@stll/folio-vue 0.31.0 → 0.32.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,47 +1,45 @@
1
1
  import { computed as e, inject as t, onBeforeUnmount as n, onMounted as r, onScopeDispose as i, provide as a, reactive as o, ref as s, shallowRef as c, toRaw as l, toValue as u, watch as d, watchEffect as f } from "vue";
2
- import { CanonicalSessionRefusalError as p, createHiddenEditorManager as m, createHiddenEditorState as ee } from "@stll/folio-core/controller/hiddenEditorManager";
3
- import { carryParseFacts as h, cloneDocumentWithParagraphPropertySources as g } from "@stll/folio-core/docx/document-clone";
4
- import { getEditorReadOnlyReason as te } from "@stll/folio-core/managers/EditorModeManager";
5
- import { getEditorScrollRoot as _, scrollEditorBy as v } from "@stll/folio-core/paged-layout/editorScrollRoot";
6
- import { getMargins as y, getPageSize as b, twipsToPixels as x } from "@stll/folio-core/paged-layout/sectionGeometry";
7
- import { CANONICAL_GAP as ne, canonicalRefusalMessage as re } from "@stll/folio-core/types/canonicalCapabilities";
8
- import { readModel as ie } from "@stll/folio-core/types/documentModel";
2
+ import { CanonicalSessionRefusalError as p, createHiddenEditorManager as m, createHiddenEditorState as h } from "@stll/folio-core/controller/hiddenEditorManager";
3
+ import { getEditorReadOnlyReason as ee } from "@stll/folio-core/managers/EditorModeManager";
4
+ import { getEditorScrollRoot as g, scrollEditorBy as _ } from "@stll/folio-core/paged-layout/editorScrollRoot";
5
+ import { getMargins as te, getPageSize as ne, twipsToPixels as v } from "@stll/folio-core/paged-layout/sectionGeometry";
6
+ import { CANONICAL_GAP as y, canonicalRefusalMessage as b } from "@stll/folio-core/types/canonicalCapabilities";
7
+ import { readModel as x } from "@stll/folio-core/types/documentModel";
9
8
  import { readPaintedTableStart as S } from "@stll/folio-core/utils/paintedPositions";
10
- import { lockHeldRevisions as C, trackedChangeEntryRevisionIds as w } from "@stll/folio-core/prosemirror/commands/comments";
11
- import { createSuggestionModePlugin as ae, setSuggestionMode as oe } from "@stll/folio-core/prosemirror/plugins/suggestionMode";
12
- import { NO_ANONYMIZATION_TERMS as se } from "@stll/folio-core/controller/anonymizationHighlights";
13
- import { DOCUMENT_CHANGE_NOTIFY_DELAY_MS as T } from "@stll/folio-core/controller/documentChangeNotification";
14
- import { FOLIO_DOCX_SERIALIZATION_MODE as E, createFolioEditor as ce } from "@stll/folio-core/controller/folioEditor";
15
- import { createFolioEditorEmitter as le } from "@stll/folio-core/controller/folioEditorEvents";
16
- import { readFontSetSignature as ue, waitForInitialLayoutFonts as D, watchLayoutFontLoads as de } from "@stll/folio-core/controller/fontReadiness";
17
- import { createHeaderFooterEditorManager as fe } from "@stll/folio-core/controller/headerFooterEditorManager";
18
- import { createHyphenationReadiness as pe } from "@stll/folio-core/controller/hyphenationReadiness";
19
- import { runLayoutPipeline as me } from "@stll/folio-core/controller/layoutPipeline";
20
- import { TRANSACTION_LAYOUT_TIMING as he, browserClock as ge, createLayoutScheduler as _e } from "@stll/folio-core/controller/layoutScheduler";
21
- import { createLayoutSession as ve } from "@stll/folio-core/controller/layoutSession";
22
- import { createNoteEditorManager as ye } from "@stll/folio-core/controller/noteEditorManager";
23
- import { canonicalSaveDiagnosticError as be, serializeCanonicalSave as xe } from "@stll/folio-core/docx/canonicalSave";
24
- import { holdsUniqueParagraphIds as Se, openCanonicalDocx as Ce, prepareCanonicalDocumentInput as we } from "@stll/folio-core/docx/canonicalSessionInput";
25
- import { getFootnoteText as Te } from "@stll/folio-core/docx/storyPlainText";
26
- import { convertHeaderFooterPmDocToContent as Ee, convertHeaderFooterToContent as De } from "@stll/folio-core/layout-bridge/convert/headerFooterLayout";
27
- import { resolveSectionHeaderFooterRefs as Oe } from "@stll/folio-core/layout-engine";
28
- import { LayoutPainter as ke, releaseDisplayPageResources as Ae } from "@stll/folio-core/layout-painter";
29
- import { LayoutSelectionGate as je } from "@stll/folio-core/paged-layout/LayoutSelectionGate";
30
- import { ExtensionManager as Me } from "@stll/folio-core/prosemirror/extensions/ExtensionManager";
31
- import { createStarterKit as Ne } from "@stll/folio-core/prosemirror/extensions/StarterKit";
32
- import { createTemplateDirectivesPlugin as Pe } from "@stll/folio-core/prosemirror/plugins/templateDirectives";
33
- import { createTemplatePreviewValuesPlugin as Fe } from "@stll/folio-core/prosemirror/plugins/templatePreviewValues";
34
- import { templateSlashMenuPlugin as Ie } from "@stll/folio-core/prosemirror/plugins/templateSlashMenu";
35
- import { resolveHeaderFooterContent as Le } from "@stll/folio-core/utils/headerFooter";
36
- import { FindReplaceManager as Re } from "@stll/folio-core/managers/FindReplaceManager";
37
- import { findInDisplayedDocument as ze } from "@stll/folio-core/prosemirror/findReplaceSelection";
38
- import { replaceFindMatch as Be, replaceFindMatches as Ve } from "@stll/folio-core/prosemirror/replaceFindMatches";
39
- import { createFindMatchView as He, getRenderedSearchStories as Ue } from "@stll/folio-core/utils/findMatchView";
40
- import { createDefaultFindOptions as We, replaceEligibility as Ge } from "@stll/folio-core/utils/findReplace";
41
- import { createFindSearchKey as O, sameFindSearchKey as Ke } from "@stll/folio-core/utils/findSearchKey";
42
- import { MIN_CELL_WIDTH_TWIPS as qe, MIN_ROW_HEIGHT_TWIPS as Je, TWIPS_PER_PIXEL as k, clampRowResizeDelta as Ye, columnResizeCommand as Xe, readColumnWidthAt as Ze, readColumnWidths as Qe, readRowHeight as $e, rightEdgeResizeCommand as et, rowResizeCommand as A } from "@stll/folio-core/prosemirror/tableResize";
43
- import { extractTrackedChanges as tt } from "@stll/folio-core/prosemirror/utils/extractTrackedChanges";
44
- import { ZOOM_MAX as nt, ZOOM_MIN as j, ZOOM_STEP as rt } from "@stll/folio-core/utils/zoom";
9
+ import { NO_ANONYMIZATION_TERMS as re } from "@stll/folio-core/controller/anonymizationHighlights";
10
+ import { DOCUMENT_CHANGE_NOTIFY_DELAY_MS as C } from "@stll/folio-core/controller/documentChangeNotification";
11
+ import { FOLIO_DOCX_SERIALIZATION_MODE as w, createFolioEditor as ie } from "@stll/folio-core/controller/folioEditor";
12
+ import { createFolioEditorEmitter as ae } from "@stll/folio-core/controller/folioEditorEvents";
13
+ import { readFontSetSignature as oe, waitForInitialLayoutFonts as se, watchLayoutFontLoads as ce } from "@stll/folio-core/controller/fontReadiness";
14
+ import { createHeaderFooterEditorManager as le } from "@stll/folio-core/controller/headerFooterEditorManager";
15
+ import { createHyphenationReadiness as ue } from "@stll/folio-core/controller/hyphenationReadiness";
16
+ import { runLayoutPipeline as de } from "@stll/folio-core/controller/layoutPipeline";
17
+ import { TRANSACTION_LAYOUT_TIMING as fe, browserClock as T, createLayoutScheduler as pe } from "@stll/folio-core/controller/layoutScheduler";
18
+ import { createLayoutSession as me } from "@stll/folio-core/controller/layoutSession";
19
+ import { createNoteEditorManager as he } from "@stll/folio-core/controller/noteEditorManager";
20
+ import { holdsUniqueParagraphIds as ge, openCanonicalDocx as _e, prepareCanonicalDocumentInput as ve } from "@stll/folio-core/docx/canonicalSessionInput";
21
+ import { carryParseFacts as ye, cloneDocumentWithParagraphPropertySources as be } from "@stll/folio-core/docx/document-clone";
22
+ import { getFootnoteText as xe } from "@stll/folio-core/docx/storyPlainText";
23
+ import { convertHeaderFooterPmDocToContent as Se, convertHeaderFooterToContent as Ce } from "@stll/folio-core/layout-bridge/convert/headerFooterLayout";
24
+ import { resolveSectionHeaderFooterRefs as we } from "@stll/folio-core/layout-engine";
25
+ import { LayoutPainter as Te, releaseDisplayPageResources as Ee } from "@stll/folio-core/layout-painter";
26
+ import { LayoutSelectionGate as De } from "@stll/folio-core/paged-layout/LayoutSelectionGate";
27
+ import { ExtensionManager as Oe } from "@stll/folio-core/prosemirror/extensions/ExtensionManager";
28
+ import { createStarterKit as ke } from "@stll/folio-core/prosemirror/extensions/StarterKit";
29
+ import { createTemplateDirectivesPlugin as Ae } from "@stll/folio-core/prosemirror/plugins/templateDirectives";
30
+ import { createTemplatePreviewValuesPlugin as je } from "@stll/folio-core/prosemirror/plugins/templatePreviewValues";
31
+ import { templateSlashMenuPlugin as Me } from "@stll/folio-core/prosemirror/plugins/templateSlashMenu";
32
+ import { resolveHeaderFooterContent as Ne } from "@stll/folio-core/utils/headerFooter";
33
+ import { lockHeldRevisions as Pe, trackedChangeEntryRevisionIds as Fe } from "@stll/folio-core/prosemirror/commands/comments";
34
+ import { FindReplaceManager as Ie } from "@stll/folio-core/managers/FindReplaceManager";
35
+ import { findInDisplayedDocument as Le } from "@stll/folio-core/prosemirror/findReplaceSelection";
36
+ import { replaceFindMatch as Re, replaceFindMatches as ze } from "@stll/folio-core/prosemirror/replaceFindMatches";
37
+ import { createFindMatchView as Be, getRenderedSearchStories as Ve } from "@stll/folio-core/utils/findMatchView";
38
+ import { createDefaultFindOptions as He, replaceEligibility as Ue } from "@stll/folio-core/utils/findReplace";
39
+ import { createFindSearchKey as E, sameFindSearchKey as We } from "@stll/folio-core/utils/findSearchKey";
40
+ import { MIN_CELL_WIDTH_TWIPS as D, MIN_ROW_HEIGHT_TWIPS as Ge, TWIPS_PER_PIXEL as O, clampRowResizeDelta as Ke, columnResizeCommand as qe, readColumnWidthAt as Je, readColumnWidths as Ye, readRowHeight as Xe, rightEdgeResizeCommand as Ze, rowResizeCommand as k } from "@stll/folio-core/prosemirror/tableResize";
41
+ import { extractTrackedChanges as A } from "@stll/folio-core/prosemirror/utils/extractTrackedChanges";
42
+ import { ZOOM_MAX as Qe, ZOOM_MIN as j, ZOOM_STEP as $e } from "@stll/folio-core/utils/zoom";
45
43
  // src/utils/colorMode.ts
