@nine-lab/nine-mu 0.1.175 → 0.1.176

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/nine-mu.js CHANGED
@@ -9,7 +9,7 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
9
9
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
10
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
11
11
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
12
- var _mcpClient, _onAction, _onStatus, _onMessage, _owner, _NineChatManager_instances, connect_fn, fetchRoutes_fn, pushMessage_fn, updateStatus_fn, callTool_fn, _getSourcePath, _service, _routes, _diffPopup, _packageName, _routesPath, _connectorUrl, _manager, _$nineChatMessage, _NineChat_instances, initInteractions_fn, initActions_fn, render_fn, _makeMenuHandler, _sourceGenHandler, _showDiff, _asisEditorView, _tobeEditorView, _asisEditorEl, _tobeEditorEl, _languageCompartment, _isScrollSyncActive, _initCodeMirror, _setupScrollSync, _applyDiffDecorations, _dialog, _diffView, _asisBackup, _host, _NineDiffPopup_instances, render_fn2, handleConfirm_fn, handleCancel_fn, _message, _data, _unique, _init, _message2, _init2, _progressData, _progressElements, _animationIntervals, _ProgressMessage_instances, updateCurrentActiveProgress_fn, renderProgress_fn, updateProgressItemVisuals_fn, startAnimation_fn, updateProgressItem_fn, _renderer, _init3;
12
+ var _mcpClient, _onAction, _onStatus, _onMessage, _owner, _routeUrl, _NineChatManager_instances, connect_fn, fetchRoutes_fn, pushMessage_fn, updateStatus_fn, callTool_fn, getRoutes_fn, _getSourcePath, _service, _routes, _diffPopup, _packageName, _routesPath, _connectorUrl, _manager, _$nineChatMessage, _NineChat_instances, initInteractions_fn, initActions_fn, render_fn, _makeMenuHandler, _sourceGenHandler, _showDiff, _asisEditorView, _tobeEditorView, _asisEditorEl, _tobeEditorEl, _languageCompartment, _isScrollSyncActive, _initCodeMirror, _setupScrollSync, _applyDiffDecorations, _dialog, _diffView, _asisBackup, _host, _NineDiffPopup_instances, render_fn2, handleConfirm_fn, handleCancel_fn, _message, _data, _unique, _init, _message2, _init2, _progressData, _progressElements, _animationIntervals, _ProgressMessage_instances, updateCurrentActiveProgress_fn, renderProgress_fn, updateProgressItemVisuals_fn, startAnimation_fn, updateProgressItem_fn, _renderer, _init3;
13
13
  import { trace as trace$1, api, nine } from "@nine-lab/nine-util";
