superdoc 2.29.0-next.9 → 2.29.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/chunks/{FindReplaceSurface-BKVHzhQ4.es.js → FindReplaceSurface-B_5ggdWg.es.js} +1 -1
  2. package/dist/chunks/{FindReplaceSurface-BNDrJ6VS.cjs → FindReplaceSurface-fVHxPXtn.cjs} +1 -1
  3. package/dist/chunks/{PasswordPromptSurface-6mF6Azda.es.js → PasswordPromptSurface-CZqhDQQ1.es.js} +1 -1
  4. package/dist/chunks/{PasswordPromptSurface-BNkaztaP.cjs → PasswordPromptSurface-x8GNmMJT.cjs} +1 -1
  5. package/dist/chunks/{PdfViewer-aOWhUVI7.es.js → PdfViewer-CW09MNrB.es.js} +4 -10
  6. package/dist/chunks/{PdfViewer-DmSkZehl.cjs → PdfViewer-CkrAHpC-.cjs} +4 -10
  7. package/dist/chunks/{_plugin-vue_export-helper-6MBoygIY.cjs → _plugin-vue_export-helper-BkbCxNeT.cjs} +31 -7
  8. package/dist/chunks/{_plugin-vue_export-helper-CsJQtMvr.es.js → _plugin-vue_export-helper-DRPRMkeA.es.js} +20 -8
  9. package/dist/chunks/{create-super-doc-ui-Bm5kmx0W.es.js → create-super-doc-ui-Dc8dQAMc.es.js} +83 -114
  10. package/dist/chunks/{create-super-doc-ui-DN70aatf.cjs → create-super-doc-ui-L60GhVAX.cjs} +199 -236
  11. package/dist/collaboration-upgrade-engine.cjs +1 -1
  12. package/dist/collaboration-upgrade-engine.es.js +1 -1
  13. package/dist/document-api/src/contract/command-catalog.d.ts +1 -1
  14. package/dist/public/ui-react.cjs +1 -1
  15. package/dist/public/ui-react.es.js +1 -1
  16. package/dist/public/ui-vue.cjs +1 -1
  17. package/dist/public/ui-vue.es.js +1 -1
  18. package/dist/public/ui.cjs +1 -1
  19. package/dist/public/ui.es.js +1 -1
  20. package/dist/style.css +1 -1
  21. package/dist/style.layered.css +1 -1
  22. package/dist/superdoc/src/components/CommentsLayer/collect-removed-comment-ids.d.ts +11 -1
  23. package/dist/superdoc/src/components/CommentsLayer/collect-tracked-change-thread.d.ts +19 -2
  24. package/dist/superdoc/src/components/CommentsLayer/comment-urls.d.ts +1 -1
  25. package/dist/superdoc/src/components/CommentsLayer/commentsList/super-comments-list.d.ts +23 -20
  26. package/dist/superdoc/src/components/CommentsLayer/helpers.d.ts +1 -4
  27. package/dist/superdoc/src/components/CommentsLayer/tracked-change-threading.d.ts +16 -1
  28. package/dist/superdoc/src/components/Whiteboard/WhiteboardLayer.vue.d.ts +4 -5
  29. package/dist/superdoc/src/components/Whiteboard/WhiteboardPage.vue.d.ts +3 -4
  30. package/dist/superdoc/src/components/Whiteboard/whiteboard-types.d.ts +2 -0
  31. package/dist/superdoc/src/components/surfaces/watermark-surface-runtime.d.ts +7 -7
  32. package/dist/superdoc/src/composables/use-comment-small-screen.d.ts +11 -7
  33. package/dist/superdoc/src/composables/use-compact-comment-popover.d.ts +44 -18
  34. package/dist/superdoc/src/composables/use-find-replace.d.ts +13 -3
  35. package/dist/superdoc/src/composables/use-password-prompt.d.ts +1 -1
  36. package/dist/superdoc/src/composables/use-viewport-fit.d.ts +62 -26
  37. package/dist/superdoc/src/core/SuperDoc.d.ts +3 -3
  38. package/dist/superdoc/src/core/pdf/pdf-adapter.d.ts +6 -2
  39. package/dist/superdoc/src/core/types/index.d.ts +37 -4
  40. package/dist/superdoc/src/core/v2-integration/browser-peer-runtime.d.ts +5 -3
  41. package/dist/superdoc/src/core/v2-integration/cdn-engine-loader.d.ts +3 -13
  42. package/dist/superdoc/src/core/v2-integration/internal-vue-runtime.d.ts +64 -59
  43. package/dist/superdoc/src/helpers/object-guards.d.ts +1 -0
  44. package/dist/superdoc/src/helpers/v2-author-required-rejection.d.ts +8 -11
  45. package/dist/superdoc/src/helpers/v2-bulk-decision-event.d.ts +9 -7
  46. package/dist/superdoc/src/helpers/v2-keyboard-edit-rejection.d.ts +8 -7
  47. package/dist/superdoc/src/helpers/v2-mutation-exception.d.ts +12 -8
  48. package/dist/superdoc/src/helpers/v2-review-target.d.ts +11 -1
  49. package/dist/superdoc/src/helpers/v2-selection-sync.d.ts +40 -14
  50. package/dist/superdoc/src/helpers/v2-typing-mutation-event.d.ts +14 -5
  51. package/dist/superdoc/src/icons.d.ts +11 -19
  52. package/dist/superdoc/src/internal/diagnostics/translate-diagnostic.d.ts +6 -4
  53. package/dist/superdoc/src/internal/toolbar/built-in/PageNumberMenu.vue.d.ts +25 -15
  54. package/dist/superdoc/src/internal/toolbar/built-in/constants.d.ts +3 -1
  55. package/dist/superdoc/src/internal/toolbar/built-in/font-options.d.ts +15 -1
  56. package/dist/superdoc/src/internal/toolbar/built-in/font-typeahead.d.ts +37 -7
  57. package/dist/superdoc/src/internal/toolbar/built-in/format-negation.d.ts +10 -4
  58. package/dist/superdoc/src/internal/toolbar/built-in/general.d.ts +12 -1
  59. package/dist/superdoc/src/internal/toolbar/built-in/helpers.d.ts +9 -4
  60. package/dist/superdoc/src/internal/toolbar/built-in/list-style-buttons.d.ts +2 -2
  61. package/dist/superdoc/src/internal/toolbar/built-in/page-number-feedback.d.ts +4 -5
  62. package/dist/superdoc/src/internal/toolbar/built-in/scroll-helpers.d.ts +3 -4
  63. package/dist/superdoc/src/internal/toolbar/built-in/toolbarIcons.d.ts +78 -145
  64. package/dist/superdoc/src/internal/toolbar/built-in/url-safety.d.ts +11 -3
  65. package/dist/superdoc/src/internal/toolbar/built-in-toolbar.d.ts +4 -3
  66. package/dist/superdoc/src/internal/toolbar/image-upload.d.ts +29 -39
  67. package/dist/superdoc/src/public/ui/format-painter-helpers.d.ts +2 -8
  68. package/dist/superdoc/src/stores/comments-store.d.ts +7 -7
  69. package/dist/superdoc/src/stores/helpers/comment-document-scope.d.ts +22 -0
  70. package/dist/superdoc/src/stores/helpers/pending-selection-snapshot.d.ts +17 -0
  71. package/dist/superdoc/src/stores/helpers/tracked-change-compaction.d.ts +16 -0
  72. package/dist/superdoc/src/stores/helpers/tracked-change-decision.d.ts +45 -0
  73. package/dist/superdoc/src/stores/superdoc-store.d.ts +21 -21
  74. package/dist/superdoc.cjs +423 -464
  75. package/dist/superdoc.es.js +335 -376
  76. package/dist-cdn/style.layered.css +1 -1
  77. package/dist-cdn/superdoc.min.css +1 -1
  78. package/dist-cdn/superdoc.min.js +41 -41
  79. package/package.json +3 -2
  80. package/dist/superdoc/src/main.d.ts +0 -1
