xvai-loi 0.1.63 → 0.1.64

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 +15 -7
package/co.txt CHANGED
@@ -1 +1 @@
1
- xvaiLoi111249
1
+ xvaiLoi111325
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xvai-loi",
3
- "version": "0.1.63",
3
+ "version": "0.1.64",
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
@@ -10765,11 +10765,17 @@ dangKy("cmAnh", (g, d, tuoi, W4, H2, _n, _s, dai2) => {
10765
10765
  wK2 = 0.76 * W4;
10766
10766
  yK = (c.y - hK * c.k / 2 + 0.575 * 112 / 1920 * c.k) * H2;
10767
10767
  } else {
10768
+ let rT = 64;
10769
+ for (let r = 0; r < 64 && rT === 64; r++) {
10770
+ let m = 0;
10771
+ for (let cc = 4; cc < 32; cc++) m += LA[r * 36 + cc];
10772
+ if (m >= 3) rT = r;
10773
+ }
10768
10774
  const ph = (y0) => {
10769
10775
  let n = 0, t = 0;
10770
10776
  for (let r = Math.floor(y0 * 64); r < Math.min(64, Math.ceil((y0 + hK) * 64)); r++) for (let cc = 4; cc < 32; cc++) {
10771
10777
  t++;
10772
- n += LA[r * 36 + cc];
10778
+ n += LA[r * 36 + cc] * (r >= rT && r < rT + 16 ? 4 : 1);
10773
10779
  }
10774
10780
  return t ? n / t : 1;
10775
10781
  };
@@ -10784,7 +10790,7 @@ dangKy("cmAnh", (g, d, tuoi, W4, H2, _n, _s, dai2) => {
10784
10790
  if (d.chu2) chu2(g, d.chu2, xK, yK + 125 * kK * H2 / 1920 + (1 - k) * 70 * H2 / 1920, 96 * kK * H2 / 1920, d.do2 ? "do" : "vang", kep12((tuoi - 0.35) / 0.15) * kc, wK2);
10785
10791
  }
10786
10792
  if (d.pip && _n) {
10787
- const bw = 0.36 * W4, bh = bw * 1.2, bx = 0.06 * W4, by = 0.555 * H2 + (1 - eOut(Math.min(1, tuoi / 0.35))) * 0.05 * H2, F = d.F, Dm = dauCanh(d, _n, W4, H2), Fd = F && F[3] - F[1] > 0.45 ? F : Dm || F, top = Fd ? Fd[1] : 0.2, cam = Fd ? Math.max(Fd[3], top + 0.12) : 0.6, s = Math.max(bw / W4, bh / H2, Math.min(1.6, 0.54 * bh / (Math.max(0.08, cam - top) * H2))), cx0 = Fd ? (Fd[0] + Fd[2]) / 2 : 0.5, MK = globalThis.__matKhung, kd = d._goc || d, cx = MK ? kd.__pipCx = kd.__pipCx == null ? (MK[0] + MK[2]) / 2 : kd.__pipCx + ((MK[0] + MK[2]) / 2 - kd.__pipCx) * 0.12 : cx0;
10793
+ const bw = 0.36 * W4, bh = bw * 1.2, bx = 0.06 * W4, by = 0.555 * H2 + (1 - eOut(Math.min(1, tuoi / 0.35))) * 0.05 * H2, F = d.F, Dm = dauCanh(d, _n, W4, H2), Fd = F && F[3] - F[1] > 0.45 ? F : Dm || F || globalThis.__matNguon, top = Fd ? Fd[1] : 0.2, cam = Fd ? Math.max(Fd[3], top + 0.12) : 0.6, s = Math.max(bw / W4, bh / H2, Math.min(1.6, 0.54 * bh / (Math.max(0.08, cam - top) * H2))), cx0 = Fd ? (Fd[0] + Fd[2]) / 2 : 0.5, MK = globalThis.__matKhung, kd = d._goc || d, cx = MK ? kd.__pipCx = kd.__pipCx == null ? (MK[0] + MK[2]) / 2 : kd.__pipCx + ((MK[0] + MK[2]) / 2 - kd.__pipCx) * 0.12 : cx0;
10788
10794
  hop3(g, "nguoi:pip", bx, by, bx + bw, by + bh);
10789
10795
  globalThis.__pipO = { k: globalThis.__khungSo, b: [bx, 0.555 * H2, bx + bw, 0.555 * H2 + bh] };
10790
10796
  g.save();
@@ -11702,7 +11708,7 @@ function lapCuongMe(o) {
11702
11708
  if (x.kieu === "anh" && dV) {
11703
11709
  de(f2, dV, { uuTien: UT.so + 5, bo: "anh", ten: ten2, chu: chuK, chu2: chu22, keu: "whoosh", video: 1 }, 3, datAnh);
11704
11710
  ghiL("video", { bo: "anh", f: f2, d: dV }, "kho video: ung vien clip " + dV.toFixed(1) + " s thay anh: " + String(x.tu || ""));
11705
- } else if (x.kieu === "anh") de(f2, (f2 < f1 ? 2 : 2.4) * kTram(), { uuTien: UT.anh, ...co ? [{ bo: "anh", ten: ten2, chu: chuK, chu2: chu22, keu: "whoosh" }, { bo: "chia", ten: ten2, chu: chuK, keu: "whoosh" }, { bo: "anh", ten: ten2, chu: chuK, chu2: chu22, pip: 1, keu: "whoosh" }][nAnh++ % 3] : { bo: "kinh", dong: [chuK, chu22].filter(Boolean), keu: "whoosh" } }, 3, datAnh);
11711
+ } else if (x.kieu === "anh" && (co || chuK)) de(f2, (f2 < f1 ? 2 : 2.4) * kTram(), { uuTien: UT.anh, ...co ? [{ bo: "anh", ten: ten2, chu: chuK, chu2: chu22, keu: "whoosh" }, { bo: "chia", ten: ten2, chu: chuK, keu: "whoosh" }, { bo: "anh", ten: ten2, chu: chuK, chu2: chu22, pip: 1, keu: "whoosh" }][nAnh++ % 3] : { bo: "kinh", dong: [chuK, chu22].filter(Boolean), keu: "whoosh" } }, 3, datAnh);
11706
11712
  else if (x.kieu === "vat") {
11707
11713
  const LG = timLogo(suaChu(chuK + " " + sach2(String(x.tu || ""))))[0];
11708
11714
  if (LG) napHinhLogo(LG.slug);
@@ -14262,6 +14268,7 @@ async function renderNhanh(ff, clips, files, audio, cards, nen2, options, paint,
14262
14268
  }
14263
14269
  {
14264
14270
  globalThis.__matKhung = null;
14271
+ globalThis.__matNguon = null;
14265
14272
  if (FM.length) {
14266
14273
  const ts2 = c.trimStart + u;
14267
14274
  let m = FM[0];
@@ -14269,6 +14276,7 @@ async function renderNhanh(ff, clips, files, audio, cards, nen2, options, paint,
14269
14276
  if (Math.abs(m.t - ts2) < 0.6) {
14270
14277
  const mx = (nx) => (((W4 - sw * c0) / 2 + nx * sw * c0 - sx) * z - dx) / q / W4, my = (ny) => (((H2 - sh * c0) / 2 + ny * sh * c0 - sy) * z - dy) / q / H2, top = typeof m.headTop === "number" ? Math.min(m.headTop, m.face.y) : m.face.y, cam = typeof m.chin === "number" && m.chin > m.face.y ? m.chin : m.face.y + m.face.h;
14271
14278
  globalThis.__matKhung = [mx(m.face.x), my(top), mx(m.face.x + m.face.w), my(cam)];
14279
+ globalThis.__matNguon = [m.face.x, top, m.face.x + m.face.w, cam];
14272
14280
  }
14273
14281
  }
14274
14282
  }
@@ -18761,7 +18769,7 @@ async function handleExport(currentProject, setExporting, setExportedBlob, addLo
18761
18769
  }
18762
18770
  return -1;
18763
18771
  };
18764
- const moc = kb.canh.filter((c) => c && (c.kieu === "anh" || c.kieu === "vat")).map((c) => timTu(c.tu)).filter((i) => i >= 0).map((i) => W4[i].t0).sort((x, y) => x - y), pts = [W4[0].t0 + 3, ...moc, W4[W4.length - 1].t1 - 3];
18772
+ const moc = kb.canh.filter((c) => c && c.tu).map((c) => timTu(c.tu)).filter((i) => i >= 0).map((i) => W4[i].t0).sort((x, y) => x - y), pts = [W4[0].t0 + 3, ...moc, W4[W4.length - 1].t1 - 3];
18765
18773
  let them = 0;
18766
18774
  for (let k = 0; k + 1 < pts.length && them < 8; k++) {
18767
18775
  const a0 = pts[k], b0 = pts[k + 1];
@@ -18773,7 +18781,7 @@ async function handleExport(currentProject, setExporting, setExportedBlob, addLo
18773
18781
  while (i >= 0 && i < i0 + 5 && i < W4.length - 3 && HU4.test(String(W4[i].text).replace(/[.,!?;:…"“”]/g, ""))) i++;
18774
18782
  if (i < 0 || i + 3 > W4.length) continue;
18775
18783
  const tu = W4.slice(i, i + 3).map((w) => String(w.text).replace(/[.,!?;:…"“”]/g, "")).join(" "), cau = W4.slice(Math.max(0, i - 5), i + 10).map((w) => w.text).join(" ");
18776
- kb.canh.push({ tu, kieu: "anh", chu: W4.slice(i, i + 6).map((w) => String(w.text).replace(/[.,!?;:…"“”]/g, "")).filter((x) => !HU4.test(x)).slice(0, 3).join(" ").toLocaleUpperCase("vi"), chu2: "", en: 'Cinematic photorealistic vertical photo that illustrates the meaning of this Vietnamese sentence: "' + cau + '". Vietnamese people, real everyday setting, natural light, no text, no captions.' });
18784
+ kb.canh.push({ tu, kieu: "anh", chu: " ", chu2: "", en: 'Cinematic photorealistic vertical photo that illustrates the meaning of this Vietnamese sentence: "' + cau + '". Vietnamese people, real everyday setting, natural light, no text, no captions.' });
18777
18785
  them++;
18778
18786
  }
18779
18787
  }
@@ -20528,7 +20536,7 @@ async function napLoi(d) {
20528
20536
  return "LOI: " + String(e && e.message || e).slice(0, 300);
20529
20537
  }
20530
20538
  }
20531
- var LOI_URL = "https://cdn.jsdelivr.net/npm/xvai-loi@0.1.62/nap.js";
20539
+ var LOI_URL = "https://cdn.jsdelivr.net/npm/xvai-loi@0.1.63/nap.js";
20532
20540
  var TRONG_LOI = !!globalThis.__xvaiReact;
20533
20541
  try {
20534
20542
  if (!TRONG_LOI) setTimeout(() => {
@@ -20558,7 +20566,7 @@ function datCauLenh(a) {
20558
20566
  on2 = true;
20559
20567
  window.addEventListener("message", async (ev) => {
20560
20568
  const d = ev.data;
20561
- if (!d || d.xvaiLoi111249 !== true) return;
20569
+ if (!d || d.xvaiLoi111325 !== true) return;
20562
20570
  const o = String(ev.origin || "");
20563
20571
  if (!(o.indexOf("https://flow.google.com") === 0 || o.indexOf("https://labs.google") === 0)) return;
20564
20572
  const tra = (kq) => {