superdoc 2.29.0-next.2 → 2.29.0-next.3

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 (45) hide show
  1. package/dist/chunks/{FindReplaceSurface-Dm043CZP.es.js → FindReplaceSurface-BKVHzhQ4.es.js} +34 -26
  2. package/dist/chunks/{FindReplaceSurface-BRs3JrCq.cjs → FindReplaceSurface-BNDrJ6VS.cjs} +34 -26
  3. package/dist/chunks/{PasswordPromptSurface-DGjmN7A-.es.js → PasswordPromptSurface-6mF6Azda.es.js} +6 -4
  4. package/dist/chunks/{PasswordPromptSurface-BpqP4pUa.cjs → PasswordPromptSurface-BNkaztaP.cjs} +6 -4
  5. package/dist/collaboration-upgrade-engine.cjs +1 -1
  6. package/dist/collaboration-upgrade-engine.es.js +1 -1
  7. package/dist/style.css +1 -1
  8. package/dist/style.layered.css +1 -1
  9. package/dist/superdoc/src/components/CommentsLayer/CommentDialog.vue.d.ts +7 -1854
  10. package/dist/superdoc/src/components/CommentsLayer/CommentHeader.vue.d.ts +3 -4
  11. package/dist/superdoc/src/components/CommentsLayer/CommentInput.vue.d.ts +3 -618
  12. package/dist/superdoc/src/components/surfaces/FindReplaceSurface.vue.d.ts +58 -15
  13. package/dist/superdoc/src/components/surfaces/PasswordPromptSurface.vue.d.ts +58 -15
  14. package/dist/superdoc/src/components/surfaces/SurfaceFloating.vue.d.ts +14 -6
  15. package/dist/superdoc/src/components/surfaces/SurfaceHost.vue.d.ts +25 -15
  16. package/dist/superdoc/src/core/SuperDoc.d.ts +1 -6
  17. package/dist/superdoc/src/core/editor-runtime/index.d.ts +1 -1
  18. package/dist/superdoc/src/core/editor-runtime/types.d.ts +7 -0
  19. package/dist/superdoc/src/core/editor-runtime/v2/v2-editor-runtime-adapter.d.ts +2 -1
  20. package/dist/superdoc/src/icons.d.ts +8 -0
  21. package/dist/superdoc/src/internal/toolbar/built-in/AIWriter.vue.d.ts +76 -15
  22. package/dist/superdoc/src/internal/toolbar/built-in/AlignmentButtons.vue.d.ts +5 -3
  23. package/dist/superdoc/src/internal/toolbar/built-in/ButtonGroup.vue.d.ts +105 -5
  24. package/dist/superdoc/src/internal/toolbar/built-in/DocumentMode.vue.d.ts +20 -6
  25. package/dist/superdoc/src/internal/toolbar/built-in/IconGrid.vue.d.ts +44 -12
  26. package/dist/superdoc/src/internal/toolbar/built-in/IconGridRow.vue.d.ts +32 -9
  27. package/dist/superdoc/src/internal/toolbar/built-in/StyleButtonsList.vue.d.ts +39 -10
  28. package/dist/superdoc/src/internal/toolbar/built-in/TableActions.vue.d.ts +24 -6
  29. package/dist/superdoc/src/internal/toolbar/built-in/TableGrid.vue.d.ts +7 -3
  30. package/dist/superdoc/src/internal/toolbar/built-in/ToolbarComboBox.vue.d.ts +1 -1
  31. package/dist/superdoc/src/internal/toolbar/built-in/ToolbarDropdown.vue.d.ts +1 -0
  32. package/dist/superdoc/src/internal/toolbar/built-in/ToolbarSeparator.vue.d.ts +16 -6
  33. package/dist/superdoc/src/internal/toolbar/built-in/color-dropdown-helpers.d.ts +2 -2
  34. package/dist/superdoc/src/internal/toolbar/built-in/list-style-buttons.d.ts +2 -2
  35. package/dist/superdoc/src/internal/toolbar/built-in/toolbarIcons.d.ts +67 -0
  36. package/dist/superdoc/src/stores/helpers/comment-draft-text.d.ts +1 -0
  37. package/dist/superdoc/src/stores/helpers/tracked-change-row-values.d.ts +25 -0
  38. package/dist/superdoc.cjs +259 -176
  39. package/dist/superdoc.es.js +240 -159
  40. package/dist-cdn/style.layered.css +1 -1
  41. package/dist-cdn/superdoc.min.css +1 -1
  42. package/dist-cdn/superdoc.min.js +41 -41
  43. package/package.json +2 -2
  44. package/dist/superdoc/src/internal/toolbar/built-in/FontFamilyCombobox.vue.d.ts +0 -10
  45. package/dist/superdoc/src/internal/toolbar/built-in/FontSizeCombobox.vue.d.ts +0 -10
