@beeintel/batch-image 0.0.0-stage → 1.0.0
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.
- package/FONT-LICENSE.txt +93 -0
- package/README.md +181 -2
- package/dist/assets/11st-D7qGO5e4.webp +0 -0
- package/dist/assets/UPNG-CPfdwFSy.js +2298 -0
- package/dist/assets/adjust-card-B63b81iV.webp +0 -0
- package/dist/assets/adjust-final.worker-C2JbTvv5.js +6945 -0
- package/dist/assets/amazon-CjTtpZTq.webp +0 -0
- package/dist/assets/ascii_art-B4UGbtGs.webp +0 -0
- package/dist/assets/auction-j26eVUQO.webp +0 -0
- package/dist/assets/background-DGdZUdkL.webp +0 -0
- package/dist/assets/background-card-wK7DRpvM.png +0 -0
- package/dist/assets/body-CUFdRg8w.webp +0 -0
- package/dist/assets/bounded-cutout.worker-BZR6mbaI.js +9615 -0
- package/dist/assets/brand-mark-card-cFUeDeO2.webp +0 -0
- package/dist/assets/buyma-dAxYNjow.webp +0 -0
- package/dist/assets/codec.worker-7W6hmsm6.js +7349 -0
- package/dist/assets/contour_lines-C_CqrgV1.webp +0 -0
- package/dist/assets/creema-B1tWyCPx.webp +0 -0
- package/dist/assets/crop-final.worker-Owin7TvX.js +7035 -0
- package/dist/assets/cutout-CzMvV5An.webp +0 -0
- package/dist/assets/cutout-card-CN4gNFBz.png +0 -0
- package/dist/assets/cutout.worker-DyH6Prbn.js +3894 -0
- package/dist/assets/depop-CkVC5Fn1.webp +0 -0
- package/dist/assets/dewrinkle-kFzP6LqD.webp +0 -0
- package/dist/assets/dither-CcxmO2e6.webp +0 -0
- package/dist/assets/douyin-CP_HwBDF.webp +0 -0
- package/dist/assets/download.worker-DnGSB6P_.js +17779 -0
- package/dist/assets/duotone-Cdg_3fQf.webp +0 -0
- package/dist/assets/ebay-CxLfrRAf.webp +0 -0
- package/dist/assets/edit-Cv-txfZm.webp +0 -0
- package/dist/assets/effect.worker-qu1eCcII.js +9227 -0
- package/dist/assets/engraving-BENh1O2O.webp +0 -0
- package/dist/assets/etsy-CSvz9GpY.webp +0 -0
- package/dist/assets/expand-C60VE9nK.webp +0 -0
- package/dist/assets/facebook-Ca2nJJiQ.webp +0 -0
- package/dist/assets/film_stock-Bqauwcq4.webp +0 -0
- package/dist/assets/final.worker-BnzJ3N5C.js +7035 -0
- package/dist/assets/final.worker-Csc1zoYS.js +7054 -0
- package/dist/assets/final.worker-DzBFT9xk.js +6922 -0
- package/dist/assets/final.worker-XpgKnlaz.js +7217 -0
- package/dist/assets/flatlay-CPiVmlAa.webp +0 -0
- package/dist/assets/flatlay-fold-B-CRYy87.webp +0 -0
- package/dist/assets/flatlay-open-Dzas8okC.webp +0 -0
- package/dist/assets/g-market-DXuYK_JH.webp +0 -0
- package/dist/assets/ghost-BCEAx_Zx.webp +0 -0
- package/dist/assets/ghost-front-WFgA4sUo.webp +0 -0
- package/dist/assets/ghost-three-quarter-Rt8cXj34.webp +0 -0
- package/dist/assets/gif-CObOIITx.js +303 -0
- package/dist/assets/glass_tiles-3IXP-Hmg.webp +0 -0
- package/dist/assets/glitch_art-D1i3qben.webp +0 -0
- package/dist/assets/glitch_blur-C4q_9zyq.webp +0 -0
- package/dist/assets/glow-Bv9EHBU5.webp +0 -0
- package/dist/assets/gradient_map-BR-UVYMP.webp +0 -0
- package/dist/assets/halftone-CWdKu2_6.webp +0 -0
- package/dist/assets/holo_sticker-BQDikLg2.webp +0 -0
- package/dist/assets/idus-7diqRNPs.webp +0 -0
- package/dist/assets/imagetracer.worker-CgunQTPG.js +7096 -0
- package/dist/assets/instagram-Bf0IVidT.webp +0 -0
- package/dist/assets/kakao-talk-Df79L_Mv.webp +0 -0
- package/dist/assets/kaleidoscope-BxqMZuWo.webp +0 -0
- package/dist/assets/karrot-BXFPhDwt.webp +0 -0
- package/dist/assets/kaufland-BDDy6e0C.webp +0 -0
- package/dist/assets/lazada-ConR4e1O.webp +0 -0
- package/dist/assets/lens_flare-DgyiAv_j.webp +0 -0
- package/dist/assets/light_leak-kUdpoFuC.webp +0 -0
- package/dist/assets/line-Dr1j___B.webp +0 -0
- package/dist/assets/linkedin-4s_9Wh03.webp +0 -0
- package/dist/assets/lo_fi-DSdl3yY_.webp +0 -0
- package/dist/assets/logo-preparation.worker-D9oa7SME.js +420 -0
- package/dist/assets/mercado-libre-C8CskEiS.webp +0 -0
- package/dist/assets/mercari-jp-DHj7nz4O.webp +0 -0
- package/dist/assets/metadata.worker-B_9_BgN1.js +6456 -0
- package/dist/assets/mirror_collage-JtSKCeSh.webp +0 -0
- package/dist/assets/model-BbeF-fsf.webp +0 -0
- package/dist/assets/model-BjWhieit.webp +0 -0
- package/dist/assets/momo-BWXO_8Df.webp +0 -0
- package/dist/assets/motion_blur-B8YUHeSg.webp +0 -0
- package/dist/assets/naver-xQKL8lWg.webp +0 -0
- package/dist/assets/nuvemshop-DPt6rnA-.webp +0 -0
- package/dist/assets/olx-B87gp-Il.webp +0 -0
- package/dist/assets/orient-card-Da0ii6mX.webp +0 -0
- package/dist/assets/orient-final.worker-CdF5Y5zD.js +6909 -0
- package/dist/assets/orientation-preview.worker-B7uFzz3J.js +6865 -0
- package/dist/assets/ort.bundle.min-CreFV8V1.js +9311 -0
- package/dist/assets/ort.webgpu.bundle.min-CAudaHZO.js +9311 -0
- package/dist/assets/otto-market-DWZyNKJn.webp +0 -0
- package/dist/assets/paper_texture-CXphyIrs.webp +0 -0
- package/dist/assets/pinterest-ByZqih2J.webp +0 -0
- package/dist/assets/polish-DFy6LNG7.webp +0 -0
- package/dist/assets/poshmark-DnZi2vA1.webp +0 -0
- package/dist/assets/posterize-SpLVGq1s.webp +0 -0
- package/dist/assets/preview.worker-DcrCKKWl.js +380 -0
- package/dist/assets/qoo10-C1pq81Jx.webp +0 -0
- package/dist/assets/rakuten-ulYog1hL.webp +0 -0
- package/dist/assets/recolor-mBX7vdFT.webp +0 -0
- package/dist/assets/resize-DVEAl0Um.webp +0 -0
- package/dist/assets/runtime-0663b902fb3937883a34.wasm +0 -0
- package/dist/assets/runtime-355a5c80c7bfdf8737de.mjs +2817 -0
- package/dist/assets/runtime-49871f5a4409519797e1.wasm +0 -0
- package/dist/assets/runtime-74cf72f9a2b7befc115a.mjs +2817 -0
- package/dist/assets/shadow-card-DTZEH60r.png +0 -0
- package/dist/assets/shopee-Bxfei6sj.webp +0 -0
- package/dist/assets/shopify-wVaBafcF.webp +0 -0
- package/dist/assets/shopline-DMoaJ7Bh.webp +0 -0
- package/dist/assets/sparkle-CD5GSGip.webp +0 -0
- package/dist/assets/ssg-DQoFx5u5.webp +0 -0
- package/dist/assets/staging-CIc8pQJ6.webp +0 -0
- package/dist/assets/standard-cutout.worker-BYLzdpR-.js +1261 -0
- package/dist/assets/text-DQW2mBGp.webp +0 -0
- package/dist/assets/textured_glass-D2coxp7n.webp +0 -0
- package/dist/assets/tga-VGxWDes0.js +752 -0
- package/dist/assets/tilt_shift-BKs46yeX.webp +0 -0
- package/dist/assets/transformers.web-DB57cIO5.js +28891 -0
- package/dist/assets/tritone-CcR4qizk.webp +0 -0
- package/dist/assets/upscale-BrLadyUk.webp +0 -0
- package/dist/assets/upscale-creative-DnZnQufJ.webp +0 -0
- package/dist/assets/upscale-crisp-Ckdmbsnn.webp +0 -0
- package/dist/assets/vinted-1QDsxvC6.webp +0 -0
- package/dist/assets/watercolor-CV67zYNE.webp +0 -0
- package/dist/assets/watermark-CpPrxaT5.webp +0 -0
- package/dist/assets/wave_distortion-CV5jVfK4.webp +0 -0
- package/dist/assets/whatsapp-CWJxqzR6.webp +0 -0
- package/dist/assets/worker-DfrCFP3O.js +55 -0
- package/dist/assets/xerox_noise-CbbHY1S1.webp +0 -0
- package/dist/assets/youtube-DS12d5mi.webp +0 -0
- package/dist/assets/zalando-CenfWOwz.webp +0 -0
- package/dist/browser-adapter.d.ts +4 -0
- package/dist/browser-cutout-capability.d.ts +4 -0
- package/dist/browser-cutout-resources.d.ts +3 -0
- package/dist/browser-local-capabilities.d.ts +5 -0
- package/dist/capabilities.d.ts +18 -0
- package/dist/chunks/AdjustToolPanel-B6dtlFlj.js +195 -0
- package/dist/chunks/BackgroundToolPanel-C3Rr9d4S.js +41 -0
- package/dist/chunks/BatchMaterials-DDoJTaS5.js +806 -0
- package/dist/chunks/BatchModeChoices-DeBARgvY.js +111 -0
- package/dist/chunks/BatchOutputColorPicker-D7WIDS4_.js +75 -0
- package/dist/chunks/BatchReferenceFields-Cr5WgFRJ.js +316 -0
- package/dist/chunks/BeautifyToolPanel-DDZXDQKM.js +215 -0
- package/dist/chunks/BrandMarkToolPanel-vKobk_R3.js +1179 -0
- package/dist/chunks/ContentTrimControl-BKCJEst5.js +297 -0
- package/dist/chunks/CropToolPanel-C_sW5tWL.js +218 -0
- package/dist/chunks/CutoutToolPanel-B7ObmiWd.js +73 -0
- package/dist/chunks/DisclosureToolPanel-F3ccFJIF.js +76 -0
- package/dist/chunks/ExpandToolPanel-BKjj5UJA.js +67 -0
- package/dist/chunks/ImageEffectsToolPanel-CsDIBpT6.js +966 -0
- package/dist/chunks/IpAuditToolPanel-CduDfFh-.js +96 -0
- package/dist/chunks/ListingToolPanel-8pJ2_zvI.js +783 -0
- package/dist/chunks/MaterialSelectionPlate-CW7HaS6v.js +30 -0
- package/dist/chunks/MetadataToolPanel-C8XJOamN.js +104 -0
- package/dist/chunks/OrientToolPanel-C1AzQchm.js +161 -0
- package/dist/chunks/PluginActionFooter.vue_vue_type_script_setup_true_lang-BGe419qz.js +102 -0
- package/dist/chunks/ResizeToolPanel-DWikcj2G.js +1178 -0
- package/dist/chunks/RetouchToolPanel-B4eQKk2W.js +350 -0
- package/dist/chunks/ShadowToolPanel-Bbj76hQd.js +254 -0
- package/dist/chunks/SvgExportToolPanel-BRxpzd7q.js +219 -0
- package/dist/chunks/TranslationToolPanel-Bxv8U2WY.js +125 -0
- package/dist/chunks/UpscaleToolPanel-BRIgpszs.js +127 -0
- package/dist/chunks/engine-D-T-1RSx.js +69 -0
- package/dist/chunks/entry-CboOSe2r.js +42945 -0
- package/dist/chunks/gpu-CScw5MNG.js +231 -0
- package/dist/chunks/hosted-resources-COzZ7nZY.js +8196 -0
- package/dist/chunks/loader-circle-CylCgDqP.js +16 -0
- package/dist/chunks/motionFeatures-D67ghPG1.js +4405 -0
- package/dist/chunks/search-BwsDnulU.js +18 -0
- package/dist/chunks/standard-cutout-vPpP6xBc.js +45 -0
- package/dist/chunks/static-logo-2F9ORZWc.js +34 -0
- package/dist/config.d.ts +66 -0
- package/dist/contracts.d.ts +272 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +13 -0
- package/dist/node/catalog.mjs +45 -0
- package/dist/node/cli.mjs +11 -0
- package/dist/node/index.d.mts +20 -0
- package/dist/node/index.mjs +2 -0
- package/dist/node/prepare.mjs +114 -0
- package/dist/node/vite.mjs +46 -0
- package/dist/processing.d.ts +1 -0
- package/dist/processing.js +12105 -0
- package/dist/remote-contracts.d.ts +114 -0
- package/dist/resource-contracts.d.ts +40 -0
- package/dist/resources/cutout/9ae2e5375a34fa413530954dc20d085d175faffc86108c13619220d0557f80bf.json +1 -0
- package/dist/resources/cutout/f119dabecc64bc436d3d08425dde96ec2598fd40541eba97d8d53a4e8bbdcaea.json +1 -0
- package/dist/resources/cutout/resources.json +195 -0
- package/dist/resources/cutout/sources.json +294 -0
- package/dist/resources.json +1191 -0
- package/dist/service-contracts.d.ts +43 -0
- package/dist/slots.d.ts +21 -0
- package/dist/style.css +1 -0
- package/dist/types/batch/api.d.ts +89 -0
- package/dist/types/batch/cutout-output.d.ts +2 -0
- package/dist/types/batch/features/background/engine.d.mts +12 -0
- package/dist/types/batch/features/basic-edit/contracts.d.ts +87 -0
- package/dist/types/batch/features/basic-edit/engine.d.mts +96 -0
- package/dist/types/batch/features/brand-mark/contracts.d.ts +84 -0
- package/dist/types/batch/features/brand-mark/engine.d.mts +68 -0
- package/dist/types/batch/features/export-compression/contracts.d.ts +44 -0
- package/dist/types/batch/features/export-compression/gifenc.d.ts +33 -0
- package/dist/types/batch/features/export-compression/plan.d.ts +45 -0
- package/dist/types/batch/features/export-compression/presentation.d.ts +70 -0
- package/dist/types/batch/features/export-compression/upng.d.ts +6 -0
- package/dist/types/batch/features/final-image/resize.d.mts +15 -0
- package/dist/types/batch/features/image-effects/contracts.d.ts +58 -0
- package/dist/types/batch/features/image-effects/gpu-pixel-runtime.d.ts +15 -0
- package/dist/types/batch/features/image-effects/photo-audit.d.ts +21 -0
- package/dist/types/batch/features/image-effects/photo-v7-cpu.d.ts +9 -0
- package/dist/types/batch/features/image-effects/profiles-v4.d.ts +157 -0
- package/dist/types/batch/features/image-effects/profiles-v5.d.ts +20 -0
- package/dist/types/batch/features/image-effects/profiles-v6.d.ts +14 -0
- package/dist/types/batch/features/image-effects/profiles-v7.d.ts +53 -0
- package/dist/types/batch/features/image-effects/profiles-v8.d.ts +113 -0
- package/dist/types/batch/features/image-effects/profiles-v9.d.ts +20 -0
- package/dist/types/batch/features/image-translation/params.d.ts +257 -0
- package/dist/types/batch/features/listing-remake/transport.d.ts +21 -0
- package/dist/types/batch/features/metadata/bytes.d.mts +13 -0
- package/dist/types/batch/features/metadata/containers.d.mts +20 -0
- package/dist/types/batch/features/metadata/declaration.d.mts +5 -0
- package/dist/types/batch/features/metadata/engine.d.mts +9 -0
- package/dist/types/batch/features/metadata/exchange.d.mts +48 -0
- package/dist/types/batch/features/shadow/contracts.d.ts +43 -0
- package/dist/types/batch/features/shadow/engine.d.mts +33 -0
- package/dist/types/batch/features/svg-export/download-contract.d.ts +33 -0
- package/dist/types/batch/features/svg-export/download-prepare.d.ts +2 -0
- package/dist/types/batch/features/svg-export/download.d.ts +7 -0
- package/dist/types/batch/features/svg-export/imagetracer.d.ts +6 -0
- package/dist/types/batch/features/svg-export/optimizer.d.ts +2 -0
- package/dist/types/batch/ids.d.ts +1 -0
- package/dist/types/batch/model.d.ts +317 -0
- package/dist/types/batch/public/config.d.ts +66 -0
- package/dist/types/batch/public/contracts.d.ts +272 -0
- package/dist/types/batch/public/remote-contracts.d.ts +114 -0
- package/dist/types/batch/public/resource-contracts.d.ts +40 -0
- package/dist/types/batch/public/service-contracts.d.ts +43 -0
- package/dist/types/batch/queue.d.ts +34 -0
- package/dist/types/batch/receipts.d.ts +85 -0
- package/dist/types/batch/retention.d.ts +13 -0
- package/dist/types/onnxruntime-web.d.ts +5 -0
- package/dist/types/plugins/cutout/core/hosted-resources.d.ts +11 -0
- package/dist/types/processing.d.ts +18 -0
- package/dist/types/shared/svg-security.d.mts +4 -0
- package/dist/types/workspace-worker.d.ts +2 -0
- package/package.json +91 -3
|
@@ -0,0 +1,1179 @@
|
|
|
1
|
+
import { defineComponent as He, inject as ka, ref as j, onMounted as Ue, watch as J, onUnmounted as je, computed as D, openBlock as w, createElementBlock as L, withModifiers as Ge, unref as n, createElementVNode as P, Fragment as de, renderList as ve, toDisplayString as y, createBlock as he, createCommentVNode as z, createVNode as ce, createTextVNode as re, nextTick as xe, withCtx as Me } from "vue";
|
|
2
|
+
import { a6 as ge, a7 as _e, a8 as ie, a9 as fa, F as Je, aa as ha, ab as ya, ac as We, ad as wa, ae as _a, af as Pa, ag as ke, ah as Ia, ai as Ea, a3 as $e, aj as La, P as xa, R as Ma, ak as Ve, al as $, am as Va, an as Fe, ao as Xe, ap as Aa, aq as Ba, ar as fe, _ as Ca, G as qa, as as Sa } from "./entry-CboOSe2r.js";
|
|
3
|
+
import { L as Oa, n as Z, r as ue, a_ as ne, a1 as ye } from "./hosted-resources-COzZ7nZY.js";
|
|
4
|
+
import { C as Ra } from "./ContentTrimControl-BKCJEst5.js";
|
|
5
|
+
import { a as Ta } from "./static-logo-2F9ORZWc.js";
|
|
6
|
+
import { u as Na, a as Da, _ as za, n as Ka } from "./PluginActionFooter.vue_vue_type_script_setup_true_lang-BGe419qz.js";
|
|
7
|
+
const Ua = "" + new URL("../assets/logo-preparation.worker-D9oa7SME.js", import.meta.url).href;
|
|
8
|
+
function Ye(i) {
|
|
9
|
+
const s = new OffscreenCanvas(i.width, i.height), a = s.getContext("2d");
|
|
10
|
+
if (!a) throw new Error("浏览器不支持本机 Logo 处理");
|
|
11
|
+
a.drawImage(i, 0, 0);
|
|
12
|
+
const c = a.getImageData(0, 0, i.width, i.height).data;
|
|
13
|
+
for (let t = 3; t < c.length; t += 4) if (c[t] > 0) return;
|
|
14
|
+
throw Object.assign(new Error("没有可安全区分的Logo前景,上传原版保留"), {
|
|
15
|
+
reason: "no_foreground"
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
const Ae = () => new DOMException("Logo 准备已取消", "AbortError");
|
|
19
|
+
function ja(i) {
|
|
20
|
+
let s, a, c = !1, t = 0, g;
|
|
21
|
+
function u() {
|
|
22
|
+
s?.dispose(), s = void 0, a?.terminate(), a = void 0;
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
dispose() {
|
|
26
|
+
if (c = !0, g) {
|
|
27
|
+
const l = g;
|
|
28
|
+
g = void 0, l.cleanup(), l.reject(Ae());
|
|
29
|
+
}
|
|
30
|
+
u();
|
|
31
|
+
},
|
|
32
|
+
run(l, p) {
|
|
33
|
+
const R = ["intelligent", "isnet_fp16", "birefnet_quality"].includes(
|
|
34
|
+
p.method
|
|
35
|
+
), I = p.crop?.kind === "alpha", { signal: f, onProgress: E } = p;
|
|
36
|
+
return new Promise((k, M) => {
|
|
37
|
+
if (c || f?.aborted) {
|
|
38
|
+
M(Ae());
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (g) {
|
|
42
|
+
M(new Error("Logo 正在准备,请稍后再试"));
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (!l.size || l.size > ge || !["image/png", "image/jpeg", "image/webp"].includes(l.type)) {
|
|
46
|
+
M(new Error("Logo 需为5MiB以内的PNG、JPEG或WebP"));
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const x = ++t, b = (S) => {
|
|
50
|
+
g?.id === x && (g.cleanup(), g = void 0, u(), M(S));
|
|
51
|
+
}, h = () => b(Ae()), q = setTimeout(
|
|
52
|
+
() => b(
|
|
53
|
+
Object.assign(new Error("Logo 准备超时,请保留原图或更换素材"), {
|
|
54
|
+
reason: "local-transient"
|
|
55
|
+
})
|
|
56
|
+
),
|
|
57
|
+
p.method === "birefnet_quality" ? 20 * 6e4 + 3e4 : R ? 21e4 : 3e4
|
|
58
|
+
);
|
|
59
|
+
g = { id: x, reject: M, resolve: k, cleanup: () => {
|
|
60
|
+
clearTimeout(q), f?.removeEventListener("abort", h);
|
|
61
|
+
} }, f?.addEventListener("abort", h, { once: !0 });
|
|
62
|
+
try {
|
|
63
|
+
a ??= Oa(Ua, {
|
|
64
|
+
type: "module"
|
|
65
|
+
}), a.onmessage = async (S) => {
|
|
66
|
+
if (g?.id !== S.data.id) return;
|
|
67
|
+
const _ = S.data;
|
|
68
|
+
if (_.error) {
|
|
69
|
+
b(Object.assign(new Error(_.error), { reason: _.reason }));
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (!(_.blob instanceof Blob) || !_.blob.size || !R && _.blob.size > ge || typeof _.changed != "boolean" || !Number.isInteger(_.width) || !Number.isInteger(_.height) || _.width < 1 || _.height < 1 || _.width * _.height > _e || _.changed && _.blob.type !== "image/png") {
|
|
73
|
+
b(new Error("Logo 处理结果无效"));
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
try {
|
|
77
|
+
let A = _;
|
|
78
|
+
if (R) {
|
|
79
|
+
const T = { execution: "browser", model: p.method === "birefnet_quality" ? p.method : "isnet_fp16", background: "transparent" };
|
|
80
|
+
if (!i || i.supports?.(T) === !1)
|
|
81
|
+
throw new Error("Logo 本机抠图资源尚未配置");
|
|
82
|
+
const Y = await crypto.subtle.digest("SHA-256", await _.blob.arrayBuffer());
|
|
83
|
+
if (g?.id !== x || f?.aborted) return;
|
|
84
|
+
s = i.createExecutor();
|
|
85
|
+
const v = await s.run(
|
|
86
|
+
{
|
|
87
|
+
clientRequestId: Z("logo-local-request"),
|
|
88
|
+
operationId: Z("logo-local-operation"),
|
|
89
|
+
itemId: Z("logo-local-item"),
|
|
90
|
+
inputVersionId: Z("logo-normalized"),
|
|
91
|
+
inputSha256: Array.from(
|
|
92
|
+
new Uint8Array(Y),
|
|
93
|
+
(d) => d.toString(16).padStart(2, "0")
|
|
94
|
+
).join(""),
|
|
95
|
+
toolId: "cutout",
|
|
96
|
+
toolVersion: "1",
|
|
97
|
+
params: T
|
|
98
|
+
},
|
|
99
|
+
_.blob,
|
|
100
|
+
{
|
|
101
|
+
signal: f ?? new AbortController().signal,
|
|
102
|
+
readAsset: async () => {
|
|
103
|
+
throw new Error("Logo cutout does not reference additional assets");
|
|
104
|
+
},
|
|
105
|
+
progress: (d) => {
|
|
106
|
+
g?.id === x && !f?.aborted && E?.(d.total ? d.completed / d.total : void 0);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
).catch((d) => {
|
|
110
|
+
throw Object.assign(d instanceof Error ? d : new Error(String(d)), {
|
|
111
|
+
reason: "local-transient"
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
if (v.kind !== "image") throw new Error("Logo 处理结果无效");
|
|
115
|
+
if (g?.id !== x || f?.aborted) return;
|
|
116
|
+
s.dispose(), s = void 0, A = {
|
|
117
|
+
id: x,
|
|
118
|
+
blob: v.blob,
|
|
119
|
+
width: _.width,
|
|
120
|
+
height: _.height,
|
|
121
|
+
changed: !0
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
if (A.changed) {
|
|
125
|
+
if (A.blob.type !== "image/png" || !A.blob.size || A.blob.size > ge)
|
|
126
|
+
throw new Error("Logo 处理结果无效");
|
|
127
|
+
const U = new Uint8Array(await A.blob.slice(0, 8).arrayBuffer());
|
|
128
|
+
if (![137, 80, 78, 71, 13, 10, 26, 10].every(
|
|
129
|
+
(Y, v) => U[v] === Y
|
|
130
|
+
))
|
|
131
|
+
throw new Error("Logo PNG 无效");
|
|
132
|
+
const T = await createImageBitmap(A.blob);
|
|
133
|
+
try {
|
|
134
|
+
if (Ye(T), !I && (T.width !== _.width || T.height !== _.height) || T.width !== A.width || T.height !== A.height || T.width * T.height > _e)
|
|
135
|
+
throw new Error("Logo 处理结果尺寸无效");
|
|
136
|
+
} finally {
|
|
137
|
+
T.close();
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
if (g?.id !== x || f?.aborted) return;
|
|
141
|
+
g.cleanup(), g = void 0, u(), k(A);
|
|
142
|
+
} catch (A) {
|
|
143
|
+
b(A);
|
|
144
|
+
}
|
|
145
|
+
}, a.onerror = () => b(new Error("Logo 准备失败,原图保留")), a.onmessageerror = () => b(new Error("无法读取 Logo 处理结果")), a.postMessage({
|
|
146
|
+
id: x,
|
|
147
|
+
blob: l,
|
|
148
|
+
normalizeOnly: R || p.method === "original",
|
|
149
|
+
crop: p.crop
|
|
150
|
+
});
|
|
151
|
+
} catch (S) {
|
|
152
|
+
b(S);
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
function we(i) {
|
|
159
|
+
const { clientRequestId: s, operationId: a, itemId: c, inputVersionId: t } = i;
|
|
160
|
+
return { clientRequestId: s, operationId: a, itemId: c, inputVersionId: t };
|
|
161
|
+
}
|
|
162
|
+
function Be(i) {
|
|
163
|
+
const s = ue(i), a = ie(s.source), c = fa(s.settings), t = ue(s.request), g = ue(t.source), u = ue(t.params), l = ue(s.outcome);
|
|
164
|
+
if (g.kind !== "asset" || g.assetId !== a.assetId || g.assetVersionId !== a.assetVersionId || t.toolId !== "cutout" || t.toolVersion !== "1" || u.model !== c.background || !["picwish", "ideogram"].includes(c.background))
|
|
165
|
+
throw new Error("Logo receipt identity invalid");
|
|
166
|
+
const p = {
|
|
167
|
+
clientRequestId: ne(t.clientRequestId),
|
|
168
|
+
operationId: ne(t.operationId),
|
|
169
|
+
itemId: ne(t.itemId),
|
|
170
|
+
inputVersionId: ne(t.inputVersionId),
|
|
171
|
+
source: { kind: "asset", assetId: a.assetId, assetVersionId: a.assetVersionId },
|
|
172
|
+
toolId: "cutout",
|
|
173
|
+
toolVersion: "1",
|
|
174
|
+
params: { execution: "python", model: c.background, background: "transparent" }
|
|
175
|
+
}, R = {
|
|
176
|
+
key: ne(s.key),
|
|
177
|
+
ownerBatchId: ne(s.ownerBatchId),
|
|
178
|
+
source: a,
|
|
179
|
+
settings: c,
|
|
180
|
+
request: p
|
|
181
|
+
};
|
|
182
|
+
if (l.kind === "reserved" || l.kind === "unknown")
|
|
183
|
+
return { ...R, outcome: { kind: l.kind } };
|
|
184
|
+
const I = ye(l.receipt, we(p));
|
|
185
|
+
if (l.kind === "receipt") return { ...R, outcome: { kind: "receipt", receipt: I } };
|
|
186
|
+
if (l.kind === "ready" && I.status === "succeeded")
|
|
187
|
+
return {
|
|
188
|
+
...R,
|
|
189
|
+
outcome: { kind: "ready", receipt: I, master: ie(l.master) }
|
|
190
|
+
};
|
|
191
|
+
throw new Error("Logo receipt state invalid");
|
|
192
|
+
}
|
|
193
|
+
function Ce() {
|
|
194
|
+
return new Promise((i, s) => {
|
|
195
|
+
const a = indexedDB.open("batch-logo-attempts-v2", 1);
|
|
196
|
+
a.onupgradeneeded = () => a.result.createObjectStore("attempts", { keyPath: "key" }), a.onerror = () => s(a.error), a.onsuccess = () => i(a.result);
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
const Ga = {
|
|
200
|
+
async reserve(i) {
|
|
201
|
+
const s = await Ce();
|
|
202
|
+
return new Promise((a, c) => {
|
|
203
|
+
const t = s.transaction("attempts", "readwrite"), g = t.objectStore("attempts");
|
|
204
|
+
let u = { attempt: i, submit: !1 };
|
|
205
|
+
const l = g.get(i.key);
|
|
206
|
+
l.onsuccess = () => {
|
|
207
|
+
if (l.result)
|
|
208
|
+
try {
|
|
209
|
+
u = { attempt: Be(l.result), submit: !1 };
|
|
210
|
+
} catch {
|
|
211
|
+
t.abort();
|
|
212
|
+
}
|
|
213
|
+
else
|
|
214
|
+
g.add(i), u = { attempt: i, submit: !0 };
|
|
215
|
+
}, t.oncomplete = () => {
|
|
216
|
+
s.close(), a(u);
|
|
217
|
+
}, t.onabort = t.onerror = () => {
|
|
218
|
+
s.close(), c(t.error ?? new Error("Logo journal unavailable"));
|
|
219
|
+
};
|
|
220
|
+
});
|
|
221
|
+
},
|
|
222
|
+
async save(i) {
|
|
223
|
+
const s = await Ce();
|
|
224
|
+
return new Promise((a, c) => {
|
|
225
|
+
const t = s.transaction("attempts", "readwrite"), g = t.objectStore("attempts"), u = g.get(i.key);
|
|
226
|
+
u.onsuccess = () => {
|
|
227
|
+
let l;
|
|
228
|
+
try {
|
|
229
|
+
l = u.result ? Be(u.result) : void 0;
|
|
230
|
+
} catch {
|
|
231
|
+
t.abort();
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
l?.outcome.kind !== "ready" && (l?.outcome.kind === "receipt" && i.outcome.kind === "receipt" && l.outcome.receipt.statusVersion > i.outcome.receipt.statusVersion || g.put(i));
|
|
235
|
+
}, t.oncomplete = () => {
|
|
236
|
+
s.close(), a();
|
|
237
|
+
}, t.onabort = t.onerror = () => {
|
|
238
|
+
s.close(), c(t.error ?? new Error("Logo journal unavailable"));
|
|
239
|
+
};
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
async function Wa(i) {
|
|
244
|
+
const s = await Ce();
|
|
245
|
+
return new Promise((a, c) => {
|
|
246
|
+
const t = s.transaction("attempts", "readonly"), g = t.objectStore("attempts").openCursor(), u = [];
|
|
247
|
+
g.onsuccess = () => {
|
|
248
|
+
const l = g.result;
|
|
249
|
+
if (l) {
|
|
250
|
+
try {
|
|
251
|
+
const p = Be(l.value);
|
|
252
|
+
p.ownerBatchId === i && u.push(p);
|
|
253
|
+
} catch {
|
|
254
|
+
}
|
|
255
|
+
l.continue();
|
|
256
|
+
}
|
|
257
|
+
}, t.oncomplete = () => {
|
|
258
|
+
s.close(), a(u);
|
|
259
|
+
}, t.onerror = () => {
|
|
260
|
+
s.close(), c(t.error);
|
|
261
|
+
};
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
const Qe = "logo-v2";
|
|
265
|
+
function Ze(i, s, a) {
|
|
266
|
+
return JSON.stringify([
|
|
267
|
+
i,
|
|
268
|
+
s.assetId,
|
|
269
|
+
s.assetVersionId,
|
|
270
|
+
s.sha256,
|
|
271
|
+
a.background,
|
|
272
|
+
Qe
|
|
273
|
+
]);
|
|
274
|
+
}
|
|
275
|
+
async function $a(i, s) {
|
|
276
|
+
const a = () => {
|
|
277
|
+
throw new Error("Logo cloud services not configured");
|
|
278
|
+
}, { document: c, signal: t, ownerBatchId: g } = i, u = c.desired, l = c.original;
|
|
279
|
+
if (!l) throw new Error("请重新上传原 Logo");
|
|
280
|
+
const p = () => {
|
|
281
|
+
if (t.aborted) throw new DOMException("Cancelled", "AbortError");
|
|
282
|
+
};
|
|
283
|
+
p();
|
|
284
|
+
const R = u.background === "original" ? void 0 : c.masters.find((k) => k.background === u.background);
|
|
285
|
+
let I = R?.asset;
|
|
286
|
+
if (!I && u.background === "original" && (I = l), !I && (u.background === "picwish" || u.background === "ideogram")) {
|
|
287
|
+
i.onStage?.("cloud");
|
|
288
|
+
const k = s.journal ?? Ga, M = {
|
|
289
|
+
key: Ze(g, l, u),
|
|
290
|
+
ownerBatchId: g,
|
|
291
|
+
source: l,
|
|
292
|
+
settings: u,
|
|
293
|
+
request: {
|
|
294
|
+
clientRequestId: Z("logo-request"),
|
|
295
|
+
operationId: Z("logo-operation"),
|
|
296
|
+
itemId: Z("logo-item"),
|
|
297
|
+
inputVersionId: l.assetVersionId,
|
|
298
|
+
source: { kind: "asset", assetId: l.assetId, assetVersionId: l.assetVersionId },
|
|
299
|
+
toolId: "cutout",
|
|
300
|
+
toolVersion: "1",
|
|
301
|
+
params: { execution: "python", model: u.background, background: "transparent" }
|
|
302
|
+
},
|
|
303
|
+
outcome: { kind: "reserved" }
|
|
304
|
+
}, x = await k.reserve(M);
|
|
305
|
+
let b = x.attempt;
|
|
306
|
+
if (b.outcome.kind === "ready") I = ie(b.outcome.master);
|
|
307
|
+
else
|
|
308
|
+
try {
|
|
309
|
+
p();
|
|
310
|
+
let h = x.submit ? await (s.submit ?? a)(b.request) : b.outcome.kind === "receipt" ? await (s.queryTask ?? a)(b.outcome.receipt.taskId, "python-ai") : await (s.queryRequest ?? a)(
|
|
311
|
+
b.request.clientRequestId,
|
|
312
|
+
"python-ai"
|
|
313
|
+
);
|
|
314
|
+
h = ye(h, we(b.request)), !x.submit && h.status === "failed" && [
|
|
315
|
+
"PROVIDER_PENDING",
|
|
316
|
+
"PROVIDER_ACCEPTANCE_UNKNOWN",
|
|
317
|
+
"GATEWAY_UNAVAILABLE",
|
|
318
|
+
"STORAGE_UNAVAILABLE"
|
|
319
|
+
].includes(h.error?.code ?? "") && (h = ye(
|
|
320
|
+
await (s.queryOriginal ?? a)(h.taskId),
|
|
321
|
+
we(b.request)
|
|
322
|
+
)), b = { ...b, outcome: { kind: "receipt", receipt: h } }, await k.save(b);
|
|
323
|
+
const q = Date.now() + 3e4;
|
|
324
|
+
for (; ["accepted", "queued", "running"].includes(h.status) && Date.now() < q && !t.aborted && (await new Promise(
|
|
325
|
+
(G) => setTimeout(G, Math.min(h.pollAfterMs ?? 1500, 3e3))
|
|
326
|
+
), !t.aborted); )
|
|
327
|
+
h = ye(
|
|
328
|
+
await (s.queryTask ?? a)(h.taskId, "python-ai"),
|
|
329
|
+
we(b.request)
|
|
330
|
+
), b = { ...b, outcome: { kind: "receipt", receipt: h } }, await k.save(b);
|
|
331
|
+
if (h.status === "succeeded" && h.result?.kind === "image") {
|
|
332
|
+
I = ie(h.result.asset);
|
|
333
|
+
const G = l.orientation && l.orientation >= 5 ? [l.height, l.width] : [l.width, l.height];
|
|
334
|
+
if (I.width !== G[0] || I.height !== G[1] || I.mime !== "image/png")
|
|
335
|
+
throw new Error("Logo 处理结果尺寸无效");
|
|
336
|
+
const S = await s.read(I, AbortSignal.timeout(3e4)), _ = new Uint8Array(await S.slice(0, 8).arrayBuffer());
|
|
337
|
+
if (![137, 80, 78, 71, 13, 10, 26, 10].every((U, T) => _[T] === U))
|
|
338
|
+
throw new Error("Logo PNG 无效");
|
|
339
|
+
const A = await createImageBitmap(S);
|
|
340
|
+
try {
|
|
341
|
+
if (Ye(A), A.width !== I.width || A.height !== I.height)
|
|
342
|
+
throw new Error("Logo 处理结果尺寸无效");
|
|
343
|
+
} finally {
|
|
344
|
+
A.close();
|
|
345
|
+
}
|
|
346
|
+
await k.save({ ...b, outcome: { kind: "ready", receipt: h, master: I } });
|
|
347
|
+
} else
|
|
348
|
+
throw Object.assign(new Error("Logo 云端任务尚未完成,请查询原任务"), {
|
|
349
|
+
reason: "cloud-unknown"
|
|
350
|
+
});
|
|
351
|
+
} catch (h) {
|
|
352
|
+
throw b.outcome.kind === "reserved" && await k.save({ ...b, outcome: { kind: "unknown" } }), Object.assign(h instanceof Error ? h : new Error(String(h)), {
|
|
353
|
+
reason: "cloud-unknown"
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
if (!I) {
|
|
358
|
+
i.onStage?.("model");
|
|
359
|
+
const k = await s.read(l, t);
|
|
360
|
+
if (p(), u.background === "picwish" || u.background === "ideogram")
|
|
361
|
+
throw new Error("Logo cloud result missing");
|
|
362
|
+
const M = await s.preparer.run(k, {
|
|
363
|
+
method: u.background,
|
|
364
|
+
signal: t,
|
|
365
|
+
onProgress: i.onProgress
|
|
366
|
+
});
|
|
367
|
+
p(), i.onStage?.("save"), I = ie(await s.save(M.blob, "brand-logo-master.png")), p();
|
|
368
|
+
}
|
|
369
|
+
p();
|
|
370
|
+
const f = {
|
|
371
|
+
background: u.background,
|
|
372
|
+
processorVersion: R?.processorVersion ?? Qe,
|
|
373
|
+
asset: I
|
|
374
|
+
};
|
|
375
|
+
await i.onMaster?.(f), p();
|
|
376
|
+
let E = I;
|
|
377
|
+
if (u.crop.kind === "alpha") {
|
|
378
|
+
i.onStage?.("derive");
|
|
379
|
+
const k = await s.read(I, t);
|
|
380
|
+
p();
|
|
381
|
+
const M = await s.preparer.run(k, {
|
|
382
|
+
method: "original",
|
|
383
|
+
crop: u.crop,
|
|
384
|
+
signal: t
|
|
385
|
+
});
|
|
386
|
+
p(), i.onStage?.("save"), E = ie(await s.save(M.blob, "brand-logo.png")), p();
|
|
387
|
+
}
|
|
388
|
+
return p(), {
|
|
389
|
+
...c,
|
|
390
|
+
applied: { settings: u, asset: E },
|
|
391
|
+
masters: [...c.masters.filter((k) => k.background !== u.background), f],
|
|
392
|
+
state: { kind: "idle" }
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
const Fa = ["disabled", "aria-label"], Ha = ["aria-label"], Ja = ["aria-label", "aria-checked", "tabindex", "onClick", "onKeydown"], Xa = ["aria-label"], Ya = ["aria-label", "disabled"], Qa = ["src", "alt"], Za = { key: 2 }, eo = ["aria-label"], ao = { class: "logo-background-select" }, oo = ["value", "disabled"], to = { value: "original" }, ro = { value: "solid" }, no = ["value", "disabled"], io = {
|
|
396
|
+
key: 1,
|
|
397
|
+
class: "hint"
|
|
398
|
+
}, so = {
|
|
399
|
+
key: 2,
|
|
400
|
+
class: "hint",
|
|
401
|
+
role: "status"
|
|
402
|
+
}, lo = {
|
|
403
|
+
key: 3,
|
|
404
|
+
class: "hint"
|
|
405
|
+
}, uo = {
|
|
406
|
+
key: 4,
|
|
407
|
+
class: "hint logo-progress",
|
|
408
|
+
role: "status",
|
|
409
|
+
"aria-live": "polite"
|
|
410
|
+
}, co = { class: "logo-progress-label" }, go = ["value"], mo = ["aria-label", "title"], bo = {
|
|
411
|
+
key: 5,
|
|
412
|
+
class: "logo-actions"
|
|
413
|
+
}, po = ["disabled"], vo = {
|
|
414
|
+
key: 6,
|
|
415
|
+
class: "logo-actions"
|
|
416
|
+
}, ko = ["disabled"], fo = {
|
|
417
|
+
key: 7,
|
|
418
|
+
class: "logo-error",
|
|
419
|
+
role: "alert"
|
|
420
|
+
}, ho = { class: "brand-field-label" }, yo = ["aria-label"], wo = ["aria-label", "aria-pressed", "onClick"], _o = ["aria-label", "min", "max", "value", "onInput"], Po = ["aria-label", "title", "aria-valuetext", "min", "max", "value", "onInput"], Io = {
|
|
421
|
+
key: 0,
|
|
422
|
+
class: "brand-density-ticks",
|
|
423
|
+
"aria-hidden": "true"
|
|
424
|
+
}, Eo = {
|
|
425
|
+
key: 9,
|
|
426
|
+
class: "logo-error",
|
|
427
|
+
role: "alert"
|
|
428
|
+
}, Lo = ["aria-label"], xo = /* @__PURE__ */ He({
|
|
429
|
+
__name: "BrandMarkPanel",
|
|
430
|
+
props: {
|
|
431
|
+
modelValue: {},
|
|
432
|
+
disabled: { type: Boolean, default: !1 },
|
|
433
|
+
hideReset: { type: Boolean, default: !1 },
|
|
434
|
+
scopeKey: {},
|
|
435
|
+
resetEpoch: { default: 0 },
|
|
436
|
+
availableCutoutModes: {},
|
|
437
|
+
allowedModes: {},
|
|
438
|
+
uploadReference: {}
|
|
439
|
+
},
|
|
440
|
+
emits: ["update:modelValue", "validity"],
|
|
441
|
+
setup(i, { emit: s }) {
|
|
442
|
+
const { ui: a, uiText: c } = Je(), t = i, g = s, u = ha(), l = ka(ya, void 0), p = We(() => t.modelValue.logo ?? t.modelValue.originalLogo);
|
|
443
|
+
function R(e) {
|
|
444
|
+
if (!t.uploadReference) throw Error("参考素材注册能力尚未配置");
|
|
445
|
+
return t.uploadReference(e);
|
|
446
|
+
}
|
|
447
|
+
const I = j(), f = j(!1), E = j(""), k = j(""), M = j({});
|
|
448
|
+
let x = 0, b, h, q, G, S;
|
|
449
|
+
const _ = j([]);
|
|
450
|
+
async function A() {
|
|
451
|
+
const e = t.scopeKey ?? "";
|
|
452
|
+
try {
|
|
453
|
+
const r = await Wa(e);
|
|
454
|
+
U && (t.scopeKey ?? "") === e && (_.value = r);
|
|
455
|
+
} catch {
|
|
456
|
+
U && (t.scopeKey ?? "") === e && (_.value = []);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
Ue(A), J(() => t.scopeKey, A);
|
|
460
|
+
let U = !0;
|
|
461
|
+
je(() => {
|
|
462
|
+
U = !1;
|
|
463
|
+
});
|
|
464
|
+
const T = [
|
|
465
|
+
["top-left", "左上", "↖"],
|
|
466
|
+
["top", "顶部", "↑"],
|
|
467
|
+
["top-right", "右上", "↗"],
|
|
468
|
+
["left", "左侧", "←"],
|
|
469
|
+
["center", "居中", "·"],
|
|
470
|
+
["right", "右侧", "→"],
|
|
471
|
+
["bottom-left", "左下", "↙"],
|
|
472
|
+
["bottom", "底部", "↓"],
|
|
473
|
+
["bottom-right", "右下", "↘"]
|
|
474
|
+
], Y = j(), v = D(() => wa(t.modelValue)), d = D(() => _a(v.value)), B = D(() => d.value.desired), ea = D(() => ["picwish", "ideogram"].includes(B.value.background)), W = j("");
|
|
475
|
+
function qe(e) {
|
|
476
|
+
const r = d.value;
|
|
477
|
+
if (r.kind !== "loaded") return !1;
|
|
478
|
+
if (r.masters.some((m) => m.background === e)) return !0;
|
|
479
|
+
const o = r.original;
|
|
480
|
+
return !!o && _.value.some(
|
|
481
|
+
(m) => m.key === Ze(t.scopeKey ?? "", o, { ...r.desired, background: e })
|
|
482
|
+
);
|
|
483
|
+
}
|
|
484
|
+
function ee(e) {
|
|
485
|
+
if (e === "original" || e === "solid" || d.value.kind === "loaded" && d.value.masters.some((o) => o.background === e))
|
|
486
|
+
return !0;
|
|
487
|
+
if (!qe(e) && !(t.availableCutoutModes ?? []).includes(e))
|
|
488
|
+
return !1;
|
|
489
|
+
if (e === "picwish" || e === "ideogram") {
|
|
490
|
+
const o = l?.services;
|
|
491
|
+
return !!(o?.submitTask && o.getTask && o.getTaskByRequest && o.queryOriginalTask);
|
|
492
|
+
}
|
|
493
|
+
const r = l?.execution?.local?.cutout;
|
|
494
|
+
return !!r && r.supports?.({
|
|
495
|
+
execution: "browser",
|
|
496
|
+
model: e,
|
|
497
|
+
background: "transparent"
|
|
498
|
+
}) !== !1;
|
|
499
|
+
}
|
|
500
|
+
const Se = D(() => {
|
|
501
|
+
const e = B.value.background;
|
|
502
|
+
return qe(e) || e === "original" || e === "solid" ? 0 : Pa(e, 1);
|
|
503
|
+
}), ae = j(!0), me = j(0), X = D(() => B.value.crop.kind !== "alpha" || ae.value), Oe = D(() => {
|
|
504
|
+
const e = d.value;
|
|
505
|
+
if (e.kind !== "loaded") return;
|
|
506
|
+
const r = e.masters.find((o) => o.background === e.desired.background);
|
|
507
|
+
return e.desired.background === "original" ? e.original : r?.asset ?? e.original;
|
|
508
|
+
}), Re = We(() => Oe.value), Pe = D(() => {
|
|
509
|
+
const e = d.value, r = Oe.value;
|
|
510
|
+
if (!(e.kind !== "loaded" || !r))
|
|
511
|
+
return {
|
|
512
|
+
source: Re.value ? {
|
|
513
|
+
url: Re.value,
|
|
514
|
+
versionId: JSON.stringify([r.assetId, r.assetVersionId, r.sha256])
|
|
515
|
+
} : void 0,
|
|
516
|
+
approximate: e.desired.background !== "original" && !e.masters.some((o) => o.background === e.desired.background)
|
|
517
|
+
};
|
|
518
|
+
});
|
|
519
|
+
function aa(e) {
|
|
520
|
+
be({
|
|
521
|
+
...B.value,
|
|
522
|
+
crop: e ? { kind: "alpha", padding: 0 } : { kind: "none" }
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
function oa(e) {
|
|
526
|
+
be({ ...B.value, crop: { kind: "alpha", padding: e } });
|
|
527
|
+
}
|
|
528
|
+
function be(e) {
|
|
529
|
+
if (t.disabled || f.value && (B.value.background !== "original" || q !== void 0) || e.crop.kind === "alpha" && (!Number.isInteger(e.crop.padding) || e.crop.padding < 0 || e.crop.padding > 1024) || ae.value && Ve(e, B.value)) return;
|
|
530
|
+
E.value = "", W.value = "";
|
|
531
|
+
const r = d.value;
|
|
532
|
+
K(
|
|
533
|
+
$(
|
|
534
|
+
v.value,
|
|
535
|
+
r.kind === "loaded" ? { ...r, desired: e, state: { kind: "idle" } } : { ...r, desired: e }
|
|
536
|
+
)
|
|
537
|
+
);
|
|
538
|
+
}
|
|
539
|
+
function ta() {
|
|
540
|
+
me.value++, ae.value = !0, F(), E.value = "", W.value = "";
|
|
541
|
+
const e = d.value;
|
|
542
|
+
e.kind === "loaded" && K(
|
|
543
|
+
$(v.value, {
|
|
544
|
+
...e,
|
|
545
|
+
desired: e.applied.settings,
|
|
546
|
+
state: { kind: "idle" }
|
|
547
|
+
})
|
|
548
|
+
);
|
|
549
|
+
}
|
|
550
|
+
function ra(e) {
|
|
551
|
+
const r = e.target.value, o = ["original", "solid", ...$e.map((m) => m.model)].find(
|
|
552
|
+
(m) => m === r
|
|
553
|
+
);
|
|
554
|
+
o && ee(o) && be({ ...B.value, background: o });
|
|
555
|
+
}
|
|
556
|
+
const se = D(() => t.modelValue.mode ?? "single");
|
|
557
|
+
J(
|
|
558
|
+
[
|
|
559
|
+
() => t.resetEpoch,
|
|
560
|
+
() => t.scopeKey,
|
|
561
|
+
() => v.value.originalLogo?.assetId,
|
|
562
|
+
() => v.value.originalLogo?.assetVersionId,
|
|
563
|
+
() => v.value.originalLogo?.sha256
|
|
564
|
+
],
|
|
565
|
+
() => {
|
|
566
|
+
me.value++, ae.value = !0;
|
|
567
|
+
}
|
|
568
|
+
);
|
|
569
|
+
const na = [
|
|
570
|
+
{ key: "sizePercent", label: "Logo 大小", min: 1, max: 50, unit: "%" },
|
|
571
|
+
{ key: "marginPercent", label: "边距", min: 0, max: 20, unit: "%" },
|
|
572
|
+
{ key: "density", label: "疏密", min: 0, max: 100, unit: "" },
|
|
573
|
+
{ key: "angle", label: "角度", min: -90, max: 90, unit: "°" },
|
|
574
|
+
{ key: "opacity", label: "不透明度", min: 0, max: 100, unit: "%" }
|
|
575
|
+
], Ie = D(
|
|
576
|
+
() => na.filter(
|
|
577
|
+
(e) => se.value === "tile" ? e.key !== "marginPercent" : e.key !== "density" && e.key !== "angle"
|
|
578
|
+
)
|
|
579
|
+
);
|
|
580
|
+
function Ee(e) {
|
|
581
|
+
return e === "opacity" ? Math.round(v.value.opacity * 100) : v.value[e] ?? (e === "density" ? 50 : -30);
|
|
582
|
+
}
|
|
583
|
+
const Te = D(
|
|
584
|
+
() => Ie.value.every((e) => {
|
|
585
|
+
const r = M.value[e.key];
|
|
586
|
+
if (r === void 0) return !0;
|
|
587
|
+
const o = Number(r);
|
|
588
|
+
return r.trim() !== "" && Number.isInteger(o) && o >= e.min && o <= e.max;
|
|
589
|
+
})
|
|
590
|
+
), ia = D(
|
|
591
|
+
() => ke(v.value).kind === "ready" && !f.value && !E.value && Te.value && X.value
|
|
592
|
+
);
|
|
593
|
+
J(
|
|
594
|
+
() => [
|
|
595
|
+
v.value.sizePercent,
|
|
596
|
+
v.value.marginPercent,
|
|
597
|
+
v.value.opacity,
|
|
598
|
+
v.value.density,
|
|
599
|
+
v.value.angle
|
|
600
|
+
],
|
|
601
|
+
(e, r) => {
|
|
602
|
+
const o = ["sizePercent", "marginPercent", "opacity", "density", "angle"], m = { ...M.value };
|
|
603
|
+
o.forEach((V, C) => {
|
|
604
|
+
e[C] !== r[C] && delete m[V];
|
|
605
|
+
}), M.value = m;
|
|
606
|
+
}
|
|
607
|
+
), J(
|
|
608
|
+
() => t.resetEpoch,
|
|
609
|
+
() => {
|
|
610
|
+
M.value = {};
|
|
611
|
+
}
|
|
612
|
+
), J(se, () => {
|
|
613
|
+
M.value = {};
|
|
614
|
+
}), J(ia, (e) => g("validity", e), { immediate: !0 });
|
|
615
|
+
function K(e) {
|
|
616
|
+
t.disabled || g("update:modelValue", { ...v.value, ...e });
|
|
617
|
+
}
|
|
618
|
+
function Ne(e) {
|
|
619
|
+
t.disabled || (M.value = {}, g("update:modelValue", Va(t.modelValue, e)));
|
|
620
|
+
}
|
|
621
|
+
function sa(e, r, o, m) {
|
|
622
|
+
if (t.disabled || e.defaultPrevented) return;
|
|
623
|
+
let V;
|
|
624
|
+
if (e.key === "ArrowRight" || e.key === "ArrowDown") V = (r + 1) % o.length;
|
|
625
|
+
else if (e.key === "ArrowLeft" || e.key === "ArrowUp")
|
|
626
|
+
V = (r + o.length - 1) % o.length;
|
|
627
|
+
else if (e.key === "Home") V = 0;
|
|
628
|
+
else if (e.key === "End") V = o.length - 1;
|
|
629
|
+
else return;
|
|
630
|
+
e.preventDefault(), e.stopPropagation();
|
|
631
|
+
const C = e.currentTarget.parentElement;
|
|
632
|
+
m(o[V]), xe(() => C?.querySelectorAll("[role=radio]")[V]?.focus());
|
|
633
|
+
}
|
|
634
|
+
function F() {
|
|
635
|
+
clearTimeout(G), G = void 0, q = void 0, x++, b?.abort(), b = void 0, h?.dispose(), h = void 0, f.value = !1, k.value = "", Y.value = void 0;
|
|
636
|
+
}
|
|
637
|
+
J(
|
|
638
|
+
() => [t.disabled, t.scopeKey, t.resetEpoch],
|
|
639
|
+
() => {
|
|
640
|
+
F(), E.value = "", M.value = {};
|
|
641
|
+
},
|
|
642
|
+
{ flush: "sync" }
|
|
643
|
+
), je(F);
|
|
644
|
+
function De(e) {
|
|
645
|
+
if (!e.width || !e.height || e.width * e.height > _e || e.bytes > ge || !["image/png", "image/jpeg", "image/webp"].includes(e.mime))
|
|
646
|
+
throw new Error("Logo 需为5MiB、400万像素以内的静态图片");
|
|
647
|
+
}
|
|
648
|
+
async function la(e, r) {
|
|
649
|
+
if (!l) throw Error("参考素材读取能力尚未配置");
|
|
650
|
+
return De(e), Aa(l, e, r);
|
|
651
|
+
}
|
|
652
|
+
const Q = D(() => {
|
|
653
|
+
const e = d.value, r = e.kind === "loaded" ? e.original : void 0;
|
|
654
|
+
return JSON.stringify([
|
|
655
|
+
t.scopeKey,
|
|
656
|
+
t.resetEpoch,
|
|
657
|
+
t.disabled,
|
|
658
|
+
e.kind,
|
|
659
|
+
r?.assetId,
|
|
660
|
+
r?.assetVersionId,
|
|
661
|
+
r?.sha256,
|
|
662
|
+
e.desired.background,
|
|
663
|
+
e.desired.crop.kind,
|
|
664
|
+
e.desired.crop.kind === "alpha" ? e.desired.crop.padding : void 0,
|
|
665
|
+
X.value
|
|
666
|
+
]);
|
|
667
|
+
});
|
|
668
|
+
function pe() {
|
|
669
|
+
const e = d.value;
|
|
670
|
+
if (!U || t.disabled || f.value || !X.value || e.kind !== "loaded" || !e.original || e.desired.background !== "original")
|
|
671
|
+
return;
|
|
672
|
+
const r = Q.value;
|
|
673
|
+
if (ke(v.value).kind === "ready" || S === r) return;
|
|
674
|
+
if (e.state.kind === "failed") {
|
|
675
|
+
S = r;
|
|
676
|
+
return;
|
|
677
|
+
}
|
|
678
|
+
if (S = r, E.value = "", W.value = "", e.desired.crop.kind === "none") {
|
|
679
|
+
K(
|
|
680
|
+
$(v.value, {
|
|
681
|
+
...e,
|
|
682
|
+
applied: { settings: fe(), asset: e.original },
|
|
683
|
+
state: { kind: "idle" }
|
|
684
|
+
})
|
|
685
|
+
);
|
|
686
|
+
return;
|
|
687
|
+
}
|
|
688
|
+
const o = {
|
|
689
|
+
...e,
|
|
690
|
+
desired: { background: "original", crop: { ...e.desired.crop } }
|
|
691
|
+
};
|
|
692
|
+
G = setTimeout(() => {
|
|
693
|
+
G = void 0, U && !t.disabled && X.value && Q.value === r && Le(o);
|
|
694
|
+
}, 225);
|
|
695
|
+
}
|
|
696
|
+
J(
|
|
697
|
+
Q,
|
|
698
|
+
() => {
|
|
699
|
+
const e = d.value;
|
|
700
|
+
q?.generation === x && Ve(e.desired, q.expected.desired) && (e.kind === "empty" && q.expected.kind === "empty" || e.kind === "loaded" && q.expected.kind === "loaded" && e.original && q.expected.original && Fe(e.original, q.expected.original)) || (F(), S = void 0, E.value = "", W.value = "", pe());
|
|
701
|
+
},
|
|
702
|
+
{ flush: "sync" }
|
|
703
|
+
), J(
|
|
704
|
+
() => [
|
|
705
|
+
Q.value,
|
|
706
|
+
d.value.kind === "loaded" && d.value.state.kind
|
|
707
|
+
],
|
|
708
|
+
([e, r], [o, m]) => {
|
|
709
|
+
e !== o || m !== "failed" || r !== "idle" || B.value.background !== "original" || (S = void 0, pe());
|
|
710
|
+
},
|
|
711
|
+
{ flush: "post" }
|
|
712
|
+
), Ue(pe);
|
|
713
|
+
function da() {
|
|
714
|
+
const e = d.value;
|
|
715
|
+
e.kind !== "loaded" || e.desired.background !== "original" || (S = Q.value, Le({ ...e, desired: { background: "original", crop: { ...e.desired.crop } } }));
|
|
716
|
+
}
|
|
717
|
+
async function Le(e) {
|
|
718
|
+
const r = e ?? d.value;
|
|
719
|
+
if (!U || t.disabled || f.value || !X.value || r.kind !== "loaded" || !ee(r.desired.background)) return;
|
|
720
|
+
F();
|
|
721
|
+
const o = x, m = t.scopeKey, V = Q.value;
|
|
722
|
+
b = new AbortController();
|
|
723
|
+
const C = b.signal, H = () => {
|
|
724
|
+
const O = d.value;
|
|
725
|
+
return U && o === x && !t.disabled && !C.aborted && t.scopeKey === m && Q.value === V && X.value && O.kind === "loaded" && !!O.original && !!r.original && Fe(O.original, r.original) && Ve(O.desired, r.desired);
|
|
726
|
+
}, oe = d.value;
|
|
727
|
+
if (!(!H() || oe.kind !== "loaded")) {
|
|
728
|
+
E.value = "", W.value = "", f.value = !0, k.value = r.desired.background === "original" ? a("tools.brand_mark.trimLogo") : ea.value ? "logo-cloud-progress" : "logo-local-progress", K($(v.value, { ...oe, state: { kind: "running" } })), h ??= ja(l?.execution?.local?.cutout);
|
|
729
|
+
try {
|
|
730
|
+
const O = await $a(
|
|
731
|
+
{
|
|
732
|
+
document: r,
|
|
733
|
+
ownerBatchId: m ?? "",
|
|
734
|
+
signal: C,
|
|
735
|
+
onMaster: async (N) => {
|
|
736
|
+
const le = d.value;
|
|
737
|
+
!H() || le.kind !== "loaded" || (K(
|
|
738
|
+
$(v.value, {
|
|
739
|
+
...le,
|
|
740
|
+
masters: [
|
|
741
|
+
...le.masters.filter((va) => va.background !== N.background),
|
|
742
|
+
N
|
|
743
|
+
]
|
|
744
|
+
})
|
|
745
|
+
), await xe());
|
|
746
|
+
},
|
|
747
|
+
onStage: (N) => {
|
|
748
|
+
H() && (k.value = N === "cloud" ? "logo-cloud-progress" : N === "model" ? "logo-local-progress" : N === "derive" ? a("tools.brand_mark.trimLogo") : "正在保存去底 Logo…");
|
|
749
|
+
},
|
|
750
|
+
onProgress: (N) => {
|
|
751
|
+
H() && (Y.value = N);
|
|
752
|
+
}
|
|
753
|
+
},
|
|
754
|
+
{
|
|
755
|
+
read: la,
|
|
756
|
+
save: (N, le) => R(new File([N], le, { type: N.type })),
|
|
757
|
+
preparer: h,
|
|
758
|
+
submit: u.submitTask,
|
|
759
|
+
queryTask: u.getTask,
|
|
760
|
+
queryRequest: u.getTaskByRequest,
|
|
761
|
+
queryOriginal: u.queryOriginalTask
|
|
762
|
+
}
|
|
763
|
+
), te = d.value;
|
|
764
|
+
if (!H() || te.kind !== "loaded") return;
|
|
765
|
+
K(
|
|
766
|
+
$(v.value, {
|
|
767
|
+
...te,
|
|
768
|
+
applied: O.applied,
|
|
769
|
+
state: { kind: "idle" },
|
|
770
|
+
masters: [
|
|
771
|
+
...te.masters.filter((N) => N.background !== r.desired.background),
|
|
772
|
+
...O.masters.filter((N) => N.background === r.desired.background)
|
|
773
|
+
]
|
|
774
|
+
})
|
|
775
|
+
);
|
|
776
|
+
} catch (O) {
|
|
777
|
+
const te = d.value;
|
|
778
|
+
H() && te.kind === "loaded" && (E.value = O instanceof Error ? O.message : "Logo 准备失败", W.value = O instanceof Error && "reason" in O && typeof O.reason == "string" ? O.reason : "", K($(v.value, { ...te, state: { kind: "failed" } })));
|
|
779
|
+
} finally {
|
|
780
|
+
o === x && (f.value = !1, k.value = "", h?.dispose(), h = void 0), A();
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
async function ze(e) {
|
|
785
|
+
if (t.disabled || !e) return;
|
|
786
|
+
F();
|
|
787
|
+
const r = x;
|
|
788
|
+
S = void 0, E.value = "", f.value = !0, k.value = "正在准备 Logo…", b = new AbortController();
|
|
789
|
+
const o = b.signal, m = d.value.desired, V = t.scopeKey;
|
|
790
|
+
q = { generation: r, expected: { version: 2, kind: "empty", desired: m } }, K({
|
|
791
|
+
logo: void 0,
|
|
792
|
+
originalLogo: void 0,
|
|
793
|
+
logoPreparation: { version: 2, kind: "empty", desired: m },
|
|
794
|
+
preparedLogoVariants: void 0,
|
|
795
|
+
logoName: e.name,
|
|
796
|
+
ownerBatchId: V
|
|
797
|
+
});
|
|
798
|
+
try {
|
|
799
|
+
if (!["image/png", "image/jpeg", "image/webp"].includes(e.type) || !e.size || e.size > ge)
|
|
800
|
+
throw new Error("请选择5MiB以内的PNG、JPEG或WebP Logo");
|
|
801
|
+
const C = new Uint8Array(await e.arrayBuffer());
|
|
802
|
+
Ta(C);
|
|
803
|
+
const H = Ba(C);
|
|
804
|
+
if (H.width * H.height > _e) throw Error("Logo 超过400万像素");
|
|
805
|
+
if (r !== x || t.disabled) return;
|
|
806
|
+
const oe = await R(e);
|
|
807
|
+
if (r !== x || t.disabled || (De(oe), t.scopeKey !== V)) return;
|
|
808
|
+
const O = {
|
|
809
|
+
version: 2,
|
|
810
|
+
kind: "loaded",
|
|
811
|
+
original: oe,
|
|
812
|
+
desired: m,
|
|
813
|
+
applied: { settings: fe(), asset: oe },
|
|
814
|
+
masters: [],
|
|
815
|
+
state: { kind: "idle" }
|
|
816
|
+
};
|
|
817
|
+
q = { generation: r, expected: O }, K({
|
|
818
|
+
...$(v.value, O),
|
|
819
|
+
logoName: e.name,
|
|
820
|
+
ownerBatchId: V
|
|
821
|
+
});
|
|
822
|
+
} catch (C) {
|
|
823
|
+
r === x && !o.aborted && (E.value = C instanceof Error ? C.message : "Logo 准备失败", K({ logo: void 0 }));
|
|
824
|
+
} finally {
|
|
825
|
+
r === x && (f.value = !1, k.value = "", await xe(), r === x && (q = void 0, pe()));
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
function ua(e) {
|
|
829
|
+
const r = e.target;
|
|
830
|
+
ze(r.files?.[0]), r.value = "";
|
|
831
|
+
}
|
|
832
|
+
function ca(e) {
|
|
833
|
+
t.disabled || ze(e.dataTransfer?.files[0]);
|
|
834
|
+
}
|
|
835
|
+
function ga() {
|
|
836
|
+
if (t.disabled) return;
|
|
837
|
+
F(), E.value = "", W.value = "";
|
|
838
|
+
const e = d.value;
|
|
839
|
+
e.kind === "loaded" && e.original && K(
|
|
840
|
+
$(v.value, {
|
|
841
|
+
...e,
|
|
842
|
+
desired: fe(),
|
|
843
|
+
applied: { settings: fe(), asset: e.original },
|
|
844
|
+
state: { kind: "idle" }
|
|
845
|
+
})
|
|
846
|
+
);
|
|
847
|
+
}
|
|
848
|
+
function ma() {
|
|
849
|
+
t.disabled || (F(), E.value = "", K({
|
|
850
|
+
logo: void 0,
|
|
851
|
+
originalLogo: void 0,
|
|
852
|
+
preparedLogoVariants: void 0,
|
|
853
|
+
logoName: "",
|
|
854
|
+
logoPreparation: { version: 2, kind: "empty", desired: d.value.desired },
|
|
855
|
+
removeBackground: !1
|
|
856
|
+
}));
|
|
857
|
+
}
|
|
858
|
+
function Ke(e, r) {
|
|
859
|
+
if (t.disabled) return;
|
|
860
|
+
const o = r.target.value, m = Number(o), V = Ie.value.find((C) => C.key === e);
|
|
861
|
+
V && (M.value = { ...M.value, [e]: o }, o.trim() !== "" && Number.isInteger(m) && m >= V.min && m <= V.max && K({ [e]: e === "opacity" ? m / 100 : m }));
|
|
862
|
+
}
|
|
863
|
+
function ba(e) {
|
|
864
|
+
[
|
|
865
|
+
"ArrowLeft",
|
|
866
|
+
"ArrowRight",
|
|
867
|
+
"ArrowUp",
|
|
868
|
+
"ArrowDown",
|
|
869
|
+
"Home",
|
|
870
|
+
"End",
|
|
871
|
+
"PageUp",
|
|
872
|
+
"PageDown"
|
|
873
|
+
].includes(e.key) && e.stopPropagation();
|
|
874
|
+
}
|
|
875
|
+
function pa() {
|
|
876
|
+
if (t.disabled) return;
|
|
877
|
+
const e = f.value || G !== void 0;
|
|
878
|
+
F(), me.value++, ae.value = !0, M.value = {};
|
|
879
|
+
const r = d.value, o = e && r.kind === "loaded" ? $(v.value, {
|
|
880
|
+
...r,
|
|
881
|
+
desired: r.applied.settings,
|
|
882
|
+
state: { kind: "idle" }
|
|
883
|
+
}) : v.value;
|
|
884
|
+
E.value = "", W.value = "", g("update:modelValue", Xe(o));
|
|
885
|
+
}
|
|
886
|
+
return (e, r) => (w(), L("fieldset", {
|
|
887
|
+
class: "brand-mark-panel",
|
|
888
|
+
disabled: i.disabled,
|
|
889
|
+
"aria-label": n(a)("tools.brand_mark.brandMarkPanel_bfd3cc8f"),
|
|
890
|
+
onDragover: r[4] || (r[4] = Ge(() => {
|
|
891
|
+
}, ["stop", "prevent"])),
|
|
892
|
+
onDrop: Ge(ca, ["stop", "prevent"])
|
|
893
|
+
}, [
|
|
894
|
+
P("div", {
|
|
895
|
+
class: "brand-mode",
|
|
896
|
+
role: "radiogroup",
|
|
897
|
+
"aria-label": n(a)("tools.brand_mark.brandMarkPanel_b2722cb0")
|
|
898
|
+
}, [
|
|
899
|
+
(w(!0), L(de, null, ve([
|
|
900
|
+
["single", n(a)("tools.brand_mark.singleMark")],
|
|
901
|
+
["tile", n(a)("common.toolPanel_e415d1fe")]
|
|
902
|
+
].filter((o) => !i.allowedModes || i.allowedModes.includes(o[0])), (o, m) => (w(), L("button", {
|
|
903
|
+
key: o[0],
|
|
904
|
+
type: "button",
|
|
905
|
+
role: "radio",
|
|
906
|
+
"aria-label": o[1],
|
|
907
|
+
"aria-checked": se.value === o[0],
|
|
908
|
+
tabindex: se.value === o[0] ? 0 : -1,
|
|
909
|
+
onClick: (V) => Ne(o[0]),
|
|
910
|
+
onKeydown: (V) => sa(
|
|
911
|
+
V,
|
|
912
|
+
m,
|
|
913
|
+
["single", "tile"].filter((C) => !i.allowedModes || i.allowedModes.includes(C)),
|
|
914
|
+
(C) => Ne(C)
|
|
915
|
+
)
|
|
916
|
+
}, y(o[1]), 41, Ja))), 128))
|
|
917
|
+
], 8, Ha),
|
|
918
|
+
P("input", {
|
|
919
|
+
ref_key: "picker",
|
|
920
|
+
ref: I,
|
|
921
|
+
class: "logo-file-input",
|
|
922
|
+
hidden: "",
|
|
923
|
+
type: "file",
|
|
924
|
+
accept: "image/png,image/jpeg,image/webp",
|
|
925
|
+
"aria-label": n(a)("tools.brand_mark.brandMarkPanel_78f4cf57"),
|
|
926
|
+
onChange: ua
|
|
927
|
+
}, null, 40, Xa),
|
|
928
|
+
P("button", {
|
|
929
|
+
class: "logo-upload",
|
|
930
|
+
type: "button",
|
|
931
|
+
"aria-label": n(a)("tools.brand_mark.brandMarkPanel_b7603312"),
|
|
932
|
+
disabled: i.disabled,
|
|
933
|
+
onClick: r[0] || (r[0] = (o) => I.value?.click())
|
|
934
|
+
}, [
|
|
935
|
+
n(p) ? (w(), L("img", {
|
|
936
|
+
key: 0,
|
|
937
|
+
src: n(p),
|
|
938
|
+
alt: n(a)("tools.brand_mark.brandMarkPanel_baacf60a"),
|
|
939
|
+
decoding: "async"
|
|
940
|
+
}, null, 8, Qa)) : (w(), he(n(Ia), {
|
|
941
|
+
key: 1,
|
|
942
|
+
size: 24
|
|
943
|
+
})),
|
|
944
|
+
n(p) ? z("", !0) : (w(), L("strong", Za, y(i.modelValue.logoName || n(a)("tools.brand_mark.brandMarkPanel_7dcf64ca")), 1)),
|
|
945
|
+
P("small", null, y(f.value ? k.value === "logo-cloud-progress" ? n(a)("tools.brand_mark.cloudWaiting") : k.value === "logo-local-progress" ? n(a)("tools.brand_mark.localProgress") : n(c)(k.value) : n(a)("tools.brand_mark.brandMarkPanel_204bfba6")), 1)
|
|
946
|
+
], 8, Ya),
|
|
947
|
+
i.modelValue.originalLogo || f.value ? (w(), L("button", {
|
|
948
|
+
key: 0,
|
|
949
|
+
class: "logo-remove",
|
|
950
|
+
type: "button",
|
|
951
|
+
"aria-label": n(a)("tools.brand_mark.brandMarkPanel_731cdce5"),
|
|
952
|
+
onClick: ma
|
|
953
|
+
}, [
|
|
954
|
+
ce(n(Ea), { size: 14 }),
|
|
955
|
+
re(y(n(a)("tools.brand_mark.brandMarkPanel_731cdce5")), 1)
|
|
956
|
+
], 8, eo)) : z("", !0),
|
|
957
|
+
P("label", ao, [
|
|
958
|
+
re(y(n(a)("tools.brand_mark.backgroundMode")) + " ", 1),
|
|
959
|
+
P("select", {
|
|
960
|
+
value: B.value.background,
|
|
961
|
+
disabled: f.value && (B.value.background !== "original" || n(q) !== void 0),
|
|
962
|
+
onChange: ra
|
|
963
|
+
}, [
|
|
964
|
+
P("option", to, y(n(a)("tools.brand_mark.originalMode")), 1),
|
|
965
|
+
P("option", ro, y(n(a)("tools.brand_mark.solidRemoval")), 1),
|
|
966
|
+
(w(!0), L(de, null, ve(n($e), (o) => (w(), L("option", {
|
|
967
|
+
key: o.model,
|
|
968
|
+
value: o.model,
|
|
969
|
+
disabled: !ee(o.model)
|
|
970
|
+
}, y(n(c)(o.label)) + y(ee(o.model) ? "" : n(a)("common.toolPanel_14a718cd")), 9, no))), 128))
|
|
971
|
+
], 40, oo)
|
|
972
|
+
]),
|
|
973
|
+
(w(), he(Ra, {
|
|
974
|
+
key: me.value,
|
|
975
|
+
enabled: B.value.crop.kind === "alpha",
|
|
976
|
+
padding: B.value.crop.kind === "alpha" ? B.value.crop.padding : 0,
|
|
977
|
+
"max-padding": 1024,
|
|
978
|
+
hint: n(a)("tools.brand_mark.trimHint"),
|
|
979
|
+
source: Pe.value?.source,
|
|
980
|
+
"estimate-applied": Pe.value?.approximate,
|
|
981
|
+
disabled: i.disabled || f.value && (B.value.background !== "original" || n(q) !== void 0),
|
|
982
|
+
onEnabled: aa,
|
|
983
|
+
onPadding: oa,
|
|
984
|
+
onValidity: r[1] || (r[1] = (o) => ae.value = o)
|
|
985
|
+
}, null, 8, ["enabled", "padding", "hint", "source", "estimate-applied", "disabled"])),
|
|
986
|
+
B.value.crop.kind === "alpha" && Pe.value?.approximate ? (w(), L("p", io, y(n(a)("tools.brand_mark.approximateTrim")), 1)) : z("", !0),
|
|
987
|
+
n(ke)(v.value).kind === "pending" ? (w(), L("p", so, y(B.value.background !== "original" ? n(a)("tools.brand_mark.settingsPending") : d.value.kind === "loaded" && !d.value.original ? n(a)("tools.brand_mark.uploadOriginal") : d.value.kind === "loaded" && d.value.state.kind === "failed" ? n(a)("tools.brand_mark.preparationFailed") : n(a)("tools.brand_mark.previewPending")), 1)) : z("", !0),
|
|
988
|
+
Se.value > 0 ? (w(), L("p", lo, y(n(a)("tools.brand_mark.logoEstimate", { p0: Se.value })), 1)) : z("", !0),
|
|
989
|
+
f.value ? (w(), L("div", uo, [
|
|
990
|
+
P("span", co, [
|
|
991
|
+
r[5] || (r[5] = P("span", {
|
|
992
|
+
class: "logo-activity",
|
|
993
|
+
"aria-hidden": "true"
|
|
994
|
+
}, null, -1)),
|
|
995
|
+
re(" " + y(k.value === "logo-cloud-progress" ? n(a)("tools.brand_mark.cloudWaiting") : k.value === "logo-local-progress" ? n(a)("tools.brand_mark.localProgress") : n(c)(k.value)), 1)
|
|
996
|
+
]),
|
|
997
|
+
P("progress", {
|
|
998
|
+
value: Y.value,
|
|
999
|
+
max: "1"
|
|
1000
|
+
}, null, 8, go),
|
|
1001
|
+
P("button", {
|
|
1002
|
+
type: "button",
|
|
1003
|
+
class: "logo-cancel",
|
|
1004
|
+
"aria-label": k.value === "logo-cloud-progress" ? n(a)("tools.brand_mark.stopWaiting") : n(a)("tools.brand_mark.cancelPreparation"),
|
|
1005
|
+
title: k.value === "logo-cloud-progress" ? n(a)("tools.brand_mark.stopWaiting") : n(a)("tools.brand_mark.cancelPreparation"),
|
|
1006
|
+
onClick: ta
|
|
1007
|
+
}, [
|
|
1008
|
+
ce(n(La), {
|
|
1009
|
+
size: 16,
|
|
1010
|
+
"aria-hidden": "true"
|
|
1011
|
+
})
|
|
1012
|
+
], 8, mo)
|
|
1013
|
+
])) : B.value.background === "original" && d.value.kind === "loaded" && d.value.state.kind === "failed" && d.value.original ? (w(), L("div", bo, [
|
|
1014
|
+
P("button", {
|
|
1015
|
+
type: "button",
|
|
1016
|
+
disabled: !X.value,
|
|
1017
|
+
onClick: da
|
|
1018
|
+
}, y(n(a)("tools.brand_mark.retryPreview")), 9, po)
|
|
1019
|
+
])) : B.value.background !== "original" && n(ke)(v.value).kind !== "ready" ? (w(), L("div", vo, [
|
|
1020
|
+
P("button", {
|
|
1021
|
+
type: "button",
|
|
1022
|
+
disabled: !X.value || !ee(B.value.background) || d.value.kind !== "loaded" || !d.value.original || !!E.value && !["local-transient", "cloud-unknown"].includes(W.value),
|
|
1023
|
+
onClick: r[2] || (r[2] = (o) => Le())
|
|
1024
|
+
}, y(W.value === "local-transient" ? n(a)("tools.brand_mark.retryPreparation") : n(a)("tools.brand_mark.processLogo")), 9, ko)
|
|
1025
|
+
])) : z("", !0),
|
|
1026
|
+
E.value ? (w(), L("div", fo, [
|
|
1027
|
+
P("p", null, y(n(c)(E.value)), 1),
|
|
1028
|
+
P("button", {
|
|
1029
|
+
type: "button",
|
|
1030
|
+
onClick: ga
|
|
1031
|
+
}, y(n(a)("tools.brand_mark.brandMarkPanel_a3728699")), 1),
|
|
1032
|
+
ee("isnet_fp16") && ["inconsistent_corners", "noisy_background", "no_foreground"].includes(W.value) ? (w(), L("button", {
|
|
1033
|
+
key: 0,
|
|
1034
|
+
type: "button",
|
|
1035
|
+
onClick: r[3] || (r[3] = (o) => be({ ...B.value, background: "isnet_fp16" }))
|
|
1036
|
+
}, y(n(a)("tools.brand_mark.switchFast")), 1)) : z("", !0)
|
|
1037
|
+
])) : z("", !0),
|
|
1038
|
+
se.value === "single" ? (w(), L(de, { key: 8 }, [
|
|
1039
|
+
P("span", ho, y(n(a)("tools.brand_mark.brandMarkPanel_1fb4d574")), 1),
|
|
1040
|
+
P("div", {
|
|
1041
|
+
class: "brand-anchors",
|
|
1042
|
+
role: "group",
|
|
1043
|
+
"aria-label": n(a)("tools.brand_mark.brandMarkPanel_1c3852e5")
|
|
1044
|
+
}, [
|
|
1045
|
+
(w(), L(de, null, ve(T, ([o, m, V]) => P("button", {
|
|
1046
|
+
key: o,
|
|
1047
|
+
type: "button",
|
|
1048
|
+
"aria-label": n(a)("tools.brand_mark.brandMarkPanel_9c441f43", { p0: n(c)(m) }),
|
|
1049
|
+
"aria-pressed": i.modelValue.anchor === o,
|
|
1050
|
+
onClick: (C) => K({ anchor: o })
|
|
1051
|
+
}, y(V), 9, wo)), 64))
|
|
1052
|
+
], 8, yo)
|
|
1053
|
+
], 64)) : z("", !0),
|
|
1054
|
+
(w(!0), L(de, null, ve(Ie.value, (o) => (w(), L("div", {
|
|
1055
|
+
key: o.key,
|
|
1056
|
+
class: "brand-field"
|
|
1057
|
+
}, [
|
|
1058
|
+
P("label", null, [
|
|
1059
|
+
P("span", null, [
|
|
1060
|
+
re(y(n(c)(o.label)), 1),
|
|
1061
|
+
["sizePercent", "marginPercent", "angle"].includes(o.key) ? (w(), he(xa, {
|
|
1062
|
+
key: 0,
|
|
1063
|
+
text: o.key === "angle" ? n(a)("tools.brand_mark.brandMarkPanel_0d6bb2f4") : n(a)(
|
|
1064
|
+
o.key === "marginPercent" ? "common.audit.marginHelp" : "common.audit.logoSizeHelp"
|
|
1065
|
+
)
|
|
1066
|
+
}, null, 8, ["text"])) : z("", !0)
|
|
1067
|
+
]),
|
|
1068
|
+
P("span", null, [
|
|
1069
|
+
P("input", {
|
|
1070
|
+
type: "number",
|
|
1071
|
+
"aria-label": n(a)("tools.brand_mark.brandMarkPanel_1e5e0e2d", {
|
|
1072
|
+
p0: n(c)(o.label),
|
|
1073
|
+
p1: o.unit ? " / " + o.unit : ""
|
|
1074
|
+
}),
|
|
1075
|
+
min: o.min,
|
|
1076
|
+
max: o.max,
|
|
1077
|
+
step: "1",
|
|
1078
|
+
value: M.value[o.key] ?? Ee(o.key),
|
|
1079
|
+
onInput: (m) => Ke(o.key, m)
|
|
1080
|
+
}, null, 40, _o),
|
|
1081
|
+
re(y(o.unit), 1)
|
|
1082
|
+
])
|
|
1083
|
+
]),
|
|
1084
|
+
P("input", {
|
|
1085
|
+
type: "range",
|
|
1086
|
+
"aria-label": n(c)(o.label),
|
|
1087
|
+
title: o.key === "angle" ? n(a)("tools.brand_mark.brandMarkPanel_85cb55a6") : o.key === "density" ? n(a)("tools.brand_mark.brandMarkPanel_2f2abb95") : void 0,
|
|
1088
|
+
"aria-valuetext": `${Ee(o.key)}${o.unit}`,
|
|
1089
|
+
min: o.min,
|
|
1090
|
+
max: o.max,
|
|
1091
|
+
step: "1",
|
|
1092
|
+
value: Ee(o.key),
|
|
1093
|
+
onInput: (m) => Ke(o.key, m),
|
|
1094
|
+
onKeydown: ba
|
|
1095
|
+
}, null, 40, Po),
|
|
1096
|
+
o.key === "density" ? (w(), L("div", Io, [
|
|
1097
|
+
P("span", null, y(n(a)("tools.brand_mark.brandMarkPanel_7812011c")), 1),
|
|
1098
|
+
P("span", null, y(n(a)("tools.brand_mark.brandMarkPanel_6bea77ac")), 1),
|
|
1099
|
+
P("span", null, y(n(a)("tools.brand_mark.brandMarkPanel_0e3d8855")), 1)
|
|
1100
|
+
])) : z("", !0)
|
|
1101
|
+
]))), 128)),
|
|
1102
|
+
Te.value ? z("", !0) : (w(), L("p", Eo, y(n(a)("tools.brand_mark.brandMarkPanel_b7a07d1e")), 1)),
|
|
1103
|
+
i.hideReset ? z("", !0) : (w(), L("button", {
|
|
1104
|
+
key: 10,
|
|
1105
|
+
type: "button",
|
|
1106
|
+
class: "brand-reset",
|
|
1107
|
+
"aria-label": n(a)("tools.brand_mark.brandMarkPanel_3086a0b9"),
|
|
1108
|
+
onClick: pa
|
|
1109
|
+
}, [
|
|
1110
|
+
ce(n(Ma), { size: 14 }),
|
|
1111
|
+
re(y(n(a)("tools.brand_mark.brandMarkPanel_7fe8ee7c")), 1)
|
|
1112
|
+
], 8, Lo))
|
|
1113
|
+
], 40, Fa));
|
|
1114
|
+
}
|
|
1115
|
+
}), Mo = /* @__PURE__ */ Ca(xo, [["__scopeId", "data-v-92b829b5"]]), Vo = { class: "hint" }, Ao = {
|
|
1116
|
+
key: 0,
|
|
1117
|
+
class: "hint"
|
|
1118
|
+
}, Bo = {
|
|
1119
|
+
key: 1,
|
|
1120
|
+
class: "hint"
|
|
1121
|
+
}, No = /* @__PURE__ */ He({
|
|
1122
|
+
__name: "BrandMarkToolPanel",
|
|
1123
|
+
props: {
|
|
1124
|
+
context: {}
|
|
1125
|
+
},
|
|
1126
|
+
setup(i) {
|
|
1127
|
+
const { ui: s } = Je(), a = i, c = Na(() => a.context), t = j(!1), g = j(0), u = D(() => c.value.brandMark.opacity === 0), l = D(
|
|
1128
|
+
() => a.context.view.waitingCount ? void 0 : s("common.toolPanel_3e0a0715", {
|
|
1129
|
+
p0: a.context.view.appliedCount ? s("common.toolPanel_9f8d35b3") : s("common.toolPanel_7a8a11ea"),
|
|
1130
|
+
p1: c.value.brandMark.mode === "tile" ? s("common.toolPanel_e415d1fe") : s("common.toolPanel_aa9f217c"),
|
|
1131
|
+
p2: a.context.view.count
|
|
1132
|
+
})
|
|
1133
|
+
);
|
|
1134
|
+
function p() {
|
|
1135
|
+
g.value++, a.context.resetDraft({ brandMark: Xe(c.value.brandMark) });
|
|
1136
|
+
}
|
|
1137
|
+
const R = Da(() => a.context, "brandMark");
|
|
1138
|
+
return (I, f) => (w(), he(qa, {
|
|
1139
|
+
context: i.context,
|
|
1140
|
+
layout: "contained",
|
|
1141
|
+
changed: n(Sa)(n(c).brandMark),
|
|
1142
|
+
onReset: p
|
|
1143
|
+
}, {
|
|
1144
|
+
actions: Me(() => [
|
|
1145
|
+
ce(za, {
|
|
1146
|
+
context: i.context,
|
|
1147
|
+
available: n(Ka)(i.context),
|
|
1148
|
+
ready: t.value && !!n(c).brandMark.logo && !u.value,
|
|
1149
|
+
label: l.value
|
|
1150
|
+
}, {
|
|
1151
|
+
default: Me(() => [
|
|
1152
|
+
P("p", Vo, y(n(s)("common.audit.saveVersion")), 1),
|
|
1153
|
+
i.context.view.appliedCount ? (w(), L("p", Ao, y(n(s)("common.toolPanel_1c5c7944", { p0: i.context.view.appliedCount })), 1)) : z("", !0),
|
|
1154
|
+
u.value ? (w(), L("p", Bo, y(n(s)("common.toolPanel_6cc00dda")), 1)) : z("", !0)
|
|
1155
|
+
]),
|
|
1156
|
+
_: 1
|
|
1157
|
+
}, 8, ["context", "available", "ready", "label"])
|
|
1158
|
+
]),
|
|
1159
|
+
default: Me(() => [
|
|
1160
|
+
ce(Mo, {
|
|
1161
|
+
"model-value": n(c).brandMark,
|
|
1162
|
+
"hide-reset": !0,
|
|
1163
|
+
"allowed-modes": ["single", "tile"].filter((E) => i.context.modeAllowed?.(E) !== !1),
|
|
1164
|
+
disabled: i.context.readonly,
|
|
1165
|
+
"scope-key": i.context.view.batchId,
|
|
1166
|
+
"reset-epoch": g.value,
|
|
1167
|
+
"available-cutout-modes": i.context.view.availableCutoutModes,
|
|
1168
|
+
"upload-reference": i.context.uploadReference,
|
|
1169
|
+
"onUpdate:modelValue": n(R),
|
|
1170
|
+
onValidity: f[0] || (f[0] = (E) => t.value = E)
|
|
1171
|
+
}, null, 8, ["model-value", "allowed-modes", "disabled", "scope-key", "reset-epoch", "available-cutout-modes", "upload-reference", "onUpdate:modelValue"])
|
|
1172
|
+
]),
|
|
1173
|
+
_: 1
|
|
1174
|
+
}, 8, ["context", "changed"]));
|
|
1175
|
+
}
|
|
1176
|
+
});
|
|
1177
|
+
export {
|
|
1178
|
+
No as default
|
|
1179
|
+
};
|