@semiont/react-ui 0.5.30 → 0.5.32

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.
package/dist/index.js CHANGED
@@ -1269,17 +1269,17 @@ var TextNode = class _TextNode extends Text {
1269
1269
  ), maxChunk = chunk << 1, minChunk = chunk >> 1;
1270
1270
  let chunked = [], currentLines = 0, currentLen = -1, currentChunk = [];
1271
1271
  function add2(child) {
1272
- let last;
1272
+ let last2;
1273
1273
  if (child.lines > maxChunk && child instanceof _TextNode) {
1274
1274
  for (let node of child.children)
1275
1275
  add2(node);
1276
1276
  } else if (child.lines > minChunk && (currentLines > minChunk || !currentLines)) {
1277
1277
  flush();
1278
1278
  chunked.push(child);
1279
- } else if (child instanceof TextLeaf && currentLines && (last = currentChunk[currentChunk.length - 1]) instanceof TextLeaf && child.lines + last.lines <= 32) {
1279
+ } else if (child instanceof TextLeaf && currentLines && (last2 = currentChunk[currentChunk.length - 1]) instanceof TextLeaf && child.lines + last2.lines <= 32) {
1280
1280
  currentLines += child.lines;
1281
1281
  currentLen += child.length + 1;
1282
- currentChunk[currentChunk.length - 1] = new TextLeaf(last.text.concat(child.text), last.length + 1 + child.length);
1282
+ currentChunk[currentChunk.length - 1] = new TextLeaf(last2.text.concat(child.text), last2.length + 1 + child.length);
1283
1283
  } else {
1284
1284
  if (currentLines + child.lines > chunk)
1285
1285
  flush();
@@ -1341,21 +1341,21 @@ var RawTextCursor = class {
1341
1341
  nextInner(skip, dir) {
1342
1342
  this.done = this.lineBreak = false;
1343
1343
  for (; ; ) {
1344
- let last = this.nodes.length - 1;
1345
- let top2 = this.nodes[last], offsetValue = this.offsets[last], offset = offsetValue >> 1;
1344
+ let last2 = this.nodes.length - 1;
1345
+ let top2 = this.nodes[last2], offsetValue = this.offsets[last2], offset = offsetValue >> 1;
1346
1346
  let size = top2 instanceof TextLeaf ? top2.text.length : top2.children.length;
1347
1347
  if (offset == (dir > 0 ? size : 0)) {
1348
- if (last == 0) {
1348
+ if (last2 == 0) {
1349
1349
  this.done = true;
1350
1350
  this.value = "";
1351
1351
  return this;
1352
1352
  }
1353
1353
  if (dir > 0)
1354
- this.offsets[last - 1]++;
1354
+ this.offsets[last2 - 1]++;
1355
1355
  this.nodes.pop();
1356
1356
  this.offsets.pop();
1357
1357
  } else if ((offsetValue & 1) == (dir > 0 ? 0 : 1)) {
1358
- this.offsets[last] += dir;
1358
+ this.offsets[last2] += dir;
1359
1359
  if (skip == 0) {
1360
1360
  this.lineBreak = true;
1361
1361
  this.value = "\n";
@@ -1364,7 +1364,7 @@ var RawTextCursor = class {
1364
1364
  skip--;
1365
1365
  } else if (top2 instanceof TextLeaf) {
1366
1366
  let next = top2.text[offset + (dir < 0 ? -1 : 0)];
1367
- this.offsets[last] += dir;
1367
+ this.offsets[last2] += dir;
1368
1368
  if (next.length > Math.max(0, skip)) {
1369
1369
  this.value = skip == 0 ? next : dir > 0 ? next.slice(skip) : next.slice(0, next.length - skip);
1370
1370
  return this;
@@ -1374,10 +1374,10 @@ var RawTextCursor = class {
1374
1374
  let next = top2.children[offset + (dir < 0 ? -1 : 0)];
1375
1375
  if (skip > next.length) {
1376
1376
  skip -= next.length;
1377
- this.offsets[last] += dir;
1377
+ this.offsets[last2] += dir;
1378
1378
  } else {
1379
1379
  if (dir < 0)
1380
- this.offsets[last]--;
1380
+ this.offsets[last2]--;
1381
1381
  this.nodes.push(next);
1382
1382
  this.offsets.push(dir > 0 ? 1 : (next instanceof TextLeaf ? next.text.length : next.children.length) << 1);
1383
1383
  }
@@ -1913,14 +1913,14 @@ var ChangeSet = class _ChangeSet extends ChangeDesc {
1913
1913
  function addSection(sections, len, ins, forceJoin = false) {
1914
1914
  if (len == 0 && ins <= 0)
1915
1915
  return;
1916
- let last = sections.length - 2;
1917
- if (last >= 0 && ins <= 0 && ins == sections[last + 1])
1918
- sections[last] += len;
1919
- else if (last >= 0 && len == 0 && sections[last] == 0)
1920
- sections[last + 1] += ins;
1916
+ let last2 = sections.length - 2;
1917
+ if (last2 >= 0 && ins <= 0 && ins == sections[last2 + 1])
1918
+ sections[last2] += len;
1919
+ else if (last2 >= 0 && len == 0 && sections[last2] == 0)
1920
+ sections[last2 + 1] += ins;
1921
1921
  else if (forceJoin) {
1922
- sections[last] += len;
1923
- sections[last + 1] += ins;
1922
+ sections[last2] += len;
1923
+ sections[last2 + 1] += ins;
1924
1924
  } else
1925
1925
  sections.push(len, ins);
1926
1926
  }
@@ -3556,7 +3556,7 @@ var Chunk = class _Chunk {
3556
3556
  this.maxPoint = maxPoint;
3557
3557
  }
3558
3558
  get length() {
3559
- return this.to[this.to.length - 1];
3559
+ return last(this.to);
3560
3560
  }
3561
3561
  // Find the index of the given position and side. Use the ranges'
3562
3562
  // `from` pos when `end == false`, `to` when `end == true`.
@@ -3580,9 +3580,9 @@ var Chunk = class _Chunk {
3580
3580
  if (f11(this.from[i13] + offset, this.to[i13] + offset, this.value[i13]) === false)
3581
3581
  return false;
3582
3582
  }
3583
- map(offset, changes) {
3583
+ map(offset, changes, basePos, baseSide, spill) {
3584
3584
  let value = [], from = [], to = [], newPos = -1, maxPoint = -1;
3585
- for (let i13 = 0; i13 < this.value.length; i13++) {
3585
+ iter: for (let i13 = 0; i13 < this.value.length; i13++) {
3586
3586
  let val = this.value[i13], curFrom = this.from[i13] + offset, curTo = this.to[i13] + offset, newFrom, newTo;
3587
3587
  if (curFrom == curTo) {
3588
3588
  let mapped = changes.mapPos(curFrom, val.startSide, val.mapMode);
@@ -3606,9 +3606,27 @@ var Chunk = class _Chunk {
3606
3606
  newPos = newFrom;
3607
3607
  if (val.point)
3608
3608
  maxPoint = Math.max(maxPoint, newTo - newFrom);
3609
- value.push(val);
3610
- from.push(newFrom - newPos);
3611
- to.push(newTo - newPos);
3609
+ if ((newFrom - basePos || val.startSide - baseSide) >= 0) {
3610
+ value.push(val);
3611
+ from.push(newFrom - newPos);
3612
+ to.push(newTo - newPos);
3613
+ basePos = newTo;
3614
+ baseSide = val.endSide;
3615
+ } else {
3616
+ if (newFrom == newTo) {
3617
+ for (let i14 = value.length; i14 > 0; i14--) {
3618
+ if ((newFrom - (to[i14 - 1] + newPos) || val.startSide - value[i14 - 1].endSide) >= 0) {
3619
+ value.splice(i14, 0, val);
3620
+ from.splice(i14, 0, newFrom - newPos);
3621
+ to.splice(i14, 0, newTo - newPos);
3622
+ continue iter;
3623
+ }
3624
+ if ((newFrom - (from[i14 - 1] + newPos) || val.endSide - value[i14 - 1].startSide) > 0)
3625
+ break;
3626
+ }
3627
+ }
3628
+ spill(newFrom, newTo, val);
3629
+ }
3612
3630
  }
3613
3631
  return { mapped: value.length ? new _Chunk(from, to, value, maxPoint) : null, pos: newPos };
3614
3632
  }
@@ -3630,8 +3648,8 @@ var RangeSet = class _RangeSet {
3630
3648
  @internal
3631
3649
  */
3632
3650
  get length() {
3633
- let last = this.chunk.length - 1;
3634
- return last < 0 ? 0 : Math.max(this.chunkEnd(last), this.nextLayer.length);
3651
+ let last2 = this.chunk.length - 1;
3652
+ return last2 < 0 ? 0 : Math.max(this.chunkEnd(last2), this.nextLayer.length);
3635
3653
  }
3636
3654
  /**
3637
3655
  The number of ranges in the set.
@@ -3673,13 +3691,13 @@ var RangeSet = class _RangeSet {
3673
3691
  while (cur.value || i13 < add2.length) {
3674
3692
  if (i13 < add2.length && (cur.from - add2[i13].from || cur.startSide - add2[i13].value.startSide) >= 0) {
3675
3693
  let range = add2[i13++];
3676
- if (!builder.addInner(range.from, range.to, range.value))
3694
+ if (!builder.addInner(range.from, range.to, range.value, false))
3677
3695
  spill.push(range);
3678
3696
  } else if (cur.rangeIndex == 1 && cur.chunkIndex < this.chunk.length && (i13 == add2.length || this.chunkEnd(cur.chunkIndex) < add2[i13].from) && (!filter || filterFrom > this.chunkEnd(cur.chunkIndex) || filterTo < this.chunkPos[cur.chunkIndex]) && builder.addChunk(this.chunkPos[cur.chunkIndex], this.chunk[cur.chunkIndex])) {
3679
3697
  cur.nextChunk();
3680
3698
  } else {
3681
3699
  if (!filter || filterFrom > cur.to || filterTo < cur.from || filter(cur.from, cur.to, cur.value)) {
3682
- if (!builder.addInner(cur.from, cur.to, cur.value))
3700
+ if (!builder.addInner(cur.from, cur.to, cur.value, false))
3683
3701
  spill.push(Range.create(cur.from, cur.to, cur.value));
3684
3702
  }
3685
3703
  cur.next();
@@ -3694,6 +3712,12 @@ var RangeSet = class _RangeSet {
3694
3712
  if (changes.empty || this.isEmpty)
3695
3713
  return this;
3696
3714
  let chunks = [], chunkPos = [], maxPoint = -1;
3715
+ let spilled;
3716
+ let spill = (from, to, value) => {
3717
+ if (!spilled)
3718
+ spilled = new RangeSetBuilder();
3719
+ spilled.addRange(from, to, value, false);
3720
+ };
3697
3721
  for (let i13 = 0; i13 < this.chunk.length; i13++) {
3698
3722
  let start = this.chunkPos[i13], chunk = this.chunk[i13];
3699
3723
  let touch = changes.touchesRange(start, start + chunk.length);
@@ -3702,7 +3726,8 @@ var RangeSet = class _RangeSet {
3702
3726
  chunks.push(chunk);
3703
3727
  chunkPos.push(changes.mapPos(start));
3704
3728
  } else if (touch === true) {
3705
- let { mapped, pos } = chunk.map(start, changes);
3729
+ let [prevPos, prevSide] = !chunks.length ? [-1, -1] : [last(chunkPos) + last(chunks).length, last(last(chunks).value).endSide];
3730
+ let { mapped, pos } = chunk.map(start, changes, prevPos, prevSide, spill);
3706
3731
  if (mapped) {
3707
3732
  maxPoint = Math.max(maxPoint, mapped.maxPoint);
3708
3733
  chunks.push(mapped);
@@ -3711,6 +3736,8 @@ var RangeSet = class _RangeSet {
3711
3736
  }
3712
3737
  }
3713
3738
  let next = this.nextLayer.map(changes);
3739
+ if (spilled)
3740
+ next = spilled.finishInner(next);
3714
3741
  return chunks.length == 0 ? next : new _RangeSet(chunkPos, chunks, next || _RangeSet.empty, maxPoint);
3715
3742
  }
3716
3743
  /**
@@ -3833,7 +3860,7 @@ var RangeSet = class _RangeSet {
3833
3860
  static join(sets) {
3834
3861
  if (!sets.length)
3835
3862
  return _RangeSet.empty;
3836
- let result = sets[sets.length - 1];
3863
+ let result = last(sets);
3837
3864
  for (let i13 = sets.length - 2; i13 >= 0; i13--) {
3838
3865
  for (let layer = sets[i13]; layer != _RangeSet.empty; layer = layer.nextLayer)
3839
3866
  result = new _RangeSet(layer.chunkPos, layer.chunk, result, Math.max(layer.maxPoint, result.maxPoint));
@@ -3842,6 +3869,9 @@ var RangeSet = class _RangeSet {
3842
3869
  }
3843
3870
  };
3844
3871
  RangeSet.empty = /* @__PURE__ */ new RangeSet([], [], null, -1);
3872
+ function last(arr) {
3873
+ return arr[arr.length - 1];
3874
+ }
3845
3875
  function lazySort(ranges) {
3846
3876
  if (ranges.length > 1)
3847
3877
  for (let prev = ranges[0], i13 = 1; i13 < ranges.length; i13++) {
@@ -3888,15 +3918,21 @@ var RangeSetBuilder = class _RangeSetBuilder {
3888
3918
  `value.startSide`) order.
3889
3919
  */
3890
3920
  add(from, to, value) {
3891
- if (!this.addInner(from, to, value))
3892
- (this.nextLayer || (this.nextLayer = new _RangeSetBuilder())).add(from, to, value);
3921
+ this.addRange(from, to, value, true);
3922
+ }
3923
+ /**
3924
+ @internal
3925
+ */
3926
+ addRange(from, to, value, strict) {
3927
+ if (!this.addInner(from, to, value, strict))
3928
+ (this.nextLayer || (this.nextLayer = new _RangeSetBuilder())).addRange(from, to, value, strict);
3893
3929
  }
3894
3930
  /**
3895
3931
  @internal
3896
3932
  */
3897
- addInner(from, to, value) {
3933
+ addInner(from, to, value, strict) {
3898
3934
  let diff = from - this.lastTo || value.startSide - this.last.endSide;
3899
- if (diff <= 0 && (from - this.lastFrom || value.startSide - this.last.startSide) < 0)
3935
+ if (strict && diff <= 0 && (from - this.lastFrom || value.startSide - this.last.startSide) < 0)
3900
3936
  throw new Error("Ranges must be added sorted by `from` position and `startSide`");
3901
3937
  if (diff < 0)
3902
3938
  return false;
@@ -3925,10 +3961,10 @@ var RangeSetBuilder = class _RangeSetBuilder {
3925
3961
  this.setMaxPoint = Math.max(this.setMaxPoint, chunk.maxPoint);
3926
3962
  this.chunks.push(chunk);
3927
3963
  this.chunkPos.push(from);
3928
- let last = chunk.value.length - 1;
3929
- this.last = chunk.value[last];
3930
- this.lastFrom = chunk.from[last] + from;
3931
- this.lastTo = chunk.to[last] + from;
3964
+ let last2 = chunk.value.length - 1;
3965
+ this.last = chunk.value[last2];
3966
+ this.lastFrom = chunk.from[last2] + from;
3967
+ this.lastTo = chunk.to[last2] + from;
3932
3968
  return true;
3933
3969
  }
3934
3970
  /**
@@ -4883,9 +4919,9 @@ function widgetsEq(a15, b8) {
4883
4919
  return a15 == b8 || !!(a15 && b8 && a15.compare(b8));
4884
4920
  }
4885
4921
  function addRange(from, to, ranges, margin = 0) {
4886
- let last = ranges.length - 1;
4887
- if (last >= 0 && ranges[last] + margin >= from)
4888
- ranges[last] = Math.max(ranges[last], to);
4922
+ let last2 = ranges.length - 1;
4923
+ if (last2 >= 0 && ranges[last2] + margin >= from)
4924
+ ranges[last2] = Math.max(ranges[last2], to);
4889
4925
  else
4890
4926
  ranges.push(from, to);
4891
4927
  }
@@ -6326,10 +6362,10 @@ var LineTile = class _LineTile extends CompositeTile {
6326
6362
  }
6327
6363
  };
6328
6364
  function fallbackRect(tile) {
6329
- let last = tile.dom.lastChild;
6330
- if (!last)
6365
+ let last2 = tile.dom.lastChild;
6366
+ if (!last2)
6331
6367
  return tile.dom.getBoundingClientRect();
6332
- let rects = clientRectsFor(last);
6368
+ let rects = clientRectsFor(last2);
6333
6369
  return rects[rects.length - 1] || null;
6334
6370
  }
6335
6371
  function onSameLine(a15, b8) {
@@ -6607,11 +6643,11 @@ var TileBuilder = class {
6607
6643
  let head = line;
6608
6644
  for (let i13 = context.marks.length - 1; i13 >= 0; i13--) {
6609
6645
  let mark = context.marks[i13];
6610
- let last = head.lastChild;
6611
- if (last instanceof MarkTile && last.mark.eq(mark.mark)) {
6612
- if (last.dom != mark.dom)
6613
- last.setDOM(freeNode(mark.dom));
6614
- head = last;
6646
+ let last2 = head.lastChild;
6647
+ if (last2 instanceof MarkTile && last2.mark.eq(mark.mark)) {
6648
+ if (last2.dom != mark.dom)
6649
+ last2.setDOM(freeNode(mark.dom));
6650
+ head = last2;
6615
6651
  } else {
6616
6652
  if (this.cache.reused.get(mark)) {
6617
6653
  let tile = Tile.get(mark.dom);
@@ -6699,9 +6735,9 @@ var TileBuilder = class {
6699
6735
  var _a2;
6700
6736
  let parent = this.curLine;
6701
6737
  for (let i13 = marks2.length - 1; i13 >= 0; i13--) {
6702
- let mark = marks2[i13], last;
6703
- if (openStart > 0 && (last = parent.lastChild) && last instanceof MarkTile && last.mark.eq(mark)) {
6704
- parent = last;
6738
+ let mark = marks2[i13], last2;
6739
+ if (openStart > 0 && (last2 = parent.lastChild) && last2 instanceof MarkTile && last2.mark.eq(mark)) {
6740
+ parent = last2;
6705
6741
  openStart--;
6706
6742
  } else {
6707
6743
  let tile = MarkTile.of(mark, (_a2 = this.cache.find(MarkTile, (m6) => m6.mark.eq(mark))) === null || _a2 === void 0 ? void 0 : _a2.dom);
@@ -6715,8 +6751,8 @@ var TileBuilder = class {
6715
6751
  endLine() {
6716
6752
  if (this.curLine) {
6717
6753
  this.flushBuffer();
6718
- let last = this.curLine.lastChild;
6719
- if (!last || !hasContent(this.curLine, false) || last.dom.nodeName != "BR" && last.isWidget() && !(browser.ios && hasContent(this.curLine, true)))
6754
+ let last2 = this.curLine.lastChild;
6755
+ if (!last2 || !hasContent(this.curLine, false) || last2.dom.nodeName != "BR" && last2.isWidget() && !(browser.ios && hasContent(this.curLine, true)))
6720
6756
  this.curLine.append(this.cache.findWidget(
6721
6757
  BreakWidget,
6722
6758
  0,
@@ -6755,9 +6791,9 @@ var TileBuilder = class {
6755
6791
  this.updateBlockWrappers();
6756
6792
  let parent = this.root;
6757
6793
  for (let wrap of this.wrappers) {
6758
- let last = parent.lastChild;
6759
- if (wrap.from < this.pos && last instanceof BlockWrapperTile && last.wrapper.eq(wrap.wrapper)) {
6760
- parent = last;
6794
+ let last2 = parent.lastChild;
6795
+ if (wrap.from < this.pos && last2 instanceof BlockWrapperTile && last2.wrapper.eq(wrap.wrapper)) {
6796
+ parent = last2;
6761
6797
  } else {
6762
6798
  let tile = BlockWrapperTile.of(wrap.wrapper, (_a2 = this.cache.find(BlockWrapperTile, (t12) => t12.wrapper.eq(wrap.wrapper))) === null || _a2 === void 0 ? void 0 : _a2.dom);
6763
6799
  parent.append(tile);
@@ -6767,8 +6803,8 @@ var TileBuilder = class {
6767
6803
  return parent;
6768
6804
  }
6769
6805
  blockPosCovered() {
6770
- let last = this.lastBlock;
6771
- return last != null && !last.breakAfter && (!last.isWidget() || (last.flags & (32 | 128)) > 0);
6806
+ let last2 = this.lastBlock;
6807
+ return last2 != null && !last2.breakAfter && (!last2.isWidget() || (last2.flags & (32 | 128)) > 0);
6772
6808
  }
6773
6809
  getBuffer(side) {
6774
6810
  let flags = 2 | (side < 0 ? 16 : 32);
@@ -7575,8 +7611,8 @@ var DocView = class {
7575
7611
  result.push(height + spaceAbove);
7576
7612
  spaceAbove = 0;
7577
7613
  if (isWider) {
7578
- let last = child.dom.lastChild;
7579
- let rects = last ? clientRectsFor(last) : [];
7614
+ let last2 = child.dom.lastChild;
7615
+ let rects = last2 ? clientRectsFor(last2) : [];
7580
7616
  if (rects.length) {
7581
7617
  let rect = rects[rects.length - 1];
7582
7618
  let width = ltr ? rect.right - childRect.left : childRect.right - rect.left;
@@ -8184,7 +8220,7 @@ var InlineCoordsScan = class {
8184
8220
  }
8185
8221
  if (!closestRect) {
8186
8222
  if (!below && !above)
8187
- return { i: positions[0], after: false };
8223
+ return { i: 0, after: false };
8188
8224
  let side = above && (!below || this.y - above.bottom < below.top - this.y) ? above : below;
8189
8225
  this.y = (side.top + side.bottom) / 2;
8190
8226
  return this.scan(positions, getRects, true);
@@ -8741,7 +8777,7 @@ var InputState = class {
8741
8777
  if (mods.shiftKey && browser.ios && !/^(off|none)$/.test(this.view.contentDOM.autocapitalize) && iosVirtualKeyboardOpen(this.view.win))
8742
8778
  mods.shiftKey = false;
8743
8779
  this.pendingIOSKey = { key: event.key, keyCode: event.keyCode, mods };
8744
- setTimeout(() => this.flushIOSKey(), 250);
8780
+ setTimeout(() => this.flushIOSKey(), 50);
8745
8781
  return true;
8746
8782
  }
8747
8783
  if (event.keyCode != 229)
@@ -8750,7 +8786,7 @@ var InputState = class {
8750
8786
  }
8751
8787
  flushIOSKey(change) {
8752
8788
  let key = this.pendingIOSKey;
8753
- if (!key)
8789
+ if (!key || this.view.observer.pendingRecords().length)
8754
8790
  return false;
8755
8791
  if (key.key == "Enter" && change && change.from < change.to && /^\S+$/.test(change.insert.toString()))
8756
8792
  return false;
@@ -9114,10 +9150,10 @@ var lastMouseDownTime = 0;
9114
9150
  function getClickType(event) {
9115
9151
  if (!BadMouseDetail)
9116
9152
  return event.detail;
9117
- let last = lastMouseDown, lastTime = lastMouseDownTime;
9153
+ let last2 = lastMouseDown, lastTime = lastMouseDownTime;
9118
9154
  lastMouseDown = event;
9119
9155
  lastMouseDownTime = Date.now();
9120
- return lastMouseDownCount = !last || lastTime > Date.now() - 400 && Math.abs(last.clientX - event.clientX) < 2 && Math.abs(last.clientY - event.clientY) < 2 ? (lastMouseDownCount + 1) % 3 : 1;
9156
+ return lastMouseDownCount = !last2 || lastTime > Date.now() - 400 && Math.abs(last2.clientX - event.clientX) < 2 && Math.abs(last2.clientY - event.clientY) < 2 ? (lastMouseDownCount + 1) % 3 : 1;
9121
9157
  }
9122
9158
  function basicMouseSelection(view, event) {
9123
9159
  let start = view.posAndSideAtCoords({ x: event.clientX, y: event.clientY }, false), type = getClickType(event);
@@ -9809,9 +9845,9 @@ var HeightMapGap = class _HeightMapGap extends HeightMap {
9809
9845
  replace(from, to, nodes) {
9810
9846
  let after = this.length - to;
9811
9847
  if (after > 0) {
9812
- let last = nodes[nodes.length - 1];
9813
- if (last instanceof _HeightMapGap)
9814
- nodes[nodes.length - 1] = new _HeightMapGap(last.length + after);
9848
+ let last2 = nodes[nodes.length - 1];
9849
+ if (last2 instanceof _HeightMapGap)
9850
+ nodes[nodes.length - 1] = new _HeightMapGap(last2.length + after);
9815
9851
  else
9816
9852
  nodes.push(null, new _HeightMapGap(after - 1));
9817
9853
  }
@@ -10009,9 +10045,9 @@ var NodeBuilder = class _NodeBuilder {
10009
10045
  }
10010
10046
  span(_from, to) {
10011
10047
  if (this.lineStart > -1) {
10012
- let end = Math.min(to, this.lineEnd), last = this.nodes[this.nodes.length - 1];
10013
- if (last instanceof HeightMapText)
10014
- last.length += end - this.pos;
10048
+ let end = Math.min(to, this.lineEnd), last2 = this.nodes[this.nodes.length - 1];
10049
+ if (last2 instanceof HeightMapText)
10050
+ last2.length += end - this.pos;
10015
10051
  else if (end > this.pos || !this.isCovered)
10016
10052
  this.nodes.push(new HeightMapText(end - this.pos, -1, 0));
10017
10053
  this.writtenTo = end;
@@ -10064,9 +10100,9 @@ var NodeBuilder = class _NodeBuilder {
10064
10100
  }
10065
10101
  ensureLine() {
10066
10102
  this.enterLine();
10067
- let last = this.nodes.length ? this.nodes[this.nodes.length - 1] : null;
10068
- if (last instanceof HeightMapText)
10069
- return last;
10103
+ let last2 = this.nodes.length ? this.nodes[this.nodes.length - 1] : null;
10104
+ if (last2 instanceof HeightMapText)
10105
+ return last2;
10070
10106
  let line = new HeightMapText(0, -1, 0);
10071
10107
  this.nodes.push(line);
10072
10108
  return line;
@@ -10090,10 +10126,10 @@ var NodeBuilder = class _NodeBuilder {
10090
10126
  this.writtenTo = this.pos = this.pos + length;
10091
10127
  }
10092
10128
  finish(from) {
10093
- let last = this.nodes.length == 0 ? null : this.nodes[this.nodes.length - 1];
10094
- if (this.lineStart > -1 && !(last instanceof HeightMapText) && !this.isCovered)
10129
+ let last2 = this.nodes.length == 0 ? null : this.nodes[this.nodes.length - 1];
10130
+ if (this.lineStart > -1 && !(last2 instanceof HeightMapText) && !this.isCovered)
10095
10131
  this.nodes.push(new HeightMapText(0, -1, 0));
10096
- else if (this.writtenTo < this.pos || last == null)
10132
+ else if (this.writtenTo < this.pos || last2 == null)
10097
10133
  this.nodes.push(this.blankContent(this.writtenTo, this.pos));
10098
10134
  let pos = from;
10099
10135
  for (let node of this.nodes) {
@@ -10626,8 +10662,7 @@ var ViewState = class {
10626
10662
  return height >= this.viewportLines[0].top && height <= this.viewportLines[this.viewportLines.length - 1].bottom && this.viewportLines.find((l10) => l10.top <= height && l10.bottom >= height) || scaleBlock(this.heightMap.lineAt(this.scaler.fromDOM(height), QueryType.ByHeight, this.heightOracle, 0, 0), this.scaler);
10627
10663
  }
10628
10664
  getScrollOffset() {
10629
- let base2 = this.scrollParent == this.view.scrollDOM ? this.scrollParent.scrollTop : (this.scrollParent ? this.scrollParent.getBoundingClientRect().top : 0) - this.view.contentDOM.getBoundingClientRect().top;
10630
- return base2 * this.scaleY;
10665
+ return this.scrollParent == this.view.scrollDOM ? this.scrollParent.scrollTop * this.scaleY : (this.scrollParent ? this.scrollParent.getBoundingClientRect().top : 0) - this.view.contentDOM.getBoundingClientRect().top;
10631
10666
  }
10632
10667
  scrollAnchorAt(scrollOffset) {
10633
10668
  let block = this.lineBlockAtHeight(scrollOffset + 8);
@@ -11026,8 +11061,9 @@ var baseTheme$1 = /* @__PURE__ */ buildTheme("." + baseThemeID, {
11026
11061
  userSelect: "none"
11027
11062
  },
11028
11063
  ".cm-highlightSpace": {
11029
- backgroundImage: "radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",
11030
- backgroundPosition: "center"
11064
+ background: "radial-gradient(circle at 50% 55%, #aaa 20%, transparent 0) no-repeat",
11065
+ backgroundSize: ".4em",
11066
+ backgroundPosition: "calc(min(50%, 0px)) center"
11031
11067
  },
11032
11068
  ".cm-highlightTab": {
11033
11069
  backgroundImage: `url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,
@@ -12033,7 +12069,7 @@ var EditorView = class _EditorView {
12033
12069
  this.observer.forceFlush();
12034
12070
  let updated = null;
12035
12071
  let scroll = this.viewState.scrollParent, scrollOffset = this.viewState.getScrollOffset();
12036
- let { scrollAnchorPos, scrollAnchorHeight } = this.viewState;
12072
+ let { scrollAnchorPos, scrollAnchorHeight, scaleY: scrollScale } = this.viewState;
12037
12073
  if (Math.abs(scrollOffset - this.viewState.scrollOffset) > 1)
12038
12074
  scrollAnchorHeight = -1;
12039
12075
  this.viewState.scrollAnchorHeight = -1;
@@ -12042,12 +12078,13 @@ var EditorView = class _EditorView {
12042
12078
  if (scrollAnchorHeight < 0) {
12043
12079
  if (isScrolledToBottom(scroll || this.win)) {
12044
12080
  scrollAnchorPos = -1;
12045
- scrollAnchorHeight = this.viewState.heightMap.height;
12081
+ scrollAnchorHeight = this.viewState.heightMap.height / this.viewState.scaleY;
12046
12082
  } else {
12047
12083
  let block = this.viewState.scrollAnchorAt(scrollOffset);
12048
12084
  scrollAnchorPos = block.from;
12049
12085
  scrollAnchorHeight = block.top;
12050
12086
  }
12087
+ scrollScale = this.viewState.scaleY;
12051
12088
  }
12052
12089
  this.updateState = 1;
12053
12090
  let changed = this.viewState.measure();
@@ -12104,7 +12141,7 @@ var EditorView = class _EditorView {
12104
12141
  continue;
12105
12142
  } else {
12106
12143
  let newAnchorHeight = scrollAnchorPos < 0 ? this.viewState.heightMap.height : this.viewState.lineBlockAt(scrollAnchorPos).top;
12107
- let diff = (newAnchorHeight - scrollAnchorHeight) / this.scaleY;
12144
+ let diff = newAnchorHeight / this.viewState.scaleY - scrollAnchorHeight / scrollScale;
12108
12145
  if ((diff > 1 || diff < -1) && !(browser.ios && this.inputState.lastIOSMomentumScroll > Date.now() - 100) && (scroll == this.scrollDOM || this.hasFocus || Math.max(this.inputState.lastWheelEvent, this.inputState.lastTouchTime) > Date.now() - 100)) {
12109
12146
  scrollOffset = scrollOffset + diff;
12110
12147
  if (!scroll)
@@ -13222,9 +13259,9 @@ var UpdateContext = class {
13222
13259
  finish() {
13223
13260
  let gutter2 = this.gutter;
13224
13261
  while (gutter2.elements.length > this.i) {
13225
- let last = gutter2.elements.pop();
13226
- gutter2.dom.removeChild(last.dom);
13227
- last.destroy();
13262
+ let last2 = gutter2.elements.pop();
13263
+ gutter2.dom.removeChild(last2.dom);
13264
+ last2.destroy();
13228
13265
  }
13229
13266
  }
13230
13267
  };
@@ -13415,10 +13452,10 @@ function lineNumbers(config = {}) {
13415
13452
  ];
13416
13453
  }
13417
13454
  function maxLineNumber(lines) {
13418
- let last = 9;
13419
- while (last < lines)
13420
- last = last * 10 + 9;
13421
- return last;
13455
+ let last2 = 9;
13456
+ while (last2 < lines)
13457
+ last2 = last2 * 10 + 9;
13458
+ return last2;
13422
13459
  }
13423
13460
 
13424
13461
  // ../../node_modules/@lezer/common/dist/index.js
@@ -13961,14 +13998,14 @@ var BaseNode = class {
13961
13998
  enterUnfinishedNodesBefore(pos) {
13962
13999
  let scan = this.childBefore(pos), node = this;
13963
14000
  while (scan) {
13964
- let last = scan.lastChild;
13965
- if (!last || last.to != scan.to)
14001
+ let last2 = scan.lastChild;
14002
+ if (!last2 || last2.to != scan.to)
13966
14003
  break;
13967
- if (last.type.isError && last.from == last.to) {
14004
+ if (last2.type.isError && last2.from == last2.to) {
13968
14005
  node = scan;
13969
- scan = last.prevSibling;
14006
+ scan = last2.prevSibling;
13970
14007
  } else {
13971
- scan = last;
14008
+ scan = last2;
13972
14009
  }
13973
14010
  }
13974
14011
  return node;
@@ -14764,12 +14801,12 @@ function buildTree(data2) {
14764
14801
  }
14765
14802
  function makeBalanced(type, contextHash2) {
14766
14803
  return (children2, positions2, length2) => {
14767
- let lookAhead2 = 0, lastI = children2.length - 1, last, lookAheadProp;
14768
- if (lastI >= 0 && (last = children2[lastI]) instanceof Tree) {
14769
- if (!lastI && last.type == type && last.length == length2)
14770
- return last;
14771
- if (lookAheadProp = last.prop(NodeProp.lookAhead))
14772
- lookAhead2 = positions2[lastI] + last.length + lookAheadProp;
14804
+ let lookAhead2 = 0, lastI = children2.length - 1, last2, lookAheadProp;
14805
+ if (lastI >= 0 && (last2 = children2[lastI]) instanceof Tree) {
14806
+ if (!lastI && last2.type == type && last2.length == length2)
14807
+ return last2;
14808
+ if (lookAheadProp = last2.prop(NodeProp.lookAhead))
14809
+ lookAhead2 = positions2[lastI] + last2.length + lookAheadProp;
14773
14810
  }
14774
14811
  return makeTree(type, children2, positions2, length2, lookAhead2, contextHash2);
14775
14812
  };
@@ -15226,9 +15263,9 @@ var MixedParse = class {
15226
15263
  if (range === true)
15227
15264
  range = new Range2(cursor2.from, cursor2.to);
15228
15265
  if (range.from < range.to) {
15229
- let last = overlay.ranges.length - 1;
15230
- if (last >= 0 && overlay.ranges[last].to == range.from)
15231
- overlay.ranges[last] = { from: overlay.ranges[last].from, to: range.to };
15266
+ let last2 = overlay.ranges.length - 1;
15267
+ if (last2 >= 0 && overlay.ranges[last2].to == range.from)
15268
+ overlay.ranges[last2] = { from: overlay.ranges[last2].from, to: range.to };
15232
15269
  else
15233
15270
  overlay.ranges.push(range);
15234
15271
  }
@@ -15458,10 +15495,10 @@ function enterFragments(mounts, ranges) {
15458
15495
  let overlay = mount.overlay.map((r13) => new Range2(r13.from + pos, r13.to + pos));
15459
15496
  let changes = findCoverChanges(ranges, overlay, from, to);
15460
15497
  for (let i13 = 0, pos2 = from; ; i13++) {
15461
- let last = i13 == changes.length, end = last ? to : changes[i13].from;
15498
+ let last2 = i13 == changes.length, end = last2 ? to : changes[i13].from;
15462
15499
  if (end > pos2)
15463
15500
  result.push(new TreeFragment(pos2, end, mount.tree, -startPos, frag.from >= pos2 || frag.openStart, frag.to <= end || frag.openEnd));
15464
- if (last)
15501
+ if (last2)
15465
15502
  break;
15466
15503
  pos2 = changes[i13].to;
15467
15504
  }
@@ -15592,10 +15629,10 @@ function styleTags(spec) {
15592
15629
  throw new RangeError("Invalid path: " + part);
15593
15630
  rest = part.slice(pos);
15594
15631
  }
15595
- let last = pieces.length - 1, inner = pieces[last];
15632
+ let last2 = pieces.length - 1, inner = pieces[last2];
15596
15633
  if (!inner)
15597
15634
  throw new RangeError("Invalid path: " + part);
15598
- let rule = new Rule(tags3, mode, last > 0 ? pieces.slice(0, last) : null);
15635
+ let rule = new Rule(tags3, mode, last2 > 0 ? pieces.slice(0, last2) : null);
15599
15636
  byName[inner] = rule.sort(byName[inner]);
15600
15637
  }
15601
15638
  }
@@ -16816,7 +16853,7 @@ var indentUnit = /* @__PURE__ */ Facet.define({
16816
16853
  var indentNodeProp = /* @__PURE__ */ new NodeProp();
16817
16854
  function bracketedAligned(context) {
16818
16855
  let tree = context.node;
16819
- let openToken = tree.childAfter(tree.from), last = tree.lastChild;
16856
+ let openToken = tree.childAfter(tree.from), last2 = tree.lastChild;
16820
16857
  if (!openToken)
16821
16858
  return null;
16822
16859
  let sim = context.options.simulateBreak;
@@ -16824,7 +16861,7 @@ function bracketedAligned(context) {
16824
16861
  let lineEnd2 = sim == null || sim <= openLine.from ? openLine.to : Math.min(openLine.to, sim);
16825
16862
  for (let pos = openToken.to; ; ) {
16826
16863
  let next = tree.childAfter(pos);
16827
- if (!next || next == last)
16864
+ if (!next || next == last2)
16828
16865
  return null;
16829
16866
  if (!next.type.isSkipped) {
16830
16867
  if (next.from >= lineEnd2)
@@ -16856,8 +16893,8 @@ function continuedIndent({ except, units = 1 } = {}) {
16856
16893
  var foldService = /* @__PURE__ */ Facet.define();
16857
16894
  var foldNodeProp = /* @__PURE__ */ new NodeProp();
16858
16895
  function foldInside(node) {
16859
- let first = node.firstChild, last = node.lastChild;
16860
- return first && first.to < last.from ? { from: first.to, to: last.type.isError ? node.to : last.from } : null;
16896
+ let first = node.firstChild, last2 = node.lastChild;
16897
+ return first && first.to < last2.from ? { from: first.to, to: last2.type.isError ? node.to : last2.from } : null;
16861
16898
  }
16862
16899
  var HighlightStyle = class _HighlightStyle {
16863
16900
  constructor(specs, options) {
@@ -17385,9 +17422,9 @@ function resolveAnnotationSpans(annotations, offsetMap) {
17385
17422
  for (const annotation of annotations) {
17386
17423
  if (annotation.length <= 0) continue;
17387
17424
  const start = offsetMap.get(annotation.offset);
17388
- const last = offsetMap.get(annotation.offset + annotation.length - 1);
17389
- if (start === void 0 || last === void 0 || last < start) continue;
17390
- spans.push({ annotation, start, end: last + 1 });
17425
+ const last2 = offsetMap.get(annotation.offset + annotation.length - 1);
17426
+ if (start === void 0 || last2 === void 0 || last2 < start) continue;
17427
+ spans.push({ annotation, start, end: last2 + 1 });
17391
17428
  }
17392
17429
  return spans;
17393
17430
  }
@@ -19217,10 +19254,10 @@ function moveField(dir) {
19217
19254
  let active = state.field(snippetState, false);
19218
19255
  if (!active || dir < 0 && active.active == 0)
19219
19256
  return false;
19220
- let next = active.active + dir, last = dir > 0 && !active.ranges.some((r13) => r13.field == next + dir);
19257
+ let next = active.active + dir, last2 = dir > 0 && !active.ranges.some((r13) => r13.field == next + dir);
19221
19258
  dispatch(state.update({
19222
19259
  selection: fieldSelection(active.ranges, next),
19223
- effects: setActive.of(last ? null : new ActiveSnippet(active.ranges, next)),
19260
+ effects: setActive.of(last2 ? null : new ActiveSnippet(active.ranges, next)),
19224
19261
  scrollIntoView: true
19225
19262
  }));
19226
19263
  return true;
@@ -19293,9 +19330,9 @@ var CompositeBlock = class _CompositeBlock {
19293
19330
  this.positions.push(pos);
19294
19331
  }
19295
19332
  toTree(nodeSet, end = this.end) {
19296
- let last = this.children.length - 1;
19297
- if (last >= 0)
19298
- end = Math.max(end, this.positions[last] + this.children[last].length + this.from);
19333
+ let last2 = this.children.length - 1;
19334
+ if (last2 >= 0)
19335
+ end = Math.max(end, this.positions[last2] + this.children[last2].length + this.from);
19299
19336
  return new Tree(nodeSet.types[this.type], this.children, this.positions, end - this.from).balance({
19300
19337
  makeTree: (children, positions, length) => new Tree(NodeType.none, children, positions, length, this.hashProp)
19301
19338
  });
@@ -19609,9 +19646,9 @@ function getListIndent(line, pos) {
19609
19646
  return indented >= indentAfter + 5 || skipped == line.text.length ? indentAfter + 1 : indented;
19610
19647
  }
19611
19648
  function addCodeText(marks2, from, to) {
19612
- let last = marks2.length - 1;
19613
- if (last >= 0 && marks2[last].to == from && marks2[last].type == Type.CodeText)
19614
- marks2[last].to = to;
19649
+ let last2 = marks2.length - 1;
19650
+ if (last2 >= 0 && marks2[last2].to == from && marks2[last2].type == Type.CodeText)
19651
+ marks2[last2].to = to;
19615
19652
  else
19616
19653
  marks2.push(elt(Type.CodeText, from, to));
19617
19654
  }
@@ -21230,10 +21267,10 @@ function autolinkURLEnd(text, from) {
21230
21267
  return -1;
21231
21268
  let end = from + m6[0].length;
21232
21269
  for (; ; ) {
21233
- let last = text[end - 1], m7;
21234
- if (/[?!.,:*_~]/.test(last) || last == ")" && count(text, from, end, ")") > count(text, from, end, "("))
21270
+ let last2 = text[end - 1], m7;
21271
+ if (/[?!.,:*_~]/.test(last2) || last2 == ")" && count(text, from, end, ")") > count(text, from, end, "("))
21235
21272
  end--;
21236
- else if (last == ";" && (m7 = /&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(text.slice(from, end))))
21273
+ else if (last2 == ";" && (m7 = /&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(text.slice(from, end))))
21237
21274
  end = from + m7.index;
21238
21275
  else
21239
21276
  break;
@@ -21245,8 +21282,8 @@ function autolinkEmailEnd(text, from) {
21245
21282
  let m6 = emailRE.exec(text);
21246
21283
  if (!m6)
21247
21284
  return -1;
21248
- let last = m6[0][m6[0].length - 1];
21249
- return last == "_" || last == "-" ? -1 : from + m6[0].length - (last == "." ? 1 : 0);
21285
+ let last2 = m6[0][m6[0].length - 1];
21286
+ return last2 == "_" || last2 == "-" ? -1 : from + m6[0].length - (last2 == "." ? 1 : 0);
21250
21287
  }
21251
21288
  var Autolink = {
21252
21289
  parseInline: [{
@@ -21773,16 +21810,16 @@ var Stack = class _Stack {
21773
21810
  @internal
21774
21811
  */
21775
21812
  emitContext() {
21776
- let last = this.buffer.length - 1;
21777
- if (last < 0 || this.buffer[last] != -3)
21813
+ let last2 = this.buffer.length - 1;
21814
+ if (last2 < 0 || this.buffer[last2] != -3)
21778
21815
  this.buffer.push(this.curContext.hash, this.pos, this.pos, -3);
21779
21816
  }
21780
21817
  /**
21781
21818
  @internal
21782
21819
  */
21783
21820
  emitLookAhead() {
21784
- let last = this.buffer.length - 1;
21785
- if (last < 0 || this.buffer[last] != -4)
21821
+ let last2 = this.buffer.length - 1;
21822
+ if (last2 < 0 || this.buffer[last2] != -4)
21786
21823
  this.buffer.push(this.lookAhead, this.pos, this.pos, -4);
21787
21824
  }
21788
21825
  updateContext(context) {
@@ -22303,12 +22340,12 @@ var FragmentCursor3 = class {
22303
22340
  if (!this.fragment)
22304
22341
  return null;
22305
22342
  for (; ; ) {
22306
- let last = this.trees.length - 1;
22307
- if (last < 0) {
22343
+ let last2 = this.trees.length - 1;
22344
+ if (last2 < 0) {
22308
22345
  this.nextFragment();
22309
22346
  return null;
22310
22347
  }
22311
- let top2 = this.trees[last], index = this.index[last];
22348
+ let top2 = this.trees[last2], index = this.index[last2];
22312
22349
  if (index == top2.children.length) {
22313
22350
  this.trees.pop();
22314
22351
  this.start.pop();
@@ -22316,7 +22353,7 @@ var FragmentCursor3 = class {
22316
22353
  continue;
22317
22354
  }
22318
22355
  let next = top2.children[index];
22319
- let start = this.start[last] + top2.positions[index];
22356
+ let start = this.start[last2] + top2.positions[index];
22320
22357
  if (start > pos) {
22321
22358
  this.nextStart = start;
22322
22359
  return null;
@@ -22332,14 +22369,14 @@ var FragmentCursor3 = class {
22332
22369
  return next;
22333
22370
  }
22334
22371
  }
22335
- this.index[last]++;
22372
+ this.index[last2]++;
22336
22373
  if (start + next.length >= Math.max(this.safeFrom, pos)) {
22337
22374
  this.trees.push(next);
22338
22375
  this.start.push(start);
22339
22376
  this.index.push(0);
22340
22377
  }
22341
22378
  } else {
22342
- this.index[last]++;
22379
+ this.index[last2]++;
22343
22380
  this.nextStart = start + next.length;
22344
22381
  }
22345
22382
  }
@@ -22640,8 +22677,8 @@ var Parse = class {
22640
22677
  let actions = this.tokens.getActions(stack);
22641
22678
  for (let i13 = 0; i13 < actions.length; ) {
22642
22679
  let action = actions[i13++], term = actions[i13++], end = actions[i13++];
22643
- let last = i13 == actions.length || !split;
22644
- let localStack = last ? stack : stack.split();
22680
+ let last2 = i13 == actions.length || !split;
22681
+ let localStack = last2 ? stack : stack.split();
22645
22682
  let main = this.tokens.mainToken;
22646
22683
  localStack.apply(action, term, main ? main.start : localStack.pos, end);
22647
22684
  if (verbose)
@@ -22649,7 +22686,7 @@ var Parse = class {
22649
22686
  action & 65535
22650
22687
  /* Action.ValueMask */
22651
22688
  )}`} for ${parser6.getName(term)} @ ${start}${localStack == stack ? "" : ", split"})`);
22652
- if (last)
22689
+ if (last2)
22653
22690
  return true;
22654
22691
  else if (localStack.pos > start)
22655
22692
  stacks.push(localStack);
@@ -22858,14 +22895,14 @@ var LRParser = class _LRParser extends Parser {
22858
22895
  if (term >= table[0])
22859
22896
  return -1;
22860
22897
  for (let pos = table[term + 1]; ; ) {
22861
- let groupTag = table[pos++], last = groupTag & 1;
22898
+ let groupTag = table[pos++], last2 = groupTag & 1;
22862
22899
  let target = table[pos++];
22863
- if (last && loose)
22900
+ if (last2 && loose)
22864
22901
  return target;
22865
22902
  for (let end = pos + (groupTag >> 1); pos < end; pos++)
22866
22903
  if (table[pos] == state)
22867
22904
  return target;
22868
- if (last)
22905
+ if (last2)
22869
22906
  return -1;
22870
22907
  }
22871
22908
  }
@@ -23428,7 +23465,7 @@ function configureNesting(tags3 = [], attributes = []) {
23428
23465
  let value = n12.lastChild;
23429
23466
  if (value.type.id == AttributeValue) {
23430
23467
  let from = value.from + 1;
23431
- let last = value.lastChild, to = value.to - (last && last.isError ? 0 : 1);
23468
+ let last2 = value.lastChild, to = value.to - (last2 && last2.isError ? 0 : 1);
23432
23469
  if (to > from) return { parser: attr.parser, overlay: [{ from, to }], bracketed: true };
23433
23470
  } else if (value.type.id == UnquotedAttributeValue) {
23434
23471
  return { parser: attr.parser, overlay: [{ from: value.from, to: value.to }] };
@@ -25546,11 +25583,11 @@ function completeAttrValue(state, schema, tree, from, to) {
25546
25583
  function htmlCompletionFor(schema, context) {
25547
25584
  let { state, pos } = context, tree = syntaxTree(state).resolveInner(pos, -1), around = tree.resolve(pos);
25548
25585
  for (let scan = pos, before; around == tree && (before = tree.childBefore(scan)); ) {
25549
- let last = before.lastChild;
25550
- if (!last || !last.type.isError || last.from < last.to)
25586
+ let last2 = before.lastChild;
25587
+ if (!last2 || !last2.type.isError || last2.from < last2.to)
25551
25588
  break;
25552
25589
  around = tree = before;
25553
- scan = last.from;
25590
+ scan = last2.from;
25554
25591
  }
25555
25592
  if (tree.name == "TagName") {
25556
25593
  return tree.parent && /CloseTag$/.test(tree.parent.name) ? completeCloseTag(state, tree, tree.from, pos) : completeTag(state, schema, tree, tree.from, pos);
@@ -25640,10 +25677,10 @@ var htmlPlain = /* @__PURE__ */ LRLanguage.define({
25640
25677
  return context.continue();
25641
25678
  let endElt = null, close;
25642
25679
  for (let cur = context.node; ; ) {
25643
- let last = cur.lastChild;
25644
- if (!last || last.name != "Element" || last.to != cur.to)
25680
+ let last2 = cur.lastChild;
25681
+ if (!last2 || last2.name != "Element" || last2.to != cur.to)
25645
25682
  break;
25646
- endElt = cur = last;
25683
+ endElt = cur = last2;
25647
25684
  }
25648
25685
  if (endElt && !((close = endElt.lastChild) && (close.name == "CloseTag" || close.name == "SelfClosingTag")))
25649
25686
  return context.lineIndent(endElt.from) + context.unit;
@@ -25652,10 +25689,10 @@ var htmlPlain = /* @__PURE__ */ LRLanguage.define({
25652
25689
  }),
25653
25690
  /* @__PURE__ */ foldNodeProp.add({
25654
25691
  Element(node) {
25655
- let first = node.firstChild, last = node.lastChild;
25692
+ let first = node.firstChild, last2 = node.lastChild;
25656
25693
  if (!first || first.name != "OpenTag")
25657
25694
  return null;
25658
- return { from: first.to, to: last.name == "CloseTag" ? last.from : node.to };
25695
+ return { from: first.to, to: last2.name == "CloseTag" ? last2.from : node.to };
25659
25696
  }
25660
25697
  }),
25661
25698
  /* @__PURE__ */ bracketMatchingHandle.add({
@@ -25765,14 +25802,14 @@ function isList(type) {
25765
25802
  return type.name == "OrderedList" || type.name == "BulletList";
25766
25803
  }
25767
25804
  function findSectionEnd(headerNode, level) {
25768
- let last = headerNode;
25805
+ let last2 = headerNode;
25769
25806
  for (; ; ) {
25770
- let next = last.nextSibling, heading2;
25807
+ let next = last2.nextSibling, heading2;
25771
25808
  if (!next || (heading2 = isHeading(next.type)) != null && heading2 <= level)
25772
25809
  break;
25773
- last = next;
25810
+ last2 = next;
25774
25811
  }
25775
- return last.to;
25812
+ return last2.to;
25776
25813
  }
25777
25814
  var headerIndent = /* @__PURE__ */ foldService.of((state, start, end) => {
25778
25815
  for (let node = syntaxTree(state).resolveInner(end, -1); node; node = node.parent) {
@@ -44178,7 +44215,7 @@ import { createMarkStateUnit } from "@semiont/sdk";
44178
44215
  import { createGatherStateUnit } from "@semiont/sdk";
44179
44216
  import { createMatchStateUnit } from "@semiont/sdk";
44180
44217
  import { createYieldStateUnit } from "@semiont/sdk";
44181
- import { decodeWithCharset as decodeWithCharset2, textExtractionOf, uuidV4 as uuidV42 } from "@semiont/core";
44218
+ import { decodeWithCharset as decodeWithCharset2, textSourceOf, uuidV4 as uuidV42 } from "@semiont/core";
44182
44219
  var WIZARD_CLOSED = {
44183
44220
  open: false,
44184
44221
  annotationId: null,
@@ -44212,7 +44249,7 @@ function createResourceViewerPageStateUnit(session, resourceId2, locale, browse,
44212
44249
  const contentLoading$ = new import_rxjs3.BehaviorSubject(false);
44213
44250
  const mediaToken$ = new import_rxjs3.BehaviorSubject(null);
44214
44251
  const mediaType = options?.mediaType || "text/plain";
44215
- const isBinaryType = textExtractionOf(mediaType) !== "decode";
44252
+ const isBinaryType = textSourceOf(mediaType) !== "decode";
44216
44253
  if (!isBinaryType && mediaType) {
44217
44254
  contentLoading$.next(true);
44218
44255
  client.browse.resourceRepresentation(resourceId2).then(({ data: data2, contentType }) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@semiont/react-ui",
3
- "version": "0.5.30",
3
+ "version": "0.5.32",
4
4
  "engines": {
5
5
  "node": ">=24.0.0"
6
6
  },
@@ -95,7 +95,7 @@
95
95
  "@testing-library/jest-dom": "^7.0.1",
96
96
  "@testing-library/react": "^16.3.3",
97
97
  "@types/react": "^19.2.18",
98
- "@types/react-dom": "^19.2.5",
98
+ "@types/react-dom": "^19.2.7",
99
99
  "@vitest/coverage-v8": "^4.1.11",
100
100
  "autoprefixer": "^10.5.4",
101
101
  "axe-core": "^4.12.1",
@@ -122,12 +122,12 @@
122
122
  "directory": "packages/react-ui"
123
123
  },
124
124
  "dependencies": {
125
- "@semiont/core": "0.5.30",
126
- "@semiont/http-transport": "0.5.30",
127
- "@semiont/sdk": "0.5.30",
125
+ "@semiont/core": "0.5.32",
126
+ "@semiont/http-transport": "0.5.32",
127
+ "@semiont/sdk": "0.5.32",
128
128
  "clsx": "^2.1.1",
129
129
  "pdfjs-dist": "^6.2.108",
130
- "react-error-boundary": "^6.1.3",
130
+ "react-error-boundary": "^6.1.4",
131
131
  "react-markdown": "^10.1.0",
132
132
  "remark-gfm": "^4.0.1",
133
133
  "use-sync-external-store": "^1.6.0"
@@ -59,6 +59,7 @@ const loadedHighlight: Annotation = {
59
59
  type: 'Annotation',
60
60
  id: annotationId('ann-1'),
61
61
  motivation: 'highlighting',
62
+ created: '2026-01-01T00:00:00.000Z',
62
63
  target: { source: 'res-1', selector: { type: 'TextPositionSelector', start: 0, end: 10 } },
63
64
  };
64
65
 
@@ -152,7 +152,7 @@ describe('createResourceViewerPageStateUnit', () => {
152
152
  stateUnit.dispose();
153
153
  });
154
154
 
155
- // isBinaryType keys off textExtractionOf(...) !== 'decode', not render mode:
155
+ // isBinaryType keys off textSourceOf(...) !== 'decode', not render mode:
156
156
  // storage-tier binary (ZIP, gif/webp) must be fetched as bytes, never
157
157
  // decoded as text — the client-side twin of the Phase 3a serving-side fix.
158
158
  it('fetches storage-tier binary (ZIP) as bytes, never the text-decode path', async () => {
@@ -10,7 +10,7 @@ import { createGatherStateUnit, type GatherStateUnit } from '@semiont/sdk';
10
10
  import { createMatchStateUnit } from '@semiont/sdk';
11
11
  import { createYieldStateUnit, type YieldStateUnit } from '@semiont/sdk';
12
12
  import type { SemiontSession } from '@semiont/sdk';
13
- import { decodeWithCharset, textExtractionOf, uuidV4 } from '@semiont/core';
13
+ import { decodeWithCharset, textSourceOf, uuidV4 } from '@semiont/core';
14
14
  import { groupAnnotations } from '../../../lib/annotation-groups';
15
15
  import type { ReferencedByEntry } from '@semiont/sdk';
16
16
 
@@ -109,7 +109,7 @@ export function createResourceViewerPageStateUnit(
109
109
  // type does not decode to text. Storage-tier images (gif/webp) are
110
110
  // render:'none' but still binary, and a ZIP must avoid the text path; a
111
111
  // mechanical render-mode check would mis-route both into mojibake.
112
- const isBinaryType = textExtractionOf(mediaType) !== 'decode';
112
+ const isBinaryType = textSourceOf(mediaType) !== 'decode';
113
113
 
114
114
  if (!isBinaryType && mediaType) {
115
115
  contentLoading$.next(true);