@beeintel/batch-image 1.0.1 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/README.md +188 -184
  2. package/dist/chunks/{AdjustToolPanel-BELqYSUR.js → AdjustToolPanel-BEqQFYEO.js} +30 -29
  3. package/dist/chunks/BackgroundToolPanel-Dw3uT7S-.js +43 -0
  4. package/dist/chunks/{BatchMaterials-niGKrga3.js → BatchMaterials-HiK3VQc3.js} +1 -1
  5. package/dist/chunks/BatchModeChoices-BAslK92y.js +118 -0
  6. package/dist/chunks/{BatchOutputColorPicker-CCvmIF-b.js → BatchOutputColorPicker-CgtnQBA3.js} +1 -1
  7. package/dist/chunks/BatchReferenceFields-DbjXtKC4.js +308 -0
  8. package/dist/chunks/BeautifyToolPanel-imF6jnTG.js +220 -0
  9. package/dist/chunks/{BrandMarkToolPanel-FKxXth_3.js → BrandMarkToolPanel-C-gouhaT.js} +319 -333
  10. package/dist/chunks/{ContentTrimControl-BQfigZPq.js → ContentTrimControl-LgNIZbXa.js} +2 -2
  11. package/dist/chunks/{CropToolPanel-BhSuHkYm.js → CropToolPanel-DsPgFUWI.js} +60 -56
  12. package/dist/chunks/CutoutToolPanel-BhJngz89.js +78 -0
  13. package/dist/chunks/DisclosureToolPanel-DOaWm-im.js +72 -0
  14. package/dist/chunks/ExpandToolPanel-CuufFNiC.js +69 -0
  15. package/dist/chunks/{ImageEffectsToolPanel-BRLPIt4q.js → ImageEffectsToolPanel-BsfBZdYp.js} +63 -52
  16. package/dist/chunks/{IpAuditToolPanel-DfY-mBSe.js → IpAuditToolPanel-DOB7TEoI.js} +15 -13
  17. package/dist/chunks/{ListingToolPanel-B9Yh3LBK.js → ListingToolPanel-Dapetiw-.js} +170 -184
  18. package/dist/chunks/{MaterialSelectionPlate-DhioUjdW.js → MaterialSelectionPlate-BjNttUh8.js} +4 -4
  19. package/dist/chunks/MetadataToolPanel-G56L-VTi.js +116 -0
  20. package/dist/chunks/{OrientToolPanel-BTrwaWBm.js → OrientToolPanel-BJHfMixX.js} +3 -3
  21. package/dist/chunks/PluginActionFooter.vue_vue_type_script_setup_true_lang-DI8W37RA.js +122 -0
  22. package/dist/chunks/ResizeToolPanel-HDDArzWx.js +1171 -0
  23. package/dist/chunks/RetouchToolPanel-Drei3Dj7.js +358 -0
  24. package/dist/chunks/ShadowToolPanel-BM5MRfYB.js +258 -0
  25. package/dist/chunks/SvgExportToolPanel-D3KNi5AS.js +208 -0
  26. package/dist/chunks/TranslationToolPanel-DbNO3IKA.js +104 -0
  27. package/dist/chunks/{UpscaleToolPanel-D0H-j2Tr.js → UpscaleToolPanel-5kT1uUl0.js} +44 -39
  28. package/dist/chunks/arrow-up-DT1zSe8a.js +18 -0
  29. package/dist/chunks/{engine-D-T-1RSx.js → engine-BZ0nkcqj.js} +1 -1
  30. package/dist/chunks/{entry-DK9FjQZ_.js → entry-FNjvjYxd.js} +7512 -7395
  31. package/dist/chunks/{hosted-resources-COzZ7nZY.js → hosted-resources-C3iu_zn4.js} +2 -2
  32. package/dist/chunks/{loader-circle-UFoEem2a.js → loader-circle-pki8gM3_.js} +1 -1
  33. package/dist/chunks/{motionFeatures-D4miwXxc.js → motionFeatures-Cp11tdeb.js} +1 -1
  34. package/dist/chunks/{search-BjTSm1KS.js → search-BNwQCPna.js} +1 -1
  35. package/dist/chunks/{standard-cutout-vPpP6xBc.js → standard-cutout-iIOMfl6q.js} +1 -1
  36. package/dist/chunks/{static-logo-2F9ORZWc.js → static-logo-7HK4ubmZ.js} +1 -1
  37. package/dist/config.d.ts +6 -0
  38. package/dist/index.d.ts +1 -0
  39. package/dist/index.js +6 -5
  40. package/dist/processing.js +3 -3
  41. package/dist/resources.json +113 -103
  42. package/dist/slots.d.ts +2 -0
  43. package/dist/style.css +1 -1
  44. package/dist/tool-links.d.ts +10 -0
  45. package/dist/types/batch/public/config.d.ts +6 -0
  46. package/package.json +95 -95
  47. package/dist/chunks/BackgroundToolPanel-Dy_l8KFl.js +0 -41
  48. package/dist/chunks/BatchModeChoices-BRqn6zNI.js +0 -111
  49. package/dist/chunks/BatchReferenceFields-C4t7OSTw.js +0 -316
  50. package/dist/chunks/BeautifyToolPanel-Dc-ddaBC.js +0 -215
  51. package/dist/chunks/CutoutToolPanel-BfaZZSE_.js +0 -73
  52. package/dist/chunks/DisclosureToolPanel-B_oc5fld.js +0 -76
  53. package/dist/chunks/ExpandToolPanel-D_ZODTUZ.js +0 -67
  54. package/dist/chunks/MetadataToolPanel-KVrtb3K0.js +0 -104
  55. package/dist/chunks/PluginActionFooter.vue_vue_type_script_setup_true_lang-C2kJCYeA.js +0 -102
  56. package/dist/chunks/ResizeToolPanel-Ch_-WR74.js +0 -1178
  57. package/dist/chunks/RetouchToolPanel-BTS33Dsd.js +0 -350
  58. package/dist/chunks/ShadowToolPanel-DxJE4eyV.js +0 -254
  59. package/dist/chunks/SvgExportToolPanel-RHmuQARH.js +0 -219
  60. package/dist/chunks/TranslationToolPanel-B_qTA1hM.js +0 -125