@@ -258,7 +258,7 @@ var v_click_outside_default = {
258
258
  var DEFAULT_ENDPOINT = "https://ingest.superdoc.dev/v1/collect";
259
259
  function getSuperdocVersion() {
260
260
  try {
261
- return "2.29.0-next.2";
261
+ return "2.29.0-next.3";
262
262
  } catch {
263
263
  return "unknown";
264
264
  }
@@ -7383,74 +7383,88 @@ var buildTrackedChangeDecisionLinkIndex = (allComments, previous = /* @__PURE__
7383
7383
  return next;
7384
7384
  };
7385
7385
  //#endregion
7386
- //#region src/stores/comments-store.js
7387
- var makeTrackedChangeAnchorKey = ({ storyKey, rawId }) => `tc::${storyKey}::${rawId}`;
7386
+ //#region src/stores/helpers/comment-draft-text.ts
7388
7387
  var COMMENT_DRAFT_BR_TAG = /<br(?:\s[^>]*)?\s*\/?>/gi;
7389
7388
  var COMMENT_DRAFT_BLOCK_BOUNDARY = /(?:<\/(?:p|div|li|blockquote|pre|h[1-6])\s*>\s*)+(?:<(?:p|div|li|blockquote|pre|h[1-6])(?:\s[^>]*)?\s*\/?>)+/gi;
7390
7389
  var COMMENT_DRAFT_BLOCK_OPEN_TAG = /<(?:p|div|li|blockquote|pre|h[1-6])(?:\s[^>]*)?\s*\/?>/gi;
7391
7390
  var COMMENT_DRAFT_BLOCK_CLOSE_TAG = /<\/(?:p|div|li|blockquote|pre|h[1-6])\s*>/gi;
7392
7391
  var COMMENT_DRAFT_ANY_TAG = /<\/?[A-Za-z][A-Za-z0-9:-]*(?:\s[^>]*)?\s*\/?>/g;
7393
- var COMMENT_DRAFT_ENTITY = /&(#x[0-9a-fA-F]+|#\d+|[a-zA-Z][a-zA-Z0-9]+);/g;
7394
- var COMMENT_DRAFT_NAMED_ENTITIES = {
7395
- amp: "&",
7396
- apos: "'",
7397
- gt: ">",
7398
- lt: "<",
7399
- nbsp: " ",
7400
- quot: "\""
7392
+ var COMMENT_DRAFT_ENTITY = /&(#[xX][0-9a-fA-F]+|#\d+|[a-zA-Z][a-zA-Z0-9]+);/g;
7393
+ var COMMENT_DRAFT_NAMED_ENTITIES = /* @__PURE__ */ new Map([
7394
+ ["amp", "&"],
7395
+ ["apos", "'"],
7396
+ ["gt", ">"],
7397
+ ["lt", "<"],
7398
+ ["nbsp", " "],
7399
+ ["quot", "\""]
7400
+ ]);
7401
+ var decodeCommentDraftEntity = (entity) => {
7402
+ const lower = entity.toLowerCase();
7403
+ const named = COMMENT_DRAFT_NAMED_ENTITIES.get(lower);
7404
+ if (named !== void 0) return named;
7405
+ const radix = lower.startsWith("#x") ? 16 : lower.startsWith("#") ? 10 : null;
7406
+ if (!radix) return null;
7407
+ const value = lower.startsWith("#x") ? lower.slice(2) : lower.slice(1);
7408
+ const codePoint = Number.parseInt(value, radix);
7409
+ if (!Number.isFinite(codePoint)) return null;
7410
+ try {
7411
+ return String.fromCodePoint(codePoint);
7412
+ } catch {
7413
+ return null;
7414
+ }
7415
+ };
7416
+ var decodeCommentDraftEntities = (value) => value.replace(COMMENT_DRAFT_ENTITY, (match, entity) => decodeCommentDraftEntity(entity) ?? match);
7417
+ var normalizeV2CommentDraftText = (value) => {
7418
+ const html = String(value ?? "");
7419
+ if (!html || html === "<p></p>") return "";
7420
+ return decodeCommentDraftEntities(html.replace(COMMENT_DRAFT_BLOCK_BOUNDARY, "\n").replace(COMMENT_DRAFT_BR_TAG, "\n").replace(COMMENT_DRAFT_BLOCK_CLOSE_TAG, "").replace(COMMENT_DRAFT_BLOCK_OPEN_TAG, "").replace(COMMENT_DRAFT_ANY_TAG, ""));
7401
7421
  };
7422
+ //#endregion
7423
+ //#region src/stores/helpers/tracked-change-row-values.ts
7424
+ var isObjectOrArray = (value) => isPlainObject$1(value) || Array.isArray(value);
7425
+ var stringOrEmpty = (value) => typeof value === "string" ? value : "";
7426
+ var makeTrackedChangeAnchorKey = ({ storyKey, rawId }) => `tc::${storyKey}::${rawId}`;
7402
7427
  var shallowEqual = (a, b) => {
7403
7428
  if (Object.is(a, b)) return true;
7404
- if (!a || !b || typeof a !== "object" || typeof b !== "object") return false;
7429
+ if (!isObjectOrArray(a) || !isObjectOrArray(b)) return false;
7405
7430
  const aKeys = Object.keys(a);
7406
7431
  const bKeys = Object.keys(b);
7407
7432
  if (aKeys.length !== bKeys.length) return false;
7408
7433
  return aKeys.every((key) => Object.prototype.hasOwnProperty.call(b, key) && Object.is(a[key], b[key]));
7409
7434
  };
7410
- /**
7411
- * Normalize the optional signed tracked-change detail lines
7412
- * (`[{ excerpt, label }]`, TCS-LIST-005) to a stable shape; absent, empty, or
7413
- * malformed input reads as `null` so legacy rows stay untouched.
7414
- */
7435
+ var elementsShallowEqual = (a, b) => {
7436
+ if (a === b) return true;
7437
+ if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return false;
7438
+ return a.every((element, index) => shallowEqual(element, b[index]));
7439
+ };
7415
7440
  var normalizeTrackedChangeDetailLines = (lines) => {
7416
7441
  if (!Array.isArray(lines)) return null;
7417
- const normalized = lines.filter((line) => line && typeof line === "object").map((line) => ({
7418
- excerpt: typeof line.excerpt === "string" ? line.excerpt : "",
7419
- label: typeof line.label === "string" ? line.label : ""
7442
+ const normalized = lines.filter(isObjectOrArray).map((line) => ({
7443
+ excerpt: stringOrEmpty(line.excerpt),
7444
+ label: stringOrEmpty(line.label)
7420
7445
  }));
7421
7446
  return normalized.length > 0 ? normalized : null;
7422
7447
  };
7423
- /**
7424
- * Element-wise equality for detail-line arrays: refresh paths rebuild the
7425
- * array each pass, so reference equality would rebroadcast every keystroke.
7426
- */
7427
- var trackedChangeDetailLinesEqual = (a, b) => {
7428
- if (a === b) return true;
7429
- if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return false;
7430
- return a.every((line, index) => shallowEqual(line, b[index]));
7431
- };
7448
+ var trackedChangeDetailLinesEqual = elementsShallowEqual;
7432
7449
  var normalizeTrackedChangeCustomAttributes = (attributes) => {
7433
7450
  if (!Array.isArray(attributes)) return null;
7434
- return attributes.filter((attribute) => attribute && typeof attribute === "object").map((attribute) => ({
7435
- name: typeof attribute.name === "string" ? attribute.name : "",
7436
- namespaceUri: typeof attribute.namespaceUri === "string" ? attribute.namespaceUri : "",
7437
- localName: typeof attribute.localName === "string" ? attribute.localName : "",
7438
- value: typeof attribute.value === "string" ? attribute.value : ""
7451
+ return attributes.filter(isObjectOrArray).map((attribute) => ({
7452
+ name: stringOrEmpty(attribute.name),
7453
+ namespaceUri: stringOrEmpty(attribute.namespaceUri),
7454
+ localName: stringOrEmpty(attribute.localName),
7455
+ value: stringOrEmpty(attribute.value)
7439
7456
  })).filter((attribute) => attribute.name && attribute.namespaceUri && attribute.localName);
7440
7457
  };
7441
- var trackedChangeCustomAttributesEqual = (left, right) => {
7442
- if (left === right) return true;
7443
- if (!Array.isArray(left) || !Array.isArray(right) || left.length !== right.length) return false;
7444
- return left.every((attribute, index) => shallowEqual(attribute, right[index]));
7445
- };
7458
+ var trackedChangeCustomAttributesEqual = elementsShallowEqual;
7459
+ var positiveDimension = (value) => isFiniteNumber(value) && value > 0 ? value : null;
7446
7460
  var normalizeTrackedChangeImagePreview = (preview) => {
7447
- if (!preview || typeof preview !== "object") return null;
7461
+ if (!isObjectOrArray(preview)) return null;
7448
7462
  const src = typeof preview.src === "string" ? preview.src : null;
7449
7463
  if (!src || !src.startsWith("data:image/")) return null;
7450
7464
  const contentType = typeof preview.contentType === "string" && preview.contentType.startsWith("image/") ? preview.contentType : null;
7451
7465
  const role = typeof preview.role === "string" ? preview.role : null;
7452
- const width = isFiniteNumber(preview.width) && preview.width > 0 ? preview.width : null;
7453
- const height = isFiniteNumber(preview.height) && preview.height > 0 ? preview.height : null;
7466
+ const width = positiveDimension(preview.width);
7467
+ const height = positiveDimension(preview.height);
7454
7468
  const alt = typeof preview.alt === "string" && preview.alt.length > 0 ? preview.alt : "Tracked image preview";
7455
7469
  return {
7456
7470
  src,
@@ -7461,35 +7475,16 @@ var normalizeTrackedChangeImagePreview = (preview) => {
7461
7475
  alt
7462
7476
  };
7463
7477
  };
7464
- var decodeCommentDraftEntity = (entity) => {
7465
- const lower = String(entity).toLowerCase();
7466
- const named = COMMENT_DRAFT_NAMED_ENTITIES[lower];
7467
- if (named !== void 0) return named;
7468
- const radix = lower.startsWith("#x") ? 16 : lower.startsWith("#") ? 10 : null;
7469
- if (!radix) return null;
7470
- const value = lower.startsWith("#x") ? lower.slice(2) : lower.slice(1);
7471
- const codePoint = Number.parseInt(value, radix);
7472
- if (!Number.isFinite(codePoint)) return null;
7473
- try {
7474
- return String.fromCodePoint(codePoint);
7475
- } catch {
7476
- return null;
7477
- }
7478
- };
7479
- var decodeCommentDraftEntities = (value) => value.replace(COMMENT_DRAFT_ENTITY, (match, entity) => decodeCommentDraftEntity(entity) ?? match);
7480
- var normalizeV2CommentDraftText = (value) => {
7481
- const html = String(value ?? "");
7482
- if (!html || html === "<p></p>") return "";
7483
- return decodeCommentDraftEntities(html.replace(COMMENT_DRAFT_BLOCK_BOUNDARY, "\n").replace(COMMENT_DRAFT_BR_TAG, "\n").replace(COMMENT_DRAFT_BLOCK_CLOSE_TAG, "").replace(COMMENT_DRAFT_BLOCK_OPEN_TAG, "").replace(COMMENT_DRAFT_ANY_TAG, ""));
7484
- };
7485
7478
  var cloneV2TrackedChangeStory = (story) => {
7486
- if (!story || typeof story !== "object") return null;
7479
+ if (!isObjectOrArray(story)) return null;
7487
7480
  const rawStory = toRaw$2(story);
7488
7481
  return {
7489
7482
  ...rawStory,
7490
- ...rawStory.section && typeof rawStory.section === "object" ? { section: { ...toRaw$2(rawStory.section) } } : {}
7483
+ ...isObjectOrArray(rawStory.section) ? { section: { ...toRaw$2(rawStory.section) } } : {}
7491
7484
  };
7492
7485
  };
7486
+ //#endregion
7487
+ //#region src/stores/comments-store.js
7493
7488
  var useCommentsStore = defineStore("comments", () => {
7494
7489
  const BODY_TRACKED_CHANGE_STORY = {
7495
7490
  kind: "story",
@@ -11723,7 +11718,7 @@ var CommentHeader_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/*
11723
11718
  ], 2)]);
11724
11719
  };
11725
11720
  }
11726
- }), [["__scopeId", "data-v-33950cc9"]]);
11721
+ }), [["__scopeId", "data-v-5831e876"]]);
11727
11722
  //#endregion
11728
11723
  //#region src/components/CommentsLayer/CommentInput.vue?vue&type=script&setup=true&lang.ts
11729
11724
  var _hoisted_1$27 = { class: "input-section" };
@@ -11946,7 +11941,7 @@ var CommentInput_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/*
11946
11941
  }), 128))])) : createCommentVNode("", true)])], 2)]);
11947
11942
  };
11948
11943
  }
11949
- }), [["__scopeId", "data-v-65c31fdc"]]);
11944
+ }), [["__scopeId", "data-v-aa97de44"]]);
11950
11945
  //#endregion
11951
11946
  //#region src/internal/toolbar/built-in/url-safety.js
11952
11947
  /**
@@ -13392,7 +13387,7 @@ var CommentDialog_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/*
13392
13387
  ], 64))], 14, _hoisted_1$26)), [[_directive_click_outside, handleClickOutside]]);
13393
13388
  };
13394
13389
  }
13395
- }), [["__scopeId", "data-v-752d9e0b"]]);
13390
+ }), [["__scopeId", "data-v-90d88bf5"]]);
13396
13391
  //#endregion
13397
13392
  //#region src/components/CommentsLayer/commentsList/ReviewDirectoryListItem.vue?vue&type=script&setup=true&lang.ts
13398
13393
  var _hoisted_1$25 = [
@@ -15343,7 +15338,7 @@ var FloatingComments_default = /* @__PURE__ */ _plugin_vue_export_helper_default
15343
15338
  }), 128))], 4)], 36);
15344
15339
  };
15345
15340
  }
15346
- }), [["__scopeId", "data-v-e74251e0"]]);
15341
+ }), [["__scopeId", "data-v-0655e424"]]);
15347
15342
  //#endregion