14
14
  class Trace extends trace$1.constructor {
15
15
  constructor() {
@@ -1056,12 +1056,12 @@ const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
1056
1056
  validate: (value) => {
1057
1057
  var _a4;
1058
1058
  try {
1059
- const r = safeParse$2(inst, value);
1060
- return r.success ? { value: r.data } : { issues: (_a4 = r.error) == null ? void 0 : _a4.issues };
1059
+ const r2 = safeParse$2(inst, value);
1060
+ return r2.success ? { value: r2.data } : { issues: (_a4 = r2.error) == null ? void 0 : _a4.issues };
1061
1061
  } catch (_) {
1062
- return safeParseAsync$1(inst, value).then((r) => {
1062
+ return safeParseAsync$1(inst, value).then((r2) => {
1063
1063
  var _a5;
1064
- return r.success ? { value: r.data } : { issues: (_a5 = r.error) == null ? void 0 : _a5.issues };
1064
+ return r2.success ? { value: r2.data } : { issues: (_a5 = r2.error) == null ? void 0 : _a5.issues };
1065
1065
  });
1066
1066
  }
1067
1067
  },
@@ -1629,14 +1629,14 @@ const $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
1629
1629
  const shape = value.shape;
1630
1630
  for (const key of value.keys) {
1631
1631
  const el = shape[key];
1632
- const r = el._zod.run({ value: input[key], issues: [] }, ctx);
1632
+ const r2 = el._zod.run({ value: input[key], issues: [] }, ctx);
1633
1633
  const isOptional = el._zod.optin === "optional" && el._zod.optout === "optional";
1634
- if (r instanceof Promise) {
1635
- proms.push(r.then((r2) => isOptional ? handleOptionalObjectResult(r2, payload, key, input) : handleObjectResult(r2, payload, key)));
1634
+ if (r2 instanceof Promise) {
1635
+ proms.push(r2.then((r3) => isOptional ? handleOptionalObjectResult(r3, payload, key, input) : handleObjectResult(r3, payload, key)));
1636
1636
  } else if (isOptional) {
1637
- handleOptionalObjectResult(r, payload, key, input);
1637
+ handleOptionalObjectResult(r2, payload, key, input);
1638
1638
  } else {
1639
- handleObjectResult(r, payload, key);
1639
+ handleObjectResult(r2, payload, key);
1640
1640
  }
1641
1641
  }
1642
1642
  }
@@ -1654,11 +1654,11 @@ const $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
1654
1654
  unrecognized.push(key);
1655
1655
  continue;
1656
1656
  }
1657
- const r = _catchall.run({ value: input[key], issues: [] }, ctx);
1658
- if (r instanceof Promise) {
1659
- proms.push(r.then((r2) => handleObjectResult(r2, payload, key)));
1657
+ const r2 = _catchall.run({ value: input[key], issues: [] }, ctx);
1658
+ if (r2 instanceof Promise) {
1659
+ proms.push(r2.then((r3) => handleObjectResult(r3, payload, key)));
1660
1660
  } else {
1661
- handleObjectResult(r, payload, key);
1661
+ handleObjectResult(r2, payload, key);
1662
1662
  }
1663
1663
  }
1664
1664
  if (unrecognized.length) {
@@ -2197,11 +2197,11 @@ const $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
2197
2197
  };
2198
2198
  inst._zod.check = (payload) => {
2199
2199
  const input = payload.value;
2200
- const r = def.fn(input);
2201
- if (r instanceof Promise) {
2202
- return r.then((r2) => handleRefineResult(r2, payload, input, inst));
2200
+ const r2 = def.fn(input);
2201
+ if (r2 instanceof Promise) {
2202
+ return r2.then((r3) => handleRefineResult(r3, payload, input, inst));
2203
2203
  }
2204
- handleRefineResult(r, payload, input, inst);
2204
+ handleRefineResult(r2, payload, input, inst);
2205
2205
  return;
2206
2206
  };
2207
2207
  });
@@ -5265,7 +5265,7 @@ class Protocol {
5265
5265
  }
5266
5266
  await this.notification(notification, notificationOptions);
5267
5267
  },
5268
- sendRequest: async (r, resultSchema, options) => {
5268
+ sendRequest: async (r2, resultSchema, options) => {
5269
5269
  var _a3;
5270
5270
  if (abortController.signal.aborted) {
5271
5271
  throw new McpError(ErrorCode.ConnectionClosed, "Request was cancelled");
@@ -5278,7 +5278,7 @@ class Protocol {
5278
5278
  if (effectiveTaskId && taskStore) {
5279
5279
  await taskStore.updateTaskStatus(effectiveTaskId, "input_required");
5280
5280
  }
5281
- return await this.request(r, resultSchema, requestOptions);
5281
+ return await this.request(r2, resultSchema, requestOptions);
5282
5282
  },
5283
5283
  authInfo: extra == null ? void 0 : extra.authInfo,
5284
5284
  requestId: request.id,
@@ -13511,8 +13511,9 @@ class NineChatManager {
13511
13511
  __privateAdd(this, _onMessage);
13512
13512
  // UI에 메시지를 뿌려줄 콜백 추가
13513
13513
  __privateAdd(this, _owner);
13514
+ __privateAdd(this, _routeUrl);
13514
13515
  __publicField(this, "handleChatSubmit", async (el) => {
13515
- const routes = [];
13516
+ const routes = __privateMethod(this, _NineChatManager_instances, getRoutes_fn).call(this);
13516
13517
  return await __privateMethod(this, _NineChatManager_instances, callTool_fn).call(this, "system-brain", {
13517
13518
  user_input: el.value.trim(),
13518
13519
  routes,
@@ -13520,6 +13521,7 @@ class NineChatManager {
13520
13521
  });
13521
13522
  });
13522
13523
  __privateSet(this, _owner, owner);
13524
+ __privateSet(this, _routeUrl, __privateGet(this, _owner).getAttribute("route-url"));
13523
13525
  __privateSet(this, _onAction, callbacks.onAction);
13524
13526
  __privateSet(this, _onStatus, callbacks.onStatus);
13525
13527
  __privateSet(this, _onMessage, callbacks.onMessage);
@@ -13572,6 +13574,7 @@ _onAction = new WeakMap();
13572
13574
  _onStatus = new WeakMap();
13573
13575
  _onMessage = new WeakMap();
13574
13576
  _owner = new WeakMap();
13577
+ _routeUrl = new WeakMap();
13575
13578
  _NineChatManager_instances = new WeakSet();
13576
13579
  connect_fn = async function() {
13577
13580
  if (__privateGet(this, _mcpClient)) return;
@@ -13590,8 +13593,8 @@ connect_fn = async function() {
13590
13593
  });
13591
13594
  };
13592
13595
  fetchRoutes_fn = async function() {
13593
- const r = await fetch("/admin/prompts/data/routes.json");
13594
- return r.ok ? await r.json() : [];
13596
+ const r2 = await fetch("/admin/prompts/data/routes.json");
13597
+ return r2.ok ? await r2.json() : [];
13595
13598
  };
13596
13599
  pushMessage_fn = function(role, content2, result = null) {
13597
13600
  var _a2;
@@ -13612,6 +13615,14 @@ updateStatus_fn = function(msg) {
13612
13615
  callTool_fn = async function(toolName, args = {}) {
13613
13616
  return __privateGet(this, _mcpClient).callTool({ name: toolName, arguments: args });
13614
13617
  };
13618
+ getRoutes_fn = async function(toolName, args = {}) {
13619
+ console.log(__privateGet(this, _routeUrl));
13620
+ const res = await fetch(__privateGet(this, _routeUrl));
13621
+ if (!res.ok) {
13622
+ throw new Error(`HTTP error! status: ${r.status}`);
13623
+ }
13624
+ return await res.json();
13625
+ };
13615
13626
  class NineMuService {
13616
13627
  constructor(connectorUrl) {
13617
13628
  __privateAdd(this, _getSourcePath, (menuUrl) => {
@@ -13819,7 +13830,7 @@ render_fn = function() {
13819
13830
  const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
13820
13831
  this.shadowRoot.innerHTML = `
13821
13832
  <style>
13822
- @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.174"}/dist/css/nine-mu.css";
13833
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.175"}/dist/css/nine-mu.css";
13823
13834
  ${customImport}
13824
13835
  </style>
13825
13836
  <div class="wrapper">
@@ -15220,7 +15231,7 @@ class EditorSelection {
15220
15231
  map(change, assoc = -1) {
15221
15232
  if (change.empty)
15222
15233
  return this;
15223
- return EditorSelection.create(this.ranges.map((r) => r.map(change, assoc)), this.mainIndex);
15234
+ return EditorSelection.create(this.ranges.map((r2) => r2.map(change, assoc)), this.mainIndex);
15224
15235
  }
15225
15236
  /**
15226
15237
  Compare this selection to another selection. By default, ranges
@@ -15271,7 +15282,7 @@ class EditorSelection {
15271
15282
  JSON.
15272
15283
  */
15273
15284
  toJSON() {
15274
- return { ranges: this.ranges.map((r) => r.toJSON()), main: this.mainIndex };
15285
+ return { ranges: this.ranges.map((r2) => r2.toJSON()), main: this.mainIndex };
15275
15286
  }
15276
15287
  /**
15277
15288
  Create a selection from a JSON representation.
@@ -15279,7 +15290,7 @@ class EditorSelection {
15279
15290
  static fromJSON(json) {
15280
15291
  if (!json || !Array.isArray(json.ranges) || typeof json.main != "number" || json.main >= json.ranges.length)
15281
15292
  throw new RangeError("Invalid JSON representation for EditorSelection");
15282
- return new EditorSelection(json.ranges.map((r) => SelectionRange.fromJSON(r)), json.main);
15293
+ return new EditorSelection(json.ranges.map((r2) => SelectionRange.fromJSON(r2)), json.main);
15283
15294
  }
15284
15295
  /**
15285
15296
  Create a selection holding a single range.
@@ -18294,9 +18305,9 @@ const LowTypes = /* @__PURE__ */ dec("888888888888888888888888888888888886668888
18294
18305
  const ArabicTypes = /* @__PURE__ */ dec("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333");
18295
18306
  const Brackets = /* @__PURE__ */ Object.create(null), BracketStack = [];
18296
18307
  for (let p of ["()", "[]", "{}"]) {
18297
- let l = /* @__PURE__ */ p.charCodeAt(0), r = /* @__PURE__ */ p.charCodeAt(1);
18298
- Brackets[l] = r;
18299
- Brackets[r] = -l;
18308
+ let l = /* @__PURE__ */ p.charCodeAt(0), r2 = /* @__PURE__ */ p.charCodeAt(1);
18309
+ Brackets[l] = r2;
18310
+ Brackets[r2] = -l;
18300
18311
  }
18301
18312
  function charType(ch) {
18302
18313
  return ch <= 247 ? LowTypes[ch] : 1424 <= ch && ch <= 1524 ? 2 : 1536 <= ch && ch <= 1785 ? ArabicTypes[ch - 1536] : 1774 <= ch && ch <= 2220 ? 4 : 8192 <= ch && ch <= 8204 ? 256 : 64336 <= ch && ch <= 65023 ? 4 : 1;
@@ -19381,7 +19392,7 @@ class TextTile extends Tile {
19381
19392
  return null;
19382
19393
  let rect = rects[(flatten2 ? flatten2 < 0 : side >= 0) ? 0 : rects.length - 1];
19383
19394
  if (browser.safari && !flatten2 && rect.width == 0)
19384
- rect = Array.prototype.find.call(rects, (r) => r.width) || rect;
19395
+ rect = Array.prototype.find.call(rects, (r2) => r2.width) || rect;
19385
19396
  return flatten2 ? flattenRect(rect, flatten2 < 0) : rect || null;
19386
19397
  }
19387
19398
  static of(text, dom) {
@@ -20241,7 +20252,7 @@ class DocView {
20241
20252
  let blockDiff = findChangedWrappers(prevWrappers, this.blockWrappers, update.changes);
20242
20253
  if (blockDiff.length)
20243
20254
  changedRanges = ChangedRange.extendWithRanges(changedRanges, blockDiff);
20244
- if (composition && !changedRanges.some((r) => r.fromA <= composition.range.fromA && r.toA >= composition.range.toA))
20255
+ if (composition && !changedRanges.some((r2) => r2.fromA <= composition.range.fromA && r2.toA >= composition.range.toA))
20245
20256
  changedRanges = composition.range.addToSet(changedRanges.slice());
20246
20257
  if (this.tile.flags & 2 && changedRanges.length == 0) {
20247
20258
  return false;
@@ -20709,9 +20720,9 @@ class DocView {
20709
20720
  }
20710
20721
  }
20711
20722
  function destroyDropped(tile, reused) {
20712
- let r = reused === null || reused === void 0 ? void 0 : reused.get(tile);
20713
- if (r != 1) {
20714
- if (r == null)
20723
+ let r2 = reused === null || reused === void 0 ? void 0 : reused.get(tile);
20724
+ if (r2 != 1) {
20725
+ if (r2 == null)
20715
20726
  tile.destroy();
20716
20727
  for (let ch of tile.children)
20717
20728
  destroyDropped(ch, reused);
@@ -21958,7 +21969,7 @@ function doPaste(view, input) {
21958
21969
  input = textFilter(view.state, clipboardInputFilter, input);
21959
21970
  let { state } = view, changes, i = 1, text = state.toText(input);
21960
21971
  let byLine = text.lines == state.selection.ranges.length;
21961
- let linewise = lastLinewiseCopy != null && state.selection.ranges.every((r) => r.empty) && lastLinewiseCopy == text.toString();
21972
+ let linewise = lastLinewiseCopy != null && state.selection.ranges.every((r2) => r2.empty) && lastLinewiseCopy == text.toString();
21962
21973
  if (linewise) {
21963
21974
  let lastLine = -1;
21964
21975
  changes = state.changeByRange((range) => {
@@ -22325,8 +22336,8 @@ handlers.beforeinput = (view, event) => {
22325
22336
  if (event.inputType == "insertReplacementText" && view.observer.editContext) {
22326
22337
  let text = (_a2 = event.dataTransfer) === null || _a2 === void 0 ? void 0 : _a2.getData("text/plain"), ranges = event.getTargetRanges();
22327
22338
  if (text && ranges.length) {
22328
- let r = ranges[0];
22329
- let from = view.posAtDOM(r.startContainer, r.startOffset), to = view.posAtDOM(r.endContainer, r.endOffset);
22339
+ let r2 = ranges[0];
22340
+ let from = view.posAtDOM(r2.startContainer, r2.startOffset), to = view.posAtDOM(r2.endContainer, r2.endOffset);
22330
22341
  applyDOMChangeInner(view, { from, to, insert: view.state.toText(text) }, null);
22331
22342
  return true;
22332
22343
  }
@@ -23457,7 +23468,7 @@ class ViewState {
23457
23468
  }
23458
23469
  let gap = find(current, (gap2) => gap2.from >= line.from && gap2.to <= line.to && Math.abs(gap2.from - from) < halfMargin && Math.abs(gap2.to - to) < halfMargin && !avoid.some((pos) => gap2.from < pos && gap2.to > pos));
23459
23470
  if (!gap) {
23460
- if (to < line.to && mayMeasure && wrapping && mayMeasure.visibleRanges.some((r) => r.from <= to && r.to >= to)) {
23471
+ if (to < line.to && mayMeasure && wrapping && mayMeasure.visibleRanges.some((r2) => r2.from <= to && r2.to >= to)) {
23461
23472
  let lineStart = mayMeasure.moveToLineBoundary(EditorSelection.cursor(to), false, true).head;
23462
23473
  if (lineStart > from)
23463
23474
  to = lineStart;
@@ -25972,9 +25983,9 @@ function rectanglesForRange(view, className, range) {
25972
25983
  horizontal.push(!ltr && toOpen ? leftSide : toCoords.left, !ltr && fromOpen ? rightSide : fromCoords.right);
25973
25984
  }
25974
25985
  let start = from2 !== null && from2 !== void 0 ? from2 : line.from, end = to2 !== null && to2 !== void 0 ? to2 : line.to;
25975
- for (let r of view.visibleRanges)
25976
- if (r.to > start && r.from < end) {
25977
- for (let pos = Math.max(r.from, start), endPos = Math.min(r.to, end); ; ) {
25986
+ for (let r2 of view.visibleRanges)
25987
+ if (r2.to > start && r2.from < end) {
25988
+ for (let pos = Math.max(r2.from, start), endPos = Math.min(r2.to, end); ; ) {
25978
25989
  let docLine = view.state.doc.lineAt(pos);
25979
25990
  for (let span of view.bidiSpans(docLine)) {
25980
25991
  let spanFrom = span.from + docLine.from, spanTo = span.to + docLine.from;
@@ -26113,11 +26124,11 @@ const cursorLayer = /* @__PURE__ */ layer({
26113
26124
  markers(view) {
26114
26125
  let { state } = view, conf = state.facet(selectionConfig);
26115
26126
  let cursors = [];
26116
- for (let r of state.selection.ranges) {
26117
- let prim = r == state.selection.main;
26118
- if (r.empty || conf.drawRangeCursor && !(prim && browser.ios && conf.iosSelectionHandles)) {
26127
+ for (let r2 of state.selection.ranges) {
26128
+ let prim = r2 == state.selection.main;
26129
+ if (r2.empty || conf.drawRangeCursor && !(prim && browser.ios && conf.iosSelectionHandles)) {
26119
26130
  let className = prim ? "cm-cursor cm-cursor-primary" : "cm-cursor cm-cursor-secondary";
26120
- let cursor = r.empty ? r : EditorSelection.cursor(r.head, r.assoc);
26131
+ let cursor = r2.empty ? r2 : EditorSelection.cursor(r2.head, r2.assoc);
26121
26132
  for (let piece of RectangleMarker.forRange(view, className, cursor))
26122
26133
  cursors.push(piece);
26123
26134
  }
@@ -26144,9 +26155,9 @@ const selectionLayer = /* @__PURE__ */ layer({
26144
26155
  above: false,
26145
26156
  markers(view) {
26146
26157
  let markers = [], { main, ranges } = view.state.selection;
26147
- for (let r of ranges)
26148
- if (!r.empty) {
26149
- for (let marker of RectangleMarker.forRange(view, "cm-selectionBackground", r))
26158
+ for (let r2 of ranges)
26159
+ if (!r2.empty) {
26160
+ for (let marker of RectangleMarker.forRange(view, "cm-selectionBackground", r2))
26150
26161
  markers.push(marker);
26151
26162
  }
26152
26163
  if (browser.ios && !main.empty && view.state.facet(selectionConfig).iosSelectionHandles) {
@@ -26348,11 +26359,11 @@ class MatchDecorator {
26348
26359
  return deco;
26349
26360
  }
26350
26361
  updateRange(view, deco, updateFrom, updateTo) {
26351
- for (let r of view.visibleRanges) {
26352
- let from = Math.max(r.from, updateFrom), to = Math.min(r.to, updateTo);
26362
+ for (let r2 of view.visibleRanges) {
26363
+ let from = Math.max(r2.from, updateFrom), to = Math.min(r2.to, updateTo);
26353
26364
  if (to >= from) {
26354
26365
  let fromLine = view.state.doc.lineAt(from), toLine = fromLine.to < to ? view.state.doc.lineAt(to) : fromLine;
26355
- let start = Math.max(r.from, fromLine.from), end = Math.min(r.to, toLine.to);
26366
+ let start = Math.max(r2.from, fromLine.from), end = Math.min(r2.to, toLine.to);
26356
26367
  if (this.boundary) {
26357
26368
  for (; from > fromLine.from; from--)
26358
26369
  if (this.boundary.test(fromLine.text[from - 1 - fromLine.from])) {
@@ -26539,8 +26550,8 @@ const activeLineHighlighter = /* @__PURE__ */ ViewPlugin.fromClass(class {
26539
26550
  }
26540
26551
  getDeco(view) {
26541
26552
  let lastLineStart = -1, deco = [];
26542
- for (let r of view.state.selection.ranges) {
26543
- let line = view.lineBlockAt(r.head);
26553
+ for (let r2 of view.state.selection.ranges) {
26554
+ let line = view.lineBlockAt(r2.head);
26544
26555
  if (line.from > lastLineStart) {
26545
26556
  deco.push(lineDeco.range(line.from));
26546
26557
  lastLineStart = line.from;
@@ -26818,9 +26829,9 @@ const tooltipPlugin = /* @__PURE__ */ ViewPlugin.fromClass(class {
26818
26829
  let top2 = above ? pos.top - height - arrowHeight - offset.y : pos.bottom + arrowHeight + offset.y;
26819
26830
  let right = left + width;
26820
26831
  if (tView.overlap !== true) {
26821
- for (let r of others)
26822
- if (r.left < right && r.right > left && r.top < top2 + height && r.bottom > top2)
26823
- top2 = above ? r.top - height - 2 - arrowHeight : r.bottom + arrowHeight + 2;
26832
+ for (let r2 of others)
26833
+ if (r2.left < right && r2.right > left && r2.top < top2 + height && r2.bottom > top2)
26834
+ top2 = above ? r2.top - height - 2 - arrowHeight : r2.bottom + arrowHeight + 2;
26824
26835
  }
26825
26836
  if (this.position == "absolute") {
26826
26837
  dom.style.top = (top2 - measured.parent.top) / scaleY + "px";
@@ -27400,7 +27411,7 @@ const showPanel = /* @__PURE__ */ Facet.define({
27400
27411
  });
27401
27412
  function showDialog(view, config2) {
27402
27413
  let resolve2;
27403
- let promise = new Promise((r) => resolve2 = r);
27414
+ let promise = new Promise((r2) => resolve2 = r2);
27404
27415
  let panelCtor = (view2) => createDialog(view2, config2, resolve2);
27405
27416
  if (view.state.field(dialogField, false)) {
27406
27417
  view.dispatch({ effects: openDialogEffect.of(panelCtor) });
@@ -28477,8 +28488,8 @@ class BaseNode {
28477
28488
  return new TreeCursor(this, mode);
28478
28489
  }
28479
28490
  getChild(type2, before = null, after = null) {
28480
- let r = getChildren(this, type2, before, after);
28481
- return r.length ? r[0] : null;
28491
+ let r2 = getChildren(this, type2, before, after);
28492
+ return r2.length ? r2[0] : null;
28482
28493
  }
28483
28494
  getChildren(type2, before = null, after = null) {
28484
28495
  return getChildren(this, type2, before, after);
@@ -29591,7 +29602,7 @@ class Parser {
29591
29602
  startParse(input, fragments, ranges) {
29592
29603
  if (typeof input == "string")
29593
29604
  input = new StringInput(input);
29594
- ranges = !ranges ? [new Range2(0, input.length)] : ranges.length ? ranges.map((r) => new Range2(r.from, r.to)) : [new Range2(0, 0)];
29605
+ ranges = !ranges ? [new Range2(0, input.length)] : ranges.length ? ranges.map((r2) => new Range2(r2.from, r2.to)) : [new Range2(0, 0)];
29595
29606
  return this.createParse(input, fragments || [], ranges);
29596
29607
  }
29597
29608
  /**
@@ -30403,8 +30414,8 @@ class Language {
30403
30414
  if (mount) {
30404
30415
  if (mount.tree.prop(languageDataProp) == this.data) {
30405
30416
  if (mount.overlay)
30406
- for (let r of mount.overlay)
30407
- result.push({ from: r.from + from, to: r.to + from });
30417
+ for (let r2 of mount.overlay)
30418
+ result.push({ from: r2.from + from, to: r2.to + from });
30408
30419
  else
30409
30420
  result.push({ from, to: from + tree.length });
30410
30421
  return;
@@ -30592,8 +30603,8 @@ class ParseContext {
30592
30603
  }
30593
30604
  }
30594
30605
  withoutTempSkipped(fragments) {
30595
- for (let r; r = this.tempSkipped.pop(); )
30596
- fragments = cutFragments(fragments, r.from, r.to);
30606
+ for (let r2; r2 = this.tempSkipped.pop(); )
30607
+ fragments = cutFragments(fragments, r2.from, r2.to);
30597
30608
  return fragments;
30598
30609
  }
30599
30610
  /**
@@ -30611,8 +30622,8 @@ class ParseContext {
30611
30622
  viewport = { from: changes.mapPos(viewport.from, -1), to: changes.mapPos(viewport.to, 1) };
30612
30623
  if (this.skipped.length) {
30613
30624
  skipped = [];
30614
- for (let r of this.skipped) {
30615
- let from = changes.mapPos(r.from, 1), to = changes.mapPos(r.to, -1);
30625
+ for (let r2 of this.skipped) {
30626
+ let from = changes.mapPos(r2.from, 1), to = changes.mapPos(r2.to, -1);
30616
30627
  if (from < to)
30617
30628
  skipped.push({ from, to });
30618
30629
  }
@@ -30675,8 +30686,8 @@ class ParseContext {
30675
30686
  advance() {
30676
30687
  let cx = currentContext;
30677
30688
  if (cx) {
30678
- for (let r of ranges)
30679
- cx.tempSkipped.push(r);
30689
+ for (let r2 of ranges)
30690
+ cx.tempSkipped.push(r2);
30680
30691
  if (until)
30681
30692
  cx.scheduleOn = cx.scheduleOn ? Promise.all([cx.scheduleOn, until]) : until;
30682
30693
  }
@@ -31140,7 +31151,7 @@ function indentOnInput() {
31140
31151
  if (head > line.from + DontIndentBeyond)
31141
31152
  return tr;
31142
31153
  let lineStart = doc2.sliceString(line.from, head);
31143
- if (!rules2.some((r) => r.test(lineStart)))
31154
+ if (!rules2.some((r2) => r2.test(lineStart)))
31144
31155
  return tr;
31145
31156
  let { state } = tr, last = -1, changes = [];
31146
31157
  for (let { head: head2 } of state.selection.ranges) {
@@ -31629,11 +31640,11 @@ function findBlockComment(state, { open, close }, from, to) {
31629
31640
  }
31630
31641
  function selectedLineRanges(state) {
31631
31642
  let ranges = [];
31632
- for (let r of state.selection.ranges) {
31633
- let fromLine = state.doc.lineAt(r.from);
31634
- let toLine = r.to <= fromLine.to ? fromLine : state.doc.lineAt(r.to);
31635
- if (toLine.from > fromLine.from && toLine.from == r.to)
31636
- toLine = r.to == fromLine.to + 1 ? fromLine : state.doc.lineAt(r.to - 1);
31643
+ for (let r2 of state.selection.ranges) {
31644
+ let fromLine = state.doc.lineAt(r2.from);
31645
+ let toLine = r2.to <= fromLine.to ? fromLine : state.doc.lineAt(r2.to);
31646
+ if (toLine.from > fromLine.from && toLine.from == r2.to)
31647
+ toLine = r2.to == fromLine.to + 1 ? fromLine : state.doc.lineAt(r2.to - 1);
31637
31648
  let last = ranges.length - 1;
31638
31649
  if (last >= 0 && ranges[last].to > fromLine.from)
31639
31650
  ranges[last].to = toLine.to;
@@ -31643,10 +31654,10 @@ function selectedLineRanges(state) {
31643
31654
  return ranges;
31644
31655
  }
31645
31656
  function changeBlockComment(option, state, ranges = state.selection.ranges) {
31646
- let tokens = ranges.map((r) => getConfig(state, r.from).block);
31657
+ let tokens = ranges.map((r2) => getConfig(state, r2.from).block);
31647
31658
  if (!tokens.every((c) => c))
31648
31659
  return null;
31649
- let comments = ranges.map((r, i) => findBlockComment(state, tokens[i], r.from, r.to));
31660
+ let comments = ranges.map((r2, i) => findBlockComment(state, tokens[i], r2.from, r2.to));
31650
31661
  if (option != 2 && !comments.every((c) => c)) {
31651
31662
  return { changes: state.changes(ranges.map((range, i) => {
31652
31663
  if (comments[i])
@@ -31862,7 +31873,7 @@ function isAdjacent(a, b) {
31862
31873
  return isAdjacent2;
31863
31874
  }
31864
31875
  function eqSelectionShape(a, b) {
31865
- return a.ranges.length == b.ranges.length && a.ranges.filter((r, i) => r.empty != b.ranges[i].empty).length === 0;
31876
+ return a.ranges.length == b.ranges.length && a.ranges.filter((r2, i) => r2.empty != b.ranges[i].empty).length === 0;
31866
31877
  }
31867
31878
  function conc(a, b) {
31868
31879
  return !a.length ? b : !b.length ? a : a.concat(b);
@@ -32212,7 +32223,7 @@ function addCursorVertically(view, forward) {
32212
32223
  for (let cur2 = range; ; ) {
32213
32224
  let next = view.moveVertically(cur2, forward);
32214
32225
  if (next.head < line.from || next.head > line.to) {
32215
- if (!ranges.some((r) => r.head == next.head))
32226
+ if (!ranges.some((r2) => r2.head == next.head))
32216
32227
  ranges.push(next);
32217
32228
  break;
32218
32229
  } else if (next.head == cur2.head) {
@@ -32394,12 +32405,12 @@ function moveLine(state, dispatch, forward) {
32394
32405
  let size = nextLine.length + 1;
32395
32406
  if (forward) {
32396
32407
  changes.push({ from: block.to, to: nextLine.to }, { from: block.from, insert: nextLine.text + state.lineBreak });
32397
- for (let r of block.ranges)
32398
- ranges.push(EditorSelection.range(Math.min(state.doc.length, r.anchor + size), Math.min(state.doc.length, r.head + size)));
32408
+ for (let r2 of block.ranges)
32409
+ ranges.push(EditorSelection.range(Math.min(state.doc.length, r2.anchor + size), Math.min(state.doc.length, r2.head + size)));
32399
32410
  } else {
32400
32411
  changes.push({ from: nextLine.from, to: block.from }, { from: block.to, insert: state.lineBreak + nextLine.text });
32401
- for (let r of block.ranges)
32402
- ranges.push(EditorSelection.range(r.anchor - size, r.head - size));
32412
+ for (let r2 of block.ranges)
32413
+ ranges.push(EditorSelection.range(r2.anchor - size, r2.head - size));
32403
32414
  }
32404
32415
  }
32405
32416
  if (!changes.length)
@@ -33052,7 +33063,7 @@ function findNextOccurrence(state, query) {
33052
33063
  cursor = new SearchCursor(state.doc, query, 0, Math.max(0, ranges[ranges.length - 1].from - 1));
33053
33064
  cycled = true;
33054
33065
  } else {
33055
- if (cycled && ranges.some((r) => r.from == cursor.value.from))
33066
+ if (cycled && ranges.some((r2) => r2.from == cursor.value.from))
33056
33067
  continue;
33057
33068
  if (fullWord) {
33058
33069
  let word2 = state.wordAt(cursor.value.from);
@@ -33068,7 +33079,7 @@ const selectNextOccurrence = ({ state, dispatch }) => {
33068
33079
  if (ranges.some((sel) => sel.from === sel.to))
33069
33080
  return selectWord({ state, dispatch });
33070
33081
  let searchedText = state.sliceDoc(ranges[0].from, ranges[0].to);
33071
- if (state.selection.ranges.some((r) => state.sliceDoc(r.from, r.to) != searchedText))
33082
+ if (state.selection.ranges.some((r2) => state.sliceDoc(r2.from, r2.to) != searchedText))
33072
33083
  return false;
33073
33084
  let range = findNextOccurrence(state, searchedText);
33074
33085
  if (!range)
@@ -33342,7 +33353,7 @@ const searchHighlighter = /* @__PURE__ */ ViewPlugin.fromClass(class {
33342
33353
  while (i < l - 1 && to > ranges[i + 1].from - 2 * 250)
33343
33354
  to = ranges[++i].to;
33344
33355
  query.highlight(view.state, from, to, (from2, to2) => {
33345
- let selected = view.state.selection.ranges.some((r) => r.from == from2 && r.to == to2);
33356
+ let selected = view.state.selection.ranges.some((r2) => r2.from == from2 && r2.to == to2);
33346
33357
  builder.add(from2, to2, selected ? selectedMatchMark : matchMark);
33347
33358
  });
33348
33359
  }
@@ -33392,7 +33403,7 @@ const selectMatches = /* @__PURE__ */ searchCommand((view, { query }) => {
33392
33403
  if (!ranges || !ranges.length)
33393
33404
  return false;
33394
33405
  view.dispatch({
33395
- selection: EditorSelection.create(ranges.map((r) => EditorSelection.range(r.from, r.to))),
33406
+ selection: EditorSelection.create(ranges.map((r2) => EditorSelection.range(r2.from, r2.to))),
33396
33407
  userEvent: "select.search.matches"
33397
33408
  });
33398
33409
  return true;
@@ -34506,11 +34517,11 @@ class InputStream {
34506
34517
  if (from >= this.range.from && to <= this.range.to)
34507
34518
  return this.input.read(from, to);
34508
34519
  let result = "";
34509
- for (let r of this.ranges) {
34510
- if (r.from >= to)
34520
+ for (let r2 of this.ranges) {
34521
+ if (r2.from >= to)
34511
34522
  break;
34512
- if (r.to > from)
34513
- result += this.input.read(Math.max(r.from, from), Math.min(r.to, to));
34523
+ if (r2.to > from)
34524
+ result += this.input.read(Math.max(r2.from, from), Math.min(r2.to, to));
34514
34525
  }
34515
34526
  return result;
34516
34527
  }
@@ -35164,7 +35175,7 @@ class LRParser extends Parser {
35164
35175
  this.minRepeatTerm = nodeNames.length;
35165
35176
  for (let i = 0; i < spec.repeatNodeCount; i++)
35166
35177
  nodeNames.push("");
35167
- let topTerms = Object.keys(spec.topRules).map((r) => spec.topRules[r][1]);
35178
+ let topTerms = Object.keys(spec.topRules).map((r2) => spec.topRules[r2][1]);
35168
35179
  let nodeProps = [];
35169
35180
  for (let i = 0; i < nodeNames.length; i++)
35170
35181
  nodeProps.push([]);
@@ -35360,13 +35371,13 @@ class LRParser extends Parser {
35360
35371
  }
35361
35372
  if (config2.tokenizers)
35362
35373
  copy.tokenizers = this.tokenizers.map((t2) => {
35363
- let found = config2.tokenizers.find((r) => r.from == t2);
35374
+ let found = config2.tokenizers.find((r2) => r2.from == t2);
35364
35375
  return found ? found.to : t2;
35365
35376
  });
35366
35377
  if (config2.specializers) {
35367
35378
  copy.specializers = this.specializers.slice();
35368
35379
  copy.specializerSpecs = this.specializerSpecs.map((s, i) => {
35369
- let found = config2.specializers.find((r) => r.from == s.external);
35380
+ let found = config2.specializers.find((r2) => r2.from == s.external);
35370
35381
  if (!found)
35371
35382
  return s;
35372
35383
  let spec = Object.assign(Object.assign({}, s), { external: found.to });
@@ -36773,7 +36784,7 @@ const completionPlugin = /* @__PURE__ */ ViewPlugin.fromClass(class {
36773
36784
  this.pendingStart = false;
36774
36785
  let { state } = this.view, cState = state.field(completionState);
36775
36786
  for (let active of cState.active) {
36776
- if (active.isPending && !this.running.some((r) => r.active.source == active.source))
36787
+ if (active.isPending && !this.running.some((r2) => r2.active.source == active.source))
36777
36788
  this.startQuery(active);
36778
36789
  }
36779
36790
  if (this.running.length && cState.open && cState.open.disabled)
@@ -37105,12 +37116,12 @@ class ActiveSnippet {
37105
37116
  constructor(ranges, active) {
37106
37117
  this.ranges = ranges;
37107
37118
  this.active = active;
37108
- this.deco = Decoration.set(ranges.map((r) => (r.from == r.to ? fieldMarker : fieldRange).range(r.from, r.to)), true);
37119
+ this.deco = Decoration.set(ranges.map((r2) => (r2.from == r2.to ? fieldMarker : fieldRange).range(r2.from, r2.to)), true);
37109
37120
  }
37110
37121
  map(changes) {
37111
37122
  let ranges = [];
37112
- for (let r of this.ranges) {
37113
- let mapped = r.map(changes);
37123
+ for (let r2 of this.ranges) {
37124
+ let mapped = r2.map(changes);
37114
37125
  if (!mapped)
37115
37126
  return null;
37116
37127
  ranges.push(mapped);
@@ -37118,7 +37129,7 @@ class ActiveSnippet {
37118
37129
  return new ActiveSnippet(ranges, this.active);
37119
37130
  }
37120
37131
  selectionInsideField(sel) {
37121
- return sel.ranges.every((range) => this.ranges.some((r) => r.field == this.active && r.from <= range.from && r.to >= range.to));
37132
+ return sel.ranges.every((range) => this.ranges.some((r2) => r2.field == this.active && r2.from <= range.from && r2.to >= range.to));
37122
37133
  }
37123
37134
  }
37124
37135
  const setActive = /* @__PURE__ */ StateEffect.define({
@@ -37147,7 +37158,7 @@ const snippetState = /* @__PURE__ */ StateField.define({
37147
37158
  provide: (f) => EditorView.decorations.from(f, (val) => val ? val.deco : Decoration.none)
37148
37159
  });
37149
37160
  function fieldSelection(ranges, field) {
37150
- return EditorSelection.create(ranges.filter((r) => r.field == field).map((r) => EditorSelection.range(r.from, r.to)));
37161
+ return EditorSelection.create(ranges.filter((r2) => r2.field == field).map((r2) => EditorSelection.range(r2.from, r2.to)));
37151
37162
  }
37152
37163
  function snippet(template) {
37153
37164
  let snippet2 = Snippet.parse(template);
@@ -37161,7 +37172,7 @@ function snippet(template) {
37161
37172
  };
37162
37173
  if (ranges.length)
37163
37174
  spec.selection = fieldSelection(ranges, 0);
37164
- if (ranges.some((r) => r.field > 0)) {
37175
+ if (ranges.some((r2) => r2.field > 0)) {
37165
37176
  let active = new ActiveSnippet(ranges, 0);
37166
37177
  let effects = spec.effects = [setActive.of(active)];
37167
37178
  if (editor.state.field(snippetState, false) === void 0)
@@ -37175,7 +37186,7 @@ function moveField(dir) {
37175
37186
  let active = state.field(snippetState, false);
37176
37187
  if (!active || dir < 0 && active.active == 0)
37177
37188
  return false;
37178
- let next = active.active + dir, last = dir > 0 && !active.ranges.some((r) => r.field == next + dir);
37189
+ let next = active.active + dir, last = dir > 0 && !active.ranges.some((r2) => r2.field == next + dir);
37179
37190
  dispatch(state.update({
37180
37191
  selection: fieldSelection(active.ranges, next),
37181
37192
  effects: setActive.of(last ? null : new ActiveSnippet(active.ranges, next)),
@@ -37211,12 +37222,12 @@ const snippetPointerHandler = /* @__PURE__ */ EditorView.domEventHandlers({
37211
37222
  let active = view.state.field(snippetState, false), pos;
37212
37223
  if (!active || (pos = view.posAtCoords({ x: event.clientX, y: event.clientY })) == null)
37213
37224
  return false;
37214
- let match = active.ranges.find((r) => r.from <= pos && r.to >= pos);
37225
+ let match = active.ranges.find((r2) => r2.from <= pos && r2.to >= pos);
37215
37226
  if (!match || match.field == active.active)
37216
37227
  return false;
37217
37228
  view.dispatch({
37218
37229
  selection: fieldSelection(active.ranges, match.field),
37219
- effects: setActive.of(active.ranges.some((r) => r.field > match.field) ? new ActiveSnippet(active.ranges, match.field) : null),
37230
+ effects: setActive.of(active.ranges.some((r2) => r2.field > match.field) ? new ActiveSnippet(active.ranges, match.field) : null),
37220
37231
  scrollIntoView: true
37221
37232
  });
37222
37233
  return true;
@@ -40038,7 +40049,7 @@ class NineDiff extends HTMLElement {
40038
40049
  const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
40039
40050
  this.shadowRoot.innerHTML = `
40040
40051
  <style>
40041
- @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.174"}/dist/css/nine-mu.css";
40052
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.175"}/dist/css/nine-mu.css";
40042
40053
  ${customImport}
40043
40054
  </style>
40044
40055
 
@@ -40148,7 +40159,7 @@ render_fn2 = function() {
40148
40159
  const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
40149
40160
  this.shadowRoot.innerHTML = `
40150
40161
  <style>
40151
- @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.174"}/dist/css/nine-mu.css";
40162
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.175"}/dist/css/nine-mu.css";
40152
40163
  ${customImport}
40153
40164
  </style>
40154
40165
 
@@ -40475,7 +40486,7 @@ class ChatMessageBody extends HTMLElement {
40475
40486
  const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
40476
40487
  this.shadowRoot.innerHTML = `
40477
40488
  <style>
40478
- @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.174"}/dist/css/nine-mu.css";
40489
+ @import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.175"}/dist/css/nine-mu.css";
40479
40490
  ${customImport}
40480
40491
  </style>
40481
40492
 
@@ -40569,7 +40580,7 @@ if (!customElements.get("nine-chat-progress")) {
40569
40580
  customElements.define("nine-chat-progress", ProgressMessage);
40570
40581
  }
40571
40582
  const NineMu = {
40572
- version: "0.1.174",
40583
+ version: "0.1.175",
40573
40584
  init: (config2) => {
40574
40585
  trace$1.log("🛠️ Nine-Mu Engine initialized", config2);
40575
40586
  }