@@ -1,7 +1,7 @@
1
- import { defineComponent as k, openBlock as d, createElementBlock as h, unref as a, Fragment as B, renderList as N, createElementVNode as i, createTextVNode as _, toDisplayString as f, createBlock as V, createCommentVNode as v, normalizeStyle as F, createVNode as g, computed as I, withCtx as p } from "vue";
2
- import { F as P, P as T, R as U, _ as $, G as C } from "./entry-DK9FjQZ_.js";
3
- import { f as j, ap as D } from "./hosted-resources-COzZ7nZY.js";
4
- import { u as R, a as M, c as E, _ as S, n as z } from "./PluginActionFooter.vue_vue_type_script_setup_true_lang-C2kJCYeA.js";
1
+ import { defineComponent as k, openBlock as d, createElementBlock as h, unref as a, Fragment as B, renderList as F, createElementVNode as c, createTextVNode as v, toDisplayString as f, createBlock as V, createCommentVNode as _, normalizeStyle as N, createVNode as g, computed as I, withCtx as p } from "vue";
2
+ import { F as P, P as T, R as U, _ as $, G as C } from "./entry-FNjvjYxd.js";
3
+ import { f as j, ap as D } from "./hosted-resources-C3iu_zn4.js";
4
+ import { u as R, a as M, c as E, _ as S, n as z } from "./PluginActionFooter.vue_vue_type_script_setup_true_lang-DI8W37RA.js";
5
5
  const L = ["disabled", "aria-label"], G = { class: "basic-adjust-label" }, H = ["aria-label", "aria-valuetext", "title", "min", "max", "value", "onInput"], J = ["aria-label", "min", "max", "value", "onInput"], O = ["aria-label"], q = /* @__PURE__ */ k({
6
6
  __name: "BasicAdjustPanel",
7
7
  props: {
@@ -10,8 +10,8 @@ const L = ["disabled", "aria-label"], G = { class: "basic-adjust-label" }, H = [
10
10
  hideReset: { type: Boolean }
11
11
  },
12
12
  emits: ["update:modelValue"],
13
- setup(t, { emit: m }) {
14
- const { ui: l, uiText: n } = P(), o = t, r = m, b = [
13
+ setup(t, { emit: r }) {
14
+ const { ui: l, uiText: n } = P(), o = t, m = r, b = [
15
15
  {
16
16
  key: "brightness",
17
17
  label: "亮度",
@@ -81,35 +81,35 @@ const L = ["disabled", "aria-label"], G = { class: "basic-adjust-label" }, H = [
81
81
  if (o.disabled) return;
82
82
  const e = u.target.value;
83
83
  if (!e.trim()) return;
84
- const c = Number(e);
85
- if (!Number.isFinite(c)) return;
86
- const A = Math.round(Math.min(s.max, Math.max(s.min, c)) * 100) / 100;
87
- r("update:modelValue", { ...o.modelValue, [s.key]: A });
84
+ const i = Number(e);
85
+ if (!Number.isFinite(i)) return;
86
+ const A = Math.round(Math.min(s.max, Math.max(s.min, i)) * 100) / 100;
87
+ m("update:modelValue", { ...o.modelValue, [s.key]: A });
88
88
  }
89
89
  function w() {
90
- o.disabled || r("update:modelValue", { ...j });
90
+ o.disabled || m("update:modelValue", { ...j });
91
91
  }
92
92
  return (s, u) => (d(), h("fieldset", {
93
93
  class: "basic-adjust-panel",
94
94
  disabled: t.disabled,
95
95
  "aria-label": a(l)("tools.adjust.basicAdjustPanel_5eff15b3")
96
96
  }, [
97
- (d(), h(B, null, N(b, (e) => i("div", {
97
+ (d(), h(B, null, F(b, (e) => c("div", {
98
98
  key: e.key,
99
99
  class: "basic-adjust-row"
100
100
  }, [
101
- i("span", G, [
102
- _(f(a(n)(e.label)), 1),
101
+ c("span", G, [
102
+ v(f(a(n)(e.label)), 1),
103
103
  e.neutral === 1 ? (d(), V(T, {
104
104
  key: 0,
105
105
  text: a(l)("common.audit.neutralOne")
106
- }, null, 8, ["text"])) : v("", !0)
106
+ }, null, 8, ["text"])) : _("", !0)
107
107
  ]),
108
- i("span", {
108
+ c("span", {
109
109
  class: "basic-adjust-track",
110
- style: F({ "--adjust-gradient": `linear-gradient(90deg, ${e.gradient})` })
110
+ style: N({ "--adjust-gradient": `linear-gradient(90deg, ${e.gradient})` })
111
111
  }, [
112
- i("input", {
112
+ c("input", {
113
113
  class: "basic-adjust-range",
114
114
  type: "range",
115
115
  "aria-label": a(n)(e.label),
@@ -123,10 +123,10 @@ const L = ["disabled", "aria-label"], G = { class: "basic-adjust-label" }, H = [
123
123
  max: e.max,
124
124
  step: "0.01",
125
125
  value: t.modelValue[e.key],
126
- onInput: (c) => x(e, c)
126
+ onInput: (i) => x(e, i)
127
127
  }, null, 40, H)
128
128
  ], 4),
129
- i("input", {
129
+ c("input", {
130
130
  class: "basic-adjust-number",
131
131
  type: "number",
132
132
  "aria-label": a(l)("tools.adjust.basicAdjustPanel_fb9d3a1e", { p0: a(n)(e.label) }),
@@ -134,10 +134,10 @@ const L = ["disabled", "aria-label"], G = { class: "basic-adjust-label" }, H = [
134
134
  max: e.max,
135
135
  step: "0.01",
136
136
  value: t.modelValue[e.key],
137
- onInput: (c) => x(e, c)
137
+ onInput: (i) => x(e, i)
138
138
  }, null, 40, J)
139
139
  ])), 64)),
140
- t.hideReset ? v("", !0) : (d(), h("button", {
140
+ t.hideReset ? _("", !0) : (d(), h("button", {
141
141
  key: 0,
142
142
  type: "button",
143
143
  class: "basic-adjust-reset",
@@ -145,7 +145,7 @@ const L = ["disabled", "aria-label"], G = { class: "basic-adjust-label" }, H = [
145
145
  onClick: w
146
146
  }, [
147
147
  g(a(U), { size: 14 }),
148
- _(f(a(l)("tools.adjust.basicAdjustPanel_98f4fdf7")), 1)
148
+ v(f(a(l)("tools.adjust.basicAdjustPanel_98f4fdf7")), 1)
149
149
  ], 8, O))
150
150
  ], 8, L));
151
151
  }
@@ -155,8 +155,8 @@ const L = ["disabled", "aria-label"], G = { class: "basic-adjust-label" }, H = [
155
155
  context: {}
156
156
  },
157
157
  setup(t) {
158
- const { ui: m } = P(), l = t, n = R(() => l.context), o = I(() => D(n.value.adjust));
159
- function r() {
158
+ const { ui: r } = P(), l = t, n = R(() => l.context), o = I(() => D(n.value.adjust));
159
+ function m() {
160
160
  l.context.resetDraft({ adjust: { ...j } });
161
161
  }
162
162
  const b = M(() => l.context, "adjust");
@@ -164,19 +164,20 @@ const L = ["disabled", "aria-label"], G = { class: "basic-adjust-label" }, H = [
164
164
  context: t.context,
165
165
  layout: "contained",
166
166
  changed: a(E)(a(n).adjust, a(j)),
167
- onReset: r
167
+ onReset: m
168
168
  }, {
169
169
  actions: p(() => [
170
170
  g(S, {
171
171
  context: t.context,
172
172
  available: a(z)(t.context),
173
- ready: !o.value
173
+ ready: !o.value,
174
+ label: o.value && t.context.view.count > 0 ? a(r)("common.audit.adjustFirst") : void 0
174
175
  }, {
175
176
  default: p(() => [
176
- i("p", Q, f(a(m)("common.audit.saveVersion")), 1)
177
+ c("p", Q, f(a(r)("common.audit.saveVersion")), 1)
177
178
  ]),
178
179
  _: 1
179
- }, 8, ["context", "available", "ready"])
180
+ }, 8, ["context", "available", "ready", "label"])
180
181
  ]),
181
182
  default: p(() => [
182
183
  g(K, {
@@ -0,0 +1,43 @@
1
+ import { defineComponent as r, openBlock as u, createBlock as m, unref as o, withCtx as n, createElementVNode as t, toDisplayString as f, createVNode as c } from "vue";
2
+ import { F as x, G as b, _ as p } from "./entry-FNjvjYxd.js";
3
+ import { u as P, _ as g, n as k } from "./PluginActionFooter.vue_vue_type_script_setup_true_lang-DI8W37RA.js";
4
+ import { B as v } from "./BatchOutputColorPicker-CgtnQBA3.js";
5
+ const B = ["disabled"], _ = { class: "output-color-field" }, h = /* @__PURE__ */ r({
6
+ __name: "BackgroundToolPanel",
7
+ props: {
8
+ context: {}
9
+ },
10
+ setup(e) {
11
+ const { ui: a } = x(), d = e, s = P(() => d.context);
12
+ return (C, l) => (u(), m(b, {
13
+ context: e.context,
14
+ help: o(a)("common.toolPanel_018bab40")
15
+ }, {
16
+ actions: n(() => [
17
+ c(g, {
18
+ context: e.context,
19
+ available: o(k)(e.context)
20
+ }, null, 8, ["context", "available"])
21
+ ]),
22
+ default: n(() => [
23
+ t("fieldset", {
24
+ class: "tool-fields plugin-fields",
25
+ disabled: e.context.readonly
26
+ }, [
27
+ t("div", _, [
28
+ t("span", null, f(o(a)("common.toolPanel_243779ee")), 1),
29
+ c(v, {
30
+ "model-value": o(s).backgroundColor,
31
+ disabled: e.context.readonly,
32
+ "onUpdate:modelValue": l[0] || (l[0] = (i) => e.context.updateDraft({ backgroundColor: i }))
33
+ }, null, 8, ["model-value", "disabled"])
34
+ ])
35
+ ], 8, B)
36
+ ]),
37
+ _: 1
38
+ }, 8, ["context", "help"]));
39
+ }
40
+ }), I = /* @__PURE__ */ p(h, [["__scopeId", "data-v-7ff739ca"]]);
41
+ export {
42
+ I as default
43
+ };
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as we, ref as pe, watch as U, onBeforeUnmount as xe, openBlock as ee, createElementBlock as ye, withModifiers as Be, normalizeStyle as De, Fragment as Te, renderList as Ae, createElementVNode as Fe, toDisplayString as ze, createCommentVNode as Ie, nextTick as We, computed as He, onMounted as Ne, createBlock as qe } from "vue";
2
- import { D as Xe, E as _e } from "./entry-DK9FjQZ_.js";
2
+ import { D as Xe, E as _e } from "./entry-FNjvjYxd.js";
3
3
  const V = {
4
4
  regular: {
5
5
  refractionCssPx: 9,
@@ -0,0 +1,118 @@
1
+ import { defineComponent as L, openBlock as t, createElementBlock as n, createElementVNode as s, createTextVNode as M, toDisplayString as b, unref as r, createBlock as v, createCommentVNode as m, Fragment as h, renderList as f } from "vue";
2
+ import { F as C, D as V, P as _, _ as A } from "./entry-FNjvjYxd.js";
3
+ const D = { class: "batch-mode-choices" }, N = { class: "mode-label" }, E = ["aria-label"], H = ["aria-label", "aria-pressed", "disabled", "onClick", "onKeydown"], I = ["src"], P = {
4
+ key: 1,
5
+ viewBox: "0 0 120 76",
6
+ "aria-hidden": "true"
7
+ }, S = {
8
+ fill: "#f3f5ed",
9
+ stroke: "#899774",
10
+ "stroke-width": "1.4"
11
+ }, T = ["y"], F = ["y"], K = { key: 2 }, R = /* @__PURE__ */ L({
12
+ __name: "BatchModeChoices",
13
+ props: {
14
+ modelValue: {},
15
+ label: {},
16
+ help: {},
17
+ options: {},
18
+ disabled: { type: Boolean }
19
+ },
20
+ emits: ["update:modelValue"],
21
+ setup(o, { emit: g }) {
22
+ const { ui: q, uiText: d, batchI18n: x } = C(), { displayState: w } = V(), u = o, p = g;
23
+ function y(i) {
24
+ !u.disabled && !i.disabled && p("update:modelValue", i.value);
25
+ }
26
+ function B(i, l) {
27
+ if (!["ArrowLeft", "ArrowRight"].includes(i.key)) return;
28
+ i.preventDefault(), i.stopPropagation();
29
+ const e = (i.key === "ArrowRight" ? 1 : -1) * (w.value.direction === "rtl" ? -1 : 1), a = u.options.indexOf(l);
30
+ for (let c = a + e; c >= 0 && c < u.options.length; c += e) {
31
+ const k = u.options[c];
32
+ if (!(k.disabled || u.disabled)) {
33
+ y(k), i.currentTarget.parentElement?.querySelectorAll("button")[c]?.focus();
34
+ break;
35
+ }
36
+ }
37
+ }
38
+ return (i, l) => (t(), n("section", D, [
39
+ s("span", N, [
40
+ M(b(r(d)(o.label)), 1),
41
+ o.help ? (t(), v(_, {
42
+ key: 0,
43
+ text: o.help
44
+ }, null, 8, ["text"])) : m("", !0)
45
+ ]),
46
+ s("div", {
47
+ class: "mode-options",
48
+ role: "group",
49
+ "aria-label": r(d)(o.label)
50
+ }, [
51
+ (t(!0), n(h, null, f(o.options, (e) => (t(), n("button", {
52
+ key: e.value,
53
+ type: "button",
54
+ "aria-label": r(d)(o.label) + (r(x).global.locale.value === "zh-CN" ? ":" : ": ") + r(d)(e.label),
55
+ "aria-pressed": o.modelValue === e.value,
56
+ disabled: o.disabled || e.disabled,
57
+ onClick: (a) => y(e),
58
+ onKeydown: (a) => B(a, e)
59
+ }, [
60
+ e.image ? (t(), n("img", {
61
+ key: 0,
62
+ src: e.image,
63
+ alt: ""
64
+ }, null, 8, I)) : e.flow ? (t(), n("svg", P, [
65
+ s("g", S, [
66
+ e.flow === "one-to-many" ? (t(), n(h, { key: 0 }, [
67
+ l[0] || (l[0] = s("rect", {
68
+ x: "8",
69
+ y: "26",
70
+ width: "25",
71
+ height: "26",
72
+ rx: "4"
73
+ }, null, -1)),
74
+ (t(), n(h, null, f([5, 28, 51], (a) => s("rect", {
75
+ key: a,
76
+ x: "87",
77
+ y: a,
78
+ width: "25",
79
+ height: "20",
80
+ rx: "3"
81
+ }, null, 8, T)), 64)),
82
+ l[1] || (l[1] = s("path", {
83
+ d: "M39 39H76M65 31L77 39L65 47M83 15L77 39L83 61",
84
+ fill: "none"
85
+ }, null, -1))
86
+ ], 64)) : (t(), n(h, { key: 1 }, [
87
+ (t(), n(h, null, f([5, 28, 51], (a) => s("rect", {
88
+ key: a,
89
+ x: "8",
90
+ y: a,
91
+ width: "25",
92
+ height: "20",
93
+ rx: "3"
94
+ }, null, 8, F)), 64)),
95
+ l[2] || (l[2] = s("rect", {
96
+ x: "87",
97
+ y: "26",
98
+ width: "25",
99
+ height: "26",
100
+ rx: "4"
101
+ }, null, -1)),
102
+ l[3] || (l[3] = s("path", {
103
+ d: "M39 15L45 39L39 61M46 39H77M65 31L77 39L65 47",
104
+ fill: "none"
105
+ }, null, -1))
106
+ ], 64))
107
+ ])
108
+ ])) : m("", !0),
109
+ s("strong", null, b(r(d)(e.label)), 1),
110
+ e.description ? (t(), n("small", K, b(r(d)(e.description)), 1)) : m("", !0)
111
+ ], 40, H))), 128))
112
+ ], 8, E)
113
+ ]));
114
+ }
115
+ }), U = /* @__PURE__ */ A(R, [["__scopeId", "data-v-18df4a83"]]);
116
+ export {
117
+ U as B
118
+ };
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as _, ref as p, computed as b, watch as w, openBlock as P, createElementBlock as V, unref as o, createElementVNode as s, normalizeClass as h, normalizeStyle as B } from "vue";
2
- import { F as y, _ as g } from "./entry-DK9FjQZ_.js";
2
+ import { F as y, _ as g } from "./entry-FNjvjYxd.js";
3
3
  const $ = ["aria-label"], I = ["title", "aria-label", "aria-pressed", "disabled"], S = ["title", "aria-label", "aria-pressed", "disabled"], z = ["data-selected", "title"], E = ["aria-label", "value", "disabled"], L = /* @__PURE__ */ _({
4
4
  __name: "BatchOutputColorPicker",
5
5
  props: {
@@ -0,0 +1,308 @@
1
+ import { defineComponent as Y, inject as Z, ref as R, computed as B, watch as j, onUnmounted as ee, openBlock as f, createElementBlock as v, unref as t, normalizeClass as ae, createElementVNode as n, createTextVNode as V, toDisplayString as u, createBlock as te, createCommentVNode as w, Fragment as A, renderList as T, createVNode as C, nextTick as M } from "vue";
2
+ import { J as le, aP as re, F as ne, aa as oe, aQ as se, av as ie, P as ce, ai as ue, ag as de, ax as fe, _ as me } from "./entry-FNjvjYxd.js";
3
+ import { A as ve } from "./arrow-up-DT1zSe8a.js";
4
+ import { L as be } from "./loader-circle-pki8gM3_.js";
5
+ /**
6
+ * @license @lucide/vue v1.47.0 - ISC
7
+ *
8
+ * This source code is licensed under the ISC license.
9
+ * See the LICENSE file in the root directory of this source tree.
10
+ */
11
+ const pe = {
12
+ name: "arrow-down",
13
+ size: 24,
14
+ node: [
15
+ ["path", { d: "M12 5v14", key: "s699le" }],
16
+ ["path", { d: "m19 12-7 7-7-7", key: "1idqje" }]
17
+ ]
18
+ }, he = le(pe), ge = ["aria-label"], we = { class: "retouch-reference-heading" }, ye = ["aria-label", "disabled"], ke = { class: "retouch-reference-list" }, Fe = { class: "retouch-reference-title" }, Re = ["src", "alt"], Ve = { class: "reference-number" }, Ce = ["aria-label", "disabled", "onClick"], Le = ["title"], Ue = { class: "reference-settings" }, Ie = { class: "reference-order" }, _e = ["aria-label", "disabled", "onClick"], Ee = ["aria-label", "disabled", "onClick"], Ne = { key: 0 }, Oe = ["aria-label", "value", "disabled", "onChange"], Pe = { value: "" }, $e = ["value"], ze = ["aria-label", "value", "disabled", "placeholder", "onInput"], De = {
19
+ key: 0,
20
+ class: "reference-pending",
21
+ role: "status"
22
+ }, Be = {
23
+ key: 1,
24
+ class: "reference-add"
25
+ }, je = ["aria-label", "disabled"], Ae = { class: "reference-upload-copy" }, Te = {
26
+ key: 0,
27
+ class: "tool-note",
28
+ role: "alert"
29
+ }, Me = ["aria-label", "disabled"], Se = {
30
+ key: 1,
31
+ role: "alert",
32
+ class: "retouch-error"
33
+ }, He = /* @__PURE__ */ Y({
34
+ __name: "BatchReferenceFields",
35
+ props: {
36
+ modelValue: {},
37
+ writer: { type: Boolean },
38
+ candidates: { default: () => [] },
39
+ roles: { default: () => [] },
40
+ defaultRoleLabel: { default: "" },
41
+ maxCount: { default: re },
42
+ title: { default: "共用参考图" },
43
+ description: { default: "整批共用同一组。每张待改图为图 1,参考依顺序为图 2–11;用途可选,具体修改以文字要求为准。" },
44
+ numberOffset: { default: 2 },
45
+ uploadLabel: { default: "上传参考图" },
46
+ confirmLabel: { default: "确认当前参考集合" },
47
+ purposePlaceholder: { default: "例如:只参考颜色,不复制商品" }
48
+ },
49
+ emits: ["update:modelValue", "busy"],
50
+ setup(a, { emit: S }) {
51
+ const { ui: c, uiText: m } = ne(), { uploadLocal: H } = oe(), W = Z(
52
+ se,
53
+ (e) => H(e, e.name)
54
+ ), o = a, _ = S, X = ie(() => o.modelValue.references), E = R(), d = R(0), p = R(""), q = B(() => p.value ? c({
55
+ capacity: "common.referenceFields_5f066788",
56
+ format: "common.referenceFields_7bf5d70a",
57
+ upload: "common.referenceFields_dc2e4820"
58
+ }[p.value], {
59
+ p0: p.value === "capacity" ? o.maxCount : m(o.title)
60
+ }) : ""), L = R(!1), h = R(/* @__PURE__ */ new Map());
61
+ let y = !1, k = 0;
62
+ const F = (e) => `${e.assetId}:${e.assetVersionId}`, U = B(
63
+ () => Math.max(0, o.maxCount - o.modelValue.references.length - d.value)
64
+ );
65
+ j(d, (e) => _("busy", e > 0), { immediate: !0 }), j(
66
+ () => o.writer,
67
+ (e) => {
68
+ e || k++;
69
+ }
70
+ );
71
+ function g(e) {
72
+ !o.writer || y || _("update:modelValue", {
73
+ references: o.modelValue.references,
74
+ referenceUploadNeedsReview: o.modelValue.referenceUploadNeedsReview,
75
+ ...e
76
+ });
77
+ }
78
+ function N(e, s) {
79
+ g({
80
+ references: o.modelValue.references.map(
81
+ (l, r) => r === e ? { ...l, ...s } : l
82
+ )
83
+ });
84
+ }
85
+ function O(e, s) {
86
+ const l = [...o.modelValue.references], r = e + s;
87
+ r < 0 || r >= l.length || ([l[e], l[r]] = [l[r], l[e]], g({ references: l }));
88
+ }
89
+ function J(e) {
90
+ if (!o.writer) return;
91
+ const s = o.modelValue.references[e];
92
+ if (!s) return;
93
+ const l = F(s), r = h.value.get(l);
94
+ o.modelValue.references.some((i, b) => b !== e && F(i) === l) || (r && URL.revokeObjectURL(r), h.value.delete(l)), g({ references: o.modelValue.references.filter((i, b) => b !== e) });
95
+ }
96
+ function P(e) {
97
+ return X.get(e) || h.value.get(F(e)) || "";
98
+ }
99
+ async function K(e) {
100
+ const s = e.target, l = [...s.files ?? []];
101
+ s.value = "", await I(l);
102
+ }
103
+ function Q(e) {
104
+ e.dataTransfer?.types.includes("Files") && (e.preventDefault(), e.stopPropagation(), L.value = o.writer && !d.value && !!U.value);
105
+ }
106
+ async function x(e) {
107
+ e.dataTransfer?.types.includes("Files") && (e.preventDefault(), e.stopPropagation(), L.value = !1, await I([...e.dataTransfer.files ?? []]));
108
+ }
109
+ function G(e) {
110
+ const s = fe(e);
111
+ s.length && (e.preventDefault(), e.stopPropagation(), I(s));
112
+ }
113
+ async function I(e) {
114
+ if (!e.length || !o.writer || d.value) return;
115
+ if (p.value = "", e.length > U.value) {
116
+ p.value = "capacity";
117
+ return;
118
+ }
119
+ if (e.some(
120
+ (i) => !["image/png", "image/jpeg", "image/webp"].includes(i.type) || !i.size || i.size > 25 * 1024 * 1024
121
+ )) {
122
+ p.value = "format";
123
+ return;
124
+ }
125
+ const s = !!o.modelValue.referenceUploadNeedsReview, l = k;
126
+ let r = !1;
127
+ g({ referenceUploadNeedsReview: !0 }), d.value = e.length;
128
+ try {
129
+ for (const i of e) {
130
+ if (y || !o.writer || l !== k) return;
131
+ try {
132
+ const b = await W(i);
133
+ if (y || !o.writer || l !== k) return;
134
+ if (!b.assetId || !b.assetVersionId || !/^[a-fA-F0-9]{64}$/.test(b.sha256))
135
+ throw new Error("Invalid upload receipt");
136
+ const $ = {
137
+ assetId: b.assetId,
138
+ assetVersionId: b.assetVersionId,
139
+ sha256: b.sha256,
140
+ name: i.name
141
+ }, z = F($), D = h.value.get(z);
142
+ D && URL.revokeObjectURL(D), h.value.set(z, URL.createObjectURL(i)), g({ references: [...o.modelValue.references, $] }), await M();
143
+ } catch {
144
+ r = !0, y || (p.value = "upload");
145
+ } finally {
146
+ d.value--;
147
+ }
148
+ }
149
+ await M(), !y && o.writer && l === k && !r && !s && g({ referenceUploadNeedsReview: !1 });
150
+ } finally {
151
+ d.value = 0;
152
+ }
153
+ }
154
+ return ee(() => {
155
+ y = !0;
156
+ for (const e of h.value.values()) URL.revokeObjectURL(e);
157
+ h.value.clear();
158
+ }), (e, s) => (f(), v("section", {
159
+ tabindex: "0",
160
+ onPaste: G,
161
+ class: ae(["retouch-references", { dragging: L.value }]),
162
+ "aria-label": t(m)(a.title),
163
+ onDragover: Q,
164
+ onDragleave: s[2] || (s[2] = (l) => L.value = !1),
165
+ onDrop: x
166
+ }, [
167
+ n("div", we, [
168
+ n("strong", null, [
169
+ V(u(t(m)(a.title)), 1),
170
+ a.description ? (f(), te(ce, {
171
+ key: 0,
172
+ text: t(m)(a.description)
173
+ }, null, 8, ["text"])) : w("", !0)
174
+ ]),
175
+ n("span", null, u(a.modelValue.references.length) + " / " + u(a.maxCount), 1)
176
+ ]),
177
+ n("input", {
178
+ ref_key: "fileInput",
179
+ ref: E,
180
+ type: "file",
181
+ accept: "image/png,image/jpeg,image/webp",
182
+ multiple: "",
183
+ class: "retouch-file-input",
184
+ "aria-label": t(m)(a.uploadLabel),
185
+ disabled: !a.writer || d.value > 0 || !U.value,
186
+ onChange: K
187
+ }, null, 40, ye),
188
+ n("ol", ke, [
189
+ (f(!0), v(A, null, T(a.modelValue.references, (l, r) => (f(), v("li", {
190
+ key: `${F(l)}:${r}`,
191
+ class: "retouch-reference batch-reference"
192
+ }, [
193
+ n("div", Fe, [
194
+ P(l) ? (f(), v("img", {
195
+ key: 0,
196
+ src: P(l),
197
+ alt: l.name,
198
+ loading: "lazy"
199
+ }, null, 8, Re)) : w("", !0),
200
+ n("strong", Ve, u(t(c)("common.referenceFields_d7084142", { p0: r + a.numberOffset })), 1),
201
+ n("button", {
202
+ type: "button",
203
+ "aria-label": t(c)("common.referenceFields_405c85b2", { p0: r + a.numberOffset }),
204
+ disabled: !a.writer,
205
+ onClick: (i) => J(r)
206
+ }, [
207
+ C(t(ue), { size: 14 })
208
+ ], 8, Ce)
209
+ ]),
210
+ n("small", {
211
+ class: "reference-name",
212
+ title: l.name
213
+ }, u(l.name), 9, Le),
214
+ n("details", Ue, [
215
+ n("summary", null, u(t(c)("common.referenceFields_75359a48")), 1),
216
+ n("div", Ie, [
217
+ n("button", {
218
+ type: "button",
219
+ "aria-label": t(c)("common.referenceFields_8aa5f1b3", { p0: r + a.numberOffset }),
220
+ disabled: !a.writer || r === 0 || d.value > 0,
221
+ onClick: (i) => O(r, -1)
222
+ }, [
223
+ C(t(ve), { size: 14 }),
224
+ V(u(t(c)("common.referenceFields_708c9687")), 1)
225
+ ], 8, _e),
226
+ n("button", {
227
+ type: "button",
228
+ "aria-label": t(c)("common.referenceFields_18e2d946", { p0: r + a.numberOffset }),
229
+ disabled: !a.writer || r === a.modelValue.references.length - 1 || d.value > 0,
230
+ onClick: (i) => O(r, 1)
231
+ }, [
232
+ C(t(he), { size: 14 }),
233
+ V(u(t(c)("common.referenceFields_c0714215")), 1)
234
+ ], 8, Ee)
235
+ ]),
236
+ a.roles.length ? (f(), v("label", Ne, [
237
+ V(u(t(c)("common.referenceFields_76335454")), 1),
238
+ n("select", {
239
+ "aria-label": t(c)("common.referenceFields_1e100229", { p0: r + a.numberOffset }),
240
+ value: l.role ?? "",
241
+ disabled: !a.writer,
242
+ onChange: (i) => N(r, {
243
+ role: i.target.value || void 0
244
+ })
245
+ }, [
246
+ n("option", Pe, u(a.defaultRoleLabel ? t(c)("common.referenceFields_0acbcb84", {
247
+ p0: t(m)(a.defaultRoleLabel)
248
+ }) : t(c)("common.referenceFields_f91a63a1")), 1),
249
+ (f(!0), v(A, null, T(a.roles, (i) => (f(), v("option", {
250
+ key: i.value,
251
+ value: i.value
252
+ }, u(t(m)(i.label)), 9, $e))), 128))
253
+ ], 40, Oe)
254
+ ])) : w("", !0),
255
+ n("label", null, [
256
+ V(u(t(c)("common.referenceFields_d59f7895")), 1),
257
+ n("input", {
258
+ "aria-label": t(c)("common.referenceFields_17d29b80", { p0: r + a.numberOffset }),
259
+ value: l.purpose,
260
+ disabled: !a.writer,
261
+ maxlength: "500",
262
+ placeholder: t(m)(a.purposePlaceholder),
263
+ onInput: (i) => N(r, { purpose: i.target.value })
264
+ }, null, 40, ze)
265
+ ])
266
+ ])
267
+ ]))), 128)),
268
+ d.value ? (f(), v("li", De, [
269
+ C(t(be), { size: 22 }),
270
+ n("span", null, u(t(c)("common.referenceFields_d8690492", { p0: d.value })), 1)
271
+ ])) : w("", !0),
272
+ !d.value && U.value ? (f(), v("li", Be, [
273
+ n("button", {
274
+ type: "button",
275
+ class: "retouch-add-card",
276
+ "aria-label": t(c)("common.referenceFields_bdb86a11", { p0: t(m)(a.title) }),
277
+ disabled: !a.writer,
278
+ onClick: s[0] || (s[0] = (l) => E.value?.click())
279
+ }, [
280
+ C(t(de), { size: 25 }),
281
+ n("span", Ae, [
282
+ n("strong", null, u(t(c)("common.app_9f0d4e46")), 1),
283
+ n("small", null, u(t(c)("common.referenceFields_e4eea1f1")), 1)
284
+ ])
285
+ ], 8, je)
286
+ ])) : w("", !0)
287
+ ]),
288
+ a.modelValue.referenceUploadNeedsReview && !d.value ? (f(), v("div", Te, [
289
+ n("p", null, u(t(c)("common.referenceFields_20637ce7", {
290
+ p0: t(m)(a.title),
291
+ p1: a.modelValue.references.length
292
+ })), 1),
293
+ n("button", {
294
+ type: "button",
295
+ "aria-label": t(m)(a.confirmLabel),
296
+ disabled: !a.writer || d.value > 0,
297
+ onClick: s[1] || (s[1] = (l) => {
298
+ g({ referenceUploadNeedsReview: !1 }), p.value = "";
299
+ })
300
+ }, u(t(c)("common.referenceFields_850fe99f")), 9, Me)
301
+ ])) : w("", !0),
302
+ p.value ? (f(), v("p", Se, u(q.value), 1)) : w("", !0)
303
+ ], 42, ge));
304
+ }
305
+ }), Ke = /* @__PURE__ */ me(He, [["__scopeId", "data-v-473a5b18"]]);
306
+ export {
307
+ Ke as B
308
+ };