xvai-loi 0.1.71 → 0.1.73

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 +27 -7
package/co.txt CHANGED
@@ -1 +1 @@
1
- xvaiLoi111747
1
+ xvaiLoi111825
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xvai-loi",
3
- "version": "0.1.71",
3
+ "version": "0.1.73",
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, "");
@@ -9854,6 +9854,13 @@ function lapAnhTheoKhuon(kb, ws, K = KHUON_TOPN, toiDa = 12) {
9854
9854
  (c) => c && c.tu && /^(anh|ds)$/.test(String(c.kieu))
9855
9855
  /* 'so' vẽ thành chữ to trên người / ô tròn (cut/tron) — không phải trám */
9856
9856
  ).map((c) => timTu(c.tu)).filter((i) => i >= 0).map((i) => W4[i].t0).filter((t) => t > t0 && t < t1).sort((a, b) => a - b);
9857
+ let noi2 = 0;
9858
+ for (let i = 0; i < W4.length; i++) {
9859
+ if (W4[i].t0 < t0 || W4[i].t1 > t1) continue;
9860
+ noi2 += W4[i].t1 - W4[i].t0 + (i + 1 < W4.length ? Math.min(0.4, Math.max(0, W4[i + 1].t0 - W4[i].t1)) : 0);
9861
+ }
9862
+ const mocDu = kb.canh.filter((c) => c && c.tu && /^(anh|ds|vat)$/.test(String(c.kieu))).map((c) => timTu(c.tu)).filter((i) => i >= 0 && W4[i].t0 > t0 && W4[i].t0 < t1).length;
9863
+ if (mocDu / Math.max(1e-6, noi2 / 60) >= 0.9 * K.tram.phut) return 0;
9857
9864
  const pts = [t0, ...moc, t1];
9858
9865
  let them = 0;
