@superdoc-dev/cli 0.16.0-next.33 → 0.16.0-next.35

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 (2) hide show
  1. package/dist/index.js +310 -194
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -59533,90 +59533,70 @@ Actual: ` + parser.attribValue);
59533
59533
  });
59534
59534
  });
59535
59535
 
59536
- // ../../packages/superdoc/dist/chunks/uuid-qzgm05fK.es.js
59537
- function rng() {
59538
- if (!getRandomValues3) {
59539
- getRandomValues3 = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
59540
- if (!getRandomValues3)
59541
- throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
59542
- }
59543
- return getRandomValues3(rnds8);
59544
- }
59536
+ // ../../packages/superdoc/dist/chunks/uuid-B2wVPhPi.es.js
59545
59537
  function validate(uuid) {
59546
59538
  return typeof uuid === "string" && regex_default.test(uuid);
59547
59539
  }
59548
- function unsafeStringify(arr, offset = 0) {
59549
- 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]];
59550
- }
59551
59540
  function parse(uuid) {
59552
59541
  if (!validate_default(uuid))
59553
59542
  throw TypeError("Invalid UUID");
59554
59543
  let v;
59555
- const arr = new Uint8Array(16);
59556
- arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;
59557
- arr[1] = v >>> 16 & 255;
59558
- arr[2] = v >>> 8 & 255;
59559
- arr[3] = v & 255;
59560
- arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;
59561
- arr[5] = v & 255;
59562
- arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;
59563
- arr[7] = v & 255;
59564
- arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;
59565
- arr[9] = v & 255;
59566
- arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 1099511627776 & 255;
59567
- arr[11] = v / 4294967296 & 255;
59568
- arr[12] = v >>> 24 & 255;
59569
- arr[13] = v >>> 16 & 255;
59570
- arr[14] = v >>> 8 & 255;
59571
- arr[15] = v & 255;
59572
- return arr;
59544
+ return Uint8Array.of((v = parseInt(uuid.slice(0, 8), 16)) >>> 24, v >>> 16 & 255, v >>> 8 & 255, v & 255, (v = parseInt(uuid.slice(9, 13), 16)) >>> 8, v & 255, (v = parseInt(uuid.slice(14, 18), 16)) >>> 8, v & 255, (v = parseInt(uuid.slice(19, 23), 16)) >>> 8, v & 255, (v = parseInt(uuid.slice(24, 36), 16)) / 1099511627776 & 255, v / 4294967296 & 255, v >>> 24 & 255, v >>> 16 & 255, v >>> 8 & 255, v & 255);
59545
+ }
59546
+ function unsafeStringify(arr, offset = 0) {
59547
+ 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]]).toLowerCase();
59548
+ }
59549
+ function rng() {
59550
+ if (!getRandomValues3) {
59551
+ if (typeof crypto === "undefined" || !crypto.getRandomValues)
59552
+ throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
59553
+ getRandomValues3 = crypto.getRandomValues.bind(crypto);
59554
+ }
59555
+ return getRandomValues3(rnds8);
59573
59556
  }
59574
59557
  function stringToBytes(str) {
59575
59558
  str = unescape(encodeURIComponent(str));
59576
- const bytes = [];
59559
+ const bytes = new Uint8Array(str.length);
59577
59560
  for (let i2 = 0;i2 < str.length; ++i2)
59578
- bytes.push(str.charCodeAt(i2));
59561
+ bytes[i2] = str.charCodeAt(i2);
59579
59562
  return bytes;
59580
59563
  }
59581
- function v35(name, version3, hashfunc) {
59582
- function generateUUID(value, namespace, buf, offset) {
59583
- var _namespace;
59584
- if (typeof value === "string")
59585
- value = stringToBytes(value);
59586
- if (typeof namespace === "string")
59587
- namespace = parse_default(namespace);
59588
- if (((_namespace = namespace) === null || _namespace === undefined ? undefined : _namespace.length) !== 16)
59589
- throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");
59590
- let bytes = new Uint8Array(16 + value.length);
59591
- bytes.set(namespace);
59592
- bytes.set(value, namespace.length);
59593
- bytes = hashfunc(bytes);
59594
- bytes[6] = bytes[6] & 15 | version3;
59595
- bytes[8] = bytes[8] & 63 | 128;
59596
- if (buf) {
59597
- offset = offset || 0;
59598
- for (let i2 = 0;i2 < 16; ++i2)
59599
- buf[offset + i2] = bytes[i2];
59600
- return buf;
59601
- }
59602
- return unsafeStringify(bytes);
59564
+ function v35(version3, hash, value, namespace, buf, offset) {
59565
+ const valueBytes = typeof value === "string" ? stringToBytes(value) : value;
59566
+ const namespaceBytes = typeof namespace === "string" ? parse_default(namespace) : namespace;
59567
+ if (typeof namespace === "string")
59568
+ namespace = parse_default(namespace);
59569
+ if (namespace?.length !== 16)
59570
+ throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");
59571
+ let bytes = new Uint8Array(16 + valueBytes.length);
59572
+ bytes.set(namespaceBytes);
59573
+ bytes.set(valueBytes, namespaceBytes.length);
59574
+ bytes = hash(bytes);
59575
+ bytes[6] = bytes[6] & 15 | version3;
59576
+ bytes[8] = bytes[8] & 63 | 128;
59577
+ if (buf) {
59578
+ offset = offset || 0;
59579
+ if (offset < 0 || offset + 16 > buf.length)
59580
+ throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
59581
+ for (let i2 = 0;i2 < 16; ++i2)
59582
+ buf[offset + i2] = bytes[i2];
59583
+ return buf;
59603
59584
  }
59604
- try {
59605
- generateUUID.name = name;
59606
- } catch (err) {}
59607
- generateUUID.DNS = DNS;
59608
- generateUUID.URL = URL2;
59609
- return generateUUID;
59585
+ return unsafeStringify(bytes);
59610
59586
  }
59611
59587
  function v4(options, buf, offset) {
59612
59588
  if (native_default.randomUUID && !buf && !options)
59613
59589
  return native_default.randomUUID();
59614
59590
  options = options || {};
59615
- const rnds = options.random || (options.rng || rng)();
59591
+ const rnds = options.random ?? options.rng?.() ?? rng();
59592
+ if (rnds.length < 16)
59593
+ throw new Error("Random bytes length must be >= 16");
59616
59594
  rnds[6] = rnds[6] & 15 | 64;
59617
59595
  rnds[8] = rnds[8] & 63 | 128;
59618
59596
  if (buf) {
59619
59597
  offset = offset || 0;
59598
+ if (offset < 0 || offset + 16 > buf.length)
59599
+ throw new RangeError(`UUID byte range ${offset}:${offset + 15} is out of buffer bounds`);
59620
59600
  for (let i2 = 0;i2 < 16; ++i2)
59621
59601
  buf[offset + i2] = rnds[i2];
59622
59602
  return buf;
@@ -59652,14 +59632,10 @@ function sha1(bytes) {
59652
59632
  271733878,
59653
59633
  3285377520
59654
59634
  ];
59655
- if (typeof bytes === "string") {
59656
- const msg = unescape(encodeURIComponent(bytes));
59657
- bytes = [];
59658
- for (let i2 = 0;i2 < msg.length; ++i2)
59659
- bytes.push(msg.charCodeAt(i2));
59660
- } else if (!Array.isArray(bytes))
59661
- bytes = Array.prototype.slice.call(bytes);
59662
- bytes.push(128);
59635
+ const newBytes = new Uint8Array(bytes.length + 1);
59636
+ newBytes.set(bytes);
59637
+ newBytes[bytes.length] = 128;
59638
+ bytes = newBytes;
59663
59639
  const l = bytes.length / 4 + 2;
59664
59640
  const N = Math.ceil(l / 16);
59665
59641
  const M = new Array(N);
@@ -59698,41 +59674,26 @@ function sha1(bytes) {
59698
59674
  H[3] = H[3] + d >>> 0;
59699
59675
  H[4] = H[4] + e >>> 0;
59700
59676
  }
59701
- return [
59702
- H[0] >> 24 & 255,
59703
- H[0] >> 16 & 255,
59704
- H[0] >> 8 & 255,
59705
- H[0] & 255,
59706
- H[1] >> 24 & 255,
59707
- H[1] >> 16 & 255,
59708
- H[1] >> 8 & 255,
59709
- H[1] & 255,
59710
- H[2] >> 24 & 255,
59711
- H[2] >> 16 & 255,
59712
- H[2] >> 8 & 255,
59713
- H[2] & 255,
59714
- H[3] >> 24 & 255,
59715
- H[3] >> 16 & 255,
59716
- H[3] >> 8 & 255,
59717
- H[3] & 255,
59718
- H[4] >> 24 & 255,
59719
- H[4] >> 16 & 255,
59720
- H[4] >> 8 & 255,
59721
- H[4] & 255
59722
- ];
59677
+ return Uint8Array.of(H[0] >> 24, H[0] >> 16, H[0] >> 8, H[0], H[1] >> 24, H[1] >> 16, H[1] >> 8, H[1], H[2] >> 24, H[2] >> 16, H[2] >> 8, H[2], H[3] >> 24, H[3] >> 16, H[3] >> 8, H[3], H[4] >> 24, H[4] >> 16, H[4] >> 8, H[4]);
59723
59678
  }
59724
- var getRandomValues3, rnds8, regex_default, validate_default, byteToHex, parse_default, DNS = "6ba7b810-9dad-11d1-80b4-00c04fd430c8", URL2 = "6ba7b811-9dad-11d1-80b4-00c04fd430c8", native_default, v4_default, v5_default;
59725
- var init_uuid_qzgm05fK_es = __esm(() => {
59726
- rnds8 = new Uint8Array(16);
59727
- regex_default = /^(?:[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;
59679
+ function v5(value, namespace, buf, offset) {
59680
+ return v35(80, sha1_default, value, namespace, buf, offset);
59681
+ }
59682
+ var regex_default, validate_default, parse_default, byteToHex, getRandomValues3, rnds8, DNS = "6ba7b810-9dad-11d1-80b4-00c04fd430c8", URL2 = "6ba7b811-9dad-11d1-80b4-00c04fd430c8", native_default, v4_default, sha1_default, v5_default;
59683
+ var init_uuid_B2wVPhPi_es = __esm(() => {
59684
+ regex_default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
59728
59685
  validate_default = validate;
59686
+ parse_default = parse;
59729
59687
  byteToHex = [];
59730
59688
  for (let i2 = 0;i2 < 256; ++i2)
59731
59689
  byteToHex.push((i2 + 256).toString(16).slice(1));
59732
- parse_default = parse;
59690
+ rnds8 = new Uint8Array(16);
59733
59691
  native_default = { randomUUID: typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto) };
59734
59692
  v4_default = v4;
59735
- v5_default = v35("v5", 80, sha1);
59693
+ sha1_default = sha1;
59694
+ v5.DNS = DNS;
59695
+ v5.URL = URL2;
59696
+ v5_default = v5;
59736
59697
  });
59737
59698
 
59738
59699
  // ../../packages/superdoc/dist/chunks/constants-D9qj59G2.es.js
@@ -68366,7 +68327,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
68366
68327
  emptyOptions2 = {};
68367
68328
  });
68368
68329
 
68369
- // ../../packages/superdoc/dist/chunks/SuperConverter-DOoAJ6Zk.es.js
68330
+ // ../../packages/superdoc/dist/chunks/SuperConverter-CJi2bUhE.es.js
68370
68331
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
68371
68332
  const fieldValue = extension$1.config[field];
68372
68333
  if (typeof fieldValue === "function")
@@ -77490,9 +77451,9 @@ function decode$66(params3) {
77490
77451
  });
77491
77452
  if (params3.isFinalDoc)
77492
77453
  return null;
77493
- const textNode = translatedTextNode.elements.find((n) => n.name === "w:t");
77494
- if (textNode)
77495
- textNode.name = "w:delText";
77454
+ (translatedTextNode.elements || []).filter((n) => n.name === "w:t").forEach((n) => {
77455
+ n.name = "w:delText";
77456
+ });
77496
77457
  return {
77497
77458
  name: "w:del",
77498
77459
  attributes: {
@@ -98593,14 +98554,37 @@ function getTextNodeForExport(text$2, marks, params3) {
98593
98554
  wordIdAllocator: params3?.converter?.wordIdAllocator || null,
98594
98555
  partPath: resolveExportPartPath(params3)
98595
98556
  });
98596
- textNodes.push({
98597
- name: "w:t",
98598
- elements: [{
98599
- text: text$2,
98600
- type: "text"
98601
- }],
98602
- attributes: nodeAttrs
98603
- });
98557
+ const textValue = typeof text$2 === "string" ? text$2 : "";
98558
+ const normalizedText = textValue.includes("\r") ? textValue.replace(/\r\n?/g, `
98559
+ `) : textValue;
98560
+ if (normalizedText.includes(`
98561
+ `)) {
98562
+ const segments = normalizedText.split(`
98563
+ `);
98564
+ segments.forEach((segment, index2) => {
98565
+ if (segment.length > 0) {
98566
+ const segmentNeedsSpace = /^\s|\s$/.test(segment);
98567
+ textNodes.push({
98568
+ name: "w:t",
98569
+ elements: [{
98570
+ text: segment,
98571
+ type: "text"
98572
+ }],
98573
+ attributes: segmentNeedsSpace ? { "xml:space": "preserve" } : null
98574
+ });
98575
+ }
98576
+ if (index2 < segments.length - 1)
98577
+ textNodes.push({ name: "w:br" });
98578
+ });
98579
+ } else
98580
+ textNodes.push({
98581
+ name: "w:t",
98582
+ elements: [{
98583
+ text: normalizedText,
98584
+ type: "text"
98585
+ }],
98586
+ attributes: nodeAttrs
98587
+ });
98604
98588
  if (params3?.editor?.extensionService?.extensions) {
98605
98589
  const customMarks = params3.editor.extensionService.extensions.filter((extension$1) => extension$1.isExternal === true);
98606
98590
  normalizedMarks.forEach((mark) => {
@@ -107788,6 +107772,9 @@ function hasTrackDeleteMark(node3) {
107788
107772
  function shouldSkipTextNode(node3, options) {
107789
107773
  return isVisibleTextModel(options) && hasTrackDeleteMark(node3);
107790
107774
  }
107775
+ function shouldSkipLeafNode(node3, options) {
107776
+ return isVisibleTextModel(options) && hasTrackDeleteMark(node3);
107777
+ }
107791
107778
  function resolveSegmentPosition(targetOffset, segmentStart, segmentLength, docFrom, docTo) {
107792
107779
  if (segmentLength <= 1)
107793
107780
  return targetOffset <= segmentStart ? docFrom : docTo;
@@ -107819,7 +107806,13 @@ function pmPositionToTextOffset(blockNode, blockPos, pmPos, options) {
107819
107806
  return;
107820
107807
  }
107821
107808
  if (node3.isLeaf) {
107822
- if (pmPos >= docPos + node3.nodeSize)
107809
+ const endPos = docPos + node3.nodeSize;
107810
+ if (shouldSkipLeafNode(node3, options)) {
107811
+ if (pmPos < endPos)
107812
+ done = true;
107813
+ return;
107814
+ }
107815
+ if (pmPos >= endPos)
107823
107816
  offset += 1;
107824
107817
  else
107825
107818
  done = true;
@@ -107860,6 +107853,8 @@ function computeTextContentLength(blockNode, options) {
107860
107853
  return;
107861
107854
  }
107862
107855
  if (node3.isLeaf) {
107856
+ if (shouldSkipLeafNode(node3, options))
107857
+ return;
107863
107858
  length3 += 1;
107864
107859
  return;
107865
107860
  }
@@ -107919,6 +107914,8 @@ function resolveTextRangeInBlock(blockNode, blockPos, range, options) {
107919
107914
  return;
107920
107915
  }
107921
107916
  if (node3.isLeaf) {
107917
+ if (shouldSkipLeafNode(node3, options))
107918
+ return;
107922
107919
  advanceSegment(1, docPos, docPos + node3.nodeSize);
107923
107920
  return;
107924
107921
  }
@@ -107950,7 +107947,10 @@ function textContentInBlock(blockNode, options) {
107950
107947
  return;
107951
107948
  }
107952
107949
  if (node3.isLeaf) {
107953
- text$2 += "";
107950
+ if (shouldSkipLeafNode(node3, options))
107951
+ return;
107952
+ const leafText = node3.type?.spec?.leafText;
107953
+ text$2 += typeof leafText === "function" ? leafText(node3) : "";
107954
107954
  return;
107955
107955
  }
107956
107956
  let isFirstChild$1 = true;
@@ -107975,19 +107975,31 @@ function textContentInBlock(blockNode, options) {
107975
107975
  return text$2;
107976
107976
  }
107977
107977
  function buildTextWithTabs(schema, text$2, marks, opts = {}) {
107978
- if (!text$2.includes("\t"))
107979
- return schema.text(text$2, marks);
107980
- const tabNodeType = schema.nodes?.tab;
107981
- if (!tabNodeType || opts.parentAllowsTab === false)
107982
- return schema.text(text$2, marks);
107983
- const tabMarks = marks ?? null;
107984
- const parts = text$2.split("\t");
107978
+ const normalized = text$2.includes("\r") ? text$2.replace(/\r\n?/g, `
107979
+ `) : text$2;
107980
+ const hasTab = normalized.includes("\t");
107981
+ const hasNewline = normalized.includes(`
107982
+ `);
107983
+ if (!hasTab && !hasNewline)
107984
+ return schema.text(normalized, marks);
107985
+ const tabNodeType = hasTab && opts.parentAllowsTab !== false ? schema.nodes?.tab : undefined;
107986
+ const lineBreakNodeType = hasNewline && opts.parentAllowsLineBreak !== false ? schema.nodes?.lineBreak : undefined;
107987
+ if (!tabNodeType && !lineBreakNodeType)
107988
+ return schema.text(normalized, marks);
107989
+ const tabMarks = marks ?? undefined;
107990
+ const splitPattern = [tabNodeType ? "\\t" : null, lineBreakNodeType ? "\\n" : null].filter(Boolean).join("|");
107991
+ const parts = normalized.split(/* @__PURE__ */ new RegExp(`(${splitPattern})`));
107985
107992
  const nodes = [];
107986
- for (let i$1 = 0;i$1 < parts.length; i$1++) {
107987
- if (parts[i$1])
107988
- nodes.push(schema.text(parts[i$1], marks));
107989
- if (i$1 < parts.length - 1)
107993
+ for (const part of parts) {
107994
+ if (part === "")
107995
+ continue;
107996
+ if (part === "\t" && tabNodeType)
107990
107997
  nodes.push(tabNodeType.create(null, null, tabMarks));
107998
+ else if (part === `
107999
+ ` && lineBreakNodeType)
108000
+ nodes.push(lineBreakNodeType.create());
108001
+ else
108002
+ nodes.push(schema.text(part, marks));
107991
108003
  }
107992
108004
  return Fragment.from(nodes);
107993
108005
  }
@@ -108029,6 +108041,8 @@ function textBetweenWithTabs(doc$2, from5, to, blockSeparator, leafFallback, opt
108029
108041
  }
108030
108042
  if (node3.isLeaf) {
108031
108043
  if (node3.isInline) {
108044
+ if (options.textModel === "visible" && node3.marks?.some((mark) => mark.type.name === "trackDelete"))
108045
+ return false;
108032
108046
  const leafTextFn = node3.type?.spec?.leafText;
108033
108047
  if (typeof leafTextFn === "function")
108034
108048
  out += leafTextFn(node3);
@@ -134037,11 +134051,11 @@ var isRegExp = (value) => {
134037
134051
  state.kern = kernNode.attributes["w:val"];
134038
134052
  }
134039
134053
  }, SuperConverter;
134040
- var init_SuperConverter_DOoAJ6Zk_es = __esm(() => {
134054
+ var init_SuperConverter_CJi2bUhE_es = __esm(() => {
134041
134055
  init_rolldown_runtime_Bg48TavK_es();
134042
134056
  init_jszip_C49i9kUs_es();
134043
134057
  init_xml_js_CqGKpaft_es();
134044
- init_uuid_qzgm05fK_es();
134058
+ init_uuid_B2wVPhPi_es();
134045
134059
  init_constants_D9qj59G2_es();
134046
134060
  init_dist_B8HfvhaK_es();
134047
134061
  init_unified_Dsuw2be5_es();
@@ -173374,7 +173388,7 @@ var init_SuperConverter_DOoAJ6Zk_es = __esm(() => {
173374
173388
  };
173375
173389
  });
173376
173390
 
173377
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-DUhzXJ4D.es.js
173391
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-B3f9Th4u.es.js
173378
173392
  function parseSizeUnit(val = "0") {
173379
173393
  const length3 = val.toString() || "0";
173380
173394
  const value = Number.parseFloat(length3);
@@ -177222,6 +177236,8 @@ function executeTextRewrite(editor, tr, target, step3, mapping) {
177222
177236
  const absTo = mapping.map(target.absTo);
177223
177237
  const replacementText = getReplacementText(step3.args.replacement);
177224
177238
  const marks = resolveMarksForRange(editor, target, step3);
177239
+ const lineBreakNodeType = editor.state.schema.nodes?.lineBreak;
177240
+ const parentAllowsLineBreakAt = (pos) => lineBreakNodeType ? parentAllowsNodeAt(tr, pos, lineBreakNodeType) : false;
177225
177241
  const structuralRewrite = resolveStructuralRangeRewrite(tr.doc, absFrom, absTo, step3);
177226
177242
  if (structuralRewrite) {
177227
177243
  const slice2 = buildReplacementParagraphSlice(editor, structuralRewrite.replacementBlocks, marks, structuralRewrite.paragraphAttrs, step3.id, structuralRewrite.leadingWrappers, structuralRewrite.trailingWrappers, structuralRewrite.openStart, structuralRewrite.openEnd);
@@ -177249,7 +177265,7 @@ function executeTextRewrite(editor, tr, target, step3, mapping) {
177249
177265
  tr.delete(absFrom, absTo);
177250
177266
  return { changed: target.text.length > 0 };
177251
177267
  }
177252
- const content2 = buildTextWithTabs(editor.state.schema, replacementText, asProseMirrorMarks(marks));
177268
+ const content2 = buildTextWithTabs(editor.state.schema, replacementText, asProseMirrorMarks(marks), { parentAllowsLineBreak: parentAllowsLineBreakAt(absFrom) });
177253
177269
  tr.replaceWith(absFrom, absTo, content2);
177254
177270
  return { changed: replacementText !== target.text };
177255
177271
  }
@@ -177291,17 +177307,17 @@ function executeTextRewrite(editor, tr, target, step3, mapping) {
177291
177307
  if (change.type === "delete")
177292
177308
  tr.delete(remap(change.docFrom), remap(change.docTo));
177293
177309
  else if (change.type === "insert") {
177294
- const content2 = buildTextWithTabs(editor.state.schema, change.newText, asProseMirrorMarks(marks));
177310
+ const content2 = buildTextWithTabs(editor.state.schema, change.newText, asProseMirrorMarks(marks), { parentAllowsLineBreak: parentAllowsLineBreakAt(remap(change.docPos)) });
177295
177311
  tr.insert(remap(change.docPos), content2);
177296
177312
  } else {
177297
- const content2 = buildTextWithTabs(editor.state.schema, change.newText, asProseMirrorMarks(marks));
177313
+ const content2 = buildTextWithTabs(editor.state.schema, change.newText, asProseMirrorMarks(marks), { parentAllowsLineBreak: parentAllowsLineBreakAt(remap(change.docFrom)) });
177298
177314
  tr.replaceWith(remap(change.docFrom), remap(change.docTo), content2);
177299
177315
  }
177300
177316
  }
177301
177317
  } else if (trimmedNew.length === 0)
177302
177318
  tr.delete(trimmedFrom, trimmedTo);
177303
177319
  else {
177304
- const content2 = buildTextWithTabs(editor.state.schema, trimmedNew, asProseMirrorMarks(marks));
177320
+ const content2 = buildTextWithTabs(editor.state.schema, trimmedNew, asProseMirrorMarks(marks), { parentAllowsLineBreak: parentAllowsLineBreakAt(trimmedFrom) });
177305
177321
  tr.replaceWith(trimmedFrom, trimmedTo, content2);
177306
177322
  }
177307
177323
  return { changed: replacementText !== target.text };
@@ -177372,7 +177388,12 @@ function executeTextInsert(editor, tr, target, step3, mapping) {
177372
177388
  }
177373
177389
  const tabNodeType = editor.state.schema.nodes?.tab;
177374
177390
  const parentAllowsTab = tabNodeType && text4.includes("\t") ? parentAllowsNodeAt(tr, absPos, tabNodeType) : false;
177375
- tr.insert(absPos, buildTextWithTabs(editor.state.schema, text4, marks, { parentAllowsTab }));
177391
+ const lineBreakNodeType = editor.state.schema.nodes?.lineBreak;
177392
+ const parentAllowsLineBreak = lineBreakNodeType && /[\r\n]/.test(text4) ? parentAllowsNodeAt(tr, absPos, lineBreakNodeType) : false;
177393
+ tr.insert(absPos, buildTextWithTabs(editor.state.schema, text4, marks, {
177394
+ parentAllowsTab,
177395
+ parentAllowsLineBreak
177396
+ }));
177376
177397
  return { changed: true };
177377
177398
  }
177378
177399
  function executeTextDelete(_editor, tr, target, _step, mapping) {
@@ -177466,7 +177487,9 @@ function executeSpanTextRewrite(editor, tr, target, step3, mapping) {
177466
177487
  const absTo = mapping.map(lastSeg.absTo, -1);
177467
177488
  if (replacementBlocks.length === 1) {
177468
177489
  const marks = resolveSpanMarks(editor, target, policy, step3.id);
177469
- const content2 = buildTextWithTabs(editor.state.schema, replacementBlocks[0], asProseMirrorMarks(marks));
177490
+ const lineBreakNodeType = editor.state.schema.nodes?.lineBreak;
177491
+ const parentAllowsLineBreak = lineBreakNodeType ? parentAllowsNodeAt(tr, absFrom, lineBreakNodeType) : false;
177492
+ const content2 = buildTextWithTabs(editor.state.schema, replacementBlocks[0], asProseMirrorMarks(marks), { parentAllowsLineBreak });
177470
177493
  tr.replaceWith(absFrom, absTo, content2);
177471
177494
  return { changed: true };
177472
177495
  }
@@ -178693,7 +178716,7 @@ function materializeTab(schema) {
178693
178716
  return nodeType.create();
178694
178717
  }
178695
178718
  function materializeLineBreak(schema) {
178696
- const nodeType = schema.nodes.hardBreak ?? schema.nodes.lineBreak;
178719
+ const nodeType = schema.nodes.lineBreak ?? schema.nodes.hardBreak;
178697
178720
  if (!nodeType)
178698
178721
  return schema.text(`