15348
15343
  //#region src/components/CommentsLayer/PdfCommentsLayer.vue?vue&type=script&setup=true&lang.ts
15349
15344
  var _hoisted_1$22 = {
@@ -16855,7 +16850,7 @@ function usePasswordPrompt({ getSurfaceManager, getPasswordPromptConfig, onUnhan
16855
16850
  })
16856
16851
  });
16857
16852
  } else {
16858
- const PasswordPromptSurface = (await import("./chunks/PasswordPromptSurface-DGjmN7A-.es.js")).default;
16853
+ const PasswordPromptSurface = (await import("./chunks/PasswordPromptSurface-6mF6Azda.es.js")).default;
16859
16854
  const surfaceId = `password-prompt-${doc.id}`;
16860
16855
  handle = manager.open({
16861
16856
  id: surfaceId,
@@ -17550,7 +17545,7 @@ function useFindReplace({ getSurfaceManager, getActiveEditor, activeEditorRef, g
17550
17545
  } else {
17551
17546
  let FindReplaceSurface;
17552
17547
  try {
17553
- FindReplaceSurface = (await import("./chunks/FindReplaceSurface-Dm043CZP.es.js")).default;
17548
+ FindReplaceSurface = (await import("./chunks/FindReplaceSurface-BKVHzhQ4.es.js")).default;
17554
17549
  } catch {
17555
17550
  opening = false;
17556
17551
  return;
@@ -19600,6 +19595,9 @@ function createV2EditorRuntimeAdapter(options) {
19600
19595
  setDocumentMode(mode) {
19601
19596
  host.setDocumentMode(mode);
19602
19597
  },
19598
+ async setUser(user) {
19599
+ await host.setUser?.(user);
19600
+ },
19603
19601
  getDocumentMode: () => host.getDocumentMode(),
19604
19602
  setTrackedChangesRenderOptions(options) {
19605
19603
  host.setTrackedChangesRenderOptions(options);
@@ -20439,11 +20437,13 @@ var SurfaceDialog_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/*
20439
20437
  }
20440
20438
  }), [["__scopeId", "data-v-6ce23dd7"]]);
20441
20439
  //#endregion
20442
- //#region src/components/surfaces/SurfaceFloating.vue
20440
+ //#region src/components/surfaces/SurfaceFloating.vue?vue&type=script&setup=true&lang.ts
20443
20441
  var _hoisted_1$18 = ["aria-labelledby", "aria-label"];
20444
20442
  var _hoisted_2$14 = ["id"];
20445
20443
  var _hoisted_3$12 = { class: "sd-surface-floating__content" };
20446
- var SurfaceFloating_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
20444
+ //#endregion
20445
+ //#region src/components/surfaces/SurfaceFloating.vue
20446
+ var SurfaceFloating_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
20447
20447
  __name: "SurfaceFloating",
20448
20448
  props: { surface: {
20449
20449
  type: Object,
@@ -20591,8 +20591,10 @@ var SurfaceFloating_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
20591
20591
  ])) : __props.surface.component ? (openBlock(), createBlock(resolveDynamicComponent(__props.surface.component), normalizeProps(mergeProps({ key: 1 }, mergedComponentProps.value)), null, 16)) : createCommentVNode("", true)])], 14, _hoisted_1$18);
20592
20592
  };
20593
20593
  }
20594
- }, [["__scopeId", "data-v-cd2be5db"]]);
20595
- var SurfaceHost_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
20594
+ }), [["__scopeId", "data-v-d26a1197"]]);
20595
+ //#endregion
20596
+ //#region src/components/surfaces/SurfaceHost.vue
20597
+ var SurfaceHost_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
20596
20598
  __name: "SurfaceHost",
20597
20599
  props: { geometryTarget: {
20598
20600
  type: Object,
@@ -20742,7 +20744,7 @@ var SurfaceHost_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
20742
20744
  if (dialog.value) return;
20743
20745
  if (event.key === "Escape" && f.request.closeOnEscape !== false) {
20744
20746
  event.stopPropagation();
20745
- surfaceManager.close(f.id);
20747
+ surfaceManager?.close(f.id);
20746
20748
  }
20747
20749
  }
20748
20750
  let escapeListenerAttached = false;
@@ -20761,7 +20763,8 @@ var SurfaceHost_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
20761
20763
  if (!f || f.settled) return;
20762
20764
  if (dialog.value) return;
20763
20765
  const rootEl = floatingRef.value?.rootEl;
20764
- if (rootEl && !rootEl.contains(event.target)) surfaceManager.close(f.id);
20766
+ const target = event.target instanceof Node ? event.target : null;
20767
+ if (rootEl && !rootEl.contains(target)) surfaceManager?.close(f.id);
20765
20768
  }
20766
20769
  let pointerListenerAttached = false;
20767
20770
  function attachPointerListener() {
@@ -20791,7 +20794,7 @@ var SurfaceHost_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
20791
20794
  });
20792
20795
  function handleDialogClose() {
20793
20796
  const d = dialog.value;
20794
- if (d && !d.settled) surfaceManager.close(d.id);
20797
+ if (d && !d.settled) surfaceManager?.close(d.id);
20795
20798
  }
20796
20799
  return (_ctx, _cache) => {
20797
20800
  return openBlock(), createBlock(Teleport, { to: "body" }, [hasAnySurface.value ? (openBlock(), createElementBlock("div", {
@@ -20813,7 +20816,7 @@ var SurfaceHost_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
20813
20816
  }, null, 8, ["surface", "scroll-lock-target"])) : createCommentVNode("", true)]);
20814
20817
  };
20815
20818
  }
20816
- }, [["__scopeId", "data-v-dad99b67"]]);
20819
+ }), [["__scopeId", "data-v-ae02e94c"]]);
20817
20820
  //#endregion
20818
20821
  //#region src/SuperDoc.vue?vue&type=script&setup=true&lang.ts
20819
20822
  var _hoisted_1$17 = ["data-superdoc-ui-owner"];
@@ -23446,7 +23449,7 @@ var SuperDoc_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__P
23446
23449
  ], 46, _hoisted_1$17);
23447
23450
  };
23448
23451
  }
23449
- }), [["__scopeId", "data-v-da95e5c5"]]);
23452
+ }), [["__scopeId", "data-v-0c6f8747"]]);
23450
23453
  //#endregion
23451
23454
  //#region src/core/create-app.js
23452
23455
  var PINIA_DEVTOOLS_SETUP_EVENT = "devtools-plugin:setup";
@@ -27188,13 +27191,15 @@ var ToolbarButton_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/*
27188
27191
  }
27189
27192
  }), [["__scopeId", "data-v-40889353"]]);
27190
27193
  //#endregion
27191
- //#region src/internal/toolbar/built-in/ToolbarSeparator.vue
27194
+ //#region src/internal/toolbar/built-in/ToolbarSeparator.vue?vue&type=script&setup=true&lang.ts
27192
27195
  var _hoisted_1$14 = {
27193
27196
  class: "toolbar-separator",
27194
27197
  role: "separator",
27195
27198
  "aria-label": "Toolbar separator"
27196
27199
  };
27197
- var ToolbarSeparator_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
27200
+ //#endregion
27201
+ //#region src/internal/toolbar/built-in/ToolbarSeparator.vue
27202
+ var ToolbarSeparator_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
27198
27203
  __name: "ToolbarSeparator",
27199
27204
  props: { active: {
27200
27205
  type: Boolean,
@@ -27214,7 +27219,7 @@ var ToolbarSeparator_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
27214
27219
  }, null, 4)]);
27215
27220
  };
27216
27221
  }
27217
- }, [["__scopeId", "data-v-cb82253a"]]);
27222
+ }), [["__scopeId", "data-v-10932d46"]]);
27218
27223
  //#endregion
27219
27224
  //#region src/internal/toolbar/built-in/ToolbarDropdown.vue?vue&type=script&setup=true&lang.ts
27220
27225
  var _hoisted_1$13 = { class: "toolbar-dropdown" };
@@ -27617,7 +27622,7 @@ var ToolbarDropdown_default = /* @__PURE__ */ _plugin_vue_export_helper_default(
27617
27622
  })], 8, ["to"]))]);
27618
27623
  };
27619
27624
  }