9859
9866
  for (let k = 0; k + 1 < pts.length && them < toiDa; k++) {
@@ -17776,6 +17783,14 @@ async function kichBanDoan(ws) {
17776
17783
  }
17777
17784
  } catch (e) {
17778
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
+ }
17779
17794
  if (cm) {
17780
17795
  const dau = van.dau;
17781
17796
  for (const k of Object.keys(localStorage)) {
@@ -17836,6 +17851,10 @@ async function kichBanDoan(ws) {
17836
17851
  localStorage.setItem(khoa3, JSON.stringify({ ...j, van }));
17837
17852
  } catch (e) {
17838
17853
  }
17854
+ try {
17855
+ ghiDem("kb:" + khoa3, JSON.parse(JSON.stringify({ ...j, van })));
17856
+ } catch (e) {
17857
+ }
17839
17858
  return j;
17840
17859
  }
17841
17860
  } catch (e) {
@@ -18555,7 +18574,7 @@ async function napVideo(b, bao) {
18555
18574
 
18556
18575
  // flow-src/engine/taiSanAI.ts
18557
18576
  var NEN = ", isolated on a plain flat light grey studio background, soft even light, no shadow on background, no text, no watermark, photorealistic";
18558
- var ANH = (x) => "Cinematic photorealistic vertical photo, " + x + ", Vietnamese people and setting, natural light, shallow depth of field, rich detail, no text, no watermark, no logo";
18577
+ var ANH = (x, i = 0) => "Cinematic photorealistic vertical photo, " + x + (i % 2 || /no faces/i.test(x) ? ", Vietnamese setting, close-up of objects, hands or place, no faces" : ", Vietnamese people and setting") + ", natural light, shallow depth of field, rich detail, no text, no watermark, no logo";
18559
18578
  var V3D = (x) => "A single glossy 3D render of " + x + ", bold shapes, warm orange and white palette, soft studio light" + NEN;
18560
18579
  var ICON = (x) => "A single glossy 3D icon of " + x + ", premium app-icon style, smooth plastic and metal materials, vivid but tasteful colors, soft studio lighting, subtle reflection, centered, isolated" + NEN;
18561
18580
  var ICON3D = [["xu", "a shiny gold coin with a dollar sign"], ["dongho", "a modern round alarm clock"], ["canh", "a yellow warning triangle with an exclamation mark"], ["tich", "a green rounded check mark badge"], ["sao", "a golden star"], ["tim", "a glossy red heart"], ["bieu", "a rising bar chart with an upward arrow"], ["lua", "a glowing orange fire flame"], ["tenlua", "a small white and red rocket launching upward"], ["bongden", "a glowing yellow light bulb"], ["qua", "a red gift box with a gold ribbon"], ["giohang", "a shopping cart"], ["nha", "a small modern house"], ["sach", "an open book"], ["dienthoai", "a modern smartphone"], ["cup", "a golden trophy cup"], ["khien", "a blue shield with a white check mark"], ["la", "a fresh green leaf"], ["giot", "a clear blue water drop"], ["kinhlup", "a magnifying glass"], ["sai", "a red cross X mark badge"]];
@@ -18656,9 +18675,10 @@ async function goi(de, ar, bao) {
18656
18675
  }
18657
18676
  async function mot(d, ten, de, ar, bao) {
18658
18677
  if (taiSan(ten)) return true;
18678
+ const kTen = (/no faces/i.test(de) ? "ten2:" : "ten:") + ten;
18659
18679
  let a = await doc22(d, de);
18660
18680
  if (!a) {
18661
- a = await doc22(d, "ten:" + ten);
18681
+ a = await doc22(d, kTen);
18662
18682
  if (a) ghi2(d, de, a);
18663
18683
  }
18664
18684
  if (!a && khoaAnhDen() > Date.now()) throw new Error("\u0110ang t\u1EA1m kho\xE1 t\u1EA1o \u1EA3nh t\u1EDBi " + new Date(khoaAnhDen()).toLocaleTimeString());
@@ -18675,7 +18695,7 @@ async function mot(d, ten, de, ar, bao) {
18675
18695
  if (!r || !r.base64) return false;
18676
18696
  a = { base64: r.base64, mimeType: r.mimeType || "image/png" };
18677
18697
  ghi2(d, de, a);
18678
- ghi2(d, "ten:" + ten, a);
18698
+ ghi2(d, kTen, a);
18679
18699
  }
18680
18700
  const s = atob(String(a.base64).split(",").pop() || ""), u = new Uint8Array(s.length);
18681
18701
  for (let i = 0; i < s.length; i++) u[i] = s.charCodeAt(i);
@@ -18702,7 +18722,7 @@ function dsTaiSan(kieu, kb) {
18702
18722
  return 20;
18703
18723
  }
18704
18724
  })();
18705
- (kb?.canh || []).filter((c) => c && c.tu && c.en && (c.kieu === "anh" || c.kieu === "vat")).slice(0, TRAN_ANH).forEach((c) => ds2.push([c.kieu + ":" + String(c.tu).toLocaleLowerCase("vi"), c.kieu === "anh" ? ANH(String(c.en).slice(0, 220)) : V3D(String(c.en).slice(0, 120)), c.kieu === "anh" ? "9:16" : "1:1"]));
18725
+ (kb?.canh || []).filter((c) => c && c.tu && c.en && (c.kieu === "anh" || c.kieu === "vat")).slice(0, TRAN_ANH).forEach((c, i) => ds2.push([c.kieu + ":" + String(c.tu).toLocaleLowerCase("vi"), c.kieu === "anh" ? ANH(String(c.en).slice(0, 220), i) : V3D(String(c.en).slice(0, 120)), c.kieu === "anh" ? "9:16" : "1:1"]));
18706
18726
  ICON3D.forEach(([k, v]) => ds2.push(["st3d:" + k, ICON(v), "1:1"]));
18707
18727
  return ds2;
18708
18728
  }
@@ -20736,7 +20756,7 @@ function datCauLenh(a) {
20736
20756
  on2 = true;
20737
20757
  window.addEventListener("message", async (ev) => {
20738
20758
  const d = ev.data;
20739
- if (!d || d.xvaiLoi111747 !== true) return;
20759
+ if (!d || d.xvaiLoi111825 !== true) return;
20740
20760
  const o = String(ev.origin || "");
20741
20761
  if (!(o.indexOf("https://flow.google.com") === 0 || o.indexOf("https://labs.google") === 0)) return;
20742
20762
  const tra = (kq) => {