@stll/folio-vue 0.21.1 → 0.22.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.
Files changed (80) hide show
  1. package/dist/ListButtons-DIWR-Q8d.cjs +4 -0
  2. package/dist/{ListButtons-CSyBR9KM.js → ListButtons-DjLPhg8p.js} +398 -379
  3. package/dist/{SplitCellDialog-NOmSMMla.cjs → SplitCellDialog-B_z6ynxm.cjs} +2 -2
  4. package/dist/components/DocxEditor/types.d.ts +2 -0
  5. package/dist/composables/useCommentManagement.d.ts +2 -0
  6. package/dist/composables/useDocxEditor.d.ts +2 -0
  7. package/dist/composables/useDocxEditorRefApi.d.ts +3 -2
  8. package/dist/composables/usePageSetupControls.d.ts +2 -0
  9. package/dist/composables/usePagesPointer.d.ts +3 -0
  10. package/dist/composables/useTransientNotice.d.ts +5 -0
  11. package/dist/composables.cjs +1 -1
  12. package/dist/composables.js +1 -1
  13. package/dist/dialogs.cjs +1 -1
  14. package/dist/folio-vue.css +1 -1
  15. package/dist/i18n/messages/ar.d.ts +1 -0
  16. package/dist/i18n/messages/cs.d.ts +1 -0
  17. package/dist/i18n/messages/de.d.ts +1 -0
  18. package/dist/i18n/messages/en.d.ts +1 -0
  19. package/dist/i18n/messages/es.d.ts +1 -0
  20. package/dist/i18n/messages/et.d.ts +1 -0
  21. package/dist/i18n/messages/fr.d.ts +1 -0
  22. package/dist/i18n/messages/he.d.ts +1 -0
  23. package/dist/i18n/messages/hi.d.ts +1 -0
  24. package/dist/i18n/messages/hu.d.ts +1 -0
  25. package/dist/i18n/messages/locales.d.ts +1 -0
  26. package/dist/i18n/messages/lt.d.ts +1 -0
  27. package/dist/i18n/messages/lv.d.ts +1 -0
  28. package/dist/i18n/messages/pl.d.ts +1 -0
  29. package/dist/i18n/messages/pt-BR.d.ts +1 -0
  30. package/dist/i18n/messages/sk.d.ts +1 -0
  31. package/dist/i18n/messages/tr.d.ts +1 -0
  32. package/dist/i18n/messages/zh-CN.d.ts +1 -0
  33. package/dist/index.cjs +1 -1
  34. package/dist/index.js +1496 -1362
  35. package/dist/messages/ar.cjs +1 -0
  36. package/dist/messages/ar.js +2 -0
  37. package/dist/messages/cs.cjs +1 -0
  38. package/dist/messages/cs.js +2 -0
  39. package/dist/messages/de.cjs +1 -0
  40. package/dist/messages/de.js +2 -0
  41. package/dist/messages/en.cjs +1 -0
  42. package/dist/messages/en.js +2 -0
  43. package/dist/messages/es.cjs +1 -0
  44. package/dist/messages/es.js +2 -0
  45. package/dist/messages/et.cjs +1 -0
  46. package/dist/messages/et.js +2 -0
  47. package/dist/messages/fr.cjs +1 -0
  48. package/dist/messages/fr.js +2 -0
  49. package/dist/messages/he.cjs +1 -0
  50. package/dist/messages/he.js +2 -0
  51. package/dist/messages/hi.cjs +1 -0
  52. package/dist/messages/hi.js +2 -0
  53. package/dist/messages/hu.cjs +1 -0
  54. package/dist/messages/hu.js +2 -0
  55. package/dist/messages/locales.cjs +1 -0
  56. package/dist/messages/locales.js +2 -0
  57. package/dist/messages/lt.cjs +1 -0
  58. package/dist/messages/lt.js +2 -0
  59. package/dist/messages/lv.cjs +1 -0
  60. package/dist/messages/lv.js +2 -0
  61. package/dist/messages/pl.cjs +1 -0
  62. package/dist/messages/pl.js +2 -0
  63. package/dist/messages/pt-BR.cjs +1 -0
  64. package/dist/messages/pt-BR.js +2 -0
  65. package/dist/messages/sk.cjs +1 -0
  66. package/dist/messages/sk.js +2 -0
  67. package/dist/messages/tr.cjs +1 -0
  68. package/dist/messages/tr.js +2 -0
  69. package/dist/messages/zh-CN.cjs +1 -0
  70. package/dist/messages/zh-CN.js +2 -0
  71. package/dist/rolldown-runtime-C6qsp3rV.cjs +1 -0
  72. package/dist/ui.cjs +1 -1
  73. package/dist/ui.js +1 -1
  74. package/dist/useZoom-BT2c88KW.cjs +1 -0
  75. package/dist/{useZoom-C75jJC2q.js → useZoom-BycIz5VE.js} +324 -283
  76. package/dist/utils/domQueries.d.ts +2 -6
  77. package/dist/utils/viewportPosition.d.ts +11 -0
  78. package/package.json +8 -3
  79. package/dist/ListButtons-BSRd6dsB.cjs +0 -4
  80. package/dist/useZoom-Df8U8Fko.cjs +0 -1
@@ -1,58 +1,61 @@
1
1
  import { computed as e, inject as t, onBeforeUnmount as n, onMounted as r, onScopeDispose as i, provide as a, ref as o, shallowRef as s, toValue as c, watch as l, watchEffect as u } from "vue";