27620
- }), [["__scopeId", "data-v-50758732"]]);
27625
+ }), [["__scopeId", "data-v-942d76a6"]]);
27621
27626
  //#endregion
27622
27627
  //#region src/internal/toolbar/built-in/toolbar-focus-helpers.js
27623
27628
  var preventEditorFocusTransfer = (event) => {
@@ -27639,7 +27644,9 @@ var refocusEditorSurface = (superToolbar, preferredEditor = null) => {
27639
27644
  const editor = document.querySelector("[role=\"textbox\"][aria-label*=\"SuperDoc body\"], .ProseMirror");
27640
27645
  if (editor instanceof HTMLElement) editor.focus({ preventScroll: true });
27641
27646
  };
27642
- var OverflowMenu_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
27647
+ //#endregion
27648
+ //#region src/internal/toolbar/built-in/OverflowMenu.vue
27649
+ var OverflowMenu_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
27643
27650
  __name: "OverflowMenu",
27644
27651
  props: {
27645
27652
  toolbarItem: {
@@ -27735,7 +27742,7 @@ var OverflowMenu_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
27735
27742
  ]);
27736
27743
  };
27737
27744
  }
27738
- }, [["__scopeId", "data-v-1227fcf9"]]);
27745
+ }), [["__scopeId", "data-v-d2e189fd"]]);
27739
27746
  //#endregion
27740
27747
  //#region src/internal/toolbar/built-in/font-typeahead.js
27741
27748
  /**
@@ -28361,10 +28368,10 @@ var ToolbarComboBox_default = /* @__PURE__ */ _plugin_vue_export_helper_default(
28361
28368
  ], 14, _hoisted_1$12);
28362
28369
  };
28363
28370
  }
28364
- }), [["__scopeId", "data-v-e9143b7e"]]);
28371
+ }), [["__scopeId", "data-v-a400064a"]]);
28365
28372
  //#endregion
28366
28373
  //#region src/internal/toolbar/built-in/FontFamilyCombobox.vue
28367
- var _sfc_main$11 = {
28374
+ var FontFamilyCombobox_default = /* @__PURE__ */ defineComponent({
28368
28375
  __name: "FontFamilyCombobox",
28369
28376
  props: {
28370
28377
  item: {
@@ -28402,10 +28409,10 @@ var _sfc_main$11 = {
28402
28409
  ]);
28403
28410
  };
28404
28411
  }
28405
- };
28412
+ });
28406
28413
  //#endregion
28407
28414
  //#region src/internal/toolbar/built-in/FontSizeCombobox.vue
28408
- var _sfc_main$10 = {
28415
+ var FontSizeCombobox_default = /* @__PURE__ */ defineComponent({
28409
28416
  __name: "FontSizeCombobox",
28410
28417
  props: {
28411
28418
  item: {
@@ -28443,7 +28450,7 @@ var _sfc_main$10 = {
28443
28450
  ]);
28444
28451
  };
28445
28452
  }
28446
- };
28453
+ });
28447
28454
  //#endregion