46
44
  var M = "(prefers-color-scheme: dark)";
47
45
  function N() {
@@ -58,13 +56,13 @@ function F(e) {
58
56
  return t.addEventListener("change", n), () => t.removeEventListener("change", n);
59
57
  }
60
58
  // src/composables/useColorMode.ts
61
- var it = "light", I = Symbol("folioColorMode"), at = (t = it) => {
59
+ var et = "light", I = Symbol("folioColorMode"), tt = (t = et) => {
62
60
  a(I, e(() => u(t)));
63
- }, L = { install(t, n = it) {
61
+ }, L = { install(t, n = et) {
64
62
  t.provide(I, e(() => u(n)));
65
63
  } };
66
64
  function R() {
67
- let n = t(I, e(() => it)), i = s(!1), a = s(!1);
65
+ let n = t(I, e(() => et)), i = s(!1), a = s(!1);
68
66
  return r(() => {
69
67
  i.value = !0;
70
68
  }), f((e) => {
@@ -74,14 +72,14 @@ function R() {
74
72
  }), e(() => P(n.value, i.value && a.value));
75
73
  }
76
74
  // src/utils/rawDocument.ts
77
- var ot = (e) => z(e, /* @__PURE__ */ new Map()), z = (e, t) => {
75
+ var nt = (e) => z(e, /* @__PURE__ */ new Map()), z = (e, t) => {
78
76
  if (typeof e != "object" || !e) return e;
79
77
  let n = l(e), r = t.get(n);
80
78
  if (r !== void 0) return r;
81
79
  t.set(n, n);
82
- let i = st(n, t);
80
+ let i = rt(n, t);
83
81
  return t.set(n, i), i;
84
- }, st = (e, t) => {
82
+ }, rt = (e, t) => {
85
83
  if (ArrayBuffer.isView(e) || e instanceof ArrayBuffer) return e;
86
84
  if (e instanceof Map) {
87
85
  let n = !1, r = [];
@@ -109,42 +107,42 @@ var ot = (e) => z(e, /* @__PURE__ */ new Map()), z = (e, t) => {
109
107
  let n = Object.getOwnPropertyDescriptors(e), r = !1;
110
108
  for (let e of Reflect.ownKeys(n)) {
111
109
  let i = Reflect.get(n, e);
112
- if (!ct(i)) continue;
110
+ if (!it(i)) continue;
113
111
  let a = z(i.value, t);
114
112
  a !== i.value && (r = !0, i.value = a);
115
113
  }
116
114
  if (!r) return e;
117
115
  let i = Object.create(Reflect.getPrototypeOf(e), n);
118
- return h(i, e), i;
119
- }, ct = (e) => typeof e == "object" && !!e && "value" in e, lt = 24, ut = "User", dt = [], ft = [];
120
- function pt(e) {
116
+ return ye(i, e), i;
117
+ }, it = (e) => typeof e == "object" && !!e && "value" in e, at = 24, ot = "User", st = [], ct = [];
118
+ function lt(e) {
121
119
  let t = e?.columnCount ?? 1;
122
120
  if (t <= 1) return;
123
121
  let n = {
124
122
  count: t,
125
- gap: x(e?.columnSpace ?? 720),
123
+ gap: v(e?.columnSpace ?? 720),
126
124
  equalWidth: e?.equalWidth ?? !0
127
125
  };
128
126
  return e?.separator !== void 0 && (n.separator = e.separator), n;
129
127
  }
130
- function mt(e, t, n, r, i, a) {
128
+ function ut(e, t, n, r, i, a) {
131
129
  if (!e) return;
132
130
  let o = t ? {
133
131
  ...a,
134
132
  rId: t
135
133
  } : a, s = t ? n?.getView(t) : null;
136
- return s ? Ee(s.state.doc, r, i, o) : De(e, r, i, o);
134
+ return s ? Se(s.state.doc, r, i, o) : Ce(e, r, i, o);
137
135
  }
138
- function ht(e, t, n, r, i) {
136
+ function dt(e, t, n, r, i) {
139
137
  if (!e || e.size === 0) return;
140
138
  let a = /* @__PURE__ */ new Map();
141
139
  for (let [o, s] of e) {
142
- let e = mt(s, o, t, n, r, i);
140
+ let e = ut(s, o, t, n, r, i);
143
141
  e && a.set(o, e);
144
142
  }
145
143
  return a.size > 0 ? a : void 0;
146
144
  }
147
- function gt(e, t, n) {
145
+ function ft(e, t, n) {
148
146
  let r = /* @__PURE__ */ new Map();
149
147
  if (!n || !n.package.footnotes) return r;
150
148
  let i = /* @__PURE__ */ new Map();
@@ -158,7 +156,7 @@ function gt(e, t, n) {
158
156
  e.push({
159
157
  displayNumber: String(o),
160
158
  noteId: n,
161
- text: Te(r),
159
+ text: xe(r),
162
160
  ...a ? { content: {
163
161
  blocks: a.blocks,
164
162
  measures: a.measures,
@@ -189,7 +187,7 @@ var B = /* @__PURE__ */ new Set([
189
187
  "white",
190
188
  "yellow"
191
189
  ]);
192
- function _t(e) {
190
+ function pt(e) {
193
191
  let t = [], n = (e, r) => {
194
192
  for (let [n, i] of e.marks.entries()) i.type.name === "highlight" && !B.has(String(i.attrs.color)) && t.push(`${r}.marks[${n}]=${JSON.stringify(i.attrs)}`);
195
193
  e.forEach((e, t, i) => {
@@ -199,40 +197,39 @@ function _t(e) {
199
197
  return n(e, "doc"), t.join("; ");
200
198
  }
201
199
  function V(e) {
202
- let { hiddenContainer: t, hiddenHeaderFooterContainer: n, noteEditorContainer: r, pagesContainer: a, readOnly: o = !1, pageGap: l = lt, pageRenderer: f, markupView: h = "all-markup", showCommentHighlights: te = !0, altChunkMarkerText: _, showMarginGuides: v, marginGuideColor: x, password: S, editorMode: C, author: w, externalPlugins: Te = [], historyShortcuts: Ee = "editor", onCanonicalHistory: De, onCanonicalHistoryDrop: Re, collaboration: ze, getAnonymizationTerms: Be, getDerivedFields: Ve, showTemplateDirectives: He, onSlashMenuChange: Ue, onSlashMenuKeyAction: We, onChange: Ge, onError: O, onSelectionUpdate: Ke, onEditorViewReady: qe, onCopy: Je, onCut: k, onPaste: Ye, onReadOnlyEditAttempt: Xe, featureFlags: Ze, onSelectiveSaveTripwire: Qe } = e, $e = n ?? t, et = () => u(w) ?? ut, A = c(null), tt = () => {
203
- let e = A.value;
204
- return (e && ie(e).package.styles) ?? null;
205
- }, nt = c(null), j = 0, rt = !1, M = 0, N = !1, P = c(null), F = c(null), it = () => u(ze), I = c([]), at = c(null), L = c(null), R = c(null), z = s(0), st = c([]), ct = c([]), B = s(!1), V = s(null), H = s(!1), vt = (e) => g(e), yt = (e) => {
206
- let t = vt(e);
207
- Ge?.(t), G.emit("docChange", t);
208
- }, bt = (e, t) => {
200
+ let { hiddenContainer: t, hiddenHeaderFooterContainer: n, noteEditorContainer: r, pagesContainer: a, readOnly: o = !1, pageGap: l = at, pageRenderer: f, markupView: ee = "all-markup", showCommentHighlights: g = !0, altChunkMarkerText: _, showMarginGuides: v, marginGuideColor: S, password: ye, editorMode: xe, author: Se, externalPlugins: Ce = [], historyShortcuts: Pe = "editor", onCanonicalHistory: Fe, onCanonicalHistoryDrop: Ie, collaboration: Le, getAnonymizationTerms: Re, getDerivedFields: ze, showTemplateDirectives: Be, onSlashMenuChange: Ve, onSlashMenuKeyAction: He, onChange: Ue, onError: E, onSelectionUpdate: We, onEditorViewReady: D, onCopy: Ge, onCut: O, onPaste: Ke, onReadOnlyEditAttempt: qe, featureFlags: Je, onSelectiveSaveTripwire: Ye } = e, Xe = n ?? t, Ze = () => u(Se) ?? ot, k = c(null), A = () => {
201
+ let e = k.value;
202
+ return (e && x(e).package.styles) ?? null;
203
+ }, Qe = c(null), j = 0, $e = !1, M = 0, N = !1, P = c(null), F = c(null), et = () => u(Le), I = c([]), tt = c(null), L = c(null), R = c(null), z = s(0), rt = c([]), it = c([]), B = s(!1), V = s(null), H = s(!1), mt = (e) => be(e), ht = (e) => {
204
+ let t = mt(e);
205
+ Ue?.(t), G.emit("docChange", t);
206
+ }, gt = (e, t) => {
209
207
  let n = new p({
210
208
  ground: { gap: e },
211
- message: re(e, t)
209
+ message: b(e, t)
212
210
  });
213
- return O?.(n), !0;
214
- }, U = new Me(Ne({ historyShortcuts: Ee }));
211
+ return E?.(n), !0;
212
+ }, U = new Oe(ke({ historyShortcuts: Pe }));
215
213
  U.buildSchema(), U.initializeRuntime();
216
- let xt = ae(!1), St = Pe(), Ct = Ie({
217
- onChange: (e) => Ue?.(e),
218
- onKeyAction: (e) => We?.(e) ?? !1
219
- }), wt = Fe(), W = () => u(He) === !0;
220
- function Tt() {
214
+ let _t = Ae(), vt = Me({
215
+ onChange: (e) => Ve?.(e),
216
+ onKeyAction: (e) => He?.(e) ?? !1
217
+ }), yt = je(), W = () => u(Be) === !0;
218
+ function bt() {
221
219
  return [
222
- xt,
223
- ...Te,
224
- ...W() ? [St, Ct] : [],
225
- wt
220
+ ...Ce,
221
+ ...W() ? [_t, vt] : [],
222
+ yt
226
223
  ];
227
224
  }
228
- let G = le(), K = new je(), q = ve(), Et = pe({
225
+ let G = ae(), K = new De(), q = me(), xt = ue({
229
226
  relayout: () => {
230
227
  let e = P.value?.state ?? q.lastEditorState;
231
228
  e && X(e, { reason: "hyphenation-ready" });
232
229
  },
233
- onError: (e) => O?.(e)
230
+ onError: (e) => E?.(e)
234
231
  });
235
- i(Et.cancel), i(de({
232
+ i(xt.cancel), i(ce({
236
233
  measuredFontSet: () => q.lastMeasureInputs?.fontSet ?? null,
237
234
  relayout: () => {
238
235
  if (N) return;
@@ -240,55 +237,55 @@ function V(e) {
240
237
  e && X(e, { reason: "font-ready" });
241
238
  }
242
239
  }));
243
- let Dt = new ke({
240
+ let St = new Te({
244
241
  pageGap: l,
245
242
  showShadow: !0
246
- }), Ot = fe({
247
- getHost: () => $e.value,
243
+ }), Ct = le({
244
+ getHost: () => Xe.value,
248
245
  getReadOnly: () => u(o),
249
246
  getCanonicalApi: () => $.api,
250
247
  readCanonicalDocument: () => $.readCanonicalDocument(),
251
248
  onSessionRefusal: (e, t, n) => {
252
- V.value = e, O?.(n ?? new p({
249
+ V.value = e, E?.(n ?? new p({
253
250
  ground: t,
254
251
  message: e
255
252
  }));
256
253
  },
257
- getStyles: tt,
254
+ getStyles: A,
258
255
  onTransaction: ({ rId: e, kind: t, view: n, docChanged: r, selectionChanged: i }) => {
259
256
  if (r && (H.value = !0, Z.schedule()), r || i) {
260
257
  let { from: r, to: i } = n.state.selection;
261
- at.value = {
258
+ tt.value = {
262
259
  from: r,
263
260
  kind: t,
264
261
  rId: e,
265
262
  to: i
266
- }, Ke?.(n.state), G.emit("selectionChange", {
263
+ }, We?.(n.state), G.emit("selectionChange", {
267
264
  from: r,
268
265
  to: i
269
266
  });
270
267
  }
271
268
  K.requestRender();
272
269
  }
273
- }), J = ye({
270
+ }), J = he({
274
271
  getHost: () => r?.value ?? null,
275
272
  getCanonicalApi: () => $.api,
276
273
  readCanonicalDocument: () => $.readCanonicalDocument(),
277
274
  onSessionRefusal: (e, t, n) => {
278
- V.value = e, O?.(n ?? new p({
275
+ V.value = e, E?.(n ?? new p({
279
276
  ground: t,
280
277
  message: e
281
278
  }));
282
279
  },
283
- getStyles: tt,
280
+ getStyles: A,
284
281
  onTransaction: ({ docChanged: e, selectionChanged: t, view: n }) => {
285
282
  if (e) {
286
283
  H.value = !0;
287
- let e = A.value;
288
- e && (A.value = $.readCanonicalDocument() ?? e, Nt()), Z.schedule();
284
+ let e = k.value;
285
+ e && (k.value = $.readCanonicalDocument() ?? e, Ot()), Z.schedule();
289
286
  }
290
287
  if (e || t) {
291
- Ke?.(n.state);
288
+ We?.(n.state);
292
289
  let { from: e, to: t } = n.state.selection;
293
290
  G.emit("selectionChange", {
294
291
  from: e,
@@ -297,503 +294,493 @@ function V(e) {
297
294
  }
298
295
  }
299
296
  }), Y = () => {
300
- Ot.sync(), J.sync();
297
+ Ct.sync(), J.sync();
301
298
  };
302
- function kt(e) {
303
- e.layout && (R.value = e.layout), e.blocks && (st.value = e.blocks), e.measures && (ct.value = e.measures), e.blockLookup && Dt.setBlockLookup(e.blockLookup), e.layout && G.emit("layoutComplete", e.layout);
299
+ function wt(e) {
300
+ e.layout && (R.value = e.layout), e.blocks && (rt.value = e.blocks), e.measures && (it.value = e.measures), e.blockLookup && St.setBlockLookup(e.blockLookup), e.layout && G.emit("layoutComplete", e.layout);
304
301
  }
305
302
  function X(e, t = {}) {
306
303
  if (N) return;
307
- let n = a.value, r = n instanceof HTMLDivElement ? n : null, i = A.value, o = i && ie(i), s = o?.package.document, c = s?.sections?.[0]?.properties ?? s?.finalSectionProperties ?? null, d = b(c), p = y(c), m = pt(c), ee = d.w - p.left - p.right;
308
- z.value = ee;
309
- let g = o?.package.styles ?? null, ne = i?.package.theme ?? null, re = i?.package.settings?.defaultTabStop, S = i?.package.settings?.mirrorMargins === !0, C = Le(o?.package);
304
+ let n = a.value, r = n instanceof HTMLDivElement ? n : null, i = k.value, o = i && x(i), s = o?.package.document, c = s?.sections?.[0]?.properties ?? s?.finalSectionProperties ?? null, d = ne(c), p = te(c), m = lt(c), h = d.w - p.left - p.right;
305
+ z.value = h;
306
+ let y = o?.package.styles ?? null, b = i?.package.theme ?? null, re = i?.package.settings?.defaultTabStop, C = i?.package.settings?.mirrorMargins === !0, w = Ne(o?.package);
310
307
  try {
311
- kt(me({
312
- contentWidth: ee,
308
+ wt(de({
309
+ contentWidth: h,
313
310
  columns: m,
314
311
  pageSize: d,
315
312
  margins: p,
316
313
  pageGap: l,
317
314
  showMarginGuides: u(v) === !0,
318
- marginGuideColor: u(x),
315
+ marginGuideColor: u(S),
319
316
  ...(() => {
320
317
  let e = u(f);
321
318
  return e === void 0 ? {} : { pageRenderer: e };
322
319
  })(),
323
320
  syncCoordinator: K,
324
- headerContent: C.headerContent,
325
- footerContent: C.footerContent,
326
- firstPageHeaderContent: C.firstPageHeaderContent,
327
- firstPageFooterContent: C.firstPageFooterContent,
328
- headerContentRId: C.activeHeaderRId,
329
- footerContentRId: C.activeFooterRId,
330
- firstPageHeaderContentRId: C.activeFirstHeaderRId,
331
- firstPageFooterContentRId: C.activeFirstFooterRId,
332
- sectionHeaderFooterRefs: Oe(o),
333
- theme: ne,
321
+ headerContent: w.headerContent,
322
+ footerContent: w.footerContent,
323
+ firstPageHeaderContent: w.firstPageHeaderContent,
324
+ firstPageFooterContent: w.firstPageFooterContent,
325
+ headerContentRId: w.activeHeaderRId,
326
+ footerContentRId: w.activeFooterRId,
327
+ firstPageHeaderContentRId: w.activeFirstHeaderRId,
328
+ firstPageFooterContentRId: w.activeFirstFooterRId,
329
+ sectionHeaderFooterRefs: we(o),
330
+ theme: b,
334
331
  sectionProperties: c,
335
332
  document: i,
336
333
  defaultTabStop: re,
337
- mirrorMargins: S,
338
- styles: g,
334
+ mirrorMargins: C,
335
+ styles: y,
339
336
  layout: R.value,
340
- hfPMs: Ot,
341
- painter: Dt,
337
+ hfPMs: Ct,
338
+ painter: St,
342
339
  pagesContainer: r,
343
340
  session: q,
344
- renderHfFromContentOrPm: mt,
345
- renderHeaderFooterContentByRId: ht,
346
- readFontSetSignature: ue,
347
- buildFootnoteRenderItems: gt,
348
- describeInvalidHighlightMarks: _t,
349
- emptyTemplatePreviewEntries: dt,
350
- emptyTemplatePreviewHidden: ft,
351
- hyphenationReadiness: Et,
352
- markupView: u(h),
353
- showCommentHighlights: u(te),
341
+ renderHfFromContentOrPm: ut,
342
+ renderHeaderFooterContentByRId: dt,
343
+ readFontSetSignature: oe,
344
+ buildFootnoteRenderItems: ft,
345
+ describeInvalidHighlightMarks: pt,
346
+ emptyTemplatePreviewEntries: st,
347
+ emptyTemplatePreviewHidden: ct,
348
+ hyphenationReadiness: xt,
349
+ markupView: u(ee),
350
+ showCommentHighlights: u(g),
354
351
  ..._ === void 0 ? {} : { altChunkMarkerText: u(_) }
355
352
  }, e, t));
356
353
  } catch (e) {
357
354
  let t = e instanceof Error ? e : Error(String(e));
358
- O?.(t);
355
+ E?.(t);
359
356
  }
360
357
  }
361
- let Z = _e({
358
+ let Z = pe({
362
359
  readState: () => P.value?.state ?? null,
363
360
  runLayout: (e, t) => X(e, t),
364
- ...he,
365
- clock: ge
361
+ ...fe,
362
+ clock: T
366
363
  }), Q = null;
367
- function At() {
368
- if (Q !== null && (window.clearTimeout(Q), Q = null), P.value && A.value) try {
364
+ function Tt() {
365
+ if (Q !== null && (window.clearTimeout(Q), Q = null), P.value && k.value) try {
369
366
  let e = $.readCanonicalDocument();
370
367
  if (!e) return;
371
- A.value = e, Y(), Mt(), yt(e);
368
+ k.value = e, Y(), Dt(), ht(e);
372
369
  } catch (e) {
373
- O?.(e instanceof Error ? e : Error(String(e)));
370
+ E?.(e instanceof Error ? e : Error(String(e)));
374
371
  }
375
372
  }
376
- let jt = null;
377
- function Mt() {
378
- jt !== null && (window.clearTimeout(jt), jt = null);
373
+ let Et = null;
374
+ function Dt() {
375
+ Et !== null && (window.clearTimeout(Et), Et = null);
379
376
  }
380
- function Nt() {
381
- Mt(), jt = window.setTimeout(() => {
382
- if (jt = null, Q !== null) return;
383
- let e = A.value;
384
- e && yt(e);
385
- }, T);
377
+ function Ot() {
378
+ Dt(), Et = window.setTimeout(() => {
379
+ if (Et = null, Q !== null) return;
380
+ let e = k.value;
381
+ e && ht(e);
382
+ }, C);
386
383
  }
387
- function Pt() {
384
+ function kt() {
388
385
  Q !== null && window.clearTimeout(Q), Q = window.setTimeout(() => {
389
- Q = null, At();
390
- }, T);
386
+ Q = null, Tt();
387
+ }, C);
391
388
  }
392
389
  let $ = m({
393
390
  getHost: () => t.value,
394
- getDocument: () => A.value,
395
- getStyles: tt,
391
+ getDocument: () => k.value,
392
+ getStyles: A,
396
393
  getExtensionManager: () => U,
397
- getExternalPlugins: Tt,
398
- getAnonymizationTerms: () => Be?.() ?? se,
399
- getDerivedFields: () => Ve?.(),
400
- getCanonicalRoom: it,
394
+ getExternalPlugins: bt,
395
+ getAnonymizationTerms: () => Re?.() ?? re,
396
+ getDerivedFields: () => ze?.(),
397
+ getCanonicalRoom: et,
401
398
  getReadOnly: () => u(o),
402
- getHistoryShortcuts: () => Ee,
403
- onCanonicalHistory: (e) => De?.(e),
404
- onCanonicalHistoryDrop: (e) => Re?.(e),
405
- getEditingMode: () => u(C) ?? "editing",
406
- getSuggestionAuthor: et,
399
+ getHistoryShortcuts: () => Pe,
400
+ onCanonicalHistory: (e) => Fe?.(e),
401
+ onCanonicalHistoryDrop: (e) => Ie?.(e),
402
+ getEditingMode: () => u(xe) ?? "editing",
403
+ getSuggestionAuthor: Ze,
407
404
  onSessionRefusal: (e, t, n) => {
408
- O?.(n ?? new p({
405
+ E?.(n ?? new p({
409
406
  ground: t,
410
407
  message: e
411
408
  }));
412
409
  },
413
410
  getDocumentIdentity: () => String(j),
414
- getDocumentContext: () => A.value,
415
- onTransaction: It,
416
- onCanonicalCompositionLayout: Lt,
411
+ getDocumentContext: () => k.value,
412
+ onTransaction: jt,
413
+ onCanonicalCompositionLayout: Mt,
417
414
  getEmbeddedFontFamilyMap: () => q.embeddedFontFamilyMap,
418
415
  onSelectionChange: (e) => {
419
- F.value = e, Ke?.(e), G.emit("selectionChange", {
416
+ F.value = e, We?.(e), G.emit("selectionChange", {
420
417
  from: e.selection.from,
421
418
  to: e.selection.to
422
419
  });
423
420
  },
424
421
  onKeyDown: () => !1,
425
- onCopy: () => Je?.(),
426
- onCut: () => k?.(),
427
- onPaste: () => Ye?.(),
428
- onReadOnlyEditAttempt: () => Xe?.(),
429
- onEditorViewReady: Rt,
422
+ onCopy: () => Ge?.(),
423
+ onCut: () => O?.(),
424
+ onPaste: () => Ke?.(),
425
+ onReadOnlyEditAttempt: () => qe?.(),
426
+ onEditorViewReady: Nt,
430
427
  onEditorViewDestroy: () => {
431
- P.value = null, B.value = !1, qe?.(null);
428
+ P.value = null, B.value = !1, D?.(null);
432
429
  },
433
430
  onRemoteSelectionsChange: (e) => {
434
431
  I.value = e;
435
432
  }
436
- }), Ft = $.api.autocomplete.subscribe((t) => e.onAutocompleteChange?.(t));
437
- d(() => u(ze), () => {
433
+ }), At = $.api.autocomplete.subscribe((t) => e.onAutocompleteChange?.(t));
434
+ d(() => u(Le), () => {
438
435
  I.value = [], $.retryViewCreation(), $.syncExternalDocument();
439
436
  }, { immediate: !0 });
440
- function It({ newState: e, docChanged: t }) {
437
+ function jt({ newState: e, docChanged: t }) {
441
438
  if (F.value = e, t) {
442
439
  let e = $.readCanonicalDocument();
443
- e && (A.value = e, Y()), H.value = !0, K.incrementStateSeq(), Z.schedule(), Pt();
440
+ e && (k.value = e, Y()), H.value = !0, K.incrementStateSeq(), Z.schedule(), kt();
444
441
  }
445
442
  K.requestRender();
446
443
  }
447
- function Lt() {
444
+ function Mt() {
448
445
  let e = P.value;
449
446
  e && (F.value = e.state), K.incrementStateSeq(), Z.schedule(), K.requestRender();
450
447
  }
451
- function Rt(e) {
448
+ function Nt(e) {
452
449
  P.value = e, F.value = e.state, B.value = !0;
453
- let t = A.value, n = j, r = ++M;
450
+ let t = k.value, n = j, r = ++M;
454
451
  N = !0;
455
452
  let i = () => {
456
- M === r && (N = !1, rt || j !== n || $.getView() !== e || (X(e.state, { reason: "initial" }), K.requestRender()));
453
+ M === r && (N = !1, $e || j !== n || $.getView() !== e || (X(e.state, { reason: "initial" }), K.requestRender()));
457
454
  };
458
- D(t, e.state.doc).then(i, i), Vt(e), qe?.(e), u(o) || requestAnimationFrame(() => {
455
+ se(t, e.state.doc).then(i, i), D?.(e), u(o) || requestAnimationFrame(() => {
459
456
  P.value === e && !e.hasFocus() && e.focus();
460
457
  });
461
458
  }
462
- let zt = {
459
+ let Pt = {
463
460
  getDocx: async (e) => {
464
- let t = await Zt(e);
465
- return t?.tripwireResult && Qe?.(t.tripwireResult), t?.buffer ?? null;
461
+ let t = await Gt(e);
462
+ return t?.tripwireResult && Ye?.(t.tripwireResult), t?.buffer ?? null;
466
463
  },
467
- loadDocument: Jt,
468
- loadDocx: qt
469
- }, Bt = ce({
464
+ loadDocument: Ht,
465
+ loadDocx: Vt
466
+ }, Ft = ie({
470
467
  getEditorApi: () => $.api,
471
468
  getLayout: () => R.value,
472
469
  runLayout: (e, t) => X(e, t),
473
- getDocumentIO: () => zt,
470
+ getDocumentIO: () => Pt,
474
471
  emitter: G
475
472
  });
476
- function Vt(e) {
477
- let t = u(C) === "suggesting";
478
- oe(t, e.state, e.dispatch, et());
479
- }
480
- d([() => u(C), et], () => {
481
- Bt.setCanonicalMode(u(C) === "suggesting" ? {
473
+ d([() => u(xe), Ze], () => {
474
+ Ft.setCanonicalMode(u(xe) === "suggesting" ? {
482
475
  type: "suggesting",
483
- author: et()
476
+ author: Ze()
484
477
  } : { type: "editing" });
485
- let e = P.value;
486
- e && Vt(e);
487
- for (let e of J.listStories()) {
488
- let t = J.getView(e);
489
- t && Vt(t);
490
- }
491
478
  }), d(() => u(o), (e) => {
492
- $.syncEditable(), e && sn(), Ot.sync();
479
+ $.syncEditable(), e && en(), Ct.sync();
493
480
  });
494
- function Ht(e) {
481
+ function It(e) {
495
482
  let t = W();
496
- if (t === e.state.plugins.includes(St)) return;
497
- let n = e.state.plugins.filter((e) => e !== St && e !== Ct);
483
+ if (t === e.state.plugins.includes(_t)) return;
484
+ let n = e.state.plugins.filter((e) => e !== _t && e !== vt);
498
485
  if (t) {
499
- let e = n.indexOf(wt), t = e === -1 ? n.length : e;
500
- n.splice(t, 0, St, Ct);
486
+ let e = n.indexOf(yt), t = e === -1 ? n.length : e;
487
+ n.splice(t, 0, _t, vt);
501
488
  }
502
489
  e.updateState(e.state.reconfigure({ plugins: n }));
503
490
  }
504
491
  d(() => W(), () => {
505
492
  let e = P.value;
506
- e && Ht(e);
493
+ e && It(e);
507
494
  });
508
- function Ut() {
495
+ function Lt() {
509
496
  $.ensureView();
510
497
  }
511
- function Wt() {
512
- Mt(), j += 1, nt.value = A.value?.originalBuffer ?? null, H.value = !1, at.value = null, L.value = null, J.activate(null), Z.dispose(), $.destroyView(), $.ensureView(), Y(), $.ensureView(), $.getView() || Gt();
498
+ function Rt() {
499
+ Dt(), j += 1, Qe.value = k.value?.originalBuffer ?? null, H.value = !1, tt.value = null, L.value = null, J.activate(null), Z.dispose(), $.destroyView(), $.ensureView(), Y(), $.ensureView(), $.getView() || zt();
513
500
  }
514
- function Gt() {
515
- let e = A.value;
501
+ function zt() {
502
+ let e = k.value;
516
503
  if (e) try {
517
- let t = ee({
504
+ let t = h({
518
505
  document: e,
519
- styles: ie(e).package.styles ?? null,
506
+ styles: x(e).package.styles ?? null,
520
507
  manager: U,
521
- externalPlugins: Tt(),
508
+ externalPlugins: bt(),
522
509
  reason: "mount"
523
510
  });
524
511
  F.value = t;
525
512
  let n = j, r = ++M;
526
513
  N = !0;
527
514
  let i = () => {
528
- M === r && (N = !1, rt || j !== n || A.value !== e || $.getView() || X(t, { reason: "initial" }));
515
+ M === r && (N = !1, $e || j !== n || k.value !== e || $.getView() || X(t, { reason: "initial" }));
529
516
  };
530
- D(e, t.doc).then(i, i);
517
+ se(e, t.doc).then(i, i);
531
518
  } catch (e) {
532
- O?.(e instanceof Error ? e : Error(String(e)));
519
+ E?.(e instanceof Error ? e : Error(String(e)));
533
520
  }
534
521
  }
535
522
  d([
536
523
  t,
537
524
  a,
538
- $e,
525
+ Xe,
539
526
  ...r ? [r] : []
540
527
  ], () => {
541
- t.value && A.value && !$.getView() && Ut(), Y();
528
+ t.value && k.value && !$.getView() && Lt(), Y();
542
529
  }, { flush: "post" });
543
- let Kt = 0;
544
- async function qt(e) {
545
- Kt += 1, V.value = null, B.value = !1;
530
+ let Bt = 0;
531
+ async function Vt(e) {
532
+ Bt += 1, V.value = null, B.value = !1;
546
533
  try {
547
- let t = await Ce(e, { password: u(S) });
534
+ let t = await _e(e, { password: u(ye) });
548
535
  if (t.isErr()) throw t.error;
549
536
  let n = t.value.document;
550
- A.value = n, Wt();
537
+ k.value = n, Rt();
551
538
  } catch (e) {
552
539
  let t = e instanceof Error ? e : Error(String(e));
553
- V.value = t.message, O?.(t);
540
+ V.value = t.message, E?.(t);
554
541
  }
555
542
  }
556
- function Jt(e) {
557
- let t = Kt += 1;
543
+ function Ht(e) {
544
+ let t = Bt += 1;
558
545
  V.value = null;
559
- let n = ot(e);
560
- Se(n) ? Xt(n) : Yt(n, t);
546
+ let n = nt(e);
547
+ ge(n) ? Wt(n) : Ut(n, t);
561
548
  }
562
- async function Yt(e, t) {
563
- let n = await we(e);
564
- t === Kt && (n.isErr() ? (V.value = n.error.message, O?.(n.error)) : Xt(n.value));
549
+ async function Ut(e, t) {
550
+ let n = await ve(e);
551
+ t === Bt && (n.isErr() ? (V.value = n.error.message, E?.(n.error)) : Wt(n.value));
565
552
  }
566
- function Xt(e) {
567
- A.value = e, Wt();
553
+ function Wt(e) {
554
+ k.value = e, Rt();
568
555
  }
569
- async function Zt(e) {
570
- let t = P.value, n = A.value;
556
+ async function Gt(e) {
557
+ let t = P.value, n = k.value;
571
558
  if (!t || !n) return null;
572
559
  try {
573
560
  let t = $.api.captureCanonicalSave();
574
561
  if (t) {
575
- let n = await xe({
562
+ let n = u(Je), { canonicalSaveDiagnosticError: r, serializeCanonicalSave: i } = await import("@stll/folio-core/docx/canonicalSave"), a = await i({
576
563
  snapshot: t,
577
564
  options: e,
578
- featureFlags: u(Ze)
565
+ featureFlags: n
579
566
  });
580
- for (let t of n.diagnostics) e?.onDiagnostic || O?.(be(t));
581
- return n;
567
+ for (let t of a.diagnostics) e?.onDiagnostic || E?.(r(t));
568
+ return a;
582
569
  }
583
570
  return null;
584
571
  } catch (e) {
585
- return O?.(e instanceof Error ? e : Error(String(e))), null;
572
+ return E?.(e instanceof Error ? e : Error(String(e))), null;
586
573
  }
587
574
  }
588
- async function Qt(e) {
589
- let t = P.value, n = t?.state, r = await Zt({
575
+ async function Kt(e) {
576
+ let t = P.value, n = t?.state, r = await Gt({
590
577
  onDiagnostic: e?.onDiagnostic,
591
578
  onSelectiveDecline: e?.onSelectiveDecline,
592
579
  onSerializationPath: e?.onSerializationPath,
593
- mode: e?.selective === !1 ? E.full : E.preferSelective
580
+ mode: e?.selective === !1 ? w.full : w.preferSelective
594
581
  });
595
582
  return r ? (P.value === t && t?.state.doc === n?.doc && (r.version === void 0 || $.api.isCanonicalSaveCurrent(r.version)) && (r.version !== void 0 && $.api.markCanonicalSaved(r.version, {
596
583
  buffer: r.buffer,
597
584
  path: r.path
598
- }), A.value = r.document, Y(), H.value = !1), r.tripwireResult && Qe?.(r.tripwireResult), new Blob([r.buffer], { type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" })) : null;
585
+ }), k.value = r.document, Y(), H.value = !1), r.tripwireResult && Ye?.(r.tripwireResult), new Blob([r.buffer], { type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document" })) : null;
599
586
  }
600
- function $t() {
587
+ function qt() {
601
588
  return $.readCanonicalDocument();
602
589
  }
603
- function en() {
604
- return $t();
590
+ function Jt() {
591
+ return qt();
605
592
  }
606
- function tn() {
607
- let e = en();
608
- return e && vt(e);
593
+ function Yt() {
594
+ let e = Jt();
595
+ return e && mt(e);
609
596
  }
610
- function nn(e) {
611
- bt(ne.modelEdits, "Direct document model changes are unavailable in this session.") || (A.value = ot(e), Mt(), nt.value = e.originalBuffer ?? null, Y(), L.value && !J.getView(L.value) && (L.value = null));
597
+ function Xt(e) {
598
+ gt(y.modelEdits, "Direct document model changes are unavailable in this session.") || (k.value = nt(e), Dt(), Qe.value = e.originalBuffer ?? null, Y(), L.value && !J.getView(L.value) && (L.value = null));
612
599
  }
613
- function rn(e) {
614
- return Ot.getView(e);
600
+ function Zt(e) {
601
+ return Ct.getView(e);
615
602
  }
616
- function an() {
603
+ function Qt() {
617
604
  Y();
618
605
  }
619
- function on(e) {
606
+ function $t(e) {
620
607
  let t = J.activate(e);
621
- t && (Vt(t), L.value = e, requestAnimationFrame(() => t.focus()));
608
+ t && (L.value = e, requestAnimationFrame(() => t.focus()));
622
609
  }
623
- function sn() {
610
+ function en() {
624
611
  J.activate(null), L.value = null;
625
612
  }
626
- function cn() {
613
+ function tn() {
627
614
  let e = L.value;
628
615
  return e ? J.getView(e) : null;
629
616
  }
630
- function ln() {
617
+ function nn() {
631
618
  return U.getCommands();
632
619
  }
633
- function un() {
634
- let e = cn();
620
+ function rn() {
621
+ let e = tn();
635
622
  e ? e.focus() : P.value?.focus();
636
623
  }
637
- function dn() {
624
+ function an() {
638
625
  let e = P.value;
639
626
  e && X(e.state, { reason: "manual" });
640
627
  }
641
628
  d([
642
629
  () => u(v),
643
- () => u(x),
630
+ () => u(S),
644
631
  () => u(f),
645
- () => u(h),
646
- () => u(te),
632
+ () => u(ee),
633
+ () => u(g),
647
634
  () => u(_)
648
- ], () => dn());
649
- function fn() {
650
- rt = !0, a.value && Ae(a.value), M += 1, N = !1, Z.dispose(), Q !== null && (window.clearTimeout(Q), Q = null), Mt(), $.destroyView(), I.value = [], Ot.destroy(), J.destroy(), U.destroy(), F.value = null, R.value = null, A.value = null, nt.value = null, B.value = !1;
635
+ ], () => an());
636
+ function on() {
637
+ $e = !0, a.value && Ee(a.value), M += 1, N = !1, Z.dispose(), Q !== null && (window.clearTimeout(Q), Q = null), Dt(), $.destroyView(), I.value = [], Ct.destroy(), J.destroy(), U.destroy(), F.value = null, R.value = null, k.value = null, Qe.value = null, B.value = !1;
651
638
  }
652
639
  return i(() => {
653
- fn(), Ft();
640
+ on(), At();
654
641
  }), {
655
642
  setEmbeddedFontFamilies: (e) => {
656
643
  e ? q.embeddedFontFamilyMap = new Map(e) : delete q.embeddedFontFamilyMap, $.refreshFonts();
657
644
  },
658
- editor: Bt,
645
+ editor: Ft,
659
646
  editorView: P,
660
647
  editorState: F,
661
648
  remoteSelections: I,
662
- headerFooterSelection: at,
649
+ headerFooterSelection: tt,
663
650
  activeNoteStory: L,
664
651
  isReady: B,
665
652
  isDirty: H,
666
653
  parseError: V,
667
- modelDocument: A,
668
- readDocumentModel: $t,
669
- sourceBuffer: nt,
654
+ modelDocument: k,
655
+ readDocumentModel: qt,
656
+ sourceBuffer: Qe,
670
657
  hiddenEditorWidth: z,
671
658
  layout: R,
672
- blocks: st,
673
- measures: ct,
659
+ blocks: rt,
660
+ measures: it,
674
661
  syncCoordinator: K,
675
- loadBuffer: qt,
676
- loadDocument: Jt,
677
- save: Qt,
678
- getDocument: tn,
679
- readDocument: en,
680
- setDocument: nn,
681
- getHeaderFooterView: rn,
682
- syncHeaderFooterViews: an,
683
- openNoteStory: on,
684
- closeNoteStory: sn,
685
- getActiveNoteView: cn,
686
- getCommands: ln,
687
- focus: un,
688
- reLayout: dn,
689
- destroy: fn
662
+ loadBuffer: Vt,
663
+ loadDocument: Ht,
664
+ save: Kt,
665
+ getDocument: Yt,
666
+ readDocument: Jt,
667
+ setDocument: Xt,
668
+ getHeaderFooterView: Zt,
669
+ syncHeaderFooterViews: Qt,
670
+ openNoteStory: $t,
671
+ closeNoteStory: en,
672
+ getActiveNoteView: tn,
673
+ getCommands: nn,
674
+ focus: rn,
675
+ reLayout: an,
676
+ destroy: on
690
677
  };
691
678
  }
692
679
  // src/composables/useFindReplace.ts
693
- function H({ editorView: t, pagesRef: n, getDocument: r, layout: a, commentRoot: l, revealComment: u, displayMode: f, readOnly: p, onReadonlyEditAttempt: m, onResultChange: ee }) {
694
- let h = new Re(), g = s(""), _ = s(""), v = o(We()), y = c([]), b = s(-1), x = e(() => y.value.at(b.value) ?? null), ne = () => te({
680
+ function H({ editorView: t, pagesRef: n, getDocument: r, layout: a, commentRoot: l, revealComment: u, displayMode: f, readOnly: p, onReadonlyEditAttempt: m, onResultChange: h }) {
681
+ let g = new Ie(), _ = s(""), te = s(""), ne = o(He()), v = c([]), y = s(-1), b = e(() => v.value.at(y.value) ?? null), x = () => ee({
695
682
  editingMode: t.value?.editable === !1 ? "viewing" : "editing",
696
683
  readOnlyProp: p.value,
697
684
  displayMode: f.value
698
- }), re = e(ne), ie = e(() => {
699
- let e = x.value;
700
- return ne() === null && !!t.value && !!e && oe() && Ge(e).status === "allowed";
701
- }), S = null, C, w = null, ae = (e) => {
685
+ }), S = e(x), re = e(() => {
686
+ let e = b.value;
687
+ return x() === null && !!t.value && !!e && oe() && Ue(e).status === "allowed";
688
+ }), C = null, w, ie = null, ae = (e) => {
702
689
  let n = t.value?.state.doc;
703
690
  return {
704
- query: g.value,
691
+ query: _.value,
705
692
  options: {
706
- ...v,
693
+ ...ne,
707
694
  displayMode: f.value,
708
695
  includeComments: !!l
709
696
  },
710
697
  document: e,
711
698
  ...n ? { bodyVersion: n } : {},
712
- context: { renderedStories: Ue(a.value) }
699
+ context: { renderedStories: Ve(a.value) }
713
700
  };
714
701
  }, oe = () => {
715
702
  let e = r();
716
- return !!e && Ke(w, O(ae(e)));
717
- }, se = () => h.getResult(), T = () => ee(se()), E = () => {
718
- clearTimeout(C), C = void 0;
719
- }, ce = () => {
720
- E(), h.clear(), S?.destroy(), S = null, y.value = [], w = null, b.value = -1;
721
- }, le = () => {
722
- ce(), g.value = "", T();
723
- }, ue = (e) => (b.value = e, S?.navigate(e, u), T(), !0), D = (e = "query") => {
724
- E();
703
+ return !!e && We(ie, E(ae(e)));
704
+ }, se = () => g.getResult(), ce = () => h(se()), le = () => {
705
+ clearTimeout(w), w = void 0;
706
+ }, ue = () => {
707
+ le(), g.clear(), C?.destroy(), C = null, v.value = [], ie = null, y.value = -1;
708
+ }, de = () => {
709
+ ue(), _.value = "", ce();
710
+ }, fe = (e) => (y.value = e, C?.navigate(e, u), ce(), !0), T = (e = "query") => {
711
+ le();
725
712
  let i = r(), o = n.value, s = t.value?.state.doc;
726
- if (!i || !g.value.trim()) return le(), [];
727
- let c = ae(i), u = ze({
713
+ if (!i || !_.value.trim()) return de(), [];
714
+ let c = ae(i), u = Le({
728
715
  document: c.document,
729
716
  state: t.value?.state ?? null,
730
717
  searchText: c.query,
731
718
  options: c.options,
732
719
  context: c.context
733
720
  });
734
- if (u === null) return ce(), T(), [];
735
- let d = O(c), f = e === "refresh" && w?.query === d.query, p = h.setMatches(u, f ? h.getResult()?.currentIndex ?? 0 : 0);
736
- return w = d, y.value = u, b.value = u.length > 0 ? p.currentIndex : -1, S?.destroy(), S = o ? He({
721
+ if (u === null) return ue(), ce(), [];
722
+ let d = E(c), f = e === "refresh" && ie?.query === d.query, p = g.setMatches(u, f ? g.getResult()?.currentIndex ?? 0 : 0);
723
+ return ie = d, v.value = u, y.value = u.length > 0 ? p.currentIndex : -1, C?.destroy(), C = o ? Be({
737
724
  container: o,
738
725
  document: i,
739
726
  bodyDoc: s,
740
727
  matches: u,
741
728
  commentRoot: l?.value ?? void 0,
742
729
  layout: a.value
743
- }) : null, S?.paint(b.value), u.at(0) && !f ? ue(0) : T(), u;
744
- }, de = () => {
745
- E(), C = setTimeout(() => D("refresh"), 120);
746
- }, fe = (e, t) => (g.value = e, Object.assign(v, We(), t), D(), se()), pe = (e) => {
747
- let t = h.goTo(e);
748
- return t ? ue(t.index) : !1;
749
- }, me = (e) => {
750
- let t = h.navigate(e);
751
- return t ? (ue(t.index), t.match) : null;
752
- }, he = () => !oe() && (D("refresh"), !0), ge = () => {
753
- let e = ne();
730
+ }) : null, C?.paint(y.value), u.at(0) && !f ? fe(0) : ce(), u;
731
+ }, pe = () => {
732
+ le(), w = setTimeout(() => T("refresh"), 120);
733
+ }, me = (e, t) => (_.value = e, Object.assign(ne, He(), t), T(), se()), he = (e) => {
734
+ let t = g.goTo(e);
735
+ return t ? fe(t.index) : !1;
736
+ }, ge = (e) => {
737
+ let t = g.navigate(e);
738
+ return t ? (fe(t.index), t.match) : null;
739
+ }, _e = () => !oe() && (T("refresh"), !0), ve = () => {
740
+ let e = x();
754
741
  return e !== null && (m?.(e), !0);
755
742
  };
756
743
  return d(f, () => {
757
- g.value.trim() && D();
744
+ _.value.trim() && T();
758
745
  }), i(() => {
759
- E(), S?.destroy();
746
+ le(), C?.destroy();
760
747
  }), {
761
- searchText: g,
762
- replaceText: _,
763
- options: v,
764
- matches: y,
765
- currentIndex: b,
766
- currentMatch: x,
767
- canReplaceCurrent: ie,
768
- replacementRefusal: re,
769
- performSearch: D,
770
- scheduleSearch: de,
771
- find: fe,
748
+ searchText: _,
749
+ replaceText: te,
750
+ options: ne,
751
+ matches: v,
752
+ currentIndex: y,
753
+ currentMatch: b,
754
+ canReplaceCurrent: re,
755
+ replacementRefusal: S,
756
+ performSearch: T,
757
+ scheduleSearch: pe,
758
+ find: me,
772
759
  getFindResult: se,
773
- goToMatch: pe,
774
- findNext: () => me("next"),
775
- findPrevious: () => me("previous"),
760
+ goToMatch: he,
761
+ findNext: () => ge("next"),
762
+ findPrevious: () => ge("previous"),
776
763
  replaceCurrent: () => {
777
764
  let e = t.value;
778
- if (!e || ge() || he()) return !1;
779
- let n = x.value;
780
- if (!ie.value || !n) return !1;
781
- let r = e.state.doc, i = Be(e, n, _.value);
782
- return e.state.doc !== r && D("refresh"), i;
765
+ if (!e || ve() || _e()) return !1;
766
+ let n = b.value;
767
+ if (!re.value || !n) return !1;
768
+ let r = e.state.doc, i = Re(e, n, te.value);
769
+ return e.state.doc !== r && T("refresh"), i;
783
770
  },
784
771
  replaceAll: () => {
785
- let e = t.value, n = y.value.length;
786
- if (!e || ge() || he()) return {
772
+ let e = t.value, n = v.value.length;
773
+ if (!e || ve() || _e()) return {
787
774
  replacedCount: 0,
788
775
  skippedCount: n
789
776
  };
790
- let r = e.state.doc, i = Ve(e, y.value, _.value);
791
- return e.state.doc !== r && D(), i;
777
+ let r = e.state.doc, i = ze(e, v.value, te.value);
778
+ return e.state.doc !== r && T(), i;
792
779
  },
793
- clear: le
780
+ clear: de
794
781
  };
795
782
  }
796
- function vt(e, t) {
783
+ function mt(e, t) {
797
784
  if (t < e.top + 40) {
798
785
  let n = Math.max(0, e.top + 40 - t);
799
786
  return -Math.min(12, n / 40 * 12);
@@ -805,10 +792,10 @@ function vt(e, t) {
805
792
  return 0;
806
793
  }
807
794
  // src/composables/useDragAutoScroll.ts
808
- function yt({ pagesContainer: e, onScrollExtendSelection: t }) {
795
+ function ht({ pagesContainer: e, onScrollExtendSelection: t }) {
809
796
  let n = null, r = 0, a = 0, o = !1;
810
797
  function s() {
811
- return _(e.value);
798
+ return g(e.value);
812
799
  }
813
800
  function c() {
814
801
  o = !1, n !== null && (cancelAnimationFrame(n), n = null);
@@ -817,8 +804,8 @@ function yt({ pagesContainer: e, onScrollExtendSelection: t }) {
817
804
  if (!o) return;
818
805
  let e = s();
819
806
  if (!e) return;
820
- let i = vt(e.getBoundingClientRect(), a);
821
- i !== 0 && (v(e, i), t(r, a)), n = requestAnimationFrame(l);
807
+ let i = mt(e.getBoundingClientRect(), a);
808
+ i !== 0 && (_(e, i), t(r, a)), n = requestAnimationFrame(l);
822
809
  }
823
810
  function u() {
824
811
  o || (o = !0, n = requestAnimationFrame(l));
@@ -837,7 +824,7 @@ function yt({ pagesContainer: e, onScrollExtendSelection: t }) {
837
824
  };
838
825
  }
839
826
  // src/composables/useTableResize.ts
840
- function bt({ runCommand: e }) {
827
+ function gt({ runCommand: e }) {
841
828
  let t = {
842
829
  active: !1,
843
830
  startX: 0,
@@ -856,7 +843,7 @@ function bt({ runCommand: e }) {
856
843
  isEdge: !1,
857
844
  tablePmStart: 0,
858
845
  origHeight: 0,
859
- minimumHeight: Je
846
+ minimumHeight: Ge
860
847
  }, r = {
861
848
  active: !1,
862
849
  startX: 0,
@@ -870,15 +857,15 @@ function bt({ runCommand: e }) {
870
857
  }
871
858
  function o(e, a) {
872
859
  let o = e.target;
873
- return o instanceof HTMLElement ? o.classList.contains("layout-table-resize-handle") ? (e.preventDefault(), e.stopPropagation(), i = a, t.active = !0, t.startX = e.clientX, t.handle = o, o.classList.add("dragging"), t.columnIndex = parseInt(o.dataset.columnIndex ?? "0", 10), t.tablePmStart = S(o) ?? 0, U(a, t), !0) : o.classList.contains("layout-table-row-resize-handle") || o.classList.contains("layout-table-edge-handle-bottom") ? (e.preventDefault(), e.stopPropagation(), i = a, n.active = !0, n.startY = e.clientY, n.handle = o, n.isEdge = o.dataset.isEdge === "bottom", o.classList.add("dragging"), n.rowIndex = parseInt(o.dataset.rowIndex ?? "0", 10), n.tablePmStart = S(o) ?? 0, xt(a, n, o), !0) : o.classList.contains("layout-table-edge-handle-right") ? (e.preventDefault(), e.stopPropagation(), i = a, r.active = !0, r.startX = e.clientX, r.handle = o, o.classList.add("dragging"), r.columnIndex = parseInt(o.dataset.columnIndex ?? "0", 10), r.tablePmStart = S(o) ?? 0, St(a, r), !0) : !1 : !1;
860
+ return o instanceof HTMLElement ? o.classList.contains("layout-table-resize-handle") ? (e.preventDefault(), e.stopPropagation(), i = a, t.active = !0, t.startX = e.clientX, t.handle = o, o.classList.add("dragging"), t.columnIndex = parseInt(o.dataset.columnIndex ?? "0", 10), t.tablePmStart = S(o) ?? 0, U(a, t), !0) : o.classList.contains("layout-table-row-resize-handle") || o.classList.contains("layout-table-edge-handle-bottom") ? (e.preventDefault(), e.stopPropagation(), i = a, n.active = !0, n.startY = e.clientY, n.handle = o, n.isEdge = o.dataset.isEdge === "bottom", o.classList.add("dragging"), n.rowIndex = parseInt(o.dataset.rowIndex ?? "0", 10), n.tablePmStart = S(o) ?? 0, _t(a, n, o), !0) : o.classList.contains("layout-table-edge-handle-right") ? (e.preventDefault(), e.stopPropagation(), i = a, r.active = !0, r.startX = e.clientX, r.handle = o, o.classList.add("dragging"), r.columnIndex = parseInt(o.dataset.columnIndex ?? "0", 10), r.tablePmStart = S(o) ?? 0, vt(a, r), !0) : !1 : !1;
874
861
  }
875
862
  function s(e) {
876
863
  if (t.active && t.handle) {
877
864
  e.preventDefault();
878
865
  let n = e.clientX - t.startX, r = parseFloat(t.handle.style.left);
879
866
  t.handle.style.left = `${r + n}px`, t.startX = e.clientX;
880
- let i = Math.round(n * k), a = t.origWidths.left + i, o = t.origWidths.right - i;
881
- a >= qe && o >= qe && (t.origWidths = {
867
+ let i = Math.round(n * O), a = t.origWidths.left + i, o = t.origWidths.right - i;
868
+ a >= D && o >= D && (t.origWidths = {
882
869
  left: a,
883
870
  right: o
884
871
  });
@@ -886,31 +873,31 @@ function bt({ runCommand: e }) {
886
873
  e.preventDefault();
887
874
  let t = e.clientY - n.startY, r = parseFloat(n.handle.style.top);
888
875
  n.startY = e.clientY;
889
- let i = Math.round(t * k), a = Ye({
876
+ let i = Math.round(t * O), a = Ke({
890
877
  currentHeight: n.origHeight,
891
878
  delta: i,
892
879
  minimumHeight: n.minimumHeight
893
880
  });
894
- n.handle.style.top = `${r + a / k}px`, n.origHeight += a;
881
+ n.handle.style.top = `${r + a / O}px`, n.origHeight += a;
895
882
  } else if (r.active && r.handle) {
896
883
  e.preventDefault();
897
884
  let t = e.clientX - r.startX, n = parseFloat(r.handle.style.left);
898
885
  r.handle.style.left = `${n + t}px`, r.startX = e.clientX;
899
- let i = Math.round(t * k), a = r.origWidth + i;
900
- a >= qe && (r.origWidth = a);
886
+ let i = Math.round(t * O), a = r.origWidth + i;
887
+ a >= D && (r.origWidth = a);
901
888
  }
902
889
  }
903
890
  function c(a) {
904
- t.active ? (t.active = !1, t.handle?.classList.remove("dragging"), i && e(i, Xe({
891
+ t.active ? (t.active = !1, t.handle?.classList.remove("dragging"), i && e(i, qe({
905
892
  pmStart: t.tablePmStart,
906
893
  colIdx: t.columnIndex,
907
894
  newLeft: t.origWidths.left,
908
895
  newRight: t.origWidths.right
909
- })), t.handle = null) : n.active ? (n.active = !1, n.handle?.classList.remove("dragging"), i && e(i, A({
896
+ })), t.handle = null) : n.active ? (n.active = !1, n.handle?.classList.remove("dragging"), i && e(i, k({
910
897
  pmStart: n.tablePmStart,
911
898
  rowIdx: n.rowIndex,
912
899
  newHeight: n.origHeight
913
- })), n.handle = null) : r.active && (r.active = !1, r.handle?.classList.remove("dragging"), i && e(i, et({
900
+ })), n.handle = null) : r.active && (r.active = !1, r.handle?.classList.remove("dragging"), i && e(i, Ze({
914
901
  pmStart: r.tablePmStart,
915
902
  colIdx: r.columnIndex,
916
903
  newWidth: r.origWidth
@@ -928,36 +915,36 @@ function bt({ runCommand: e }) {
928
915
  };
929
916
  }
930
917
  function U(e, t) {
931
- let n = Qe(e, t.tablePmStart, t.columnIndex);
918
+ let n = Ye(e, t.tablePmStart, t.columnIndex);
932
919
  n && (t.origWidths = n);
933
920
  }
934
- function xt(e, t, n) {
935
- let r = $e(e, t.tablePmStart, t.rowIndex);
921
+ function _t(e, t, n) {
922
+ let r = Xe(e, t.tablePmStart, t.rowIndex);
936
923
  if (r != null) t.origHeight = r;
937
924
  else {
938
925
  let e = n.closest(".layout-table")?.querySelector(`[data-row-index="${t.rowIndex}"]`), r = e ? e.getBoundingClientRect().height : 30;
939
- t.origHeight = Math.round(r * k);
926
+ t.origHeight = Math.round(r * O);
940
927
  }
941
- t.minimumHeight = Math.min(Je, t.origHeight);
928
+ t.minimumHeight = Math.min(Ge, t.origHeight);
942
929
  }
943
- function St(e, t) {
944
- let n = Ze(e, t.tablePmStart, t.columnIndex);
930
+ function vt(e, t) {
931
+ let n = Je(e, t.tablePmStart, t.columnIndex);
945
932
  n != null && (t.origWidth = n);
946
933
  }
947
934
  // src/composables/useTrackedChanges.ts
948
- function Ct(t, n) {
935
+ function yt(t, n) {
949
936
  return e(() => {
950
937
  n.value;
951
- let e = t.value?.state ?? null, r = tt(e);
938
+ let e = t.value?.state ?? null, r = A(e);
952
939
  if (e === null) return r;
953
940
  let i = {
954
- accept: C(e, "accept"),
955
- reject: C(e, "reject")
941
+ accept: Pe(e, "accept"),
942
+ reject: Pe(e, "reject")
956
943
  };
957
944
  if (i.accept.size === 0 && i.reject.size === 0) return r;
958
945
  let a = r.entries;
959
946
  for (let e of a) {
960
- let t = w(e);
947
+ let t = Fe(e);
961
948
  e.heldByLock = {
962
949
  accept: t.some((e) => i.accept.has(e)),
963
950
  reject: t.some((e) => i.reject.has(e))
@@ -970,7 +957,7 @@ function Ct(t, n) {
970
957
  });
971
958
  }
972
959
  // src/composables/useZoom.ts
973
- var wt = j, W = nt, Tt = [
960
+ var W = j, bt = Qe, G = [
974
961
  .5,
975
962
  .75,
976
963
  1,
@@ -978,16 +965,16 @@ var wt = j, W = nt, Tt = [
978
965
  1.5,
979
966
  2
980
967
  ];
981
- function G(t = 1) {
982
- let i = s(Math.max(wt, Math.min(W, t))), a = e(() => Math.round(i.value * 100)), o = e(() => i.value <= wt), c = e(() => i.value >= W);
968
+ function K(t = 1) {
969
+ let i = s(Math.max(W, Math.min(bt, t))), a = e(() => Math.round(i.value * 100)), o = e(() => i.value <= W), c = e(() => i.value >= bt);
983
970
  function l(e) {
984
- i.value = Math.max(wt, Math.min(W, Math.round(e * 100) / 100));
971
+ i.value = Math.max(W, Math.min(bt, Math.round(e * 100) / 100));
985
972
  }
986
973
  function u() {
987
- l(i.value + rt);
974
+ l(i.value + $e);
988
975
  }
989
976
  function d() {
990
- l(i.value - rt);
977
+ l(i.value - $e);
991
978
  }
992
979
  function f() {
993
980
  l(1);
@@ -998,7 +985,7 @@ function G(t = 1) {
998
985
  function m(e) {
999
986
  (e.ctrlKey || e.metaKey) && (e.shiftKey || e.altKey || (e.key === "=" || e.key === "+" ? (e.preventDefault(), u()) : e.key === "-" ? (e.preventDefault(), d()) : e.key === "0" && (e.preventDefault(), f())));
1000
987
  }
1001
- function ee() {
988
+ function h() {
1002
989
  r(() => document.addEventListener("keydown", m)), n(() => document.removeEventListener("keydown", m));
1003
990
  }
1004
991
  return {
@@ -1012,8 +999,8 @@ function G(t = 1) {
1012
999
  resetZoom: f,
1013
1000
  handleWheel: p,
1014
1001
  handleKeyDown: m,
1015
- installShortcuts: ee,
1016
- ZOOM_PRESETS: Tt
1002
+ installShortcuts: h,
1003
+ ZOOM_PRESETS: G
1017
1004
  };
1018
1005
  }
1019
- export { yt as a, L as c, R as d, bt as i, it as l, tt as n, H as o, Ct as r, V as s, G as t, at as u };
1006
+ export { ht as a, L as c, R as d, gt as i, et as l, A as n, H as o, yt as r, V as s, K as t, tt as u };