2
- import { getMargins as d, getPageSize as f, twipsToPixels as p } from "@stll/folio-core/paged-layout/sectionGeometry";
3
- import { createAnonymizationDecorationsPlugin as m } from "@stll/folio-core/prosemirror/plugins/anonymizationDecorations";
4
- import { autocompleteSuggestionPlugin as h } from "@stll/folio-core/prosemirror/plugins/autocompleteSuggestion";
5
- import { createTemplateDirectivesPlugin as g } from "@stll/folio-core/prosemirror/plugins/templateDirectives";
6
- import { createSuggestionModePlugin as _, setSuggestionMode as ee } from "@stll/folio-core/prosemirror/plugins/suggestionMode";
7
- import { FOLIO_DOCX_SERIALIZATION_MODE as v, createFolioEditor as y } from "@stll/folio-core/controller/folioEditor";
8
- import { createFolioEditorEmitter as te } from "@stll/folio-core/controller/folioEditorEvents";
9
- import { loadCollaborationModules as ne } from "@stll/folio-core/controller/collaborationModules";
10
- import { createHeaderFooterEditorManager as re } from "@stll/folio-core/controller/headerFooterEditorManager";
11
- import { createNoteEditorManager as ie } from "@stll/folio-core/controller/noteEditorManager";
12
- import { collectRemoteSelections as ae, createHiddenEditorManager as oe, createHiddenEditorState as se } from "@stll/folio-core/controller/hiddenEditorManager";
13
- import { runLayoutPipeline as ce } from "@stll/folio-core/controller/layoutPipeline";
14
- import { createHyphenationReadiness as le } from "@stll/folio-core/controller/hyphenationReadiness";
15
- import { readFontSetSignature as ue, waitForInitialLayoutFonts as de, watchLayoutFontLoads as fe } from "@stll/folio-core/controller/fontReadiness";
16
- import { TRANSACTION_LAYOUT_TIMING as pe, browserClock as me, createLayoutScheduler as he } from "@stll/folio-core/controller/layoutScheduler";
17
- import { createLayoutSession as ge } from "@stll/folio-core/controller/layoutSession";
18
- import { parseDocx as _e } from "@stll/folio-core/docx/parser";
19
- import { getFootnoteText as ve } from "@stll/folio-core/docx/footnoteParser";
20
- import { convertHeaderFooterPmDocToContent as ye, convertHeaderFooterToContent as be } from "@stll/folio-core/layout-bridge/convert/headerFooterLayout";
21
- import { resolveSectionHeaderFooterRefs as xe } from "@stll/folio-core/layout-engine";
22
- import { LayoutPainter as Se } from "@stll/folio-core/layout-painter";
23
- import { LayoutSelectionGate as Ce } from "@stll/folio-core/paged-layout/LayoutSelectionGate";
24
- import { fromProseDoc as we } from "@stll/folio-core/prosemirror/conversion/fromProseDoc";
25
- import { createNoteReferenceFollower as Te, withoutUnreferencedNotes as Ee } from "@stll/folio-core/prosemirror/noteReferenceReview";
26
- import { ExtensionManager as De } from "@stll/folio-core/prosemirror/extensions/ExtensionManager";
27
- import { getChangedParagraphIds as Oe, hasStructuralChanges as ke, hasUntrackedChanges as Ae, repackWithEditorSectionRemovals as je } from "@stll/folio-core/prosemirror/extensions/features/ParagraphChangeTrackerExtension";
28
- import { createStarterKit as Me } from "@stll/folio-core/prosemirror/extensions/StarterKit";
29
- import { createTemplatePreviewValuesPlugin as Ne } from "@stll/folio-core/prosemirror/plugins/templatePreviewValues";
30
- import { templateSlashMenuPlugin as Pe } from "@stll/folio-core/prosemirror/plugins/templateSlashMenu";
31
- import { resolveHeaderFooterContent as Fe } from "@stll/folio-core/utils/headerFooter";
32
- import { findVerticalScrollParent as Ie } from "@stll/folio-core/utils/findVerticalScrollParent";
33
- import { MIN_CELL_WIDTH_TWIPS as b, MIN_ROW_HEIGHT_TWIPS as Le, TWIPS_PER_PIXEL as x, commitColumnResize as Re, commitRightEdgeResize as ze, commitRowResize as S, readColumnWidthAt as Be, readColumnWidths as Ve, readRowHeight as He } from "@stll/folio-core/prosemirror/tableResize";
34
- import { extractTrackedChanges as Ue } from "@stll/folio-core/prosemirror/utils/extractTrackedChanges";
35
- import { ZOOM_MAX as We, ZOOM_MIN as C, ZOOM_STEP as w } from "@stll/folio-core/utils/zoom";
2
+ import { TRANSACTION_LAYOUT_TIMING as d, browserClock as f, createLayoutScheduler as p } from "@stll/folio-core/controller/layoutScheduler";
3
+ import { CanonicalSessionRefusalError as m, collectRemoteSelections as h, createHiddenEditorManager as g, createHiddenEditorState as _ } from "@stll/folio-core/controller/hiddenEditorManager";
4
+ import { cloneDocumentWithParagraphPropertySources as ee } from "@stll/folio-core/docx/document-clone";
5
+ import { getMargins as te, getPageSize as ne, twipsToPixels as v } from "@stll/folio-core/paged-layout/sectionGeometry";
6
+ import { getEditorScrollRoot as re, scrollEditorBy as ie } from "@stll/folio-core/paged-layout/editorScrollRoot";
7
+ import { createAnonymizationDecorationsPlugin as ae } from "@stll/folio-core/prosemirror/plugins/anonymizationDecorations";
8
+ import { autocompleteSuggestionPlugin as oe } from "@stll/folio-core/prosemirror/plugins/autocompleteSuggestion";
9
+ import { createTemplateDirectivesPlugin as se } from "@stll/folio-core/prosemirror/plugins/templateDirectives";
10
+ import { createSuggestionModePlugin as ce, setSuggestionMode as le } from "@stll/folio-core/prosemirror/plugins/suggestionMode";
11
+ import { FOLIO_DOCX_SERIALIZATION_MODE as ue, createFolioEditor as de } from "@stll/folio-core/controller/folioEditor";
12
+ import { createFolioEditorEmitter as fe } from "@stll/folio-core/controller/folioEditorEvents";
13
+ import { prepareCanonicalDocxInput as pe } from "@stll/folio-core/docx/canonicalSessionInput";
14
+ import { repackWithCanonicalStoryRemovals as me } from "@stll/folio-core/docx/canonicalStoryRepack";
15
+ import { loadCollaborationModules as he } from "@stll/folio-core/controller/collaborationModules";
16
+ import { createHeaderFooterEditorManager as ge } from "@stll/folio-core/controller/headerFooterEditorManager";
17
+ import { createNoteEditorManager as _e } from "@stll/folio-core/controller/noteEditorManager";
18
+ import { runLayoutPipeline as ve } from "@stll/folio-core/controller/layoutPipeline";
19
+ import { createHyphenationReadiness as ye } from "@stll/folio-core/controller/hyphenationReadiness";
20
+ import { readFontSetSignature as be, waitForInitialLayoutFonts as xe, watchLayoutFontLoads as Se } from "@stll/folio-core/controller/fontReadiness";
21
+ import { createLayoutSession as Ce } from "@stll/folio-core/controller/layoutSession";
22
+ import { parseDocx as we } from "@stll/folio-core/docx/parser";
23
+ import { getFootnoteText as Te } from "@stll/folio-core/docx/footnoteParser";
24
+ import { convertHeaderFooterPmDocToContent as Ee, convertHeaderFooterToContent as De } from "@stll/folio-core/layout-bridge/convert/headerFooterLayout";
25
+ import { resolveSectionHeaderFooterRefs as Oe } from "@stll/folio-core/layout-engine";
26
+ import { LayoutPainter as ke } from "@stll/folio-core/layout-painter";
27
+ import { LayoutSelectionGate as Ae } from "@stll/folio-core/paged-layout/LayoutSelectionGate";
28
+ import { fromProseDoc as je } from "@stll/folio-core/prosemirror/conversion/fromProseDoc";
29
+ import { createNoteReferenceFollower as Me, withoutUnreferencedNotes as Ne } from "@stll/folio-core/prosemirror/noteReferenceReview";
30
+ import { ExtensionManager as Pe } from "@stll/folio-core/prosemirror/extensions/ExtensionManager";
31
+ import { getChangedParagraphIds as Fe, hasStructuralChanges as Ie, hasUntrackedChanges as Le, repackWithEditorSectionRemovals as Re } from "@stll/folio-core/prosemirror/extensions/features/ParagraphChangeTrackerExtension";
32
+ import { createStarterKit as ze } from "@stll/folio-core/prosemirror/extensions/StarterKit";
33
+ import { createTemplatePreviewValuesPlugin as Be } from "@stll/folio-core/prosemirror/plugins/templatePreviewValues";
34
+ import { templateSlashMenuPlugin as Ve } from "@stll/folio-core/prosemirror/plugins/templateSlashMenu";
35
+ import { resolveHeaderFooterContent as He } from "@stll/folio-core/utils/headerFooter";
36
+ import { MIN_CELL_WIDTH_TWIPS as y, MIN_ROW_HEIGHT_TWIPS as b, TWIPS_PER_PIXEL as x, commitColumnResize as Ue, commitRightEdgeResize as We, commitRowResize as S, readColumnWidthAt as Ge, readColumnWidths as Ke, readRowHeight as qe } from "@stll/folio-core/prosemirror/tableResize";
37
+ import { extractTrackedChanges as Je } from "@stll/folio-core/prosemirror/utils/extractTrackedChanges";
38
+ import { ZOOM_MAX as Ye, ZOOM_MIN as C, ZOOM_STEP as w } from "@stll/folio-core/utils/zoom";
36
39
  //#region src/utils/colorMode.ts
