xvai-loi 0.1.72 → 0.1.74

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 +56 -5
package/co.txt CHANGED
@@ -1 +1 @@
1
- xvaiLoi111816
1
+ xvaiLoi111930
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xvai-loi",
3
- "version": "0.1.72",
3
+ "version": "0.1.74",
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
@@ -9827,8 +9827,8 @@ var KHUON_TOPN = {
9827
9827
  cat: { moi10s: [4, 6] },
9828
9828
  nguoi: { phongToiDa: 1.8, matToiDa: 0.55 },
9829
9829
  // matToiDa: hộp đầu (tóc→cằm) cao hơn 0,55 H thì KHÔNG dùng ô người / chia (không vừa ô) // MỌI ô người (PIP, thẻ, chia) phóng khung gốc tối đa 1,8× (độ nét) — trước: PIP 1,6, thẻ 1,3 (B05-1027: thẻ hiện cả người nhỏ)
9830
- bien: { dau: 3, cuoi: 2.5, ctaAnh: true }
9831
- // không đặt ảnh trám ở 3 s đầu (móc) và 2,5 s cuối; vùng CTA VẪN có ảnh (đối thủ CTA 8,7 s vẫn trám)
9830
+ bien: { dau: 1.5, cuoi: 2.5, ctaAnh: true }
9831
+ // không đặt ảnh trám ở 1,5 s đầu (móc; bàn thử 13 video: 3 → 1,5 s nâng 1/3 đầu T2 63→87, B05 23→42, B08 25→45, không video nào tụt) và 2,5 s cuối; vùng CTA VẪN có ảnh (đối thủ CTA 8,7 s vẫn trám)
9832
9832
  };
9833
9833
  var HU3 = /^(và|với|là|thì|mà|nhưng|rồi|cái|những|các|một|này|đó|chúng|ta|tôi|mình|bạn|em|anh|chị|của|cho|để|nên|vì|cũng|đã|đang|sẽ|có|không|được|rất|ạ|nhé|nha|à|ơi|lại|ra|vào|đi|nó|họ|hãy|chỉ|cần|phải|mới|khi|nếu|vậy|thế|như|từ|trong|về|bị|hết|luôn|sau|trước)$/i;
