@eigenpal/docx-editor-vue 1.1.0 → 1.2.0

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.
package/dist/index.js CHANGED
@@ -1,34 +1,35 @@
1
1
  import { a as e, c as t, d as n, f as r, i, l as a, n as o, o as s, p as c, r as l, s as u, t as d, u as f } from "./KeyboardShortcutsDialog-5ZsgieYf.js";
2
2
  import { a as p, c as m, h, i as g, o as _, s as v, t as y, x as b } from "./MenuBar-DLXxthZk.js";
3
3
  import { t as x } from "./_plugin-vue_export-helper-B52Kst-M.js";
4
- import { n as S } from "./RenderedDomContext-CHc18N_2.js";
5
- import { t as ee } from "./zIndex-CxELVe_L.js";
6
- import { n as te, r as ne, t as C } from "./useTableResize-BbyKMoa9.js";
7
- import { Fragment as w, Teleport as T, computed as E, createApp as re, createBlock as ie, createCommentVNode as D, createElementBlock as O, createElementVNode as k, createSlots as ae, createStaticVNode as oe, createVNode as A, defineComponent as j, h as se, nextTick as ce, normalizeClass as M, normalizeStyle as N, onBeforeUnmount as P, onMounted as F, openBlock as I, ref as L, renderList as R, renderSlot as le, resolveDynamicComponent as ue, shallowRef as de, toDisplayString as z, unref as B, vModelText as V, watch as H, withCtx as U, withDirectives as W, withKeys as G, withModifiers as K } from "vue";
8
- import { NodeSelection as q, TextSelection as fe } from "prosemirror-state";
9
- import { clickToPositionDom as pe, computeHfCaretRectFromView as me, findBodyPmSpans as he } from "@eigenpal/docx-editor-core/layout-bridge";
10
- import { clearFormatting as J, findHyperlinkRangeAt as Y } from "@eigenpal/docx-editor-core/prosemirror/commands/formatting";
11
- import { SIDEBAR_DOCUMENT_SHIFT as ge, findWordBoundaries as _e, loadFontDefinitions as ve, onFontError as ye, pixelsToEmu as be, readDocxFileFromInput as xe, toArrayBuffer as Se } from "@eigenpal/docx-editor-core/utils";
12
- import { getTableContext as Ce } from "@eigenpal/docx-editor-core/prosemirror/extensions/nodes/TableExtension";
13
- import { clickToPositionDom as we, getCaretPositionFromDom as Te, getSelectionRectsFromDom as Ee } from "@eigenpal/docx-editor-core/layout-bridge/clickToPositionDom";
14
- import { IMAGE_LAYOUT_OPTIONS as X, captureInlinePositionEmu as De, deriveLayoutChoice as Oe, findImageElement as ke, isImageLayoutOptionEnabled as Ae, toolbarValueToLayoutTarget as je } from "@eigenpal/docx-editor-core/layout-painter";
15
- import { proseDocToBlocks as Me } from "@eigenpal/docx-editor-core/prosemirror/conversion";
16
- import { LayoutSelectionGate as Ne, schema as Pe } from "@eigenpal/docx-editor-core/prosemirror";
17
- import { pointsToHalfPoints as Fe, twipsToPixels as Ie } from "@eigenpal/docx-editor-core/utils/units";
18
- import { makeRevisionInfo as Z } from "@eigenpal/docx-editor-core/prosemirror/plugins";
19
- import { findPageIndexContainingPmPos as Le } from "@eigenpal/docx-editor-core/layout-engine";
20
- import { applyStyle as Re, removeTabStop as ze, setIndentFirstLine as Be, setIndentLeft as Ve, setIndentRight as He } from "@eigenpal/docx-editor-core/prosemirror/commands/paragraph";
21
- import { createStyleResolver as Ue } from "@eigenpal/docx-editor-core/prosemirror/styles";
22
- import { insertPageBreak as We } from "@eigenpal/docx-editor-core/prosemirror/commands/pageBreak";
23
- import { mapHexToHighlightName as Ge } from "@eigenpal/docx-editor-core/utils/highlightColors";
24
- import { collectHeadings as Ke } from "@eigenpal/docx-editor-core/utils/headingCollector";
25
- import { acceptChange as qe, acceptChangeById as Je, insertImageNode as Ye, rejectChange as Xe, rejectChangeById as Ze } from "@eigenpal/docx-editor-core/prosemirror/commands";
26
- import { extractTrackedChanges as Qe } from "@eigenpal/docx-editor-core/prosemirror/utils/extractTrackedChanges";
27
- import { TABLE_INSERT_HIDE_DELAY_MS as $e, detectTableInsertHover as et } from "@eigenpal/docx-editor-core/layout-bridge/tableInsertHover";
28
- import { openReportIssue as tt } from "@eigenpal/docx-editor-core/utils/reportIssue";
29
- import { createDocumentWithText as nt, createEmptyDocument as rt } from "@eigenpal/docx-editor-core";
4
+ import { n as ee } from "./RenderedDomContext-CHc18N_2.js";
5
+ import { t as te } from "./zIndex-CxELVe_L.js";
6
+ import { n as ne, r as re, t as S } from "./useTableResize-BcBdSaOE.js";
7
+ import { Fragment as C, Teleport as w, computed as T, createApp as ie, createBlock as E, createCommentVNode as D, createElementBlock as O, createElementVNode as k, createSlots as ae, createStaticVNode as oe, createVNode as A, defineComponent as j, h as se, nextTick as ce, normalizeClass as M, normalizeStyle as N, onBeforeUnmount as P, onMounted as F, openBlock as I, ref as L, renderList as R, renderSlot as le, resolveDynamicComponent as ue, shallowRef as de, toDisplayString as z, unref as B, vModelText as V, watch as H, withCtx as U, withDirectives as W, withKeys as G, withModifiers as K } from "vue";
8
+ import { NodeSelection as fe, TextSelection as pe } from "prosemirror-state";
9
+ import { clickToPositionDom as me, computeHfCaretRectFromView as he, findBodyPmSpans as ge } from "@eigenpal/docx-editor-core/layout-bridge";
10
+ import { clearFormatting as q, findHyperlinkRangeAt as J } from "@eigenpal/docx-editor-core/prosemirror/commands/formatting";
11
+ import { SIDEBAR_DOCUMENT_SHIFT as _e, findWordBoundaries as ve, loadFontDefinitions as ye, onFontError as be, pixelsToEmu as xe, readDocxFileFromInput as Se, toArrayBuffer as Ce } from "@eigenpal/docx-editor-core/utils";
12
+ import { getTableContext as we } from "@eigenpal/docx-editor-core/prosemirror/extensions/nodes/TableExtension";
13
+ import { clickToPositionDom as Te, getCaretPositionFromDom as Ee, getSelectionRectsFromDom as De } from "@eigenpal/docx-editor-core/layout-bridge/clickToPositionDom";
14
+ import { IMAGE_LAYOUT_OPTIONS as Y, captureInlinePositionEmu as Oe, deriveLayoutChoice as ke, findImageElement as Ae, isImageLayoutOptionEnabled as je, toolbarValueToLayoutTarget as Me } from "@eigenpal/docx-editor-core/layout-painter";
15
+ import { proseDocToBlocks as Ne } from "@eigenpal/docx-editor-core/prosemirror/conversion";
16
+ import { LayoutSelectionGate as Pe, addRepeatingSectionItemTr as Fe, findContentControlPos as Ie, findContentControlsInPM as X, removeContentControlTr as Le, removeRepeatingSectionItemTr as Re, schema as ze, setContentControlContentTr as Be, setContentControlValueTr as Ve } from "@eigenpal/docx-editor-core/prosemirror";
17
+ import { pointsToHalfPoints as He, twipsToPixels as Ue } from "@eigenpal/docx-editor-core/utils/units";
18
+ import { makeRevisionInfo as We } from "@eigenpal/docx-editor-core/prosemirror/plugins";
19
+ import { findPageIndexContainingPmPos as Ge } from "@eigenpal/docx-editor-core/layout-engine";
20
+ import { applyStyle as Z, removeTabStop as Ke, setIndentFirstLine as qe, setIndentLeft as Je, setIndentRight as Ye } from "@eigenpal/docx-editor-core/prosemirror/commands/paragraph";
21
+ import { createStyleResolver as Xe } from "@eigenpal/docx-editor-core/prosemirror/styles";
22
+ import { insertPageBreak as Ze } from "@eigenpal/docx-editor-core/prosemirror/commands/pageBreak";
23
+ import { mapHexToHighlightName as Qe } from "@eigenpal/docx-editor-core/utils/highlightColors";
24
+ import { collectHeadings as $e } from "@eigenpal/docx-editor-core/utils/headingCollector";
25
+ import { acceptChange as et, acceptChangeById as tt, insertImageNode as nt, rejectChange as rt, rejectChangeById as it } from "@eigenpal/docx-editor-core/prosemirror/commands";
26
+ import { extractTrackedChanges as at } from "@eigenpal/docx-editor-core/prosemirror/utils/extractTrackedChanges";
27
+ import { TABLE_INSERT_HIDE_DELAY_MS as ot, detectTableInsertHover as st } from "@eigenpal/docx-editor-core/layout-bridge/tableInsertHover";
28
+ import { openReportIssue as ct } from "@eigenpal/docx-editor-core/utils/reportIssue";
29
+ import { ContentControlNotFoundError as lt } from "@eigenpal/docx-editor-core/agent";
30
+ import { createDocumentWithText as ut, createEmptyDocument as dt } from "@eigenpal/docx-editor-core";
30
31
  //#region src/utils/paraTextHelpers.ts
