diff --git a/dist/renderer/Upload pictures with PicList.workflow/Contents/Info.plist b/dist/renderer/Upload pictures with PicList.workflow/Contents/Info.plist
deleted file mode 100644
index 8b2ad60a..00000000
--- a/dist/renderer/Upload pictures with PicList.workflow/Contents/Info.plist
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
- NSServices
-
-
- NSBackgroundColorName
- background
- NSBackgroundSystemColorName
- systemBlueColor
- NSIconName
- NSTouchBarShare
- NSMenuItem
-
- default
- Upload pictures with PicList
-
- NSMessage
- runWorkflowAsService
- NSRequiredContext
-
- NSApplicationIdentifier
- com.apple.finder
-
- NSSendFileTypes
-
- public.image
-
-
-
-
-
diff --git a/dist/renderer/Upload pictures with PicList.workflow/Contents/QuickLook/Thumbnail.png b/dist/renderer/Upload pictures with PicList.workflow/Contents/QuickLook/Thumbnail.png
deleted file mode 100644
index 77815af2..00000000
Binary files a/dist/renderer/Upload pictures with PicList.workflow/Contents/QuickLook/Thumbnail.png and /dev/null differ
diff --git a/dist/renderer/Upload pictures with PicList.workflow/Contents/Resources/background.color b/dist/renderer/Upload pictures with PicList.workflow/Contents/Resources/background.color
deleted file mode 100644
index 744ae65f..00000000
Binary files a/dist/renderer/Upload pictures with PicList.workflow/Contents/Resources/background.color and /dev/null differ
diff --git a/dist/renderer/Upload pictures with PicList.workflow/Contents/document.wflow b/dist/renderer/Upload pictures with PicList.workflow/Contents/document.wflow
deleted file mode 100644
index 6917e5e3..00000000
--- a/dist/renderer/Upload pictures with PicList.workflow/Contents/document.wflow
+++ /dev/null
@@ -1,314 +0,0 @@
-
-
-
-
- AMApplicationBuild
- 444.42
- AMApplicationVersion
- 2.9
- AMDocumentVersion
- 2
- actions
-
-
- action
-
- AMAccepts
-
- Container
- List
- Optional
-
- Types
-
- com.apple.cocoa.string
-
-
- AMActionVersion
- 2.0.3
- AMApplication
-
- 自动操作
-
- AMParameterProperties
-
- COMMAND_STRING
-
- CheckedForUserDefaultShell
-
- inputMethod
-
- shell
-
- source
-
-
- AMProvides
-
- Container
- List
- Types
-
- com.apple.cocoa.string
-
-
- ActionBundlePath
- /System/Library/Automator/Run Shell Script.action
- ActionName
- 运行 Shell 脚本
- ActionParameters
-
- COMMAND_STRING
- /Applications/PicList.app/Contents/MacOS/PicList upload "$@" > /dev/null 2>&1 &
- CheckedForUserDefaultShell
-
- inputMethod
- 1
- shell
- /bin/bash
- source
-
-
- BundleIdentifier
- com.apple.RunShellScript
- CFBundleVersion
- 2.0.3
- CanShowSelectedItemsWhenRun
-
- CanShowWhenRun
-
- Category
-
- AMCategoryUtilities
-
- Class Name
- RunShellScriptAction
- InputUUID
- 79609224-28DD-4ADE-AA8F-5A6C68C18C18
- Keywords
-
- Shell
- 脚本
- 命令
- 运行
- Unix
-
- OutputUUID
- 35CD6B4C-A616-4F89-8D76-DCD3249C5B4E
- UUID
- 4350A83B-E7E6-4D2B-9768-B1D676CF58F3
- UnlocalizedApplications
-
- Automator
-
- arguments
-
- 0
-
- default value
- 0
- name
- inputMethod
- required
- 0
- type
- 0
- uuid
- 0
-
- 1
-
- default value
-
- name
- source
- required
- 0
- type
- 0
- uuid
- 1
-
- 2
-
- default value
-
- name
- CheckedForUserDefaultShell
- required
- 0
- type
- 0
- uuid
- 2
-
- 3
-
- default value
-
- name
- COMMAND_STRING
- required
- 0
- type
- 0
- uuid
- 3
-
- 4
-
- default value
- /bin/sh
- name
- shell
- required
- 0
- type
- 0
- uuid
- 4
-
-
- isViewVisible
-
- location
- 449.000000:305.000000
- nibPath
- /System/Library/Automator/Run Shell Script.action/Contents/Resources/Base.lproj/main.nib
-
- isViewVisible
-
-
-
- connectors
-
- workflowMetaData
-
- applicationBundleID
- com.apple.finder
- applicationBundleIDsByPath
-
- /System/Library/CoreServices/Finder.app
- com.apple.finder
-
- applicationPath
- /System/Library/CoreServices/Finder.app
- applicationPaths
-
- /System/Library/CoreServices/Finder.app
-
- backgroundColor
-
- YnBsaXN0MDDUAQIDBAUGNjdYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVy
- VCR0b3ASAAGGoKoHCBMUFR4kKC8zVSRudWxs1QkKCwwNDg8QERJWJGNsYXNz
- W05TQ29sb3JOYW1lXE5TQ29sb3JTcGFjZV1OU0NhdGFsb2dOYW1lV05TQ29s
- b3KACYADEAaAAoAEVlN5c3RlbV8QD3N5c3RlbUJsdWVDb2xvctUWFwsYCRka
- GxwOXE5TQ29tcG9uZW50c1VOU1JHQl8QEk5TQ3VzdG9tQ29sb3JTcGFjZUcw
- IDAgMSAxTxARMCAwIDAuOTk4MTg4OTcyNQAQAYAFgAnTHyAJISIjVE5TSURV
- TlNJQ0MQB4AGgAjSJQkmJ1dOUy5kYXRhTxEMSAAADEhMaW5vAhAAAG1udHJS
- R0IgWFlaIAfOAAIACQAGADEAAGFjc3BNU0ZUAAAAAElFQyBzUkdCAAAAAAAA
- AAAAAAAAAAD21gABAAAAANMtSFAgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEWNwcnQAAAFQAAAAM2Rlc2MAAAGE
- AAAAbHd0cHQAAAHwAAAAFGJrcHQAAAIEAAAAFHJYWVoAAAIYAAAAFGdYWVoA
- AAIsAAAAFGJYWVoAAAJAAAAAFGRtbmQAAAJUAAAAcGRtZGQAAALEAAAAiHZ1
- ZWQAAANMAAAAhnZpZXcAAAPUAAAAJGx1bWkAAAP4AAAAFG1lYXMAAAQMAAAA
- JHRlY2gAAAQwAAAADHJUUkMAAAQ8AAAIDGdUUkMAAAQ8AAAIDGJUUkMAAAQ8
- AAAIDHRleHQAAAAAQ29weXJpZ2h0IChjKSAxOTk4IEhld2xldHQtUGFja2Fy
- ZCBDb21wYW55AABkZXNjAAAAAAAAABJzUkdCIElFQzYxOTY2LTIuMQAAAAAA
- AAAAAAAAEnNSR0IgSUVDNjE5NjYtMi4xAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABYWVogAAAAAAAA81EAAQAA
- AAEWzFhZWiAAAAAAAAAAAAAAAAAAAAAAWFlaIAAAAAAAAG+iAAA49QAAA5BY
- WVogAAAAAAAAYpkAALeFAAAY2lhZWiAAAAAAAAAkoAAAD4QAALbPZGVzYwAA
- AAAAAAAWSUVDIGh0dHA6Ly93d3cuaWVjLmNoAAAAAAAAAAAAAAAWSUVDIGh0
- dHA6Ly93d3cuaWVjLmNoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAGRlc2MAAAAAAAAALklFQyA2MTk2Ni0yLjEgRGVm
- YXVsdCBSR0IgY29sb3VyIHNwYWNlIC0gc1JHQgAAAAAAAAAAAAAALklFQyA2
- MTk2Ni0yLjEgRGVmYXVsdCBSR0IgY29sb3VyIHNwYWNlIC0gc1JHQgAAAAAA
- AAAAAAAAAAAAAAAAAAAAAABkZXNjAAAAAAAAACxSZWZlcmVuY2UgVmlld2lu
- ZyBDb25kaXRpb24gaW4gSUVDNjE5NjYtMi4xAAAAAAAAAAAAAAAsUmVmZXJl
- bmNlIFZpZXdpbmcgQ29uZGl0aW9uIGluIElFQzYxOTY2LTIuMQAAAAAAAAAA
- AAAAAAAAAAAAAAAAAAAAAAAAdmlldwAAAAAAE6T+ABRfLgAQzxQAA+3MAAQT
- CwADXJ4AAAABWFlaIAAAAAAATAlWAFAAAABXH+dtZWFzAAAAAAAAAAEAAAAA
- AAAAAAAAAAAAAAAAAAACjwAAAAJzaWcgAAAAAENSVCBjdXJ2AAAAAAAABAAA
- AAAFAAoADwAUABkAHgAjACgALQAyADcAOwBAAEUASgBPAFQAWQBeAGMAaABt
- AHIAdwB8AIEAhgCLAJAAlQCaAJ8ApACpAK4AsgC3ALwAwQDGAMsA0ADVANsA
- 4ADlAOsA8AD2APsBAQEHAQ0BEwEZAR8BJQErATIBOAE+AUUBTAFSAVkBYAFn
- AW4BdQF8AYMBiwGSAZoBoQGpAbEBuQHBAckB0QHZAeEB6QHyAfoCAwIMAhQC
- HQImAi8COAJBAksCVAJdAmcCcQJ6AoQCjgKYAqICrAK2AsECywLVAuAC6wL1
- AwADCwMWAyEDLQM4A0MDTwNaA2YDcgN+A4oDlgOiA64DugPHA9MD4APsA/kE
- BgQTBCAELQQ7BEgEVQRjBHEEfgSMBJoEqAS2BMQE0wThBPAE/gUNBRwFKwU6
- BUkFWAVnBXcFhgWWBaYFtQXFBdUF5QX2BgYGFgYnBjcGSAZZBmoGewaMBp0G
- rwbABtEG4wb1BwcHGQcrBz0HTwdhB3QHhgeZB6wHvwfSB+UH+AgLCB8IMghG
- CFoIbgiCCJYIqgi+CNII5wj7CRAJJQk6CU8JZAl5CY8JpAm6Cc8J5Qn7ChEK
- Jwo9ClQKagqBCpgKrgrFCtwK8wsLCyILOQtRC2kLgAuYC7ALyAvhC/kMEgwq
- DEMMXAx1DI4MpwzADNkM8w0NDSYNQA1aDXQNjg2pDcMN3g34DhMOLg5JDmQO
- fw6bDrYO0g7uDwkPJQ9BD14Peg+WD7MPzw/sEAkQJhBDEGEQfhCbELkQ1xD1
- ERMRMRFPEW0RjBGqEckR6BIHEiYSRRJkEoQSoxLDEuMTAxMjE0MTYxODE6QT
- xRPlFAYUJxRJFGoUixStFM4U8BUSFTQVVhV4FZsVvRXgFgMWJhZJFmwWjxay
- FtYW+hcdF0EXZReJF64X0hf3GBsYQBhlGIoYrxjVGPoZIBlFGWsZkRm3Gd0a
- BBoqGlEadxqeGsUa7BsUGzsbYxuKG7Ib2hwCHCocUhx7HKMczBz1HR4dRx1w
- HZkdwx3sHhYeQB5qHpQevh7pHxMfPh9pH5Qfvx/qIBUgQSBsIJggxCDwIRwh
- SCF1IaEhziH7IiciVSKCIq8i3SMKIzgjZiOUI8Ij8CQfJE0kfCSrJNolCSU4
- JWgllyXHJfcmJyZXJocmtyboJxgnSSd6J6sn3CgNKD8ocSiiKNQpBik4KWsp
- nSnQKgIqNSpoKpsqzysCKzYraSudK9EsBSw5LG4soizXLQwtQS12Last4S4W
- Lkwugi63Lu4vJC9aL5Evxy/+MDUwbDCkMNsxEjFKMYIxujHyMioyYzKbMtQz
- DTNGM38zuDPxNCs0ZTSeNNg1EzVNNYc1wjX9Njc2cjauNuk3JDdgN5w31zgU
- OFA4jDjIOQU5Qjl/Obw5+To2OnQ6sjrvOy07azuqO+g8JzxlPKQ84z0iPWE9
- oT3gPiA+YD6gPuA/IT9hP6I/4kAjQGRApkDnQSlBakGsQe5CMEJyQrVC90M6
- Q31DwEQDREdEikTORRJFVUWaRd5GIkZnRqtG8Ec1R3tHwEgFSEtIkUjXSR1J
- Y0mpSfBKN0p9SsRLDEtTS5pL4kwqTHJMuk0CTUpNk03cTiVObk63TwBPSU+T
- T91QJ1BxULtRBlFQUZtR5lIxUnxSx1MTU19TqlP2VEJUj1TbVShVdVXCVg9W
- XFapVvdXRFeSV+BYL1h9WMtZGllpWbhaB1pWWqZa9VtFW5Vb5Vw1XIZc1l0n
- XXhdyV4aXmxevV8PX2Ffs2AFYFdgqmD8YU9homH1YklinGLwY0Njl2PrZEBk
- lGTpZT1lkmXnZj1mkmboZz1nk2fpaD9olmjsaUNpmmnxakhqn2r3a09rp2v/
- bFdsr20IbWBtuW4SbmtuxG8eb3hv0XArcIZw4HE6cZVx8HJLcqZzAXNdc7h0
- FHRwdMx1KHWFdeF2Pnabdvh3VnezeBF4bnjMeSp5iXnnekZ6pXsEe2N7wnwh
- fIF84X1BfaF+AX5ifsJ/I3+Ef+WAR4CogQqBa4HNgjCCkoL0g1eDuoQdhICE
- 44VHhauGDoZyhteHO4efiASIaYjOiTOJmYn+imSKyoswi5aL/IxjjMqNMY2Y
- jf+OZo7OjzaPnpAGkG6Q1pE/kaiSEZJ6kuOTTZO2lCCUipT0lV+VyZY0lp+X
- Cpd1l+CYTJi4mSSZkJn8mmia1ZtCm6+cHJyJnPedZJ3SnkCerp8dn4uf+qBp
- oNihR6G2oiailqMGo3aj5qRWpMelOKWpphqmi6b9p26n4KhSqMSpN6mpqhyq
- j6sCq3Wr6axcrNCtRK24ri2uoa8Wr4uwALB1sOqxYLHWskuywrM4s660JbSc
- tRO1irYBtnm28Ldot+C4WbjRuUq5wro7urW7LrunvCG8m70VvY++Cr6Evv+/
- er/1wHDA7MFnwePCX8Lbw1jD1MRRxM7FS8XIxkbGw8dBx7/IPci8yTrJuco4
- yrfLNsu2zDXMtc01zbXONs62zzfPuNA50LrRPNG+0j/SwdNE08bUSdTL1U7V
- 0dZV1tjXXNfg2GTY6Nls2fHadtr724DcBdyK3RDdlt4c3qLfKd+v4DbgveFE
- 4cziU+Lb42Pj6+Rz5PzlhOYN5pbnH+ep6DLovOlG6dDqW+rl63Dr++yG7RHt
- nO4o7rTvQO/M8Fjw5fFy8f/yjPMZ86f0NPTC9VD13vZt9vv3ivgZ+Kj5OPnH
- +lf65/t3/Af8mP0p/br+S/7c/23//4AH0ikqKyxaJGNsYXNzbmFtZVgkY2xh
- c3Nlc11OU011dGFibGVEYXRhoystLlZOU0RhdGFYTlNPYmplY3TSKSowMVxO
- U0NvbG9yU3BhY2WiMi5cTlNDb2xvclNwYWNl0ikqNDVXTlNDb2xvcqI0Ll8Q
- D05TS2V5ZWRBcmNoaXZlctE4OVRyb290gAEACAARABoAIwAtADIANwBCAEgA
- UwBaAGYAcwCBAIkAiwCNAI8AkQCTAJoArAC3AMQAygDfAOcA+wD9AP8BAQEI
- AQ0BEwEVARcBGQEeASYNcg10DXkNhA2NDZsNnw2mDa8NtA3BDcQN0Q3WDd4N
- 4Q3zDfYN+wAAAAAAAAIBAAAAAAAAADoAAAAAAAAAAAAAAAAAAA39
-
- backgroundColorName
- systemBlueColor
- inputTypeIdentifier
- com.apple.Automator.fileSystemObject.image
- outputTypeIdentifier
- com.apple.Automator.nothing
- presentationMode
- 15
- processesInput
- 0
- serviceApplicationBundleID
- com.apple.finder
- serviceApplicationPath
- /System/Library/CoreServices/Finder.app
- serviceInputTypeIdentifier
- com.apple.Automator.fileSystemObject.image
- serviceOutputTypeIdentifier
- com.apple.Automator.nothing
- serviceProcessesInput
- 0
- systemImageName
- NSTouchBarShare
- useAutomaticInputType
- 0
- workflowTypeIdentifier
- com.apple.Automator.servicesMenu
-
-
-
diff --git a/dist/renderer/assets/BucketPage-B7rY7eY7.js b/dist/renderer/assets/BucketPage-B7rY7eY7.js
deleted file mode 100644
index b1e8aa43..00000000
--- a/dist/renderer/assets/BucketPage-B7rY7eY7.js
+++ /dev/null
@@ -1,4283 +0,0 @@
-import { d as defineComponent, r as ref, o as onBeforeMount, N as createBlock, e as openBlock, y as resolveComponent, u as unref, v as withCtx, q as createVNode, ax as loading_default, am as computed, D as watch, M as onMounted, m as triggerRPC, j as IRPCActionType, ay as ElImage, az as ElIcon, a as reactive, al as useRoute, T, s as sendRPC, aA as ElTooltip, aB as ElLink, aC as ElTag, aD as ElProgress, ao as folder_opened_default, aE as document_default, aF as ElCheckbox, aG as ElPopover, aH as circle_close_default, aI as download_default, aJ as edit_default, aK as ElDropdown, aL as ElDropdownMenu, aM as ElDropdownItem, aN as copy_document_default, aO as delete_filled_default, b as onBeforeUnmount, w as withDirectives, i as resolveDirective, c as createElementBlock, f as createBaseVNode, g as createCommentVNode, aP as ElButton, aQ as arrow_right_default, t as toDisplayString, J as ElMessage, au as ElNotification, ae as ElMessageBox, F as Fragment, h as renderList, B as createTextVNode, aR as upload_default, a0 as upload_filled_default, aS as folder_add_default, a7 as link_default, aT as refresh_default, aq as home_filled_default, aU as coin_default, aV as sort_default, aW as grid_default, aX as fold_default, aY as ElCard, x as withModifiers, n as normalizeClass, ap as folder_default, A as close_default, a8 as info_filled_default } from "./index-BqdcQlNn.js";
-import { d } from "./marked.esm-D58Rgktj.js";
-import { g as getFileIconPath, f as formatFileSize, a as customStrMatch, b as formatFileName, d as formatLink, s as svg, v as v4, c as customRenameFormatTable, i as isValidUrl, e as customStrReplace, r as renameFile } from "./common-REXFY3_s.js";
-import { f as formatEndpoint, t as trimPath } from "./common-DNjr697i.js";
-import { f as fileCacheDbInstance } from "./bucketFileDb-qvw68roE.js";
-import { u as useManageStore, a as useDownloadFileTransferStore, b as useFileTransferStore } from "./manageStore-EteLCVxq.js";
-import { g as getConfig, s as saveConfig } from "./dataSender-Bg45AIFL.js";
-import { c as cancelDownloadLoadingFileList, r as refreshDownloadFileTransferList } from "./static-DltyNkMh.js";
-const _sfc_main$3 = /* @__PURE__ */ defineComponent({
- __name: "ImageLocal",
- props: {
- isShowThumbnail: { type: Boolean },
- item: {},
- localPath: {}
- },
- setup(__props) {
- const base64Image = ref("");
- const props = __props;
- const createBase64Image = async () => {
- const filePath = window.node.path.normalize(props.localPath);
- const base64 = await window.node.fs.readFile(filePath, "base64");
- base64Image.value = `data:${window.node.mime.lookup(filePath) || "image/png"};base64,${base64}`;
- };
- onBeforeMount(async () => {
- try {
- await createBase64Image();
- } catch (e) {
- console.log(e);
- }
- });
- return (_ctx, _cache) => {
- const _component_el_icon = resolveComponent("el-icon");
- const _component_el_image = resolveComponent("el-image");
- return openBlock(), createBlock(_component_el_image, {
- src: _ctx.isShowThumbnail && _ctx.item.isImage ? base64Image.value : require(`../manage/pages/assets/icons/${unref(getFileIconPath)(_ctx.item.fileName ?? "")}`),
- fit: "contain",
- style: { "height": "100px", "width": "100%", "margin": "0 auto" }
- }, {
- placeholder: withCtx(() => [
- createVNode(_component_el_icon, null, {
- default: withCtx(() => [
- createVNode(unref(loading_default))
- ]),
- _: 1
- })
- ]),
- error: withCtx(() => [
- createVNode(_component_el_image, {
- src: require(`../manage/pages/assets/icons/${unref(getFileIconPath)(_ctx.item.fileName ?? "")}`),
- fit: "contain",
- style: { "height": "100px", "width": "100%", "margin": "0 auto" }
- }, null, 8, ["src"])
- ]),
- _: 1
- }, 8, ["src"]);
- };
- }
-});
-const _sfc_main$2 = /* @__PURE__ */ defineComponent({
- __name: "ImagePreSign",
- props: {
- item: {},
- alias: {},
- url: {},
- config: {},
- isShowThumbnail: { type: Boolean }
- },
- setup(__props) {
- const preSignedUrl = ref("");
- const props = __props;
- const imageSource = computed(() => {
- return props.isShowThumbnail && props.item.isImage ? preSignedUrl.value : require(`../manage/pages/assets/icons/${getFileIconPath(props.item.fileName ?? "")}`);
- });
- const iconPath = computed(() => require(`../manage/pages/assets/icons/${getFileIconPath(props.item.fileName ?? "")}`));
- async function getUrl() {
- preSignedUrl.value = await triggerRPC(IRPCActionType.MANAGE_GET_PRE_SIGNED_URL, props.alias, props.config);
- }
- watch(() => [props.url, props.item], getUrl, { deep: true });
- onMounted(getUrl);
- return (_ctx, _cache) => {
- const _component_el_icon = resolveComponent("el-icon");
- const _component_el_image = resolveComponent("el-image");
- return openBlock(), createBlock(_component_el_image, {
- src: imageSource.value,
- fit: "contain",
- style: { "height": "100px", "width": "100%", "margin": "0 auto" }
- }, {
- placeholder: withCtx(() => [
- createVNode(_component_el_icon, null, {
- default: withCtx(() => [
- createVNode(unref(loading_default))
- ]),
- _: 1
- })
- ]),
- error: withCtx(() => [
- createVNode(_component_el_image, {
- src: iconPath.value,
- fit: "contain",
- style: { "height": "100px", "width": "100%", "margin": "0 auto" }
- }, null, 8, ["src"])
- ]),
- _: 1
- }, 8, ["src"]);
- };
- }
-});
-const ImagePreSignTsx = defineComponent({
- props: {
- isShowThumbnail: {
- type: Boolean,
- required: true
- },
- item: {
- type: Object,
- required: true
- },
- alias: {
- type: String,
- required: true
- },
- url: {
- type: String,
- required: true
- },
- config: {
- type: Object,
- required: true
- }
- },
- setup(props) {
- const preSignedUrl = ref("");
- const imageSource = computed(() => {
- return props.isShowThumbnail && props.item.isImage ? preSignedUrl.value : require(`../manage/pages/assets/icons/${getFileIconPath(props.item.fileName ?? "")}`);
- });
- const iconPath = computed(
- () => require(`../manage/pages/assets/icons/${getFileIconPath(props.item.fileName ?? "")}`)
- );
- async function getUrl() {
- preSignedUrl.value = await triggerRPC(IRPCActionType.MANAGE_GET_PRE_SIGNED_URL, props.alias, props.config);
- }
- watch(() => [props.url, props.item], getUrl, { deep: true });
- onMounted(getUrl);
- return () => /* @__PURE__ */ React.createElement(ElImage, { src: imageSource.value, fit: "contain", style: "height: 100px;width: 100%;margin: 0 auto;" }, {
- placeholder: () => /* @__PURE__ */ React.createElement(ElIcon, null, /* @__PURE__ */ React.createElement(loading_default, null)),
- error: () => /* @__PURE__ */ React.createElement(ElImage, { src: iconPath.value, fit: "contain", style: "height: 100px;width: 100%;margin: 0 auto;" })
- });
- }
-});
-const AUTH_KEY_VALUE_RE = /(\w+)=["']?([^'"]{1,10000})["']?/;
-let NC = 0;
-const NC_PAD = "00000000";
-function md5(text) {
- return window.node.crypto.createHash("md5").update(text).digest("hex");
-}
-function digestAuthHeader(method, uri, wwwAuthenticate, username, password) {
- const parts = wwwAuthenticate.split(",");
- const opts = {};
- for (const i of parts) {
- const m = AUTH_KEY_VALUE_RE.exec(i);
- if (m) {
- opts[m[1]] = m[2].replace(/["']/g, "");
- }
- }
- if (!opts.realm || !opts.nonce) {
- return "";
- }
- let qop = opts.qop || "";
- const userpassArray = [username, password];
- let nc = String(++NC);
- nc = NC_PAD.substring(nc.length) + nc;
- const cnonce = window.node.crypto.randomBytes(8).toString("hex");
- const ha1 = md5(userpassArray[0] + ":" + opts.realm + ":" + userpassArray[1]);
- const ha2 = md5(method.toUpperCase() + ":" + uri);
- let s = ha1 + ":" + opts.nonce;
- if (qop) {
- qop = qop.split(",")[0];
- s += ":" + nc + ":" + cnonce + ":" + qop;
- }
- s += ":" + ha2;
- const response = md5(s);
- let authstring = 'Digest username="' + userpassArray[0] + '", realm="' + opts.realm + '", nonce="' + opts.nonce + '", uri="' + uri + '", response="' + response + '"';
- if (opts.opaque) {
- authstring += ', opaque="' + opts.opaque + '"';
- }
- if (qop) {
- authstring += ", qop=" + qop + ", nc=" + nc + ', cnonce="' + cnonce + '"';
- }
- return authstring;
-}
-async function getAuthHeader(method, host, uri, username, password) {
- try {
- await window.node.axios.get(`${host}${uri}`);
- } catch (error) {
- if (error.response.status === 401 && error.response.headers["www-authenticate"]) {
- return digestAuthHeader(method, uri, error.response.headers["www-authenticate"], username, password);
- }
- }
-}
-const _sfc_main$1 = /* @__PURE__ */ defineComponent({
- __name: "ImageWebdav",
- props: {
- item: {},
- url: {},
- config: {},
- isShowThumbnail: { type: Boolean }
- },
- setup(__props) {
- const base64Url = ref("");
- const success = ref(false);
- const props = __props;
- const imageSource = computed(() => {
- return props.isShowThumbnail && props.item.isImage && success.value ? base64Url.value : require(`../manage/pages/assets/icons/${getFileIconPath(props.item.fileName ?? "")}`);
- });
- const iconPath = computed(() => require(`../manage/pages/assets/icons/${getFileIconPath(props.item.fileName ?? "")}`));
- async function getWebdavHeader(key) {
- let headers = {};
- if (props.config.authType === "digest") {
- const authHeader = await getAuthHeader(
- "GET",
- formatEndpoint(props.config.endpoint, props.config.sslEnabled || false),
- `/${key.replace(/^\//, "")}`,
- props.config.username,
- props.config.password
- );
- headers = {
- Authorization: authHeader
- };
- } else {
- headers = {
- Authorization: "Basic " + Buffer.from(`${props.config.username}:${props.config.password}`).toString("base64")
- };
- }
- return headers;
- }
- const fetchImage = async () => {
- try {
- const headers = await getWebdavHeader(props.item.key);
- const res = await fetch(props.url, { method: "GET", headers });
- if (res.status >= 200 && res.status < 300) {
- const blob = await res.blob();
- success.value = true;
- base64Url.value = URL.createObjectURL(blob);
- } else {
- throw new Error("Network response was not ok.");
- }
- } catch (err) {
- success.value = false;
- console.log(err);
- }
- };
- watch(() => [props.url, props.item], fetchImage, { deep: true });
- onMounted(fetchImage);
- return (_ctx, _cache) => {
- const _component_el_icon = resolveComponent("el-icon");
- const _component_el_image = resolveComponent("el-image");
- return openBlock(), createBlock(_component_el_image, {
- src: imageSource.value,
- fit: "contain",
- style: { "height": "100px", "width": "100%", "margin": "0 auto" }
- }, {
- placeholder: withCtx(() => [
- createVNode(_component_el_icon, null, {
- default: withCtx(() => [
- createVNode(unref(loading_default))
- ]),
- _: 1
- })
- ]),
- error: withCtx(() => [
- createVNode(_component_el_image, {
- src: iconPath.value,
- fit: "contain",
- style: { "height": "100px", "width": "100%", "margin": "0 auto" }
- }, null, 8, ["src"])
- ]),
- _: 1
- }, 8, ["src"]);
- };
- }
-});
-const ImageWebdavTsx = defineComponent({
- props: {
- isShowThumbnail: {
- type: Boolean,
- required: true
- },
- item: {
- type: Object,
- required: true
- },
- url: {
- type: String,
- required: true
- },
- config: {
- type: Object,
- required: true
- }
- },
- setup(props) {
- const base64Url = ref("");
- const success = ref(false);
- const imageSource = computed(() => {
- return props.isShowThumbnail && props.item.isImage && success.value ? base64Url.value : require(`../manage/pages/assets/icons/${getFileIconPath(props.item.fileName ?? "")}`);
- });
- const iconPath = computed(
- () => require(`../manage/pages/assets/icons/${getFileIconPath(props.item.fileName ?? "")}`)
- );
- async function getWebdavHeader(key) {
- let headers = {};
- if (props.config.authType === "digest") {
- const authHeader = await getAuthHeader(
- "GET",
- formatEndpoint(props.config.endpoint, props.config.sslEnabled || false),
- `/${key.replace(/^\//, "")}`,
- props.config.username,
- props.config.password
- );
- headers = {
- Authorization: authHeader
- };
- } else {
- headers = {
- Authorization: "Basic " + Buffer.from(`${props.config.username}:${props.config.password}`).toString("base64")
- };
- }
- return headers;
- }
- const fetchImage = async () => {
- try {
- const headers = await getWebdavHeader(props.item.key);
- const res = await fetch(props.url, { method: "GET", headers });
- if (res.status >= 200 && res.status < 300) {
- const blob = await res.blob();
- success.value = true;
- base64Url.value = URL.createObjectURL(blob);
- } else {
- throw new Error("Network response was not ok.");
- }
- } catch (err) {
- success.value = false;
- console.log(err);
- }
- };
- watch(() => [props.url, props.item], fetchImage, { deep: true });
- onMounted(fetchImage);
- return () => /* @__PURE__ */ React.createElement(ElImage, { src: imageSource.value, fit: "contain", style: "height: 100px;width: 100%;margin: 0 auto;" }, {
- placeholder: () => /* @__PURE__ */ React.createElement(ElIcon, null, /* @__PURE__ */ React.createElement(loading_default, null)),
- error: () => /* @__PURE__ */ React.createElement(ElImage, { src: iconPath.value, fit: "contain", style: "height: 100px;width: 100%;margin: 0 auto;" })
- });
- }
-});
-const textFileExt = [
- ".applescript",
- ".bat",
- ".c",
- ".cmd",
- ".condarc",
- ".conf",
- ".config",
- ".cpp",
- ".css",
- ".csv",
- ".dart",
- ".eslintignore",
- ".gitattributes",
- ".gitconfig",
- ".gitignore",
- ".gitkeep",
- ".gitmodules",
- ".go",
- ".h",
- ".hpp",
- ".htm",
- ".html",
- ".ini",
- ".java",
- ".js",
- ".json",
- ".jsx",
- ".lock",
- ".log",
- ".php",
- ".prop",
- ".properties",
- ".ps1",
- ".py",
- ".rc",
- ".sh",
- ".ts",
- ".tsv",
- ".tsx",
- ".txt",
- ".vue",
- ".xml",
- ".yaml",
- ".yml",
- ".yarnrc",
- "license"
-];
-const videoExt = [
- ".aac",
- ".amv",
- ".avi",
- ".flac",
- ".flv",
- ".m2ts",
- ".m4a",
- ".m4v",
- ".mp3",
- ".mpeg",
- ".mpg",
- ".mts",
- ".ogg",
- ".ogv",
- ".vob",
- ".wav",
- ".webm",
- ".mp4",
- ".3g2",
- ".3gp",
- ".asf",
- ".mov",
- ".mxf",
- ".rm",
- ".rmvb",
- ".wmv",
- ".mkv"
-];
-const _hoisted_1 = ["element-loading-text", "element-loading-spinner"];
-const _hoisted_2 = { class: "layout-header" };
-const _hoisted_3 = { style: { "flex-grow": "1", "margin-left": "16px" } };
-const _hoisted_4 = { key: 0 };
-const _hoisted_5 = { class: "header-dir-view" };
-const _hoisted_6 = { class: "dir-layout" };
-const _hoisted_7 = { style: { "flex-grow": "1", "flex-shrink": "1", "overflow-x": "auto", "margin-right": "10px" } };
-const _hoisted_8 = { class: "header-info-view" };
-const _hoisted_9 = { style: { "margin-right": "5px", "padding-left": "5px" } };
-const _hoisted_10 = { style: { "padding-left": "5px" } };
-const _hoisted_11 = {
- key: 0,
- class: "header-buttom-view"
-};
-const _hoisted_12 = {
- key: 1,
- class: "header-buttom-view"
-};
-const _hoisted_13 = {
- key: 0,
- class: "layout-table",
- style: { "margin": "0 15px 15px 15px", "overflow-y": "auto", "overflow-x": "hidden", "height": "80vh" }
-};
-const _hoisted_14 = {
- key: 1,
- class: "layout-grid",
- style: { "margin": "0 15px 15px 15px", "overflow-y": "auto", "overflow-x": "hidden", "height": "80vh" }
-};
-const _hoisted_15 = ["onClick"];
-const _hoisted_16 = { style: { "font-weight": "500" } };
-const _hoisted_17 = { style: { "font-weight": "500", "word-break": "break-all" } };
-const _hoisted_18 = {
- key: 0,
- id: "upload-dragger",
- style: { "position": "relative", "top": "0", "right": "0", "height": "100%", "width": "100%", "display": "flex", "justify-content": "center", "align-items": "center" }
-};
-const _hoisted_19 = {
- class: "upload-dragger__text",
- style: { "color": "orange", "font-size": "2.5vh", "font-family": "Arial, Helvetica, sans-serif", "align-items": "center", "display": "flex", "justify-content": "center", "flex-direction": "column" }
-};
-const _hoisted_20 = { style: { "color": "#409eff", "font-size": "2.5vh", "font-family": "Arial, Helvetica, sans-serif", "align-items": "center", "display": "flex", "justify-content": "center", "flex-direction": "column" } };
-const _hoisted_21 = { style: { "display": "flex", "justify-content": "center", "align-items": "center" } };
-const _hoisted_22 = { style: { "height": "500px" } };
-const _hoisted_23 = { style: { "height": "500px" } };
-const _hoisted_24 = { style: { "height": "500px" } };
-const _hoisted_25 = { style: { "height": "600px" } };
-const _hoisted_26 = { style: { "height": "600px" } };
-const _hoisted_27 = { style: { "height": "600px" } };
-const _hoisted_28 = ["innerHTML"];
-const _hoisted_29 = { style: { "margin-top": "10px", "align-items": "center", "display": "flex", "justify-content": "flex-end" } };
-const _sfc_main = /* @__PURE__ */ defineComponent({
- __name: "BucketPage",
- setup(__props) {
- const getExtension = (fileName) => window.node.path.extname(fileName).slice(1);
- const linkFormatArray = [
- { key: "Url", value: "url" },
- { key: "Markdown", value: "markdown" },
- { key: "Markdown-link", value: "markdown-with-link" },
- { key: "Html", value: "html" },
- { key: "BBCode", value: "bbcode" },
- { key: "Custom", value: "custom" }
- ];
- const linkFormatList = ["url", "markdown", "markdown-with-link", "html", "bbcode", "custom"];
- const sortTypeList = ["name", "size", "time", "ext", "check", "init"];
- const route = useRoute();
- const manageStore = useManageStore();
- const configMap = reactive(JSON.parse(route.query.configMap));
- const isLoadingData = ref(false);
- const isShowLoadingPage = ref(false);
- const isShowImagePreview = ref(false);
- const layoutStyle = ref("grid");
- const fileTable = ref(null);
- const isShowFileInfo = ref(false);
- const currentShowedFileInfo = ref({});
- const currentPageNumber = ref(1);
- const pagingMarker = ref("");
- const pagingMarkerStack = reactive([]);
- const currentPageFilesInfo = reactive([]);
- const currentPrefix = ref("/");
- const fileSortExtReverse = ref(false);
- const fileSortNameReverse = ref(false);
- const fileSortSizeReverse = ref(false);
- const fileSortTimeReverse = ref(false);
- const searchText = ref("");
- const isDragover = ref(false);
- const tableData = reactive([]);
- const isShowUploadPanel = ref(false);
- const activeUpLoadTab = ref("uploading");
- const uploadTaskList = ref([]);
- const refreshUploadTaskId = ref(void 0);
- const uploadPanelFilesList = ref([]);
- const cancelToken = ref("");
- const isLoadingUploadPanelFiles = ref(false);
- const isUploadKeepDirStructure = computed(() => manageStore.config.settings.isUploadKeepDirStructure ?? true);
- const uploadingTaskList = computed(
- () => uploadTaskList.value.filter((item) => ["uploading", "queuing", "paused"].includes(item.status))
- );
- const uploadedTaskList = computed(
- () => uploadTaskList.value.filter((item) => ["uploaded", "failed", "canceled"].includes(item.status))
- );
- const isShowDownloadPanel = ref(false);
- const isLoadingDownloadData = ref(false);
- const activeDownLoadTab = ref("downloading");
- const currentDownloadFileList = reactive([]);
- const downloadTaskList = ref([]);
- const refreshDownloadTaskId = ref(void 0);
- const downloadCancelToken = ref("");
- const downloadingTaskList = computed(
- () => downloadTaskList.value.filter((item) => ["downloading", "queuing", "paused"].includes(item.status))
- );
- const downloadedTaskList = computed(
- () => downloadTaskList.value.filter((item) => ["downloaded", "failed", "canceled"].includes(item.status))
- );
- const dialogVisible = ref(false);
- const urlToUpload = ref("");
- const previewedImage = ref("");
- const filterList = computed(() => {
- return getList();
- });
- const selectedItems = computed(() => filterList.value.filter((item) => item.checked));
- const ImagePreviewList = computed(() => filterList.value.filter((item) => item.isImage).map((item) => item.url));
- const getCurrentPreviewIndex = computed(() => ImagePreviewList.value.indexOf(previewedImage.value));
- const isShiftKeyPress = ref(false);
- const lastChoosed = ref(-1);
- const customDomainList = ref([]);
- const currentCustomDomain = ref("");
- const isShowCustomDomainSelectList = computed(
- () => ["tcyun", "aliyun", "qiniu", "github"].includes(currentPicBedName.value)
- );
- const isShowCustomDomainInput = computed(
- () => ["aliyun", "qiniu", "tcyun", "s3plist", "webdavplist", "local", "sftp"].includes(currentPicBedName.value)
- );
- const isAutoCustomDomain = computed(
- () => manageStore.config.picBed[configMap.alias].isAutoCustomUrl === void 0 ? true : manageStore.config.picBed[configMap.alias].isAutoCustomUrl
- );
- const isShowMarkDownDialog = ref(false);
- const markDownContent = ref("");
- const isShowTextFileDialog = ref(false);
- const textfileContent = ref("");
- const isShowVideoFileDialog = ref(false);
- const videoFileUrl = ref("");
- const videoPlayerHeaders = ref({});
- const isShowRenameFileIcon = computed(
- () => ["tcyun", "aliyun", "qiniu", "upyun", "s3plist", "webdavplist", "local", "sftp"].includes(currentPicBedName.value)
- );
- const isShowBatchRenameDialog = ref(false);
- const batchRenameMatch = ref("");
- const batchRenameReplace = ref("");
- const isRenameIncludeExt = ref(false);
- const isSingleRename = ref(false);
- const itemToBeRenamed = ref({});
- let fileTransferInterval;
- let downloadInterval;
- const currentPicBedName = computed(() => manageStore.config.picBed[configMap.alias].picBedName);
- const paging = computed(() => manageStore.config.picBed[configMap.alias].paging);
- const itemsPerPage = computed(() => manageStore.config.picBed[configMap.alias].itemsPerPage);
- const calculateAllFileSize = computed(
- () => formatFileSize(currentPageFilesInfo.reduce((total, item) => total + item.fileSize, 0)) || "0"
- );
- const isShowThumbnail = computed(() => manageStore.config.settings.isShowThumbnail ?? false);
- const isUsePreSignedUrl = computed(() => manageStore.config.settings.isUsePreSignedUrl ?? false);
- const isAutoRefresh = computed(() => manageStore.config.settings.isAutoRefresh ?? false);
- const isIgnoreCase = computed(() => manageStore.config.settings.isIgnoreCase ?? false);
- const isShowCreateNewFolder = computed(
- () => ["aliyun", "github", "local", "qiniu", "tcyun", "s3plist", "upyun", "webdavplist", "sftp"].includes(
- currentPicBedName.value
- )
- );
- const isShowPresignedUrl = computed(
- () => ["aliyun", "github", "qiniu", "s3plist", "tcyun", "webdavplist"].includes(currentPicBedName.value)
- );
- function getList() {
- if (!searchText.value) {
- return currentPageFilesInfo;
- }
- return currentPageFilesInfo.filter((item) => {
- if (isIgnoreCase.value) {
- return item.fileName.toLowerCase().includes(searchText.value.toLowerCase());
- } else {
- return item.fileName.includes(searchText.value);
- }
- });
- }
- function handleUploadKeepDirChange(val) {
- saveConfig("settings.isUploadKeepDirStructure", !!val);
- manageStore.refreshConfig();
- }
- function showUploadDialog() {
- isShowUploadPanel.value = true;
- }
- function startRefreshUploadTask() {
- refreshUploadTaskId.value = setInterval(() => {
- triggerRPC(IRPCActionType.MANAGE_GET_UPLOAD_TASK_LIST).then((res) => {
- uploadTaskList.value = res;
- });
- }, 300);
- }
- function stopRefreshUploadTask() {
- refreshUploadTaskId.value && clearInterval(refreshUploadTaskId.value);
- }
- function handleGetWebdavConfig() {
- return manageStore.config.picBed[configMap.alias];
- }
- function showDownloadDialog() {
- isShowDownloadPanel.value = true;
- }
- function startRefreshDownloadTask() {
- refreshDownloadTaskId.value = setInterval(() => {
- triggerRPC(IRPCActionType.MANAGE_GET_DOWNLOAD_TASK_LIST).then((res) => {
- downloadTaskList.value = res;
- });
- }, 300);
- }
- function stopRefreshDownloadTask() {
- refreshDownloadTaskId.value && clearInterval(refreshDownloadTaskId.value);
- }
- function handleViewChange(val) {
- saveConfig("settings.isShowList", val === "list");
- layoutStyle.value = val;
- }
- function openFileSelectDialog() {
- triggerRPC(IRPCActionType.MANAGE_OPEN_FILE_SELECT_DIALOG).then((res) => {
- if (res) {
- res.forEach((item) => {
- tableData.push({
- fileSize: window.node.fs.statSync(item).size,
- isFolder: false,
- name: window.node.path.basename(item),
- filesList: []
- });
- const index = uploadPanelFilesList.value.findIndex((file) => file.path === item);
- if (index === -1) {
- uploadPanelFilesList.value.push({
- name: window.node.path.basename(item),
- path: item,
- size: window.node.fs.statSync(item).size
- });
- }
- });
- }
- });
- }
- function onDrop(e) {
- isDragover.value = false;
- const items = e.dataTransfer?.items;
- if (items) {
- webkitReadDataTransfer(e.dataTransfer);
- }
- }
- function webkitReadDataTransfer(dataTransfer) {
- isLoadingUploadPanelFiles.value = true;
- let fileNum = dataTransfer.items.length;
- const decrement = () => {
- fileNum--;
- if (fileNum === 0) {
- files.forEach((item) => {
- const index = uploadPanelFilesList.value.findIndex((file) => file.path === item.path);
- if (index === -1) {
- uploadPanelFilesList.value.push({
- name: item.name,
- path: item.path,
- size: item.size,
- relativePath: item.relativePath
- });
- }
- });
- handleUploadFiles(files);
- isLoadingUploadPanelFiles.value = false;
- }
- };
- const files = [];
- const items = dataTransfer.items;
- for (const item of items) {
- const entry = item.webkitGetAsEntry();
- if (!entry) {
- decrement();
- continue;
- }
- if (entry.isFile) {
- readFiles(item.getAsFile(), entry.fullPath);
- } else if (entry.isDirectory) {
- readDirectory(entry.createReader());
- }
- }
- function readDirectory(reader) {
- reader.readEntries(
- (entries) => {
- if (entries.length) {
- fileNum += entries.length;
- entries.forEach((entry) => {
- if (entry.isFile) {
- entry.file(
- (file) => {
- readFiles(file, entry.fullPath);
- },
- (err) => {
- console.error(err);
- }
- );
- } else if (entry.isDirectory) {
- readDirectory(entry.createReader());
- }
- });
- readDirectory(reader);
- } else {
- decrement();
- }
- },
- (err) => {
- console.error(err);
- }
- );
- }
- function readFiles(file, fullPath) {
- file.relativePath = fullPath.substring(1);
- files.push(file);
- decrement();
- }
- }
- function handleUploadFiles(files) {
- const dirObj = {};
- files.forEach((item) => {
- if (item.relativePath === item.name) {
- const index = tableData.findIndex((file) => file.fullPath === item.path);
- if (index === -1) {
- tableData.push({
- name: item.name,
- filesList: [item.file],
- isFolder: false,
- fileSize: item.size,
- fullPath: item.path
- });
- }
- }
- if (item.relativePath !== item.name) {
- const folderName = item.relativePath.split("/")[0];
- if (dirObj[folderName]) {
- const dirList = dirObj[folderName].filesList || [];
- dirList.push(item);
- dirObj[folderName].filesList = dirList;
- const dirSize = dirObj[folderName].fileSize;
- dirObj[folderName].fileSize = dirSize ? dirSize + item.size : item.size;
- } else {
- dirObj[folderName] = {
- filesList: [item],
- fileSize: item.size,
- path: item.path
- };
- }
- }
- });
- Object.keys(dirObj).forEach((key) => {
- const index = tableData.findIndex((item) => item.fullPath === dirObj[key].path);
- if (index === -1) {
- tableData.push({
- name: key,
- filesList: dirObj[key].filesList,
- isFolder: true,
- fileSize: dirObj[key].fileSize,
- fullPath: dirObj[key].path
- });
- }
- });
- }
- function clearTableData() {
- tableData.length = 0;
- uploadPanelFilesList.value = [];
- }
- function renameFileBeforeUpload(filePath) {
- const fileName = window.node.path.basename(filePath);
- const typeMap = {
- timestampRename: manageStore.config.settings.timestampRename,
- randomStringRename: manageStore.config.settings.randomStringRename,
- customRenameFormat: manageStore.config.settings.customRenameFormat,
- customRename: manageStore.config.settings.customRename
- };
- return renameFile(typeMap, fileName);
- }
- function uploadFiles() {
- const formateduploadPanelFilesList = [];
- uploadPanelFilesList.value.forEach((item) => {
- formateduploadPanelFilesList.push({
- rawName: item.name,
- path: item.path.replace(/\\/g, "/"),
- size: item.size,
- renamedFileName: renameFileBeforeUpload(item.name),
- relativePath: item.relativePath ?? ""
- });
- });
- if (isUploadKeepDirStructure.value) {
- formateduploadPanelFilesList.forEach((item) => {
- item.key = `${currentPrefix.value}${item.relativePath.substring(0, item.relativePath.lastIndexOf("/"))}/${item.renamedFileName}`;
- });
- } else {
- formateduploadPanelFilesList.forEach((item) => {
- item.key = currentPrefix.value + item.renamedFileName;
- });
- }
- clearTableData();
- const param = {
- // tcyun
- fileArray: []
- };
- formateduploadPanelFilesList.forEach((item) => {
- param.fileArray.push({
- alias: configMap.alias,
- bucketName: configMap.bucketName,
- region: configMap.bucketConfig.Location,
- key: item.key,
- filePath: item.path,
- fileSize: item.size,
- fileName: item.rawName,
- githubBranch: currentCustomDomain.value,
- aclForUpload: manageStore.config.picBed[configMap.alias].aclForUpload
- });
- });
- sendRPC(IRPCActionType.MANAGE_UPLOAD_BUCKET_FILE, configMap.alias, param);
- }
- function handleCopyUploadingTaskInfo() {
- window.electron.clipboard.writeText(JSON.stringify(uploadTaskList.value, null, 2));
- ElMessage.success(T("MANAGE_BUCKET_COPY_SUCCESS"));
- }
- function handleDeleteUploadedTask() {
- sendRPC(IRPCActionType.MANAGE_DELETE_UPLOADED_TASK);
- ElMessage.success(T("MANAGE_BUCKET_DELETE_SUCCESS"));
- }
- function handleDeleteAllUploadedTask() {
- sendRPC(IRPCActionType.MANAGE_DELETE_ALL_UPLOADED_TASK);
- ElMessage.success(T("MANAGE_BUCKET_DELETE_SUCCESS"));
- }
- function handleCopyDownloadingTaskInfo() {
- window.electron.clipboard.writeText(JSON.stringify(downloadTaskList.value, null, 2));
- ElMessage.success(T("MANAGE_BUCKET_COPY_SUCCESS"));
- }
- function handleDeleteDownloadedTask() {
- sendRPC(IRPCActionType.MANAGE_DELETE_DOWNLOADED_TASK);
- ElMessage.success(T("MANAGE_BUCKET_DELETE_SUCCESS"));
- }
- function handleDeleteAllDownloadedTask() {
- sendRPC(IRPCActionType.MANAGE_DELETE_ALL_DOWNLOADED_TASK);
- ElMessage.success(T("MANAGE_BUCKET_DELETE_SUCCESS"));
- }
- function handleOpenDownloadedFolder() {
- sendRPC(IRPCActionType.MANAGE_OPEN_DOWNLOADED_FOLDER, manageStore.config.settings.downloadDir);
- }
- function handleShowFileInfo(item) {
- isShowFileInfo.value = true;
- currentShowedFileInfo.value = item;
- }
- async function handleBreadcrumbClick(index) {
- const targetPrefix = currentPrefix.value.split("/").slice(0, index + 1).join("/") + "/";
- if (isLoadingData.value) {
- isLoadingData.value = false;
- window.electron.electronAPI.ipcRenderer.send("cancelLoadingFileList", cancelToken.value);
- }
- configMap.prefix = targetPrefix;
- isShowLoadingPage.value = true;
- resetParam(false);
- isShowLoadingPage.value = false;
- }
- async function handleClickFile(item) {
- const options = {};
- if (currentPicBedName.value === "webdavplist") {
- options.headers = {
- Authorization: `Basic ${Buffer.from(`${manageStore.config.picBed[configMap.alias].username}:${manageStore.config.picBed[configMap.alias].password}`).toString("base64")}`
- };
- }
- if (item.isImage) {
- previewedImage.value = item.url;
- isShowImagePreview.value = true;
- } else if (item.isDir) {
- if (isLoadingData.value) {
- isLoadingData.value = false;
- window.electron.electronAPI.ipcRenderer.send("cancelLoadingFileList", cancelToken.value);
- }
- configMap.prefix = `/${item.key}`;
- isShowLoadingPage.value = true;
- await resetParam(false);
- isShowLoadingPage.value = false;
- } else if (item.fileName.endsWith(".md")) {
- try {
- ElMessage({
- message: T("MANAGE_BUCKET_START_LOADING_MESSAGE"),
- duration: 300,
- type: "success"
- });
- const fileUrl = item.url;
- const res = await window.node.axios.get(fileUrl, options);
- const content = res.data;
- markDownContent.value = await d.parse(content);
- isShowMarkDownDialog.value = true;
- } catch (error) {
- ElMessage.error(T("MANAGE_BUCKET_END_LOADING_MESSAGE_FAIL"));
- }
- } else if (textFileExt.includes(window.node.path.extname(item.fileName).toLowerCase()) || textFileExt.includes(item.fileName.toLowerCase())) {
- try {
- ElMessage({
- message: T("MANAGE_BUCKET_START_LOADING_MESSAGE"),
- duration: 300,
- type: "success"
- });
- const fileUrl = item.url;
- const res = await window.node.axios.get(fileUrl, options);
- textfileContent.value = res.data;
- isShowTextFileDialog.value = true;
- } catch (error) {
- ElMessage.error(T("MANAGE_BUCKET_END_LOADING_MESSAGE_FAIL"));
- }
- } else if (videoExt.includes(window.node.path.extname(item.fileName).toLowerCase())) {
- videoFileUrl.value = item.url;
- isShowVideoFileDialog.value = true;
- videoPlayerHeaders.value = options.headers;
- }
- }
- async function handleChangeCustomUrlInput() {
- await handleChangeCustomUrl();
- await forceRefreshFileList();
- }
- async function handleChangeCustomUrl() {
- if (["aliyun", "tcyun", "qiniu", "s3plist", "webdavplist", "local", "sftp"].includes(currentPicBedName.value)) {
- const currentConfigs = await getConfig("picBed");
- const currentConfig = currentConfigs[configMap.alias];
- const currentTransformedConfig = JSON.parse(currentConfig.transformedConfig ?? "{}");
- if (currentTransformedConfig[configMap.bucketName]) {
- currentTransformedConfig[configMap.bucketName].customUrl = currentCustomDomain.value;
- } else {
- currentTransformedConfig[configMap.bucketName] = {
- customUrl: currentCustomDomain.value
- };
- }
- currentConfig.transformedConfig = JSON.stringify(currentTransformedConfig);
- saveConfig(`picBed.${configMap.alias}`, currentConfig);
- await manageStore.refreshConfig();
- }
- }
- async function initCustomDomainList() {
- if (["aliyun", "tcyun", "qiniu"].includes(currentPicBedName.value) && (manageStore.config.picBed[configMap.alias].isAutoCustomUrl === void 0 || manageStore.config.picBed[configMap.alias].isAutoCustomUrl === true) || ["github", "smms", "upyun", "imgur"].includes(currentPicBedName.value)) {
- const param = {
- bucketName: configMap.bucketName,
- region: configMap.bucketConfig.Location
- };
- let defaultUrl = "";
- if (currentPicBedName.value === "tcyun") {
- defaultUrl = `https://${configMap.bucketName}.cos.${configMap.bucketConfig.Location}.myqcloud.com`;
- } else if (currentPicBedName.value === "aliyun") {
- defaultUrl = `https://${configMap.bucketName}.${configMap.bucketConfig.Location}.aliyuncs.com`;
- } else if (currentPicBedName.value === "github") {
- defaultUrl = "main";
- }
- const res = await triggerRPC(IRPCActionType.MANAGE_GET_BUCKET_DOMAIN, configMap.alias, param);
- if (res.length > 0) {
- customDomainList.value.length = 0;
- res.forEach((item) => {
- if (!/^https?:\/\//.test(item) && currentPicBedName.value !== "github") {
- item = manageStore.config.settings.isForceCustomUrlHttps ? `https://${item}` : `http://${item}`;
- }
- customDomainList.value.push({
- label: item,
- value: item
- });
- });
- defaultUrl !== "" && currentPicBedName.value !== "github" && customDomainList.value.push({
- label: defaultUrl,
- value: defaultUrl
- });
- currentCustomDomain.value = customDomainList.value[0].value;
- } else {
- customDomainList.value.length = 0;
- customDomainList.value = [
- {
- label: defaultUrl,
- value: defaultUrl
- }
- ];
- currentCustomDomain.value = defaultUrl;
- }
- } else if (["aliyun", "tcyun", "qiniu"].includes(currentPicBedName.value)) {
- const currentConfigs = await getConfig("picBed");
- const currentConfig = currentConfigs[configMap.alias];
- const currentTransformedConfig = JSON.parse(currentConfig.transformedConfig ?? "{}");
- if (currentTransformedConfig[configMap.bucketName]) {
- currentCustomDomain.value = currentTransformedConfig[configMap.bucketName].customUrl ?? "";
- } else {
- currentCustomDomain.value = "";
- }
- } else if (currentPicBedName.value === "s3plist") {
- const currentConfigs = await getConfig("picBed");
- const currentConfig = currentConfigs[configMap.alias];
- const currentTransformedConfig = JSON.parse(currentConfig.transformedConfig ?? "{}");
- if (currentTransformedConfig[configMap.bucketName]) {
- currentCustomDomain.value = currentTransformedConfig[configMap.bucketName].customUrl ?? "";
- } else {
- if (manageStore.config.picBed[configMap.alias].endpoint) {
- const endpoint = manageStore.config.picBed[configMap.alias].endpoint;
- const s3ForcePathStyle = manageStore.config.picBed[configMap.alias].s3ForcePathStyle;
- let url;
- if (/^https?:\/\//.test(endpoint)) {
- url = new URL(endpoint);
- } else {
- url = new URL(
- manageStore.config.picBed[configMap.alias].sslEnabled ? `https://${endpoint}` : `http://${endpoint}`
- );
- }
- if (s3ForcePathStyle) {
- currentCustomDomain.value = `${url.protocol}//${url.hostname}${url.port ? ":" + url.port : ""}/${configMap.bucketName}`;
- } else {
- currentCustomDomain.value = `${url.protocol}//${configMap.bucketName}.${url.hostname}${url.port ? ":" + url.port : ""}`;
- }
- } else {
- currentCustomDomain.value = `https://${configMap.bucketName}.s3.amazonaws.com`;
- }
- }
- await handleChangeCustomUrl();
- } else if (currentPicBedName.value === "webdavplist") {
- const currentConfigs = await getConfig("picBed");
- const currentConfig = currentConfigs[configMap.alias];
- const currentTransformedConfig = JSON.parse(currentConfig.transformedConfig ?? "{}");
- if (currentTransformedConfig[configMap.bucketName] && currentTransformedConfig[configMap.bucketName]?.customUrl) {
- currentCustomDomain.value = currentTransformedConfig[configMap.bucketName].customUrl;
- } else {
- let endpoint = manageStore.config.picBed[configMap.alias].endpoint;
- if (!/^https?:\/\//.test(endpoint)) {
- endpoint = "http://" + endpoint;
- }
- currentCustomDomain.value = endpoint;
- }
- await handleChangeCustomUrl();
- } else if (currentPicBedName.value === "local" || currentPicBedName.value === "sftp") {
- const currentConfigs = await getConfig("picBed");
- const currentConfig = currentConfigs[configMap.alias];
- const currentTransformedConfig = JSON.parse(currentConfig.transformedConfig ?? "{}");
- if (currentTransformedConfig[configMap.bucketName] && currentTransformedConfig[configMap.bucketName]?.customUrl) {
- currentCustomDomain.value = currentTransformedConfig[configMap.bucketName].customUrl ?? "";
- if (manageStore.config.settings.isForceCustomUrlHttps && currentCustomDomain.value.startsWith("http://")) {
- currentCustomDomain.value = currentCustomDomain.value.replace("http://", "https://");
- }
- } else {
- currentCustomDomain.value = "";
- }
- await handleChangeCustomUrl();
- }
- }
- async function resetParam(force = false) {
- if (isLoadingData.value) {
- isLoadingData.value = false;
- window.electron.electronAPI.ipcRenderer.send("cancelLoadingFileList", cancelToken.value);
- }
- if (isLoadingDownloadData.value) {
- isLoadingDownloadData.value = false;
- window.electron.electronAPI.ipcRenderer.send(cancelDownloadLoadingFileList, downloadCancelToken.value);
- }
- cancelToken.value = "";
- pagingMarker.value = "";
- currentPrefix.value = configMap.prefix;
- currentPageNumber.value = 1;
- currentPageFilesInfo.length = 0;
- currentDownloadFileList.length = 0;
- searchText.value = "";
- urlToUpload.value = "";
- dialogVisible.value = false;
- isShowImagePreview.value = false;
- previewedImage.value = "";
- isShowFileInfo.value = false;
- lastChoosed.value = -1;
- layoutStyle.value = await getConfig("settings.isShowList") ? "list" : "grid";
- fileSortExtReverse.value = false;
- fileSortNameReverse.value = false;
- fileSortSizeReverse.value = false;
- fileSortTimeReverse.value = false;
- if (!isAutoRefresh.value && !force && !paging.value) {
- console.log("use cache");
- const cachedData = await searchExistFileList();
- if (cachedData.length > 0) {
- currentPageFilesInfo.push(...cachedData[0].value.fullList);
- const sortType = localStorage.getItem("sortType") || "init";
- sortFile(sortType);
- isShowLoadingPage.value = false;
- return;
- }
- }
- if (paging.value) {
- const res = await getBucketFileList();
- if (res.success) {
- currentPageFilesInfo.push(...res.fullList);
- const sortType = localStorage.getItem("sortType") || "init";
- sortFile(sortType);
- if (res.isTruncated && paging.value) {
- pagingMarkerStack.push(pagingMarker.value);
- pagingMarker.value = res.nextMarker;
- } else if (paging.value && currentPageNumber.value > 1) {
- ElNotification({
- title: T("MANAGE_BUCKET_LAST_PAGE_TITLE"),
- message: T("MANAGE_BUCKET_LAST_PAGE_MSG"),
- type: "success",
- duration: 500
- });
- }
- } else {
- ElNotification({
- title: T("MANAGE_BUCKET_GET_LIST_FAIL_TITLE"),
- message: T("MANAGE_BUCKET_GET_LIST_FAIL_MSG"),
- type: "error",
- duration: 2e3
- });
- }
- } else {
- getBucketFileListBackStage();
- ElNotification.info({
- title: T("MANAGE_BUCKET_GET_LIST_FAIL_TITLE"),
- message: T("MANAGE_BUCKET_GET_LIST_FAIL_MSG2"),
- duration: 1e3
- });
- }
- }
- watch(route, async (newRoute) => {
- const queryConfigMap = newRoute.query.configMap;
- if (queryConfigMap) {
- isShowLoadingPage.value = true;
- const parsedConfigMap = JSON.parse(queryConfigMap);
- Object.assign(configMap, parsedConfigMap);
- await initCustomDomainList();
- await resetParam(true);
- isShowLoadingPage.value = false;
- }
- });
- async function forceRefreshFileList() {
- if (isLoadingData.value) {
- ElNotification({
- title: T("MANAGE_BUCKET_GET_LIST_FAIL_TITLE"),
- message: T("MANAGE_BUCKET_GET_LIST_FAIL_MSG3"),
- type: "error",
- duration: 1e3
- });
- return;
- }
- isShowLoadingPage.value = true;
- await resetParam(true);
- isShowLoadingPage.value = false;
- }
- watch(currentPageNumber, () => {
- if (typeof currentPageNumber.value !== "number") {
- currentPageNumber.value = 1;
- }
- });
- const changePage = async (cur, prev) => {
- if (!cur || !prev) {
- currentPageNumber.value = 1;
- return;
- }
- const isForwardNavigation = cur > prev;
- const newPageNumber = isForwardNavigation ? prev + 1 : prev - 1;
- const sortType = localStorage.getItem("sortType") || "init";
- isShowLoadingPage.value = true;
- currentPageNumber.value = newPageNumber;
- currentPageFilesInfo.length = 0;
- searchText.value = "";
- urlToUpload.value = "";
- dialogVisible.value = false;
- if (!isForwardNavigation) {
- pagingMarker.value = pagingMarkerStack[pagingMarkerStack.length - 2];
- pagingMarkerStack.pop();
- pagingMarkerStack.pop();
- }
- const res = await getBucketFileList();
- isShowLoadingPage.value = false;
- if (!res.success) {
- ElNotification({
- title: T("MANAGE_BUCKET_GET_LIST_FAIL_TITLE"),
- message: T("MANAGE_BUCKET_GET_LIST_FAIL_MSG"),
- type: "error",
- duration: 1e3
- });
- return;
- }
- currentPageFilesInfo.push(...res.fullList);
- sortFile(sortType);
- if (!(cur < prev && !paging.value)) {
- if (res.isTruncated) {
- pagingMarkerStack.push(pagingMarker.value);
- pagingMarker.value = res.nextMarker;
- } else {
- ElNotification({
- title: T("MANAGE_BUCKET_GET_LIST_FAIL_TITLE"),
- message: T("MANAGE_BUCKET_LAST_PAGE_MSG"),
- type: "success",
- duration: 1e3
- });
- }
- }
- };
- function sortFile(type) {
- switch (type) {
- case "name":
- localStorage.setItem("sortType", "name");
- fileSortNameReverse.value = !fileSortNameReverse.value;
- currentPageFilesInfo.sort((a, b) => {
- if (fileSortNameReverse.value) {
- return a.fileName.localeCompare(b.fileName);
- }
- return b.fileName.localeCompare(a.fileName);
- });
- break;
- case "size":
- localStorage.setItem("sortType", "size");
- fileSortSizeReverse.value = !fileSortSizeReverse.value;
- currentPageFilesInfo.sort((a, b) => {
- if (fileSortSizeReverse.value) {
- return a.fileSize - b.fileSize;
- }
- return b.fileSize - a.fileSize;
- });
- break;
- case "time":
- localStorage.setItem("sortType", "time");
- fileSortTimeReverse.value = !fileSortTimeReverse.value;
- currentPageFilesInfo.sort((a, b) => {
- if (fileSortTimeReverse.value) {
- return new Date(a.formatedTime).getTime() - new Date(b.formatedTime).getTime();
- }
- return new Date(b.formatedTime).getTime() - new Date(a.formatedTime).getTime();
- });
- break;
- case "ext":
- localStorage.setItem("sortType", "ext");
- fileSortExtReverse.value = !fileSortExtReverse.value;
- currentPageFilesInfo.sort((a, b) => {
- if (fileSortExtReverse.value) {
- return getExtension(a.fileName).localeCompare(getExtension(b.fileName));
- }
- return getExtension(b.fileName).localeCompare(getExtension(a.fileName));
- });
- break;
- case "check":
- localStorage.setItem("sortType", "check");
- currentPageFilesInfo.sort((a, b) => {
- return b.checked - a.checked;
- });
- break;
- case "init":
- localStorage.setItem("sortType", "init");
- currentPageFilesInfo.sort((a, b) => {
- return b.isDir - a.isDir || a.fileName.localeCompare(b.fileName);
- });
- }
- }
- function handleCancelCheck() {
- currentPageFilesInfo.forEach((item) => {
- item.checked = false;
- });
- }
- function handleReverseCheck() {
- currentPageFilesInfo.forEach((item) => {
- item.checked = !item.checked;
- });
- }
- function handleCheckChangeOther(item) {
- item.checked = !item.checked;
- }
- async function handleFolderBatchDownload(item) {
- ElMessageBox.confirm(T("MANAGE_BUCKET_DOWNLOAD_FOLDER_BOX_TITLE"), T("MANAGE_BUCKET_DOWNLOAD_FOLDER_BOX_TIP"), {
- confirmButtonText: T("MANAGE_BUCKET_DOWNLOAD_FOLDER_BOX_CONFIRM"),
- cancelButtonText: T("MANAGE_BUCKET_DOWNLOAD_FOLDER_BOX_CANCEL"),
- type: "warning"
- }).then(async () => {
- const defaultDownloadPath = await triggerRPC(IRPCActionType.MANAGE_GET_DEFAULT_DOWNLOAD_FOLDER);
- const param = {
- downloadPath: manageStore.config.settings.downloadDir ?? defaultDownloadPath,
- maxDownloadFileCount: manageStore.config.settings.maxDownloadFileCount ? manageStore.config.settings.maxDownloadFileCount : 5,
- fileArray: []
- };
- cancelToken.value = v4();
- const paramGet = {
- // tcyun
- bucketName: configMap.bucketName,
- bucketConfig: {
- Location: configMap.bucketConfig.Location
- },
- paging: paging.value,
- prefix: `/${item.key.replace(/^\/+|\/+$/, "")}/`,
- marker: pagingMarker.value,
- itemsPerPage: itemsPerPage.value,
- customUrl: currentCustomDomain.value,
- currentPage: currentPageNumber.value,
- cancelToken: cancelToken.value,
- cdnUrl: configMap.cdnUrl
- };
- isLoadingDownloadData.value = true;
- const downloadFileTransferStore = useDownloadFileTransferStore();
- downloadFileTransferStore.resetDownloadFileTransferList();
- sendRPC(IRPCActionType.MANAGE_GET_BUCKET_LIST_RECURSIVELY, configMap.alias, paramGet);
- window.electron.electronAPI.ipcRenderer.on(refreshDownloadFileTransferList, (_, data) => {
- downloadFileTransferStore.refreshDownloadFileTransferList(data);
- });
- downloadInterval = setInterval(() => {
- const currentFileList = downloadFileTransferStore.getDownloadFileTransferList();
- currentDownloadFileList.length = 0;
- currentDownloadFileList.push(...currentFileList);
- if (downloadFileTransferStore.isFinished() && downloadInterval) {
- isLoadingDownloadData.value = false;
- clearInterval(downloadInterval);
- if (downloadFileTransferStore.isSuccess()) {
- ElNotification.success({
- title: T("MANAGE_BUCKET_DOWNLOAD_FOLDER_BOX_TIP"),
- message: T("MANAGE_BUCKET_DOWNLOAD_FOLDER_SUCCESS"),
- duration: 500
- });
- if (currentDownloadFileList.length) {
- currentDownloadFileList.forEach((item2) => {
- param.fileArray.push({
- alias: configMap.alias,
- bucketName: configMap.bucketName,
- region: configMap.bucketConfig.Location,
- key: item2.key,
- fileName: [void 0, true].includes(manageStore.config.settings.isDownloadFolderKeepDirStructure) ? `/${item2.key.replace(/^\/+|\/+$/, "")}` : item2.fileName,
- customUrl: currentCustomDomain.value,
- downloadUrl: item2.downloadUrl,
- githubUrl: item2.url,
- githubPrivate: configMap.bucketConfig.private
- });
- });
- }
- sendRPC(IRPCActionType.MANAGE_DOWNLOAD_BUCKET_FILE, configMap.alias, param);
- isShowDownloadPanel.value = true;
- } else {
- ElNotification.error({
- title: T("MANAGE_BUCKET_DOWNLOAD_FOLDER_BOX_TIP"),
- message: T("MANAGE_BUCKET_DOWNLOAD_FOLDER_FAIL"),
- duration: 500
- });
- }
- downloadFileTransferStore.resetDownloadFileTransferList();
- }
- }, 500);
- }).catch(() => {
- ElNotification.info({
- title: T("MANAGE_BUCKET_DOWNLOAD_FOLDER_BOX_TIP"),
- message: T("MANAGE_BUCKET_DOWNLOAD_FOLDER_CANCEL"),
- duration: 500
- });
- });
- }
- async function handleBatchDownload() {
- const defaultDownloadPath = await triggerRPC(IRPCActionType.MANAGE_GET_DEFAULT_DOWNLOAD_FOLDER);
- const param = {
- downloadPath: manageStore.config.settings.downloadDir ?? defaultDownloadPath,
- maxDownloadFileCount: manageStore.config.settings.maxDownloadFileCount ? manageStore.config.settings.maxDownloadFileCount : 5,
- fileArray: []
- };
- selectedItems.value.forEach((item) => {
- if (!item.isDir) {
- param.fileArray.push({
- alias: configMap.alias,
- bucketName: configMap.bucketName,
- region: configMap.bucketConfig.Location,
- key: item.key,
- fileName: manageStore.config.settings.isDownloadFileKeepDirStructure ? `/${item.key.replace(/^\/+|\/+$/, "")}` : item.fileName,
- customUrl: currentCustomDomain.value,
- downloadUrl: item.downloadUrl,
- githubUrl: item.url,
- githubPrivate: configMap.bucketConfig.private
- });
- }
- });
- sendRPC(IRPCActionType.MANAGE_DOWNLOAD_BUCKET_FILE, configMap.alias, param);
- handleCancelCheck();
- isShowDownloadPanel.value = true;
- }
- function handleCheckAllChange() {
- const allSelected = selectedItems.value.length === filterList.value.length;
- filterList.value.forEach((item) => {
- item.checked = !allSelected;
- });
- }
- function handleCreateFolder() {
- ElMessageBox.prompt(T("MANAGE_BUCKET_CREATE_FOLDER_BOX_TITLE"), T("MANAGE_BUCKET_CREATE_FOLDER_BOX_TIP"), {
- confirmButtonText: T("MANAGE_BUCKET_CREATE_FOLDER_BOX_CONFIRM"),
- cancelButtonText: T("MANAGE_BUCKET_CREATE_FOLDER_BOX_CANCEL"),
- inputPattern: /^[\p{Unified_Ideograph}_a-zA-Z0-9-]+$/u,
- inputErrorMessage: T("MANAGE_BUCKET_CREATE_FOLDER_ERROR_MSG")
- }).then(async ({ value }) => {
- let formatedPath = value;
- formatedPath = trimPath(formatedPath);
- const param = {
- // tcyun
- bucketName: configMap.bucketName,
- region: configMap.bucketConfig.Location,
- key: currentPrefix.value.slice(1) + formatedPath + "/",
- githubBranch: currentCustomDomain.value
- };
- const res = await triggerRPC(IRPCActionType.MANAGE_CREATE_BUCKET_FOLDER, configMap.alias, param);
- if (res) {
- ElMessage.success(T("MANAGE_BUCKET_CREATE_FOLDER_SUCCESS"));
- } else {
- ElMessage.error(T("MANAGE_BUCKET_CREATE_FOLDER_FAIL"));
- }
- }).catch(() => {
- });
- }
- function showUrlDialog() {
- dialogVisible.value = true;
- }
- async function handleUploadFromUrl() {
- dialogVisible.value = false;
- const urlList = [];
- urlToUpload.value.split("\n").forEach((item) => {
- if (item.trim() !== "" && isValidUrl(item.trim())) {
- urlList.push(item.trim());
- }
- });
- if (urlList.length === 0) {
- ElMessage.warning(T("MANAGE_BUCKET_UPLOAD_URL_ERROR_MSQ"));
- return;
- }
- ElNotification({
- title: T("MANAGE_BUCKET_UPLOAD_URL_NOT_TITLE"),
- message: T("MANAGE_BUCKET_UPLOAD_URL_NOT_MSG"),
- type: "success",
- duration: 1e3
- });
- const res = await triggerRPC(IRPCActionType.MANAGE_DOWNLOAD_FILE_FROM_URL, urlList);
- for (const item of res) {
- const fPath = item.replace(/\\/g, "/");
- uploadPanelFilesList.value.push({
- name: window.node.path.basename(fPath),
- path: fPath,
- size: window.node.fs.statSync(fPath).size
- });
- }
- uploadFiles();
- isShowUploadPanel.value = true;
- }
- function handleBatchRenameFile() {
- batchRenameMatch.value = "";
- isSingleRename.value = false;
- isShowBatchRenameDialog.value = true;
- }
- const matchedFilesNumber = computed(() => {
- if (!batchRenameMatch.value) {
- return 0;
- }
- const matchedFiles = [];
- currentPageFilesInfo.forEach((item) => {
- if (isRenameIncludeExt.value) {
- if (customStrMatch(item.fileName, batchRenameMatch.value) && !item.isDir) {
- matchedFiles.push(item);
- }
- } else {
- if (customStrMatch(item.fileName.split(".")[0], batchRenameMatch.value) && !item.isDir) {
- matchedFiles.push(item);
- }
- }
- });
- return matchedFiles.length;
- });
- async function BatchRename() {
- isShowBatchRenameDialog.value = false;
- if (batchRenameMatch.value === "") {
- ElMessage.warning(T("MANAGE_BUCKET_BATCH_RENAME_ERROR_MSG"));
- return;
- }
- let matchedFiles = [];
- currentPageFilesInfo.forEach((item) => {
- if (isRenameIncludeExt.value) {
- if (customStrMatch(item.fileName, batchRenameMatch.value) && !item.isDir) {
- matchedFiles.push(item);
- }
- } else {
- if (customStrMatch(item.fileName.split(".")[0], batchRenameMatch.value) && !item.isDir) {
- matchedFiles.push(item);
- }
- }
- });
- if (matchedFiles.length === 0) {
- ElMessage.warning(T("MANAGE_BUCKET_BATCH_RENAME_ERROR_MSG2"));
- return;
- }
- for (const item of matchedFiles) {
- if (isRenameIncludeExt.value) {
- item.newName = customStrReplace(
- item.fileName,
- batchRenameMatch.value,
- batchRenameReplace.value
- );
- } else {
- item.newName = customStrReplace(item.fileName.split(".")[0], batchRenameMatch.value, batchRenameReplace.value) + "." + item.fileName.split(".")[1];
- }
- }
- matchedFiles = matchedFiles.filter((item) => item.fileName !== item.newName);
- if (matchedFiles.length === 0) {
- ElMessage.warning(T("MANAGE_BUCKET_BATCH_RENAME_ERROR_MSG3"));
- return;
- }
- for (let i = 0; i < matchedFiles.length; i++) {
- matchedFiles[i].newName = matchedFiles[i].newName.replaceAll("{auto}", (i + 1).toString());
- }
- const duplicateFilesNum = matchedFiles.filter(
- (item) => matchedFiles.filter((item2) => item2.newName === item.newName).length > 1
- ).length;
- let successCount = 0;
- let failCount = 0;
- const error = new Error("error");
- const renamefunc = (item) => {
- return new Promise((resolve, reject) => {
- const param = {
- // tcyun
- bucketName: configMap.bucketName,
- region: configMap.bucketConfig.Location,
- oldKey: item.key,
- newKey: (item.key.slice(0, item.key.lastIndexOf("/") + 1) + item.newName).replaceAll("//", "/"),
- customUrl: currentCustomDomain.value
- };
- triggerRPC(IRPCActionType.MANAGE_RENAME_BUCKET_FILE, configMap.alias, param).then((res) => {
- if (res) {
- successCount++;
- resolve(true);
- const oldKey = currentPrefix.value + item.fileName;
- if (pagingMarker.value === oldKey.slice(1)) {
- pagingMarker.value = currentPrefix.value.slice(1) + item.newName;
- }
- const oldName = item.fileName;
- if (item.newName.includes("/")) {
- item.fileName = item.newName.slice(0, item.newName.indexOf("/"));
- item.isDir = true;
- item.fileSize = 0;
- item.formatedTime = "";
- } else {
- item.fileName = item.newName;
- }
- item.key = (item.key.slice(0, item.key.lastIndexOf("/") + 1) + item.newName).replaceAll("//", "/");
- item.url = `${currentCustomDomain.value}${currentPrefix.value}${item.newName}`;
- item.formatedTime = (/* @__PURE__ */ new Date()).toLocaleString();
- if (!paging.value) {
- const table = fileCacheDbInstance.table(currentPicBedName.value);
- table.where("key").equals(getTableKeyOfDb()).modify((l) => {
- l.value.fullList.forEach((i) => {
- if (i.fileName === oldName) {
- if (item.newName.includes("/")) {
- i.fileName = item.newName.slice(0, item.newName.indexOf("/"));
- i.isDir = true;
- i.fileSize = 0;
- i.formatedTime = "";
- } else {
- i.fileName = item.newName;
- }
- i.key = (i.key.slice(0, i.key.lastIndexOf("/") + 1) + item.newName).replaceAll("//", "/");
- i.url = `${currentCustomDomain.value}${currentPrefix.value}${item.newName}`;
- i.formatedTime = (/* @__PURE__ */ new Date()).toLocaleString();
- }
- });
- });
- }
- } else {
- failCount++;
- reject(error);
- }
- });
- });
- };
- if (duplicateFilesNum > 0) {
- ElMessageBox.confirm(
- `${T("MANAGE_BUCKET_BATCH_RENAME_REPEATED_MSG_A")} ${duplicateFilesNum} ${T("MANAGE_BUCKET_BATCH_RENAME_REPEATED_MSG_B")}`,
- T("MANAGE_BUCKET_BATCH_RENAME_REPEATED_MSG_C"),
- {
- confirmButtonText: T("MANAGE_BUCKET_BATCH_RENAME_REPEATED_CONFIRM"),
- cancelButtonText: T("MANAGE_BUCKET_BATCH_RENAME_REPEATED_CANCEL"),
- type: "warning"
- }
- ).then(() => {
- const promiseList = [];
- for (const item of matchedFiles) {
- promiseList.push(renamefunc(item));
- }
- Promise.allSettled(promiseList).then(() => {
- ElMessage.success(
- `${T("MANAGE_BUCKET_BATCH_RENAME_RESULT_MSG_A")} ${successCount},${T("MANAGE_BUCKET_BATCH_RENAME_RESULT_MSG_B")} ${failCount}`
- );
- });
- }).catch(() => {
- ElMessage.info(T("MANAGE_BUCKET_BATCH_RENAME_CANCEL"));
- });
- } else {
- const promiseList = [];
- for (const item of matchedFiles) {
- promiseList.push(renamefunc(item));
- }
- Promise.allSettled(promiseList).then(() => {
- ElMessage.success(
- `${T("MANAGE_BUCKET_BATCH_RENAME_RESULT_MSG_A")} ${successCount},${T("MANAGE_BUCKET_BATCH_RENAME_RESULT_MSG_B")} ${failCount}`
- );
- });
- }
- }
- function handleBatchCopyInfo() {
- if (selectedItems.value.length === 0) {
- ElMessage.warning(T("MANAGE_BUCKET_BATCH_COPY_INFO_ERROR_MSG"));
- return;
- }
- const result = {};
- selectedItems.value.forEach((item) => {
- result[item.fileName] = item;
- });
- window.electron.clipboard.writeText(JSON.stringify(result, null, 2));
- ElMessage.success(
- `${T("MANAGE_BUCKET_BATCH_COPY_INFO_MSG_A")} ${selectedItems.value.length} ${T("MANAGE_BUCKET_BATCH_COPY_INFO_MSG_B")}`
- );
- }
- async function copyLink(item, type) {
- copyToClipboard(await formatLink(item.url, item.fileName, type, manageStore.config.settings.customPasteFormat));
- }
- async function handleBatchCopyLink(type) {
- if (!selectedItems.value.length) {
- ElMessage.warning(T("MANAGE_BUCKET_BATCH_COPY_URL_ERROR_MSG"));
- return;
- }
- const result = [];
- for (const item of selectedItems.value) {
- if (!item.isDir) {
- const preSignedUrl = type === "preSignedUrl" ? await getPreSignedUrl(item) : null;
- const url = await formatLink(
- preSignedUrl || item.url,
- item.fileName,
- type,
- manageStore.config.settings.customPasteFormat
- );
- result.push(url);
- }
- }
- window.electron.clipboard.writeText(result.join("\n"));
- ElMessage.success(
- `${T("MANAGE_BUCKET_BATCH_COPY_URL_MSG_A")} ${result.length} ${T("MANAGE_BUCKET_BATCH_COPY_URL_MSG_B")}`
- );
- }
- function cancelLoading() {
- ElMessageBox.confirm(T("MANAGE_BUCKET_CANCEL_LOADING_TITLE"), T("MANAGE_BUCKET_CANCEL_LOADING_MSG"), {
- confirmButtonText: T("MANAGE_BUCKET_CANCEL_LOADING_CONFIRM"),
- cancelButtonText: T("MANAGE_BUCKET_CANCEL_LOADING_CANCEL"),
- type: "warning"
- }).then(() => {
- isLoadingData.value = false;
- window.electron.electronAPI.ipcRenderer.send("cancelLoadingFileList", cancelToken.value);
- ElMessage.success(T("MANAGE_BUCKET_CANCEL_LOADING_SUCCESS"));
- }).catch(() => {
- });
- }
- function cancelDownloadLoading() {
- ElMessageBox.confirm(
- T("MANAGE_BUCKET_CANCEL_DOWNLOAD_LOADING_TITLE"),
- T("MANAGE_BUCKET_CANCEL_DOWNLOAD_LOADING_MSG"),
- {
- confirmButtonText: T("MANAGE_BUCKET_CANCEL_DOWNLOAD_LOADING_CONFIRM"),
- cancelButtonText: T("MANAGE_BUCKET_CANCEL_DOWNLOAD_LOADING_CANCEL"),
- type: "warning"
- }
- ).then(() => {
- isLoadingData.value = false;
- window.electron.electronAPI.ipcRenderer.send(cancelDownloadLoadingFileList, downloadCancelToken.value);
- ElMessage.success(T("MANAGE_BUCKET_CANCEL_DOWNLOAD_LOADING_SUCCESS"));
- }).catch(() => {
- });
- }
- async function getBucketFileListBackStage() {
- cancelToken.value = v4();
- const param = {
- // tcyun
- bucketName: configMap.bucketName,
- bucketConfig: {
- Location: configMap.bucketConfig.Location
- },
- paging: paging.value,
- prefix: currentPrefix.value,
- marker: pagingMarker.value,
- itemsPerPage: itemsPerPage.value,
- customUrl: currentCustomDomain.value,
- currentPage: currentPageNumber.value,
- cancelToken: cancelToken.value,
- cdnUrl: configMap.cdnUrl
- };
- isLoadingData.value = true;
- const fileTransferStore = useFileTransferStore();
- fileTransferStore.resetFileTransferList();
- const picBedNamesArr = ["webdavplist", "local", "sftp"];
- if (picBedNamesArr.includes(currentPicBedName.value)) {
- param.baseDir = configMap.baseDir;
- param.webPath = configMap.webPath;
- }
- sendRPC(IRPCActionType.MANAGE_GET_BUCKET_LIST_BACKSTAGE, configMap.alias, param);
- window.electron.electronAPI.ipcRenderer.on("refreshFileTransferList", (_, data) => {
- fileTransferStore.refreshFileTransferList(data);
- });
- fileTransferInterval = setInterval(() => {
- const currentFileList = fileTransferStore.getFileTransferList();
- currentPageFilesInfo.splice(0, currentPageFilesInfo.length, ...currentFileList);
- const sortType = localStorage.getItem("sortType") || "init";
- sortFile(sortType);
- const table = fileCacheDbInstance.table(currentPicBedName.value);
- table.put({
- key: getTableKeyOfDb(),
- value: JSON.parse(
- JSON.stringify({
- fullList: currentPageFilesInfo
- })
- )
- });
- if (fileTransferStore.isFinished() && fileTransferInterval) {
- isLoadingData.value = false;
- clearInterval(fileTransferInterval);
- if (fileTransferStore.isSuccess()) {
- ElNotification.success({
- title: T("MANAGE_BUCKET_GET_FILE_BS_NOT_TITLE"),
- message: T("MANAGE_BUCKET_GET_FILE_BS_NOT_MSG"),
- duration: 500
- });
- } else {
- ElNotification.error({
- title: T("MANAGE_BUCKET_GET_FILE_BS_NOT_TITLE"),
- message: T("MANAGE_BUCKET_GET_FILE_BS_NOT_MSG2"),
- duration: 500
- });
- }
- fileTransferStore.resetFileTransferList();
- }
- }, 1e3);
- }
- async function getBucketFileList() {
- const param = {
- // tcyun
- bucketName: configMap.bucketName,
- bucketConfig: {
- Location: configMap.bucketConfig.Location
- },
- paging: paging.value,
- prefix: currentPrefix.value,
- marker: pagingMarker.value,
- itemsPerPage: itemsPerPage.value,
- customUrl: currentCustomDomain.value,
- currentPage: currentPageNumber.value
- };
- return await triggerRPC(IRPCActionType.MANAGE_GET_BUCKET_FILE_LIST, configMap.alias, param);
- }
- function handleBatchDeleteInfo() {
- const confirmTitle = `${T("MANAGE_BUCKET_BATCH_DELETE_CONFIRM_TITLE_A")} ${selectedItems.value.length} ${T("MANAGE_BUCKET_BATCH_DELETE_CONFIRM_TITLE_B")}`;
- ElMessageBox.confirm(confirmTitle, T("MANAGE_BUCKET_BATCH_DELETE_CONFIRM_MSG"), {
- confirmButtonText: T("MANAGE_BUCKET_BATCH_DELETE_CONFIRM_CONFIRM"),
- cancelButtonText: T("MANAGE_BUCKET_BATCH_DELETE_CONFIRM_CANCEL"),
- type: "warning",
- center: true,
- draggable: true
- }).then(async () => {
- const copiedSelectedItems = JSON.parse(JSON.stringify(selectedItems.value));
- let successCount = 0;
- let failCount = 0;
- for (const item of copiedSelectedItems) {
- const param = {
- bucketName: configMap.bucketName,
- region: configMap.bucketConfig.Location,
- key: item.key,
- DeleteHash: item.sha,
- githubBranch: currentCustomDomain.value
- };
- const result = item.isDir ? await triggerRPC(IRPCActionType.MANAGE_DELETE_BUCKET_FOLDER, configMap.alias, param) : await triggerRPC(IRPCActionType.MANAGE_DELETE_BUCKET_FILE, configMap.alias, param);
- if (result) {
- successCount++;
- currentPageFilesInfo.splice(
- currentPageFilesInfo.findIndex((j) => j.key === item.key),
- 1
- );
- if (!paging.value) {
- const table = fileCacheDbInstance.table(currentPicBedName.value);
- table.where("key").equals(getTableKeyOfDb()).modify((l) => {
- l.value.fullList.splice(
- l.value.fullList.findIndex((j) => j.key === item.key),
- 1
- );
- });
- }
- } else {
- failCount++;
- }
- }
- if (successCount === 0) {
- ElNotification.error({
- title: T("MANAGE_BUCKET_BATCH_DELETE_ERROR_MSG_TITLE"),
- message: T("MANAGE_BUCKET_BATCH_DELETE_ERROR_MSG_MSG"),
- duration: 1e3
- });
- } else if (failCount === 0) {
- ElNotification.success({
- title: T("MANAGE_BUCKET_BATCH_DELETE_ERROR_MSG_TITLE"),
- message: T("MANAGE_BUCKET_BATCH_DELETE_ERROR_MSG_MSG2"),
- duration: 1e3
- });
- } else {
- ElNotification.warning({
- title: T("MANAGE_BUCKET_BATCH_DELETE_ERROR_MSG_TITLE"),
- message: `${T("MANAGE_BUCKET_BATCH_DELETE_ERROR_MSG_MSG2")} ${successCount}, ${T("MANAGE_BUCKET_BATCH_DELETE_ERROR_MSG_MSG3")} ${failCount}`,
- duration: 1e3
- });
- }
- }).catch(() => {
- ElMessage.info(T("MANAGE_BUCKET_BATCH_DELETE_CANCEL"));
- });
- }
- function handleDeleteFile(item) {
- ElMessageBox.confirm(
- `${T("MANAGE_BUCKET_DELETE_CONFIRM_TITLE")} ${item.isDir ? T("MANAGE_BUCKET_DELETE_CONFIRM_TITLE_FOLDER") : T("MANAGE_BUCKET_DELETE_CONFIRM_TITLE_FILE")} ${item.fileName} ${item.isDir ? T("MANAGE_BUCKET_DELETE_CONFIRM_TITLE_FOLDER_A") : ""}, ${T("MANAGE_BUCKET_DELETE_CONFIRM_TITLE_C")}`,
- T("MANAGE_BUCKET_DELETE_CONFIRM_MSG"),
- {
- confirmButtonText: T("MANAGE_BUCKET_DELETE_CONFIRM_CONFIRM"),
- cancelButtonText: T("MANAGE_BUCKET_DELETE_CONFIRM_CANCEL"),
- type: "warning",
- center: true,
- draggable: true
- }
- ).then(async () => {
- let res = false;
- const param = {
- bucketName: configMap.bucketName,
- region: configMap.bucketConfig.Location,
- key: item.key,
- DeleteHash: item.sha,
- githubBranch: currentCustomDomain.value
- };
- if (item.isDir) {
- ElNotification.info({
- title: T("MANAGE_BUCKET_DELETE_ERROR_MSG_TITLE"),
- message: T("MANAGE_BUCKET_DELETE_ERROR_MSG_MSG"),
- duration: 1e3
- });
- res = await triggerRPC(IRPCActionType.MANAGE_DELETE_BUCKET_FOLDER, configMap.alias, param);
- } else {
- res = await triggerRPC(IRPCActionType.MANAGE_DELETE_BUCKET_FILE, configMap.alias, param);
- }
- if (res) {
- ElMessage.success(T("MANAGE_BUCKET_DELETE_SUCCESS"));
- currentPageFilesInfo.splice(
- currentPageFilesInfo.findIndex((i) => i.key === item.key),
- 1
- );
- if (!paging.value) {
- const table = fileCacheDbInstance.table(currentPicBedName.value);
- table.where("key").equals(getTableKeyOfDb()).modify((l) => {
- l.value.fullList.splice(
- l.value.fullList.findIndex((i) => i.key === item.key),
- 1
- );
- });
- }
- } else {
- ElMessage.error(T("MANAGE_BUCKET_DELETE_FAIL"));
- }
- }).catch(() => {
- ElMessage.info(T("MANAGE_BUCKET_DELETE_CANCEL"));
- });
- }
- function handleRenameFile(item) {
- batchRenameMatch.value = window.node.path.basename(item.fileName, window.node.path.extname(item.fileName));
- isSingleRename.value = true;
- isShowBatchRenameDialog.value = true;
- itemToBeRenamed.value = item;
- }
- function singleRename() {
- const index = filterList.value.findIndex((i) => i === itemToBeRenamed.value);
- isShowBatchRenameDialog.value = false;
- if (batchRenameMatch.value === "") {
- batchRenameMatch.value = ".+";
- }
- if (isRenameIncludeExt.value) {
- itemToBeRenamed.value.newName = customStrReplace(
- itemToBeRenamed.value.fileName,
- batchRenameMatch.value,
- batchRenameReplace.value
- );
- } else {
- itemToBeRenamed.value.newName = customStrReplace(itemToBeRenamed.value.fileName.split(".")[0], batchRenameMatch.value, batchRenameReplace.value) + "." + itemToBeRenamed.value.fileName.split(".")[1];
- }
- if (itemToBeRenamed.value.newName === itemToBeRenamed.value.fileName) {
- ElMessage.info(T("MANAGE_BUCKET_RENAME_INFO_MSG"));
- return;
- }
- itemToBeRenamed.value.newName = itemToBeRenamed.value.newName.replaceAll("{auto}", "1");
- const item = currentPageFilesInfo[index];
- const param = {
- // tcyun
- bucketName: configMap.bucketName,
- region: configMap.bucketConfig.Location,
- oldKey: item.key,
- newKey: (item.key.slice(0, item.key.lastIndexOf("/") + 1) + itemToBeRenamed.value.newName).replaceAll("//", "/"),
- customUrl: currentCustomDomain.value
- };
- triggerRPC(IRPCActionType.MANAGE_RENAME_BUCKET_FILE, configMap.alias, param).then((res) => {
- if (res) {
- const oldKey = currentPrefix.value + item.fileName;
- if (pagingMarker.value === oldKey.slice(1)) {
- pagingMarker.value = currentPrefix.value.slice(1) + itemToBeRenamed.value.newName;
- }
- const oldName = item.fileName;
- if (itemToBeRenamed.value.newName.includes("/")) {
- item.fileName = itemToBeRenamed.value.newName.slice(0, itemToBeRenamed.value.newName.indexOf("/"));
- item.isDir = true;
- item.fileSize = 0;
- item.formatedTime = "";
- } else {
- item.fileName = itemToBeRenamed.value.newName;
- }
- item.key = (item.key.slice(0, item.key.lastIndexOf("/") + 1) + itemToBeRenamed.value.newName).replaceAll(
- "//",
- "/"
- );
- item.url = `${currentCustomDomain.value}${currentPrefix.value}${itemToBeRenamed.value.newName}`;
- item.formatedTime = (/* @__PURE__ */ new Date()).toLocaleString();
- if (!paging.value) {
- const table = fileCacheDbInstance.table(currentPicBedName.value);
- table.where("key").equals(getTableKeyOfDb()).modify((l) => {
- l.value.fullList.forEach((i) => {
- if (i.fileName === oldName) {
- if (itemToBeRenamed.value.newName.includes("/")) {
- i.fileName = itemToBeRenamed.value.newName.slice(0, itemToBeRenamed.value.newName.indexOf("/"));
- i.isDir = true;
- i.fileSize = 0;
- i.formatedTime = "";
- } else {
- i.fileName = itemToBeRenamed.value.newName;
- }
- i.key = (i.key.slice(0, i.key.lastIndexOf("/") + 1) + itemToBeRenamed.value.newName).replaceAll(
- "//",
- "/"
- );
- i.url = `${currentCustomDomain.value}${currentPrefix.value}${itemToBeRenamed.value.newName}`;
- i.formatedTime = (/* @__PURE__ */ new Date()).toLocaleString();
- }
- });
- });
- }
- ElMessage.success(T("MANAGE_BUCKET_RENAME_SUCCESS"));
- } else {
- ElMessage.error(T("MANAGE_BUCKET_RENAME_ERROR_MSG"));
- }
- });
- }
- function handleGetS3Config(item) {
- return {
- bucketName: configMap.bucketName,
- region: configMap.bucketConfig.Location,
- key: item.key,
- customUrl: currentCustomDomain.value,
- expires: manageStore.config.settings.PreSignedExpire,
- githubPrivate: configMap.bucketConfig.private,
- rawUrl: item.url
- };
- }
- async function getPreSignedUrl(item) {
- const param = {
- // tcyun
- bucketName: configMap.bucketName,
- region: configMap.bucketConfig.Location,
- key: item.key,
- customUrl: currentCustomDomain.value,
- expires: manageStore.config.settings.PreSignedExpire,
- githubPrivate: configMap.bucketConfig.private,
- rawUrl: item.url
- };
- return await triggerRPC(IRPCActionType.MANAGE_GET_PRE_SIGNED_URL, configMap.alias, param);
- }
- function copyToClipboard(text) {
- window.electron.clipboard.writeText(text);
- ElMessage.success(T("MANAGE_BUCKET_COPY_SUCCESS"));
- }
- function getTableKeyOfDb() {
- let tableKey;
- if (currentPicBedName.value === "github") {
- tableKey = `${configMap.alias}@${configMap.bucketConfig.githubUsername}@${configMap.bucketName}@${currentCustomDomain.value}@${currentPrefix.value}`;
- } else {
- tableKey = `${configMap.alias}@${configMap.bucketName}@${currentPrefix.value}`;
- }
- return tableKey;
- }
- async function searchExistFileList() {
- const table = fileCacheDbInstance.table(currentPicBedName.value);
- return await table.where("key").equals(getTableKeyOfDb()).toArray();
- }
- function handleDetectShiftKey(event) {
- if (event.key === "Shift") {
- if (event.type === "keydown") {
- isShiftKeyPress.value = true;
- } else if (event.type === "keyup") {
- isShiftKeyPress.value = false;
- }
- }
- }
- const downloadedTaskColumns = [
- {
- key: "name",
- title: T("MANAGE_BUCKET_DOWNLOAD_COLUMN_FILENAME"),
- dataKey: "sourceFileName",
- width: 300,
- cellRenderer: ({ rowData: item }) => /* @__PURE__ */ React.createElement(
- "div",
- {
- onClick: () => {
- sendRPC(IRPCActionType.MANAGE_OPEN_LOCAL_FILE, item.targetFilePath);
- }
- },
- /* @__PURE__ */ React.createElement(ElTooltip, { effect: "dark", content: item.sourceFileName, placement: "top" }, /* @__PURE__ */ React.createElement(ElLink, { style: "color: black;font-size: 14px;font-family: Arial, Helvetica, sans-serif;" }, formatFileName(item.sourceFileName)))
- )
- },
- {
- key: "finishTime",
- title: T("MANAGE_BUCKET_DOWNLOAD_COLUMN_FINISHTIME"),
- dataKey: "finishTime",
- width: 200,
- cellRenderer: ({ rowData: item }) => /* @__PURE__ */ React.createElement("span", { style: "color: black;font-size: 14px;font-family: Arial, Helvetica, sans-serif;" }, item.finishTime)
- },
- {
- key: "status",
- title: T("MANAGE_BUCKET_DOWNLOAD_COLUMN_STATUS"),
- width: 100,
- cellRenderer: ({ rowData: item }) => item.status === "downloaded" ? /* @__PURE__ */ React.createElement(ElTag, { type: "success", style: "font-size: 14px;font-family: Arial, Helvetica, sans-serif;" }, T("MANAGE_BUCKET_DOWNLOAD_COLUMN_STATUS_SUCCESS")) : /* @__PURE__ */ React.createElement(ElTag, { type: "danger", style: "font-size: 14px;font-family: Arial, Helvetica, sans-serif;" }, T("MANAGE_BUCKET_DOWNLOAD_COLUMN_STATUS_FAIL"))
- }
- ];
- const uploadedTaskColumns = [
- {
- key: "name",
- title: T("MANAGE_BUCKET_UPLOAD_COLUMN_FILENAME"),
- dataKey: "sourceFileName",
- width: 300,
- cellRenderer: ({ rowData: item }) => /* @__PURE__ */ React.createElement(ElTooltip, { effect: "dark", content: item.sourceFileName, placement: "top" }, /* @__PURE__ */ React.createElement("span", { style: "color: black;font-size: 14px;font-family: Arial, Helvetica, sans-serif;" }, formatFileName(item.sourceFileName)))
- },
- {
- key: "targetFilePath",
- title: T("MANAGE_BUCKET_UPLOAD_COLUMN_TARGETFILEPATH"),
- dataKey: "targetFilePath",
- width: 300,
- cellRenderer: ({ rowData: item }) => /* @__PURE__ */ React.createElement(ElTooltip, { effect: "dark", content: item.targetFilePath, placement: "top" }, /* @__PURE__ */ React.createElement("span", { style: "color: black;font-size: 14px;font-family: Arial, Helvetica, sans-serif;" }, formatFileName(item.targetFilePath)))
- },
- {
- key: "finishTime",
- title: T("MANAGE_BUCKET_UPLOAD_COLUMN_FINISHTIME"),
- dataKey: "finishTime",
- width: 200,
- cellRenderer: ({ rowData: item }) => /* @__PURE__ */ React.createElement("span", { style: "color: black;font-size: 14px;font-family: Arial, Helvetica, sans-serif;" }, item.finishTime)
- },
- {
- key: "status",
- title: T("MANAGE_BUCKET_UPLOAD_COLUMN_STATUS"),
- width: 100,
- cellRenderer: ({ rowData: item }) => item.status === "uploaded" ? /* @__PURE__ */ React.createElement(ElTag, { type: "success", style: "font-size: 14px;font-family: Arial, Helvetica, sans-serif;" }, T("MANAGE_BUCKET_UPLOAD_COLUMN_STATUS_SUCCESS")) : /* @__PURE__ */ React.createElement(ElTag, { type: "danger", style: "font-size: 14px;font-family: Arial, Helvetica, sans-serif;" }, T("MANAGE_BUCKET_UPLOAD_COLUMN_STATUS_FAIL"))
- }
- ];
- const downloadingTaskColumns = [
- {
- key: "name",
- title: T("MANAGE_BUCKET_DOWNLOADING_COLUMN_FILENAME"),
- dataKey: "sourceFileName",
- width: 300,
- cellRenderer: ({ rowData: item }) => /* @__PURE__ */ React.createElement("span", { style: "color: black;font-size: 14px;font-family: Arial, Helvetica, sans-serif;" }, formatFileName(item.sourceFileName))
- },
- {
- key: "progress",
- title: T("MANAGE_BUCKET_DOWNLOADING_COLUMN_PROGRESS"),
- dataKey: "progress",
- width: 300,
- cellRenderer: ({ rowData: item }) => /* @__PURE__ */ React.createElement(ElProgress, { percentage: item.progress, status: "success", strokeWidth: 20, textInside: true, style: "width: 100%;" })
- }
- ];
- const uploadingTaskColumns = [
- {
- key: "name",
- title: T("MANAGE_BUCKET_UPLOADING_COLUMN_FILENAME"),
- dataKey: "sourceFileName",
- width: 300,
- cellRenderer: ({ rowData: item }) => /* @__PURE__ */ React.createElement("span", { style: "color: black;font-size: 14px;font-family: Arial, Helvetica, sans-serif;" }, formatFileName(item.sourceFileName))
- },
- {
- key: "progress",
- title: T("MANAGE_BUCKET_UPLOADING_COLUMN_PROGRESS"),
- dataKey: "progress",
- width: 300,
- cellRenderer: ({ rowData: item }) => /* @__PURE__ */ React.createElement(
- ElProgress,
- {
- percentage: item.progress ? item.progress : 50,
- status: "success",
- strokeWidth: 20,
- textInside: true,
- style: "width: 100%;",
- indeterminate: !!item.noProgress
- }
- )
- }
- ];
- const upLoadTaskColumns = [
- {
- key: "name",
- title: T("MANAGE_BUCKET_UPLOADED_COLUMN_FILENAME"),
- dataKey: "name",
- width: 300,
- cellRenderer: ({ rowData: item }) => item.isFolder ? /* @__PURE__ */ React.createElement("span", null, /* @__PURE__ */ React.createElement(ElIcon, { color: "#409EFF", style: "position: relative;left: -5px;" }, /* @__PURE__ */ React.createElement(folder_opened_default, null)), /* @__PURE__ */ React.createElement("span", { style: "font-weight: bold;color: black;font-size: 14px;font-family: Arial, Helvetica, sans-serif;" }, formatFileName(item.name))) : /* @__PURE__ */ React.createElement("span", null, /* @__PURE__ */ React.createElement(ElIcon, { color: "#409EFF" }, /* @__PURE__ */ React.createElement(document_default, null)), /* @__PURE__ */ React.createElement("span", { style: "color: black;font-size: 14px;font-family: Arial, Helvetica, sans-serif;" }, formatFileName(item.name)))
- },
- {
- key: "fileSize",
- title: T("MANAGE_BUCKET_UPLOADED_COLUMN_FILESIZE"),
- dataKey: "fileSize",
- width: 100,
- cellRenderer: ({ rowData: item }) => /* @__PURE__ */ React.createElement("span", { style: "color: black;font-size: 14px;font-family: Arial, Helvetica, sans-serif;" }, formatFileSize(item.fileSize))
- },
- {
- key: "fileNumber",
- title: T("MANAGE_BUCKET_UPLOADED_COLUMN_FILENUM"),
- width: 100,
- cellRenderer: ({ rowData: item }) => !item.isFolder ? /* @__PURE__ */ React.createElement("template", null) : /* @__PURE__ */ React.createElement("span", { style: "color: black;font-size: 14px;font-family: Arial, Helvetica, sans-serif;" }, item.filesList.length)
- }
- ];
- function rowClass({ rowData }) {
- return rowData.checked ? "file-list-row-checked" : "";
- }
- const columns = [
- {
- key: "checked",
- title: "",
- dataKey: "checked",
- width: 30,
- cellRenderer: ({ rowData: item }) => /* @__PURE__ */ React.createElement(ElCheckbox, { "v-model": item.checked })
- },
- {
- key: "icon",
- title: "",
- width: 30,
- cellRenderer: ({ rowData: item }) => /* @__PURE__ */ React.createElement(
- ElPopover,
- {
- trigger: "hover",
- width: "200",
- disabled: !item.isImage,
- placement: "right",
- persistent: false,
- teleported: true
- },
- {
- reference: () => !item.isDir ? currentPicBedName.value !== "webdavplist" ? currentPicBedName.value === "s3plist" && item.isImage && isUsePreSignedUrl.value ? /* @__PURE__ */ React.createElement(
- ImagePreSignTsx,
- {
- isShowThumbnail: isShowThumbnail.value,
- item,
- config: handleGetS3Config(item),
- url: item.url,
- alias: configMap.alias
- }
- ) : /* @__PURE__ */ React.createElement(
- ElImage,
- {
- src: isShowThumbnail.value ? item.isImage ? item.url : require(`./assets/icons/${getFileIconPath(item.fileName ?? "")}`) : require(`./assets/icons/${getFileIconPath(item.fileName ?? "")}`),
- fit: "contain",
- style: { width: "20px", height: "20px" }
- },
- {
- placeholder: () => /* @__PURE__ */ React.createElement(ElIcon, null, /* @__PURE__ */ React.createElement(loading_default, null)),
- error: () => /* @__PURE__ */ React.createElement(
- ElImage,
- {
- src: require(`./assets/icons/${getFileIconPath(item.fileName ?? "")}`),
- fit: "contain",
- style: { width: "20px", height: "20px" }
- }
- )
- }
- ) : item.isImage ? /* @__PURE__ */ React.createElement(
- ImageWebdavTsx,
- {
- isShowThumbnail: isShowThumbnail.value,
- item,
- config: handleGetWebdavConfig(),
- url: item.url
- }
- ) : /* @__PURE__ */ React.createElement(
- ElImage,
- {
- src: require(`./assets/icons/${getFileIconPath(item.fileName ?? "")}`),
- fit: "contain",
- style: { width: "20px", height: "20px" }
- }
- ) : /* @__PURE__ */ React.createElement(
- ElImage,
- {
- src: require("./assets/icons/folder.webp"),
- fit: "contain",
- style: { width: "20px", height: "20px" }
- }
- ),
- default: () => currentPicBedName.value === "webdavplist" && item.isImage ? /* @__PURE__ */ React.createElement(
- ImageWebdavTsx,
- {
- isShowThumbnail: isShowThumbnail.value,
- item,
- config: handleGetWebdavConfig(),
- url: item.url
- }
- ) : currentPicBedName.value === "s3plist" && item.isImage && isUsePreSignedUrl.value ? /* @__PURE__ */ React.createElement(
- ImagePreSignTsx,
- {
- isShowThumbnail: isShowThumbnail.value,
- item,
- config: handleGetS3Config(item),
- url: item.url,
- alias: configMap.alias
- }
- ) : /* @__PURE__ */ React.createElement(
- ElImage,
- {
- src: item.isImage ? item.url : require(`./assets/icons/${getFileIconPath(item.fileName ?? "")}`),
- fit: "contain"
- },
- {
- placeholder: () => /* @__PURE__ */ React.createElement(ElIcon, null, /* @__PURE__ */ React.createElement(loading_default, null)),
- error: () => /* @__PURE__ */ React.createElement(ElIcon, null, /* @__PURE__ */ React.createElement(circle_close_default, null))
- }
- )
- }
- )
- },
- {
- key: "fileName",
- title: T("MANAGE_BUCKET_FILE_COLUMN_FILENAME"),
- dataKey: "fileName",
- width: 300,
- cellRenderer: ({ cellData: fileName, rowData: item }) => /* @__PURE__ */ React.createElement("div", { onClick: () => handleClickFile(item) }, /* @__PURE__ */ React.createElement(ElTooltip, { placement: "top", content: fileName }, /* @__PURE__ */ React.createElement("div", { style: "font-size: 14px;color: #303133;font-family: Arial, Helvetica, sans-serif;" }, formatFileName(item.fileName ?? "", 40))))
- },
- {
- key: "rename",
- title: "",
- width: 30,
- cellRenderer: ({ rowData: item }) => item.isDir || !isShowRenameFileIcon.value ? item.isDir ? /* @__PURE__ */ React.createElement(ElIcon, { size: "15", style: "cursor: pointer;", color: "#409EFF", onClick: () => handleFolderBatchDownload(item) }, /* @__PURE__ */ React.createElement(download_default, null)) : /* @__PURE__ */ React.createElement("template", null) : /* @__PURE__ */ React.createElement(ElIcon, { size: "15", style: "cursor: pointer;", color: "#409EFF", onClick: () => handleRenameFile(item) }, /* @__PURE__ */ React.createElement(edit_default, null))
- },
- {
- key: "copy",
- title: "",
- width: 30,
- cellRenderer: ({ rowData: item }) => /* @__PURE__ */ React.createElement(ElTooltip, { placement: "top", content: T("MANAGE_BUCKET_FILE_COLUMN_COPY_URL"), effect: "light", "hide-after": 150 }, /* @__PURE__ */ React.createElement(ElDropdown, { teleported: true }, {
- default: () => /* @__PURE__ */ React.createElement(
- ElIcon,
- {
- size: "15",
- style: "cursor: pointer;",
- color: "#409EFF",
- onClick: async () => copyToClipboard(
- await formatLink(
- item.url,
- item.fileName,
- manageStore.config.settings.pasteFormat ?? "$markdown",
- manageStore.config.settings.customPasteFormat ?? "$url"
- )
- )
- },
- /* @__PURE__ */ React.createElement(copy_document_default, null)
- ),
- dropdown: () => /* @__PURE__ */ React.createElement(ElDropdownMenu, null, /* @__PURE__ */ React.createElement(ElDropdownItem, { onClick: async () => copyToClipboard(await formatLink(item.url, item.fileName, "url")) }, "Url"), /* @__PURE__ */ React.createElement(
- ElDropdownItem,
- {
- onClick: async () => copyToClipboard(await formatLink(item.url, item.fileName, "markdown"))
- },
- "Markdown"
- ), /* @__PURE__ */ React.createElement(
- ElDropdownItem,
- {
- onClick: async () => copyToClipboard(await formatLink(item.url, item.fileName, "markdown-with-link"))
- },
- "Markdown-link"
- ), /* @__PURE__ */ React.createElement(
- ElDropdownItem,
- {
- onClick: async () => copyToClipboard(await formatLink(item.url, item.fileName, "html"))
- },
- "Html"
- ), /* @__PURE__ */ React.createElement(
- ElDropdownItem,
- {
- onClick: async () => copyToClipboard(await formatLink(item.url, item.fileName, "bbcode"))
- },
- "BBCode"
- ), /* @__PURE__ */ React.createElement(
- ElDropdownItem,
- {
- onClick: async () => copyToClipboard(
- await formatLink(item.url, item.fileName, "custom", manageStore.config.settings.customPasteFormat)
- )
- },
- "Custom"
- ), isShowPresignedUrl.value ? /* @__PURE__ */ React.createElement(
- ElDropdownItem,
- {
- onClick: async () => {
- const res = await getPreSignedUrl(item);
- copyToClipboard(res);
- }
- },
- "preSignURL"
- ) : /* @__PURE__ */ React.createElement("template", null))
- }))
- },
- {
- key: "info",
- title: "",
- width: 30,
- cellRenderer: ({ rowData: item }) => /* @__PURE__ */ React.createElement(ElTooltip, { placement: "top", content: T("MANAGE_BUCKET_FILE_COLUMN_INFO"), effect: "light", "hide-after": 150 }, /* @__PURE__ */ React.createElement(ElIcon, { size: "15", style: "cursor: pointer;", color: "#409EFF", onClick: () => handleShowFileInfo(item) }, /* @__PURE__ */ React.createElement(document_default, null)))
- },
- {
- key: "placeholder",
- title: "",
- width: 30,
- cellRenderer: () => /* @__PURE__ */ React.createElement("span", null)
- },
- {
- key: "fileSize",
- title: T("MANAGE_BUCKET_FILE_COLUMN_FILESIZE"),
- width: 100,
- dataKey: "fileSize",
- cellRenderer: ({ cellData: fileSize, rowData: item }) => /* @__PURE__ */ React.createElement(
- "div",
- {
- style: "font-size: 14px;color: #303133;font-family: Arial, Helvetica, sans-serif;height: 100%;display: flex;align-items: center;",
- onClick: () => handleCheckChangeOther(item)
- },
- formatFileSize(fileSize)
- )
- },
- {
- key: "formatedTime",
- title: T("MANAGE_BUCKET_FILE_COLUMN_TIME"),
- width: 200,
- dataKey: "formatedTime",
- cellRenderer: ({ cellData: formatedTime, rowData: item }) => /* @__PURE__ */ React.createElement(
- "div",
- {
- style: "font-size: 14px;color: #303133;font-family: Arial, Helvetica, sans-serif;height: 100%;display: flex;align-items: center;",
- onClick: () => handleCheckChangeOther(item)
- },
- formatedTime
- )
- },
- {
- key: "delete",
- title: "",
- width: 30,
- cellRenderer: ({ rowData: item }) => /* @__PURE__ */ React.createElement(ElIcon, { style: "cursor: pointer;", color: "red", onClick: () => handleDeleteFile(item) }, /* @__PURE__ */ React.createElement(delete_filled_default, null))
- }
- ];
- onBeforeMount(async () => {
- await manageStore.refreshConfig();
- isShowLoadingPage.value = true;
- await initCustomDomainList();
- await resetParam(true);
- isShowLoadingPage.value = false;
- document.addEventListener("keydown", handleDetectShiftKey);
- document.addEventListener("keyup", handleDetectShiftKey);
- });
- onBeforeUnmount(() => {
- document.removeEventListener("keydown", handleDetectShiftKey);
- document.removeEventListener("keyup", handleDetectShiftKey);
- fileTransferInterval && clearInterval(fileTransferInterval);
- downloadInterval && clearInterval(downloadInterval);
- refreshUploadTaskId.value && clearInterval(refreshUploadTaskId.value);
- refreshDownloadTaskId.value && clearInterval(refreshDownloadTaskId.value);
- if (isLoadingData.value) {
- window.electron.electronAPI.ipcRenderer.send("cancelLoadingFileList", cancelToken.value);
- }
- if (isLoadingDownloadData.value) {
- window.electron.electronAPI.ipcRenderer.send(cancelDownloadLoadingFileList, downloadCancelToken.value);
- }
- window.electron.electronAPI.ipcRenderer.removeAllListeners("refreshFileTransferList");
- window.electron.electronAPI.ipcRenderer.removeAllListeners(refreshDownloadFileTransferList);
- });
- return (_ctx, _cache) => {
- const _component_el_option = resolveComponent("el-option");
- const _component_el_select = resolveComponent("el-select");
- const _component_el_input = resolveComponent("el-input");
- const _component_el_breadcrumb_item = resolveComponent("el-breadcrumb-item");
- const _component_el_breadcrumb = resolveComponent("el-breadcrumb");
- const _component_el_button_group = resolveComponent("el-button-group");
- const _component_el_input_number = resolveComponent("el-input-number");
- const _component_el_dialog = resolveComponent("el-dialog");
- const _component_el_table_v2 = resolveComponent("el-table-v2");
- const _component_el_auto_resizer = resolveComponent("el-auto-resizer");
- const _component_el_row = resolveComponent("el-row");
- const _component_el_col = resolveComponent("el-col");
- const _component_el_image_viewer = resolveComponent("el-image-viewer");
- const _component_el_affix = resolveComponent("el-affix");
- const _component_el_switch = resolveComponent("el-switch");
- const _component_el_badge = resolveComponent("el-badge");
- const _component_el_tab_pane = resolveComponent("el-tab-pane");
- const _component_el_tabs = resolveComponent("el-tabs");
- const _component_el_drawer = resolveComponent("el-drawer");
- const _component_highlightjs = resolveComponent("highlightjs");
- const _component_video_player = resolveComponent("video-player");
- const _component_el_descriptions_item = resolveComponent("el-descriptions-item");
- const _component_el_descriptions = resolveComponent("el-descriptions");
- const _directive_loading = resolveDirective("loading");
- return withDirectives((openBlock(), createElementBlock("div", {
- "element-loading-text": unref(T)("MANAGE_BUCKET_PAGE_LOADING_TEXT"),
- "element-loading-spinner": unref(svg),
- "element-loading-svg-view-box": "0, 0, 50, 50",
- "element-loading-background": "rgba(122, 122, 122, 0.5)"
- }, [
- createBaseVNode("div", _hoisted_2, [
- createBaseVNode("div", _hoisted_3, [
- isShowCustomDomainSelectList.value && customDomainList.value.length > 1 && isAutoCustomDomain.value ? (openBlock(), createBlock(_component_el_select, {
- key: 0,
- modelValue: currentCustomDomain.value,
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => currentCustomDomain.value = $event),
- placeholder: unref(T)("MANAGE_BUCKET_PAGE_CUSTOM_URL_SELECT_PLACEHOLDER"),
- style: { "width": "200px" },
- persistent: false,
- teleported: "",
- onChange: handleChangeCustomUrlInput
- }, {
- default: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(customDomainList.value, (item) => {
- return openBlock(), createBlock(_component_el_option, {
- key: item,
- label: item.label,
- value: item.value
- }, null, 8, ["label", "value"]);
- }), 128))
- ]),
- _: 1
- }, 8, ["modelValue", "placeholder"])) : isShowCustomDomainInput.value ? (openBlock(), createBlock(_component_el_input, {
- key: 1,
- modelValue: currentCustomDomain.value,
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => currentCustomDomain.value = $event),
- placeholder: unref(T)("MANAGE_BUCKET_PAGE_CUSTOM_URL_INPUT_PLACEHOLDER"),
- style: { "width": "200px" },
- onBlur: handleChangeCustomUrlInput
- }, null, 8, ["modelValue", "placeholder"])) : (openBlock(), createBlock(unref(ElLink), {
- key: 2,
- underline: false,
- type: "primary",
- onClick: _cache[2] || (_cache[2] = ($event) => copyToClipboard(currentCustomDomain.value))
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(currentCustomDomain.value), 1)
- ]),
- _: 1
- }))
- ]),
- createBaseVNode("div", {
- style: { "display": "flex" },
- onClick: showUploadDialog
- }, [
- createVNode(unref(ElButton), {
- type: "primary",
- link: true
- }, {
- default: withCtx(() => [
- createVNode(unref(ElTooltip), {
- class: "item",
- effect: "dark",
- content: unref(T)("MANAGE_BUCKET_PAGE_UPLOAD_FILES_TOOLTIP"),
- placement: "bottom",
- persistent: false,
- teleported: ""
- }, {
- default: withCtx(() => [
- createVNode(unref(ElIcon), {
- class: "icon",
- size: "25px"
- }, {
- default: withCtx(() => [
- createVNode(unref(upload_default))
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["content"])
- ]),
- _: 1
- })
- ]),
- createBaseVNode("div", null, [
- createVNode(unref(ElButton), {
- type: "primary",
- link: true,
- onClick: showUrlDialog
- }, {
- default: withCtx(() => [
- createVNode(unref(ElTooltip), {
- class: "item",
- effect: "dark",
- content: unref(T)("MANAGE_BUCKET_PAGE_UPLOAD_FROM_URL_TOOLTIP"),
- placement: "bottom",
- persistent: false,
- teleported: ""
- }, {
- default: withCtx(() => [
- createVNode(unref(ElIcon), {
- class: "icon",
- size: "25px",
- style: { "margin-left": "5px" }
- }, {
- default: withCtx(() => [
- createVNode(unref(upload_filled_default))
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["content"])
- ]),
- _: 1
- })
- ]),
- isShowCreateNewFolder.value ? (openBlock(), createElementBlock("div", _hoisted_4, [
- createVNode(unref(ElButton), {
- type: "primary",
- link: true,
- onClick: handleCreateFolder
- }, {
- default: withCtx(() => [
- createVNode(unref(ElTooltip), {
- class: "item",
- effect: "dark",
- content: unref(T)("MANAGE_BUCKET_PAGE_CREATE_FOLDER_TOOLTIP"),
- placement: "bottom",
- persistent: false,
- teleported: ""
- }, {
- default: withCtx(() => [
- createVNode(unref(ElIcon), {
- class: "icon",
- size: "25px",
- style: { "margin-left": "5px" }
- }, {
- default: withCtx(() => [
- createVNode(unref(folder_add_default))
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["content"])
- ]),
- _: 1
- })
- ])) : createCommentVNode("", true),
- createBaseVNode("div", { onClick: showDownloadDialog }, [
- createVNode(unref(ElButton), {
- type: "primary",
- link: true
- }, {
- default: withCtx(() => [
- createVNode(unref(ElTooltip), {
- class: "item",
- effect: "dark",
- content: unref(T)("MANAGE_BUCKET_PAGE_DOWNLOAD_TOOLTIP"),
- placement: "bottom",
- persistent: false,
- teleported: ""
- }, {
- default: withCtx(() => [
- createVNode(unref(ElIcon), {
- class: "icon",
- size: "25px",
- style: { "margin-left": "5px" }
- }, {
- default: withCtx(() => [
- createVNode(unref(download_default))
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["content"])
- ]),
- _: 1
- })
- ]),
- isShowRenameFileIcon.value ? (openBlock(), createElementBlock("div", {
- key: 1,
- onClick: handleBatchRenameFile
- }, [
- createVNode(unref(ElButton), {
- type: "primary",
- link: true
- }, {
- default: withCtx(() => [
- createVNode(unref(ElTooltip), {
- class: "item",
- effect: "dark",
- content: unref(T)("MANAGE_BUCKET_PAGE_BATCH_RENAME_TOOLTIP"),
- placement: "bottom",
- persistent: false,
- teleported: ""
- }, {
- default: withCtx(() => [
- createVNode(unref(ElIcon), {
- class: "icon",
- size: "25px",
- style: { "margin-left": "5px" }
- }, {
- default: withCtx(() => [
- createVNode(unref(edit_default))
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["content"])
- ]),
- _: 1
- })
- ])) : createCommentVNode("", true),
- createBaseVNode("div", null, [
- createVNode(unref(ElButton), {
- type: "primary",
- link: true
- }, {
- default: withCtx(() => [
- createVNode(unref(ElTooltip), {
- class: "item",
- effect: "dark",
- content: unref(T)("MANAGE_BUCKET_PAGE_BATCH_COPY_URL_TOOLTIP"),
- placement: "right",
- persistent: false,
- teleported: ""
- }, {
- default: withCtx(() => [
- createVNode(unref(ElDropdown), { teleported: "" }, {
- dropdown: withCtx(() => [
- isShowPresignedUrl.value ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList([...linkFormatArray, { key: "preSignURL", value: "preSignedUrl" }], (i) => {
- return openBlock(), createBlock(unref(ElDropdownItem), {
- key: i.key,
- onClick: ($event) => handleBatchCopyLink(i.value)
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(i.key), 1)
- ]),
- _: 2
- }, 1032, ["onClick"]);
- }), 128)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, renderList(linkFormatArray, (i) => {
- return createVNode(unref(ElDropdownItem), {
- key: i.value + i.key,
- onClick: ($event) => handleBatchCopyLink(i.value)
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(i.key), 1)
- ]),
- _: 2
- }, 1032, ["onClick"]);
- }), 64))
- ]),
- default: withCtx(() => [
- createVNode(unref(ElIcon), {
- class: "icon",
- size: "25px",
- color: selectedItems.value.length > 0 ? "#409EFF" : "gray",
- style: { "margin-left": "10px" },
- onClick: _cache[3] || (_cache[3] = ($event) => handleBatchCopyLink(unref(manageStore).config.settings.pasteFormat))
- }, {
- default: withCtx(() => [
- createVNode(unref(link_default))
- ]),
- _: 1
- }, 8, ["color"])
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["content"])
- ]),
- _: 1
- })
- ]),
- createBaseVNode("div", null, [
- createVNode(unref(ElButton), {
- type: "primary",
- link: true
- }, {
- default: withCtx(() => [
- createVNode(unref(ElTooltip), {
- class: "item",
- effect: "dark",
- content: unref(T)("MANAGE_BUCKET_PAGE_COPY_FILE_INFO_TOOLTIP"),
- placement: "bottom",
- persistent: false,
- teleported: ""
- }, {
- default: withCtx(() => [
- createVNode(unref(ElIcon), {
- class: "icon",
- size: "25px",
- color: selectedItems.value.length > 0 ? "#409EFF" : "gray",
- style: { "margin-left": "10px" },
- onClick: handleBatchCopyInfo
- }, {
- default: withCtx(() => [
- createVNode(unref(document_default))
- ]),
- _: 1
- }, 8, ["color"])
- ]),
- _: 1
- }, 8, ["content"])
- ]),
- _: 1
- })
- ]),
- createBaseVNode("div", null, [
- createVNode(unref(ElButton), {
- type: "primary",
- link: true,
- onClick: forceRefreshFileList
- }, {
- default: withCtx(() => [
- createVNode(unref(ElTooltip), {
- class: "item",
- effect: "dark",
- content: unref(T)("MANAGE_BUCKET_PAGE_FORCE_REFRESH_TOOLTIP"),
- placement: "bottom",
- persistent: false,
- teleported: ""
- }, {
- default: withCtx(() => [
- createVNode(unref(ElIcon), {
- id: "refresh",
- class: "icon",
- size: "25px",
- style: { "margin-left": "10px", "color": "red" }
- }, {
- default: withCtx(() => [
- createVNode(unref(refresh_default))
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["content"])
- ]),
- _: 1
- })
- ]),
- createVNode(_component_el_input, {
- modelValue: searchText.value,
- "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => searchText.value = $event),
- placeholder: unref(T)("MANAGE_BUCKET_PAGE_SEARCH_PLACEHOLDER"),
- style: { "margin-left": "10px", "width": "200px" },
- clearable: "",
- size: "small"
- }, null, 8, ["modelValue", "placeholder"])
- ]),
- createBaseVNode("div", _hoisted_5, [
- createVNode(_component_el_breadcrumb, {
- "separator-icon": unref(arrow_right_default),
- style: { "margin-top": "2px" }
- }, {
- default: withCtx(() => [
- createVNode(_component_el_breadcrumb_item, { style: { "flex-shrink": "0" } }, {
- default: withCtx(() => [
- createVNode(unref(ElIcon), {
- size: 16,
- style: { "margin-right": "5px" }
- }, {
- default: withCtx(() => [
- createVNode(unref(home_filled_default))
- ]),
- _: 1
- })
- ]),
- _: 1
- }),
- configMap.prefix !== "/" ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(configMap.prefix.replace(/\/$/g, "").split("/"), (item, index) => {
- return openBlock(), createBlock(_component_el_breadcrumb_item, {
- key: index,
- style: { "flex-shrink": "0", "font-size": "12px", "color": "#606266", "font-family": "Arial, Helvetica, sans-serif", "cursor": "pointer" },
- onClick: ($event) => handleBreadcrumbClick(index)
- }, {
- default: withCtx(() => [
- createVNode(unref(ElLink), null, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(item === "" ? unref(T)("MANAGE_BUCKET_PAGE_ROOT_FOLDER") : item), 1)
- ]),
- _: 2
- }, 1024)
- ]),
- _: 2
- }, 1032, ["onClick"]);
- }), 128)) : (openBlock(), createBlock(_component_el_breadcrumb_item, {
- key: 1,
- style: { "flex-shrink": "0", "font-size": "12px", "color": "#606266", "font-family": "Arial, Helvetica, sans-serif", "cursor": "pointer" }
- }, {
- default: withCtx(() => [
- createVNode(unref(ElLink), null, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_PAGE_ROOT_FOLDER")), 1)
- ]),
- _: 1
- })
- ]),
- _: 1
- }))
- ]),
- _: 1
- }, 8, ["separator-icon"])
- ]),
- createBaseVNode("div", _hoisted_6, [
- createBaseVNode("div", _hoisted_7, [
- createBaseVNode("div", _hoisted_8, [
- createBaseVNode("span", null, [
- createVNode(unref(ElIcon), {
- size: 14,
- style: { "margin-right": "5px" }
- }, {
- default: withCtx(() => [
- createVNode(unref(document_default))
- ]),
- _: 1
- }),
- createBaseVNode("span", _hoisted_9, toDisplayString(`${unref(T)("MANAGE_BUCKET_PAGE_FILE_NUMBER")}${currentPageFilesInfo.length}`), 1)
- ]),
- createBaseVNode("span", null, [
- createVNode(unref(ElIcon), {
- size: 14,
- style: { "margin-right": "5px" }
- }, {
- default: withCtx(() => [
- createVNode(unref(coin_default))
- ]),
- _: 1
- }),
- createBaseVNode("span", _hoisted_10, toDisplayString(`${unref(T)("MANAGE_BUCKET_PAGE_FILE_SIZE")}${calculateAllFileSize.value}`), 1)
- ])
- ])
- ]),
- selectedItems.value.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_11, [
- createVNode(unref(ElButton), {
- class: "btn",
- size: "small",
- type: "primary",
- plain: "",
- style: { "margin-right": "2px" },
- onClick: handleCheckAllChange
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_PAGE_SELECT_ALL")), 1)
- ]),
- _: 1
- })
- ])) : createCommentVNode("", true),
- selectedItems.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_12, [
- createVNode(unref(ElButton), {
- class: "btn",
- size: "small",
- type: "warning",
- plain: "",
- style: { "margin-right": "2px" },
- onClick: handleCancelCheck
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_PAGE_SELECT_NONE")), 1)
- ]),
- _: 1
- }),
- createVNode(unref(ElButton), {
- class: "btn",
- size: "small",
- type: "primary",
- plain: "",
- style: { "margin-right": "2px" },
- onClick: handleReverseCheck
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_PAGE_SELECT_INVERT")), 1)
- ]),
- _: 1
- }),
- createVNode(unref(ElButton), {
- class: "btn",
- size: "small",
- type: "primary",
- plain: "",
- style: { "margin-right": "2px" },
- onClick: handleCheckAllChange
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_PAGE_SELECT_ALL")), 1)
- ]),
- _: 1
- }),
- createVNode(unref(ElButton), {
- class: "btn",
- size: "small",
- type: "success",
- plain: "",
- icon: unref(download_default),
- style: { "margin-right": "2px" },
- onClick: handleBatchDownload
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(`${unref(T)("MANAGE_BUCKET_DOWNLOAD_BTN")}(${selectedItems.value.filter((item) => item.isDir === false).length})`), 1)
- ]),
- _: 1
- }, 8, ["icon"]),
- createVNode(unref(ElButton), {
- class: "btn",
- size: "small",
- type: "danger",
- icon: unref(delete_filled_default),
- onClick: handleBatchDeleteInfo
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(`${unref(T)("MANAGE_BUCKET_DELETE_BTN")}${selectedItems.value.length}`), 1)
- ]),
- _: 1
- }, 8, ["icon"])
- ])) : createCommentVNode("", true),
- createVNode(unref(ElDropdown), { teleported: "" }, {
- dropdown: withCtx(() => [
- (openBlock(), createElementBlock(Fragment, null, renderList(sortTypeList, (item) => {
- return createVNode(unref(ElDropdownItem), {
- key: item,
- onClick: ($event) => sortFile(item)
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)(`MANAGE_BUCKET_SORT_${item.toUpperCase()}`)), 1)
- ]),
- _: 2
- }, 1032, ["onClick"]);
- }), 64))
- ]),
- default: withCtx(() => [
- createVNode(unref(ElButton), {
- size: "small",
- type: "primary",
- plain: "",
- icon: unref(sort_default)
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_SORT_TITLE")), 1)
- ]),
- _: 1
- }, 8, ["icon"])
- ]),
- _: 1
- }),
- createVNode(_component_el_button_group, {
- size: "small",
- style: { "margin-left": "10px", "width": "80px", "flex-shrink": "0" },
- type: "primary"
- }, {
- default: withCtx(() => [
- createVNode(unref(ElButton), {
- icon: unref(grid_default),
- type: layoutStyle.value === "grid" ? "primary" : "info",
- onClick: _cache[5] || (_cache[5] = ($event) => handleViewChange("grid"))
- }, null, 8, ["icon", "type"]),
- createVNode(unref(ElButton), {
- icon: unref(fold_default),
- type: layoutStyle.value === "list" ? "primary" : "info",
- onClick: _cache[6] || (_cache[6] = ($event) => handleViewChange("list"))
- }, null, 8, ["icon", "type"])
- ]),
- _: 1
- }),
- paging.value ? (openBlock(), createBlock(_component_el_input_number, {
- key: 2,
- modelValue: currentPageNumber.value,
- "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => currentPageNumber.value = $event),
- min: 1,
- size: "small",
- disabled: !paging.value,
- style: { "margin-left": "10px", "flex-shrink": "0" },
- onChange: changePage
- }, null, 8, ["modelValue", "disabled"])) : createCommentVNode("", true)
- ]),
- createVNode(_component_el_dialog, {
- modelValue: dialogVisible.value,
- "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => dialogVisible.value = $event),
- title: unref(T)("MANAGE_BUCKET_URL_UPLOAD_DIALOG_TITLE"),
- width: "50%",
- draggable: "",
- center: "",
- "align-center": "",
- "append-to-body": ""
- }, {
- footer: withCtx(() => [
- createVNode(unref(ElButton), {
- onClick: _cache[9] || (_cache[9] = ($event) => dialogVisible.value = false)
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_URL_UPLOAD_DIALOG_CANCEL")), 1)
- ]),
- _: 1
- }),
- createVNode(unref(ElButton), {
- type: "primary",
- style: { "font-size": "12px", "font-weight": "500" },
- onClick: handleUploadFromUrl
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_URL_UPLOAD_DIALOG_CONFIRM")), 1)
- ]),
- _: 1
- })
- ]),
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: urlToUpload.value,
- "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => urlToUpload.value = $event),
- placeholder: "https://www.baidu.com/img/bd_logo1.png\nhttps://www.baidu.com/img/bd_logo1.png",
- style: { "margin-bottom": "10px" },
- type: "textarea",
- autosize: { minRows: 3, maxRows: 5 }
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- }, 8, ["modelValue", "title"]),
- layoutStyle.value === "list" ? (openBlock(), createElementBlock("div", _hoisted_13, [
- createVNode(_component_el_auto_resizer, null, {
- default: withCtx(({ height, width }) => [
- createVNode(_component_el_table_v2, {
- ref_key: "fileTable",
- ref: fileTable,
- columns,
- data: filterList.value,
- "row-class": rowClass,
- width,
- height
- }, null, 8, ["data", "width", "height"])
- ]),
- _: 1
- })
- ])) : createCommentVNode("", true),
- layoutStyle.value === "grid" ? (openBlock(), createElementBlock("div", _hoisted_14, [
- createVNode(_component_el_col, { span: 24 }, {
- default: withCtx(() => [
- createVNode(_component_el_row, { gutter: 16 }, {
- default: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(filterList.value, (item, index) => {
- return openBlock(), createBlock(_component_el_col, {
- key: index,
- xs: 24,
- sm: 12,
- md: 8,
- lg: 3,
- xl: 2
- }, {
- default: withCtx(() => [
- createVNode(unref(ElCard), {
- "body-style": {
- padding: "0px",
- height: "150px",
- width: "100%",
- background: item.checked ? "#f2f2f2" : "#fff"
- },
- style: { "margin-bottom": "10px" },
- shadow: "hover"
- }, {
- default: withCtx(() => [
- !item.isDir && !["webdavplist", "sftp", "local", "s3plist"].includes(currentPicBedName.value) ? (openBlock(), createBlock(unref(ElImage), {
- key: 0,
- src: isShowThumbnail.value && item.isImage ? item.url : require(`./assets/icons/${unref(getFileIconPath)(item.fileName ?? "")}`),
- fit: "contain",
- style: { "height": "100px", "width": "100%", "margin": "0 auto" },
- onClick: ($event) => handleClickFile(item)
- }, {
- placeholder: withCtx(() => [
- createVNode(unref(ElIcon), null, {
- default: withCtx(() => [
- createVNode(unref(loading_default))
- ]),
- _: 1
- })
- ]),
- error: withCtx(() => [
- createVNode(unref(ElImage), {
- src: require(`./assets/icons/${unref(getFileIconPath)(item.fileName ?? "")}`),
- fit: "contain",
- style: { "height": "100px", "width": "100%", "margin": "0 auto" }
- }, null, 8, ["src"])
- ]),
- _: 2
- }, 1032, ["src", "onClick"])) : !item.isDir && currentPicBedName.value === "s3plist" && !isUsePreSignedUrl.value ? (openBlock(), createBlock(unref(ElImage), {
- key: 1,
- src: isShowThumbnail.value && item.isImage ? item.url : require(`./assets/icons/${unref(getFileIconPath)(item.fileName ?? "")}`),
- fit: "contain",
- style: { "height": "100px", "width": "100%", "margin": "0 auto" },
- onClick: ($event) => handleClickFile(item)
- }, {
- placeholder: withCtx(() => [
- createVNode(unref(ElIcon), null, {
- default: withCtx(() => [
- createVNode(unref(loading_default))
- ]),
- _: 1
- })
- ]),
- error: withCtx(() => [
- createVNode(unref(ElImage), {
- src: require(`./assets/icons/${unref(getFileIconPath)(item.fileName ?? "")}`),
- fit: "contain",
- style: { "height": "100px", "width": "100%", "margin": "0 auto" }
- }, null, 8, ["src"])
- ]),
- _: 2
- }, 1032, ["src", "onClick"])) : !item.isDir && currentPicBedName.value === "s3plist" && isUsePreSignedUrl.value ? (openBlock(), createBlock(_sfc_main$2, {
- key: 2,
- "is-show-thumbnail": isShowThumbnail.value,
- item,
- alias: configMap.alias,
- url: item.url,
- config: handleGetS3Config(item),
- onClick: ($event) => handleClickFile(item)
- }, null, 8, ["is-show-thumbnail", "item", "alias", "url", "config", "onClick"])) : !item.isDir && currentPicBedName.value === "webdavplist" && item.isImage ? (openBlock(), createBlock(_sfc_main$1, {
- key: 3,
- "is-show-thumbnail": isShowThumbnail.value,
- item,
- config: handleGetWebdavConfig(),
- url: item.url,
- onClick: ($event) => handleClickFile(item)
- }, null, 8, ["is-show-thumbnail", "item", "config", "url", "onClick"])) : !item.isDir && currentPicBedName.value === "local" && item.isImage ? (openBlock(), createBlock(_sfc_main$3, {
- key: 4,
- "is-show-thumbnail": isShowThumbnail.value,
- item,
- "local-path": item.key,
- onClick: ($event) => handleClickFile(item)
- }, null, 8, ["is-show-thumbnail", "item", "local-path", "onClick"])) : !item.isDir ? (openBlock(), createBlock(unref(ElImage), {
- key: 5,
- src: require(`./assets/icons/${unref(getFileIconPath)(item.fileName ?? "")}`),
- fit: "contain",
- style: { "height": "100px", "width": "100%", "margin": "0 auto" },
- onClick: ($event) => handleClickFile(item)
- }, null, 8, ["src", "onClick"])) : (openBlock(), createBlock(unref(ElImage), {
- key: 6,
- src: require("./assets/icons/folder.webp"),
- fit: "contain",
- style: { "height": "100px", "width": "100%", "margin": "0 auto" },
- onClick: ($event) => handleClickFile(item)
- }, null, 8, ["src", "onClick"])),
- createBaseVNode("div", {
- style: { "align-items": "center", "display": "flex", "justify-content": "center" },
- onClick: ($event) => copyToClipboard(item.fileName ?? "")
- }, [
- createVNode(unref(ElTooltip), {
- placement: "top",
- effect: "light",
- content: item.fileName,
- persistent: false,
- teleported: ""
- }, {
- default: withCtx(() => [
- createVNode(unref(ElLink), {
- style: { "font-size": "12px", "font-family": "Arial, Helvetica, sans-serif" },
- underline: false,
- type: item.checked ? "primary" : "info"
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(formatFileName)(item.fileName ?? "", 15)), 1)
- ]),
- _: 2
- }, 1032, ["type"])
- ]),
- _: 2
- }, 1032, ["content"])
- ], 8, _hoisted_15),
- createVNode(_component_el_row, {
- style: { "display": "flex" },
- justify: "space-between",
- align: "middle"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_row, null, {
- default: withCtx(() => [
- !item.isDir && isShowRenameFileIcon.value ? (openBlock(), createBlock(unref(ElIcon), {
- key: 0,
- size: "15",
- style: { "cursor": "pointer" },
- color: "#409EFF",
- onClick: ($event) => handleRenameFile(item)
- }, {
- default: withCtx(() => [
- createVNode(unref(edit_default))
- ]),
- _: 2
- }, 1032, ["onClick"])) : createCommentVNode("", true),
- item.isDir ? (openBlock(), createBlock(unref(ElIcon), {
- key: 1,
- size: "15",
- style: { "cursor": "pointer" },
- color: "crimson",
- onClick: ($event) => handleFolderBatchDownload(item)
- }, {
- default: withCtx(() => [
- createVNode(unref(download_default))
- ]),
- _: 2
- }, 1032, ["onClick"])) : createCommentVNode("", true),
- createVNode(unref(ElDropdown), { teleported: "" }, {
- default: withCtx(() => [
- createVNode(unref(ElIcon), {
- size: "15",
- style: { "cursor": "pointer" },
- color: "#409EFF",
- onClick: async () => {
- copyToClipboard(
- await unref(formatLink)(
- item.url,
- item.fileName,
- unref(manageStore).config.settings.pasteFormat ?? "$markdown",
- unref(manageStore).config.settings.customPasteFormat ?? "$url"
- )
- );
- }
- }, {
- default: withCtx(() => [
- createVNode(unref(copy_document_default))
- ]),
- _: 2
- }, 1032, ["onClick"])
- ]),
- dropdown: withCtx(() => [
- createVNode(unref(ElDropdownMenu), null, {
- default: withCtx(() => [
- (openBlock(), createElementBlock(Fragment, null, renderList(linkFormatList, (format) => {
- return createVNode(unref(ElDropdownItem), {
- key: format,
- onClick: ($event) => copyLink(item, format)
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)(`MANAGE_BUCKET_URL_FORMAT_${format.toUpperCase().replace(/-/g, "_")}`)), 1)
- ]),
- _: 2
- }, 1032, ["onClick"]);
- }), 64)),
- isShowPresignedUrl.value ? (openBlock(), createBlock(unref(ElDropdownItem), {
- key: 0,
- onClick: async () => {
- copyToClipboard(await getPreSignedUrl(item));
- }
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_URL_FORMAT_PRESIGN")), 1)
- ]),
- _: 2
- }, 1032, ["onClick"])) : createCommentVNode("", true)
- ]),
- _: 2
- }, 1024)
- ]),
- _: 2
- }, 1024),
- createVNode(unref(ElIcon), {
- size: "15",
- style: { "cursor": "pointer" },
- color: "#409EFF",
- onClick: ($event) => handleShowFileInfo(item)
- }, {
- default: withCtx(() => [
- createVNode(unref(document_default))
- ]),
- _: 2
- }, 1032, ["onClick"]),
- createVNode(unref(ElIcon), {
- size: "15",
- style: { "cursor": "pointer" },
- color: "#FFB6C1",
- onClick: ($event) => handleDeleteFile(item)
- }, {
- default: withCtx(() => [
- createVNode(unref(delete_filled_default))
- ]),
- _: 2
- }, 1032, ["onClick"])
- ]),
- _: 2
- }, 1024),
- createVNode(unref(ElCheckbox), {
- modelValue: item.checked,
- "onUpdate:modelValue": ($event) => item.checked = $event,
- size: "large"
- }, null, 8, ["modelValue", "onUpdate:modelValue"])
- ]),
- _: 2
- }, 1024)
- ]),
- _: 2
- }, 1032, ["body-style"])
- ]),
- _: 2
- }, 1024);
- }), 128))
- ]),
- _: 1
- })
- ]),
- _: 1
- })
- ])) : createCommentVNode("", true),
- isShowImagePreview.value ? (openBlock(), createBlock(_component_el_image_viewer, {
- key: 2,
- "url-list": ImagePreviewList.value,
- "initial-index": getCurrentPreviewIndex.value,
- infinite: "",
- "hide-on-click-modal": "",
- teleported: "",
- onClose: _cache[11] || (_cache[11] = ($event) => isShowImagePreview.value = false)
- }, null, 8, ["url-list", "initial-index"])) : createCommentVNode("", true),
- createVNode(_component_el_dialog, {
- modelValue: isShowFileInfo.value,
- "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => isShowFileInfo.value = $event),
- title: unref(T)("MANAGE_BUCKET_FILE_INFO_TITLE"),
- center: "",
- "align-center": "",
- draggable: "",
- "append-to-body": ""
- }, {
- header: withCtx(() => [
- createVNode(unref(ElButton), {
- type: "primary",
- plain: "",
- onClick: _cache[12] || (_cache[12] = ($event) => copyToClipboard(JSON.stringify(currentShowedFileInfo.value, null, 2)))
- }, {
- icon: withCtx(() => [
- createVNode(unref(ElIcon), null, {
- default: withCtx(() => [
- createVNode(unref(document_default))
- ]),
- _: 1
- })
- ]),
- default: withCtx(() => [
- createTextVNode(" " + toDisplayString(unref(T)("MANAGE_BUCKET_FILE_INFO_COPY_TIPS")), 1)
- ]),
- _: 1
- })
- ]),
- default: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(currentShowedFileInfo.value, (value, key) => {
- return openBlock(), createBlock(_component_el_row, {
- key,
- gutter: 20,
- style: {
- margin: "10px 0",
- textAlign: "center",
- fontFamily: "Arial, Helvetica, sans-serif"
- }
- }, {
- default: withCtx(() => [
- createVNode(_component_el_col, {
- span: 6,
- onClick: ($event) => copyToClipboard(JSON.stringify({ [key]: value }))
- }, {
- default: withCtx(() => [
- createBaseVNode("span", _hoisted_16, toDisplayString(key) + ":", 1)
- ]),
- _: 2
- }, 1032, ["onClick"]),
- createVNode(_component_el_col, {
- span: 18,
- onClick: ($event) => copyToClipboard(value)
- }, {
- default: withCtx(() => [
- createBaseVNode("span", _hoisted_17, toDisplayString(value), 1)
- ]),
- _: 2
- }, 1032, ["onClick"])
- ]),
- _: 2
- }, 1024);
- }), 128))
- ]),
- _: 1
- }, 8, ["modelValue", "title"]),
- isLoadingData.value ? (openBlock(), createBlock(_component_el_affix, {
- key: 3,
- style: { "position": "fixed", "bottom": "25px", "right": "0" },
- onClick: cancelLoading
- }, {
- default: withCtx(() => [
- createVNode(unref(ElButton), {
- type: "warning",
- icon: "el-icon-loading",
- style: { "font-size": "12px", "font-weight": "500" },
- loading: isLoadingData.value
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_FILE_LIST_LOADING")), 1)
- ]),
- _: 1
- }, 8, ["loading"])
- ]),
- _: 1
- })) : createCommentVNode("", true),
- isLoadingDownloadData.value ? (openBlock(), createBlock(_component_el_affix, {
- key: 4,
- style: { "position": "fixed", "top": "50px", "right": "0px" },
- onClick: cancelDownloadLoading
- }, {
- default: withCtx(() => [
- createVNode(unref(ElButton), {
- type: "warning",
- icon: "el-icon-loading",
- style: { "font-size": "12px", "font-weight": "500" },
- loading: isLoadingDownloadData.value
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_FILE_LIST_DOWNLOAD_PRE")), 1)
- ]),
- _: 1
- }, 8, ["loading"])
- ]),
- _: 1
- })) : createCommentVNode("", true),
- createVNode(_component_el_drawer, {
- modelValue: isShowUploadPanel.value,
- "onUpdate:modelValue": _cache[18] || (_cache[18] = ($event) => isShowUploadPanel.value = $event),
- size: "60%",
- "append-to-body": "",
- onOpen: startRefreshUploadTask,
- onClose: stopRefreshUploadTask
- }, {
- header: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: isUploadKeepDirStructure.value,
- "onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => isUploadKeepDirStructure.value = $event),
- "active-text": unref(T)("MANAGE_BUCKET_KEEP_FOLDER_STRUCTURE"),
- "inactive-text": unref(T)("MANAGE_BUCKET_NOT_KEEP_FOLDER_STRUCTURE"),
- onChange: handleUploadKeepDirChange
- }, null, 8, ["modelValue", "active-text", "inactive-text"])
- ]),
- default: withCtx(() => [
- createBaseVNode("div", {
- id: "upload-area",
- class: normalizeClass({ "is-dragover": isDragover.value }),
- styel: "position: fixed;bottom: 0;right: 0;heigth: 100%;width: 100%;",
- onDrop: withModifiers(onDrop, ["prevent"]),
- onDragover: _cache[15] || (_cache[15] = withModifiers(($event) => isDragover.value = true, ["prevent"])),
- onDragleave: _cache[16] || (_cache[16] = withModifiers(($event) => isDragover.value = false, ["prevent"])),
- onClick: openFileSelectDialog
- }, [
- !tableData.length ? (openBlock(), createElementBlock("div", _hoisted_18, [
- createBaseVNode("div", _hoisted_19, [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_UPLOAD_AREA_TITLE")) + " ", 1),
- createBaseVNode("span", _hoisted_20, toDisplayString(unref(T)("MANAGE_BUCKET_UPLOAD_AREA_TEXT")), 1)
- ])
- ])) : createCommentVNode("", true),
- tableData.length ? (openBlock(), createBlock(_component_el_auto_resizer, { key: 1 }, {
- default: withCtx(({ height, width }) => [
- createVNode(_component_el_table_v2, {
- columns: upLoadTaskColumns,
- data: tableData.sort(
- (a, b) => b.isFolder - a.isFolder === 0 ? b.filesList.length - a.filesList.length : b.isFolder - a.isFolder
- ),
- width,
- height
- }, null, 8, ["data", "width", "height"])
- ]),
- _: 1
- })) : createCommentVNode("", true)
- ], 34),
- createBaseVNode("div", _hoisted_21, [
- createVNode(_component_el_button_group, null, {
- default: withCtx(() => [
- createVNode(unref(ElButton), {
- type: "success",
- plain: "",
- loading: isLoadingUploadPanelFiles.value,
- disabled: isLoadingUploadPanelFiles.value || !tableData.length,
- onClick: uploadFiles
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(isLoadingUploadPanelFiles.value ? unref(T)("MANAGE_BUCKET_UPLOAD_AREA_BTN_LOADING") : unref(T)("MANAGE_BUCKET_UPLOAD_AREA_BTN")), 1)
- ]),
- _: 1
- }, 8, ["loading", "disabled"]),
- createBaseVNode("span", null, [
- createVNode(unref(ElButton), {
- type: "warning",
- plain: "",
- disabled: isLoadingUploadPanelFiles.value,
- onClick: clearTableData
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_UPLOAD_AREA_CLEAR")), 1)
- ]),
- _: 1
- }, 8, ["disabled"])
- ])
- ]),
- _: 1
- })
- ]),
- createVNode(_component_el_tabs, {
- modelValue: activeUpLoadTab.value,
- "onUpdate:modelValue": _cache[17] || (_cache[17] = ($event) => activeUpLoadTab.value = $event),
- stretch: "",
- lazy: ""
- }, {
- default: withCtx(() => [
- createVNode(_component_el_tab_pane, { name: "uploading" }, {
- label: withCtx(() => [
- createBaseVNode("span", null, toDisplayString(unref(T)("MANAGE_BUCKET_UPLOAD_AREA_STATUS_UPLOADING")), 1),
- uploadingTaskList.value.length ? (openBlock(), createBlock(_component_el_badge, {
- key: 0,
- value: uploadingTaskList.value.length,
- max: 9999,
- type: "primary"
- }, null, 8, ["value"])) : createCommentVNode("", true)
- ]),
- default: withCtx(() => [
- createVNode(_component_el_button_group, { size: "small" }, {
- default: withCtx(() => [
- createVNode(unref(ElButton), {
- type: "primary",
- plain: "",
- icon: unref(document_default),
- onClick: handleCopyUploadingTaskInfo
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_UPLOAD_AREA_COPY_TASK")), 1)
- ]),
- _: 1
- }, 8, ["icon"]),
- createVNode(unref(ElButton), {
- type: "primary",
- plain: "",
- icon: unref(delete_filled_default),
- onClick: handleDeleteUploadedTask
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_UPLOAD_AREA_CLEAR_UPLOADED_TASK")), 1)
- ]),
- _: 1
- }, 8, ["icon"]),
- createVNode(unref(ElButton), {
- type: "primary",
- plain: "",
- icon: unref(delete_filled_default),
- onClick: handleDeleteAllUploadedTask
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_UPLOAD_AREA_CLEAR_ALL_TASK")), 1)
- ]),
- _: 1
- }, 8, ["icon"])
- ]),
- _: 1
- }),
- createBaseVNode("div", _hoisted_22, [
- createVNode(_component_el_auto_resizer, null, {
- default: withCtx(({ height, width }) => [
- createVNode(_component_el_table_v2, {
- columns: uploadingTaskColumns,
- data: uploadingTaskList.value,
- width,
- height
- }, null, 8, ["data", "width", "height"])
- ]),
- _: 1
- })
- ])
- ]),
- _: 1
- }),
- createVNode(_component_el_tab_pane, { name: "finished" }, {
- label: withCtx(() => [
- createBaseVNode("span", null, toDisplayString(unref(T)("MANAGE_BUCKET_UPLOAD_AREA_SUCCESS")), 1),
- uploadedTaskList.value.filter((item) => item.status === "uploaded").length ? (openBlock(), createBlock(_component_el_badge, {
- key: 0,
- value: uploadedTaskList.value.filter((item) => item.status === "uploaded").length,
- max: 9999,
- type: "success"
- }, null, 8, ["value"])) : createCommentVNode("", true)
- ]),
- default: withCtx(() => [
- createVNode(_component_el_button_group, { size: "small" }, {
- default: withCtx(() => [
- createVNode(unref(ElButton), {
- type: "primary",
- plain: "",
- icon: unref(document_default),
- onClick: handleCopyUploadingTaskInfo
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_UPLOAD_AREA_COPY_TASK")), 1)
- ]),
- _: 1
- }, 8, ["icon"]),
- createVNode(unref(ElButton), {
- type: "primary",
- plain: "",
- icon: unref(delete_filled_default),
- onClick: handleDeleteUploadedTask
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_UPLOAD_AREA_CLEAR_UPLOADED_TASK")), 1)
- ]),
- _: 1
- }, 8, ["icon"]),
- createVNode(unref(ElButton), {
- type: "primary",
- plain: "",
- icon: unref(delete_filled_default),
- onClick: handleDeleteAllUploadedTask
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_UPLOAD_AREA_CLEAR_ALL_TASK")), 1)
- ]),
- _: 1
- }, 8, ["icon"])
- ]),
- _: 1
- }),
- createBaseVNode("div", _hoisted_23, [
- createVNode(_component_el_auto_resizer, null, {
- default: withCtx(({ height, width }) => [
- createVNode(_component_el_table_v2, {
- columns: uploadedTaskColumns,
- data: uploadedTaskList.value.filter((item) => item.status === "uploaded"),
- width,
- height
- }, null, 8, ["data", "width", "height"])
- ]),
- _: 1
- })
- ])
- ]),
- _: 1
- }),
- createVNode(_component_el_tab_pane, { name: "failed" }, {
- label: withCtx(() => [
- createBaseVNode("span", null, toDisplayString(unref(T)("MANAGE_BUCKET_UPLOAD_AREA_FAILED")), 1),
- uploadedTaskList.value.filter((item) => item.status !== "uploaded").length ? (openBlock(), createBlock(_component_el_badge, {
- key: 0,
- value: uploadedTaskList.value.filter((item) => item.status !== "uploaded").length,
- max: 9999,
- type: "danger"
- }, null, 8, ["value"])) : createCommentVNode("", true)
- ]),
- default: withCtx(() => [
- createVNode(_component_el_button_group, { size: "small" }, {
- default: withCtx(() => [
- createVNode(unref(ElButton), {
- type: "primary",
- plain: "",
- icon: unref(document_default),
- onClick: handleCopyUploadingTaskInfo
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_UPLOAD_AREA_COPY_TASK")), 1)
- ]),
- _: 1
- }, 8, ["icon"]),
- createVNode(unref(ElButton), {
- type: "primary",
- plain: "",
- icon: unref(delete_filled_default),
- onClick: handleDeleteUploadedTask
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_UPLOAD_AREA_CLEAR_UPLOADED_TASK")), 1)
- ]),
- _: 1
- }, 8, ["icon"]),
- createVNode(unref(ElButton), {
- type: "primary",
- plain: "",
- icon: unref(delete_filled_default),
- onClick: handleDeleteAllUploadedTask
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_UPLOAD_AREA_CLEAR_ALL_TASK")), 1)
- ]),
- _: 1
- }, 8, ["icon"])
- ]),
- _: 1
- }),
- createBaseVNode("div", _hoisted_24, [
- createVNode(_component_el_auto_resizer, null, {
- default: withCtx(({ height, width }) => [
- createVNode(_component_el_table_v2, {
- columns: uploadedTaskColumns,
- data: uploadedTaskList.value.filter((item) => item.status !== "uploaded"),
- width,
- height
- }, null, 8, ["data", "width", "height"])
- ]),
- _: 1
- })
- ])
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["modelValue"])
- ]),
- _: 1
- }, 8, ["modelValue"]),
- createVNode(_component_el_drawer, {
- modelValue: isShowDownloadPanel.value,
- "onUpdate:modelValue": _cache[20] || (_cache[20] = ($event) => isShowDownloadPanel.value = $event),
- title: unref(T)("MANAGE_BUCKET_DOWNLOAD_PAGE_TITLE"),
- size: "60%",
- "append-to-body": "",
- onOpen: startRefreshDownloadTask,
- onClose: stopRefreshDownloadTask
- }, {
- default: withCtx(() => [
- createVNode(_component_el_tabs, {
- modelValue: activeDownLoadTab.value,
- "onUpdate:modelValue": _cache[19] || (_cache[19] = ($event) => activeDownLoadTab.value = $event),
- stretch: "",
- lazy: ""
- }, {
- default: withCtx(() => [
- createVNode(_component_el_tab_pane, { name: "downloading" }, {
- label: withCtx(() => [
- createBaseVNode("span", null, toDisplayString(unref(T)("MANAGE_BUCKET_DOWNLOADING")), 1),
- downloadingTaskList.value.length ? (openBlock(), createBlock(_component_el_badge, {
- key: 0,
- value: downloadingTaskList.value.length,
- type: "primary",
- max: 9999
- }, null, 8, ["value"])) : createCommentVNode("", true)
- ]),
- default: withCtx(() => [
- createVNode(_component_el_button_group, { size: "small" }, {
- default: withCtx(() => [
- createVNode(unref(ElButton), {
- type: "primary",
- plain: "",
- icon: unref(document_default),
- onClick: handleCopyDownloadingTaskInfo
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_DOWNLOAD_COPY_TASK")), 1)
- ]),
- _: 1
- }, 8, ["icon"]),
- createVNode(unref(ElButton), {
- type: "primary",
- plain: "",
- icon: unref(delete_filled_default),
- onClick: handleDeleteDownloadedTask
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_DOWNLOAD_CLEAR_DOWNLOADED_TASK")), 1)
- ]),
- _: 1
- }, 8, ["icon"]),
- createVNode(unref(ElButton), {
- type: "primary",
- plain: "",
- icon: unref(delete_filled_default),
- onClick: handleDeleteAllDownloadedTask
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_DOWNLOAD_CLEAR_ALL_TASK")), 1)
- ]),
- _: 1
- }, 8, ["icon"]),
- createVNode(unref(ElButton), {
- type: "primary",
- plain: "",
- icon: unref(folder_default),
- onClick: handleOpenDownloadedFolder
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_DOWNLOAD_OPEN_FOLDER")), 1)
- ]),
- _: 1
- }, 8, ["icon"])
- ]),
- _: 1
- }),
- createBaseVNode("div", _hoisted_25, [
- createVNode(_component_el_auto_resizer, null, {
- default: withCtx(({ height, width }) => [
- createVNode(_component_el_table_v2, {
- columns: downloadingTaskColumns,
- data: downloadingTaskList.value,
- width,
- height
- }, null, 8, ["data", "width", "height"])
- ]),
- _: 1
- })
- ])
- ]),
- _: 1
- }),
- createVNode(_component_el_tab_pane, { name: "finished" }, {
- label: withCtx(() => [
- createBaseVNode("span", null, toDisplayString(unref(T)("MANAGE_BUCKET_DOWNLOAD_SUCCESS")), 1),
- downloadedTaskList.value.filter((item) => item.status === "downloaded").length ? (openBlock(), createBlock(_component_el_badge, {
- key: 0,
- value: downloadedTaskList.value.filter((item) => item.status === "downloaded").length,
- max: 9999,
- type: "success"
- }, null, 8, ["value"])) : createCommentVNode("", true)
- ]),
- default: withCtx(() => [
- createVNode(_component_el_button_group, { size: "small" }, {
- default: withCtx(() => [
- createVNode(unref(ElButton), {
- type: "primary",
- plain: "",
- icon: unref(document_default),
- onClick: handleCopyDownloadingTaskInfo
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_DOWNLOAD_COPY_TASK")), 1)
- ]),
- _: 1
- }, 8, ["icon"]),
- createVNode(unref(ElButton), {
- type: "primary",
- plain: "",
- icon: unref(delete_filled_default),
- onClick: handleDeleteDownloadedTask
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_DOWNLOAD_CLEAR_DOWNLOADED_TASK")), 1)
- ]),
- _: 1
- }, 8, ["icon"]),
- createVNode(unref(ElButton), {
- type: "primary",
- plain: "",
- icon: unref(delete_filled_default),
- onClick: handleDeleteAllDownloadedTask
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_DOWNLOAD_CLEAR_ALL_TASK")), 1)
- ]),
- _: 1
- }, 8, ["icon"]),
- createVNode(unref(ElButton), {
- type: "primary",
- plain: "",
- icon: unref(folder_default),
- onClick: handleOpenDownloadedFolder
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_DOWNLOAD_OPEN_FOLDER")), 1)
- ]),
- _: 1
- }, 8, ["icon"])
- ]),
- _: 1
- }),
- createBaseVNode("div", _hoisted_26, [
- createVNode(_component_el_auto_resizer, null, {
- default: withCtx(({ height, width }) => [
- createVNode(_component_el_table_v2, {
- columns: downloadedTaskColumns,
- data: downloadedTaskList.value.filter((item) => item.status === "downloaded"),
- width,
- height
- }, null, 8, ["data", "width", "height"])
- ]),
- _: 1
- })
- ])
- ]),
- _: 1
- }),
- createVNode(_component_el_tab_pane, { name: "failed" }, {
- label: withCtx(() => [
- createBaseVNode("span", null, toDisplayString(unref(T)("MANAGE_BUCKET_DOWNLOAD_FAILED")), 1),
- downloadedTaskList.value.filter((item) => item.status !== "downloaded").length ? (openBlock(), createBlock(_component_el_badge, {
- key: 0,
- value: downloadedTaskList.value.filter((item) => item.status !== "downloaded").length,
- max: 9999,
- type: "warning"
- }, null, 8, ["value"])) : createCommentVNode("", true)
- ]),
- default: withCtx(() => [
- createVNode(_component_el_button_group, { size: "small" }, {
- default: withCtx(() => [
- createVNode(unref(ElButton), {
- type: "primary",
- plain: "",
- icon: unref(document_default),
- onClick: handleCopyDownloadingTaskInfo
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_DOWNLOAD_COPY_TASK")), 1)
- ]),
- _: 1
- }, 8, ["icon"]),
- createVNode(unref(ElButton), {
- type: "primary",
- plain: "",
- icon: unref(delete_filled_default),
- onClick: handleDeleteDownloadedTask
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_DOWNLOAD_CLEAR_DOWNLOADED_TASK")), 1)
- ]),
- _: 1
- }, 8, ["icon"]),
- createVNode(unref(ElButton), {
- type: "primary",
- plain: "",
- icon: unref(delete_filled_default),
- onClick: handleDeleteAllDownloadedTask
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_DOWNLOAD_CLEAR_ALL_TASK")), 1)
- ]),
- _: 1
- }, 8, ["icon"]),
- createVNode(unref(ElButton), {
- type: "primary",
- plain: "",
- icon: unref(folder_default),
- onClick: handleOpenDownloadedFolder
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_DOWNLOAD_OPEN_FOLDER")), 1)
- ]),
- _: 1
- }, 8, ["icon"])
- ]),
- _: 1
- }),
- createBaseVNode("div", _hoisted_27, [
- createVNode(_component_el_auto_resizer, null, {
- default: withCtx(({ height, width }) => [
- createVNode(_component_el_table_v2, {
- columns: downloadedTaskColumns,
- data: downloadedTaskList.value.filter((item) => item.status !== "downloaded"),
- width,
- height
- }, null, 8, ["data", "width", "height"])
- ]),
- _: 1
- })
- ])
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["modelValue"])
- ]),
- _: 1
- }, 8, ["modelValue", "title"]),
- createVNode(_component_el_dialog, {
- modelValue: isShowMarkDownDialog.value,
- "onUpdate:modelValue": _cache[22] || (_cache[22] = ($event) => isShowMarkDownDialog.value = $event),
- title: unref(T)("MANAGE_BUCKET_MARKDOWN_PREVIEW"),
- center: "",
- "align-center": "",
- draggable: "",
- fullscreen: "",
- "close-on-press-escape": "",
- "show-close": "",
- "destroy-on-close": "",
- "append-to-body": ""
- }, {
- default: withCtx(() => [
- createBaseVNode("div", {
- style: { "-webkit-user-select": "text", "user-select": "text" },
- innerHTML: markDownContent.value
- }, null, 8, _hoisted_28),
- createVNode(unref(ElButton), {
- type: "danger",
- icon: unref(close_default),
- size: "large",
- style: { "position": "fixed", "bottom": "10px", "right": "15px" },
- circle: "",
- onClick: _cache[21] || (_cache[21] = () => {
- isShowMarkDownDialog.value = false;
- })
- }, null, 8, ["icon"])
- ]),
- _: 1
- }, 8, ["modelValue", "title"]),
- createVNode(_component_el_dialog, {
- modelValue: isShowTextFileDialog.value,
- "onUpdate:modelValue": _cache[24] || (_cache[24] = ($event) => isShowTextFileDialog.value = $event),
- title: unref(T)("MANAGE_BUCKET_MARKDOWN_PREVIEW"),
- center: "",
- "align-center": "",
- draggable: "",
- fullscreen: "",
- "close-on-press-escape": "",
- "show-close": "",
- "destroy-on-close": "",
- "append-to-body": ""
- }, {
- default: withCtx(() => [
- createVNode(_component_highlightjs, {
- style: { "-webkit-user-select": "text", "user-select": "text" },
- language: "js",
- code: textfileContent.value
- }, null, 8, ["code"]),
- createVNode(unref(ElButton), {
- type: "danger",
- icon: unref(close_default),
- size: "large",
- style: { "position": "fixed", "bottom": "10px", "right": "15px" },
- circle: "",
- onClick: _cache[23] || (_cache[23] = () => {
- isShowTextFileDialog.value = false;
- })
- }, null, 8, ["icon"])
- ]),
- _: 1
- }, 8, ["modelValue", "title"]),
- createVNode(_component_el_dialog, {
- modelValue: isShowVideoFileDialog.value,
- "onUpdate:modelValue": _cache[26] || (_cache[26] = ($event) => isShowVideoFileDialog.value = $event),
- title: unref(T)("MANAGE_BUCKET_PLAY"),
- center: "",
- "align-center": "",
- draggable: "",
- fullscreen: "",
- "close-on-press-escape": "",
- "show-close": "",
- "destroy-on-close": "",
- "append-to-body": ""
- }, {
- default: withCtx(() => [
- createVNode(_component_video_player, {
- src: videoFileUrl.value,
- headers: videoPlayerHeaders.value,
- controls: "",
- loop: true,
- volume: 0.6,
- autoplay: true,
- width: 1100,
- height: 700
- }, null, 8, ["src", "headers"]),
- createVNode(unref(ElButton), {
- type: "danger",
- icon: unref(close_default),
- size: "large",
- style: { "position": "fixed", "bottom": "10px", "right": "15px" },
- circle: "",
- onClick: _cache[25] || (_cache[25] = () => {
- isShowVideoFileDialog.value = false;
- })
- }, null, 8, ["icon"])
- ]),
- _: 1
- }, 8, ["modelValue", "title"]),
- createVNode(_component_el_dialog, {
- modelValue: isShowBatchRenameDialog.value,
- "onUpdate:modelValue": _cache[32] || (_cache[32] = ($event) => isShowBatchRenameDialog.value = $event),
- title: unref(T)("MANAGE_BUCKET_RENAME_FILE"),
- center: "",
- "align-center": "",
- draggable: "",
- "destroy-on-close": "",
- "append-to-body": "",
- onClose: _cache[33] || (_cache[33] = () => {
- isSingleRename.value = false;
- isRenameIncludeExt.value = false;
- })
- }, {
- default: withCtx(() => [
- createVNode(unref(ElLink), {
- underline: false,
- style: { "margin-bottom": "10px" }
- }, {
- default: withCtx(() => [
- createBaseVNode("span", null, [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_RENAME_FILE_INPUT_A")) + " - Matched: " + toDisplayString(matchedFilesNumber.value) + " ", 1),
- createVNode(unref(ElTooltip), {
- effect: "dark",
- content: unref(T)("MANAGE_BUCKET_RENAME_FILE_INPUT_A_TIPS"),
- placement: "right",
- persistent: false,
- teleported: ""
- }, {
- default: withCtx(() => [
- createVNode(unref(ElIcon), { color: "#409EFF" }, {
- default: withCtx(() => [
- createVNode(unref(info_filled_default))
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["content"])
- ])
- ]),
- _: 1
- }),
- createVNode(_component_el_input, {
- modelValue: batchRenameMatch.value,
- "onUpdate:modelValue": _cache[27] || (_cache[27] = ($event) => batchRenameMatch.value = $event),
- placeholder: unref(T)("MANAGE_BUCKET_RENAME_FILE_INPUT_A_PLACEHOLDER"),
- clearable: ""
- }, null, 8, ["modelValue", "placeholder"]),
- createVNode(unref(ElLink), {
- underline: false,
- style: { "margin-bottom": "10px", "margin-top": "10px" }
- }, {
- default: withCtx(() => [
- createBaseVNode("span", null, [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_RENAME_FILE_INPUT_B")) + " ", 1),
- createVNode(unref(ElPopover), {
- effect: "light",
- placement: "right",
- width: "280",
- persistent: false,
- teleported: ""
- }, {
- reference: withCtx(() => [
- createVNode(unref(ElIcon), { color: "#409EFF" }, {
- default: withCtx(() => [
- createVNode(unref(info_filled_default))
- ]),
- _: 1
- })
- ]),
- default: withCtx(() => [
- createVNode(_component_el_descriptions, {
- column: 1,
- style: { "width": "250px" },
- border: ""
- }, {
- default: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(customRenameFormatTable), (item, index) => {
- return openBlock(), createBlock(_component_el_descriptions_item, {
- key: index,
- label: item.placeholder,
- align: "center",
- "label-style": "width: 100px;"
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(item.description), 1)
- ]),
- _: 2
- }, 1032, ["label"]);
- }), 128)),
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(customRenameFormatTable).slice(0, unref(customRenameFormatTable).length - 1), (item, index) => {
- return openBlock(), createBlock(_component_el_descriptions_item, {
- key: index,
- label: item.placeholderB,
- align: "center",
- "label-style": "width: 100px;"
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(item.descriptionB), 1)
- ]),
- _: 2
- }, 1032, ["label"]);
- }), 128)),
- createVNode(_component_el_descriptions_item, {
- label: "{auto}",
- align: "center",
- "label-style": "width: 100px;"
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_RENAME_FILE_TABLE_IID")), 1)
- ]),
- _: 1
- })
- ]),
- _: 1
- })
- ]),
- _: 1
- })
- ])
- ]),
- _: 1
- }),
- createVNode(_component_el_input, {
- modelValue: batchRenameReplace.value,
- "onUpdate:modelValue": _cache[28] || (_cache[28] = ($event) => batchRenameReplace.value = $event),
- placeholder: "Ex. {Y}-{m}-{uuid}",
- clearable: ""
- }, null, 8, ["modelValue"]),
- createVNode(unref(ElLink), {
- underline: false,
- style: { "margin-bottom": "10px", "margin-top": "10px" }
- }, {
- default: withCtx(() => [
- createBaseVNode("span", null, [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_RENAME_FILE_EXT")) + " ", 1),
- createVNode(unref(ElTooltip), {
- effect: "dark",
- content: unref(T)("MANAGE_BUCKET_RENAME_FILE_EXT_TIPS"),
- placement: "right",
- persistent: false,
- teleported: ""
- }, {
- default: withCtx(() => [
- createVNode(unref(ElIcon), { color: "#409EFF" }, {
- default: withCtx(() => [
- createVNode(unref(info_filled_default))
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["content"])
- ])
- ]),
- _: 1
- }),
- _cache[34] || (_cache[34] = createBaseVNode("br", null, null, -1)),
- createVNode(_component_el_switch, {
- modelValue: isRenameIncludeExt.value,
- "onUpdate:modelValue": _cache[29] || (_cache[29] = ($event) => isRenameIncludeExt.value = $event),
- "active-text": unref(T)("MANAGE_BUCKET_RENAME_FILE_EXT_YES"),
- "inactive-text": unref(T)("MANAGE_BUCKET_RENAME_FILE_EXT_NO")
- }, null, 8, ["modelValue", "active-text", "inactive-text"]),
- createBaseVNode("div", _hoisted_29, [
- createVNode(unref(ElButton), {
- type: "danger",
- style: { "margin-right": "30px" },
- plain: "",
- icon: unref(close_default),
- onClick: _cache[30] || (_cache[30] = () => {
- isShowBatchRenameDialog.value = false;
- })
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_RENAME_FILE_CANCEL")), 1)
- ]),
- _: 1
- }, 8, ["icon"]),
- createVNode(unref(ElButton), {
- type: "primary",
- plain: "",
- icon: unref(edit_default),
- onClick: _cache[31] || (_cache[31] = ($event) => isSingleRename.value ? singleRename() : BatchRename())
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_RENAME_FILE_CONFIRM")), 1)
- ]),
- _: 1
- }, 8, ["icon"])
- ])
- ]),
- _: 1,
- __: [34]
- }, 8, ["modelValue", "title"])
- ], 8, _hoisted_1)), [
- [_directive_loading, isShowLoadingPage.value]
- ]);
- };
- }
-});
-export {
- _sfc_main as default
-};
diff --git a/dist/renderer/assets/BucketPage-D2ZIMjPT.css b/dist/renderer/assets/BucketPage-D2ZIMjPT.css
deleted file mode 100644
index c634bd22..00000000
--- a/dist/renderer/assets/BucketPage-D2ZIMjPT.css
+++ /dev/null
@@ -1,77 +0,0 @@
-.layout-header {
- background-color: #fff;
- box-shadow: 2px 2px 1px rgba(0,0,0,0.1);
- flex-shrink: 0;
- display: flex;
- align-items: center;
- padding: right 15px;
-}
-.dir-layout {
- display: flex;
- flex-direction: row;
- align-items: center;
- padding: 5px 10px;
- flex-shrink: 0;
-}
-.header-dir-view {
- display: flex;
- flex-direction: row;
- align-items: center;
- padding: 5px 10px;
- flex-shrink: 0;
- flex-grow: 1;
- flex-shrink: 1;
- overflow-x: auto;
-}
-.header-info-view {
- display: flex;
- flex-direction: row;
- align-items: center;
- flex-shrink: 0;
- margin-right: 10px;
- font-weight: 500;
- font-size: 12px;
-}
-.header-buttom-view {
- display: flex;
- flex-direction: row;
- flex-shrink: 0;
-}
-.btn {
- margin-right: 10px;
-}
-.file-item :hover {
- background-color: Beige;
-}
-.file-list-font {
- font-size: 14px;
- color: #303133;
- font-family: Arial, Helvetica, sans-serif;
-}
-.file-list-row-checked {
- background-color: Beige;
-}
-#refresh :hover {
- animation: rotate 1s linear infinite reverse;
-}
-#upload-area {
- height: 40%;
- border: 2px dashed #ddd;
- border-radius: 8px;
- text-align: center;
- width: 100%;
- margin: 0 auto;
- color: #ddd;
- cursor: pointer;
- transition: all 0.2s ease-in-out;
- align-items: center;
-}
-#upload-area #upload-dragger {
- height: 100%;
- item-align: center;
-}
-#upload-area.is-dragover,
-#upload-area:hover {
- border: 2px dashed #a4d8fa;
- color: #a4d8fa;
-}
diff --git a/dist/renderer/assets/DocumentPage-01l_wH6n.js b/dist/renderer/assets/DocumentPage-01l_wH6n.js
deleted file mode 100644
index 88171335..00000000
--- a/dist/renderer/assets/DocumentPage-01l_wH6n.js
+++ /dev/null
@@ -1,31 +0,0 @@
-import { d as defineComponent, r as ref, M as onMounted, N as createBlock, e as openBlock, k as getConfig, ad as II18nLanguage, y as resolveComponent, p as configPaths } from "./index-BqdcQlNn.js";
-const __default__ = {
- name: "DocumentPage"
-};
-const _sfc_main = /* @__PURE__ */ defineComponent({
- ...__default__,
- setup(__props) {
- const srcUrl = ref("https://piclist.cn/app.html");
- const updateUrl = async () => {
- const lang = await getConfig(configPaths.settings.language) || II18nLanguage.ZH_CN;
- srcUrl.value = lang === II18nLanguage.ZH_CN ? "https://piclist.cn/app.html" : "https://piclist.cn/en/app.html";
- };
- onMounted(() => {
- updateUrl();
- });
- return (_ctx, _cache) => {
- const _component_webview = resolveComponent("webview");
- return openBlock(), createBlock(_component_webview, {
- src: srcUrl.value,
- disablewebsecurity: "",
- allowpopups: "",
- autosize: "on",
- scrollbars: "none",
- style: { "width": "100%", "height": "100%" }
- }, null, 8, ["src"]);
- };
- }
-});
-export {
- _sfc_main as default
-};
diff --git a/dist/renderer/assets/EmptyPage-wVPwAgzg.js b/dist/renderer/assets/EmptyPage-wVPwAgzg.js
deleted file mode 100644
index d4830d86..00000000
--- a/dist/renderer/assets/EmptyPage-wVPwAgzg.js
+++ /dev/null
@@ -1,15 +0,0 @@
-import { d as defineComponent, N as createBlock, e as openBlock, u as unref, T, y as resolveComponent } from "./index-BqdcQlNn.js";
-const _sfc_main = /* @__PURE__ */ defineComponent({
- __name: "EmptyPage",
- setup(__props) {
- return (_ctx, _cache) => {
- const _component_el_empty = resolveComponent("el-empty");
- return openBlock(), createBlock(_component_el_empty, {
- description: unref(T)("MANAGE_NO_DATA")
- }, null, 8, ["description"]);
- };
- }
-});
-export {
- _sfc_main as default
-};
diff --git a/dist/renderer/assets/Gallery-CIW8E9xr.css b/dist/renderer/assets/Gallery-CIW8E9xr.css
deleted file mode 100644
index ac72fe7b..00000000
--- a/dist/renderer/assets/Gallery-CIW8E9xr.css
+++ /dev/null
@@ -1,154 +0,0 @@
-.PhotoSlider__BannerIcon:nth-child(1) {
- display: none;
-}
-.PhotoSlider__Counter {
- margin-top: 20px;
-}
-.view-title {
- color: #eee;
- font-size: 20px;
- text-align: center;
- margin: 10px auto;
-}
-.view-title .sub-title {
- font-size: 14px;
-}
-.view-title .el-icon-caret-bottom {
- cursor: pointer;
- transition: all 0.2s ease-in-out;
-}
-.view-title .el-icon-caret-bottom.active {
- transform: rotate(180deg);
-}
-#gallery-view {
- position: absolute;
- left: 142px;
- right: 0;
- height: 85%;
-}
-#gallery-view .cursor-pointer {
- cursor: pointer;
-}
-.item-base {
- background: #2e2e2e;
- text-align: center;
- padding: 5px 0;
- cursor: pointer;
- font-size: 13px;
- transition: all 0.2s ease-in-out;
- height: 28px;
- box-sizing: border-box;
-}
-.item-base.copy {
- cursor: not-allowed;
- background: #49b1f5;
-}
-.item-base.copy.active {
- cursor: pointer;
- background: #1b9ef3;
- color: #fff;
-}
-.item-base.delete {
- cursor: not-allowed;
- background: #f47466;
-}
-.item-base.delete.active {
- cursor: pointer;
- background: #f15140;
- color: #fff;
-}
-.item-base.all-pick {
- cursor: not-allowed;
- background: #69c282;
-}
-.item-base.all-pick.active {
- cursor: pointer;
- background: #44b363;
- color: #fff;
-}
-#gallery-view .round {
- border-radius: 14px;
-}
-#gallery-view .pull-right {
- float: right;
-}
-#gallery-view .gallery-list {
- height: 100%;
- box-sizing: border-box;
- padding: 8px 0;
- overflow-y: auto;
- overflow-x: auto;
- position: absolute;
- top: 38px;
- transition: all 0.2s ease-in-out 0.1s;
- width: 100%;
-}
-#gallery-view .gallery-list.small {
- height: 100%;
- top: 113px;
-}
-#gallery-view .gallery-list__img {
- position: relative;
- margin-bottom: 8px;
-}
-#gallery-view .gallery-list__item {
- width: 100%;
- height: 120px;
- transition: all 0.2s ease-in-out;
- cursor: pointer;
- margin-bottom: 4px;
- overflow: hidden;
- display: flex;
- margin-bottom: 6px;
-}
-#gallery-view .gallery-list__item-fake {
- position: absolute;
- top: 0;
- left: 0;
- opacity: 0;
- width: 100%;
- z-index: -1;
-}
-#gallery-view .gallery-list__item:hover {
- transform: scale(1.1);
-}
-#gallery-view .gallery-list__item-img {
- width: 100%;
- object-fit: contain;
-}
-#gallery-view .gallery-list__tool-panel {
- color: #ddd;
- margin-bottom: 4px;
- display: flex;
-}
-#gallery-view .gallery-list__tool-panel .el-checkbox {
- height: 16px;
-}
-#gallery-view .gallery-list__tool-panel i {
- cursor: pointer;
- transition: all 0.2s ease-in-out;
- margin-right: 4px;
-}
-#gallery-view .gallery-list__tool-panel i.document:hover {
- color: #49b1f5;
-}
-#gallery-view .gallery-list__tool-panel i.edit:hover {
- color: #69c282;
-}
-#gallery-view .gallery-list__tool-panel i.delete:hover {
- color: #f15140;
-}
-#gallery-view .gallery-list__file-name {
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- color: #ddd;
- font-size: 14px;
- margin-bottom: 4px;
- text-align: center;
- align-self: center;
-}
-#gallery-view .handle-bar {
- color: #ddd;
- margin-bottom: 10px;
-}
diff --git a/dist/renderer/assets/Gallery-DLKNnx97.js b/dist/renderer/assets/Gallery-DLKNnx97.js
deleted file mode 100644
index bd3a49be..00000000
--- a/dist/renderer/assets/Gallery-DLKNnx97.js
+++ /dev/null
@@ -1,4144 +0,0 @@
-import { s as sendRPC, b5 as ILogType, j as IRPCActionType, m as triggerRPC, b6 as getRawData, d as defineComponent, r as ref, a as reactive, ae as ElMessageBox, T, am as computed, W as onBeforeRouteUpdate, o as onBeforeMount, ah as nextTick, $ as $$db, D as watch, b as onBeforeUnmount, b7 as onActivated, c as createElementBlock, e as openBlock, f as createBaseVNode, q as createVNode, B as createTextVNode, t as toDisplayString, u as unref, v as withCtx, y as resolveComponent, a9 as Transition, n as normalizeClass, E as normalizeStyle, af as saveConfig, w as withDirectives, ac as vShow, aj as caret_bottom_default, b8 as caret_top_default, aT as refresh_default, F as Fragment, h as renderList, N as createBlock, a3 as picBedGlobal, aV as sort_default, A as close_default, i as resolveDirective, aE as document_default, aJ as edit_default, a_ as delete_default, a8 as info_filled_default, k as getConfig, p as configPaths, au as ElNotification, J as ElMessage, l as IPasteStyle } from "./index-BqdcQlNn.js";
-import { f as formatEndpoint } from "./common-DNjr697i.js";
-import { a as customStrMatch, c as customRenameFormatTable, e as customStrReplace } from "./common-REXFY3_s.js";
-import { a as picBedsCanbeDeleted } from "./static-DltyNkMh.js";
-import "./dataSender-Bg45AIFL.js";
-function bind(fn, thisArg) {
- return function wrap() {
- return fn.apply(thisArg, arguments);
- };
-}
-const { toString } = Object.prototype;
-const { getPrototypeOf } = Object;
-const { iterator, toStringTag } = Symbol;
-const kindOf = /* @__PURE__ */ ((cache) => (thing) => {
- const str = toString.call(thing);
- return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
-})(/* @__PURE__ */ Object.create(null));
-const kindOfTest = (type) => {
- type = type.toLowerCase();
- return (thing) => kindOf(thing) === type;
-};
-const typeOfTest = (type) => (thing) => typeof thing === type;
-const { isArray } = Array;
-const isUndefined = typeOfTest("undefined");
-function isBuffer(val) {
- return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
-}
-const isArrayBuffer = kindOfTest("ArrayBuffer");
-function isArrayBufferView(val) {
- let result;
- if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
- result = ArrayBuffer.isView(val);
- } else {
- result = val && val.buffer && isArrayBuffer(val.buffer);
- }
- return result;
-}
-const isString = typeOfTest("string");
-const isFunction = typeOfTest("function");
-const isNumber = typeOfTest("number");
-const isObject = (thing) => thing !== null && typeof thing === "object";
-const isBoolean = (thing) => thing === true || thing === false;
-const isPlainObject = (val) => {
- if (kindOf(val) !== "object") {
- return false;
- }
- const prototype2 = getPrototypeOf(val);
- return (prototype2 === null || prototype2 === Object.prototype || Object.getPrototypeOf(prototype2) === null) && !(toStringTag in val) && !(iterator in val);
-};
-const isEmptyObject = (val) => {
- if (!isObject(val) || isBuffer(val)) {
- return false;
- }
- try {
- return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
- } catch (e) {
- return false;
- }
-};
-const isDate = kindOfTest("Date");
-const isFile = kindOfTest("File");
-const isBlob = kindOfTest("Blob");
-const isFileList = kindOfTest("FileList");
-const isStream = (val) => isObject(val) && isFunction(val.pipe);
-const isFormData = (thing) => {
- let kind;
- return thing && (typeof FormData === "function" && thing instanceof FormData || isFunction(thing.append) && ((kind = kindOf(thing)) === "formdata" || // detect form-data instance
- kind === "object" && isFunction(thing.toString) && thing.toString() === "[object FormData]"));
-};
-const isURLSearchParams = kindOfTest("URLSearchParams");
-const [isReadableStream, isRequest, isResponse, isHeaders] = ["ReadableStream", "Request", "Response", "Headers"].map(kindOfTest);
-const trim = (str) => str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
-function forEach(obj, fn, { allOwnKeys = false } = {}) {
- if (obj === null || typeof obj === "undefined") {
- return;
- }
- let i;
- let l;
- if (typeof obj !== "object") {
- obj = [obj];
- }
- if (isArray(obj)) {
- for (i = 0, l = obj.length; i < l; i++) {
- fn.call(null, obj[i], i, obj);
- }
- } else {
- if (isBuffer(obj)) {
- return;
- }
- const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
- const len = keys.length;
- let key;
- for (i = 0; i < len; i++) {
- key = keys[i];
- fn.call(null, obj[key], key, obj);
- }
- }
-}
-function findKey(obj, key) {
- if (isBuffer(obj)) {
- return null;
- }
- key = key.toLowerCase();
- const keys = Object.keys(obj);
- let i = keys.length;
- let _key;
- while (i-- > 0) {
- _key = keys[i];
- if (key === _key.toLowerCase()) {
- return _key;
- }
- }
- return null;
-}
-const _global = (() => {
- if (typeof globalThis !== "undefined") return globalThis;
- return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : global;
-})();
-const isContextDefined = (context) => !isUndefined(context) && context !== _global;
-function merge() {
- const { caseless } = isContextDefined(this) && this || {};
- const result = {};
- const assignValue = (val, key) => {
- const targetKey = caseless && findKey(result, key) || key;
- if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
- result[targetKey] = merge(result[targetKey], val);
- } else if (isPlainObject(val)) {
- result[targetKey] = merge({}, val);
- } else if (isArray(val)) {
- result[targetKey] = val.slice();
- } else {
- result[targetKey] = val;
- }
- };
- for (let i = 0, l = arguments.length; i < l; i++) {
- arguments[i] && forEach(arguments[i], assignValue);
- }
- return result;
-}
-const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
- forEach(b, (val, key) => {
- if (thisArg && isFunction(val)) {
- a[key] = bind(val, thisArg);
- } else {
- a[key] = val;
- }
- }, { allOwnKeys });
- return a;
-};
-const stripBOM = (content) => {
- if (content.charCodeAt(0) === 65279) {
- content = content.slice(1);
- }
- return content;
-};
-const inherits = (constructor, superConstructor, props, descriptors2) => {
- constructor.prototype = Object.create(superConstructor.prototype, descriptors2);
- constructor.prototype.constructor = constructor;
- Object.defineProperty(constructor, "super", {
- value: superConstructor.prototype
- });
- props && Object.assign(constructor.prototype, props);
-};
-const toFlatObject = (sourceObj, destObj, filter2, propFilter) => {
- let props;
- let i;
- let prop;
- const merged = {};
- destObj = destObj || {};
- if (sourceObj == null) return destObj;
- do {
- props = Object.getOwnPropertyNames(sourceObj);
- i = props.length;
- while (i-- > 0) {
- prop = props[i];
- if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
- destObj[prop] = sourceObj[prop];
- merged[prop] = true;
- }
- }
- sourceObj = filter2 !== false && getPrototypeOf(sourceObj);
- } while (sourceObj && (!filter2 || filter2(sourceObj, destObj)) && sourceObj !== Object.prototype);
- return destObj;
-};
-const endsWith = (str, searchString, position) => {
- str = String(str);
- if (position === void 0 || position > str.length) {
- position = str.length;
- }
- position -= searchString.length;
- const lastIndex = str.indexOf(searchString, position);
- return lastIndex !== -1 && lastIndex === position;
-};
-const toArray = (thing) => {
- if (!thing) return null;
- if (isArray(thing)) return thing;
- let i = thing.length;
- if (!isNumber(i)) return null;
- const arr = new Array(i);
- while (i-- > 0) {
- arr[i] = thing[i];
- }
- return arr;
-};
-const isTypedArray = /* @__PURE__ */ ((TypedArray) => {
- return (thing) => {
- return TypedArray && thing instanceof TypedArray;
- };
-})(typeof Uint8Array !== "undefined" && getPrototypeOf(Uint8Array));
-const forEachEntry = (obj, fn) => {
- const generator = obj && obj[iterator];
- const _iterator = generator.call(obj);
- let result;
- while ((result = _iterator.next()) && !result.done) {
- const pair = result.value;
- fn.call(obj, pair[0], pair[1]);
- }
-};
-const matchAll = (regExp, str) => {
- let matches;
- const arr = [];
- while ((matches = regExp.exec(str)) !== null) {
- arr.push(matches);
- }
- return arr;
-};
-const isHTMLForm = kindOfTest("HTMLFormElement");
-const toCamelCase = (str) => {
- return str.toLowerCase().replace(
- /[-_\s]([a-z\d])(\w*)/g,
- function replacer(m, p1, p2) {
- return p1.toUpperCase() + p2;
- }
- );
-};
-const hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
-const isRegExp = kindOfTest("RegExp");
-const reduceDescriptors = (obj, reducer) => {
- const descriptors2 = Object.getOwnPropertyDescriptors(obj);
- const reducedDescriptors = {};
- forEach(descriptors2, (descriptor, name) => {
- let ret;
- if ((ret = reducer(descriptor, name, obj)) !== false) {
- reducedDescriptors[name] = ret || descriptor;
- }
- });
- Object.defineProperties(obj, reducedDescriptors);
-};
-const freezeMethods = (obj) => {
- reduceDescriptors(obj, (descriptor, name) => {
- if (isFunction(obj) && ["arguments", "caller", "callee"].indexOf(name) !== -1) {
- return false;
- }
- const value = obj[name];
- if (!isFunction(value)) return;
- descriptor.enumerable = false;
- if ("writable" in descriptor) {
- descriptor.writable = false;
- return;
- }
- if (!descriptor.set) {
- descriptor.set = () => {
- throw Error("Can not rewrite read-only method '" + name + "'");
- };
- }
- });
-};
-const toObjectSet = (arrayOrString, delimiter) => {
- const obj = {};
- const define = (arr) => {
- arr.forEach((value) => {
- obj[value] = true;
- });
- };
- isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
- return obj;
-};
-const noop = () => {
-};
-const toFiniteNumber = (value, defaultValue) => {
- return value != null && Number.isFinite(value = +value) ? value : defaultValue;
-};
-function isSpecCompliantForm(thing) {
- return !!(thing && isFunction(thing.append) && thing[toStringTag] === "FormData" && thing[iterator]);
-}
-const toJSONObject = (obj) => {
- const stack = new Array(10);
- const visit = (source, i) => {
- if (isObject(source)) {
- if (stack.indexOf(source) >= 0) {
- return;
- }
- if (isBuffer(source)) {
- return source;
- }
- if (!("toJSON" in source)) {
- stack[i] = source;
- const target = isArray(source) ? [] : {};
- forEach(source, (value, key) => {
- const reducedValue = visit(value, i + 1);
- !isUndefined(reducedValue) && (target[key] = reducedValue);
- });
- stack[i] = void 0;
- return target;
- }
- }
- return source;
- };
- return visit(obj, 0);
-};
-const isAsyncFn = kindOfTest("AsyncFunction");
-const isThenable = (thing) => thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
-const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
- if (setImmediateSupported) {
- return setImmediate;
- }
- return postMessageSupported ? ((token, callbacks) => {
- _global.addEventListener("message", ({ source, data }) => {
- if (source === _global && data === token) {
- callbacks.length && callbacks.shift()();
- }
- }, false);
- return (cb) => {
- callbacks.push(cb);
- _global.postMessage(token, "*");
- };
- })(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
-})(
- typeof setImmediate === "function",
- isFunction(_global.postMessage)
-);
-const asap = typeof queueMicrotask !== "undefined" ? queueMicrotask.bind(_global) : typeof process !== "undefined" && process.nextTick || _setImmediate;
-const isIterable = (thing) => thing != null && isFunction(thing[iterator]);
-const utils$1 = {
- isArray,
- isArrayBuffer,
- isBuffer,
- isFormData,
- isArrayBufferView,
- isString,
- isNumber,
- isBoolean,
- isObject,
- isPlainObject,
- isEmptyObject,
- isReadableStream,
- isRequest,
- isResponse,
- isHeaders,
- isUndefined,
- isDate,
- isFile,
- isBlob,
- isRegExp,
- isFunction,
- isStream,
- isURLSearchParams,
- isTypedArray,
- isFileList,
- forEach,
- merge,
- extend,
- trim,
- stripBOM,
- inherits,
- toFlatObject,
- kindOf,
- kindOfTest,
- endsWith,
- toArray,
- forEachEntry,
- matchAll,
- isHTMLForm,
- hasOwnProperty,
- hasOwnProp: hasOwnProperty,
- // an alias to avoid ESLint no-prototype-builtins detection
- reduceDescriptors,
- freezeMethods,
- toObjectSet,
- toCamelCase,
- noop,
- toFiniteNumber,
- findKey,
- global: _global,
- isContextDefined,
- isSpecCompliantForm,
- toJSONObject,
- isAsyncFn,
- isThenable,
- setImmediate: _setImmediate,
- asap,
- isIterable
-};
-function AxiosError$1(message, code, config, request, response) {
- Error.call(this);
- if (Error.captureStackTrace) {
- Error.captureStackTrace(this, this.constructor);
- } else {
- this.stack = new Error().stack;
- }
- this.message = message;
- this.name = "AxiosError";
- code && (this.code = code);
- config && (this.config = config);
- request && (this.request = request);
- if (response) {
- this.response = response;
- this.status = response.status ? response.status : null;
- }
-}
-utils$1.inherits(AxiosError$1, Error, {
- toJSON: function toJSON() {
- return {
- // Standard
- message: this.message,
- name: this.name,
- // Microsoft
- description: this.description,
- number: this.number,
- // Mozilla
- fileName: this.fileName,
- lineNumber: this.lineNumber,
- columnNumber: this.columnNumber,
- stack: this.stack,
- // Axios
- config: utils$1.toJSONObject(this.config),
- code: this.code,
- status: this.status
- };
- }
-});
-const prototype$1 = AxiosError$1.prototype;
-const descriptors = {};
-[
- "ERR_BAD_OPTION_VALUE",
- "ERR_BAD_OPTION",
- "ECONNABORTED",
- "ETIMEDOUT",
- "ERR_NETWORK",
- "ERR_FR_TOO_MANY_REDIRECTS",
- "ERR_DEPRECATED",
- "ERR_BAD_RESPONSE",
- "ERR_BAD_REQUEST",
- "ERR_CANCELED",
- "ERR_NOT_SUPPORT",
- "ERR_INVALID_URL"
- // eslint-disable-next-line func-names
-].forEach((code) => {
- descriptors[code] = { value: code };
-});
-Object.defineProperties(AxiosError$1, descriptors);
-Object.defineProperty(prototype$1, "isAxiosError", { value: true });
-AxiosError$1.from = (error, code, config, request, response, customProps) => {
- const axiosError = Object.create(prototype$1);
- utils$1.toFlatObject(error, axiosError, function filter2(obj) {
- return obj !== Error.prototype;
- }, (prop) => {
- return prop !== "isAxiosError";
- });
- AxiosError$1.call(axiosError, error.message, code, config, request, response);
- axiosError.cause = error;
- axiosError.name = error.name;
- customProps && Object.assign(axiosError, customProps);
- return axiosError;
-};
-const httpAdapter = null;
-function isVisitable(thing) {
- return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
-}
-function removeBrackets(key) {
- return utils$1.endsWith(key, "[]") ? key.slice(0, -2) : key;
-}
-function renderKey(path, key, dots) {
- if (!path) return key;
- return path.concat(key).map(function each(token, i) {
- token = removeBrackets(token);
- return !dots && i ? "[" + token + "]" : token;
- }).join(dots ? "." : "");
-}
-function isFlatArray(arr) {
- return utils$1.isArray(arr) && !arr.some(isVisitable);
-}
-const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
- return /^is[A-Z]/.test(prop);
-});
-function toFormData$1(obj, formData, options) {
- if (!utils$1.isObject(obj)) {
- throw new TypeError("target must be an object");
- }
- formData = formData || new FormData();
- options = utils$1.toFlatObject(options, {
- metaTokens: true,
- dots: false,
- indexes: false
- }, false, function defined(option, source) {
- return !utils$1.isUndefined(source[option]);
- });
- const metaTokens = options.metaTokens;
- const visitor = options.visitor || defaultVisitor;
- const dots = options.dots;
- const indexes = options.indexes;
- const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
- const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
- if (!utils$1.isFunction(visitor)) {
- throw new TypeError("visitor must be a function");
- }
- function convertValue(value) {
- if (value === null) return "";
- if (utils$1.isDate(value)) {
- return value.toISOString();
- }
- if (utils$1.isBoolean(value)) {
- return value.toString();
- }
- if (!useBlob && utils$1.isBlob(value)) {
- throw new AxiosError$1("Blob is not supported. Use a Buffer instead.");
- }
- if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
- return useBlob && typeof Blob === "function" ? new Blob([value]) : Buffer.from(value);
- }
- return value;
- }
- function defaultVisitor(value, key, path) {
- let arr = value;
- if (value && !path && typeof value === "object") {
- if (utils$1.endsWith(key, "{}")) {
- key = metaTokens ? key : key.slice(0, -2);
- value = JSON.stringify(value);
- } else if (utils$1.isArray(value) && isFlatArray(value) || (utils$1.isFileList(value) || utils$1.endsWith(key, "[]")) && (arr = utils$1.toArray(value))) {
- key = removeBrackets(key);
- arr.forEach(function each(el, index) {
- !(utils$1.isUndefined(el) || el === null) && formData.append(
- // eslint-disable-next-line no-nested-ternary
- indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + "[]",
- convertValue(el)
- );
- });
- return false;
- }
- }
- if (isVisitable(value)) {
- return true;
- }
- formData.append(renderKey(path, key, dots), convertValue(value));
- return false;
- }
- const stack = [];
- const exposedHelpers = Object.assign(predicates, {
- defaultVisitor,
- convertValue,
- isVisitable
- });
- function build(value, path) {
- if (utils$1.isUndefined(value)) return;
- if (stack.indexOf(value) !== -1) {
- throw Error("Circular reference detected in " + path.join("."));
- }
- stack.push(value);
- utils$1.forEach(value, function each(el, key) {
- const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
- formData,
- el,
- utils$1.isString(key) ? key.trim() : key,
- path,
- exposedHelpers
- );
- if (result === true) {
- build(el, path ? path.concat(key) : [key]);
- }
- });
- stack.pop();
- }
- if (!utils$1.isObject(obj)) {
- throw new TypeError("data must be an object");
- }
- build(obj);
- return formData;
-}
-function encode$1(str) {
- const charMap = {
- "!": "%21",
- "'": "%27",
- "(": "%28",
- ")": "%29",
- "~": "%7E",
- "%20": "+",
- "%00": "\0"
- };
- return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
- return charMap[match];
- });
-}
-function AxiosURLSearchParams(params, options) {
- this._pairs = [];
- params && toFormData$1(params, this, options);
-}
-const prototype = AxiosURLSearchParams.prototype;
-prototype.append = function append(name, value) {
- this._pairs.push([name, value]);
-};
-prototype.toString = function toString2(encoder) {
- const _encode = encoder ? function(value) {
- return encoder.call(this, value, encode$1);
- } : encode$1;
- return this._pairs.map(function each(pair) {
- return _encode(pair[0]) + "=" + _encode(pair[1]);
- }, "").join("&");
-};
-function encode(val) {
- return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
-}
-function buildURL(url, params, options) {
- if (!params) {
- return url;
- }
- const _encode = options && options.encode || encode;
- if (utils$1.isFunction(options)) {
- options = {
- serialize: options
- };
- }
- const serializeFn = options && options.serialize;
- let serializedParams;
- if (serializeFn) {
- serializedParams = serializeFn(params, options);
- } else {
- serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, options).toString(_encode);
- }
- if (serializedParams) {
- const hashmarkIndex = url.indexOf("#");
- if (hashmarkIndex !== -1) {
- url = url.slice(0, hashmarkIndex);
- }
- url += (url.indexOf("?") === -1 ? "?" : "&") + serializedParams;
- }
- return url;
-}
-class InterceptorManager {
- constructor() {
- this.handlers = [];
- }
- /**
- * Add a new interceptor to the stack
- *
- * @param {Function} fulfilled The function to handle `then` for a `Promise`
- * @param {Function} rejected The function to handle `reject` for a `Promise`
- *
- * @return {Number} An ID used to remove interceptor later
- */
- use(fulfilled, rejected, options) {
- this.handlers.push({
- fulfilled,
- rejected,
- synchronous: options ? options.synchronous : false,
- runWhen: options ? options.runWhen : null
- });
- return this.handlers.length - 1;
- }
- /**
- * Remove an interceptor from the stack
- *
- * @param {Number} id The ID that was returned by `use`
- *
- * @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
- */
- eject(id) {
- if (this.handlers[id]) {
- this.handlers[id] = null;
- }
- }
- /**
- * Clear all interceptors from the stack
- *
- * @returns {void}
- */
- clear() {
- if (this.handlers) {
- this.handlers = [];
- }
- }
- /**
- * Iterate over all the registered interceptors
- *
- * This method is particularly useful for skipping over any
- * interceptors that may have become `null` calling `eject`.
- *
- * @param {Function} fn The function to call for each interceptor
- *
- * @returns {void}
- */
- forEach(fn) {
- utils$1.forEach(this.handlers, function forEachHandler(h) {
- if (h !== null) {
- fn(h);
- }
- });
- }
-}
-const transitionalDefaults = {
- silentJSONParsing: true,
- forcedJSONParsing: true,
- clarifyTimeoutError: false
-};
-const URLSearchParams$1 = typeof URLSearchParams !== "undefined" ? URLSearchParams : AxiosURLSearchParams;
-const FormData$1 = typeof FormData !== "undefined" ? FormData : null;
-const Blob$1 = typeof Blob !== "undefined" ? Blob : null;
-const platform$1 = {
- isBrowser: true,
- classes: {
- URLSearchParams: URLSearchParams$1,
- FormData: FormData$1,
- Blob: Blob$1
- },
- protocols: ["http", "https", "file", "blob", "url", "data"]
-};
-const hasBrowserEnv = typeof window !== "undefined" && typeof document !== "undefined";
-const _navigator = typeof navigator === "object" && navigator || void 0;
-const hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ["ReactNative", "NativeScript", "NS"].indexOf(_navigator.product) < 0);
-const hasStandardBrowserWebWorkerEnv = (() => {
- return typeof WorkerGlobalScope !== "undefined" && // eslint-disable-next-line no-undef
- self instanceof WorkerGlobalScope && typeof self.importScripts === "function";
-})();
-const origin = hasBrowserEnv && window.location.href || "http://localhost";
-const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
- __proto__: null,
- hasBrowserEnv,
- hasStandardBrowserEnv,
- hasStandardBrowserWebWorkerEnv,
- navigator: _navigator,
- origin
-}, Symbol.toStringTag, { value: "Module" }));
-const platform = {
- ...utils,
- ...platform$1
-};
-function toURLEncodedForm(data, options) {
- return toFormData$1(data, new platform.classes.URLSearchParams(), {
- visitor: function(value, key, path, helpers) {
- if (platform.isNode && utils$1.isBuffer(value)) {
- this.append(key, value.toString("base64"));
- return false;
- }
- return helpers.defaultVisitor.apply(this, arguments);
- },
- ...options
- });
-}
-function parsePropPath(name) {
- return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
- return match[0] === "[]" ? "" : match[1] || match[0];
- });
-}
-function arrayToObject(arr) {
- const obj = {};
- const keys = Object.keys(arr);
- let i;
- const len = keys.length;
- let key;
- for (i = 0; i < len; i++) {
- key = keys[i];
- obj[key] = arr[key];
- }
- return obj;
-}
-function formDataToJSON(formData) {
- function buildPath(path, value, target, index) {
- let name = path[index++];
- if (name === "__proto__") return true;
- const isNumericKey = Number.isFinite(+name);
- const isLast = index >= path.length;
- name = !name && utils$1.isArray(target) ? target.length : name;
- if (isLast) {
- if (utils$1.hasOwnProp(target, name)) {
- target[name] = [target[name], value];
- } else {
- target[name] = value;
- }
- return !isNumericKey;
- }
- if (!target[name] || !utils$1.isObject(target[name])) {
- target[name] = [];
- }
- const result = buildPath(path, value, target[name], index);
- if (result && utils$1.isArray(target[name])) {
- target[name] = arrayToObject(target[name]);
- }
- return !isNumericKey;
- }
- if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
- const obj = {};
- utils$1.forEachEntry(formData, (name, value) => {
- buildPath(parsePropPath(name), value, obj, 0);
- });
- return obj;
- }
- return null;
-}
-function stringifySafely(rawValue, parser, encoder) {
- if (utils$1.isString(rawValue)) {
- try {
- (parser || JSON.parse)(rawValue);
- return utils$1.trim(rawValue);
- } catch (e) {
- if (e.name !== "SyntaxError") {
- throw e;
- }
- }
- }
- return (encoder || JSON.stringify)(rawValue);
-}
-const defaults = {
- transitional: transitionalDefaults,
- adapter: ["xhr", "http", "fetch"],
- transformRequest: [function transformRequest(data, headers) {
- const contentType = headers.getContentType() || "";
- const hasJSONContentType = contentType.indexOf("application/json") > -1;
- const isObjectPayload = utils$1.isObject(data);
- if (isObjectPayload && utils$1.isHTMLForm(data)) {
- data = new FormData(data);
- }
- const isFormData2 = utils$1.isFormData(data);
- if (isFormData2) {
- return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
- }
- if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data) || utils$1.isReadableStream(data)) {
- return data;
- }
- if (utils$1.isArrayBufferView(data)) {
- return data.buffer;
- }
- if (utils$1.isURLSearchParams(data)) {
- headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
- return data.toString();
- }
- let isFileList2;
- if (isObjectPayload) {
- if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
- return toURLEncodedForm(data, this.formSerializer).toString();
- }
- if ((isFileList2 = utils$1.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
- const _FormData = this.env && this.env.FormData;
- return toFormData$1(
- isFileList2 ? { "files[]": data } : data,
- _FormData && new _FormData(),
- this.formSerializer
- );
- }
- }
- if (isObjectPayload || hasJSONContentType) {
- headers.setContentType("application/json", false);
- return stringifySafely(data);
- }
- return data;
- }],
- transformResponse: [function transformResponse(data) {
- const transitional2 = this.transitional || defaults.transitional;
- const forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing;
- const JSONRequested = this.responseType === "json";
- if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
- return data;
- }
- if (data && utils$1.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
- const silentJSONParsing = transitional2 && transitional2.silentJSONParsing;
- const strictJSONParsing = !silentJSONParsing && JSONRequested;
- try {
- return JSON.parse(data);
- } catch (e) {
- if (strictJSONParsing) {
- if (e.name === "SyntaxError") {
- throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
- }
- throw e;
- }
- }
- }
- return data;
- }],
- /**
- * A timeout in milliseconds to abort a request. If set to 0 (default) a
- * timeout is not created.
- */
- timeout: 0,
- xsrfCookieName: "XSRF-TOKEN",
- xsrfHeaderName: "X-XSRF-TOKEN",
- maxContentLength: -1,
- maxBodyLength: -1,
- env: {
- FormData: platform.classes.FormData,
- Blob: platform.classes.Blob
- },
- validateStatus: function validateStatus(status) {
- return status >= 200 && status < 300;
- },
- headers: {
- common: {
- "Accept": "application/json, text/plain, */*",
- "Content-Type": void 0
- }
- }
-};
-utils$1.forEach(["delete", "get", "head", "post", "put", "patch"], (method) => {
- defaults.headers[method] = {};
-});
-const ignoreDuplicateOf = utils$1.toObjectSet([
- "age",
- "authorization",
- "content-length",
- "content-type",
- "etag",
- "expires",
- "from",
- "host",
- "if-modified-since",
- "if-unmodified-since",
- "last-modified",
- "location",
- "max-forwards",
- "proxy-authorization",
- "referer",
- "retry-after",
- "user-agent"
-]);
-const parseHeaders = (rawHeaders) => {
- const parsed = {};
- let key;
- let val;
- let i;
- rawHeaders && rawHeaders.split("\n").forEach(function parser(line) {
- i = line.indexOf(":");
- key = line.substring(0, i).trim().toLowerCase();
- val = line.substring(i + 1).trim();
- if (!key || parsed[key] && ignoreDuplicateOf[key]) {
- return;
- }
- if (key === "set-cookie") {
- if (parsed[key]) {
- parsed[key].push(val);
- } else {
- parsed[key] = [val];
- }
- } else {
- parsed[key] = parsed[key] ? parsed[key] + ", " + val : val;
- }
- });
- return parsed;
-};
-const $internals = Symbol("internals");
-function normalizeHeader(header) {
- return header && String(header).trim().toLowerCase();
-}
-function normalizeValue(value) {
- if (value === false || value == null) {
- return value;
- }
- return utils$1.isArray(value) ? value.map(normalizeValue) : String(value);
-}
-function parseTokens(str) {
- const tokens = /* @__PURE__ */ Object.create(null);
- const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
- let match;
- while (match = tokensRE.exec(str)) {
- tokens[match[1]] = match[2];
- }
- return tokens;
-}
-const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
-function matchHeaderValue(context, value, header, filter2, isHeaderNameFilter) {
- if (utils$1.isFunction(filter2)) {
- return filter2.call(this, value, header);
- }
- if (isHeaderNameFilter) {
- value = header;
- }
- if (!utils$1.isString(value)) return;
- if (utils$1.isString(filter2)) {
- return value.indexOf(filter2) !== -1;
- }
- if (utils$1.isRegExp(filter2)) {
- return filter2.test(value);
- }
-}
-function formatHeader(header) {
- return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
- return char.toUpperCase() + str;
- });
-}
-function buildAccessors(obj, header) {
- const accessorName = utils$1.toCamelCase(" " + header);
- ["get", "set", "has"].forEach((methodName) => {
- Object.defineProperty(obj, methodName + accessorName, {
- value: function(arg1, arg2, arg3) {
- return this[methodName].call(this, header, arg1, arg2, arg3);
- },
- configurable: true
- });
- });
-}
-let AxiosHeaders$1 = class AxiosHeaders {
- constructor(headers) {
- headers && this.set(headers);
- }
- set(header, valueOrRewrite, rewrite) {
- const self2 = this;
- function setHeader(_value, _header, _rewrite) {
- const lHeader = normalizeHeader(_header);
- if (!lHeader) {
- throw new Error("header name must be a non-empty string");
- }
- const key = utils$1.findKey(self2, lHeader);
- if (!key || self2[key] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key] !== false) {
- self2[key || _header] = normalizeValue(_value);
- }
- }
- const setHeaders = (headers, _rewrite) => utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
- if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
- setHeaders(header, valueOrRewrite);
- } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
- setHeaders(parseHeaders(header), valueOrRewrite);
- } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
- let obj = {}, dest, key;
- for (const entry of header) {
- if (!utils$1.isArray(entry)) {
- throw TypeError("Object iterator must return a key-value pair");
- }
- obj[key = entry[0]] = (dest = obj[key]) ? utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]] : entry[1];
- }
- setHeaders(obj, valueOrRewrite);
- } else {
- header != null && setHeader(valueOrRewrite, header, rewrite);
- }
- return this;
- }
- get(header, parser) {
- header = normalizeHeader(header);
- if (header) {
- const key = utils$1.findKey(this, header);
- if (key) {
- const value = this[key];
- if (!parser) {
- return value;
- }
- if (parser === true) {
- return parseTokens(value);
- }
- if (utils$1.isFunction(parser)) {
- return parser.call(this, value, key);
- }
- if (utils$1.isRegExp(parser)) {
- return parser.exec(value);
- }
- throw new TypeError("parser must be boolean|regexp|function");
- }
- }
- }
- has(header, matcher) {
- header = normalizeHeader(header);
- if (header) {
- const key = utils$1.findKey(this, header);
- return !!(key && this[key] !== void 0 && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
- }
- return false;
- }
- delete(header, matcher) {
- const self2 = this;
- let deleted = false;
- function deleteHeader(_header) {
- _header = normalizeHeader(_header);
- if (_header) {
- const key = utils$1.findKey(self2, _header);
- if (key && (!matcher || matchHeaderValue(self2, self2[key], key, matcher))) {
- delete self2[key];
- deleted = true;
- }
- }
- }
- if (utils$1.isArray(header)) {
- header.forEach(deleteHeader);
- } else {
- deleteHeader(header);
- }
- return deleted;
- }
- clear(matcher) {
- const keys = Object.keys(this);
- let i = keys.length;
- let deleted = false;
- while (i--) {
- const key = keys[i];
- if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
- delete this[key];
- deleted = true;
- }
- }
- return deleted;
- }
- normalize(format) {
- const self2 = this;
- const headers = {};
- utils$1.forEach(this, (value, header) => {
- const key = utils$1.findKey(headers, header);
- if (key) {
- self2[key] = normalizeValue(value);
- delete self2[header];
- return;
- }
- const normalized = format ? formatHeader(header) : String(header).trim();
- if (normalized !== header) {
- delete self2[header];
- }
- self2[normalized] = normalizeValue(value);
- headers[normalized] = true;
- });
- return this;
- }
- concat(...targets) {
- return this.constructor.concat(this, ...targets);
- }
- toJSON(asStrings) {
- const obj = /* @__PURE__ */ Object.create(null);
- utils$1.forEach(this, (value, header) => {
- value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(", ") : value);
- });
- return obj;
- }
- [Symbol.iterator]() {
- return Object.entries(this.toJSON())[Symbol.iterator]();
- }
- toString() {
- return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join("\n");
- }
- getSetCookie() {
- return this.get("set-cookie") || [];
- }
- get [Symbol.toStringTag]() {
- return "AxiosHeaders";
- }
- static from(thing) {
- return thing instanceof this ? thing : new this(thing);
- }
- static concat(first, ...targets) {
- const computed2 = new this(first);
- targets.forEach((target) => computed2.set(target));
- return computed2;
- }
- static accessor(header) {
- const internals = this[$internals] = this[$internals] = {
- accessors: {}
- };
- const accessors = internals.accessors;
- const prototype2 = this.prototype;
- function defineAccessor(_header) {
- const lHeader = normalizeHeader(_header);
- if (!accessors[lHeader]) {
- buildAccessors(prototype2, _header);
- accessors[lHeader] = true;
- }
- }
- utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
- return this;
- }
-};
-AxiosHeaders$1.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
-utils$1.reduceDescriptors(AxiosHeaders$1.prototype, ({ value }, key) => {
- let mapped = key[0].toUpperCase() + key.slice(1);
- return {
- get: () => value,
- set(headerValue) {
- this[mapped] = headerValue;
- }
- };
-});
-utils$1.freezeMethods(AxiosHeaders$1);
-function transformData(fns, response) {
- const config = this || defaults;
- const context = response || config;
- const headers = AxiosHeaders$1.from(context.headers);
- let data = context.data;
- utils$1.forEach(fns, function transform(fn) {
- data = fn.call(config, data, headers.normalize(), response ? response.status : void 0);
- });
- headers.normalize();
- return data;
-}
-function isCancel$1(value) {
- return !!(value && value.__CANCEL__);
-}
-function CanceledError$1(message, config, request) {
- AxiosError$1.call(this, message == null ? "canceled" : message, AxiosError$1.ERR_CANCELED, config, request);
- this.name = "CanceledError";
-}
-utils$1.inherits(CanceledError$1, AxiosError$1, {
- __CANCEL__: true
-});
-function settle(resolve, reject, response) {
- const validateStatus2 = response.config.validateStatus;
- if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
- resolve(response);
- } else {
- reject(new AxiosError$1(
- "Request failed with status code " + response.status,
- [AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
- response.config,
- response.request,
- response
- ));
- }
-}
-function parseProtocol(url) {
- const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
- return match && match[1] || "";
-}
-function speedometer(samplesCount, min) {
- samplesCount = samplesCount || 10;
- const bytes = new Array(samplesCount);
- const timestamps = new Array(samplesCount);
- let head = 0;
- let tail = 0;
- let firstSampleTS;
- min = min !== void 0 ? min : 1e3;
- return function push(chunkLength) {
- const now = Date.now();
- const startedAt = timestamps[tail];
- if (!firstSampleTS) {
- firstSampleTS = now;
- }
- bytes[head] = chunkLength;
- timestamps[head] = now;
- let i = tail;
- let bytesCount = 0;
- while (i !== head) {
- bytesCount += bytes[i++];
- i = i % samplesCount;
- }
- head = (head + 1) % samplesCount;
- if (head === tail) {
- tail = (tail + 1) % samplesCount;
- }
- if (now - firstSampleTS < min) {
- return;
- }
- const passed = startedAt && now - startedAt;
- return passed ? Math.round(bytesCount * 1e3 / passed) : void 0;
- };
-}
-function throttle(fn, freq) {
- let timestamp = 0;
- let threshold = 1e3 / freq;
- let lastArgs;
- let timer;
- const invoke = (args, now = Date.now()) => {
- timestamp = now;
- lastArgs = null;
- if (timer) {
- clearTimeout(timer);
- timer = null;
- }
- fn(...args);
- };
- const throttled = (...args) => {
- const now = Date.now();
- const passed = now - timestamp;
- if (passed >= threshold) {
- invoke(args, now);
- } else {
- lastArgs = args;
- if (!timer) {
- timer = setTimeout(() => {
- timer = null;
- invoke(lastArgs);
- }, threshold - passed);
- }
- }
- };
- const flush = () => lastArgs && invoke(lastArgs);
- return [throttled, flush];
-}
-const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
- let bytesNotified = 0;
- const _speedometer = speedometer(50, 250);
- return throttle((e) => {
- const loaded = e.loaded;
- const total = e.lengthComputable ? e.total : void 0;
- const progressBytes = loaded - bytesNotified;
- const rate = _speedometer(progressBytes);
- const inRange = loaded <= total;
- bytesNotified = loaded;
- const data = {
- loaded,
- total,
- progress: total ? loaded / total : void 0,
- bytes: progressBytes,
- rate: rate ? rate : void 0,
- estimated: rate && total && inRange ? (total - loaded) / rate : void 0,
- event: e,
- lengthComputable: total != null,
- [isDownloadStream ? "download" : "upload"]: true
- };
- listener(data);
- }, freq);
-};
-const progressEventDecorator = (total, throttled) => {
- const lengthComputable = total != null;
- return [(loaded) => throttled[0]({
- lengthComputable,
- total,
- loaded
- }), throttled[1]];
-};
-const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
-const isURLSameOrigin = platform.hasStandardBrowserEnv ? /* @__PURE__ */ ((origin2, isMSIE) => (url) => {
- url = new URL(url, platform.origin);
- return origin2.protocol === url.protocol && origin2.host === url.host && (isMSIE || origin2.port === url.port);
-})(
- new URL(platform.origin),
- platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
-) : () => true;
-const cookies = platform.hasStandardBrowserEnv ? (
- // Standard browser envs support document.cookie
- {
- write(name, value, expires, path, domain, secure) {
- const cookie = [name + "=" + encodeURIComponent(value)];
- utils$1.isNumber(expires) && cookie.push("expires=" + new Date(expires).toGMTString());
- utils$1.isString(path) && cookie.push("path=" + path);
- utils$1.isString(domain) && cookie.push("domain=" + domain);
- secure === true && cookie.push("secure");
- document.cookie = cookie.join("; ");
- },
- read(name) {
- const match = document.cookie.match(new RegExp("(^|;\\s*)(" + name + ")=([^;]*)"));
- return match ? decodeURIComponent(match[3]) : null;
- },
- remove(name) {
- this.write(name, "", Date.now() - 864e5);
- }
- }
-) : (
- // Non-standard browser env (web workers, react-native) lack needed support.
- {
- write() {
- },
- read() {
- return null;
- },
- remove() {
- }
- }
-);
-function isAbsoluteURL(url) {
- return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
-}
-function combineURLs(baseURL, relativeURL) {
- return relativeURL ? baseURL.replace(/\/?\/$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
-}
-function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
- let isRelativeUrl = !isAbsoluteURL(requestedURL);
- if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
- return combineURLs(baseURL, requestedURL);
- }
- return requestedURL;
-}
-const headersToObject = (thing) => thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
-function mergeConfig$1(config1, config2) {
- config2 = config2 || {};
- const config = {};
- function getMergedValue(target, source, prop, caseless) {
- if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
- return utils$1.merge.call({ caseless }, target, source);
- } else if (utils$1.isPlainObject(source)) {
- return utils$1.merge({}, source);
- } else if (utils$1.isArray(source)) {
- return source.slice();
- }
- return source;
- }
- function mergeDeepProperties(a, b, prop, caseless) {
- if (!utils$1.isUndefined(b)) {
- return getMergedValue(a, b, prop, caseless);
- } else if (!utils$1.isUndefined(a)) {
- return getMergedValue(void 0, a, prop, caseless);
- }
- }
- function valueFromConfig2(a, b) {
- if (!utils$1.isUndefined(b)) {
- return getMergedValue(void 0, b);
- }
- }
- function defaultToConfig2(a, b) {
- if (!utils$1.isUndefined(b)) {
- return getMergedValue(void 0, b);
- } else if (!utils$1.isUndefined(a)) {
- return getMergedValue(void 0, a);
- }
- }
- function mergeDirectKeys(a, b, prop) {
- if (prop in config2) {
- return getMergedValue(a, b);
- } else if (prop in config1) {
- return getMergedValue(void 0, a);
- }
- }
- const mergeMap = {
- url: valueFromConfig2,
- method: valueFromConfig2,
- data: valueFromConfig2,
- baseURL: defaultToConfig2,
- transformRequest: defaultToConfig2,
- transformResponse: defaultToConfig2,
- paramsSerializer: defaultToConfig2,
- timeout: defaultToConfig2,
- timeoutMessage: defaultToConfig2,
- withCredentials: defaultToConfig2,
- withXSRFToken: defaultToConfig2,
- adapter: defaultToConfig2,
- responseType: defaultToConfig2,
- xsrfCookieName: defaultToConfig2,
- xsrfHeaderName: defaultToConfig2,
- onUploadProgress: defaultToConfig2,
- onDownloadProgress: defaultToConfig2,
- decompress: defaultToConfig2,
- maxContentLength: defaultToConfig2,
- maxBodyLength: defaultToConfig2,
- beforeRedirect: defaultToConfig2,
- transport: defaultToConfig2,
- httpAgent: defaultToConfig2,
- httpsAgent: defaultToConfig2,
- cancelToken: defaultToConfig2,
- socketPath: defaultToConfig2,
- responseEncoding: defaultToConfig2,
- validateStatus: mergeDirectKeys,
- headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
- };
- utils$1.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
- const merge2 = mergeMap[prop] || mergeDeepProperties;
- const configValue = merge2(config1[prop], config2[prop], prop);
- utils$1.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config[prop] = configValue);
- });
- return config;
-}
-const resolveConfig = (config) => {
- const newConfig = mergeConfig$1({}, config);
- let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
- newConfig.headers = headers = AxiosHeaders$1.from(headers);
- newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
- if (auth) {
- headers.set(
- "Authorization",
- "Basic " + btoa((auth.username || "") + ":" + (auth.password ? unescape(encodeURIComponent(auth.password)) : ""))
- );
- }
- let contentType;
- if (utils$1.isFormData(data)) {
- if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
- headers.setContentType(void 0);
- } else if ((contentType = headers.getContentType()) !== false) {
- const [type, ...tokens] = contentType ? contentType.split(";").map((token) => token.trim()).filter(Boolean) : [];
- headers.setContentType([type || "multipart/form-data", ...tokens].join("; "));
- }
- }
- if (platform.hasStandardBrowserEnv) {
- withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
- if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) {
- const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
- if (xsrfValue) {
- headers.set(xsrfHeaderName, xsrfValue);
- }
- }
- }
- return newConfig;
-};
-const isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
-const xhrAdapter = isXHRAdapterSupported && function(config) {
- return new Promise(function dispatchXhrRequest(resolve, reject) {
- const _config = resolveConfig(config);
- let requestData = _config.data;
- const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
- let { responseType, onUploadProgress, onDownloadProgress } = _config;
- let onCanceled;
- let uploadThrottled, downloadThrottled;
- let flushUpload, flushDownload;
- function done() {
- flushUpload && flushUpload();
- flushDownload && flushDownload();
- _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
- _config.signal && _config.signal.removeEventListener("abort", onCanceled);
- }
- let request = new XMLHttpRequest();
- request.open(_config.method.toUpperCase(), _config.url, true);
- request.timeout = _config.timeout;
- function onloadend() {
- if (!request) {
- return;
- }
- const responseHeaders = AxiosHeaders$1.from(
- "getAllResponseHeaders" in request && request.getAllResponseHeaders()
- );
- const responseData = !responseType || responseType === "text" || responseType === "json" ? request.responseText : request.response;
- const response = {
- data: responseData,
- status: request.status,
- statusText: request.statusText,
- headers: responseHeaders,
- config,
- request
- };
- settle(function _resolve(value) {
- resolve(value);
- done();
- }, function _reject(err) {
- reject(err);
- done();
- }, response);
- request = null;
- }
- if ("onloadend" in request) {
- request.onloadend = onloadend;
- } else {
- request.onreadystatechange = function handleLoad() {
- if (!request || request.readyState !== 4) {
- return;
- }
- if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf("file:") === 0)) {
- return;
- }
- setTimeout(onloadend);
- };
- }
- request.onabort = function handleAbort() {
- if (!request) {
- return;
- }
- reject(new AxiosError$1("Request aborted", AxiosError$1.ECONNABORTED, config, request));
- request = null;
- };
- request.onerror = function handleError() {
- reject(new AxiosError$1("Network Error", AxiosError$1.ERR_NETWORK, config, request));
- request = null;
- };
- request.ontimeout = function handleTimeout() {
- let timeoutErrorMessage = _config.timeout ? "timeout of " + _config.timeout + "ms exceeded" : "timeout exceeded";
- const transitional2 = _config.transitional || transitionalDefaults;
- if (_config.timeoutErrorMessage) {
- timeoutErrorMessage = _config.timeoutErrorMessage;
- }
- reject(new AxiosError$1(
- timeoutErrorMessage,
- transitional2.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
- config,
- request
- ));
- request = null;
- };
- requestData === void 0 && requestHeaders.setContentType(null);
- if ("setRequestHeader" in request) {
- utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
- request.setRequestHeader(key, val);
- });
- }
- if (!utils$1.isUndefined(_config.withCredentials)) {
- request.withCredentials = !!_config.withCredentials;
- }
- if (responseType && responseType !== "json") {
- request.responseType = _config.responseType;
- }
- if (onDownloadProgress) {
- [downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
- request.addEventListener("progress", downloadThrottled);
- }
- if (onUploadProgress && request.upload) {
- [uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
- request.upload.addEventListener("progress", uploadThrottled);
- request.upload.addEventListener("loadend", flushUpload);
- }
- if (_config.cancelToken || _config.signal) {
- onCanceled = (cancel) => {
- if (!request) {
- return;
- }
- reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
- request.abort();
- request = null;
- };
- _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
- if (_config.signal) {
- _config.signal.aborted ? onCanceled() : _config.signal.addEventListener("abort", onCanceled);
- }
- }
- const protocol = parseProtocol(_config.url);
- if (protocol && platform.protocols.indexOf(protocol) === -1) {
- reject(new AxiosError$1("Unsupported protocol " + protocol + ":", AxiosError$1.ERR_BAD_REQUEST, config));
- return;
- }
- request.send(requestData || null);
- });
-};
-const composeSignals = (signals, timeout) => {
- const { length } = signals = signals ? signals.filter(Boolean) : [];
- if (timeout || length) {
- let controller = new AbortController();
- let aborted;
- const onabort = function(reason) {
- if (!aborted) {
- aborted = true;
- unsubscribe();
- const err = reason instanceof Error ? reason : this.reason;
- controller.abort(err instanceof AxiosError$1 ? err : new CanceledError$1(err instanceof Error ? err.message : err));
- }
- };
- let timer = timeout && setTimeout(() => {
- timer = null;
- onabort(new AxiosError$1(`timeout ${timeout} of ms exceeded`, AxiosError$1.ETIMEDOUT));
- }, timeout);
- const unsubscribe = () => {
- if (signals) {
- timer && clearTimeout(timer);
- timer = null;
- signals.forEach((signal2) => {
- signal2.unsubscribe ? signal2.unsubscribe(onabort) : signal2.removeEventListener("abort", onabort);
- });
- signals = null;
- }
- };
- signals.forEach((signal2) => signal2.addEventListener("abort", onabort));
- const { signal } = controller;
- signal.unsubscribe = () => utils$1.asap(unsubscribe);
- return signal;
- }
-};
-const streamChunk = function* (chunk, chunkSize) {
- let len = chunk.byteLength;
- if (len < chunkSize) {
- yield chunk;
- return;
- }
- let pos = 0;
- let end;
- while (pos < len) {
- end = pos + chunkSize;
- yield chunk.slice(pos, end);
- pos = end;
- }
-};
-const readBytes = async function* (iterable, chunkSize) {
- for await (const chunk of readStream(iterable)) {
- yield* streamChunk(chunk, chunkSize);
- }
-};
-const readStream = async function* (stream) {
- if (stream[Symbol.asyncIterator]) {
- yield* stream;
- return;
- }
- const reader = stream.getReader();
- try {
- for (; ; ) {
- const { done, value } = await reader.read();
- if (done) {
- break;
- }
- yield value;
- }
- } finally {
- await reader.cancel();
- }
-};
-const trackStream = (stream, chunkSize, onProgress, onFinish) => {
- const iterator2 = readBytes(stream, chunkSize);
- let bytes = 0;
- let done;
- let _onFinish = (e) => {
- if (!done) {
- done = true;
- onFinish && onFinish(e);
- }
- };
- return new ReadableStream({
- async pull(controller) {
- try {
- const { done: done2, value } = await iterator2.next();
- if (done2) {
- _onFinish();
- controller.close();
- return;
- }
- let len = value.byteLength;
- if (onProgress) {
- let loadedBytes = bytes += len;
- onProgress(loadedBytes);
- }
- controller.enqueue(new Uint8Array(value));
- } catch (err) {
- _onFinish(err);
- throw err;
- }
- },
- cancel(reason) {
- _onFinish(reason);
- return iterator2.return();
- }
- }, {
- highWaterMark: 2
- });
-};
-const isFetchSupported = typeof fetch === "function" && typeof Request === "function" && typeof Response === "function";
-const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === "function";
-const encodeText = isFetchSupported && (typeof TextEncoder === "function" ? /* @__PURE__ */ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : async (str) => new Uint8Array(await new Response(str).arrayBuffer()));
-const test = (fn, ...args) => {
- try {
- return !!fn(...args);
- } catch (e) {
- return false;
- }
-};
-const supportsRequestStream = isReadableStreamSupported && test(() => {
- let duplexAccessed = false;
- const hasContentType = new Request(platform.origin, {
- body: new ReadableStream(),
- method: "POST",
- get duplex() {
- duplexAccessed = true;
- return "half";
- }
- }).headers.has("Content-Type");
- return duplexAccessed && !hasContentType;
-});
-const DEFAULT_CHUNK_SIZE = 64 * 1024;
-const supportsResponseStream = isReadableStreamSupported && test(() => utils$1.isReadableStream(new Response("").body));
-const resolvers = {
- stream: supportsResponseStream && ((res) => res.body)
-};
-isFetchSupported && ((res) => {
- ["text", "arrayBuffer", "blob", "formData", "stream"].forEach((type) => {
- !resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res2) => res2[type]() : (_, config) => {
- throw new AxiosError$1(`Response type '${type}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, config);
- });
- });
-})(new Response());
-const getBodyLength = async (body) => {
- if (body == null) {
- return 0;
- }
- if (utils$1.isBlob(body)) {
- return body.size;
- }
- if (utils$1.isSpecCompliantForm(body)) {
- const _request = new Request(platform.origin, {
- method: "POST",
- body
- });
- return (await _request.arrayBuffer()).byteLength;
- }
- if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
- return body.byteLength;
- }
- if (utils$1.isURLSearchParams(body)) {
- body = body + "";
- }
- if (utils$1.isString(body)) {
- return (await encodeText(body)).byteLength;
- }
-};
-const resolveBodyLength = async (headers, body) => {
- const length = utils$1.toFiniteNumber(headers.getContentLength());
- return length == null ? getBodyLength(body) : length;
-};
-const fetchAdapter = isFetchSupported && (async (config) => {
- let {
- url,
- method,
- data,
- signal,
- cancelToken,
- timeout,
- onDownloadProgress,
- onUploadProgress,
- responseType,
- headers,
- withCredentials = "same-origin",
- fetchOptions
- } = resolveConfig(config);
- responseType = responseType ? (responseType + "").toLowerCase() : "text";
- let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
- let request;
- const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
- composedSignal.unsubscribe();
- });
- let requestContentLength;
- try {
- if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
- let _request = new Request(url, {
- method: "POST",
- body: data,
- duplex: "half"
- });
- let contentTypeHeader;
- if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) {
- headers.setContentType(contentTypeHeader);
- }
- if (_request.body) {
- const [onProgress, flush] = progressEventDecorator(
- requestContentLength,
- progressEventReducer(asyncDecorator(onUploadProgress))
- );
- data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
- }
- }
- if (!utils$1.isString(withCredentials)) {
- withCredentials = withCredentials ? "include" : "omit";
- }
- const isCredentialsSupported = "credentials" in Request.prototype;
- request = new Request(url, {
- ...fetchOptions,
- signal: composedSignal,
- method: method.toUpperCase(),
- headers: headers.normalize().toJSON(),
- body: data,
- duplex: "half",
- credentials: isCredentialsSupported ? withCredentials : void 0
- });
- let response = await fetch(request, fetchOptions);
- const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
- if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
- const options = {};
- ["status", "statusText", "headers"].forEach((prop) => {
- options[prop] = response[prop];
- });
- const responseContentLength = utils$1.toFiniteNumber(response.headers.get("content-length"));
- const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
- responseContentLength,
- progressEventReducer(asyncDecorator(onDownloadProgress), true)
- ) || [];
- response = new Response(
- trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
- flush && flush();
- unsubscribe && unsubscribe();
- }),
- options
- );
- }
- responseType = responseType || "text";
- let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || "text"](response, config);
- !isStreamResponse && unsubscribe && unsubscribe();
- return await new Promise((resolve, reject) => {
- settle(resolve, reject, {
- data: responseData,
- headers: AxiosHeaders$1.from(response.headers),
- status: response.status,
- statusText: response.statusText,
- config,
- request
- });
- });
- } catch (err) {
- unsubscribe && unsubscribe();
- if (err && err.name === "TypeError" && /Load failed|fetch/i.test(err.message)) {
- throw Object.assign(
- new AxiosError$1("Network Error", AxiosError$1.ERR_NETWORK, config, request),
- {
- cause: err.cause || err
- }
- );
- }
- throw AxiosError$1.from(err, err && err.code, config, request);
- }
-});
-const knownAdapters = {
- http: httpAdapter,
- xhr: xhrAdapter,
- fetch: fetchAdapter
-};
-utils$1.forEach(knownAdapters, (fn, value) => {
- if (fn) {
- try {
- Object.defineProperty(fn, "name", { value });
- } catch (e) {
- }
- Object.defineProperty(fn, "adapterName", { value });
- }
-});
-const renderReason = (reason) => `- ${reason}`;
-const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
-const adapters = {
- getAdapter: (adapters2) => {
- adapters2 = utils$1.isArray(adapters2) ? adapters2 : [adapters2];
- const { length } = adapters2;
- let nameOrAdapter;
- let adapter;
- const rejectedReasons = {};
- for (let i = 0; i < length; i++) {
- nameOrAdapter = adapters2[i];
- let id;
- adapter = nameOrAdapter;
- if (!isResolvedHandle(nameOrAdapter)) {
- adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
- if (adapter === void 0) {
- throw new AxiosError$1(`Unknown adapter '${id}'`);
- }
- }
- if (adapter) {
- break;
- }
- rejectedReasons[id || "#" + i] = adapter;
- }
- if (!adapter) {
- const reasons = Object.entries(rejectedReasons).map(
- ([id, state]) => `adapter ${id} ` + (state === false ? "is not supported by the environment" : "is not available in the build")
- );
- let s = length ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified";
- throw new AxiosError$1(
- `There is no suitable adapter to dispatch the request ` + s,
- "ERR_NOT_SUPPORT"
- );
- }
- return adapter;
- },
- adapters: knownAdapters
-};
-function throwIfCancellationRequested(config) {
- if (config.cancelToken) {
- config.cancelToken.throwIfRequested();
- }
- if (config.signal && config.signal.aborted) {
- throw new CanceledError$1(null, config);
- }
-}
-function dispatchRequest(config) {
- throwIfCancellationRequested(config);
- config.headers = AxiosHeaders$1.from(config.headers);
- config.data = transformData.call(
- config,
- config.transformRequest
- );
- if (["post", "put", "patch"].indexOf(config.method) !== -1) {
- config.headers.setContentType("application/x-www-form-urlencoded", false);
- }
- const adapter = adapters.getAdapter(config.adapter || defaults.adapter);
- return adapter(config).then(function onAdapterResolution(response) {
- throwIfCancellationRequested(config);
- response.data = transformData.call(
- config,
- config.transformResponse,
- response
- );
- response.headers = AxiosHeaders$1.from(response.headers);
- return response;
- }, function onAdapterRejection(reason) {
- if (!isCancel$1(reason)) {
- throwIfCancellationRequested(config);
- if (reason && reason.response) {
- reason.response.data = transformData.call(
- config,
- config.transformResponse,
- reason.response
- );
- reason.response.headers = AxiosHeaders$1.from(reason.response.headers);
- }
- }
- return Promise.reject(reason);
- });
-}
-const VERSION$1 = "1.11.0";
-const validators$1 = {};
-["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i) => {
- validators$1[type] = function validator2(thing) {
- return typeof thing === type || "a" + (i < 1 ? "n " : " ") + type;
- };
-});
-const deprecatedWarnings = {};
-validators$1.transitional = function transitional(validator2, version, message) {
- function formatMessage(opt, desc) {
- return "[Axios v" + VERSION$1 + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : "");
- }
- return (value, opt, opts) => {
- if (validator2 === false) {
- throw new AxiosError$1(
- formatMessage(opt, " has been removed" + (version ? " in " + version : "")),
- AxiosError$1.ERR_DEPRECATED
- );
- }
- if (version && !deprecatedWarnings[opt]) {
- deprecatedWarnings[opt] = true;
- console.warn(
- formatMessage(
- opt,
- " has been deprecated since v" + version + " and will be removed in the near future"
- )
- );
- }
- return validator2 ? validator2(value, opt, opts) : true;
- };
-};
-validators$1.spelling = function spelling(correctSpelling) {
- return (value, opt) => {
- console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
- return true;
- };
-};
-function assertOptions(options, schema, allowUnknown) {
- if (typeof options !== "object") {
- throw new AxiosError$1("options must be an object", AxiosError$1.ERR_BAD_OPTION_VALUE);
- }
- const keys = Object.keys(options);
- let i = keys.length;
- while (i-- > 0) {
- const opt = keys[i];
- const validator2 = schema[opt];
- if (validator2) {
- const value = options[opt];
- const result = value === void 0 || validator2(value, opt, options);
- if (result !== true) {
- throw new AxiosError$1("option " + opt + " must be " + result, AxiosError$1.ERR_BAD_OPTION_VALUE);
- }
- continue;
- }
- if (allowUnknown !== true) {
- throw new AxiosError$1("Unknown option " + opt, AxiosError$1.ERR_BAD_OPTION);
- }
- }
-}
-const validator = {
- assertOptions,
- validators: validators$1
-};
-const validators = validator.validators;
-let Axios$1 = class Axios {
- constructor(instanceConfig) {
- this.defaults = instanceConfig || {};
- this.interceptors = {
- request: new InterceptorManager(),
- response: new InterceptorManager()
- };
- }
- /**
- * Dispatch a request
- *
- * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
- * @param {?Object} config
- *
- * @returns {Promise} The Promise to be fulfilled
- */
- async request(configOrUrl, config) {
- try {
- return await this._request(configOrUrl, config);
- } catch (err) {
- if (err instanceof Error) {
- let dummy = {};
- Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
- const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, "") : "";
- try {
- if (!err.stack) {
- err.stack = stack;
- } else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ""))) {
- err.stack += "\n" + stack;
- }
- } catch (e) {
- }
- }
- throw err;
- }
- }
- _request(configOrUrl, config) {
- if (typeof configOrUrl === "string") {
- config = config || {};
- config.url = configOrUrl;
- } else {
- config = configOrUrl || {};
- }
- config = mergeConfig$1(this.defaults, config);
- const { transitional: transitional2, paramsSerializer, headers } = config;
- if (transitional2 !== void 0) {
- validator.assertOptions(transitional2, {
- silentJSONParsing: validators.transitional(validators.boolean),
- forcedJSONParsing: validators.transitional(validators.boolean),
- clarifyTimeoutError: validators.transitional(validators.boolean)
- }, false);
- }
- if (paramsSerializer != null) {
- if (utils$1.isFunction(paramsSerializer)) {
- config.paramsSerializer = {
- serialize: paramsSerializer
- };
- } else {
- validator.assertOptions(paramsSerializer, {
- encode: validators.function,
- serialize: validators.function
- }, true);
- }
- }
- if (config.allowAbsoluteUrls !== void 0) ;
- else if (this.defaults.allowAbsoluteUrls !== void 0) {
- config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
- } else {
- config.allowAbsoluteUrls = true;
- }
- validator.assertOptions(config, {
- baseUrl: validators.spelling("baseURL"),
- withXsrfToken: validators.spelling("withXSRFToken")
- }, true);
- config.method = (config.method || this.defaults.method || "get").toLowerCase();
- let contextHeaders = headers && utils$1.merge(
- headers.common,
- headers[config.method]
- );
- headers && utils$1.forEach(
- ["delete", "get", "head", "post", "put", "patch", "common"],
- (method) => {
- delete headers[method];
- }
- );
- config.headers = AxiosHeaders$1.concat(contextHeaders, headers);
- const requestInterceptorChain = [];
- let synchronousRequestInterceptors = true;
- this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
- if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config) === false) {
- return;
- }
- synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
- requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
- });
- const responseInterceptorChain = [];
- this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
- responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
- });
- let promise;
- let i = 0;
- let len;
- if (!synchronousRequestInterceptors) {
- const chain = [dispatchRequest.bind(this), void 0];
- chain.unshift(...requestInterceptorChain);
- chain.push(...responseInterceptorChain);
- len = chain.length;
- promise = Promise.resolve(config);
- while (i < len) {
- promise = promise.then(chain[i++], chain[i++]);
- }
- return promise;
- }
- len = requestInterceptorChain.length;
- let newConfig = config;
- i = 0;
- while (i < len) {
- const onFulfilled = requestInterceptorChain[i++];
- const onRejected = requestInterceptorChain[i++];
- try {
- newConfig = onFulfilled(newConfig);
- } catch (error) {
- onRejected.call(this, error);
- break;
- }
- }
- try {
- promise = dispatchRequest.call(this, newConfig);
- } catch (error) {
- return Promise.reject(error);
- }
- i = 0;
- len = responseInterceptorChain.length;
- while (i < len) {
- promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
- }
- return promise;
- }
- getUri(config) {
- config = mergeConfig$1(this.defaults, config);
- const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
- return buildURL(fullPath, config.params, config.paramsSerializer);
- }
-};
-utils$1.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) {
- Axios$1.prototype[method] = function(url, config) {
- return this.request(mergeConfig$1(config || {}, {
- method,
- url,
- data: (config || {}).data
- }));
- };
-});
-utils$1.forEach(["post", "put", "patch"], function forEachMethodWithData(method) {
- function generateHTTPMethod(isForm) {
- return function httpMethod(url, data, config) {
- return this.request(mergeConfig$1(config || {}, {
- method,
- headers: isForm ? {
- "Content-Type": "multipart/form-data"
- } : {},
- url,
- data
- }));
- };
- }
- Axios$1.prototype[method] = generateHTTPMethod();
- Axios$1.prototype[method + "Form"] = generateHTTPMethod(true);
-});
-let CancelToken$1 = class CancelToken {
- constructor(executor) {
- if (typeof executor !== "function") {
- throw new TypeError("executor must be a function.");
- }
- let resolvePromise;
- this.promise = new Promise(function promiseExecutor(resolve) {
- resolvePromise = resolve;
- });
- const token = this;
- this.promise.then((cancel) => {
- if (!token._listeners) return;
- let i = token._listeners.length;
- while (i-- > 0) {
- token._listeners[i](cancel);
- }
- token._listeners = null;
- });
- this.promise.then = (onfulfilled) => {
- let _resolve;
- const promise = new Promise((resolve) => {
- token.subscribe(resolve);
- _resolve = resolve;
- }).then(onfulfilled);
- promise.cancel = function reject() {
- token.unsubscribe(_resolve);
- };
- return promise;
- };
- executor(function cancel(message, config, request) {
- if (token.reason) {
- return;
- }
- token.reason = new CanceledError$1(message, config, request);
- resolvePromise(token.reason);
- });
- }
- /**
- * Throws a `CanceledError` if cancellation has been requested.
- */
- throwIfRequested() {
- if (this.reason) {
- throw this.reason;
- }
- }
- /**
- * Subscribe to the cancel signal
- */
- subscribe(listener) {
- if (this.reason) {
- listener(this.reason);
- return;
- }
- if (this._listeners) {
- this._listeners.push(listener);
- } else {
- this._listeners = [listener];
- }
- }
- /**
- * Unsubscribe from the cancel signal
- */
- unsubscribe(listener) {
- if (!this._listeners) {
- return;
- }
- const index = this._listeners.indexOf(listener);
- if (index !== -1) {
- this._listeners.splice(index, 1);
- }
- }
- toAbortSignal() {
- const controller = new AbortController();
- const abort = (err) => {
- controller.abort(err);
- };
- this.subscribe(abort);
- controller.signal.unsubscribe = () => this.unsubscribe(abort);
- return controller.signal;
- }
- /**
- * Returns an object that contains a new `CancelToken` and a function that, when called,
- * cancels the `CancelToken`.
- */
- static source() {
- let cancel;
- const token = new CancelToken(function executor(c) {
- cancel = c;
- });
- return {
- token,
- cancel
- };
- }
-};
-function spread$1(callback) {
- return function wrap(arr) {
- return callback.apply(null, arr);
- };
-}
-function isAxiosError$1(payload) {
- return utils$1.isObject(payload) && payload.isAxiosError === true;
-}
-const HttpStatusCode$1 = {
- Continue: 100,
- SwitchingProtocols: 101,
- Processing: 102,
- EarlyHints: 103,
- Ok: 200,
- Created: 201,
- Accepted: 202,
- NonAuthoritativeInformation: 203,
- NoContent: 204,
- ResetContent: 205,
- PartialContent: 206,
- MultiStatus: 207,
- AlreadyReported: 208,
- ImUsed: 226,
- MultipleChoices: 300,
- MovedPermanently: 301,
- Found: 302,
- SeeOther: 303,
- NotModified: 304,
- UseProxy: 305,
- Unused: 306,
- TemporaryRedirect: 307,
- PermanentRedirect: 308,
- BadRequest: 400,
- Unauthorized: 401,
- PaymentRequired: 402,
- Forbidden: 403,
- NotFound: 404,
- MethodNotAllowed: 405,
- NotAcceptable: 406,
- ProxyAuthenticationRequired: 407,
- RequestTimeout: 408,
- Conflict: 409,
- Gone: 410,
- LengthRequired: 411,
- PreconditionFailed: 412,
- PayloadTooLarge: 413,
- UriTooLong: 414,
- UnsupportedMediaType: 415,
- RangeNotSatisfiable: 416,
- ExpectationFailed: 417,
- ImATeapot: 418,
- MisdirectedRequest: 421,
- UnprocessableEntity: 422,
- Locked: 423,
- FailedDependency: 424,
- TooEarly: 425,
- UpgradeRequired: 426,
- PreconditionRequired: 428,
- TooManyRequests: 429,
- RequestHeaderFieldsTooLarge: 431,
- UnavailableForLegalReasons: 451,
- InternalServerError: 500,
- NotImplemented: 501,
- BadGateway: 502,
- ServiceUnavailable: 503,
- GatewayTimeout: 504,
- HttpVersionNotSupported: 505,
- VariantAlsoNegotiates: 506,
- InsufficientStorage: 507,
- LoopDetected: 508,
- NotExtended: 510,
- NetworkAuthenticationRequired: 511
-};
-Object.entries(HttpStatusCode$1).forEach(([key, value]) => {
- HttpStatusCode$1[value] = key;
-});
-function createInstance(defaultConfig) {
- const context = new Axios$1(defaultConfig);
- const instance = bind(Axios$1.prototype.request, context);
- utils$1.extend(instance, Axios$1.prototype, context, { allOwnKeys: true });
- utils$1.extend(instance, context, null, { allOwnKeys: true });
- instance.create = function create(instanceConfig) {
- return createInstance(mergeConfig$1(defaultConfig, instanceConfig));
- };
- return instance;
-}
-const axios = createInstance(defaults);
-axios.Axios = Axios$1;
-axios.CanceledError = CanceledError$1;
-axios.CancelToken = CancelToken$1;
-axios.isCancel = isCancel$1;
-axios.VERSION = VERSION$1;
-axios.toFormData = toFormData$1;
-axios.AxiosError = AxiosError$1;
-axios.Cancel = axios.CanceledError;
-axios.all = function all(promises) {
- return Promise.all(promises);
-};
-axios.spread = spread$1;
-axios.isAxiosError = isAxiosError$1;
-axios.mergeConfig = mergeConfig$1;
-axios.AxiosHeaders = AxiosHeaders$1;
-axios.formToJSON = (thing) => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
-axios.getAdapter = adapters.getAdapter;
-axios.HttpStatusCode = HttpStatusCode$1;
-axios.default = axios;
-const {
- Axios: Axios2,
- AxiosError,
- CanceledError,
- isCancel,
- CancelToken: CancelToken2,
- VERSION,
- all: all2,
- Cancel,
- isAxiosError,
- spread,
- toFormData,
- AxiosHeaders: AxiosHeaders2,
- HttpStatusCode,
- formToJSON,
- getAdapter,
- mergeConfig
-} = axios;
-const deleteLog$1 = (fileName, type, isSuccess = true, msg) => {
- window?.electron?.electronAPI.ipcRenderer ? sendRPC(
- IRPCActionType.GALLERY_LOG_DELETE_MSG,
- msg || `Delete ${fileName} on ${type} success`,
- isSuccess ? ILogType.success : ILogType.error
- ) : console.log(`Delete ${fileName} on ${type} success`);
-};
-const deleteFailedLog$1 = (fileName, type, error) => {
- deleteLog$1(fileName, type, false);
- window?.electron?.electronAPI.ipcRenderer ? sendRPC(IRPCActionType.GALLERY_LOG_DELETE_MSG, error, ILogType.error) : console.error(error);
-};
-class AlistApi {
- static async delete(configMap) {
- const { fileName, config } = configMap;
- try {
- const { version, url, uploadPath, token } = config;
- if (String(version) === "2") {
- deleteLog$1(fileName, "Alist", false, "Alist version 2 is not supported, deletion is skipped");
- return true;
- }
- const result = await axios.request({
- method: "post",
- url: `${url}/api/fs/remove`,
- headers: {
- "Content-Type": "application/json",
- Authorization: token
- },
- data: {
- dir: window.node.path.join("/", uploadPath, window.node.path.dirname(fileName)),
- names: [window.node.path.basename(fileName)]
- }
- });
- if (result.data.code === 200) {
- deleteLog$1(fileName, "Alist");
- return true;
- }
- deleteLog$1(fileName, "Alist", false);
- return false;
- } catch (error) {
- deleteFailedLog$1(fileName, "Alist", error);
- return false;
- }
- }
-}
-const getAListToken = async (url, username, password) => {
- const res = await axios.post(`${url}/api/auth/login`, {
- username,
- password
- });
- if (res.data.code === 200 && res.data.message === "success") {
- return res.data.data.token;
- }
-};
-class AListplistApi {
- static async delete(configMap) {
- const { fileName, config } = configMap;
- try {
- const { url, username, password, uploadPath } = config;
- let token = config.token;
- if (!token) {
- token = await getAListToken(url, username, password);
- }
- if (!url || !(token || username && password)) {
- deleteFailedLog$1(fileName, "Alist", "No valid token or username/password provided");
- return false;
- }
- const result = await axios.request({
- method: "post",
- url: `${url}/api/fs/remove`,
- headers: {
- "Content-Type": "application/json",
- Authorization: token
- },
- data: {
- dir: window.node.path.join("/", uploadPath, window.node.path.dirname(fileName)),
- names: [window.node.path.basename(fileName)]
- }
- });
- if (result.data.code === 200) {
- deleteLog$1(fileName, "Alist");
- return true;
- }
- deleteLog$1(fileName, "Alist", false);
- return false;
- } catch (error) {
- deleteFailedLog$1(fileName, "Alist", error);
- return false;
- }
- }
-}
-class AliyunApi {
- static #getKey(fileName, path) {
- return path && path !== "/" ? `${path.replace(/^\/+|\/+$/, "")}/${fileName}` : fileName;
- }
- static async delete(configMap) {
- const { fileName, config } = configMap;
- try {
- const client = new window.node.OSS({ ...config, region: config.area });
- const key = AliyunApi.#getKey(fileName, config.path);
- const result = await client.delete(key);
- if (result.res.status === 204) {
- deleteLog$1(fileName, "Aliyun");
- return true;
- }
- deleteLog$1(fileName, "Aliyun", false);
- return false;
- } catch (error) {
- deleteFailedLog$1(fileName, "Aliyun", error);
- return false;
- }
- }
-}
-let AwsS3Api$1 = class AwsS3Api {
- static async delete(configMap) {
- try {
- return await triggerRPC(IRPCActionType.GALLERY_DELETE_AWS_S3_FILE, getRawData(configMap)) || false;
- } catch (error) {
- deleteFailedLog$1(configMap.fileName, "AWS S3", error);
- return false;
- }
- }
-};
-class AwsS3Api2 {
- static async delete(configMap) {
- try {
- return await triggerRPC(IRPCActionType.GALLERY_DELETE_DOGE_FILE, getRawData(configMap)) || false;
- } catch (error) {
- deleteFailedLog$1(configMap.fileName, "DogeCloud", error);
- return false;
- }
- }
-}
-class GithubApi {
- static #createOctokit(token) {
- return new window.node.Octokit({
- auth: token
- });
- }
- static #createKey(path, fileName) {
- const formatedFileName = fileName.replace(/%2F/g, "/");
- return path && path !== "/" ? `${path.replace(/^\/+|\/+$/, "")}/${formatedFileName}` : formatedFileName;
- }
- static async delete(configMap) {
- const {
- fileName,
- hash,
- config: { repo, token, branch, path }
- } = configMap;
- const [owner, repoName] = repo.split("/");
- const octokit = GithubApi.#createOctokit(token);
- const key = GithubApi.#createKey(path, fileName);
- try {
- const { status } = await octokit.rest.repos.deleteFile({
- owner,
- repo: repoName,
- path: key,
- message: `delete ${fileName} by PicList`,
- sha: hash,
- branch
- });
- if (status === 200) {
- deleteLog$1(fileName, "GitHub");
- return true;
- }
- deleteLog$1(fileName, "GitHub", false);
- return false;
- } catch (error) {
- deleteFailedLog$1(fileName, "GitHub", error);
- return false;
- }
- }
-}
-class HuaweicloudApi {
- static async delete(configMap) {
- try {
- return await triggerRPC(IRPCActionType.GALLERY_DELETE_HUAWEI_OSS_FILE, getRawData(configMap)) || false;
- } catch (error) {
- deleteFailedLog$1(configMap.fileName, "HuaweiCloud", error);
- return false;
- }
- }
-}
-class ImgurApi {
- static #baseUrl = "https://api.imgur.com/3";
- static async delete(configMap) {
- const { config: { clientId = "", username = "", accessToken = "" } = {}, hash = "" } = configMap;
- let Authorization, apiUrl;
- if (username && accessToken) {
- Authorization = `Bearer ${accessToken}`;
- apiUrl = `${ImgurApi.#baseUrl}/account/${username}/image/${hash}`;
- } else if (clientId) {
- Authorization = `Client-ID ${clientId}`;
- apiUrl = `${ImgurApi.#baseUrl}/image/${hash}`;
- } else {
- deleteLog$1(hash, "Imgur", false, "No credentials found");
- return false;
- }
- try {
- const response = await axios.delete(apiUrl, {
- headers: { Authorization },
- timeout: 3e4
- });
- if (response.status === 200) {
- deleteLog$1(hash, "Imgur");
- return true;
- }
- deleteLog$1(hash, "Imgur", false);
- return false;
- } catch (error) {
- deleteFailedLog$1(hash, "Imgur", error);
- return false;
- }
- }
-}
-class LocalApi {
- static async delete(configMap) {
- const { hash } = configMap;
- if (!hash) {
- deleteLog$1(hash, "Local", false, "Local.delete: invalid params");
- return false;
- }
- try {
- await window.node.fs.remove(hash);
- deleteLog$1(hash, "Local");
- return true;
- } catch (error) {
- deleteFailedLog$1(hash, "Local", error);
- return false;
- }
- }
-}
-class LskyplistApi {
- static async delete(configMap) {
- const { hash, config } = configMap;
- if (!hash || !config || !config.token) {
- deleteLog$1(hash, "Lskyplist", false, "LskyplistApi.delete: invalid params");
- return false;
- }
- const { host, token, version } = config;
- if (version !== "V2") {
- deleteLog$1(hash, "Lskyplist", false, "LskyplistApi.delete: invalid version");
- return false;
- }
- const v2Headers = {
- Accept: "application/json",
- Authorization: token || void 0
- };
- const requestAgent = new window.node.https.Agent({
- rejectUnauthorized: false
- });
- try {
- const response = await window.node.axios.delete(`${host}/api/v1/images/${hash}`, {
- headers: v2Headers,
- timeout: 3e4,
- httpsAgent: requestAgent
- });
- if (response.status === 200 && response.data.status === true) {
- deleteLog$1(hash, "Lskyplist");
- return true;
- }
- deleteLog$1(hash, "Lskyplist", false);
- return false;
- } catch (error) {
- deleteFailedLog$1(hash, "Lskyplist", error);
- return false;
- }
- }
-}
-const deleteLog = (fileName, type, isSuccess = true, msg) => {
- console.log(`Delete ${fileName} on ${type} ${isSuccess ? "success" : "failed"}, message: ${msg || ""}`);
-};
-const deleteFailedLog = (fileName, type, error) => {
- deleteLog(fileName, type, false);
- console.error(error);
-};
-class PiclistApi {
- static async delete(configMap) {
- const { config, fullResult } = configMap;
- const { host, port } = config;
- if (!fullResult) return true;
- if (!host) {
- deleteLog(fullResult, "Piclist", false, "PiclistApi.delete: invalid params");
- return false;
- }
- const url = `http://${host || "127.0.0.1"}:${port || 36677}/delete`;
- try {
- const response = await window.node.axios.post(url, {
- list: [fullResult]
- });
- if (response.status === 200 && response.data?.success) {
- deleteLog(fullResult, "Piclist");
- return true;
- }
- deleteLog(fullResult, "Piclist", false);
- return false;
- } catch (error) {
- deleteFailedLog(fullResult, "Piclist", error);
- return false;
- }
- }
-}
-class QiniuApi {
- static async delete(configMap) {
- const {
- fileName,
- config: { accessKey, secretKey, bucket, path }
- } = configMap;
- const mac = new window.node.qiniu.auth.digest.Mac(accessKey, secretKey);
- const qiniuConfig = new window.node.qiniu.conf.Config();
- try {
- const bucketManager = new window.node.qiniu.rs.BucketManager(mac, qiniuConfig);
- const formattedPath = path?.replace(/^\/+|\/+$/, "") || "";
- const key = path === "/" || !path ? fileName : `${formattedPath}/${fileName}`;
- const res = await new Promise((resolve, reject) => {
- bucketManager.delete(bucket, key, (err, respBody, respInfo) => {
- if (err) {
- reject(err);
- } else {
- resolve({
- respBody,
- respInfo
- });
- }
- });
- });
- if (res?.respInfo?.statusCode === 200) {
- deleteLog(fileName, "Qiniu");
- return true;
- }
- deleteLog(fileName, "Qiniu", false);
- return false;
- } catch (error) {
- deleteFailedLog(fileName, "Qiniu", error);
- return false;
- }
- }
-}
-class SftpPlistApi {
- static async delete(configMap) {
- const { fileName, config } = configMap;
- try {
- return await triggerRPC(IRPCActionType.GALLERY_DELETE_SFTP_FILE, getRawData(config), fileName) || false;
- } catch (error) {
- deleteFailedLog$1(fileName, "SFTP", error);
- return false;
- }
- }
-}
-class SmmsApi {
- static #baseUrl = "https://smms.app/api/v2";
- static async delete(configMap) {
- const { hash, config } = configMap;
- if (!hash || !config || !config.token) {
- deleteLog$1(hash, "Smms", false, "SmmsApi.delete: invalid params");
- return false;
- }
- const { token } = config;
- try {
- const response = await window.node.axios.get(`${SmmsApi.#baseUrl}/delete/${hash}`, {
- headers: {
- Authorization: token
- },
- params: {
- hash,
- format: "json"
- },
- timeout: 3e4
- });
- if (response.status === 200) {
- deleteLog$1(hash, "Smms");
- return true;
- }
- deleteLog$1(hash, "Smms", false);
- return false;
- } catch (error) {
- deleteFailedLog$1(hash, "Smms", error);
- return false;
- }
- }
-}
-class TcyunApi {
- static #createCOS(SecretId, SecretKey) {
- return new window.node.COS({
- SecretId,
- SecretKey
- });
- }
- static async delete(configMap) {
- const {
- fileName,
- config: { secretId, secretKey, bucket, area, path }
- } = configMap;
- try {
- const cos = TcyunApi.#createCOS(secretId, secretKey);
- let key;
- if (path === "/" || !path) {
- key = `/${fileName}`;
- } else {
- key = `/${path.replace(/^\/+|\/+$/, "")}/${fileName}`;
- }
- const result = await cos.deleteObject({
- Bucket: bucket,
- Region: area,
- Key: key
- });
- if (result.statusCode === 204) {
- deleteLog$1(fileName, "Tcyun");
- return true;
- }
- deleteLog$1(fileName, "Tcyun", false);
- return false;
- } catch (error) {
- deleteFailedLog$1(fileName, "Tcyun", error);
- return false;
- }
- }
-}
-class UpyunApi {
- static async delete(configMap) {
- const {
- fileName,
- config: { bucket, operator, password, path }
- } = configMap;
- try {
- const service = new window.node.Upyun.Service(bucket, operator, password);
- const client = new window.node.Upyun.Client(service);
- let key;
- if (path === "/" || !path) {
- key = fileName;
- } else {
- key = `${path.replace(/^\/+|\/+$/, "")}/${fileName}`;
- }
- const result = await client.deleteFile(key);
- if (result) {
- deleteLog$1(fileName, "Upyun");
- return true;
- }
- deleteLog$1(fileName, "Upyun", false);
- return false;
- } catch (error) {
- deleteFailedLog$1(fileName, "Upyun", error);
- return false;
- }
- }
-}
-class WebdavApi {
- static async delete(configMap) {
- const {
- fileName,
- config: { host, username, password, path, sslEnabled, authType }
- } = configMap;
- const endpoint = formatEndpoint(host, sslEnabled);
- const options = {
- username,
- password
- };
- if (authType === "digest") {
- options.authType = window.node.webdav.AuthType.Digest;
- }
- const ctx = window.node.webdav.createClient(endpoint, options);
- let key;
- if (path === "/" || !path) {
- key = fileName;
- } else {
- key = `${path.replace(/^\/+|\/+$/, "")}/${fileName}`;
- }
- try {
- await ctx.deleteFile(key);
- deleteLog$1(fileName, "WebDAV");
- return true;
- } catch (error) {
- deleteFailedLog$1(fileName, "WebDAV", error);
- return false;
- }
- }
-}
-const apiMap = {
- alist: AlistApi,
- alistplist: AListplistApi,
- aliyun: AliyunApi,
- "aws-s3": AwsS3Api$1,
- "aws-s3-plist": AwsS3Api$1,
- dogecloud: AwsS3Api2,
- github: GithubApi,
- "huaweicloud-uploader": HuaweicloudApi,
- imgur: ImgurApi,
- local: LocalApi,
- lskyplist: LskyplistApi,
- piclist: PiclistApi,
- qiniu: QiniuApi,
- sftpplist: SftpPlistApi,
- smms: SmmsApi,
- tcyun: TcyunApi,
- upyun: UpyunApi,
- webdavplist: WebdavApi
-};
-class ALLApi {
- static async delete(configMap) {
- const api = apiMap[configMap.type];
- return api ? await api.delete(configMap) : false;
- }
-}
-const _hoisted_1 = { class: "view-title" };
-const _hoisted_2 = { style: { "position": "absolute", "right": "0", "top": "0", "margin-right": "20px", "font-size": "0.8em", "color": "#fff" } };
-const _hoisted_3 = ["onClick"];
-const _hoisted_4 = { class: "gallery-list__item-img" };
-const _hoisted_5 = ["title"];
-const _hoisted_6 = { style: { "margin-top": "10px", "align-items": "center", "display": "flex", "justify-content": "flex-end" } };
-const __default__ = {
- name: "GalleryPage"
-};
-const _sfc_main = /* @__PURE__ */ defineComponent({
- ...__default__,
- setup(__props) {
- const images = ref([]);
- const dialogVisible = ref(false);
- const imgInfo = reactive({
- id: "",
- imgUrl: ""
- });
- const $confirm = ElMessageBox.confirm;
- const choosedList = reactive({});
- const gallerySliderControl = reactive({
- visible: false,
- index: 0
- });
- const deleteCloud = ref(false);
- const choosedPicBed = ref([]);
- const lastChoosed = ref(-1);
- const isShiftKeyPress = ref(false);
- const searchText = ref("");
- const searchTextURL = ref("");
- const handleBarActive = ref(true);
- const pasteStyle = ref("");
- const pasteStyleMap = {
- Markdown: "markdown",
- HTML: "HTML",
- URL: "URL",
- UBB: "UBB",
- Custom: "Custom"
- };
- const useShortUrl = ref("");
- const shortURLMap = {
- [T("UPLOAD_SHORT_URL")]: T("UPLOAD_SHORT_URL"),
- [T("UPLOAD_NORMAL_URL")]: T("UPLOAD_NORMAL_URL")
- };
- const fileSortNameReverse = ref(false);
- const fileSortTimeReverse = ref(false);
- const fileSortExtReverse = ref(false);
- const isShowBatchRenameDialog = ref(false);
- const batchRenameMatch = ref("");
- const batchRenameReplace = ref("");
- const dateRange = ref("");
- const mathcedCount = computed(() => {
- return filterList.value.filter((item) => {
- return customStrMatch(item.imgUrl, batchRenameMatch.value);
- }).length;
- });
- onBeforeRouteUpdate((to, from) => {
- if (from.name === "gallery") {
- clearChoosedList();
- }
- if (to.name === "gallery") {
- updateGallery();
- }
- });
- async function initDeleteCloud() {
- deleteCloud.value = await getConfig(configPaths.settings.deleteCloudFile) || false;
- }
- onBeforeMount(async () => {
- window.electron.electronAPI.ipcRenderer.on("updateGallery", () => {
- nextTick(async () => {
- updateGallery();
- });
- });
- updateGallery();
- document.addEventListener("keydown", handleDetectShiftKey);
- document.addEventListener("keyup", handleDetectShiftKey);
- });
- function handleDetectShiftKey(event) {
- if (event.key === "Shift") {
- isShiftKeyPress.value = event.type === "keydown";
- }
- }
- const filterList = computed(() => {
- const res = getGallery();
- return res;
- });
- const addCacheBustParam = (url) => {
- if (!url) {
- return "";
- }
- if (!(url.startsWith("http://") || url.startsWith("https://"))) {
- return url;
- }
- try {
- const separator = url.includes("?") ? "&" : "?";
- return `${url}${separator}cbplist=${(/* @__PURE__ */ new Date()).getTime()}`;
- } catch (e) {
- return url;
- }
- };
- const filterListWithCacheBust = computed(() => {
- const newList = filterList.value.map((item) => {
- const newItem = { ...item };
- if (newItem.imgUrl) {
- newItem.imgUrl = addCacheBustParam(newItem.imgUrl);
- }
- if (newItem.galleryPath) {
- newItem.galleryPath = addCacheBustParam(newItem.galleryPath);
- }
- newItem.src = addCacheBustParam(newItem.src || newItem.galleryPath || newItem.imgUrl || "");
- return newItem;
- });
- return newList;
- });
- const isAllSelected = computed(() => {
- return Object.values(choosedList).length > 0 && filterList.value.every((item) => choosedList[item.id]);
- });
- function formatFileName(name) {
- return window.node.path.basename(name);
- }
- function getGallery() {
- if (searchText.value || choosedPicBed.value.length > 0 || searchTextURL.value || dateRange.value) {
- return images.value.filter((item) => {
- let isInChoosedPicBed = true;
- let isIncludesSearchText = true;
- let isIncludesSearchTextURL = true;
- let isIncludesDateRange = true;
- if (choosedPicBed.value.length > 0) {
- isInChoosedPicBed = choosedPicBed.value.some((type) => type === item.type);
- }
- if (searchText.value) {
- isIncludesSearchText = customStrMatch(item.fileName || "", searchText.value);
- }
- if (searchTextURL.value) {
- isIncludesSearchTextURL = customStrMatch(item.imgUrl || "", searchTextURL.value);
- }
- if (dateRange.value) {
- const [start, end] = dateRange.value;
- const date = new Date(item.updatedAt).getTime();
- isIncludesDateRange = date >= new Date(start).getTime() && date <= new Date(end).getTime() + 864e5;
- }
- return isIncludesSearchText && isInChoosedPicBed && isIncludesSearchTextURL && isIncludesDateRange;
- }).map((item) => {
- return {
- ...item,
- src: item.galleryPath || item.imgUrl || "",
- key: item.id || `${Date.now()}`,
- intro: item.fileName || ""
- };
- });
- } else {
- return images.value.map((item) => {
- return {
- ...item,
- src: item.galleryPath || item.imgUrl || "",
- key: item.id || `${Date.now()}`,
- intro: item.fileName || ""
- };
- });
- }
- }
- async function updateGallery() {
- images.value = (await $$db.get({ orderBy: "desc" })).data;
- }
- watch(
- () => filterList,
- () => {
- clearChoosedList();
- }
- );
- function handleChooseImage(val, index) {
- if (val === true) {
- handleBarActive.value = true;
- if (lastChoosed.value !== -1 && isShiftKeyPress.value) {
- const min = Math.min(lastChoosed.value, index);
- const max = Math.max(lastChoosed.value, index);
- for (let i = min + 1; i < max; i++) {
- const id = filterList.value[i].id;
- choosedList[id] = true;
- }
- }
- lastChoosed.value = index;
- }
- }
- function refreshPage() {
- sendRPC(IRPCActionType.REFRESH_SETTING_WINDOW);
- }
- function clearChoosedList() {
- isShiftKeyPress.value = false;
- Object.keys(choosedList).forEach((key) => {
- choosedList[key] = false;
- });
- lastChoosed.value = -1;
- }
- function zoomImage(index) {
- gallerySliderControl.index = index;
- gallerySliderControl.visible = true;
- changeZIndexForGallery(true);
- }
- function changeZIndexForGallery(isOpen) {
- if (isOpen) {
- document.querySelector(".main-content.el-row").style.zIndex = 101;
- } else {
- document.querySelector(".main-content.el-row").style.zIndex = 10;
- }
- }
- function handleClose() {
- gallerySliderControl.index = 0;
- gallerySliderControl.visible = false;
- changeZIndexForGallery(false);
- }
- async function copy(item) {
- item.config = JSON.parse(JSON.stringify(item.config) || "{}");
- const result = await triggerRPC(IRPCActionType.GALLERY_PASTE_TEXT, item);
- if (result && result[1] && item.id) {
- await $$db.updateById(item.id, {
- shortUrl: result[1]
- });
- }
- const obj = {
- title: T("COPY_LINK_SUCCEED"),
- body: result ? result[0] : ""
- };
- const myNotification = new Notification(obj.title, obj);
- myNotification.onclick = () => {
- return true;
- };
- updateGallery();
- }
- function remove(item) {
- if (!item.id) return;
- $confirm(T("TIPS_REMOVE_LINK"), T("TIPS_NOTICE"), {
- confirmButtonText: T("CONFIRM"),
- cancelButtonText: T("CANCEL"),
- type: "warning"
- }).then(async () => {
- const file = await $$db.getById(item.id);
- if (await getConfig(configPaths.settings.deleteCloudFile) && picBedsCanbeDeleted.includes(item?.type || "placeholder")) {
- const result = await ALLApi.delete(item);
- if (result) {
- ElNotification({
- title: T("GALLERY_SYNC_DELETE_NOTICE_TITLE"),
- message: `${item.fileName} ${T("GALLERY_SYNC_DELETE_NOTICE_SUCCEED")}`,
- type: "success"
- });
- } else {
- ElNotification({
- title: T("GALLERY_SYNC_DELETE_NOTICE_TITLE"),
- message: `${item.fileName} ${T("GALLERY_SYNC_DELETE_NOTICE_FAILED")}`,
- type: "error"
- });
- return true;
- }
- }
- await $$db.removeById(item.id);
- sendRPC(IRPCActionType.GALLERY_REMOVE_FILES, [file]);
- const obj = {
- title: T("OPERATION_SUCCEED"),
- body: ""
- };
- const myNotification = new Notification(obj.title, obj);
- myNotification.onclick = () => {
- return true;
- };
- updateGallery();
- }).catch((e) => {
- console.log(e);
- return true;
- });
- }
- function handleDeleteCloudFile(val) {
- saveConfig({
- [configPaths.settings.deleteCloudFile]: val
- });
- }
- function openDialog(item) {
- imgInfo.id = item.id;
- imgInfo.imgUrl = item.imgUrl;
- dialogVisible.value = true;
- }
- async function confirmModify() {
- await $$db.updateById(imgInfo.id, {
- imgUrl: imgInfo.imgUrl
- });
- const obj = {
- title: T("CHANGE_IMAGE_URL_SUCCEED"),
- body: imgInfo.imgUrl
- };
- const myNotification = new Notification(obj.title, obj);
- myNotification.onclick = () => {
- return true;
- };
- dialogVisible.value = false;
- updateGallery();
- }
- function cleanSearch() {
- searchText.value = "";
- }
- function cleanSearchUrl() {
- searchTextURL.value = "";
- }
- function isMultiple(obj) {
- return Object.values(obj).some((item) => item);
- }
- function toggleSelectAll() {
- const result = !isAllSelected.value;
- filterList.value.forEach((item) => {
- choosedList[item.id] = result;
- });
- }
- function multiRemove() {
- const multiRemoveNumber = Object.values(choosedList).filter((item) => item).length;
- if (multiRemoveNumber) {
- $confirm(
- T("TIPS_WILL_REMOVE_CHOOSED_IMAGES", {
- m: multiRemoveNumber
- }),
- T("TIPS_NOTICE"),
- {
- confirmButtonText: T("CONFIRM"),
- cancelButtonText: T("CANCEL"),
- type: "warning"
- }
- ).then(async () => {
- const files = [];
- const imageIDList = Object.keys(choosedList);
- const isDeleteCloudFile = await getConfig(configPaths.settings.deleteCloudFile);
- if (isDeleteCloudFile) {
- for (const imageIDListItem of imageIDList) {
- const key = imageIDListItem;
- if (choosedList[key]) {
- const file = await $$db.getById(key);
- if (file) {
- if (file.type !== void 0 && picBedsCanbeDeleted.includes(file.type)) {
- const result = await ALLApi.delete(file);
- if (result) {
- ElNotification({
- title: T("GALLERY_SYNC_DELETE"),
- message: `${file.fileName} ${T("GALLERY_SYNC_DELETE_NOTICE_SUCCEED")}`,
- type: "success",
- duration: multiRemoveNumber > 5 ? 1e3 : 2e3
- });
- files.push(file);
- await $$db.removeById(key);
- } else {
- ElNotification({
- title: T("GALLERY_SYNC_DELETE"),
- message: `${file.fileName} ${T("GALLERY_SYNC_DELETE_NOTICE_FAILED")}`,
- type: "error",
- duration: multiRemoveNumber > 5 ? 1e3 : 2e3
- });
- }
- } else {
- files.push(file);
- await $$db.removeById(key);
- }
- }
- }
- }
- } else {
- for (const imageIDListItem of imageIDList) {
- const key = imageIDListItem;
- if (choosedList[key]) {
- const file = await $$db.getById(key);
- if (file) {
- files.push(file);
- await $$db.removeById(key);
- }
- }
- }
- }
- clearChoosedList();
- const obj = {
- title: T("OPERATION_SUCCEED"),
- body: ""
- };
- sendRPC(IRPCActionType.GALLERY_REMOVE_FILES, files);
- const myNotification = new Notification(obj.title, obj);
- myNotification.onclick = () => {
- return true;
- };
- updateGallery();
- }).catch(() => {
- return true;
- });
- }
- }
- async function multiCopy() {
- if (Object.values(choosedList).some((item) => item)) {
- const copyString = [];
- const imageIDList = Object.keys(choosedList);
- for (const imageIDListItem of imageIDList) {
- const key = imageIDListItem;
- if (choosedList[key]) {
- const item = await $$db.getById(key);
- if (item) {
- const result = await triggerRPC(IRPCActionType.GALLERY_PASTE_TEXT, item);
- copyString.push(result ? result[0] : "");
- if (result && result[1] && item.id) {
- await $$db.updateById(item.id, {
- shortUrl: result[1]
- });
- }
- choosedList[key] = false;
- }
- }
- }
- const obj = {
- title: T("BATCH_COPY_LINK_SUCCEED"),
- body: copyString.join("\n")
- };
- const myNotification = new Notification(obj.title, obj);
- window.electron.clipboard.writeText(copyString.join("\n"));
- myNotification.onclick = () => {
- return true;
- };
- updateGallery();
- }
- }
- function toggleHandleBar() {
- handleBarActive.value = !handleBarActive.value;
- }
- async function handlePasteStyleChange(val) {
- saveConfig(configPaths.settings.pasteStyle, val);
- pasteStyle.value = val;
- }
- function handleUseShortUrlChange(value) {
- saveConfig(configPaths.settings.useShortUrl, value === T("UPLOAD_SHORT_URL"));
- useShortUrl.value = value;
- }
- function sortFile(type) {
- switch (type) {
- case "name":
- fileSortNameReverse.value = !fileSortNameReverse.value;
- images.value.sort((a, b) => {
- if (fileSortNameReverse.value) {
- return a.fileName.localeCompare(b.fileName);
- } else {
- return b.fileName.localeCompare(a.fileName);
- }
- });
- break;
- case "time":
- fileSortTimeReverse.value = !fileSortTimeReverse.value;
- images.value.sort((a, b) => {
- if (fileSortTimeReverse.value) {
- return a.updatedAt - b.updatedAt;
- } else {
- return b.updatedAt - a.updatedAt;
- }
- });
- break;
- case "ext":
- fileSortExtReverse.value = !fileSortExtReverse.value;
- images.value.sort((a, b) => {
- if (fileSortExtReverse.value) {
- return a.extname.localeCompare(b.extname);
- } else {
- return b.extname.localeCompare(a.extname);
- }
- });
- break;
- case "check":
- images.value.sort((a, b) => {
- if (choosedList[a.id] && !choosedList[b.id]) {
- return -1;
- } else if (!choosedList[a.id] && choosedList[b.id]) {
- return 1;
- } else {
- return 0;
- }
- });
- break;
- }
- }
- function handleBatchRename() {
- isShowBatchRenameDialog.value = false;
- if (batchRenameMatch.value === "") {
- ElMessage.warning(T("MANAGE_BUCKET_BATCH_RENAME_ERROR_MSG"));
- return;
- }
- let matchedFiles = [];
- filterList.value.forEach((item) => {
- if (customStrMatch(item.imgUrl, batchRenameMatch.value)) {
- matchedFiles.push(item);
- }
- });
- if (matchedFiles.length === 0) {
- ElMessage.warning(T("MANAGE_BUCKET_BATCH_RENAME_ERROR_MSG2"));
- return;
- }
- for (const matchedFile of matchedFiles) {
- matchedFile.newUrl = customStrReplace(matchedFile.imgUrl, batchRenameMatch.value, batchRenameReplace.value);
- }
- matchedFiles = matchedFiles.filter((item) => item.imgUrl !== item.newUrl);
- if (matchedFiles.length === 0) {
- ElMessage.warning(T("MANAGE_BUCKET_BATCH_RENAME_ERROR_MSG3"));
- }
- for (let i = 0; i < matchedFiles.length; i++) {
- matchedFiles[i].newUrl = matchedFiles[i].newUrl.replaceAll("{auto}", (i + 1).toString());
- }
- const duplicateFilesNum = matchedFiles.filter(
- (item) => matchedFiles.filter((item2) => item2.newUrl === item.newUrl).length > 1
- ).length;
- const renamefunc = async (item) => {
- await $$db.updateById(item.id, {
- imgUrl: item.newUrl
- });
- };
- const rename = () => {
- const promiseList = [];
- for (const matchedFile of matchedFiles) {
- promiseList.push(renamefunc(matchedFile));
- }
- Promise.all(promiseList).then(() => {
- const obj = {
- title: T("OPERATION_SUCCEED"),
- body: ""
- };
- const myNotification = new Notification(obj.title, obj);
- myNotification.onclick = () => {
- return true;
- };
- updateGallery();
- }).catch(() => {
- return true;
- });
- };
- if (duplicateFilesNum > 0) {
- ElMessageBox.confirm(
- `${T("MANAGE_BUCKET_BATCH_RENAME_REPEATED_MSG_A")} ${duplicateFilesNum} ${T("MANAGE_BUCKET_BATCH_RENAME_REPEATED_MSG_B")}`,
- T("MANAGE_BUCKET_BATCH_RENAME_REPEATED_MSG_C"),
- {
- confirmButtonText: T("MANAGE_BUCKET_BATCH_RENAME_REPEATED_CONFIRM"),
- cancelButtonText: T("MANAGE_BUCKET_BATCH_RENAME_REPEATED_CANCEL"),
- type: "warning"
- }
- ).then(() => {
- rename();
- }).catch(() => {
- ElMessage.info(T("MANAGE_BUCKET_BATCH_RENAME_CANCEL"));
- });
- } else {
- rename();
- }
- }
- onBeforeUnmount(() => {
- window.electron.electronAPI.ipcRenderer.removeAllListeners("updateGallery");
- });
- onActivated(async () => {
- pasteStyle.value = await getConfig(configPaths.settings.pasteStyle) || IPasteStyle.MARKDOWN;
- useShortUrl.value = await getConfig(configPaths.settings.useShortUrl) ? T("UPLOAD_SHORT_URL") : T("UPLOAD_NORMAL_URL");
- initDeleteCloud();
- });
- return (_ctx, _cache) => {
- const _component_el_icon = resolveComponent("el-icon");
- const _component_el_switch = resolveComponent("el-switch");
- const _component_el_tooltip = resolveComponent("el-tooltip");
- const _component_el_button = resolveComponent("el-button");
- const _component_el_option = resolveComponent("el-option");
- const _component_el_select = resolveComponent("el-select");
- const _component_el_col = resolveComponent("el-col");
- const _component_el_date_picker = resolveComponent("el-date-picker");
- const _component_el_divider = resolveComponent("el-divider");
- const _component_el_dropdown_item = resolveComponent("el-dropdown-item");
- const _component_el_dropdown = resolveComponent("el-dropdown");
- const _component_el_row = resolveComponent("el-row");
- const _component_el_input = resolveComponent("el-input");
- const _component_photo_slider = resolveComponent("photo-slider");
- const _component_el_checkbox = resolveComponent("el-checkbox");
- const _component_el_dialog = resolveComponent("el-dialog");
- const _component_el_link = resolveComponent("el-link");
- const _component_el_descriptions_item = resolveComponent("el-descriptions-item");
- const _component_el_descriptions = resolveComponent("el-descriptions");
- const _component_el_popover = resolveComponent("el-popover");
- const _directive_lazy = resolveDirective("lazy");
- return openBlock(), createElementBlock("div", {
- id: "gallery-view",
- style: normalizeStyle(handleBarActive.value ? "height: 85%;" : "height: 95%;")
- }, [
- createBaseVNode("div", _hoisted_1, [
- createTextVNode(toDisplayString(unref(T)("GALLERY")) + " - " + toDisplayString(filterList.value.length) + " ", 1),
- createVNode(_component_el_icon, {
- style: { "margin-left": "4px" },
- class: "cursor-pointer",
- onClick: toggleHandleBar
- }, {
- default: withCtx(() => [
- withDirectives(createVNode(unref(caret_bottom_default), null, null, 512), [
- [vShow, !handleBarActive.value]
- ]),
- withDirectives(createVNode(unref(caret_top_default), null, null, 512), [
- [vShow, handleBarActive.value]
- ])
- ]),
- _: 1
- }),
- createBaseVNode("span", _hoisted_2, [
- createTextVNode(toDisplayString(unref(T)("GALLERY_SYNC_DELETE")) + " ", 1),
- createVNode(_component_el_switch, {
- modelValue: deleteCloud.value,
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => deleteCloud.value = $event),
- "active-text": unref(T)("SETTINGS_OPEN"),
- "inactive-text": unref(T)("SETTINGS_CLOSE"),
- onChange: handleDeleteCloudFile
- }, null, 8, ["modelValue", "active-text", "inactive-text"]),
- createVNode(_component_el_button, {
- type: "primary",
- link: true,
- onClick: refreshPage
- }, {
- default: withCtx(() => [
- createVNode(_component_el_tooltip, {
- class: "item",
- effect: "dark",
- content: unref(T)("REFRESH"),
- placement: "bottom",
- persistent: false,
- teleported: ""
- }, {
- default: withCtx(() => [
- createVNode(_component_el_icon, {
- size: "25",
- style: { "cursor": "pointer", "margin-left": "10px" }
- }, {
- default: withCtx(() => [
- createVNode(unref(refresh_default))
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["content"])
- ]),
- _: 1
- })
- ])
- ]),
- createVNode(Transition, { name: "el-zoom-in-top" }, {
- default: withCtx(() => [
- withDirectives(createVNode(_component_el_row, null, {
- default: withCtx(() => [
- createVNode(_component_el_col, {
- span: 22,
- offset: 1
- }, {
- default: withCtx(() => [
- createVNode(_component_el_row, {
- class: "handle-bar",
- gutter: 16
- }, {
- default: withCtx(() => [
- createVNode(_component_el_col, { span: 5 }, {
- default: withCtx(() => [
- createVNode(_component_el_select, {
- modelValue: choosedPicBed.value,
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => choosedPicBed.value = $event),
- multiple: "",
- "collapse-tags": "",
- size: "small",
- style: { "width": "100%" },
- placeholder: unref(T)("CHOOSE_SHOWED_PICBED"),
- persistent: false,
- teleported: ""
- }, {
- default: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(picBedGlobal), (item) => {
- return openBlock(), createBlock(_component_el_option, {
- key: item.type,
- label: item.name,
- value: item.type
- }, null, 8, ["label", "value"]);
- }), 128))
- ]),
- _: 1
- }, 8, ["modelValue", "placeholder"])
- ]),
- _: 1
- }),
- createVNode(_component_el_col, { span: 10 }, {
- default: withCtx(() => [
- createVNode(_component_el_date_picker, {
- modelValue: dateRange.value,
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => dateRange.value = $event),
- type: "daterange",
- "unlink-panels": "",
- "range-separator": "To",
- "start-placeholder": "Start date",
- "end-placeholder": "End date",
- size: "small",
- teleported: ""
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- }),
- createVNode(_component_el_col, { span: 1 }, {
- default: withCtx(() => [
- createVNode(_component_el_divider, {
- direction: "vertical",
- style: { "height": "100%" },
- "border-style": "hidden"
- })
- ]),
- _: 1
- }),
- createVNode(_component_el_col, { span: 3 }, {
- default: withCtx(() => [
- createVNode(_component_el_select, {
- modelValue: pasteStyle.value,
- "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => pasteStyle.value = $event),
- size: "small",
- style: { "width": "100%" },
- placeholder: unref(T)("CHOOSE_PASTE_FORMAT"),
- persistent: false,
- teleported: "",
- onChange: handlePasteStyleChange
- }, {
- default: withCtx(() => [
- (openBlock(), createElementBlock(Fragment, null, renderList(pasteStyleMap, (value, key) => {
- return createVNode(_component_el_option, {
- key,
- label: key,
- value
- }, null, 8, ["label", "value"]);
- }), 64))
- ]),
- _: 1
- }, 8, ["modelValue", "placeholder"])
- ]),
- _: 1
- }),
- createVNode(_component_el_col, { span: 3 }, {
- default: withCtx(() => [
- createVNode(_component_el_select, {
- modelValue: useShortUrl.value,
- "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => useShortUrl.value = $event),
- size: "small",
- style: { "width": "100%" },
- placeholder: "Choose",
- persistent: false,
- teleported: "",
- onChange: handleUseShortUrlChange
- }, {
- default: withCtx(() => [
- (openBlock(), createElementBlock(Fragment, null, renderList(shortURLMap, (value, key) => {
- return createVNode(_component_el_option, {
- key,
- label: key,
- value
- }, null, 8, ["label", "value"]);
- }), 64))
- ]),
- _: 1
- }, 8, ["modelValue"])
- ]),
- _: 1
- }),
- createVNode(_component_el_col, { span: 2 }, {
- default: withCtx(() => [
- createVNode(_component_el_dropdown, { teleported: "" }, {
- dropdown: withCtx(() => [
- createVNode(_component_el_dropdown_item, {
- onClick: _cache[5] || (_cache[5] = ($event) => sortFile("name"))
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_SORT_NAME")), 1)
- ]),
- _: 1
- }),
- createVNode(_component_el_dropdown_item, {
- onClick: _cache[6] || (_cache[6] = ($event) => sortFile("ext"))
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_SORT_EXT")), 1)
- ]),
- _: 1
- }),
- createVNode(_component_el_dropdown_item, {
- onClick: _cache[7] || (_cache[7] = ($event) => sortFile("time"))
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_SORT_TIME")), 1)
- ]),
- _: 1
- }),
- createVNode(_component_el_dropdown_item, {
- onClick: _cache[8] || (_cache[8] = ($event) => sortFile("check"))
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_SORT_CHECK")), 1)
- ]),
- _: 1
- })
- ]),
- default: withCtx(() => [
- createVNode(_component_el_button, {
- size: "small",
- type: "primary",
- icon: unref(sort_default)
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_SORT_TITLE")), 1)
- ]),
- _: 1
- }, 8, ["icon"])
- ]),
- _: 1
- })
- ]),
- _: 1
- })
- ]),
- _: 1
- }),
- createVNode(_component_el_row, {
- class: "handle-bar",
- gutter: 16
- }, {
- default: withCtx(() => [
- createVNode(_component_el_col, { span: 5 }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: searchText.value,
- "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => searchText.value = $event),
- placeholder: unref(T)("GALLERY_SEARCH_FILENAME"),
- size: "small"
- }, {
- suffix: withCtx(() => [
- createVNode(_component_el_icon, {
- class: "el-input__icon",
- style: { "cursor": "pointer" },
- onClick: cleanSearch
- }, {
- default: withCtx(() => [
- createVNode(unref(close_default))
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["modelValue", "placeholder"])
- ]),
- _: 1
- }),
- createVNode(_component_el_col, { span: 6 }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: searchTextURL.value,
- "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => searchTextURL.value = $event),
- placeholder: unref(T)("GALLERY_SEARCH_URL"),
- size: "small"
- }, {
- suffix: withCtx(() => [
- createVNode(_component_el_icon, {
- class: "el-input__icon",
- style: { "cursor": "pointer" },
- onClick: cleanSearchUrl
- }, {
- default: withCtx(() => [
- createVNode(unref(close_default))
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["modelValue", "placeholder"])
- ]),
- _: 1
- }),
- createVNode(_component_el_col, { span: 1 }, {
- default: withCtx(() => [
- createVNode(_component_el_divider, {
- direction: "vertical",
- style: { "height": "100%" },
- "border-style": "hidden"
- })
- ]),
- _: 1
- }),
- createVNode(_component_el_col, { span: 3 }, {
- default: withCtx(() => [
- createBaseVNode("div", {
- class: normalizeClass(["item-base copy round", { active: isMultiple(choosedList) }]),
- onClick: multiCopy
- }, toDisplayString(unref(T)("COPY")), 3)
- ]),
- _: 1
- }),
- createVNode(_component_el_col, { span: 3 }, {
- default: withCtx(() => [
- createBaseVNode("div", {
- class: normalizeClass(["item-base all-pick round", { active: filterList.value.length > 0 }]),
- onClick: _cache[11] || (_cache[11] = () => isShowBatchRenameDialog.value = true)
- }, toDisplayString(unref(T)("GALLERY_CHANGE_URL")), 3)
- ]),
- _: 1
- }),
- createVNode(_component_el_col, { span: 3 }, {
- default: withCtx(() => [
- createBaseVNode("div", {
- class: normalizeClass(["item-base delete round", { active: isMultiple(choosedList) }]),
- onClick: multiRemove
- }, toDisplayString(unref(T)("DELETE")), 3)
- ]),
- _: 1
- }),
- createVNode(_component_el_col, { span: 3 }, {
- default: withCtx(() => [
- createBaseVNode("div", {
- class: normalizeClass(["item-base all-pick round", { active: filterList.value.length > 0 }]),
- onClick: toggleSelectAll
- }, toDisplayString(isAllSelected.value ? unref(T)("CANCEL") : unref(T)("SELECT_ALL")), 3)
- ]),
- _: 1
- })
- ]),
- _: 1
- })
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 512), [
- [vShow, handleBarActive.value]
- ])
- ]),
- _: 1
- }),
- createVNode(_component_el_row, {
- class: normalizeClass(["gallery-list", { small: handleBarActive.value }])
- }, {
- default: withCtx(() => [
- createVNode(_component_el_col, {
- span: 22,
- offset: 1
- }, {
- default: withCtx(() => [
- createVNode(_component_el_row, { gutter: 16 }, {
- default: withCtx(() => [
- createVNode(_component_photo_slider, {
- items: filterListWithCacheBust.value,
- visible: gallerySliderControl.visible,
- index: gallerySliderControl.index,
- "should-transition": true,
- onChangeIndex: zoomImage,
- onClickMask: handleClose,
- onCloseModal: handleClose
- }, null, 8, ["items", "visible", "index"]),
- (openBlock(true), createElementBlock(Fragment, null, renderList(filterList.value, (item, index) => {
- return openBlock(), createBlock(_component_el_col, {
- key: item.id,
- xs: 24,
- sm: 12,
- md: 8,
- lg: 4,
- xl: 2,
- class: "gallery-list__img"
- }, {
- default: withCtx(() => [
- createBaseVNode("div", {
- class: "gallery-list__item",
- onClick: ($event) => zoomImage(index)
- }, [
- withDirectives(createBaseVNode("img", _hoisted_4, null, 512), [
- [_directive_lazy, {
- src: addCacheBustParam(item.galleryPath) || addCacheBustParam(item.imgUrl)
- }]
- ])
- ], 8, _hoisted_3),
- createBaseVNode("div", {
- class: "gallery-list__file-name",
- title: item.fileName
- }, toDisplayString(formatFileName(item.fileName || "")), 9, _hoisted_5),
- createVNode(_component_el_row, {
- class: "gallery-list__tool-panel",
- justify: "space-between",
- align: "middle"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_row, null, {
- default: withCtx(() => [
- createVNode(_component_el_icon, {
- class: "cursor-pointer document",
- onClick: ($event) => copy(item)
- }, {
- default: withCtx(() => [
- createVNode(unref(document_default))
- ]),
- _: 2
- }, 1032, ["onClick"]),
- createVNode(_component_el_icon, {
- class: "cursor-pointer edit",
- onClick: ($event) => openDialog(item)
- }, {
- default: withCtx(() => [
- createVNode(unref(edit_default))
- ]),
- _: 2
- }, 1032, ["onClick"]),
- createVNode(_component_el_icon, {
- class: "cursor-pointer delete",
- onClick: ($event) => remove(item)
- }, {
- default: withCtx(() => [
- createVNode(unref(delete_default))
- ]),
- _: 2
- }, 1032, ["onClick"])
- ]),
- _: 2
- }, 1024),
- createVNode(_component_el_checkbox, {
- modelValue: choosedList[item.id ? item.id : ""],
- "onUpdate:modelValue": ($event) => choosedList[item.id ? item.id : ""] = $event,
- onChange: (val) => handleChooseImage(val, index)
- }, null, 8, ["modelValue", "onUpdate:modelValue", "onChange"])
- ]),
- _: 2
- }, 1024)
- ]),
- _: 2
- }, 1024);
- }), 128))
- ]),
- _: 1
- })
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["class"]),
- createVNode(_component_el_dialog, {
- modelValue: dialogVisible.value,
- "onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => dialogVisible.value = $event),
- title: unref(T)("CHANGE_IMAGE_URL"),
- width: "500px",
- "modal-append-to-body": false,
- "append-to-body": ""
- }, {
- footer: withCtx(() => [
- createVNode(_component_el_button, {
- onClick: _cache[13] || (_cache[13] = ($event) => dialogVisible.value = false)
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("CANCEL")), 1)
- ]),
- _: 1
- }),
- createVNode(_component_el_button, {
- type: "primary",
- onClick: confirmModify
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("CONFIRM")), 1)
- ]),
- _: 1
- })
- ]),
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: imgInfo.imgUrl,
- "onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => imgInfo.imgUrl = $event)
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- }, 8, ["modelValue", "title"]),
- createVNode(_component_el_dialog, {
- modelValue: isShowBatchRenameDialog.value,
- "onUpdate:modelValue": _cache[19] || (_cache[19] = ($event) => isShowBatchRenameDialog.value = $event),
- title: unref(T)("CHANGE_IMAGE_URL"),
- center: "",
- "align-center": "",
- draggable: "",
- "destroy-on-close": "",
- "append-to-body": ""
- }, {
- default: withCtx(() => [
- createVNode(_component_el_link, {
- underline: false,
- style: { "margin-bottom": "10px" }
- }, {
- default: withCtx(() => [
- createBaseVNode("span", null, [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_RENAME_FILE_INPUT_A") + unref(T)("GALLERY_MATCHED") + mathcedCount.value + " ") + " ", 1),
- createVNode(_component_el_tooltip, {
- effect: "dark",
- content: unref(T)("MANAGE_BUCKET_RENAME_FILE_INPUT_A_TIPS"),
- placement: "right",
- persistent: false,
- teleported: ""
- }, {
- default: withCtx(() => [
- createVNode(_component_el_icon, { color: "#409EFF" }, {
- default: withCtx(() => [
- createVNode(unref(info_filled_default))
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["content"])
- ])
- ]),
- _: 1
- }),
- createVNode(_component_el_input, {
- modelValue: batchRenameMatch.value,
- "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => batchRenameMatch.value = $event),
- placeholder: unref(T)("MANAGE_BUCKET_RENAME_FILE_INPUT_A_PLACEHOLDER"),
- clearable: ""
- }, null, 8, ["modelValue", "placeholder"]),
- createVNode(_component_el_link, {
- underline: false,
- style: { "margin-bottom": "10px", "margin-top": "10px" }
- }, {
- default: withCtx(() => [
- createBaseVNode("span", null, [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_RENAME_FILE_INPUT_B")) + " ", 1),
- createVNode(_component_el_popover, {
- effect: "light",
- placement: "right",
- width: "280",
- persistent: false,
- teleported: ""
- }, {
- reference: withCtx(() => [
- createVNode(_component_el_icon, { color: "#409EFF" }, {
- default: withCtx(() => [
- createVNode(unref(info_filled_default))
- ]),
- _: 1
- })
- ]),
- default: withCtx(() => [
- createVNode(_component_el_descriptions, {
- column: 1,
- style: { "width": "250px" },
- border: ""
- }, {
- default: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(customRenameFormatTable), (item, index) => {
- return openBlock(), createBlock(_component_el_descriptions_item, {
- key: index,
- label: item.placeholder,
- align: "center",
- "label-style": "width: 100px;"
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(item.description), 1)
- ]),
- _: 2
- }, 1032, ["label"]);
- }), 128)),
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(customRenameFormatTable).slice(0, unref(customRenameFormatTable).length - 1), (item, index) => {
- return openBlock(), createBlock(_component_el_descriptions_item, {
- key: index,
- label: item.placeholderB,
- align: "center",
- "label-style": "width: 100px;"
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(item.descriptionB), 1)
- ]),
- _: 2
- }, 1032, ["label"]);
- }), 128)),
- createVNode(_component_el_descriptions_item, {
- label: "{auto}",
- align: "center",
- "label-style": "width: 100px;"
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_RENAME_FILE_TABLE_IID")), 1)
- ]),
- _: 1
- })
- ]),
- _: 1
- })
- ]),
- _: 1
- })
- ])
- ]),
- _: 1
- }),
- createVNode(_component_el_input, {
- modelValue: batchRenameReplace.value,
- "onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => batchRenameReplace.value = $event),
- placeholder: "Ex. {Y}-{m}-{uuid}",
- clearable: ""
- }, null, 8, ["modelValue"]),
- createBaseVNode("div", _hoisted_6, [
- createVNode(_component_el_button, {
- type: "danger",
- style: { "margin-right": "30px" },
- plain: "",
- icon: unref(close_default),
- onClick: _cache[17] || (_cache[17] = () => {
- isShowBatchRenameDialog.value = false;
- })
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_RENAME_FILE_CANCEL")), 1)
- ]),
- _: 1
- }, 8, ["icon"]),
- createVNode(_component_el_button, {
- type: "primary",
- plain: "",
- icon: unref(edit_default),
- onClick: _cache[18] || (_cache[18] = ($event) => handleBatchRename())
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_BUCKET_RENAME_FILE_CONFIRM")), 1)
- ]),
- _: 1
- }, 8, ["icon"])
- ])
- ]),
- _: 1
- }, 8, ["modelValue", "title"])
- ], 4);
- };
- }
-});
-export {
- _sfc_main as default
-};
diff --git a/dist/renderer/assets/ImageProcessSetting.vue_vue_type_script_setup_true_lang-DFtMAQE7.js b/dist/renderer/assets/ImageProcessSetting.vue_vue_type_script_setup_true_lang-DFtMAQE7.js
deleted file mode 100644
index c1b6b151..00000000
--- a/dist/renderer/assets/ImageProcessSetting.vue_vue_type_script_setup_true_lang-DFtMAQE7.js
+++ /dev/null
@@ -1,589 +0,0 @@
-import { d as defineComponent, aw as useModel, T, a as reactive, r as ref, o as onBeforeMount, N as createBlock, e as openBlock, v as withCtx, q as createVNode, w as withDirectives, y as resolveComponent, u as unref, f as createBaseVNode, t as toDisplayString, ac as vShow, B as createTextVNode, c as createElementBlock, F as Fragment, h as renderList, af as saveConfig, bd as toRaw, p as configPaths, k as getConfig } from "./index-BqdcQlNn.js";
-const _hoisted_1 = { class: "text-xs text-gray-500" };
-const switchStyle = "--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949;";
-const _sfc_main = /* @__PURE__ */ defineComponent({
- __name: "ImageProcessSetting",
- props: {
- "modelValue": { type: Boolean },
- "modelModifiers": {}
- },
- emits: ["update:modelValue"],
- setup(__props) {
- const imageProcessDialogVisible = useModel(__props, "modelValue");
- const waterMarkPositionMap = /* @__PURE__ */ new Map([
- ["north", T("UPLOAD_PAGE_IMAGE_PROCESS_POSITION_TOP")],
- ["northeast", T("UPLOAD_PAGE_IMAGE_PROCESS_POSITION_TOP_RIGHT")],
- ["southeast", T("UPLOAD_PAGE_IMAGE_PROCESS_POSITION_BOTTOM_RIGHT")],
- ["south", T("UPLOAD_PAGE_IMAGE_PROCESS_POSITION_BOTTOM")],
- ["southwest", T("UPLOAD_PAGE_IMAGE_PROCESS_POSITION_BOTTOM_LEFT")],
- ["northwest", T("UPLOAD_PAGE_IMAGE_PROCESS_POSITION_TOP_LEFT")],
- ["west", T("UPLOAD_PAGE_IMAGE_PROCESS_POSITION_LEFT")],
- ["east", T("UPLOAD_PAGE_IMAGE_PROCESS_POSITION_RIGHT")],
- ["centre", T("UPLOAD_PAGE_IMAGE_PROCESS_POSITION_CENTER")]
- ]);
- const imageExtList = ["jpg", "jpeg", "png", "webp", "bmp", "tiff", "tif", "svg", "ico", "avif", "heif", "heic"];
- const availableFormat = [
- "avif",
- "dz",
- "fits",
- "gif",
- "heif",
- "input",
- "jpeg",
- "jpg",
- "jp2",
- "jxl",
- "magick",
- "openslide",
- "pdf",
- "png",
- "ppm",
- "raw",
- "svg",
- "tiff",
- "tif",
- "v",
- "webp"
- ];
- const waterMarkForm = reactive({
- isAddWatermark: false,
- watermarkType: "text",
- isFullScreenWatermark: false,
- watermarkDegree: 0,
- watermarkText: "",
- watermarkFontPath: "",
- watermarkScaleRatio: 0.15,
- watermarkColor: "#CCCCCC73",
- watermarkImagePath: "",
- watermarkPosition: "southeast"
- });
- const compressForm = reactive({
- quality: 100,
- isConvert: false,
- convertFormat: "jpg",
- isReSize: false,
- reSizeWidth: 500,
- reSizeHeight: 500,
- skipReSizeOfSmallImg: false,
- isReSizeByPercent: false,
- reSizePercent: 50,
- isRotate: false,
- rotateDegree: 0,
- isRemoveExif: false,
- isFlip: false,
- isFlop: false
- });
- const formatConvertObj = ref("{}");
- const skipProcessForm = reactive({
- skipProcessExtList: "zip,rar,7z,tar,gz,tar.gz,tar.bz2,tar.xz"
- });
- const waterMarkFormKeys = Object.keys(waterMarkForm);
- const compressFormKeys = Object.keys(compressForm);
- const skipProcessFormKeys = Object.keys(skipProcessForm);
- function handleSaveConfig() {
- let iformatConvertObj = {};
- try {
- iformatConvertObj = JSON.parse(formatConvertObj.value);
- } catch (error) {
- }
- const formatConvertObjEntries = Object.entries(iformatConvertObj);
- const formatConvertObjEntriesFilter = formatConvertObjEntries.filter((item) => {
- return imageExtList.includes(item[0]) && availableFormat.includes(item[1]);
- });
- const formatConvertObjFilter = Object.fromEntries(formatConvertObjEntriesFilter);
- formatConvertObj.value = JSON.stringify(formatConvertObjFilter);
- compressForm.formatConvertObj = formatConvertObjFilter;
- saveConfig(configPaths.buildIn.compress, toRaw(compressForm));
- saveConfig(configPaths.buildIn.watermark, toRaw(waterMarkForm));
- saveConfig(configPaths.buildIn.skipProcess, toRaw(skipProcessForm));
- closeDialog();
- }
- async function initData() {
- const compress = await getConfig(configPaths.buildIn.compress);
- const watermark = await getConfig(configPaths.buildIn.watermark);
- const skipProcess = await getConfig(configPaths.buildIn.skipProcess);
- if (compress) {
- compressFormKeys.forEach((key) => {
- compressForm[key] = compress[key] ?? compressForm[key];
- });
- try {
- if (typeof compress.formatConvertObj === "object") {
- formatConvertObj.value = JSON.stringify(compress.formatConvertObj);
- } else {
- formatConvertObj.value = compress.formatConvertObj ?? "{}";
- }
- } catch (error) {
- formatConvertObj.value = "{}";
- }
- }
- if (watermark) {
- waterMarkFormKeys.forEach((key) => {
- waterMarkForm[key] = watermark[key] ?? waterMarkForm[key];
- });
- waterMarkForm.watermarkColor = watermark.watermarkColor === "" ? "#CCCCCC73" : watermark.watermarkColor;
- }
- if (skipProcess) {
- skipProcessFormKeys.forEach((key) => {
- skipProcessForm[key] = skipProcess[key] ?? skipProcessForm[key];
- });
- }
- }
- function closeDialog() {
- imageProcessDialogVisible.value = false;
- }
- onBeforeMount(async () => {
- await initData();
- });
- return (_ctx, _cache) => {
- const _component_el_input = resolveComponent("el-input");
- const _component_el_form_item = resolveComponent("el-form-item");
- const _component_el_switch = resolveComponent("el-switch");
- const _component_el_radio = resolveComponent("el-radio");
- const _component_el_radio_group = resolveComponent("el-radio-group");
- const _component_el_input_number = resolveComponent("el-input-number");
- const _component_el_color_picker = resolveComponent("el-color-picker");
- const _component_el_option = resolveComponent("el-option");
- const _component_el_select = resolveComponent("el-select");
- const _component_el_button = resolveComponent("el-button");
- const _component_el_form = resolveComponent("el-form");
- return openBlock(), createBlock(_component_el_form, {
- "label-position": "top",
- "require-asterisk-position": "right",
- "label-width": "10vw",
- size: "default",
- model: waterMarkForm
- }, {
- default: withCtx(() => [
- createVNode(_component_el_form_item, {
- label: unref(T)("UPLOAD_PAGE_IMAGE_PROCESS_SKIP_PROCESS_EXT_LIST")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: skipProcessForm.skipProcessExtList,
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => skipProcessForm.skipProcessExtList = $event),
- type: "textarea",
- autosize: { minRows: 2, maxRows: 4 }
- }, null, 8, ["modelValue"]),
- createBaseVNode("div", _hoisted_1, toDisplayString(unref(T)("UPLOAD_PAGE_IMAGE_PROCESS_SKIP_PROCESS_EXT_LIST_TIPS")), 1)
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("UPLOAD_PAGE_IMAGE_PROCESS_ISADDWM")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: waterMarkForm.isAddWatermark,
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => waterMarkForm.isAddWatermark = $event),
- style: switchStyle
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- }, 8, ["label"]),
- withDirectives(createVNode(_component_el_form_item, {
- label: unref(T)("UPLOAD_PAGE_IMAGE_PROCESS_WMTYPE")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_radio_group, {
- modelValue: waterMarkForm.watermarkType,
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => waterMarkForm.watermarkType = $event)
- }, {
- default: withCtx(() => [
- createVNode(_component_el_radio, { value: "text" }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("UPLOAD_PAGE_IMAGE_PROCESS_WMTYPE_TEXT")), 1)
- ]),
- _: 1
- }),
- createVNode(_component_el_radio, { value: "image" }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("UPLOAD_PAGE_IMAGE_PROCESS_WMTYPE_IMAGE")), 1)
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["modelValue"])
- ]),
- _: 1
- }, 8, ["label"]), [
- [vShow, waterMarkForm.isAddWatermark]
- ]),
- withDirectives(createVNode(_component_el_form_item, {
- label: unref(T)("UPLOAD_PAGE_IMAGE_PROCESS_ISFULLSCREEN_WM")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: waterMarkForm.isFullScreenWatermark,
- "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => waterMarkForm.isFullScreenWatermark = $event),
- style: switchStyle
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- }, 8, ["label"]), [
- [vShow, waterMarkForm.isAddWatermark]
- ]),
- withDirectives(createVNode(_component_el_form_item, {
- label: unref(T)("UPLOAD_PAGE_IMAGE_PROCESS_WMDEGREE")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input_number, {
- modelValue: waterMarkForm.watermarkDegree,
- "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => waterMarkForm.watermarkDegree = $event),
- step: 1
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- }, 8, ["label"]), [
- [vShow, waterMarkForm.isAddWatermark]
- ]),
- withDirectives(createVNode(_component_el_form_item, {
- label: unref(T)("UPLOAD_PAGE_IMAGE_PROCESS_WMTEXT")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: waterMarkForm.watermarkText,
- "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => waterMarkForm.watermarkText = $event)
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- }, 8, ["label"]), [
- [vShow, waterMarkForm.isAddWatermark && waterMarkForm.watermarkType === "text"]
- ]),
- withDirectives(createVNode(_component_el_form_item, {
- label: unref(T)("UPLOAD_PAGE_IMAGE_PROCESS_WMTEXT_FONT_PATH")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: waterMarkForm.watermarkFontPath,
- "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => waterMarkForm.watermarkFontPath = $event)
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- }, 8, ["label"]), [
- [vShow, waterMarkForm.isAddWatermark && waterMarkForm.watermarkType === "text"]
- ]),
- withDirectives(createVNode(_component_el_form_item, {
- label: unref(T)("UPLOAD_PAGE_IMAGE_PROCESS_WMRATIO")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input_number, {
- modelValue: waterMarkForm.watermarkScaleRatio,
- "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => waterMarkForm.watermarkScaleRatio = $event),
- min: 0,
- max: 1,
- step: 0.01
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- }, 8, ["label"]), [
- [vShow, waterMarkForm.isAddWatermark]
- ]),
- withDirectives(createVNode(_component_el_form_item, {
- label: unref(T)("UPLOAD_PAGE_IMAGE_PROCESS_WMCOLOR")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_color_picker, {
- modelValue: waterMarkForm.watermarkColor,
- "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => waterMarkForm.watermarkColor = $event),
- "show-alpha": ""
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- }, 8, ["label"]), [
- [vShow, waterMarkForm.isAddWatermark && waterMarkForm.watermarkType === "text"]
- ]),
- withDirectives(createVNode(_component_el_form_item, {
- label: unref(T)("UPLOAD_PAGE_IMAGE_PROCESS_WMPATH")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: waterMarkForm.watermarkImagePath,
- "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => waterMarkForm.watermarkImagePath = $event)
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- }, 8, ["label"]), [
- [vShow, waterMarkForm.isAddWatermark && waterMarkForm.watermarkType === "image"]
- ]),
- withDirectives(createVNode(_component_el_form_item, {
- label: unref(T)("UPLOAD_PAGE_IMAGE_PROCESS_WMPOSITION")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_radio_group, {
- modelValue: waterMarkForm.watermarkPosition,
- "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => waterMarkForm.watermarkPosition = $event)
- }, {
- default: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(waterMarkPositionMap), (item) => {
- return openBlock(), createBlock(_component_el_radio, {
- key: item[0],
- value: item[0]
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(item[1]), 1)
- ]),
- _: 2
- }, 1032, ["value"]);
- }), 128))
- ]),
- _: 1
- }, 8, ["modelValue"])
- ]),
- _: 1
- }, 8, ["label"]), [
- [vShow, waterMarkForm.isAddWatermark]
- ]),
- createVNode(_component_el_form_item, {
- label: unref(T)("UPLOAD_PAGE_IMAGE_PROCESS_ISREMOVEEXIF")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: compressForm.isRemoveExif,
- "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => compressForm.isRemoveExif = $event),
- style: switchStyle
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("UPLOAD_PAGE_IMAGE_PROCESS_QUALITY")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input_number, {
- modelValue: compressForm.quality,
- "onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => compressForm.quality = $event),
- min: 1,
- max: 100,
- step: 1
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("UPLOAD_PAGE_IMAGE_PROCESS_ISCONVERT")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: compressForm.isConvert,
- "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => compressForm.isConvert = $event),
- style: switchStyle
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- }, 8, ["label"]),
- withDirectives(createVNode(_component_el_form_item, {
- label: unref(T)("UPLOAD_PAGE_IMAGE_PROCESS_CONVERTFORMAT")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_select, {
- modelValue: compressForm.convertFormat,
- "onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => compressForm.convertFormat = $event),
- persistent: false,
- teleported: ""
- }, {
- default: withCtx(() => [
- (openBlock(), createElementBlock(Fragment, null, renderList(availableFormat, (item) => {
- return createVNode(_component_el_option, {
- key: item,
- label: item,
- value: item
- }, null, 8, ["label", "value"]);
- }), 64))
- ]),
- _: 1
- }, 8, ["modelValue"])
- ]),
- _: 1
- }, 8, ["label"]), [
- [vShow, compressForm.isConvert]
- ]),
- withDirectives(createVNode(_component_el_form_item, {
- label: unref(T)("UPLOAD_PAGE_IMAGE_PROCESS_CONVERTFORMAT_SPECIFIC")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: formatConvertObj.value,
- "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => formatConvertObj.value = $event),
- placeholder: '{"jpg": "png", "png": "jpg"}',
- type: "textarea",
- autosize: { minRows: 2, maxRows: 4 }
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- }, 8, ["label"]), [
- [vShow, compressForm.isConvert]
- ]),
- createVNode(_component_el_form_item, {
- label: unref(T)("UPLOAD_PAGE_IMAGE_PROCESS_ISFLIP")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: compressForm.isFlip,
- "onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => compressForm.isFlip = $event),
- style: switchStyle
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("UPLOAD_PAGE_IMAGE_PROCESS_ISFLOP")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: compressForm.isFlop,
- "onUpdate:modelValue": _cache[17] || (_cache[17] = ($event) => compressForm.isFlop = $event),
- style: switchStyle
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("UPLOAD_PAGE_IMAGE_PROCESS_ISRESIZE")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: compressForm.isReSize,
- "onUpdate:modelValue": _cache[18] || (_cache[18] = ($event) => compressForm.isReSize = $event),
- style: switchStyle
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- }, 8, ["label"]),
- withDirectives(createVNode(_component_el_form_item, {
- label: unref(T)("UPLOAD_PAGE_IMAGE_PROCESS_RESIZEWIDTH")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input_number, {
- modelValue: compressForm.reSizeWidth,
- "onUpdate:modelValue": _cache[19] || (_cache[19] = ($event) => compressForm.reSizeWidth = $event),
- min: 0
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- }, 8, ["label"]), [
- [vShow, compressForm.isReSize]
- ]),
- withDirectives(createVNode(_component_el_form_item, {
- label: unref(T)("UPLOAD_PAGE_IMAGE_PROCESS_RESIZEHEIGHT")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input_number, {
- modelValue: compressForm.reSizeHeight,
- "onUpdate:modelValue": _cache[20] || (_cache[20] = ($event) => compressForm.reSizeHeight = $event),
- min: 0
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- }, 8, ["label"]), [
- [vShow, compressForm.isReSize]
- ]),
- withDirectives(createVNode(_component_el_form_item, {
- label: unref(T)("UPLOAD_PAGE_IMAGE_PROCESS_SKIPRESIZEOfSMALLIMG_HEIGHT")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: compressForm.skipReSizeOfSmallImg,
- "onUpdate:modelValue": _cache[21] || (_cache[21] = ($event) => compressForm.skipReSizeOfSmallImg = $event),
- style: switchStyle
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- }, 8, ["label"]), [
- [vShow, compressForm.isReSize && compressForm.reSizeHeight > 0 && compressForm.reSizeWidth === 0]
- ]),
- withDirectives(createVNode(_component_el_form_item, {
- label: unref(T)("UPLOAD_PAGE_IMAGE_PROCESS_SKIPRESIZEOfSMALLIMG_WIDTH")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: compressForm.skipReSizeOfSmallImg,
- "onUpdate:modelValue": _cache[22] || (_cache[22] = ($event) => compressForm.skipReSizeOfSmallImg = $event),
- style: switchStyle
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- }, 8, ["label"]), [
- [vShow, compressForm.isReSize && compressForm.reSizeWidth > 0 && compressForm.reSizeHeight === 0]
- ]),
- createVNode(_component_el_form_item, {
- label: unref(T)("UPLOAD_PAGE_IMAGE_PROCESS_ISRESIZEBYPERCENT")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: compressForm.isReSizeByPercent,
- "onUpdate:modelValue": _cache[23] || (_cache[23] = ($event) => compressForm.isReSizeByPercent = $event),
- style: switchStyle
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- }, 8, ["label"]),
- withDirectives(createVNode(_component_el_form_item, {
- label: unref(T)("UPLOAD_PAGE_IMAGE_PROCESS_RESIZEPERCENT")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input_number, {
- modelValue: compressForm.reSizePercent,
- "onUpdate:modelValue": _cache[24] || (_cache[24] = ($event) => compressForm.reSizePercent = $event),
- min: 0
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- }, 8, ["label"]), [
- [vShow, compressForm.isReSizeByPercent]
- ]),
- createVNode(_component_el_form_item, {
- label: unref(T)("UPLOAD_PAGE_IMAGE_PROCESS_ISROTATE")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: compressForm.isRotate,
- "onUpdate:modelValue": _cache[25] || (_cache[25] = ($event) => compressForm.isRotate = $event),
- style: switchStyle
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- }, 8, ["label"]),
- withDirectives(createVNode(_component_el_form_item, {
- label: unref(T)("UPLOAD_PAGE_IMAGE_PROCESS_ROTATEDEGREE")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input_number, {
- modelValue: compressForm.rotateDegree,
- "onUpdate:modelValue": _cache[26] || (_cache[26] = ($event) => compressForm.rotateDegree = $event),
- step: 1
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- }, 8, ["label"]), [
- [vShow, compressForm.isRotate]
- ]),
- createVNode(_component_el_form_item, null, {
- default: withCtx(() => [
- createVNode(_component_el_button, {
- type: "primary",
- onClick: handleSaveConfig
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("UPLOAD_PAGE_IMAGE_PROCESS_CONFIRM")), 1)
- ]),
- _: 1
- }),
- createVNode(_component_el_button, { onClick: closeDialog }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("UPLOAD_PAGE_IMAGE_PROCESS_CANCEL")), 1)
- ]),
- _: 1
- })
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["model"]);
- };
- }
-});
-export {
- _sfc_main as _
-};
diff --git a/dist/renderer/assets/LogInPage-BpIsfGOe.css b/dist/renderer/assets/LogInPage-BpIsfGOe.css
deleted file mode 100644
index b72de10a..00000000
--- a/dist/renderer/assets/LogInPage-BpIsfGOe.css
+++ /dev/null
@@ -1,13 +0,0 @@
-.layout {
- background-color: #fff;
- position: absolute;
- left: 162px;
- right: 0;
-}
-.layout.el-tabs {
- border: 0;
- border-style: none;
-}
-.loginpage:hover {
- background-color: Beige;
-}
diff --git a/dist/renderer/assets/LogInPage-KS3NYFdk.js b/dist/renderer/assets/LogInPage-KS3NYFdk.js
deleted file mode 100644
index d8855064..00000000
--- a/dist/renderer/assets/LogInPage-KS3NYFdk.js
+++ /dev/null
@@ -1,896 +0,0 @@
-import { d as defineComponent, r as ref, a as reactive, am as computed, M as onMounted, c as createElementBlock, e as openBlock, q as createVNode, v as withCtx, y as resolveComponent, k as getConfig$1, u as unref, T, F as Fragment, h as renderList, N as createBlock, f as createBaseVNode, B as createTextVNode, t as toDisplayString, aZ as pointer_default, a_ as delete_default, g as createCommentVNode, a8 as info_filled_default, aJ as edit_default, J as ElMessage, au as ElNotification, ae as ElMessageBox, Q as useRouter } from "./index-BqdcQlNn.js";
-import { u as useManageStore } from "./manageStore-EteLCVxq.js";
-import { h as formObjToTableData } from "./common-REXFY3_s.js";
-import { s as supportedPicBedList } from "./constants-BZfYqEeL.js";
-import { g as getConfig, s as saveConfig, r as removeConfig } from "./dataSender-Bg45AIFL.js";
-import { f as formatEndpoint, a as isNeedToShorten, s as safeSliceF } from "./common-DNjr697i.js";
-const _hoisted_1 = { class: "layout" };
-const _hoisted_2 = ["src"];
-const _hoisted_3 = ["onClick"];
-const _hoisted_4 = { style: { "margin": "0 auto", "position": "relative", "left": "10%", "right": "50%" } };
-const _sfc_main = /* @__PURE__ */ defineComponent({
- __name: "LogInPage",
- setup(__props) {
- const manageStore = useManageStore();
- const router = useRouter();
- const activeName = ref("login");
- const configResult = reactive({});
- const existingConfiguration = reactive({});
- const dataForTable = reactive([]);
- const allConfigAliasMap = reactive({});
- const currentAliasList = reactive([]);
- const rules = ruleMap(supportedPicBedList);
- const sortedAllConfigAliasMap = computed(() => {
- return Object.values(allConfigAliasMap).sort((a, b) => {
- return a.picBedName.localeCompare(b.picBedName);
- });
- });
- const importedNewConfig = {};
- function ruleMap(options) {
- const rule = {};
- Object.keys(options).forEach((key) => {
- const item = options[key].options;
- item.forEach((option) => {
- const configOptions = options[key].configOptions[option];
- const keyName = `${key}.${option}`;
- if (configOptions.rule) {
- rule[keyName] = configOptions.rule;
- }
- if (configOptions.default) {
- configResult[keyName] = configOptions.default;
- }
- });
- });
- return rule;
- }
- function getDataForTable() {
- for (const key in existingConfiguration) {
- dataForTable.push({ ...existingConfiguration[key] });
- }
- }
- async function getExistingConfig(name) {
- if (name === "login") {
- getAllConfigAliasArray();
- return;
- }
- currentAliasList.length = 0;
- const result = await getConfig("picBed");
- for (const key in existingConfiguration) {
- delete existingConfiguration[key];
- }
- if (!result || typeof result !== "object" || Object.keys(result).length === 0) {
- existingConfiguration[name] = { fail: "暂无配置" };
- } else {
- for (const key in result) {
- if (result[key].picBedName === name) {
- existingConfiguration[key] = result[key];
- currentAliasList.push(key);
- }
- }
- }
- dataForTable.length = 0;
- getDataForTable();
- handleConfigImport(currentAliasList[0]);
- }
- function getAliasList() {
- return Object.values(existingConfiguration).map((item) => item.alias);
- }
- async function handleConfigChange(name) {
- const aliasList = getAliasList();
- const allKeys = Object.keys(supportedPicBedList[name].configOptions);
- const resultMap = {};
- const reg = /^[\p{Unified_Ideograph}_a-zA-Z0-9-]+$/u;
- for (const key of allKeys) {
- const resultKey = name + "." + key;
- if (supportedPicBedList[name].configOptions[key].required) {
- if (supportedPicBedList[name].configOptions[key].type !== "boolean" && !configResult[resultKey]) {
- ElMessage.error(
- `${T("MANAGE_LOGIN_PAGE_PANE_CONFIG_CHANGE_MESSAGE_A")} ${supportedPicBedList[name].configOptions[key].description}`
- );
- return;
- }
- }
- if (key === "alias" && configResult[resultKey] !== void 0 && !reg.test(configResult[resultKey])) {
- ElMessage.error(T("MANAGE_LOGIN_PAGE_PANE_CONFIG_CHANGE_ALIAS_MESSAGE"));
- return;
- }
- if (key === "itemsPerPage" && configResult[resultKey] !== void 0 && (configResult[resultKey] < 20 || configResult[resultKey] > 1e3)) {
- ElMessage.error(T("MANAGE_LOGIN_PAGE_PANE_CONFIG_CHANGE_ITEMS_PER_PAGE_MESSAGE"));
- return;
- }
- if (key === "customUrl" && configResult[resultKey] !== void 0 && configResult[resultKey] !== "") {
- if (name !== "upyun") {
- if (!/^https?:\/\//.test(configResult[resultKey])) {
- ElMessage.error(T("MANAGE_LOGIN_PAGE_PANE_CONFIG_CHANGE_CUSTOM_URL_MESSAGE"));
- return;
- }
- }
- }
- if (supportedPicBedList[name].configOptions[key].default !== void 0 && configResult[resultKey] === "") {
- resultMap[key] = supportedPicBedList[name].configOptions[key].default;
- } else if (configResult[resultKey] === void 0) {
- if (supportedPicBedList[name].configOptions[key].default !== void 0) {
- resultMap[key] = supportedPicBedList[name].configOptions[key].default;
- } else {
- resultMap[key] = "";
- }
- } else {
- resultMap[key] = configResult[resultKey];
- }
- }
- resultMap.picBedName = name;
- if (resultMap.bucketName !== void 0) {
- resultMap.transformedConfig = {};
- const bucketName = resultMap.bucketName.split(",");
- const baseDir = resultMap.baseDir?.split(",");
- const area = resultMap.area?.split(",");
- const customUrl = resultMap.customUrl?.split(",");
- const operator = resultMap.operator?.split(",");
- const password = resultMap.password?.split(",");
- for (let i = 0; i < bucketName.length; i++) {
- if (bucketName[i]) {
- resultMap.transformedConfig = {
- ...resultMap.transformedConfig,
- [bucketName[i]]: {
- baseDir: baseDir && baseDir[i] ? baseDir[i] : "/",
- area: area && area[i] ? area[i] : "",
- customUrl: customUrl && customUrl[i] ? /^https?:\/\//.test(customUrl[i]) ? customUrl[i] : "http://" + customUrl[i] : "",
- operator: operator && operator[i] ? operator[i] : "",
- password: password && password[i] ? password[i] : ""
- }
- };
- }
- }
- }
- if (resultMap.transformedConfig) {
- resultMap.transformedConfig = JSON.stringify(resultMap.transformedConfig);
- }
- saveConfig(`picBed.${resultMap.alias}`, resultMap);
- await manageStore.refreshConfig();
- await getExistingConfig(activeName.value);
- dataForTable.length = 0;
- getDataForTable();
- if (aliasList.includes(resultMap.alias)) {
- ElNotification({
- title: T("MANAGE_LOGIN_PAGE_PANE_CONFIG_CHANGE_NOTICE_NAME"),
- message: `${T("MANAGE_LOGIN_PAGE_PANE_CONFIG_CHANGE_NOTICE_MESSAGE")}${resultMap.alias}`,
- type: "warning",
- duration: 500,
- customClass: "notification",
- offset: 100
- });
- } else {
- ElNotification({
- title: T("MANAGE_LOGIN_PAGE_PANE_CONFIG_CHANGE_NOTICE_NAME"),
- message: `${T("MANAGE_LOGIN_PAGE_PANE_CONFIG_CHANGE_NOTICE_MESSAGE_B")}${resultMap.alias}`,
- type: "success",
- duration: 2e3,
- customClass: "notification",
- offset: 100
- });
- }
- }
- const handleConfigReset = (name) => {
- const keys = Object.keys(configResult).filter((key) => key.startsWith(name));
- keys.forEach((key) => {
- const optionKey = key.split(".")[1];
- const configOption = supportedPicBedList[name]?.configOptions?.[optionKey];
- if (configOption) {
- configResult[key] = configOption.default || "";
- }
- });
- };
- const handleConfigRemove = (name) => {
- ElMessageBox.confirm(
- T("MANAGE_LOGIN_PAGE_PANE_DELETE_CONFIG_TITLE"),
- T("MANAGE_LOGIN_PAGE_PANE_DELETE_CONFIG_TIP"),
- {
- confirmButtonText: T("MANAGE_LOGIN_PAGE_PANE_DELETE_CONFIG_CONFIRM"),
- cancelButtonText: T("MANAGE_LOGIN_PAGE_PANE_DELETE_CONFIG_CANCEL"),
- type: "warning"
- }
- ).then(async () => {
- const commonNoticeConfig = {
- title: T("MANAGE_LOGIN_PAGE_PANE_CONFIG_CHANGE_NOTICE_NAME"),
- duration: 2e3,
- customClass: "notification",
- offset: 100
- };
- try {
- removeConfig("picBed", name);
- ElNotification({
- ...commonNoticeConfig,
- message: `${T("MANAGE_LOGIN_PAGE_PANE_CONFIG_CHANGE_NOTICE_MESSAGE_C")}${name}`,
- type: "success",
- position: "bottom-right"
- });
- manageStore.refreshConfig();
- getAllConfigAliasArray();
- } catch (error) {
- ElNotification({
- ...commonNoticeConfig,
- message: `${T("MANAGE_LOGIN_PAGE_PANE_CONFIG_CHANGE_NOTICE_MESSAGE_D")}${name}${T("MANAGE_LOGIN_PAGE_PANE_CONFIG_CHANGE_NOTICE_MESSAGE_E")}`,
- type: "error",
- position: "bottom-right"
- });
- }
- });
- };
- const getAllConfigAliasArray = async () => {
- const result = await getConfig("picBed");
- for (const key in allConfigAliasMap) {
- delete allConfigAliasMap[key];
- }
- if (!result) return;
- Object.entries(result).forEach(([, value], index) => {
- allConfigAliasMap[index] = {
- alias: value.alias,
- picBedName: value.picBedName,
- config: value
- };
- });
- };
- const handleCellClick = (row, column) => {
- navigator.clipboard.writeText(row[column.property]);
- ElMessage.success(`${T("MANAGE_LOGIN_PAGE_PANE_CONFIG_CHANGE_COPY_SUCCESS")}${row[column.property]}`);
- };
- const handleReferenceClick = (url) => window.electron.shell.openExternal(url);
- const handleConfigClick = async (item) => {
- const alias = item.alias;
- const config = JSON.stringify(item.config);
- const picBedName = item.picBedName;
- const result = await getConfig("picBed");
- router.push({
- path: "/main-page/manage-main-page",
- query: {
- alias,
- picBedName,
- config,
- allPicBedConfigure: JSON.stringify(result)
- }
- });
- };
- function handleConfigImport(alias) {
- const selectedConfig = existingConfiguration[alias];
- if (!selectedConfig) return;
- supportedPicBedList[selectedConfig.picBedName].options.forEach((option) => {
- if (selectedConfig[option] !== void 0) {
- configResult[selectedConfig.picBedName + "." + option] = selectedConfig[option];
- }
- });
- }
- async function getCurrentConfigList() {
- await manageStore.refreshConfig();
- const configList = await getConfig$1("uploader") ?? {};
- const pbList = [
- "aliyun",
- "aws-s3",
- "aws-s3-plist",
- "github",
- "imgur",
- "local",
- "qiniu",
- "sftpplist",
- "smms",
- "tcyun",
- "upyun",
- "webdavplist"
- ];
- const filteredConfigList = pbList.flatMap((pb) => {
- const config = configList[pb];
- return config?.configList?.length ? config.configList.map((item) => ({ ...item, type: pb })) : [];
- });
- const autoImport = await getConfig$1("settings.autoImport") || false;
- if (autoImport) {
- const autoImportPicBed = initArray(
- await getConfig$1("settings.autoImportPicBed") || "",
- []
- );
- await Promise.all(filteredConfigList.flatMap((config) => transUpToManage(config, config.type, autoImportPicBed)));
- if (Object.keys(importedNewConfig).length > 0) {
- const oldConfig = await getConfig("picBed");
- const newConfig = { ...oldConfig, ...importedNewConfig };
- saveConfig("picBed", newConfig);
- await manageStore.refreshConfig();
- }
- }
- await getAllConfigAliasArray();
- }
- function isImported(alias) {
- return Object.values(allConfigAliasMap).some((item) => item.alias === alias);
- }
- function initArray(arrayT, defaultValue) {
- if (!Array.isArray(arrayT)) {
- arrayT = arrayT ? [arrayT] : defaultValue;
- }
- return arrayT;
- }
- async function transUpToManage(config, picBedName, autoImportPicBed) {
- const alias = `${picBedName === "webdavplist" ? "webdav" : picBedName === "sftpplist" ? "sftp" : picBedName === "aws-s3" || picBedName === "aws-s3-plist" ? "s3plist" : picBedName}-${config._configName ?? "Default"}-imp`;
- if (!autoImportPicBed.includes(picBedName) || isImported(alias)) return;
- const commonConfig = {
- alias,
- picBedName,
- paging: true
- };
- const resultMap = {};
- switch (picBedName) {
- case "smms":
- if (!config.token) return;
- Object.assign(resultMap, {
- ...commonConfig,
- token: config.token
- });
- break;
- case "aliyun":
- if (!config.accessKeyId || !config.accessKeySecret) return;
- Object.assign(resultMap, {
- ...commonConfig,
- accessKeyId: config.accessKeyId,
- accessKeySecret: config.accessKeySecret,
- bucketName: "",
- baseDir: "/",
- itemsPerPage: 50,
- isAutoCustomUrl: !config.customUrl,
- transformedConfig: JSON.stringify(
- config.customUrl ? {
- [config.bucket]: {
- customUrl: config.customUrl
- }
- } : {}
- )
- });
- break;
- case "qiniu":
- if (!config.accessKey || !config.secretKey) return;
- Object.assign(resultMap, {
- ...commonConfig,
- accessKey: config.accessKey,
- secretKey: config.secretKey,
- bucketName: "",
- baseDir: "/",
- isAutoCustomUrl: false,
- transformedConfig: JSON.stringify({ [config.bucket]: config.url }),
- itemsPerPage: 50
- });
- break;
- case "tcyun":
- if (!config.secretId || !config.secretKey || config.version === "v4") return;
- Object.assign(resultMap, {
- ...commonConfig,
- secretId: config.secretId,
- secretKey: config.secretKey,
- bucketName: "",
- baseDir: "/",
- appId: config.appId,
- isAutoCustomUrl: !config.customUrl,
- transformedConfig: JSON.stringify(
- config.customUrl ? {
- [config.bucket]: {
- customUrl: config.customUrl
- }
- } : {}
- ),
- itemsPerPage: 50
- });
- break;
- case "github":
- if (!config.token) return;
- Object.assign(resultMap, {
- ...commonConfig,
- token: config.token,
- githubUsername: config.repo.split("/")[0],
- customUrl: "",
- proxy: "",
- itemsPerPage: 50
- });
- break;
- case "upyun":
- if (!config.operator || !config.password) return;
- Object.assign(resultMap, {
- ...commonConfig,
- operator: config.operator,
- password: config.password,
- bucketName: config.bucket,
- antiLeechToken: config.antiLeechToken,
- expireTime: config.expireTime,
- baseDir: "/",
- customUrl: config.url,
- transformedConfig: JSON.stringify({
- [config.bucket]: {
- customUrl: config.url,
- baseDir: "/",
- area: "",
- operator: config.operator,
- password: config.password
- }
- }),
- itemsPerPage: 50
- });
- break;
- case "webdavplist":
- if (!config.host) return;
- Object.assign(resultMap, {
- ...commonConfig,
- endpoint: formatEndpoint(config.host, config.sslEnabled),
- username: config.username,
- password: config.password,
- bucketName: "webdav",
- baseDir: config.path || "/",
- webPath: config.webpath || "",
- customUrl: config.customUrl || "",
- sslEnabled: !!config.sslEnabled,
- authType: config.authType || "basic",
- proxy: "",
- transformedConfig: JSON.stringify({
- webdav: {
- operator: "",
- password: config.password,
- baseDir: config.path || "/",
- customUrl: config.customUrl || "",
- area: ""
- }
- })
- });
- delete resultMap.paging;
- break;
- case "local":
- if (!config.path) return;
- Object.assign(resultMap, {
- ...commonConfig,
- baseDir: config.path,
- webPath: config.webpath || "",
- customUrl: config.customUrl || "",
- transformedConfig: JSON.stringify({
- local: {
- customUrl: config.customUrl || "",
- baseDir: config.path,
- webPath: config.webpath || ""
- }
- })
- });
- delete resultMap.paging;
- break;
- case "sftpplist":
- if (!config.host) return;
- Object.assign(resultMap, {
- ...commonConfig,
- picBedName: "sftp",
- host: config.host,
- port: config.port || 22,
- username: config.username,
- password: config.password,
- privateKey: config.privateKey,
- passphrase: config.passphrase,
- baseDir: config.uploadPath || "/",
- webPath: config.webPath || "",
- customUrl: config.customUrl || "",
- fileMode: config.fileMode || "0664",
- dirMode: config.dirMode || "0775",
- transformedConfig: JSON.stringify({
- sftp: {
- host: config.host,
- port: config.port || 22,
- username: config.username,
- password: config.password,
- privateKey: config.privateKey,
- passphrase: config.passphrase,
- baseDir: config.uploadPath || "/",
- webPath: config.webPath || "",
- customUrl: config.customUrl || "",
- fileMode: config.fileMode || "0664",
- dirMode: config.dirMode || "0775"
- }
- })
- });
- delete resultMap.paging;
- break;
- case "aws-s3":
- case "aws-s3-plist":
- if (!config.accessKeyID || !config.secretAccessKey) return;
- Object.assign(resultMap, {
- ...commonConfig,
- picBedName: "s3plist",
- accessKeyId: config.accessKeyID,
- secretAccessKey: config.secretAccessKey,
- endpoint: config.endpoint || "",
- bucketName: "",
- baseDir: "/",
- itemsPerPage: 50,
- proxy: "",
- sslEnabled: config.endpoint ? config.endpoint.startsWith("https") : false,
- aclForUpload: "public-read",
- s3ForcePathStyle: config.pathStyleAccess,
- dogeCloudSupport: false,
- transformedConfig: JSON.stringify(
- config.urlPrefix ? {
- [config.bucketName]: {
- customUrl: config.urlPrefix
- }
- } : {}
- )
- });
- break;
- case "imgur":
- if (!config.username || !config.accessToken) return;
- Object.assign(resultMap, {
- ...commonConfig,
- username: config.username,
- accessToken: config.accessToken,
- proxy: ""
- });
- delete resultMap.paging;
- break;
- default:
- return;
- }
- importedNewConfig[alias] = resultMap;
- }
- onMounted(() => {
- getCurrentConfigList();
- });
- return (_ctx, _cache) => {
- const _component_el_table_column = resolveComponent("el-table-column");
- const _component_el_table = resolveComponent("el-table");
- const _component_el_tooltip = resolveComponent("el-tooltip");
- const _component_el_button = resolveComponent("el-button");
- const _component_el_popover = resolveComponent("el-popover");
- const _component_el_button_group = resolveComponent("el-button-group");
- const _component_el_card = resolveComponent("el-card");
- const _component_el_col = resolveComponent("el-col");
- const _component_el_row = resolveComponent("el-row");
- const _component_el_tab_pane = resolveComponent("el-tab-pane");
- const _component_el_alert = resolveComponent("el-alert");
- const _component_el_icon = resolveComponent("el-icon");
- const _component_el_input = resolveComponent("el-input");
- const _component_el_switch = resolveComponent("el-switch");
- const _component_el_option = resolveComponent("el-option");
- const _component_el_select = resolveComponent("el-select");
- const _component_el_form_item = resolveComponent("el-form-item");
- const _component_el_form = resolveComponent("el-form");
- const _component_el_dropdown_item = resolveComponent("el-dropdown-item");
- const _component_el_dropdown = resolveComponent("el-dropdown");
- const _component_el_tabs = resolveComponent("el-tabs");
- return openBlock(), createElementBlock("div", _hoisted_1, [
- createVNode(_component_el_tabs, {
- modelValue: activeName.value,
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => activeName.value = $event),
- type: "border-card",
- stretch: "",
- style: { "height": "calc(100vh - 50px)", "width": "100%", "overflow-x": "hidden" },
- "tab-position": "left",
- lazy: "",
- onTabChange: _cache[1] || (_cache[1] = ($event) => getExistingConfig(activeName.value))
- }, {
- default: withCtx(() => [
- createVNode(_component_el_tab_pane, {
- name: "login",
- label: unref(T)("MANAGE_LOGIN_PAGE_PANE_NAME"),
- style: { "width": "100%", "overflow-y": "scroll", "height": "calc(100vh - 50px)" },
- lazy: ""
- }, {
- default: withCtx(() => [
- createVNode(_component_el_row, null, {
- default: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(sortedAllConfigAliasMap.value, (item) => {
- return openBlock(), createBlock(_component_el_col, {
- key: item,
- xs: 24,
- sm: 12,
- md: 8,
- lg: 6,
- xl: 4
- }, {
- default: withCtx(() => [
- createVNode(_component_el_card, {
- class: "box-card",
- style: { "margin": "10px 0" },
- shadow: "hover"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_popover, {
- placement: "top",
- width: 300,
- trigger: "click",
- persistent: false,
- teleported: ""
- }, {
- reference: withCtx(() => [
- createVNode(_component_el_button, { style: { "width": "100%", "text-align": "center", "overflow": "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" } }, {
- icon: withCtx(() => [
- createBaseVNode("img", {
- src: require(`./assets/${item.picBedName}.webp`),
- style: { "width": "25px", "height": "25px" }
- }, null, 8, _hoisted_2)
- ]),
- default: withCtx(() => [
- createVNode(_component_el_tooltip, {
- effect: "light",
- content: item.alias,
- placement: "top",
- disabled: !unref(isNeedToShorten)(item.alias),
- persistent: false,
- teleported: ""
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(isNeedToShorten)(item.alias) ? unref(safeSliceF)(item.alias, 17) + "..." : item.alias), 1)
- ]),
- _: 2
- }, 1032, ["content", "disabled"])
- ]),
- _: 2
- }, 1024)
- ]),
- default: withCtx(() => [
- createVNode(_component_el_table, {
- data: unref(formObjToTableData)(item.config),
- style: { "width": "100%" },
- size: "small",
- "header-cell-style": { "text-align": "center" },
- "cell-style": { "text-align": "center" }
- }, {
- default: withCtx(() => [
- createVNode(_component_el_table_column, {
- prop: "key",
- label: unref(T)("MANAGE_LOGIN_PAGE_PANE_KEY_NAME"),
- width: "100"
- }, null, 8, ["label"]),
- createVNode(_component_el_table_column, {
- prop: "value",
- label: unref(T)("MANAGE_LOGIN_PAGE_PANE_KEY_VALUE")
- }, null, 8, ["label"])
- ]),
- _: 2
- }, 1032, ["data"])
- ]),
- _: 2
- }, 1024),
- _cache[2] || (_cache[2] = createBaseVNode("br", null, null, -1)),
- _cache[3] || (_cache[3] = createBaseVNode("br", null, null, -1)),
- createVNode(_component_el_button_group, null, {
- default: withCtx(() => [
- createVNode(_component_el_button, {
- type: "primary",
- icon: unref(pointer_default),
- plain: "",
- onClick: ($event) => handleConfigClick(item)
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_LOGIN_PAGE_PANE_ENTER")), 1)
- ]),
- _: 2
- }, 1032, ["icon", "onClick"]),
- createVNode(_component_el_button, {
- type: "warning",
- icon: unref(delete_default),
- plain: "",
- onClick: ($event) => handleConfigRemove(item.alias)
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_LOGIN_PAGE_PANE_DELETE")), 1)
- ]),
- _: 2
- }, 1032, ["icon", "onClick"])
- ]),
- _: 2
- }, 1024)
- ]),
- _: 2,
- __: [2, 3]
- }, 1024)
- ]),
- _: 2
- }, 1024);
- }), 128))
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["label"]),
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(supportedPicBedList), (item) => {
- return openBlock(), createBlock(_component_el_tab_pane, {
- key: item.name,
- label: item.name,
- name: item.icon,
- class: "tab-pane",
- lazy: "",
- style: { "width": "100%", "overflow-y": "scroll", "height": "calc(100vh - 50px)" }
- }, {
- default: withCtx(() => [
- createVNode(_component_el_alert, {
- title: item.explain,
- type: "info",
- "show-icon": "",
- center: "",
- closable: false
- }, null, 8, ["title"]),
- createVNode(_component_el_alert, {
- center: "",
- closable: false
- }, {
- default: withCtx(() => [
- createBaseVNode("div", null, [
- createTextVNode(toDisplayString(item.referenceText) + " ", 1),
- createBaseVNode("a", {
- style: { "color": "blue", "cursor": "pointer" },
- onClick: ($event) => handleReferenceClick(item.refLink)
- }, toDisplayString(item.refLink), 9, _hoisted_3)
- ])
- ]),
- _: 2
- }, 1024),
- createVNode(_component_el_form, {
- "label-position": "top",
- "require-asterisk-position": "right",
- "label-width": "10vw",
- size: "default",
- rules: unref(rules),
- model: configResult
- }, {
- default: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(supportedPicBedList)[item.icon].options, (option) => {
- return openBlock(), createBlock(_component_el_form_item, {
- key: option,
- prop: item.icon + "." + option
- }, {
- label: withCtx(() => [
- createTextVNode(toDisplayString(unref(supportedPicBedList)[item.icon].configOptions[option].description) + " ", 1),
- !!unref(supportedPicBedList)[item.icon].configOptions[option].tooltip ? (openBlock(), createBlock(_component_el_tooltip, {
- key: 0,
- effect: "dark",
- content: unref(supportedPicBedList)[item.icon].configOptions[option].tooltip,
- placement: "right",
- persistent: false,
- teleported: ""
- }, {
- default: withCtx(() => [
- createVNode(_component_el_icon, { color: "#409EFF" }, {
- default: withCtx(() => [
- createVNode(unref(info_filled_default))
- ]),
- _: 1
- })
- ]),
- _: 2
- }, 1032, ["content"])) : createCommentVNode("", true)
- ]),
- default: withCtx(() => [
- unref(supportedPicBedList)[item.icon].configOptions[option].type === "string" ? (openBlock(), createBlock(_component_el_input, {
- key: 0,
- modelValue: configResult[item.icon + "." + option],
- "onUpdate:modelValue": ($event) => configResult[item.icon + "." + option] = $event,
- modelModifiers: { trim: true },
- placeholder: unref(supportedPicBedList)[item.icon].configOptions[option].placeholder,
- disabled: !!unref(supportedPicBedList)[item.icon].configOptions[option].disabled
- }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "disabled"])) : unref(supportedPicBedList)[item.icon].configOptions[option].type === "boolean" ? (openBlock(), createBlock(_component_el_switch, {
- key: 1,
- modelValue: configResult[item.icon + "." + option],
- "onUpdate:modelValue": ($event) => configResult[item.icon + "." + option] = $event,
- style: { "--el-switch-on-color": "#13ce66", "--el-switch-off-color": "#ff4949" }
- }, null, 8, ["modelValue", "onUpdate:modelValue"])) : unref(supportedPicBedList)[item.icon].configOptions[option].type === "number" ? (openBlock(), createBlock(_component_el_input, {
- key: 2,
- modelValue: configResult[item.icon + "." + option],
- "onUpdate:modelValue": ($event) => configResult[item.icon + "." + option] = $event,
- modelModifiers: { number: true },
- placeholder: unref(supportedPicBedList)[item.icon].configOptions[option].placeholder
- }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])) : unref(supportedPicBedList)[item.icon].configOptions[option].type === "select" ? (openBlock(), createBlock(_component_el_select, {
- key: 3,
- modelValue: configResult[item.icon + "." + option],
- "onUpdate:modelValue": ($event) => configResult[item.icon + "." + option] = $event,
- placeholder: unref(T)("MANAGE_LOGIN_PAGE_PANE_SELECT_PLACEHOLDER"),
- persistent: false,
- teleported: ""
- }, {
- default: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(Object.entries(unref(supportedPicBedList)[item.icon].configOptions[option].selectOptions), (i) => {
- return openBlock(), createBlock(_component_el_option, {
- key: i[0],
- label: i[1],
- value: i[0]
- }, null, 8, ["label", "value"]);
- }), 128))
- ]),
- _: 2
- }, 1032, ["modelValue", "onUpdate:modelValue", "placeholder"])) : createCommentVNode("", true)
- ]),
- _: 2
- }, 1032, ["prop"]);
- }), 128))
- ]),
- _: 2
- }, 1032, ["rules", "model"]),
- createBaseVNode("div", _hoisted_4, [
- createVNode(_component_el_dropdown, {
- "split-button": "",
- type: "success",
- style: { "margin-left": "10vw" },
- placement: "top",
- disabled: currentAliasList.length === 0,
- teleported: ""
- }, {
- dropdown: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(currentAliasList, (i) => {
- return openBlock(), createBlock(_component_el_dropdown_item, {
- key: i,
- onClick: ($event) => handleConfigImport(i)
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(i), 1)
- ]),
- _: 2
- }, 1032, ["onClick"]);
- }), 128))
- ]),
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_LOGIN_PAGE_PANE_IMPORT")) + " ", 1)
- ]),
- _: 1
- }, 8, ["disabled"]),
- createVNode(_component_el_button, {
- type: "primary",
- style: { "margin-left": "10vw" },
- icon: unref(edit_default),
- plain: "",
- onClick: ($event) => handleConfigChange(item.icon)
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_LOGIN_PAGE_PANE_SAVE")), 1)
- ]),
- _: 2
- }, 1032, ["icon", "onClick"]),
- createVNode(_component_el_button, {
- type: "danger",
- style: { "margin-left": "10vw" },
- icon: unref(delete_default),
- plain: "",
- onClick: ($event) => handleConfigReset(item.icon)
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_LOGIN_PAGE_PANE_RESET")), 1)
- ]),
- _: 2
- }, 1032, ["icon", "onClick"])
- ]),
- _cache[4] || (_cache[4] = createBaseVNode("br", null, null, -1)),
- createVNode(_component_el_alert, {
- title: unref(T)("MANAGE_LOGIN_PAGE_PANE_TABLE_TITLE"),
- type: "success",
- center: "",
- closable: false
- }, null, 8, ["title"]),
- createVNode(_component_el_table, {
- data: dataForTable,
- style: { "width": "100%", "margin-top": "10px" },
- "header-cell-style": { "text-align": "center" },
- "cell-style": { "text-align": "center" },
- onCellClick: handleCellClick
- }, {
- default: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(supportedPicBedList)[item.icon].options, (option) => {
- return openBlock(), createBlock(_component_el_table_column, {
- key: option,
- prop: option,
- label: unref(supportedPicBedList)[item.icon].configOptions[option].description,
- sortable: "",
- "show-overflow-tooltip": ""
- }, null, 8, ["prop", "label"]);
- }), 128))
- ]),
- _: 2
- }, 1032, ["data"])
- ]),
- _: 2,
- __: [4]
- }, 1032, ["label", "name"]);
- }), 128))
- ]),
- _: 1
- }, 8, ["modelValue"])
- ]);
- };
- }
-});
-export {
- _sfc_main as default
-};
diff --git a/dist/renderer/assets/Main-D3yRZ6wJ.js b/dist/renderer/assets/Main-D3yRZ6wJ.js
deleted file mode 100644
index 2c7cc1ab..00000000
--- a/dist/renderer/assets/Main-D3yRZ6wJ.js
+++ /dev/null
@@ -1,1536 +0,0 @@
-import { d as defineComponent, K as h, r as ref, L as onUpdated, M as onMounted, F as Fragment, a as reactive, o as onBeforeMount, S as SHOW_INPUT_BOX, b as onBeforeUnmount, N as createBlock, e as openBlock, v as withCtx, u as unref, T, y as resolveComponent, q as createVNode, B as createTextVNode, t as toDisplayString, C as sendToMain, O as SHOW_INPUT_BOX_RESPONSE, P as config, Q as useRouter, U as updatePicBedGlobal, V as SHOW_MAIN_PAGE_QRCODE, D as watch, W as onBeforeRouteUpdate, c as createElementBlock, f as createBaseVNode, g as createCommentVNode, H as osGlobal, s as sendRPC, j as IRPCActionType, X as arrow_up_bold_default, Y as semi_select_default, Z as arrow_down_bold_default, _ as close_bold_default, a0 as upload_filled_default, a1 as pie_chart_default, a2 as picture_filled_default, h as renderList, a3 as picBedGlobal, a4 as menu_default, a5 as tools_default, a6 as share_default, a7 as link_default, a8 as info_filled_default, a9 as Transition, aa as resolveDynamicComponent, ab as KeepAlive, w as withDirectives, ac as vShow, k as getConfig, p as configPaths, ad as II18nLanguage, ae as ElMessageBox, af as saveConfig, J as ElMessage, ag as pkg, ah as nextTick, ai as pick } from "./index-BqdcQlNn.js";
-import { e as emitter } from "./bus-BjW7Y6FA.js";
-/*!
- * qrcode.vue v3.6.0
- * A Vue.js component to generate QRCode. Both support Vue 2 and Vue 3
- * © 2017-PRESENT @scopewu(https://github.com/scopewu)
- * MIT License.
- */
-var __assign = function() {
- __assign = Object.assign || function __assign2(t) {
- for (var s, i = 1, n = arguments.length; i < n; i++) {
- s = arguments[i];
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
- }
- return t;
- };
- return __assign.apply(this, arguments);
-};
-typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
- var e = new Error(message);
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
-};
-var qrcodegen;
-(function(qrcodegen2) {
- var QrCode = (
- /** @class */
- function() {
- function QrCode2(version, errorCorrectionLevel, dataCodewords, msk) {
- this.version = version;
- this.errorCorrectionLevel = errorCorrectionLevel;
- this.modules = [];
- this.isFunction = [];
- if (version < QrCode2.MIN_VERSION || version > QrCode2.MAX_VERSION)
- throw new RangeError("Version value out of range");
- if (msk < -1 || msk > 7)
- throw new RangeError("Mask value out of range");
- this.size = version * 4 + 17;
- var row = [];
- for (var i = 0; i < this.size; i++)
- row.push(false);
- for (var i = 0; i < this.size; i++) {
- this.modules.push(row.slice());
- this.isFunction.push(row.slice());
- }
- this.drawFunctionPatterns();
- var allCodewords = this.addEccAndInterleave(dataCodewords);
- this.drawCodewords(allCodewords);
- if (msk == -1) {
- var minPenalty = 1e9;
- for (var i = 0; i < 8; i++) {
- this.applyMask(i);
- this.drawFormatBits(i);
- var penalty = this.getPenaltyScore();
- if (penalty < minPenalty) {
- msk = i;
- minPenalty = penalty;
- }
- this.applyMask(i);
- }
- }
- assert(0 <= msk && msk <= 7);
- this.mask = msk;
- this.applyMask(msk);
- this.drawFormatBits(msk);
- this.isFunction = [];
- }
- QrCode2.encodeText = function(text, ecl) {
- var segs = qrcodegen2.QrSegment.makeSegments(text);
- return QrCode2.encodeSegments(segs, ecl);
- };
- QrCode2.encodeBinary = function(data, ecl) {
- var seg = qrcodegen2.QrSegment.makeBytes(data);
- return QrCode2.encodeSegments([seg], ecl);
- };
- QrCode2.encodeSegments = function(segs, ecl, minVersion, maxVersion, mask, boostEcl) {
- if (minVersion === void 0) {
- minVersion = 1;
- }
- if (maxVersion === void 0) {
- maxVersion = 40;
- }
- if (mask === void 0) {
- mask = -1;
- }
- if (boostEcl === void 0) {
- boostEcl = true;
- }
- if (!(QrCode2.MIN_VERSION <= minVersion && minVersion <= maxVersion && maxVersion <= QrCode2.MAX_VERSION) || mask < -1 || mask > 7)
- throw new RangeError("Invalid value");
- var version;
- var dataUsedBits;
- for (version = minVersion; ; version++) {
- var dataCapacityBits_1 = QrCode2.getNumDataCodewords(version, ecl) * 8;
- var usedBits = QrSegment.getTotalBits(segs, version);
- if (usedBits <= dataCapacityBits_1) {
- dataUsedBits = usedBits;
- break;
- }
- if (version >= maxVersion)
- throw new RangeError("Data too long");
- }
- for (var _i = 0, _a = [QrCode2.Ecc.MEDIUM, QrCode2.Ecc.QUARTILE, QrCode2.Ecc.HIGH]; _i < _a.length; _i++) {
- var newEcl = _a[_i];
- if (boostEcl && dataUsedBits <= QrCode2.getNumDataCodewords(version, newEcl) * 8)
- ecl = newEcl;
- }
- var bb = [];
- for (var _b = 0, segs_1 = segs; _b < segs_1.length; _b++) {
- var seg = segs_1[_b];
- appendBits(seg.mode.modeBits, 4, bb);
- appendBits(seg.numChars, seg.mode.numCharCountBits(version), bb);
- for (var _c = 0, _d = seg.getData(); _c < _d.length; _c++) {
- var b = _d[_c];
- bb.push(b);
- }
- }
- assert(bb.length == dataUsedBits);
- var dataCapacityBits = QrCode2.getNumDataCodewords(version, ecl) * 8;
- assert(bb.length <= dataCapacityBits);
- appendBits(0, Math.min(4, dataCapacityBits - bb.length), bb);
- appendBits(0, (8 - bb.length % 8) % 8, bb);
- assert(bb.length % 8 == 0);
- for (var padByte = 236; bb.length < dataCapacityBits; padByte ^= 236 ^ 17)
- appendBits(padByte, 8, bb);
- var dataCodewords = [];
- while (dataCodewords.length * 8 < bb.length)
- dataCodewords.push(0);
- bb.forEach(function(b2, i) {
- return dataCodewords[i >>> 3] |= b2 << 7 - (i & 7);
- });
- return new QrCode2(version, ecl, dataCodewords, mask);
- };
- QrCode2.prototype.getModule = function(x, y) {
- return 0 <= x && x < this.size && 0 <= y && y < this.size && this.modules[y][x];
- };
- QrCode2.prototype.getModules = function() {
- return this.modules;
- };
- QrCode2.prototype.drawFunctionPatterns = function() {
- for (var i = 0; i < this.size; i++) {
- this.setFunctionModule(6, i, i % 2 == 0);
- this.setFunctionModule(i, 6, i % 2 == 0);
- }
- this.drawFinderPattern(3, 3);
- this.drawFinderPattern(this.size - 4, 3);
- this.drawFinderPattern(3, this.size - 4);
- var alignPatPos = this.getAlignmentPatternPositions();
- var numAlign = alignPatPos.length;
- for (var i = 0; i < numAlign; i++) {
- for (var j = 0; j < numAlign; j++) {
- if (!(i == 0 && j == 0 || i == 0 && j == numAlign - 1 || i == numAlign - 1 && j == 0))
- this.drawAlignmentPattern(alignPatPos[i], alignPatPos[j]);
- }
- }
- this.drawFormatBits(0);
- this.drawVersion();
- };
- QrCode2.prototype.drawFormatBits = function(mask) {
- var data = this.errorCorrectionLevel.formatBits << 3 | mask;
- var rem = data;
- for (var i = 0; i < 10; i++)
- rem = rem << 1 ^ (rem >>> 9) * 1335;
- var bits = (data << 10 | rem) ^ 21522;
- assert(bits >>> 15 == 0);
- for (var i = 0; i <= 5; i++)
- this.setFunctionModule(8, i, getBit(bits, i));
- this.setFunctionModule(8, 7, getBit(bits, 6));
- this.setFunctionModule(8, 8, getBit(bits, 7));
- this.setFunctionModule(7, 8, getBit(bits, 8));
- for (var i = 9; i < 15; i++)
- this.setFunctionModule(14 - i, 8, getBit(bits, i));
- for (var i = 0; i < 8; i++)
- this.setFunctionModule(this.size - 1 - i, 8, getBit(bits, i));
- for (var i = 8; i < 15; i++)
- this.setFunctionModule(8, this.size - 15 + i, getBit(bits, i));
- this.setFunctionModule(8, this.size - 8, true);
- };
- QrCode2.prototype.drawVersion = function() {
- if (this.version < 7)
- return;
- var rem = this.version;
- for (var i = 0; i < 12; i++)
- rem = rem << 1 ^ (rem >>> 11) * 7973;
- var bits = this.version << 12 | rem;
- assert(bits >>> 18 == 0);
- for (var i = 0; i < 18; i++) {
- var color = getBit(bits, i);
- var a = this.size - 11 + i % 3;
- var b = Math.floor(i / 3);
- this.setFunctionModule(a, b, color);
- this.setFunctionModule(b, a, color);
- }
- };
- QrCode2.prototype.drawFinderPattern = function(x, y) {
- for (var dy = -4; dy <= 4; dy++) {
- for (var dx = -4; dx <= 4; dx++) {
- var dist = Math.max(Math.abs(dx), Math.abs(dy));
- var xx = x + dx;
- var yy = y + dy;
- if (0 <= xx && xx < this.size && 0 <= yy && yy < this.size)
- this.setFunctionModule(xx, yy, dist != 2 && dist != 4);
- }
- }
- };
- QrCode2.prototype.drawAlignmentPattern = function(x, y) {
- for (var dy = -2; dy <= 2; dy++) {
- for (var dx = -2; dx <= 2; dx++)
- this.setFunctionModule(x + dx, y + dy, Math.max(Math.abs(dx), Math.abs(dy)) != 1);
- }
- };
- QrCode2.prototype.setFunctionModule = function(x, y, isDark) {
- this.modules[y][x] = isDark;
- this.isFunction[y][x] = true;
- };
- QrCode2.prototype.addEccAndInterleave = function(data) {
- var ver = this.version;
- var ecl = this.errorCorrectionLevel;
- if (data.length != QrCode2.getNumDataCodewords(ver, ecl))
- throw new RangeError("Invalid argument");
- var numBlocks = QrCode2.NUM_ERROR_CORRECTION_BLOCKS[ecl.ordinal][ver];
- var blockEccLen = QrCode2.ECC_CODEWORDS_PER_BLOCK[ecl.ordinal][ver];
- var rawCodewords = Math.floor(QrCode2.getNumRawDataModules(ver) / 8);
- var numShortBlocks = numBlocks - rawCodewords % numBlocks;
- var shortBlockLen = Math.floor(rawCodewords / numBlocks);
- var blocks = [];
- var rsDiv = QrCode2.reedSolomonComputeDivisor(blockEccLen);
- for (var i = 0, k = 0; i < numBlocks; i++) {
- var dat = data.slice(k, k + shortBlockLen - blockEccLen + (i < numShortBlocks ? 0 : 1));
- k += dat.length;
- var ecc = QrCode2.reedSolomonComputeRemainder(dat, rsDiv);
- if (i < numShortBlocks)
- dat.push(0);
- blocks.push(dat.concat(ecc));
- }
- var result = [];
- var _loop_1 = function(i2) {
- blocks.forEach(function(block, j) {
- if (i2 != shortBlockLen - blockEccLen || j >= numShortBlocks)
- result.push(block[i2]);
- });
- };
- for (var i = 0; i < blocks[0].length; i++) {
- _loop_1(i);
- }
- assert(result.length == rawCodewords);
- return result;
- };
- QrCode2.prototype.drawCodewords = function(data) {
- if (data.length != Math.floor(QrCode2.getNumRawDataModules(this.version) / 8))
- throw new RangeError("Invalid argument");
- var i = 0;
- for (var right = this.size - 1; right >= 1; right -= 2) {
- if (right == 6)
- right = 5;
- for (var vert = 0; vert < this.size; vert++) {
- for (var j = 0; j < 2; j++) {
- var x = right - j;
- var upward = (right + 1 & 2) == 0;
- var y = upward ? this.size - 1 - vert : vert;
- if (!this.isFunction[y][x] && i < data.length * 8) {
- this.modules[y][x] = getBit(data[i >>> 3], 7 - (i & 7));
- i++;
- }
- }
- }
- }
- assert(i == data.length * 8);
- };
- QrCode2.prototype.applyMask = function(mask) {
- if (mask < 0 || mask > 7)
- throw new RangeError("Mask value out of range");
- for (var y = 0; y < this.size; y++) {
- for (var x = 0; x < this.size; x++) {
- var invert = void 0;
- switch (mask) {
- case 0:
- invert = (x + y) % 2 == 0;
- break;
- case 1:
- invert = y % 2 == 0;
- break;
- case 2:
- invert = x % 3 == 0;
- break;
- case 3:
- invert = (x + y) % 3 == 0;
- break;
- case 4:
- invert = (Math.floor(x / 3) + Math.floor(y / 2)) % 2 == 0;
- break;
- case 5:
- invert = x * y % 2 + x * y % 3 == 0;
- break;
- case 6:
- invert = (x * y % 2 + x * y % 3) % 2 == 0;
- break;
- case 7:
- invert = ((x + y) % 2 + x * y % 3) % 2 == 0;
- break;
- default:
- throw new Error("Unreachable");
- }
- if (!this.isFunction[y][x] && invert)
- this.modules[y][x] = !this.modules[y][x];
- }
- }
- };
- QrCode2.prototype.getPenaltyScore = function() {
- var result = 0;
- for (var y = 0; y < this.size; y++) {
- var runColor = false;
- var runX = 0;
- var runHistory = [0, 0, 0, 0, 0, 0, 0];
- for (var x = 0; x < this.size; x++) {
- if (this.modules[y][x] == runColor) {
- runX++;
- if (runX == 5)
- result += QrCode2.PENALTY_N1;
- else if (runX > 5)
- result++;
- } else {
- this.finderPenaltyAddHistory(runX, runHistory);
- if (!runColor)
- result += this.finderPenaltyCountPatterns(runHistory) * QrCode2.PENALTY_N3;
- runColor = this.modules[y][x];
- runX = 1;
- }
- }
- result += this.finderPenaltyTerminateAndCount(runColor, runX, runHistory) * QrCode2.PENALTY_N3;
- }
- for (var x = 0; x < this.size; x++) {
- var runColor = false;
- var runY = 0;
- var runHistory = [0, 0, 0, 0, 0, 0, 0];
- for (var y = 0; y < this.size; y++) {
- if (this.modules[y][x] == runColor) {
- runY++;
- if (runY == 5)
- result += QrCode2.PENALTY_N1;
- else if (runY > 5)
- result++;
- } else {
- this.finderPenaltyAddHistory(runY, runHistory);
- if (!runColor)
- result += this.finderPenaltyCountPatterns(runHistory) * QrCode2.PENALTY_N3;
- runColor = this.modules[y][x];
- runY = 1;
- }
- }
- result += this.finderPenaltyTerminateAndCount(runColor, runY, runHistory) * QrCode2.PENALTY_N3;
- }
- for (var y = 0; y < this.size - 1; y++) {
- for (var x = 0; x < this.size - 1; x++) {
- var color = this.modules[y][x];
- if (color == this.modules[y][x + 1] && color == this.modules[y + 1][x] && color == this.modules[y + 1][x + 1])
- result += QrCode2.PENALTY_N2;
- }
- }
- var dark = 0;
- for (var _i = 0, _a = this.modules; _i < _a.length; _i++) {
- var row = _a[_i];
- dark = row.reduce(function(sum, color2) {
- return sum + (color2 ? 1 : 0);
- }, dark);
- }
- var total = this.size * this.size;
- var k = Math.ceil(Math.abs(dark * 20 - total * 10) / total) - 1;
- assert(0 <= k && k <= 9);
- result += k * QrCode2.PENALTY_N4;
- assert(0 <= result && result <= 2568888);
- return result;
- };
- QrCode2.prototype.getAlignmentPatternPositions = function() {
- if (this.version == 1)
- return [];
- else {
- var numAlign = Math.floor(this.version / 7) + 2;
- var step = Math.floor((this.version * 8 + numAlign * 3 + 5) / (numAlign * 4 - 4)) * 2;
- var result = [6];
- for (var pos = this.size - 7; result.length < numAlign; pos -= step)
- result.splice(1, 0, pos);
- return result;
- }
- };
- QrCode2.getNumRawDataModules = function(ver) {
- if (ver < QrCode2.MIN_VERSION || ver > QrCode2.MAX_VERSION)
- throw new RangeError("Version number out of range");
- var result = (16 * ver + 128) * ver + 64;
- if (ver >= 2) {
- var numAlign = Math.floor(ver / 7) + 2;
- result -= (25 * numAlign - 10) * numAlign - 55;
- if (ver >= 7)
- result -= 36;
- }
- assert(208 <= result && result <= 29648);
- return result;
- };
- QrCode2.getNumDataCodewords = function(ver, ecl) {
- return Math.floor(QrCode2.getNumRawDataModules(ver) / 8) - QrCode2.ECC_CODEWORDS_PER_BLOCK[ecl.ordinal][ver] * QrCode2.NUM_ERROR_CORRECTION_BLOCKS[ecl.ordinal][ver];
- };
- QrCode2.reedSolomonComputeDivisor = function(degree) {
- if (degree < 1 || degree > 255)
- throw new RangeError("Degree out of range");
- var result = [];
- for (var i = 0; i < degree - 1; i++)
- result.push(0);
- result.push(1);
- var root = 1;
- for (var i = 0; i < degree; i++) {
- for (var j = 0; j < result.length; j++) {
- result[j] = QrCode2.reedSolomonMultiply(result[j], root);
- if (j + 1 < result.length)
- result[j] ^= result[j + 1];
- }
- root = QrCode2.reedSolomonMultiply(root, 2);
- }
- return result;
- };
- QrCode2.reedSolomonComputeRemainder = function(data, divisor) {
- var result = divisor.map(function(_) {
- return 0;
- });
- var _loop_2 = function(b2) {
- var factor = b2 ^ result.shift();
- result.push(0);
- divisor.forEach(function(coef, i) {
- return result[i] ^= QrCode2.reedSolomonMultiply(coef, factor);
- });
- };
- for (var _i = 0, data_1 = data; _i < data_1.length; _i++) {
- var b = data_1[_i];
- _loop_2(b);
- }
- return result;
- };
- QrCode2.reedSolomonMultiply = function(x, y) {
- if (x >>> 8 != 0 || y >>> 8 != 0)
- throw new RangeError("Byte out of range");
- var z = 0;
- for (var i = 7; i >= 0; i--) {
- z = z << 1 ^ (z >>> 7) * 285;
- z ^= (y >>> i & 1) * x;
- }
- assert(z >>> 8 == 0);
- return z;
- };
- QrCode2.prototype.finderPenaltyCountPatterns = function(runHistory) {
- var n = runHistory[1];
- assert(n <= this.size * 3);
- var core = n > 0 && runHistory[2] == n && runHistory[3] == n * 3 && runHistory[4] == n && runHistory[5] == n;
- return (core && runHistory[0] >= n * 4 && runHistory[6] >= n ? 1 : 0) + (core && runHistory[6] >= n * 4 && runHistory[0] >= n ? 1 : 0);
- };
- QrCode2.prototype.finderPenaltyTerminateAndCount = function(currentRunColor, currentRunLength, runHistory) {
- if (currentRunColor) {
- this.finderPenaltyAddHistory(currentRunLength, runHistory);
- currentRunLength = 0;
- }
- currentRunLength += this.size;
- this.finderPenaltyAddHistory(currentRunLength, runHistory);
- return this.finderPenaltyCountPatterns(runHistory);
- };
- QrCode2.prototype.finderPenaltyAddHistory = function(currentRunLength, runHistory) {
- if (runHistory[0] == 0)
- currentRunLength += this.size;
- runHistory.pop();
- runHistory.unshift(currentRunLength);
- };
- QrCode2.MIN_VERSION = 1;
- QrCode2.MAX_VERSION = 40;
- QrCode2.PENALTY_N1 = 3;
- QrCode2.PENALTY_N2 = 3;
- QrCode2.PENALTY_N3 = 40;
- QrCode2.PENALTY_N4 = 10;
- QrCode2.ECC_CODEWORDS_PER_BLOCK = [
- // Version: (note that index 0 is for padding, and is set to an illegal value)
- //0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 Error correction level
- [-1, 7, 10, 15, 20, 26, 18, 20, 24, 30, 18, 20, 24, 26, 30, 22, 24, 28, 30, 28, 28, 28, 28, 30, 30, 26, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],
- // Low
- [-1, 10, 16, 26, 18, 24, 16, 18, 22, 22, 26, 30, 22, 22, 24, 24, 28, 28, 26, 26, 26, 26, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28],
- // Medium
- [-1, 13, 22, 18, 26, 18, 24, 18, 22, 20, 24, 28, 26, 24, 20, 30, 24, 28, 28, 26, 30, 28, 30, 30, 30, 30, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],
- // Quartile
- [-1, 17, 28, 22, 16, 22, 28, 26, 26, 24, 28, 24, 28, 22, 24, 24, 30, 28, 28, 26, 28, 30, 24, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30]
- // High
- ];
- QrCode2.NUM_ERROR_CORRECTION_BLOCKS = [
- // Version: (note that index 0 is for padding, and is set to an illegal value)
- //0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 Error correction level
- [-1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 4, 6, 6, 6, 6, 7, 8, 8, 9, 9, 10, 12, 12, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 24, 25],
- // Low
- [-1, 1, 1, 1, 2, 2, 4, 4, 4, 5, 5, 5, 8, 9, 9, 10, 10, 11, 13, 14, 16, 17, 17, 18, 20, 21, 23, 25, 26, 28, 29, 31, 33, 35, 37, 38, 40, 43, 45, 47, 49],
- // Medium
- [-1, 1, 1, 2, 2, 4, 4, 6, 6, 8, 8, 8, 10, 12, 16, 12, 17, 16, 18, 21, 20, 23, 23, 25, 27, 29, 34, 34, 35, 38, 40, 43, 45, 48, 51, 53, 56, 59, 62, 65, 68],
- // Quartile
- [-1, 1, 1, 2, 4, 4, 4, 5, 6, 8, 8, 11, 11, 16, 16, 18, 16, 19, 21, 25, 25, 25, 34, 30, 32, 35, 37, 40, 42, 45, 48, 51, 54, 57, 60, 63, 66, 70, 74, 77, 81]
- // High
- ];
- return QrCode2;
- }()
- );
- qrcodegen2.QrCode = QrCode;
- function appendBits(val, len, bb) {
- if (len < 0 || len > 31 || val >>> len != 0)
- throw new RangeError("Value out of range");
- for (var i = len - 1; i >= 0; i--)
- bb.push(val >>> i & 1);
- }
- function getBit(x, i) {
- return (x >>> i & 1) != 0;
- }
- function assert(cond) {
- if (!cond)
- throw new Error("Assertion error");
- }
- var QrSegment = (
- /** @class */
- function() {
- function QrSegment2(mode, numChars, bitData) {
- this.mode = mode;
- this.numChars = numChars;
- this.bitData = bitData;
- if (numChars < 0)
- throw new RangeError("Invalid argument");
- this.bitData = bitData.slice();
- }
- QrSegment2.makeBytes = function(data) {
- var bb = [];
- for (var _i = 0, data_2 = data; _i < data_2.length; _i++) {
- var b = data_2[_i];
- appendBits(b, 8, bb);
- }
- return new QrSegment2(QrSegment2.Mode.BYTE, data.length, bb);
- };
- QrSegment2.makeNumeric = function(digits) {
- if (!QrSegment2.isNumeric(digits))
- throw new RangeError("String contains non-numeric characters");
- var bb = [];
- for (var i = 0; i < digits.length; ) {
- var n = Math.min(digits.length - i, 3);
- appendBits(parseInt(digits.substring(i, i + n), 10), n * 3 + 1, bb);
- i += n;
- }
- return new QrSegment2(QrSegment2.Mode.NUMERIC, digits.length, bb);
- };
- QrSegment2.makeAlphanumeric = function(text) {
- if (!QrSegment2.isAlphanumeric(text))
- throw new RangeError("String contains unencodable characters in alphanumeric mode");
- var bb = [];
- var i;
- for (i = 0; i + 2 <= text.length; i += 2) {
- var temp = QrSegment2.ALPHANUMERIC_CHARSET.indexOf(text.charAt(i)) * 45;
- temp += QrSegment2.ALPHANUMERIC_CHARSET.indexOf(text.charAt(i + 1));
- appendBits(temp, 11, bb);
- }
- if (i < text.length)
- appendBits(QrSegment2.ALPHANUMERIC_CHARSET.indexOf(text.charAt(i)), 6, bb);
- return new QrSegment2(QrSegment2.Mode.ALPHANUMERIC, text.length, bb);
- };
- QrSegment2.makeSegments = function(text) {
- if (text == "")
- return [];
- else if (QrSegment2.isNumeric(text))
- return [QrSegment2.makeNumeric(text)];
- else if (QrSegment2.isAlphanumeric(text))
- return [QrSegment2.makeAlphanumeric(text)];
- else
- return [QrSegment2.makeBytes(QrSegment2.toUtf8ByteArray(text))];
- };
- QrSegment2.makeEci = function(assignVal) {
- var bb = [];
- if (assignVal < 0)
- throw new RangeError("ECI assignment value out of range");
- else if (assignVal < 1 << 7)
- appendBits(assignVal, 8, bb);
- else if (assignVal < 1 << 14) {
- appendBits(2, 2, bb);
- appendBits(assignVal, 14, bb);
- } else if (assignVal < 1e6) {
- appendBits(6, 3, bb);
- appendBits(assignVal, 21, bb);
- } else
- throw new RangeError("ECI assignment value out of range");
- return new QrSegment2(QrSegment2.Mode.ECI, 0, bb);
- };
- QrSegment2.isNumeric = function(text) {
- return QrSegment2.NUMERIC_REGEX.test(text);
- };
- QrSegment2.isAlphanumeric = function(text) {
- return QrSegment2.ALPHANUMERIC_REGEX.test(text);
- };
- QrSegment2.prototype.getData = function() {
- return this.bitData.slice();
- };
- QrSegment2.getTotalBits = function(segs, version) {
- var result = 0;
- for (var _i = 0, segs_2 = segs; _i < segs_2.length; _i++) {
- var seg = segs_2[_i];
- var ccbits = seg.mode.numCharCountBits(version);
- if (seg.numChars >= 1 << ccbits)
- return Infinity;
- result += 4 + ccbits + seg.bitData.length;
- }
- return result;
- };
- QrSegment2.toUtf8ByteArray = function(str) {
- str = encodeURI(str);
- var result = [];
- for (var i = 0; i < str.length; i++) {
- if (str.charAt(i) != "%")
- result.push(str.charCodeAt(i));
- else {
- result.push(parseInt(str.substring(i + 1, i + 3), 16));
- i += 2;
- }
- }
- return result;
- };
- QrSegment2.NUMERIC_REGEX = /^[0-9]*$/;
- QrSegment2.ALPHANUMERIC_REGEX = /^[A-Z0-9 $%*+.\/:-]*$/;
- QrSegment2.ALPHANUMERIC_CHARSET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";
- return QrSegment2;
- }()
- );
- qrcodegen2.QrSegment = QrSegment;
-})(qrcodegen || (qrcodegen = {}));
-(function(qrcodegen2) {
- (function(QrCode) {
- var Ecc = (
- /** @class */
- function() {
- function Ecc2(ordinal, formatBits) {
- this.ordinal = ordinal;
- this.formatBits = formatBits;
- }
- Ecc2.LOW = new Ecc2(0, 1);
- Ecc2.MEDIUM = new Ecc2(1, 0);
- Ecc2.QUARTILE = new Ecc2(2, 3);
- Ecc2.HIGH = new Ecc2(3, 2);
- return Ecc2;
- }()
- );
- QrCode.Ecc = Ecc;
- })(qrcodegen2.QrCode || (qrcodegen2.QrCode = {}));
-})(qrcodegen || (qrcodegen = {}));
-(function(qrcodegen2) {
- (function(QrSegment) {
- var Mode = (
- /** @class */
- function() {
- function Mode2(modeBits, numBitsCharCount) {
- this.modeBits = modeBits;
- this.numBitsCharCount = numBitsCharCount;
- }
- Mode2.prototype.numCharCountBits = function(ver) {
- return this.numBitsCharCount[Math.floor((ver + 7) / 17)];
- };
- Mode2.NUMERIC = new Mode2(1, [10, 12, 14]);
- Mode2.ALPHANUMERIC = new Mode2(2, [9, 11, 13]);
- Mode2.BYTE = new Mode2(4, [8, 16, 16]);
- Mode2.KANJI = new Mode2(8, [8, 10, 12]);
- Mode2.ECI = new Mode2(7, [0, 0, 0]);
- return Mode2;
- }()
- );
- QrSegment.Mode = Mode;
- })(qrcodegen2.QrSegment || (qrcodegen2.QrSegment = {}));
-})(qrcodegen || (qrcodegen = {}));
-var QR = qrcodegen;
-var defaultErrorCorrectLevel = "L";
-var ErrorCorrectLevelMap = {
- L: QR.QrCode.Ecc.LOW,
- M: QR.QrCode.Ecc.MEDIUM,
- Q: QR.QrCode.Ecc.QUARTILE,
- H: QR.QrCode.Ecc.HIGH
-};
-var SUPPORTS_PATH2D = function() {
- try {
- new Path2D().addPath(new Path2D());
- } catch (e) {
- return false;
- }
- return true;
-}();
-function validErrorCorrectLevel(level) {
- return level in ErrorCorrectLevelMap;
-}
-function generatePath(modules, margin) {
- if (margin === void 0) {
- margin = 0;
- }
- var ops = [];
- modules.forEach(function(row, y) {
- var start = null;
- row.forEach(function(cell, x) {
- if (!cell && start !== null) {
- ops.push("M".concat(start + margin, " ").concat(y + margin, "h").concat(x - start, "v1H").concat(start + margin, "z"));
- start = null;
- return;
- }
- if (x === row.length - 1) {
- if (!cell) {
- return;
- }
- if (start === null) {
- ops.push("M".concat(x + margin, ",").concat(y + margin, " h1v1H").concat(x + margin, "z"));
- } else {
- ops.push("M".concat(start + margin, ",").concat(y + margin, " h").concat(x + 1 - start, "v1H").concat(start + margin, "z"));
- }
- return;
- }
- if (cell && start === null) {
- start = x;
- }
- });
- });
- return ops.join("");
-}
-function getImageSettings(cells, size, margin, imageSettings) {
- var width = imageSettings.width, height = imageSettings.height, imageX = imageSettings.x, imageY = imageSettings.y;
- var numCells = cells.length + margin * 2;
- var defaultSize = Math.floor(size * 0.1);
- var scale = numCells / size;
- var w = (width || defaultSize) * scale;
- var h2 = (height || defaultSize) * scale;
- var x = imageX == null ? cells.length / 2 - w / 2 : imageX * scale;
- var y = imageY == null ? cells.length / 2 - h2 / 2 : imageY * scale;
- var excavation = null;
- if (imageSettings.excavate) {
- var floorX = Math.floor(x);
- var floorY = Math.floor(y);
- var ceilW = Math.ceil(w + x - floorX);
- var ceilH = Math.ceil(h2 + y - floorY);
- excavation = { x: floorX, y: floorY, w: ceilW, h: ceilH };
- }
- return { x, y, h: h2, w, excavation };
-}
-function excavateModules(modules, excavation) {
- return modules.slice().map(function(row, y) {
- if (y < excavation.y || y >= excavation.y + excavation.h) {
- return row;
- }
- return row.map(function(cell, x) {
- if (x < excavation.x || x >= excavation.x + excavation.w) {
- return cell;
- }
- return false;
- });
- });
-}
-var QRCodeProps = {
- value: {
- type: String,
- required: true,
- default: ""
- },
- size: {
- type: Number,
- default: 100
- },
- level: {
- type: String,
- default: defaultErrorCorrectLevel,
- validator: function(l) {
- return validErrorCorrectLevel(l);
- }
- },
- background: {
- type: String,
- default: "#fff"
- },
- foreground: {
- type: String,
- default: "#000"
- },
- margin: {
- type: Number,
- required: false,
- default: 0
- },
- imageSettings: {
- type: Object,
- required: false,
- default: function() {
- return {};
- }
- },
- gradient: {
- type: Boolean,
- required: false,
- default: false
- },
- gradientType: {
- type: String,
- required: false,
- default: "linear",
- validator: function(t) {
- return ["linear", "radial"].indexOf(t) > -1;
- }
- },
- gradientStartColor: {
- type: String,
- required: false,
- default: "#000"
- },
- gradientEndColor: {
- type: String,
- required: false,
- default: "#fff"
- }
-};
-var QRCodeVueProps = __assign(__assign({}, QRCodeProps), { renderAs: {
- type: String,
- required: false,
- default: "canvas",
- validator: function(as) {
- return ["canvas", "svg"].indexOf(as) > -1;
- }
-} });
-var QrcodeSvg = defineComponent({
- name: "QRCodeSvg",
- props: QRCodeProps,
- setup: function(props) {
- var numCells = ref(0);
- var fgPath = ref("");
- var imageProps;
- var generate = function() {
- var value = props.value, _level = props.level, _margin = props.margin;
- var margin = _margin >>> 0;
- var level = validErrorCorrectLevel(_level) ? _level : defaultErrorCorrectLevel;
- var cells = QR.QrCode.encodeText(value, ErrorCorrectLevelMap[level]).getModules();
- numCells.value = cells.length + margin * 2;
- if (props.imageSettings.src) {
- var imageSettings = getImageSettings(cells, props.size, margin, props.imageSettings);
- imageProps = {
- x: imageSettings.x + margin,
- y: imageSettings.y + margin,
- width: imageSettings.w,
- height: imageSettings.h
- };
- if (imageSettings.excavation) {
- cells = excavateModules(cells, imageSettings.excavation);
- }
- }
- fgPath.value = generatePath(cells, margin);
- };
- var renderGradient = function() {
- if (!props.gradient)
- return null;
- var gradientProps = props.gradientType === "linear" ? {
- x1: "0%",
- y1: "0%",
- x2: "100%",
- y2: "100%"
- } : {
- cx: "50%",
- cy: "50%",
- r: "50%",
- fx: "50%",
- fy: "50%"
- };
- return h(props.gradientType === "linear" ? "linearGradient" : "radialGradient", __assign({ id: "qr-gradient" }, gradientProps), [
- h("stop", {
- offset: "0%",
- style: { stopColor: props.gradientStartColor }
- }),
- h("stop", {
- offset: "100%",
- style: { stopColor: props.gradientEndColor }
- })
- ]);
- };
- generate();
- onUpdated(generate);
- return function() {
- return h("svg", {
- width: props.size,
- height: props.size,
- "shape-rendering": "crispEdges",
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 ".concat(numCells.value, " ").concat(numCells.value)
- }, [
- h("defs", {}, [renderGradient()]),
- h("rect", {
- width: "100%",
- height: "100%",
- fill: props.background
- }),
- h("path", {
- fill: props.gradient ? "url(#qr-gradient)" : props.foreground,
- d: fgPath.value
- }),
- props.imageSettings.src && h("image", __assign({ href: props.imageSettings.src }, imageProps))
- ]);
- };
- }
-});
-var QrcodeCanvas = defineComponent({
- name: "QRCodeCanvas",
- props: QRCodeProps,
- setup: function(props, ctx) {
- var canvasEl = ref(null);
- var imageRef = ref(null);
- var generate = function() {
- var value = props.value, _level = props.level, size = props.size, _margin = props.margin, background = props.background, foreground = props.foreground, gradient = props.gradient, gradientType = props.gradientType, gradientStartColor = props.gradientStartColor, gradientEndColor = props.gradientEndColor;
- var margin = _margin >>> 0;
- var level = validErrorCorrectLevel(_level) ? _level : defaultErrorCorrectLevel;
- var canvas = canvasEl.value;
- if (!canvas) {
- return;
- }
- var ctx2 = canvas.getContext("2d");
- if (!ctx2) {
- return;
- }
- var cells = QR.QrCode.encodeText(value, ErrorCorrectLevelMap[level]).getModules();
- var numCells = cells.length + margin * 2;
- var image = imageRef.value;
- var imageProps = { x: 0, y: 0, width: 0, height: 0 };
- var showImage = props.imageSettings.src && image != null && image.naturalWidth !== 0 && image.naturalHeight !== 0;
- if (showImage) {
- var imageSettings = getImageSettings(cells, props.size, margin, props.imageSettings);
- imageProps = {
- x: imageSettings.x + margin,
- y: imageSettings.y + margin,
- width: imageSettings.w,
- height: imageSettings.h
- };
- if (imageSettings.excavation) {
- cells = excavateModules(cells, imageSettings.excavation);
- }
- }
- var devicePixelRatio = window.devicePixelRatio || 1;
- var scale = size / numCells * devicePixelRatio;
- canvas.height = canvas.width = size * devicePixelRatio;
- ctx2.scale(scale, scale);
- ctx2.fillStyle = background;
- ctx2.fillRect(0, 0, numCells, numCells);
- if (gradient) {
- var grad = void 0;
- if (gradientType === "linear") {
- grad = ctx2.createLinearGradient(0, 0, numCells, numCells);
- } else {
- grad = ctx2.createRadialGradient(numCells / 2, numCells / 2, 0, numCells / 2, numCells / 2, numCells / 2);
- }
- grad.addColorStop(0, gradientStartColor);
- grad.addColorStop(1, gradientEndColor);
- ctx2.fillStyle = grad;
- } else {
- ctx2.fillStyle = foreground;
- }
- if (SUPPORTS_PATH2D) {
- ctx2.fill(new Path2D(generatePath(cells, margin)));
- } else {
- cells.forEach(function(row, rdx) {
- row.forEach(function(cell, cdx) {
- if (cell) {
- ctx2.fillRect(cdx + margin, rdx + margin, 1, 1);
- }
- });
- });
- }
- if (showImage) {
- ctx2.drawImage(image, imageProps.x, imageProps.y, imageProps.width, imageProps.height);
- }
- };
- onMounted(generate);
- onUpdated(generate);
- var style = ctx.attrs.style;
- return function() {
- return h(Fragment, [
- h("canvas", __assign(__assign({}, ctx.attrs), { ref: canvasEl, style: __assign(__assign({}, style), { width: "".concat(props.size, "px"), height: "".concat(props.size, "px") }) })),
- props.imageSettings.src && h("img", {
- ref: imageRef,
- src: props.imageSettings.src,
- style: { display: "none" },
- onLoad: generate
- })
- ]);
- };
- }
-});
-var QrcodeVue = defineComponent({
- name: "Qrcode",
- render: function() {
- var _a = this.$props, renderAs = _a.renderAs, value = _a.value, size = _a.size, margin = _a.margin, level = _a.level, background = _a.background, foreground = _a.foreground, imageSettings = _a.imageSettings, gradient = _a.gradient, gradientType = _a.gradientType, gradientStartColor = _a.gradientStartColor, gradientEndColor = _a.gradientEndColor;
- return h(renderAs === "svg" ? QrcodeSvg : QrcodeCanvas, {
- value,
- size,
- margin,
- level,
- background,
- foreground,
- imageSettings,
- gradient,
- gradientType,
- gradientStartColor,
- gradientEndColor
- });
- },
- props: QRCodeVueProps
-});
-const __default__$1 = {
- name: "InputBoxDialog"
-};
-const _sfc_main$1 = /* @__PURE__ */ defineComponent({
- ...__default__$1,
- setup(__props) {
- const inputBoxValue = ref("");
- const showInputBoxVisible = ref(false);
- const inputBoxOptions = reactive({
- title: "",
- placeholder: ""
- });
- onBeforeMount(() => {
- window.electron.electronAPI.ipcRenderer.on(SHOW_INPUT_BOX, ipcEventHandler);
- emitter.on(SHOW_INPUT_BOX, initInputBoxValue);
- });
- function ipcEventHandler(_, options) {
- initInputBoxValue(options);
- }
- function initInputBoxValue(options) {
- inputBoxValue.value = options.value || "";
- inputBoxOptions.title = options.title || "";
- inputBoxOptions.placeholder = options.placeholder || "";
- showInputBoxVisible.value = true;
- }
- function handleInputBoxCancel() {
- showInputBoxVisible.value = false;
- sendToMain(SHOW_INPUT_BOX, "");
- emitter.emit(SHOW_INPUT_BOX_RESPONSE, "");
- }
- function handleInputBoxConfirm() {
- showInputBoxVisible.value = false;
- sendToMain(SHOW_INPUT_BOX, inputBoxValue.value);
- emitter.emit(SHOW_INPUT_BOX_RESPONSE, inputBoxValue.value);
- }
- onBeforeUnmount(() => {
- window.electron.electronAPI.ipcRenderer.removeListener(SHOW_INPUT_BOX, ipcEventHandler);
- emitter.off(SHOW_INPUT_BOX);
- });
- return (_ctx, _cache) => {
- const _component_el_input = resolveComponent("el-input");
- const _component_el_button = resolveComponent("el-button");
- const _component_el_dialog = resolveComponent("el-dialog");
- return openBlock(), createBlock(_component_el_dialog, {
- modelValue: showInputBoxVisible.value,
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => showInputBoxVisible.value = $event),
- title: inputBoxOptions.title || unref(T)("INPUT"),
- "modal-append-to-body": false,
- "append-to-body": ""
- }, {
- footer: withCtx(() => [
- createVNode(_component_el_button, {
- round: "",
- onClick: handleInputBoxCancel
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("CANCEL")), 1)
- ]),
- _: 1
- }),
- createVNode(_component_el_button, {
- type: "primary",
- round: "",
- onClick: handleInputBoxConfirm
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("CONFIRM")), 1)
- ]),
- _: 1
- })
- ]),
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: inputBoxValue.value,
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputBoxValue.value = $event),
- placeholder: inputBoxOptions.placeholder
- }, null, 8, ["modelValue", "placeholder"])
- ]),
- _: 1
- }, 8, ["modelValue", "title"]);
- };
- }
-});
-const _hoisted_1 = { id: "main-page" };
-const _hoisted_2 = { class: "fake-title-bar" };
-const _hoisted_3 = { class: "fake-title-bar__title" };
-const _hoisted_4 = {
- key: 0,
- class: "handle-bar"
-};
-const _hoisted_5 = { class: "qrcode-container" };
-const __default__ = {
- name: "MainPage"
-};
-const _sfc_main = /* @__PURE__ */ defineComponent({
- ...__default__,
- setup(__props) {
- const version = ref(pkg.version);
- const routerConfig = reactive(config);
- const defaultActive = ref(routerConfig.UPLOAD_PAGE);
- const $router = useRouter();
- const qrcodeVisible = ref(false);
- const picBedConfigString = ref("");
- const choosedPicBedForQRCode = ref([]);
- const isAlwaysOnTop = ref(false);
- const keepAlivePages = $router.getRoutes().filter((item) => item.meta.keepAlive).map((item) => item.name);
- const isShowprogress = ref(false);
- const progress = ref(0);
- onBeforeMount(() => {
- updatePicBedGlobal();
- window.electron.electronAPI.ipcRenderer.on(SHOW_MAIN_PAGE_QRCODE, () => {
- qrcodeVisible.value = true;
- });
- window.electron.electronAPI.ipcRenderer.on("updateProgress", (_event, data) => {
- isShowprogress.value = data.progress !== 100 && data.progress !== 0;
- progress.value = data.progress;
- });
- });
- watch(
- () => choosedPicBedForQRCode,
- (val) => {
- if (val.value.length > 0) {
- nextTick(async () => {
- const picBedConfig = await getConfig("picBed");
- const config2 = pick(picBedConfig, ...choosedPicBedForQRCode.value);
- picBedConfigString.value = JSON.stringify(config2);
- });
- }
- },
- { deep: true }
- );
- const handleSelect = async (index) => {
- defaultActive.value = index;
- if (index === routerConfig.DocumentPage) {
- const manualPageOpenSetting = await getConfig(configPaths.settings.manualPageOpen);
- const lang = await getConfig(configPaths.settings.language) || II18nLanguage.ZH_CN;
- const openManual = () => sendRPC(IRPCActionType.OPEN_MANUAL_WINDOW);
- const openExternal = () => sendRPC(
- IRPCActionType.OPEN_URL,
- lang === II18nLanguage.ZH_CN ? "https://piclist.cn/app.html" : "https://piclist.cn/en/app.html"
- );
- if (!manualPageOpenSetting) {
- ElMessageBox.confirm(T("MANUAL_PAGE_OPEN_TIP"), T("MANUAL_PAGE_OPEN_TIP_TITLE"), {
- confirmButtonText: T("MANUAL_PAGE_OPEN_BY_BROWSER"),
- cancelButtonText: T("MANUAL_PAGE_OPEN_BY_BUILD_IN"),
- type: "info",
- center: true
- }).then(() => {
- saveConfig(configPaths.settings.manualPageOpen, "browser");
- openExternal();
- }).catch(() => {
- saveConfig(configPaths.settings.manualPageOpen, "window");
- openManual();
- });
- } else {
- manualPageOpenSetting === "window" ? openManual() : openExternal();
- }
- return;
- }
- const type = index.match(routerConfig.UPLOADER_CONFIG_PAGE);
- if (type === null) {
- $router.push({
- name: index
- });
- } else {
- const type2 = index.replace(`${routerConfig.UPLOADER_CONFIG_PAGE}-`, "");
- $router.push({
- name: routerConfig.UPLOADER_CONFIG_PAGE,
- params: {
- type: type2
- }
- });
- }
- };
- function minimizeWindow() {
- sendRPC(IRPCActionType.MINIMIZE_WINDOW);
- }
- function closeWindow() {
- sendRPC(IRPCActionType.CLOSE_WINDOW);
- }
- function openMenu() {
- sendRPC(IRPCActionType.SHOW_MAIN_PAGE_MENU);
- }
- function openMiniWindow() {
- sendRPC(IRPCActionType.OPEN_MINI_WINDOW);
- }
- function handleCopyPicBedConfig() {
- window.electron.clipboard.writeText(picBedConfigString.value);
- ElMessage.success(T("COPY_PICBED_CONFIG_SUCCEED"));
- }
- function setAlwaysOnTop() {
- isAlwaysOnTop.value = !isAlwaysOnTop.value;
- sendRPC(IRPCActionType.MAIN_WINDOW_ON_TOP);
- }
- onBeforeRouteUpdate(async (to) => {
- if (to.params.type) {
- defaultActive.value = `${routerConfig.UPLOADER_CONFIG_PAGE}-${to.params.type}`;
- } else {
- defaultActive.value = to.name;
- }
- });
- onBeforeUnmount(() => {
- window.electron.electronAPI.ipcRenderer.removeAllListeners(SHOW_MAIN_PAGE_QRCODE);
- window.electron.electronAPI.ipcRenderer.removeAllListeners("updateProgress");
- });
- return (_ctx, _cache) => {
- const _component_el_icon = resolveComponent("el-icon");
- const _component_el_progress = resolveComponent("el-progress");
- const _component_el_menu_item = resolveComponent("el-menu-item");
- const _component_el_sub_menu = resolveComponent("el-sub-menu");
- const _component_el_menu = resolveComponent("el-menu");
- const _component_el_col = resolveComponent("el-col");
- const _component_router_view = resolveComponent("router-view");
- const _component_el_row = resolveComponent("el-row");
- const _component_el_option = resolveComponent("el-option");
- const _component_el_select = resolveComponent("el-select");
- const _component_el_button = resolveComponent("el-button");
- const _component_el_form_item = resolveComponent("el-form-item");
- const _component_el_form = resolveComponent("el-form");
- const _component_el_dialog = resolveComponent("el-dialog");
- return openBlock(), createElementBlock("div", _hoisted_1, [
- createBaseVNode("div", _hoisted_2, [
- createBaseVNode("div", _hoisted_3, " PicList - " + toDisplayString(version.value), 1),
- unref(osGlobal) !== "darwin" ? (openBlock(), createElementBlock("div", _hoisted_4, [
- createVNode(_component_el_icon, {
- class: "minus",
- color: isAlwaysOnTop.value ? "#409EFF" : "#fff",
- size: "20",
- style: { "margin-right": "10px" },
- onClick: setAlwaysOnTop
- }, {
- default: withCtx(() => [
- createVNode(unref(arrow_up_bold_default))
- ]),
- _: 1
- }, 8, ["color"]),
- createVNode(_component_el_icon, {
- class: "minus",
- color: "#fff",
- size: "20",
- style: { "margin-right": "10px" },
- onClick: minimizeWindow
- }, {
- default: withCtx(() => [
- createVNode(unref(semi_select_default))
- ]),
- _: 1
- }),
- createVNode(_component_el_icon, {
- class: "plus",
- color: "orange",
- size: "20",
- style: { "margin-right": "10px" },
- onClick: openMiniWindow
- }, {
- default: withCtx(() => [
- createVNode(unref(arrow_down_bold_default))
- ]),
- _: 1
- }),
- createVNode(_component_el_icon, {
- class: "close",
- color: "#fff",
- size: "20",
- onClick: closeWindow
- }, {
- default: withCtx(() => [
- createVNode(unref(close_bold_default))
- ]),
- _: 1
- })
- ])) : createCommentVNode("", true)
- ]),
- isShowprogress.value ? (openBlock(), createBlock(_component_el_progress, {
- key: 0,
- percentage: progress.value,
- "stroke-width": 7,
- "text-inside": true,
- "show-text": false,
- status: "success",
- class: "progress-bar"
- }, null, 8, ["percentage"])) : createCommentVNode("", true),
- createVNode(_component_el_row, {
- style: { "padding-top": "22px" },
- class: "main-content"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_col, { class: "side-bar-menu" }, {
- default: withCtx(() => [
- createVNode(_component_el_menu, {
- class: "picgo-sidebar",
- "default-active": defaultActive.value,
- "unique-opened": true,
- onSelect: handleSelect
- }, {
- default: withCtx(() => [
- createVNode(_component_el_menu_item, {
- index: routerConfig.UPLOAD_PAGE
- }, {
- default: withCtx(() => [
- createVNode(_component_el_icon, null, {
- default: withCtx(() => [
- createVNode(unref(upload_filled_default))
- ]),
- _: 1
- }),
- createBaseVNode("span", null, toDisplayString(unref(T)("UPLOAD_AREA")), 1)
- ]),
- _: 1
- }, 8, ["index"]),
- createVNode(_component_el_menu_item, {
- index: routerConfig.MANAGE_LOGIN_PAGE
- }, {
- default: withCtx(() => [
- createVNode(_component_el_icon, null, {
- default: withCtx(() => [
- createVNode(unref(pie_chart_default))
- ]),
- _: 1
- }),
- createBaseVNode("span", null, toDisplayString(unref(T)("MANAGE_PAGE")), 1)
- ]),
- _: 1
- }, 8, ["index"]),
- createVNode(_component_el_menu_item, {
- index: routerConfig.GALLERY_PAGE
- }, {
- default: withCtx(() => [
- createVNode(_component_el_icon, null, {
- default: withCtx(() => [
- createVNode(unref(picture_filled_default))
- ]),
- _: 1
- }),
- createBaseVNode("span", null, toDisplayString(unref(T)("GALLERY")), 1)
- ]),
- _: 1
- }, 8, ["index"]),
- createVNode(_component_el_sub_menu, {
- index: "sub-menu",
- "show-timeout": 0,
- "hide-timeout": 0,
- "popper-offset": 0
- }, {
- title: withCtx(() => [
- createVNode(_component_el_icon, null, {
- default: withCtx(() => [
- createVNode(unref(menu_default))
- ]),
- _: 1
- }),
- createBaseVNode("span", null, toDisplayString(unref(T)("PICBEDS_SETTINGS")), 1)
- ]),
- default: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(picBedGlobal), (item) => {
- return openBlock(), createElementBlock(Fragment, null, [
- item.visible ? (openBlock(), createBlock(_component_el_menu_item, {
- key: item.type,
- index: `${routerConfig.UPLOADER_CONFIG_PAGE}-${item.type}`
- }, {
- default: withCtx(() => [
- createBaseVNode("span", null, toDisplayString(item.name), 1)
- ]),
- _: 2
- }, 1032, ["index"])) : createCommentVNode("", true)
- ], 64);
- }), 256))
- ]),
- _: 1
- }),
- createVNode(_component_el_menu_item, {
- index: routerConfig.SETTING_PAGE
- }, {
- default: withCtx(() => [
- createVNode(_component_el_icon, null, {
- default: withCtx(() => [
- createVNode(unref(tools_default))
- ]),
- _: 1
- }),
- createBaseVNode("span", null, toDisplayString(unref(T)("PICLIST_SETTINGS")), 1)
- ]),
- _: 1
- }, 8, ["index"]),
- createVNode(_component_el_menu_item, {
- index: routerConfig.PLUGIN_PAGE
- }, {
- default: withCtx(() => [
- createVNode(_component_el_icon, null, {
- default: withCtx(() => [
- createVNode(unref(share_default))
- ]),
- _: 1
- }),
- createBaseVNode("span", null, toDisplayString(unref(T)("PLUGIN_SETTINGS")), 1)
- ]),
- _: 1
- }, 8, ["index"]),
- createVNode(_component_el_menu_item, {
- index: routerConfig.DocumentPage
- }, {
- default: withCtx(() => [
- createVNode(_component_el_icon, null, {
- default: withCtx(() => [
- createVNode(unref(link_default))
- ]),
- _: 1
- }),
- createBaseVNode("span", null, toDisplayString(unref(T)("MANUAL")), 1)
- ]),
- _: 1
- }, 8, ["index"])
- ]),
- _: 1
- }, 8, ["default-active"]),
- createVNode(_component_el_icon, {
- class: "info-window",
- onClick: openMenu
- }, {
- default: withCtx(() => [
- createVNode(unref(info_filled_default))
- ]),
- _: 1
- })
- ]),
- _: 1
- }),
- createVNode(_component_el_col, {
- span: 21,
- offset: 3,
- style: { "height": "100%" },
- class: "main-wrapper"
- }, {
- default: withCtx(() => [
- createVNode(_component_router_view, null, {
- default: withCtx(({ Component }) => [
- createVNode(Transition, {
- name: "picgo-fade",
- mode: "out-in"
- }, {
- default: withCtx(() => [
- (openBlock(), createBlock(KeepAlive, { include: unref(keepAlivePages) }, [
- (openBlock(), createBlock(resolveDynamicComponent(Component)))
- ], 1032, ["include"]))
- ]),
- _: 2
- }, 1024)
- ]),
- _: 1
- })
- ]),
- _: 1
- })
- ]),
- _: 1
- }),
- createVNode(_component_el_dialog, {
- modelValue: qrcodeVisible.value,
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => qrcodeVisible.value = $event),
- class: "qrcode-dialog",
- top: "3vh",
- width: "60%",
- title: unref(T)("PICBED_QRCODE"),
- "modal-append-to-body": false,
- "lock-scroll": "",
- "append-to-body": ""
- }, {
- default: withCtx(() => [
- createVNode(_component_el_form, {
- "label-position": "left",
- "label-width": "70px",
- size: "small"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_form_item, {
- label: unref(T)("CHOOSE_PICBED")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_select, {
- modelValue: choosedPicBedForQRCode.value,
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => choosedPicBedForQRCode.value = $event),
- multiple: "",
- "collapse-tags": "",
- persistent: false,
- teleported: ""
- }, {
- default: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(picBedGlobal), (item) => {
- return openBlock(), createBlock(_component_el_option, {
- key: item.type,
- label: item.name,
- value: item.type
- }, null, 8, ["label", "value"]);
- }), 128))
- ]),
- _: 1
- }, 8, ["modelValue"]),
- withDirectives(createVNode(_component_el_button, {
- type: "primary",
- round: "",
- class: "copy-picbed-config",
- onClick: handleCopyPicBedConfig
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("COPY_PICBED_CONFIG")), 1)
- ]),
- _: 1
- }, 512), [
- [vShow, choosedPicBedForQRCode.value.length > 0]
- ])
- ]),
- _: 1
- }, 8, ["label"])
- ]),
- _: 1
- }),
- createBaseVNode("div", _hoisted_5, [
- withDirectives(createVNode(QrcodeVue, {
- size: 280,
- value: picBedConfigString.value
- }, null, 8, ["value"]), [
- [vShow, choosedPicBedForQRCode.value.length > 0]
- ])
- ])
- ]),
- _: 1
- }, 8, ["modelValue", "title"]),
- createVNode(_sfc_main$1)
- ]);
- };
- }
-});
-export {
- _sfc_main as default
-};
diff --git a/dist/renderer/assets/Main-DxgNipu7.css b/dist/renderer/assets/Main-DxgNipu7.css
deleted file mode 100644
index 0de7a09f..00000000
--- a/dist/renderer/assets/Main-DxgNipu7.css
+++ /dev/null
@@ -1,166 +0,0 @@
-.setting-list-scroll {
- height: 800px;
- overflow-y: auto;
- overflow-x: hidden;
- margin-right: 0 !important;
-}
-.picgo-fade-enter,
-.picgo-fade-leave,
-.picgo-fade-leave-active {
- opacity: 0;
-}
-.picgo-fade-enter-active,
-.picgo-fade-leave-active {
- transition: all 150ms linear;
-}
-.view-title {
- color: #eee;
- font-size: 20px;
- text-align: center;
- margin: 10px auto;
-}
-#main-page {
- height: 100%;
-}
-#main-page .qrcode-dialog .qrcode-container {
- display: flex;
- justify-content: center;
-}
-#main-page .qrcode-dialog .el-dialog__body {
- padding-top: 10px;
-}
-#main-page .qrcode-dialog .copy-picbed-config {
- margin-left: 10px;
-}
-#main-page .fake-title-bar {
- -webkit-app-region: drag;
- height: 22px;
- width: 100%;
- text-align: center;
- color: #eee;
- font-size: 12px;
- line-height: 22px;
- position: fixed;
- z-index: 100;
-}
-#main-page .fake-title-bar.darwin {
- background: transparent;
- background-image: linear-gradient(to right, transparent 0%, transparent 167px, rgba(33,51,54,0.7) 167px, rgba(33,51,54,0.7) 100%);
-}
-#main-page .fake-title-bar.darwin .fake-title-bar__title {
- padding-left: 167px;
-}
-#main-page .fake-title-bar .handle-bar {
- position: absolute;
- top: 2px;
- right: 4px;
- z-index: 10000;
- -webkit-app-region: no-drag;
-}
-#main-page .fake-title-bar .handle-bar .el-icon {
- cursor: pointer;
- font-size: 16px;
- margin-left: 5px;
-}
-#main-page .fake-title-bar .handle-bar .el-icon.minus:hover {
- color: #409eff;
-}
-#main-page .fake-title-bar .handle-bar .el-icon.close:hover {
- color: #f15140;
-}
-#main-page .fake-title-bar .handle-bar .el-icon.plus:hover {
- color: #69c282;
-}
-#main-page .main-wrapper.darwin {
- background: rgba(33,51,54,0.7);
-}
-#main-page .side-bar-menu {
- position: fixed;
- height: calc(100vh - 22px);
- overflow-x: hidden;
- overflow-y: auto;
- width: 142px;
-}
-#main-page .side-bar-menu .info-window {
- cursor: pointer;
- position: fixed;
- bottom: 4px;
- left: 4px;
- cursor: poiter;
- color: #878d99;
- transition: 0.2s all ease-in-out;
-}
-#main-page .side-bar-menu .info-window:hover {
- color: #409eff;
-}
-#main-page .el-menu {
- border-right: none;
- background: transparent;
- width: 142px;
-}
-#main-page .el-menu-item {
- color: #eee;
- position: relative;
-}
-#main-page .el-menu-item:focus,
-#main-page .el-menu-item:hover {
- color: #fff;
- background: transparent;
-}
-#main-page .el-menu-item.is-active {
- color: #409eff;
-}
-#main-page .el-menu-item.is-active:before {
- content: '';
- position: absolute;
- width: 1px;
- height: 20px;
- right: 0;
- top: 18px;
- background: #409eff;
-}
-#main-page .el-sub-menu__title {
- color: #eee;
-}
-#main-page .el-sub-menu__title:hover {
- background: transparent;
-}
-#main-page .el-sub-menu__title:hover span {
- color: #fff;
-}
-#main-page .el-sub-menu .el-menu-item {
- min-width: 142px;
-}
-#main-page .el-sub-menu .el-menu-item.is-active:before {
- top: 16px;
-}
-#main-page .main-content {
- padding-top: 22px;
- position: relative;
- height: calc(100vh - 22px);
- z-index: 10;
-}
-#main-page .el-dialog__body {
- padding: 20px;
-}
-#main-page .support {
- text-align: center;
-}
-#main-page .support-title {
- text-align: center;
- color: #878d99;
-}
-#main-page .align-center input {
- text-align: center;
-}
-#main-page *::-webkit-scrollbar {
- width: 2px;
- height: 8px;
-}
-#main-page *::-webkit-scrollbar-thumb {
- border-radius: 4px;
- background: #6f6f6f;
-}
-#main-page *::-webkit-scrollbar-track {
- background-color: transparent;
-}
diff --git a/dist/renderer/assets/ManageMain-CSobdUqJ.css b/dist/renderer/assets/ManageMain-CSobdUqJ.css
deleted file mode 100644
index 2554734b..00000000
--- a/dist/renderer/assets/ManageMain-CSobdUqJ.css
+++ /dev/null
@@ -1,82 +0,0 @@
-.layout {
- height: 100%;
- display: flex;
- flex-direction: row;
-}
-.layout__menu {
- background: #fff;
- color: #fff;
- display: flex;
- flex-direction: column;
- border-bottom-right-radius: 4px;
- z-index: 1;
- width: 130px;
- position: relative;
-}
-.layout__menu__button {
- font-weight: bold;
- text-align: left;
- padding-left: 0px;
- padding-top: 10px;
-}
-.layout__menu__button__item {
- color: #2d8cf0;
- width: 100%;
- height: 100%;
- display: flex;
- align-items: center;
- justify-content: center;
-}
-.layout__menu__button__item:hover {
- cursor: pointer;
- color: #ffa500;
-}
-.layout__menu__button__item__icon {
- width: 25px;
- height: 25px;
-}
-.layout__menu__button__divider__icon:hover {
- cursor: pointer;
- color: #ffa500;
-}
-.layout__menu__list {
- flex: 1;
- overflow-y: auto;
-}
-.layout__menu__list__item {
- width: 100%;
- height: 100%;
- display: flex;
- color: #2d8cf0;
- align-items: center;
- justify-content: center;
-}
-.layout__menu__list__item:hover {
- cursor: pointer;
- color: #ffa500;
-}
-.layout__menu__list__item__icon {
- width: 25px;
- height: 25px;
-}
-.layout__menu__setting {
- position: relative;
- overflow: hidden;
-}
-.layout__menu__setting__item {
- width: 100%;
- display: flex;
- align-items: center;
- color: #000;
- justify-content: center;
- font-size: 12px;
- font-family: Arial, Helvetica, sans-serif;
-}
-.layout__menu__setting__item:hover {
- cursor: pointer;
- color: #ffa500;
-}
-.layout__menu__setting__item__icon {
- width: 25px;
- height: 25px;
-}
diff --git a/dist/renderer/assets/ManageMain-ZMzzX0g0.js b/dist/renderer/assets/ManageMain-ZMzzX0g0.js
deleted file mode 100644
index cc481f0d..00000000
--- a/dist/renderer/assets/ManageMain-ZMzzX0g0.js
+++ /dev/null
@@ -1,838 +0,0 @@
-import { T, d as defineComponent, r as ref, al as useRoute, a as reactive, D as watch, am as computed, o as onBeforeMount, c as createElementBlock, e as openBlock, f as createBaseVNode, q as createVNode, w as withDirectives, B as createTextVNode, u as unref, t as toDisplayString, v as withCtx, y as resolveComponent, i as resolveDirective, N as createBlock, m as triggerRPC, j as IRPCActionType, g as createCommentVNode, an as circle_plus_default, F as Fragment, h as renderList, E as normalizeStyle, ao as folder_opened_default, ap as folder_default, aq as home_filled_default, ar as switch_default, a5 as tools_default, as as chrome_filled_default, at as success_filled_default, au as ElNotification, Q as useRouter } from "./index-BqdcQlNn.js";
-import { u as useManageStore } from "./manageStore-EteLCVxq.js";
-import { s as supportedPicBedList } from "./constants-BZfYqEeL.js";
-import "./dataSender-Bg45AIFL.js";
-const AliyunAreaCodeName = {
- "oss-cn-hangzhou": "华东1(杭州)",
- "oss-cn-shanghai": "华东2(上海)",
- "oss-cn-nanjing": "华东5(南京)",
- "oss-cn-fuzhou": "华东6(福州)",
- "oss-cn-wuhan": "华中1(武汉)",
- "oss-cn-qingdao": "华北1(青岛)",
- "oss-cn-beijing": "华北2(北京)",
- "oss-cn-zhangjiakou": "华北3(张家口)",
- "oss-cn-huhehaote": "华北5(呼和浩特)",
- "oss-cn-wulanchabu": "华北6(乌兰察布)",
- "oss-cn-shenzhen": "华南1(深圳)",
- "oss-cn-heyuan": "华南2(河源)",
- "oss-cn-guangzhou": "华南3(广州)",
- "oss-cn-chengdu": "西南1(成都)",
- "oss-cn-hongkong": "中国香港",
- "oss-us-west-1": "美国(硅谷)",
- "oss-us-east-1": "美国(弗吉尼亚)",
- "oss-ap-northeast-1": "日本(东京)",
- "oss-ap-northeast-2": "韩国(首尔)",
- "oss-ap-southeast-1": "新加坡",
- "oss-ap-southeast-2": "澳大利亚(悉尼)",
- "oss-ap-southeast-3": "马来西亚(吉隆坡)",
- "oss-ap-southeast-5": "印度尼西亚(雅加达)",
- "oss-ap-southeast-6": "菲律宾(马尼拉)",
- "oss-ap-southeast-7": "泰国(曼谷)",
- "oss-ap-south-1": "印度(孟买)",
- "oss-eu-central-1": "德国(法兰克福)",
- "oss-eu-west-1": "英国(伦敦)",
- "oss-me-east-1": "阿联酋(迪拜)",
- "oss-rg-china-mainland": "无地域属性"
-};
-const QiniuAreaCodeName = {
- z0: "华东-浙江",
- "cn-east-2": "华东 浙江2",
- z1: "华北-河北",
- z2: "华南-广东",
- na0: "北美-洛杉矶",
- as0: "亚太-新加坡",
- "ap-northeast-1": "亚太-首尔",
- "ap-southeast-2": "亚太-河内"
-};
-const TencentAreaCodeName = {
- "ap-beijing-1": "北京一区",
- "ap-beijing": "北京",
- "ap-nanjing": "南京",
- "ap-shanghai": "上海",
- "ap-guangzhou": "广州",
- "ap-chengdu": "成都",
- "ap-chongqing": "重庆",
- "ap-shenzhen-fsi": "深圳金融",
- "ap-shagnhai-fsi": "上海金融",
- "ap-beijing-fsi": "北京金融",
- "ap-hongkong": "香港",
- "ap-singapore": "新加坡",
- "ap-mumbai": "孟买",
- "ap-jakarta": "雅加达",
- "ap-seoul": "首尔",
- "ap-bangkok": "曼谷",
- "ap-tokyo": "东京",
- "na-siliconvalley": "硅谷(美西)",
- "na-ashburn": "弗吉尼亚(美东)",
- "na-toronto": "多伦多",
- "sa-saopaulo": "圣保罗",
- "eu-frankfurt": "法兰克福"
-};
-const newBucketConfig = {
- tcyun: {
- name: T("MANAGE_NEW_BUCKET_TCYUN_NAME"),
- icon: "tcyun",
- configOptions: {
- BucketName: {
- required: true,
- description: T("MANAGE_NEW_BUCKET_TCYUN_BUCKETNAME_DESC"),
- placeholder: T("MANAGE_NEW_BUCKET_TCYUN_BUCKETNAME_PLACEHOLDER"),
- paraType: "string",
- component: "input",
- default: "piclist",
- rule: [
- {
- required: true,
- message: T("MANAGE_NEW_BUCKET_TCYUN_BUCKETNAME_RULE_MSG_A"),
- trigger: "blur"
- },
- {
- validator: (rule, value, callback) => {
- const reg = /^[a-z0-9][a-z0-9-]{1,21}[a-z0-9]$/;
- if (value.length > 23) {
- callback(new Error(T("MANAGE_NEW_BUCKET_TCYUN_BUCKETNAME_RULE_MSG_B")));
- } else if (!reg.test(value)) {
- callback(new Error(T("MANAGE_NEW_BUCKET_TCYUN_BUCKETNAME_RULE_MSG_C")));
- } else {
- callback();
- }
- },
- trigger: "change"
- }
- ]
- },
- region: {
- required: true,
- description: T("MANAGE_NEW_BUCKET_TCYUN_REGION"),
- paraType: "string",
- component: "select",
- default: "ap-nanjing",
- options: TencentAreaCodeName
- },
- acl: {
- required: true,
- description: T("MANAGE_NEW_BUCKET_TCYUN_ACL_DESC"),
- paraType: "string",
- component: "select",
- default: "private",
- options: {
- private: T("MANAGE_NEW_BUCKET_TCYUN_ACL_PRIVATE"),
- "public-read": T("MANAGE_NEW_BUCKET_TCYUN_ACL_PUBLIC_R"),
- "public-read-write": T("MANAGE_NEW_BUCKET_TCYUN_ACL_PUBLIC_RW")
- }
- }
- },
- options: ["BucketName", "region", "acl"]
- },
- aliyun: {
- name: T("MANAGE_NEW_BUCKET_ALIYUN_NAME"),
- icon: "aliyun",
- configOptions: {
- BucketName: {
- required: true,
- description: T("MANAGE_NEW_BUCKET_ALIYUN_BUCKETNAME_DESC"),
- placeholder: T("MANAGE_NEW_BUCKET_ALIYUN_BUCKETNAME_PLACEHOLDER"),
- paraType: "string",
- component: "input",
- default: "piclist",
- rule: [
- {
- required: true,
- message: T("MANAGE_NEW_BUCKET_ALIYUN_BUCKETNAME_RULE_MSG_A"),
- trigger: "blur"
- },
- {
- validator: (rule, value, callback) => {
- const reg = /^[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$/;
- if (value.length > 63) {
- callback(new Error(T("MANAGE_NEW_BUCKET_ALIYUN_BUCKETNAME_RULE_MSG_B")));
- } else if (!reg.test(value)) {
- callback(new Error(T("MANAGE_NEW_BUCKET_ALIYUN_BUCKETNAME_RULE_MSG_C")));
- } else {
- callback();
- }
- },
- trigger: "change"
- }
- ]
- },
- region: {
- required: true,
- description: T("MANAGE_NEW_BUCKET_ALIYUN_REGION"),
- paraType: "string",
- component: "select",
- default: "oss-cn-hangzhou",
- options: AliyunAreaCodeName
- },
- acl: {
- required: true,
- description: T("MANAGE_NEW_BUCKET_ALIYUN_ACL_DESC"),
- paraType: "string",
- component: "select",
- default: "private",
- options: {
- private: T("MANAGE_NEW_BUCKET_ALIYUN_ACL_PRIVATE"),
- publicRead: T("MANAGE_NEW_BUCKET_ALIYUN_ACL_PUBLIC_R"),
- publicReadWrite: T("MANAGE_NEW_BUCKET_ALIYUN_ACL_PUBLIC_RW")
- }
- }
- },
- options: ["BucketName", "region", "acl"]
- },
- qiniu: {
- name: T("MANAGE_NEW_BUCKET_QINIU_NAME"),
- icon: "qiniu",
- configOptions: {
- BucketName: {
- required: true,
- description: T("MANAGE_NEW_BUCKET_QINIU_BUCKETNAME_DESC"),
- placeholder: T("MANAGE_NEW_BUCKET_QINIU_BUCKETNAME_PLACEHOLDER"),
- paraType: "string",
- component: "input",
- default: "piclist",
- rule: [
- {
- required: true,
- message: T("MANAGE_NEW_BUCKET_QINIU_BUCKETNAME_RULE_MSG_A"),
- trigger: "blur"
- },
- {
- validator: (rule, value, callback) => {
- const reg = /^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$/;
- if (value.length > 63) {
- callback(new Error(T("MANAGE_NEW_BUCKET_QINIU_BUCKETNAME_RULE_MSG_B")));
- } else if (!reg.test(value)) {
- callback(new Error(T("MANAGE_NEW_BUCKET_QINIU_BUCKETNAME_RULE_MSG_C")));
- } else {
- callback();
- }
- },
- trigger: "change"
- }
- ]
- },
- region: {
- required: true,
- description: T("MANAGE_NEW_BUCKET_QINIU_REGION"),
- paraType: "string",
- component: "select",
- default: "z0",
- options: QiniuAreaCodeName
- },
- acl: {
- required: true,
- description: T("MANAGE_NEW_BUCKET_QINIU_ACL_DESC"),
- paraType: "boolean",
- component: "switch",
- default: false
- }
- },
- options: ["BucketName", "region", "acl"]
- },
- s3plist: {
- name: T("MANAGE_NEW_BUCKET_S3PLIST_NAME"),
- icon: "s3plist",
- configOptions: {
- BucketName: {
- required: true,
- description: T("MANAGE_NEW_BUCKET_S3PLIST_BUCKETNAME_DESC"),
- placeholder: T("MANAGE_NEW_BUCKET_S3PLIST_BUCKETNAME_PLACEHOLDER"),
- paraType: "string",
- component: "input",
- default: "piclist",
- rule: [
- {
- required: true,
- message: T("MANAGE_NEW_BUCKET_S3PLIST_BUCKETNAME_RULE_MSG_A"),
- trigger: "blur"
- }
- ]
- },
- region: {
- required: true,
- description: T("MANAGE_NEW_BUCKET_S3PLIST_REGION"),
- paraType: "string",
- component: "input",
- default: "us-east-1"
- },
- acl: {
- required: true,
- description: T("MANAGE_NEW_BUCKET_S3PLIST_ACL_DESC"),
- paraType: "string",
- component: "select",
- default: "private",
- options: {
- private: T("MANAGE_NEW_BUCKET_S3PLIST_ACL_PRIVATE"),
- "public-read": T("MANAGE_NEW_BUCKET_S3PLIST_ACL_PUBLIC_R"),
- "public-read-write": T("MANAGE_NEW_BUCKET_S3PLIST_ACL_PUBLIC_RW"),
- "authenticated-read": T("MANAGE_NEW_BUCKET_S3PLIST_ACL_AUTHENTICATED_READ")
- }
- }
- },
- options: ["BucketName", "region", "acl"]
- }
-};
-const _hoisted_1 = { class: "layout" };
-const _hoisted_2 = { class: "layout__menu" };
-const _hoisted_3 = { class: "layout__menu__button" };
-const _hoisted_4 = ["src"];
-const _hoisted_5 = { style: { "font-size": "14px", "color": "#909399" } };
-const _hoisted_6 = { class: "layout__menu__setting__item" };
-const _hoisted_7 = { class: "layout__menu__setting__item" };
-const _hoisted_8 = { class: "layout__menu__setting__item" };
-const _hoisted_9 = {
- class: "layout__content",
- style: { "height": "100%", "background-color": "transparent", "flex": "1", "width": "0" }
-};
-const _hoisted_10 = {
- class: "choice-cos",
- style: { "display": "flex", "flex-direction": "row", "flex-wrap": "wrap", "justify-content": "space-around" }
-};
-const _hoisted_11 = { style: { "font-size": "13px", "margin-top": "5px", "color": "red" } };
-const _hoisted_12 = ["onClick"];
-const _hoisted_13 = { style: { "font-size": "13px", "margin-top": "5px", "color": "cornflowerblue" } };
-const _hoisted_14 = { style: { "position": "relative", "height": "10vh", "width": "100%" } };
-const _hoisted_15 = { style: { "position": "relative", "height": "10vh", "width": "100%", "z-index": "1" } };
-const _sfc_main = /* @__PURE__ */ defineComponent({
- __name: "ManageMain",
- setup(__props) {
- const manageStore = useManageStore();
- const route = useRoute();
- const router = useRouter();
- const currentAlias = ref(route.query.alias);
- const currentPicBedName = ref(route.query.picBedName);
- let allPicBedConfigure = JSON.parse(route.query.allPicBedConfigure);
- let currentPagePicBedConfig = reactive(JSON.parse(route.query.config));
- const newBucketConfigResult = reactive({});
- const bucketList = ref({});
- const currentSelectedBucket = ref("");
- const bucketNameList = ref([]);
- const isLoadingBucketList = ref(false);
- const nweBucketDrawerVisible = ref(false);
- const picBedSwitchDialogVisible = ref(false);
- watch(route, async (newRoute) => {
- if (newRoute.fullPath.split("?")[0] === "/main-page/manage-main-page") {
- currentAlias.value = newRoute.query.alias;
- currentPicBedName.value = newRoute.query.picBedName;
- allPicBedConfigure = JSON.parse(newRoute.query.allPicBedConfigure);
- currentPagePicBedConfig = reactive(JSON.parse(newRoute.query.config));
- await getBucketList();
- }
- });
- const getCurrentActiveBucket = computed(() => bucketNameList.value.length === 0 ? "" : bucketNameList.value[0]);
- const urlMap = {
- aliyun: "https://oss.console.aliyun.com",
- github: "https://github.com",
- imgur: "https://imgur.com",
- local: "https://piclist.cn",
- qiniu: "https://portal.qiniu.com",
- s3plist: "https://aws.amazon.com/cn/s3/",
- sftp: "https://github.com/imba97/picgo-plugin-sftp-uploader",
- smms: "https://smms.app",
- tcyun: "https://console.cloud.tencent.com/cos",
- upyun: "https://console.upyun.com",
- webdavplist: "https://baike.baidu.com/item/WebDAV/4610909"
- };
- const showNewIconList = ["aliyun", "qiniu", "tcyun", "s3plist"];
- const bucketT = T("MANAGE_MAIN_PAGE_BUCKET");
- const galleryT = T("MANAGE_MAIN_PAGE_GALLERY");
- const repositoryT = T("MANAGE_MAIN_PAGE_REPOSITORY");
- const menuTitleMap = {
- aliyun: bucketT,
- qiniu: bucketT,
- tcyun: bucketT,
- upyun: bucketT,
- s3plist: bucketT,
- sftp: "",
- smms: galleryT,
- imgur: galleryT,
- github: repositoryT,
- webdavplist: "",
- local: ""
- };
- const rules = ruleMap(newBucketConfig);
- const openPicBedUrl = () => window.electron.shell.openExternal(urlMap[currentPagePicBedConfig.picBedName]);
- function ruleMap(options) {
- return Object.keys(options).reduce((result, key) => {
- options[key].options.forEach((option) => {
- const keyName = `${key}.${option}`;
- const configOption = options[key].configOptions[option];
- if (configOption.rule) {
- result[keyName] = configOption.rule;
- }
- if (configOption.default) {
- newBucketConfigResult[keyName] = configOption.default;
- }
- });
- return result;
- }, {});
- }
- function openNewBucketDrawer() {
- nweBucketDrawerVisible.value = true;
- }
- function createNewBucket(picBedName) {
- const configOptions = newBucketConfig[picBedName].configOptions;
- const resultMap = Object.keys(configOptions).reduce((result, key) => {
- const resultKey = `${picBedName}.${key}`;
- const defaultValue = configOptions[key].default;
- const resultValue = newBucketConfigResult[resultKey];
- result[key] = resultValue === "" && defaultValue !== void 0 ? defaultValue : resultValue === void 0 ? defaultValue ?? "" : resultValue;
- return result;
- }, {});
- if (currentPicBedName.value === "tcyun") {
- resultMap.BucketName = `${resultMap.BucketName}-${currentPagePicBedConfig.appId}`;
- }
- resultMap.endpoint = currentPagePicBedConfig.endpoint;
- triggerRPC(IRPCActionType.MANAGE_CREATE_BUCKET, currentAlias, resultMap).then((result) => {
- if (result) {
- ElNotification({
- title: T("MANAGE_MAIN_PAGE_TIPS"),
- message: T("MANAGE_MAIN_PAGE_TIPS_SUCCESS"),
- type: "success"
- });
- nweBucketDrawerVisible.value = false;
- setTimeout(() => {
- getBucketList();
- }, 2e3);
- } else {
- ElNotification({
- title: T("MANAGE_MAIN_PAGE_TIPS"),
- message: T("MANAGE_MAIN_PAGE_TIPS_FAILED"),
- type: "error"
- });
- }
- });
- }
- async function getBucketList() {
- bucketList.value = {};
- bucketNameList.value = [];
- isLoadingBucketList.value = true;
- const result = await triggerRPC(IRPCActionType.MANAGE_GET_BUCKET_LIST, currentAlias.value);
- isLoadingBucketList.value = false;
- if (result.length > 0) {
- result.forEach((item) => {
- bucketList.value[item.Name] = item;
- bucketNameList.value.push(item.Name);
- });
- }
- }
- function transPathToUnix(filePath) {
- if (!filePath) return "";
- return process.platform === "win32" ? filePath.split(window.node.path.sep).join(window.node.path.posix.sep).replace(/^\/+|\/+$/g, "") : filePath.replace(/^\/+|\/+$/g, "");
- }
- function handleSelectMenu(bucketName) {
- const currentPicBedConfig = manageStore.config.picBed[currentAlias.value];
- const transformedConfig = JSON.parse(currentPicBedConfig.transformedConfig ?? "{}");
- let prefix = transformedConfig[bucketName]?.baseDir || "/";
- const cpicBedName = currentPicBedConfig.picBedName ?? currentPicBedName.value;
- if (cpicBedName === "local") {
- prefix = `/${transPathToUnix(prefix)}/`;
- } else {
- prefix = prefix.startsWith("/") ? prefix : `/${prefix}`;
- prefix = prefix.endsWith("/") ? prefix : `${prefix}/`;
- }
- const configMap = {
- prefix,
- bucketName,
- customUrl: transformedConfig[bucketName]?.customUrl ?? "",
- picBedName: cpicBedName,
- alias: currentAlias.value,
- bucketConfig: bucketList.value[bucketName],
- cdnUrl: currentPicBedConfig.customUrl,
- baseDir: prefix,
- webPath: currentPicBedConfig.webPath || ""
- };
- currentSelectedBucket.value = bucketName;
- router.push({
- path: "/main-page/manage-main-page/manage-bucket-page",
- query: {
- configMap: JSON.stringify(configMap)
- }
- });
- }
- function switchPicBed(picBedAlias) {
- if (picBedAlias === "main") {
- router.push({
- path: "/main-page/manage-login-page"
- });
- return;
- }
- if (route.fullPath.startsWith("/main-page/manage-main-page/manage-bucket-page") || route.fullPath.startsWith("/main-page/manage-main-page/manage-setting-page")) {
- picBedSwitchDialogVisible.value = false;
- router.push({
- path: "/main-page/manage-main-page",
- query: {
- alias: picBedAlias,
- picBedName: allPicBedConfigure[picBedAlias].picBedName,
- config: JSON.stringify(allPicBedConfigure[picBedAlias]),
- allPicBedConfigure: JSON.stringify(allPicBedConfigure)
- }
- });
- } else {
- currentAlias.value = picBedAlias;
- currentPicBedName.value = allPicBedConfigure[picBedAlias].picBedName;
- currentPagePicBedConfig = allPicBedConfigure[picBedAlias];
- picBedSwitchDialogVisible.value = false;
- currentSelectedBucket.value = "";
- getBucketList();
- }
- }
- function changePicBed() {
- picBedSwitchDialogVisible.value = true;
- }
- function openBucketPageSetting() {
- router.push({
- path: "/main-page/manage-main-page/manage-setting-page"
- });
- }
- onBeforeMount(() => {
- getBucketList();
- });
- return (_ctx, _cache) => {
- const _component_el_icon = resolveComponent("el-icon");
- const _component_el_tooltip = resolveComponent("el-tooltip");
- const _component_el_divider = resolveComponent("el-divider");
- const _component_el_menu_item = resolveComponent("el-menu-item");
- const _component_el_menu = resolveComponent("el-menu");
- const _component_router_view = resolveComponent("router-view");
- const _component_el_card = resolveComponent("el-card");
- const _component_el_image = resolveComponent("el-image");
- const _component_el_dialog = resolveComponent("el-dialog");
- const _component_el_input = resolveComponent("el-input");
- const _component_el_option = resolveComponent("el-option");
- const _component_el_select = resolveComponent("el-select");
- const _component_el_switch = resolveComponent("el-switch");
- const _component_el_form_item = resolveComponent("el-form-item");
- const _component_el_button = resolveComponent("el-button");
- const _component_el_form = resolveComponent("el-form");
- const _component_el_drawer = resolveComponent("el-drawer");
- const _directive_loading = resolveDirective("loading");
- return openBlock(), createElementBlock("div", _hoisted_1, [
- createBaseVNode("div", _hoisted_2, [
- createBaseVNode("div", _hoisted_3, [
- createBaseVNode("span", {
- class: "layout__menu__button__item",
- onClick: openPicBedUrl
- }, [
- createBaseVNode("img", {
- src: require(`./assets/${unref(currentPagePicBedConfig).picBedName}.webp`),
- class: "layout__menu__button__item__icon"
- }, null, 8, _hoisted_4),
- createTextVNode(" " + toDisplayString(unref(supportedPicBedList)[unref(currentPagePicBedConfig).picBedName].name), 1)
- ])
- ]),
- createVNode(_component_el_divider, {
- "content-position": "left",
- class: "layout__menu__button__divider",
- "border-style": "none"
- }, {
- default: withCtx(() => [
- createBaseVNode("span", _hoisted_5, [
- createTextVNode(toDisplayString(menuTitleMap[currentPicBedName.value]) + " ", 1),
- showNewIconList.includes(currentPicBedName.value) ? (openBlock(), createBlock(_component_el_tooltip, {
- key: 0,
- effect: "dark",
- content: unref(T)("MANAGE_MAIN_PAGE_NEW_BUCKET"),
- placement: "right",
- persistent: false,
- teleported: "",
- "popper-class": "layout__menu__button__divider__tooltip"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_icon, {
- class: "layout__menu__button__divider__icon",
- color: "red",
- style: { "top": "2px" },
- onClick: _cache[0] || (_cache[0] = ($event) => openNewBucketDrawer())
- }, {
- default: withCtx(() => [
- createVNode(unref(circle_plus_default))
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["content"])) : createCommentVNode("", true)
- ])
- ]),
- _: 1
- }),
- _cache[6] || (_cache[6] = createBaseVNode("div", null, null, -1)),
- withDirectives((openBlock(), createBlock(_component_el_menu, {
- class: "layout__menu__list",
- "default-active": getCurrentActiveBucket.value,
- style: { "width": "120px" },
- "active-text-color": "#409EFF",
- onSelect: handleSelectMenu
- }, {
- default: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(bucketNameList.value, (item) => {
- return openBlock(), createBlock(_component_el_menu_item, {
- key: item,
- index: item
- }, {
- default: withCtx(() => [
- createBaseVNode("span", {
- class: "layout__menu__list__item",
- style: normalizeStyle({
- color: item === currentSelectedBucket.value ? "#409EFF" : "#606266"
- })
- }, [
- currentSelectedBucket.value === item && currentPicBedName.value !== "github" ? (openBlock(), createBlock(_component_el_icon, {
- key: 0,
- class: "layout__menu__list__item__icon",
- color: "#409EFF",
- style: { "top": "2px" }
- }, {
- default: withCtx(() => [
- createVNode(unref(folder_opened_default))
- ]),
- _: 1
- })) : currentPicBedName.value !== "github" ? (openBlock(), createBlock(_component_el_icon, {
- key: 1,
- class: "layout__menu__list__item__icon",
- color: "#606266",
- style: { "top": "2px" }
- }, {
- default: withCtx(() => [
- createVNode(unref(folder_default))
- ]),
- _: 1
- })) : createCommentVNode("", true),
- createTextVNode(" " + toDisplayString(currentPicBedName.value === "tcyun" ? item.slice(0, item.length - 11) : currentPicBedName.value === "github" ? item.length > 10 ? `${item.slice(0, 5)}..${item.slice(-5)}` : item : item), 1)
- ], 4)
- ]),
- _: 2
- }, 1032, ["index"]);
- }), 128))
- ]),
- _: 1
- }, 8, ["default-active"])), [
- [_directive_loading, isLoadingBucketList.value]
- ]),
- createVNode(_component_el_menu, {
- class: "layout__menu__setting",
- style: { "width": "120px" }
- }, {
- default: withCtx(() => [
- createVNode(_component_el_menu_item, {
- index: "changePicBed",
- style: { "height": "40px" },
- onClick: _cache[1] || (_cache[1] = ($event) => switchPicBed("main"))
- }, {
- default: withCtx(() => [
- createBaseVNode("span", _hoisted_6, [
- createVNode(_component_el_icon, { class: "layout__menu__setting__item__icon" }, {
- default: withCtx(() => [
- createVNode(unref(home_filled_default))
- ]),
- _: 1
- }),
- createTextVNode(" " + toDisplayString(unref(T)("MANAGE_MAIN_PAGE_BACK_TO_HOME")), 1)
- ])
- ]),
- _: 1
- }),
- createVNode(_component_el_menu_item, {
- index: "changePicBed",
- style: { "height": "40px" },
- onClick: changePicBed
- }, {
- default: withCtx(() => [
- createBaseVNode("span", _hoisted_7, [
- createVNode(_component_el_icon, { class: "layout__menu__setting__item__icon" }, {
- default: withCtx(() => [
- createVNode(unref(switch_default))
- ]),
- _: 1
- }),
- createTextVNode(" " + toDisplayString(unref(T)("MANAGE_MAIN_PAGE_SWITCH_PICBED")), 1)
- ])
- ]),
- _: 1
- }),
- createVNode(_component_el_menu_item, {
- index: "bucketPageSetting",
- style: { "height": "40px" },
- onClick: openBucketPageSetting
- }, {
- default: withCtx(() => [
- createBaseVNode("span", _hoisted_8, [
- createVNode(_component_el_icon, { class: "layout__menu__setting__item__icon" }, {
- default: withCtx(() => [
- createVNode(unref(tools_default))
- ]),
- _: 1
- }),
- createTextVNode(" " + toDisplayString(unref(T)("MANAGE_MAIN_PAGE_SETTING")), 1)
- ])
- ]),
- _: 1
- })
- ]),
- _: 1
- })
- ]),
- createBaseVNode("div", _hoisted_9, [
- createVNode(_component_router_view)
- ]),
- createVNode(_component_el_dialog, {
- modelValue: picBedSwitchDialogVisible.value,
- "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => picBedSwitchDialogVisible.value = $event),
- top: "30vh",
- "append-to-body": ""
- }, {
- default: withCtx(() => [
- createBaseVNode("div", _hoisted_10, [
- createVNode(_component_el_card, { shadow: "hover" }, {
- default: withCtx(() => [
- createBaseVNode("div", {
- style: { "text-align": "center", "display": "flex", "flex-direction": "column" },
- onClick: _cache[2] || (_cache[2] = ($event) => switchPicBed("main"))
- }, [
- createVNode(_component_el_icon, {
- color: "red",
- size: "25px",
- style: { "margin": "0 auto" }
- }, {
- default: withCtx(() => [
- createVNode(unref(chrome_filled_default))
- ]),
- _: 1
- }),
- createBaseVNode("span", _hoisted_11, toDisplayString(unref(T)("MANAGE_MAIN_PAGE_BACK_TO_HOME")), 1)
- ])
- ]),
- _: 1
- }),
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(allPicBedConfigure), (item) => {
- return openBlock(), createBlock(_component_el_card, {
- key: item,
- shadow: "hover"
- }, {
- default: withCtx(() => [
- createBaseVNode("div", {
- style: { "text-align": "center", "display": "flex", "flex-direction": "column" },
- onClick: ($event) => switchPicBed(item.alias)
- }, [
- createVNode(_component_el_image, {
- src: require(`./assets/${item.picBedName}.webp`),
- class: "layout__addNewBucket__icon",
- style: { "width": "25px", "height": "25px", "margin": "0 auto" }
- }, null, 8, ["src"]),
- createBaseVNode("span", _hoisted_13, toDisplayString(item.alias), 1)
- ], 8, _hoisted_12)
- ]),
- _: 2
- }, 1024);
- }), 128))
- ])
- ]),
- _: 1
- }, 8, ["modelValue"]),
- createVNode(_component_el_drawer, {
- modelValue: nweBucketDrawerVisible.value,
- "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => nweBucketDrawerVisible.value = $event),
- class: "layout__addNewBucket",
- "append-to-body": ""
- }, {
- default: withCtx(() => [
- createVNode(_component_el_form, {
- "label-position": "top",
- "require-asterisk-position": "right",
- "label-width": "10vw",
- size: "default",
- model: newBucketConfigResult,
- rules: unref(rules)
- }, {
- default: withCtx(() => [
- createBaseVNode("div", _hoisted_14, [
- createVNode(_component_el_image, {
- src: require(`./assets/${currentPicBedName.value}.webp`),
- class: "layout__addNewBucket__icon",
- style: { "position": "absolute", "top": "50%", "left": "50%", "transform": "translate(-50%, -50%)" }
- }, null, 8, ["src"])
- ]),
- createVNode(_component_el_divider, { "border-style": "none" }),
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(newBucketConfig)[currentPicBedName.value].options, (option) => {
- return openBlock(), createBlock(_component_el_form_item, {
- key: option,
- prop: currentPicBedName.value + "." + option,
- label: unref(newBucketConfig)[currentPicBedName.value].configOptions[option].description
- }, {
- default: withCtx(() => [
- unref(newBucketConfig)[currentPicBedName.value].configOptions[option].component === "input" && currentPicBedName.value !== "tcyun" ? (openBlock(), createBlock(_component_el_input, {
- key: 0,
- modelValue: newBucketConfigResult[currentPicBedName.value + "." + option],
- "onUpdate:modelValue": ($event) => newBucketConfigResult[currentPicBedName.value + "." + option] = $event,
- modelModifiers: { trim: true },
- placeholder: unref(newBucketConfig)[currentPicBedName.value].configOptions[option].placeholder
- }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])) : createCommentVNode("", true),
- currentPicBedName.value === "tcyun" && unref(newBucketConfig)[currentPicBedName.value].configOptions[option].component === "input" ? (openBlock(), createBlock(_component_el_input, {
- key: 1,
- modelValue: newBucketConfigResult[currentPicBedName.value + "." + option],
- "onUpdate:modelValue": ($event) => newBucketConfigResult[currentPicBedName.value + "." + option] = $event,
- modelModifiers: { trim: true },
- placeholder: unref(newBucketConfig)[currentPicBedName.value].configOptions[option].placeholder
- }, {
- append: withCtx(() => [
- createTextVNode(toDisplayString("-" + unref(currentPagePicBedConfig).appId), 1)
- ]),
- _: 2
- }, 1032, ["modelValue", "onUpdate:modelValue", "placeholder"])) : createCommentVNode("", true),
- unref(newBucketConfig)[currentPicBedName.value].configOptions[option].component === "select" ? (openBlock(), createBlock(_component_el_select, {
- key: 2,
- modelValue: newBucketConfigResult[currentPicBedName.value + "." + option],
- "onUpdate:modelValue": ($event) => newBucketConfigResult[currentPicBedName.value + "." + option] = $event,
- size: "large",
- persistent: false,
- teleported: ""
- }, {
- default: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(Object.keys(unref(newBucketConfig)[currentPicBedName.value].configOptions[option].options), (item) => {
- return openBlock(), createBlock(_component_el_option, {
- key: item,
- label: unref(newBucketConfig)[currentPicBedName.value].configOptions[option].options[item],
- value: item
- }, null, 8, ["label", "value"]);
- }), 128))
- ]),
- _: 2
- }, 1032, ["modelValue", "onUpdate:modelValue"])) : createCommentVNode("", true),
- unref(newBucketConfig)[currentPicBedName.value].configOptions[option].component === "switch" ? (openBlock(), createBlock(_component_el_switch, {
- key: 3,
- modelValue: newBucketConfigResult[currentPicBedName.value + "." + option],
- "onUpdate:modelValue": ($event) => newBucketConfigResult[currentPicBedName.value + "." + option] = $event,
- "active-value": true,
- "inactive-value": false
- }, null, 8, ["modelValue", "onUpdate:modelValue"])) : createCommentVNode("", true)
- ]),
- _: 2
- }, 1032, ["prop", "label"]);
- }), 128)),
- createBaseVNode("div", _hoisted_15, [
- createVNode(_component_el_button, {
- icon: unref(success_filled_default),
- type: "primary",
- style: { "position": "absolute", "top": "50%", "left": "50%", "transform": "translate(-50%, -50%)" },
- onClick: _cache[4] || (_cache[4] = ($event) => createNewBucket(currentPicBedName.value))
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_MAIN_PAGE_SUBMIT")), 1)
- ]),
- _: 1
- }, 8, ["icon"])
- ])
- ]),
- _: 1
- }, 8, ["model", "rules"])
- ]),
- _: 1
- }, 8, ["modelValue"])
- ]);
- };
- }
-});
-export {
- _sfc_main as default
-};
diff --git a/dist/renderer/assets/ManageSetting-BK7oAv59.css b/dist/renderer/assets/ManageSetting-BK7oAv59.css
deleted file mode 100644
index 4467ada0..00000000
--- a/dist/renderer/assets/ManageSetting-BK7oAv59.css
+++ /dev/null
@@ -1,4 +0,0 @@
-#manage-setting {
- height: 100%;
- overflow-y: auto;
-}
diff --git a/dist/renderer/assets/ManageSetting-CcSbcH15.js b/dist/renderer/assets/ManageSetting-CcSbcH15.js
deleted file mode 100644
index 14bdab9e..00000000
--- a/dist/renderer/assets/ManageSetting-CcSbcH15.js
+++ /dev/null
@@ -1,542 +0,0 @@
-import { d as defineComponent, av as mergeModels, aw as useModel, N as createBlock, e as openBlock, y as resolveComponent, v as withCtx, q as createVNode, f as createBaseVNode, c as createElementBlock, g as createCommentVNode, F as Fragment, h as renderList, E as normalizeStyle, t as toDisplayString, u as unref, a8 as info_filled_default, r as ref, D as watch, T, o as onBeforeMount, B as createTextVNode, ap as folder_default, m as triggerRPC, j as IRPCActionType, J as ElMessage } from "./index-BqdcQlNn.js";
-import { f as fileCacheDbInstance } from "./bucketFileDb-qvw68roE.js";
-import { f as formatFileSize, c as customRenameFormatTable } from "./common-REXFY3_s.js";
-import { g as getConfig, s as saveConfig } from "./dataSender-Bg45AIFL.js";
-import "./common-DNjr697i.js";
-const _hoisted_1$1 = { style: { "position": "absolute", "left": "0" } };
-const _sfc_main$1 = /* @__PURE__ */ defineComponent({
- __name: "DynamicSwitch",
- props: /* @__PURE__ */ mergeModels({
- tooltip: {},
- activeText: {},
- inactiveText: {},
- segments: {}
- }, {
- "modelValue": { type: Boolean },
- "modelModifiers": {}
- }),
- emits: ["update:modelValue"],
- setup(__props) {
- const value = useModel(__props, "modelValue");
- return (_ctx, _cache) => {
- const _component_el_icon = resolveComponent("el-icon");
- const _component_el_tooltip = resolveComponent("el-tooltip");
- const _component_el_switch = resolveComponent("el-switch");
- const _component_el_form_item = resolveComponent("el-form-item");
- return openBlock(), createBlock(_component_el_form_item, null, {
- label: withCtx(() => [
- createBaseVNode("span", _hoisted_1$1, [
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.segments, (segment, index) => {
- return openBlock(), createElementBlock("span", {
- key: index,
- style: normalizeStyle(segment.style)
- }, toDisplayString(segment.text), 5);
- }), 128)),
- _ctx.tooltip ? (openBlock(), createBlock(_component_el_tooltip, {
- key: 0,
- content: _ctx.tooltip,
- effect: "dark",
- placement: "right",
- persistent: false,
- teleported: ""
- }, {
- default: withCtx(() => [
- createVNode(_component_el_icon, null, {
- default: withCtx(() => [
- createVNode(unref(info_filled_default))
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["content"])) : createCommentVNode("", true)
- ])
- ]),
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: value.value,
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event),
- "active-text": _ctx.activeText,
- "inactive-text": _ctx.inactiveText,
- style: { "--el-switch-on-color": "#13ce66", "--el-switch-off-color": "#ff4949", "position": "absolute", "right": "0" }
- }, null, 8, ["modelValue", "active-text", "inactive-text"])
- ]),
- _: 1
- });
- };
- }
-});
-const _hoisted_1 = { id: "manage-setting" };
-const _hoisted_2 = { style: { "position": "absolute", "left": "0" } };
-const _hoisted_3 = { style: { "color": "#ff4949" } };
-const _hoisted_4 = { style: { "color": "#ff4949" } };
-const _hoisted_5 = { key: 3 };
-const _hoisted_6 = { style: { "position": "absolute", "left": "0" } };
-const _hoisted_7 = { style: { "position": "absolute", "left": "0" } };
-const _sfc_main = /* @__PURE__ */ defineComponent({
- __name: "ManageSetting",
- setup(__props) {
- const form = ref({
- timestampRename: false,
- randomStringRename: false,
- customRename: false,
- isAutoRefresh: false,
- isShowThumbnail: false,
- isShowList: false,
- isUsePreSignedUrl: false,
- isIgnoreCase: false,
- isForceCustomUrlHttps: false,
- isEncodeUrl: false,
- isUploadKeepDirStructure: true,
- isDownloadFileKeepDirStructure: false,
- isDownloadFolderKeepDirStructure: true,
- downloadDir: "",
- pasteFormat: "markdown",
- customPasteFormat: "$url",
- PreSignedExpire: 14400,
- // seconds
- maxDownloadFileCount: 5,
- customRenameFormat: "{filename}"
- });
- const settingsKeys = Object.keys(form.value);
- const dbSize = ref(0);
- const dbSizeAvailableRate = ref("0");
- const pasteFormatList = ["markdown", "markdown-with-link", "rawurl", "html", "bbcode", "custom"];
- settingsKeys.forEach((key) => {
- watch(
- () => form.value[key],
- (newValue) => saveConfig({ [`settings.${key}`]: newValue })
- );
- });
- const switchFieldsList = [
- "isAutoRefresh",
- "isShowThumbnail",
- "isShowList",
- "isUsePreSignedUrl",
- "isForceCustomUrlHttps",
- "isEncodeUrl",
- "isUploadKeepDirStructure",
- "isIgnoreCase",
- "timestampRename",
- "randomStringRename",
- "customRename"
- ];
- const switchFieldsNoTipsList = ["isShowThumbnail", "isShowList", "isUsePreSignedUrl"];
- const switchFieldsHasActiveTextList = ["isShowList"];
- const switchFieldsConfigList = switchFieldsList.map((item) => ({
- configName: item,
- segments: [
- {
- text: T(`MANAGE_SETTING_${item.toUpperCase()}_TITLE`),
- style: "color: black;"
- }
- ],
- tooltip: switchFieldsNoTipsList.includes(item) ? void 0 : T(`MANAGE_SETTING_${item.toUpperCase()}_TIPS`),
- activeText: switchFieldsHasActiveTextList.includes(item) ? T(`MANAGE_SETTING_${item.toUpperCase()}_ON`) : void 0,
- inactiveText: switchFieldsHasActiveTextList.includes(item) ? T(`MANAGE_SETTING_${item.toUpperCase()}_OFF`) : void 0
- }));
- const switchFieldsSpecialList = [
- {
- configName: "isDownloadFileKeepDirStructure",
- segments: [
- {
- text: T("MANAGE_SETTING_ISDOWNLOADFILEKEEPDIRSTRUCTURE_TITLE_A"),
- style: "color: black;"
- },
- {
- text: T("MANAGE_SETTING_ISDOWNLOADFILEKEEPDIRSTRUCTURE_TITLE_B"),
- style: "color: orange;"
- },
- {
- text: T("MANAGE_SETTING_ISDOWNLOADFILEKEEPDIRSTRUCTURE_TITLE_C"),
- style: "color: black;"
- }
- ],
- tooltip: T("MANAGE_SETTING_ISDOWNLOADFILEKEEPDIRSTRUCTURE_TIPS")
- },
- {
- configName: "isDownloadFolderKeepDirStructure",
- segments: [
- {
- text: T("MANAGE_SETTING_ISDOWNLOADFILEKEEPDIRSTRUCTURE_TITLE_A"),
- style: "color: black;"
- },
- {
- text: T("MANAGE_SETTING_ISDOWNLOADFOLDERKEEPDIRSTRUCTURE_TITLE_D"),
- style: "color: coral;"
- },
- {
- text: T("MANAGE_SETTING_ISDOWNLOADFILEKEEPDIRSTRUCTURE_TITLE_C"),
- style: "color: black;"
- }
- ],
- tooltip: T("MANAGE_SETTING_ISDOWNLOADFILEKEEPDIRSTRUCTURE_TIPS")
- }
- ];
- async function initData() {
- const config = await getConfig();
- settingsKeys.forEach((key) => {
- form.value[key] = config.settings[key] ?? form.value[key];
- });
- }
- async function handleDownloadDirClick() {
- const result = await triggerRPC(IRPCActionType.MANAGE_SELECT_DOWNLOAD_FOLDER);
- if (result) {
- form.value.downloadDir = result;
- }
- }
- const handleCellClick = (row, column) => {
- navigator.clipboard.writeText(row[column.property]);
- ElMessage.success(`${T("MANAGE_SETTING_COPY_MESSAGE")}${row[column.property]}`);
- };
- function handleClearDb() {
- fileCacheDbInstance.delete().then(() => {
- getIndexDbSize();
- ElMessage.success(T("MANAGE_SETTING_CLEAR_CACHE_SUCCESS"));
- }).catch(() => {
- ElMessage.error(T("MANAGE_SETTING_CLEAR_CACHE_FAILED"));
- });
- }
- async function getIndexDbSize() {
- const size = (await navigator.storage.estimate()).usage ?? 0;
- const quota = (await navigator.storage.estimate()).quota ?? 0;
- dbSize.value = size;
- dbSizeAvailableRate.value = (100 - size / quota * 100).toFixed(2);
- }
- onBeforeMount(() => {
- initData();
- getIndexDbSize();
- });
- return (_ctx, _cache) => {
- const _component_el_row = resolveComponent("el-row");
- const _component_el_icon = resolveComponent("el-icon");
- const _component_el_tooltip = resolveComponent("el-tooltip");
- const _component_el_button = resolveComponent("el-button");
- const _component_el_popconfirm = resolveComponent("el-popconfirm");
- const _component_el_form_item = resolveComponent("el-form-item");
- const _component_el_link = resolveComponent("el-link");
- const _component_el_input = resolveComponent("el-input");
- const _component_el_table_column = resolveComponent("el-table-column");
- const _component_el_table = resolveComponent("el-table");
- const _component_el_input_number = resolveComponent("el-input-number");
- const _component_el_radio = resolveComponent("el-radio");
- const _component_el_radio_group = resolveComponent("el-radio-group");
- const _component_el_form = resolveComponent("el-form");
- const _component_el_divider = resolveComponent("el-divider");
- const _component_el_col = resolveComponent("el-col");
- return openBlock(), createElementBlock("div", _hoisted_1, [
- createVNode(_component_el_row, {
- class: "view-title",
- align: "middle",
- justify: "center",
- style: { "font-size": "20px", "color": "black" }
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_SETTING_TITLE")), 1)
- ]),
- _: 1
- }),
- createVNode(_component_el_row, { class: "setting-list" }, {
- default: withCtx(() => [
- createVNode(_component_el_col, {
- span: 20,
- offset: 2
- }, {
- default: withCtx(() => [
- createVNode(_component_el_row, { style: { "width": "100%" } }, {
- default: withCtx(() => [
- createVNode(_component_el_form, {
- "label-position": "left",
- "label-width": "50%",
- size: "default",
- style: { "position": "relative", "width": "100%" }
- }, {
- default: withCtx(() => [
- createVNode(_component_el_form_item, null, {
- label: withCtx(() => [
- createBaseVNode("span", _hoisted_2, [
- createBaseVNode("span", null, toDisplayString(unref(T)("MANAGE_SETTING_CLEAR_CACHE_TITLE")), 1),
- createBaseVNode("span", _hoisted_3, toDisplayString(unref(formatFileSize)(dbSize.value) === "" ? 0 : unref(formatFileSize)(dbSize.value)), 1),
- createBaseVNode("span", null, " " + toDisplayString(unref(T)("MANAGE_SETTING_CLEAR_CACHE_FREE_TITLE")), 1),
- createBaseVNode("span", _hoisted_4, toDisplayString(dbSizeAvailableRate.value) + " %", 1),
- createVNode(_component_el_tooltip, {
- effect: "dark",
- content: unref(T)("MANAGE_SETTING_CLEAR_CACHE_TIPS"),
- placement: "right",
- persistent: false,
- teleported: ""
- }, {
- default: withCtx(() => [
- createVNode(_component_el_icon, null, {
- default: withCtx(() => [
- createVNode(unref(info_filled_default))
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["content"])
- ])
- ]),
- default: withCtx(() => [
- createVNode(_component_el_popconfirm, {
- title: unref(T)("MANAGE_SETTING_CLEAR_CACHE_PROMPT"),
- "confirm-button-text": unref(T)("CONFIRM"),
- "cancel-button-text": unref(T)("CANCEL"),
- "hide-icon": "",
- persistent: false,
- teleported: "",
- onConfirm: handleClearDb
- }, {
- reference: withCtx(() => [
- createVNode(_component_el_button, {
- type: "primary",
- plain: "",
- style: { "position": "absolute", "right": "0" }
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_SETTING_CLEAR_CACHE_BUTTON")), 1)
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["title", "confirm-button-text", "cancel-button-text"])
- ]),
- _: 1
- }),
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(switchFieldsConfigList), (item) => {
- return openBlock(), createBlock(_sfc_main$1, {
- key: item.configName,
- modelValue: form.value[item.configName],
- "onUpdate:modelValue": ($event) => form.value[item.configName] = $event,
- segments: item.segments,
- tooltip: item.tooltip,
- "config-name": item.configName,
- "active-text": item.activeText,
- "inactive-text": item.inactiveText
- }, null, 8, ["modelValue", "onUpdate:modelValue", "segments", "tooltip", "config-name", "active-text", "inactive-text"]);
- }), 128)),
- form.value.customRename ? (openBlock(), createBlock(_component_el_link, {
- key: 0,
- style: { "margin-top": "10px", "margin-bottom": "10px", "color": "#409eff" },
- underline: false
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_SETTING_CUSTOM_PATTERN_TITLE")), 1)
- ]),
- _: 1
- })) : createCommentVNode("", true),
- form.value.customRename ? (openBlock(), createBlock(_component_el_input, {
- key: 1,
- modelValue: form.value.customRenameFormat,
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => form.value.customRenameFormat = $event),
- placeholder: unref(T)("MANAGE_SETTING_CUSTOM_PATTERN_TIPS"),
- style: { "width": "100%" }
- }, null, 8, ["modelValue", "placeholder"])) : createCommentVNode("", true),
- form.value.customRename ? (openBlock(), createBlock(_component_el_table, {
- key: 2,
- data: unref(customRenameFormatTable),
- style: { "width": "100%", "margin-top": "10px", "margin-left": "10%" },
- "header-cell-style": { "text-align": "center" },
- "cell-style": { "text-align": "center" },
- onCellClick: handleCellClick
- }, {
- default: withCtx(() => [
- (openBlock(), createElementBlock(Fragment, null, renderList(["placeholder", "description", "placeholderB", "descriptionB"], (prop) => {
- return createVNode(_component_el_table_column, {
- key: prop,
- prop,
- label: unref(T)("MANAGE_SETTING_CUSTOM_PATTERN_TABLE_TITLE"),
- width: "150"
- }, null, 8, ["prop", "label"]);
- }), 64))
- ]),
- _: 1
- }, 8, ["data"])) : createCommentVNode("", true),
- form.value.customRename ? (openBlock(), createElementBlock("br", _hoisted_5)) : createCommentVNode("", true),
- (openBlock(), createElementBlock(Fragment, null, renderList(switchFieldsSpecialList, (item) => {
- return createVNode(_sfc_main$1, {
- key: item.configName,
- modelValue: form.value[item.configName],
- "onUpdate:modelValue": ($event) => form.value[item.configName] = $event,
- segments: item.segments,
- tooltip: item.tooltip,
- "config-name": item.configName
- }, null, 8, ["modelValue", "onUpdate:modelValue", "segments", "tooltip", "config-name"]);
- }), 64)),
- createVNode(_component_el_form_item, null, {
- label: withCtx(() => [
- createBaseVNode("span", _hoisted_6, [
- createTextVNode(toDisplayString(unref(T)("MANAGE_SETTING_MAX_DOWNLOAD_FILE_SIZE_TITLE")) + " ", 1),
- createVNode(_component_el_tooltip, {
- effect: "dark",
- content: unref(T)("MANAGE_SETTING_MAX_DOWNLOAD_FILE_SIZE_TIPS"),
- placement: "right",
- persistent: false,
- teleported: ""
- }, {
- default: withCtx(() => [
- createVNode(_component_el_icon, null, {
- default: withCtx(() => [
- createVNode(unref(info_filled_default))
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["content"])
- ])
- ]),
- default: withCtx(() => [
- createVNode(_component_el_input_number, {
- modelValue: form.value.maxDownloadFileCount,
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => form.value.maxDownloadFileCount = $event),
- style: { "position": "absolute", "right": "0" },
- placeholder: unref(T)("MANAGE_SETTING_MAX_DOWNLOAD_FILE_SIZE_INPUT_TIPS"),
- min: 1,
- max: 9999,
- step: 1
- }, null, 8, ["modelValue", "placeholder"])
- ]),
- _: 1
- }),
- createVNode(_component_el_form_item, null, {
- label: withCtx(() => [
- createBaseVNode("span", _hoisted_7, [
- createTextVNode(toDisplayString(unref(T)("MANAGE_SETTING_PRESIGNED_URL_EXPIRE_TITLE")) + " ", 1),
- createVNode(_component_el_tooltip, {
- effect: "dark",
- content: unref(T)("MANAGE_SETTING_PRESIGNED_URL_EXPIRE_TIPS"),
- placement: "right",
- persistent: false,
- teleported: ""
- }, {
- default: withCtx(() => [
- createVNode(_component_el_icon, null, {
- default: withCtx(() => [
- createVNode(unref(info_filled_default))
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["content"])
- ])
- ]),
- default: withCtx(() => [
- createVNode(_component_el_input_number, {
- modelValue: form.value.PreSignedExpire,
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => form.value.PreSignedExpire = $event),
- style: { "position": "absolute", "right": "0" },
- placeholder: unref(T)("MANAGE_SETTING_PRESIGNED_URL_EXPIRE_TIPS"),
- min: 1,
- step: 1
- }, null, 8, ["modelValue", "placeholder"])
- ]),
- _: 1
- }),
- createVNode(_component_el_link, {
- style: { "margin-top": "10px", "margin-bottom": "10px", "color": "#409eff" },
- underline: false
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_SETTING_CHOOSE_COPY_FORMAT_TITLE")), 1)
- ]),
- _: 1
- }),
- _cache[6] || (_cache[6] = createBaseVNode("br", null, null, -1)),
- createVNode(_component_el_radio_group, {
- modelValue: form.value.pasteFormat,
- "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => form.value.pasteFormat = $event)
- }, {
- default: withCtx(() => [
- (openBlock(), createElementBlock(Fragment, null, renderList(pasteFormatList, (item) => {
- return createVNode(_component_el_radio, {
- key: item,
- value: item
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)(`MANAGE_SETTING_CHOOSE_COPY_FORMAT_${item.toUpperCase().replace(/-/g, "_")}`)), 1)
- ]),
- _: 2
- }, 1032, ["value"]);
- }), 64))
- ]),
- _: 1
- }, 8, ["modelValue"]),
- form.value.pasteFormat === "custom" ? (openBlock(), createBlock(_component_el_link, {
- key: 4,
- style: { "margin-top": "10px", "margin-bottom": "10px", "color": "#409eff" },
- underline: false
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_SETTING_CUSTOM_COPY_FORMAT_TITLE")), 1)
- ]),
- _: 1
- })) : createCommentVNode("", true),
- form.value.pasteFormat === "custom" ? (openBlock(), createBlock(_component_el_input, {
- key: 5,
- modelValue: form.value.customPasteFormat,
- "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => form.value.customPasteFormat = $event),
- placeholder: unref(T)("MANAGE_SETTING_CUSTOM_COPY_FORMAT_TIPS"),
- style: { "width": "100%" }
- }, null, 8, ["modelValue", "placeholder"])) : createCommentVNode("", true),
- createBaseVNode("div", null, [
- createVNode(_component_el_link, {
- style: { "margin-top": "10px", "margin-bottom": "10px", "color": "#409eff" },
- underline: false
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_SETTING_CHOOSE_DOWNLOAD_FOLDER_TITLE")), 1)
- ]),
- _: 1
- })
- ]),
- createVNode(_component_el_input, {
- modelValue: form.value.downloadDir,
- "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => form.value.downloadDir = $event),
- disabled: "",
- placeholder: unref(T)("MANAGE_SETTING_CHOOSE_DOWNLOAD_FOLDER_TIPS"),
- style: { "width": "100%", "margin-top": "10px" }
- }, {
- append: withCtx(() => [
- createVNode(_component_el_button, {
- type: "primary",
- onClick: handleDownloadDirClick
- }, {
- default: withCtx(() => [
- createVNode(_component_el_icon, null, {
- default: withCtx(() => [
- createVNode(unref(folder_default))
- ]),
- _: 1
- }),
- createTextVNode(" " + toDisplayString(unref(T)("MANAGE_SETTING_CHOOSE_DOWNLOAD_FOLDER_BUTTON")), 1)
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["modelValue", "placeholder"])
- ]),
- _: 1,
- __: [6]
- }),
- createVNode(_component_el_divider, { "border-style": "none" })
- ]),
- _: 1
- })
- ]),
- _: 1
- })
- ]),
- _: 1
- })
- ]);
- };
- }
-});
-export {
- _sfc_main as default
-};
diff --git a/dist/renderer/assets/MiniPage-Cu5L_RYi.js b/dist/renderer/assets/MiniPage-Cu5L_RYi.js
deleted file mode 100644
index 523882b4..00000000
--- a/dist/renderer/assets/MiniPage-Cu5L_RYi.js
+++ /dev/null
@@ -1,182 +0,0 @@
-import { d as defineComponent, r as ref, o as onBeforeMount, D as watch, s as sendRPC, j as IRPCActionType, b as onBeforeUnmount, c as createElementBlock, e as openBlock, f as createBaseVNode, g as createCommentVNode, x as withModifiers, E as normalizeStyle, n as normalizeClass, u as unref, H as osGlobal, k as getConfig, m as triggerRPC, J as ElMessage, T } from "./index-BqdcQlNn.js";
-import { i as isUrl } from "./common-DNjr697i.js";
-const _hoisted_1 = { id: "mini-page" };
-const _hoisted_2 = ["src"];
-const __default__ = {
- name: "MiniPage"
-};
-const _sfc_main = /* @__PURE__ */ defineComponent({
- ...__default__,
- setup(__props) {
- const logoPath = ref("");
- const dragover = ref(false);
- const progress = ref(0);
- const isShowingProgress = ref(false);
- const draggingState = ref(false);
- const wX = ref(-1);
- const wY = ref(-1);
- const screenX = ref(-1);
- const screenY = ref(-1);
- async function initLogoPath() {
- const config = await getConfig();
- if (config) {
- if (config.settings?.isCustomMiniIcon && config.settings?.customMiniIcon) {
- logoPath.value = "data:image/jpg;base64," + await triggerRPC(IRPCActionType.MANAGE_CONVERT_PATH_TO_BASE64, config.settings.customMiniIcon);
- }
- }
- }
- onBeforeMount(async () => {
- await initLogoPath();
- window.electron.electronAPI.ipcRenderer.on("uploadProgress", (_, _progress) => {
- if (_progress !== -1) {
- isShowingProgress.value = true;
- progress.value = _progress;
- } else {
- progress.value = 100;
- }
- });
- window.electron.electronAPI.ipcRenderer.on("updateMiniIcon", async () => {
- await initLogoPath();
- });
- window.addEventListener("mousedown", handleMouseDown, false);
- window.addEventListener("mousemove", handleMouseMove, false);
- window.addEventListener("mouseup", handleMouseUp, false);
- });
- watch(progress, (val) => {
- if (val === 100) {
- setTimeout(() => {
- isShowingProgress.value = false;
- }, 1e3);
- setTimeout(() => {
- progress.value = 0;
- }, 1200);
- }
- });
- function onDrop(e) {
- dragover.value = false;
- if (e.dataTransfer?.files?.length) {
- ipcSendFiles(e.dataTransfer.files);
- } else if (e.dataTransfer?.items) {
- const items = e.dataTransfer.items;
- if (items.length === 2 && items[0].type === "text/uri-list") {
- handleURLDrag(items, e.dataTransfer);
- } else if (items[0].type === "text/plain") {
- const str = e.dataTransfer.getData(items[0].type);
- if (isUrl(str)) {
- sendRPC(IRPCActionType.UPLOAD_CHOOSED_FILES, [{ path: str }]);
- } else {
- ElMessage.error(T("TIPS_DRAG_VALID_PICTURE_OR_URL"));
- }
- }
- }
- }
- function handleURLDrag(items, dataTransfer) {
- const urlString = dataTransfer.getData(items[1].type);
- const urlMatch = urlString.match(/ {
- const obj = {
- name: item.name,
- path: item.webkitRelativePath
- };
- sendFiles.push(obj);
- });
- sendRPC(IRPCActionType.UPLOAD_CHOOSED_FILES, sendFiles);
- }
- function handleMouseDown(e) {
- draggingState.value = true;
- wX.value = e.pageX;
- wY.value = e.pageY;
- screenX.value = e.screenX;
- screenY.value = e.screenY;
- }
- function handleMouseMove(e) {
- e.preventDefault();
- e.stopPropagation();
- if (draggingState.value) {
- const xLoc = e.screenX - wX.value;
- const yLoc = e.screenY - wY.value;
- sendRPC(IRPCActionType.SET_MINI_WINDOW_POS, {
- x: xLoc,
- y: yLoc,
- width: 64,
- height: 64
- });
- }
- }
- function handleMouseUp(e) {
- draggingState.value = false;
- if (screenX.value === e.screenX && screenY.value === e.screenY) {
- if (e.button === 0) {
- openUploadWindow();
- } else {
- openContextMenu();
- }
- }
- }
- function openContextMenu() {
- sendRPC(IRPCActionType.SHOW_MINI_PAGE_MENU);
- }
- onBeforeUnmount(() => {
- window.electron.electronAPI.ipcRenderer.removeAllListeners("uploadProgress");
- window.electron.electronAPI.ipcRenderer.removeAllListeners("updateMiniIcon");
- window.removeEventListener("mousedown", handleMouseDown, false);
- window.removeEventListener("mousemove", handleMouseMove, false);
- window.removeEventListener("mouseup", handleMouseUp, false);
- });
- return (_ctx, _cache) => {
- return openBlock(), createElementBlock("div", _hoisted_1, [
- createBaseVNode("div", {
- id: "upload-area",
- class: normalizeClass({
- "is-dragover": dragover.value,
- uploading: isShowingProgress.value,
- linux: unref(osGlobal) === "linux"
- }),
- style: normalizeStyle({ backgroundPosition: "0 " + progress.value + "%" }),
- onDrop: withModifiers(onDrop, ["prevent"]),
- onDragover: _cache[0] || (_cache[0] = withModifiers(($event) => dragover.value = true, ["prevent"])),
- onDragleave: _cache[1] || (_cache[1] = withModifiers(($event) => dragover.value = false, ["prevent"]))
- }, [
- !dragover.value && !isShowingProgress.value ? (openBlock(), createElementBlock("img", {
- key: 0,
- src: logoPath.value ? logoPath.value : require("../assets/squareLogo.png"),
- style: { "width": "100%", "height": "100%", "border-radius": "50%" }
- }, null, 8, _hoisted_2)) : createCommentVNode("", true),
- createBaseVNode("div", {
- id: "upload-dragger",
- onDblclick: openUploadWindow
- }, [
- createBaseVNode("input", {
- id: "file-uploader",
- type: "file",
- multiple: "",
- onChange
- }, null, 32)
- ], 32)
- ], 38)
- ]);
- };
- }
-});
-export {
- _sfc_main as default
-};
diff --git a/dist/renderer/assets/MiniPage-e-N9dAYG.css b/dist/renderer/assets/MiniPage-e-N9dAYG.css
deleted file mode 100644
index 6fe3d393..00000000
--- a/dist/renderer/assets/MiniPage-e-N9dAYG.css
+++ /dev/null
@@ -1,43 +0,0 @@
-#mini-page {
- background: #409eff;
- color: #fff;
- height: 100vh;
- width: 100vw;
- border-radius: 50%;
- text-align: center;
- line-height: 100vh;
- font-size: 40px;
- background-size: 90vh 90vw;
- background-position: center center;
- background-repeat: no-repeat;
- position: relative;
- border: 4px solid #fff;
- box-sizing: border-box;
- cursor: pointer;
-}
-#mini-page.linux {
- border-radius: 0;
- background-size: 100vh 100vw;
-}
-#mini-page #upload-area {
- height: 100%;
- width: 100%;
- border-radius: 50%;
- transition: all 0.2s ease-in-out;
-}
-#mini-page #upload-area.linux {
- border-radius: 0;
-}
-#mini-page #upload-area.uploading {
- background: linear-gradient(to top, #409eff 50%, #fff 51%);
- background-size: 200%;
-}
-#mini-page #upload-area #upload-dragger {
- height: 100%;
-}
-#mini-page #upload-area.is-dragover {
- background: rgba(0,0,0,0.3);
-}
-#mini-page #file-uploader {
- display: none;
-}
diff --git a/dist/renderer/assets/PicGoSetting-BLDICmxR.js b/dist/renderer/assets/PicGoSetting-BLDICmxR.js
deleted file mode 100644
index d4719a92..00000000
--- a/dist/renderer/assets/PicGoSetting-BLDICmxR.js
+++ /dev/null
@@ -1,2854 +0,0 @@
-import { d as defineComponent, r as ref, b9 as i18nManager, ba as ISartMode, T, am as computed, a3 as picBedGlobal, a as reactive, o as onBeforeMount, k as getConfig, H as osGlobal, af as saveConfig, p as configPaths, j as IRPCActionType, c as createElementBlock, e as openBlock, q as createVNode, v as withCtx, y as resolveComponent, u as unref, D as watch, ag as pkg, s as sendRPC, B as createTextVNode, t as toDisplayString, bb as reading_default, bc as ElForm, N as createBlock, g as createCommentVNode, F as Fragment, h as renderList, a8 as info_filled_default, f as createBaseVNode, A as close_default, aJ as edit_default, bd as toRaw, ae as ElMessageBox, m as triggerRPC, J as ElMessage, U as updatePicBedGlobal, ad as II18nLanguage, Q as useRouter, be as SHORTKEY_PAGE } from "./index-BqdcQlNn.js";
-import { _ as _sfc_main$1 } from "./ImageProcessSetting.vue_vue_type_script_setup_true_lang-DFtMAQE7.js";
-import { j as buildInRenameFormatTable } from "./common-REXFY3_s.js";
-import { R as RELEASE_URL, b as RELEASE_URL_BACKUP } from "./static-DltyNkMh.js";
-import { e as enforceNumber } from "./common-DNjr697i.js";
-import "./dataSender-Bg45AIFL.js";
-const semver = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i;
-const validateAndParse = (version) => {
- if (typeof version !== "string") {
- throw new TypeError("Invalid argument expected string");
- }
- const match = version.match(semver);
- if (!match) {
- throw new Error(`Invalid argument not valid semver ('${version}' received)`);
- }
- match.shift();
- return match;
-};
-const isWildcard = (s) => s === "*" || s === "x" || s === "X";
-const tryParse = (v) => {
- const n = parseInt(v, 10);
- return isNaN(n) ? v : n;
-};
-const forceType = (a, b) => typeof a !== typeof b ? [String(a), String(b)] : [a, b];
-const compareStrings = (a, b) => {
- if (isWildcard(a) || isWildcard(b))
- return 0;
- const [ap, bp] = forceType(tryParse(a), tryParse(b));
- if (ap > bp)
- return 1;
- if (ap < bp)
- return -1;
- return 0;
-};
-const compareSegments = (a, b) => {
- for (let i = 0; i < Math.max(a.length, b.length); i++) {
- const r = compareStrings(a[i] || "0", b[i] || "0");
- if (r !== 0)
- return r;
- }
- return 0;
-};
-const compareVersions = (v1, v2) => {
- const n1 = validateAndParse(v1);
- const n2 = validateAndParse(v2);
- const p1 = n1.pop();
- const p2 = n2.pop();
- const r = compareSegments(n1, n2);
- if (r !== 0)
- return r;
- if (p1 && p2) {
- return compareSegments(p1.split("."), p2.split("."));
- } else if (p1 || p2) {
- return p1 ? -1 : 1;
- }
- return 0;
-};
-const compare = (v1, v2, operator) => {
- assertValidOperator(operator);
- const res = compareVersions(v1, v2);
- return operatorResMap[operator].includes(res);
-};
-const operatorResMap = {
- ">": [1],
- ">=": [0, 1],
- "=": [0],
- "<=": [-1, 0],
- "<": [-1],
- "!=": [-1, 1]
-};
-const allowedOperators = Object.keys(operatorResMap);
-const assertValidOperator = (op) => {
- if (allowedOperators.indexOf(op) === -1) {
- throw new Error(`Invalid operator, expected one of ${allowedOperators.join("|")}`);
- }
-};
-const getLatestVersion = async () => {
- try {
- const { data: normalList } = await window.node.axios.get(RELEASE_URL);
- return normalList[0].name;
- } catch (err) {
- console.error("Error fetching latest version: ", err);
- try {
- const { data } = await window.node.axios.get(`${RELEASE_URL_BACKUP}/latest.yml`);
- const r = window.node.yaml.load(data);
- return r.version;
- } catch (err2) {
- console.error("Error fetching backup latest version: ", err2);
- return "";
- }
- }
-};
-const _hoisted_1 = { id: "piclist-setting" };
-const _hoisted_2 = { class: "custom-title" };
-const _hoisted_3 = { key: 0 };
-const _hoisted_4 = { style: { "margin-top": "10px", "align-items": "center", "display": "flex", "justify-content": "flex-end" } };
-const _hoisted_5 = { class: "notice-text" };
-const _hoisted_6 = { class: "notice-text" };
-const _hoisted_7 = {
- class: "notice-text",
- style: { "align-items": "center", "display": "flex", "justify-content": "center" }
-};
-const __default__ = {
- name: "SettingPage"
-};
-const _sfc_main = /* @__PURE__ */ defineComponent({
- ...__default__,
- setup(__props) {
- const $router = useRouter();
- const activeName = ref("system");
- const shortUrlServerList = [
- {
- label: "c1n",
- value: "c1n"
- },
- {
- label: "yourls",
- value: "yourls"
- },
- {
- label: "xyTom/Url-Shorten-Worker",
- value: "cf_worker"
- },
- {
- label: "ccbikai/Sink",
- value: "sink"
- }
- ];
- const languageList = i18nManager.languageList.map((item) => ({
- label: item.label,
- value: item.value
- }));
- const startModeList = Object.values(ISartMode).map((item) => ({
- label: T(`SETTINGS_START_MODE_${item.toUpperCase().replace(/-/g, "_")}`),
- value: item
- }));
- const manualPageOpenList = [
- {
- label: T("MANUAL_PAGE_OPEN_BY_BUILD_IN"),
- value: "window"
- },
- {
- label: T("MANUAL_PAGE_OPEN_BY_BROWSER"),
- value: "browser"
- }
- ];
- const showPicBedList = computed(
- () => picBedGlobal.value.map((item) => {
- if (item.visible) {
- return item.name;
- }
- return null;
- }).filter((item) => item)
- );
- const $customLink = ref(null);
- const customLinkRule = (_, value, callback) => {
- if (!/\$url/.test(value) && !/\$fileName/.test(value) && !/\$extName/.test(value)) {
- return callback(new Error(T("TIPS_MUST_CONTAINS_URL")));
- } else {
- return callback();
- }
- };
- const formOfSetting = ref({
- showUpdateTip: true,
- autoStart: false,
- rename: false,
- autoRename: false,
- uploadNotification: false,
- uploadResultNotification: true,
- miniWindowOntop: false,
- autoCloseMiniWindow: false,
- autoCloseMainWindow: false,
- logLevel: ["all"],
- autoCopy: true,
- useBuiltinClipboard: true,
- logFileSizeLimit: 10,
- deleteCloudFile: false,
- isCustomMiniIcon: false,
- customMiniIcon: "",
- isHideDock: false,
- autoImport: false,
- autoImportPicBed: [],
- encodeOutputURL: false,
- isAutoListenClipboard: false,
- useShortUrl: false,
- shortUrlServer: "c1n",
- c1nToken: "",
- yourlsDomain: "",
- yourlsSignature: "",
- cfWorkerHost: "",
- sinkDomain: "",
- sinkToken: "",
- deleteLocalFile: false,
- serverKey: "",
- aesPassword: "PicList-aesPassword",
- enableWebServer: false,
- webServerHost: "0.0.0.0",
- webServerPort: 37777,
- webServerPath: "",
- registry: "",
- proxy: "",
- mainWindowWidth: 1200,
- mainWindowHeight: 800,
- enableSecondUploader: false
- });
- const proxy = ref("");
- const formKeys = Object.keys(formOfSetting.value);
- const autoWatchKeys = [
- "showUpdateTip",
- "autoImport",
- "autoImportPicBed",
- "useBuiltinClipboard",
- "isAutoListenClipboard",
- "deleteCloudFile",
- "deleteLocalFile",
- "rename",
- "autoRename",
- "enableWebServer",
- "webServerHost",
- "webServerPath",
- "serverKey",
- "uploadNotification",
- "uploadResultNotification",
- "autoCloseMainWindow",
- "autoCloseMiniWindow",
- "isCustomMiniIcon",
- "c1nToken",
- "yourlsDomain",
- "yourlsSignature",
- "cfWorkerHost",
- "sinkDomain",
- "sinkToken",
- "registry",
- "proxy",
- "autoCopy",
- "encodeOutputURL",
- "useShortUrl",
- "enableSecondUploader"
- ];
- const addWatch = () => {
- autoWatchKeys.forEach((key) => {
- watch(
- () => formOfSetting.value[key],
- (value) => {
- saveConfig({
- [`settings.${key}`]: value
- });
- }
- );
- });
- };
- const addProxyWatch = () => {
- watch(proxy, (value) => {
- saveConfig({
- "picBed.proxy": value
- });
- });
- };
- const valueToOptionItem = (value, list) => {
- return list.find((item) => item.value === value) || list[0];
- };
- const currentLanguage = ref();
- const currentStartMode = ref();
- const currentManualPageOpen = ref();
- const currentShortUrlServer = ref();
- const logFileVisible = ref(false);
- const customLinkVisible = ref(false);
- const checkUpdateVisible = ref(false);
- const serverVisible = ref(false);
- const webServerVisible = ref(false);
- const syncVisible = ref(false);
- const upDownConfigVisible = ref(false);
- const proxyVisible = ref(false);
- const mainWindowSizeVisible = ref(false);
- const advancedRenameVisible = ref(false);
- const imageProcessDialogVisible = ref(false);
- const rawPicGoSize = ref(false);
- const customLink = reactive({
- value: ""
- });
- const rules = reactive({
- value: [{ validator: customLinkRule, trigger: "blur" }]
- });
- const logLevel = {
- all: T("SETTINGS_LOG_LEVEL_ALL"),
- success: T("SETTINGS_LOG_LEVEL_SUCCESS"),
- error: T("SETTINGS_LOG_LEVEL_ERROR"),
- info: T("SETTINGS_LOG_LEVEL_INFO"),
- warn: T("SETTINGS_LOG_LEVEL_WARN"),
- none: T("SETTINGS_LOG_LEVEL_NONE")
- };
- const server = ref({
- port: 36677,
- host: "0.0.0.0",
- enable: true
- });
- const advancedRename = ref({
- enable: false,
- format: "{filename}"
- });
- const sync = ref({
- type: "github",
- username: "",
- repo: "",
- branch: "",
- token: "",
- endpoint: "",
- proxy: "",
- interval: 60,
- // WebDAV-specific fields
- password: "",
- authType: "basic",
- sslEnabled: true,
- webdavSavePath: ""
- });
- const syncType = ["github", "gitee", "gitea", "webdav"];
- async function cancelSyncSetting() {
- syncVisible.value = false;
- sync.value = await getConfig(configPaths.settings.sync) || {
- type: "github",
- username: "",
- repo: "",
- branch: "",
- token: "",
- endpoint: "",
- proxy: "",
- interval: 60,
- // WebDAV-specific fields
- webdavEndpoint: "",
- webdavUsername: "",
- webdavPassword: "",
- webdavAuthType: "basic",
- webdavSslEnabled: true,
- webdavSavePath: ""
- };
- }
- function confirmSyncSetting() {
- saveConfig({
- [configPaths.settings.sync]: sync.value
- });
- syncVisible.value = false;
- }
- const version = pkg.version;
- const latestVersion = ref("");
- const needUpdate = computed(() => {
- if (latestVersion.value) {
- return compareVersion2Update(version, latestVersion.value);
- }
- return false;
- });
- onBeforeMount(() => {
- initData();
- });
- async function initData() {
- const config = await getConfig() || {};
- const settings = config.settings || {};
- const picBed = config.picBed;
- formKeys.forEach((key) => {
- formOfSetting.value[key] = settings[key] ?? formOfSetting.value[key];
- });
- formOfSetting.value.logLevel = initArray(settings.logLevel || [], ["all"]);
- formOfSetting.value.autoImportPicBed = initArray(settings.autoImportPicBed || [], []);
- currentLanguage.value = valueToOptionItem(settings.language || "zh-CN", languageList);
- currentStartMode.value = valueToOptionItem(settings.startMode || ISartMode.QUIET, startModeList);
- if (osGlobal.value === "darwin" && currentStartMode.value.value === ISartMode.MINI) {
- currentStartMode.value = valueToOptionItem(ISartMode.QUIET, startModeList);
- saveConfig(configPaths.settings.startMode, ISartMode.QUIET);
- }
- currentManualPageOpen.value = valueToOptionItem(settings.manualPageOpen || "window", manualPageOpenList);
- currentShortUrlServer.value = valueToOptionItem(settings.shortUrlServer || "c1n", shortUrlServerList);
- customLink.value = settings.customLink || "";
- proxy.value = picBed.proxy || "";
- server.value = settings.server || {
- port: 36677,
- host: "0.0.0.0",
- enable: true
- };
- advancedRename.value = config.buildIn?.rename || {
- enable: false,
- format: "{filename}"
- };
- if (advancedRename.value.enable) {
- formOfSetting.value.autoRename = false;
- saveConfig({
- [configPaths.settings.autoRename]: false
- });
- }
- sync.value = settings.sync || {
- type: "github",
- username: "",
- repo: "",
- branch: "",
- token: "",
- endpoint: "",
- proxy: "",
- interval: 60,
- // WebDAV-specific fields
- webdavEndpoint: "",
- webdavUsername: "",
- webdavPassword: "",
- webdavAuthType: "basic",
- webdavSslEnabled: true,
- webdavSavePath: ""
- };
- formOfSetting.value.logFileSizeLimit = enforceNumber(settings.logFileSizeLimit) || 10;
- addProxyWatch();
- addWatch();
- }
- function initArray(arrayT, defaultValue) {
- if (!Array.isArray(arrayT)) {
- if (arrayT && arrayT.length > 0) {
- arrayT = [arrayT];
- } else {
- arrayT = defaultValue;
- }
- }
- return arrayT;
- }
- async function handleChangeSecondPicBed() {
- sendRPC(IRPCActionType.SHOW_SECOND_UPLOADER_MENU);
- }
- function openFile(file) {
- sendRPC(IRPCActionType.PICLIST_OPEN_FILE, file);
- }
- function handleManualPageOpenChange(val) {
- saveConfig({
- [configPaths.settings.manualPageOpen]: val
- });
- }
- function openDirectory(directory, inStorePath = true) {
- sendRPC(IRPCActionType.PICLIST_OPEN_DIRECTORY, directory, inStorePath);
- }
- function openLogSetting() {
- logFileVisible.value = true;
- }
- async function cancelCustomLink() {
- customLinkVisible.value = false;
- customLink.value = await getConfig(configPaths.settings.customLink) || "";
- }
- function confirmCustomLink() {
- $customLink.value?.validate((valid) => {
- if (valid) {
- saveConfig(configPaths.settings.customLink, customLink.value);
- customLinkVisible.value = false;
- }
- });
- }
- async function handleCancelAdvancedRename() {
- advancedRenameVisible.value = false;
- advancedRename.value = toRaw(
- await getConfig(configPaths.buildIn.rename) || {
- enable: false,
- format: "{filename}"
- }
- );
- }
- function handleSaveAdvancedRename() {
- saveConfig(configPaths.buildIn.rename, toRaw(advancedRename.value));
- if (advancedRename.value.enable) {
- formOfSetting.value.autoRename = false;
- saveConfig(configPaths.settings.autoRename, false);
- }
- advancedRenameVisible.value = false;
- }
- function handleMigrateFromPicGo() {
- ElMessageBox.confirm(T("SETTINGS_MIGRATE_FROM_PICGO_CONTENT"), T("SETTINGS_MIGRATE_FROM_PICGO_TITLE"), {
- confirmButtonText: T("CONFIRM"),
- cancelButtonText: T("CANCEL"),
- type: "warning",
- center: true
- }).then(() => {
- triggerRPC(IRPCActionType.CONFIGURE_MIGRATE_FROM_PICGO).then(() => {
- ElMessage.success(T("SETTINGS_MIGRATE_FROM_PICGO_SUCCESS"));
- }).catch(() => {
- ElMessage.error(T("SETTINGS_MIGRATE_FROM_PICGO_FAILED"));
- });
- }).catch(() => {
- return false;
- });
- }
- function handleHideDockChange(val) {
- if (val && currentStartMode.value.value === ISartMode.NO_TRAY) {
- ElMessage.warning(T("SETTINGS_ISHIDEDOCK_TIPS"));
- formOfSetting.value.isHideDock = false;
- return;
- }
- saveConfig(configPaths.settings.isHideDock, val);
- sendRPC(IRPCActionType.HIDE_DOCK, val);
- }
- function handleShowPicBedListChange(val) {
- const list = picBedGlobal.value.map((item) => {
- if (!val.includes(item.name)) {
- item.visible = false;
- } else {
- item.visible = true;
- }
- return item;
- });
- saveConfig({
- [configPaths.picBed.list]: list
- });
- updatePicBedGlobal();
- }
- function handleAutoStartChange(val) {
- saveConfig(configPaths.settings.autoStart, val);
- sendRPC(IRPCActionType.PICLIST_AUTO_START, val);
- }
- function compareVersion2Update(current, latest) {
- return compare(current, latest, "<");
- }
- async function checkUpdate() {
- checkUpdateVisible.value = true;
- latestVersion.value = await getLatestVersion() || T("TIPS_NETWORK_ERROR");
- }
- function confirmCheckVersion() {
- if (needUpdate.value) {
- sendRPC(IRPCActionType.RELOAD_APP);
- }
- checkUpdateVisible.value = false;
- }
- function cancelCheckVersion() {
- checkUpdateVisible.value = false;
- }
- function handleWebServerPortChange(val, _) {
- saveConfig(configPaths.settings.webServerPort, Number(val) || 37777);
- }
- function confirmWebServerSetting() {
- if (formOfSetting.value.enableWebServer) {
- sendRPC(IRPCActionType.ADVANCED_RESTART_WEB_SERVER);
- } else {
- sendRPC(IRPCActionType.ADVANCED_STOP_WEB_SERVER);
- }
- }
- async function getMainWindowSize() {
- formOfSetting.value.mainWindowWidth = await getConfig(configPaths.settings.mainWindowWidth) || 1200;
- formOfSetting.value.mainWindowHeight = await getConfig(configPaths.settings.mainWindowHeight) || 800;
- }
- async function cancelWindowSize() {
- mainWindowSizeVisible.value = false;
- await getMainWindowSize();
- }
- async function confirmWindowSize() {
- mainWindowSizeVisible.value = false;
- const width = enforceNumber(formOfSetting.value.mainWindowWidth);
- const height = enforceNumber(formOfSetting.value.mainWindowHeight);
- saveConfig({
- [configPaths.settings.mainWindowWidth]: rawPicGoSize.value ? 800 : width < 100 ? 100 : width,
- [configPaths.settings.mainWindowHeight]: rawPicGoSize.value ? 450 : height < 100 ? 100 : height
- });
- await getMainWindowSize();
- }
- function handleMiniWindowOntop(val) {
- saveConfig(configPaths.settings.miniWindowOntop, val);
- sendRPC(IRPCActionType.MINI_WINDOW_ON_TOP, val);
- }
- async function handleMiniIconPath(_) {
- const result = await triggerRPC(IRPCActionType.MANAGE_OPEN_FILE_SELECT_DIALOG);
- if (result && result[0]) {
- formOfSetting.value.customMiniIcon = result[0];
- saveConfig(configPaths.settings.customMiniIcon, formOfSetting.value.customMiniIcon);
- sendRPC(IRPCActionType.UPDATE_MINI_WINDOW_ICON, formOfSetting.value.customMiniIcon);
- }
- }
- function handleShortUrlServerChange(val) {
- formOfSetting.value.shortUrlServer = val;
- saveConfig(configPaths.settings.shortUrlServer, val);
- }
- function handleAesPasswordChange(val) {
- saveConfig(configPaths.settings.aesPassword, val || "PicList-aesPassword");
- }
- function confirmLogLevelSetting() {
- if (formOfSetting.value.logLevel.length === 0) {
- return ElMessage.error(T("TIPS_PLEASE_CHOOSE_LOG_LEVEL"));
- }
- saveConfig({
- [configPaths.settings.logLevel]: formOfSetting.value.logLevel,
- [configPaths.settings.logFileSizeLimit]: formOfSetting.value.logFileSizeLimit
- });
- logFileVisible.value = false;
- }
- async function cancelLogLevelSetting() {
- logFileVisible.value = false;
- let logLevel2 = await getConfig(configPaths.settings.logLevel);
- const logFileSizeLimit = await getConfig(configPaths.settings.logFileSizeLimit) || 10;
- if (!Array.isArray(logLevel2)) {
- if (logLevel2 && logLevel2.length > 0) {
- logLevel2 = [logLevel2];
- } else {
- logLevel2 = ["all"];
- }
- }
- formOfSetting.value.logLevel = logLevel2;
- formOfSetting.value.logFileSizeLimit = logFileSizeLimit;
- }
- function syncMessage(failed, taskType) {
- if (failed) {
- ElMessage.error(T(`SETTINGS_SYNC_${taskType}_FAILED`, { failed }));
- } else {
- ElMessage.success(T(`SETTINGS_SYNC_${taskType}_SUCCESS`));
- }
- }
- const syncTaskList = [
- {
- task: IRPCActionType.CONFIGURE_UPLOAD_COMMON_CONFIG,
- label: T("SETTINGS_SYNC_COMMON_CONFIG"),
- number: 2
- },
- {
- task: IRPCActionType.CONFIGURE_UPLOAD_MANAGE_CONFIG,
- label: T("SETTINGS_SYNC_MANAGE_CONFIG"),
- number: 2
- },
- {
- task: IRPCActionType.CONFIGURE_UPLOAD_ALL_CONFIG,
- label: T("SETTINGS_SYNC_UPLOAD_ALL"),
- number: 4
- },
- {
- task: IRPCActionType.CONFIGURE_DOWNLOAD_COMMON_CONFIG,
- label: T("SETTINGS_SYNC_COMMON_CONFIG"),
- number: 2
- },
- {
- task: IRPCActionType.CONFIGURE_DOWNLOAD_MANAGE_CONFIG,
- label: T("SETTINGS_SYNC_MANAGE_CONFIG"),
- number: 2
- },
- {
- task: IRPCActionType.CONFIGURE_DOWNLOAD_ALL_CONFIG,
- label: T("SETTINGS_SYNC_DOWNLOAD_ALL"),
- number: 4
- }
- ];
- async function syncTaskFn(task, number) {
- const failed = number - (await triggerRPC(task) || 0);
- syncMessage(failed, task.includes("UPLOAD") ? "UPLOAD" : "DOWNLOAD");
- }
- function confirmServerSetting() {
- server.value.port = parseInt(server.value.port, 10);
- saveConfig({
- [configPaths.settings.server]: server.value
- });
- serverVisible.value = false;
- sendRPC(IRPCActionType.ADVANCED_UPDATE_SERVER);
- }
- async function cancelServerSetting() {
- serverVisible.value = false;
- server.value = await getConfig(configPaths.settings.server) || {
- port: 36677,
- host: "0.0.0.0",
- enable: true
- };
- }
- function handleLevelDisabled(val) {
- const currentLevel = val;
- let flagLevel;
- const result = formOfSetting.value.logLevel.some((item) => {
- if (item === "all" || item === "none") {
- flagLevel = item;
- }
- return item === "all" || item === "none";
- });
- if (result) {
- if (currentLevel !== flagLevel) {
- return true;
- }
- } else if (formOfSetting.value.logLevel.length > 0) {
- if (val === "all" || val === "none") {
- return true;
- }
- }
- return false;
- }
- function handleLanguageChange(val) {
- i18nManager.setCurrentLanguage(val);
- saveConfig({
- [configPaths.settings.language]: val
- });
- updatePicBedGlobal();
- }
- function handleStartModeChange(val) {
- if (val === ISartMode.NO_TRAY) {
- if (formOfSetting.value.isHideDock) {
- ElMessage.warning(T("SETTINGS_ISHIDEDOCK_TIPS"));
- currentStartMode.value = valueToOptionItem(ISartMode.QUIET, startModeList);
- return;
- }
- ElMessage.info(T("TIPS_NEED_RELOAD"));
- }
- saveConfig({
- [configPaths.settings.startMode]: val
- });
- }
- async function goConfigPage() {
- const lang = await getConfig(configPaths.settings.language) || II18nLanguage.ZH_CN;
- const url = lang === II18nLanguage.ZH_CN ? "https://piclist.cn/configure.html" : "https://piclist.cn/en/configure.html";
- sendRPC(IRPCActionType.OPEN_URL, url);
- }
- function goShortCutPage() {
- $router.push({
- name: SHORTKEY_PAGE
- });
- }
- return (_ctx, _cache) => {
- const _component_el_icon = resolveComponent("el-icon");
- const _component_el_row = resolveComponent("el-row");
- const _component_el_option = resolveComponent("el-option");
- const _component_el_select = resolveComponent("el-select");
- const _component_el_form_item = resolveComponent("el-form-item");
- const _component_el_switch = resolveComponent("el-switch");
- const _component_el_button = resolveComponent("el-button");
- const _component_el_col = resolveComponent("el-col");
- const _component_el_tab_pane = resolveComponent("el-tab-pane");
- const _component_el_input = resolveComponent("el-input");
- const _component_el_tooltip = resolveComponent("el-tooltip");
- const _component_el_checkbox = resolveComponent("el-checkbox");
- const _component_el_checkbox_group = resolveComponent("el-checkbox-group");
- const _component_el_divider = resolveComponent("el-divider");
- const _component_el_tabs = resolveComponent("el-tabs");
- const _component_el_dialog = resolveComponent("el-dialog");
- const _component_el_link = resolveComponent("el-link");
- const _component_el_descriptions_item = resolveComponent("el-descriptions-item");
- const _component_el_descriptions = resolveComponent("el-descriptions");
- const _component_el_popover = resolveComponent("el-popover");
- const _component_el_input_number = resolveComponent("el-input-number");
- const _component_el_button_group = resolveComponent("el-button-group");
- return openBlock(), createElementBlock("div", _hoisted_1, [
- createVNode(_component_el_row, {
- class: "view-title",
- align: "middle",
- justify: "center"
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("PICLIST_SETTINGS")) + " - ", 1),
- createVNode(_component_el_icon, {
- class: "el-icon-document",
- onClick: goConfigPage
- }, {
- default: withCtx(() => [
- createVNode(unref(reading_default))
- ]),
- _: 1
- })
- ]),
- _: 1
- }),
- createVNode(_component_el_tabs, {
- modelValue: activeName.value,
- "onUpdate:modelValue": _cache[45] || (_cache[45] = ($event) => activeName.value = $event),
- stretch: "",
- style: { "height": "calc(100vh - 50px)", "width": "100%", "overflow-x": "hidden", "top": "50px", "position": "absolute" },
- "tab-position": "left",
- lazy: ""
- }, {
- default: withCtx(() => [
- createVNode(_component_el_tab_pane, {
- name: "system",
- label: unref(T)("SETTINGS_TAB_SYSTEM"),
- style: { "height": "calc(100vh - 50px)", "overflow-y": "scroll", "color": "#fff" }
- }, {
- default: withCtx(() => [
- createVNode(_component_el_row, { class: "setting-list" }, {
- default: withCtx(() => [
- createVNode(_component_el_col, {
- span: 22,
- offset: 1
- }, {
- default: withCtx(() => [
- createVNode(_component_el_row, { style: { "width": "100%" } }, {
- default: withCtx(() => [
- createVNode(unref(ElForm), {
- "label-position": "left",
- "label-width": "50%",
- size: "small"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_CHOOSE_LANGUAGE")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_select, {
- modelValue: currentLanguage.value,
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => currentLanguage.value = $event),
- size: "small",
- style: { "width": "50%" },
- placeholder: unref(T)("SETTINGS_CHOOSE_LANGUAGE"),
- persistent: false,
- teleported: "",
- onChange: handleLanguageChange
- }, {
- default: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(languageList), (item) => {
- return openBlock(), createBlock(_component_el_option, {
- key: item.value,
- label: item.label,
- value: item.value
- }, null, 8, ["label", "value"]);
- }), 128))
- ]),
- _: 1
- }, 8, ["modelValue", "placeholder"])
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_START_MODE")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_select, {
- modelValue: currentStartMode.value,
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => currentStartMode.value = $event),
- size: "small",
- style: { "width": "50%" },
- placeholder: unref(T)("SETTINGS_START_MODE"),
- persistent: false,
- teleported: "",
- onChange: handleStartModeChange
- }, {
- default: withCtx(() => [
- createVNode(_component_el_option, {
- key: "quiet",
- label: unref(T)("SETTINGS_START_MODE_QUIET"),
- value: "quiet"
- }, null, 8, ["label"]),
- unref(osGlobal) !== "darwin" ? (openBlock(), createBlock(_component_el_option, {
- key: "mini",
- label: unref(T)("SETTINGS_START_MODE_MINI"),
- value: "mini"
- }, null, 8, ["label"])) : createCommentVNode("", true),
- unref(osGlobal) === "darwin" ? (openBlock(), createBlock(_component_el_option, {
- key: "no-tray",
- label: unref(T)("SETTINGS_START_MODE_NO_TRAY"),
- value: "no-tray"
- }, null, 8, ["label"])) : createCommentVNode("", true),
- createVNode(_component_el_option, {
- key: "main",
- label: unref(T)("SETTINGS_START_MODE_MAIN"),
- value: "main"
- }, null, 8, ["label"])
- ]),
- _: 1
- }, 8, ["modelValue", "placeholder"])
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("MANUAL_PAGE_OPEN_SETTING_TIP")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_select, {
- modelValue: currentManualPageOpen.value,
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => currentManualPageOpen.value = $event),
- size: "small",
- style: { "width": "50%" },
- placeholder: unref(T)("MANUAL_PAGE_OPEN_SETTING_TIP"),
- persistent: false,
- teleported: "",
- onChange: handleManualPageOpenChange
- }, {
- default: withCtx(() => [
- (openBlock(), createElementBlock(Fragment, null, renderList(manualPageOpenList, (item) => {
- return createVNode(_component_el_option, {
- key: item.value,
- label: item.label,
- value: item.value
- }, null, 8, ["label", "value"]);
- }), 64))
- ]),
- _: 1
- }, 8, ["modelValue", "placeholder"])
- ]),
- _: 1
- }, 8, ["label"]),
- unref(osGlobal) === "darwin" ? (openBlock(), createBlock(_component_el_form_item, {
- key: 0,
- label: unref(T)("SETTINGS_ISHIDEDOCK")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: formOfSetting.value.isHideDock,
- "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => formOfSetting.value.isHideDock = $event),
- "active-text": unref(T)("SETTINGS_OPEN"),
- "inactive-text": unref(T)("SETTINGS_CLOSE"),
- onChange: handleHideDockChange
- }, null, 8, ["modelValue", "active-text", "inactive-text"])
- ]),
- _: 1
- }, 8, ["label"])) : createCommentVNode("", true),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_MAIN_WINDOW_SIZE")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_button, {
- type: "primary",
- round: "",
- size: "small",
- onClick: _cache[4] || (_cache[4] = ($event) => mainWindowSizeVisible.value = true)
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("SETTINGS_CLICK_TO_SET")), 1)
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["label"]),
- unref(osGlobal) !== "darwin" ? (openBlock(), createBlock(_component_el_form_item, {
- key: 1,
- label: unref(T)("SETTINGS_CLOSE_MINI_WINDOW_SYNC")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: formOfSetting.value.autoCloseMiniWindow,
- "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => formOfSetting.value.autoCloseMiniWindow = $event),
- "active-text": unref(T)("SETTINGS_OPEN"),
- "inactive-text": unref(T)("SETTINGS_CLOSE")
- }, null, 8, ["modelValue", "active-text", "inactive-text"])
- ]),
- _: 1
- }, 8, ["label"])) : createCommentVNode("", true),
- unref(osGlobal) !== "darwin" ? (openBlock(), createBlock(_component_el_form_item, {
- key: 2,
- label: unref(T)("SETTINGS_CLOSE_MAIN_WINDOW_SYNC")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: formOfSetting.value.autoCloseMainWindow,
- "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => formOfSetting.value.autoCloseMainWindow = $event),
- "active-text": unref(T)("SETTINGS_OPEN"),
- "inactive-text": unref(T)("SETTINGS_CLOSE")
- }, null, 8, ["modelValue", "active-text", "inactive-text"])
- ]),
- _: 1
- }, 8, ["label"])) : createCommentVNode("", true),
- unref(osGlobal) !== "darwin" ? (openBlock(), createBlock(_component_el_form_item, {
- key: 3,
- label: unref(T)("SETTINGS_MINI_WINDOW_ON_TOP")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: formOfSetting.value.miniWindowOntop,
- "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => formOfSetting.value.miniWindowOntop = $event),
- "active-text": unref(T)("SETTINGS_OPEN"),
- "inactive-text": unref(T)("SETTINGS_CLOSE"),
- onChange: handleMiniWindowOntop
- }, null, 8, ["modelValue", "active-text", "inactive-text"])
- ]),
- _: 1
- }, 8, ["label"])) : createCommentVNode("", true),
- unref(osGlobal) !== "darwin" ? (openBlock(), createBlock(_component_el_form_item, {
- key: 4,
- label: unref(T)("SETTINGS_CUSTOM_MINI_ICON")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: formOfSetting.value.isCustomMiniIcon,
- "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => formOfSetting.value.isCustomMiniIcon = $event),
- "active-text": unref(T)("SETTINGS_OPEN"),
- "inactive-text": unref(T)("SETTINGS_CLOSE")
- }, null, 8, ["modelValue", "active-text", "inactive-text"])
- ]),
- _: 1
- }, 8, ["label"])) : createCommentVNode("", true),
- unref(osGlobal) !== "darwin" && formOfSetting.value.isCustomMiniIcon ? (openBlock(), createBlock(_component_el_form_item, {
- key: 5,
- label: unref(T)("SETTINGS_CUSTOM_MINI_ICON_PATH")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_button, {
- type: "primary",
- round: "",
- size: "small",
- onClick: handleMiniIconPath
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("SETTINGS_CLICK_TO_SET")), 1)
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["label"])) : createCommentVNode("", true),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_LAUNCH_ON_BOOT")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: formOfSetting.value.autoStart,
- "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => formOfSetting.value.autoStart = $event),
- "active-text": unref(T)("SETTINGS_OPEN"),
- "inactive-text": unref(T)("SETTINGS_CLOSE"),
- onChange: handleAutoStartChange
- }, null, 8, ["modelValue", "active-text", "inactive-text"])
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_SET_SHORTCUT")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_button, {
- type: "primary",
- round: "",
- size: "small",
- onClick: goShortCutPage
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("SETTINGS_CLICK_TO_SET")), 1)
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["label"])
- ]),
- _: 1
- })
- ]),
- _: 1
- })
- ]),
- _: 1
- })
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_tab_pane, {
- name: "syncAndConfigure",
- label: unref(T)("SETTINGS_TAB_SYNC_CONFIG"),
- style: { "height": "calc(100vh - 50px)", "overflow-y": "scroll", "color": "#fff" }
- }, {
- default: withCtx(() => [
- createVNode(_component_el_row, { class: "setting-list" }, {
- default: withCtx(() => [
- createVNode(_component_el_col, {
- span: 22,
- offset: 1
- }, {
- default: withCtx(() => [
- createVNode(_component_el_row, { style: { "width": "100%" } }, {
- default: withCtx(() => [
- createVNode(unref(ElForm), {
- "label-position": "left",
- "label-width": "50%",
- size: "small"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_SYNC_CONFIG")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_button, {
- type: "primary",
- round: "",
- size: "small",
- onClick: _cache[10] || (_cache[10] = ($event) => syncVisible.value = true)
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("SETTINGS_CLICK_TO_SET")), 1)
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_UP_DOWN_DESC")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_button, {
- type: "primary",
- round: "",
- size: "small",
- onClick: _cache[11] || (_cache[11] = ($event) => upDownConfigVisible.value = true)
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("SETTINGS_CLICK_TO_SET")), 1)
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_MIGRATE_FROM_PICGO")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_button, {
- type: "primary",
- round: "",
- size: "small",
- onClick: handleMigrateFromPicGo
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("SETTINGS_CLICK_TO_SET")), 1)
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_OPEN_CONFIG_FILE")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_button, {
- type: "primary",
- round: "",
- size: "small",
- onClick: _cache[12] || (_cache[12] = ($event) => openFile("data.json"))
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("SETTINGS_CLICK_TO_OPEN")), 1)
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_CONFIG_FILE_PATH")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_button, {
- type: "primary",
- round: "",
- size: "small",
- onClick: _cache[13] || (_cache[13] = ($event) => openDirectory())
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("SETTINGS_CLICK_TO_OPEN")), 1)
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["label"])
- ]),
- _: 1
- })
- ]),
- _: 1
- })
- ]),
- _: 1
- })
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_tab_pane, {
- name: "upload",
- label: unref(T)("SETTINGS_TAB_UPLOAD"),
- style: { "height": "calc(100vh - 50px)", "overflow-y": "scroll", "color": "#fff" }
- }, {
- default: withCtx(() => [
- createVNode(_component_el_row, { class: "setting-list" }, {
- default: withCtx(() => [
- createVNode(_component_el_col, {
- span: 22,
- offset: 1
- }, {
- default: withCtx(() => [
- createVNode(_component_el_row, { style: { "width": "100%" } }, {
- default: withCtx(() => [
- createVNode(unref(ElForm), {
- "label-position": "left",
- "label-width": "50%",
- size: "small"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_AUTO_IMPORT")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: formOfSetting.value.autoImport,
- "onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => formOfSetting.value.autoImport = $event),
- "active-text": unref(T)("SETTINGS_OPEN"),
- "inactive-text": unref(T)("SETTINGS_CLOSE")
- }, null, 8, ["modelValue", "active-text", "inactive-text"])
- ]),
- _: 1
- }, 8, ["label"]),
- formOfSetting.value.autoImport ? (openBlock(), createBlock(_component_el_form_item, {
- key: 0,
- label: unref(T)("SETTINGS_AUTO_IMPORT_SELECT_PICBED")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_select, {
- modelValue: formOfSetting.value.autoImportPicBed,
- "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => formOfSetting.value.autoImportPicBed = $event),
- multiple: "",
- size: "small",
- style: { "width": "50%" },
- placeholder: unref(T)("SETTINGS_AUTO_IMPORT_SELECT_PICBED"),
- persistent: false,
- teleported: ""
- }, {
- default: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(picBedGlobal), (item) => {
- return openBlock(), createBlock(_component_el_option, {
- key: item.type,
- label: item.name,
- value: item.type
- }, null, 8, ["label", "value"]);
- }), 128))
- ]),
- _: 1
- }, 8, ["modelValue", "placeholder"])
- ]),
- _: 1
- }, 8, ["label"])) : createCommentVNode("", true),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_ENABLE_SECOND_PICBED")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: formOfSetting.value.enableSecondUploader,
- "onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => formOfSetting.value.enableSecondUploader = $event),
- "active-text": unref(T)("SETTINGS_OPEN"),
- "inactive-text": unref(T)("SETTINGS_CLOSE")
- }, null, 8, ["modelValue", "active-text", "inactive-text"])
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_SET_SECOND_PICBED")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_button, {
- type: "primary",
- round: "",
- size: "small",
- onClick: handleChangeSecondPicBed
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("SETTINGS_CLICK_TO_SET")), 1)
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_SYNC_DELETE_CLOUD")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: formOfSetting.value.deleteCloudFile,
- "onUpdate:modelValue": _cache[17] || (_cache[17] = ($event) => formOfSetting.value.deleteCloudFile = $event),
- "active-text": unref(T)("SETTINGS_OPEN"),
- "inactive-text": unref(T)("SETTINGS_CLOSE")
- }, null, 8, ["modelValue", "active-text", "inactive-text"])
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_OPEN_UPLOAD_TIPS")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: formOfSetting.value.uploadNotification,
- "onUpdate:modelValue": _cache[18] || (_cache[18] = ($event) => formOfSetting.value.uploadNotification = $event),
- "active-text": unref(T)("SETTINGS_OPEN"),
- "inactive-text": unref(T)("SETTINGS_CLOSE")
- }, null, 8, ["modelValue", "active-text", "inactive-text"])
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_OPEN_UPLOAD_RESULT_TIPS")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: formOfSetting.value.uploadResultNotification,
- "onUpdate:modelValue": _cache[19] || (_cache[19] = ($event) => formOfSetting.value.uploadResultNotification = $event),
- "active-text": unref(T)("SETTINGS_OPEN"),
- "inactive-text": unref(T)("SETTINGS_CLOSE")
- }, null, 8, ["modelValue", "active-text", "inactive-text"])
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_COMPRESS_AND_WATERMARK")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_button, {
- type: "primary",
- round: "",
- size: "small",
- onClick: _cache[20] || (_cache[20] = ($event) => imageProcessDialogVisible.value = true)
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("SETTINGS_CLICK_TO_SET")), 1)
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_RENAME_BEFORE_UPLOAD")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: formOfSetting.value.rename,
- "onUpdate:modelValue": _cache[21] || (_cache[21] = ($event) => formOfSetting.value.rename = $event),
- "active-text": unref(T)("SETTINGS_OPEN"),
- "inactive-text": unref(T)("SETTINGS_CLOSE")
- }, null, 8, ["modelValue", "active-text", "inactive-text"])
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_TIMESTAMP_RENAME")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: formOfSetting.value.autoRename,
- "onUpdate:modelValue": _cache[22] || (_cache[22] = ($event) => formOfSetting.value.autoRename = $event),
- "active-text": unref(T)("SETTINGS_OPEN"),
- "inactive-text": unref(T)("SETTINGS_CLOSE")
- }, null, 8, ["modelValue", "active-text", "inactive-text"])
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_ADVANCED_RENAME")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_button, {
- type: "primary",
- round: "",
- size: "small",
- onClick: _cache[23] || (_cache[23] = ($event) => advancedRenameVisible.value = true)
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("SETTINGS_CLICK_TO_SET")), 1)
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_DELETE_LOCAL_FILE_AFTER_UPLOAD")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: formOfSetting.value.deleteLocalFile,
- "onUpdate:modelValue": _cache[24] || (_cache[24] = ($event) => formOfSetting.value.deleteLocalFile = $event),
- "active-text": unref(T)("SETTINGS_OPEN"),
- "inactive-text": unref(T)("SETTINGS_CLOSE")
- }, null, 8, ["modelValue", "active-text", "inactive-text"])
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_AUTO_COPY_URL_AFTER_UPLOAD")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: formOfSetting.value.autoCopy,
- "onUpdate:modelValue": _cache[25] || (_cache[25] = ($event) => formOfSetting.value.autoCopy = $event),
- "active-text": unref(T)("SETTINGS_OPEN"),
- "inactive-text": unref(T)("SETTINGS_CLOSE")
- }, null, 8, ["modelValue", "active-text", "inactive-text"])
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_CUSTOM_LINK_FORMAT")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_button, {
- type: "primary",
- round: "",
- size: "small",
- onClick: _cache[26] || (_cache[26] = ($event) => customLinkVisible.value = true)
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("SETTINGS_CLICK_TO_SET")), 1)
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_SHORT_URL")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: formOfSetting.value.useShortUrl,
- "onUpdate:modelValue": _cache[27] || (_cache[27] = ($event) => formOfSetting.value.useShortUrl = $event),
- "active-text": unref(T)("SETTINGS_OPEN"),
- "inactive-text": unref(T)("SETTINGS_CLOSE")
- }, null, 8, ["modelValue", "active-text", "inactive-text"])
- ]),
- _: 1
- }, 8, ["label"]),
- formOfSetting.value.useShortUrl ? (openBlock(), createBlock(_component_el_form_item, {
- key: 1,
- label: unref(T)("SETTINGS_SHORT_URL_SERVER")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_select, {
- modelValue: currentShortUrlServer.value,
- "onUpdate:modelValue": _cache[28] || (_cache[28] = ($event) => currentShortUrlServer.value = $event),
- size: "small",
- style: { "width": "50%" },
- placeholder: unref(T)("SETTINGS_SHORT_URL_SERVER"),
- persistent: false,
- teleported: "",
- onChange: handleShortUrlServerChange
- }, {
- default: withCtx(() => [
- (openBlock(), createElementBlock(Fragment, null, renderList(shortUrlServerList, (item) => {
- return createVNode(_component_el_option, {
- key: item.value,
- label: item.label,
- value: item.value
- }, null, 8, ["label", "value"]);
- }), 64))
- ]),
- _: 1
- }, 8, ["modelValue", "placeholder"])
- ]),
- _: 1
- }, 8, ["label"])) : createCommentVNode("", true),
- formOfSetting.value.useShortUrl && formOfSetting.value.shortUrlServer === "c1n" ? (openBlock(), createBlock(_component_el_form_item, {
- key: 2,
- label: unref(T)("SETTINGS_SHORT_URL_C1N_TOKEN")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: formOfSetting.value.c1nToken,
- "onUpdate:modelValue": _cache[29] || (_cache[29] = ($event) => formOfSetting.value.c1nToken = $event),
- size: "small",
- style: { "width": "50%" },
- placeholder: unref(T)("SETTINGS_SHORT_URL_C1N_TOKEN")
- }, null, 8, ["modelValue", "placeholder"])
- ]),
- _: 1
- }, 8, ["label"])) : createCommentVNode("", true),
- formOfSetting.value.useShortUrl && formOfSetting.value.shortUrlServer === "yourls" ? (openBlock(), createBlock(_component_el_form_item, {
- key: 3,
- label: unref(T)("SETTINGS_SHORT_URL_YOURLS_DOMAIN")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: formOfSetting.value.yourlsDomain,
- "onUpdate:modelValue": _cache[30] || (_cache[30] = ($event) => formOfSetting.value.yourlsDomain = $event),
- size: "small",
- style: { "width": "50%" },
- placeholder: unref(T)("SETTINGS_SHORT_URL_YOURLS_DOMAIN")
- }, null, 8, ["modelValue", "placeholder"])
- ]),
- _: 1
- }, 8, ["label"])) : createCommentVNode("", true),
- formOfSetting.value.useShortUrl && formOfSetting.value.shortUrlServer === "yourls" ? (openBlock(), createBlock(_component_el_form_item, {
- key: 4,
- label: unref(T)("SETTINGS_SHORT_URL_YOURLS_SIGNATURE")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: formOfSetting.value.yourlsSignature,
- "onUpdate:modelValue": _cache[31] || (_cache[31] = ($event) => formOfSetting.value.yourlsSignature = $event),
- size: "small",
- style: { "width": "50%" },
- placeholder: unref(T)("SETTINGS_SHORT_URL_YOURLS_SIGNATURE")
- }, null, 8, ["modelValue", "placeholder"])
- ]),
- _: 1
- }, 8, ["label"])) : createCommentVNode("", true),
- formOfSetting.value.useShortUrl && formOfSetting.value.shortUrlServer === "cf_worker" ? (openBlock(), createBlock(_component_el_form_item, {
- key: 5,
- label: unref(T)("SETTINGS_SHORT_URL_CF_WORKER_HOST")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: formOfSetting.value.cfWorkerHost,
- "onUpdate:modelValue": _cache[32] || (_cache[32] = ($event) => formOfSetting.value.cfWorkerHost = $event),
- size: "small",
- style: { "width": "50%" },
- placeholder: unref(T)("SETTINGS_SHORT_URL_CF_WORKER_HOST")
- }, null, 8, ["modelValue", "placeholder"])
- ]),
- _: 1
- }, 8, ["label"])) : createCommentVNode("", true),
- formOfSetting.value.useShortUrl && formOfSetting.value.shortUrlServer === "sink" ? (openBlock(), createBlock(_component_el_form_item, {
- key: 6,
- label: unref(T)("SETTINGS_SHORT_SINK_DOMAIN")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: formOfSetting.value.sinkDomain,
- "onUpdate:modelValue": _cache[33] || (_cache[33] = ($event) => formOfSetting.value.sinkDomain = $event),
- size: "small",
- style: { "width": "50%" },
- placeholder: unref(T)("SETTINGS_SHORT_SINK_DOMAIN")
- }, null, 8, ["modelValue", "placeholder"])
- ]),
- _: 1
- }, 8, ["label"])) : createCommentVNode("", true),
- formOfSetting.value.useShortUrl && formOfSetting.value.shortUrlServer === "sink" ? (openBlock(), createBlock(_component_el_form_item, {
- key: 7,
- label: unref(T)("SETTINGS_SHORT_SINK_TOKEN")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: formOfSetting.value.sinkToken,
- "onUpdate:modelValue": _cache[34] || (_cache[34] = ($event) => formOfSetting.value.sinkToken = $event),
- size: "small",
- style: { "width": "50%" },
- placeholder: unref(T)("SETTINGS_SHORT_SINK_TOKEN")
- }, null, 8, ["modelValue", "placeholder"])
- ]),
- _: 1
- }, 8, ["label"])) : createCommentVNode("", true),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_ENCODE_OUTPUT_URL")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: formOfSetting.value.encodeOutputURL,
- "onUpdate:modelValue": _cache[35] || (_cache[35] = ($event) => formOfSetting.value.encodeOutputURL = $event),
- "active-text": unref(T)("SETTINGS_OPEN"),
- "inactive-text": unref(T)("SETTINGS_CLOSE")
- }, null, 8, ["modelValue", "active-text", "inactive-text"])
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, null, {
- label: withCtx(() => [
- createVNode(_component_el_row, { align: "middle" }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("SETTINGS_USE_BUILTIN_CLIPBOARD_UPLOAD")) + " ", 1),
- createVNode(_component_el_tooltip, {
- class: "item",
- effect: "dark",
- content: unref(T)("BUILTIN_CLIPBOARD_TIPS"),
- placement: "right",
- persistent: false,
- teleported: ""
- }, {
- default: withCtx(() => [
- createVNode(_component_el_icon, { style: { "margin-left": "4px" } }, {
- default: withCtx(() => [
- createVNode(unref(info_filled_default))
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["content"])
- ]),
- _: 1
- })
- ]),
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: formOfSetting.value.useBuiltinClipboard,
- "onUpdate:modelValue": _cache[36] || (_cache[36] = ($event) => formOfSetting.value.useBuiltinClipboard = $event),
- "active-text": unref(T)("SETTINGS_OPEN"),
- "inactive-text": unref(T)("SETTINGS_CLOSE")
- }, null, 8, ["modelValue", "active-text", "inactive-text"])
- ]),
- _: 1
- }),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_WATCH_CLIPBOARD")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: formOfSetting.value.isAutoListenClipboard,
- "onUpdate:modelValue": _cache[37] || (_cache[37] = ($event) => formOfSetting.value.isAutoListenClipboard = $event),
- "active-text": unref(T)("SETTINGS_OPEN"),
- "inactive-text": unref(T)("SETTINGS_CLOSE")
- }, null, 8, ["modelValue", "active-text", "inactive-text"])
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- style: { marginRight: "-64px" },
- label: unref(T)("CHOOSE_SHOWED_PICBED")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_checkbox_group, {
- modelValue: showPicBedList.value,
- "onUpdate:modelValue": _cache[38] || (_cache[38] = ($event) => showPicBedList.value = $event),
- onChange: handleShowPicBedListChange
- }, {
- default: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(picBedGlobal), (item) => {
- return openBlock(), createBlock(_component_el_checkbox, {
- key: item.name,
- label: item.name,
- value: item.name
- }, null, 8, ["label", "value"]);
- }), 128))
- ]),
- _: 1
- }, 8, ["modelValue"])
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_divider, { "border-style": "none" }),
- createVNode(_component_el_form_item)
- ]),
- _: 1
- })
- ]),
- _: 1
- })
- ]),
- _: 1
- })
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_tab_pane, {
- name: "advanced",
- label: unref(T)("SETTINGS_TAB_ADVANCED"),
- style: { "height": "calc(100vh - 50px)", "overflow-y": "scroll", "color": "#fff" }
- }, {
- default: withCtx(() => [
- createVNode(_component_el_row, { class: "setting-list" }, {
- default: withCtx(() => [
- createVNode(_component_el_col, {
- span: 22,
- offset: 1
- }, {
- default: withCtx(() => [
- createVNode(_component_el_row, { style: { "width": "100%" } }, {
- default: withCtx(() => [
- createVNode(unref(ElForm), {
- "label-position": "left",
- "label-width": "50%",
- size: "small"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_LOG_FILE_PATH")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_button, {
- type: "primary",
- round: "",
- size: "small",
- onClick: _cache[39] || (_cache[39] = ($event) => openDirectory())
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("SETTINGS_CLICK_TO_OPEN")), 1)
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_SET_LOG_FILE")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_button, {
- type: "primary",
- round: "",
- size: "small",
- onClick: openLogSetting
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("SETTINGS_CLICK_TO_SET")), 1)
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_SET_PROXY_AND_MIRROR")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_button, {
- type: "primary",
- round: "",
- size: "small",
- onClick: _cache[40] || (_cache[40] = ($event) => proxyVisible.value = true)
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("SETTINGS_CLICK_TO_SET")), 1)
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_SET_WEB_SERVER")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_button, {
- type: "primary",
- round: "",
- size: "small",
- onClick: _cache[41] || (_cache[41] = ($event) => webServerVisible.value = true)
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("SETTINGS_CLICK_TO_SET")), 1)
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_SET_SERVER")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_button, {
- type: "primary",
- round: "",
- size: "small",
- onClick: _cache[42] || (_cache[42] = ($event) => serverVisible.value = true)
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("SETTINGS_CLICK_TO_SET")), 1)
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_SET_SERVER_AES_KEY")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: formOfSetting.value.aesPassword,
- "onUpdate:modelValue": _cache[43] || (_cache[43] = ($event) => formOfSetting.value.aesPassword = $event),
- modelModifiers: { trim: true },
- type: "input",
- placeholder: unref(T)("SETTINGS_SET_SERVER_AES_KEY"),
- size: "small",
- style: { "width": "50%" },
- onChange: handleAesPasswordChange
- }, null, 8, ["modelValue", "placeholder"])
- ]),
- _: 1
- }, 8, ["label"])
- ]),
- _: 1
- })
- ]),
- _: 1
- })
- ]),
- _: 1
- })
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_tab_pane, {
- name: "upadte",
- label: unref(T)("SETTINGS_TAB_UPDATE"),
- style: { "height": "calc(100vh - 50px)", "overflow-y": "scroll" }
- }, {
- default: withCtx(() => [
- createVNode(_component_el_row, { class: "setting-list" }, {
- default: withCtx(() => [
- createVNode(_component_el_col, {
- span: 22,
- offset: 1
- }, {
- default: withCtx(() => [
- createVNode(_component_el_row, { style: { "width": "100%" } }, {
- default: withCtx(() => [
- createVNode(unref(ElForm), {
- "label-position": "left",
- "label-width": "50%",
- size: "small"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_CHECK_UPDATE")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_button, {
- type: "primary",
- round: "",
- size: "small",
- onClick: checkUpdate
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("SETTINGS_CLICK_TO_CHECK")), 1)
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_OPEN_UPDATE_HELPER")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: formOfSetting.value.showUpdateTip,
- "onUpdate:modelValue": _cache[44] || (_cache[44] = ($event) => formOfSetting.value.showUpdateTip = $event),
- "active-text": unref(T)("SETTINGS_OPEN"),
- "inactive-text": unref(T)("SETTINGS_CLOSE")
- }, null, 8, ["modelValue", "active-text", "inactive-text"])
- ]),
- _: 1
- }, 8, ["label"])
- ]),
- _: 1
- })
- ]),
- _: 1
- })
- ]),
- _: 1
- })
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["label"])
- ]),
- _: 1
- }, 8, ["modelValue"]),
- createVNode(_component_el_dialog, {
- modelValue: customLinkVisible.value,
- "onUpdate:modelValue": _cache[47] || (_cache[47] = ($event) => customLinkVisible.value = $event),
- title: unref(T)("SETTINGS_CUSTOM_LINK_FORMAT"),
- "modal-append-to-body": false,
- center: "",
- draggable: "",
- "append-to-body": ""
- }, {
- footer: withCtx(() => [
- createVNode(_component_el_button, {
- round: "",
- onClick: cancelCustomLink
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("CANCEL")), 1)
- ]),
- _: 1
- }),
- createVNode(_component_el_button, {
- type: "primary",
- round: "",
- onClick: confirmCustomLink
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("CONFIRM")), 1)
- ]),
- _: 1
- })
- ]),
- default: withCtx(() => [
- createVNode(unref(ElForm), {
- ref_key: "$customLink",
- ref: $customLink,
- "label-position": "top",
- model: customLink,
- rules,
- size: "small"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_form_item, { prop: "value" }, {
- default: withCtx(() => [
- createBaseVNode("div", _hoisted_2, [
- createTextVNode(toDisplayString(unref(T)("SETTINGS_TIPS_PLACEHOLDER_URL")) + " ", 1),
- _cache[89] || (_cache[89] = createBaseVNode("br", null, null, -1)),
- createTextVNode(" " + toDisplayString(unref(T)("SETTINGS_TIPS_PLACEHOLDER_FILENAME")) + " ", 1),
- _cache[90] || (_cache[90] = createBaseVNode("br", null, null, -1)),
- createTextVNode(" " + toDisplayString(unref(T)("SETTINGS_TIPS_PLACEHOLDER_EXTNAME")), 1)
- ]),
- createVNode(_component_el_input, {
- modelValue: customLink.value,
- "onUpdate:modelValue": _cache[46] || (_cache[46] = ($event) => customLink.value = $event),
- class: "align-center",
- autofocus: true
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["model", "rules"]),
- createBaseVNode("div", null, toDisplayString(unref(T)("SETTINGS_TIPS_SUCH_AS")) + "[$fileName]($url)", 1)
- ]),
- _: 1
- }, 8, ["modelValue", "title"]),
- createVNode(_component_el_dialog, {
- modelValue: proxyVisible.value,
- "onUpdate:modelValue": _cache[51] || (_cache[51] = ($event) => proxyVisible.value = $event),
- title: unref(T)("SETTINGS_SET_PROXY_AND_MIRROR"),
- "modal-append-to-body": false,
- width: "70%",
- center: "",
- draggable: "",
- "append-to-body": ""
- }, {
- default: withCtx(() => [
- createVNode(unref(ElForm), {
- "label-position": "right",
- "label-width": "120px"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_UPLOAD_PROXY")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: proxy.value,
- "onUpdate:modelValue": _cache[48] || (_cache[48] = ($event) => proxy.value = $event),
- clearable: "",
- autofocus: true,
- placeholder: `${unref(T)("SETTINGS_TIPS_SUCH_AS")}:http://127.0.0.1:1080`
- }, null, 8, ["modelValue", "placeholder"])
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_PLUGIN_INSTALL_PROXY")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: formOfSetting.value.proxy,
- "onUpdate:modelValue": _cache[49] || (_cache[49] = ($event) => formOfSetting.value.proxy = $event),
- clearable: "",
- placeholder: `${unref(T)("SETTINGS_TIPS_SUCH_AS")}:http://127.0.0.1:1080`
- }, null, 8, ["modelValue", "placeholder"])
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_PLUGIN_INSTALL_MIRROR")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: formOfSetting.value.registry,
- "onUpdate:modelValue": _cache[50] || (_cache[50] = ($event) => formOfSetting.value.registry = $event),
- clearable: "",
- placeholder: `${unref(T)("SETTINGS_TIPS_SUCH_AS")}:https://registry.npmmirror.com`
- }, null, 8, ["modelValue", "placeholder"])
- ]),
- _: 1
- }, 8, ["label"])
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["modelValue", "title"]),
- createVNode(_component_el_dialog, {
- modelValue: mainWindowSizeVisible.value,
- "onUpdate:modelValue": _cache[55] || (_cache[55] = ($event) => mainWindowSizeVisible.value = $event),
- title: unref(T)("SETTINGS_MAIN_WINDOW_SIZE"),
- "modal-append-to-body": false,
- width: "70%",
- center: "",
- draggable: "",
- "append-to-body": ""
- }, {
- footer: withCtx(() => [
- createVNode(_component_el_button, {
- round: "",
- onClick: cancelWindowSize
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("CANCEL")), 1)
- ]),
- _: 1
- }),
- createVNode(_component_el_button, {
- type: "primary",
- round: "",
- onClick: confirmWindowSize
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("CONFIRM")), 1)
- ]),
- _: 1
- })
- ]),
- default: withCtx(() => [
- createVNode(unref(ElForm), {
- "label-position": "right",
- "label-width": "120px"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_MAIN_WINDOW_SIZE_WIDTH")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: formOfSetting.value.mainWindowWidth,
- "onUpdate:modelValue": _cache[52] || (_cache[52] = ($event) => formOfSetting.value.mainWindowWidth = $event),
- autofocus: true,
- placeholder: unref(T)("SETTINGS_MAIN_WINDOW_WIDTH_HINT")
- }, null, 8, ["modelValue", "placeholder"])
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_MAIN_WINDOW_SIZE_HEIGHT")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: formOfSetting.value.mainWindowHeight,
- "onUpdate:modelValue": _cache[53] || (_cache[53] = ($event) => formOfSetting.value.mainWindowHeight = $event),
- autofocus: true,
- placeholder: unref(T)("SETTINGS_MAIN_WINDOW_HEIGHT_HINT")
- }, null, 8, ["modelValue", "placeholder"])
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_RAW_PICGO_SIZE")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: rawPicGoSize.value,
- "onUpdate:modelValue": _cache[54] || (_cache[54] = ($event) => rawPicGoSize.value = $event),
- "active-text": unref(T)("SETTINGS_OPEN"),
- "inactive-text": unref(T)("SETTINGS_CLOSE")
- }, null, 8, ["modelValue", "active-text", "inactive-text"])
- ]),
- _: 1
- }, 8, ["label"])
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["modelValue", "title"]),
- createVNode(_component_el_dialog, {
- modelValue: checkUpdateVisible.value,
- "onUpdate:modelValue": _cache[56] || (_cache[56] = ($event) => checkUpdateVisible.value = $event),
- title: unref(T)("SETTINGS_CHECK_UPDATE"),
- "modal-append-to-body": false,
- center: "",
- draggable: "",
- "append-to-body": ""
- }, {
- footer: withCtx(() => [
- createVNode(_component_el_button, {
- round: "",
- onClick: cancelCheckVersion
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("CANCEL")), 1)
- ]),
- _: 1
- }),
- createVNode(_component_el_button, {
- type: "primary",
- round: "",
- onClick: confirmCheckVersion
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("CONFIRM")), 1)
- ]),
- _: 1
- })
- ]),
- default: withCtx(() => [
- createBaseVNode("div", null, toDisplayString(unref(T)("SETTINGS_CURRENT_VERSION")) + ": " + toDisplayString(unref(version)), 1),
- createBaseVNode("div", null, toDisplayString(unref(T)("SETTINGS_NEWEST_VERSION")) + ": " + toDisplayString(latestVersion.value ? latestVersion.value : `${unref(T)("SETTINGS_GETING")}...`), 1),
- needUpdate.value ? (openBlock(), createElementBlock("div", _hoisted_3, toDisplayString(unref(T)("SETTINGS_TIPS_HAS_NEW_VERSION")), 1)) : createCommentVNode("", true)
- ]),
- _: 1
- }, 8, ["modelValue", "title"]),
- createVNode(_component_el_dialog, {
- modelValue: advancedRenameVisible.value,
- "onUpdate:modelValue": _cache[59] || (_cache[59] = ($event) => advancedRenameVisible.value = $event),
- title: unref(T)("SETTINGS_ADVANCED_RENAME"),
- center: "",
- "align-center": "",
- draggable: "",
- "destroy-on-close": "",
- "append-to-body": ""
- }, {
- default: withCtx(() => [
- createVNode(_component_el_link, {
- underline: false,
- style: { "margin-bottom": "10px" }
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("SETTINGS_ADVANCED_RENAME_ENABLE")), 1)
- ]),
- _: 1
- }),
- _cache[91] || (_cache[91] = createBaseVNode("br", null, null, -1)),
- createVNode(_component_el_switch, {
- modelValue: advancedRename.value.enable,
- "onUpdate:modelValue": _cache[57] || (_cache[57] = ($event) => advancedRename.value.enable = $event),
- "active-text": unref(T)("SETTINGS_OPEN"),
- "inactive-text": unref(T)("SETTINGS_CLOSE")
- }, null, 8, ["modelValue", "active-text", "inactive-text"]),
- _cache[92] || (_cache[92] = createBaseVNode("br", null, null, -1)),
- createVNode(_component_el_link, {
- underline: false,
- style: { "margin-bottom": "10px", "margin-top": "10px" }
- }, {
- default: withCtx(() => [
- createBaseVNode("span", null, [
- createTextVNode(toDisplayString(unref(T)("SETTINGS_ADVANCED_RENAME_FORMAT")) + " ", 1),
- createVNode(_component_el_popover, {
- effect: "light",
- placement: "right",
- width: "350",
- persistent: false,
- teleported: ""
- }, {
- reference: withCtx(() => [
- createVNode(_component_el_icon, { color: "#409EFF" }, {
- default: withCtx(() => [
- createVNode(unref(info_filled_default))
- ]),
- _: 1
- })
- ]),
- default: withCtx(() => [
- createVNode(_component_el_descriptions, {
- column: 1,
- style: { "width": "320px" },
- border: ""
- }, {
- default: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(buildInRenameFormatTable), (item, index) => {
- return openBlock(), createBlock(_component_el_descriptions_item, {
- key: index,
- label: item.placeholder,
- align: "center",
- "label-style": "width: 100px;"
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(item.description), 1)
- ]),
- _: 2
- }, 1032, ["label"]);
- }), 128)),
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(buildInRenameFormatTable).slice(0, unref(buildInRenameFormatTable).length - 1), (item, index) => {
- return openBlock(), createBlock(_component_el_descriptions_item, {
- key: index,
- label: item.placeholderB,
- align: "center",
- "label-style": "width: 100px;"
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(item.descriptionB), 1)
- ]),
- _: 2
- }, 1032, ["label"]);
- }), 128))
- ]),
- _: 1
- })
- ]),
- _: 1
- })
- ])
- ]),
- _: 1
- }),
- createVNode(_component_el_input, {
- modelValue: advancedRename.value.format,
- "onUpdate:modelValue": _cache[58] || (_cache[58] = ($event) => advancedRename.value.format = $event),
- placeholder: "Ex. {Y}-{m}-{uuid}",
- clearable: ""
- }, null, 8, ["modelValue"]),
- createBaseVNode("div", _hoisted_4, [
- createVNode(_component_el_button, {
- type: "danger",
- style: { "margin-right": "30px" },
- plain: "",
- icon: unref(close_default),
- onClick: handleCancelAdvancedRename
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("CANCEL")), 1)
- ]),
- _: 1
- }, 8, ["icon"]),
- createVNode(_component_el_button, {
- type: "primary",
- plain: "",
- icon: unref(edit_default),
- onClick: handleSaveAdvancedRename
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("CONFIRM")), 1)
- ]),
- _: 1
- }, 8, ["icon"])
- ])
- ]),
- _: 1,
- __: [91, 92]
- }, 8, ["modelValue", "title"]),
- createVNode(_component_el_dialog, {
- modelValue: logFileVisible.value,
- "onUpdate:modelValue": _cache[65] || (_cache[65] = ($event) => logFileVisible.value = $event),
- title: unref(T)("SETTINGS_SET_LOG_FILE"),
- "modal-append-to-body": false,
- width: "500px",
- center: "",
- draggable: "",
- "append-to-body": ""
- }, {
- footer: withCtx(() => [
- createVNode(_component_el_button, {
- round: "",
- onClick: cancelLogLevelSetting
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("CANCEL")), 1)
- ]),
- _: 1
- }),
- createVNode(_component_el_button, {
- type: "primary",
- round: "",
- onClick: confirmLogLevelSetting
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("CONFIRM")), 1)
- ]),
- _: 1
- })
- ]),
- default: withCtx(() => [
- createVNode(unref(ElForm), {
- "label-position": "right",
- "label-width": "150px"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_LOG_FILE")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_button, {
- type: "primary",
- round: "",
- size: "small",
- onClick: _cache[60] || (_cache[60] = ($event) => openFile("piclist.log"))
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("SETTINGS_CLICK_TO_OPEN")), 1)
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_GUI_LOG_FILE")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_button, {
- type: "primary",
- round: "",
- size: "small",
- onClick: _cache[61] || (_cache[61] = ($event) => openFile("piclist-gui-local.log"))
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("SETTINGS_CLICK_TO_OPEN")), 1)
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_MANAGE_LOG_FILE")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_button, {
- type: "primary",
- round: "",
- size: "small",
- onClick: _cache[62] || (_cache[62] = ($event) => openFile("manage.log"))
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("SETTINGS_CLICK_TO_OPEN")), 1)
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_LOG_LEVEL")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_select, {
- modelValue: formOfSetting.value.logLevel,
- "onUpdate:modelValue": _cache[63] || (_cache[63] = ($event) => formOfSetting.value.logLevel = $event),
- multiple: "",
- "collapse-tags": "",
- style: { "width": "100%" },
- persistent: false,
- teleported: ""
- }, {
- default: withCtx(() => [
- (openBlock(), createElementBlock(Fragment, null, renderList(logLevel, (value, key) => {
- return createVNode(_component_el_option, {
- key,
- label: value,
- value: key,
- disabled: handleLevelDisabled(key)
- }, null, 8, ["label", "value", "disabled"]);
- }), 64))
- ]),
- _: 1
- }, 8, ["modelValue"])
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: `${unref(T)("SETTINGS_LOG_FILE_SIZE")} (MB)`
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input_number, {
- modelValue: formOfSetting.value.logFileSizeLimit,
- "onUpdate:modelValue": _cache[64] || (_cache[64] = ($event) => formOfSetting.value.logFileSizeLimit = $event),
- style: { "width": "100%" },
- placeholder: `${unref(T)("SETTINGS_TIPS_SUCH_AS")}:10`,
- controls: false,
- min: 1
- }, null, 8, ["modelValue", "placeholder"])
- ]),
- _: 1
- }, 8, ["label"])
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["modelValue", "title"]),
- createVNode(_component_el_dialog, {
- modelValue: serverVisible.value,
- "onUpdate:modelValue": _cache[70] || (_cache[70] = ($event) => serverVisible.value = $event),
- class: "server-dialog",
- width: "60%",
- title: unref(T)("SETTINGS_SET_PICGO_SERVER"),
- "modal-append-to-body": false,
- center: "",
- draggable: "",
- "append-to-body": ""
- }, {
- footer: withCtx(() => [
- createVNode(_component_el_button, {
- round: "",
- onClick: cancelServerSetting
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("CANCEL")), 1)
- ]),
- _: 1
- }),
- createVNode(_component_el_button, {
- type: "primary",
- round: "",
- onClick: confirmServerSetting
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("CONFIRM")), 1)
- ]),
- _: 1
- })
- ]),
- default: withCtx(() => [
- createBaseVNode("div", _hoisted_5, toDisplayString(unref(T)("SETTINGS_TIPS_SERVER_NOTICE")), 1),
- createVNode(unref(ElForm), {
- "label-position": "right",
- "label-width": "120px"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_ENABLE_SERVER")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: server.value.enable,
- "onUpdate:modelValue": _cache[66] || (_cache[66] = ($event) => server.value.enable = $event),
- "active-text": unref(T)("SETTINGS_OPEN"),
- "inactive-text": unref(T)("SETTINGS_CLOSE")
- }, null, 8, ["modelValue", "active-text", "inactive-text"])
- ]),
- _: 1
- }, 8, ["label"]),
- server.value.enable ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_SET_SERVER_HOST")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: server.value.host,
- "onUpdate:modelValue": _cache[67] || (_cache[67] = ($event) => server.value.host = $event),
- type: "input",
- placeholder: unref(T)("SETTINGS_TIP_PLACEHOLDER_HOST")
- }, null, 8, ["modelValue", "placeholder"])
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_SET_SERVER_PORT")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: server.value.port,
- "onUpdate:modelValue": _cache[68] || (_cache[68] = ($event) => server.value.port = $event),
- type: "number",
- placeholder: unref(T)("SETTINGS_TIP_PLACEHOLDER_PORT")
- }, null, 8, ["modelValue", "placeholder"])
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_SET_SERVER_KEY")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: formOfSetting.value.serverKey,
- "onUpdate:modelValue": _cache[69] || (_cache[69] = ($event) => formOfSetting.value.serverKey = $event),
- type: "input",
- placeholder: unref(T)("SETTINGS_TIP_PLACEHOLDER_KEY")
- }, null, 8, ["modelValue", "placeholder"])
- ]),
- _: 1
- }, 8, ["label"])
- ], 64)) : createCommentVNode("", true)
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["modelValue", "title"]),
- createVNode(_component_el_dialog, {
- modelValue: webServerVisible.value,
- "onUpdate:modelValue": _cache[75] || (_cache[75] = ($event) => webServerVisible.value = $event),
- class: "server-dialog",
- width: "60%",
- title: unref(T)("SETTINGS_SET_WEB_SERVER"),
- "modal-append-to-body": false,
- "align-center": "",
- draggable: "",
- "append-to-body": "",
- onClose: confirmWebServerSetting
- }, {
- default: withCtx(() => [
- createBaseVNode("div", _hoisted_6, toDisplayString(unref(T)("SETTINGS_TIPS_WEB_SERVER_NOTICE")), 1),
- createVNode(unref(ElForm), {
- "label-position": "right",
- "label-width": "180px"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_SET_ENABLE_WEB_SERVER")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: formOfSetting.value.enableWebServer,
- "onUpdate:modelValue": _cache[71] || (_cache[71] = ($event) => formOfSetting.value.enableWebServer = $event),
- "active-text": unref(T)("SETTINGS_OPEN"),
- "inactive-text": unref(T)("SETTINGS_CLOSE")
- }, null, 8, ["modelValue", "active-text", "inactive-text"])
- ]),
- _: 1
- }, 8, ["label"]),
- formOfSetting.value.enableWebServer ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_SET_WEB_SERVER_HOST")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: formOfSetting.value.webServerHost,
- "onUpdate:modelValue": _cache[72] || (_cache[72] = ($event) => formOfSetting.value.webServerHost = $event),
- type: "input",
- placeholder: unref(T)("SETTINGS_TIP_PLACEHOLDER_WEB_HOST")
- }, null, 8, ["modelValue", "placeholder"])
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_SET_WEB_SERVER_PORT")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input_number, {
- modelValue: formOfSetting.value.webServerPort,
- "onUpdate:modelValue": _cache[73] || (_cache[73] = ($event) => formOfSetting.value.webServerPort = $event),
- min: 1,
- max: 65535,
- placeholder: unref(T)("SETTINGS_TIP_PLACEHOLDER_WEB_PORT"),
- onChange: handleWebServerPortChange
- }, null, 8, ["modelValue", "placeholder"])
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_SET_WEB_SERVER_PATH")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: formOfSetting.value.webServerPath,
- "onUpdate:modelValue": _cache[74] || (_cache[74] = ($event) => formOfSetting.value.webServerPath = $event),
- type: "input",
- placeholder: unref(T)("SETTINGS_SET_WEB_SERVER_PATH")
- }, null, 8, ["modelValue", "placeholder"])
- ]),
- _: 1
- }, 8, ["label"])
- ], 64)) : createCommentVNode("", true)
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["modelValue", "title"]),
- createVNode(_component_el_dialog, {
- modelValue: syncVisible.value,
- "onUpdate:modelValue": _cache[85] || (_cache[85] = ($event) => syncVisible.value = $event),
- class: "server-dialog",
- width: "60%",
- title: unref(T)("SETTINGS_SYNC_CONFIG_TITLE"),
- "modal-append-to-body": false,
- center: "",
- draggable: "",
- "append-to-body": ""
- }, {
- footer: withCtx(() => [
- createVNode(_component_el_button, {
- round: "",
- onClick: cancelSyncSetting
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("CANCEL")), 1)
- ]),
- _: 1
- }),
- createVNode(_component_el_button, {
- type: "primary",
- round: "",
- onClick: confirmSyncSetting
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("CONFIRM")), 1)
- ]),
- _: 1
- })
- ]),
- default: withCtx(() => [
- createBaseVNode("div", _hoisted_7, toDisplayString(unref(T)("SETTINGS_SYNC_CONFIG_NOTE")), 1),
- createVNode(_component_el_divider),
- createVNode(unref(ElForm), {
- "label-position": "right",
- "label-width": "120px"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_SYNC_CONFIG_SELECT_TYPE")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_select, {
- modelValue: sync.value.type,
- "onUpdate:modelValue": _cache[76] || (_cache[76] = ($event) => sync.value.type = $event),
- style: { "width": "100%" },
- persistent: false,
- teleported: ""
- }, {
- default: withCtx(() => [
- (openBlock(), createElementBlock(Fragment, null, renderList(syncType, (typeitem) => {
- return createVNode(_component_el_option, {
- key: typeitem,
- label: typeitem.slice(0, 1).toUpperCase() + typeitem.slice(1),
- value: typeitem
- }, null, 8, ["label", "value"]);
- }), 64))
- ]),
- _: 1
- }, 8, ["modelValue"])
- ]),
- _: 1
- }, 8, ["label"]),
- sync.value.type === "gitea" ? (openBlock(), createBlock(_component_el_form_item, {
- key: 0,
- label: unref(T)("SETTINGS_SYNC_CONFIG_GITEA_HOST")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: sync.value.endpoint,
- "onUpdate:modelValue": _cache[77] || (_cache[77] = ($event) => sync.value.endpoint = $event),
- modelModifiers: { trim: true },
- type: "input",
- placeholder: unref(T)("SETTINGS_SYNC_CONFIG_GITEA_HOST")
- }, null, 8, ["modelValue", "placeholder"])
- ]),
- _: 1
- }, 8, ["label"])) : createCommentVNode("", true),
- sync.value.type === "webdav" ? (openBlock(), createBlock(_component_el_form_item, {
- key: 1,
- label: unref(T)("SETTINGS_SYNC_CONFIG_WEBDAV_ENDPOINT")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: sync.value.webdavEndpoint,
- "onUpdate:modelValue": _cache[78] || (_cache[78] = ($event) => sync.value.webdavEndpoint = $event),
- modelModifiers: { trim: true },
- type: "input",
- placeholder: unref(T)("SETTINGS_SYNC_CONFIG_WEBDAV_ENDPOINT_PLACEHOLDER")
- }, null, 8, ["modelValue", "placeholder"])
- ]),
- _: 1
- }, 8, ["label"])) : createCommentVNode("", true),
- sync.value.type !== "webdav" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, renderList(["username", "repo", "branch", "token"], (inputItem) => {
- return createVNode(_component_el_form_item, {
- key: inputItem,
- label: unref(T)(`SETTINGS_SYNC_CONFIG_${sync.value.type.toUpperCase()}_${inputItem.toUpperCase()}`)
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: sync.value[inputItem],
- "onUpdate:modelValue": ($event) => sync.value[inputItem] = $event,
- modelModifiers: { trim: true },
- type: "input",
- placeholder: unref(T)(`SETTINGS_SYNC_CONFIG_${sync.value.type.toUpperCase()}_${inputItem.toUpperCase()}_PLACEHOLDER`)
- }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])
- ]),
- _: 2
- }, 1032, ["label"]);
- }), 64)) : createCommentVNode("", true),
- sync.value.type === "webdav" ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_SYNC_CONFIG_WEBDAV_USERNAME")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: sync.value.webdavUsername,
- "onUpdate:modelValue": _cache[79] || (_cache[79] = ($event) => sync.value.webdavUsername = $event),
- modelModifiers: { trim: true },
- type: "input",
- placeholder: unref(T)("SETTINGS_SYNC_CONFIG_WEBDAV_USERNAME_PLACEHOLDER")
- }, null, 8, ["modelValue", "placeholder"])
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_SYNC_CONFIG_WEBDAV_PASSWORD")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: sync.value.webdavPassword,
- "onUpdate:modelValue": _cache[80] || (_cache[80] = ($event) => sync.value.webdavPassword = $event),
- modelModifiers: { trim: true },
- type: "password",
- "show-password": "",
- placeholder: unref(T)("SETTINGS_SYNC_CONFIG_WEBDAV_PASSWORD_PLACEHOLDER")
- }, null, 8, ["modelValue", "placeholder"])
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_SYNC_CONFIG_WEBDAV_SAVE_PATH")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: sync.value.webdavSavePath,
- "onUpdate:modelValue": _cache[81] || (_cache[81] = ($event) => sync.value.webdavSavePath = $event),
- modelModifiers: { trim: true },
- type: "input",
- placeholder: unref(T)("SETTINGS_SYNC_CONFIG_WEBDAV_SAVE_PATH_PLACEHOLDER")
- }, null, 8, ["modelValue", "placeholder"])
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_SYNC_CONFIG_WEBDAV_AUTH_TYPE")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_select, {
- modelValue: sync.value.webdavAuthType,
- "onUpdate:modelValue": _cache[82] || (_cache[82] = ($event) => sync.value.webdavAuthType = $event),
- style: { "width": "100%" },
- persistent: false,
- teleported: ""
- }, {
- default: withCtx(() => [
- createVNode(_component_el_option, {
- label: "Basic",
- value: "basic"
- }),
- createVNode(_component_el_option, {
- label: "Digest",
- value: "digest"
- })
- ]),
- _: 1
- }, 8, ["modelValue"])
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_SYNC_CONFIG_WEBDAV_SSL_ENABLED")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_switch, {
- modelValue: sync.value.webdavSslEnabled,
- "onUpdate:modelValue": _cache[83] || (_cache[83] = ($event) => sync.value.webdavSslEnabled = $event),
- "active-text": unref(T)("SETTINGS_OPEN"),
- "inactive-text": unref(T)("SETTINGS_CLOSE")
- }, null, 8, ["modelValue", "active-text", "inactive-text"])
- ]),
- _: 1
- }, 8, ["label"])
- ], 64)) : createCommentVNode("", true),
- sync.value.type === "github" ? (openBlock(), createBlock(_component_el_form_item, {
- key: 4,
- label: unref(T)("SETTINGS_SYNC_CONFIG_PROXY")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: sync.value.proxy,
- "onUpdate:modelValue": _cache[84] || (_cache[84] = ($event) => sync.value.proxy = $event),
- modelModifiers: { trim: true },
- type: "input",
- placeholder: unref(T)("SETTINGS_SYNC_CONFIG_PROXY_PLACEHOLDER")
- }, null, 8, ["modelValue", "placeholder"])
- ]),
- _: 1
- }, 8, ["label"])) : createCommentVNode("", true)
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["modelValue", "title"]),
- createVNode(_component_el_dialog, {
- modelValue: upDownConfigVisible.value,
- "onUpdate:modelValue": _cache[86] || (_cache[86] = ($event) => upDownConfigVisible.value = $event),
- class: "server-dialog",
- width: "60%",
- title: unref(T)("SETTINGS_UP_DOWN_DESC"),
- "modal-append-to-body": false,
- center: "",
- draggable: "",
- "append-to-body": ""
- }, {
- default: withCtx(() => [
- createVNode(unref(ElForm), {
- "label-position": "right",
- "label-width": "120px"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_SYNC_UPLOAD")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_button_group, null, {
- default: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(syncTaskList.slice(0, 3), (item) => {
- return openBlock(), createBlock(_component_el_button, {
- key: item.task,
- type: "primary",
- plain: "",
- size: "small",
- onClick: ($event) => syncTaskFn(item.task, item.number)
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(item.label), 1)
- ]),
- _: 2
- }, 1032, ["onClick"]);
- }), 128))
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_form_item, {
- label: unref(T)("SETTINGS_SYNC_DOWNLOAD")
- }, {
- default: withCtx(() => [
- createVNode(_component_el_button_group, null, {
- default: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(syncTaskList.slice(3), (item) => {
- return openBlock(), createBlock(_component_el_button, {
- key: item.task,
- type: "primary",
- plain: "",
- size: "small",
- onClick: ($event) => syncTaskFn(item.task, item.number)
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(item.label), 1)
- ]),
- _: 2
- }, 1032, ["onClick"]);
- }), 128))
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["label"])
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["modelValue", "title"]),
- createVNode(_component_el_dialog, {
- modelValue: imageProcessDialogVisible.value,
- "onUpdate:modelValue": _cache[88] || (_cache[88] = ($event) => imageProcessDialogVisible.value = $event),
- title: unref(T)("UPLOAD_PAGE_IMAGE_PROCESS_DIALOG_TITLE"),
- width: "50%",
- draggable: "",
- center: "",
- "align-center": "",
- "append-to-body": ""
- }, {
- default: withCtx(() => [
- createVNode(_sfc_main$1, {
- modelValue: imageProcessDialogVisible.value,
- "onUpdate:modelValue": _cache[87] || (_cache[87] = ($event) => imageProcessDialogVisible.value = $event)
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- }, 8, ["modelValue", "title"])
- ]);
- };
- }
-});
-export {
- _sfc_main as default
-};
diff --git a/dist/renderer/assets/PicGoSetting-CmM9FTij.css b/dist/renderer/assets/PicGoSetting-CmM9FTij.css
deleted file mode 100644
index 960b3507..00000000
--- a/dist/renderer/assets/PicGoSetting-CmM9FTij.css
+++ /dev/null
@@ -1,111 +0,0 @@
-.el-message {
- left: 60%;
-}
-.view-title .el-icon-document {
- margin-left: 8px;
- cursor: pointer;
- transition: color 0.2s ease-in-out;
-}
-.view-title .el-icon-document:hover {
- color: #49b1f5;
-}
-.el-tabs__item {
- color: #fff;
-}
-#piclist-setting {
- height: 100%;
- position: absolute;
- left: 142px;
- right: 0;
-}
-#piclist-setting .sub-title {
- font-size: 14px;
-}
-#piclist-setting .setting-list {
- height: 100%;
- box-sizing: border-box;
- overflow-y: auto;
- overflow-x: hidden;
- width: 100%;
-}
-#piclist-setting .setting-list .el-form {
- width: 100%;
-}
-#piclist-setting .setting-list .el-form-item {
- display: flex;
- justify-content: space-between;
- padding-top: 8px;
- padding-bottom: 8px;
- border-bottom: 1px solid #777;
- margin-bottom: 0;
-}
-#piclist-setting .setting-list .el-form-item:last-child {
- border-bottom: none;
-}
-#piclist-setting .setting-list .el-form-item::after {
- display: none;
-}
-#piclist-setting .setting-list .el-form-item::before {
- display: none;
-}
-#piclist-setting .setting-list .el-form-item__content {
- display: flex;
- justify-content: flex-end;
- flex-basis: 50%;
-}
-#piclist-setting .setting-list .el-form .el-form-item__label {
- line-height: 32px;
- padding-bottom: 0;
- color: #eee;
- flex-basis: 50%;
- flex-shrink: 0;
-}
-#piclist-setting .setting-list .el-form .el-form-item__custom-label {
- display: flex;
- align-items: center;
-}
-#piclist-setting .setting-list .el-form .el-button-group {
- width: 100%;
-}
-#piclist-setting .setting-list .el-form .el-button-group .el-button {
- width: 50%;
-}
-#piclist-setting .setting-list .el-form .el-radio-group {
- margin-left: 25px;
-}
-#piclist-setting .setting-list .el-form .el-switch__label {
- color: #eee;
-}
-#piclist-setting .setting-list .el-form .el-switch__label.is-active {
- color: #409eff;
-}
-#piclist-setting .setting-list .el-form .el-icon-question {
- margin-left: 4px;
- color: #eee;
- cursor: pointer;
- transition: 0.2s color ease-in-out;
-}
-#piclist-setting .setting-list .el-form .el-icon-question:hover {
- color: #409eff;
-}
-#piclist-setting .setting-list .el-form .el-checkbox-group label {
- margin-right: 30px;
- width: 100px;
-}
-#piclist-setting .setting-list .el-form .el-checkbox+.el-checkbox {
- margin-right: 30px;
- margin-left: 0;
-}
-#piclist-setting .setting-list .el-form .confirm-button {
- width: 100%;
-}
-#piclist-setting .server-dialog .notice-text {
- text-align: center;
- color: #49b1f5;
-}
-#piclist-setting .server-dialog .el-dialog__body {
- padding-top: 0;
-}
-#piclist-setting .server-dialog .el-form-item {
- margin-bottom: 10px;
-}
diff --git a/dist/renderer/assets/Plugin-Bpit55id.css b/dist/renderer/assets/Plugin-Bpit55id.css
deleted file mode 100644
index b0ff21f3..00000000
--- a/dist/renderer/assets/Plugin-Bpit55id.css
+++ /dev/null
@@ -1,234 +0,0 @@
-#config-form .el-form label {
- line-height: 22px;
- padding-bottom: 0;
-}
-#config-form .el-form-item {
- display: flex;
- justify-content: space-between;
- border-bottom: 1px solid #777;
- padding-bottom: 16px;
-}
-#config-form .el-form-item:last-child {
- border-bottom: none;
-}
-#config-form .el-form-item__content {
- justify-content: flex-end;
-}
-#config-form .el-form .el-button-group {
- width: 100%;
-}
-#config-form .el-form .el-button-group .el-button {
- width: 50%;
-}
-#config-form .el-form .el-radio-group {
- margin-left: 25px;
-}
-#config-form .el-form .el-switch__label.is-active {
- color: #409eff;
-}
-#config-form.white .el-form-item {
- border-bottom: 1px solid #ddd;
-}
-#plugin-view {
- position: absolute;
- left: 142px;
- right: 0;
-}
-#plugin-view .el-loading-mask {
- background-color: rgba(0,0,0,0.8);
-}
-#plugin-view .plugin-list {
- align-content: flex-start;
- height: 600px;
- box-sizing: border-box;
- padding: 8px 15px;
- overflow-y: auto;
- overflow-x: hidden;
- position: absolute;
- top: 70px;
- left: 5px;
- transition: all 0.2s ease-in-out 0.1s;
- width: 100%;
-}
-#plugin-view .plugin-list .el-loading-mask {
- left: 20px;
- width: calc(100% - 40px);
-}
-#plugin-view .view-title {
- color: #eee;
- font-size: 20px;
- text-align: center;
- margin: 10px auto;
- position: relative;
-}
-#plugin-view .view-title i.el-icon-goods {
- margin-left: 4px;
- font-size: 20px;
- vertical-align: middle;
- cursor: pointer;
- transition: color 0.2s ease-in-out;
-}
-#plugin-view .view-title i.el-icon-goods:hover {
- color: #49b1f5;
-}
-#plugin-view .view-title i.el-icon-update {
- position: absolute;
- right: 35px;
- top: 8px;
- font-size: 20px;
- vertical-align: middle;
- cursor: pointer;
- transition: color 0.2s ease-in-out;
-}
-#plugin-view .view-title i.el-icon-update:hover {
- color: #49b1f5;
-}
-#plugin-view .view-title i.el-icon-download {
- position: absolute;
- right: 5px;
- top: 8px;
- font-size: 20px;
- vertical-align: middle;
- cursor: pointer;
- transition: color 0.2s ease-in-out;
-}
-#plugin-view .view-title i.el-icon-download:hover {
- color: #49b1f5;
-}
-#plugin-view .handle-bar {
- margin-bottom: 20px;
-}
-#plugin-view .handle-bar.cut-width {
- padding-right: 8px;
-}
-#plugin-view .el-input__inner {
- border-radius: 0;
-}
-#plugin-view .plugin-item {
- box-sizing: border-box;
- height: 80px;
- background: #444;
- padding: 8px;
- user-select: text;
- transition: all 0.2s ease-in-out;
- position: relative;
-}
-#plugin-view .plugin-item__container {
- height: 80px;
- margin-bottom: 10px;
-}
-#plugin-view .plugin-item .cli-only-badge {
- position: absolute;
- right: 0px;
- top: 0;
- font-size: 12px;
- padding: 3px 8px;
- background: #49b1f5;
- color: #eee;
-}
-#plugin-view .plugin-item.darwin {
- background: rgba(31,48,51,0.75);
-}
-#plugin-view .plugin-item.darwin:hover {
- background: rgba(27,42,45,0.85);
-}
-#plugin-view .plugin-item:hover {
- background: #333;
-}
-#plugin-view .plugin-item__logo {
- width: 64px;
- height: 64px;
- float: left;
-}
-#plugin-view .plugin-item__content {
- float: left;
- width: calc(100% - 72px);
- height: 64px;
- color: #ddd;
- margin-left: 8px;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
-}
-#plugin-view .plugin-item__content.disabled {
- color: #aaa;
-}
-#plugin-view .plugin-item__name {
- font-size: 16px;
- height: 22px;
- line-height: 22px;
- font-weight: 600;
- cursor: pointer;
- text-overflow: ellipsis;
- white-space: nowrap;
- overflow: hidden;
- transition: all 0.2s ease-in-out;
-}
-#plugin-view .plugin-item__name:hover {
- color: #1b9ef3;
-}
-#plugin-view .plugin-item__desc {
- font-size: 14px;
- height: 21px;
- line-height: 21px;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
-}
-#plugin-view .plugin-item__info-bar {
- font-size: 14px;
- height: 21px;
- line-height: 28px;
- position: relative;
-}
-#plugin-view .plugin-item__author {
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
-}
-#plugin-view .plugin-item__config {
- float: right;
- font-size: 16px;
- cursor: pointer;
- transition: all 0.2s ease-in-out;
-}
-#plugin-view .plugin-item__config:hover {
- color: #1b9ef3;
-}
-#plugin-view .plugin-item .config-button {
- font-size: 12px;
- color: #ddd;
- background: #222;
- padding: 1px 8px;
- height: 18px;
- line-height: 18px;
- text-align: center;
- position: absolute;
- top: 4px;
- right: 20px;
- transition: all 0.2s ease-in-out;
-}
-#plugin-view .plugin-item .config-button.reload {
- right: 0px;
-}
-#plugin-view .plugin-item .config-button.ing {
- right: 0px;
-}
-#plugin-view .plugin-item .config-button.install {
- right: 0px;
-}
-#plugin-view .plugin-item .config-button.install:hover {
- background: #1b9ef3;
- color: #fff;
-}
-#plugin-view .reload-mask {
- position: absolute;
- width: calc(100% - 40px);
- bottom: -320px;
- text-align: center;
- background: rgba(0,0,0,0.4);
- padding: 10px 0;
-}
-#plugin-view .reload-mask.cut-width {
- width: calc(100% - 48px);
-}
diff --git a/dist/renderer/assets/Plugin-DOBpniPg.js b/dist/renderer/assets/Plugin-DOBpniPg.js
deleted file mode 100644
index b124ed3e..00000000
--- a/dist/renderer/assets/Plugin-DOBpniPg.js
+++ /dev/null
@@ -1,793 +0,0 @@
-import { d as defineComponent, r as ref, a as reactive, D as watch, c as createElementBlock, e as openBlock, n as normalizeClass, q as createVNode, y as resolveComponent, v as withCtx, b1 as renderSlot, u as unref, T, F as Fragment, h as renderList, N as createBlock, g as createCommentVNode, b2 as cloneDeep, b3 as union, k as getConfig, ae as ElMessageBox, am as computed, o as onBeforeMount, bf as PICGO_HANDLE_PLUGIN_DONE, U as updatePicBedGlobal, bg as PICGO_CONFIG_PLUGIN, bh as PICGO_HANDLE_PLUGIN_ING, bi as PICGO_TOGGLE_PLUGIN, bj as debounce, M as onMounted, s as sendRPC, j as IRPCActionType, af as saveConfig, b as onBeforeUnmount, f as createBaseVNode, w as withDirectives, B as createTextVNode, t as toDisplayString, i as resolveDirective, ac as vShow, p as configPaths, bk as goods_default, aT as refresh_default, aI as download_default, A as close_default, a5 as tools_default, bl as remove_default, H as osGlobal, bd as toRaw } from "./index-BqdcQlNn.js";
-import { b as handleStreamlinePluginName } from "./common-DNjr697i.js";
-const _sfc_main$1 = /* @__PURE__ */ defineComponent({
- __name: "ConfigFormForPlugin",
- props: {
- config: {},
- type: {},
- id: {},
- colorMode: {}
- },
- setup(__props, { expose: __expose }) {
- const props = __props;
- const $form = ref();
- const configList = ref([]);
- const ruleForm = reactive({});
- watch(
- () => props.config,
- (val) => {
- handleConfigChange(val);
- },
- {
- deep: true,
- immediate: true
- }
- );
- function handleConfigChange(val) {
- handleConfig(val);
- }
- async function validate() {
- return new Promise((resolve) => {
- $form.value?.validate((valid) => {
- if (valid) {
- resolve(ruleForm);
- } else {
- resolve(false);
- }
- });
- });
- }
- function getConfigType() {
- switch (props.type) {
- case "plugin": {
- return props.id;
- }
- case "uploader": {
- return `picBed.${props.id}`;
- }
- case "transformer": {
- return `transformer.${props.id}`;
- }
- default:
- return "unknown";
- }
- }
- async function handleConfig(val) {
- const config = await getCurConfigFormData();
- Object.assign(ruleForm, config);
- if (val.length > 0) {
- configList.value = cloneDeep(val).map((item) => {
- let defaultValue = item.default !== void 0 ? item.default : item.type === "checkbox" ? [] : null;
- if (item.type === "checkbox") {
- const defaults = item.choices?.filter((i) => {
- return i.checked;
- }).map((i) => i.value) || [];
- defaultValue = union(defaultValue, defaults);
- }
- if (config && config[item.name] !== void 0) {
- defaultValue = config[item.name];
- }
- ruleForm[item.name] = defaultValue;
- return item;
- });
- }
- }
- async function getCurConfigFormData() {
- return await getConfig(`${props.id}`) || {};
- }
- function updateRuleForm(key, value) {
- try {
- ruleForm[key] = value;
- } catch (e) {
- console.log(e);
- }
- }
- __expose({
- updateRuleForm,
- validate,
- getConfigType
- });
- return (_ctx, _cache) => {
- const _component_el_input = resolveComponent("el-input");
- const _component_el_form_item = resolveComponent("el-form-item");
- const _component_el_option = resolveComponent("el-option");
- const _component_el_select = resolveComponent("el-select");
- const _component_el_switch = resolveComponent("el-switch");
- const _component_el_form = resolveComponent("el-form");
- return openBlock(), createElementBlock("div", {
- id: "config-form",
- class: normalizeClass(props.colorMode === "white" ? "white" : "")
- }, [
- createVNode(_component_el_form, {
- ref_key: "$form",
- ref: $form,
- "label-position": "left",
- "label-width": "50%",
- model: ruleForm,
- size: "small"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_form_item, {
- label: unref(T)("UPLOADER_CONFIG_NAME"),
- required: "",
- prop: "_configName"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: ruleForm._configName,
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => ruleForm._configName = $event),
- type: "input",
- placeholder: unref(T)("UPLOADER_CONFIG_PLACEHOLDER")
- }, null, 8, ["modelValue", "placeholder"])
- ]),
- _: 1
- }, 8, ["label"]),
- (openBlock(true), createElementBlock(Fragment, null, renderList(configList.value, (item, index) => {
- return openBlock(), createBlock(_component_el_form_item, {
- key: item.name + index,
- label: item.alias || item.name,
- required: item.required,
- prop: item.name
- }, {
- default: withCtx(() => [
- item.type === "input" || item.type === "password" ? (openBlock(), createBlock(_component_el_input, {
- key: 0,
- modelValue: ruleForm[item.name],
- "onUpdate:modelValue": ($event) => ruleForm[item.name] = $event,
- type: "input",
- placeholder: item.message || item.name
- }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])) : item.type === "list" && item.choices ? (openBlock(), createBlock(_component_el_select, {
- key: 1,
- modelValue: ruleForm[item.name],
- "onUpdate:modelValue": ($event) => ruleForm[item.name] = $event,
- placeholder: item.message || item.name,
- persistent: false,
- teleported: ""
- }, {
- default: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(item.choices, (choice) => {
- return openBlock(), createBlock(_component_el_option, {
- key: choice.name || choice.value || choice,
- label: choice.name || choice.value || choice,
- value: choice.value || choice
- }, null, 8, ["label", "value"]);
- }), 128))
- ]),
- _: 2
- }, 1032, ["modelValue", "onUpdate:modelValue", "placeholder"])) : item.type === "checkbox" && item.choices ? (openBlock(), createBlock(_component_el_select, {
- key: 2,
- modelValue: ruleForm[item.name],
- "onUpdate:modelValue": ($event) => ruleForm[item.name] = $event,
- placeholder: item.message || item.name,
- multiple: "",
- "collapse-tags": "",
- persistent: false,
- teleported: ""
- }, {
- default: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(item.choices, (choice) => {
- return openBlock(), createBlock(_component_el_option, {
- key: choice.value || choice,
- label: choice.name || choice.value || choice,
- value: choice.value || choice
- }, null, 8, ["label", "value"]);
- }), 128))
- ]),
- _: 2
- }, 1032, ["modelValue", "onUpdate:modelValue", "placeholder"])) : item.type === "confirm" ? (openBlock(), createBlock(_component_el_switch, {
- key: 3,
- modelValue: ruleForm[item.name],
- "onUpdate:modelValue": ($event) => ruleForm[item.name] = $event,
- "active-text": "yes",
- "inactive-text": "no"
- }, null, 8, ["modelValue", "onUpdate:modelValue"])) : createCommentVNode("", true)
- ]),
- _: 2
- }, 1032, ["label", "required", "prop"]);
- }), 128)),
- renderSlot(_ctx.$slots, "default")
- ]),
- _: 3
- }, 8, ["model"])
- ], 2);
- };
- }
-});
-const _hoisted_1 = { id: "plugin-view" };
-const _hoisted_2 = { class: "view-title" };
-const _hoisted_3 = {
- key: 0,
- class: "cli-only-badge",
- title: "CLI only"
-};
-const _hoisted_4 = ["src", "onerror"];
-const _hoisted_5 = ["onClick"];
-const _hoisted_6 = ["title"];
-const _hoisted_7 = { class: "plugin-item__info-bar" };
-const _hoisted_8 = { class: "plugin-item__author" };
-const _hoisted_9 = { class: "plugin-item__config" };
-const _hoisted_10 = ["onClick"];
-const _hoisted_11 = {
- key: 1,
- class: "config-button ing"
-};
-const _hoisted_12 = {
- key: 1,
- class: "config-button ing"
-};
-const _hoisted_13 = {
- key: 0,
- class: "config-button ing"
-};
-const __default__ = {
- name: "PluginPage"
-};
-const _sfc_main = /* @__PURE__ */ defineComponent({
- ...__default__,
- setup(__props) {
- const $confirm = ElMessageBox.confirm;
- const searchText = ref("");
- const pluginList = ref([]);
- const config = ref([]);
- const currentType = ref("plugin");
- const configName = ref("");
- const dialogVisible = ref(false);
- const pluginNameList = ref([]);
- const loading = ref(true);
- const needReload = ref(false);
- const latestVersionMap = reactive({});
- const pluginListToolTip = T("PLUGIN_LIST");
- const importLocalPluginToolTip = T("PLUGIN_IMPORT_LOCAL");
- const updateAllToolTip = T("PLUGIN_UPDATE_ALL");
- const defaultLogo = ref('this.src="file://roundLogo.png"');
- const $configForm = ref(null);
- const npmSearchText = computed(() => {
- return searchText.value.match("picgo-plugin-") ? searchText.value : searchText.value !== "" ? `picgo-plugin-${searchText.value}` : searchText.value;
- });
- let getSearchResult;
- watch(npmSearchText, (val) => {
- if (val) {
- loading.value = true;
- pluginList.value = [];
- getSearchResult(val);
- } else {
- getPluginList();
- }
- });
- watch(dialogVisible, (val) => {
- if (val) {
- document.querySelector(".main-content.el-row").style.zIndex = 101;
- } else {
- document.querySelector(".main-content.el-row").style.zIndex = 10;
- }
- });
- async function getLatestVersionOfPlugIn(pluginName) {
- try {
- const res = await window.node.axios.get(`https://registry.npmjs.com/${pluginName}`);
- latestVersionMap[pluginName] = res.data["dist-tags"].latest;
- } catch (err) {
- console.error(err);
- }
- }
- onBeforeMount(async () => {
- window.electron.electronAPI.ipcRenderer.on("hideLoading", () => {
- loading.value = false;
- });
- window.electron.electronAPI.ipcRenderer.on(PICGO_HANDLE_PLUGIN_DONE, (_, fullName) => {
- pluginList.value.forEach((item) => {
- if (item.fullName === fullName || item.name === fullName) {
- item.ing = false;
- }
- });
- loading.value = false;
- });
- window.electron.electronAPI.ipcRenderer.on("pluginList", (_, list) => {
- pluginList.value = list;
- pluginNameList.value = list.map((item) => item.fullName);
- for (const item of pluginList.value) {
- getLatestVersionOfPlugIn(item.fullName);
- }
- loading.value = false;
- });
- window.electron.electronAPI.ipcRenderer.on(
- "installPlugin",
- (_, {
- success,
- body
- }) => {
- loading.value = false;
- pluginList.value.forEach((item) => {
- if (item.fullName === body) {
- item.ing = false;
- item.hasInstall = success;
- }
- });
- }
- );
- window.electron.electronAPI.ipcRenderer.on("updateSuccess", (_, plugin) => {
- loading.value = false;
- pluginList.value.forEach((item) => {
- if (item.fullName === plugin) {
- item.ing = false;
- item.hasInstall = true;
- }
- updatePicBedGlobal();
- });
- handleReload();
- getPluginList();
- });
- window.electron.electronAPI.ipcRenderer.on("uninstallSuccess", (_, plugin) => {
- loading.value = false;
- pluginList.value = pluginList.value.filter((item) => {
- if (item.fullName === plugin) {
- if (item.config.transformer.name) {
- handleRestoreState("transformer", item.config.transformer.name);
- }
- if (item.config.uploader.name) {
- handleRestoreState("uploader", item.config.uploader.name);
- }
- updatePicBedGlobal();
- }
- return item.fullName !== plugin;
- });
- pluginNameList.value = pluginNameList.value.filter((item) => item !== plugin);
- });
- window.electron.electronAPI.ipcRenderer.on(
- PICGO_CONFIG_PLUGIN,
- (_, _currentType, _configName, _config) => {
- currentType.value = _currentType;
- configName.value = _configName;
- config.value = _config;
- dialogVisible.value = true;
- }
- );
- window.electron.electronAPI.ipcRenderer.on(PICGO_HANDLE_PLUGIN_ING, (_, fullName) => {
- pluginList.value.forEach((item) => {
- if (item.fullName === fullName || item.name === fullName) {
- item.ing = true;
- }
- });
- loading.value = true;
- });
- window.electron.electronAPI.ipcRenderer.on(PICGO_TOGGLE_PLUGIN, (_, fullName, enabled) => {
- const plugin = pluginList.value.find((item) => item.fullName === fullName);
- if (plugin) {
- plugin.enabled = enabled;
- updatePicBedGlobal();
- needReload.value = true;
- }
- });
- getPluginList();
- getSearchResult = debounce(_getSearchResult, 50);
- needReload.value = await getConfig(configPaths.needReload) || false;
- });
- async function buildContextMenu(plugin) {
- sendRPC(IRPCActionType.SHOW_PLUGIN_PAGE_MENU, plugin);
- }
- function handleResize() {
- const myDiv = document.getElementById("pluginList");
- const windowHeight = window.innerHeight;
- const newHeight = windowHeight * 0.75;
- myDiv.style.height = newHeight + "px";
- }
- onMounted(() => {
- window.addEventListener("resize", handleResize);
- });
- function getPluginList() {
- sendRPC(IRPCActionType.PLUGIN_GET_LIST);
- }
- function installPlugin(item) {
- if (!item.gui) {
- $confirm(T("TIPS_PLUGIN_NOT_GUI_IMPLEMENT"), T("TIPS_NOTICE"), {
- confirmButtonText: T("CONFIRM"),
- cancelButtonText: T("CANCEL"),
- type: "warning"
- }).then(() => {
- item.ing = true;
- sendRPC(IRPCActionType.PLUGIN_INSTALL, item.fullName);
- }).catch(() => {
- console.log("Install canceled");
- });
- } else {
- item.ing = true;
- sendRPC(IRPCActionType.PLUGIN_INSTALL, item.fullName);
- }
- }
- function reloadApp() {
- sendRPC(IRPCActionType.RELOAD_APP);
- }
- async function handleReload() {
- saveConfig({
- needReload: true
- });
- needReload.value = true;
- const successNotification = new Notification(T("PLUGIN_UPDATE_SUCCEED"), {
- body: T("TIPS_NEED_RELOAD")
- });
- successNotification.onclick = () => {
- reloadApp();
- };
- }
- function cleanSearch() {
- searchText.value = "";
- }
- async function handleConfirmConfig() {
- const result = await $configForm.value?.validate() || false;
- if (result !== false) {
- switch (currentType.value) {
- case "plugin":
- saveConfig({
- [`${configName.value}`]: result
- });
- break;
- case "uploader":
- saveConfig({
- [`picBed.${configName.value}`]: result
- });
- break;
- case "transformer":
- saveConfig({
- [`transformer.${configName.value}`]: result
- });
- break;
- }
- const successNotification = new Notification(T("SETTINGS_RESULT"), {
- body: T("TIPS_SET_SUCCEED")
- });
- successNotification.onclick = () => {
- return true;
- };
- dialogVisible.value = false;
- getPluginList();
- }
- }
- function _getSearchResult(val) {
- window.node.axios.get(`https://registry.npmjs.com/-/v1/search?text=${val}`).then((res) => {
- pluginList.value = res.data.objects.filter((item) => {
- return item.package.name.includes("picgo-plugin-");
- }).map((item) => {
- return handleSearchResult(item);
- });
- loading.value = false;
- }).catch((err) => {
- console.log(err);
- loading.value = false;
- });
- }
- function handleSearchResult(item) {
- const pkg = item.package;
- const name = handleStreamlinePluginName(pkg.name);
- let gui = false;
- if (pkg.keywords && pkg.keywords.length > 0) {
- if (pkg.keywords.includes("picgo-gui-plugin")) {
- gui = true;
- }
- }
- return {
- name,
- fullName: pkg.name,
- author: pkg.author?.name || pkg.publisher?.username || "unknown",
- description: pkg.description,
- logo: `https://cdn.jsdelivr.net/npm/${pkg.name}/logo.png`,
- config: {},
- homepage: pkg.links ? pkg.links.homepage : "",
- hasInstall: pluginNameList.value.some((plugin) => plugin === pkg.name),
- version: pkg.version,
- gui,
- ing: false
- // installing or uninstalling
- };
- }
- async function handleRestoreState(item, name) {
- if (item === "uploader") {
- const current = await getConfig(configPaths.picBed.current);
- if (current === name) {
- saveConfig({
- [configPaths.picBed.current]: "smms",
- [configPaths.picBed.uploader]: "smms"
- });
- }
- }
- if (item === "transformer") {
- const current = await getConfig(configPaths.picBed.transformer);
- if (current === name) {
- saveConfig({
- [configPaths.picBed.transformer]: "path"
- });
- }
- }
- }
- function openHomepage(url) {
- if (url) {
- sendRPC(IRPCActionType.OPEN_URL, url);
- }
- }
- function goAwesomeList() {
- sendRPC(IRPCActionType.OPEN_URL, "https://github.com/PicGo/Awesome-PicGo");
- }
- function handleImportLocalPlugin() {
- sendRPC(IRPCActionType.PLUGIN_IMPORT_LOCAL);
- loading.value = true;
- }
- function handleUpdateAllPlugin() {
- sendRPC(IRPCActionType.PLUGIN_UPDATE_ALL, toRaw(pluginNameList.value));
- }
- onBeforeUnmount(() => {
- window.removeEventListener("resize", handleResize);
- window.electron.electronAPI.ipcRenderer.removeAllListeners("pluginList");
- window.electron.electronAPI.ipcRenderer.removeAllListeners("installPlugin");
- window.electron.electronAPI.ipcRenderer.removeAllListeners("uninstallSuccess");
- window.electron.electronAPI.ipcRenderer.removeAllListeners("updateSuccess");
- window.electron.electronAPI.ipcRenderer.removeAllListeners("hideLoading");
- window.electron.electronAPI.ipcRenderer.removeAllListeners(PICGO_HANDLE_PLUGIN_DONE);
- });
- return (_ctx, _cache) => {
- const _component_el_icon = resolveComponent("el-icon");
- const _component_el_tooltip = resolveComponent("el-tooltip");
- const _component_el_input = resolveComponent("el-input");
- const _component_el_row = resolveComponent("el-row");
- const _component_el_tag = resolveComponent("el-tag");
- const _component_el_col = resolveComponent("el-col");
- const _component_el_button = resolveComponent("el-button");
- const _component_el_dialog = resolveComponent("el-dialog");
- const _directive_loading = resolveDirective("loading");
- return openBlock(), createElementBlock("div", _hoisted_1, [
- createBaseVNode("div", _hoisted_2, [
- createTextVNode(toDisplayString(unref(T)("PLUGIN_SETTINGS")) + " - ", 1),
- createVNode(_component_el_tooltip, {
- content: unref(pluginListToolTip),
- placement: "right",
- persistent: false,
- teleported: ""
- }, {
- default: withCtx(() => [
- createVNode(_component_el_icon, {
- class: "el-icon-goods",
- onClick: goAwesomeList
- }, {
- default: withCtx(() => [
- createVNode(unref(goods_default))
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["content"]),
- createVNode(_component_el_tooltip, {
- content: unref(updateAllToolTip),
- placement: "left",
- persistent: false,
- teleported: ""
- }, {
- default: withCtx(() => [
- createVNode(_component_el_icon, {
- class: "el-icon-update",
- onClick: handleUpdateAllPlugin
- }, {
- default: withCtx(() => [
- createVNode(unref(refresh_default))
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["content"]),
- createVNode(_component_el_tooltip, {
- content: unref(importLocalPluginToolTip),
- placement: "left"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_icon, {
- class: "el-icon-download",
- persistent: false,
- teleported: "",
- onClick: handleImportLocalPlugin
- }, {
- default: withCtx(() => [
- createVNode(unref(download_default))
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["content"])
- ]),
- createVNode(_component_el_row, {
- class: normalizeClass(["handle-bar", { "cut-width": pluginList.value.length > 6 }])
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: searchText.value,
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchText.value = $event),
- placeholder: unref(T)("PLUGIN_SEARCH_PLACEHOLDER"),
- size: "small"
- }, {
- suffix: withCtx(() => [
- createVNode(_component_el_icon, {
- class: "el-input__icon",
- style: { "cursor": "pointer" },
- onClick: cleanSearch
- }, {
- default: withCtx(() => [
- createVNode(unref(close_default))
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["modelValue", "placeholder"])
- ]),
- _: 1
- }, 8, ["class"]),
- withDirectives((openBlock(), createBlock(_component_el_row, {
- id: "pluginList",
- gutter: 10,
- class: "plugin-list"
- }, {
- default: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(pluginList.value, (item) => {
- return openBlock(), createBlock(_component_el_col, {
- key: item.fullName,
- class: "plugin-item__container",
- xs: 24,
- sm: pluginList.value.length === 1 ? 24 : 12,
- md: pluginList.value.length === 1 ? 24 : 12,
- lg: pluginList.value.length === 1 ? 24 : 12,
- xl: pluginList.value.length === 1 ? 24 : 12
- }, {
- default: withCtx(() => [
- createBaseVNode("div", {
- class: normalizeClass(["plugin-item", { darwin: unref(osGlobal) === "darwin" }])
- }, [
- !item.gui ? (openBlock(), createElementBlock("div", _hoisted_3, " CLI ")) : createCommentVNode("", true),
- createBaseVNode("img", {
- class: "plugin-item__logo",
- src: item.logo,
- onerror: defaultLogo.value
- }, null, 8, _hoisted_4),
- createBaseVNode("div", {
- class: normalizeClass(["plugin-item__content", { disabled: !item.enabled }])
- }, [
- createBaseVNode("div", {
- class: "plugin-item__name",
- onClick: ($event) => openHomepage(item.homepage)
- }, [
- createTextVNode(toDisplayString(item.name) + " ", 1),
- createBaseVNode("small", null, toDisplayString(" " + item.version), 1),
- _cache[4] || (_cache[4] = createTextVNode(" ", -1)),
- latestVersionMap[item.fullName] && latestVersionMap[item.fullName] !== item.version ? (openBlock(), createBlock(_component_el_tag, {
- key: 0,
- type: "success",
- size: "small",
- round: "",
- effect: "plain"
- }, {
- default: withCtx(() => _cache[3] || (_cache[3] = [
- createTextVNode(" new ", -1)
- ])),
- _: 1,
- __: [3]
- })) : createCommentVNode("", true)
- ], 8, _hoisted_5),
- createBaseVNode("div", {
- class: "plugin-item__desc",
- title: item.description
- }, toDisplayString(item.description), 9, _hoisted_6),
- createBaseVNode("div", _hoisted_7, [
- createBaseVNode("span", _hoisted_8, toDisplayString(item.author.replace(/<.*>/, "")), 1),
- createBaseVNode("span", _hoisted_9, [
- searchText.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
- !item.hasInstall ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
- !item.ing ? (openBlock(), createElementBlock("span", {
- key: 0,
- class: "config-button install",
- onClick: ($event) => installPlugin(item)
- }, toDisplayString(unref(T)("PLUGIN_INSTALL")), 9, _hoisted_10)) : item.ing ? (openBlock(), createElementBlock("span", _hoisted_11, toDisplayString(unref(T)("PLUGIN_INSTALLING")), 1)) : createCommentVNode("", true)
- ], 64)) : (openBlock(), createElementBlock("span", _hoisted_12, toDisplayString(unref(T)("PLUGIN_INSTALLED")), 1))
- ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
- item.ing ? (openBlock(), createElementBlock("span", _hoisted_13, toDisplayString(unref(T)("PLUGIN_DOING_SOMETHING")), 1)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
- item.enabled ? (openBlock(), createBlock(_component_el_icon, {
- key: 0,
- class: "el-icon-setting",
- onClick: ($event) => buildContextMenu(item)
- }, {
- default: withCtx(() => [
- createVNode(unref(tools_default))
- ]),
- _: 2
- }, 1032, ["onClick"])) : (openBlock(), createBlock(_component_el_icon, {
- key: 1,
- class: "el-icon-remove-outline",
- onClick: ($event) => buildContextMenu(item)
- }, {
- default: withCtx(() => [
- createVNode(unref(remove_default))
- ]),
- _: 2
- }, 1032, ["onClick"]))
- ], 64))
- ], 64))
- ])
- ])
- ], 2)
- ], 2)
- ]),
- _: 2
- }, 1032, ["sm", "md", "lg", "xl"]);
- }), 128))
- ]),
- _: 1
- })), [
- [_directive_loading, loading.value]
- ]),
- withDirectives(createVNode(_component_el_row, {
- class: normalizeClass(["reload-mask", { "cut-width": pluginList.value.length > 6 }]),
- justify: "center"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_button, {
- type: "primary",
- size: "small",
- round: "",
- onClick: reloadApp
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("TIPS_NEED_RELOAD")), 1)
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["class"]), [
- [vShow, needReload.value]
- ]),
- createVNode(_component_el_dialog, {
- modelValue: dialogVisible.value,
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => dialogVisible.value = $event),
- "modal-append-to-body": false,
- title: unref(T)("CONFIG_THING", {
- c: configName.value
- }),
- width: "70%",
- "append-to-body": ""
- }, {
- footer: withCtx(() => [
- createVNode(_component_el_button, {
- round: "",
- onClick: _cache[1] || (_cache[1] = ($event) => dialogVisible.value = false)
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("CANCEL")), 1)
- ]),
- _: 1
- }),
- createVNode(_component_el_button, {
- type: "primary",
- round: "",
- onClick: handleConfirmConfig
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("CONFIRM")), 1)
- ]),
- _: 1
- })
- ]),
- default: withCtx(() => [
- createVNode(_sfc_main$1, {
- id: configName.value,
- ref_key: "$configForm",
- ref: $configForm,
- config: config.value,
- type: currentType.value,
- "color-mode": "white"
- }, null, 8, ["id", "config", "type"])
- ]),
- _: 1
- }, 8, ["modelValue", "title"])
- ]);
- };
- }
-});
-export {
- _sfc_main as default
-};
diff --git a/dist/renderer/assets/RenamePage-CYXv9h-U.js b/dist/renderer/assets/RenamePage-CYXv9h-U.js
deleted file mode 100644
index ca00f51a..00000000
--- a/dist/renderer/assets/RenamePage-CYXv9h-U.js
+++ /dev/null
@@ -1,122 +0,0 @@
-import { d as defineComponent, r as ref, a as reactive, o as onBeforeMount, G as GET_RENAME_FILE_NAME, b as onBeforeUnmount, R as RENAME_FILE_NAME, c as createElementBlock, e as openBlock, q as createVNode, v as withCtx, x as withModifiers, y as resolveComponent, u as unref, T, z as withKeys, A as close_default, f as createBaseVNode, B as createTextVNode, t as toDisplayString, C as sendToMain } from "./index-BqdcQlNn.js";
-import { u as useIPCOn } from "./useIPC-O_oSdR6Q.js";
-const _hoisted_1 = { id: "rename-page" };
-const _hoisted_2 = { class: "pull-right" };
-const __default__ = {
- name: "RenamePage"
-};
-const _sfc_main = /* @__PURE__ */ defineComponent({
- ...__default__,
- setup(__props) {
- const id = ref(null);
- const formRef = ref();
- const form = reactive({
- fileName: "",
- originName: ""
- });
- const handleFileName = (_, newName, _originName, _id) => {
- form.fileName = newName;
- form.originName = _originName;
- id.value = _id;
- };
- useIPCOn(RENAME_FILE_NAME, handleFileName);
- onBeforeMount(() => {
- window.electron.electronAPI.ipcRenderer.send(GET_RENAME_FILE_NAME);
- });
- function confirmName() {
- formRef.value?.validate((valid) => {
- if (valid) {
- sendToMain(`${RENAME_FILE_NAME}${id.value}`, form.fileName);
- }
- });
- }
- function cancel() {
- sendToMain(`${RENAME_FILE_NAME}${id.value}`, form.originName);
- }
- onBeforeUnmount(() => {
- window.electron.electronAPI.ipcRenderer.removeAllListeners(RENAME_FILE_NAME);
- });
- return (_ctx, _cache) => {
- const _component_el_icon = resolveComponent("el-icon");
- const _component_el_input = resolveComponent("el-input");
- const _component_el_form_item = resolveComponent("el-form-item");
- const _component_el_form = resolveComponent("el-form");
- const _component_el_button = resolveComponent("el-button");
- const _component_el_row = resolveComponent("el-row");
- return openBlock(), createElementBlock("div", _hoisted_1, [
- createVNode(_component_el_form, {
- ref_key: "formRef",
- ref: formRef,
- model: form,
- onSubmit: _cache[2] || (_cache[2] = withModifiers(() => {
- }, ["prevent"]))
- }, {
- default: withCtx(() => [
- createVNode(_component_el_form_item, {
- label: unref(T)("FILE_RENAME"),
- prop: "fileName",
- rules: [{ required: true, message: "file name is required", trigger: "blur" }]
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: form.fileName,
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => form.fileName = $event),
- size: "small",
- autofocus: "",
- onKeyup: withKeys(confirmName, ["enter"])
- }, {
- suffix: withCtx(() => [
- createVNode(_component_el_icon, {
- class: "el-input__icon",
- style: { "cursor": "pointer" },
- onClick: _cache[0] || (_cache[0] = ($event) => form.fileName = "")
- }, {
- default: withCtx(() => [
- createVNode(unref(close_default))
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["modelValue"])
- ]),
- _: 1
- }, 8, ["label"])
- ]),
- _: 1
- }, 8, ["model"]),
- createVNode(_component_el_row, null, {
- default: withCtx(() => [
- createBaseVNode("div", _hoisted_2, [
- createVNode(_component_el_button, {
- round: "",
- size: "small",
- onClick: cancel
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("CANCEL")), 1)
- ]),
- _: 1
- }),
- createVNode(_component_el_button, {
- type: "primary",
- round: "",
- size: "small",
- onClick: confirmName
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("CONFIRM")), 1)
- ]),
- _: 1
- })
- ])
- ]),
- _: 1
- })
- ]);
- };
- }
-});
-export {
- _sfc_main as default
-};
diff --git a/dist/renderer/assets/RenamePage-Dc09j0Xq.css b/dist/renderer/assets/RenamePage-Dc09j0Xq.css
deleted file mode 100644
index 35651c74..00000000
--- a/dist/renderer/assets/RenamePage-Dc09j0Xq.css
+++ /dev/null
@@ -1,9 +0,0 @@
-#rename-page {
- padding: 0 20px;
-}
-#rename-page .pull-right {
- float: right;
-}
-#rename-page .el-form-item__label {
- color: #ddd;
-}
diff --git a/dist/renderer/assets/ShortKey-BEjx61e-.css b/dist/renderer/assets/ShortKey-BEjx61e-.css
deleted file mode 100644
index 1c18ce01..00000000
--- a/dist/renderer/assets/ShortKey-BEjx61e-.css
+++ /dev/null
@@ -1,42 +0,0 @@
-#shortcut-page .shortcut-page-table-border {
- border-color: #777;
-}
-#shortcut-page .el-dialog__body {
- padding: 10px 20px;
-}
-#shortcut-page .el-dialog__body .el-form-item {
- margin-bottom: 0;
-}
-#shortcut-page .el-button.disabled {
- color: #f56c6c;
-}
-#shortcut-page .el-button.edit {
- color: #67c23a;
-}
-#shortcut-page .el-button--text {
- padding-left: 4px;
- padding-right: 4px;
-}
-#shortcut-page .el-table {
- background-color: transparent;
- color: #ddd;
-}
-#shortcut-page .el-table::before {
- background-color: #777;
-}
-#shortcut-page .el-table thead {
- color: #bbb;
-}
-#shortcut-page .el-table th,
-#shortcut-page .el-table tr {
- background-color: transparent;
-}
-#shortcut-page .el-table__body tr.el-table__row--striped td {
- background: transparent;
-}
-#shortcut-page .el-table--enable-row-hover .el-table__body tr:hover>td {
- background: #333;
-}
-#shortcut-page .el-button+.el-button {
- margin-left: 4px;
-}
diff --git a/dist/renderer/assets/ShortKey-Bk8jitxF.js b/dist/renderer/assets/ShortKey-Bk8jitxF.js
deleted file mode 100644
index 9611255a..00000000
--- a/dist/renderer/assets/ShortKey-Bk8jitxF.js
+++ /dev/null
@@ -1,260 +0,0 @@
-import { d as defineComponent, r as ref, o as onBeforeMount, k as getConfig, D as watch, b as onBeforeUnmount, s as sendRPC, j as IRPCActionType, c as createElementBlock, e as openBlock, f as createBaseVNode, q as createVNode, t as toDisplayString, u as unref, T, v as withCtx, y as resolveComponent, p as configPaths, B as createTextVNode, n as normalizeClass, x as withModifiers, m as triggerRPC } from "./index-BqdcQlNn.js";
-const isSpecialKey = (key) => {
- const keyArr = ["Shift", "Control", "Alt", "Meta"];
- return keyArr.includes(key);
-};
-const keyBinding = (event) => {
- const meta = process.platform === "darwin" ? "Cmd" : "Super";
- const specialKey = {
- Ctrl: event.ctrlKey,
- Shift: event.shiftKey,
- Alt: event.altKey,
- [meta]: event.metaKey
- };
- const pressKey = [];
- for (const i in specialKey) {
- if (specialKey[i]) {
- pressKey.push(i);
- }
- }
- if (!isSpecialKey(event.key)) {
- pressKey.push(event.key.toUpperCase());
- }
- return pressKey;
-};
-const _hoisted_1 = { id: "shortcut-page" };
-const _hoisted_2 = { class: "view-title" };
-const __default__ = {
- name: "ShortkeyPage"
-};
-const _sfc_main = /* @__PURE__ */ defineComponent({
- ...__default__,
- setup(__props) {
- const list = ref([]);
- const keyBindingVisible = ref(false);
- const command = ref("");
- const shortKey = ref("");
- const currentIndex = ref(0);
- onBeforeMount(async () => {
- const shortKeyConfig = await getConfig(configPaths.settings.shortKey._path);
- list.value = Object.keys(shortKeyConfig).map((item) => {
- return {
- ...shortKeyConfig[item],
- from: calcOrigin(item)
- };
- });
- });
- watch(keyBindingVisible, (val) => {
- sendRPC(IRPCActionType.SHORTKEY_TOGGLE_SHORTKEY_MODIFIED_MODE, val);
- });
- function calcOrigin(item) {
- const [origin] = item.split(":");
- return origin;
- }
- function calcOriginShowName(item) {
- return item.replace("picgo-plugin-", "");
- }
- function toggleEnable(item) {
- const status = !item.enable;
- item.enable = status;
- sendRPC(IRPCActionType.SHORTKEY_BIND_OR_UNBIND, item, item.from);
- }
- function keyDetect(event) {
- shortKey.value = keyBinding(event).join("+");
- }
- async function openKeyBindingDialog(config, index) {
- command.value = `${config.from}:${config.name}`;
- shortKey.value = await getConfig(`settings.shortKey.${command.value}.key`) || "";
- currentIndex.value = index;
- keyBindingVisible.value = true;
- }
- async function cancelKeyBinding() {
- keyBindingVisible.value = false;
- shortKey.value = await getConfig(`settings.shortKey.${command.value}.key`) || "";
- }
- async function confirmKeyBinding() {
- const oldKey = await getConfig(`settings.shortKey.${command.value}.key`);
- const config = { ...list.value[currentIndex.value] };
- config.key = shortKey.value;
- const result = await triggerRPC(IRPCActionType.SHORTKEY_UPDATE, config, oldKey, config.from);
- if (result) {
- keyBindingVisible.value = false;
- list.value[currentIndex.value].key = shortKey.value;
- }
- }
- onBeforeUnmount(() => {
- sendRPC(IRPCActionType.SHORTKEY_TOGGLE_SHORTKEY_MODIFIED_MODE, false);
- });
- return (_ctx, _cache) => {
- const _component_el_table_column = resolveComponent("el-table-column");
- const _component_el_tag = resolveComponent("el-tag");
- const _component_el_button = resolveComponent("el-button");
- const _component_el_row = resolveComponent("el-row");
- const _component_el_table = resolveComponent("el-table");
- const _component_el_col = resolveComponent("el-col");
- const _component_el_input = resolveComponent("el-input");
- const _component_el_form_item = resolveComponent("el-form-item");
- const _component_el_form = resolveComponent("el-form");
- const _component_el_dialog = resolveComponent("el-dialog");
- return openBlock(), createElementBlock("div", _hoisted_1, [
- createBaseVNode("div", _hoisted_2, toDisplayString(unref(T)("SETTINGS_SET_SHORTCUT")), 1),
- createVNode(_component_el_row, null, {
- default: withCtx(() => [
- createVNode(_component_el_col, {
- span: 20,
- offset: 2
- }, {
- default: withCtx(() => [
- createVNode(_component_el_table, {
- class: "shortcut-page-table-border",
- data: list.value,
- size: "small",
- "header-cell-class-name": "shortcut-page-table-border",
- "cell-class-name": "shortcut-page-table-border"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_table_column, {
- label: unref(T)("SHORTCUT_NAME")
- }, {
- default: withCtx((scope) => [
- createTextVNode(toDisplayString(scope.row.label ? scope.row.label : scope.row.name), 1)
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_table_column, {
- width: "160px",
- label: unref(T)("SHORTCUT_BIND"),
- prop: "key"
- }, null, 8, ["label"]),
- createVNode(_component_el_table_column, {
- label: unref(T)("SHORTCUT_STATUS")
- }, {
- default: withCtx((scope) => [
- createVNode(_component_el_tag, {
- size: "small",
- type: scope.row.enable ? "success" : "danger"
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(scope.row.enable ? unref(T)("SHORTCUT_ENABLED") : unref(T)("SHORTCUT_DISABLED")), 1)
- ]),
- _: 2
- }, 1032, ["type"])
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_table_column, {
- label: unref(T)("SHORTCUT_SOURCE"),
- width: "100px"
- }, {
- default: withCtx((scope) => [
- createTextVNode(toDisplayString(calcOriginShowName(scope.row.from)), 1)
- ]),
- _: 1
- }, 8, ["label"]),
- createVNode(_component_el_table_column, {
- label: unref(T)("SHORTCUT_HANDLE"),
- width: "100px"
- }, {
- default: withCtx((scope) => [
- createVNode(_component_el_row, null, {
- default: withCtx(() => [
- createVNode(_component_el_button, {
- size: "small",
- class: normalizeClass({
- disabled: scope.row.enable
- }),
- type: "info",
- link: true,
- onClick: ($event) => toggleEnable(scope.row)
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(scope.row.enable ? unref(T)("SHORTCUT_DISABLE") : unref(T)("SHORTCUT_ENABLE")), 1)
- ]),
- _: 2
- }, 1032, ["class", "onClick"]),
- createVNode(_component_el_button, {
- class: "edit",
- size: "small",
- type: "info",
- link: true,
- onClick: ($event) => openKeyBindingDialog(scope.row, scope.$index)
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("SHORTCUT_EDIT")), 1)
- ]),
- _: 2
- }, 1032, ["onClick"])
- ]),
- _: 2
- }, 1024)
- ]),
- _: 1
- }, 8, ["label"])
- ]),
- _: 1
- }, 8, ["data"])
- ]),
- _: 1
- })
- ]),
- _: 1
- }),
- createVNode(_component_el_dialog, {
- modelValue: keyBindingVisible.value,
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => keyBindingVisible.value = $event),
- title: unref(T)("SHORTCUT_CHANGE_UPLOAD"),
- "modal-append-to-body": false,
- "append-to-body": ""
- }, {
- footer: withCtx(() => [
- createVNode(_component_el_button, {
- round: "",
- onClick: cancelKeyBinding
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("CANCEL")), 1)
- ]),
- _: 1
- }),
- createVNode(_component_el_button, {
- type: "primary",
- round: "",
- onClick: confirmKeyBinding
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("CONFIRM")), 1)
- ]),
- _: 1
- })
- ]),
- default: withCtx(() => [
- createVNode(_component_el_form, {
- "label-position": "top",
- "label-width": "80px"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_form_item, null, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: shortKey.value,
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => shortKey.value = $event),
- class: "align-center",
- autofocus: true,
- onKeydown: _cache[1] || (_cache[1] = withModifiers(($event) => keyDetect($event), ["prevent"]))
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- })
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["modelValue", "title"])
- ]);
- };
- }
-});
-export {
- _sfc_main as default
-};
diff --git a/dist/renderer/assets/Toolbox-BBhxAVY5.css b/dist/renderer/assets/Toolbox-BBhxAVY5.css
deleted file mode 100644
index 307aad3c..00000000
--- a/dist/renderer/assets/Toolbox-BBhxAVY5.css
+++ /dev/null
@@ -1,68 +0,0 @@
-.toolbox-status-icon {
- margin-left: 8px;
-}
-.toolbox {
- padding: 0 40px;
-}
-.toolbox-header {
- width: 100%;
- color: #eee;
- justify-content: space-between;
- align-items: center;
- padding: 20px 0px;
-}
-.toolbox-header__logo {
- width: 64px;
- height: 64px;
- margin-right: 20px;
-}
-.toolbox-header__text {
- flex-direction: column;
- justify-content: center;
-}
-.toolbox-header__title {
- color: #ddd;
- font-size: 20px;
- margin-bottom: 4px;
-}
-.toolbox-header__sub-title {
- color: #aaa;
- font-size: 16px;
-}
-.toolbox .progress {
- width: 100%;
-}
-.toolbox .progress .el-progress--line {
- width: 100%;
-}
-.toolbox .progress .el-progress__text {
- min-width: 0;
-}
-.toolbox .el-collapse {
- margin-top: 20px;
- --el-collapse-border-color: #777;
- --el-collapse-header-height: 48px;
- --el-collapse-header-bg-color: transparent;
- --el-collapse-header-text-color: #ddd;
- --el-collapse-header-font-size: 13px;
- --el-collapse-content-bg-color: transparent;
- --el-collapse-content-font-size: 13px;
- --el-collapse-content-text-color: #ddd;
-}
-.toolbox .el-collapse-item__content {
- padding-bottom: 12px;
-}
-.toolbox-item-msg {
- color: #aaa;
-}
-.toolbox-tips {
- padding: 12px 0;
-}
-.toolbox-cant-fix {
- display: flex;
- justify-content: center;
- align-items: center;
-}
-.toolbox-cant-fix__btn {
- margin-left: 8px;
-}
diff --git a/dist/renderer/assets/Toolbox-C8d1wmoC.js b/dist/renderer/assets/Toolbox-C8d1wmoC.js
deleted file mode 100644
index 11ba2651..00000000
--- a/dist/renderer/assets/Toolbox-C8d1wmoC.js
+++ /dev/null
@@ -1,323 +0,0 @@
-import { d as defineComponent, c as createElementBlock, e as openBlock, q as createVNode, y as resolveComponent, v as withCtx, B as createTextVNode, t as toDisplayString, am as computed, bp as IToolboxItemCheckStatus, N as createBlock, g as createCommentVNode, u as unref, at as success_filled_default, bq as circle_close_filled_default, ax as loading_default, ae as ElMessageBox, r as ref, a as reactive, T, br as IToolboxItemType, s as sendRPC, j as IRPCActionType, f as createBaseVNode, F as Fragment, h as renderList, m as triggerRPC } from "./index-BqdcQlNn.js";
-import { a as useIPC } from "./useIPC-O_oSdR6Q.js";
-const _hoisted_1$1 = { class: "toolbox-handler" };
-const __default__$2 = {
- name: "ToolboxHandler"
-};
-const _sfc_main$2 = /* @__PURE__ */ defineComponent({
- ...__default__$2,
- props: {
- status: {},
- value: {},
- handlerText: {},
- handler: { type: Function }
- },
- setup(__props) {
- const props = __props;
- return (_ctx, _cache) => {
- const _component_ElButton = resolveComponent("ElButton");
- return openBlock(), createElementBlock("div", _hoisted_1$1, [
- createVNode(_component_ElButton, {
- type: "primary",
- link: true,
- onClick: _cache[0] || (_cache[0] = () => props.handler(_ctx.value))
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(props.handlerText), 1)
- ]),
- _: 1
- })
- ]);
- };
- }
-});
-const __default__$1 = {
- name: "ToolboxStatusIcon"
-};
-const _sfc_main$1 = /* @__PURE__ */ defineComponent({
- ...__default__$1,
- props: {
- status: {}
- },
- setup(__props) {
- const props = __props;
- const color = computed(() => {
- switch (props.status) {
- case IToolboxItemCheckStatus.SUCCESS:
- return "#67C23A";
- case IToolboxItemCheckStatus.ERROR:
- return "#F56C6C";
- default:
- return "#909399";
- }
- });
- return (_ctx, _cache) => {
- const _component_el_icon = resolveComponent("el-icon");
- return openBlock(), createBlock(_component_el_icon, {
- color: color.value,
- class: "toolbox-status-icon"
- }, {
- default: withCtx(() => [
- props.status === unref(IToolboxItemCheckStatus).SUCCESS ? (openBlock(), createBlock(unref(success_filled_default), { key: 0 })) : createCommentVNode("", true),
- props.status === unref(IToolboxItemCheckStatus).ERROR ? (openBlock(), createBlock(unref(circle_close_filled_default), { key: 1 })) : createCommentVNode("", true),
- props.status === unref(IToolboxItemCheckStatus).LOADING ? (openBlock(), createBlock(unref(loading_default), { key: 2 })) : createCommentVNode("", true)
- ]),
- _: 1
- }, 8, ["color"]);
- };
- }
-});
-const _hoisted_1 = { class: "toolbox" };
-const _hoisted_2 = ["src"];
-const _hoisted_3 = {
- key: 1,
- class: "toolbox-tips"
-};
-const _hoisted_4 = {
- key: 1,
- class: "toolbox-cant-fix toolbox-tips"
-};
-const _hoisted_5 = { class: "toolbox-item-msg" };
-const __default__ = {
- name: "ToolBoxPage"
-};
-const _sfc_main = /* @__PURE__ */ defineComponent({
- ...__default__,
- setup(__props) {
- const $confirm = ElMessageBox.confirm;
- const defaultLogo = ref("file://roundLogo.png");
- const activeTypes = ref([]);
- const fixList = reactive({
- [IToolboxItemType.IS_CONFIG_FILE_BROKEN]: {
- title: T("TOOLBOX_CHECK_CONFIG_FILE_BROKEN"),
- status: IToolboxItemCheckStatus.INIT,
- handlerText: T("SETTINGS_OPEN_CONFIG_FILE"),
- handler(value) {
- sendRPC(IRPCActionType.OPEN_FILE, value);
- }
- },
- [IToolboxItemType.IS_GALLERY_FILE_BROKEN]: {
- title: T("TOOLBOX_CHECK_GALLERY_FILE_BROKEN"),
- status: IToolboxItemCheckStatus.INIT
- },
- [IToolboxItemType.HAS_PROBLEM_WITH_CLIPBOARD_PIC_UPLOAD]: {
- title: T("TOOLBOX_CHECK_PROBLEM_WITH_CLIPBOARD_PIC_UPLOAD"),
- // picgo-image-clipboard folder
- status: IToolboxItemCheckStatus.INIT,
- handlerText: T("OPEN_FILE_PATH"),
- handler(value) {
- sendRPC(IRPCActionType.OPEN_FILE, value);
- }
- },
- [IToolboxItemType.HAS_PROBLEM_WITH_PROXY]: {
- title: T("TOOLBOX_CHECK_PROBLEM_WITH_PROXY"),
- status: IToolboxItemCheckStatus.INIT,
- hasNoFixMethod: true
- }
- });
- const progress = computed(() => {
- const total = Object.keys(fixList).length;
- const done = Object.keys(fixList).filter((key) => {
- const status = fixList[key].status;
- return status !== IToolboxItemCheckStatus.INIT && status !== IToolboxItemCheckStatus.LOADING;
- }).length;
- return done / total * 100;
- });
- const isAllSuccess = computed(() => {
- return Object.keys(fixList).every((key) => {
- const status = fixList[key].status;
- return status === IToolboxItemCheckStatus.SUCCESS;
- });
- });
- const isLoading = computed(() => {
- return Object.keys(fixList).some((key) => {
- const status = fixList[key].status;
- return status === IToolboxItemCheckStatus.LOADING;
- });
- });
- const canFixLength = computed(() => {
- return Object.keys(fixList).filter((key) => {
- const status = fixList[key].status;
- return status === IToolboxItemCheckStatus.ERROR && !fixList[key].hasNoFixMethod;
- }).length;
- });
- const format = (_percentage) => "";
- const ipc = useIPC();
- ipc.on(IRPCActionType.TOOLBOX_CHECK_RES, (_event, { type, msg = "", status, value = "" }) => {
- fixList[type].status = status;
- fixList[type].msg = msg;
- fixList[type].value = value;
- if (status === IToolboxItemCheckStatus.ERROR) {
- activeTypes.value.push(type);
- }
- });
- const handleCheck = () => {
- activeTypes.value = [];
- Object.keys(fixList).forEach((key) => {
- fixList[key].status = IToolboxItemCheckStatus.LOADING;
- fixList[key].msg = "";
- fixList[key].value = "";
- });
- sendRPC(IRPCActionType.TOOLBOX_CHECK);
- };
- const handleFix = async () => {
- const fixRes = await Promise.all(
- Object.keys(fixList).filter((key) => {
- const status = fixList[key].status;
- return status === IToolboxItemCheckStatus.ERROR && !fixList[key].hasNoFixMethod;
- }).map(async (key) => {
- return triggerRPC(IRPCActionType.TOOLBOX_CHECK_FIX, key);
- })
- );
- fixRes.filter((item) => item !== null).forEach((item) => {
- if (item) {
- fixList[item.type].status = item.status;
- fixList[item.type].msg = item.msg;
- fixList[item.type].value = item.value;
- }
- });
- $confirm(T("TOOLBOX_FIX_DONE_NEED_RELOAD"), T("TIPS_NOTICE"), {
- confirmButtonText: T("CONFIRM"),
- cancelButtonText: T("CANCEL"),
- type: "info"
- }).then(() => {
- sendRPC(IRPCActionType.RELOAD_APP);
- }).catch(() => {
- });
- };
- return (_ctx, _cache) => {
- const _component_el_row = resolveComponent("el-row");
- const _component_el_button = resolveComponent("el-button");
- const _component_el_progress = resolveComponent("el-progress");
- const _component_el_collapse_item = resolveComponent("el-collapse-item");
- const _component_el_collapse = resolveComponent("el-collapse");
- return openBlock(), createElementBlock("div", _hoisted_1, [
- createVNode(_component_el_row, null, {
- default: withCtx(() => [
- createVNode(_component_el_row, { class: "toolbox-header" }, {
- default: withCtx(() => [
- createVNode(_component_el_row, null, {
- default: withCtx(() => [
- createBaseVNode("img", {
- class: "toolbox-header__logo",
- src: defaultLogo.value
- }, null, 8, _hoisted_2),
- createVNode(_component_el_row, { class: "toolbox-header__text" }, {
- default: withCtx(() => [
- createVNode(_component_el_row, { class: "toolbox-header__title" }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("TOOLBOX_TITLE")), 1)
- ]),
- _: 1
- }),
- createVNode(_component_el_row, { class: "toolbox-header__sub-title" }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("TOOLBOX_SUB_TITLE")), 1)
- ]),
- _: 1
- })
- ]),
- _: 1
- })
- ]),
- _: 1
- }),
- createVNode(_component_el_row, null, {
- default: withCtx(() => [
- progress.value !== 100 ? (openBlock(), createBlock(_component_el_button, {
- key: 0,
- type: "primary",
- round: "",
- disabled: isLoading.value,
- onClick: handleCheck
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("TOOLBOX_START_SCAN")), 1)
- ]),
- _: 1
- }, 8, ["disabled"])) : isAllSuccess.value ? (openBlock(), createElementBlock("div", _hoisted_3, toDisplayString(unref(T)("TOOLBOX_SUCCESS_TIPS")), 1)) : !isAllSuccess.value ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
- canFixLength.value !== 0 ? (openBlock(), createBlock(_component_el_button, {
- key: 0,
- type: "primary",
- round: "",
- onClick: handleFix
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("TOOLBOX_START_FIX")), 1)
- ]),
- _: 1
- })) : (openBlock(), createElementBlock("div", _hoisted_4, [
- createTextVNode(toDisplayString(unref(T)("TOOLBOX_CANT_AUTO_FIX")) + " ", 1),
- createVNode(_component_el_button, {
- type: "primary",
- round: "",
- class: "toolbox-cant-fix__btn",
- onClick: handleCheck
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("TOOLBOX_RE_SCAN")), 1)
- ]),
- _: 1
- })
- ]))
- ], 64)) : createCommentVNode("", true)
- ]),
- _: 1
- })
- ]),
- _: 1
- })
- ]),
- _: 1
- }),
- createVNode(_component_el_row, { class: "progress" }, {
- default: withCtx(() => [
- createVNode(_component_el_progress, {
- percentage: progress.value,
- format
- }, null, 8, ["percentage"])
- ]),
- _: 1
- }),
- createVNode(_component_el_collapse, {
- modelValue: activeTypes.value,
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => activeTypes.value = $event),
- accordion: ""
- }, {
- default: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(fixList, (item, key) => {
- return openBlock(), createBlock(_component_el_collapse_item, {
- key,
- name: key
- }, {
- title: withCtx(() => [
- createTextVNode(toDisplayString(item.title) + " ", 1),
- createVNode(_sfc_main$1, {
- status: item.status
- }, null, 8, ["status"])
- ]),
- default: withCtx(() => [
- createBaseVNode("div", _hoisted_5, [
- createTextVNode(toDisplayString(item.msg || "") + " ", 1),
- item.handler && item.handlerText && item.value ? (openBlock(), createBlock(_sfc_main$2, {
- key: 0,
- value: item.value,
- status: item.status,
- handler: item.handler,
- "handler-text": item.handlerText
- }, null, 8, ["value", "status", "handler", "handler-text"])) : createCommentVNode("", true)
- ])
- ]),
- _: 2
- }, 1032, ["name"]);
- }), 128))
- ]),
- _: 1
- }, 8, ["modelValue"])
- ]);
- };
- }
-});
-export {
- _sfc_main as default
-};
diff --git a/dist/renderer/assets/TrayPage-D2S-w9HD.css b/dist/renderer/assets/TrayPage-D2S-w9HD.css
deleted file mode 100644
index 6b703f62..00000000
--- a/dist/renderer/assets/TrayPage-D2S-w9HD.css
+++ /dev/null
@@ -1,87 +0,0 @@
-body::-webkit-scrollbar {
- width: 0px;
-}
-#tray-page {
- background-color: transparent;
-}
-#tray-page .open-main-window {
- background: #000;
- height: 20px;
- line-height: 20px;
- text-align: center;
- color: #858585;
- font-size: 12px;
- cursor: pointer;
- transition: all 0.2s ease-in-out;
-}
-#tray-page .open-main-window:hover {
- color: #fff;
- background: #49b1f5;
-}
-#tray-page .list-title {
- text-align: center;
- color: #858585;
- font-size: 12px;
- padding: 6px 0;
- position: relative;
-}
-#tray-page .list-title:before {
- content: '';
- position: absolute;
- height: 1px;
- width: calc(100% - 36px);
- bottom: 0;
- left: 18px;
- background: #858585;
-}
-#tray-page .content {
- position: absolute;
- top: 20px;
- width: 100%;
-}
-#tray-page .img-list {
- padding: 4px 8px;
- display: flex;
- justify-content: space-between;
- align-items: center;
- cursor: pointer;
- transition: all 0.2s ease-in-out;
-}
-#tray-page .img-list:hover {
- background: #49b1f5;
-}
-#tray-page .img-list:hover .upload-img__index {
- color: #fff;
-}
-#tray-page .img-list .upload-img__container {
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
-}
-#tray-page .upload-img {
- max-width: 100%;
- object-fit: scale-down;
- margin: 0 auto;
-}
-#tray-page .upload-img__container {
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- width: 100%;
- padding: 8px 8px 4px;
- height: 100%;
-}
-#tray-page .upload-img__container.upload {
- cursor: not-allowed;
-}
-#tray-page .upload-img__title {
- text-align: center;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- color: #ddd;
- font-size: 14px;
- margin-top: 4px;
-}
diff --git a/dist/renderer/assets/TrayPage-D6P4rVmM.js b/dist/renderer/assets/TrayPage-D6P4rVmM.js
deleted file mode 100644
index 9c51e9dd..00000000
--- a/dist/renderer/assets/TrayPage-D6P4rVmM.js
+++ /dev/null
@@ -1,202 +0,0 @@
-import { d as defineComponent, r as ref, a as reactive, T, o as onBeforeMount, $ as $$db, b as onBeforeUnmount, c as createElementBlock, e as openBlock, f as createBaseVNode, t as toDisplayString, u as unref, g as createCommentVNode, F as Fragment, h as renderList, n as normalizeClass, w as withDirectives, i as resolveDirective, s as sendRPC, I as IWindowList, j as IRPCActionType, k as getConfig, l as IPasteStyle, m as triggerRPC, p as configPaths } from "./index-BqdcQlNn.js";
-import { h as handleUrlEncode } from "./common-DNjr697i.js";
-const _hoisted_1 = { id: "tray-page" };
-const _hoisted_2 = { class: "content" };
-const _hoisted_3 = {
- key: 0,
- class: "wait-upload-img"
-};
-const _hoisted_4 = { class: "list-title" };
-const _hoisted_5 = ["src"];
-const _hoisted_6 = { class: "uploaded-img" };
-const _hoisted_7 = { class: "list-title" };
-const _hoisted_8 = ["onClick"];
-const _hoisted_9 = { class: "upload-img" };
-const _hoisted_10 = ["title"];
-const __default__ = {
- name: "TrayPage"
-};
-const _sfc_main = /* @__PURE__ */ defineComponent({
- ...__default__,
- setup(__props) {
- const files = ref([]);
- const notification = reactive({
- title: T("COPY_LINK_SUCCEED"),
- body: ""
- });
- const clipboardFiles = ref([]);
- const uploadFlag = ref(false);
- function openSettingWindow() {
- sendRPC(IRPCActionType.OPEN_WINDOW, IWindowList.SETTING_WINDOW);
- }
- async function getData() {
- files.value = (await $$db.get({ orderBy: "desc", limit: 5 })).data;
- }
- const formatCustomLink = (customLink, item) => {
- const fileName = item.fileName.replace(new RegExp(`\\${item.extname}$`), "");
- const url = item.url || item.imgUrl;
- const extName = item.extname;
- const formatObj = {
- url,
- fileName,
- extName
- };
- const keys = Object.keys(formatObj);
- keys.forEach((item2) => {
- if (customLink.indexOf(`$${item2}`) !== -1) {
- const reg = new RegExp(`\\$${item2}`, "g");
- customLink = customLink.replace(reg, formatObj[item2]);
- }
- });
- return customLink;
- };
- async function copyTheLink(item) {
- const pasteStyle = await getConfig(configPaths.settings.pasteStyle) || IPasteStyle.MARKDOWN;
- const customLink = await getConfig(configPaths.settings.customLink);
- const txt = await pasteTemplate(pasteStyle, item, customLink);
- window.electron.clipboard.writeText(txt);
- const myNotification = new Notification(notification.title, notification);
- myNotification.onclick = () => {
- return true;
- };
- }
- async function pasteTemplate(style, item, customLink) {
- let url = item.url || item.imgUrl;
- if (item.type === "aws-s3" || item.type === "aws-s3-plist") {
- url = item.imgUrl || item.url || "";
- }
- if (await getConfig(configPaths.settings.encodeOutputURL) === true) {
- url = handleUrlEncode(url);
- }
- const useShortUrl = await getConfig(configPaths.settings.useShortUrl) || false;
- if (useShortUrl) {
- url = await triggerRPC(IRPCActionType.TRAY_GET_SHORT_URL, url) || url;
- }
- notification.body = url;
- const _customLink = customLink || "";
- const tpl = {
- markdown: ``,
- HTML: `
`,
- URL: url,
- UBB: `[IMG]${url}[/IMG]`,
- Custom: formatCustomLink(_customLink, {
- ...item,
- url
- })
- };
- return tpl[style];
- }
- function disableDragFile() {
- window.addEventListener(
- "dragover",
- (e) => {
- e = e || event;
- e.preventDefault();
- },
- false
- );
- window.addEventListener(
- "drop",
- (e) => {
- e = e || event;
- e.preventDefault();
- },
- false
- );
- }
- function uploadClipboardFiles() {
- if (uploadFlag.value) {
- return;
- }
- uploadFlag.value = true;
- sendRPC(IRPCActionType.TRAY_UPLOAD_CLIPBOARD_FILES);
- }
- onBeforeMount(() => {
- disableDragFile();
- getData();
- window.electron.electronAPI.ipcRenderer.on("dragFiles", async (_, _files) => {
- for (const file of _files) {
- await $$db.insert(file);
- }
- files.value = (await $$db.get({
- orderBy: "desc",
- limit: 5
- })).data;
- });
- window.electron.electronAPI.ipcRenderer.on("clipboardFiles", (_, files2) => {
- clipboardFiles.value = files2;
- });
- window.electron.electronAPI.ipcRenderer.on("uploadFiles", async () => {
- files.value = (await $$db.get({
- orderBy: "desc",
- limit: 5
- })).data;
- uploadFlag.value = false;
- });
- window.electron.electronAPI.ipcRenderer.on("updateFiles", () => {
- getData();
- });
- });
- onBeforeUnmount(() => {
- window.electron.electronAPI.ipcRenderer.removeAllListeners("dragFiles");
- window.electron.electronAPI.ipcRenderer.removeAllListeners("clipboardFiles");
- window.electron.electronAPI.ipcRenderer.removeAllListeners("uploadFiles");
- window.electron.electronAPI.ipcRenderer.removeAllListeners("updateFiles");
- });
- return (_ctx, _cache) => {
- const _directive_lazy = resolveDirective("lazy");
- return openBlock(), createElementBlock("div", _hoisted_1, [
- createBaseVNode("div", {
- class: "open-main-window",
- onClick: openSettingWindow
- }, toDisplayString(unref(T)("OPEN_MAIN_WINDOW")), 1),
- createBaseVNode("div", _hoisted_2, [
- clipboardFiles.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_3, [
- createBaseVNode("div", _hoisted_4, toDisplayString(unref(T)("WAIT_TO_UPLOAD")), 1),
- (openBlock(true), createElementBlock(Fragment, null, renderList(clipboardFiles.value, (item, index) => {
- return openBlock(), createElementBlock("div", {
- key: index,
- class: "img-list"
- }, [
- createBaseVNode("div", {
- class: normalizeClass(["upload-img__container", { upload: uploadFlag.value }]),
- onClick: uploadClipboardFiles
- }, [
- createBaseVNode("img", {
- src: item.imgUrl,
- class: "upload-img"
- }, null, 8, _hoisted_5)
- ], 2)
- ]);
- }), 128))
- ])) : createCommentVNode("", true),
- createBaseVNode("div", _hoisted_6, [
- createBaseVNode("div", _hoisted_7, toDisplayString(unref(T)("ALREADY_UPLOAD")), 1),
- (openBlock(true), createElementBlock(Fragment, null, renderList(files.value, (item) => {
- return openBlock(), createElementBlock("div", {
- key: item.imgUrl,
- class: "img-list"
- }, [
- createBaseVNode("div", {
- class: "upload-img__container",
- onClick: ($event) => copyTheLink(item)
- }, [
- withDirectives(createBaseVNode("img", _hoisted_9, null, 512), [
- [_directive_lazy, item.imgUrl]
- ]),
- createBaseVNode("div", {
- class: "upload-img__title",
- title: item.fileName
- }, toDisplayString(item.fileName), 9, _hoisted_10)
- ], 8, _hoisted_8)
- ]);
- }), 128))
- ])
- ])
- ]);
- };
- }
-});
-export {
- _sfc_main as default
-};
diff --git a/dist/renderer/assets/Upload-BgeyAvpo.js b/dist/renderer/assets/Upload-BgeyAvpo.js
deleted file mode 100644
index a0ecbf59..00000000
--- a/dist/renderer/assets/Upload-BgeyAvpo.js
+++ /dev/null
@@ -1,425 +0,0 @@
-import { M as onMounted, b as onBeforeUnmount, d as defineComponent, r as ref, l as IPasteStyle, D as watch, o as onBeforeMount, U as updatePicBedGlobal, O as SHOW_INPUT_BOX_RESPONSE, k as getConfig, s as sendRPC, j as IRPCActionType, J as ElMessage, T, a3 as picBedGlobal, c as createElementBlock, e as openBlock, q as createVNode, v as withCtx, y as resolveComponent, u as unref, p as configPaths, f as createBaseVNode, t as toDisplayString, aj as caret_bottom_default, B as createTextVNode, a0 as upload_filled_default, x as withModifiers, n as normalizeClass, F as Fragment, h as renderList, N as createBlock, m as triggerRPC, Q as useRouter, ak as PICBEDS_PAGE, af as saveConfig, S as SHOW_INPUT_BOX } from "./index-BqdcQlNn.js";
-import { _ as _sfc_main$1 } from "./ImageProcessSetting.vue_vue_type_script_setup_true_lang-DFtMAQE7.js";
-import { e as emitter } from "./bus-BjW7Y6FA.js";
-import { i as isUrl } from "./common-DNjr697i.js";
-function disableDrag(e) {
- const dropzone = document.getElementById("upload-area");
- if (dropzone === null || !dropzone.contains(e.target)) {
- e.preventDefault();
- e.dataTransfer.effectAllowed = "none";
- e.dataTransfer.dropEffect = "none";
- }
-}
-function useDragEventListeners() {
- onMounted(() => {
- window.addEventListener("dragenter", disableDrag, false);
- window.addEventListener("dragover", disableDrag);
- window.addEventListener("drop", disableDrag);
- });
- onBeforeUnmount(() => {
- window.removeEventListener("dragenter", disableDrag, false);
- window.removeEventListener("dragover", disableDrag);
- window.removeEventListener("drop", disableDrag);
- });
-}
-const _hoisted_1 = { id: "upload-view" };
-const _hoisted_2 = { class: "view-title" };
-const _hoisted_3 = { class: "upload-dragger__text" };
-const _hoisted_4 = { class: "paste-style" };
-const _hoisted_5 = { class: "el-col-12" };
-const _hoisted_6 = { class: "paste-style__text" };
-const _hoisted_7 = { class: "el-col-8" };
-const _hoisted_8 = { class: "paste-style__text" };
-const __default__ = {
- name: "UploadPage"
-};
-const _sfc_main = /* @__PURE__ */ defineComponent({
- ...__default__,
- setup(__props) {
- useDragEventListeners();
- const $router = useRouter();
- const imageProcessDialogVisible = ref(false);
- const useShortUrl = ref(false);
- const dragover = ref(false);
- const progress = ref(0);
- const showProgress = ref(false);
- const showError = ref(false);
- const pasteStyle = ref("");
- const picBedName = ref("");
- const picBedConfigName = ref("");
- const pasteFormatList = ref({
- [IPasteStyle.MARKDOWN]: "",
- [IPasteStyle.HTML]: '
',
- [IPasteStyle.URL]: "http://test.com/test.png",
- [IPasteStyle.UBB]: "[img]url[/img]",
- [IPasteStyle.CUSTOM]: ""
- });
- watch(picBedGlobal, () => {
- getDefaultPicBed();
- });
- onBeforeMount(() => {
- updatePicBedGlobal();
- window.electron.electronAPI.ipcRenderer.on("uploadProgress", (_event, _progress) => {
- if (_progress !== -1) {
- showProgress.value = true;
- progress.value = _progress;
- } else {
- progress.value = 100;
- showError.value = true;
- }
- });
- getUseShortUrl();
- getPasteStyle();
- getDefaultPicBed();
- window.electron.electronAPI.ipcRenderer.on("syncPicBed", () => {
- getDefaultPicBed();
- });
- emitter.on(SHOW_INPUT_BOX_RESPONSE, handleInputBoxValue);
- });
- const handleImageProcess = () => {
- imageProcessDialogVisible.value = true;
- };
- watch(progress, onProgressChange);
- function onProgressChange(val) {
- if (val === 100) {
- setTimeout(() => {
- showProgress.value = false;
- showError.value = false;
- }, 1e3);
- setTimeout(() => {
- progress.value = 0;
- }, 1200);
- }
- }
- async function handlePicBedNameClick(_picBedName, picBedConfigName2) {
- const formatedpicBedConfigName = picBedConfigName2 || "Default";
- const currentPicBed = await getConfig(configPaths.picBed.current);
- const currentPicBedConfig = await getConfig(`uploader.${currentPicBed}`) || {};
- const configList = await triggerRPC(IRPCActionType.PICBED_GET_CONFIG_LIST, currentPicBed);
- const currentConfigList = configList?.configList ?? [];
- const config = currentConfigList.find((item) => item._configName === formatedpicBedConfigName);
- $router.push({
- name: PICBEDS_PAGE,
- params: {
- type: currentPicBed,
- configId: config?._id || ""
- },
- query: {
- defaultConfigId: currentPicBedConfig.defaultId || ""
- }
- });
- }
- onBeforeUnmount(() => {
- emitter.off(SHOW_INPUT_BOX_RESPONSE);
- window.electron.electronAPI.ipcRenderer.removeAllListeners("uploadProgress");
- window.electron.electronAPI.ipcRenderer.removeAllListeners("syncPicBed");
- });
- function onDrop(e) {
- dragover.value = false;
- if (e.dataTransfer?.files?.length) {
- ipcSendFiles(e.dataTransfer.files);
- } else if (e.dataTransfer?.items) {
- const items = e.dataTransfer.items;
- if (items.length === 2 && items[0].type === "text/uri-list") {
- handleURLDrag(items, e.dataTransfer);
- } else if (items[0].type === "text/plain") {
- const str = e.dataTransfer.getData(items[0].type);
- if (isUrl(str)) {
- sendRPC(IRPCActionType.UPLOAD_CHOOSED_FILES, [{ path: str }]);
- } else {
- ElMessage.error(T("TIPS_DRAG_VALID_PICTURE_OR_URL"));
- }
- }
- }
- }
- function handleURLDrag(items, dataTransfer) {
- const urlString = dataTransfer.getData(items[1].type);
- const urlMatch = urlString.match(/ {
- const obj = {
- name: item.name,
- path: item.webkitRelativePath
- };
- sendFiles.push(obj);
- });
- sendRPC(IRPCActionType.UPLOAD_CHOOSED_FILES, sendFiles);
- }
- async function getPasteStyle() {
- pasteStyle.value = await getConfig(configPaths.settings.pasteStyle) || IPasteStyle.MARKDOWN;
- pasteFormatList.value.Custom = await getConfig(configPaths.settings.customLink) || "";
- }
- async function getUseShortUrl() {
- useShortUrl.value = await getConfig(configPaths.settings.useShortUrl) || false;
- }
- async function handleUseShortUrlChange() {
- saveConfig({
- [configPaths.settings.useShortUrl]: useShortUrl.value
- });
- }
- function handlePasteStyleChange(val) {
- saveConfig({
- [configPaths.settings.pasteStyle]: val || IPasteStyle.MARKDOWN
- });
- }
- function uploadClipboardFiles() {
- sendRPC(IRPCActionType.UPLOAD_CLIPBOARD_FILES_FROM_UPLOAD_PAGE);
- }
- async function uploadURLFiles() {
- const str = await navigator.clipboard.readText();
- emitter.emit(SHOW_INPUT_BOX, {
- value: isUrl(str) ? str : "",
- title: T("TIPS_INPUT_URL"),
- placeholder: T("TIPS_HTTP_PREFIX")
- });
- }
- function handleInputBoxValue(val) {
- if (val === "") return;
- if (isUrl(val)) {
- sendRPC(IRPCActionType.UPLOAD_CHOOSED_FILES, [
- {
- path: val
- }
- ]);
- } else {
- ElMessage.error(T("TIPS_INPUT_VALID_URL"));
- }
- }
- async function getDefaultPicBed() {
- const currentPicBed = await getConfig(configPaths.picBed.current);
- picBedGlobal.value.forEach((item) => {
- if (item.type === currentPicBed) {
- picBedName.value = item.name;
- }
- });
- picBedConfigName.value = await getConfig(`picBed.${currentPicBed}._configName`) || "";
- }
- async function handleChangePicBed() {
- sendRPC(IRPCActionType.SHOW_UPLOAD_PAGE_MENU);
- }
- return (_ctx, _cache) => {
- const _component_el_tooltip = resolveComponent("el-tooltip");
- const _component_el_icon = resolveComponent("el-icon");
- const _component_el_button = resolveComponent("el-button");
- const _component_el_progress = resolveComponent("el-progress");
- const _component_el_radio_button = resolveComponent("el-radio-button");
- const _component_el_radio_group = resolveComponent("el-radio-group");
- const _component_el_col = resolveComponent("el-col");
- const _component_el_row = resolveComponent("el-row");
- const _component_el_dialog = resolveComponent("el-dialog");
- return openBlock(), createElementBlock("div", _hoisted_1, [
- createVNode(_component_el_row, {
- gutter: 16,
- align: "middle"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_col, { span: 24 }, {
- default: withCtx(() => [
- createBaseVNode("div", _hoisted_2, [
- createVNode(_component_el_tooltip, {
- placement: "top",
- effect: "light",
- content: unref(T)("UPLOAD_VIEW_HINT"),
- persistent: false,
- teleported: ""
- }, {
- default: withCtx(() => [
- createBaseVNode("span", {
- id: "upload-view-title",
- onClick: _cache[0] || (_cache[0] = ($event) => handlePicBedNameClick(picBedName.value, picBedConfigName.value))
- }, toDisplayString(picBedName.value) + " - " + toDisplayString(picBedConfigName.value || "Default"), 1)
- ]),
- _: 1
- }, 8, ["content"]),
- createVNode(_component_el_icon, {
- style: { "cursor": "pointer", "margin-left": "4px" },
- onClick: handleChangePicBed
- }, {
- default: withCtx(() => [
- createVNode(unref(caret_bottom_default))
- ]),
- _: 1
- }),
- createVNode(_component_el_button, {
- type: "primary",
- round: "",
- size: "small",
- class: "quick-upload",
- style: { "margin-left": "6px" },
- onClick: handleImageProcess
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("UPLOAD_PAGE_IMAGE_PROCESS_NAME")), 1)
- ]),
- _: 1
- })
- ]),
- createBaseVNode("div", {
- id: "upload-area",
- class: normalizeClass({ "is-dragover": dragover.value }),
- onDrop: withModifiers(onDrop, ["prevent"]),
- onDragover: _cache[1] || (_cache[1] = withModifiers(($event) => dragover.value = true, ["prevent"])),
- onDragleave: _cache[2] || (_cache[2] = withModifiers(($event) => dragover.value = false, ["prevent"]))
- }, [
- createBaseVNode("div", {
- id: "upload-dragger",
- onClick: openUplodWindow
- }, [
- createVNode(_component_el_icon, null, {
- default: withCtx(() => [
- createVNode(unref(upload_filled_default))
- ]),
- _: 1
- }),
- createBaseVNode("div", _hoisted_3, [
- createTextVNode(toDisplayString(unref(T)("DRAG_FILE_TO_HERE")) + " ", 1),
- createBaseVNode("span", null, toDisplayString(unref(T)("CLICK_TO_UPLOAD")), 1)
- ]),
- createBaseVNode("input", {
- id: "file-uploader",
- type: "file",
- multiple: "",
- onChange
- }, null, 32)
- ])
- ], 34),
- createVNode(_component_el_progress, {
- percentage: progress.value,
- "show-text": false,
- class: normalizeClass(["upload-progress", { show: showProgress.value }]),
- status: showError.value ? "exception" : void 0
- }, null, 8, ["percentage", "class", "status"]),
- createBaseVNode("div", _hoisted_4, [
- createBaseVNode("div", _hoisted_5, [
- createBaseVNode("div", _hoisted_6, toDisplayString(unref(T)("LINK_FORMAT")), 1),
- createVNode(_component_el_radio_group, {
- modelValue: pasteStyle.value,
- "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => pasteStyle.value = $event),
- size: "small",
- onChange: handlePasteStyleChange
- }, {
- default: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(pasteFormatList.value, (item, key) => {
- return openBlock(), createBlock(_component_el_radio_button, {
- key,
- value: key,
- title: item
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(key), 1)
- ]),
- _: 2
- }, 1032, ["value", "title"]);
- }), 128))
- ]),
- _: 1
- }, 8, ["modelValue"]),
- createVNode(_component_el_radio_group, {
- modelValue: useShortUrl.value,
- "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => useShortUrl.value = $event),
- size: "small",
- onChange: handleUseShortUrlChange
- }, {
- default: withCtx(() => [
- createVNode(_component_el_radio_button, {
- value: true,
- style: { "border-radius": "5px" }
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("UPLOAD_SHORT_URL")), 1)
- ]),
- _: 1
- }),
- createVNode(_component_el_radio_button, {
- value: false,
- style: { "border-radius": "5px" }
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("UPLOAD_NORMAL_URL")), 1)
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["modelValue"])
- ]),
- createBaseVNode("div", _hoisted_7, [
- createBaseVNode("div", _hoisted_8, toDisplayString(unref(T)("QUICK_UPLOAD")), 1),
- createVNode(_component_el_button, {
- type: "primary",
- round: "",
- size: "small",
- class: "quick-upload",
- style: { "width": "50%" },
- onClick: uploadClipboardFiles
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("CLIPBOARD_PICTURE")), 1)
- ]),
- _: 1
- }),
- createVNode(_component_el_button, {
- type: "primary",
- round: "",
- size: "small",
- class: "quick-upload",
- style: { "width": "46%", "margin-left": "6px" },
- onClick: uploadURLFiles
- }, {
- default: withCtx(() => _cache[7] || (_cache[7] = [
- createTextVNode(" URL ", -1)
- ])),
- _: 1,
- __: [7]
- })
- ])
- ])
- ]),
- _: 1
- })
- ]),
- _: 1
- }),
- createVNode(_component_el_dialog, {
- modelValue: imageProcessDialogVisible.value,
- "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => imageProcessDialogVisible.value = $event),
- title: unref(T)("UPLOAD_PAGE_IMAGE_PROCESS_DIALOG_TITLE"),
- width: "50%",
- draggable: "",
- center: "",
- "align-center": "",
- "append-to-body": ""
- }, {
- default: withCtx(() => [
- createVNode(_sfc_main$1, {
- modelValue: imageProcessDialogVisible.value,
- "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => imageProcessDialogVisible.value = $event)
- }, null, 8, ["modelValue"])
- ]),
- _: 1
- }, 8, ["modelValue", "title"])
- ]);
- };
- }
-});
-export {
- _sfc_main as default
-};
diff --git a/dist/renderer/assets/Upload-DQdUIROq.css b/dist/renderer/assets/Upload-DQdUIROq.css
deleted file mode 100644
index ed1b960e..00000000
--- a/dist/renderer/assets/Upload-DQdUIROq.css
+++ /dev/null
@@ -1,93 +0,0 @@
-.view-title {
- display: flex;
- color: #eee;
- font-size: 20px;
- text-align: center;
- margin: 10px auto;
- align-items: center;
- justify-content: center;
-}
-#upload-view-title:hover {
- cursor: pointer;
- color: #409eff;
-}
-#upload-view {
- position: absolute;
- left: 142px;
- right: 0;
- height: 100%;
-}
-#upload-view .view-title {
- margin: 10vh auto 10px;
-}
-#upload-view #upload-area {
- height: 50vh;
- border: 2px dashed #ddd;
- border-radius: 8px;
- text-align: center;
- width: 60vw;
- margin: 0 auto;
- color: #ddd;
- cursor: pointer;
- transition: all 0.2s ease-in-out;
- align-items: center;
-}
-#upload-view #upload-area #upload-dragger {
- height: 100%;
- item-align: center;
-}
-#upload-view #upload-area.is-dragover,
-#upload-view #upload-area:hover {
- border: 2px dashed #a4d8fa;
- background-color: rgba(164,216,250,0.3);
- color: #fff;
-}
-#upload-view #upload-area i {
- height: 80%;
- font-size: 10vh;
- margin: 0;
-}
-#upload-view #upload-area span {
- color: #409eff;
-}
-#upload-view #file-uploader {
- display: none;
-}
-#upload-view .upload-progress {
- opacity: 0;
- transition: all 0.2s ease-in-out;
- width: 450px;
- margin: 20px auto 0;
-}
-#upload-view .upload-progress.show {
- opacity: 1;
-}
-#upload-view .upload-progress .el-progress-bar__inner {
- transition: all 0.2s ease-in-out;
-}
-#upload-view .paste-style {
- justify-content: center;
- text-align: center;
- margin-top: 16px;
- display: flex;
- align-items: flex-end;
-}
-#upload-view .paste-style__text {
- font-size: 12px;
- color: #eee;
- margin-bottom: 4px;
-}
-#upload-view .el-radio-button:first-child .el-radio-button__inner {
- border-left: none;
-}
-#upload-view .el-radio-button:first-child .el-radio-button__inner {
- border-left: none;
- border-radius: 14px 0 0 14px;
-}
-#upload-view .el-radio-button:last-child .el-radio-button__inner {
- border-left: none;
- border-radius: 0 14px 14px 0;
-}
-#upload-view .el-icon-caret-bottom {
- cursor: pointer;
-}
diff --git a/dist/renderer/assets/UploaderConfigPage-BvifEShU.js b/dist/renderer/assets/UploaderConfigPage-BvifEShU.js
deleted file mode 100644
index 77afc762..00000000
--- a/dist/renderer/assets/UploaderConfigPage-BvifEShU.js
+++ /dev/null
@@ -1,207 +0,0 @@
-import { d as defineComponent, r as ref, W as onBeforeRouteUpdate, o as onBeforeMount, al as useRoute, m as triggerRPC, j as IRPCActionType, c as createElementBlock, e as openBlock, f as createBaseVNode, q as createVNode, t as toDisplayString, u as unref, T, v as withCtx, y as resolveComponent, F as Fragment, h as renderList, N as createBlock, g as createCommentVNode, aJ as edit_default, x as withModifiers, n as normalizeClass, a_ as delete_default, bm as plus_default, bn as useStore, B as createTextVNode, s as sendRPC, Q as useRouter, ak as PICBEDS_PAGE, b4 as dayjs, af as saveConfig, p as configPaths, bo as UPLOADER_CONFIG_PAGE } from "./index-BqdcQlNn.js";
-const _hoisted_1 = { id: "config-list-view" };
-const _hoisted_2 = { class: "view-title" };
-const _hoisted_3 = ["onClick"];
-const _hoisted_4 = { class: "config-name" };
-const _hoisted_5 = { class: "config-update-time" };
-const _hoisted_6 = {
- key: 0,
- class: "default-text"
-};
-const _hoisted_7 = { class: "operation-container" };
-const __default__ = {
- name: "UploaderConfigPage"
-};
-const _sfc_main = /* @__PURE__ */ defineComponent({
- ...__default__,
- setup(__props) {
- const router = useRouter();
- const route = useRoute();
- const type = ref("");
- const curConfigList = ref([]);
- const defaultConfigId = ref("");
- const store = useStore();
- async function selectItem(id) {
- await triggerRPC(IRPCActionType.UPLOADER_SELECT, type.value, id);
- if (store?.state.defaultPicBed === type.value) {
- sendRPC(
- IRPCActionType.TRAY_SET_TOOL_TIP,
- `${type.value} ${curConfigList.value.find((item) => item._id === id)?._configName || ""}`
- );
- }
- defaultConfigId.value = id;
- }
- onBeforeRouteUpdate((to, _, next) => {
- if (to.params.type && to.name === UPLOADER_CONFIG_PAGE) {
- type.value = to.params.type;
- getCurrentConfigList();
- }
- next();
- });
- onBeforeMount(() => {
- type.value = route.params.type;
- getCurrentConfigList();
- });
- async function getCurrentConfigList() {
- const configList = await triggerRPC(IRPCActionType.PICBED_GET_CONFIG_LIST, type.value);
- curConfigList.value = configList?.configList ?? [];
- defaultConfigId.value = configList?.defaultId ?? "";
- }
- function openEditPage(configId) {
- router.push({
- name: PICBEDS_PAGE,
- params: {
- type: type.value,
- configId
- },
- query: {
- defaultConfigId: defaultConfigId.value
- }
- });
- }
- function formatTime(time) {
- return dayjs(time).format("YY-MM-DD HH:mm");
- }
- async function deleteConfig(id) {
- const res = await triggerRPC(IRPCActionType.PICBED_DELETE_CONFIG, type.value, id);
- if (!res) return;
- curConfigList.value = res.configList;
- defaultConfigId.value = res.defaultId;
- }
- function addNewConfig() {
- router.push({
- name: PICBEDS_PAGE,
- params: {
- type: type.value,
- configId: ""
- }
- });
- }
- function setDefaultPicBed(type2) {
- saveConfig({
- [configPaths.picBed.current]: type2,
- [configPaths.picBed.uploader]: type2
- });
- store?.setDefaultPicBed(type2);
- const currentConfigName = curConfigList.value.find((item) => item._id === defaultConfigId.value)?._configName;
- sendRPC(IRPCActionType.TRAY_SET_TOOL_TIP, `${type2} ${currentConfigName || ""}`);
- const successNotification = new Notification(T("SETTINGS_DEFAULT_PICBED"), {
- body: T("TIPS_SET_SUCCEED")
- });
- successNotification.onclick = () => {
- return true;
- };
- }
- return (_ctx, _cache) => {
- const _component_el_icon = resolveComponent("el-icon");
- const _component_el_col = resolveComponent("el-col");
- const _component_el_row = resolveComponent("el-row");
- const _component_el_button = resolveComponent("el-button");
- return openBlock(), createElementBlock("div", _hoisted_1, [
- createBaseVNode("div", _hoisted_2, toDisplayString(unref(T)("SETTINGS")), 1),
- createVNode(_component_el_row, {
- gutter: 15,
- justify: "space-between",
- align: "middle",
- type: "flex",
- class: "config-list"
- }, {
- default: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(curConfigList.value, (item) => {
- return openBlock(), createBlock(_component_el_col, {
- key: item._id,
- class: "config-item-col",
- xs: 24,
- sm: curConfigList.value.length === 1 ? 24 : 12,
- md: curConfigList.value.length === 1 ? 24 : 12,
- lg: curConfigList.value.length === 1 ? 12 : 6,
- xl: curConfigList.value.length === 1 ? 12 : 3
- }, {
- default: withCtx(() => [
- createBaseVNode("div", {
- class: normalizeClass(`config-item ${defaultConfigId.value === item._id ? "selected" : ""}`),
- onClick: () => selectItem(item._id)
- }, [
- createBaseVNode("div", _hoisted_4, toDisplayString(item._configName), 1),
- createBaseVNode("div", _hoisted_5, toDisplayString(formatTime(item._updatedAt)), 1),
- defaultConfigId.value === item._id ? (openBlock(), createElementBlock("div", _hoisted_6, toDisplayString(unref(T)("SELECTED_SETTING_HINT")), 1)) : createCommentVNode("", true),
- createBaseVNode("div", _hoisted_7, [
- createVNode(_component_el_icon, {
- class: "el-icon-edit",
- onClick: ($event) => openEditPage(item._id)
- }, {
- default: withCtx(() => [
- createVNode(unref(edit_default))
- ]),
- _: 2
- }, 1032, ["onClick"]),
- createVNode(_component_el_icon, {
- class: normalizeClass(["el-icon-delete", curConfigList.value.length <= 1 ? "disabled" : ""]),
- onClick: withModifiers(() => deleteConfig(item._id), ["stop"])
- }, {
- default: withCtx(() => [
- createVNode(unref(delete_default))
- ]),
- _: 2
- }, 1032, ["class", "onClick"])
- ])
- ], 10, _hoisted_3)
- ]),
- _: 2
- }, 1032, ["sm", "md", "lg", "xl"]);
- }), 128)),
- createVNode(_component_el_col, {
- class: "config-item-col",
- xs: 24,
- sm: curConfigList.value.length === 1 ? 24 : 12,
- md: curConfigList.value.length === 1 ? 24 : 12,
- lg: curConfigList.value.length === 1 ? 12 : 6,
- xl: curConfigList.value.length === 1 ? 12 : 3
- }, {
- default: withCtx(() => [
- createBaseVNode("div", {
- class: "config-item config-item-add",
- onClick: addNewConfig
- }, [
- createVNode(_component_el_icon, { class: "el-icon-plus" }, {
- default: withCtx(() => [
- createVNode(unref(plus_default))
- ]),
- _: 1
- })
- ])
- ]),
- _: 1
- }, 8, ["sm", "md", "lg", "xl"])
- ]),
- _: 1
- }),
- createVNode(_component_el_row, {
- type: "flex",
- justify: "center",
- span: 24,
- class: "set-default-container"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_button, {
- class: "set-default-btn",
- type: "success",
- round: "",
- disabled: unref(store)?.state.defaultPicBed === type.value,
- onClick: _cache[0] || (_cache[0] = ($event) => setDefaultPicBed(type.value))
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("SETTINGS_SET_DEFAULT_PICBED")), 1)
- ]),
- _: 1
- }, 8, ["disabled"])
- ]),
- _: 1
- })
- ]);
- };
- }
-});
-export {
- _sfc_main as default
-};
diff --git a/dist/renderer/assets/UploaderConfigPage-CYEWTO-c.css b/dist/renderer/assets/UploaderConfigPage-CYEWTO-c.css
deleted file mode 100644
index 2c368e97..00000000
--- a/dist/renderer/assets/UploaderConfigPage-CYEWTO-c.css
+++ /dev/null
@@ -1,90 +0,0 @@
-#config-list-view {
- position: absolute;
- min-height: 100%;
- left: 162px;
- right: 0;
- overflow-x: hidden;
- overflow-y: auto;
- padding-bottom: 50px;
- box-sizing: border-box;
-}
-#config-list-view .config-list {
- flex-wrap: wrap;
- width: 98%;
-}
-#config-list-view .config-list .config-item {
- height: 85px;
- margin-bottom: 20px;
- border-radius: 4px;
- cursor: pointer;
- box-sizing: border-box;
- padding: 8px;
- background: rgba(130,130,130,0.2);
- border: 1px solid transparent;
- box-shadow: 0 2px 4px rgba(0,0,0,0.12), 0 0 6px rgba(0,0,0,0.04);
- position: relative;
-}
-#config-list-view .config-list .config-item .config-name {
- color: #eee;
- font-size: 16px;
-}
-#config-list-view .config-list .config-item .config-update-time {
- color: #aaa;
- font-size: 14px;
- margin-top: 10px;
-}
-#config-list-view .config-list .config-item .default-text {
- color: #67c23a;
- font-size: 12px;
- margin-top: 5px;
-}
-#config-list-view .config-list .config-item .operation-container {
- position: absolute;
- right: 5px;
- top: 8px;
- left: 0;
- font-size: 18pxc;
- word-break: break-all;
- display: flex;
- align-items: center;
- color: #eee;
-}
-#config-list-view .config-list .config-item .operation-container .el-icon-edit {
- right: 20px;
- position: absolute;
- top: 2px;
- margin-right: 10px;
- cursor: pointer;
-}
-#config-list-view .config-list .config-item .operation-container .el-icon-delete {
- position: absolute;
- top: 2px;
- margin-right: 10px;
- right: 0;
- cursor: pointer;
-}
-#config-list-view .config-list .config-item .operation-container .el-icon-edit {
- margin-right: 10px;
-}
-#config-list-view .config-list .config-item .operation-container .disabled {
- cursor: not-allowed;
- color: #aaa;
-}
-#config-list-view .config-list .config-item-add {
- display: flex;
- justify-content: center;
- align-items: center;
- color: #eee;
- font-size: 28px;
-}
-#config-list-view .config-list .selected {
- border: 1px solid #409eff;
-}
-#config-list-view .set-default-container {
- position: absolute;
- bottom: 10px;
- width: 100%;
-}
-#config-list-view .set-default-container .set-default-btn {
- width: 250px;
-}
diff --git a/dist/renderer/assets/bucketFileDb-qvw68roE.js b/dist/renderer/assets/bucketFileDb-qvw68roE.js
deleted file mode 100644
index 0f23e2ab..00000000
--- a/dist/renderer/assets/bucketFileDb-qvw68roE.js
+++ /dev/null
@@ -1,2586 +0,0 @@
-const e = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : "undefined" != typeof window ? window : global, t = Object.keys, n = Array.isArray;
-function r(e2, n2) {
- return "object" != typeof n2 || t(n2).forEach(function(t2) {
- e2[t2] = n2[t2];
- }), e2;
-}
-"undefined" == typeof Promise || e.Promise || (e.Promise = Promise);
-const s = Object.getPrototypeOf, i = {}.hasOwnProperty;
-function o(e2, t2) {
- return i.call(e2, t2);
-}
-function a(e2, n2) {
- "function" == typeof n2 && (n2 = n2(s(e2))), ("undefined" == typeof Reflect ? t : Reflect.ownKeys)(n2).forEach((t2) => {
- l(e2, t2, n2[t2]);
- });
-}
-const u = Object.defineProperty;
-function l(e2, t2, n2, s2) {
- u(e2, t2, r(n2 && o(n2, "get") && "function" == typeof n2.get ? { get: n2.get, set: n2.set, configurable: true } : { value: n2, configurable: true, writable: true }, s2));
-}
-function c(e2) {
- return { from: function(t2) {
- return e2.prototype = Object.create(t2.prototype), l(e2.prototype, "constructor", e2), { extend: a.bind(null, e2.prototype) };
- } };
-}
-const h = Object.getOwnPropertyDescriptor;
-function d(e2, t2) {
- let n2;
- return h(e2, t2) || (n2 = s(e2)) && d(n2, t2);
-}
-const f = [].slice;
-function p(e2, t2, n2) {
- return f.call(e2, t2, n2);
-}
-function y(e2, t2) {
- return t2(e2);
-}
-function m(e2) {
- if (!e2) throw new Error("Assertion Failed");
-}
-function v(t2) {
- e.setImmediate ? setImmediate(t2) : setTimeout(t2, 0);
-}
-function g(e2, t2) {
- return e2.reduce((e3, n2, r2) => {
- var s2 = t2(n2, r2);
- return s2 && (e3[s2[0]] = s2[1]), e3;
- }, {});
-}
-function b(e2, t2) {
- if (o(e2, t2)) return e2[t2];
- if (!t2) return e2;
- if ("string" != typeof t2) {
- for (var n2 = [], r2 = 0, s2 = t2.length; r2 < s2; ++r2) {
- var i2 = b(e2, t2[r2]);
- n2.push(i2);
- }
- return n2;
- }
- var a2 = t2.indexOf(".");
- if (-1 !== a2) {
- var u2 = e2[t2.substr(0, a2)];
- return void 0 === u2 ? void 0 : b(u2, t2.substr(a2 + 1));
- }
-}
-function _(e2, t2, r2) {
- if (e2 && void 0 !== t2 && (!("isFrozen" in Object) || !Object.isFrozen(e2))) if ("string" != typeof t2 && "length" in t2) {
- m("string" != typeof r2 && "length" in r2);
- for (var s2 = 0, i2 = t2.length; s2 < i2; ++s2) _(e2, t2[s2], r2[s2]);
- } else {
- var a2 = t2.indexOf(".");
- if (-1 !== a2) {
- var u2 = t2.substr(0, a2), l2 = t2.substr(a2 + 1);
- if ("" === l2) void 0 === r2 ? n(e2) && !isNaN(parseInt(u2)) ? e2.splice(u2, 1) : delete e2[u2] : e2[u2] = r2;
- else {
- var c2 = e2[u2];
- c2 && o(e2, u2) || (c2 = e2[u2] = {}), _(c2, l2, r2);
- }
- } else void 0 === r2 ? n(e2) && !isNaN(parseInt(t2)) ? e2.splice(t2, 1) : delete e2[t2] : e2[t2] = r2;
- }
-}
-function w(e2) {
- var t2 = {};
- for (var n2 in e2) o(e2, n2) && (t2[n2] = e2[n2]);
- return t2;
-}
-const x = [].concat;
-function k(e2) {
- return x.apply([], e2);
-}
-const E = "Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(k([8, 16, 32, 64].map((e2) => ["Int", "Uint", "Float"].map((t2) => t2 + e2 + "Array")))).filter((t2) => e[t2]), P = E.map((t2) => e[t2]);
-g(E, (e2) => [e2, true]);
-let K = null;
-function O(e2) {
- K = "undefined" != typeof WeakMap && /* @__PURE__ */ new WeakMap();
- const t2 = S(e2);
- return K = null, t2;
-}
-function S(e2) {
- if (!e2 || "object" != typeof e2) return e2;
- let t2 = K && K.get(e2);
- if (t2) return t2;
- if (n(e2)) {
- t2 = [], K && K.set(e2, t2);
- for (var r2 = 0, i2 = e2.length; r2 < i2; ++r2) t2.push(S(e2[r2]));
- } else if (P.indexOf(e2.constructor) >= 0) t2 = e2;
- else {
- const n2 = s(e2);
- for (var a2 in t2 = n2 === Object.prototype ? {} : Object.create(n2), K && K.set(e2, t2), e2) o(e2, a2) && (t2[a2] = S(e2[a2]));
- }
- return t2;
-}
-const { toString: A } = {};
-function C(e2) {
- return A.call(e2).slice(8, -1);
-}
-const j = "undefined" != typeof Symbol ? Symbol.iterator : "@@iterator", D = "symbol" == typeof j ? function(e2) {
- var t2;
- return null != e2 && (t2 = e2[j]) && t2.apply(e2);
-} : function() {
- return null;
-}, I = {};
-function B(e2) {
- var t2, r2, s2, i2;
- if (1 === arguments.length) {
- if (n(e2)) return e2.slice();
- if (this === I && "string" == typeof e2) return [e2];
- if (i2 = D(e2)) {
- for (r2 = []; !(s2 = i2.next()).done; ) r2.push(s2.value);
- return r2;
- }
- if (null == e2) return [e2];
- if ("number" == typeof (t2 = e2.length)) {
- for (r2 = new Array(t2); t2--; ) r2[t2] = e2[t2];
- return r2;
- }
- return [e2];
- }
- for (t2 = arguments.length, r2 = new Array(t2); t2--; ) r2[t2] = arguments[t2];
- return r2;
-}
-const T = "undefined" != typeof Symbol ? (e2) => "AsyncFunction" === e2[Symbol.toStringTag] : () => false;
-var R = "undefined" != typeof location && /^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);
-function F(e2, t2) {
- R = e2, M = t2;
-}
-var M = () => true;
-const N = !new Error("").stack;
-function q() {
- if (N) try {
- throw q.arguments, new Error();
- } catch (e2) {
- return e2;
- }
- return new Error();
-}
-function $(e2, t2) {
- var n2 = e2.stack;
- return n2 ? (t2 = t2 || 0, 0 === n2.indexOf(e2.name) && (t2 += (e2.name + e2.message).split("\n").length), n2.split("\n").slice(t2).filter(M).map((e3) => "\n" + e3).join("")) : "";
-}
-var U = ["Unknown", "Constraint", "Data", "TransactionInactive", "ReadOnly", "Version", "NotFound", "InvalidState", "InvalidAccess", "Abort", "Timeout", "QuotaExceeded", "Syntax", "DataClone"], L = ["Modify", "Bulk", "OpenFailed", "VersionChange", "Schema", "Upgrade", "InvalidTable", "MissingAPI", "NoSuchDatabase", "InvalidArgument", "SubTransaction", "Unsupported", "Internal", "DatabaseClosed", "PrematureCommit", "ForeignAwait"].concat(U), V = { VersionChanged: "Database version changed by other database connection", DatabaseClosed: "Database has been closed", Abort: "Transaction aborted", TransactionInactive: "Transaction has already completed or failed", MissingAPI: "IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb" };
-function W(e2, t2) {
- this._e = q(), this.name = e2, this.message = t2;
-}
-function Y(e2, t2) {
- return e2 + ". Errors: " + Object.keys(t2).map((e3) => t2[e3].toString()).filter((e3, t3, n2) => n2.indexOf(e3) === t3).join("\n");
-}
-function z(e2, t2, n2, r2) {
- this._e = q(), this.failures = t2, this.failedKeys = r2, this.successCount = n2, this.message = Y(e2, t2);
-}
-function G(e2, t2) {
- this._e = q(), this.name = "BulkError", this.failures = Object.keys(t2).map((e3) => t2[e3]), this.failuresByPos = t2, this.message = Y(e2, t2);
-}
-c(W).from(Error).extend({ stack: { get: function() {
- return this._stack || (this._stack = this.name + ": " + this.message + $(this._e, 2));
-} }, toString: function() {
- return this.name + ": " + this.message;
-} }), c(z).from(W), c(G).from(W);
-var H = L.reduce((e2, t2) => (e2[t2] = t2 + "Error", e2), {});
-const Q = W;
-var X = L.reduce((e2, t2) => {
- var n2 = t2 + "Error";
- function r2(e3, r3) {
- this._e = q(), this.name = n2, e3 ? "string" == typeof e3 ? (this.message = `${e3}${r3 ? "\n " + r3 : ""}`, this.inner = r3 || null) : "object" == typeof e3 && (this.message = `${e3.name} ${e3.message}`, this.inner = e3) : (this.message = V[t2] || n2, this.inner = null);
- }
- return c(r2).from(Q), e2[t2] = r2, e2;
-}, {});
-X.Syntax = SyntaxError, X.Type = TypeError, X.Range = RangeError;
-var J = U.reduce((e2, t2) => (e2[t2 + "Error"] = X[t2], e2), {});
-var Z = L.reduce((e2, t2) => (-1 === ["Syntax", "Type", "Range"].indexOf(t2) && (e2[t2 + "Error"] = X[t2]), e2), {});
-function ee() {
-}
-function te(e2) {
- return e2;
-}
-function ne(e2, t2) {
- return null == e2 || e2 === te ? t2 : function(n2) {
- return t2(e2(n2));
- };
-}
-function re(e2, t2) {
- return function() {
- e2.apply(this, arguments), t2.apply(this, arguments);
- };
-}
-function se(e2, t2) {
- return e2 === ee ? t2 : function() {
- var n2 = e2.apply(this, arguments);
- void 0 !== n2 && (arguments[0] = n2);
- var r2 = this.onsuccess, s2 = this.onerror;
- this.onsuccess = null, this.onerror = null;
- var i2 = t2.apply(this, arguments);
- return r2 && (this.onsuccess = this.onsuccess ? re(r2, this.onsuccess) : r2), s2 && (this.onerror = this.onerror ? re(s2, this.onerror) : s2), void 0 !== i2 ? i2 : n2;
- };
-}
-function ie(e2, t2) {
- return e2 === ee ? t2 : function() {
- e2.apply(this, arguments);
- var n2 = this.onsuccess, r2 = this.onerror;
- this.onsuccess = this.onerror = null, t2.apply(this, arguments), n2 && (this.onsuccess = this.onsuccess ? re(n2, this.onsuccess) : n2), r2 && (this.onerror = this.onerror ? re(r2, this.onerror) : r2);
- };
-}
-function oe(e2, t2) {
- return e2 === ee ? t2 : function(n2) {
- var s2 = e2.apply(this, arguments);
- r(n2, s2);
- var i2 = this.onsuccess, o2 = this.onerror;
- this.onsuccess = null, this.onerror = null;
- var a2 = t2.apply(this, arguments);
- return i2 && (this.onsuccess = this.onsuccess ? re(i2, this.onsuccess) : i2), o2 && (this.onerror = this.onerror ? re(o2, this.onerror) : o2), void 0 === s2 ? void 0 === a2 ? void 0 : a2 : r(s2, a2);
- };
-}
-function ae(e2, t2) {
- return e2 === ee ? t2 : function() {
- return false !== t2.apply(this, arguments) && e2.apply(this, arguments);
- };
-}
-function ue(e2, t2) {
- return e2 === ee ? t2 : function() {
- var n2 = e2.apply(this, arguments);
- if (n2 && "function" == typeof n2.then) {
- for (var r2 = this, s2 = arguments.length, i2 = new Array(s2); s2--; ) i2[s2] = arguments[s2];
- return n2.then(function() {
- return t2.apply(r2, i2);
- });
- }
- return t2.apply(this, arguments);
- };
-}
-Z.ModifyError = z, Z.DexieError = W, Z.BulkError = G;
-var le = {};
-const ce = 100, [he, de, fe] = "undefined" == typeof Promise ? [] : (() => {
- let e2 = Promise.resolve();
- if ("undefined" == typeof crypto || !crypto.subtle) return [e2, s(e2), e2];
- const t2 = crypto.subtle.digest("SHA-512", new Uint8Array([0]));
- return [t2, s(t2), e2];
-})(), pe = de && de.then, ye = he && he.constructor, me = !!fe;
-var ve = false, ge = fe ? () => {
- fe.then($e);
-} : e.setImmediate ? setImmediate.bind(null, $e) : e.MutationObserver ? () => {
- var e2 = document.createElement("div");
- new MutationObserver(() => {
- $e(), e2 = null;
- }).observe(e2, { attributes: true }), e2.setAttribute("i", "1");
-} : () => {
- setTimeout($e, 0);
-}, be = function(e2, t2) {
- Se.push([e2, t2]), we && (ge(), we = false);
-}, _e = true, we = true, xe = [], ke = [], Ee = null, Pe = te, Ke = { id: "global", global: true, ref: 0, unhandleds: [], onunhandled: dt, pgp: false, env: {}, finalize: function() {
- this.unhandleds.forEach((e2) => {
- try {
- dt(e2[0], e2[1]);
- } catch (e3) {
- }
- });
-} }, Oe = Ke, Se = [], Ae = 0, Ce = [];
-function je(e2) {
- if ("object" != typeof this) throw new TypeError("Promises must be constructed via new");
- this._listeners = [], this.onuncatched = ee, this._lib = false;
- var t2 = this._PSD = Oe;
- if (R && (this._stackHolder = q(), this._prev = null, this._numPrev = 0), "function" != typeof e2) {
- if (e2 !== le) throw new TypeError("Not a function");
- return this._state = arguments[1], this._value = arguments[2], void (false === this._state && Te(this, this._value));
- }
- this._state = null, this._value = null, ++t2.ref, Be(this, e2);
-}
-const De = { get: function() {
- var e2 = Oe, t2 = Xe;
- function n2(n3, r2) {
- var s2 = !e2.global && (e2 !== Oe || t2 !== Xe);
- const i2 = s2 && !tt();
- var o2 = new je((t3, o3) => {
- Fe(this, new Ie(lt(n3, e2, s2, i2), lt(r2, e2, s2, i2), t3, o3, e2));
- });
- return R && qe(o2, this), o2;
- }
- return n2.prototype = le, n2;
-}, set: function(e2) {
- l(this, "then", e2 && e2.prototype === le ? De : { get: function() {
- return e2;
- }, set: De.set });
-} };
-function Ie(e2, t2, n2, r2, s2) {
- this.onFulfilled = "function" == typeof e2 ? e2 : null, this.onRejected = "function" == typeof t2 ? t2 : null, this.resolve = n2, this.reject = r2, this.psd = s2;
-}
-function Be(e2, t2) {
- try {
- t2((t3) => {
- if (null === e2._state) {
- if (t3 === e2) throw new TypeError("A promise cannot be resolved with itself.");
- var n2 = e2._lib && Ue();
- t3 && "function" == typeof t3.then ? Be(e2, (e3, n3) => {
- t3 instanceof je ? t3._then(e3, n3) : t3.then(e3, n3);
- }) : (e2._state = true, e2._value = t3, Re(e2)), n2 && Le();
- }
- }, Te.bind(null, e2));
- } catch (t3) {
- Te(e2, t3);
- }
-}
-function Te(e2, t2) {
- if (ke.push(t2), null === e2._state) {
- var n2 = e2._lib && Ue();
- t2 = Pe(t2), e2._state = false, e2._value = t2, R && null !== t2 && "object" == typeof t2 && !t2._promise && function(e3, t3, n3) {
- try {
- e3.apply(null, n3);
- } catch (e4) {
- }
- }(() => {
- var n3 = d(t2, "stack");
- t2._promise = e2, l(t2, "stack", { get: () => ve ? n3 && (n3.get ? n3.get.apply(t2) : n3.value) : e2.stack });
- }), function(e3) {
- xe.some((t3) => t3._value === e3._value) || xe.push(e3);
- }(e2), Re(e2), n2 && Le();
- }
-}
-function Re(e2) {
- var t2 = e2._listeners;
- e2._listeners = [];
- for (var n2 = 0, r2 = t2.length; n2 < r2; ++n2) Fe(e2, t2[n2]);
- var s2 = e2._PSD;
- --s2.ref || s2.finalize(), 0 === Ae && (++Ae, be(() => {
- 0 == --Ae && Ve();
- }, []));
-}
-function Fe(e2, t2) {
- if (null !== e2._state) {
- var n2 = e2._state ? t2.onFulfilled : t2.onRejected;
- if (null === n2) return (e2._state ? t2.resolve : t2.reject)(e2._value);
- ++t2.psd.ref, ++Ae, be(Me, [n2, e2, t2]);
- } else e2._listeners.push(t2);
-}
-function Me(e2, t2, n2) {
- try {
- Ee = t2;
- var r2, s2 = t2._value;
- t2._state ? r2 = e2(s2) : (ke.length && (ke = []), r2 = e2(s2), -1 === ke.indexOf(s2) && function(e3) {
- var t3 = xe.length;
- for (; t3; ) if (xe[--t3]._value === e3._value) return void xe.splice(t3, 1);
- }(t2)), n2.resolve(r2);
- } catch (e3) {
- n2.reject(e3);
- } finally {
- Ee = null, 0 == --Ae && Ve(), --n2.psd.ref || n2.psd.finalize();
- }
-}
-function Ne(e2, t2, n2) {
- if (t2.length === n2) return t2;
- var r2 = "";
- if (false === e2._state) {
- var s2, i2, o2 = e2._value;
- null != o2 ? (s2 = o2.name || "Error", i2 = o2.message || o2, r2 = $(o2, 0)) : (s2 = o2, i2 = ""), t2.push(s2 + (i2 ? ": " + i2 : "") + r2);
- }
- return R && ((r2 = $(e2._stackHolder, 2)) && -1 === t2.indexOf(r2) && t2.push(r2), e2._prev && Ne(e2._prev, t2, n2)), t2;
-}
-function qe(e2, t2) {
- var n2 = t2 ? t2._numPrev + 1 : 0;
- n2 < 100 && (e2._prev = t2, e2._numPrev = n2);
-}
-function $e() {
- Ue() && Le();
-}
-function Ue() {
- var e2 = _e;
- return _e = false, we = false, e2;
-}
-function Le() {
- var e2, t2, n2;
- do {
- for (; Se.length > 0; ) for (e2 = Se, Se = [], n2 = e2.length, t2 = 0; t2 < n2; ++t2) {
- var r2 = e2[t2];
- r2[0].apply(null, r2[1]);
- }
- } while (Se.length > 0);
- _e = true, we = true;
-}
-function Ve() {
- var e2 = xe;
- xe = [], e2.forEach((e3) => {
- e3._PSD.onunhandled.call(null, e3._value, e3);
- });
- for (var t2 = Ce.slice(0), n2 = t2.length; n2; ) t2[--n2]();
-}
-function We(e2) {
- return new je(le, false, e2);
-}
-function Ye(e2, t2) {
- var n2 = Oe;
- return function() {
- var r2 = Ue(), s2 = Oe;
- try {
- return it(n2, true), e2.apply(this, arguments);
- } catch (e3) {
- t2 && t2(e3);
- } finally {
- it(s2, false), r2 && Le();
- }
- };
-}
-a(je.prototype, { then: De, _then: function(e2, t2) {
- Fe(this, new Ie(null, null, e2, t2, Oe));
-}, catch: function(e2) {
- if (1 === arguments.length) return this.then(null, e2);
- var t2 = arguments[0], n2 = arguments[1];
- return "function" == typeof t2 ? this.then(null, (e3) => e3 instanceof t2 ? n2(e3) : We(e3)) : this.then(null, (e3) => e3 && e3.name === t2 ? n2(e3) : We(e3));
-}, finally: function(e2) {
- return this.then((t2) => (e2(), t2), (t2) => (e2(), We(t2)));
-}, stack: { get: function() {
- if (this._stack) return this._stack;
- try {
- ve = true;
- var e2 = Ne(this, [], 20).join("\nFrom previous: ");
- return null !== this._state && (this._stack = e2), e2;
- } finally {
- ve = false;
- }
-} }, timeout: function(e2, t2) {
- return e2 < 1 / 0 ? new je((n2, r2) => {
- var s2 = setTimeout(() => r2(new X.Timeout(t2)), e2);
- this.then(n2, r2).finally(clearTimeout.bind(null, s2));
- }) : this;
-} }), "undefined" != typeof Symbol && Symbol.toStringTag && l(je.prototype, Symbol.toStringTag, "Dexie.Promise"), Ke.env = ot(), a(je, { all: function() {
- var e2 = B.apply(null, arguments).map(nt);
- return new je(function(t2, n2) {
- 0 === e2.length && t2([]);
- var r2 = e2.length;
- e2.forEach((s2, i2) => je.resolve(s2).then((n3) => {
- e2[i2] = n3, --r2 || t2(e2);
- }, n2));
- });
-}, resolve: (e2) => {
- if (e2 instanceof je) return e2;
- if (e2 && "function" == typeof e2.then) return new je((t3, n2) => {
- e2.then(t3, n2);
- });
- var t2 = new je(le, true, e2);
- return qe(t2, Ee), t2;
-}, reject: We, race: function() {
- var e2 = B.apply(null, arguments).map(nt);
- return new je((t2, n2) => {
- e2.map((e3) => je.resolve(e3).then(t2, n2));
- });
-}, PSD: { get: () => Oe, set: (e2) => Oe = e2 }, totalEchoes: { get: () => Xe }, newPSD: Ze, usePSD: at, scheduler: { get: () => be, set: (e2) => {
- be = e2;
-} }, rejectionMapper: { get: () => Pe, set: (e2) => {
- Pe = e2;
-} }, follow: (e2, t2) => new je((n2, r2) => Ze((t3, n3) => {
- var r3 = Oe;
- r3.unhandleds = [], r3.onunhandled = n3, r3.finalize = re(function() {
- !function(e3) {
- function t4() {
- e3(), Ce.splice(Ce.indexOf(t4), 1);
- }
- Ce.push(t4), ++Ae, be(() => {
- 0 == --Ae && Ve();
- }, []);
- }(() => {
- 0 === this.unhandleds.length ? t3() : n3(this.unhandleds[0]);
- });
- }, r3.finalize), e2();
-}, t2, n2, r2)) }), ye && (ye.allSettled && l(je, "allSettled", function() {
- const e2 = B.apply(null, arguments).map(nt);
- return new je((t2) => {
- 0 === e2.length && t2([]);
- let n2 = e2.length;
- const r2 = new Array(n2);
- e2.forEach((e3, s2) => je.resolve(e3).then((e4) => r2[s2] = { status: "fulfilled", value: e4 }, (e4) => r2[s2] = { status: "rejected", reason: e4 }).then(() => --n2 || t2(r2)));
- });
-}), ye.any && "undefined" != typeof AggregateError && l(je, "any", function() {
- const e2 = B.apply(null, arguments).map(nt);
- return new je((t2, n2) => {
- 0 === e2.length && n2(new AggregateError([]));
- let r2 = e2.length;
- const s2 = new Array(r2);
- e2.forEach((e3, i2) => je.resolve(e3).then((e4) => t2(e4), (e4) => {
- s2[i2] = e4, --r2 || n2(new AggregateError(s2));
- }));
- });
-}));
-const ze = { awaits: 0, echoes: 0, id: 0 };
-var Ge = 0, He = [], Qe = 0, Xe = 0, Je = 0;
-function Ze(e2, t2, n2, s2) {
- var i2 = Oe, o2 = Object.create(i2);
- o2.parent = i2, o2.ref = 0, o2.global = false, o2.id = ++Je;
- var a2 = Ke.env;
- o2.env = me ? { Promise: je, PromiseProp: { value: je, configurable: true, writable: true }, all: je.all, race: je.race, allSettled: je.allSettled, any: je.any, resolve: je.resolve, reject: je.reject, nthen: ct(a2.nthen, o2), gthen: ct(a2.gthen, o2) } : {}, t2 && r(o2, t2), ++i2.ref, o2.finalize = function() {
- --this.parent.ref || this.parent.finalize();
- };
- var u2 = at(o2, e2, n2, s2);
- return 0 === o2.ref && o2.finalize(), u2;
-}
-function et() {
- return ze.id || (ze.id = ++Ge), ++ze.awaits, ze.echoes += ce, ze.id;
-}
-function tt() {
- return !!ze.awaits && (0 == --ze.awaits && (ze.id = 0), ze.echoes = ze.awaits * ce, true);
-}
-function nt(e2) {
- return ze.echoes && e2 && e2.constructor === ye ? (et(), e2.then((e3) => (tt(), e3), (e3) => (tt(), ft(e3)))) : e2;
-}
-function rt(e2) {
- ++Xe, ze.echoes && 0 != --ze.echoes || (ze.echoes = ze.id = 0), He.push(Oe), it(e2, true);
-}
-function st() {
- var e2 = He[He.length - 1];
- He.pop(), it(e2, false);
-}
-function it(t2, n2) {
- var r2 = Oe;
- if ((n2 ? !ze.echoes || Qe++ && t2 === Oe : !Qe || --Qe && t2 === Oe) || ut(n2 ? rt.bind(null, t2) : st), t2 !== Oe && (Oe = t2, r2 === Ke && (Ke.env = ot()), me)) {
- var s2 = Ke.env.Promise, i2 = t2.env;
- de.then = i2.nthen, s2.prototype.then = i2.gthen, (r2.global || t2.global) && (Object.defineProperty(e, "Promise", i2.PromiseProp), s2.all = i2.all, s2.race = i2.race, s2.resolve = i2.resolve, s2.reject = i2.reject, i2.allSettled && (s2.allSettled = i2.allSettled), i2.any && (s2.any = i2.any));
- }
-}
-function ot() {
- var t2 = e.Promise;
- return me ? { Promise: t2, PromiseProp: Object.getOwnPropertyDescriptor(e, "Promise"), all: t2.all, race: t2.race, allSettled: t2.allSettled, any: t2.any, resolve: t2.resolve, reject: t2.reject, nthen: de.then, gthen: t2.prototype.then } : {};
-}
-function at(e2, t2, n2, r2, s2) {
- var i2 = Oe;
- try {
- return it(e2, true), t2(n2, r2, s2);
- } finally {
- it(i2, false);
- }
-}
-function ut(e2) {
- pe.call(he, e2);
-}
-function lt(e2, t2, n2, r2) {
- return "function" != typeof e2 ? e2 : function() {
- var s2 = Oe;
- n2 && et(), it(t2, true);
- try {
- return e2.apply(this, arguments);
- } finally {
- it(s2, false), r2 && ut(tt);
- }
- };
-}
-function ct(e2, t2) {
- return function(n2, r2) {
- return e2.call(this, lt(n2, t2), lt(r2, t2));
- };
-}
--1 === ("" + pe).indexOf("[native code]") && (et = tt = ee);
-const ht = "unhandledrejection";
-function dt(t2, n2) {
- var s2;
- try {
- s2 = n2.onuncatched(t2);
- } catch (e2) {
- }
- if (false !== s2) try {
- var i2, o2 = { promise: n2, reason: t2 };
- if (e.document && document.createEvent ? ((i2 = document.createEvent("Event")).initEvent(ht, true, true), r(i2, o2)) : e.CustomEvent && r(i2 = new CustomEvent(ht, { detail: o2 }), o2), i2 && e.dispatchEvent && (dispatchEvent(i2), !e.PromiseRejectionEvent && e.onunhandledrejection)) try {
- e.onunhandledrejection(i2);
- } catch (e2) {
- }
- R && i2 && !i2.defaultPrevented && console.warn(`Unhandled rejection: ${t2.stack || t2}`);
- } catch (e2) {
- }
-}
-var ft = je.reject;
-function pt(e2, t2, n2, r2) {
- if (e2.idbdb && (e2._state.openComplete || Oe.letThrough || e2._vip)) {
- var s2 = e2._createTransaction(t2, n2, e2._dbSchema);
- try {
- s2.create(), e2._state.PR1398_maxLoop = 3;
- } catch (s3) {
- return s3.name === H.InvalidState && e2.isOpen() && --e2._state.PR1398_maxLoop > 0 ? (console.warn("Dexie: Need to reopen db"), e2._close(), e2.open().then(() => pt(e2, t2, n2, r2))) : ft(s3);
- }
- return s2._promise(t2, (e3, t3) => Ze(() => (Oe.trans = s2, r2(e3, t3, s2)))).then((e3) => s2._completion.then(() => e3));
- }
- if (e2._state.openComplete) return ft(new X.DatabaseClosed(e2._state.dbOpenError));
- if (!e2._state.isBeingOpened) {
- if (!e2._options.autoOpen) return ft(new X.DatabaseClosed());
- e2.open().catch(ee);
- }
- return e2._state.dbReadyPromise.then(() => pt(e2, t2, n2, r2));
-}
-const yt = "3.2.4", mt = String.fromCharCode(65535), vt = -1 / 0, gt = "Invalid key provided. Keys must be of type string, number, Date or Array.", bt = "String expected.", _t = [], wt = "undefined" != typeof navigator && /(MSIE|Trident|Edge)/.test(navigator.userAgent), xt = wt, kt = wt, Et = (e2) => !/(dexie\.js|dexie\.min\.js)/.test(e2), Pt = "__dbnames", Kt = "readonly", Ot = "readwrite";
-function St(e2, t2) {
- return e2 ? t2 ? function() {
- return e2.apply(this, arguments) && t2.apply(this, arguments);
- } : e2 : t2;
-}
-const At = { type: 3, lower: -1 / 0, lowerOpen: false, upper: [[]], upperOpen: false };
-function Ct(e2) {
- return "string" != typeof e2 || /\./.test(e2) ? (e3) => e3 : (t2) => (void 0 === t2[e2] && e2 in t2 && delete (t2 = O(t2))[e2], t2);
-}
-class jt {
- _trans(e2, t2, n2) {
- const r2 = this._tx || Oe.trans, s2 = this.name;
- function i2(e3, n3, r3) {
- if (!r3.schema[s2]) throw new X.NotFound("Table " + s2 + " not part of transaction");
- return t2(r3.idbtrans, r3);
- }
- const o2 = Ue();
- try {
- return r2 && r2.db === this.db ? r2 === Oe.trans ? r2._promise(e2, i2, n2) : Ze(() => r2._promise(e2, i2, n2), { trans: r2, transless: Oe.transless || Oe }) : pt(this.db, e2, [this.name], i2);
- } finally {
- o2 && Le();
- }
- }
- get(e2, t2) {
- return e2 && e2.constructor === Object ? this.where(e2).first(t2) : this._trans("readonly", (t3) => this.core.get({ trans: t3, key: e2 }).then((e3) => this.hook.reading.fire(e3))).then(t2);
- }
- where(e2) {
- if ("string" == typeof e2) return new this.db.WhereClause(this, e2);
- if (n(e2)) return new this.db.WhereClause(this, `[${e2.join("+")}]`);
- const r2 = t(e2);
- if (1 === r2.length) return this.where(r2[0]).equals(e2[r2[0]]);
- const s2 = this.schema.indexes.concat(this.schema.primKey).filter((e3) => e3.compound && r2.every((t2) => e3.keyPath.indexOf(t2) >= 0) && e3.keyPath.every((e4) => r2.indexOf(e4) >= 0))[0];
- if (s2 && this.db._maxKey !== mt) return this.where(s2.name).equals(s2.keyPath.map((t2) => e2[t2]));
- !s2 && R && console.warn(`The query ${JSON.stringify(e2)} on ${this.name} would benefit of a compound index [${r2.join("+")}]`);
- const { idxByName: i2 } = this.schema, o2 = this.db._deps.indexedDB;
- function a2(e3, t2) {
- try {
- return 0 === o2.cmp(e3, t2);
- } catch (e4) {
- return false;
- }
- }
- const [u2, l2] = r2.reduce(([t2, r3], s3) => {
- const o3 = i2[s3], u3 = e2[s3];
- return [t2 || o3, t2 || !o3 ? St(r3, o3 && o3.multi ? (e3) => {
- const t3 = b(e3, s3);
- return n(t3) && t3.some((e4) => a2(u3, e4));
- } : (e3) => a2(u3, b(e3, s3))) : r3];
- }, [null, null]);
- return u2 ? this.where(u2.name).equals(e2[u2.keyPath]).filter(l2) : s2 ? this.filter(l2) : this.where(r2).equals("");
- }
- filter(e2) {
- return this.toCollection().and(e2);
- }
- count(e2) {
- return this.toCollection().count(e2);
- }
- offset(e2) {
- return this.toCollection().offset(e2);
- }
- limit(e2) {
- return this.toCollection().limit(e2);
- }
- each(e2) {
- return this.toCollection().each(e2);
- }
- toArray(e2) {
- return this.toCollection().toArray(e2);
- }
- toCollection() {
- return new this.db.Collection(new this.db.WhereClause(this));
- }
- orderBy(e2) {
- return new this.db.Collection(new this.db.WhereClause(this, n(e2) ? `[${e2.join("+")}]` : e2));
- }
- reverse() {
- return this.toCollection().reverse();
- }
- mapToClass(e2) {
- this.schema.mappedClass = e2;
- const t2 = (t3) => {
- if (!t3) return t3;
- const n2 = Object.create(e2.prototype);
- for (var r2 in t3) if (o(t3, r2)) try {
- n2[r2] = t3[r2];
- } catch (e3) {
- }
- return n2;
- };
- return this.schema.readHook && this.hook.reading.unsubscribe(this.schema.readHook), this.schema.readHook = t2, this.hook("reading", t2), e2;
- }
- defineClass() {
- return this.mapToClass(function(e2) {
- r(this, e2);
- });
- }
- add(e2, t2) {
- const { auto: n2, keyPath: r2 } = this.schema.primKey;
- let s2 = e2;
- return r2 && n2 && (s2 = Ct(r2)(e2)), this._trans("readwrite", (e3) => this.core.mutate({ trans: e3, type: "add", keys: null != t2 ? [t2] : null, values: [s2] })).then((e3) => e3.numFailures ? je.reject(e3.failures[0]) : e3.lastResult).then((t3) => {
- if (r2) try {
- _(e2, r2, t3);
- } catch (e3) {
- }
- return t3;
- });
- }
- update(e2, r2) {
- if ("object" != typeof e2 || n(e2)) return this.where(":id").equals(e2).modify(r2);
- {
- const n2 = b(e2, this.schema.primKey.keyPath);
- if (void 0 === n2) return ft(new X.InvalidArgument("Given object does not contain its primary key"));
- try {
- "function" != typeof r2 ? t(r2).forEach((t2) => {
- _(e2, t2, r2[t2]);
- }) : r2(e2, { value: e2, primKey: n2 });
- } catch (e3) {
- }
- return this.where(":id").equals(n2).modify(r2);
- }
- }
- put(e2, t2) {
- const { auto: n2, keyPath: r2 } = this.schema.primKey;
- let s2 = e2;
- return r2 && n2 && (s2 = Ct(r2)(e2)), this._trans("readwrite", (e3) => this.core.mutate({ trans: e3, type: "put", values: [s2], keys: null != t2 ? [t2] : null })).then((e3) => e3.numFailures ? je.reject(e3.failures[0]) : e3.lastResult).then((t3) => {
- if (r2) try {
- _(e2, r2, t3);
- } catch (e3) {
- }
- return t3;
- });
- }
- delete(e2) {
- return this._trans("readwrite", (t2) => this.core.mutate({ trans: t2, type: "delete", keys: [e2] })).then((e3) => e3.numFailures ? je.reject(e3.failures[0]) : void 0);
- }
- clear() {
- return this._trans("readwrite", (e2) => this.core.mutate({ trans: e2, type: "deleteRange", range: At })).then((e2) => e2.numFailures ? je.reject(e2.failures[0]) : void 0);
- }
- bulkGet(e2) {
- return this._trans("readonly", (t2) => this.core.getMany({ keys: e2, trans: t2 }).then((e3) => e3.map((e4) => this.hook.reading.fire(e4))));
- }
- bulkAdd(e2, t2, n2) {
- const r2 = Array.isArray(t2) ? t2 : void 0, s2 = (n2 = n2 || (r2 ? void 0 : t2)) ? n2.allKeys : void 0;
- return this._trans("readwrite", (t3) => {
- const { auto: n3, keyPath: i2 } = this.schema.primKey;
- if (i2 && r2) throw new X.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");
- if (r2 && r2.length !== e2.length) throw new X.InvalidArgument("Arguments objects and keys must have the same length");
- const o2 = e2.length;
- let a2 = i2 && n3 ? e2.map(Ct(i2)) : e2;
- return this.core.mutate({ trans: t3, type: "add", keys: r2, values: a2, wantResults: s2 }).then(({ numFailures: e3, results: t4, lastResult: n4, failures: r3 }) => {
- if (0 === e3) return s2 ? t4 : n4;
- throw new G(`${this.name}.bulkAdd(): ${e3} of ${o2} operations failed`, r3);
- });
- });
- }
- bulkPut(e2, t2, n2) {
- const r2 = Array.isArray(t2) ? t2 : void 0, s2 = (n2 = n2 || (r2 ? void 0 : t2)) ? n2.allKeys : void 0;
- return this._trans("readwrite", (t3) => {
- const { auto: n3, keyPath: i2 } = this.schema.primKey;
- if (i2 && r2) throw new X.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");
- if (r2 && r2.length !== e2.length) throw new X.InvalidArgument("Arguments objects and keys must have the same length");
- const o2 = e2.length;
- let a2 = i2 && n3 ? e2.map(Ct(i2)) : e2;
- return this.core.mutate({ trans: t3, type: "put", keys: r2, values: a2, wantResults: s2 }).then(({ numFailures: e3, results: t4, lastResult: n4, failures: r3 }) => {
- if (0 === e3) return s2 ? t4 : n4;
- throw new G(`${this.name}.bulkPut(): ${e3} of ${o2} operations failed`, r3);
- });
- });
- }
- bulkDelete(e2) {
- const t2 = e2.length;
- return this._trans("readwrite", (t3) => this.core.mutate({ trans: t3, type: "delete", keys: e2 })).then(({ numFailures: e3, lastResult: n2, failures: r2 }) => {
- if (0 === e3) return n2;
- throw new G(`${this.name}.bulkDelete(): ${e3} of ${t2} operations failed`, r2);
- });
- }
-}
-function Dt(e2) {
- var r2 = {}, s2 = function(t2, n2) {
- if (n2) {
- for (var s3 = arguments.length, i3 = new Array(s3 - 1); --s3; ) i3[s3 - 1] = arguments[s3];
- return r2[t2].subscribe.apply(null, i3), e2;
- }
- if ("string" == typeof t2) return r2[t2];
- };
- s2.addEventType = a2;
- for (var i2 = 1, o2 = arguments.length; i2 < o2; ++i2) a2(arguments[i2]);
- return s2;
- function a2(e3, i3, o3) {
- if ("object" != typeof e3) {
- var u2;
- i3 || (i3 = ae), o3 || (o3 = ee);
- var l2 = { subscribers: [], fire: o3, subscribe: function(e4) {
- -1 === l2.subscribers.indexOf(e4) && (l2.subscribers.push(e4), l2.fire = i3(l2.fire, e4));
- }, unsubscribe: function(e4) {
- l2.subscribers = l2.subscribers.filter(function(t2) {
- return t2 !== e4;
- }), l2.fire = l2.subscribers.reduce(i3, o3);
- } };
- return r2[e3] = s2[e3] = l2, l2;
- }
- t(u2 = e3).forEach(function(e4) {
- var t2 = u2[e4];
- if (n(t2)) a2(e4, u2[e4][0], u2[e4][1]);
- else {
- if ("asap" !== t2) throw new X.InvalidArgument("Invalid event config");
- var r3 = a2(e4, te, function() {
- for (var e5 = arguments.length, t3 = new Array(e5); e5--; ) t3[e5] = arguments[e5];
- r3.subscribers.forEach(function(e6) {
- v(function() {
- e6.apply(null, t3);
- });
- });
- });
- }
- });
- }
-}
-function It(e2, t2) {
- return c(t2).from({ prototype: e2 }), t2;
-}
-function Bt(e2, t2) {
- return !(e2.filter || e2.algorithm || e2.or) && (t2 ? e2.justLimit : !e2.replayFilter);
-}
-function Tt(e2, t2) {
- e2.filter = St(e2.filter, t2);
-}
-function Rt(e2, t2, n2) {
- var r2 = e2.replayFilter;
- e2.replayFilter = r2 ? () => St(r2(), t2()) : t2, e2.justLimit = n2 && !r2;
-}
-function Ft(e2, t2) {
- if (e2.isPrimKey) return t2.primaryKey;
- const n2 = t2.getIndexByKeyPath(e2.index);
- if (!n2) throw new X.Schema("KeyPath " + e2.index + " on object store " + t2.name + " is not indexed");
- return n2;
-}
-function Mt(e2, t2, n2) {
- const r2 = Ft(e2, t2.schema);
- return t2.openCursor({ trans: n2, values: !e2.keysOnly, reverse: "prev" === e2.dir, unique: !!e2.unique, query: { index: r2, range: e2.range } });
-}
-function Nt(e2, t2, n2, r2) {
- const s2 = e2.replayFilter ? St(e2.filter, e2.replayFilter()) : e2.filter;
- if (e2.or) {
- const i2 = {}, a2 = (e3, n3, r3) => {
- if (!s2 || s2(n3, r3, (e4) => n3.stop(e4), (e4) => n3.fail(e4))) {
- var a3 = n3.primaryKey, u2 = "" + a3;
- "[object ArrayBuffer]" === u2 && (u2 = "" + new Uint8Array(a3)), o(i2, u2) || (i2[u2] = true, t2(e3, n3, r3));
- }
- };
- return Promise.all([e2.or._iterate(a2, n2), qt(Mt(e2, r2, n2), e2.algorithm, a2, !e2.keysOnly && e2.valueMapper)]);
- }
- return qt(Mt(e2, r2, n2), St(e2.algorithm, s2), t2, !e2.keysOnly && e2.valueMapper);
-}
-function qt(e2, t2, n2, r2) {
- var s2 = Ye(r2 ? (e3, t3, s3) => n2(r2(e3), t3, s3) : n2);
- return e2.then((e3) => {
- if (e3) return e3.start(() => {
- var n3 = () => e3.continue();
- t2 && !t2(e3, (e4) => n3 = e4, (t3) => {
- e3.stop(t3), n3 = ee;
- }, (t3) => {
- e3.fail(t3), n3 = ee;
- }) || s2(e3.value, e3, (e4) => n3 = e4), n3();
- });
- });
-}
-function $t(e2, t2) {
- try {
- const n2 = Ut(e2), r2 = Ut(t2);
- if (n2 !== r2) return "Array" === n2 ? 1 : "Array" === r2 ? -1 : "binary" === n2 ? 1 : "binary" === r2 ? -1 : "string" === n2 ? 1 : "string" === r2 ? -1 : "Date" === n2 ? 1 : "Date" !== r2 ? NaN : -1;
- switch (n2) {
- case "number":
- case "Date":
- case "string":
- return e2 > t2 ? 1 : e2 < t2 ? -1 : 0;
- case "binary":
- return function(e3, t3) {
- const n3 = e3.length, r3 = t3.length, s2 = n3 < r3 ? n3 : r3;
- for (let n4 = 0; n4 < s2; ++n4) if (e3[n4] !== t3[n4]) return e3[n4] < t3[n4] ? -1 : 1;
- return n3 === r3 ? 0 : n3 < r3 ? -1 : 1;
- }(Lt(e2), Lt(t2));
- case "Array":
- return function(e3, t3) {
- const n3 = e3.length, r3 = t3.length, s2 = n3 < r3 ? n3 : r3;
- for (let n4 = 0; n4 < s2; ++n4) {
- const r4 = $t(e3[n4], t3[n4]);
- if (0 !== r4) return r4;
- }
- return n3 === r3 ? 0 : n3 < r3 ? -1 : 1;
- }(e2, t2);
- }
- } catch (e3) {
- }
- return NaN;
-}
-function Ut(e2) {
- const t2 = typeof e2;
- if ("object" !== t2) return t2;
- if (ArrayBuffer.isView(e2)) return "binary";
- const n2 = C(e2);
- return "ArrayBuffer" === n2 ? "binary" : n2;
-}
-function Lt(e2) {
- return e2 instanceof Uint8Array ? e2 : ArrayBuffer.isView(e2) ? new Uint8Array(e2.buffer, e2.byteOffset, e2.byteLength) : new Uint8Array(e2);
-}
-class Vt {
- _read(e2, t2) {
- var n2 = this._ctx;
- return n2.error ? n2.table._trans(null, ft.bind(null, n2.error)) : n2.table._trans("readonly", e2).then(t2);
- }
- _write(e2) {
- var t2 = this._ctx;
- return t2.error ? t2.table._trans(null, ft.bind(null, t2.error)) : t2.table._trans("readwrite", e2, "locked");
- }
- _addAlgorithm(e2) {
- var t2 = this._ctx;
- t2.algorithm = St(t2.algorithm, e2);
- }
- _iterate(e2, t2) {
- return Nt(this._ctx, e2, t2, this._ctx.table.core);
- }
- clone(e2) {
- var t2 = Object.create(this.constructor.prototype), n2 = Object.create(this._ctx);
- return e2 && r(n2, e2), t2._ctx = n2, t2;
- }
- raw() {
- return this._ctx.valueMapper = null, this;
- }
- each(e2) {
- var t2 = this._ctx;
- return this._read((n2) => Nt(t2, e2, n2, t2.table.core));
- }
- count(e2) {
- return this._read((e3) => {
- const t2 = this._ctx, n2 = t2.table.core;
- if (Bt(t2, true)) return n2.count({ trans: e3, query: { index: Ft(t2, n2.schema), range: t2.range } }).then((e4) => Math.min(e4, t2.limit));
- var r2 = 0;
- return Nt(t2, () => (++r2, false), e3, n2).then(() => r2);
- }).then(e2);
- }
- sortBy(e2, t2) {
- const n2 = e2.split(".").reverse(), r2 = n2[0], s2 = n2.length - 1;
- function i2(e3, t3) {
- return t3 ? i2(e3[n2[t3]], t3 - 1) : e3[r2];
- }
- var o2 = "next" === this._ctx.dir ? 1 : -1;
- function a2(e3, t3) {
- var n3 = i2(e3, s2), r3 = i2(t3, s2);
- return n3 < r3 ? -o2 : n3 > r3 ? o2 : 0;
- }
- return this.toArray(function(e3) {
- return e3.sort(a2);
- }).then(t2);
- }
- toArray(e2) {
- return this._read((e3) => {
- var t2 = this._ctx;
- if ("next" === t2.dir && Bt(t2, true) && t2.limit > 0) {
- const { valueMapper: n2 } = t2, r2 = Ft(t2, t2.table.core.schema);
- return t2.table.core.query({ trans: e3, limit: t2.limit, values: true, query: { index: r2, range: t2.range } }).then(({ result: e4 }) => n2 ? e4.map(n2) : e4);
- }
- {
- const n2 = [];
- return Nt(t2, (e4) => n2.push(e4), e3, t2.table.core).then(() => n2);
- }
- }, e2);
- }
- offset(e2) {
- var t2 = this._ctx;
- return e2 <= 0 || (t2.offset += e2, Bt(t2) ? Rt(t2, () => {
- var t3 = e2;
- return (e3, n2) => 0 === t3 || (1 === t3 ? (--t3, false) : (n2(() => {
- e3.advance(t3), t3 = 0;
- }), false));
- }) : Rt(t2, () => {
- var t3 = e2;
- return () => --t3 < 0;
- })), this;
- }
- limit(e2) {
- return this._ctx.limit = Math.min(this._ctx.limit, e2), Rt(this._ctx, () => {
- var t2 = e2;
- return function(e3, n2, r2) {
- return --t2 <= 0 && n2(r2), t2 >= 0;
- };
- }, true), this;
- }
- until(e2, t2) {
- return Tt(this._ctx, function(n2, r2, s2) {
- return !e2(n2.value) || (r2(s2), t2);
- }), this;
- }
- first(e2) {
- return this.limit(1).toArray(function(e3) {
- return e3[0];
- }).then(e2);
- }
- last(e2) {
- return this.reverse().first(e2);
- }
- filter(e2) {
- var t2, n2;
- return Tt(this._ctx, function(t3) {
- return e2(t3.value);
- }), t2 = this._ctx, n2 = e2, t2.isMatch = St(t2.isMatch, n2), this;
- }
- and(e2) {
- return this.filter(e2);
- }
- or(e2) {
- return new this.db.WhereClause(this._ctx.table, e2, this);
- }
- reverse() {
- return this._ctx.dir = "prev" === this._ctx.dir ? "next" : "prev", this._ondirectionchange && this._ondirectionchange(this._ctx.dir), this;
- }
- desc() {
- return this.reverse();
- }
- eachKey(e2) {
- var t2 = this._ctx;
- return t2.keysOnly = !t2.isMatch, this.each(function(t3, n2) {
- e2(n2.key, n2);
- });
- }
- eachUniqueKey(e2) {
- return this._ctx.unique = "unique", this.eachKey(e2);
- }
- eachPrimaryKey(e2) {
- var t2 = this._ctx;
- return t2.keysOnly = !t2.isMatch, this.each(function(t3, n2) {
- e2(n2.primaryKey, n2);
- });
- }
- keys(e2) {
- var t2 = this._ctx;
- t2.keysOnly = !t2.isMatch;
- var n2 = [];
- return this.each(function(e3, t3) {
- n2.push(t3.key);
- }).then(function() {
- return n2;
- }).then(e2);
- }
- primaryKeys(e2) {
- var t2 = this._ctx;
- if ("next" === t2.dir && Bt(t2, true) && t2.limit > 0) return this._read((e3) => {
- var n3 = Ft(t2, t2.table.core.schema);
- return t2.table.core.query({ trans: e3, values: false, limit: t2.limit, query: { index: n3, range: t2.range } });
- }).then(({ result: e3 }) => e3).then(e2);
- t2.keysOnly = !t2.isMatch;
- var n2 = [];
- return this.each(function(e3, t3) {
- n2.push(t3.primaryKey);
- }).then(function() {
- return n2;
- }).then(e2);
- }
- uniqueKeys(e2) {
- return this._ctx.unique = "unique", this.keys(e2);
- }
- firstKey(e2) {
- return this.limit(1).keys(function(e3) {
- return e3[0];
- }).then(e2);
- }
- lastKey(e2) {
- return this.reverse().firstKey(e2);
- }
- distinct() {
- var e2 = this._ctx, t2 = e2.index && e2.table.schema.idxByName[e2.index];
- if (!t2 || !t2.multi) return this;
- var n2 = {};
- return Tt(this._ctx, function(e3) {
- var t3 = e3.primaryKey.toString(), r2 = o(n2, t3);
- return n2[t3] = true, !r2;
- }), this;
- }
- modify(e2) {
- var n2 = this._ctx;
- return this._write((r2) => {
- var s2;
- if ("function" == typeof e2) s2 = e2;
- else {
- var i2 = t(e2), o2 = i2.length;
- s2 = function(t2) {
- for (var n3 = false, r3 = 0; r3 < o2; ++r3) {
- var s3 = i2[r3], a3 = e2[s3];
- b(t2, s3) !== a3 && (_(t2, s3, a3), n3 = true);
- }
- return n3;
- };
- }
- const a2 = n2.table.core, { outbound: u2, extractKey: l2 } = a2.schema.primaryKey, c2 = this.db._options.modifyChunkSize || 200, h2 = [];
- let d2 = 0;
- const f2 = [], p2 = (e3, n3) => {
- const { failures: r3, numFailures: s3 } = n3;
- d2 += e3 - s3;
- for (let e4 of t(r3)) h2.push(r3[e4]);
- };
- return this.clone().primaryKeys().then((t2) => {
- const i3 = (o3) => {
- const h3 = Math.min(c2, t2.length - o3);
- return a2.getMany({ trans: r2, keys: t2.slice(o3, o3 + h3), cache: "immutable" }).then((d3) => {
- const f3 = [], y2 = [], m2 = u2 ? [] : null, v2 = [];
- for (let e3 = 0; e3 < h3; ++e3) {
- const n3 = d3[e3], r3 = { value: O(n3), primKey: t2[o3 + e3] };
- false !== s2.call(r3, r3.value, r3) && (null == r3.value ? v2.push(t2[o3 + e3]) : u2 || 0 === $t(l2(n3), l2(r3.value)) ? (y2.push(r3.value), u2 && m2.push(t2[o3 + e3])) : (v2.push(t2[o3 + e3]), f3.push(r3.value)));
- }
- const g2 = Bt(n2) && n2.limit === 1 / 0 && ("function" != typeof e2 || e2 === Wt) && { index: n2.index, range: n2.range };
- return Promise.resolve(f3.length > 0 && a2.mutate({ trans: r2, type: "add", values: f3 }).then((e3) => {
- for (let t3 in e3.failures) v2.splice(parseInt(t3), 1);
- p2(f3.length, e3);
- })).then(() => (y2.length > 0 || g2 && "object" == typeof e2) && a2.mutate({ trans: r2, type: "put", keys: m2, values: y2, criteria: g2, changeSpec: "function" != typeof e2 && e2 }).then((e3) => p2(y2.length, e3))).then(() => (v2.length > 0 || g2 && e2 === Wt) && a2.mutate({ trans: r2, type: "delete", keys: v2, criteria: g2 }).then((e3) => p2(v2.length, e3))).then(() => t2.length > o3 + h3 && i3(o3 + c2));
- });
- };
- return i3(0).then(() => {
- if (h2.length > 0) throw new z("Error modifying one or more objects", h2, d2, f2);
- return t2.length;
- });
- });
- });
- }
- delete() {
- var e2 = this._ctx, t2 = e2.range;
- return Bt(e2) && (e2.isPrimKey && !kt || 3 === t2.type) ? this._write((n2) => {
- const { primaryKey: r2 } = e2.table.core.schema, s2 = t2;
- return e2.table.core.count({ trans: n2, query: { index: r2, range: s2 } }).then((t3) => e2.table.core.mutate({ trans: n2, type: "deleteRange", range: s2 }).then(({ failures: e3, lastResult: n3, results: r3, numFailures: s3 }) => {
- if (s3) throw new z("Could not delete some values", Object.keys(e3).map((t4) => e3[t4]), t3 - s3);
- return t3 - s3;
- }));
- }) : this.modify(Wt);
- }
-}
-const Wt = (e2, t2) => t2.value = null;
-function Yt(e2, t2) {
- return e2 < t2 ? -1 : e2 === t2 ? 0 : 1;
-}
-function zt(e2, t2) {
- return e2 > t2 ? -1 : e2 === t2 ? 0 : 1;
-}
-function Gt(e2, t2, n2) {
- var r2 = e2 instanceof en ? new e2.Collection(e2) : e2;
- return r2._ctx.error = n2 ? new n2(t2) : new TypeError(t2), r2;
-}
-function Ht(e2) {
- return new e2.Collection(e2, () => Zt("")).limit(0);
-}
-function Qt(e2, t2, n2, r2, s2, i2) {
- for (var o2 = Math.min(e2.length, r2.length), a2 = -1, u2 = 0; u2 < o2; ++u2) {
- var l2 = t2[u2];
- if (l2 !== r2[u2]) return s2(e2[u2], n2[u2]) < 0 ? e2.substr(0, u2) + n2[u2] + n2.substr(u2 + 1) : s2(e2[u2], r2[u2]) < 0 ? e2.substr(0, u2) + r2[u2] + n2.substr(u2 + 1) : a2 >= 0 ? e2.substr(0, a2) + t2[a2] + n2.substr(a2 + 1) : null;
- s2(e2[u2], l2) < 0 && (a2 = u2);
- }
- return o2 < r2.length && "next" === i2 ? e2 + n2.substr(e2.length) : o2 < e2.length && "prev" === i2 ? e2.substr(0, n2.length) : a2 < 0 ? null : e2.substr(0, a2) + r2[a2] + n2.substr(a2 + 1);
-}
-function Xt(e2, t2, n2, r2) {
- var s2, i2, o2, a2, u2, l2, c2, h2 = n2.length;
- if (!n2.every((e3) => "string" == typeof e3)) return Gt(e2, bt);
- function d2(e3) {
- s2 = /* @__PURE__ */ function(e4) {
- return "next" === e4 ? (e5) => e5.toUpperCase() : (e5) => e5.toLowerCase();
- }(e3), i2 = /* @__PURE__ */ function(e4) {
- return "next" === e4 ? (e5) => e5.toLowerCase() : (e5) => e5.toUpperCase();
- }(e3), o2 = "next" === e3 ? Yt : zt;
- var t3 = n2.map(function(e4) {
- return { lower: i2(e4), upper: s2(e4) };
- }).sort(function(e4, t4) {
- return o2(e4.lower, t4.lower);
- });
- a2 = t3.map(function(e4) {
- return e4.upper;
- }), u2 = t3.map(function(e4) {
- return e4.lower;
- }), l2 = e3, c2 = "next" === e3 ? "" : r2;
- }
- d2("next");
- var f2 = new e2.Collection(e2, () => Jt(a2[0], u2[h2 - 1] + r2));
- f2._ondirectionchange = function(e3) {
- d2(e3);
- };
- var p2 = 0;
- return f2._addAlgorithm(function(e3, n3, r3) {
- var s3 = e3.key;
- if ("string" != typeof s3) return false;
- var d3 = i2(s3);
- if (t2(d3, u2, p2)) return true;
- for (var f3 = null, y2 = p2; y2 < h2; ++y2) {
- var m2 = Qt(s3, d3, a2[y2], u2[y2], o2, l2);
- null === m2 && null === f3 ? p2 = y2 + 1 : (null === f3 || o2(f3, m2) > 0) && (f3 = m2);
- }
- return n3(null !== f3 ? function() {
- e3.continue(f3 + c2);
- } : r3), false;
- }), f2;
-}
-function Jt(e2, t2, n2, r2) {
- return { type: 2, lower: e2, upper: t2, lowerOpen: n2, upperOpen: r2 };
-}
-function Zt(e2) {
- return { type: 1, lower: e2, upper: e2 };
-}
-class en {
- get Collection() {
- return this._ctx.table.db.Collection;
- }
- between(e2, t2, n2, r2) {
- n2 = false !== n2, r2 = true === r2;
- try {
- return this._cmp(e2, t2) > 0 || 0 === this._cmp(e2, t2) && (n2 || r2) && (!n2 || !r2) ? Ht(this) : new this.Collection(this, () => Jt(e2, t2, !n2, !r2));
- } catch (e3) {
- return Gt(this, gt);
- }
- }
- equals(e2) {
- return null == e2 ? Gt(this, gt) : new this.Collection(this, () => Zt(e2));
- }
- above(e2) {
- return null == e2 ? Gt(this, gt) : new this.Collection(this, () => Jt(e2, void 0, true));
- }
- aboveOrEqual(e2) {
- return null == e2 ? Gt(this, gt) : new this.Collection(this, () => Jt(e2, void 0, false));
- }
- below(e2) {
- return null == e2 ? Gt(this, gt) : new this.Collection(this, () => Jt(void 0, e2, false, true));
- }
- belowOrEqual(e2) {
- return null == e2 ? Gt(this, gt) : new this.Collection(this, () => Jt(void 0, e2));
- }
- startsWith(e2) {
- return "string" != typeof e2 ? Gt(this, bt) : this.between(e2, e2 + mt, true, true);
- }
- startsWithIgnoreCase(e2) {
- return "" === e2 ? this.startsWith(e2) : Xt(this, (e3, t2) => 0 === e3.indexOf(t2[0]), [e2], mt);
- }
- equalsIgnoreCase(e2) {
- return Xt(this, (e3, t2) => e3 === t2[0], [e2], "");
- }
- anyOfIgnoreCase() {
- var e2 = B.apply(I, arguments);
- return 0 === e2.length ? Ht(this) : Xt(this, (e3, t2) => -1 !== t2.indexOf(e3), e2, "");
- }
- startsWithAnyOfIgnoreCase() {
- var e2 = B.apply(I, arguments);
- return 0 === e2.length ? Ht(this) : Xt(this, (e3, t2) => t2.some((t3) => 0 === e3.indexOf(t3)), e2, mt);
- }
- anyOf() {
- const e2 = B.apply(I, arguments);
- let t2 = this._cmp;
- try {
- e2.sort(t2);
- } catch (e3) {
- return Gt(this, gt);
- }
- if (0 === e2.length) return Ht(this);
- const n2 = new this.Collection(this, () => Jt(e2[0], e2[e2.length - 1]));
- n2._ondirectionchange = (n3) => {
- t2 = "next" === n3 ? this._ascending : this._descending, e2.sort(t2);
- };
- let r2 = 0;
- return n2._addAlgorithm((n3, s2, i2) => {
- const o2 = n3.key;
- for (; t2(o2, e2[r2]) > 0; ) if (++r2, r2 === e2.length) return s2(i2), false;
- return 0 === t2(o2, e2[r2]) || (s2(() => {
- n3.continue(e2[r2]);
- }), false);
- }), n2;
- }
- notEqual(e2) {
- return this.inAnyRange([[vt, e2], [e2, this.db._maxKey]], { includeLowers: false, includeUppers: false });
- }
- noneOf() {
- const e2 = B.apply(I, arguments);
- if (0 === e2.length) return new this.Collection(this);
- try {
- e2.sort(this._ascending);
- } catch (e3) {
- return Gt(this, gt);
- }
- const t2 = e2.reduce((e3, t3) => e3 ? e3.concat([[e3[e3.length - 1][1], t3]]) : [[vt, t3]], null);
- return t2.push([e2[e2.length - 1], this.db._maxKey]), this.inAnyRange(t2, { includeLowers: false, includeUppers: false });
- }
- inAnyRange(e2, t2) {
- const n2 = this._cmp, r2 = this._ascending, s2 = this._descending, i2 = this._min, o2 = this._max;
- if (0 === e2.length) return Ht(this);
- if (!e2.every((e3) => void 0 !== e3[0] && void 0 !== e3[1] && r2(e3[0], e3[1]) <= 0)) return Gt(this, "First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower", X.InvalidArgument);
- const a2 = !t2 || false !== t2.includeLowers, u2 = t2 && true === t2.includeUppers;
- let l2, c2 = r2;
- function h2(e3, t3) {
- return c2(e3[0], t3[0]);
- }
- try {
- l2 = e2.reduce(function(e3, t3) {
- let r3 = 0, s3 = e3.length;
- for (; r3 < s3; ++r3) {
- const s4 = e3[r3];
- if (n2(t3[0], s4[1]) < 0 && n2(t3[1], s4[0]) > 0) {
- s4[0] = i2(s4[0], t3[0]), s4[1] = o2(s4[1], t3[1]);
- break;
- }
- }
- return r3 === s3 && e3.push(t3), e3;
- }, []), l2.sort(h2);
- } catch (e3) {
- return Gt(this, gt);
- }
- let d2 = 0;
- const f2 = u2 ? (e3) => r2(e3, l2[d2][1]) > 0 : (e3) => r2(e3, l2[d2][1]) >= 0, p2 = a2 ? (e3) => s2(e3, l2[d2][0]) > 0 : (e3) => s2(e3, l2[d2][0]) >= 0;
- let y2 = f2;
- const m2 = new this.Collection(this, () => Jt(l2[0][0], l2[l2.length - 1][1], !a2, !u2));
- return m2._ondirectionchange = (e3) => {
- "next" === e3 ? (y2 = f2, c2 = r2) : (y2 = p2, c2 = s2), l2.sort(h2);
- }, m2._addAlgorithm((e3, t3, n3) => {
- for (var s3 = e3.key; y2(s3); ) if (++d2, d2 === l2.length) return t3(n3), false;
- return !!function(e4) {
- return !f2(e4) && !p2(e4);
- }(s3) || (0 === this._cmp(s3, l2[d2][1]) || 0 === this._cmp(s3, l2[d2][0]) || t3(() => {
- c2 === r2 ? e3.continue(l2[d2][0]) : e3.continue(l2[d2][1]);
- }), false);
- }), m2;
- }
- startsWithAnyOf() {
- const e2 = B.apply(I, arguments);
- return e2.every((e3) => "string" == typeof e3) ? 0 === e2.length ? Ht(this) : this.inAnyRange(e2.map((e3) => [e3, e3 + mt])) : Gt(this, "startsWithAnyOf() only works with strings");
- }
-}
-function tn(e2) {
- return Ye(function(t2) {
- return nn(t2), e2(t2.target.error), false;
- });
-}
-function nn(e2) {
- e2.stopPropagation && e2.stopPropagation(), e2.preventDefault && e2.preventDefault();
-}
-const rn = "storagemutated", sn = "x-storagemutated-1", on = Dt(null, rn);
-class an {
- _lock() {
- return m(!Oe.global), ++this._reculock, 1 !== this._reculock || Oe.global || (Oe.lockOwnerFor = this), this;
- }
- _unlock() {
- if (m(!Oe.global), 0 == --this._reculock) for (Oe.global || (Oe.lockOwnerFor = null); this._blockedFuncs.length > 0 && !this._locked(); ) {
- var e2 = this._blockedFuncs.shift();
- try {
- at(e2[1], e2[0]);
- } catch (e3) {
- }
- }
- return this;
- }
- _locked() {
- return this._reculock && Oe.lockOwnerFor !== this;
- }
- create(e2) {
- if (!this.mode) return this;
- const t2 = this.db.idbdb, n2 = this.db._state.dbOpenError;
- if (m(!this.idbtrans), !e2 && !t2) switch (n2 && n2.name) {
- case "DatabaseClosedError":
- throw new X.DatabaseClosed(n2);
- case "MissingAPIError":
- throw new X.MissingAPI(n2.message, n2);
- default:
- throw new X.OpenFailed(n2);
- }
- if (!this.active) throw new X.TransactionInactive();
- return m(null === this._completion._state), (e2 = this.idbtrans = e2 || (this.db.core ? this.db.core.transaction(this.storeNames, this.mode, { durability: this.chromeTransactionDurability }) : t2.transaction(this.storeNames, this.mode, { durability: this.chromeTransactionDurability }))).onerror = Ye((t3) => {
- nn(t3), this._reject(e2.error);
- }), e2.onabort = Ye((t3) => {
- nn(t3), this.active && this._reject(new X.Abort(e2.error)), this.active = false, this.on("abort").fire(t3);
- }), e2.oncomplete = Ye(() => {
- this.active = false, this._resolve(), "mutatedParts" in e2 && on.storagemutated.fire(e2.mutatedParts);
- }), this;
- }
- _promise(e2, t2, n2) {
- if ("readwrite" === e2 && "readwrite" !== this.mode) return ft(new X.ReadOnly("Transaction is readonly"));
- if (!this.active) return ft(new X.TransactionInactive());
- if (this._locked()) return new je((r3, s2) => {
- this._blockedFuncs.push([() => {
- this._promise(e2, t2, n2).then(r3, s2);
- }, Oe]);
- });
- if (n2) return Ze(() => {
- var e3 = new je((e4, n3) => {
- this._lock();
- const r3 = t2(e4, n3, this);
- r3 && r3.then && r3.then(e4, n3);
- });
- return e3.finally(() => this._unlock()), e3._lib = true, e3;
- });
- var r2 = new je((e3, n3) => {
- var r3 = t2(e3, n3, this);
- r3 && r3.then && r3.then(e3, n3);
- });
- return r2._lib = true, r2;
- }
- _root() {
- return this.parent ? this.parent._root() : this;
- }
- waitFor(e2) {
- var t2 = this._root();
- const n2 = je.resolve(e2);
- if (t2._waitingFor) t2._waitingFor = t2._waitingFor.then(() => n2);
- else {
- t2._waitingFor = n2, t2._waitingQueue = [];
- var r2 = t2.idbtrans.objectStore(t2.storeNames[0]);
- !function e3() {
- for (++t2._spinCount; t2._waitingQueue.length; ) t2._waitingQueue.shift()();
- t2._waitingFor && (r2.get(-1 / 0).onsuccess = e3);
- }();
- }
- var s2 = t2._waitingFor;
- return new je((e3, r3) => {
- n2.then((n3) => t2._waitingQueue.push(Ye(e3.bind(null, n3))), (e4) => t2._waitingQueue.push(Ye(r3.bind(null, e4)))).finally(() => {
- t2._waitingFor === s2 && (t2._waitingFor = null);
- });
- });
- }
- abort() {
- this.active && (this.active = false, this.idbtrans && this.idbtrans.abort(), this._reject(new X.Abort()));
- }
- table(e2) {
- const t2 = this._memoizedTables || (this._memoizedTables = {});
- if (o(t2, e2)) return t2[e2];
- const n2 = this.schema[e2];
- if (!n2) throw new X.NotFound("Table " + e2 + " not part of transaction");
- const r2 = new this.db.Table(e2, n2, this);
- return r2.core = this.db.core.table(e2), t2[e2] = r2, r2;
- }
-}
-function un(e2, t2, n2, r2, s2, i2, o2) {
- return { name: e2, keyPath: t2, unique: n2, multi: r2, auto: s2, compound: i2, src: (n2 && !o2 ? "&" : "") + (r2 ? "*" : "") + (s2 ? "++" : "") + ln(t2) };
-}
-function ln(e2) {
- return "string" == typeof e2 ? e2 : e2 ? "[" + [].join.call(e2, "+") + "]" : "";
-}
-function cn(e2, t2, n2) {
- return { name: e2, primKey: t2, indexes: n2, mappedClass: null, idxByName: g(n2, (e3) => [e3.name, e3]) };
-}
-let hn = (e2) => {
- try {
- return e2.only([[]]), hn = () => [[]], [[]];
- } catch (e3) {
- return hn = () => mt, mt;
- }
-};
-function dn(e2) {
- return null == e2 ? () => {
- } : "string" == typeof e2 ? function(e3) {
- const t2 = e3.split(".");
- return 1 === t2.length ? (t3) => t3[e3] : (t3) => b(t3, e3);
- }(e2) : (t2) => b(t2, e2);
-}
-function fn(e2) {
- return [].slice.call(e2);
-}
-let pn = 0;
-function yn(e2) {
- return null == e2 ? ":id" : "string" == typeof e2 ? e2 : `[${e2.join("+")}]`;
-}
-function mn(e2, t2, r2) {
- function s2(e3) {
- if (3 === e3.type) return null;
- if (4 === e3.type) throw new Error("Cannot convert never type to IDBKeyRange");
- const { lower: n2, upper: r3, lowerOpen: s3, upperOpen: i3 } = e3;
- return void 0 === n2 ? void 0 === r3 ? null : t2.upperBound(r3, !!i3) : void 0 === r3 ? t2.lowerBound(n2, !!s3) : t2.bound(n2, r3, !!s3, !!i3);
- }
- const { schema: i2, hasGetAll: o2 } = function(e3, t3) {
- const r3 = fn(e3.objectStoreNames);
- return { schema: { name: e3.name, tables: r3.map((e4) => t3.objectStore(e4)).map((e4) => {
- const { keyPath: t4, autoIncrement: r4 } = e4, s3 = n(t4), i3 = null == t4, o3 = {}, a3 = { name: e4.name, primaryKey: { name: null, isPrimaryKey: true, outbound: i3, compound: s3, keyPath: t4, autoIncrement: r4, unique: true, extractKey: dn(t4) }, indexes: fn(e4.indexNames).map((t5) => e4.index(t5)).map((e5) => {
- const { name: t5, unique: r5, multiEntry: s4, keyPath: i4 } = e5, a4 = { name: t5, compound: n(i4), keyPath: i4, unique: r5, multiEntry: s4, extractKey: dn(i4) };
- return o3[yn(i4)] = a4, a4;
- }), getIndexByKeyPath: (e5) => o3[yn(e5)] };
- return o3[":id"] = a3.primaryKey, null != t4 && (o3[yn(t4)] = a3.primaryKey), a3;
- }) }, hasGetAll: r3.length > 0 && "getAll" in t3.objectStore(r3[0]) && !("undefined" != typeof navigator && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604) };
- }(e2, r2), a2 = i2.tables.map((e3) => function(e4) {
- const t3 = e4.name;
- return { name: t3, schema: e4, mutate: function({ trans: e5, type: n2, keys: r3, values: i3, range: o3 }) {
- return new Promise((a3, u3) => {
- a3 = Ye(a3);
- const l2 = e5.objectStore(t3), c2 = null == l2.keyPath, h2 = "put" === n2 || "add" === n2;
- if (!h2 && "delete" !== n2 && "deleteRange" !== n2) throw new Error("Invalid operation type: " + n2);
- const { length: d2 } = r3 || i3 || { length: 1 };
- if (r3 && i3 && r3.length !== i3.length) throw new Error("Given keys array must have same length as given values array.");
- if (0 === d2) return a3({ numFailures: 0, failures: {}, results: [], lastResult: void 0 });
- let f2;
- const p2 = [], y2 = [];
- let m2 = 0;
- const v2 = (e6) => {
- ++m2, nn(e6);
- };
- if ("deleteRange" === n2) {
- if (4 === o3.type) return a3({ numFailures: m2, failures: y2, results: [], lastResult: void 0 });
- 3 === o3.type ? p2.push(f2 = l2.clear()) : p2.push(f2 = l2.delete(s2(o3)));
- } else {
- const [e6, t4] = h2 ? c2 ? [i3, r3] : [i3, null] : [r3, null];
- if (h2) for (let r4 = 0; r4 < d2; ++r4) p2.push(f2 = t4 && void 0 !== t4[r4] ? l2[n2](e6[r4], t4[r4]) : l2[n2](e6[r4])), f2.onerror = v2;
- else for (let t5 = 0; t5 < d2; ++t5) p2.push(f2 = l2[n2](e6[t5])), f2.onerror = v2;
- }
- const g2 = (e6) => {
- const t4 = e6.target.result;
- p2.forEach((e7, t5) => null != e7.error && (y2[t5] = e7.error)), a3({ numFailures: m2, failures: y2, results: "delete" === n2 ? r3 : p2.map((e7) => e7.result), lastResult: t4 });
- };
- f2.onerror = (e6) => {
- v2(e6), g2(e6);
- }, f2.onsuccess = g2;
- });
- }, getMany: ({ trans: e5, keys: n2 }) => new Promise((r3, s3) => {
- r3 = Ye(r3);
- const i3 = e5.objectStore(t3), o3 = n2.length, a3 = new Array(o3);
- let u3, l2 = 0, c2 = 0;
- const h2 = (e6) => {
- const t4 = e6.target;
- a3[t4._pos] = t4.result, ++c2 === l2 && r3(a3);
- }, d2 = tn(s3);
- for (let e6 = 0; e6 < o3; ++e6) null != n2[e6] && (u3 = i3.get(n2[e6]), u3._pos = e6, u3.onsuccess = h2, u3.onerror = d2, ++l2);
- 0 === l2 && r3(a3);
- }), get: ({ trans: e5, key: n2 }) => new Promise((r3, s3) => {
- r3 = Ye(r3);
- const i3 = e5.objectStore(t3).get(n2);
- i3.onsuccess = (e6) => r3(e6.target.result), i3.onerror = tn(s3);
- }), query: /* @__PURE__ */ function(e5) {
- return (n2) => new Promise((r3, i3) => {
- r3 = Ye(r3);
- const { trans: o3, values: a3, limit: u3, query: l2 } = n2, c2 = u3 === 1 / 0 ? void 0 : u3, { index: h2, range: d2 } = l2, f2 = o3.objectStore(t3), p2 = h2.isPrimaryKey ? f2 : f2.index(h2.name), y2 = s2(d2);
- if (0 === u3) return r3({ result: [] });
- if (e5) {
- const e6 = a3 ? p2.getAll(y2, c2) : p2.getAllKeys(y2, c2);
- e6.onsuccess = (e7) => r3({ result: e7.target.result }), e6.onerror = tn(i3);
- } else {
- let e6 = 0;
- const t4 = a3 || !("openKeyCursor" in p2) ? p2.openCursor(y2) : p2.openKeyCursor(y2), n3 = [];
- t4.onsuccess = (s3) => {
- const i4 = t4.result;
- return i4 ? (n3.push(a3 ? i4.value : i4.primaryKey), ++e6 === u3 ? r3({ result: n3 }) : void i4.continue()) : r3({ result: n3 });
- }, t4.onerror = tn(i3);
- }
- });
- }(o2), openCursor: function({ trans: e5, values: n2, query: r3, reverse: i3, unique: o3 }) {
- return new Promise((a3, u3) => {
- a3 = Ye(a3);
- const { index: l2, range: c2 } = r3, h2 = e5.objectStore(t3), d2 = l2.isPrimaryKey ? h2 : h2.index(l2.name), f2 = i3 ? o3 ? "prevunique" : "prev" : o3 ? "nextunique" : "next", p2 = n2 || !("openKeyCursor" in d2) ? d2.openCursor(s2(c2), f2) : d2.openKeyCursor(s2(c2), f2);
- p2.onerror = tn(u3), p2.onsuccess = Ye((t4) => {
- const n3 = p2.result;
- if (!n3) return void a3(null);
- n3.___id = ++pn, n3.done = false;
- const r4 = n3.continue.bind(n3);
- let s3 = n3.continuePrimaryKey;
- s3 && (s3 = s3.bind(n3));
- const i4 = n3.advance.bind(n3), o4 = () => {
- throw new Error("Cursor not stopped");
- };
- n3.trans = e5, n3.stop = n3.continue = n3.continuePrimaryKey = n3.advance = () => {
- throw new Error("Cursor not started");
- }, n3.fail = Ye(u3), n3.next = function() {
- let e6 = 1;
- return this.start(() => e6-- ? this.continue() : this.stop()).then(() => this);
- }, n3.start = (e6) => {
- const t5 = new Promise((e7, t6) => {
- e7 = Ye(e7), p2.onerror = tn(t6), n3.fail = t6, n3.stop = (t7) => {
- n3.stop = n3.continue = n3.continuePrimaryKey = n3.advance = o4, e7(t7);
- };
- }), a4 = () => {
- if (p2.result) try {
- e6();
- } catch (e7) {
- n3.fail(e7);
- }
- else n3.done = true, n3.start = () => {
- throw new Error("Cursor behind last entry");
- }, n3.stop();
- };
- return p2.onsuccess = Ye((e7) => {
- p2.onsuccess = a4, a4();
- }), n3.continue = r4, n3.continuePrimaryKey = s3, n3.advance = i4, a4(), t5;
- }, a3(n3);
- }, u3);
- });
- }, count({ query: e5, trans: n2 }) {
- const { index: r3, range: i3 } = e5;
- return new Promise((e6, o3) => {
- const a3 = n2.objectStore(t3), u3 = r3.isPrimaryKey ? a3 : a3.index(r3.name), l2 = s2(i3), c2 = l2 ? u3.count(l2) : u3.count();
- c2.onsuccess = Ye((t4) => e6(t4.target.result)), c2.onerror = tn(o3);
- });
- } };
- }(e3)), u2 = {};
- return a2.forEach((e3) => u2[e3.name] = e3), { stack: "dbcore", transaction: e2.transaction.bind(e2), table(e3) {
- if (!u2[e3]) throw new Error(`Table '${e3}' not found`);
- return u2[e3];
- }, MIN_KEY: -1 / 0, MAX_KEY: hn(t2), schema: i2 };
-}
-function vn({ _novip: e2 }, t2) {
- const n2 = t2.db, r2 = function(e3, t3, { IDBKeyRange: n3, indexedDB: r3 }, s2) {
- const i2 = function(e4, t4) {
- return t4.reduce((e5, { create: t5 }) => ({ ...e5, ...t5(e5) }), e4);
- }(mn(t3, n3, s2), e3.dbcore);
- return { dbcore: i2 };
- }(e2._middlewares, n2, e2._deps, t2);
- e2.core = r2.dbcore, e2.tables.forEach((t3) => {
- const n3 = t3.name;
- e2.core.schema.tables.some((e3) => e3.name === n3) && (t3.core = e2.core.table(n3), e2[n3] instanceof e2.Table && (e2[n3].core = t3.core));
- });
-}
-function gn({ _novip: e2 }, t2, n2, r2) {
- n2.forEach((n3) => {
- const s2 = r2[n3];
- t2.forEach((t3) => {
- const r3 = d(t3, n3);
- (!r3 || "value" in r3 && void 0 === r3.value) && (t3 === e2.Transaction.prototype || t3 instanceof e2.Transaction ? l(t3, n3, { get() {
- return this.table(n3);
- }, set(e3) {
- u(this, n3, { value: e3, writable: true, configurable: true, enumerable: true });
- } }) : t3[n3] = new e2.Table(n3, s2));
- });
- });
-}
-function bn({ _novip: e2 }, t2) {
- t2.forEach((t3) => {
- for (let n2 in t3) t3[n2] instanceof e2.Table && delete t3[n2];
- });
-}
-function _n(e2, t2) {
- return e2._cfg.version - t2._cfg.version;
-}
-function wn(e2, n2, r2, s2) {
- const i2 = e2._dbSchema, o2 = e2._createTransaction("readwrite", e2._storeNames, i2);
- o2.create(r2), o2._completion.catch(s2);
- const a2 = o2._reject.bind(o2), u2 = Oe.transless || Oe;
- Ze(() => {
- Oe.trans = o2, Oe.transless = u2, 0 === n2 ? (t(i2).forEach((e3) => {
- kn(r2, e3, i2[e3].primKey, i2[e3].indexes);
- }), vn(e2, r2), je.follow(() => e2.on.populate.fire(o2)).catch(a2)) : function({ _novip: e3 }, n3, r3, s3) {
- const i3 = [], o3 = e3._versions;
- let a3 = e3._dbSchema = Pn(e3, e3.idbdb, s3), u3 = false;
- const l2 = o3.filter((e4) => e4._cfg.version >= n3);
- function c2() {
- return i3.length ? je.resolve(i3.shift()(r3.idbtrans)).then(c2) : je.resolve();
- }
- return l2.forEach((o4) => {
- i3.push(() => {
- const i4 = a3, l3 = o4._cfg.dbschema;
- Kn(e3, i4, s3), Kn(e3, l3, s3), a3 = e3._dbSchema = l3;
- const c3 = xn(i4, l3);
- c3.add.forEach((e4) => {
- kn(s3, e4[0], e4[1].primKey, e4[1].indexes);
- }), c3.change.forEach((e4) => {
- if (e4.recreate) throw new X.Upgrade("Not yet support for changing primary key");
- {
- const t2 = s3.objectStore(e4.name);
- e4.add.forEach((e5) => En(t2, e5)), e4.change.forEach((e5) => {
- t2.deleteIndex(e5.name), En(t2, e5);
- }), e4.del.forEach((e5) => t2.deleteIndex(e5));
- }
- });
- const h2 = o4._cfg.contentUpgrade;
- if (h2 && o4._cfg.version > n3) {
- vn(e3, s3), r3._memoizedTables = {}, u3 = true;
- let n4 = w(l3);
- c3.del.forEach((e4) => {
- n4[e4] = i4[e4];
- }), bn(e3, [e3.Transaction.prototype]), gn(e3, [e3.Transaction.prototype], t(n4), n4), r3.schema = n4;
- const o5 = T(h2);
- let a4;
- o5 && et();
- const d2 = je.follow(() => {
- if (a4 = h2(r3), a4 && o5) {
- var e4 = tt.bind(null, null);
- a4.then(e4, e4);
- }
- });
- return a4 && "function" == typeof a4.then ? je.resolve(a4) : d2.then(() => a4);
- }
- }), i3.push((t2) => {
- if (!u3 || !xt) {
- !function(e4, t3) {
- [].slice.call(t3.db.objectStoreNames).forEach((n4) => null == e4[n4] && t3.db.deleteObjectStore(n4));
- }(o4._cfg.dbschema, t2);
- }
- bn(e3, [e3.Transaction.prototype]), gn(e3, [e3.Transaction.prototype], e3._storeNames, e3._dbSchema), r3.schema = e3._dbSchema;
- });
- }), c2().then(() => {
- var e4, n4;
- n4 = s3, t(e4 = a3).forEach((t2) => {
- n4.db.objectStoreNames.contains(t2) || kn(n4, t2, e4[t2].primKey, e4[t2].indexes);
- });
- });
- }(e2, n2, o2, r2).catch(a2);
- });
-}
-function xn(e2, t2) {
- const n2 = { del: [], add: [], change: [] };
- let r2;
- for (r2 in e2) t2[r2] || n2.del.push(r2);
- for (r2 in t2) {
- const s2 = e2[r2], i2 = t2[r2];
- if (s2) {
- const e3 = { name: r2, def: i2, recreate: false, del: [], add: [], change: [] };
- if ("" + (s2.primKey.keyPath || "") != "" + (i2.primKey.keyPath || "") || s2.primKey.auto !== i2.primKey.auto && !wt) e3.recreate = true, n2.change.push(e3);
- else {
- const t3 = s2.idxByName, r3 = i2.idxByName;
- let o2;
- for (o2 in t3) r3[o2] || e3.del.push(o2);
- for (o2 in r3) {
- const n3 = t3[o2], s3 = r3[o2];
- n3 ? n3.src !== s3.src && e3.change.push(s3) : e3.add.push(s3);
- }
- (e3.del.length > 0 || e3.add.length > 0 || e3.change.length > 0) && n2.change.push(e3);
- }
- } else n2.add.push([r2, i2]);
- }
- return n2;
-}
-function kn(e2, t2, n2, r2) {
- const s2 = e2.db.createObjectStore(t2, n2.keyPath ? { keyPath: n2.keyPath, autoIncrement: n2.auto } : { autoIncrement: n2.auto });
- return r2.forEach((e3) => En(s2, e3)), s2;
-}
-function En(e2, t2) {
- e2.createIndex(t2.name, t2.keyPath, { unique: t2.unique, multiEntry: t2.multi });
-}
-function Pn(e2, t2, n2) {
- const r2 = {};
- return p(t2.objectStoreNames, 0).forEach((e3) => {
- const t3 = n2.objectStore(e3);
- let s2 = t3.keyPath;
- const i2 = un(ln(s2), s2 || "", false, false, !!t3.autoIncrement, s2 && "string" != typeof s2, true), o2 = [];
- for (let e4 = 0; e4 < t3.indexNames.length; ++e4) {
- const n3 = t3.index(t3.indexNames[e4]);
- s2 = n3.keyPath;
- var a2 = un(n3.name, s2, !!n3.unique, !!n3.multiEntry, false, s2 && "string" != typeof s2, false);
- o2.push(a2);
- }
- r2[e3] = cn(e3, i2, o2);
- }), r2;
-}
-function Kn({ _novip: t2 }, n2, r2) {
- const s2 = r2.db.objectStoreNames;
- for (let e2 = 0; e2 < s2.length; ++e2) {
- const i2 = s2[e2], o2 = r2.objectStore(i2);
- t2._hasGetAll = "getAll" in o2;
- for (let e3 = 0; e3 < o2.indexNames.length; ++e3) {
- const t3 = o2.indexNames[e3], r3 = o2.index(t3).keyPath, s3 = "string" == typeof r3 ? r3 : "[" + p(r3).join("+") + "]";
- if (n2[i2]) {
- const e4 = n2[i2].idxByName[s3];
- e4 && (e4.name = t3, delete n2[i2].idxByName[s3], n2[i2].idxByName[t3] = e4);
- }
- }
- }
- "undefined" != typeof navigator && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && e.WorkerGlobalScope && e instanceof e.WorkerGlobalScope && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604 && (t2._hasGetAll = false);
-}
-class On {
- _parseStoresSpec(e2, r2) {
- t(e2).forEach((t2) => {
- if (null !== e2[t2]) {
- var s2 = e2[t2].split(",").map((e3, t3) => {
- const r3 = (e3 = e3.trim()).replace(/([&*]|\+\+)/g, ""), s3 = /^\[/.test(r3) ? r3.match(/^\[(.*)\]$/)[1].split("+") : r3;
- return un(r3, s3 || null, /\&/.test(e3), /\*/.test(e3), /\+\+/.test(e3), n(s3), 0 === t3);
- }), i2 = s2.shift();
- if (i2.multi) throw new X.Schema("Primary key cannot be multi-valued");
- s2.forEach((e3) => {
- if (e3.auto) throw new X.Schema("Only primary key can be marked as autoIncrement (++)");
- if (!e3.keyPath) throw new X.Schema("Index must have a name and cannot be an empty string");
- }), r2[t2] = cn(t2, i2, s2);
- }
- });
- }
- stores(e2) {
- const n2 = this.db;
- this._cfg.storesSource = this._cfg.storesSource ? r(this._cfg.storesSource, e2) : e2;
- const s2 = n2._versions, i2 = {};
- let o2 = {};
- return s2.forEach((e3) => {
- r(i2, e3._cfg.storesSource), o2 = e3._cfg.dbschema = {}, e3._parseStoresSpec(i2, o2);
- }), n2._dbSchema = o2, bn(n2, [n2._allTables, n2, n2.Transaction.prototype]), gn(n2, [n2._allTables, n2, n2.Transaction.prototype, this._cfg.tables], t(o2), o2), n2._storeNames = t(o2), this;
- }
- upgrade(e2) {
- return this._cfg.contentUpgrade = ue(this._cfg.contentUpgrade || ee, e2), this;
- }
-}
-function Sn(e2, t2) {
- let n2 = e2._dbNamesDB;
- return n2 || (n2 = e2._dbNamesDB = new Xn(Pt, { addons: [], indexedDB: e2, IDBKeyRange: t2 }), n2.version(1).stores({ dbnames: "name" })), n2.table("dbnames");
-}
-function An(e2) {
- return e2 && "function" == typeof e2.databases;
-}
-function Cn(e2) {
- return Ze(function() {
- return Oe.letThrough = true, e2();
- });
-}
-function jn() {
- var e2;
- return !navigator.userAgentData && /Safari\//.test(navigator.userAgent) && !/Chrom(e|ium)\//.test(navigator.userAgent) && indexedDB.databases ? new Promise(function(t2) {
- var n2 = function() {
- return indexedDB.databases().finally(t2);
- };
- e2 = setInterval(n2, 100), n2();
- }).finally(function() {
- return clearInterval(e2);
- }) : Promise.resolve();
-}
-function Dn(e2) {
- const n2 = e2._state, { indexedDB: r2 } = e2._deps;
- if (n2.isBeingOpened || e2.idbdb) return n2.dbReadyPromise.then(() => n2.dbOpenError ? ft(n2.dbOpenError) : e2);
- R && (n2.openCanceller._stackHolder = q()), n2.isBeingOpened = true, n2.dbOpenError = null, n2.openComplete = false;
- const s2 = n2.openCanceller;
- function i2() {
- if (n2.openCanceller !== s2) throw new X.DatabaseClosed("db.open() was cancelled");
- }
- let o2 = n2.dbReadyResolve, a2 = null, u2 = false;
- return je.race([s2, ("undefined" == typeof navigator ? je.resolve() : jn()).then(() => new je((s3, o3) => {
- if (i2(), !r2) throw new X.MissingAPI();
- const l2 = e2.name, c2 = n2.autoSchema ? r2.open(l2) : r2.open(l2, Math.round(10 * e2.verno));
- if (!c2) throw new X.MissingAPI();
- c2.onerror = tn(o3), c2.onblocked = Ye(e2._fireOnBlocked), c2.onupgradeneeded = Ye((t2) => {
- if (a2 = c2.transaction, n2.autoSchema && !e2._options.allowEmptyDB) {
- c2.onerror = nn, a2.abort(), c2.result.close();
- const e3 = r2.deleteDatabase(l2);
- e3.onsuccess = e3.onerror = Ye(() => {
- o3(new X.NoSuchDatabase(`Database ${l2} doesnt exist`));
- });
- } else {
- a2.onerror = tn(o3);
- var s4 = t2.oldVersion > Math.pow(2, 62) ? 0 : t2.oldVersion;
- u2 = s4 < 1, e2._novip.idbdb = c2.result, wn(e2, s4 / 10, a2, o3);
- }
- }, o3), c2.onsuccess = Ye(() => {
- a2 = null;
- const r3 = e2._novip.idbdb = c2.result, i3 = p(r3.objectStoreNames);
- if (i3.length > 0) try {
- const s4 = r3.transaction(1 === (o4 = i3).length ? o4[0] : o4, "readonly");
- n2.autoSchema ? function({ _novip: e3 }, n3, r4) {
- e3.verno = n3.version / 10;
- const s5 = e3._dbSchema = Pn(0, n3, r4);
- e3._storeNames = p(n3.objectStoreNames, 0), gn(e3, [e3._allTables], t(s5), s5);
- }(e2, r3, s4) : (Kn(e2, e2._dbSchema, s4), function(e3, t2) {
- const n3 = xn(Pn(0, e3.idbdb, t2), e3._dbSchema);
- return !(n3.add.length || n3.change.some((e4) => e4.add.length || e4.change.length));
- }(e2, s4) || console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")), vn(e2, s4);
- } catch (e3) {
- }
- var o4;
- _t.push(e2), r3.onversionchange = Ye((t2) => {
- n2.vcFired = true, e2.on("versionchange").fire(t2);
- }), r3.onclose = Ye((t2) => {
- e2.on("close").fire(t2);
- }), u2 && function({ indexedDB: e3, IDBKeyRange: t2 }, n3) {
- !An(e3) && n3 !== Pt && Sn(e3, t2).put({ name: n3 }).catch(ee);
- }(e2._deps, l2), s3();
- }, o3);
- }))]).then(() => (i2(), n2.onReadyBeingFired = [], je.resolve(Cn(() => e2.on.ready.fire(e2.vip))).then(function t2() {
- if (n2.onReadyBeingFired.length > 0) {
- let r3 = n2.onReadyBeingFired.reduce(ue, ee);
- return n2.onReadyBeingFired = [], je.resolve(Cn(() => r3(e2.vip))).then(t2);
- }
- }))).finally(() => {
- n2.onReadyBeingFired = null, n2.isBeingOpened = false;
- }).then(() => e2).catch((t2) => {
- n2.dbOpenError = t2;
- try {
- a2 && a2.abort();
- } catch (e3) {
- }
- return s2 === n2.openCanceller && e2._close(), ft(t2);
- }).finally(() => {
- n2.openComplete = true, o2();
- });
-}
-function In(e2) {
- var t2 = (t3) => e2.next(t3), r2 = i2(t2), s2 = i2((t3) => e2.throw(t3));
- function i2(e3) {
- return (t3) => {
- var i3 = e3(t3), o2 = i3.value;
- return i3.done ? o2 : o2 && "function" == typeof o2.then ? o2.then(r2, s2) : n(o2) ? Promise.all(o2).then(r2, s2) : r2(o2);
- };
- }
- return i2(t2)();
-}
-function Bn(e2, t2, n2) {
- var r2 = arguments.length;
- if (r2 < 2) throw new X.InvalidArgument("Too few arguments");
- for (var s2 = new Array(r2 - 1); --r2; ) s2[r2 - 1] = arguments[r2];
- return n2 = s2.pop(), [e2, k(s2), n2];
-}
-function Tn(e2, t2, n2, r2, s2) {
- return je.resolve().then(() => {
- const i2 = Oe.transless || Oe, o2 = e2._createTransaction(t2, n2, e2._dbSchema, r2), a2 = { trans: o2, transless: i2 };
- if (r2) o2.idbtrans = r2.idbtrans;
- else try {
- o2.create(), e2._state.PR1398_maxLoop = 3;
- } catch (r3) {
- return r3.name === H.InvalidState && e2.isOpen() && --e2._state.PR1398_maxLoop > 0 ? (console.warn("Dexie: Need to reopen db"), e2._close(), e2.open().then(() => Tn(e2, t2, n2, null, s2))) : ft(r3);
- }
- const u2 = T(s2);
- let l2;
- u2 && et();
- const c2 = je.follow(() => {
- if (l2 = s2.call(o2, o2), l2) if (u2) {
- var e3 = tt.bind(null, null);
- l2.then(e3, e3);
- } else "function" == typeof l2.next && "function" == typeof l2.throw && (l2 = In(l2));
- }, a2);
- return (l2 && "function" == typeof l2.then ? je.resolve(l2).then((e3) => o2.active ? e3 : ft(new X.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))) : c2.then(() => l2)).then((e3) => (r2 && o2._resolve(), o2._completion.then(() => e3))).catch((e3) => (o2._reject(e3), ft(e3)));
- });
-}
-function Rn(e2, t2, r2) {
- const s2 = n(e2) ? e2.slice() : [e2];
- for (let e3 = 0; e3 < r2; ++e3) s2.push(t2);
- return s2;
-}
-const Fn = { stack: "dbcore", name: "VirtualIndexMiddleware", level: 1, create: function(e2) {
- return { ...e2, table(t2) {
- const n2 = e2.table(t2), { schema: r2 } = n2, s2 = {}, i2 = [];
- function o2(e3, t3, n3) {
- const r3 = yn(e3), a3 = s2[r3] = s2[r3] || [], u3 = null == e3 ? 0 : "string" == typeof e3 ? 1 : e3.length, l3 = t3 > 0, c2 = { ...n3, isVirtual: l3, keyTail: t3, keyLength: u3, extractKey: dn(e3), unique: !l3 && n3.unique };
- if (a3.push(c2), c2.isPrimaryKey || i2.push(c2), u3 > 1) {
- o2(2 === u3 ? e3[0] : e3.slice(0, u3 - 1), t3 + 1, n3);
- }
- return a3.sort((e4, t4) => e4.keyTail - t4.keyTail), c2;
- }
- const a2 = o2(r2.primaryKey.keyPath, 0, r2.primaryKey);
- s2[":id"] = [a2];
- for (const e3 of r2.indexes) o2(e3.keyPath, 0, e3);
- function u2(t3) {
- const n3 = t3.query.index;
- return n3.isVirtual ? { ...t3, query: { index: n3, range: (r3 = t3.query.range, s3 = n3.keyTail, { type: 1 === r3.type ? 2 : r3.type, lower: Rn(r3.lower, r3.lowerOpen ? e2.MAX_KEY : e2.MIN_KEY, s3), lowerOpen: true, upper: Rn(r3.upper, r3.upperOpen ? e2.MIN_KEY : e2.MAX_KEY, s3), upperOpen: true }) } } : t3;
- var r3, s3;
- }
- const l2 = { ...n2, schema: { ...r2, primaryKey: a2, indexes: i2, getIndexByKeyPath: function(e3) {
- const t3 = s2[yn(e3)];
- return t3 && t3[0];
- } }, count: (e3) => n2.count(u2(e3)), query: (e3) => n2.query(u2(e3)), openCursor(t3) {
- const { keyTail: r3, isVirtual: s3, keyLength: i3 } = t3.query.index;
- if (!s3) return n2.openCursor(t3);
- return n2.openCursor(u2(t3)).then((n3) => n3 && function(n4) {
- const s4 = Object.create(n4, { continue: { value: function(s5) {
- null != s5 ? n4.continue(Rn(s5, t3.reverse ? e2.MAX_KEY : e2.MIN_KEY, r3)) : t3.unique ? n4.continue(n4.key.slice(0, i3).concat(t3.reverse ? e2.MIN_KEY : e2.MAX_KEY, r3)) : n4.continue();
- } }, continuePrimaryKey: { value(t4, s5) {
- n4.continuePrimaryKey(Rn(t4, e2.MAX_KEY, r3), s5);
- } }, primaryKey: { get: () => n4.primaryKey }, key: { get() {
- const e3 = n4.key;
- return 1 === i3 ? e3[0] : e3.slice(0, i3);
- } }, value: { get: () => n4.value } });
- return s4;
- }(n3));
- } };
- return l2;
- } };
-} };
-function Mn(e2, n2, r2, s2) {
- return r2 = r2 || {}, s2 = s2 || "", t(e2).forEach((t2) => {
- if (o(n2, t2)) {
- var i2 = e2[t2], a2 = n2[t2];
- if ("object" == typeof i2 && "object" == typeof a2 && i2 && a2) {
- const e3 = C(i2);
- e3 !== C(a2) ? r2[s2 + t2] = n2[t2] : "Object" === e3 ? Mn(i2, a2, r2, s2 + t2 + ".") : i2 !== a2 && (r2[s2 + t2] = n2[t2]);
- } else i2 !== a2 && (r2[s2 + t2] = n2[t2]);
- } else r2[s2 + t2] = void 0;
- }), t(n2).forEach((t2) => {
- o(e2, t2) || (r2[s2 + t2] = n2[t2]);
- }), r2;
-}
-const Nn = { stack: "dbcore", name: "HooksMiddleware", level: 2, create: (e2) => ({ ...e2, table(t2) {
- const n2 = e2.table(t2), { primaryKey: r2 } = n2.schema, s2 = { ...n2, mutate(e3) {
- const s3 = Oe.trans, { deleting: i2, creating: a2, updating: u2 } = s3.table(t2).hook;
- switch (e3.type) {
- case "add":
- if (a2.fire === ee) break;
- return s3._promise("readwrite", () => l2(e3), true);
- case "put":
- if (a2.fire === ee && u2.fire === ee) break;
- return s3._promise("readwrite", () => l2(e3), true);
- case "delete":
- if (i2.fire === ee) break;
- return s3._promise("readwrite", () => l2(e3), true);
- case "deleteRange":
- if (i2.fire === ee) break;
- return s3._promise("readwrite", () => function(e4) {
- return c2(e4.trans, e4.range, 1e4);
- }(e3), true);
- }
- return n2.mutate(e3);
- function l2(e4) {
- const t3 = Oe.trans, s4 = e4.keys || function(e5, t4) {
- return "delete" === t4.type ? t4.keys : t4.keys || t4.values.map(e5.extractKey);
- }(r2, e4);
- if (!s4) throw new Error("Keys missing");
- return "delete" !== (e4 = "add" === e4.type || "put" === e4.type ? { ...e4, keys: s4 } : { ...e4 }).type && (e4.values = [...e4.values]), e4.keys && (e4.keys = [...e4.keys]), function(e5, t4, n3) {
- return "add" === t4.type ? Promise.resolve([]) : e5.getMany({ trans: t4.trans, keys: n3, cache: "immutable" });
- }(n2, e4, s4).then((l3) => {
- const c3 = s4.map((n3, s5) => {
- const c4 = l3[s5], h2 = { onerror: null, onsuccess: null };
- if ("delete" === e4.type) i2.fire.call(h2, n3, c4, t3);
- else if ("add" === e4.type || void 0 === c4) {
- const i3 = a2.fire.call(h2, n3, e4.values[s5], t3);
- null == n3 && null != i3 && (n3 = i3, e4.keys[s5] = n3, r2.outbound || _(e4.values[s5], r2.keyPath, n3));
- } else {
- const r3 = Mn(c4, e4.values[s5]), i3 = u2.fire.call(h2, r3, n3, c4, t3);
- if (i3) {
- const t4 = e4.values[s5];
- Object.keys(i3).forEach((e5) => {
- o(t4, e5) ? t4[e5] = i3[e5] : _(t4, e5, i3[e5]);
- });
- }
- }
- return h2;
- });
- return n2.mutate(e4).then(({ failures: t4, results: n3, numFailures: r3, lastResult: i3 }) => {
- for (let r4 = 0; r4 < s4.length; ++r4) {
- const i4 = n3 ? n3[r4] : s4[r4], o2 = c3[r4];
- null == i4 ? o2.onerror && o2.onerror(t4[r4]) : o2.onsuccess && o2.onsuccess("put" === e4.type && l3[r4] ? e4.values[r4] : i4);
- }
- return { failures: t4, results: n3, numFailures: r3, lastResult: i3 };
- }).catch((e5) => (c3.forEach((t4) => t4.onerror && t4.onerror(e5)), Promise.reject(e5)));
- });
- }
- function c2(e4, t3, s4) {
- return n2.query({ trans: e4, values: false, query: { index: r2, range: t3 }, limit: s4 }).then(({ result: n3 }) => l2({ type: "delete", keys: n3, trans: e4 }).then((r3) => r3.numFailures > 0 ? Promise.reject(r3.failures[0]) : n3.length < s4 ? { failures: [], numFailures: 0, lastResult: void 0 } : c2(e4, { ...t3, lower: n3[n3.length - 1], lowerOpen: true }, s4)));
- }
- } };
- return s2;
-} }) };
-function qn(e2, t2, n2) {
- try {
- if (!t2) return null;
- if (t2.keys.length < e2.length) return null;
- const r2 = [];
- for (let s2 = 0, i2 = 0; s2 < t2.keys.length && i2 < e2.length; ++s2) 0 === $t(t2.keys[s2], e2[i2]) && (r2.push(n2 ? O(t2.values[s2]) : t2.values[s2]), ++i2);
- return r2.length === e2.length ? r2 : null;
- } catch (e3) {
- return null;
- }
-}
-const $n = { stack: "dbcore", level: -1, create: (e2) => ({ table: (t2) => {
- const n2 = e2.table(t2);
- return { ...n2, getMany: (e3) => {
- if (!e3.cache) return n2.getMany(e3);
- const t3 = qn(e3.keys, e3.trans._cache, "clone" === e3.cache);
- return t3 ? je.resolve(t3) : n2.getMany(e3).then((t4) => (e3.trans._cache = { keys: e3.keys, values: "clone" === e3.cache ? O(t4) : t4 }, t4));
- }, mutate: (e3) => ("add" !== e3.type && (e3.trans._cache = null), n2.mutate(e3)) };
-} }) };
-function Un(e2) {
- return !("from" in e2);
-}
-const Ln = function(e2, t2) {
- if (!this) {
- const t3 = new Ln();
- return e2 && "d" in e2 && r(t3, e2), t3;
- }
- r(this, arguments.length ? { d: 1, from: e2, to: arguments.length > 1 ? t2 : e2 } : { d: 0 });
-};
-function Vn(e2, t2, n2) {
- const s2 = $t(t2, n2);
- if (isNaN(s2)) return;
- if (s2 > 0) throw RangeError();
- if (Un(e2)) return r(e2, { from: t2, to: n2, d: 1 });
- const i2 = e2.l, o2 = e2.r;
- if ($t(n2, e2.from) < 0) return i2 ? Vn(i2, t2, n2) : e2.l = { from: t2, to: n2, d: 1, l: null, r: null }, Gn(e2);
- if ($t(t2, e2.to) > 0) return o2 ? Vn(o2, t2, n2) : e2.r = { from: t2, to: n2, d: 1, l: null, r: null }, Gn(e2);
- $t(t2, e2.from) < 0 && (e2.from = t2, e2.l = null, e2.d = o2 ? o2.d + 1 : 1), $t(n2, e2.to) > 0 && (e2.to = n2, e2.r = null, e2.d = e2.l ? e2.l.d + 1 : 1);
- const a2 = !e2.r;
- i2 && !e2.l && Wn(e2, i2), o2 && a2 && Wn(e2, o2);
-}
-function Wn(e2, t2) {
- Un(t2) || function e3(t3, { from: n2, to: r2, l: s2, r: i2 }) {
- Vn(t3, n2, r2), s2 && e3(t3, s2), i2 && e3(t3, i2);
- }(e2, t2);
-}
-function Yn(e2, t2) {
- const n2 = zn(t2);
- let r2 = n2.next();
- if (r2.done) return false;
- let s2 = r2.value;
- const i2 = zn(e2);
- let o2 = i2.next(s2.from), a2 = o2.value;
- for (; !r2.done && !o2.done; ) {
- if ($t(a2.from, s2.to) <= 0 && $t(a2.to, s2.from) >= 0) return true;
- $t(s2.from, a2.from) < 0 ? s2 = (r2 = n2.next(a2.from)).value : a2 = (o2 = i2.next(s2.from)).value;
- }
- return false;
-}
-function zn(e2) {
- let t2 = Un(e2) ? null : { s: 0, n: e2 };
- return { next(e3) {
- const n2 = arguments.length > 0;
- for (; t2; ) switch (t2.s) {
- case 0:
- if (t2.s = 1, n2) for (; t2.n.l && $t(e3, t2.n.from) < 0; ) t2 = { up: t2, n: t2.n.l, s: 1 };
- else for (; t2.n.l; ) t2 = { up: t2, n: t2.n.l, s: 1 };
- case 1:
- if (t2.s = 2, !n2 || $t(e3, t2.n.to) <= 0) return { value: t2.n, done: false };
- case 2:
- if (t2.n.r) {
- t2.s = 3, t2 = { up: t2, n: t2.n.r, s: 0 };
- continue;
- }
- case 3:
- t2 = t2.up;
- }
- return { done: true };
- } };
-}
-function Gn(e2) {
- var t2, n2;
- const r2 = ((null === (t2 = e2.r) || void 0 === t2 ? void 0 : t2.d) || 0) - ((null === (n2 = e2.l) || void 0 === n2 ? void 0 : n2.d) || 0), s2 = r2 > 1 ? "r" : r2 < -1 ? "l" : "";
- if (s2) {
- const t3 = "r" === s2 ? "l" : "r", n3 = { ...e2 }, r3 = e2[s2];
- e2.from = r3.from, e2.to = r3.to, e2[s2] = r3[s2], n3[s2] = r3[t3], e2[t3] = n3, n3.d = Hn(n3);
- }
- e2.d = Hn(e2);
-}
-function Hn({ r: e2, l: t2 }) {
- return (e2 ? t2 ? Math.max(e2.d, t2.d) : e2.d : t2 ? t2.d : 0) + 1;
-}
-a(Ln.prototype, { add(e2) {
- return Wn(this, e2), this;
-}, addKey(e2) {
- return Vn(this, e2, e2), this;
-}, addKeys(e2) {
- return e2.forEach((e3) => Vn(this, e3, e3)), this;
-}, [j]() {
- return zn(this);
-} });
-const Qn = { stack: "dbcore", level: 0, create: (e2) => {
- const r2 = e2.schema.name, s2 = new Ln(e2.MIN_KEY, e2.MAX_KEY);
- return { ...e2, table: (i2) => {
- const o2 = e2.table(i2), { schema: a2 } = o2, { primaryKey: u2 } = a2, { extractKey: l2, outbound: c2 } = u2, h2 = { ...o2, mutate: (e3) => {
- const t2 = e3.trans, u3 = t2.mutatedParts || (t2.mutatedParts = {}), l3 = (e4) => {
- const t3 = `idb://${r2}/${i2}/${e4}`;
- return u3[t3] || (u3[t3] = new Ln());
- }, c3 = l3(""), h3 = l3(":dels"), { type: d3 } = e3;
- let [f3, p2] = "deleteRange" === e3.type ? [e3.range] : "delete" === e3.type ? [e3.keys] : e3.values.length < 50 ? [[], e3.values] : [];
- const y2 = e3.trans._cache;
- return o2.mutate(e3).then((e4) => {
- if (n(f3)) {
- "delete" !== d3 && (f3 = e4.results), c3.addKeys(f3);
- const t3 = qn(f3, y2);
- t3 || "add" === d3 || h3.addKeys(f3), (t3 || p2) && function(e5, t4, r3, s3) {
- function i3(t5) {
- const i4 = e5(t5.name || "");
- function o3(e6) {
- return null != e6 ? t5.extractKey(e6) : null;
- }
- const a3 = (e6) => t5.multiEntry && n(e6) ? e6.forEach((e7) => i4.addKey(e7)) : i4.addKey(e6);
- (r3 || s3).forEach((e6, t6) => {
- const n2 = r3 && o3(r3[t6]), i5 = s3 && o3(s3[t6]);
- 0 !== $t(n2, i5) && (null != n2 && a3(n2), null != i5 && a3(i5));
- });
- }
- t4.indexes.forEach(i3);
- }(l3, a2, t3, p2);
- } else if (f3) {
- const e5 = { from: f3.lower, to: f3.upper };
- h3.add(e5), c3.add(e5);
- } else c3.add(s2), h3.add(s2), a2.indexes.forEach((e5) => l3(e5.name).add(s2));
- return e4;
- });
- } }, d2 = ({ query: { index: t2, range: n2 } }) => {
- var r3, s3;
- return [t2, new Ln(null !== (r3 = n2.lower) && void 0 !== r3 ? r3 : e2.MIN_KEY, null !== (s3 = n2.upper) && void 0 !== s3 ? s3 : e2.MAX_KEY)];
- }, f2 = { get: (e3) => [u2, new Ln(e3.key)], getMany: (e3) => [u2, new Ln().addKeys(e3.keys)], count: d2, query: d2, openCursor: d2 };
- return t(f2).forEach((e3) => {
- h2[e3] = function(t2) {
- const { subscr: n2 } = Oe;
- if (n2) {
- const a3 = (e4) => {
- const t3 = `idb://${r2}/${i2}/${e4}`;
- return n2[t3] || (n2[t3] = new Ln());
- }, u3 = a3(""), h3 = a3(":dels"), [d3, p2] = f2[e3](t2);
- if (a3(d3.name || "").add(p2), !d3.isPrimaryKey) {
- if ("count" !== e3) {
- const n3 = "query" === e3 && c2 && t2.values && o2.query({ ...t2, values: false });
- return o2[e3].apply(this, arguments).then((r3) => {
- if ("query" === e3) {
- if (c2 && t2.values) return n3.then(({ result: e5 }) => (u3.addKeys(e5), r3));
- const e4 = t2.values ? r3.result.map(l2) : r3.result;
- t2.values ? u3.addKeys(e4) : h3.addKeys(e4);
- } else if ("openCursor" === e3) {
- const e4 = r3, n4 = t2.values;
- return e4 && Object.create(e4, { key: { get: () => (h3.addKey(e4.primaryKey), e4.key) }, primaryKey: { get() {
- const t3 = e4.primaryKey;
- return h3.addKey(t3), t3;
- } }, value: { get: () => (n4 && u3.addKey(e4.primaryKey), e4.value) } });
- }
- return r3;
- });
- }
- h3.add(s2);
- }
- }
- return o2[e3].apply(this, arguments);
- };
- }), h2;
- } };
-} };
-class Xn {
- constructor(e2, t2) {
- this._middlewares = {}, this.verno = 0;
- const n2 = Xn.dependencies;
- this._options = t2 = { addons: Xn.addons, autoOpen: true, indexedDB: n2.indexedDB, IDBKeyRange: n2.IDBKeyRange, ...t2 }, this._deps = { indexedDB: t2.indexedDB, IDBKeyRange: t2.IDBKeyRange };
- const { addons: r2 } = t2;
- this._dbSchema = {}, this._versions = [], this._storeNames = [], this._allTables = {}, this.idbdb = null, this._novip = this;
- const s2 = { dbOpenError: null, isBeingOpened: false, onReadyBeingFired: null, openComplete: false, dbReadyResolve: ee, dbReadyPromise: null, cancelOpen: ee, openCanceller: null, autoSchema: true, PR1398_maxLoop: 3 };
- var i2;
- s2.dbReadyPromise = new je((e3) => {
- s2.dbReadyResolve = e3;
- }), s2.openCanceller = new je((e3, t3) => {
- s2.cancelOpen = t3;
- }), this._state = s2, this.name = e2, this.on = Dt(this, "populate", "blocked", "versionchange", "close", { ready: [ue, ee] }), this.on.ready.subscribe = y(this.on.ready.subscribe, (e3) => (t3, n3) => {
- Xn.vip(() => {
- const r3 = this._state;
- if (r3.openComplete) r3.dbOpenError || je.resolve().then(t3), n3 && e3(t3);
- else if (r3.onReadyBeingFired) r3.onReadyBeingFired.push(t3), n3 && e3(t3);
- else {
- e3(t3);
- const r4 = this;
- n3 || e3(function e4() {
- r4.on.ready.unsubscribe(t3), r4.on.ready.unsubscribe(e4);
- });
- }
- });
- }), this.Collection = (i2 = this, It(Vt.prototype, function(e3, t3) {
- this.db = i2;
- let n3 = At, r3 = null;
- if (t3) try {
- n3 = t3();
- } catch (e4) {
- r3 = e4;
- }
- const s3 = e3._ctx, o2 = s3.table, a2 = o2.hook.reading.fire;
- this._ctx = { table: o2, index: s3.index, isPrimKey: !s3.index || o2.schema.primKey.keyPath && s3.index === o2.schema.primKey.name, range: n3, keysOnly: false, dir: "next", unique: "", algorithm: null, filter: null, replayFilter: null, justLimit: true, isMatch: null, offset: 0, limit: 1 / 0, error: r3, or: s3.or, valueMapper: a2 !== te ? a2 : null };
- })), this.Table = function(e3) {
- return It(jt.prototype, function(t3, n3, r3) {
- this.db = e3, this._tx = r3, this.name = t3, this.schema = n3, this.hook = e3._allTables[t3] ? e3._allTables[t3].hook : Dt(null, { creating: [se, ee], reading: [ne, te], updating: [oe, ee], deleting: [ie, ee] });
- });
- }(this), this.Transaction = function(e3) {
- return It(an.prototype, function(t3, n3, r3, s3, i3) {
- this.db = e3, this.mode = t3, this.storeNames = n3, this.schema = r3, this.chromeTransactionDurability = s3, this.idbtrans = null, this.on = Dt(this, "complete", "error", "abort"), this.parent = i3 || null, this.active = true, this._reculock = 0, this._blockedFuncs = [], this._resolve = null, this._reject = null, this._waitingFor = null, this._waitingQueue = null, this._spinCount = 0, this._completion = new je((e4, t4) => {
- this._resolve = e4, this._reject = t4;
- }), this._completion.then(() => {
- this.active = false, this.on.complete.fire();
- }, (e4) => {
- var t4 = this.active;
- return this.active = false, this.on.error.fire(e4), this.parent ? this.parent._reject(e4) : t4 && this.idbtrans && this.idbtrans.abort(), ft(e4);
- });
- });
- }(this), this.Version = function(e3) {
- return It(On.prototype, function(t3) {
- this.db = e3, this._cfg = { version: t3, storesSource: null, dbschema: {}, tables: {}, contentUpgrade: null };
- });
- }(this), this.WhereClause = function(e3) {
- return It(en.prototype, function(t3, n3, r3) {
- this.db = e3, this._ctx = { table: t3, index: ":id" === n3 ? null : n3, or: r3 };
- const s3 = e3._deps.indexedDB;
- if (!s3) throw new X.MissingAPI();
- this._cmp = this._ascending = s3.cmp.bind(s3), this._descending = (e4, t4) => s3.cmp(t4, e4), this._max = (e4, t4) => s3.cmp(e4, t4) > 0 ? e4 : t4, this._min = (e4, t4) => s3.cmp(e4, t4) < 0 ? e4 : t4, this._IDBKeyRange = e3._deps.IDBKeyRange;
- });
- }(this), this.on("versionchange", (e3) => {
- e3.newVersion > 0 ? console.warn(`Another connection wants to upgrade database '${this.name}'. Closing db now to resume the upgrade.`) : console.warn(`Another connection wants to delete database '${this.name}'. Closing db now to resume the delete request.`), this.close();
- }), this.on("blocked", (e3) => {
- !e3.newVersion || e3.newVersion < e3.oldVersion ? console.warn(`Dexie.delete('${this.name}') was blocked`) : console.warn(`Upgrade '${this.name}' blocked by other connection holding version ${e3.oldVersion / 10}`);
- }), this._maxKey = hn(t2.IDBKeyRange), this._createTransaction = (e3, t3, n3, r3) => new this.Transaction(e3, t3, n3, this._options.chromeTransactionDurability, r3), this._fireOnBlocked = (e3) => {
- this.on("blocked").fire(e3), _t.filter((e4) => e4.name === this.name && e4 !== this && !e4._state.vcFired).map((t3) => t3.on("versionchange").fire(e3));
- }, this.use(Fn), this.use(Nn), this.use(Qn), this.use($n), this.vip = Object.create(this, { _vip: { value: true } }), r2.forEach((e3) => e3(this));
- }
- version(e2) {
- if (isNaN(e2) || e2 < 0.1) throw new X.Type("Given version is not a positive number");
- if (e2 = Math.round(10 * e2) / 10, this.idbdb || this._state.isBeingOpened) throw new X.Schema("Cannot add version when database is open");
- this.verno = Math.max(this.verno, e2);
- const t2 = this._versions;
- var n2 = t2.filter((t3) => t3._cfg.version === e2)[0];
- return n2 || (n2 = new this.Version(e2), t2.push(n2), t2.sort(_n), n2.stores({}), this._state.autoSchema = false, n2);
- }
- _whenReady(e2) {
- return this.idbdb && (this._state.openComplete || Oe.letThrough || this._vip) ? e2() : new je((e3, t2) => {
- if (this._state.openComplete) return t2(new X.DatabaseClosed(this._state.dbOpenError));
- if (!this._state.isBeingOpened) {
- if (!this._options.autoOpen) return void t2(new X.DatabaseClosed());
- this.open().catch(ee);
- }
- this._state.dbReadyPromise.then(e3, t2);
- }).then(e2);
- }
- use({ stack: e2, create: t2, level: n2, name: r2 }) {
- r2 && this.unuse({ stack: e2, name: r2 });
- const s2 = this._middlewares[e2] || (this._middlewares[e2] = []);
- return s2.push({ stack: e2, create: t2, level: null == n2 ? 10 : n2, name: r2 }), s2.sort((e3, t3) => e3.level - t3.level), this;
- }
- unuse({ stack: e2, name: t2, create: n2 }) {
- return e2 && this._middlewares[e2] && (this._middlewares[e2] = this._middlewares[e2].filter((e3) => n2 ? e3.create !== n2 : !!t2 && e3.name !== t2)), this;
- }
- open() {
- return Dn(this);
- }
- _close() {
- const e2 = this._state, t2 = _t.indexOf(this);
- if (t2 >= 0 && _t.splice(t2, 1), this.idbdb) {
- try {
- this.idbdb.close();
- } catch (e3) {
- }
- this._novip.idbdb = null;
- }
- e2.dbReadyPromise = new je((t3) => {
- e2.dbReadyResolve = t3;
- }), e2.openCanceller = new je((t3, n2) => {
- e2.cancelOpen = n2;
- });
- }
- close() {
- this._close();
- const e2 = this._state;
- this._options.autoOpen = false, e2.dbOpenError = new X.DatabaseClosed(), e2.isBeingOpened && e2.cancelOpen(e2.dbOpenError);
- }
- delete() {
- const e2 = arguments.length > 0, t2 = this._state;
- return new je((n2, r2) => {
- const s2 = () => {
- this.close();
- var e3 = this._deps.indexedDB.deleteDatabase(this.name);
- e3.onsuccess = Ye(() => {
- !function({ indexedDB: e4, IDBKeyRange: t3 }, n3) {
- !An(e4) && n3 !== Pt && Sn(e4, t3).delete(n3).catch(ee);
- }(this._deps, this.name), n2();
- }), e3.onerror = tn(r2), e3.onblocked = this._fireOnBlocked;
- };
- if (e2) throw new X.InvalidArgument("Arguments not allowed in db.delete()");
- t2.isBeingOpened ? t2.dbReadyPromise.then(s2) : s2();
- });
- }
- backendDB() {
- return this.idbdb;
- }
- isOpen() {
- return null !== this.idbdb;
- }
- hasBeenClosed() {
- const e2 = this._state.dbOpenError;
- return e2 && "DatabaseClosed" === e2.name;
- }
- hasFailed() {
- return null !== this._state.dbOpenError;
- }
- dynamicallyOpened() {
- return this._state.autoSchema;
- }
- get tables() {
- return t(this._allTables).map((e2) => this._allTables[e2]);
- }
- transaction() {
- const e2 = Bn.apply(this, arguments);
- return this._transaction.apply(this, e2);
- }
- _transaction(e2, t2, n2) {
- let r2 = Oe.trans;
- r2 && r2.db === this && -1 === e2.indexOf("!") || (r2 = null);
- const s2 = -1 !== e2.indexOf("?");
- let i2, o2;
- e2 = e2.replace("!", "").replace("?", "");
- try {
- if (o2 = t2.map((e3) => {
- var t3 = e3 instanceof this.Table ? e3.name : e3;
- if ("string" != typeof t3) throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");
- return t3;
- }), "r" == e2 || e2 === Kt) i2 = Kt;
- else {
- if ("rw" != e2 && e2 != Ot) throw new X.InvalidArgument("Invalid transaction mode: " + e2);
- i2 = Ot;
- }
- if (r2) {
- if (r2.mode === Kt && i2 === Ot) {
- if (!s2) throw new X.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");
- r2 = null;
- }
- r2 && o2.forEach((e3) => {
- if (r2 && -1 === r2.storeNames.indexOf(e3)) {
- if (!s2) throw new X.SubTransaction("Table " + e3 + " not included in parent transaction.");
- r2 = null;
- }
- }), s2 && r2 && !r2.active && (r2 = null);
- }
- } catch (e3) {
- return r2 ? r2._promise(null, (t3, n3) => {
- n3(e3);
- }) : ft(e3);
- }
- const a2 = Tn.bind(null, this, i2, o2, r2, n2);
- return r2 ? r2._promise(i2, a2, "lock") : Oe.trans ? at(Oe.transless, () => this._whenReady(a2)) : this._whenReady(a2);
- }
- table(e2) {
- if (!o(this._allTables, e2)) throw new X.InvalidTable(`Table ${e2} does not exist`);
- return this._allTables[e2];
- }
-}
-const Jn = "undefined" != typeof Symbol && "observable" in Symbol ? Symbol.observable : "@@observable";
-class Zn {
- constructor(e2) {
- this._subscribe = e2;
- }
- subscribe(e2, t2, n2) {
- return this._subscribe(e2 && "function" != typeof e2 ? e2 : { next: e2, error: t2, complete: n2 });
- }
- [Jn]() {
- return this;
- }
-}
-function er(e2, n2) {
- return t(n2).forEach((t2) => {
- Wn(e2[t2] || (e2[t2] = new Ln()), n2[t2]);
- }), e2;
-}
-function tr(e2) {
- let n2, r2 = false;
- const s2 = new Zn((s3) => {
- const i2 = T(e2);
- let o2 = false, a2 = {}, u2 = {};
- const l2 = { get closed() {
- return o2;
- }, unsubscribe: () => {
- o2 = true, on.storagemutated.unsubscribe(f2);
- } };
- s3.start && s3.start(l2);
- let c2 = false, h2 = false;
- function d2() {
- return t(u2).some((e3) => a2[e3] && Yn(a2[e3], u2[e3]));
- }
- const f2 = (e3) => {
- er(a2, e3), d2() && p2();
- }, p2 = () => {
- if (c2 || o2) return;
- a2 = {};
- const t2 = {}, y2 = function(t3) {
- i2 && et();
- const n3 = () => Ze(e2, { subscr: t3, trans: null }), r3 = Oe.trans ? at(Oe.transless, n3) : n3();
- return i2 && r3.then(tt, tt), r3;
- }(t2);
- h2 || (on(rn, f2), h2 = true), c2 = true, Promise.resolve(y2).then((e3) => {
- r2 = true, n2 = e3, c2 = false, o2 || (d2() ? p2() : (a2 = {}, u2 = t2, s3.next && s3.next(e3)));
- }, (e3) => {
- c2 = false, r2 = false, s3.error && s3.error(e3), l2.unsubscribe();
- });
- };
- return p2(), l2;
- });
- return s2.hasValue = () => r2, s2.getValue = () => n2, s2;
-}
-let nr;
-try {
- nr = { indexedDB: e.indexedDB || e.mozIndexedDB || e.webkitIndexedDB || e.msIndexedDB, IDBKeyRange: e.IDBKeyRange || e.webkitIDBKeyRange };
-} catch (e2) {
- nr = { indexedDB: null, IDBKeyRange: null };
-}
-const rr = Xn;
-function sr(e2) {
- let t2 = ir;
- try {
- ir = true, on.storagemutated.fire(e2);
- } finally {
- ir = t2;
- }
-}
-a(rr, { ...Z, delete: (e2) => new rr(e2, { addons: [] }).delete(), exists: (e2) => new rr(e2, { addons: [] }).open().then((e3) => (e3.close(), true)).catch("NoSuchDatabaseError", () => false), getDatabaseNames(e2) {
- try {
- return function({ indexedDB: e3, IDBKeyRange: t2 }) {
- return An(e3) ? Promise.resolve(e3.databases()).then((e4) => e4.map((e5) => e5.name).filter((e5) => e5 !== Pt)) : Sn(e3, t2).toCollection().primaryKeys();
- }(rr.dependencies).then(e2);
- } catch (e3) {
- return ft(new X.MissingAPI());
- }
-}, defineClass: () => function(e2) {
- r(this, e2);
-}, ignoreTransaction: (e2) => Oe.trans ? at(Oe.transless, e2) : e2(), vip: Cn, async: function(e2) {
- return function() {
- try {
- var t2 = In(e2.apply(this, arguments));
- return t2 && "function" == typeof t2.then ? t2 : je.resolve(t2);
- } catch (e3) {
- return ft(e3);
- }
- };
-}, spawn: function(e2, t2, n2) {
- try {
- var r2 = In(e2.apply(n2, t2 || []));
- return r2 && "function" == typeof r2.then ? r2 : je.resolve(r2);
- } catch (e3) {
- return ft(e3);
- }
-}, currentTransaction: { get: () => Oe.trans || null }, waitFor: function(e2, t2) {
- const n2 = je.resolve("function" == typeof e2 ? rr.ignoreTransaction(e2) : e2).timeout(t2 || 6e4);
- return Oe.trans ? Oe.trans.waitFor(n2) : n2;
-}, Promise: je, debug: { get: () => R, set: (e2) => {
- F(e2, "dexie" === e2 ? () => true : Et);
-} }, derive: c, extend: r, props: a, override: y, Events: Dt, on, liveQuery: tr, extendObservabilitySet: er, getByKeyPath: b, setByKeyPath: _, delByKeyPath: function(e2, t2) {
- "string" == typeof t2 ? _(e2, t2, void 0) : "length" in t2 && [].map.call(t2, function(t3) {
- _(e2, t3, void 0);
- });
-}, shallowClone: w, deepClone: O, getObjectDiff: Mn, cmp: $t, asap: v, minKey: vt, addons: [], connections: _t, errnames: H, dependencies: nr, semVer: yt, version: yt.split(".").map((e2) => parseInt(e2)).reduce((e2, t2, n2) => e2 + t2 / Math.pow(10, 2 * n2)) }), rr.maxKey = hn(rr.dependencies.IDBKeyRange), "undefined" != typeof dispatchEvent && "undefined" != typeof addEventListener && (on(rn, (e2) => {
- if (!ir) {
- let t2;
- wt ? (t2 = document.createEvent("CustomEvent"), t2.initCustomEvent(sn, true, true, e2)) : t2 = new CustomEvent(sn, { detail: e2 }), ir = true, dispatchEvent(t2), ir = false;
- }
-}), addEventListener(sn, ({ detail: e2 }) => {
- ir || sr(e2);
-}));
-let ir = false;
-if ("undefined" != typeof BroadcastChannel) {
- const e2 = new BroadcastChannel(sn);
- "function" == typeof e2.unref && e2.unref(), on(rn, (t2) => {
- ir || e2.postMessage(t2);
- }), e2.onmessage = (e3) => {
- e3.data && sr(e3.data);
- };
-} else if ("undefined" != typeof self && "undefined" != typeof navigator) {
- on(rn, (e3) => {
- try {
- ir || ("undefined" != typeof localStorage && localStorage.setItem(sn, JSON.stringify({ trig: Math.random(), changedParts: e3 })), "object" == typeof self.clients && [...self.clients.matchAll({ includeUncontrolled: true })].forEach((t2) => t2.postMessage({ type: sn, changedParts: e3 })));
- } catch (e4) {
- }
- }), "undefined" != typeof addEventListener && addEventListener("storage", (e3) => {
- if (e3.key === sn) {
- const t2 = JSON.parse(e3.newValue);
- t2 && sr(t2.changedParts);
- }
- });
- const e2 = self.document && navigator.serviceWorker;
- e2 && e2.addEventListener("message", function({ data: e3 }) {
- e3 && e3.type === sn && sr(e3.changedParts);
- });
-}
-je.rejectionMapper = function(e2, t2) {
- if (!e2 || e2 instanceof W || e2 instanceof TypeError || e2 instanceof SyntaxError || !e2.name || !J[e2.name]) return e2;
- var n2 = new J[e2.name](t2 || e2.message, e2);
- return "stack" in e2 && l(n2, "stack", { get: function() {
- return this.inner.stack;
- } }), n2;
-}, F(R, Et);
-class FileCacheDb extends Xn {
- aliyun;
- github;
- imgur;
- local;
- tcyun;
- qiniu;
- smms;
- s3plist;
- sftp;
- upyun;
- webdavplist;
- constructor() {
- super("bucketFileDb");
- const tableNames = [
- "aliyun",
- "github",
- "imgur",
- "local",
- "qiniu",
- "s3plist",
- "sftp",
- "smms",
- "tcyun",
- "upyun",
- "webdavplist"
- ];
- const tableNamesMap = tableNames.reduce((acc, cur) => {
- acc[cur] = "&key, value";
- return acc;
- }, {});
- this.version(5).stores(tableNamesMap);
- this.aliyun = this.table("aliyun");
- this.github = this.table("github");
- this.imgur = this.table("imgur");
- this.local = this.table("local");
- this.qiniu = this.table("qiniu");
- this.tcyun = this.table("tcyun");
- this.s3plist = this.table("s3plist");
- this.sftp = this.table("sftp");
- this.smms = this.table("smms");
- this.upyun = this.table("upyun");
- this.webdavplist = this.table("webdavplist");
- }
-}
-const fileCacheDbInstance = new FileCacheDb();
-export {
- fileCacheDbInstance as f
-};
diff --git a/dist/renderer/assets/bus-BjW7Y6FA.js b/dist/renderer/assets/bus-BjW7Y6FA.js
deleted file mode 100644
index 399801ca..00000000
--- a/dist/renderer/assets/bus-BjW7Y6FA.js
+++ /dev/null
@@ -1,20 +0,0 @@
-function mitt(n) {
- return { all: n = n || /* @__PURE__ */ new Map(), on: function(t, e) {
- var i = n.get(t);
- i ? i.push(e) : n.set(t, [e]);
- }, off: function(t, e) {
- var i = n.get(t);
- i && (e ? i.splice(i.indexOf(e) >>> 0, 1) : n.set(t, []));
- }, emit: function(t, e) {
- var i = n.get(t);
- i && i.slice().map(function(n2) {
- n2(e);
- }), (i = n.get("*")) && i.slice().map(function(n2) {
- n2(t, e);
- });
- } };
-}
-const emitter = mitt();
-export {
- emitter as e
-};
diff --git a/dist/renderer/assets/common-DNjr697i.js b/dist/renderer/assets/common-DNjr697i.js
deleted file mode 100644
index 3cada7c2..00000000
--- a/dist/renderer/assets/common-DNjr697i.js
+++ /dev/null
@@ -1,51 +0,0 @@
-const isUrl = (url) => {
- try {
- return Boolean(new URL(url));
- } catch {
- return false;
- }
-};
-const isUrlEncode = (url) => {
- url = url || "";
- try {
- return url !== decodeURI(url);
- } catch {
- return false;
- }
-};
-const handleUrlEncode = (url) => isUrlEncode(url) ? url : encodeURI(url);
-const handleStreamlinePluginName = (name) => name.replace(/(@[^/]+\/)?picgo-plugin-/, "");
-const enforceNumber = (num) => isNaN(+num) ? 0 : +num;
-function isNeedToShorten(alias, cutOff = 20) {
- return [...alias].reduce((len, char) => len + (char.charCodeAt(0) > 255 ? 2 : 1), 0) > cutOff;
-}
-function safeSliceF(str, total) {
- let result = "";
- let totalLen = 0;
- for (const s of str) {
- if (totalLen >= total) {
- break;
- }
- result += s;
- totalLen += s.charCodeAt(0) > 255 ? 2 : 1;
- }
- return result;
-}
-const formatEndpoint = (endpoint, sslEnabled) => {
- const hasProtocol = /^https?:\/\//.test(endpoint);
- if (!hasProtocol) {
- return `${sslEnabled ? "https" : "http"}://${endpoint}`;
- }
- return sslEnabled ? endpoint.replace(/^http:\/\//, "https://") : endpoint.replace(/^https:\/\//, "http://");
-};
-const trimPath = (path) => path.replace(/^\/+|\/+$/g, "").replace(/\/+/g, "/");
-export {
- isNeedToShorten as a,
- handleStreamlinePluginName as b,
- enforceNumber as e,
- formatEndpoint as f,
- handleUrlEncode as h,
- isUrl as i,
- safeSliceF as s,
- trimPath as t
-};
diff --git a/dist/renderer/assets/common-REXFY3_s.js b/dist/renderer/assets/common-REXFY3_s.js
deleted file mode 100644
index 9cf724cb..00000000
--- a/dist/renderer/assets/common-REXFY3_s.js
+++ /dev/null
@@ -1,513 +0,0 @@
-import { g as getConfig } from "./dataSender-Bg45AIFL.js";
-import { s as safeSliceF, a as isNeedToShorten, h as handleUrlEncode } from "./common-DNjr697i.js";
-const byteToHex = [];
-for (let i = 0; i < 256; ++i) {
- byteToHex.push((i + 256).toString(16).slice(1));
-}
-function unsafeStringify(arr, offset = 0) {
- return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
-}
-let getRandomValues;
-const rnds8 = new Uint8Array(16);
-function rng() {
- if (!getRandomValues) {
- if (typeof crypto === "undefined" || !crypto.getRandomValues) {
- throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
- }
- getRandomValues = crypto.getRandomValues.bind(crypto);
- }
- return getRandomValues(rnds8);
-}
-const randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
-const native = { randomUUID };
-function v4(options, buf, offset) {
- if (native.randomUUID && true && !options) {
- return native.randomUUID();
- }
- options = options || {};
- const rnds = options.random ?? options.rng?.() ?? rng();
- if (rnds.length < 16) {
- throw new Error("Random bytes length must be >= 16");
- }
- rnds[6] = rnds[6] & 15 | 64;
- rnds[8] = rnds[8] & 63 | 128;
- return unsafeStringify(rnds);
-}
-const availableIconList = [
- "_blank",
- "_page",
- "3g2",
- "3gp",
- "7z",
- "aac",
- "accdb",
- "adt",
- "ai",
- "aiff",
- "aly",
- "amiga",
- "amr",
- "ape",
- "apk",
- "arj",
- "asf",
- "asm",
- "asx",
- "au",
- "avc",
- "avi",
- "avif",
- "avs",
- "bak",
- "bas",
- "bat",
- "bmp",
- "bom",
- "c",
- "cda",
- "cdr",
- "chm",
- "class",
- "cmd",
- "com",
- "cpp",
- "css",
- "csv",
- "dart",
- "dat",
- "ddb",
- "dif",
- "divx",
- "dll",
- "dmg",
- "doc",
- "docm",
- "docx",
- "dot",
- "dotm",
- "dotx",
- "dsl",
- "dv",
- "dvd",
- "dvdaudio",
- "dwg",
- "dxf",
- "emf",
- "env",
- "eot",
- "eps",
- "exe",
- "exif",
- "fakesmms",
- "flc",
- "fli",
- "flv",
- "folder",
- "fon",
- "font",
- "for",
- "fpx",
- "fv",
- "gif",
- "gitingore",
- "gitkeep",
- "gz",
- "h",
- "hdri",
- "hlp",
- "hpp",
- "htm",
- "html",
- "ico",
- "ics",
- "int",
- "ipynb",
- "iso",
- "java",
- "jpeg",
- "jpg",
- "js",
- "json",
- "key",
- "ksp",
- "less",
- "lib",
- "lic",
- "license",
- "log",
- "lst",
- "lua",
- "mac",
- "map",
- "markdown",
- "md",
- "mdf",
- "mht",
- "mhtml",
- "mid",
- "midi",
- "mkv",
- "mmf",
- "mod",
- "mov",
- "mp2",
- "mp3",
- "mp4",
- "mpa",
- "mpe",
- "mpeg",
- "mpeg1",
- "mpeg2",
- "mpg",
- "mppro",
- "msg",
- "mts",
- "mux",
- "mv",
- "navi",
- "obj",
- "odf",
- "ods",
- "odt",
- "ogg",
- "one",
- "otf",
- "otp",
- "ots",
- "ott",
- "pas",
- "pcd",
- "pcx",
- "pdf",
- "php",
- "pic",
- "png",
- "ppt",
- "pptx",
- "proe",
- "prt",
- "psd",
- "py",
- "pyc",
- "qsv",
- "qt",
- "quicktime",
- "ra",
- "ram",
- "rar",
- "raw",
- "rb",
- "realaudio",
- "rm",
- "rmvb",
- "rp",
- "rtf",
- "s48",
- "sacd",
- "sass",
- "sch",
- "scss",
- "sh",
- "sql",
- "stp",
- "svcd",
- "svg",
- "swf",
- "sys",
- "tga",
- "tgz",
- "tiff",
- "tmp",
- "ts",
- "ttc",
- "ttf",
- "txt",
- "ufo",
- "unknown",
- "vcd",
- "vob",
- "voc",
- "vqf",
- "vue",
- "wav",
- "wdl",
- "webm",
- "webp",
- "wki",
- "wma",
- "wmf",
- "wmv",
- "wmvhd",
- "woff",
- "woff2",
- "wps",
- "wpt",
- "x_t",
- "xls",
- "xlsm",
- "xlsx",
- "xlt",
- "xltm",
- "xltx",
- "xmind",
- "xml",
- "xv",
- "xvid",
- "yaml",
- "yml",
- "z",
- "zip"
-];
-function randomStringGenerator(length) {
- const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
- return Array.from({ length }).map(() => chars.charAt(Math.floor(Math.random() * chars.length))).join("");
-}
-function renameFileNameWithTimestamp(oldName) {
- return `${Math.floor(Date.now() / 1e3)}${randomStringGenerator(5)}${window.node.path.extname(oldName)}`;
-}
-function renameFileNameWithRandomString(oldName, length = 5) {
- return `${randomStringGenerator(length)}${window.node.path.extname(oldName)}`;
-}
-function renameFormatHelper(num) {
- return num.toString().length === 1 ? `0${num}` : num.toString();
-}
-function getMd5(input) {
- return window.node.crypto.createHash("md5").update(input).digest("hex");
-}
-function renameFileNameWithCustomString(oldName, customFormat, affixFileName) {
- const date = /* @__PURE__ */ new Date();
- const year = date.getFullYear().toString();
- const fileBaseName = window.node.path.basename(oldName, window.node.path.extname(oldName));
- const conversionMap = {
- "{Y}": () => year,
- "{y}": () => year.slice(2),
- "{m}": () => renameFormatHelper(date.getMonth() + 1),
- "{d}": () => renameFormatHelper(date.getDate()),
- "{h}": () => renameFormatHelper(date.getHours()),
- "{i}": () => renameFormatHelper(date.getMinutes()),
- "{s}": () => renameFormatHelper(date.getSeconds()),
- "{ms}": () => date.getMilliseconds().toString().padStart(3, "0"),
- "{md5}": () => getMd5(fileBaseName),
- "{md5-16}": () => getMd5(fileBaseName).slice(0, 16),
- "{filename}": () => affixFileName ? window.node.path.basename(affixFileName, window.node.path.extname(affixFileName)) : window.node.path.basename(oldName, window.node.path.extname(oldName)),
- "{uuid}": () => v4().replace(/-/g, ""),
- "{timestamp}": () => date.getTime().toString()
- };
- if (customFormat === void 0 || !Object.keys(conversionMap).some((item) => customFormat.includes(item)) && !customFormat.includes("{str-")) {
- return oldName;
- }
- const ext = window.node.path.extname(oldName);
- let newName = Object.keys(conversionMap).reduce((acc, cur) => {
- return acc.replace(new RegExp(cur, "g"), conversionMap[cur]());
- }, customFormat) + ext;
- const strRegex = /{str-(\d+)}/gi;
- newName = newName.replace(strRegex, (_, group1) => {
- const length = parseInt(group1, 10);
- return randomStringGenerator(length);
- });
- return newName;
-}
-function renameFile({ timestampRename, randomStringRename, customRename, customRenameFormat }, oldName = "") {
- switch (true) {
- case timestampRename:
- return renameFileNameWithTimestamp(oldName);
- case randomStringRename:
- return renameFileNameWithRandomString(oldName, 20);
- case customRename:
- return renameFileNameWithCustomString(oldName, customRenameFormat);
- default:
- return oldName;
- }
-}
-async function formatLink(url, fileName, type, format) {
- const encodedUrl = await getConfig("settings.isEncodeUrl") ? handleUrlEncode(url) : url;
- switch (type) {
- case "markdown":
- return ``;
- case "html":
- return `
`;
- case "bbcode":
- return `[img]${encodedUrl}[/img]`;
- case "url":
- return encodedUrl;
- case "markdown-with-link":
- return `[](${encodedUrl})`;
- case "custom":
- if (format && (format.includes("$url") || format.includes("$fileName"))) {
- return format.replace(/\$url/g, encodedUrl).replace(/\$fileName/g, fileName);
- }
- return encodedUrl;
- default:
- return encodedUrl;
- }
-}
-function getFileIconPath(fileName) {
- const ext = window.node.path.extname(fileName).slice(1).toLowerCase();
- return availableIconList.includes(ext) ? `${ext}.webp` : "unknown.webp";
-}
-const units = ["B", "KB", "MB", "GB", "TB", "PB"];
-function formatFileSize(size) {
- if (size === 0) return "";
- const index = Math.floor(Math.log2(size) / 10);
- return `${(size / Math.pow(2, index * 10)).toFixed(2)} ${units[index]}`;
-}
-function formatFileName(fileName, length = 20) {
- let ext = window.node.path.extname(fileName);
- ext = ext.length > 5 ? ext.slice(ext.length - 5) : ext;
- const name = window.node.path.basename(fileName, ext);
- return isNeedToShorten(fileName, length) ? `${safeSliceF(name, length - 3 - ext.length)}...${ext}` : fileName;
-}
-function formObjToTableData(obj) {
- const exclude = [void 0, null, "", "transformedConfig"];
- return Object.keys(obj).filter((key) => !exclude.includes(obj[key])).map((key) => ({
- key,
- value: typeof obj[key] === "object" ? JSON.stringify(obj[key]) : obj[key]
- })).sort((a, b) => a.key.localeCompare(b.key));
-}
-function isValidUrl(str) {
- try {
- return !!new URL(str);
- } catch (e) {
- return false;
- }
-}
-const svg = `
-
- `;
-function customStrMatch(str, pattern) {
- if (!str || !pattern) return false;
- try {
- const reg = new RegExp(pattern, "ug");
- return reg.test(str);
- } catch (e) {
- console.error(e);
- return false;
- }
-}
-function customStrReplace(str, pattern, replacement) {
- if (!str || !pattern) return str;
- replacement = replacement || "";
- let result = str;
- try {
- const reg = new RegExp(pattern, "ug");
- result = str.replace(reg, replacement);
- result = renameFileNameWithCustomString(result, result, str);
- } catch (e) {
- console.error(e);
- }
- return result;
-}
-const customRenameFormatTable = [
- {
- placeholder: "{Y}",
- description: "年份,4位数",
- placeholderB: "{y}",
- descriptionB: "年份,2位数"
- },
- {
- placeholder: "{m}",
- description: "月份(01-12)",
- placeholderB: "{d}",
- descriptionB: "日期(01-31)"
- },
- {
- placeholder: "{h}",
- description: "小时(00-23)",
- placeholderB: "{i}",
- descriptionB: "分钟(00-59)"
- },
- {
- placeholder: "{s}",
- description: "秒(00-59)",
- placeholderB: "{ms}",
- descriptionB: "毫秒(000-999)"
- },
- {
- placeholder: "{timestamp}",
- description: "时间戳(毫秒)",
- placeholderB: "{uuid}",
- descriptionB: "uuid字符串"
- },
- {
- placeholder: "{md5}",
- description: "md5",
- placeholderB: "{md5-16}",
- descriptionB: "md5前16位"
- },
- {
- placeholder: "{str-number}",
- description: "number位随机字符串",
- placeholderB: "{filename}",
- descriptionB: "原文件名"
- }
-];
-const buildInRenameFormatTable = [
- {
- placeholder: "{Y}",
- description: "年份,4位数",
- placeholderB: "{timestamp}",
- descriptionB: "时间戳(毫秒)"
- },
- {
- placeholder: "{y}",
- description: "年份,2位数",
- placeholderB: "{md5}",
- descriptionB: "md5"
- },
- {
- placeholder: "{m}",
- description: "月份(01-12)",
- placeholderB: "{md5-16}",
- descriptionB: "md5前16位"
- },
- {
- placeholder: "{d}",
- description: "日期(01-31)",
- placeholderB: "{localFolder:}",
- descriptionB: "本地文件夹层级"
- },
- {
- placeholder: "{h}",
- description: "小时(00-23)",
- placeholderB: "{uuid}",
- descriptionB: "uuid字符串"
- },
- {
- placeholder: "{i}",
- description: "分钟(00-59)",
- placeholderB: "{filename}",
- descriptionB: "原文件名"
- },
- {
- placeholder: "{s}",
- description: "秒(00-59)",
- placeholderB: "{str-number}",
- descriptionB: "number位随机字符串"
- },
- {
- placeholder: "{ms}",
- description: "毫秒(000-999)"
- }
-];
-export {
- customStrMatch as a,
- formatFileName as b,
- customRenameFormatTable as c,
- formatLink as d,
- customStrReplace as e,
- formatFileSize as f,
- getFileIconPath as g,
- formObjToTableData as h,
- isValidUrl as i,
- buildInRenameFormatTable as j,
- renameFile as r,
- svg as s,
- v4 as v
-};
diff --git a/dist/renderer/assets/constants-BZfYqEeL.js b/dist/renderer/assets/constants-BZfYqEeL.js
deleted file mode 100644
index 908b2bbc..00000000
--- a/dist/renderer/assets/constants-BZfYqEeL.js
+++ /dev/null
@@ -1,1078 +0,0 @@
-import { T } from "./index-BqdcQlNn.js";
-const defaultBaseRule = (name) => {
- return [
- {
- required: true,
- message: `${T("MANAGE_CONSTANT_BASE_RULE")}${name}`,
- trigger: "blur"
- }
- ];
-};
-const itemsPerPageRule = [
- {
- required: true,
- message: T("MANAGE_CONSTANT_ITEMS_PAGE_RULE_MESSAGE_A"),
- trigger: "blur"
- },
- {
- type: "number",
- message: T("MANAGE_CONSTANT_ITEMS_PAGE_RULE_MESSAGE_B"),
- trigger: "change"
- },
- {
- validator: (_rule, value, callback) => {
- if (value < 20 || value > 1e3) {
- callback(new Error(T("MANAGE_CONSTANT_ITEMS_PAGE_RULE_MESSAGE_C")));
- } else {
- callback();
- }
- },
- trigger: "change"
- }
-];
-const aliasRule = [
- {
- required: true,
- message: T("MANAGE_CONSTANT_ALIAS_RULE_MESSAGE_A"),
- trigger: "blur"
- },
- {
- validator: (_rule, value, callback) => {
- const reg = /^[\u4e00-\u9fff_a-zA-Z0-9-]+$/;
- if (!reg.test(value)) {
- callback(new Error(T("MANAGE_CONSTANT_ALIAS_RULE_MESSAGE_B")));
- } else {
- callback();
- }
- },
- trigger: "change"
- }
-];
-const aliasTooltip = T("MANAGE_CONSTANT_ALIAS_TOOLTIP");
-const itemsPerPageTooltip = T("MANAGE_CONSTANT_ITEMS_PAGE_TOOLTIP");
-const pagingTooltip = T("MANAGE_CONSTANT_PAGING_TOOLTIP");
-const bucketNameTooltip = T("MANAGE_CONSTANT_BUCKET_NAME_TOOLTIP");
-const baseDirTooltip = T("MANAGE_CONSTANT_BASE_DIR_TOOLTIP");
-const isAutoCustomUrlTooltip = T("MANAGE_CONSTANT_IS_AUTO_CUSTOM_URL_TOOLTIP");
-const supportedPicBedList = {
- smms: {
- name: "SM.MS",
- icon: "smms",
- configOptions: {
- alias: {
- required: true,
- description: T("MANAGE_CONSTANT_SMMS_ALIAS_DESC"),
- placeholder: T("MANAGE_CONSTANT_SMMS_ALIAS_PLACEHOLDER"),
- type: "string",
- rule: aliasRule,
- default: "smms-A",
- tooltip: aliasTooltip
- },
- token: {
- required: true,
- description: T("MANAGE_CONSTANT_SMMS_TOKEN_DESC"),
- placeholder: T("MANAGE_CONSTANT_SMMS_TOKEN_PLACEHOLDER"),
- type: "string",
- rule: defaultBaseRule("token")
- },
- paging: {
- required: true,
- description: T("MANAGE_CONSTANT_SMMS_PAGING_DESC"),
- default: true,
- type: "boolean",
- tooltip: pagingTooltip
- }
- },
- explain: T("MANAGE_CONSTANT_SMMS_EXPLAIN"),
- options: ["alias", "token", "paging"],
- refLink: "https://piclist.cn/manage.html#smms",
- referenceText: T("MANAGE_CONSTANT_SMMS_REFER_TEXT")
- },
- qiniu: {
- name: T("MANAGE_CONSTANT_QINIU_NAME"),
- icon: "qiniu",
- configOptions: {
- alias: {
- required: true,
- description: T("MANAGE_CONSTANT_QINIU_ALIAS_DESC"),
- placeholder: T("MANAGE_CONSTANT_QINIU_ALIAS_PLACEHOLDER"),
- type: "string",
- rule: aliasRule,
- default: "qiniu-A",
- tooltip: aliasTooltip
- },
- accessKey: {
- required: true,
- description: T("MANAGE_CONSTANT_QINIU_ACCESS_KEY_DESC"),
- placeholder: T("MANAGE_CONSTANT_QINIU_ACCESS_KEY_PLACEHOLDER"),
- type: "string",
- rule: defaultBaseRule("accessKey")
- },
- secretKey: {
- required: true,
- description: T("MANAGE_CONSTANT_QINIU_SECRET_KEY_DESC"),
- placeholder: T("MANAGE_CONSTANT_QINIU_SECRET_KEY_PLACEHOLDER"),
- type: "string",
- rule: defaultBaseRule("secretKey")
- },
- bucketName: {
- required: false,
- description: T("MANAGE_CONSTANT_QINIU_BUCKET_DESC"),
- placeholder: T("MANAGE_CONSTANT_QINIU_BUCKET_PLACEHOLDER"),
- type: "string",
- tooltip: bucketNameTooltip
- },
- baseDir: {
- required: false,
- description: T("MANAGE_CONSTANT_QINIU_BASE_DIR_DESC"),
- placeholder: T("MANAGE_CONSTANT_QINIU_BASE_DIR_PLACEHOLDER"),
- default: "/",
- type: "string",
- tooltip: baseDirTooltip
- },
- isAutoCustomUrl: {
- required: true,
- description: T("MANAGE_CONSTANT_QINIU_IS_AUTO_CUSTOM_URL_DESC"),
- default: true,
- type: "boolean",
- tooltip: isAutoCustomUrlTooltip
- },
- paging: {
- required: true,
- description: T("MANAGE_CONSTANT_QINIU_PAGING_DESC"),
- default: true,
- type: "boolean",
- tooltip: pagingTooltip
- },
- itemsPerPage: {
- required: true,
- description: T("MANAGE_CONSTANT_QINIU_ITEMS_PAGE_DESC"),
- default: 50,
- type: "number",
- rule: itemsPerPageRule,
- tooltip: itemsPerPageTooltip
- }
- },
- explain: T("MANAGE_CONSTANT_QINIU_EXPLAIN"),
- options: ["alias", "accessKey", "secretKey", "bucketName", "baseDir", "isAutoCustomUrl", "paging", "itemsPerPage"],
- refLink: "https://piclist.cn/manage.html#%E4%B8%83%E7%89%9B%E4%BA%91",
- referenceText: T("MANAGE_CONSTANT_QINIU_REFER_TEXT")
- },
- github: {
- name: "GitHub",
- icon: "github",
- configOptions: {
- alias: {
- required: true,
- description: T("MANAGE_CONSTANT_GITHUB_ALIAS_DESC"),
- placeholder: T("MANAGE_CONSTANT_GITHUB_ALIAS_PLACEHOLDER"),
- type: "string",
- rule: aliasRule,
- default: "github-A",
- tooltip: aliasTooltip
- },
- token: {
- required: true,
- description: T("MANAGE_CONSTANT_GITHUB_TOKEN_DESC"),
- placeholder: T("MANAGE_CONSTANT_GITHUB_TOKEN_PLACEHOLDER"),
- type: "string",
- rule: defaultBaseRule("token"),
- tooltip: T("MANAGE_CONSTANT_GITHUB_TOKEN_TIPS")
- },
- githubUsername: {
- required: true,
- description: T("MANAGE_CONSTANT_GITHUB_USER_DESC"),
- placeholder: T("MANAGE_CONSTANT_GITHUB_USER_PLACEHOLDER"),
- type: "string",
- rule: defaultBaseRule(T("MANAGE_CONSTANT_GITHUB_USER_RULE_MESSAGE"))
- },
- proxy: {
- required: false,
- description: T("MANAGE_CONSTANT_GITHUB_PROXY_DESC"),
- placeholder: T("MANAGE_CONSTANT_GITHUB_PROXY_PLACEHOLDER"),
- type: "string",
- tooltip: T("MANAGE_CONSTANT_GITHUB_PROXY_TIPS")
- },
- paging: {
- required: true,
- description: T("MANAGE_CONSTANT_GITHUB_PAGING_DESC"),
- default: false,
- type: "boolean",
- tooltip: pagingTooltip
- },
- customUrl: {
- required: false,
- description: T("MANAGE_CONSTANT_GITHUB_CUSTOM_URL_DESC"),
- placeholder: T("MANAGE_CONSTANT_GITHUB_CUSTOM_URL_PLACEHOLDER"),
- type: "string",
- tooltip: T("MANAGE_CONSTANT_GITHUB_CUSTOM_URL_TIPS"),
- rule: [
- {
- validator: (_rule, value, callback) => {
- if (value) {
- const customUrlList = value.split(",");
- const customUrlValid = customUrlList.every((customUrl) => {
- const reg = /^((https|http)?:\/\/)/;
- if (customUrl === "") {
- return true;
- } else if (!reg.test(customUrl)) {
- return false;
- }
- return true;
- });
- const isBracketsValid = customUrlList.every((customUrl) => {
- const bracketPaired = (str) => {
- const stack = [];
- for (const i of str) {
- if (i === "{") {
- stack.push(i);
- } else if (i === "}") {
- if (stack.length === 0) {
- return false;
- }
- stack.pop();
- }
- }
- return stack.length === 0;
- };
- if (customUrl === "") {
- return true;
- } else if (!bracketPaired(customUrl)) {
- return false;
- }
- return true;
- });
- if (!customUrlValid) {
- callback(new Error(T("MANAGE_CONSTANT_GITHUB_CUSTOM_URL_RULE_MESSAGE_A")));
- } else if (!isBracketsValid) {
- callback(new Error(T("MANAGE_CONSTANT_GITHUB_CUSTOM_URL_RULE_MESSAGE_B")));
- } else {
- callback();
- }
- } else {
- callback();
- }
- },
- trigger: "change"
- }
- ]
- }
- },
- explain: T("MANAGE_CONSTANT_GITHUB_EXPLAIN"),
- options: ["alias", "token", "githubUsername", "proxy", "customUrl"],
- refLink: "https://piclist.cn/manage.html#github",
- referenceText: T("MANAGE_CONSTANT_GITHUB_REFER_TEXT")
- },
- aliyun: {
- name: T("MANAGE_CONSTANT_ALIYUN_NAME"),
- icon: "aliyun",
- configOptions: {
- alias: {
- required: true,
- description: T("MANAGE_CONSTANT_ALIYUN_ALIAS_DESC"),
- placeholder: T("MANAGE_CONSTANT_ALIYUN_ALIAS_PLACEHOLDER"),
- type: "string",
- rule: aliasRule,
- default: "aliyun-A",
- tooltip: aliasTooltip
- },
- accessKeyId: {
- required: true,
- description: T("MANAGE_CONSTANT_ALIYUN_ACCESS_KEY_ID_DESC"),
- placeholder: "请输入accessKeyId",
- type: "string",
- rule: defaultBaseRule("accessKeyId")
- },
- accessKeySecret: {
- required: true,
- description: T("MANAGE_CONSTANT_ALIYUN_ACCESS_KEY_SECRET_DESC"),
- placeholder: T("MANAGE_CONSTANT_ALIYUN_ACCESS_KEY_SECRET_PLACEHOLDER"),
- type: "string",
- rule: defaultBaseRule("accessKeySecret")
- },
- bucketName: {
- required: false,
- description: T("MANAGE_CONSTANT_ALIYUN_BUCKET_DESC"),
- placeholder: T("MANAGE_CONSTANT_ALIYUN_BUCKET_PLACEHOLDER"),
- type: "string",
- tooltip: bucketNameTooltip
- },
- baseDir: {
- required: false,
- description: T("MANAGE_CONSTANT_ALIYUN_BASE_DIR_DESC"),
- placeholder: T("MANAGE_CONSTANT_ALIYUN_BASE_DIR_PLACEHOLDER"),
- type: "string",
- default: "/",
- tooltip: baseDirTooltip
- },
- isAutoCustomUrl: {
- required: true,
- description: T("MANAGE_CONSTANT_ALIYUN_IS_AUTO_CUSTOM_URL_DESC"),
- default: true,
- type: "boolean",
- tooltip: isAutoCustomUrlTooltip
- },
- paging: {
- required: true,
- description: T("MANAGE_CONSTANT_ALIYUN_PAGING_DESC"),
- default: true,
- type: "boolean",
- tooltip: pagingTooltip
- },
- itemsPerPage: {
- required: true,
- description: T("MANAGE_CONSTANT_ALIYUN_ITEMS_PAGE_DESC"),
- default: 50,
- type: "number",
- rule: itemsPerPageRule,
- tooltip: itemsPerPageTooltip
- }
- },
- explain: T("MANAGE_CONSTANT_ALIYUN_EXPLAIN"),
- options: [
- "alias",
- "accessKeyId",
- "accessKeySecret",
- "bucketName",
- "baseDir",
- "isAutoCustomUrl",
- "paging",
- "itemsPerPage"
- ],
- refLink: "https://piclist.cn/manage.html#%E9%98%BF%E9%87%8C%E4%BA%91oss",
- referenceText: T("MANAGE_CONSTANT_ALIYUN_REFER_TEXT")
- },
- tcyun: {
- name: T("MANAGE_CONSTANT_TENCENT_NAME"),
- icon: "tcyun",
- configOptions: {
- alias: {
- required: true,
- description: T("MANAGE_CONSTANT_TENCENT_ALIAS_DESC"),
- placeholder: T("MANAGE_CONSTANT_TENCENT_ALIAS_PLACEHOLDER"),
- type: "string",
- rule: aliasRule,
- default: "tcyun-A",
- tooltip: aliasTooltip
- },
- secretId: {
- required: true,
- description: T("MANAGE_CONSTANT_TENCENT_SECRET_ID_DESC"),
- placeholder: T("MANAGE_CONSTANT_TENCENT_SECRET_ID_PLACEHOLDER"),
- type: "string",
- rule: defaultBaseRule("secretId")
- },
- secretKey: {
- required: true,
- description: T("MANAGE_CONSTANT_TENCENT_SECRET_KEY_DESC"),
- placeholder: T("MANAGE_CONSTANT_TENCENT_SECRET_KEY_PLACEHOLDER"),
- type: "string",
- rule: defaultBaseRule("secretKey")
- },
- appId: {
- required: true,
- description: T("MANAGE_CONSTANT_TENCENT_APPID_DESC"),
- placeholder: T("MANAGE_CONSTANT_TENCENT_APPID_PLACEHOLDER"),
- type: "string",
- rule: defaultBaseRule("appId"),
- tooltip: T("MANAGE_CONSTANT_TENCENT_APPID_TOOLTIP")
- },
- bucketName: {
- required: false,
- description: T("MANAGE_CONSTANT_TENCENT_BUCKET_DESC"),
- placeholder: T("MANAGE_CONSTANT_TENCENT_BUCKET_PLACEHOLDER"),
- type: "string",
- tooltip: bucketNameTooltip
- },
- baseDir: {
- required: false,
- description: T("MANAGE_CONSTANT_TENCENT_BASE_DIR_DESC"),
- placeholder: T("MANAGE_CONSTANT_TENCENT_BASE_DIR_PLACEHOLDER"),
- type: "string",
- default: "/",
- tooltip: baseDirTooltip
- },
- isAutoCustomUrl: {
- required: true,
- description: T("MANAGE_CONSTANT_TENCENT_IS_AUTO_CUSTOM_URL_DESC"),
- default: true,
- type: "boolean",
- tooltip: isAutoCustomUrlTooltip
- },
- paging: {
- required: true,
- description: T("MANAGE_CONSTANT_TENCENT_PAGING_DESC"),
- default: true,
- type: "boolean",
- tooltip: pagingTooltip
- },
- itemsPerPage: {
- required: true,
- description: T("MANAGE_CONSTANT_TENCENT_ITEMS_PAGE_DESC"),
- default: 50,
- type: "number",
- rule: itemsPerPageRule,
- tooltip: itemsPerPageTooltip
- }
- },
- explain: T("MANAGE_CONSTANT_TENCENT_EXPLAIN"),
- options: [
- "alias",
- "secretId",
- "secretKey",
- "appId",
- "bucketName",
- "baseDir",
- "isAutoCustomUrl",
- "paging",
- "itemsPerPage"
- ],
- refLink: "https://piclist.cn/manage.html#%E8%85%BE%E8%AE%AF%E4%BA%91",
- referenceText: T("MANAGE_CONSTANT_TENCENT_REFER_TEXT")
- },
- upyun: {
- name: T("MANAGE_CONSTANT_UPYUN_NAME"),
- icon: "upyun",
- configOptions: {
- alias: {
- required: true,
- description: T("MANAGE_CONSTANT_UPYUN_ALIAS_DESC"),
- placeholder: T("MANAGE_CONSTANT_UPYUN_ALIAS_PLACEHOLDER"),
- type: "string",
- rule: aliasRule,
- default: "upyun-A",
- tooltip: aliasTooltip
- },
- bucketName: {
- required: true,
- description: T("MANAGE_CONSTANT_UPYUN_BUCKET_DESC"),
- placeholder: T("MANAGE_CONSTANT_UPYUN_BUCKET_PLACEHOLDER"),
- type: "string",
- rule: defaultBaseRule("bucketName")
- },
- operator: {
- required: true,
- description: T("MANAGE_CONSTANT_UPYUN_OPERATOR_NAME_DESC"),
- placeholder: T("MANAGE_CONSTANT_UPYUN_OPERATOR_NAME_PLACEHOLDER"),
- type: "string",
- rule: defaultBaseRule(T("MANAGE_CONSTANT_UPYUN_OPERATOR_NAME_RULE"))
- },
- password: {
- required: true,
- description: T("MANAGE_CONSTANT_UPYUN_OPERATOR_PWD_DESC"),
- placeholder: T("MANAGE_CONSTANT_UPYUN_OPERATOR_PWD_PLACEHOLDER"),
- type: "string",
- rule: defaultBaseRule(T("MANAGE_CONSTANT_UPYUN_OPERATOR_PWD_RULE"))
- },
- baseDir: {
- required: false,
- description: T("MANAGE_CONSTANT_UPYUN_BASE_DIR_DESC"),
- placeholder: T("MANAGE_CONSTANT_UPYUN_BASE_DIR_PLACEHOLDER"),
- type: "string",
- default: "/"
- },
- customUrl: {
- required: true,
- description: T("MANAGE_CONSTANT_UPYUN_IS_AUTO_CUSTOM_URL_DESC"),
- placeholder: T("MANAGE_CONSTANT_UPYUN_IS_AUTO_CUSTOM_URL_PLACEHOLDER"),
- type: "string",
- rule: [
- {
- required: true,
- message: T("MANAGE_CONSTANT_UPYUN_IS_AUTO_CUSTOM_URL_RULE_MESSAGE_A"),
- trigger: "change"
- },
- {
- validator: (_rule, value, callback) => {
- if (value) {
- const customUrlList = value.split(",");
- const customUrlValid = customUrlList.every((customUrl) => {
- const reg = /^((https|http)?:\/\/)/;
- if (customUrl === "") {
- return true;
- } else if (!reg.test(customUrl)) {
- return false;
- }
- return true;
- });
- if (!customUrlValid) {
- callback(new Error(T("MANAGE_CONSTANT_UPYUN_IS_AUTO_CUSTOM_URL_RULE_MESSAGE_B")));
- } else {
- callback();
- }
- } else {
- callback();
- }
- },
- trigger: "change"
- }
- ]
- },
- antiLeechToken: {
- required: false,
- description: T("MANAGE_CONSTANT_UPYUN_ANTI_LEECH_TOKEN_DESC"),
- placeholder: T("MANAGE_CONSTANT_UPYUN_ANTI_LEECH_TOKEN_PLACEHOLDER"),
- type: "string",
- default: "",
- tooltip: T("MANAGE_CONSTANT_UPYUN_ANTI_LEECH_TOKEN_TOOLTIP")
- },
- expireTime: {
- required: false,
- description: T("MANAGE_CONSTANT_UPYUN_EXPIRE_TIME_DESC"),
- type: "number",
- default: 0
- },
- paging: {
- required: true,
- description: T("MANAGE_CONSTANT_UPYUN_PAGING"),
- default: true,
- type: "boolean",
- tooltip: pagingTooltip
- },
- itemsPerPage: {
- required: true,
- description: T("MANAGE_CONSTANT_UPYUN_ITEMS_PAGE"),
- default: 50,
- type: "number",
- rule: itemsPerPageRule,
- tooltip: itemsPerPageTooltip
- }
- },
- explain: T("MANAGE_CONSTANT_UPYUN_EXPLAIN"),
- options: [
- "alias",
- "bucketName",
- "operator",
- "password",
- "baseDir",
- "customUrl",
- "paging",
- "itemsPerPage",
- "antiLeechToken",
- "expireTime"
- ],
- refLink: "https://piclist.cn/manage.html#%E5%8F%88%E6%8B%8D%E4%BA%91",
- referenceText: T("MANAGE_CONSTANT_UPYUN_REFER_TEXT")
- },
- imgur: {
- name: T("MANAGE_CONSTANT_IMGUR_NAME"),
- icon: "imgur",
- configOptions: {
- alias: {
- required: true,
- description: T("MANAGE_CONSTANT_IMGUR_ALIAS_DESC"),
- placeholder: T("MANAGE_CONSTANT_IMGUR_ALIAS_PLACEHOLDER"),
- type: "string",
- rule: aliasRule,
- default: "imgur-A"
- },
- imgurUserName: {
- required: true,
- description: T("MANAGE_CONSTANT_IMGUR_USERNAME_DESC"),
- placeholder: T("MANAGE_CONSTANT_IMGUR_USERNAME_PLACEHOLDER"),
- type: "string",
- rule: defaultBaseRule("imgurUserName")
- },
- accessToken: {
- required: true,
- description: T("MANAGE_CONSTANT_IMGUR_ACCESS_TOKEN_DESC"),
- placeholder: T("MANAGE_CONSTANT_IMGUR_ACCESS_TOKEN_PLACEHOLDER"),
- type: "string",
- rule: defaultBaseRule("accessToken"),
- tooltip: T("MANAGE_CONSTANT_IMGUR_ACCESS_TOKEN_TOOLTIP")
- },
- proxy: {
- required: false,
- description: T("MANAGE_CONSTANT_IMGUR_PROXY_DESC"),
- placeholder: T("MANAGE_CONSTANT_IMGUR_PROXY_PLACEHOLDER"),
- type: "string",
- tooltip: T("MANAGE_CONSTANT_IMGUR_PROXY_TOOLTIP")
- }
- },
- explain: T("MANAGE_CONSTANT_IMGUR_EXPLAIN"),
- options: ["alias", "imgurUserName", "accessToken", "proxy"],
- refLink: "https://piclist.cn/manage.html#imgur",
- referenceText: T("MANAGE_CONSTANT_IMGUR_REFER_TEXT")
- },
- s3plist: {
- name: T("MANAGE_CONSTANT_S3_NAME"),
- icon: "s3plist",
- configOptions: {
- alias: {
- required: true,
- description: T("MANAGE_CONSTANT_S3_ALIAS_DESC"),
- placeholder: T("MANAGE_CONSTANT_S3_ALIAS_PLACEHOLDER"),
- type: "string",
- rule: aliasRule,
- default: "s3plist-A",
- tooltip: aliasTooltip
- },
- accessKeyId: {
- required: true,
- description: T("MANAGE_CONSTANT_S3_ACCESS_KEY_ID_DESC"),
- placeholder: T("MANAGE_CONSTANT_S3_ACCESS_KEY_ID_PLACEHOLDER"),
- type: "string",
- rule: defaultBaseRule("accessKeyId")
- },
- secretAccessKey: {
- required: true,
- description: T("MANAGE_CONSTANT_S3_SECRET_ACCESS_KEY_DESC"),
- placeholder: T("MANAGE_CONSTANT_S3_SECRET_ACCESS_KEY_PLACEHOLDER"),
- type: "string",
- rule: defaultBaseRule("secretAccessKey")
- },
- endpoint: {
- required: false,
- description: T("MANAGE_CONSTANT_S3_ENDPOINT_DESC"),
- placeholder: T("MANAGE_CONSTANT_S3_ENDPOINT_PLACEHOLDER"),
- type: "string",
- tooltip: T("MANAGE_CONSTANT_S3_ENDPOINT_TOOLTIP")
- },
- sslEnabled: {
- required: true,
- description: T("MANAGE_CONSTANT_S3_SSLENABLED_DESC"),
- default: true,
- type: "boolean",
- tooltip: T("MANAGE_CONSTANT_S3_SSLENABLED_TOOLTIP")
- },
- s3ForcePathStyle: {
- required: true,
- description: T("MANAGE_CONSTANT_S3_FORCE_PATH_STYLE_DESC"),
- default: false,
- type: "boolean",
- tooltip: T("MANAGE_CONSTANT_S3_FORCE_PATH_STYLE_TOOLTIP")
- },
- proxy: {
- required: false,
- description: T("MANAGE_CONSTANT_S3_PROXY_DESC"),
- placeholder: T("MANAGE_CONSTANT_S3_PROXY_PLACEHOLDER"),
- type: "string",
- tooltip: T("MANAGE_CONSTANT_S3_PROXY_TOOLTIP")
- },
- aclForUpload: {
- required: true,
- description: T("MANAGE_CONSTANT_S3_ACL_FOR_UPLOAD_DESC"),
- rule: defaultBaseRule("aclForUpload"),
- default: "public-read",
- type: "select",
- selectOptions: {
- private: T("MANAGE_CONSTANT_S3_ACL_FOR_UPLOAD_OPTIONS_PRIVATE"),
- "public-read": T("MANAGE_CONSTANT_S3_ACL_FOR_UPLOAD_OPTIONS_PUBLIC_READ"),
- "public-read-write": T("MANAGE_CONSTANT_S3_ACL_FOR_UPLOAD_OPTIONS_PUBLIC_READ_WRITE"),
- "authenticated-read": T("MANAGE_CONSTANT_S3_ACL_FOR_UPLOAD_OPTIONS_AUTHENTICATED_READ"),
- "bucket-owner-read": T("MANAGE_CONSTANT_S3_ACL_FOR_UPLOAD_OPTIONS_BUCKET_OWNER_READ"),
- "bucket-owner-full-control": T("MANAGE_CONSTANT_S3_ACL_FOR_UPLOAD_OPTIONS_BUCKET_OWNER_FULL_CONTROL"),
- "aws-exec-read": T("MANAGE_CONSTANT_S3_ACL_FOR_UPLOAD_OPTIONS_AWS_EXEC_READ")
- },
- tooltip: T("MANAGE_CONSTANT_S3_ACL_FOR_UPLOAD_TOOLTIP")
- },
- bucketName: {
- required: false,
- description: T("MANAGE_CONSTANT_S3_BUCKET_DESC"),
- placeholder: T("MANAGE_CONSTANT_S3_BUCKET_PLACEHOLDER"),
- type: "string",
- tooltip: bucketNameTooltip
- },
- baseDir: {
- required: false,
- description: T("MANAGE_CONSTANT_S3_BASE_DIR_DESC"),
- placeholder: T("MANAGE_CONSTANT_S3_BASE_DIR_PLACEHOLDER"),
- type: "string",
- default: "/",
- tooltip: baseDirTooltip
- },
- dogeCloudSupport: {
- required: false,
- description: T("MANAGE_CONSTANT_S3_DOGE_CLOUD_SUPPORT_DESC"),
- default: false,
- type: "boolean",
- tooltip: T("MANAGE_CONSTANT_S3_DOGE_CLOUD_SUPPORT_TOOLTIP")
- },
- paging: {
- required: true,
- description: T("MANAGE_CONSTANT_S3_PAGING_DESC"),
- default: true,
- type: "boolean",
- tooltip: pagingTooltip
- },
- itemsPerPage: {
- required: true,
- description: T("MANAGE_CONSTANT_S3_ITEMS_PAGE_DESC"),
- default: 50,
- type: "number",
- rule: itemsPerPageRule,
- tooltip: itemsPerPageTooltip
- }
- },
- explain: T("MANAGE_CONSTANT_S3_EXPLAIN"),
- options: [
- "alias",
- "accessKeyId",
- "secretAccessKey",
- "endpoint",
- "sslEnabled",
- "s3ForcePathStyle",
- "proxy",
- "aclForUpload",
- "bucketName",
- "baseDir",
- "dogeCloudSupport",
- "paging",
- "itemsPerPage"
- ],
- refLink: "https://piclist.cn/manage.html#s3",
- referenceText: T("MANAGE_CONSTANT_S3_REFER_TEXT")
- },
- webdavplist: {
- name: "WebDAV",
- icon: "webdavplist",
- configOptions: {
- alias: {
- required: true,
- description: T("MANAGE_CONSTANT_WEBDAV_ALIAS_DESC"),
- placeholder: T("MANAGE_CONSTANT_WEBDAV_ALIAS_PLACEHOLDER"),
- type: "string",
- rule: aliasRule,
- default: "webdavplist-A",
- tooltip: aliasTooltip
- },
- endpoint: {
- required: true,
- description: T("MANAGE_CONSTANT_WEBDAV_HOST_DESC"),
- placeholder: T("MANAGE_CONSTANT_WEBDAV_HOST_PLACEHOLDER"),
- type: "string",
- rule: defaultBaseRule("rootDomain"),
- tooltip: T("MANAGE_CONSTANT_WEBDAV_HOST_TOOLTIP")
- },
- username: {
- required: true,
- description: T("MANAGE_CONSTANT_WEBDAV_USERNAME_DESC"),
- placeholder: T("MANAGE_CONSTANT_WEBDAV_USERNAME_PLACEHOLDER"),
- type: "string",
- rule: defaultBaseRule("username")
- },
- bucketName: {
- required: true,
- description: T("MANAGE_CONSTANT_WEBDAV_BUCKET_DESC"),
- placeholder: T("MANAGE_CONSTANT_WEBDAV_BUCKET_PLACEHOLDER"),
- type: "string",
- default: "webdav",
- disabled: true,
- tooltip: T("MANAGE_CONSTANT_WEBDAV_BUCKET_TOOLTIP")
- },
- password: {
- required: true,
- description: T("MANAGE_CONSTANT_WEBDAV_PASSWORD_DESC"),
- placeholder: T("MANAGE_CONSTANT_WEBDAV_PASSWORD_PLACEHOLDER"),
- type: "string",
- rule: defaultBaseRule("password")
- },
- baseDir: {
- required: false,
- description: T("MANAGE_CONSTANT_WEBDAV_BASE_DIR_DESC"),
- placeholder: T("MANAGE_CONSTANT_WEBDAV_BASE_DIR_PLACEHOLDER"),
- type: "string",
- default: "/"
- },
- customUrl: {
- required: false,
- description: T("MANAGE_CONSTANT_WEBDAV_CUSTOM_URL_DESC"),
- placeholder: T("MANAGE_CONSTANT_WEBDAV_CUSTOM_URL_PLACEHOLDER"),
- type: "string",
- tooltip: T("MANAGE_CONSTANT_WEBDAV_CUSTOM_URL_TOOLTIP"),
- rule: [
- {
- validator: (_rule, value, callback) => {
- if (value) {
- if (!/^https?:\/\/.+/.test(value)) {
- callback(new Error(T("MANAGE_CONSTANT_WEBDAV_CUSTOM_URL_RULE_MESSAGE")));
- } else {
- callback();
- }
- } else {
- callback();
- }
- },
- trigger: "change"
- }
- ]
- },
- webPath: {
- required: false,
- description: T("MANAGE_CONSTANT_WEBDAV_WEB_PATH"),
- placeholder: T("MANAGE_CONSTANT_WEBDAV_WEB_PATH_PLACEHOLDER"),
- type: "string",
- tooltip: T("MANAGE_CONSTANT_WEBDAV_WEB_PATH_TOOLTIP"),
- default: ""
- },
- proxy: {
- required: false,
- description: T("MANAGE_CONSTANT_WEBDAV_PROXY_DESC"),
- placeholder: T("MANAGE_CONSTANT_WEBDAV_PROXY_PLACEHOLDER"),
- type: "string",
- tooltip: T("MANAGE_CONSTANT_WEBDAV_PROXY_TOOLTIP")
- },
- sslEnabled: {
- required: true,
- description: T("MANAGE_CONSTANT_WEBDAV_SSL_DESC"),
- default: true,
- type: "boolean",
- tooltip: T("MANAGE_CONSTANT_WEBDAV_SSL_TOOLTIP")
- },
- authType: {
- required: true,
- description: T("MANAGE_CONSTANT_WEBDAV_AUTH_TYPE_DESC"),
- default: "basic",
- type: "select",
- selectOptions: {
- basic: "Basic",
- digest: "Digest"
- }
- }
- },
- explain: T("MANAGE_CONSTANT_WEBDAV_EXPLAIN"),
- options: [
- "alias",
- "endpoint",
- "username",
- "password",
- "bucketName",
- "baseDir",
- "customUrl",
- "webPath",
- "proxy",
- "sslEnabled",
- "authType"
- ],
- refLink: "https://piclist.cn/manage.html#webdav",
- referenceText: T("MANAGE_CONSTANT_WEBDAV_REFER_TEXT")
- },
- local: {
- name: T("MANAGE_CONSTANT_LOCAL_NAME"),
- icon: "local",
- configOptions: {
- alias: {
- required: true,
- description: T("MANAGE_CONSTANT_LOCAL_ALIAS_DESC"),
- placeholder: T("MANAGE_CONSTANT_LOCAL_ALIAS_PLACEHOLDER"),
- type: "string",
- rule: aliasRule,
- default: "local-A",
- tooltip: aliasTooltip
- },
- baseDir: {
- required: true,
- description: T("MANAGE_CONSTANT_LOCAL_BASE_DIR_DESC"),
- placeholder: T("MANAGE_CONSTANT_LOCAL_BASE_DIR_PLACEHOLDER"),
- type: "string",
- default: "",
- rule: [
- {
- validator: (_rule, value, callback) => {
- if (!value) {
- callback(new Error(T("MANAGE_CONSTANT_LOCAL_BASE_DIR_RULE_MESSAGE")));
- } else {
- callback();
- }
- }
- }
- ]
- },
- customUrl: {
- required: false,
- description: T("MANAGE_CONSTANT_LOCAL_CUSTOM_URL_DESC"),
- placeholder: T("MANAGE_CONSTANT_LOCAL_CUSTOM_URL_PLACEHOLDER"),
- type: "string",
- tooltip: T("MANAGE_CONSTANT_LOCAL_CUSTOM_URL_TOOLTIP"),
- rule: [
- {
- validator: (_rule, value, callback) => {
- if (value) {
- if (!/^https?:\/\/.+/.test(value)) {
- callback(new Error(T("MANAGE_CONSTANT_WEBDAV_CUSTOM_URL_RULE_MESSAGE")));
- } else {
- callback();
- }
- } else {
- callback();
- }
- },
- trigger: "change"
- }
- ]
- },
- bucketName: {
- required: true,
- description: T("MANAGE_CONSTANT_LOCAL_BUCKET_DESC"),
- placeholder: T("MANAGE_CONSTANT_LOCAL_BUCKET_PLACEHOLDER"),
- type: "string",
- default: "local",
- disabled: true,
- tooltip: T("MANAGE_CONSTANT_LOCAL_BUCKET_TOOLTIP")
- },
- webPath: {
- required: false,
- description: T("MANAGE_CONSTANT_LOCAL_WEB_PATH"),
- placeholder: T("MANAGE_CONSTANT_LOCAL_WEB_PATH_PLACEHOLDER"),
- type: "string",
- tooltip: T("MANAGE_CONSTANT_LOCAL_WEB_PATH_TOOLTIP"),
- default: ""
- }
- },
- explain: T("MANAGE_CONSTANT_LOCAL_EXPLAIN"),
- options: ["alias", "baseDir", "customUrl", "bucketName", "webPath"],
- refLink: "https://piclist.cn/manage.html#%E6%9C%AC%E5%9C%B0%E5%AD%98%E5%82%A8",
- referenceText: T("MANAGE_CONSTANT_LOCAL_REFER_TEXT")
- },
- sftp: {
- name: T("MANAGE_CONSTANT_SFTP_NAME"),
- icon: "sftp",
- configOptions: {
- alias: {
- required: true,
- description: T("MANAGE_CONSTANT_SFTP_ALIAS_DESC"),
- placeholder: T("MANAGE_CONSTANT_SFTP_ALIAS_PLACEHOLDER"),
- type: "string",
- rule: aliasRule,
- default: "sftp-A",
- tooltip: aliasTooltip
- },
- host: {
- required: true,
- description: T("MANAGE_CONSTANT_SFTP_HOST_DESC"),
- placeholder: T("MANAGE_CONSTANT_SFTP_HOST_PLACEHOLDER"),
- type: "string",
- rule: defaultBaseRule("host"),
- default: ""
- },
- port: {
- required: false,
- description: T("MANAGE_CONSTANT_SFTP_PORT_DESC"),
- placeholder: T("MANAGE_CONSTANT_SFTP_PORT_PLACEHOLDER"),
- type: "number",
- default: 22
- },
- username: {
- required: false,
- description: T("MANAGE_CONSTANT_SFTP_USERNAME_DESC"),
- placeholder: T("MANAGE_CONSTANT_SFTP_USERNAME_PLACEHOLDER"),
- type: "string",
- default: ""
- },
- password: {
- required: false,
- description: T("MANAGE_CONSTANT_SFTP_PASSWORD_DESC"),
- placeholder: T("MANAGE_CONSTANT_SFTP_PASSWORD_PLACEHOLDER"),
- type: "string",
- default: ""
- },
- privateKey: {
- required: false,
- description: T("MANAGE_CONSTANT_SFTP_PRIVATE_KEY_DESC"),
- placeholder: T("MANAGE_CONSTANT_SFTP_PRIVATE_KEY_PLACEHOLDER"),
- type: "string",
- default: ""
- },
- passphrase: {
- required: false,
- description: T("MANAGE_CONSTANT_SFTP_PASSPHRASE_DESC"),
- placeholder: T("MANAGE_CONSTANT_SFTP_PASSPHRASE_PLACEHOLDER"),
- type: "string",
- default: ""
- },
- fileMode: {
- required: false,
- description: T("MANAGE_CONSTANT_SFTP_FILE_PERMISSIONS_DESC"),
- placeholder: T("MANAGE_CONSTANT_SFTP_FILE_PERMISSIONS_PLACEHOLDER"),
- type: "string",
- default: "0664"
- },
- dirMode: {
- required: false,
- description: T("MANAGE_CONSTANT_SFTP_DIR_PERMISSIONS_DESC"),
- placeholder: T("MANAGE_CONSTANT_SFTP_DIR_PERMISSIONS_PLACEHOLDER"),
- type: "string",
- default: "0755"
- },
- baseDir: {
- required: false,
- description: T("MANAGE_CONSTANT_SFTP_BASE_DIR_DESC"),
- placeholder: T("MANAGE_CONSTANT_SFTP_BASE_DIR_PLACEHOLDER"),
- type: "string",
- default: "",
- rule: [
- {
- validator: (_rule, value, callback) => {
- if (!value) {
- callback(new Error(T("MANAGE_CONSTANT_SFTP_BASE_DIR_RULE_MESSAGE")));
- } else {
- callback();
- }
- }
- }
- ]
- },
- customUrl: {
- required: false,
- description: T("MANAGE_CONSTANT_SFTP_CUSTOM_URL_DESC"),
- placeholder: T("MANAGE_CONSTANT_SFTP_CUSTOM_URL_PLACEHOLDER"),
- type: "string",
- tooltip: T("MANAGE_CONSTANT_SFTP_CUSTOM_URL_TOOLTIP"),
- rule: [
- {
- validator: (_rule, value, callback) => {
- if (value) {
- if (!/^https?:\/\/.+/.test(value)) {
- callback(new Error(T("MANAGE_CONSTANT_WEBDAV_CUSTOM_URL_RULE_MESSAGE")));
- } else {
- callback();
- }
- } else {
- callback();
- }
- },
- trigger: "change"
- }
- ]
- },
- bucketName: {
- required: true,
- description: T("MANAGE_CONSTANT_SFTP_BUCKET_DESC"),
- placeholder: T("MANAGE_CONSTANT_SFTP_BUCKET_PLACEHOLDER"),
- type: "string",
- default: "sftp",
- disabled: true,
- tooltip: T("MANAGE_CONSTANT_SFTP_BUCKET_TOOLTIP")
- },
- webPath: {
- required: false,
- description: T("MANAGE_CONSTANT_SFTP_WEB_PATH"),
- placeholder: T("MANAGE_CONSTANT_SFTP_WEB_PATH_PLACEHOLDER"),
- type: "string",
- tooltip: T("MANAGE_CONSTANT_SFTP_WEB_PATH_TOOLTIP"),
- default: ""
- }
- },
- explain: T("MANAGE_CONSTANT_SFTP_EXPLAIN"),
- options: [
- "alias",
- "host",
- "port",
- "username",
- "password",
- "privateKey",
- "passphrase",
- "fileMode",
- "dirMode",
- "baseDir",
- "customUrl",
- "bucketName",
- "webPath"
- ],
- refLink: "https://piclist.cn/manage.html#sftp",
- referenceText: T("MANAGE_CONSTANT_SFTP_REFER_TEXT")
- }
-};
-export {
- supportedPicBedList as s
-};
diff --git a/dist/renderer/assets/dataSender-Bg45AIFL.js b/dist/renderer/assets/dataSender-Bg45AIFL.js
deleted file mode 100644
index 95d63a1c..00000000
--- a/dist/renderer/assets/dataSender-Bg45AIFL.js
+++ /dev/null
@@ -1,16 +0,0 @@
-import { m as triggerRPC, j as IRPCActionType, s as sendRPC } from "./index-BqdcQlNn.js";
-function saveConfig(config, value) {
- const configObj = typeof config === "string" ? { [config]: value } : config;
- sendRPC(IRPCActionType.MANAGE_SAVE_CONFIG, configObj);
-}
-async function getConfig(key) {
- return await triggerRPC(IRPCActionType.MANAGE_GET_CONFIG, key);
-}
-function removeConfig(key, propName) {
- sendRPC(IRPCActionType.MANAGE_REMOVE_CONFIG, key, propName);
-}
-export {
- getConfig as g,
- removeConfig as r,
- saveConfig as s
-};
diff --git a/dist/renderer/assets/index-1NKI9aE3.js b/dist/renderer/assets/index-1NKI9aE3.js
deleted file mode 100644
index 4b11d35d..00000000
--- a/dist/renderer/assets/index-1NKI9aE3.js
+++ /dev/null
@@ -1,480 +0,0 @@
-import { d as defineComponent, r as ref, a as reactive, D as watch, b0 as toRefs, c as createElementBlock, e as openBlock, n as normalizeClass, q as createVNode, y as resolveComponent, v as withCtx, b1 as renderSlot, u as unref, T, F as Fragment, h as renderList, N as createBlock, g as createCommentVNode, B as createTextVNode, t as toDisplayString, a8 as info_filled_default, f as createBaseVNode, al as useRoute, b2 as cloneDeep, b3 as union, k as getConfig, o as onBeforeMount, m as triggerRPC, j as IRPCActionType, a7 as link_default, aK as ElDropdown, Q as useRouter, b4 as dayjs, p as configPaths, ad as II18nLanguage, s as sendRPC, J as ElMessage } from "./index-BqdcQlNn.js";
-import { d } from "./marked.esm-D58Rgktj.js";
-import { p as picBedManualUrlList } from "./static-DltyNkMh.js";
-const _hoisted_1$1 = ["innerHTML"];
-const _sfc_main$1 = /* @__PURE__ */ defineComponent({
- __name: "ConfigForm",
- props: {
- config: {},
- type: {},
- id: {},
- colorMode: {}
- },
- setup(__props, { expose: __expose }) {
- const props = __props;
- const $route = useRoute();
- const $form = ref();
- const configList = ref([]);
- const ruleForm = reactive({});
- watch(
- toRefs(props.config),
- (val) => {
- handleConfigChange(val);
- },
- {
- deep: true,
- immediate: true
- }
- );
- function handleConfigChange(val) {
- handleConfig(val);
- }
- async function validate() {
- return new Promise((resolve) => {
- $form.value?.validate((valid) => {
- if (valid) {
- resolve(ruleForm);
- } else {
- resolve(false);
- }
- });
- });
- }
- function transformMarkdownToHTML(markdown) {
- try {
- return d.parse(markdown);
- } catch (e) {
- return markdown;
- }
- }
- function getConfigType() {
- switch (props.type) {
- case "plugin": {
- return props.id;
- }
- case "uploader": {
- return `picBed.${props.id}`;
- }
- case "transformer": {
- return `transformer.${props.id}`;
- }
- default:
- return "unknown";
- }
- }
- async function handleConfig(val) {
- const config = await getCurConfigFormData();
- const configId = $route.params.configId;
- Object.assign(ruleForm, config);
- if (val.length > 0) {
- configList.value = cloneDeep(val).map((item) => {
- if (!configId) return item;
- let defaultValue = item.default !== void 0 ? item.default : item.type === "checkbox" ? [] : null;
- if (item.type === "checkbox") {
- const defaults = item.choices?.filter((i) => {
- return i.checked;
- }).map((i) => i.value) || [];
- defaultValue = union(defaultValue, defaults);
- }
- if (config && config[item.name] !== void 0) {
- defaultValue = config[item.name];
- }
- ruleForm[item.name] = defaultValue;
- return item;
- });
- }
- }
- async function getCurConfigFormData() {
- const configId = $route.params.configId;
- const curTypeConfigList = await getConfig(`uploader.${props.id}.configList`) || [];
- return curTypeConfigList.find((i) => i._id === configId) || {};
- }
- function updateRuleForm(key, value) {
- try {
- ruleForm[key] = value;
- } catch (e) {
- console.log(e);
- }
- }
- __expose({
- updateRuleForm,
- validate,
- getConfigType
- });
- return (_ctx, _cache) => {
- const _component_el_input = resolveComponent("el-input");
- const _component_el_form_item = resolveComponent("el-form-item");
- const _component_el_icon = resolveComponent("el-icon");
- const _component_el_tooltip = resolveComponent("el-tooltip");
- const _component_el_row = resolveComponent("el-row");
- const _component_el_option = resolveComponent("el-option");
- const _component_el_select = resolveComponent("el-select");
- const _component_el_switch = resolveComponent("el-switch");
- const _component_el_form = resolveComponent("el-form");
- return openBlock(), createElementBlock("div", {
- id: "config-form",
- class: normalizeClass(props.colorMode === "white" ? "white" : "")
- }, [
- createVNode(_component_el_form, {
- ref_key: "$form",
- ref: $form,
- "label-position": "left",
- "label-width": "50%",
- model: ruleForm,
- size: "small"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_form_item, {
- label: unref(T)("UPLOADER_CONFIG_NAME"),
- required: "",
- prop: "_configName"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_input, {
- modelValue: ruleForm._configName,
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => ruleForm._configName = $event),
- type: "input",
- placeholder: unref(T)("UPLOADER_CONFIG_PLACEHOLDER")
- }, null, 8, ["modelValue", "placeholder"])
- ]),
- _: 1
- }, 8, ["label"]),
- (openBlock(true), createElementBlock(Fragment, null, renderList(configList.value, (item, index) => {
- return openBlock(), createBlock(_component_el_form_item, {
- key: item.name + index,
- required: item.required,
- prop: item.name
- }, {
- label: withCtx(() => [
- createVNode(_component_el_row, { align: "middle" }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(item.alias || item.name) + " ", 1),
- item.tips ? (openBlock(), createBlock(_component_el_tooltip, {
- key: 0,
- class: "item",
- effect: "dark",
- placement: "right",
- persistent: false,
- teleported: ""
- }, {
- content: withCtx(() => [
- createBaseVNode("span", {
- class: "config-form-common-tips",
- innerHTML: transformMarkdownToHTML(item.tips)
- }, null, 8, _hoisted_1$1)
- ]),
- default: withCtx(() => [
- createVNode(_component_el_icon, { class: "ml-[4px] cursor-pointer hover:text-blue" }, {
- default: withCtx(() => [
- createVNode(unref(info_filled_default))
- ]),
- _: 1
- })
- ]),
- _: 2
- }, 1024)) : createCommentVNode("", true)
- ]),
- _: 2
- }, 1024)
- ]),
- default: withCtx(() => [
- item.type === "input" || item.type === "password" ? (openBlock(), createBlock(_component_el_input, {
- key: 0,
- modelValue: ruleForm[item.name],
- "onUpdate:modelValue": ($event) => ruleForm[item.name] = $event,
- type: "input",
- placeholder: item.message || item.name
- }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])) : item.type === "list" && item.choices ? (openBlock(), createBlock(_component_el_select, {
- key: 1,
- modelValue: ruleForm[item.name],
- "onUpdate:modelValue": ($event) => ruleForm[item.name] = $event,
- placeholder: item.message || item.name,
- persistent: false,
- teleported: ""
- }, {
- default: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(item.choices, (choice) => {
- return openBlock(), createBlock(_component_el_option, {
- key: choice.name || choice.value || choice,
- label: choice.name || choice.value || choice,
- value: choice.value || choice
- }, null, 8, ["label", "value"]);
- }), 128))
- ]),
- _: 2
- }, 1032, ["modelValue", "onUpdate:modelValue", "placeholder"])) : item.type === "checkbox" && item.choices ? (openBlock(), createBlock(_component_el_select, {
- key: 2,
- modelValue: ruleForm[item.name],
- "onUpdate:modelValue": ($event) => ruleForm[item.name] = $event,
- placeholder: item.message || item.name,
- multiple: "",
- "collapse-tags": "",
- persistent: false,
- teleported: ""
- }, {
- default: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(item.choices, (choice) => {
- return openBlock(), createBlock(_component_el_option, {
- key: choice.value || choice,
- label: choice.name || choice.value || choice,
- value: choice.value || choice
- }, null, 8, ["label", "value"]);
- }), 128))
- ]),
- _: 2
- }, 1032, ["modelValue", "onUpdate:modelValue", "placeholder"])) : item.type === "confirm" ? (openBlock(), createBlock(_component_el_switch, {
- key: 3,
- modelValue: ruleForm[item.name],
- "onUpdate:modelValue": ($event) => ruleForm[item.name] = $event,
- "active-text": item.confirmText || "yes",
- "inactive-text": item.cancelText || "no"
- }, null, 8, ["modelValue", "onUpdate:modelValue", "active-text", "inactive-text"])) : createCommentVNode("", true)
- ]),
- _: 2
- }, 1032, ["required", "prop"]);
- }), 128)),
- renderSlot(_ctx.$slots, "default")
- ]),
- _: 3
- }, 8, ["model"])
- ], 2);
- };
- }
-});
-const _hoisted_1 = { id: "picbeds-page" };
-const _hoisted_2 = { class: "view-title" };
-const _hoisted_3 = {
- key: 1,
- class: "single"
-};
-const _hoisted_4 = { class: "notice" };
-const __default__ = {
- name: "PicbedsPage"
-};
-const _sfc_main = /* @__PURE__ */ defineComponent({
- ...__default__,
- setup(__props) {
- const type = ref("");
- const config = ref([]);
- const picBedConfigList = ref([]);
- const picBedName = ref("");
- const $route = useRoute();
- const $router = useRouter();
- const $configForm = ref(null);
- const $dropdown = ref(null);
- type.value = $route.params.type;
- onBeforeMount(async () => {
- await getPicBeds();
- await getPicBedConfigList();
- });
- const handleConfirm = async () => {
- const result = await $configForm.value?.validate() || false;
- if (result !== false) {
- await triggerRPC(IRPCActionType.UPLOADER_UPDATE_CONFIG, type.value, result?._id, result);
- const successNotification = new Notification(T("SETTINGS_RESULT"), {
- body: T("TIPS_SET_SUCCEED")
- });
- successNotification.onclick = () => {
- return true;
- };
- $router.back();
- }
- };
- function handleMouseEnter() {
- $dropdown.value?.handleOpen();
- }
- function handleMouseLeave() {
- $dropdown.value?.handleClose();
- }
- async function getPicBeds() {
- const result = await triggerRPC(IRPCActionType.PICBED_GET_PICBED_CONFIG, $route.params.type);
- config.value = result.config;
- picBedName.value = result.name;
- }
- async function getPicBedConfigList() {
- const res = await triggerRPC(IRPCActionType.PICBED_GET_CONFIG_LIST, type.value) || void 0;
- const configList = res?.configList || [];
- picBedConfigList.value = configList.filter((item) => item._id !== $route.params.configId);
- }
- async function handleConfigImport(configItem) {
- const { _id, _configName, _updatedAt, _createdAt, ...rest } = configItem;
- for (const key in rest) {
- if (Object.prototype.hasOwnProperty.call(rest, key)) {
- const value = rest[key];
- $configForm.value?.updateRuleForm(key, value);
- }
- }
- $configForm.value?.updateRuleForm("_configName", dayjs().format("YYYYMMDDHHmmss"));
- }
- const handleReset = async () => {
- await triggerRPC(IRPCActionType.UPLOADER_RESET_CONFIG, type.value, $route.params.configId);
- const successNotification = new Notification(T("SETTINGS_RESULT"), {
- body: T("TIPS_RESET_SUCCEED")
- });
- successNotification.onclick = () => {
- return true;
- };
- $router.back();
- };
- async function handleNameClick() {
- const lang = await getConfig(configPaths.settings.language) || II18nLanguage.ZH_CN;
- const url = picBedManualUrlList[lang === II18nLanguage.EN ? "en" : "zh_cn"][$route.params.type];
- if (url) {
- sendRPC(IRPCActionType.OPEN_URL, url);
- }
- }
- async function handleCopyApi() {
- try {
- const { port = 36677, host = "127.0.0.1" } = await getConfig(configPaths.settings.server) || {};
- const serverKey = await getConfig(configPaths.settings.serverKey) || "";
- const uploader = await getConfig(configPaths.uploader) || {};
- const picBedConfigList2 = uploader[$route.params.type].configList || [];
- const picBedConfig = picBedConfigList2.find((item) => item._id === $route.params.configId);
- if (!picBedConfig) {
- ElMessage.error("No config found");
- return;
- }
- const apiUrl = `http://${host === "0.0.0.0" ? "127.0.0.1" : host}:${port}/upload?picbed=${$route.params.type}&configName=${picBedConfig._configName}${serverKey ? `&key=${serverKey}` : ""}`;
- window.electron.clipboard.writeText(apiUrl);
- ElMessage.success(`${T("MANAGE_BUCKET_COPY_SUCCESS")} ${apiUrl}`);
- } catch (error) {
- console.log(error);
- ElMessage.error("Copy failed");
- }
- }
- return (_ctx, _cache) => {
- const _component_el_icon = resolveComponent("el-icon");
- const _component_el_button = resolveComponent("el-button");
- const _component_el_dropdown_item = resolveComponent("el-dropdown-item");
- const _component_el_button_group = resolveComponent("el-button-group");
- const _component_el_form_item = resolveComponent("el-form-item");
- const _component_el_col = resolveComponent("el-col");
- const _component_el_row = resolveComponent("el-row");
- return openBlock(), createElementBlock("div", _hoisted_1, [
- createVNode(_component_el_row, {
- gutter: 20,
- class: "setting-list"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_col, {
- span: 22,
- offset: 1
- }, {
- default: withCtx(() => [
- createBaseVNode("div", _hoisted_2, [
- createBaseVNode("span", {
- class: "view-title-text",
- onClick: handleNameClick
- }, toDisplayString(picBedName.value) + " " + toDisplayString(unref(T)("SETTINGS")), 1),
- createVNode(_component_el_icon, null, {
- default: withCtx(() => [
- createVNode(unref(link_default))
- ]),
- _: 1
- }),
- createVNode(_component_el_button, {
- type: "primary",
- round: "",
- size: "small",
- style: { "margin-left": "6px" },
- onClick: handleCopyApi
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("UPLOAD_PAGE_COPY_UPLOAD_API")), 1)
- ]),
- _: 1
- })
- ]),
- config.value.length > 0 ? (openBlock(), createBlock(_sfc_main$1, {
- key: 0,
- id: type.value,
- ref_key: "$configForm",
- ref: $configForm,
- config: config.value,
- type: "uploader"
- }, {
- default: withCtx(() => [
- createVNode(_component_el_form_item, null, {
- default: withCtx(() => [
- createVNode(_component_el_button_group, null, {
- default: withCtx(() => [
- createVNode(_component_el_button, {
- type: "info",
- round: "",
- onClick: handleReset
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("RESET_PICBED_CONFIG")), 1)
- ]),
- _: 1
- }),
- createVNode(_component_el_button, {
- type: "success",
- round: "",
- onClick: handleConfirm
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("CONFIRM")), 1)
- ]),
- _: 1
- }),
- createVNode(_component_el_button, {
- round: "",
- type: "warning",
- onMouseenter: handleMouseEnter,
- onMouseleave: handleMouseLeave
- }, {
- default: withCtx(() => [
- createVNode(unref(ElDropdown), {
- ref_key: "$dropdown",
- ref: $dropdown,
- placement: "top",
- style: { "color": "#fff", "font-size": "12px", "width": "100%" },
- disabled: picBedConfigList.value.length === 0,
- teleported: ""
- }, {
- dropdown: withCtx(() => [
- (openBlock(true), createElementBlock(Fragment, null, renderList(picBedConfigList.value, (i) => {
- return openBlock(), createBlock(_component_el_dropdown_item, {
- key: i._id,
- onClick: ($event) => handleConfigImport(i)
- }, {
- default: withCtx(() => [
- createTextVNode(toDisplayString(i._configName), 1)
- ]),
- _: 2
- }, 1032, ["onClick"]);
- }), 128))
- ]),
- default: withCtx(() => [
- createTextVNode(toDisplayString(unref(T)("MANAGE_LOGIN_PAGE_PANE_IMPORT")) + " ", 1)
- ]),
- _: 1
- }, 8, ["disabled"])
- ]),
- _: 1
- })
- ]),
- _: 1
- })
- ]),
- _: 1
- })
- ]),
- _: 1
- }, 8, ["id", "config"])) : (openBlock(), createElementBlock("div", _hoisted_3, [
- createBaseVNode("div", _hoisted_4, toDisplayString(unref(T)("SETTINGS_NOT_CONFIG_OPTIONS")), 1)
- ]))
- ]),
- _: 1
- })
- ]),
- _: 1
- })
- ]);
- };
- }
-});
-export {
- _sfc_main as default
-};
diff --git a/dist/renderer/assets/index-BLrsZxcw.css b/dist/renderer/assets/index-BLrsZxcw.css
deleted file mode 100644
index 70cc0f74..00000000
--- a/dist/renderer/assets/index-BLrsZxcw.css
+++ /dev/null
@@ -1,83 +0,0 @@
-.config-form-common-tips a {
- color: #409eff;
- text-decoration: none;
-}
-#config-form .el-form label {
- line-height: 22px;
- padding-bottom: 0;
-}
-#config-form .el-form-item {
- display: flex;
- justify-content: space-between;
- border-bottom: 1px solid #777;
- padding-bottom: 16px;
-}
-#config-form .el-form-item:last-child {
- border-bottom: none;
-}
-#config-form .el-form-item__content {
- justify-content: flex-end;
-}
-#config-form .el-form .el-button-group {
- width: 100%;
-}
-#config-form .el-form .el-button-group .el-button {
- width: 50%;
-}
-#config-form .el-form .el-radio-group {
- margin-left: 25px;
-}
-#config-form .el-form .el-switch__label.is-active {
- color: #409eff;
-}
-#config-form.white .el-form-item {
- border-bottom: 1px solid #ddd;
-}
-#picbeds-page {
- height: 100%;
- overflow-y: auto;
- overflow-x: hidden;
- position: absolute;
- left: 142px;
- right: 0;
-}
-#picbeds-page .setting-list {
- height: 100%;
- overflow-y: auto;
- overflow-x: hidden;
-}
-#picbeds-page .view-title-text:hover {
- cursor: pointer;
- color: #409eff;
-}
-#picbeds-page .el-form label {
- line-height: 22px;
- padding-bottom: 0;
- color: #eee;
-}
-#picbeds-page .el-form-item {
- margin-bottom: 16px;
-}
-#picbeds-page .el-form .el-button-group {
- width: 100%;
-}
-#picbeds-page .el-form .el-button-group .el-button {
- width: calc(33.3333% - 10px);
-}
-#picbeds-page .el-form .el-radio-group {
- margin-left: 25px;
-}
-#picbeds-page .el-form .el-switch__label {
- color: #eee;
-}
-#picbeds-page .el-form .el-switch__label.is-active {
- color: #409eff;
-}
-#picbeds-page .notice {
- color: #eee;
- text-align: center;
- margin-bottom: 10px;
-}
-#picbeds-page .single {
- text-align: center;
-}
diff --git a/dist/renderer/assets/index-BqdcQlNn.js b/dist/renderer/assets/index-BqdcQlNn.js
deleted file mode 100644
index 997de9ad..00000000
--- a/dist/renderer/assets/index-BqdcQlNn.js
+++ /dev/null
@@ -1,133380 +0,0 @@
-const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./TrayPage-D6P4rVmM.js","./common-DNjr697i.js","./TrayPage-D2S-w9HD.css","./RenamePage-CYXv9h-U.js","./useIPC-O_oSdR6Q.js","./RenamePage-Dc09j0Xq.css","./MiniPage-Cu5L_RYi.js","./MiniPage-e-N9dAYG.css","./Main-D3yRZ6wJ.js","./bus-BjW7Y6FA.js","./Main-DxgNipu7.css","./Upload-BgeyAvpo.js","./ImageProcessSetting.vue_vue_type_script_setup_true_lang-DFtMAQE7.js","./Upload-DQdUIROq.css","./ManageMain-ZMzzX0g0.js","./manageStore-EteLCVxq.js","./dataSender-Bg45AIFL.js","./constants-BZfYqEeL.js","./ManageMain-CSobdUqJ.css","./ManageSetting-CcSbcH15.js","./bucketFileDb-qvw68roE.js","./common-REXFY3_s.js","./ManageSetting-BK7oAv59.css","./BucketPage-B7rY7eY7.js","./marked.esm-D58Rgktj.js","./static-DltyNkMh.js","./BucketPage-D2ZIMjPT.css","./LogInPage-KS3NYFdk.js","./LogInPage-BpIsfGOe.css","./index-1NKI9aE3.js","./index-BLrsZxcw.css","./Gallery-DLKNnx97.js","./Gallery-CIW8E9xr.css","./PicGoSetting-BLDICmxR.js","./PicGoSetting-CmM9FTij.css","./Plugin-DOBpniPg.js","./Plugin-Bpit55id.css","./ShortKey-Bk8jitxF.js","./ShortKey-BEjx61e-.css","./UploaderConfigPage-BvifEShU.js","./UploaderConfigPage-CYEWTO-c.css","./Toolbox-C8d1wmoC.js","./Toolbox-BBhxAVY5.css"])))=>i.map(i=>d[i]);
-var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
-function getDefaultExportFromCjs(x2) {
- return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
-}
-function getAugmentedNamespace(n2) {
- if (Object.prototype.hasOwnProperty.call(n2, "__esModule")) return n2;
- var f2 = n2.default;
- if (typeof f2 == "function") {
- var a2 = function a3() {
- var isInstance = false;
- try {
- isInstance = this instanceof a3;
- } catch {
- }
- if (isInstance) {
- return Reflect.construct(f2, arguments, this.constructor);
- }
- return f2.apply(this, arguments);
- };
- a2.prototype = f2.prototype;
- } else a2 = {};
- Object.defineProperty(a2, "__esModule", { value: true });
- Object.keys(n2).forEach(function(k2) {
- var d2 = Object.getOwnPropertyDescriptor(n2, k2);
- Object.defineProperty(a2, k2, d2.get ? d2 : {
- enumerable: true,
- get: function() {
- return n2[k2];
- }
- });
- });
- return a2;
-}
-var core;
-var hasRequiredCore;
-function requireCore() {
- if (hasRequiredCore) return core;
- hasRequiredCore = 1;
- function deepFreeze(obj) {
- if (obj instanceof Map) {
- obj.clear = obj.delete = obj.set = function() {
- throw new Error("map is read-only");
- };
- } else if (obj instanceof Set) {
- obj.add = obj.clear = obj.delete = function() {
- throw new Error("set is read-only");
- };
- }
- Object.freeze(obj);
- Object.getOwnPropertyNames(obj).forEach((name) => {
- const prop = obj[name];
- const type4 = typeof prop;
- if ((type4 === "object" || type4 === "function") && !Object.isFrozen(prop)) {
- deepFreeze(prop);
- }
- });
- return obj;
- }
- class Response {
- /**
- * @param {CompiledMode} mode
- */
- constructor(mode) {
- if (mode.data === void 0) mode.data = {};
- this.data = mode.data;
- this.isMatchIgnored = false;
- }
- ignoreMatch() {
- this.isMatchIgnored = true;
- }
- }
- function escapeHTML(value) {
- return value.replace(/&/g, "&").replace(//g, ">").replace(/"/g, """).replace(/'/g, "'");
- }
- function inherit$1(original, ...objects) {
- const result = /* @__PURE__ */ Object.create(null);
- for (const key in original) {
- result[key] = original[key];
- }
- objects.forEach(function(obj) {
- for (const key in obj) {
- result[key] = obj[key];
- }
- });
- return (
- /** @type {T} */
- result
- );
- }
- const SPAN_CLOSE = "";
- const emitsWrappingTags = (node) => {
- return !!node.scope;
- };
- const scopeToCSSClass = (name, { prefix }) => {
- if (name.startsWith("language:")) {
- return name.replace("language:", "language-");
- }
- if (name.includes(".")) {
- const pieces = name.split(".");
- return [
- `${prefix}${pieces.shift()}`,
- ...pieces.map((x2, i2) => `${x2}${"_".repeat(i2 + 1)}`)
- ].join(" ");
- }
- return `${prefix}${name}`;
- };
- class HTMLRenderer {
- /**
- * Creates a new HTMLRenderer
- *
- * @param {Tree} parseTree - the parse tree (must support `walk` API)
- * @param {{classPrefix: string}} options
- */
- constructor(parseTree, options) {
- this.buffer = "";
- this.classPrefix = options.classPrefix;
- parseTree.walk(this);
- }
- /**
- * Adds texts to the output stream
- *
- * @param {string} text */
- addText(text) {
- this.buffer += escapeHTML(text);
- }
- /**
- * Adds a node open to the output stream (if needed)
- *
- * @param {Node} node */
- openNode(node) {
- if (!emitsWrappingTags(node)) return;
- const className = scopeToCSSClass(
- node.scope,
- { prefix: this.classPrefix }
- );
- this.span(className);
- }
- /**
- * Adds a node close to the output stream (if needed)
- *
- * @param {Node} node */
- closeNode(node) {
- if (!emitsWrappingTags(node)) return;
- this.buffer += SPAN_CLOSE;
- }
- /**
- * returns the accumulated buffer
- */
- value() {
- return this.buffer;
- }
- // helpers
- /**
- * Builds a span element
- *
- * @param {string} className */
- span(className) {
- this.buffer += ``;
- }
- }
- const newNode = (opts = {}) => {
- const result = { children: [] };
- Object.assign(result, opts);
- return result;
- };
- class TokenTree {
- constructor() {
- this.rootNode = newNode();
- this.stack = [this.rootNode];
- }
- get top() {
- return this.stack[this.stack.length - 1];
- }
- get root() {
- return this.rootNode;
- }
- /** @param {Node} node */
- add(node) {
- this.top.children.push(node);
- }
- /** @param {string} scope */
- openNode(scope) {
- const node = newNode({ scope });
- this.add(node);
- this.stack.push(node);
- }
- closeNode() {
- if (this.stack.length > 1) {
- return this.stack.pop();
- }
- return void 0;
- }
- closeAllNodes() {
- while (this.closeNode()) ;
- }
- toJSON() {
- return JSON.stringify(this.rootNode, null, 4);
- }
- /**
- * @typedef { import("./html_renderer").Renderer } Renderer
- * @param {Renderer} builder
- */
- walk(builder) {
- return this.constructor._walk(builder, this.rootNode);
- }
- /**
- * @param {Renderer} builder
- * @param {Node} node
- */
- static _walk(builder, node) {
- if (typeof node === "string") {
- builder.addText(node);
- } else if (node.children) {
- builder.openNode(node);
- node.children.forEach((child) => this._walk(builder, child));
- builder.closeNode(node);
- }
- return builder;
- }
- /**
- * @param {Node} node
- */
- static _collapse(node) {
- if (typeof node === "string") return;
- if (!node.children) return;
- if (node.children.every((el) => typeof el === "string")) {
- node.children = [node.children.join("")];
- } else {
- node.children.forEach((child) => {
- TokenTree._collapse(child);
- });
- }
- }
- }
- class TokenTreeEmitter extends TokenTree {
- /**
- * @param {*} options
- */
- constructor(options) {
- super();
- this.options = options;
- }
- /**
- * @param {string} text
- */
- addText(text) {
- if (text === "") {
- return;
- }
- this.add(text);
- }
- /** @param {string} scope */
- startScope(scope) {
- this.openNode(scope);
- }
- endScope() {
- this.closeNode();
- }
- /**
- * @param {Emitter & {root: DataNode}} emitter
- * @param {string} name
- */
- __addSublanguage(emitter, name) {
- const node = emitter.root;
- if (name) node.scope = `language:${name}`;
- this.add(node);
- }
- toHTML() {
- const renderer2 = new HTMLRenderer(this, this.options);
- return renderer2.value();
- }
- finalize() {
- this.closeAllNodes();
- return true;
- }
- }
- function source(re) {
- if (!re) return null;
- if (typeof re === "string") return re;
- return re.source;
- }
- function lookahead(re) {
- return concat("(?=", re, ")");
- }
- function anyNumberOfTimes(re) {
- return concat("(?:", re, ")*");
- }
- function optional(re) {
- return concat("(?:", re, ")?");
- }
- function concat(...args) {
- const joined = args.map((x2) => source(x2)).join("");
- return joined;
- }
- function stripOptionsFromArgs(args) {
- const opts = args[args.length - 1];
- if (typeof opts === "object" && opts.constructor === Object) {
- args.splice(args.length - 1, 1);
- return opts;
- } else {
- return {};
- }
- }
- function either(...args) {
- const opts = stripOptionsFromArgs(args);
- const joined = "(" + (opts.capture ? "" : "?:") + args.map((x2) => source(x2)).join("|") + ")";
- return joined;
- }
- function countMatchGroups(re) {
- return new RegExp(re.toString() + "|").exec("").length - 1;
- }
- function startsWith(re, lexeme) {
- const match = re && re.exec(lexeme);
- return match && match.index === 0;
- }
- const BACKREF_RE = /\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;
- function _rewriteBackreferences(regexps, { joinWith }) {
- let numCaptures = 0;
- return regexps.map((regex) => {
- numCaptures += 1;
- const offset = numCaptures;
- let re = source(regex);
- let out = "";
- while (re.length > 0) {
- const match = BACKREF_RE.exec(re);
- if (!match) {
- out += re;
- break;
- }
- out += re.substring(0, match.index);
- re = re.substring(match.index + match[0].length);
- if (match[0][0] === "\\" && match[1]) {
- out += "\\" + String(Number(match[1]) + offset);
- } else {
- out += match[0];
- if (match[0] === "(") {
- numCaptures++;
- }
- }
- }
- return out;
- }).map((re) => `(${re})`).join(joinWith);
- }
- const MATCH_NOTHING_RE = /\b\B/;
- const IDENT_RE = "[a-zA-Z]\\w*";
- const UNDERSCORE_IDENT_RE = "[a-zA-Z_]\\w*";
- const NUMBER_RE = "\\b\\d+(\\.\\d+)?";
- const C_NUMBER_RE = "(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)";
- const BINARY_NUMBER_RE = "\\b(0b[01]+)";
- const RE_STARTERS_RE = "!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";
- const SHEBANG = (opts = {}) => {
- const beginShebang = /^#![ ]*\//;
- if (opts.binary) {
- opts.begin = concat(
- beginShebang,
- /.*\b/,
- opts.binary,
- /\b.*/
- );
- }
- return inherit$1({
- scope: "meta",
- begin: beginShebang,
- end: /$/,
- relevance: 0,
- /** @type {ModeCallback} */
- "on:begin": (m2, resp) => {
- if (m2.index !== 0) resp.ignoreMatch();
- }
- }, opts);
- };
- const BACKSLASH_ESCAPE = {
- begin: "\\\\[\\s\\S]",
- relevance: 0
- };
- const APOS_STRING_MODE = {
- scope: "string",
- begin: "'",
- end: "'",
- illegal: "\\n",
- contains: [BACKSLASH_ESCAPE]
- };
- const QUOTE_STRING_MODE = {
- scope: "string",
- begin: '"',
- end: '"',
- illegal: "\\n",
- contains: [BACKSLASH_ESCAPE]
- };
- const PHRASAL_WORDS_MODE = {
- begin: /\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/
- };
- const COMMENT = function(begin, end, modeOptions = {}) {
- const mode = inherit$1(
- {
- scope: "comment",
- begin,
- end,
- contains: []
- },
- modeOptions
- );
- mode.contains.push({
- scope: "doctag",
- // hack to avoid the space from being included. the space is necessary to
- // match here to prevent the plain text rule below from gobbling up doctags
- begin: "[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",
- end: /(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,
- excludeBegin: true,
- relevance: 0
- });
- const ENGLISH_WORD = either(
- // list of common 1 and 2 letter words in English
- "I",
- "a",
- "is",
- "so",
- "us",
- "to",
- "at",
- "if",
- "in",
- "it",
- "on",
- // note: this is not an exhaustive list of contractions, just popular ones
- /[A-Za-z]+['](d|ve|re|ll|t|s|n)/,
- // contractions - can't we'd they're let's, etc
- /[A-Za-z]+[-][a-z]+/,
- // `no-way`, etc.
- /[A-Za-z][a-z]{2,}/
- // allow capitalized words at beginning of sentences
- );
- mode.contains.push(
- {
- // TODO: how to include ", (, ) without breaking grammars that use these for
- // comment delimiters?
- // begin: /[ ]+([()"]?([A-Za-z'-]{3,}|is|a|I|so|us|[tT][oO]|at|if|in|it|on)[.]?[()":]?([.][ ]|[ ]|\))){3}/
- // ---
- // this tries to find sequences of 3 english words in a row (without any
- // "programming" type syntax) this gives us a strong signal that we've
- // TRULY found a comment - vs perhaps scanning with the wrong language.
- // It's possible to find something that LOOKS like the start of the
- // comment - but then if there is no readable text - good chance it is a
- // false match and not a comment.
- //
- // for a visual example please see:
- // https://github.com/highlightjs/highlight.js/issues/2827
- begin: concat(
- /[ ]+/,
- // necessary to prevent us gobbling up doctags like /* @author Bob Mcgill */
- "(",
- ENGLISH_WORD,
- /[.]?[:]?([.][ ]|[ ])/,
- "){3}"
- )
- // look for 3 words in a row
- }
- );
- return mode;
- };
- const C_LINE_COMMENT_MODE = COMMENT("//", "$");
- const C_BLOCK_COMMENT_MODE = COMMENT("/\\*", "\\*/");
- const HASH_COMMENT_MODE = COMMENT("#", "$");
- const NUMBER_MODE = {
- scope: "number",
- begin: NUMBER_RE,
- relevance: 0
- };
- const C_NUMBER_MODE = {
- scope: "number",
- begin: C_NUMBER_RE,
- relevance: 0
- };
- const BINARY_NUMBER_MODE = {
- scope: "number",
- begin: BINARY_NUMBER_RE,
- relevance: 0
- };
- const REGEXP_MODE = {
- scope: "regexp",
- begin: /\/(?=[^/\n]*\/)/,
- end: /\/[gimuy]*/,
- contains: [
- BACKSLASH_ESCAPE,
- {
- begin: /\[/,
- end: /\]/,
- relevance: 0,
- contains: [BACKSLASH_ESCAPE]
- }
- ]
- };
- const TITLE_MODE = {
- scope: "title",
- begin: IDENT_RE,
- relevance: 0
- };
- const UNDERSCORE_TITLE_MODE = {
- scope: "title",
- begin: UNDERSCORE_IDENT_RE,
- relevance: 0
- };
- const METHOD_GUARD = {
- // excludes method names from keyword processing
- begin: "\\.\\s*" + UNDERSCORE_IDENT_RE,
- relevance: 0
- };
- const END_SAME_AS_BEGIN = function(mode) {
- return Object.assign(
- mode,
- {
- /** @type {ModeCallback} */
- "on:begin": (m2, resp) => {
- resp.data._beginMatch = m2[1];
- },
- /** @type {ModeCallback} */
- "on:end": (m2, resp) => {
- if (resp.data._beginMatch !== m2[1]) resp.ignoreMatch();
- }
- }
- );
- };
- var MODES = /* @__PURE__ */ Object.freeze({
- __proto__: null,
- APOS_STRING_MODE,
- BACKSLASH_ESCAPE,
- BINARY_NUMBER_MODE,
- BINARY_NUMBER_RE,
- COMMENT,
- C_BLOCK_COMMENT_MODE,
- C_LINE_COMMENT_MODE,
- C_NUMBER_MODE,
- C_NUMBER_RE,
- END_SAME_AS_BEGIN,
- HASH_COMMENT_MODE,
- IDENT_RE,
- MATCH_NOTHING_RE,
- METHOD_GUARD,
- NUMBER_MODE,
- NUMBER_RE,
- PHRASAL_WORDS_MODE,
- QUOTE_STRING_MODE,
- REGEXP_MODE,
- RE_STARTERS_RE,
- SHEBANG,
- TITLE_MODE,
- UNDERSCORE_IDENT_RE,
- UNDERSCORE_TITLE_MODE
- });
- function skipIfHasPrecedingDot(match, response) {
- const before = match.input[match.index - 1];
- if (before === ".") {
- response.ignoreMatch();
- }
- }
- function scopeClassName(mode, _parent) {
- if (mode.className !== void 0) {
- mode.scope = mode.className;
- delete mode.className;
- }
- }
- function beginKeywords(mode, parent2) {
- if (!parent2) return;
- if (!mode.beginKeywords) return;
- mode.begin = "\\b(" + mode.beginKeywords.split(" ").join("|") + ")(?!\\.)(?=\\b|\\s)";
- mode.__beforeBegin = skipIfHasPrecedingDot;
- mode.keywords = mode.keywords || mode.beginKeywords;
- delete mode.beginKeywords;
- if (mode.relevance === void 0) mode.relevance = 0;
- }
- function compileIllegal(mode, _parent) {
- if (!Array.isArray(mode.illegal)) return;
- mode.illegal = either(...mode.illegal);
- }
- function compileMatch(mode, _parent) {
- if (!mode.match) return;
- if (mode.begin || mode.end) throw new Error("begin & end are not supported with match");
- mode.begin = mode.match;
- delete mode.match;
- }
- function compileRelevance(mode, _parent) {
- if (mode.relevance === void 0) mode.relevance = 1;
- }
- const beforeMatchExt = (mode, parent2) => {
- if (!mode.beforeMatch) return;
- if (mode.starts) throw new Error("beforeMatch cannot be used with starts");
- const originalMode = Object.assign({}, mode);
- Object.keys(mode).forEach((key) => {
- delete mode[key];
- });
- mode.keywords = originalMode.keywords;
- mode.begin = concat(originalMode.beforeMatch, lookahead(originalMode.begin));
- mode.starts = {
- relevance: 0,
- contains: [
- Object.assign(originalMode, { endsParent: true })
- ]
- };
- mode.relevance = 0;
- delete originalMode.beforeMatch;
- };
- const COMMON_KEYWORDS = [
- "of",
- "and",
- "for",
- "in",
- "not",
- "or",
- "if",
- "then",
- "parent",
- // common variable name
- "list",
- // common variable name
- "value"
- // common variable name
- ];
- const DEFAULT_KEYWORD_SCOPE = "keyword";
- function compileKeywords(rawKeywords, caseInsensitive, scopeName = DEFAULT_KEYWORD_SCOPE) {
- const compiledKeywords = /* @__PURE__ */ Object.create(null);
- if (typeof rawKeywords === "string") {
- compileList(scopeName, rawKeywords.split(" "));
- } else if (Array.isArray(rawKeywords)) {
- compileList(scopeName, rawKeywords);
- } else {
- Object.keys(rawKeywords).forEach(function(scopeName2) {
- Object.assign(
- compiledKeywords,
- compileKeywords(rawKeywords[scopeName2], caseInsensitive, scopeName2)
- );
- });
- }
- return compiledKeywords;
- function compileList(scopeName2, keywordList) {
- if (caseInsensitive) {
- keywordList = keywordList.map((x2) => x2.toLowerCase());
- }
- keywordList.forEach(function(keyword) {
- const pair = keyword.split("|");
- compiledKeywords[pair[0]] = [scopeName2, scoreForKeyword(pair[0], pair[1])];
- });
- }
- }
- function scoreForKeyword(keyword, providedScore) {
- if (providedScore) {
- return Number(providedScore);
- }
- return commonKeyword(keyword) ? 0 : 1;
- }
- function commonKeyword(keyword) {
- return COMMON_KEYWORDS.includes(keyword.toLowerCase());
- }
- const seenDeprecations = {};
- const error = (message2) => {
- console.error(message2);
- };
- const warn2 = (message2, ...args) => {
- console.log(`WARN: ${message2}`, ...args);
- };
- const deprecated = (version3, message2) => {
- if (seenDeprecations[`${version3}/${message2}`]) return;
- console.log(`Deprecated as of ${version3}. ${message2}`);
- seenDeprecations[`${version3}/${message2}`] = true;
- };
- const MultiClassError = new Error();
- function remapScopeNames(mode, regexes, { key }) {
- let offset = 0;
- const scopeNames = mode[key];
- const emit2 = {};
- const positions = {};
- for (let i2 = 1; i2 <= regexes.length; i2++) {
- positions[i2 + offset] = scopeNames[i2];
- emit2[i2 + offset] = true;
- offset += countMatchGroups(regexes[i2 - 1]);
- }
- mode[key] = positions;
- mode[key]._emit = emit2;
- mode[key]._multi = true;
- }
- function beginMultiClass(mode) {
- if (!Array.isArray(mode.begin)) return;
- if (mode.skip || mode.excludeBegin || mode.returnBegin) {
- error("skip, excludeBegin, returnBegin not compatible with beginScope: {}");
- throw MultiClassError;
- }
- if (typeof mode.beginScope !== "object" || mode.beginScope === null) {
- error("beginScope must be object");
- throw MultiClassError;
- }
- remapScopeNames(mode, mode.begin, { key: "beginScope" });
- mode.begin = _rewriteBackreferences(mode.begin, { joinWith: "" });
- }
- function endMultiClass(mode) {
- if (!Array.isArray(mode.end)) return;
- if (mode.skip || mode.excludeEnd || mode.returnEnd) {
- error("skip, excludeEnd, returnEnd not compatible with endScope: {}");
- throw MultiClassError;
- }
- if (typeof mode.endScope !== "object" || mode.endScope === null) {
- error("endScope must be object");
- throw MultiClassError;
- }
- remapScopeNames(mode, mode.end, { key: "endScope" });
- mode.end = _rewriteBackreferences(mode.end, { joinWith: "" });
- }
- function scopeSugar(mode) {
- if (mode.scope && typeof mode.scope === "object" && mode.scope !== null) {
- mode.beginScope = mode.scope;
- delete mode.scope;
- }
- }
- function MultiClass(mode) {
- scopeSugar(mode);
- if (typeof mode.beginScope === "string") {
- mode.beginScope = { _wrap: mode.beginScope };
- }
- if (typeof mode.endScope === "string") {
- mode.endScope = { _wrap: mode.endScope };
- }
- beginMultiClass(mode);
- endMultiClass(mode);
- }
- function compileLanguage(language) {
- function langRe(value, global2) {
- return new RegExp(
- source(value),
- "m" + (language.case_insensitive ? "i" : "") + (language.unicodeRegex ? "u" : "") + (global2 ? "g" : "")
- );
- }
- class MultiRegex {
- constructor() {
- this.matchIndexes = {};
- this.regexes = [];
- this.matchAt = 1;
- this.position = 0;
- }
- // @ts-ignore
- addRule(re, opts) {
- opts.position = this.position++;
- this.matchIndexes[this.matchAt] = opts;
- this.regexes.push([opts, re]);
- this.matchAt += countMatchGroups(re) + 1;
- }
- compile() {
- if (this.regexes.length === 0) {
- this.exec = () => null;
- }
- const terminators = this.regexes.map((el) => el[1]);
- this.matcherRe = langRe(_rewriteBackreferences(terminators, { joinWith: "|" }), true);
- this.lastIndex = 0;
- }
- /** @param {string} s */
- exec(s2) {
- this.matcherRe.lastIndex = this.lastIndex;
- const match = this.matcherRe.exec(s2);
- if (!match) {
- return null;
- }
- const i2 = match.findIndex((el, i3) => i3 > 0 && el !== void 0);
- const matchData = this.matchIndexes[i2];
- match.splice(0, i2);
- return Object.assign(match, matchData);
- }
- }
- class ResumableMultiRegex {
- constructor() {
- this.rules = [];
- this.multiRegexes = [];
- this.count = 0;
- this.lastIndex = 0;
- this.regexIndex = 0;
- }
- // @ts-ignore
- getMatcher(index2) {
- if (this.multiRegexes[index2]) return this.multiRegexes[index2];
- const matcher = new MultiRegex();
- this.rules.slice(index2).forEach(([re, opts]) => matcher.addRule(re, opts));
- matcher.compile();
- this.multiRegexes[index2] = matcher;
- return matcher;
- }
- resumingScanAtSamePosition() {
- return this.regexIndex !== 0;
- }
- considerAll() {
- this.regexIndex = 0;
- }
- // @ts-ignore
- addRule(re, opts) {
- this.rules.push([re, opts]);
- if (opts.type === "begin") this.count++;
- }
- /** @param {string} s */
- exec(s2) {
- const m2 = this.getMatcher(this.regexIndex);
- m2.lastIndex = this.lastIndex;
- let result = m2.exec(s2);
- if (this.resumingScanAtSamePosition()) {
- if (result && result.index === this.lastIndex) ;
- else {
- const m22 = this.getMatcher(0);
- m22.lastIndex = this.lastIndex + 1;
- result = m22.exec(s2);
- }
- }
- if (result) {
- this.regexIndex += result.position + 1;
- if (this.regexIndex === this.count) {
- this.considerAll();
- }
- }
- return result;
- }
- }
- function buildModeRegex(mode) {
- const mm = new ResumableMultiRegex();
- mode.contains.forEach((term) => mm.addRule(term.begin, { rule: term, type: "begin" }));
- if (mode.terminatorEnd) {
- mm.addRule(mode.terminatorEnd, { type: "end" });
- }
- if (mode.illegal) {
- mm.addRule(mode.illegal, { type: "illegal" });
- }
- return mm;
- }
- function compileMode(mode, parent2) {
- const cmode = (
- /** @type CompiledMode */
- mode
- );
- if (mode.isCompiled) return cmode;
- [
- scopeClassName,
- // do this early so compiler extensions generally don't have to worry about
- // the distinction between match/begin
- compileMatch,
- MultiClass,
- beforeMatchExt
- ].forEach((ext) => ext(mode, parent2));
- language.compilerExtensions.forEach((ext) => ext(mode, parent2));
- mode.__beforeBegin = null;
- [
- beginKeywords,
- // do this later so compiler extensions that come earlier have access to the
- // raw array if they wanted to perhaps manipulate it, etc.
- compileIllegal,
- // default to 1 relevance if not specified
- compileRelevance
- ].forEach((ext) => ext(mode, parent2));
- mode.isCompiled = true;
- let keywordPattern = null;
- if (typeof mode.keywords === "object" && mode.keywords.$pattern) {
- mode.keywords = Object.assign({}, mode.keywords);
- keywordPattern = mode.keywords.$pattern;
- delete mode.keywords.$pattern;
- }
- keywordPattern = keywordPattern || /\w+/;
- if (mode.keywords) {
- mode.keywords = compileKeywords(mode.keywords, language.case_insensitive);
- }
- cmode.keywordPatternRe = langRe(keywordPattern, true);
- if (parent2) {
- if (!mode.begin) mode.begin = /\B|\b/;
- cmode.beginRe = langRe(cmode.begin);
- if (!mode.end && !mode.endsWithParent) mode.end = /\B|\b/;
- if (mode.end) cmode.endRe = langRe(cmode.end);
- cmode.terminatorEnd = source(cmode.end) || "";
- if (mode.endsWithParent && parent2.terminatorEnd) {
- cmode.terminatorEnd += (mode.end ? "|" : "") + parent2.terminatorEnd;
- }
- }
- if (mode.illegal) cmode.illegalRe = langRe(
- /** @type {RegExp | string} */
- mode.illegal
- );
- if (!mode.contains) mode.contains = [];
- mode.contains = [].concat(...mode.contains.map(function(c2) {
- return expandOrCloneMode(c2 === "self" ? mode : c2);
- }));
- mode.contains.forEach(function(c2) {
- compileMode(
- /** @type Mode */
- c2,
- cmode
- );
- });
- if (mode.starts) {
- compileMode(mode.starts, parent2);
- }
- cmode.matcher = buildModeRegex(cmode);
- return cmode;
- }
- if (!language.compilerExtensions) language.compilerExtensions = [];
- if (language.contains && language.contains.includes("self")) {
- throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");
- }
- language.classNameAliases = inherit$1(language.classNameAliases || {});
- return compileMode(
- /** @type Mode */
- language
- );
- }
- function dependencyOnParent(mode) {
- if (!mode) return false;
- return mode.endsWithParent || dependencyOnParent(mode.starts);
- }
- function expandOrCloneMode(mode) {
- if (mode.variants && !mode.cachedVariants) {
- mode.cachedVariants = mode.variants.map(function(variant) {
- return inherit$1(mode, { variants: null }, variant);
- });
- }
- if (mode.cachedVariants) {
- return mode.cachedVariants;
- }
- if (dependencyOnParent(mode)) {
- return inherit$1(mode, { starts: mode.starts ? inherit$1(mode.starts) : null });
- }
- if (Object.isFrozen(mode)) {
- return inherit$1(mode);
- }
- return mode;
- }
- var version2 = "11.11.1";
- class HTMLInjectionError extends Error {
- constructor(reason, html) {
- super(reason);
- this.name = "HTMLInjectionError";
- this.html = html;
- }
- }
- const escape2 = escapeHTML;
- const inherit = inherit$1;
- const NO_MATCH = Symbol("nomatch");
- const MAX_KEYWORD_HITS = 7;
- const HLJS = function(hljs) {
- const languages = /* @__PURE__ */ Object.create(null);
- const aliases = /* @__PURE__ */ Object.create(null);
- const plugins = [];
- let SAFE_MODE = true;
- const LANGUAGE_NOT_FOUND = "Could not find the language '{}', did you forget to load/include a language module?";
- const PLAINTEXT_LANGUAGE = { disableAutodetect: true, name: "Plain text", contains: [] };
- let options = {
- ignoreUnescapedHTML: false,
- throwUnescapedHTML: false,
- noHighlightRe: /^(no-?highlight)$/i,
- languageDetectRe: /\blang(?:uage)?-([\w-]+)\b/i,
- classPrefix: "hljs-",
- cssSelector: "pre code",
- languages: null,
- // beta configuration options, subject to change, welcome to discuss
- // https://github.com/highlightjs/highlight.js/issues/1086
- __emitter: TokenTreeEmitter
- };
- function shouldNotHighlight(languageName) {
- return options.noHighlightRe.test(languageName);
- }
- function blockLanguage(block) {
- let classes = block.className + " ";
- classes += block.parentNode ? block.parentNode.className : "";
- const match = options.languageDetectRe.exec(classes);
- if (match) {
- const language = getLanguage(match[1]);
- if (!language) {
- warn2(LANGUAGE_NOT_FOUND.replace("{}", match[1]));
- warn2("Falling back to no-highlight mode for this block.", block);
- }
- return language ? match[1] : "no-highlight";
- }
- return classes.split(/\s+/).find((_class) => shouldNotHighlight(_class) || getLanguage(_class));
- }
- function highlight2(codeOrLanguageName, optionsOrCode, ignoreIllegals) {
- let code = "";
- let languageName = "";
- if (typeof optionsOrCode === "object") {
- code = codeOrLanguageName;
- ignoreIllegals = optionsOrCode.ignoreIllegals;
- languageName = optionsOrCode.language;
- } else {
- deprecated("10.7.0", "highlight(lang, code, ...args) has been deprecated.");
- deprecated("10.7.0", "Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277");
- languageName = codeOrLanguageName;
- code = optionsOrCode;
- }
- if (ignoreIllegals === void 0) {
- ignoreIllegals = true;
- }
- const context = {
- code,
- language: languageName
- };
- fire("before:highlight", context);
- const result = context.result ? context.result : _highlight(context.language, context.code, ignoreIllegals);
- result.code = context.code;
- fire("after:highlight", result);
- return result;
- }
- function _highlight(languageName, codeToHighlight, ignoreIllegals, continuation) {
- const keywordHits = /* @__PURE__ */ Object.create(null);
- function keywordData(mode, matchText) {
- return mode.keywords[matchText];
- }
- function processKeywords() {
- if (!top.keywords) {
- emitter.addText(modeBuffer);
- return;
- }
- let lastIndex = 0;
- top.keywordPatternRe.lastIndex = 0;
- let match = top.keywordPatternRe.exec(modeBuffer);
- let buf = "";
- while (match) {
- buf += modeBuffer.substring(lastIndex, match.index);
- const word = language.case_insensitive ? match[0].toLowerCase() : match[0];
- const data = keywordData(top, word);
- if (data) {
- const [kind, keywordRelevance] = data;
- emitter.addText(buf);
- buf = "";
- keywordHits[word] = (keywordHits[word] || 0) + 1;
- if (keywordHits[word] <= MAX_KEYWORD_HITS) relevance += keywordRelevance;
- if (kind.startsWith("_")) {
- buf += match[0];
- } else {
- const cssClass = language.classNameAliases[kind] || kind;
- emitKeyword(match[0], cssClass);
- }
- } else {
- buf += match[0];
- }
- lastIndex = top.keywordPatternRe.lastIndex;
- match = top.keywordPatternRe.exec(modeBuffer);
- }
- buf += modeBuffer.substring(lastIndex);
- emitter.addText(buf);
- }
- function processSubLanguage() {
- if (modeBuffer === "") return;
- let result2 = null;
- if (typeof top.subLanguage === "string") {
- if (!languages[top.subLanguage]) {
- emitter.addText(modeBuffer);
- return;
- }
- result2 = _highlight(top.subLanguage, modeBuffer, true, continuations[top.subLanguage]);
- continuations[top.subLanguage] = /** @type {CompiledMode} */
- result2._top;
- } else {
- result2 = highlightAuto(modeBuffer, top.subLanguage.length ? top.subLanguage : null);
- }
- if (top.relevance > 0) {
- relevance += result2.relevance;
- }
- emitter.__addSublanguage(result2._emitter, result2.language);
- }
- function processBuffer() {
- if (top.subLanguage != null) {
- processSubLanguage();
- } else {
- processKeywords();
- }
- modeBuffer = "";
- }
- function emitKeyword(keyword, scope) {
- if (keyword === "") return;
- emitter.startScope(scope);
- emitter.addText(keyword);
- emitter.endScope();
- }
- function emitMultiClass(scope, match) {
- let i2 = 1;
- const max2 = match.length - 1;
- while (i2 <= max2) {
- if (!scope._emit[i2]) {
- i2++;
- continue;
- }
- const klass = language.classNameAliases[scope[i2]] || scope[i2];
- const text = match[i2];
- if (klass) {
- emitKeyword(text, klass);
- } else {
- modeBuffer = text;
- processKeywords();
- modeBuffer = "";
- }
- i2++;
- }
- }
- function startNewMode(mode, match) {
- if (mode.scope && typeof mode.scope === "string") {
- emitter.openNode(language.classNameAliases[mode.scope] || mode.scope);
- }
- if (mode.beginScope) {
- if (mode.beginScope._wrap) {
- emitKeyword(modeBuffer, language.classNameAliases[mode.beginScope._wrap] || mode.beginScope._wrap);
- modeBuffer = "";
- } else if (mode.beginScope._multi) {
- emitMultiClass(mode.beginScope, match);
- modeBuffer = "";
- }
- }
- top = Object.create(mode, { parent: { value: top } });
- return top;
- }
- function endOfMode(mode, match, matchPlusRemainder) {
- let matched = startsWith(mode.endRe, matchPlusRemainder);
- if (matched) {
- if (mode["on:end"]) {
- const resp = new Response(mode);
- mode["on:end"](match, resp);
- if (resp.isMatchIgnored) matched = false;
- }
- if (matched) {
- while (mode.endsParent && mode.parent) {
- mode = mode.parent;
- }
- return mode;
- }
- }
- if (mode.endsWithParent) {
- return endOfMode(mode.parent, match, matchPlusRemainder);
- }
- }
- function doIgnore(lexeme) {
- if (top.matcher.regexIndex === 0) {
- modeBuffer += lexeme[0];
- return 1;
- } else {
- resumeScanAtSamePosition = true;
- return 0;
- }
- }
- function doBeginMatch(match) {
- const lexeme = match[0];
- const newMode = match.rule;
- const resp = new Response(newMode);
- const beforeCallbacks = [newMode.__beforeBegin, newMode["on:begin"]];
- for (const cb of beforeCallbacks) {
- if (!cb) continue;
- cb(match, resp);
- if (resp.isMatchIgnored) return doIgnore(lexeme);
- }
- if (newMode.skip) {
- modeBuffer += lexeme;
- } else {
- if (newMode.excludeBegin) {
- modeBuffer += lexeme;
- }
- processBuffer();
- if (!newMode.returnBegin && !newMode.excludeBegin) {
- modeBuffer = lexeme;
- }
- }
- startNewMode(newMode, match);
- return newMode.returnBegin ? 0 : lexeme.length;
- }
- function doEndMatch(match) {
- const lexeme = match[0];
- const matchPlusRemainder = codeToHighlight.substring(match.index);
- const endMode = endOfMode(top, match, matchPlusRemainder);
- if (!endMode) {
- return NO_MATCH;
- }
- const origin = top;
- if (top.endScope && top.endScope._wrap) {
- processBuffer();
- emitKeyword(lexeme, top.endScope._wrap);
- } else if (top.endScope && top.endScope._multi) {
- processBuffer();
- emitMultiClass(top.endScope, match);
- } else if (origin.skip) {
- modeBuffer += lexeme;
- } else {
- if (!(origin.returnEnd || origin.excludeEnd)) {
- modeBuffer += lexeme;
- }
- processBuffer();
- if (origin.excludeEnd) {
- modeBuffer = lexeme;
- }
- }
- do {
- if (top.scope) {
- emitter.closeNode();
- }
- if (!top.skip && !top.subLanguage) {
- relevance += top.relevance;
- }
- top = top.parent;
- } while (top !== endMode.parent);
- if (endMode.starts) {
- startNewMode(endMode.starts, match);
- }
- return origin.returnEnd ? 0 : lexeme.length;
- }
- function processContinuations() {
- const list = [];
- for (let current = top; current !== language; current = current.parent) {
- if (current.scope) {
- list.unshift(current.scope);
- }
- }
- list.forEach((item) => emitter.openNode(item));
- }
- let lastMatch = {};
- function processLexeme(textBeforeMatch, match) {
- const lexeme = match && match[0];
- modeBuffer += textBeforeMatch;
- if (lexeme == null) {
- processBuffer();
- return 0;
- }
- if (lastMatch.type === "begin" && match.type === "end" && lastMatch.index === match.index && lexeme === "") {
- modeBuffer += codeToHighlight.slice(match.index, match.index + 1);
- if (!SAFE_MODE) {
- const err = new Error(`0 width match regex (${languageName})`);
- err.languageName = languageName;
- err.badRule = lastMatch.rule;
- throw err;
- }
- return 1;
- }
- lastMatch = match;
- if (match.type === "begin") {
- return doBeginMatch(match);
- } else if (match.type === "illegal" && !ignoreIllegals) {
- const err = new Error('Illegal lexeme "' + lexeme + '" for mode "' + (top.scope || "") + '"');
- err.mode = top;
- throw err;
- } else if (match.type === "end") {
- const processed = doEndMatch(match);
- if (processed !== NO_MATCH) {
- return processed;
- }
- }
- if (match.type === "illegal" && lexeme === "") {
- modeBuffer += "\n";
- return 1;
- }
- if (iterations > 1e5 && iterations > match.index * 3) {
- const err = new Error("potential infinite loop, way more iterations than matches");
- throw err;
- }
- modeBuffer += lexeme;
- return lexeme.length;
- }
- const language = getLanguage(languageName);
- if (!language) {
- error(LANGUAGE_NOT_FOUND.replace("{}", languageName));
- throw new Error('Unknown language: "' + languageName + '"');
- }
- const md = compileLanguage(language);
- let result = "";
- let top = continuation || md;
- const continuations = {};
- const emitter = new options.__emitter(options);
- processContinuations();
- let modeBuffer = "";
- let relevance = 0;
- let index2 = 0;
- let iterations = 0;
- let resumeScanAtSamePosition = false;
- try {
- if (!language.__emitTokens) {
- top.matcher.considerAll();
- for (; ; ) {
- iterations++;
- if (resumeScanAtSamePosition) {
- resumeScanAtSamePosition = false;
- } else {
- top.matcher.considerAll();
- }
- top.matcher.lastIndex = index2;
- const match = top.matcher.exec(codeToHighlight);
- if (!match) break;
- const beforeMatch = codeToHighlight.substring(index2, match.index);
- const processedCount = processLexeme(beforeMatch, match);
- index2 = match.index + processedCount;
- }
- processLexeme(codeToHighlight.substring(index2));
- } else {
- language.__emitTokens(codeToHighlight, emitter);
- }
- emitter.finalize();
- result = emitter.toHTML();
- return {
- language: languageName,
- value: result,
- relevance,
- illegal: false,
- _emitter: emitter,
- _top: top
- };
- } catch (err) {
- if (err.message && err.message.includes("Illegal")) {
- return {
- language: languageName,
- value: escape2(codeToHighlight),
- illegal: true,
- relevance: 0,
- _illegalBy: {
- message: err.message,
- index: index2,
- context: codeToHighlight.slice(index2 - 100, index2 + 100),
- mode: err.mode,
- resultSoFar: result
- },
- _emitter: emitter
- };
- } else if (SAFE_MODE) {
- return {
- language: languageName,
- value: escape2(codeToHighlight),
- illegal: false,
- relevance: 0,
- errorRaised: err,
- _emitter: emitter,
- _top: top
- };
- } else {
- throw err;
- }
- }
- }
- function justTextHighlightResult(code) {
- const result = {
- value: escape2(code),
- illegal: false,
- relevance: 0,
- _top: PLAINTEXT_LANGUAGE,
- _emitter: new options.__emitter(options)
- };
- result._emitter.addText(code);
- return result;
- }
- function highlightAuto(code, languageSubset) {
- languageSubset = languageSubset || options.languages || Object.keys(languages);
- const plaintext = justTextHighlightResult(code);
- const results = languageSubset.filter(getLanguage).filter(autoDetection).map(
- (name) => _highlight(name, code, false)
- );
- results.unshift(plaintext);
- const sorted = results.sort((a2, b2) => {
- if (a2.relevance !== b2.relevance) return b2.relevance - a2.relevance;
- if (a2.language && b2.language) {
- if (getLanguage(a2.language).supersetOf === b2.language) {
- return 1;
- } else if (getLanguage(b2.language).supersetOf === a2.language) {
- return -1;
- }
- }
- return 0;
- });
- const [best, secondBest] = sorted;
- const result = best;
- result.secondBest = secondBest;
- return result;
- }
- function updateClassName(element, currentLang, resultLang) {
- const language = currentLang && aliases[currentLang] || resultLang;
- element.classList.add("hljs");
- element.classList.add(`language-${language}`);
- }
- function highlightElement(element) {
- let node = null;
- const language = blockLanguage(element);
- if (shouldNotHighlight(language)) return;
- fire(
- "before:highlightElement",
- { el: element, language }
- );
- if (element.dataset.highlighted) {
- console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.", element);
- return;
- }
- if (element.children.length > 0) {
- if (!options.ignoreUnescapedHTML) {
- console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk.");
- console.warn("https://github.com/highlightjs/highlight.js/wiki/security");
- console.warn("The element with unescaped HTML:");
- console.warn(element);
- }
- if (options.throwUnescapedHTML) {
- const err = new HTMLInjectionError(
- "One of your code blocks includes unescaped HTML.",
- element.innerHTML
- );
- throw err;
- }
- }
- node = element;
- const text = node.textContent;
- const result = language ? highlight2(text, { language, ignoreIllegals: true }) : highlightAuto(text);
- element.innerHTML = result.value;
- element.dataset.highlighted = "yes";
- updateClassName(element, language, result.language);
- element.result = {
- language: result.language,
- // TODO: remove with version 11.0
- re: result.relevance,
- relevance: result.relevance
- };
- if (result.secondBest) {
- element.secondBest = {
- language: result.secondBest.language,
- relevance: result.secondBest.relevance
- };
- }
- fire("after:highlightElement", { el: element, result, text });
- }
- function configure(userOptions) {
- options = inherit(options, userOptions);
- }
- const initHighlighting = () => {
- highlightAll();
- deprecated("10.6.0", "initHighlighting() deprecated. Use highlightAll() now.");
- };
- function initHighlightingOnLoad() {
- highlightAll();
- deprecated("10.6.0", "initHighlightingOnLoad() deprecated. Use highlightAll() now.");
- }
- let wantsHighlight = false;
- function highlightAll() {
- function boot() {
- highlightAll();
- }
- if (document.readyState === "loading") {
- if (!wantsHighlight) {
- window.addEventListener("DOMContentLoaded", boot, false);
- }
- wantsHighlight = true;
- return;
- }
- const blocks = document.querySelectorAll(options.cssSelector);
- blocks.forEach(highlightElement);
- }
- function registerLanguage(languageName, languageDefinition) {
- let lang = null;
- try {
- lang = languageDefinition(hljs);
- } catch (error$1) {
- error("Language definition for '{}' could not be registered.".replace("{}", languageName));
- if (!SAFE_MODE) {
- throw error$1;
- } else {
- error(error$1);
- }
- lang = PLAINTEXT_LANGUAGE;
- }
- if (!lang.name) lang.name = languageName;
- languages[languageName] = lang;
- lang.rawDefinition = languageDefinition.bind(null, hljs);
- if (lang.aliases) {
- registerAliases(lang.aliases, { languageName });
- }
- }
- function unregisterLanguage(languageName) {
- delete languages[languageName];
- for (const alias of Object.keys(aliases)) {
- if (aliases[alias] === languageName) {
- delete aliases[alias];
- }
- }
- }
- function listLanguages() {
- return Object.keys(languages);
- }
- function getLanguage(name) {
- name = (name || "").toLowerCase();
- return languages[name] || languages[aliases[name]];
- }
- function registerAliases(aliasList, { languageName }) {
- if (typeof aliasList === "string") {
- aliasList = [aliasList];
- }
- aliasList.forEach((alias) => {
- aliases[alias.toLowerCase()] = languageName;
- });
- }
- function autoDetection(name) {
- const lang = getLanguage(name);
- return lang && !lang.disableAutodetect;
- }
- function upgradePluginAPI(plugin) {
- if (plugin["before:highlightBlock"] && !plugin["before:highlightElement"]) {
- plugin["before:highlightElement"] = (data) => {
- plugin["before:highlightBlock"](
- Object.assign({ block: data.el }, data)
- );
- };
- }
- if (plugin["after:highlightBlock"] && !plugin["after:highlightElement"]) {
- plugin["after:highlightElement"] = (data) => {
- plugin["after:highlightBlock"](
- Object.assign({ block: data.el }, data)
- );
- };
- }
- }
- function addPlugin(plugin) {
- upgradePluginAPI(plugin);
- plugins.push(plugin);
- }
- function removePlugin(plugin) {
- const index2 = plugins.indexOf(plugin);
- if (index2 !== -1) {
- plugins.splice(index2, 1);
- }
- }
- function fire(event, args) {
- const cb = event;
- plugins.forEach(function(plugin) {
- if (plugin[cb]) {
- plugin[cb](args);
- }
- });
- }
- function deprecateHighlightBlock(el) {
- deprecated("10.7.0", "highlightBlock will be removed entirely in v12.0");
- deprecated("10.7.0", "Please use highlightElement now.");
- return highlightElement(el);
- }
- Object.assign(hljs, {
- highlight: highlight2,
- highlightAuto,
- highlightAll,
- highlightElement,
- // TODO: Remove with v12 API
- highlightBlock: deprecateHighlightBlock,
- configure,
- initHighlighting,
- initHighlightingOnLoad,
- registerLanguage,
- unregisterLanguage,
- listLanguages,
- getLanguage,
- registerAliases,
- autoDetection,
- inherit,
- addPlugin,
- removePlugin
- });
- hljs.debugMode = function() {
- SAFE_MODE = false;
- };
- hljs.safeMode = function() {
- SAFE_MODE = true;
- };
- hljs.versionString = version2;
- hljs.regex = {
- concat,
- lookahead,
- either,
- optional,
- anyNumberOfTimes
- };
- for (const key in MODES) {
- if (typeof MODES[key] === "object") {
- deepFreeze(MODES[key]);
- }
- }
- Object.assign(hljs, MODES);
- return hljs;
- };
- const highlight = HLJS({});
- highlight.newInstance = () => HLJS({});
- core = highlight;
- highlight.HighlightJS = highlight;
- highlight.default = highlight;
- return core;
-}
-var xml_1;
-var hasRequiredXml;
-function requireXml() {
- if (hasRequiredXml) return xml_1;
- hasRequiredXml = 1;
- function xml(hljs) {
- const regex = hljs.regex;
- const TAG_NAME_RE = regex.concat(/[\p{L}_]/u, regex.optional(/[\p{L}0-9_.-]*:/u), /[\p{L}0-9_.-]*/u);
- const XML_IDENT_RE = /[\p{L}0-9._:-]+/u;
- const XML_ENTITIES = {
- className: "symbol",
- begin: /&[a-z]+;|[0-9]+;|[a-f0-9]+;/
- };
- const XML_META_KEYWORDS = {
- begin: /\s/,
- contains: [
- {
- className: "keyword",
- begin: /#?[a-z_][a-z1-9_-]+/,
- illegal: /\n/
- }
- ]
- };
- const XML_META_PAR_KEYWORDS = hljs.inherit(XML_META_KEYWORDS, {
- begin: /\(/,
- end: /\)/
- });
- const APOS_META_STRING_MODE = hljs.inherit(hljs.APOS_STRING_MODE, { className: "string" });
- const QUOTE_META_STRING_MODE = hljs.inherit(hljs.QUOTE_STRING_MODE, { className: "string" });
- const TAG_INTERNALS = {
- endsWithParent: true,
- illegal: /,
- relevance: 0,
- contains: [
- {
- className: "attr",
- begin: XML_IDENT_RE,
- relevance: 0
- },
- {
- begin: /=\s*/,
- relevance: 0,
- contains: [
- {
- className: "string",
- endsParent: true,
- variants: [
- {
- begin: /"/,
- end: /"/,
- contains: [XML_ENTITIES]
- },
- {
- begin: /'/,
- end: /'/,
- contains: [XML_ENTITIES]
- },
- { begin: /[^\s"'=<>`]+/ }
- ]
- }
- ]
- }
- ]
- };
- return {
- name: "HTML, XML",
- aliases: [
- "html",
- "xhtml",
- "rss",
- "atom",
- "xjb",
- "xsd",
- "xsl",
- "plist",
- "wsf",
- "svg"
- ],
- case_insensitive: true,
- unicodeRegex: true,
- contains: [
- {
- className: "meta",
- begin: //,
- relevance: 10,
- contains: [
- XML_META_KEYWORDS,
- QUOTE_META_STRING_MODE,
- APOS_META_STRING_MODE,
- XML_META_PAR_KEYWORDS,
- {
- begin: /\[/,
- end: /\]/,
- contains: [
- {
- className: "meta",
- begin: //,
- contains: [
- XML_META_KEYWORDS,
- XML_META_PAR_KEYWORDS,
- QUOTE_META_STRING_MODE,
- APOS_META_STRING_MODE
- ]
- }
- ]
- }
- ]
- },
- hljs.COMMENT(
- //,
- { relevance: 10 }
- ),
- {
- begin: //,
- relevance: 10
- },
- XML_ENTITIES,
- // xml processing instructions
- {
- className: "meta",
- end: /\?>/,
- variants: [
- {
- begin: /<\?xml/,
- relevance: 10,
- contains: [
- QUOTE_META_STRING_MODE
- ]
- },
- {
- begin: /<\?[a-z][a-z0-9]+/
- }
- ]
- },
- {
- className: "tag",
- /*
- The lookahead pattern (?=...) ensures that 'begin' only matches
- '