37
- var Ge = "(prefers-color-scheme: dark)";
38
- function Ke() {
40
+ var Xe = "(prefers-color-scheme: dark)";
41
+ function Ze() {
39
42
  return typeof window < "u" && typeof window.matchMedia == "function";
40
43
  }
41
- function qe(e, t) {
44
+ function Qe(e, t) {
42
45
  return e === "dark" || e === "system" && t;
43
46
  }
44
- function Je(e) {
45
- if (!Ke()) return () => {};
46
- let t = window.matchMedia(Ge);
47
+ function $e(e) {
48
+ if (!Ze()) return () => {};
49
+ let t = window.matchMedia(Xe);
47
50
  e(t.matches);
48
51
  let n = (t) => e(t.matches);
49
52
  return t.addEventListener("change", n), () => t.removeEventListener("change", n);
50
53
  }
51
54
  //#endregion
52
55
  //#region src/composables/useColorMode.ts
53
- var T = "light", E = Symbol("folioColorMode"), Ye = (t = T) => {
56
+ var T = "light", E = Symbol("folioColorMode"), et = (t = T) => {
54
57
  a(E, e(() => c(t)));
55
- }, Xe = { install(t, n = T) {
58
+ }, tt = { install(t, n = T) {
56
59
  t.provide(E, e(() => c(n)));
57
60
  } };
58
61
  function D() {
@@ -60,42 +63,42 @@ function D() {
60
63
  return r(() => {
61
64
  i.value = !0;
62
65
  }), u((e) => {
63
- !i.value || n.value !== "system" || e(Je((e) => {
66
+ !i.value || n.value !== "system" || e($e((e) => {
64
67
  a.value = e;
65
68
  }));
66
- }), e(() => qe(n.value, i.value && a.value));
69
+ }), e(() => Qe(n.value, i.value && a.value));
67
70
  }
68
71
  //#endregion
69
72
  //#region src/composables/useDocxEditor.ts
70
- var Ze = 24, Qe = 250, $e = [], et = [];
71
- function tt(e) {
73
+ var nt = 24, rt = 250, it = [], at = [];
74
+ function ot(e) {
72
75
  let t = e?.columnCount ?? 1;
73
76
  if (t <= 1) return;
74
77
  let n = {
75
78
  count: t,
76
- gap: p(e?.columnSpace ?? 720),
79
+ gap: v(e?.columnSpace ?? 720),
77
80
  equalWidth: e?.equalWidth ?? !0
78
81
  };
79
82
  return e?.separator !== void 0 && (n.separator = e.separator), n;
80
83
  }
81
- function nt(e, t, n, r, i, a) {
84
+ function st(e, t, n, r, i, a) {
82
85
  if (!e) return;
83
86
  let o = t ? {
84
87
  ...a,
85
88
  rId: t
86
89
  } : a, s = t ? n?.getView(t) : null;
87
- return s ? ye(s.state.doc, r, i, o) : be(e, r, i, o);
90
+ return s ? Ee(s.state.doc, r, i, o) : De(e, r, i, o);
88
91
  }
89
- function rt(e, t, n, r, i) {
92
+ function ct(e, t, n, r, i) {
90
93
  if (!e || e.size === 0) return;
91
94
  let a = /* @__PURE__ */ new Map();
92
95
  for (let [o, s] of e) {
93
- let e = nt(s, o, t, n, r, i);
96
+ let e = st(s, o, t, n, r, i);
94
97
  e && a.set(o, e);
95
98
  }
96
99
  return a.size > 0 ? a : void 0;
97
100
  }
98
- function it(e, t, n) {
101
+ function lt(e, t, n) {
99
102
  let r = /* @__PURE__ */ new Map();
100
103
  if (!n || !n.package.footnotes) return r;
101
104
  let i = /* @__PURE__ */ new Map();
@@ -109,7 +112,7 @@ function it(e, t, n) {
109
112
  e.push({
110
113
  displayNumber: String(o),
111
114
  noteId: n,
112
- text: ve(r),
115
+ text: Te(r),
113
116
  ...a ? { content: {
114
117
  blocks: a.blocks,
115
118
  measures: a.measures,
@@ -140,7 +143,7 @@ var O = /* @__PURE__ */ new Set([
140
143
  "white",
141
144
  "yellow"
142
145
  ]);
143
- function at(e) {
146
+ function ut(e) {
144
147
  let t = [], n = (e, r) => {
145
148
  for (let [n, i] of e.marks.entries()) i.type.name === "highlight" && !O.has(String(i.attrs.color)) && t.push(`${r}.marks[${n}]=${JSON.stringify(i.attrs)}`);
146
149
  e.forEach((e, t, i) => {
@@ -150,44 +153,53 @@ function at(e) {
150
153
  return n(e, "doc"), t.join("; ");
151
154
  }
152
155
  function k(e) {
153
- let { hiddenContainer: t, hiddenHeaderFooterContainer: n, noteEditorContainer: r, pagesContainer: a, readOnly: u = !1, pageGap: p = Ze, pageRenderer: ve, markupView: ye = "all-markup", showMarginGuides: be, marginGuideColor: Ie, password: b, editorMode: Le, author: x, externalPlugins: Re = [], historyShortcuts: ze = "editor", collaboration: S, onAnonymizationMatchesChange: Be, showTemplateDirectives: Ve, onSlashMenuChange: He, onSlashMenuKeyAction: Ue, onChange: We, onError: C, onSelectionUpdate: w, onEditorViewReady: Ge, onCopy: Ke, onCut: qe, onPaste: Je, onReadOnlyEditAttempt: T, featureFlags: E, onSelectiveSaveTripwire: Ye } = e, Xe = n ?? t, D = s(null), O = 0, k = !1, A = 0, j = !1, M = s(null), N = s(null), P = s(null), F = s([]), I = s(null), L = s(null), R = s(null), ot = s([]), st = s([]), z = o(!1), B = o(null), V = o(!1), H = new De(Me({ historyShortcuts: ze }));
154
- H.buildSchema(), H.initializeRuntime();
155
- let ct = _(!1), lt = [ct], ut = h({ keymap: !0 }), dt = m({ onMatchesChange: (e) => Be?.(e) }), U = g(), ft = Pe({
156
- onChange: (e) => He?.(e),
157
- onKeyAction: (e) => Ue?.(e) ?? !1
158
- }), pt = Ne(), mt = () => c(Ve) === !0;
159
- function ht() {
156
+ let { hiddenContainer: t, hiddenHeaderFooterContainer: n, noteEditorContainer: r, pagesContainer: a, readOnly: u = !1, experimentalSession: v, pageGap: re = nt, pageRenderer: ie, markupView: Te = "all-markup", showMarginGuides: Ee, marginGuideColor: De, password: y, editorMode: b, author: x, externalPlugins: Ue = [], historyShortcuts: We = "editor", collaboration: S, onAnonymizationMatchesChange: Ge, showTemplateDirectives: Ke, onSlashMenuChange: qe, onSlashMenuKeyAction: Je, onChange: Ye, onError: C, onSelectionUpdate: w, onEditorViewReady: Xe, onCopy: Ze, onCut: Qe, onPaste: $e, onReadOnlyEditAttempt: T, featureFlags: E, onSelectiveSaveTripwire: et } = e, tt = n ?? t, D = s(null), O = 0, k = !1, A = 0, j = !1, M = s(null), N = s(null), P = s(null), F = s([]), I = s(null), L = s(null), R = s(null), dt = s([]), ft = s([]), z = o(!1), B = o(null), V = o(!1), pt = () => c(v) === "canonical", H = (e) => pt() ? ee(e) : e, mt = (e) => {
157
+ if (!pt()) return !1;
158
+ let t = new m({ message: e });
159
+ return C?.(t), !0;
160
+ }, U = new Pe(ze({ historyShortcuts: We }));
161
+ U.buildSchema(), U.initializeRuntime();
162
+ let ht = ce(!1), gt = [ht], _t = oe({ keymap: !0 }), vt = ae({ onMatchesChange: (e) => Ge?.(e) }), yt = se(), bt = Ve({
163
+ onChange: (e) => qe?.(e),
164
+ onKeyAction: (e) => Je?.(e) ?? !1
165
+ }), xt = Be(), St = () => c(Ke) === !0;
166
+ function Ct() {
160
167
  return [
161
- ut,
162
- ct,
163
- ...Re,
168
+ _t,
169
+ ht,
170
+ ...Ue,
164
171
  ...c(S)?.plugins ?? [],
165
- dt,
166
- ...mt() ? [U, ft] : [],
167
- pt
172
+ vt,
173
+ ...St() ? [yt, bt] : [],
174
+ xt
168
175
  ];
169
176
  }
170
- let W = te(), G = new Ce(), K = ge(), gt = le({
177
+ let W = fe(), G = new Ae(), wt = Ce(), Tt = ye({
171
178
  relayout: () => {
172
- let e = M.value?.state ?? K.lastEditorState;
179
+ let e = M.value?.state ?? wt.lastEditorState;
173
180
  e && Y(e, { reason: "hyphenation-ready" });
174
181
  },
175
182
  onError: (e) => C?.(e)
176
183
  });
177
- i(gt.cancel), i(fe({
178
- measuredFontSet: () => K.lastMeasureInputs?.fontSet ?? null,
184
+ i(Tt.cancel), i(Se({
185
+ measuredFontSet: () => wt.lastMeasureInputs?.fontSet ?? null,
179
186
  relayout: () => {
180
187
  if (j) return;
181
- let e = M.value?.state ?? K.lastEditorState;
188
+ let e = M.value?.state ?? wt.lastEditorState;
182
189
  e && Y(e, { reason: "font-ready" });
183
190
  }
184
191
  }));
185
- let _t = new Se({
186
- pageGap: p,
192
+ let Et = new ke({
193
+ pageGap: re,
187
194
  showShadow: !0
188
- }), q = re({
189
- getHost: () => Xe.value,
190
- getDocument: () => D.value,
195
+ }), K = ge({
196
+ getHost: () => tt.value,
197
+ getDocument: () => Q.api.getCanonicalDocument() ?? D.value,
198
+ getCanonicalApi: () => Q.api,
199
+ getExperimentalSession: () => c(v),
200
+ onSessionRefusal: (e) => {
201
+ B.value = e, C?.(new m({ message: e }));
202
+ },
191
203
  getStyles: () => D.value?.package.styles ?? null,
192
204
  getTheme: () => D.value?.package.theme ?? null,
193
205
  onTransaction: ({ rId: e, kind: t, view: n, docChanged: r, selectionChanged: i }) => {
@@ -205,10 +217,15 @@ function k(e) {
205
217
  }
206
218
  G.requestRender();
207
219
  }
208
- }), vt = { current: null }, J = ie({
220
+ }), Dt = { current: null }, q = _e({
209
221
  getHost: () => r?.value ?? null,
210
- getPlugins: () => lt,
211
- getDocument: () => D.value,
222
+ getPlugins: () => gt,
223
+ getDocument: () => Q.api.getCanonicalDocument() ?? D.value,
224
+ getCanonicalApi: () => Q.api,
225
+ getExperimentalSession: () => c(v),
226
+ onSessionRefusal: (e) => {
227
+ B.value = e, C?.(new m({ message: e }));
228
+ },
212
229
  getStyles: () => D.value?.package.styles ?? null,
213
230
  getTheme: () => D.value?.package.theme ?? null,
214
231
  onTransaction: ({ docChanged: e, selectionChanged: t, view: n }) => {
@@ -216,8 +233,8 @@ function k(e) {
216
233
  V.value = !0;
217
234
  let e = D.value;
218
235
  if (e) {
219
- let t = vt.current?.snapshotDocument(e) ?? e;
220
- D.value = t, We?.(t), W.emit("docChange", t);
236
+ let t = Q.api.getCanonicalDocument() ?? Dt.current?.snapshotDocument(e) ?? e;
237
+ D.value = t, Ye?.(H(t)), W.emit("docChange", H(t));
221
238
  }
222
239
  X.schedule();
223
240
  }
@@ -231,96 +248,106 @@ function k(e) {
231
248
  }
232
249
  }
233
250
  });
234
- vt.current = J;
235
- function yt(e) {
236
- e.layout && (R.value = e.layout), e.blocks && (ot.value = e.blocks), e.measures && (st.value = e.measures), e.blockLookup && _t.setBlockLookup(e.blockLookup), e.layout && W.emit("layoutComplete", e.layout);
251
+ Dt.current = q;
252
+ let J = () => {
253
+ K.sync(), q.sync();
254
+ };
255
+ l(() => c(v), J);
256
+ function Ot(e) {
257
+ e.layout && (R.value = e.layout), e.blocks && (dt.value = e.blocks), e.measures && (ft.value = e.measures), e.blockLookup && Et.setBlockLookup(e.blockLookup), e.layout && W.emit("layoutComplete", e.layout);
237
258
  }
238
259
  function Y(e, t = {}) {
239
260
  if (j) return;
240
- let n = a.value, r = n instanceof HTMLDivElement ? n : null, i = D.value, o = i?.package.document, s = o?.sections?.[0]?.properties ?? o?.finalSectionProperties ?? null, l = f(s), u = d(s), m = tt(s), h = l.w - u.left - u.right, g = i?.package.styles ?? null, _ = i?.package.theme ?? null, ee = i?.package.settings?.defaultTabStop, v = i?.package.settings?.mirrorMargins === !0, y = Fe(i?.package);
261
+ let n = a.value, r = n instanceof HTMLDivElement ? n : null, i = D.value, o = i?.package.document, s = o?.sections?.[0]?.properties ?? o?.finalSectionProperties ?? null, l = ne(s), u = te(s), d = ot(s), f = l.w - u.left - u.right, p = i?.package.styles ?? null, m = i?.package.theme ?? null, h = i?.package.settings?.defaultTabStop, g = i?.package.settings?.mirrorMargins === !0, _ = He(i?.package);
241
262
  try {
242
- yt(ce({
243
- contentWidth: h,
244
- columns: m,
263
+ Ot(ve({
264
+ contentWidth: f,
265
+ columns: d,
245
266
  pageSize: l,
246
267
  margins: u,
247
- pageGap: p,
248
- showMarginGuides: c(be) === !0,
249
- marginGuideColor: c(Ie),
268
+ pageGap: re,
269
+ showMarginGuides: c(Ee) === !0,
270
+ marginGuideColor: c(De),
250
271
  ...(() => {
251
- let e = c(ve);
272
+ let e = c(ie);
252
273
  return e === void 0 ? {} : { pageRenderer: e };
253
274
  })(),
254
275
  syncCoordinator: G,
255
- headerContent: y.headerContent,
256
- footerContent: y.footerContent,
257
- firstPageHeaderContent: y.firstPageHeaderContent,
258
- firstPageFooterContent: y.firstPageFooterContent,
259
- headerContentRId: y.activeHeaderRId,
260
- footerContentRId: y.activeFooterRId,
261
- firstPageHeaderContentRId: y.activeFirstHeaderRId,
262
- firstPageFooterContentRId: y.activeFirstFooterRId,
263
- sectionHeaderFooterRefs: xe(i),
264
- theme: _,
276
+ headerContent: _.headerContent,
277
+ footerContent: _.footerContent,
278
+ firstPageHeaderContent: _.firstPageHeaderContent,
279
+ firstPageFooterContent: _.firstPageFooterContent,
280
+ headerContentRId: _.activeHeaderRId,
281
+ footerContentRId: _.activeFooterRId,
282
+ firstPageHeaderContentRId: _.activeFirstHeaderRId,
283
+ firstPageFooterContentRId: _.activeFirstFooterRId,
284
+ sectionHeaderFooterRefs: Oe(i),
285
+ theme: m,
265
286
  sectionProperties: s,
266
287
  document: i,
267
- defaultTabStop: ee,
268
- mirrorMargins: v,
269
- styles: g,
288
+ defaultTabStop: h,
289
+ mirrorMargins: g,
290
+ styles: p,
270
291
  layout: R.value,
271
- hfPMs: q,
272
- painter: _t,
292
+ hfPMs: K,
293
+ painter: Et,
273
294
  pagesContainer: r,
274
- session: K,
275
- renderHfFromContentOrPm: nt,
276
- renderHeaderFooterContentByRId: rt,
277
- readFontSetSignature: ue,
278
- buildFootnoteRenderItems: it,
279
- describeInvalidHighlightMarks: at,
280
- emptyTemplatePreviewEntries: $e,
281
- emptyTemplatePreviewHidden: et,
282
- hyphenationReadiness: gt,
283
- markupView: c(ye)
295
+ session: wt,
296
+ renderHfFromContentOrPm: st,
297
+ renderHeaderFooterContentByRId: ct,
298
+ readFontSetSignature: be,
299
+ buildFootnoteRenderItems: lt,
300
+ describeInvalidHighlightMarks: ut,
301
+ emptyTemplatePreviewEntries: it,
302
+ emptyTemplatePreviewHidden: at,
303
+ hyphenationReadiness: Tt,
304
+ markupView: c(Te)
284
305
  }, e, t));
285
306
  } catch (e) {
286
307
  let t = e instanceof Error ? e : Error(String(e));
287
308
  C?.(t);
288
309
  }
289
310
  }
290
- let X = he({
311
+ let X = p({
291
312
  readState: () => M.value?.state ?? null,
292
313
  runLayout: (e, t) => Y(e, t),
293
- ...pe,
294
- clock: me
295
- }), Z = null, bt = Te();
296
- function xt() {
314
+ ...d,
315
+ clock: f
316
+ }), Z = null, kt = Me();
317
+ function At() {
297
318
  Z !== null && (window.clearTimeout(Z), Z = null);
298
319
  let e = M.value, t = D.value;
299
320
  if (!(!e || !t)) try {
300
- let n = bt.reconcile(we(e.state.doc, t), e.state.doc);
301
- D.value = n, q.sync(), J.sync(), We?.(n), W.emit("docChange", n);
321
+ let n = Q.api.getCanonicalDocument() ?? kt.reconcile(je(e.state.doc, t), e.state.doc);
322
+ D.value = n, J(), Ye?.(H(n)), W.emit("docChange", H(n));
302
323
  } catch (e) {
303
324
  C?.(e instanceof Error ? e : Error(String(e)));
304
325
  }
305
326
  }
306
- function St() {
327
+ function jt() {
307
328
  Z !== null && window.clearTimeout(Z), Z = window.setTimeout(() => {
308
- Z = null, xt();
309
- }, Qe);
329
+ Z = null, At();
330
+ }, rt);
310
331
  }
311
- let Q = oe({
332
+ let Q = g({
312
333
  getHost: () => t.value,
313
334
  getDocument: () => D.value,
314
335
  getStyles: () => D.value?.package.styles ?? null,
315
- getExtensionManager: () => H,
316
- getExternalPlugins: ht,
336
+ getExtensionManager: () => U,
337
+ getExternalPlugins: Ct,
317
338
  getCollaboration: () => c(S),
318
339
  getCollaborationModules: () => P.value,
319
340
  getPrecomputedInitialState: () => null,
320
341
  getReadOnly: () => c(u),
342
+ getExperimentalSession: () => c(v),
343
+ getEditingMode: () => c(b) ?? "editing",
344
+ getSuggestionAuthor: () => c(x) ?? "User",
345
+ onSessionRefusal: (e) => {
346
+ C?.(new m({ message: e }));
347
+ },
321
348
  getDocumentIdentity: () => String(O),
322
349
  getDocumentContext: () => D.value,
323
- onTransaction: Ct,
350
+ onTransaction: Nt,
324
351
  onSelectionChange: (e) => {
325
352
  N.value = e, w?.(e), W.emit("selectionChange", {
326
353
  from: e.selection.from,
@@ -328,20 +355,20 @@ function k(e) {
328
355
  });
329
356
  },
330
357
  onKeyDown: () => !1,
331
- onCopy: () => Ke?.(),
332
- onCut: () => qe?.(),
333
- onPaste: () => Je?.(),
358
+ onCopy: () => Ze?.(),
359
+ onCut: () => Qe?.(),
360
+ onPaste: () => $e?.(),
334
361
  onReadOnlyEditAttempt: () => T?.(),
335
- onEditorViewReady: wt,
362
+ onEditorViewReady: Pt,
336
363
  onEditorViewDestroy: () => {
337
- M.value = null, z.value = !1, Ge?.(null);
364
+ M.value = null, z.value = !1, Xe?.(null);
338
365
  },
339
366
  onRemoteSelectionsChange: (e) => {
340
367
  F.value = e;
341
368
  }
342
- }), $ = () => {
369
+ }), Mt = () => {
343
370
  let e = c(S)?.awareness, t = P.value, n = Q.getView();
344
- F.value = e && t && n ? ae(n.state, e, t) : [];
371
+ F.value = e && t && n ? h(n.state, e, t) : [];
345
372
  };
346
373
  l(() => c(S), (e, t, n) => {
347
374
  if (F.value = [], !e) {
@@ -351,8 +378,8 @@ function k(e) {
351
378
  let r = !1;
352
379
  n(() => {
353
380
  r = !0;
354
- }), P.value = null, ne().then((e) => {
355
- r || (P.value = e, Q.retryViewCreation(), Q.syncExternalDocument(), $());
381
+ }), P.value = null, he().then((e) => {
382
+ r || (P.value = e, Q.retryViewCreation(), Q.syncExternalDocument(), Mt());
356
383
  }, (e) => {
357
384
  r || (P.value = null, C?.(e instanceof Error ? e : Error(String(e))));
358
385
  });
@@ -365,78 +392,82 @@ function k(e) {
365
392
  F.value = [];
366
393
  return;
367
394
  }
368
- e.on("change", $), $(), i(() => {
369
- e.off("change", $), F.value = [];
395
+ e.on("change", Mt), Mt(), i(() => {
396
+ e.off("change", Mt), F.value = [];
370
397
  });
371
398
  }, { flush: "post" });
372
- function Ct({ newState: e, docChanged: t, transactions: n }) {
399
+ function Nt({ newState: e, docChanged: t, transactions: n }) {
373
400
  N.value = e;
374
401
  let r = n[0]?.before;
375
- t && r && bt.noteBase(r), t && (V.value = !0, G.incrementStateSeq(), X.schedule(), St()), G.requestRender();
402
+ if (t && r && kt.noteBase(r), t) {
403
+ let e = Q.api.getCanonicalDocument();
404
+ e && (D.value = e, J()), V.value = !0, G.incrementStateSeq(), X.schedule(), jt();
405
+ }
406
+ G.requestRender();
376
407
  }
377
- function wt(e) {
408
+ function Pt(e) {
378
409
  M.value = e, N.value = e.state, z.value = !0;
379
410
  let t = D.value, n = O, r = ++A;
380
411
  j = !0;
381
412
  let i = () => {
382
413
  A === r && (j = !1, !(k || O !== n || Q.getView() !== e) && (Y(e.state, { reason: "initial" }), G.requestRender()));
383
414
  };
384
- de(t, e.state.doc).then(i, i), Dt(e), Ge?.(e), c(u) || requestAnimationFrame(() => {
415
+ xe(t, e.state.doc).then(i, i), $(e), Xe?.(e), c(u) || requestAnimationFrame(() => {
385
416
  M.value === e && e.focus();
386
417
  });
387
418
  }
388
- let Tt = {
389
- getDocx: async (e) => (await Pt(e))?.buffer ?? null,
390
- loadDocument: Nt,
391
- loadDocx: Mt
392
- }, Et = y({
419
+ let Ft = {
420
+ getDocx: async (e) => (await Ut(e))?.buffer ?? null,
421
+ loadDocument: Ht,
422
+ loadDocx: Vt
423
+ }, It = de({
393
424
  getEditorApi: () => Q.api,
394
425
  getLayout: () => R.value,
395
426
  runLayout: (e, t) => Y(e, t),
396
- getDocumentIO: () => Tt,
427
+ getDocumentIO: () => Ft,
397
428
  emitter: W
398
429
  });
399
- function Dt(e) {
400
- ee(c(Le) === "suggesting", e.state, e.dispatch, c(x));
430
+ function $(e) {
431
+ le(c(b) === "suggesting", e.state, e.dispatch, c(x));
401
432
  }
402
- l([() => c(Le), () => c(x)], () => {
433
+ l([() => c(b), () => c(x)], () => {
403
434
  let e = M.value;
404
- e && Dt(e);
405
- for (let e of J.listStories()) {
406
- let t = J.getView(e);
407
- t && Dt(t);
435
+ e && $(e);
436
+ for (let e of q.listStories()) {
437
+ let t = q.getView(e);
438
+ t && $(t);
408
439
  }
409
440
  }), l(() => c(u), (e) => {
410
- Q.syncEditable(), e && Vt();
441
+ Q.syncEditable(), e && Xt();
411
442
  });
412
- function Ot(e) {
413
- let t = mt();
414
- if (t === e.state.plugins.includes(U)) return;
415
- let n = e.state.plugins.filter((e) => e !== U && e !== ft);
443
+ function Lt(e) {
444
+ let t = St();
445
+ if (t === e.state.plugins.includes(yt)) return;
446
+ let n = e.state.plugins.filter((e) => e !== yt && e !== bt);
416
447
  if (t) {
417
- let e = n.indexOf(pt), t = e === -1 ? n.length : e;
418
- n.splice(t, 0, U, ft);
448
+ let e = n.indexOf(xt), t = e === -1 ? n.length : e;
449
+ n.splice(t, 0, yt, bt);
419
450
  }
420
451
  e.updateState(e.state.reconfigure({ plugins: n }));
421
452
  }
422
- l(() => mt(), () => {
453
+ l(() => St(), () => {
423
454
  let e = M.value;
424
- e && Ot(e);
455
+ e && Lt(e);
425
456
  });
426
- function kt() {
457
+ function Rt() {
427
458
  Q.ensureView();
428
459
  }
429
- function At() {
430
- O += 1, V.value = !1, I.value = null, L.value = null, J.activate(null), X.dispose(), Q.destroyView(), q.sync(), J.sync(), Q.ensureView(), Q.getView() || jt();
460
+ function zt() {
461
+ O += 1, V.value = !1, I.value = null, L.value = null, q.activate(null), X.dispose(), Q.destroyView(), pt() && Q.ensureView(), J(), Q.ensureView(), Q.getView() || Bt();
431
462
  }
432
- function jt() {
463
+ function Bt() {
433
464
  let e = D.value;
434
465
  if (!(!e || c(S))) try {
435
- let t = se({
466
+ let t = _({
436
467
  document: e,
437
468
  styles: e.package.styles ?? null,
438
- manager: H,
439
- externalPlugins: ht(),
469
+ manager: U,
470
+ externalPlugins: Ct(),
440
471
  collaborationModules: null,
441
472
  reason: "mount"
442
473
  });
@@ -446,7 +477,7 @@ function k(e) {
446
477
  let i = () => {
447
478
  A === r && (j = !1, !(k || O !== n || D.value !== e || Q.getView()) && Y(t, { reason: "initial" }));
448
479
  };
449
- de(e, t.doc).then(i, i);
480
+ xe(e, t.doc).then(i, i);
450
481
  } catch (e) {
451
482
  C?.(e instanceof Error ? e : Error(String(e)));
452
483
  }
@@ -454,106 +485,118 @@ function k(e) {
454
485
  l([
455
486
  t,
456
487
  a,
457
- Xe,
488
+ tt,
458
489
  ...r ? [r] : []
459
490
  ], () => {
460
- t.value && D.value && !Q.getView() && kt(), q.sync(), J.sync();
491
+ t.value && D.value && !Q.getView() && Rt(), J();
461
492
  }, { flush: "post" });
462
- async function Mt(e) {
493
+ async function Vt(e) {
463
494
  B.value = null, z.value = !1;
464
495
  try {
465
- let t = await _e(e, { password: c(b) });
466
- D.value = t, At();
496
+ let t = e;
497
+ if (pt()) {
498
+ let n = await pe(e);
499
+ if (n.isErr()) throw n.error;
500
+ t = n.value;
501
+ }
502
+ let n = await we(t, { password: c(y) });
503
+ D.value = n, zt();
467
504
  } catch (e) {
468
505
  let t = e instanceof Error ? e : Error(String(e));
469
506
  B.value = t.message, C?.(t);
470
507
  }
471
508
  }
472
- function Nt(e) {
473
- B.value = null, D.value = e, bt.reset(), At();
509
+ function Ht(e) {
510
+ B.value = null, D.value = e, kt.reset(), zt();
474
511
  }
475
- async function Pt(e) {
476
- Z !== null && xt();
512
+ async function Ut(e) {
513
+ Z !== null && At();
477
514
  let t = M.value, n = D.value;
478
515
  if (!t || !n) return null;
479
- let r = J.snapshotDocument(q.snapshotDocument(n)), i = t.state, { resolveSelectiveSaveFlags: a } = await import("@stll/folio-core/docx/selectiveSaveFlags"), o = a(c(E)), s = Ee(we(i.doc, r)), l = s.originalBuffer ?? null, u = o.selectiveSave && e?.mode !== v.full, d = u || o.selectiveSaveTripwire, { repackDocx: f, createDocx: p } = await import("@stll/folio-core/docx/rezip"), m = null;
480
- if (d && l) {
516
+ let r = q.snapshotDocument(K.snapshotDocument(n)), i = t.state, a = Q.api.getCanonicalDocument(), o = Ne(a ?? je(i.doc, r)), { resolveSelectiveSaveFlags: s } = await import("@stll/folio-core/docx/selectiveSaveFlags"), l = s(c(E)), u = o.originalBuffer ?? null, d = l.selectiveSave && e?.mode !== ue.full, f = d || l.selectiveSaveTripwire, { repackDocx: p, createDocx: m } = await import("@stll/folio-core/docx/rezip"), h = null;
517
+ if (f && u) {
481
518
  let { attemptSelectiveSave: e } = await import("@stll/folio-core/docx/selectiveSave");
482
- m = await e(s, l, {
483
- changedParaIds: Oe(i),
484
- structuralChange: ke(i),
485
- hasUntrackedChanges: Ae(i),
486
- maxBytes: o.selectiveSaveMaxBytes
519
+ h = await e(o, u, {
520
+ changedParaIds: Fe(i),
521
+ structuralChange: Ie(i),
522
+ hasUntrackedChanges: Le(i),
523
+ maxBytes: l.selectiveSaveMaxBytes
487
524
  });
488
525
  }
489
- let h = u ? m : null, g = null, _ = () => je({
526
+ let g = d ? h : null, _ = null, ee = () => a ? me({
527
+ document: o,
528
+ repack: () => p(o)
529
+ }) : Re({
490
530
  state: i,
491
- document: s,
492
- repack: () => f(s)
531
+ document: o,
532
+ repack: () => p(o)
493
533
  });
494
- if (!h) g = l ? await _() : await p(s), h = g;
495
- else if (o.selectiveSaveTripwire) try {
496
- g = await _();
534
+ if (!g) _ = u ? await ee() : await m(o), g = _;
535
+ else if (l.selectiveSaveTripwire) try {
536
+ _ = await ee();
497
537
  } catch {}
498
- if (o.selectiveSaveTripwire && g && Ye) try {
538
+ if (l.selectiveSaveTripwire && _ && et) try {
499
539
  let { compareSelectiveVsFull: e } = await import("@stll/folio-core/docx/selectiveSaveTripwire");
500
- Ye(await e(m, g));
540
+ et(await e(h, _));
501
541
  } catch {}
502
542
  return {
503
- buffer: h,
504
- document: s
543
+ buffer: g,
544
+ document: o
505
545
  };
506
546
  }
507
- async function Ft(e) {
508
- let t = await Pt({ mode: e?.selective === !1 ? v.full : v.preferSelective });
509
- return t ? (D.value = t.document, q.sync(), J.sync(), V.value = !1, new Blob([t.buffer], { type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" })) : null;
547
+ async function Wt(e) {
548
+ let t = M.value, n = t?.state, r = await Ut({ mode: e?.selective === !1 ? ue.full : ue.preferSelective });
549
+ return r ? (M.value === t && t?.state.doc === n?.doc && (D.value = r.document, J(), V.value = !1), new Blob([r.buffer], { type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" })) : null;
510
550
  }
511
- function It() {
512
- let e = D.value;
513
- return e ? J.snapshotDocument(q.snapshotDocument(e)) : null;
551
+ function Gt() {
552
+ let e = Q.api.getCanonicalDocument();
553
+ if (e) return e;
554
+ if (c(v) === "canonical") return null;
555
+ let t = D.value;
556
+ return t ? H(q.snapshotDocument(K.snapshotDocument(t))) : null;
514
557
  }
515
- function Lt(e) {
516
- D.value = e, q.sync(), J.sync(), L.value && !J.getView(L.value) && (L.value = null);
558
+ function Kt(e) {
559
+ mt("Direct document model changes are unavailable in this session.") || (D.value = e, J(), L.value && !q.getView(L.value) && (L.value = null));
517
560
  }
518
- function Rt(e) {
519
- return q.getView(e);
561
+ function qt(e) {
562
+ return K.getView(e);
520
563
  }
521
- function zt() {
522
- q.sync();
564
+ function Jt() {
565
+ J();
523
566
  }
524
- function Bt(e) {
525
- let t = J.activate(e);
526
- t && (Dt(t), L.value = e, requestAnimationFrame(() => t.focus()));
567
+ function Yt(e) {
568
+ let t = q.activate(e);
569
+ t && ($(t), L.value = e, requestAnimationFrame(() => t.focus()));
527
570
  }
528
- function Vt() {
529
- J.activate(null), L.value = null;
571
+ function Xt() {
572
+ q.activate(null), L.value = null;
530
573
  }
531
- function Ht() {
574
+ function Zt() {
532
575
  let e = L.value;
533
- return e ? J.getView(e) : null;
576
+ return e ? q.getView(e) : null;
534
577
  }
535
- function Ut() {
536
- return H.getCommands();
578
+ function Qt() {
579
+ return U.getCommands();
537
580
  }
538
- function Wt() {
539
- let e = Ht();
581
+ function $t() {
582
+ let e = Zt();
540
583
  e ? e.focus() : M.value?.focus();
541
584
  }
542
- function Gt() {
585
+ function en() {
543
586
  let e = M.value;
544
587
  e && Y(e.state, { reason: "manual" });
545
588
  }
546
589
  l([
547
- () => c(be),
548
- () => c(Ie),
549
- () => c(ve),
550
- () => c(ye)
551
- ], () => Gt());
552
- function Kt() {
553
- k = !0, A += 1, j = !1, X.dispose(), Z !== null && (window.clearTimeout(Z), Z = null), Q.destroyView(), F.value = [], q.destroy(), J.destroy(), H.destroy(), N.value = null, R.value = null, D.value = null, z.value = !1;
554
- }
555
- return i(Kt), {
556
- editor: Et,
590
+ () => c(Ee),
591
+ () => c(De),
592
+ () => c(ie),
593
+ () => c(Te)
594
+ ], () => en());
595
+ function tn() {
596
+ k = !0, A += 1, j = !1, X.dispose(), Z !== null && (window.clearTimeout(Z), Z = null), Q.destroyView(), F.value = [], K.destroy(), q.destroy(), U.destroy(), N.value = null, R.value = null, D.value = null, z.value = !1;
597
+ }
598
+ return i(tn), {
599
+ editor: It,
557
600
  editorView: M,
558
601
  editorState: N,
559
602
  remoteSelections: F,
@@ -563,23 +606,23 @@ function k(e) {
563
606
  isDirty: V,
564
607
  parseError: B,
565
608
  layout: R,
566
- blocks: ot,
567
- measures: st,
609
+ blocks: dt,
610
+ measures: ft,
568
611
  syncCoordinator: G,
569
- loadBuffer: Mt,
570
- loadDocument: Nt,
571
- save: Ft,
572
- getDocument: It,
573
- setDocument: Lt,
574
- getHeaderFooterView: Rt,
575
- syncHeaderFooterViews: zt,
576
- openNoteStory: Bt,
577
- closeNoteStory: Vt,
578
- getActiveNoteView: Ht,
579
- getCommands: Ut,
580
- focus: Wt,
581
- reLayout: Gt,
582
- destroy: Kt
612
+ loadBuffer: Vt,
613
+ loadDocument: Ht,
614
+ save: Wt,
615
+ getDocument: Gt,
616
+ setDocument: Kt,
617
+ getHeaderFooterView: qt,
618
+ syncHeaderFooterViews: Jt,
619
+ openNoteStory: Yt,
620
+ closeNoteStory: Xt,
621
+ getActiveNoteView: Zt,
622
+ getCommands: Qt,
623
+ focus: $t,
624
+ reLayout: en,
625
+ destroy: tn
583
626
  };
584
627
  }
585
628
  function A(e, t) {
@@ -596,36 +639,34 @@ function A(e, t) {
596
639
  //#endregion
597
640
  //#region src/composables/useDragAutoScroll.ts
598
641
  function j({ pagesContainer: e, onScrollExtendSelection: t }) {
599
- let n = null, r = 0, a = 0, o = !1, s = null;
600
- function c() {
601
- if (s) return s;
602
- let t = e.value;
603
- return t ? (s = Ie(t), s) : null;
642
+ let n = null, r = 0, a = 0, o = !1;
643
+ function s() {
644
+ return re(e.value);
604
645
  }
605
- function l() {
646
+ function c() {
606
647
  o = !1, n !== null && (cancelAnimationFrame(n), n = null);
607
648
  }
608
- function u() {
649
+ function l() {
609
650
  if (!o) return;
610
- let e = c();
651
+ let e = s();
611
652
  if (!e) return;
612
653
  let i = A(e.getBoundingClientRect(), a);
613
- i !== 0 && (e.scrollTop += i, t(r, a)), n = requestAnimationFrame(u);
654
+ i !== 0 && (ie(e, i), t(r, a)), n = requestAnimationFrame(l);
614
655
  }
615
- function d() {
616
- o || (o = !0, n = requestAnimationFrame(u));
656
+ function u() {
657
+ o || (o = !0, n = requestAnimationFrame(l));
617
658
  }
618
- function f(e, t) {
659
+ function d(e, t) {
619
660
  if (r = e, a = t, !o) {
620
- let e = c();
661
+ let e = s();
621
662
  if (!e) return;
622
663
  let n = e.getBoundingClientRect();
623
- (t < n.top + 40 || t > n.bottom - 40) && d();
664
+ (t < n.top + 40 || t > n.bottom - 40) && u();
624
665
  }
625
666
  }
626
- return i(() => l()), {
627
- updateMousePosition: f,
628
- stopAutoScroll: l
667
+ return i(() => c()), {
668
+ updateMousePosition: d,
669
+ stopAutoScroll: c
629
670
  };
630
671
  }
631
672
  //#endregion
@@ -670,7 +711,7 @@ function M() {
670
711
  let t = r.clientX - e.startX, n = parseFloat(e.handle.style.left);
671
712
  e.handle.style.left = `${n + t}px`, e.startX = r.clientX;
672
713
  let i = Math.round(t * x), a = e.origWidths.left + i, o = e.origWidths.right - i;
673
- a >= b && o >= b && (e.origWidths = {
714
+ a >= y && o >= y && (e.origWidths = {
674
715
  left: a,
675
716
  right: o
676
717
  });
@@ -681,7 +722,7 @@ function M() {
681
722
  let e = r.clientY - t.startY, n = parseFloat(t.handle.style.top);
682
723
  t.handle.style.top = `${n + e}px`, t.startY = r.clientY;
683
724
  let i = Math.round(e * x), a = t.origHeight + i;
684
- a >= Le && (t.origHeight = a);
725
+ a >= b && (t.origHeight = a);
685
726
  return;
686
727
  }
687
728
  if (n.active && n.handle) {
@@ -689,12 +730,12 @@ function M() {
689
730
  let e = r.clientX - n.startX, t = parseFloat(n.handle.style.left);
690
731
  n.handle.style.left = `${t + e}px`, n.startX = r.clientX;
691
732
  let i = Math.round(e * x), a = n.origWidth + i;
692
- a >= b && (n.origWidth = a);
733
+ a >= y && (n.origWidth = a);
693
734
  }
694
735
  }
695
736
  function s(i) {
696
737
  if (e.active) {
697
- e.active = !1, e.handle?.classList.remove("dragging"), r && Re(r, {
738
+ e.active = !1, e.handle?.classList.remove("dragging"), r && Ue(r, {
698
739
  pmStart: e.tablePmStart,
699
740
  colIdx: e.columnIndex,
700
741
  newLeft: e.origWidths.left,
@@ -710,7 +751,7 @@ function M() {
710
751
  }), t.handle = null;
711
752
  return;
712
753
  }
713
- n.active && (n.active = !1, n.handle?.classList.remove("dragging"), r && ze(r, {
754
+ n.active && (n.active = !1, n.handle?.classList.remove("dragging"), r && We(r, {
714
755
  pmStart: n.tablePmStart,
715
756
  colIdx: n.columnIndex,
716
757
  newWidth: n.origWidth
@@ -728,11 +769,11 @@ function M() {
728
769
  };
729
770
  }
730
771
  function N(e, t) {
731
- let n = Ve(e, t.tablePmStart, t.columnIndex);
772
+ let n = Ke(e, t.tablePmStart, t.columnIndex);
732
773
  n && (t.origWidths = n);
733
774
  }
734
775
  function P(e, t, n) {
735
- let r = He(e, t.tablePmStart, t.rowIndex);
776
+ let r = qe(e, t.tablePmStart, t.rowIndex);
736
777
  if (r != null) {
737
778
  t.origHeight = r;
738
779
  return;
@@ -741,17 +782,17 @@ function P(e, t, n) {
741
782
  t.origHeight = Math.round(a * x);
742
783
  }
743
784
  function F(e, t) {
744
- let n = Be(e, t.tablePmStart, t.columnIndex);
785
+ let n = Ge(e, t.tablePmStart, t.columnIndex);
745
786
  n != null && (t.origWidth = n);
746
787
  }
747
788
  //#endregion
748
789
  //#region src/composables/useTrackedChanges.ts
749
790
  function I(t, n) {
750
- return e(() => (n.value, Ue(t.value?.state ?? null)));
791
+ return e(() => (n.value, Je(t.value?.state ?? null)));
751
792
  }
752
793
  //#endregion
753
794
  //#region src/composables/useZoom.ts
754
- var L = C, R = We, ot = [
795
+ var L = C, R = Ye, dt = [
755
796
  .5,
756
797
  .75,
757
798
  1,
@@ -759,7 +800,7 @@ var L = C, R = We, ot = [
759
800
  1.5,
760
801
  2
761
802
  ];
762
- function st(t = 1) {
803
+ function ft(t = 1) {
763
804
  let i = o(Math.max(L, Math.min(R, t))), a = e(() => Math.round(i.value * 100)), s = e(() => i.value <= L), c = e(() => i.value >= R);
764
805
  function l(e) {
765
806
  i.value = Math.max(L, Math.min(R, Math.round(e * 100) / 100));
@@ -794,8 +835,8 @@ function st(t = 1) {
794
835
  handleWheel: p,
795
836
  handleKeyDown: m,
796
837
  installShortcuts: h,
797
- ZOOM_PRESETS: ot
838
+ ZOOM_PRESETS: dt
798
839
  };
799
840
  }
800
841
  //#endregion
801
- export { j as a, T as c, M as i, Ye as l, Ue as n, k as o, I as r, Xe as s, st as t, D as u };
842
+ export { j as a, T as c, M as i, et as l, Je as n, k as o, I as r, tt as s, ft as t, D as u };