@nine-lab/nine-mu 0.1.133 → 0.1.135
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/css/nine-mu.css +3 -1
- package/dist/nine-mu.js +284 -285
- package/dist/nine-mu.js.map +1 -1
- package/dist/nine-mu.umd.js +1 -1
- package/dist/nine-mu.umd.js.map +1 -1
- package/package.json +1 -1
- package/public/css/nine-mu.css +3 -1
- package/src/components/NineChat.js +3 -3
package/dist/nine-mu.js
CHANGED
|
@@ -31,7 +31,7 @@ class NineMuService {
|
|
|
31
31
|
* @param {Array} targets - 체크된 생성 대상 (MyBatis, Service 등)
|
|
32
32
|
* @param {Array} currentRoutes - 현재 프로젝트 경로 정보
|
|
33
33
|
*/
|
|
34
|
-
async generate(command2, targets,
|
|
34
|
+
async generate(command2, targets, currentRoutes) {
|
|
35
35
|
try {
|
|
36
36
|
trace.log(`공정 시작: "${command2}" [대상: ${targets.join(", ")}]`);
|
|
37
37
|
const response = await fetch(`${this.connectorUrl}/api/mu/generate`, {
|
|
@@ -41,7 +41,7 @@ class NineMuService {
|
|
|
41
41
|
command: command2,
|
|
42
42
|
targets,
|
|
43
43
|
projectType: "spring-react",
|
|
44
|
-
currentRoutes
|
|
44
|
+
currentRoutes
|
|
45
45
|
})
|
|
46
46
|
});
|
|
47
47
|
const result = await response.json();
|
|
@@ -56,7 +56,7 @@ class NineMuService {
|
|
|
56
56
|
}
|
|
57
57
|
async generateAll(command2) {
|
|
58
58
|
}
|
|
59
|
-
async generateAll_BAK(command2, targets,
|
|
59
|
+
async generateAll_BAK(command2, targets, currentRoutes) {
|
|
60
60
|
try {
|
|
61
61
|
trace.log(`공정 시작: "${command2}" [대상: ${targets.join(", ")}]`);
|
|
62
62
|
const srcPath = __privateGet(this, _getSourcePath).call(this, "/admin/payment/order-list");
|
|
@@ -10329,7 +10329,7 @@ function requireCore$1() {
|
|
|
10329
10329
|
errorsText(errors2 = this.errors, { separator = ", ", dataVar = "data" } = {}) {
|
|
10330
10330
|
if (!errors2 || errors2.length === 0)
|
|
10331
10331
|
return "No errors";
|
|
10332
|
-
return errors2.map((e) => `${dataVar}${e.instancePath} ${e.message}`).reduce((
|
|
10332
|
+
return errors2.map((e) => `${dataVar}${e.instancePath} ${e.message}`).reduce((text, msg) => text + separator + msg);
|
|
10333
10333
|
}
|
|
10334
10334
|
$dataMetaSchema(metaSchema, keywordsJsonPointers) {
|
|
10335
10335
|
const rules2 = this.RULES.all;
|
|
@@ -13657,7 +13657,6 @@ class NineChat extends HTMLElement {
|
|
|
13657
13657
|
__privateMethod(this, _NineChat_instances, render_fn).call(this);
|
|
13658
13658
|
__privateMethod(this, _NineChat_instances, initInteractions_fn).call(this);
|
|
13659
13659
|
__privateMethod(this, _NineChat_instances, initActions_fn).call(this);
|
|
13660
|
-
__privateGet(this, _initMcp).call(this);
|
|
13661
13660
|
const res = await api.post("/nine-mu/config/get", {});
|
|
13662
13661
|
__privateSet(this, _routesPath, (res == null ? void 0 : res.userDir) + "/" + __privateGet(this, _packageName) + "/public/prompts/data/routes.json");
|
|
13663
13662
|
__privateSet(this, _routes, await __privateGet(this, _service).fetchRoutes(this.getAttribute("route-url")));
|
|
@@ -13702,8 +13701,8 @@ initActions_fn = function() {
|
|
|
13702
13701
|
const response = await __privateGet(this, _mcpClient).callTool({
|
|
13703
13702
|
name: "ask_nine_engine",
|
|
13704
13703
|
arguments: {
|
|
13705
|
-
prompt:
|
|
13706
|
-
routes:
|
|
13704
|
+
prompt: userInput,
|
|
13705
|
+
routes: []
|
|
13707
13706
|
// 현재 화면의 메뉴 정보
|
|
13708
13707
|
}
|
|
13709
13708
|
});
|
|
@@ -13719,7 +13718,7 @@ render_fn = function() {
|
|
|
13719
13718
|
const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
|
|
13720
13719
|
this.shadowRoot.innerHTML = `
|
|
13721
13720
|
<style>
|
|
13722
|
-
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.
|
|
13721
|
+
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.134"}/dist/css/nine-mu.css";
|
|
13723
13722
|
${customImport}
|
|
13724
13723
|
</style>
|
|
13725
13724
|
<div class="wrapper">
|
|
@@ -13854,7 +13853,7 @@ class Text {
|
|
|
13854
13853
|
/**
|
|
13855
13854
|
Replace a range of the text with the given content.
|
|
13856
13855
|
*/
|
|
13857
|
-
replace(from, to,
|
|
13856
|
+
replace(from, to, text) {
|
|
13858
13857
|
[from, to] = clip(this, from, to);
|
|
13859
13858
|
let parts = [];
|
|
13860
13859
|
this.decompose(
|
|
@@ -13864,10 +13863,10 @@ class Text {
|
|
|
13864
13863
|
2
|
|
13865
13864
|
/* Open.To */
|
|
13866
13865
|
);
|
|
13867
|
-
if (
|
|
13868
|
-
|
|
13866
|
+
if (text.length)
|
|
13867
|
+
text.decompose(
|
|
13869
13868
|
0,
|
|
13870
|
-
|
|
13869
|
+
text.length,
|
|
13871
13870
|
parts,
|
|
13872
13871
|
1 | 2
|
|
13873
13872
|
/* Open.To */
|
|
@@ -13879,7 +13878,7 @@ class Text {
|
|
|
13879
13878
|
1
|
|
13880
13879
|
/* Open.From */
|
|
13881
13880
|
);
|
|
13882
|
-
return TextNode.from(parts, this.length - (to - from) +
|
|
13881
|
+
return TextNode.from(parts, this.length - (to - from) + text.length);
|
|
13883
13882
|
}
|
|
13884
13883
|
/**
|
|
13885
13884
|
Append another document to this one.
|
|
@@ -13975,18 +13974,18 @@ class Text {
|
|
|
13975
13974
|
/**
|
|
13976
13975
|
Create a `Text` instance for the given array of lines.
|
|
13977
13976
|
*/
|
|
13978
|
-
static of(
|
|
13979
|
-
if (
|
|
13977
|
+
static of(text) {
|
|
13978
|
+
if (text.length == 0)
|
|
13980
13979
|
throw new RangeError("A document must have at least one line");
|
|
13981
|
-
if (
|
|
13980
|
+
if (text.length == 1 && !text[0])
|
|
13982
13981
|
return Text.empty;
|
|
13983
|
-
return
|
|
13982
|
+
return text.length <= 32 ? new TextLeaf(text) : TextNode.from(TextLeaf.split(text, []));
|
|
13984
13983
|
}
|
|
13985
13984
|
}
|
|
13986
13985
|
class TextLeaf extends Text {
|
|
13987
|
-
constructor(
|
|
13986
|
+
constructor(text, length = textLength(text)) {
|
|
13988
13987
|
super();
|
|
13989
|
-
this.text =
|
|
13988
|
+
this.text = text;
|
|
13990
13989
|
this.length = length;
|
|
13991
13990
|
}
|
|
13992
13991
|
get lines() {
|
|
@@ -14005,26 +14004,26 @@ class TextLeaf extends Text {
|
|
|
14005
14004
|
}
|
|
14006
14005
|
}
|
|
14007
14006
|
decompose(from, to, target, open) {
|
|
14008
|
-
let
|
|
14007
|
+
let text = from <= 0 && to >= this.length ? this : new TextLeaf(sliceText(this.text, from, to), Math.min(to, this.length) - Math.max(0, from));
|
|
14009
14008
|
if (open & 1) {
|
|
14010
14009
|
let prev = target.pop();
|
|
14011
|
-
let joined = appendText(
|
|
14010
|
+
let joined = appendText(text.text, prev.text.slice(), 0, text.length);
|
|
14012
14011
|
if (joined.length <= 32) {
|
|
14013
|
-
target.push(new TextLeaf(joined, prev.length +
|
|
14012
|
+
target.push(new TextLeaf(joined, prev.length + text.length));
|
|
14014
14013
|
} else {
|
|
14015
14014
|
let mid = joined.length >> 1;
|
|
14016
14015
|
target.push(new TextLeaf(joined.slice(0, mid)), new TextLeaf(joined.slice(mid)));
|
|
14017
14016
|
}
|
|
14018
14017
|
} else {
|
|
14019
|
-
target.push(
|
|
14018
|
+
target.push(text);
|
|
14020
14019
|
}
|
|
14021
14020
|
}
|
|
14022
|
-
replace(from, to,
|
|
14023
|
-
if (!(
|
|
14024
|
-
return super.replace(from, to,
|
|
14021
|
+
replace(from, to, text) {
|
|
14022
|
+
if (!(text instanceof TextLeaf))
|
|
14023
|
+
return super.replace(from, to, text);
|
|
14025
14024
|
[from, to] = clip(this, from, to);
|
|
14026
|
-
let lines = appendText(this.text, appendText(
|
|
14027
|
-
let newLen = this.length +
|
|
14025
|
+
let lines = appendText(this.text, appendText(text.text, sliceText(this.text, 0, from)), to);
|
|
14026
|
+
let newLen = this.length + text.length - (to - from);
|
|
14028
14027
|
if (lines.length <= 32)
|
|
14029
14028
|
return new TextLeaf(lines, newLen);
|
|
14030
14029
|
return TextNode.from(TextLeaf.split(lines, []), newLen);
|
|
@@ -14049,9 +14048,9 @@ class TextLeaf extends Text {
|
|
|
14049
14048
|
scanIdentical() {
|
|
14050
14049
|
return 0;
|
|
14051
14050
|
}
|
|
14052
|
-
static split(
|
|
14051
|
+
static split(text, target) {
|
|
14053
14052
|
let part = [], len = -1;
|
|
14054
|
-
for (let line of
|
|
14053
|
+
for (let line of text) {
|
|
14055
14054
|
part.push(line);
|
|
14056
14055
|
len += line.length + 1;
|
|
14057
14056
|
if (part.length == 32) {
|
|
@@ -14096,24 +14095,24 @@ class TextNode extends Text {
|
|
|
14096
14095
|
pos = end + 1;
|
|
14097
14096
|
}
|
|
14098
14097
|
}
|
|
14099
|
-
replace(from, to,
|
|
14098
|
+
replace(from, to, text) {
|
|
14100
14099
|
[from, to] = clip(this, from, to);
|
|
14101
|
-
if (
|
|
14100
|
+
if (text.lines < this.lines)
|
|
14102
14101
|
for (let i = 0, pos = 0; i < this.children.length; i++) {
|
|
14103
14102
|
let child = this.children[i], end = pos + child.length;
|
|
14104
14103
|
if (from >= pos && to <= end) {
|
|
14105
|
-
let updated = child.replace(from - pos, to - pos,
|
|
14104
|
+
let updated = child.replace(from - pos, to - pos, text);
|
|
14106
14105
|
let totalLines = this.lines - child.lines + updated.lines;
|
|
14107
14106
|
if (updated.lines < totalLines >> 5 - 1 && updated.lines > totalLines >> 5 + 1) {
|
|
14108
14107
|
let copy = this.children.slice();
|
|
14109
14108
|
copy[i] = updated;
|
|
14110
|
-
return new TextNode(copy, this.length - (to - from) +
|
|
14109
|
+
return new TextNode(copy, this.length - (to - from) + text.length);
|
|
14111
14110
|
}
|
|
14112
14111
|
return super.replace(pos, end, updated);
|
|
14113
14112
|
}
|
|
14114
14113
|
pos = end + 1;
|
|
14115
14114
|
}
|
|
14116
|
-
return super.replace(from, to,
|
|
14115
|
+
return super.replace(from, to, text);
|
|
14117
14116
|
}
|
|
14118
14117
|
sliceString(from, to = this.length, lineSep = "\n") {
|
|
14119
14118
|
[from, to] = clip(this, from, to);
|
|
@@ -14196,15 +14195,15 @@ class TextNode extends Text {
|
|
|
14196
14195
|
}
|
|
14197
14196
|
}
|
|
14198
14197
|
Text.empty = /* @__PURE__ */ new TextLeaf([""], 0);
|
|
14199
|
-
function textLength(
|
|
14198
|
+
function textLength(text) {
|
|
14200
14199
|
let length = -1;
|
|
14201
|
-
for (let line of
|
|
14200
|
+
for (let line of text)
|
|
14202
14201
|
length += line.length + 1;
|
|
14203
14202
|
return length;
|
|
14204
14203
|
}
|
|
14205
|
-
function appendText(
|
|
14206
|
-
for (let pos = 0, i = 0, first = true; i <
|
|
14207
|
-
let line =
|
|
14204
|
+
function appendText(text, target, from = 0, to = 1e9) {
|
|
14205
|
+
for (let pos = 0, i = 0, first = true; i < text.length && pos <= to; i++) {
|
|
14206
|
+
let line = text[i], end = pos + line.length;
|
|
14208
14207
|
if (end >= from) {
|
|
14209
14208
|
if (end > to)
|
|
14210
14209
|
line = line.slice(0, to - pos);
|
|
@@ -14220,17 +14219,17 @@ function appendText(text2, target, from = 0, to = 1e9) {
|
|
|
14220
14219
|
}
|
|
14221
14220
|
return target;
|
|
14222
14221
|
}
|
|
14223
|
-
function sliceText(
|
|
14224
|
-
return appendText(
|
|
14222
|
+
function sliceText(text, from, to) {
|
|
14223
|
+
return appendText(text, [""], from, to);
|
|
14225
14224
|
}
|
|
14226
14225
|
class RawTextCursor {
|
|
14227
|
-
constructor(
|
|
14226
|
+
constructor(text, dir = 1) {
|
|
14228
14227
|
this.dir = dir;
|
|
14229
14228
|
this.done = false;
|
|
14230
14229
|
this.lineBreak = false;
|
|
14231
14230
|
this.value = "";
|
|
14232
|
-
this.nodes = [
|
|
14233
|
-
this.offsets = [dir > 0 ? 1 : (
|
|
14231
|
+
this.nodes = [text];
|
|
14232
|
+
this.offsets = [dir > 0 ? 1 : (text instanceof TextLeaf ? text.text.length : text.children.length) << 1];
|
|
14234
14233
|
}
|
|
14235
14234
|
nextInner(skip, dir) {
|
|
14236
14235
|
this.done = this.lineBreak = false;
|
|
@@ -14287,11 +14286,11 @@ class RawTextCursor {
|
|
|
14287
14286
|
}
|
|
14288
14287
|
}
|
|
14289
14288
|
class PartialTextCursor {
|
|
14290
|
-
constructor(
|
|
14289
|
+
constructor(text, start, end) {
|
|
14291
14290
|
this.value = "";
|
|
14292
14291
|
this.done = false;
|
|
14293
|
-
this.cursor = new RawTextCursor(
|
|
14294
|
-
this.pos = start > end ?
|
|
14292
|
+
this.cursor = new RawTextCursor(text, start > end ? -1 : 1);
|
|
14293
|
+
this.pos = start > end ? text.length : 0;
|
|
14295
14294
|
this.from = Math.min(start, end);
|
|
14296
14295
|
this.to = Math.max(start, end);
|
|
14297
14296
|
}
|
|
@@ -14367,11 +14366,11 @@ class Line {
|
|
|
14367
14366
|
/**
|
|
14368
14367
|
@internal
|
|
14369
14368
|
*/
|
|
14370
|
-
constructor(from, to, number2,
|
|
14369
|
+
constructor(from, to, number2, text) {
|
|
14371
14370
|
this.from = from;
|
|
14372
14371
|
this.to = to;
|
|
14373
14372
|
this.number = number2;
|
|
14374
|
-
this.text =
|
|
14373
|
+
this.text = text;
|
|
14375
14374
|
}
|
|
14376
14375
|
/**
|
|
14377
14376
|
The length of the line (not including any line break after it).
|
|
@@ -14380,9 +14379,9 @@ class Line {
|
|
|
14380
14379
|
return this.to - this.from;
|
|
14381
14380
|
}
|
|
14382
14381
|
}
|
|
14383
|
-
function clip(
|
|
14384
|
-
from = Math.max(0, Math.min(
|
|
14385
|
-
return [from, Math.max(from, Math.min(
|
|
14382
|
+
function clip(text, from, to) {
|
|
14383
|
+
from = Math.max(0, Math.min(text.length, from));
|
|
14384
|
+
return [from, Math.max(from, Math.min(text.length, to))];
|
|
14386
14385
|
}
|
|
14387
14386
|
function findClusterBreak(str, pos, forward = true, includeExtending = true) {
|
|
14388
14387
|
return findClusterBreak$1(str, pos, forward, includeExtending);
|
|
@@ -14600,7 +14599,7 @@ class ChangeSet extends ChangeDesc {
|
|
|
14600
14599
|
apply(doc2) {
|
|
14601
14600
|
if (this.length != doc2.length)
|
|
14602
14601
|
throw new RangeError("Applying change set to a document with the wrong length");
|
|
14603
|
-
iterChanges(this, (fromA, toA, fromB, _toB,
|
|
14602
|
+
iterChanges(this, (fromA, toA, fromB, _toB, text) => doc2 = doc2.replace(fromB, fromB + (toA - fromA), text), false);
|
|
14604
14603
|
return doc2;
|
|
14605
14604
|
}
|
|
14606
14605
|
mapDesc(other, before = false) {
|
|
@@ -14844,18 +14843,18 @@ function iterChanges(desc, f, individual) {
|
|
|
14844
14843
|
posA += len;
|
|
14845
14844
|
posB += len;
|
|
14846
14845
|
} else {
|
|
14847
|
-
let endA = posA, endB = posB,
|
|
14846
|
+
let endA = posA, endB = posB, text = Text.empty;
|
|
14848
14847
|
for (; ; ) {
|
|
14849
14848
|
endA += len;
|
|
14850
14849
|
endB += ins;
|
|
14851
14850
|
if (ins && inserted)
|
|
14852
|
-
|
|
14851
|
+
text = text.append(inserted[i - 2 >> 1]);
|
|
14853
14852
|
if (individual || i == desc.sections.length || desc.sections[i + 1] < 0)
|
|
14854
14853
|
break;
|
|
14855
14854
|
len = desc.sections[i++];
|
|
14856
14855
|
ins = desc.sections[i++];
|
|
14857
14856
|
}
|
|
14858
|
-
f(posA, endA, posB, endB,
|
|
14857
|
+
f(posA, endA, posB, endB, text);
|
|
14859
14858
|
posA = endA;
|
|
14860
14859
|
posB = endB;
|
|
14861
14860
|
}
|
|
@@ -16110,12 +16109,12 @@ class EditorState {
|
|
|
16110
16109
|
Create a [transaction spec](https://codemirror.net/6/docs/ref/#state.TransactionSpec) that
|
|
16111
16110
|
replaces every selection range with the given content.
|
|
16112
16111
|
*/
|
|
16113
|
-
replaceSelection(
|
|
16114
|
-
if (typeof
|
|
16115
|
-
|
|
16112
|
+
replaceSelection(text) {
|
|
16113
|
+
if (typeof text == "string")
|
|
16114
|
+
text = this.toText(text);
|
|
16116
16115
|
return this.changeByRange((range) => ({
|
|
16117
|
-
changes: { from: range.from, to: range.to, insert:
|
|
16118
|
-
range: EditorSelection.cursor(range.from +
|
|
16116
|
+
changes: { from: range.from, to: range.to, insert: text },
|
|
16117
|
+
range: EditorSelection.cursor(range.from + text.length)
|
|
16119
16118
|
}));
|
|
16120
16119
|
}
|
|
16121
16120
|
/**
|
|
@@ -16334,18 +16333,18 @@ class EditorState {
|
|
|
16334
16333
|
this returns null.
|
|
16335
16334
|
*/
|
|
16336
16335
|
wordAt(pos) {
|
|
16337
|
-
let { text
|
|
16336
|
+
let { text, from, length } = this.doc.lineAt(pos);
|
|
16338
16337
|
let cat = this.charCategorizer(pos);
|
|
16339
16338
|
let start = pos - from, end = pos - from;
|
|
16340
16339
|
while (start > 0) {
|
|
16341
|
-
let prev = findClusterBreak(
|
|
16342
|
-
if (cat(
|
|
16340
|
+
let prev = findClusterBreak(text, start, false);
|
|
16341
|
+
if (cat(text.slice(prev, start)) != CharCategory.Word)
|
|
16343
16342
|
break;
|
|
16344
16343
|
start = prev;
|
|
16345
16344
|
}
|
|
16346
16345
|
while (end < length) {
|
|
16347
|
-
let next = findClusterBreak(
|
|
16348
|
-
if (cat(
|
|
16346
|
+
let next = findClusterBreak(text, end);
|
|
16347
|
+
if (cat(text.slice(end, next)) != CharCategory.Word)
|
|
16349
16348
|
break;
|
|
16350
16349
|
end = next;
|
|
16351
16350
|
}
|
|
@@ -17300,10 +17299,10 @@ class StyleSet {
|
|
|
17300
17299
|
if (root.adoptedStyleSheets.indexOf(this.sheet) < 0)
|
|
17301
17300
|
root.adoptedStyleSheets = [this.sheet, ...root.adoptedStyleSheets];
|
|
17302
17301
|
} else {
|
|
17303
|
-
let
|
|
17302
|
+
let text = "";
|
|
17304
17303
|
for (let i = 0; i < this.modules.length; i++)
|
|
17305
|
-
|
|
17306
|
-
this.styleTag.textContent =
|
|
17304
|
+
text += this.modules[i].getRules() + "\n";
|
|
17305
|
+
this.styleTag.textContent = text;
|
|
17307
17306
|
let target = root.head || root;
|
|
17308
17307
|
if (this.styleTag.parentNode != target)
|
|
17309
17308
|
target.insertBefore(this.styleTag, target.firstChild);
|
|
@@ -18529,9 +18528,9 @@ function moveVisually(line, order, dir, start, forward) {
|
|
|
18529
18528
|
return EditorSelection.cursor(nextSpan.side(!forward, dir) + line.from, nextSpan.forward(forward, dir) ? 1 : -1, nextSpan.level);
|
|
18530
18529
|
return EditorSelection.cursor(nextIndex + line.from, span.forward(forward, dir) ? -1 : 1, span.level);
|
|
18531
18530
|
}
|
|
18532
|
-
function autoDirection(
|
|
18531
|
+
function autoDirection(text, from, to) {
|
|
18533
18532
|
for (let i = from; i < to; i++) {
|
|
18534
|
-
let type2 = charType(
|
|
18533
|
+
let type2 = charType(text.charCodeAt(i));
|
|
18535
18534
|
if (type2 == 1)
|
|
18536
18535
|
return LTR;
|
|
18537
18536
|
if (type2 == 2 || type2 == 4)
|
|
@@ -19234,9 +19233,9 @@ class MarkTile extends CompositeTile {
|
|
|
19234
19233
|
}
|
|
19235
19234
|
}
|
|
19236
19235
|
class TextTile extends Tile {
|
|
19237
|
-
constructor(dom,
|
|
19238
|
-
super(dom,
|
|
19239
|
-
this.text =
|
|
19236
|
+
constructor(dom, text) {
|
|
19237
|
+
super(dom, text.length);
|
|
19238
|
+
this.text = text;
|
|
19240
19239
|
}
|
|
19241
19240
|
sync(track) {
|
|
19242
19241
|
if (this.flags & 2)
|
|
@@ -19283,8 +19282,8 @@ class TextTile extends Tile {
|
|
|
19283
19282
|
rect = Array.prototype.find.call(rects, (r) => r.width) || rect;
|
|
19284
19283
|
return flatten2 ? flattenRect(rect, flatten2 < 0) : rect || null;
|
|
19285
19284
|
}
|
|
19286
|
-
static of(
|
|
19287
|
-
let tile = new TextTile(dom || document.createTextNode(
|
|
19285
|
+
static of(text, dom) {
|
|
19286
|
+
let tile = new TextTile(dom || document.createTextNode(text), text);
|
|
19288
19287
|
if (!dom)
|
|
19289
19288
|
tile.flags |= 2;
|
|
19290
19289
|
return tile;
|
|
@@ -19454,23 +19453,23 @@ class TileBuilder {
|
|
|
19454
19453
|
this.wrappers = [];
|
|
19455
19454
|
this.wrapperPos = 0;
|
|
19456
19455
|
}
|
|
19457
|
-
addText(
|
|
19456
|
+
addText(text, marks, openStart, tile) {
|
|
19458
19457
|
var _a2;
|
|
19459
19458
|
this.flushBuffer();
|
|
19460
19459
|
let parent = this.ensureMarks(marks, openStart);
|
|
19461
19460
|
let prev = parent.lastChild;
|
|
19462
|
-
if (prev && prev.isText() && !(prev.flags & 8) && prev.length +
|
|
19461
|
+
if (prev && prev.isText() && !(prev.flags & 8) && prev.length + text.length < 512) {
|
|
19463
19462
|
this.cache.reused.set(
|
|
19464
19463
|
prev,
|
|
19465
19464
|
2
|
|
19466
19465
|
/* Reused.DOM */
|
|
19467
19466
|
);
|
|
19468
|
-
let tile2 = parent.children[parent.children.length - 1] = new TextTile(prev.dom, prev.text +
|
|
19467
|
+
let tile2 = parent.children[parent.children.length - 1] = new TextTile(prev.dom, prev.text + text);
|
|
19469
19468
|
tile2.parent = parent;
|
|
19470
19469
|
} else {
|
|
19471
|
-
parent.append(tile || TextTile.of(
|
|
19470
|
+
parent.append(tile || TextTile.of(text, (_a2 = this.cache.find(TextTile)) === null || _a2 === void 0 ? void 0 : _a2.dom));
|
|
19472
19471
|
}
|
|
19473
|
-
this.pos +=
|
|
19472
|
+
this.pos += text.length;
|
|
19474
19473
|
this.afterWidget = null;
|
|
19475
19474
|
}
|
|
19476
19475
|
addComposition(composition, context) {
|
|
@@ -19514,10 +19513,10 @@ class TileBuilder {
|
|
|
19514
19513
|
2
|
|
19515
19514
|
/* Reused.DOM */
|
|
19516
19515
|
);
|
|
19517
|
-
let
|
|
19518
|
-
|
|
19516
|
+
let text = new TextTile(composition.text, composition.text.nodeValue);
|
|
19517
|
+
text.flags |= 8;
|
|
19519
19518
|
this.pos = composition.range.toB;
|
|
19520
|
-
head.append(
|
|
19519
|
+
head.append(text);
|
|
19521
19520
|
}
|
|
19522
19521
|
addInlineWidget(widget, marks, openStart) {
|
|
19523
19522
|
let noSpace = this.afterWidget && widget.flags & 48 && (this.afterWidget.flags & 48) == (widget.flags & 48);
|
|
@@ -19989,9 +19988,9 @@ class TileUpdate {
|
|
|
19989
19988
|
this.old.advance(5, side, this.reuseWalker);
|
|
19990
19989
|
}
|
|
19991
19990
|
}
|
|
19992
|
-
getCompositionContext(
|
|
19991
|
+
getCompositionContext(text) {
|
|
19993
19992
|
let marks = [], line = null;
|
|
19994
|
-
for (let parent =
|
|
19993
|
+
for (let parent = text.parentNode; ; parent = parent.parentNode) {
|
|
19995
19994
|
let tile = Tile.get(parent);
|
|
19996
19995
|
if (parent == this.view.contentDOM)
|
|
19997
19996
|
break;
|
|
@@ -20230,9 +20229,9 @@ class DocView {
|
|
|
20230
20229
|
if (browser.gecko) {
|
|
20231
20230
|
let nextTo = nextToUneditable(anchor.node, anchor.offset);
|
|
20232
20231
|
if (nextTo && nextTo != (1 | 2)) {
|
|
20233
|
-
let
|
|
20234
|
-
if (
|
|
20235
|
-
anchor = new DOMPos(
|
|
20232
|
+
let text = (nextTo == 1 ? textNodeBefore : textNodeAfter)(anchor.node, anchor.offset);
|
|
20233
|
+
if (text)
|
|
20234
|
+
anchor = new DOMPos(text.node, text.offset);
|
|
20236
20235
|
}
|
|
20237
20236
|
}
|
|
20238
20237
|
rawSel.collapse(anchor.node, anchor.offset);
|
|
@@ -20646,10 +20645,10 @@ function findCompositionRange(view, changes, headPos) {
|
|
|
20646
20645
|
let found = findCompositionNode(view, headPos);
|
|
20647
20646
|
if (!found)
|
|
20648
20647
|
return null;
|
|
20649
|
-
let { node: textNode, from, to } = found,
|
|
20650
|
-
if (/[\n\r]/.test(
|
|
20648
|
+
let { node: textNode, from, to } = found, text = textNode.nodeValue;
|
|
20649
|
+
if (/[\n\r]/.test(text))
|
|
20651
20650
|
return null;
|
|
20652
|
-
if (view.state.doc.sliceString(found.from, found.to) !=
|
|
20651
|
+
if (view.state.doc.sliceString(found.from, found.to) != text)
|
|
20653
20652
|
return null;
|
|
20654
20653
|
let inv = changes.invertedDesc;
|
|
20655
20654
|
return { range: new ChangedRange(inv.mapPos(from), inv.mapPos(to), from, to), text: textNode };
|
|
@@ -21119,8 +21118,8 @@ class DOMReader {
|
|
|
21119
21118
|
this.text = "";
|
|
21120
21119
|
this.lineSeparator = view.state.facet(EditorState.lineSeparator);
|
|
21121
21120
|
}
|
|
21122
|
-
append(
|
|
21123
|
-
this.text +=
|
|
21121
|
+
append(text) {
|
|
21122
|
+
this.text += text;
|
|
21124
21123
|
}
|
|
21125
21124
|
lineBreak() {
|
|
21126
21125
|
this.text += LineBreakPlaceholder;
|
|
@@ -21148,20 +21147,20 @@ class DOMReader {
|
|
|
21148
21147
|
return this;
|
|
21149
21148
|
}
|
|
21150
21149
|
readTextNode(node) {
|
|
21151
|
-
let
|
|
21150
|
+
let text = node.nodeValue;
|
|
21152
21151
|
for (let point of this.points)
|
|
21153
21152
|
if (point.node == node)
|
|
21154
|
-
point.pos = this.text.length + Math.min(point.offset,
|
|
21153
|
+
point.pos = this.text.length + Math.min(point.offset, text.length);
|
|
21155
21154
|
for (let off = 0, re = this.lineSeparator ? null : /\r\n?|\n/g; ; ) {
|
|
21156
21155
|
let nextBreak = -1, breakSize = 1, m;
|
|
21157
21156
|
if (this.lineSeparator) {
|
|
21158
|
-
nextBreak =
|
|
21157
|
+
nextBreak = text.indexOf(this.lineSeparator, off);
|
|
21159
21158
|
breakSize = this.lineSeparator.length;
|
|
21160
|
-
} else if (m = re.exec(
|
|
21159
|
+
} else if (m = re.exec(text)) {
|
|
21161
21160
|
nextBreak = m.index;
|
|
21162
21161
|
breakSize = m[0].length;
|
|
21163
21162
|
}
|
|
21164
|
-
this.append(
|
|
21163
|
+
this.append(text.slice(off, nextBreak < 0 ? text.length : nextBreak));
|
|
21165
21164
|
if (nextBreak < 0)
|
|
21166
21165
|
break;
|
|
21167
21166
|
this.lineBreak();
|
|
@@ -21384,12 +21383,12 @@ function applyDOMChangeInner(view, change, newSel, lastKey = -1) {
|
|
|
21384
21383
|
// after a completion when you press enter
|
|
21385
21384
|
(change.from == sel.from || change.from == sel.from - 1 && view.state.sliceDoc(change.from, sel.from) == " ") && change.insert.length == 1 && change.insert.lines == 2 && dispatchKey(view.contentDOM, "Enter", 13) || (change.from == sel.from - 1 && change.to == sel.to && change.insert.length == 0 || lastKey == 8 && change.insert.length < change.to - change.from && change.to > sel.head) && dispatchKey(view.contentDOM, "Backspace", 8) || change.from == sel.from && change.to == sel.to + 1 && change.insert.length == 0 && dispatchKey(view.contentDOM, "Delete", 46)))
|
|
21386
21385
|
return true;
|
|
21387
|
-
let
|
|
21386
|
+
let text = change.insert.toString();
|
|
21388
21387
|
if (view.inputState.composing >= 0)
|
|
21389
21388
|
view.inputState.composing++;
|
|
21390
21389
|
let defaultTr;
|
|
21391
21390
|
let defaultInsert = () => defaultTr || (defaultTr = applyDefaultInsert(view, change, newSel));
|
|
21392
|
-
if (!view.state.facet(inputHandler).some((h) => h(view, change.from, change.to,
|
|
21391
|
+
if (!view.state.facet(inputHandler).some((h) => h(view, change.from, change.to, text, defaultInsert)))
|
|
21393
21392
|
view.dispatch(defaultInsert());
|
|
21394
21393
|
return true;
|
|
21395
21394
|
}
|
|
@@ -21848,16 +21847,16 @@ function capturePaste(view) {
|
|
|
21848
21847
|
doPaste(view, target.value);
|
|
21849
21848
|
}, 50);
|
|
21850
21849
|
}
|
|
21851
|
-
function textFilter(state, facet,
|
|
21850
|
+
function textFilter(state, facet, text) {
|
|
21852
21851
|
for (let filter of state.facet(facet))
|
|
21853
|
-
|
|
21854
|
-
return
|
|
21852
|
+
text = filter(text, state);
|
|
21853
|
+
return text;
|
|
21855
21854
|
}
|
|
21856
21855
|
function doPaste(view, input) {
|
|
21857
21856
|
input = textFilter(view.state, clipboardInputFilter, input);
|
|
21858
|
-
let { state } = view, changes, i = 1,
|
|
21859
|
-
let byLine =
|
|
21860
|
-
let linewise = lastLinewiseCopy != null && state.selection.ranges.every((r) => r.empty) && lastLinewiseCopy ==
|
|
21857
|
+
let { state } = view, changes, i = 1, text = state.toText(input);
|
|
21858
|
+
let byLine = text.lines == state.selection.ranges.length;
|
|
21859
|
+
let linewise = lastLinewiseCopy != null && state.selection.ranges.every((r) => r.empty) && lastLinewiseCopy == text.toString();
|
|
21861
21860
|
if (linewise) {
|
|
21862
21861
|
let lastLine = -1;
|
|
21863
21862
|
changes = state.changeByRange((range) => {
|
|
@@ -21865,7 +21864,7 @@ function doPaste(view, input) {
|
|
|
21865
21864
|
if (line.from == lastLine)
|
|
21866
21865
|
return { range };
|
|
21867
21866
|
lastLine = line.from;
|
|
21868
|
-
let insert2 = state.toText((byLine ?
|
|
21867
|
+
let insert2 = state.toText((byLine ? text.line(i++).text : input) + state.lineBreak);
|
|
21869
21868
|
return {
|
|
21870
21869
|
changes: { from: line.from, insert: insert2 },
|
|
21871
21870
|
range: EditorSelection.cursor(range.from + insert2.length)
|
|
@@ -21873,14 +21872,14 @@ function doPaste(view, input) {
|
|
|
21873
21872
|
});
|
|
21874
21873
|
} else if (byLine) {
|
|
21875
21874
|
changes = state.changeByRange((range) => {
|
|
21876
|
-
let line =
|
|
21875
|
+
let line = text.line(i++);
|
|
21877
21876
|
return {
|
|
21878
21877
|
changes: { from: range.from, to: range.to, insert: line.text },
|
|
21879
21878
|
range: EditorSelection.cursor(range.from + line.length)
|
|
21880
21879
|
};
|
|
21881
21880
|
});
|
|
21882
21881
|
} else {
|
|
21883
|
-
changes = state.replaceSelection(
|
|
21882
|
+
changes = state.replaceSelection(text);
|
|
21884
21883
|
}
|
|
21885
21884
|
view.dispatch(changes, {
|
|
21886
21885
|
userEvent: "input.paste",
|
|
@@ -22028,14 +22027,14 @@ handlers.dragend = (view) => {
|
|
|
22028
22027
|
view.inputState.draggedContent = null;
|
|
22029
22028
|
return false;
|
|
22030
22029
|
};
|
|
22031
|
-
function dropText(view, event,
|
|
22032
|
-
|
|
22033
|
-
if (!
|
|
22030
|
+
function dropText(view, event, text, direct) {
|
|
22031
|
+
text = textFilter(view.state, clipboardInputFilter, text);
|
|
22032
|
+
if (!text)
|
|
22034
22033
|
return;
|
|
22035
22034
|
let dropPos = view.posAtCoords({ x: event.clientX, y: event.clientY }, false);
|
|
22036
22035
|
let { draggedContent } = view.inputState;
|
|
22037
22036
|
let del = direct && draggedContent && dragMovesSelection(view, event) ? { from: draggedContent.from, to: draggedContent.to } : null;
|
|
22038
|
-
let ins = { from: dropPos, insert:
|
|
22037
|
+
let ins = { from: dropPos, insert: text };
|
|
22039
22038
|
let changes = view.state.changes(del ? [del, ins] : ins);
|
|
22040
22039
|
view.focus();
|
|
22041
22040
|
view.dispatch({
|
|
@@ -22052,26 +22051,26 @@ handlers.drop = (view, event) => {
|
|
|
22052
22051
|
return true;
|
|
22053
22052
|
let files = event.dataTransfer.files;
|
|
22054
22053
|
if (files && files.length) {
|
|
22055
|
-
let
|
|
22054
|
+
let text = Array(files.length), read = 0;
|
|
22056
22055
|
let finishFile = () => {
|
|
22057
22056
|
if (++read == files.length)
|
|
22058
|
-
dropText(view, event,
|
|
22057
|
+
dropText(view, event, text.filter((s) => s != null).join(view.state.lineBreak), false);
|
|
22059
22058
|
};
|
|
22060
22059
|
for (let i = 0; i < files.length; i++) {
|
|
22061
22060
|
let reader = new FileReader();
|
|
22062
22061
|
reader.onerror = finishFile;
|
|
22063
22062
|
reader.onload = () => {
|
|
22064
22063
|
if (!/[\x00-\x08\x0e-\x1f]{2}/.test(reader.result))
|
|
22065
|
-
|
|
22064
|
+
text[i] = reader.result;
|
|
22066
22065
|
finishFile();
|
|
22067
22066
|
};
|
|
22068
22067
|
reader.readAsText(files[i]);
|
|
22069
22068
|
}
|
|
22070
22069
|
return true;
|
|
22071
22070
|
} else {
|
|
22072
|
-
let
|
|
22073
|
-
if (
|
|
22074
|
-
dropText(view, event,
|
|
22071
|
+
let text = event.dataTransfer.getData("Text");
|
|
22072
|
+
if (text) {
|
|
22073
|
+
dropText(view, event, text, true);
|
|
22075
22074
|
return true;
|
|
22076
22075
|
}
|
|
22077
22076
|
}
|
|
@@ -22090,15 +22089,15 @@ handlers.paste = (view, event) => {
|
|
|
22090
22089
|
return false;
|
|
22091
22090
|
}
|
|
22092
22091
|
};
|
|
22093
|
-
function captureCopy(view,
|
|
22092
|
+
function captureCopy(view, text) {
|
|
22094
22093
|
let parent = view.dom.parentNode;
|
|
22095
22094
|
if (!parent)
|
|
22096
22095
|
return;
|
|
22097
22096
|
let target = parent.appendChild(document.createElement("textarea"));
|
|
22098
22097
|
target.style.cssText = "position: fixed; left: -10000px; top: 10px";
|
|
22099
|
-
target.value =
|
|
22098
|
+
target.value = text;
|
|
22100
22099
|
target.focus();
|
|
22101
|
-
target.selectionEnd =
|
|
22100
|
+
target.selectionEnd = text.length;
|
|
22102
22101
|
target.selectionStart = 0;
|
|
22103
22102
|
setTimeout(() => {
|
|
22104
22103
|
target.remove();
|
|
@@ -22130,10 +22129,10 @@ let lastLinewiseCopy = null;
|
|
|
22130
22129
|
handlers.copy = handlers.cut = (view, event) => {
|
|
22131
22130
|
if (!hasSelection(view.contentDOM, view.observer.selectionRange))
|
|
22132
22131
|
return false;
|
|
22133
|
-
let { text
|
|
22134
|
-
if (!
|
|
22132
|
+
let { text, ranges, linewise } = copiedRange(view.state);
|
|
22133
|
+
if (!text && !linewise)
|
|
22135
22134
|
return false;
|
|
22136
|
-
lastLinewiseCopy = linewise ?
|
|
22135
|
+
lastLinewiseCopy = linewise ? text : null;
|
|
22137
22136
|
if (event.type == "cut" && !view.state.readOnly)
|
|
22138
22137
|
view.dispatch({
|
|
22139
22138
|
changes: ranges,
|
|
@@ -22143,10 +22142,10 @@ handlers.copy = handlers.cut = (view, event) => {
|
|
|
22143
22142
|
let data = brokenClipboardAPI ? null : event.clipboardData;
|
|
22144
22143
|
if (data) {
|
|
22145
22144
|
data.clearData();
|
|
22146
|
-
data.setData("text/plain",
|
|
22145
|
+
data.setData("text/plain", text);
|
|
22147
22146
|
return true;
|
|
22148
22147
|
} else {
|
|
22149
|
-
captureCopy(view,
|
|
22148
|
+
captureCopy(view, text);
|
|
22150
22149
|
return false;
|
|
22151
22150
|
}
|
|
22152
22151
|
};
|
|
@@ -22222,11 +22221,11 @@ handlers.beforeinput = (view, event) => {
|
|
|
22222
22221
|
view.inputState.insertingTextAt = Date.now();
|
|
22223
22222
|
}
|
|
22224
22223
|
if (event.inputType == "insertReplacementText" && view.observer.editContext) {
|
|
22225
|
-
let
|
|
22226
|
-
if (
|
|
22224
|
+
let text = (_a2 = event.dataTransfer) === null || _a2 === void 0 ? void 0 : _a2.getData("text/plain"), ranges = event.getTargetRanges();
|
|
22225
|
+
if (text && ranges.length) {
|
|
22227
22226
|
let r = ranges[0];
|
|
22228
22227
|
let from = view.posAtDOM(r.startContainer, r.startOffset), to = view.posAtDOM(r.endContainer, r.endOffset);
|
|
22229
|
-
applyDOMChangeInner(view, { from, to, insert: view.state.toText(
|
|
22228
|
+
applyDOMChangeInner(view, { from, to, insert: view.state.toText(text) }, null);
|
|
22230
22229
|
return true;
|
|
22231
22230
|
}
|
|
22232
22231
|
}
|
|
@@ -30840,18 +30839,18 @@ class IndentContext {
|
|
|
30840
30839
|
textAfterPos(pos, bias = 1) {
|
|
30841
30840
|
if (this.options.simulateDoubleBreak && pos == this.options.simulateBreak)
|
|
30842
30841
|
return "";
|
|
30843
|
-
let { text
|
|
30844
|
-
return
|
|
30842
|
+
let { text, from } = this.lineAt(pos, bias);
|
|
30843
|
+
return text.slice(pos - from, Math.min(text.length, pos + 100 - from));
|
|
30845
30844
|
}
|
|
30846
30845
|
/**
|
|
30847
30846
|
Find the column for the given position.
|
|
30848
30847
|
*/
|
|
30849
30848
|
column(pos, bias = 1) {
|
|
30850
|
-
let { text
|
|
30851
|
-
let result = this.countColumn(
|
|
30849
|
+
let { text, from } = this.lineAt(pos, bias);
|
|
30850
|
+
let result = this.countColumn(text, pos - from);
|
|
30852
30851
|
let override = this.options.overrideIndentation ? this.options.overrideIndentation(from) : -1;
|
|
30853
30852
|
if (override > -1)
|
|
30854
|
-
result += override - this.countColumn(
|
|
30853
|
+
result += override - this.countColumn(text, text.search(/\S|$/));
|
|
30855
30854
|
return result;
|
|
30856
30855
|
}
|
|
30857
30856
|
/**
|
|
@@ -30865,14 +30864,14 @@ class IndentContext {
|
|
|
30865
30864
|
Find the indentation column of the line at the given point.
|
|
30866
30865
|
*/
|
|
30867
30866
|
lineIndent(pos, bias = 1) {
|
|
30868
|
-
let { text
|
|
30867
|
+
let { text, from } = this.lineAt(pos, bias);
|
|
30869
30868
|
let override = this.options.overrideIndentation;
|
|
30870
30869
|
if (override) {
|
|
30871
30870
|
let overriden = override(from);
|
|
30872
30871
|
if (overriden > -1)
|
|
30873
30872
|
return overriden;
|
|
30874
30873
|
}
|
|
30875
|
-
return this.countColumn(
|
|
30874
|
+
return this.countColumn(text, text.search(/\S|$/));
|
|
30876
30875
|
}
|
|
30877
30876
|
/**
|
|
30878
30877
|
Returns the [simulated line
|
|
@@ -31369,12 +31368,12 @@ function matchPlainBrackets(state, pos, dir, tree, tokenType, maxScanDistance, b
|
|
|
31369
31368
|
let startToken = { from: dir < 0 ? pos - 1 : pos, to: dir > 0 ? pos + 1 : pos };
|
|
31370
31369
|
let iter = state.doc.iterRange(pos, dir > 0 ? state.doc.length : 0), depth = 0;
|
|
31371
31370
|
for (let distance = 0; !iter.next().done && distance <= maxScanDistance; ) {
|
|
31372
|
-
let
|
|
31371
|
+
let text = iter.value;
|
|
31373
31372
|
if (dir < 0)
|
|
31374
|
-
distance +=
|
|
31373
|
+
distance += text.length;
|
|
31375
31374
|
let basePos = pos + distance * dir;
|
|
31376
|
-
for (let pos2 = dir > 0 ? 0 :
|
|
31377
|
-
let found = brackets.indexOf(
|
|
31375
|
+
for (let pos2 = dir > 0 ? 0 : text.length - 1, end = dir > 0 ? text.length : -1; pos2 != end; pos2 += dir) {
|
|
31376
|
+
let found = brackets.indexOf(text[pos2]);
|
|
31378
31377
|
if (found < 0 || tree.resolveInner(basePos + pos2, 1).type != tokenType)
|
|
31379
31378
|
continue;
|
|
31380
31379
|
if (found % 2 == 0 == dir > 0) {
|
|
@@ -31386,7 +31385,7 @@ function matchPlainBrackets(state, pos, dir, tree, tokenType, maxScanDistance, b
|
|
|
31386
31385
|
}
|
|
31387
31386
|
}
|
|
31388
31387
|
if (dir > 0)
|
|
31389
|
-
distance +=
|
|
31388
|
+
distance += text.length;
|
|
31390
31389
|
}
|
|
31391
31390
|
return iter.done ? { start: startToken, matched: false } : null;
|
|
31392
31391
|
}
|
|
@@ -32550,14 +32549,14 @@ class SearchCursor {
|
|
|
32550
32549
|
[`.normalize("NFKD")`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize)
|
|
32551
32550
|
(when supported).
|
|
32552
32551
|
*/
|
|
32553
|
-
constructor(
|
|
32552
|
+
constructor(text, query, from = 0, to = text.length, normalize, test) {
|
|
32554
32553
|
this.test = test;
|
|
32555
32554
|
this.value = { from: 0, to: 0, precise: false };
|
|
32556
32555
|
this.done = false;
|
|
32557
32556
|
this.matches = [];
|
|
32558
32557
|
this.buffer = "";
|
|
32559
32558
|
this.bufferPos = 0;
|
|
32560
|
-
this.iter =
|
|
32559
|
+
this.iter = text.iterRange(from, to);
|
|
32561
32560
|
this.bufferStart = from;
|
|
32562
32561
|
this.normalize = normalize ? (x) => normalize(basicNormalize(x)) : basicNormalize;
|
|
32563
32562
|
this.query = this.normalize(query);
|
|
@@ -32656,20 +32655,20 @@ class RegExpCursor {
|
|
|
32656
32655
|
document. `query` should be the raw pattern (as you'd pass it to
|
|
32657
32656
|
`new RegExp`).
|
|
32658
32657
|
*/
|
|
32659
|
-
constructor(
|
|
32660
|
-
this.text =
|
|
32658
|
+
constructor(text, query, options, from = 0, to = text.length) {
|
|
32659
|
+
this.text = text;
|
|
32661
32660
|
this.to = to;
|
|
32662
32661
|
this.curLine = "";
|
|
32663
32662
|
this.done = false;
|
|
32664
32663
|
this.value = empty;
|
|
32665
32664
|
if (/\\[sWDnr]|\n|\r|\[\^/.test(query))
|
|
32666
|
-
return new MultilineRegExpCursor(
|
|
32665
|
+
return new MultilineRegExpCursor(text, query, options, from, to);
|
|
32667
32666
|
this.re = new RegExp(query, baseFlags + ((options === null || options === void 0 ? void 0 : options.ignoreCase) ? "i" : ""));
|
|
32668
32667
|
this.test = options === null || options === void 0 ? void 0 : options.test;
|
|
32669
|
-
this.iter =
|
|
32670
|
-
let startLine =
|
|
32668
|
+
this.iter = text.iter();
|
|
32669
|
+
let startLine = text.lineAt(from);
|
|
32671
32670
|
this.curLineStart = startLine.from;
|
|
32672
|
-
this.matchPos = toCharEnd(
|
|
32671
|
+
this.matchPos = toCharEnd(text, from);
|
|
32673
32672
|
this.getLine(this.curLineStart);
|
|
32674
32673
|
}
|
|
32675
32674
|
getLine(skip) {
|
|
@@ -32719,9 +32718,9 @@ class RegExpCursor {
|
|
|
32719
32718
|
}
|
|
32720
32719
|
const flattened = /* @__PURE__ */ new WeakMap();
|
|
32721
32720
|
class FlattenedDoc {
|
|
32722
|
-
constructor(from,
|
|
32721
|
+
constructor(from, text) {
|
|
32723
32722
|
this.from = from;
|
|
32724
|
-
this.text =
|
|
32723
|
+
this.text = text;
|
|
32725
32724
|
}
|
|
32726
32725
|
get to() {
|
|
32727
32726
|
return this.from + this.text.length;
|
|
@@ -32735,27 +32734,27 @@ class FlattenedDoc {
|
|
|
32735
32734
|
}
|
|
32736
32735
|
if (cached2.from == from && cached2.to == to)
|
|
32737
32736
|
return cached2;
|
|
32738
|
-
let { text
|
|
32737
|
+
let { text, from: cachedFrom } = cached2;
|
|
32739
32738
|
if (cachedFrom > from) {
|
|
32740
|
-
|
|
32739
|
+
text = doc2.sliceString(from, cachedFrom) + text;
|
|
32741
32740
|
cachedFrom = from;
|
|
32742
32741
|
}
|
|
32743
32742
|
if (cached2.to < to)
|
|
32744
|
-
|
|
32745
|
-
flattened.set(doc2, new FlattenedDoc(cachedFrom,
|
|
32746
|
-
return new FlattenedDoc(from,
|
|
32743
|
+
text += doc2.sliceString(cached2.to, to);
|
|
32744
|
+
flattened.set(doc2, new FlattenedDoc(cachedFrom, text));
|
|
32745
|
+
return new FlattenedDoc(from, text.slice(from - cachedFrom, to - cachedFrom));
|
|
32747
32746
|
}
|
|
32748
32747
|
}
|
|
32749
32748
|
class MultilineRegExpCursor {
|
|
32750
|
-
constructor(
|
|
32751
|
-
this.text =
|
|
32749
|
+
constructor(text, query, options, from, to) {
|
|
32750
|
+
this.text = text;
|
|
32752
32751
|
this.to = to;
|
|
32753
32752
|
this.done = false;
|
|
32754
32753
|
this.value = empty;
|
|
32755
|
-
this.matchPos = toCharEnd(
|
|
32754
|
+
this.matchPos = toCharEnd(text, from);
|
|
32756
32755
|
this.re = new RegExp(query, baseFlags + ((options === null || options === void 0 ? void 0 : options.ignoreCase) ? "i" : ""));
|
|
32757
32756
|
this.test = options === null || options === void 0 ? void 0 : options.test;
|
|
32758
|
-
this.flat = FlattenedDoc.get(
|
|
32757
|
+
this.flat = FlattenedDoc.get(text, from, this.chunkEnd(
|
|
32759
32758
|
from + 5e3
|
|
32760
32759
|
/* Chunk.Base */
|
|
32761
32760
|
));
|
|
@@ -32800,10 +32799,10 @@ function validRegExp(source) {
|
|
|
32800
32799
|
return false;
|
|
32801
32800
|
}
|
|
32802
32801
|
}
|
|
32803
|
-
function toCharEnd(
|
|
32804
|
-
if (pos >=
|
|
32802
|
+
function toCharEnd(text, pos) {
|
|
32803
|
+
if (pos >= text.length)
|
|
32805
32804
|
return pos;
|
|
32806
|
-
let line =
|
|
32805
|
+
let line = text.lineAt(pos), next;
|
|
32807
32806
|
while (pos < line.to && (next = line.text.charCodeAt(pos - line.from)) >= 56320 && next < 57344)
|
|
32808
32807
|
pos++;
|
|
32809
32808
|
return pos;
|
|
@@ -33009,8 +33008,8 @@ class SearchQuery {
|
|
|
33009
33008
|
/**
|
|
33010
33009
|
@internal
|
|
33011
33010
|
*/
|
|
33012
|
-
unquote(
|
|
33013
|
-
return this.literal ?
|
|
33011
|
+
unquote(text) {
|
|
33012
|
+
return this.literal ? text : text.replace(/\\([nrt\\])/g, (_, ch) => ch == "n" ? "\n" : ch == "r" ? "\r" : ch == "t" ? " " : "\\");
|
|
33014
33013
|
}
|
|
33015
33014
|
/**
|
|
33016
33015
|
Compare this query to another query.
|
|
@@ -33559,22 +33558,22 @@ const Break = /[\s\.,:;?!]/;
|
|
|
33559
33558
|
function announceMatch(view, { from, to }) {
|
|
33560
33559
|
let line = view.state.doc.lineAt(from), lineEnd = view.state.doc.lineAt(to).to;
|
|
33561
33560
|
let start = Math.max(line.from, from - AnnounceMargin), end = Math.min(lineEnd, to + AnnounceMargin);
|
|
33562
|
-
let
|
|
33561
|
+
let text = view.state.sliceDoc(start, end);
|
|
33563
33562
|
if (start != line.from) {
|
|
33564
33563
|
for (let i = 0; i < AnnounceMargin; i++)
|
|
33565
|
-
if (!Break.test(
|
|
33566
|
-
|
|
33564
|
+
if (!Break.test(text[i + 1]) && Break.test(text[i])) {
|
|
33565
|
+
text = text.slice(i);
|
|
33567
33566
|
break;
|
|
33568
33567
|
}
|
|
33569
33568
|
}
|
|
33570
33569
|
if (end != lineEnd) {
|
|
33571
|
-
for (let i =
|
|
33572
|
-
if (!Break.test(
|
|
33573
|
-
|
|
33570
|
+
for (let i = text.length - 1; i > text.length - AnnounceMargin; i--)
|
|
33571
|
+
if (!Break.test(text[i - 1]) && Break.test(text[i])) {
|
|
33572
|
+
text = text.slice(0, i);
|
|
33574
33573
|
break;
|
|
33575
33574
|
}
|
|
33576
33575
|
}
|
|
33577
|
-
return EditorView.announce.of(`${view.state.phrase("current match")}. ${
|
|
33576
|
+
return EditorView.announce.of(`${view.state.phrase("current match")}. ${text} ${view.state.phrase("on line")} ${line.number}.`);
|
|
33578
33577
|
}
|
|
33579
33578
|
const baseTheme$2 = /* @__PURE__ */ EditorView.baseTheme({
|
|
33580
33579
|
".cm-panel.cm-search": {
|
|
@@ -35684,13 +35683,13 @@ function ensureAnchor(expr, start) {
|
|
|
35684
35683
|
return new RegExp(`${addStart ? "^" : ""}(?:${source})${addEnd ? "$" : ""}`, (_a2 = expr.flags) !== null && _a2 !== void 0 ? _a2 : expr.ignoreCase ? "i" : "");
|
|
35685
35684
|
}
|
|
35686
35685
|
const pickedCompletion = /* @__PURE__ */ Annotation.define();
|
|
35687
|
-
function insertCompletionText(state,
|
|
35686
|
+
function insertCompletionText(state, text, from, to) {
|
|
35688
35687
|
let { main } = state.selection, fromOff = from - main.from, toOff = to - main.from;
|
|
35689
35688
|
return {
|
|
35690
35689
|
...state.changeByRange((range) => {
|
|
35691
35690
|
if (range != main && from != to && state.sliceDoc(range.from + fromOff, range.from + toOff) != state.sliceDoc(from, to))
|
|
35692
35691
|
return { range };
|
|
35693
|
-
let lines = state.toText(
|
|
35692
|
+
let lines = state.toText(text);
|
|
35694
35693
|
return {
|
|
35695
35694
|
changes: { from: range.from + fromOff, to: to == main.from ? range.to : range.from + toOff, insert: lines },
|
|
35696
35695
|
range: EditorSelection.cursor(range.from + fromOff + lines.length)
|
|
@@ -36530,8 +36529,8 @@ class ActiveResult extends ActiveSource {
|
|
|
36530
36529
|
function checkValid(validFor, state, from, to) {
|
|
36531
36530
|
if (!validFor)
|
|
36532
36531
|
return false;
|
|
36533
|
-
let
|
|
36534
|
-
return typeof validFor == "function" ? validFor(
|
|
36532
|
+
let text = state.sliceDoc(from, to);
|
|
36533
|
+
return typeof validFor == "function" ? validFor(text, from, to, state) : ensureAnchor(validFor, true).test(text);
|
|
36535
36534
|
}
|
|
36536
36535
|
const setActiveEffect = /* @__PURE__ */ StateEffect.define({
|
|
36537
36536
|
map(sources, mapping) {
|
|
@@ -36930,21 +36929,21 @@ class Snippet {
|
|
|
36930
36929
|
this.fieldPositions = fieldPositions;
|
|
36931
36930
|
}
|
|
36932
36931
|
instantiate(state, pos) {
|
|
36933
|
-
let
|
|
36932
|
+
let text = [], lineStart = [pos];
|
|
36934
36933
|
let lineObj = state.doc.lineAt(pos), baseIndent = /^\s*/.exec(lineObj.text)[0];
|
|
36935
36934
|
for (let line of this.lines) {
|
|
36936
|
-
if (
|
|
36935
|
+
if (text.length) {
|
|
36937
36936
|
let indent = baseIndent, tabs = /^\t*/.exec(line)[0].length;
|
|
36938
36937
|
for (let i = 0; i < tabs; i++)
|
|
36939
36938
|
indent += state.facet(indentUnit);
|
|
36940
36939
|
lineStart.push(pos + indent.length - tabs);
|
|
36941
36940
|
line = indent + line.slice(tabs);
|
|
36942
36941
|
}
|
|
36943
|
-
|
|
36942
|
+
text.push(line);
|
|
36944
36943
|
pos += line.length + 1;
|
|
36945
36944
|
}
|
|
36946
36945
|
let ranges = this.fieldPositions.map((pos2) => new FieldRange(pos2.field, lineStart[pos2.line] + pos2.from, lineStart[pos2.line] + pos2.to));
|
|
36947
|
-
return { text
|
|
36946
|
+
return { text, ranges };
|
|
36948
36947
|
}
|
|
36949
36948
|
static parse(template) {
|
|
36950
36949
|
let fields = [];
|
|
@@ -37051,10 +37050,10 @@ function fieldSelection(ranges, field) {
|
|
|
37051
37050
|
function snippet(template) {
|
|
37052
37051
|
let snippet2 = Snippet.parse(template);
|
|
37053
37052
|
return (editor, completion, from, to) => {
|
|
37054
|
-
let { text
|
|
37053
|
+
let { text, ranges } = snippet2.instantiate(editor.state, from);
|
|
37055
37054
|
let { main } = editor.state.selection;
|
|
37056
37055
|
let spec = {
|
|
37057
|
-
changes: { from, to: to == main.from ? main.to : to, insert: Text.of(
|
|
37056
|
+
changes: { from, to: to == main.from ? main.to : to, insert: Text.of(text) },
|
|
37058
37057
|
scrollIntoView: true,
|
|
37059
37058
|
annotations: completion ? [pickedCompletion.of(completion), Transaction.userEvent.of("input.complete")] : void 0
|
|
37060
37059
|
};
|
|
@@ -37424,8 +37423,8 @@ function elementName(doc2, tree, max = doc2.length) {
|
|
|
37424
37423
|
return "";
|
|
37425
37424
|
}
|
|
37426
37425
|
const android = typeof navigator == "object" && /* @__PURE__ */ /Android\b/.test(navigator.userAgent);
|
|
37427
|
-
const autoCloseTags = /* @__PURE__ */ EditorView.inputHandler.of((view, from, to,
|
|
37428
|
-
if ((android ? view.composing : view.compositionStarted) || view.state.readOnly || from != to ||
|
|
37426
|
+
const autoCloseTags = /* @__PURE__ */ EditorView.inputHandler.of((view, from, to, text, defaultInsert) => {
|
|
37427
|
+
if ((android ? view.composing : view.compositionStarted) || view.state.readOnly || from != to || text != ">" && text != "/" || !javascriptLanguage.isActiveAt(view.state, from, -1))
|
|
37429
37428
|
return false;
|
|
37430
37429
|
let base2 = defaultInsert(), { state } = base2;
|
|
37431
37430
|
let closeTags = state.changeByRange((range) => {
|
|
@@ -37433,16 +37432,16 @@ const autoCloseTags = /* @__PURE__ */ EditorView.inputHandler.of((view, from, to
|
|
|
37433
37432
|
let { head } = range, around = syntaxTree(state).resolveInner(head - 1, -1), name2;
|
|
37434
37433
|
if (around.name == "JSXStartTag")
|
|
37435
37434
|
around = around.parent;
|
|
37436
|
-
if (state.doc.sliceString(head - 1, head) !=
|
|
37437
|
-
else if (
|
|
37435
|
+
if (state.doc.sliceString(head - 1, head) != text || around.name == "JSXAttributeValue" && around.to > head) ;
|
|
37436
|
+
else if (text == ">" && around.name == "JSXFragmentTag") {
|
|
37438
37437
|
return { range, changes: { from: head, insert: `</>` } };
|
|
37439
|
-
} else if (
|
|
37438
|
+
} else if (text == "/" && around.name == "JSXStartCloseTag") {
|
|
37440
37439
|
let empty2 = around.parent, base3 = empty2.parent;
|
|
37441
37440
|
if (base3 && empty2.from == head - 2 && ((name2 = elementName(state.doc, base3.firstChild, head)) || ((_a2 = base3.firstChild) === null || _a2 === void 0 ? void 0 : _a2.name) == "JSXFragmentTag")) {
|
|
37442
37441
|
let insert2 = `${name2}>`;
|
|
37443
37442
|
return { range: EditorSelection.cursor(head + insert2.length, -1), changes: { from: head, insert: insert2 } };
|
|
37444
37443
|
}
|
|
37445
|
-
} else if (
|
|
37444
|
+
} else if (text == ">") {
|
|
37446
37445
|
let openTag = findOpenTag(around);
|
|
37447
37446
|
if (openTag && openTag.name == "JSXOpenTag" && !/^\/?>|^<\//.test(state.doc.sliceString(head, head + 2)) && (name2 = elementName(state.doc, openTag, head)))
|
|
37448
37447
|
return { range, changes: { from: head, insert: `</${name2}>` } };
|
|
@@ -38082,8 +38081,8 @@ function requireDiffMatchPatch() {
|
|
|
38082
38081
|
var DIFF_DELETE = -1;
|
|
38083
38082
|
var DIFF_INSERT = 1;
|
|
38084
38083
|
var DIFF_EQUAL = 0;
|
|
38085
|
-
diff_match_patch.Diff = function(op,
|
|
38086
|
-
return [op,
|
|
38084
|
+
diff_match_patch.Diff = function(op, text) {
|
|
38085
|
+
return [op, text];
|
|
38087
38086
|
};
|
|
38088
38087
|
diff_match_patch.prototype.diff_main = function(text1, text2, opt_checklines, opt_deadline) {
|
|
38089
38088
|
if (typeof opt_deadline == "undefined") {
|
|
@@ -38324,23 +38323,23 @@ function requireDiffMatchPatch() {
|
|
|
38324
38323
|
var lineArray = [];
|
|
38325
38324
|
var lineHash = {};
|
|
38326
38325
|
lineArray[0] = "";
|
|
38327
|
-
function diff_linesToCharsMunge_(
|
|
38326
|
+
function diff_linesToCharsMunge_(text) {
|
|
38328
38327
|
var chars = "";
|
|
38329
38328
|
var lineStart = 0;
|
|
38330
38329
|
var lineEnd = -1;
|
|
38331
38330
|
var lineArrayLength = lineArray.length;
|
|
38332
|
-
while (lineEnd <
|
|
38333
|
-
lineEnd =
|
|
38331
|
+
while (lineEnd < text.length - 1) {
|
|
38332
|
+
lineEnd = text.indexOf("\n", lineStart);
|
|
38334
38333
|
if (lineEnd == -1) {
|
|
38335
|
-
lineEnd =
|
|
38334
|
+
lineEnd = text.length - 1;
|
|
38336
38335
|
}
|
|
38337
|
-
var line =
|
|
38336
|
+
var line = text.substring(lineStart, lineEnd + 1);
|
|
38338
38337
|
if (lineHash.hasOwnProperty ? lineHash.hasOwnProperty(line) : lineHash[line] !== void 0) {
|
|
38339
38338
|
chars += String.fromCharCode(lineHash[line]);
|
|
38340
38339
|
} else {
|
|
38341
38340
|
if (lineArrayLength == maxLines) {
|
|
38342
|
-
line =
|
|
38343
|
-
lineEnd =
|
|
38341
|
+
line = text.substring(lineStart);
|
|
38342
|
+
lineEnd = text.length;
|
|
38344
38343
|
}
|
|
38345
38344
|
chars += String.fromCharCode(lineArrayLength);
|
|
38346
38345
|
lineHash[line] = lineArrayLength;
|
|
@@ -38359,11 +38358,11 @@ function requireDiffMatchPatch() {
|
|
|
38359
38358
|
diff_match_patch.prototype.diff_charsToLines_ = function(diffs, lineArray) {
|
|
38360
38359
|
for (var i = 0; i < diffs.length; i++) {
|
|
38361
38360
|
var chars = diffs[i][1];
|
|
38362
|
-
var
|
|
38361
|
+
var text = [];
|
|
38363
38362
|
for (var j = 0; j < chars.length; j++) {
|
|
38364
|
-
|
|
38363
|
+
text[j] = lineArray[chars.charCodeAt(j)];
|
|
38365
38364
|
}
|
|
38366
|
-
diffs[i][1] =
|
|
38365
|
+
diffs[i][1] = text.join("");
|
|
38367
38366
|
}
|
|
38368
38367
|
};
|
|
38369
38368
|
diff_match_patch.prototype.diff_commonPrefix = function(text1, text2) {
|
|
@@ -38868,38 +38867,38 @@ function requireDiffMatchPatch() {
|
|
|
38868
38867
|
for (var x = 0; x < diffs.length; x++) {
|
|
38869
38868
|
var op = diffs[x][0];
|
|
38870
38869
|
var data = diffs[x][1];
|
|
38871
|
-
var
|
|
38870
|
+
var text = data.replace(pattern_amp, "&").replace(pattern_lt, "<").replace(pattern_gt, ">").replace(pattern_para, "¶<br>");
|
|
38872
38871
|
switch (op) {
|
|
38873
38872
|
case DIFF_INSERT:
|
|
38874
|
-
html[x] = '<ins style="background:#e6ffe6;">' +
|
|
38873
|
+
html[x] = '<ins style="background:#e6ffe6;">' + text + "</ins>";
|
|
38875
38874
|
break;
|
|
38876
38875
|
case DIFF_DELETE:
|
|
38877
|
-
html[x] = '<del style="background:#ffe6e6;">' +
|
|
38876
|
+
html[x] = '<del style="background:#ffe6e6;">' + text + "</del>";
|
|
38878
38877
|
break;
|
|
38879
38878
|
case DIFF_EQUAL:
|
|
38880
|
-
html[x] = "<span>" +
|
|
38879
|
+
html[x] = "<span>" + text + "</span>";
|
|
38881
38880
|
break;
|
|
38882
38881
|
}
|
|
38883
38882
|
}
|
|
38884
38883
|
return html.join("");
|
|
38885
38884
|
};
|
|
38886
38885
|
diff_match_patch.prototype.diff_text1 = function(diffs) {
|
|
38887
|
-
var
|
|
38886
|
+
var text = [];
|
|
38888
38887
|
for (var x = 0; x < diffs.length; x++) {
|
|
38889
38888
|
if (diffs[x][0] !== DIFF_INSERT) {
|
|
38890
|
-
|
|
38889
|
+
text[x] = diffs[x][1];
|
|
38891
38890
|
}
|
|
38892
38891
|
}
|
|
38893
|
-
return
|
|
38892
|
+
return text.join("");
|
|
38894
38893
|
};
|
|
38895
38894
|
diff_match_patch.prototype.diff_text2 = function(diffs) {
|
|
38896
|
-
var
|
|
38895
|
+
var text = [];
|
|
38897
38896
|
for (var x = 0; x < diffs.length; x++) {
|
|
38898
38897
|
if (diffs[x][0] !== DIFF_DELETE) {
|
|
38899
|
-
|
|
38898
|
+
text[x] = diffs[x][1];
|
|
38900
38899
|
}
|
|
38901
38900
|
}
|
|
38902
|
-
return
|
|
38901
|
+
return text.join("");
|
|
38903
38902
|
};
|
|
38904
38903
|
diff_match_patch.prototype.diff_levenshtein = function(diffs) {
|
|
38905
38904
|
var levenshtein = 0;
|
|
@@ -38926,21 +38925,21 @@ function requireDiffMatchPatch() {
|
|
|
38926
38925
|
return levenshtein;
|
|
38927
38926
|
};
|
|
38928
38927
|
diff_match_patch.prototype.diff_toDelta = function(diffs) {
|
|
38929
|
-
var
|
|
38928
|
+
var text = [];
|
|
38930
38929
|
for (var x = 0; x < diffs.length; x++) {
|
|
38931
38930
|
switch (diffs[x][0]) {
|
|
38932
38931
|
case DIFF_INSERT:
|
|
38933
|
-
|
|
38932
|
+
text[x] = "+" + encodeURI(diffs[x][1]);
|
|
38934
38933
|
break;
|
|
38935
38934
|
case DIFF_DELETE:
|
|
38936
|
-
|
|
38935
|
+
text[x] = "-" + diffs[x][1].length;
|
|
38937
38936
|
break;
|
|
38938
38937
|
case DIFF_EQUAL:
|
|
38939
|
-
|
|
38938
|
+
text[x] = "=" + diffs[x][1].length;
|
|
38940
38939
|
break;
|
|
38941
38940
|
}
|
|
38942
38941
|
}
|
|
38943
|
-
return
|
|
38942
|
+
return text.join(" ").replace(/%20/g, " ");
|
|
38944
38943
|
};
|
|
38945
38944
|
diff_match_patch.prototype.diff_fromDelta = function(text1, delta) {
|
|
38946
38945
|
var diffs = [];
|
|
@@ -38964,11 +38963,11 @@ function requireDiffMatchPatch() {
|
|
|
38964
38963
|
if (isNaN(n) || n < 0) {
|
|
38965
38964
|
throw new Error("Invalid number in diff_fromDelta: " + param);
|
|
38966
38965
|
}
|
|
38967
|
-
var
|
|
38966
|
+
var text = text1.substring(pointer, pointer += n);
|
|
38968
38967
|
if (tokens[x].charAt(0) == "=") {
|
|
38969
|
-
diffs[diffsLength++] = new diff_match_patch.Diff(DIFF_EQUAL,
|
|
38968
|
+
diffs[diffsLength++] = new diff_match_patch.Diff(DIFF_EQUAL, text);
|
|
38970
38969
|
} else {
|
|
38971
|
-
diffs[diffsLength++] = new diff_match_patch.Diff(DIFF_DELETE,
|
|
38970
|
+
diffs[diffsLength++] = new diff_match_patch.Diff(DIFF_DELETE, text);
|
|
38972
38971
|
}
|
|
38973
38972
|
break;
|
|
38974
38973
|
default:
|
|
@@ -38982,22 +38981,22 @@ function requireDiffMatchPatch() {
|
|
|
38982
38981
|
}
|
|
38983
38982
|
return diffs;
|
|
38984
38983
|
};
|
|
38985
|
-
diff_match_patch.prototype.match_main = function(
|
|
38986
|
-
if (
|
|
38984
|
+
diff_match_patch.prototype.match_main = function(text, pattern2, loc) {
|
|
38985
|
+
if (text == null || pattern2 == null || loc == null) {
|
|
38987
38986
|
throw new Error("Null input. (match_main)");
|
|
38988
38987
|
}
|
|
38989
|
-
loc = Math.max(0, Math.min(loc,
|
|
38990
|
-
if (
|
|
38988
|
+
loc = Math.max(0, Math.min(loc, text.length));
|
|
38989
|
+
if (text == pattern2) {
|
|
38991
38990
|
return 0;
|
|
38992
|
-
} else if (!
|
|
38991
|
+
} else if (!text.length) {
|
|
38993
38992
|
return -1;
|
|
38994
|
-
} else if (
|
|
38993
|
+
} else if (text.substring(loc, loc + pattern2.length) == pattern2) {
|
|
38995
38994
|
return loc;
|
|
38996
38995
|
} else {
|
|
38997
|
-
return this.match_bitap_(
|
|
38996
|
+
return this.match_bitap_(text, pattern2, loc);
|
|
38998
38997
|
}
|
|
38999
38998
|
};
|
|
39000
|
-
diff_match_patch.prototype.match_bitap_ = function(
|
|
38999
|
+
diff_match_patch.prototype.match_bitap_ = function(text, pattern2, loc) {
|
|
39001
39000
|
if (pattern2.length > this.Match_MaxBits) {
|
|
39002
39001
|
throw new Error("Pattern too long for this browser.");
|
|
39003
39002
|
}
|
|
@@ -39012,10 +39011,10 @@ function requireDiffMatchPatch() {
|
|
|
39012
39011
|
return accuracy + proximity / dmp.Match_Distance;
|
|
39013
39012
|
}
|
|
39014
39013
|
var score_threshold = this.Match_Threshold;
|
|
39015
|
-
var best_loc =
|
|
39014
|
+
var best_loc = text.indexOf(pattern2, loc);
|
|
39016
39015
|
if (best_loc != -1) {
|
|
39017
39016
|
score_threshold = Math.min(match_bitapScore_(0, best_loc), score_threshold);
|
|
39018
|
-
best_loc =
|
|
39017
|
+
best_loc = text.lastIndexOf(pattern2, loc + pattern2.length);
|
|
39019
39018
|
if (best_loc != -1) {
|
|
39020
39019
|
score_threshold = Math.min(match_bitapScore_(0, best_loc), score_threshold);
|
|
39021
39020
|
}
|
|
@@ -39023,7 +39022,7 @@ function requireDiffMatchPatch() {
|
|
|
39023
39022
|
var matchmask = 1 << pattern2.length - 1;
|
|
39024
39023
|
best_loc = -1;
|
|
39025
39024
|
var bin_min, bin_mid;
|
|
39026
|
-
var bin_max = pattern2.length +
|
|
39025
|
+
var bin_max = pattern2.length + text.length;
|
|
39027
39026
|
var last_rd;
|
|
39028
39027
|
for (var d = 0; d < pattern2.length; d++) {
|
|
39029
39028
|
bin_min = 0;
|
|
@@ -39038,11 +39037,11 @@ function requireDiffMatchPatch() {
|
|
|
39038
39037
|
}
|
|
39039
39038
|
bin_max = bin_mid;
|
|
39040
39039
|
var start = Math.max(1, loc - bin_mid + 1);
|
|
39041
|
-
var finish = Math.min(loc + bin_mid,
|
|
39040
|
+
var finish = Math.min(loc + bin_mid, text.length) + pattern2.length;
|
|
39042
39041
|
var rd = Array(finish + 2);
|
|
39043
39042
|
rd[finish + 1] = (1 << d) - 1;
|
|
39044
39043
|
for (var j = finish; j >= start; j--) {
|
|
39045
|
-
var charMatch = s[
|
|
39044
|
+
var charMatch = s[text.charAt(j - 1)];
|
|
39046
39045
|
if (d === 0) {
|
|
39047
39046
|
rd[j] = (rd[j + 1] << 1 | 1) & charMatch;
|
|
39048
39047
|
} else {
|
|
@@ -39078,28 +39077,28 @@ function requireDiffMatchPatch() {
|
|
|
39078
39077
|
}
|
|
39079
39078
|
return s;
|
|
39080
39079
|
};
|
|
39081
|
-
diff_match_patch.prototype.patch_addContext_ = function(patch,
|
|
39082
|
-
if (
|
|
39080
|
+
diff_match_patch.prototype.patch_addContext_ = function(patch, text) {
|
|
39081
|
+
if (text.length == 0) {
|
|
39083
39082
|
return;
|
|
39084
39083
|
}
|
|
39085
39084
|
if (patch.start2 === null) {
|
|
39086
39085
|
throw Error("patch not initialized");
|
|
39087
39086
|
}
|
|
39088
|
-
var pattern2 =
|
|
39087
|
+
var pattern2 = text.substring(patch.start2, patch.start2 + patch.length1);
|
|
39089
39088
|
var padding = 0;
|
|
39090
|
-
while (
|
|
39089
|
+
while (text.indexOf(pattern2) != text.lastIndexOf(pattern2) && pattern2.length < this.Match_MaxBits - this.Patch_Margin - this.Patch_Margin) {
|
|
39091
39090
|
padding += this.Patch_Margin;
|
|
39092
|
-
pattern2 =
|
|
39091
|
+
pattern2 = text.substring(
|
|
39093
39092
|
patch.start2 - padding,
|
|
39094
39093
|
patch.start2 + patch.length1 + padding
|
|
39095
39094
|
);
|
|
39096
39095
|
}
|
|
39097
39096
|
padding += this.Patch_Margin;
|
|
39098
|
-
var prefix =
|
|
39097
|
+
var prefix = text.substring(patch.start2 - padding, patch.start2);
|
|
39099
39098
|
if (prefix) {
|
|
39100
39099
|
patch.diffs.unshift(new diff_match_patch.Diff(DIFF_EQUAL, prefix));
|
|
39101
39100
|
}
|
|
39102
|
-
var suffix =
|
|
39101
|
+
var suffix = text.substring(
|
|
39103
39102
|
patch.start2 + patch.length1,
|
|
39104
39103
|
patch.start2 + patch.length1 + padding
|
|
39105
39104
|
);
|
|
@@ -39218,13 +39217,13 @@ function requireDiffMatchPatch() {
|
|
|
39218
39217
|
}
|
|
39219
39218
|
return patchesCopy;
|
|
39220
39219
|
};
|
|
39221
|
-
diff_match_patch.prototype.patch_apply = function(patches,
|
|
39220
|
+
diff_match_patch.prototype.patch_apply = function(patches, text) {
|
|
39222
39221
|
if (patches.length == 0) {
|
|
39223
|
-
return [
|
|
39222
|
+
return [text, []];
|
|
39224
39223
|
}
|
|
39225
39224
|
patches = this.patch_deepCopy(patches);
|
|
39226
39225
|
var nullPadding = this.patch_addPadding(patches);
|
|
39227
|
-
|
|
39226
|
+
text = nullPadding + text + nullPadding;
|
|
39228
39227
|
this.patch_splitMax(patches);
|
|
39229
39228
|
var delta = 0;
|
|
39230
39229
|
var results = [];
|
|
@@ -39235,13 +39234,13 @@ function requireDiffMatchPatch() {
|
|
|
39235
39234
|
var end_loc = -1;
|
|
39236
39235
|
if (text1.length > this.Match_MaxBits) {
|
|
39237
39236
|
start_loc = this.match_main(
|
|
39238
|
-
|
|
39237
|
+
text,
|
|
39239
39238
|
text1.substring(0, this.Match_MaxBits),
|
|
39240
39239
|
expected_loc
|
|
39241
39240
|
);
|
|
39242
39241
|
if (start_loc != -1) {
|
|
39243
39242
|
end_loc = this.match_main(
|
|
39244
|
-
|
|
39243
|
+
text,
|
|
39245
39244
|
text1.substring(text1.length - this.Match_MaxBits),
|
|
39246
39245
|
expected_loc + text1.length - this.Match_MaxBits
|
|
39247
39246
|
);
|
|
@@ -39250,7 +39249,7 @@ function requireDiffMatchPatch() {
|
|
|
39250
39249
|
}
|
|
39251
39250
|
}
|
|
39252
39251
|
} else {
|
|
39253
|
-
start_loc = this.match_main(
|
|
39252
|
+
start_loc = this.match_main(text, text1, expected_loc);
|
|
39254
39253
|
}
|
|
39255
39254
|
if (start_loc == -1) {
|
|
39256
39255
|
results[x] = false;
|
|
@@ -39258,16 +39257,16 @@ function requireDiffMatchPatch() {
|
|
|
39258
39257
|
} else {
|
|
39259
39258
|
results[x] = true;
|
|
39260
39259
|
delta = start_loc - expected_loc;
|
|
39261
|
-
var
|
|
39260
|
+
var text2;
|
|
39262
39261
|
if (end_loc == -1) {
|
|
39263
|
-
|
|
39262
|
+
text2 = text.substring(start_loc, start_loc + text1.length);
|
|
39264
39263
|
} else {
|
|
39265
|
-
|
|
39264
|
+
text2 = text.substring(start_loc, end_loc + this.Match_MaxBits);
|
|
39266
39265
|
}
|
|
39267
|
-
if (text1 ==
|
|
39268
|
-
|
|
39266
|
+
if (text1 == text2) {
|
|
39267
|
+
text = text.substring(0, start_loc) + this.diff_text2(patches[x].diffs) + text.substring(start_loc + text1.length);
|
|
39269
39268
|
} else {
|
|
39270
|
-
var diffs = this.diff_main(text1,
|
|
39269
|
+
var diffs = this.diff_main(text1, text2, false);
|
|
39271
39270
|
if (text1.length > this.Match_MaxBits && this.diff_levenshtein(diffs) / text1.length > this.Patch_DeleteThreshold) {
|
|
39272
39271
|
results[x] = false;
|
|
39273
39272
|
} else {
|
|
@@ -39280,9 +39279,9 @@ function requireDiffMatchPatch() {
|
|
|
39280
39279
|
index2 = this.diff_xIndex(diffs, index1);
|
|
39281
39280
|
}
|
|
39282
39281
|
if (mod[0] === DIFF_INSERT) {
|
|
39283
|
-
|
|
39282
|
+
text = text.substring(0, start_loc + index2) + mod[1] + text.substring(start_loc + index2);
|
|
39284
39283
|
} else if (mod[0] === DIFF_DELETE) {
|
|
39285
|
-
|
|
39284
|
+
text = text.substring(0, start_loc + index2) + text.substring(start_loc + this.diff_xIndex(
|
|
39286
39285
|
diffs,
|
|
39287
39286
|
index1 + mod[1].length
|
|
39288
39287
|
));
|
|
@@ -39295,8 +39294,8 @@ function requireDiffMatchPatch() {
|
|
|
39295
39294
|
}
|
|
39296
39295
|
}
|
|
39297
39296
|
}
|
|
39298
|
-
|
|
39299
|
-
return [
|
|
39297
|
+
text = text.substring(nullPadding.length, text.length - nullPadding.length);
|
|
39298
|
+
return [text, results];
|
|
39300
39299
|
};
|
|
39301
39300
|
diff_match_patch.prototype.patch_addPadding = function(patches) {
|
|
39302
39301
|
var paddingLength = this.Patch_Margin;
|
|
@@ -39412,24 +39411,24 @@ function requireDiffMatchPatch() {
|
|
|
39412
39411
|
}
|
|
39413
39412
|
};
|
|
39414
39413
|
diff_match_patch.prototype.patch_toText = function(patches) {
|
|
39415
|
-
var
|
|
39414
|
+
var text = [];
|
|
39416
39415
|
for (var x = 0; x < patches.length; x++) {
|
|
39417
|
-
|
|
39416
|
+
text[x] = patches[x];
|
|
39418
39417
|
}
|
|
39419
|
-
return
|
|
39418
|
+
return text.join("");
|
|
39420
39419
|
};
|
|
39421
39420
|
diff_match_patch.prototype.patch_fromText = function(textline) {
|
|
39422
39421
|
var patches = [];
|
|
39423
39422
|
if (!textline) {
|
|
39424
39423
|
return patches;
|
|
39425
39424
|
}
|
|
39426
|
-
var
|
|
39425
|
+
var text = textline.split("\n");
|
|
39427
39426
|
var textPointer = 0;
|
|
39428
39427
|
var patchHeader = /^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;
|
|
39429
|
-
while (textPointer <
|
|
39430
|
-
var m =
|
|
39428
|
+
while (textPointer < text.length) {
|
|
39429
|
+
var m = text[textPointer].match(patchHeader);
|
|
39431
39430
|
if (!m) {
|
|
39432
|
-
throw new Error("Invalid patch string: " +
|
|
39431
|
+
throw new Error("Invalid patch string: " + text[textPointer]);
|
|
39433
39432
|
}
|
|
39434
39433
|
var patch = new diff_match_patch.patch_obj();
|
|
39435
39434
|
patches.push(patch);
|
|
@@ -39454,10 +39453,10 @@ function requireDiffMatchPatch() {
|
|
|
39454
39453
|
patch.length2 = parseInt(m[4], 10);
|
|
39455
39454
|
}
|
|
39456
39455
|
textPointer++;
|
|
39457
|
-
while (textPointer <
|
|
39458
|
-
var sign =
|
|
39456
|
+
while (textPointer < text.length) {
|
|
39457
|
+
var sign = text[textPointer].charAt(0);
|
|
39459
39458
|
try {
|
|
39460
|
-
var line = decodeURI(
|
|
39459
|
+
var line = decodeURI(text[textPointer].substring(1));
|
|
39461
39460
|
} catch (ex) {
|
|
39462
39461
|
throw new Error("Illegal escape in patch_fromText: " + line);
|
|
39463
39462
|
}
|
|
@@ -39501,7 +39500,7 @@ function requireDiffMatchPatch() {
|
|
|
39501
39500
|
} else {
|
|
39502
39501
|
coords2 = this.start2 + 1 + "," + this.length2;
|
|
39503
39502
|
}
|
|
39504
|
-
var
|
|
39503
|
+
var text = ["@@ -" + coords1 + " +" + coords2 + " @@\n"];
|
|
39505
39504
|
var op;
|
|
39506
39505
|
for (var x = 0; x < this.diffs.length; x++) {
|
|
39507
39506
|
switch (this.diffs[x][0]) {
|
|
@@ -39515,9 +39514,9 @@ function requireDiffMatchPatch() {
|
|
|
39515
39514
|
op = " ";
|
|
39516
39515
|
break;
|
|
39517
39516
|
}
|
|
39518
|
-
|
|
39517
|
+
text[x + 1] = op + encodeURI(this.diffs[x][1]) + "\n";
|
|
39519
39518
|
}
|
|
39520
|
-
return
|
|
39519
|
+
return text.join("").replace(/%20/g, " ");
|
|
39521
39520
|
};
|
|
39522
39521
|
module.exports = diff_match_patch;
|
|
39523
39522
|
module.exports["diff_match_patch"] = diff_match_patch;
|
|
@@ -39625,7 +39624,7 @@ class MergeButtonWidget extends WidgetType {
|
|
|
39625
39624
|
return container;
|
|
39626
39625
|
}
|
|
39627
39626
|
// 실제 변경 적용 로직
|
|
39628
|
-
applyChanges(
|
|
39627
|
+
applyChanges(text, editorView, range) {
|
|
39629
39628
|
if (!editorView || !range) {
|
|
39630
39629
|
trace.error("Target editor view or range is undefined.", editorView, range);
|
|
39631
39630
|
return;
|
|
@@ -39634,7 +39633,7 @@ class MergeButtonWidget extends WidgetType {
|
|
|
39634
39633
|
changes: {
|
|
39635
39634
|
from: range.from,
|
|
39636
39635
|
to: range.to,
|
|
39637
|
-
insert:
|
|
39636
|
+
insert: text
|
|
39638
39637
|
}
|
|
39639
39638
|
});
|
|
39640
39639
|
requestAnimationFrame(() => {
|
|
@@ -39788,16 +39787,16 @@ class NineDiff extends HTMLElement {
|
|
|
39788
39787
|
const insertedLineDeco = Decoration.line({ class: "cm-inserted-line-bg" });
|
|
39789
39788
|
const deletedLineDeco = Decoration.line({ class: "cm-deleted-line-bg" });
|
|
39790
39789
|
const currentInstance = this;
|
|
39791
|
-
for (const [op,
|
|
39792
|
-
const len =
|
|
39790
|
+
for (const [op, text] of diffs) {
|
|
39791
|
+
const len = text.length;
|
|
39793
39792
|
const asisRangeStart = asisCursor;
|
|
39794
39793
|
const tobeRangeStart = tobeCursor;
|
|
39795
39794
|
switch (op) {
|
|
39796
39795
|
case diffMatchPatchExports.diff_match_patch.DIFF_INSERT:
|
|
39797
|
-
trace.log("DIFF_INSERT (TOBE added):", JSON.stringify(
|
|
39798
|
-
const tobeLines =
|
|
39796
|
+
trace.log("DIFF_INSERT (TOBE added):", JSON.stringify(text));
|
|
39797
|
+
const tobeLines = text.split("\n");
|
|
39799
39798
|
for (let i = 0; i < tobeLines.length; i++) {
|
|
39800
|
-
if (!(i === tobeLines.length - 1 && tobeLines[i] === "" &&
|
|
39799
|
+
if (!(i === tobeLines.length - 1 && tobeLines[i] === "" && text.endsWith("\n"))) {
|
|
39801
39800
|
tobeLineBuilder.add(tobeCursor, tobeCursor, insertedLineDeco);
|
|
39802
39801
|
}
|
|
39803
39802
|
tobeCursor += tobeLines[i].length + (i < tobeLines.length - 1 ? 1 : 0);
|
|
@@ -39809,7 +39808,7 @@ class NineDiff extends HTMLElement {
|
|
|
39809
39808
|
widget: new MergeButtonWidget(
|
|
39810
39809
|
false,
|
|
39811
39810
|
// 이 버튼은 TOBE 에디터에 붙는 버튼
|
|
39812
|
-
|
|
39811
|
+
text,
|
|
39813
39812
|
// AI가 추가한 내용을 ASIS에 '삽입'
|
|
39814
39813
|
__privateGet(currentInstance, _asisEditorView),
|
|
39815
39814
|
// 대상 에디터는 ASIS (현재 소스)
|
|
@@ -39822,10 +39821,10 @@ class NineDiff extends HTMLElement {
|
|
|
39822
39821
|
);
|
|
39823
39822
|
break;
|
|
39824
39823
|
case diffMatchPatchExports.diff_match_patch.DIFF_DELETE:
|
|
39825
|
-
trace.log("DIFF_DELETE (ASIS deleted):", JSON.stringify(
|
|
39826
|
-
const asisLines =
|
|
39824
|
+
trace.log("DIFF_DELETE (ASIS deleted):", JSON.stringify(text));
|
|
39825
|
+
const asisLines = text.split("\n");
|
|
39827
39826
|
for (let i = 0; i < asisLines.length; i++) {
|
|
39828
|
-
if (!(i === asisLines.length - 1 && asisLines[i] === "" &&
|
|
39827
|
+
if (!(i === asisLines.length - 1 && asisLines[i] === "" && text.endsWith("\n"))) {
|
|
39829
39828
|
asisLineBuilder.add(asisCursor, asisCursor, deletedLineDeco);
|
|
39830
39829
|
}
|
|
39831
39830
|
asisCursor += asisLines[i].length + (i < asisLines.length - 1 ? 1 : 0);
|
|
@@ -39841,7 +39840,7 @@ class NineDiff extends HTMLElement {
|
|
|
39841
39840
|
// ASIS에서 해당 내용을 '제거'하므로 삽입할 텍스트는 없음
|
|
39842
39841
|
__privateGet(currentInstance, _asisEditorView),
|
|
39843
39842
|
// 대상 에디터는 ASIS (현재 소스)
|
|
39844
|
-
{ from: asisRangeStart, to: asisRangeStart +
|
|
39843
|
+
{ from: asisRangeStart, to: asisRangeStart + text.length },
|
|
39845
39844
|
// ASIS에서 '삭제될' 범위
|
|
39846
39845
|
currentInstance
|
|
39847
39846
|
),
|
|
@@ -39937,7 +39936,7 @@ class NineDiff extends HTMLElement {
|
|
|
39937
39936
|
const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
|
|
39938
39937
|
this.shadowRoot.innerHTML = `
|
|
39939
39938
|
<style>
|
|
39940
|
-
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.
|
|
39939
|
+
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.134"}/dist/css/nine-mu.css";
|
|
39941
39940
|
${customImport}
|
|
39942
39941
|
</style>
|
|
39943
39942
|
|
|
@@ -40047,7 +40046,7 @@ render_fn2 = function() {
|
|
|
40047
40046
|
const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
|
|
40048
40047
|
this.shadowRoot.innerHTML = `
|
|
40049
40048
|
<style>
|
|
40050
|
-
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.
|
|
40049
|
+
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.134"}/dist/css/nine-mu.css";
|
|
40051
40050
|
${customImport}
|
|
40052
40051
|
</style>
|
|
40053
40052
|
|
|
@@ -40086,7 +40085,7 @@ handleCancel_fn = function() {
|
|
|
40086
40085
|
};
|
|
40087
40086
|
customElements.define("nine-diff-popup", NineDiffPopup);
|
|
40088
40087
|
const NineMu = {
|
|
40089
|
-
version: "0.1.
|
|
40088
|
+
version: "0.1.134",
|
|
40090
40089
|
init: (config2) => {
|
|
40091
40090
|
trace$1.log("🛠️ Nine-Mu Engine initialized", config2);
|
|
40092
40091
|
}
|