28448
28455
  //#region src/internal/toolbar/built-in/SdTooltip.vue?vue&type=script&setup=true&lang.ts
28449
28456
  var AUTO_HIDE_DELAY = 2500;
@@ -28666,7 +28673,7 @@ var SdTooltip_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__
28666
28673
  }
28667
28674
  }), [["__scopeId", "data-v-dfd6f1d1"]]);
28668
28675
  //#endregion
28669
- //#region src/internal/toolbar/built-in/ButtonGroup.vue
28676
+ //#region src/internal/toolbar/built-in/ButtonGroup.vue?vue&type=script&setup=true&lang.ts
28670
28677
  var _hoisted_1$11 = [
28671
28678
  "onKeydown",
28672
28679
  "tabindex",
@@ -28677,7 +28684,9 @@ var _hoisted_3$7 = { key: 0 };
28677
28684
  var _hoisted_4$5 = { key: 0 };
28678
28685
  var _hoisted_5$3 = { key: 0 };
28679
28686
  var _hoisted_6$2 = { key: 0 };
28680
- var ButtonGroup_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
28687
+ //#endregion
28688
+ //#region src/internal/toolbar/built-in/ButtonGroup.vue
28689
+ var ButtonGroup_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
28681
28690
  __name: "ButtonGroup",
28682
28691
  props: {
28683
28692
  toolbarItems: {
@@ -28718,7 +28727,7 @@ var ButtonGroup_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
28718
28727
  ],
28719
28728
  setup(__props, { emit: __emit }) {
28720
28729
  const emit = __emit;
28721
- const { proxy } = getCurrentInstance();
28730
+ const proxy = getCurrentInstance()?.proxy;
28722
28731
  const toolbarItemRefs = ref([]);
28723
28732
  const buttonGroupRef = ref(null);
28724
28733
  const props = __props;
@@ -28901,37 +28910,35 @@ var ButtonGroup_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
28901
28910
  "aria-label": `${item.attributes.value.ariaLabel} - ${option.label}`
28902
28911
  };
28903
28912
  };
28904
- const moveToNextButton = (e) => {
28905
- const currentButton = e.target;
28906
- const nextButton = e.target.closest(".sd-toolbar-item-ctn").nextElementSibling;
28907
- if (nextButton) {
28908
- currentButton.setAttribute("tabindex", "-1");
28913
+ const moveToNextButton = (target) => {
28914
+ const nextButton = target.closest(".sd-toolbar-item-ctn")?.nextElementSibling;
28915
+ if (nextButton instanceof HTMLElement) {
28916
+ target.setAttribute("tabindex", "-1");
28909
28917
  nextButton.setAttribute("tabindex", "0");
28910
28918
  nextButton.focus();
28911
28919
  }
28912
28920
  };
28913
- const moveToPreviousButton = (e) => {
28914
- const currentButton = e.target;
28915
- const previousButton = e.target.closest(".sd-toolbar-item-ctn").previousElementSibling;
28916
- if (previousButton) {
28917
- currentButton.setAttribute("tabindex", "-1");
28921
+ const moveToPreviousButton = (target) => {
28922
+ const previousButton = target.closest(".sd-toolbar-item-ctn")?.previousElementSibling;
28923
+ if (previousButton instanceof HTMLElement) {
28924
+ target.setAttribute("tabindex", "-1");
28918
28925
  previousButton.setAttribute("tabindex", "0");
28919
28926
  previousButton.focus();
28920
28927
  }
28921
28928
  };
28922
- const moveToNextButtonGroup = (e) => {
28923
- const nextButtonGroup = e.target.closest(".button-group").nextElementSibling;
28924
- if (nextButtonGroup) {
28929
+ const moveToNextButtonGroup = (target) => {
28930
+ const nextButtonGroup = target.closest(".button-group")?.nextElementSibling;
28931
+ if (nextButtonGroup instanceof HTMLElement) {
28925
28932
  nextButtonGroup.setAttribute("tabindex", "0");
28926
28933
  nextButtonGroup.focus();
28927
28934
  } else {
28928
28935
  const editor = document.querySelector(".ProseMirror");
28929
- if (editor) editor.focus();
28936
+ if (editor instanceof HTMLElement) editor.focus();
28930
28937
  }
28931
28938
  };
28932
- const moveToPreviousButtonGroup = (e) => {
28933
- const previousButtonGroup = e.target.closest(".button-group").previousElementSibling;
28934
- if (previousButtonGroup) {
28939
+ const moveToPreviousButtonGroup = (target) => {
28940
+ const previousButtonGroup = target.closest(".button-group")?.previousElementSibling;
28941
+ if (previousButtonGroup instanceof HTMLElement) {
28935
28942
  previousButtonGroup.setAttribute("tabindex", "0");
28936
28943
  previousButtonGroup.focus();
28937
28944
  }
@@ -28945,7 +28952,9 @@ var ButtonGroup_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
28945
28952
  handleToolbarButtonClick(item);
28946
28953
  };
28947
28954
  const handleKeyDown = (e, item) => {
28948
- const isTypingField = e.target.nodeName === "INPUT" || e.target.nodeName === "TEXTAREA";
28955
+ const target = e.target;
28956
+ if (!(target instanceof Element)) return;
28957
+ const isTypingField = target.nodeName === "INPUT" || target.nodeName === "TEXTAREA";
28949
28958
  const isTypingToolbarItem = item.name.value === "fontSize" || item.name.value === "fontFamily";
28950
28959
  if (isTypingField && isTypingToolbarItem) return;
28951
28960
  if (![
@@ -28969,20 +28978,20 @@ var ButtonGroup_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
28969
28978
  break;
28970
28979
  case "ArrowRight":
28971
28980
  closeDropdowns();
28972
- moveToNextButton(e);
28981
+ moveToNextButton(target);
28973
28982
  break;
28974
28983
  case "ArrowLeft":
28975
28984
  closeDropdowns();
28976
- moveToPreviousButton(e);
28985
+ moveToPreviousButton(target);
28977
28986
  break;
28978
28987
  case "Tab":
28979
- if (e.shiftKey) moveToPreviousButtonGroup(e);
28980
- else moveToNextButtonGroup(e);
28988
+ if (e.shiftKey) moveToPreviousButtonGroup(target);
28989
+ else moveToNextButtonGroup(target);
28981
28990
  break;
28982
28991
  default: break;
28983
28992
  }
28984
28993
  };
28985
- const handleFocus = (e) => {
28994
+ const handleFocus = () => {
28986
28995
  const firstButton = toolbarItemRefs.value.find((item) => !item.classList.contains("sd-disabled"));
28987
28996
  if (firstButton) {
28988
28997
  firstButton.setAttribute("tabindex", "0");
@@ -29052,7 +29061,7 @@ var ButtonGroup_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
29052
29061
  disabled: !item.tooltip?.value,
29053
29062
  "content-style": { fontFamily: props.uiFontFamily }
29054
29063
  }, {
29055
- trigger: withCtx(() => [createVNode(_sfc_main$11, {
29064
+ trigger: withCtx(() => [createVNode(FontFamilyCombobox_default, {
29056
29065
  item,
29057
29066
  "ui-font-family": props.uiFontFamily,
29058
29067
  class: "sd-toolbar-button sd-editor-toolbar-dropdown",
@@ -29069,7 +29078,7 @@ var ButtonGroup_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
29069
29078
  disabled: !item.tooltip?.value,
29070
29079
  "content-style": { fontFamily: props.uiFontFamily }
29071
29080
  }, {
29072
- trigger: withCtx(() => [createVNode(_sfc_main$10, {
29081
+ trigger: withCtx(() => [createVNode(FontSizeCombobox_default, {
29073
29082
  item,
29074
29083
  "ui-font-family": props.uiFontFamily,
29075
29084
  class: "sd-toolbar-button sd-editor-toolbar-dropdown",
@@ -29167,7 +29176,7 @@ var ButtonGroup_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
29167
29176
  }), 128))], 36);
29168
29177
  };
29169
29178
  }
29170
- }, [["__scopeId", "data-v-fb216897"]]);
29179
+ }), [["__scopeId", "data-v-21333fed"]]);
29171
29180
  var TOOLBAR_FONTS = [
29172
29181
  ["Arial", "sans-serif"],
29173
29182
  ["Arial Black", "sans-serif"],
@@ -29687,14 +29696,16 @@ var useToolbarItem = (options) => {
29687
29696
  };
29688
29697
  };
29689
29698
  //#endregion
29690
- //#region src/internal/toolbar/built-in/AlignmentButtons.vue
29699
+ //#region src/internal/toolbar/built-in/AlignmentButtons.vue?vue&type=script&setup=true&lang.ts
29691
29700
  var _hoisted_1$9 = [
29692
29701
  "onClick",
29693
29702
  "innerHTML",
29694
29703
  "aria-label",
29695
29704
  "onKeydown"
29696
29705
  ];
29697
- var AlignmentButtons_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
29706
+ //#endregion
29707
+ //#region src/internal/toolbar/built-in/AlignmentButtons.vue
29708
+ var AlignmentButtons_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
29698
29709
  __name: "AlignmentButtons",
29699
29710
  emits: ["select"],
29700
29711
  setup(__props, { emit: __emit }) {
@@ -29781,16 +29792,18 @@ var AlignmentButtons_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
29781
29792
  }), 64))], 2);
29782
29793
  };
29783
29794
  }
29784
- }, [["__scopeId", "data-v-13e5f7a4"]]);
29795
+ }), [["__scopeId", "data-v-7ddf6e50"]]);
29785
29796
  //#endregion
29786
- //#region src/internal/toolbar/built-in/StyleButtonsList.vue
29797
+ //#region src/internal/toolbar/built-in/StyleButtonsList.vue?vue&type=script&setup=true&lang.ts
29787
29798
  var _hoisted_1$8 = [
29788
29799
  "onClick",
29789
29800
  "innerHTML",
29790
29801
  "aria-label",
29791
29802
  "onKeydown"
29792
29803
  ];
29793
- var StyleButtonsList_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
29804
+ //#endregion
29805
+ //#region src/internal/toolbar/built-in/StyleButtonsList.vue
29806
+ var StyleButtonsList_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
29794
29807
  __name: "StyleButtonsList",
29795
29808
  props: {
29796
29809
  buttons: {
@@ -29874,7 +29887,7 @@ var StyleButtonsList_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
29874
29887
  }), 128))], 2);
