@harbour-enterprises/superdoc 1.0.0-alpha.26 → 1.0.0-alpha.27

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.
@@ -967,7 +967,7 @@ function add(value) {
967
967
  function set$1(key, value) {
968
968
  value = toRaw(value);
969
969
  const target = toRaw(this);
970
- const { has: has2, get: get2 } = getProto(target);
970
+ const { has: has2, get: get22 } = getProto(target);
971
971
  let hadKey = has2.call(target, key);
972
972
  if (!hadKey) {
973
973
  key = toRaw(key);
@@ -975,7 +975,7 @@ function set$1(key, value) {
975
975
  } else if (!!(process.env.NODE_ENV !== "production")) {
976
976
  checkIdentityKeys(target, has2, key);
977
977
  }
978
- const oldValue = get2.call(target, key);
978
+ const oldValue = get22.call(target, key);
979
979
  target.set(key, value);
980
980
  if (!hadKey) {
981
981
  trigger(target, "add", key, value);
@@ -986,7 +986,7 @@ function set$1(key, value) {
986
986
  }
987
987
  function deleteEntry(key) {
988
988
  const target = toRaw(this);
989
- const { has: has2, get: get2 } = getProto(target);
989
+ const { has: has2, get: get22 } = getProto(target);
990
990
  let hadKey = has2.call(target, key);
991
991
  if (!hadKey) {
992
992
  key = toRaw(key);
@@ -994,7 +994,7 @@ function deleteEntry(key) {
994
994
  } else if (!!(process.env.NODE_ENV !== "production")) {
995
995
  checkIdentityKeys(target, has2, key);
996
996
  }
997
- const oldValue = get2 ? get2.call(target, key) : void 0;
997
+ const oldValue = get22 ? get22.call(target, key) : void 0;
998
998
  const result = target.delete(key);
999
999
  if (hadKey) {
1000
1000
  trigger(target, "delete", key, void 0, oldValue);
@@ -1012,7 +1012,7 @@ function clear() {
1012
1012
  return result;
1013
1013
  }
1014
1014
  function createForEach(isReadonly2, isShallow2) {
1015
- return function forEach(callback, thisArg) {
1015
+ return function forEach2(callback, thisArg) {
1016
1016
  const observed = this;
1017
1017
  const target = observed["__v_raw"];
1018
1018
  const rawTarget = toRaw(target);
@@ -2671,7 +2671,7 @@ function queueEffectWithSuspense(fn, suspense) {
2671
2671
  queuePostFlushCb(fn);
2672
2672
  }
2673
2673
  }
2674
- function injectHook(type2, hook, target = currentInstance, prepend = false) {
2674
+ function injectHook(type2, hook, target = currentInstance, prepend2 = false) {
2675
2675
  if (target) {
2676
2676
  const hooks = target[type2] || (target[type2] = []);
2677
2677
  const wrappedHook = hook.__weh || (hook.__weh = (...args) => {
@@ -2682,7 +2682,7 @@ function injectHook(type2, hook, target = currentInstance, prepend = false) {
2682
2682
  resetTracking();
2683
2683
  return res;
2684
2684
  });
2685
- if (prepend) {
2685
+ if (prepend2) {
2686
2686
  hooks.unshift(wrappedHook);
2687
2687
  } else {
2688
2688
  hooks.push(wrappedHook);
@@ -3173,8 +3173,8 @@ function applyOptions(instance) {
3173
3173
  if (computedOptions) {
3174
3174
  for (const key in computedOptions) {
3175
3175
  const opt = computedOptions[key];
3176
- const get2 = isFunction$1(opt) ? opt.bind(publicThis, publicThis) : isFunction$1(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP;
3177
- if (!!(process.env.NODE_ENV !== "production") && get2 === NOOP) {
3176
+ const get3 = isFunction$1(opt) ? opt.bind(publicThis, publicThis) : isFunction$1(opt.get) ? opt.get.bind(publicThis, publicThis) : NOOP;
3177
+ if (!!(process.env.NODE_ENV !== "production") && get3 === NOOP) {
3178
3178
  warn$1(`Computed property "${key}" has no getter.`);
3179
3179
  }
3180
3180
  const set2 = !isFunction$1(opt) && isFunction$1(opt.set) ? opt.set.bind(publicThis) : !!(process.env.NODE_ENV !== "production") ? () => {
@@ -3183,7 +3183,7 @@ function applyOptions(instance) {
3183
3183
  );
3184
3184
  } : NOOP;
3185
3185
  const c2 = computed({
3186
- get: get2,
3186
+ get: get3,
3187
3187
  set: set2
3188
3188
  });
3189
3189
  Object.defineProperty(ctx, key, {
@@ -3350,8 +3350,8 @@ function resolveMergedOptions(instance) {
3350
3350
  }
3351
3351
  return resolved;
3352
3352
  }
3353
- function mergeOptions(to, from, strats, asMixin = false) {
3354
- const { mixins, extends: extendsOptions } = from;
3353
+ function mergeOptions(to, from2, strats, asMixin = false) {
3354
+ const { mixins, extends: extendsOptions } = from2;
3355
3355
  if (extendsOptions) {
3356
3356
  mergeOptions(to, extendsOptions, strats, true);
3357
3357
  }
@@ -3360,14 +3360,14 @@ function mergeOptions(to, from, strats, asMixin = false) {
3360
3360
  (m) => mergeOptions(to, m, strats, true)
3361
3361
  );
3362
3362
  }
3363
- for (const key in from) {
3363
+ for (const key in from2) {
3364
3364
  if (asMixin && key === "expose") {
3365
3365
  !!(process.env.NODE_ENV !== "production") && warn$1(
3366
3366
  `"expose" option is ignored when declared in mixins or extends. It should only be declared in the base component itself.`
3367
3367
  );
3368
3368
  } else {
3369
3369
  const strat = internalOptionMergeStrats[key] || strats && strats[key];
3370
- to[key] = strat ? strat(to[key], from[key]) : from[key];
3370
+ to[key] = strat ? strat(to[key], from2[key]) : from2[key];
3371
3371
  }
3372
3372
  }
3373
3373
  return to;
@@ -3403,22 +3403,22 @@ const internalOptionMergeStrats = {
3403
3403
  provide: mergeDataFn,
3404
3404
  inject: mergeInject
3405
3405
  };
3406
- function mergeDataFn(to, from) {
3407
- if (!from) {
3406
+ function mergeDataFn(to, from2) {
3407
+ if (!from2) {
3408
3408
  return to;
3409
3409
  }
3410
3410
  if (!to) {
3411
- return from;
3411
+ return from2;
3412
3412
  }
3413
3413
  return function mergedDataFn() {
3414
3414
  return extend(
3415
3415
  isFunction$1(to) ? to.call(this, this) : to,
3416
- isFunction$1(from) ? from.call(this, this) : from
3416
+ isFunction$1(from2) ? from2.call(this, this) : from2
3417
3417
  );
3418
3418
  };
3419
3419
  }
3420
- function mergeInject(to, from) {
3421
- return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
3420
+ function mergeInject(to, from2) {
3421
+ return mergeObjectOptions(normalizeInject(to), normalizeInject(from2));
3422
3422
  }
3423
3423
  function normalizeInject(raw) {
3424
3424
  if (isArray$4(raw)) {
@@ -3430,32 +3430,32 @@ function normalizeInject(raw) {
3430
3430
  }
3431
3431
  return raw;
3432
3432
  }
3433
- function mergeAsArray(to, from) {
3434
- return to ? [...new Set([].concat(to, from))] : from;
3433
+ function mergeAsArray(to, from2) {
3434
+ return to ? [...new Set([].concat(to, from2))] : from2;
3435
3435
  }
3436
- function mergeObjectOptions(to, from) {
3437
- return to ? extend(/* @__PURE__ */ Object.create(null), to, from) : from;
3436
+ function mergeObjectOptions(to, from2) {
3437
+ return to ? extend(/* @__PURE__ */ Object.create(null), to, from2) : from2;
3438
3438
  }
3439
- function mergeEmitsOrPropsOptions(to, from) {
3439
+ function mergeEmitsOrPropsOptions(to, from2) {
3440
3440
  if (to) {
3441
- if (isArray$4(to) && isArray$4(from)) {
3442
- return [.../* @__PURE__ */ new Set([...to, ...from])];
3441
+ if (isArray$4(to) && isArray$4(from2)) {
3442
+ return [.../* @__PURE__ */ new Set([...to, ...from2])];
3443
3443
  }
3444
3444
  return extend(
3445
3445
  /* @__PURE__ */ Object.create(null),
3446
3446
  normalizePropsOrEmits(to),
3447
- normalizePropsOrEmits(from != null ? from : {})
3447
+ normalizePropsOrEmits(from2 != null ? from2 : {})
3448
3448
  );
3449
3449
  } else {
3450
- return from;
3450
+ return from2;
3451
3451
  }
3452
3452
  }
3453
- function mergeWatchOptions(to, from) {
3454
- if (!to) return from;
3455
- if (!from) return to;
3453
+ function mergeWatchOptions(to, from2) {
3454
+ if (!to) return from2;
3455
+ if (!from2) return to;
3456
3456
  const merged = extend(/* @__PURE__ */ Object.create(null), to);
3457
- for (const key in from) {
3458
- merged[key] = mergeAsArray(to[key], from[key]);
3457
+ for (const key in from2) {
3458
+ merged[key] = mergeAsArray(to[key], from2[key]);
3459
3459
  }
3460
3460
  return merged;
3461
3461
  }
@@ -10700,9 +10700,9 @@ function stringToBytes(str) {
10700
10700
  function string32(value) {
10701
10701
  return String.fromCharCode(value >> 24 & 255, value >> 16 & 255, value >> 8 & 255, value & 255);
10702
10702
  }
10703
- function objectFromMap(map2) {
10703
+ function objectFromMap(map3) {
10704
10704
  const obj = /* @__PURE__ */ Object.create(null);
10705
- for (const [key, value] of map2) {
10705
+ for (const [key, value] of map3) {
10706
10706
  obj[key] = value;
10707
10707
  }
10708
10708
  return obj;
@@ -10948,10 +10948,10 @@ class BaseFilterFactory {
10948
10948
  addHCMFilter(fgColor, bgColor) {
10949
10949
  return "none";
10950
10950
  }
10951
- addAlphaFilter(map2) {
10951
+ addAlphaFilter(map3) {
10952
10952
  return "none";
10953
10953
  }
10954
- addLuminosityFilter(map2) {
10954
+ addLuminosityFilter(map3) {
10955
10955
  return "none";
10956
10956
  }
10957
10957
  addHighlightHCMFilter(filterName, fgColor, bgColor, newFgColor, newBgColor) {
@@ -11159,12 +11159,12 @@ class DOMFilterFactory extends BaseFilterFactory {
11159
11159
  if (fgColor === "#000000" && bgColor === "#ffffff" || fgColor === bgColor) {
11160
11160
  return info2.url;
11161
11161
  }
11162
- const map2 = new Array(256);
11162
+ const map3 = new Array(256);
11163
11163
  for (let i = 0; i <= 255; i++) {
11164
11164
  const x = i / 255;
11165
- map2[i] = x <= 0.03928 ? x / 12.92 : ((x + 0.055) / 1.055) ** 2.4;
11165
+ map3[i] = x <= 0.03928 ? x / 12.92 : ((x + 0.055) / 1.055) ** 2.4;
11166
11166
  }
11167
- const table = map2.join(",");
11167
+ const table = map3.join(",");
11168
11168
  const id = `g_${__privateGet(this, _docId)}_hcm_filter`;
11169
11169
  const filter = info2.filter = __privateMethod(this, _DOMFilterFactory_instances, createFilter_fn).call(this, id);
11170
11170
  __privateMethod(this, _DOMFilterFactory_instances, addTransferMapConversion_fn).call(this, table, table, table, filter);
@@ -11182,50 +11182,50 @@ class DOMFilterFactory extends BaseFilterFactory {
11182
11182
  info2.url = `url(#${id})`;
11183
11183
  return info2.url;
11184
11184
  }
11185
- addAlphaFilter(map2) {
11186
- let value = __privateGet(this, _DOMFilterFactory_instances, cache_get).get(map2);
11185
+ addAlphaFilter(map3) {
11186
+ let value = __privateGet(this, _DOMFilterFactory_instances, cache_get).get(map3);
11187
11187
  if (value) {
11188
11188
  return value;
11189
11189
  }
11190
- const [tableA] = __privateMethod(this, _DOMFilterFactory_instances, createTables_fn).call(this, [map2]);
11190
+ const [tableA] = __privateMethod(this, _DOMFilterFactory_instances, createTables_fn).call(this, [map3]);
11191
11191
  const key = `alpha_${tableA}`;
11192
11192
  value = __privateGet(this, _DOMFilterFactory_instances, cache_get).get(key);
11193
11193
  if (value) {
11194
- __privateGet(this, _DOMFilterFactory_instances, cache_get).set(map2, value);
11194
+ __privateGet(this, _DOMFilterFactory_instances, cache_get).set(map3, value);
11195
11195
  return value;
11196
11196
  }
11197
11197
  const id = `g_${__privateGet(this, _docId)}_alpha_map_${__privateWrapper(this, _id)._++}`;
11198
11198
  const url = `url(#${id})`;
11199
- __privateGet(this, _DOMFilterFactory_instances, cache_get).set(map2, url);
11199
+ __privateGet(this, _DOMFilterFactory_instances, cache_get).set(map3, url);
11200
11200
  __privateGet(this, _DOMFilterFactory_instances, cache_get).set(key, url);
11201
11201
  const filter = __privateMethod(this, _DOMFilterFactory_instances, createFilter_fn).call(this, id);
11202
11202
  __privateMethod(this, _DOMFilterFactory_instances, addTransferMapAlphaConversion_fn).call(this, tableA, filter);
11203
11203
  return url;
11204
11204
  }
11205
- addLuminosityFilter(map2) {
11206
- let value = __privateGet(this, _DOMFilterFactory_instances, cache_get).get(map2 || "luminosity");
11205
+ addLuminosityFilter(map3) {
11206
+ let value = __privateGet(this, _DOMFilterFactory_instances, cache_get).get(map3 || "luminosity");
11207
11207
  if (value) {
11208
11208
  return value;
11209
11209
  }
11210
11210
  let tableA, key;
11211
- if (map2) {
11212
- [tableA] = __privateMethod(this, _DOMFilterFactory_instances, createTables_fn).call(this, [map2]);
11211
+ if (map3) {
11212
+ [tableA] = __privateMethod(this, _DOMFilterFactory_instances, createTables_fn).call(this, [map3]);
11213
11213
  key = `luminosity_${tableA}`;
11214
11214
  } else {
11215
11215
  key = "luminosity";
11216
11216
  }
11217
11217
  value = __privateGet(this, _DOMFilterFactory_instances, cache_get).get(key);
11218
11218
  if (value) {
11219
- __privateGet(this, _DOMFilterFactory_instances, cache_get).set(map2, value);
11219
+ __privateGet(this, _DOMFilterFactory_instances, cache_get).set(map3, value);
11220
11220
  return value;
11221
11221
  }
11222
11222
  const id = `g_${__privateGet(this, _docId)}_luminosity_map_${__privateWrapper(this, _id)._++}`;
11223
11223
  const url = `url(#${id})`;
11224
- __privateGet(this, _DOMFilterFactory_instances, cache_get).set(map2, url);
11224
+ __privateGet(this, _DOMFilterFactory_instances, cache_get).set(map3, url);
11225
11225
  __privateGet(this, _DOMFilterFactory_instances, cache_get).set(key, url);
11226
11226
  const filter = __privateMethod(this, _DOMFilterFactory_instances, createFilter_fn).call(this, id);
11227
11227
  __privateMethod(this, _DOMFilterFactory_instances, addLuminosityConversion_fn).call(this, filter);
11228
- if (map2) {
11228
+ if (map3) {
11229
11229
  __privateMethod(this, _DOMFilterFactory_instances, addTransferMapAlphaConversion_fn).call(this, tableA, filter);
11230
11230
  }
11231
11231
  return url;
@@ -12134,7 +12134,7 @@ class CommandManager {
12134
12134
  }
12135
12135
  add({
12136
12136
  cmd,
12137
- undo,
12137
+ undo: undo2,
12138
12138
  post,
12139
12139
  mustExec,
12140
12140
  type: type2 = NaN,
@@ -12149,7 +12149,7 @@ class CommandManager {
12149
12149
  }
12150
12150
  const save = {
12151
12151
  cmd,
12152
- undo,
12152
+ undo: undo2,
12153
12153
  post,
12154
12154
  type: type2
12155
12155
  };
@@ -12185,10 +12185,10 @@ class CommandManager {
12185
12185
  }
12186
12186
  __privateSet(this, _locked, true);
12187
12187
  const {
12188
- undo,
12188
+ undo: undo2,
12189
12189
  post
12190
12190
  } = __privateGet(this, _commands)[__privateGet(this, _position)];
12191
- undo();
12191
+ undo2();
12192
12192
  post?.();
12193
12193
  __privateSet(this, _locked, false);
12194
12194
  __privateSet(this, _position, __privateGet(this, _position) - 1);
@@ -12711,14 +12711,14 @@ let AnnotationEditorUIManager$1 = (_c = class {
12711
12711
  }
12712
12712
  __privateMethod(this, _AnnotationEditorUIManager_instances, selectEditors_fn).call(this, newEditors);
12713
12713
  };
12714
- const undo = () => {
12714
+ const undo2 = () => {
12715
12715
  for (const editor of newEditors) {
12716
12716
  editor.remove();
12717
12717
  }
12718
12718
  };
12719
12719
  this.addCommands({
12720
12720
  cmd,
12721
- undo,
12721
+ undo: undo2,
12722
12722
  mustExec: true
12723
12723
  });
12724
12724
  } catch (ex) {
@@ -13054,14 +13054,14 @@ let AnnotationEditorUIManager$1 = (_c = class {
13054
13054
  editor.remove();
13055
13055
  }
13056
13056
  };
13057
- const undo = () => {
13057
+ const undo2 = () => {
13058
13058
  for (const editor of editors) {
13059
13059
  __privateMethod(this, _AnnotationEditorUIManager_instances, addEditorToLayer_fn).call(this, editor);
13060
13060
  }
13061
13061
  };
13062
13062
  this.addCommands({
13063
13063
  cmd,
13064
- undo,
13064
+ undo: undo2,
13065
13065
  mustExec: true
13066
13066
  });
13067
13067
  }
@@ -13157,14 +13157,14 @@ let AnnotationEditorUIManager$1 = (_c = class {
13157
13157
  return false;
13158
13158
  }
13159
13159
  this.disableUserSelect(false);
13160
- const map2 = __privateGet(this, _draggingEditors);
13160
+ const map3 = __privateGet(this, _draggingEditors);
13161
13161
  __privateSet(this, _draggingEditors, null);
13162
13162
  let mustBeAddedInUndoStack = false;
13163
13163
  for (const [{
13164
13164
  x,
13165
13165
  y,
13166
13166
  pageIndex
13167
- }, value] of map2) {
13167
+ }, value] of map3) {
13168
13168
  value.newX = x;
13169
13169
  value.newY = y;
13170
13170
  value.newPageIndex = pageIndex;
@@ -13191,7 +13191,7 @@ let AnnotationEditorUIManager$1 = (_c = class {
13191
13191
  newX,
13192
13192
  newY,
13193
13193
  newPageIndex
13194
- }] of map2) {
13194
+ }] of map3) {
13195
13195
  move(editor, newX, newY, newPageIndex);
13196
13196
  }
13197
13197
  },
@@ -13200,7 +13200,7 @@ let AnnotationEditorUIManager$1 = (_c = class {
13200
13200
  savedX,
13201
13201
  savedY,
13202
13202
  savedPageIndex
13203
- }] of map2) {
13203
+ }] of map3) {
13204
13204
  move(editor, savedX, savedY, savedPageIndex);
13205
13205
  }
13206
13206
  },
@@ -14993,26 +14993,26 @@ class AnnotationStorage {
14993
14993
  if (__privateGet(this, _storage).size === 0) {
14994
14994
  return SerializableEmpty;
14995
14995
  }
14996
- const map2 = /* @__PURE__ */ new Map(), hash = new MurmurHash3_64(), transfer = [];
14996
+ const map3 = /* @__PURE__ */ new Map(), hash = new MurmurHash3_64(), transfer = [];
14997
14997
  const context = /* @__PURE__ */ Object.create(null);
14998
14998
  let hasBitmap = false;
14999
14999
  for (const [key, val] of __privateGet(this, _storage)) {
15000
15000
  const serialized = val instanceof AnnotationEditor ? val.serialize(false, context) : val;
15001
15001
  if (serialized) {
15002
- map2.set(key, serialized);
15002
+ map3.set(key, serialized);
15003
15003
  hash.update(`${key}:${JSON.stringify(serialized)}`);
15004
15004
  hasBitmap || (hasBitmap = !!serialized.bitmap);
15005
15005
  }
15006
15006
  }
15007
15007
  if (hasBitmap) {
15008
- for (const value of map2.values()) {
15008
+ for (const value of map3.values()) {
15009
15009
  if (value.bitmap) {
15010
15010
  transfer.push(value.bitmap);
15011
15011
  }
15012
15012
  }
15013
15013
  }
15014
- return map2.size > 0 ? {
15015
- map: map2,
15014
+ return map3.size > 0 ? {
15015
+ map: map3,
15016
15016
  hash: hash.hexdigest(),
15017
15017
  transfer
15018
15018
  } : SerializableEmpty;
@@ -15035,15 +15035,15 @@ class AnnotationStorage {
15035
15035
  typeToEditor.set(type2, Object.getPrototypeOf(value).constructor);
15036
15036
  }
15037
15037
  stats || (stats = /* @__PURE__ */ Object.create(null));
15038
- const map2 = stats[type2] || (stats[type2] = /* @__PURE__ */ new Map());
15038
+ const map3 = stats[type2] || (stats[type2] = /* @__PURE__ */ new Map());
15039
15039
  for (const [key, val] of Object.entries(editorStats)) {
15040
15040
  if (key === "type") {
15041
15041
  continue;
15042
15042
  }
15043
- let counters = map2.get(key);
15043
+ let counters = map3.get(key);
15044
15044
  if (!counters) {
15045
15045
  counters = /* @__PURE__ */ new Map();
15046
- map2.set(key, counters);
15046
+ map3.set(key, counters);
15047
15047
  }
15048
15048
  const count = counters.get(val) ?? 0;
15049
15049
  counters.set(val, count + 1);
@@ -15071,11 +15071,11 @@ class PrintAnnotationStorage extends AnnotationStorage {
15071
15071
  super();
15072
15072
  __privateAdd(this, _serializable);
15073
15073
  const {
15074
- map: map2,
15074
+ map: map3,
15075
15075
  hash,
15076
15076
  transfer
15077
15077
  } = parent.serializable;
15078
- const clone = structuredClone(map2, transfer ? {
15078
+ const clone = structuredClone(map3, transfer ? {
15079
15079
  transfer
15080
15080
  } : null);
15081
15081
  __privateSet(this, _serializable, {
@@ -15454,8 +15454,8 @@ if (isNodeJS) {
15454
15454
  path2d
15455
15455
  }));
15456
15456
  };
15457
- loadPackages().then((map2) => {
15458
- packageMap = map2;
15457
+ loadPackages().then((map3) => {
15458
+ packageMap = map3;
15459
15459
  packageCapability.resolve();
15460
15460
  }, (reason) => {
15461
15461
  warn(`loadPackages: ${reason}`);
@@ -17847,9 +17847,9 @@ const _CanvasGraphics = class _CanvasGraphics {
17847
17847
  }
17848
17848
  const width = imgData.width;
17849
17849
  const height = imgData.height;
17850
- const map2 = [];
17850
+ const map3 = [];
17851
17851
  for (let i = 0, ii = positions.length; i < ii; i += 2) {
17852
- map2.push({
17852
+ map3.push({
17853
17853
  transform: [scaleX, 0, 0, scaleY, positions[i], positions[i + 1]],
17854
17854
  x: 0,
17855
17855
  y: 0,
@@ -17857,7 +17857,7 @@ const _CanvasGraphics = class _CanvasGraphics {
17857
17857
  h: height
17858
17858
  });
17859
17859
  }
17860
- this.paintInlineImageXObjectGroup(imgData, map2);
17860
+ this.paintInlineImageXObjectGroup(imgData, map3);
17861
17861
  }
17862
17862
  applyTransferMapsToCanvas(ctx) {
17863
17863
  if (this.current.transferMaps !== "none") {
@@ -17917,7 +17917,7 @@ const _CanvasGraphics = class _CanvasGraphics {
17917
17917
  this.compose();
17918
17918
  this.restore();
17919
17919
  }
17920
- paintInlineImageXObjectGroup(imgData, map2) {
17920
+ paintInlineImageXObjectGroup(imgData, map3) {
17921
17921
  if (!this.contentVisible) {
17922
17922
  return;
17923
17923
  }
@@ -17933,7 +17933,7 @@ const _CanvasGraphics = class _CanvasGraphics {
17933
17933
  putBinaryImageData(tmpCtx, imgData);
17934
17934
  imgToPaint = this.applyTransferMapsToCanvas(tmpCtx);
17935
17935
  }
17936
- for (const entry of map2) {
17936
+ for (const entry of map3) {
17937
17937
  ctx.save();
17938
17938
  ctx.transform(...entry.transform);
17939
17939
  ctx.scale(1, -1);
@@ -21346,14 +21346,14 @@ class PDFPageProxy {
21346
21346
  annotationStorageSerializable
21347
21347
  }) {
21348
21348
  const {
21349
- map: map2,
21349
+ map: map3,
21350
21350
  transfer
21351
21351
  } = annotationStorageSerializable;
21352
21352
  const readableStream = this._transport.messageHandler.sendWithStream("GetOperatorList", {
21353
21353
  pageIndex: this._pageIndex,
21354
21354
  intent: renderingIntent,
21355
21355
  cacheKey,
21356
- annotationStorage: map2
21356
+ annotationStorage: map3
21357
21357
  }, transfer);
21358
21358
  const reader = readableStream.getReader();
21359
21359
  const intentState = this._intentStates.get(cacheKey);
@@ -22124,13 +22124,13 @@ class WorkerTransport {
22124
22124
  warn("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");
22125
22125
  }
22126
22126
  const {
22127
- map: map2,
22127
+ map: map3,
22128
22128
  transfer
22129
22129
  } = this.annotationStorage.serializable;
22130
22130
  return this.messageHandler.sendWithPromise("SaveDocument", {
22131
22131
  isPureXfa: !!this._htmlForXfa,
22132
22132
  numPages: this._numPages,
22133
- annotationStorage: map2,
22133
+ annotationStorage: map3,
22134
22134
  filename: this._fullReader?.filename ?? null
22135
22135
  }, transfer).finally(() => {
22136
22136
  this.annotationStorage.resetModified();
@@ -23455,9 +23455,9 @@ class LinkAnnotationElement extends AnnotationElement {
23455
23455
  }
23456
23456
  _bindJSAction(link, data2) {
23457
23457
  link.href = this.linkService.getAnchorUrl("");
23458
- const map2 = /* @__PURE__ */ new Map([["Action", "onclick"], ["Mouse Up", "onmouseup"], ["Mouse Down", "onmousedown"]]);
23458
+ const map3 = /* @__PURE__ */ new Map([["Action", "onclick"], ["Mouse Up", "onmouseup"], ["Mouse Down", "onmousedown"]]);
23459
23459
  for (const name of Object.keys(data2.actions)) {
23460
- const jsName = map2.get(name);
23460
+ const jsName = map3.get(name);
23461
23461
  if (!jsName) {
23462
23462
  continue;
23463
23463
  }
@@ -27923,7 +27923,7 @@ stopDrawing_fn = function(x, y) {
27923
27923
  this.bezierPath2D.push(path2D);
27924
27924
  this._uiManager.rebuild(this);
27925
27925
  };
27926
- const undo = () => {
27926
+ const undo2 = () => {
27927
27927
  this.allRawPaths.pop();
27928
27928
  this.paths.pop();
27929
27929
  this.bezierPath2D.pop();
@@ -27939,7 +27939,7 @@ stopDrawing_fn = function(x, y) {
27939
27939
  };
27940
27940
  this.addCommands({
27941
27941
  cmd,
27942
- undo,
27942
+ undo: undo2,
27943
27943
  mustExec: true
27944
27944
  });
27945
27945
  };
@@ -29013,12 +29013,12 @@ let AnnotationEditorLayer$1 = (_j = class {
29013
29013
  }
29014
29014
  addUndoableEditor(editor) {
29015
29015
  const cmd = () => editor._uiManager.rebuild(editor);
29016
- const undo = () => {
29016
+ const undo2 = () => {
29017
29017
  editor.remove();
29018
29018
  };
29019
29019
  this.addCommands({
29020
29020
  cmd,
29021
- undo,
29021
+ undo: undo2,
29022
29022
  mustExec: false
29023
29023
  });
29024
29024
  }
@@ -40044,8 +40044,8 @@ function isKeyable(value) {
40044
40044
  var type2 = typeof value;
40045
40045
  return type2 == "string" || type2 == "number" || type2 == "symbol" || type2 == "boolean" ? value !== "__proto__" : value === null;
40046
40046
  }
40047
- function getMapData(map2, key) {
40048
- var data2 = map2.__data__;
40047
+ function getMapData(map3, key) {
40048
+ var data2 = map3.__data__;
40049
40049
  return isKeyable(key) ? data2[typeof key == "string" ? "string" : "hash"] : data2.map;
40050
40050
  }
40051
40051
  function mapCacheDelete(key) {
@@ -41723,10 +41723,10 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
41723
41723
  }
41724
41724
  return allocUnsafe(arg);
41725
41725
  }
41726
- return from(arg, encodingOrOffset, length);
41726
+ return from2(arg, encodingOrOffset, length);
41727
41727
  }
41728
41728
  Buffer3.poolSize = 8192;
41729
- function from(value, encodingOrOffset, length) {
41729
+ function from2(value, encodingOrOffset, length) {
41730
41730
  if (typeof value === "string") {
41731
41731
  return fromString(value, encodingOrOffset);
41732
41732
  }
@@ -41763,7 +41763,7 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
41763
41763
  );
41764
41764
  }
41765
41765
  Buffer3.from = function(value, encodingOrOffset, length) {
41766
- return from(value, encodingOrOffset, length);
41766
+ return from2(value, encodingOrOffset, length);
41767
41767
  };
41768
41768
  Object.setPrototypeOf(Buffer3.prototype, GlobalUint8Array.prototype);
41769
41769
  Object.setPrototypeOf(Buffer3, GlobalUint8Array);
@@ -42479,7 +42479,7 @@ ieee754.write = function(buffer2, value, offset, isLE, mLen, nBytes) {
42479
42479
  }
42480
42480
  return res;
42481
42481
  }
42482
- Buffer3.prototype.slice = function slice(start, end) {
42482
+ Buffer3.prototype.slice = function slice2(start, end) {
42483
42483
  const len = this.length;
42484
42484
  start = ~~start;
42485
42485
  end = end === void 0 ? len : ~~end;
@@ -43398,7 +43398,7 @@ function requireEvents() {
43398
43398
  }
43399
43399
  return true;
43400
43400
  };
43401
- function _addListener(target, type2, listener, prepend) {
43401
+ function _addListener(target, type2, listener, prepend2) {
43402
43402
  var m;
43403
43403
  var events2;
43404
43404
  var existing;
@@ -43423,8 +43423,8 @@ function requireEvents() {
43423
43423
  ++target._eventsCount;
43424
43424
  } else {
43425
43425
  if (typeof existing === "function") {
43426
- existing = events2[type2] = prepend ? [listener, existing] : [existing, listener];
43427
- } else if (prepend) {
43426
+ existing = events2[type2] = prepend2 ? [listener, existing] : [existing, listener];
43427
+ } else if (prepend2) {
43428
43428
  existing.unshift(listener);
43429
43429
  } else {
43430
43430
  existing.push(listener);
@@ -43806,16 +43806,16 @@ process$1.nextTick = function(fun) {
43806
43806
  args[i - 1] = arguments[i];
43807
43807
  }
43808
43808
  }
43809
- queue.push(new Item(fun, args));
43809
+ queue.push(new Item$1(fun, args));
43810
43810
  if (queue.length === 1 && !draining) {
43811
43811
  runTimeout(drainQueue);
43812
43812
  }
43813
43813
  };
43814
- function Item(fun, array) {
43814
+ function Item$1(fun, array) {
43815
43815
  this.fun = fun;
43816
43816
  this.array = array;
43817
43817
  }
43818
- Item.prototype.run = function() {
43818
+ Item$1.prototype.run = function() {
43819
43819
  this.fun.apply(null, this.array);
43820
43820
  };
43821
43821
  process$1.title = "browser";
@@ -44866,7 +44866,7 @@ function requireForEach() {
44866
44866
  }
44867
44867
  }
44868
44868
  };
44869
- var forEach = function forEach2(list, iterator, thisArg) {
44869
+ var forEach2 = function forEach3(list, iterator, thisArg) {
44870
44870
  if (!isCallable2(iterator)) {
44871
44871
  throw new TypeError("iterator must be a function");
44872
44872
  }
@@ -44882,7 +44882,7 @@ function requireForEach() {
44882
44882
  forEachObject(list, iterator, receiver);
44883
44883
  }
44884
44884
  };
44885
- forEach_1 = forEach;
44885
+ forEach_1 = forEach2;
44886
44886
  return forEach_1;
44887
44887
  }
44888
44888
  var possibleTypedArrayNames;
@@ -44928,7 +44928,7 @@ var hasRequiredWhichTypedArray;
44928
44928
  function requireWhichTypedArray() {
44929
44929
  if (hasRequiredWhichTypedArray) return whichTypedArray;
44930
44930
  hasRequiredWhichTypedArray = 1;
44931
- var forEach = requireForEach();
44931
+ var forEach2 = requireForEach();
44932
44932
  var availableTypedArrays2 = requireAvailableTypedArrays();
44933
44933
  var callBind2 = requireCallBind();
44934
44934
  var callBound2 = requireCallBound();
@@ -44949,7 +44949,7 @@ function requireWhichTypedArray() {
44949
44949
  };
44950
44950
  var cache2 = { __proto__: null };
44951
44951
  if (hasToStringTag && gOPD && getPrototypeOf) {
44952
- forEach(typedArrays, function(typedArray) {
44952
+ forEach2(typedArrays, function(typedArray) {
44953
44953
  var arr = new g[typedArray]();
44954
44954
  if (Symbol.toStringTag in arr) {
44955
44955
  var proto = getPrototypeOf(arr);
@@ -44962,7 +44962,7 @@ function requireWhichTypedArray() {
44962
44962
  }
44963
44963
  });
44964
44964
  } else {
44965
- forEach(typedArrays, function(typedArray) {
44965
+ forEach2(typedArrays, function(typedArray) {
44966
44966
  var arr = new g[typedArray]();
44967
44967
  var fn = arr.slice || arr.set;
44968
44968
  if (fn) {
@@ -44972,7 +44972,7 @@ function requireWhichTypedArray() {
44972
44972
  }
44973
44973
  var tryTypedArrays = function tryAllTypedArrays(value) {
44974
44974
  var found2 = false;
44975
- forEach(
44975
+ forEach2(
44976
44976
  // eslint-disable-next-line no-extra-parens
44977
44977
  /** @type {Record<`\$${TypedArrayName}`, Getter>} */
44978
44978
  /** @type {any} */
@@ -44993,7 +44993,7 @@ function requireWhichTypedArray() {
44993
44993
  };
44994
44994
  var trySlices = function tryAllSlices(value) {
44995
44995
  var found2 = false;
44996
- forEach(
44996
+ forEach2(
44997
44997
  // eslint-disable-next-line no-extra-parens
44998
44998
  /** @type {Record<`\$${TypedArrayName}`, Getter>} */
44999
44999
  /** @type {any} */
@@ -46524,7 +46524,7 @@ function require_stream_writable() {
46524
46524
  // because otherwise some prototype manipulation in
46525
46525
  // userland will fail
46526
46526
  enumerable: false,
46527
- get: function get2() {
46527
+ get: function get22() {
46528
46528
  return this._writableState && this._writableState.getBuffer();
46529
46529
  }
46530
46530
  });
@@ -46539,7 +46539,7 @@ function require_stream_writable() {
46539
46539
  // because otherwise some prototype manipulation in
46540
46540
  // userland will fail
46541
46541
  enumerable: false,
46542
- get: function get2() {
46542
+ get: function get22() {
46543
46543
  return this._writableState.highWaterMark;
46544
46544
  }
46545
46545
  });
@@ -46709,7 +46709,7 @@ function require_stream_writable() {
46709
46709
  // because otherwise some prototype manipulation in
46710
46710
  // userland will fail
46711
46711
  enumerable: false,
46712
- get: function get2() {
46712
+ get: function get22() {
46713
46713
  return this._writableState.length;
46714
46714
  }
46715
46715
  });
@@ -46782,7 +46782,7 @@ function require_stream_writable() {
46782
46782
  // because otherwise some prototype manipulation in
46783
46783
  // userland will fail
46784
46784
  enumerable: false,
46785
- get: function get2() {
46785
+ get: function get22() {
46786
46786
  if (this._writableState === void 0) {
46787
46787
  return false;
46788
46788
  }
@@ -46842,7 +46842,7 @@ function require_stream_duplex() {
46842
46842
  // because otherwise some prototype manipulation in
46843
46843
  // userland will fail
46844
46844
  enumerable: false,
46845
- get: function get2() {
46845
+ get: function get22() {
46846
46846
  return this._writableState.highWaterMark;
46847
46847
  }
46848
46848
  });
@@ -46851,7 +46851,7 @@ function require_stream_duplex() {
46851
46851
  // because otherwise some prototype manipulation in
46852
46852
  // userland will fail
46853
46853
  enumerable: false,
46854
- get: function get2() {
46854
+ get: function get22() {
46855
46855
  return this._writableState && this._writableState.getBuffer();
46856
46856
  }
46857
46857
  });
@@ -46860,7 +46860,7 @@ function require_stream_duplex() {
46860
46860
  // because otherwise some prototype manipulation in
46861
46861
  // userland will fail
46862
46862
  enumerable: false,
46863
- get: function get2() {
46863
+ get: function get22() {
46864
46864
  return this._writableState.length;
46865
46865
  }
46866
46866
  });
@@ -46876,7 +46876,7 @@ function require_stream_duplex() {
46876
46876
  // because otherwise some prototype manipulation in
46877
46877
  // userland will fail
46878
46878
  enumerable: false,
46879
- get: function get2() {
46879
+ get: function get22() {
46880
46880
  if (this._readableState === void 0 || this._writableState === void 0) {
46881
46881
  return false;
46882
46882
  }
@@ -47508,7 +47508,7 @@ function require_stream_readable() {
47508
47508
  var _require$codes = requireErrorsBrowser().codes, ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF, ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;
47509
47509
  var StringDecoder;
47510
47510
  var createReadableStreamAsyncIterator;
47511
- var from;
47511
+ var from2;
47512
47512
  requireInherits_browser()(Readable, Stream);
47513
47513
  var errorOrDestroy = destroyImpl.errorOrDestroy;
47514
47514
  var kProxyEvents = ["error", "close", "destroy", "pause", "resume"];
@@ -47570,7 +47570,7 @@ function require_stream_readable() {
47570
47570
  // because otherwise some prototype manipulation in
47571
47571
  // userland will fail
47572
47572
  enumerable: false,
47573
- get: function get2() {
47573
+ get: function get22() {
47574
47574
  if (this._readableState === void 0) {
47575
47575
  return false;
47576
47576
  }
@@ -48111,7 +48111,7 @@ function require_stream_readable() {
48111
48111
  // because otherwise some prototype manipulation in
48112
48112
  // userland will fail
48113
48113
  enumerable: false,
48114
- get: function get2() {
48114
+ get: function get22() {
48115
48115
  return this._readableState.highWaterMark;
48116
48116
  }
48117
48117
  });
@@ -48120,7 +48120,7 @@ function require_stream_readable() {
48120
48120
  // because otherwise some prototype manipulation in
48121
48121
  // userland will fail
48122
48122
  enumerable: false,
48123
- get: function get2() {
48123
+ get: function get22() {
48124
48124
  return this._readableState && this._readableState.buffer;
48125
48125
  }
48126
48126
  });
@@ -48129,7 +48129,7 @@ function require_stream_readable() {
48129
48129
  // because otherwise some prototype manipulation in
48130
48130
  // userland will fail
48131
48131
  enumerable: false,
48132
- get: function get2() {
48132
+ get: function get22() {
48133
48133
  return this._readableState.flowing;
48134
48134
  },
48135
48135
  set: function set2(state2) {
@@ -48144,7 +48144,7 @@ function require_stream_readable() {
48144
48144
  // because otherwise some prototype manipulation in
48145
48145
  // userland will fail
48146
48146
  enumerable: false,
48147
- get: function get2() {
48147
+ get: function get22() {
48148
48148
  return this._readableState.length;
48149
48149
  }
48150
48150
  });
@@ -48186,10 +48186,10 @@ function require_stream_readable() {
48186
48186
  }
48187
48187
  if (typeof Symbol === "function") {
48188
48188
  Readable.from = function(iterable, opts) {
48189
- if (from === void 0) {
48190
- from = requireFromBrowser();
48189
+ if (from2 === void 0) {
48190
+ from2 = requireFromBrowser();
48191
48191
  }
48192
- return from(Readable, iterable, opts);
48192
+ return from2(Readable, iterable, opts);
48193
48193
  };
48194
48194
  }
48195
48195
  function indexOf(xs, x) {
@@ -48363,8 +48363,8 @@ function requirePipeline() {
48363
48363
  function call2(fn) {
48364
48364
  fn();
48365
48365
  }
48366
- function pipe(from, to) {
48367
- return from.pipe(to);
48366
+ function pipe(from2, to) {
48367
+ return from2.pipe(to);
48368
48368
  }
48369
48369
  function popCallback(streams) {
48370
48370
  if (!streams.length) return noop2;
@@ -50925,16 +50925,16 @@ _SuperConverter_instances = /* @__PURE__ */ new WeakSet();
50925
50925
  handleListNode_fn = function(node, listItems, listLevel = 0) {
50926
50926
  const parsedListItems = [];
50927
50927
  let overallListType;
50928
- for (let item of listItems) {
50928
+ for (let [index, item] of listItems.entries()) {
50929
50929
  if (item.seen) continue;
50930
50930
  const { attributes, elements, marks = [] } = this._parseProperties(item);
50931
50931
  const { listType, ilvl } = this._getNodeListType(attributes);
50932
50932
  const intLevel = parseInt(ilvl);
50933
50933
  if (listLevel > intLevel) continue;
50934
50934
  const content = [];
50935
+ const sublist = {};
50935
50936
  if (listLevel < intLevel) {
50936
- const sublist = __privateMethod2(this, _SuperConverter_instances, handleListNode_fn).call(this, item, listItems, listLevel + 1);
50937
- content.push(sublist);
50937
+ Object.assign(sublist, __privateMethod2(this, _SuperConverter_instances, handleListNode_fn).call(this, item, listItems, listLevel + 1));
50938
50938
  } else {
50939
50939
  overallListType = listType;
50940
50940
  item.seen = true;
@@ -50944,7 +50944,12 @@ handleListNode_fn = function(node, listItems, listLevel = 0) {
50944
50944
  if (schemaNode) content.push(schemaNode);
50945
50945
  }
50946
50946
  }
50947
- parsedListItems.push(__privateMethod2(this, _SuperConverter_instances, createListItem_fn).call(this, content, attributes, marks));
50947
+ if (Object.keys(sublist).length) {
50948
+ const item2 = parsedListItems[index - 1];
50949
+ item2?.content.push(sublist);
50950
+ } else {
50951
+ parsedListItems.push(__privateMethod2(this, _SuperConverter_instances, createListItem_fn).call(this, content, attributes, marks));
50952
+ }
50948
50953
  }
50949
50954
  node.seen = true;
50950
50955
  return {
@@ -53464,27 +53469,27 @@ OrderedMap.prototype = {
53464
53469
  // :: (union<Object, OrderedMap>) → OrderedMap
53465
53470
  // Create a new map by prepending the keys in this map that don't
53466
53471
  // appear in `map` before the keys in `map`.
53467
- prepend: function(map2) {
53468
- map2 = OrderedMap.from(map2);
53469
- if (!map2.size) return this;
53470
- return new OrderedMap(map2.content.concat(this.subtract(map2).content));
53472
+ prepend: function(map22) {
53473
+ map22 = OrderedMap.from(map22);
53474
+ if (!map22.size) return this;
53475
+ return new OrderedMap(map22.content.concat(this.subtract(map22).content));
53471
53476
  },
53472
53477
  // :: (union<Object, OrderedMap>) → OrderedMap
53473
53478
  // Create a new map by appending the keys in this map that don't
53474
53479
  // appear in `map` after the keys in `map`.
53475
- append: function(map2) {
53476
- map2 = OrderedMap.from(map2);
53477
- if (!map2.size) return this;
53478
- return new OrderedMap(this.subtract(map2).content.concat(map2.content));
53480
+ append: function(map22) {
53481
+ map22 = OrderedMap.from(map22);
53482
+ if (!map22.size) return this;
53483
+ return new OrderedMap(this.subtract(map22).content.concat(map22.content));
53479
53484
  },
53480
53485
  // :: (union<Object, OrderedMap>) → OrderedMap
53481
53486
  // Create a map containing all the keys in this map that don't
53482
53487
  // appear in `map`.
53483
- subtract: function(map2) {
53488
+ subtract: function(map22) {
53484
53489
  var result = this;
53485
- map2 = OrderedMap.from(map2);
53486
- for (var i = 0; i < map2.content.length; i += 2)
53487
- result = result.remove(map2.content[i]);
53490
+ map22 = OrderedMap.from(map22);
53491
+ for (var i = 0; i < map22.content.length; i += 2)
53492
+ result = result.remove(map22.content[i]);
53488
53493
  return result;
53489
53494
  },
53490
53495
  // :: () → Object
@@ -53578,12 +53583,12 @@ class Fragment {
53578
53583
  positions (relative to start of this fragment). Doesn't descend
53579
53584
  into a node when the callback returns `false`.
53580
53585
  */
53581
- nodesBetween(from, to, f, nodeStart = 0, parent) {
53586
+ nodesBetween(from2, to, f, nodeStart = 0, parent) {
53582
53587
  for (let i = 0, pos = 0; pos < to; i++) {
53583
53588
  let child = this.content[i], end = pos + child.nodeSize;
53584
- if (end > from && f(child, nodeStart + pos, parent || null, i) !== false && child.content.size) {
53589
+ if (end > from2 && f(child, nodeStart + pos, parent || null, i) !== false && child.content.size) {
53585
53590
  let start = pos + 1;
53586
- child.nodesBetween(Math.max(0, from - start), Math.min(child.content.size, to - start), f, nodeStart + start);
53591
+ child.nodesBetween(Math.max(0, from2 - start), Math.min(child.content.size, to - start), f, nodeStart + start);
53587
53592
  }
53588
53593
  pos = end;
53589
53594
  }
@@ -53600,10 +53605,10 @@ class Fragment {
53600
53605
  Extract the text between `from` and `to`. See the same method on
53601
53606
  [`Node`](https://prosemirror.net/docs/ref/#model.Node.textBetween).
53602
53607
  */
53603
- textBetween(from, to, blockSeparator, leafText) {
53608
+ textBetween(from2, to, blockSeparator, leafText) {
53604
53609
  let text = "", first = true;
53605
- this.nodesBetween(from, to, (node, pos) => {
53606
- let nodeText = node.isText ? node.text.slice(Math.max(from, pos) - pos, to - pos) : !node.isLeaf ? "" : leafText ? typeof leafText === "function" ? leafText(node) : leafText : node.type.spec.leafText ? node.type.spec.leafText(node) : "";
53610
+ this.nodesBetween(from2, to, (node, pos) => {
53611
+ let nodeText = node.isText ? node.text.slice(Math.max(from2, pos) - pos, to - pos) : !node.isLeaf ? "" : leafText ? typeof leafText === "function" ? leafText(node) : leafText : node.type.spec.leafText ? node.type.spec.leafText(node) : "";
53607
53612
  if (node.isBlock && (node.isLeaf && nodeText || node.isTextblock) && blockSeparator) {
53608
53613
  if (first)
53609
53614
  first = false;
@@ -53635,19 +53640,19 @@ class Fragment {
53635
53640
  /**
53636
53641
  Cut out the sub-fragment between the two given positions.
53637
53642
  */
53638
- cut(from, to = this.size) {
53639
- if (from == 0 && to == this.size)
53643
+ cut(from2, to = this.size) {
53644
+ if (from2 == 0 && to == this.size)
53640
53645
  return this;
53641
53646
  let result = [], size2 = 0;
53642
- if (to > from)
53647
+ if (to > from2)
53643
53648
  for (let i = 0, pos = 0; pos < to; i++) {
53644
53649
  let child = this.content[i], end = pos + child.nodeSize;
53645
- if (end > from) {
53646
- if (pos < from || end > to) {
53650
+ if (end > from2) {
53651
+ if (pos < from2 || end > to) {
53647
53652
  if (child.isText)
53648
- child = child.cut(Math.max(0, from - pos), Math.min(child.text.length, to - pos));
53653
+ child = child.cut(Math.max(0, from2 - pos), Math.min(child.text.length, to - pos));
53649
53654
  else
53650
- child = child.cut(Math.max(0, from - pos - 1), Math.min(child.content.size, to - pos - 1));
53655
+ child = child.cut(Math.max(0, from2 - pos - 1), Math.min(child.content.size, to - pos - 1));
53651
53656
  }
53652
53657
  result.push(child);
53653
53658
  size2 += child.nodeSize;
@@ -53659,12 +53664,12 @@ class Fragment {
53659
53664
  /**
53660
53665
  @internal
53661
53666
  */
53662
- cutByIndex(from, to) {
53663
- if (from == to)
53667
+ cutByIndex(from2, to) {
53668
+ if (from2 == to)
53664
53669
  return Fragment.empty;
53665
- if (from == 0 && to == this.content.length)
53670
+ if (from2 == 0 && to == this.content.length)
53666
53671
  return this;
53667
- return new Fragment(this.content.slice(from, to));
53672
+ return new Fragment(this.content.slice(from2, to));
53668
53673
  }
53669
53674
  /**
53670
53675
  Create a new fragment in which the node at the given index is
@@ -54040,8 +54045,8 @@ class Slice {
54040
54045
  /**
54041
54046
  @internal
54042
54047
  */
54043
- removeBetween(from, to) {
54044
- return new Slice(removeRange(this.content, from + this.openStart, to + this.openStart), this.openStart, this.openEnd);
54048
+ removeBetween(from2, to) {
54049
+ return new Slice(removeRange(this.content, from2 + this.openStart, to + this.openStart), this.openStart, this.openEnd);
54045
54050
  }
54046
54051
  /**
54047
54052
  Tests whether this slice is equal to another slice.
@@ -54093,17 +54098,17 @@ class Slice {
54093
54098
  }
54094
54099
  }
54095
54100
  Slice.empty = new Slice(Fragment.empty, 0, 0);
54096
- function removeRange(content, from, to) {
54097
- let { index, offset } = content.findIndex(from), child = content.maybeChild(index);
54101
+ function removeRange(content, from2, to) {
54102
+ let { index, offset } = content.findIndex(from2), child = content.maybeChild(index);
54098
54103
  let { index: indexTo, offset: offsetTo } = content.findIndex(to);
54099
- if (offset == from || child.isText) {
54104
+ if (offset == from2 || child.isText) {
54100
54105
  if (offsetTo != to && !content.child(indexTo).isText)
54101
54106
  throw new RangeError("Removing non-flat range");
54102
- return content.cut(0, from).append(content.cut(to));
54107
+ return content.cut(0, from2).append(content.cut(to));
54103
54108
  }
54104
54109
  if (index != indexTo)
54105
54110
  throw new RangeError("Removing non-flat range");
54106
- return content.replaceChild(index, child.copy(removeRange(child.content, from - offset - 1, to - offset - 1)));
54111
+ return content.replaceChild(index, child.copy(removeRange(child.content, from2 - offset - 1, to - offset - 1)));
54107
54112
  }
54108
54113
  function insertInto(content, dist2, insert, parent) {
54109
54114
  let { index, offset } = content.findIndex(dist2), child = content.maybeChild(index);
@@ -54113,25 +54118,25 @@ function insertInto(content, dist2, insert, parent) {
54113
54118
  let inner = insertInto(child.content, dist2 - offset - 1, insert);
54114
54119
  return inner && content.replaceChild(index, child.copy(inner));
54115
54120
  }
54116
- function replace($from, $to, slice) {
54117
- if (slice.openStart > $from.depth)
54121
+ function replace($from, $to, slice2) {
54122
+ if (slice2.openStart > $from.depth)
54118
54123
  throw new ReplaceError("Inserted content deeper than insertion position");
54119
- if ($from.depth - slice.openStart != $to.depth - slice.openEnd)
54124
+ if ($from.depth - slice2.openStart != $to.depth - slice2.openEnd)
54120
54125
  throw new ReplaceError("Inconsistent open depths");
54121
- return replaceOuter($from, $to, slice, 0);
54126
+ return replaceOuter($from, $to, slice2, 0);
54122
54127
  }
54123
- function replaceOuter($from, $to, slice, depth) {
54128
+ function replaceOuter($from, $to, slice2, depth) {
54124
54129
  let index = $from.index(depth), node = $from.node(depth);
54125
- if (index == $to.index(depth) && depth < $from.depth - slice.openStart) {
54126
- let inner = replaceOuter($from, $to, slice, depth + 1);
54130
+ if (index == $to.index(depth) && depth < $from.depth - slice2.openStart) {
54131
+ let inner = replaceOuter($from, $to, slice2, depth + 1);
54127
54132
  return node.copy(node.content.replaceChild(index, inner));
54128
- } else if (!slice.content.size) {
54133
+ } else if (!slice2.content.size) {
54129
54134
  return close(node, replaceTwoWay($from, $to, depth));
54130
- } else if (!slice.openStart && !slice.openEnd && $from.depth == depth && $to.depth == depth) {
54135
+ } else if (!slice2.openStart && !slice2.openEnd && $from.depth == depth && $to.depth == depth) {
54131
54136
  let parent = $from.parent, content = parent.content;
54132
- return close(parent, content.cut(0, $from.parentOffset).append(slice.content).append(content.cut($to.parentOffset)));
54137
+ return close(parent, content.cut(0, $from.parentOffset).append(slice2.content).append(content.cut($to.parentOffset)));
54133
54138
  } else {
54134
- let { start, end } = prepareSliceForReplace(slice, $from);
54139
+ let { start, end } = prepareSliceForReplace(slice2, $from);
54135
54140
  return close(node, replaceThreeWay($from, start, end, $to, depth));
54136
54141
  }
54137
54142
  }
@@ -54200,14 +54205,14 @@ function replaceTwoWay($from, $to, depth) {
54200
54205
  addRange($to, null, depth, content);
54201
54206
  return new Fragment(content);
54202
54207
  }
54203
- function prepareSliceForReplace(slice, $along) {
54204
- let extra = $along.depth - slice.openStart, parent = $along.node(extra);
54205
- let node = parent.copy(slice.content);
54208
+ function prepareSliceForReplace(slice2, $along) {
54209
+ let extra = $along.depth - slice2.openStart, parent = $along.node(extra);
54210
+ let node = parent.copy(slice2.content);
54206
54211
  for (let i = extra - 1; i >= 0; i--)
54207
54212
  node = $along.node(i).copy(Fragment.from(node));
54208
54213
  return {
54209
- start: node.resolveNoCache(slice.openStart + extra),
54210
- end: node.resolveNoCache(node.content.size - slice.openEnd - extra)
54214
+ start: node.resolveNoCache(slice2.openStart + extra),
54215
+ end: node.resolveNoCache(node.content.size - slice2.openEnd - extra)
54211
54216
  };
54212
54217
  }
54213
54218
  class ResolvedPos {
@@ -54579,8 +54584,8 @@ let Node$1 = class Node2 {
54579
54584
  recursed over. The last parameter can be used to specify a
54580
54585
  starting position to count from.
54581
54586
  */
54582
- nodesBetween(from, to, f, startPos = 0) {
54583
- this.content.nodesBetween(from, to, f, startPos, this);
54587
+ nodesBetween(from2, to, f, startPos = 0) {
54588
+ this.content.nodesBetween(from2, to, f, startPos, this);
54584
54589
  }
54585
54590
  /**
54586
54591
  Call the given callback for every descendant node. Doesn't
@@ -54603,8 +54608,8 @@ let Node$1 = class Node2 {
54603
54608
  inserted for every non-text leaf node encountered, otherwise
54604
54609
  [`leafText`](https://prosemirror.net/docs/ref/#model.NodeSpec^leafText) will be used.
54605
54610
  */
54606
- textBetween(from, to, blockSeparator, leafText) {
54607
- return this.content.textBetween(from, to, blockSeparator, leafText);
54611
+ textBetween(from2, to, blockSeparator, leafText) {
54612
+ return this.content.textBetween(from2, to, blockSeparator, leafText);
54608
54613
  }
54609
54614
  /**
54610
54615
  Returns this node's first child, or `null` if there are no
@@ -54661,19 +54666,19 @@ let Node$1 = class Node2 {
54661
54666
  given positions. If `to` is not given, it defaults to the end of
54662
54667
  the node.
54663
54668
  */
54664
- cut(from, to = this.content.size) {
54665
- if (from == 0 && to == this.content.size)
54669
+ cut(from2, to = this.content.size) {
54670
+ if (from2 == 0 && to == this.content.size)
54666
54671
  return this;
54667
- return this.copy(this.content.cut(from, to));
54672
+ return this.copy(this.content.cut(from2, to));
54668
54673
  }
54669
54674
  /**
54670
54675
  Cut out the part of the document between the given positions, and
54671
54676
  return it as a `Slice` object.
54672
54677
  */
54673
- slice(from, to = this.content.size, includeParents = false) {
54674
- if (from == to)
54678
+ slice(from2, to = this.content.size, includeParents = false) {
54679
+ if (from2 == to)
54675
54680
  return Slice.empty;
54676
- let $from = this.resolve(from), $to = this.resolve(to);
54681
+ let $from = this.resolve(from2), $to = this.resolve(to);
54677
54682
  let depth = includeParents ? 0 : $from.sharedDepth(to);
54678
54683
  let start = $from.start(depth), node = $from.node(depth);
54679
54684
  let content = node.content.cut($from.pos - start, $to.pos - start);
@@ -54687,8 +54692,8 @@ let Node$1 = class Node2 {
54687
54692
  into. If any of this is violated, an error of type
54688
54693
  [`ReplaceError`](https://prosemirror.net/docs/ref/#model.ReplaceError) is thrown.
54689
54694
  */
54690
- replace(from, to, slice) {
54691
- return replace(this.resolve(from), this.resolve(to), slice);
54695
+ replace(from2, to, slice2) {
54696
+ return replace(this.resolve(from2), this.resolve(to), slice2);
54692
54697
  }
54693
54698
  /**
54694
54699
  Find the node directly after the given position.
@@ -54744,10 +54749,10 @@ let Node$1 = class Node2 {
54744
54749
  Test whether a given mark or mark type occurs in this document
54745
54750
  between the two given positions.
54746
54751
  */
54747
- rangeHasMark(from, to, type2) {
54752
+ rangeHasMark(from2, to, type2) {
54748
54753
  let found2 = false;
54749
- if (to > from)
54750
- this.nodesBetween(from, to, (node) => {
54754
+ if (to > from2)
54755
+ this.nodesBetween(from2, to, (node) => {
54751
54756
  if (type2.isInSet(node.marks))
54752
54757
  found2 = true;
54753
54758
  return !found2;
@@ -54830,8 +54835,8 @@ let Node$1 = class Node2 {
54830
54835
  can optionally pass `start` and `end` indices into the
54831
54836
  replacement fragment.
54832
54837
  */
54833
- canReplace(from, to, replacement = Fragment.empty, start = 0, end = replacement.childCount) {
54834
- let one = this.contentMatchAt(from).matchFragment(replacement, start, end);
54838
+ canReplace(from2, to, replacement = Fragment.empty, start = 0, end = replacement.childCount) {
54839
+ let one = this.contentMatchAt(from2).matchFragment(replacement, start, end);
54835
54840
  let two = one && one.matchFragment(this.content, to);
54836
54841
  if (!two || !two.validEnd)
54837
54842
  return false;
@@ -54844,10 +54849,10 @@ let Node$1 = class Node2 {
54844
54849
  Test whether replacing the range `from` to `to` (by index) with
54845
54850
  a node of the given type would leave the node's content valid.
54846
54851
  */
54847
- canReplaceWith(from, to, type2, marks) {
54852
+ canReplaceWith(from2, to, type2, marks) {
54848
54853
  if (marks && !this.type.allowsMarks(marks))
54849
54854
  return false;
54850
- let start = this.contentMatchAt(from).matchType(type2);
54855
+ let start = this.contentMatchAt(from2).matchType(type2);
54851
54856
  let end = start && start.matchFragment(this.content, to);
54852
54857
  return end ? end.validEnd : false;
54853
54858
  }
@@ -54931,8 +54936,8 @@ class TextNode extends Node$1 {
54931
54936
  get textContent() {
54932
54937
  return this.text;
54933
54938
  }
54934
- textBetween(from, to) {
54935
- return this.text.slice(from, to);
54939
+ textBetween(from2, to) {
54940
+ return this.text.slice(from2, to);
54936
54941
  }
54937
54942
  get nodeSize() {
54938
54943
  return this.text.length;
@@ -54945,10 +54950,10 @@ class TextNode extends Node$1 {
54945
54950
  return this;
54946
54951
  return new TextNode(this.type, this.attrs, text, this.marks);
54947
54952
  }
54948
- cut(from = 0, to = this.text.length) {
54949
- if (from == 0 && to == this.text.length)
54953
+ cut(from2 = 0, to = this.text.length) {
54954
+ if (from2 == 0 && to == this.text.length)
54950
54955
  return this;
54951
- return this.withText(this.text.slice(from, to));
54956
+ return this.withText(this.text.slice(from2, to));
54952
54957
  }
54953
54958
  eq(other) {
54954
54959
  return this.sameMarkup(other) && this.text == other.text;
@@ -55248,38 +55253,38 @@ function nfa(expr) {
55248
55253
  function node() {
55249
55254
  return nfa2.push([]) - 1;
55250
55255
  }
55251
- function edge(from, to, term) {
55256
+ function edge(from2, to, term) {
55252
55257
  let edge2 = { term, to };
55253
- nfa2[from].push(edge2);
55258
+ nfa2[from2].push(edge2);
55254
55259
  return edge2;
55255
55260
  }
55256
55261
  function connect(edges, to) {
55257
55262
  edges.forEach((edge2) => edge2.to = to);
55258
55263
  }
55259
- function compile2(expr2, from) {
55264
+ function compile2(expr2, from2) {
55260
55265
  if (expr2.type == "choice") {
55261
- return expr2.exprs.reduce((out, expr3) => out.concat(compile2(expr3, from)), []);
55266
+ return expr2.exprs.reduce((out, expr3) => out.concat(compile2(expr3, from2)), []);
55262
55267
  } else if (expr2.type == "seq") {
55263
55268
  for (let i = 0; ; i++) {
55264
- let next = compile2(expr2.exprs[i], from);
55269
+ let next = compile2(expr2.exprs[i], from2);
55265
55270
  if (i == expr2.exprs.length - 1)
55266
55271
  return next;
55267
- connect(next, from = node());
55272
+ connect(next, from2 = node());
55268
55273
  }
55269
55274
  } else if (expr2.type == "star") {
55270
55275
  let loop = node();
55271
- edge(from, loop);
55276
+ edge(from2, loop);
55272
55277
  connect(compile2(expr2.expr, loop), loop);
55273
55278
  return [edge(loop)];
55274
55279
  } else if (expr2.type == "plus") {
55275
55280
  let loop = node();
55276
- connect(compile2(expr2.expr, from), loop);
55281
+ connect(compile2(expr2.expr, from2), loop);
55277
55282
  connect(compile2(expr2.expr, loop), loop);
55278
55283
  return [edge(loop)];
55279
55284
  } else if (expr2.type == "opt") {
55280
- return [edge(from)].concat(compile2(expr2.expr, from));
55285
+ return [edge(from2)].concat(compile2(expr2.expr, from2));
55281
55286
  } else if (expr2.type == "range") {
55282
- let cur = from;
55287
+ let cur = from2;
55283
55288
  for (let i = 0; i < expr2.min; i++) {
55284
55289
  let next = node();
55285
55290
  connect(compile2(expr2.expr, cur), next);
@@ -55297,7 +55302,7 @@ function nfa(expr) {
55297
55302
  }
55298
55303
  return [edge(cur)];
55299
55304
  } else if (expr2.type == "name") {
55300
- return [edge(from, void 0, expr2.value)];
55305
+ return [edge(from2, void 0, expr2.value)];
55301
55306
  } else {
55302
55307
  throw new Error("Unknown expr type");
55303
55308
  }
@@ -56804,17 +56809,17 @@ class Mapping {
56804
56809
  /**
56805
56810
  Create a new mapping with the given position maps.
56806
56811
  */
56807
- constructor(maps = [], mirror, from = 0, to = maps.length) {
56812
+ constructor(maps = [], mirror, from2 = 0, to = maps.length) {
56808
56813
  this.maps = maps;
56809
56814
  this.mirror = mirror;
56810
- this.from = from;
56815
+ this.from = from2;
56811
56816
  this.to = to;
56812
56817
  }
56813
56818
  /**
56814
56819
  Create a mapping that maps only through a part of this one.
56815
56820
  */
56816
- slice(from = 0, to = this.maps.length) {
56817
- return new Mapping(this.maps, this.mirror, from, to);
56821
+ slice(from2 = 0, to = this.maps.length) {
56822
+ return new Mapping(this.maps, this.mirror, from2, to);
56818
56823
  }
56819
56824
  /**
56820
56825
  @internal
@@ -56827,8 +56832,8 @@ class Mapping {
56827
56832
  given, it should be the index of the step map that is the mirror
56828
56833
  image of this one.
56829
56834
  */
56830
- appendMap(map2, mirrors) {
56831
- this.to = this.maps.push(map2);
56835
+ appendMap(map22, mirrors) {
56836
+ this.to = this.maps.push(map22);
56832
56837
  if (mirrors != null)
56833
56838
  this.setMirror(this.maps.length - 1, mirrors);
56834
56839
  }
@@ -56902,7 +56907,7 @@ class Mapping {
56902
56907
  _map(pos, assoc, simple) {
56903
56908
  let delInfo = 0;
56904
56909
  for (let i = this.from; i < this.to; i++) {
56905
- let map2 = this.maps[i], result = map2.mapResult(pos, assoc);
56910
+ let map22 = this.maps[i], result = map22.mapResult(pos, assoc);
56906
56911
  if (result.recover != null) {
56907
56912
  let corr = this.getMirror(i);
56908
56913
  if (corr != null && corr > i && corr < this.to) {
@@ -56986,9 +56991,9 @@ class StepResult {
56986
56991
  arguments. Create a successful result if it succeeds, and a
56987
56992
  failed one if it throws a `ReplaceError`.
56988
56993
  */
56989
- static fromReplace(doc2, from, to, slice) {
56994
+ static fromReplace(doc2, from2, to, slice2) {
56990
56995
  try {
56991
- return StepResult.ok(doc2.replace(from, to, slice));
56996
+ return StepResult.ok(doc2.replace(from2, to, slice2));
56992
56997
  } catch (e) {
56993
56998
  if (e instanceof ReplaceError)
56994
56999
  return StepResult.fail(e.message);
@@ -57012,30 +57017,30 @@ class AddMarkStep extends Step {
57012
57017
  /**
57013
57018
  Create a mark step.
57014
57019
  */
57015
- constructor(from, to, mark) {
57020
+ constructor(from2, to, mark) {
57016
57021
  super();
57017
- this.from = from;
57022
+ this.from = from2;
57018
57023
  this.to = to;
57019
57024
  this.mark = mark;
57020
57025
  }
57021
57026
  apply(doc2) {
57022
57027
  let oldSlice = doc2.slice(this.from, this.to), $from = doc2.resolve(this.from);
57023
57028
  let parent = $from.node($from.sharedDepth(this.to));
57024
- let slice = new Slice(mapFragment(oldSlice.content, (node, parent2) => {
57029
+ let slice2 = new Slice(mapFragment(oldSlice.content, (node, parent2) => {
57025
57030
  if (!node.isAtom || !parent2.type.allowsMarkType(this.mark.type))
57026
57031
  return node;
57027
57032
  return node.mark(this.mark.addToSet(node.marks));
57028
57033
  }, parent), oldSlice.openStart, oldSlice.openEnd);
57029
- return StepResult.fromReplace(doc2, this.from, this.to, slice);
57034
+ return StepResult.fromReplace(doc2, this.from, this.to, slice2);
57030
57035
  }
57031
57036
  invert() {
57032
57037
  return new RemoveMarkStep(this.from, this.to, this.mark);
57033
57038
  }
57034
57039
  map(mapping) {
57035
- let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
57036
- if (from.deleted && to.deleted || from.pos >= to.pos)
57040
+ let from2 = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
57041
+ if (from2.deleted && to.deleted || from2.pos >= to.pos)
57037
57042
  return null;
57038
- return new AddMarkStep(from.pos, to.pos, this.mark);
57043
+ return new AddMarkStep(from2.pos, to.pos, this.mark);
57039
57044
  }
57040
57045
  merge(other) {
57041
57046
  if (other instanceof AddMarkStep && other.mark.eq(this.mark) && this.from <= other.to && this.to >= other.from)
@@ -57064,27 +57069,27 @@ class RemoveMarkStep extends Step {
57064
57069
  /**
57065
57070
  Create a mark-removing step.
57066
57071
  */
57067
- constructor(from, to, mark) {
57072
+ constructor(from2, to, mark) {
57068
57073
  super();
57069
- this.from = from;
57074
+ this.from = from2;
57070
57075
  this.to = to;
57071
57076
  this.mark = mark;
57072
57077
  }
57073
57078
  apply(doc2) {
57074
57079
  let oldSlice = doc2.slice(this.from, this.to);
57075
- let slice = new Slice(mapFragment(oldSlice.content, (node) => {
57080
+ let slice2 = new Slice(mapFragment(oldSlice.content, (node) => {
57076
57081
  return node.mark(this.mark.removeFromSet(node.marks));
57077
57082
  }, doc2), oldSlice.openStart, oldSlice.openEnd);
57078
- return StepResult.fromReplace(doc2, this.from, this.to, slice);
57083
+ return StepResult.fromReplace(doc2, this.from, this.to, slice2);
57079
57084
  }
57080
57085
  invert() {
57081
57086
  return new AddMarkStep(this.from, this.to, this.mark);
57082
57087
  }
57083
57088
  map(mapping) {
57084
- let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
57085
- if (from.deleted && to.deleted || from.pos >= to.pos)
57089
+ let from2 = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
57090
+ if (from2.deleted && to.deleted || from2.pos >= to.pos)
57086
57091
  return null;
57087
- return new RemoveMarkStep(from.pos, to.pos, this.mark);
57092
+ return new RemoveMarkStep(from2.pos, to.pos, this.mark);
57088
57093
  }
57089
57094
  merge(other) {
57090
57095
  if (other instanceof RemoveMarkStep && other.mark.eq(this.mark) && this.from <= other.to && this.to >= other.from)
@@ -57204,11 +57209,11 @@ class ReplaceStep extends Step {
57204
57209
  tokens (this is to guard against rebased replace steps
57205
57210
  overwriting something they weren't supposed to).
57206
57211
  */
57207
- constructor(from, to, slice, structure = false) {
57212
+ constructor(from2, to, slice2, structure = false) {
57208
57213
  super();
57209
- this.from = from;
57214
+ this.from = from2;
57210
57215
  this.to = to;
57211
- this.slice = slice;
57216
+ this.slice = slice2;
57212
57217
  this.structure = structure;
57213
57218
  }
57214
57219
  apply(doc2) {
@@ -57223,20 +57228,20 @@ class ReplaceStep extends Step {
57223
57228
  return new ReplaceStep(this.from, this.from + this.slice.size, doc2.slice(this.from, this.to));
57224
57229
  }
57225
57230
  map(mapping) {
57226
- let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
57227
- if (from.deletedAcross && to.deletedAcross)
57231
+ let from2 = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
57232
+ if (from2.deletedAcross && to.deletedAcross)
57228
57233
  return null;
57229
- return new ReplaceStep(from.pos, Math.max(from.pos, to.pos), this.slice);
57234
+ return new ReplaceStep(from2.pos, Math.max(from2.pos, to.pos), this.slice);
57230
57235
  }
57231
57236
  merge(other) {
57232
57237
  if (!(other instanceof ReplaceStep) || other.structure || this.structure)
57233
57238
  return null;
57234
57239
  if (this.from + this.slice.size == other.from && !this.slice.openEnd && !other.slice.openStart) {
57235
- let slice = this.slice.size + other.slice.size == 0 ? Slice.empty : new Slice(this.slice.content.append(other.slice.content), this.slice.openStart, other.slice.openEnd);
57236
- return new ReplaceStep(this.from, this.to + (other.to - other.from), slice, this.structure);
57240
+ let slice2 = this.slice.size + other.slice.size == 0 ? Slice.empty : new Slice(this.slice.content.append(other.slice.content), this.slice.openStart, other.slice.openEnd);
57241
+ return new ReplaceStep(this.from, this.to + (other.to - other.from), slice2, this.structure);
57237
57242
  } else if (other.to == this.from && !this.slice.openStart && !other.slice.openEnd) {
57238
- let slice = this.slice.size + other.slice.size == 0 ? Slice.empty : new Slice(other.slice.content.append(this.slice.content), other.slice.openStart, this.slice.openEnd);
57239
- return new ReplaceStep(other.from, this.to, slice, this.structure);
57243
+ let slice2 = this.slice.size + other.slice.size == 0 ? Slice.empty : new Slice(other.slice.content.append(this.slice.content), other.slice.openStart, this.slice.openEnd);
57244
+ return new ReplaceStep(other.from, this.to, slice2, this.structure);
57240
57245
  } else {
57241
57246
  return null;
57242
57247
  }
@@ -57266,13 +57271,13 @@ class ReplaceAroundStep extends Step {
57266
57271
  of the gap should be moved. `structure` has the same meaning as
57267
57272
  it has in the [`ReplaceStep`](https://prosemirror.net/docs/ref/#transform.ReplaceStep) class.
57268
57273
  */
57269
- constructor(from, to, gapFrom, gapTo, slice, insert, structure = false) {
57274
+ constructor(from2, to, gapFrom, gapTo, slice2, insert, structure = false) {
57270
57275
  super();
57271
- this.from = from;
57276
+ this.from = from2;
57272
57277
  this.to = to;
57273
57278
  this.gapFrom = gapFrom;
57274
57279
  this.gapTo = gapTo;
57275
- this.slice = slice;
57280
+ this.slice = slice2;
57276
57281
  this.insert = insert;
57277
57282
  this.structure = structure;
57278
57283
  }
@@ -57302,12 +57307,12 @@ class ReplaceAroundStep extends Step {
57302
57307
  return new ReplaceAroundStep(this.from, this.from + this.slice.size + gap, this.from + this.insert, this.from + this.insert + gap, doc2.slice(this.from, this.to).removeBetween(this.gapFrom - this.from, this.gapTo - this.from), this.gapFrom - this.from, this.structure);
57303
57308
  }
57304
57309
  map(mapping) {
57305
- let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
57306
- let gapFrom = this.from == this.gapFrom ? from.pos : mapping.map(this.gapFrom, -1);
57310
+ let from2 = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
57311
+ let gapFrom = this.from == this.gapFrom ? from2.pos : mapping.map(this.gapFrom, -1);
57307
57312
  let gapTo = this.to == this.gapTo ? to.pos : mapping.map(this.gapTo, 1);
57308
- if (from.deletedAcross && to.deletedAcross || gapFrom < from.pos || gapTo > to.pos)
57313
+ if (from2.deletedAcross && to.deletedAcross || gapFrom < from2.pos || gapTo > to.pos)
57309
57314
  return null;
57310
- return new ReplaceAroundStep(from.pos, to.pos, gapFrom, gapTo, this.slice, this.insert, this.structure);
57315
+ return new ReplaceAroundStep(from2.pos, to.pos, gapFrom, gapTo, this.slice, this.insert, this.structure);
57311
57316
  }
57312
57317
  toJSON() {
57313
57318
  let json = {
@@ -57334,8 +57339,8 @@ class ReplaceAroundStep extends Step {
57334
57339
  }
57335
57340
  }
57336
57341
  Step.jsonID("replaceAround", ReplaceAroundStep);
57337
- function contentBetween(doc2, from, to) {
57338
- let $from = doc2.resolve(from), dist2 = to - from, depth = $from.depth;
57342
+ function contentBetween(doc2, from2, to) {
57343
+ let $from = doc2.resolve(from2), dist2 = to - from2, depth = $from.depth;
57339
57344
  while (dist2 > 0 && depth > 0 && $from.indexAfter(depth) == $from.node(depth).childCount) {
57340
57345
  depth--;
57341
57346
  dist2--;
@@ -57351,15 +57356,15 @@ function contentBetween(doc2, from, to) {
57351
57356
  }
57352
57357
  return false;
57353
57358
  }
57354
- function addMark(tr, from, to, mark) {
57359
+ function addMark(tr, from2, to, mark) {
57355
57360
  let removed = [], added = [];
57356
57361
  let removing, adding;
57357
- tr.doc.nodesBetween(from, to, (node, pos, parent) => {
57362
+ tr.doc.nodesBetween(from2, to, (node, pos, parent) => {
57358
57363
  if (!node.isInline)
57359
57364
  return;
57360
57365
  let marks = node.marks;
57361
57366
  if (!mark.isInSet(marks) && parent.type.allowsMarkType(mark.type)) {
57362
- let start = Math.max(pos, from), end = Math.min(pos + node.nodeSize, to);
57367
+ let start = Math.max(pos, from2), end = Math.min(pos + node.nodeSize, to);
57363
57368
  let newSet = mark.addToSet(marks);
57364
57369
  for (let i = 0; i < marks.length; i++) {
57365
57370
  if (!marks[i].isInSet(newSet)) {
@@ -57378,9 +57383,9 @@ function addMark(tr, from, to, mark) {
57378
57383
  removed.forEach((s) => tr.step(s));
57379
57384
  added.forEach((s) => tr.step(s));
57380
57385
  }
57381
- function removeMark(tr, from, to, mark) {
57386
+ function removeMark(tr, from2, to, mark) {
57382
57387
  let matched = [], step = 0;
57383
- tr.doc.nodesBetween(from, to, (node, pos) => {
57388
+ tr.doc.nodesBetween(from2, to, (node, pos) => {
57384
57389
  if (!node.isInline)
57385
57390
  return;
57386
57391
  step++;
@@ -57410,7 +57415,7 @@ function removeMark(tr, from, to, mark) {
57410
57415
  found2.to = end;
57411
57416
  found2.step = step;
57412
57417
  } else {
57413
- matched.push({ style: style2, from: Math.max(pos, from), to: end, step });
57418
+ matched.push({ style: style2, from: Math.max(pos, from2), to: end, step });
57414
57419
  }
57415
57420
  }
57416
57421
  }
@@ -57431,11 +57436,11 @@ function clearIncompatible(tr, pos, parentType, match2 = parentType.contentMatch
57431
57436
  if (!parentType.allowsMarkType(child.marks[j].type))
57432
57437
  tr.step(new RemoveMarkStep(cur, end, child.marks[j]));
57433
57438
  if (clearNewlines && child.isText && parentType.whitespace != "pre") {
57434
- let m, newline = /\r?\n|\r/g, slice;
57439
+ let m, newline = /\r?\n|\r/g, slice2;
57435
57440
  while (m = newline.exec(child.text)) {
57436
- if (!slice)
57437
- slice = new Slice(Fragment.from(parentType.schema.text(" ", parentType.allowedMarks(child.marks))), 0, 0);
57438
- replSteps.push(new ReplaceStep(cur + m.index, cur + m.index + m[0].length, slice));
57441
+ if (!slice2)
57442
+ slice2 = new Slice(Fragment.from(parentType.schema.text(" ", parentType.allowedMarks(child.marks))), 0, 0);
57443
+ replSteps.push(new ReplaceStep(cur + m.index, cur + m.index + m[0].length, slice2));
57439
57444
  }
57440
57445
  }
57441
57446
  }
@@ -57485,11 +57490,11 @@ function wrap(tr, range2, wrappers) {
57485
57490
  let start = range2.start, end = range2.end;
57486
57491
  tr.step(new ReplaceAroundStep(start, end, start, end, new Slice(content, 0, 0), wrappers.length, true));
57487
57492
  }
57488
- function setBlockType(tr, from, to, type2, attrs) {
57493
+ function setBlockType(tr, from2, to, type2, attrs) {
57489
57494
  if (!type2.isTextblock)
57490
57495
  throw new RangeError("Type given to setBlockType should be a textblock");
57491
57496
  let mapFrom = tr.steps.length;
57492
- tr.doc.nodesBetween(from, to, (node, pos) => {
57497
+ tr.doc.nodesBetween(from2, to, (node, pos) => {
57493
57498
  if (node.isTextblock && !node.hasMarkup(type2, attrs) && canChangeType(tr.doc, tr.mapping.slice(mapFrom).map(pos), type2)) {
57494
57499
  let convertNewlines = null;
57495
57500
  if (type2.schema.linebreakReplacement) {
@@ -57582,14 +57587,14 @@ function insertPoint(doc2, pos, nodeType) {
57582
57587
  }
57583
57588
  return null;
57584
57589
  }
57585
- function dropPoint(doc2, pos, slice) {
57590
+ function dropPoint(doc2, pos, slice2) {
57586
57591
  let $pos = doc2.resolve(pos);
57587
- if (!slice.content.size)
57592
+ if (!slice2.content.size)
57588
57593
  return pos;
57589
- let content = slice.content;
57590
- for (let i = 0; i < slice.openStart; i++)
57594
+ let content = slice2.content;
57595
+ for (let i = 0; i < slice2.openStart; i++)
57591
57596
  content = content.firstChild.content;
57592
- for (let pass = 1; pass <= (slice.openStart == 0 && slice.size ? 2 : 1); pass++) {
57597
+ for (let pass = 1; pass <= (slice2.openStart == 0 && slice2.size ? 2 : 1); pass++) {
57593
57598
  for (let d = $pos.depth; d >= 0; d--) {
57594
57599
  let bias = d == $pos.depth ? 0 : $pos.pos <= ($pos.start(d + 1) + $pos.end(d + 1)) / 2 ? -1 : 1;
57595
57600
  let insertPos = $pos.index(d) + (bias > 0 ? 1 : 0);
@@ -57606,16 +57611,16 @@ function dropPoint(doc2, pos, slice) {
57606
57611
  }
57607
57612
  return null;
57608
57613
  }
57609
- function replaceStep(doc2, from, to = from, slice = Slice.empty) {
57610
- if (from == to && !slice.size)
57614
+ function replaceStep(doc2, from2, to = from2, slice2 = Slice.empty) {
57615
+ if (from2 == to && !slice2.size)
57611
57616
  return null;
57612
- let $from = doc2.resolve(from), $to = doc2.resolve(to);
57613
- if (fitsTrivially($from, $to, slice))
57614
- return new ReplaceStep(from, to, slice);
57615
- return new Fitter($from, $to, slice).fit();
57617
+ let $from = doc2.resolve(from2), $to = doc2.resolve(to);
57618
+ if (fitsTrivially($from, $to, slice2))
57619
+ return new ReplaceStep(from2, to, slice2);
57620
+ return new Fitter($from, $to, slice2).fit();
57616
57621
  }
57617
- function fitsTrivially($from, $to, slice) {
57618
- return !slice.openStart && !slice.openEnd && $from.start() == $to.start() && $from.parent.canReplace($from.index(), $to.index(), slice.content);
57622
+ function fitsTrivially($from, $to, slice2) {
57623
+ return !slice2.openStart && !slice2.openEnd && $from.start() == $to.start() && $from.parent.canReplace($from.index(), $to.index(), slice2.content);
57619
57624
  }
57620
57625
  class Fitter {
57621
57626
  constructor($from, $to, unplaced) {
@@ -57655,11 +57660,11 @@ class Fitter {
57655
57660
  openStart--;
57656
57661
  openEnd--;
57657
57662
  }
57658
- let slice = new Slice(content, openStart, openEnd);
57663
+ let slice2 = new Slice(content, openStart, openEnd);
57659
57664
  if (moveInline > -1)
57660
- return new ReplaceAroundStep($from.pos, moveInline, this.$to.pos, this.$to.end(), slice, placedSize);
57661
- if (slice.size || $from.pos != this.$to.pos)
57662
- return new ReplaceStep($from.pos, $to.pos, slice);
57665
+ return new ReplaceAroundStep($from.pos, moveInline, this.$to.pos, this.$to.end(), slice2, placedSize);
57666
+ if (slice2.size || $from.pos != this.$to.pos)
57667
+ return new ReplaceStep($from.pos, $to.pos, slice2);
57663
57668
  return null;
57664
57669
  }
57665
57670
  // Find a position on the start spine of `this.unplaced` that has
@@ -57726,8 +57731,8 @@ class Fitter {
57726
57731
  if (wrap2)
57727
57732
  for (let i = 0; i < wrap2.length; i++)
57728
57733
  this.openFrontierNode(wrap2[i]);
57729
- let slice = this.unplaced, fragment = parent ? parent.content : slice.content;
57730
- let openStart = slice.openStart - sliceDepth;
57734
+ let slice2 = this.unplaced, fragment = parent ? parent.content : slice2.content;
57735
+ let openStart = slice2.openStart - sliceDepth;
57731
57736
  let taken = 0, add2 = [];
57732
57737
  let { match: match2, type: type2 } = this.frontier[frontierDepth];
57733
57738
  if (inject2) {
@@ -57735,7 +57740,7 @@ class Fitter {
57735
57740
  add2.push(inject2.child(i));
57736
57741
  match2 = match2.matchFragment(inject2);
57737
57742
  }
57738
- let openEndCount = fragment.size + sliceDepth - (slice.content.size - slice.openEnd);
57743
+ let openEndCount = fragment.size + sliceDepth - (slice2.content.size - slice2.openEnd);
57739
57744
  while (taken < fragment.childCount) {
57740
57745
  let next = fragment.child(taken), matches2 = match2.matchType(next.type);
57741
57746
  if (!matches2)
@@ -57758,7 +57763,7 @@ class Fitter {
57758
57763
  this.frontier.push({ type: node.type, match: node.contentMatchAt(node.childCount) });
57759
57764
  cur = node.content;
57760
57765
  }
57761
- this.unplaced = !toEnd ? new Slice(dropFromFragment(slice.content, sliceDepth, taken), slice.openStart, slice.openEnd) : sliceDepth == 0 ? Slice.empty : new Slice(dropFromFragment(slice.content, sliceDepth - 1, 1), sliceDepth - 1, openEndCount < 0 ? slice.openEnd : sliceDepth - 1);
57766
+ this.unplaced = !toEnd ? new Slice(dropFromFragment(slice2.content, sliceDepth, taken), slice2.openStart, slice2.openEnd) : sliceDepth == 0 ? Slice.empty : new Slice(dropFromFragment(slice2.content, sliceDepth - 1, 1), sliceDepth - 1, openEndCount < 0 ? slice2.openEnd : sliceDepth - 1);
57762
57767
  }
57763
57768
  mustMoveInline() {
57764
57769
  if (!this.$to.parent.isTextblock)
@@ -57859,12 +57864,12 @@ function invalidMarks(type2, fragment, start) {
57859
57864
  function definesContent(type2) {
57860
57865
  return type2.spec.defining || type2.spec.definingForContent;
57861
57866
  }
57862
- function replaceRange(tr, from, to, slice) {
57863
- if (!slice.size)
57864
- return tr.deleteRange(from, to);
57865
- let $from = tr.doc.resolve(from), $to = tr.doc.resolve(to);
57866
- if (fitsTrivially($from, $to, slice))
57867
- return tr.step(new ReplaceStep(from, to, slice));
57867
+ function replaceRange(tr, from2, to, slice2) {
57868
+ if (!slice2.size)
57869
+ return tr.deleteRange(from2, to);
57870
+ let $from = tr.doc.resolve(from2), $to = tr.doc.resolve(to);
57871
+ if (fitsTrivially($from, $to, slice2))
57872
+ return tr.step(new ReplaceStep(from2, to, slice2));
57868
57873
  let targetDepths = coveredDepths($from, tr.doc.resolve(to));
57869
57874
  if (targetDepths[targetDepths.length - 1] == 0)
57870
57875
  targetDepths.pop();
@@ -57880,11 +57885,11 @@ function replaceRange(tr, from, to, slice) {
57880
57885
  targetDepths.splice(1, 0, -d);
57881
57886
  }
57882
57887
  let preferredTargetIndex = targetDepths.indexOf(preferredTarget);
57883
- let leftNodes = [], preferredDepth = slice.openStart;
57884
- for (let content = slice.content, i = 0; ; i++) {
57888
+ let leftNodes = [], preferredDepth = slice2.openStart;
57889
+ for (let content = slice2.content, i = 0; ; i++) {
57885
57890
  let node = content.firstChild;
57886
57891
  leftNodes.push(node);
57887
- if (i == slice.openStart)
57892
+ if (i == slice2.openStart)
57888
57893
  break;
57889
57894
  content = node.content;
57890
57895
  }
@@ -57895,8 +57900,8 @@ function replaceRange(tr, from, to, slice) {
57895
57900
  else if (def2 || !leftNode.type.isTextblock)
57896
57901
  break;
57897
57902
  }
57898
- for (let j = slice.openStart; j >= 0; j--) {
57899
- let openDepth = (j + preferredDepth + 1) % (slice.openStart + 1);
57903
+ for (let j = slice2.openStart; j >= 0; j--) {
57904
+ let openDepth = (j + preferredDepth + 1) % (slice2.openStart + 1);
57900
57905
  let insert = leftNodes[openDepth];
57901
57906
  if (!insert)
57902
57907
  continue;
@@ -57908,18 +57913,18 @@ function replaceRange(tr, from, to, slice) {
57908
57913
  }
57909
57914
  let parent = $from.node(targetDepth - 1), index = $from.index(targetDepth - 1);
57910
57915
  if (parent.canReplaceWith(index, index, insert.type, insert.marks))
57911
- return tr.replace($from.before(targetDepth), expand ? $to.after(targetDepth) : to, new Slice(closeFragment(slice.content, 0, slice.openStart, openDepth), openDepth, slice.openEnd));
57916
+ return tr.replace($from.before(targetDepth), expand ? $to.after(targetDepth) : to, new Slice(closeFragment(slice2.content, 0, slice2.openStart, openDepth), openDepth, slice2.openEnd));
57912
57917
  }
57913
57918
  }
57914
57919
  let startSteps = tr.steps.length;
57915
57920
  for (let i = targetDepths.length - 1; i >= 0; i--) {
57916
- tr.replace(from, to, slice);
57921
+ tr.replace(from2, to, slice2);
57917
57922
  if (tr.steps.length > startSteps)
57918
57923
  break;
57919
57924
  let depth = targetDepths[i];
57920
57925
  if (depth < 0)
57921
57926
  continue;
57922
- from = $from.before(depth);
57927
+ from2 = $from.before(depth);
57923
57928
  to = $to.after(depth);
57924
57929
  }
57925
57930
  }
@@ -57935,16 +57940,16 @@ function closeFragment(fragment, depth, oldOpen, newOpen, parent) {
57935
57940
  }
57936
57941
  return fragment;
57937
57942
  }
57938
- function replaceRangeWith(tr, from, to, node) {
57939
- if (!node.isInline && from == to && tr.doc.resolve(from).parent.content.size) {
57940
- let point = insertPoint(tr.doc, from, node.type);
57943
+ function replaceRangeWith(tr, from2, to, node) {
57944
+ if (!node.isInline && from2 == to && tr.doc.resolve(from2).parent.content.size) {
57945
+ let point = insertPoint(tr.doc, from2, node.type);
57941
57946
  if (point != null)
57942
- from = to = point;
57947
+ from2 = to = point;
57943
57948
  }
57944
- tr.replaceRange(from, to, new Slice(Fragment.from(node), 0, 0));
57949
+ tr.replaceRange(from2, to, new Slice(Fragment.from(node), 0, 0));
57945
57950
  }
57946
- function deleteRange(tr, from, to) {
57947
- let $from = tr.doc.resolve(from), $to = tr.doc.resolve(to);
57951
+ function deleteRange(tr, from2, to) {
57952
+ let $from = tr.doc.resolve(from2), $to = tr.doc.resolve(to);
57948
57953
  let covered = coveredDepths($from, $to);
57949
57954
  for (let i = 0; i < covered.length; i++) {
57950
57955
  let depth = covered[i], last = i == covered.length - 1;
@@ -57954,10 +57959,10 @@ function deleteRange(tr, from, to) {
57954
57959
  return tr.delete($from.before(depth), $to.after(depth));
57955
57960
  }
57956
57961
  for (let d = 1; d <= $from.depth && d <= $to.depth; d++) {
57957
- if (from - $from.start(d) == $from.depth - d && to > $from.end(d) && $to.end(d) - to != $to.depth - d)
57962
+ if (from2 - $from.start(d) == $from.depth - d && to > $from.end(d) && $to.end(d) - to != $to.depth - d)
57958
57963
  return tr.delete($from.before(d), to);
57959
57964
  }
57960
- tr.delete(from, to);
57965
+ tr.delete(from2, to);
57961
57966
  }
57962
57967
  function coveredDepths($from, $to) {
57963
57968
  let result = [], minDepth = Math.min($from.depth, $to.depth);
@@ -58113,8 +58118,8 @@ class Transform {
58113
58118
  Replace the part of the document between `from` and `to` with the
58114
58119
  given `slice`.
58115
58120
  */
58116
- replace(from, to = from, slice = Slice.empty) {
58117
- let step = replaceStep(this.doc, from, to, slice);
58121
+ replace(from2, to = from2, slice2 = Slice.empty) {
58122
+ let step = replaceStep(this.doc, from2, to, slice2);
58118
58123
  if (step)
58119
58124
  this.step(step);
58120
58125
  return this;
@@ -58123,14 +58128,14 @@ class Transform {
58123
58128
  Replace the given range with the given content, which may be a
58124
58129
  fragment, node, or array of nodes.
58125
58130
  */
58126
- replaceWith(from, to, content) {
58127
- return this.replace(from, to, new Slice(Fragment.from(content), 0, 0));
58131
+ replaceWith(from2, to, content) {
58132
+ return this.replace(from2, to, new Slice(Fragment.from(content), 0, 0));
58128
58133
  }
58129
58134
  /**
58130
58135
  Delete the content between the given positions.
58131
58136
  */
58132
- delete(from, to) {
58133
- return this.replace(from, to, Slice.empty);
58137
+ delete(from2, to) {
58138
+ return this.replace(from2, to, Slice.empty);
58134
58139
  }
58135
58140
  /**
58136
58141
  Insert the given content at the given position.
@@ -58157,8 +58162,8 @@ class Transform {
58157
58162
  range, and is useful in situations where you need more precise
58158
58163
  control over what happens.
58159
58164
  */
58160
- replaceRange(from, to, slice) {
58161
- replaceRange(this, from, to, slice);
58165
+ replaceRange(from2, to, slice2) {
58166
+ replaceRange(this, from2, to, slice2);
58162
58167
  return this;
58163
58168
  }
58164
58169
  /**
@@ -58170,16 +58175,16 @@ class Transform {
58170
58175
  completely covers a parent node, this method may completely replace
58171
58176
  that parent node.
58172
58177
  */
58173
- replaceRangeWith(from, to, node) {
58174
- replaceRangeWith(this, from, to, node);
58178
+ replaceRangeWith(from2, to, node) {
58179
+ replaceRangeWith(this, from2, to, node);
58175
58180
  return this;
58176
58181
  }
58177
58182
  /**
58178
58183
  Delete the given range, expanding it to cover fully covered
58179
58184
  parent nodes until a valid replace is found.
58180
58185
  */
58181
- deleteRange(from, to) {
58182
- deleteRange(this, from, to);
58186
+ deleteRange(from2, to) {
58187
+ deleteRange(this, from2, to);
58183
58188
  return this;
58184
58189
  }
58185
58190
  /**
@@ -58214,8 +58219,8 @@ class Transform {
58214
58219
  Set the type of all textblocks (partly) between `from` and `to` to
58215
58220
  the given node type with the given attributes.
58216
58221
  */
58217
- setBlockType(from, to = from, type2, attrs = null) {
58218
- setBlockType(this, from, to, type2, attrs);
58222
+ setBlockType(from2, to = from2, type2, attrs = null) {
58223
+ setBlockType(this, from2, to, type2, attrs);
58219
58224
  return this;
58220
58225
  }
58221
58226
  /**
@@ -58279,8 +58284,8 @@ class Transform {
58279
58284
  /**
58280
58285
  Add the given mark to the inline content between `from` and `to`.
58281
58286
  */
58282
- addMark(from, to, mark) {
58283
- addMark(this, from, to, mark);
58287
+ addMark(from2, to, mark) {
58288
+ addMark(this, from2, to, mark);
58284
58289
  return this;
58285
58290
  }
58286
58291
  /**
@@ -58289,8 +58294,8 @@ class Transform {
58289
58294
  a mark type, remove all marks of that type. When it is null,
58290
58295
  remove all marks of any type.
58291
58296
  */
58292
- removeMark(from, to, mark) {
58293
- removeMark(this, from, to, mark);
58297
+ removeMark(from2, to, mark) {
58298
+ removeMark(this, from2, to, mark);
58294
58299
  return this;
58295
58300
  }
58296
58301
  /**
@@ -58394,11 +58399,11 @@ class Selection {
58394
58399
  let mapFrom = tr.steps.length, ranges = this.ranges;
58395
58400
  for (let i = 0; i < ranges.length; i++) {
58396
58401
  let { $from, $to } = ranges[i], mapping = tr.mapping.slice(mapFrom);
58397
- let from = mapping.map($from.pos), to = mapping.map($to.pos);
58402
+ let from2 = mapping.map($from.pos), to = mapping.map($to.pos);
58398
58403
  if (i) {
58399
- tr.deleteRange(from, to);
58404
+ tr.deleteRange(from2, to);
58400
58405
  } else {
58401
- tr.replaceRangeWith(from, to, node);
58406
+ tr.replaceRangeWith(from2, to, node);
58402
58407
  selectionToInsertionEnd(tr, mapFrom, node.isInline ? -1 : 1);
58403
58408
  }
58404
58409
  }
@@ -58640,8 +58645,8 @@ class NodeSelection extends Selection {
58640
58645
  /**
58641
58646
  Create a node selection from non-resolved positions.
58642
58647
  */
58643
- static create(doc2, from) {
58644
- return new NodeSelection(doc2.resolve(from));
58648
+ static create(doc2, from2) {
58649
+ return new NodeSelection(doc2.resolve(from2));
58645
58650
  }
58646
58651
  /**
58647
58652
  Determines whether the given node may be selected as a node
@@ -58736,8 +58741,8 @@ function selectionToInsertionEnd(tr, startLen, bias) {
58736
58741
  let step = tr.steps[last];
58737
58742
  if (!(step instanceof ReplaceStep || step instanceof ReplaceAroundStep))
58738
58743
  return;
58739
- let map2 = tr.mapping.maps[last], end;
58740
- map2.forEach((_from, _to, _newFrom, newTo) => {
58744
+ let map22 = tr.mapping.maps[last], end;
58745
+ map22.forEach((_from, _to, _newFrom, newTo) => {
58741
58746
  if (end == null)
58742
58747
  end = newTo;
58743
58748
  });
@@ -58843,8 +58848,8 @@ class Transaction extends Transform {
58843
58848
  /**
58844
58849
  Replace the current selection with the given slice.
58845
58850
  */
58846
- replaceSelection(slice) {
58847
- this.selection.replace(this, slice);
58851
+ replaceSelection(slice2) {
58852
+ this.selection.replace(this, slice2);
58848
58853
  return this;
58849
58854
  }
58850
58855
  /**
@@ -58870,24 +58875,24 @@ class Transaction extends Transform {
58870
58875
  Replace the given range, or the selection if no range is given,
58871
58876
  with a text node containing the given string.
58872
58877
  */
58873
- insertText(text, from, to) {
58878
+ insertText(text, from2, to) {
58874
58879
  let schema = this.doc.type.schema;
58875
- if (from == null) {
58880
+ if (from2 == null) {
58876
58881
  if (!text)
58877
58882
  return this.deleteSelection();
58878
58883
  return this.replaceSelectionWith(schema.text(text), true);
58879
58884
  } else {
58880
58885
  if (to == null)
58881
- to = from;
58882
- to = to == null ? from : to;
58886
+ to = from2;
58887
+ to = to == null ? from2 : to;
58883
58888
  if (!text)
58884
- return this.deleteRange(from, to);
58889
+ return this.deleteRange(from2, to);
58885
58890
  let marks = this.storedMarks;
58886
58891
  if (!marks) {
58887
- let $from = this.doc.resolve(from);
58888
- marks = to == from ? $from.marks() : $from.marksAcross(this.doc.resolve(to));
58892
+ let $from = this.doc.resolve(from2);
58893
+ marks = to == from2 ? $from.marks() : $from.marksAcross(this.doc.resolve(to));
58889
58894
  }
58890
- this.replaceRangeWith(from, to, schema.text(text, marks));
58895
+ this.replaceRangeWith(from2, to, schema.text(text, marks));
58891
58896
  if (!this.selection.empty)
58892
58897
  this.setSelection(Selection.near(this.selection.$to));
58893
58898
  return this;
@@ -59239,10 +59244,10 @@ const parentNode = function(node) {
59239
59244
  return parent && parent.nodeType == 11 ? parent.host : parent;
59240
59245
  };
59241
59246
  let reusedRange = null;
59242
- const textRange = function(node, from, to) {
59247
+ const textRange = function(node, from2, to) {
59243
59248
  let range2 = reusedRange || (reusedRange = document.createRange());
59244
59249
  range2.setEnd(node, to == null ? node.nodeValue.length : to);
59245
- range2.setStart(node, from || 0);
59250
+ range2.setStart(node, from2 || 0);
59246
59251
  return range2;
59247
59252
  };
59248
59253
  const clearReusedRange = function() {
@@ -59698,19 +59703,19 @@ function coordsAtPos(view, pos, side) {
59698
59703
  }
59699
59704
  return rect;
59700
59705
  } else {
59701
- let from = offset, to = offset, takeSide = side < 0 ? 1 : -1;
59706
+ let from2 = offset, to = offset, takeSide = side < 0 ? 1 : -1;
59702
59707
  if (side < 0 && !offset) {
59703
59708
  to++;
59704
59709
  takeSide = -1;
59705
59710
  } else if (side >= 0 && offset == node.nodeValue.length) {
59706
- from--;
59711
+ from2--;
59707
59712
  takeSide = 1;
59708
59713
  } else if (side < 0) {
59709
- from--;
59714
+ from2--;
59710
59715
  } else {
59711
59716
  to++;
59712
59717
  }
59713
- return flattenV(singleRect(textRange(node, from, to), takeSide), takeSide < 0);
59718
+ return flattenV(singleRect(textRange(node, from2, to), takeSide), takeSide < 0);
59714
59719
  }
59715
59720
  }
59716
59721
  let $dom = view.state.doc.resolve(pos - (atom || 0));
@@ -60049,24 +60054,24 @@ class ViewDesc {
60049
60054
  }
60050
60055
  // Used to find a DOM range in a single parent for a given changed
60051
60056
  // range.
60052
- parseRange(from, to, base2 = 0) {
60057
+ parseRange(from2, to, base2 = 0) {
60053
60058
  if (this.children.length == 0)
60054
- return { node: this.contentDOM, from, to, fromOffset: 0, toOffset: this.contentDOM.childNodes.length };
60059
+ return { node: this.contentDOM, from: from2, to, fromOffset: 0, toOffset: this.contentDOM.childNodes.length };
60055
60060
  let fromOffset = -1, toOffset = -1;
60056
60061
  for (let offset = base2, i = 0; ; i++) {
60057
60062
  let child = this.children[i], end = offset + child.size;
60058
- if (fromOffset == -1 && from <= end) {
60063
+ if (fromOffset == -1 && from2 <= end) {
60059
60064
  let childBase = offset + child.border;
60060
- if (from >= childBase && to <= end - child.border && child.node && child.contentDOM && this.contentDOM.contains(child.contentDOM))
60061
- return child.parseRange(from, to, childBase);
60062
- from = offset;
60065
+ if (from2 >= childBase && to <= end - child.border && child.node && child.contentDOM && this.contentDOM.contains(child.contentDOM))
60066
+ return child.parseRange(from2, to, childBase);
60067
+ from2 = offset;
60063
60068
  for (let j = i; j > 0; j--) {
60064
60069
  let prev = this.children[j - 1];
60065
60070
  if (prev.size && prev.dom.parentNode == this.contentDOM && !prev.emptyChildAt(1)) {
60066
60071
  fromOffset = domIndex(prev.dom) + 1;
60067
60072
  break;
60068
60073
  }
60069
- from -= prev.size;
60074
+ from2 -= prev.size;
60070
60075
  }
60071
60076
  if (fromOffset == -1)
60072
60077
  fromOffset = 0;
@@ -60087,7 +60092,7 @@ class ViewDesc {
60087
60092
  }
60088
60093
  offset = end;
60089
60094
  }
60090
- return { node: this.contentDOM, from, to, fromOffset, toOffset };
60095
+ return { node: this.contentDOM, from: from2, to, fromOffset, toOffset };
60091
60096
  }
60092
60097
  emptyChildAt(side) {
60093
60098
  if (this.border || !this.contentDOM || !this.children.length)
@@ -60107,10 +60112,10 @@ class ViewDesc {
60107
60112
  // a selection starts in such a node and ends in another, in which
60108
60113
  // case we just use whatever domFromPos produces as a best effort.
60109
60114
  setSelection(anchor, head, root2, force = false) {
60110
- let from = Math.min(anchor, head), to = Math.max(anchor, head);
60115
+ let from2 = Math.min(anchor, head), to = Math.max(anchor, head);
60111
60116
  for (let i = 0, offset = 0; i < this.children.length; i++) {
60112
60117
  let child = this.children[i], end = offset + child.size;
60113
- if (from > offset && to < end)
60118
+ if (from2 > offset && to < end)
60114
60119
  return child.setSelection(anchor - offset - child.border, head - offset - child.border, root2, force);
60115
60120
  offset = end;
60116
60121
  }
@@ -60177,17 +60182,17 @@ class ViewDesc {
60177
60182
  }
60178
60183
  // Remove a subtree of the element tree that has been touched
60179
60184
  // by a DOM change, so that the next update will redraw it.
60180
- markDirty(from, to) {
60185
+ markDirty(from2, to) {
60181
60186
  for (let offset = 0, i = 0; i < this.children.length; i++) {
60182
60187
  let child = this.children[i], end = offset + child.size;
60183
- if (offset == end ? from <= end && to >= offset : from < end && to > offset) {
60188
+ if (offset == end ? from2 <= end && to >= offset : from2 < end && to > offset) {
60184
60189
  let startInside = offset + child.border, endInside = end - child.border;
60185
- if (from >= startInside && to <= endInside) {
60186
- this.dirty = from == offset || to == end ? CONTENT_DIRTY : CHILD_DIRTY;
60187
- if (from == startInside && to == endInside && (child.contentLost || child.dom.parentNode != this.contentDOM))
60190
+ if (from2 >= startInside && to <= endInside) {
60191
+ this.dirty = from2 == offset || to == end ? CONTENT_DIRTY : CHILD_DIRTY;
60192
+ if (from2 == startInside && to == endInside && (child.contentLost || child.dom.parentNode != this.contentDOM))
60188
60193
  child.dirty = NODE_DIRTY;
60189
60194
  else
60190
- child.markDirty(from - startInside, to - startInside);
60195
+ child.markDirty(from2 - startInside, to - startInside);
60191
60196
  return;
60192
60197
  } else {
60193
60198
  child.dirty = child.dom == child.contentDOM && child.dom.parentNode == this.contentDOM && !child.children.length ? CONTENT_DIRTY : NODE_DIRTY;
@@ -60304,8 +60309,8 @@ class MarkViewDesc extends ViewDesc {
60304
60309
  matchesMark(mark) {
60305
60310
  return this.dirty != NODE_DIRTY && this.mark.eq(mark);
60306
60311
  }
60307
- markDirty(from, to) {
60308
- super.markDirty(from, to);
60312
+ markDirty(from2, to) {
60313
+ super.markDirty(from2, to);
60309
60314
  if (this.dirty != NOT_DIRTY) {
60310
60315
  let parent = this.parent;
60311
60316
  while (!parent.node)
@@ -60315,13 +60320,13 @@ class MarkViewDesc extends ViewDesc {
60315
60320
  this.dirty = NOT_DIRTY;
60316
60321
  }
60317
60322
  }
60318
- slice(from, to, view) {
60323
+ slice(from2, to, view) {
60319
60324
  let copy2 = MarkViewDesc.create(this.parent, this.mark, true, view);
60320
60325
  let nodes = this.children, size2 = this.size;
60321
60326
  if (to < size2)
60322
60327
  nodes = replaceNodes(nodes, to, size2, view);
60323
- if (from > 0)
60324
- nodes = replaceNodes(nodes, 0, from, view);
60328
+ if (from2 > 0)
60329
+ nodes = replaceNodes(nodes, 0, from2, view);
60325
60330
  for (let i = 0; i < nodes.length; i++)
60326
60331
  nodes[i].parent = copy2;
60327
60332
  copy2.children = nodes;
@@ -60449,15 +60454,15 @@ class NodeViewDesc extends ViewDesc {
60449
60454
  }
60450
60455
  }
60451
60456
  localCompositionInfo(view, pos) {
60452
- let { from, to } = view.state.selection;
60453
- if (!(view.state.selection instanceof TextSelection) || from < pos || to > pos + this.node.content.size)
60457
+ let { from: from2, to } = view.state.selection;
60458
+ if (!(view.state.selection instanceof TextSelection) || from2 < pos || to > pos + this.node.content.size)
60454
60459
  return null;
60455
60460
  let textNode = view.input.compositionNode;
60456
60461
  if (!textNode || !this.dom.contains(textNode.parentNode))
60457
60462
  return null;
60458
60463
  if (this.node.inlineContent) {
60459
60464
  let text = textNode.nodeValue;
60460
- let textPos = findTextInFragment(this.node.content, text, from - pos, to - pos);
60465
+ let textPos = findTextInFragment(this.node.content, text, from2 - pos, to - pos);
60461
60466
  return textPos < 0 ? null : { node: textNode, pos: textPos, text };
60462
60467
  } else {
60463
60468
  return { node: textNode, pos: -1, text: "" };
@@ -60576,13 +60581,13 @@ class TextViewDesc extends NodeViewDesc {
60576
60581
  ignoreMutation(mutation) {
60577
60582
  return mutation.type != "characterData" && mutation.type != "selection";
60578
60583
  }
60579
- slice(from, to, view) {
60580
- let node = this.node.cut(from, to), dom = document.createTextNode(node.text);
60584
+ slice(from2, to, view) {
60585
+ let node = this.node.cut(from2, to), dom = document.createTextNode(node.text);
60581
60586
  return new TextViewDesc(this.parent, node, this.outerDeco, this.innerDeco, dom, dom, view);
60582
60587
  }
60583
- markDirty(from, to) {
60584
- super.markDirty(from, to);
60585
- if (this.dom != this.nodeDOM && (from == 0 || to == this.nodeDOM.nodeValue.length))
60588
+ markDirty(from2, to) {
60589
+ super.markDirty(from2, to);
60590
+ if (this.dom != this.nodeDOM && (from2 == 0 || to == this.nodeDOM.nodeValue.length))
60586
60591
  this.dirty = NODE_DIRTY;
60587
60592
  }
60588
60593
  get domAtom() {
@@ -61106,7 +61111,7 @@ function iosHacks(dom) {
61106
61111
  dom.style.cssText = oldCSS;
61107
61112
  }
61108
61113
  }
61109
- function findTextInFragment(frag, text, from, to) {
61114
+ function findTextInFragment(frag, text, from2, to) {
61110
61115
  for (let i = 0, pos = 0; i < frag.childCount && pos <= to; ) {
61111
61116
  let child = frag.child(i++), childStart = pos;
61112
61117
  pos += child.nodeSize;
@@ -61120,27 +61125,27 @@ function findTextInFragment(frag, text, from, to) {
61120
61125
  break;
61121
61126
  str += next.text;
61122
61127
  }
61123
- if (pos >= from) {
61128
+ if (pos >= from2) {
61124
61129
  if (pos >= to && str.slice(to - text.length - childStart, to - childStart) == text)
61125
61130
  return to - text.length;
61126
61131
  let found2 = childStart < to ? str.lastIndexOf(text, to - childStart - 1) : -1;
61127
- if (found2 >= 0 && found2 + text.length + childStart >= from)
61132
+ if (found2 >= 0 && found2 + text.length + childStart >= from2)
61128
61133
  return childStart + found2;
61129
- if (from == to && str.length >= to + text.length - childStart && str.slice(to - childStart, to - childStart + text.length) == text)
61134
+ if (from2 == to && str.length >= to + text.length - childStart && str.slice(to - childStart, to - childStart + text.length) == text)
61130
61135
  return to;
61131
61136
  }
61132
61137
  }
61133
61138
  return -1;
61134
61139
  }
61135
- function replaceNodes(nodes, from, to, view, replacement) {
61140
+ function replaceNodes(nodes, from2, to, view, replacement) {
61136
61141
  let result = [];
61137
61142
  for (let i = 0, off2 = 0; i < nodes.length; i++) {
61138
61143
  let child = nodes[i], start = off2, end = off2 += child.size;
61139
- if (start >= to || end <= from) {
61144
+ if (start >= to || end <= from2) {
61140
61145
  result.push(child);
61141
61146
  } else {
61142
- if (start < from)
61143
- result.push(child.slice(0, from - start, view));
61147
+ if (start < from2)
61148
+ result.push(child.slice(0, from2 - start, view));
61144
61149
  if (replacement) {
61145
61150
  result.push(replacement);
61146
61151
  replacement = void 0;
@@ -61651,11 +61656,11 @@ function captureKeyDown(view, event) {
61651
61656
  }
61652
61657
  return false;
61653
61658
  }
61654
- function serializeForClipboard(view, slice) {
61659
+ function serializeForClipboard(view, slice2) {
61655
61660
  view.someProp("transformCopied", (f) => {
61656
- slice = f(slice, view);
61661
+ slice2 = f(slice2, view);
61657
61662
  });
61658
- let context = [], { content, openStart, openEnd } = slice;
61663
+ let context = [], { content, openStart, openEnd } = slice2;
61659
61664
  while (openStart > 1 && openEnd > 1 && content.childCount == 1 && content.firstChild.childCount == 1) {
61660
61665
  openStart--;
61661
61666
  openEnd--;
@@ -61679,12 +61684,12 @@ function serializeForClipboard(view, slice) {
61679
61684
  }
61680
61685
  if (firstChild && firstChild.nodeType == 1)
61681
61686
  firstChild.setAttribute("data-pm-slice", `${openStart} ${openEnd}${wrappers ? ` -${wrappers}` : ""} ${JSON.stringify(context)}`);
61682
- let text = view.someProp("clipboardTextSerializer", (f) => f(slice, view)) || slice.content.textBetween(0, slice.content.size, "\n\n");
61683
- return { dom: wrap2, text, slice };
61687
+ let text = view.someProp("clipboardTextSerializer", (f) => f(slice2, view)) || slice2.content.textBetween(0, slice2.content.size, "\n\n");
61688
+ return { dom: wrap2, text, slice: slice2 };
61684
61689
  }
61685
61690
  function parseFromClipboard(view, text, html, plainText, $context) {
61686
61691
  let inCode = $context.parent.type.spec.code;
61687
- let dom, slice;
61692
+ let dom, slice2;
61688
61693
  if (!html && !text)
61689
61694
  return null;
61690
61695
  let asText = text && (plainText || inCode || !html);
@@ -61696,7 +61701,7 @@ function parseFromClipboard(view, text, html, plainText, $context) {
61696
61701
  return text ? new Slice(Fragment.from(view.state.schema.text(text.replace(/\r\n?/g, "\n"))), 0, 0) : Slice.empty;
61697
61702
  let parsed = view.someProp("clipboardTextParser", (f) => f(text, $context, plainText, view));
61698
61703
  if (parsed) {
61699
- slice = parsed;
61704
+ slice2 = parsed;
61700
61705
  } else {
61701
61706
  let marks = $context.marks();
61702
61707
  let { schema } = view.state, serializer = DOMSerializer.fromSchema(schema);
@@ -61726,9 +61731,9 @@ function parseFromClipboard(view, text, html, plainText, $context) {
61726
61731
  break;
61727
61732
  dom = child;
61728
61733
  }
61729
- if (!slice) {
61734
+ if (!slice2) {
61730
61735
  let parser = view.someProp("clipboardParser") || view.someProp("domParser") || DOMParser.fromSchema(view.state.schema);
61731
- slice = parser.parseSlice(dom, {
61736
+ slice2 = parser.parseSlice(dom, {
61732
61737
  preserveWhitespace: !!(asText || sliceData),
61733
61738
  context: $context,
61734
61739
  ruleFromNode(dom2) {
@@ -61739,22 +61744,22 @@ function parseFromClipboard(view, text, html, plainText, $context) {
61739
61744
  });
61740
61745
  }
61741
61746
  if (sliceData) {
61742
- slice = addContext(closeSlice(slice, +sliceData[1], +sliceData[2]), sliceData[4]);
61747
+ slice2 = addContext(closeSlice(slice2, +sliceData[1], +sliceData[2]), sliceData[4]);
61743
61748
  } else {
61744
- slice = Slice.maxOpen(normalizeSiblings(slice.content, $context), true);
61745
- if (slice.openStart || slice.openEnd) {
61749
+ slice2 = Slice.maxOpen(normalizeSiblings(slice2.content, $context), true);
61750
+ if (slice2.openStart || slice2.openEnd) {
61746
61751
  let openStart = 0, openEnd = 0;
61747
- for (let node = slice.content.firstChild; openStart < slice.openStart && !node.type.spec.isolating; openStart++, node = node.firstChild) {
61752
+ for (let node = slice2.content.firstChild; openStart < slice2.openStart && !node.type.spec.isolating; openStart++, node = node.firstChild) {
61748
61753
  }
61749
- for (let node = slice.content.lastChild; openEnd < slice.openEnd && !node.type.spec.isolating; openEnd++, node = node.lastChild) {
61754
+ for (let node = slice2.content.lastChild; openEnd < slice2.openEnd && !node.type.spec.isolating; openEnd++, node = node.lastChild) {
61750
61755
  }
61751
- slice = closeSlice(slice, openStart, openEnd);
61756
+ slice2 = closeSlice(slice2, openStart, openEnd);
61752
61757
  }
61753
61758
  }
61754
61759
  view.someProp("transformPasted", (f) => {
61755
- slice = f(slice, view);
61760
+ slice2 = f(slice2, view);
61756
61761
  });
61757
- return slice;
61762
+ return slice2;
61758
61763
  }
61759
61764
  const inlineParents = /^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;
61760
61765
  function normalizeSiblings(fragment, $context) {
@@ -61786,8 +61791,8 @@ function normalizeSiblings(fragment, $context) {
61786
61791
  }
61787
61792
  return fragment;
61788
61793
  }
61789
- function withWrappers(node, wrap2, from = 0) {
61790
- for (let i = wrap2.length - 1; i >= from; i--)
61794
+ function withWrappers(node, wrap2, from2 = 0) {
61795
+ for (let i = wrap2.length - 1; i >= from2; i--)
61791
61796
  node = wrap2[i].create(null, Fragment.from(node));
61792
61797
  return node;
61793
61798
  }
@@ -61808,22 +61813,22 @@ function closeRight(node, depth) {
61808
61813
  let fill = node.contentMatchAt(node.childCount).fillBefore(Fragment.empty, true);
61809
61814
  return node.copy(fragment.append(fill));
61810
61815
  }
61811
- function closeRange(fragment, side, from, to, depth, openEnd) {
61816
+ function closeRange(fragment, side, from2, to, depth, openEnd) {
61812
61817
  let node = side < 0 ? fragment.firstChild : fragment.lastChild, inner = node.content;
61813
61818
  if (fragment.childCount > 1)
61814
61819
  openEnd = 0;
61815
61820
  if (depth < to - 1)
61816
- inner = closeRange(inner, side, from, to, depth + 1, openEnd);
61817
- if (depth >= from)
61821
+ inner = closeRange(inner, side, from2, to, depth + 1, openEnd);
61822
+ if (depth >= from2)
61818
61823
  inner = side < 0 ? node.contentMatchAt(0).fillBefore(inner, openEnd <= depth).append(inner) : inner.append(node.contentMatchAt(node.childCount).fillBefore(Fragment.empty, true));
61819
61824
  return fragment.replaceChild(side < 0 ? 0 : fragment.childCount - 1, node.copy(inner));
61820
61825
  }
61821
- function closeSlice(slice, openStart, openEnd) {
61822
- if (openStart < slice.openStart)
61823
- slice = new Slice(closeRange(slice.content, -1, openStart, slice.openStart, 0, slice.openEnd), openStart, slice.openEnd);
61824
- if (openEnd < slice.openEnd)
61825
- slice = new Slice(closeRange(slice.content, 1, openEnd, slice.openEnd, 0, 0), slice.openStart, openEnd);
61826
- return slice;
61826
+ function closeSlice(slice2, openStart, openEnd) {
61827
+ if (openStart < slice2.openStart)
61828
+ slice2 = new Slice(closeRange(slice2.content, -1, openStart, slice2.openStart, 0, slice2.openEnd), openStart, slice2.openEnd);
61829
+ if (openEnd < slice2.openEnd)
61830
+ slice2 = new Slice(closeRange(slice2.content, 1, openEnd, slice2.openEnd, 0, 0), slice2.openStart, openEnd);
61831
+ return slice2;
61827
61832
  }
61828
61833
  const wrapMap = {
61829
61834
  thead: ["table"],
@@ -61862,16 +61867,16 @@ function restoreReplacedSpaces(dom) {
61862
61867
  node.parentNode.replaceChild(dom.ownerDocument.createTextNode(" "), node);
61863
61868
  }
61864
61869
  }
61865
- function addContext(slice, context) {
61866
- if (!slice.size)
61867
- return slice;
61868
- let schema = slice.content.firstChild.type.schema, array;
61870
+ function addContext(slice2, context) {
61871
+ if (!slice2.size)
61872
+ return slice2;
61873
+ let schema = slice2.content.firstChild.type.schema, array;
61869
61874
  try {
61870
61875
  array = JSON.parse(context);
61871
61876
  } catch (e) {
61872
- return slice;
61877
+ return slice2;
61873
61878
  }
61874
- let { content, openStart, openEnd } = slice;
61879
+ let { content, openStart, openEnd } = slice2;
61875
61880
  for (let i = array.length - 2; i >= 0; i -= 2) {
61876
61881
  let type2 = schema.nodes[array[i]];
61877
61882
  if (!type2 || type2.hasRequiredAttrs())
@@ -62365,7 +62370,7 @@ handlers.copy = editHandlers.cut = (view, _event) => {
62365
62370
  if (sel.empty)
62366
62371
  return;
62367
62372
  let data2 = brokenClipboardAPI ? null : event.clipboardData;
62368
- let slice = sel.content(), { dom, text } = serializeForClipboard(view, slice);
62373
+ let slice2 = sel.content(), { dom, text } = serializeForClipboard(view, slice2);
62369
62374
  if (data2) {
62370
62375
  event.preventDefault();
62371
62376
  data2.clearData();
@@ -62377,8 +62382,8 @@ handlers.copy = editHandlers.cut = (view, _event) => {
62377
62382
  if (cut)
62378
62383
  view.dispatch(view.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent", "cut"));
62379
62384
  };
62380
- function sliceSingleNode(slice) {
62381
- return slice.openStart == 0 && slice.openEnd == 0 && slice.content.childCount == 1 ? slice.content.firstChild : null;
62385
+ function sliceSingleNode(slice2) {
62386
+ return slice2.openStart == 0 && slice2.openEnd == 0 && slice2.content.childCount == 1 ? slice2.content.firstChild : null;
62382
62387
  }
62383
62388
  function capturePaste(view, event) {
62384
62389
  if (!view.dom.parentNode)
@@ -62401,13 +62406,13 @@ function capturePaste(view, event) {
62401
62406
  }, 50);
62402
62407
  }
62403
62408
  function doPaste(view, text, html, preferPlain, event) {
62404
- let slice = parseFromClipboard(view, text, html, preferPlain, view.state.selection.$from);
62405
- if (view.someProp("handlePaste", (f) => f(view, event, slice || Slice.empty)))
62409
+ let slice2 = parseFromClipboard(view, text, html, preferPlain, view.state.selection.$from);
62410
+ if (view.someProp("handlePaste", (f) => f(view, event, slice2 || Slice.empty)))
62406
62411
  return true;
62407
- if (!slice)
62412
+ if (!slice2)
62408
62413
  return false;
62409
- let singleNode = sliceSingleNode(slice);
62410
- let tr = singleNode ? view.state.tr.replaceSelectionWith(singleNode, preferPlain) : view.state.tr.replaceSelection(slice);
62414
+ let singleNode = sliceSingleNode(slice2);
62415
+ let tr = singleNode ? view.state.tr.replaceSelectionWith(singleNode, preferPlain) : view.state.tr.replaceSelection(slice2);
62411
62416
  view.dispatch(tr.scrollIntoView().setMeta("paste", true).setMeta("uiEvent", "paste"));
62412
62417
  return true;
62413
62418
  }
@@ -62430,8 +62435,8 @@ editHandlers.paste = (view, _event) => {
62430
62435
  capturePaste(view, event);
62431
62436
  };
62432
62437
  class Dragging {
62433
- constructor(slice, move, node) {
62434
- this.slice = slice;
62438
+ constructor(slice2, move, node) {
62439
+ this.slice = slice2;
62435
62440
  this.move = move;
62436
62441
  this.node = node;
62437
62442
  }
@@ -62456,13 +62461,13 @@ handlers.dragstart = (view, _event) => {
62456
62461
  node = NodeSelection.create(view.state.doc, desc.posBefore);
62457
62462
  }
62458
62463
  let draggedSlice = (node || view.state.selection).content();
62459
- let { dom, text, slice } = serializeForClipboard(view, draggedSlice);
62464
+ let { dom, text, slice: slice2 } = serializeForClipboard(view, draggedSlice);
62460
62465
  event.dataTransfer.clearData();
62461
62466
  event.dataTransfer.setData(brokenClipboardAPI ? "Text" : "text/html", dom.innerHTML);
62462
62467
  event.dataTransfer.effectAllowed = "copyMove";
62463
62468
  if (!brokenClipboardAPI)
62464
62469
  event.dataTransfer.setData("text/plain", text);
62465
- view.dragging = new Dragging(slice, !event[dragCopyModifier], node);
62470
+ view.dragging = new Dragging(slice2, !event[dragCopyModifier], node);
62466
62471
  };
62467
62472
  handlers.dragend = (view) => {
62468
62473
  let dragging = view.dragging;
@@ -62482,23 +62487,23 @@ editHandlers.drop = (view, _event) => {
62482
62487
  if (!eventPos)
62483
62488
  return;
62484
62489
  let $mouse = view.state.doc.resolve(eventPos.pos);
62485
- let slice = dragging && dragging.slice;
62486
- if (slice) {
62490
+ let slice2 = dragging && dragging.slice;
62491
+ if (slice2) {
62487
62492
  view.someProp("transformPasted", (f) => {
62488
- slice = f(slice, view);
62493
+ slice2 = f(slice2, view);
62489
62494
  });
62490
62495
  } else {
62491
- slice = parseFromClipboard(view, getText(event.dataTransfer), brokenClipboardAPI ? null : event.dataTransfer.getData("text/html"), false, $mouse);
62496
+ slice2 = parseFromClipboard(view, getText(event.dataTransfer), brokenClipboardAPI ? null : event.dataTransfer.getData("text/html"), false, $mouse);
62492
62497
  }
62493
62498
  let move = !!(dragging && !event[dragCopyModifier]);
62494
- if (view.someProp("handleDrop", (f) => f(view, event, slice || Slice.empty, move))) {
62499
+ if (view.someProp("handleDrop", (f) => f(view, event, slice2 || Slice.empty, move))) {
62495
62500
  event.preventDefault();
62496
62501
  return;
62497
62502
  }
62498
- if (!slice)
62503
+ if (!slice2)
62499
62504
  return;
62500
62505
  event.preventDefault();
62501
- let insertPos = slice ? dropPoint(view.state.doc, $mouse.pos, slice) : $mouse.pos;
62506
+ let insertPos = slice2 ? dropPoint(view.state.doc, $mouse.pos, slice2) : $mouse.pos;
62502
62507
  if (insertPos == null)
62503
62508
  insertPos = $mouse.pos;
62504
62509
  let tr = view.state.tr;
@@ -62510,16 +62515,16 @@ editHandlers.drop = (view, _event) => {
62510
62515
  tr.deleteSelection();
62511
62516
  }
62512
62517
  let pos = tr.mapping.map(insertPos);
62513
- let isNode = slice.openStart == 0 && slice.openEnd == 0 && slice.content.childCount == 1;
62518
+ let isNode = slice2.openStart == 0 && slice2.openEnd == 0 && slice2.content.childCount == 1;
62514
62519
  let beforeInsert = tr.doc;
62515
62520
  if (isNode)
62516
- tr.replaceRangeWith(pos, pos, slice.content.firstChild);
62521
+ tr.replaceRangeWith(pos, pos, slice2.content.firstChild);
62517
62522
  else
62518
- tr.replaceRange(pos, pos, slice);
62523
+ tr.replaceRange(pos, pos, slice2);
62519
62524
  if (tr.doc.eq(beforeInsert))
62520
62525
  return;
62521
62526
  let $pos = tr.doc.resolve(pos);
62522
- if (isNode && NodeSelection.isSelectable(slice.content.firstChild) && $pos.nodeAfter && $pos.nodeAfter.sameMarkup(slice.content.firstChild)) {
62527
+ if (isNode && NodeSelection.isSelectable(slice2.content.firstChild) && $pos.nodeAfter && $pos.nodeAfter.sameMarkup(slice2.content.firstChild)) {
62523
62528
  tr.setSelection(new NodeSelection($pos));
62524
62529
  } else {
62525
62530
  let end = tr.mapping.map(insertPos);
@@ -62611,9 +62616,9 @@ class InlineType {
62611
62616
  this.spec = spec || noSpec;
62612
62617
  }
62613
62618
  map(mapping, span, offset, oldOffset) {
62614
- let from = mapping.map(span.from + oldOffset, this.spec.inclusiveStart ? -1 : 1) - offset;
62619
+ let from2 = mapping.map(span.from + oldOffset, this.spec.inclusiveStart ? -1 : 1) - offset;
62615
62620
  let to = mapping.map(span.to + oldOffset, this.spec.inclusiveEnd ? 1 : -1) - offset;
62616
- return from >= to ? null : new Decoration(from, to, this);
62621
+ return from2 >= to ? null : new Decoration(from2, to, this);
62617
62622
  }
62618
62623
  valid(_, span) {
62619
62624
  return span.from < span.to;
@@ -62633,13 +62638,13 @@ class NodeType2 {
62633
62638
  this.spec = spec || noSpec;
62634
62639
  }
62635
62640
  map(mapping, span, offset, oldOffset) {
62636
- let from = mapping.mapResult(span.from + oldOffset, 1);
62637
- if (from.deleted)
62641
+ let from2 = mapping.mapResult(span.from + oldOffset, 1);
62642
+ if (from2.deleted)
62638
62643
  return null;
62639
62644
  let to = mapping.mapResult(span.to + oldOffset, -1);
62640
- if (to.deleted || to.pos <= from.pos)
62645
+ if (to.deleted || to.pos <= from2.pos)
62641
62646
  return null;
62642
- return new Decoration(from.pos - offset, to.pos - offset, this);
62647
+ return new Decoration(from2.pos - offset, to.pos - offset, this);
62643
62648
  }
62644
62649
  valid(node, span) {
62645
62650
  let { index, offset } = node.content.findIndex(span.from), child;
@@ -62655,16 +62660,16 @@ class Decoration {
62655
62660
  /**
62656
62661
  @internal
62657
62662
  */
62658
- constructor(from, to, type2) {
62659
- this.from = from;
62663
+ constructor(from2, to, type2) {
62664
+ this.from = from2;
62660
62665
  this.to = to;
62661
62666
  this.type = type2;
62662
62667
  }
62663
62668
  /**
62664
62669
  @internal
62665
62670
  */
62666
- copy(from, to) {
62667
- return new Decoration(from, to, this.type);
62671
+ copy(from2, to) {
62672
+ return new Decoration(from2, to, this.type);
62668
62673
  }
62669
62674
  /**
62670
62675
  @internal
@@ -62693,16 +62698,16 @@ class Decoration {
62693
62698
  Creates an inline decoration, which adds the given attributes to
62694
62699
  each inline node between `from` and `to`.
62695
62700
  */
62696
- static inline(from, to, attrs, spec) {
62697
- return new Decoration(from, to, new InlineType(attrs, spec));
62701
+ static inline(from2, to, attrs, spec) {
62702
+ return new Decoration(from2, to, new InlineType(attrs, spec));
62698
62703
  }
62699
62704
  /**
62700
62705
  Creates a node decoration. `from` and `to` should point precisely
62701
62706
  before and after a node in the document. That node, and only that
62702
62707
  node, will receive the given attributes.
62703
62708
  */
62704
- static node(from, to, attrs, spec) {
62705
- return new Decoration(from, to, new NodeType2(attrs, spec));
62709
+ static node(from2, to, attrs, spec) {
62710
+ return new Decoration(from2, to, new NodeType2(attrs, spec));
62706
62711
  }
62707
62712
  /**
62708
62713
  The spec provided when creating this decoration. Can be useful
@@ -62841,10 +62846,10 @@ class DecorationSet {
62841
62846
  let children = this.children, local = this.local;
62842
62847
  for (let i = 0; i < children.length; i += 3) {
62843
62848
  let found2;
62844
- let from = children[i] + offset, to = children[i + 1] + offset;
62849
+ let from2 = children[i] + offset, to = children[i + 1] + offset;
62845
62850
  for (let j = 0, span; j < decorations.length; j++)
62846
62851
  if (span = decorations[j]) {
62847
- if (span.from > from && span.to < to) {
62852
+ if (span.from > from2 && span.to < to) {
62848
62853
  decorations[j] = null;
62849
62854
  (found2 || (found2 = [])).push(span);
62850
62855
  }
@@ -62853,7 +62858,7 @@ class DecorationSet {
62853
62858
  continue;
62854
62859
  if (children == this.children)
62855
62860
  children = this.children.slice();
62856
- let removed = children[i + 2].removeInner(found2, from + 1);
62861
+ let removed = children[i + 2].removeInner(found2, from2 + 1);
62857
62862
  if (removed != empty) {
62858
62863
  children[i + 2] = removed;
62859
62864
  } else {
@@ -62892,9 +62897,9 @@ class DecorationSet {
62892
62897
  for (let i = 0; i < this.local.length; i++) {
62893
62898
  let dec = this.local[i];
62894
62899
  if (dec.from < end && dec.to > start && dec.type instanceof InlineType) {
62895
- let from = Math.max(start, dec.from) - start, to = Math.min(end, dec.to) - start;
62896
- if (from < to)
62897
- (local || (local = [])).push(dec.copy(from, to));
62900
+ let from2 = Math.max(start, dec.from) - start, to = Math.min(end, dec.to) - start;
62901
+ if (from2 < to)
62902
+ (local || (local = [])).push(dec.copy(from2, to));
62898
62903
  }
62899
62904
  }
62900
62905
  if (local) {
@@ -63037,7 +63042,7 @@ function mapChildren(oldChildren, newLocal, mapping, node, offset, oldOffset, op
63037
63042
  children[i + 1] = -1;
63038
63043
  continue;
63039
63044
  }
63040
- let from = mapping.map(oldChildren[i] + oldOffset), fromLocal = from - offset;
63045
+ let from2 = mapping.map(oldChildren[i] + oldOffset), fromLocal = from2 - offset;
63041
63046
  if (fromLocal < 0 || fromLocal >= node.content.size) {
63042
63047
  mustRebuild = true;
63043
63048
  continue;
@@ -63046,7 +63051,7 @@ function mapChildren(oldChildren, newLocal, mapping, node, offset, oldOffset, op
63046
63051
  let { index, offset: childOffset } = node.content.findIndex(fromLocal);
63047
63052
  let childNode = node.maybeChild(index);
63048
63053
  if (childNode && childOffset == fromLocal && childOffset + childNode.nodeSize == toLocal) {
63049
- let mapped = children[i + 2].mapInner(mapping, childNode, from + 1, oldChildren[i] + oldOffset + 1, options2);
63054
+ let mapped = children[i + 2].mapInner(mapping, childNode, from2 + 1, oldChildren[i] + oldOffset + 1, options2);
63050
63055
  if (mapped != empty) {
63051
63056
  children[i] = fromLocal;
63052
63057
  children[i + 1] = toLocal;
@@ -63069,8 +63074,8 @@ function mapChildren(oldChildren, newLocal, mapping, node, offset, oldOffset, op
63069
63074
  i -= 3;
63070
63075
  }
63071
63076
  for (let i = 0, j = 0; i < built.children.length; i += 3) {
63072
- let from = built.children[i];
63073
- while (j < children.length && children[j] < from)
63077
+ let from2 = built.children[i];
63078
+ while (j < children.length && children[j] < from2)
63074
63079
  j += 3;
63075
63080
  children.splice(j, 0, built.children[i], built.children[i + 1], built.children[i + 2]);
63076
63081
  }
@@ -63343,12 +63348,12 @@ class DOMObserver {
63343
63348
  this.queue = [];
63344
63349
  let sel = view.domSelectionRange();
63345
63350
  let newSel = !this.suppressingSelectionUpdates && !this.currentSelection.eq(sel) && hasFocusAndSelection(view) && !this.ignoreSelectionChange(sel);
63346
- let from = -1, to = -1, typeOver = false, added = [];
63351
+ let from2 = -1, to = -1, typeOver = false, added = [];
63347
63352
  if (view.editable) {
63348
63353
  for (let i = 0; i < mutations.length; i++) {
63349
63354
  let result = this.registerMutation(mutations[i], added);
63350
63355
  if (result) {
63351
- from = from < 0 ? result.from : Math.min(result.from, from);
63356
+ from2 = from2 < 0 ? result.from : Math.min(result.from, from2);
63352
63357
  to = to < 0 ? result.to : Math.max(result.to, to);
63353
63358
  if (result.typeOver)
63354
63359
  typeOver = true;
@@ -63373,17 +63378,17 @@ class DOMObserver {
63373
63378
  }
63374
63379
  }
63375
63380
  let readSel = null;
63376
- if (from < 0 && newSel && view.input.lastFocus > Date.now() - 200 && Math.max(view.input.lastTouch, view.input.lastClick.time) < Date.now() - 300 && selectionCollapsed(sel) && (readSel = selectionFromDOM(view)) && readSel.eq(Selection.near(view.state.doc.resolve(0), 1))) {
63381
+ if (from2 < 0 && newSel && view.input.lastFocus > Date.now() - 200 && Math.max(view.input.lastTouch, view.input.lastClick.time) < Date.now() - 300 && selectionCollapsed(sel) && (readSel = selectionFromDOM(view)) && readSel.eq(Selection.near(view.state.doc.resolve(0), 1))) {
63377
63382
  view.input.lastFocus = 0;
63378
63383
  selectionToDOM(view);
63379
63384
  this.currentSelection.set(sel);
63380
63385
  view.scrollToSelection();
63381
- } else if (from > -1 || newSel) {
63382
- if (from > -1) {
63383
- view.docView.markDirty(from, to);
63386
+ } else if (from2 > -1 || newSel) {
63387
+ if (from2 > -1) {
63388
+ view.docView.markDirty(from2, to);
63384
63389
  checkCSS(view);
63385
63390
  }
63386
- this.handleDOMChange(from, to, typeOver, added);
63391
+ this.handleDOMChange(from2, to, typeOver, added);
63387
63392
  if (view.docView && view.docView.dirty)
63388
63393
  view.updateState(view.state);
63389
63394
  else if (!this.currentSelection.eq(sel))
@@ -63420,10 +63425,10 @@ class DOMObserver {
63420
63425
  }
63421
63426
  }
63422
63427
  let fromOffset = prev && prev.parentNode == mut.target ? domIndex(prev) + 1 : 0;
63423
- let from = desc.localPosFromDOM(mut.target, fromOffset, -1);
63428
+ let from2 = desc.localPosFromDOM(mut.target, fromOffset, -1);
63424
63429
  let toOffset = next && next.parentNode == mut.target ? domIndex(next) : mut.target.childNodes.length;
63425
63430
  let to = desc.localPosFromDOM(mut.target, toOffset, 1);
63426
- return { from, to };
63431
+ return { from: from2, to };
63427
63432
  } else if (mut.type == "attributes") {
63428
63433
  return { from: desc.posAtStart - desc.border, to: desc.posAtEnd + desc.border };
63429
63434
  } else {
@@ -63488,7 +63493,7 @@ function blockParent(view, node) {
63488
63493
  return null;
63489
63494
  }
63490
63495
  function parseBetween(view, from_, to_) {
63491
- let { node: parent, fromOffset, toOffset, from, to } = view.docView.parseRange(from_, to_);
63496
+ let { node: parent, fromOffset, toOffset, from: from2, to } = view.docView.parseRange(from_, to_);
63492
63497
  let domSel = view.domSelectionRange();
63493
63498
  let find2;
63494
63499
  let anchor = domSel.anchorNode;
@@ -63510,7 +63515,7 @@ function parseBetween(view, from_, to_) {
63510
63515
  }
63511
63516
  let startDoc = view.state.doc;
63512
63517
  let parser = view.someProp("domParser") || DOMParser.fromSchema(view.state.schema);
63513
- let $from = startDoc.resolve(from);
63518
+ let $from = startDoc.resolve(from2);
63514
63519
  let sel = null, doc2 = parser.parse(parent, {
63515
63520
  topNode: $from.parent,
63516
63521
  topMatch: $from.parent.contentMatchAt($from.index()),
@@ -63526,9 +63531,9 @@ function parseBetween(view, from_, to_) {
63526
63531
  let anchor2 = find2[0].pos, head = find2[1] && find2[1].pos;
63527
63532
  if (head == null)
63528
63533
  head = anchor2;
63529
- sel = { anchor: anchor2 + from, head: head + from };
63534
+ sel = { anchor: anchor2 + from2, head: head + from2 };
63530
63535
  }
63531
- return { doc: doc2, sel, from, to };
63536
+ return { doc: doc2, sel, from: from2, to };
63532
63537
  }
63533
63538
  function ruleFromNode(dom) {
63534
63539
  let desc = dom.pmViewDesc;
@@ -63548,10 +63553,10 @@ function ruleFromNode(dom) {
63548
63553
  return null;
63549
63554
  }
63550
63555
  const isInline = /^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;
63551
- function readDOMChange(view, from, to, typeOver, addedNodes) {
63556
+ function readDOMChange(view, from2, to, typeOver, addedNodes) {
63552
63557
  let compositionID = view.input.compositionPendingChanges || (view.composing ? view.input.compositionID : 0);
63553
63558
  view.input.compositionPendingChanges = 0;
63554
- if (from < 0) {
63559
+ if (from2 < 0) {
63555
63560
  let origin = view.input.lastSelectionTime > Date.now() - 50 ? view.input.lastSelectionOrigin : null;
63556
63561
  let newSel = selectionFromDOM(view, origin);
63557
63562
  if (newSel && !view.state.selection.eq(newSel)) {
@@ -63568,12 +63573,12 @@ function readDOMChange(view, from, to, typeOver, addedNodes) {
63568
63573
  }
63569
63574
  return;
63570
63575
  }
63571
- let $before = view.state.doc.resolve(from);
63576
+ let $before = view.state.doc.resolve(from2);
63572
63577
  let shared = $before.sharedDepth(to);
63573
- from = $before.before(shared + 1);
63578
+ from2 = $before.before(shared + 1);
63574
63579
  to = view.state.doc.resolve(to).after(shared + 1);
63575
63580
  let sel = view.state.selection;
63576
- let parse = parseBetween(view, from, to);
63581
+ let parse = parseBetween(view, from2, to);
63577
63582
  let doc2 = view.state.doc, compare = doc2.slice(parse.from, parse.to);
63578
63583
  let preferredPos, preferredSide;
63579
63584
  if (view.input.lastKeyCode === 8 && Date.now() - 100 < view.input.lastKeyCodeTime) {
@@ -63818,7 +63823,7 @@ class EditorView {
63818
63823
  updateCursorWrapper(this);
63819
63824
  this.nodeViews = buildNodeViews(this);
63820
63825
  this.docView = docViewDesc(this.state.doc, computeDocDeco(this), viewDecorations(this), this.dom, this);
63821
- this.domObserver = new DOMObserver(this, (from, to, typeOver, added) => readDOMChange(this, from, to, typeOver, added));
63826
+ this.domObserver = new DOMObserver(this, (from2, to, typeOver, added) => readDOMChange(this, from2, to, typeOver, added));
63822
63827
  this.domObserver.start();
63823
63828
  initInput(this);
63824
63829
  this.updatePluginViews();
@@ -64468,10 +64473,10 @@ function normalizeKeyName(name) {
64468
64473
  result = "Shift-" + result;
64469
64474
  return result;
64470
64475
  }
64471
- function normalize(map2) {
64476
+ function normalize(map22) {
64472
64477
  let copy2 = /* @__PURE__ */ Object.create(null);
64473
- for (let prop in map2)
64474
- copy2[normalizeKeyName(prop)] = map2[prop];
64478
+ for (let prop in map22)
64479
+ copy2[normalizeKeyName(prop)] = map22[prop];
64475
64480
  return copy2;
64476
64481
  }
64477
64482
  function modifiers(name, event, shift2 = true) {
@@ -64489,19 +64494,19 @@ function keymap(bindings) {
64489
64494
  return new Plugin({ props: { handleKeyDown: keydownHandler(bindings) } });
64490
64495
  }
64491
64496
  function keydownHandler(bindings) {
64492
- let map2 = normalize(bindings);
64497
+ let map22 = normalize(bindings);
64493
64498
  return function(view, event) {
64494
- let name = keyName(event), baseName, direct = map2[modifiers(name, event)];
64499
+ let name = keyName(event), baseName, direct = map22[modifiers(name, event)];
64495
64500
  if (direct && direct(view.state, view.dispatch, view))
64496
64501
  return true;
64497
64502
  if (name.length == 1 && name != " ") {
64498
64503
  if (event.shiftKey) {
64499
- let noShift = map2[modifiers(name, event, false)];
64504
+ let noShift = map22[modifiers(name, event, false)];
64500
64505
  if (noShift && noShift(view.state, view.dispatch, view))
64501
64506
  return true;
64502
64507
  }
64503
64508
  if ((event.shiftKey || event.altKey || event.metaKey || name.charCodeAt(0) > 127) && (baseName = base[event.keyCode]) && baseName != name) {
64504
- let fromCode = map2[modifiers(baseName, event)];
64509
+ let fromCode = map22[modifiers(baseName, event)];
64505
64510
  if (fromCode && fromCode(view.state, view.dispatch, view))
64506
64511
  return true;
64507
64512
  }
@@ -64889,7 +64894,7 @@ const _ExtensionService = class _ExtensionService2 {
64889
64894
  return container;
64890
64895
  }
64891
64896
  /**
64892
- * TODO: Add input and paste rules.
64897
+ * TODO:Artem Add input and paste rules.
64893
64898
  *
64894
64899
  * Get all PM plugins defined in the extensions.
64895
64900
  * And also keyboard shortcuts.
@@ -65150,14 +65155,14 @@ function toggleMark$1(markType, attrs = null) {
65150
65155
  if (has2) {
65151
65156
  tr.removeMark($from.pos, $to.pos, markType);
65152
65157
  } else {
65153
- let from = $from.pos, to = $to.pos, start = $from.nodeAfter, end = $to.nodeBefore;
65158
+ let from2 = $from.pos, to = $to.pos, start = $from.nodeAfter, end = $to.nodeBefore;
65154
65159
  let spaceStart = start && start.isText ? /^\s*/.exec(start.text)[0].length : 0;
65155
65160
  let spaceEnd = end && end.isText ? /\s*$/.exec(end.text)[0].length : 0;
65156
- if (from + spaceStart < to) {
65157
- from += spaceStart;
65161
+ if (from2 + spaceStart < to) {
65162
+ from2 += spaceStart;
65158
65163
  to -= spaceEnd;
65159
65164
  }
65160
- tr.addMark(from, to, markType.create(attrs));
65165
+ tr.addMark(from2, to, markType.create(attrs));
65161
65166
  }
65162
65167
  }
65163
65168
  dispatch(tr.scrollIntoView());
@@ -65205,6 +65210,32 @@ const Editable = Extension.create({
65205
65210
  return [editablePlugin];
65206
65211
  }
65207
65212
  });
65213
+ const EditorFocus = Extension.create({
65214
+ name: "editorFocus",
65215
+ addPmPlugins() {
65216
+ const editor = this.editor;
65217
+ const editorFocusPlugin = new Plugin({
65218
+ key: new PluginKey("editorFocus"),
65219
+ props: {
65220
+ handleDOMEvents: {
65221
+ focus: (view, event) => {
65222
+ editor.isFocused = true;
65223
+ const tr = editor.state.tr.setMeta("focus", { event }).setMeta("addToHistory", false);
65224
+ view.dispatch(tr);
65225
+ return false;
65226
+ },
65227
+ blur: (view, event) => {
65228
+ editor.isFocused = false;
65229
+ const tr = editor.state.tr.setMeta("blur", { event }).setMeta("addToHistory", false);
65230
+ view.dispatch(tr);
65231
+ return false;
65232
+ }
65233
+ }
65234
+ }
65235
+ });
65236
+ return [editorFocusPlugin];
65237
+ }
65238
+ });
65208
65239
  function createDocument(converter, schema, parseOptions) {
65209
65240
  const documentData = converter.getSchema();
65210
65241
  console.debug("\nSCHEMA", JSON.stringify(documentData, null, 2), "\n");
@@ -65347,7 +65378,8 @@ const initComments = (editorView, converter, documentId) => {
65347
65378
  commentsFiles.commentsIds = converter.convertedXml["word/commentsIds.xml"];
65348
65379
  doc2.descendants((node, pos) => {
65349
65380
  if (node.type.name === "commentRangeStart") {
65350
- const id = parseInt(node.attrs.attributes["w:id"]);
65381
+ if (!node.attrs?.attributes || !("w:id" in node.attrs.attributes)) return;
65382
+ const id = parseInt(node?.attrs?.attributes["w:id"]);
65351
65383
  const coords = editorView.coordsAtPos(pos);
65352
65384
  const parentThread = getParentCommentId(id);
65353
65385
  const comment2 = getComment(id);
@@ -65358,7 +65390,8 @@ const initComments = (editorView, converter, documentId) => {
65358
65390
  comment: comment2
65359
65391
  });
65360
65392
  } else if (node.type.name === "commentRangeEnd") {
65361
- const id = parseInt(node.attrs.attributes["w:id"]);
65393
+ if (!node.attrs?.attributes || !("w:id" in node.attrs.attributes)) return;
65394
+ const id = parseInt(node?.attrs?.attributes["w:id"]);
65362
65395
  const match2 = comments.find((item) => item.id === id);
65363
65396
  const coords = editorView.coordsAtPos(pos);
65364
65397
  match2.end = coords;
@@ -65437,6 +65470,7 @@ class Editor extends EventEmitter {
65437
65470
  __publicField2(this, "extensionStorage", {});
65438
65471
  __publicField2(this, "schema");
65439
65472
  __publicField2(this, "view");
65473
+ __publicField2(this, "isFocused", false);
65440
65474
  __privateAdd2(this, _css);
65441
65475
  __publicField2(this, "options", {
65442
65476
  element: document.createElement("div"),
@@ -65604,6 +65638,7 @@ createExtensionService_fn = function() {
65604
65638
  const coreExtensions = [
65605
65639
  Editable,
65606
65640
  Commands,
65641
+ EditorFocus,
65607
65642
  Keymap
65608
65643
  ];
65609
65644
  const allExtensions = [
@@ -65672,6 +65707,22 @@ dispatchTransaction_fn = function(transaction) {
65672
65707
  transaction
65673
65708
  });
65674
65709
  }
65710
+ const focus = transaction.getMeta("focus");
65711
+ if (focus) {
65712
+ this.emit("focus", {
65713
+ editor: this,
65714
+ event: focus.event,
65715
+ transaction
65716
+ });
65717
+ }
65718
+ const blur = transaction.getMeta("blur");
65719
+ if (blur) {
65720
+ this.emit("blur", {
65721
+ editor: this,
65722
+ event: blur.event,
65723
+ transaction
65724
+ });
65725
+ }
65675
65726
  if (!transaction.docChanged) {
65676
65727
  return;
65677
65728
  }
@@ -65752,6 +65803,563 @@ class Mark2 {
65752
65803
  return new Mark2(...args);
65753
65804
  }
65754
65805
  }
65806
+ var GOOD_LEAF_SIZE = 200;
65807
+ var RopeSequence = function RopeSequence2() {
65808
+ };
65809
+ RopeSequence.prototype.append = function append(other) {
65810
+ if (!other.length) {
65811
+ return this;
65812
+ }
65813
+ other = RopeSequence.from(other);
65814
+ return !this.length && other || other.length < GOOD_LEAF_SIZE && this.leafAppend(other) || this.length < GOOD_LEAF_SIZE && other.leafPrepend(this) || this.appendInner(other);
65815
+ };
65816
+ RopeSequence.prototype.prepend = function prepend(other) {
65817
+ if (!other.length) {
65818
+ return this;
65819
+ }
65820
+ return RopeSequence.from(other).append(this);
65821
+ };
65822
+ RopeSequence.prototype.appendInner = function appendInner(other) {
65823
+ return new Append(this, other);
65824
+ };
65825
+ RopeSequence.prototype.slice = function slice(from2, to) {
65826
+ if (from2 === void 0) from2 = 0;
65827
+ if (to === void 0) to = this.length;
65828
+ if (from2 >= to) {
65829
+ return RopeSequence.empty;
65830
+ }
65831
+ return this.sliceInner(Math.max(0, from2), Math.min(this.length, to));
65832
+ };
65833
+ RopeSequence.prototype.get = function get2(i) {
65834
+ if (i < 0 || i >= this.length) {
65835
+ return void 0;
65836
+ }
65837
+ return this.getInner(i);
65838
+ };
65839
+ RopeSequence.prototype.forEach = function forEach(f, from2, to) {
65840
+ if (from2 === void 0) from2 = 0;
65841
+ if (to === void 0) to = this.length;
65842
+ if (from2 <= to) {
65843
+ this.forEachInner(f, from2, to, 0);
65844
+ } else {
65845
+ this.forEachInvertedInner(f, from2, to, 0);
65846
+ }
65847
+ };
65848
+ RopeSequence.prototype.map = function map2(f, from2, to) {
65849
+ if (from2 === void 0) from2 = 0;
65850
+ if (to === void 0) to = this.length;
65851
+ var result = [];
65852
+ this.forEach(function(elt, i) {
65853
+ return result.push(f(elt, i));
65854
+ }, from2, to);
65855
+ return result;
65856
+ };
65857
+ RopeSequence.from = function from(values2) {
65858
+ if (values2 instanceof RopeSequence) {
65859
+ return values2;
65860
+ }
65861
+ return values2 && values2.length ? new Leaf(values2) : RopeSequence.empty;
65862
+ };
65863
+ var Leaf = /* @__PURE__ */ function(RopeSequence3) {
65864
+ function Leaf2(values2) {
65865
+ RopeSequence3.call(this);
65866
+ this.values = values2;
65867
+ }
65868
+ if (RopeSequence3) Leaf2.__proto__ = RopeSequence3;
65869
+ Leaf2.prototype = Object.create(RopeSequence3 && RopeSequence3.prototype);
65870
+ Leaf2.prototype.constructor = Leaf2;
65871
+ var prototypeAccessors = { length: { configurable: true }, depth: { configurable: true } };
65872
+ Leaf2.prototype.flatten = function flatten() {
65873
+ return this.values;
65874
+ };
65875
+ Leaf2.prototype.sliceInner = function sliceInner(from2, to) {
65876
+ if (from2 == 0 && to == this.length) {
65877
+ return this;
65878
+ }
65879
+ return new Leaf2(this.values.slice(from2, to));
65880
+ };
65881
+ Leaf2.prototype.getInner = function getInner(i) {
65882
+ return this.values[i];
65883
+ };
65884
+ Leaf2.prototype.forEachInner = function forEachInner(f, from2, to, start) {
65885
+ for (var i = from2; i < to; i++) {
65886
+ if (f(this.values[i], start + i) === false) {
65887
+ return false;
65888
+ }
65889
+ }
65890
+ };
65891
+ Leaf2.prototype.forEachInvertedInner = function forEachInvertedInner(f, from2, to, start) {
65892
+ for (var i = from2 - 1; i >= to; i--) {
65893
+ if (f(this.values[i], start + i) === false) {
65894
+ return false;
65895
+ }
65896
+ }
65897
+ };
65898
+ Leaf2.prototype.leafAppend = function leafAppend(other) {
65899
+ if (this.length + other.length <= GOOD_LEAF_SIZE) {
65900
+ return new Leaf2(this.values.concat(other.flatten()));
65901
+ }
65902
+ };
65903
+ Leaf2.prototype.leafPrepend = function leafPrepend(other) {
65904
+ if (this.length + other.length <= GOOD_LEAF_SIZE) {
65905
+ return new Leaf2(other.flatten().concat(this.values));
65906
+ }
65907
+ };
65908
+ prototypeAccessors.length.get = function() {
65909
+ return this.values.length;
65910
+ };
65911
+ prototypeAccessors.depth.get = function() {
65912
+ return 0;
65913
+ };
65914
+ Object.defineProperties(Leaf2.prototype, prototypeAccessors);
65915
+ return Leaf2;
65916
+ }(RopeSequence);
65917
+ RopeSequence.empty = new Leaf([]);
65918
+ var Append = /* @__PURE__ */ function(RopeSequence3) {
65919
+ function Append2(left, right) {
65920
+ RopeSequence3.call(this);
65921
+ this.left = left;
65922
+ this.right = right;
65923
+ this.length = left.length + right.length;
65924
+ this.depth = Math.max(left.depth, right.depth) + 1;
65925
+ }
65926
+ if (RopeSequence3) Append2.__proto__ = RopeSequence3;
65927
+ Append2.prototype = Object.create(RopeSequence3 && RopeSequence3.prototype);
65928
+ Append2.prototype.constructor = Append2;
65929
+ Append2.prototype.flatten = function flatten() {
65930
+ return this.left.flatten().concat(this.right.flatten());
65931
+ };
65932
+ Append2.prototype.getInner = function getInner(i) {
65933
+ return i < this.left.length ? this.left.get(i) : this.right.get(i - this.left.length);
65934
+ };
65935
+ Append2.prototype.forEachInner = function forEachInner(f, from2, to, start) {
65936
+ var leftLen = this.left.length;
65937
+ if (from2 < leftLen && this.left.forEachInner(f, from2, Math.min(to, leftLen), start) === false) {
65938
+ return false;
65939
+ }
65940
+ if (to > leftLen && this.right.forEachInner(f, Math.max(from2 - leftLen, 0), Math.min(this.length, to) - leftLen, start + leftLen) === false) {
65941
+ return false;
65942
+ }
65943
+ };
65944
+ Append2.prototype.forEachInvertedInner = function forEachInvertedInner(f, from2, to, start) {
65945
+ var leftLen = this.left.length;
65946
+ if (from2 > leftLen && this.right.forEachInvertedInner(f, from2 - leftLen, Math.max(to, leftLen) - leftLen, start + leftLen) === false) {
65947
+ return false;
65948
+ }
65949
+ if (to < leftLen && this.left.forEachInvertedInner(f, Math.min(from2, leftLen), to, start) === false) {
65950
+ return false;
65951
+ }
65952
+ };
65953
+ Append2.prototype.sliceInner = function sliceInner(from2, to) {
65954
+ if (from2 == 0 && to == this.length) {
65955
+ return this;
65956
+ }
65957
+ var leftLen = this.left.length;
65958
+ if (to <= leftLen) {
65959
+ return this.left.slice(from2, to);
65960
+ }
65961
+ if (from2 >= leftLen) {
65962
+ return this.right.slice(from2 - leftLen, to - leftLen);
65963
+ }
65964
+ return this.left.slice(from2, leftLen).append(this.right.slice(0, to - leftLen));
65965
+ };
65966
+ Append2.prototype.leafAppend = function leafAppend(other) {
65967
+ var inner = this.right.leafAppend(other);
65968
+ if (inner) {
65969
+ return new Append2(this.left, inner);
65970
+ }
65971
+ };
65972
+ Append2.prototype.leafPrepend = function leafPrepend(other) {
65973
+ var inner = this.left.leafPrepend(other);
65974
+ if (inner) {
65975
+ return new Append2(inner, this.right);
65976
+ }
65977
+ };
65978
+ Append2.prototype.appendInner = function appendInner2(other) {
65979
+ if (this.left.depth >= Math.max(this.right.depth, other.depth) + 1) {
65980
+ return new Append2(this.left, new Append2(this.right, other));
65981
+ }
65982
+ return new Append2(this, other);
65983
+ };
65984
+ return Append2;
65985
+ }(RopeSequence);
65986
+ const max_empty_items = 500;
65987
+ class Branch {
65988
+ constructor(items, eventCount) {
65989
+ this.items = items;
65990
+ this.eventCount = eventCount;
65991
+ }
65992
+ // Pop the latest event off the branch's history and apply it
65993
+ // to a document transform.
65994
+ popEvent(state2, preserveItems) {
65995
+ if (this.eventCount == 0)
65996
+ return null;
65997
+ let end = this.items.length;
65998
+ for (; ; end--) {
65999
+ let next = this.items.get(end - 1);
66000
+ if (next.selection) {
66001
+ --end;
66002
+ break;
66003
+ }
66004
+ }
66005
+ let remap, mapFrom;
66006
+ if (preserveItems) {
66007
+ remap = this.remapping(end, this.items.length);
66008
+ mapFrom = remap.maps.length;
66009
+ }
66010
+ let transform = state2.tr;
66011
+ let selection, remaining;
66012
+ let addAfter = [], addBefore = [];
66013
+ this.items.forEach((item, i) => {
66014
+ if (!item.step) {
66015
+ if (!remap) {
66016
+ remap = this.remapping(end, i + 1);
66017
+ mapFrom = remap.maps.length;
66018
+ }
66019
+ mapFrom--;
66020
+ addBefore.push(item);
66021
+ return;
66022
+ }
66023
+ if (remap) {
66024
+ addBefore.push(new Item(item.map));
66025
+ let step = item.step.map(remap.slice(mapFrom)), map22;
66026
+ if (step && transform.maybeStep(step).doc) {
66027
+ map22 = transform.mapping.maps[transform.mapping.maps.length - 1];
66028
+ addAfter.push(new Item(map22, void 0, void 0, addAfter.length + addBefore.length));
66029
+ }
66030
+ mapFrom--;
66031
+ if (map22)
66032
+ remap.appendMap(map22, mapFrom);
66033
+ } else {
66034
+ transform.maybeStep(item.step);
66035
+ }
66036
+ if (item.selection) {
66037
+ selection = remap ? item.selection.map(remap.slice(mapFrom)) : item.selection;
66038
+ remaining = new Branch(this.items.slice(0, end).append(addBefore.reverse().concat(addAfter)), this.eventCount - 1);
66039
+ return false;
66040
+ }
66041
+ }, this.items.length, 0);
66042
+ return { remaining, transform, selection };
66043
+ }
66044
+ // Create a new branch with the given transform added.
66045
+ addTransform(transform, selection, histOptions, preserveItems) {
66046
+ let newItems = [], eventCount = this.eventCount;
66047
+ let oldItems = this.items, lastItem = !preserveItems && oldItems.length ? oldItems.get(oldItems.length - 1) : null;
66048
+ for (let i = 0; i < transform.steps.length; i++) {
66049
+ let step = transform.steps[i].invert(transform.docs[i]);
66050
+ let item = new Item(transform.mapping.maps[i], step, selection), merged;
66051
+ if (merged = lastItem && lastItem.merge(item)) {
66052
+ item = merged;
66053
+ if (i)
66054
+ newItems.pop();
66055
+ else
66056
+ oldItems = oldItems.slice(0, oldItems.length - 1);
66057
+ }
66058
+ newItems.push(item);
66059
+ if (selection) {
66060
+ eventCount++;
66061
+ selection = void 0;
66062
+ }
66063
+ if (!preserveItems)
66064
+ lastItem = item;
66065
+ }
66066
+ let overflow = eventCount - histOptions.depth;
66067
+ if (overflow > DEPTH_OVERFLOW) {
66068
+ oldItems = cutOffEvents(oldItems, overflow);
66069
+ eventCount -= overflow;
66070
+ }
66071
+ return new Branch(oldItems.append(newItems), eventCount);
66072
+ }
66073
+ remapping(from2, to) {
66074
+ let maps = new Mapping();
66075
+ this.items.forEach((item, i) => {
66076
+ let mirrorPos = item.mirrorOffset != null && i - item.mirrorOffset >= from2 ? maps.maps.length - item.mirrorOffset : void 0;
66077
+ maps.appendMap(item.map, mirrorPos);
66078
+ }, from2, to);
66079
+ return maps;
66080
+ }
66081
+ addMaps(array) {
66082
+ if (this.eventCount == 0)
66083
+ return this;
66084
+ return new Branch(this.items.append(array.map((map22) => new Item(map22))), this.eventCount);
66085
+ }
66086
+ // When the collab module receives remote changes, the history has
66087
+ // to know about those, so that it can adjust the steps that were
66088
+ // rebased on top of the remote changes, and include the position
66089
+ // maps for the remote changes in its array of items.
66090
+ rebased(rebasedTransform, rebasedCount) {
66091
+ if (!this.eventCount)
66092
+ return this;
66093
+ let rebasedItems = [], start = Math.max(0, this.items.length - rebasedCount);
66094
+ let mapping = rebasedTransform.mapping;
66095
+ let newUntil = rebasedTransform.steps.length;
66096
+ let eventCount = this.eventCount;
66097
+ this.items.forEach((item) => {
66098
+ if (item.selection)
66099
+ eventCount--;
66100
+ }, start);
66101
+ let iRebased = rebasedCount;
66102
+ this.items.forEach((item) => {
66103
+ let pos = mapping.getMirror(--iRebased);
66104
+ if (pos == null)
66105
+ return;
66106
+ newUntil = Math.min(newUntil, pos);
66107
+ let map22 = mapping.maps[pos];
66108
+ if (item.step) {
66109
+ let step = rebasedTransform.steps[pos].invert(rebasedTransform.docs[pos]);
66110
+ let selection = item.selection && item.selection.map(mapping.slice(iRebased + 1, pos));
66111
+ if (selection)
66112
+ eventCount++;
66113
+ rebasedItems.push(new Item(map22, step, selection));
66114
+ } else {
66115
+ rebasedItems.push(new Item(map22));
66116
+ }
66117
+ }, start);
66118
+ let newMaps = [];
66119
+ for (let i = rebasedCount; i < newUntil; i++)
66120
+ newMaps.push(new Item(mapping.maps[i]));
66121
+ let items = this.items.slice(0, start).append(newMaps).append(rebasedItems);
66122
+ let branch = new Branch(items, eventCount);
66123
+ if (branch.emptyItemCount() > max_empty_items)
66124
+ branch = branch.compress(this.items.length - rebasedItems.length);
66125
+ return branch;
66126
+ }
66127
+ emptyItemCount() {
66128
+ let count = 0;
66129
+ this.items.forEach((item) => {
66130
+ if (!item.step)
66131
+ count++;
66132
+ });
66133
+ return count;
66134
+ }
66135
+ // Compressing a branch means rewriting it to push the air (map-only
66136
+ // items) out. During collaboration, these naturally accumulate
66137
+ // because each remote change adds one. The `upto` argument is used
66138
+ // to ensure that only the items below a given level are compressed,
66139
+ // because `rebased` relies on a clean, untouched set of items in
66140
+ // order to associate old items with rebased steps.
66141
+ compress(upto = this.items.length) {
66142
+ let remap = this.remapping(0, upto), mapFrom = remap.maps.length;
66143
+ let items = [], events2 = 0;
66144
+ this.items.forEach((item, i) => {
66145
+ if (i >= upto) {
66146
+ items.push(item);
66147
+ if (item.selection)
66148
+ events2++;
66149
+ } else if (item.step) {
66150
+ let step = item.step.map(remap.slice(mapFrom)), map22 = step && step.getMap();
66151
+ mapFrom--;
66152
+ if (map22)
66153
+ remap.appendMap(map22, mapFrom);
66154
+ if (step) {
66155
+ let selection = item.selection && item.selection.map(remap.slice(mapFrom));
66156
+ if (selection)
66157
+ events2++;
66158
+ let newItem = new Item(map22.invert(), step, selection), merged, last = items.length - 1;
66159
+ if (merged = items.length && items[last].merge(newItem))
66160
+ items[last] = merged;
66161
+ else
66162
+ items.push(newItem);
66163
+ }
66164
+ } else if (item.map) {
66165
+ mapFrom--;
66166
+ }
66167
+ }, this.items.length, 0);
66168
+ return new Branch(RopeSequence.from(items.reverse()), events2);
66169
+ }
66170
+ }
66171
+ Branch.empty = new Branch(RopeSequence.empty, 0);
66172
+ function cutOffEvents(items, n) {
66173
+ let cutPoint;
66174
+ items.forEach((item, i) => {
66175
+ if (item.selection && n-- == 0) {
66176
+ cutPoint = i;
66177
+ return false;
66178
+ }
66179
+ });
66180
+ return items.slice(cutPoint);
66181
+ }
66182
+ class Item {
66183
+ constructor(map22, step, selection, mirrorOffset) {
66184
+ this.map = map22;
66185
+ this.step = step;
66186
+ this.selection = selection;
66187
+ this.mirrorOffset = mirrorOffset;
66188
+ }
66189
+ merge(other) {
66190
+ if (this.step && other.step && !other.selection) {
66191
+ let step = other.step.merge(this.step);
66192
+ if (step)
66193
+ return new Item(step.getMap().invert(), step, this.selection);
66194
+ }
66195
+ }
66196
+ }
66197
+ class HistoryState {
66198
+ constructor(done, undone, prevRanges, prevTime, prevComposition) {
66199
+ this.done = done;
66200
+ this.undone = undone;
66201
+ this.prevRanges = prevRanges;
66202
+ this.prevTime = prevTime;
66203
+ this.prevComposition = prevComposition;
66204
+ }
66205
+ }
66206
+ const DEPTH_OVERFLOW = 20;
66207
+ function applyTransaction(history2, state2, tr, options2) {
66208
+ let historyTr = tr.getMeta(historyKey), rebased;
66209
+ if (historyTr)
66210
+ return historyTr.historyState;
66211
+ if (tr.getMeta(closeHistoryKey))
66212
+ history2 = new HistoryState(history2.done, history2.undone, null, 0, -1);
66213
+ let appended = tr.getMeta("appendedTransaction");
66214
+ if (tr.steps.length == 0) {
66215
+ return history2;
66216
+ } else if (appended && appended.getMeta(historyKey)) {
66217
+ if (appended.getMeta(historyKey).redo)
66218
+ return new HistoryState(history2.done.addTransform(tr, void 0, options2, mustPreserveItems(state2)), history2.undone, rangesFor(tr.mapping.maps[tr.steps.length - 1]), history2.prevTime, history2.prevComposition);
66219
+ else
66220
+ return new HistoryState(history2.done, history2.undone.addTransform(tr, void 0, options2, mustPreserveItems(state2)), null, history2.prevTime, history2.prevComposition);
66221
+ } else if (tr.getMeta("addToHistory") !== false && !(appended && appended.getMeta("addToHistory") === false)) {
66222
+ let composition = tr.getMeta("composition");
66223
+ let newGroup = history2.prevTime == 0 || !appended && history2.prevComposition != composition && (history2.prevTime < (tr.time || 0) - options2.newGroupDelay || !isAdjacentTo(tr, history2.prevRanges));
66224
+ let prevRanges = appended ? mapRanges(history2.prevRanges, tr.mapping) : rangesFor(tr.mapping.maps[tr.steps.length - 1]);
66225
+ return new HistoryState(history2.done.addTransform(tr, newGroup ? state2.selection.getBookmark() : void 0, options2, mustPreserveItems(state2)), Branch.empty, prevRanges, tr.time, composition == null ? history2.prevComposition : composition);
66226
+ } else if (rebased = tr.getMeta("rebased")) {
66227
+ return new HistoryState(history2.done.rebased(tr, rebased), history2.undone.rebased(tr, rebased), mapRanges(history2.prevRanges, tr.mapping), history2.prevTime, history2.prevComposition);
66228
+ } else {
66229
+ return new HistoryState(history2.done.addMaps(tr.mapping.maps), history2.undone.addMaps(tr.mapping.maps), mapRanges(history2.prevRanges, tr.mapping), history2.prevTime, history2.prevComposition);
66230
+ }
66231
+ }
66232
+ function isAdjacentTo(transform, prevRanges) {
66233
+ if (!prevRanges)
66234
+ return false;
66235
+ if (!transform.docChanged)
66236
+ return true;
66237
+ let adjacent = false;
66238
+ transform.mapping.maps[0].forEach((start, end) => {
66239
+ for (let i = 0; i < prevRanges.length; i += 2)
66240
+ if (start <= prevRanges[i + 1] && end >= prevRanges[i])
66241
+ adjacent = true;
66242
+ });
66243
+ return adjacent;
66244
+ }
66245
+ function rangesFor(map22) {
66246
+ let result = [];
66247
+ map22.forEach((_from, _to, from2, to) => result.push(from2, to));
66248
+ return result;
66249
+ }
66250
+ function mapRanges(ranges, mapping) {
66251
+ if (!ranges)
66252
+ return null;
66253
+ let result = [];
66254
+ for (let i = 0; i < ranges.length; i += 2) {
66255
+ let from2 = mapping.map(ranges[i], 1), to = mapping.map(ranges[i + 1], -1);
66256
+ if (from2 <= to)
66257
+ result.push(from2, to);
66258
+ }
66259
+ return result;
66260
+ }
66261
+ function histTransaction(history2, state2, redo2) {
66262
+ let preserveItems = mustPreserveItems(state2);
66263
+ let histOptions = historyKey.get(state2).spec.config;
66264
+ let pop = (redo2 ? history2.undone : history2.done).popEvent(state2, preserveItems);
66265
+ if (!pop)
66266
+ return null;
66267
+ let selection = pop.selection.resolve(pop.transform.doc);
66268
+ let added = (redo2 ? history2.done : history2.undone).addTransform(pop.transform, state2.selection.getBookmark(), histOptions, preserveItems);
66269
+ let newHist = new HistoryState(redo2 ? added : pop.remaining, redo2 ? pop.remaining : added, null, 0, -1);
66270
+ return pop.transform.setSelection(selection).setMeta(historyKey, { redo: redo2, historyState: newHist });
66271
+ }
66272
+ let cachedPreserveItems = false, cachedPreserveItemsPlugins = null;
66273
+ function mustPreserveItems(state2) {
66274
+ let plugins = state2.plugins;
66275
+ if (cachedPreserveItemsPlugins != plugins) {
66276
+ cachedPreserveItems = false;
66277
+ cachedPreserveItemsPlugins = plugins;
66278
+ for (let i = 0; i < plugins.length; i++)
66279
+ if (plugins[i].spec.historyPreserveItems) {
66280
+ cachedPreserveItems = true;
66281
+ break;
66282
+ }
66283
+ }
66284
+ return cachedPreserveItems;
66285
+ }
66286
+ const historyKey = new PluginKey("history");
66287
+ const closeHistoryKey = new PluginKey("closeHistory");
66288
+ function history(config = {}) {
66289
+ config = {
66290
+ depth: config.depth || 100,
66291
+ newGroupDelay: config.newGroupDelay || 500
66292
+ };
66293
+ return new Plugin({
66294
+ key: historyKey,
66295
+ state: {
66296
+ init() {
66297
+ return new HistoryState(Branch.empty, Branch.empty, null, 0, -1);
66298
+ },
66299
+ apply(tr, hist, state2) {
66300
+ return applyTransaction(hist, state2, tr, config);
66301
+ }
66302
+ },
66303
+ config,
66304
+ props: {
66305
+ handleDOMEvents: {
66306
+ beforeinput(view, e) {
66307
+ let inputType = e.inputType;
66308
+ let command = inputType == "historyUndo" ? undo : inputType == "historyRedo" ? redo : null;
66309
+ if (!command)
66310
+ return false;
66311
+ e.preventDefault();
66312
+ return command(view.state, view.dispatch);
66313
+ }
66314
+ }
66315
+ }
66316
+ });
66317
+ }
66318
+ function buildCommand(redo2, scroll) {
66319
+ return (state2, dispatch) => {
66320
+ let hist = historyKey.getState(state2);
66321
+ if (!hist || (redo2 ? hist.undone : hist.done).eventCount == 0)
66322
+ return false;
66323
+ if (dispatch) {
66324
+ let tr = histTransaction(hist, state2, redo2);
66325
+ if (tr)
66326
+ dispatch(tr.scrollIntoView());
66327
+ }
66328
+ return true;
66329
+ };
66330
+ }
66331
+ const undo = buildCommand(false);
66332
+ const redo = buildCommand(true);
66333
+ const History = Extension.create({
66334
+ name: "history",
66335
+ addOptions() {
66336
+ return {
66337
+ depth: 100,
66338
+ newGroupDelay: 500
66339
+ };
66340
+ },
66341
+ addPmPlugins() {
66342
+ const historyPlugin = history(this.options);
66343
+ return [historyPlugin];
66344
+ },
66345
+ addCommands() {
66346
+ return {
66347
+ undo: () => ({ state: state2, dispatch }) => {
66348
+ return undo(state2, dispatch);
66349
+ },
66350
+ redo: () => ({ state: state2, dispatch }) => {
66351
+ return redo(state2, dispatch);
66352
+ }
66353
+ };
66354
+ },
66355
+ addShortcuts() {
66356
+ return {
66357
+ "Mod-z": () => this.editor.commands.undo(),
66358
+ "Mod-Shift-z": () => this.editor.commands.redo(),
66359
+ "Mod-y": () => this.editor.commands.redo()
66360
+ };
66361
+ }
66362
+ });
65755
66363
  const Document = Node22.create({
65756
66364
  name: "doc",
65757
66365
  topNode: true,
@@ -66003,6 +66611,7 @@ const extensions = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
66003
66611
  CommentRangeStart,
66004
66612
  CommentReference,
66005
66613
  Document,
66614
+ History,
66006
66615
  Italic,
66007
66616
  ListItem,
66008
66617
  OrderedList,