@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.
Files changed (77) hide show
  1. package/dist/CheckBox-D3rHnX7I.js +13 -0
  2. package/dist/CheckBox-D3rHnX7I.js.map +1 -0
  3. package/dist/IconQuickEdit-YVn1ANbm.js +27 -0
  4. package/dist/IconQuickEdit-YVn1ANbm.js.map +1 -0
  5. package/dist/InPageEdit.d.ts +7 -5
  6. package/dist/InputBox-BV4m05Xs.js +22 -0
  7. package/dist/InputBox-BV4m05Xs.js.map +1 -0
  8. package/dist/RadioBox-nJqWsxW2.js +13 -0
  9. package/dist/RadioBox-nJqWsxW2.js.map +1 -0
  10. package/dist/__test__/utils/constants.d.ts +2 -0
  11. package/dist/components/Icon/IconEdit.d.ts +2 -0
  12. package/dist/components/Icon/IconQuickEdit.d.ts +2 -0
  13. package/dist/components/MwUserLinks.d.ts +2 -0
  14. package/dist/components/index.js +13 -11
  15. package/dist/components/index.js.map +1 -1
  16. package/dist/{index-i-Uf0vuA.js → index-1JtE4urY.js} +490 -374
  17. package/dist/{index-i-Uf0vuA.js.map → index-1JtE4urY.js.map} +1 -1
  18. package/dist/{index-UyiZ7umI.js → index-2AEdgbUL.js} +4 -4
  19. package/dist/index-2AEdgbUL.js.map +1 -0
  20. package/dist/index-2kN4SKmT.js +116 -0
  21. package/dist/index-2kN4SKmT.js.map +1 -0
  22. package/dist/{index-BSjnoNn2.js → index-B3Bsg_nE.js} +5 -3
  23. package/dist/index-B3Bsg_nE.js.map +1 -0
  24. package/dist/index-BCMwmSfQ.js +295 -0
  25. package/dist/index-BCMwmSfQ.js.map +1 -0
  26. package/dist/{index-BedbUMp8.js → index-C0ci6Ll1.js} +14 -12
  27. package/dist/index-C0ci6Ll1.js.map +1 -0
  28. package/dist/index-CZnu6cRK.js +319 -0
  29. package/dist/index-CZnu6cRK.js.map +1 -0
  30. package/dist/{index-xJ2bdsOD.js → index-CheNjwas.js} +5 -5
  31. package/dist/{index-xJ2bdsOD.js.map → index-CheNjwas.js.map} +1 -1
  32. package/dist/{index-DtOC8Ck-.js → index-CrWxZ0yl.js} +66 -63
  33. package/dist/{index-DtOC8Ck-.js.map → index-CrWxZ0yl.js.map} +1 -1
  34. package/dist/{index-DNQjqBV-.js → index-DqfQ7hp6.js} +3359 -3037
  35. package/dist/index-DqfQ7hp6.js.map +1 -0
  36. package/dist/index-lZkYoUca.js +46 -0
  37. package/dist/index-lZkYoUca.js.map +1 -0
  38. package/dist/index-sfkutNHj.js +201 -0
  39. package/dist/index-sfkutNHj.js.map +1 -0
  40. package/dist/index.js +1 -1
  41. package/dist/makeCallable-LDU0xZMJ.js +40 -0
  42. package/dist/makeCallable-LDU0xZMJ.js.map +1 -0
  43. package/dist/models/WikiPage/index.d.ts +2 -2
  44. package/dist/models/WikiTitle/index.d.ts +87 -11
  45. package/dist/models/WikiTitle/index.spec.d.ts +1 -0
  46. package/dist/noop-ClDc6zv4.js +6 -0
  47. package/dist/noop-ClDc6zv4.js.map +1 -0
  48. package/dist/plugins/in-article-links/index.d.ts +33 -7
  49. package/dist/plugins/quick-delete/index.d.ts +47 -0
  50. package/dist/plugins/quick-diff/PluginQuickDiffCore.d.ts +4 -2
  51. package/dist/plugins/quick-diff/components/DiffTable.d.ts +17 -0
  52. package/dist/plugins/quick-preview/index.d.ts +6 -3
  53. package/dist/services/ApiService.d.ts +2 -2
  54. package/dist/services/ModalService/IPEModal.d.ts +1 -1
  55. package/dist/services/SiteMetadataService.d.ts +43 -4
  56. package/dist/services/WikiPageService.d.ts +2 -2
  57. package/dist/services/WikiTitleService.d.ts +14 -0
  58. package/dist/style.css +1 -1
  59. package/dist/types/SiteMetadata.d.ts +1 -1
  60. package/dist/utils/url.d.ts +24 -0
  61. package/lib/index.umd.js +28 -28
  62. package/lib/index.umd.js.map +1 -1
  63. package/lib/style.css +1 -1
  64. package/package.json +10 -1
  65. package/dist/InputBox-FIzJ-rPN.js +0 -30
  66. package/dist/InputBox-FIzJ-rPN.js.map +0 -1
  67. package/dist/RadioBox-CaA8VgLu.js +0 -54
  68. package/dist/RadioBox-CaA8VgLu.js.map +0 -1
  69. package/dist/index-BSjnoNn2.js.map +0 -1
  70. package/dist/index-BedbUMp8.js.map +0 -1
  71. package/dist/index-DNQjqBV-.js.map +0 -1
  72. package/dist/index-UyiZ7umI.js.map +0 -1
  73. package/dist/index-e7eyr1FL.js +0 -96
  74. package/dist/index-e7eyr1FL.js.map +0 -1
  75. package/dist/index-rMDuLpcz.js +0 -458
  76. package/dist/index-rMDuLpcz.js.map +0 -1
  77. package/dist/plugins/quick-edit/PluginQuickEditInArticleLinks.d.ts +0 -14
