@superdoc-dev/cli 0.4.0-next.5 → 0.4.0-next.7

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 (3) hide show
  1. package/README.md +1 -1
  2. package/dist/index.js +243 -109
  3. package/package.json +9 -9
package/README.md CHANGED
@@ -368,7 +368,7 @@ Error:
368
368
 
369
369
  ## Part of SuperDoc
370
370
 
371
- This CLI is part of the [SuperDoc](https://github.com/superdoc-dev/superdoc) project an open source document editor bringing Microsoft Word to the web. Use it alongside the editor, or standalone for document automation.
371
+ This CLI is part of [SuperDoc](https://github.com/superdoc-dev/superdoc) — open-source DOCX editing and tooling. Renders, edits, and automates .docx in the browser and on the server.
372
372
 
373
373
  ## License
374
374
 
package/dist/index.js CHANGED
@@ -25713,9 +25713,9 @@ var init_jszip_ChlR43oI_es = __esm(() => {
25713
25713
  });
25714
25714
  });
25715
25715
 
25716
- // ../../packages/superdoc/dist/chunks/xml-js-DLE8mr0n.es.js
25716
+ // ../../packages/superdoc/dist/chunks/xml-js-40FWvL78.es.js
25717
25717
  var require_events, require_inherits_browser, require_stream_browser, require_dist, require_shams$1, require_shams, require_es_object_atoms, require_es_errors, require_eval, require_range, require_ref, require_syntax, require_type, require_uri, require_abs, require_floor, require_max, require_min, require_pow, require_round, require_isNaN, require_sign, require_gOPD, require_gopd, require_es_define_property, require_has_symbols, require_Reflect_getPrototypeOf, require_Object_getPrototypeOf, require_implementation, require_function_bind, require_functionCall, require_functionApply, require_reflectApply, require_actualApply, require_call_bind_apply_helpers, require_get, require_get_proto, require_hasown, require_get_intrinsic, require_call_bound, require_is_arguments, require_is_regex, require_safe_regex_test, require_generator_function, require_is_generator_function, require_is_callable, require_for_each, require_possible_typed_array_names, require_available_typed_arrays, require_define_data_property, require_has_property_descriptors, require_set_function_length, require_applyBind, require_call_bind, require_which_typed_array, require_is_typed_array, require_types, require_isBufferBrowser, require_util, require_buffer_list, require_destroy, require_errors_browser, require_state, require_browser, require__stream_writable, require__stream_duplex, require_safe_buffer, require_string_decoder, require_end_of_stream, require_async_iterator, require_from_browser, require__stream_readable, require__stream_transform, require__stream_passthrough, require_pipeline, require_stream_browserify, require_sax, require_array_helper, require_options_helper, require_xml2js, require_xml2json, require_js2xml, require_json2xml, require_lib;
