sqlui 0.1.59 → 0.1.61

Sign up to get free protection for your applications and to get access to all the features.
@@ -1514,10 +1514,11 @@
1514
1514
  /**
1515
1515
  Create a selection range.
1516
1516
  */
1517
- static range(anchor, head, goalColumn) {
1518
- let goal = (goalColumn !== null && goalColumn !== void 0 ? goalColumn : 33554431 /* RangeFlag.NoGoalColumn */) << 5 /* RangeFlag.GoalColumnOffset */;
1519
- return head < anchor ? SelectionRange.create(head, anchor, 16 /* RangeFlag.Inverted */ | goal | 8 /* RangeFlag.AssocAfter */)
1520
- : SelectionRange.create(anchor, head, goal | (head > anchor ? 4 /* RangeFlag.AssocBefore */ : 0));
1517
+ static range(anchor, head, goalColumn, bidiLevel) {
1518
+ let flags = ((goalColumn !== null && goalColumn !== void 0 ? goalColumn : 33554431 /* RangeFlag.NoGoalColumn */) << 5 /* RangeFlag.GoalColumnOffset */) |
1519
+ (bidiLevel == null ? 3 : Math.min(2, bidiLevel));
1520
+ return head < anchor ? SelectionRange.create(head, anchor, 16 /* RangeFlag.Inverted */ | 8 /* RangeFlag.AssocAfter */ | flags)
1521
+ : SelectionRange.create(anchor, head, (head > anchor ? 4 /* RangeFlag.AssocBefore */ : 0) | flags);
1521
1522
  }
1522
1523
  /**
1523
1524
  @internal
@@ -3055,7 +3056,7 @@
3055
3056
  @internal
3056
3057
  */
3057
3058
  static create(from, to, value) {
3058
- return new Range$1(from, to, value);
3059
+ return new Range(from, to, value);
3059
3060
  }
3060
3061
  };
3061
3062
  function cmpRange(a, b) {
@@ -4346,6 +4347,26 @@
4346
4347
  }
4347
4348
  }
4348
4349
  }
