@nine-lab/nine-mu 0.1.132 → 0.1.133
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 +290 -283
- 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/src/components/NineChat.js +12 -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, currentRoutes2) {
|
|
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: currentRoutes2
|
|
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, currentRoutes2) {
|
|
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((text2, msg) => text2 + separator + msg);
|
|
10333
10333
|
}
|
|
10334
10334
|
$dataMetaSchema(metaSchema, keywordsJsonPointers) {
|
|
10335
10335
|
const rules2 = this.RULES.all;
|
|
@@ -13699,7 +13699,14 @@ initActions_fn = function() {
|
|
|
13699
13699
|
e.preventDefault();
|
|
13700
13700
|
const userInput = e.target.value.trim();
|
|
13701
13701
|
if (!userInput) return;
|
|
13702
|
-
const response = await __privateGet(this, _mcpClient).
|
|
13702
|
+
const response = await __privateGet(this, _mcpClient).callTool({
|
|
13703
|
+
name: "ask_nine_engine",
|
|
13704
|
+
arguments: {
|
|
13705
|
+
prompt: text,
|
|
13706
|
+
routes: currentRoutes
|
|
13707
|
+
// 현재 화면의 메뉴 정보
|
|
13708
|
+
}
|
|
13709
|
+
});
|
|
13703
13710
|
console.log(response);
|
|
13704
13711
|
const result = JSON.parse(response.content[0].text);
|
|
13705
13712
|
if (result.action === "SHOW_DIFF") this.openDiff(result);
|
|
@@ -13712,7 +13719,7 @@ render_fn = function() {
|
|
|
13712
13719
|
const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
|
|
13713
13720
|
this.shadowRoot.innerHTML = `
|
|
13714
13721
|
<style>
|
|
13715
|
-
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.
|
|
13722
|
+
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.132"}/dist/css/nine-mu.css";
|
|
13716
13723
|
${customImport}
|
|
13717
13724
|
</style>
|
|
13718
13725
|
<div class="wrapper">
|
|
@@ -13847,7 +13854,7 @@ class Text {
|
|
|
13847
13854
|
/**
|
|
13848
13855
|
Replace a range of the text with the given content.
|
|
13849
13856
|
*/
|
|
13850
|
-
replace(from, to,
|
|
13857
|
+
replace(from, to, text2) {
|
|
13851
13858
|
[from, to] = clip(this, from, to);
|
|
13852
13859
|
let parts = [];
|
|
13853
13860
|
this.decompose(
|
|
@@ -13857,10 +13864,10 @@ class Text {
|
|
|
13857
13864
|
2
|
|
13858
13865
|
/* Open.To */
|
|
13859
13866
|
);
|
|
13860
|
-
if (
|
|
13861
|
-
|
|
13867
|
+
if (text2.length)
|
|
13868
|
+
text2.decompose(
|
|
13862
13869
|
0,
|
|
13863
|
-
|
|
13870
|
+
text2.length,
|
|
13864
13871
|
parts,
|
|
13865
13872
|
1 | 2
|
|
13866
13873
|
/* Open.To */
|
|
@@ -13872,7 +13879,7 @@ class Text {
|
|
|
13872
13879
|
1
|
|
13873
13880
|
/* Open.From */
|
|
13874
13881
|
);
|
|
13875
|
-
return TextNode.from(parts, this.length - (to - from) +
|
|
13882
|
+
return TextNode.from(parts, this.length - (to - from) + text2.length);
|
|
13876
13883
|
}
|
|
13877
13884
|
/**
|
|
13878
13885
|
Append another document to this one.
|
|
@@ -13968,18 +13975,18 @@ class Text {
|
|
|
13968
13975
|
/**
|
|
13969
13976
|
Create a `Text` instance for the given array of lines.
|
|
13970
13977
|
*/
|
|
13971
|
-
static of(
|
|
13972
|
-
if (
|
|
13978
|
+
static of(text2) {
|
|
13979
|
+
if (text2.length == 0)
|
|
13973
13980
|
throw new RangeError("A document must have at least one line");
|
|
13974
|
-
if (
|
|
13981
|
+
if (text2.length == 1 && !text2[0])
|
|
13975
13982
|
return Text.empty;
|
|
13976
|
-
return
|
|
13983
|
+
return text2.length <= 32 ? new TextLeaf(text2) : TextNode.from(TextLeaf.split(text2, []));
|
|
13977
13984
|
}
|
|
13978
13985
|
}
|
|
13979
13986
|
class TextLeaf extends Text {
|
|
13980
|
-
constructor(
|
|
13987
|
+
constructor(text2, length = textLength(text2)) {
|
|
13981
13988
|
super();
|
|
13982
|
-
this.text =
|
|
13989
|
+
this.text = text2;
|
|
13983
13990
|
this.length = length;
|
|
13984
13991
|
}
|
|
13985
13992
|
get lines() {
|
|
@@ -13998,26 +14005,26 @@ class TextLeaf extends Text {
|
|
|
13998
14005
|
}
|
|
13999
14006
|
}
|
|
14000
14007
|
decompose(from, to, target, open) {
|
|
14001
|
-
let
|
|
14008
|
+
let text2 = from <= 0 && to >= this.length ? this : new TextLeaf(sliceText(this.text, from, to), Math.min(to, this.length) - Math.max(0, from));
|
|
14002
14009
|
if (open & 1) {
|
|
14003
14010
|
let prev = target.pop();
|
|
14004
|
-
let joined = appendText(
|
|
14011
|
+
let joined = appendText(text2.text, prev.text.slice(), 0, text2.length);
|
|
14005
14012
|
if (joined.length <= 32) {
|
|
14006
|
-
target.push(new TextLeaf(joined, prev.length +
|
|
14013
|
+
target.push(new TextLeaf(joined, prev.length + text2.length));
|
|
14007
14014
|
} else {
|
|
14008
14015
|
let mid = joined.length >> 1;
|
|
14009
14016
|
target.push(new TextLeaf(joined.slice(0, mid)), new TextLeaf(joined.slice(mid)));
|
|
14010
14017
|
}
|
|
14011
14018
|
} else {
|
|
14012
|
-
target.push(
|
|
14019
|
+
target.push(text2);
|
|
14013
14020
|
}
|
|
14014
14021
|
}
|
|
14015
|
-
replace(from, to,
|
|
14016
|
-
if (!(
|
|
14017
|
-
return super.replace(from, to,
|
|
14022
|
+
replace(from, to, text2) {
|
|
14023
|
+
if (!(text2 instanceof TextLeaf))
|
|
14024
|
+
return super.replace(from, to, text2);
|
|
14018
14025
|
[from, to] = clip(this, from, to);
|
|
14019
|
-
let lines = appendText(this.text, appendText(
|
|
14020
|
-
let newLen = this.length +
|
|
14026
|
+
let lines = appendText(this.text, appendText(text2.text, sliceText(this.text, 0, from)), to);
|
|
14027
|
+
let newLen = this.length + text2.length - (to - from);
|
|
14021
14028
|
if (lines.length <= 32)
|
|
14022
14029
|
return new TextLeaf(lines, newLen);
|
|
14023
14030
|
return TextNode.from(TextLeaf.split(lines, []), newLen);
|
|
@@ -14042,9 +14049,9 @@ class TextLeaf extends Text {
|
|
|
14042
14049
|
scanIdentical() {
|
|
14043
14050
|
return 0;
|
|
14044
14051
|
}
|
|
14045
|
-
static split(
|
|
14052
|
+
static split(text2, target) {
|
|
14046
14053
|
let part = [], len = -1;
|
|
14047
|
-
for (let line of
|
|
14054
|
+
for (let line of text2) {
|
|
14048
14055
|
part.push(line);
|
|
14049
14056
|
len += line.length + 1;
|
|
14050
14057
|
if (part.length == 32) {
|
|
@@ -14089,24 +14096,24 @@ class TextNode extends Text {
|
|
|
14089
14096
|
pos = end + 1;
|
|
14090
14097
|
}
|
|
14091
14098
|
}
|
|
14092
|
-
replace(from, to,
|
|
14099
|
+
replace(from, to, text2) {
|
|
14093
14100
|
[from, to] = clip(this, from, to);
|
|
14094
|
-
if (
|
|
14101
|
+
if (text2.lines < this.lines)
|
|
14095
14102
|
for (let i = 0, pos = 0; i < this.children.length; i++) {
|
|
14096
14103
|
let child = this.children[i], end = pos + child.length;
|
|
14097
14104
|
if (from >= pos && to <= end) {
|
|
14098
|
-
let updated = child.replace(from - pos, to - pos,
|
|
14105
|
+
let updated = child.replace(from - pos, to - pos, text2);
|
|
14099
14106
|
let totalLines = this.lines - child.lines + updated.lines;
|
|
14100
14107
|
if (updated.lines < totalLines >> 5 - 1 && updated.lines > totalLines >> 5 + 1) {
|
|
14101
14108
|
let copy = this.children.slice();
|
|
14102
14109
|
copy[i] = updated;
|
|
14103
|
-
return new TextNode(copy, this.length - (to - from) +
|
|
14110
|
+
return new TextNode(copy, this.length - (to - from) + text2.length);
|
|
14104
14111
|
}
|
|
14105
14112
|
return super.replace(pos, end, updated);
|
|
14106
14113
|
}
|
|
14107
14114
|
pos = end + 1;
|
|
14108
14115
|
}
|
|
14109
|
-
return super.replace(from, to,
|
|
14116
|
+
return super.replace(from, to, text2);
|
|
14110
14117
|
}
|
|
14111
14118
|
sliceString(from, to = this.length, lineSep = "\n") {
|
|
14112
14119
|
[from, to] = clip(this, from, to);
|
|
@@ -14189,15 +14196,15 @@ class TextNode extends Text {
|
|
|
14189
14196
|
}
|
|
14190
14197
|
}
|
|
14191
14198
|
Text.empty = /* @__PURE__ */ new TextLeaf([""], 0);
|
|
14192
|
-
function textLength(
|
|
14199
|
+
function textLength(text2) {
|
|
14193
14200
|
let length = -1;
|
|
14194
|
-
for (let line of
|
|
14201
|
+
for (let line of text2)
|
|
14195
14202
|
length += line.length + 1;
|
|
14196
14203
|
return length;
|
|
14197
14204
|
}
|
|
14198
|
-
function appendText(
|
|
14199
|
-
for (let pos = 0, i = 0, first = true; i <
|
|
14200
|
-
let line =
|
|
14205
|
+
function appendText(text2, target, from = 0, to = 1e9) {
|
|
14206
|
+
for (let pos = 0, i = 0, first = true; i < text2.length && pos <= to; i++) {
|
|
14207
|
+
let line = text2[i], end = pos + line.length;
|
|
14201
14208
|
if (end >= from) {
|
|
14202
14209
|
if (end > to)
|
|
14203
14210
|
line = line.slice(0, to - pos);
|
|
@@ -14213,17 +14220,17 @@ function appendText(text, target, from = 0, to = 1e9) {
|
|
|
14213
14220
|
}
|
|
14214
14221
|
return target;
|
|
14215
14222
|
}
|
|
14216
|
-
function sliceText(
|
|
14217
|
-
return appendText(
|
|
14223
|
+
function sliceText(text2, from, to) {
|
|
14224
|
+
return appendText(text2, [""], from, to);
|
|
14218
14225
|
}
|
|
14219
14226
|
class RawTextCursor {
|
|
14220
|
-
constructor(
|
|
14227
|
+
constructor(text2, dir = 1) {
|
|
14221
14228
|
this.dir = dir;
|
|
14222
14229
|
this.done = false;
|
|
14223
14230
|
this.lineBreak = false;
|
|
14224
14231
|
this.value = "";
|
|
14225
|
-
this.nodes = [
|
|
14226
|
-
this.offsets = [dir > 0 ? 1 : (
|
|
14232
|
+
this.nodes = [text2];
|
|
14233
|
+
this.offsets = [dir > 0 ? 1 : (text2 instanceof TextLeaf ? text2.text.length : text2.children.length) << 1];
|
|
14227
14234
|
}
|
|
14228
14235
|
nextInner(skip, dir) {
|
|
14229
14236
|
this.done = this.lineBreak = false;
|
|
@@ -14280,11 +14287,11 @@ class RawTextCursor {
|
|
|
14280
14287
|
}
|
|
14281
14288
|
}
|
|
14282
14289
|
class PartialTextCursor {
|
|
14283
|
-
constructor(
|
|
14290
|
+
constructor(text2, start, end) {
|
|
14284
14291
|
this.value = "";
|
|
14285
14292
|
this.done = false;
|
|
14286
|
-
this.cursor = new RawTextCursor(
|
|
14287
|
-
this.pos = start > end ?
|
|
14293
|
+
this.cursor = new RawTextCursor(text2, start > end ? -1 : 1);
|
|
14294
|
+
this.pos = start > end ? text2.length : 0;
|
|
14288
14295
|
this.from = Math.min(start, end);
|
|
14289
14296
|
this.to = Math.max(start, end);
|
|
14290
14297
|
}
|
|
@@ -14360,11 +14367,11 @@ class Line {
|
|
|
14360
14367
|
/**
|
|
14361
14368
|
@internal
|
|
14362
14369
|
*/
|
|
14363
|
-
constructor(from, to, number2,
|
|
14370
|
+
constructor(from, to, number2, text2) {
|
|
14364
14371
|
this.from = from;
|
|
14365
14372
|
this.to = to;
|
|
14366
14373
|
this.number = number2;
|
|
14367
|
-
this.text =
|
|
14374
|
+
this.text = text2;
|
|
14368
14375
|
}
|
|
14369
14376
|
/**
|
|
14370
14377
|
The length of the line (not including any line break after it).
|
|
@@ -14373,9 +14380,9 @@ class Line {
|
|
|
14373
14380
|
return this.to - this.from;
|
|
14374
14381
|
}
|
|
14375
14382
|
}
|
|
14376
|
-
function clip(
|
|
14377
|
-
from = Math.max(0, Math.min(
|
|
14378
|
-
return [from, Math.max(from, Math.min(
|
|
14383
|
+
function clip(text2, from, to) {
|
|
14384
|
+
from = Math.max(0, Math.min(text2.length, from));
|
|
14385
|
+
return [from, Math.max(from, Math.min(text2.length, to))];
|
|
14379
14386
|
}
|
|
14380
14387
|
function findClusterBreak(str, pos, forward = true, includeExtending = true) {
|
|
14381
14388
|
return findClusterBreak$1(str, pos, forward, includeExtending);
|
|
@@ -14593,7 +14600,7 @@ class ChangeSet extends ChangeDesc {
|
|
|
14593
14600
|
apply(doc2) {
|
|
14594
14601
|
if (this.length != doc2.length)
|
|
14595
14602
|
throw new RangeError("Applying change set to a document with the wrong length");
|
|
14596
|
-
iterChanges(this, (fromA, toA, fromB, _toB,
|
|
14603
|
+
iterChanges(this, (fromA, toA, fromB, _toB, text2) => doc2 = doc2.replace(fromB, fromB + (toA - fromA), text2), false);
|
|
14597
14604
|
return doc2;
|
|
14598
14605
|
}
|
|
14599
14606
|
mapDesc(other, before = false) {
|
|
@@ -14837,18 +14844,18 @@ function iterChanges(desc, f, individual) {
|
|
|
14837
14844
|
posA += len;
|
|
14838
14845
|
posB += len;
|
|
14839
14846
|
} else {
|
|
14840
|
-
let endA = posA, endB = posB,
|
|
14847
|
+
let endA = posA, endB = posB, text2 = Text.empty;
|
|
14841
14848
|
for (; ; ) {
|
|
14842
14849
|
endA += len;
|
|
14843
14850
|
endB += ins;
|
|
14844
14851
|
if (ins && inserted)
|
|
14845
|
-
|
|
14852
|
+
text2 = text2.append(inserted[i - 2 >> 1]);
|
|
14846
14853
|
if (individual || i == desc.sections.length || desc.sections[i + 1] < 0)
|
|
14847
14854
|
break;
|
|
14848
14855
|
len = desc.sections[i++];
|
|
14849
14856
|
ins = desc.sections[i++];
|
|
14850
14857
|
}
|
|
14851
|
-
f(posA, endA, posB, endB,
|
|
14858
|
+
f(posA, endA, posB, endB, text2);
|
|
14852
14859
|
posA = endA;
|
|
14853
14860
|
posB = endB;
|
|
14854
14861
|
}
|
|
@@ -16103,12 +16110,12 @@ class EditorState {
|
|
|
16103
16110
|
Create a [transaction spec](https://codemirror.net/6/docs/ref/#state.TransactionSpec) that
|
|
16104
16111
|
replaces every selection range with the given content.
|
|
16105
16112
|
*/
|
|
16106
|
-
replaceSelection(
|
|
16107
|
-
if (typeof
|
|
16108
|
-
|
|
16113
|
+
replaceSelection(text2) {
|
|
16114
|
+
if (typeof text2 == "string")
|
|
16115
|
+
text2 = this.toText(text2);
|
|
16109
16116
|
return this.changeByRange((range) => ({
|
|
16110
|
-
changes: { from: range.from, to: range.to, insert:
|
|
16111
|
-
range: EditorSelection.cursor(range.from +
|
|
16117
|
+
changes: { from: range.from, to: range.to, insert: text2 },
|
|
16118
|
+
range: EditorSelection.cursor(range.from + text2.length)
|
|
16112
16119
|
}));
|
|
16113
16120
|
}
|
|
16114
16121
|
/**
|
|
@@ -16327,18 +16334,18 @@ class EditorState {
|
|
|
16327
16334
|
this returns null.
|
|
16328
16335
|
*/
|
|
16329
16336
|
wordAt(pos) {
|
|
16330
|
-
let { text, from, length } = this.doc.lineAt(pos);
|
|
16337
|
+
let { text: text2, from, length } = this.doc.lineAt(pos);
|
|
16331
16338
|
let cat = this.charCategorizer(pos);
|
|
16332
16339
|
let start = pos - from, end = pos - from;
|
|
16333
16340
|
while (start > 0) {
|
|
16334
|
-
let prev = findClusterBreak(
|
|
16335
|
-
if (cat(
|
|
16341
|
+
let prev = findClusterBreak(text2, start, false);
|
|
16342
|
+
if (cat(text2.slice(prev, start)) != CharCategory.Word)
|
|
16336
16343
|
break;
|
|
16337
16344
|
start = prev;
|
|
16338
16345
|
}
|
|
16339
16346
|
while (end < length) {
|
|
16340
|
-
let next = findClusterBreak(
|
|
16341
|
-
if (cat(
|
|
16347
|
+
let next = findClusterBreak(text2, end);
|
|
16348
|
+
if (cat(text2.slice(end, next)) != CharCategory.Word)
|
|
16342
16349
|
break;
|
|
16343
16350
|
end = next;
|
|
16344
16351
|
}
|
|
@@ -17293,10 +17300,10 @@ class StyleSet {
|
|
|
17293
17300
|
if (root.adoptedStyleSheets.indexOf(this.sheet) < 0)
|
|
17294
17301
|
root.adoptedStyleSheets = [this.sheet, ...root.adoptedStyleSheets];
|
|
17295
17302
|
} else {
|
|
17296
|
-
let
|
|
17303
|
+
let text2 = "";
|
|
17297
17304
|
for (let i = 0; i < this.modules.length; i++)
|
|
17298
|
-
|
|
17299
|
-
this.styleTag.textContent =
|
|
17305
|
+
text2 += this.modules[i].getRules() + "\n";
|
|
17306
|
+
this.styleTag.textContent = text2;
|
|
17300
17307
|
let target = root.head || root;
|
|
17301
17308
|
if (this.styleTag.parentNode != target)
|
|
17302
17309
|
target.insertBefore(this.styleTag, target.firstChild);
|
|
@@ -18522,9 +18529,9 @@ function moveVisually(line, order, dir, start, forward) {
|
|
|
18522
18529
|
return EditorSelection.cursor(nextSpan.side(!forward, dir) + line.from, nextSpan.forward(forward, dir) ? 1 : -1, nextSpan.level);
|
|
18523
18530
|
return EditorSelection.cursor(nextIndex + line.from, span.forward(forward, dir) ? -1 : 1, span.level);
|
|
18524
18531
|
}
|
|
18525
|
-
function autoDirection(
|
|
18532
|
+
function autoDirection(text2, from, to) {
|
|
18526
18533
|
for (let i = from; i < to; i++) {
|
|
18527
|
-
let type2 = charType(
|
|
18534
|
+
let type2 = charType(text2.charCodeAt(i));
|
|
18528
18535
|
if (type2 == 1)
|
|
18529
18536
|
return LTR;
|
|
18530
18537
|
if (type2 == 2 || type2 == 4)
|
|
@@ -19227,9 +19234,9 @@ class MarkTile extends CompositeTile {
|
|
|
19227
19234
|
}
|
|
19228
19235
|
}
|
|
19229
19236
|
class TextTile extends Tile {
|
|
19230
|
-
constructor(dom,
|
|
19231
|
-
super(dom,
|
|
19232
|
-
this.text =
|
|
19237
|
+
constructor(dom, text2) {
|
|
19238
|
+
super(dom, text2.length);
|
|
19239
|
+
this.text = text2;
|
|
19233
19240
|
}
|
|
19234
19241
|
sync(track) {
|
|
19235
19242
|
if (this.flags & 2)
|
|
@@ -19276,8 +19283,8 @@ class TextTile extends Tile {
|
|
|
19276
19283
|
rect = Array.prototype.find.call(rects, (r) => r.width) || rect;
|
|
19277
19284
|
return flatten2 ? flattenRect(rect, flatten2 < 0) : rect || null;
|
|
19278
19285
|
}
|
|
19279
|
-
static of(
|
|
19280
|
-
let tile = new TextTile(dom || document.createTextNode(
|
|
19286
|
+
static of(text2, dom) {
|
|
19287
|
+
let tile = new TextTile(dom || document.createTextNode(text2), text2);
|
|
19281
19288
|
if (!dom)
|
|
19282
19289
|
tile.flags |= 2;
|
|
19283
19290
|
return tile;
|
|
@@ -19447,23 +19454,23 @@ class TileBuilder {
|
|
|
19447
19454
|
this.wrappers = [];
|
|
19448
19455
|
this.wrapperPos = 0;
|
|
19449
19456
|
}
|
|
19450
|
-
addText(
|
|
19457
|
+
addText(text2, marks, openStart, tile) {
|
|
19451
19458
|
var _a2;
|
|
19452
19459
|
this.flushBuffer();
|
|
19453
19460
|
let parent = this.ensureMarks(marks, openStart);
|
|
19454
19461
|
let prev = parent.lastChild;
|
|
19455
|
-
if (prev && prev.isText() && !(prev.flags & 8) && prev.length +
|
|
19462
|
+
if (prev && prev.isText() && !(prev.flags & 8) && prev.length + text2.length < 512) {
|
|
19456
19463
|
this.cache.reused.set(
|
|
19457
19464
|
prev,
|
|
19458
19465
|
2
|
|
19459
19466
|
/* Reused.DOM */
|
|
19460
19467
|
);
|
|
19461
|
-
let tile2 = parent.children[parent.children.length - 1] = new TextTile(prev.dom, prev.text +
|
|
19468
|
+
let tile2 = parent.children[parent.children.length - 1] = new TextTile(prev.dom, prev.text + text2);
|
|
19462
19469
|
tile2.parent = parent;
|
|
19463
19470
|
} else {
|
|
19464
|
-
parent.append(tile || TextTile.of(
|
|
19471
|
+
parent.append(tile || TextTile.of(text2, (_a2 = this.cache.find(TextTile)) === null || _a2 === void 0 ? void 0 : _a2.dom));
|
|
19465
19472
|
}
|
|
19466
|
-
this.pos +=
|
|
19473
|
+
this.pos += text2.length;
|
|
19467
19474
|
this.afterWidget = null;
|
|
19468
19475
|
}
|
|
19469
19476
|
addComposition(composition, context) {
|
|
@@ -19507,10 +19514,10 @@ class TileBuilder {
|
|
|
19507
19514
|
2
|
|
19508
19515
|
/* Reused.DOM */
|
|
19509
19516
|
);
|
|
19510
|
-
let
|
|
19511
|
-
|
|
19517
|
+
let text2 = new TextTile(composition.text, composition.text.nodeValue);
|
|
19518
|
+
text2.flags |= 8;
|
|
19512
19519
|
this.pos = composition.range.toB;
|
|
19513
|
-
head.append(
|
|
19520
|
+
head.append(text2);
|
|
19514
19521
|
}
|
|
19515
19522
|
addInlineWidget(widget, marks, openStart) {
|
|
19516
19523
|
let noSpace = this.afterWidget && widget.flags & 48 && (this.afterWidget.flags & 48) == (widget.flags & 48);
|
|
@@ -19982,9 +19989,9 @@ class TileUpdate {
|
|
|
19982
19989
|
this.old.advance(5, side, this.reuseWalker);
|
|
19983
19990
|
}
|
|
19984
19991
|
}
|
|
19985
|
-
getCompositionContext(
|
|
19992
|
+
getCompositionContext(text2) {
|
|
19986
19993
|
let marks = [], line = null;
|
|
19987
|
-
for (let parent =
|
|
19994
|
+
for (let parent = text2.parentNode; ; parent = parent.parentNode) {
|
|
19988
19995
|
let tile = Tile.get(parent);
|
|
19989
19996
|
if (parent == this.view.contentDOM)
|
|
19990
19997
|
break;
|
|
@@ -20223,9 +20230,9 @@ class DocView {
|
|
|
20223
20230
|
if (browser.gecko) {
|
|
20224
20231
|
let nextTo = nextToUneditable(anchor.node, anchor.offset);
|
|
20225
20232
|
if (nextTo && nextTo != (1 | 2)) {
|
|
20226
|
-
let
|
|
20227
|
-
if (
|
|
20228
|
-
anchor = new DOMPos(
|
|
20233
|
+
let text2 = (nextTo == 1 ? textNodeBefore : textNodeAfter)(anchor.node, anchor.offset);
|
|
20234
|
+
if (text2)
|
|
20235
|
+
anchor = new DOMPos(text2.node, text2.offset);
|
|
20229
20236
|
}
|
|
20230
20237
|
}
|
|
20231
20238
|
rawSel.collapse(anchor.node, anchor.offset);
|
|
@@ -20639,10 +20646,10 @@ function findCompositionRange(view, changes, headPos) {
|
|
|
20639
20646
|
let found = findCompositionNode(view, headPos);
|
|
20640
20647
|
if (!found)
|
|
20641
20648
|
return null;
|
|
20642
|
-
let { node: textNode, from, to } = found,
|
|
20643
|
-
if (/[\n\r]/.test(
|
|
20649
|
+
let { node: textNode, from, to } = found, text2 = textNode.nodeValue;
|
|
20650
|
+
if (/[\n\r]/.test(text2))
|
|
20644
20651
|
return null;
|
|
20645
|
-
if (view.state.doc.sliceString(found.from, found.to) !=
|
|
20652
|
+
if (view.state.doc.sliceString(found.from, found.to) != text2)
|
|
20646
20653
|
return null;
|
|
20647
20654
|
let inv = changes.invertedDesc;
|
|
20648
20655
|
return { range: new ChangedRange(inv.mapPos(from), inv.mapPos(to), from, to), text: textNode };
|
|
@@ -21112,8 +21119,8 @@ class DOMReader {
|
|
|
21112
21119
|
this.text = "";
|
|
21113
21120
|
this.lineSeparator = view.state.facet(EditorState.lineSeparator);
|
|
21114
21121
|
}
|
|
21115
|
-
append(
|
|
21116
|
-
this.text +=
|
|
21122
|
+
append(text2) {
|
|
21123
|
+
this.text += text2;
|
|
21117
21124
|
}
|
|
21118
21125
|
lineBreak() {
|
|
21119
21126
|
this.text += LineBreakPlaceholder;
|
|
@@ -21141,20 +21148,20 @@ class DOMReader {
|
|
|
21141
21148
|
return this;
|
|
21142
21149
|
}
|
|
21143
21150
|
readTextNode(node) {
|
|
21144
|
-
let
|
|
21151
|
+
let text2 = node.nodeValue;
|
|
21145
21152
|
for (let point of this.points)
|
|
21146
21153
|
if (point.node == node)
|
|
21147
|
-
point.pos = this.text.length + Math.min(point.offset,
|
|
21154
|
+
point.pos = this.text.length + Math.min(point.offset, text2.length);
|
|
21148
21155
|
for (let off = 0, re = this.lineSeparator ? null : /\r\n?|\n/g; ; ) {
|
|
21149
21156
|
let nextBreak = -1, breakSize = 1, m;
|
|
21150
21157
|
if (this.lineSeparator) {
|
|
21151
|
-
nextBreak =
|
|
21158
|
+
nextBreak = text2.indexOf(this.lineSeparator, off);
|
|
21152
21159
|
breakSize = this.lineSeparator.length;
|
|
21153
|
-
} else if (m = re.exec(
|
|
21160
|
+
} else if (m = re.exec(text2)) {
|
|
21154
21161
|
nextBreak = m.index;
|
|
21155
21162
|
breakSize = m[0].length;
|
|
21156
21163
|
}
|
|
21157
|
-
this.append(
|
|
21164
|
+
this.append(text2.slice(off, nextBreak < 0 ? text2.length : nextBreak));
|
|
21158
21165
|
if (nextBreak < 0)
|
|
21159
21166
|
break;
|
|
21160
21167
|
this.lineBreak();
|
|
@@ -21377,12 +21384,12 @@ function applyDOMChangeInner(view, change, newSel, lastKey = -1) {
|
|
|
21377
21384
|
// after a completion when you press enter
|
|
21378
21385
|
(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)))
|
|
21379
21386
|
return true;
|
|
21380
|
-
let
|
|
21387
|
+
let text2 = change.insert.toString();
|
|
21381
21388
|
if (view.inputState.composing >= 0)
|
|
21382
21389
|
view.inputState.composing++;
|
|
21383
21390
|
let defaultTr;
|
|
21384
21391
|
let defaultInsert = () => defaultTr || (defaultTr = applyDefaultInsert(view, change, newSel));
|
|
21385
|
-
if (!view.state.facet(inputHandler).some((h) => h(view, change.from, change.to,
|
|
21392
|
+
if (!view.state.facet(inputHandler).some((h) => h(view, change.from, change.to, text2, defaultInsert)))
|
|
21386
21393
|
view.dispatch(defaultInsert());
|
|
21387
21394
|
return true;
|
|
21388
21395
|
}
|
|
@@ -21841,16 +21848,16 @@ function capturePaste(view) {
|
|
|
21841
21848
|
doPaste(view, target.value);
|
|
21842
21849
|
}, 50);
|
|
21843
21850
|
}
|
|
21844
|
-
function textFilter(state, facet,
|
|
21851
|
+
function textFilter(state, facet, text2) {
|
|
21845
21852
|
for (let filter of state.facet(facet))
|
|
21846
|
-
|
|
21847
|
-
return
|
|
21853
|
+
text2 = filter(text2, state);
|
|
21854
|
+
return text2;
|
|
21848
21855
|
}
|
|
21849
21856
|
function doPaste(view, input) {
|
|
21850
21857
|
input = textFilter(view.state, clipboardInputFilter, input);
|
|
21851
|
-
let { state } = view, changes, i = 1,
|
|
21852
|
-
let byLine =
|
|
21853
|
-
let linewise = lastLinewiseCopy != null && state.selection.ranges.every((r) => r.empty) && lastLinewiseCopy ==
|
|
21858
|
+
let { state } = view, changes, i = 1, text2 = state.toText(input);
|
|
21859
|
+
let byLine = text2.lines == state.selection.ranges.length;
|
|
21860
|
+
let linewise = lastLinewiseCopy != null && state.selection.ranges.every((r) => r.empty) && lastLinewiseCopy == text2.toString();
|
|
21854
21861
|
if (linewise) {
|
|
21855
21862
|
let lastLine = -1;
|
|
21856
21863
|
changes = state.changeByRange((range) => {
|
|
@@ -21858,7 +21865,7 @@ function doPaste(view, input) {
|
|
|
21858
21865
|
if (line.from == lastLine)
|
|
21859
21866
|
return { range };
|
|
21860
21867
|
lastLine = line.from;
|
|
21861
|
-
let insert2 = state.toText((byLine ?
|
|
21868
|
+
let insert2 = state.toText((byLine ? text2.line(i++).text : input) + state.lineBreak);
|
|
21862
21869
|
return {
|
|
21863
21870
|
changes: { from: line.from, insert: insert2 },
|
|
21864
21871
|
range: EditorSelection.cursor(range.from + insert2.length)
|
|
@@ -21866,14 +21873,14 @@ function doPaste(view, input) {
|
|
|
21866
21873
|
});
|
|
21867
21874
|
} else if (byLine) {
|
|
21868
21875
|
changes = state.changeByRange((range) => {
|
|
21869
|
-
let line =
|
|
21876
|
+
let line = text2.line(i++);
|
|
21870
21877
|
return {
|
|
21871
21878
|
changes: { from: range.from, to: range.to, insert: line.text },
|
|
21872
21879
|
range: EditorSelection.cursor(range.from + line.length)
|
|
21873
21880
|
};
|
|
21874
21881
|
});
|
|
21875
21882
|
} else {
|
|
21876
|
-
changes = state.replaceSelection(
|
|
21883
|
+
changes = state.replaceSelection(text2);
|
|
21877
21884
|
}
|
|
21878
21885
|
view.dispatch(changes, {
|
|
21879
21886
|
userEvent: "input.paste",
|
|
@@ -22021,14 +22028,14 @@ handlers.dragend = (view) => {
|
|
|
22021
22028
|
view.inputState.draggedContent = null;
|
|
22022
22029
|
return false;
|
|
22023
22030
|
};
|
|
22024
|
-
function dropText(view, event,
|
|
22025
|
-
|
|
22026
|
-
if (!
|
|
22031
|
+
function dropText(view, event, text2, direct) {
|
|
22032
|
+
text2 = textFilter(view.state, clipboardInputFilter, text2);
|
|
22033
|
+
if (!text2)
|
|
22027
22034
|
return;
|
|
22028
22035
|
let dropPos = view.posAtCoords({ x: event.clientX, y: event.clientY }, false);
|
|
22029
22036
|
let { draggedContent } = view.inputState;
|
|
22030
22037
|
let del = direct && draggedContent && dragMovesSelection(view, event) ? { from: draggedContent.from, to: draggedContent.to } : null;
|
|
22031
|
-
let ins = { from: dropPos, insert:
|
|
22038
|
+
let ins = { from: dropPos, insert: text2 };
|
|
22032
22039
|
let changes = view.state.changes(del ? [del, ins] : ins);
|
|
22033
22040
|
view.focus();
|
|
22034
22041
|
view.dispatch({
|
|
@@ -22045,26 +22052,26 @@ handlers.drop = (view, event) => {
|
|
|
22045
22052
|
return true;
|
|
22046
22053
|
let files = event.dataTransfer.files;
|
|
22047
22054
|
if (files && files.length) {
|
|
22048
|
-
let
|
|
22055
|
+
let text2 = Array(files.length), read = 0;
|
|
22049
22056
|
let finishFile = () => {
|
|
22050
22057
|
if (++read == files.length)
|
|
22051
|
-
dropText(view, event,
|
|
22058
|
+
dropText(view, event, text2.filter((s) => s != null).join(view.state.lineBreak), false);
|
|
22052
22059
|
};
|
|
22053
22060
|
for (let i = 0; i < files.length; i++) {
|
|
22054
22061
|
let reader = new FileReader();
|
|
22055
22062
|
reader.onerror = finishFile;
|
|
22056
22063
|
reader.onload = () => {
|
|
22057
22064
|
if (!/[\x00-\x08\x0e-\x1f]{2}/.test(reader.result))
|
|
22058
|
-
|
|
22065
|
+
text2[i] = reader.result;
|
|
22059
22066
|
finishFile();
|
|
22060
22067
|
};
|
|
22061
22068
|
reader.readAsText(files[i]);
|
|
22062
22069
|
}
|
|
22063
22070
|
return true;
|
|
22064
22071
|
} else {
|
|
22065
|
-
let
|
|
22066
|
-
if (
|
|
22067
|
-
dropText(view, event,
|
|
22072
|
+
let text2 = event.dataTransfer.getData("Text");
|
|
22073
|
+
if (text2) {
|
|
22074
|
+
dropText(view, event, text2, true);
|
|
22068
22075
|
return true;
|
|
22069
22076
|
}
|
|
22070
22077
|
}
|
|
@@ -22083,15 +22090,15 @@ handlers.paste = (view, event) => {
|
|
|
22083
22090
|
return false;
|
|
22084
22091
|
}
|
|
22085
22092
|
};
|
|
22086
|
-
function captureCopy(view,
|
|
22093
|
+
function captureCopy(view, text2) {
|
|
22087
22094
|
let parent = view.dom.parentNode;
|
|
22088
22095
|
if (!parent)
|
|
22089
22096
|
return;
|
|
22090
22097
|
let target = parent.appendChild(document.createElement("textarea"));
|
|
22091
22098
|
target.style.cssText = "position: fixed; left: -10000px; top: 10px";
|
|
22092
|
-
target.value =
|
|
22099
|
+
target.value = text2;
|
|
22093
22100
|
target.focus();
|
|
22094
|
-
target.selectionEnd =
|
|
22101
|
+
target.selectionEnd = text2.length;
|
|
22095
22102
|
target.selectionStart = 0;
|
|
22096
22103
|
setTimeout(() => {
|
|
22097
22104
|
target.remove();
|
|
@@ -22123,10 +22130,10 @@ let lastLinewiseCopy = null;
|
|
|
22123
22130
|
handlers.copy = handlers.cut = (view, event) => {
|
|
22124
22131
|
if (!hasSelection(view.contentDOM, view.observer.selectionRange))
|
|
22125
22132
|
return false;
|
|
22126
|
-
let { text, ranges, linewise } = copiedRange(view.state);
|
|
22127
|
-
if (!
|
|
22133
|
+
let { text: text2, ranges, linewise } = copiedRange(view.state);
|
|
22134
|
+
if (!text2 && !linewise)
|
|
22128
22135
|
return false;
|
|
22129
|
-
lastLinewiseCopy = linewise ?
|
|
22136
|
+
lastLinewiseCopy = linewise ? text2 : null;
|
|
22130
22137
|
if (event.type == "cut" && !view.state.readOnly)
|
|
22131
22138
|
view.dispatch({
|
|
22132
22139
|
changes: ranges,
|
|
@@ -22136,10 +22143,10 @@ handlers.copy = handlers.cut = (view, event) => {
|
|
|
22136
22143
|
let data = brokenClipboardAPI ? null : event.clipboardData;
|
|
22137
22144
|
if (data) {
|
|
22138
22145
|
data.clearData();
|
|
22139
|
-
data.setData("text/plain",
|
|
22146
|
+
data.setData("text/plain", text2);
|
|
22140
22147
|
return true;
|
|
22141
22148
|
} else {
|
|
22142
|
-
captureCopy(view,
|
|
22149
|
+
captureCopy(view, text2);
|
|
22143
22150
|
return false;
|
|
22144
22151
|
}
|
|
22145
22152
|
};
|
|
@@ -22215,11 +22222,11 @@ handlers.beforeinput = (view, event) => {
|
|
|
22215
22222
|
view.inputState.insertingTextAt = Date.now();
|
|
22216
22223
|
}
|
|
22217
22224
|
if (event.inputType == "insertReplacementText" && view.observer.editContext) {
|
|
22218
|
-
let
|
|
22219
|
-
if (
|
|
22225
|
+
let text2 = (_a2 = event.dataTransfer) === null || _a2 === void 0 ? void 0 : _a2.getData("text/plain"), ranges = event.getTargetRanges();
|
|
22226
|
+
if (text2 && ranges.length) {
|
|
22220
22227
|
let r = ranges[0];
|
|
22221
22228
|
let from = view.posAtDOM(r.startContainer, r.startOffset), to = view.posAtDOM(r.endContainer, r.endOffset);
|
|
22222
|
-
applyDOMChangeInner(view, { from, to, insert: view.state.toText(
|
|
22229
|
+
applyDOMChangeInner(view, { from, to, insert: view.state.toText(text2) }, null);
|
|
22223
22230
|
return true;
|
|
22224
22231
|
}
|
|
22225
22232
|
}
|
|
@@ -30833,18 +30840,18 @@ class IndentContext {
|
|
|
30833
30840
|
textAfterPos(pos, bias = 1) {
|
|
30834
30841
|
if (this.options.simulateDoubleBreak && pos == this.options.simulateBreak)
|
|
30835
30842
|
return "";
|
|
30836
|
-
let { text, from } = this.lineAt(pos, bias);
|
|
30837
|
-
return
|
|
30843
|
+
let { text: text2, from } = this.lineAt(pos, bias);
|
|
30844
|
+
return text2.slice(pos - from, Math.min(text2.length, pos + 100 - from));
|
|
30838
30845
|
}
|
|
30839
30846
|
/**
|
|
30840
30847
|
Find the column for the given position.
|
|
30841
30848
|
*/
|
|
30842
30849
|
column(pos, bias = 1) {
|
|
30843
|
-
let { text, from } = this.lineAt(pos, bias);
|
|
30844
|
-
let result = this.countColumn(
|
|
30850
|
+
let { text: text2, from } = this.lineAt(pos, bias);
|
|
30851
|
+
let result = this.countColumn(text2, pos - from);
|
|
30845
30852
|
let override = this.options.overrideIndentation ? this.options.overrideIndentation(from) : -1;
|
|
30846
30853
|
if (override > -1)
|
|
30847
|
-
result += override - this.countColumn(
|
|
30854
|
+
result += override - this.countColumn(text2, text2.search(/\S|$/));
|
|
30848
30855
|
return result;
|
|
30849
30856
|
}
|
|
30850
30857
|
/**
|
|
@@ -30858,14 +30865,14 @@ class IndentContext {
|
|
|
30858
30865
|
Find the indentation column of the line at the given point.
|
|
30859
30866
|
*/
|
|
30860
30867
|
lineIndent(pos, bias = 1) {
|
|
30861
|
-
let { text, from } = this.lineAt(pos, bias);
|
|
30868
|
+
let { text: text2, from } = this.lineAt(pos, bias);
|
|
30862
30869
|
let override = this.options.overrideIndentation;
|
|
30863
30870
|
if (override) {
|
|
30864
30871
|
let overriden = override(from);
|
|
30865
30872
|
if (overriden > -1)
|
|
30866
30873
|
return overriden;
|
|
30867
30874
|
}
|
|
30868
|
-
return this.countColumn(
|
|
30875
|
+
return this.countColumn(text2, text2.search(/\S|$/));
|
|
30869
30876
|
}
|
|
30870
30877
|
/**
|
|
30871
30878
|
Returns the [simulated line
|
|
@@ -31362,12 +31369,12 @@ function matchPlainBrackets(state, pos, dir, tree, tokenType, maxScanDistance, b
|
|
|
31362
31369
|
let startToken = { from: dir < 0 ? pos - 1 : pos, to: dir > 0 ? pos + 1 : pos };
|
|
31363
31370
|
let iter = state.doc.iterRange(pos, dir > 0 ? state.doc.length : 0), depth = 0;
|
|
31364
31371
|
for (let distance = 0; !iter.next().done && distance <= maxScanDistance; ) {
|
|
31365
|
-
let
|
|
31372
|
+
let text2 = iter.value;
|
|
31366
31373
|
if (dir < 0)
|
|
31367
|
-
distance +=
|
|
31374
|
+
distance += text2.length;
|
|
31368
31375
|
let basePos = pos + distance * dir;
|
|
31369
|
-
for (let pos2 = dir > 0 ? 0 :
|
|
31370
|
-
let found = brackets.indexOf(
|
|
31376
|
+
for (let pos2 = dir > 0 ? 0 : text2.length - 1, end = dir > 0 ? text2.length : -1; pos2 != end; pos2 += dir) {
|
|
31377
|
+
let found = brackets.indexOf(text2[pos2]);
|
|
31371
31378
|
if (found < 0 || tree.resolveInner(basePos + pos2, 1).type != tokenType)
|
|
31372
31379
|
continue;
|
|
31373
31380
|
if (found % 2 == 0 == dir > 0) {
|
|
@@ -31379,7 +31386,7 @@ function matchPlainBrackets(state, pos, dir, tree, tokenType, maxScanDistance, b
|
|
|
31379
31386
|
}
|
|
31380
31387
|
}
|
|
31381
31388
|
if (dir > 0)
|
|
31382
|
-
distance +=
|
|
31389
|
+
distance += text2.length;
|
|
31383
31390
|
}
|
|
31384
31391
|
return iter.done ? { start: startToken, matched: false } : null;
|
|
31385
31392
|
}
|
|
@@ -32543,14 +32550,14 @@ class SearchCursor {
|
|
|
32543
32550
|
[`.normalize("NFKD")`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize)
|
|
32544
32551
|
(when supported).
|
|
32545
32552
|
*/
|
|
32546
|
-
constructor(
|
|
32553
|
+
constructor(text2, query, from = 0, to = text2.length, normalize, test) {
|
|
32547
32554
|
this.test = test;
|
|
32548
32555
|
this.value = { from: 0, to: 0, precise: false };
|
|
32549
32556
|
this.done = false;
|
|
32550
32557
|
this.matches = [];
|
|
32551
32558
|
this.buffer = "";
|
|
32552
32559
|
this.bufferPos = 0;
|
|
32553
|
-
this.iter =
|
|
32560
|
+
this.iter = text2.iterRange(from, to);
|
|
32554
32561
|
this.bufferStart = from;
|
|
32555
32562
|
this.normalize = normalize ? (x) => normalize(basicNormalize(x)) : basicNormalize;
|
|
32556
32563
|
this.query = this.normalize(query);
|
|
@@ -32649,20 +32656,20 @@ class RegExpCursor {
|
|
|
32649
32656
|
document. `query` should be the raw pattern (as you'd pass it to
|
|
32650
32657
|
`new RegExp`).
|
|
32651
32658
|
*/
|
|
32652
|
-
constructor(
|
|
32653
|
-
this.text =
|
|
32659
|
+
constructor(text2, query, options, from = 0, to = text2.length) {
|
|
32660
|
+
this.text = text2;
|
|
32654
32661
|
this.to = to;
|
|
32655
32662
|
this.curLine = "";
|
|
32656
32663
|
this.done = false;
|
|
32657
32664
|
this.value = empty;
|
|
32658
32665
|
if (/\\[sWDnr]|\n|\r|\[\^/.test(query))
|
|
32659
|
-
return new MultilineRegExpCursor(
|
|
32666
|
+
return new MultilineRegExpCursor(text2, query, options, from, to);
|
|
32660
32667
|
this.re = new RegExp(query, baseFlags + ((options === null || options === void 0 ? void 0 : options.ignoreCase) ? "i" : ""));
|
|
32661
32668
|
this.test = options === null || options === void 0 ? void 0 : options.test;
|
|
32662
|
-
this.iter =
|
|
32663
|
-
let startLine =
|
|
32669
|
+
this.iter = text2.iter();
|
|
32670
|
+
let startLine = text2.lineAt(from);
|
|
32664
32671
|
this.curLineStart = startLine.from;
|
|
32665
|
-
this.matchPos = toCharEnd(
|
|
32672
|
+
this.matchPos = toCharEnd(text2, from);
|
|
32666
32673
|
this.getLine(this.curLineStart);
|
|
32667
32674
|
}
|
|
32668
32675
|
getLine(skip) {
|
|
@@ -32712,9 +32719,9 @@ class RegExpCursor {
|
|
|
32712
32719
|
}
|
|
32713
32720
|
const flattened = /* @__PURE__ */ new WeakMap();
|
|
32714
32721
|
class FlattenedDoc {
|
|
32715
|
-
constructor(from,
|
|
32722
|
+
constructor(from, text2) {
|
|
32716
32723
|
this.from = from;
|
|
32717
|
-
this.text =
|
|
32724
|
+
this.text = text2;
|
|
32718
32725
|
}
|
|
32719
32726
|
get to() {
|
|
32720
32727
|
return this.from + this.text.length;
|
|
@@ -32728,27 +32735,27 @@ class FlattenedDoc {
|
|
|
32728
32735
|
}
|
|
32729
32736
|
if (cached2.from == from && cached2.to == to)
|
|
32730
32737
|
return cached2;
|
|
32731
|
-
let { text, from: cachedFrom } = cached2;
|
|
32738
|
+
let { text: text2, from: cachedFrom } = cached2;
|
|
32732
32739
|
if (cachedFrom > from) {
|
|
32733
|
-
|
|
32740
|
+
text2 = doc2.sliceString(from, cachedFrom) + text2;
|
|
32734
32741
|
cachedFrom = from;
|
|
32735
32742
|
}
|
|
32736
32743
|
if (cached2.to < to)
|
|
32737
|
-
|
|
32738
|
-
flattened.set(doc2, new FlattenedDoc(cachedFrom,
|
|
32739
|
-
return new FlattenedDoc(from,
|
|
32744
|
+
text2 += doc2.sliceString(cached2.to, to);
|
|
32745
|
+
flattened.set(doc2, new FlattenedDoc(cachedFrom, text2));
|
|
32746
|
+
return new FlattenedDoc(from, text2.slice(from - cachedFrom, to - cachedFrom));
|
|
32740
32747
|
}
|
|
32741
32748
|
}
|
|
32742
32749
|
class MultilineRegExpCursor {
|
|
32743
|
-
constructor(
|
|
32744
|
-
this.text =
|
|
32750
|
+
constructor(text2, query, options, from, to) {
|
|
32751
|
+
this.text = text2;
|
|
32745
32752
|
this.to = to;
|
|
32746
32753
|
this.done = false;
|
|
32747
32754
|
this.value = empty;
|
|
32748
|
-
this.matchPos = toCharEnd(
|
|
32755
|
+
this.matchPos = toCharEnd(text2, from);
|
|
32749
32756
|
this.re = new RegExp(query, baseFlags + ((options === null || options === void 0 ? void 0 : options.ignoreCase) ? "i" : ""));
|
|
32750
32757
|
this.test = options === null || options === void 0 ? void 0 : options.test;
|
|
32751
|
-
this.flat = FlattenedDoc.get(
|
|
32758
|
+
this.flat = FlattenedDoc.get(text2, from, this.chunkEnd(
|
|
32752
32759
|
from + 5e3
|
|
32753
32760
|
/* Chunk.Base */
|
|
32754
32761
|
));
|
|
@@ -32793,10 +32800,10 @@ function validRegExp(source) {
|
|
|
32793
32800
|
return false;
|
|
32794
32801
|
}
|
|
32795
32802
|
}
|
|
32796
|
-
function toCharEnd(
|
|
32797
|
-
if (pos >=
|
|
32803
|
+
function toCharEnd(text2, pos) {
|
|
32804
|
+
if (pos >= text2.length)
|
|
32798
32805
|
return pos;
|
|
32799
|
-
let line =
|
|
32806
|
+
let line = text2.lineAt(pos), next;
|
|
32800
32807
|
while (pos < line.to && (next = line.text.charCodeAt(pos - line.from)) >= 56320 && next < 57344)
|
|
32801
32808
|
pos++;
|
|
32802
32809
|
return pos;
|
|
@@ -33002,8 +33009,8 @@ class SearchQuery {
|
|
|
33002
33009
|
/**
|
|
33003
33010
|
@internal
|
|
33004
33011
|
*/
|
|
33005
|
-
unquote(
|
|
33006
|
-
return this.literal ?
|
|
33012
|
+
unquote(text2) {
|
|
33013
|
+
return this.literal ? text2 : text2.replace(/\\([nrt\\])/g, (_, ch) => ch == "n" ? "\n" : ch == "r" ? "\r" : ch == "t" ? " " : "\\");
|
|
33007
33014
|
}
|
|
33008
33015
|
/**
|
|
33009
33016
|
Compare this query to another query.
|
|
@@ -33552,22 +33559,22 @@ const Break = /[\s\.,:;?!]/;
|
|
|
33552
33559
|
function announceMatch(view, { from, to }) {
|
|
33553
33560
|
let line = view.state.doc.lineAt(from), lineEnd = view.state.doc.lineAt(to).to;
|
|
33554
33561
|
let start = Math.max(line.from, from - AnnounceMargin), end = Math.min(lineEnd, to + AnnounceMargin);
|
|
33555
|
-
let
|
|
33562
|
+
let text2 = view.state.sliceDoc(start, end);
|
|
33556
33563
|
if (start != line.from) {
|
|
33557
33564
|
for (let i = 0; i < AnnounceMargin; i++)
|
|
33558
|
-
if (!Break.test(
|
|
33559
|
-
|
|
33565
|
+
if (!Break.test(text2[i + 1]) && Break.test(text2[i])) {
|
|
33566
|
+
text2 = text2.slice(i);
|
|
33560
33567
|
break;
|
|
33561
33568
|
}
|
|
33562
33569
|
}
|
|
33563
33570
|
if (end != lineEnd) {
|
|
33564
|
-
for (let i =
|
|
33565
|
-
if (!Break.test(
|
|
33566
|
-
|
|
33571
|
+
for (let i = text2.length - 1; i > text2.length - AnnounceMargin; i--)
|
|
33572
|
+
if (!Break.test(text2[i - 1]) && Break.test(text2[i])) {
|
|
33573
|
+
text2 = text2.slice(0, i);
|
|
33567
33574
|
break;
|
|
33568
33575
|
}
|
|
33569
33576
|
}
|
|
33570
|
-
return EditorView.announce.of(`${view.state.phrase("current match")}. ${
|
|
33577
|
+
return EditorView.announce.of(`${view.state.phrase("current match")}. ${text2} ${view.state.phrase("on line")} ${line.number}.`);
|
|
33571
33578
|
}
|
|
33572
33579
|
const baseTheme$2 = /* @__PURE__ */ EditorView.baseTheme({
|
|
33573
33580
|
".cm-panel.cm-search": {
|
|
@@ -35677,13 +35684,13 @@ function ensureAnchor(expr, start) {
|
|
|
35677
35684
|
return new RegExp(`${addStart ? "^" : ""}(?:${source})${addEnd ? "$" : ""}`, (_a2 = expr.flags) !== null && _a2 !== void 0 ? _a2 : expr.ignoreCase ? "i" : "");
|
|
35678
35685
|
}
|
|
35679
35686
|
const pickedCompletion = /* @__PURE__ */ Annotation.define();
|
|
35680
|
-
function insertCompletionText(state,
|
|
35687
|
+
function insertCompletionText(state, text2, from, to) {
|
|
35681
35688
|
let { main } = state.selection, fromOff = from - main.from, toOff = to - main.from;
|
|
35682
35689
|
return {
|
|
35683
35690
|
...state.changeByRange((range) => {
|
|
35684
35691
|
if (range != main && from != to && state.sliceDoc(range.from + fromOff, range.from + toOff) != state.sliceDoc(from, to))
|
|
35685
35692
|
return { range };
|
|
35686
|
-
let lines = state.toText(
|
|
35693
|
+
let lines = state.toText(text2);
|
|
35687
35694
|
return {
|
|
35688
35695
|
changes: { from: range.from + fromOff, to: to == main.from ? range.to : range.from + toOff, insert: lines },
|
|
35689
35696
|
range: EditorSelection.cursor(range.from + fromOff + lines.length)
|
|
@@ -36523,8 +36530,8 @@ class ActiveResult extends ActiveSource {
|
|
|
36523
36530
|
function checkValid(validFor, state, from, to) {
|
|
36524
36531
|
if (!validFor)
|
|
36525
36532
|
return false;
|
|
36526
|
-
let
|
|
36527
|
-
return typeof validFor == "function" ? validFor(
|
|
36533
|
+
let text2 = state.sliceDoc(from, to);
|
|
36534
|
+
return typeof validFor == "function" ? validFor(text2, from, to, state) : ensureAnchor(validFor, true).test(text2);
|
|
36528
36535
|
}
|
|
36529
36536
|
const setActiveEffect = /* @__PURE__ */ StateEffect.define({
|
|
36530
36537
|
map(sources, mapping) {
|
|
@@ -36923,21 +36930,21 @@ class Snippet {
|
|
|
36923
36930
|
this.fieldPositions = fieldPositions;
|
|
36924
36931
|
}
|
|
36925
36932
|
instantiate(state, pos) {
|
|
36926
|
-
let
|
|
36933
|
+
let text2 = [], lineStart = [pos];
|
|
36927
36934
|
let lineObj = state.doc.lineAt(pos), baseIndent = /^\s*/.exec(lineObj.text)[0];
|
|
36928
36935
|
for (let line of this.lines) {
|
|
36929
|
-
if (
|
|
36936
|
+
if (text2.length) {
|
|
36930
36937
|
let indent = baseIndent, tabs = /^\t*/.exec(line)[0].length;
|
|
36931
36938
|
for (let i = 0; i < tabs; i++)
|
|
36932
36939
|
indent += state.facet(indentUnit);
|
|
36933
36940
|
lineStart.push(pos + indent.length - tabs);
|
|
36934
36941
|
line = indent + line.slice(tabs);
|
|
36935
36942
|
}
|
|
36936
|
-
|
|
36943
|
+
text2.push(line);
|
|
36937
36944
|
pos += line.length + 1;
|
|
36938
36945
|
}
|
|
36939
36946
|
let ranges = this.fieldPositions.map((pos2) => new FieldRange(pos2.field, lineStart[pos2.line] + pos2.from, lineStart[pos2.line] + pos2.to));
|
|
36940
|
-
return { text, ranges };
|
|
36947
|
+
return { text: text2, ranges };
|
|
36941
36948
|
}
|
|
36942
36949
|
static parse(template) {
|
|
36943
36950
|
let fields = [];
|
|
@@ -37044,10 +37051,10 @@ function fieldSelection(ranges, field) {
|
|
|
37044
37051
|
function snippet(template) {
|
|
37045
37052
|
let snippet2 = Snippet.parse(template);
|
|
37046
37053
|
return (editor, completion, from, to) => {
|
|
37047
|
-
let { text, ranges } = snippet2.instantiate(editor.state, from);
|
|
37054
|
+
let { text: text2, ranges } = snippet2.instantiate(editor.state, from);
|
|
37048
37055
|
let { main } = editor.state.selection;
|
|
37049
37056
|
let spec = {
|
|
37050
|
-
changes: { from, to: to == main.from ? main.to : to, insert: Text.of(
|
|
37057
|
+
changes: { from, to: to == main.from ? main.to : to, insert: Text.of(text2) },
|
|
37051
37058
|
scrollIntoView: true,
|
|
37052
37059
|
annotations: completion ? [pickedCompletion.of(completion), Transaction.userEvent.of("input.complete")] : void 0
|
|
37053
37060
|
};
|
|
@@ -37417,8 +37424,8 @@ function elementName(doc2, tree, max = doc2.length) {
|
|
|
37417
37424
|
return "";
|
|
37418
37425
|
}
|
|
37419
37426
|
const android = typeof navigator == "object" && /* @__PURE__ */ /Android\b/.test(navigator.userAgent);
|
|
37420
|
-
const autoCloseTags = /* @__PURE__ */ EditorView.inputHandler.of((view, from, to,
|
|
37421
|
-
if ((android ? view.composing : view.compositionStarted) || view.state.readOnly || from != to ||
|
|
37427
|
+
const autoCloseTags = /* @__PURE__ */ EditorView.inputHandler.of((view, from, to, text2, defaultInsert) => {
|
|
37428
|
+
if ((android ? view.composing : view.compositionStarted) || view.state.readOnly || from != to || text2 != ">" && text2 != "/" || !javascriptLanguage.isActiveAt(view.state, from, -1))
|
|
37422
37429
|
return false;
|
|
37423
37430
|
let base2 = defaultInsert(), { state } = base2;
|
|
37424
37431
|
let closeTags = state.changeByRange((range) => {
|
|
@@ -37426,16 +37433,16 @@ const autoCloseTags = /* @__PURE__ */ EditorView.inputHandler.of((view, from, to
|
|
|
37426
37433
|
let { head } = range, around = syntaxTree(state).resolveInner(head - 1, -1), name2;
|
|
37427
37434
|
if (around.name == "JSXStartTag")
|
|
37428
37435
|
around = around.parent;
|
|
37429
|
-
if (state.doc.sliceString(head - 1, head) !=
|
|
37430
|
-
else if (
|
|
37436
|
+
if (state.doc.sliceString(head - 1, head) != text2 || around.name == "JSXAttributeValue" && around.to > head) ;
|
|
37437
|
+
else if (text2 == ">" && around.name == "JSXFragmentTag") {
|
|
37431
37438
|
return { range, changes: { from: head, insert: `</>` } };
|
|
37432
|
-
} else if (
|
|
37439
|
+
} else if (text2 == "/" && around.name == "JSXStartCloseTag") {
|
|
37433
37440
|
let empty2 = around.parent, base3 = empty2.parent;
|
|
37434
37441
|
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")) {
|
|
37435
37442
|
let insert2 = `${name2}>`;
|
|
37436
37443
|
return { range: EditorSelection.cursor(head + insert2.length, -1), changes: { from: head, insert: insert2 } };
|
|
37437
37444
|
}
|
|
37438
|
-
} else if (
|
|
37445
|
+
} else if (text2 == ">") {
|
|
37439
37446
|
let openTag = findOpenTag(around);
|
|
37440
37447
|
if (openTag && openTag.name == "JSXOpenTag" && !/^\/?>|^<\//.test(state.doc.sliceString(head, head + 2)) && (name2 = elementName(state.doc, openTag, head)))
|
|
37441
37448
|
return { range, changes: { from: head, insert: `</${name2}>` } };
|
|
@@ -38075,8 +38082,8 @@ function requireDiffMatchPatch() {
|
|
|
38075
38082
|
var DIFF_DELETE = -1;
|
|
38076
38083
|
var DIFF_INSERT = 1;
|
|
38077
38084
|
var DIFF_EQUAL = 0;
|
|
38078
|
-
diff_match_patch.Diff = function(op,
|
|
38079
|
-
return [op,
|
|
38085
|
+
diff_match_patch.Diff = function(op, text2) {
|
|
38086
|
+
return [op, text2];
|
|
38080
38087
|
};
|
|
38081
38088
|
diff_match_patch.prototype.diff_main = function(text1, text2, opt_checklines, opt_deadline) {
|
|
38082
38089
|
if (typeof opt_deadline == "undefined") {
|
|
@@ -38317,23 +38324,23 @@ function requireDiffMatchPatch() {
|
|
|
38317
38324
|
var lineArray = [];
|
|
38318
38325
|
var lineHash = {};
|
|
38319
38326
|
lineArray[0] = "";
|
|
38320
|
-
function diff_linesToCharsMunge_(
|
|
38327
|
+
function diff_linesToCharsMunge_(text3) {
|
|
38321
38328
|
var chars = "";
|
|
38322
38329
|
var lineStart = 0;
|
|
38323
38330
|
var lineEnd = -1;
|
|
38324
38331
|
var lineArrayLength = lineArray.length;
|
|
38325
|
-
while (lineEnd <
|
|
38326
|
-
lineEnd =
|
|
38332
|
+
while (lineEnd < text3.length - 1) {
|
|
38333
|
+
lineEnd = text3.indexOf("\n", lineStart);
|
|
38327
38334
|
if (lineEnd == -1) {
|
|
38328
|
-
lineEnd =
|
|
38335
|
+
lineEnd = text3.length - 1;
|
|
38329
38336
|
}
|
|
38330
|
-
var line =
|
|
38337
|
+
var line = text3.substring(lineStart, lineEnd + 1);
|
|
38331
38338
|
if (lineHash.hasOwnProperty ? lineHash.hasOwnProperty(line) : lineHash[line] !== void 0) {
|
|
38332
38339
|
chars += String.fromCharCode(lineHash[line]);
|
|
38333
38340
|
} else {
|
|
38334
38341
|
if (lineArrayLength == maxLines) {
|
|
38335
|
-
line =
|
|
38336
|
-
lineEnd =
|
|
38342
|
+
line = text3.substring(lineStart);
|
|
38343
|
+
lineEnd = text3.length;
|
|
38337
38344
|
}
|
|
38338
38345
|
chars += String.fromCharCode(lineArrayLength);
|
|
38339
38346
|
lineHash[line] = lineArrayLength;
|
|
@@ -38352,11 +38359,11 @@ function requireDiffMatchPatch() {
|
|
|
38352
38359
|
diff_match_patch.prototype.diff_charsToLines_ = function(diffs, lineArray) {
|
|
38353
38360
|
for (var i = 0; i < diffs.length; i++) {
|
|
38354
38361
|
var chars = diffs[i][1];
|
|
38355
|
-
var
|
|
38362
|
+
var text2 = [];
|
|
38356
38363
|
for (var j = 0; j < chars.length; j++) {
|
|
38357
|
-
|
|
38364
|
+
text2[j] = lineArray[chars.charCodeAt(j)];
|
|
38358
38365
|
}
|
|
38359
|
-
diffs[i][1] =
|
|
38366
|
+
diffs[i][1] = text2.join("");
|
|
38360
38367
|
}
|
|
38361
38368
|
};
|
|
38362
38369
|
diff_match_patch.prototype.diff_commonPrefix = function(text1, text2) {
|
|
@@ -38861,38 +38868,38 @@ function requireDiffMatchPatch() {
|
|
|
38861
38868
|
for (var x = 0; x < diffs.length; x++) {
|
|
38862
38869
|
var op = diffs[x][0];
|
|
38863
38870
|
var data = diffs[x][1];
|
|
38864
|
-
var
|
|
38871
|
+
var text2 = data.replace(pattern_amp, "&").replace(pattern_lt, "<").replace(pattern_gt, ">").replace(pattern_para, "¶<br>");
|
|
38865
38872
|
switch (op) {
|
|
38866
38873
|
case DIFF_INSERT:
|
|
38867
|
-
html[x] = '<ins style="background:#e6ffe6;">' +
|
|
38874
|
+
html[x] = '<ins style="background:#e6ffe6;">' + text2 + "</ins>";
|
|
38868
38875
|
break;
|
|
38869
38876
|
case DIFF_DELETE:
|
|
38870
|
-
html[x] = '<del style="background:#ffe6e6;">' +
|
|
38877
|
+
html[x] = '<del style="background:#ffe6e6;">' + text2 + "</del>";
|
|
38871
38878
|
break;
|
|
38872
38879
|
case DIFF_EQUAL:
|
|
38873
|
-
html[x] = "<span>" +
|
|
38880
|
+
html[x] = "<span>" + text2 + "</span>";
|
|
38874
38881
|
break;
|
|
38875
38882
|
}
|
|
38876
38883
|
}
|
|
38877
38884
|
return html.join("");
|
|
38878
38885
|
};
|
|
38879
38886
|
diff_match_patch.prototype.diff_text1 = function(diffs) {
|
|
38880
|
-
var
|
|
38887
|
+
var text2 = [];
|
|
38881
38888
|
for (var x = 0; x < diffs.length; x++) {
|
|
38882
38889
|
if (diffs[x][0] !== DIFF_INSERT) {
|
|
38883
|
-
|
|
38890
|
+
text2[x] = diffs[x][1];
|
|
38884
38891
|
}
|
|
38885
38892
|
}
|
|
38886
|
-
return
|
|
38893
|
+
return text2.join("");
|
|
38887
38894
|
};
|
|
38888
38895
|
diff_match_patch.prototype.diff_text2 = function(diffs) {
|
|
38889
|
-
var
|
|
38896
|
+
var text2 = [];
|
|
38890
38897
|
for (var x = 0; x < diffs.length; x++) {
|
|
38891
38898
|
if (diffs[x][0] !== DIFF_DELETE) {
|
|
38892
|
-
|
|
38899
|
+
text2[x] = diffs[x][1];
|
|
38893
38900
|
}
|
|
38894
38901
|
}
|
|
38895
|
-
return
|
|
38902
|
+
return text2.join("");
|
|
38896
38903
|
};
|
|
38897
38904
|
diff_match_patch.prototype.diff_levenshtein = function(diffs) {
|
|
38898
38905
|
var levenshtein = 0;
|
|
@@ -38919,21 +38926,21 @@ function requireDiffMatchPatch() {
|
|
|
38919
38926
|
return levenshtein;
|
|
38920
38927
|
};
|
|
38921
38928
|
diff_match_patch.prototype.diff_toDelta = function(diffs) {
|
|
38922
|
-
var
|
|
38929
|
+
var text2 = [];
|
|
38923
38930
|
for (var x = 0; x < diffs.length; x++) {
|
|
38924
38931
|
switch (diffs[x][0]) {
|
|
38925
38932
|
case DIFF_INSERT:
|
|
38926
|
-
|
|
38933
|
+
text2[x] = "+" + encodeURI(diffs[x][1]);
|
|
38927
38934
|
break;
|
|
38928
38935
|
case DIFF_DELETE:
|
|
38929
|
-
|
|
38936
|
+
text2[x] = "-" + diffs[x][1].length;
|
|
38930
38937
|
break;
|
|
38931
38938
|
case DIFF_EQUAL:
|
|
38932
|
-
|
|
38939
|
+
text2[x] = "=" + diffs[x][1].length;
|
|
38933
38940
|
break;
|
|
38934
38941
|
}
|
|
38935
38942
|
}
|
|
38936
|
-
return
|
|
38943
|
+
return text2.join(" ").replace(/%20/g, " ");
|
|
38937
38944
|
};
|
|
38938
38945
|
diff_match_patch.prototype.diff_fromDelta = function(text1, delta) {
|
|
38939
38946
|
var diffs = [];
|
|
@@ -38957,11 +38964,11 @@ function requireDiffMatchPatch() {
|
|
|
38957
38964
|
if (isNaN(n) || n < 0) {
|
|
38958
38965
|
throw new Error("Invalid number in diff_fromDelta: " + param);
|
|
38959
38966
|
}
|
|
38960
|
-
var
|
|
38967
|
+
var text2 = text1.substring(pointer, pointer += n);
|
|
38961
38968
|
if (tokens[x].charAt(0) == "=") {
|
|
38962
|
-
diffs[diffsLength++] = new diff_match_patch.Diff(DIFF_EQUAL,
|
|
38969
|
+
diffs[diffsLength++] = new diff_match_patch.Diff(DIFF_EQUAL, text2);
|
|
38963
38970
|
} else {
|
|
38964
|
-
diffs[diffsLength++] = new diff_match_patch.Diff(DIFF_DELETE,
|
|
38971
|
+
diffs[diffsLength++] = new diff_match_patch.Diff(DIFF_DELETE, text2);
|
|
38965
38972
|
}
|
|
38966
38973
|
break;
|
|
38967
38974
|
default:
|
|
@@ -38975,22 +38982,22 @@ function requireDiffMatchPatch() {
|
|
|
38975
38982
|
}
|
|
38976
38983
|
return diffs;
|
|
38977
38984
|
};
|
|
38978
|
-
diff_match_patch.prototype.match_main = function(
|
|
38979
|
-
if (
|
|
38985
|
+
diff_match_patch.prototype.match_main = function(text2, pattern2, loc) {
|
|
38986
|
+
if (text2 == null || pattern2 == null || loc == null) {
|
|
38980
38987
|
throw new Error("Null input. (match_main)");
|
|
38981
38988
|
}
|
|
38982
|
-
loc = Math.max(0, Math.min(loc,
|
|
38983
|
-
if (
|
|
38989
|
+
loc = Math.max(0, Math.min(loc, text2.length));
|
|
38990
|
+
if (text2 == pattern2) {
|
|
38984
38991
|
return 0;
|
|
38985
|
-
} else if (!
|
|
38992
|
+
} else if (!text2.length) {
|
|
38986
38993
|
return -1;
|
|
38987
|
-
} else if (
|
|
38994
|
+
} else if (text2.substring(loc, loc + pattern2.length) == pattern2) {
|
|
38988
38995
|
return loc;
|
|
38989
38996
|
} else {
|
|
38990
|
-
return this.match_bitap_(
|
|
38997
|
+
return this.match_bitap_(text2, pattern2, loc);
|
|
38991
38998
|
}
|
|
38992
38999
|
};
|
|
38993
|
-
diff_match_patch.prototype.match_bitap_ = function(
|
|
39000
|
+
diff_match_patch.prototype.match_bitap_ = function(text2, pattern2, loc) {
|
|
38994
39001
|
if (pattern2.length > this.Match_MaxBits) {
|
|
38995
39002
|
throw new Error("Pattern too long for this browser.");
|
|
38996
39003
|
}
|
|
@@ -39005,10 +39012,10 @@ function requireDiffMatchPatch() {
|
|
|
39005
39012
|
return accuracy + proximity / dmp.Match_Distance;
|
|
39006
39013
|
}
|
|
39007
39014
|
var score_threshold = this.Match_Threshold;
|
|
39008
|
-
var best_loc =
|
|
39015
|
+
var best_loc = text2.indexOf(pattern2, loc);
|
|
39009
39016
|
if (best_loc != -1) {
|
|
39010
39017
|
score_threshold = Math.min(match_bitapScore_(0, best_loc), score_threshold);
|
|
39011
|
-
best_loc =
|
|
39018
|
+
best_loc = text2.lastIndexOf(pattern2, loc + pattern2.length);
|
|
39012
39019
|
if (best_loc != -1) {
|
|
39013
39020
|
score_threshold = Math.min(match_bitapScore_(0, best_loc), score_threshold);
|
|
39014
39021
|
}
|
|
@@ -39016,7 +39023,7 @@ function requireDiffMatchPatch() {
|
|
|
39016
39023
|
var matchmask = 1 << pattern2.length - 1;
|
|
39017
39024
|
best_loc = -1;
|
|
39018
39025
|
var bin_min, bin_mid;
|
|
39019
|
-
var bin_max = pattern2.length +
|
|
39026
|
+
var bin_max = pattern2.length + text2.length;
|
|
39020
39027
|
var last_rd;
|
|
39021
39028
|
for (var d = 0; d < pattern2.length; d++) {
|
|
39022
39029
|
bin_min = 0;
|
|
@@ -39031,11 +39038,11 @@ function requireDiffMatchPatch() {
|
|
|
39031
39038
|
}
|
|
39032
39039
|
bin_max = bin_mid;
|
|
39033
39040
|
var start = Math.max(1, loc - bin_mid + 1);
|
|
39034
|
-
var finish = Math.min(loc + bin_mid,
|
|
39041
|
+
var finish = Math.min(loc + bin_mid, text2.length) + pattern2.length;
|
|
39035
39042
|
var rd = Array(finish + 2);
|
|
39036
39043
|
rd[finish + 1] = (1 << d) - 1;
|
|
39037
39044
|
for (var j = finish; j >= start; j--) {
|
|
39038
|
-
var charMatch = s[
|
|
39045
|
+
var charMatch = s[text2.charAt(j - 1)];
|
|
39039
39046
|
if (d === 0) {
|
|
39040
39047
|
rd[j] = (rd[j + 1] << 1 | 1) & charMatch;
|
|
39041
39048
|
} else {
|
|
@@ -39071,28 +39078,28 @@ function requireDiffMatchPatch() {
|
|
|
39071
39078
|
}
|
|
39072
39079
|
return s;
|
|
39073
39080
|
};
|
|
39074
|
-
diff_match_patch.prototype.patch_addContext_ = function(patch,
|
|
39075
|
-
if (
|
|
39081
|
+
diff_match_patch.prototype.patch_addContext_ = function(patch, text2) {
|
|
39082
|
+
if (text2.length == 0) {
|
|
39076
39083
|
return;
|
|
39077
39084
|
}
|
|
39078
39085
|
if (patch.start2 === null) {
|
|
39079
39086
|
throw Error("patch not initialized");
|
|
39080
39087
|
}
|
|
39081
|
-
var pattern2 =
|
|
39088
|
+
var pattern2 = text2.substring(patch.start2, patch.start2 + patch.length1);
|
|
39082
39089
|
var padding = 0;
|
|
39083
|
-
while (
|
|
39090
|
+
while (text2.indexOf(pattern2) != text2.lastIndexOf(pattern2) && pattern2.length < this.Match_MaxBits - this.Patch_Margin - this.Patch_Margin) {
|
|
39084
39091
|
padding += this.Patch_Margin;
|
|
39085
|
-
pattern2 =
|
|
39092
|
+
pattern2 = text2.substring(
|
|
39086
39093
|
patch.start2 - padding,
|
|
39087
39094
|
patch.start2 + patch.length1 + padding
|
|
39088
39095
|
);
|
|
39089
39096
|
}
|
|
39090
39097
|
padding += this.Patch_Margin;
|
|
39091
|
-
var prefix =
|
|
39098
|
+
var prefix = text2.substring(patch.start2 - padding, patch.start2);
|
|
39092
39099
|
if (prefix) {
|
|
39093
39100
|
patch.diffs.unshift(new diff_match_patch.Diff(DIFF_EQUAL, prefix));
|
|
39094
39101
|
}
|
|
39095
|
-
var suffix =
|
|
39102
|
+
var suffix = text2.substring(
|
|
39096
39103
|
patch.start2 + patch.length1,
|
|
39097
39104
|
patch.start2 + patch.length1 + padding
|
|
39098
39105
|
);
|
|
@@ -39211,13 +39218,13 @@ function requireDiffMatchPatch() {
|
|
|
39211
39218
|
}
|
|
39212
39219
|
return patchesCopy;
|
|
39213
39220
|
};
|
|
39214
|
-
diff_match_patch.prototype.patch_apply = function(patches,
|
|
39221
|
+
diff_match_patch.prototype.patch_apply = function(patches, text2) {
|
|
39215
39222
|
if (patches.length == 0) {
|
|
39216
|
-
return [
|
|
39223
|
+
return [text2, []];
|
|
39217
39224
|
}
|
|
39218
39225
|
patches = this.patch_deepCopy(patches);
|
|
39219
39226
|
var nullPadding = this.patch_addPadding(patches);
|
|
39220
|
-
|
|
39227
|
+
text2 = nullPadding + text2 + nullPadding;
|
|
39221
39228
|
this.patch_splitMax(patches);
|
|
39222
39229
|
var delta = 0;
|
|
39223
39230
|
var results = [];
|
|
@@ -39228,13 +39235,13 @@ function requireDiffMatchPatch() {
|
|
|
39228
39235
|
var end_loc = -1;
|
|
39229
39236
|
if (text1.length > this.Match_MaxBits) {
|
|
39230
39237
|
start_loc = this.match_main(
|
|
39231
|
-
|
|
39238
|
+
text2,
|
|
39232
39239
|
text1.substring(0, this.Match_MaxBits),
|
|
39233
39240
|
expected_loc
|
|
39234
39241
|
);
|
|
39235
39242
|
if (start_loc != -1) {
|
|
39236
39243
|
end_loc = this.match_main(
|
|
39237
|
-
|
|
39244
|
+
text2,
|
|
39238
39245
|
text1.substring(text1.length - this.Match_MaxBits),
|
|
39239
39246
|
expected_loc + text1.length - this.Match_MaxBits
|
|
39240
39247
|
);
|
|
@@ -39243,7 +39250,7 @@ function requireDiffMatchPatch() {
|
|
|
39243
39250
|
}
|
|
39244
39251
|
}
|
|
39245
39252
|
} else {
|
|
39246
|
-
start_loc = this.match_main(
|
|
39253
|
+
start_loc = this.match_main(text2, text1, expected_loc);
|
|
39247
39254
|
}
|
|
39248
39255
|
if (start_loc == -1) {
|
|
39249
39256
|
results[x] = false;
|
|
@@ -39251,16 +39258,16 @@ function requireDiffMatchPatch() {
|
|
|
39251
39258
|
} else {
|
|
39252
39259
|
results[x] = true;
|
|
39253
39260
|
delta = start_loc - expected_loc;
|
|
39254
|
-
var
|
|
39261
|
+
var text22;
|
|
39255
39262
|
if (end_loc == -1) {
|
|
39256
|
-
|
|
39263
|
+
text22 = text2.substring(start_loc, start_loc + text1.length);
|
|
39257
39264
|
} else {
|
|
39258
|
-
|
|
39265
|
+
text22 = text2.substring(start_loc, end_loc + this.Match_MaxBits);
|
|
39259
39266
|
}
|
|
39260
|
-
if (text1 ==
|
|
39261
|
-
|
|
39267
|
+
if (text1 == text22) {
|
|
39268
|
+
text2 = text2.substring(0, start_loc) + this.diff_text2(patches[x].diffs) + text2.substring(start_loc + text1.length);
|
|
39262
39269
|
} else {
|
|
39263
|
-
var diffs = this.diff_main(text1,
|
|
39270
|
+
var diffs = this.diff_main(text1, text22, false);
|
|
39264
39271
|
if (text1.length > this.Match_MaxBits && this.diff_levenshtein(diffs) / text1.length > this.Patch_DeleteThreshold) {
|
|
39265
39272
|
results[x] = false;
|
|
39266
39273
|
} else {
|
|
@@ -39273,9 +39280,9 @@ function requireDiffMatchPatch() {
|
|
|
39273
39280
|
index2 = this.diff_xIndex(diffs, index1);
|
|
39274
39281
|
}
|
|
39275
39282
|
if (mod[0] === DIFF_INSERT) {
|
|
39276
|
-
|
|
39283
|
+
text2 = text2.substring(0, start_loc + index2) + mod[1] + text2.substring(start_loc + index2);
|
|
39277
39284
|
} else if (mod[0] === DIFF_DELETE) {
|
|
39278
|
-
|
|
39285
|
+
text2 = text2.substring(0, start_loc + index2) + text2.substring(start_loc + this.diff_xIndex(
|
|
39279
39286
|
diffs,
|
|
39280
39287
|
index1 + mod[1].length
|
|
39281
39288
|
));
|
|
@@ -39288,8 +39295,8 @@ function requireDiffMatchPatch() {
|
|
|
39288
39295
|
}
|
|
39289
39296
|
}
|
|
39290
39297
|
}
|
|
39291
|
-
|
|
39292
|
-
return [
|
|
39298
|
+
text2 = text2.substring(nullPadding.length, text2.length - nullPadding.length);
|
|
39299
|
+
return [text2, results];
|
|
39293
39300
|
};
|
|
39294
39301
|
diff_match_patch.prototype.patch_addPadding = function(patches) {
|
|
39295
39302
|
var paddingLength = this.Patch_Margin;
|
|
@@ -39405,24 +39412,24 @@ function requireDiffMatchPatch() {
|
|
|
39405
39412
|
}
|
|
39406
39413
|
};
|
|
39407
39414
|
diff_match_patch.prototype.patch_toText = function(patches) {
|
|
39408
|
-
var
|
|
39415
|
+
var text2 = [];
|
|
39409
39416
|
for (var x = 0; x < patches.length; x++) {
|
|
39410
|
-
|
|
39417
|
+
text2[x] = patches[x];
|
|
39411
39418
|
}
|
|
39412
|
-
return
|
|
39419
|
+
return text2.join("");
|
|
39413
39420
|
};
|
|
39414
39421
|
diff_match_patch.prototype.patch_fromText = function(textline) {
|
|
39415
39422
|
var patches = [];
|
|
39416
39423
|
if (!textline) {
|
|
39417
39424
|
return patches;
|
|
39418
39425
|
}
|
|
39419
|
-
var
|
|
39426
|
+
var text2 = textline.split("\n");
|
|
39420
39427
|
var textPointer = 0;
|
|
39421
39428
|
var patchHeader = /^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;
|
|
39422
|
-
while (textPointer <
|
|
39423
|
-
var m =
|
|
39429
|
+
while (textPointer < text2.length) {
|
|
39430
|
+
var m = text2[textPointer].match(patchHeader);
|
|
39424
39431
|
if (!m) {
|
|
39425
|
-
throw new Error("Invalid patch string: " +
|
|
39432
|
+
throw new Error("Invalid patch string: " + text2[textPointer]);
|
|
39426
39433
|
}
|
|
39427
39434
|
var patch = new diff_match_patch.patch_obj();
|
|
39428
39435
|
patches.push(patch);
|
|
@@ -39447,10 +39454,10 @@ function requireDiffMatchPatch() {
|
|
|
39447
39454
|
patch.length2 = parseInt(m[4], 10);
|
|
39448
39455
|
}
|
|
39449
39456
|
textPointer++;
|
|
39450
|
-
while (textPointer <
|
|
39451
|
-
var sign =
|
|
39457
|
+
while (textPointer < text2.length) {
|
|
39458
|
+
var sign = text2[textPointer].charAt(0);
|
|
39452
39459
|
try {
|
|
39453
|
-
var line = decodeURI(
|
|
39460
|
+
var line = decodeURI(text2[textPointer].substring(1));
|
|
39454
39461
|
} catch (ex) {
|
|
39455
39462
|
throw new Error("Illegal escape in patch_fromText: " + line);
|
|
39456
39463
|
}
|
|
@@ -39494,7 +39501,7 @@ function requireDiffMatchPatch() {
|
|
|
39494
39501
|
} else {
|
|
39495
39502
|
coords2 = this.start2 + 1 + "," + this.length2;
|
|
39496
39503
|
}
|
|
39497
|
-
var
|
|
39504
|
+
var text2 = ["@@ -" + coords1 + " +" + coords2 + " @@\n"];
|
|
39498
39505
|
var op;
|
|
39499
39506
|
for (var x = 0; x < this.diffs.length; x++) {
|
|
39500
39507
|
switch (this.diffs[x][0]) {
|
|
@@ -39508,9 +39515,9 @@ function requireDiffMatchPatch() {
|
|
|
39508
39515
|
op = " ";
|
|
39509
39516
|
break;
|
|
39510
39517
|
}
|
|
39511
|
-
|
|
39518
|
+
text2[x + 1] = op + encodeURI(this.diffs[x][1]) + "\n";
|
|
39512
39519
|
}
|
|
39513
|
-
return
|
|
39520
|
+
return text2.join("").replace(/%20/g, " ");
|
|
39514
39521
|
};
|
|
39515
39522
|
module.exports = diff_match_patch;
|
|
39516
39523
|
module.exports["diff_match_patch"] = diff_match_patch;
|
|
@@ -39618,7 +39625,7 @@ class MergeButtonWidget extends WidgetType {
|
|
|
39618
39625
|
return container;
|
|
39619
39626
|
}
|
|
39620
39627
|
// 실제 변경 적용 로직
|
|
39621
|
-
applyChanges(
|
|
39628
|
+
applyChanges(text2, editorView, range) {
|
|
39622
39629
|
if (!editorView || !range) {
|
|
39623
39630
|
trace.error("Target editor view or range is undefined.", editorView, range);
|
|
39624
39631
|
return;
|
|
@@ -39627,7 +39634,7 @@ class MergeButtonWidget extends WidgetType {
|
|
|
39627
39634
|
changes: {
|
|
39628
39635
|
from: range.from,
|
|
39629
39636
|
to: range.to,
|
|
39630
|
-
insert:
|
|
39637
|
+
insert: text2
|
|
39631
39638
|
}
|
|
39632
39639
|
});
|
|
39633
39640
|
requestAnimationFrame(() => {
|
|
@@ -39781,16 +39788,16 @@ class NineDiff extends HTMLElement {
|
|
|
39781
39788
|
const insertedLineDeco = Decoration.line({ class: "cm-inserted-line-bg" });
|
|
39782
39789
|
const deletedLineDeco = Decoration.line({ class: "cm-deleted-line-bg" });
|
|
39783
39790
|
const currentInstance = this;
|
|
39784
|
-
for (const [op,
|
|
39785
|
-
const len =
|
|
39791
|
+
for (const [op, text2] of diffs) {
|
|
39792
|
+
const len = text2.length;
|
|
39786
39793
|
const asisRangeStart = asisCursor;
|
|
39787
39794
|
const tobeRangeStart = tobeCursor;
|
|
39788
39795
|
switch (op) {
|
|
39789
39796
|
case diffMatchPatchExports.diff_match_patch.DIFF_INSERT:
|
|
39790
|
-
trace.log("DIFF_INSERT (TOBE added):", JSON.stringify(
|
|
39791
|
-
const tobeLines =
|
|
39797
|
+
trace.log("DIFF_INSERT (TOBE added):", JSON.stringify(text2));
|
|
39798
|
+
const tobeLines = text2.split("\n");
|
|
39792
39799
|
for (let i = 0; i < tobeLines.length; i++) {
|
|
39793
|
-
if (!(i === tobeLines.length - 1 && tobeLines[i] === "" &&
|
|
39800
|
+
if (!(i === tobeLines.length - 1 && tobeLines[i] === "" && text2.endsWith("\n"))) {
|
|
39794
39801
|
tobeLineBuilder.add(tobeCursor, tobeCursor, insertedLineDeco);
|
|
39795
39802
|
}
|
|
39796
39803
|
tobeCursor += tobeLines[i].length + (i < tobeLines.length - 1 ? 1 : 0);
|
|
@@ -39802,7 +39809,7 @@ class NineDiff extends HTMLElement {
|
|
|
39802
39809
|
widget: new MergeButtonWidget(
|
|
39803
39810
|
false,
|
|
39804
39811
|
// 이 버튼은 TOBE 에디터에 붙는 버튼
|
|
39805
|
-
|
|
39812
|
+
text2,
|
|
39806
39813
|
// AI가 추가한 내용을 ASIS에 '삽입'
|
|
39807
39814
|
__privateGet(currentInstance, _asisEditorView),
|
|
39808
39815
|
// 대상 에디터는 ASIS (현재 소스)
|
|
@@ -39815,10 +39822,10 @@ class NineDiff extends HTMLElement {
|
|
|
39815
39822
|
);
|
|
39816
39823
|
break;
|
|
39817
39824
|
case diffMatchPatchExports.diff_match_patch.DIFF_DELETE:
|
|
39818
|
-
trace.log("DIFF_DELETE (ASIS deleted):", JSON.stringify(
|
|
39819
|
-
const asisLines =
|
|
39825
|
+
trace.log("DIFF_DELETE (ASIS deleted):", JSON.stringify(text2));
|
|
39826
|
+
const asisLines = text2.split("\n");
|
|
39820
39827
|
for (let i = 0; i < asisLines.length; i++) {
|
|
39821
|
-
if (!(i === asisLines.length - 1 && asisLines[i] === "" &&
|
|
39828
|
+
if (!(i === asisLines.length - 1 && asisLines[i] === "" && text2.endsWith("\n"))) {
|
|
39822
39829
|
asisLineBuilder.add(asisCursor, asisCursor, deletedLineDeco);
|
|
39823
39830
|
}
|
|
39824
39831
|
asisCursor += asisLines[i].length + (i < asisLines.length - 1 ? 1 : 0);
|
|
@@ -39834,7 +39841,7 @@ class NineDiff extends HTMLElement {
|
|
|
39834
39841
|
// ASIS에서 해당 내용을 '제거'하므로 삽입할 텍스트는 없음
|
|
39835
39842
|
__privateGet(currentInstance, _asisEditorView),
|
|
39836
39843
|
// 대상 에디터는 ASIS (현재 소스)
|
|
39837
|
-
{ from: asisRangeStart, to: asisRangeStart +
|
|
39844
|
+
{ from: asisRangeStart, to: asisRangeStart + text2.length },
|
|
39838
39845
|
// ASIS에서 '삭제될' 범위
|
|
39839
39846
|
currentInstance
|
|
39840
39847
|
),
|
|
@@ -39930,7 +39937,7 @@ class NineDiff extends HTMLElement {
|
|
|
39930
39937
|
const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
|
|
39931
39938
|
this.shadowRoot.innerHTML = `
|
|
39932
39939
|
<style>
|
|
39933
|
-
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.
|
|
39940
|
+
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.132"}/dist/css/nine-mu.css";
|
|
39934
39941
|
${customImport}
|
|
39935
39942
|
</style>
|
|
39936
39943
|
|
|
@@ -40040,7 +40047,7 @@ render_fn2 = function() {
|
|
|
40040
40047
|
const customImport = this.getAttribute("css-path") ? `@import "${this.getAttribute("css-path")}";` : "";
|
|
40041
40048
|
this.shadowRoot.innerHTML = `
|
|
40042
40049
|
<style>
|
|
40043
|
-
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.
|
|
40050
|
+
@import "https://cdn.jsdelivr.net/npm/@nine-lab/nine-mu@${"0.1.132"}/dist/css/nine-mu.css";
|
|
40044
40051
|
${customImport}
|
|
40045
40052
|
</style>
|
|
40046
40053
|
|
|
@@ -40079,7 +40086,7 @@ handleCancel_fn = function() {
|
|
|
40079
40086
|
};
|
|
40080
40087
|
customElements.define("nine-diff-popup", NineDiffPopup);
|
|
40081
40088
|
const NineMu = {
|
|
40082
|
-
version: "0.1.
|
|
40089
|
+
version: "0.1.132",
|
|
40083
40090
|
init: (config2) => {
|
|
40084
40091
|
trace$1.log("🛠️ Nine-Mu Engine initialized", config2);
|
|
40085
40092
|
}
|