178699
178722
  `);
@@ -182818,6 +182841,11 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, normalizeActorId = (value) => {
182818
182841
  disabled: !context,
182819
182842
  value: typeof superdoc?.getZoom === "function" ? superdoc.getZoom() : 100
182820
182843
  };
182844
+ }, createZoomFitWidthStateDeriver = () => ({ context, superdoc }) => {
182845
+ return {
182846
+ active: (typeof superdoc?.getZoomState === "function" ? superdoc.getZoomState()?.mode : undefined) === "fit-width",
182847
+ disabled: !context || typeof superdoc?.setZoomMode !== "function"
182848
+ };
182821
182849
  }, createDocumentModeStateDeriver = () => ({ context, superdoc }) => {
182822
182850
  return {
182823
182851
  active: false,
@@ -182838,6 +182866,12 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, normalizeActorId = (value) => {
182838
182866
  return false;
182839
182867
  superdoc.setZoom?.(normalizedPayload);
182840
182868
  return true;
182869
+ }, createZoomFitWidthExecute = () => ({ superdoc }) => {
182870
+ if (typeof superdoc?.setZoomMode !== "function")
182871
+ return false;
182872
+ const mode = typeof superdoc.getZoomState === "function" ? superdoc.getZoomState()?.mode : undefined;
182873
+ superdoc.setZoomMode(mode === "fit-width" ? "manual" : "fit-width");
182874
+ return true;
182841
182875
  }, createDocumentModeExecute = () => ({ superdoc, payload }) => {
182842
182876
  const validModes = [
182843
182877
  "editing",
@@ -183511,6 +183545,11 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, normalizeActorId = (value) => {
183511
183545
  state: createZoomStateDeriver(),
183512
183546
  execute: createZoomExecute()
183513
183547
  },
183548
+ "zoom-fit-width": {
183549
+ id: "zoom-fit-width",
183550
+ state: createZoomFitWidthStateDeriver(),
183551
+ execute: createZoomFitWidthExecute()
183552
+ },
183514
183553
  "document-mode": {
183515
183554
  id: "document-mode",
183516
183555
  state: createDocumentModeStateDeriver(),
@@ -183707,9 +183746,9 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, normalizeActorId = (value) => {
183707
183746
  }
183708
183747
  };
183709
183748
  };
183710
- var init_create_headless_toolbar_DUhzXJ4D_es = __esm(() => {
183711
- init_SuperConverter_DOoAJ6Zk_es();
183712
- init_uuid_qzgm05fK_es();
183749
+ var init_create_headless_toolbar_B3f9Th4u_es = __esm(() => {
183750
+ init_SuperConverter_CJi2bUhE_es();
183751
+ init_uuid_B2wVPhPi_es();
183713
183752
  init_constants_D9qj59G2_es();
183714
183753
  init_dist_B8HfvhaK_es();
183715
183754
  CSS_DIMENSION_REGEX = /[\d-.]+(\w+)$/;
@@ -184896,7 +184935,7 @@ var init_remark_stringify_6MMJfY0k_es = __esm(() => {
184896
184935
  eol = /\r?\n|\r/g;
184897
184936
  });
184898
184937
 
184899
- // ../../packages/superdoc/dist/chunks/detect-container-B6sqy7HZ.es.js
184938
+ // ../../packages/superdoc/dist/chunks/detect-container-sTWXwOzh.es.js
184900
184939
  function matchesMagic(bytes, magic) {
184901
184940
  if (bytes.length < magic.length)
184902
184941
  return false;
@@ -184914,7 +184953,7 @@ function detectContainerType(data) {
184914
184953
  return "unknown";
184915
184954
  }
184916
184955
  var ZIP_MAGIC, CFB_MAGIC;
184917
- var init_detect_container_B6sqy7HZ_es = __esm(() => {
184956
+ var init_detect_container_sTWXwOzh_es = __esm(() => {
184918
184957
  ZIP_MAGIC = [
184919
184958
  80,
184920
184959
  75,
@@ -184933,13 +184972,13 @@ var init_detect_container_B6sqy7HZ_es = __esm(() => {
184933
184972
  ];
184934
184973
  });
184935
184974
 
184936
- // ../../packages/superdoc/dist/chunks/detect-container-Cs3KoJVc.es.js
184937
- var exports_detect_container_Cs3KoJVc_es = {};
184938
- __export(exports_detect_container_Cs3KoJVc_es, {
184975
+ // ../../packages/superdoc/dist/chunks/detect-container-0tUwtCR4.es.js
184976
+ var exports_detect_container_0tUwtCR4_es = {};
184977
+ __export(exports_detect_container_0tUwtCR4_es, {
184939
184978
  detectContainerType: () => detectContainerType
184940
184979
  });
184941
- var init_detect_container_Cs3KoJVc_es = __esm(() => {
184942
- init_detect_container_B6sqy7HZ_es();
184980
+ var init_detect_container_0tUwtCR4_es = __esm(() => {
184981
+ init_detect_container_sTWXwOzh_es();
184943
184982
  });
184944
184983
 
184945
184984
  // ../../packages/superdoc/dist/chunks/errors-CNaD6vcg.es.js
@@ -184992,9 +185031,9 @@ var init_errors_CNaD6vcg_es = __esm(() => {
184992
185031
  };
184993
185032
  });
184994
185033
 
184995
- // ../../packages/superdoc/dist/chunks/decrypt-docx-G2a7hkiV.es.js
184996
- var exports_decrypt_docx_G2a7hkiV_es = {};
184997
- __export(exports_decrypt_docx_G2a7hkiV_es, {
185034
+ // ../../packages/superdoc/dist/chunks/decrypt-docx-CPcaRl5W.es.js
185035
+ var exports_decrypt_docx_CPcaRl5W_es = {};
185036
+ __export(exports_decrypt_docx_CPcaRl5W_es, {
184998
185037
  decryptDocxIfNeeded: () => decryptDocxIfNeeded
184999
185038
  });
185000
185039
  function concatUint8Arrays(chunks) {
@@ -185535,10 +185574,10 @@ async function decryptDocxIfNeeded(data, options) {
185535
185574
  };
185536
185575
  }
185537
185576
  var CFB_SIGNATURE, CFB_END_OF_CHAIN = 4294967294, CFB_OBJECT_TYPE, utf16LeDecoder, AGILE_VERSION = 4, AGILE_RESERVED = 4, STANDARD_VERSION_3 = 3, STANDARD_VERSION_4 = 4, STANDARD_RESERVED = 3, MIN_HEADER_SIZE = 8, BLOCK_KEY_VERIFIER_INPUT, BLOCK_KEY_VERIFIER_VALUE, BLOCK_KEY_ENCRYPTED_KEY, BLOCK_KEY_HMAC_KEY, BLOCK_KEY_HMAC_VALUE, SEGMENT_SIZE = 4096, PACKAGE_HEADER_SIZE = 8;
185538
- var init_decrypt_docx_G2a7hkiV_es = __esm(() => {
185577
+ var init_decrypt_docx_CPcaRl5W_es = __esm(() => {
185539
185578
  init_dist_B8HfvhaK_es();
185540
185579
  init_errors_CNaD6vcg_es();
185541
- init_detect_container_B6sqy7HZ_es();
185580
+ init_detect_container_sTWXwOzh_es();
185542
185581
  CFB_SIGNATURE = new Uint8Array([
185543
185582
  208,
185544
185583
  207,
@@ -185607,7 +185646,7 @@ var init_decrypt_docx_G2a7hkiV_es = __esm(() => {
185607
185646
  ]);
185608
185647
  });
185609
185648
 
185610
- // ../../packages/superdoc/dist/chunks/DocxZipper-Bu2Fhqkw.es.js
185649
+ // ../../packages/superdoc/dist/chunks/DocxZipper-FUsfThjV.es.js
185611
185650
  function sniffEncoding(u8) {
185612
185651
  if (u8.length >= 2) {
185613
185652
  const b0 = u8[0], b1 = u8[1];
@@ -185923,11 +185962,11 @@ var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.docum
185923
185962
  return new Uint8Array(0);
185924
185963
  }
185925
185964
  async getDocxData(file, isNode3 = false, options = {}) {
185926
- const { detectContainerType: detectContainerType2 } = await Promise.resolve().then(() => (init_detect_container_Cs3KoJVc_es(), exports_detect_container_Cs3KoJVc_es));
185965
+ const { detectContainerType: detectContainerType2 } = await Promise.resolve().then(() => (init_detect_container_0tUwtCR4_es(), exports_detect_container_0tUwtCR4_es));
185927
185966
  const containerType = detectContainerType2(await this.#peekBytes(file, 8));
185928
185967
  let fileData = file;
185929
185968
  if (containerType === "cfb") {
185930
- const { decryptDocxIfNeeded: decryptDocxIfNeeded2 } = await Promise.resolve().then(() => (init_decrypt_docx_G2a7hkiV_es(), exports_decrypt_docx_G2a7hkiV_es));
185969
+ const { decryptDocxIfNeeded: decryptDocxIfNeeded2 } = await Promise.resolve().then(() => (init_decrypt_docx_CPcaRl5W_es(), exports_decrypt_docx_CPcaRl5W_es));
185931
185970
  const result = await decryptDocxIfNeeded2(file instanceof Uint8Array ? file : file instanceof ArrayBuffer ? new Uint8Array(file) : new Uint8Array(await file.arrayBuffer()), { password: options.password });
185932
185971
  fileData = result.data;
185933
185972
  this.decryptedFileData = result.data;
@@ -186280,7 +186319,7 @@ var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.docum
186280
186319
  return `image/${MIME_TYPE_FOR_EXT[detectedType] || detectedType}`;
186281
186320
  }
186282
186321
  }, DocxZipper_default;
186283
- var init_DocxZipper_Bu2Fhqkw_es = __esm(() => {
186322
+ var init_DocxZipper_FUsfThjV_es = __esm(() => {
186284
186323
  init_rolldown_runtime_Bg48TavK_es();
186285
186324
  init_jszip_C49i9kUs_es();
186286
186325
  init_xml_js_CqGKpaft_es();
@@ -222159,9 +222198,9 @@ var init_unified_vFnLRfAM_es = __esm(() => {
222159
222198
  init_unified_Dsuw2be5_es();
222160
222199
  });
222161
222200
 
222162
- // ../../packages/superdoc/dist/chunks/rehype-parse-q8NfsLv7.es.js
222163
- var exports_rehype_parse_q8NfsLv7_es = {};
222164
- __export(exports_rehype_parse_q8NfsLv7_es, {
222201
+ // ../../packages/superdoc/dist/chunks/rehype-parse-DTSDs3kr.es.js
222202
+ var exports_rehype_parse_DTSDs3kr_es = {};
222203
+ __export(exports_rehype_parse_DTSDs3kr_es, {
222165
222204
  default: () => rehypeParse
222166
222205
  });
222167
222206
  function merge2(definitions, space) {
@@ -228110,7 +228149,7 @@ var Schema2 = class {
228110
228149
  }
228111
228150
  }
228112
228151
  }, TABLE_VOID_ELEMENTS, errors, base3 = "https://html.spec.whatwg.org/multipage/parsing.html#parse-error-", dashToCamelRe, formatCRe, formatXRe, fatalities, emptyOptions3;
228113
- var init_rehype_parse_q8NfsLv7_es = __esm(() => {
228152
+ var init_rehype_parse_DTSDs3kr_es = __esm(() => {
228114
228153
  init_rolldown_runtime_Bg48TavK_es();
228115
228154
  init_default_BqgWzMfR_es();
228116
228155
  init_lib_CYqLdG4z_es();
@@ -230855,9 +230894,9 @@ var init_rehype_parse_q8NfsLv7_es = __esm(() => {
230855
230894
  emptyOptions3 = {};
230856
230895
  });
230857
230896
 
230858
- // ../../packages/superdoc/dist/chunks/rehype-remark-CKg94dxK.es.js
230859
- var exports_rehype_remark_CKg94dxK_es = {};
230860
- __export(exports_rehype_remark_CKg94dxK_es, {
230897
+ // ../../packages/superdoc/dist/chunks/rehype-remark-Bt5njn02.es.js
230898
+ var exports_rehype_remark_Bt5njn02_es = {};
230899
+ __export(exports_rehype_remark_Bt5njn02_es, {
230861
230900
  default: () => rehypeRemark
230862
230901
  });
230863
230902
  function anyFactory2(tests) {
@@ -232477,7 +232516,7 @@ var env, deserializer = ($2, _2) => {
232477
232516
  if (is(parent.children[index2], index2, parent))
232478
232517
  return parent.children[index2];
232479
232518
  }, searchLineFeeds, searchTabOrSpaces, br$1, cell, p$1, row, notRendered, blockOrCaption, prefix = "language-", defaultChecked = "[x]", defaultUnchecked = "[ ]", own$12, list$1, basic, meta, defaultQuotes, nodeHandlers2, handlers2, own6, emptyOptions4, defaults;
232480
- var init_rehype_remark_CKg94dxK_es = __esm(() => {
232519
+ var init_rehype_remark_Bt5njn02_es = __esm(() => {
232481
232520
  init_lib_DEff_P2k_es();
232482
232521
  env = typeof self === "object" ? self : globalThis;
232483
232522
  ({ toString: toString$1 } = {});
@@ -232871,7 +232910,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
232871
232910
  init_remark_gfm_BhnWr3yf_es();
232872
232911
  });
232873
232912
 
232874
- // ../../packages/superdoc/dist/chunks/src-DEnygTyz.es.js
232913
+ // ../../packages/superdoc/dist/chunks/src-Bp0jHIlx.es.js
232875
232914
  function deleteProps(obj, propOrProps) {
232876
232915
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
232877
232916
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -264462,7 +264501,12 @@ function insertTextAroundSdt(editor, target, content3, resolvePos) {
264462
264501
  const { tr } = editor.state;
264463
264502
  const tabType = editor.schema.nodes?.tab;
264464
264503
  const parentAllowsTab = tabType && content3.includes("\t") ? parentAllowsNodeAt(tr, pos, tabType) : false;
264465
- tr.insert(pos, buildTextWithTabs(editor.schema, content3, undefined, { parentAllowsTab }));
264504
+ const lineBreakType = editor.schema.nodes?.lineBreak;
264505
+ const parentAllowsLineBreak = lineBreakType && /[\r\n]/.test(content3) ? parentAllowsNodeAt(tr, pos, lineBreakType) : false;
264506
+ tr.insert(pos, buildTextWithTabs(editor.schema, content3, undefined, {
264507
+ parentAllowsTab,
264508
+ parentAllowsLineBreak
264509
+ }));
264466
264510
  dispatchTransaction$1(editor, tr);
264467
264511
  return true;
264468
264512
  }
@@ -306595,17 +306639,25 @@ var Node$13 = class Node$14 {
306595
306639
  this.deco = deco;
306596
306640
  }
306597
306641
  }, searchKey, BLOCK_SEPARATOR = `
