xvai-loi 0.1.83 → 0.1.85

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 (3) hide show
  1. package/co.txt +1 -1
  2. package/package.json +1 -1
  3. package/xvai-loi.js +24 -11
package/co.txt CHANGED
@@ -1 +1 @@
1
- xvaiLoi120102
1
+ xvaiLoi120210
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xvai-loi",
3
- "version": "0.1.83",
3
+ "version": "0.1.85",
4
4
  "description": "Loi dung video (Edit Video Tu Dong) nap vao tool Google Flow qua o cam engine/oCam.ts",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
package/xvai-loi.js CHANGED
@@ -9684,7 +9684,7 @@ function moNhanh(g, W4, H2, ve, r, them = "") {
9684
9684
  // flow-src/engine/khuon.ts
9685
9685
  var KHUON_TOPN = {
9686
9686
  ten: "Top N chi\u1EC1u s\xE2u (Captions)",
9687
- tram: { phut: 18.3, tyLe: 0.7, phan: [0.83, 0.81, 0.46], daiTV: 2.1, video: 0.33, nhanVat: ["Vietnamese people in a real everyday setting.", "Close-up of an object, hands or a place that shows the idea, no faces."], cheToiDa: 0.55, tranToiDa: 0.8, tranToiThieu: 0.5 },
9687
+ tram: { phut: 18.3, tyLe: 0.7, phan: [0.83, 0.81, 0.46], daiTV: 2.1, video: 0.33, nhanVat: ["Vietnamese people in a real everyday setting.", "Close-up of an object, hands or a place that shows the idea, no faces."], cheToiDa: 0.45, tranToiDa: 0.8, tranToiThieu: 0.5 },
9688
9688
  // cheToiDa: phần phim người nói bị CHE (ảnh / thẻ kính toàn khung) tối đa — máy đo B9 'không thấy mặt' ≈ 0,5–0,87 × che (ảnh có người vẫn tính thấy mặt) → 0,55 giữ B9 ≤ ~40 (D03-1041: che 60 %, B9 53 %); tranToiThieu: không cắt khi trám còn < 50 % (B2 ≥ 45) · tranToiDa: trám cả chia / thẻ tối đa (B2 45–80 %) · cảnh trám / phút, % thời lượng, 3 phần đầu/giữa/cuối, độ dài trung vị (s), tỉ lệ clip động; nhanVat: xen kẽ ảnh có người / cận vật-tay-nơi (đối thủ trộn web, stock, 3D — B06-1027: toàn ảnh người → 'không thấy mặt' 12 % < 15)
9689
9689
  chu: { phut: [8, 18], caoMin: 0.042 },
9690
9690
  // caoMin: nét chữ nhấn (kể cả dấu) / H — đối thủ trung vị 0,042 (đo tay 23 dòng); chữ bị ép ngang thấp hơn → 2 dòng
@@ -10855,14 +10855,14 @@ dangKy("cmNen", (g, d, tuoi, W4, H2, nen2, _s, dai2) => {
10855
10855
  if (hv2 > 0) g.drawImage(vt, W4 / 2 - wv / 2, yv - hv2 / 2, wv, hv2);
10856
10856
  g.restore();
10857
10857
  }
10858
- const t2 = d.tieu ? haiDong4(g, String(d.tieu), 122 * H2 / 1920, 0.76 * W4, KHUON_TOPN.chu.caoMin / 0.92 * H2, 0.05 * H2) : null;
10859
- if (t2) chu2(g, t2[0], W4 / 2, (t2[2] ? 0.118 : 0.135) * H2 + (1 - ka) * 70 * H2 / 1920, t2[1], "brand", kep12(tuoi / 0.15), 0.76 * W4);
10858
+ const t2 = d.tieu ? haiDong4(g, String(d.tieu), 122 * H2 / 1920, 0.76 * W4, KHUON_TOPN.chu.caoMin / 0.92 * H2, 0.046 * H2) : null;
10859
+ if (t2) chu2(g, t2[0], W4 / 2, (t2[2] ? 0.15 : 0.135) * H2 + (1 - ka) * 70 * H2 / 1920, t2[1], "brand", kep12(tuoi / 0.15), 0.76 * W4);
10860
10860
  if (d.so) {
10861
10861
  g.save();
10862
10862
  g.globalAlpha = a * kep12((tuoi - 0.15) / 0.2);
10863
10863
  g.font = "900 " + (0.02 * H2).toFixed(1) + "px " + FB;
10864
10864
  const t = (d.nhom || "M\u1EE4C") + " " + d.so + "/" + d.N, tw = g.measureText(t).width + 0.05 * W4;
10865
- const dy = t2 && t2[2] ? 0.01 * H2 : 0;
10865
+ const dy = t2 && t2[2] ? 0.04 * H2 : 0;
10866
10866
  bo(g, W4 / 2 - tw / 2, 0.172 * H2 + dy, tw, 0.034 * H2, 0.017 * H2);
10867
10867
  g.fillStyle = "rgba(20,20,26,0.85)";
10868
10868
  g.fill();
@@ -10874,11 +10874,11 @@ dangKy("cmNen", (g, d, tuoi, W4, H2, nen2, _s, dai2) => {
10874
10874
  }
10875
10875
  if (d.ui) theUI(g, d.ui, tuoi, W4, H2, 1);
10876
10876
  if (d.hang) {
10877
- let yh = d.so ? 0.23 : 0.17, kh = 1;
10877
+ let yh = (d.so ? 0.23 : 0.17) + (t2 && t2[2] ? 0.04 : 0), kh = 1;
10878
10878
  const L2 = luoiNguoi2(p || (nen2 ? nguoi(nen2, W4, H2) : null), d), F2 = F || (nen2 ? dauCanh(d, nen2, W4, H2) : null);
10879
10879
  if (L2 && F2) {
10880
10880
  const tt = d.bo === "cut" && p ? THU_HANG : 1, Lt = tt < 1 ? thuLuoi(L2, tt) : L2, Ft = tt < 1 ? [0.5 + tt * (F2[0] - 0.5), 1 - tt * (1 - F2[1]), 0.5 + tt * (F2[2] - 0.5), 1 - tt * (1 - F2[3])] : F2;
10881
- const nr = Math.ceil(d.hang.length / (d.hang.length > 3 ? 2 : 1)), hb2 = nr * 0.078, c = datKhoiChu({ luoi: Lt, mat: [Ft[0], Ft[1] + 0.25 * (Ft[3] - Ft[1]), Ft[2], Ft[3]], dinh: Ft[1], cam: Ft[3] }, { h: hb2, w: d.hang.length > 3 ? 0.87 : 0.7 }, false, false, void 0, false, W4 / H2, [[0, 0, 1, d.so ? 0.21 : 0.17]]);
10881
+ const nr = Math.ceil(d.hang.length / (d.hang.length > 3 ? 2 : 1)), hb2 = nr * 0.078, c = datKhoiChu({ luoi: Lt, mat: [Ft[0], Ft[1] + 0.25 * (Ft[3] - Ft[1]), Ft[2], Ft[3]], dinh: Ft[1], cam: Ft[3] }, { h: hb2, w: d.hang.length > 3 ? 0.87 : 0.7 }, false, false, void 0, false, W4 / H2, [[0, 0, 1, (d.so ? 0.21 : 0.17) + (t2 && t2[2] ? 0.04 : 0)]]);
10882
10882
  if (c.k > 0) {
10883
10883
  kh = c.k;
10884
10884
  yh = c.y - hb2 * c.k / 2;
@@ -13008,11 +13008,13 @@ function lapCuongMe(o) {
13008
13008
  const mn = +(globalThis.__manhNguoi ?? KHUON_TOPN.cat.manhNguoi), ds2 = () => sp.filter((x) => x.bo !== "phong").sort((p, q) => p.f - q.f);
13009
13009
  for (const [loai2, tran] of [[/^(anh|kinh)$/, KHUON_TOPN.tram.cheToiDa], [/^(anh|kinh|chia|card)$/, KHUON_TOPN.tram.tranToiDa]]) {
13010
13010
  let du = sp.filter((x) => loai2.test(String(x.bo))).reduce((s2, x) => s2 + x.d, 0) - tran * tong, vong2 = 0;
13011
- while (du > 0.05 && vong2++ < 60 && sp.filter((x) => /^(anh|kinh|chia|card)$/.test(String(x.bo))).reduce((s2, x) => s2 + x.d, 0) > KHUON_TOPN.tram.tranToiThieu * tong + 0.3) {
13011
+ while (du > 0.05 && vong2++ < 60) {
13012
+ const duE = Math.min(du, sp.filter((x) => /^(anh|kinh|chia|card)$/.test(String(x.bo))).reduce((s2, x) => s2 + x.d, 0) - KHUON_TOPN.tram.tranToiThieu * tong);
13013
+ if (duE <= 0.25) break;
13012
13014
  const L = ds2(), cat2 = L.filter((x) => loai2.test(String(x.bo)) && /^(anh|chia)$/.test(String(x.bo)) && !x.khoa && !x.dong && !x.doc && !x.ui && !x.hang && x.f >= 1).sort((p, q) => q.d - p.d);
13013
13015
  let lam = false;
13014
13016
  for (const x of cat2) {
13015
- const nx = L[L.indexOf(x) + 1], het = nx ? nx.f : tong, giu2 = Math.max(1.6, x.d - du - (nx && het - (x.f + x.d) < mn ? mn - (het - (x.f + x.d)) : 0));
13017
+ const nx = L[L.indexOf(x) + 1], het = nx ? nx.f : tong, giu2 = Math.max(1.6, x.d - duE - (nx && het - (x.f + x.d) < mn ? mn - (het - (x.f + x.d)) : 0));
13016
13018
  const d2 = nx && het - (x.f + giu2) < mn ? het - mn - x.f : giu2;
13017
13019
  if (d2 >= 1.6 && x.d - d2 > 0.25) {
13018
13020
  ghiL("rut", x, "khuon tram tran: " + x.d.toFixed(2) + " -> " + d2.toFixed(2) + " s");
@@ -13023,7 +13025,18 @@ function lapCuongMe(o) {
13023
13025
  }
13024
13026
  }
13025
13027
  if (!lam) {
13026
- const bo4 = cat2.filter((x) => !String(x.chu || x.giant || "").trim()).sort((p, q) => q.d - p.d)[0];
13028
+ const demCat = (bo22) => {
13029
+ let c = 0, e = -1;
13030
+ for (const x of ds2()) {
13031
+ if (x === bo22) continue;
13032
+ if (x.f - e > 0.05) c += e < 0 ? 1 : 2;
13033
+ else c += 1;
13034
+ e = Math.max(e, x.f + x.d);
13035
+ }
13036
+ if (tong - e > 0.05) c++;
13037
+ return c / tong * 10;
13038
+ };
13039
+ const bo4 = cat2.filter((x) => !String(x.chu || x.giant || "").trim() && x.d <= duE + 0.3 && demCat(x) >= KHUON_TOPN.cat.moi10s[0] + 0.2).sort((p, q) => q.d - p.d)[0];
13027
13040
  if (!bo4) break;
13028
13041
  ghiL("bo", bo4, "khuon tram tran: bo anh khong chu");
13029
13042
  du -= bo4.d;
@@ -13064,7 +13077,7 @@ function lapCuongMe(o) {
13064
13077
  G4.__doiNguoiBo = nD;
13065
13078
  }
13066
13079
  {
13067
- const coC = (x) => x.bo !== "phong" && !!String(x.giant || x.chu || x.tieu || "").trim(), C2 = sp.filter(coC).sort((p, q) => p.f - q.f), tran = Math.floor(0.9 * KHUON_TOPN.chu.phut[1] * tong / 60);
13080
+ const coC = (x) => x.bo !== "phong" && (!!String(x.giant || x.chu || x.tieu || "").trim() || x.bo === "kinh" && Array.isArray(x.dong) && x.dong.length > 0), C2 = sp.filter(coC).sort((p, q) => p.f - q.f), tran = Math.floor(0.9 * KHUON_TOPN.chu.phut[1] * tong / 60);
13068
13081
  let nT = 0;
13069
13082
  while (C2.length > tran) {
13070
13083
  let j = -1, m = 1e9;
@@ -20977,7 +20990,7 @@ function datCauLenh(a) {
20977
20990
  on2 = true;
20978
20991
  window.addEventListener("message", async (ev) => {
20979
20992
  const d = ev.data;
20980
- if (!d || d.xvaiLoi120102 !== true) return;
20993
+ if (!d || d.xvaiLoi120210 !== true) return;
20981
20994
  const o = String(ev.origin || "");
20982
20995
  if (!(o.indexOf("https://flow.google.com") === 0 || o.indexOf("https://labs.google") === 0)) return;
20983
20996
  const tra = (kq) => {