superdoc 0.29.0-RC.2 → 0.29.0-RC.4

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 (36) hide show
  1. package/dist/chunks/{PdfViewer-CH7xPqiQ.es.js → PdfViewer-CYtVMRB4.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-Dlcx3g-l.cjs → PdfViewer-DYWsxwtD.cjs} +1 -1
  3. package/dist/chunks/{editor-EfXZ6xB6-VJn78MZE.es.js → editor-CBEFneyM-B-I0P4KA.es.js} +77 -27
  4. package/dist/chunks/{editor-EfXZ6xB6-Ckfqr3sG.cjs → editor-CBEFneyM-BO6OoPuF.cjs} +77 -27
  5. package/dist/chunks/{index-FikaCO2P.cjs → index-BvMxNDXY.cjs} +21 -20
  6. package/dist/chunks/{index-BTT4BNXs.es.js → index-CcpywD-2.es.js} +7 -6
  7. package/dist/chunks/uuid-CjlX8hrF.es.js +35 -0
  8. package/dist/chunks/uuid-R7L08bOx.cjs +34 -0
  9. package/dist/images/altText_disclaimer.svg +3 -0
  10. package/dist/images/altText_spinner.svg +30 -0
  11. package/dist/images/altText_warning.svg +3 -0
  12. package/dist/images/messageBar_closingButton.svg +3 -0
  13. package/dist/images/messageBar_warning.svg +3 -0
  14. package/dist/super-editor/ai-writer.es.js +2 -2
  15. package/dist/super-editor/chunks/{converter-BK9AD8UY.js → converter-BKIv2WSE.js} +75 -26
  16. package/dist/super-editor/chunks/{docx-zipper-QhU8I-YW.js → docx-zipper-BCqR6F8B.js} +1 -1
  17. package/dist/super-editor/chunks/{editor-EfXZ6xB6.js → editor-CBEFneyM.js} +5 -5
  18. package/dist/super-editor/chunks/{super-input-DWpAmOmi.js → super-input-CQ5Tl3ML.js} +3 -3
  19. package/dist/super-editor/converter.es.js +1 -1
  20. package/dist/super-editor/docx-zipper.es.js +2 -2
  21. package/dist/super-editor/editor.es.js +3 -3
  22. package/dist/super-editor/file-zipper.es.js +1 -1
  23. package/dist/super-editor/super-editor/src/components/toolbar/use-toolbar-item.d.ts +1 -1
  24. package/dist/super-editor/super-editor/src/core/super-converter/exporter.d.ts +6 -0
  25. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/translate-structured-content.d.ts +2 -2
  26. package/dist/super-editor/super-editor.es.js +4 -4
  27. package/dist/super-editor/toolbar.es.js +1 -1
  28. package/dist/super-editor.cjs +26 -26
  29. package/dist/super-editor.es.js +1 -1
  30. package/dist/superdoc.cjs +13 -13
  31. package/dist/superdoc.es.js +2 -2
  32. package/dist/superdoc.umd.js +100 -53
  33. package/dist/superdoc.umd.js.map +1 -1
  34. package/package.json +1 -1
  35. package/dist/chunks/uuid-CQzaMNgL.cjs +0 -36
  36. package/dist/chunks/uuid-DIIKH5Zc.es.js +0 -37
@@ -1,5 +1,5 @@
1
1
  import { H as defineComponent, N as h, V as Transition, $ as process$1, S as watchEffect, e as computed, r as ref, b as onMounted, d as onUnmounted, c as createElementBlock, o as openBlock, a as createBaseVNode, f as createCommentVNode, l as createVNode, u as unref } from "./vue-DSlPeKKC.es.js";