@@ -1,8 +1,10 @@
1
- import { j as m, F as be, P as Se } from "./index-CvhkVj_L.js";
2
- import { B as G, a as Ne, S as E } from "./index-DNQjqBV-.js";
3
- import { R as Pe } from "./Preferences-Bg3J5Ur9.js";
4
- import { R as Ee, M as We } from "./RadioBox-CaA8VgLu.js";
5
- class S {
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 = (u) => {
15
- if (u = this.postProcess(u, i), s) {
16
+ const l = (d) => {
17
+ if (d = this.postProcess(d, i), s) {
16
18
  setTimeout(function() {
17
- s(u);
19
+ s(d);
18
20
  }, 0);
19
21
  return;
20
22
  } else
21
- return u;
23
+ return d;
22
24
  }, o = n.length, f = e.length;
23
- let g = 1, a = o + f;
24
- i.maxEditLength != null && (a = Math.min(a, i.maxEditLength));
25
- const h = (r = i.timeout) !== null && r !== void 0 ? r : 1 / 0, y = Date.now() + h, v = [{ oldPos: -1, lastComponent: void 0 }];
26
- let d = this.extractCommon(v[0], n, e, 0, i);
27
- if (v[0].oldPos + 1 >= f && d + 1 >= o)
28
- return l(this.buildValues(v[0].lastComponent, n, e));
29
- let p = -1 / 0, x = 1 / 0;
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 u = Math.max(p, -g); u <= Math.min(x, g); u += 2) {
32
- let c;
33
- const w = v[u - 1], k = v[u + 1];
34
- w && (v[u - 1] = void 0);
35
- let b = !1;
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 - u;
38
- b = k && 0 <= N && N < o;
39
+ const N = k.oldPos - d;
40
+ D = k && 0 <= N && N < o;
39
41
  }
40
- const D = w && w.oldPos + 1 < f;
41
- if (!b && !D) {
42
- v[u] = void 0;
42
+ const b = p && p.oldPos + 1 < f;
43
+ if (!D && !b) {
44
+ w[d] = void 0;
43
45
  continue;
44
46
  }
45
- if (!D || b && w.oldPos < k.oldPos ? c = this.addToPath(k, !0, !1, 0, i) : c = this.addToPath(w, !1, !0, 1, i), d = this.extractCommon(c, n, e, u, i), c.oldPos + 1 >= f && d + 1 >= o)
46
- return l(this.buildValues(c.lastComponent, n, e)) || !0;
47
- v[u] = c, c.oldPos + 1 >= f && (x = Math.min(x, u - 1)), d + 1 >= o && (p = Math.max(p, u + 1));
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
- g++;
51
+ h++;
50
52
  };
51
53
  if (s)
52
- (function u() {
54
+ (function d() {
53
55
  setTimeout(function() {
54
- if (g > a || Date.now() > y)
56
+ if (h > c || Date.now() > y)
55
57
  return s(void 0);
56
- C() || u();
58
+ C() || d();
57
59
  }, 0);
58
60
  })();
59
61
  else
60
- for (; g <= a && Date.now() <= y; ) {
61
- const u = C();
62
- if (u)
63
- return u;
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, g = f - s, a = 0;
79
- for (; g + 1 < l && f + 1 < o && this.equals(i[f + 1], n[g + 1], r); )
80
- g++, f++, a++, r.oneChangePerToken && (e.lastComponent = { count: 1, previousComponent: e.lastComponent, added: !1, removed: !1 });
81
- return a && !r.oneChangePerToken && (e.lastComponent = { count: a, previousComponent: e.lastComponent, added: !1, removed: !1 }), e.oldPos = f, g;
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, g = 0;
118
+ let o = 0, f = 0, h = 0;
117
119
  for (; o < l; o++) {
118
- const a = s[o];
119
- if (a.removed)
120
- a.value = this.join(i.slice(g, g + a.count)), g += a.count;
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 (!a.added && this.useLongestToken) {
123
- let h = n.slice(f, f + a.count);
124
- h = h.map(function(y, v) {
125
- const d = i[g + v];
126
- return d.length > y.length ? d : y;
127
- }), a.value = this.join(h);
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
- a.value = this.join(n.slice(f, f + a.count));
130
- f += a.count, a.added || (g += a.count);
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 _e extends S {
138
+ class Te extends E {
137
139
  }
138
- const K = new _e();
139
- function ee(t, e, n) {
140
- return K.diff(t, e, n);
140
+ const ee = new Te();
141
+ function te(t, e, n) {
142
+ return ee.diff(t, e, n);
141
143
  }
142
- function U(t, e) {
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 V(t, e) {
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 I(t, e, n) {
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 H(t, e, n) {
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 I(t, e, "");
173
+ return $(t, e, "");
172
174
  }
173
175
  function O(t, e) {
174
- return H(t, e, "");
176
+ return q(t, e, "");
175
177
  }
176
- function Y(t, e) {
177
- return e.slice(0, Oe(t, e));
178
+ function X(t, e) {
179
+ return e.slice(0, Le(t, e));
178
180
  }
179
- function Oe(t, e) {
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 Te(t) {
202
+ function Fe(t) {
201
203
  return t.includes(`\r
202
204
  `) && !t.startsWith(`
203
205
  `) && !t.match(/[^\r]\n/);
204
206
  }
205
- function Fe(t) {
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 P(t) {
218
+ function S(t) {
217
219
  const e = t.match(/^\s*/);
218
220
  return e ? e[0] : "";
219
221
  }
220
- const T = "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(`[${T}]+|\\s+|[^${T}]`, "ug");
221
- class Le extends S {
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) && X(i, r, s, l), i = l, s = null, r = null);
249
- }), (s || r) && X(i, r, s, null), e;
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 te = new Le();
253
- function ne(t, e, n) {
254
- return n?.ignoreWhitespace != null && !n.ignoreWhitespace ? $(t, e, n) : te.diff(t, e, n);
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 X(t, e, n, i) {
258
+ function Z(t, e, n, i) {
257
259
  if (e && n) {
258
- const s = P(e.value), r = _(e.value), l = P(n.value), o = _(n.value);
260
+ const s = S(e.value), r = _(e.value), l = S(n.value), o = _(n.value);
259
261
  if (t) {
260
- const f = U(s, l);
261
- t.value = H(t.value, l, f), e.value = W(e.value, f), n.value = W(n.value, f);
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 = V(r, o);
265
- i.value = I(i.value, o, f), e.value = O(e.value, f), n.value = O(n.value, f);
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 = P(n.value);
271
+ const s = S(n.value);
270
272
  n.value = n.value.substring(s.length);
271
273
  }
272
274
  if (i) {
273
- const s = P(i.value);
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 = P(i.value), r = P(e.value), l = _(e.value), o = U(s, r);
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 = V(W(s, o), l);
280
- e.value = O(e.value, f), i.value = I(i.value, s, f), t.value = H(t.value, s, s.slice(0, s.length - f.length));
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 = P(i.value), r = _(e.value), l = Y(r, 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 = P(e.value), l = Y(s, 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 je extends S {
291
+ class ze extends E {
290
292
  tokenize(e) {
291
- const n = new RegExp(`(\\r?\\n)|[${T}]+|[^\\S\\n\\r]+|[^${T}]`, "ug");
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 ie = new je();
296
- function $(t, e, n) {
297
- return ie.diff(t, e, n);
297
+ const re = new ze();
298
+ function M(t, e, n) {
299
+ return re.diff(t, e, n);
298
300
  }
299
- function ze(t, e) {
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 Ie extends S {
309
+ class qe extends E {
308
310
  constructor() {
309
- super(...arguments), this.tokenize = se;
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 M = new Ie();
321
+ const R = new qe();
320
322
  function F(t, e, n) {
321
- return M.diff(t, e, n);
323
+ return R.diff(t, e, n);
322
324
  }
323
- function re(t, e, n) {
324
- return n = ze(n, { ignoreWhitespace: !0 }), M.diff(t, e, n);
325
+ function se(t, e, n) {
326
+ return n = $e(n, { ignoreWhitespace: !0 }), R.diff(t, e, n);
325
327
  }
326
- function se(t, e) {
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 qe extends S {
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 le = new qe();
360
- function oe(t, e, n) {
361
- return le.diff(t, e, n);
361
+ const oe = new Me();
362
+ function fe(t, e, n) {
363
+ return oe.diff(t, e, n);
362
364
  }
363
- class $e extends S {
365
+ class Re extends E {
364
366
  tokenize(e) {
365
367
  return e.split(/([{}:;,]|\s+)/);
366
368
  }
367
369
  }
368
- const fe = new $e();
369
- function ae(t, e, n) {
370
- return fe.diff(t, e, n);
370
+ const ae = new Re();
371
+ function ce(t, e, n) {
372
+ return ae.diff(t, e, n);
371
373
  }
372
- class Me extends S {
374
+ class Je extends E {
373
375
  constructor() {
374
- super(...arguments), this.tokenize = se;
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(A(e, null, null, s), null, " ");
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 ce = new Me();
388
- function ue(t, e, n) {
389
- return ce.diff(t, e, n);
389
+ const ue = new Je();
390
+ function de(t, e, n) {
391
+ return ue.diff(t, e, n);
390
392
  }
391
- function A(t, e, n, i, s) {
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] = A(t[r], e, n, i, String(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] = A(t[f], e, n, i, 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 Re extends S {
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 de = new Re();
428
- function me(t, e, n) {
429
- return de.diff(t, e, n);
429
+ const me = new Ue();
430
+ function he(t, e, n) {
431
+ return me.diff(t, e, n);
430
432
  }
431
- function he(t) {
432
- return Array.isArray(t) ? t.map((e) => he(e)) : Object.assign(Object.assign({}, t), { hunks: t.hunks.map((e) => Object.assign(Object.assign({}, e), { lines: e.lines.map((n, i) => {
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 ge(t) {
438
- 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) => n.endsWith("\r") ? n.substring(0, n.length - 1) : n) })) });
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 Je(t) {
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 R(t) {
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 g = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(f);
459
- g && (o.index = g[1]), i++;
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 g = f[2].split(" ", 2), a = (g[1] || "").trim();
478
- let h = g[0].replace(/\\\\/g, "\\");
479
- /^".*"$/.test(h) && (h = h.substr(1, h.length - 2)), f[1] === "---" ? (o.oldFileName = h, o.oldHeader = a) : (o.newFileName = h, o.newHeader = a), i++;
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, g = e[i++], a = g.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/), h = {
485
- oldStart: +a[1],
486
- oldLines: typeof a[2] > "u" ? 1 : +a[2],
487
- newStart: +a[3],
488
- newLines: typeof a[4] > "u" ? 1 : +a[4],
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
- h.oldLines === 0 && (h.oldStart += 1), h.newLines === 0 && (h.newStart += 1);
492
- let y = 0, v = 0;
493
- for (; i < e.length && (v < h.oldLines || y < h.newLines || !((o = e[i]) === null || o === void 0) && o.startsWith("\\")); i++) {
494
- const d = e[i].length == 0 && i != e.length - 1 ? " " : e[i][0];
495
- if (d === "+" || d === "-" || d === " " || d === "\\")
496
- h.lines.push(e[i]), d === "+" ? y++ : d === "-" ? v++ : d === " " && (y++, v++);
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 && h.newLines === 1 && (h.newLines = 0), !v && h.oldLines === 1 && (h.oldLines = 0), y !== h.newLines)
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 (v !== h.oldLines)
504
+ if (w !== g.oldLines)
503
505
  throw new Error("Removed line count did not match for hunk at line " + (f + 1));
504
- return h;
506
+ return g;
505
507
  }
506
508
  for (; i < e.length; )
507
509
  s();
508
510
  return n;
509
511
  }
510
- function Qe(t, e, n) {
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 = R(e) : Array.isArray(e) ? i = e : i = [e], i.length > 1)
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 Ue(t, i[0], n);
528
+ return Ye(t, i[0], n);
527
529
  }
528
- function Ue(t, e, n = {}) {
529
- (n.autoConvertLineEndings || n.autoConvertLineEndings == null) && (Te(t) && Je(e) ? e = he(e) : Fe(t) && Be(e) && (e = ge(e)));
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 || ((d, p, x, C) => p === C), l = n.fuzzFactor || 0;
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 = "", g = !1, a = !1;
538
- for (let d = 0; d < s[s.length - 1].lines.length; d++) {
539
- const p = s[s.length - 1].lines[d];
540
- p[0] == "\\" && (f[0] == "+" ? g = !0 : f[0] == "-" && (a = !0)), f = p;
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 (g) {
543
- if (a) {
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 (a) {
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 h(d, p, x, C = 0, u = !0, c = [], w = 0) {
557
- let k = 0, b = !1;
558
- for (; C < d.length; C++) {
559
- const D = d[C], N = D.length > 0 ? D[0] : " ", z = D.length > 0 ? D.substr(1) : D;
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(p + 1, i[p], N, z))
562
- p++, k = 0;
563
+ if (r(v + 1, i[v], N, z))
564
+ v++, k = 0;
563
565
  else
564
- return !x || i[p] == null ? null : (c[w] = i[p], h(d, p + 1, x - 1, C, !1, c, w + 1));
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 (!u)
568
+ if (!d)
567
569
  return null;
568
- c[w] = z, w++, k = 0, b = !0;
570
+ u[p] = z, p++, k = 0, D = !0;
569
571
  }
570
572
  if (N === " ")
571
- if (k++, c[w] = i[p], r(p + 1, i[p], N, z))
572
- w++, u = !0, b = !1, p++;
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 b || !x ? null : i[p] && (h(d, p + 1, x - 1, C + 1, !1, c, w + 1) || h(d, p + 1, x - 1, C, !1, c, w + 1)) || h(d, p, x - 1, C + 1, !1, c, w);
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 w -= k, p -= k, c.length = w, {
577
- patchedLines: c,
578
- oldLineLastI: p - 1
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 v = 0;
583
- for (let d = 0; d < s.length; d++) {
584
- const p = s[d];
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 - p.oldLines + l;
587
- let u;
588
- for (let c = 0; c <= l; c++) {
589
- u = p.oldStart + v - 1;
590
- const w = Qe(u, o, C);
591
- for (; u !== void 0 && (x = h(p.lines, u, c), !x); u = w())
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 c = o; c < u; c++)
599
- y.push(i[c]);
600
- for (let c = 0; c < x.patchedLines.length; c++) {
601
- const w = x.patchedLines[c];
602
- y.push(w);
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, v = u + 1 - p.oldStart;
606
+ o = x.oldLineLastI + 1, w = d + 1 - v.oldStart;
605
607
  }
606
- for (let d = o; d < i.length; d++)
607
- y.push(i[d]);
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 Ve(t, e) {
612
- const n = typeof t == "string" ? R(t) : t;
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(g) {
623
- if (g)
624
- return e.complete(g);
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 q(t, e, n, i, s, r, l) {
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: a } = o;
648
- F(n, i, Object.assign(Object.assign({}, o), { callback: (h) => {
649
- const y = g(h);
650
- a(y);
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 g(F(n, i, o));
654
- function g(a) {
655
- if (!a)
655
+ return h(F(n, i, o));
656
+ function h(c) {
657
+ if (!c)
656
658
  return;
657
- a.push({ value: "", lines: [] });
658
- function h(u) {
659
- return u.map(function(c) {
660
- return " " + c;
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 v = 0, d = 0, p = [], x = 1, C = 1;
665
- for (let u = 0; u < a.length; u++) {
666
- const c = a[u], w = c.lines || Xe(c.value);
667
- if (c.lines = w, c.added || c.removed) {
668
- if (!v) {
669
- const k = a[u - 1];
670
- v = x, d = C, k && (p = f > 0 ? h(k.lines.slice(-f)) : [], v -= p.length, d -= p.length);
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 w)
673
- p.push((c.added ? "+" : "-") + k);
674
- c.added ? C += w.length : x += w.length;
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 (v)
677
- if (w.length <= f * 2 && u < a.length - 2)
678
- for (const k of h(w))
679
- p.push(k);
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(w.length, f);
682
- for (const D of h(w.slice(0, k)))
683
- p.push(D);
684
- const b = {
685
- oldStart: v,
686
- oldLines: x - v + k,
687
- newStart: d,
688
- newLines: C - d + k,
689
- lines: p
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(b), v = 0, d = 0, p = [];
693
+ y.push(D), w = 0, m = 0, v = [];
692
694
  }
693
- x += w.length, C += w.length;
695
+ x += p.length, C += p.length;
694
696
  }
695
697
  }
696
- for (const u of y)
697
- for (let c = 0; c < u.lines.length; c++)
698
- u.lines[c].endsWith(`
699
- `) ? u.lines[c] = u.lines[c].slice(0, -1) : (u.lines.splice(c + 1, 0, "\"), c++);
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 L(t) {
711
+ function A(t) {
710
712
  if (Array.isArray(t))
711
- return t.map(L).join(`
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 J(t, e, n, i, s, r, l) {
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
- q(t, e, n, i, s, r, Object.assign(Object.assign({}, l), { callback: (f) => {
729
- o(f ? L(f) : void 0);
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 = q(t, e, n, i, s, r, l);
733
- return o ? L(o) : void 0;
734
+ const o = H(t, e, n, i, s, r, l);
735
+ return o ? A(o) : void 0;
734
736
  }
735
737
  }
736
- function Ye(t, e, n, i, s, r) {
737
- return J(t, t, e, n, i, s, r);
738
+ function Ze(t, e, n, i, s, r) {
739
+ return U(t, t, e, n, i, s, r);
738
740
  }
739
- function Xe(t) {
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 Ze(t) {
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 Ge(t) {
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(Ke(i.value)), i.added ? e.push("</ins>") : i.removed && e.push("</del>");
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 Ke(t) {
763
+ function tt(t) {
762
764
  let e = t;
763
765
  return e = e.replace(/&/g, "&amp;"), e = e.replace(/</g, "&lt;"), e = e.replace(/>/g, "&gt;"), e = e.replace(/"/g, "&quot;"), e;
764
766
  }
765
- const et = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
767
+ const nt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
766
768
  __proto__: null,
767
- Diff: S,
769
+ Diff: E,
768
770
  applyPatch: pe,
769
- applyPatches: Ve,
770
- arrayDiff: de,
771
- canonicalize: A,
772
- characterDiff: K,
773
- convertChangesToDMP: Ze,
774
- convertChangesToXML: Ge,
775
- createPatch: Ye,
776
- createTwoFilesPatch: J,
777
- cssDiff: fe,
778
- diffArrays: me,
779
- diffChars: ee,
780
- diffCss: ae,
781
- diffJson: ue,
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: oe,
784
- diffTrimmedLines: re,
785
- diffWords: ne,
786
- diffWordsWithSpace: $,
787
- formatPatch: L,
788
- jsonDiff: ce,
789
- lineDiff: M,
790
- parsePatch: R,
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: le,
793
- structuredPatch: q,
794
- wordDiff: te,
795
- wordsWithSpaceDiff: ie
794
+ sentenceDiff: oe,
795
+ structuredPatch: H,
796
+ wordDiff: ne,
797
+ wordsWithSpaceDiff: re
796
798
  }, Symbol.toStringTag, { value: "Module" }));
797
- class tt {
799
+ class it {
798
800
  constructor(e) {
799
- this.ctx = e, this.JsDiff = et, this.diffChars = ee, this.diffWords = ne, this.diffWordsWithSpace = $, this.diffLines = F, this.diffTrimmedLines = re, this.diffSentences = oe, this.diffCss = ae, this.diffJson = ue, this.diffArrays = me, this.createTwoFilesPatch = J, this.ctx.set("jsdiff", this);
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 nt = {
804
+ const rt = {
803
805
  "diff-container": "_diff-container_lq0si_2"
804
- }, it = (t) => {
805
- let { user: e, target: n } = t;
806
- const i = window.mw?.config?.get("wgArticlePath") || "/$1", s = (r) => i.replace("$1", r);
807
- return /* @__PURE__ */ m("span", { className: "mw-userlinks", children: [
808
- /* @__PURE__ */ m("a", { href: s(`User:${e}`), className: "mw-userlink", target: n, children: e }),
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__ */ m("span", { className: "mw-usertoollinks", children: [
812
+ /* @__PURE__ */ a("span", { className: "mw-usertoollinks", children: [
811
813
  "(",
812
- /* @__PURE__ */ m("a", { href: s(`User_talk:${e}`), className: "mw-usertoollinks-talk", target: n, children: "talk" }),
814
+ /* @__PURE__ */ a("a", { href: s(`User_talk:${e}`), className: "mw-usertoollinks-talk", target: n, children: "talk" }),
813
815
  " | ",
814
- /* @__PURE__ */ m(
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__ */ m(
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
- }, rt = new Intl.DateTimeFormat(void 0, {
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, Z = (t) => {
843
+ }).format, G = (t) => {
840
844
  let e = ["diff-title"];
841
- return t.type === "from" ? e.push("diff-otitle") : t.type === "to" && e.push("diff-ntitle"), !t.pageid || !t.userid ? /* @__PURE__ */ m("td", { colSpan: 2, className: e, children: /* @__PURE__ */ m("div", { className: "mw-diff-title--title", children: t.type === "from" ? "Original content" : t.type === "to" ? "Your content" : "" }) }) : /* @__PURE__ */ m("td", { colSpan: 2, className: e, children: [
842
- /* @__PURE__ */ m("div", { className: "mw-diff-title--title", children: t.pagetitle || t.timestamp }),
843
- /* @__PURE__ */ m("div", { className: "mw-diff-title--user", children: t.username && /* @__PURE__ */ m(it, { user: t.username, target: "_blank" }) }),
844
- /* @__PURE__ */ m("div", { className: "mw-diff-title--timestamp", children: t.timestamp && rt(new Date(t.timestamp)) }),
845
- /* @__PURE__ */ m("div", { className: "mw-diff-title--comment", children: t.parsedcomment && /* @__PURE__ */ m(be, { children: [
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__ */ m("i", { innerHTML: t.parsedcomment }),
875
+ /* @__PURE__ */ a("i", { innerHTML: t.parsedcomment }),
848
876
  ")"
849
- ] }) }),
850
- /* @__PURE__ */ m("div", { className: "mw-diff-title--navigation" })
877
+ ] }) })
851
878
  ] });
852
- }, st = (t) => {
853
- const { data: e, ...n } = t, i = /* @__PURE__ */ m("table", { className: "theme-ipe diff diff-type-table", "data-mw": "interface", ...n, children: [
854
- /* @__PURE__ */ m("colgroup", { children: [
855
- /* @__PURE__ */ m("col", { className: "diff-marker" }),
856
- /* @__PURE__ */ m("col", { className: "diff-content" }),
857
- /* @__PURE__ */ m("col", { className: "diff-marker" }),
858
- /* @__PURE__ */ m("col", { className: "diff-content" })
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__ */ m("tbody", { children: [
861
- /* @__PURE__ */ m("tr", { children: [
862
- /* @__PURE__ */ m(
863
- Z,
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__ */ m(
878
- Z,
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__ */ m("div", { id: "diffbody" }),
894
- /* @__PURE__ */ m("tr", { className: "diff-size", style: { textAlign: "center" }, children: [
895
- /* @__PURE__ */ m("td", { colSpan: 2, className: "diff-size-old", children: e.fromsize !== void 0 && `${e.fromsize} bytes` }),
896
- /* @__PURE__ */ m("td", { colSpan: 2, className: "diff-size-new", children: e.tosize !== void 0 && `${e.tosize} bytes` })
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__ */ m("tr", { children: /* @__PURE__ */ m("td", { colSpan: 4, children: /* @__PURE__ */ m(
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__ */ m("i", { children: "No changes" })
969
+ children: /* @__PURE__ */ a("i", { children: "No changes" })
910
970
  }
911
971
  ) }) })).outerHTML, i;
912
- }, lt = (t, e = document) => e.querySelector(t), ot = (t, e = document) => e.querySelectorAll(t);
913
- var ft = Object.create, B = Object.defineProperty, at = Object.getOwnPropertyDescriptor, ve = (t, e) => (e = Symbol[t]) ? e : Symbol.for("Symbol." + t), ye = (t) => {
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
- }, ct = (t, e, n) => e in t ? B(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, ut = (t, e) => B(t, "name", { value: e, configurable: !0 }), dt = (t) => [, , , ft(t?.[ve("metadata")] ?? null)], mt = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], xe = (t) => t !== void 0 && typeof t != "function" ? ye("Function expected") : t, ht = (t, e, n, i, s) => ({ kind: mt[t], name: e, metadata: i, addInitializer: (r) => n._ ? ye("Already initialized") : s.push(xe(r || null)) }), gt = (t, e) => ct(e, ve("metadata"), t[3]), pt = (t, e, n, i) => {
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
- }, wt = (t, e, n, i, s, r) => {
919
- var l, o, f, g = e & 7, a = !1, h = 0, y = t[h] || (t[h] = []), v = g && (s = s.prototype, g < 5 && (g > 3 || !a) && at(s, n));
920
- ut(s, n);
921
- for (var d = i.length - 1; d >= 0; d--)
922
- f = ht(g, n, o = {}, t[3], y), l = (0, i[d])(s, f), o._ = 1, xe(l) && (s = l);
923
- return gt(t, s), v && B(s, n, v), a ? g ^ 4 ? r : v : s;
924
- }, ke, Q, Ce;
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
- ke = [Ne(["jsdiff"]), Pe(
933
- E.object({
934
- "quickDiff.preferredCompareMode": E.union([E.const("jsDiff"), E.const("mwApi")]).description("The preferred comparison mode for quick diff").default("mwApi"),
935
- "quickDiff.jsDiff.defaultType": E.union(De.map((t) => E.const(t))).description("The default diff type for JsDiff").default("diffSentences")
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 j extends (Ce = G) {
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 = lt("#mw-history-compare");
1027
+ const e = at("#mw-history-compare");
967
1028
  if (!e)
968
1029
  return;
969
- ot(".mw-history-compareselectedversions-button", e).forEach((i) => {
1030
+ ct(".mw-history-compareselectedversions-button", e).forEach((i) => {
970
1031
  i.after(
971
- /* @__PURE__ */ m(
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
- 1
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__ */ m("pre", { className: nt["diff-container"] }), r = /* @__PURE__ */ m(
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__ */ m(
1030
- Ee,
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__ */ m("section", { children: [
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 (!n || n.isDestroyed) && (n = this.ctx.modal.createObject({
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
- backdrop: !1,
1094
- draggable: !0
1095
- }).init()), n.setContent(/* @__PURE__ */ m(Se, {})), n.bringToFront(), window.mw && mw.loader.getState("mediawiki.diff.styles") !== "ready" && mw.loader.load(["mediawiki.diff.styles"]), this.ctx.api.post({
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((i) => {
1102
- if (i.data?.error || i.data?.errors) {
1103
- const r = [i.data?.error, ...i.data?.errors || []].filter(
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(r.map((l) => l.info).join(`
1107
- `), { cause: i });
1182
+ throw new Error(o.map((f) => f.info).join(`
1183
+ `), { cause: s });
1108
1184
  }
1109
- if (!i.data.compare)
1110
- throw new Error("No compare data received", { cause: i });
1185
+ if (!s.data.compare)
1186
+ throw new Error("No compare data received", { cause: s });
1111
1187
  const {
1112
- data: { compare: s }
1113
- } = i;
1188
+ data: { compare: r }
1189
+ } = s;
1114
1190
  n.setTitle(
1115
- s.fromtitle && s.totitle ? `${s.fromtitle} ⇔ ${s.totitle}` : "Differences"
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
- }).catch((i) => {
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__ */ m(We, { title: "Failed to load diff", type: "error", children: /* @__PURE__ */ m("pre", { children: i instanceof Error ? i.message : String(i) }) })
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
- Q = dt(Ce);
1127
- j = wt(Q, 0, "PluginQuickDiffCore", ke, j);
1128
- pt(Q, 1, j);
1129
- class Ct extends G {
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(tt), e.plugin(j);
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
- Ct as PluginQuickDiff
1254
+ St as PluginQuickDiff
1139
1255
  };
1140
- //# sourceMappingURL=index-i-Uf0vuA.js.map
1256
+ //# sourceMappingURL=index-1JtE4urY.js.map