25718
- var init_xml_js_DLE8mr0n_es = __esm(() => {
25718
+ var init_xml_js_40FWvL78_es = __esm(() => {
25719
25719
  init_rolldown_runtime_B2q5OVn9_es();
25720
25720
  init_jszip_ChlR43oI_es();
25721
25721
  require_events = /* @__PURE__ */ __commonJSMin((exports, module) => {
@@ -32263,9 +32263,13 @@ var init_xml_js_DLE8mr0n_es = __esm(() => {
32263
32263
  clearBuffers(parser);
32264
32264
  parser.q = parser.c = "";
32265
32265
  parser.bufferCheckPosition = sax$1.MAX_BUFFER_LENGTH;
32266
+ parser.encoding = null;
32266
32267
  parser.opt = opt || {};
32267
32268
  parser.opt.lowercase = parser.opt.lowercase || parser.opt.lowercasetags;
32268
32269
  parser.looseCase = parser.opt.lowercase ? "toLowerCase" : "toUpperCase";
32270
+ parser.opt.maxEntityCount = parser.opt.maxEntityCount || 512;
32271
+ parser.opt.maxEntityDepth = parser.opt.maxEntityDepth || 4;
32272
+ parser.entityCount = parser.entityDepth = 0;
32269
32273
  parser.tags = [];
32270
32274
  parser.closed = parser.closedRoot = parser.sawRoot = false;
32271
32275
  parser.tag = parser.error = null;
@@ -32368,6 +32372,24 @@ var init_xml_js_DLE8mr0n_es = __esm(() => {
32368
32372
  function createStream(strict, opt) {
32369
32373
  return new SAXStream(strict, opt);
32370
32374
  }
32375
+ function determineBufferEncoding(data, isEnd) {
32376
+ if (data.length >= 2) {
32377
+ if (data[0] === 255 && data[1] === 254)
32378
+ return "utf-16le";
32379
+ if (data[0] === 254 && data[1] === 255)
32380
+ return "utf-16be";
32381
+ }
32382
+ if (data.length >= 3 && data[0] === 239 && data[1] === 187 && data[2] === 191)
32383
+ return "utf8";
32384
+ if (data.length >= 4) {
32385
+ if (data[0] === 60 && data[1] === 0 && data[2] === 63 && data[3] === 0)
32386
+ return "utf-16le";
32387
+ if (data[0] === 0 && data[1] === 60 && data[2] === 0 && data[3] === 63)
32388
+ return "utf-16be";
32389
+ return "utf8";
32390
+ }
32391
+ return isEnd ? "utf8" : null;
32392
+ }
32371
32393
  function SAXStream(strict, opt) {
32372
32394
  if (!(this instanceof SAXStream))
32373
32395
  return new SAXStream(strict, opt);
@@ -32384,6 +32406,7 @@ var init_xml_js_DLE8mr0n_es = __esm(() => {
32384
32406
  me._parser.error = null;
32385
32407
  };
32386
32408
  this._decoder = null;
32409
+ this._decoderBuffer = null;
32387
32410
  streamWraps.forEach(function(ev) {
32388
32411
  Object.defineProperty(me, "on" + ev, {
32389
32412
  get: function() {
@@ -32403,11 +32426,31 @@ var init_xml_js_DLE8mr0n_es = __esm(() => {
32403
32426
  });
32404
32427
  }
32405
32428
  SAXStream.prototype = Object.create(Stream$3.prototype, { constructor: { value: SAXStream } });
32429
+ SAXStream.prototype._decodeBuffer = function(data, isEnd) {
32430
+ if (this._decoderBuffer) {
32431
+ data = Buffer2.concat([this._decoderBuffer, data]);
32432
+ this._decoderBuffer = null;
32433
+ }
32434
+ if (!this._decoder) {
32435
+ var encoding = determineBufferEncoding(data, isEnd);
32436
+ if (!encoding) {
32437
+ this._decoderBuffer = data;
32438
+ return "";
32439
+ }
32440
+ this._parser.encoding = encoding;
32441
+ this._decoder = new TextDecoder(encoding);
32442
+ }
32443
+ return this._decoder.decode(data, { stream: !isEnd });
32444
+ };
32406
32445
  SAXStream.prototype.write = function(data) {
32407
- if (typeof Buffer2 === "function" && typeof Buffer2.isBuffer === "function" && Buffer2.isBuffer(data)) {
32408
- if (!this._decoder)
32409
- this._decoder = new TextDecoder("utf8");
32410
- data = this._decoder.decode(data, { stream: true });
32446
+ if (typeof Buffer2 === "function" && typeof Buffer2.isBuffer === "function" && Buffer2.isBuffer(data))
32447
+ data = this._decodeBuffer(data, false);
32448
+ else if (this._decoderBuffer) {
32449
+ var remaining = this._decodeBuffer(Buffer2.alloc(0), true);
32450
+ if (remaining) {
32451
+ this._parser.write(remaining);
32452
+ this.emit("data", remaining);
32453
+ }
32411
32454
  }
32412
32455
  this._parser.write(data.toString());
32413
32456
  this.emit("data", data);
@@ -32416,7 +32459,13 @@ var init_xml_js_DLE8mr0n_es = __esm(() => {
32416
32459
  SAXStream.prototype.end = function(chunk) {
32417
32460
  if (chunk && chunk.length)
32418
32461
  this.write(chunk);
32419
- if (this._decoder) {
32462
+ if (this._decoderBuffer) {
32463
+ var finalChunk = this._decodeBuffer(Buffer2.alloc(0), true);
32464
+ if (finalChunk) {
32465
+ this._parser.write(finalChunk);
32466
+ this.emit("data", finalChunk);
32467
+ }
32468
+ } else if (this._decoder) {
32420
32469
  var remaining = this._decoder.decode();
32421
32470
  if (remaining) {
32422
32471
  this._parser.write(remaining);
@@ -32776,6 +32825,31 @@ var init_xml_js_DLE8mr0n_es = __esm(() => {
32776
32825
  function emit(parser, event, data) {
32777
32826
  parser[event] && parser[event](data);
32778
32827
  }
32828
+ function getDeclaredEncoding(body) {
32829
+ var match = body && body.match(/(?:^|\s)encoding\s*=\s*(['"])([^'"]+)\1/i);
32830
+ return match ? match[2] : null;
32831
+ }
32832
+ function normalizeEncodingName(encoding) {
32833
+ if (!encoding)
32834
+ return null;
32835
+ return encoding.toLowerCase().replace(/[^a-z0-9]/g, "");
32836
+ }
32837
+ function encodingsMatch(detectedEncoding, declaredEncoding) {
32838
+ const detected = normalizeEncodingName(detectedEncoding);
32839
+ const declared = normalizeEncodingName(declaredEncoding);
32840
+ if (!detected || !declared)
32841
+ return true;
32842
+ if (declared === "utf16")
32843
+ return detected === "utf16le" || detected === "utf16be";
32844
+ return detected === declared;
32845
+ }
32846
+ function validateXmlDeclarationEncoding(parser, data) {
32847
+ if (!parser.strict || !parser.encoding || !data || data.name !== "xml")
32848
+ return;
32849
+ var declaredEncoding = getDeclaredEncoding(data.body);
32850
+ if (declaredEncoding && !encodingsMatch(parser.encoding, declaredEncoding))
32851
+ strictFail(parser, "XML declaration encoding " + declaredEncoding + " does not match detected stream encoding " + parser.encoding.toUpperCase());
32852
+ }
32779
32853
  function emitNode(parser, nodeType, data) {
32780
32854
  if (parser.textNode)
32781
32855
  closeText(parser);
@@ -33314,10 +33388,12 @@ Actual: ` + parser.attribValue);
33314
33388
  continue;
33315
33389
  case S.PROC_INST_ENDING:
33316
33390
  if (c === ">") {
33317
- emitNode(parser, "onprocessinginstruction", {
33391
+ const procInstEndData = {
33318
33392
  name: parser.procInstName,
33319
33393
  body: parser.procInstBody
33320
- });
33394
+ };
33395
+ validateXmlDeclarationEncoding(parser, procInstEndData);
33396
+ emitNode(parser, "onprocessinginstruction", procInstEndData);
33321
33397
  parser.procInstName = parser.procInstBody = "";
33322
33398
  parser.state = S.TEXT;
33323
33399
  } else {
@@ -33514,9 +33590,14 @@ Actual: ` + parser.attribValue);
33514
33590
  if (c === ";") {
33515
33591
  var parsedEntity = parseEntity(parser);
33516
33592
  if (parser.opt.unparsedEntities && !Object.values(sax$1.XML_ENTITIES).includes(parsedEntity)) {
33593
+ if ((parser.entityCount += 1) > parser.opt.maxEntityCount)
33594
+ error(parser, "Parsed entity count exceeds max entity count");
33595
+ if ((parser.entityDepth += 1) > parser.opt.maxEntityDepth)
33596
+ error(parser, "Parsed entity depth exceeds max entity depth");
33517
33597
  parser.entity = "";
33518
33598
  parser.state = returnState;
33519
33599
  parser.write(parsedEntity);
33600
+ parser.entityDepth -= 1;
33520
33601
  } else {
33521
33602
  parser[buffer$2] += parsedEntity;
33522
33603
  parser.entity = "";
@@ -34459,7 +34540,7 @@ var init_uuid_qzgm05fK_es = __esm(() => {
34459
34540
  v5_default = v35("v5", 80, sha1);
34460
34541
  });
34461
34542
 
34462
- // ../../packages/superdoc/dist/chunks/constants-CMPtQbp7.es.js
34543
+ // ../../packages/superdoc/dist/chunks/constants-Qqwopz80.es.js
34463
34544
  function computeCrc32Hex(data) {
34464
34545
  let crc = 4294967295;
34465
34546
  for (let i2 = 0;i2 < data.length; i2++)
@@ -34851,8 +34932,8 @@ var import_lib, CRC32_TABLE, REMOTE_RESOURCE_PATTERN, DATA_URI_PATTERN, getArray
34851
34932
  return "webp";
34852
34933
  return null;
34853
34934
  }, COMMENT_FILE_BASENAMES, COMMENT_RELATIONSHIP_TYPES;
34854
- var init_constants_CMPtQbp7_es = __esm(() => {
34855
- init_xml_js_DLE8mr0n_es();
34935
+ var init_constants_Qqwopz80_es = __esm(() => {
34936
+ init_xml_js_40FWvL78_es();
34856
34937
  import_lib = require_lib();
34857
34938
  CRC32_TABLE = new Uint32Array(256);
34858
34939
  for (let i2 = 0;i2 < 256; i2++) {
@@ -41059,7 +41140,7 @@ var init_remark_gfm_z_sDF4ss_es = __esm(() => {
41059
41140
  emptyOptions2 = {};
41060
41141
  });
41061
41142
 
41062
- // ../../packages/superdoc/dist/chunks/SuperConverter-BMUaGImr.es.js
41143
+ // ../../packages/superdoc/dist/chunks/SuperConverter-Cqf2W6iO.es.js
41063
41144
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
41064
41145
  const fieldValue = extension$1.config[field];
41065
41146
  if (typeof fieldValue === "function")
@@ -91290,12 +91371,12 @@ var isRegExp = (value) => {
91290
91371
  state.kern = kernNode.attributes["w:val"];
91291
91372
  }
91292
91373
  }, SuperConverter;
91293
- var init_SuperConverter_BMUaGImr_es = __esm(() => {
91374
+ var init_SuperConverter_Cqf2W6iO_es = __esm(() => {
91294
91375
  init_rolldown_runtime_B2q5OVn9_es();
91295
91376
  init_jszip_ChlR43oI_es();
91296
- init_xml_js_DLE8mr0n_es();
91377
+ init_xml_js_40FWvL78_es();
91297
91378
  init_uuid_qzgm05fK_es();
91298
- init_constants_CMPtQbp7_es();
91379
+ init_constants_Qqwopz80_es();
91299
91380
  init_unified_BRHLwnjP_es();
91300
91381
  init_lib_HnbxUP96_es();
91301
91382
  init_lib_DAB30bX1_es();
@@ -128663,7 +128744,7 @@ var init_remark_stringify_D8vxv_XI_es = __esm(() => {
128663
128744
  eol = /\r?\n|\r/g;
128664
128745
  });
128665
128746
 
128666
- // ../../packages/superdoc/dist/chunks/DocxZipper-BBJ5zSyW.es.js
128747
+ // ../../packages/superdoc/dist/chunks/DocxZipper-gWkmvJfR.es.js
128667
128748
  function getLens2(b64) {
128668
128749
  var len$1 = b64.length;
128669
128750
  if (len$1 % 4 > 0)
@@ -129358,11 +129439,11 @@ var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.docum
129358
129439
  return `image/${MIME_TYPE_FOR_EXT[detectedType] || detectedType}`;
129359
129440
  }
129360
129441
  }, DocxZipper_default;
129361
- var init_DocxZipper_BBJ5zSyW_es = __esm(() => {
129442
+ var init_DocxZipper_gWkmvJfR_es = __esm(() => {
129362
129443
  init_rolldown_runtime_B2q5OVn9_es();
129363
129444
  init_jszip_ChlR43oI_es();
129364
- init_xml_js_DLE8mr0n_es();
129365
- init_constants_CMPtQbp7_es();
129445
+ init_xml_js_40FWvL78_es();
129446
+ init_constants_Qqwopz80_es();
129366
129447
  buffer2 = {};
129367
129448
  base64Js2 = {};
129368
129449
  base64Js2.byteLength = byteLength2;
@@ -138857,11 +138938,20 @@ var assign, keys2, forEach2 = (obj, f2) => {
138857
138938
  }
138858
138939
  }
138859
138940
  return true;
138860
- }, hasProperty = (obj, key) => Object.prototype.hasOwnProperty.call(obj, key), equalFlat = (a, b) => a === b || size(a) === size(b) && every(a, (val, key) => (val !== undefined || hasProperty(b, key)) && equals(b[key], val));
138941
+ }, hasProperty = (obj, key) => Object.prototype.hasOwnProperty.call(obj, key), equalFlat = (a, b) => a === b || size(a) === size(b) && every(a, (val, key) => (val !== undefined || hasProperty(b, key)) && equals(b[key], val)), freeze, deepFreeze = (o) => {
138942
+ for (const key in o) {
138943
+ const c = o[key];
138944
+ if (typeof c === "object" || typeof c === "function") {
138945
+ deepFreeze(o[key]);
138946
+ }
138947
+ }
138948
+ return freeze(o);
138949
+ };
138861
138950
  var init_object = __esm(() => {
138862
138951
  init_equality();
138863
138952
  assign = Object.assign;
138864
138953
  keys2 = Object.keys;
138954
+ freeze = Object.freeze;
138865
138955
  });
138866
138956
 
138867
138957
  // ../../node_modules/.pnpm/lib0@0.2.117/node_modules/lib0/function.js
@@ -139160,7 +139250,7 @@ var createIterator = (next) => ({
139160
139250
  return { done, value: done ? undefined : fmap(value) };
139161
139251
  });
139162
139252
 
139163
- // ../../node_modules/.pnpm/yjs@13.6.19/node_modules/yjs/dist/yjs.mjs
139253
+ // ../../node_modules/.pnpm/yjs@13.6.30/node_modules/yjs/dist/yjs.mjs
139164
139254
  class DeleteItem {
139165
139255
  constructor(clock, len3) {
139166
139256
  this.clock = clock;
@@ -139858,6 +139948,7 @@ class ContentJSON {
139858
139948
  class ContentAny {
139859
139949
  constructor(arr) {
139860
139950
  this.arr = arr;
139951
+ isDevMode && deepFreeze(arr);
139861
139952
  }
139862
139953
  getLength() {
139863
139954
  return this.arr.length;
@@ -140005,9 +140096,12 @@ class ContentType {
140005
140096
  }
140006
140097
  var iterateDeletedStructs = (transaction, ds, f2) => ds.clients.forEach((deletes, clientid) => {
140007
140098
  const structs = transaction.doc.store.clients.get(clientid);
140008
- for (let i4 = 0;i4 < deletes.length; i4++) {
140009
- const del = deletes[i4];
140010
- iterateStructs(transaction, structs, del.clock, del.len, f2);
140099
+ if (structs != null) {
140100
+ const lastStruct = structs[structs.length - 1];
140101
+ const clockState = lastStruct.id.clock + lastStruct.length;
140102
+ for (let i4 = 0, del = deletes[i4];i4 < deletes.length && del.clock < clockState; del = deletes[++i4]) {
140103
+ iterateStructs(transaction, structs, del.clock, del.len, f2);
140104
+ }
140011
140105
  }
140012
140106
  }), findIndexDS = (dis, clock) => {
140013
140107
  let left = 0;
@@ -140037,7 +140131,7 @@ var iterateDeletedStructs = (transaction, ds, f2) => ds.clients.forEach((deletes
140037
140131
  const left = dels[j - 1];
140038
140132
  const right = dels[i4];
140039
140133
  if (left.clock + left.len >= right.clock) {
140040
- left.len = max(left.len, right.clock + right.len - left.clock);
140134
+ dels[j - 1] = new DeleteItem(left.clock, max(left.len, right.clock + right.len - left.clock));
140041
140135
  } else {
140042
140136
  if (j < i4) {
140043
140137
  dels[j] = right;
@@ -140260,13 +140354,13 @@ var iterateDeletedStructs = (transaction, ds, f2) => ds.clients.forEach((deletes
140260
140354
  const addStackToRestSS = () => {
140261
140355
  for (const item of stack2) {
140262
140356
  const client = item.id.client;
140263
- const unapplicableItems = clientsStructRefs.get(client);
140264
- if (unapplicableItems) {
140265
- unapplicableItems.i--;
140266
- restStructs.clients.set(client, unapplicableItems.refs.slice(unapplicableItems.i));
140357
+ const inapplicableItems = clientsStructRefs.get(client);
140358
+ if (inapplicableItems) {
140359
+ inapplicableItems.i--;
140360
+ restStructs.clients.set(client, inapplicableItems.refs.slice(inapplicableItems.i));
140267
140361
  clientsStructRefs.delete(client);
140268
- unapplicableItems.i = 0;
140269
- unapplicableItems.refs = [];
140362
+ inapplicableItems.i = 0;
140363
+ inapplicableItems.refs = [];
140270
140364
  } else {
140271
140365
  restStructs.clients.set(client, [item]);
140272
140366
  }
@@ -140464,6 +140558,13 @@ var iterateDeletedStructs = (transaction, ds, f2) => ds.clients.forEach((deletes
140464
140558
  t = t.right;
140465
140559
  }
140466
140560
  return createRelativePosition(type, null, assoc);
140561
+ }, getItemWithOffset = (store, id2) => {
140562
+ const item = getItem(store, id2);
140563
+ const diff = id2.clock - item.id.clock;
140564
+ return {
140565
+ item,
140566
+ diff
140567
+ };
140467
140568
  }, createAbsolutePositionFromRelativePosition = (rpos, doc3, followUndoneDeletions = true) => {
140468
140569
  const store = doc3.store;
140469
140570
  const rightID = rpos.item;
@@ -140476,7 +140577,7 @@ var iterateDeletedStructs = (transaction, ds, f2) => ds.clients.forEach((deletes
140476
140577
  if (getState(store, rightID.client) <= rightID.clock) {
140477
140578
  return null;
140478
140579
  }
140479
- const res = followUndoneDeletions ? followRedone(store, rightID) : { item: getItem(store, rightID), diff: 0 };
140580
+ const res = followUndoneDeletions ? followRedone(store, rightID) : getItemWithOffset(store, rightID);
140480
140581
  const right = res.item;
140481
140582
  if (!(right instanceof Item4)) {
140482
140583
  return null;
@@ -140702,15 +140803,19 @@ var iterateDeletedStructs = (transaction, ds, f2) => ds.clients.forEach((deletes
140702
140803
  event._path = null;
140703
140804
  });
140704
140805
  events.sort((event1, event2) => event1.path.length - event2.path.length);
140705
- callEventHandlerListeners(type._dEH, events, transaction);
140806
+ fs.push(() => {
140807
+ callEventHandlerListeners(type._dEH, events, transaction);
140808
+ });
140809
+ }
140810
+ });
140811
+ fs.push(() => doc3.emit("afterTransaction", [transaction, doc3]));
140812
+ fs.push(() => {
140813
+ if (transaction._needFormattingCleanup) {
140814
+ cleanupYTextAfterTransaction(transaction);
140706
140815
  }
140707
140816
  });
140708
140817
  });
140709
- fs.push(() => doc3.emit("afterTransaction", [transaction, doc3]));
140710
140818
  callAll(fs, []);
140711
- if (transaction._needFormattingCleanup) {
140712
- cleanupYTextAfterTransaction(transaction);
140713
- }
140714
140819
  } finally {
140715
140820
  if (doc3.gc) {
140716
140821
  tryGcDeleteSet(ds, store, doc3.gcFilter);
@@ -140806,7 +140911,7 @@ var iterateDeletedStructs = (transaction, ds, f2) => ds.clients.forEach((deletes
140806
140911
  return result;
140807
140912
  }, clearUndoManagerStackItem = (tr, um, stackItem) => {
140808
140913
  iterateDeletedStructs(tr, stackItem.deletions, (item) => {
140809
- if (item instanceof Item4 && um.scope.some((type) => isParentOf(type, item))) {
140914
+ if (item instanceof Item4 && um.scope.some((type) => type === tr.doc || isParentOf(type, item))) {
140810
140915
  keepItem(item, false);
140811
140916
  }
140812
140917
  });
@@ -140830,13 +140935,13 @@ var iterateDeletedStructs = (transaction, ds, f2) => ds.clients.forEach((deletes
140830
140935
  }
140831
140936
  struct = item;
140832
140937
  }
140833
- if (!struct.deleted && scope.some((type) => isParentOf(type, struct))) {
140938
+ if (!struct.deleted && scope.some((type) => type === transaction.doc || isParentOf(type, struct))) {
140834
140939
  itemsToDelete.push(struct);
140835
140940
  }
140836
140941
  }
140837
140942
  });
140838
140943
  iterateDeletedStructs(transaction, stackItem.deletions, (struct) => {
140839
- if (struct instanceof Item4 && scope.some((type) => isParentOf(type, struct)) && !isDeleted(stackItem.insertions, struct.id)) {
140944
+ if (struct instanceof Item4 && scope.some((type) => type === transaction.doc || isParentOf(type, struct)) && !isDeleted(stackItem.insertions, struct.id)) {
140840
140945
  itemsToRedo.add(struct);
140841
140946
  }
140842
140947
  });
@@ -141052,6 +141157,8 @@ var iterateDeletedStructs = (transaction, ds, f2) => ds.clients.forEach((deletes
141052
141157
  child = child._item.parent;
141053
141158
  }
141054
141159
  return path2;
141160
+ }, warnPrematureAccess = () => {
141161
+ warn2("Invalid access: Add Yjs type to a document before reading data.");
141055
141162
  }, maxSearchMarker = 80, globalSearchMarkerTimestamp = 0, refreshMarkerTimestamp = (marker) => {
141056
141163
  marker.timestamp = globalSearchMarkerTimestamp++;
141057
141164
  }, overwriteMarker = (marker, p2, index2) => {
@@ -141144,6 +141251,7 @@ var iterateDeletedStructs = (transaction, ds, f2) => ds.clients.forEach((deletes
141144
141251
  }
141145
141252
  callEventHandlerListeners(changedType._eH, event, transaction);
141146
141253
  }, typeListSlice = (type, start, end) => {
141254
+ type.doc ?? warnPrematureAccess();
141147
141255
  if (start < 0) {
141148
141256
  start = type._length + start;
141149
141257
  }
@@ -141170,6 +141278,7 @@ var iterateDeletedStructs = (transaction, ds, f2) => ds.clients.forEach((deletes
141170
141278
  }
141171
141279
  return cs;
141172
141280
  }, typeListToArray = (type) => {
141281
+ type.doc ?? warnPrematureAccess();
141173
141282
  const cs = [];
141174
141283
  let n = type._start;
141175
141284
  while (n !== null) {
@@ -141198,6 +141307,7 @@ var iterateDeletedStructs = (transaction, ds, f2) => ds.clients.forEach((deletes
141198
141307
  }, typeListForEach = (type, f2) => {
141199
141308
  let index2 = 0;
141200
141309
  let n = type._start;
141310
+ type.doc ?? warnPrematureAccess();
141201
141311
  while (n !== null) {
141202
141312
  if (n.countable && !n.deleted) {
141203
141313
  const c = n.content.getContent();
@@ -141247,6 +141357,7 @@ var iterateDeletedStructs = (transaction, ds, f2) => ds.clients.forEach((deletes
141247
141357
  }
141248
141358
  };
141249
141359
  }, typeListGet = (type, index2) => {
141360
+ type.doc ?? warnPrematureAccess();
141250
141361
  const marker = findMarker(type, index2);
141251
141362
  let n = type._start;
141252
141363
  if (marker !== null) {
@@ -141411,6 +141522,8 @@ var iterateDeletedStructs = (transaction, ds, f2) => ds.clients.forEach((deletes
141411
141522
  case Boolean:
141412
141523
  case Array:
141413
141524
  case String:
141525
+ case Date:
141526
+ case BigInt:
141414
141527
  content2 = new ContentAny([value]);
141415
141528
  break;
141416
141529
  case Uint8Array:
@@ -141429,10 +141542,12 @@ var iterateDeletedStructs = (transaction, ds, f2) => ds.clients.forEach((deletes
141429
141542
  }
141430
141543
  new Item4(createID(ownClientId, getState(doc3.store, ownClientId)), left, left && left.lastId, null, null, parent, key, content2).integrate(transaction, 0);
141431
141544
  }, typeMapGet = (parent, key) => {
141545
+ parent.doc ?? warnPrematureAccess();
141432
141546
  const val = parent._map.get(key);
141433
141547
  return val !== undefined && !val.deleted ? val.content.getContent()[val.length - 1] : undefined;
141434
141548
  }, typeMapGetAll = (parent) => {
141435
141549
  const res = {};
141550
+ parent.doc ?? warnPrematureAccess();
141436
141551
  parent._map.forEach((value, key) => {
141437
141552
  if (!value.deleted) {
141438
141553
  res[key] = value.content.getContent()[value.length - 1];
@@ -141440,6 +141555,7 @@ var iterateDeletedStructs = (transaction, ds, f2) => ds.clients.forEach((deletes
141440
141555
  });
141441
141556
  return res;
141442
141557
  }, typeMapHas = (parent, key) => {
141558
+ parent.doc ?? warnPrematureAccess();
141443
141559
  const val = parent._map.get(key);
141444
141560
  return val !== undefined && !val.deleted;
141445
141561
  }, typeMapGetAllSnapshot = (parent, snapshot2) => {
@@ -141454,7 +141570,10 @@ var iterateDeletedStructs = (transaction, ds, f2) => ds.clients.forEach((deletes
141454
141570
  }
141455
141571
  });
141456
141572
  return res;
141457
- }, createMapIterator = (map6) => iteratorFilter(map6.entries(), (entry) => !entry[1].deleted), YArrayEvent, YArray, readYArray = (_decoder) => new YArray, YMapEvent, YMap, readYMap = (_decoder) => new YMap, equalAttrs = (a, b) => a === b || typeof a === "object" && typeof b === "object" && a && b && equalFlat(a, b), findNextPosition = (transaction, pos, count) => {
141573
+ }, createMapIterator = (type) => {
141574
+ type.doc ?? warnPrematureAccess();
141575
+ return iteratorFilter(type._map.entries(), (entry) => !entry[1].deleted);
141576
+ }, YArrayEvent, YArray, readYArray = (_decoder) => new YArray, YMapEvent, YMap, readYMap = (_decoder) => new YMap, equalAttrs = (a, b) => a === b || typeof a === "object" && typeof b === "object" && a && b && equalFlat(a, b), findNextPosition = (transaction, pos, count) => {
141458
141577
  while (pos.right !== null && count > 0) {
141459
141578
  switch (pos.right.content.constructor) {
141460
141579
  case ContentFormat:
@@ -141759,7 +141878,7 @@ var iterateDeletedStructs = (transaction, ds, f2) => ds.clients.forEach((deletes
141759
141878
  }
141760
141879
  }
141761
141880
  return new ContentJSON(cs);
141762
- }, readContentAny = (decoder) => {
141881
+ }, isDevMode, readContentAny = (decoder) => {
141763
141882
  const len3 = decoder.readLen();
141764
141883
  const cs = [];
141765
141884
  for (let i4 = 0;i4 < len3; i4++) {
@@ -141893,6 +142012,7 @@ var init_yjs = __esm(() => {
141893
142012
  init_logging_node();
141894
142013
  init_time();
141895
142014
  init_object();
142015
+ init_environment();
141896
142016
  generateNewClientId = uint32;
141897
142017
  Doc = class Doc extends ObservableV2 {
141898
142018
  constructor({ guid = uuidv4(), collectionid = null, gc = true, gcFilter = () => true, meta = null, autoLoad = false, shouldLoad = true } = {}) {
@@ -142253,7 +142373,7 @@ var init_yjs = __esm(() => {
142253
142373
  deleteFilter = () => true,
142254
142374
  trackedOrigins = new Set([null]),
142255
142375
  ignoreRemoteMapChanges = false,
142256
- doc: doc3 = isArray2(typeScope) ? typeScope[0].doc : typeScope.doc
142376
+ doc: doc3 = isArray2(typeScope) ? typeScope[0].doc : typeScope instanceof Doc ? typeScope : typeScope.doc
142257
142377
  } = {}) {
142258
142378
  super();
142259
142379
  this.scope = [];
@@ -142272,7 +142392,7 @@ var init_yjs = __esm(() => {
142272
142392
  this.ignoreRemoteMapChanges = ignoreRemoteMapChanges;
142273
142393
  this.captureTimeout = captureTimeout;
142274
142394
  this.afterTransactionHandler = (transaction) => {
142275
- if (!this.captureTransaction(transaction) || !this.scope.some((type) => transaction.changedParentTypes.has(type)) || !this.trackedOrigins.has(transaction.origin) && (!transaction.origin || !this.trackedOrigins.has(transaction.origin.constructor))) {
142395
+ if (!this.captureTransaction(transaction) || !this.scope.some((type) => transaction.changedParentTypes.has(type) || type === this.doc) || !this.trackedOrigins.has(transaction.origin) && (!transaction.origin || !this.trackedOrigins.has(transaction.origin.constructor))) {
142276
142396
  return;
142277
142397
  }
142278
142398
  const undoing = this.undoing;
@@ -142305,7 +142425,7 @@ var init_yjs = __esm(() => {
142305
142425
  this.lastChange = now;
142306
142426
  }
142307
142427
  iterateDeletedStructs(transaction, transaction.deleteSet, (item) => {
142308
- if (item instanceof Item4 && this.scope.some((type) => isParentOf(type, item))) {
142428
+ if (item instanceof Item4 && this.scope.some((type) => type === transaction.doc || isParentOf(type, item))) {
142309
142429
  keepItem(item, true);
142310
142430
  }
142311
142431
  });
@@ -142322,10 +142442,12 @@ var init_yjs = __esm(() => {
142322
142442
  });
142323
142443
  }
142324
142444
  addToScope(ytypes) {
142445
+ const tmpSet = new Set(this.scope);
142325
142446
  ytypes = isArray2(ytypes) ? ytypes : [ytypes];
142326
142447
  ytypes.forEach((ytype) => {
142327
- if (this.scope.every((yt) => yt !== ytype)) {
142328
- if (ytype.doc !== this.doc)
142448
+ if (!tmpSet.has(ytype)) {
142449
+ tmpSet.add(ytype);
142450
+ if (ytype instanceof AbstractType ? ytype.doc !== this.doc : ytype !== this.doc)
142329
142451
  warn2("[yjs#509] Not same Y.Doc");
142330
142452
  this.scope.push(ytype);
142331
142453
  }
@@ -142414,7 +142536,8 @@ var init_yjs = __esm(() => {
142414
142536
  return arr;
142415
142537
  }
142416
142538
  get length() {
142417
- return this._prelimContent === null ? this._length : this._prelimContent.length;
142539
+ this.doc ?? warnPrematureAccess();
142540
+ return this._length;
142418
142541
  }
142419
142542
  _callObserver(transaction, parentSubs) {
142420
142543
  super._callObserver(transaction, parentSubs);
@@ -142512,6 +142635,7 @@ var init_yjs = __esm(() => {
142512
142635
  callTypeObservers(this, transaction, new YMapEvent(this, transaction, parentSubs));
142513
142636
  }
142514
142637
  toJSON() {
142638
+ this.doc ?? warnPrematureAccess();
142515
142639
  const map6 = {};
142516
142640
  this._map.forEach((item, key) => {
142517
142641
  if (!item.deleted) {
@@ -142522,18 +142646,19 @@ var init_yjs = __esm(() => {
142522
142646
  return map6;
142523
142647
  }
142524
142648
  get size() {
142525
- return [...createMapIterator(this._map)].length;
142649
+ return [...createMapIterator(this)].length;
142526
142650
  }
142527
142651
  keys() {
142528
- return iteratorMap(createMapIterator(this._map), (v) => v[0]);
142652
+ return iteratorMap(createMapIterator(this), (v) => v[0]);
142529
142653
  }
142530
142654
  values() {
142531
- return iteratorMap(createMapIterator(this._map), (v) => v[1].content.getContent()[v[1].length - 1]);
142655
+ return iteratorMap(createMapIterator(this), (v) => v[1].content.getContent()[v[1].length - 1]);
142532
142656
  }
142533
142657
  entries() {
142534
- return iteratorMap(createMapIterator(this._map), (v) => [v[0], v[1].content.getContent()[v[1].length - 1]]);
142658
+ return iteratorMap(createMapIterator(this), (v) => [v[0], v[1].content.getContent()[v[1].length - 1]]);
142535
142659
  }
142536
142660
  forEach(f2) {
142661
+ this.doc ?? warnPrematureAccess();
142537
142662
  this._map.forEach((item, key) => {
142538
142663
  if (!item.deleted) {
142539
142664
  f2(item.content.getContent()[item.length - 1], key, this);
@@ -142787,6 +142912,7 @@ var init_yjs = __esm(() => {
142787
142912
  this._hasFormatting = false;
142788
142913
  }
142789
142914
  get length() {
142915
+ this.doc ?? warnPrematureAccess();
142790
142916
  return this._length;
142791
142917
  }
142792
142918
  _integrate(y, item) {
@@ -142815,6 +142941,7 @@ var init_yjs = __esm(() => {
142815
142941
  }
142816
142942
  }
142817
142943
  toString() {
142944
+ this.doc ?? warnPrematureAccess();
142818
142945
  let str = "";
142819
142946
  let n = this._start;
142820
142947
  while (n !== null) {
@@ -142852,6 +142979,7 @@ var init_yjs = __esm(() => {
142852
142979
  }
142853
142980
  }
142854
142981
  toDelta(snapshot2, prevSnapshot, computeYChange) {
142982
+ this.doc ?? warnPrematureAccess();
142855
142983
  const ops = [];
142856
142984
  const currentAttributes = new Map;
142857
142985
  const doc3 = this.doc;
@@ -143034,6 +143162,7 @@ var init_yjs = __esm(() => {
143034
143162
  this._root = root2;
143035
143163
  this._currentNode = root2._start;
143036
143164
  this._firstCall = true;
143165
+ root2.doc ?? warnPrematureAccess();
143037
143166
  }
143038
143167
  [Symbol.iterator]() {
143039
143168
  return this;
@@ -143048,8 +143177,9 @@ var init_yjs = __esm(() => {
143048
143177
  n = type._start;
143049
143178
  } else {
143050
143179
  while (n !== null) {
143051
- if (n.right !== null) {
143052
- n = n.right;
143180
+ const nxt = n.next;
143181
+ if (nxt !== null) {
143182
+ n = nxt;
143053
143183
  break;
143054
143184
  } else if (n.parent === this._root) {
143055
143185
  n = null;
@@ -143091,6 +143221,7 @@ var init_yjs = __esm(() => {
143091
143221
  return el;
143092
143222
  }
143093
143223
  get length() {
143224
+ this.doc ?? warnPrematureAccess();
143094
143225
  return this._prelimContent === null ? this._length : this._prelimContent.length;
143095
143226
  }
143096
143227
  createTreeWalker(filter) {
@@ -143212,11 +143343,9 @@ var init_yjs = __esm(() => {
143212
143343
  const el = new YXmlElement(this.nodeName);
143213
143344
  const attrs = this.getAttributes();
143214
143345
  forEach2(attrs, (value, key) => {
143215
- if (typeof value === "string") {
143216
- el.setAttribute(key, value);
143217
- }
143346
+ el.setAttribute(key, value);
143218
143347
  });
143219
- el.insert(0, this.toArray().map((item) => item instanceof AbstractType ? item.clone() : item));
143348
+ el.insert(0, this.toArray().map((v) => v instanceof AbstractType ? v.clone() : v));
143220
143349
  return el;
143221
143350
  }
143222
143351
  toString() {
@@ -143420,6 +143549,7 @@ var init_yjs = __esm(() => {
143420
143549
  return null;
143421
143550
  }
143422
143551
  };
143552
+ isDevMode = getVariable("node_env") === "development";
143423
143553
  typeRefs = [
143424
143554
  readYArray,
143425
143555
  readYMap,
@@ -143496,8 +143626,7 @@ var init_yjs = __esm(() => {
143496
143626
  if (this.left && this.left.constructor === Item4) {
143497
143627
  this.parent = this.left.parent;
143498
143628
  this.parentSub = this.left.parentSub;
143499
- }
143500
- if (this.right && this.right.constructor === Item4) {
143629
+ } else if (this.right && this.right.constructor === Item4) {
143501
143630
  this.parent = this.right.parent;
143502
143631
  this.parentSub = this.right.parentSub;
143503
143632
  }
@@ -154468,7 +154597,7 @@ var init_remark_gfm_CjV8kaUy_es = __esm(() => {
154468
154597
  init_remark_gfm_z_sDF4ss_es();
154469
154598
  });
154470
154599
 
154471
- // ../../packages/superdoc/dist/chunks/src-BGYOfW0n.es.js
154600
+ // ../../packages/superdoc/dist/chunks/src-Bfppcrj5.es.js
154472
154601
  function deleteProps(obj, propOrProps) {
154473
154602
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
154474
154603
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -221548,7 +221677,25 @@ var Node$13 = class Node$14 {
221548
221677
  this.onMouseLeave = null;
221549
221678
  this.hoveredSdtId = null;
221550
221679
  }
221551
- }, cssToken = (varName, fallback) => ({
221680
+ }, isRtlParagraph = (attrs) => attrs?.direction === "rtl" || attrs?.rtl === true, resolveTextAlign = (alignment$1, isRtl) => {
221681
+ switch (alignment$1) {
221682
+ case "center":
221683
+ case "right":
221684
+ case "left":
221685
+ return alignment$1;
221686
+ case "justify":
221687
+ default:
221688
+ return isRtl ? "right" : "left";
221689
+ }
221690
+ }, applyRtlStyles = (element3, attrs) => {
221691
+ const rtl = isRtlParagraph(attrs);
221692
+ if (rtl) {
221693
+ element3.setAttribute("dir", "rtl");
221694
+ element3.style.direction = "rtl";
221695
+ }
221696
+ element3.style.textAlign = resolveTextAlign(attrs?.alignment, rtl);
221697
+ return rtl;
221698
+ }, shouldUseSegmentPositioning = (hasExplicitPositioning, hasSegments, isRtl) => hasExplicitPositioning && hasSegments && !isRtl, cssToken = (varName, fallback) => ({
221552
221699
  css: `var(${varName}, ${fallback})`,
221553
221700
  fallback
221554
221701
  }), LIST_MARKER_GAP = 8, DEFAULT_PAGE_HEIGHT_PX = 1056, DEFAULT_VIRTUALIZED_PAGE_GAP = 72, COMMENT_HIGHLIGHT_EXTERNAL, COMMENT_HIGHLIGHT_EXTERNAL_ACTIVE, COMMENT_HIGHLIGHT_EXTERNAL_FADED, COMMENT_HIGHLIGHT_INTERNAL, COMMENT_HIGHLIGHT_INTERNAL_ACTIVE, COMMENT_HIGHLIGHT_INTERNAL_FADED, COMMENT_HIGHLIGHT_EXTERNAL_NESTED_BORDER, COMMENT_HIGHLIGHT_INTERNAL_NESTED_BORDER, LINK_DATASET_KEYS, MAX_HREF_LENGTH = 2048, SAFE_ANCHOR_PATTERN, MAX_DATA_URL_LENGTH, VALID_IMAGE_DATA_URL, MAX_RESIZE_MULTIPLIER = 3, FALLBACK_MAX_DIMENSION = 1000, MIN_IMAGE_DIMENSION = 20, AMBIGUOUS_LINK_PATTERNS, linkMetrics, TRACK_CHANGE_BASE_CLASS, TRACK_CHANGE_FOCUSED_CLASS = "track-change-focused", TRACK_CHANGE_MODIFIER_CLASS, LINK_TARGET_SET, normalizeAnchor$1 = (value) => {
@@ -222215,27 +222362,12 @@ var Node$13 = class Node$14 {
222215
222362
  console.warn(`[DomPainter] Failed to set data attribute "${key$1}":`, error);
222216
222363
  }
222217
222364
  });
222218
- }, resolveParagraphDirection = (attrs) => {
222219
- if (attrs?.direction)
222220
- return attrs.direction;
222221
- if (attrs?.rtl === true)
222222
- return "rtl";
222223
- if (attrs?.rtl === false)
222224
- return "ltr";
222225
- }, applyParagraphDirection = (element3, attrs) => {
222226
- const direction = resolveParagraphDirection(attrs);
222227
- if (!direction)
222228
- return;
222229
- element3.setAttribute("dir", direction);
222230
- element3.style.direction = direction;
222231
222365
  }, applyParagraphBlockStyles = (element3, attrs) => {
222232
222366
  if (!attrs)
222233
222367
  return;
222234
222368
  if (attrs.styleId)
222235
222369
  element3.setAttribute("styleid", attrs.styleId);
222236
- applyParagraphDirection(element3, attrs);
222237
- if (attrs.alignment)
222238
- element3.style.textAlign = attrs.alignment === "justify" ? "left" : attrs.alignment;
222370
+ applyRtlStyles(element3, attrs);
222239
222371
  if (attrs.dropCap)
222240
222372
  element3.classList.add("sd-editor-dropcap");
222241
222373
  const indent2 = attrs.indent;
@@ -226102,7 +226234,7 @@ var Node$13 = class Node$14 {
226102
226234
  return;
226103
226235
  const trimmed = value.trim();
226104
226236
  return trimmed ? trimmed : undefined;
226105
- }, AUTO_SPACING_DEFAULT_MULTIPLIER = 1.15, AUTO_SPACING_LINE_DEFAULT = 240, normalizeAlignment = (value) => {
226237
+ }, AUTO_SPACING_DEFAULT_MULTIPLIER = 1.15, AUTO_SPACING_LINE_DEFAULT = 240, normalizeAlignment = (value, isRtl = false) => {
226106
226238
  switch (value) {
226107
226239
  case "center":
226108
226240
  case "right":
@@ -226113,11 +226245,14 @@ var Node$13 = class Node$14 {
226113
226245
  case "distribute":
226114
226246
  case "numTab":
226115
226247
  case "thaiDistribute":
226248
+ case "lowKashida":
226249
+ case "mediumKashida":
226250
+ case "highKashida":
226116
226251
  return "justify";
226117
226252
  case "end":
226118
- return "right";
226253
+ return isRtl ? "left" : "right";
226119
226254
  case "start":
226120
- return "left";
226255
+ return isRtl ? "right" : "left";
226121
226256
  default:
226122
226257
  return;
226123
226258
  }
@@ -226377,10 +226512,11 @@ var Node$13 = class Node$14 {
226377
226512
  resolvedParagraphProperties = paragraphProperties;
226378
226513
  else
226379
226514
  resolvedParagraphProperties = resolveParagraphProperties(converterContext, paragraphProperties, converterContext.tableInfo);
226515
+ const isRtl = resolvedParagraphProperties.rightToLeft === true;
226380
226516
  const normalizedSpacing = normalizeParagraphSpacing(resolvedParagraphProperties.spacing, Boolean(resolvedParagraphProperties.numberingProperties));
226381
226517
  const normalizedIndent = normalizeIndentTwipsToPx(resolvedParagraphProperties.indent);
226382
226518
  const normalizedTabStops = normalizeOoxmlTabs(resolvedParagraphProperties.tabStops);
226383
- const normalizedAlignment = normalizeAlignment(resolvedParagraphProperties.justification);
226519
+ const normalizedAlignment = normalizeAlignment(resolvedParagraphProperties.justification, isRtl);
226384
226520
  const normalizedBorders = normalizeParagraphBorders(resolvedParagraphProperties.borders);
226385
226521
  const normalizedShading = normalizeParagraphShading(resolvedParagraphProperties.shading);
226386
226522
  const paragraphDecimalSeparator = DEFAULT_DECIMAL_SEPARATOR;
@@ -226409,8 +226545,10 @@ var Node$13 = class Node$14 {
226409
226545
  keepLines: resolvedParagraphProperties.keepLines,
226410
226546
  floatAlignment,
226411
226547
  pageBreakBefore: resolvedParagraphProperties.pageBreakBefore,
226412
- direction: normalizedDirection,
226413
- rtl: normalizedDirection === "rtl" ? true : normalizedDirection === "ltr" ? false : undefined
226548
+ ...normalizedDirection ? {
226549
+ direction: normalizedDirection,
226550
+ rtl: isRtl
226551
+ } : {}
226414
226552
  };
226415
226553
  if (normalizedNumberingProperties && normalizedListRendering) {
226416
226554
  const markerRunAttrs = computeRunAttrs(resolveRunProperties(converterContext, resolvedParagraphProperties.runProperties, resolvedParagraphProperties, converterContext.tableInfo, true, Boolean(paragraphProperties.numberingProperties)), converterContext);
@@ -234037,16 +234175,16 @@ var Node$13 = class Node$14 {
234037
234175
  return;
234038
234176
  console.log(...args$1);
234039
234177
  }, 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;
234040
- var init_src_BGYOfW0n_es = __esm(() => {
234178
+ var init_src_Bfppcrj5_es = __esm(() => {
234041
234179
  init_rolldown_runtime_B2q5OVn9_es();
234042
- init_SuperConverter_BMUaGImr_es();
234180
+ init_SuperConverter_Cqf2W6iO_es();
234043
234181
  init_jszip_ChlR43oI_es();
234044
234182
  init_uuid_qzgm05fK_es();
234045
- init_constants_CMPtQbp7_es();
234183
+ init_constants_Qqwopz80_es();
234046
234184
  init_unified_BRHLwnjP_es();
234047
234185
  init_remark_gfm_z_sDF4ss_es();
234048
234186
  init_remark_stringify_D8vxv_XI_es();
234049
- init_DocxZipper_BBJ5zSyW_es();
234187
+ init_DocxZipper_gWkmvJfR_es();
234050
234188
  init_vue_LcaAh_pz_es();
234051
234189
  init__plugin_vue_export_helper_DBsdbQXw_es();
234052
234190
  init_eventemitter3_C8I7im8Y_es();
@@ -254672,16 +254810,11 @@ function print() { __p += __j.call(arguments, '') }
254672
254810
  el.classList.add(CLASS_NAMES$1.line);
254673
254811
  applyStyles(el, lineStyles(line.lineHeight));
254674
254812
  el.dataset.layoutEpoch = String(this.layoutEpoch);
254675
- const paragraphAttrs = block.attrs ?? {};
254676
- const styleId = paragraphAttrs.styleId;
254813
+ const styleId = (block.attrs ?? {}).styleId;
254677
254814
  if (styleId)
254678
254815
  el.setAttribute("styleid", styleId);
254679
- applyParagraphDirection(el, paragraphAttrs);
254680
- const alignment$1 = paragraphAttrs.alignment;
254681
- if (alignment$1 === "center" || alignment$1 === "right")
254682
- el.style.textAlign = alignment$1;
254683
- else
254684
- el.style.textAlign = "left";
254816
+ const pAttrs = block.attrs;
254817
+ const isRtl = applyRtlStyles(el, pAttrs);
254685
254818
  if (lineRange.pmStart != null)
254686
254819
  el.dataset.pmStart = String(lineRange.pmStart);
254687
254820
  if (lineRange.pmEnd != null)
@@ -254879,7 +255012,7 @@ function print() { __p += __j.call(arguments, '') }
254879
255012
  });
254880
255013
  if (spacingPerSpace !== 0)
254881
255014
  el.style.wordSpacing = `${spacingPerSpace}px`;
254882
- if (hasExplicitPositioning && line.segments) {
255015
+ if (shouldUseSegmentPositioning(hasExplicitPositioning ?? false, Boolean(line.segments), isRtl)) {
254883
255016
  const paraIndent = block.attrs?.indent;
254884
255017
  const indentLeft = paraIndent?.left ?? 0;
254885
255018
  const firstLine = paraIndent?.firstLine ?? 0;
@@ -254892,8 +255025,9 @@ function print() { __p += __j.call(arguments, '') }
254892
255025
  const fallbackListTextStartPx = typeof wordLayout?.marker?.textStartX === "number" && Number.isFinite(wordLayout.marker.textStartX) ? wordLayout.marker.textStartX : typeof wordLayout?.textStartPx === "number" && Number.isFinite(wordLayout.textStartPx) ? wordLayout.textStartPx : undefined;
254893
255026
  const indentOffset = isListParagraph ? isFirstLineOfPara ? resolvedListTextStartPx ?? fallbackListTextStartPx ?? indentLeft : indentLeft : indentLeft + firstLineOffsetForCumX;
254894
255027
  let cumulativeX = 0;
255028
+ const segments = line.segments;
254895
255029
  const segmentsByRun = /* @__PURE__ */ new Map;
254896
- line.segments.forEach((segment) => {
255030
+ segments.forEach((segment) => {
254897
255031
  const list5 = segmentsByRun.get(segment.runIndex);
254898
255032
  if (list5)
254899
255033
  list5.push(segment);
@@ -267360,13 +267494,13 @@ var init_zipper_DqXT7uTa_es = __esm(() => {
267360
267494
 
267361
267495
  // ../../packages/superdoc/dist/super-editor.es.js
267362
267496
  var init_super_editor_es = __esm(() => {
267363
- init_src_BGYOfW0n_es();
267364
- init_SuperConverter_BMUaGImr_es();
267497
+ init_src_Bfppcrj5_es();
267498
+ init_SuperConverter_Cqf2W6iO_es();
267365
267499
  init_jszip_ChlR43oI_es();
267366
- init_xml_js_DLE8mr0n_es();
267367
- init_constants_CMPtQbp7_es();
267500
+ init_xml_js_40FWvL78_es();
267501
+ init_constants_Qqwopz80_es();
267368
267502
  init_unified_BRHLwnjP_es();
267369
- init_DocxZipper_BBJ5zSyW_es();
267503
+ init_DocxZipper_gWkmvJfR_es();
267370
267504
  init_vue_LcaAh_pz_es();
267371
267505
  init_eventemitter3_C8I7im8Y_es();
267372
267506
  init_zipper_DqXT7uTa_es();
@@ -318342,7 +318476,7 @@ var require_src = __commonJS((exports) => {
318342
318476
  exports.retry = retry;
318343
318477
  });
318344
318478
 
318345
- // ../../node_modules/.pnpm/@hocuspocus+provider@2.15.3_y-protocols@1.0.7_yjs@13.6.19__yjs@13.6.19/node_modules/@hocuspocus/provider/dist/hocuspocus-provider.esm.js
318479
+ // ../../node_modules/.pnpm/@hocuspocus+provider@2.15.3_y-protocols@1.0.7_yjs@13.6.30__yjs@13.6.30/node_modules/@hocuspocus/provider/dist/hocuspocus-provider.esm.js
318346
318480
  class VarStoragePolyfill3 {
318347
318481
  constructor() {
318348
318482
  this.map = new Map;
@@ -320029,7 +320163,7 @@ var init_broadcastchannel = __esm(() => {
320029
320163
  BC2 = typeof BroadcastChannel === "undefined" ? LocalStoragePolyfill2 : BroadcastChannel;
320030
320164
  });
320031
320165
 
320032
- // ../../node_modules/.pnpm/y-protocols@1.0.7_yjs@13.6.19/node_modules/y-protocols/sync.js
320166
+ // ../../node_modules/.pnpm/y-protocols@1.0.7_yjs@13.6.30/node_modules/y-protocols/sync.js
320033
320167
  var messageYjsSyncStep12 = 0, messageYjsSyncStep22 = 1, messageYjsUpdate2 = 2, writeSyncStep12 = (encoder, doc4) => {
320034
320168
  writeVarUint(encoder, messageYjsSyncStep12);
320035
320169
  const sv = encodeStateVector(doc4);
@@ -320072,7 +320206,7 @@ var init_sync = __esm(() => {
320072
320206
  readUpdate2 = readSyncStep22;
320073
320207
  });
320074
320208
 
320075
- // ../../node_modules/.pnpm/y-protocols@1.0.7_yjs@13.6.19/node_modules/y-protocols/auth.js
320209
+ // ../../node_modules/.pnpm/y-protocols@1.0.7_yjs@13.6.30/node_modules/y-protocols/auth.js
320076
320210
  var messagePermissionDenied = 0, readAuthMessage2 = (decoder, y3, permissionDeniedHandler) => {
320077
320211
  switch (readVarUint(decoder)) {
320078
320212
  case messagePermissionDenied:
@@ -320083,7 +320217,7 @@ var init_auth = __esm(() => {
320083
320217
  init_decoding();
320084
320218
  });
320085
320219
 
320086
- // ../../node_modules/.pnpm/y-protocols@1.0.7_yjs@13.6.19/node_modules/y-protocols/awareness.js
320220
+ // ../../node_modules/.pnpm/y-protocols@1.0.7_yjs@13.6.30/node_modules/y-protocols/awareness.js
320087
320221
  var outdatedTimeout2 = 30000, Awareness2, removeAwarenessStates2 = (awareness, clients, origin) => {
320088
320222
  const removed = [];
320089
320223
  for (let i4 = 0;i4 < clients.length; i4++) {
@@ -320272,7 +320406,7 @@ var init_url = __esm(() => {
320272
320406
  init_object();
320273
320407
  });
320274
320408
 
320275
- // ../../node_modules/.pnpm/y-websocket@3.0.0_yjs@13.6.19/node_modules/y-websocket/src/y-websocket.js
320409
+ // ../../node_modules/.pnpm/y-websocket@3.0.0_yjs@13.6.30/node_modules/y-websocket/src/y-websocket.js
320276
320410
  var messageSync = 0, messageQueryAwareness = 3, messageAwareness = 1, messageAuth = 2, messageHandlers, messageReconnectTimeout = 30000, permissionDeniedHandler = (provider, reason2) => console.warn(`Permission denied to access ${provider.url}.
320277
320411
  ${reason2}`), readMessage = (provider, buf, emitSynced) => {
320278
320412
  const decoder = createDecoder(buf);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.4.0-next.5",
3
+ "version": "0.4.0-next.7",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -14,27 +14,27 @@
14
14
  "fast-glob": "^3.3.3",
15
15
  "happy-dom": "^20.3.4",
16
16
  "y-websocket": "^3.0.0",
17
- "yjs": "13.6.19"
17
+ "yjs": "^13.6.19"
18
18
  },
19
19
  "devDependencies": {
20
20
  "@types/bun": "^1.3.8",
21
21
  "@types/node": "22.19.2",
22
22
  "typescript": "^5.9.2",
23
23
  "@superdoc/document-api": "0.0.1",
24
- "@superdoc/super-editor": "0.0.1",
25
24
  "@superdoc/pm-adapter": "0.0.0",
26
- "superdoc": "1.21.0"
25
+ "superdoc": "1.21.0",
26
+ "@superdoc/super-editor": "0.0.1"
27
27
  },
28
28
  "module": "src/index.ts",
29
29
  "publishConfig": {
30
30
  "access": "public"
31
31
  },
32
32
  "optionalDependencies": {
33
- "@superdoc-dev/cli-darwin-arm64": "0.4.0-next.5",
34
- "@superdoc-dev/cli-darwin-x64": "0.4.0-next.5",
35
- "@superdoc-dev/cli-linux-x64": "0.4.0-next.5",
36
- "@superdoc-dev/cli-linux-arm64": "0.4.0-next.5",
37
- "@superdoc-dev/cli-windows-x64": "0.4.0-next.5"
33
+ "@superdoc-dev/cli-darwin-arm64": "0.4.0-next.7",
34
+ "@superdoc-dev/cli-darwin-x64": "0.4.0-next.7",
35
+ "@superdoc-dev/cli-linux-x64": "0.4.0-next.7",
36
+ "@superdoc-dev/cli-linux-arm64": "0.4.0-next.7",
37
+ "@superdoc-dev/cli-windows-x64": "0.4.0-next.7"
38
38
  },
39
39
  "scripts": {
40
40
  "predev": "node scripts/ensure-superdoc-build.js",