2
- import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-BTT4BNXs.es.js";
2
+ import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-CcpywD-2.es.js";
3
3
  function self(vars) {
4
4
  const {
5
5
  opacityDisabled,
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const vue = require("./vue-DKMj1I9B.cjs");
4
- const superdoc = require("./index-FikaCO2P.cjs");
4
+ const superdoc = require("./index-BvMxNDXY.cjs");
5
5
  function self(vars) {
6
6
  const {
7
7
  opacityDisabled,
@@ -7492,6 +7492,7 @@ function require_stream_duplex() {
7492
7492
  }
7493
7493
  var string_decoder = {};
7494
7494
  var safeBuffer = { exports: {} };
7495
+ /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
7495
7496
  var hasRequiredSafeBuffer;
7496
7497
  function requireSafeBuffer() {
7497
7498
  if (hasRequiredSafeBuffer) return safeBuffer.exports;
@@ -7513,6 +7514,7 @@ function requireSafeBuffer() {
7513
7514
  function SafeBuffer(arg, encodingOrOffset, length2) {
7514
7515
  return Buffer3(arg, encodingOrOffset, length2);
7515
7516
  }
7517
+ SafeBuffer.prototype = Object.create(Buffer3.prototype);
7516
7518
  copyProps(Buffer3, SafeBuffer);
7517
7519
  SafeBuffer.from = function(arg, encodingOrOffset, length2) {
7518
7520
  if (typeof arg === "number") {
@@ -11330,39 +11332,37 @@ function requireLib() {
11330
11332
  }
11331
11333
  var libExports = requireLib();
11332
11334
  const xmljs = /* @__PURE__ */ getDefaultExportFromCjs$2(libExports);
11333
- var getRandomValues;
11334
- var rnds8 = new Uint8Array(16);
11335
+ let getRandomValues;
11336
+ const rnds8 = new Uint8Array(16);
11335
11337
  function rng() {
11336
11338
  if (!getRandomValues) {
11337
- getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== "undefined" && typeof msCrypto.getRandomValues === "function" && msCrypto.getRandomValues.bind(msCrypto);
11339
+ getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
11338
11340
  if (!getRandomValues) {
11339
11341
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
11340
11342
  }
11341
11343
  }
11342
11344
  return getRandomValues(rnds8);
11343
11345
  }
11344
- const REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
11345
- function validate(uuid) {
11346
- return typeof uuid === "string" && REGEX.test(uuid);
11346
+ const byteToHex = [];
11347
+ for (let i = 0; i < 256; ++i) {
11348
+ byteToHex.push((i + 256).toString(16).slice(1));
11347
11349
  }
11348
- var byteToHex = [];
11349
- for (var i$2 = 0; i$2 < 256; ++i$2) {
11350
- byteToHex.push((i$2 + 256).toString(16).substr(1));
11351
- }
11352
- function stringify(arr) {
11353
- var offset2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
11354
- var uuid = (byteToHex[arr[offset2 + 0]] + byteToHex[arr[offset2 + 1]] + byteToHex[arr[offset2 + 2]] + byteToHex[arr[offset2 + 3]] + "-" + byteToHex[arr[offset2 + 4]] + byteToHex[arr[offset2 + 5]] + "-" + byteToHex[arr[offset2 + 6]] + byteToHex[arr[offset2 + 7]] + "-" + byteToHex[arr[offset2 + 8]] + byteToHex[arr[offset2 + 9]] + "-" + byteToHex[arr[offset2 + 10]] + byteToHex[arr[offset2 + 11]] + byteToHex[arr[offset2 + 12]] + byteToHex[arr[offset2 + 13]] + byteToHex[arr[offset2 + 14]] + byteToHex[arr[offset2 + 15]]).toLowerCase();
11355
- if (!validate(uuid)) {
11356
- throw TypeError("Stringified UUID is invalid");
11357
- }
11358
- return uuid;
11350
+ function unsafeStringify(arr, offset2 = 0) {
11351
+ return byteToHex[arr[offset2 + 0]] + byteToHex[arr[offset2 + 1]] + byteToHex[arr[offset2 + 2]] + byteToHex[arr[offset2 + 3]] + "-" + byteToHex[arr[offset2 + 4]] + byteToHex[arr[offset2 + 5]] + "-" + byteToHex[arr[offset2 + 6]] + byteToHex[arr[offset2 + 7]] + "-" + byteToHex[arr[offset2 + 8]] + byteToHex[arr[offset2 + 9]] + "-" + byteToHex[arr[offset2 + 10]] + byteToHex[arr[offset2 + 11]] + byteToHex[arr[offset2 + 12]] + byteToHex[arr[offset2 + 13]] + byteToHex[arr[offset2 + 14]] + byteToHex[arr[offset2 + 15]];
11359
11352
  }
11353
+ const randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
11354
+ const native = {
11355
+ randomUUID
11356
+ };
11360
11357
  function v4(options, buf, offset2) {
11358
+ if (native.randomUUID && true && !options) {
11359
+ return native.randomUUID();
11360
+ }
11361
11361
  options = options || {};
11362
- var rnds = options.random || (options.rng || rng)();
11362
+ const rnds = options.random || (options.rng || rng)();
11363
11363
  rnds[6] = rnds[6] & 15 | 64;
11364
11364
  rnds[8] = rnds[8] & 63 | 128;
11365
- return stringify(rnds);
11365
+ return unsafeStringify(rnds);
11366
11366
  }
11367
11367
  function getDefaultExportFromCjs(x) {
11368
11368
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
@@ -30886,9 +30886,18 @@ function translateDocumentPartObj(params2) {
30886
30886
  return result;
30887
30887
  }
30888
30888
  function translateStructuredContent(params2) {
30889
- const { node } = params2;
30890
- const childContent = translateChildNodes({ ...params2, nodes: node.content });
30891
- const sdtContent = { name: "w:sdtContent", elements: childContent };
30889
+ const { node, isFinalDoc } = params2;
30890
+ const childContent = translateChildNodes({ ...params2, node });
30891
+ const childElements = Array.isArray(childContent) ? childContent : [childContent];
30892
+ if (isFinalDoc) {
30893
+ if (node?.type === "structuredContent") {
30894
+ return convertSdtContentToRuns(childElements);
30895
+ }
30896
+ if (node?.type === "structuredContentBlock") {
30897
+ return childElements.length === 1 ? childElements[0] : childElements;
30898
+ }
30899
+ }
30900
+ const sdtContent = { name: "w:sdtContent", elements: childElements };
30892
30901
  const sdtPr = generateSdtPrTagForStructuredContent({ node });
30893
30902
  const nodeElements = [sdtPr, sdtContent];
30894
30903
  const result = {
@@ -34105,6 +34114,7 @@ const config = {
34105
34114
  attributes: validXmlAttributes
34106
34115
  };
34107
34116
  const translator = NodeTranslator.from(config);
34117
+ const RUN_LEVEL_WRAPPERS = /* @__PURE__ */ new Set(["w:hyperlink", "w:ins", "w:del"]);
34108
34118
  const DEFAULT_SECTION_PROPS_TWIPS = Object.freeze({
34109
34119
  pageSize: Object.freeze({ width: "12240", height: "15840" }),
34110
34120
  pageMargins: Object.freeze({
@@ -34170,6 +34180,45 @@ const isLineBreakOnlyRun = (node) => {
34170
34180
  if (!runContent.length) return false;
34171
34181
  return runContent.every((child) => child?.type === "lineBreak" || child?.type === "hardBreak");
34172
34182
  };
34183
+ function convertSdtContentToRuns(elements) {
34184
+ const normalized = Array.isArray(elements) ? elements : [elements];
34185
+ const runs = [];
34186
+ normalized.forEach((element) => {
34187
+ if (!element) return;
34188
+ if (element.name === "w:sdtPr") {
34189
+ return;
34190
+ }
34191
+ if (element.name === "w:r") {
34192
+ runs.push(element);
34193
+ return;
34194
+ }
34195
+ if (element.name === "w:sdt") {
34196
+ const sdtContent = (element.elements || []).find((child) => child?.name === "w:sdtContent");
34197
+ if (sdtContent?.elements) {
34198
+ runs.push(...convertSdtContentToRuns(sdtContent.elements));
34199
+ }
34200
+ return;
34201
+ }
34202
+ if (RUN_LEVEL_WRAPPERS.has(element.name)) {
34203
+ const wrapperElements = convertSdtContentToRuns(element.elements || []);
34204
+ if (wrapperElements.length) {
34205
+ runs.push({
34206
+ ...element,
34207
+ elements: wrapperElements
34208
+ });
34209
+ }
34210
+ return;
34211
+ }
34212
+ if (element.name) {
34213
+ runs.push({
34214
+ name: "w:r",
34215
+ type: "element",
34216
+ elements: element.elements || [element]
34217
+ });
34218
+ }
34219
+ });
34220
+ return runs.filter((run2) => Array.isArray(run2.elements) && run2.elements.length > 0);
34221
+ }
34173
34222
  function exportSchemaToJson(params2) {
34174
34223
  const { type: type2 } = params2.node || {};
34175
34224
  const router = {
@@ -35411,7 +35460,7 @@ const _SuperConverter = class _SuperConverter2 {
35411
35460
  static getStoredSuperdocVersion(docx) {
35412
35461
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
35413
35462
  }
35414
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.29.0-RC.2") {
35463
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.29.0-RC.4") {
35415
35464
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
35416
35465
  }
35417
35466
  /**
@@ -60008,7 +60057,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60008
60057
  * @returns {Object | void} Migration results
60009
60058
  */
60010
60059
  processCollaborationMigrations() {
60011
- console.debug("[checkVersionMigrations] Current editor version", "0.29.0-RC.2");
60060
+ console.debug("[checkVersionMigrations] Current editor version", "0.29.0-RC.4");
60012
60061
  if (!this.options.ydoc) return;
60013
60062
  const metaMap = this.options.ydoc.getMap("meta");
60014
60063
  let docVersion = metaMap.get("version");
@@ -71885,7 +71934,7 @@ const Image = Node$1.create({
71885
71934
  return {
71886
71935
  allowBase64: true,
71887
71936
  htmlAttributes: {
71888
- style: "display: inline-block; content-visibility: auto; contain-intrinsic-size: auto 600px;",
71937
+ style: "display: inline-block;",
71889
71938
  "aria-label": "Image node"
71890
71939
  }
71891
71940
  };
@@ -79628,13 +79677,14 @@ Object.assign({}, applyStyles$1, {
79628
79677
  tippy.setDefaultProps({
79629
79678
  render: render$2
79630
79679
  });
79631
- const _export_sfc = (sfc, props) => {
79680
+ function _export_sfc(sfc, props) {
79632
79681
  const target = sfc.__vccOpts || sfc;
79633
79682
  for (const [key2, val] of props) {
79634
79683
  target[key2] = val;
79635
79684
  }
79636
79685
  return target;
79637
- };
79686
+ }
79687
+
79638
79688
  const _hoisted_1$c = ["onClick", "onMouseenter"];
79639
79689
  const _hoisted_2$a = { key: 0 };
79640
79690
  const _hoisted_3$8 = { key: 0 };
@@ -7509,6 +7509,7 @@ function require_stream_duplex() {
7509
7509
  }
7510
7510
  var string_decoder = {};
7511
7511
  var safeBuffer = { exports: {} };
7512
+ /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
7512
7513
  var hasRequiredSafeBuffer;
7513
7514
  function requireSafeBuffer() {
7514
7515
  if (hasRequiredSafeBuffer) return safeBuffer.exports;
@@ -7530,6 +7531,7 @@ function requireSafeBuffer() {
7530
7531
  function SafeBuffer(arg, encodingOrOffset, length2) {
7531
7532
  return Buffer3(arg, encodingOrOffset, length2);
7532
7533
  }
7534
+ SafeBuffer.prototype = Object.create(Buffer3.prototype);
7533
7535
  copyProps(Buffer3, SafeBuffer);
7534
7536
  SafeBuffer.from = function(arg, encodingOrOffset, length2) {
7535
7537
  if (typeof arg === "number") {
@@ -11347,39 +11349,37 @@ function requireLib() {
11347
11349
  }
11348
11350
  var libExports = requireLib();
11349
11351
  const xmljs = /* @__PURE__ */ getDefaultExportFromCjs$2(libExports);
11350
- var getRandomValues;
11351
- var rnds8 = new Uint8Array(16);
11352
+ let getRandomValues;
11353
+ const rnds8 = new Uint8Array(16);
11352
11354
  function rng() {
11353
11355
  if (!getRandomValues) {
11354
- getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== "undefined" && typeof msCrypto.getRandomValues === "function" && msCrypto.getRandomValues.bind(msCrypto);
11356
+ getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
11355
11357
  if (!getRandomValues) {
11356
11358
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
11357
11359
  }
11358
11360
  }
11359
11361
  return getRandomValues(rnds8);
11360
11362
  }
11361
- const REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
11362
- function validate(uuid) {
11363
- return typeof uuid === "string" && REGEX.test(uuid);
11363
+ const byteToHex = [];
11364
+ for (let i = 0; i < 256; ++i) {
11365
+ byteToHex.push((i + 256).toString(16).slice(1));
11364
11366
  }
11365
- var byteToHex = [];
11366
- for (var i$2 = 0; i$2 < 256; ++i$2) {
11367
- byteToHex.push((i$2 + 256).toString(16).substr(1));
11368
- }
11369
- function stringify(arr) {
11370
- var offset2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
11371
- var uuid = (byteToHex[arr[offset2 + 0]] + byteToHex[arr[offset2 + 1]] + byteToHex[arr[offset2 + 2]] + byteToHex[arr[offset2 + 3]] + "-" + byteToHex[arr[offset2 + 4]] + byteToHex[arr[offset2 + 5]] + "-" + byteToHex[arr[offset2 + 6]] + byteToHex[arr[offset2 + 7]] + "-" + byteToHex[arr[offset2 + 8]] + byteToHex[arr[offset2 + 9]] + "-" + byteToHex[arr[offset2 + 10]] + byteToHex[arr[offset2 + 11]] + byteToHex[arr[offset2 + 12]] + byteToHex[arr[offset2 + 13]] + byteToHex[arr[offset2 + 14]] + byteToHex[arr[offset2 + 15]]).toLowerCase();
11372
- if (!validate(uuid)) {
11373
- throw TypeError("Stringified UUID is invalid");
11374
- }
11375
- return uuid;
11367
+ function unsafeStringify(arr, offset2 = 0) {
11368
+ return byteToHex[arr[offset2 + 0]] + byteToHex[arr[offset2 + 1]] + byteToHex[arr[offset2 + 2]] + byteToHex[arr[offset2 + 3]] + "-" + byteToHex[arr[offset2 + 4]] + byteToHex[arr[offset2 + 5]] + "-" + byteToHex[arr[offset2 + 6]] + byteToHex[arr[offset2 + 7]] + "-" + byteToHex[arr[offset2 + 8]] + byteToHex[arr[offset2 + 9]] + "-" + byteToHex[arr[offset2 + 10]] + byteToHex[arr[offset2 + 11]] + byteToHex[arr[offset2 + 12]] + byteToHex[arr[offset2 + 13]] + byteToHex[arr[offset2 + 14]] + byteToHex[arr[offset2 + 15]];
11376
11369
  }
11370
+ const randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
11371
+ const native = {
11372
+ randomUUID
11373
+ };
11377
11374
  function v4(options, buf, offset2) {
11375
+ if (native.randomUUID && true && !options) {
11376
+ return native.randomUUID();
11377
+ }
11378
11378
  options = options || {};
11379
- var rnds = options.random || (options.rng || rng)();
11379
+ const rnds = options.random || (options.rng || rng)();
11380
11380
  rnds[6] = rnds[6] & 15 | 64;
11381
11381
  rnds[8] = rnds[8] & 63 | 128;
11382
- return stringify(rnds);
11382
+ return unsafeStringify(rnds);
11383
11383
  }
11384
11384
  function getDefaultExportFromCjs(x) {
11385
11385
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
@@ -30903,9 +30903,18 @@ function translateDocumentPartObj(params2) {
30903
30903
  return result;
30904
30904
  }
30905
30905
  function translateStructuredContent(params2) {
30906
- const { node } = params2;
30907
- const childContent = translateChildNodes({ ...params2, nodes: node.content });
30908
- const sdtContent = { name: "w:sdtContent", elements: childContent };
30906
+ const { node, isFinalDoc } = params2;
30907
+ const childContent = translateChildNodes({ ...params2, node });
30908
+ const childElements = Array.isArray(childContent) ? childContent : [childContent];
30909
+ if (isFinalDoc) {
30910
+ if (node?.type === "structuredContent") {
30911
+ return convertSdtContentToRuns(childElements);
30912
+ }
30913
+ if (node?.type === "structuredContentBlock") {
30914
+ return childElements.length === 1 ? childElements[0] : childElements;
30915
+ }
30916
+ }
30917
+ const sdtContent = { name: "w:sdtContent", elements: childElements };
30909
30918
  const sdtPr = generateSdtPrTagForStructuredContent({ node });
30910
30919
  const nodeElements = [sdtPr, sdtContent];
30911
30920
  const result = {
@@ -34122,6 +34131,7 @@ const config = {
34122
34131
  attributes: validXmlAttributes
34123
34132
  };
34124
34133
  const translator = NodeTranslator.from(config);
34134
+ const RUN_LEVEL_WRAPPERS = /* @__PURE__ */ new Set(["w:hyperlink", "w:ins", "w:del"]);
34125
34135
  const DEFAULT_SECTION_PROPS_TWIPS = Object.freeze({
34126
34136
  pageSize: Object.freeze({ width: "12240", height: "15840" }),
34127
34137
  pageMargins: Object.freeze({
@@ -34187,6 +34197,45 @@ const isLineBreakOnlyRun = (node) => {
34187
34197
  if (!runContent.length) return false;
34188
34198
  return runContent.every((child) => child?.type === "lineBreak" || child?.type === "hardBreak");
34189
34199
  };
34200
+ function convertSdtContentToRuns(elements) {
34201
+ const normalized = Array.isArray(elements) ? elements : [elements];
34202
+ const runs = [];
34203
+ normalized.forEach((element) => {
34204
+ if (!element) return;
34205
+ if (element.name === "w:sdtPr") {
34206
+ return;
34207
+ }
34208
+ if (element.name === "w:r") {
34209
+ runs.push(element);
34210
+ return;
34211
+ }
34212
+ if (element.name === "w:sdt") {
34213
+ const sdtContent = (element.elements || []).find((child) => child?.name === "w:sdtContent");
34214
+ if (sdtContent?.elements) {
34215
+ runs.push(...convertSdtContentToRuns(sdtContent.elements));
34216
+ }
34217
+ return;
34218
+ }
34219
+ if (RUN_LEVEL_WRAPPERS.has(element.name)) {
34220
+ const wrapperElements = convertSdtContentToRuns(element.elements || []);
34221
+ if (wrapperElements.length) {
34222
+ runs.push({
34223
+ ...element,
34224
+ elements: wrapperElements
34225
+ });
34226
+ }
34227
+ return;
34228
+ }
34229
+ if (element.name) {
34230
+ runs.push({
34231
+ name: "w:r",
34232
+ type: "element",
34233
+ elements: element.elements || [element]
34234
+ });
34235
+ }
34236
+ });
34237
+ return runs.filter((run2) => Array.isArray(run2.elements) && run2.elements.length > 0);
34238
+ }
34190
34239
  function exportSchemaToJson(params2) {
34191
34240
  const { type: type2 } = params2.node || {};
34192
34241
  const router = {
@@ -35428,7 +35477,7 @@ const _SuperConverter = class _SuperConverter2 {
35428
35477
  static getStoredSuperdocVersion(docx) {
35429
35478
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
35430
35479
  }
35431
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.29.0-RC.2") {
35480
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.29.0-RC.4") {
35432
35481
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
35433
35482
  }
35434
35483
  /**
@@ -60025,7 +60074,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
60025
60074
  * @returns {Object | void} Migration results
60026
60075
  */
60027
60076
  processCollaborationMigrations() {
60028
- console.debug("[checkVersionMigrations] Current editor version", "0.29.0-RC.2");
60077
+ console.debug("[checkVersionMigrations] Current editor version", "0.29.0-RC.4");
60029
60078
  if (!this.options.ydoc) return;
60030
60079
  const metaMap = this.options.ydoc.getMap("meta");
60031
60080
  let docVersion = metaMap.get("version");
@@ -71902,7 +71951,7 @@ const Image = Node$1.create({
71902
71951
  return {
71903
71952
  allowBase64: true,
71904
71953
  htmlAttributes: {
71905
- style: "display: inline-block; content-visibility: auto; contain-intrinsic-size: auto 600px;",
71954
+ style: "display: inline-block;",
71906
71955
  "aria-label": "Image node"
71907
71956
  }
71908
71957
  };
@@ -79645,13 +79694,14 @@ Object.assign({}, applyStyles$1, {
79645
79694
  tippy.setDefaultProps({
79646
79695
  render: render$2
79647
79696
  });
79648
- const _export_sfc = (sfc, props) => {
79697
+ function _export_sfc(sfc, props) {
79649
79698
  const target = sfc.__vccOpts || sfc;
79650
79699
  for (const [key2, val] of props) {
79651
79700
  target[key2] = val;
79652
79701
  }
79653
79702
  return target;
79654
- };
79703
+ }
79704
+
79655
79705
  const _hoisted_1$c = ["onClick", "onMouseenter"];
79656
79706
  const _hoisted_2$a = { key: 0 };
79657
79707
  const _hoisted_3$8 = { key: 0 };
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
- const editorEfXZ6xB6 = require("./editor-EfXZ6xB6-Ckfqr3sG.cjs");
2
+ const editorCBEFneyM = require("./editor-CBEFneyM-BO6OoPuF.cjs");
3
3
  const vue = require("./vue-DKMj1I9B.cjs");
4
4
  const blankDocx = require("./blank-docx-DfW3Eeh2.cjs");
5
5
  const eventemitter3 = require("./eventemitter3-DkXkH2rT.cjs");
6
6
  const provider = require("@hocuspocus/provider");
7
7
  const Y = require("yjs");
8
8
  const jszip = require("./jszip-u4dvXAKa.cjs");
9
- const uuid = require("./uuid-CQzaMNgL.cjs");
9
+ const uuid = require("./uuid-R7L08bOx.cjs");
10
10
  function _interopNamespaceDefault(e) {
11
11
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
12
12
  if (e) {
@@ -4187,7 +4187,7 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
4187
4187
  }, 0);
4188
4188
  };
4189
4189
  const createCommentForTrackChanges = (editor) => {
4190
- let trackedChanges = editorEfXZ6xB6.index.getTrackChanges(editor.state);
4190
+ let trackedChanges = editorCBEFneyM.index.getTrackChanges(editor.state);
4191
4191
  const groupedChanges = groupChanges(trackedChanges);
4192
4192
  const { tr } = editor.view.state;
4193
4193
  const { dispatch } = editor.view;
@@ -4199,7 +4199,7 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
4199
4199
  const isLastIteration = trackedChanges.length === index + 1;
4200
4200
  if (foundComment) {
4201
4201
  if (isLastIteration) {
4202
- tr.setMeta(editorEfXZ6xB6.CommentsPluginKey, { type: "force" });
4202
+ tr.setMeta(editorCBEFneyM.CommentsPluginKey, { type: "force" });
4203
4203
  }
4204
4204
  return;
4205
4205
  }
@@ -4209,9 +4209,9 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
4209
4209
  ...deletionMark && { deletionMark: deletionMark.mark },
4210
4210
  ...formatMark && { formatMark: formatMark.mark }
4211
4211
  };
4212
- if (isLastIteration) tr.setMeta(editorEfXZ6xB6.CommentsPluginKey, { type: "force" });
4213
- tr.setMeta(editorEfXZ6xB6.CommentsPluginKey, { type: "forceTrackChanges" });
4214
- tr.setMeta(editorEfXZ6xB6.TrackChangesBasePluginKey, trackChangesPayload);
4212
+ if (isLastIteration) tr.setMeta(editorCBEFneyM.CommentsPluginKey, { type: "force" });
4213
+ tr.setMeta(editorCBEFneyM.CommentsPluginKey, { type: "forceTrackChanges" });
4214
+ tr.setMeta(editorCBEFneyM.TrackChangesBasePluginKey, trackChangesPayload);
4215
4215
  }
4216
4216
  dispatch(tr);
4217
4217
  });
@@ -4232,11 +4232,11 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
4232
4232
  const convertHtmlToSchema = (commentHTML) => {
4233
4233
  const div = document.createElement("div");
4234
4234
  div.innerHTML = commentHTML;
4235
- const editor = new editorEfXZ6xB6.Editor({
4235
+ const editor = new editorCBEFneyM.Editor({
4236
4236
  mode: "text",
4237
4237
  isHeadless: true,
4238
4238
  content: div,
4239
- extensions: editorEfXZ6xB6.getRichTextExtensions()
4239
+ extensions: editorCBEFneyM.getRichTextExtensions()
4240
4240
  });
4241
4241
  return editor.getJSON().content[0];
4242
4242
  };
@@ -4285,12 +4285,12 @@ const useCommentsStore = /* @__PURE__ */ defineStore("comments", () => {
4285
4285
  const normalizedContent = normalizeCommentForEditor(commentTextJson);
4286
4286
  const schemaContent = Array.isArray(normalizedContent) ? normalizedContent[0] : normalizedContent;
4287
4287
  if (!schemaContent.content.length) return null;
4288
- const editor = new editorEfXZ6xB6.Editor({
4288
+ const editor = new editorCBEFneyM.Editor({
4289
4289
  mode: "text",
4290
4290
  isHeadless: true,
4291
4291
  content: schemaContent,
4292
4292
  loadFromSchema: true,
4293
- extensions: editorEfXZ6xB6.getRichTextExtensions()
4293
+ extensions: editorCBEFneyM.getRichTextExtensions()
4294
4294
  });
4295
4295
  return editor.getHTML();
4296
4296
  } catch (error) {
@@ -15345,13 +15345,14 @@ const superdocIcons = {
15345
15345
  rejectChange: xmarkIconSvg,
15346
15346
  overflow: ellipsisVerticalSvg
15347
15347
  };
15348
- const _export_sfc = (sfc, props) => {
15348
+ function _export_sfc(sfc, props) {
15349
15349
  const target = sfc.__vccOpts || sfc;
15350
15350
  for (const [key, val] of props) {
15351
15351
  target[key] = val;
15352
15352
  }
15353
15353
  return target;
15354
- };
15354
+ }
15355
+
15355
15356
  const _hoisted_1$f = { class: "user-container" };
15356
15357
  const _hoisted_2$9 = ["src"];
15357
15358
  const _hoisted_3$7 = {
@@ -15801,7 +15802,7 @@ const _sfc_main$d = {
15801
15802
  vue.createBaseVNode("div", {
15802
15803
  class: vue.normalizeClass(["comment-entry", { "sd-input-active": __props.isFocused }])
15803
15804
  }, [
15804
- vue.createVNode(vue.unref(editorEfXZ6xB6.SuperInput), {
15805
+ vue.createVNode(vue.unref(editorCBEFneyM.SuperInput), {
15805
15806
  class: "superdoc-field",
15806
15807
  placeholder: "Add a comment",
15807
15808
  modelValue: vue.unref(currentCommentText),
@@ -17173,7 +17174,7 @@ const _sfc_main = {
17173
17174
  __name: "SuperDoc",
17174
17175
  emits: ["selection-update"],
17175
17176
  setup(__props, { emit: __emit }) {
17176
- const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-Dlcx3g-l.cjs")));
17177
+ const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-DYWsxwtD.cjs")));
17177
17178
  const superdocStore = useSuperdocStore();
17178
17179
  const commentsStore = useCommentsStore();
17179
17180
  const {
@@ -17710,7 +17711,7 @@ const _sfc_main = {
17710
17711
  }, null, 8, ["document-data", "config", "onPageLoaded"])) : vue.createCommentVNode("", true),
17711
17712
  vue.createVNode(vue.unref(NMessageProvider), null, {
17712
17713
  default: vue.withCtx(() => [
17713
- doc.type === vue.unref(DOCX) ? (vue.openBlock(), vue.createBlock(vue.unref(editorEfXZ6xB6.SuperEditor), {
17714
+ doc.type === vue.unref(DOCX) ? (vue.openBlock(), vue.createBlock(vue.unref(editorCBEFneyM.SuperEditor), {
17714
17715
  key: 0,
17715
17716
  "file-source": doc.data,
17716
17717
  state: doc.state,
@@ -17755,7 +17756,7 @@ const _sfc_main = {
17755
17756
  class: "ai-writer-container",
17756
17757
  style: vue.normalizeStyle(vue.unref(aiWriterPosition))
17757
17758
  }, [
17758
- vue.createVNode(vue.unref(editorEfXZ6xB6.AIWriter), {
17759
+ vue.createVNode(vue.unref(editorCBEFneyM.AIWriter), {
17759
17760
  "selected-text": vue.unref(selectedText),
17760
17761
  "handle-close": vue.unref(handleAiWriterClose),
17761
17762
  editor: vue.unref(proxy).$superdoc.activeEditor,
@@ -17937,7 +17938,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
17937
17938
  this.config.colors = shuffleArray(this.config.colors);
17938
17939
  this.userColorMap = /* @__PURE__ */ new Map();
17939
17940
  this.colorIndex = 0;
17940
- this.version = "0.29.0-RC.2";
17941
+ this.version = "0.29.0-RC.4";
17941
17942
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
17942
17943
  this.superdocId = config.superdocId || uuid.v4();
17943
17944
  this.colors = this.config.colors;
@@ -18299,7 +18300,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
18299
18300
  aiEndpoint: this.config.modules?.ai?.endpoint,
18300
18301
  ...moduleConfig
18301
18302
  };
18302
- this.toolbar = new editorEfXZ6xB6.SuperToolbar(config);
18303
+ this.toolbar = new editorCBEFneyM.SuperToolbar(config);
18303
18304
  this.toolbar.on("superdoc-command", this.onToolbarCommand.bind(this));
18304
18305
  this.toolbar.on("exception", this.config.onException);
18305
18306
  this.once("editorCreate", () => this.toolbar.updateToolbarState());
@@ -18486,7 +18487,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
18486
18487
  }
18487
18488
  return blobsToZip[0];
18488
18489
  }
18489
- const zip = await editorEfXZ6xB6.createZip(blobsToZip, filenames);
18490
+ const zip = await editorCBEFneyM.createZip(blobsToZip, filenames);
18490
18491
  if (triggerDownload) {
18491
18492
  return createDownload(zip, baseFileName, "zip");
18492
18493
  }
@@ -1,4 +1,4 @@
1
- import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./editor-EfXZ6xB6-VJn78MZE.es.js";
1
+ import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./editor-CBEFneyM-B-I0P4KA.es.js";
2
2
  import { a0 as effectScope, r as ref, L as markRaw, $ as process$1, a1 as toRaw, e as computed, a2 as isRef, a3 as isReactive, O as toRef, C as inject, i as getCurrentInstance, E as watch, u as unref, a4 as hasInjectionContext, G as reactive, n as nextTick, a5 as getCurrentScope, a6 as onScopeDispose, a7 as toRefs, g as global$1, z as shallowRef, U as readonly, b as onMounted, A as onBeforeUnmount, D as onBeforeMount, Y as onActivated, j as onDeactivated, s as createTextVNode, F as Fragment, X as Comment, H as defineComponent, P as provide, w as withDirectives, N as h, Z as Teleport, M as renderSlot, _ as isVNode, S as watchEffect, V as Transition, a8 as TransitionGroup, Q as mergeProps, W as vShow, R as cloneVNode, T as Text, c as createElementBlock, o as openBlock, t as toDisplayString, l as createVNode, q as withCtx, a as createBaseVNode, x as normalizeStyle, f as createCommentVNode, k as createBlock, h as withModifiers, p as normalizeClass, a9 as resolveDirective, m as renderList, B as createApp, I as resolveDynamicComponent, aa as defineAsyncComponent } from "./vue-DSlPeKKC.es.js";
3
3
  import { B as BlankDOCX } from "./blank-docx-ABm6XYAA.es.js";
4
4
  import { E as EventEmitter } from "./eventemitter3-Car_xCfN.es.js";
@@ -6,7 +6,7 @@ import { HocuspocusProvider, HocuspocusProviderWebsocket } from "@hocuspocus/pro
6
6
  import * as Y from "yjs";
7
7
  import { Doc, Map as Map$2 } from "yjs";
8
8
  import { B as Buffer$2 } from "./jszip-JuROCP0M.es.js";
9
- import { v as v4 } from "./uuid-DIIKH5Zc.es.js";
9
+ import { v as v4 } from "./uuid-CjlX8hrF.es.js";
10
10
  const DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
11
11
  const PDF = "application/pdf";
12
12
  const HTML = "text/html";
@@ -15328,13 +15328,14 @@ const superdocIcons = {
15328
15328
  rejectChange: xmarkIconSvg,
15329
15329
  overflow: ellipsisVerticalSvg
15330
15330
  };
15331
- const _export_sfc = (sfc, props) => {
15331
+ function _export_sfc(sfc, props) {
15332
15332
  const target = sfc.__vccOpts || sfc;
15333
15333
  for (const [key, val] of props) {
15334
15334
  target[key] = val;
15335
15335
  }
15336
15336
  return target;
15337
- };
15337
+ }
15338
+
15338
15339
  const _hoisted_1$f = { class: "user-container" };
15339
15340
  const _hoisted_2$9 = ["src"];
15340
15341
  const _hoisted_3$7 = {
@@ -17156,7 +17157,7 @@ const _sfc_main = {
17156
17157
  __name: "SuperDoc",
17157
17158
  emits: ["selection-update"],
17158
17159
  setup(__props, { emit: __emit }) {
17159
- const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-CH7xPqiQ.es.js"));
17160
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-CYtVMRB4.es.js"));
17160
17161
  const superdocStore = useSuperdocStore();
17161
17162
  const commentsStore = useCommentsStore();
17162
17163
  const {
@@ -17920,7 +17921,7 @@ class SuperDoc extends EventEmitter {
17920
17921
  this.config.colors = shuffleArray(this.config.colors);
17921
17922
  this.userColorMap = /* @__PURE__ */ new Map();
17922
17923
  this.colorIndex = 0;
17923
- this.version = "0.29.0-RC.2";
17924
+ this.version = "0.29.0-RC.4";
17924
17925
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
17925
17926
  this.superdocId = config.superdocId || v4();
17926
17927
  this.colors = this.config.colors;
@@ -0,0 +1,35 @@
1
+ let getRandomValues;
2
+ const rnds8 = new Uint8Array(16);
3
+ function rng() {
4
+ if (!getRandomValues) {
5
+ getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
6
+ if (!getRandomValues) {
7
+ throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
8
+ }
9
+ }
10
+ return getRandomValues(rnds8);
11
+ }
12
+ const byteToHex = [];
13
+ for (let i = 0; i < 256; ++i) {
14
+ byteToHex.push((i + 256).toString(16).slice(1));
15
+ }
16
+ function unsafeStringify(arr, offset = 0) {
17
+ return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
18
+ }
19
+ const randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
20
+ const native = {
21
+ randomUUID
22
+ };
23
+ function v4(options, buf, offset) {
24
+ if (native.randomUUID && true && !options) {
25
+ return native.randomUUID();
26
+ }
27
+ options = options || {};
28
+ const rnds = options.random || (options.rng || rng)();
29
+ rnds[6] = rnds[6] & 15 | 64;
30
+ rnds[8] = rnds[8] & 63 | 128;
31
+ return unsafeStringify(rnds);
32
+ }
33
+ export {
34
+ v4 as v
35
+ };