@bireturn/word-editor 1.0.7 → 1.0.9

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,9 +1,9 @@
1
1
  var yn = Object.defineProperty;
2
2
  var bn = (t, e, n) => e in t ? yn(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
- var z = (t, e, n) => bn(t, typeof e != "symbol" ? e + "" : e, n);
4
- import { computed as re, ref as ne, onMounted as vt, onUnmounted as at, openBlock as u, createElementBlock as p, normalizeStyle as N, createElementVNode as Z, Fragment as U, renderList as X, normalizeClass as Fe, createBlock as Me, resolveDynamicComponent as lt, toDisplayString as G, unref as j, createCommentVNode as pe, render as Vt, h as xn, defineComponent as _n, getCurrentInstance as kn, watch as je, nextTick as ke, createVNode as K, createTextVNode as Oe, isVNode as wn, renderSlot as Cn, resolveComponent as Mn, inject as jt, withCtx as qe, provide as Kt, createSlots as In, reactive as qt } from "vue";
3
+ var N = (t, e, n) => bn(t, typeof e != "symbol" ? e + "" : e, n);
4
+ import { computed as de, ref as te, onMounted as _t, onUnmounted as rt, openBlock as u, createElementBlock as g, normalizeStyle as V, createElementVNode as ne, Fragment as G, renderList as Q, normalizeClass as Pe, createBlock as Fe, resolveDynamicComponent as at, toDisplayString as Y, unref as K, createCommentVNode as ve, render as qt, h as _n, defineComponent as xn, getCurrentInstance as kn, watch as Ke, nextTick as Se, createVNode as q, createTextVNode as Le, isVNode as wn, renderSlot as Cn, resolveComponent as Mn, inject as mt, withCtx as qe, provide as yt, createSlots as In, reactive as Wt } from "vue";
5
5
  import { DynamicScroller as En, DynamicScrollerItem as Sn } from "vue-virtual-scroller";
6
- import { ChevronRight as Ut, MoreHorizontal as kt, Download as dt, Upload as Tn, Save as Fn, RotateCcw as An, History as Pn, Settings as $n, Info as Ln, Globe as Rn, Lock as Hn, Share as On, ShieldCheck as Bn, Search as Dn, Filter as zn, SortDesc as Nn, SortAsc as Vn, Minus as jn, Plus as wt, Eye as Ct, FileText as ut, Grid as Kn, Type as Mt, FileDown as It, Layers as Et, Edit as qn, Move as Un, Copy as Wn, Trash2 as St, Clipboard as Tt, PlusCircle as Ft, ArrowDown as At, Navigation as Pt, ChevronDown as Gn, PanelLeftOpen as Jn, ListTree as Xn, PanelLeftClose as Yn } from "lucide-vue-next";
6
+ import { ChevronRight as Gt, MoreHorizontal as It, Download as ht, Upload as Fn, Save as Tn, RotateCcw as An, History as Pn, Settings as $n, Info as Ln, Globe as Rn, Lock as Hn, Share as On, ShieldCheck as Bn, Search as Dn, Filter as zn, SortDesc as Nn, SortAsc as Vn, Minus as jn, Plus as Et, Eye as St, FileText as ft, Grid as Kn, Type as Ft, FileDown as Tt, Layers as At, Edit as Un, Move as qn, Copy as Wn, Trash2 as Pt, Clipboard as $t, PlusCircle as Lt, ArrowDown as Rt, Navigation as Ht, ChevronDown as Gn, PanelLeftOpen as Jn, ListTree as Xn, PanelLeftClose as Yn } from "lucide-vue-next";
7
7
  const Zn = { class: "we-vt-context-menu--option-wrapper modern-menu-wrapper" }, Qn = ["onMouseenter", "onMouseleave"], ei = ["onClick"], ti = { class: "we-vt-context-menu--link-content menu-label" }, ni = {
8
8
  key: 0,
9
9
  class: "we-vt-context-menu--submenu modern-submenu"
@@ -30,79 +30,79 @@ const Zn = { class: "we-vt-context-menu--option-wrapper modern-menu-wrapper" },
30
30
  },
31
31
  emits: ["close", "menuClick"],
32
32
  setup(t, { emit: e }) {
33
- const n = e, l = t, o = re(() => {
34
- var B, A;
33
+ const n = e, l = t, o = de(() => {
34
+ var D, T;
35
35
  return {
36
- left: `${(B = l.e) == null ? void 0 : B.pageX}px`,
37
- top: `${(A = l.e) == null ? void 0 : A.pageY}px`
36
+ left: `${(D = l.e) == null ? void 0 : D.pageX}px`,
37
+ top: `${(T = l.e) == null ? void 0 : T.pageY}px`
38
38
  };
39
- }), r = ne([]), y = ne(null);
40
- let s = null;
41
- const m = ne(), h = (B, A, f) => {
42
- if (B.children && B.children.length > 0) {
43
- A && A.preventDefault() && A.stopPropagation();
39
+ }), s = te([]), v = te(null);
40
+ let m = null;
41
+ const y = te(), r = (D, T, h) => {
42
+ if (D.children && D.children.length > 0) {
43
+ T && T.preventDefault() && T.stopPropagation();
44
44
  return;
45
45
  }
46
- B.disabled || (f ? n("menuClick", { ...B, parent: f.code }, l.row) : n("menuClick", B, l.row)), A && A.preventDefault() && A.stopPropagation();
47
- }, S = (B) => {
48
- let A = B.target;
49
- for (; A && A != m.value; )
50
- A = A.parentNode;
51
- A != m.value && n("close");
52
- }, F = (B, A) => {
53
- B.currentTarget.classList.add("link--active"), s && (clearTimeout(s), s = null), A.children && A.children.length > 0 ? y.value = A.code : s = setTimeout(() => {
54
- y.value = null;
46
+ D.disabled || (h ? n("menuClick", { ...D, parent: h.code }, l.row) : n("menuClick", D, l.row)), T && T.preventDefault() && T.stopPropagation();
47
+ }, M = (D) => {
48
+ let T = D.target;
49
+ for (; T && T != y.value; )
50
+ T = T.parentNode;
51
+ T != y.value && n("close");
52
+ }, x = (D, T) => {
53
+ D.currentTarget.classList.add("link--active"), m && (clearTimeout(m), m = null), T.children && T.children.length > 0 ? v.value = T.code : m = setTimeout(() => {
54
+ v.value = null;
55
55
  }, 100);
56
- }, O = (B, A) => {
57
- B.currentTarget.classList.remove("link--active"), A.children && A.children.length > 0 && (s = setTimeout(() => {
58
- y.value === A.code && (y.value = null);
56
+ }, $ = (D, T) => {
57
+ D.currentTarget.classList.remove("link--active"), T.children && T.children.length > 0 && (m = setTimeout(() => {
58
+ v.value === T.code && (v.value = null);
59
59
  }, 300));
60
- }, _ = (B) => {
61
- s && (clearTimeout(s), s = null), B.currentTarget.classList.add("link--active");
62
- }, q = (B) => {
63
- B.currentTarget.classList.remove("link--active");
64
- }, ie = (B) => {
65
- const A = B.code || "", f = (B.name || "").toLowerCase(), M = {
60
+ }, B = (D) => {
61
+ m && (clearTimeout(m), m = null), D.currentTarget.classList.add("link--active");
62
+ }, W = (D) => {
63
+ D.currentTarget.classList.remove("link--active");
64
+ }, I = (D) => {
65
+ const T = D.code || "", h = (D.name || "").toLowerCase(), F = {
66
66
  // 添加操作 - 根据具体类型使用不同图标
67
- "add-current": Pt,
67
+ "add-current": Ht,
68
68
  // 添加(当前位置)
69
- "add-next": At,
69
+ "add-next": Rt,
70
70
  // 添加(下一行)
71
- "add-child": Ft,
71
+ "add-child": Lt,
72
72
  // 添加(子节点)
73
73
  // 基本操作
74
- paste: Tt,
74
+ paste: $t,
75
75
  // 粘贴
76
- delete: St,
76
+ delete: Pt,
77
77
  // 删除
78
78
  copy: Wn,
79
79
  // 复制
80
- cut: Un,
80
+ cut: qn,
81
81
  // 剪切
82
- edit: qn,
82
+ edit: Un,
83
83
  // 编辑
84
84
  // 导出操作 - 根据范围使用不同图标
85
- export_part_section: Et,
85
+ export_part_section: At,
86
86
  // 导出此节点所在节
87
- export_part_chapter: It,
87
+ export_part_chapter: Tt,
88
88
  // 导出此节点所在章
89
- export_full: dt,
89
+ export_full: ht,
90
90
  // 完整导出
91
91
  // 文件格式
92
- pdf: ut,
92
+ pdf: ft,
93
93
  // PDF格式
94
- word: Mt,
94
+ word: Ft,
95
95
  // WORD格式
96
96
  excel: Kn,
97
97
  // Excel格式
98
- txt: ut,
98
+ txt: ft,
99
99
  // 文本格式
100
100
  // 视图操作
101
- view: Ct,
101
+ view: St,
102
102
  // 查看
103
- preview: Ct,
103
+ preview: St,
104
104
  // 预览
105
- expand: wt,
105
+ expand: Et,
106
106
  // 展开
107
107
  collapse: jn,
108
108
  // 折叠
@@ -133,140 +133,140 @@ const Zn = { class: "we-vt-context-menu--option-wrapper modern-menu-wrapper" },
133
133
  // 历史
134
134
  refresh: An,
135
135
  // 刷新
136
- save: Fn,
136
+ save: Tn,
137
137
  // 保存
138
- upload: Tn,
138
+ upload: Fn,
139
139
  // 上传
140
- download: dt,
140
+ download: ht,
141
141
  // 下载
142
- more: kt
142
+ more: It
143
143
  // 更多
144
144
  };
145
- return M[A] ? M[A] : f.includes("添加") || f.includes("add") ? f.includes("当前") || f.includes("current") ? Pt : f.includes("下") || f.includes("next") ? At : f.includes("子") || f.includes("child") ? Ft : wt : f.includes("导出") || f.includes("export") ? f.includes("节") || f.includes("section") ? Et : f.includes("章") || f.includes("chapter") ? It : dt : f.includes("粘贴") || f.includes("paste") ? Tt : f.includes("删除") || f.includes("delete") ? St : f.includes("pdf") ? ut : f.includes("word") ? Mt : kt;
145
+ return F[T] ? F[T] : h.includes("添加") || h.includes("add") ? h.includes("当前") || h.includes("current") ? Ht : h.includes("下") || h.includes("next") ? Rt : h.includes("子") || h.includes("child") ? Lt : Et : h.includes("导出") || h.includes("export") ? h.includes("节") || h.includes("section") ? At : h.includes("章") || h.includes("chapter") ? Tt : ht : h.includes("粘贴") || h.includes("paste") ? $t : h.includes("删除") || h.includes("delete") ? Pt : h.includes("pdf") ? ft : h.includes("word") ? Ft : It;
146
146
  };
147
- return vt(() => {
148
- var B, A, f, M, $, E, L;
149
- (B = l.menuConfig) != null && B.visibleMethod && typeof ((A = l.menuConfig) == null ? void 0 : A.visibleMethod) == "function" && (($ = l.menuConfig) == null || $.visibleMethod({
150
- options: (M = (f = l.menuConfig) == null ? void 0 : f.body) == null ? void 0 : M.options,
147
+ return _t(() => {
148
+ var D, T, h, F, P, E, X;
149
+ (D = l.menuConfig) != null && D.visibleMethod && typeof ((T = l.menuConfig) == null ? void 0 : T.visibleMethod) == "function" && ((P = l.menuConfig) == null || P.visibleMethod({
150
+ options: (F = (h = l.menuConfig) == null ? void 0 : h.body) == null ? void 0 : F.options,
151
151
  row: l.row
152
- })), r.value = (((L = (E = l.menuConfig) == null ? void 0 : E.body) == null ? void 0 : L.options) || []).flat(), document.addEventListener("click", S, !0);
153
- }), at(() => {
154
- document.removeEventListener("click", S, !0);
155
- }), (B, A) => (u(), p("div", {
152
+ })), s.value = (((X = (E = l.menuConfig) == null ? void 0 : E.body) == null ? void 0 : X.options) || []).flat(), document.addEventListener("click", M, !0);
153
+ }), rt(() => {
154
+ document.removeEventListener("click", M, !0);
155
+ }), (D, T) => (u(), g("div", {
156
156
  class: "we-vt-table--context-menu-wrapper virtual-table-menu modern-virtual-menu",
157
157
  ref_key: "contextMenuRef",
158
- ref: m,
159
- style: N([{ display: "inline-block" }, o.value])
158
+ ref: y,
159
+ style: V([{ display: "inline-block" }, o.value])
160
160
  }, [
161
- Z("ul", Zn, [
162
- (u(!0), p(U, null, X(r.value, (f) => (u(), p("li", {
163
- class: Fe({
164
- "link--disabled": f.disabled,
165
- "has-children": f.children && f.children.length > 0,
161
+ ne("ul", Zn, [
162
+ (u(!0), g(G, null, Q(s.value, (h) => (u(), g("li", {
163
+ class: Pe({
164
+ "link--disabled": h.disabled,
165
+ "has-children": h.children && h.children.length > 0,
166
166
  "modern-menu-item": !0
167
167
  }),
168
- key: f.code,
169
- onMouseenter: (M) => F(M, f),
170
- onMouseleave: (M) => O(M, f)
168
+ key: h.code,
169
+ onMouseenter: (F) => x(F, h),
170
+ onMouseleave: (F) => $(F, h)
171
171
  }, [
172
- Z("a", {
172
+ ne("a", {
173
173
  class: "we-vt-context-menu--link modern-menu-link",
174
- onClick: (M) => h(f, M)
174
+ onClick: (F) => r(h, F)
175
175
  }, [
176
- (u(), Me(lt(ie(f)), {
176
+ (u(), Fe(at(I(h)), {
177
177
  size: 16,
178
178
  class: "menu-icon"
179
179
  })),
180
- Z("span", ti, G(f.name), 1),
181
- f.children && f.children.length > 0 ? (u(), Me(j(Ut), {
180
+ ne("span", ti, Y(h.name), 1),
181
+ h.children && h.children.length > 0 ? (u(), Fe(K(Gt), {
182
182
  key: 0,
183
183
  size: 14,
184
184
  class: "submenu-arrow"
185
- })) : pe("", !0)
185
+ })) : ve("", !0)
186
186
  ], 8, ei),
187
- f.children && f.children.length > 0 && y.value === f.code ? (u(), p("ul", ni, [
188
- (u(!0), p(U, null, X(f.children, (M) => (u(), p("li", {
189
- key: M.code,
190
- class: Fe({
191
- "link--disabled": M.disabled,
187
+ h.children && h.children.length > 0 && v.value === h.code ? (u(), g("ul", ni, [
188
+ (u(!0), g(G, null, Q(h.children, (F) => (u(), g("li", {
189
+ key: F.code,
190
+ class: Pe({
191
+ "link--disabled": F.disabled,
192
192
  "modern-submenu-item": !0
193
193
  }),
194
- onMouseenter: _,
195
- onMouseleave: q
194
+ onMouseenter: B,
195
+ onMouseleave: W
196
196
  }, [
197
- Z("a", {
197
+ ne("a", {
198
198
  class: "we-vt-context-menu--link modern-submenu-link",
199
- onClick: ($) => h(M, $, f)
199
+ onClick: (P) => r(F, P, h)
200
200
  }, [
201
- (u(), Me(lt(ie(M)), {
201
+ (u(), Fe(at(I(F)), {
202
202
  size: 14,
203
203
  class: "submenu-icon"
204
204
  })),
205
- Z("span", li, G(M.name), 1)
205
+ ne("span", li, Y(F.name), 1)
206
206
  ], 8, ii)
207
207
  ], 34))), 128))
208
- ])) : pe("", !0)
208
+ ])) : ve("", !0)
209
209
  ], 42, Qn))), 128))
210
210
  ])
211
211
  ], 4));
212
212
  }
213
- }, Wt = Symbol("component_container");
213
+ }, Jt = Symbol("component_container");
214
214
  function ai(t, e, n) {
215
- const l = xn(t, { ...e }, n), o = document.createElement("div");
216
- return document.body.appendChild(o), l[Wt] = o, Vt(l, o), l.component;
215
+ const l = _n(t, { ...e }, n), o = document.createElement("div");
216
+ return document.body.appendChild(o), l[Jt] = o, qt(l, o), l.component;
217
217
  }
218
218
  function si(t) {
219
219
  var n;
220
- const e = t.vnode[Wt];
221
- Vt(null, e), e != null && e.checkVisibility && (e != null && e.checkVisibility()) && ((n = document.body) == null || n.removeChild(e));
220
+ const e = t.vnode[Jt];
221
+ qt(null, e), e != null && e.checkVisibility && (e != null && e.checkVisibility()) && ((n = document.body) == null || n.removeChild(e));
222
222
  }
223
- let Gt;
223
+ let Xt;
224
224
  const ri = (t) => {
225
- Gt = ai(oi, t, null);
225
+ Xt = ai(oi, t, null);
226
226
  }, ci = function(t) {
227
227
  const e = t.onClose;
228
228
  return t.onClose = () => {
229
- e && e.call(), si(Gt);
229
+ e && e.call(), si(Xt);
230
230
  }, ri(t), t;
231
231
  };
232
232
  function di(t, e, n) {
233
- const l = (n == null ? void 0 : n.keyField) || (n == null ? void 0 : n.rowField) || "node_id", o = (n == null ? void 0 : n.parentField) || "parent_id", r = (n == null ? void 0 : n.parentField) || "order";
233
+ const l = (n == null ? void 0 : n.keyField) || (n == null ? void 0 : n.rowField) || "node_id", o = (n == null ? void 0 : n.parentField) || "parent_id", s = (n == null ? void 0 : n.parentField) || "order";
234
234
  if (!(t != null && t.length))
235
235
  return t;
236
- const y = {};
237
- t.forEach((S) => {
238
- const F = S[o];
239
- y[F] || (y[F] = []), y[F].push(S);
236
+ const v = {};
237
+ t.forEach((M) => {
238
+ const x = M[o];
239
+ v[x] || (v[x] = []), v[x].push(M);
240
240
  });
241
- function s(S) {
242
- const F = y[S] || [];
243
- F.sort(
244
- (_, q) => _[r] && q[r] ? _[r] - q[r] : 0
241
+ function m(M) {
242
+ const x = v[M] || [];
243
+ x.sort(
244
+ (B, W) => B[s] && W[s] ? B[s] - W[s] : 0
245
245
  );
246
- const O = [];
247
- return F.forEach((_) => {
248
- O.push(_), O.push(...s(_[l]));
249
- }), O;
246
+ const $ = [];
247
+ return x.forEach((B) => {
248
+ $.push(B), $.push(...m(B[l]));
249
+ }), $;
250
250
  }
251
- let m = [];
251
+ let y = [];
252
252
  if (Array.isArray(e))
253
- m = e;
253
+ y = e;
254
254
  else {
255
- const S = new Set(t.map((_) => _[l])), F = t.filter((_) => !S.has(_[o]));
256
- if (F.length === 0)
255
+ const M = new Set(t.map((B) => B[l])), x = t.filter((B) => !M.has(B[o]));
256
+ if (x.length === 0)
257
257
  throw new Error("无法确定根节点:可能存在循环引用或数据不完整");
258
- const O = {};
259
- F.forEach((_) => {
260
- const q = _[o];
261
- O[q] = (O[q] || 0) + 1;
262
- }), m = Object.entries(O).map(([_]) => _);
263
- }
264
- let h = [];
265
- return m.forEach((S) => {
266
- h = h.concat(s(S));
267
- }), h;
258
+ const $ = {};
259
+ x.forEach((B) => {
260
+ const W = B[o];
261
+ $[W] = ($[W] || 0) + 1;
262
+ }), y = Object.entries($).map(([B]) => B);
263
+ }
264
+ let r = [];
265
+ return y.forEach((M) => {
266
+ r = r.concat(m(M));
267
+ }), r;
268
268
  }
269
- function $t(t, e, n) {
269
+ function Ot(t, e, n) {
270
270
  let l;
271
271
  for (; t && t.nodeType && t !== document; ) {
272
272
  if (t.className && t.className.split && t.className.split(" ").indexOf(e) > -1)
@@ -280,7 +280,7 @@ function $t(t, e, n) {
280
280
  function ui(t) {
281
281
  return typeof t == "function" || Object.prototype.toString.call(t) === "[object Object]" && !wn(t);
282
282
  }
283
- const hi = /* @__PURE__ */ _n({
283
+ const hi = /* @__PURE__ */ xn({
284
284
  name: "VirtualTable",
285
285
  props: {
286
286
  data: {
@@ -360,26 +360,26 @@ const hi = /* @__PURE__ */ _n({
360
360
  slots: n,
361
361
  expose: l
362
362
  }) {
363
- var _t;
364
- const o = kn(), r = ne(), y = ne(!1), s = ne(null), m = ne(null), h = ne([]);
365
- let S = /* @__PURE__ */ new Map();
366
- const F = /* @__PURE__ */ new Map();
367
- ne(0);
368
- const O = ne([]);
369
- ne([]);
370
- const _ = ne(/* @__PURE__ */ new Set()), q = ne(/* @__PURE__ */ new Set()), ie = ne(null), B = 2, A = /* @__PURE__ */ new WeakMap(), f = ne(null), M = ne(""), $ = /* @__PURE__ */ new Set(), E = re(() => {
363
+ var Mt;
364
+ const o = kn(), s = te(), v = te(!1), m = te(null), y = te(null), r = te([]);
365
+ let M = /* @__PURE__ */ new Map();
366
+ const x = /* @__PURE__ */ new Map();
367
+ te(0);
368
+ const $ = te([]);
369
+ te([]);
370
+ const B = te(/* @__PURE__ */ new Set()), W = te(/* @__PURE__ */ new Set()), I = te(null), D = 2, T = /* @__PURE__ */ new WeakMap(), h = te(null), F = te(""), P = /* @__PURE__ */ new Set(), E = de(() => {
371
371
  try {
372
- return Array.isArray(h.value) ? h.value : [];
372
+ return Array.isArray(r.value) ? r.value : [];
373
373
  } catch {
374
374
  return [];
375
375
  }
376
- }), L = (i) => {
377
- var v, d, g;
376
+ }), X = (i) => {
377
+ var p, d, f;
378
378
  if (!i) return 30;
379
379
  if (i.height) return i.height;
380
- const a = `${i.content_type}_${((v = i.content) == null ? void 0 : v.length) || 0}_${((d = i.title) == null ? void 0 : d.length) || 0}_${i._editing ? 1 : 0}`;
381
- if (A.has(i)) {
382
- const k = A.get(i);
380
+ const a = `${i.content_type}_${((p = i.content) == null ? void 0 : p.length) || 0}_${((d = i.title) == null ? void 0 : d.length) || 0}_${i._editing ? 1 : 0}`;
381
+ if (T.has(i)) {
382
+ const k = T.get(i);
383
383
  if (k.key === a)
384
384
  return k.height;
385
385
  }
@@ -399,64 +399,64 @@ const hi = /* @__PURE__ */ _n({
399
399
  c = 200;
400
400
  break;
401
401
  default: {
402
- const b = (i.content || "").length, x = (i.title || "").length, C = b + x, P = ((g = (i.content || "").match(/[\u4e00-\u9fa5]/g)) == null ? void 0 : g.length) || 0, H = C - P, T = P * 12 + H * 6, I = Math.max(1, Math.ceil(T / 760));
403
- c = Math.max(20, I * 18), i._editing && (c += 20);
402
+ const b = (i.content || "").length, _ = (i.title || "").length, C = b + _, A = ((f = (i.content || "").match(/[\u4e00-\u9fa5]/g)) == null ? void 0 : f.length) || 0, R = C - A, S = A * 12 + R * 6, L = Math.max(1, Math.ceil(S / 760));
403
+ c = Math.max(20, L * 18), i._editing && (c += 20);
404
404
  break;
405
405
  }
406
406
  }
407
- return A.set(i, {
407
+ return T.set(i, {
408
408
  key: a,
409
409
  height: c
410
410
  }), c;
411
- }, Y = re(() => {
411
+ }, ue = de(() => {
412
412
  if (E.value.length === 0) return 30;
413
413
  const i = E.value.slice(0, Math.min(100, E.value.length));
414
414
  if (i.length === 0) return 30;
415
- const a = i.reduce((v, d) => v + L(d), 0) / i.length, c = Math.max(20, Math.floor(a * 0.6));
415
+ const a = i.reduce((p, d) => p + X(d), 0) / i.length, c = Math.max(20, Math.floor(a * 0.6));
416
416
  return Math.min(c, 60);
417
417
  });
418
- let le;
419
- const st = (i, a) => {
418
+ let z;
419
+ const ie = (i, a) => {
420
420
  e("menu-click", {
421
421
  menu: i,
422
422
  row: a
423
- }), le == null || le.onClose(), le = null;
424
- }, V = (i) => {
425
- var c, v, d, g, k;
426
- if (!((d = (v = (c = t.menuConfig) == null ? void 0 : c.body) == null ? void 0 : v.options) != null && d.length)) return;
427
- le == null || le.onClose(), le = null;
423
+ }), z == null || z.onClose(), z = null;
424
+ }, Ce = (i) => {
425
+ var c, p, d, f, k;
426
+ if (!((d = (p = (c = t.menuConfig) == null ? void 0 : c.body) == null ? void 0 : p.options) != null && d.length)) return;
427
+ z == null || z.onClose(), z = null;
428
428
  let a = i.target;
429
- for (; a && (a != null && a.getAttribute) && !(a != null && a.getAttribute("data-id")) && a !== ((g = r.value) == null ? void 0 : g.$el); )
429
+ for (; a && (a != null && a.getAttribute) && !(a != null && a.getAttribute("data-id")) && a !== ((f = s.value) == null ? void 0 : f.$el); )
430
430
  a = a.parentNode;
431
431
  if ((k = a == null ? void 0 : a.getAttribute) != null && k.call(a, "data-id")) {
432
- const w = a.getAttribute("data-id"), b = Se(w);
433
- b && (le = ci({
432
+ const w = a.getAttribute("data-id"), b = Ae(w);
433
+ b && (z = ci({
434
434
  e: i,
435
435
  row: b,
436
436
  menuConfig: t.menuConfig,
437
- onMenuClick: st
437
+ onMenuClick: ie
438
438
  }), i.preventDefault(), i.stopPropagation());
439
439
  }
440
- }, he = (i) => {
441
- var c, v, d;
442
- if (!s.value)
440
+ }, Je = (i) => {
441
+ var c, p, d;
442
+ if (!m.value)
443
443
  return;
444
444
  let a = i.target;
445
- for (; a && (a != null && a.getAttribute) && !(a != null && a.getAttribute("data-id")) && a !== ((c = r.value) == null ? void 0 : c.$el); )
446
- if (a = a.parentNode, a != null && a.classList && ["el-popper", "ck-body-wrapper"].some((g) => a.classList.contains(g)))
445
+ for (; a && (a != null && a.getAttribute) && !(a != null && a.getAttribute("data-id")) && a !== ((c = s.value) == null ? void 0 : c.$el); )
446
+ if (a = a.parentNode, a != null && a.classList && ["el-popper", "ck-body-wrapper"].some((f) => a.classList.contains(f)))
447
447
  return;
448
- ((v = a == null ? void 0 : a.getAttribute) == null ? void 0 : v.call(a, "data-id")) != ((d = s.value) == null ? void 0 : d.node_id) && (s.value._editing = !1, e("edit-closed", {
449
- row: s.value,
448
+ ((p = a == null ? void 0 : a.getAttribute) == null ? void 0 : p.call(a, "data-id")) != ((d = m.value) == null ? void 0 : d.node_id) && (m.value._editing = !1, e("edit-closed", {
449
+ row: m.value,
450
450
  column: {},
451
451
  $table: o == null ? void 0 : o.exposed
452
- }), s.value = null);
452
+ }), m.value = null);
453
453
  };
454
- ((_t = t.editConfig) == null ? void 0 : _t.trigger) === "dblclick" && je(() => s.value, (i) => {
455
- document.removeEventListener("click", he, !0), i && setTimeout(() => {
456
- document.addEventListener("click", he, !0);
454
+ ((Mt = t.editConfig) == null ? void 0 : Mt.trigger) === "dblclick" && Ke(() => m.value, (i) => {
455
+ document.removeEventListener("click", Je, !0), i && setTimeout(() => {
456
+ document.addEventListener("click", Je, !0);
457
457
  }, 200);
458
458
  });
459
- const me = (i) => JSON.stringify(i.map((a) => {
459
+ const H = (i) => JSON.stringify(i.map((a) => {
460
460
  var c;
461
461
  return {
462
462
  id: a[t.rowConfig.keyField],
@@ -464,102 +464,102 @@ const hi = /* @__PURE__ */ _n({
464
464
  type: a.content_type,
465
465
  editing: a._editing
466
466
  };
467
- })), we = () => {
467
+ })), he = () => {
468
468
  if (!t.pageConfig.enabled) {
469
- O.value = [{
470
- items: h.value,
469
+ $.value = [{
470
+ items: r.value,
471
471
  startIndex: 0,
472
- endIndex: h.value.length
472
+ endIndex: r.value.length
473
473
  }];
474
474
  return;
475
475
  }
476
476
  if (t.pageData && Object.keys(t.pageData).length) {
477
477
  const i = [], a = t.rowConfig.keyField || "node_id", c = /* @__PURE__ */ new Map();
478
- h.value.forEach((d) => {
478
+ r.value.forEach((d) => {
479
479
  c.set(String(d[a]), d);
480
- }), Object.keys(t.pageData).sort((d, g) => parseInt(d) - parseInt(g)).forEach((d) => {
481
- const g = t.pageData[d], k = [];
482
- g.forEach((w) => {
480
+ }), Object.keys(t.pageData).sort((d, f) => parseInt(d) - parseInt(f)).forEach((d) => {
481
+ const f = t.pageData[d], k = [];
482
+ f.forEach((w) => {
483
483
  const b = c.get(String(w));
484
484
  b && k.push(b);
485
485
  }), k.length > 0 && i.push({
486
486
  items: k,
487
487
  pageNumber: parseInt(d),
488
- height: k.reduce((w, b) => w + L(b), 0)
488
+ height: k.reduce((w, b) => w + X(b), 0)
489
489
  });
490
- }), O.value = i;
490
+ }), $.value = i;
491
491
  } else {
492
492
  const {
493
493
  pageHeight: i,
494
494
  margin: a,
495
495
  headerHeight: c = 0
496
- } = t.pageConfig, d = Math.max(100, i - a * 2 - c - 20), g = [];
497
- let k = [], w = 0, b = 0, x = 1;
498
- h.value.forEach((C, P) => {
499
- const H = L(C);
500
- (C.layer || 0) <= 2 && k.length > 0 ? (g.push({
496
+ } = t.pageConfig, d = Math.max(100, i - a * 2 - c - 20), f = [];
497
+ let k = [], w = 0, b = 0, _ = 1;
498
+ r.value.forEach((C, A) => {
499
+ const R = X(C);
500
+ (C.layer || 0) <= 2 && k.length > 0 ? (f.push({
501
501
  items: [...k],
502
502
  startIndex: b,
503
- endIndex: P,
503
+ endIndex: A,
504
504
  height: w,
505
- pageNumber: x++
506
- }), k = [C], w = H, b = P) : w + H > d && k.length > 0 ? (g.push({
505
+ pageNumber: _++
506
+ }), k = [C], w = R, b = A) : w + R > d && k.length > 0 ? (f.push({
507
507
  items: [...k],
508
508
  startIndex: b,
509
- endIndex: P,
509
+ endIndex: A,
510
510
  height: w,
511
- pageNumber: x++
512
- }), k = [C], w = Math.min(H, d), b = P) : (k.push(C), w += H);
513
- }), k.length > 0 && g.push({
511
+ pageNumber: _++
512
+ }), k = [C], w = Math.min(R, d), b = A) : (k.push(C), w += R);
513
+ }), k.length > 0 && f.push({
514
514
  items: k,
515
515
  startIndex: b,
516
- endIndex: h.value.length,
516
+ endIndex: r.value.length,
517
517
  height: w,
518
- pageNumber: x
519
- }), O.value = g;
518
+ pageNumber: _
519
+ }), $.value = f;
520
520
  }
521
- }, ze = () => {
521
+ }, me = () => {
522
522
  try {
523
- const i = Array.isArray(t.data) ? t.data : [], a = me(i);
524
- if (!(a !== M.value) && h.value.length > 0)
523
+ const i = Array.isArray(t.data) ? t.data : [], a = H(i);
524
+ if (!(a !== F.value) && r.value.length > 0)
525
525
  return;
526
- M.value = a;
527
- const v = (t.treeConfig ? di(i, void 0, t.treeConfig) : i).map((g, k) => {
528
- const w = g[t.rowConfig.keyField], b = F.get(w);
529
- if (!b || b.content !== g.content || b.content_type !== g.content_type) {
530
- $.add(w);
531
- const x = {
532
- ...g,
526
+ F.value = a;
527
+ const p = (t.treeConfig ? di(i, void 0, t.treeConfig) : i).map((f, k) => {
528
+ const w = f[t.rowConfig.keyField], b = x.get(w);
529
+ if (!b || b.content !== f.content || b.content_type !== f.content_type) {
530
+ P.add(w);
531
+ const _ = {
532
+ ...f,
533
533
  index: k,
534
- _editing: g._editing || !1,
534
+ _editing: f._editing || !1,
535
535
  _original: (b == null ? void 0 : b._original) || {
536
- ...g
536
+ ...f
537
537
  }
538
538
  // 保留原始数据,避免重复深拷贝
539
539
  };
540
- return F.set(w, x), x;
540
+ return x.set(w, _), _;
541
541
  }
542
542
  return b.index = k, b;
543
543
  });
544
- h.value = v, we();
545
- const d = new Set(v.map((g) => g[t.rowConfig.keyField]));
546
- for (const [g] of F)
547
- d.has(g) || (F.delete(g), $.delete(g));
544
+ r.value = p, he();
545
+ const d = new Set(p.map((f) => f[t.rowConfig.keyField]));
546
+ for (const [f] of x)
547
+ d.has(f) || (x.delete(f), P.delete(f));
548
548
  } catch {
549
- h.value = [], O.value = [], F.clear(), $.clear();
549
+ r.value = [], $.value = [], x.clear(), P.clear();
550
550
  }
551
551
  };
552
- je(() => t.data, (i, a) => {
552
+ Ke(() => t.data, (i, a) => {
553
553
  try {
554
554
  if (!Array.isArray(i))
555
555
  return;
556
- ke(() => {
557
- if (ze(), t.pageConfig.enabled) {
558
- q.value.clear(), _.value.clear();
559
- for (let c = 0; c < Math.min(3, O.value.length); c++)
560
- q.value.add(c);
561
- ke(() => {
562
- de();
556
+ Se(() => {
557
+ if (me(), t.pageConfig.enabled) {
558
+ W.value.clear(), B.value.clear();
559
+ for (let c = 0; c < Math.min(3, $.value.length); c++)
560
+ W.value.add(c);
561
+ Se(() => {
562
+ fe();
563
563
  });
564
564
  }
565
565
  });
@@ -568,104 +568,104 @@ const hi = /* @__PURE__ */ _n({
568
568
  }, {
569
569
  deep: !1,
570
570
  immediate: !1
571
- }), je(() => t.pageData, () => {
571
+ }), Ke(() => t.pageData, () => {
572
572
  if (t.pageConfig.enabled) {
573
- we(), q.value.clear(), _.value.clear();
574
- for (let i = 0; i < Math.min(3, O.value.length); i++)
575
- q.value.add(i);
576
- ke(() => {
577
- de();
573
+ he(), W.value.clear(), B.value.clear();
574
+ for (let i = 0; i < Math.min(3, $.value.length); i++)
575
+ W.value.add(i);
576
+ Se(() => {
577
+ fe();
578
578
  });
579
579
  }
580
580
  }, {
581
581
  deep: !0
582
- }), je(() => t.pageConfig, () => {
582
+ }), Ke(() => t.pageConfig, () => {
583
583
  if (t.pageConfig.enabled) {
584
- we(), q.value.clear(), _.value.clear();
585
- for (let i = 0; i < Math.min(3, O.value.length); i++)
586
- q.value.add(i);
587
- ke(() => {
588
- de();
584
+ he(), W.value.clear(), B.value.clear();
585
+ for (let i = 0; i < Math.min(3, $.value.length); i++)
586
+ W.value.add(i);
587
+ Se(() => {
588
+ fe();
589
589
  });
590
590
  }
591
591
  }, {
592
592
  deep: !0
593
- }), je(m, () => e("current-change", {
594
- row: m.value
593
+ }), Ke(y, () => e("current-change", {
594
+ row: y.value
595
595
  }));
596
- let Ae = null;
597
- const ye = () => {
598
- window.ResizeObserver && (Ae = new ResizeObserver((i) => {
596
+ let Me = null;
597
+ const Xe = () => {
598
+ window.ResizeObserver && (Me = new ResizeObserver((i) => {
599
599
  var a, c;
600
- for (const v of i) {
601
- const d = (a = v.target.dataset) == null ? void 0 : a.id;
600
+ for (const p of i) {
601
+ const d = (a = p.target.dataset) == null ? void 0 : a.id;
602
602
  if (!d) continue;
603
- const g = Se(d);
604
- if (!g) continue;
605
- const k = v.contentRect.height, w = ((c = A.get(g)) == null ? void 0 : c.height) || 0;
603
+ const f = Ae(d);
604
+ if (!f) continue;
605
+ const k = p.contentRect.height, w = ((c = T.get(f)) == null ? void 0 : c.height) || 0;
606
606
  if (Math.abs(w - k) > 5) {
607
- const b = A.get(g) || {};
608
- A.set(g, {
607
+ const b = T.get(f) || {};
608
+ T.set(f, {
609
609
  ...b,
610
610
  height: k
611
611
  }), requestAnimationFrame(() => {
612
612
  var C;
613
- const x = v.target.__vueParentComponent;
614
- (C = x == null ? void 0 : x.proxy) != null && C.updateSize && x.proxy.updateSize();
613
+ const _ = p.target.__vueParentComponent;
614
+ (C = _ == null ? void 0 : _.proxy) != null && C.updateSize && _.proxy.updateSize();
615
615
  });
616
616
  }
617
617
  }
618
- }), ke(() => {
618
+ }), Se(() => {
619
619
  var c;
620
- const i = (c = r.value) == null ? void 0 : c.$el;
620
+ const i = (c = s.value) == null ? void 0 : c.$el;
621
621
  if (!i) return;
622
- i.querySelectorAll("[data-id]").forEach((v) => {
623
- v.dataset.id && Ae.observe(v);
622
+ i.querySelectorAll("[data-id]").forEach((p) => {
623
+ p.dataset.id && Me.observe(p);
624
624
  });
625
625
  }));
626
- }, ce = () => {
627
- f.value && (f.value.disconnect(), f.value = null), Ae && (Ae.disconnect(), Ae = null);
628
- }, de = () => {
629
- t.pageConfig.enabled && (ie.value && ie.value.disconnect(), ie.value = new IntersectionObserver((i) => {
626
+ }, Ye = () => {
627
+ h.value && (h.value.disconnect(), h.value = null), Me && (Me.disconnect(), Me = null);
628
+ }, fe = () => {
629
+ t.pageConfig.enabled && (I.value && I.value.disconnect(), I.value = new IntersectionObserver((i) => {
630
630
  i.forEach((a) => {
631
631
  const c = parseInt(a.target.dataset.pageIndex);
632
632
  if (a.isIntersecting) {
633
- _.value.add(c);
634
- for (let v = Math.max(0, c - B); v <= Math.min(O.value.length - 1, c + B); v++)
635
- q.value.add(v);
633
+ B.value.add(c);
634
+ for (let p = Math.max(0, c - D); p <= Math.min($.value.length - 1, c + D); p++)
635
+ W.value.add(p);
636
636
  } else
637
- _.value.delete(c), setTimeout(() => {
638
- _.value.has(c) || Array.from(_.value).some((d) => Math.abs(d - c) <= B * 2) || q.value.delete(c);
637
+ B.value.delete(c), setTimeout(() => {
638
+ B.value.has(c) || Array.from(B.value).some((d) => Math.abs(d - c) <= D * 2) || W.value.delete(c);
639
639
  }, 3e3);
640
640
  });
641
641
  }, {
642
642
  root: null,
643
643
  rootMargin: "100px",
644
644
  threshold: 0.01
645
- }), ke(() => {
645
+ }), Se(() => {
646
646
  const i = document.querySelector(".a4-pages-container");
647
647
  i && i.querySelectorAll(".a4-page-placeholder").forEach((c) => {
648
- ie.value.observe(c);
648
+ I.value.observe(c);
649
649
  });
650
650
  }));
651
651
  };
652
- vt(() => {
653
- ze(), ke(() => {
652
+ _t(() => {
653
+ me(), Se(() => {
654
654
  var i;
655
- if (ye(), xe.setup(), de(), ((i = t.editConfig) == null ? void 0 : i.trigger) === "contenteditable" && (document.addEventListener("selectionchange", Pe), document.addEventListener("mouseup", Ge)), t.pageConfig.enabled)
656
- for (let a = 0; a < Math.min(3, O.value.length); a++)
657
- q.value.add(a);
658
- }), y.value = !0;
659
- }), at(() => {
655
+ if (Xe(), se.setup(), fe(), ((i = t.editConfig) == null ? void 0 : i.trigger) === "contenteditable" && (document.addEventListener("selectionchange", re), document.addEventListener("mouseup", Te)), t.pageConfig.enabled)
656
+ for (let a = 0; a < Math.min(3, $.value.length); a++)
657
+ W.value.add(a);
658
+ }), v.value = !0;
659
+ }), rt(() => {
660
660
  var i;
661
- ce(), xe.cleanup(), ie.value && (ie.value.disconnect(), ie.value = null), ((i = t.editConfig) == null ? void 0 : i.trigger) === "contenteditable" && (document.removeEventListener("selectionchange", Pe), document.removeEventListener("mouseup", Ge)), Q && clearTimeout(Q), S = /* @__PURE__ */ new Map(), F.clear(), q.value.clear(), _.value.clear();
661
+ Ye(), se.cleanup(), I.value && (I.value.disconnect(), I.value = null), ((i = t.editConfig) == null ? void 0 : i.trigger) === "contenteditable" && (document.removeEventListener("selectionchange", re), document.removeEventListener("mouseup", Te)), Ee && clearTimeout(Ee), M = /* @__PURE__ */ new Map(), x.clear(), W.value.clear(), B.value.clear();
662
662
  });
663
- const xe = {
663
+ const se = {
664
664
  handlers: /* @__PURE__ */ new Map(),
665
665
  setup() {
666
- ke(() => {
666
+ Se(() => {
667
667
  var a;
668
- const i = (a = r.value) == null ? void 0 : a.$el;
668
+ const i = (a = s.value) == null ? void 0 : a.$el;
669
669
  i && (i.addEventListener("click", this.handleClick.bind(this), {
670
670
  passive: !0
671
671
  }), i.addEventListener("dblclick", this.handleDblClick.bind(this), {
@@ -676,49 +676,49 @@ const hi = /* @__PURE__ */ _n({
676
676
  handleClick(i) {
677
677
  const a = i.target.closest("[data-id]");
678
678
  if (!a) return;
679
- const c = a.dataset.id, v = Se(c);
680
- v && Xe(v);
679
+ const c = a.dataset.id, p = Ae(c);
680
+ p && Qe(p);
681
681
  },
682
682
  handleDblClick(i) {
683
683
  var d;
684
684
  if (!((d = t.editConfig) != null && d.trigger) === "dblclick") return;
685
685
  const a = i.target.closest("[data-id]");
686
686
  if (!a) return;
687
- const c = a.dataset.id, v = Se(c);
688
- v && Ne(v);
687
+ const c = a.dataset.id, p = Ae(c);
688
+ p && Ve(p);
689
689
  },
690
690
  cleanup() {
691
691
  var a, c;
692
- const i = (c = (a = r.value) == null ? void 0 : a.$el) == null ? void 0 : c.querySelector(".virtual-table-wrapper");
692
+ const i = (c = (a = s.value) == null ? void 0 : a.$el) == null ? void 0 : c.querySelector(".virtual-table-wrapper");
693
693
  i && (i.removeEventListener("click", this.handleClick), i.removeEventListener("dblclick", this.handleDblClick));
694
694
  }
695
- }, Ce = (i) => {
696
- Xe(i);
697
- }, fe = (i) => Ne(i);
698
- let oe = null, ue;
695
+ }, ke = (i) => {
696
+ Qe(i);
697
+ }, Ie = (i) => Ve(i);
698
+ let we = null, le;
699
699
  const ge = ({
700
700
  row: i,
701
701
  column: a
702
- }, c, v) => {
702
+ }, c, p) => {
703
703
  var k, w;
704
- const d = v || c.target, g = $t(d, "virtual-table-cell", (k = r.value) == null ? void 0 : k.$el);
705
- oe === g && ue && (clearTimeout(ue), oe = null), ((w = s.value) == null ? void 0 : w[t.rowConfig.keyField]) != (i == null ? void 0 : i[t.rowConfig.keyField]) && setTimeout(() => {
706
- var x, C;
707
- s.value = i;
708
- let b = (x = d == null ? void 0 : d.getAttribute) == null ? void 0 : x.call(d, "field");
704
+ const d = p || c.target, f = Ot(d, "virtual-table-cell", (k = s.value) == null ? void 0 : k.$el);
705
+ we === f && le && (clearTimeout(le), we = null), ((w = m.value) == null ? void 0 : w[t.rowConfig.keyField]) != (i == null ? void 0 : i[t.rowConfig.keyField]) && setTimeout(() => {
706
+ var _, C;
707
+ m.value = i;
708
+ let b = (_ = d == null ? void 0 : d.getAttribute) == null ? void 0 : _.call(d, "field");
709
709
  if (!b) {
710
710
  try {
711
- const P = document.getSelection();
712
- let H = P == null ? void 0 : P.anchorNode;
713
- H && H.nodeType === 3 && (H = H.parentElement);
714
- const T = (C = H == null ? void 0 : H.closest) == null ? void 0 : C.call(H, "[field]");
715
- T && (b = T.getAttribute("field"));
711
+ const A = document.getSelection();
712
+ let R = A == null ? void 0 : A.anchorNode;
713
+ R && R.nodeType === 3 && (R = R.parentElement);
714
+ const S = (C = R == null ? void 0 : R.closest) == null ? void 0 : C.call(R, "[field]");
715
+ S && (b = S.getAttribute("field"));
716
716
  } catch {
717
717
  }
718
718
  if (!b && (c != null && c.composedPath)) {
719
- for (const P of c.composedPath())
720
- if (P != null && P.getAttribute && P.getAttribute("field")) {
721
- b = P.getAttribute("field");
719
+ for (const A of c.composedPath())
720
+ if (A != null && A.getAttribute && A.getAttribute("field")) {
721
+ b = A.getAttribute("field");
722
722
  break;
723
723
  }
724
724
  }
@@ -732,40 +732,40 @@ const hi = /* @__PURE__ */ _n({
732
732
  $table: o == null ? void 0 : o.exposed
733
733
  });
734
734
  }, 200);
735
- }, Ie = ({
735
+ }, ye = ({
736
736
  row: i,
737
737
  column: a
738
- }, c, v) => {
739
- var g;
740
- const d = v || c.target;
741
- oe = $t(d, "virtual-table-cell", (g = r.value) == null ? void 0 : g.$el), ue && clearTimeout(ue), ue = setTimeout(() => {
742
- var b, x, C, P, H;
738
+ }, c, p) => {
739
+ var f;
740
+ const d = p || c.target;
741
+ we = Ot(d, "virtual-table-cell", (f = s.value) == null ? void 0 : f.$el), le && clearTimeout(le), le = setTimeout(() => {
742
+ var b, _, C, A, R;
743
743
  const k = i.content_type;
744
744
  let w = (b = d == null ? void 0 : d.getAttribute) == null ? void 0 : b.call(d, "field");
745
745
  if (!w) {
746
746
  try {
747
- const T = document.getSelection();
748
- let I = T == null ? void 0 : T.anchorNode;
749
- I && I.nodeType === 3 && (I = I.parentElement);
750
- const W = (x = I == null ? void 0 : I.closest) == null ? void 0 : x.call(I, "[field]");
751
- W && (w = W.getAttribute("field"));
747
+ const S = document.getSelection();
748
+ let L = S == null ? void 0 : S.anchorNode;
749
+ L && L.nodeType === 3 && (L = L.parentElement);
750
+ const Z = (_ = L == null ? void 0 : L.closest) == null ? void 0 : _.call(L, "[field]");
751
+ Z && (w = Z.getAttribute("field"));
752
752
  } catch {
753
753
  }
754
754
  if (!w && (c != null && c.composedPath)) {
755
- for (const T of c.composedPath())
756
- if (T != null && T.getAttribute && T.getAttribute("field")) {
757
- w = T.getAttribute("field");
755
+ for (const S of c.composedPath())
756
+ if (S != null && S.getAttribute && S.getAttribute("field")) {
757
+ w = S.getAttribute("field");
758
758
  break;
759
759
  }
760
760
  }
761
761
  }
762
762
  if (k !== "table") {
763
763
  if (k === "text") {
764
- let T = null, I = null;
765
- if ((C = d == null ? void 0 : d.getAttribute) != null && C.call(d, "field") ? T = d : (P = d == null ? void 0 : d.closest) != null && P.call(d, "[field]") && (T = d.closest("[field]")), T && (I = T.textContent), w && I !== void 0 && I !== null) {
766
- I = I.trim();
767
- const W = ((H = i[w]) == null ? void 0 : H.trim()) || "";
768
- I !== W && (i[w] = I);
764
+ let S = null, L = null;
765
+ if ((C = d == null ? void 0 : d.getAttribute) != null && C.call(d, "field") ? S = d : (A = d == null ? void 0 : d.closest) != null && A.call(d, "[field]") && (S = d.closest("[field]")), S && (L = S.textContent), w && L !== void 0 && L !== null) {
766
+ L = L.trim();
767
+ const Z = ((R = i[w]) == null ? void 0 : R.trim()) || "";
768
+ L !== Z && (i[w] = L);
769
769
  }
770
770
  }
771
771
  }
@@ -779,110 +779,110 @@ const hi = /* @__PURE__ */ _n({
779
779
  });
780
780
  }, 50);
781
781
  };
782
- let D = null, Q = null;
783
- const ee = (i) => {
782
+ let O = null, Ee = null;
783
+ const be = (i) => {
784
784
  var a;
785
- ((a = t.editConfig) == null ? void 0 : a.trigger) === "contenteditable" && Ee("focusin", i);
786
- }, ae = (i) => {
787
- var a, c, v, d, g;
785
+ ((a = t.editConfig) == null ? void 0 : a.trigger) === "contenteditable" && ee("focusin", i);
786
+ }, oe = (i) => {
787
+ var a, c, p, d, f;
788
788
  if (((a = t.editConfig) == null ? void 0 : a.trigger) === "contenteditable")
789
- if (D != null && D.cellEl) {
790
- let k = D.fieldEl;
791
- !k && D.field && (k = (v = (c = D.cellEl) == null ? void 0 : c.querySelector) == null ? void 0 : v.call(c, `[field="${D.field}"]`)), k || (k = ((g = (d = D.cellEl).querySelector) == null ? void 0 : g.call(d, "[field]")) || D.cellEl), Ie(D, {
789
+ if (O != null && O.cellEl) {
790
+ let k = O.fieldEl;
791
+ !k && O.field && (k = (p = (c = O.cellEl) == null ? void 0 : c.querySelector) == null ? void 0 : p.call(c, `[field="${O.field}"]`)), k || (k = ((f = (d = O.cellEl).querySelector) == null ? void 0 : f.call(d, "[field]")) || O.cellEl), ye(O, {
792
792
  target: k
793
- }, k), D = null;
793
+ }, k), O = null;
794
794
  } else
795
- Ee("focusout", i);
796
- }, Ee = (i, a) => {
797
- var c, v, d, g, k, w;
795
+ ee("focusout", i);
796
+ }, ee = (i, a) => {
797
+ var c, p, d, f, k, w;
798
798
  try {
799
799
  const b = document.getSelection();
800
- let x = b == null ? void 0 : b.anchorNode;
801
- x && x.nodeType === 3 && (x = x.parentElement);
802
- const C = (c = x == null ? void 0 : x.closest) == null ? void 0 : c.call(x, ".virtual-table-cell"), P = (v = x == null ? void 0 : x.closest) == null ? void 0 : v.call(x, ".virtual-table-row");
803
- if (!C || !P) return;
804
- const H = P.getAttribute("data-id"), T = C.getAttribute("data-prop"), I = Se(H), W = Re.value.find((be) => `${be.prop}` == `${T}`) || {}, J = ((d = x == null ? void 0 : x.closest) == null ? void 0 : d.call(x, "[field]")) || null, R = ((g = J == null ? void 0 : J.getAttribute) == null ? void 0 : g.call(J, "field")) || void 0;
805
- i === "focusin" ? (D = {
806
- row: I,
807
- column: W,
800
+ let _ = b == null ? void 0 : b.anchorNode;
801
+ _ && _.nodeType === 3 && (_ = _.parentElement);
802
+ const C = (c = _ == null ? void 0 : _.closest) == null ? void 0 : c.call(_, ".virtual-table-cell"), A = (p = _ == null ? void 0 : _.closest) == null ? void 0 : p.call(_, ".virtual-table-row");
803
+ if (!C || !A) return;
804
+ const R = A.getAttribute("data-id"), S = C.getAttribute("data-prop"), L = Ae(R), Z = Oe.value.find((ce) => `${ce.prop}` == `${S}`) || {}, j = ((d = _ == null ? void 0 : _.closest) == null ? void 0 : d.call(_, "[field]")) || null, U = ((f = j == null ? void 0 : j.getAttribute) == null ? void 0 : f.call(j, "field")) || void 0;
805
+ i === "focusin" ? (O = {
806
+ row: L,
807
+ column: Z,
808
808
  cellEl: C,
809
- rowEl: P,
810
- fieldEl: J,
811
- field: R
809
+ rowEl: A,
810
+ fieldEl: j,
811
+ field: U
812
812
  }, ge({
813
- row: I,
814
- column: W
815
- }, a, J || ((k = x == null ? void 0 : x.closest) == null ? void 0 : k.call(x, "[field]")))) : Ie({
816
- row: I,
817
- column: W
818
- }, a, J || ((w = x == null ? void 0 : x.closest) == null ? void 0 : w.call(x, "[field]")));
813
+ row: L,
814
+ column: Z
815
+ }, a, j || ((k = _ == null ? void 0 : _.closest) == null ? void 0 : k.call(_, "[field]")))) : ye({
816
+ row: L,
817
+ column: Z
818
+ }, a, j || ((w = _ == null ? void 0 : _.closest) == null ? void 0 : w.call(_, "[field]")));
819
819
  } catch {
820
820
  }
821
- }, Pe = () => {
821
+ }, re = () => {
822
822
  var i;
823
- ((i = t.editConfig) == null ? void 0 : i.trigger) === "contenteditable" && (Q && clearTimeout(Q), Q = setTimeout(() => {
824
- var a, c, v, d, g, k, w, b, x, C, P, H, T, I;
823
+ ((i = t.editConfig) == null ? void 0 : i.trigger) === "contenteditable" && (Ee && clearTimeout(Ee), Ee = setTimeout(() => {
824
+ var a, c, p, d, f, k, w, b, _, C, A, R, S, L;
825
825
  try {
826
- const W = document.getSelection();
827
- if (W.rangeCount === 0) return;
828
- const J = W.getRangeAt(0);
829
- let R = J.startContainer;
830
- R.nodeType === 3 && (R = R.parentElement);
831
- const be = (a = R == null ? void 0 : R.closest) == null ? void 0 : a.call(R, ".virtual-table-cell"), Te = (c = R == null ? void 0 : R.closest) == null ? void 0 : c.call(R, ".virtual-table-row");
832
- if (!be || !Te) return;
833
- const $e = Te.getAttribute("data-id"), He = be.getAttribute("data-prop"), _e = Se($e), se = Re.value.find((te) => `${te.prop}` == `${He}`) || {};
834
- if (!D || ((v = D.row) == null ? void 0 : v[t.rowConfig.keyField]) !== (_e == null ? void 0 : _e[t.rowConfig.keyField]) || ((d = D.column) == null ? void 0 : d.prop) !== (se == null ? void 0 : se.prop)) {
835
- if (D) {
836
- let te = D.fieldEl;
837
- !te && D.field && (te = (k = (g = D.cellEl) == null ? void 0 : g.querySelector) == null ? void 0 : k.call(g, `[field="${D.field}"]`)), te || (te = ((b = (w = D.cellEl) == null ? void 0 : w.querySelector) == null ? void 0 : b.call(w, "[field]")) || D.cellEl), Ie(D, {
838
- target: te
839
- }, te);
826
+ const Z = document.getSelection();
827
+ if (Z.rangeCount === 0) return;
828
+ const j = Z.getRangeAt(0);
829
+ let U = j.startContainer;
830
+ U.nodeType === 3 && (U = U.parentElement);
831
+ const ce = (a = U == null ? void 0 : U.closest) == null ? void 0 : a.call(U, ".virtual-table-cell"), ae = (c = U == null ? void 0 : U.closest) == null ? void 0 : c.call(U, ".virtual-table-row");
832
+ if (!ce || !ae) return;
833
+ const Be = ae.getAttribute("data-id"), De = ce.getAttribute("data-prop"), xe = Ae(Be), pe = Oe.value.find((J) => `${J.prop}` == `${De}`) || {};
834
+ if (!O || ((p = O.row) == null ? void 0 : p[t.rowConfig.keyField]) !== (xe == null ? void 0 : xe[t.rowConfig.keyField]) || ((d = O.column) == null ? void 0 : d.prop) !== (pe == null ? void 0 : pe.prop)) {
835
+ if (O) {
836
+ let J = O.fieldEl;
837
+ !J && O.field && (J = (k = (f = O.cellEl) == null ? void 0 : f.querySelector) == null ? void 0 : k.call(f, `[field="${O.field}"]`)), J || (J = ((b = (w = O.cellEl) == null ? void 0 : w.querySelector) == null ? void 0 : b.call(w, "[field]")) || O.cellEl), ye(O, {
838
+ target: J
839
+ }, J);
840
840
  }
841
- D = {
842
- row: _e,
843
- column: se,
844
- cellEl: be,
845
- rowEl: Te,
846
- fieldEl: ((x = R == null ? void 0 : R.closest) == null ? void 0 : x.call(R, "[field]")) || null,
847
- field: ((H = (P = ((C = R == null ? void 0 : R.closest) == null ? void 0 : C.call(R, "[field]")) || null) == null ? void 0 : P.getAttribute) == null ? void 0 : H.call(P, "field")) || void 0
841
+ O = {
842
+ row: xe,
843
+ column: pe,
844
+ cellEl: ce,
845
+ rowEl: ae,
846
+ fieldEl: ((_ = U == null ? void 0 : U.closest) == null ? void 0 : _.call(U, "[field]")) || null,
847
+ field: ((R = (A = ((C = U == null ? void 0 : U.closest) == null ? void 0 : C.call(U, "[field]")) || null) == null ? void 0 : A.getAttribute) == null ? void 0 : R.call(A, "field")) || void 0
848
848
  }, ge({
849
- row: _e,
850
- column: se
849
+ row: xe,
850
+ column: pe
851
851
  }, {
852
- target: be
853
- }, be);
852
+ target: ce
853
+ }, ce);
854
854
  }
855
- if (W.toString()) {
856
- const te = J.endContainer.nodeType === 3 ? J.endContainer.parentElement : J.endContainer, et = (T = te == null ? void 0 : te.closest) == null ? void 0 : T.call(te, ".virtual-table-cell"), tt = (I = te == null ? void 0 : te.closest) == null ? void 0 : I.call(te, ".virtual-table-row");
855
+ if (Z.toString()) {
856
+ const J = j.endContainer.nodeType === 3 ? j.endContainer.parentElement : j.endContainer, He = (S = J == null ? void 0 : J.closest) == null ? void 0 : S.call(J, ".virtual-table-cell"), it = (L = J == null ? void 0 : J.closest) == null ? void 0 : L.call(J, ".virtual-table-row");
857
857
  }
858
858
  } catch {
859
859
  }
860
860
  }, 50));
861
- }, Ge = () => {
861
+ }, Te = () => {
862
862
  var i;
863
863
  ((i = t.editConfig) == null ? void 0 : i.trigger) === "contenteditable" && setTimeout(() => {
864
- var v, d, g, k;
864
+ var p, d, f, k;
865
865
  const a = document.getSelection();
866
866
  if (!a) return;
867
867
  const c = a.toString();
868
868
  if (c) {
869
869
  const w = a.rangeCount > 0 ? a.getRangeAt(0) : null;
870
- let b = null, x = null;
870
+ let b = null, _ = null;
871
871
  try {
872
872
  if (w) {
873
873
  let C = w.startContainer;
874
874
  (C == null ? void 0 : C.nodeType) === 3 && (C = C.parentElement);
875
- const P = (v = C == null ? void 0 : C.closest) == null ? void 0 : v.call(C, ".virtual-table-cell"), H = (d = C == null ? void 0 : C.closest) == null ? void 0 : d.call(C, ".virtual-table-row");
876
- b = P && H ? {
877
- rowId: H.getAttribute("data-id"),
878
- prop: P.getAttribute("data-prop")
875
+ const A = (p = C == null ? void 0 : C.closest) == null ? void 0 : p.call(C, ".virtual-table-cell"), R = (d = C == null ? void 0 : C.closest) == null ? void 0 : d.call(C, ".virtual-table-row");
876
+ b = A && R ? {
877
+ rowId: R.getAttribute("data-id"),
878
+ prop: A.getAttribute("data-prop")
879
879
  } : null;
880
- let T = w.endContainer;
881
- (T == null ? void 0 : T.nodeType) === 3 && (T = T.parentElement);
882
- const I = (g = T == null ? void 0 : T.closest) == null ? void 0 : g.call(T, ".virtual-table-cell"), W = (k = T == null ? void 0 : T.closest) == null ? void 0 : k.call(T, ".virtual-table-row");
883
- x = I && W ? {
884
- rowId: W.getAttribute("data-id"),
885
- prop: I.getAttribute("data-prop")
880
+ let S = w.endContainer;
881
+ (S == null ? void 0 : S.nodeType) === 3 && (S = S.parentElement);
882
+ const L = (f = S == null ? void 0 : S.closest) == null ? void 0 : f.call(S, ".virtual-table-cell"), Z = (k = S == null ? void 0 : S.closest) == null ? void 0 : k.call(S, ".virtual-table-row");
883
+ _ = L && Z ? {
884
+ rowId: Z.getAttribute("data-id"),
885
+ prop: L.getAttribute("data-prop")
886
886
  } : null;
887
887
  }
888
888
  } catch {
@@ -892,62 +892,62 @@ const hi = /* @__PURE__ */ _n({
892
892
  selection: a,
893
893
  range: w,
894
894
  start: b,
895
- end: x
895
+ end: _
896
896
  });
897
897
  }
898
898
  }, 10);
899
- }, Zt = (i) => (i == null ? void 0 : i._editing) === !0, Qt = (i) => i != null && i.parent_id ? S.get(i.parent_id) : null, en = (i) => {
899
+ }, Re = (i) => (i == null ? void 0 : i._editing) === !0, dt = (i) => i != null && i.parent_id ? M.get(i.parent_id) : null, en = (i) => {
900
900
  var c;
901
- const a = h.value.findIndex((v) => v[t.rowConfig.keyField] == i[t.rowConfig.keyField]);
902
- return a < 1 ? null : ((c = h.value[a - 1]) == null ? void 0 : c.layer) === i.layer ? h.value[a - 1] : null;
901
+ const a = r.value.findIndex((p) => p[t.rowConfig.keyField] == i[t.rowConfig.keyField]);
902
+ return a < 1 ? null : ((c = r.value[a - 1]) == null ? void 0 : c.layer) === i.layer ? r.value[a - 1] : null;
903
903
  }, tn = (i) => {
904
- const a = h.value.findIndex((c) => c[t.rowConfig.keyField] == i[t.rowConfig.keyField]);
905
- return a >= h.value.length - 1 ? null : h.value[a + 1];
906
- }, Se = (i) => {
904
+ const a = r.value.findIndex((c) => c[t.rowConfig.keyField] == i[t.rowConfig.keyField]);
905
+ return a >= r.value.length - 1 ? null : r.value[a + 1];
906
+ }, Ae = (i) => {
907
907
  if (!i) return null;
908
- let a = F.get(i);
909
- return a || (typeof i == "number" ? F.get(`${i}`) : typeof i == "string" && /^\d+$/.test(i) ? F.get(Number(i)) : null);
908
+ let a = x.get(i);
909
+ return a || (typeof i == "number" ? x.get(`${i}`) : typeof i == "string" && /^\d+$/.test(i) ? x.get(Number(i)) : null);
910
910
  };
911
- let Je = null;
911
+ let Ze = null;
912
912
  const nn = (i) => {
913
- Je && cancelAnimationFrame(Je), Je = requestAnimationFrame(() => {
914
- var v;
913
+ Ze && cancelAnimationFrame(Ze), Ze = requestAnimationFrame(() => {
914
+ var p;
915
915
  const a = t.rowConfig.keyField, c = i[a];
916
916
  if (t.pageConfig.enabled) {
917
917
  let d = -1;
918
- for (let g = 0; g < O.value.length; g++)
919
- if (O.value[g].items.some((b) => b[a] === c)) {
920
- d = g;
918
+ for (let f = 0; f < $.value.length; f++)
919
+ if ($.value[f].items.some((b) => b[a] === c)) {
920
+ d = f;
921
921
  break;
922
922
  }
923
923
  if (d !== -1) {
924
- for (let g = Math.max(0, d - 1); g <= Math.min(O.value.length - 1, d + 1); g++)
925
- q.value.has(g) || q.value.add(g);
926
- ke(() => {
927
- const g = document.querySelector(".a4-pages-container");
928
- if (!g) return;
924
+ for (let f = Math.max(0, d - 1); f <= Math.min($.value.length - 1, d + 1); f++)
925
+ W.value.has(f) || W.value.add(f);
926
+ Se(() => {
927
+ const f = document.querySelector(".a4-pages-container");
928
+ if (!f) return;
929
929
  const k = (w = 0) => {
930
- const b = g.querySelector(`[data-id="${c}"]`);
930
+ const b = f.querySelector(`[data-id="${c}"]`);
931
931
  if (b) {
932
- let x = 0, C = b;
933
- for (; C && C !== g; )
934
- x += C.offsetTop, C = C.offsetParent;
935
- const P = g.clientHeight;
936
- let H = x - P * 0.3;
937
- H = Math.max(0, H);
938
- const T = g.scrollTop, I = Math.abs(H - T), W = (J) => {
939
- const R = g.scrollTop, be = J - R, Te = Math.min(800, Math.max(300, I * 0.5)), $e = performance.now(), He = (se) => se < 0.5 ? 4 * se * se * se : 1 - Math.pow(-2 * se + 2, 3) / 2, _e = (se) => {
940
- const Ve = se - $e, te = Math.min(Ve / Te, 1), et = He(te), tt = R + be * et;
941
- g.scrollTop = tt, te < 1 ? requestAnimationFrame(_e) : setTimeout(() => {
942
- g.scrollTop = J;
932
+ let _ = 0, C = b;
933
+ for (; C && C !== f; )
934
+ _ += C.offsetTop, C = C.offsetParent;
935
+ const A = f.clientHeight;
936
+ let R = _ - A * 0.3;
937
+ R = Math.max(0, R);
938
+ const S = f.scrollTop, L = Math.abs(R - S), Z = (j) => {
939
+ const U = f.scrollTop, ce = j - U, ae = Math.min(800, Math.max(300, L * 0.5)), Be = performance.now(), De = (pe) => pe < 0.5 ? 4 * pe * pe * pe : 1 - Math.pow(-2 * pe + 2, 3) / 2, xe = (pe) => {
940
+ const je = pe - Be, J = Math.min(je / ae, 1), He = De(J), it = U + ce * He;
941
+ f.scrollTop = it, J < 1 ? requestAnimationFrame(xe) : setTimeout(() => {
942
+ f.scrollTop = j;
943
943
  }, 50);
944
944
  };
945
- requestAnimationFrame(_e);
945
+ requestAnimationFrame(xe);
946
946
  };
947
- I > 3e3 ? g.scrollTo({
948
- top: H,
947
+ L > 3e3 ? f.scrollTo({
948
+ top: R,
949
949
  behavior: "instant"
950
- }) : W(H), b.classList.add("row--highlight"), setTimeout(() => {
950
+ }) : Z(R), b.classList.add("row--highlight"), setTimeout(() => {
951
951
  b.classList.remove("row--highlight");
952
952
  }, 1500);
953
953
  } else w < 10 && setTimeout(() => k(w + 1), 150);
@@ -956,40 +956,40 @@ const hi = /* @__PURE__ */ _n({
956
956
  });
957
957
  }
958
958
  } else {
959
- const d = h.value.findIndex((g) => g[a] === c);
960
- d !== -1 && ((v = r.value) != null && v.scrollToItem) && r.value.scrollToItem(d);
959
+ const d = r.value.findIndex((f) => f[a] === c);
960
+ d !== -1 && ((p = s.value) != null && p.scrollToItem) && s.value.scrollToItem(d);
961
961
  }
962
- Je = null;
962
+ Ze = null;
963
963
  });
964
- }, Xe = (i) => {
964
+ }, Qe = (i) => {
965
965
  if (i) {
966
- if (!y.value) {
967
- setTimeout(() => Xe(i), 200);
966
+ if (!v.value) {
967
+ setTimeout(() => Qe(i), 200);
968
968
  return;
969
969
  }
970
- m.value = i, m.value !== s.value && s.value && (s.value._editing = !1, setTimeout(() => {
971
- s.value = null;
970
+ y.value = i, y.value !== m.value && m.value && (m.value._editing = !1, setTimeout(() => {
971
+ m.value = null;
972
972
  }, 200));
973
973
  }
974
- }, Ne = (i, a) => new Promise((c) => {
975
- var v, d;
976
- if (!((v = t == null ? void 0 : t.editConfig) != null && v.beforeEditMethod && typeof ((d = t == null ? void 0 : t.editConfig) == null ? void 0 : d.beforeEditMethod) == "function" && !t.editConfig.beforeEditMethod({
974
+ }, Ve = (i, a) => new Promise((c) => {
975
+ var p, d;
976
+ if (!((p = t == null ? void 0 : t.editConfig) != null && p.beforeEditMethod && typeof ((d = t == null ? void 0 : t.editConfig) == null ? void 0 : d.beforeEditMethod) == "function" && !t.editConfig.beforeEditMethod({
977
977
  row: i
978
978
  }))) {
979
- if (!i || !y.value) {
980
- setTimeout(() => Ne(i), 200);
979
+ if (!i || !v.value) {
980
+ setTimeout(() => Ve(i), 200);
981
981
  return;
982
982
  }
983
- i !== s.value && (h.value.forEach((g) => {
984
- g._editing && e("edit-closed", {
985
- row: g,
983
+ i !== m.value && (r.value.forEach((f) => {
984
+ f._editing && e("edit-closed", {
985
+ row: f,
986
986
  column: {
987
987
  field: a
988
988
  },
989
989
  $table: o == null ? void 0 : o.exposed
990
- }), g._editing = !1;
990
+ }), f._editing = !1;
991
991
  }), i._editing = !0, setTimeout(() => {
992
- s.value = i, e("edit-activated", {
992
+ m.value = i, e("edit-activated", {
993
993
  row: i,
994
994
  column: {
995
995
  field: a
@@ -998,49 +998,49 @@ const hi = /* @__PURE__ */ _n({
998
998
  }), c(!0);
999
999
  }));
1000
1000
  }
1001
- }), ln = (i) => Ne(i), ct = () => {
1002
- if (we(), t.pageConfig.enabled) {
1003
- const i = Array.from(_.value);
1001
+ }), ln = (i) => Ve(i), ut = () => {
1002
+ if (he(), t.pageConfig.enabled) {
1003
+ const i = Array.from(B.value);
1004
1004
  if (i.length > 0) {
1005
1005
  const a = Math.min(...i);
1006
- for (let c = Math.max(0, a - 1); c <= Math.min(O.value.length - 1, a + 2); c++)
1007
- q.value.add(c);
1006
+ for (let c = Math.max(0, a - 1); c <= Math.min($.value.length - 1, a + 2); c++)
1007
+ W.value.add(c);
1008
1008
  } else
1009
- for (let a = 0; a < Math.min(3, O.value.length); a++)
1010
- q.value.add(a);
1011
- ke(() => {
1012
- de();
1009
+ for (let a = 0; a < Math.min(3, $.value.length); a++)
1010
+ W.value.add(a);
1011
+ Se(() => {
1012
+ fe();
1013
1013
  });
1014
1014
  }
1015
- ke(() => {
1016
- !t.pageConfig.enabled && r.value && r.value.$forceUpdate && r.value.$forceUpdate();
1015
+ Se(() => {
1016
+ !t.pageConfig.enabled && s.value && s.value.$forceUpdate && s.value.$forceUpdate();
1017
1017
  });
1018
1018
  }, on = (i, a) => new Promise((c) => {
1019
- let v = -1;
1019
+ let p = -1;
1020
1020
  if (a == -1) {
1021
- const d = Se(i.parent_id);
1022
- for (v = h.value.findIndex((g) => g[t.rowConfig.keyField] == d[t.rowConfig.keyField]) + 1; h.value[v].parent_id == d[t.rowConfig.keyField]; )
1023
- v += 1;
1021
+ const d = Ae(i.parent_id);
1022
+ for (p = r.value.findIndex((f) => f[t.rowConfig.keyField] == d[t.rowConfig.keyField]) + 1; r.value[p].parent_id == d[t.rowConfig.keyField]; )
1023
+ p += 1;
1024
1024
  } else
1025
- v = h.value.findIndex((d) => d[t.rowConfig.keyField] == a[t.rowConfig.keyField]);
1026
- S.set(i.node_id, i), F.set(i[t.rowConfig.keyField], i), h.value.splice(v, 0, i), ct(), c({
1025
+ p = r.value.findIndex((d) => d[t.rowConfig.keyField] == a[t.rowConfig.keyField]);
1026
+ M.set(i.node_id, i), x.set(i[t.rowConfig.keyField], i), r.value.splice(p, 0, i), ut(), c({
1027
1027
  row: i
1028
1028
  });
1029
1029
  }), an = (i, a) => new Promise((c) => {
1030
- const v = h.value.findIndex((d) => d[t.rowConfig.keyField] == a[t.rowConfig.keyField]) + 1;
1031
- S.set(i.node_id, i), F.set(i[t.rowConfig.keyField], i), h.value.splice(v, 0, i), ct(), c({
1030
+ const p = r.value.findIndex((d) => d[t.rowConfig.keyField] == a[t.rowConfig.keyField]) + 1;
1031
+ M.set(i.node_id, i), x.set(i[t.rowConfig.keyField], i), r.value.splice(p, 0, i), ut(), c({
1032
1032
  row: i
1033
1033
  });
1034
- }), mt = (i) => {
1035
- const a = h.value.findIndex((c) => c[t.rowConfig.keyField] == i[t.rowConfig.keyField] || c === i);
1034
+ }), xt = (i) => {
1035
+ const a = r.value.findIndex((c) => c[t.rowConfig.keyField] == i[t.rowConfig.keyField] || c === i);
1036
1036
  if (a > -1) {
1037
1037
  const c = i[t.rowConfig.keyField];
1038
- S.delete(i.node_id), F.delete(c), h.value.splice(a, 1), ct();
1038
+ M.delete(i.node_id), x.delete(c), r.value.splice(a, 1), ut();
1039
1039
  }
1040
1040
  }, sn = (i, a) => {
1041
1041
  if (!i || !i[t.rowConfig.keyField]) return !1;
1042
1042
  const c = i._original;
1043
- return c ? a ? i[a] !== c[a] : Object.keys(c).some((v) => c[v] !== i[v]) : !1;
1043
+ return c ? a ? i[a] !== c[a] : Object.keys(c).some((p) => c[p] !== i[p]) : !1;
1044
1044
  }, rn = (i) => i && i[t.rowConfig.keyField] && !i._original, cn = (i, a) => {
1045
1045
  i && i[t.rowConfig.keyField] && (a && Object.assign(i, a), i._original = {
1046
1046
  ...i,
@@ -1050,22 +1050,22 @@ const hi = /* @__PURE__ */ _n({
1050
1050
  });
1051
1051
  }, dn = (i) => {
1052
1052
  if (i && i[t.rowConfig.keyField]) {
1053
- const a = Se(i[t.rowConfig.keyField]);
1054
- a._original ? Object.assign(a, a._original) : mt(a);
1053
+ const a = Ae(i[t.rowConfig.keyField]);
1054
+ a._original ? Object.assign(a, a._original) : xt(a);
1055
1055
  }
1056
1056
  }, un = () => {
1057
1057
  }, hn = () => {
1058
- m.value = {};
1059
- }, yt = (i) => {
1060
- var c, v, d;
1061
- let a = h.value.findIndex((g) => g[t.rowConfig.keyField] == i[t.rowConfig.keyField]);
1058
+ y.value = {};
1059
+ }, kt = (i) => {
1060
+ var c, p, d;
1061
+ let a = r.value.findIndex((f) => f[t.rowConfig.keyField] == i[t.rowConfig.keyField]);
1062
1062
  if (a > -1 && t.treeConfig) {
1063
- const g = ((c = t.treeConfig) == null ? void 0 : c.keyField) || ((v = t.treeConfig) == null ? void 0 : v.rowField) || "node_id", k = ((d = t.treeConfig) == null ? void 0 : d.parentField) || "parent_id", w = [], b = /* @__PURE__ */ new Map();
1064
- b.set(i[g], !0);
1065
- for (let x = a + 1; x < h.value.length; x++) {
1066
- const C = h.value[x];
1063
+ const f = ((c = t.treeConfig) == null ? void 0 : c.keyField) || ((p = t.treeConfig) == null ? void 0 : p.rowField) || "node_id", k = ((d = t.treeConfig) == null ? void 0 : d.parentField) || "parent_id", w = [], b = /* @__PURE__ */ new Map();
1064
+ b.set(i[f], !0);
1065
+ for (let _ = a + 1; _ < r.value.length; _++) {
1066
+ const C = r.value[_];
1067
1067
  if (C && b.has(C[k]))
1068
- w.push(C), b.set(C[g]);
1068
+ w.push(C), b.set(C[f]);
1069
1069
  else
1070
1070
  break;
1071
1071
  }
@@ -1074,14 +1074,14 @@ const hi = /* @__PURE__ */ _n({
1074
1074
  return [];
1075
1075
  };
1076
1076
  l({
1077
- isEditByRow: Zt,
1078
- getParentRow: Qt,
1077
+ isEditByRow: Re,
1078
+ getParentRow: dt,
1079
1079
  getSiblingRow: en,
1080
1080
  getNextRow: tn,
1081
- getRowById: Se,
1081
+ getRowById: Ae,
1082
1082
  scrollToRow: nn,
1083
- setCurrentRow: Xe,
1084
- setEditRow: Ne,
1083
+ setCurrentRow: Qe,
1084
+ setEditRow: Ve,
1085
1085
  setEditCell: ln,
1086
1086
  insertAt: on,
1087
1087
  insertNextAt: an,
@@ -1089,23 +1089,23 @@ const hi = /* @__PURE__ */ _n({
1089
1089
  isInsertByRow: rn,
1090
1090
  reloadRow: cn,
1091
1091
  revertData: dn,
1092
- remove: mt,
1092
+ remove: xt,
1093
1093
  setAllTreeExpand: un,
1094
1094
  clearCurrentRow: hn,
1095
- getAllChilds: yt
1095
+ getAllChilds: kt
1096
1096
  });
1097
- const Re = re(() => n.default().filter((i) => {
1097
+ const Oe = de(() => n.default().filter((i) => {
1098
1098
  var a;
1099
1099
  return ((a = i.type) == null ? void 0 : a.name) === "VirtualTableColumn";
1100
1100
  }).map((i) => {
1101
- var a, c, v;
1101
+ var a, c, p;
1102
1102
  return {
1103
1103
  prop: (a = i.props) == null ? void 0 : a.prop,
1104
1104
  title: (c = i.props) == null ? void 0 : c.title,
1105
- width: (v = i.props) == null ? void 0 : v.width,
1105
+ width: (p = i.props) == null ? void 0 : p.width,
1106
1106
  slots: i.children
1107
1107
  };
1108
- })), Ye = (i) => {
1108
+ })), et = (i) => {
1109
1109
  try {
1110
1110
  return i === 0 ? {
1111
1111
  width: "0px"
@@ -1119,155 +1119,156 @@ const hi = /* @__PURE__ */ _n({
1119
1119
  flex: "1 1 100%"
1120
1120
  };
1121
1121
  }
1122
- }, bt = re(() => {
1122
+ }, wt = de(() => {
1123
1123
  var i;
1124
- return (i = t.treeConfig) != null && i.childCurrent && m.value ? yt(m.value).map((a) => a[t.rowConfig.keyField]) : [];
1125
- }), xt = ne({
1124
+ return (i = t.treeConfig) != null && i.childCurrent && y.value ? kt(y.value).map((a) => a[t.rowConfig.keyField]) : [];
1125
+ }), Ct = te({
1126
1126
  viewStartIndex: 0,
1127
1127
  viewEndIndex: 0,
1128
1128
  visibleStartIndex: 0,
1129
1129
  visibleEndIndex: 0
1130
1130
  });
1131
- let Ze = null, Qe = null;
1131
+ let tt = null, nt = null;
1132
1132
  const fn = (i, a) => {
1133
- Ze && cancelAnimationFrame(Ze), Ze = requestAnimationFrame(() => {
1133
+ tt && cancelAnimationFrame(tt), tt = requestAnimationFrame(() => {
1134
1134
  e("scroll-end", {
1135
- ...xt.value
1136
- }), Ze = null;
1135
+ ...Ct.value
1136
+ }), tt = null;
1137
1137
  });
1138
- }, gn = (i, a, c, v) => {
1139
- Qe && cancelAnimationFrame(Qe), Qe = requestAnimationFrame(() => {
1140
- xt.value = {
1138
+ }, gn = (i, a, c, p) => {
1139
+ nt && cancelAnimationFrame(nt), nt = requestAnimationFrame(() => {
1140
+ Ct.value = {
1141
1141
  viewStartIndex: i,
1142
1142
  viewEndIndex: a,
1143
1143
  visibleStartIndex: c,
1144
- visibleEndIndex: v
1145
- }, Qe = null;
1144
+ visibleEndIndex: p
1145
+ }, nt = null;
1146
1146
  });
1147
1147
  }, pn = (i, a) => {
1148
- var H, T;
1148
+ var S, L, Z;
1149
1149
  const {
1150
1150
  pageHeight: c,
1151
- margin: v,
1151
+ margin: p,
1152
1152
  showPageBorder: d,
1153
- pageBorderPadding: g,
1153
+ pageBorderPadding: f,
1154
1154
  pageBorderStyle: k,
1155
1155
  showPageHeader: w,
1156
1156
  headerHeight: b = 0,
1157
- footerHeight: x = 0,
1157
+ footerHeight: _ = 0,
1158
1158
  showPageNumber: C
1159
- } = t.pageConfig, P = i.pageNumber || a + 1;
1160
- return q.value.has(a) ? K(U, null, [w !== !1 && (n["page-header"] || b > 0) ? K("div", {
1159
+ } = t.pageConfig, A = i.pageNumber || a + 1, R = (S = i.items) == null ? void 0 : S.some((j) => j._isCover);
1160
+ return W.value.has(a) ? q(G, null, [w !== !1 && (n["page-header"] || b > 0) && !R ? q("div", {
1161
1161
  class: "a4-page-header",
1162
1162
  style: {
1163
1163
  minHeight: `${Math.max(b, 1)}px`
1164
1164
  }
1165
- }, [(H = n["page-header"]) == null ? void 0 : H.call(n, {
1166
- pageNumber: P,
1165
+ }, [(L = n["page-header"]) == null ? void 0 : L.call(n, {
1166
+ pageNumber: A,
1167
1167
  pageIndex: a,
1168
- totalPages: O.value.length
1169
- })]) : null, a === 0 && t.showHeader ? K("div", {
1168
+ totalPages: $.value.length,
1169
+ isCoverPage: R
1170
+ })]) : null, a === 0 && t.showHeader ? q("div", {
1170
1171
  class: "a4-table-header"
1171
- }, [K("div", {
1172
+ }, [q("div", {
1172
1173
  class: "virtual-table-header we-vt-table--header we-vt-table--header-wrapper"
1173
- }, [Re.value.map((I) => {
1174
- var W, J, R;
1175
- return K("div", {
1174
+ }, [Oe.value.map((j) => {
1175
+ var U, ce, ae;
1176
+ return q("div", {
1176
1177
  class: "we-vt-header--column",
1177
- key: I.prop,
1178
- style: Ye(I.width)
1179
- }, [K("div", {
1178
+ key: j.prop,
1179
+ style: et(j.width)
1180
+ }, [q("div", {
1180
1181
  class: "we-vt-cell"
1181
- }, [(W = I.slots) != null && W.header ? (R = (J = I.slots) == null ? void 0 : J.header) == null ? void 0 : R.call(J, {
1182
- column: I
1183
- }) : I.title])]);
1184
- })])]) : null, K("div", {
1182
+ }, [(U = j.slots) != null && U.header ? (ae = (ce = j.slots) == null ? void 0 : ce.header) == null ? void 0 : ae.call(ce, {
1183
+ column: j
1184
+ }) : j.title])]);
1185
+ })])]) : null, q("div", {
1185
1186
  class: "a4-page-content",
1186
1187
  style: {
1187
1188
  ...d ? {
1188
1189
  border: k,
1189
- padding: `${g}px`
1190
+ padding: `${f}px`
1190
1191
  } : {}
1191
1192
  }
1192
- }, [i.items.map((I) => {
1193
- var W, J;
1194
- return K("div", {
1195
- key: I[t.rowConfig.keyField],
1196
- "data-id": I[t.rowConfig.keyField],
1193
+ }, [i.items.map((j) => {
1194
+ var U, ce;
1195
+ return q("div", {
1196
+ key: j[t.rowConfig.keyField],
1197
+ "data-id": j[t.rowConfig.keyField],
1197
1198
  class: {
1198
1199
  "virtual-table-row": !0,
1199
1200
  "we-vt-body--row": !0,
1200
- "row--current": I[t.rowConfig.keyField] === ((W = m.value) == null ? void 0 : W[t.rowConfig.keyField]) || ((J = t.treeConfig) == null ? void 0 : J.childCurrent) && bt.value.includes(I[t.rowConfig.keyField])
1201
+ "row--current": j[t.rowConfig.keyField] === ((U = y.value) == null ? void 0 : U[t.rowConfig.keyField]) || ((ce = t.treeConfig) == null ? void 0 : ce.childCurrent) && wt.value.includes(j[t.rowConfig.keyField])
1201
1202
  },
1202
1203
  style: {
1203
1204
  width: "100%"
1204
1205
  },
1205
- onClick: () => Ce(I),
1206
- onDblclick: () => fe(I)
1207
- }, [Re.value.map((R) => {
1208
- var be, Te, $e, He, _e, se, Ve;
1209
- return K("div", {
1210
- key: R.prop,
1206
+ onClick: () => ke(j),
1207
+ onDblclick: () => Ie(j)
1208
+ }, [Oe.value.map((ae) => {
1209
+ var Be, De, xe, pe, je, J, He;
1210
+ return q("div", {
1211
+ key: ae.prop,
1211
1212
  class: "virtual-table-cell we-vt-cell",
1212
- style: Ye(R.width),
1213
- "data-prop": R.prop
1214
- }, [I._editing && ((be = t.editConfig) == null ? void 0 : be.trigger) === "dblclick" ? ((Te = R.slots) == null ? void 0 : Te.edit) && ((He = ($e = R.slots) == null ? void 0 : $e.edit) == null ? void 0 : He.call($e, {
1215
- row: I,
1216
- column: R
1217
- })) : ((_e = R.slots) == null ? void 0 : _e.default) && ((Ve = (se = R.slots) == null ? void 0 : se.default) == null ? void 0 : Ve.call(se, {
1218
- row: I,
1219
- column: R
1213
+ style: et(ae.width),
1214
+ "data-prop": ae.prop
1215
+ }, [j._editing && ((Be = t.editConfig) == null ? void 0 : Be.trigger) === "dblclick" ? ((De = ae.slots) == null ? void 0 : De.edit) && ((pe = (xe = ae.slots) == null ? void 0 : xe.edit) == null ? void 0 : pe.call(xe, {
1216
+ row: j,
1217
+ column: ae
1218
+ })) : ((je = ae.slots) == null ? void 0 : je.default) && ((He = (J = ae.slots) == null ? void 0 : J.default) == null ? void 0 : He.call(J, {
1219
+ row: j,
1220
+ column: ae
1220
1221
  }))]);
1221
1222
  })]);
1222
- })]), n["page-footer"] ? K("div", {
1223
+ })]), n["page-footer"] ? q("div", {
1223
1224
  class: "a4-page-footer"
1224
- }, [(T = n["page-footer"]) == null ? void 0 : T.call(n, {
1225
- pageNumber: P,
1225
+ }, [(Z = n["page-footer"]) == null ? void 0 : Z.call(n, {
1226
+ pageNumber: A,
1226
1227
  pageIndex: a,
1227
- totalPages: O.value.length
1228
- })]) : K("div", {
1228
+ totalPages: $.value.length
1229
+ })]) : q("div", {
1229
1230
  class: "a4-page-footer",
1230
1231
  contenteditable: "false"
1231
- }, [C !== !1 ? K("span", {
1232
+ }, [C !== !1 ? q("span", {
1232
1233
  class: "page-number",
1233
1234
  contenteditable: "false"
1234
- }, [P, Oe(" / "), O.value.length]) : null])]) : K("div", {
1235
+ }, [Le("第"), A, Le(" / "), $.value.length, Le("页")]) : null])]) : q("div", {
1235
1236
  class: "a4-page-loading"
1236
- }, [K("div", {
1237
+ }, [q("div", {
1237
1238
  class: "loading-spinner"
1238
- }, null), K("div", {
1239
+ }, null), q("div", {
1239
1240
  class: "loading-text"
1240
- }, [Oe("加载中...")])]);
1241
+ }, [Le("加载中...")])]);
1241
1242
  }, vn = () => {
1242
1243
  var k;
1243
1244
  const {
1244
1245
  pageHeight: i,
1245
1246
  pageWidth: a,
1246
1247
  margin: c,
1247
- gap: v,
1248
+ gap: p,
1248
1249
  showPageBorder: d,
1249
- pageBorderPadding: g
1250
+ pageBorderPadding: f
1250
1251
  } = t.pageConfig;
1251
- return K("div", {
1252
+ return q("div", {
1252
1253
  class: "virtual-table we-vt-table we-vt-table--render-default border--none"
1253
- }, [K("div", {
1254
+ }, [q("div", {
1254
1255
  class: "a4-pages-container",
1255
1256
  contenteditable: ((k = t.editConfig) == null ? void 0 : k.trigger) === "contenteditable" ? "true" : void 0,
1256
- onContextmenu: V,
1257
- onFocusin: ee,
1258
- onFocusout: ae
1259
- }, [O.value.map((w, b) => {
1260
- const x = q.value.has(b);
1261
- return K("div", {
1257
+ onContextmenu: Ce,
1258
+ onFocusin: be,
1259
+ onFocusout: oe
1260
+ }, [$.value.map((w, b) => {
1261
+ const _ = W.value.has(b);
1262
+ return q("div", {
1262
1263
  key: `page-${b}`,
1263
- class: x ? "a4-page" : "a4-page-placeholder",
1264
+ class: _ ? "a4-page" : "a4-page-placeholder",
1264
1265
  "data-page-index": b,
1265
1266
  style: {
1266
1267
  width: `${a}px`,
1267
1268
  minHeight: `${i}px`,
1268
- marginBottom: `${v}px`,
1269
- padding: x ? `${d ? c - g : c}px` : "0",
1270
- paddingBottom: x ? "12px" : "0",
1269
+ marginBottom: `${p}px`,
1270
+ padding: _ ? `${d ? c - f : c}px` : "0",
1271
+ paddingBottom: _ ? "12px" : "0",
1271
1272
  boxSizing: "border-box",
1272
1273
  position: "relative"
1273
1274
  }
@@ -1275,70 +1276,70 @@ const hi = /* @__PURE__ */ _n({
1275
1276
  })])]);
1276
1277
  }, mn = () => {
1277
1278
  var i;
1278
- return K("div", {
1279
+ return q("div", {
1279
1280
  class: "virtual-table we-vt-table we-vt-table--render-default border--none"
1280
- }, [t.showHeader ? K("div", {
1281
+ }, [t.showHeader ? q("div", {
1281
1282
  class: "virtual-table-header we-vt-table--header we-vt-table--header-wrapper"
1282
- }, [Re.value.map((a) => {
1283
- var c, v, d;
1284
- return K("div", {
1283
+ }, [Oe.value.map((a) => {
1284
+ var c, p, d;
1285
+ return q("div", {
1285
1286
  class: "we-vt-header--column",
1286
1287
  key: a.prop,
1287
- style: Ye(a.width)
1288
- }, [K("div", {
1288
+ style: et(a.width)
1289
+ }, [q("div", {
1289
1290
  class: "we-vt-cell"
1290
- }, [(c = a.slots) != null && c.header ? (d = (v = a.slots) == null ? void 0 : v.header) == null ? void 0 : d.call(v, {
1291
+ }, [(c = a.slots) != null && c.header ? (d = (p = a.slots) == null ? void 0 : p.header) == null ? void 0 : d.call(p, {
1291
1292
  column: a
1292
- }) : a.title]), K("div", {
1293
+ }) : a.title]), q("div", {
1293
1294
  class: "we-vt-resizable is--line"
1294
1295
  }, null)]);
1295
- })]) : void 0, K(En, {
1296
- ref: r,
1296
+ })]) : void 0, q(En, {
1297
+ ref: s,
1297
1298
  items: E.value,
1298
- minItemSize: Y.value,
1299
+ minItemSize: ue.value,
1299
1300
  keyField: t.rowConfig.keyField,
1300
1301
  emitUpdate: !1,
1301
1302
  buffer: 300,
1302
1303
  class: "virtual-table-wrapper",
1303
1304
  contenteditable: ((i = t.editConfig) == null ? void 0 : i.trigger) === "contenteditable" ? "true" : void 0,
1304
- onContextmenu: V,
1305
+ onContextmenu: Ce,
1305
1306
  onScrollend: fn,
1306
1307
  onUpdate: gn,
1307
- onFocusin: ee,
1308
- onFocusout: ae
1308
+ onFocusin: be,
1309
+ onFocusout: oe
1309
1310
  }, {
1310
1311
  default: ({
1311
1312
  item: a,
1312
1313
  index: c,
1313
- active: v
1314
+ active: p
1314
1315
  }) => {
1315
- var g, k, w;
1316
+ var f, k, w;
1316
1317
  let d;
1317
- return K(Sn, {
1318
+ return q(Sn, {
1318
1319
  key: a[t.rowConfig.keyField],
1319
1320
  item: a,
1320
- active: v,
1321
- sizeDependencies: [(g = a.content) == null ? void 0 : g.length, a._editing, a.content_type],
1321
+ active: p,
1322
+ sizeDependencies: [(f = a.content) == null ? void 0 : f.length, a._editing, a.content_type],
1322
1323
  "data-id": a[t.rowConfig.keyField],
1323
1324
  "data-index": c,
1324
- "data-active": v,
1325
+ "data-active": p,
1325
1326
  class: {
1326
1327
  "virtual-table-row": !0,
1327
1328
  "we-vt-body--row": !0,
1328
- "row--current": a[t.rowConfig.keyField] === ((k = m.value) == null ? void 0 : k[t.rowConfig.keyField]) || // 如果是树,并且配置了childCurrent高亮子节点
1329
- ((w = t.treeConfig) == null ? void 0 : w.childCurrent) && bt.value.includes(a[t.rowConfig.keyField])
1329
+ "row--current": a[t.rowConfig.keyField] === ((k = y.value) == null ? void 0 : k[t.rowConfig.keyField]) || // 如果是树,并且配置了childCurrent高亮子节点
1330
+ ((w = t.treeConfig) == null ? void 0 : w.childCurrent) && wt.value.includes(a[t.rowConfig.keyField])
1330
1331
  }
1331
- }, ui(d = Re.value.map((b) => {
1332
- var x, C, P, H, T, I, W;
1333
- return K("div", {
1332
+ }, ui(d = Oe.value.map((b) => {
1333
+ var _, C, A, R, S, L, Z;
1334
+ return q("div", {
1334
1335
  key: b.prop,
1335
1336
  class: "virtual-table-cell we-vt-cell",
1336
- style: Ye(b.width),
1337
+ style: et(b.width),
1337
1338
  "data-prop": b.prop
1338
- }, [a._editing && ((x = t.editConfig) == null ? void 0 : x.trigger) === "dblclick" ? ((C = b.slots) == null ? void 0 : C.edit) && ((H = (P = b.slots) == null ? void 0 : P.edit) == null ? void 0 : H.call(P, {
1339
+ }, [a._editing && ((_ = t.editConfig) == null ? void 0 : _.trigger) === "dblclick" ? ((C = b.slots) == null ? void 0 : C.edit) && ((R = (A = b.slots) == null ? void 0 : A.edit) == null ? void 0 : R.call(A, {
1339
1340
  row: a,
1340
1341
  column: b
1341
- })) : ((T = b.slots) == null ? void 0 : T.default) && ((W = (I = b.slots) == null ? void 0 : I.default) == null ? void 0 : W.call(I, {
1342
+ })) : ((S = b.slots) == null ? void 0 : S.default) && ((Z = (L = b.slots) == null ? void 0 : L.default) == null ? void 0 : Z.call(L, {
1342
1343
  row: a,
1343
1344
  column: b
1344
1345
  }))]);
@@ -1350,12 +1351,12 @@ const hi = /* @__PURE__ */ _n({
1350
1351
  };
1351
1352
  return () => t.pageConfig.enabled ? vn() : mn();
1352
1353
  }
1353
- }), De = (t, e) => {
1354
+ }), Ne = (t, e) => {
1354
1355
  const n = t.__vccOpts || t;
1355
1356
  for (const [l, o] of e)
1356
1357
  n[l] = o;
1357
1358
  return n;
1358
- }, fi = /* @__PURE__ */ De(hi, [["__scopeId", "data-v-bd96f5fb"]]), gi = {
1359
+ }, fi = /* @__PURE__ */ Ne(hi, [["__scopeId", "data-v-6bbd7545"]]), gi = {
1359
1360
  name: "VirtualTableColumn",
1360
1361
  props: {
1361
1362
  prop: String,
@@ -1363,13 +1364,13 @@ const hi = /* @__PURE__ */ _n({
1363
1364
  width: [String, Number]
1364
1365
  }
1365
1366
  };
1366
- function pi(t, e, n, l, o, r) {
1367
+ function pi(t, e, n, l, o, s) {
1367
1368
  return Cn(t.$slots, "default");
1368
1369
  }
1369
- const vi = /* @__PURE__ */ De(gi, [["render", pi]]), mi = { class: "catalog-node" }, yi = ["title"], bi = { class: "catalog-node__text" }, xi = {
1370
+ const vi = /* @__PURE__ */ Ne(gi, [["render", pi]]), mi = { class: "catalog-node" }, yi = ["title"], bi = { class: "catalog-node__text" }, _i = {
1370
1371
  key: 0,
1371
1372
  class: "catalog-node__children"
1372
- }, _i = {
1373
+ }, xi = {
1373
1374
  __name: "CatalogNode",
1374
1375
  props: {
1375
1376
  item: { type: Object, required: !0 },
@@ -1378,43 +1379,43 @@ const vi = /* @__PURE__ */ De(gi, [["render", pi]]), mi = { class: "catalog-node
1378
1379
  },
1379
1380
  emits: ["navigate"],
1380
1381
  setup(t, { emit: e }) {
1381
- const n = t, l = e, o = ne(!0), r = re(() => n.item.children && n.item.children.length > 0);
1382
- function y(s) {
1383
- s.stopPropagation(), o.value = !o.value;
1382
+ const n = t, l = e, o = te(!0), s = de(() => n.item.children && n.item.children.length > 0);
1383
+ function v(m) {
1384
+ m.stopPropagation(), o.value = !o.value;
1384
1385
  }
1385
- return (s, m) => {
1386
- const h = Mn("CatalogNode", !0);
1387
- return u(), p("div", mi, [
1388
- Z("div", {
1389
- class: Fe(["catalog-node__label", { "is-active": t.activeId === t.item.nodeId }]),
1390
- style: N({ paddingLeft: 10 + t.depth * 14 + "px" }),
1386
+ return (m, y) => {
1387
+ const r = Mn("CatalogNode", !0);
1388
+ return u(), g("div", mi, [
1389
+ ne("div", {
1390
+ class: Pe(["catalog-node__label", { "is-active": t.activeId === t.item.nodeId }]),
1391
+ style: V({ paddingLeft: 10 + t.depth * 14 + "px" }),
1391
1392
  title: t.item.name,
1392
- onClick: m[0] || (m[0] = (S) => l("navigate", t.item))
1393
+ onClick: y[0] || (y[0] = (M) => l("navigate", t.item))
1393
1394
  }, [
1394
- Z("span", {
1395
+ ne("span", {
1395
1396
  class: "catalog-node__toggle",
1396
- onClick: y
1397
+ onClick: v
1397
1398
  }, [
1398
- r.value ? (u(), Me(lt(o.value ? j(Gn) : j(Ut)), {
1399
+ s.value ? (u(), Fe(at(o.value ? K(Gn) : K(Gt)), {
1399
1400
  key: 0,
1400
1401
  size: 14
1401
- })) : pe("", !0)
1402
+ })) : ve("", !0)
1402
1403
  ]),
1403
- Z("span", bi, G(t.item.name || "(无标题)"), 1)
1404
+ ne("span", bi, Y(t.item.name || "(无标题)"), 1)
1404
1405
  ], 14, yi),
1405
- r.value && o.value ? (u(), p("div", xi, [
1406
- (u(!0), p(U, null, X(t.item.children, (S) => (u(), Me(h, {
1407
- key: S.nodeId,
1408
- item: S,
1406
+ s.value && o.value ? (u(), g("div", _i, [
1407
+ (u(!0), g(G, null, Q(t.item.children, (M) => (u(), Fe(r, {
1408
+ key: M.nodeId,
1409
+ item: M,
1409
1410
  depth: t.depth + 1,
1410
1411
  "active-id": t.activeId,
1411
- onNavigate: m[1] || (m[1] = (F) => l("navigate", F))
1412
+ onNavigate: y[1] || (y[1] = (x) => l("navigate", x))
1412
1413
  }, null, 8, ["item", "depth", "active-id"]))), 128))
1413
- ])) : pe("", !0)
1414
+ ])) : ve("", !0)
1414
1415
  ]);
1415
1416
  };
1416
1417
  }
1417
- }, ki = /* @__PURE__ */ De(_i, [["__scopeId", "data-v-ac882917"]]), wi = {
1418
+ }, ki = /* @__PURE__ */ Ne(xi, [["__scopeId", "data-v-ac882917"]]), wi = {
1418
1419
  key: 0,
1419
1420
  class: "catalog catalog--collapsed"
1420
1421
  }, Ci = {
@@ -1423,51 +1424,51 @@ const vi = /* @__PURE__ */ De(gi, [["render", pi]]), mi = { class: "catalog-node
1423
1424
  }, Mi = { class: "catalog__header" }, Ii = { class: "catalog__title" }, Ei = { class: "catalog__body" }, Si = {
1424
1425
  key: 0,
1425
1426
  class: "catalog__empty"
1426
- }, Ti = {
1427
+ }, Fi = {
1427
1428
  __name: "index",
1428
1429
  props: {
1429
1430
  items: { type: Array, default: () => [] }
1430
1431
  },
1431
1432
  emits: ["navigate"],
1432
1433
  setup(t, { emit: e }) {
1433
- const n = e, l = ne(!1), o = ne("");
1434
- function r(y) {
1435
- o.value = y.nodeId, n("navigate", y);
1434
+ const n = e, l = te(!1), o = te("");
1435
+ function s(v) {
1436
+ o.value = v.nodeId, n("navigate", v);
1436
1437
  }
1437
- return (y, s) => l.value ? (u(), p("div", wi, [
1438
- Z("button", {
1438
+ return (v, m) => l.value ? (u(), g("div", wi, [
1439
+ ne("button", {
1439
1440
  class: "catalog__icon-btn",
1440
1441
  title: "展开目录",
1441
- onClick: s[0] || (s[0] = (m) => l.value = !1)
1442
+ onClick: m[0] || (m[0] = (y) => l.value = !1)
1442
1443
  }, [
1443
- K(j(Jn), { size: 18 })
1444
+ q(K(Jn), { size: 18 })
1444
1445
  ])
1445
- ])) : (u(), p("div", Ci, [
1446
- Z("div", Mi, [
1447
- Z("span", Ii, [
1448
- K(j(Xn), { size: 16 }),
1449
- s[2] || (s[2] = Oe(" 目录 ", -1))
1446
+ ])) : (u(), g("div", Ci, [
1447
+ ne("div", Mi, [
1448
+ ne("span", Ii, [
1449
+ q(K(Xn), { size: 16 }),
1450
+ m[2] || (m[2] = Le(" 目录 ", -1))
1450
1451
  ]),
1451
- Z("button", {
1452
+ ne("button", {
1452
1453
  class: "catalog__icon-btn",
1453
1454
  title: "收起目录",
1454
- onClick: s[1] || (s[1] = (m) => l.value = !0)
1455
+ onClick: m[1] || (m[1] = (y) => l.value = !0)
1455
1456
  }, [
1456
- K(j(Yn), { size: 18 })
1457
+ q(K(Yn), { size: 18 })
1457
1458
  ])
1458
1459
  ]),
1459
- Z("div", Ei, [
1460
- (u(!0), p(U, null, X(t.items, (m) => (u(), Me(ki, {
1461
- key: m.nodeId,
1462
- item: m,
1460
+ ne("div", Ei, [
1461
+ (u(!0), g(G, null, Q(t.items, (y) => (u(), Fe(ki, {
1462
+ key: y.nodeId,
1463
+ item: y,
1463
1464
  "active-id": o.value,
1464
- onNavigate: r
1465
+ onNavigate: s
1465
1466
  }, null, 8, ["item", "active-id"]))), 128)),
1466
- t.items.length ? pe("", !0) : (u(), p("div", Si, " 暂无目录 "))
1467
+ t.items.length ? ve("", !0) : (u(), g("div", Si, " 暂无目录 "))
1467
1468
  ])
1468
1469
  ]));
1469
1470
  }
1470
- }, Fi = /* @__PURE__ */ De(Ti, [["__scopeId", "data-v-8becafa1"]]), Ai = {
1471
+ }, Ti = /* @__PURE__ */ Ne(Fi, [["__scopeId", "data-v-8becafa1"]]), Ai = {
1471
1472
  first: 1,
1472
1473
  second: 2,
1473
1474
  third: 3,
@@ -1481,23 +1482,23 @@ function Pi(t) {
1481
1482
  function $i(t) {
1482
1483
  const e = [];
1483
1484
  for (const o of t || []) {
1484
- const r = Pi(o);
1485
- r && e.push({
1485
+ const s = Pi(o);
1486
+ s && e.push({
1486
1487
  id: o.node_id,
1487
1488
  nodeId: o.node_id,
1488
1489
  name: (o.content || "").trim(),
1489
- level: r,
1490
+ level: s,
1490
1491
  children: []
1491
1492
  });
1492
1493
  }
1493
1494
  if (!e.length) return [];
1494
- const n = (o, r) => {
1495
- const y = r.children[r.children.length - 1];
1496
- y && o.level > y.level ? n(o, y) : r.children.push(o);
1495
+ const n = (o, s) => {
1496
+ const v = s.children[s.children.length - 1];
1497
+ v && o.level > v.level ? n(o, v) : s.children.push(o);
1497
1498
  }, l = [];
1498
1499
  for (const o of e) {
1499
- const r = l[l.length - 1];
1500
- r && o.level > r.level ? n(o, r) : l.push(o);
1500
+ const s = l[l.length - 1];
1501
+ s && o.level > s.level ? n(o, s) : l.push(o);
1501
1502
  }
1502
1503
  return l;
1503
1504
  }
@@ -1511,31 +1512,31 @@ const Li = {
1511
1512
  seventh: 6,
1512
1513
  eighth: 7
1513
1514
  };
1514
- function nt(t, e) {
1515
+ function lt(t, e) {
1515
1516
  let n = "", l = t;
1516
1517
  const o = e ? 65 : 97;
1517
1518
  for (; l > 0; ) {
1518
- const r = (l - 1) % 26;
1519
- n = String.fromCharCode(o + r) + n, l = Math.floor((l - 1) / 26);
1519
+ const s = (l - 1) % 26;
1520
+ n = String.fromCharCode(o + s) + n, l = Math.floor((l - 1) / 26);
1520
1521
  }
1521
1522
  return n;
1522
1523
  }
1523
- const Lt = [
1524
+ const Bt = [
1524
1525
  (t) => t.toString(),
1525
1526
  // first:数字
1526
- (t) => nt(t, !0),
1527
+ (t) => lt(t, !0),
1527
1528
  // second:大写字母
1528
1529
  (t) => `(${t})`,
1529
1530
  // third:括号数字
1530
- (t) => `(${nt(t, !1)})`,
1531
+ (t) => `(${lt(t, !1)})`,
1531
1532
  // fourth:括号小写字母
1532
1533
  (t) => `${t})`,
1533
1534
  // fifth:数字+右括号
1534
- (t) => `${nt(t, !1)})`,
1535
+ (t) => `${lt(t, !1)})`,
1535
1536
  // sixth:小写字母+右括号
1536
1537
  (t) => `<${t}>`,
1537
1538
  // seventh:数字+尖括号
1538
- (t) => `<${nt(t, !1)}>`
1539
+ (t) => `<${lt(t, !1)}>`
1539
1540
  // eighth:小写字母+尖括号
1540
1541
  ];
1541
1542
  function Ri() {
@@ -1545,22 +1546,22 @@ function Ri() {
1545
1546
  const l = Li[e];
1546
1547
  if (l == null) return "";
1547
1548
  t[l]++;
1548
- for (let r = l + 1; r < t.length; r++) t[r] = 0;
1549
+ for (let s = l + 1; s < t.length; s++) t[s] = 0;
1549
1550
  if (n != null && n !== "")
1550
1551
  return `${n} `;
1551
- const o = Lt[Math.min(l, Lt.length - 1)];
1552
+ const o = Bt[Math.min(l, Bt.length - 1)];
1552
1553
  return `${o(t[l])}. `;
1553
1554
  }
1554
1555
  };
1555
1556
  }
1556
- const Ue = 14, Jt = 760, Rt = 756, Hi = {
1557
+ const We = 14, Yt = 760, Dt = 756, Hi = {
1557
1558
  left: "left",
1558
1559
  center: "center",
1559
1560
  right: "right",
1560
1561
  alignment: "justify",
1561
1562
  justify: "justify"
1562
1563
  };
1563
- function Xt(t) {
1564
+ function Zt(t) {
1564
1565
  const e = [];
1565
1566
  let n = !1;
1566
1567
  const l = (o) => {
@@ -1579,137 +1580,142 @@ function Xt(t) {
1579
1580
  continue;
1580
1581
  }
1581
1582
  if (o && o.type === "area") {
1582
- const r = Xt(o.valueList || []), y = (o.areaId || "").includes("cover");
1583
- for (const s of r) l(s);
1584
- y && (n = !0);
1583
+ const s = Zt(o.valueList || []);
1584
+ if ((o.areaId || "").includes("cover")) {
1585
+ for (const m of s)
1586
+ l({ ...m, _isCover: !0 });
1587
+ n = !0;
1588
+ } else
1589
+ for (const m of s) l(m);
1585
1590
  } else
1586
1591
  l(o);
1587
1592
  }
1588
1593
  return e;
1589
1594
  }
1590
- function We(t) {
1591
- const e = Xt(t), n = [];
1592
- let l = [], o = 0, r = null;
1593
- const y = (m) => {
1594
- l.length && (n.push({ type: "paragraph", elements: [...l], rowFlex: m }), l = []);
1595
- }, s = () => {
1595
+ const Oi = (t) => t == null ? void 0 : t.some((e) => e._isCover);
1596
+ function Ge(t) {
1597
+ const e = Zt(t), n = [];
1598
+ let l = [], o = 0, s = null;
1599
+ const v = (y) => {
1600
+ l.length && (n.push({ type: "paragraph", elements: [...l], rowFlex: y, _isCover: Oi(l) }), l = []);
1601
+ }, m = () => {
1596
1602
  if (o === 0) return;
1597
- const m = r;
1598
- y(m);
1599
- for (let h = 1; h < o; h++)
1600
- n.push({ type: "paragraph", elements: [], rowFlex: m });
1601
- o = 0, r = null;
1603
+ const y = s;
1604
+ v(y);
1605
+ for (let r = 1; r < o; r++)
1606
+ n.push({ type: "paragraph", elements: [], rowFlex: y });
1607
+ o = 0, s = null;
1602
1608
  };
1603
- for (const m of e || [])
1604
- if (m.type === "table")
1605
- s(), y(), n.push({ type: "table", el: m });
1606
- else if (m.type === "title")
1607
- s(), y(), n.push({ type: "title", el: m });
1608
- else if (m.type === "list") {
1609
- s(), y();
1610
- const h = [];
1611
- let S = [];
1612
- for (const F of m.valueList || [])
1613
- F.value === `
1614
- ` || F.value === "​" ? (h.push([...S]), S = []) : S.push(F);
1615
- (S.length || h.length === 0) && h.push([...S]), n.push({ type: "list", listType: m.listType || "ul", listStyle: m.listStyle || "disc", items: h });
1616
- } else if (m.listId) {
1617
- s(), y();
1618
- const h = m.value === "​" || m.value === "" ? [] : [m];
1619
- n.push({ type: "list", listType: m.listType || "ul", listStyle: m.listStyle || "disc", items: [h] });
1620
- } else m.value != null && /^[\n200B]+$/.test(m.value) ? (o += m.value.length, m.rowFlex && (r = m.rowFlex)) : (s(), l.push(m));
1621
- return s(), y(), n;
1609
+ for (const y of e || [])
1610
+ if (y.type === "table")
1611
+ m(), v(), n.push({ type: "table", el: y, _isCover: !!y._isCover });
1612
+ else if (y.type === "title")
1613
+ m(), v(), n.push({ type: "title", el: y, _isCover: !!y._isCover });
1614
+ else if (y.type === "list") {
1615
+ m(), v();
1616
+ const r = [];
1617
+ let M = [];
1618
+ for (const x of y.valueList || [])
1619
+ x.value === `
1620
+ ` || x.value === "​" ? (r.push([...M]), M = []) : M.push(x);
1621
+ (M.length || r.length === 0) && r.push([...M]), n.push({ type: "list", listType: y.listType || "ul", listStyle: y.listStyle || "disc", items: r });
1622
+ } else if (y.listId) {
1623
+ m(), v();
1624
+ const r = y.value === "​" || y.value === "" ? [] : [y];
1625
+ n.push({ type: "list", listType: y.listType || "ul", listStyle: y.listStyle || "disc", items: [r] });
1626
+ } else y.value != null && /^[\n200B]+$/.test(y.value) ? (o += y.value.length, y.rowFlex && (s = y.rowFlex)) : (m(), l.push(y));
1627
+ return m(), v(), n;
1622
1628
  }
1623
- function Be(t) {
1624
- const e = t.filter((h) => h.type === "image").reduce((h, S) => h + (S.height || S.width || 0), 0), n = t.filter((h) => h.type !== "image").map((h) => h.value || "").join("");
1629
+ function ze(t) {
1630
+ const e = t.filter((r) => r.type === "image").reduce((r, M) => r + (M.height || M.width || 0), 0), n = t.filter((r) => r.type !== "image").map((r) => r.value || "").join("");
1625
1631
  if (!n) return e || 20;
1626
- const l = t.reduce((h, S) => Math.max(h, S.size || 0), 0) || 14, o = l + 6, r = (n.match(/[一-龥]/g) || []).length, y = n.length - r, s = r * l + y * (l * 0.5), m = Math.max(1, Math.ceil(s / Jt));
1627
- return e + Math.max(o, m * o);
1632
+ const l = t.reduce((r, M) => Math.max(r, M.size || 0), 0) || 14, o = l + 6, s = (n.match(/[一-龥]/g) || []).length, v = n.length - s, m = s * l + v * (l * 0.5), y = Math.max(1, Math.ceil(m / Yt));
1633
+ return e + Math.max(o, y * o);
1628
1634
  }
1629
- function Oi(t) {
1635
+ function Bi(t) {
1630
1636
  if (!t || !t.length) return [[]];
1631
1637
  const e = [];
1632
1638
  let n = [];
1633
1639
  for (const l of t)
1634
- l.type === "image" && (l.width || 0) >= Jt ? (n.length && (e.push(n), n = []), e.push([l])) : n.push(l);
1640
+ l.type === "image" && (l.width || 0) >= Yt ? (n.length && (e.push(n), n = []), e.push([l])) : n.push(l);
1635
1641
  return n.length && e.push(n), e.length ? e : [[]];
1636
1642
  }
1637
- function Ht(t) {
1643
+ function zt(t) {
1638
1644
  if (t.length === 0) return [];
1639
1645
  const e = new Array(t.length).fill(0);
1640
- t.forEach((r, y) => {
1641
- (r.tdList || []).forEach((s) => {
1642
- const m = s.rowspan || 1;
1643
- if (m > 1) {
1644
- const h = Math.min(y + m - 1, t.length - 1);
1645
- e[y] = Math.max(e[y], h);
1646
- for (let S = 1; S < m && y + S < t.length; S++)
1647
- e[y + S] = Math.max(e[y + S], h);
1646
+ t.forEach((s, v) => {
1647
+ (s.tdList || []).forEach((m) => {
1648
+ const y = m.rowspan || 1;
1649
+ if (y > 1) {
1650
+ const r = Math.min(v + y - 1, t.length - 1);
1651
+ e[v] = Math.max(e[v], r);
1652
+ for (let M = 1; M < y && v + M < t.length; M++)
1653
+ e[v + M] = Math.max(e[v + M], r);
1648
1654
  }
1649
1655
  });
1650
1656
  });
1651
1657
  const n = [];
1652
1658
  let l = 0, o = 0;
1653
- for (let r = 0; r < t.length; r++)
1654
- o = Math.max(o, e[r]), o <= r && (n.push(t.slice(l, r + 1)), l = r + 1, o = 0);
1659
+ for (let s = 0; s < t.length; s++)
1660
+ o = Math.max(o, e[s]), o <= s && (n.push(t.slice(l, s + 1)), l = s + 1, o = 0);
1655
1661
  return l < t.length && n.push(t.slice(l)), n;
1656
1662
  }
1657
- function ht(t) {
1663
+ function gt(t) {
1658
1664
  const e = (t == null ? void 0 : t.width) || 0;
1659
- return !e || e <= Rt ? 1 : Rt / e;
1665
+ return !e || e <= Dt ? 1 : Dt / e;
1660
1666
  }
1661
- function Ot(t) {
1662
- var r, y;
1663
- const e = t.elements || [], n = ((r = e.find((s) => s.rowFlex)) == null ? void 0 : r.rowFlex) || t.rowFlex, l = { textAlign: Hi[n] || "left" }, o = (y = e.find((s) => s.rowMargin)) == null ? void 0 : y.rowMargin;
1667
+ function Nt(t) {
1668
+ var s, v;
1669
+ const e = t.elements || [], n = ((s = e.find((m) => m.rowFlex)) == null ? void 0 : s.rowFlex) || t.rowFlex, l = { textAlign: Hi[n] || "left" }, o = (v = e.find((m) => m.rowMargin)) == null ? void 0 : v.rowMargin;
1664
1670
  return o && (l.lineHeight = o), l;
1665
1671
  }
1666
- function Bi(t) {
1667
- var r;
1668
- const e = We(t.value);
1672
+ function Di(t) {
1673
+ var s;
1674
+ const e = Ge(t.value);
1669
1675
  let n = 0, l = 0, o = !1;
1670
- for (const y of e)
1671
- if (y.type === "paragraph") {
1672
- if (!y.elements.length) continue;
1676
+ for (const v of e)
1677
+ if (v.type === "paragraph") {
1678
+ if (!v.elements.length) continue;
1673
1679
  n++;
1674
- for (const s of y.elements)
1675
- (s.type === "image" || s.type === "table") && (o = !0), l += (s.value || "").length;
1676
- } else y.type === "list" ? (n += ((r = y.items) == null ? void 0 : r.length) || 1, o = !0) : (n++, o = !0);
1680
+ for (const m of v.elements)
1681
+ (m.type === "image" || m.type === "table") && (o = !0), l += (m.value || "").length;
1682
+ } else v.type === "list" ? (n += ((s = v.items) == null ? void 0 : s.length) || 1, o = !0) : (n++, o = !0);
1677
1683
  return n > 1 || l > 30 || o ? "top" : t.verticalAlign || "middle";
1678
1684
  }
1679
- function ve(t) {
1685
+ function _e(t) {
1680
1686
  const e = {};
1681
- t.font && (e.fontFamily = t.font), e.fontSize = (t.size || Ue) + "px", t.bold != null && (e.fontWeight = t.bold ? "bold" : "normal"), t.italic != null && (e.fontStyle = t.italic ? "italic" : "normal"), t.color && (e.color = t.color), t.highlight && t.highlight !== "rgb(255, 255, 255)" && t.highlight !== "#ffffff" && (e.backgroundColor = t.highlight);
1687
+ t.font && (e.fontFamily = t.font), e.fontSize = (t.size || We) + "px", t.bold != null && (e.fontWeight = t.bold ? "bold" : "normal"), t.italic != null && (e.fontStyle = t.italic ? "italic" : "normal"), t.color && (e.color = t.color), t.highlight && t.highlight !== "rgb(255, 255, 255)" && t.highlight !== "#ffffff" && (e.backgroundColor = t.highlight);
1682
1688
  const n = [t.underline && "underline", t.strikeout && "line-through"].filter(Boolean).join(" ");
1683
1689
  return n && (e.textDecoration = n), t.letterSpacing && (e.letterSpacing = t.letterSpacing + "px"), e;
1684
1690
  }
1685
- const Di = 5;
1686
- function Bt(t, e = !1) {
1691
+ const zi = 5;
1692
+ function Vt(t, e = !1) {
1687
1693
  var l, o;
1688
1694
  let n = 0;
1689
- for (const r of t)
1690
- if (r.type === "table") {
1691
- const y = ((l = r.el) == null ? void 0 : l.trList) || [];
1692
- n += y.reduce((s, m) => s + (m.height || m.minHeight || 35), 0);
1693
- } else if (r.type === "title")
1694
- n += Be(r.titleValueList || ((o = r.el) == null ? void 0 : o.valueList) || []);
1695
- else if (r.type === "paragraph")
1696
- n += Be(r.elements || []);
1697
- else if (r.type === "list") {
1698
- const y = Math.round(18), s = (r.items || []).reduce(
1699
- (m, h) => m + (h.length ? Be(h) : y),
1695
+ for (const s of t)
1696
+ if (s.type === "table") {
1697
+ const v = ((l = s.el) == null ? void 0 : l.trList) || [];
1698
+ n += v.reduce((m, y) => m + (y.height || y.minHeight || 35), 0);
1699
+ } else if (s.type === "title")
1700
+ n += ze(s.titleValueList || ((o = s.el) == null ? void 0 : o.valueList) || []);
1701
+ else if (s.type === "paragraph")
1702
+ n += ze(s.elements || []);
1703
+ else if (s.type === "list") {
1704
+ const v = Math.round(18), m = (s.items || []).reduce(
1705
+ (y, r) => y + (r.length ? ze(r) : v),
1700
1706
  0
1701
1707
  );
1702
- n += Math.max(s, y);
1708
+ n += Math.max(m, v);
1703
1709
  }
1704
- return n + (e && n > 0 ? Di : 0);
1710
+ return n + (e && n > 0 ? zi : 0);
1705
1711
  }
1706
- const zi = {
1712
+ const Ni = {
1707
1713
  key: 0,
1708
1714
  class: "empty-line"
1709
- }, Ni = ["href"], Vi = ["src"], ji = ["checked"], Ki = ["checked"], qi = {
1715
+ }, Vi = ["href"], ji = ["src"], Ki = ["checked"], Ui = ["checked"], qi = {
1710
1716
  key: 4,
1711
1717
  class: "ctrl-input"
1712
- }, Ui = ["checked"], Wi = ["checked"], Gi = { key: 0 }, Ji = ["colspan", "rowspan"], Xi = { key: 0 }, Yi = ["src"], Zi = ["href"], Qi = ["checked"], el = ["checked"], tl = ["checked"], nl = {
1718
+ }, Wi = ["checked"], Gi = ["checked"], Ji = { key: 0 }, Xi = ["colspan", "rowspan"], Yi = { key: 0 }, Zi = ["src"], Qi = ["href"], el = ["checked"], tl = ["checked"], nl = ["checked"], il = {
1713
1719
  __name: "DocBlock",
1714
1720
  props: {
1715
1721
  block: {
@@ -1722,297 +1728,306 @@ const zi = {
1722
1728
  }
1723
1729
  },
1724
1730
  setup(t) {
1725
- const e = t, n = jt("bindTableObserver", null), l = re(() => e.isHeaderFooter ? 0 : e.block.indentPx ?? 0);
1726
- return (o, r) => {
1731
+ const e = t, n = mt("bindTableObserver", null), l = mt("resolveImageUrl", null);
1732
+ function o(v) {
1733
+ if (!v) return "";
1734
+ const m = (l == null ? void 0 : l.value) || l;
1735
+ return typeof m == "function" ? m(v) : v;
1736
+ }
1737
+ const s = de(() => e.isHeaderFooter ? 0 : e.block.indentPx ?? 0);
1738
+ return (v, m) => {
1727
1739
  var y;
1728
- return t.block.blockType === "title" ? (u(), p("p", {
1740
+ return t.block.blockType === "title" ? (u(), g("p", {
1729
1741
  key: 0,
1730
- class: Fe(["doc-title", `doc-title--${t.block.level}`]),
1731
- style: N({ paddingLeft: l.value ? l.value + "px" : void 0 })
1742
+ class: Pe(["doc-title", `doc-title--${t.block.level}`]),
1743
+ style: V({ paddingLeft: s.value ? s.value + "px" : void 0 })
1732
1744
  }, [
1733
- (u(!0), p(U, null, X(t.block.titleValueList || [], (s, m) => (u(), p("span", {
1734
- key: m,
1735
- style: N(j(ve)(s))
1736
- }, G(s.value), 5))), 128))
1737
- ], 6)) : t.block.blockType === "paragraph" ? (u(), p("p", {
1745
+ (u(!0), g(G, null, Q(t.block.titleValueList || [], (r, M) => (u(), g("span", {
1746
+ key: M,
1747
+ style: V(K(_e)(r))
1748
+ }, Y(r.value), 5))), 128))
1749
+ ], 6)) : t.block.blockType === "paragraph" ? (u(), g("p", {
1738
1750
  key: 1,
1739
1751
  class: "doc-para",
1740
- style: N({ ...j(Ot)(t.block), paddingLeft: l.value ? l.value + "px" : void 0 })
1752
+ style: V({ ...K(Nt)(t.block), paddingLeft: s.value ? s.value + "px" : void 0 })
1741
1753
  }, [
1742
- t.block.elements.length ? pe("", !0) : (u(), p("span", zi, " ")),
1743
- (u(!0), p(U, null, X(t.block.elements, (s, m) => {
1744
- var h, S, F, O, _, q, ie, B, A, f, M, $, E;
1745
- return u(), p(U, { key: m }, [
1746
- !s.type || s.type === "text" ? (u(), p("span", {
1754
+ t.block.elements.length ? ve("", !0) : (u(), g("span", Ni, " ")),
1755
+ (u(!0), g(G, null, Q(t.block.elements, (r, M) => {
1756
+ var x, $, B, W, I, D, T, h, F, P, E, X, ue;
1757
+ return u(), g(G, { key: M }, [
1758
+ !r.type || r.type === "text" ? (u(), g("span", {
1747
1759
  key: 0,
1748
- style: N(j(ve)(s))
1749
- }, G(s.value), 5)) : s.type === "hyperlink" ? (u(), p("a", {
1760
+ style: V(K(_e)(r))
1761
+ }, Y(r.value), 5)) : r.type === "hyperlink" ? (u(), g("a", {
1750
1762
  key: 1,
1751
- href: s.url,
1763
+ href: r.url,
1752
1764
  class: "doc-link",
1753
1765
  target: "_blank",
1754
1766
  rel: "noopener"
1755
1767
  }, [
1756
- (u(!0), p(U, null, X(s.valueList || [], (L, Y) => (u(), p("span", {
1757
- key: Y,
1758
- style: N(j(ve)(L))
1759
- }, G(L.value), 5))), 128))
1760
- ], 8, Ni)) : s.type === "image" ? (u(), p("img", {
1768
+ (u(!0), g(G, null, Q(r.valueList || [], (z, ie) => (u(), g("span", {
1769
+ key: ie,
1770
+ style: V(K(_e)(z))
1771
+ }, Y(z.value), 5))), 128))
1772
+ ], 8, Vi)) : r.type === "image" ? (u(), g("img", {
1761
1773
  key: 2,
1762
- src: s.value,
1774
+ src: o(r.value),
1763
1775
  class: "doc-image",
1764
- style: N({
1765
- width: s.width ? s.width + "px" : "auto",
1766
- height: s.height ? s.height + "px" : "auto"
1776
+ style: V({
1777
+ width: r.width ? r.width + "px" : "auto",
1778
+ height: r.height ? r.height + "px" : "auto"
1767
1779
  })
1768
- }, null, 12, Vi)) : s.type === "control" ? (u(), p(U, { key: 3 }, [
1769
- ((h = s.control) == null ? void 0 : h.type) === "text" ? (u(), p("span", {
1780
+ }, null, 12, ji)) : r.type === "control" ? (u(), g(G, { key: 3 }, [
1781
+ ((x = r.control) == null ? void 0 : x.type) === "text" ? (u(), g("span", {
1770
1782
  key: 0,
1771
- style: N({ fontSize: (s.control.size || 12) + "px" })
1783
+ style: V({ fontSize: (r.control.size || 12) + "px" })
1772
1784
  }, [
1773
- (u(!0), p(U, null, X(s.control.value || [], (L, Y) => (u(), p("span", {
1774
- key: Y,
1775
- style: N(j(ve)(L))
1776
- }, G(L.value), 5))), 128))
1777
- ], 4)) : ((S = s.control) == null ? void 0 : S.type) === "input" ? (u(), p("span", {
1785
+ (u(!0), g(G, null, Q(r.control.value || [], (z, ie) => (u(), g("span", {
1786
+ key: ie,
1787
+ style: V(K(_e)(z))
1788
+ }, Y(z.value), 5))), 128))
1789
+ ], 4)) : (($ = r.control) == null ? void 0 : $.type) === "input" ? (u(), g("span", {
1778
1790
  key: 1,
1779
1791
  class: "ctrl-input",
1780
- style: N({
1781
- minWidth: (s.control.minWidth || 60) + "px",
1782
- fontSize: (s.control.size || 12) + "px"
1792
+ style: V({
1793
+ minWidth: (r.control.minWidth || 60) + "px",
1794
+ fontSize: (r.control.size || 12) + "px"
1783
1795
  })
1784
1796
  }, [
1785
- (u(!0), p(U, null, X(s.control.value || [], (L, Y) => (u(), p("span", { key: Y }, G(L.value), 1))), 128))
1786
- ], 4)) : ((F = s.control) == null ? void 0 : F.type) === "radio" ? (u(), p("span", {
1797
+ (u(!0), g(G, null, Q(r.control.value || [], (z, ie) => (u(), g("span", { key: ie }, Y(z.value), 1))), 128))
1798
+ ], 4)) : ((B = r.control) == null ? void 0 : B.type) === "radio" ? (u(), g("span", {
1787
1799
  key: 2,
1788
- class: Fe(["ctrl-options", { "ctrl-options--vertical": ((_ = (O = s.control.extension) == null ? void 0 : O.elementAttributes) == null ? void 0 : _.layout) === "vertical" }]),
1789
- style: N({ fontSize: (s.control.size || j(Ue)) + "px" })
1800
+ class: Pe(["ctrl-options", { "ctrl-options--vertical": ((I = (W = r.control.extension) == null ? void 0 : W.elementAttributes) == null ? void 0 : I.layout) === "vertical" }]),
1801
+ style: V({ fontSize: (r.control.size || K(We)) + "px" })
1790
1802
  }, [
1791
- (u(!0), p(U, null, X(s.control.valueSets || [], (L, Y) => (u(), p("label", {
1792
- key: Y,
1803
+ (u(!0), g(G, null, Q(r.control.valueSets || [], (z, ie) => (u(), g("label", {
1804
+ key: ie,
1793
1805
  class: "ctrl-option"
1794
1806
  }, [
1795
- Z("input", {
1807
+ ne("input", {
1796
1808
  type: "radio",
1797
1809
  disabled: "",
1798
- checked: s.control.code === L.code
1799
- }, null, 8, ji),
1800
- Oe(" " + G(L.value), 1)
1810
+ checked: r.control.code === z.code
1811
+ }, null, 8, Ki),
1812
+ Le(" " + Y(z.value), 1)
1801
1813
  ]))), 128))
1802
- ], 6)) : ((q = s.control) == null ? void 0 : q.type) === "checkbox" ? (u(), p("span", {
1814
+ ], 6)) : ((D = r.control) == null ? void 0 : D.type) === "checkbox" ? (u(), g("span", {
1803
1815
  key: 3,
1804
- class: Fe(["ctrl-options", { "ctrl-options--vertical": ((B = (ie = s.control.extension) == null ? void 0 : ie.elementAttributes) == null ? void 0 : B.layout) === "vertical" }]),
1805
- style: N({ fontSize: (s.control.size || j(Ue)) + "px" })
1816
+ class: Pe(["ctrl-options", { "ctrl-options--vertical": ((h = (T = r.control.extension) == null ? void 0 : T.elementAttributes) == null ? void 0 : h.layout) === "vertical" }]),
1817
+ style: V({ fontSize: (r.control.size || K(We)) + "px" })
1806
1818
  }, [
1807
- (u(!0), p(U, null, X(s.control.valueSets || [], (L, Y) => (u(), p("label", {
1808
- key: Y,
1819
+ (u(!0), g(G, null, Q(r.control.valueSets || [], (z, ie) => (u(), g("label", {
1820
+ key: ie,
1809
1821
  class: "ctrl-option"
1810
1822
  }, [
1811
- Z("input", {
1823
+ ne("input", {
1812
1824
  type: "checkbox",
1813
1825
  disabled: "",
1814
- checked: (s.control.code || "").split(",").includes(L.code)
1815
- }, null, 8, Ki),
1816
- Oe(" " + G(L.value), 1)
1826
+ checked: (r.control.code || "").split(",").includes(z.code)
1827
+ }, null, 8, Ui),
1828
+ Le(" " + Y(z.value), 1)
1817
1829
  ]))), 128))
1818
- ], 6)) : ((A = s.control) == null ? void 0 : A.type) === "select" ? (u(), p("span", qi, G(((M = (f = s.control.value) == null ? void 0 : f[0]) == null ? void 0 : M.value) || s.control.placeholder || ""), 1)) : pe("", !0)
1819
- ], 64)) : s.type === "checkbox" ? (u(), p("input", {
1830
+ ], 6)) : ((F = r.control) == null ? void 0 : F.type) === "select" ? (u(), g("span", qi, Y(((E = (P = r.control.value) == null ? void 0 : P[0]) == null ? void 0 : E.value) || r.control.placeholder || ""), 1)) : ve("", !0)
1831
+ ], 64)) : r.type === "checkbox" ? (u(), g("input", {
1820
1832
  key: 4,
1821
1833
  type: "checkbox",
1822
- checked: !!(($ = s.checkbox) != null && $.value),
1834
+ checked: !!((X = r.checkbox) != null && X.value),
1823
1835
  disabled: "",
1824
1836
  class: "el-check"
1825
- }, null, 8, Ui)) : s.type === "radio" ? (u(), p("input", {
1837
+ }, null, 8, Wi)) : r.type === "radio" ? (u(), g("input", {
1826
1838
  key: 5,
1827
1839
  type: "radio",
1828
- checked: !!((E = s.radio) != null && E.value),
1840
+ checked: !!((ue = r.radio) != null && ue.value),
1829
1841
  disabled: "",
1830
1842
  class: "el-check"
1831
- }, null, 8, Wi)) : s.type === "superscript" ? (u(), p("sup", {
1843
+ }, null, 8, Gi)) : r.type === "superscript" ? (u(), g("sup", {
1832
1844
  key: 6,
1833
- style: N(j(ve)(s))
1834
- }, G(s.value), 5)) : s.type === "subscript" ? (u(), p("sub", {
1845
+ style: V(K(_e)(r))
1846
+ }, Y(r.value), 5)) : r.type === "subscript" ? (u(), g("sub", {
1835
1847
  key: 7,
1836
- style: N(j(ve)(s))
1837
- }, G(s.value), 5)) : s.type === "tab" ? (u(), p("span", {
1848
+ style: V(K(_e)(r))
1849
+ }, Y(r.value), 5)) : r.type === "tab" ? (u(), g("span", {
1838
1850
  key: 8,
1839
1851
  class: "doc-tab",
1840
- style: N({ width: (s.size || j(Ue)) + "px" })
1841
- }, null, 4)) : pe("", !0)
1852
+ style: V({ width: (r.size || K(We)) + "px" })
1853
+ }, null, 4)) : ve("", !0)
1842
1854
  ], 64);
1843
1855
  }), 128))
1844
- ], 4)) : t.block.blockType === "list" ? (u(), Me(lt(t.block.listType === "ol" ? "ol" : "ul"), {
1856
+ ], 4)) : t.block.blockType === "list" ? (u(), Fe(at(t.block.listType === "ol" ? "ol" : "ul"), {
1845
1857
  key: 2,
1846
1858
  class: "doc-list",
1847
- style: N({ listStyleType: t.block.listStyle === "decimal" ? "decimal" : t.block.listStyle === "lower-alpha" ? "lower-alpha" : "disc", paddingLeft: l.value ? l.value + 24 + "px" : void 0 })
1859
+ style: V({ listStyleType: t.block.listStyle === "decimal" ? "decimal" : t.block.listStyle === "lower-alpha" ? "lower-alpha" : "disc", paddingLeft: s.value ? s.value + 24 + "px" : void 0 })
1848
1860
  }, {
1849
1861
  default: qe(() => [
1850
- (u(!0), p(U, null, X(t.block.items, (s, m) => (u(), p("li", {
1851
- key: m,
1862
+ (u(!0), g(G, null, Q(t.block.items, (r, M) => (u(), g("li", {
1863
+ key: M,
1852
1864
  class: "doc-list-item"
1853
1865
  }, [
1854
- (u(!0), p(U, null, X(s, (h, S) => (u(), p(U, { key: S }, [
1855
- !h.type || h.type === "text" ? (u(), p("span", {
1866
+ (u(!0), g(G, null, Q(r, (x, $) => (u(), g(G, { key: $ }, [
1867
+ !x.type || x.type === "text" ? (u(), g("span", {
1856
1868
  key: 0,
1857
- style: N(j(ve)(h))
1858
- }, G(h.value), 5)) : h.type === "superscript" ? (u(), p("sup", {
1869
+ style: V(K(_e)(x))
1870
+ }, Y(x.value), 5)) : x.type === "superscript" ? (u(), g("sup", {
1859
1871
  key: 1,
1860
- style: N(j(ve)(h))
1861
- }, G(h.value), 5)) : h.type === "subscript" ? (u(), p("sub", {
1872
+ style: V(K(_e)(x))
1873
+ }, Y(x.value), 5)) : x.type === "subscript" ? (u(), g("sub", {
1862
1874
  key: 2,
1863
- style: N(j(ve)(h))
1864
- }, G(h.value), 5)) : pe("", !0)
1875
+ style: V(K(_e)(x))
1876
+ }, Y(x.value), 5)) : ve("", !0)
1865
1877
  ], 64))), 128))
1866
1878
  ]))), 128))
1867
1879
  ]),
1868
1880
  _: 1
1869
- }, 8, ["style"])) : t.block.blockType === "table-row-group" ? (u(), p("div", {
1881
+ }, 8, ["style"])) : t.block.blockType === "table-row-group" ? (u(), g("div", {
1870
1882
  key: 3,
1871
- class: Fe(["doc-table-row-wrap", { "is-first": t.block.isFirst, "is-last": t.block.isLast, "is-page-break": t.block.isPageBreak }]),
1872
- style: N({
1883
+ class: Pe(["doc-table-row-wrap", { "is-first": t.block.isFirst, "is-last": t.block.isLast, "is-page-break": t.block.isPageBreak }]),
1884
+ style: V({
1873
1885
  display: t.block.tableRowFlex ? "flex" : void 0,
1874
1886
  justifyContent: t.block.tableRowFlex === "right" ? "flex-end" : t.block.tableRowFlex === "center" ? "center" : t.block.tableRowFlex === "left" ? "flex-start" : void 0,
1875
- paddingLeft: l.value ? l.value + "px" : void 0
1887
+ paddingLeft: s.value ? s.value + "px" : void 0
1876
1888
  })
1877
1889
  }, [
1878
- Z("div", {
1879
- style: N({
1890
+ ne("div", {
1891
+ style: V({
1880
1892
  overflow: t.block.sliceHeight != null ? "hidden" : void 0,
1881
1893
  height: t.block.sliceHeight != null ? (t.block.isLast ? t.block.sliceHeight + 1 : t.block.sliceHeight) + "px" : void 0,
1882
1894
  width: t.block.tableEl.width ? "max-content" : "100%"
1883
1895
  })
1884
1896
  }, [
1885
- Z("table", {
1886
- ref: t.block._baseKey && j(n) ? (s) => j(n)(s, t.block._baseKey) : void 0,
1887
- class: Fe(["doc-table", { "doc-table--no-border": t.block.tableEl.borderType === "empty", "doc-table--header-footer": t.isHeaderFooter }]),
1888
- style: N({
1889
- width: t.block.tableEl.width ? (t.isHeaderFooter ? t.block.tableEl.width : t.block.tableEl.width * j(ht)(t.block.tableEl)) + "px" : "100%",
1897
+ ne("table", {
1898
+ ref: t.block._baseKey && K(n) ? (r) => K(n)(r, t.block._baseKey) : void 0,
1899
+ class: Pe(["doc-table", { "doc-table--no-border": t.block.tableEl.borderType === "empty", "doc-table--header-footer": t.isHeaderFooter }]),
1900
+ style: V({
1901
+ width: t.block.tableEl.width ? (t.isHeaderFooter ? t.block.tableEl.width : t.block.tableEl.width * K(gt)(t.block.tableEl)) + "px" : "100%",
1890
1902
  transform: t.block.sliceOffset ? `translateY(-${t.block.sliceOffset}px)` : void 0
1891
1903
  })
1892
1904
  }, [
1893
- (y = t.block.tableEl.colgroup) != null && y.length ? (u(), p("colgroup", Gi, [
1894
- (u(!0), p(U, null, X(t.block.tableEl.colgroup, (s, m) => (u(), p("col", {
1895
- key: m,
1896
- style: N({ width: (t.isHeaderFooter ? s.width : s.width * j(ht)(t.block.tableEl)) + "px" })
1905
+ (y = t.block.tableEl.colgroup) != null && y.length ? (u(), g("colgroup", Ji, [
1906
+ (u(!0), g(G, null, Q(t.block.tableEl.colgroup, (r, M) => (u(), g("col", {
1907
+ key: M,
1908
+ style: V({ width: (t.isHeaderFooter ? r.width : r.width * K(gt)(t.block.tableEl)) + "px" })
1897
1909
  }, null, 4))), 128))
1898
- ])) : pe("", !0),
1899
- Z("tbody", null, [
1900
- (u(!0), p(U, null, X(t.block.trGroup, (s, m) => (u(), p("tr", {
1901
- key: m,
1902
- style: N({ height: (s.height || s.minHeight || 30) + "px" })
1910
+ ])) : ve("", !0),
1911
+ ne("tbody", null, [
1912
+ (u(!0), g(G, null, Q(t.block.trGroup, (r, M) => (u(), g("tr", {
1913
+ key: M,
1914
+ style: V({ height: (r.height || r.minHeight || 30) + "px" })
1903
1915
  }, [
1904
- (u(!0), p(U, null, X(s.tdList || [], (h, S) => (u(), p("td", {
1905
- key: S,
1906
- colspan: h.colspan || 1,
1907
- rowspan: h.rowspan || 1,
1908
- style: N({
1909
- backgroundColor: h.backgroundColor || void 0,
1910
- verticalAlign: j(Bi)(h),
1911
- width: h.width ? h.width * j(ht)(t.block.tableEl) + "px" : void 0,
1912
- height: h.height ? h.height + "px" : void 0
1916
+ (u(!0), g(G, null, Q(r.tdList || [], (x, $) => (u(), g("td", {
1917
+ key: $,
1918
+ colspan: x.colspan || 1,
1919
+ rowspan: x.rowspan || 1,
1920
+ style: V({
1921
+ backgroundColor: x.backgroundColor || void 0,
1922
+ verticalAlign: K(Di)(x),
1923
+ width: x.width ? x.width * K(gt)(t.block.tableEl) + "px" : void 0,
1924
+ height: x.height ? x.height + "px" : void 0
1913
1925
  })
1914
1926
  }, [
1915
- (u(!0), p(U, null, X(j(We)(h.value), (F, O) => (u(), p(U, { key: O }, [
1916
- F.type === "paragraph" ? (u(), p("p", {
1927
+ (u(!0), g(G, null, Q(K(Ge)(x.value), (B, W) => (u(), g(G, { key: W }, [
1928
+ B.type === "paragraph" ? (u(), g("p", {
1917
1929
  key: 0,
1918
1930
  class: "cell-para",
1919
- style: N(j(Ot)(F))
1931
+ style: V(K(Nt)(B))
1920
1932
  }, [
1921
- F.elements.length ? pe("", !0) : (u(), p("span", Xi, " ")),
1922
- (u(!0), p(U, null, X(F.elements, (_, q) => {
1923
- var ie, B, A, f, M, $, E;
1924
- return u(), p(U, { key: q }, [
1925
- !_.type || _.type === "text" ? (u(), p("span", {
1933
+ B.elements.length ? ve("", !0) : (u(), g("span", Yi, " ")),
1934
+ (u(!0), g(G, null, Q(B.elements, (I, D) => {
1935
+ var T, h, F, P, E, X, ue;
1936
+ return u(), g(G, { key: D }, [
1937
+ !I.type || I.type === "text" ? (u(), g("span", {
1926
1938
  key: 0,
1927
- style: N(j(ve)(_))
1928
- }, G(_.value), 5)) : _.type === "image" ? (u(), p("img", {
1939
+ style: V(K(_e)(I))
1940
+ }, Y(I.value), 5)) : I.type === "image" ? (u(), g("img", {
1929
1941
  key: 1,
1930
- src: _.value,
1942
+ src: o(I.value),
1931
1943
  class: "doc-image",
1932
- style: N({
1933
- width: _.width ? _.width + "px" : "auto",
1934
- height: _.height ? _.height + "px" : "auto"
1944
+ style: V({
1945
+ width: I.width ? I.width + "px" : "auto",
1946
+ height: I.height ? I.height + "px" : "auto"
1935
1947
  })
1936
- }, null, 12, Yi)) : _.type === "hyperlink" ? (u(), p("a", {
1948
+ }, null, 12, Zi)) : I.type === "hyperlink" ? (u(), g("a", {
1937
1949
  key: 2,
1938
- href: _.url,
1950
+ href: I.url,
1939
1951
  class: "doc-link",
1940
1952
  target: "_blank"
1941
1953
  }, [
1942
- (u(!0), p(U, null, X(_.valueList || [], (L, Y) => (u(), p("span", {
1943
- key: Y,
1944
- style: N(j(ve)(L))
1945
- }, G(L.value), 5))), 128))
1946
- ], 8, Zi)) : _.type === "control" ? (u(), p(U, { key: 3 }, [
1947
- ((ie = _.control) == null ? void 0 : ie.type) === "text" ? (u(), p("span", {
1954
+ (u(!0), g(G, null, Q(I.valueList || [], (z, ie) => (u(), g("span", {
1955
+ key: ie,
1956
+ style: V(K(_e)(z))
1957
+ }, Y(z.value), 5))), 128))
1958
+ ], 8, Qi)) : I.type === "control" ? (u(), g(G, { key: 3 }, [
1959
+ ((T = I.control) == null ? void 0 : T.type) === "text" ? (u(), g("span", {
1948
1960
  key: 0,
1949
- style: N({ fontSize: (_.control.size || 12) + "px" })
1961
+ style: V({ fontSize: (I.control.size || 12) + "px" })
1950
1962
  }, [
1951
- (u(!0), p(U, null, X(_.control.value || [], (L, Y) => (u(), p("span", {
1952
- key: Y,
1953
- style: N(j(ve)(L))
1954
- }, G(L.value), 5))), 128))
1955
- ], 4)) : ((B = _.control) == null ? void 0 : B.type) === "input" ? (u(), p("span", {
1963
+ (u(!0), g(G, null, Q(I.control.value || [], (z, ie) => (u(), g("span", {
1964
+ key: ie,
1965
+ style: V(K(_e)(z))
1966
+ }, Y(z.value), 5))), 128))
1967
+ ], 4)) : ((h = I.control) == null ? void 0 : h.type) === "input" ? (u(), g("span", {
1956
1968
  key: 1,
1957
1969
  class: "ctrl-input",
1958
- style: N({ fontSize: (_.control.size || 12) + "px" })
1970
+ style: V({ fontSize: (I.control.size || 12) + "px" })
1959
1971
  }, [
1960
- (u(!0), p(U, null, X(_.control.value || [], (L, Y) => (u(), p("span", { key: Y }, G(L.value), 1))), 128))
1961
- ], 4)) : ((A = _.control) == null ? void 0 : A.type) === "radio" ? (u(), p("span", {
1972
+ (u(!0), g(G, null, Q(I.control.value || [], (z, ie) => (u(), g("span", { key: ie }, Y(z.value), 1))), 128))
1973
+ ], 4)) : ((F = I.control) == null ? void 0 : F.type) === "radio" ? (u(), g("span", {
1962
1974
  key: 2,
1963
- class: Fe(["ctrl-options", { "ctrl-options--vertical": ((M = (f = _.control.extension) == null ? void 0 : f.elementAttributes) == null ? void 0 : M.layout) === "vertical" }])
1975
+ class: Pe(["ctrl-options", { "ctrl-options--vertical": ((E = (P = I.control.extension) == null ? void 0 : P.elementAttributes) == null ? void 0 : E.layout) === "vertical" }])
1964
1976
  }, [
1965
- (u(!0), p(U, null, X(_.control.valueSets || [], (L, Y) => (u(), p("label", {
1966
- key: Y,
1977
+ (u(!0), g(G, null, Q(I.control.valueSets || [], (z, ie) => (u(), g("label", {
1978
+ key: ie,
1967
1979
  class: "ctrl-option"
1968
1980
  }, [
1969
- Z("input", {
1981
+ ne("input", {
1970
1982
  type: "radio",
1971
1983
  disabled: "",
1972
- checked: _.control.code === L.code
1973
- }, null, 8, Qi),
1974
- Oe(G(L.value), 1)
1984
+ checked: I.control.code === z.code
1985
+ }, null, 8, el),
1986
+ Le(Y(z.value), 1)
1975
1987
  ]))), 128))
1976
- ], 2)) : pe("", !0)
1977
- ], 64)) : _.type === "checkbox" ? (u(), p("input", {
1988
+ ], 2)) : ve("", !0)
1989
+ ], 64)) : I.type === "checkbox" ? (u(), g("input", {
1978
1990
  key: 4,
1979
1991
  type: "checkbox",
1980
- checked: !!(($ = _.checkbox) != null && $.value),
1992
+ checked: !!((X = I.checkbox) != null && X.value),
1981
1993
  disabled: "",
1982
1994
  class: "el-check"
1983
- }, null, 8, el)) : _.type === "radio" ? (u(), p("input", {
1995
+ }, null, 8, tl)) : I.type === "radio" ? (u(), g("input", {
1984
1996
  key: 5,
1985
1997
  type: "radio",
1986
- checked: !!((E = _.radio) != null && E.value),
1998
+ checked: !!((ue = I.radio) != null && ue.value),
1987
1999
  disabled: "",
1988
2000
  class: "el-check"
1989
- }, null, 8, tl)) : _.type === "superscript" ? (u(), p("sup", {
2001
+ }, null, 8, nl)) : I.type === "superscript" ? (u(), g("sup", {
1990
2002
  key: 6,
1991
- style: N(j(ve)(_))
1992
- }, G(_.value), 5)) : _.type === "subscript" ? (u(), p("sub", {
2003
+ style: V(K(_e)(I))
2004
+ }, Y(I.value), 5)) : I.type === "subscript" ? (u(), g("sub", {
1993
2005
  key: 7,
1994
- style: N(j(ve)(_))
1995
- }, G(_.value), 5)) : _.type === "tab" ? (u(), p("span", {
2006
+ style: V(K(_e)(I))
2007
+ }, Y(I.value), 5)) : I.type === "tab" ? (u(), g("span", {
1996
2008
  key: 8,
1997
2009
  class: "doc-tab",
1998
- style: N({ width: (_.size || j(Ue)) + "px" })
1999
- }, null, 4)) : pe("", !0)
2010
+ style: V({ width: (I.size || K(We)) + "px" })
2011
+ }, null, 4)) : ve("", !0)
2000
2012
  ], 64);
2001
2013
  }), 128))
2002
- ], 4)) : pe("", !0)
2014
+ ], 4)) : ve("", !0)
2003
2015
  ], 64))), 128))
2004
- ], 12, Ji))), 128))
2016
+ ], 12, Xi))), 128))
2005
2017
  ], 4))), 128))
2006
2018
  ])
2007
2019
  ], 6)
2008
2020
  ], 4)
2009
- ], 6)) : pe("", !0);
2021
+ ], 6)) : ve("", !0);
2010
2022
  };
2011
2023
  }
2012
- }, ft = /* @__PURE__ */ De(nl, [["__scopeId", "data-v-3ddfa762"]]), il = { class: "editor-layout word-editor-scope" }, ll = { class: "editor-container" }, ol = {
2024
+ }, pt = /* @__PURE__ */ Ne(il, [["__scopeId", "data-v-88bdb013"]]), ll = { class: "editor-layout word-editor-scope" }, ol = { class: "editor-container" }, al = {
2013
2025
  key: 0,
2014
2026
  class: "editor-loading"
2015
- }, al = { class: "doc-header" }, sl = { class: "doc-footer" }, rl = { class: "doc-page-number" }, cl = 1123, dl = 50, ul = 20, hl = {
2027
+ }, sl = {
2028
+ key: 0,
2029
+ class: "doc-header"
2030
+ }, rl = { class: "doc-footer" }, cl = { class: "doc-page-number" }, dl = 1123, ul = 50, hl = 20, fl = {
2016
2031
  __name: "index",
2017
2032
  props: {
2018
2033
  // 文档结构数据(IElement[]),来源由使用方决定
@@ -2024,248 +2039,255 @@ const zi = {
2024
2039
  loading: {
2025
2040
  type: Boolean,
2026
2041
  default: !1
2042
+ },
2043
+ // 图片 URL 解析函数:(filename) => fullUrl,宿主传入用于拼接完整图片链接
2044
+ resolveImageUrl: {
2045
+ type: Function,
2046
+ default: null
2027
2047
  }
2028
2048
  },
2029
2049
  setup(t) {
2030
- const e = t, n = re(() => {
2031
- const f = e.data;
2032
- return f ? !Array.isArray(f) && f.main ? f.main : Array.isArray(f) ? f : [] : [];
2033
- }), l = ne(null), o = ne({});
2034
- let r = null;
2035
- vt(() => {
2036
- r = new ResizeObserver((f) => {
2037
- const M = {};
2038
- for (const $ of f) {
2039
- const E = $.target._rowKey;
2050
+ const e = t, n = de(() => {
2051
+ const h = e.data;
2052
+ return h ? !Array.isArray(h) && h.main ? h.main : Array.isArray(h) ? h : [] : [];
2053
+ }), l = te(null), o = te({});
2054
+ let s = null;
2055
+ _t(() => {
2056
+ s = new ResizeObserver((h) => {
2057
+ const F = {};
2058
+ for (const P of h) {
2059
+ const E = P.target._rowKey;
2040
2060
  if (!E) continue;
2041
- const L = Math.round($.contentRect.height);
2042
- L > (o.value[E] || 0) && (M[E] = L);
2061
+ const X = Math.round(P.contentRect.height);
2062
+ X > (o.value[E] || 0) && (F[E] = X);
2043
2063
  }
2044
- Object.keys(M).length && (o.value = { ...o.value, ...M });
2064
+ Object.keys(F).length && (o.value = { ...o.value, ...F });
2045
2065
  });
2046
- }), at(() => {
2047
- r == null || r.disconnect(), r = null;
2066
+ }), rt(() => {
2067
+ s == null || s.disconnect(), s = null;
2048
2068
  });
2049
- function y(f, M) {
2050
- !f || !r || (f._rowKey = M, r.observe(f));
2069
+ function v(h, F) {
2070
+ !h || !s || (h._rowKey = F, s.observe(h));
2051
2071
  }
2052
- Kt("bindTableObserver", y);
2053
- const s = re(
2054
- () => Math.max(100, cl - dl * 2 - F.value - ul)
2055
- ), m = re(() => {
2056
- const f = We(n.value), M = [], $ = s.value;
2057
- let E = 0;
2058
- const L = Ri(), Y = { first: 0, second: 1, third: 2, fourth: 3, fifth: 4, sixth: 5, seventh: 6, eighth: 7 };
2059
- let le = -1;
2060
- const st = (V) => {
2061
- var he, me, we;
2062
- return !!((he = V.el) != null && he._coverBreakBefore || (we = (me = V.elements) == null ? void 0 : me[0]) != null && we._coverBreakBefore);
2072
+ yt("bindTableObserver", v), yt("resolveImageUrl", e.resolveImageUrl);
2073
+ const m = de(
2074
+ () => Math.max(100, dl - ul * 2 - x.value - hl)
2075
+ ), y = de(() => {
2076
+ const h = Ge(n.value), F = [], P = m.value;
2077
+ let E = 0, X = !1;
2078
+ const ue = (H) => {
2079
+ F.push({ ...H, _isCover: X });
2080
+ }, z = Ri(), ie = { first: 0, second: 1, third: 2, fourth: 3, fifth: 4, sixth: 5, seventh: 6, eighth: 7 };
2081
+ let Ce = -1;
2082
+ const Je = (H) => {
2083
+ var he, me, Me;
2084
+ return !!((he = H.el) != null && he._coverBreakBefore || (Me = (me = H.elements) == null ? void 0 : me[0]) != null && Me._coverBreakBefore);
2063
2085
  };
2064
- return f.forEach((V, he) => {
2065
- var we, ze, Ae, rt;
2066
- const me = st(V);
2067
- if (me && (E = 0), V.type === "title") {
2068
- const ye = V.el.valueList || [], ce = L.next(V.el.level, (we = V.el.extension) == null ? void 0 : we.startIndex), de = ye.some((oe) => {
2069
- var ue;
2070
- return (ue = oe.extension) == null ? void 0 : ue.isIndex;
2086
+ return h.forEach((H, he) => {
2087
+ var Me, ct, Xe, Ye;
2088
+ const me = Je(H);
2089
+ if (me && (E = 0), X = !!H._isCover, H.type === "title") {
2090
+ const fe = H.el.valueList || [], se = z.next(H.el.level, (Me = H.el.extension) == null ? void 0 : Me.startIndex), ke = fe.some((ge) => {
2091
+ var ye;
2092
+ return (ye = ge.extension) == null ? void 0 : ye.isIndex;
2071
2093
  });
2072
- let xe = ye;
2073
- if (!de && ce) {
2074
- const oe = ye[0] || {};
2075
- xe = [
2094
+ let Ie = fe;
2095
+ if (!ke && se) {
2096
+ const ge = fe[0] || {};
2097
+ Ie = [
2076
2098
  {
2077
- value: ce,
2078
- size: oe.size,
2079
- bold: oe.bold,
2080
- italic: oe.italic,
2081
- color: oe.color,
2082
- font: oe.font,
2099
+ value: se,
2100
+ size: ge.size,
2101
+ bold: ge.bold,
2102
+ italic: ge.italic,
2103
+ color: ge.color,
2104
+ font: ge.font,
2083
2105
  extension: { isIndex: !0 }
2084
2106
  },
2085
- ...ye
2107
+ ...fe
2086
2108
  ];
2087
2109
  }
2088
- const Ce = xe.map((oe) => oe.value || "").join(""), fe = Be(xe);
2089
- E = E + fe > $ && E > 0 ? fe : E + fe, le = Y[V.el.level] ?? 0, M.push({
2110
+ const we = Ie.map((ge) => ge.value || "").join(""), le = ze(Ie);
2111
+ E = E + le > P && E > 0 ? le : E + le, Ce = ie[H.el.level] ?? 0, ue({
2090
2112
  node_id: `blk_${he}_0`,
2091
2113
  layer: me ? 1 : 100,
2092
2114
  blockType: "title",
2093
- level: V.el.level,
2094
- titleEl: V.el,
2095
- titleValueList: xe,
2115
+ level: H.el.level,
2116
+ titleEl: H.el,
2117
+ titleValueList: Ie,
2096
2118
  content_type: "text",
2097
- content: Ce,
2098
- height: fe,
2099
- indentPx: le * 20
2119
+ content: we,
2120
+ height: le,
2121
+ indentPx: Ce * 20
2100
2122
  });
2101
- } else if (V.type === "paragraph") {
2102
- const ye = Oi(V.elements), ce = le >= 0 ? (le + 1) * 20 : 0;
2103
- ye.forEach((de, xe) => {
2104
- const Ce = de.map((oe) => oe.value || "").join(""), fe = Be(de);
2105
- E = E + fe > $ && E > 0 ? fe : E + fe, M.push({
2106
- node_id: `blk_${he}_${xe}`,
2107
- layer: me && xe === 0 ? 1 : 100,
2123
+ } else if (H.type === "paragraph") {
2124
+ const fe = Bi(H.elements), se = Ce >= 0 ? (Ce + 1) * 20 : 0;
2125
+ fe.forEach((ke, Ie) => {
2126
+ const we = ke.map((ge) => ge.value || "").join(""), le = ze(ke);
2127
+ E = E + le > P && E > 0 ? le : E + le, ue({
2128
+ node_id: `blk_${he}_${Ie}`,
2129
+ layer: me && Ie === 0 ? 1 : 100,
2108
2130
  blockType: "paragraph",
2109
- elements: de,
2110
- rowFlex: V.rowFlex,
2131
+ elements: ke,
2132
+ rowFlex: H.rowFlex,
2111
2133
  content_type: "text",
2112
- content: Ce,
2113
- height: fe,
2114
- indentPx: ce
2134
+ content: we,
2135
+ height: le,
2136
+ indentPx: se
2115
2137
  });
2116
2138
  });
2117
- } else if (V.type === "table") {
2118
- const ye = !!((ze = V.el.extension) != null && ze.isTitleTable), ce = ((Ae = V.el.extension) == null ? void 0 : Ae.elementType) === "signOff", de = ((rt = V.el.extension) == null ? void 0 : rt.elementType) === "stepTable", xe = ce || de, Ce = ye || ce ? 0 : le >= 0 ? (le + 1) * 20 : 0, fe = Ht(V.el.trList || []), oe = fe.length;
2119
- if (xe) {
2120
- const ue = fe.flat(), ge = ue.reduce(
2121
- (Q, ee) => Q + (ee.height || ee.minHeight || 35),
2139
+ } else if (H.type === "table") {
2140
+ const fe = !!((ct = H.el.extension) != null && ct.isTitleTable), se = ((Xe = H.el.extension) == null ? void 0 : Xe.elementType) === "signOff", ke = ((Ye = H.el.extension) == null ? void 0 : Ye.elementType) === "stepTable", Ie = se || ke, we = fe || se ? 0 : Ce >= 0 ? (Ce + 1) * 20 : 0, le = zt(H.el.trList || []), ge = le.length;
2141
+ if (Ie) {
2142
+ const ye = le.flat(), O = ye.reduce(
2143
+ (oe, ee) => oe + (ee.height || ee.minHeight || 35),
2122
2144
  0
2123
- ), Ie = `blk_${he}_0`, D = Math.max(ge, o.value[Ie] || 0);
2124
- if (E > 0 && E + D > $ && (E = 0), D > $) {
2125
- const Q = Math.ceil(D / $);
2126
- for (let ee = 0; ee < Q; ee++) {
2127
- const ae = ee * $, Ee = Math.min($, D - ae), Pe = ee > 0 || E > 0;
2128
- E = Ee, M.push({
2145
+ ), Ee = `blk_${he}_0`, be = Math.max(O, o.value[Ee] || 0);
2146
+ if (E > 0 && E + be > P && (E = 0), be > P) {
2147
+ const oe = Math.ceil(be / P);
2148
+ for (let ee = 0; ee < oe; ee++) {
2149
+ const re = ee * P, Te = Math.min(P, be - re), Re = ee > 0 || E > 0;
2150
+ E = Te, ue({
2129
2151
  node_id: `blk_${he}_0_s${ee}`,
2130
2152
  layer: me && ee === 0 ? 1 : 100,
2131
2153
  blockType: "table-row-group",
2132
2154
  content_type: "table-row",
2133
- rowHeight: D,
2134
- trGroup: ue,
2135
- tableEl: V.el,
2136
- tableRowFlex: V.el.rowFlex || null,
2155
+ rowHeight: be,
2156
+ trGroup: ye,
2157
+ tableEl: H.el,
2158
+ tableRowFlex: H.el.rowFlex || null,
2137
2159
  isFirst: ee === 0,
2138
- isLast: ee === Q - 1,
2139
- isPageBreak: Pe,
2140
- sliceOffset: ae,
2141
- sliceHeight: Ee,
2142
- _baseKey: ee === 0 ? Ie : void 0,
2143
- height: Ee,
2144
- indentPx: Ce
2160
+ isLast: ee === oe - 1,
2161
+ isPageBreak: Re,
2162
+ sliceOffset: re,
2163
+ sliceHeight: Te,
2164
+ _baseKey: ee === 0 ? Ee : void 0,
2165
+ height: Te,
2166
+ indentPx: we
2145
2167
  });
2146
2168
  }
2147
2169
  } else {
2148
- const Q = E > 0;
2149
- E = E + D > $ ? D : E + D, M.push({
2170
+ const oe = E > 0;
2171
+ E = E + be > P ? be : E + be, ue({
2150
2172
  node_id: `blk_${he}_0`,
2151
2173
  layer: me ? 1 : 100,
2152
2174
  blockType: "table-row-group",
2153
2175
  content_type: "table-row",
2154
- rowHeight: D,
2155
- trGroup: ue,
2156
- tableEl: V.el,
2157
- tableRowFlex: V.el.rowFlex || null,
2176
+ rowHeight: be,
2177
+ trGroup: ye,
2178
+ tableEl: H.el,
2179
+ tableRowFlex: H.el.rowFlex || null,
2158
2180
  isFirst: !0,
2159
2181
  isLast: !0,
2160
- isPageBreak: Q,
2161
- indentPx: Ce
2182
+ isPageBreak: oe,
2183
+ indentPx: we
2162
2184
  });
2163
2185
  }
2164
2186
  } else
2165
- fe.forEach((ue, ge) => {
2166
- const Ie = `blk_${he}_${ge}`, D = ue.reduce(
2167
- (ee, ae) => ee + (ae.height || ae.minHeight || 35),
2187
+ le.forEach((ye, O) => {
2188
+ const Ee = `blk_${he}_${O}`, be = ye.reduce(
2189
+ (ee, re) => ee + (re.height || re.minHeight || 35),
2168
2190
  0
2169
- ), Q = Math.max(D, o.value[Ie] || 0);
2170
- if (Q > $) {
2171
- const ee = Math.ceil(Q / $);
2172
- for (let ae = 0; ae < ee; ae++) {
2173
- const Ee = ae * $, Pe = Math.min($, Q - Ee), Ge = ae > 0 || E > 0;
2174
- E = Pe, M.push({
2175
- node_id: `blk_${he}_${ge}_s${ae}`,
2176
- layer: me && ge === 0 && ae === 0 ? 1 : 100,
2191
+ ), oe = Math.max(be, o.value[Ee] || 0);
2192
+ if (oe > P) {
2193
+ const ee = Math.ceil(oe / P);
2194
+ for (let re = 0; re < ee; re++) {
2195
+ const Te = re * P, Re = Math.min(P, oe - Te), dt = re > 0 || E > 0;
2196
+ E = Re, ue({
2197
+ node_id: `blk_${he}_${O}_s${re}`,
2198
+ layer: me && O === 0 && re === 0 ? 1 : 100,
2177
2199
  blockType: "table-row-group",
2178
2200
  content_type: "table-row",
2179
- rowHeight: Q,
2180
- trGroup: ue,
2181
- tableEl: V.el,
2182
- tableRowFlex: V.el.rowFlex || null,
2183
- isFirst: ge === 0 && ae === 0,
2184
- isLast: ge === oe - 1 && ae === ee - 1,
2185
- isPageBreak: Ge,
2186
- sliceOffset: Ee,
2187
- sliceHeight: Pe,
2188
- _baseKey: ae === 0 ? Ie : void 0,
2189
- height: Pe,
2190
- indentPx: Ce
2201
+ rowHeight: oe,
2202
+ trGroup: ye,
2203
+ tableEl: H.el,
2204
+ tableRowFlex: H.el.rowFlex || null,
2205
+ isFirst: O === 0 && re === 0,
2206
+ isLast: O === ge - 1 && re === ee - 1,
2207
+ isPageBreak: dt,
2208
+ sliceOffset: Te,
2209
+ sliceHeight: Re,
2210
+ _baseKey: re === 0 ? Ee : void 0,
2211
+ height: Re,
2212
+ indentPx: we
2191
2213
  });
2192
2214
  }
2193
2215
  } else {
2194
- const ee = ge > 0 && E + Q > $;
2195
- E = E + Q > $ ? Q : E + Q, M.push({
2196
- node_id: `blk_${he}_${ge}`,
2197
- layer: me && ge === 0 ? 1 : 100,
2216
+ const ee = O > 0 && E + oe > P;
2217
+ E = E + oe > P ? oe : E + oe, ue({
2218
+ node_id: `blk_${he}_${O}`,
2219
+ layer: me && O === 0 ? 1 : 100,
2198
2220
  blockType: "table-row-group",
2199
2221
  content_type: "table-row",
2200
- rowHeight: Q,
2201
- trGroup: ue,
2202
- tableEl: V.el,
2203
- tableRowFlex: V.el.rowFlex || null,
2204
- isFirst: ge === 0,
2205
- isLast: ge === oe - 1,
2222
+ rowHeight: oe,
2223
+ trGroup: ye,
2224
+ tableEl: H.el,
2225
+ tableRowFlex: H.el.rowFlex || null,
2226
+ isFirst: O === 0,
2227
+ isLast: O === ge - 1,
2206
2228
  isPageBreak: ee,
2207
- indentPx: Ce
2229
+ indentPx: we
2208
2230
  });
2209
2231
  }
2210
2232
  });
2211
- } else if (V.type === "list") {
2212
- const ye = Math.round(18);
2213
- let ce = 0;
2214
- for (const de of V.items)
2215
- ce += de.length ? Be(de) : ye;
2216
- ce = Math.max(ce, ye), E = E + ce > $ && E > 0 ? ce : E + ce, M.push({
2233
+ } else if (H.type === "list") {
2234
+ const fe = Math.round(18);
2235
+ let se = 0;
2236
+ for (const ke of H.items)
2237
+ se += ke.length ? ze(ke) : fe;
2238
+ se = Math.max(se, fe), E = E + se > P && E > 0 ? se : E + se, ue({
2217
2239
  node_id: `blk_${he}_0`,
2218
2240
  layer: me ? 1 : 100,
2219
2241
  blockType: "list",
2220
- listType: V.listType,
2221
- listStyle: V.listStyle,
2222
- items: V.items,
2223
- height: ce,
2224
- indentPx: le >= 0 ? (le + 1) * 20 : 0
2242
+ listType: H.listType,
2243
+ listStyle: H.listStyle,
2244
+ items: H.items,
2245
+ height: se,
2246
+ indentPx: Ce >= 0 ? (Ce + 1) * 20 : 0
2225
2247
  });
2226
2248
  }
2227
- }), M;
2228
- }), h = re(() => {
2229
- var M;
2230
- const f = (M = e.data) == null ? void 0 : M.header;
2231
- return f != null && f.length ? We(f) : [];
2232
- }), S = re(() => {
2233
- var M;
2234
- const f = (M = e.data) == null ? void 0 : M.footer;
2235
- return f != null && f.length ? We(f) : [];
2236
- }), F = re(() => Bt(h.value, !0)), O = re(() => Bt(S.value, !0)), _ = re(() => h.value.length > 0), q = re(() => S.value.length > 0);
2237
- function ie(f) {
2238
- var $, E, L;
2239
- const M = f.type === "table";
2249
+ }), F;
2250
+ }), r = de(() => {
2251
+ var F;
2252
+ const h = (F = e.data) == null ? void 0 : F.header;
2253
+ return h != null && h.length ? Ge(h) : [];
2254
+ }), M = de(() => {
2255
+ var F;
2256
+ const h = (F = e.data) == null ? void 0 : F.footer;
2257
+ return h != null && h.length ? Ge(h) : [];
2258
+ }), x = de(() => Vt(r.value, !0)), $ = de(() => Vt(M.value, !0)), B = de(() => r.value.length > 0), W = de(() => M.value.length > 0);
2259
+ function I(h) {
2260
+ var P, E, X;
2261
+ const F = h.type === "table";
2240
2262
  return {
2241
- blockType: M ? "table-row-group" : f.type,
2242
- elements: f.elements,
2243
- rowFlex: f.rowFlex,
2244
- level: ($ = f.el) == null ? void 0 : $.level,
2245
- titleValueList: ((E = f.el) == null ? void 0 : E.valueList) || f.titleValueList,
2246
- listType: f.listType,
2247
- listStyle: f.listStyle,
2248
- items: f.items,
2263
+ blockType: F ? "table-row-group" : h.type,
2264
+ elements: h.elements,
2265
+ rowFlex: h.rowFlex,
2266
+ level: (P = h.el) == null ? void 0 : P.level,
2267
+ titleValueList: ((E = h.el) == null ? void 0 : E.valueList) || h.titleValueList,
2268
+ listType: h.listType,
2269
+ listStyle: h.listStyle,
2270
+ items: h.items,
2249
2271
  indentPx: 0,
2250
- trGroup: M ? Ht(f.el.trList).flat() : void 0,
2251
- tableEl: M ? f.el : void 0,
2272
+ trGroup: F ? zt(h.el.trList).flat() : void 0,
2273
+ tableEl: F ? h.el : void 0,
2252
2274
  isFirst: !0,
2253
2275
  isLast: !0,
2254
- tableRowFlex: ((L = f.el) == null ? void 0 : L.rowFlex) || null
2276
+ tableRowFlex: ((X = h.el) == null ? void 0 : X.rowFlex) || null
2255
2277
  };
2256
2278
  }
2257
- const B = re(() => $i(m.value));
2258
- function A(f) {
2259
- var M;
2260
- (M = l.value) == null || M.scrollToRow({ node_id: f.nodeId });
2279
+ const D = de(() => $i(y.value));
2280
+ function T(h) {
2281
+ var F;
2282
+ (F = l.value) == null || F.scrollToRow({ node_id: h.nodeId });
2261
2283
  }
2262
- return (f, M) => (u(), p("div", il, [
2263
- K(Fi, {
2264
- items: B.value,
2265
- onNavigate: A
2284
+ return (h, F) => (u(), g("div", ll, [
2285
+ q(Ti, {
2286
+ items: D.value,
2287
+ onNavigate: T
2266
2288
  }, null, 8, ["items"]),
2267
- Z("div", ll, [
2268
- t.loading ? (u(), p("div", ol, " 加载中… ")) : (u(), Me(j(fi), {
2289
+ ne("div", ol, [
2290
+ t.loading ? (u(), g("div", al, " 加载中… ")) : (u(), Fe(K(fi), {
2269
2291
  key: 1,
2270
2292
  ref_key: "virtualTableRef",
2271
2293
  ref: l,
@@ -2277,49 +2299,49 @@ const zi = {
2277
2299
  pageWidth: 860,
2278
2300
  margin: 50,
2279
2301
  gap: 16,
2280
- showPageHeader: _.value,
2302
+ showPageHeader: B.value,
2281
2303
  showPageBorder: !0,
2282
2304
  pageBorderPadding: 5,
2283
2305
  pageBorderStyle: "1px solid #333",
2284
- headerHeight: F.value,
2285
- footerHeight: O.value,
2306
+ headerHeight: x.value,
2307
+ footerHeight: $.value,
2286
2308
  showPageNumber: !0
2287
2309
  },
2288
- data: m.value
2310
+ data: y.value
2289
2311
  }, In({
2290
2312
  default: qe(() => [
2291
- K(j(vi), null, {
2292
- default: qe(({ row: $ }) => [
2293
- K(ft, { block: $ }, null, 8, ["block"])
2313
+ q(K(vi), null, {
2314
+ default: qe(({ row: P }) => [
2315
+ q(pt, { block: P }, null, 8, ["block"])
2294
2316
  ]),
2295
2317
  _: 1
2296
2318
  })
2297
2319
  ]),
2298
2320
  _: 2
2299
2321
  }, [
2300
- _.value ? {
2322
+ B.value ? {
2301
2323
  name: "page-header",
2302
- fn: qe(() => [
2303
- Z("div", al, [
2304
- (u(!0), p(U, null, X(h.value, ($, E) => (u(), Me(ft, {
2305
- key: E,
2306
- block: ie($),
2324
+ fn: qe(({ isCoverPage: P }) => [
2325
+ P ? ve("", !0) : (u(), g("div", sl, [
2326
+ (u(!0), g(G, null, Q(r.value, (E, X) => (u(), Fe(pt, {
2327
+ key: X,
2328
+ block: I(E),
2307
2329
  "is-header-footer": !0
2308
2330
  }, null, 8, ["block"]))), 128))
2309
- ])
2331
+ ]))
2310
2332
  ]),
2311
2333
  key: "0"
2312
2334
  } : void 0,
2313
- q.value ? {
2335
+ W.value ? {
2314
2336
  name: "page-footer",
2315
- fn: qe(({ pageNumber: $, totalPages: E }) => [
2316
- Z("div", sl, [
2317
- (u(!0), p(U, null, X(S.value, (L, Y) => (u(), Me(ft, {
2318
- key: Y,
2319
- block: ie(L),
2337
+ fn: qe(({ pageNumber: P, totalPages: E }) => [
2338
+ ne("div", rl, [
2339
+ (u(!0), g(G, null, Q(M.value, (X, ue) => (u(), Fe(pt, {
2340
+ key: ue,
2341
+ block: I(X),
2320
2342
  "is-header-footer": !0
2321
2343
  }, null, 8, ["block"]))), 128)),
2322
- Z("div", rl, G($) + " / " + G(E), 1)
2344
+ ne("div", cl, " 第" + Y(P) + " / " + Y(E) + "页 ", 1)
2323
2345
  ])
2324
2346
  ]),
2325
2347
  key: "1"
@@ -2328,16 +2350,16 @@ const zi = {
2328
2350
  ])
2329
2351
  ]));
2330
2352
  }
2331
- }, fl = /* @__PURE__ */ De(hl, [["__scopeId", "data-v-70681e24"]]), Dt = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
2332
- function it(t = 10) {
2353
+ }, gl = /* @__PURE__ */ Ne(fl, [["__scopeId", "data-v-9ff2db2b"]]), jt = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
2354
+ function ot(t = 10) {
2333
2355
  const e = crypto.getRandomValues(new Uint8Array(t));
2334
- return Array.from(e).map((n) => Dt[n % Dt.length]).join("");
2356
+ return Array.from(e).map((n) => jt[n % jt.length]).join("");
2335
2357
  }
2336
- class ot {
2358
+ class st {
2337
2359
  constructor(e) {
2338
- z(this, "data");
2339
- this.data = qt({
2340
- id: it(),
2360
+ N(this, "data");
2361
+ this.data = Wt({
2362
+ id: ot(),
2341
2363
  version: 1,
2342
2364
  sections: [this.createEmptySection()],
2343
2365
  pageWidth: 595,
@@ -2352,13 +2374,13 @@ class ot {
2352
2374
  // ─── 工厂方法 ─────────────────────────────────────────────────────────────
2353
2375
  createEmptySection() {
2354
2376
  return {
2355
- id: it(),
2377
+ id: ot(),
2356
2378
  paragraphs: [this.createEmptyParagraph()]
2357
2379
  };
2358
2380
  }
2359
2381
  createEmptyParagraph(e) {
2360
2382
  return {
2361
- id: it(),
2383
+ id: ot(),
2362
2384
  type: "paragraph",
2363
2385
  format: e ?? {},
2364
2386
  children: []
@@ -2366,7 +2388,7 @@ class ot {
2366
2388
  }
2367
2389
  createTextElement(e, n) {
2368
2390
  return {
2369
- id: it(),
2391
+ id: ot(),
2370
2392
  type: "text",
2371
2393
  value: e,
2372
2394
  format: n ?? {}
@@ -2384,8 +2406,8 @@ class ot {
2384
2406
  getAllParagraphs() {
2385
2407
  const e = [];
2386
2408
  return this.data.sections.forEach((n, l) => {
2387
- n.paragraphs.forEach((o, r) => {
2388
- e.push({ paragraph: o, sectionIndex: l, paragraphIndex: r });
2409
+ n.paragraphs.forEach((o, s) => {
2410
+ e.push({ paragraph: o, sectionIndex: l, paragraphIndex: s });
2389
2411
  });
2390
2412
  }), e;
2391
2413
  }
@@ -2402,12 +2424,12 @@ class ot {
2402
2424
  insertText(e, n, l) {
2403
2425
  const o = this.getParagraphAt(e.sectionIndex, e.paragraphIndex);
2404
2426
  if (!o) return;
2405
- const r = o.children[e.elementIndex];
2406
- if (r && r.type === "text")
2407
- r.value = r.value.slice(0, e.offset) + n + r.value.slice(e.offset);
2427
+ const s = o.children[e.elementIndex];
2428
+ if (s && s.type === "text")
2429
+ s.value = s.value.slice(0, e.offset) + n + s.value.slice(e.offset);
2408
2430
  else {
2409
- const y = this.createTextElement(n, l);
2410
- o.children.splice(e.elementIndex, 0, y);
2431
+ const v = this.createTextElement(n, l);
2432
+ o.children.splice(e.elementIndex, 0, v);
2411
2433
  }
2412
2434
  this.bumpVersion();
2413
2435
  }
@@ -2422,15 +2444,15 @@ class ot {
2422
2444
  insertParagraph(e, n, l) {
2423
2445
  const o = this.data.sections[e];
2424
2446
  if (!o) throw new Error(`Section ${e} not found`);
2425
- const r = this.createEmptyParagraph(l);
2426
- return o.paragraphs.splice(n + 1, 0, r), this.bumpVersion(), r;
2447
+ const s = this.createEmptyParagraph(l);
2448
+ return o.paragraphs.splice(n + 1, 0, s), this.bumpVersion(), s;
2427
2449
  }
2428
2450
  /** 合并两个相邻段落 */
2429
2451
  mergeParagraphs(e, n) {
2430
2452
  const l = this.data.sections[e];
2431
2453
  if (!l) return;
2432
- const o = l.paragraphs[n], r = l.paragraphs[n + 1];
2433
- !o || !r || (o.children.push(...r.children), l.paragraphs.splice(n + 1, 1), this.bumpVersion());
2454
+ const o = l.paragraphs[n], s = l.paragraphs[n + 1];
2455
+ !o || !s || (o.children.push(...s.children), l.paragraphs.splice(n + 1, 1), this.bumpVersion());
2434
2456
  }
2435
2457
  /** 更新段落格式 */
2436
2458
  updateParagraphFormat(e, n, l) {
@@ -2445,18 +2467,18 @@ class ot {
2445
2467
  /** 批量更新选区内元素格式 */
2446
2468
  updateRangeFormat(e, n, l) {
2447
2469
  const o = this.getAllParagraphs();
2448
- let r = !1;
2449
- for (const { paragraph: y, sectionIndex: s, paragraphIndex: m } of o) {
2450
- const h = s === e.sectionIndex && m === e.paragraphIndex, S = s === n.sectionIndex && m === n.paragraphIndex;
2451
- if (h && (r = !0), r)
2452
- for (let F = 0; F < y.children.length; F++) {
2453
- const O = y.children[F];
2454
- if (!(h && F < e.elementIndex)) {
2455
- if (S && F > n.elementIndex) break;
2456
- O.format = { ...O.format, ...l };
2470
+ let s = !1;
2471
+ for (const { paragraph: v, sectionIndex: m, paragraphIndex: y } of o) {
2472
+ const r = m === e.sectionIndex && y === e.paragraphIndex, M = m === n.sectionIndex && y === n.paragraphIndex;
2473
+ if (r && (s = !0), s)
2474
+ for (let x = 0; x < v.children.length; x++) {
2475
+ const $ = v.children[x];
2476
+ if (!(r && x < e.elementIndex)) {
2477
+ if (M && x > n.elementIndex) break;
2478
+ $.format = { ...$.format, ...l };
2457
2479
  }
2458
2480
  }
2459
- if (S) break;
2481
+ if (M) break;
2460
2482
  }
2461
2483
  this.bumpVersion();
2462
2484
  }
@@ -2469,26 +2491,26 @@ class ot {
2469
2491
  }
2470
2492
  /** 从 JSON 恢复 */
2471
2493
  static fromJSON(e) {
2472
- const n = JSON.parse(e), l = new ot();
2494
+ const n = JSON.parse(e), l = new st();
2473
2495
  return Object.assign(l.data, n), l;
2474
2496
  }
2475
2497
  }
2476
- function Le(t = 0, e = 0, n = 0, l = 0) {
2498
+ function $e(t = 0, e = 0, n = 0, l = 0) {
2477
2499
  return { sectionIndex: t, paragraphIndex: e, elementIndex: n, offset: l };
2478
2500
  }
2479
- function zt(t, e) {
2501
+ function Kt(t, e) {
2480
2502
  return t.sectionIndex === e.sectionIndex && t.paragraphIndex === e.paragraphIndex && t.elementIndex === e.elementIndex && t.offset === e.offset;
2481
2503
  }
2482
- class pt {
2504
+ class bt {
2483
2505
  constructor(e) {
2484
- z(this, "_selection", qt({
2485
- anchor: Le(),
2486
- focus: Le(),
2506
+ N(this, "_selection", Wt({
2507
+ anchor: $e(),
2508
+ focus: $e(),
2487
2509
  isCollapsed: !0
2488
2510
  }));
2489
- z(this, "_docModel");
2511
+ N(this, "_docModel");
2490
2512
  /** 是否有选区(非光标) */
2491
- z(this, "hasSelection", re(() => !this._selection.isCollapsed));
2513
+ N(this, "hasSelection", de(() => !this._selection.isCollapsed));
2492
2514
  this._docModel = e;
2493
2515
  }
2494
2516
  get selection() {
@@ -2499,18 +2521,18 @@ class pt {
2499
2521
  this._selection.anchor = { ...e }, this._selection.focus = { ...e }, this._selection.isCollapsed = !0;
2500
2522
  }
2501
2523
  setSelection(e, n) {
2502
- this._selection.anchor = { ...e }, this._selection.focus = { ...n }, this._selection.isCollapsed = zt(e, n);
2524
+ this._selection.anchor = { ...e }, this._selection.focus = { ...n }, this._selection.isCollapsed = Kt(e, n);
2503
2525
  }
2504
2526
  collapse(e = !0) {
2505
2527
  e ? this._selection.anchor = { ...this._selection.focus } : this._selection.focus = { ...this._selection.anchor }, this._selection.isCollapsed = !0;
2506
2528
  }
2507
2529
  selectAll() {
2508
- const e = this._docModel.data.sections, n = e[e.length - 1], l = n == null ? void 0 : n.paragraphs[n.paragraphs.length - 1], o = l == null ? void 0 : l.children[l.children.length - 1], r = (o == null ? void 0 : o.type) === "text" ? o.value.length : 0;
2509
- this._selection.anchor = Le(0, 0, 0, 0), this._selection.focus = Le(
2530
+ const e = this._docModel.data.sections, n = e[e.length - 1], l = n == null ? void 0 : n.paragraphs[n.paragraphs.length - 1], o = l == null ? void 0 : l.children[l.children.length - 1], s = (o == null ? void 0 : o.type) === "text" ? o.value.length : 0;
2531
+ this._selection.anchor = $e(0, 0, 0, 0), this._selection.focus = $e(
2510
2532
  e.length - 1,
2511
2533
  ((n == null ? void 0 : n.paragraphs.length) ?? 1) - 1,
2512
2534
  ((l == null ? void 0 : l.children.length) ?? 0) === 0 ? 0 : ((l == null ? void 0 : l.children.length) ?? 1) - 1,
2513
- r
2535
+ s
2514
2536
  ), this._selection.isCollapsed = !1;
2515
2537
  }
2516
2538
  // ─── 移动光标 ─────────────────────────────────────────────────────────────
@@ -2520,17 +2542,17 @@ class pt {
2520
2542
  if (!l) return;
2521
2543
  const o = l.children[n.elementIndex];
2522
2544
  if ((o == null ? void 0 : o.type) === "text" && n.offset < o.value.length) {
2523
- const y = { ...n, offset: n.offset + 1 };
2524
- this._applyMove(y, e);
2545
+ const v = { ...n, offset: n.offset + 1 };
2546
+ this._applyMove(v, e);
2525
2547
  return;
2526
2548
  }
2527
2549
  if (n.elementIndex < l.children.length - 1) {
2528
- const y = { ...n, elementIndex: n.elementIndex + 1, offset: 0 };
2529
- this._applyMove(y, e);
2550
+ const v = { ...n, elementIndex: n.elementIndex + 1, offset: 0 };
2551
+ this._applyMove(v, e);
2530
2552
  return;
2531
2553
  }
2532
- const r = this._getNextParagraphPoint(n);
2533
- r && this._applyMove(r, e);
2554
+ const s = this._getNextParagraphPoint(n);
2555
+ s && this._applyMove(s, e);
2534
2556
  }
2535
2557
  /** 光标向后移动一个字符 */
2536
2558
  moveBackward(e = !1) {
@@ -2541,32 +2563,32 @@ class pt {
2541
2563
  return;
2542
2564
  }
2543
2565
  if (n.elementIndex > 0) {
2544
- const o = this._docModel.getParagraphAt(n.sectionIndex, n.paragraphIndex), r = o == null ? void 0 : o.children[n.elementIndex - 1], y = (r == null ? void 0 : r.type) === "text" ? r.value.length : 0, s = { ...n, elementIndex: n.elementIndex - 1, offset: y };
2545
- this._applyMove(s, e);
2566
+ const o = this._docModel.getParagraphAt(n.sectionIndex, n.paragraphIndex), s = o == null ? void 0 : o.children[n.elementIndex - 1], v = (s == null ? void 0 : s.type) === "text" ? s.value.length : 0, m = { ...n, elementIndex: n.elementIndex - 1, offset: v };
2567
+ this._applyMove(m, e);
2546
2568
  return;
2547
2569
  }
2548
2570
  const l = this._getPrevParagraphPoint(n);
2549
2571
  l && this._applyMove(l, e);
2550
2572
  }
2551
2573
  _applyMove(e, n) {
2552
- n ? (this._selection.focus = e, this._selection.isCollapsed = zt(this._selection.anchor, e)) : (this._selection.anchor = { ...e }, this._selection.focus = { ...e }, this._selection.isCollapsed = !0);
2574
+ n ? (this._selection.focus = e, this._selection.isCollapsed = Kt(this._selection.anchor, e)) : (this._selection.anchor = { ...e }, this._selection.focus = { ...e }, this._selection.isCollapsed = !0);
2553
2575
  }
2554
2576
  _getNextParagraphPoint(e) {
2555
2577
  const n = this._docModel.data.sections[e.sectionIndex];
2556
- return n ? e.paragraphIndex < n.paragraphs.length - 1 ? Le(e.sectionIndex, e.paragraphIndex + 1, 0, 0) : e.sectionIndex < this._docModel.data.sections.length - 1 ? Le(e.sectionIndex + 1, 0, 0, 0) : null : null;
2578
+ return n ? e.paragraphIndex < n.paragraphs.length - 1 ? $e(e.sectionIndex, e.paragraphIndex + 1, 0, 0) : e.sectionIndex < this._docModel.data.sections.length - 1 ? $e(e.sectionIndex + 1, 0, 0, 0) : null : null;
2557
2579
  }
2558
2580
  _getPrevParagraphPoint(e) {
2559
2581
  if (e.paragraphIndex > 0) {
2560
2582
  const n = this._docModel.getParagraphAt(e.sectionIndex, e.paragraphIndex - 1);
2561
2583
  if (!n) return null;
2562
- const l = n.children.length - 1, o = n.children[l], r = (o == null ? void 0 : o.type) === "text" ? o.value.length : 0;
2563
- return Le(e.sectionIndex, e.paragraphIndex - 1, Math.max(l, 0), r);
2584
+ const l = n.children.length - 1, o = n.children[l], s = (o == null ? void 0 : o.type) === "text" ? o.value.length : 0;
2585
+ return $e(e.sectionIndex, e.paragraphIndex - 1, Math.max(l, 0), s);
2564
2586
  }
2565
2587
  if (e.sectionIndex > 0) {
2566
2588
  const n = this._docModel.data.sections[e.sectionIndex - 1];
2567
2589
  if (!n) return null;
2568
- const l = n.paragraphs.length - 1, o = n.paragraphs[l], r = ((o == null ? void 0 : o.children.length) ?? 0) - 1, y = o == null ? void 0 : o.children[r], s = (y == null ? void 0 : y.type) === "text" ? y.value.length : 0;
2569
- return Le(e.sectionIndex - 1, l, Math.max(r, 0), s);
2590
+ const l = n.paragraphs.length - 1, o = n.paragraphs[l], s = ((o == null ? void 0 : o.children.length) ?? 0) - 1, v = o == null ? void 0 : o.children[s], m = (v == null ? void 0 : v.type) === "text" ? v.value.length : 0;
2591
+ return $e(e.sectionIndex - 1, l, Math.max(s, 0), m);
2570
2592
  }
2571
2593
  return null;
2572
2594
  }
@@ -2578,12 +2600,12 @@ class pt {
2578
2600
  static domToModelPoint(e, n) {
2579
2601
  let l = e instanceof Element ? e : e.parentElement;
2580
2602
  for (; l; ) {
2581
- const o = l.getAttribute("data-si"), r = l.getAttribute("data-pi"), y = l.getAttribute("data-ei");
2582
- if (o !== null && r !== null && y !== null)
2603
+ const o = l.getAttribute("data-si"), s = l.getAttribute("data-pi"), v = l.getAttribute("data-ei");
2604
+ if (o !== null && s !== null && v !== null)
2583
2605
  return {
2584
2606
  sectionIndex: parseInt(o),
2585
- paragraphIndex: parseInt(r),
2586
- elementIndex: parseInt(y),
2607
+ paragraphIndex: parseInt(s),
2608
+ elementIndex: parseInt(v),
2587
2609
  offset: n
2588
2610
  };
2589
2611
  l = l.parentElement;
@@ -2591,11 +2613,11 @@ class pt {
2591
2613
  return null;
2592
2614
  }
2593
2615
  }
2594
- const gl = 200;
2595
- class pl {
2616
+ const pl = 200;
2617
+ class vl {
2596
2618
  constructor() {
2597
- z(this, "_undoStack", []);
2598
- z(this, "_redoStack", []);
2619
+ N(this, "_undoStack", []);
2620
+ N(this, "_redoStack", []);
2599
2621
  }
2600
2622
  get canUndo() {
2601
2623
  return this._undoStack.length > 0;
@@ -2615,7 +2637,7 @@ class pl {
2615
2637
  (o = n.merge) == null || o.call(n, e);
2616
2638
  return;
2617
2639
  }
2618
- this._undoStack.push(e), this._undoStack.length > gl && this._undoStack.shift();
2640
+ this._undoStack.push(e), this._undoStack.length > pl && this._undoStack.shift();
2619
2641
  }
2620
2642
  undo() {
2621
2643
  const e = this._undoStack.pop();
@@ -2629,13 +2651,13 @@ class pl {
2629
2651
  this._undoStack = [], this._redoStack = [];
2630
2652
  }
2631
2653
  }
2632
- class vl {
2633
- constructor(e, n, l, o, r) {
2634
- z(this, "name", "insertText");
2635
- z(this, "_point");
2636
- z(this, "_text");
2637
- z(this, "_format");
2638
- this.docModel = e, this.selectionManager = n, this._point = { ...l }, this._text = o, this._format = r;
2654
+ class ml {
2655
+ constructor(e, n, l, o, s) {
2656
+ N(this, "name", "insertText");
2657
+ N(this, "_point");
2658
+ N(this, "_text");
2659
+ N(this, "_format");
2660
+ this.docModel = e, this.selectionManager = n, this._point = { ...l }, this._text = o, this._format = s;
2639
2661
  }
2640
2662
  execute() {
2641
2663
  this.docModel.insertText(this._point, this._text, this._format), this.selectionManager.setCursor({
@@ -2656,18 +2678,18 @@ class vl {
2656
2678
  this._text += n._text;
2657
2679
  }
2658
2680
  }
2659
- class ml {
2681
+ class yl {
2660
2682
  constructor(e, n) {
2661
- z(this, "name", "insertParagraph");
2662
- z(this, "_insertedParagraphId", null);
2683
+ N(this, "name", "insertParagraph");
2684
+ N(this, "_insertedParagraphId", null);
2663
2685
  this.docModel = e, this.selectionManager = n;
2664
2686
  }
2665
2687
  execute() {
2666
- var m, h;
2688
+ var y, r;
2667
2689
  const { focus: e } = this.selectionManager.selection, { sectionIndex: n, paragraphIndex: l } = e, o = this.docModel.getParagraphAt(n, l);
2668
2690
  if (!o) return;
2669
- const r = e.elementIndex, y = o.children.splice(r), s = this.docModel.createEmptyParagraph(o.format);
2670
- s.children.push(...y), this._insertedParagraphId = s.id, this.docModel.data.sections[n].paragraphs.splice(l + 1, 0, s), (h = (m = this.docModel).bumpVersion) == null || h.call(m), this.selectionManager.setCursor({
2691
+ const s = e.elementIndex, v = o.children.splice(s), m = this.docModel.createEmptyParagraph(o.format);
2692
+ m.children.push(...v), this._insertedParagraphId = m.id, this.docModel.data.sections[n].paragraphs.splice(l + 1, 0, m), (r = (y = this.docModel).bumpVersion) == null || r.call(y), this.selectionManager.setCursor({
2671
2693
  sectionIndex: n,
2672
2694
  paragraphIndex: l + 1,
2673
2695
  elementIndex: 0,
@@ -2684,10 +2706,10 @@ class ml {
2684
2706
  }));
2685
2707
  }
2686
2708
  }
2687
- class Nt {
2709
+ class Ut {
2688
2710
  constructor(e, n, l) {
2689
- z(this, "name");
2690
- z(this, "_deletedText", "");
2711
+ N(this, "name");
2712
+ N(this, "_deletedText", "");
2691
2713
  this.docModel = e, this.selectionManager = n, this.name = l === "backward" ? "deleteBackward" : "deleteForward";
2692
2714
  }
2693
2715
  execute() {
@@ -2718,10 +2740,10 @@ class Nt {
2718
2740
  }
2719
2741
  }
2720
2742
  }
2721
- class Ke {
2743
+ class Ue {
2722
2744
  constructor(e, n, l, o) {
2723
- z(this, "name");
2724
- z(this, "_prevFormat", {});
2745
+ N(this, "name");
2746
+ N(this, "_prevFormat", {});
2725
2747
  this.docModel = e, this.selectionManager = n, this._value = o, this.name = l;
2726
2748
  }
2727
2749
  execute() {
@@ -2729,8 +2751,8 @@ class Ke {
2729
2751
  if (!l) return;
2730
2752
  const o = {};
2731
2753
  if (this._isToggle()) {
2732
- const r = this._getCurrentValue(l);
2733
- o[l] = !r;
2754
+ const s = this._getCurrentValue(l);
2755
+ o[l] = !s;
2734
2756
  } else
2735
2757
  o[l] = this._value;
2736
2758
  this.docModel.updateRangeFormat(e, n, o);
@@ -2760,9 +2782,9 @@ class Ke {
2760
2782
  return (o = l == null ? void 0 : l.format) == null ? void 0 : o[e];
2761
2783
  }
2762
2784
  }
2763
- class gt {
2785
+ class vt {
2764
2786
  constructor(e, n, l, o) {
2765
- z(this, "name", "textAlign");
2787
+ N(this, "name", "textAlign");
2766
2788
  this.docModel = e, this.selectionManager = n, this._formatKey = l, this._value = o;
2767
2789
  }
2768
2790
  execute() {
@@ -2772,19 +2794,19 @@ class gt {
2772
2794
  undo() {
2773
2795
  }
2774
2796
  }
2775
- class yl {
2797
+ class bl {
2776
2798
  constructor(e, n, l) {
2777
- z(this, "_factories", /* @__PURE__ */ new Map());
2799
+ N(this, "_factories", /* @__PURE__ */ new Map());
2778
2800
  this.docModel = e, this.selectionManager = n, this.historyManager = l, this._registerBuiltinCommands();
2779
2801
  }
2780
2802
  // ─── 注册内置命令 ─────────────────────────────────────────────────────────
2781
2803
  _registerBuiltinCommands() {
2782
2804
  this.register("insertText", (n) => {
2783
2805
  const { focus: l } = this.selectionManager.selection;
2784
- return new vl(this.docModel, this.selectionManager, l, n);
2785
- }), this.register("insertParagraph", () => new ml(this.docModel, this.selectionManager)), this.register("deleteBackward", () => new Nt(this.docModel, this.selectionManager, "backward")), this.register("deleteForward", () => new Nt(this.docModel, this.selectionManager, "forward")), this.register("undo", () => null), this.register("redo", () => null), ["bold", "italic", "underline", "strikethrough", "superscript", "subscript"].forEach((n) => {
2786
- this.register(n, () => new Ke(this.docModel, this.selectionManager, n));
2787
- }), this.register("fontSize", (n) => new Ke(this.docModel, this.selectionManager, "fontSize", n)), this.register("fontFamily", (n) => new Ke(this.docModel, this.selectionManager, "fontFamily", n)), this.register("color", (n) => new Ke(this.docModel, this.selectionManager, "color", n)), this.register("backgroundColor", (n) => new Ke(this.docModel, this.selectionManager, "backgroundColor", n)), this.register("textAlign", (n) => new gt(this.docModel, this.selectionManager, "textAlign", n)), this.register("lineHeight", (n) => new gt(this.docModel, this.selectionManager, "lineHeight", n)), this.register("heading", (n) => new gt(this.docModel, this.selectionManager, "heading", n)), this.register("selectAll", () => (this.selectionManager.selectAll(), null)), this.register("setSelection", (n) => {
2806
+ return new ml(this.docModel, this.selectionManager, l, n);
2807
+ }), this.register("insertParagraph", () => new yl(this.docModel, this.selectionManager)), this.register("deleteBackward", () => new Ut(this.docModel, this.selectionManager, "backward")), this.register("deleteForward", () => new Ut(this.docModel, this.selectionManager, "forward")), this.register("undo", () => null), this.register("redo", () => null), ["bold", "italic", "underline", "strikethrough", "superscript", "subscript"].forEach((n) => {
2808
+ this.register(n, () => new Ue(this.docModel, this.selectionManager, n));
2809
+ }), this.register("fontSize", (n) => new Ue(this.docModel, this.selectionManager, "fontSize", n)), this.register("fontFamily", (n) => new Ue(this.docModel, this.selectionManager, "fontFamily", n)), this.register("color", (n) => new Ue(this.docModel, this.selectionManager, "color", n)), this.register("backgroundColor", (n) => new Ue(this.docModel, this.selectionManager, "backgroundColor", n)), this.register("textAlign", (n) => new vt(this.docModel, this.selectionManager, "textAlign", n)), this.register("lineHeight", (n) => new vt(this.docModel, this.selectionManager, "lineHeight", n)), this.register("heading", (n) => new vt(this.docModel, this.selectionManager, "heading", n)), this.register("selectAll", () => (this.selectionManager.selectAll(), null)), this.register("setSelection", (n) => {
2788
2810
  if (n) {
2789
2811
  const l = n;
2790
2812
  this.selectionManager.setSelection(l.anchor, l.focus);
@@ -2814,18 +2836,18 @@ class yl {
2814
2836
  o && (o.execute(), this.historyManager.push(o));
2815
2837
  }
2816
2838
  }
2817
- class bl {
2839
+ class _l {
2818
2840
  constructor(e, n) {
2819
- z(this, "_el", null);
2820
- z(this, "_commandManager");
2821
- z(this, "_selectionManager");
2822
- z(this, "_composing", !1);
2841
+ N(this, "_el", null);
2842
+ N(this, "_commandManager");
2843
+ N(this, "_selectionManager");
2844
+ N(this, "_composing", !1);
2823
2845
  // 正在 IME 输入中
2824
- z(this, "_boundKeydown");
2825
- z(this, "_boundBeforeInput");
2826
- z(this, "_boundCompositionStart");
2827
- z(this, "_boundCompositionEnd");
2828
- z(this, "_boundSelectionChange");
2846
+ N(this, "_boundKeydown");
2847
+ N(this, "_boundBeforeInput");
2848
+ N(this, "_boundCompositionStart");
2849
+ N(this, "_boundCompositionEnd");
2850
+ N(this, "_boundSelectionChange");
2829
2851
  this._commandManager = e, this._selectionManager = n, this._boundKeydown = this._onKeydown.bind(this), this._boundBeforeInput = this._onBeforeInput.bind(this), this._boundCompositionStart = () => {
2830
2852
  this._composing = !0;
2831
2853
  }, this._boundCompositionEnd = this._onCompositionEnd.bind(this), this._boundSelectionChange = this._onSelectionChange.bind(this);
@@ -2889,22 +2911,22 @@ class bl {
2889
2911
  if (!e || !this._el) return;
2890
2912
  const n = e.anchorNode, l = e.focusNode;
2891
2913
  if (!n || !l || !this._el.contains(n) && !this._el.contains(l)) return;
2892
- const o = pt.domToModelPoint(n, e.anchorOffset), r = pt.domToModelPoint(l, e.focusOffset);
2893
- o && r && this._selectionManager.setSelection(o, r);
2914
+ const o = bt.domToModelPoint(n, e.anchorOffset), s = bt.domToModelPoint(l, e.focusOffset);
2915
+ o && s && this._selectionManager.setSelection(o, s);
2894
2916
  }
2895
2917
  }
2896
2918
  class xl {
2897
2919
  constructor(e = {}) {
2898
- z(this, "docModel");
2899
- z(this, "selection");
2900
- z(this, "history");
2901
- z(this, "commands");
2902
- z(this, "input");
2903
- z(this, "_readonly");
2904
- z(this, "_plugins", []);
2905
- z(this, "_inputEl", null);
2920
+ N(this, "docModel");
2921
+ N(this, "selection");
2922
+ N(this, "history");
2923
+ N(this, "commands");
2924
+ N(this, "input");
2925
+ N(this, "_readonly");
2926
+ N(this, "_plugins", []);
2927
+ N(this, "_inputEl", null);
2906
2928
  var n;
2907
- this._readonly = e.readonly ?? !1, this.docModel = new ot(e.initialDocument), this.selection = new pt(this.docModel), this.history = new pl(), this.commands = new yl(this.docModel, this.selection, this.history), this.input = new bl(this.commands, this.selection), (n = e.plugins) == null || n.forEach((l) => this.use(l));
2929
+ this._readonly = e.readonly ?? !1, this.docModel = new st(e.initialDocument), this.selection = new bt(this.docModel), this.history = new vl(), this.commands = new bl(this.docModel, this.selection, this.history), this.input = new _l(this.commands, this.selection), (n = e.plugins) == null || n.forEach((l) => this.use(l));
2908
2930
  }
2909
2931
  // ─── 公共 API ─────────────────────────────────────────────────────────────
2910
2932
  /**
@@ -2938,7 +2960,7 @@ class xl {
2938
2960
  }
2939
2961
  /** 从 JSON 加载文档(清空历史) */
2940
2962
  loadJSON(e) {
2941
- const n = ot.fromJSON(e);
2963
+ const n = st.fromJSON(e);
2942
2964
  Object.assign(this.docModel.data, n.data), this.history.clear();
2943
2965
  }
2944
2966
  get isReadonly() {
@@ -2948,29 +2970,29 @@ class xl {
2948
2970
  return ["undo", "redo", "selectAll", "setSelection"].includes(e);
2949
2971
  }
2950
2972
  }
2951
- const Yt = Symbol("editor");
2952
- function Il(t) {
2973
+ const Qt = Symbol("editor");
2974
+ function El(t) {
2953
2975
  const e = new xl(t);
2954
- return Kt(Yt, e), at(() => {
2976
+ return yt(Qt, e), rt(() => {
2955
2977
  e.unmount();
2956
2978
  }), e;
2957
2979
  }
2958
- function El() {
2959
- const t = jt(Yt);
2980
+ function Sl() {
2981
+ const t = mt(Qt);
2960
2982
  if (!t)
2961
2983
  throw new Error("[useEditor] 必须在 EditorContainer 组件内使用");
2962
2984
  return t;
2963
2985
  }
2964
- const _l = fl, Sl = {
2986
+ const kl = gl, Fl = {
2965
2987
  install(t) {
2966
- t.component("EditorContainer", _l);
2988
+ t.component("EditorContainer", kl);
2967
2989
  }
2968
2990
  };
2969
2991
  export {
2970
2992
  xl as Editor,
2971
- _l as EditorContainer,
2972
- Yt as EditorKey,
2973
- Il as createEditor,
2974
- Sl as default,
2975
- El as useEditor
2993
+ kl as EditorContainer,
2994
+ Qt as EditorKey,
2995
+ El as createEditor,
2996
+ Fl as default,
2997
+ Sl as useEditor
2976
2998
  };