29875
29888
  };
29876
29889
  }
29877
- }, [["__scopeId", "data-v-44f37ff6"]]);
29890
+ }), [["__scopeId", "data-v-539d0995"]]);
29878
29891
  //#endregion
29879
29892
  //#region src/internal/toolbar/built-in/list-style-buttons.js
29880
29893
  var bulletStyleButtons = [
@@ -29937,14 +29950,16 @@ var numberedStyleButtons = [
29937
29950
  }
29938
29951
  ];
29939
29952
  //#endregion
29940
- //#region src/internal/toolbar/built-in/DocumentMode.vue
29953
+ //#region src/internal/toolbar/built-in/DocumentMode.vue?vue&type=script&setup=true&lang.ts
29941
29954
  var _hoisted_1$7 = ["onClick", "onKeydown"];
29942
29955
  var _hoisted_2$7 = { class: "document-mode-column icon-column" };
29943
29956
  var _hoisted_3$6 = ["innerHTML"];
29944
29957
  var _hoisted_4$4 = { class: "document-mode-column text-column" };
29945
29958
  var _hoisted_5$2 = { class: "document-mode-type" };
29946
29959
  var _hoisted_6$1 = { class: "document-mode-description" };
29947
- var DocumentMode_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
29960
+ //#endregion
29961
+ //#region src/internal/toolbar/built-in/DocumentMode.vue
29962
+ var DocumentMode_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
29948
29963
  __name: "DocumentMode",
29949
29964
  props: { options: { type: Array } },
29950
29965
  emits: ["select"],
@@ -29980,9 +29995,11 @@ var DocumentMode_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
29980
29995
  case "ArrowUp":
29981
29996
  moveToPreviousOption(index);
29982
29997
  break;
29983
- case "Enter":
29984
- handleClick(props.options[index]);
29998
+ case "Enter": {
29999
+ const option = props.options?.[index];
30000
+ if (option) handleClick(option);
29985
30001
  break;
30002
+ }
29986
30003
  default: break;
29987
30004
  }
29988
30005
  };
@@ -30008,7 +30025,7 @@ var DocumentMode_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
30008
30025
  }), 256))], 2);
30009
30026
  };
30010
30027
  }
30011
- }, [["__scopeId", "data-v-bee14d7a"]]);
30028
+ }), [["__scopeId", "data-v-a20b9574"]]);
30012
30029
  //#endregion
30013
30030
  //#region src/internal/toolbar/built-in/LinkedStyle.vue?vue&type=script&setup=true&lang.ts
30014
30031
  var _hoisted_1$6 = {
@@ -30131,7 +30148,7 @@ var LinkedStyle_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @
30131
30148
  }
30132
30149
  }), [["__scopeId", "data-v-4e36f956"]]);
30133
30150
  //#endregion
30134
- //#region src/internal/toolbar/built-in/AIWriter.vue
30151
+ //#region src/internal/toolbar/built-in/AIWriter.vue?vue&type=script&setup=true&lang.ts
30135
30152
  var _hoisted_1$5 = ["placeholder"];
30136
30153
  var _hoisted_2$5 = { class: "sd-ai-writer__footer" };
30137
30154
  var _hoisted_3$4 = {
@@ -30142,7 +30159,9 @@ var _hoisted_3$4 = {
30142
30159
  var _hoisted_4$2 = ["disabled"];
30143
30160
  var DEFAULT_AI_ENDPOINT = "https://sd-dev-express-gateway-i6xtm.ondigitalocean.app/insights";
30144
30161
  var SYSTEM_PROMPT = "You are an expert copywriter and you are immersed in a document editor. Only write what is asked for.";
30145
- var AIWriter_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
30162
+ //#endregion
30163
+ //#region src/internal/toolbar/built-in/AIWriter.vue
30164
+ var AIWriter_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
30146
30165
  __name: "AIWriter",
30147
30166
  props: {
30148
30167
  selectedText: {
@@ -30189,13 +30208,13 @@ var AIWriter_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
30189
30208
  });
30190
30209
  function extractGeneratedText(payload) {
30191
30210
  if (typeof payload === "string") return payload;
30192
- if (!payload || typeof payload !== "object") return "";
30211
+ if (!isPlainObject$1(payload)) return "";
30193
30212
  const customPrompt = payload.custom_prompt;
30194
30213
  if (Array.isArray(customPrompt)) {
30195
30214
  const first = customPrompt[0];
30196
- if (first && typeof first.value === "string") return first.value;
30215
+ if (isPlainObject$1(first) && typeof first.value === "string") return first.value;
30197
30216
  }
30198
- if (customPrompt && typeof customPrompt === "object" && typeof customPrompt.value === "string") return customPrompt.value;
30217
+ if (isPlainObject$1(customPrompt) && typeof customPrompt.value === "string") return customPrompt.value;
30199
30218
  if (typeof payload.value === "string") return payload.value;
30200
30219
  if (typeof payload.text === "string") return payload.text;
30201
30220
  return "";
@@ -30229,7 +30248,7 @@ var AIWriter_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
30229
30248
  }
30230
30249
  function receiptSucceeded(receipt) {
30231
30250
  if (!receipt || typeof receipt !== "object") return true;
30232
- if (receipt.success === false || receipt.ok === false) return false;
30251
+ if ("success" in receipt && receipt.success === false || "ok" in receipt && receipt.ok === false) return false;
30233
30252
  return true;
30234
30253
  }
30235
30254
  function insertGeneratedText(text) {
@@ -30299,9 +30318,9 @@ var AIWriter_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
30299
30318
  }, toDisplayString(isLoading.value ? "Generating" : "Generate"), 9, _hoisted_4$2)])], 32);