@@ -1,4 +1,4 @@
1
- import { D as normalizeClass, F as openBlock, G as toDisplayString, N as onMounted, a as computed, at as withModifiers, c as createCommentVNode, h as defineComponent, it as withKeys, l as createElementBlock, t as _plugin_vue_export_helper_default, u as createElementVNode, z as ref } from "./_plugin-vue_export-helper-CsJQtMvr.es.js";
1
+ import { D as normalizeClass, F as openBlock, G as toDisplayString, N as onMounted, a as computed, at as withModifiers, c as createCommentVNode, h as defineComponent, it as withKeys, l as createElementBlock, t as _plugin_vue_export_helper_default, u as createElementVNode, z as ref } from "./_plugin-vue_export-helper-DRPRMkeA.es.js";
2
2
  //#region src/components/surfaces/FindReplaceSurface.vue?vue&type=script&setup=true&lang.ts
3
3
  var _hoisted_1 = ["onKeydown"];
4
4
  var _hoisted_2 = { class: "sd-find-replace__row" };
@@ -1,4 +1,4 @@
1
- const require__plugin_vue_export_helper = require("./_plugin-vue_export-helper-6MBoygIY.cjs");
1
+ const require__plugin_vue_export_helper = require("./_plugin-vue_export-helper-BkbCxNeT.cjs");
2
2
  //#region src/components/surfaces/FindReplaceSurface.vue?vue&type=script&setup=true&lang.ts
3
3
  var _hoisted_1 = ["onKeydown"];
4
4
  var _hoisted_2 = { class: "sd-find-replace__row" };
@@ -1,4 +1,4 @@
1
- import { F as openBlock, G as toDisplayString, a as computed, at as withModifiers, c as createCommentVNode, et as vModelText, h as defineComponent, it as withKeys, l as createElementBlock, rt as withDirectives, t as _plugin_vue_export_helper_default, u as createElementVNode, z as ref } from "./_plugin-vue_export-helper-CsJQtMvr.es.js";
1
+ import { F as openBlock, G as toDisplayString, a as computed, at as withModifiers, c as createCommentVNode, et as vModelText, h as defineComponent, it as withKeys, l as createElementBlock, rt as withDirectives, t as _plugin_vue_export_helper_default, u as createElementVNode, z as ref } from "./_plugin-vue_export-helper-DRPRMkeA.es.js";
2
2
  //#region src/components/surfaces/PasswordPromptSurface.vue?vue&type=script&setup=true&lang.ts
3
3
  var _hoisted_1 = ["onKeydown"];
4
4
  var _hoisted_2 = ["id"];
@@ -1,4 +1,4 @@
1
- const require__plugin_vue_export_helper = require("./_plugin-vue_export-helper-6MBoygIY.cjs");
1
+ const require__plugin_vue_export_helper = require("./_plugin-vue_export-helper-BkbCxNeT.cjs");
2
2
  //#region src/components/surfaces/PasswordPromptSurface.vue?vue&type=script&setup=true&lang.ts
3
3
  var _hoisted_1 = ["onKeydown"];
4
4
  var _hoisted_2 = ["id"];
@@ -1,4 +1,4 @@
1
- import { B as renderList, F as openBlock, N as onMounted, T as mergeProps, W as shallowRef, a as computed, c as createCommentVNode, h as defineComponent, j as onBeforeUnmount, k as normalizeStyle, l as createElementBlock, n as Fragment, p as createVNode, s as createBlock, t as _plugin_vue_export_helper_default, tt as watch, u as createElementVNode, w as markRaw, z as ref } from "./_plugin-vue_export-helper-CsJQtMvr.es.js";
1
+ import { B as renderList, F as openBlock, N as onMounted, T as mergeProps, W as shallowRef, a as computed, c as createCommentVNode, h as defineComponent, j as onBeforeUnmount, k as normalizeStyle, l as createElementBlock, n as Fragment, p as createVNode, s as createBlock, t as _plugin_vue_export_helper_default, tt as watch, u as createElementVNode, w as markRaw, z as ref } from "./_plugin-vue_export-helper-DRPRMkeA.es.js";
2
2
  import { t as isFiniteNumber } from "./is-finite-number-BpL4F38c.es.js";
3
3
  import { t as PDF_TO_CSS_UNITS } from "./constants-BvNs_ybI.es.js";
4
4
  //#region src/core/pdf/helpers/floor.ts
@@ -71,15 +71,9 @@ var PDFJSAdapter = class extends PDFAdapter {
71
71
  };
