Your Name 1912bcd25b
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled
chore: sync all remaining local workspace changes
2026-05-08 11:26:57 +08:00

247 lines
7.8 KiB
JavaScript

/*
* Extracted from browser-delivered Turbopack chunk: d797a0c3f1e529b7.bdfb00cb92.js
* Module id: 740151
* For reading/searching only; this factory depends on the original Turbopack runtime.
*/
const moduleFactory = (e) => {
"use strict";
function t(e) {
return e;
}
e.s(["convertToChinaCdn", () => t], 740151);
let o = new Map();
function r() {
let e = window.devicePixelRatio;
return !Number.isFinite(e) || e <= 0 ? 1 : e;
}
function i(e) {
return null == e || "" === e || "null" === e || "undefined" === e;
}
let n = [100, 200, 400, 800, 1600],
s = /resize,w_(\d+)/;
function a(e, t, o) {
if (
!e ||
!e.includes("libtv-res.liblib.art") ||
!e.startsWith("http") ||
(o && o > 0xc800000) ||
e.includes("x-oss-process=")
)
return null;
let r = n.find((e) => e >= t) ?? n[n.length - 1],
i = e.includes("?") ? "&" : "?";
return `${e}${i}x-oss-process=image/resize,w_${r},m_lfit/format,webp/ignore-error,1`;
}
function l(e, t) {
if (
!e ||
!e.includes("libtv-res.liblib.art") ||
!e.startsWith("http") ||
e.includes("x-oss-process=")
)
return null;
let o = n.find((e) => e >= t) ?? n[n.length - 1],
r = e.includes("?") ? "&" : "?";
return `${e}${r}x-oss-process=video/snapshot,t_0,f_jpg,w_${o},m_fast,ar_auto`;
}
function d(e, t, o) {
if (
!e ||
!e.includes("libtv-res.liblib.art") ||
!e.startsWith("http") ||
(t && t > 0xc800000) ||
e.includes("x-oss-process=")
)
return null;
let r = null != o ? `/quality,Q_${o}` : "",
i = e.includes("?") ? "&" : "?",
s = n.map((t) => {
let o = `${e}${i}x-oss-process=image/resize,w_${t},m_lfit/format,webp${r}/ignore-error,1`;
return `${o} ${t}w`;
});
return { src: s[0].split(" ")[0], srcSet: s.join(", "), widths: [...n] };
}
let p = [1600, 800, 400, 200, 100];
function u(e) {
let t,
o = (t = e.match(s)) ? parseInt(t[1], 10) : null;
return null == o ? 200 : (p.find((e) => e <= o) ?? 100);
}
let c = /\.(mp4|mov|webm|avi|mkv|m4v|flv|wmv)(\?|$)/i;
function f(e) {
return !!e && c.test(e);
}
function g(e, t, o, r, i) {
return new Promise((n, s) => {
let a = new Image();
(a.crossOrigin = "anonymous"),
(a.onload = () => {
let e = a.naturalWidth,
l = a.naturalHeight,
d = Math.max(0, Math.round(t * e)),
p = Math.max(0, Math.round(o * l)),
u = Math.round(r * e),
c = Math.round(i * l);
if (
(d + u > e && (u = e - d),
p + c > l && (c = l - p),
u <= 0 || c <= 0)
)
return void s(Error("Invalid crop region"));
let f = document.createElement("canvas");
(f.width = u), (f.height = c);
let g = f.getContext("2d");
if (!g) return void s(Error("Canvas context unavailable"));
try {
g.drawImage(a, d, p, u, c, 0, 0, u, c),
n(f.toDataURL("image/png"));
} catch (e) {
s(e instanceof Error ? e : Error(String(e)));
}
}),
(a.onerror = () => s(Error("Image load failed"))),
(a.src = e);
});
}
function m(e, t, o, r, i) {
return new Promise((n, s) => {
let a = new Image();
(a.crossOrigin = "anonymous"),
(a.onload = () => {
let e = a.naturalWidth,
l = a.naturalHeight,
d = document.createElement("canvas");
(d.width = e), (d.height = l);
let p = d.getContext("2d");
if (!p) return void s(Error("Canvas context unavailable"));
try {
p.drawImage(a, 0, 0);
let s = Math.max(
2,
Math.min(8, Math.round(0.01 * Math.min(e, l))),
);
(p.strokeStyle = "#ff0000"),
(p.lineWidth = s),
p.strokeRect(t * e, o * l, r * e, i * l),
n(d.toDataURL("image/png"));
} catch (e) {
s(e instanceof Error ? e : Error(String(e)));
}
}),
(a.onerror = () => s(Error("Image load failed"))),
(a.src = e);
});
}
e.s(
[
"OSS_PROCESS_MAX_FILE_SIZE",
0,
0xc800000,
"RESPONSIVE_WIDTHS",
0,
n,
"cropImageByNormalizedRect",
() => g,
"drawFocusRegionRedBox",
() => m,
"getFasterCroppedImage",
0,
(e, t) => {
if (!e) return "";
if (
!e.startsWith("http") ||
e.includes("x-oss-process=") ||
(t?.fileSize && t.fileSize > 0xc800000)
)
return e;
let { width: o, height: i, format: n = "webp" } = t,
s = t?.devicePixelRatio ?? r(),
a = Math.floor(parseInt(o) * s),
l = Math.floor(parseInt(i) * s),
d = e.includes("?") ? "&" : "?";
return !Number.isFinite(a) || !Number.isFinite(l) || a <= 0 || l <= 0
? e
: `${e}${d}x-oss-process=image/resize,m_fill,w_${a},h_${l}/format,${n}/ignore-error,1`;
},
"getFasterImage",
0,
(e, t) => {
if (i(e)) return "";
if (
!e.includes("libtv-res.liblib.art") ||
!e.startsWith("http") ||
(t?.fileSize && t.fileSize > 0xc800000)
)
return e;
let { format: o = "webp", width: n, length: s, height: a } = { ...t },
l = t?.devicePixelRatio ?? r();
if (!n && !s && !a)
return `${e}?x-oss-process=image/format,${o}/ignore-error,1`;
if (n) {
let t = Math.floor(parseInt(n) * l);
return `${e}?x-oss-process=image/resize,w_${t},m_lfit/format,${o}/ignore-error,1`;
}
if (s) {
let t = Math.floor(parseInt(s) * l);
return `${e}?x-oss-process=image/resize,l_${t},m_lfit/format,${o}/ignore-error,1`;
}
if (a) {
let t = Math.floor(parseInt(a) * l);
return `${e}?x-oss-process=image/resize,h_${t},m_lfit/format,${o}/ignore-error,1`;
}
return e;
},
"getOssCompressedImage",
0,
(e, t = 600, o) => {
if (!e) return "";
if (
!e.startsWith("http") ||
(o && o > 0xc800000) ||
e.includes("x-oss-process=")
)
return e;
let r = e.includes("?") ? "&" : "?";
return `${e}${r}x-oss-process=image/resize,w_${t},m_lfit/format,webp/ignore-error,1`;
},
"getResponsiveImageUrls",
() => d,
"getUrlForWidth",
() => a,
"getVideoSnapshotForWidth",
() => l,
"getWidthTierForCache",
() => u,
"imagePrefetch",
0,
(e, t) =>
new Promise((r, i) => {
if (o.has(e)) return;
let n = setTimeout(() => {
o.delete(e), i(Error("Timeout"));
}, t?.timeout ?? 6e4),
s = new Image();
t?.crossOrigin && s.setAttribute("crossOrigin", "Anonymous"),
(s.onerror = () => {
o.delete(e),
clearTimeout(n),
i(Error("Failed to prefetch image"));
}),
(s.onload = () => {
o.delete(e), clearTimeout(n), r(s);
}),
o.set(e, !0),
(s.src = e);
}),
"isEmptyImageSrc",
() => i,
"isVideoUrl",
() => f,
],
295085,
);
};
export default moduleFactory;