30300
30319
  };
30301
30320
  }
30302
- }, [["__scopeId", "data-v-67f6c6f7"]]);
30321
+ }), [["__scopeId", "data-v-3951e804"]]);
30303
30322
  //#endregion
30304
- //#region src/internal/toolbar/built-in/IconGridRow.vue
30323
+ //#region src/internal/toolbar/built-in/IconGridRow.vue?vue&type=script&setup=true&lang.ts
30305
30324
  var _hoisted_1$4 = [
30306
30325
  "aria-label",
30307
30326
  "onClick",
@@ -30310,7 +30329,9 @@ var _hoisted_1$4 = [
30310
30329
  var _hoisted_2$4 = ["innerHTML"];
30311
30330
  var _hoisted_3$3 = ["innerHTML"];
30312
30331
  var ROW_SIZE$1 = 7;
30313
- var IconGridRow_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
30332
+ //#endregion
30333
+ //#region src/internal/toolbar/built-in/IconGridRow.vue
30334
+ var IconGridRow_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
30314
30335
  __name: "IconGridRow",
30315
30336
  props: {
30316
30337
  icons: {
@@ -30327,8 +30348,9 @@ var IconGridRow_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
30327
30348
  const emit = __emit;
30328
30349
  const props = __props;
30329
30350
  const isActive = computed$1(() => (option) => {
30330
- if (!props.activeColor.value) return false;
30331
- return props.activeColor.value.toUpperCase() === option.value;
30351
+ const activeColor = props.activeColor?.value;
30352
+ if (!activeColor) return false;
30353
+ return activeColor.toUpperCase() === option.value;
30332
30354
  });
30333
30355
  const getCheckStyle = (color, optionIndex) => {
30334
30356
  if (optionIndex === 5 || ["#FFFFFF", "#FAFF09"].includes(color)) return { color: "#000" };
@@ -30436,16 +30458,18 @@ var IconGridRow_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
30436
30458
  }), 128);
30437
30459
  };
30438
30460
  }
30439
- }, [["__scopeId", "data-v-05eb02fc"]]);
30461
+ }), [["__scopeId", "data-v-b1771c36"]]);
30440
30462
  //#endregion
30441
30463
  //#region ../../shared/common/icons/droplet-slash.svg?raw
30442
30464
  var droplet_slash_default = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 640 512\"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d=\"M320 512c53.2 0 101.4-21.6 136.1-56.6l-298.3-235C140 257.1 128 292.3 128 320c0 106 86 192 192 192zM505.2 370.7c4.4-16.2 6.8-33.1 6.8-50.7c0-91.2-130.2-262.3-166.6-308.3C339.4 4.2 330.5 0 320.9 0l-1.8 0c-9.6 0-18.5 4.2-24.5 11.7C277.8 33 240.7 81.3 205.8 136L38.8 5.1C28.4-3.1 13.3-1.2 5.1 9.2S-1.2 34.7 9.2 42.9l592 464c10.4 8.2 25.5 6.3 33.7-4.1s6.3-25.5-4.1-33.7L505.2 370.7zM224 336c0 44.2 35.8 80 80 80c8.8 0 16 7.2 16 16s-7.2 16-16 16c-61.9 0-112-50.1-112-112c0-8.8 7.2-16 16-16s16 7.2 16 16z\"/></svg>\n";
30443
30465
  //#endregion
30444
- //#region src/internal/toolbar/built-in/IconGrid.vue
30466
+ //#region src/internal/toolbar/built-in/IconGrid.vue?vue&type=script&setup=true&lang.ts
30445
30467
  var _hoisted_1$3 = { class: "options-grid-wrap" };
30446
30468
  var _hoisted_2$3 = ["innerHTML"];
30447
30469
  var _hoisted_3$2 = { class: "option-grid-ctn" };
30448
- var IconGrid_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
30470
+ //#endregion
30471
+ //#region src/internal/toolbar/built-in/IconGrid.vue
30472
+ var IconGrid_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
30449
30473
  __name: "IconGrid",
30450
30474
  props: {
30451
30475
  icons: {
@@ -30485,14 +30509,14 @@ var IconGrid_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
30485
30509
  icons: __props.icons,
30486
30510
  "active-color": __props.activeColor,
30487
30511
  onSelect: handleSelect
30488
- }, null, 8, ["icons", "active-color"]), __props.customIcons.flat().length ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [_cache[2] || (_cache[2] = createElementVNode("span", { class: "option-grid-ctn__subtitle" }, "Custom colors", -1)), createVNode(IconGridRow_default, {
30512
+ }, null, 8, ["icons", "active-color"]), __props.customIcons?.flat().length ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [_cache[2] || (_cache[2] = createElementVNode("span", { class: "option-grid-ctn__subtitle" }, "Custom colors", -1)), createVNode(IconGridRow_default, {
30489
30513
  icons: __props.customIcons,
30490
30514
  "active-color": __props.activeColor,
30491
30515
  onSelect: handleSelect
30492
30516
  }, null, 8, ["icons", "active-color"])], 64)) : createCommentVNode("", true)])]);
30493
30517
  };
30494
30518
  }
30495
- }, [["__scopeId", "data-v-52b0283a"]]);
30519
+ }), [["__scopeId", "data-v-03719472"]]);
30496
30520
  //#endregion
30497
30521
  //#region src/internal/toolbar/built-in/color-dropdown-helpers.js
30498
30522
  var closeDropdown$1 = (dropdown) => {
@@ -30603,7 +30627,7 @@ var icons = [
30603
30627
  ]
30604
30628
  ];
30605
30629
  //#endregion