72
72
  var PDFAdapterFactory = class {
73
73
  static create(config) {
74
- const adapters = {
75
- pdfjs: () => {
76
- return new PDFJSAdapter(config);
77
- },
78
- default: () => {
79
- throw new Error("Unsupported adapter");
80
- }
81
- };
82
- return (adapters[config.adapter] ?? adapters.default)();
74
+ const adapter = (/* @__PURE__ */ new Map([["pdfjs", () => new PDFJSAdapter(config)]])).get(config.adapter);
75
+ if (!adapter) throw new Error("Unsupported adapter");
76
+ return adapter();
83
77
  }
84
78
  };
85
79
  function getWorkerSrcFromCDN(version) {
@@ -1,4 +1,4 @@
1
- const require__plugin_vue_export_helper = require("./_plugin-vue_export-helper-6MBoygIY.cjs");
1
+ const require__plugin_vue_export_helper = require("./_plugin-vue_export-helper-BkbCxNeT.cjs");
2
2
  const require_is_finite_number = require("./is-finite-number-BEXgTRgc.cjs");
3
3
  const require_constants = require("./constants-BeeNZoQp.cjs");
4
4
  //#region src/core/pdf/helpers/floor.ts
@@ -71,15 +71,9 @@ var PDFJSAdapter = class extends PDFAdapter {
71
71
  };
72
72
  var PDFAdapterFactory = class {
73
73
  static create(config) {
74
- const adapters = {
75
- pdfjs: () => {
76
- return new PDFJSAdapter(config);
77
- },
78
- default: () => {
79
- throw new Error("Unsupported adapter");
80
- }
81
- };
82
- return (adapters[config.adapter] ?? adapters.default)();
74
+ const adapter = (/* @__PURE__ */ new Map([["pdfjs", () => new PDFJSAdapter(config)]])).get(config.adapter);
75
+ if (!adapter) throw new Error("Unsupported adapter");
76
+ return adapter();
83
77
  }
84
78
  };
85
79
  function getWorkerSrcFromCDN(version) {
@@ -1,17 +1,29 @@
1
- //#region src/core/v2-integration/internal-vue-runtime.js
1
+ //#region src/helpers/object-guards.ts
2
+ function isPlainObject(value) {
3
+ return typeof value === "object" && value !== null && !Array.isArray(value);
4
+ }
5
+ function isThenable(value) {
6
+ return (typeof value === "object" || typeof value === "function") && value !== null && "then" in value && typeof value.then === "function";
7
+ }
8
+ //#endregion
9
+ //#region src/core/v2-integration/internal-vue-runtime.ts
2
10
  var runtimeKey = "__SUPERDOC_V2_BROWSER_RUNTIME__";
11
+ function isVueRuntime(value) {
12
+ return isPlainObject(value) && typeof value.createApp === "function";
13
+ }
3
14
  function runtime() {
4
- const vue = globalThis[runtimeKey]?.vue;
5
- if (!vue) throw new Error("SuperDoc rendering runtime is unavailable; initialize SuperDoc before rendering built-in surfaces.");
15
+ const installed = Reflect.get(globalThis, runtimeKey);
16
+ const vue = isPlainObject(installed) ? installed.vue : void 0;
17
+ if (!isVueRuntime(vue)) throw new Error("SuperDoc rendering runtime is unavailable; initialize SuperDoc before rendering built-in surfaces.");
6
18
  return vue;
7
19
  }
8
20
  function component(name) {
9
21
  return new Proxy({}, {
10
22
  get(_target, key) {
11
- return runtime()[name][key];
23
+ return Reflect.get(runtime()[name], key);
12
24
  },
13
25
  set(_target, key, value) {
14
- runtime()[name][key] = value;
26
+ Reflect.set(runtime()[name], key, value);
15
27
  return true;
16
28
  },
17
29
  has(_target, key) {
@@ -38,10 +50,10 @@ function defineComponent(options, extraOptions) {
38
50
  }
39
51
  var Transition = new Proxy((props, context) => runtime().Transition(props, context), {
40
52
  get(_target, key) {
41
- return runtime().Transition[key];
53
+ return Reflect.get(runtime().Transition, key);
42
54
  },
43
55
  set(_target, key, value) {
44
- runtime().Transition[key] = value;
56
+ Reflect.set(runtime().Transition, key, value);
45
57
  return true;
46
58
  },
47
59
  has(_target, key) {
@@ -340,6 +352,12 @@ Object.defineProperty(exports, "inject", {
340
352
  return inject;
341
353
  }
342
354
  });
355
+ Object.defineProperty(exports, "isPlainObject", {
356
+ enumerable: true,
357
+ get: function() {
358
+ return isPlainObject;
359
+ }
360
+ });
343
361
  Object.defineProperty(exports, "isReactive", {
344
362
  enumerable: true,
345
363
  get: function() {
@@ -352,6 +370,12 @@ Object.defineProperty(exports, "isRef", {
352
370
  return isRef;
353
371
  }
354
372
  });
373
+ Object.defineProperty(exports, "isThenable", {
374
+ enumerable: true,
375
+ get: function() {
376
+ return isThenable;
377
+ }
378
+ });
355
379
  Object.defineProperty(exports, "markRaw", {
356
380
  enumerable: true,
357
381
  get: function() {
@@ -1,17 +1,29 @@
1
- //#region src/core/v2-integration/internal-vue-runtime.js
1
+ //#region src/helpers/object-guards.ts
2
+ function isPlainObject(value) {
3
+ return typeof value === "object" && value !== null && !Array.isArray(value);
4
+ }
5
+ function isThenable(value) {
6
+ return (typeof value === "object" || typeof value === "function") && value !== null && "then" in value && typeof value.then === "function";
7
+ }
8
+ //#endregion
9
+ //#region src/core/v2-integration/internal-vue-runtime.ts
2
10
  var runtimeKey = "__SUPERDOC_V2_BROWSER_RUNTIME__";
11
+ function isVueRuntime(value) {
12
+ return isPlainObject(value) && typeof value.createApp === "function";
13
+ }
3
14
  function runtime() {
4
- const vue = globalThis[runtimeKey]?.vue;
5
- if (!vue) throw new Error("SuperDoc rendering runtime is unavailable; initialize SuperDoc before rendering built-in surfaces.");
15
+ const installed = Reflect.get(globalThis, runtimeKey);
16
+ const vue = isPlainObject(installed) ? installed.vue : void 0;
17
+ if (!isVueRuntime(vue)) throw new Error("SuperDoc rendering runtime is unavailable; initialize SuperDoc before rendering built-in surfaces.");
6
18
  return vue;
7
19
  }
8
20
  function component(name) {
9
21
  return new Proxy({}, {
10
22
  get(_target, key) {
11
- return runtime()[name][key];
23
+ return Reflect.get(runtime()[name], key);
12
24
  },
13
25
  set(_target, key, value) {
14
- runtime()[name][key] = value;
26
+ Reflect.set(runtime()[name], key, value);
15
27
  return true;
16
28
  },
17
29
  has(_target, key) {
@@ -38,10 +50,10 @@ function defineComponent(options, extraOptions) {
38
50
  }
39
51
  var Transition = new Proxy((props, context) => runtime().Transition(props, context), {
40
52
  get(_target, key) {
41
- return runtime().Transition[key];
53
+ return Reflect.get(runtime().Transition, key);
42
54
  },
43
55
  set(_target, key, value) {
44
- runtime().Transition[key] = value;
56
+ Reflect.set(runtime().Transition, key, value);
45
57
  return true;
46
58
  },
47
59
  has(_target, key) {
@@ -214,4 +226,4 @@ var _plugin_vue_export_helper_default = (sfc, props) => {
214
226
  return target;
215
227
  };
216
228
  //#endregion
217
- export { vModelSelect as $, onActivated as A, renderList as B, isRef as C, normalizeClass as D, nextTick as E, openBlock as F, toDisplayString as G, resolveDirective as H, provide as I, toRefs as J, toRaw as K, reactive as L, onDeactivated as M, onMounted as N, normalizeProps as O, onScopeDispose as P, vModelCheckbox as Q, readonly as R, isReactive as S, mergeProps as T, resolveDynamicComponent as U, renderSlot as V, shallowRef as W, useAttrs as X, unref as Y, useSlots as Z, getCurrentInstance as _, computed as a, withModifiers as at, hasInjectionContext as b, createCommentVNode as c, createStaticVNode as d, vModelText as et, createTextVNode as f, effectScope as g, defineComponent as h, Transition as i, withKeys as it, onBeforeUnmount as j, normalizeStyle as k, createElementBlock as l, defineAsyncComponent as m, Fragment as n, withCtx as nt, createApp as o, createVNode as p, toRef as q, Teleport as r, withDirectives as rt, createBlock as s, _plugin_vue_export_helper_default as t, watch as tt, createElementVNode as u, getCurrentScope as v, markRaw as w, inject as x, h as y, ref as z };
229
+ export { vModelSelect as $, onActivated as A, renderList as B, isRef as C, normalizeClass as D, nextTick as E, openBlock as F, toDisplayString as G, resolveDirective as H, provide as I, toRefs as J, toRaw as K, reactive as L, onDeactivated as M, onMounted as N, normalizeProps as O, onScopeDispose as P, vModelCheckbox as Q, readonly as R, isReactive as S, mergeProps as T, resolveDynamicComponent as U, renderSlot as V, shallowRef as W, useAttrs as X, unref as Y, useSlots as Z, getCurrentInstance as _, computed as a, withModifiers as at, hasInjectionContext as b, createCommentVNode as c, createStaticVNode as d, vModelText as et, createTextVNode as f, effectScope as g, defineComponent as h, Transition as i, withKeys as it, onBeforeUnmount as j, normalizeStyle as k, createElementBlock as l, defineAsyncComponent as m, Fragment as n, withCtx as nt, createApp as o, isPlainObject as ot, createVNode as p, toRef as q, Teleport as r, withDirectives as rt, createBlock as s, isThenable as st, _plugin_vue_export_helper_default as t, watch as tt, createElementVNode as u, getCurrentScope as v, markRaw as w, inject as x, h as y, ref as z };
@@ -1,4 +1,4 @@
1
- import { B as renderList, D as normalizeClass, E as nextTick, F as openBlock, G as toDisplayString, N as onMounted, W as shallowRef, Y as unref, a as computed, at as withModifiers, c as createCommentVNode, f as createTextVNode, h as defineComponent, j as onBeforeUnmount, l as createElementBlock, n as Fragment, t as _plugin_vue_export_helper_default, tt as watch, u as createElementVNode, z as ref } from "./_plugin-vue_export-helper-CsJQtMvr.es.js";
1
+ import { B as renderList, D as normalizeClass, E as nextTick, F as openBlock, G as toDisplayString, N as onMounted, W as shallowRef, Y as unref, a as computed, at as withModifiers, c as createCommentVNode, f as createTextVNode, h as defineComponent, j as onBeforeUnmount, l as createElementBlock, n as Fragment, ot as isPlainObject, t as _plugin_vue_export_helper_default, tt as watch, u as createElementVNode, z as ref } from "./_plugin-vue_export-helper-DRPRMkeA.es.js";
2
2
  import { t as isFiniteNumber } from "./is-finite-number-BpL4F38c.es.js";
3
3
  //#region src/internal/diagnostics/workflow-recording.ts
4
4
  var fields$1 = /* @__PURE__ */ new Set([
@@ -1079,11 +1079,6 @@ var decodeLayoutStoryDataset = (raw) => {
1079
1079
  `${DOM_CLASS_NAMES.BLOCK_SDT}${DATA_ATTRS.SDT_ID}`;
1080
1080
  `${DATA_ATTRS.DRAGGABLE}`;
1081
1081
  //#endregion
1082
- //#region src/helpers/object-guards.ts
1083
- function isPlainObject(value) {
1084
- return typeof value === "object" && value !== null && !Array.isArray(value);
1085
- }
1086
- //#endregion
1087
1082
  //#region src/helpers/tracked-change-comment-lane.ts
1088
1083
  var TRACKED_CHANGE_COMMENT_LANE_ID_PREFIX = "tc-comment:";
1089
1084
  function isSyntheticTrackedChangeCommentLaneItem(item) {
@@ -1304,7 +1299,7 @@ function shallowEqual(a, b) {
1304
1299
  return true;
1305
1300
  }
1306
1301
  //#endregion
1307
- //#region src/internal/toolbar/image-upload.js
1302
+ //#region src/internal/toolbar/image-upload.ts
1308
1303
  /**
1309
1304
  * Interactive image acquisition for the built-in toolbar (SD-3567).
1310
1305
  *
@@ -1325,8 +1320,6 @@ var SUPPORTED_IMAGE_EXTENSIONS = /\.(png|jpe?g)$/i;
1325
1320
  /**
1326
1321
  * Whether a picked/dropped file is an insertable image (PNG/JPEG). Falls back
1327
1322
  * to the file extension when the browser reports no MIME type.
1328
- * @param {File | null | undefined} file
1329
- * @returns {boolean}
1330
1323
  */
1331
1324
  function isSupportedImageFile(file) {
1332
1325
  if (!file) return false;
@@ -1341,8 +1334,6 @@ function isSupportedImageFile(file) {
1341
1334
  * accepts those by extension, but `readAsDataURL` would then produce an
1342
1335
  * `application/octet-stream` data URI that `create.image` rejects. Rewrite
1343
1336
  * the media type from the filename so extension-accepted files still insert.
1344
- * @param {Blob & { name?: string }} file
1345
- * @returns {Promise<string>}
1346
1337
  */
1347
1338
  function fileToDataUri(file) {
1348
1339
  return new Promise((resolve, reject) => {
@@ -1355,9 +1346,6 @@ function fileToDataUri(file) {
1355
1346
  /**
1356
1347
  * Ensure a data URI read from a supported file carries a PNG/JPEG media type.
1357
1348
  * Leaves URIs already typed as a supported image (or uninferable ones) alone.
1358
- * @param {string} dataUri
1359
- * @param {(Blob & { name?: string }) | null | undefined} file
1360
- * @returns {string}
1361
1349
  */
1362
1350
  function normalizeImageDataUri(dataUri, file) {
1363
1351
  const match = /^data:([^;,]*);base64,/.exec(dataUri);
@@ -1374,9 +1362,6 @@ function normalizeImageDataUri(dataUri, file) {
1374
1362
  * `handleImageUpload` callback when configured (V1 contract:
1375
1363
  * `(file: File) => Promise<string>`). A returned non-data URL is fetched and
1376
1364
  * embedded, because `create.image` requires an embedded base64 data URI.
1377
- * @param {File} file
1378
- * @param {((file: File) => Promise<string>) | null | undefined} handleImageUpload
1379
- * @returns {Promise<string>}
1380
1365
  */
1381
1366
  async function resolveImageSrc(file, handleImageUpload) {
1382
1367
  if (typeof handleImageUpload === "function") {
@@ -1392,9 +1377,6 @@ async function resolveImageSrc(file, handleImageUpload) {
1392
1377
  * presigned URLs often respond `application/octet-stream`, so keep a filename
1393
1378
  * hint (URL path, falling back to the originally picked file) for the media
1394
1379
  * type normalization in `fileToDataUri`.
1395
- * @param {string} url
1396
- * @param {File | null | undefined} pickedFile
1397
- * @returns {Promise<string>}
1398
1380
  */
1399
1381
  async function embedRemoteImage(url, pickedFile) {
1400
1382
  const response = await fetch(url);
@@ -1408,13 +1390,6 @@ async function embedRemoteImage(url, pickedFile) {
1408
1390
  * stays attached (hidden) so automation and tests can drive it; `destroy()`
1409
1391
  * removes it. Picking a file calls `onPick(file)`; an unsupported type or a
1410
1392
  * failed pick routes through `onError(error)`.
1411
- *
1412
- * @param {{
1413
- * ownerDocument?: Document,
1414
- * onPick?: (file: File) => unknown,
1415
- * onError?: (error: Error) => void,
1416
- * }} options
1417
- * @returns {{ input: HTMLInputElement, open: () => void, destroy: () => void }}
1418
1393
  */
1419
1394
  function createImageFilePicker({ ownerDocument = document, onPick, onError } = {}) {
1420
1395
  const input = ownerDocument.createElement("input");
@@ -2006,13 +1981,9 @@ var WatermarkSurface_default = /* @__PURE__ */ _plugin_vue_export_helper_default
2006
1981
  }
2007
1982
  }), [["__scopeId", "data-v-df56c82c"]]);
2008
1983
  //#endregion
2009
- //#region src/components/surfaces/watermark-surface-runtime.js
2010
- /**
2011
- * Keeps Vue rendering and post-dismissal announcements outside the public type graph.
2012
- * @param {(() => HTMLElement | null) | undefined} getContainer
2013
- */
1984
+ //#region src/components/surfaces/watermark-surface-runtime.ts
1985
+ /** Keeps Vue rendering and post-dismissal announcements outside the public type graph. */
2014
1986
  function createWatermarkSurfaceRuntime(getContainer) {
2015
- /** @type {HTMLDivElement | null} */
2016
1987
  let status = null;
2017
1988
  let disposed = false;
2018
1989
  return {
@@ -2023,7 +1994,6 @@ function createWatermarkSurfaceRuntime(getContainer) {
2023
1994
  const item = opener?.closest("[data-sd-part=\"toolbar-item\"]") ?? opener?.querySelector("[data-sd-part=\"toolbar-item\"]");
2024
1995
  const container = (item?.closest("[data-sd-part=\"toolbar\"]"))?.parentElement;
2025
1996
  const isWatermarkEntry = item?.querySelector("[data-item=\"btn-watermark\"], [data-item=\"btn-overflow\"]");
2026
- /** @param {() => boolean} isCurrent */
2027
1997
  return async (isCurrent) => {
2028
1998
  await nextTick();
2029
1999
  if (disposed || !isCurrent() || !isWatermarkEntry || opener?.isConnected || !container?.isConnected) return;
@@ -2055,7 +2025,6 @@ function createWatermarkSurfaceRuntime(getContainer) {
2055
2025
  });
2056
2026
  container.appendChild(status);
2057
2027
  },
2058
- /** @param {string} message */
2059
2028
  announce(message) {
2060
2029
  if (!disposed && status) status.textContent = message;
2061
2030
  },
@@ -2671,34 +2640,33 @@ function fontsValue(value) {
2671
2640
  return Object.keys(result).length > 0 ? result : null;
2672
2641
  }
2673
2642
  //#endregion
2674
- //#region src/public/ui/format-painter-helpers.js
2643
+ //#region src/public/ui/format-painter-helpers.ts
2675
2644
  /**
2676
2645
  * Maps SDRunProps field names to InlineRunPatch field names.
2677
2646
  * SDRunProps (read-side) and InlineRunPatch (write-side) use different keys
2678
2647
  * for the same properties; direct assignment between them is forbidden.
2679
- *
2680
- * @param {Record<string, unknown>} props - SDRunProps object from doc.getNodeById
2681
- * @returns {Record<string, unknown>} InlineRunPatch ready for doc.format.apply
2682
2648
  */
2683
2649
  function sdRunPropsToInlineRunPatch(props) {
2684
2650
  if (!props || typeof props !== "object") return {};
2685
2651
  const patch = {};
2686
- if (props.fonts) patch.rFonts = {
2687
- ascii: props.fonts.ascii,
2688
- hAnsi: props.fonts.hAnsi,
2689
- eastAsia: props.fonts.eastAsia,
2690
- cs: props.fonts.cs,
2691
- asciiTheme: props.fonts.asciiTheme,
2692
- hAnsiTheme: props.fonts.hAnsiTheme,
2693
- eastAsiaTheme: props.fonts.eastAsiaTheme,
2694
- csTheme: props.fonts.csTheme,
2695
- hint: props.fonts.hint
2652
+ const fonts = props.fonts;
2653
+ if (isPlainObject(fonts)) patch.rFonts = {
2654
+ ascii: fonts.ascii,
2655
+ hAnsi: fonts.hAnsi,
2656
+ eastAsia: fonts.eastAsia,
2657
+ cs: fonts.cs,
2658
+ asciiTheme: fonts.asciiTheme,
2659
+ hAnsiTheme: fonts.hAnsiTheme,
2660
+ eastAsiaTheme: fonts.eastAsiaTheme,
2661
+ csTheme: fonts.csTheme,
2662
+ hint: fonts.hint
2696
2663
  };
2697
2664
  if (props.fontFamily != null) patch.fontFamily = props.fontFamily;
2698
- if (props.lang) patch.lang = {
2699
- val: props.lang.val,
2700
- eastAsia: props.lang.eastAsia,
2701
- bidi: props.lang.bidi
2665
+ const lang = props.lang;
2666
+ if (isPlainObject(lang)) patch.lang = {
2667
+ val: lang.val,
2668
+ eastAsia: lang.eastAsia,
2669
+ bidi: lang.bidi
2702
2670
  };
2703
2671
  if (props.fontSize != null) patch.fontSize = props.fontSize;
2704
2672
  if (props.fontSizeCs != null) patch.fontSizeCs = props.fontSizeCs;
@@ -2739,19 +2707,24 @@ function sdRunPropsToInlineRunPatch(props) {
2739
2707
  function projectColorRefToInlineColor(color) {
2740
2708
  if (!color) return void 0;
2741
2709
  if (typeof color === "string") return color;
2710
+ if (!isPlainObject(color)) return void 0;
2742
2711
  if (color.model === "rgb") return color.value;
2743
2712
  if (color.model === "auto") return "auto";
2744
2713
  }
2745
2714
  function projectUnderlineToInlinePatch(underline) {
2746
2715
  if (underline == null) return void 0;
2716
+ if (!isPlainObject(underline)) return true;
2747
2717
  const patch = {};
2748
2718
  if (underline.style != null) patch.style = underline.style;
2749
- if (underline.color?.model === "rgb") patch.color = underline.color.value;
2750
- if (underline.color?.model === "theme") patch.themeColor = underline.color.theme;
2719
+ const color = underline.color;
2720
+ if (isPlainObject(color)) {
2721
+ if (color.model === "rgb") patch.color = color.value;
2722
+ else if (color.model === "theme") patch.themeColor = color.theme;
2723
+ }
2751
2724
  return Object.keys(patch).length > 0 ? patch : true;
2752
2725
  }
2753
2726
  function projectShadingToInlinePatch(shading) {
2754
- if (!shading) return void 0;
2727
+ if (!isPlainObject(shading)) return void 0;
2755
2728
  const patch = {};
2756
2729
  const fill = projectColorRefToInlineColor(shading.fill);
2757
2730
  if (fill != null) patch.fill = fill;
@@ -2761,7 +2734,7 @@ function projectShadingToInlinePatch(shading) {
2761
2734
  return Object.keys(patch).length > 0 ? patch : void 0;
2762
2735
  }
2763
2736
  function projectBorderToInlinePatch(border) {
2764
- if (!border) return void 0;
2737
+ if (!isPlainObject(border)) return void 0;
2765
2738
  const patch = {};
2766
2739
  if (border.style != null) patch.val = border.style;
2767
2740
  if (border.width != null) patch.sz = border.width;
@@ -2776,9 +2749,6 @@ function projectBorderToInlinePatch(border) {
2776
2749
  *
2777
2750
  * Falls back to the plain text target when the host has not populated an
2778
2751
  * explicit `selectionTarget` yet.
2779
- *
2780
- * @param {{ selectionTarget?: unknown; target?: unknown } | null | undefined} selection
2781
- * @returns {string}
2782
2752
  */
2783
2753
  function selectionKey(selection) {
2784
2754
  const target = selection?.selectionTarget ?? selection?.target;
@@ -2887,7 +2857,7 @@ function readAllResolvedFact(event, receipt) {
2887
2857
  return fact;
2888
2858
  }
2889
2859
  //#endregion
2890
- //#region src/helpers/v2-typing-mutation-event.js
2860
+ //#region src/helpers/v2-typing-mutation-event.ts
2891
2861
  /**
2892
2862
  * Command kinds whose committed mutations belong to the sustained typing
2893
2863
  * cadence class (insert / replace / plain paste / Backspace / Delete).
@@ -2928,9 +2898,6 @@ var V2_TYPING_COMMAND_KINDS = /* @__PURE__ */ new Set([
2928
2898
  * Events without a forwarded `editableCommandKind` (programmatic Document API
2929
2899
  * mutations, history commits, unclassified structural commands) return false
2930
2900
  * so they keep hydrating immediately.
2931
- *
2932
- * @param {{ type?: string, origin?: string, editableCommandKind?: string } | null | undefined} event
2933
- * @returns {boolean}
2934
2901
  */
2935
2902
  var isV2EditableTextMutationEvent = (event) => {
2936
2903
  if (event?.type !== "mutation:committed" || event.origin !== "command") return false;
@@ -7544,6 +7511,23 @@ function createSuperDocUI(options) {
7544
7511
  const clearAsyncReadKeys = (predicate) => {
7545
7512
  for (const key of asyncReads.keys()) if (predicate(key)) asyncReads.delete(key);
7546
7513
  };
7514
+ const seedAsyncRead = (key, token, value, inflightToken = null) => {
7515
+ asyncReads.set(key, {
7516
+ token,
7517
+ value,
7518
+ hasSettled: true,
7519
+ inflightToken
7520
+ });
7521
+ };
7522
+ const selectionValidationSnapshot = () => ({
7523
+ held: typedCaretValidationHeld,
7524
+ pendingToken: pendingSelectionSeedValidationToken
7525
+ });
7526
+ const setSelectionValidation = (next) => {
7527
+ typedCaretValidationHeld = next.held;
7528
+ pendingSelectionSeedValidationToken = next.pendingToken;
7529
+ };
7530
+ const typingIsRecent = () => Date.now() - lastTypingMutationAtMs < HEAVY_READ_IDLE_MS;
7547
7531
  const selectionScopedAsyncReadKeys = (selection) => {
7548
7532
  const signature = selectionSignature(selection);
7549
7533
  const effectiveUniformityKey = effectiveInlineUniformityCacheKey(selection);
@@ -7811,16 +7795,13 @@ function createSuperDocUI(options) {
7811
7795
  const foreground = foregroundMutationState();
7812
7796
  if (isNonCollapsedHostSelection(hostSelectionSnapshot) && readHostSelectionSnapshot() === hostSelectionSnapshot) {
7813
7797
  const seed = normalizeSelectionInfo(safeCall(() => hostMethod(host, "readLiveSelectionSyncSnapshot")?.(), null));
7814
- if (seed && !seed.selectionTarget && captureWholeTableParagraphSeed(host, seed, hostSelectionSnapshot)) asyncReads.set("selection", {
7815
- token: asyncReads.get("selection")?.token ?? null,
7816
- value: seed,
7817
- hasSettled: true,
7818
- inflightToken: null
7819
- });
7798
+ if (seed && !seed.selectionTarget && captureWholeTableParagraphSeed(host, seed, hostSelectionSnapshot)) seedAsyncRead("selection", asyncReads.get("selection")?.token ?? null, seed);
7820
7799
  }
7821
7800
  if (isNonCollapsedHostSelection(hostSelectionSnapshot) && !(foreground && foreground.active > 0)) {
7822
- typedCaretValidationHeld = false;
7823
- pendingSelectionSeedValidationToken = null;
7801
+ setSelectionValidation({
7802
+ held: false,
7803
+ pendingToken: null
7804
+ });
7824
7805
  issueAsyncRead("selection", selectionReadToken(), selectionCurrentRun, normalizeSelectionInfo);
7825
7806
  return;
7826
7807
  }
@@ -7829,17 +7810,14 @@ function createSuperDocUI(options) {
7829
7810
  const seed = normalizeSelectionInfo(safeCall(() => read.call(host), null));
7830
7811
  if (!seed) return;
7831
7812
  if (wholeTableSelectionChanged) {
7832
- typedCaretValidationHeld = false;
7833
- pendingSelectionSeedValidationToken = null;
7813
+ setSelectionValidation({
7814
+ held: false,
7815
+ pendingToken: null
7816
+ });
7834
7817
  wholeTableParagraphSeed = null;
7835
7818
  captureWholeTableParagraphSeed(host, seed, initialTableSelection);
7836
7819
  const token = selectionReadToken();
7837
- asyncReads.set("selection", {
7838
- token,
7839
- value: seed,
7840
- hasSettled: true,
7841
- inflightToken: null
7842
- });
7820
+ seedAsyncRead("selection", token, seed);
7843
7821
  issueAsyncRead("selection", token, selectionCurrentRun, normalizeSelectionInfo);
7844
7822
  return;
7845
7823
  }
@@ -7849,14 +7827,25 @@ function createSuperDocUI(options) {
7849
7827
  const previousRange = previousCaret?.range;
7850
7828
  const nextRange = nextCaret?.range;
7851
7829
  const sameSeedCaret = Boolean(previousCaret && nextCaret && previousCaret.blockId === nextCaret.blockId && storyLocatorSignature(previousCaret.story) === storyLocatorSignature(nextCaret.story) && previousRange?.start === nextRange?.start);
7852
- typedCaretValidationHeld = Boolean(foreground && foreground.active > 0) || typedCaretValidationHeld && (afterTypingPaint || sameSeedCaret);
7830
+ const validation = selectionValidationSnapshot();
7831
+ const held = Boolean(foreground && foreground.active > 0) || validation.held && (afterTypingPaint || sameSeedCaret);
7832
+ setSelectionValidation({
7833
+ held,
7834
+ pendingToken: validation.pendingToken
7835
+ });
7853
7836
  const token = selectionReadToken();
7854
- const deferAuthoritativeRead = Boolean(foreground && (foreground.active > 0 || foreground.pending > 0)) || typedCaretValidationHeld && Date.now() - lastTypingMutationAtMs < HEAVY_READ_IDLE_MS;
7837
+ const deferAuthoritativeRead = Boolean(foreground && (foreground.active > 0 || foreground.pending > 0)) || held && typingIsRecent();
7855
7838
  if (!deferAuthoritativeRead) {
7856
- pendingSelectionSeedValidationToken = null;
7839
+ setSelectionValidation({
7840
+ held,
7841
+ pendingToken: null
7842
+ });
7857
7843
  if (issueAsyncRead("selection", token, selectionCurrentRun, normalizeSelectionInfo)) return;
7858
7844
  } else {
7859
- pendingSelectionSeedValidationToken = token;
7845
+ setSelectionValidation({
7846
+ held,
7847
+ pendingToken: token
7848
+ });
7860
7849
  scheduleForegroundAsyncRetry();
7861
7850
  }
7862
7851
  const prev = asyncReads.get("selection");
@@ -7866,17 +7855,12 @@ function createSuperDocUI(options) {
7866
7855
  const sameActiveTypingCaret = Boolean(foreground && foreground.active > 0 && previousCaret && nextCaret && previousCaret.blockId === nextCaret.blockId && storyLocatorSignature(previousCaret.story) === storyLocatorSignature(nextCaret.story) && typeof previousRange?.start === "number" && typeof nextRange?.start === "number" && Math.abs(nextRange.start - previousRange.start) <= 2);
7867
7856
  const carriedChangeIds = paintedTrackChangeId != null || sameActiveTypingCaret ? state.selection.activeChangeIds.filter((id) => paintedTrackChangeId == null || buildTrackedChangeIdContext(state.trackChanges.items).aliasesFor(id).includes(paintedTrackChangeId)) : [];
7868
7857
  const seedChangeIds = Array.isArray(seed.activeChangeIds) && seed.activeChangeIds.length > 0 ? seed.activeChangeIds : carriedChangeIds;
7869
- asyncReads.set("selection", {
7870
- token,
7871
- value: {
7872
- ...seed,
7873
- activeMarks: seedMarks,
7874
- activeCommentIds: seedCommentIds,
7875
- activeChangeIds: seedChangeIds
7876
- },
7877
- hasSettled: true,
7878
- inflightToken: deferAuthoritativeRead ? null : prev?.inflightToken ?? null
7879
- });
7858
+ seedAsyncRead("selection", token, {
7859
+ ...seed,
7860
+ activeMarks: seedMarks,
7861
+ activeCommentIds: seedCommentIds,
7862
+ activeChangeIds: seedChangeIds
7863
+ }, deferAuthoritativeRead ? null : prev?.inflightToken ?? null);
7880
7864
  };
7881
7865
  const selectionInfoMatchesHost = (info) => {
7882
7866
  const snapshot = readHostSelectionSnapshot();
@@ -7898,12 +7882,7 @@ function createSuperDocUI(options) {
7898
7882
  const sourceToken = contentToken();
7899
7883
  const mode = readDocumentMode();
7900
7884
  if (typeof current !== "function") {
7901
- asyncReads.set("selection", {
7902
- token,
7903
- value: null,
7904
- hasSettled: true,
7905
- inflightToken: null
7906
- });
7885
+ seedAsyncRead("selection", token, null);
7907
7886
  recompute();
7908
7887
  return selectionSliceFromInfo(null, "pending");
7909
7888
  }
@@ -7920,12 +7899,7 @@ function createSuperDocUI(options) {
7920
7899
  if (disposed) return selectionSliceFromInfo(null, "pending");
7921
7900
  const info = normalizeSelectionInfo(raw);
7922
7901
  if (selectionReadToken() !== token && !(getDoc() === doc && contentToken() === sourceToken && readDocumentMode() === mode && selectionInfoMatchesHost(info))) return attempt < 1 ? readSelectionInfoFresh(attempt + 1) : selectionSliceFromInfo(null, "pending");
7923
- asyncReads.set("selection", {
7924
- token: selectionReadToken(),
7925
- value: info,
7926
- hasSettled: true,
7927
- inflightToken: null
7928
- });
7902
+ seedAsyncRead("selection", selectionReadToken(), info);
7929
7903
  const selection = selectionSliceFromInfo(info, info ? "ready" : "pending");
7930
7904
  recompute();
7931
7905
  return selection;
@@ -14598,12 +14572,7 @@ function createSuperDocUI(options) {
14598
14572
  const resolved = await Promise.resolve(resolveMetadata({ id }));
14599
14573
  if (token !== localContentToken()) return null;
14600
14574
  const target = readMetadataResolvedTarget(resolved);
14601
- asyncReads.set(metadataResolveKey(id), {
14602
- token,
14603
- value: target,
14604
- hasSettled: true,
14605
- inflightToken: null
14606
- });
14575
+ seedAsyncRead(metadataResolveKey(id), token, target);
14607
14576
  return target;
14608
14577
  } catch {
14609
14578
  return null;
@@ -15859,4 +15828,4 @@ function commandIsActive(descriptor, selection) {
15859
15828
  return descriptor.activeMark ? selection.activeMarks.includes(descriptor.activeMark) : false;
15860
15829
  }
15861
15830
  //#endregion
15862
- export { createInteractionHistory as C, recordInteraction as E, closeInteractionHistory as S, isWorkflowRecordingEnabled as T, createTrackedChangePermissionResolver as _, registerFirstPartyCommandMutation as a, isPlainObject as b, getCommandDescriptor as c, mutationCommittedEventChangedDocument as d, createImageFilePicker as f, PERMISSIONS as g, BUILT_IN_PERMISSION_METHOD as h, readFirstPartyPageNumbers as i, applyV2CommentInvalidationFromMutation as l, shallowEqual as m, executeFirstPartyCommandAsync as n, isRecord as o, resolveImageSrc as p, executeFirstPartyShortcutAsync as r, BUILT_IN_COMMAND_IDS as s, createSuperDocUI as t, getV2TrackedChangeMutationImpact as u, isAllowed as v, getWorkflowRecording as w, DOM_CLASS_NAMES as x, isSyntheticTrackedChangeCommentLaneItem as y };
15831
+ export { getWorkflowRecording as C, createInteractionHistory as S, recordInteraction as T, createTrackedChangePermissionResolver as _, registerFirstPartyCommandMutation as a, DOM_CLASS_NAMES as b, getCommandDescriptor as c, mutationCommittedEventChangedDocument as d, createImageFilePicker as f, PERMISSIONS as g, BUILT_IN_PERMISSION_METHOD as h, readFirstPartyPageNumbers as i, applyV2CommentInvalidationFromMutation as l, shallowEqual as m, executeFirstPartyCommandAsync as n, isRecord as o, resolveImageSrc as p, executeFirstPartyShortcutAsync as r, BUILT_IN_COMMAND_IDS as s, createSuperDocUI as t, getV2TrackedChangeMutationImpact as u, isAllowed as v, isWorkflowRecordingEnabled as w, closeInteractionHistory as x, isSyntheticTrackedChangeCommentLaneItem as y };