@inpageedit/core 0.5.4 → 0.7.0
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/CheckBox-D3rHnX7I.js +13 -0
- package/dist/CheckBox-D3rHnX7I.js.map +1 -0
- package/dist/IconQuickEdit-YVn1ANbm.js +27 -0
- package/dist/IconQuickEdit-YVn1ANbm.js.map +1 -0
- package/dist/InPageEdit.d.ts +7 -5
- package/dist/InputBox-BV4m05Xs.js +22 -0
- package/dist/InputBox-BV4m05Xs.js.map +1 -0
- package/dist/RadioBox-nJqWsxW2.js +13 -0
- package/dist/RadioBox-nJqWsxW2.js.map +1 -0
- package/dist/__test__/utils/constants.d.ts +2 -0
- package/dist/components/Icon/IconEdit.d.ts +2 -0
- package/dist/components/Icon/IconQuickEdit.d.ts +2 -0
- package/dist/components/MwUserLinks.d.ts +2 -0
- package/dist/components/index.js +13 -11
- package/dist/components/index.js.map +1 -1
- package/dist/{index-i-Uf0vuA.js → index-1JtE4urY.js} +490 -374
- package/dist/{index-i-Uf0vuA.js.map → index-1JtE4urY.js.map} +1 -1
- package/dist/{index-UyiZ7umI.js → index-2AEdgbUL.js} +4 -4
- package/dist/index-2AEdgbUL.js.map +1 -0
- package/dist/index-2kN4SKmT.js +116 -0
- package/dist/index-2kN4SKmT.js.map +1 -0
- package/dist/{index-BSjnoNn2.js → index-B3Bsg_nE.js} +5 -3
- package/dist/index-B3Bsg_nE.js.map +1 -0
- package/dist/index-BCMwmSfQ.js +295 -0
- package/dist/index-BCMwmSfQ.js.map +1 -0
- package/dist/{index-BedbUMp8.js → index-C0ci6Ll1.js} +14 -12
- package/dist/index-C0ci6Ll1.js.map +1 -0
- package/dist/index-CZnu6cRK.js +319 -0
- package/dist/index-CZnu6cRK.js.map +1 -0
- package/dist/{index-xJ2bdsOD.js → index-CheNjwas.js} +5 -5
- package/dist/{index-xJ2bdsOD.js.map → index-CheNjwas.js.map} +1 -1
- package/dist/{index-DtOC8Ck-.js → index-CrWxZ0yl.js} +66 -63
- package/dist/{index-DtOC8Ck-.js.map → index-CrWxZ0yl.js.map} +1 -1
- package/dist/{index-DNQjqBV-.js → index-DqfQ7hp6.js} +3359 -3037
- package/dist/index-DqfQ7hp6.js.map +1 -0
- package/dist/index-lZkYoUca.js +46 -0
- package/dist/index-lZkYoUca.js.map +1 -0
- package/dist/index-sfkutNHj.js +201 -0
- package/dist/index-sfkutNHj.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/makeCallable-LDU0xZMJ.js +40 -0
- package/dist/makeCallable-LDU0xZMJ.js.map +1 -0
- package/dist/models/WikiPage/index.d.ts +2 -2
- package/dist/models/WikiTitle/index.d.ts +87 -11
- package/dist/models/WikiTitle/index.spec.d.ts +1 -0
- package/dist/noop-ClDc6zv4.js +6 -0
- package/dist/noop-ClDc6zv4.js.map +1 -0
- package/dist/plugins/in-article-links/index.d.ts +33 -7
- package/dist/plugins/quick-delete/index.d.ts +47 -0
- package/dist/plugins/quick-diff/PluginQuickDiffCore.d.ts +4 -2
- package/dist/plugins/quick-diff/components/DiffTable.d.ts +17 -0
- package/dist/plugins/quick-preview/index.d.ts +6 -3
- package/dist/services/ApiService.d.ts +2 -2
- package/dist/services/ModalService/IPEModal.d.ts +1 -1
- package/dist/services/SiteMetadataService.d.ts +43 -4
- package/dist/services/WikiPageService.d.ts +2 -2
- package/dist/services/WikiTitleService.d.ts +14 -0
- package/dist/style.css +1 -1
- package/dist/types/SiteMetadata.d.ts +1 -1
- package/dist/utils/url.d.ts +24 -0
- package/lib/index.umd.js +28 -28
- package/lib/index.umd.js.map +1 -1
- package/lib/style.css +1 -1
- package/package.json +10 -1
- package/dist/InputBox-FIzJ-rPN.js +0 -30
- package/dist/InputBox-FIzJ-rPN.js.map +0 -1
- package/dist/RadioBox-CaA8VgLu.js +0 -54
- package/dist/RadioBox-CaA8VgLu.js.map +0 -1
- package/dist/index-BSjnoNn2.js.map +0 -1
- package/dist/index-BedbUMp8.js.map +0 -1
- package/dist/index-DNQjqBV-.js.map +0 -1
- package/dist/index-UyiZ7umI.js.map +0 -1
- package/dist/index-e7eyr1FL.js +0 -96
- package/dist/index-e7eyr1FL.js.map +0 -1
- package/dist/index-rMDuLpcz.js +0 -458
- package/dist/index-rMDuLpcz.js.map +0 -1
- package/dist/plugins/quick-edit/PluginQuickEditInArticleLinks.d.ts +0 -14
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import { B as
|
|
3
|
-
import {
|
|
4
|
-
import { R as
|
|
5
|
-
|
|
1
|
+
import { j as a, F as Ee, P as Ne } from "./index-CvhkVj_L.js";
|
|
2
|
+
import { B as K, I as Se, S as P } from "./index-DqfQ7hp6.js";
|
|
3
|
+
import { I as Pe } from "./IconQuickEdit-YVn1ANbm.js";
|
|
4
|
+
import { R as We } from "./Preferences-Bg3J5Ur9.js";
|
|
5
|
+
import { R as _e } from "./RadioBox-nJqWsxW2.js";
|
|
6
|
+
import { M as Oe } from "./index-lZkYoUca.js";
|
|
7
|
+
class E {
|
|
6
8
|
diff(e, n, i = {}) {
|
|
7
9
|
let s;
|
|
8
10
|
typeof i == "function" ? (s = i, i = {}) : "callback" in i && (s = i.callback);
|
|
@@ -11,56 +13,56 @@ class S {
|
|
|
11
13
|
}
|
|
12
14
|
diffWithOptionsObj(e, n, i, s) {
|
|
13
15
|
var r;
|
|
14
|
-
const l = (
|
|
15
|
-
if (
|
|
16
|
+
const l = (d) => {
|
|
17
|
+
if (d = this.postProcess(d, i), s) {
|
|
16
18
|
setTimeout(function() {
|
|
17
|
-
s(
|
|
19
|
+
s(d);
|
|
18
20
|
}, 0);
|
|
19
21
|
return;
|
|
20
22
|
} else
|
|
21
|
-
return
|
|
23
|
+
return d;
|
|
22
24
|
}, o = n.length, f = e.length;
|
|
23
|
-
let
|
|
24
|
-
i.maxEditLength != null && (
|
|
25
|
-
const
|
|
26
|
-
let
|
|
27
|
-
if (
|
|
28
|
-
return l(this.buildValues(
|
|
29
|
-
let
|
|
25
|
+
let h = 1, c = o + f;
|
|
26
|
+
i.maxEditLength != null && (c = Math.min(c, i.maxEditLength));
|
|
27
|
+
const g = (r = i.timeout) !== null && r !== void 0 ? r : 1 / 0, y = Date.now() + g, w = [{ oldPos: -1, lastComponent: void 0 }];
|
|
28
|
+
let m = this.extractCommon(w[0], n, e, 0, i);
|
|
29
|
+
if (w[0].oldPos + 1 >= f && m + 1 >= o)
|
|
30
|
+
return l(this.buildValues(w[0].lastComponent, n, e));
|
|
31
|
+
let v = -1 / 0, x = 1 / 0;
|
|
30
32
|
const C = () => {
|
|
31
|
-
for (let
|
|
32
|
-
let
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
let
|
|
33
|
+
for (let d = Math.max(v, -h); d <= Math.min(x, h); d += 2) {
|
|
34
|
+
let u;
|
|
35
|
+
const p = w[d - 1], k = w[d + 1];
|
|
36
|
+
p && (w[d - 1] = void 0);
|
|
37
|
+
let D = !1;
|
|
36
38
|
if (k) {
|
|
37
|
-
const N = k.oldPos -
|
|
38
|
-
|
|
39
|
+
const N = k.oldPos - d;
|
|
40
|
+
D = k && 0 <= N && N < o;
|
|
39
41
|
}
|
|
40
|
-
const
|
|
41
|
-
if (!
|
|
42
|
-
|
|
42
|
+
const b = p && p.oldPos + 1 < f;
|
|
43
|
+
if (!D && !b) {
|
|
44
|
+
w[d] = void 0;
|
|
43
45
|
continue;
|
|
44
46
|
}
|
|
45
|
-
if (!
|
|
46
|
-
return l(this.buildValues(
|
|
47
|
-
|
|
47
|
+
if (!b || D && p.oldPos < k.oldPos ? u = this.addToPath(k, !0, !1, 0, i) : u = this.addToPath(p, !1, !0, 1, i), m = this.extractCommon(u, n, e, d, i), u.oldPos + 1 >= f && m + 1 >= o)
|
|
48
|
+
return l(this.buildValues(u.lastComponent, n, e)) || !0;
|
|
49
|
+
w[d] = u, u.oldPos + 1 >= f && (x = Math.min(x, d - 1)), m + 1 >= o && (v = Math.max(v, d + 1));
|
|
48
50
|
}
|
|
49
|
-
|
|
51
|
+
h++;
|
|
50
52
|
};
|
|
51
53
|
if (s)
|
|
52
|
-
(function
|
|
54
|
+
(function d() {
|
|
53
55
|
setTimeout(function() {
|
|
54
|
-
if (
|
|
56
|
+
if (h > c || Date.now() > y)
|
|
55
57
|
return s(void 0);
|
|
56
|
-
C() ||
|
|
58
|
+
C() || d();
|
|
57
59
|
}, 0);
|
|
58
60
|
})();
|
|
59
61
|
else
|
|
60
|
-
for (;
|
|
61
|
-
const
|
|
62
|
-
if (
|
|
63
|
-
return
|
|
62
|
+
for (; h <= c && Date.now() <= y; ) {
|
|
63
|
+
const d = C();
|
|
64
|
+
if (d)
|
|
65
|
+
return d;
|
|
64
66
|
}
|
|
65
67
|
}
|
|
66
68
|
addToPath(e, n, i, s, r) {
|
|
@@ -75,10 +77,10 @@ class S {
|
|
|
75
77
|
}
|
|
76
78
|
extractCommon(e, n, i, s, r) {
|
|
77
79
|
const l = n.length, o = i.length;
|
|
78
|
-
let f = e.oldPos,
|
|
79
|
-
for (;
|
|
80
|
-
|
|
81
|
-
return
|
|
80
|
+
let f = e.oldPos, h = f - s, c = 0;
|
|
81
|
+
for (; h + 1 < l && f + 1 < o && this.equals(i[f + 1], n[h + 1], r); )
|
|
82
|
+
h++, f++, c++, r.oneChangePerToken && (e.lastComponent = { count: 1, previousComponent: e.lastComponent, added: !1, removed: !1 });
|
|
83
|
+
return c && !r.oneChangePerToken && (e.lastComponent = { count: c, previousComponent: e.lastComponent, added: !1, removed: !1 }), e.oldPos = f, h;
|
|
82
84
|
}
|
|
83
85
|
equals(e, n, i) {
|
|
84
86
|
return i.comparator ? i.comparator(e, n) : e === n || !!i.ignoreCase && e.toLowerCase() === n.toLowerCase();
|
|
@@ -113,40 +115,40 @@ class S {
|
|
|
113
115
|
s.push(e), r = e.previousComponent, delete e.previousComponent, e = r;
|
|
114
116
|
s.reverse();
|
|
115
117
|
const l = s.length;
|
|
116
|
-
let o = 0, f = 0,
|
|
118
|
+
let o = 0, f = 0, h = 0;
|
|
117
119
|
for (; o < l; o++) {
|
|
118
|
-
const
|
|
119
|
-
if (
|
|
120
|
-
|
|
120
|
+
const c = s[o];
|
|
121
|
+
if (c.removed)
|
|
122
|
+
c.value = this.join(i.slice(h, h + c.count)), h += c.count;
|
|
121
123
|
else {
|
|
122
|
-
if (!
|
|
123
|
-
let
|
|
124
|
-
|
|
125
|
-
const
|
|
126
|
-
return
|
|
127
|
-
}),
|
|
124
|
+
if (!c.added && this.useLongestToken) {
|
|
125
|
+
let g = n.slice(f, f + c.count);
|
|
126
|
+
g = g.map(function(y, w) {
|
|
127
|
+
const m = i[h + w];
|
|
128
|
+
return m.length > y.length ? m : y;
|
|
129
|
+
}), c.value = this.join(g);
|
|
128
130
|
} else
|
|
129
|
-
|
|
130
|
-
f +=
|
|
131
|
+
c.value = this.join(n.slice(f, f + c.count));
|
|
132
|
+
f += c.count, c.added || (h += c.count);
|
|
131
133
|
}
|
|
132
134
|
}
|
|
133
135
|
return s;
|
|
134
136
|
}
|
|
135
137
|
}
|
|
136
|
-
class
|
|
138
|
+
class Te extends E {
|
|
137
139
|
}
|
|
138
|
-
const
|
|
139
|
-
function
|
|
140
|
-
return
|
|
140
|
+
const ee = new Te();
|
|
141
|
+
function te(t, e, n) {
|
|
142
|
+
return ee.diff(t, e, n);
|
|
141
143
|
}
|
|
142
|
-
function
|
|
144
|
+
function V(t, e) {
|
|
143
145
|
let n;
|
|
144
146
|
for (n = 0; n < t.length && n < e.length; n++)
|
|
145
147
|
if (t[n] != e[n])
|
|
146
148
|
return t.slice(0, n);
|
|
147
149
|
return t.slice(0, n);
|
|
148
150
|
}
|
|
149
|
-
function
|
|
151
|
+
function Y(t, e) {
|
|
150
152
|
let n;
|
|
151
153
|
if (!t || !e || t[t.length - 1] != e[e.length - 1])
|
|
152
154
|
return "";
|
|
@@ -155,12 +157,12 @@ function V(t, e) {
|
|
|
155
157
|
return t.slice(-n);
|
|
156
158
|
return t.slice(-n);
|
|
157
159
|
}
|
|
158
|
-
function
|
|
160
|
+
function $(t, e, n) {
|
|
159
161
|
if (t.slice(0, e.length) != e)
|
|
160
162
|
throw Error(`string ${JSON.stringify(t)} doesn't start with prefix ${JSON.stringify(e)}; this is a bug`);
|
|
161
163
|
return n + t.slice(e.length);
|
|
162
164
|
}
|
|
163
|
-
function
|
|
165
|
+
function q(t, e, n) {
|
|
164
166
|
if (!e)
|
|
165
167
|
return t + n;
|
|
166
168
|
if (t.slice(-e.length) != e)
|
|
@@ -168,15 +170,15 @@ function H(t, e, n) {
|
|
|
168
170
|
return t.slice(0, -e.length) + n;
|
|
169
171
|
}
|
|
170
172
|
function W(t, e) {
|
|
171
|
-
return
|
|
173
|
+
return $(t, e, "");
|
|
172
174
|
}
|
|
173
175
|
function O(t, e) {
|
|
174
|
-
return
|
|
176
|
+
return q(t, e, "");
|
|
175
177
|
}
|
|
176
|
-
function
|
|
177
|
-
return e.slice(0,
|
|
178
|
+
function X(t, e) {
|
|
179
|
+
return e.slice(0, Le(t, e));
|
|
178
180
|
}
|
|
179
|
-
function
|
|
181
|
+
function Le(t, e) {
|
|
180
182
|
let n = 0;
|
|
181
183
|
t.length > e.length && (n = t.length - e.length);
|
|
182
184
|
let i = e.length;
|
|
@@ -197,12 +199,12 @@ function Oe(t, e) {
|
|
|
197
199
|
}
|
|
198
200
|
return r;
|
|
199
201
|
}
|
|
200
|
-
function
|
|
202
|
+
function Fe(t) {
|
|
201
203
|
return t.includes(`\r
|
|
202
204
|
`) && !t.startsWith(`
|
|
203
205
|
`) && !t.match(/[^\r]\n/);
|
|
204
206
|
}
|
|
205
|
-
function
|
|
207
|
+
function je(t) {
|
|
206
208
|
return !t.includes(`\r
|
|
207
209
|
`) && t.includes(`
|
|
208
210
|
`);
|
|
@@ -213,12 +215,12 @@ function _(t) {
|
|
|
213
215
|
;
|
|
214
216
|
return t.substring(e + 1);
|
|
215
217
|
}
|
|
216
|
-
function
|
|
218
|
+
function S(t) {
|
|
217
219
|
const e = t.match(/^\s*/);
|
|
218
220
|
return e ? e[0] : "";
|
|
219
221
|
}
|
|
220
|
-
const
|
|
221
|
-
class
|
|
222
|
+
const L = "a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}", Ae = new RegExp(`[${L}]+|\\s+|[^${L}]`, "ug");
|
|
223
|
+
class Ie extends E {
|
|
222
224
|
equals(e, n, i) {
|
|
223
225
|
return i.ignoreCase && (e = e.toLowerCase(), n = n.toLowerCase()), e.trim() === n.trim();
|
|
224
226
|
}
|
|
@@ -245,58 +247,58 @@ class Le extends S {
|
|
|
245
247
|
return e;
|
|
246
248
|
let i = null, s = null, r = null;
|
|
247
249
|
return e.forEach((l) => {
|
|
248
|
-
l.added ? s = l : l.removed ? r = l : ((s || r) &&
|
|
249
|
-
}), (s || r) &&
|
|
250
|
+
l.added ? s = l : l.removed ? r = l : ((s || r) && Z(i, r, s, l), i = l, s = null, r = null);
|
|
251
|
+
}), (s || r) && Z(i, r, s, null), e;
|
|
250
252
|
}
|
|
251
253
|
}
|
|
252
|
-
const
|
|
253
|
-
function
|
|
254
|
-
return n?.ignoreWhitespace != null && !n.ignoreWhitespace ?
|
|
254
|
+
const ne = new Ie();
|
|
255
|
+
function ie(t, e, n) {
|
|
256
|
+
return n?.ignoreWhitespace != null && !n.ignoreWhitespace ? M(t, e, n) : ne.diff(t, e, n);
|
|
255
257
|
}
|
|
256
|
-
function
|
|
258
|
+
function Z(t, e, n, i) {
|
|
257
259
|
if (e && n) {
|
|
258
|
-
const s =
|
|
260
|
+
const s = S(e.value), r = _(e.value), l = S(n.value), o = _(n.value);
|
|
259
261
|
if (t) {
|
|
260
|
-
const f =
|
|
261
|
-
t.value =
|
|
262
|
+
const f = V(s, l);
|
|
263
|
+
t.value = q(t.value, l, f), e.value = W(e.value, f), n.value = W(n.value, f);
|
|
262
264
|
}
|
|
263
265
|
if (i) {
|
|
264
|
-
const f =
|
|
265
|
-
i.value =
|
|
266
|
+
const f = Y(r, o);
|
|
267
|
+
i.value = $(i.value, o, f), e.value = O(e.value, f), n.value = O(n.value, f);
|
|
266
268
|
}
|
|
267
269
|
} else if (n) {
|
|
268
270
|
if (t) {
|
|
269
|
-
const s =
|
|
271
|
+
const s = S(n.value);
|
|
270
272
|
n.value = n.value.substring(s.length);
|
|
271
273
|
}
|
|
272
274
|
if (i) {
|
|
273
|
-
const s =
|
|
275
|
+
const s = S(i.value);
|
|
274
276
|
i.value = i.value.substring(s.length);
|
|
275
277
|
}
|
|
276
278
|
} else if (t && i) {
|
|
277
|
-
const s =
|
|
279
|
+
const s = S(i.value), r = S(e.value), l = _(e.value), o = V(s, r);
|
|
278
280
|
e.value = W(e.value, o);
|
|
279
|
-
const f =
|
|
280
|
-
e.value = O(e.value, f), i.value =
|
|
281
|
+
const f = Y(W(s, o), l);
|
|
282
|
+
e.value = O(e.value, f), i.value = $(i.value, s, f), t.value = q(t.value, s, s.slice(0, s.length - f.length));
|
|
281
283
|
} else if (i) {
|
|
282
|
-
const s =
|
|
284
|
+
const s = S(i.value), r = _(e.value), l = X(r, s);
|
|
283
285
|
e.value = O(e.value, l);
|
|
284
286
|
} else if (t) {
|
|
285
|
-
const s = _(t.value), r =
|
|
287
|
+
const s = _(t.value), r = S(e.value), l = X(s, r);
|
|
286
288
|
e.value = W(e.value, l);
|
|
287
289
|
}
|
|
288
290
|
}
|
|
289
|
-
class
|
|
291
|
+
class ze extends E {
|
|
290
292
|
tokenize(e) {
|
|
291
|
-
const n = new RegExp(`(\\r?\\n)|[${
|
|
293
|
+
const n = new RegExp(`(\\r?\\n)|[${L}]+|[^\\S\\n\\r]+|[^${L}]`, "ug");
|
|
292
294
|
return e.match(n) || [];
|
|
293
295
|
}
|
|
294
296
|
}
|
|
295
|
-
const
|
|
296
|
-
function
|
|
297
|
-
return
|
|
297
|
+
const re = new ze();
|
|
298
|
+
function M(t, e, n) {
|
|
299
|
+
return re.diff(t, e, n);
|
|
298
300
|
}
|
|
299
|
-
function
|
|
301
|
+
function $e(t, e) {
|
|
300
302
|
if (typeof t == "function")
|
|
301
303
|
e.callback = t;
|
|
302
304
|
else if (t)
|
|
@@ -304,9 +306,9 @@ function ze(t, e) {
|
|
|
304
306
|
Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
|
|
305
307
|
return e;
|
|
306
308
|
}
|
|
307
|
-
class
|
|
309
|
+
class qe extends E {
|
|
308
310
|
constructor() {
|
|
309
|
-
super(...arguments), this.tokenize =
|
|
311
|
+
super(...arguments), this.tokenize = le;
|
|
310
312
|
}
|
|
311
313
|
equals(e, n, i) {
|
|
312
314
|
return i.ignoreWhitespace ? ((!i.newlineIsToken || !e.includes(`
|
|
@@ -316,14 +318,14 @@ class Ie extends S {
|
|
|
316
318
|
`) && (n = n.slice(0, -1))), super.equals(e, n, i);
|
|
317
319
|
}
|
|
318
320
|
}
|
|
319
|
-
const
|
|
321
|
+
const R = new qe();
|
|
320
322
|
function F(t, e, n) {
|
|
321
|
-
return
|
|
323
|
+
return R.diff(t, e, n);
|
|
322
324
|
}
|
|
323
|
-
function
|
|
324
|
-
return n =
|
|
325
|
+
function se(t, e, n) {
|
|
326
|
+
return n = $e(n, { ignoreWhitespace: !0 }), R.diff(t, e, n);
|
|
325
327
|
}
|
|
326
|
-
function
|
|
328
|
+
function le(t, e) {
|
|
327
329
|
e.stripTrailingCr && (t = t.replace(/\r\n/g, `
|
|
328
330
|
`));
|
|
329
331
|
const n = [], i = t.split(/(\n|\r\n)/);
|
|
@@ -337,7 +339,7 @@ function se(t, e) {
|
|
|
337
339
|
function He(t) {
|
|
338
340
|
return t == "." || t == "!" || t == "?";
|
|
339
341
|
}
|
|
340
|
-
class
|
|
342
|
+
class Me extends E {
|
|
341
343
|
tokenize(e) {
|
|
342
344
|
var n;
|
|
343
345
|
const i = [];
|
|
@@ -356,39 +358,39 @@ class qe extends S {
|
|
|
356
358
|
return i;
|
|
357
359
|
}
|
|
358
360
|
}
|
|
359
|
-
const
|
|
360
|
-
function
|
|
361
|
-
return
|
|
361
|
+
const oe = new Me();
|
|
362
|
+
function fe(t, e, n) {
|
|
363
|
+
return oe.diff(t, e, n);
|
|
362
364
|
}
|
|
363
|
-
class
|
|
365
|
+
class Re extends E {
|
|
364
366
|
tokenize(e) {
|
|
365
367
|
return e.split(/([{}:;,]|\s+)/);
|
|
366
368
|
}
|
|
367
369
|
}
|
|
368
|
-
const
|
|
369
|
-
function
|
|
370
|
-
return
|
|
370
|
+
const ae = new Re();
|
|
371
|
+
function ce(t, e, n) {
|
|
372
|
+
return ae.diff(t, e, n);
|
|
371
373
|
}
|
|
372
|
-
class
|
|
374
|
+
class Je extends E {
|
|
373
375
|
constructor() {
|
|
374
|
-
super(...arguments), this.tokenize =
|
|
376
|
+
super(...arguments), this.tokenize = le;
|
|
375
377
|
}
|
|
376
378
|
get useLongestToken() {
|
|
377
379
|
return !0;
|
|
378
380
|
}
|
|
379
381
|
castInput(e, n) {
|
|
380
382
|
const { undefinedReplacement: i, stringifyReplacer: s = (r, l) => typeof l > "u" ? i : l } = n;
|
|
381
|
-
return typeof e == "string" ? e : JSON.stringify(
|
|
383
|
+
return typeof e == "string" ? e : JSON.stringify(j(e, null, null, s), null, " ");
|
|
382
384
|
}
|
|
383
385
|
equals(e, n, i) {
|
|
384
386
|
return super.equals(e.replace(/,([\r\n])/g, "$1"), n.replace(/,([\r\n])/g, "$1"), i);
|
|
385
387
|
}
|
|
386
388
|
}
|
|
387
|
-
const
|
|
388
|
-
function
|
|
389
|
-
return
|
|
389
|
+
const ue = new Je();
|
|
390
|
+
function de(t, e, n) {
|
|
391
|
+
return ue.diff(t, e, n);
|
|
390
392
|
}
|
|
391
|
-
function
|
|
393
|
+
function j(t, e, n, i, s) {
|
|
392
394
|
e = e || [], n = n || [], i && (t = i(s === void 0 ? "" : s, t));
|
|
393
395
|
let r;
|
|
394
396
|
for (r = 0; r < e.length; r += 1)
|
|
@@ -397,7 +399,7 @@ function A(t, e, n, i, s) {
|
|
|
397
399
|
let l;
|
|
398
400
|
if (Object.prototype.toString.call(t) === "[object Array]") {
|
|
399
401
|
for (e.push(t), l = new Array(t.length), n.push(l), r = 0; r < t.length; r += 1)
|
|
400
|
-
l[r] =
|
|
402
|
+
l[r] = j(t[r], e, n, i, String(r));
|
|
401
403
|
return e.pop(), n.pop(), l;
|
|
402
404
|
}
|
|
403
405
|
if (t && t.toJSON && (t = t.toJSON()), typeof t == "object" && t !== null) {
|
|
@@ -407,13 +409,13 @@ function A(t, e, n, i, s) {
|
|
|
407
409
|
for (f in t)
|
|
408
410
|
Object.prototype.hasOwnProperty.call(t, f) && o.push(f);
|
|
409
411
|
for (o.sort(), r = 0; r < o.length; r += 1)
|
|
410
|
-
f = o[r], l[f] =
|
|
412
|
+
f = o[r], l[f] = j(t[f], e, n, i, f);
|
|
411
413
|
e.pop(), n.pop();
|
|
412
414
|
} else
|
|
413
415
|
l = t;
|
|
414
416
|
return l;
|
|
415
417
|
}
|
|
416
|
-
class
|
|
418
|
+
class Ue extends E {
|
|
417
419
|
tokenize(e) {
|
|
418
420
|
return e.slice();
|
|
419
421
|
}
|
|
@@ -424,20 +426,20 @@ class Re extends S {
|
|
|
424
426
|
return e;
|
|
425
427
|
}
|
|
426
428
|
}
|
|
427
|
-
const
|
|
428
|
-
function
|
|
429
|
-
return
|
|
429
|
+
const me = new Ue();
|
|
430
|
+
function he(t, e, n) {
|
|
431
|
+
return me.diff(t, e, n);
|
|
430
432
|
}
|
|
431
|
-
function
|
|
432
|
-
return Array.isArray(t) ? t.map((e) =>
|
|
433
|
+
function ge(t) {
|
|
434
|
+
return Array.isArray(t) ? t.map((e) => ge(e)) : Object.assign(Object.assign({}, t), { hunks: t.hunks.map((e) => Object.assign(Object.assign({}, e), { lines: e.lines.map((n, i) => {
|
|
433
435
|
var s;
|
|
434
436
|
return n.startsWith("\\") || n.endsWith("\r") || !((s = e.lines[i + 1]) === null || s === void 0) && s.startsWith("\\") ? n : n + "\r";
|
|
435
437
|
}) })) });
|
|
436
438
|
}
|
|
437
|
-
function
|
|
438
|
-
return Array.isArray(t) ? t.map((e) =>
|
|
439
|
+
function ve(t) {
|
|
440
|
+
return Array.isArray(t) ? t.map((e) => ve(e)) : Object.assign(Object.assign({}, t), { hunks: t.hunks.map((e) => Object.assign(Object.assign({}, e), { lines: e.lines.map((n) => n.endsWith("\r") ? n.substring(0, n.length - 1) : n) })) });
|
|
439
441
|
}
|
|
440
|
-
function
|
|
442
|
+
function Qe(t) {
|
|
441
443
|
return Array.isArray(t) || (t = [t]), !t.some((e) => e.hunks.some((n) => n.lines.some((i) => !i.startsWith("\\") && i.endsWith("\r"))));
|
|
442
444
|
}
|
|
443
445
|
function Be(t) {
|
|
@@ -446,7 +448,7 @@ function Be(t) {
|
|
|
446
448
|
return i.startsWith("\\") || i.endsWith("\r") || ((r = n.lines[s + 1]) === null || r === void 0 ? void 0 : r.startsWith("\\"));
|
|
447
449
|
})));
|
|
448
450
|
}
|
|
449
|
-
function
|
|
451
|
+
function J(t) {
|
|
450
452
|
const e = t.split(/\n/), n = [];
|
|
451
453
|
let i = 0;
|
|
452
454
|
function s() {
|
|
@@ -455,8 +457,8 @@ function R(t) {
|
|
|
455
457
|
const f = e[i];
|
|
456
458
|
if (/^(---|\+\+\+|@@)\s/.test(f))
|
|
457
459
|
break;
|
|
458
|
-
const
|
|
459
|
-
|
|
460
|
+
const h = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(f);
|
|
461
|
+
h && (o.index = h[1]), i++;
|
|
460
462
|
}
|
|
461
463
|
for (r(o), r(o), o.hunks = []; i < e.length; ) {
|
|
462
464
|
const f = e[i];
|
|
@@ -474,40 +476,40 @@ function R(t) {
|
|
|
474
476
|
function r(o) {
|
|
475
477
|
const f = /^(---|\+\+\+)\s+(.*)\r?$/.exec(e[i]);
|
|
476
478
|
if (f) {
|
|
477
|
-
const
|
|
478
|
-
let
|
|
479
|
-
/^".*"$/.test(
|
|
479
|
+
const h = f[2].split(" ", 2), c = (h[1] || "").trim();
|
|
480
|
+
let g = h[0].replace(/\\\\/g, "\\");
|
|
481
|
+
/^".*"$/.test(g) && (g = g.substr(1, g.length - 2)), f[1] === "---" ? (o.oldFileName = g, o.oldHeader = c) : (o.newFileName = g, o.newHeader = c), i++;
|
|
480
482
|
}
|
|
481
483
|
}
|
|
482
484
|
function l() {
|
|
483
485
|
var o;
|
|
484
|
-
const f = i,
|
|
485
|
-
oldStart: +
|
|
486
|
-
oldLines: typeof
|
|
487
|
-
newStart: +
|
|
488
|
-
newLines: typeof
|
|
486
|
+
const f = i, h = e[i++], c = h.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/), g = {
|
|
487
|
+
oldStart: +c[1],
|
|
488
|
+
oldLines: typeof c[2] > "u" ? 1 : +c[2],
|
|
489
|
+
newStart: +c[3],
|
|
490
|
+
newLines: typeof c[4] > "u" ? 1 : +c[4],
|
|
489
491
|
lines: []
|
|
490
492
|
};
|
|
491
|
-
|
|
492
|
-
let y = 0,
|
|
493
|
-
for (; i < e.length && (
|
|
494
|
-
const
|
|
495
|
-
if (
|
|
496
|
-
|
|
493
|
+
g.oldLines === 0 && (g.oldStart += 1), g.newLines === 0 && (g.newStart += 1);
|
|
494
|
+
let y = 0, w = 0;
|
|
495
|
+
for (; i < e.length && (w < g.oldLines || y < g.newLines || !((o = e[i]) === null || o === void 0) && o.startsWith("\\")); i++) {
|
|
496
|
+
const m = e[i].length == 0 && i != e.length - 1 ? " " : e[i][0];
|
|
497
|
+
if (m === "+" || m === "-" || m === " " || m === "\\")
|
|
498
|
+
g.lines.push(e[i]), m === "+" ? y++ : m === "-" ? w++ : m === " " && (y++, w++);
|
|
497
499
|
else
|
|
498
500
|
throw new Error(`Hunk at line ${f + 1} contained invalid line ${e[i]}`);
|
|
499
501
|
}
|
|
500
|
-
if (!y &&
|
|
502
|
+
if (!y && g.newLines === 1 && (g.newLines = 0), !w && g.oldLines === 1 && (g.oldLines = 0), y !== g.newLines)
|
|
501
503
|
throw new Error("Added line count did not match for hunk at line " + (f + 1));
|
|
502
|
-
if (
|
|
504
|
+
if (w !== g.oldLines)
|
|
503
505
|
throw new Error("Removed line count did not match for hunk at line " + (f + 1));
|
|
504
|
-
return
|
|
506
|
+
return g;
|
|
505
507
|
}
|
|
506
508
|
for (; i < e.length; )
|
|
507
509
|
s();
|
|
508
510
|
return n;
|
|
509
511
|
}
|
|
510
|
-
function
|
|
512
|
+
function Ve(t, e, n) {
|
|
511
513
|
let i = !0, s = !1, r = !1, l = 1;
|
|
512
514
|
return function o() {
|
|
513
515
|
if (i && !r) {
|
|
@@ -521,95 +523,95 @@ function Qe(t, e, n) {
|
|
|
521
523
|
}
|
|
522
524
|
function pe(t, e, n = {}) {
|
|
523
525
|
let i;
|
|
524
|
-
if (typeof e == "string" ? i =
|
|
526
|
+
if (typeof e == "string" ? i = J(e) : Array.isArray(e) ? i = e : i = [e], i.length > 1)
|
|
525
527
|
throw new Error("applyPatch only works with a single input.");
|
|
526
|
-
return
|
|
528
|
+
return Ye(t, i[0], n);
|
|
527
529
|
}
|
|
528
|
-
function
|
|
529
|
-
(n.autoConvertLineEndings || n.autoConvertLineEndings == null) && (
|
|
530
|
+
function Ye(t, e, n = {}) {
|
|
531
|
+
(n.autoConvertLineEndings || n.autoConvertLineEndings == null) && (Fe(t) && Qe(e) ? e = ge(e) : je(t) && Be(e) && (e = ve(e)));
|
|
530
532
|
const i = t.split(`
|
|
531
|
-
`), s = e.hunks, r = n.compareLine || ((
|
|
533
|
+
`), s = e.hunks, r = n.compareLine || ((m, v, x, C) => v === C), l = n.fuzzFactor || 0;
|
|
532
534
|
let o = 0;
|
|
533
535
|
if (l < 0 || !Number.isInteger(l))
|
|
534
536
|
throw new Error("fuzzFactor must be a non-negative integer");
|
|
535
537
|
if (!s.length)
|
|
536
538
|
return t;
|
|
537
|
-
let f = "",
|
|
538
|
-
for (let
|
|
539
|
-
const
|
|
540
|
-
|
|
539
|
+
let f = "", h = !1, c = !1;
|
|
540
|
+
for (let m = 0; m < s[s.length - 1].lines.length; m++) {
|
|
541
|
+
const v = s[s.length - 1].lines[m];
|
|
542
|
+
v[0] == "\\" && (f[0] == "+" ? h = !0 : f[0] == "-" && (c = !0)), f = v;
|
|
541
543
|
}
|
|
542
|
-
if (
|
|
543
|
-
if (
|
|
544
|
+
if (h) {
|
|
545
|
+
if (c) {
|
|
544
546
|
if (!l && i[i.length - 1] == "")
|
|
545
547
|
return !1;
|
|
546
548
|
} else if (i[i.length - 1] == "")
|
|
547
549
|
i.pop();
|
|
548
550
|
else if (!l)
|
|
549
551
|
return !1;
|
|
550
|
-
} else if (
|
|
552
|
+
} else if (c) {
|
|
551
553
|
if (i[i.length - 1] != "")
|
|
552
554
|
i.push("");
|
|
553
555
|
else if (!l)
|
|
554
556
|
return !1;
|
|
555
557
|
}
|
|
556
|
-
function
|
|
557
|
-
let k = 0,
|
|
558
|
-
for (; C <
|
|
559
|
-
const
|
|
558
|
+
function g(m, v, x, C = 0, d = !0, u = [], p = 0) {
|
|
559
|
+
let k = 0, D = !1;
|
|
560
|
+
for (; C < m.length; C++) {
|
|
561
|
+
const b = m[C], N = b.length > 0 ? b[0] : " ", z = b.length > 0 ? b.substr(1) : b;
|
|
560
562
|
if (N === "-")
|
|
561
|
-
if (r(
|
|
562
|
-
|
|
563
|
+
if (r(v + 1, i[v], N, z))
|
|
564
|
+
v++, k = 0;
|
|
563
565
|
else
|
|
564
|
-
return !x || i[
|
|
566
|
+
return !x || i[v] == null ? null : (u[p] = i[v], g(m, v + 1, x - 1, C, !1, u, p + 1));
|
|
565
567
|
if (N === "+") {
|
|
566
|
-
if (!
|
|
568
|
+
if (!d)
|
|
567
569
|
return null;
|
|
568
|
-
|
|
570
|
+
u[p] = z, p++, k = 0, D = !0;
|
|
569
571
|
}
|
|
570
572
|
if (N === " ")
|
|
571
|
-
if (k++,
|
|
572
|
-
|
|
573
|
+
if (k++, u[p] = i[v], r(v + 1, i[v], N, z))
|
|
574
|
+
p++, d = !0, D = !1, v++;
|
|
573
575
|
else
|
|
574
|
-
return
|
|
576
|
+
return D || !x ? null : i[v] && (g(m, v + 1, x - 1, C + 1, !1, u, p + 1) || g(m, v + 1, x - 1, C, !1, u, p + 1)) || g(m, v, x - 1, C + 1, !1, u, p);
|
|
575
577
|
}
|
|
576
|
-
return
|
|
577
|
-
patchedLines:
|
|
578
|
-
oldLineLastI:
|
|
578
|
+
return p -= k, v -= k, u.length = p, {
|
|
579
|
+
patchedLines: u,
|
|
580
|
+
oldLineLastI: v - 1
|
|
579
581
|
};
|
|
580
582
|
}
|
|
581
583
|
const y = [];
|
|
582
|
-
let
|
|
583
|
-
for (let
|
|
584
|
-
const
|
|
584
|
+
let w = 0;
|
|
585
|
+
for (let m = 0; m < s.length; m++) {
|
|
586
|
+
const v = s[m];
|
|
585
587
|
let x;
|
|
586
|
-
const C = i.length -
|
|
587
|
-
let
|
|
588
|
-
for (let
|
|
589
|
-
|
|
590
|
-
const
|
|
591
|
-
for (;
|
|
588
|
+
const C = i.length - v.oldLines + l;
|
|
589
|
+
let d;
|
|
590
|
+
for (let u = 0; u <= l; u++) {
|
|
591
|
+
d = v.oldStart + w - 1;
|
|
592
|
+
const p = Ve(d, o, C);
|
|
593
|
+
for (; d !== void 0 && (x = g(v.lines, d, u), !x); d = p())
|
|
592
594
|
;
|
|
593
595
|
if (x)
|
|
594
596
|
break;
|
|
595
597
|
}
|
|
596
598
|
if (!x)
|
|
597
599
|
return !1;
|
|
598
|
-
for (let
|
|
599
|
-
y.push(i[
|
|
600
|
-
for (let
|
|
601
|
-
const
|
|
602
|
-
y.push(
|
|
600
|
+
for (let u = o; u < d; u++)
|
|
601
|
+
y.push(i[u]);
|
|
602
|
+
for (let u = 0; u < x.patchedLines.length; u++) {
|
|
603
|
+
const p = x.patchedLines[u];
|
|
604
|
+
y.push(p);
|
|
603
605
|
}
|
|
604
|
-
o = x.oldLineLastI + 1,
|
|
606
|
+
o = x.oldLineLastI + 1, w = d + 1 - v.oldStart;
|
|
605
607
|
}
|
|
606
|
-
for (let
|
|
607
|
-
y.push(i[
|
|
608
|
+
for (let m = o; m < i.length; m++)
|
|
609
|
+
y.push(i[m]);
|
|
608
610
|
return y.join(`
|
|
609
611
|
`);
|
|
610
612
|
}
|
|
611
|
-
function
|
|
612
|
-
const n = typeof t == "string" ?
|
|
613
|
+
function Xe(t, e) {
|
|
614
|
+
const n = typeof t == "string" ? J(t) : t;
|
|
613
615
|
let i = 0;
|
|
614
616
|
function s() {
|
|
615
617
|
const r = n[i++];
|
|
@@ -619,9 +621,9 @@ function Ve(t, e) {
|
|
|
619
621
|
if (l)
|
|
620
622
|
return e.complete(l);
|
|
621
623
|
const f = pe(o, r, e);
|
|
622
|
-
e.patched(r, f, function(
|
|
623
|
-
if (
|
|
624
|
-
return e.complete(
|
|
624
|
+
e.patched(r, f, function(h) {
|
|
625
|
+
if (h)
|
|
626
|
+
return e.complete(h);
|
|
625
627
|
s();
|
|
626
628
|
});
|
|
627
629
|
});
|
|
@@ -637,66 +639,66 @@ function we(t) {
|
|
|
637
639
|
lines: e.lines.map((n) => n.startsWith("-") ? `+${n.slice(1)}` : n.startsWith("+") ? `-${n.slice(1)}` : n)
|
|
638
640
|
})) });
|
|
639
641
|
}
|
|
640
|
-
function
|
|
642
|
+
function H(t, e, n, i, s, r, l) {
|
|
641
643
|
let o;
|
|
642
644
|
l ? typeof l == "function" ? o = { callback: l } : o = l : o = {}, typeof o.context > "u" && (o.context = 4);
|
|
643
645
|
const f = o.context;
|
|
644
646
|
if (o.newlineIsToken)
|
|
645
647
|
throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");
|
|
646
648
|
if (o.callback) {
|
|
647
|
-
const { callback:
|
|
648
|
-
F(n, i, Object.assign(Object.assign({}, o), { callback: (
|
|
649
|
-
const y = g
|
|
650
|
-
|
|
649
|
+
const { callback: c } = o;
|
|
650
|
+
F(n, i, Object.assign(Object.assign({}, o), { callback: (g) => {
|
|
651
|
+
const y = h(g);
|
|
652
|
+
c(y);
|
|
651
653
|
} }));
|
|
652
654
|
} else
|
|
653
|
-
return
|
|
654
|
-
function
|
|
655
|
-
if (!
|
|
655
|
+
return h(F(n, i, o));
|
|
656
|
+
function h(c) {
|
|
657
|
+
if (!c)
|
|
656
658
|
return;
|
|
657
|
-
|
|
658
|
-
function
|
|
659
|
-
return
|
|
660
|
-
return " " +
|
|
659
|
+
c.push({ value: "", lines: [] });
|
|
660
|
+
function g(d) {
|
|
661
|
+
return d.map(function(u) {
|
|
662
|
+
return " " + u;
|
|
661
663
|
});
|
|
662
664
|
}
|
|
663
665
|
const y = [];
|
|
664
|
-
let
|
|
665
|
-
for (let
|
|
666
|
-
const
|
|
667
|
-
if (
|
|
668
|
-
if (!
|
|
669
|
-
const k =
|
|
670
|
-
|
|
666
|
+
let w = 0, m = 0, v = [], x = 1, C = 1;
|
|
667
|
+
for (let d = 0; d < c.length; d++) {
|
|
668
|
+
const u = c[d], p = u.lines || Ge(u.value);
|
|
669
|
+
if (u.lines = p, u.added || u.removed) {
|
|
670
|
+
if (!w) {
|
|
671
|
+
const k = c[d - 1];
|
|
672
|
+
w = x, m = C, k && (v = f > 0 ? g(k.lines.slice(-f)) : [], w -= v.length, m -= v.length);
|
|
671
673
|
}
|
|
672
|
-
for (const k of
|
|
673
|
-
|
|
674
|
-
|
|
674
|
+
for (const k of p)
|
|
675
|
+
v.push((u.added ? "+" : "-") + k);
|
|
676
|
+
u.added ? C += p.length : x += p.length;
|
|
675
677
|
} else {
|
|
676
|
-
if (
|
|
677
|
-
if (
|
|
678
|
-
for (const k of
|
|
679
|
-
|
|
678
|
+
if (w)
|
|
679
|
+
if (p.length <= f * 2 && d < c.length - 2)
|
|
680
|
+
for (const k of g(p))
|
|
681
|
+
v.push(k);
|
|
680
682
|
else {
|
|
681
|
-
const k = Math.min(
|
|
682
|
-
for (const
|
|
683
|
-
|
|
684
|
-
const
|
|
685
|
-
oldStart:
|
|
686
|
-
oldLines: x -
|
|
687
|
-
newStart:
|
|
688
|
-
newLines: C -
|
|
689
|
-
lines:
|
|
683
|
+
const k = Math.min(p.length, f);
|
|
684
|
+
for (const b of g(p.slice(0, k)))
|
|
685
|
+
v.push(b);
|
|
686
|
+
const D = {
|
|
687
|
+
oldStart: w,
|
|
688
|
+
oldLines: x - w + k,
|
|
689
|
+
newStart: m,
|
|
690
|
+
newLines: C - m + k,
|
|
691
|
+
lines: v
|
|
690
692
|
};
|
|
691
|
-
y.push(
|
|
693
|
+
y.push(D), w = 0, m = 0, v = [];
|
|
692
694
|
}
|
|
693
|
-
x +=
|
|
695
|
+
x += p.length, C += p.length;
|
|
694
696
|
}
|
|
695
697
|
}
|
|
696
|
-
for (const
|
|
697
|
-
for (let
|
|
698
|
-
|
|
699
|
-
`) ?
|
|
698
|
+
for (const d of y)
|
|
699
|
+
for (let u = 0; u < d.lines.length; u++)
|
|
700
|
+
d.lines[u].endsWith(`
|
|
701
|
+
`) ? d.lines[u] = d.lines[u].slice(0, -1) : (d.lines.splice(u + 1, 0, "\"), u++);
|
|
700
702
|
return {
|
|
701
703
|
oldFileName: t,
|
|
702
704
|
newFileName: e,
|
|
@@ -706,9 +708,9 @@ function q(t, e, n, i, s, r, l) {
|
|
|
706
708
|
};
|
|
707
709
|
}
|
|
708
710
|
}
|
|
709
|
-
function
|
|
711
|
+
function A(t) {
|
|
710
712
|
if (Array.isArray(t))
|
|
711
|
-
return t.map(
|
|
713
|
+
return t.map(A).join(`
|
|
712
714
|
`);
|
|
713
715
|
const e = [];
|
|
714
716
|
t.oldFileName == t.newFileName && e.push("Index: " + t.oldFileName), e.push("==================================================================="), e.push("--- " + t.oldFileName + (typeof t.oldHeader > "u" ? "" : " " + t.oldHeader)), e.push("+++ " + t.newFileName + (typeof t.newHeader > "u" ? "" : " " + t.newHeader));
|
|
@@ -722,96 +724,96 @@ function L(t) {
|
|
|
722
724
|
`) + `
|
|
723
725
|
`;
|
|
724
726
|
}
|
|
725
|
-
function
|
|
727
|
+
function U(t, e, n, i, s, r, l) {
|
|
726
728
|
if (typeof l == "function" && (l = { callback: l }), l?.callback) {
|
|
727
729
|
const { callback: o } = l;
|
|
728
|
-
|
|
729
|
-
o(f ?
|
|
730
|
+
H(t, e, n, i, s, r, Object.assign(Object.assign({}, l), { callback: (f) => {
|
|
731
|
+
o(f ? A(f) : void 0);
|
|
730
732
|
} }));
|
|
731
733
|
} else {
|
|
732
|
-
const o =
|
|
733
|
-
return o ?
|
|
734
|
+
const o = H(t, e, n, i, s, r, l);
|
|
735
|
+
return o ? A(o) : void 0;
|
|
734
736
|
}
|
|
735
737
|
}
|
|
736
|
-
function
|
|
737
|
-
return
|
|
738
|
+
function Ze(t, e, n, i, s, r) {
|
|
739
|
+
return U(t, t, e, n, i, s, r);
|
|
738
740
|
}
|
|
739
|
-
function
|
|
741
|
+
function Ge(t) {
|
|
740
742
|
const e = t.endsWith(`
|
|
741
743
|
`), n = t.split(`
|
|
742
744
|
`).map((i) => i + `
|
|
743
745
|
`);
|
|
744
746
|
return e ? n.pop() : n.push(n.pop().slice(0, -1)), n;
|
|
745
747
|
}
|
|
746
|
-
function
|
|
748
|
+
function Ke(t) {
|
|
747
749
|
const e = [];
|
|
748
750
|
let n, i;
|
|
749
751
|
for (let s = 0; s < t.length; s++)
|
|
750
752
|
n = t[s], n.added ? i = 1 : n.removed ? i = -1 : i = 0, e.push([i, n.value]);
|
|
751
753
|
return e;
|
|
752
754
|
}
|
|
753
|
-
function
|
|
755
|
+
function et(t) {
|
|
754
756
|
const e = [];
|
|
755
757
|
for (let n = 0; n < t.length; n++) {
|
|
756
758
|
const i = t[n];
|
|
757
|
-
i.added ? e.push("<ins>") : i.removed && e.push("<del>"), e.push(
|
|
759
|
+
i.added ? e.push("<ins>") : i.removed && e.push("<del>"), e.push(tt(i.value)), i.added ? e.push("</ins>") : i.removed && e.push("</del>");
|
|
758
760
|
}
|
|
759
761
|
return e.join("");
|
|
760
762
|
}
|
|
761
|
-
function
|
|
763
|
+
function tt(t) {
|
|
762
764
|
let e = t;
|
|
763
765
|
return e = e.replace(/&/g, "&"), e = e.replace(/</g, "<"), e = e.replace(/>/g, ">"), e = e.replace(/"/g, """), e;
|
|
764
766
|
}
|
|
765
|
-
const
|
|
767
|
+
const nt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
766
768
|
__proto__: null,
|
|
767
|
-
Diff:
|
|
769
|
+
Diff: E,
|
|
768
770
|
applyPatch: pe,
|
|
769
|
-
applyPatches:
|
|
770
|
-
arrayDiff:
|
|
771
|
-
canonicalize:
|
|
772
|
-
characterDiff:
|
|
773
|
-
convertChangesToDMP:
|
|
774
|
-
convertChangesToXML:
|
|
775
|
-
createPatch:
|
|
776
|
-
createTwoFilesPatch:
|
|
777
|
-
cssDiff:
|
|
778
|
-
diffArrays:
|
|
779
|
-
diffChars:
|
|
780
|
-
diffCss:
|
|
781
|
-
diffJson:
|
|
771
|
+
applyPatches: Xe,
|
|
772
|
+
arrayDiff: me,
|
|
773
|
+
canonicalize: j,
|
|
774
|
+
characterDiff: ee,
|
|
775
|
+
convertChangesToDMP: Ke,
|
|
776
|
+
convertChangesToXML: et,
|
|
777
|
+
createPatch: Ze,
|
|
778
|
+
createTwoFilesPatch: U,
|
|
779
|
+
cssDiff: ae,
|
|
780
|
+
diffArrays: he,
|
|
781
|
+
diffChars: te,
|
|
782
|
+
diffCss: ce,
|
|
783
|
+
diffJson: de,
|
|
782
784
|
diffLines: F,
|
|
783
|
-
diffSentences:
|
|
784
|
-
diffTrimmedLines:
|
|
785
|
-
diffWords:
|
|
786
|
-
diffWordsWithSpace:
|
|
787
|
-
formatPatch:
|
|
788
|
-
jsonDiff:
|
|
789
|
-
lineDiff:
|
|
790
|
-
parsePatch:
|
|
785
|
+
diffSentences: fe,
|
|
786
|
+
diffTrimmedLines: se,
|
|
787
|
+
diffWords: ie,
|
|
788
|
+
diffWordsWithSpace: M,
|
|
789
|
+
formatPatch: A,
|
|
790
|
+
jsonDiff: ue,
|
|
791
|
+
lineDiff: R,
|
|
792
|
+
parsePatch: J,
|
|
791
793
|
reversePatch: we,
|
|
792
|
-
sentenceDiff:
|
|
793
|
-
structuredPatch:
|
|
794
|
-
wordDiff:
|
|
795
|
-
wordsWithSpaceDiff:
|
|
794
|
+
sentenceDiff: oe,
|
|
795
|
+
structuredPatch: H,
|
|
796
|
+
wordDiff: ne,
|
|
797
|
+
wordsWithSpaceDiff: re
|
|
796
798
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
797
|
-
class
|
|
799
|
+
class it {
|
|
798
800
|
constructor(e) {
|
|
799
|
-
this.ctx = e, this.JsDiff =
|
|
801
|
+
this.ctx = e, this.JsDiff = nt, this.diffChars = te, this.diffWords = ie, this.diffWordsWithSpace = M, this.diffLines = F, this.diffTrimmedLines = se, this.diffSentences = fe, this.diffCss = ce, this.diffJson = de, this.diffArrays = he, this.createTwoFilesPatch = U, this.ctx.set("jsdiff", this);
|
|
800
802
|
}
|
|
801
803
|
}
|
|
802
|
-
const
|
|
804
|
+
const rt = {
|
|
803
805
|
"diff-container": "_diff-container_lq0si_2"
|
|
804
|
-
},
|
|
805
|
-
let { user: e, target: n } = t;
|
|
806
|
-
const
|
|
807
|
-
return /* @__PURE__ */
|
|
808
|
-
/* @__PURE__ */
|
|
806
|
+
}, st = (t) => {
|
|
807
|
+
let { user: e, target: n, ctx: i } = t;
|
|
808
|
+
const s = i.getUrl.bind(i);
|
|
809
|
+
return /* @__PURE__ */ a("span", { className: "mw-userlinks", children: [
|
|
810
|
+
/* @__PURE__ */ a("a", { href: s(`User:${e}`), className: "mw-userlink", target: n, children: e }),
|
|
809
811
|
" ",
|
|
810
|
-
/* @__PURE__ */
|
|
812
|
+
/* @__PURE__ */ a("span", { className: "mw-usertoollinks", children: [
|
|
811
813
|
"(",
|
|
812
|
-
/* @__PURE__ */
|
|
814
|
+
/* @__PURE__ */ a("a", { href: s(`User_talk:${e}`), className: "mw-usertoollinks-talk", target: n, children: "talk" }),
|
|
813
815
|
" | ",
|
|
814
|
-
/* @__PURE__ */
|
|
816
|
+
/* @__PURE__ */ a(
|
|
815
817
|
"a",
|
|
816
818
|
{
|
|
817
819
|
href: s(`Special:Contributions/${e}`),
|
|
@@ -821,7 +823,7 @@ const nt = {
|
|
|
821
823
|
}
|
|
822
824
|
),
|
|
823
825
|
" | ",
|
|
824
|
-
/* @__PURE__ */
|
|
826
|
+
/* @__PURE__ */ a(
|
|
825
827
|
"a",
|
|
826
828
|
{
|
|
827
829
|
href: s(`Special:Block/${e}`),
|
|
@@ -833,35 +835,91 @@ const nt = {
|
|
|
833
835
|
")"
|
|
834
836
|
] })
|
|
835
837
|
] });
|
|
836
|
-
}
|
|
838
|
+
};
|
|
839
|
+
var T = /* @__PURE__ */ ((t) => (t.update = "ipe:diff-table/update", t.edit = "ipe:diff-table/edit", t))(T || {});
|
|
840
|
+
const lt = new Intl.DateTimeFormat(void 0, {
|
|
837
841
|
dateStyle: "medium",
|
|
838
842
|
timeStyle: "medium"
|
|
839
|
-
}).format,
|
|
843
|
+
}).format, G = (t) => {
|
|
840
844
|
let e = ["diff-title"];
|
|
841
|
-
|
|
842
|
-
/* @__PURE__ */
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
845
|
+
if (t.type === "from" ? e.push("diff-otitle") : t.type === "to" && e.push("diff-ntitle"), !t.pageid || !t.userid)
|
|
846
|
+
return /* @__PURE__ */ a("td", { colSpan: 2, className: e, children: /* @__PURE__ */ a("div", { className: "mw-diff-title--title", children: t.type === "from" ? "Original content" : t.type === "to" ? "Your content" : "" }) });
|
|
847
|
+
const n = (i) => {
|
|
848
|
+
i.preventDefault(), i.target.dispatchEvent(
|
|
849
|
+
new CustomEvent("ipe:diff-table/edit", {
|
|
850
|
+
detail: { revid: t.revid },
|
|
851
|
+
bubbles: !0
|
|
852
|
+
})
|
|
853
|
+
);
|
|
854
|
+
};
|
|
855
|
+
return /* @__PURE__ */ a("td", { colSpan: 2, className: e, children: [
|
|
856
|
+
/* @__PURE__ */ a("div", { className: "mw-diff-title--title", children: [
|
|
857
|
+
t.pagetitle || t.timestamp,
|
|
858
|
+
t.revid ? ` (rev#${t.revid})` : ""
|
|
859
|
+
] }),
|
|
860
|
+
/* @__PURE__ */ a("div", { className: "mw-diff-title--actions", children: /* @__PURE__ */ a(
|
|
861
|
+
"a",
|
|
862
|
+
{
|
|
863
|
+
href: t.ctx.getUrl("", { action: "edit", oldid: t.revid }),
|
|
864
|
+
onClick: n,
|
|
865
|
+
children: [
|
|
866
|
+
/* @__PURE__ */ a(Pe, { style: "width: 1em; height: 1em" }),
|
|
867
|
+
"Quick edit"
|
|
868
|
+
]
|
|
869
|
+
}
|
|
870
|
+
) }),
|
|
871
|
+
/* @__PURE__ */ a("div", { className: "mw-diff-title--user", children: t.username && /* @__PURE__ */ a(st, { ctx: t.ctx, user: t.username, target: "_blank" }) }),
|
|
872
|
+
/* @__PURE__ */ a("div", { className: "mw-diff-title--timestamp", children: t.timestamp && lt(new Date(t.timestamp)) }),
|
|
873
|
+
/* @__PURE__ */ a("div", { className: "mw-diff-title--comment", children: t.parsedcomment && /* @__PURE__ */ a(Ee, { children: [
|
|
846
874
|
"(",
|
|
847
|
-
/* @__PURE__ */
|
|
875
|
+
/* @__PURE__ */ a("i", { innerHTML: t.parsedcomment }),
|
|
848
876
|
")"
|
|
849
|
-
] }) })
|
|
850
|
-
/* @__PURE__ */ m("div", { className: "mw-diff-title--navigation" })
|
|
877
|
+
] }) })
|
|
851
878
|
] });
|
|
852
|
-
},
|
|
853
|
-
const
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
879
|
+
}, ot = (t) => {
|
|
880
|
+
const e = t.data;
|
|
881
|
+
if (!e.prev && !e.next)
|
|
882
|
+
return null;
|
|
883
|
+
const n = (i, s, r) => {
|
|
884
|
+
i.preventDefault(), i.target.dispatchEvent(
|
|
885
|
+
new CustomEvent("ipe:diff-table/update", {
|
|
886
|
+
detail: { fromrev: s, torev: r },
|
|
887
|
+
bubbles: !0
|
|
888
|
+
})
|
|
889
|
+
);
|
|
890
|
+
};
|
|
891
|
+
return /* @__PURE__ */ a("tr", { className: "mw-diff-title--navigation", children: [
|
|
892
|
+
/* @__PURE__ */ a("td", { colSpan: 2, children: e.prev ? /* @__PURE__ */ a(
|
|
893
|
+
"a",
|
|
894
|
+
{
|
|
895
|
+
href: t.ctx.getUrl("", { diff: e.prev, oldid: e.fromrevid }),
|
|
896
|
+
onClick: (i) => n(i, e.prev, e.fromrevid),
|
|
897
|
+
children: "← Previous"
|
|
898
|
+
}
|
|
899
|
+
) : /* @__PURE__ */ a("i", { children: "Oldest version" }) }),
|
|
900
|
+
/* @__PURE__ */ a("td", { colSpan: 2, children: e.next ? /* @__PURE__ */ a(
|
|
901
|
+
"a",
|
|
902
|
+
{
|
|
903
|
+
href: t.ctx.getUrl("", { diff: e.next, oldid: e.torevid }),
|
|
904
|
+
onClick: (i) => n(i, e.torevid, e.next),
|
|
905
|
+
children: "Next →"
|
|
906
|
+
}
|
|
907
|
+
) : /* @__PURE__ */ a("i", { children: "Newest version" }) })
|
|
908
|
+
] });
|
|
909
|
+
}, ft = (t) => {
|
|
910
|
+
const { data: e, ...n } = t, i = /* @__PURE__ */ a("table", { className: "theme-ipe diff diff-type-table", "data-mw": "interface", ...n, children: [
|
|
911
|
+
/* @__PURE__ */ a("colgroup", { children: [
|
|
912
|
+
/* @__PURE__ */ a("col", { className: "diff-marker" }),
|
|
913
|
+
/* @__PURE__ */ a("col", { className: "diff-content" }),
|
|
914
|
+
/* @__PURE__ */ a("col", { className: "diff-marker" }),
|
|
915
|
+
/* @__PURE__ */ a("col", { className: "diff-content" })
|
|
859
916
|
] }),
|
|
860
|
-
/* @__PURE__ */
|
|
861
|
-
/* @__PURE__ */
|
|
862
|
-
/* @__PURE__ */
|
|
863
|
-
|
|
917
|
+
/* @__PURE__ */ a("tbody", { children: [
|
|
918
|
+
/* @__PURE__ */ a("tr", { children: [
|
|
919
|
+
/* @__PURE__ */ a(
|
|
920
|
+
G,
|
|
864
921
|
{
|
|
922
|
+
ctx: t.ctx,
|
|
865
923
|
type: "from",
|
|
866
924
|
pageid: e.fromid,
|
|
867
925
|
pagetitle: e.fromtitle,
|
|
@@ -874,9 +932,10 @@ const nt = {
|
|
|
874
932
|
parsedcomment: e.fromparsedcomment
|
|
875
933
|
}
|
|
876
934
|
),
|
|
877
|
-
/* @__PURE__ */
|
|
878
|
-
|
|
935
|
+
/* @__PURE__ */ a(
|
|
936
|
+
G,
|
|
879
937
|
{
|
|
938
|
+
ctx: t.ctx,
|
|
880
939
|
type: "to",
|
|
881
940
|
pageid: e.toid,
|
|
882
941
|
pagetitle: e.totitle,
|
|
@@ -890,14 +949,15 @@ const nt = {
|
|
|
890
949
|
}
|
|
891
950
|
)
|
|
892
951
|
] }),
|
|
893
|
-
/* @__PURE__ */
|
|
894
|
-
/* @__PURE__ */
|
|
895
|
-
|
|
896
|
-
/* @__PURE__ */
|
|
952
|
+
/* @__PURE__ */ a(ot, { data: e, ctx: t.ctx }),
|
|
953
|
+
/* @__PURE__ */ a("div", { id: "diffbody" }),
|
|
954
|
+
/* @__PURE__ */ a("tr", { className: "diff-size", style: { textAlign: "center" }, children: [
|
|
955
|
+
/* @__PURE__ */ a("td", { colSpan: 2, className: "diff-size-old", children: e.fromsize !== void 0 && `${e.fromsize} bytes` }),
|
|
956
|
+
/* @__PURE__ */ a("td", { colSpan: 2, className: "diff-size-new", children: e.tosize !== void 0 && `${e.tosize} bytes` })
|
|
897
957
|
] })
|
|
898
958
|
] })
|
|
899
959
|
] });
|
|
900
|
-
return i.querySelector("#diffbody").outerHTML = e.body || (/* @__PURE__ */
|
|
960
|
+
return i.querySelector("#diffbody").outerHTML = e.body || (/* @__PURE__ */ a("tr", { children: /* @__PURE__ */ a("td", { colSpan: 4, children: /* @__PURE__ */ a(
|
|
901
961
|
"div",
|
|
902
962
|
{
|
|
903
963
|
style: {
|
|
@@ -906,22 +966,22 @@ const nt = {
|
|
|
906
966
|
alignItems: "center",
|
|
907
967
|
height: "5rem"
|
|
908
968
|
},
|
|
909
|
-
children: /* @__PURE__ */
|
|
969
|
+
children: /* @__PURE__ */ a("i", { children: "No changes" })
|
|
910
970
|
}
|
|
911
971
|
) }) })).outerHTML, i;
|
|
912
|
-
},
|
|
913
|
-
var
|
|
972
|
+
}, at = (t, e = document) => e.querySelector(t), ct = (t, e = document) => e.querySelectorAll(t);
|
|
973
|
+
var ut = Object.create, Q = Object.defineProperty, dt = Object.getOwnPropertyDescriptor, ye = (t, e) => (e = Symbol[t]) ? e : Symbol.for("Symbol." + t), xe = (t) => {
|
|
914
974
|
throw TypeError(t);
|
|
915
|
-
},
|
|
975
|
+
}, mt = (t, e, n) => e in t ? Q(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, ht = (t, e) => Q(t, "name", { value: e, configurable: !0 }), gt = (t) => [, , , ut(t?.[ye("metadata")] ?? null)], vt = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], ke = (t) => t !== void 0 && typeof t != "function" ? xe("Function expected") : t, pt = (t, e, n, i, s) => ({ kind: vt[t], name: e, metadata: i, addInitializer: (r) => n._ ? xe("Already initialized") : s.push(ke(r || null)) }), wt = (t, e) => mt(e, ye("metadata"), t[3]), yt = (t, e, n, i) => {
|
|
916
976
|
for (var s = 0, r = t[e >> 1], l = r && r.length; s < l; s++) r[s].call(n);
|
|
917
977
|
return i;
|
|
918
|
-
},
|
|
919
|
-
var l, o, f,
|
|
920
|
-
|
|
921
|
-
for (var
|
|
922
|
-
f =
|
|
923
|
-
return
|
|
924
|
-
},
|
|
978
|
+
}, xt = (t, e, n, i, s, r) => {
|
|
979
|
+
var l, o, f, h = e & 7, c = !1, g = 0, y = t[g] || (t[g] = []), w = h && (s = s.prototype, h < 5 && (h > 3 || !c) && dt(s, n));
|
|
980
|
+
ht(s, n);
|
|
981
|
+
for (var m = i.length - 1; m >= 0; m--)
|
|
982
|
+
f = pt(h, n, o = {}, t[3], y), l = (0, i[m])(s, f), o._ = 1, ke(l) && (s = l);
|
|
983
|
+
return wt(t, s), w && Q(s, n, w), c ? h ^ 4 ? r : w : s;
|
|
984
|
+
}, Ce, B, be;
|
|
925
985
|
const De = [
|
|
926
986
|
"diffChars",
|
|
927
987
|
"diffWords",
|
|
@@ -929,17 +989,17 @@ const De = [
|
|
|
929
989
|
"diffLines",
|
|
930
990
|
"createTwoFilesPatch"
|
|
931
991
|
];
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
"quickDiff.preferredCompareMode":
|
|
935
|
-
"quickDiff.jsDiff.defaultType":
|
|
992
|
+
Ce = [Se(["jsdiff", "sitemeta", "getUrl"]), We(
|
|
993
|
+
P.object({
|
|
994
|
+
"quickDiff.preferredCompareMode": P.union([P.const("jsDiff"), P.const("mwApi")]).description("The preferred comparison mode for quick diff").default("mwApi"),
|
|
995
|
+
"quickDiff.jsDiff.defaultType": P.union(De.map((t) => P.const(t))).description("The default diff type for JsDiff").default("diffSentences")
|
|
936
996
|
}).description("Quick Diff Preferences"),
|
|
937
997
|
{
|
|
938
998
|
"quickDiff.preferredCompareMode": "mwApi",
|
|
939
999
|
"quickDiff.jsDiff.defaultType": "diffSentences"
|
|
940
1000
|
}
|
|
941
1001
|
)];
|
|
942
|
-
class
|
|
1002
|
+
class I extends (be = K) {
|
|
943
1003
|
constructor(e) {
|
|
944
1004
|
super(e, {}, "quick-diff"), this.ctx = e, this.VALID_DIFF_TYPES = De, this.COMPARE_API_DEFAULT_OPTIONS = {
|
|
945
1005
|
prop: [
|
|
@@ -951,7 +1011,8 @@ class j extends (Ce = G) {
|
|
|
951
1011
|
"size",
|
|
952
1012
|
"timestamp",
|
|
953
1013
|
"title",
|
|
954
|
-
"user"
|
|
1014
|
+
"user",
|
|
1015
|
+
"rel"
|
|
955
1016
|
].join("|"),
|
|
956
1017
|
difftype: "table"
|
|
957
1018
|
};
|
|
@@ -963,12 +1024,12 @@ class j extends (Ce = G) {
|
|
|
963
1024
|
this.ctx.off("quick-edit/wiki-page", this.injectQuickEdit.bind(this));
|
|
964
1025
|
}
|
|
965
1026
|
injectHistoryPage() {
|
|
966
|
-
const e =
|
|
1027
|
+
const e = at("#mw-history-compare");
|
|
967
1028
|
if (!e)
|
|
968
1029
|
return;
|
|
969
|
-
|
|
1030
|
+
ct(".mw-history-compareselectedversions-button", e).forEach((i) => {
|
|
970
1031
|
i.after(
|
|
971
|
-
/* @__PURE__ */
|
|
1032
|
+
/* @__PURE__ */ a(
|
|
972
1033
|
"button",
|
|
973
1034
|
{
|
|
974
1035
|
className: "cdx-button",
|
|
@@ -1004,14 +1065,21 @@ class j extends (Ce = G) {
|
|
|
1004
1065
|
fromtitle: s,
|
|
1005
1066
|
fromtext: r,
|
|
1006
1067
|
totitle: s,
|
|
1007
|
-
totext: l
|
|
1068
|
+
totext: l,
|
|
1069
|
+
topst: !0
|
|
1008
1070
|
},
|
|
1009
|
-
i
|
|
1071
|
+
i,
|
|
1072
|
+
{
|
|
1073
|
+
backdrop: !1,
|
|
1074
|
+
draggable: !0
|
|
1075
|
+
}
|
|
1010
1076
|
), i);
|
|
1011
1077
|
}
|
|
1012
1078
|
},
|
|
1013
|
-
|
|
1014
|
-
)
|
|
1079
|
+
2
|
|
1080
|
+
), e.on(e.Event.Close, () => {
|
|
1081
|
+
i?.destroy(), i = void 0;
|
|
1082
|
+
});
|
|
1015
1083
|
}
|
|
1016
1084
|
simpleTextDiff(e, n) {
|
|
1017
1085
|
const i = this.ctx.modal.show({
|
|
@@ -1019,15 +1087,15 @@ class j extends (Ce = G) {
|
|
|
1019
1087
|
className: "in-page-edit ipe-quickDiff"
|
|
1020
1088
|
});
|
|
1021
1089
|
i.show();
|
|
1022
|
-
const s = /* @__PURE__ */
|
|
1090
|
+
const s = /* @__PURE__ */ a("pre", { className: rt["diff-container"] }), r = /* @__PURE__ */ a(
|
|
1023
1091
|
"div",
|
|
1024
1092
|
{
|
|
1025
1093
|
style: {
|
|
1026
1094
|
display: "flex",
|
|
1027
1095
|
gap: "1em"
|
|
1028
1096
|
},
|
|
1029
|
-
children: this.VALID_DIFF_TYPES.map((l, o) => /* @__PURE__ */
|
|
1030
|
-
|
|
1097
|
+
children: this.VALID_DIFF_TYPES.map((l, o) => /* @__PURE__ */ a(
|
|
1098
|
+
_e,
|
|
1031
1099
|
{
|
|
1032
1100
|
name: "diffType",
|
|
1033
1101
|
value: l,
|
|
@@ -1040,7 +1108,7 @@ class j extends (Ce = G) {
|
|
|
1040
1108
|
}
|
|
1041
1109
|
);
|
|
1042
1110
|
i.setContent(
|
|
1043
|
-
/* @__PURE__ */
|
|
1111
|
+
/* @__PURE__ */ a("section", { children: [
|
|
1044
1112
|
r,
|
|
1045
1113
|
s
|
|
1046
1114
|
] })
|
|
@@ -1085,56 +1153,104 @@ class j extends (Ce = G) {
|
|
|
1085
1153
|
}
|
|
1086
1154
|
return s;
|
|
1087
1155
|
}
|
|
1088
|
-
comparePages(e, n) {
|
|
1089
|
-
return
|
|
1156
|
+
comparePages(e, n, i) {
|
|
1157
|
+
return !n || n.isDestroyed ? n = this.ctx.modal.createObject({
|
|
1090
1158
|
title: "Loading diff...",
|
|
1091
1159
|
content: "",
|
|
1092
1160
|
className: "quick-diff",
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
}).init()
|
|
1161
|
+
center: !1,
|
|
1162
|
+
...i
|
|
1163
|
+
}).init() : n.removeButton("*"), n.setContent(
|
|
1164
|
+
/* @__PURE__ */ a(
|
|
1165
|
+
"section",
|
|
1166
|
+
{
|
|
1167
|
+
style: { height: "70vh", display: "flex", justifyContent: "center", alignItems: "center" },
|
|
1168
|
+
children: /* @__PURE__ */ a(Ne, {})
|
|
1169
|
+
}
|
|
1170
|
+
)
|
|
1171
|
+
), n.bringToFront(), window.mw && mw.loader.getState("mediawiki.diff.styles") !== "ready" && mw.loader.load(["mediawiki.diff.styles"]), this.ctx.api.post({
|
|
1096
1172
|
...this.COMPARE_API_DEFAULT_OPTIONS,
|
|
1097
1173
|
...e,
|
|
1098
1174
|
action: "compare",
|
|
1099
1175
|
format: "json",
|
|
1100
1176
|
formatversion: 2
|
|
1101
|
-
}).then((
|
|
1102
|
-
if (
|
|
1103
|
-
const
|
|
1177
|
+
}).then((s) => {
|
|
1178
|
+
if (s.data?.error || s.data?.errors) {
|
|
1179
|
+
const o = [s.data?.error, ...s.data?.errors || []].filter(
|
|
1104
1180
|
Boolean
|
|
1105
1181
|
);
|
|
1106
|
-
throw new Error(
|
|
1107
|
-
`), { cause:
|
|
1182
|
+
throw new Error(o.map((f) => f.info).join(`
|
|
1183
|
+
`), { cause: s });
|
|
1108
1184
|
}
|
|
1109
|
-
if (!
|
|
1110
|
-
throw new Error("No compare data received", { cause:
|
|
1185
|
+
if (!s.data.compare)
|
|
1186
|
+
throw new Error("No compare data received", { cause: s });
|
|
1111
1187
|
const {
|
|
1112
|
-
data: { compare:
|
|
1113
|
-
} =
|
|
1188
|
+
data: { compare: r }
|
|
1189
|
+
} = s;
|
|
1114
1190
|
n.setTitle(
|
|
1115
|
-
|
|
1116
|
-
), n.setContent(
|
|
1117
|
-
/* @__PURE__ */ m("section", { children: /* @__PURE__ */ m(st, { data: s }) })
|
|
1191
|
+
r.fromtitle && r.totitle ? `${r.fromtitle}${r.fromrevid ? ` (${r.fromrevid})` : ""} ⇔ ${r.totitle}${r.torevid ? ` (${r.torevid})` : ""}` : "Differences"
|
|
1118
1192
|
);
|
|
1119
|
-
|
|
1193
|
+
let l;
|
|
1194
|
+
n.setContent(
|
|
1195
|
+
/* @__PURE__ */ a(
|
|
1196
|
+
"section",
|
|
1197
|
+
{
|
|
1198
|
+
style: {
|
|
1199
|
+
minHeight: "70vh"
|
|
1200
|
+
},
|
|
1201
|
+
children: /* @__PURE__ */ a(ft, { ref: (o) => l = o, data: r, ctx: this.ctx })
|
|
1202
|
+
}
|
|
1203
|
+
)
|
|
1204
|
+
), l.addEventListener(
|
|
1205
|
+
T.update,
|
|
1206
|
+
(o) => {
|
|
1207
|
+
o.stopPropagation(), this.comparePages(
|
|
1208
|
+
{
|
|
1209
|
+
fromrev: o.detail.fromrev,
|
|
1210
|
+
torev: o.detail.torev
|
|
1211
|
+
},
|
|
1212
|
+
n,
|
|
1213
|
+
i
|
|
1214
|
+
);
|
|
1215
|
+
},
|
|
1216
|
+
{ once: !0 }
|
|
1217
|
+
), this.ctx.inject(["quickEdit"], (o) => {
|
|
1218
|
+
const f = (h) => {
|
|
1219
|
+
h.stopPropagation(), o.quickEdit({ revision: h.detail.revid });
|
|
1220
|
+
};
|
|
1221
|
+
l.addEventListener(T.edit, f), n.on(n.Event.Close, () => {
|
|
1222
|
+
l.removeEventListener(T.edit, f);
|
|
1223
|
+
});
|
|
1224
|
+
}), r.fromrevid && r.torevid && n.addButton({
|
|
1225
|
+
label: "Original Compare Page",
|
|
1226
|
+
side: "right",
|
|
1227
|
+
className: "btn btn-secondary",
|
|
1228
|
+
method: () => {
|
|
1229
|
+
window.location.href = this.ctx.getUrl("", {
|
|
1230
|
+
oldid: r.fromrevid,
|
|
1231
|
+
diff: r.torevid
|
|
1232
|
+
});
|
|
1233
|
+
}
|
|
1234
|
+
});
|
|
1235
|
+
}).catch((s) => {
|
|
1120
1236
|
n.setContent(
|
|
1121
|
-
/* @__PURE__ */
|
|
1237
|
+
/* @__PURE__ */ a(Oe, { title: "Failed to load diff", type: "error", children: /* @__PURE__ */ a("pre", { children: s instanceof Error ? s.message : String(s) }) })
|
|
1122
1238
|
);
|
|
1123
1239
|
}), n.show();
|
|
1124
1240
|
}
|
|
1125
1241
|
}
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
class
|
|
1242
|
+
B = gt(be);
|
|
1243
|
+
I = xt(B, 0, "PluginQuickDiffCore", Ce, I);
|
|
1244
|
+
yt(B, 1, I);
|
|
1245
|
+
class St extends K {
|
|
1130
1246
|
constructor(e) {
|
|
1131
|
-
super(e, {}, "quick-diff-loader"), this.ctx = e, e.plugin(
|
|
1247
|
+
super(e, {}, "quick-diff-loader"), this.ctx = e, e.plugin(it), e.plugin(I);
|
|
1132
1248
|
}
|
|
1133
1249
|
static {
|
|
1134
1250
|
this.inject = ["api", "wikiPage", "modal"];
|
|
1135
1251
|
}
|
|
1136
1252
|
}
|
|
1137
1253
|
export {
|
|
1138
|
-
|
|
1254
|
+
St as PluginQuickDiff
|
|
1139
1255
|
};
|
|
1140
|
-
//# sourceMappingURL=index-
|
|
1256
|
+
//# sourceMappingURL=index-1JtE4urY.js.map
|