30606
- //#region src/internal/toolbar/built-in/TableGrid.vue
30630
+ //#region src/internal/toolbar/built-in/TableGrid.vue?vue&type=script&setup=true&lang.ts
30607
30631
  var _hoisted_1$2 = [
30608
30632
  "data-cols",
30609
30633
  "data-rows",
@@ -30612,7 +30636,9 @@ var _hoisted_1$2 = [
30612
30636
  ];
30613
30637
  var _hoisted_2$2 = ["aria-valuetext"];
30614
30638
  var ROW_SIZE = 5;
30615
- var TableGrid_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
30639
+ //#endregion
30640
+ //#region src/internal/toolbar/built-in/TableGrid.vue
30641
+ var TableGrid_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
30616
30642
  __name: "TableGrid",
30617
30643
  emits: ["select", "clickoutside"],
30618
30644
  setup(__props, { emit: __emit }) {
@@ -30623,10 +30649,13 @@ var TableGrid_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
30623
30649
  const tableGridItems = ref([]);
30624
30650
  const onTableGridMouseOver = (event) => {
30625
30651
  let target = event.target;
30652
+ if (!(target instanceof HTMLElement)) return;
30626
30653
  if (!!target.dataset.grid) return;
30627
- let allItems = [...target.parentElement.querySelectorAll("[data-item]")];
30628
- let cols = parseInt(target.dataset.cols, 10);
30629
- let rows = parseInt(target.dataset.rows, 10);
30654
+ let grid = target.parentElement;
30655
+ if (!grid) return;
30656
+ let allItems = Array.from(grid.querySelectorAll("[data-item]"));
30657
+ let cols = parseInt(target.dataset.cols ?? "", 10);
30658
+ let rows = parseInt(target.dataset.rows ?? "", 10);
30630
30659
  selectGridItems(allItems, cols, rows);
30631
30660
  };
30632
30661
  const selectGridItems = (allItems, cols, rows) => {
@@ -30634,8 +30663,8 @@ var TableGrid_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
30634
30663
  selectedRows.value = rows;
30635
30664
  for (let i = 0; i < allItems.length; i++) {
30636
30665
  let item = allItems[i];
30637
- let itemsCols = parseInt(item.dataset.cols, 10);
30638
- let itemsRows = parseInt(item.dataset.rows, 10);
30666
+ let itemsCols = parseInt(item.dataset.cols ?? "", 10);
30667
+ let itemsRows = parseInt(item.dataset.rows ?? "", 10);
30639
30668
  if (itemsCols <= cols && itemsRows <= rows) item.classList.add("sd-selected");
30640
30669
  else item.classList.remove("sd-selected");
30641
30670
  }
@@ -30725,9 +30754,9 @@ var TableGrid_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
30725
30754
  }, toDisplayString(selectedRows.value) + " x " + toDisplayString(selectedCols.value), 9, _hoisted_2$2)], 2);
30726
30755
  };
30727
30756
  }
30728
- }, [["__scopeId", "data-v-b87d6ca2"]]);
30757
+ }), [["__scopeId", "data-v-38daa3ad"]]);
30729
30758
  //#endregion
30730
- //#region src/internal/toolbar/built-in/TableActions.vue
30759
+ //#region src/internal/toolbar/built-in/TableActions.vue?vue&type=script&setup=true&lang.ts
30731
30760
  var _hoisted_1$1 = { class: "toolbar-table-actions" };
30732
30761
  var _hoisted_2$1 = [
30733
30762
  "aria-disabled",
@@ -30738,7 +30767,9 @@ var _hoisted_2$1 = [
30738
30767
  var _hoisted_3$1 = { class: "toolbar-table-actions__icon" };
30739
30768
  var _hoisted_4$1 = ["innerHTML"];
30740
30769
  var _hoisted_5$1 = { class: "toolbar-table-actions__label" };
30741
- var TableActions_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
30770
+ //#endregion
30771
+ //#region src/internal/toolbar/built-in/TableActions.vue
30772
+ var TableActions_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
30742
30773
  __name: "TableActions",
30743
30774
  props: { options: { type: Array } },
30744
30775
  emits: ["select"],
@@ -30767,7 +30798,7 @@ var TableActions_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
30767
30798
  }), 256))]);
30768
30799
  };
30769
30800
  }
30770
- }, [["__scopeId", "data-v-72123aae"]]);
30801
+ }), [["__scopeId", "data-v-76ed2dc1"]]);
30771
30802
  //#endregion
30772
30803
  //#region src/internal/toolbar/built-in/PageNumberMenu.vue?vue&type=script&setup=true&lang.ts
30773
30804
  var _hoisted_1 = ["aria-busy"];
@@ -33756,6 +33787,15 @@ function getActiveFontRuntime(editor) {
33756
33787
  *
33757
33788
  * @class
33758
33789
  */
33790
+ function runtimeUserOf(user) {
33791
+ const text = (value) => typeof value === "string" && value ? value : void 0;
33792
+ return {
33793
+ name: text(user.name) ?? "",
33794
+ ...text(user.id) ? { id: text(user.id) } : {},
33795
+ ...text(user.email) ? { email: text(user.email) } : {},
33796
+ ...text(user.initials) ? { initials: text(user.initials) } : {}
33797
+ };
33798
+ }
33759
33799
  var SuperDoc = class extends import_eventemitter3.default {
33760
33800
  static {
33761
33801
  this.allowedTypes = [DOCX, PDF];
@@ -33986,6 +34026,7 @@ var SuperDoc = class extends import_eventemitter3.default {
33986
34026
  viewOptions: { layout: "print" },
33987
34027
  useLayoutEngine: true
33988
34028
  };
34029
+ this.#userSwitch = Promise.resolve();
33989
34030
  this.#fontsRelayEditors = /* @__PURE__ */ new WeakSet();
33990
34031
  this.#warnedMissingFonts = /* @__PURE__ */ new WeakMap();
33991
34032
  this.#lastFontsChangedPayload = null;
@@ -34082,7 +34123,7 @@ var SuperDoc = class extends import_eventemitter3.default {
34082
34123
  }
34083
34124
  this.userColorMap = /* @__PURE__ */ new Map();
34084
34125
  this.colorIndex = 0;
34085
- this.version = "2.29.0-next.2";
34126
+ this.version = "2.29.0-next.3";
34086
34127
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
34087
34128
  this.superdocId = config.superdocId || v4();
34088
34129
  this.colors = this.config.colors ?? [];
@@ -34937,6 +34978,46 @@ var SuperDoc = class extends import_eventemitter3.default {
34937
34978
  if (!editor) throw new Error("SuperDoc: source editor not yet created — wait for the ready event before upgrading");
34938
34979
  return editor;
34939
34980
  }
34981
+ setUser(user) {
34982
+ this.#requireReady("setUser");
34983
+ const name = typeof user?.name === "string" ? user.name.trim() : "";
34984
+ if (!name) return Promise.reject(/* @__PURE__ */ new TypeError("SuperDoc.setUser requires a non-empty user name."));
34985
+ const next = normalizeSuperDocUser({
34986
+ ...user,
34987
+ name
34988
+ });
34989
+ const applied = this.#userSwitch.then(() => this.#applyUser(next));
34990
+ this.#userSwitch = applied.catch(() => {});
34991
+ return applied;
34992
+ }
34993
+ #userSwitch;
34994
+ async #applyUser(next) {
34995
+ const current = this.config.user;
34996
+ if (current && [
34997
+ "id",
34998
+ "name",
34999
+ "email",
35000
+ "image",
35001
+ "initials"
35002
+ ].every((key) => (current[key] ?? null) === (next[key] ?? null))) return;
35003
+ const runtimes = this.#editorRuntimeRegistry.getAll();
35004
+ const results = await Promise.allSettled(runtimes.map((runtime) => runtime.setUser?.(runtimeUserOf(next))));
35005
+ const failure = results.find((result) => result.status === "rejected");
35006
+ if (failure) {
35007
+ if (current) await Promise.allSettled(runtimes.filter((_, index) => results[index].status === "fulfilled").map((runtime) => runtime.setUser?.(runtimeUserOf(current))));
35008
+ throw failure.reason;
35009
+ }
35010
+ const target = this.config.user ?? (this.config.user = {});
35011
+ for (const key of Object.keys(target)) delete target[key];
35012
+ Object.assign(target, next);
35013
+ this.user = target;
35014
+ this.#assignUserColor();
35015
+ const storeUser = this.superdocStore?.user;
35016
+ if (storeUser) {
35017
+ for (const key of Object.keys(storeUser)) delete storeUser[key];
35018
+ Object.assign(storeUser, target);
35019
+ }
35020
+ }
34940
35021
  /**
34941
35022
  * Add a user to the shared users list. Requires the instance to be
34942
35023
  * ready; pre-ready mutations would be silently overwritten by the