31
- function it(e, t) {
32
+ function ft(e, t) {
32
33
  if (!t.trim()) return null;
33
34
  let n = null;
34
35
  return e.descendants((e, r) => n ? !1 : e.isTextblock && e.attrs?.paraId === t ? (n = {
@@ -36,11 +37,11 @@ function it(e, t) {
36
37
  to: r + e.nodeSize
37
38
  }, !1) : !0), n;
38
39
  }
39
- function at(e) {
40
+ function pt(e) {
40
41
  let t = [];
41
42
  return e.descendants((e) => !e.isText || !e.text ? !0 : e.marks.some((e) => e.type.name === "insertion") ? !1 : (t.push(e.text), !0)), t.join("");
42
43
  }
43
- function ot(e, t, n) {
44
+ function mt(e, t, n) {
44
45
  if (t >= n) return "";
45
46
  let r = [];
46
47
  return e.nodesBetween(t, n, (e, i) => {
@@ -49,7 +50,7 @@ function ot(e, t, n) {
49
50
  a < o && r.push(e.text.slice(a - i, o - i));
50
51
  }), r.join("");
51
52
  }
52
- function st(e, t, n, r) {
53
+ function ht(e, t, n, r) {
53
54
  if (!r) return null;
54
55
  let i = "", a = [];
55
56
  e.nodesBetween(t, n, (e, t) => {
@@ -76,7 +77,7 @@ function st(e, t, n, r) {
76
77
  }
77
78
  //#endregion
78
79
  //#region src/utils/refApiQueries.ts
79
- function ct(e, t, n) {
80
+ function gt(e, t, n) {
80
81
  if (!e || !t) return [];
81
82
  let r = n?.caseSensitive ?? !1, i = n?.limit ?? 20, a = r ? t : t.toLowerCase(), o = [];
82
83
  return e.state.doc.descendants((e) => {
@@ -84,7 +85,7 @@ function ct(e, t, n) {
84
85
  if (!e.isTextblock) return !0;
85
86
  let n = e.attrs?.paraId;
86
87
  if (!n) return !1;
87
- let s = at(e), c = r ? s : s.toLowerCase(), l = c.indexOf(a);
88
+ let s = pt(e), c = r ? s : s.toLowerCase(), l = c.indexOf(a);
88
89
  return l === -1 || c.indexOf(a, l + 1) !== -1 || o.push({
89
90
  paraId: n,
90
91
  match: s.slice(l, l + t.length),
@@ -93,13 +94,13 @@ function ct(e, t, n) {
93
94
  }), !1;
94
95
  }), o;
95
96
  }
96
- function lt(e) {
97
+ function _t(e) {
97
98
  if (!e) return null;
98
99
  let { selection: t, doc: n } = e.state, r = t.$from, i = r.depth;
99
100
  for (; i > 0 && !r.node(i).isTextblock;) i--;
100
101
  let a = i > 0 ? r.node(i) : null;
101
102
  if (!a) return null;
102
- let o = a.attrs?.paraId ?? null, s = r.start(i), c = s + a.content.size, l = ot(n, s, t.from), u = ot(n, t.from, t.to), d = ot(n, t.to, c);
103
+ let o = a.attrs?.paraId ?? null, s = r.start(i), c = s + a.content.size, l = mt(n, s, t.from), u = mt(n, t.from, t.to), d = mt(n, t.to, c);
103
104
  return {
104
105
  paraId: o,
105
106
  selectedText: u,
@@ -108,7 +109,7 @@ function lt(e) {
108
109
  after: d
109
110
  };
110
111
  }
111
- function ut(e, t, n) {
112
+ function vt(e, t, n) {
112
113
  if (!t || !e) return null;
113
114
  let r = t.pages[n - 1];
114
115
  if (!r) return null;
@@ -122,7 +123,7 @@ function ut(e, t, n) {
122
123
  let o = r.attrs?.paraId;
123
124
  !o || i.has(o) || (i.add(o), a.push({
124
125
  paraId: o,
125
- text: at(r),
126
+ text: pt(r),
126
127
  styleId: r.attrs?.styleId ?? void 0
127
128
  }));
128
129
  }
@@ -134,7 +135,7 @@ function ut(e, t, n) {
134
135
  }
135
136
  //#endregion
136
137
  //#region src/components/DecorationLayer.vue
137
- var dt = /* @__PURE__ */ j({
138
+ var yt = /* @__PURE__ */ j({
138
139
  __name: "DecorationLayer",
139
140
  props: {
140
141
  getView: { type: Function },
@@ -169,7 +170,7 @@ var dt = /* @__PURE__ */ j({
169
170
  n.firstChild && n.replaceChildren();
170
171
  return;
171
172
  }
172
- let a = S(t, r), o = a.getContainerOffset(), s = document.createDocumentFragment();
173
+ let a = ee(t, r), o = a.getContainerOffset(), s = document.createDocumentFragment();
173
174
  for (let { decoration: t, from: n, to: r } of i) {
174
175
  if (n === r) {
175
176
  let r = l(t, e);
@@ -226,13 +227,13 @@ var dt = /* @__PURE__ */ j({
226
227
  "aria-hidden": "true"
227
228
  }, null, 512));
228
229
  }
229
- }), ft = ["data-handle", "onMousedown"], pt = ["title"], mt = {
230
+ }), bt = ["data-handle", "onMousedown"], xt = ["title"], St = {
230
231
  key: 0,
231
232
  class: "image-overlay__dim"
232
- }, ht = {
233
+ }, Ct = {
233
234
  key: 1,
234
235
  class: "image-overlay__dim image-overlay__dim--rotate"
235
- }, gt = 4, _t = 15, vt = /* @__PURE__ */ x(/* @__PURE__ */ j({
236
+ }, wt = 4, Tt = 15, Et = /* @__PURE__ */ x(/* @__PURE__ */ j({
236
237
  __name: "ImageSelectionOverlay",
237
238
  props: {
238
239
  imageInfo: {},
@@ -246,8 +247,8 @@ var dt = /* @__PURE__ */ j({
246
247
  "context-menu"
247
248
  ],
248
249
  setup(e, { emit: t }) {
249
- let { t: r } = n(), i = e, a = t, o = L(null), s = L(!1), c = L(!1), l = L(!1), u = L(0), d = L(0), f = L(0), p = L(null), m = "se", h = 0, g = 0, _ = 0, v = 0, y = null, b = null, x = null, S = null;
250
- function te(e, t) {
250
+ let { t: r } = n(), i = e, a = t, o = L(null), s = L(!1), c = L(!1), l = L(!1), u = L(0), d = L(0), f = L(0), p = L(null), m = "se", h = 0, g = 0, _ = 0, v = 0, y = null, b = null, x = null, ee = null;
251
+ function ne(e, t) {
251
252
  if (!e) return null;
252
253
  try {
253
254
  let n = e.state.doc.nodeAt(t);
@@ -256,20 +257,20 @@ var dt = /* @__PURE__ */ j({
256
257
  return null;
257
258
  }
258
259
  }
259
- function ne() {
260
+ function re() {
260
261
  let e = i.imageInfo;
261
262
  if (!e) return null;
262
263
  if (e.element.isConnected) return e.element;
263
264
  let t = o.value?.closest(".docx-editor-vue__pages-viewport")?.querySelector(".docx-editor-vue__pages");
264
265
  if (!t) return null;
265
266
  for (let n of t.querySelectorAll(`[data-pm-start="${e.pmPos}"]`)) {
266
- let e = ke(n);
267
+ let e = Ae(n);
267
268
  if (e) return e;
268
269
  }
269
270
  return null;
270
271
  }
271
- function C() {
272
- let e = ne();
272
+ function S() {
273
+ let e = re();
273
274
  if (!e || !o.value) {
274
275
  p.value = null;
275
276
  return;
@@ -288,17 +289,17 @@ var dt = /* @__PURE__ */ j({
288
289
  };
289
290
  }
290
291
  H(() => i.imageInfo, async () => {
291
- await ce(), C();
292
+ await ce(), S();
292
293
  }, { immediate: !0 }), H(() => i.imageInfo, (e, t, n) => {
293
294
  if (!i.imageInfo) return;
294
295
  let r = () => {
295
- b && cancelAnimationFrame(b), b = requestAnimationFrame(C);
296
+ b && cancelAnimationFrame(b), b = requestAnimationFrame(S);
296
297
  }, a = o.value?.closest(".docx-editor-vue__pages-viewport")?.parentElement;
297
298
  a?.addEventListener("scroll", r, { passive: !0 }), window.addEventListener("resize", r, { passive: !0 }), n(() => {
298
299
  a?.removeEventListener("scroll", r), window.removeEventListener("resize", r), b && cancelAnimationFrame(b);
299
300
  });
300
301
  }, { immediate: !0 });
301
- let T = E(() => s.value ? u.value : p.value?.width || 0), re = E(() => s.value ? d.value : p.value?.height || 0), ie = E(() => {
302
+ let w = T(() => s.value ? u.value : p.value?.width || 0), ie = T(() => s.value ? d.value : p.value?.height || 0), E = T(() => {
302
303
  let e = p.value;
303
304
  if (!e) return {
304
305
  position: "absolute",
@@ -314,11 +315,11 @@ var dt = /* @__PURE__ */ j({
314
315
  top: `${e.top}px`,
315
316
  width: `${t}px`,
316
317
  height: `${n}px`,
317
- zIndex: ee.imageOverlay,
318
+ zIndex: te.imageOverlay,
318
319
  pointerEvents: "auto"
319
320
  };
320
- }), ae = E(() => {
321
- let e = T.value, t = re.value, n = `${e / 2 - 5}px`, r = `${t / 2 - 5}px`, i = `${e - 5}px`, a = `${t - 5}px`, o = "-5px";
321
+ }), ae = T(() => {
322
+ let e = w.value, t = ie.value, n = `${e / 2 - 5}px`, r = `${t / 2 - 5}px`, i = `${e - 5}px`, a = `${t - 5}px`, o = "-5px";
322
323
  return [
323
324
  {
324
325
  pos: "nw",
@@ -415,10 +416,10 @@ var dt = /* @__PURE__ */ j({
415
416
  document.removeEventListener("mousemove", se), document.removeEventListener("mouseup", M), s.value = !1, y = null, a("interact-end");
416
417
  let e = i.view, t = i.imageInfo;
417
418
  if (!e || !t) {
418
- C();
419
+ S();
419
420
  return;
420
421
  }
421
- let n = te(e, t.pmPos);
422
+ let n = ne(e, t.pmPos);
422
423
  if (n) try {
423
424
  e.dispatch(e.state.tr.setNodeMarkup(t.pmPos, void 0, {
424
425
  ...n.attrs,
@@ -426,7 +427,7 @@ var dt = /* @__PURE__ */ j({
426
427
  height: d.value
427
428
  }));
428
429
  } catch {}
429
- ce(() => C());
430
+ ce(() => S());
430
431
  }
431
432
  let F = 0, le = 0, ue = 0, de = 0, V = null, U = null;
432
433
  function W(e) {
@@ -438,25 +439,25 @@ var dt = /* @__PURE__ */ j({
438
439
  let n = /scaleX\(-1\)/.test(e || ""), r = /scaleY\(-1\)/.test(e || ""), i = [], a = (t % 360 + 360) % 360;
439
440
  return a !== 0 && i.push(`rotate(${a}deg)`), n && i.push("scaleX(-1)"), r && i.push("scaleY(-1)"), i.length > 0 ? i.join(" ") : null;
440
441
  }
441
- function fe(e, t) {
442
+ function pe(e, t) {
442
443
  return Math.atan2(e - F, -(t - le)) * 180 / Math.PI;
443
444
  }
444
- function pe(e) {
445
+ function me(e) {
445
446
  if (!i.imageInfo) return;
446
447
  let t = i.imageInfo.element.getBoundingClientRect();
447
448
  F = t.left + t.width / 2, le = t.top + t.height / 2;
448
- let n = te(i.view, i.imageInfo.pmPos);
449
- V = n && n.attrs.transform || null, de = W(V), U = i.imageInfo.element.querySelector("img"), ue = fe(e.clientX, e.clientY), f.value = de, l.value = !0, a("interact-start"), document.addEventListener("mousemove", me), document.addEventListener("mouseup", he);
449
+ let n = ne(i.view, i.imageInfo.pmPos);
450
+ V = n && n.attrs.transform || null, de = W(V), U = i.imageInfo.element.querySelector("img"), ue = pe(e.clientX, e.clientY), f.value = de, l.value = !0, a("interact-start"), document.addEventListener("mousemove", he), document.addEventListener("mouseup", ge);
450
451
  }
451
- function me(e) {
452
- let t = fe(e.clientX, e.clientY) - ue, n = de + t;
453
- e.shiftKey || (n = Math.round(n / _t) * _t), f.value = (n % 360 + 360) % 360, U && (U.style.transform = G(V, f.value) || "");
452
+ function he(e) {
453
+ let t = pe(e.clientX, e.clientY) - ue, n = de + t;
454
+ e.shiftKey || (n = Math.round(n / Tt) * Tt), f.value = (n % 360 + 360) % 360, U && (U.style.transform = G(V, f.value) || "");
454
455
  }
455
- function he() {
456
- document.removeEventListener("mousemove", me), document.removeEventListener("mouseup", he), l.value = !1, a("interact-end");
456
+ function ge() {
457
+ document.removeEventListener("mousemove", he), document.removeEventListener("mouseup", ge), l.value = !1, a("interact-end");
457
458
  let e = i.view, t = i.imageInfo;
458
459
  try {
459
- let n = e && t ? te(e, t.pmPos) : null;
460
+ let n = e && t ? ne(e, t.pmPos) : null;
460
461
  e && t && n && e.dispatch(e.state.tr.setNodeMarkup(t.pmPos, void 0, {
461
462
  ...n.attrs,
462
463
  transform: G(n.attrs.transform, f.value)
@@ -464,33 +465,33 @@ var dt = /* @__PURE__ */ j({
464
465
  } catch {} finally {
465
466
  U && (U.style.transform = ""), U = null, V = null;
466
467
  }
467
- ce(() => C());
468
+ ce(() => S());
468
469
  }
469
- let J = null;
470
- function Y(e) {
470
+ let q = null;
471
+ function J(e) {
471
472
  if (!i.imageInfo || !p.value) return;
472
473
  let t = e.clientX, n = e.clientY, r = p.value, o = !1, s = (e) => {
473
474
  let s = e.clientX - t, l = e.clientY - n;
474
- if (!(!o && Math.sqrt(s * s + l * l) < gt)) {
475
+ if (!(!o && Math.sqrt(s * s + l * l) < wt)) {
475
476
  if (!o) {
476
- o = !0, c.value = !0, a("interact-start"), J = document.createElement("div"), J.style.cssText = "position: fixed; pointer-events: none; z-index: 10000; opacity: 0.5; border: 2px dashed #2563eb; border-radius: 4px; background: rgba(37, 99, 235, 0.1);";
477
+ o = !0, c.value = !0, a("interact-start"), q = document.createElement("div"), q.style.cssText = "position: fixed; pointer-events: none; z-index: 10000; opacity: 0.5; border: 2px dashed #2563eb; border-radius: 4px; background: rgba(37, 99, 235, 0.1);";
477
478
  let e = i.zoom;
478
- J.style.width = `${r.width * e}px`, J.style.height = `${r.height * e}px`, document.body.appendChild(J);
479
+ q.style.width = `${r.width * e}px`, q.style.height = `${r.height * e}px`, document.body.appendChild(q);
479
480
  }
480
- if (J) {
481
+ if (q) {
481
482
  let t = i.zoom;
482
- J.style.left = `${e.clientX - r.width * t / 2}px`, J.style.top = `${e.clientY - r.height * t / 2}px`;
483
+ q.style.left = `${e.clientX - r.width * t / 2}px`, q.style.top = `${e.clientY - r.height * t / 2}px`;
483
484
  }
484
485
  }
485
486
  }, l = (e) => {
486
- document.removeEventListener("mousemove", s), document.removeEventListener("mouseup", l), x = null, S = null, J &&= (J.remove(), null), c.value = !1, o && (a("interact-end"), ge(e.clientX, e.clientY));
487
+ document.removeEventListener("mousemove", s), document.removeEventListener("mouseup", l), x = null, ee = null, q &&= (q.remove(), null), c.value = !1, o && (a("interact-end"), _e(e.clientX, e.clientY));
487
488
  };
488
- x = s, S = l, document.addEventListener("mousemove", s), document.addEventListener("mouseup", l);
489
+ x = s, ee = l, document.addEventListener("mousemove", s), document.addEventListener("mouseup", l);
489
490
  }
490
- function ge(e, t) {
491
+ function _e(e, t) {
491
492
  let n = i.view, r = i.imageInfo;
492
493
  if (!n || !r) return;
493
- let a = te(n, r.pmPos);
494
+ let a = ne(n, r.pmPos);
494
495
  if (!a) return;
495
496
  let s = a.attrs.wrapType, c = a.attrs.displayMode === "float" || (s ? [
496
497
  "square",
@@ -512,80 +513,80 @@ var dt = /* @__PURE__ */ j({
512
513
  if (c ||= s[s.length - 1].querySelector(".layout-page-content"), !c) return;
513
514
  let l = c.getBoundingClientRect(), u = i.zoom, d = (e - l.left) / u, f = (t - l.top) / u, p = {
514
515
  horizontal: {
515
- posOffset: be(d),
516
+ posOffset: xe(d),
516
517
  relativeTo: "margin"
517
518
  },
518
519
  vertical: {
519
- posOffset: be(f),
520
+ posOffset: xe(f),
520
521
  relativeTo: "margin"
521
522
  }
522
523
  }, m = n.state.tr.setNodeMarkup(r.pmPos, void 0, {
523
524
  ...a.attrs,
524
525
  position: p
525
526
  });
526
- n.dispatch(m), _e(r.pmPos);
527
+ n.dispatch(m), ve(r.pmPos);
527
528
  } else {
528
529
  let i = o.value?.closest(".docx-editor-vue__pages-viewport")?.querySelector(".docx-editor-vue__pages");
529
530
  if (!i) return;
530
- let s = we(i, e, t, 1);
531
+ let s = Te(i, e, t, 1);
531
532
  if (s == null || s < 0 || s === r.pmPos || s === r.pmPos + 1) return;
532
533
  let c = n.state.tr, l = a.nodeSize;
533
- if (s <= r.pmPos) c = c.delete(r.pmPos, r.pmPos + l), c = c.insert(s, a), n.dispatch(c), _e(s);
534
+ if (s <= r.pmPos) c = c.delete(r.pmPos, r.pmPos + l), c = c.insert(s, a), n.dispatch(c), ve(s);
534
535
  else {
535
536
  c = c.delete(r.pmPos, r.pmPos + l);
536
537
  let e = Math.min(s - l, c.doc.content.size);
537
- c = c.insert(e, a), n.dispatch(c), _e(Math.min(e, n.state.doc.content.size - 1));
538
+ c = c.insert(e, a), n.dispatch(c), ve(Math.min(e, n.state.doc.content.size - 1));
538
539
  }
539
540
  }
540
541
  } catch {}
541
- ce(() => C());
542
+ ce(() => S());
542
543
  }
543
- function _e(e) {
544
+ function ve(e) {
544
545
  let t = i.view;
545
546
  if (t) try {
546
- let n = q.create(t.state.doc, e);
547
+ let n = fe.create(t.state.doc, e);
547
548
  t.dispatch(t.state.tr.setSelection(n));
548
549
  } catch {}
549
550
  }
550
551
  return P(() => {
551
- document.removeEventListener("mousemove", se), document.removeEventListener("mouseup", M), document.removeEventListener("mousemove", me), document.removeEventListener("mouseup", he), x && document.removeEventListener("mousemove", x), S && document.removeEventListener("mouseup", S), J &&= (J.remove(), null), b && cancelAnimationFrame(b);
552
+ document.removeEventListener("mousemove", se), document.removeEventListener("mouseup", M), document.removeEventListener("mousemove", he), document.removeEventListener("mouseup", ge), x && document.removeEventListener("mousemove", x), ee && document.removeEventListener("mouseup", ee), q &&= (q.remove(), null), b && cancelAnimationFrame(b);
552
553
  }), (t, n) => e.imageInfo ? (I(), O("div", {
553
554
  key: 0,
554
555
  ref_key: "overlayRootRef",
555
556
  ref: o,
556
557
  class: "image-overlay",
557
- style: N(ie.value),
558
+ style: N(E.value),
558
559
  onMousedown: n[3] ||= K(() => {}, ["stop"])
559
560
  }, [
560
561
  n[4] ||= k("div", { class: "image-overlay__border" }, null, -1),
561
562
  k("div", {
562
563
  class: "image-overlay__body",
563
564
  style: N({ cursor: c.value ? "grabbing" : "grab" }),
564
- onMousedown: n[0] ||= K((e) => Y(e), ["prevent", "stop"]),
565
+ onMousedown: n[0] ||= K((e) => J(e), ["prevent", "stop"]),
565
566
  onContextmenu: n[1] ||= K((e) => t.$emit("context-menu", e), ["prevent", "stop"])
566
567
  }, null, 36),
567
- (I(!0), O(w, null, R(ae.value, (e) => (I(), O("div", {
568
+ (I(!0), O(C, null, R(ae.value, (e) => (I(), O("div", {
568
569
  key: e.pos,
569
570
  class: "image-overlay__handle",
570
571
  style: N(e.style),
571
572
  "data-handle": e.pos,
572
573
  onMousedown: K((t) => j(t, e.pos), ["prevent", "stop"])
573
- }, null, 44, ft))), 128)),
574
+ }, null, 44, bt))), 128)),
574
575
  n[5] ||= k("div", { class: "image-overlay__rotate-line" }, null, -1),
575
576
  k("div", {
576
577
  class: "image-overlay__rotate-handle",
577
- style: N({ left: `${T.value / 2 - 7}px` }),
578
+ style: N({ left: `${w.value / 2 - 7}px` }),
578
579
  title: B(r)("imageOverlay.rotate"),
579
- onMousedown: n[2] ||= K((e) => pe(e), ["prevent", "stop"])
580
- }, null, 44, pt),
581
- s.value ? (I(), O("div", mt, z(Math.round(u.value)) + " × " + z(Math.round(d.value)), 1)) : D("", !0),
582
- l.value ? (I(), O("div", ht, z(Math.round(f.value)) + "° ", 1)) : D("", !0)
580
+ onMousedown: n[2] ||= K((e) => me(e), ["prevent", "stop"])
581
+ }, null, 44, xt),
582
+ s.value ? (I(), O("div", St, z(Math.round(u.value)) + " × " + z(Math.round(d.value)), 1)) : D("", !0),
583
+ l.value ? (I(), O("div", Ct, z(Math.round(f.value)) + "° ", 1)) : D("", !0)
583
584
  ], 36)) : D("", !0);
584
585
  }
585
- }), [["__scopeId", "data-v-a6f20ec2"]]), yt = { class: "doc-outline__header" }, bt = { class: "doc-outline__body" }, xt = {
586
+ }), [["__scopeId", "data-v-a6f20ec2"]]), Dt = { class: "doc-outline__header" }, Ot = { class: "doc-outline__body" }, kt = {
586
587
  key: 0,
587
588
  class: "doc-outline__empty"
588
- }, St = ["onMousedown"], Ct = /* @__PURE__ */ x(/* @__PURE__ */ j({
589
+ }, At = ["onMousedown"], jt = /* @__PURE__ */ x(/* @__PURE__ */ j({
589
590
  __name: "DocumentOutline",
590
591
  props: {
591
592
  isOpen: { type: Boolean },
@@ -599,7 +600,7 @@ var dt = /* @__PURE__ */ j({
599
600
  role: "navigation",
600
601
  "aria-label": "Document outline",
601
602
  onMousedown: n[1] ||= K(() => {}, ["stop"])
602
- }, [k("div", yt, [k("button", {
603
+ }, [k("div", Dt, [k("button", {
603
604
  class: "doc-outline__back",
604
605
  title: "Close outline",
605
606
  "aria-label": "Close outline",
@@ -607,14 +608,14 @@ var dt = /* @__PURE__ */ j({
607
608
  }, [A(c, {
608
609
  name: "arrow_back",
609
610
  size: 20
610
- })]), n[2] ||= k("span", { class: "doc-outline__title" }, "Document Outline", -1)]), k("div", bt, [e.headings.length === 0 ? (I(), O("div", xt, " No headings found ")) : D("", !0), (I(!0), O(w, null, R(e.headings, (e, n) => (I(), O("button", {
611
+ })]), n[2] ||= k("span", { class: "doc-outline__title" }, "Document Outline", -1)]), k("div", Ot, [e.headings.length === 0 ? (I(), O("div", kt, " No headings found ")) : D("", !0), (I(!0), O(C, null, R(e.headings, (e, n) => (I(), O("button", {
611
612
  key: n,
612
613
  class: "doc-outline__item",
613
614
  style: N({ paddingLeft: 12 + (e.level - 1) * 16 + "px" }),
614
615
  onMousedown: K((n) => t.$emit("navigate", e.pmPos), ["prevent"])
615
- }, z(e.text || "(untitled)"), 45, St))), 128))])], 32)) : D("", !0);
616
+ }, z(e.text || "(untitled)"), 45, At))), 128))])], 32)) : D("", !0);
616
617
  }
617
- }), [["__scopeId", "data-v-cb2cdc39"]]), wt = /* @__PURE__ */ x(/* @__PURE__ */ j({
618
+ }), [["__scopeId", "data-v-cb2cdc39"]]), Mt = /* @__PURE__ */ x(/* @__PURE__ */ j({
618
619
  __name: "PageIndicator",
619
620
  props: {
620
621
  currentPage: {},
@@ -633,10 +634,10 @@ var dt = /* @__PURE__ */ j({
633
634
  total: e.totalPages
634
635
  })), 5));
635
636
  }
636
- }), [["__scopeId", "data-v-d117bf6e"]]), Tt = { class: "hf-editor__label" }, Et = {
637
+ }), [["__scopeId", "data-v-d117bf6e"]]), Nt = { class: "hf-editor__label" }, Pt = {
637
638
  class: "hf-editor__actions",
638
639
  style: { position: "relative" }
639
- }, Dt = /* @__PURE__ */ x(/* @__PURE__ */ j({
640
+ }, Ft = /* @__PURE__ */ x(/* @__PURE__ */ j({
640
641
  __name: "InlineHeaderFooterEditor",
641
642
  props: {
642
643
  isOpen: { type: Boolean },
@@ -654,7 +655,7 @@ var dt = /* @__PURE__ */ j({
654
655
  function o(e) {
655
656
  let t = n.view;
656
657
  if (!t) return;
657
- let { $from: r, from: i } = t.state.selection, a = t.state.storedMarks || r.marks(), o = Pe.nodes.field.create({
658
+ let { $from: r, from: i } = t.state.selection, a = t.state.storedMarks || r.marks(), o = ze.nodes.field.create({
658
659
  fieldType: e,
659
660
  instruction: ` ${e} \\* MERGEFORMAT `,
660
661
  fieldKind: "simple",
@@ -680,7 +681,7 @@ var dt = /* @__PURE__ */ j({
680
681
  n.isOpen && s();
681
682
  }, { deep: !0 });
682
683
  function c() {
683
- n.view && (r("save", Me(n.view.state.doc)), r("close"));
684
+ n.view && (r("save", Ne(n.view.state.doc)), r("close"));
684
685
  }
685
686
  return (t, n) => e.isOpen ? (I(), O("div", {
686
687
  key: 0,
@@ -690,7 +691,7 @@ var dt = /* @__PURE__ */ j({
690
691
  class: M(["hf-editor__toolbar", e.position === "footer" ? "hf-editor__toolbar--below" : "hf-editor__toolbar--above"]),
691
692
  onMousedown: n[8] ||= K(() => {}, ["stop"]),
692
693
  onContextmenu: n[9] ||= K(() => {}, ["stop"])
693
- }, [k("span", Tt, z(e.position === "header" ? "Header" : "Footer"), 1), k("div", Et, [
694
+ }, [k("span", Nt, z(e.position === "header" ? "Header" : "Footer"), 1), k("div", Pt, [
694
695
  k("button", {
695
696
  class: "hf-editor__btn",
696
697
  title: "Options",
@@ -732,10 +733,144 @@ var dt = /* @__PURE__ */ j({
732
733
  }, " Cancel ", 32)
733
734
  ])], 34)], 4)) : D("", !0);
734
735
  }
735
- }), [["__scopeId", "data-v-e93a9f94"]]), Ot = {
736
+ }), [["__scopeId", "data-v-e93a9f94"]]), It = ["role"], Lt = {
737
+ key: 0,
738
+ class: "layout-sdt-widget-empty"
739
+ }, Rt = ["aria-selected", "onClick"], zt = ["value"], Bt = /* @__PURE__ */ j({
740
+ __name: "ContentControlWidgets",
741
+ props: {
742
+ container: {},
743
+ view: {}
744
+ },
745
+ setup(e) {
746
+ function t(e) {
747
+ let t = /^sdt@(\d+)$/.exec(e ?? "");
748
+ return t ? Number(t[1]) : null;
749
+ }
750
+ let n = e, r = L(null), i = L(null);
751
+ function a(e, t) {
752
+ let i = n.view;
753
+ if (i) try {
754
+ i.dispatch(Ve(i.state, { tag: e }, t)), i.focus();
755
+ } catch {}
756
+ r.value = null;
757
+ }
758
+ function o(e) {
759
+ let r = n.view, i = t(e.dataset.sdtGroupId);
760
+ if (!(!r || i == null)) try {
761
+ let t = e.dataset.sdtRepeat === "add" ? Fe(r.state, i) : Re(r.state, i);
762
+ r.dispatch(t), r.focus();
763
+ } catch {}
764
+ }
765
+ function s(e) {
766
+ let t = e.target;
767
+ (t?.closest?.(".layout-sdt-widget") || t?.closest?.(".layout-sdt-repeat-btn")) && e.preventDefault();
768
+ }
769
+ function c(e) {
770
+ let t = n.view, i = e.dataset.sdtTag, o = e.dataset.sdtWidget;
771
+ if (!t || !i || !o) return;
772
+ let s = X(t.state.doc, { tag: i })[0], c = e.getBoundingClientRect();
773
+ o === "checkbox" ? a(i, {
774
+ kind: "checkbox",
775
+ checked: !s?.checked
776
+ }) : o === "dropdown" ? r.value = {
777
+ kind: "dropdown",
778
+ tag: i,
779
+ items: s?.listItems ?? [],
780
+ current: s?.text ?? "",
781
+ x: c.left,
782
+ y: c.bottom + 2
783
+ } : o === "date" && (r.value = {
784
+ kind: "date",
785
+ tag: i,
786
+ current: s?.dateValue ?? "",
787
+ x: c.left,
788
+ y: c.bottom + 2
789
+ });
790
+ }
791
+ function l(e) {
792
+ let t = e.target?.closest?.(".layout-sdt-repeat-btn");
793
+ if (t) {
794
+ e.preventDefault(), e.stopPropagation(), o(t);
795
+ return;
796
+ }
797
+ let n = e.target?.closest?.(".layout-sdt-widget");
798
+ n && (e.preventDefault(), e.stopPropagation(), c(n));
799
+ }
800
+ function u(e) {
801
+ if (e.key !== "Enter" && e.key !== " ") return;
802
+ let t = e.target?.closest?.(".layout-sdt-widget");
803
+ t && (e.preventDefault(), c(t));
804
+ }
805
+ function d(e) {
806
+ r.value && !i.value?.contains(e.target) && (r.value = null);
807
+ }
808
+ function f(e) {
809
+ e.key === "Escape" && (r.value = null);
810
+ }
811
+ let p = null;
812
+ H(() => n.container, (e) => {
813
+ p && (p.removeEventListener("mousedown", s), p.removeEventListener("click", l), p.removeEventListener("keydown", u)), p = e ?? null, p && (p.addEventListener("mousedown", s), p.addEventListener("click", l), p.addEventListener("keydown", u));
814
+ }, { immediate: !0 }), H(r, (e) => {
815
+ e ? (document.addEventListener("mousedown", d), document.addEventListener("keydown", f), e.kind === "dropdown" && ce(() => {
816
+ let e = i.value?.querySelectorAll(".layout-sdt-widget-option");
817
+ e?.length && ([...e].find((e) => e.getAttribute("aria-selected") === "true") ?? e[0]).focus();
818
+ })) : (document.removeEventListener("mousedown", d), document.removeEventListener("keydown", f));
819
+ });
820
+ function m(e) {
821
+ if (e.key !== "ArrowDown" && e.key !== "ArrowUp") return;
822
+ let t = [...i.value?.querySelectorAll(".layout-sdt-widget-option") ?? []];
823
+ if (!t.length) return;
824
+ e.preventDefault();
825
+ let n = t.indexOf(document.activeElement);
826
+ t[e.key === "ArrowDown" ? (n + 1) % t.length : (n - 1 + t.length) % t.length].focus();
827
+ }
828
+ P(() => {
829
+ p && (p.removeEventListener("mousedown", s), p.removeEventListener("click", l), p.removeEventListener("keydown", u)), document.removeEventListener("mousedown", d), document.removeEventListener("keydown", f);
830
+ });
831
+ function h(e) {
832
+ let t = e.target.value;
833
+ t && r.value && a(r.value.tag, {
834
+ kind: "date",
835
+ date: t
836
+ });
837
+ }
838
+ return (e, t) => r.value ? (I(), O("div", {
839
+ key: 0,
840
+ ref_key: "popupEl",
841
+ ref: i,
842
+ class: "layout-sdt-widget-popup",
843
+ role: r.value.kind === "dropdown" ? "listbox" : void 0,
844
+ style: N({
845
+ position: "fixed",
846
+ top: r.value.y + "px",
847
+ left: r.value.x + "px",
848
+ zIndex: 1e3
849
+ }),
850
+ onKeydown: m,
851
+ onMousedown: t[0] ||= K(() => {}, ["prevent"])
852
+ }, [r.value.kind === "dropdown" ? (I(), O(C, { key: 0 }, [r.value.items.length === 0 ? (I(), O("div", Lt, "No options")) : D("", !0), (I(!0), O(C, null, R(r.value.items, (e) => (I(), O("button", {
853
+ key: e.value,
854
+ type: "button",
855
+ role: "option",
856
+ "aria-selected": e.displayText === r.value.current,
857
+ class: M(["layout-sdt-widget-option", { "is-selected": e.displayText === r.value.current }]),
858
+ onClick: (t) => a(r.value.tag, {
859
+ kind: "dropdown",
860
+ value: e.value
861
+ })
862
+ }, z(e.displayText), 11, Rt))), 128))], 64)) : (I(), O("input", {
863
+ key: 1,
864
+ type: "date",
865
+ class: "layout-sdt-widget-date",
866
+ value: r.value.current,
867
+ onChange: h
868
+ }, null, 40, zt))], 44, It)) : D("", !0);
869
+ }
870
+ }), Vt = {
736
871
  key: 0,
737
872
  class: "docx-editor-vue__title-bar"
738
- }, kt = { class: "docx-editor-vue__title-bar-left" }, At = { class: "docx-editor-vue__title-bar-center" }, jt = { class: "docx-editor-vue__title-bar-right" }, Mt = /* @__PURE__ */ j({
873
+ }, Ht = { class: "docx-editor-vue__title-bar-left" }, Ut = { class: "docx-editor-vue__title-bar-center" }, Wt = { class: "docx-editor-vue__title-bar-right" }, Gt = /* @__PURE__ */ j({
739
874
  __name: "DocxEditorMenuBar",
740
875
  props: {
741
876
  showMenuBar: { type: Boolean },
@@ -754,9 +889,9 @@ var dt = /* @__PURE__ */ j({
754
889
  ],
755
890
  setup(e, { emit: t }) {
756
891
  let n = t;
757
- return (t, r) => e.showMenuBar ? (I(), O("div", Ot, [
758
- k("div", kt, [e.renderLogo ? (I(), ie(ue(e.renderLogo), { key: 0 })) : D("", !0), le(t.$slots, "title-bar-left")]),
759
- k("div", At, [A(g, {
892
+ return (t, r) => e.showMenuBar ? (I(), O("div", Vt, [
893
+ k("div", Ht, [e.renderLogo ? (I(), E(ue(e.renderLogo), { key: 0 })) : D("", !0), le(t.$slots, "title-bar-left")]),
894
+ k("div", Ut, [A(g, {
760
895
  "model-value": e.documentName,
761
896
  editable: e.documentNameEditable,
762
897
  "onUpdate:modelValue": r[0] ||= (e) => n("rename", e)
@@ -764,10 +899,10 @@ var dt = /* @__PURE__ */ j({
764
899
  onAction: r[1] ||= (e) => n("menu-action", e),
765
900
  onInsertTable: r[2] ||= (e, t) => n("insert-table", e, t)
766
901
  })]),
767
- k("div", jt, [le(t.$slots, "title-bar-right"), e.renderTitleBarRight ? (I(), ie(ue(e.renderTitleBarRight), { key: 0 })) : D("", !0)])
902
+ k("div", Wt, [le(t.$slots, "title-bar-right"), e.renderTitleBarRight ? (I(), E(ue(e.renderTitleBarRight), { key: 0 })) : D("", !0)])
768
903
  ])) : D("", !0);
769
904
  }
770
- }), Nt = /* @__PURE__ */ j({
905
+ }), Kt = /* @__PURE__ */ j({
771
906
  __name: "DocxEditorDialogs",
772
907
  props: {
773
908
  view: {},
@@ -799,7 +934,7 @@ var dt = /* @__PURE__ */ j({
799
934
  ],
800
935
  setup(t, { emit: n }) {
801
936
  let r = n;
802
- return (n, a) => (I(), O(w, null, [
937
+ return (n, a) => (I(), O(C, null, [
803
938
  A(u, {
804
939
  "is-open": t.showFindReplace,
805
940
  view: t.view,
@@ -854,10 +989,10 @@ var dt = /* @__PURE__ */ j({
854
989
  }, null, 8, ["is-open"])
855
990
  ], 64));
856
991
  }
857
- }), Pt = ["disabled", "onMousedown"], Ft = { class: "ctx-menu__label" }, It = {
992
+ }), qt = ["disabled", "onMousedown"], Jt = { class: "ctx-menu__label" }, Yt = {
858
993
  key: 0,
859
994
  class: "ctx-menu__shortcut"
860
- }, Lt = 220, Rt = 32, zt = 10, Bt = /* @__PURE__ */ x(/* @__PURE__ */ j({
995
+ }, Xt = 220, Zt = 32, Qt = 10, $t = /* @__PURE__ */ x(/* @__PURE__ */ j({
861
996
  __name: "TextContextMenu",
862
997
  props: {
863
998
  isOpen: { type: Boolean },
@@ -871,7 +1006,7 @@ var dt = /* @__PURE__ */ j({
871
1006
  },
872
1007
  emits: ["close", "action"],
873
1008
  setup(e, { emit: t }) {
874
- let n = e, r = t, i = L(null), a = E(() => {
1009
+ let n = e, r = t, i = L(null), a = T(() => {
875
1010
  let e = [
876
1011
  {
877
1012
  id: "cut",
@@ -989,9 +1124,9 @@ var dt = /* @__PURE__ */ j({
989
1124
  action: "splitCell",
990
1125
  disabled: !n.canSplitCell
991
1126
  }), e;
992
- }), o = E(() => {
993
- let e = n.position.x, t = n.position.y, r = a.value.filter((e) => !e.divider).length, i = a.value.filter((e) => e.divider).length, o = r * Rt + i * 9;
994
- return typeof window < "u" && (e + Lt + zt > window.innerWidth && (e = window.innerWidth - Lt - zt), t + o + zt > window.innerHeight && (t = window.innerHeight - o - zt)), {
1127
+ }), o = T(() => {
1128
+ let e = n.position.x, t = n.position.y, r = a.value.filter((e) => !e.divider).length, i = a.value.filter((e) => e.divider).length, o = r * Zt + i * 9;
1129
+ return typeof window < "u" && (e + Xt + Qt > window.innerWidth && (e = window.innerWidth - Xt - Qt), t + o + Qt > window.innerHeight && (t = window.innerHeight - o - Qt)), {
995
1130
  position: "fixed",
996
1131
  left: `${e}px`,
997
1132
  top: `${t}px`,
@@ -1006,7 +1141,7 @@ var dt = /* @__PURE__ */ j({
1006
1141
  }
1007
1142
  return H(() => n.isOpen, (e) => {
1008
1143
  e && ce(() => i.value?.focus());
1009
- }), (t, n) => (I(), ie(T, { to: "body" }, [e.isOpen ? (I(), O("div", {
1144
+ }), (t, n) => (I(), E(w, { to: "body" }, [e.isOpen ? (I(), O("div", {
1010
1145
  key: 0,
1011
1146
  class: "ctx-menu-backdrop",
1012
1147
  onMousedown: n[0] ||= (e) => t.$emit("close"),
@@ -1019,7 +1154,7 @@ var dt = /* @__PURE__ */ j({
1019
1154
  style: N(o.value),
1020
1155
  onContextmenu: n[2] ||= K(() => {}, ["prevent"]),
1021
1156
  onKeydown: c
1022
- }, [(I(!0), O(w, null, R(a.value, (e, t) => (I(), O("button", {
1157
+ }, [(I(!0), O(C, null, R(a.value, (e, t) => (I(), O("button", {
1023
1158
  key: e.id || t,
1024
1159
  class: M(["ctx-menu__item", {
1025
1160
  "ctx-menu__item--disabled": e.disabled,
@@ -1027,27 +1162,27 @@ var dt = /* @__PURE__ */ j({
1027
1162
  }]),
1028
1163
  disabled: e.disabled,
1029
1164
  onMousedown: K((t) => s(e.action), ["prevent"])
1030
- }, [k("span", Ft, z(e.label), 1), e.shortcut ? (I(), O("span", It, z(e.shortcut), 1)) : D("", !0)], 42, Pt))), 128))], 36)) : D("", !0)]));
1165
+ }, [k("span", Jt, z(e.label), 1), e.shortcut ? (I(), O("span", Yt, z(e.shortcut), 1)) : D("", !0)], 42, qt))), 128))], 36)) : D("", !0)]));
1031
1166
  }
1032
- }), [["__scopeId", "data-v-741c4f71"]]), Vt = ["aria-label"], Ht = { class: "image-ctx-menu__icon" }, Ut = { class: "image-ctx-menu__label" }, Wt = {
1167
+ }), [["__scopeId", "data-v-741c4f71"]]), en = ["aria-label"], tn = { class: "image-ctx-menu__icon" }, nn = { class: "image-ctx-menu__label" }, rn = {
1033
1168
  key: 1,
1034
1169
  class: "image-ctx-menu__divider",
1035
1170
  role: "separator"
1036
- }, Gt = [
1171
+ }, an = [
1037
1172
  "data-wrap-type",
1038
1173
  "data-current",
1039
1174
  "data-disabled",
1040
1175
  "disabled",
1041
1176
  "title",
1042
1177
  "onClick"
1043
- ], Kt = { class: "image-ctx-menu__icon" }, qt = { class: "image-ctx-menu__label" }, Jt = ["aria-label"], Yt = ["disabled", "onClick"], Xt = { class: "image-ctx-menu__label" }, Zt = {
1178
+ ], on = { class: "image-ctx-menu__icon" }, sn = { class: "image-ctx-menu__label" }, cn = ["aria-label"], ln = ["disabled", "onClick"], un = { class: "image-ctx-menu__label" }, dn = {
1044
1179
  key: 0,
1045
1180
  class: "image-ctx-menu__shortcut"
1046
- }, Qt = {
1181
+ }, fn = {
1047
1182
  key: 0,
1048
1183
  class: "image-ctx-menu__divider",
1049
1184
  role: "separator"
1050
- }, $t = 18, en = 260, tn = 10, nn = /* @__PURE__ */ x(/* @__PURE__ */ j({
1185
+ }, pn = 18, mn = 260, Q = 10, $ = /* @__PURE__ */ x(/* @__PURE__ */ j({
1051
1186
  __name: "ImageContextMenu",
1052
1187
  props: {
1053
1188
  state: {},
@@ -1068,7 +1203,7 @@ var dt = /* @__PURE__ */ j({
1068
1203
  function a() {
1069
1204
  i("open-properties"), i("close");
1070
1205
  }
1071
- let { t: o } = n(), s = L(null), l = X, u = E(() => r.state ? Oe(r.state.currentWrapType, r.state.currentCssFloat ?? null) : null), d = {
1206
+ let { t: o } = n(), s = L(null), l = Y, u = T(() => r.state ? ke(r.state.currentWrapType, r.state.currentCssFloat ?? null) : null), d = {
1072
1207
  inline: "wrap_text",
1073
1208
  squareLeft: "format_image_left",
1074
1209
  squareRight: "format_image_right",
@@ -1078,19 +1213,19 @@ var dt = /* @__PURE__ */ j({
1078
1213
  function f(e) {
1079
1214
  return d[e];
1080
1215
  }
1081
- let p = E(() => {
1216
+ let p = T(() => {
1082
1217
  if (!r.state) return {};
1083
- let e = X.length * 36 + 16, t = r.state.position.x, n = r.state.position.y;
1084
- return typeof window < "u" && (t + en > window.innerWidth && (t = window.innerWidth - en - tn), n + e > window.innerHeight && (n = window.innerHeight - e - tn), t < tn && (t = tn), n < tn && (n = tn)), {
1218
+ let e = Y.length * 36 + 16, t = r.state.position.x, n = r.state.position.y;
1219
+ return typeof window < "u" && (t + mn > window.innerWidth && (t = window.innerWidth - mn - Q), n + e > window.innerHeight && (n = window.innerHeight - e - Q), t < Q && (t = Q), n < Q && (n = Q)), {
1085
1220
  position: "fixed",
1086
1221
  left: `${t}px`,
1087
1222
  top: `${n}px`,
1088
- minWidth: `${en}px`,
1223
+ minWidth: `${mn}px`,
1089
1224
  zIndex: 400
1090
1225
  };
1091
1226
  });
1092
1227
  function m(e) {
1093
- return r.state ? Ae(e, r.state.currentWrapType) : !1;
1228
+ return r.state ? je(e, r.state.currentWrapType) : !1;
1094
1229
  }
1095
1230
  function h(e) {
1096
1231
  m(e) && (i("select", e.choice), i("close"));
@@ -1104,7 +1239,7 @@ var dt = /* @__PURE__ */ j({
1104
1239
  function v(e) {
1105
1240
  e.key === "Escape" && (e.preventDefault(), i("close"));
1106
1241
  }
1107
- return (t, n) => (I(), ie(T, { to: "body" }, [e.state && e.state.open ? (I(), O("div", {
1242
+ return (t, n) => (I(), E(w, { to: "body" }, [e.state && e.state.open ? (I(), O("div", {
1108
1243
  key: 0,
1109
1244
  class: "image-ctx-menu-backdrop",
1110
1245
  onMousedown: _,
@@ -1129,12 +1264,12 @@ var dt = /* @__PURE__ */ j({
1129
1264
  "data-action": "open-properties",
1130
1265
  onMousedown: n[1] ||= K(() => {}, ["prevent"]),
1131
1266
  onClick: a
1132
- }, [k("span", Ht, [A(c, {
1267
+ }, [k("span", tn, [A(c, {
1133
1268
  name: "settings",
1134
- size: $t
1135
- })]), k("span", Ut, z(B(o)("imageWrap.menu.imageProperties")), 1)], 32)) : D("", !0),
1136
- e.canOpenProperties ? (I(), O("div", Wt)) : D("", !0),
1137
- (I(!0), O(w, null, R(B(l), (e) => (I(), O("button", {
1269
+ size: pn
1270
+ })]), k("span", nn, z(B(o)("imageWrap.menu.imageProperties")), 1)], 32)) : D("", !0),
1271
+ e.canOpenProperties ? (I(), O("div", rn)) : D("", !0),
1272
+ (I(!0), O(C, null, R(B(l), (e) => (I(), O("button", {
1138
1273
  key: e.choice,
1139
1274
  type: "button",
1140
1275
  role: "menuitem",
@@ -1147,31 +1282,31 @@ var dt = /* @__PURE__ */ j({
1147
1282
  onMousedown: n[2] ||= K(() => {}, ["prevent"]),
1148
1283
  onClick: (t) => h(e)
1149
1284
  }, [
1150
- k("span", Kt, [A(c, {
1285
+ k("span", on, [A(c, {
1151
1286
  name: f(e.iconHint),
1152
- size: $t
1287
+ size: pn
1153
1288
  }, null, 8, ["name"])]),
1154
- k("span", qt, z(B(o)(`imageWrap.menu.${e.i18nLabelKey}`)), 1),
1289
+ k("span", sn, z(B(o)(`imageWrap.menu.${e.i18nLabelKey}`)), 1),
1155
1290
  e.choice === u.value ? (I(), O("span", {
1156
1291
  key: 0,
1157
1292
  class: "image-ctx-menu__current-dot",
1158
1293
  "aria-label": B(o)("imageWrap.menu.ariaLabel")
1159
- }, "●", 8, Jt)) : D("", !0)
1160
- ], 42, Gt))), 128)),
1161
- e.textActions && e.textActions.length > 0 ? (I(), O(w, { key: 2 }, [n[5] ||= k("div", {
1294
+ }, "●", 8, cn)) : D("", !0)
1295
+ ], 42, an))), 128)),
1296
+ e.textActions && e.textActions.length > 0 ? (I(), O(C, { key: 2 }, [n[5] ||= k("div", {
1162
1297
  class: "image-ctx-menu__divider",
1163
1298
  role: "separator"
1164
- }, null, -1), (I(!0), O(w, null, R(e.textActions, (e, t) => (I(), O(w, { key: `${e.action}-${t}` }, [k("button", {
1299
+ }, null, -1), (I(!0), O(C, null, R(e.textActions, (e, t) => (I(), O(C, { key: `${e.action}-${t}` }, [k("button", {
1165
1300
  type: "button",
1166
1301
  role: "menuitem",
1167
1302
  class: "image-ctx-menu__item image-ctx-menu__item--text",
1168
1303
  disabled: e.disabled,
1169
1304
  onMousedown: n[3] ||= K(() => {}, ["prevent"]),
1170
1305
  onClick: (t) => g(e)
1171
- }, [k("span", Xt, z(e.label), 1), e.shortcut ? (I(), O("span", Zt, z(e.shortcut), 1)) : D("", !0)], 40, Yt), e.dividerAfter ? (I(), O("div", Qt)) : D("", !0)], 64))), 128))], 64)) : D("", !0)
1172
- ], 44, Vt)) : D("", !0)]));
1306
+ }, [k("span", un, z(e.label), 1), e.shortcut ? (I(), O("span", dn, z(e.shortcut), 1)) : D("", !0)], 40, ln), e.dividerAfter ? (I(), O("div", fn)) : D("", !0)], 64))), 128))], 64)) : D("", !0)
1307
+ ], 44, en)) : D("", !0)]));
1173
1308
  }
1174
- }), [["__scopeId", "data-v-5c21ca8c"]]), rn = /* @__PURE__ */ j({
1309
+ }), [["__scopeId", "data-v-5c21ca8c"]]), hn = /* @__PURE__ */ j({
1175
1310
  __name: "DocxEditorOverlays",
1176
1311
  props: {
1177
1312
  readOnly: { type: Boolean },
@@ -1189,7 +1324,7 @@ var dt = /* @__PURE__ */ j({
1189
1324
  ],
1190
1325
  setup(e, { emit: t }) {
1191
1326
  let n = t;
1192
- return (t, r) => (I(), O(w, null, [A(Bt, {
1327
+ return (t, r) => (I(), O(C, null, [A($t, {
1193
1328
  "is-open": e.contextMenu.isOpen,
1194
1329
  position: e.contextMenu.position,
1195
1330
  "has-selection": e.contextMenu.hasSelection,
@@ -1209,7 +1344,7 @@ var dt = /* @__PURE__ */ j({
1209
1344
  "on-image",
1210
1345
  "can-merge-cells",
1211
1346
  "can-split-cell"
1212
- ]), A(nn, {
1347
+ ]), A($, {
1213
1348
  state: e.imageContextMenu,
1214
1349
  "text-actions": e.imageContextMenuTextActions,
1215
1350
  "can-open-properties": e.canOpenImageProperties,
@@ -1223,7 +1358,7 @@ var dt = /* @__PURE__ */ j({
1223
1358
  "can-open-properties"
1224
1359
  ])], 64));
1225
1360
  }
1226
- }), an = ["href", "title"], on = ["title"], sn = ["title"], cn = ["title"], ln = { class: "docx-hyperlink-popup__edit-row" }, un = ["placeholder", "onKeydown"], dn = { class: "docx-hyperlink-popup__edit-row" }, fn = ["onKeydown"], pn = ["disabled"], mn = /* @__PURE__ */ x(/* @__PURE__ */ j({
1361
+ }), gn = ["href", "title"], _n = ["title"], vn = ["title"], yn = ["title"], bn = { class: "docx-hyperlink-popup__edit-row" }, xn = ["placeholder", "onKeydown"], Sn = { class: "docx-hyperlink-popup__edit-row" }, Cn = ["onKeydown"], wn = ["disabled"], Tn = /* @__PURE__ */ x(/* @__PURE__ */ j({
1227
1362
  __name: "HyperlinkPopup",
1228
1363
  props: {
1229
1364
  data: {},
@@ -1237,7 +1372,7 @@ var dt = /* @__PURE__ */ j({
1237
1372
  "close"
1238
1373
  ],
1239
1374
  setup(e, { emit: t }) {
1240
- let { t: r } = n(), i = e, a = t, o = L(!1), s = L(""), c = L(""), l = L(null), u = E(() => ({
1375
+ let { t: r } = n(), i = e, a = t, o = L(!1), s = L(""), c = L(""), l = L(null), u = T(() => ({
1241
1376
  left: (i.data?.position.left ?? 0) + "px",
1242
1377
  top: (i.data?.position.top ?? 0) + "px"
1243
1378
  }));
@@ -1272,28 +1407,28 @@ var dt = /* @__PURE__ */ j({
1272
1407
  class: M(["docx-hyperlink-popup", { "docx-hyperlink-popup--edit": o.value }]),
1273
1408
  style: N(u.value),
1274
1409
  onMousedown: n[6] ||= K(() => {}, ["stop"])
1275
- }, [o.value ? (I(), O(w, { key: 1 }, [k("div", ln, [W(k("input", {
1410
+ }, [o.value ? (I(), O(C, { key: 1 }, [k("div", bn, [W(k("input", {
1276
1411
  class: "docx-hyperlink-popup__input",
1277
1412
  placeholder: B(r)("hyperlinkPopup.displayTextPlaceholder"),
1278
1413
  "onUpdate:modelValue": n[2] ||= (e) => s.value = e,
1279
1414
  onKeydown: [G(K(h, ["prevent"]), ["enter"]), n[3] ||= G((e) => t.$emit("close"), ["esc"])]
1280
- }, null, 40, un), [[V, s.value]])]), k("div", dn, [W(k("input", {
1415
+ }, null, 40, xn), [[V, s.value]])]), k("div", Sn, [W(k("input", {
1281
1416
  class: "docx-hyperlink-popup__input",
1282
1417
  placeholder: "https://...",
1283
1418
  "onUpdate:modelValue": n[4] ||= (e) => c.value = e,
1284
1419
  onKeydown: [G(K(h, ["prevent"]), ["enter"]), n[5] ||= G((e) => t.$emit("close"), ["esc"])]
1285
- }, null, 40, fn), [[V, c.value]]), k("button", {
1420
+ }, null, 40, Cn), [[V, c.value]]), k("button", {
1286
1421
  class: "docx-hyperlink-popup__apply",
1287
1422
  disabled: !c.value.trim(),
1288
1423
  onClick: K(h, ["prevent"])
1289
- }, z(B(r)("common.apply")), 9, pn)])], 64)) : (I(), O(w, { key: 0 }, [
1424
+ }, z(B(r)("common.apply")), 9, wn)])], 64)) : (I(), O(C, { key: 0 }, [
1290
1425
  n[10] ||= oe("<span class=\"docx-hyperlink-popup__icon\" aria-hidden data-v-9d23bb12><svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" data-v-9d23bb12><circle cx=\"12\" cy=\"12\" r=\"10\" data-v-9d23bb12></circle><path d=\"M2 12h20\" data-v-9d23bb12></path><path d=\"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z\" data-v-9d23bb12></path></svg></span>", 1),
1291
1426
  k("a", {
1292
1427
  class: "docx-hyperlink-popup__url",
1293
1428
  href: e.data.href,
1294
1429
  title: e.data.href,
1295
1430
  onClick: n[0] ||= K((n) => t.$emit("navigate", e.data.href), ["prevent"])
1296
- }, z(e.data.href), 9, an),
1431
+ }, z(e.data.href), 9, gn),
1297
1432
  n[11] ||= k("span", { class: "docx-hyperlink-popup__sep" }, null, -1),
1298
1433
  k("button", {
1299
1434
  class: "docx-hyperlink-popup__btn",
@@ -1315,7 +1450,7 @@ var dt = /* @__PURE__ */ j({
1315
1450
  height: "13",
1316
1451
  rx: "2",
1317
1452
  ry: "2"
1318
- }), k("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })], -1)]], 8, on),
1453
+ }), k("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })], -1)]], 8, _n),
1319
1454
  e.readOnly ? D("", !0) : (I(), O("button", {
1320
1455
  key: 0,
1321
1456
  class: "docx-hyperlink-popup__btn",
@@ -1330,26 +1465,26 @@ var dt = /* @__PURE__ */ j({
1330
1465
  "stroke-width": "2",
1331
1466
  "stroke-linecap": "round",
1332
1467
  "stroke-linejoin": "round"
1333
- }, [k("path", { d: "M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" }), k("path", { d: "M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z" })], -1)]], 8, sn)),
1468
+ }, [k("path", { d: "M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" }), k("path", { d: "M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z" })], -1)]], 8, vn)),
1334
1469
  e.readOnly ? D("", !0) : (I(), O("button", {
1335
1470
  key: 1,
1336
1471
  class: "docx-hyperlink-popup__btn",
1337
1472
  title: B(r)("hyperlinkPopup.removeLink"),
1338
1473
  onClick: n[1] ||= K((e) => t.$emit("remove"), ["prevent"])
1339
- }, [...n[9] ||= [oe("<svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" data-v-9d23bb12><path d=\"M18.84 12.25l1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71\" data-v-9d23bb12></path><path d=\"M5.17 11.75l-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71\" data-v-9d23bb12></path><line x1=\"8\" y1=\"2\" x2=\"8\" y2=\"5\" data-v-9d23bb12></line><line x1=\"2\" y1=\"8\" x2=\"5\" y2=\"8\" data-v-9d23bb12></line><line x1=\"16\" y1=\"19\" x2=\"16\" y2=\"22\" data-v-9d23bb12></line><line x1=\"19\" y1=\"16\" x2=\"22\" y2=\"16\" data-v-9d23bb12></line></svg>", 1)]], 8, cn))
1474
+ }, [...n[9] ||= [oe("<svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" data-v-9d23bb12><path d=\"M18.84 12.25l1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71\" data-v-9d23bb12></path><path d=\"M5.17 11.75l-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71\" data-v-9d23bb12></path><line x1=\"8\" y1=\"2\" x2=\"8\" y2=\"5\" data-v-9d23bb12></line><line x1=\"2\" y1=\"8\" x2=\"5\" y2=\"8\" data-v-9d23bb12></line><line x1=\"16\" y1=\"19\" x2=\"16\" y2=\"22\" data-v-9d23bb12></line><line x1=\"19\" y1=\"16\" x2=\"22\" y2=\"16\" data-v-9d23bb12></line></svg>", 1)]], 8, yn))
1340
1475
  ], 64))], 38)) : D("", !0);
1341
1476
  }
1342
1477
  }), [["__scopeId", "data-v-9d23bb12"]]);
1343
1478
  //#endregion
1344
1479
  //#region src/composables/useFileIO.ts
1345
- function hn(e) {
1480
+ function En(e) {
1346
1481
  let t = L(null);
1347
1482
  async function n() {
1348
1483
  await e.nextTick(), e.extractCommentsAndChanges(), e.emit("ready");
1349
1484
  }
1350
1485
  async function r(t) {
1351
1486
  try {
1352
- let r = await xe(t);
1487
+ let r = await Se(t);
1353
1488
  if (!r) return;
1354
1489
  await e.loadBuffer(r.buffer), e.emit("update:document", e.getDocument()), e.emit("rename", r.name), await n();
1355
1490
  } catch (t) {
@@ -1388,7 +1523,7 @@ function hn(e) {
1388
1523
  }
1389
1524
  //#endregion
1390
1525
  //#region src/composables/useHyperlinkManagement.ts
1391
- function gn(e) {
1526
+ function Dn(e) {
1392
1527
  let t = L(null);
1393
1528
  function n(t) {
1394
1529
  let n = e.editorView.value;
@@ -1417,7 +1552,7 @@ function gn(e) {
1417
1552
  function a(n, r) {
1418
1553
  let i = e.editorView.value;
1419
1554
  if (!i) return;
1420
- let a = Y(i.state);
1555
+ let a = J(i.state);
1421
1556
  if (!a) {
1422
1557
  t.value = null;
1423
1558
  return;
@@ -1431,7 +1566,7 @@ function gn(e) {
1431
1566
  function o() {
1432
1567
  let n = e.editorView.value;
1433
1568
  if (!n) return;
1434
- let r = Y(n.state, t.value?.href);
1569
+ let r = J(n.state, t.value?.href);
1435
1570
  if (!r) {
1436
1571
  t.value = null;
1437
1572
  return;
@@ -1450,27 +1585,27 @@ function gn(e) {
1450
1585
  }
1451
1586
  //#endregion
1452
1587
  //#region src/composables/useFormattingActions.ts
1453
- function _n(e) {
1588
+ function On(e) {
1454
1589
  function t() {
1455
1590
  let t = e.editorView.value;
1456
- t && (J(t.state, t.dispatch, t), t.focus());
1591
+ t && (q(t.state, t.dispatch, t), t.focus());
1457
1592
  }
1458
1593
  function n(t) {
1459
1594
  let n = e.editorView.value;
1460
1595
  if (!n) return;
1461
1596
  let r = e.getDocument()?.package?.styles;
1462
1597
  if (r) {
1463
- let e = Ue(r).resolveParagraphStyle(t);
1464
- Re(t, {
1598
+ let e = Xe(r).resolveParagraphStyle(t);
1599
+ Z(t, {
1465
1600
  paragraphFormatting: e.paragraphFormatting,
1466
1601
  runFormatting: e.runFormatting
1467
1602
  })(n.state, (e) => n.dispatch(e));
1468
- } else Re(t)(n.state, (e) => n.dispatch(e));
1603
+ } else Z(t)(n.state, (e) => n.dispatch(e));
1469
1604
  n.focus();
1470
1605
  }
1471
1606
  function r() {
1472
1607
  let t = e.editorView.value;
1473
- t && (We(t.state, (e) => t.dispatch(e), t), t.focus());
1608
+ t && (Ze(t.state, (e) => t.dispatch(e), t), t.focus());
1474
1609
  }
1475
1610
  function i(t) {
1476
1611
  let n = e.editorView.value;
@@ -1481,11 +1616,11 @@ function _n(e) {
1481
1616
  function a(t) {
1482
1617
  let n = e.editorView.value;
1483
1618
  if (!n) return !1;
1484
- let r = it(n.state.doc, t.paraId);
1619
+ let r = ft(n.state.doc, t.paraId);
1485
1620
  if (!r) return !1;
1486
1621
  let i = r.from + 1, a = r.to - 1;
1487
1622
  if (t.search) {
1488
- let e = st(n.state.doc, r.from, r.to, t.search);
1623
+ let e = ht(n.state.doc, r.from, r.to, t.search);
1489
1624
  if (!e) return !1;
1490
1625
  i = e.from, a = e.to;
1491
1626
  }
@@ -1498,7 +1633,7 @@ function _n(e) {
1498
1633
  return s.strike !== void 0 && o.marks.strike && (c = s.strike ? c.addMark(i, a, o.marks.strike.create()) : c.removeMark(i, a, o.marks.strike)), s.color !== void 0 && o.marks.textColor && (c = s.color && (s.color.rgb || s.color.themeColor) ? c.addMark(i, a, o.marks.textColor.create({
1499
1634
  rgb: s.color.rgb ?? null,
1500
1635
  themeColor: s.color.themeColor ?? null
1501
- })) : c.removeMark(i, a, o.marks.textColor)), s.highlight !== void 0 && o.marks.highlight && (c = s.highlight ? c.addMark(i, a, o.marks.highlight.create({ color: Ge(s.highlight) || s.highlight })) : c.removeMark(i, a, o.marks.highlight)), s.fontSize !== void 0 && o.marks.fontSize && (c = s.fontSize > 0 ? c.addMark(i, a, o.marks.fontSize.create({ size: Fe(s.fontSize) })) : c.removeMark(i, a, o.marks.fontSize)), s.fontFamily !== void 0 && o.marks.fontFamily && (c = s.fontFamily && (s.fontFamily.ascii || s.fontFamily.hAnsi) ? c.addMark(i, a, o.marks.fontFamily.create({
1636
+ })) : c.removeMark(i, a, o.marks.textColor)), s.highlight !== void 0 && o.marks.highlight && (c = s.highlight ? c.addMark(i, a, o.marks.highlight.create({ color: Qe(s.highlight) || s.highlight })) : c.removeMark(i, a, o.marks.highlight)), s.fontSize !== void 0 && o.marks.fontSize && (c = s.fontSize > 0 ? c.addMark(i, a, o.marks.fontSize.create({ size: He(s.fontSize) })) : c.removeMark(i, a, o.marks.fontSize)), s.fontFamily !== void 0 && o.marks.fontFamily && (c = s.fontFamily && (s.fontFamily.ascii || s.fontFamily.hAnsi) ? c.addMark(i, a, o.marks.fontFamily.create({
1502
1637
  ascii: s.fontFamily.ascii ?? null,
1503
1638
  hAnsi: s.fontFamily.hAnsi ?? s.fontFamily.ascii ?? null
1504
1639
  })) : c.removeMark(i, a, o.marks.fontFamily)), n.dispatch(c), !0;
@@ -1506,17 +1641,17 @@ function _n(e) {
1506
1641
  function o(t) {
1507
1642
  let n = e.editorView.value;
1508
1643
  if (!n) return !1;
1509
- let r = it(n.state.doc, t.paraId);
1644
+ let r = ft(n.state.doc, t.paraId);
1510
1645
  if (!r) return !1;
1511
- let i = e.getDocument(), a = i?.package?.styles ? Ue(i.package.styles) : null;
1646
+ let i = e.getDocument(), a = i?.package?.styles ? Xe(i.package.styles) : null;
1512
1647
  if (a && !a.hasParagraphStyle(t.styleId)) return !1;
1513
- let o = n.state.doc.resolve(r.from + 1), s = n.state.doc.resolve(r.to - 1), c = n.state.apply(n.state.tr.setSelection(fe.between(o, s))), l = a ? (() => {
1648
+ let o = n.state.doc.resolve(r.from + 1), s = n.state.doc.resolve(r.to - 1), c = n.state.apply(n.state.tr.setSelection(pe.between(o, s))), l = a ? (() => {
1514
1649
  let e = a.resolveParagraphStyle(t.styleId);
1515
- return Re(t.styleId, {
1650
+ return Z(t.styleId, {
1516
1651
  paragraphFormatting: e.paragraphFormatting,
1517
1652
  runFormatting: e.runFormatting
1518
1653
  });
1519
- })() : Re(t.styleId), u = !1;
1654
+ })() : Z(t.styleId), u = !1;
1520
1655
  return l(c, (e) => {
1521
1656
  u = !0, e.setSelection(n.state.selection.map(e.doc, e.mapping)), n.dispatch(e);
1522
1657
  }), u;
@@ -1532,7 +1667,7 @@ function _n(e) {
1532
1667
  }
1533
1668
  //#endregion
1534
1669
  //#region src/composables/usePageSetupControls.ts
1535
- function vn(e) {
1670
+ function kn(e) {
1536
1671
  function t(t) {
1537
1672
  let n = e.getDocument();
1538
1673
  if (!n?.package?.document) return;
@@ -1559,19 +1694,19 @@ function vn(e) {
1559
1694
  }
1560
1695
  function s(t) {
1561
1696
  let n = e.editorView.value;
1562
- n && Ve(t)(n.state, n.dispatch);
1697
+ n && Je(t)(n.state, n.dispatch);
1563
1698
  }
1564
1699
  function c(t) {
1565
1700
  let n = e.editorView.value;
1566
- n && He(t)(n.state, n.dispatch);
1701
+ n && Ye(t)(n.state, n.dispatch);
1567
1702
  }
1568
1703
  function l(t) {
1569
1704
  let n = e.editorView.value;
1570
- n && (t < 0 ? Be(-t, !0)(n.state, n.dispatch) : Be(t, !1)(n.state, n.dispatch));
1705
+ n && (t < 0 ? qe(-t, !0)(n.state, n.dispatch) : qe(t, !1)(n.state, n.dispatch));
1571
1706
  }
1572
1707
  function u(t) {
1573
1708
  let n = e.editorView.value;
1574
- n && ze(t)(n.state, n.dispatch);
1709
+ n && Ke(t)(n.state, n.dispatch);
1575
1710
  }
1576
1711
  return {
1577
1712
  handlePageSetupApply: t,
@@ -1587,18 +1722,18 @@ function vn(e) {
1587
1722
  }
1588
1723
  //#endregion
1589
1724
  //#region src/composables/useOutlineSidebar.ts
1590
- function yn(e) {
1725
+ function An(e) {
1591
1726
  function t() {
1592
1727
  if (!e.showOutline.value) {
1593
1728
  let t = e.editorView.value;
1594
- t && (e.outlineHeadings.value = Ke(t.state.doc));
1729
+ t && (e.outlineHeadings.value = $e(t.state.doc));
1595
1730
  }
1596
1731
  e.showOutline.value = !e.showOutline.value;
1597
1732
  }
1598
1733
  function n(t) {
1599
1734
  let n = e.editorView.value;
1600
1735
  if (!n) return;
1601
- let r = n.state.doc.resolve(Math.min(t + 1, n.state.doc.content.size)), i = fe.near(r);
1736
+ let r = n.state.doc.resolve(Math.min(t + 1, n.state.doc.content.size)), i = pe.near(r);
1602
1737
  n.dispatch(n.state.tr.setSelection(i).scrollIntoView()), n.focus();
1603
1738
  }
1604
1739
  function r() {
@@ -1617,7 +1752,7 @@ function yn(e) {
1617
1752
  }
1618
1753
  //#endregion
1619
1754
  //#region src/composables/useKeyboardShortcuts.ts
1620
- function bn(e) {
1755
+ function jn(e) {
1621
1756
  function t(t) {
1622
1757
  if (t.key === "F1") {
1623
1758
  t.preventDefault(), e.showKeyboardShortcuts.value = !0;
@@ -1629,7 +1764,7 @@ function bn(e) {
1629
1764
  }
1630
1765
  //#endregion
1631
1766
  //#region src/utils/commentFactories.ts
1632
- function xn(e, t, n, r) {
1767
+ function Mn(e, t, n, r) {
1633
1768
  return {
1634
1769
  id: e.reduce((e, t) => Math.max(e, t.id), 0) + 1,
1635
1770
  author: n,
@@ -1651,9 +1786,9 @@ function xn(e, t, n, r) {
1651
1786
  }
1652
1787
  //#endregion
1653
1788
  //#region src/composables/useCommentManagement.ts
1654
- function Sn(e) {
1789
+ function Nn(e) {
1655
1790
  function t(t, n, r) {
1656
- return xn(e.getDocument()?.package?.document?.comments ?? [], t, n, r);
1791
+ return Mn(e.getDocument()?.package?.document?.comments ?? [], t, n, r);
1657
1792
  }
1658
1793
  function n(n) {
1659
1794
  let r = e.getDocument(), i = e.editorView.value;
@@ -1661,11 +1796,11 @@ function Sn(e) {
1661
1796
  r.package.document.comments || (r.package.document.comments = []);
1662
1797
  let a = i.state.schema.marks.comment;
1663
1798
  if (!a) return null;
1664
- let o = it(i.state.doc, n.paraId);
1799
+ let o = ft(i.state.doc, n.paraId);
1665
1800
  if (!o) return null;
1666
1801
  let s = o.from + 1, c = o.to - 1;
1667
1802
  if (n.search) {
1668
- let e = st(i.state.doc, o.from, o.to, n.search);
1803
+ let e = ht(i.state.doc, o.from, o.to, n.search);
1669
1804
  if (!e) return null;
1670
1805
  s = e.from, c = e.to;
1671
1806
  }
@@ -1690,14 +1825,14 @@ function Sn(e) {
1690
1825
  if (!n) return !1;
1691
1826
  let { schema: r } = n.state;
1692
1827
  if (!r.marks.deletion || !r.marks.insertion) return !1;
1693
- let i = it(n.state.doc, t.paraId);
1828
+ let i = ft(n.state.doc, t.paraId);
1694
1829
  if (!i) return !1;
1695
1830
  let a = t.search === "", o = t.replaceWith === "";
1696
1831
  if (a && o) return !1;
1697
1832
  let s, c;
1698
1833
  if (a) s = i.to - 1, c = i.to - 1;
1699
1834
  else {
1700
- let e = st(n.state.doc, i.from, i.to, t.search);
1835
+ let e = ht(n.state.doc, i.from, i.to, t.search);
1701
1836
  if (!e) return !1;
1702
1837
  s = e.from, c = e.to;
1703
1838
  }
@@ -1732,19 +1867,19 @@ function Sn(e) {
1732
1867
  }
1733
1868
  function l(t, n) {
1734
1869
  let r = e.editorView.value;
1735
- r && (qe(t, n)(r.state, r.dispatch), e.extractCommentsAndChanges(), r.focus());
1870
+ r && (et(t, n)(r.state, r.dispatch), e.extractCommentsAndChanges(), r.focus());
1736
1871
  }
1737
1872
  function u(t, n) {
1738
1873
  let r = e.editorView.value;
1739
- r && (Xe(t, n)(r.state, r.dispatch), e.extractCommentsAndChanges(), r.focus());
1874
+ r && (rt(t, n)(r.state, r.dispatch), e.extractCommentsAndChanges(), r.focus());
1740
1875
  }
1741
1876
  function d(t) {
1742
1877
  let n = e.editorView.value;
1743
- n && (Je(t)(n.state, n.dispatch), e.extractCommentsAndChanges(), n.focus());
1878
+ n && (tt(t)(n.state, n.dispatch), e.extractCommentsAndChanges(), n.focus());
1744
1879
  }
1745
1880
  function f(t) {
1746
1881
  let n = e.editorView.value;
1747
- n && (Ze(t)(n.state, n.dispatch), e.extractCommentsAndChanges(), n.focus());
1882
+ n && (it(t)(n.state, n.dispatch), e.extractCommentsAndChanges(), n.focus());
1748
1883
  }
1749
1884
  function p(n, r) {
1750
1885
  let i = e.getDocument(), a = e.editorView.value;
@@ -1780,18 +1915,18 @@ function Sn(e) {
1780
1915
  }
1781
1916
  //#endregion
1782
1917
  //#region src/utils/domQueries.ts
1783
- function Q(e, t) {
1784
- let n = he(e);
1918
+ function Pn(e, t) {
1919
+ let n = ge(e);
1785
1920
  for (let e of n) {
1786
1921
  let n = Number(e.dataset.pmStart), r = Number(e.dataset.pmEnd);
1787
1922
  if (!isNaN(n) && !isNaN(r) && t >= n && t <= r) return e;
1788
1923
  }
1789
1924
  return null;
1790
1925
  }
1791
- function $(e, t, n) {
1926
+ function Fn(e, t, n) {
1792
1927
  if (!e || !t) return;
1793
1928
  let r = null;
1794
- for (let t of he(e)) {
1929
+ for (let t of ge(e)) {
1795
1930
  let e = Number(t.dataset.pmStart), i = Number(t.dataset.pmEnd);
1796
1931
  if (Number.isFinite(e) && Number.isFinite(i) && n >= e && n <= i) {
1797
1932
  r = t;
@@ -1805,21 +1940,21 @@ function $(e, t, n) {
1805
1940
  behavior: "smooth"
1806
1941
  });
1807
1942
  }
1808
- function Cn(e, t, n, r) {
1943
+ function In(e, t, n, r) {
1809
1944
  if (!e || !t) return null;
1810
- let i = pe(e, n, r, 1);
1945
+ let i = me(e, n, r, 1);
1811
1946
  return i === null || i < 0 ? null : Math.min(i, t.state.doc.content.size);
1812
1947
  }
1813
- function wn(e, t, n) {
1948
+ function Ln(e, t, n) {
1814
1949
  if (!e) return;
1815
- let r = Q(e, t);
1950
+ let r = Pn(e, t);
1816
1951
  if (!r) return;
1817
- let i = r.textContent || "", a = Number(r.dataset.pmStart) || 0, [o, s] = _e(i, t - a), c = a + o, l = a + s;
1952
+ let i = r.textContent || "", a = Number(r.dataset.pmStart) || 0, [o, s] = ve(i, t - a), c = a + o, l = a + s;
1818
1953
  c < l && n(c, l);
1819
1954
  }
1820
- function Tn(e, t, n) {
1955
+ function Rn(e, t, n) {
1821
1956
  if (!e) return;
1822
- let r = Q(e, t);
1957
+ let r = Pn(e, t);
1823
1958
  if (!r) return;
1824
1959
  let i = r.closest(".layout-paragraph");
1825
1960
  if (!i) return;
@@ -1828,11 +1963,11 @@ function Tn(e, t, n) {
1828
1963
  }
1829
1964
  //#endregion
1830
1965
  //#region src/composables/useCommentLifecycle.ts
1831
- function En(e) {
1966
+ function zn(e) {
1832
1967
  let t = L(null), n = L(null), r = L(null), i = L(!1);
1833
1968
  function a() {
1834
1969
  let t = e.getDocument(), n = e.editorView.value;
1835
- !t || !n || (e.comments.value = [...t.package?.document?.comments ?? []], e.trackedChanges.value = Qe(n.state).entries, !i.value && (e.comments.value.length > 0 || e.trackedChanges.value.length > 0) && (e.showSidebar.value = !0, i.value = !0));
1970
+ !t || !n || (e.comments.value = [...t.package?.document?.comments ?? []], e.trackedChanges.value = at(n.state).entries, !i.value && (e.comments.value.length > 0 || e.trackedChanges.value.length > 0) && (e.showSidebar.value = !0, i.value = !0));
1836
1971
  }
1837
1972
  function o() {
1838
1973
  e.stateTick.value;
@@ -1851,7 +1986,7 @@ function En(e) {
1851
1986
  t.value = null;
1852
1987
  return;
1853
1988
  }
1854
- let s = o.getBoundingClientRect(), c = Q(a, r);
1989
+ let s = o.getBoundingClientRect(), c = Pn(a, r);
1855
1990
  if (!c) {
1856
1991
  t.value = null;
1857
1992
  return;
@@ -1913,7 +2048,7 @@ function En(e) {
1913
2048
  let i = e.getDocument(), a = e.editorView.value;
1914
2049
  if (!i?.package) return;
1915
2050
  i.package.document.comments || (i.package.document.comments = []);
1916
- let o = xn(i.package.document.comments, t, "User");
2051
+ let o = Mn(i.package.document.comments, t, "User");
1917
2052
  i.package.document.comments.push(o), e.comments.value = [...i.package.document.comments];
1918
2053
  let s = n.value;
1919
2054
  if (a && s && s.from !== s.to) {
@@ -1962,8 +2097,8 @@ function En(e) {
1962
2097
  }
1963
2098
  //#endregion
1964
2099
  //#region src/composables/useImageActions.ts
1965
- function Dn(e) {
1966
- let t = de(null), n = L(!1), r = E(() => {
2100
+ function Bn(e) {
2101
+ let t = de(null), n = L(!1), r = T(() => {
1967
2102
  e.stateTick.value;
1968
2103
  let n = e.editorView.value, r = t.value;
1969
2104
  if (!n || !r) return null;
@@ -1985,14 +2120,14 @@ function Dn(e) {
1985
2120
  width: t.width,
1986
2121
  height: t.height
1987
2122
  });
1988
- Ye(n.state, n.dispatch, i, n.state.selection.from), n.focus();
2123
+ nt(n.state, n.dispatch, i, n.state.selection.from), n.focus();
1989
2124
  }
1990
2125
  function a(n) {
1991
2126
  let r = e.editorView.value, i = t.value;
1992
2127
  if (!r || !i) return;
1993
- let a = je(n);
2128
+ let a = Me(n);
1994
2129
  if (!a) return;
1995
- let o = r.state.doc.nodeAt(i.pmPos), s = e.getCommands(), c = o?.attrs.wrapType === "inline" && a !== "inline" ? { initialPositionEmu: De(i.element, e.zoom.value) } : void 0, l = s.setImageWrapType?.(i.pmPos, a, c);
2130
+ let o = r.state.doc.nodeAt(i.pmPos), s = e.getCommands(), c = o?.attrs.wrapType === "inline" && a !== "inline" ? { initialPositionEmu: Oe(i.element, e.zoom.value) } : void 0, l = s.setImageWrapType?.(i.pmPos, a, c);
1996
2131
  l && (l(r.state, (e) => r.dispatch(e), r), r.focus());
1997
2132
  }
1998
2133
  function o(n) {
@@ -2021,8 +2156,8 @@ function Dn(e) {
2021
2156
  }
2022
2157
  //#endregion
2023
2158
  //#region src/utils/imageClipboard.ts
2024
- function On(e, t, n) {
2025
- let r = Z(e.state), i = e.state.schema.marks.insertion;
2159
+ function Vn(e, t, n) {
2160
+ let r = We(e.state), i = e.state.schema.marks.insertion;
2026
2161
  if (!r || !i) return;
2027
2162
  let a = t.selection.from, o = a - n.nodeSize;
2028
2163
  o < 0 || t.addMark(o, a, i.create({
@@ -2031,10 +2166,10 @@ function On(e, t, n) {
2031
2166
  date: r.date
2032
2167
  }));
2033
2168
  }
2034
- function kn(e, t) {
2169
+ function Hn(e, t) {
2035
2170
  return e.getBlob(t);
2036
2171
  }
2037
- function An(e, t) {
2172
+ function Un(e, t) {
2038
2173
  let n = e.state.doc.nodeAt(t);
2039
2174
  if (!n || n.type.name !== "image") return;
2040
2175
  let r = `<img src="${n.attrs.src}" data-pm-image="true" data-width="${n.attrs.width ?? ""}" data-height="${n.attrs.height ?? ""}" data-wrap-type="${n.attrs.wrapType ?? ""}" data-display-mode="${n.attrs.displayMode ?? ""}" data-rid="${n.attrs.rId ?? ""}" />`, i = new ClipboardItem({
@@ -2046,13 +2181,13 @@ function An(e, t) {
2046
2181
  e.value = r, document.body.appendChild(e), e.select(), document.execCommand("copy"), document.body.removeChild(e);
2047
2182
  });
2048
2183
  }
2049
- function jn(e) {
2184
+ function Wn(e) {
2050
2185
  return new Promise((t, n) => {
2051
2186
  let r = new FileReader();
2052
2187
  r.onload = () => t(r.result), r.onerror = n, r.readAsDataURL(e);
2053
2188
  });
2054
2189
  }
2055
- function Mn(e) {
2190
+ function Gn(e) {
2056
2191
  return new Promise((t) => {
2057
2192
  let n = new Image();
2058
2193
  n.onload = () => t({
@@ -2064,13 +2199,13 @@ function Mn(e) {
2064
2199
  }), n.src = e;
2065
2200
  });
2066
2201
  }
2067
- async function Nn(e) {
2202
+ async function Kn(e) {
2068
2203
  try {
2069
2204
  let t = await navigator.clipboard.read();
2070
2205
  for (let n of t) {
2071
2206
  let t = n.types.find((e) => e.startsWith("image/"));
2072
2207
  if (t) {
2073
- let r = await jn(await kn(n, t)), i = await Mn(r), a = i.width, o = i.height;
2208
+ let r = await Wn(await Hn(n, t)), i = await Gn(r), a = i.width, o = i.height;
2074
2209
  a > 612 && (o = Math.round(612 / a * o), a = 612);
2075
2210
  let s = e.state.schema.nodes.image.create({
2076
2211
  src: r,
@@ -2080,11 +2215,11 @@ async function Nn(e) {
2080
2215
  wrapType: "inline",
2081
2216
  displayMode: "inline"
2082
2217
  }), c = e.state.tr.replaceSelectionWith(s);
2083
- On(e, c, s), e.dispatch(c);
2218
+ Vn(e, c, s), e.dispatch(c);
2084
2219
  return;
2085
2220
  }
2086
2221
  if (n.types.includes("text/html")) {
2087
- let t = await (await kn(n, "text/html")).text(), r = t.match(/<img[^>]+src="([^"]+)"[^>]*>/i);
2222
+ let t = await (await Hn(n, "text/html")).text(), r = t.match(/<img[^>]+src="([^"]+)"[^>]*>/i);
2088
2223
  if (r && r[1]) {
2089
2224
  let n = r[1], i = t.match(/data-width="(\d+)"/), a = t.match(/data-height="(\d+)"/), o = i ? Number(i[1]) : 200, s = a ? Number(a[1]) : 200, c = e.state.schema.nodes.image.create({
2090
2225
  src: n,
@@ -2094,12 +2229,12 @@ async function Nn(e) {
2094
2229
  wrapType: "inline",
2095
2230
  displayMode: "inline"
2096
2231
  }), l = e.state.tr.replaceSelectionWith(c);
2097
- On(e, l, c), e.dispatch(l);
2232
+ Vn(e, l, c), e.dispatch(l);
2098
2233
  return;
2099
2234
  }
2100
2235
  }
2101
2236
  if (n.types.includes("text/plain")) {
2102
- let t = await (await kn(n, "text/plain")).text();
2237
+ let t = await (await Hn(n, "text/plain")).text();
2103
2238
  if (t && t !== "[image]") {
2104
2239
  let { from: n } = e.state.selection;
2105
2240
  e.dispatch(e.state.tr.insertText(t, n));
@@ -2115,14 +2250,14 @@ async function Nn(e) {
2115
2250
  }
2116
2251
  }
2117
2252
  }
2118
- function Pn(e, t) {
2253
+ function qn(e, t) {
2119
2254
  let n = e.state.doc.nodeAt(t);
2120
2255
  if (!n || n.type.name !== "image") return;
2121
2256
  let r = document.createElement("input");
2122
2257
  r.type = "file", r.accept = "image/*", r.onchange = async () => {
2123
2258
  let i = r.files?.[0];
2124
2259
  if (!i) return;
2125
- let a = await jn(i), o = await Mn(a), s = n.attrs.width || o.width, c = n.attrs.height || o.height, l = Math.min(s / o.width, c / o.height), u = Math.round(o.width * l), d = Math.round(o.height * l);
2260
+ let a = await Wn(i), o = await Gn(a), s = n.attrs.width || o.width, c = n.attrs.height || o.height, l = Math.min(s / o.width, c / o.height), u = Math.round(o.width * l), d = Math.round(o.height * l);
2126
2261
  try {
2127
2262
  let r = e.state.tr.setNodeMarkup(t, void 0, {
2128
2263
  ...n.attrs,
@@ -2137,7 +2272,7 @@ function Pn(e, t) {
2137
2272
  }
2138
2273
  //#endregion
2139
2274
  //#region src/composables/useContextMenus.ts
2140
- function Fn(e) {
2275
+ function Jn(e) {
2141
2276
  let { t } = n(), r = L({
2142
2277
  isOpen: !1,
2143
2278
  position: {
@@ -2149,7 +2284,7 @@ function Fn(e) {
2149
2284
  onImage: !1,
2150
2285
  canMergeCells: !1,
2151
2286
  canSplitCell: !1
2152
- }), i = L(null), a = E(() => [
2287
+ }), i = L(null), a = T(() => [
2153
2288
  {
2154
2289
  action: "cut",
2155
2290
  label: t("contextMenu.cut"),
@@ -2175,12 +2310,12 @@ function Fn(e) {
2175
2310
  function o(t) {
2176
2311
  let n = e.editorView.value;
2177
2312
  if (!n) return;
2178
- let a = t.target, o = ke(a);
2313
+ let a = t.target, o = Ae(a);
2179
2314
  if (o) {
2180
2315
  let a = Number(o.dataset.pmStart);
2181
2316
  if (!isNaN(a)) {
2182
2317
  try {
2183
- let e = q.create(n.state.doc, a);
2318
+ let e = fe.create(n.state.doc, a);
2184
2319
  n.dispatch(n.state.tr.setSelection(e));
2185
2320
  } catch {}
2186
2321
  e.selectedImage.value = {
@@ -2201,7 +2336,7 @@ function Fn(e) {
2201
2336
  pmPos: a,
2202
2337
  currentWrapType: n,
2203
2338
  currentCssFloat: c ?? null,
2204
- inlinePositionEmu: n === "inline" ? De(o, e.zoom.value) : void 0
2339
+ inlinePositionEmu: n === "inline" ? Oe(o, e.zoom.value) : void 0
2205
2340
  }, r.value.isOpen = !1;
2206
2341
  return;
2207
2342
  }
@@ -2213,7 +2348,7 @@ function Fn(e) {
2213
2348
  e.setPmSelection(a);
2214
2349
  } catch {}
2215
2350
  }
2216
- let s = Ce(n.state), { empty: c } = n.state.selection;
2351
+ let s = we(n.state), { empty: c } = n.state.selection;
2217
2352
  i.value &&= null, r.value = {
2218
2353
  isOpen: !0,
2219
2354
  position: {
@@ -2242,7 +2377,7 @@ function Fn(e) {
2242
2377
  pmPos: a.pmPos,
2243
2378
  currentWrapType: s,
2244
2379
  currentCssFloat: c ?? null,
2245
- inlinePositionEmu: s === "inline" ? De(a.element, e.zoom.value) : void 0
2380
+ inlinePositionEmu: s === "inline" ? Oe(a.element, e.zoom.value) : void 0
2246
2381
  }, r.value.isOpen = !1;
2247
2382
  }
2248
2383
  function c(t) {
@@ -2258,16 +2393,16 @@ function Fn(e) {
2258
2393
  switch (t) {
2259
2394
  case "cut":
2260
2395
  if (e.selectedImage.value) {
2261
- An(n, e.selectedImage.value.pmPos);
2396
+ Un(n, e.selectedImage.value.pmPos);
2262
2397
  let t = e.selectedImage.value.pmPos, r = n.state.doc.nodeAt(t);
2263
2398
  r && (n.dispatch(n.state.tr.delete(t, t + r.nodeSize)), e.selectedImage.value = null);
2264
2399
  } else document.execCommand("cut");
2265
2400
  break;
2266
2401
  case "copy":
2267
- e.selectedImage.value ? An(n, e.selectedImage.value.pmPos) : document.execCommand("copy");
2402
+ e.selectedImage.value ? Un(n, e.selectedImage.value.pmPos) : document.execCommand("copy");
2268
2403
  break;
2269
2404
  case "paste":
2270
- Nn(n);
2405
+ Kn(n);
2271
2406
  break;
2272
2407
  case "pasteAsPlainText":
2273
2408
  navigator.clipboard.readText().then((e) => {
@@ -2280,7 +2415,7 @@ function Fn(e) {
2280
2415
  break;
2281
2416
  }
2282
2417
  case "selectAll": {
2283
- let e = fe.create(n.state.doc, 0, n.state.doc.content.size);
2418
+ let e = pe.create(n.state.doc, 0, n.state.doc.content.size);
2284
2419
  n.dispatch(n.state.tr.setSelection(e));
2285
2420
  break;
2286
2421
  }
@@ -2288,7 +2423,7 @@ function Fn(e) {
2288
2423
  e.selectedImage.value && (e.showImageProperties.value = !0);
2289
2424
  break;
2290
2425
  case "replaceImage":
2291
- e.selectedImage.value && Pn(n, e.selectedImage.value.pmPos);
2426
+ e.selectedImage.value && qn(n, e.selectedImage.value.pmPos);
2292
2427
  break;
2293
2428
  case "deleteImage":
2294
2429
  if (e.selectedImage.value) {
@@ -2323,8 +2458,8 @@ function Fn(e) {
2323
2458
  }
2324
2459
  //#endregion
2325
2460
  //#region src/composables/usePagesPointer.ts
2326
- var In = 500;
2327
- function Ln(e) {
2461
+ var Yn = 500;
2462
+ function Xn(e) {
2328
2463
  let t = L(null), n = null;
2329
2464
  function r() {
2330
2465
  n !== null && (clearTimeout(n), n = null);
@@ -2335,7 +2470,7 @@ function Ln(e) {
2335
2470
  visible: !1
2336
2471
  }), d = null;
2337
2472
  function f(t, n) {
2338
- return Cn(e.pagesRef.value, e.editorView.value, t, n);
2473
+ return In(e.pagesRef.value, e.editorView.value, t, n);
2339
2474
  }
2340
2475
  function p() {
2341
2476
  let t = i.value;
@@ -2348,18 +2483,18 @@ function Ln(e) {
2348
2483
  function m(e, t) {
2349
2484
  let n = p();
2350
2485
  if (n) try {
2351
- let r = n.state.doc.resolve(e), i = t === void 0 ? r : n.state.doc.resolve(t), a = fe.between(r, i);
2486
+ let r = n.state.doc.resolve(e), i = t === void 0 ? r : n.state.doc.resolve(t), a = pe.between(r, i);
2352
2487
  n.dispatch(n.state.tr.setSelection(a));
2353
2488
  } catch {}
2354
2489
  }
2355
2490
  function h(t) {
2356
- $(e.pagesRef.value, e.pagesViewportRef.value, t);
2491
+ Fn(e.pagesRef.value, e.pagesViewportRef.value, t);
2357
2492
  }
2358
2493
  function g(t) {
2359
- wn(e.pagesRef.value, t, m);
2494
+ Ln(e.pagesRef.value, t, m);
2360
2495
  }
2361
2496
  function _(t) {
2362
- Tn(e.pagesRef.value, t, m);
2497
+ Rn(e.pagesRef.value, t, m);
2363
2498
  }
2364
2499
  function v(t) {
2365
2500
  let n = e.editorView.value;
@@ -2380,7 +2515,7 @@ function Ln(e) {
2380
2515
  if (!o) return;
2381
2516
  let s = e.pagesViewportRef.value;
2382
2517
  if (!s) return;
2383
- let l = et({
2518
+ let l = st({
2384
2519
  mouseX: a.clientX,
2385
2520
  mouseY: a.clientY,
2386
2521
  pagesContainer: o,
@@ -2390,7 +2525,7 @@ function Ln(e) {
2390
2525
  if (!l) {
2391
2526
  n === null && (n = setTimeout(() => {
2392
2527
  t.value = null, n = null;
2393
- }, $e));
2528
+ }, ot));
2394
2529
  return;
2395
2530
  }
2396
2531
  let u = s.getBoundingClientRect();
@@ -2405,7 +2540,7 @@ function Ln(e) {
2405
2540
  n.preventDefault(), n.stopPropagation();
2406
2541
  let r = t.value, i = e.editorView.value;
2407
2542
  if (!r || !i) return;
2408
- let a = i.state.tr.setSelection(fe.create(i.state.doc, r.cellPmPos + 1));
2543
+ let a = i.state.tr.setSelection(pe.create(i.state.doc, r.cellPmPos + 1));
2409
2544
  i.dispatch(a);
2410
2545
  let o = e.getCommands(), s = r.type === "row" ? o.addRowBelow?.() : o.addColumnRight?.();
2411
2546
  s && (s(i.state, (e) => i.dispatch(e), i), t.value = null, i.focus());
@@ -2436,7 +2571,7 @@ function Ln(e) {
2436
2571
  }
2437
2572
  };
2438
2573
  }
2439
- function S(t) {
2574
+ function ee(t) {
2440
2575
  let n = t.target, r = n.closest(".layout-page-header"), a = n.closest(".layout-page-footer"), o = r ?? a;
2441
2576
  if (!o) return;
2442
2577
  let s = r ? "header" : "footer", c = e.getDocument();
@@ -2502,7 +2637,7 @@ function Ln(e) {
2502
2637
  }
2503
2638
  };
2504
2639
  }
2505
- function ee(t) {
2640
+ function te(t) {
2506
2641
  let n = e.getDocument(), r = i.value;
2507
2642
  if (!n?.package || !r) return;
2508
2643
  let a = r.position === "header" ? n.package.headers : n.package.footers;
@@ -2510,13 +2645,13 @@ function Ln(e) {
2510
2645
  let o = a.get(r.rId);
2511
2646
  o && (o.content = t), e.syncHfPMs?.(), e.reLayout(), e.emit("change", n);
2512
2647
  }
2513
- function te() {
2648
+ function ne() {
2514
2649
  let t = e.getDocument(), n = i.value;
2515
2650
  if (!t?.package || !n || !n.rId) return;
2516
2651
  let r = (n.position === "header" ? t.package.headers : t.package.footers)?.get(n.rId);
2517
2652
  r && (r.content = []), i.value = null, e.syncHfPMs?.(), e.reLayout(), e.emit("change", t);
2518
2653
  }
2519
- function ne(t) {
2654
+ function re(t) {
2520
2655
  if (t.button !== 0 || e.imageInteracting.value) return;
2521
2656
  let n = e.editorView.value;
2522
2657
  if (!n) return;
@@ -2524,13 +2659,13 @@ function Ln(e) {
2524
2659
  i.value && (r.closest(".layout-page-header") || r.closest(".layout-page-footer") || r.closest(".hf-editor") || (i.value = null, n.focus()));
2525
2660
  let u = p() ?? n;
2526
2661
  if (!e.readOnly.value && e.tableResize.tryStartResize(t, u)) return;
2527
- let d = ke(r);
2662
+ let d = Ae(r);
2528
2663
  if (d) {
2529
2664
  t.preventDefault(), t.stopPropagation();
2530
2665
  let n = Number(d.dataset.pmStart);
2531
2666
  if (!isNaN(n)) {
2532
2667
  try {
2533
- u.dispatch(u.state.tr.setSelection(q.create(u.state.doc, n)));
2668
+ u.dispatch(u.state.tr.setSelection(fe.create(u.state.doc, n)));
2534
2669
  } catch {}
2535
2670
  e.selectedImage.value = {
2536
2671
  element: d,
@@ -2549,7 +2684,7 @@ function Ln(e) {
2549
2684
  return;
2550
2685
  }
2551
2686
  let v = Date.now();
2552
- if (v - a < In && o === h ? s++ : s = 1, a = v, o = h, s === 2) g(h);
2687
+ if (v - a < Yn && o === h ? s++ : s = 1, a = v, o = h, s === 2) g(h);
2553
2688
  else if (s >= 3) _(h), s = 0;
2554
2689
  else {
2555
2690
  if (t.shiftKey) {
@@ -2560,15 +2695,15 @@ function Ln(e) {
2560
2695
  }
2561
2696
  u.focus();
2562
2697
  }
2563
- function C(e) {
2698
+ function S(e) {
2564
2699
  if (!c || l === null) return;
2565
2700
  let t = f(e.clientX, e.clientY);
2566
2701
  t !== null && t !== l && m(l, t);
2567
2702
  }
2568
- function w() {
2703
+ function C() {
2569
2704
  c = !1;
2570
2705
  }
2571
- function T() {
2706
+ function w() {
2572
2707
  let t = e.pagesViewportRef.value, n = e.layout.value;
2573
2708
  if (!t || !n || n.pages.length === 0) return;
2574
2709
  let r = t.scrollTop, i = n.pages.length, a = r + t.clientHeight / 2, o = 24, s = 1;
@@ -2592,9 +2727,9 @@ function Ln(e) {
2592
2727
  }, 600);
2593
2728
  }
2594
2729
  return F(() => {
2595
- window.addEventListener("mousemove", C), window.addEventListener("mouseup", w), e.pagesViewportRef.value?.addEventListener("scroll", T, { passive: !0 });
2730
+ window.addEventListener("mousemove", S), window.addEventListener("mouseup", C), e.pagesViewportRef.value?.addEventListener("scroll", w, { passive: !0 });
2596
2731
  }), P(() => {
2597
- r(), window.removeEventListener("mousemove", C), window.removeEventListener("mouseup", w), e.pagesViewportRef.value?.removeEventListener("scroll", T), d && clearTimeout(d);
2732
+ r(), window.removeEventListener("mousemove", S), window.removeEventListener("mouseup", C), e.pagesViewportRef.value?.removeEventListener("scroll", w), d && clearTimeout(d);
2598
2733
  }), {
2599
2734
  tableInsertButton: t,
2600
2735
  hfEdit: i,
@@ -2603,19 +2738,19 @@ function Ln(e) {
2603
2738
  setPmSelection: m,
2604
2739
  scrollVisiblePositionIntoView: h,
2605
2740
  navigateToBookmark: v,
2606
- handlePagesMouseDown: ne,
2741
+ handlePagesMouseDown: re,
2607
2742
  handlePagesMouseMove: y,
2608
2743
  handlePagesClick: x,
2609
- handlePagesDoubleClick: S,
2744
+ handlePagesDoubleClick: ee,
2610
2745
  handleTableInsertClick: b,
2611
2746
  clearTableInsertTimer: r,
2612
- handleHfSave: ee,
2613
- handleHfRemove: te
2747
+ handleHfSave: te,
2748
+ handleHfRemove: ne
2614
2749
  };
2615
2750
  }
2616
2751
  //#endregion
2617
2752
  //#region src/composables/useSelectionSync.ts
2618
- function Rn(e) {
2753
+ function Zn(e) {
2619
2754
  let t = null, n = null;
2620
2755
  function r() {
2621
2756
  let r = e.pagesRef.value;
@@ -2625,10 +2760,10 @@ function Rn(e) {
2625
2760
  let i = e.pagesRef.value, a = e.editorView.value;
2626
2761
  if (!i || !a || (r(), e.isHfEditing?.value)) return;
2627
2762
  let o = a.state.selection;
2628
- if (o instanceof q && o.node.type.name === "image") {
2763
+ if (o instanceof fe && o.node.type.name === "image") {
2629
2764
  let t = null;
2630
2765
  for (let e of i.querySelectorAll(`[data-pm-start="${o.from}"]`)) {
2631
- let n = ke(e);
2766
+ let n = Ae(e);
2632
2767
  if (n) {
2633
2768
  t = n;
2634
2769
  break;
@@ -2648,7 +2783,7 @@ function Rn(e) {
2648
2783
  if (e.selectedImage.value) return;
2649
2784
  let { from: s, to: c, empty: l } = a.state.selection, u = i.scrollTop, d = i.scrollLeft;
2650
2785
  if (l) {
2651
- let e = Te(i, s, i.getBoundingClientRect());
2786
+ let e = Ee(i, s, i.getBoundingClientRect());
2652
2787
  if (e) {
2653
2788
  let r = document.createElement("div");
2654
2789
  r.className = "vue-caret", r.style.cssText = `
@@ -2659,7 +2794,7 @@ function Rn(e) {
2659
2794
  height: ${e.height}px;
2660
2795
  background: #000;
2661
2796
  pointer-events: none;
2662
- z-index: ${ee.selectionOverlay};
2797
+ z-index: ${te.selectionOverlay};
2663
2798
  `, i.appendChild(r), n = r;
2664
2799
  let a = !0;
2665
2800
  t = setInterval(() => {
@@ -2668,7 +2803,7 @@ function Rn(e) {
2668
2803
  }
2669
2804
  return;
2670
2805
  }
2671
- let f = Ee(i, s, c, i.getBoundingClientRect());
2806
+ let f = De(i, s, c, i.getBoundingClientRect());
2672
2807
  for (let e of f) {
2673
2808
  let t = document.createElement("div");
2674
2809
  t.className = "vue-sel-rect", t.style.cssText = `
@@ -2679,7 +2814,7 @@ function Rn(e) {
2679
2814
  height: ${e.height}px;
2680
2815
  background: rgba(66, 133, 244, 0.3);
2681
2816
  pointer-events: none;
2682
- z-index: ${ee.selectionOverlay};
2817
+ z-index: ${te.selectionOverlay};
2683
2818
  `, i.appendChild(t);
2684
2819
  }
2685
2820
  }
@@ -2692,7 +2827,7 @@ function Rn(e) {
2692
2827
  }
2693
2828
  //#endregion
2694
2829
  //#region src/composables/useMenuActions.ts
2695
- function zn(e) {
2830
+ function Qn(e) {
2696
2831
  function t(t) {
2697
2832
  let n = e.editorView.value;
2698
2833
  if (!n) return;
@@ -2744,7 +2879,7 @@ function zn(e) {
2744
2879
  e.showKeyboardShortcuts.value = !0;
2745
2880
  break;
2746
2881
  case "reportIssue":
2747
- tt();
2882
+ ct();
2748
2883
  break;
2749
2884
  case "dirLTR":
2750
2885
  t("setLtr");
@@ -2762,7 +2897,7 @@ function zn(e) {
2762
2897
  }
2763
2898
  //#endregion
2764
2899
  //#region src/composables/useDocumentLifecycle.ts
2765
- function Bn(e) {
2900
+ function $n(e) {
2766
2901
  async function t(t) {
2767
2902
  e.sidebarAutoOpenedRef.value = !1, await e.loadDocumentBuffer(t);
2768
2903
  }
@@ -2781,7 +2916,7 @@ function Bn(e) {
2781
2916
  }
2782
2917
  //#endregion
2783
2918
  //#region src/composables/useDocxEditorRefApi.ts
2784
- function Vn(e) {
2919
+ function er(e) {
2785
2920
  function t() {
2786
2921
  e.onPrint?.(), window.print();
2787
2922
  }
@@ -2817,31 +2952,71 @@ function Vn(e) {
2817
2952
  function c() {
2818
2953
  let t = e.layout.value, n = e.editorView.value;
2819
2954
  if (!t || !n) return 0;
2820
- let r = Le(t, n.state.selection.from);
2955
+ let r = Ge(t, n.state.selection.from);
2821
2956
  return r == null ? 0 : r + 1;
2822
2957
  }
2823
2958
  function l(t) {
2824
2959
  let n = e.editorView.value;
2825
2960
  if (!n) return !1;
2826
- let r = it(n.state.doc, t);
2961
+ let r = ft(n.state.doc, t);
2827
2962
  return r ? (e.scrollVisiblePositionIntoView(r.from + 1), !0) : !1;
2828
2963
  }
2829
2964
  function u(t, n) {
2830
- return ct(e.editorView.value, t, n);
2965
+ return gt(e.editorView.value, t, n);
2831
2966
  }
2832
2967
  function d() {
2833
- return lt(e.editorView.value);
2968
+ return _t(e.editorView.value);
2834
2969
  }
2835
2970
  function f() {
2836
2971
  return e.comments.value;
2837
2972
  }
2838
2973
  function p(t) {
2839
- return ut(e.editorView.value, e.layout.value, t);
2974
+ let n = e.editorView.value;
2975
+ return n ? X(n.state.doc, t ?? {}) : [];
2840
2976
  }
2841
2977
  function m(t) {
2978
+ let n = e.editorView.value;
2979
+ if (!n) return !1;
2980
+ let r = Ie(n.state.doc, t);
2981
+ return r == null ? !1 : (a(r), !0);
2982
+ }
2983
+ function h(t, n, r) {
2984
+ let i = e.editorView.value;
2985
+ if (!i) return !1;
2986
+ try {
2987
+ return i.dispatch(Be(i.state, t, n, r)), !0;
2988
+ } catch (e) {
2989
+ if (e instanceof lt) return !1;
2990
+ throw e;
2991
+ }
2992
+ }
2993
+ function g(t, n) {
2994
+ let r = e.editorView.value;
2995
+ if (!r) return !1;
2996
+ try {
2997
+ return r.dispatch(Le(r.state, t, n)), !0;
2998
+ } catch (e) {
2999
+ if (e instanceof lt) return !1;
3000
+ throw e;
3001
+ }
3002
+ }
3003
+ function _(t, n, r) {
3004
+ let i = e.editorView.value;
3005
+ if (!i) return !1;
3006
+ try {
3007
+ return i.dispatch(Ve(i.state, t, n, r)), !0;
3008
+ } catch (e) {
3009
+ if (e instanceof lt) return !1;
3010
+ throw e;
3011
+ }
3012
+ }
3013
+ function v(t) {
3014
+ return vt(e.editorView.value, e.layout.value, t);
3015
+ }
3016
+ function y(t) {
2842
3017
  return e.contentChangeSubscribers.add(t), () => e.contentChangeSubscribers.delete(t);
2843
3018
  }
2844
- function h(t) {
3019
+ function b(t) {
2845
3020
  return e.selectionChangeSubscribers.add(t), () => e.selectionChangeSubscribers.delete(t);
2846
3021
  }
2847
3022
  return { exposed: {
@@ -2867,36 +3042,41 @@ function Vn(e) {
2867
3042
  findInDocument: u,
2868
3043
  getSelectionInfo: d,
2869
3044
  getComments: f,
3045
+ getContentControls: p,
3046
+ scrollToContentControl: m,
3047
+ setContentControlContent: h,
3048
+ removeContentControl: g,
3049
+ setContentControlValue: _,
2870
3050
  applyFormatting: e.applyFormatting,
2871
3051
  setParagraphStyle: e.setParagraphStyle,
2872
- getPageContent: p,
3052
+ getPageContent: v,
2873
3053
  getTotalPages: s,
2874
3054
  getCurrentPage: c,
2875
- onContentChange: m,
2876
- onSelectionChange: h
3055
+ onContentChange: y,
3056
+ onSelectionChange: b
2877
3057
  } };
2878
3058
  }
2879
3059
  //#endregion
2880
3060
  //#region src/composables/useFontLifecycle.ts
2881
- function Hn(e, t) {
3061
+ function tr(e, t) {
2882
3062
  H(e, (e) => {
2883
- ve(e);
3063
+ ye(e);
2884
3064
  }, { immediate: !0 });
2885
- let n = ye(t);
3065
+ let n = be(t);
2886
3066
  P(() => n());
2887
3067
  }
2888
3068
  //#endregion
2889
3069
  //#region src/components/DocxEditor.vue?vue&type=script&setup=true&lang.ts
2890
- var Un = { class: "docx-editor-vue__toolbar-shell" }, Wn = {
3070
+ var nr = { class: "docx-editor-vue__toolbar-shell" }, rr = {
2891
3071
  key: 0,
2892
3072
  class: "docx-editor-vue__error"
2893
- }, Gn = {
3073
+ }, ir = {
2894
3074
  key: 1,
2895
3075
  class: "docx-editor-vue__loading"
2896
- }, Kn = { class: "docx-editor-vue__editor-area" }, qn = {
3076
+ }, ar = { class: "docx-editor-vue__editor-area" }, or = {
2897
3077
  key: 0,
2898
3078
  class: "docx-editor-vue__vertical-ruler"
2899
- }, Jn = ["title"], Yn = ["title", "aria-label"], Xn = /* @__PURE__ */ j({
3079
+ }, sr = ["title"], cr = ["title", "aria-label"], lr = /* @__PURE__ */ j({
2900
3080
  __name: "DocxEditor",
2901
3081
  props: {
2902
3082
  documentBuffer: { default: null },
@@ -2988,44 +3168,44 @@ var Un = { class: "docx-editor-vue__toolbar-shell" }, Wn = {
2988
3168
  "mode-change"
2989
3169
  ],
2990
3170
  setup(e, { expose: n, emit: r }) {
2991
- let i = e, a = r, o = L(i.mode), s = E(() => i.readOnly || o.value === "viewing");
2992
- f(E(() => i.i18n));
2993
- let { t: l } = t(E(() => i.i18n)), u = L(null), d = L(null), g = L(null), y = L(0), x = /* @__PURE__ */ new Set(), S = /* @__PURE__ */ new Set(), ee = new Ne(), w = L(!1), T = L(!1), re = L(!1), oe = L(!1), j = L(!1), se = L(!1), R = L(i.showOutline), V = L(!1), W = L(!1), G = L(!1), q = L(null), pe = de([]), he = de([]), J = de([]), { zoom: Y, zoomPercent: _e, isMinZoom: ve, isMaxZoom: ye, setZoom: be, zoomIn: xe, zoomOut: Se, handleWheel: Ce, handleKeyDown: we, installShortcuts: Te, ZOOM_PRESETS: Ee } = te(i.initialZoom);
2994
- Te();
2995
- let { editorView: X, isReady: De, parseError: Oe, layout: ke, loadBuffer: Ae, loadDocument: je, save: Me, focus: Pe, destroy: Fe, getDocument: Z, getCommands: Le, reLayout: Re, getHfPmView: ze, syncHfPMs: Be, setHfTransactionListener: Ve, setDocument: He } = ne({
3171
+ let i = e, a = r, o = L(i.mode), s = T(() => i.readOnly || o.value === "viewing");
3172
+ f(T(() => i.i18n));
3173
+ let { t: l } = t(T(() => i.i18n)), u = L(null), d = L(null), g = L(null), y = L(0), x = /* @__PURE__ */ new Set(), ee = /* @__PURE__ */ new Set(), te = new Pe(), C = L(!1), w = L(!1), ie = L(!1), oe = L(!1), j = L(!1), se = L(!1), R = L(i.showOutline), V = L(!1), W = L(!1), G = L(!1), fe = L(null), me = de([]), ge = de([]), q = de([]), { zoom: J, zoomPercent: ve, isMinZoom: ye, isMaxZoom: be, setZoom: xe, zoomIn: Se, zoomOut: Ce, handleWheel: we, handleKeyDown: Te, installShortcuts: Ee, ZOOM_PRESETS: De } = ne(i.initialZoom);
3174
+ Ee();
3175
+ let { editorView: Y, isReady: Oe, parseError: ke, layout: Ae, loadBuffer: je, loadDocument: Me, save: Ne, focus: Fe, destroy: Ie, getDocument: X, getCommands: Le, reLayout: Re, getHfPmView: ze, syncHfPMs: Be, setHfTransactionListener: Ve, setDocument: He } = re({
2996
3176
  hiddenContainer: u,
2997
3177
  pagesContainer: d,
2998
3178
  readOnly: s,
2999
3179
  externalPlugins: i.externalPlugins,
3000
- syncCoordinator: ee,
3180
+ syncCoordinator: te,
3001
3181
  editorMode: o,
3002
3182
  onChange: (e) => {
3003
3183
  a("change", e), a("update:document", e), x.forEach((t) => t(e));
3004
3184
  },
3005
3185
  onError: (e) => a("error", e),
3006
3186
  onSelectionUpdate: () => {
3007
- y.value++, ur();
3008
- let e = lt(X.value);
3009
- S.forEach((t) => t(e));
3187
+ y.value++, dr();
3188
+ let e = _t(Y.value);
3189
+ ee.forEach((t) => t(e));
3010
3190
  }
3011
- }), Ue = E(() => {
3191
+ }), We = T(() => {
3012
3192
  y.value;
3013
- let e = Z();
3193
+ let e = X();
3014
3194
  if (!e?.package?.document) return null;
3015
3195
  let t = e.package.document;
3016
3196
  return t.finalSectionProperties ?? t.sections?.[0]?.properties ?? null;
3017
- }), We = E(() => (y.value, Z()?.package?.theme ?? i.theme ?? null)), Ge = L(null);
3018
- Hn(() => i.fonts, (e) => a("error", e));
3019
- let Ke = E(() => $.value?.headerFooter ? ze($.value.headerFooter) ?? null : null);
3197
+ }), Ge = T(() => (y.value, X()?.package?.theme ?? i.theme ?? null)), Z = L(null);
3198
+ tr(() => i.fonts, (e) => a("error", e));
3199
+ let Ke = T(() => $.value?.headerFooter ? ze($.value.headerFooter) ?? null : null);
3020
3200
  F(() => {
3021
3201
  Ve((e, t) => {
3022
3202
  requestAnimationFrame(() => {
3023
- Ge.value = me(t);
3203
+ Z.value = he(t);
3024
3204
  let e = $.value;
3025
3205
  if (!e) return;
3026
3206
  let n = window.document.querySelector(e.position === "header" ? ".layout-page-header" : ".layout-page-footer"), r = g.value;
3027
3207
  if (!n || !r) return;
3028
- let i = n.getBoundingClientRect(), a = r.getBoundingClientRect(), o = Y.value || 1;
3208
+ let i = n.getBoundingClientRect(), a = r.getBoundingClientRect(), o = J.value || 1;
3029
3209
  $.value = {
3030
3210
  ...e,
3031
3211
  targetRect: {
@@ -3038,18 +3218,18 @@ var Un = { class: "docx-editor-vue__toolbar-shell" }, Wn = {
3038
3218
  });
3039
3219
  }), H(() => $.value, (e) => {
3040
3220
  if (!e) {
3041
- Ge.value = null;
3221
+ Z.value = null;
3042
3222
  return;
3043
3223
  }
3044
- let t = X.value;
3224
+ let t = Y.value;
3045
3225
  if (t) {
3046
3226
  try {
3047
- let e = t.state.tr.setSelection(fe.create(t.state.doc, 0));
3227
+ let e = t.state.tr.setSelection(pe.create(t.state.doc, 0));
3048
3228
  t.dispatch(e);
3049
3229
  } catch {}
3050
3230
  t.dom.blur?.();
3051
3231
  }
3052
- dr.updateSelectionOverlay();
3232
+ fr.updateSelectionOverlay();
3053
3233
  });
3054
3234
  let e = 0;
3055
3235
  function t() {
@@ -3058,34 +3238,34 @@ var Un = { class: "docx-editor-vue__toolbar-shell" }, Wn = {
3058
3238
  let t = $.value;
3059
3239
  if (!t?.headerFooter) return;
3060
3240
  let n = ze(t.headerFooter);
3061
- n && (Ge.value = me(n));
3241
+ n && (Z.value = he(n));
3062
3242
  }));
3063
3243
  }
3064
3244
  window.addEventListener("scroll", t, !0), window.addEventListener("resize", t), P(() => {
3065
3245
  e && cancelAnimationFrame(e), window.removeEventListener("scroll", t, !0), window.removeEventListener("resize", t);
3066
3246
  });
3067
3247
  });
3068
- let qe = E(() => {
3248
+ let qe = T(() => {
3069
3249
  let e = [];
3070
- return W.value && e.push(`translateX(-${ge}px)`), Y.value !== 1 && e.push(`scale(${Y.value})`), {
3250
+ return W.value && e.push(`translateX(-${_e}px)`), J.value !== 1 && e.push(`scale(${J.value})`), {
3071
3251
  transform: e.length > 0 ? e.join(" ") : void 0,
3072
3252
  transformOrigin: "top center",
3073
3253
  transition: "transform 0.2s ease"
3074
3254
  };
3075
- }), Je = E(() => ({
3255
+ }), Je = T(() => ({
3076
3256
  paddingLeft: "20px",
3077
- paddingRight: 20 + (W.value ? ge * 2 : 0) + "px",
3257
+ paddingRight: 20 + (W.value ? _e * 2 : 0) + "px",
3078
3258
  transition: "padding 0.2s ease"
3079
- })), Ye = E(() => {
3080
- let e = Ue.value;
3081
- return Ie(e?.pageWidth ?? 12240) * Y.value;
3082
- }), Xe = E(() => {
3259
+ })), Ye = T(() => {
3260
+ let e = We.value;
3261
+ return Ue(e?.pageWidth ?? 12240) * J.value;
3262
+ }), Xe = T(() => {
3083
3263
  let e = /* @__PURE__ */ new Set();
3084
- for (let t of pe.value) t.parentId == null && t.done && e.add(t.id);
3264
+ for (let t of me.value) t.parentId == null && t.done && e.add(t.id);
3085
3265
  return e;
3086
- }), Ze = E(() => {
3266
+ }), Ze = T(() => {
3087
3267
  y.value;
3088
- let e = X.value;
3268
+ let e = Y.value;
3089
3269
  if (!e) return [];
3090
3270
  let t = /* @__PURE__ */ new Set(), n = [];
3091
3271
  return e.state.doc.descendants((e) => {
@@ -3100,181 +3280,181 @@ var Un = { class: "docx-editor-vue__toolbar-shell" }, Wn = {
3100
3280
  }
3101
3281
  return !0;
3102
3282
  }), n.sort((e, t) => e.name.localeCompare(t.name));
3103
- }), { floatingCommentBtn: Qe, pendingCommentRange: $e, addCommentYPosition: et, sidebarAutoOpenedRef: tt, extractCommentsAndChanges: nt, handleAddComment: rt, handleCancelAddComment: it, handleStartAddComment: at, handleMarkerClick: ot } = En({
3104
- editorView: X,
3105
- getDocument: Z,
3106
- comments: pe,
3107
- trackedChanges: he,
3283
+ }), { floatingCommentBtn: Qe, pendingCommentRange: $e, addCommentYPosition: et, sidebarAutoOpenedRef: tt, extractCommentsAndChanges: nt, handleAddComment: rt, handleCancelAddComment: it, handleStartAddComment: at, handleMarkerClick: ot } = zn({
3284
+ editorView: Y,
3285
+ getDocument: X,
3286
+ comments: me,
3287
+ trackedChanges: ge,
3108
3288
  resolvedCommentIds: Xe,
3109
- activeSidebarItem: q,
3289
+ activeSidebarItem: fe,
3110
3290
  showSidebar: W,
3111
3291
  isAddingComment: G,
3112
3292
  readOnly: s,
3113
- zoom: Y,
3293
+ zoom: J,
3114
3294
  stateTick: y,
3115
3295
  pagesRef: d,
3116
3296
  pagesViewportRef: g,
3117
3297
  emit: a
3118
- }), { docxInputRef: st, handleDocxFileChange: ct, handleDocumentNameChange: ut, downloadCurrentDocument: ft, loadDocumentBuffer: pt, loadDocument: mt, save: ht } = hn({
3119
- loadBuffer: Ae,
3120
- loadParsedDocument: je,
3121
- getDocument: Z,
3122
- saveBlob: Me,
3298
+ }), { docxInputRef: st, handleDocxFileChange: ct, handleDocumentNameChange: lt, downloadCurrentDocument: ut, loadDocumentBuffer: dt, loadDocument: ft, save: pt } = En({
3299
+ loadBuffer: je,
3300
+ loadParsedDocument: Me,
3301
+ getDocument: X,
3302
+ saveBlob: Ne,
3123
3303
  extractCommentsAndChanges: nt,
3124
3304
  emit: a,
3125
3305
  documentName: () => i.documentName,
3126
3306
  onDocumentNameChange: i.onDocumentNameChange,
3127
3307
  nextTick: ce
3128
- }), { hyperlinkPopupData: gt, handleHyperlinkSubmit: _t, handleHyperlinkRemove: yt, handleHyperlinkPopupNavigate: bt, handleHyperlinkPopupEdit: xt, handleHyperlinkPopupRemove: St } = gn({
3129
- editorView: X,
3308
+ }), { hyperlinkPopupData: mt, handleHyperlinkSubmit: ht, handleHyperlinkRemove: gt, handleHyperlinkPopupNavigate: vt, handleHyperlinkPopupEdit: bt, handleHyperlinkPopupRemove: xt } = Dn({
3309
+ editorView: Y,
3130
3310
  getCommands: Le
3131
- }), { handleClearFormatting: Tt, handleApplyStyle: Et, handleInsertPageBreak: Ot, handleInsertSymbol: kt, applyFormatting: At, setParagraphStyle: jt } = _n({
3132
- editorView: X,
3133
- getDocument: Z
3134
- }), { handlePageSetupApply: Pt, handleLeftMarginChange: Ft, handleRightMarginChange: It, handleTopMarginChange: Lt, handleBottomMarginChange: Rt, handleIndentLeftChange: zt, handleIndentRightChange: Bt, handleFirstLineIndentChange: Vt, handleTabStopRemove: Ht } = vn({
3135
- editorView: X,
3136
- getDocument: Z,
3311
+ }), { handleClearFormatting: St, handleApplyStyle: Ct, handleInsertPageBreak: wt, handleInsertSymbol: Tt, applyFormatting: Dt, setParagraphStyle: Ot } = On({
3312
+ editorView: Y,
3313
+ getDocument: X
3314
+ }), { handlePageSetupApply: kt, handleLeftMarginChange: At, handleRightMarginChange: Nt, handleTopMarginChange: Pt, handleBottomMarginChange: It, handleIndentLeftChange: Lt, handleIndentRightChange: Rt, handleFirstLineIndentChange: zt, handleTabStopRemove: Vt } = kn({
3315
+ editorView: Y,
3316
+ getDocument: X,
3137
3317
  readOnly: s,
3138
3318
  stateTick: y,
3139
3319
  reLayout: Re,
3140
3320
  emit: a
3141
- }), { handleToggleOutline: Ut, handleOutlineNavigate: Wt, handleToggleSidebar: Gt, handleEditorScrollMouseDown: Kt } = yn({
3142
- editorView: X,
3321
+ }), { handleToggleOutline: Ht, handleOutlineNavigate: Ut, handleToggleSidebar: Wt, handleEditorScrollMouseDown: qt } = An({
3322
+ editorView: Y,
3143
3323
  showOutline: R,
3144
3324
  showSidebar: W,
3145
- outlineHeadings: J,
3146
- activeSidebarItem: q,
3325
+ outlineHeadings: q,
3326
+ activeSidebarItem: fe,
3147
3327
  extractCommentsAndChanges: nt
3148
3328
  });
3149
- bn({
3329
+ jn({
3150
3330
  showKeyboardShortcuts: V,
3151
- showFindReplace: w,
3152
- showHyperlink: re,
3153
- handleZoomKeyDown: we,
3331
+ showFindReplace: C,
3332
+ showHyperlink: ie,
3333
+ handleZoomKeyDown: Te,
3154
3334
  disableFindReplaceShortcuts: () => i.disableFindReplaceShortcuts
3155
3335
  });
3156
- let { addComment: qt, replyToComment: Jt, resolveComment: Yt, proposeChange: Xt, handleCommentReply: Zt, handleCommentUnresolve: Qt, handleCommentDelete: $t, handleAcceptChange: en, handleRejectChange: tn, handleAcceptChangeById: nn, handleRejectChangeById: an, handleTrackedChangeReply: on } = Sn({
3157
- editorView: X,
3158
- getDocument: Z,
3159
- comments: pe,
3160
- trackedChanges: he,
3336
+ let { addComment: Jt, replyToComment: Yt, resolveComment: Xt, proposeChange: Zt, handleCommentReply: Qt, handleCommentUnresolve: $t, handleCommentDelete: en, handleAcceptChange: tn, handleRejectChange: nn, handleAcceptChangeById: rn, handleRejectChangeById: an, handleTrackedChangeReply: on } = Nn({
3337
+ editorView: Y,
3338
+ getDocument: X,
3339
+ comments: me,
3340
+ trackedChanges: ge,
3161
3341
  showSidebar: W,
3162
3342
  isAddingComment: G,
3163
3343
  pendingCommentRange: $e,
3164
3344
  contentChangeSubscribers: x,
3165
3345
  extractCommentsAndChanges: nt,
3166
3346
  emit: a
3167
- }), { selectedImage: sn, imageInteracting: cn, imageToolbarContext: ln, handleInsertImage: un, handleToolbarImageWrap: dn, handleImageTransform: fn } = Dn({
3168
- editorView: X,
3169
- zoom: Y,
3347
+ }), { selectedImage: sn, imageInteracting: cn, imageToolbarContext: ln, handleInsertImage: un, handleToolbarImageWrap: dn, handleImageTransform: fn } = Bn({
3348
+ editorView: Y,
3349
+ zoom: J,
3170
3350
  stateTick: y,
3171
3351
  getCommands: Le
3172
- }), pn = C(), xn = null, { tableInsertButton: Q, hfEdit: $, scrollPageInfo: Cn, resolvePos: wn, setPmSelection: Tn, scrollVisiblePositionIntoView: On, handlePagesMouseDown: kn, handlePagesMouseMove: An, handlePagesClick: jn, handlePagesDoubleClick: Mn, handleTableInsertClick: Nn, clearTableInsertTimer: Pn, handleHfSave: In, handleHfRemove: Xn } = Ln({
3173
- editorView: X,
3352
+ }), pn = S(), mn = null, { tableInsertButton: Q, hfEdit: $, scrollPageInfo: gn, resolvePos: _n, setPmSelection: vn, scrollVisiblePositionIntoView: yn, handlePagesMouseDown: bn, handlePagesMouseMove: xn, handlePagesClick: Sn, handlePagesDoubleClick: Cn, handleTableInsertClick: wn, clearTableInsertTimer: Mn, handleHfSave: Pn, handleHfRemove: Fn } = Xn({
3353
+ editorView: Y,
3174
3354
  pagesRef: d,
3175
3355
  pagesViewportRef: g,
3176
3356
  selectedImage: sn,
3177
3357
  imageInteracting: cn,
3178
- hyperlinkPopupData: gt,
3358
+ hyperlinkPopupData: mt,
3179
3359
  readOnly: s,
3180
- zoom: Y,
3181
- layout: ke,
3360
+ zoom: J,
3361
+ layout: Ae,
3182
3362
  tableResize: pn,
3183
3363
  getCommands: Le,
3184
- getDocument: Z,
3364
+ getDocument: X,
3185
3365
  reLayout: Re,
3186
3366
  emit: a,
3187
- clearOverlay: lr,
3367
+ clearOverlay: ur,
3188
3368
  syncHfPMs: Be,
3189
3369
  getHfPmView: ze,
3190
3370
  setDocument: He
3191
- }), { contextMenu: Zn, imageContextMenu: Qn, imageContextMenuTextActions: $n, handleContextMenu: er, handleSelectedImageContextMenu: tr, handleImageWrapSelect: nr, handleContextMenuAction: rr } = Fn({
3192
- editorView: X,
3371
+ }), { contextMenu: In, imageContextMenu: Ln, imageContextMenuTextActions: Rn, handleContextMenu: Vn, handleSelectedImageContextMenu: Hn, handleImageWrapSelect: Un, handleContextMenuAction: Wn } = Jn({
3372
+ editorView: Y,
3193
3373
  selectedImage: sn,
3194
- zoom: Y,
3374
+ zoom: J,
3195
3375
  showImageProperties: j,
3196
3376
  getCommands: Le,
3197
- clearOverlay: lr,
3198
- setPmSelection: Tn,
3199
- resolvePos: wn
3200
- }), { handleMenuAction: ir, handleMenuTableInsert: ar } = zn({
3201
- editorView: X,
3377
+ clearOverlay: ur,
3378
+ setPmSelection: vn,
3379
+ resolvePos: _n
3380
+ }), { handleMenuAction: Gn, handleMenuTableInsert: Kn } = Qn({
3381
+ editorView: Y,
3202
3382
  getCommands: Le,
3203
3383
  docxInputRef: st,
3204
3384
  showPageSetup: se,
3205
- showInsertImage: T,
3206
- showHyperlink: re,
3385
+ showInsertImage: w,
3386
+ showHyperlink: ie,
3207
3387
  showInsertSymbol: oe,
3208
3388
  showKeyboardShortcuts: V,
3209
- handleClearFormatting: Tt,
3210
- handleInsertPageBreak: Ot,
3211
- handleToggleOutline: Ut,
3212
- handleToggleSidebar: Gt,
3213
- downloadCurrentDocument: ft,
3389
+ handleClearFormatting: St,
3390
+ handleInsertPageBreak: wt,
3391
+ handleToggleOutline: Ht,
3392
+ handleToggleSidebar: Wt,
3393
+ downloadCurrentDocument: ut,
3214
3394
  emit: a
3215
3395
  });
3216
- Bn({
3396
+ $n({
3217
3397
  documentBuffer: () => i.documentBuffer,
3218
3398
  document: () => i.document,
3219
- loadDocumentBuffer: pt,
3220
- loadDocument: mt,
3399
+ loadDocumentBuffer: dt,
3400
+ loadDocument: ft,
3221
3401
  sidebarAutoOpenedRef: tt
3222
3402
  });
3223
- let or = () => X.value, sr = () => d.value;
3403
+ let qn = () => Y.value, Yn = () => d.value;
3224
3404
  H(() => i.mode, (e) => {
3225
3405
  e && e !== o.value && (o.value = e);
3226
3406
  }), H(() => i.showOutline, (e) => {
3227
3407
  R.value = !!e;
3228
3408
  });
3229
- function cr(e) {
3409
+ function lr(e) {
3230
3410
  o.value !== e && (o.value = e, a("mode-change", e));
3231
3411
  }
3232
3412
  F(() => {
3233
- xn = pn.install();
3413
+ mn = pn.install();
3234
3414
  }), P(() => {
3235
- xn?.();
3415
+ mn?.();
3236
3416
  });
3237
- function lr() {
3238
- dr.clearOverlay();
3239
- }
3240
3417
  function ur() {
3241
- dr.updateSelectionOverlay();
3418
+ fr.clearOverlay();
3242
3419
  }
3243
- let dr = Rn({
3244
- editorView: X,
3420
+ function dr() {
3421
+ fr.updateSelectionOverlay();
3422
+ }
3423
+ let fr = Zn({
3424
+ editorView: Y,
3245
3425
  pagesRef: d,
3246
3426
  selectedImage: sn,
3247
- isHfEditing: E(() => $.value !== null)
3427
+ isHfEditing: T(() => $.value !== null)
3248
3428
  });
3249
3429
  P(() => {
3250
- lr();
3430
+ ur();
3251
3431
  });
3252
- let { exposed: fr } = Vn({
3253
- editorView: X,
3254
- layout: ke,
3432
+ let { exposed: pr } = er({
3433
+ editorView: Y,
3434
+ layout: Ae,
3255
3435
  pagesRef: d,
3256
3436
  pagesViewportRef: g,
3257
- zoom: Y,
3258
- comments: pe,
3259
- focus: Pe,
3260
- destroy: Fe,
3261
- getDocument: Z,
3262
- setZoom: be,
3263
- save: ht,
3264
- loadDocument: mt,
3265
- loadDocumentBuffer: pt,
3266
- addComment: qt,
3267
- replyToComment: Jt,
3268
- resolveComment: Yt,
3269
- proposeChange: Xt,
3270
- applyFormatting: At,
3271
- setParagraphStyle: jt,
3272
- scrollVisiblePositionIntoView: On,
3437
+ zoom: J,
3438
+ comments: me,
3439
+ focus: Fe,
3440
+ destroy: Ie,
3441
+ getDocument: X,
3442
+ setZoom: xe,
3443
+ save: pt,
3444
+ loadDocument: ft,
3445
+ loadDocumentBuffer: dt,
3446
+ addComment: Jt,
3447
+ replyToComment: Yt,
3448
+ resolveComment: Xt,
3449
+ proposeChange: Zt,
3450
+ applyFormatting: Dt,
3451
+ setParagraphStyle: Ot,
3452
+ scrollVisiblePositionIntoView: yn,
3273
3453
  contentChangeSubscribers: x,
3274
- selectionChangeSubscribers: S,
3454
+ selectionChangeSubscribers: ee,
3275
3455
  onPrint: i.onPrint
3276
3456
  });
3277
- return n(fr), (t, n) => (I(), O("div", {
3457
+ return n(pr), (t, n) => (I(), O("div", {
3278
3458
  class: M([
3279
3459
  "docx-editor-vue ep-root paged-editor",
3280
3460
  e.className,
@@ -3287,15 +3467,15 @@ var Un = { class: "docx-editor-vue__toolbar-shell" }, Wn = {
3287
3467
  ]),
3288
3468
  style: N(e.style)
3289
3469
  }, [
3290
- k("div", Un, [A(Mt, {
3470
+ k("div", nr, [A(Gt, {
3291
3471
  "show-menu-bar": e.showMenuBar,
3292
3472
  "document-name": e.documentName,
3293
3473
  "document-name-editable": e.documentNameEditable,
3294
3474
  "render-logo": e.renderLogo,
3295
3475
  "render-title-bar-right": e.renderTitleBarRight,
3296
- onRename: B(ut),
3297
- onMenuAction: B(ir),
3298
- onInsertTable: B(ar)
3476
+ onRename: B(lt),
3477
+ onMenuAction: B(Gn),
3478
+ onInsertTable: B(Kn)
3299
3479
  }, {
3300
3480
  "title-bar-left": U(() => [le(t.$slots, "title-bar-left")]),
3301
3481
  "title-bar-right": U(() => [le(t.$slots, "title-bar-right")]),
@@ -3309,37 +3489,37 @@ var Un = { class: "docx-editor-vue__toolbar-shell" }, Wn = {
3309
3489
  "onRename",
3310
3490
  "onMenuAction",
3311
3491
  "onInsertTable"
3312
- ]), e.showToolbar ? (I(), ie(b, {
3492
+ ]), e.showToolbar ? (I(), E(b, {
3313
3493
  key: 0,
3314
- view: B(X),
3494
+ view: B(Y),
3315
3495
  "get-commands": B(Le),
3316
3496
  "state-tick": y.value,
3317
- "zoom-percent": B(_e),
3318
- "is-min-zoom": B(ve),
3319
- "is-max-zoom": B(ye),
3320
- "zoom-presets": B(Ee),
3497
+ "zoom-percent": B(ve),
3498
+ "is-min-zoom": B(ye),
3499
+ "is-max-zoom": B(be),
3500
+ "zoom-presets": B(De),
3321
3501
  "show-zoom-control": e.showZoomControl,
3322
3502
  "editor-mode": o.value,
3323
3503
  "comments-sidebar-open": W.value,
3324
3504
  "image-context": B(ln),
3325
- theme: We.value,
3505
+ theme: Ge.value,
3326
3506
  "font-families": e.fontFamilies,
3327
- onInsertLink: n[0] ||= (e) => re.value = !0,
3328
- onApplyStyle: B(Et),
3329
- onZoomIn: B(xe),
3330
- onZoomOut: B(Se),
3331
- onZoomSet: B(be),
3332
- onToggleSidebar: B(Gt),
3333
- onModeChange: cr,
3507
+ onInsertLink: n[0] ||= (e) => ie.value = !0,
3508
+ onApplyStyle: B(Ct),
3509
+ onZoomIn: B(Se),
3510
+ onZoomOut: B(Ce),
3511
+ onZoomSet: B(xe),
3512
+ onToggleSidebar: B(Wt),
3513
+ onModeChange: lr,
3334
3514
  onImageWrapType: B(dn),
3335
3515
  onImageProperties: n[1] ||= (e) => j.value = !0,
3336
3516
  onImageTransform: B(fn)
3337
3517
  }, ae({
3338
3518
  "table-context": U(() => [A(h, {
3339
- view: B(X),
3519
+ view: B(Y),
3340
3520
  "get-commands": B(Le),
3341
3521
  "state-tick": y.value,
3342
- theme: We.value
3522
+ theme: Ge.value
3343
3523
  }, null, 8, [
3344
3524
  "view",
3345
3525
  "get-commands",
@@ -3349,7 +3529,7 @@ var Un = { class: "docx-editor-vue__toolbar-shell" }, Wn = {
3349
3529
  _: 2
3350
3530
  }, [e.toolbarExtra ? {
3351
3531
  name: "toolbar-extra",
3352
- fn: U(() => [(I(), ie(ue(e.toolbarExtra)))]),
3532
+ fn: U(() => [(I(), E(ue(e.toolbarExtra)))]),
3353
3533
  key: "0"
3354
3534
  } : {
3355
3535
  name: "toolbar-extra",
@@ -3377,13 +3557,13 @@ var Un = { class: "docx-editor-vue__toolbar-shell" }, Wn = {
3377
3557
  "onImageWrapType",
3378
3558
  "onImageTransform"
3379
3559
  ])) : D("", !0)]),
3380
- A(Nt, {
3381
- "show-find-replace": w.value,
3382
- "onUpdate:showFindReplace": n[2] ||= (e) => w.value = e,
3383
- "show-insert-image": T.value,
3384
- "onUpdate:showInsertImage": n[3] ||= (e) => T.value = e,
3385
- "show-hyperlink": re.value,
3386
- "onUpdate:showHyperlink": n[4] ||= (e) => re.value = e,
3560
+ A(Kt, {
3561
+ "show-find-replace": C.value,
3562
+ "onUpdate:showFindReplace": n[2] ||= (e) => C.value = e,
3563
+ "show-insert-image": w.value,
3564
+ "onUpdate:showInsertImage": n[3] ||= (e) => w.value = e,
3565
+ "show-hyperlink": ie.value,
3566
+ "onUpdate:showHyperlink": n[4] ||= (e) => ie.value = e,
3387
3567
  "show-insert-symbol": oe.value,
3388
3568
  "onUpdate:showInsertSymbol": n[5] ||= (e) => oe.value = e,
3389
3569
  "show-image-properties": j.value,
@@ -3392,16 +3572,16 @@ var Un = { class: "docx-editor-vue__toolbar-shell" }, Wn = {
3392
3572
  "onUpdate:showPageSetup": n[7] ||= (e) => se.value = e,
3393
3573
  "show-keyboard-shortcuts": V.value,
3394
3574
  "onUpdate:showKeyboardShortcuts": n[8] ||= (e) => V.value = e,
3395
- view: B(X),
3575
+ view: B(Y),
3396
3576
  bookmarks: Ze.value,
3397
3577
  "selected-image-pm-pos": B(sn)?.pmPos ?? null,
3398
- "section-properties": Ue.value,
3399
- "scroll-visible-position-into-view": B(On),
3578
+ "section-properties": We.value,
3579
+ "scroll-visible-position-into-view": B(yn),
3400
3580
  onInsertImage: B(un),
3401
- onInsertSymbol: B(kt),
3402
- onHyperlinkSubmit: B(_t),
3403
- onHyperlinkRemove: B(yt),
3404
- onPageSetupApply: B(Pt)
3581
+ onInsertSymbol: B(Tt),
3582
+ onHyperlinkSubmit: B(ht),
3583
+ onHyperlinkRemove: B(gt),
3584
+ onPageSetupApply: B(kt)
3405
3585
  }, null, 8, [
3406
3586
  "show-find-replace",
3407
3587
  "show-insert-image",
@@ -3421,8 +3601,8 @@ var Un = { class: "docx-editor-vue__toolbar-shell" }, Wn = {
3421
3601
  "onHyperlinkRemove",
3422
3602
  "onPageSetupApply"
3423
3603
  ]),
3424
- B(Oe) ? (I(), O("div", Wn, z(B(Oe)), 1)) : D("", !0),
3425
- !B(De) && !B(Oe) ? (I(), O("div", Gn, "Loading...")) : D("", !0),
3604
+ B(ke) ? (I(), O("div", rr, z(B(ke)), 1)) : D("", !0),
3605
+ !B(Oe) && !B(ke) ? (I(), O("div", ir, "Loading...")) : D("", !0),
3426
3606
  k("div", {
3427
3607
  ref_key: "hiddenPmRef",
3428
3608
  ref: u,
@@ -3430,21 +3610,21 @@ var Un = { class: "docx-editor-vue__toolbar-shell" }, Wn = {
3430
3610
  }, null, 512),
3431
3611
  k("div", {
3432
3612
  class: "docx-editor-vue__editor-scroll",
3433
- onMousedown: n[31] ||= (...e) => B(Kt) && B(Kt)(...e)
3434
- }, [e.showRuler && Ue.value ? (I(), O("div", {
3613
+ onMousedown: n[31] ||= (...e) => B(qt) && B(qt)(...e)
3614
+ }, [e.showRuler && We.value ? (I(), O("div", {
3435
3615
  key: 0,
3436
3616
  class: "docx-editor-vue__ruler-row",
3437
3617
  style: N(Je.value)
3438
3618
  }, [A(_, {
3439
- "section-props": Ue.value,
3440
- zoom: B(Y),
3619
+ "section-props": We.value,
3620
+ zoom: B(J),
3441
3621
  editable: !s.value,
3442
- onLeftMarginChange: B(Ft),
3443
- onRightMarginChange: B(It),
3444
- onIndentLeftChange: B(zt),
3445
- onIndentRightChange: B(Bt),
3446
- onFirstLineIndentChange: B(Vt),
3447
- onTabStopRemove: B(Ht)
3622
+ onLeftMarginChange: B(At),
3623
+ onRightMarginChange: B(Nt),
3624
+ onIndentLeftChange: B(Lt),
3625
+ onIndentRightChange: B(Rt),
3626
+ onFirstLineIndentChange: B(zt),
3627
+ onTabStopRemove: B(Vt)
3448
3628
  }, null, 8, [
3449
3629
  "section-props",
3450
3630
  "zoom",
@@ -3455,24 +3635,24 @@ var Un = { class: "docx-editor-vue__toolbar-shell" }, Wn = {
3455
3635
  "onIndentRightChange",
3456
3636
  "onFirstLineIndentChange",
3457
3637
  "onTabStopRemove"
3458
- ])], 4)) : D("", !0), k("div", Kn, [
3638
+ ])], 4)) : D("", !0), k("div", ar, [
3459
3639
  k("div", {
3460
3640
  ref_key: "pagesViewportRef",
3461
3641
  ref: g,
3462
3642
  class: "docx-editor-vue__pages-viewport",
3463
- onMousedown: n[22] ||= (...e) => B(kn) && B(kn)(...e),
3464
- onMousemove: n[23] ||= (...e) => B(An) && B(An)(...e),
3465
- onClick: n[24] ||= (...e) => B(jn) && B(jn)(...e),
3466
- onDblclick: n[25] ||= (...e) => B(Mn) && B(Mn)(...e),
3467
- onContextmenu: n[26] ||= K((...e) => B(er) && B(er)(...e), ["prevent"]),
3468
- onWheel: n[27] ||= (...e) => B(Ce) && B(Ce)(...e)
3643
+ onMousedown: n[22] ||= (...e) => B(bn) && B(bn)(...e),
3644
+ onMousemove: n[23] ||= (...e) => B(xn) && B(xn)(...e),
3645
+ onClick: n[24] ||= (...e) => B(Sn) && B(Sn)(...e),
3646
+ onDblclick: n[25] ||= (...e) => B(Cn) && B(Cn)(...e),
3647
+ onContextmenu: n[26] ||= K((...e) => B(Vn) && B(Vn)(...e), ["prevent"]),
3648
+ onWheel: n[27] ||= (...e) => B(we) && B(we)(...e)
3469
3649
  }, [
3470
- e.showRuler && Ue.value ? (I(), O("div", qn, [A(p, {
3471
- "section-props": Ue.value,
3472
- zoom: B(Y),
3650
+ e.showRuler && We.value ? (I(), O("div", or, [A(p, {
3651
+ "section-props": We.value,
3652
+ zoom: B(J),
3473
3653
  editable: !s.value,
3474
- onTopMarginChange: B(Lt),
3475
- onBottomMarginChange: B(Rt)
3654
+ onTopMarginChange: B(Pt),
3655
+ onBottomMarginChange: B(It)
3476
3656
  }, null, 8, [
3477
3657
  "section-props",
3478
3658
  "zoom",
@@ -3486,14 +3666,19 @@ var Un = { class: "docx-editor-vue__toolbar-shell" }, Wn = {
3486
3666
  class: "docx-editor-vue__pages paged-editor__pages",
3487
3667
  style: N(qe.value)
3488
3668
  }, null, 4),
3489
- A(Dt, {
3669
+ s.value ? D("", !0) : (I(), E(Bt, {
3670
+ key: 1,
3671
+ container: d.value,
3672
+ view: B(Y)
3673
+ }, null, 8, ["container", "view"])),
3674
+ A(Ft, {
3490
3675
  "is-open": B($) !== null,
3491
3676
  position: B($)?.position ?? "header",
3492
3677
  view: Ke.value,
3493
3678
  "target-rect": B($)?.targetRect ?? null,
3494
- onSave: B(In),
3679
+ onSave: B(Pn),
3495
3680
  onClose: n[9] ||= (e) => $.value = null,
3496
- onRemove: B(Xn)
3681
+ onRemove: B(Fn)
3497
3682
  }, null, 8, [
3498
3683
  "is-open",
3499
3684
  "position",
@@ -3502,49 +3687,49 @@ var Un = { class: "docx-editor-vue__toolbar-shell" }, Wn = {
3502
3687
  "onSave",
3503
3688
  "onRemove"
3504
3689
  ]),
3505
- B($) && Ge.value ? (I(), O("div", {
3506
- key: 1,
3690
+ B($) && Z.value ? (I(), O("div", {
3691
+ key: 2,
3507
3692
  "aria-hidden": "true",
3508
3693
  style: N({
3509
3694
  position: "fixed",
3510
- top: `${Ge.value.top}px`,
3511
- left: `${Ge.value.left}px`,
3695
+ top: `${Z.value.top}px`,
3696
+ left: `${Z.value.left}px`,
3512
3697
  width: "2px",
3513
- height: `${Ge.value.height}px`,
3698
+ height: `${Z.value.height}px`,
3514
3699
  background: "#4285f4",
3515
3700
  pointerEvents: "none",
3516
3701
  zIndex: 9999,
3517
3702
  animation: "hf-caret-blink 1.06s steps(1) infinite"
3518
3703
  })
3519
3704
  }, null, 4)) : D("", !0),
3520
- A(vt, {
3705
+ A(Et, {
3521
3706
  "image-info": B(sn),
3522
- zoom: B(Y),
3523
- view: B(X),
3707
+ zoom: B(J),
3708
+ view: B(Y),
3524
3709
  onOpenProperties: n[10] ||= (e) => j.value = !0,
3525
3710
  onDeselect: n[11] ||= (e) => sn.value = null,
3526
3711
  onInteractStart: n[12] ||= (e) => cn.value = !0,
3527
3712
  onInteractEnd: n[13] ||= (e) => cn.value = !1,
3528
- onContextMenu: B(tr)
3713
+ onContextMenu: B(Hn)
3529
3714
  }, null, 8, [
3530
3715
  "image-info",
3531
3716
  "zoom",
3532
3717
  "view",
3533
3718
  "onContextMenu"
3534
3719
  ]),
3535
- A(dt, {
3536
- "get-view": or,
3537
- "get-pages-container": sr,
3538
- zoom: B(Y),
3720
+ A(yt, {
3721
+ "get-view": qn,
3722
+ "get-pages-container": Yn,
3723
+ zoom: B(J),
3539
3724
  "transaction-version": y.value,
3540
- "sync-coordinator": B(ee)
3725
+ "sync-coordinator": B(te)
3541
3726
  }, null, 8, [
3542
3727
  "zoom",
3543
3728
  "transaction-version",
3544
3729
  "sync-coordinator"
3545
3730
  ]),
3546
3731
  B(Qe) && !G.value && !s.value ? (I(), O("button", {
3547
- key: 2,
3732
+ key: 3,
3548
3733
  type: "button",
3549
3734
  class: "docx-editor-vue__floating-comment",
3550
3735
  style: N({
@@ -3556,9 +3741,9 @@ var Un = { class: "docx-editor-vue__toolbar-shell" }, Wn = {
3556
3741
  }, [A(c, {
3557
3742
  name: "add_comment",
3558
3743
  size: 16
3559
- })], 44, Jn)) : D("", !0),
3744
+ })], 44, sr)) : D("", !0),
3560
3745
  B(Q) && !s.value ? (I(), O("button", {
3561
- key: 3,
3746
+ key: 4,
3562
3747
  type: "button",
3563
3748
  class: "docx-editor-vue__table-insert-btn",
3564
3749
  style: N({
@@ -3567,8 +3752,8 @@ var Un = { class: "docx-editor-vue__toolbar-shell" }, Wn = {
3567
3752
  }),
3568
3753
  title: B(Q).type === "row" ? "Insert row below" : "Insert column to the right",
3569
3754
  "aria-label": B(Q).type === "row" ? "Insert row below" : "Insert column to the right",
3570
- onMousedown: n[15] ||= (...e) => B(Nn) && B(Nn)(...e),
3571
- onMouseenter: n[16] ||= (...e) => B(Pn) && B(Pn)(...e),
3755
+ onMousedown: n[15] ||= (...e) => B(wn) && B(wn)(...e),
3756
+ onMouseenter: n[16] ||= (...e) => B(Mn) && B(Mn)(...e),
3572
3757
  onMouseleave: n[17] ||= (e) => Q.value = null
3573
3758
  }, [...n[36] ||= [k("svg", {
3574
3759
  width: "12",
@@ -3580,11 +3765,11 @@ var Un = { class: "docx-editor-vue__toolbar-shell" }, Wn = {
3580
3765
  stroke: "currentColor",
3581
3766
  "stroke-width": "1.5",
3582
3767
  "stroke-linecap": "round"
3583
- })], -1)]], 44, Yn)) : D("", !0),
3768
+ })], -1)]], 44, cr)) : D("", !0),
3584
3769
  A(v, {
3585
- comments: pe.value,
3770
+ comments: me.value,
3586
3771
  "pages-container": d.value,
3587
- zoom: B(Y),
3772
+ zoom: B(J),
3588
3773
  "page-width-px": Ye.value,
3589
3774
  "sidebar-open": W.value,
3590
3775
  "resolved-comment-ids": Xe.value,
@@ -3600,28 +3785,28 @@ var Un = { class: "docx-editor-vue__toolbar-shell" }, Wn = {
3600
3785
  ]),
3601
3786
  A(m, {
3602
3787
  "is-open": W.value,
3603
- comments: pe.value,
3604
- "tracked-changes": he.value,
3788
+ comments: me.value,
3789
+ "tracked-changes": ge.value,
3605
3790
  "is-adding-comment": G.value,
3606
3791
  "add-comment-y-position": B(et),
3607
3792
  "show-resolved": !0,
3608
3793
  "pages-container": d.value,
3609
3794
  "page-width-px": Ye.value,
3610
- zoom: B(Y),
3611
- "active-item-id": q.value,
3795
+ zoom: B(J),
3796
+ "active-item-id": fe.value,
3612
3797
  onClose: n[18] ||= (e) => W.value = !1,
3613
3798
  onAddComment: B(rt),
3614
3799
  onCancelAddComment: B(it),
3615
- onCommentReply: B(Zt),
3616
- onCommentResolve: B(Yt),
3617
- onCommentUnresolve: B(Qt),
3618
- onCommentDelete: B($t),
3619
- onAcceptChange: B(en),
3620
- onRejectChange: B(tn),
3621
- onAcceptChangeById: B(nn),
3800
+ onCommentReply: B(Qt),
3801
+ onCommentResolve: B(Xt),
3802
+ onCommentUnresolve: B($t),
3803
+ onCommentDelete: B(en),
3804
+ onAcceptChange: B(tn),
3805
+ onRejectChange: B(nn),
3806
+ onAcceptChangeById: B(rn),
3622
3807
  onRejectChangeById: B(an),
3623
3808
  onTrackedChangeReply: B(on),
3624
- "onUpdate:activeItemId": n[19] ||= (e) => q.value = e
3809
+ "onUpdate:activeItemId": n[19] ||= (e) => fe.value = e
3625
3810
  }, null, 8, [
3626
3811
  "is-open",
3627
3812
  "comments",
@@ -3644,14 +3829,14 @@ var Un = { class: "docx-editor-vue__toolbar-shell" }, Wn = {
3644
3829
  "onRejectChangeById",
3645
3830
  "onTrackedChangeReply"
3646
3831
  ]),
3647
- A(mn, {
3648
- data: B(gt),
3832
+ A(Tn, {
3833
+ data: B(mt),
3649
3834
  "read-only": s.value,
3650
- onNavigate: B(bt),
3651
- onCopy: n[20] ||= (e) => gt.value = null,
3652
- onEdit: B(xt),
3653
- onRemove: B(St),
3654
- onClose: n[21] ||= (e) => gt.value = null
3835
+ onNavigate: B(vt),
3836
+ onCopy: n[20] ||= (e) => mt.value = null,
3837
+ onEdit: B(bt),
3838
+ onRemove: B(xt),
3839
+ onClose: n[21] ||= (e) => mt.value = null
3655
3840
  }, null, 8, [
3656
3841
  "data",
3657
3842
  "read-only",
@@ -3665,27 +3850,27 @@ var Un = { class: "docx-editor-vue__toolbar-shell" }, Wn = {
3665
3850
  type: "button",
3666
3851
  class: "docx-editor-vue__outline-toggle",
3667
3852
  title: "Show document outline",
3668
- onClick: n[28] ||= (...e) => B(Ut) && B(Ut)(...e),
3853
+ onClick: n[28] ||= (...e) => B(Ht) && B(Ht)(...e),
3669
3854
  onMousedown: n[29] ||= K(() => {}, ["stop"])
3670
3855
  }, [A(c, {
3671
3856
  name: "format_list_bulleted",
3672
3857
  size: 20
3673
3858
  })], 32)) : D("", !0),
3674
- B(Cn).totalPages > 1 ? (I(), ie(wt, {
3859
+ B(gn).totalPages > 1 ? (I(), E(Mt, {
3675
3860
  key: 1,
3676
- "current-page": B(Cn).currentPage,
3677
- "total-pages": B(Cn).totalPages,
3678
- visible: B(Cn).visible
3861
+ "current-page": B(gn).currentPage,
3862
+ "total-pages": B(gn).totalPages,
3863
+ visible: B(gn).visible
3679
3864
  }, null, 8, [
3680
3865
  "current-page",
3681
3866
  "total-pages",
3682
3867
  "visible"
3683
3868
  ])) : D("", !0),
3684
- A(Ct, {
3869
+ A(jt, {
3685
3870
  "is-open": R.value,
3686
- headings: J.value,
3871
+ headings: q.value,
3687
3872
  onClose: n[30] ||= (e) => R.value = !1,
3688
- onNavigate: B(Wt)
3873
+ onNavigate: B(Ut)
3689
3874
  }, null, 8, [
3690
3875
  "is-open",
3691
3876
  "headings",
@@ -3700,16 +3885,16 @@ var Un = { class: "docx-editor-vue__toolbar-shell" }, Wn = {
3700
3885
  style: { display: "none" },
3701
3886
  onChange: n[32] ||= (...e) => B(ct) && B(ct)(...e)
3702
3887
  }, null, 544),
3703
- A(rn, {
3888
+ A(hn, {
3704
3889
  "read-only": s.value,
3705
- "context-menu": B(Zn),
3706
- "image-context-menu": B(Qn),
3707
- "image-context-menu-text-actions": B($n),
3890
+ "context-menu": B(In),
3891
+ "image-context-menu": B(Ln),
3892
+ "image-context-menu-text-actions": B(Rn),
3708
3893
  "can-open-image-properties": !!B(sn),
3709
- onContextMenuAction: B(rr),
3710
- onCloseContextMenu: n[33] ||= (e) => B(Zn).isOpen = !1,
3711
- onImageWrapSelect: B(nr),
3712
- onCloseImageContextMenu: n[34] ||= (e) => Qn.value = null,
3894
+ onContextMenuAction: B(Wn),
3895
+ onCloseContextMenu: n[33] ||= (e) => B(In).isOpen = !1,
3896
+ onImageWrapSelect: B(Un),
3897
+ onCloseImageContextMenu: n[34] ||= (e) => Ln.value = null,
3713
3898
  onOpenImageProperties: n[35] ||= (e) => j.value = !0
3714
3899
  }, null, 8, [
3715
3900
  "read-only",
@@ -3725,8 +3910,8 @@ var Un = { class: "docx-editor-vue__toolbar-shell" }, Wn = {
3725
3910
  });
3726
3911
  //#endregion
3727
3912
  //#region src/renderAsync.ts
3728
- async function Zn(e, t, n = {}) {
3729
- let r = e instanceof ArrayBuffer ? e : await Se(e), i = null, a = null, o = !1, s = {
3913
+ async function ur(e, t, n = {}) {
3914
+ let r = e instanceof ArrayBuffer ? e : await Ce(e), i = null, a = null, o = !1, s = {
3730
3915
  save: async () => {
3731
3916
  let e = await (i?.save() ?? Promise.resolve(null));
3732
3917
  return e ? new Blob([e], { type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" }) : null;
@@ -3747,8 +3932,8 @@ async function Zn(e, t, n = {}) {
3747
3932
  }
3748
3933
  };
3749
3934
  return new Promise((e, c) => {
3750
- a = re({ setup() {
3751
- return () => se(Xn, {
3935
+ a = ie({ setup() {
3936
+ return () => se(lr, {
3752
3937
  ...n,
3753
3938
  documentBuffer: r,
3754
3939
  showToolbar: n.showToolbar ?? !0,
@@ -3772,6 +3957,6 @@ async function Zn(e, t, n = {}) {
3772
3957
  }
3773
3958
  //#endregion
3774
3959
  //#region src/index.ts
3775
- var Qn = "0.0.2";
3960
+ var dr = "0.0.2";
3776
3961
  //#endregion
3777
- export { Xn as DocxEditor, Qn as VERSION, nt as createDocumentWithText, rt as createEmptyDocument, r as defaultLocale, a as i18nPlugin, f as provideLocale, Zn as renderAsync, n as useTranslation };
3962
+ export { lr as DocxEditor, dr as VERSION, ut as createDocumentWithText, dt as createEmptyDocument, r as defaultLocale, a as i18nPlugin, f as provideLocale, ur as renderAsync, n as useTranslation };