lt-ppt 1.0.37 → 1.0.39

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.
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as k, resolveComponent as P, openBlock as d, createElementBlock as c, Fragment as x, renderList as A, withModifiers as p, normalizeClass as L, createElementVNode as C, toDisplayString as I, createCommentVNode as v, createBlock as O, computed as S, normalizeStyle as U, createVNode as D, render as w } from "vue";
2
- import { _ as b } from "./lib-CfgS7FHs.js";
2
+ import { _ as b } from "./lib-BiF29D6t.js";
3
3
  import { t as G } from "./tippy.esm-Dos-q4Dz.js";
4
4
  const R = { class: "menu-content" }, X = ["onClick"], V = { class: "text" }, W = {
5
5
  key: 0,
@@ -0,0 +1,9 @@
1
+ import { u as o, a as r } from "./database-BzBFTWuy.js";
2
+ import { u as t, a as S, b as u } from "./screen-Cfp5UER_.js";
3
+ export {
4
+ t as useKeyboardStore,
5
+ o as useMainStore,
6
+ S as useScreenStore,
7
+ r as useSlidesStore,
8
+ u as useSnapshotStore
9
+ };
@@ -2403,16 +2403,16 @@ const V = {
2403
2403
  }
2404
2404
  }
2405
2405
  }, W = Symbol("lt-ppt-i18n"), Pe = { "zh-CN": Ie, en: Te };