4350
+ function scrollableParent(dom) {
4351
+ let doc = dom.ownerDocument;
4352
+ for (let cur = dom.parentNode; cur;) {
4353
+ if (cur == doc.body) {
4354
+ break;
4355
+ }
4356
+ else if (cur.nodeType == 1) {
4357
+ if (cur.scrollHeight > cur.clientHeight || cur.scrollWidth > cur.clientWidth)
4358
+ return cur;
4359
+ cur = cur.assignedSlot || cur.parentNode;
4360
+ }
4361
+ else if (cur.nodeType == 11) {
4362
+ cur = cur.host;
4363
+ }
4364
+ else {
4365
+ break;
4366
+ }
4367
+ }
4368
+ return null;
4369
+ }
4349
4370
  class DOMSelectionState {
4350
4371
  constructor() {
4351
4372
  this.anchorNode = null;
@@ -5482,7 +5503,9 @@
5482
5503
  super(-200000000 /* Side.Line */, -200000000 /* Side.Line */, null, spec);
5483
5504
  }
5484
5505
  eq(other) {
5485
- return other instanceof LineDecoration && attrsEq(this.spec.attributes, other.spec.attributes);
5506
+ return other instanceof LineDecoration &&
5507
+ this.spec.class == other.spec.class &&
5508
+ attrsEq(this.spec.attributes, other.spec.attributes);
5486
5509
  }
5487
5510
  range(from, to = from) {
5488
5511
  if (to != from)
@@ -7233,7 +7256,8 @@
7233
7256
  closestRect = rect;
7234
7257
  closestX = dx;
7235
7258
  closestY = dy;
7236
- closestOverlap = !dx || (dx > 0 ? i < rects.length - 1 : i > 0);
7259
+ let side = dy ? (y < rect.top ? -1 : 1) : dx ? (x < rect.left ? -1 : 1) : 0;
7260
+ closestOverlap = !side || (side > 0 ? i < rects.length - 1 : i > 0);
7237
7261
  }
7238
7262
  if (dx == 0) {
7239
7263
  if (y > rect.bottom && (!aboveRect || aboveRect.bottom < rect.bottom)) {
@@ -7544,22 +7568,30 @@
7544
7568
  this.compositionFirstChange = null;
7545
7569
  this.compositionEndedAt = 0;
7546
7570
  this.mouseSelection = null;
7571
+ let handleEvent = (handler, event) => {
7572
+ if (this.ignoreDuringComposition(event))
7573
+ return;
7574
+ if (event.type == "keydown" && this.keydown(view, event))
7575
+ return;
7576
+ if (this.mustFlushObserver(event))
7577
+ view.observer.forceFlush();
7578
+ if (this.runCustomHandlers(event.type, view, event))
7579
+ event.preventDefault();
7580
+ else
7581
+ handler(view, event);
7582
+ };
7547
7583
  for (let type in handlers) {
7548
7584
  let handler = handlers[type];
7549
- view.contentDOM.addEventListener(type, (event) => {
7550
- if (!eventBelongsToEditor(view, event) || this.ignoreDuringComposition(event))
7551
- return;
7552
- if (type == "keydown" && this.keydown(view, event))
7553
- return;
7554
- if (this.mustFlushObserver(event))
7555
- view.observer.forceFlush();
7556
- if (this.runCustomHandlers(type, view, event))
7557
- event.preventDefault();
7558
- else
7559
- handler(view, event);
7585
+ view.contentDOM.addEventListener(type, event => {
7586
+ if (eventBelongsToEditor(view, event))
7587
+ handleEvent(handler, event);
7560
7588
  }, handlerOptions[type]);
7561
7589
  this.registeredEvents.push(type);
7562
7590
  }
7591
+ view.scrollDOM.addEventListener("mousedown", (event) => {
7592
+ if (event.target == view.scrollDOM)
7593
+ handleEvent(handlers.mousedown, event);
7594
+ });
7563
7595
  if (browser.chrome && browser.chrome_version == 102) { // FIXME remove at some point
7564
7596
  // On Chrome 102, viewport updates somehow stop wheel-based
7565
7597
  // scrolling. Turning off pointer events during the scroll seems
@@ -7716,12 +7748,18 @@
7716
7748
  const EmacsyPendingKeys = "dthko";
7717
7749
  // Key codes for modifier keys
7718
7750
  const modifierCodes = [16, 17, 18, 20, 91, 92, 224, 225];
7751
+ function dragScrollSpeed(dist) {
7752
+ return dist * 0.7 + 8;
7753
+ }
7719
7754
  class MouseSelection {
7720
7755
  constructor(view, startEvent, style, mustSelect) {
7721
7756
  this.view = view;
7722
7757
  this.style = style;
7723
7758
  this.mustSelect = mustSelect;
7759
+ this.scrollSpeed = { x: 0, y: 0 };
7760
+ this.scrolling = -1;
7724
7761
  this.lastEvent = startEvent;
7762
+ this.scrollParent = scrollableParent(view.contentDOM);
7725
7763
  let doc = view.contentDOM.ownerDocument;
7726
7764
  doc.addEventListener("mousemove", this.move = this.move.bind(this));
7727
7765
  doc.addEventListener("mouseup", this.up = this.up.bind(this));
@@ -7737,11 +7775,24 @@
7737
7775
  }
7738
7776
  }
7739
7777
  move(event) {
7778
+ var _a;
7740
7779
  if (event.buttons == 0)
7741
7780
  return this.destroy();
7742
7781
  if (this.dragging !== false)
7743
7782
  return;
7744
7783
  this.select(this.lastEvent = event);
7784
+ let sx = 0, sy = 0;
7785
+ let rect = ((_a = this.scrollParent) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect())
7786
+ || { left: 0, top: 0, right: this.view.win.innerWidth, bottom: this.view.win.innerHeight };
7787
+ if (event.clientX <= rect.left)
7788
+ sx = -dragScrollSpeed(rect.left - event.clientX);
7789
+ else if (event.clientX >= rect.right)
7790
+ sx = dragScrollSpeed(event.clientX - rect.right);
7791
+ if (event.clientY <= rect.top)
7792
+ sy = -dragScrollSpeed(rect.top - event.clientY);
7793
+ else if (event.clientY >= rect.bottom)
7794
+ sy = dragScrollSpeed(event.clientY - rect.bottom);
7795
+ this.setScrollSpeed(sx, sy);
7745
7796
  }
7746
7797
  up(event) {
7747
7798
  if (this.dragging == null)
@@ -7751,19 +7802,41 @@
7751
7802
  this.destroy();
7752
7803
  }
7753
7804
  destroy() {
7805
+ this.setScrollSpeed(0, 0);
7754
7806
  let doc = this.view.contentDOM.ownerDocument;
7755
7807
  doc.removeEventListener("mousemove", this.move);
7756
7808
  doc.removeEventListener("mouseup", this.up);
7757
7809
  this.view.inputState.mouseSelection = null;
7758
7810
  }
7811
+ setScrollSpeed(sx, sy) {
7812
+ this.scrollSpeed = { x: sx, y: sy };
7813
+ if (sx || sy) {
7814
+ if (this.scrolling < 0)
7815
+ this.scrolling = setInterval(() => this.scroll(), 50);
7816
+ }
7817
+ else if (this.scrolling > -1) {
7818
+ clearInterval(this.scrolling);
7819
+ this.scrolling = -1;
7820
+ }
7821
+ }
7822
+ scroll() {
7823
+ if (this.scrollParent) {
7824
+ this.scrollParent.scrollLeft += this.scrollSpeed.x;
7825
+ this.scrollParent.scrollTop += this.scrollSpeed.y;
7826
+ }
7827
+ else {
7828
+ this.view.win.scrollBy(this.scrollSpeed.x, this.scrollSpeed.y);
7829
+ }
7830
+ if (this.dragging === false)
7831
+ this.select(this.lastEvent);
7832
+ }
7759
7833
  select(event) {
7760
7834
  let selection = this.style.get(event, this.extend, this.multiple);
7761
7835
  if (this.mustSelect || !selection.eq(this.view.state.selection) ||
7762
7836
  selection.main.assoc != this.view.state.selection.main.assoc)
7763
7837
  this.view.dispatch({
7764
7838
  selection,
7765
- userEvent: "select.pointer",
7766
- scrollIntoView: true
7839
+ userEvent: "select.pointer"
7767
7840
  });
7768
7841
  this.mustSelect = false;
7769
7842
  }
@@ -7954,23 +8027,15 @@
7954
8027
  function basicMouseSelection(view, event) {
7955
8028
  let start = queryPos(view, event), type = getClickType(event);
7956
8029
  let startSel = view.state.selection;
7957
- let last = start, lastEvent = event;
7958
8030
  return {
7959
8031
  update(update) {
7960
8032
  if (update.docChanged) {
7961
8033
  start.pos = update.changes.mapPos(start.pos);
7962
8034
  startSel = startSel.map(update.changes);
7963
- lastEvent = null;
7964
8035
  }
7965
8036
  },
7966
8037
  get(event, extend, multiple) {
7967
- let cur;
7968
- if (lastEvent && event.clientX == lastEvent.clientX && event.clientY == lastEvent.clientY)
7969
- cur = last;
7970
- else {
7971
- cur = last = queryPos(view, event);
7972
- lastEvent = event;
7973
- }
8038
+ let cur = queryPos(view, event);
7974
8039
  let range = rangeForClick(view, cur.pos, cur.bias, type);
7975
8040
  if (start.pos != cur.pos && !extend) {
7976
8041
  let startRange = rangeForClick(view, start.pos, start.bias, type);
@@ -9416,7 +9481,7 @@
9416
9481
  });
9417
9482
  }
9418
9483
  const baseTheme$1$3 = /*@__PURE__*/buildTheme("." + baseThemeID, {
9419
- "&.cm-editor": {
9484
+ "&": {
9420
9485
  position: "relative !important",
9421
9486
  boxSizing: "border-box",
9422
9487
  "&.cm-focused": {
@@ -9700,7 +9765,7 @@
9700
9765
  insert: Text.of(domChange.text.slice(diff.from, diff.toB).split(LineBreakPlaceholder)) };
9701
9766
  }
9702
9767
  }
9703
- else if (newSel && (!view.hasFocus || !view.state.facet(editable) || newSel.main.eq(sel))) {
9768
+ else if (newSel && (!view.hasFocus && view.state.facet(editable) || newSel.main.eq(sel))) {
9704
9769
  newSel = null;
9705
9770
  }
9706
9771
  if (!change && !newSel)
@@ -10764,6 +10829,8 @@
10764
10829
  if (this.measureScheduled < 0)
10765
10830
  this.measureScheduled = this.win.requestAnimationFrame(() => this.measure());
10766
10831
  if (request) {
10832
+ if (this.measureRequests.indexOf(request) > -1)
10833
+ return;
10767
10834
  if (request.key != null)
10768
10835
  for (let i = 0; i < this.measureRequests.length; i++) {
10769
10836
  if (this.measureRequests[i].key === request.key) {
@@ -11447,6 +11514,8 @@
11447
11514
  if (runFor(scopeObj[prefix + modifiers(name, event, !isChar)]))
11448
11515
  return true;
11449
11516
  if (isChar && (event.altKey || event.metaKey || event.ctrlKey) &&
11517
+ // Ctrl-Alt may be used for AltGr on Windows
11518
+ !(browser.windows && event.ctrlKey && event.altKey) &&
11450
11519
  (baseName = base[event.keyCode]) && baseName != name) {
11451
11520
  if (runFor(scopeObj[prefix + modifiers(baseName, event, true)]))
11452
11521
  return true;
@@ -11741,7 +11810,7 @@
11741
11810
  ];
11742
11811
  }
11743
11812
  function configChanged(update) {
11744
- return update.startState.facet(selectionConfig) != update.startState.facet(selectionConfig);
11813
+ return update.startState.facet(selectionConfig) != update.state.facet(selectionConfig);
11745
11814
  }
11746
11815
  const cursorLayer = /*@__PURE__*/layer({
11747
11816
  above: true,
@@ -11760,7 +11829,7 @@
11760
11829
  return cursors;
11761
11830
  },
11762
11831
  update(update, dom) {
11763
- if (update.transactions.some(tr => tr.scrollIntoView))
11832
+ if (update.transactions.some(tr => tr.selection))
11764
11833
  dom.style.animationName = dom.style.animationName == "cm-blink" ? "cm-blink2" : "cm-blink";
11765
11834
  let confChange = configChanged(update);
11766
11835
  if (confChange)
@@ -13267,15 +13336,14 @@
13267
13336
  constructor(gutter, viewport, height) {
13268
13337
  this.gutter = gutter;
13269
13338
  this.height = height;
13270
- this.localMarkers = [];
13271
13339
  this.i = 0;
13272
13340
  this.cursor = RangeSet.iter(gutter.markers, viewport.from);
13273
13341
  }
13274
13342
  line(view, line, extraMarkers) {
13275
- if (this.localMarkers.length)
13276
- this.localMarkers = [];
13277
- advanceCursor(this.cursor, this.localMarkers, line.from);
13278
- let localMarkers = extraMarkers.length ? this.localMarkers.concat(extraMarkers) : this.localMarkers;
13343
+ let localMarkers = [];
13344
+ advanceCursor(this.cursor, localMarkers, line.from);
13345
+ if (extraMarkers.length)
13346
+ localMarkers = localMarkers.concat(extraMarkers);
13279
13347
  let forLine = this.gutter.config.lineMarker(view, line, localMarkers);
13280
13348
  if (forLine)
13281
13349
  localMarkers.unshift(forLine);
@@ -13313,7 +13381,17 @@
13313
13381
  this.dom.className = "cm-gutter" + (this.config.class ? " " + this.config.class : "");
13314
13382
  for (let prop in config.domEventHandlers) {
13315
13383
  this.dom.addEventListener(prop, (event) => {
13316
- let line = view.lineBlockAtHeight(event.clientY - view.documentTop);
13384
+ let target = event.target, y;
13385
+ if (target != this.dom && this.dom.contains(target)) {
13386
+ while (target.parentNode != this.dom)
13387
+ target = target.parentNode;
13388
+ let rect = target.getBoundingClientRect();
13389
+ y = (rect.top + rect.bottom) / 2;
13390
+ }
13391
+ else {
13392
+ y = event.clientY;
13393
+ }
13394
+ let line = view.lineBlockAtHeight(y - view.documentTop);
13317
13395
  if (config.domEventHandlers[prop](view, line, event))
13318
13396
  event.preventDefault();
13319
13397
  });
@@ -16967,7 +17045,7 @@
16967
17045
  */
16968
17046
  const defaultHighlightStyle = /*@__PURE__*/HighlightStyle.define([
16969
17047
  { tag: tags.meta,
16970
- color: "#7a757a" },
17048
+ color: "#404740" },
16971
17049
  { tag: tags.link,
16972
17050
  textDecoration: "underline" },
16973
17051
  { tag: tags.heading,
@@ -17066,6 +17144,15 @@
17066
17144
  function bracketMatching(config = {}) {
17067
17145
  return [bracketMatchingConfig.of(config), bracketMatchingUnique];
17068
17146
  }
17147
+ /**
17148
+ When larger syntax nodes, such as HTML tags, are marked as
17149
+ opening/closing, it can be a bit messy to treat the whole node as
17150
+ a matchable bracket. This node prop allows you to define, for such
17151
+ a node, a ‘handle’—the part of the node that is highlighted, and
17152
+ that the cursor must be on to activate highlighting in the first
17153
+ place.
17154
+ */
17155
+ const bracketMatchingHandle = /*@__PURE__*/new NodeProp();
17069
17156
  function matchingNodes(node, dir, brackets) {
17070
17157
  let byProp = node.prop(dir < 0 ? NodeProp.openedBy : NodeProp.closedBy);
17071
17158
  if (byProp)
@@ -17077,6 +17164,10 @@
17077
17164
  }
17078
17165
  return null;
17079
17166
  }
17167
+ function findHandle(node) {
17168
+ let hasHandle = node.type.prop(bracketMatchingHandle);
17169
+ return hasHandle ? hasHandle(node.node) : node;
17170
+ }
17080
17171
  /**
17081
17172
  Find the matching bracket for the token at `pos`, scanning
17082
17173
  direction `dir`. Only the `brackets` and `maxScanDistance`
@@ -17088,30 +17179,36 @@
17088
17179
  let tree = syntaxTree(state), node = tree.resolveInner(pos, dir);
17089
17180
  for (let cur = node; cur; cur = cur.parent) {
17090
17181
  let matches = matchingNodes(cur.type, dir, brackets);
17091
- if (matches && cur.from < cur.to)
17092
- return matchMarkedBrackets(state, pos, dir, cur, matches, brackets);
17182
+ if (matches && cur.from < cur.to) {
17183
+ let handle = findHandle(cur);
17184
+ if (handle && (dir > 0 ? pos >= handle.from && pos < handle.to : pos > handle.from && pos <= handle.to))
17185
+ return matchMarkedBrackets(state, pos, dir, cur, handle, matches, brackets);
17186
+ }
17093
17187
  }
17094
17188
  return matchPlainBrackets(state, pos, dir, tree, node.type, maxScanDistance, brackets);
17095
17189
  }
17096
- function matchMarkedBrackets(_state, _pos, dir, token, matching, brackets) {
17097
- let parent = token.parent, firstToken = { from: token.from, to: token.to };
17190
+ function matchMarkedBrackets(_state, _pos, dir, token, handle, matching, brackets) {
17191
+ let parent = token.parent, firstToken = { from: handle.from, to: handle.to };
17098
17192
  let depth = 0, cursor = parent === null || parent === void 0 ? void 0 : parent.cursor();
17099
17193
  if (cursor && (dir < 0 ? cursor.childBefore(token.from) : cursor.childAfter(token.to)))
17100
17194
  do {
17101
17195
  if (dir < 0 ? cursor.to <= token.from : cursor.from >= token.to) {
17102
17196
  if (depth == 0 && matching.indexOf(cursor.type.name) > -1 && cursor.from < cursor.to) {
17103
- return { start: firstToken, end: { from: cursor.from, to: cursor.to }, matched: true };
17197
+ let endHandle = findHandle(cursor);
17198
+ return { start: firstToken, end: endHandle ? { from: endHandle.from, to: endHandle.to } : undefined, matched: true };
17104
17199
  }
17105
17200
  else if (matchingNodes(cursor.type, dir, brackets)) {
17106
17201
  depth++;
17107
17202
  }
17108
17203
  else if (matchingNodes(cursor.type, -dir, brackets)) {
17109
- if (depth == 0)
17204
+ if (depth == 0) {
17205
+ let endHandle = findHandle(cursor);
17110
17206
  return {
17111
17207
  start: firstToken,
17112
- end: cursor.from == cursor.to ? undefined : { from: cursor.from, to: cursor.to },
17208
+ end: endHandle && endHandle.from < endHandle.to ? { from: endHandle.from, to: endHandle.to } : undefined,
17113
17209
  matched: false
17114
17210
  };
17211
+ }
17115
17212
  depth--;
17116
17213
  }
17117
17214
  }
@@ -17391,8 +17488,13 @@
17391
17488
  combine(configs) {
17392
17489
  return combineConfig(configs, {
17393
17490
  minDepth: 100,
17394
- newGroupDelay: 500
17395
- }, { minDepth: Math.max, newGroupDelay: Math.min });
17491
+ newGroupDelay: 500,
17492
+ joinToEvent: (_t, isAdjacent) => isAdjacent,
17493
+ }, {
17494
+ minDepth: Math.max,
17495
+ newGroupDelay: Math.min,
17496
+ joinToEvent: (a, b) => (tr, adj) => a(tr, adj) || b(tr, adj)
17497
+ });
17396
17498
  }
17397
17499
  });
17398
17500
  function changeEnd(changes) {
@@ -17425,7 +17527,7 @@
17425
17527
  let event = HistEvent.fromTransaction(tr);
17426
17528
  let time = tr.annotation(Transaction.time), userEvent = tr.annotation(Transaction.userEvent);
17427
17529
  if (event)
17428
- state = state.addChanges(event, time, userEvent, config.newGroupDelay, config.minDepth);
17530
+ state = state.addChanges(event, time, userEvent, config, tr);
17429
17531
  else if (tr.selection)
17430
17532
  state = state.addSelection(tr.startState.selection, time, userEvent, config.newGroupDelay);
17431
17533
  if (isolate == "full" || isolate == "after")
@@ -17637,19 +17739,19 @@
17637
17739
  isolate() {
17638
17740
  return this.prevTime ? new HistoryState(this.done, this.undone) : this;
17639
17741
  }
17640
- addChanges(event, time, userEvent, newGroupDelay, maxLen) {
17742
+ addChanges(event, time, userEvent, config, tr) {
17641
17743
  let done = this.done, lastEvent = done[done.length - 1];
17642
17744
  if (lastEvent && lastEvent.changes && !lastEvent.changes.empty && event.changes &&
17643
17745
  (!userEvent || joinableUserEvent.test(userEvent)) &&
17644
17746
  ((!lastEvent.selectionsAfter.length &&
17645
- time - this.prevTime < newGroupDelay &&
17646
- isAdjacent(lastEvent.changes, event.changes)) ||
17747
+ time - this.prevTime < config.newGroupDelay &&
17748
+ config.joinToEvent(tr, isAdjacent(lastEvent.changes, event.changes))) ||
17647
17749
  // For compose (but not compose.start) events, always join with previous event
17648
17750
  userEvent == "input.type.compose")) {
17649
- done = updateBranch(done, done.length - 1, maxLen, new HistEvent(event.changes.compose(lastEvent.changes), conc(event.effects, lastEvent.effects), lastEvent.mapped, lastEvent.startSelection, none$1));
17751
+ done = updateBranch(done, done.length - 1, config.minDepth, new HistEvent(event.changes.compose(lastEvent.changes), conc(event.effects, lastEvent.effects), lastEvent.mapped, lastEvent.startSelection, none$1));
17650
17752
  }
17651
17753
  else {
17652
- done = updateBranch(done, done.length, maxLen, event);
17754
+ done = updateBranch(done, done.length, config.minDepth, event);
17653
17755
  }
17654
17756
  return new HistoryState(done, none$1, time, userEvent);
17655
17757
  }
@@ -17898,7 +18000,7 @@
17898
18000
  function extendSel(view, how) {
17899
18001
  let selection = updateSel(view.state.selection, range => {
17900
18002
  let head = how(range);
17901
- return EditorSelection.range(range.anchor, head.head, head.goalColumn);
18003
+ return EditorSelection.range(range.anchor, head.head, head.goalColumn, head.bidiLevel || undefined);
17902
18004
  });
17903
18005
  if (selection.eq(view.state.selection))
17904
18006
  return false;
@@ -20091,6 +20193,7 @@
20091
20193
  closeOnBlur: true,
20092
20194
  maxRenderedOptions: 100,
20093
20195
  defaultKeymap: true,
20196
+ tooltipClass: () => "",
20094
20197
  optionClass: () => "",
20095
20198
  aboveCursor: false,
20096
20199
  icons: true,
@@ -20101,6 +20204,7 @@
20101
20204
  defaultKeymap: (a, b) => a && b,
20102
20205
  closeOnBlur: (a, b) => a && b,
20103
20206
  icons: (a, b) => a && b,
20207
+ tooltipClass: (a, b) => c => joinClass(a(c), b(c)),
20104
20208
  optionClass: (a, b) => c => joinClass(a(c), b(c)),
20105
20209
  addToOptions: (a, b) => a.concat(b)
20106
20210
  });
@@ -20179,14 +20283,17 @@
20179
20283
  key: this
20180
20284
  };
20181
20285
  this.space = null;
20286
+ this.currentClass = "";
20182
20287
  let cState = view.state.field(stateField);
20183
20288
  let { options, selected } = cState.open;
20184
20289
  let config = view.state.facet(completionConfig);
20185
20290
  this.optionContent = optionContent(config);
20186
20291
  this.optionClass = config.optionClass;
20292
+ this.tooltipClass = config.tooltipClass;
20187
20293
  this.range = rangeAroundSelected(options.length, selected, config.maxRenderedOptions);
20188
20294
  this.dom = document.createElement("div");
20189
20295
  this.dom.className = "cm-tooltip-autocomplete";
20296
+ this.updateTooltipClass(view.state);
20190
20297
  this.dom.addEventListener("mousedown", (e) => {
20191
20298
  for (let dom = e.target, match; dom && dom != this.dom; dom = dom.parentNode) {
20192
20299
  if (dom.nodeName == "LI" && (match = /-(\d+)$/.exec(dom.id)) && +match[1] < options.length) {
@@ -20207,12 +20314,25 @@
20207
20314
  var _a, _b, _c;
20208
20315
  let cState = update.state.field(this.stateField);
20209
20316
  let prevState = update.startState.field(this.stateField);
20317
+ this.updateTooltipClass(update.state);
20210
20318
  if (cState != prevState) {
20211
20319
  this.updateSel();
20212
20320
  if (((_a = cState.open) === null || _a === void 0 ? void 0 : _a.disabled) != ((_b = prevState.open) === null || _b === void 0 ? void 0 : _b.disabled))
20213
20321
  this.dom.classList.toggle("cm-tooltip-autocomplete-disabled", !!((_c = cState.open) === null || _c === void 0 ? void 0 : _c.disabled));
20214
20322
  }
20215
20323
  }
20324
+ updateTooltipClass(state) {
20325
+ let cls = this.tooltipClass(state);
20326
+ if (cls != this.currentClass) {
20327
+ for (let c of this.currentClass.split(" "))
20328
+ if (c)
20329
+ this.dom.classList.remove(c);
20330
+ for (let c of cls.split(" "))
20331
+ if (c)
20332
+ this.dom.classList.add(c);
20333
+ this.currentClass = cls;
20334
+ }
20335
+ }
20216
20336
  positioned(space) {
20217
20337
  this.space = space;
20218
20338
  if (this.info)
@@ -20473,13 +20593,13 @@
20473
20593
  if (active.length == this.active.length && active.every((a, i) => a == this.active[i]))
20474
20594
  active = this.active;
20475
20595
  let open = this.open;
20596
+ if (open && tr.docChanged)
20597
+ open = open.map(tr.changes);
20476
20598
  if (tr.selection || active.some(a => a.hasResult() && tr.changes.touchesRange(a.from, a.to)) ||
20477
20599
  !sameResults(active, this.active))
20478
- open = CompletionDialog.build(active, state, this.id, this.open, conf);
20600
+ open = CompletionDialog.build(active, state, this.id, open, conf);
20479
20601
  else if (open && open.disabled && !active.some(a => a.state == 1 /* State.Pending */))
20480
20602
  open = null;
20481
- else if (open && tr.docChanged)
20482
- open = open.map(tr.changes);
20483
20603
  if (!open && active.every(a => a.state != 1 /* State.Pending */) && active.some(a => a.hasResult()))
20484
20604
  active = active.map(a => a.hasResult() ? new ActiveSource(a.source, 0 /* State.Inactive */) : a);
20485
20605
  for (let effect of tr.effects)
@@ -21915,7 +22035,8 @@
21915
22035
  // Apply a reduce action
21916
22036
  /// @internal
21917
22037
  reduce(action) {
21918
- let depth = action >> 19 /* ReduceDepthShift */, type = action & 65535 /* ValueMask */;
22038
+ var _a;
22039
+ let depth = action >> 19 /* Action.ReduceDepthShift */, type = action & 65535 /* Action.ValueMask */;
21919
22040
  let { parser } = this.p;
21920
22041
  let dPrec = parser.dynamicPrecedence(type);
21921
22042
  if (dPrec)
@@ -21934,15 +22055,29 @@
21934
22055
  // consume two extra frames (the dummy parent node for the skipped
21935
22056
  // expression and the state that we'll be staying in, which should
21936
22057
  // be moved to `this.state`).
21937
- let base = this.stack.length - ((depth - 1) * 3) - (action & 262144 /* StayFlag */ ? 6 : 0);
21938
- let start = this.stack[base - 2];
21939
- let bufferBase = this.stack[base - 1], count = this.bufferBase + this.buffer.length - bufferBase;
22058
+ let base = this.stack.length - ((depth - 1) * 3) - (action & 262144 /* Action.StayFlag */ ? 6 : 0);
22059
+ let start = base ? this.stack[base - 2] : this.p.ranges[0].from, size = this.reducePos - start;
22060
+ // This is a kludge to try and detect overly deep left-associative
22061
+ // trees, which will not increase the parse stack depth and thus
22062
+ // won't be caught by the regular stack-depth limit check.
22063
+ if (size >= 2000 /* Recover.MinBigReduction */ && !((_a = this.p.parser.nodeSet.types[type]) === null || _a === void 0 ? void 0 : _a.isAnonymous)) {
22064
+ if (start == this.p.lastBigReductionStart) {
22065
+ this.p.bigReductionCount++;
22066
+ this.p.lastBigReductionSize = size;
22067
+ }
22068
+ else if (this.p.lastBigReductionSize < size) {
22069
+ this.p.bigReductionCount = 1;
22070
+ this.p.lastBigReductionStart = start;
22071
+ this.p.lastBigReductionSize = size;
22072
+ }
22073
+ }
22074
+ let bufferBase = base ? this.stack[base - 1] : 0, count = this.bufferBase + this.buffer.length - bufferBase;
21940
22075
  // Store normal terms or `R -> R R` repeat reductions
21941
- if (type < parser.minRepeatTerm || (action & 131072 /* RepeatFlag */)) {
21942
- let pos = parser.stateFlag(this.state, 1 /* Skipped */) ? this.pos : this.reducePos;
22076
+ if (type < parser.minRepeatTerm || (action & 131072 /* Action.RepeatFlag */)) {
22077
+ let pos = parser.stateFlag(this.state, 1 /* StateFlag.Skipped */) ? this.pos : this.reducePos;
21943
22078
  this.storeNode(type, start, pos, count + 4, true);
21944
22079
  }
21945
- if (action & 262144 /* StayFlag */) {
22080
+ if (action & 262144 /* Action.StayFlag */) {
21946
22081
  this.state = this.stack[base];
21947
22082
  }
21948
22083
  else {
@@ -21956,7 +22091,7 @@
21956
22091
  // Shift a value into the buffer
21957
22092
  /// @internal
21958
22093
  storeNode(term, start, end, size = 4, isReduce = false) {
21959
- if (term == 0 /* Err */ &&
22094
+ if (term == 0 /* Term.Err */ &&
21960
22095
  (!this.stack.length || this.stack[this.stack.length - 1] < this.buffer.length + this.bufferBase)) {
21961
22096
  // Try to omit/merge adjacent error nodes
21962
22097
  let cur = this, top = this.buffer.length;
@@ -21964,7 +22099,7 @@
21964
22099
  top = cur.bufferBase - cur.parent.bufferBase;
21965
22100
  cur = cur.parent;
21966
22101
  }
21967
- if (top > 0 && cur.buffer[top - 4] == 0 /* Err */ && cur.buffer[top - 1] > -1) {
22102
+ if (top > 0 && cur.buffer[top - 4] == 0 /* Term.Err */ && cur.buffer[top - 1] > -1) {
21968
22103
  if (start == end)
21969
22104
  return;
21970
22105
  if (cur.buffer[top - 2] >= start) {
@@ -21978,7 +22113,7 @@
21978
22113
  }
21979
22114
  else { // There may be skipped nodes that have to be moved forward
21980
22115
  let index = this.buffer.length;
21981
- if (index > 0 && this.buffer[index - 4] != 0 /* Err */)
22116
+ if (index > 0 && this.buffer[index - 4] != 0 /* Term.Err */)
21982
22117
  while (index > 0 && this.buffer[index - 2] > end) {
21983
22118
  // Move this record forward
21984
22119
  this.buffer[index] = this.buffer[index - 4];
@@ -21999,14 +22134,14 @@
21999
22134
  /// @internal
22000
22135
  shift(action, next, nextEnd) {
22001
22136
  let start = this.pos;
22002
- if (action & 131072 /* GotoFlag */) {
22003
- this.pushState(action & 65535 /* ValueMask */, this.pos);
22137
+ if (action & 131072 /* Action.GotoFlag */) {
22138
+ this.pushState(action & 65535 /* Action.ValueMask */, this.pos);
22004
22139
  }
22005
- else if ((action & 262144 /* StayFlag */) == 0) { // Regular shift
22140
+ else if ((action & 262144 /* Action.StayFlag */) == 0) { // Regular shift
22006
22141
  let nextState = action, { parser } = this.p;
22007
22142
  if (nextEnd > this.pos || next <= parser.maxNode) {
22008
22143
  this.pos = nextEnd;
22009
- if (!parser.stateFlag(nextState, 1 /* Skipped */))
22144
+ if (!parser.stateFlag(nextState, 1 /* StateFlag.Skipped */))
22010
22145
  this.reducePos = nextEnd;
22011
22146
  }
22012
22147
  this.pushState(nextState, start);
@@ -22024,7 +22159,7 @@
22024
22159
  // Apply an action
22025
22160
  /// @internal
22026
22161
  apply(action, next, nextEnd) {
22027
- if (action & 65536 /* ReduceFlag */)
22162
+ if (action & 65536 /* Action.ReduceFlag */)
22028
22163
  this.reduce(action);
22029
22164
  else
22030
22165
  this.shift(action, next, nextEnd);
@@ -22069,9 +22204,9 @@
22069
22204
  let isNode = next <= this.p.parser.maxNode;
22070
22205
  if (isNode)
22071
22206
  this.storeNode(next, this.pos, nextEnd, 4);
22072
- this.storeNode(0 /* Err */, this.pos, nextEnd, isNode ? 8 : 4);
22207
+ this.storeNode(0 /* Term.Err */, this.pos, nextEnd, isNode ? 8 : 4);
22073
22208
  this.pos = this.reducePos = nextEnd;
22074
- this.score -= 190 /* Delete */;
22209
+ this.score -= 190 /* Recover.Delete */;
22075
22210
  }
22076
22211
  /// Check if the given term would be able to be shifted (optionally
22077
22212
  /// after some reductions) on this stack. This can be useful for
@@ -22079,10 +22214,10 @@
22079
22214
  /// given token when it applies.
22080
22215
  canShift(term) {
22081
22216
  for (let sim = new SimulatedStack(this);;) {
22082
- let action = this.p.parser.stateSlot(sim.state, 4 /* DefaultReduce */) || this.p.parser.hasAction(sim.state, term);
22217
+ let action = this.p.parser.stateSlot(sim.state, 4 /* ParseState.DefaultReduce */) || this.p.parser.hasAction(sim.state, term);
22083
22218
  if (action == 0)
22084
22219
  return false;
22085
- if ((action & 65536 /* ReduceFlag */) == 0)
22220
+ if ((action & 65536 /* Action.ReduceFlag */) == 0)
22086
22221
  return true;
22087
22222
  sim.reduce(action);
22088
22223
  }
@@ -22091,17 +22226,17 @@
22091
22226
  // inserts some missing token or rule.
22092
22227
  /// @internal
22093
22228
  recoverByInsert(next) {
22094
- if (this.stack.length >= 300 /* MaxInsertStackDepth */)
22229
+ if (this.stack.length >= 300 /* Recover.MaxInsertStackDepth */)
22095
22230
  return [];
22096
22231
  let nextStates = this.p.parser.nextStates(this.state);
22097
- if (nextStates.length > 4 /* MaxNext */ << 1 || this.stack.length >= 120 /* DampenInsertStackDepth */) {
22232
+ if (nextStates.length > 4 /* Recover.MaxNext */ << 1 || this.stack.length >= 120 /* Recover.DampenInsertStackDepth */) {
22098
22233
  let best = [];
22099
22234
  for (let i = 0, s; i < nextStates.length; i += 2) {
22100
22235
  if ((s = nextStates[i + 1]) != this.state && this.p.parser.hasAction(s, next))
22101
22236
  best.push(nextStates[i], s);
22102
22237
  }
22103
- if (this.stack.length < 120 /* DampenInsertStackDepth */)
22104
- for (let i = 0; best.length < 4 /* MaxNext */ << 1 && i < nextStates.length; i += 2) {
22238
+ if (this.stack.length < 120 /* Recover.DampenInsertStackDepth */)
22239
+ for (let i = 0; best.length < 4 /* Recover.MaxNext */ << 1 && i < nextStates.length; i += 2) {
22105
22240
  let s = nextStates[i + 1];
22106
22241
  if (!best.some((v, i) => (i & 1) && v == s))
22107
22242
  best.push(nextStates[i], s);
@@ -22109,15 +22244,15 @@
22109
22244
  nextStates = best;
22110
22245
  }
22111
22246
  let result = [];
22112
- for (let i = 0; i < nextStates.length && result.length < 4 /* MaxNext */; i += 2) {
22247
+ for (let i = 0; i < nextStates.length && result.length < 4 /* Recover.MaxNext */; i += 2) {
22113
22248
  let s = nextStates[i + 1];
22114
22249
  if (s == this.state)
22115
22250
  continue;
22116
22251
  let stack = this.split();
22117
22252
  stack.pushState(s, this.pos);
22118
- stack.storeNode(0 /* Err */, stack.pos, stack.pos, 4, true);
22253
+ stack.storeNode(0 /* Term.Err */, stack.pos, stack.pos, 4, true);
22119
22254
  stack.shiftContext(nextStates[i], this.pos);
22120
- stack.score -= 200 /* Insert */;
22255
+ stack.score -= 200 /* Recover.Insert */;
22121
22256
  result.push(stack);
22122
22257
  }
22123
22258
  return result;
@@ -22126,17 +22261,17 @@
22126
22261
  // be done.
22127
22262
  /// @internal
22128
22263
  forceReduce() {
22129
- let reduce = this.p.parser.stateSlot(this.state, 5 /* ForcedReduce */);
22130
- if ((reduce & 65536 /* ReduceFlag */) == 0)
22264
+ let reduce = this.p.parser.stateSlot(this.state, 5 /* ParseState.ForcedReduce */);
22265
+ if ((reduce & 65536 /* Action.ReduceFlag */) == 0)
22131
22266
  return false;
22132
22267
  let { parser } = this.p;
22133
22268
  if (!parser.validAction(this.state, reduce)) {
22134
- let depth = reduce >> 19 /* ReduceDepthShift */, term = reduce & 65535 /* ValueMask */;
22269
+ let depth = reduce >> 19 /* Action.ReduceDepthShift */, term = reduce & 65535 /* Action.ValueMask */;
22135
22270
  let target = this.stack.length - depth * 3;
22136
22271
  if (target < 0 || parser.getGoto(this.stack[target], term, false) < 0)
22137
22272
  return false;
22138
- this.storeNode(0 /* Err */, this.reducePos, this.reducePos, 4, true);
22139
- this.score -= 100 /* Reduce */;
22273
+ this.storeNode(0 /* Term.Err */, this.reducePos, this.reducePos, 4, true);
22274
+ this.score -= 100 /* Recover.Reduce */;
22140
22275
  }
22141
22276
  this.reducePos = this.pos;
22142
22277
  this.reduce(reduce);
@@ -22144,9 +22279,9 @@
22144
22279
  }
22145
22280
  /// @internal
22146
22281
  forceAll() {
22147
- while (!this.p.parser.stateFlag(this.state, 2 /* Accepting */)) {
22282
+ while (!this.p.parser.stateFlag(this.state, 2 /* StateFlag.Accepting */)) {
22148
22283
  if (!this.forceReduce()) {
22149
- this.storeNode(0 /* Err */, this.pos, this.pos, 4, true);
22284
+ this.storeNode(0 /* Term.Err */, this.pos, this.pos, 4, true);
22150
22285
  break;
22151
22286
  }
22152
22287
  }
@@ -22159,8 +22294,8 @@
22159
22294
  if (this.stack.length != 3)
22160
22295
  return false;
22161
22296
  let { parser } = this.p;
22162
- return parser.data[parser.stateSlot(this.state, 1 /* Actions */)] == 65535 /* End */ &&
22163
- !parser.stateSlot(this.state, 4 /* DefaultReduce */);
22297
+ return parser.data[parser.stateSlot(this.state, 1 /* ParseState.Actions */)] == 65535 /* Seq.End */ &&
22298
+ !parser.stateSlot(this.state, 4 /* ParseState.DefaultReduce */);
22164
22299
  }
22165
22300
  /// Restart the stack (put it back in its start state). Only safe
22166
22301
  /// when this.stack.length == 3 (state is directly below the top
@@ -22241,6 +22376,7 @@
22241
22376
  Recover[Recover["MaxNext"] = 4] = "MaxNext";
22242
22377
  Recover[Recover["MaxInsertStackDepth"] = 300] = "MaxInsertStackDepth";
22243
22378
  Recover[Recover["DampenInsertStackDepth"] = 120] = "DampenInsertStackDepth";
22379
+ Recover[Recover["MinBigReduction"] = 2000] = "MinBigReduction";
22244
22380
  })(Recover || (Recover = {}));
22245
22381
  // Used to cheaply run some reductions to scan ahead without mutating
22246
22382
  // an entire stack
@@ -22252,7 +22388,7 @@
22252
22388
  this.base = this.stack.length;
22253
22389
  }
22254
22390
  reduce(action) {
22255
- let term = action & 65535 /* ValueMask */, depth = action >> 19 /* ReduceDepthShift */;
22391
+ let term = action & 65535 /* Action.ValueMask */, depth = action >> 19 /* Action.ReduceDepthShift */;
22256
22392
  if (depth == 0) {
22257
22393
  if (this.stack == this.start.stack)
22258
22394
  this.stack = this.stack.slice();
@@ -22303,6 +22439,42 @@
22303
22439
  }
22304
22440
  }
22305
22441
 
22442
+ // See lezer-generator/src/encode.ts for comments about the encoding
22443
+ // used here
22444
+ function decodeArray(input, Type = Uint16Array) {
22445
+ if (typeof input != "string")
22446
+ return input;
22447
+ let array = null;
22448
+ for (let pos = 0, out = 0; pos < input.length;) {
22449
+ let value = 0;
22450
+ for (;;) {
22451
+ let next = input.charCodeAt(pos++), stop = false;
22452
+ if (next == 126 /* Encode.BigValCode */) {
22453
+ value = 65535 /* Encode.BigVal */;
22454
+ break;
22455
+ }
22456
+ if (next >= 92 /* Encode.Gap2 */)
22457
+ next--;
22458
+ if (next >= 34 /* Encode.Gap1 */)
22459
+ next--;
22460
+ let digit = next - 32 /* Encode.Start */;
22461
+ if (digit >= 46 /* Encode.Base */) {
22462
+ digit -= 46 /* Encode.Base */;
22463
+ stop = true;
22464
+ }
22465
+ value += digit;
22466
+ if (stop)
22467
+ break;
22468
+ value *= 46 /* Encode.Base */;
22469
+ }
22470
+ if (array)
22471
+ array[out++] = value;
22472
+ else
22473
+ array = new Type(value);
22474
+ }
22475
+ return array;
22476
+ }
22477
+
22306
22478
  class CachedToken {
22307
22479
  constructor() {
22308
22480
  this.start = -1;
@@ -22527,9 +22699,13 @@
22527
22699
  this.data = data;
22528
22700
  this.id = id;
22529
22701
  }
22530
- token(input, stack) { readToken(this.data, input, stack, this.id); }
22702
+ token(input, stack) {
22703
+ let { parser } = stack.p;
22704
+ readToken(this.data, input, stack, this.id, parser.data, parser.tokenPrecTable);
22705
+ }
22531
22706
  }
22532
22707
  TokenGroup.prototype.contextual = TokenGroup.prototype.fallback = TokenGroup.prototype.extend = false;
22708
+ TokenGroup.prototype.fallback = TokenGroup.prototype.extend = false;
22533
22709
  /// `@external tokens` declarations in the grammar should resolve to
22534
22710
  /// an instance of this class.
22535
22711
  class ExternalTokenizer {
@@ -22567,8 +22743,8 @@
22567
22743
  // This function interprets that data, running through a stream as
22568
22744
  // long as new states with the a matching group mask can be reached,
22569
22745
  // and updating `input.token` when it matches a token.
22570
- function readToken(data, input, stack, group) {
22571
- let state = 0, groupMask = 1 << group, { parser } = stack.p, { dialect } = parser;
22746
+ function readToken(data, input, stack, group, precTable, precOffset) {
22747
+ let state = 0, groupMask = 1 << group, { dialect } = stack.p.parser;
22572
22748
  scan: for (;;) {
22573
22749
  if ((groupMask & data[state]) == 0)
22574
22750
  break;
@@ -22580,14 +22756,15 @@
22580
22756
  if ((data[i + 1] & groupMask) > 0) {
22581
22757
  let term = data[i];
22582
22758
  if (dialect.allows(term) &&
22583
- (input.token.value == -1 || input.token.value == term || parser.overrides(term, input.token.value))) {
22759
+ (input.token.value == -1 || input.token.value == term ||
22760
+ overrides(term, input.token.value, precTable, precOffset))) {
22584
22761
  input.acceptToken(term);
22585
22762
  break;
22586
22763
  }
22587
22764
  }
22588
22765
  let next = input.next, low = 0, high = data[state + 2];
22589
22766
  // Special case for EOF
22590
- if (input.next < 0 && high > low && data[accEnd + high * 3 - 3] == 65535 /* End */ && data[accEnd + high * 3 - 3] == 65535 /* End */) {
22767
+ if (input.next < 0 && high > low && data[accEnd + high * 3 - 3] == 65535 /* Seq.End */ && data[accEnd + high * 3 - 3] == 65535 /* Seq.End */) {
22591
22768
  state = data[accEnd + high * 3 - 1];
22592
22769
  continue scan;
22593
22770
  }
@@ -22609,41 +22786,15 @@
22609
22786
  break;
22610
22787
  }
22611
22788
  }
22612
-
22613
- // See lezer-generator/src/encode.ts for comments about the encoding
22614
- // used here
22615
- function decodeArray(input, Type = Uint16Array) {
22616
- if (typeof input != "string")
22617
- return input;
22618
- let array = null;
22619
- for (let pos = 0, out = 0; pos < input.length;) {
22620
- let value = 0;
22621
- for (;;) {
22622
- let next = input.charCodeAt(pos++), stop = false;
22623
- if (next == 126 /* BigValCode */) {
22624
- value = 65535 /* BigVal */;
22625
- break;
22626
- }
22627
- if (next >= 92 /* Gap2 */)
22628
- next--;
22629
- if (next >= 34 /* Gap1 */)
22630
- next--;
22631
- let digit = next - 32 /* Start */;
22632
- if (digit >= 46 /* Base */) {
22633
- digit -= 46 /* Base */;
22634
- stop = true;
22635
- }
22636
- value += digit;
22637
- if (stop)
22638
- break;
22639
- value *= 46 /* Base */;
22640
- }
22641
- if (array)
22642
- array[out++] = value;
22643
- else
22644
- array = new Type(value);
22645
- }
22646
- return array;
22789
+ function findOffset(data, start, term) {
22790
+ for (let i = start, next; (next = data[i]) != 65535 /* Seq.End */; i++)
22791
+ if (next == term)
22792
+ return i - start;
22793
+ return -1;
22794
+ }
22795
+ function overrides(token, prev, tableData, tableOffset) {
22796
+ let iPrev = findOffset(tableData, tableOffset, prev);
22797
+ return iPrev < 0 || findOffset(tableData, tableOffset, token) < iPrev;
22647
22798
  }
22648
22799
 
22649
22800
  // Environment variable used to control console output
@@ -22660,8 +22811,8 @@
22660
22811
  if (!(side < 0 ? cursor.childBefore(pos) : cursor.childAfter(pos)))
22661
22812
  for (;;) {
22662
22813
  if ((side < 0 ? cursor.to < pos : cursor.from > pos) && !cursor.type.isError)
22663
- return side < 0 ? Math.max(0, Math.min(cursor.to - 1, pos - 25 /* Margin */))
22664
- : Math.min(tree.length, Math.max(cursor.from + 1, pos + 25 /* Margin */));
22814
+ return side < 0 ? Math.max(0, Math.min(cursor.to - 1, pos - 25 /* Safety.Margin */))
22815
+ : Math.min(tree.length, Math.max(cursor.from + 1, pos + 25 /* Safety.Margin */));
22665
22816
  if (side < 0 ? cursor.prevSibling() : cursor.nextSibling())
22666
22817
  break;
22667
22818
  if (!cursor.parent())
@@ -22765,7 +22916,7 @@
22765
22916
  let actionIndex = 0;
22766
22917
  let main = null;
22767
22918
  let { parser } = stack.p, { tokenizers } = parser;
22768
- let mask = parser.stateSlot(stack.state, 3 /* TokenizerMask */);
22919
+ let mask = parser.stateSlot(stack.state, 3 /* ParseState.TokenizerMask */);
22769
22920
  let context = stack.curContext ? stack.curContext.hash : 0;
22770
22921
  let lookAhead = 0;
22771
22922
  for (let i = 0; i < tokenizers.length; i++) {
@@ -22779,9 +22930,9 @@
22779
22930
  token.mask = mask;
22780
22931
  token.context = context;
22781
22932
  }
22782
- if (token.lookAhead > token.end + 25 /* Margin */)
22933
+ if (token.lookAhead > token.end + 25 /* Safety.Margin */)
22783
22934
  lookAhead = Math.max(token.lookAhead, lookAhead);
22784
- if (token.value != 0 /* Err */) {
22935
+ if (token.value != 0 /* Term.Err */) {
22785
22936
  let startIndex = actionIndex;
22786
22937
  if (token.extended > -1)
22787
22938
  actionIndex = this.addActions(stack, token.extended, token.end, actionIndex);
@@ -22812,7 +22963,7 @@
22812
22963
  let main = new CachedToken, { pos, p } = stack;
22813
22964
  main.start = pos;
22814
22965
  main.end = Math.min(pos + 1, p.stream.end);
22815
- main.value = pos == p.stream.end ? p.parser.eofTerm : 0 /* Err */;
22966
+ main.value = pos == p.stream.end ? p.parser.eofTerm : 0 /* Term.Err */;
22816
22967
  return main;
22817
22968
  }
22818
22969
  updateCachedToken(token, tokenizer, stack) {
@@ -22824,7 +22975,7 @@
22824
22975
  if (parser.specialized[i] == token.value) {
22825
22976
  let result = parser.specializers[i](this.stream.read(token.start, token.end), stack);
22826
22977
  if (result >= 0 && stack.p.parser.dialect.allows(result >> 1)) {
22827
- if ((result & 1) == 0 /* Specialize */)
22978
+ if ((result & 1) == 0 /* Specialize.Specialize */)
22828
22979
  token.value = result >> 1;
22829
22980
  else
22830
22981
  token.extended = result >> 1;
@@ -22833,7 +22984,7 @@
22833
22984
  }
22834
22985
  }
22835
22986
  else {
22836
- token.value = 0 /* Err */;
22987
+ token.value = 0 /* Term.Err */;
22837
22988
  token.end = this.stream.clipPos(start + 1);
22838
22989
  }
22839
22990
  }
@@ -22850,13 +23001,13 @@
22850
23001
  addActions(stack, token, end, index) {
22851
23002
  let { state } = stack, { parser } = stack.p, { data } = parser;
22852
23003
  for (let set = 0; set < 2; set++) {
22853
- for (let i = parser.stateSlot(state, set ? 2 /* Skip */ : 1 /* Actions */);; i += 3) {
22854
- if (data[i] == 65535 /* End */) {
22855
- if (data[i + 1] == 1 /* Next */) {
23004
+ for (let i = parser.stateSlot(state, set ? 2 /* ParseState.Skip */ : 1 /* ParseState.Actions */);; i += 3) {
23005
+ if (data[i] == 65535 /* Seq.End */) {
23006
+ if (data[i + 1] == 1 /* Seq.Next */) {
22856
23007
  i = pair(data, i + 2);
22857
23008
  }
22858
23009
  else {
22859
- if (index == 0 && data[i + 1] == 2 /* Other */)
23010
+ if (index == 0 && data[i + 1] == 2 /* Seq.Other */)
22860
23011
  index = this.putAction(pair(data, i + 2), token, end, index);
22861
23012
  break;
22862
23013
  }
@@ -22881,6 +23032,11 @@
22881
23032
  // on recursive traversal.
22882
23033
  Rec[Rec["CutDepth"] = 15000] = "CutDepth";
22883
23034
  Rec[Rec["CutTo"] = 9000] = "CutTo";
23035
+ Rec[Rec["MaxLeftAssociativeReductionCount"] = 300] = "MaxLeftAssociativeReductionCount";
23036
+ // The maximum number of non-recovering stacks to explore (to avoid
23037
+ // getting bogged down with exponentially multiplying stacks in
23038
+ // ambiguous content)
23039
+ Rec[Rec["MaxStackCount"] = 12] = "MaxStackCount";
22884
23040
  })(Rec || (Rec = {}));
22885
23041
  class Parse {
22886
23042
  constructor(parser, input, fragments, ranges) {
@@ -22892,6 +23048,9 @@
22892
23048
  this.minStackPos = 0;
22893
23049
  this.reused = [];
22894
23050
  this.stoppedAt = null;
23051
+ this.lastBigReductionStart = -1;
23052
+ this.lastBigReductionSize = 0;
23053
+ this.bigReductionCount = 0;
22895
23054
  this.stream = new InputStream(input, ranges);
22896
23055
  this.tokens = new TokenCache(parser, this.stream);
22897
23056
  this.topTerm = parser.top[1];
@@ -22914,6 +23073,18 @@
22914
23073
  // This will hold stacks beyond `pos`.
22915
23074
  let newStacks = this.stacks = [];
22916
23075
  let stopped, stoppedTokens;
23076
+ // If a large amount of reductions happened with the same start
23077
+ // position, force the stack out of that production in order to
23078
+ // avoid creating a tree too deep to recurse through.
23079
+ // (This is an ugly kludge, because unfortunately there is no
23080
+ // straightforward, cheap way to check for this happening, due to
23081
+ // the history of reductions only being available in an
23082
+ // expensive-to-access format in the stack buffers.)
23083
+ if (this.bigReductionCount > 300 /* Rec.MaxLeftAssociativeReductionCount */ && stacks.length == 1) {
23084
+ let [s] = stacks;
23085
+ while (s.forceReduce() && s.stack.length && s.stack[s.stack.length - 2] >= this.lastBigReductionStart) { }
23086
+ this.bigReductionCount = this.lastBigReductionSize = 0;
23087
+ }
22917
23088
  // Keep advancing any stacks at `pos` until they either move
22918
23089
  // forward or can't be advanced. Gather stacks that can't be
22919
23090
  // advanced further in `stopped`.
@@ -22949,7 +23120,7 @@
22949
23120
  throw new SyntaxError("No parse at " + pos);
22950
23121
  }
22951
23122
  if (!this.recovering)
22952
- this.recovering = 5 /* Distance */;
23123
+ this.recovering = 5 /* Rec.Distance */;
22953
23124
  }
22954
23125
  if (this.recovering && stopped) {
22955
23126
  let finished = this.stoppedAt != null && stopped[0].pos > this.stoppedAt ? stopped[0]
@@ -22958,7 +23129,7 @@
22958
23129
  return this.stackToTree(finished.forceAll());
22959
23130
  }
22960
23131
  if (this.recovering) {
22961
- let maxRemaining = this.recovering == 1 ? 1 : this.recovering * 3 /* MaxRemainingPerStep */;
23132
+ let maxRemaining = this.recovering == 1 ? 1 : this.recovering * 3 /* Rec.MaxRemainingPerStep */;
22962
23133
  if (newStacks.length > maxRemaining) {
22963
23134
  newStacks.sort((a, b) => b.score - a.score);
22964
23135
  while (newStacks.length > maxRemaining)
@@ -22976,7 +23147,7 @@
22976
23147
  for (let j = i + 1; j < newStacks.length; j++) {
22977
23148
  let other = newStacks[j];
22978
23149
  if (stack.sameState(other) ||
22979
- stack.buffer.length > 500 /* MinBufferLengthPrune */ && other.buffer.length > 500 /* MinBufferLengthPrune */) {
23150
+ stack.buffer.length > 500 /* Rec.MinBufferLengthPrune */ && other.buffer.length > 500 /* Rec.MinBufferLengthPrune */) {
22980
23151
  if (((stack.score - other.score) || (stack.buffer.length - other.buffer.length)) > 0) {
22981
23152
  newStacks.splice(j--, 1);
22982
23153
  }
@@ -22987,6 +23158,8 @@
22987
23158
  }
22988
23159
  }
22989
23160
  }
23161
+ if (newStacks.length > 12 /* Rec.MaxStackCount */)
23162
+ newStacks.splice(12 /* Rec.MaxStackCount */, newStacks.length - 12 /* Rec.MaxStackCount */);
22990
23163
  }
22991
23164
  this.minStackPos = newStacks[0].pos;
22992
23165
  for (let i = 1; i < newStacks.length; i++)
@@ -23027,15 +23200,15 @@
23027
23200
  break;
23028
23201
  }
23029
23202
  }
23030
- let defaultReduce = parser.stateSlot(stack.state, 4 /* DefaultReduce */);
23203
+ let defaultReduce = parser.stateSlot(stack.state, 4 /* ParseState.DefaultReduce */);
23031
23204
  if (defaultReduce > 0) {
23032
23205
  stack.reduce(defaultReduce);
23033
23206
  if (verbose)
23034
- console.log(base + this.stackID(stack) + ` (via always-reduce ${parser.getName(defaultReduce & 65535 /* ValueMask */)})`);
23207
+ console.log(base + this.stackID(stack) + ` (via always-reduce ${parser.getName(defaultReduce & 65535 /* Action.ValueMask */)})`);
23035
23208
  return true;
23036
23209
  }
23037
- if (stack.stack.length >= 15000 /* CutDepth */) {
23038
- while (stack.stack.length > 9000 /* CutTo */ && stack.forceReduce()) { }
23210
+ if (stack.stack.length >= 15000 /* Rec.CutDepth */) {
23211
+ while (stack.stack.length > 9000 /* Rec.CutTo */ && stack.forceReduce()) { }
23039
23212
  }
23040
23213
  let actions = this.tokens.getActions(stack);
23041
23214
  for (let i = 0; i < actions.length;) {
@@ -23044,8 +23217,8 @@
23044
23217
  let localStack = last ? stack : stack.split();
23045
23218
  localStack.apply(action, term, end);
23046
23219
  if (verbose)
23047
- console.log(base + this.stackID(localStack) + ` (via ${(action & 65536 /* ReduceFlag */) == 0 ? "shift"
23048
- : `reduce of ${parser.getName(action & 65535 /* ValueMask */)}`} for ${parser.getName(term)} @ ${start}${localStack == stack ? "" : ", split"})`);
23220
+ console.log(base + this.stackID(localStack) + ` (via ${(action & 65536 /* Action.ReduceFlag */) == 0 ? "shift"
23221
+ : `reduce of ${parser.getName(action & 65535 /* Action.ValueMask */)}`} for ${parser.getName(term)} @ ${start}${localStack == stack ? "" : ", split"})`);
23049
23222
  if (last)
23050
23223
  return true;
23051
23224
  else if (localStack.pos > start)
@@ -23086,7 +23259,7 @@
23086
23259
  continue;
23087
23260
  }
23088
23261
  let force = stack.split(), forceBase = base;
23089
- for (let j = 0; force.forceReduce() && j < 10 /* ForceReduceLimit */; j++) {
23262
+ for (let j = 0; force.forceReduce() && j < 10 /* Rec.ForceReduceLimit */; j++) {
23090
23263
  if (verbose)
23091
23264
  console.log(forceBase + this.stackID(force) + " (via force-reduce)");
23092
23265
  let done = this.advanceFully(force, newStacks);
@@ -23103,7 +23276,7 @@
23103
23276
  if (this.stream.end > stack.pos) {
23104
23277
  if (tokenEnd == stack.pos) {
23105
23278
  tokenEnd++;
23106
- token = 0 /* Err */;
23279
+ token = 0 /* Term.Err */;
23107
23280
  }
23108
23281
  stack.recoverByDelete(token, tokenEnd);
23109
23282
  if (verbose)
@@ -23163,8 +23336,8 @@
23163
23336
  super();
23164
23337
  /// @internal
23165
23338
  this.wrappers = [];
23166
- if (spec.version != 14 /* Version */)
23167
- throw new RangeError(`Parser version (${spec.version}) doesn't match runtime version (${14 /* Version */})`);
23339
+ if (spec.version != 14 /* File.Version */)
23340
+ throw new RangeError(`Parser version (${spec.version}) doesn't match runtime version (${14 /* File.Version */})`);
23168
23341
  let nodeNames = spec.nodeNames.split(" ");
23169
23342
  this.minRepeatTerm = nodeNames.length;
23170
23343
  for (let i = 0; i < spec.repeatNodeCount; i++)
@@ -23254,16 +23427,16 @@
23254
23427
  hasAction(state, terminal) {
23255
23428
  let data = this.data;
23256
23429
  for (let set = 0; set < 2; set++) {
23257
- for (let i = this.stateSlot(state, set ? 2 /* Skip */ : 1 /* Actions */), next;; i += 3) {
23258
- if ((next = data[i]) == 65535 /* End */) {
23259
- if (data[i + 1] == 1 /* Next */)
23430
+ for (let i = this.stateSlot(state, set ? 2 /* ParseState.Skip */ : 1 /* ParseState.Actions */), next;; i += 3) {
23431
+ if ((next = data[i]) == 65535 /* Seq.End */) {
23432
+ if (data[i + 1] == 1 /* Seq.Next */)
23260
23433
  next = data[i = pair(data, i + 2)];
23261
- else if (data[i + 1] == 2 /* Other */)
23434
+ else if (data[i + 1] == 2 /* Seq.Other */)
23262
23435
  return pair(data, i + 2);
23263
23436
  else
23264
23437
  break;
23265
23438
  }
23266
- if (next == terminal || next == 0 /* Err */)
23439
+ if (next == terminal || next == 0 /* Term.Err */)
23267
23440
  return pair(data, i + 1);
23268
23441
  }
23269
23442
  }
@@ -23271,19 +23444,19 @@
23271
23444
  }
23272
23445
  /// @internal
23273
23446
  stateSlot(state, slot) {
23274
- return this.states[(state * 6 /* Size */) + slot];
23447
+ return this.states[(state * 6 /* ParseState.Size */) + slot];
23275
23448
  }
23276
23449
  /// @internal
23277
23450
  stateFlag(state, flag) {
23278
- return (this.stateSlot(state, 0 /* Flags */) & flag) > 0;
23451
+ return (this.stateSlot(state, 0 /* ParseState.Flags */) & flag) > 0;
23279
23452
  }
23280
23453
  /// @internal
23281
23454
  validAction(state, action) {
23282
- if (action == this.stateSlot(state, 4 /* DefaultReduce */))
23455
+ if (action == this.stateSlot(state, 4 /* ParseState.DefaultReduce */))
23283
23456
  return true;
23284
- for (let i = this.stateSlot(state, 1 /* Actions */);; i += 3) {
23285
- if (this.data[i] == 65535 /* End */) {
23286
- if (this.data[i + 1] == 1 /* Next */)
23457
+ for (let i = this.stateSlot(state, 1 /* ParseState.Actions */);; i += 3) {
23458
+ if (this.data[i] == 65535 /* Seq.End */) {
23459
+ if (this.data[i + 1] == 1 /* Seq.Next */)
23287
23460
  i = pair(this.data, i + 2);
23288
23461
  else
23289
23462
  return false;
@@ -23296,14 +23469,14 @@
23296
23469
  /// goto jumps. @internal
23297
23470
  nextStates(state) {
23298
23471
  let result = [];
23299
- for (let i = this.stateSlot(state, 1 /* Actions */);; i += 3) {
23300
- if (this.data[i] == 65535 /* End */) {
23301
- if (this.data[i + 1] == 1 /* Next */)
23472
+ for (let i = this.stateSlot(state, 1 /* ParseState.Actions */);; i += 3) {
23473
+ if (this.data[i] == 65535 /* Seq.End */) {
23474
+ if (this.data[i + 1] == 1 /* Seq.Next */)
23302
23475
  i = pair(this.data, i + 2);
23303
23476
  else
23304
23477
  break;
23305
23478
  }
23306
- if ((this.data[i + 2] & (65536 /* ReduceFlag */ >> 16)) == 0) {
23479
+ if ((this.data[i + 2] & (65536 /* Action.ReduceFlag */ >> 16)) == 0) {
23307
23480
  let value = this.data[i + 1];
23308
23481
  if (!result.some((v, i) => (i & 1) && v == value))
23309
23482
  result.push(this.data[i], value);
@@ -23311,11 +23484,6 @@
23311
23484
  }
23312
23485
  return result;
23313
23486
  }
23314
- /// @internal
23315
- overrides(token, prev) {
23316
- let iPrev = findOffset(this.data, this.tokenPrecTable, prev);
23317
- return iPrev < 0 || findOffset(this.data, this.tokenPrecTable, token) < iPrev;
23318
- }
23319
23487
  /// Configure the parser. Returns a new parser instance that has the
23320
23488
  /// given settings modified. Settings not provided in `config` are
23321
23489
  /// kept from the original parser.
@@ -23393,30 +23561,24 @@
23393
23561
  let disabled = null;
23394
23562
  for (let i = 0; i < values.length; i++)
23395
23563
  if (!flags[i]) {
23396
- for (let j = this.dialects[values[i]], id; (id = this.data[j++]) != 65535 /* End */;)
23564
+ for (let j = this.dialects[values[i]], id; (id = this.data[j++]) != 65535 /* Seq.End */;)
23397
23565
  (disabled || (disabled = new Uint8Array(this.maxTerm + 1)))[id] = 1;
23398
23566
  }
23399
23567
  return new Dialect(dialect, flags, disabled);
23400
23568
  }
23401
23569
  /// Used by the output of the parser generator. Not available to
23402
- /// user code.
23570
+ /// user code. @hide
23403
23571
  static deserialize(spec) {
23404
23572
  return new LRParser(spec);
23405
23573
  }
23406
23574
  }
23407
23575
  function pair(data, off) { return data[off] | (data[off + 1] << 16); }
23408
- function findOffset(data, start, term) {
23409
- for (let i = start, next; (next = data[i]) != 65535 /* End */; i++)
23410
- if (next == term)
23411
- return i - start;
23412
- return -1;
23413
- }
23414
23576
  function findFinished(stacks) {
23415
23577
  let best = null;
23416
23578
  for (let stack of stacks) {
23417
23579
  let stopped = stack.p.stoppedAt;
23418
23580
  if ((stack.pos == stack.p.stream.end || stopped != null && stack.pos > stopped) &&
23419
- stack.p.parser.stateFlag(stack.state, 2 /* Accepting */) &&
23581
+ stack.p.parser.stateFlag(stack.state, 2 /* StateFlag.Accepting */) &&
23420
23582
  (!best || best.score < stack.score))
23421
23583
  best = stack;
23422
23584
  }
@@ -23424,7 +23586,7 @@
23424
23586
  }
23425
23587
  function getSpecializer(spec) {
23426
23588
  if (spec.external) {
23427
- let mask = spec.extend ? 1 /* Extend */ : 0 /* Specialize */;
23589
+ let mask = spec.extend ? 1 /* Specialize.Extend */ : 0 /* Specialize.Specialize */;
23428
23590
  return (value, stack) => (spec.external(value, stack) << 1) | mask;
23429
23591
  }
23430
23592
  return spec.get;
@@ -23749,7 +23911,7 @@
23749
23911
  states: "%vQ]QQOOO#wQRO'#DSO$OQQO'#CwO%eQQO'#CxO%lQQO'#CyO%sQQO'#CzOOQQ'#DS'#DSOOQQ'#C}'#C}O'UQRO'#C{OOQQ'#Cv'#CvOOQQ'#C|'#C|Q]QQOOQOQQOOO'`QQO'#DOO(xQRO,59cO)PQQO,59cO)UQQO'#DSOOQQ,59d,59dO)cQQO,59dOOQQ,59e,59eO)jQQO,59eOOQQ,59f,59fO)qQQO,59fOOQQ-E6{-E6{OOQQ,59b,59bOOQQ-E6z-E6zOOQQ,59j,59jOOQQ-E6|-E6|O+VQRO1G.}O+^QQO,59cOOQQ1G/O1G/OOOQQ1G/P1G/POOQQ1G/Q1G/QP+kQQO'#C}O+rQQO1G.}O)PQQO,59cO,PQQO'#Cw",
23750
23912
  stateData: ",[~OtOSPOSQOS~ORUOSUOTUOUUOVROXSOZTO]XO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O^]ORvXSvXTvXUvXVvXXvXZvX]vX_vX`vXavXbvXcvXdvXevXfvXgvXhvX~OsvX~P!jOa_Ob_Oc_O~ORUOSUOTUOUUOVROXSOZTO^tO_UO`UOa`Ob`Oc`OdUOeUOfUOgUOhUO~OWaO~P$ZOYcO~P$ZO[eO~P$ZORUOSUOTUOUUOVROXSOZTO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O]hOsoX~P%zOajObjOcjO~O^]ORkaSkaTkaUkaVkaXkaZka]ka_ka`kaakabkackadkaekafkagkahka~Oska~P'kO^]O~OWvXYvX[vX~P!jOWnO~P$ZOYoO~P$ZO[pO~P$ZO^]ORkiSkiTkiUkiVkiXkiZki]ki_ki`kiakibkickidkiekifkigkihki~Oski~P)xOWkaYka[ka~P'kO]hO~P$ZOWkiYki[ki~P)xOasObsOcsO~O",
23751
23913
  goto: "#hwPPPPPPPPPPPPPPPPPPPPPPPPPPx||||!Y!^!d!xPPP#[TYOZeUORSTWZbdfqT[OZQZORiZSWOZQbRQdSQfTZgWbdfqQ^PWk^lmrQl_Qm`RrseVORSTWZbdfq",
23752
- nodeNames: "⚠ LineComment BlockComment String Number Bool Null ( ) [ ] { } ; . Operator Punctuation SpecialVar Identifier QuotedIdentifier Keyword Type Bits Bytes Builtin Script Statement CompositeIdentifier Parens Braces Brackets Statement",
23914
+ nodeNames: "⚠ LineComment BlockComment String Number Bool Null ( ) { } [ ] ; . Operator Punctuation SpecialVar Identifier QuotedIdentifier Keyword Type Bits Bytes Builtin Script Statement CompositeIdentifier Parens Braces Brackets Statement",
23753
23915
  maxTerm: 38,
23754
23916
  skippedNodes: [0,1,2],
23755
23917
  repeatNodeCount: 3,
@@ -23863,7 +24025,7 @@
23863
24025
  return this.children ? Object.keys(this.children).filter(x => x).map(name => ({ label: name, type })) : [];
23864
24026
  }
23865
24027
  }
23866
- function completeFromSchema(schema, tables, defaultTableName, defaultSchemaName) {
24028
+ function completeFromSchema(schema, tables, schemas, defaultTableName, defaultSchemaName) {
23867
24029
  let top = new CompletionLevel;
23868
24030
  let defaultSchema = top.child(defaultSchemaName || "");
23869
24031
  for (let table in schema) {
@@ -23879,7 +24041,7 @@
23879
24041
  if (!schema.list.length)
23880
24042
  schema.list = schema.childCompletions("type");
23881
24043
  }
23882
- top.list = defaultSchema.list.concat(top.childCompletions("type"));
24044
+ top.list = defaultSchema.list.concat(schemas || top.childCompletions("type"));
23883
24045
  return (context) => {
23884
24046
  let { parents, from, quoted, empty, aliases } = sourceContext(context.state, context.pos);
23885
24047
  if (empty && !context.explicit)
@@ -24001,7 +24163,7 @@
24001
24163
  for the given configuration.
24002
24164
  */
24003
24165
  function schemaCompletionSource(config) {
24004
- return config.schema ? completeFromSchema(config.schema, config.tables, config.defaultTable, config.defaultSchema)
24166
+ return config.schema ? completeFromSchema(config.schema, config.tables, config.schemas, config.defaultTable, config.defaultSchema)
24005
24167
  : () => null;
24006
24168
  }
24007
24169
  const MySQLKeywords = "accessible algorithm analyze asensitive authors auto_increment autocommit avg avg_row_length binlog btree cache catalog_name chain change changed checkpoint checksum class_origin client_statistics coalesce code collations columns comment committed completion concurrent consistent contains contributors convert database databases day_hour day_microsecond day_minute day_second delay_key_write delayed delimiter des_key_file dev_pop dev_samp deviance directory disable discard distinctrow div dual dumpfile enable enclosed ends engine engines enum errors escaped even event events every explain extended fast field fields flush force found_rows fulltext grants handler hash high_priority hosts hour_microsecond hour_minute hour_second ignore ignore_server_ids import index index_statistics infile innodb insensitive insert_method install invoker iterate keys kill linear lines list load lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modify mutex mysql_errno no_write_to_binlog offline offset one online optimize optionally outfile pack_keys parser partition partitions password phase plugin plugins prev processlist profile profiles purge query quick range read_write rebuild recover regexp relaylog remove rename reorganize repair repeatable replace require resume rlike row_format rtree schedule schema_name schemas second_microsecond security sensitive separator serializable server share show slave slow snapshot soname spatial sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result ssl starting starts std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace terminated triggers truncate uncommitted uninstall unlock upgrade use use_frm user_resources user_statistics utc_date utc_time utc_timestamp variables views warnings xa xor year_month zerofill";
@@ -24027,9 +24189,7 @@
24027
24189
  function createEditor (parent, metadata, onSubmit, onShiftSubmit) {
24028
24190
  const fixedHeightEditor = EditorView.theme({
24029
24191
  '.cm-scroller': {
24030
- height: '200px',
24031
- overflow: 'auto',
24032
- resize: 'vertical'
24192
+ overflow: 'auto'
24033
24193
  }
24034
24194
  });
24035
24195
  const schemas = Object.entries(metadata.schemas);
@@ -24119,7 +24279,7 @@
24119
24279
  ]);
24120
24280
  const sqlConfig = {
24121
24281
  dialect: MySQL,
24122
- upperCaseKeywords: true,
24282
+ upperCaseKeywords: false,
24123
24283
  schema: editorSchema,
24124
24284
  tables
24125
24285
  };
@@ -24256,7 +24416,7 @@
24256
24416
  }
24257
24417
  }),
24258
24418
  MySQL.language.data.of({
24259
- autocomplete: keywordCompletionSource(MySQL, true)
24419
+ autocomplete: keywordCompletionSource(MySQL, false)
24260
24420
  })
24261
24421
  ]
24262
24422
  );
@@ -24310,6 +24470,7 @@
24310
24470
  let drag = new Drag();
24311
24471
 
24312
24472
  document.addEventListener('mousedown', (event) => {
24473
+ if (event.button !== 0) return
24313
24474
  if (!event.target.classList.contains('col-resizer')) return
24314
24475
 
24315
24476
  drag = new Drag();
@@ -24366,10 +24527,11 @@
24366
24527
  });
24367
24528
 
24368
24529
  class ResizeTable extends HTMLTableElement {
24369
- constructor (columns, rows, cellRenderer) {
24530
+ constructor (columns, rows, headerRenderer, cellRenderer) {
24370
24531
  super();
24371
24532
 
24372
24533
  this.columns = columns;
24534
+ this.headerRenderer = headerRenderer;
24373
24535
  this.cellRenderer = cellRenderer;
24374
24536
 
24375
24537
  this.style.tableLayout = 'auto';
@@ -24408,7 +24570,11 @@
24408
24570
  resizerElement.dataset.colId = colElement.dataset.colId;
24409
24571
  contentWrapperElement.appendChild(resizerElement);
24410
24572
 
24411
- nameElement.innerText = column;
24573
+ if (headerRenderer) {
24574
+ nameElement.appendChild(headerRenderer(headerElement, index, column));
24575
+ } else {
24576
+ nameElement.innerText = column;
24577
+ }
24412
24578
  });
24413
24579
 
24414
24580
  headerTrElement.appendChild(document.createElement('th'));
@@ -24475,21 +24641,21 @@
24475
24641
  this.tbodyElement = tbodyElement;
24476
24642
 
24477
24643
  let highlight = false;
24478
- rows.forEach(function (row) {
24644
+ rows.forEach(function (row, rowIndex) {
24479
24645
  const rowElement = document.createElement('tr');
24480
24646
  if (highlight) {
24481
24647
  rowElement.classList.add('highlighted-row');
24482
24648
  }
24483
24649
  highlight = !highlight;
24484
24650
  tbodyElement.appendChild(rowElement);
24485
- row.forEach(function (value, index) {
24651
+ row.forEach(function (value, columnIndex) {
24652
+ const cellElement = document.createElement('td');
24486
24653
  if (cellRenderer) {
24487
- cellRenderer(rowElement, index, value);
24654
+ cellElement.appendChild(cellRenderer(cellElement, rowIndex, columnIndex, value));
24488
24655
  } else {
24489
- const cellElement = document.createElement('td');
24490
24656
  cellElement.innerText = value;
24491
- rowElement.appendChild(cellElement);
24492
24657
  }
24658
+ rowElement.appendChild(cellElement);
24493
24659
  });
24494
24660
  rowElement.appendChild(document.createElement('td'));
24495
24661
  });
@@ -24502,6 +24668,121 @@
24502
24668
 
24503
24669
  customElements.define('resize-table', ResizeTable, { extends: 'table' });
24504
24670
 
24671
+ function styleInject(css, ref) {
24672
+ if ( ref === void 0 ) ref = {};
24673
+ var insertAt = ref.insertAt;
24674
+
24675
+ if (!css || typeof document === 'undefined') { return; }
24676
+
24677
+ var head = document.head || document.getElementsByTagName('head')[0];
24678
+ var style = document.createElement('style');
24679
+ style.type = 'text/css';
24680
+
24681
+ if (insertAt === 'top') {
24682
+ if (head.firstChild) {
24683
+ head.insertBefore(style, head.firstChild);
24684
+ } else {
24685
+ head.appendChild(style);
24686
+ }
24687
+ } else {
24688
+ head.appendChild(style);
24689
+ }
24690
+
24691
+ if (style.styleSheet) {
24692
+ style.styleSheet.cssText = css;
24693
+ } else {
24694
+ style.appendChild(document.createTextNode(css));
24695
+ }
24696
+ }
24697
+
24698
+ var css_248z = ".popup_popup-wrapper__huCTg {\n position: absolute;\n background: rgba(0, 0, 0, 0.3);\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n z-index: 2;\n}\n\n.popup_popup-content__iGYws {\n position: absolute;\n top: 50px;\n left: 50px;\n height: calc(100% - 100px);\n width: calc(100% - 100px);\n background: #fff;\n border: 1px solid #888;\n}\n\n.popup_popup-pre__gF3-Q {\n position: absolute;\n top: 40px;\n left: 0;\n height: calc(100% - 112px);\n width: calc(100% - 20px);\n overflow: auto;\n font-size: 18px;\n border-top: 1px solid #ddd;\n border-bottom: 1px solid #ddd;\n margin: 0px;\n padding: 10px;\n background: #fff;\n font-family: monospace;\n}\n\n.popup_popup-pre__gF3-Q:focus {\n outline: none;\n}\n.popup_popup-close__3GBw3 {\n position: absolute;\n right: 20px;\n bottom: 10px;\n width: 100px;\n height: 30px;\n cursor: pointer;\n font-family: Helvetica, sans-serif;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 18px;\n color: #333;\n border: 1px solid #888;\n background: #fff;\n}\n\n.popup_popup-close__3GBw3:active {\n background-color: #e6e6e6;\n}\n\n.popup_popup-title__W2N2J {\n position: absolute;\n top: 10px;\n left: 10px;\n font-family: Helvetica, sans-serif;\n font-size: 18px;\n color: #333;\n font-weight: bold;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n width: calc(100% - 20px);\n}\n";
24699
+ var styles = {"popup-wrapper":"popup_popup-wrapper__huCTg","popup-content":"popup_popup-content__iGYws","popup-pre":"popup_popup-pre__gF3-Q","popup-close":"popup_popup-close__3GBw3","popup-title":"popup_popup-title__W2N2J"};
24700
+ styleInject(css_248z);
24701
+
24702
+ function createPopup (title, text) {
24703
+ const wrapperElement = document.createElement('div');
24704
+ wrapperElement.id = 'popup';
24705
+ wrapperElement.classList.add(styles['popup-wrapper']);
24706
+ document.body.appendChild(wrapperElement);
24707
+
24708
+ const contentElement = document.createElement('div');
24709
+ contentElement.classList.add(styles['popup-content']);
24710
+ wrapperElement.appendChild(contentElement);
24711
+
24712
+ const closeElement = document.createElement('input');
24713
+ closeElement.id = 'popup-close';
24714
+ closeElement.classList.add(styles['popup-close']);
24715
+ closeElement.type = 'button';
24716
+ closeElement.value = 'Close';
24717
+ contentElement.appendChild(closeElement);
24718
+
24719
+ closeElement.addEventListener('click', (event) => {
24720
+ document.body.removeChild(wrapperElement);
24721
+ });
24722
+
24723
+ const titleElement = document.createElement('div');
24724
+ titleElement.classList.add(styles['popup-title']);
24725
+ titleElement.innerText = title;
24726
+ contentElement.appendChild(titleElement);
24727
+
24728
+ const preElement = document.createElement('pre');
24729
+ preElement.id = 'popup-pre';
24730
+ preElement.classList.add(styles['popup-pre']);
24731
+ contentElement.appendChild(preElement);
24732
+ preElement.innerText = text;
24733
+
24734
+ wrapperElement.addEventListener('click', () => {
24735
+ document.body.removeChild(wrapperElement);
24736
+ });
24737
+
24738
+ contentElement.addEventListener('click', (event) => {
24739
+ event.stopPropagation();
24740
+ });
24741
+
24742
+ closeElement.focus();
24743
+ }
24744
+
24745
+ document.addEventListener('keydown', (event) => {
24746
+ if (event.code === 'Escape') {
24747
+ const wrapperElement = document.getElementById('popup');
24748
+ if (wrapperElement) {
24749
+ event.preventDefault();
24750
+ document.body.removeChild(wrapperElement);
24751
+ }
24752
+ } else if (event.code === 'Tab') {
24753
+ const wrapperElement = document.getElementById('popup');
24754
+ if (wrapperElement) {
24755
+ event.preventDefault();
24756
+ document.getElementById('popup-close').focus();
24757
+ }
24758
+ }
24759
+ });
24760
+
24761
+ function createVerticalResizer (resizerElement, resizableElement, min, max) {
24762
+ let startY = null;
24763
+ let startHeight = null;
24764
+
24765
+ const moveListener = (event) => {
24766
+ const y = event.clientY - startY;
24767
+ const height = Math.min(max, Math.max(min, startHeight + y));
24768
+ console.log(`y: ${y}, height: ${height}`);
24769
+ resizableElement.style.height = `${height}px`;
24770
+ };
24771
+
24772
+ resizerElement.addEventListener('mousedown', (event) => {
24773
+ if (event.button !== 0) return
24774
+ event.preventDefault();
24775
+ startY = event.clientY;
24776
+ startHeight = resizableElement.clientHeight;
24777
+ document.addEventListener('mousemove', moveListener);
24778
+ });
24779
+
24780
+ document.addEventListener('mouseup', (_) => {
24781
+ startY = null;
24782
+ document.removeEventListener('mousemove', moveListener);
24783
+ });
24784
+ }
24785
+
24505
24786
  /* global google */
24506
24787
 
24507
24788
  const PAGE_SIZE = 100;
@@ -24630,7 +24911,13 @@
24630
24911
  dropdownContent.classList.remove('submit-dropdown-content-show');
24631
24912
  }
24632
24913
  });
24914
+
24633
24915
  window.editorView = createEditor(parent, window.metadata, onSubmit, onShiftSubmit);
24916
+ const cmScroller = document.getElementsByClassName('cm-scroller')[0];
24917
+ cmScroller.style.height = '200px';
24918
+
24919
+ const editorResizer = document.getElementById('editor-resizer');
24920
+ createVerticalResizer(editorResizer, cmScroller, 100, 500);
24634
24921
  }
24635
24922
 
24636
24923
  function addEventListener (elementOrSelector, type, func) {
@@ -24857,13 +25144,11 @@
24857
25144
  }
24858
25145
  rows.push(row);
24859
25146
  }
24860
- const cellRenderer = function (rowElement, _columnIndex, value) {
24861
- const cellElement = document.createElement('td');
25147
+ const cellRenderer = function (cellElement, _rowIndex, _columnIndex, value) {
24862
25148
  cellElement.style.textAlign = (typeof value) === 'string' ? 'left' : 'right';
24863
- cellElement.innerText = value;
24864
- rowElement.appendChild(cellElement);
25149
+ return document.createTextNode(value)
24865
25150
  };
24866
- columnsElement.appendChild(new ResizeTable(columns, rows, cellRenderer));
25151
+ columnsElement.appendChild(new ResizeTable(columns, rows, null, cellRenderer));
24867
25152
  }
24868
25153
 
24869
25154
  const indexEntries = Object.entries(table.indexes);
@@ -24883,13 +25168,11 @@
24883
25168
  rows.push(row);
24884
25169
  }
24885
25170
  }
24886
- const cellRenderer = function (rowElement, _columnIndex, value) {
24887
- const cellElement = document.createElement('td');
25171
+ const cellRenderer = function (cellElement, _rowIndex, _columnIndex, value) {
24888
25172
  cellElement.style.textAlign = (typeof value) === 'string' ? 'left' : 'right';
24889
- cellElement.innerText = value;
24890
- rowElement.appendChild(cellElement);
25173
+ return document.createTextNode(value)
24891
25174
  };
24892
- indexesElement.appendChild(new ResizeTable(columns, rows, cellRenderer));
25175
+ indexesElement.appendChild(new ResizeTable(columns, rows, null, cellRenderer));
24893
25176
  }
24894
25177
  });
24895
25178
  window.structureLoaded = true;
@@ -24900,7 +25183,7 @@
24900
25183
  document.getElementById('submit-box').style.display = 'flex';
24901
25184
  document.getElementById('graph-box').style.display = 'flex';
24902
25185
  document.getElementById('fetch-sql-box').style.display = 'none';
24903
- document.getElementById('cancel-button').style.display = 'none';
25186
+ document.getElementById('cancel-button').style.visibility = 'hidden';
24904
25187
  updateDownloadButtons(window?.sqlFetch);
24905
25188
  maybeFetchResult(internal);
24906
25189
 
@@ -24912,7 +25195,7 @@
24912
25195
  document.getElementById('submit-box').style.display = 'flex';
24913
25196
  document.getElementById('result-box').style.display = 'flex';
24914
25197
  document.getElementById('fetch-sql-box').style.display = 'none';
24915
- document.getElementById('cancel-button').style.display = 'none';
25198
+ document.getElementById('cancel-button').style.visibility = 'hidden';
24916
25199
  focus(getSelection());
24917
25200
  maybeFetchResult(internal);
24918
25201
  }
@@ -25130,6 +25413,9 @@
25130
25413
  }
25131
25414
  }
25132
25415
  displaySqlFetch(sqlFetch);
25416
+ }).catch(function (error) {
25417
+ setSqlFetchError(sqlFetch, error);
25418
+ displaySqlFetch(sqlFetch);
25133
25419
  });
25134
25420
  } else {
25135
25421
  response.text().then((result) => {
@@ -25137,20 +25423,28 @@
25137
25423
  sqlFetch.errorMessage = 'failed to execute query';
25138
25424
  sqlFetch.errorDetails = result;
25139
25425
  displaySqlFetch(sqlFetch);
25426
+ }).catch(function (error) {
25427
+ setSqlFetchError(sqlFetch, error);
25428
+ displaySqlFetch(sqlFetch);
25140
25429
  });
25141
25430
  }
25142
25431
  })
25143
25432
  .catch(function (error) {
25144
- if (sqlFetch.state === 'pending') {
25145
- sqlFetch.endedAt = window.performance.now();
25146
- sqlFetch.state = 'error';
25147
- sqlFetch.errorMessage = 'failed to execute query';
25148
- sqlFetch.errorDetails = error;
25149
- }
25433
+ setSqlFetchError(sqlFetch, error);
25150
25434
  displaySqlFetch(sqlFetch);
25151
25435
  });
25152
25436
  }
25153
25437
 
25438
+ function setSqlFetchError (sqlFetch, error) {
25439
+ // Ignore the error unless pending since the error may be the result of aborting.
25440
+ if (sqlFetch.state === 'pending') {
25441
+ sqlFetch.endedAt = window.performance.now();
25442
+ sqlFetch.state = 'error';
25443
+ sqlFetch.errorMessage = 'failed to execute query';
25444
+ sqlFetch.errorDetails = error;
25445
+ }
25446
+ }
25447
+
25154
25448
  function parseSqlVariables (params) {
25155
25449
  return Object.fromEntries(
25156
25450
  Array.from(params).filter(([key]) => {
@@ -25272,10 +25566,17 @@
25272
25566
  return abbrElement
25273
25567
  };
25274
25568
 
25275
- const resultCellRenderer = function (rowElement, columnIndex, value) {
25569
+ const resultCellRenderer = function (cellElement, rowIndex, columnIndex, value) {
25276
25570
  const column = window.sqlFetch.result.columns[columnIndex];
25277
25571
  const columnType = window.sqlFetch.result.column_types[columnIndex];
25278
25572
 
25573
+ cellElement.dataset.column = columnIndex.toString();
25574
+ cellElement.dataset.row = rowIndex.toString();
25575
+
25576
+ if (typeof value === 'string' && value.indexOf('\n') >= 0) {
25577
+ value = value.replaceAll('\n', '¶');
25578
+ }
25579
+
25279
25580
  if (value && window.metadata.columns[column]?.links?.length > 0) {
25280
25581
  const linksElement = document.createElement('div');
25281
25582
  window.metadata.columns[column].links.forEach((link) => {
@@ -25292,17 +25593,22 @@
25292
25593
  wrapperElement.appendChild(linksElement);
25293
25594
  wrapperElement.appendChild(textElement);
25294
25595
 
25295
- const columnElement = document.createElement('td');
25296
- columnElement.appendChild(wrapperElement);
25297
- rowElement.appendChild(columnElement);
25596
+ return wrapperElement
25298
25597
  } else {
25299
- const cellElement = document.createElement('td');
25300
25598
  cellElement.style.textAlign = columnType === 'string' ? 'left' : 'right';
25301
- cellElement.innerText = value;
25302
- rowElement.appendChild(cellElement);
25599
+ return document.createTextNode(value)
25303
25600
  }
25304
25601
  };
25305
25602
 
25603
+ function resultHeaderRenderer (headerElement, columnIndex, value) {
25604
+ headerElement.dataset.column = columnIndex.toString();
25605
+
25606
+ if (typeof value === 'string' && value.indexOf('\n') >= 0) {
25607
+ value = value.replaceAll('\n', '¶');
25608
+ }
25609
+ return document.createTextNode(value)
25610
+ }
25611
+
25306
25612
  function displaySqlFetchInResultTab (fetch) {
25307
25613
  if (fetch.state === 'pending' || fetch.spinner === 'always') {
25308
25614
  clearResultBox();
@@ -25316,7 +25622,7 @@
25316
25622
  return
25317
25623
  }
25318
25624
 
25319
- document.getElementById('cancel-button').style.display = 'none';
25625
+ document.getElementById('cancel-button').style.visibility = 'hidden';
25320
25626
  document.getElementById('fetch-sql-box').style.display = 'none';
25321
25627
  document.getElementById('result-box').style.display = 'flex';
25322
25628
 
@@ -25352,13 +25658,45 @@
25352
25658
  } else {
25353
25659
  clearResultBox();
25354
25660
  const resultBoxElement = document.getElementById('result-box');
25355
- tableElement = new ResizeTable(fetch.result.columns, rows, resultCellRenderer);
25661
+ tableElement = new ResizeTable(fetch.result.columns, rows, resultHeaderRenderer, resultCellRenderer);
25356
25662
  tableElement.id = 'result-table';
25663
+ registerTableCellPopup(tableElement);
25357
25664
  resultBoxElement.appendChild(tableElement);
25358
25665
  }
25359
25666
  tableElement.setAttribute('data-page', fetch.page);
25360
25667
  }
25361
25668
 
25669
+ function registerTableCellPopup (tableElement) {
25670
+ const listener = (event) => {
25671
+ if (event.which === 1 && event.metaKey) {
25672
+ let node = event.target;
25673
+ while (!['td', 'th', 'table'].includes(node.tagName.toLowerCase()) && node.parentNode) {
25674
+ node = node.parentNode;
25675
+ }
25676
+ if (node.tagName.toLowerCase() === 'td') {
25677
+ if (event.type === 'mousedown') {
25678
+ const row = parseInt(node.dataset.row);
25679
+ const column = parseInt(node.dataset.column);
25680
+ const title = window.sqlFetch.result.columns[column].replaceAll('\n', '¶');
25681
+ createPopup(title, window.sqlFetch.result.rows[row][column]);
25682
+ }
25683
+ event.preventDefault();
25684
+ } else if (node.tagName.toLowerCase() === 'th') {
25685
+ if (event.type === 'mousedown') {
25686
+ const column = parseInt(node.dataset.column);
25687
+ const value = window.sqlFetch.result.columns[column];
25688
+ const title = value.replaceAll('\n', '¶');
25689
+ createPopup(title, value);
25690
+ }
25691
+ event.preventDefault();
25692
+ }
25693
+ }
25694
+ };
25695
+ // We only open the popup on mouseup but we need to preventDefault on mousedown to avoid the clicked text from
25696
+ // being highlighted.
25697
+ addEventListener(tableElement, 'mouseup', listener);
25698
+ addEventListener(tableElement, 'mousedown', listener);
25699
+ }
25362
25700
  function disableDownloadButtons () {
25363
25701
  document.getElementById('submit-dropdown-button-download-csv').classList.add('disabled');
25364
25702
  document.getElementById('submit-dropdown-button-copy-csv').classList.add('disabled');
@@ -25389,24 +25727,19 @@
25389
25727
  }
25390
25728
 
25391
25729
  function displaySqlFetchError (message, details) {
25392
- let statusMessage = 'error: ' + message;
25393
- if (statusMessage.length > 90) {
25394
- statusMessage = statusMessage.substring(0, 90) + '…';
25395
- }
25396
25730
  if (details) {
25397
- console.log(`${message}\n${details}`);
25398
- statusMessage += ' (check console)';
25731
+ console.log(details);
25399
25732
  }
25400
- setStatus(statusMessage);
25733
+ setStatus(message);
25401
25734
  }
25402
25735
 
25403
25736
  function clearSpinner () {
25404
- document.getElementById('cancel-button').style.display = 'none';
25737
+ document.getElementById('cancel-button').style.visibility = 'hidden';
25405
25738
  document.getElementById('fetch-sql-box').style.display = 'none';
25406
25739
  }
25407
25740
 
25408
25741
  function displaySpinner (fetch) {
25409
- document.getElementById('cancel-button').style.display = 'flex';
25742
+ document.getElementById('cancel-button').style.visibility = 'visible';
25410
25743
  document.getElementById('fetch-sql-box').style.display = 'flex';
25411
25744
 
25412
25745
  const elapsed = window.performance.now() - fetch.startedAt;
@@ -25505,14 +25838,14 @@
25505
25838
  const elapsed = Math.round(100 * (sqlFetch.getDuration() / 1000.0)) / 100;
25506
25839
 
25507
25840
  let message;
25508
- if (result.total_rows === 1) {
25509
- message = `${result.total_rows} row (${elapsed}s)`;
25841
+ if (result.rows.length === 1) {
25842
+ message = `1 row returned after ${elapsed}s`;
25510
25843
  } else {
25511
- message = `${result.total_rows.toLocaleString()} rows (${elapsed}s)`;
25844
+ message = `${result.rows.length.toLocaleString()} rows returned after ${elapsed}s`;
25512
25845
  }
25513
25846
 
25514
25847
  if (result.total_rows > result.rows.length) {
25515
- message += ` (truncated to ${result.rows.length.toLocaleString()})`;
25848
+ message += ` (truncated from ${result.total_rows.toLocaleString()})`;
25516
25849
  }
25517
25850
  setStatus(message);
25518
25851
 
@@ -25595,7 +25928,7 @@
25595
25928
  document.getElementById('main-box').style.display = 'flex';
25596
25929
  document.getElementById('server-name').innerText = window.metadata.server;
25597
25930
  document.title = `SQLUI ${window.metadata.server}`;
25598
- document.getElementById('header-link').href = result.list_url_path;
25931
+ document.getElementById('header-link').href = result.base_url_path;
25599
25932
  const queryElement = document.getElementById('query');
25600
25933
 
25601
25934
  init(queryElement, submitCurrent, submitAll);