9834
9834
  var sach2 = (x) => String(x || "").replace(/[.,!?;:…"“”]/g, "");
@@ -17783,6 +17783,14 @@ async function kichBanDoan(ws) {
17783
17783
  }
17784
17784
  } catch (e) {
17785
17785
  }
17786
+ try {
17787
+ const b = await docDem("kb:" + khoa3);
17788
+ if (b && b.moc) {
17789
+ globalThis.__kbNguon = "ben";
17790
+ return JSON.parse(JSON.stringify(b));
17791
+ }
17792
+ } catch (e) {
17793
+ }
17786
17794
  if (cm) {
17787
17795
  const dau = van.dau;
17788
17796
  for (const k of Object.keys(localStorage)) {
@@ -17843,6 +17851,10 @@ async function kichBanDoan(ws) {
17843
17851
  localStorage.setItem(khoa3, JSON.stringify({ ...j, van }));
17844
17852
  } catch (e) {
17845
17853
  }
17854
+ try {
17855
+ ghiDem("kb:" + khoa3, JSON.parse(JSON.stringify({ ...j, van })));
17856
+ } catch (e) {
17857
+ }
17846
17858
  return j;
17847
17859
  }
17848
17860
  } catch (e) {
@@ -18469,6 +18481,44 @@ async function chuanBiKho(kb, words, bao) {
18469
18481
  }
18470
18482
  }
18471
18483
  globalThis.__ghepKho = can.map((c) => [c.khoa, g[c.khoa] ? (co.find((x) => x.id === g[c.khoa])?.mo || "").slice(0, 70) : null]);
18484
+ {
18485
+ const W4 = (words || []).filter((w) => w && w.text), wl = W4.map((w) => chuan(w.text));
18486
+ let them = 0;
18487
+ for (const a of co) {
18488
+ if (a.loai !== "video" || da.has(a.id) || !/^omni-/i.test(String(a.ten))) continue;
18489
+ const t = chuan(String(a.ten).replace(/\.[a-z0-9]+$/i, "").replace(/^omni-[a-z0-9]+-\d+-/i, ""));
18490
+ if (t.length < 6) continue;
18491
+ let best = -1, bd = 1e9;
18492
+ for (let i = 0; i < wl.length; i++) {
18493
+ let s2 = "";
18494
+ for (let j = i; j < Math.min(wl.length, i + 8) && s2.length < t.length + 4; j++) {
18495
+ s2 += wl[j];
18496
+ if (s2.length >= t.length - 3) {
18497
+ const dd = lev(s2, t);
18498
+ if (dd < bd) {
18499
+ bd = dd;
18500
+ best = i;
18501
+ }
18502
+ }
18503
+ }
18504
+ }
18505
+ if (best < 0 || bd > Math.max(2, Math.round(0.25 * t.length))) continue;
18506
+ const tu = W4.slice(best, best + 3).map((w) => String(w.text).replace(/[.,!?;:…"“”]/g, "")).join(" "), khoa3 = "anh:" + tu.toLocaleLowerCase("vi");
18507
+ const cu = taiSan(khoa3);
18508
+ if (cu && cu.laVideo) continue;
18509
+ try {
18510
+ const im = await napVideo(a.blob, bao);
18511
+ im.khoId = a.id;
18512
+ datTaiSan(khoa3, im);
18513
+ da.add(a.id);
18514
+ n++;
18515
+ them++;
18516
+ kb.canh.push({ tu, kieu: "anh", chu: " ", chu2: "", khuon: 1, clip: 1 });
18517
+ } catch (e) {
18518
+ }
18519
+ }
18520
+ globalThis.__clipThem = them;
18521
+ }
18472
18522
  return n;
18473
18523
  }
18474
18524
  async function kiemAnhTao(kb, words, bao) {
@@ -18663,9 +18713,10 @@ async function goi(de, ar, bao) {
18663
18713
  }
18664
18714
  async function mot(d, ten, de, ar, bao) {
18665
18715
  if (taiSan(ten)) return true;
18716
+ const kTen = (/no faces/i.test(de) ? "ten2:" : "ten:") + ten;
18666
18717
  let a = await doc22(d, de);
18667
18718
  if (!a) {
18668
- a = await doc22(d, "ten:" + ten);
18719
+ a = await doc22(d, kTen);
18669
18720
  if (a) ghi2(d, de, a);
18670
18721
  }
18671
18722
  if (!a && khoaAnhDen() > Date.now()) throw new Error("\u0110ang t\u1EA1m kho\xE1 t\u1EA1o \u1EA3nh t\u1EDBi " + new Date(khoaAnhDen()).toLocaleTimeString());
@@ -18682,7 +18733,7 @@ async function mot(d, ten, de, ar, bao) {
18682
18733
  if (!r || !r.base64) return false;
18683
18734
  a = { base64: r.base64, mimeType: r.mimeType || "image/png" };
18684
18735
  ghi2(d, de, a);
18685
- ghi2(d, "ten:" + ten, a);
18736
+ ghi2(d, kTen, a);
18686
18737
  }
18687
18738
  const s = atob(String(a.base64).split(",").pop() || ""), u = new Uint8Array(s.length);
18688
18739
  for (let i = 0; i < s.length; i++) u[i] = s.charCodeAt(i);
@@ -20743,7 +20794,7 @@ function datCauLenh(a) {
20743
20794
  on2 = true;
20744
20795
  window.addEventListener("message", async (ev) => {
20745
20796
  const d = ev.data;
20746
- if (!d || d.xvaiLoi111816 !== true) return;
20797
+ if (!d || d.xvaiLoi111930 !== true) return;
20747
20798
  const o = String(ev.origin || "");
20748
20799
  if (!(o.indexOf("https://flow.google.com") === 0 || o.indexOf("https://labs.google") === 0)) return;
20749
20800
  const tra = (kq) => {