2406
- function Z(n, i = "") {
2406
+ function X(n, i = "") {
2407
2407
  return Object.entries(n).reduce((g, [c, m]) => {
2408
2408
  const C = i ? `${i}.${c}` : c;
2409
- return m && typeof m == "object" && !Array.isArray(m) ? Object.assign(g, Z(m, C)) : g[C] = String(m), g;
2409
+ return m && typeof m == "object" && !Array.isArray(m) ? Object.assign(g, X(m, C)) : g[C] = String(m), g;
2410
2410
  }, {});
2411
2411
  }
2412
2412
  const w = Object.fromEntries(
2413
- Object.entries(Pe).map(([n, i]) => [n, Z(i)])
2413
+ Object.entries(Pe).map(([n, i]) => [n, X(i)])
2414
2414
  );
2415
- function Be() {
2415
+ function Ee() {
2416
2416
  const n = he(W, { locale: P("zh-CN") });
2417
2417
  return { t: (g) => {
2418
2418
  var c, m;
@@ -2425,7 +2425,7 @@ function we(n) {
2425
2425
  return ((g = w[n.value]) == null ? void 0 : g[i]) ?? ((c = w["zh-CN"]) == null ? void 0 : c[i]) ?? i;
2426
2426
  };
2427
2427
  }
2428
- function Ee(n) {
2428
+ function De(n) {
2429
2429
  const i = P((n == null ? void 0 : n.locale) ?? "zh-CN");
2430
2430
  return {
2431
2431
  install() {
@@ -2456,8 +2456,8 @@ const _ = 4096 * 4096, ke = 8e3, ve = /* @__PURE__ */ me({
2456
2456
  emits: ["image-ai-entry-click"],
2457
2457
  setup(n, { expose: i, emit: g }) {
2458
2458
  const c = n, m = g, C = fe(), L = P();
2459
- let S = null, f = null, R = null, F = null, O = null, B = null, k = null;
2460
- const E = P(c.locale ?? "zh-CN"), D = P(c.theme ?? "dark"), $ = P(c.mode ?? "default"), X = G(() => ({
2459
+ let S = null, f = null, F = null, R = null, O = null, B = null, k = null;
2460
+ const E = P(c.locale ?? "zh-CN"), D = P(c.theme ?? "dark"), $ = P(c.mode ?? "default"), Z = G(() => ({
2461
2461
  width: c.width,
2462
2462
  height: c.height
2463
2463
  })), J = () => {
@@ -2468,107 +2468,107 @@ const _ = 4096 * 4096, ke = 8e3, ve = /* @__PURE__ */ me({
2468
2468
  t(null);
2469
2469
  return;
2470
2470
  }
2471
- let o = !1, r = null;
2472
- const s = (l) => {
2473
- o || (o = !0, r && clearTimeout(r), t(l));
2471
+ let o = !1, l = null;
2472
+ const s = (a) => {
2473
+ o || (o = !0, l && clearTimeout(l), t(a));
2474
2474
  };
2475
- r = setTimeout(() => s(null), ke);
2476
- const a = new Image();
2477
- /^https?:\/\//i.test(e) && (a.crossOrigin = "anonymous"), a.decoding = "sync", a.onload = async () => {
2478
- var l;
2475
+ l = setTimeout(() => s(null), ke);
2476
+ const r = new Image();
2477
+ /^https?:\/\//i.test(e) && (r.crossOrigin = "anonymous"), r.decoding = "sync", r.onload = async () => {
2478
+ var a;
2479
2479
  try {
2480
- await ((l = a.decode) == null ? void 0 : l.call(a));
2480
+ await ((a = r.decode) == null ? void 0 : a.call(r));
2481
2481
  } catch {
2482
2482
  }
2483
- s(a);
2484
- }, a.onerror = () => s(null), a.src = e;
2483
+ s(r);
2484
+ }, r.onerror = () => s(null), r.src = e;
2485
2485
  }), j = (e) => {
2486
2486
  const t = Math.max(1, e.width || 1), o = Math.max(1, e.height || 1);
2487
- let r = Math.min(typeof window > "u" ? 1 : window.devicePixelRatio || 1, 2);
2488
- return t * o * r * r > _ && (r = Math.sqrt(_ / (t * o))), {
2489
- width: Math.max(1, Math.round(t * r)),
2490
- height: Math.max(1, Math.round(o * r)),
2491
- scale: r
2487
+ let l = Math.min(typeof window > "u" ? 1 : window.devicePixelRatio || 1, 2);
2488
+ return t * o * l * l > _ && (l = Math.sqrt(_ / (t * o))), {
2489
+ width: Math.max(1, Math.round(t * l)),
2490
+ height: Math.max(1, Math.round(o * l)),
2491
+ scale: l
2492
2492
  };
2493
- }, Q = (e, t, o, r, s, a) => {
2494
- const l = Math.min(Math.max(a, 0), r / 2, s / 2);
2495
- if (!l) {
2496
- e.rect(t, o, r, s);
2493
+ }, Q = (e, t, o, l, s, r) => {
2494
+ const a = Math.min(Math.max(r, 0), l / 2, s / 2);
2495
+ if (!a) {
2496
+ e.rect(t, o, l, s);
2497
2497
  return;
2498
2498
  }
2499
- e.moveTo(t + l, o), e.lineTo(t + r - l, o), e.quadraticCurveTo(t + r, o, t + r, o + l), e.lineTo(t + r, o + s - l), e.quadraticCurveTo(t + r, o + s, t + r - l, o + s), e.lineTo(t + l, o + s), e.quadraticCurveTo(t, o + s, t, o + s - l), e.lineTo(t, o + l), e.quadraticCurveTo(t, o, t + l, o);
2500
- }, K = (e, t, o, r, s) => {
2499
+ e.moveTo(t + a, o), e.lineTo(t + l - a, o), e.quadraticCurveTo(t + l, o, t + l, o + a), e.lineTo(t + l, o + s - a), e.quadraticCurveTo(t + l, o + s, t + l - a, o + s), e.lineTo(t + a, o + s), e.quadraticCurveTo(t, o + s, t, o + s - a), e.lineTo(t, o + a), e.quadraticCurveTo(t, o, t + a, o);
2500
+ }, K = (e, t, o, l, s) => {
2501
2501
  var p;
2502
- const a = V[((p = t.clip) == null ? void 0 : p.shape) || "rect"] || V.rect;
2503
- if (a.type === U.ELLIPSE) {
2504
- e.beginPath(), e.ellipse(o / 2, r / 2, o / 2, r / 2, 0, 0, Math.PI * 2), e.clip();
2502
+ const r = V[((p = t.clip) == null ? void 0 : p.shape) || "rect"] || V.rect;
2503
+ if (r.type === U.ELLIPSE) {
2504
+ e.beginPath(), e.ellipse(o / 2, l / 2, o / 2, l / 2, 0, 0, Math.PI * 2), e.clip();
2505
2505
  return;
2506
2506
  }
2507
- if (a.type === U.POLYGON && a.createPath && typeof Path2D < "u") {
2508
- e.clip(new Path2D(a.createPath(o, r)));
2507
+ if (r.type === U.POLYGON && r.createPath && typeof Path2D < "u") {
2508
+ e.clip(new Path2D(r.createPath(o, l)));
2509
2509
  return;
2510
2510
  }
2511
- const l = a.radius !== void 0 ? (t.radius || Number.parseFloat(a.radius) || 0) * s : 0;
2512
- e.beginPath(), Q(e, 0, 0, o, r, l), e.clip();
2511
+ const a = r.radius !== void 0 ? (t.radius || Number.parseFloat(r.radius) || 0) * s : 0;
2512
+ e.beginPath(), Q(e, 0, 0, o, l, a), e.clip();
2513
2513
  }, ee = (e, t, o) => {
2514
2514
  if (!e.clip) return { left: 0, top: 0, width: t, height: o };
2515
- const [r, s] = e.clip.range, a = s[0] - r[0], l = s[1] - r[1];
2516
- return !Number.isFinite(a) || !Number.isFinite(l) || !a || !l ? { left: 0, top: 0, width: t, height: o } : {
2517
- left: -r[0] / a * t,
2518
- top: -r[1] / l * o,
2519
- width: 100 / a * t,
2520
- height: 100 / l * o
2515
+ const [l, s] = e.clip.range, r = s[0] - l[0], a = s[1] - l[1];
2516
+ return !Number.isFinite(r) || !Number.isFinite(a) || !r || !a ? { left: 0, top: 0, width: t, height: o } : {
2517
+ left: -l[0] / r * t,
2518
+ top: -l[1] / a * o,
2519
+ width: 100 / r * t,
2520
+ height: 100 / a * o
2521
2521
  };
2522
2522
  }, te = (e) => e.filters ? Object.keys(e.filters).map((t) => {
2523
- var r;
2524
- const o = (r = e.filters) == null ? void 0 : r[t];
2523
+ var l;
2524
+ const o = (l = e.filters) == null ? void 0 : l[t];
2525
2525
  return o ? `${t}(${o})` : "";
2526
2526
  }).filter(Boolean).join(" ") : "", oe = async (e) => {
2527
2527
  if (!e.src || typeof document > "u") return e.src;
2528
2528
  try {
2529
2529
  const t = await q(e.src);
2530
2530
  if (!t) return e.src;
2531
- const o = document.createElement("canvas"), { width: r, height: s, scale: a } = j(e);
2532
- o.width = r, o.height = s;
2533
- const l = o.getContext("2d");
2534
- if (!l) return e.src;
2535
- l.save(), (e.flipH || e.flipV) && (l.translate(e.flipH ? r : 0, e.flipV ? s : 0), l.scale(e.flipH ? -1 : 1, e.flipV ? -1 : 1)), K(l, e, r, s, a);
2531
+ const o = document.createElement("canvas"), { width: l, height: s, scale: r } = j(e);
2532
+ o.width = l, o.height = s;
2533
+ const a = o.getContext("2d");
2534
+ if (!a) return e.src;
2535
+ a.save(), (e.flipH || e.flipV) && (a.translate(e.flipH ? l : 0, e.flipV ? s : 0), a.scale(e.flipH ? -1 : 1, e.flipV ? -1 : 1)), K(a, e, l, s, r);
2536
2536
  const p = te(e);
2537
- p && (l.filter = p);
2538
- const h = ee(e, r, s);
2539
- return l.drawImage(t, h.left, h.top, h.width, h.height), e.colorMask && (l.filter = "none", l.fillStyle = e.colorMask, l.fillRect(0, 0, r, s)), l.restore(), o.toDataURL("image/png");
2537
+ p && (a.filter = p);
2538
+ const h = ee(e, l, s);
2539
+ return a.drawImage(t, h.left, h.top, h.width, h.height), e.colorMask && (a.filter = "none", a.fillStyle = e.colorMask, a.fillRect(0, 0, l, s)), a.restore(), o.toDataURL("image/png");
2540
2540
  } catch {
2541
2541
  return e.src;
2542
2542
  }
2543
2543
  }, ne = async (e) => {
2544
- var s, a;
2544
+ var s, r;
2545
2545
  const t = (s = e.detail) == null ? void 0 : s.element;
2546
2546
  if (!t || t.type !== "image") return;
2547
2547
  const o = JSON.parse(JSON.stringify(t));
2548
2548
  o.clipSrc = await oe(t);
2549
- const r = {
2549
+ const l = {
2550
2550
  element: o
2551
2551
  };
2552
- (a = c.onImageAIEntryClick) == null || a.call(c, r), m("image-ai-entry-click", r);
2552
+ (r = c.onImageAIEntryClick) == null || r.call(c, l), m("image-ai-entry-click", l);
2553
2553
  }, ie = async () => {
2554
2554
  if (!L.value || S) return;
2555
2555
  const [
2556
2556
  { createApp: e },
2557
2557
  { createPinia: t },
2558
2558
  { default: o },
2559
- { default: r },
2559
+ { default: l },
2560
2560
  s
2561
2561
  ] = await Promise.all([
2562
2562
  import("vue"),
2563
2563
  import("./pinia-CVat9nJz.js"),
2564
- import("./InnerApp-GKSyUPJQ.js"),
2565
- import("./index-DXKkkANm.js"),
2566
- import("./index-Ddislx9y.js")
2564
+ import("./InnerApp-BGfoF0IZ.js"),
2565
+ import("./index-DUXbEpof.js"),
2566
+ import("./index-fuE6bBLS.js")
2567
2567
  ]);
2568
2568
  if (!L.value) return;
2569
- R = s.useSlidesStore, F = s.useScreenStore, O = s.useMainStore, B = s.useSnapshotStore;
2570
- const a = document.createElement("div");
2571
- a.style.width = "100%", a.style.height = "100%", L.value.appendChild(a), S = e(o, {
2569
+ F = s.useSlidesStore, R = s.useScreenStore, O = s.useMainStore, B = s.useSnapshotStore;
2570
+ const r = document.createElement("div");
2571
+ r.style.width = "100%", r.style.height = "100%", L.value.appendChild(r), S = e(o, {
2572
2572
  initData: c.initData,
2573
2573
  onUploadFile: c.onUploadFile,
2574
2574
  readonly: c.readonly,
@@ -2577,7 +2577,7 @@ const _ = 4096 * 4096, ke = 8e3, ve = /* @__PURE__ */ me({
2577
2577
  onInitFinished: c.onInitFinished,
2578
2578
  onReturn: c.onReturn,
2579
2579
  theme: D.value
2580
- }), f = t(), S.use(f), S.provide(W, { locale: E }), S.provide("__lt_ppt_theme__", D), S.provide("__lt_ppt_mode__", $), S.provide("__lt_ppt_image_ai_entry_enabled__", Y), S.config.globalProperties.$t = we(E), S.use(r), S.mount(a);
2580
+ }), f = t(), S.use(f), S.provide(W, { locale: E }), S.provide("__lt_ppt_theme__", D), S.provide("__lt_ppt_mode__", $), S.provide("__lt_ppt_image_ai_entry_enabled__", Y), S.config.globalProperties.$t = we(E), S.use(l), S.mount(r);
2581
2581
  }, le = () => {
2582
2582
  S && (S.unmount(), S = null, f = null), L.value && (L.value.innerHTML = "");
2583
2583
  };
@@ -2594,16 +2594,16 @@ const _ = 4096 * 4096, ke = 8e3, ve = /* @__PURE__ */ me({
2594
2594
  });
2595
2595
  const ae = (e) => {
2596
2596
  $.value = e;
2597
- }, b = () => !f || !R ? null : R(f), I = () => !f || !O ? null : O(f), re = () => !f || !B ? null : B(f), v = async () => (!f && k && await k, !!f), N = (e) => new Promise((t) => {
2597
+ }, b = () => !f || !F ? null : F(f), I = () => !f || !O ? null : O(f), re = () => !f || !B ? null : B(f), v = async () => (!f && k && await k, !!f), N = (e) => new Promise((t) => {
2598
2598
  if (typeof Image > "u") {
2599
2599
  t(null);
2600
2600
  return;
2601
2601
  }
2602
2602
  const o = new Image();
2603
2603
  o.decoding = "sync", o.onload = async () => {
2604
- var r;
2604
+ var l;
2605
2605
  try {
2606
- await ((r = o.decode) == null ? void 0 : r.call(o));
2606
+ await ((l = o.decode) == null ? void 0 : l.call(o));
2607
2607
  } catch {
2608
2608
  }
2609
2609
  t({
@@ -2611,17 +2611,17 @@ const _ = 4096 * 4096, ke = 8e3, ve = /* @__PURE__ */ me({
2611
2611
  height: o.naturalHeight || o.height
2612
2612
  });
2613
2613
  }, o.onerror = () => t(null), o.src = e;
2614
- }), T = (e, t) => Number.isFinite(e) && e > 0 ? e : t, z = (e, t, o, r, s) => {
2615
- let a = T(e.width, (t == null ? void 0 : t.width) || s.width), l = T(e.height, (t == null ? void 0 : t.height) || s.height);
2614
+ }), T = (e, t) => Number.isFinite(e) && e > 0 ? e : t, z = (e, t, o, l, s) => {
2615
+ let r = T(e.width, (t == null ? void 0 : t.width) || s.width), a = T(e.height, (t == null ? void 0 : t.height) || s.height);
2616
2616
  if (e.width !== void 0 && e.height === void 0 && (t != null && t.width) && t.height)
2617
- l = a * t.height / t.width;
2617
+ a = r * t.height / t.width;
2618
2618
  else if (e.height !== void 0 && e.width === void 0 && (t != null && t.width) && t.height)
2619
- a = l * t.width / t.height;
2619
+ r = a * t.width / t.height;
2620
2620
  else if (e.width === void 0 && e.height === void 0 && (t != null && t.width) && t.height) {
2621
- const p = Math.min(1, o / t.width, r / t.height);
2622
- a = t.width * p, l = t.height * p;
2621
+ const p = Math.min(1, o / t.width, l / t.height);
2622
+ r = t.width * p, a = t.height * p;
2623
2623
  }
2624
- return { width: a, height: l };
2624
+ return { width: r, height: a };
2625
2625
  }, H = (e) => new Promise((t) => {
2626
2626
  if (typeof document > "u") {
2627
2627
  t(null);
@@ -2629,14 +2629,14 @@ const _ = 4096 * 4096, ke = 8e3, ve = /* @__PURE__ */ me({
2629
2629
  }
2630
2630
  const o = document.createElement("video");
2631
2631
  o.preload = "metadata", o.muted = !0, o.onloadedmetadata = () => {
2632
- const r = o.videoWidth, s = o.videoHeight;
2633
- o.onloadedmetadata = null, o.onerror = null, o.removeAttribute("src"), o.load(), t(r && s ? { width: r, height: s } : null);
2632
+ const l = o.videoWidth, s = o.videoHeight;
2633
+ o.onloadedmetadata = null, o.onerror = null, o.removeAttribute("src"), o.load(), t(l && s ? { width: l, height: s } : null);
2634
2634
  }, o.onerror = () => {
2635
2635
  o.onloadedmetadata = null, o.onerror = null, o.removeAttribute("src"), o.load(), t(null);
2636
2636
  }, o.src = e;
2637
- }), x = (e, t) => t.slideId ? e.slides.findIndex((o) => o.id === t.slideId) : t.slideIndex !== void 0 ? Number.isInteger(t.slideIndex) && t.slideIndex >= 0 && t.slideIndex < e.slides.length ? t.slideIndex : -1 : e.slideIndex, se = async (e, t, o, r, s = { width: 300, height: 200 }) => {
2638
- const a = await N(e);
2639
- return z(t, a, o, r, s);
2637
+ }), x = (e, t) => t.slideId ? e.slides.findIndex((o) => o.id === t.slideId) : t.slideIndex !== void 0 ? Number.isInteger(t.slideIndex) && t.slideIndex >= 0 && t.slideIndex < e.slides.length ? t.slideIndex : -1 : e.slideIndex, se = async (e, t, o, l, s = { width: 300, height: 200 }) => {
2638
+ const r = await N(e);
2639
+ return z(t, r, o, l, s);
2640
2640
  }, A = async () => {
2641
2641
  const e = re();
2642
2642
  e && await e.addSnapshot();
@@ -2644,34 +2644,34 @@ const _ = 4096 * 4096, ke = 8e3, ve = /* @__PURE__ */ me({
2644
2644
  if (!e.src || !await v()) return null;
2645
2645
  const t = b(), o = I();
2646
2646
  if (!t || !o || !t.slides.length) return null;
2647
- const r = x(t, e);
2648
- if (r === -1) return null;
2649
- t.slideIndex !== r && t.updateSlideIndex(r);
2650
- const s = t.viewportSize, a = t.viewportSize * t.viewportRatio, { width: l, height: p } = await se(e.src, e, s, a), { nanoid: h } = await import("./index.browser-Wq18ov6h.js"), d = {
2647
+ const l = x(t, e);
2648
+ if (l === -1) return null;
2649
+ t.slideIndex !== l && t.updateSlideIndex(l);
2650
+ const s = t.viewportSize, r = t.viewportSize * t.viewportRatio, { width: a, height: p } = await se(e.src, e, s, r), { nanoid: h } = await import("./index.browser-Wq18ov6h.js"), d = {
2651
2651
  type: "image",
2652
2652
  id: h(10),
2653
2653
  src: e.src,
2654
- width: l,
2654
+ width: a,
2655
2655
  height: p,
2656
- left: e.left ?? (s - l) / 2,
2657
- top: e.top ?? (a - p) / 2,
2656
+ left: e.left ?? (s - a) / 2,
2657
+ top: e.top ?? (r - p) / 2,
2658
2658
  fixedRatio: e.fixedRatio ?? !0,
2659
2659
  rotate: e.rotate ?? 0
2660
2660
  };
2661
2661
  return t.addElement(d), e.select !== !1 && o.setActiveElementIdList([d.id]), await A(), JSON.parse(JSON.stringify(d));
2662
2662
  }, ce = (e, t, o) => {
2663
2663
  var p, h;
2664
- const r = !!o.slideId || o.slideIndex !== void 0, s = x(e, o), a = o.elementId || (t.activeElementIdList.length === 1 ? t.activeElementIdList[0] : t.handleElementId);
2665
- if (!a) return null;
2666
- if (r || !o.elementId) {
2664
+ const l = !!o.slideId || o.slideIndex !== void 0, s = x(e, o), r = o.elementId || (t.activeElementIdList.length === 1 ? t.activeElementIdList[0] : t.handleElementId);
2665
+ if (!r) return null;
2666
+ if (l || !o.elementId) {
2667
2667
  if (s === -1) return null;
2668
- const d = (p = e.slides[s]) == null ? void 0 : p.elements.find((u) => u.id === a);
2668
+ const d = (p = e.slides[s]) == null ? void 0 : p.elements.find((u) => u.id === r);
2669
2669
  return (d == null ? void 0 : d.type) === "image" ? { slideIndex: s, element: d } : null;
2670
2670
  }
2671
- const l = (h = e.slides[e.slideIndex]) == null ? void 0 : h.elements.find((d) => d.id === a);
2672
- if ((l == null ? void 0 : l.type) === "image") return { slideIndex: e.slideIndex, element: l };
2671
+ const a = (h = e.slides[e.slideIndex]) == null ? void 0 : h.elements.find((d) => d.id === r);
2672
+ if ((a == null ? void 0 : a.type) === "image") return { slideIndex: e.slideIndex, element: a };
2673
2673
  for (let d = 0; d < e.slides.length; d++) {
2674
- const u = e.slides[d].elements.find((y) => y.id === a);
2674
+ const u = e.slides[d].elements.find((y) => y.id === r);
2675
2675
  if ((u == null ? void 0 : u.type) === "image") return { slideIndex: d, element: u };
2676
2676
  }
2677
2677
  return null;
@@ -2679,48 +2679,48 @@ const _ = 4096 * 4096, ke = 8e3, ve = /* @__PURE__ */ me({
2679
2679
  if (!e.src || !await v()) return null;
2680
2680
  const t = b(), o = I();
2681
2681
  if (!t || !o || !t.slides.length) return null;
2682
- const r = ce(t, o, e);
2683
- if (!r) return null;
2684
- const { slideIndex: s, element: a } = r, l = { src: e.src };
2685
- if (e.fixedRatio !== void 0 && (l.fixedRatio = e.fixedRatio), e.resetClip && (l.clip = void 0), !(e.keepSize === !0 && e.width === void 0 && e.height === void 0)) {
2686
- const d = await N(e.src), u = T(e.width, a.width);
2687
- let y = T(e.height, a.height);
2688
- e.height === void 0 && (d != null && d.width) && d.height && (y = u * d.height / d.width), l.width = u, l.height = y, l.left = a.left, l.top = a.top, l.clip = void 0;
2682
+ const l = ce(t, o, e);
2683
+ if (!l) return null;
2684
+ const { slideIndex: s, element: r } = l, a = { src: e.src };
2685
+ if (e.fixedRatio !== void 0 && (a.fixedRatio = e.fixedRatio), e.resetClip && (a.clip = void 0), !(e.keepSize === !0 && e.width === void 0 && e.height === void 0)) {
2686
+ const d = await N(e.src), u = T(e.width, r.width);
2687
+ let y = T(e.height, r.height);
2688
+ e.height === void 0 && (d != null && d.width) && d.height && (y = u * d.height / d.width), a.width = u, a.height = y, a.left = r.left, a.top = r.top, a.clip = void 0;
2689
2689
  }
2690
2690
  const h = t.slides[s].id;
2691
- return t.updateElement({ id: a.id, props: l, slideId: h }), t.slideIndex !== s && t.updateSlideIndex(s), e.select !== !1 && o.setActiveElementIdList([a.id]), await A(), JSON.parse(JSON.stringify({ ...a, ...l }));
2691
+ return t.updateElement({ id: r.id, props: a, slideId: h }), t.slideIndex !== s && t.updateSlideIndex(s), e.select !== !1 && o.setActiveElementIdList([r.id]), await A(), JSON.parse(JSON.stringify({ ...r, ...a }));
2692
2692
  }, pe = async (e) => {
2693
2693
  if (!e.src || !await v()) return null;
2694
2694
  const t = b(), o = I();
2695
2695
  if (!t || !o || !t.slides.length) return null;
2696
- const r = x(t, e);
2697
- if (r === -1) return null;
2698
- t.slideIndex !== r && t.updateSlideIndex(r);
2699
- const s = t.viewportSize, a = t.viewportSize * t.viewportRatio, l = await H(e.src), { width: p, height: h } = z(e, l, s, a, { width: 500, height: 300 }), { nanoid: d } = await import("./index.browser-Wq18ov6h.js"), u = {
2696
+ const l = x(t, e);
2697
+ if (l === -1) return null;
2698
+ t.slideIndex !== l && t.updateSlideIndex(l);
2699
+ const s = t.viewportSize, r = t.viewportSize * t.viewportRatio, a = await H(e.src), { width: p, height: h } = z(e, a, s, r, { width: 500, height: 300 }), { nanoid: d } = await import("./index.browser-Wq18ov6h.js"), u = {
2700
2700
  type: "video",
2701
2701
  id: d(10),
2702
2702
  src: e.src,
2703
2703
  width: p,
2704
2704
  height: h,
2705
2705
  left: e.left ?? (s - p) / 2,
2706
- top: e.top ?? (a - h) / 2,
2706
+ top: e.top ?? (r - h) / 2,
2707
2707
  rotate: e.rotate ?? 0,
2708
2708
  autoplay: e.autoplay ?? !1
2709
2709
  };
2710
2710
  return e.poster !== void 0 && (u.poster = e.poster), e.ext && (u.ext = e.ext), t.addElement(u), e.select !== !1 && o.setActiveElementIdList([u.id]), await A(), JSON.parse(JSON.stringify(u));
2711
2711
  }, ge = (e, t, o) => {
2712
2712
  var p, h;
2713
- const r = !!o.slideId || o.slideIndex !== void 0, s = x(e, o), a = o.elementId || (t.activeElementIdList.length === 1 ? t.activeElementIdList[0] : t.handleElementId);
2714
- if (!a) return null;
2715
- if (r || !o.elementId) {
2713
+ const l = !!o.slideId || o.slideIndex !== void 0, s = x(e, o), r = o.elementId || (t.activeElementIdList.length === 1 ? t.activeElementIdList[0] : t.handleElementId);
2714
+ if (!r) return null;
2715
+ if (l || !o.elementId) {
2716
2716
  if (s === -1) return null;
2717
- const d = (p = e.slides[s]) == null ? void 0 : p.elements.find((u) => u.id === a);
2717
+ const d = (p = e.slides[s]) == null ? void 0 : p.elements.find((u) => u.id === r);
2718
2718
  return (d == null ? void 0 : d.type) === "video" ? { slideIndex: s, element: d } : null;
2719
2719
  }
2720
- const l = (h = e.slides[e.slideIndex]) == null ? void 0 : h.elements.find((d) => d.id === a);
2721
- if ((l == null ? void 0 : l.type) === "video") return { slideIndex: e.slideIndex, element: l };
2720
+ const a = (h = e.slides[e.slideIndex]) == null ? void 0 : h.elements.find((d) => d.id === r);
2721
+ if ((a == null ? void 0 : a.type) === "video") return { slideIndex: e.slideIndex, element: a };
2722
2722
  for (let d = 0; d < e.slides.length; d++) {
2723
- const u = e.slides[d].elements.find((y) => y.id === a);
2723
+ const u = e.slides[d].elements.find((y) => y.id === r);
2724
2724
  if ((u == null ? void 0 : u.type) === "video") return { slideIndex: d, element: u };
2725
2725
  }
2726
2726
  return null;
@@ -2739,8 +2739,8 @@ const _ = 4096 * 4096, ke = 8e3, ve = /* @__PURE__ */ me({
2739
2739
  t && t.setSlides(e);
2740
2740
  },
2741
2741
  startScreening: () => {
2742
- if (!f || !F) return;
2743
- F(f).setScreening(!0);
2742
+ if (!f || !R) return;
2743
+ R(f).setScreening(!0);
2744
2744
  },
2745
2745
  getCurrentIndex: () => {
2746
2746
  const e = b();
@@ -2757,6 +2757,15 @@ const _ = 4096 * 4096, ke = 8e3, ve = /* @__PURE__ */ me({
2757
2757
  }
2758
2758
  e();
2759
2759
  },
2760
+ generateDeafultPPT: async () => {
2761
+ if (!await v() || !f)
2762
+ throw new Error("lt-ppt editor is not ready");
2763
+ const e = b();
2764
+ if (!e) throw new Error("lt-ppt slides store is not ready");
2765
+ const { default: t } = await import("./useExport-DY5Zq-Fg.js").then((s) => s.H), { exportPPTX: o } = t(e), l = await o(e.slides, !0, !1, !0);
2766
+ if (!l) throw new Error("Failed to generate PPTX file");
2767
+ return l;
2768
+ },
2760
2769
  setMode: ae,
2761
2770
  insertImage: de,
2762
2771
  replaceImage: ue,
@@ -2765,22 +2774,22 @@ const _ = 4096 * 4096, ke = 8e3, ve = /* @__PURE__ */ me({
2765
2774
  if (!e.src || !await v()) return null;
2766
2775
  const t = b(), o = I();
2767
2776
  if (!t || !o || !t.slides.length) return null;
2768
- const r = ge(t, o, e);
2769
- if (!r) return null;
2770
- const { slideIndex: s, element: a } = r, l = { src: e.src };
2771
- if (e.autoplay !== void 0 && (l.autoplay = e.autoplay), e.poster !== void 0 && (l.poster = e.poster || void 0), e.ext !== void 0 && (l.ext = e.ext || void 0), !(e.keepSize === !0 && e.width === void 0 && e.height === void 0)) {
2772
- const d = await H(e.src), u = T(e.width, a.width);
2773
- let y = T(e.height, a.height);
2774
- e.height === void 0 && (d != null && d.width) && d.height && (y = u * d.height / d.width), l.width = u, l.height = y, l.left = a.left, l.top = a.top;
2777
+ const l = ge(t, o, e);
2778
+ if (!l) return null;
2779
+ const { slideIndex: s, element: r } = l, a = { src: e.src };
2780
+ if (e.autoplay !== void 0 && (a.autoplay = e.autoplay), e.poster !== void 0 && (a.poster = e.poster || void 0), e.ext !== void 0 && (a.ext = e.ext || void 0), !(e.keepSize === !0 && e.width === void 0 && e.height === void 0)) {
2781
+ const d = await H(e.src), u = T(e.width, r.width);
2782
+ let y = T(e.height, r.height);
2783
+ e.height === void 0 && (d != null && d.width) && d.height && (y = u * d.height / d.width), a.width = u, a.height = y, a.left = r.left, a.top = r.top;
2775
2784
  }
2776
2785
  const h = t.slides[s].id;
2777
- return t.updateElement({ id: a.id, props: l, slideId: h }), t.slideIndex !== s && t.updateSlideIndex(s), e.select !== !1 && o.setActiveElementIdList([a.id]), await A(), JSON.parse(JSON.stringify({ ...a, ...l }));
2786
+ return t.updateElement({ id: r.id, props: a, slideId: h }), t.slideIndex !== s && t.updateSlideIndex(s), e.select !== !1 && o.setActiveElementIdList([r.id]), await A(), JSON.parse(JSON.stringify({ ...r, ...a }));
2778
2787
  }
2779
2788
  }), (e, t) => (ye(), be("div", {
2780
2789
  ref_key: "containerRef",
2781
2790
  ref: L,
2782
2791
  class: "lt-ppt-container",
2783
- style: Le(X.value),
2792
+ style: Le(Z.value),
2784
2793
  onImageAiEntryClick: ne
2785
2794
  }, null, 36));
2786
2795
  }
@@ -2789,7 +2798,7 @@ const _ = 4096 * 4096, ke = 8e3, ve = /* @__PURE__ */ me({
2789
2798
  for (const [c, m] of i)
2790
2799
  g[c] = m;
2791
2800
  return g;
2792
- }, De = /* @__PURE__ */ xe(ve, [["__scopeId", "data-v-ac370e87"]]), Ae = [
2801
+ }, $e = /* @__PURE__ */ xe(ve, [["__scopeId", "data-v-53ba6658"]]), Ae = [
2793
2802
  "SourceHanSans",
2794
2803
  "SourceHanSerif",
2795
2804
  "WenDingPLSongTi",
@@ -2818,7 +2827,7 @@ const _ = 4096 * 4096, ke = 8e3, ve = /* @__PURE__ */ me({
2818
2827
  "Montserrat",
2819
2828
  "SourceSansPro",
2820
2829
  "Merriweather"
2821
- ], $e = (n = "/fonts") => {
2830
+ ], Me = (n = "/fonts") => {
2822
2831
  if (typeof document > "u" || !document.head) return;
2823
2832
  const i = n.replace(/\/$/, ""), g = document.createElement("style");
2824
2833
  g.textContent = Ae.map(
@@ -2828,10 +2837,10 @@ const _ = 4096 * 4096, ke = 8e3, ve = /* @__PURE__ */ me({
2828
2837
  };
2829
2838
  export {
2830
2839
  U as C,
2831
- De as L,
2840
+ $e as L,
2832
2841
  xe as _,
2833
2842
  V as a,
2834
- Ee as c,
2835
- $e as l,
2836
- Be as u
2843
+ De as c,
2844
+ Me as l,
2845
+ Ee as u
2837
2846
  };