306598
- `, ATOM_PLACEHOLDER = "", DELETION_BARRIER = "\x00", DEFAULT_SEARCH_MODEL$1 = "raw", hasTrackDeleteMark$2 = (node3) => node3?.marks?.some((mark2) => mark2?.type?.name === "trackDelete") ?? false, SearchIndex, customSearchHighlightsKey, isRegExp2 = (value) => Object.prototype.toString.call(value) === "[object RegExp]", SEARCH_POSITION_TRACKER_TYPE = "search-match", DEFAULT_SEARCH_MODEL = "raw", normalizeSearchModel = (value) => value === "visible" ? "visible" : DEFAULT_SEARCH_MODEL, mapIndexMatchesToDocMatches = ({ searchIndex, indexMatches, doc: doc$12, positionTracker }) => {
306642
+ `, ATOM_PLACEHOLDER = "", DELETION_BARRIER = "\x00", DEFAULT_SEARCH_MODEL$1 = "raw", hasTrackDeleteMark$2 = (node3) => node3?.marks?.some((mark2) => mark2?.type?.name === "trackDelete") ?? false, readLeafText = (node3) => {
306643
+ const leafText = node3?.type?.spec?.leafText;
306644
+ if (typeof leafText === "function")
306645
+ return leafText(node3);
306646
+ if (typeof leafText === "string")
306647
+ return leafText;
306648
+ return ATOM_PLACEHOLDER;
306649
+ }, SearchIndex, customSearchHighlightsKey, isRegExp2 = (value) => Object.prototype.toString.call(value) === "[object RegExp]", SEARCH_POSITION_TRACKER_TYPE = "search-match", DEFAULT_SEARCH_MODEL = "raw", normalizeSearchModel = (value) => value === "visible" ? "visible" : DEFAULT_SEARCH_MODEL, mapIndexMatchesToDocMatches = ({ searchIndex, indexMatches, doc: doc$12, positionTracker }) => {
306599
306650
  const matches2 = [];
306600
306651
  for (const indexMatch of indexMatches) {
306601
306652
  const ranges = searchIndex.offsetRangeToDocRanges(indexMatch.start, indexMatch.end);
306602
306653
  if (ranges.length === 0)
306603
306654
  continue;
306604
306655
  const matchTexts = ranges.map((r$1) => doc$12.textBetween(r$1.from, r$1.to));
306656
+ const matchText = typeof indexMatch.text === "string" ? indexMatch.text : matchTexts.join("");
306605
306657
  const match$1 = {
306606
306658
  from: ranges[0].from,
306607
306659
  to: ranges[ranges.length - 1].to,
306608
- text: matchTexts.join(""),
306660
+ text: matchText,
306609
306661
  id: v4_default(),
306610
306662
  ranges,
306611
306663
  trackerIds: []
@@ -330189,19 +330241,19 @@ menclose::after {
330189
330241
  return;
330190
330242
  console.log(...args$1);
330191
330243
  }, HEADER_FOOTER_INIT_BUDGET_MS = 200, MAX_ZOOM_WARNING_THRESHOLD = 10, MAX_SELECTION_RECTS_PER_USER = 100, SEMANTIC_RESIZE_DEBOUNCE_MS = 120, MIN_SEMANTIC_CONTENT_WIDTH_PX = 1, GLOBAL_PERFORMANCE, PresentationEditor, ICONS, TEXTS, tableActionsOptions, TRACKED_MARK_NAMES;
330192
- var init_src_DEnygTyz_es = __esm(() => {
330244
+ var init_src_Bp0jHIlx_es = __esm(() => {
330193
330245
  init_rolldown_runtime_Bg48TavK_es();
330194
- init_SuperConverter_DOoAJ6Zk_es();
330246
+ init_SuperConverter_CJi2bUhE_es();
330195
330247
  init_jszip_C49i9kUs_es();
330196
330248
  init_xml_js_CqGKpaft_es();
330197
- init_uuid_qzgm05fK_es();
330198
- init_create_headless_toolbar_DUhzXJ4D_es();
330249
+ init_uuid_B2wVPhPi_es();
330250
+ init_create_headless_toolbar_B3f9Th4u_es();
330199
330251
  init_constants_D9qj59G2_es();
330200
330252
  init_dist_B8HfvhaK_es();
330201
330253
  init_unified_Dsuw2be5_es();
330202
330254
  init_remark_gfm_BhnWr3yf_es();
330203
330255
  init_remark_stringify_6MMJfY0k_es();
330204
- init_DocxZipper_Bu2Fhqkw_es();
330256
+ init_DocxZipper_FUsfThjV_es();
330205
330257
  init__plugin_vue_export_helper_5t5P5NuM_es();
330206
330258
  init_eventemitter3_BnGqBE_Q_es();
330207
330259
  init_errors_CNaD6vcg_es();
@@ -334093,10 +334145,12 @@ ${err.toString()}`);
334093
334145
  return false;
334094
334146
  const { $from } = selection;
334095
334147
  let paragraph2 = null;
334148
+ let paragraphDepth = null;
334096
334149
  for (let d = $from.depth;d >= 0; d--) {
334097
334150
  const node3 = $from.node(d);
334098
334151
  if (node3.type.name === "paragraph") {
334099
334152
  paragraph2 = node3;
334153
+ paragraphDepth = d;
334100
334154
  break;
334101
334155
  }
334102
334156
  }
@@ -334106,7 +334160,14 @@ ${err.toString()}`);
334106
334160
  return false;
334107
334161
  if (!isVisuallyEmptyParagraph(paragraph2) && !hasOnlyBreakContent(paragraph2))
334108
334162
  return false;
334109
- const tr = state.tr.insertText(event.data);
334163
+ let tr = state.tr;
334164
+ if (hasOnlyBreakContent(paragraph2) && paragraphDepth != null) {
334165
+ const contentStart = $from.start(paragraphDepth);
334166
+ const contentEnd = $from.end(paragraphDepth);
334167
+ tr = tr.delete(contentStart, contentEnd).insertText(event.data, contentStart);
334168
+ tr = tr.setSelection(TextSelection.create(tr.doc, contentStart + event.data.length));
334169
+ } else
334170
+ tr = tr.insertText(event.data);
334110
334171
  view.dispatch(tr);
334111
334172
  event.preventDefault();
334112
334173
  return true;
@@ -334426,6 +334487,8 @@ ${err.toString()}`);
334426
334487
  selectable: false,
334427
334488
  content: "",
334428
334489
  atom: true,
334490
+ leafText: () => `
334491
+ `,
334429
334492
  addOptions() {
334430
334493
  return {};
334431
334494
  },
@@ -348257,7 +348320,7 @@ function print() { __p += __j.call(arguments, '') }
348257
348320
  if (searchModel === "visible")
348258
348321
  this.#buildVisible(doc$12);
348259
348322
  else
348260
- this.text = doc$12.textBetween(0, doc$12.content.size, BLOCK_SEPARATOR, ATOM_PLACEHOLDER);
348323
+ this.text = doc$12.textBetween(0, doc$12.content.size, BLOCK_SEPARATOR, readLeafText);
348261
348324
  this.segments = [];
348262
348325
  this.docSize = doc$12.content.size;
348263
348326
  this.doc = doc$12;
@@ -348304,7 +348367,11 @@ function print() { __p += __j.call(arguments, '') }
348304
348367
  return;
348305
348368
  }
348306
348369
  if (node3.isLeaf) {
348307
- parts.push(ATOM_PLACEHOLDER);
348370
+ if (hasTrackDeleteMark$2(node3)) {
348371
+ appendDeletionBarrier();
348372
+ return;
348373
+ }
348374
+ parts.push(readLeafText(node3));
348308
348375
  emittedDeletionBarrier = false;
348309
348376
  return;
348310
348377
  }
@@ -348367,26 +348434,43 @@ function print() { __p += __j.call(arguments, '') }
348367
348434
  return offset$1;
348368
348435
  }
348369
348436
  if (node3.isLeaf) {
348437
+ if (searchModel === "visible" && hasTrackDeleteMark$2(node3)) {
348438
+ if (context?.deletionBarrierActive)
348439
+ return offset$1;
348440
+ addSegment({
348441
+ offsetStart: offset$1,
348442
+ offsetEnd: offset$1 + 1,
348443
+ docFrom: docPos,
348444
+ docTo: docPos + node3.nodeSize,
348445
+ kind: "atom"
348446
+ });
348447
+ if (context)
348448
+ context.deletionBarrierActive = true;
348449
+ return offset$1 + 1;
348450
+ }
348370
348451
  if (context && searchModel === "visible")
348371
348452
  context.deletionBarrierActive = false;
348453
+ const leafText = readLeafText(node3);
348454
+ if (leafText.length === 0)
348455
+ return offset$1;
348372
348456
  if (node3.type.name === "hard_break") {
348373
348457
  addSegment({
348374
348458
  offsetStart: offset$1,
348375
- offsetEnd: offset$1 + 1,
348459
+ offsetEnd: offset$1 + leafText.length,
348376
348460
  docFrom: docPos,
348377
348461
  docTo: docPos + node3.nodeSize,
348378
348462
  kind: "hardBreak"
348379
348463
  });
348380
- return offset$1 + 1;
348464
+ return offset$1 + leafText.length;
348381
348465
  }
348382
348466
  addSegment({
348383
348467
  offsetStart: offset$1,
348384
- offsetEnd: offset$1 + 1,
348468
+ offsetEnd: offset$1 + leafText.length,
348385
348469
  docFrom: docPos,
348386
348470
  docTo: docPos + node3.nodeSize,
348387
348471
  kind: "atom"
348388
348472
  });
348389
- return offset$1 + 1;
348473
+ return offset$1 + leafText.length;
348390
348474
  }
348391
348475
  return this.#walkNodeContent(node3, docPos + 1, offset$1, addSegment, searchModel, context);
348392
348476
  }
@@ -348403,24 +348487,56 @@ function print() { __p += __j.call(arguments, '') }
348403
348487
  }
348404
348488
  offsetRangeToDocRanges(start$1, end$1) {
348405
348489
  const ranges = [];
348490
+ let current = null;
348406
348491
  for (const segment of this.segments) {
348407
348492
  if (segment.offsetEnd <= start$1)
348408
348493
  continue;
348409
348494
  if (segment.offsetStart >= end$1)
348410
348495
  break;
348411
- if (segment.kind !== "text")
348496
+ if (segment.kind === "blockSep") {
348497
+ if (current) {
348498
+ ranges.push({
348499
+ from: current.from,
348500
+ to: current.to
348501
+ });
348502
+ current = null;
348503
+ }
348412
348504
  continue;
348505
+ }
348413
348506
  const overlapStart = Math.max(start$1, segment.offsetStart);
348414
348507
  const overlapEnd = Math.min(end$1, segment.offsetEnd);
348415
- if (overlapStart < overlapEnd) {
348416
- const startInSegment = overlapStart - segment.offsetStart;
348417
- const endInSegment = overlapEnd - segment.offsetStart;
348418
- ranges.push({
348419
- from: segment.docFrom + startInSegment,
348420
- to: segment.docFrom + endInSegment
348421
- });
348508
+ if (overlapStart >= overlapEnd)
348509
+ continue;
348510
+ let from$1;
348511
+ let to;
348512
+ if (segment.kind === "text") {
348513
+ from$1 = segment.docFrom + (overlapStart - segment.offsetStart);
348514
+ to = segment.docFrom + (overlapEnd - segment.offsetStart);
348515
+ } else {
348516
+ from$1 = segment.docFrom;
348517
+ to = segment.docTo;
348518
+ }
348519
+ if (current && segment.offsetStart === current.offsetEnd && from$1 === current.to) {
348520
+ current.to = to;
348521
+ current.offsetEnd = overlapEnd;
348522
+ } else {
348523
+ if (current)
348524
+ ranges.push({
348525
+ from: current.from,
348526
+ to: current.to
348527
+ });
348528
+ current = {
348529
+ from: from$1,
348530
+ to,
348531
+ offsetEnd: overlapEnd
348532
+ };
348422
348533
  }
348423
348534
  }
348535
+ if (current)
348536
+ ranges.push({
348537
+ from: current.from,
348538
+ to: current.to
348539
+ });
348424
348540
  return ranges;
348425
348541
  }
348426
348542
  offsetToDocPos(offset$1) {
@@ -356184,8 +356300,8 @@ function print() { __p += __j.call(arguments, '') }
356184
356300
  try {
356185
356301
  const [{ unified: unified$1 }, { default: rehypeParse2 }, { default: rehypeRemark2 }, { default: remarkStringify$1 }, { default: remarkGfm$1 }] = await Promise.all([
356186
356302
  Promise.resolve().then(() => (init_unified_vFnLRfAM_es(), exports_unified_vFnLRfAM_es)),
356187
- Promise.resolve().then(() => (init_rehype_parse_q8NfsLv7_es(), exports_rehype_parse_q8NfsLv7_es)),
356188
- Promise.resolve().then(() => (init_rehype_remark_CKg94dxK_es(), exports_rehype_remark_CKg94dxK_es)),
356303
+ Promise.resolve().then(() => (init_rehype_parse_DTSDs3kr_es(), exports_rehype_parse_DTSDs3kr_es)),
356304
+ Promise.resolve().then(() => (init_rehype_remark_Bt5njn02_es(), exports_rehype_remark_Bt5njn02_es)),
356189
356305
  Promise.resolve().then(() => (init_remark_stringify_B_orWEvD_es(), exports_remark_stringify_B_orWEvD_es)),
356190
356306
  Promise.resolve().then(() => (init_remark_gfm_eZN6yzWQ_es(), exports_remark_gfm_eZN6yzWQ_es))
356191
356307
  ]);
@@ -365035,11 +365151,11 @@ function print() { __p += __j.call(arguments, '') }
365035
365151
  ]);
365036
365152
  });
365037
365153
 
365038
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-CmcU7hTR.es.js
365154
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-DjZHlQQ4.es.js
365039
365155
  var headlessToolbarConstants, MOD_ALIASES, ALT_ALIASES, CTRL_ALIASES, SHIFT_ALIASES, BUILTIN_CONTEXT_MENU_GROUPS, BUILTIN_GROUP_ORDER, RESERVED_PROXY_PROPERTY_NAMES, ALL_TOOLBAR_COMMAND_IDS, EMPTY_ACTIVE_IDS;
365040
- var init_create_super_doc_ui_CmcU7hTR_es = __esm(() => {
365041
- init_SuperConverter_DOoAJ6Zk_es();
365042
- init_create_headless_toolbar_DUhzXJ4D_es();
365156
+ var init_create_super_doc_ui_DjZHlQQ4_es = __esm(() => {
365157
+ init_SuperConverter_CJi2bUhE_es();
365158
+ init_create_headless_toolbar_B3f9Th4u_es();
365043
365159
  headlessToolbarConstants = {
365044
365160
  DEFAULT_TEXT_ALIGN_OPTIONS: [
365045
365161
  {
@@ -365321,16 +365437,16 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
365321
365437
 
365322
365438
  // ../../packages/superdoc/dist/super-editor.es.js
365323
365439
  var init_super_editor_es = __esm(() => {
365324
- init_src_DEnygTyz_es();
365325
- init_SuperConverter_DOoAJ6Zk_es();
365440
+ init_src_Bp0jHIlx_es();
365441
+ init_SuperConverter_CJi2bUhE_es();
365326
365442
  init_jszip_C49i9kUs_es();
365327
365443
  init_xml_js_CqGKpaft_es();
365328
- init_create_headless_toolbar_DUhzXJ4D_es();
365444
+ init_create_headless_toolbar_B3f9Th4u_es();
365329
365445
  init_constants_D9qj59G2_es();
365330
365446
  init_dist_B8HfvhaK_es();
365331
365447
  init_unified_Dsuw2be5_es();
365332
- init_DocxZipper_Bu2Fhqkw_es();
365333
- init_create_super_doc_ui_CmcU7hTR_es();
365448
+ init_DocxZipper_FUsfThjV_es();
365449
+ init_create_super_doc_ui_DjZHlQQ4_es();
365334
365450
  init_ui_C5PAS9hY_es();
365335
365451
  init_eventemitter3_BnGqBE_Q_es();
365336
365452
  init_errors_CNaD6vcg_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.16.0-next.33",
3
+ "version": "0.16.0-next.35",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -24,20 +24,20 @@
24
24
  "@types/node": "22.19.2",
25
25
  "@types/ws": "^8.5.13",
26
26
  "typescript": "^5.9.2",
27
- "@superdoc/document-api": "0.0.1",
28
27
  "@superdoc/super-editor": "0.0.1",
29
- "superdoc": "1.38.0"
28
+ "superdoc": "1.38.0",
29
+ "@superdoc/document-api": "0.0.1"
30
30
  },
31
31
  "module": "src/index.ts",
32
32
  "publishConfig": {
33
33
  "access": "public"
34
34
  },
35
35
  "optionalDependencies": {
36
- "@superdoc-dev/cli-darwin-arm64": "0.16.0-next.33",
37
- "@superdoc-dev/cli-darwin-x64": "0.16.0-next.33",
38
- "@superdoc-dev/cli-linux-x64": "0.16.0-next.33",
39
- "@superdoc-dev/cli-linux-arm64": "0.16.0-next.33",
40
- "@superdoc-dev/cli-windows-x64": "0.16.0-next.33"
36
+ "@superdoc-dev/cli-darwin-arm64": "0.16.0-next.35",
37
+ "@superdoc-dev/cli-darwin-x64": "0.16.0-next.35",
38
+ "@superdoc-dev/cli-linux-x64": "0.16.0-next.35",
39
+ "@superdoc-dev/cli-linux-arm64": "0.16.0-next.35",
40
+ "@superdoc-dev/cli-windows-x64": "0.16.0-next.35"
41
41
  },
42
42
  "scripts": {
43
43
  "predev": "node scripts/ensure-superdoc-build.js",