react-monaco-json-merge 1.1.16 → 1.2.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/components/editor.d.ts.map +1 -1
- package/dist/index.cjs +30 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +1041 -998
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/index.d.ts +7 -1
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
function
|
|
1
|
+
import { jsx as ht, Fragment as In } from "react/jsx-runtime";
|
|
2
|
+
import { useState as Pe, useRef as ae, useCallback as Te, useEffect as Se } from "react";
|
|
3
|
+
function Zt(e, t) {
|
|
4
4
|
(t == null || t > e.length) && (t = e.length);
|
|
5
5
|
for (var r = 0, n = Array(t); r < t; r++) n[r] = e[r];
|
|
6
6
|
return n;
|
|
7
7
|
}
|
|
8
|
-
function
|
|
8
|
+
function Ln(e) {
|
|
9
9
|
if (Array.isArray(e)) return e;
|
|
10
10
|
}
|
|
11
|
-
function
|
|
12
|
-
return (t =
|
|
11
|
+
function Sn(e, t, r) {
|
|
12
|
+
return (t = xn(t)) in e ? Object.defineProperty(e, t, {
|
|
13
13
|
value: r,
|
|
14
14
|
enumerable: !0,
|
|
15
15
|
configurable: !0,
|
|
16
16
|
writable: !0
|
|
17
17
|
}) : e[t] = r, e;
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function kn(e, t) {
|
|
20
20
|
var r = e == null ? null : typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
|
|
21
21
|
if (r != null) {
|
|
22
22
|
var n, o, i, s, c = [], a = !0, u = !1;
|
|
@@ -34,11 +34,11 @@ function Nn(e, t) {
|
|
|
34
34
|
return c;
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function _n() {
|
|
38
38
|
throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
39
39
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function Kt(e, t) {
|
|
42
42
|
var r = Object.keys(e);
|
|
43
43
|
if (Object.getOwnPropertySymbols) {
|
|
44
44
|
var n = Object.getOwnPropertySymbols(e);
|
|
@@ -48,27 +48,27 @@ function qt(e, t) {
|
|
|
48
48
|
}
|
|
49
49
|
return r;
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function en(e) {
|
|
52
52
|
for (var t = 1; t < arguments.length; t++) {
|
|
53
53
|
var r = arguments[t] != null ? arguments[t] : {};
|
|
54
|
-
t % 2 ?
|
|
55
|
-
|
|
56
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) :
|
|
54
|
+
t % 2 ? Kt(Object(r), !0).forEach(function(n) {
|
|
55
|
+
Sn(e, n, r[n]);
|
|
56
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : Kt(Object(r)).forEach(function(n) {
|
|
57
57
|
Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
60
|
return e;
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function Pn(e, t) {
|
|
63
63
|
if (e == null) return {};
|
|
64
|
-
var r, n, o =
|
|
64
|
+
var r, n, o = jn(e, t);
|
|
65
65
|
if (Object.getOwnPropertySymbols) {
|
|
66
66
|
var i = Object.getOwnPropertySymbols(e);
|
|
67
67
|
for (n = 0; n < i.length; n++) r = i[n], t.indexOf(r) === -1 && {}.propertyIsEnumerable.call(e, r) && (o[r] = e[r]);
|
|
68
68
|
}
|
|
69
69
|
return o;
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function jn(e, t) {
|
|
72
72
|
if (e == null) return {};
|
|
73
73
|
var r = {};
|
|
74
74
|
for (var n in e) if ({}.hasOwnProperty.call(e, n)) {
|
|
@@ -77,10 +77,10 @@ function In(e, t) {
|
|
|
77
77
|
}
|
|
78
78
|
return r;
|
|
79
79
|
}
|
|
80
|
-
function
|
|
81
|
-
return
|
|
80
|
+
function Rn(e, t) {
|
|
81
|
+
return Ln(e) || kn(e, t) || Mn(e, t) || _n();
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function Dn(e, t) {
|
|
84
84
|
if (typeof e != "object" || !e) return e;
|
|
85
85
|
var r = e[Symbol.toPrimitive];
|
|
86
86
|
if (r !== void 0) {
|
|
@@ -90,18 +90,18 @@ function Sn(e, t) {
|
|
|
90
90
|
}
|
|
91
91
|
return (t === "string" ? String : Number)(e);
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
var t =
|
|
93
|
+
function xn(e) {
|
|
94
|
+
var t = Dn(e, "string");
|
|
95
95
|
return typeof t == "symbol" ? t : t + "";
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function Mn(e, t) {
|
|
98
98
|
if (e) {
|
|
99
|
-
if (typeof e == "string") return
|
|
99
|
+
if (typeof e == "string") return Zt(e, t);
|
|
100
100
|
var r = {}.toString.call(e).slice(8, -1);
|
|
101
|
-
return r === "Object" && e.constructor && (r = e.constructor.name), r === "Map" || r === "Set" ? Array.from(e) : r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ?
|
|
101
|
+
return r === "Object" && e.constructor && (r = e.constructor.name), r === "Map" || r === "Set" ? Array.from(e) : r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? Zt(e, t) : void 0;
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
-
function
|
|
104
|
+
function $n(e, t, r) {
|
|
105
105
|
return t in e ? Object.defineProperty(e, t, {
|
|
106
106
|
value: r,
|
|
107
107
|
enumerable: !0,
|
|
@@ -109,7 +109,7 @@ function Pn(e, t, r) {
|
|
|
109
109
|
writable: !0
|
|
110
110
|
}) : e[t] = r, e;
|
|
111
111
|
}
|
|
112
|
-
function
|
|
112
|
+
function tn(e, t) {
|
|
113
113
|
var r = Object.keys(e);
|
|
114
114
|
if (Object.getOwnPropertySymbols) {
|
|
115
115
|
var n = Object.getOwnPropertySymbols(e);
|
|
@@ -119,18 +119,18 @@ function zt(e, t) {
|
|
|
119
119
|
}
|
|
120
120
|
return r;
|
|
121
121
|
}
|
|
122
|
-
function
|
|
122
|
+
function nn(e) {
|
|
123
123
|
for (var t = 1; t < arguments.length; t++) {
|
|
124
124
|
var r = arguments[t] != null ? arguments[t] : {};
|
|
125
|
-
t % 2 ?
|
|
126
|
-
|
|
127
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) :
|
|
125
|
+
t % 2 ? tn(Object(r), !0).forEach(function(n) {
|
|
126
|
+
$n(e, n, r[n]);
|
|
127
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : tn(Object(r)).forEach(function(n) {
|
|
128
128
|
Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
|
|
129
129
|
});
|
|
130
130
|
}
|
|
131
131
|
return e;
|
|
132
132
|
}
|
|
133
|
-
function
|
|
133
|
+
function Bn() {
|
|
134
134
|
for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++)
|
|
135
135
|
t[r] = arguments[r];
|
|
136
136
|
return function(n) {
|
|
@@ -139,7 +139,7 @@ function Rn() {
|
|
|
139
139
|
}, n);
|
|
140
140
|
};
|
|
141
141
|
}
|
|
142
|
-
function
|
|
142
|
+
function ot(e) {
|
|
143
143
|
return function t() {
|
|
144
144
|
for (var r = this, n = arguments.length, o = new Array(n), i = 0; i < n; i++)
|
|
145
145
|
o[i] = arguments[i];
|
|
@@ -150,38 +150,38 @@ function Ce(e) {
|
|
|
150
150
|
};
|
|
151
151
|
};
|
|
152
152
|
}
|
|
153
|
-
function
|
|
153
|
+
function yt(e) {
|
|
154
154
|
return {}.toString.call(e).includes("Object");
|
|
155
155
|
}
|
|
156
|
-
function
|
|
156
|
+
function Fn(e) {
|
|
157
157
|
return !Object.keys(e).length;
|
|
158
158
|
}
|
|
159
|
-
function
|
|
159
|
+
function it(e) {
|
|
160
160
|
return typeof e == "function";
|
|
161
161
|
}
|
|
162
|
-
function
|
|
162
|
+
function Un(e, t) {
|
|
163
163
|
return Object.prototype.hasOwnProperty.call(e, t);
|
|
164
164
|
}
|
|
165
|
-
function
|
|
166
|
-
return
|
|
167
|
-
return !
|
|
168
|
-
}) &&
|
|
165
|
+
function Vn(e, t) {
|
|
166
|
+
return yt(t) || xe("changeType"), Object.keys(t).some(function(r) {
|
|
167
|
+
return !Un(e, r);
|
|
168
|
+
}) && xe("changeField"), t;
|
|
169
169
|
}
|
|
170
|
-
function
|
|
171
|
-
|
|
170
|
+
function Jn(e) {
|
|
171
|
+
it(e) || xe("selectorType");
|
|
172
172
|
}
|
|
173
|
-
function
|
|
174
|
-
|
|
175
|
-
return !
|
|
176
|
-
}) &&
|
|
173
|
+
function Hn(e) {
|
|
174
|
+
it(e) || yt(e) || xe("handlerType"), yt(e) && Object.values(e).some(function(t) {
|
|
175
|
+
return !it(t);
|
|
176
|
+
}) && xe("handlersType");
|
|
177
177
|
}
|
|
178
|
-
function
|
|
179
|
-
e ||
|
|
178
|
+
function Gn(e) {
|
|
179
|
+
e || xe("initialIsRequired"), yt(e) || xe("initialType"), Fn(e) && xe("initialContent");
|
|
180
180
|
}
|
|
181
|
-
function
|
|
181
|
+
function Wn(e, t) {
|
|
182
182
|
throw new Error(e[t] || e.default);
|
|
183
183
|
}
|
|
184
|
-
var
|
|
184
|
+
var qn = {
|
|
185
185
|
initialIsRequired: "initial state is required",
|
|
186
186
|
initialType: "initial state should be an object",
|
|
187
187
|
initialContent: "initial state shouldn't be an empty object",
|
|
@@ -191,49 +191,49 @@ var Un = {
|
|
|
191
191
|
changeType: "provided value of changes should be an object",
|
|
192
192
|
changeField: 'it seams you want to change a field in the state which is not specified in the "initial" state',
|
|
193
193
|
default: "an unknown error accured in `state-local` package"
|
|
194
|
-
},
|
|
195
|
-
changes:
|
|
196
|
-
selector:
|
|
197
|
-
handler:
|
|
198
|
-
initial:
|
|
194
|
+
}, xe = ot(Wn)(qn), dt = {
|
|
195
|
+
changes: Vn,
|
|
196
|
+
selector: Jn,
|
|
197
|
+
handler: Hn,
|
|
198
|
+
initial: Gn
|
|
199
199
|
};
|
|
200
|
-
function
|
|
200
|
+
function Yn(e) {
|
|
201
201
|
var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
202
|
-
|
|
202
|
+
dt.initial(e), dt.handler(t);
|
|
203
203
|
var r = {
|
|
204
204
|
current: e
|
|
205
|
-
}, n =
|
|
205
|
+
}, n = ot(Xn)(r, t), o = ot(Cn)(r), i = ot(dt.changes)(e), s = ot(zn)(r);
|
|
206
206
|
function c() {
|
|
207
207
|
var u = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : function(l) {
|
|
208
208
|
return l;
|
|
209
209
|
};
|
|
210
|
-
return
|
|
210
|
+
return dt.selector(u), u(r.current);
|
|
211
211
|
}
|
|
212
212
|
function a(u) {
|
|
213
|
-
|
|
213
|
+
Bn(n, o, i, s)(u);
|
|
214
214
|
}
|
|
215
215
|
return [c, a];
|
|
216
216
|
}
|
|
217
|
-
function
|
|
218
|
-
return
|
|
217
|
+
function zn(e, t) {
|
|
218
|
+
return it(t) ? t(e.current) : t;
|
|
219
219
|
}
|
|
220
|
-
function
|
|
221
|
-
return e.current =
|
|
220
|
+
function Cn(e, t) {
|
|
221
|
+
return e.current = nn(nn({}, e.current), t), t;
|
|
222
222
|
}
|
|
223
|
-
function
|
|
224
|
-
return
|
|
223
|
+
function Xn(e, t, r) {
|
|
224
|
+
return it(t) ? t(e.current) : Object.keys(r).forEach(function(n) {
|
|
225
225
|
var o;
|
|
226
226
|
return (o = t[n]) === null || o === void 0 ? void 0 : o.call(t, e.current[n]);
|
|
227
227
|
}), r;
|
|
228
228
|
}
|
|
229
|
-
var
|
|
230
|
-
create:
|
|
231
|
-
},
|
|
229
|
+
var Qn = {
|
|
230
|
+
create: Yn
|
|
231
|
+
}, Zn = {
|
|
232
232
|
paths: {
|
|
233
233
|
vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs"
|
|
234
234
|
}
|
|
235
235
|
};
|
|
236
|
-
function
|
|
236
|
+
function Kn(e) {
|
|
237
237
|
return function t() {
|
|
238
238
|
for (var r = this, n = arguments.length, o = new Array(n), i = 0; i < n; i++)
|
|
239
239
|
o[i] = arguments[i];
|
|
@@ -244,23 +244,23 @@ function Yn(e) {
|
|
|
244
244
|
};
|
|
245
245
|
};
|
|
246
246
|
}
|
|
247
|
-
function
|
|
247
|
+
function er(e) {
|
|
248
248
|
return {}.toString.call(e).includes("Object");
|
|
249
249
|
}
|
|
250
|
-
function
|
|
251
|
-
return e ||
|
|
250
|
+
function tr(e) {
|
|
251
|
+
return e || rn("configIsRequired"), er(e) || rn("configType"), e.urls ? (nr(), {
|
|
252
252
|
paths: {
|
|
253
253
|
vs: e.urls.monacoBase
|
|
254
254
|
}
|
|
255
255
|
}) : e;
|
|
256
256
|
}
|
|
257
|
-
function
|
|
258
|
-
console.warn(
|
|
257
|
+
function nr() {
|
|
258
|
+
console.warn(pn.deprecation);
|
|
259
259
|
}
|
|
260
|
-
function
|
|
260
|
+
function rr(e, t) {
|
|
261
261
|
throw new Error(e[t] || e.default);
|
|
262
262
|
}
|
|
263
|
-
var
|
|
263
|
+
var pn = {
|
|
264
264
|
configIsRequired: "the configuration object is required",
|
|
265
265
|
configType: "the configuration object should be an object",
|
|
266
266
|
default: "an unknown error accured in `@monaco-editor/loader` package",
|
|
@@ -274,9 +274,9 @@ var on = {
|
|
|
274
274
|
|
|
275
275
|
For more please check the link https://github.com/suren-atoyan/monaco-loader#config
|
|
276
276
|
`
|
|
277
|
-
},
|
|
278
|
-
config:
|
|
279
|
-
},
|
|
277
|
+
}, rn = Kn(rr)(pn), or = {
|
|
278
|
+
config: tr
|
|
279
|
+
}, ir = function() {
|
|
280
280
|
for (var t = arguments.length, r = new Array(t), n = 0; n < t; n++)
|
|
281
281
|
r[n] = arguments[n];
|
|
282
282
|
return function(o) {
|
|
@@ -285,43 +285,43 @@ var on = {
|
|
|
285
285
|
}, o);
|
|
286
286
|
};
|
|
287
287
|
};
|
|
288
|
-
function
|
|
288
|
+
function dn(e, t) {
|
|
289
289
|
return Object.keys(t).forEach(function(r) {
|
|
290
|
-
t[r] instanceof Object && e[r] && Object.assign(t[r],
|
|
291
|
-
}),
|
|
290
|
+
t[r] instanceof Object && e[r] && Object.assign(t[r], dn(e[r], t[r]));
|
|
291
|
+
}), en(en({}, e), t);
|
|
292
292
|
}
|
|
293
|
-
var
|
|
293
|
+
var sr = {
|
|
294
294
|
type: "cancelation",
|
|
295
295
|
msg: "operation is manually canceled"
|
|
296
296
|
};
|
|
297
|
-
function
|
|
297
|
+
function It(e) {
|
|
298
298
|
var t = !1, r = new Promise(function(n, o) {
|
|
299
299
|
e.then(function(i) {
|
|
300
|
-
return t ? o(
|
|
300
|
+
return t ? o(sr) : n(i);
|
|
301
301
|
}), e.catch(o);
|
|
302
302
|
});
|
|
303
303
|
return r.cancel = function() {
|
|
304
304
|
return t = !0;
|
|
305
305
|
}, r;
|
|
306
306
|
}
|
|
307
|
-
var
|
|
308
|
-
config:
|
|
307
|
+
var cr = ["monaco"], ar = Qn.create({
|
|
308
|
+
config: Zn,
|
|
309
309
|
isInitialized: !1,
|
|
310
310
|
resolve: null,
|
|
311
311
|
reject: null,
|
|
312
312
|
monaco: null
|
|
313
|
-
}),
|
|
314
|
-
function
|
|
315
|
-
var t =
|
|
316
|
-
|
|
313
|
+
}), hn = Rn(ar, 2), ct = hn[0], Ot = hn[1];
|
|
314
|
+
function lr(e) {
|
|
315
|
+
var t = or.config(e), r = t.monaco, n = Pn(t, cr);
|
|
316
|
+
Ot(function(o) {
|
|
317
317
|
return {
|
|
318
|
-
config:
|
|
318
|
+
config: dn(o.config, n),
|
|
319
319
|
monaco: r
|
|
320
320
|
};
|
|
321
321
|
});
|
|
322
322
|
}
|
|
323
|
-
function
|
|
324
|
-
var e =
|
|
323
|
+
function ur() {
|
|
324
|
+
var e = ct(function(t) {
|
|
325
325
|
var r = t.monaco, n = t.isInitialized, o = t.resolve;
|
|
326
326
|
return {
|
|
327
327
|
monaco: r,
|
|
@@ -330,37 +330,37 @@ function or() {
|
|
|
330
330
|
};
|
|
331
331
|
});
|
|
332
332
|
if (!e.isInitialized) {
|
|
333
|
-
if (
|
|
333
|
+
if (Ot({
|
|
334
334
|
isInitialized: !0
|
|
335
335
|
}), e.monaco)
|
|
336
|
-
return e.resolve(e.monaco),
|
|
336
|
+
return e.resolve(e.monaco), It(Lt);
|
|
337
337
|
if (window.monaco && window.monaco.editor)
|
|
338
|
-
return
|
|
339
|
-
|
|
338
|
+
return gn(window.monaco), e.resolve(window.monaco), It(Lt);
|
|
339
|
+
ir(fr, dr)(hr);
|
|
340
340
|
}
|
|
341
|
-
return
|
|
341
|
+
return It(Lt);
|
|
342
342
|
}
|
|
343
|
-
function
|
|
343
|
+
function fr(e) {
|
|
344
344
|
return document.body.appendChild(e);
|
|
345
345
|
}
|
|
346
|
-
function
|
|
346
|
+
function pr(e) {
|
|
347
347
|
var t = document.createElement("script");
|
|
348
348
|
return e && (t.src = e), t;
|
|
349
349
|
}
|
|
350
|
-
function
|
|
351
|
-
var t =
|
|
350
|
+
function dr(e) {
|
|
351
|
+
var t = ct(function(n) {
|
|
352
352
|
var o = n.config, i = n.reject;
|
|
353
353
|
return {
|
|
354
354
|
config: o,
|
|
355
355
|
reject: i
|
|
356
356
|
};
|
|
357
|
-
}), r =
|
|
357
|
+
}), r = pr("".concat(t.config.paths.vs, "/loader.js"));
|
|
358
358
|
return r.onload = function() {
|
|
359
359
|
return e();
|
|
360
360
|
}, r.onerror = t.reject, r;
|
|
361
361
|
}
|
|
362
|
-
function
|
|
363
|
-
var e =
|
|
362
|
+
function hr() {
|
|
363
|
+
var e = ct(function(r) {
|
|
364
364
|
var n = r.config, o = r.resolve, i = r.reject;
|
|
365
365
|
return {
|
|
366
366
|
config: n,
|
|
@@ -370,36 +370,36 @@ function ar() {
|
|
|
370
370
|
}), t = window.require;
|
|
371
371
|
t.config(e.config), t(["vs/editor/editor.main"], function(r) {
|
|
372
372
|
var n = r.m;
|
|
373
|
-
|
|
373
|
+
gn(n), e.resolve(n);
|
|
374
374
|
}, function(r) {
|
|
375
375
|
e.reject(r);
|
|
376
376
|
});
|
|
377
377
|
}
|
|
378
|
-
function
|
|
379
|
-
|
|
378
|
+
function gn(e) {
|
|
379
|
+
ct().monaco || Ot({
|
|
380
380
|
monaco: e
|
|
381
381
|
});
|
|
382
382
|
}
|
|
383
|
-
function
|
|
384
|
-
return
|
|
383
|
+
function gr() {
|
|
384
|
+
return ct(function(e) {
|
|
385
385
|
var t = e.monaco;
|
|
386
386
|
return t;
|
|
387
387
|
});
|
|
388
388
|
}
|
|
389
|
-
var
|
|
390
|
-
return
|
|
389
|
+
var Lt = new Promise(function(e, t) {
|
|
390
|
+
return Ot({
|
|
391
391
|
resolve: e,
|
|
392
392
|
reject: t
|
|
393
393
|
});
|
|
394
|
-
}),
|
|
395
|
-
config:
|
|
396
|
-
init:
|
|
397
|
-
__getMonacoInstance:
|
|
398
|
-
},
|
|
399
|
-
function
|
|
394
|
+
}), mr = {
|
|
395
|
+
config: lr,
|
|
396
|
+
init: ur,
|
|
397
|
+
__getMonacoInstance: gr
|
|
398
|
+
}, ne = /* @__PURE__ */ ((e) => (e[e.excluded = 0] = "excluded", e[e.first = 1] = "first", e[e.second = 2] = "second", e))(ne || {}), x = /* @__PURE__ */ ((e) => (e.SAME_CHANGE = "same_change", e.INPUT1_ONLY = "input1_only", e.INPUT2_ONLY = "input2_only", e.TRUE_CONFLICT = "true_conflict", e))(x || {});
|
|
399
|
+
function yr(e, t = !1) {
|
|
400
400
|
const r = e.length;
|
|
401
401
|
let n = 0, o = "", i = 0, s = 16, c = 0, a = 0, u = 0, l = 0, y = 0;
|
|
402
|
-
function p(f,
|
|
402
|
+
function p(f, I) {
|
|
403
403
|
let S = 0, g = 0;
|
|
404
404
|
for (; S < f; ) {
|
|
405
405
|
let b = e.charCodeAt(n);
|
|
@@ -418,43 +418,43 @@ function fr(e, t = !1) {
|
|
|
418
418
|
function d(f) {
|
|
419
419
|
n = f, o = "", i = 0, s = 16, y = 0;
|
|
420
420
|
}
|
|
421
|
-
function
|
|
421
|
+
function _() {
|
|
422
422
|
let f = n;
|
|
423
423
|
if (e.charCodeAt(n) === 48)
|
|
424
424
|
n++;
|
|
425
425
|
else
|
|
426
|
-
for (n++; n < e.length &&
|
|
426
|
+
for (n++; n < e.length && qe(e.charCodeAt(n)); )
|
|
427
427
|
n++;
|
|
428
428
|
if (n < e.length && e.charCodeAt(n) === 46)
|
|
429
|
-
if (n++, n < e.length &&
|
|
430
|
-
for (n++; n < e.length &&
|
|
429
|
+
if (n++, n < e.length && qe(e.charCodeAt(n)))
|
|
430
|
+
for (n++; n < e.length && qe(e.charCodeAt(n)); )
|
|
431
431
|
n++;
|
|
432
432
|
else
|
|
433
433
|
return y = 3, e.substring(f, n);
|
|
434
|
-
let
|
|
434
|
+
let I = n;
|
|
435
435
|
if (n < e.length && (e.charCodeAt(n) === 69 || e.charCodeAt(n) === 101))
|
|
436
|
-
if (n++, (n < e.length && e.charCodeAt(n) === 43 || e.charCodeAt(n) === 45) && n++, n < e.length &&
|
|
437
|
-
for (n++; n < e.length &&
|
|
436
|
+
if (n++, (n < e.length && e.charCodeAt(n) === 43 || e.charCodeAt(n) === 45) && n++, n < e.length && qe(e.charCodeAt(n))) {
|
|
437
|
+
for (n++; n < e.length && qe(e.charCodeAt(n)); )
|
|
438
438
|
n++;
|
|
439
|
-
|
|
439
|
+
I = n;
|
|
440
440
|
} else
|
|
441
441
|
y = 3;
|
|
442
|
-
return e.substring(f,
|
|
442
|
+
return e.substring(f, I);
|
|
443
443
|
}
|
|
444
|
-
function
|
|
445
|
-
let f = "",
|
|
444
|
+
function T() {
|
|
445
|
+
let f = "", I = n;
|
|
446
446
|
for (; ; ) {
|
|
447
447
|
if (n >= r) {
|
|
448
|
-
f += e.substring(
|
|
448
|
+
f += e.substring(I, n), y = 2;
|
|
449
449
|
break;
|
|
450
450
|
}
|
|
451
451
|
const S = e.charCodeAt(n);
|
|
452
452
|
if (S === 34) {
|
|
453
|
-
f += e.substring(
|
|
453
|
+
f += e.substring(I, n), n++;
|
|
454
454
|
break;
|
|
455
455
|
}
|
|
456
456
|
if (S === 92) {
|
|
457
|
-
if (f += e.substring(
|
|
457
|
+
if (f += e.substring(I, n), n++, n >= r) {
|
|
458
458
|
y = 2;
|
|
459
459
|
break;
|
|
460
460
|
}
|
|
@@ -491,12 +491,12 @@ function fr(e, t = !1) {
|
|
|
491
491
|
default:
|
|
492
492
|
y = 5;
|
|
493
493
|
}
|
|
494
|
-
|
|
494
|
+
I = n;
|
|
495
495
|
continue;
|
|
496
496
|
}
|
|
497
497
|
if (S >= 0 && S <= 31)
|
|
498
|
-
if (
|
|
499
|
-
f += e.substring(
|
|
498
|
+
if (nt(S)) {
|
|
499
|
+
f += e.substring(I, n), y = 2;
|
|
500
500
|
break;
|
|
501
501
|
} else
|
|
502
502
|
y = 6;
|
|
@@ -508,13 +508,13 @@ function fr(e, t = !1) {
|
|
|
508
508
|
if (o = "", y = 0, i = n, a = c, l = u, n >= r)
|
|
509
509
|
return i = r, s = 17;
|
|
510
510
|
let f = e.charCodeAt(n);
|
|
511
|
-
if (
|
|
511
|
+
if (St(f)) {
|
|
512
512
|
do
|
|
513
513
|
n++, o += String.fromCharCode(f), f = e.charCodeAt(n);
|
|
514
|
-
while (
|
|
514
|
+
while (St(f));
|
|
515
515
|
return s = 15;
|
|
516
516
|
}
|
|
517
|
-
if (
|
|
517
|
+
if (nt(f))
|
|
518
518
|
return n++, o += String.fromCharCode(f), f === 13 && e.charCodeAt(n) === 10 && (n++, o += `
|
|
519
519
|
`), c++, u = n, s = 14;
|
|
520
520
|
switch (f) {
|
|
@@ -533,14 +533,14 @@ function fr(e, t = !1) {
|
|
|
533
533
|
return n++, s = 5;
|
|
534
534
|
// strings
|
|
535
535
|
case 34:
|
|
536
|
-
return n++, o =
|
|
536
|
+
return n++, o = T(), s = 10;
|
|
537
537
|
// comments
|
|
538
538
|
case 47:
|
|
539
|
-
const
|
|
539
|
+
const I = n - 1;
|
|
540
540
|
if (e.charCodeAt(n + 1) === 47) {
|
|
541
|
-
for (n += 2; n < r && !
|
|
541
|
+
for (n += 2; n < r && !nt(e.charCodeAt(n)); )
|
|
542
542
|
n++;
|
|
543
|
-
return o = e.substring(
|
|
543
|
+
return o = e.substring(I, n), s = 12;
|
|
544
544
|
}
|
|
545
545
|
if (e.charCodeAt(n + 1) === 42) {
|
|
546
546
|
n += 2;
|
|
@@ -552,14 +552,14 @@ function fr(e, t = !1) {
|
|
|
552
552
|
n += 2, g = !0;
|
|
553
553
|
break;
|
|
554
554
|
}
|
|
555
|
-
n++,
|
|
555
|
+
n++, nt(b) && (b === 13 && e.charCodeAt(n) === 10 && n++, c++, u = n);
|
|
556
556
|
}
|
|
557
|
-
return g || (n++, y = 1), o = e.substring(
|
|
557
|
+
return g || (n++, y = 1), o = e.substring(I, n), s = 13;
|
|
558
558
|
}
|
|
559
559
|
return o += String.fromCharCode(f), n++, s = 16;
|
|
560
560
|
// numbers
|
|
561
561
|
case 45:
|
|
562
|
-
if (o += String.fromCharCode(f), n++, n === r || !
|
|
562
|
+
if (o += String.fromCharCode(f), n++, n === r || !qe(e.charCodeAt(n)))
|
|
563
563
|
return s = 16;
|
|
564
564
|
// found a minus, followed by a number so
|
|
565
565
|
// we fall through to proceed with scanning
|
|
@@ -574,7 +574,7 @@ function fr(e, t = !1) {
|
|
|
574
574
|
case 55:
|
|
575
575
|
case 56:
|
|
576
576
|
case 57:
|
|
577
|
-
return o +=
|
|
577
|
+
return o += _(), s = 11;
|
|
578
578
|
// literals and unknown symbols
|
|
579
579
|
default:
|
|
580
580
|
for (; n < r && h(f); )
|
|
@@ -594,7 +594,7 @@ function fr(e, t = !1) {
|
|
|
594
594
|
}
|
|
595
595
|
}
|
|
596
596
|
function h(f) {
|
|
597
|
-
if (
|
|
597
|
+
if (St(f) || nt(f))
|
|
598
598
|
return !1;
|
|
599
599
|
switch (f) {
|
|
600
600
|
case 125:
|
|
@@ -629,33 +629,33 @@ function fr(e, t = !1) {
|
|
|
629
629
|
getTokenError: () => y
|
|
630
630
|
};
|
|
631
631
|
}
|
|
632
|
-
function
|
|
632
|
+
function St(e) {
|
|
633
633
|
return e === 32 || e === 9;
|
|
634
634
|
}
|
|
635
|
-
function
|
|
635
|
+
function nt(e) {
|
|
636
636
|
return e === 10 || e === 13;
|
|
637
637
|
}
|
|
638
|
-
function
|
|
638
|
+
function qe(e) {
|
|
639
639
|
return e >= 48 && e <= 57;
|
|
640
640
|
}
|
|
641
|
-
var
|
|
641
|
+
var on;
|
|
642
642
|
(function(e) {
|
|
643
643
|
e[e.lineFeed = 10] = "lineFeed", e[e.carriageReturn = 13] = "carriageReturn", e[e.space = 32] = "space", e[e._0 = 48] = "_0", e[e._1 = 49] = "_1", e[e._2 = 50] = "_2", e[e._3 = 51] = "_3", e[e._4 = 52] = "_4", e[e._5 = 53] = "_5", e[e._6 = 54] = "_6", e[e._7 = 55] = "_7", e[e._8 = 56] = "_8", e[e._9 = 57] = "_9", e[e.a = 97] = "a", e[e.b = 98] = "b", e[e.c = 99] = "c", e[e.d = 100] = "d", e[e.e = 101] = "e", e[e.f = 102] = "f", e[e.g = 103] = "g", e[e.h = 104] = "h", e[e.i = 105] = "i", e[e.j = 106] = "j", e[e.k = 107] = "k", e[e.l = 108] = "l", e[e.m = 109] = "m", e[e.n = 110] = "n", e[e.o = 111] = "o", e[e.p = 112] = "p", e[e.q = 113] = "q", e[e.r = 114] = "r", e[e.s = 115] = "s", e[e.t = 116] = "t", e[e.u = 117] = "u", e[e.v = 118] = "v", e[e.w = 119] = "w", e[e.x = 120] = "x", e[e.y = 121] = "y", e[e.z = 122] = "z", e[e.A = 65] = "A", e[e.B = 66] = "B", e[e.C = 67] = "C", e[e.D = 68] = "D", e[e.E = 69] = "E", e[e.F = 70] = "F", e[e.G = 71] = "G", e[e.H = 72] = "H", e[e.I = 73] = "I", e[e.J = 74] = "J", e[e.K = 75] = "K", e[e.L = 76] = "L", e[e.M = 77] = "M", e[e.N = 78] = "N", e[e.O = 79] = "O", e[e.P = 80] = "P", e[e.Q = 81] = "Q", e[e.R = 82] = "R", e[e.S = 83] = "S", e[e.T = 84] = "T", e[e.U = 85] = "U", e[e.V = 86] = "V", e[e.W = 87] = "W", e[e.X = 88] = "X", e[e.Y = 89] = "Y", e[e.Z = 90] = "Z", e[e.asterisk = 42] = "asterisk", e[e.backslash = 92] = "backslash", e[e.closeBrace = 125] = "closeBrace", e[e.closeBracket = 93] = "closeBracket", e[e.colon = 58] = "colon", e[e.comma = 44] = "comma", e[e.dot = 46] = "dot", e[e.doubleQuote = 34] = "doubleQuote", e[e.minus = 45] = "minus", e[e.openBrace = 123] = "openBrace", e[e.openBracket = 91] = "openBracket", e[e.plus = 43] = "plus", e[e.slash = 47] = "slash", e[e.formFeed = 12] = "formFeed", e[e.tab = 9] = "tab";
|
|
644
|
-
})(
|
|
644
|
+
})(on || (on = {}));
|
|
645
645
|
new Array(20).fill(0).map((e, t) => " ".repeat(t));
|
|
646
|
-
const
|
|
647
|
-
new Array(
|
|
648
|
-
` + " ".repeat(t)), new Array(
|
|
649
|
-
` + " ".repeat(t)), new Array(
|
|
650
|
-
` + " ".repeat(t)), new Array(
|
|
646
|
+
const Ye = 200;
|
|
647
|
+
new Array(Ye).fill(0).map((e, t) => `
|
|
648
|
+
` + " ".repeat(t)), new Array(Ye).fill(0).map((e, t) => "\r" + " ".repeat(t)), new Array(Ye).fill(0).map((e, t) => `\r
|
|
649
|
+
` + " ".repeat(t)), new Array(Ye).fill(0).map((e, t) => `
|
|
650
|
+
` + " ".repeat(t)), new Array(Ye).fill(0).map((e, t) => "\r" + " ".repeat(t)), new Array(Ye).fill(0).map((e, t) => `\r
|
|
651
651
|
` + " ".repeat(t));
|
|
652
|
-
var
|
|
652
|
+
var vt;
|
|
653
653
|
(function(e) {
|
|
654
654
|
e.DEFAULT = {
|
|
655
655
|
allowTrailingComma: !1
|
|
656
656
|
};
|
|
657
|
-
})(
|
|
658
|
-
function
|
|
657
|
+
})(vt || (vt = {}));
|
|
658
|
+
function vr(e, t = [], r = vt.DEFAULT) {
|
|
659
659
|
let n = { type: "array", offset: -1, length: -1, children: [], parent: void 0 };
|
|
660
660
|
function o(a) {
|
|
661
661
|
n.type === "property" && (n.length = a - n.offset, n = n.parent);
|
|
@@ -663,7 +663,7 @@ function pr(e, t = [], r = ut.DEFAULT) {
|
|
|
663
663
|
function i(a) {
|
|
664
664
|
return n.children.push(a), a;
|
|
665
665
|
}
|
|
666
|
-
|
|
666
|
+
wr(e, {
|
|
667
667
|
onObjectBegin: (a) => {
|
|
668
668
|
n = i({ type: "object", offset: a, length: -1, parent: n, children: [] });
|
|
669
669
|
},
|
|
@@ -680,7 +680,7 @@ function pr(e, t = [], r = ut.DEFAULT) {
|
|
|
680
680
|
n.length = a + u - n.offset, n = n.parent, o(a + u);
|
|
681
681
|
},
|
|
682
682
|
onLiteralValue: (a, u, l) => {
|
|
683
|
-
i({ type:
|
|
683
|
+
i({ type: Or(a), offset: u, length: l, parent: n, value: a }), o(u + l);
|
|
684
684
|
},
|
|
685
685
|
onSeparator: (a, u, l) => {
|
|
686
686
|
n.type === "property" && (a === ":" ? n.colonOffset = u : a === "," && o(u));
|
|
@@ -692,7 +692,7 @@ function pr(e, t = [], r = ut.DEFAULT) {
|
|
|
692
692
|
const c = n.children[0];
|
|
693
693
|
return c && delete c.parent, c;
|
|
694
694
|
}
|
|
695
|
-
function
|
|
695
|
+
function br(e, t) {
|
|
696
696
|
if (!e)
|
|
697
697
|
return;
|
|
698
698
|
let r = e;
|
|
@@ -716,32 +716,32 @@ function dr(e, t) {
|
|
|
716
716
|
}
|
|
717
717
|
return r;
|
|
718
718
|
}
|
|
719
|
-
function
|
|
720
|
-
const n =
|
|
719
|
+
function wr(e, t, r = vt.DEFAULT) {
|
|
720
|
+
const n = yr(e, !1), o = [];
|
|
721
721
|
let i = 0;
|
|
722
|
-
function s(
|
|
723
|
-
return
|
|
722
|
+
function s(E) {
|
|
723
|
+
return E ? () => i === 0 && E(n.getTokenOffset(), n.getTokenLength(), n.getTokenStartLine(), n.getTokenStartCharacter()) : () => !0;
|
|
724
724
|
}
|
|
725
|
-
function c(
|
|
726
|
-
return
|
|
725
|
+
function c(E) {
|
|
726
|
+
return E ? (A) => i === 0 && E(A, n.getTokenOffset(), n.getTokenLength(), n.getTokenStartLine(), n.getTokenStartCharacter()) : () => !0;
|
|
727
727
|
}
|
|
728
|
-
function a(
|
|
729
|
-
return
|
|
728
|
+
function a(E) {
|
|
729
|
+
return E ? (A) => i === 0 && E(A, n.getTokenOffset(), n.getTokenLength(), n.getTokenStartLine(), n.getTokenStartCharacter(), () => o.slice()) : () => !0;
|
|
730
730
|
}
|
|
731
|
-
function u(
|
|
732
|
-
return
|
|
733
|
-
i > 0 ? i++ :
|
|
731
|
+
function u(E) {
|
|
732
|
+
return E ? () => {
|
|
733
|
+
i > 0 ? i++ : E(n.getTokenOffset(), n.getTokenLength(), n.getTokenStartLine(), n.getTokenStartCharacter(), () => o.slice()) === !1 && (i = 1);
|
|
734
734
|
} : () => !0;
|
|
735
735
|
}
|
|
736
|
-
function l(
|
|
737
|
-
return
|
|
738
|
-
i > 0 && i--, i === 0 &&
|
|
736
|
+
function l(E) {
|
|
737
|
+
return E ? () => {
|
|
738
|
+
i > 0 && i--, i === 0 && E(n.getTokenOffset(), n.getTokenLength(), n.getTokenStartLine(), n.getTokenStartCharacter());
|
|
739
739
|
} : () => !0;
|
|
740
740
|
}
|
|
741
|
-
const y = u(t.onObjectBegin), p = a(t.onObjectProperty), d = l(t.onObjectEnd),
|
|
741
|
+
const y = u(t.onObjectBegin), p = a(t.onObjectProperty), d = l(t.onObjectEnd), _ = u(t.onArrayBegin), T = l(t.onArrayEnd), v = a(t.onLiteralValue), h = c(t.onSeparator), m = s(t.onComment), f = c(t.onError), I = r && r.disallowComments, S = r && r.allowTrailingComma;
|
|
742
742
|
function g() {
|
|
743
743
|
for (; ; ) {
|
|
744
|
-
const
|
|
744
|
+
const E = n.scan();
|
|
745
745
|
switch (n.getTokenError()) {
|
|
746
746
|
case 4:
|
|
747
747
|
b(
|
|
@@ -762,7 +762,7 @@ function hr(e, t, r = ut.DEFAULT) {
|
|
|
762
762
|
);
|
|
763
763
|
break;
|
|
764
764
|
case 1:
|
|
765
|
-
|
|
765
|
+
I || b(
|
|
766
766
|
11
|
|
767
767
|
/* ParseErrorCode.UnexpectedEndOfComment */
|
|
768
768
|
);
|
|
@@ -780,10 +780,10 @@ function hr(e, t, r = ut.DEFAULT) {
|
|
|
780
780
|
);
|
|
781
781
|
break;
|
|
782
782
|
}
|
|
783
|
-
switch (
|
|
783
|
+
switch (E) {
|
|
784
784
|
case 12:
|
|
785
785
|
case 13:
|
|
786
|
-
|
|
786
|
+
I ? b(
|
|
787
787
|
10
|
|
788
788
|
/* ParseErrorCode.InvalidCommentToken */
|
|
789
789
|
) : m();
|
|
@@ -798,15 +798,15 @@ function hr(e, t, r = ut.DEFAULT) {
|
|
|
798
798
|
case 14:
|
|
799
799
|
break;
|
|
800
800
|
default:
|
|
801
|
-
return
|
|
801
|
+
return E;
|
|
802
802
|
}
|
|
803
803
|
}
|
|
804
804
|
}
|
|
805
|
-
function b(
|
|
806
|
-
if (f(
|
|
805
|
+
function b(E, A = [], R = []) {
|
|
806
|
+
if (f(E), A.length + R.length > 0) {
|
|
807
807
|
let X = n.getToken();
|
|
808
808
|
for (; X !== 17; ) {
|
|
809
|
-
if (
|
|
809
|
+
if (A.indexOf(X) !== -1) {
|
|
810
810
|
g();
|
|
811
811
|
break;
|
|
812
812
|
} else if (R.indexOf(X) !== -1)
|
|
@@ -815,19 +815,19 @@ function hr(e, t, r = ut.DEFAULT) {
|
|
|
815
815
|
}
|
|
816
816
|
}
|
|
817
817
|
}
|
|
818
|
-
function
|
|
819
|
-
const
|
|
820
|
-
return
|
|
818
|
+
function D(E) {
|
|
819
|
+
const A = n.getTokenValue();
|
|
820
|
+
return E ? v(A) : (p(A), o.push(A)), g(), !0;
|
|
821
821
|
}
|
|
822
|
-
function
|
|
822
|
+
function L() {
|
|
823
823
|
switch (n.getToken()) {
|
|
824
824
|
case 11:
|
|
825
|
-
const
|
|
826
|
-
let
|
|
827
|
-
isNaN(
|
|
825
|
+
const E = n.getTokenValue();
|
|
826
|
+
let A = Number(E);
|
|
827
|
+
isNaN(A) && (b(
|
|
828
828
|
2
|
|
829
829
|
/* ParseErrorCode.InvalidNumberFormat */
|
|
830
|
-
),
|
|
830
|
+
), A = 0), v(A);
|
|
831
831
|
break;
|
|
832
832
|
case 7:
|
|
833
833
|
v(null);
|
|
@@ -843,12 +843,12 @@ function hr(e, t, r = ut.DEFAULT) {
|
|
|
843
843
|
}
|
|
844
844
|
return g(), !0;
|
|
845
845
|
}
|
|
846
|
-
function
|
|
846
|
+
function U() {
|
|
847
847
|
return n.getToken() !== 10 ? (b(3, [], [
|
|
848
848
|
2,
|
|
849
849
|
5
|
|
850
850
|
/* SyntaxKind.CommaToken */
|
|
851
|
-
]), !1) : (
|
|
851
|
+
]), !1) : (D(!1), n.getToken() === 6 ? (h(":"), g(), V() || b(4, [], [
|
|
852
852
|
2,
|
|
853
853
|
5
|
|
854
854
|
/* SyntaxKind.CommaToken */
|
|
@@ -860,38 +860,38 @@ function hr(e, t, r = ut.DEFAULT) {
|
|
|
860
860
|
}
|
|
861
861
|
function M() {
|
|
862
862
|
y(), g();
|
|
863
|
-
let
|
|
863
|
+
let E = !1;
|
|
864
864
|
for (; n.getToken() !== 2 && n.getToken() !== 17; ) {
|
|
865
865
|
if (n.getToken() === 5) {
|
|
866
|
-
if (
|
|
866
|
+
if (E || b(4, [], []), h(","), g(), n.getToken() === 2 && S)
|
|
867
867
|
break;
|
|
868
|
-
} else
|
|
869
|
-
|
|
868
|
+
} else E && b(6, [], []);
|
|
869
|
+
U() || b(4, [], [
|
|
870
870
|
2,
|
|
871
871
|
5
|
|
872
872
|
/* SyntaxKind.CommaToken */
|
|
873
|
-
]),
|
|
873
|
+
]), E = !0;
|
|
874
874
|
}
|
|
875
875
|
return d(), n.getToken() !== 2 ? b(7, [
|
|
876
876
|
2
|
|
877
877
|
/* SyntaxKind.CloseBraceToken */
|
|
878
878
|
], []) : g(), !0;
|
|
879
879
|
}
|
|
880
|
-
function
|
|
881
|
-
|
|
882
|
-
let
|
|
880
|
+
function $() {
|
|
881
|
+
_(), g();
|
|
882
|
+
let E = !0, A = !1;
|
|
883
883
|
for (; n.getToken() !== 4 && n.getToken() !== 17; ) {
|
|
884
884
|
if (n.getToken() === 5) {
|
|
885
|
-
if (
|
|
885
|
+
if (A || b(4, [], []), h(","), g(), n.getToken() === 4 && S)
|
|
886
886
|
break;
|
|
887
|
-
} else
|
|
888
|
-
|
|
887
|
+
} else A && b(6, [], []);
|
|
888
|
+
E ? (o.push(0), E = !1) : o[o.length - 1]++, V() || b(4, [], [
|
|
889
889
|
4,
|
|
890
890
|
5
|
|
891
891
|
/* SyntaxKind.CommaToken */
|
|
892
|
-
]),
|
|
892
|
+
]), A = !0;
|
|
893
893
|
}
|
|
894
|
-
return
|
|
894
|
+
return T(), E || o.pop(), n.getToken() !== 4 ? b(8, [
|
|
895
895
|
4
|
|
896
896
|
/* SyntaxKind.CloseBracketToken */
|
|
897
897
|
], []) : g(), !0;
|
|
@@ -899,18 +899,18 @@ function hr(e, t, r = ut.DEFAULT) {
|
|
|
899
899
|
function V() {
|
|
900
900
|
switch (n.getToken()) {
|
|
901
901
|
case 3:
|
|
902
|
-
return
|
|
902
|
+
return $();
|
|
903
903
|
case 1:
|
|
904
904
|
return M();
|
|
905
905
|
case 10:
|
|
906
|
-
return
|
|
906
|
+
return D(!0);
|
|
907
907
|
default:
|
|
908
|
-
return
|
|
908
|
+
return L();
|
|
909
909
|
}
|
|
910
910
|
}
|
|
911
911
|
return g(), n.getToken() === 17 ? r.allowEmptyContent ? !0 : (b(4, [], []), !1) : V() ? (n.getToken() !== 17 && b(9, [], []), !0) : (b(4, [], []), !1);
|
|
912
912
|
}
|
|
913
|
-
function
|
|
913
|
+
function Or(e) {
|
|
914
914
|
switch (typeof e) {
|
|
915
915
|
case "boolean":
|
|
916
916
|
return "boolean";
|
|
@@ -929,25 +929,25 @@ function gr(e) {
|
|
|
929
929
|
return "null";
|
|
930
930
|
}
|
|
931
931
|
}
|
|
932
|
-
var
|
|
932
|
+
var sn;
|
|
933
933
|
(function(e) {
|
|
934
934
|
e[e.None = 0] = "None", e[e.UnexpectedEndOfComment = 1] = "UnexpectedEndOfComment", e[e.UnexpectedEndOfString = 2] = "UnexpectedEndOfString", e[e.UnexpectedEndOfNumber = 3] = "UnexpectedEndOfNumber", e[e.InvalidUnicode = 4] = "InvalidUnicode", e[e.InvalidEscapeCharacter = 5] = "InvalidEscapeCharacter", e[e.InvalidCharacter = 6] = "InvalidCharacter";
|
|
935
|
-
})(
|
|
936
|
-
var
|
|
935
|
+
})(sn || (sn = {}));
|
|
936
|
+
var cn;
|
|
937
937
|
(function(e) {
|
|
938
938
|
e[e.OpenBraceToken = 1] = "OpenBraceToken", e[e.CloseBraceToken = 2] = "CloseBraceToken", e[e.OpenBracketToken = 3] = "OpenBracketToken", e[e.CloseBracketToken = 4] = "CloseBracketToken", e[e.CommaToken = 5] = "CommaToken", e[e.ColonToken = 6] = "ColonToken", e[e.NullKeyword = 7] = "NullKeyword", e[e.TrueKeyword = 8] = "TrueKeyword", e[e.FalseKeyword = 9] = "FalseKeyword", e[e.StringLiteral = 10] = "StringLiteral", e[e.NumericLiteral = 11] = "NumericLiteral", e[e.LineCommentTrivia = 12] = "LineCommentTrivia", e[e.BlockCommentTrivia = 13] = "BlockCommentTrivia", e[e.LineBreakTrivia = 14] = "LineBreakTrivia", e[e.Trivia = 15] = "Trivia", e[e.Unknown = 16] = "Unknown", e[e.EOF = 17] = "EOF";
|
|
939
|
-
})(
|
|
940
|
-
const
|
|
941
|
-
var
|
|
939
|
+
})(cn || (cn = {}));
|
|
940
|
+
const mn = vr, yn = br;
|
|
941
|
+
var an;
|
|
942
942
|
(function(e) {
|
|
943
943
|
e[e.InvalidSymbol = 1] = "InvalidSymbol", e[e.InvalidNumberFormat = 2] = "InvalidNumberFormat", e[e.PropertyNameExpected = 3] = "PropertyNameExpected", e[e.ValueExpected = 4] = "ValueExpected", e[e.ColonExpected = 5] = "ColonExpected", e[e.CommaExpected = 6] = "CommaExpected", e[e.CloseBraceExpected = 7] = "CloseBraceExpected", e[e.CloseBracketExpected = 8] = "CloseBracketExpected", e[e.EndOfFileExpected = 9] = "EndOfFileExpected", e[e.InvalidCommentToken = 10] = "InvalidCommentToken", e[e.UnexpectedEndOfComment = 11] = "UnexpectedEndOfComment", e[e.UnexpectedEndOfString = 12] = "UnexpectedEndOfString", e[e.UnexpectedEndOfNumber = 13] = "UnexpectedEndOfNumber", e[e.InvalidUnicode = 14] = "InvalidUnicode", e[e.InvalidEscapeCharacter = 15] = "InvalidEscapeCharacter", e[e.InvalidCharacter = 16] = "InvalidCharacter";
|
|
944
|
-
})(
|
|
945
|
-
function
|
|
944
|
+
})(an || (an = {}));
|
|
945
|
+
function Ar(e) {
|
|
946
946
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
947
947
|
}
|
|
948
|
-
var
|
|
949
|
-
function
|
|
950
|
-
return
|
|
948
|
+
var kt, ln;
|
|
949
|
+
function Nr() {
|
|
950
|
+
return ln || (ln = 1, kt = function e(t, r) {
|
|
951
951
|
if (t === r) return !0;
|
|
952
952
|
if (t && r && typeof t == "object" && typeof r == "object") {
|
|
953
953
|
if (t.constructor !== r.constructor) return !1;
|
|
@@ -971,10 +971,10 @@ function yr() {
|
|
|
971
971
|
return !0;
|
|
972
972
|
}
|
|
973
973
|
return t !== t && r !== r;
|
|
974
|
-
}),
|
|
974
|
+
}), kt;
|
|
975
975
|
}
|
|
976
|
-
var
|
|
977
|
-
const de = /* @__PURE__ */
|
|
976
|
+
var Er = Nr();
|
|
977
|
+
const de = /* @__PURE__ */ Ar(Er), W = (e, t) => {
|
|
978
978
|
if (!e) return;
|
|
979
979
|
const r = t.replace(/^\//, "").replace(/\[/g, ".").replace(/\]/g, "").split(/[./#]/).filter(Boolean);
|
|
980
980
|
let n = e;
|
|
@@ -998,7 +998,7 @@ const de = /* @__PURE__ */ mr(vr), W = (e, t) => {
|
|
|
998
998
|
* (c) 2017-2022 Joachim Wester
|
|
999
999
|
* MIT licensed
|
|
1000
1000
|
*/
|
|
1001
|
-
var
|
|
1001
|
+
var Tr = /* @__PURE__ */ (function() {
|
|
1002
1002
|
var e = function(t, r) {
|
|
1003
1003
|
return e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, o) {
|
|
1004
1004
|
n.__proto__ = o;
|
|
@@ -1013,11 +1013,11 @@ var br = /* @__PURE__ */ (function() {
|
|
|
1013
1013
|
}
|
|
1014
1014
|
t.prototype = r === null ? Object.create(r) : (n.prototype = r.prototype, new n());
|
|
1015
1015
|
};
|
|
1016
|
-
})(),
|
|
1017
|
-
function
|
|
1018
|
-
return
|
|
1016
|
+
})(), Ir = Object.prototype.hasOwnProperty;
|
|
1017
|
+
function jt(e, t) {
|
|
1018
|
+
return Ir.call(e, t);
|
|
1019
1019
|
}
|
|
1020
|
-
function
|
|
1020
|
+
function Rt(e) {
|
|
1021
1021
|
if (Array.isArray(e)) {
|
|
1022
1022
|
for (var t = new Array(e.length), r = 0; r < t.length; r++)
|
|
1023
1023
|
t[r] = "" + r;
|
|
@@ -1027,10 +1027,10 @@ function Tt(e) {
|
|
|
1027
1027
|
return Object.keys(e);
|
|
1028
1028
|
var n = [];
|
|
1029
1029
|
for (var o in e)
|
|
1030
|
-
|
|
1030
|
+
jt(e, o) && n.push(o);
|
|
1031
1031
|
return n;
|
|
1032
1032
|
}
|
|
1033
|
-
function
|
|
1033
|
+
function Ae(e) {
|
|
1034
1034
|
switch (typeof e) {
|
|
1035
1035
|
case "object":
|
|
1036
1036
|
return JSON.parse(JSON.stringify(e));
|
|
@@ -1042,7 +1042,7 @@ function we(e) {
|
|
|
1042
1042
|
return e;
|
|
1043
1043
|
}
|
|
1044
1044
|
}
|
|
1045
|
-
function
|
|
1045
|
+
function Dt(e) {
|
|
1046
1046
|
for (var t = 0, r = e.length, n; t < r; ) {
|
|
1047
1047
|
if (n = e.charCodeAt(t), n >= 48 && n <= 57) {
|
|
1048
1048
|
t++;
|
|
@@ -1052,29 +1052,29 @@ function It(e) {
|
|
|
1052
1052
|
}
|
|
1053
1053
|
return !0;
|
|
1054
1054
|
}
|
|
1055
|
-
function
|
|
1055
|
+
function Fe(e) {
|
|
1056
1056
|
return e.indexOf("/") === -1 && e.indexOf("~") === -1 ? e : e.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
1057
1057
|
}
|
|
1058
|
-
function
|
|
1058
|
+
function vn(e) {
|
|
1059
1059
|
return e.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
1060
1060
|
}
|
|
1061
|
-
function
|
|
1061
|
+
function xt(e) {
|
|
1062
1062
|
if (e === void 0)
|
|
1063
1063
|
return !0;
|
|
1064
1064
|
if (e) {
|
|
1065
1065
|
if (Array.isArray(e)) {
|
|
1066
1066
|
for (var t = 0, r = e.length; t < r; t++)
|
|
1067
|
-
if (
|
|
1067
|
+
if (xt(e[t]))
|
|
1068
1068
|
return !0;
|
|
1069
1069
|
} else if (typeof e == "object") {
|
|
1070
|
-
for (var n =
|
|
1071
|
-
if (
|
|
1070
|
+
for (var n = Rt(e), o = n.length, i = 0; i < o; i++)
|
|
1071
|
+
if (xt(e[n[i]]))
|
|
1072
1072
|
return !0;
|
|
1073
1073
|
}
|
|
1074
1074
|
}
|
|
1075
1075
|
return !1;
|
|
1076
1076
|
}
|
|
1077
|
-
function
|
|
1077
|
+
function un(e, t) {
|
|
1078
1078
|
var r = [e];
|
|
1079
1079
|
for (var n in t) {
|
|
1080
1080
|
var o = typeof t[n] == "object" ? JSON.stringify(t[n], null, 2) : t[n];
|
|
@@ -1083,17 +1083,17 @@ function nn(e, t) {
|
|
|
1083
1083
|
return r.join(`
|
|
1084
1084
|
`);
|
|
1085
1085
|
}
|
|
1086
|
-
var
|
|
1086
|
+
var bn = (
|
|
1087
1087
|
/** @class */
|
|
1088
1088
|
(function(e) {
|
|
1089
|
-
|
|
1089
|
+
Tr(t, e);
|
|
1090
1090
|
function t(r, n, o, i, s) {
|
|
1091
|
-
var c = this.constructor, a = e.call(this,
|
|
1092
|
-
return a.name = n, a.index = o, a.operation = i, a.tree = s, Object.setPrototypeOf(a, c.prototype), a.message =
|
|
1091
|
+
var c = this.constructor, a = e.call(this, un(r, { name: n, index: o, operation: i, tree: s })) || this;
|
|
1092
|
+
return a.name = n, a.index = o, a.operation = i, a.tree = s, Object.setPrototypeOf(a, c.prototype), a.message = un(r, { name: n, index: o, operation: i, tree: s }), a;
|
|
1093
1093
|
}
|
|
1094
1094
|
return t;
|
|
1095
1095
|
})(Error)
|
|
1096
|
-
),
|
|
1096
|
+
), le = bn, Lr = Ae, ze = {
|
|
1097
1097
|
add: function(e, t, r) {
|
|
1098
1098
|
return e[t] = this.value, { newDocument: r };
|
|
1099
1099
|
},
|
|
@@ -1106,24 +1106,24 @@ var pn = (
|
|
|
1106
1106
|
return e[t] = this.value, { newDocument: r, removed: n };
|
|
1107
1107
|
},
|
|
1108
1108
|
move: function(e, t, r) {
|
|
1109
|
-
var n =
|
|
1110
|
-
n && (n =
|
|
1111
|
-
var o =
|
|
1112
|
-
return
|
|
1109
|
+
var n = bt(r, this.path);
|
|
1110
|
+
n && (n = Ae(n));
|
|
1111
|
+
var o = Ue(r, { op: "remove", path: this.from }).removed;
|
|
1112
|
+
return Ue(r, { op: "add", path: this.path, value: o }), { newDocument: r, removed: n };
|
|
1113
1113
|
},
|
|
1114
1114
|
copy: function(e, t, r) {
|
|
1115
|
-
var n =
|
|
1116
|
-
return
|
|
1115
|
+
var n = bt(r, this.from);
|
|
1116
|
+
return Ue(r, { op: "add", path: this.path, value: Ae(n) }), { newDocument: r };
|
|
1117
1117
|
},
|
|
1118
1118
|
test: function(e, t, r) {
|
|
1119
|
-
return { newDocument: r, test:
|
|
1119
|
+
return { newDocument: r, test: st(e[t], this.value) };
|
|
1120
1120
|
},
|
|
1121
1121
|
_get: function(e, t, r) {
|
|
1122
1122
|
return this.value = e[t], { newDocument: r };
|
|
1123
1123
|
}
|
|
1124
|
-
},
|
|
1124
|
+
}, Sr = {
|
|
1125
1125
|
add: function(e, t, r) {
|
|
1126
|
-
return
|
|
1126
|
+
return Dt(t) ? e.splice(t, 0, this.value) : e[t] = this.value, { newDocument: r, index: t };
|
|
1127
1127
|
},
|
|
1128
1128
|
remove: function(e, t, r) {
|
|
1129
1129
|
var n = e.splice(t, 1);
|
|
@@ -1133,29 +1133,29 @@ var pn = (
|
|
|
1133
1133
|
var n = e[t];
|
|
1134
1134
|
return e[t] = this.value, { newDocument: r, removed: n };
|
|
1135
1135
|
},
|
|
1136
|
-
move:
|
|
1137
|
-
copy:
|
|
1138
|
-
test:
|
|
1139
|
-
_get:
|
|
1136
|
+
move: ze.move,
|
|
1137
|
+
copy: ze.copy,
|
|
1138
|
+
test: ze.test,
|
|
1139
|
+
_get: ze._get
|
|
1140
1140
|
};
|
|
1141
|
-
function
|
|
1141
|
+
function bt(e, t) {
|
|
1142
1142
|
if (t == "")
|
|
1143
1143
|
return e;
|
|
1144
1144
|
var r = { op: "_get", path: t };
|
|
1145
|
-
return
|
|
1145
|
+
return Ue(e, r), r.value;
|
|
1146
1146
|
}
|
|
1147
|
-
function
|
|
1148
|
-
if (r === void 0 && (r = !1), n === void 0 && (n = !0), o === void 0 && (o = !0), i === void 0 && (i = 0), r && (typeof r == "function" ? r(t, 0, e, t.path) :
|
|
1147
|
+
function Ue(e, t, r, n, o, i) {
|
|
1148
|
+
if (r === void 0 && (r = !1), n === void 0 && (n = !0), o === void 0 && (o = !0), i === void 0 && (i = 0), r && (typeof r == "function" ? r(t, 0, e, t.path) : wt(t, 0)), t.path === "") {
|
|
1149
1149
|
var s = { newDocument: e };
|
|
1150
1150
|
if (t.op === "add")
|
|
1151
1151
|
return s.newDocument = t.value, s;
|
|
1152
1152
|
if (t.op === "replace")
|
|
1153
1153
|
return s.newDocument = t.value, s.removed = e, s;
|
|
1154
1154
|
if (t.op === "move" || t.op === "copy")
|
|
1155
|
-
return s.newDocument =
|
|
1155
|
+
return s.newDocument = bt(e, t.from), t.op === "move" && (s.removed = e), s;
|
|
1156
1156
|
if (t.op === "test") {
|
|
1157
|
-
if (s.test =
|
|
1158
|
-
throw new
|
|
1157
|
+
if (s.test = st(e, t.value), s.test === !1)
|
|
1158
|
+
throw new le("Test operation failed", "TEST_OPERATION_FAILED", i, t, e);
|
|
1159
1159
|
return s.newDocument = e, s;
|
|
1160
1160
|
} else {
|
|
1161
1161
|
if (t.op === "remove")
|
|
@@ -1163,104 +1163,104 @@ function xe(e, t, r, n, o, i) {
|
|
|
1163
1163
|
if (t.op === "_get")
|
|
1164
1164
|
return t.value = e, s;
|
|
1165
1165
|
if (r)
|
|
1166
|
-
throw new
|
|
1166
|
+
throw new le("Operation `op` property is not one of operations defined in RFC-6902", "OPERATION_OP_INVALID", i, t, e);
|
|
1167
1167
|
return s;
|
|
1168
1168
|
}
|
|
1169
1169
|
} else {
|
|
1170
|
-
n || (e =
|
|
1171
|
-
var c = t.path || "", a = c.split("/"), u = e, l = 1, y = a.length, p = void 0, d = void 0,
|
|
1172
|
-
for (typeof r == "function" ?
|
|
1173
|
-
if (d = a[l], d && d.indexOf("~") != -1 && (d =
|
|
1170
|
+
n || (e = Ae(e));
|
|
1171
|
+
var c = t.path || "", a = c.split("/"), u = e, l = 1, y = a.length, p = void 0, d = void 0, _ = void 0;
|
|
1172
|
+
for (typeof r == "function" ? _ = r : _ = wt; ; ) {
|
|
1173
|
+
if (d = a[l], d && d.indexOf("~") != -1 && (d = vn(d)), o && (d == "__proto__" || d == "prototype" && l > 0 && a[l - 1] == "constructor"))
|
|
1174
1174
|
throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");
|
|
1175
|
-
if (r && p === void 0 && (u[d] === void 0 ? p = a.slice(0, l).join("/") : l == y - 1 && (p = t.path), p !== void 0 &&
|
|
1175
|
+
if (r && p === void 0 && (u[d] === void 0 ? p = a.slice(0, l).join("/") : l == y - 1 && (p = t.path), p !== void 0 && _(t, 0, e, p)), l++, Array.isArray(u)) {
|
|
1176
1176
|
if (d === "-")
|
|
1177
1177
|
d = u.length;
|
|
1178
1178
|
else {
|
|
1179
|
-
if (r && !
|
|
1180
|
-
throw new
|
|
1181
|
-
|
|
1179
|
+
if (r && !Dt(d))
|
|
1180
|
+
throw new le("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index", "OPERATION_PATH_ILLEGAL_ARRAY_INDEX", i, t, e);
|
|
1181
|
+
Dt(d) && (d = ~~d);
|
|
1182
1182
|
}
|
|
1183
1183
|
if (l >= y) {
|
|
1184
1184
|
if (r && t.op === "add" && d > u.length)
|
|
1185
|
-
throw new
|
|
1186
|
-
var s =
|
|
1185
|
+
throw new le("The specified index MUST NOT be greater than the number of elements in the array", "OPERATION_VALUE_OUT_OF_BOUNDS", i, t, e);
|
|
1186
|
+
var s = Sr[t.op].call(t, u, d, e);
|
|
1187
1187
|
if (s.test === !1)
|
|
1188
|
-
throw new
|
|
1188
|
+
throw new le("Test operation failed", "TEST_OPERATION_FAILED", i, t, e);
|
|
1189
1189
|
return s;
|
|
1190
1190
|
}
|
|
1191
1191
|
} else if (l >= y) {
|
|
1192
|
-
var s =
|
|
1192
|
+
var s = ze[t.op].call(t, u, d, e);
|
|
1193
1193
|
if (s.test === !1)
|
|
1194
|
-
throw new
|
|
1194
|
+
throw new le("Test operation failed", "TEST_OPERATION_FAILED", i, t, e);
|
|
1195
1195
|
return s;
|
|
1196
1196
|
}
|
|
1197
1197
|
if (u = u[d], r && l < y && (!u || typeof u != "object"))
|
|
1198
|
-
throw new
|
|
1198
|
+
throw new le("Cannot perform operation at the desired path", "OPERATION_PATH_UNRESOLVABLE", i, t, e);
|
|
1199
1199
|
}
|
|
1200
1200
|
}
|
|
1201
1201
|
}
|
|
1202
|
-
function
|
|
1202
|
+
function Bt(e, t, r, n, o) {
|
|
1203
1203
|
if (n === void 0 && (n = !0), o === void 0 && (o = !0), r && !Array.isArray(t))
|
|
1204
|
-
throw new
|
|
1205
|
-
n || (e =
|
|
1204
|
+
throw new le("Patch sequence must be an array", "SEQUENCE_NOT_AN_ARRAY");
|
|
1205
|
+
n || (e = Ae(e));
|
|
1206
1206
|
for (var i = new Array(t.length), s = 0, c = t.length; s < c; s++)
|
|
1207
|
-
i[s] =
|
|
1207
|
+
i[s] = Ue(e, t[s], r, !0, o, s), e = i[s].newDocument;
|
|
1208
1208
|
return i.newDocument = e, i;
|
|
1209
1209
|
}
|
|
1210
|
-
function
|
|
1211
|
-
var n =
|
|
1210
|
+
function kr(e, t, r) {
|
|
1211
|
+
var n = Ue(e, t);
|
|
1212
1212
|
if (n.test === !1)
|
|
1213
|
-
throw new
|
|
1213
|
+
throw new le("Test operation failed", "TEST_OPERATION_FAILED", r, t, e);
|
|
1214
1214
|
return n.newDocument;
|
|
1215
1215
|
}
|
|
1216
|
-
function
|
|
1216
|
+
function wt(e, t, r, n) {
|
|
1217
1217
|
if (typeof e != "object" || e === null || Array.isArray(e))
|
|
1218
|
-
throw new
|
|
1219
|
-
if (
|
|
1218
|
+
throw new le("Operation is not an object", "OPERATION_NOT_AN_OBJECT", t, e, r);
|
|
1219
|
+
if (ze[e.op]) {
|
|
1220
1220
|
if (typeof e.path != "string")
|
|
1221
|
-
throw new
|
|
1221
|
+
throw new le("Operation `path` property is not a string", "OPERATION_PATH_INVALID", t, e, r);
|
|
1222
1222
|
if (e.path.indexOf("/") !== 0 && e.path.length > 0)
|
|
1223
|
-
throw new
|
|
1223
|
+
throw new le('Operation `path` property must start with "/"', "OPERATION_PATH_INVALID", t, e, r);
|
|
1224
1224
|
if ((e.op === "move" || e.op === "copy") && typeof e.from != "string")
|
|
1225
|
-
throw new
|
|
1225
|
+
throw new le("Operation `from` property is not present (applicable in `move` and `copy` operations)", "OPERATION_FROM_REQUIRED", t, e, r);
|
|
1226
1226
|
if ((e.op === "add" || e.op === "replace" || e.op === "test") && e.value === void 0)
|
|
1227
|
-
throw new
|
|
1228
|
-
if ((e.op === "add" || e.op === "replace" || e.op === "test") &&
|
|
1229
|
-
throw new
|
|
1227
|
+
throw new le("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)", "OPERATION_VALUE_REQUIRED", t, e, r);
|
|
1228
|
+
if ((e.op === "add" || e.op === "replace" || e.op === "test") && xt(e.value))
|
|
1229
|
+
throw new le("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)", "OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED", t, e, r);
|
|
1230
1230
|
if (r) {
|
|
1231
1231
|
if (e.op == "add") {
|
|
1232
1232
|
var o = e.path.split("/").length, i = n.split("/").length;
|
|
1233
1233
|
if (o !== i + 1 && o !== i)
|
|
1234
|
-
throw new
|
|
1234
|
+
throw new le("Cannot perform an `add` operation at the desired path", "OPERATION_PATH_CANNOT_ADD", t, e, r);
|
|
1235
1235
|
} else if (e.op === "replace" || e.op === "remove" || e.op === "_get") {
|
|
1236
1236
|
if (e.path !== n)
|
|
1237
|
-
throw new
|
|
1237
|
+
throw new le("Cannot perform the operation at a path that does not exist", "OPERATION_PATH_UNRESOLVABLE", t, e, r);
|
|
1238
1238
|
} else if (e.op === "move" || e.op === "copy") {
|
|
1239
|
-
var s = { op: "_get", path: e.from, value: void 0 }, c =
|
|
1239
|
+
var s = { op: "_get", path: e.from, value: void 0 }, c = wn([s], r);
|
|
1240
1240
|
if (c && c.name === "OPERATION_PATH_UNRESOLVABLE")
|
|
1241
|
-
throw new
|
|
1241
|
+
throw new le("Cannot perform the operation from a path that does not exist", "OPERATION_FROM_UNRESOLVABLE", t, e, r);
|
|
1242
1242
|
}
|
|
1243
1243
|
}
|
|
1244
|
-
} else throw new
|
|
1244
|
+
} else throw new le("Operation `op` property is not one of operations defined in RFC-6902", "OPERATION_OP_INVALID", t, e, r);
|
|
1245
1245
|
}
|
|
1246
|
-
function
|
|
1246
|
+
function wn(e, t, r) {
|
|
1247
1247
|
try {
|
|
1248
1248
|
if (!Array.isArray(e))
|
|
1249
|
-
throw new
|
|
1249
|
+
throw new le("Patch sequence must be an array", "SEQUENCE_NOT_AN_ARRAY");
|
|
1250
1250
|
if (t)
|
|
1251
|
-
|
|
1251
|
+
Bt(Ae(t), Ae(e), r || !0);
|
|
1252
1252
|
else {
|
|
1253
|
-
r = r ||
|
|
1253
|
+
r = r || wt;
|
|
1254
1254
|
for (var n = 0; n < e.length; n++)
|
|
1255
1255
|
r(e[n], n, t, void 0);
|
|
1256
1256
|
}
|
|
1257
1257
|
} catch (o) {
|
|
1258
|
-
if (o instanceof
|
|
1258
|
+
if (o instanceof le)
|
|
1259
1259
|
return o;
|
|
1260
1260
|
throw o;
|
|
1261
1261
|
}
|
|
1262
1262
|
}
|
|
1263
|
-
function
|
|
1263
|
+
function st(e, t) {
|
|
1264
1264
|
if (e === t)
|
|
1265
1265
|
return !0;
|
|
1266
1266
|
if (e && t && typeof e == "object" && typeof t == "object") {
|
|
@@ -1269,7 +1269,7 @@ function et(e, t) {
|
|
|
1269
1269
|
if (i = e.length, i != t.length)
|
|
1270
1270
|
return !1;
|
|
1271
1271
|
for (o = i; o-- !== 0; )
|
|
1272
|
-
if (!
|
|
1272
|
+
if (!st(e[o], t[o]))
|
|
1273
1273
|
return !1;
|
|
1274
1274
|
return !0;
|
|
1275
1275
|
}
|
|
@@ -1282,30 +1282,30 @@ function et(e, t) {
|
|
|
1282
1282
|
if (!t.hasOwnProperty(c[o]))
|
|
1283
1283
|
return !1;
|
|
1284
1284
|
for (o = i; o-- !== 0; )
|
|
1285
|
-
if (s = c[o], !
|
|
1285
|
+
if (s = c[o], !st(e[s], t[s]))
|
|
1286
1286
|
return !1;
|
|
1287
1287
|
return !0;
|
|
1288
1288
|
}
|
|
1289
1289
|
return e !== e && t !== t;
|
|
1290
1290
|
}
|
|
1291
|
-
const
|
|
1291
|
+
const _r = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1292
1292
|
__proto__: null,
|
|
1293
|
-
JsonPatchError:
|
|
1294
|
-
_areEquals:
|
|
1295
|
-
applyOperation:
|
|
1296
|
-
applyPatch:
|
|
1297
|
-
applyReducer:
|
|
1298
|
-
deepClone:
|
|
1299
|
-
getValueByPointer:
|
|
1300
|
-
validate:
|
|
1301
|
-
validator:
|
|
1293
|
+
JsonPatchError: le,
|
|
1294
|
+
_areEquals: st,
|
|
1295
|
+
applyOperation: Ue,
|
|
1296
|
+
applyPatch: Bt,
|
|
1297
|
+
applyReducer: kr,
|
|
1298
|
+
deepClone: Lr,
|
|
1299
|
+
getValueByPointer: bt,
|
|
1300
|
+
validate: wn,
|
|
1301
|
+
validator: wt
|
|
1302
1302
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1303
1303
|
/*!
|
|
1304
1304
|
* https://github.com/Starcounter-Jack/JSON-Patch
|
|
1305
1305
|
* (c) 2017-2021 Joachim Wester
|
|
1306
1306
|
* MIT license
|
|
1307
1307
|
*/
|
|
1308
|
-
var
|
|
1308
|
+
var Ft = /* @__PURE__ */ new WeakMap(), Pr = (
|
|
1309
1309
|
/** @class */
|
|
1310
1310
|
/* @__PURE__ */ (function() {
|
|
1311
1311
|
function e(t) {
|
|
@@ -1313,7 +1313,7 @@ var Pt = /* @__PURE__ */ new WeakMap(), Tr = (
|
|
|
1313
1313
|
}
|
|
1314
1314
|
return e;
|
|
1315
1315
|
})()
|
|
1316
|
-
),
|
|
1316
|
+
), jr = (
|
|
1317
1317
|
/** @class */
|
|
1318
1318
|
/* @__PURE__ */ (function() {
|
|
1319
1319
|
function e(t, r) {
|
|
@@ -1322,95 +1322,95 @@ var Pt = /* @__PURE__ */ new WeakMap(), Tr = (
|
|
|
1322
1322
|
return e;
|
|
1323
1323
|
})()
|
|
1324
1324
|
);
|
|
1325
|
-
function
|
|
1326
|
-
return
|
|
1325
|
+
function Rr(e) {
|
|
1326
|
+
return Ft.get(e);
|
|
1327
1327
|
}
|
|
1328
|
-
function
|
|
1328
|
+
function Dr(e, t) {
|
|
1329
1329
|
return e.observers.get(t);
|
|
1330
1330
|
}
|
|
1331
|
-
function
|
|
1331
|
+
function xr(e, t) {
|
|
1332
1332
|
e.observers.delete(t.callback);
|
|
1333
1333
|
}
|
|
1334
|
-
function
|
|
1334
|
+
function Mr(e, t) {
|
|
1335
1335
|
t.unobserve();
|
|
1336
1336
|
}
|
|
1337
|
-
function
|
|
1338
|
-
var r = [], n, o =
|
|
1337
|
+
function $r(e, t) {
|
|
1338
|
+
var r = [], n, o = Rr(e);
|
|
1339
1339
|
if (!o)
|
|
1340
|
-
o = new
|
|
1340
|
+
o = new Pr(e), Ft.set(e, o);
|
|
1341
1341
|
else {
|
|
1342
|
-
var i =
|
|
1342
|
+
var i = Dr(o, t);
|
|
1343
1343
|
n = i && i.observer;
|
|
1344
1344
|
}
|
|
1345
1345
|
if (n)
|
|
1346
1346
|
return n;
|
|
1347
|
-
if (n = {}, o.value =
|
|
1347
|
+
if (n = {}, o.value = Ae(e), t) {
|
|
1348
1348
|
n.callback = t, n.next = null;
|
|
1349
1349
|
var s = function() {
|
|
1350
|
-
|
|
1350
|
+
Mt(n);
|
|
1351
1351
|
}, c = function() {
|
|
1352
1352
|
clearTimeout(n.next), n.next = setTimeout(s);
|
|
1353
1353
|
};
|
|
1354
1354
|
typeof window < "u" && (window.addEventListener("mouseup", c), window.addEventListener("keyup", c), window.addEventListener("mousedown", c), window.addEventListener("keydown", c), window.addEventListener("change", c));
|
|
1355
1355
|
}
|
|
1356
1356
|
return n.patches = r, n.object = e, n.unobserve = function() {
|
|
1357
|
-
|
|
1358
|
-
}, o.observers.set(t, new
|
|
1357
|
+
Mt(n), clearTimeout(n.next), xr(o, n), typeof window < "u" && (window.removeEventListener("mouseup", c), window.removeEventListener("keyup", c), window.removeEventListener("mousedown", c), window.removeEventListener("keydown", c), window.removeEventListener("change", c));
|
|
1358
|
+
}, o.observers.set(t, new jr(t, n)), n;
|
|
1359
1359
|
}
|
|
1360
|
-
function
|
|
1360
|
+
function Mt(e, t) {
|
|
1361
1361
|
t === void 0 && (t = !1);
|
|
1362
|
-
var r =
|
|
1363
|
-
|
|
1362
|
+
var r = Ft.get(e.object);
|
|
1363
|
+
Ut(r.value, e.object, e.patches, "", t), e.patches.length && Bt(r.value, e.patches);
|
|
1364
1364
|
var n = e.patches;
|
|
1365
1365
|
return n.length > 0 && (e.patches = [], e.callback && e.callback(n)), n;
|
|
1366
1366
|
}
|
|
1367
|
-
function
|
|
1367
|
+
function Ut(e, t, r, n, o) {
|
|
1368
1368
|
if (t !== e) {
|
|
1369
1369
|
typeof t.toJSON == "function" && (t = t.toJSON());
|
|
1370
|
-
for (var i =
|
|
1370
|
+
for (var i = Rt(t), s = Rt(e), c = !1, a = s.length - 1; a >= 0; a--) {
|
|
1371
1371
|
var u = s[a], l = e[u];
|
|
1372
|
-
if (
|
|
1372
|
+
if (jt(t, u) && !(t[u] === void 0 && l !== void 0 && Array.isArray(t) === !1)) {
|
|
1373
1373
|
var y = t[u];
|
|
1374
|
-
typeof l == "object" && l != null && typeof y == "object" && y != null && Array.isArray(l) === Array.isArray(y) ?
|
|
1375
|
-
} else Array.isArray(e) === Array.isArray(t) ? (o && r.push({ op: "test", path: n + "/" +
|
|
1374
|
+
typeof l == "object" && l != null && typeof y == "object" && y != null && Array.isArray(l) === Array.isArray(y) ? Ut(l, y, r, n + "/" + Fe(u), o) : l !== y && (o && r.push({ op: "test", path: n + "/" + Fe(u), value: Ae(l) }), r.push({ op: "replace", path: n + "/" + Fe(u), value: Ae(y) }));
|
|
1375
|
+
} else Array.isArray(e) === Array.isArray(t) ? (o && r.push({ op: "test", path: n + "/" + Fe(u), value: Ae(l) }), r.push({ op: "remove", path: n + "/" + Fe(u) }), c = !0) : (o && r.push({ op: "test", path: n, value: e }), r.push({ op: "replace", path: n, value: t }));
|
|
1376
1376
|
}
|
|
1377
1377
|
if (!(!c && i.length == s.length))
|
|
1378
1378
|
for (var a = 0; a < i.length; a++) {
|
|
1379
1379
|
var u = i[a];
|
|
1380
|
-
!
|
|
1380
|
+
!jt(e, u) && t[u] !== void 0 && r.push({ op: "add", path: n + "/" + Fe(u), value: Ae(t[u]) });
|
|
1381
1381
|
}
|
|
1382
1382
|
}
|
|
1383
1383
|
}
|
|
1384
|
-
function
|
|
1384
|
+
function Ce(e, t, r) {
|
|
1385
1385
|
r === void 0 && (r = !1);
|
|
1386
1386
|
var n = [];
|
|
1387
|
-
return
|
|
1387
|
+
return Ut(e, t, n, "", r), n;
|
|
1388
1388
|
}
|
|
1389
|
-
const
|
|
1389
|
+
const Br = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1390
1390
|
__proto__: null,
|
|
1391
|
-
compare:
|
|
1392
|
-
generate:
|
|
1393
|
-
observe:
|
|
1394
|
-
unobserve:
|
|
1391
|
+
compare: Ce,
|
|
1392
|
+
generate: Mt,
|
|
1393
|
+
observe: $r,
|
|
1394
|
+
unobserve: Mr
|
|
1395
1395
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1396
|
-
Object.assign({},
|
|
1397
|
-
JsonPatchError:
|
|
1398
|
-
deepClone:
|
|
1399
|
-
escapePathComponent:
|
|
1400
|
-
unescapePathComponent:
|
|
1396
|
+
Object.assign({}, _r, Br, {
|
|
1397
|
+
JsonPatchError: bn,
|
|
1398
|
+
deepClone: Ae,
|
|
1399
|
+
escapePathComponent: Fe,
|
|
1400
|
+
unescapePathComponent: vn
|
|
1401
1401
|
});
|
|
1402
|
-
const
|
|
1403
|
-
function
|
|
1404
|
-
return !!(e[
|
|
1402
|
+
const At = "oneOf", Vt = "anyOf", Jt = "allOf";
|
|
1403
|
+
function Ht(e) {
|
|
1404
|
+
return !!(e[At] || e[Vt] || e[Jt]);
|
|
1405
1405
|
}
|
|
1406
|
-
function
|
|
1407
|
-
const t = e[
|
|
1406
|
+
function On(e) {
|
|
1407
|
+
const t = e[At] || e[Vt] || e[Jt];
|
|
1408
1408
|
return Array.isArray(t) ? t : void 0;
|
|
1409
1409
|
}
|
|
1410
|
-
function
|
|
1411
|
-
return e.oneOf ?
|
|
1410
|
+
function gt(e) {
|
|
1411
|
+
return e.oneOf ? At : e.anyOf ? Vt : e.allOf ? Jt : "";
|
|
1412
1412
|
}
|
|
1413
|
-
function
|
|
1413
|
+
function Fr(e, t) {
|
|
1414
1414
|
if (typeof t != "object" || t === null || Array.isArray(t))
|
|
1415
1415
|
return null;
|
|
1416
1416
|
const r = t, n = /* @__PURE__ */ new Set();
|
|
@@ -1425,7 +1425,7 @@ function jr(e, t) {
|
|
|
1425
1425
|
return { field: o, value: r[o] };
|
|
1426
1426
|
return null;
|
|
1427
1427
|
}
|
|
1428
|
-
function
|
|
1428
|
+
function mt(e, t, r = At) {
|
|
1429
1429
|
var n;
|
|
1430
1430
|
if (t.length === 0)
|
|
1431
1431
|
throw new Error("No variants provided to chooseSubschemaSync");
|
|
@@ -1436,7 +1436,7 @@ function at(e, t, r = ht) {
|
|
|
1436
1436
|
return { selectedIndex: o, schema: i };
|
|
1437
1437
|
}
|
|
1438
1438
|
if (typeof e == "object" && e !== null && !Array.isArray(e)) {
|
|
1439
|
-
const o = e, i =
|
|
1439
|
+
const o = e, i = Fr(t, e);
|
|
1440
1440
|
if (i)
|
|
1441
1441
|
for (let s = 0; s < t.length; s++) {
|
|
1442
1442
|
const c = t[s], a = (n = c.properties) == null ? void 0 : n[i.field];
|
|
@@ -1478,32 +1478,32 @@ function at(e, t, r = ht) {
|
|
|
1478
1478
|
}
|
|
1479
1479
|
return { selectedIndex: 0, schema: t[0] };
|
|
1480
1480
|
}
|
|
1481
|
-
function
|
|
1481
|
+
function $t(e, t, r) {
|
|
1482
1482
|
const n = !de(e, t), o = !de(e, r);
|
|
1483
|
-
return n && o ? de(t, r) ?
|
|
1483
|
+
return n && o ? de(t, r) ? x.SAME_CHANGE : x.TRUE_CONFLICT : n ? x.INPUT1_ONLY : o ? x.INPUT2_ONLY : x.SAME_CHANGE;
|
|
1484
1484
|
}
|
|
1485
|
-
function
|
|
1485
|
+
function De(e, t) {
|
|
1486
1486
|
try {
|
|
1487
|
-
const r =
|
|
1487
|
+
const r = mn(e);
|
|
1488
1488
|
if (!r)
|
|
1489
1489
|
return { start: 1, end: 1 };
|
|
1490
1490
|
const n = t.split("/").filter(Boolean).map((s) => {
|
|
1491
1491
|
const c = Number.parseInt(s, 10);
|
|
1492
1492
|
return !Number.isNaN(c) && String(c) === s ? c : s;
|
|
1493
|
-
}), o = n.length === 0 ? r :
|
|
1493
|
+
}), o = n.length === 0 ? r : yn(r, n);
|
|
1494
1494
|
return o ? {
|
|
1495
|
-
start:
|
|
1496
|
-
end:
|
|
1495
|
+
start: fn(e, o.offset),
|
|
1496
|
+
end: fn(e, o.offset + o.length)
|
|
1497
1497
|
} : { start: 1, end: 1 };
|
|
1498
1498
|
} catch {
|
|
1499
1499
|
return { start: 1, end: 1 };
|
|
1500
1500
|
}
|
|
1501
1501
|
}
|
|
1502
|
-
function
|
|
1502
|
+
function fn(e, t) {
|
|
1503
1503
|
return e.substring(0, t).split(`
|
|
1504
1504
|
`).length;
|
|
1505
1505
|
}
|
|
1506
|
-
function
|
|
1506
|
+
function Ur(e, t) {
|
|
1507
1507
|
const r = /* @__PURE__ */ new Map(), n = (o) => {
|
|
1508
1508
|
const i = o.split("/").filter(Boolean);
|
|
1509
1509
|
return i.length > 0 ? `/${i[0]}` : "/";
|
|
@@ -1522,7 +1522,7 @@ function Dr(e, t) {
|
|
|
1522
1522
|
}
|
|
1523
1523
|
return r;
|
|
1524
1524
|
}
|
|
1525
|
-
function
|
|
1525
|
+
function Vr(e, t, r, n, o, i) {
|
|
1526
1526
|
const s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), u = [], l = [];
|
|
1527
1527
|
for (const v of e) {
|
|
1528
1528
|
const h = v.path.match(/^(\/[^/]+(?:\/[^/]+)*)\/(\d+)(?:\/|$)/);
|
|
@@ -1548,79 +1548,79 @@ function Mr(e, t, r, n, o, i) {
|
|
|
1548
1548
|
for (const v of y) {
|
|
1549
1549
|
const h = W(r, v), m = W(n, v), f = W(o, v);
|
|
1550
1550
|
if (!Array.isArray(h) || !Array.isArray(m) || !Array.isArray(f)) {
|
|
1551
|
-
const
|
|
1552
|
-
for (const M of
|
|
1553
|
-
const
|
|
1554
|
-
if (
|
|
1555
|
-
const V =
|
|
1551
|
+
const L = c.get(v) || [], U = a.get(v) || [];
|
|
1552
|
+
for (const M of L) {
|
|
1553
|
+
const $ = M.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);
|
|
1554
|
+
if ($) {
|
|
1555
|
+
const V = $[1];
|
|
1556
1556
|
s.has(V) || s.set(V, { patches1: [], patches2: [] });
|
|
1557
|
-
const
|
|
1558
|
-
|
|
1557
|
+
const E = s.get(V);
|
|
1558
|
+
E && E.patches1.push(M);
|
|
1559
1559
|
}
|
|
1560
1560
|
}
|
|
1561
|
-
for (const M of
|
|
1562
|
-
const
|
|
1563
|
-
if (
|
|
1564
|
-
const V =
|
|
1561
|
+
for (const M of U) {
|
|
1562
|
+
const $ = M.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);
|
|
1563
|
+
if ($) {
|
|
1564
|
+
const V = $[1];
|
|
1565
1565
|
s.has(V) || s.set(V, { patches1: [], patches2: [] });
|
|
1566
|
-
const
|
|
1567
|
-
|
|
1566
|
+
const E = s.get(V);
|
|
1567
|
+
E && E.patches2.push(M);
|
|
1568
1568
|
}
|
|
1569
1569
|
}
|
|
1570
1570
|
continue;
|
|
1571
1571
|
}
|
|
1572
|
-
const
|
|
1572
|
+
const I = Xe(i, v, r), S = I != null && I.items ? Array.isArray(I.items) && I.items[0] ? I.items[0] : Array.isArray(I.items) ? null : I.items : null, g = S && typeof S == "object" ? S : null;
|
|
1573
1573
|
if (g) {
|
|
1574
|
-
const
|
|
1575
|
-
if (
|
|
1576
|
-
const
|
|
1577
|
-
for (const [
|
|
1578
|
-
R.base !== void 0 &&
|
|
1579
|
-
const V = c.get(v) || [],
|
|
1580
|
-
for (const
|
|
1581
|
-
const R =
|
|
1574
|
+
const L = Gr(h, m, f, g);
|
|
1575
|
+
if (L.size > 0) {
|
|
1576
|
+
const U = /* @__PURE__ */ new Map(), M = /* @__PURE__ */ new Map(), $ = /* @__PURE__ */ new Map();
|
|
1577
|
+
for (const [A, R] of L.entries())
|
|
1578
|
+
R.base !== void 0 && U.set(R.base, A), R.input1 !== void 0 && M.set(R.input1, A), R.input2 !== void 0 && $.set(R.input2, A);
|
|
1579
|
+
const V = c.get(v) || [], E = a.get(v) || [];
|
|
1580
|
+
for (const A of V) {
|
|
1581
|
+
const R = A.path.match(/^\/[^/]+(?:\/[^/]+)*\/(\d+)(?:\/|$)/);
|
|
1582
1582
|
if (R) {
|
|
1583
|
-
const X = Number.parseInt(R[1], 10),
|
|
1584
|
-
if (
|
|
1585
|
-
const
|
|
1586
|
-
s.has(
|
|
1587
|
-
const
|
|
1588
|
-
|
|
1583
|
+
const X = Number.parseInt(R[1], 10), re = M.get(X);
|
|
1584
|
+
if (re !== void 0) {
|
|
1585
|
+
const oe = `${v}#${re}`;
|
|
1586
|
+
s.has(oe) || s.set(oe, { patches1: [], patches2: [] });
|
|
1587
|
+
const ge = s.get(oe);
|
|
1588
|
+
ge && ge.patches1.push(A);
|
|
1589
1589
|
}
|
|
1590
1590
|
}
|
|
1591
1591
|
}
|
|
1592
|
-
for (const
|
|
1593
|
-
const R =
|
|
1592
|
+
for (const A of E) {
|
|
1593
|
+
const R = A.path.match(/^\/[^/]+(?:\/[^/]+)*\/(\d+)(?:\/|$)/);
|
|
1594
1594
|
if (R) {
|
|
1595
|
-
const X = Number.parseInt(R[1], 10),
|
|
1596
|
-
if (
|
|
1597
|
-
const
|
|
1598
|
-
s.has(
|
|
1599
|
-
const
|
|
1600
|
-
|
|
1595
|
+
const X = Number.parseInt(R[1], 10), re = $.get(X);
|
|
1596
|
+
if (re !== void 0) {
|
|
1597
|
+
const oe = `${v}#${re}`;
|
|
1598
|
+
s.has(oe) || s.set(oe, { patches1: [], patches2: [] });
|
|
1599
|
+
const ge = s.get(oe);
|
|
1600
|
+
ge && ge.patches2.push(A);
|
|
1601
1601
|
}
|
|
1602
1602
|
}
|
|
1603
1603
|
}
|
|
1604
1604
|
continue;
|
|
1605
1605
|
}
|
|
1606
1606
|
}
|
|
1607
|
-
const b = c.get(v) || [],
|
|
1608
|
-
for (const
|
|
1609
|
-
const
|
|
1610
|
-
if (
|
|
1611
|
-
const M =
|
|
1607
|
+
const b = c.get(v) || [], D = a.get(v) || [];
|
|
1608
|
+
for (const L of b) {
|
|
1609
|
+
const U = L.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);
|
|
1610
|
+
if (U) {
|
|
1611
|
+
const M = U[1];
|
|
1612
1612
|
s.has(M) || s.set(M, { patches1: [], patches2: [] });
|
|
1613
|
-
const
|
|
1614
|
-
|
|
1613
|
+
const $ = s.get(M);
|
|
1614
|
+
$ && $.patches1.push(L);
|
|
1615
1615
|
}
|
|
1616
1616
|
}
|
|
1617
|
-
for (const
|
|
1618
|
-
const
|
|
1619
|
-
if (
|
|
1620
|
-
const M =
|
|
1617
|
+
for (const L of D) {
|
|
1618
|
+
const U = L.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);
|
|
1619
|
+
if (U) {
|
|
1620
|
+
const M = U[1];
|
|
1621
1621
|
s.has(M) || s.set(M, { patches1: [], patches2: [] });
|
|
1622
|
-
const
|
|
1623
|
-
|
|
1622
|
+
const $ = s.get(M);
|
|
1623
|
+
$ && $.patches2.push(L);
|
|
1624
1624
|
}
|
|
1625
1625
|
}
|
|
1626
1626
|
}
|
|
@@ -1628,18 +1628,18 @@ function Mr(e, t, r, n, o, i) {
|
|
|
1628
1628
|
if (!h) return null;
|
|
1629
1629
|
const m = v.split("/").filter(Boolean);
|
|
1630
1630
|
if (m.length < 2) return null;
|
|
1631
|
-
const f = `/${m[0]}`,
|
|
1632
|
-
return
|
|
1633
|
-
}, d = [...u],
|
|
1631
|
+
const f = `/${m[0]}`, I = Xe(h, f);
|
|
1632
|
+
return I && Ht(I) ? f : null;
|
|
1633
|
+
}, d = [...u], _ = [...l], T = /* @__PURE__ */ new Set();
|
|
1634
1634
|
for (const v of d) {
|
|
1635
1635
|
const h = p(v.path, i);
|
|
1636
|
-
h &&
|
|
1636
|
+
h && T.add(h);
|
|
1637
1637
|
}
|
|
1638
|
-
for (const v of
|
|
1638
|
+
for (const v of _) {
|
|
1639
1639
|
const h = p(v.path, i);
|
|
1640
|
-
h &&
|
|
1640
|
+
h && T.add(h);
|
|
1641
1641
|
}
|
|
1642
|
-
for (const v of
|
|
1642
|
+
for (const v of T)
|
|
1643
1643
|
s.has(v) || s.set(v, { patches1: [], patches2: [] });
|
|
1644
1644
|
for (const v of d) {
|
|
1645
1645
|
const h = v.path, m = p(h, i);
|
|
@@ -1652,7 +1652,7 @@ function Mr(e, t, r, n, o, i) {
|
|
|
1652
1652
|
f && f.patches1.push(v);
|
|
1653
1653
|
}
|
|
1654
1654
|
}
|
|
1655
|
-
for (const v of
|
|
1655
|
+
for (const v of _) {
|
|
1656
1656
|
const h = v.path, m = p(h, i);
|
|
1657
1657
|
if (m) {
|
|
1658
1658
|
const f = s.get(m);
|
|
@@ -1665,7 +1665,7 @@ function Mr(e, t, r, n, o, i) {
|
|
|
1665
1665
|
}
|
|
1666
1666
|
return s;
|
|
1667
1667
|
}
|
|
1668
|
-
function
|
|
1668
|
+
function Xe(e, t, r) {
|
|
1669
1669
|
if (!e)
|
|
1670
1670
|
return null;
|
|
1671
1671
|
const n = t.split("/").filter(Boolean);
|
|
@@ -1674,12 +1674,12 @@ function qe(e, t, r) {
|
|
|
1674
1674
|
let o = e, i = "";
|
|
1675
1675
|
for (let s = 0; s < n.length; s++) {
|
|
1676
1676
|
const c = n[s], a = Number.parseInt(c, 10), u = !Number.isNaN(a) && String(a) === c;
|
|
1677
|
-
if (o &&
|
|
1678
|
-
const l =
|
|
1677
|
+
if (o && Ht(o)) {
|
|
1678
|
+
const l = On(o), y = gt(o), p = r ? W(r, i || "/") : void 0;
|
|
1679
1679
|
if (l && l.length > 0)
|
|
1680
1680
|
if (p !== void 0)
|
|
1681
1681
|
try {
|
|
1682
|
-
const { schema: d } =
|
|
1682
|
+
const { schema: d } = mt(p, l, y);
|
|
1683
1683
|
o = d;
|
|
1684
1684
|
} catch {
|
|
1685
1685
|
l.length > 0 && l[0] && (o = l[0]);
|
|
@@ -1707,7 +1707,7 @@ function qe(e, t, r) {
|
|
|
1707
1707
|
}
|
|
1708
1708
|
return o;
|
|
1709
1709
|
}
|
|
1710
|
-
function
|
|
1710
|
+
function An(e) {
|
|
1711
1711
|
if (!e || typeof e != "object")
|
|
1712
1712
|
return [];
|
|
1713
1713
|
const t = [];
|
|
@@ -1727,12 +1727,12 @@ function gn(e) {
|
|
|
1727
1727
|
}
|
|
1728
1728
|
return t;
|
|
1729
1729
|
}
|
|
1730
|
-
function
|
|
1731
|
-
const t =
|
|
1730
|
+
function Jr(e) {
|
|
1731
|
+
const t = An(e);
|
|
1732
1732
|
return t.length > 0 ? t[0] : null;
|
|
1733
1733
|
}
|
|
1734
|
-
function
|
|
1735
|
-
const n = /* @__PURE__ */ new Map(), o =
|
|
1734
|
+
function Hr(e, t, r) {
|
|
1735
|
+
const n = /* @__PURE__ */ new Map(), o = An(r);
|
|
1736
1736
|
if (o.length === 0)
|
|
1737
1737
|
return n;
|
|
1738
1738
|
const i = (c) => {
|
|
@@ -1756,8 +1756,8 @@ function $r(e, t, r) {
|
|
|
1756
1756
|
};
|
|
1757
1757
|
return s(e, "input1"), s(t, "input2"), n;
|
|
1758
1758
|
}
|
|
1759
|
-
function
|
|
1760
|
-
const o = /* @__PURE__ */ new Map(), i =
|
|
1759
|
+
function Gr(e, t, r, n) {
|
|
1760
|
+
const o = /* @__PURE__ */ new Map(), i = Jr(n);
|
|
1761
1761
|
if (!i)
|
|
1762
1762
|
return o;
|
|
1763
1763
|
const s = (c, a) => {
|
|
@@ -1775,23 +1775,23 @@ function Br(e, t, r, n) {
|
|
|
1775
1775
|
};
|
|
1776
1776
|
return s(e, "base"), s(t, "input1"), s(r, "input2"), o;
|
|
1777
1777
|
}
|
|
1778
|
-
function
|
|
1779
|
-
const o = typeof e == "object" && e !== null || Array.isArray(e) ? e : {}, i = typeof t == "object" && t !== null || Array.isArray(t) ? t : {}, s = typeof r == "object" && r !== null || Array.isArray(r) ? r : {}, c =
|
|
1780
|
-
let u =
|
|
1781
|
-
n && (u =
|
|
1782
|
-
const l = [], y = /* @__PURE__ */ new Set(), p = (d,
|
|
1783
|
-
if (!n || typeof
|
|
1784
|
-
const h =
|
|
1785
|
-
if (!h || !
|
|
1786
|
-
const m =
|
|
1778
|
+
function Wr(e, t, r, n) {
|
|
1779
|
+
const o = typeof e == "object" && e !== null || Array.isArray(e) ? e : {}, i = typeof t == "object" && t !== null || Array.isArray(t) ? t : {}, s = typeof r == "object" && r !== null || Array.isArray(r) ? r : {}, c = Ce(o, i), a = Ce(o, s);
|
|
1780
|
+
let u = Ur(c, a);
|
|
1781
|
+
n && (u = Vr(c, a, e, t, r, n));
|
|
1782
|
+
const l = [], y = /* @__PURE__ */ new Set(), p = (d, _, T, v) => {
|
|
1783
|
+
if (!n || typeof _ != "object" || _ === null || Array.isArray(_) || typeof T != "object" || T === null || Array.isArray(T) || typeof v != "object" || v === null || Array.isArray(v)) return !1;
|
|
1784
|
+
const h = Xe(n, d, _);
|
|
1785
|
+
if (!h || !Ht(h)) return !1;
|
|
1786
|
+
const m = On(h);
|
|
1787
1787
|
if (!m || m.length < 2) return !1;
|
|
1788
|
-
const f =
|
|
1789
|
-
return
|
|
1788
|
+
const f = mt(_, m, gt(h)), I = mt(T, m, gt(h)), S = mt(v, m, gt(h));
|
|
1789
|
+
return I.selectedIndex !== S.selectedIndex && (f.selectedIndex !== I.selectedIndex || f.selectedIndex !== S.selectedIndex);
|
|
1790
1790
|
};
|
|
1791
|
-
for (const [d, { patches1:
|
|
1791
|
+
for (const [d, { patches1: _, patches2: T }] of u) {
|
|
1792
1792
|
y.add(d);
|
|
1793
1793
|
let v = d;
|
|
1794
|
-
|
|
1794
|
+
_.length > 0 ? v = _[0].path : T.length > 0 ? v = T[0].path : d.includes("#") && (v = d.split("#")[0]);
|
|
1795
1795
|
let h = d;
|
|
1796
1796
|
if (d.includes("#"))
|
|
1797
1797
|
h = d.split("#")[0];
|
|
@@ -1799,149 +1799,149 @@ function Fr(e, t, r, n) {
|
|
|
1799
1799
|
const M = d.split("/").filter(Boolean);
|
|
1800
1800
|
M.length > 1 && (h = `/${M[0]}`);
|
|
1801
1801
|
}
|
|
1802
|
-
if ([...
|
|
1803
|
-
const M = W(e, h),
|
|
1804
|
-
if (p(h, M,
|
|
1805
|
-
const
|
|
1806
|
-
let
|
|
1807
|
-
!de(
|
|
1808
|
-
const
|
|
1809
|
-
(
|
|
1810
|
-
),
|
|
1811
|
-
for (const
|
|
1812
|
-
const
|
|
1813
|
-
let
|
|
1814
|
-
|
|
1802
|
+
if ([..._, ...T].every((M) => (M.path.split("/").slice(0, 2).join("/") || `/${M.path.split("/")[1]}`) === h) && h !== v) {
|
|
1803
|
+
const M = W(e, h), $ = W(t, h), V = W(r, h);
|
|
1804
|
+
if (p(h, M, $, V)) {
|
|
1805
|
+
const A = M, R = $, X = V;
|
|
1806
|
+
let re = $t(A, R, X);
|
|
1807
|
+
!de(A, R) && !de(A, X) && !de(R, X) && (re = x.TRUE_CONFLICT);
|
|
1808
|
+
const oe = [..._, ...T].filter(
|
|
1809
|
+
(be) => be.path.startsWith(`${h}/`) || be.path === h
|
|
1810
|
+
), ge = [], ke = [];
|
|
1811
|
+
for (const be of oe) {
|
|
1812
|
+
const at = be.path, Ne = e !== void 0 ? W(e, at) : void 0, Q = W(t, at), pe = W(r, at);
|
|
1813
|
+
let ee = !1, B = !1;
|
|
1814
|
+
be.op === "replace" ? Ne !== void 0 && (ee = !de(Ne, Q), B = !de(Ne, pe)) : be.op === "add" ? (ee = Ne === void 0 && Q !== void 0, B = Ne === void 0 && pe !== void 0) : be.op === "remove" && (ee = Ne !== void 0 && Q === void 0, B = Ne !== void 0 && pe === void 0), Ne !== void 0 && (Q !== void 0 && de(Ne, Q) && (ee = !1), pe !== void 0 && de(Ne, pe) && (B = !1)), ee && ge.push(be), B && ke.push(be);
|
|
1815
1815
|
}
|
|
1816
1816
|
l.push({
|
|
1817
1817
|
path: h,
|
|
1818
|
-
baseValue:
|
|
1818
|
+
baseValue: A,
|
|
1819
1819
|
input1Value: R,
|
|
1820
1820
|
input2Value: X,
|
|
1821
|
-
conflictType:
|
|
1822
|
-
patches1:
|
|
1823
|
-
patches2:
|
|
1821
|
+
conflictType: re,
|
|
1822
|
+
patches1: ge,
|
|
1823
|
+
patches2: ke
|
|
1824
1824
|
});
|
|
1825
1825
|
continue;
|
|
1826
1826
|
}
|
|
1827
1827
|
}
|
|
1828
|
-
const f = W(e, v),
|
|
1829
|
-
let g =
|
|
1830
|
-
const b = f != null,
|
|
1831
|
-
!b &&
|
|
1828
|
+
const f = W(e, v), I = W(t, v), S = W(r, v);
|
|
1829
|
+
let g = $t(f, I, S);
|
|
1830
|
+
const b = f != null, D = I != null, L = S != null;
|
|
1831
|
+
!b && D && L && g !== x.SAME_CHANGE && (g = x.TRUE_CONFLICT), b && de(f, I) && de(f, S) || l.push({
|
|
1832
1832
|
path: v,
|
|
1833
1833
|
// Use representative path for conflict (actual patch paths are in patches1/patches2)
|
|
1834
1834
|
baseValue: f,
|
|
1835
|
-
input1Value:
|
|
1835
|
+
input1Value: I,
|
|
1836
1836
|
input2Value: S,
|
|
1837
1837
|
conflictType: g,
|
|
1838
|
-
patches1:
|
|
1838
|
+
patches1: _,
|
|
1839
1839
|
// JSON Patch operations for base?input1 (contain actual paths with indices)
|
|
1840
|
-
patches2:
|
|
1840
|
+
patches2: T
|
|
1841
1841
|
// JSON Patch operations for base?input2 (contain actual paths with indices)
|
|
1842
1842
|
});
|
|
1843
1843
|
}
|
|
1844
1844
|
return l;
|
|
1845
1845
|
}
|
|
1846
|
-
function
|
|
1847
|
-
var y, p, d,
|
|
1848
|
-
const n = typeof e == "object" && e !== null || Array.isArray(e) ? e : {}, o = typeof t == "object" && t !== null || Array.isArray(t) ? t : {}, i =
|
|
1846
|
+
function qr(e, t, r) {
|
|
1847
|
+
var y, p, d, _;
|
|
1848
|
+
const n = typeof e == "object" && e !== null || Array.isArray(e) ? e : {}, o = typeof t == "object" && t !== null || Array.isArray(t) ? t : {}, i = Ce(n, o);
|
|
1849
1849
|
if (i.length === 0)
|
|
1850
1850
|
return [];
|
|
1851
1851
|
const s = [], c = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map(), u = [];
|
|
1852
|
-
for (const
|
|
1853
|
-
const v =
|
|
1852
|
+
for (const T of i) {
|
|
1853
|
+
const v = T.path.match(/^(\/[^/]+(?:\/[^/]+)*)\/(\d+)(?:\/|$)/);
|
|
1854
1854
|
if (v) {
|
|
1855
1855
|
const h = v[1];
|
|
1856
1856
|
a.has(h) || a.set(h, []);
|
|
1857
1857
|
const m = a.get(h);
|
|
1858
|
-
m && m.push(
|
|
1858
|
+
m && m.push(T);
|
|
1859
1859
|
} else
|
|
1860
|
-
u.push(
|
|
1860
|
+
u.push(T);
|
|
1861
1861
|
}
|
|
1862
|
-
for (const [
|
|
1863
|
-
const h = W(e,
|
|
1862
|
+
for (const [T, v] of a) {
|
|
1863
|
+
const h = W(e, T), m = W(t, T);
|
|
1864
1864
|
if (!Array.isArray(h) || !Array.isArray(m)) {
|
|
1865
1865
|
const g = /* @__PURE__ */ new Map();
|
|
1866
1866
|
for (const b of v) {
|
|
1867
|
-
const
|
|
1868
|
-
if (
|
|
1869
|
-
const
|
|
1870
|
-
g.has(
|
|
1867
|
+
const D = b.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);
|
|
1868
|
+
if (D) {
|
|
1869
|
+
const L = D[1];
|
|
1870
|
+
g.has(L) || g.set(L, []), (y = g.get(L)) == null || y.push(b);
|
|
1871
1871
|
}
|
|
1872
1872
|
}
|
|
1873
|
-
for (const [b,
|
|
1874
|
-
s.push(...
|
|
1873
|
+
for (const [b, D] of g)
|
|
1874
|
+
s.push(...rt(b, D, e, t, void 0)), c.add(b);
|
|
1875
1875
|
continue;
|
|
1876
1876
|
}
|
|
1877
|
-
const f = r ?
|
|
1877
|
+
const f = r ? Xe(r, T, e) : null, I = f != null && f.items ? Array.isArray(f.items) && f.items[0] ? f.items[0] : Array.isArray(f.items) ? null : f.items : null, S = I && typeof I == "object" ? I : null;
|
|
1878
1878
|
if (S) {
|
|
1879
|
-
const g =
|
|
1880
|
-
for (const [
|
|
1881
|
-
V.input1 !== void 0 && b.set(V.input1,
|
|
1882
|
-
const
|
|
1883
|
-
for (const
|
|
1884
|
-
const V =
|
|
1879
|
+
const g = Hr(h, m, S), b = /* @__PURE__ */ new Map(), D = /* @__PURE__ */ new Map();
|
|
1880
|
+
for (const [$, V] of g.entries())
|
|
1881
|
+
V.input1 !== void 0 && b.set(V.input1, $), V.input2 !== void 0 && D.set(V.input2, $);
|
|
1882
|
+
const L = /* @__PURE__ */ new Map(), U = [];
|
|
1883
|
+
for (const $ of v) {
|
|
1884
|
+
const V = $.path.match(/^\/[^/]+(?:\/[^/]+)*\/(\d+)(?:\/|$)/);
|
|
1885
1885
|
if (V) {
|
|
1886
|
-
const
|
|
1887
|
-
let
|
|
1888
|
-
if (
|
|
1889
|
-
|
|
1890
|
-
const R =
|
|
1891
|
-
R && R.push(
|
|
1886
|
+
const E = Number.parseInt(V[1], 10);
|
|
1887
|
+
let A;
|
|
1888
|
+
if ($.op === "add" ? A = D.get(E) : A = b.get(E), A) {
|
|
1889
|
+
L.has(A) || L.set(A, []);
|
|
1890
|
+
const R = L.get(A);
|
|
1891
|
+
R && R.push($);
|
|
1892
1892
|
} else
|
|
1893
|
-
|
|
1893
|
+
U.push($);
|
|
1894
1894
|
}
|
|
1895
1895
|
}
|
|
1896
|
-
for (const [
|
|
1897
|
-
const
|
|
1898
|
-
if (!
|
|
1899
|
-
const
|
|
1900
|
-
s.push(...
|
|
1896
|
+
for (const [$, V] of L) {
|
|
1897
|
+
const E = g.get($);
|
|
1898
|
+
if (!E) continue;
|
|
1899
|
+
const A = E.input1 !== void 0 ? `${T}/${E.input1}` : `${T}/${E.input2}`;
|
|
1900
|
+
s.push(...rt(A, V, e, t, void 0)), c.add(A);
|
|
1901
1901
|
}
|
|
1902
1902
|
const M = /* @__PURE__ */ new Map();
|
|
1903
|
-
for (const
|
|
1904
|
-
const V =
|
|
1903
|
+
for (const $ of U) {
|
|
1904
|
+
const V = $.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);
|
|
1905
1905
|
if (V) {
|
|
1906
|
-
const
|
|
1907
|
-
M.has(
|
|
1906
|
+
const E = V[1];
|
|
1907
|
+
M.has(E) || M.set(E, []), (p = M.get(E)) == null || p.push($);
|
|
1908
1908
|
}
|
|
1909
1909
|
}
|
|
1910
|
-
for (const [
|
|
1911
|
-
c.has(
|
|
1910
|
+
for (const [$, V] of M)
|
|
1911
|
+
c.has($) || (s.push(...rt($, V, e, t, void 0)), c.add($));
|
|
1912
1912
|
} else {
|
|
1913
1913
|
const g = /* @__PURE__ */ new Map();
|
|
1914
1914
|
for (const b of v) {
|
|
1915
|
-
const
|
|
1916
|
-
if (
|
|
1917
|
-
const
|
|
1918
|
-
g.has(
|
|
1915
|
+
const D = b.path.match(/^(\/[^/]+(?:\/[^/]+)*\/\d+)(?:\/|$)/);
|
|
1916
|
+
if (D) {
|
|
1917
|
+
const L = D[1];
|
|
1918
|
+
g.has(L) || g.set(L, []), (d = g.get(L)) == null || d.push(b);
|
|
1919
1919
|
}
|
|
1920
1920
|
}
|
|
1921
|
-
for (const [b,
|
|
1922
|
-
s.push(...
|
|
1921
|
+
for (const [b, D] of g)
|
|
1922
|
+
s.push(...rt(b, D, e, t, void 0)), c.add(b);
|
|
1923
1923
|
}
|
|
1924
1924
|
}
|
|
1925
1925
|
const l = /* @__PURE__ */ new Map();
|
|
1926
|
-
for (const
|
|
1927
|
-
const v =
|
|
1928
|
-
l.has(h) || l.set(h, []), (
|
|
1926
|
+
for (const T of u) {
|
|
1927
|
+
const v = T.path.split("/").filter(Boolean), h = v.length > 0 ? `/${v[0]}` : "/";
|
|
1928
|
+
l.has(h) || l.set(h, []), (_ = l.get(h)) == null || _.push(T);
|
|
1929
1929
|
}
|
|
1930
|
-
for (const [
|
|
1931
|
-
s.push(...
|
|
1930
|
+
for (const [T, v] of l)
|
|
1931
|
+
s.push(...rt(T, v, e, t, void 0));
|
|
1932
1932
|
return s;
|
|
1933
1933
|
}
|
|
1934
|
-
function
|
|
1934
|
+
function rt(e, t, r, n, o) {
|
|
1935
1935
|
const i = o !== void 0 ? W(o, e) : void 0, s = W(r, e), c = W(n, e), a = [], u = [];
|
|
1936
1936
|
for (const f of t) {
|
|
1937
|
-
const
|
|
1938
|
-
let b = !1,
|
|
1939
|
-
f.op === "add" ? (b = !1,
|
|
1937
|
+
const I = f.path, S = W(r, I), g = W(n, I);
|
|
1938
|
+
let b = !1, D = !1;
|
|
1939
|
+
f.op === "add" ? (b = !1, D = g !== void 0) : f.op === "remove" ? (b = S !== void 0, D = !1) : f.op === "replace" && (b = S !== void 0 && !de(S, g), D = g !== void 0 && !de(S, g)), I === e && (b = !0, D = !0), b && a.push(f), D && u.push(f);
|
|
1940
1940
|
}
|
|
1941
1941
|
if (a.length === 0 && u.length === 0 && i !== void 0 && s !== void 0 && c !== void 0 && de(i, s) && de(i, c))
|
|
1942
1942
|
return [];
|
|
1943
|
-
const l = a.length > 0 ? a : t, y = u.length > 0 ? u : t, p = [...l, ...y], d = p.some((f) => f.op === "add"),
|
|
1944
|
-
if (d && !
|
|
1943
|
+
const l = a.length > 0 ? a : t, y = u.length > 0 ? u : t, p = [...l, ...y], d = p.some((f) => f.op === "add"), _ = p.some((f) => f.op === "remove"), T = p.some((f) => f.op === "replace");
|
|
1944
|
+
if (d && !T && !_) {
|
|
1945
1945
|
if (s !== void 0 && c === void 0)
|
|
1946
1946
|
return [
|
|
1947
1947
|
{
|
|
@@ -1949,7 +1949,7 @@ function Ze(e, t, r, n, o) {
|
|
|
1949
1949
|
baseValue: void 0,
|
|
1950
1950
|
input1Value: s,
|
|
1951
1951
|
input2Value: void 0,
|
|
1952
|
-
conflictType:
|
|
1952
|
+
conflictType: x.INPUT1_ONLY,
|
|
1953
1953
|
patches1: l,
|
|
1954
1954
|
// Highlight on input1 (new content) - use filtered patches1
|
|
1955
1955
|
patches2: []
|
|
@@ -1963,7 +1963,7 @@ function Ze(e, t, r, n, o) {
|
|
|
1963
1963
|
baseValue: void 0,
|
|
1964
1964
|
input1Value: void 0,
|
|
1965
1965
|
input2Value: c,
|
|
1966
|
-
conflictType:
|
|
1966
|
+
conflictType: x.INPUT2_ONLY,
|
|
1967
1967
|
patches1: [],
|
|
1968
1968
|
// No highlighting on input1 (doesn't exist there)
|
|
1969
1969
|
patches2: y
|
|
@@ -1971,7 +1971,7 @@ function Ze(e, t, r, n, o) {
|
|
|
1971
1971
|
}
|
|
1972
1972
|
];
|
|
1973
1973
|
}
|
|
1974
|
-
if (
|
|
1974
|
+
if (_ && !d && !T) {
|
|
1975
1975
|
if (s !== void 0 && c === void 0)
|
|
1976
1976
|
return [
|
|
1977
1977
|
{
|
|
@@ -1979,7 +1979,7 @@ function Ze(e, t, r, n, o) {
|
|
|
1979
1979
|
baseValue: s,
|
|
1980
1980
|
input1Value: s,
|
|
1981
1981
|
input2Value: void 0,
|
|
1982
|
-
conflictType:
|
|
1982
|
+
conflictType: x.INPUT1_ONLY,
|
|
1983
1983
|
patches1: l,
|
|
1984
1984
|
// Highlight on input1 (removed content) - use filtered patches1
|
|
1985
1985
|
patches2: []
|
|
@@ -1993,7 +1993,7 @@ function Ze(e, t, r, n, o) {
|
|
|
1993
1993
|
baseValue: c,
|
|
1994
1994
|
input1Value: void 0,
|
|
1995
1995
|
input2Value: c,
|
|
1996
|
-
conflictType:
|
|
1996
|
+
conflictType: x.INPUT2_ONLY,
|
|
1997
1997
|
patches1: [],
|
|
1998
1998
|
// No highlighting on input1 (doesn't exist there)
|
|
1999
1999
|
patches2: y
|
|
@@ -2001,19 +2001,19 @@ function Ze(e, t, r, n, o) {
|
|
|
2001
2001
|
}
|
|
2002
2002
|
];
|
|
2003
2003
|
}
|
|
2004
|
-
const v =
|
|
2004
|
+
const v = $t(i, s, c);
|
|
2005
2005
|
let h = [], m = [];
|
|
2006
2006
|
switch (v) {
|
|
2007
|
-
case
|
|
2007
|
+
case x.INPUT1_ONLY:
|
|
2008
2008
|
h = l, m = [];
|
|
2009
2009
|
break;
|
|
2010
|
-
case
|
|
2010
|
+
case x.INPUT2_ONLY:
|
|
2011
2011
|
h = [], m = y;
|
|
2012
2012
|
break;
|
|
2013
|
-
case
|
|
2013
|
+
case x.SAME_CHANGE:
|
|
2014
2014
|
h = l, m = y;
|
|
2015
2015
|
break;
|
|
2016
|
-
case
|
|
2016
|
+
case x.TRUE_CONFLICT:
|
|
2017
2017
|
h = l, m = y;
|
|
2018
2018
|
break;
|
|
2019
2019
|
}
|
|
@@ -2029,66 +2029,66 @@ function Ze(e, t, r, n, o) {
|
|
|
2029
2029
|
}
|
|
2030
2030
|
];
|
|
2031
2031
|
}
|
|
2032
|
-
function
|
|
2032
|
+
function _t(e, t) {
|
|
2033
2033
|
if (!t || t.length === 0)
|
|
2034
2034
|
return { start: 1, end: 1 };
|
|
2035
2035
|
let r = Number.MAX_SAFE_INTEGER, n = 0, o = !1;
|
|
2036
2036
|
for (const i of t) {
|
|
2037
|
-
const s =
|
|
2037
|
+
const s = De(e, i.path);
|
|
2038
2038
|
s.start === 1 && s.end === 1 || (r = Math.min(r, s.start), n = Math.max(n, s.end), o = !0);
|
|
2039
2039
|
}
|
|
2040
2040
|
return !o || r === Number.MAX_SAFE_INTEGER || n === 0 ? { start: 1, end: 1 } : { start: r, end: n };
|
|
2041
2041
|
}
|
|
2042
|
-
function
|
|
2042
|
+
function Yr(e, t, r, n) {
|
|
2043
2043
|
var i, s, c, a, u, l;
|
|
2044
2044
|
const o = [];
|
|
2045
2045
|
for (let y = 0; y < e.length; y++) {
|
|
2046
2046
|
const p = e[y];
|
|
2047
|
-
let d,
|
|
2048
|
-
(((i = p.patches1) == null ? void 0 : i.length) ?? 0) === 0 && (((s = p.patches2) == null ? void 0 : s.length) ?? 0) === 0 ? (d = t ?
|
|
2049
|
-
const v = p.conflictType ===
|
|
2050
|
-
let h =
|
|
2047
|
+
let d, _, T;
|
|
2048
|
+
(((i = p.patches1) == null ? void 0 : i.length) ?? 0) === 0 && (((s = p.patches2) == null ? void 0 : s.length) ?? 0) === 0 ? (d = t ? De(t, p.path) : { start: 1, end: 1 }, _ = De(r, p.path), T = De(n, p.path)) : (d = _t(t, [...p.patches1 || [], ...p.patches2 || []]), _ = _t(r, p.patches1 || []), T = _t(n, p.patches2 || []));
|
|
2049
|
+
const v = p.conflictType === x.TRUE_CONFLICT;
|
|
2050
|
+
let h = ne.excluded, m = ne.excluded;
|
|
2051
2051
|
switch (p.conflictType) {
|
|
2052
|
-
case
|
|
2053
|
-
h =
|
|
2052
|
+
case x.SAME_CHANGE:
|
|
2053
|
+
h = ne.first, m = ne.first;
|
|
2054
2054
|
break;
|
|
2055
|
-
case
|
|
2056
|
-
h =
|
|
2055
|
+
case x.INPUT1_ONLY:
|
|
2056
|
+
h = ne.first;
|
|
2057
2057
|
break;
|
|
2058
|
-
case
|
|
2059
|
-
m =
|
|
2058
|
+
case x.INPUT2_ONLY:
|
|
2059
|
+
m = ne.first;
|
|
2060
2060
|
break;
|
|
2061
|
-
case
|
|
2062
|
-
m =
|
|
2061
|
+
case x.TRUE_CONFLICT:
|
|
2062
|
+
m = ne.first;
|
|
2063
2063
|
break;
|
|
2064
2064
|
}
|
|
2065
|
-
const f = [],
|
|
2065
|
+
const f = [], I = [];
|
|
2066
2066
|
if (p.patches1 && (p.patches1.length ?? 0) > 0)
|
|
2067
2067
|
for (const g of p.patches1) {
|
|
2068
2068
|
const b = !t || t.trim() === "";
|
|
2069
2069
|
if (g.op === "remove" && !b)
|
|
2070
2070
|
continue;
|
|
2071
|
-
const
|
|
2072
|
-
if (
|
|
2073
|
-
for (let
|
|
2074
|
-
f.push({ line:
|
|
2071
|
+
const D = De(r, g.path);
|
|
2072
|
+
if (D.start !== 1 || D.end !== 1)
|
|
2073
|
+
for (let L = D.start; L <= D.end; L++)
|
|
2074
|
+
f.push({ line: L });
|
|
2075
2075
|
}
|
|
2076
2076
|
else if ((((c = p.patches1) == null ? void 0 : c.length) ?? 0) === 0 && (((a = p.patches2) == null ? void 0 : a.length) ?? 0) === 0) {
|
|
2077
|
-
const g =
|
|
2077
|
+
const g = De(r, p.path);
|
|
2078
2078
|
(g.start !== 1 || g.end !== 1) && f.push({ line: g.start });
|
|
2079
2079
|
}
|
|
2080
2080
|
if (p.patches2 && (p.patches2.length ?? 0) > 0)
|
|
2081
2081
|
for (const g of p.patches2) {
|
|
2082
2082
|
if (g.op === "remove")
|
|
2083
2083
|
continue;
|
|
2084
|
-
const b =
|
|
2084
|
+
const b = De(n, g.path);
|
|
2085
2085
|
if (b.start !== 1 || b.end !== 1)
|
|
2086
|
-
for (let
|
|
2087
|
-
|
|
2086
|
+
for (let D = b.start; D <= b.end; D++)
|
|
2087
|
+
I.push({ line: D });
|
|
2088
2088
|
}
|
|
2089
2089
|
else if ((((u = p.patches1) == null ? void 0 : u.length) ?? 0) === 0 && (((l = p.patches2) == null ? void 0 : l.length) ?? 0) === 0) {
|
|
2090
|
-
const g =
|
|
2091
|
-
(g.start !== 1 || g.end !== 1) &&
|
|
2090
|
+
const g = De(n, p.path);
|
|
2091
|
+
(g.start !== 1 || g.end !== 1) && I.push({ line: g.start });
|
|
2092
2092
|
}
|
|
2093
2093
|
const S = {
|
|
2094
2094
|
id: `conflict-${y}`,
|
|
@@ -2099,27 +2099,27 @@ function Vr(e, t, r, n) {
|
|
|
2099
2099
|
endLineNumberExclusive: d.end + 1
|
|
2100
2100
|
},
|
|
2101
2101
|
input1Range: {
|
|
2102
|
-
startLineNumber:
|
|
2103
|
-
endLineNumberExclusive:
|
|
2102
|
+
startLineNumber: _.start,
|
|
2103
|
+
endLineNumberExclusive: _.end + 1
|
|
2104
2104
|
},
|
|
2105
2105
|
input2Range: {
|
|
2106
|
-
startLineNumber:
|
|
2107
|
-
endLineNumberExclusive:
|
|
2106
|
+
startLineNumber: T.start,
|
|
2107
|
+
endLineNumberExclusive: T.end + 1
|
|
2108
2108
|
},
|
|
2109
2109
|
input1Diffs: f,
|
|
2110
|
-
input2Diffs:
|
|
2110
|
+
input2Diffs: I,
|
|
2111
2111
|
isConflicting: v,
|
|
2112
2112
|
conflictType: p.conflictType,
|
|
2113
2113
|
input1State: h,
|
|
2114
2114
|
input2State: m,
|
|
2115
|
-
handled: p.conflictType ===
|
|
2115
|
+
handled: p.conflictType === x.SAME_CHANGE,
|
|
2116
2116
|
focused: !1
|
|
2117
2117
|
};
|
|
2118
2118
|
o.push(S);
|
|
2119
2119
|
}
|
|
2120
2120
|
return o;
|
|
2121
2121
|
}
|
|
2122
|
-
function
|
|
2122
|
+
function zr(e, t, r, n = {}) {
|
|
2123
2123
|
const { comparisonMode: o = "split", schema: i } = n;
|
|
2124
2124
|
if (!t || !r)
|
|
2125
2125
|
throw new Error("JSON Patch diff requires non-empty input1 and input2 strings");
|
|
@@ -2127,50 +2127,50 @@ function Jr(e, t, r, n = {}) {
|
|
|
2127
2127
|
const s = e ? JSON.parse(e) : void 0, c = JSON.parse(t), a = JSON.parse(r);
|
|
2128
2128
|
let u;
|
|
2129
2129
|
if (s === void 0)
|
|
2130
|
-
u =
|
|
2130
|
+
u = qr(c, a, i);
|
|
2131
2131
|
else if (o === "split")
|
|
2132
|
-
u =
|
|
2132
|
+
u = Wr(s, c, a, i);
|
|
2133
2133
|
else {
|
|
2134
|
-
const l =
|
|
2134
|
+
const l = Ce(s, c), y = Ce(c, a), p = /* @__PURE__ */ new Set();
|
|
2135
2135
|
l.forEach((d) => {
|
|
2136
2136
|
p.add(d.path);
|
|
2137
2137
|
}), y.forEach((d) => {
|
|
2138
2138
|
p.add(d.path);
|
|
2139
2139
|
}), u = Array.from(p).map((d) => {
|
|
2140
|
-
const
|
|
2140
|
+
const _ = W(s, d), T = W(c, d), v = W(a, d), h = !de(_, T), m = !de(T, v);
|
|
2141
2141
|
let f;
|
|
2142
|
-
return h && m ? f =
|
|
2142
|
+
return h && m ? f = x.TRUE_CONFLICT : h ? f = x.INPUT1_ONLY : m ? f = x.INPUT2_ONLY : f = x.SAME_CHANGE, {
|
|
2143
2143
|
path: d,
|
|
2144
|
-
baseValue:
|
|
2145
|
-
input1Value:
|
|
2144
|
+
baseValue: _,
|
|
2145
|
+
input1Value: T,
|
|
2146
2146
|
input2Value: v,
|
|
2147
2147
|
conflictType: f
|
|
2148
2148
|
};
|
|
2149
2149
|
});
|
|
2150
2150
|
}
|
|
2151
|
-
return
|
|
2151
|
+
return Yr(u, e, t, r);
|
|
2152
2152
|
} catch (s) {
|
|
2153
2153
|
const c = s instanceof Error ? s.message : String(s);
|
|
2154
2154
|
throw new Error(`JSON Patch diff computation failed: ${c}`);
|
|
2155
2155
|
}
|
|
2156
2156
|
}
|
|
2157
|
-
function
|
|
2157
|
+
function Cr(e, t, r) {
|
|
2158
2158
|
const n = e !== t, o = e !== r;
|
|
2159
2159
|
let i;
|
|
2160
|
-
return n && o ? t === r ? i =
|
|
2160
|
+
return n && o ? t === r ? i = x.SAME_CHANGE : i = x.TRUE_CONFLICT : n ? i = x.INPUT1_ONLY : i = x.INPUT2_ONLY, { conflictType: i, input1Changed: n, input2Changed: o };
|
|
2161
2161
|
}
|
|
2162
|
-
function
|
|
2162
|
+
function uo(e, t, r) {
|
|
2163
2163
|
var u, l, y;
|
|
2164
2164
|
const n = [], o = [];
|
|
2165
2165
|
for (let p = 0; p < Math.max(e.length, t.length, r.length); p++) {
|
|
2166
|
-
const d = e[p] !== void 0 ? e[p] : "",
|
|
2166
|
+
const d = e[p] !== void 0 ? e[p] : "", _ = t[p] !== void 0 ? t[p] : "", T = r[p] !== void 0 ? r[p] : "", { conflictType: v, input1Changed: h, input2Changed: m } = Cr(d, _, T);
|
|
2167
2167
|
(h || m) && o.push({
|
|
2168
2168
|
line: p + 1,
|
|
2169
2169
|
input1Changed: h,
|
|
2170
2170
|
input2Changed: m,
|
|
2171
2171
|
baseLine: d,
|
|
2172
|
-
input1Line:
|
|
2173
|
-
input2Line:
|
|
2172
|
+
input1Line: _,
|
|
2173
|
+
input2Line: T,
|
|
2174
2174
|
conflictType: v
|
|
2175
2175
|
});
|
|
2176
2176
|
}
|
|
@@ -2178,9 +2178,9 @@ function no(e, t, r) {
|
|
|
2178
2178
|
return [];
|
|
2179
2179
|
let i = ((u = o[0]) == null ? void 0 : u.line) ?? 1, s = (l = o[0]) == null ? void 0 : l.conflictType, c = [], a = [];
|
|
2180
2180
|
for (let p = 0; p <= o.length; p++) {
|
|
2181
|
-
const d = o[p],
|
|
2182
|
-
if (
|
|
2183
|
-
const h = o[p - 1], m = h ? h.line + 1 : i + 1, f = c.length > 0,
|
|
2181
|
+
const d = o[p], _ = p === o.length, T = !_ && d && o[p - 1] && d.line > (((y = o[p - 1]) == null ? void 0 : y.line) ?? 0) + 1, v = !_ && d && d.conflictType !== s;
|
|
2182
|
+
if (_ || T || v) {
|
|
2183
|
+
const h = o[p - 1], m = h ? h.line + 1 : i + 1, f = c.length > 0, I = a.length > 0, S = s === x.TRUE_CONFLICT, g = {
|
|
2184
2184
|
id: `conflict-${n.length}`,
|
|
2185
2185
|
baseRange: {
|
|
2186
2186
|
startLineNumber: i,
|
|
@@ -2199,18 +2199,18 @@ function no(e, t, r) {
|
|
|
2199
2199
|
isConflicting: S,
|
|
2200
2200
|
conflictType: s,
|
|
2201
2201
|
// Default: accept input2 (ours) by default, or both if same change
|
|
2202
|
-
input1State: s ===
|
|
2203
|
-
input2State:
|
|
2204
|
-
handled: s ===
|
|
2202
|
+
input1State: s === x.SAME_CHANGE && f ? ne.first : ne.excluded,
|
|
2203
|
+
input2State: I ? ne.first : ne.excluded,
|
|
2204
|
+
handled: s === x.SAME_CHANGE,
|
|
2205
2205
|
focused: !1
|
|
2206
2206
|
};
|
|
2207
|
-
n.push(g), !
|
|
2207
|
+
n.push(g), !_ && d && (i = d.line, s = d.conflictType, c = [], a = []);
|
|
2208
2208
|
}
|
|
2209
|
-
!
|
|
2209
|
+
!_ && d && (d.input1Changed && c.push({ line: d.line }), d.input2Changed && a.push({ line: d.line }));
|
|
2210
2210
|
}
|
|
2211
2211
|
return n;
|
|
2212
2212
|
}
|
|
2213
|
-
function
|
|
2213
|
+
function Xr(e, t, r) {
|
|
2214
2214
|
if (!t || t === "/") {
|
|
2215
2215
|
if (typeof e == "object" && e !== null && !Array.isArray(e) && typeof r == "object" && r !== null && !Array.isArray(r)) {
|
|
2216
2216
|
Object.assign(e, r);
|
|
@@ -2244,14 +2244,14 @@ function Gr(e, t, r) {
|
|
|
2244
2244
|
o[i] = r;
|
|
2245
2245
|
}
|
|
2246
2246
|
}
|
|
2247
|
-
function
|
|
2247
|
+
function Qr(e, t) {
|
|
2248
2248
|
try {
|
|
2249
|
-
const r =
|
|
2249
|
+
const r = mn(e);
|
|
2250
2250
|
if (!r) return null;
|
|
2251
2251
|
const n = t.split("/").filter((l) => l !== "").map((l) => {
|
|
2252
2252
|
const y = Number.parseInt(l, 10);
|
|
2253
2253
|
return !Number.isNaN(y) && String(y) === l ? y : l;
|
|
2254
|
-
}), o =
|
|
2254
|
+
}), o = yn(r, n);
|
|
2255
2255
|
if (!o) return null;
|
|
2256
2256
|
const s = e.substring(0, o.offset).split(`
|
|
2257
2257
|
`).length, c = o.offset + o.length, u = e.substring(0, c).split(`
|
|
@@ -2261,15 +2261,15 @@ function Wr(e, t) {
|
|
|
2261
2261
|
return null;
|
|
2262
2262
|
}
|
|
2263
2263
|
}
|
|
2264
|
-
function
|
|
2264
|
+
function Nn(e, t, r, n = "") {
|
|
2265
2265
|
if (JSON.stringify(e) === JSON.stringify(t))
|
|
2266
2266
|
return e;
|
|
2267
2267
|
if (e !== null && t !== null && typeof e == "object" && typeof t == "object" && !Array.isArray(e) && !Array.isArray(t)) {
|
|
2268
|
-
const o = e, i = t, s = { ...o }, c = r ?
|
|
2268
|
+
const o = e, i = t, s = { ...o }, c = r ? Xe(r, n, e) : null, a = c != null && c.properties && typeof c.properties == "object" && !Array.isArray(c.properties) ? c.properties : void 0, u = c == null ? void 0 : c.additionalProperties;
|
|
2269
2269
|
for (const l of Object.keys(i))
|
|
2270
2270
|
if (l in s) {
|
|
2271
2271
|
if (JSON.stringify(s[l]) !== JSON.stringify(i[l])) {
|
|
2272
|
-
const y = a == null ? void 0 : a[l], p = n ? `${n}/${l}` : `/${l}`, d =
|
|
2272
|
+
const y = a == null ? void 0 : a[l], p = n ? `${n}/${l}` : `/${l}`, d = Nn(s[l], i[l], y, p);
|
|
2273
2273
|
if (d !== null)
|
|
2274
2274
|
s[l] = d;
|
|
2275
2275
|
else
|
|
@@ -2289,7 +2289,7 @@ function mn(e, t, r, n = "") {
|
|
|
2289
2289
|
}
|
|
2290
2290
|
return null;
|
|
2291
2291
|
}
|
|
2292
|
-
function
|
|
2292
|
+
function Zr(e, t, r, n, o) {
|
|
2293
2293
|
var S;
|
|
2294
2294
|
const i = [], s = [], c = e.join(`
|
|
2295
2295
|
`), a = t.join(`
|
|
@@ -2308,118 +2308,118 @@ function qr(e, t, r, n, o) {
|
|
|
2308
2308
|
}
|
|
2309
2309
|
let d;
|
|
2310
2310
|
!l || typeof l == "object" && l !== null && Object.keys(l).length === 0 ? d = JSON.parse(JSON.stringify(p)) : d = JSON.parse(JSON.stringify(l));
|
|
2311
|
-
const
|
|
2311
|
+
const _ = /* @__PURE__ */ new Set(), T = /* @__PURE__ */ new Set(), v = /* @__PURE__ */ new Set(), h = (g, b, D) => null;
|
|
2312
2312
|
for (const g of n) {
|
|
2313
|
-
const b = g.input1State ===
|
|
2314
|
-
let
|
|
2315
|
-
if (!
|
|
2316
|
-
g.conflictType ===
|
|
2313
|
+
const b = g.input1State === ne.first || g.input1State === ne.second, D = g.input2State === ne.first || g.input2State === ne.second;
|
|
2314
|
+
let L = g.path;
|
|
2315
|
+
if (!L && (L = h(g.baseRange.startLineNumber, g.baseRange.endLineNumberExclusive) || void 0, !L)) {
|
|
2316
|
+
g.conflictType === x.INPUT2_ONLY && D ? d = JSON.parse(JSON.stringify(p)) : g.conflictType === x.INPUT1_ONLY && b ? d = JSON.parse(JSON.stringify(y)) : g.conflictType === x.SAME_CHANGE && (b || D) || D ? d = JSON.parse(JSON.stringify(p)) : b && (d = JSON.parse(JSON.stringify(y)));
|
|
2317
2317
|
continue;
|
|
2318
2318
|
}
|
|
2319
2319
|
try {
|
|
2320
|
-
let
|
|
2321
|
-
const
|
|
2322
|
-
let V = !1,
|
|
2323
|
-
if (
|
|
2324
|
-
const R =
|
|
2320
|
+
let U, M = L;
|
|
2321
|
+
const $ = (S = g.path) == null ? void 0 : S.match(/^(.*\/\d+)(?:\/.*)?$/);
|
|
2322
|
+
let V = !1, E = "";
|
|
2323
|
+
if ($) {
|
|
2324
|
+
const R = $[1].split("/").filter((X) => X !== "");
|
|
2325
2325
|
if (R.length >= 2) {
|
|
2326
2326
|
const X = R[R.length - 1];
|
|
2327
|
-
/^\d+$/.test(X) && (V = !0,
|
|
2327
|
+
/^\d+$/.test(X) && (V = !0, E = `/${R.slice(0, -1).join("/")}`);
|
|
2328
2328
|
}
|
|
2329
2329
|
}
|
|
2330
|
-
if (b &&
|
|
2331
|
-
if (g.conflictType ===
|
|
2332
|
-
V ? (
|
|
2330
|
+
if (b && D)
|
|
2331
|
+
if (g.conflictType === x.SAME_CHANGE)
|
|
2332
|
+
V ? (U = W(p, E), M = E) : U = W(p, L);
|
|
2333
2333
|
else {
|
|
2334
|
-
const
|
|
2335
|
-
|
|
2334
|
+
const A = V ? E : L, R = W(y, A), X = W(p, A), re = o && l && typeof l == "object" && Xe(o, A, l) || void 0, oe = Nn(R, X, re, A);
|
|
2335
|
+
oe !== null ? (U = oe, M = A, i.push(`Smart-merged conflict at path ${A}`)) : (U = X, M = A, i.push(`Merge failed at path ${A}, using input2 value`));
|
|
2336
2336
|
}
|
|
2337
2337
|
else if (b)
|
|
2338
2338
|
if (V)
|
|
2339
|
-
|
|
2339
|
+
U = W(y, E), M = E;
|
|
2340
2340
|
else {
|
|
2341
|
-
const
|
|
2342
|
-
if (
|
|
2343
|
-
const R = `/${
|
|
2341
|
+
const A = L.split("/").filter(Boolean);
|
|
2342
|
+
if (A.length > 1) {
|
|
2343
|
+
const R = `/${A.slice(0, -1).join("/")}`;
|
|
2344
2344
|
if (!v.has(R)) {
|
|
2345
2345
|
const X = W(y, R);
|
|
2346
2346
|
if (typeof X == "object" && X !== null && !Array.isArray(X)) {
|
|
2347
|
-
const
|
|
2348
|
-
if (typeof
|
|
2349
|
-
for (const [
|
|
2350
|
-
const
|
|
2351
|
-
|
|
2347
|
+
const re = W(d, R);
|
|
2348
|
+
if (typeof re == "object" && re !== null && !Array.isArray(re)) {
|
|
2349
|
+
for (const [oe, ge] of Object.entries(X)) {
|
|
2350
|
+
const ke = `${R}/${oe}`;
|
|
2351
|
+
T.has(ke) || (re[oe] = ge);
|
|
2352
2352
|
}
|
|
2353
2353
|
v.add(R);
|
|
2354
2354
|
}
|
|
2355
2355
|
}
|
|
2356
2356
|
}
|
|
2357
|
-
|
|
2357
|
+
U = W(y, L);
|
|
2358
2358
|
} else
|
|
2359
|
-
|
|
2359
|
+
U = W(y, L);
|
|
2360
2360
|
}
|
|
2361
|
-
else if (
|
|
2361
|
+
else if (D)
|
|
2362
2362
|
if (V)
|
|
2363
|
-
|
|
2363
|
+
U = W(p, E), M = E;
|
|
2364
2364
|
else {
|
|
2365
|
-
const
|
|
2366
|
-
if (
|
|
2367
|
-
const R = `/${
|
|
2365
|
+
const A = L.split("/").filter(Boolean);
|
|
2366
|
+
if (A.length > 1) {
|
|
2367
|
+
const R = `/${A.slice(0, -1).join("/")}`;
|
|
2368
2368
|
if (!v.has(R)) {
|
|
2369
2369
|
const X = W(p, R);
|
|
2370
2370
|
if (typeof X == "object" && X !== null && !Array.isArray(X)) {
|
|
2371
|
-
const
|
|
2372
|
-
if (typeof
|
|
2373
|
-
for (const [
|
|
2374
|
-
const
|
|
2375
|
-
|
|
2371
|
+
const re = W(d, R);
|
|
2372
|
+
if (typeof re == "object" && re !== null && !Array.isArray(re)) {
|
|
2373
|
+
for (const [oe, ge] of Object.entries(X)) {
|
|
2374
|
+
const ke = `${R}/${oe}`;
|
|
2375
|
+
T.has(ke) || (re[oe] = ge);
|
|
2376
2376
|
}
|
|
2377
2377
|
v.add(R);
|
|
2378
2378
|
}
|
|
2379
2379
|
}
|
|
2380
2380
|
}
|
|
2381
|
-
|
|
2381
|
+
U = W(p, L);
|
|
2382
2382
|
} else
|
|
2383
|
-
|
|
2383
|
+
U = W(p, L);
|
|
2384
2384
|
}
|
|
2385
2385
|
else {
|
|
2386
|
-
const
|
|
2386
|
+
const A = V ? E : L, R = W(l, A);
|
|
2387
2387
|
if (R !== void 0)
|
|
2388
|
-
|
|
2388
|
+
U = R, M = A;
|
|
2389
2389
|
else
|
|
2390
2390
|
continue;
|
|
2391
2391
|
}
|
|
2392
|
-
|
|
2393
|
-
} catch (
|
|
2394
|
-
i.push(`Failed to apply conflict at path ${
|
|
2392
|
+
U !== void 0 && (Xr(d, M, U), _.add(M), T.add(M));
|
|
2393
|
+
} catch (U) {
|
|
2394
|
+
i.push(`Failed to apply conflict at path ${L || g.id}: ${U instanceof Error ? U.message : String(U)}`);
|
|
2395
2395
|
}
|
|
2396
2396
|
}
|
|
2397
2397
|
const m = JSON.stringify(d, null, 2);
|
|
2398
2398
|
for (const g of n) {
|
|
2399
2399
|
const b = g.path;
|
|
2400
2400
|
if (!b) continue;
|
|
2401
|
-
const
|
|
2402
|
-
if (
|
|
2403
|
-
const
|
|
2404
|
-
|
|
2401
|
+
const D = g.input1State === ne.first || g.input1State === ne.second, L = g.input2State === ne.first || g.input2State === ne.second;
|
|
2402
|
+
if (D && L && g.conflictType === x.TRUE_CONFLICT) {
|
|
2403
|
+
const U = Qr(m, b);
|
|
2404
|
+
U && s.push({
|
|
2405
2405
|
conflictId: g.id,
|
|
2406
2406
|
conflictPath: b,
|
|
2407
2407
|
type: "warning",
|
|
2408
2408
|
message: "Both conflicting changes were accepted - please review and manually resolve",
|
|
2409
|
-
startLine:
|
|
2410
|
-
endLine:
|
|
2409
|
+
startLine: U.startLine,
|
|
2410
|
+
endLine: U.endLine
|
|
2411
2411
|
});
|
|
2412
2412
|
}
|
|
2413
2413
|
}
|
|
2414
|
-
let f = !0,
|
|
2414
|
+
let f = !0, I;
|
|
2415
2415
|
try {
|
|
2416
2416
|
JSON.parse(m);
|
|
2417
2417
|
} catch (g) {
|
|
2418
|
-
f = !1,
|
|
2418
|
+
f = !1, I = g instanceof Error ? g.message : "Invalid JSON", s.push({
|
|
2419
2419
|
conflictId: "validation-error",
|
|
2420
2420
|
conflictPath: "/",
|
|
2421
2421
|
type: "error",
|
|
2422
|
-
message:
|
|
2422
|
+
message: I,
|
|
2423
2423
|
startLine: 1,
|
|
2424
2424
|
endLine: m.split(`
|
|
2425
2425
|
`).length
|
|
@@ -2428,27 +2428,27 @@ function qr(e, t, r, n, o) {
|
|
|
2428
2428
|
return {
|
|
2429
2429
|
content: m,
|
|
2430
2430
|
isValid: f,
|
|
2431
|
-
validationError:
|
|
2431
|
+
validationError: I,
|
|
2432
2432
|
warnings: i.length > 0 ? i : void 0,
|
|
2433
2433
|
conflictIssues: s.length > 0 ? s : void 0
|
|
2434
2434
|
};
|
|
2435
2435
|
}
|
|
2436
|
-
function
|
|
2436
|
+
function Kr(e, t, r) {
|
|
2437
2437
|
let n = "", o = "", i = "", s = "", c = "", a = "", u = "", l = "";
|
|
2438
2438
|
switch (e.conflictType) {
|
|
2439
|
-
case
|
|
2439
|
+
case x.SAME_CHANGE: {
|
|
2440
2440
|
const y = e.baseRange.startLineNumber === 1 && e.baseRange.endLineNumberExclusive === 2 && // Default "not found" range
|
|
2441
2441
|
e.input1Range.startLineNumber !== 1 && e.input2Range.startLineNumber !== 1;
|
|
2442
2442
|
t ? y ? (n = "merge-2way-deletion", o = "merge-same-change", s = r.baseOverviewColor, c = r.changeOverviewColor, a = "", u = "-", l = "+") : (n = "merge-2way-deletion", o = "merge-same-change", i = "merge-change-base", s = r.baseOverviewColor, c = r.changeOverviewColor, a = "", u = "-", l = "") : y ? (n = "merge-same-change", o = "merge-same-change", i = "", s = r.changeOverviewColor, c = r.changeOverviewColor, a = "", u = "+", l = "+") : (n = "merge-change-incoming", o = "merge-same-change", i = "merge-change-base", s = r.changeOverviewColor, c = r.changeOverviewColor, a = r.baseOverviewColor, u = "", l = "");
|
|
2443
2443
|
break;
|
|
2444
2444
|
}
|
|
2445
|
-
case
|
|
2445
|
+
case x.INPUT1_ONLY:
|
|
2446
2446
|
t ? (n = "merge-2way-deletion", o = "", s = r.baseOverviewColor, c = "", u = "-", l = "") : (n = "merge-change-incoming", o = "", i = "merge-change-base", s = r.conflictOverviewColor, c = "", a = r.baseOverviewColor, u = "-", l = "");
|
|
2447
2447
|
break;
|
|
2448
|
-
case
|
|
2448
|
+
case x.INPUT2_ONLY:
|
|
2449
2449
|
n = "", o = "merge-change-current", i = t ? "" : "merge-change-base", s = "", c = r.changeOverviewColor, a = t ? "" : r.baseOverviewColor, u = "", l = "+";
|
|
2450
2450
|
break;
|
|
2451
|
-
case
|
|
2451
|
+
case x.TRUE_CONFLICT: {
|
|
2452
2452
|
const y = e.baseRange.startLineNumber === 1 && e.baseRange.endLineNumberExclusive === 2 && // Default "not found" range
|
|
2453
2453
|
e.input1Range.startLineNumber !== 1 && e.input2Range.startLineNumber !== 1;
|
|
2454
2454
|
t ? y ? (n = "merge-2way-deletion", o = "merge-change-current", s = r.baseOverviewColor, c = r.changeOverviewColor, a = "", u = "-", l = "+") : (n = "merge-2way-deletion", o = "merge-conflict-current", i = "merge-conflict-base", s = r.baseOverviewColor, c = r.conflictOverviewColor, a = r.baseOverviewColor, u = "-", l = "+") : y ? (n = "merge-change-incoming", o = "merge-change-current", i = "", s = r.changeOverviewColor, c = r.changeOverviewColor, a = "", u = "+", l = "+") : (n = "merge-conflict-incoming", o = "merge-conflict-current", i = "merge-conflict-base", s = r.conflictOverviewColor, c = r.conflictOverviewColor, a = r.baseOverviewColor, u = "", l = "");
|
|
@@ -2466,7 +2466,7 @@ function Yr(e, t, r) {
|
|
|
2466
2466
|
input2Symbol: l
|
|
2467
2467
|
};
|
|
2468
2468
|
}
|
|
2469
|
-
function
|
|
2469
|
+
function En(e) {
|
|
2470
2470
|
const t = /* @__PURE__ */ new Set();
|
|
2471
2471
|
for (const r of e)
|
|
2472
2472
|
if (r && typeof r == "object" && "line" in r) {
|
|
@@ -2475,11 +2475,11 @@ function yn(e) {
|
|
|
2475
2475
|
}
|
|
2476
2476
|
return Array.from(t).sort((r, n) => r - n);
|
|
2477
2477
|
}
|
|
2478
|
-
function
|
|
2478
|
+
function eo(e, t, r) {
|
|
2479
2479
|
const n = [];
|
|
2480
2480
|
if (t.input1Class) {
|
|
2481
2481
|
if (e.input1Diffs.length > 0) {
|
|
2482
|
-
const o =
|
|
2482
|
+
const o = En(e.input1Diffs);
|
|
2483
2483
|
for (const i of o)
|
|
2484
2484
|
n.push({
|
|
2485
2485
|
range: new r.Range(i, 1, i, Number.MAX_SAFE_INTEGER),
|
|
@@ -2497,7 +2497,7 @@ function zr(e, t, r) {
|
|
|
2497
2497
|
} : void 0
|
|
2498
2498
|
}
|
|
2499
2499
|
});
|
|
2500
|
-
} else if (e.conflictType ===
|
|
2500
|
+
} else if (e.conflictType === x.INPUT1_ONLY) {
|
|
2501
2501
|
const o = e.input1Range.startLineNumber, i = e.input1Range.endLineNumberExclusive - 1;
|
|
2502
2502
|
for (let s = o; s <= i; s++)
|
|
2503
2503
|
n.push({
|
|
@@ -2520,10 +2520,10 @@ function zr(e, t, r) {
|
|
|
2520
2520
|
}
|
|
2521
2521
|
return n;
|
|
2522
2522
|
}
|
|
2523
|
-
function
|
|
2523
|
+
function to(e, t, r) {
|
|
2524
2524
|
const n = [];
|
|
2525
2525
|
if (e.input2Diffs.length > 0 && t.input2Class) {
|
|
2526
|
-
const o =
|
|
2526
|
+
const o = En(e.input2Diffs);
|
|
2527
2527
|
for (const i of o)
|
|
2528
2528
|
n.push({
|
|
2529
2529
|
range: new r.Range(i, 1, i, Number.MAX_SAFE_INTEGER),
|
|
@@ -2544,7 +2544,7 @@ function Xr(e, t, r) {
|
|
|
2544
2544
|
}
|
|
2545
2545
|
return n;
|
|
2546
2546
|
}
|
|
2547
|
-
function
|
|
2547
|
+
function no(e, t, r) {
|
|
2548
2548
|
const n = [], o = e.baseRange.startLineNumber === 1 && e.baseRange.endLineNumberExclusive === 2;
|
|
2549
2549
|
return (e.input1Diffs.length > 0 || e.input2Diffs.length > 0) && !o && n.push({
|
|
2550
2550
|
range: new r.Range(
|
|
@@ -2567,18 +2567,18 @@ function Qr(e, t, r) {
|
|
|
2567
2567
|
}
|
|
2568
2568
|
}), n;
|
|
2569
2569
|
}
|
|
2570
|
-
function
|
|
2571
|
-
const o =
|
|
2570
|
+
function ro(e, t, r, n) {
|
|
2571
|
+
const o = Kr(e, t, r);
|
|
2572
2572
|
return {
|
|
2573
|
-
input1Decorations:
|
|
2574
|
-
input2Decorations:
|
|
2575
|
-
baseDecorations:
|
|
2573
|
+
input1Decorations: eo(e, o, n),
|
|
2574
|
+
input2Decorations: to(e, o, n),
|
|
2575
|
+
baseDecorations: no(e, o, n)
|
|
2576
2576
|
};
|
|
2577
2577
|
}
|
|
2578
|
-
function
|
|
2578
|
+
function oo(e, t, r, n) {
|
|
2579
2579
|
const o = [], i = [], s = [];
|
|
2580
2580
|
for (const c of e) {
|
|
2581
|
-
const a =
|
|
2581
|
+
const a = ro(c, t, r, n);
|
|
2582
2582
|
o.push(...a.input1Decorations), i.push(...a.input2Decorations), s.push(...a.baseDecorations);
|
|
2583
2583
|
}
|
|
2584
2584
|
return {
|
|
@@ -2587,8 +2587,8 @@ function Cr(e, t, r, n) {
|
|
|
2587
2587
|
baseDecorations: s
|
|
2588
2588
|
};
|
|
2589
2589
|
}
|
|
2590
|
-
const
|
|
2591
|
-
function
|
|
2590
|
+
const io = () => /* @__PURE__ */ ht("div", { style: { padding: "20px", textAlign: "center", color: "#888" }, children: "Loading Monaco Editor..." }), Pt = "⚠";
|
|
2591
|
+
function fo(e) {
|
|
2592
2592
|
const {
|
|
2593
2593
|
original: t = "",
|
|
2594
2594
|
modified: r = "",
|
|
@@ -2603,311 +2603,311 @@ function ro(e) {
|
|
|
2603
2603
|
onMergeResolve: y,
|
|
2604
2604
|
showResultColumn: p,
|
|
2605
2605
|
baseIndex: d = 1,
|
|
2606
|
-
comparisonMode:
|
|
2607
|
-
schema:
|
|
2606
|
+
comparisonMode: _ = "split",
|
|
2607
|
+
schema: T,
|
|
2608
2608
|
patches: v,
|
|
2609
2609
|
labels: h
|
|
2610
|
-
} = e, m = n ? p : !1, f = !n || n === "",
|
|
2611
|
-
const
|
|
2612
|
-
|
|
2613
|
-
const
|
|
2614
|
-
return
|
|
2615
|
-
|
|
2616
|
-
|
|
2610
|
+
} = e, m = n ? p : !1, f = !n || n === "", I = "json", [S, g] = Pe(!1), [b, D] = Pe(!0), [L, U] = Pe([]), [M, $] = Pe(null), [V, E] = Pe([]), [A, R] = Pe([]), [X, re] = Pe(!1), [oe, ge] = Pe(/* @__PURE__ */ new Set()), ke = ae(""), be = Te((P, w, N, O) => {
|
|
2611
|
+
const k = document.createElement("div");
|
|
2612
|
+
k.className = "native-checkbox-container";
|
|
2613
|
+
const F = document.createElement("input");
|
|
2614
|
+
return F.type = "checkbox", F.className = "native-checkbox", F.checked = P === ne.first || P === ne.second, F.setAttribute("aria-label", F.checked ? "Undo accept" : "Accept change"), F.addEventListener("click", (Z) => {
|
|
2615
|
+
Z.preventDefault(), Z.stopPropagation(), requestAnimationFrame(() => {
|
|
2616
|
+
O();
|
|
2617
2617
|
});
|
|
2618
|
-
}),
|
|
2619
|
-
}, []), [
|
|
2618
|
+
}), k.appendChild(F), k;
|
|
2619
|
+
}, []), [at, Ne] = Pe(0), Q = ae(null), pe = ae(null), ee = ae(null), B = ae(null), we = ae(null), Qe = ae(null), Me = ae(!1), Nt = ae(!1), Ve = ae(null), Ze = ae(null), je = ae(null), Je = ae(/* @__PURE__ */ new Map()), Ie = ae(null), Re = ae(/* @__PURE__ */ new Map()), He = ae(null), Ge = ae(null), We = ae(null);
|
|
2620
2620
|
Se(() => {
|
|
2621
|
-
let
|
|
2622
|
-
const
|
|
2623
|
-
return
|
|
2624
|
-
|
|
2625
|
-
}).catch((
|
|
2626
|
-
|
|
2621
|
+
let P = !0;
|
|
2622
|
+
const w = mr.init();
|
|
2623
|
+
return w.then((N) => {
|
|
2624
|
+
P && (we.current = N, D(!1), g(!0));
|
|
2625
|
+
}).catch((N) => {
|
|
2626
|
+
P && (N == null ? void 0 : N.type) !== "cancelation" && console.error("Monaco initialization: error:", N);
|
|
2627
2627
|
}), () => {
|
|
2628
|
-
|
|
2628
|
+
P = !1, Me.current || w.cancel();
|
|
2629
2629
|
};
|
|
2630
2630
|
}, []);
|
|
2631
|
-
const
|
|
2632
|
-
(
|
|
2633
|
-
if (!
|
|
2634
|
-
const
|
|
2631
|
+
const Gt = Te(
|
|
2632
|
+
(P, w, N) => {
|
|
2633
|
+
if (!we.current) return [];
|
|
2634
|
+
const O = (P == null ? void 0 : P.getValue()) || "", k = w.getValue(), F = N.getValue();
|
|
2635
2635
|
try {
|
|
2636
|
-
const
|
|
2637
|
-
comparisonMode:
|
|
2638
|
-
schema:
|
|
2636
|
+
const Z = performance.now(), z = zr(O, k, F, {
|
|
2637
|
+
comparisonMode: _,
|
|
2638
|
+
schema: T,
|
|
2639
2639
|
patches: v
|
|
2640
|
-
}),
|
|
2641
|
-
return
|
|
2642
|
-
} catch (
|
|
2643
|
-
const
|
|
2644
|
-
return console.error("JSON Patch diff error:",
|
|
2640
|
+
}), j = performance.now() - Z;
|
|
2641
|
+
return j > 100 && console.warn(`JSON Patch diff took ${j.toFixed(2)}ms`), z;
|
|
2642
|
+
} catch (Z) {
|
|
2643
|
+
const z = Z instanceof Error ? Z.message : String(Z);
|
|
2644
|
+
return console.error("JSON Patch diff error:", z), [];
|
|
2645
2645
|
}
|
|
2646
2646
|
},
|
|
2647
|
-
[
|
|
2648
|
-
),
|
|
2647
|
+
[_, T, v]
|
|
2648
|
+
), Ke = Te((P) => {
|
|
2649
2649
|
try {
|
|
2650
|
-
return
|
|
2650
|
+
return P.getLayoutInfo().decorationsLeft || 0;
|
|
2651
2651
|
} catch {
|
|
2652
2652
|
return 0;
|
|
2653
2653
|
}
|
|
2654
|
-
}, []),
|
|
2654
|
+
}, []), et = Te((P) => {
|
|
2655
2655
|
try {
|
|
2656
|
-
return
|
|
2656
|
+
return P.getLayoutInfo().decorationsWidth || 0;
|
|
2657
2657
|
} catch {
|
|
2658
2658
|
return 0;
|
|
2659
2659
|
}
|
|
2660
|
-
}, []),
|
|
2661
|
-
(
|
|
2662
|
-
if (!m || !
|
|
2660
|
+
}, []), lt = Te(
|
|
2661
|
+
(P) => {
|
|
2662
|
+
if (!m || !B.current || !je.current)
|
|
2663
2663
|
return;
|
|
2664
|
-
const
|
|
2665
|
-
if (!
|
|
2666
|
-
const
|
|
2667
|
-
|
|
2668
|
-
const
|
|
2669
|
-
if (
|
|
2670
|
-
|
|
2671
|
-
for (const
|
|
2672
|
-
const
|
|
2673
|
-
G.className = `conflict-issue-marker conflict-issue-${
|
|
2674
|
-
const
|
|
2675
|
-
|
|
2664
|
+
const w = we.current;
|
|
2665
|
+
if (!w) return;
|
|
2666
|
+
const N = o === "vs-dark" || typeof o == "string" && o.includes("dark"), O = Ke(B.current), k = et(B.current);
|
|
2667
|
+
je.current.style.left = `${O}px`, je.current.style.width = `${k}px`;
|
|
2668
|
+
const F = B.current.getScrollTop();
|
|
2669
|
+
if (B.current.getModel()) {
|
|
2670
|
+
je.current.innerHTML = "";
|
|
2671
|
+
for (const z of P) {
|
|
2672
|
+
const j = z.startLine, ue = z.endLine, te = B.current.getTopForLineNumber(j) - F, H = B.current.getTopForLineNumber(ue) - F, J = B.current.getOption(w.editor.EditorOption.lineHeight), ie = ue > j ? H - te + J : J, G = document.createElement("div");
|
|
2673
|
+
G.className = `conflict-issue-marker conflict-issue-${z.type}`, G.setAttribute("data-conflict-id", z.conflictId), G.setAttribute("data-issue-type", z.type), G.title = z.message, G.style.position = "absolute", G.style.top = `${Math.max(0, te)}px`, G.style.height = `${ie}px`, G.style.width = "26px", G.style.display = "flex", G.style.alignItems = "center", G.style.justifyContent = "center", G.style.cursor = "help", G.style.pointerEvents = "auto";
|
|
2674
|
+
const se = document.createElement("div");
|
|
2675
|
+
se.className = "issue-icon", z.type === "error" ? (se.textContent = "✗", se.style.color = N ? "#ff6666" : "#cc0000") : z.type === "warning" ? (se.textContent = Pt, se.style.color = N ? "#ffaa00" : "#ff8800") : z.type === "smart-merge" && (se.textContent = "↕", se.style.color = N ? "#0096ff" : "#0078d4"), se.style.fontSize = "14px", se.style.fontWeight = "bold", G.appendChild(se), je.current.appendChild(G);
|
|
2676
2676
|
}
|
|
2677
2677
|
}
|
|
2678
2678
|
},
|
|
2679
|
-
[m, o,
|
|
2680
|
-
),
|
|
2681
|
-
(
|
|
2682
|
-
var
|
|
2683
|
-
if (!
|
|
2679
|
+
[m, o, Ke, et]
|
|
2680
|
+
), ut = Te(
|
|
2681
|
+
(P) => {
|
|
2682
|
+
var ce, ie, G, se;
|
|
2683
|
+
if (!B.current || X)
|
|
2684
2684
|
return;
|
|
2685
|
-
const
|
|
2686
|
-
if (!
|
|
2685
|
+
const w = B.current.getModel(), N = (ce = Q.current) == null ? void 0 : ce.getModel(), O = (ie = ee.current) == null ? void 0 : ie.getModel(), k = (G = pe.current) == null ? void 0 : G.getModel();
|
|
2686
|
+
if (!w || !N || !O || !k)
|
|
2687
2687
|
return;
|
|
2688
|
-
const
|
|
2689
|
-
if (
|
|
2690
|
-
const
|
|
2691
|
-
|
|
2692
|
-
`)) : (
|
|
2693
|
-
}
|
|
2694
|
-
if (
|
|
2695
|
-
const
|
|
2696
|
-
if (
|
|
2697
|
-
const he =
|
|
2698
|
-
lineNumber: Math.min(
|
|
2699
|
-
column:
|
|
2688
|
+
const F = k.getLinesContent(), Z = N.getLinesContent(), z = O.getLinesContent(), j = Zr(F, Z, z, P, T);
|
|
2689
|
+
if ($(j.isValid ? null : j.validationError || "Invalid JSON"), E(j.warnings || []), R(j.conflictIssues || []), Ie.current) {
|
|
2690
|
+
const C = (h == null ? void 0 : h.result) || "Result";
|
|
2691
|
+
j.isValid ? j.warnings && j.warnings.length > 0 ? (Ie.current.textContent = `${C} ${Pt}`, Ie.current.title = j.warnings.join(`
|
|
2692
|
+
`)) : (Ie.current.textContent = C, Ie.current.style.color = "", Ie.current.title = "") : (Ie.current.textContent = `${C} ${Pt} Invalid JSON`, Ie.current.style.color = "#ff4444", Ie.current.title = j.validationError || "Invalid JSON - please fix manually");
|
|
2693
|
+
}
|
|
2694
|
+
if (w.getValue() !== j.content) {
|
|
2695
|
+
const C = B.current.getPosition(), q = B.current.getSelection();
|
|
2696
|
+
if (Nt.current = !0, w.setValue(j.content), Nt.current = !1, C) {
|
|
2697
|
+
const he = w.getLineCount(), Y = w.getLineLength(he), ye = {
|
|
2698
|
+
lineNumber: Math.min(C.lineNumber, he),
|
|
2699
|
+
column: C.lineNumber <= he ? Math.min(C.column, w.getLineLength(C.lineNumber) + 1) : Y + 1
|
|
2700
2700
|
};
|
|
2701
|
-
|
|
2701
|
+
B.current.setPosition(ye), q && !q.isEmpty() && B.current.setSelection(q);
|
|
2702
2702
|
}
|
|
2703
2703
|
}
|
|
2704
|
-
const
|
|
2704
|
+
const te = we.current, H = w;
|
|
2705
2705
|
let J = H._invalidDecorations;
|
|
2706
|
-
if (!
|
|
2706
|
+
if (!j.isValid && B.current && te ? (J || (J = B.current.createDecorationsCollection([]), H._invalidDecorations = J), J.set([
|
|
2707
2707
|
{
|
|
2708
|
-
range: new
|
|
2708
|
+
range: new te.Range(1, 1, w.getLineCount(), Number.MAX_SAFE_INTEGER),
|
|
2709
2709
|
options: {
|
|
2710
2710
|
isWholeLine: !1,
|
|
2711
2711
|
className: "merge-result-invalid",
|
|
2712
|
-
hoverMessage: { value:
|
|
2712
|
+
hoverMessage: { value: j.validationError || "Invalid JSON - please fix manually" }
|
|
2713
2713
|
}
|
|
2714
2714
|
}
|
|
2715
|
-
])) :
|
|
2716
|
-
if (
|
|
2717
|
-
const
|
|
2718
|
-
if (!
|
|
2719
|
-
const
|
|
2715
|
+
])) : j.isValid && J && B.current && J.set([]), j.conflictIssues && j.conflictIssues.length > 0) {
|
|
2716
|
+
if (lt(j.conflictIssues), B.current && te) {
|
|
2717
|
+
const C = w;
|
|
2718
|
+
if (!C._conflictIssueDecorations) {
|
|
2719
|
+
const Y = B.current.createDecorationsCollection(
|
|
2720
2720
|
[]
|
|
2721
2721
|
);
|
|
2722
|
-
|
|
2722
|
+
C._conflictIssueDecorations = Y;
|
|
2723
2723
|
}
|
|
2724
|
-
const q =
|
|
2725
|
-
let
|
|
2726
|
-
return
|
|
2727
|
-
range: new
|
|
2724
|
+
const q = C._conflictIssueDecorations, he = j.conflictIssues.map((Y) => {
|
|
2725
|
+
let ye, Ee;
|
|
2726
|
+
return Y.type === "error" ? (ye = o === "vs-dark" ? "rgba(255, 0, 0, 0.1)" : "rgba(255, 0, 0, 0.05)", Ee = o === "vs-dark" ? "#ff6666" : "#cc0000") : Y.type === "warning" ? (ye = o === "vs-dark" ? "rgba(255, 170, 0, 0.1)" : "rgba(255, 136, 0, 0.05)", Ee = o === "vs-dark" ? "#ffaa00" : "#ff8800") : (ye = o === "vs-dark" ? "rgba(0, 150, 255, 0.1)" : "rgba(0, 120, 212, 0.05)", Ee = o === "vs-dark" ? "#0096ff" : "#0078d4"), {
|
|
2727
|
+
range: new te.Range(Y.startLine, 1, Y.endLine, Number.MAX_SAFE_INTEGER),
|
|
2728
2728
|
options: {
|
|
2729
2729
|
isWholeLine: !0,
|
|
2730
|
-
className: `conflict-issue-line conflict-issue-${
|
|
2731
|
-
linesDecorationsClassName: `conflict-issue-line-decoration conflict-issue-${
|
|
2732
|
-
backgroundColor:
|
|
2730
|
+
className: `conflict-issue-line conflict-issue-${Y.type}`,
|
|
2731
|
+
linesDecorationsClassName: `conflict-issue-line-decoration conflict-issue-${Y.type}`,
|
|
2732
|
+
backgroundColor: ye,
|
|
2733
2733
|
overviewRuler: {
|
|
2734
|
-
color:
|
|
2735
|
-
position:
|
|
2734
|
+
color: Ee,
|
|
2735
|
+
position: te.editor.OverviewRulerLane.Right
|
|
2736
2736
|
},
|
|
2737
2737
|
minimap: {
|
|
2738
|
-
color:
|
|
2739
|
-
position:
|
|
2738
|
+
color: Ee,
|
|
2739
|
+
position: te.editor.MinimapPosition.Inline
|
|
2740
2740
|
}
|
|
2741
2741
|
}
|
|
2742
2742
|
};
|
|
2743
2743
|
});
|
|
2744
2744
|
q.set(he);
|
|
2745
2745
|
}
|
|
2746
|
-
} else if (
|
|
2747
|
-
const
|
|
2748
|
-
|
|
2746
|
+
} else if (B.current) {
|
|
2747
|
+
const C = w;
|
|
2748
|
+
C._conflictIssueDecorations && C._conflictIssueDecorations.set([]), je.current && m && (je.current.innerHTML = "");
|
|
2749
2749
|
}
|
|
2750
2750
|
if (y) {
|
|
2751
|
-
const
|
|
2752
|
-
|
|
2753
|
-
y(
|
|
2754
|
-
isValid:
|
|
2755
|
-
validationError:
|
|
2756
|
-
warnings:
|
|
2757
|
-
conflictIssues:
|
|
2751
|
+
const C = `${j.content}|${j.isValid}|${(se = j.warnings) == null ? void 0 : se.join(",")}`;
|
|
2752
|
+
ke.current !== C && (ke.current = C, queueMicrotask(() => {
|
|
2753
|
+
y(j.content, {
|
|
2754
|
+
isValid: j.isValid,
|
|
2755
|
+
validationError: j.validationError,
|
|
2756
|
+
warnings: j.warnings,
|
|
2757
|
+
conflictIssues: j.conflictIssues
|
|
2758
2758
|
});
|
|
2759
2759
|
}));
|
|
2760
2760
|
}
|
|
2761
2761
|
},
|
|
2762
|
-
[y,
|
|
2763
|
-
),
|
|
2764
|
-
(
|
|
2765
|
-
|
|
2766
|
-
const
|
|
2767
|
-
if (
|
|
2768
|
-
const
|
|
2769
|
-
return
|
|
2762
|
+
[y, T, h, o, lt, m, X]
|
|
2763
|
+
), Et = Te(
|
|
2764
|
+
(P, w) => {
|
|
2765
|
+
re(!1), U((N) => {
|
|
2766
|
+
const O = N.map((k) => {
|
|
2767
|
+
if (k.id !== P) return k;
|
|
2768
|
+
const Z = (w === 1 ? k.input1State : k.input2State) === ne.excluded ? ne.first : ne.excluded;
|
|
2769
|
+
return w === 1 ? { ...k, input1State: Z } : { ...k, input2State: Z };
|
|
2770
2770
|
});
|
|
2771
|
-
return m &&
|
|
2771
|
+
return m && B.current && ut(O), O;
|
|
2772
2772
|
});
|
|
2773
2773
|
},
|
|
2774
|
-
[m,
|
|
2775
|
-
),
|
|
2776
|
-
(
|
|
2777
|
-
if (!
|
|
2778
|
-
const
|
|
2779
|
-
if (!
|
|
2780
|
-
const ue =
|
|
2774
|
+
[m, ut]
|
|
2775
|
+
), Tt = Te(
|
|
2776
|
+
(P, w, N, O, k, F, Z) => {
|
|
2777
|
+
if (!we.current) return;
|
|
2778
|
+
const j = O === 1 ? Q.current : ee.current;
|
|
2779
|
+
if (!j) return;
|
|
2780
|
+
const ue = O === 1 ? N.input1Range : N.input2Range, te = O === 1 ? N.input1State : N.input2State, H = j.getModel();
|
|
2781
2781
|
if (!H) return;
|
|
2782
|
-
const J = H.getLineCount(),
|
|
2783
|
-
if (
|
|
2782
|
+
const J = H.getLineCount(), ce = Math.max(1, Math.min(ue.startLineNumber, J)), ie = Math.max(1, Math.min(ue.endLineNumberExclusive - 1, J));
|
|
2783
|
+
if (ce > J || ie < 1 || ce > ie)
|
|
2784
2784
|
return;
|
|
2785
|
-
const G =
|
|
2786
|
-
let q =
|
|
2785
|
+
const G = j.getTopForLineNumber(ce) - k, C = j.getBottomForLineNumber(ie) - k - G;
|
|
2786
|
+
let q = Je.current.get(w);
|
|
2787
2787
|
if (!q) {
|
|
2788
2788
|
q = document.createElement("div"), q.className = "merge-accept-gutter-marker";
|
|
2789
|
-
const
|
|
2790
|
-
|
|
2791
|
-
const
|
|
2792
|
-
|
|
2793
|
-
const
|
|
2794
|
-
|
|
2795
|
-
const
|
|
2796
|
-
|
|
2797
|
-
}
|
|
2798
|
-
q.style.top = `${G}px`, q.style.height = `${
|
|
2789
|
+
const fe = document.createElement("div");
|
|
2790
|
+
fe.className = "background", q.appendChild(fe);
|
|
2791
|
+
const K = document.createElement("div");
|
|
2792
|
+
K.className = "checkbox";
|
|
2793
|
+
const me = document.createElement("div");
|
|
2794
|
+
me.className = "checkbox-background";
|
|
2795
|
+
const ve = be(te, O, N.id, () => Et(N.id, O));
|
|
2796
|
+
me.appendChild(ve), K.appendChild(me), q.appendChild(K), P.appendChild(q), Je.current.set(w, q);
|
|
2797
|
+
}
|
|
2798
|
+
q.style.top = `${G}px`, q.style.height = `${C}px`;
|
|
2799
2799
|
const he = q.querySelector(".checkbox-background");
|
|
2800
2800
|
if (he) {
|
|
2801
2801
|
he.innerHTML = "";
|
|
2802
|
-
const
|
|
2803
|
-
he.appendChild(
|
|
2804
|
-
}
|
|
2805
|
-
const
|
|
2806
|
-
q.className = "merge-accept-gutter-marker",
|
|
2807
|
-
const
|
|
2808
|
-
if (
|
|
2809
|
-
const
|
|
2810
|
-
let
|
|
2811
|
-
const
|
|
2812
|
-
|
|
2802
|
+
const fe = be(te, O, N.id, () => Et(N.id, O));
|
|
2803
|
+
he.appendChild(fe);
|
|
2804
|
+
}
|
|
2805
|
+
const Y = N.handled, ye = N.focused, Ee = C > 30;
|
|
2806
|
+
q.className = "merge-accept-gutter-marker", Y && q.classList.add("handled"), ye && q.classList.add("focused"), Ee ? q.classList.add("multi-line") : q.classList.add("single-line");
|
|
2807
|
+
const $e = q.querySelector(".checkbox");
|
|
2808
|
+
if ($e) {
|
|
2809
|
+
const K = C / 2 - 12, me = 24;
|
|
2810
|
+
let ve = K;
|
|
2811
|
+
const Le = me, _e = F - me - 24, Be = me, pt = C - 24 - me;
|
|
2812
|
+
Be < pt && (ve = Math.max(Le, Math.min(ve + G, _e)) - G, ve = Math.max(Be, Math.min(ve, pt))), $e.style.top = `${ve + 5}px`;
|
|
2813
2813
|
}
|
|
2814
2814
|
},
|
|
2815
|
-
[
|
|
2816
|
-
),
|
|
2815
|
+
[Et, be]
|
|
2816
|
+
), ft = Te(() => {
|
|
2817
2817
|
if (!m) {
|
|
2818
|
-
const H =
|
|
2819
|
-
for (const [J,
|
|
2820
|
-
|
|
2818
|
+
const H = Je.current;
|
|
2819
|
+
for (const [J, ce] of H.entries())
|
|
2820
|
+
ce.remove(), H.delete(J);
|
|
2821
2821
|
return;
|
|
2822
2822
|
}
|
|
2823
|
-
if (!
|
|
2823
|
+
if (!Q.current || !ee.current || !Ve.current || !Ze.current || !we.current)
|
|
2824
2824
|
return;
|
|
2825
|
-
const
|
|
2826
|
-
|
|
2827
|
-
const
|
|
2828
|
-
if (!
|
|
2829
|
-
const
|
|
2830
|
-
for (const H of
|
|
2825
|
+
const w = o === "vs-dark" || typeof o == "string" && o.includes("dark"), N = Ke(Q.current), O = et(Q.current), k = Ke(ee.current), F = et(ee.current);
|
|
2826
|
+
Ve.current.style.left = `${N}px`, Ve.current.style.width = `${O}px`, Ze.current.style.left = `${k}px`, Ze.current.style.width = `${F}px`;
|
|
2827
|
+
const Z = Q.current.getVisibleRanges();
|
|
2828
|
+
if (!Z || Z.length === 0) return;
|
|
2829
|
+
const z = Q.current.getScrollTop(), j = Ve.current.clientHeight, ue = /* @__PURE__ */ new Set();
|
|
2830
|
+
for (const H of L)
|
|
2831
2831
|
if (!(H.input1Diffs.length === 0 && H.input2Diffs.length === 0)) {
|
|
2832
2832
|
if (H.input1Diffs.length > 0) {
|
|
2833
2833
|
const J = `${H.id}-input1`;
|
|
2834
|
-
ue.add(J),
|
|
2834
|
+
ue.add(J), Tt(Ve.current, J, H, 1, z, j, w);
|
|
2835
2835
|
}
|
|
2836
2836
|
if (H.input2Diffs.length > 0) {
|
|
2837
2837
|
const J = `${H.id}-input2`;
|
|
2838
|
-
ue.add(J),
|
|
2838
|
+
ue.add(J), Tt(Ze.current, J, H, 2, z, j, w);
|
|
2839
2839
|
}
|
|
2840
2840
|
}
|
|
2841
|
-
const
|
|
2842
|
-
for (const [H, J] of
|
|
2843
|
-
ue.has(H) || (J.remove(),
|
|
2844
|
-
}, [
|
|
2845
|
-
var
|
|
2841
|
+
const te = Je.current;
|
|
2842
|
+
for (const [H, J] of te.entries())
|
|
2843
|
+
ue.has(H) || (J.remove(), te.delete(H));
|
|
2844
|
+
}, [L, o, m, Ke, et, Tt]), Oe = Te((P, w) => {
|
|
2845
|
+
var N, O, k;
|
|
2846
2846
|
try {
|
|
2847
|
-
if (
|
|
2848
|
-
const
|
|
2849
|
-
if ((
|
|
2850
|
-
return
|
|
2847
|
+
if (we.current) {
|
|
2848
|
+
const F = (O = (N = we.current.editor).getTheme) == null ? void 0 : O.call(N);
|
|
2849
|
+
if ((k = F == null ? void 0 : F.colors) != null && k[P])
|
|
2850
|
+
return F.colors[P];
|
|
2851
2851
|
}
|
|
2852
2852
|
} catch {
|
|
2853
2853
|
}
|
|
2854
|
-
return
|
|
2855
|
-
}, []),
|
|
2856
|
-
if (!
|
|
2854
|
+
return w;
|
|
2855
|
+
}, []), Wt = Te(() => {
|
|
2856
|
+
if (!we.current || !Q.current || !ee.current)
|
|
2857
2857
|
return;
|
|
2858
|
-
const
|
|
2858
|
+
const P = we.current, w = o === "vs-dark" || typeof o == "string" && o.includes("dark"), N = Oe("mergeEditor.change.background", w ? "rgba(255, 166, 0, 0.2)" : "rgba(255, 166, 0, 0.15)"), O = Oe(
|
|
2859
2859
|
"diffEditor.insertedTextBackground",
|
|
2860
|
-
|
|
2861
|
-
),
|
|
2860
|
+
w ? "rgba(155, 185, 85, 0.2)" : "rgba(155, 185, 85, 0.15)"
|
|
2861
|
+
), k = Oe(
|
|
2862
2862
|
"mergeEditor.changeBase.background",
|
|
2863
|
-
|
|
2864
|
-
),
|
|
2863
|
+
w ? "rgba(255, 100, 100, 0.2)" : "rgba(255, 100, 100, 0.15)"
|
|
2864
|
+
), F = Oe(
|
|
2865
2865
|
"editorOverviewRuler.modifiedForeground",
|
|
2866
|
-
|
|
2867
|
-
),
|
|
2866
|
+
w ? "rgba(255, 166, 0, 0.8)" : "rgba(255, 166, 0, 1)"
|
|
2867
|
+
), Z = Oe(
|
|
2868
2868
|
"editorOverviewRuler.addedForeground",
|
|
2869
|
-
|
|
2870
|
-
),
|
|
2869
|
+
w ? "rgba(155, 185, 85, 0.8)" : "rgba(155, 185, 85, 1)"
|
|
2870
|
+
), z = Oe(
|
|
2871
2871
|
"editorOverviewRuler.deletedForeground",
|
|
2872
|
-
|
|
2873
|
-
),
|
|
2874
|
-
conflictOverviewColor:
|
|
2875
|
-
changeOverviewColor:
|
|
2876
|
-
baseOverviewColor:
|
|
2877
|
-
}, { input1Decorations:
|
|
2878
|
-
|
|
2879
|
-
|
|
2872
|
+
w ? "rgba(255, 100, 100, 0.8)" : "rgba(255, 100, 100, 1)"
|
|
2873
|
+
), j = f, ue = {
|
|
2874
|
+
conflictOverviewColor: F,
|
|
2875
|
+
changeOverviewColor: Z,
|
|
2876
|
+
baseOverviewColor: z
|
|
2877
|
+
}, { input1Decorations: te, input2Decorations: H, baseDecorations: J } = oo(
|
|
2878
|
+
L,
|
|
2879
|
+
j,
|
|
2880
2880
|
ue,
|
|
2881
|
-
|
|
2882
|
-
),
|
|
2883
|
-
let q = document.getElementById(
|
|
2884
|
-
q || (q = document.createElement("style"), q.id =
|
|
2885
|
-
const he =
|
|
2881
|
+
P
|
|
2882
|
+
), ce = Oe("input.background", w ? "#3c3c3c" : "#f3f3f3"), ie = Oe("input.border", w ? "#6b6b6b" : "#c8c8c8"), G = Oe("focusBorder", w ? "#007acc" : "#0078d4"), se = Oe("inputOption.activeForeground", w ? "#3794ff" : "#0078d4"), C = "monaco-three-way-diff-dynamic";
|
|
2883
|
+
let q = document.getElementById(C);
|
|
2884
|
+
q || (q = document.createElement("style"), q.id = C, document.head.appendChild(q));
|
|
2885
|
+
const he = Oe(
|
|
2886
2886
|
"diffEditor.insertedTextBackground",
|
|
2887
|
-
|
|
2888
|
-
),
|
|
2887
|
+
w ? "rgba(100, 100, 255, 0.15)" : "rgba(100, 100, 255, 0.1)"
|
|
2888
|
+
), Y = Oe(
|
|
2889
2889
|
"diffEditor.insertedTextBackground",
|
|
2890
|
-
|
|
2890
|
+
w ? "rgba(155, 185, 85, 0.2)" : "rgba(155, 185, 85, 0.15)"
|
|
2891
2891
|
);
|
|
2892
2892
|
q.textContent = `
|
|
2893
2893
|
/* True conflict - both sides changed differently (orange/amber) */
|
|
2894
2894
|
.monaco-editor .merge-conflict-incoming,
|
|
2895
2895
|
.monaco-editor .merge-conflict-current {
|
|
2896
|
-
background-color: ${
|
|
2896
|
+
background-color: ${N};
|
|
2897
2897
|
}
|
|
2898
2898
|
|
|
2899
2899
|
/* 2-way diff mode: red for deletions (input1 column) - must override merge-change-incoming */
|
|
2900
2900
|
.monaco-editor .merge-2way-deletion,
|
|
2901
2901
|
.monaco-editor .monaco-editor .merge-2way-deletion {
|
|
2902
|
-
background-color: ${
|
|
2902
|
+
background-color: ${k} !important;
|
|
2903
2903
|
}
|
|
2904
2904
|
|
|
2905
2905
|
/* Single-side change (green for input2/ours, orange for input1/theirs in 3-way) */
|
|
2906
2906
|
.monaco-editor .merge-change-incoming {
|
|
2907
|
-
background-color: ${
|
|
2907
|
+
background-color: ${Y};
|
|
2908
2908
|
}
|
|
2909
2909
|
.monaco-editor .merge-change-current {
|
|
2910
|
-
background-color: ${
|
|
2910
|
+
background-color: ${O};
|
|
2911
2911
|
}
|
|
2912
2912
|
|
|
2913
2913
|
/* Same change on both sides (blue/purple) */
|
|
@@ -2918,13 +2918,13 @@ function ro(e) {
|
|
|
2918
2918
|
/* Base changes */
|
|
2919
2919
|
.monaco-editor .merge-conflict-base,
|
|
2920
2920
|
.monaco-editor .merge-change-base {
|
|
2921
|
-
background-color: ${
|
|
2921
|
+
background-color: ${k};
|
|
2922
2922
|
}
|
|
2923
2923
|
|
|
2924
2924
|
/* Invalid JSON in result column */
|
|
2925
2925
|
.monaco-editor .merge-result-invalid {
|
|
2926
|
-
background-color: ${
|
|
2927
|
-
outline: 1px solid ${
|
|
2926
|
+
background-color: ${w ? "rgba(255, 0, 0, 0.2)" : "rgba(255, 0, 0, 0.1)"};
|
|
2927
|
+
outline: 1px solid ${w ? "rgba(255, 100, 100, 0.5)" : "rgba(255, 0, 0, 0.3)"};
|
|
2928
2928
|
}
|
|
2929
2929
|
|
|
2930
2930
|
/* Diff symbols (+ and -) in line decorations - positioned in code area */
|
|
@@ -2956,7 +2956,7 @@ function ro(e) {
|
|
|
2956
2956
|
pointer-events: none;
|
|
2957
2957
|
font-family: "Courier New", monospace;
|
|
2958
2958
|
width: 20px;
|
|
2959
|
-
color: ${
|
|
2959
|
+
color: ${w ? "#9BB955" : "#6A9955"};
|
|
2960
2960
|
}
|
|
2961
2961
|
|
|
2962
2962
|
.monaco-editor .diff-symbol.diff-symbol-minus::before {
|
|
@@ -2975,7 +2975,7 @@ function ro(e) {
|
|
|
2975
2975
|
pointer-events: none;
|
|
2976
2976
|
font-family: "Courier New", monospace;
|
|
2977
2977
|
width: 20px;
|
|
2978
|
-
color: ${
|
|
2978
|
+
color: ${w ? "#FF6464" : "#CC0000"};
|
|
2979
2979
|
}
|
|
2980
2980
|
|
|
2981
2981
|
/* VSCode-style checkbox gutter - positioned at Monaco's glyph margin */
|
|
@@ -3018,8 +3018,8 @@ function ro(e) {
|
|
|
3018
3018
|
width: 14px;
|
|
3019
3019
|
height: 14px;
|
|
3020
3020
|
border-radius: 3px;
|
|
3021
|
-
background-color: ${
|
|
3022
|
-
border: 1px solid ${
|
|
3021
|
+
background-color: ${ce};
|
|
3022
|
+
border: 1px solid ${ie};
|
|
3023
3023
|
}
|
|
3024
3024
|
|
|
3025
3025
|
.merge-accept-gutter-marker.focused .checkbox-background {
|
|
@@ -3046,7 +3046,7 @@ function ro(e) {
|
|
|
3046
3046
|
height: 16px;
|
|
3047
3047
|
cursor: pointer;
|
|
3048
3048
|
margin: 0;
|
|
3049
|
-
accent-color: ${
|
|
3049
|
+
accent-color: ${se};
|
|
3050
3050
|
}
|
|
3051
3051
|
|
|
3052
3052
|
/* Result column status indicator */
|
|
@@ -3074,65 +3074,85 @@ function ro(e) {
|
|
|
3074
3074
|
outline: 2px solid ${G};
|
|
3075
3075
|
outline-offset: 2px;
|
|
3076
3076
|
}
|
|
3077
|
-
`,
|
|
3078
|
-
}, [
|
|
3079
|
-
if (!
|
|
3080
|
-
const
|
|
3081
|
-
|
|
3082
|
-
const
|
|
3083
|
-
|
|
3084
|
-
const
|
|
3085
|
-
var
|
|
3077
|
+
`, He.current || (He.current = Q.current.createDecorationsCollection([])), He.current.set(te), Ge.current || (Ge.current = ee.current.createDecorationsCollection([])), Ge.current.set(H), pe.current && (We.current || (We.current = pe.current.createDecorationsCollection([])), We.current.set(J));
|
|
3078
|
+
}, [L, o, f, Oe]), qt = Te(() => {
|
|
3079
|
+
if (!Me.current && Qe.current && we.current && !b) {
|
|
3080
|
+
const P = we.current;
|
|
3081
|
+
Qe.current.innerHTML = "", Re.current.clear();
|
|
3082
|
+
const w = document.createElement("div");
|
|
3083
|
+
w.style.display = "flex", w.style.height = "100%", w.style.width = "100%";
|
|
3084
|
+
const N = o === "vs-dark" || typeof o == "string" && o.includes("dark"), O = N ? "#444" : "#ddd", k = N ? "#fff" : "#333", F = (Y, ye) => {
|
|
3085
|
+
var Ee, $e, fe;
|
|
3086
3086
|
try {
|
|
3087
|
-
const
|
|
3088
|
-
if ((
|
|
3089
|
-
return
|
|
3087
|
+
const K = ($e = (Ee = P.editor).getTheme) == null ? void 0 : $e.call(Ee);
|
|
3088
|
+
if ((fe = K == null ? void 0 : K.colors) != null && fe[Y])
|
|
3089
|
+
return K.colors[Y];
|
|
3090
3090
|
} catch {
|
|
3091
3091
|
}
|
|
3092
|
-
return
|
|
3093
|
-
},
|
|
3094
|
-
const
|
|
3095
|
-
|
|
3096
|
-
const
|
|
3097
|
-
|
|
3098
|
-
const
|
|
3099
|
-
|
|
3100
|
-
const
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3092
|
+
return ye;
|
|
3093
|
+
}, Z = F("mergeEditor.conflict.input1.header.background", N ? "#4B1818" : "#FFE6E6"), z = F("editorGutter.background", N ? "#333" : "#f0f0f0"), j = F("mergeEditor.conflict.input2.header.background", N ? "#1B4B18" : "#E6FFE6"), ue = F("mergeEditor.result.header.background", N ? "#7F5F00" : "#FFECB3"), te = (Y, ye, Ee, $e = !1) => {
|
|
3094
|
+
const fe = document.createElement("div");
|
|
3095
|
+
fe.style.flex = "1", fe.style.display = "flex", fe.style.flexDirection = "column", fe.style.borderRight = `1px solid ${O}`, fe.style.overflow = "hidden", fe.style.transition = "flex 0.2s ease, min-width 0.2s ease, max-width 0.2s ease", fe.dataset.columnKey = Y;
|
|
3096
|
+
const K = document.createElement("div");
|
|
3097
|
+
K.style.padding = "4px 8px", K.style.fontSize = "11px", K.style.fontWeight = "500", K.style.backgroundColor = Ee, K.style.color = k, K.style.borderBottom = `1px solid ${O}`, K.style.display = "flex", K.style.alignItems = "center", K.style.gap = "4px", K.style.height = "22px", K.style.boxSizing = "content-box", K.style.whiteSpace = "nowrap", K.style.overflow = "hidden";
|
|
3098
|
+
const me = document.createElement("span");
|
|
3099
|
+
me.textContent = ye, me.style.flex = "1", me.style.overflow = "hidden", me.style.textOverflow = "ellipsis", K.appendChild(me);
|
|
3100
|
+
const ve = document.createElement("div");
|
|
3101
|
+
ve.className = "column-collapse-icon", ve.title = "Collapse column", ve.innerHTML = '<svg width="12" height="12" viewBox="0 0 12 12" fill="none" style="display:block"><path d="M8 2L4 6L8 10" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>', ve.addEventListener("click", (pt) => {
|
|
3102
|
+
pt.stopPropagation(), ge((Qt) => {
|
|
3103
|
+
const tt = new Set(Qt);
|
|
3104
|
+
if (tt.has(Y))
|
|
3105
|
+
tt.delete(Y);
|
|
3106
|
+
else {
|
|
3107
|
+
if (Array.from(Re.current.keys()).filter((Tn) => !tt.has(Tn)).length <= 1) return Qt;
|
|
3108
|
+
tt.add(Y);
|
|
3109
|
+
}
|
|
3110
|
+
return tt;
|
|
3111
|
+
});
|
|
3112
|
+
}), K.appendChild(ve), fe.appendChild(K);
|
|
3113
|
+
const Le = document.createElement("div");
|
|
3114
|
+
Le.style.flex = "1", Le.style.position = "relative", Le.style.overflow = "hidden", Le.style.transition = "opacity 0.2s ease";
|
|
3115
|
+
const _e = document.createElement("div");
|
|
3116
|
+
_e.style.position = "absolute", _e.style.left = "0", _e.style.right = "0", _e.style.top = "0", _e.style.bottom = "0", Le.appendChild(_e);
|
|
3117
|
+
let Be = null;
|
|
3118
|
+
return $e && (Be = document.createElement("div"), Be.className = "merge-editor-gutter", Le.appendChild(Be)), fe.appendChild(Le), Re.current.set(Y, { container: fe, editorWrapper: Le, labelDiv: K, labelText: me, collapseIcon: ve }), { container: fe, editorDiv: _e, gutterDiv: Be };
|
|
3119
|
+
}, H = te("input1", (h == null ? void 0 : h.input1) || "Theirs", Z, m), J = te("input2", (h == null ? void 0 : h.input2) || "Ours", j, m);
|
|
3120
|
+
H.gutterDiv && (Ve.current = H.gutterDiv), J.gutterDiv && (Ze.current = J.gutterDiv);
|
|
3121
|
+
const ce = !!n;
|
|
3122
|
+
let ie = null;
|
|
3123
|
+
if (ce) {
|
|
3124
|
+
ie = te("base", (h == null ? void 0 : h.base) || "Base", z, !1);
|
|
3125
|
+
const Y = [];
|
|
3126
|
+
d === 0 ? Y.push(ie.container, H.container, J.container) : d === 1 ? Y.push(H.container, ie.container, J.container) : d === 2 && Y.push(H.container, J.container, ie.container), Y.forEach((ye) => {
|
|
3127
|
+
w.appendChild(ye);
|
|
3113
3128
|
});
|
|
3114
3129
|
} else
|
|
3115
|
-
|
|
3130
|
+
w.appendChild(H.container), w.appendChild(J.container);
|
|
3116
3131
|
let G = null;
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3132
|
+
if (m && ce) {
|
|
3133
|
+
G = te("result", (h == null ? void 0 : h.result) || "Result", ue, !0);
|
|
3134
|
+
const Y = Re.current.get("result");
|
|
3135
|
+
Ie.current = (Y == null ? void 0 : Y.labelText) ?? G.container.querySelector("span"), G.gutterDiv && (je.current = G.gutterDiv), w.appendChild(G.container);
|
|
3136
|
+
}
|
|
3137
|
+
Qe.current.appendChild(w);
|
|
3138
|
+
const se = P.editor.createModel(t || "", I), C = ce ? P.editor.createModel(n || "", I) : null, q = P.editor.createModel(r || "", I);
|
|
3139
|
+
if (Q.current = P.editor.create(H.editorDiv, {
|
|
3140
|
+
model: se,
|
|
3121
3141
|
readOnly: !0,
|
|
3122
3142
|
automaticLayout: !0,
|
|
3123
3143
|
folding: !m,
|
|
3124
3144
|
glyphMargin: !1,
|
|
3125
3145
|
...i,
|
|
3126
3146
|
lineDecorationsWidth: m ? 26 : 10
|
|
3127
|
-
}),
|
|
3128
|
-
model:
|
|
3147
|
+
}), ce && ie && (pe.current = P.editor.create(ie.editorDiv, {
|
|
3148
|
+
model: C,
|
|
3129
3149
|
readOnly: !0,
|
|
3130
3150
|
automaticLayout: !0,
|
|
3131
3151
|
folding: !m,
|
|
3132
3152
|
glyphMargin: !1,
|
|
3133
3153
|
...i,
|
|
3134
3154
|
lineDecorationsWidth: 10
|
|
3135
|
-
})), ee.current =
|
|
3155
|
+
})), ee.current = P.editor.create(J.editorDiv, {
|
|
3136
3156
|
model: q,
|
|
3137
3157
|
readOnly: !0,
|
|
3138
3158
|
automaticLayout: !0,
|
|
@@ -3141,94 +3161,117 @@ function ro(e) {
|
|
|
3141
3161
|
...i,
|
|
3142
3162
|
lineDecorationsWidth: m ? 26 : 10
|
|
3143
3163
|
}), m && G) {
|
|
3144
|
-
const
|
|
3145
|
-
|
|
3146
|
-
model:
|
|
3164
|
+
const Y = P.editor.createModel(r || "", I);
|
|
3165
|
+
B.current = P.editor.create(G.editorDiv, {
|
|
3166
|
+
model: Y,
|
|
3147
3167
|
automaticLayout: !0,
|
|
3148
3168
|
folding: !m,
|
|
3149
3169
|
glyphMargin: !1,
|
|
3150
3170
|
...i,
|
|
3151
3171
|
readOnly: !1,
|
|
3152
3172
|
lineDecorationsWidth: 26
|
|
3153
|
-
}),
|
|
3154
|
-
|
|
3173
|
+
}), Y.onDidChangeContent(() => {
|
|
3174
|
+
Nt.current || re(!0);
|
|
3155
3175
|
});
|
|
3156
3176
|
}
|
|
3157
|
-
|
|
3158
|
-
const he =
|
|
3159
|
-
|
|
3177
|
+
P.editor.setTheme(o);
|
|
3178
|
+
const he = Gt(C, se, q);
|
|
3179
|
+
U(he), Me.current = !0, l && Q.current && ee.current && l(
|
|
3180
|
+
{
|
|
3181
|
+
input1: Q.current,
|
|
3182
|
+
input2: ee.current,
|
|
3183
|
+
base: pe.current,
|
|
3184
|
+
result: B.current
|
|
3185
|
+
},
|
|
3186
|
+
P
|
|
3187
|
+
);
|
|
3160
3188
|
}
|
|
3161
|
-
}, [i, o, t, r, n, m, d, b,
|
|
3189
|
+
}, [i, o, t, r, n, m, d, b, Gt, l, h]), Yt = ae(m), zt = ae(d), Ct = ae(_), Xt = ae(n);
|
|
3162
3190
|
return Se(() => {
|
|
3163
|
-
var
|
|
3164
|
-
const
|
|
3165
|
-
if ((
|
|
3166
|
-
|
|
3191
|
+
var k, F, Z, z, j, ue, te, H, J, ce, ie;
|
|
3192
|
+
const P = Yt.current !== m, w = zt.current !== d, N = Ct.current !== _, O = Xt.current !== n;
|
|
3193
|
+
if ((P || w || N || O) && Me.current) {
|
|
3194
|
+
Yt.current = m, zt.current = d, Ct.current = _, Xt.current = n, Je.current.forEach((he) => {
|
|
3167
3195
|
he.remove();
|
|
3168
|
-
}),
|
|
3169
|
-
const G = (
|
|
3170
|
-
(H =
|
|
3171
|
-
}
|
|
3172
|
-
}, [m, d,
|
|
3173
|
-
!b &&
|
|
3174
|
-
}, [b,
|
|
3175
|
-
!S || !i || (
|
|
3196
|
+
}), Je.current.clear(), Re.current.clear(), ge(/* @__PURE__ */ new Set()), (k = He.current) == null || k.set([]), (F = Ge.current) == null || F.set([]), (Z = We.current) == null || Z.set([]), He.current = null, Ge.current = null, We.current = null;
|
|
3197
|
+
const G = (z = Q.current) == null ? void 0 : z.getModel(), se = (j = pe.current) == null ? void 0 : j.getModel(), C = (ue = ee.current) == null ? void 0 : ue.getModel(), q = (te = B.current) == null ? void 0 : te.getModel();
|
|
3198
|
+
(H = Q.current) == null || H.dispose(), (J = pe.current) == null || J.dispose(), (ce = ee.current) == null || ce.dispose(), (ie = B.current) == null || ie.dispose(), G == null || G.dispose(), se == null || se.dispose(), C == null || C.dispose(), q == null || q.dispose(), Me.current = !1, Ne((he) => he + 1);
|
|
3199
|
+
}
|
|
3200
|
+
}, [m, d, _, n]), Se(() => {
|
|
3201
|
+
!b && we.current && Qe.current && !Me.current && qt();
|
|
3202
|
+
}, [b, qt]), Se(() => {
|
|
3203
|
+
!S || !i || (Q.current && Q.current.updateOptions(i), ee.current && ee.current.updateOptions(i), pe.current && pe.current.updateOptions(i), B.current && B.current.updateOptions(i));
|
|
3176
3204
|
}, [i, S]), Se(() => {
|
|
3177
|
-
S &&
|
|
3178
|
-
}, [S,
|
|
3179
|
-
S &&
|
|
3180
|
-
}, [S,
|
|
3205
|
+
S && L.length > 0 && (Wt(), m && ft());
|
|
3206
|
+
}, [S, L, Wt, ft, m]), Se(() => {
|
|
3207
|
+
S && L.length > 0 && m && B.current && ut(L);
|
|
3208
|
+
}, [S, L, m, ut]), Se(() => {
|
|
3181
3209
|
if (!S) return;
|
|
3182
|
-
const
|
|
3183
|
-
|
|
3184
|
-
},
|
|
3185
|
-
|
|
3210
|
+
const P = () => {
|
|
3211
|
+
A.length > 0 && lt(A);
|
|
3212
|
+
}, w = [], N = () => {
|
|
3213
|
+
ft();
|
|
3186
3214
|
};
|
|
3187
|
-
return
|
|
3188
|
-
|
|
3189
|
-
|
|
3215
|
+
return Q.current && w.push(Q.current.onDidScrollChange(N)), ee.current && w.push(ee.current.onDidScrollChange(N)), B.current && m && (w.push(B.current.onDidScrollChange(P)), w.push(B.current.onDidLayoutChange(P))), Q.current && w.push(Q.current.onDidLayoutChange(N)), ee.current && w.push(ee.current.onDidLayoutChange(N)), () => {
|
|
3216
|
+
w.forEach((O) => {
|
|
3217
|
+
O == null || O.dispose();
|
|
3190
3218
|
});
|
|
3191
3219
|
};
|
|
3192
|
-
}, [S,
|
|
3220
|
+
}, [S, ft, lt, m, A]), Se(() => {
|
|
3193
3221
|
if (!S) return;
|
|
3194
|
-
const
|
|
3195
|
-
m &&
|
|
3196
|
-
const
|
|
3197
|
-
let
|
|
3198
|
-
const
|
|
3199
|
-
if (
|
|
3200
|
-
|
|
3201
|
-
const
|
|
3202
|
-
|
|
3203
|
-
|
|
3222
|
+
const P = [Q.current, pe.current, ee.current];
|
|
3223
|
+
m && B.current && P.push(B.current);
|
|
3224
|
+
const w = [];
|
|
3225
|
+
let N = !1;
|
|
3226
|
+
const O = (k) => {
|
|
3227
|
+
if (N) return;
|
|
3228
|
+
N = !0;
|
|
3229
|
+
const F = k.getScrollTop(), Z = k.getScrollLeft();
|
|
3230
|
+
P.forEach((z) => {
|
|
3231
|
+
z && z !== k && (z.setScrollTop(F), z.setScrollLeft(Z));
|
|
3204
3232
|
}), setTimeout(() => {
|
|
3205
|
-
|
|
3233
|
+
N = !1;
|
|
3206
3234
|
}, 10);
|
|
3207
3235
|
};
|
|
3208
|
-
return
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3236
|
+
return P.forEach((k) => {
|
|
3237
|
+
k && w.push(
|
|
3238
|
+
k.onDidScrollChange(() => {
|
|
3239
|
+
O(k);
|
|
3212
3240
|
})
|
|
3213
3241
|
);
|
|
3214
3242
|
}), () => {
|
|
3215
|
-
|
|
3216
|
-
|
|
3243
|
+
w.forEach((k) => {
|
|
3244
|
+
k == null || k.dispose();
|
|
3217
3245
|
});
|
|
3218
3246
|
};
|
|
3219
|
-
}, [S, m]), Se(() =>
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3247
|
+
}, [S, m]), Se(() => {
|
|
3248
|
+
if (!S) return;
|
|
3249
|
+
const w = Array.from(Re.current.keys()).filter((N) => !oe.has(N)).length;
|
|
3250
|
+
for (const [N, O] of Re.current.entries()) {
|
|
3251
|
+
const k = oe.has(N), F = w > 1 || k;
|
|
3252
|
+
k ? (O.container.style.flex = "0 0 28px", O.container.style.minWidth = "28px", O.container.style.maxWidth = "28px", O.editorWrapper.style.opacity = "0", O.editorWrapper.style.pointerEvents = "none", O.labelDiv.style.justifyContent = "center", O.labelText.style.display = "none", O.collapseIcon.style.transform = "rotate(180deg)", O.collapseIcon.title = "Expand column") : (O.container.style.flex = "1", O.container.style.minWidth = "", O.container.style.maxWidth = "", O.editorWrapper.style.opacity = "1", O.editorWrapper.style.pointerEvents = "", O.labelDiv.style.justifyContent = "", O.labelText.style.display = "", O.collapseIcon.style.transform = "", O.collapseIcon.title = "Collapse column"), !k && !F ? (O.collapseIcon.classList.add("column-collapse-icon--disabled"), O.collapseIcon.title = "Cannot collapse last column") : O.collapseIcon.classList.remove("column-collapse-icon--disabled");
|
|
3253
|
+
}
|
|
3254
|
+
requestAnimationFrame(() => {
|
|
3255
|
+
var N;
|
|
3256
|
+
for (const [O] of Re.current.entries())
|
|
3257
|
+
if (!oe.has(O)) {
|
|
3258
|
+
const k = O === "input1" ? Q : O === "input2" ? ee : O === "base" ? pe : O === "result" ? B : null;
|
|
3259
|
+
(N = k == null ? void 0 : k.current) == null || N.layout();
|
|
3260
|
+
}
|
|
3261
|
+
});
|
|
3262
|
+
}, [S, oe]), Se(() => () => {
|
|
3263
|
+
var k, F, Z, z, j, ue, te, H, J, ce, ie;
|
|
3264
|
+
(k = He.current) == null || k.set([]), (F = Ge.current) == null || F.set([]), (Z = We.current) == null || Z.set([]);
|
|
3265
|
+
const P = (z = Q.current) == null ? void 0 : z.getModel(), w = (j = pe.current) == null ? void 0 : j.getModel(), N = (ue = ee.current) == null ? void 0 : ue.getModel(), O = (te = B.current) == null ? void 0 : te.getModel();
|
|
3266
|
+
(H = Q.current) == null || H.dispose(), (J = pe.current) == null || J.dispose(), (ce = ee.current) == null || ce.dispose(), (ie = B.current) == null || ie.dispose(), P == null || P.dispose(), w == null || w.dispose(), N == null || N.dispose(), O == null || O.dispose(), Me.current = !1, g(!1);
|
|
3267
|
+
}, []), b || !S ? /* @__PURE__ */ ht(In, { children: u ?? /* @__PURE__ */ ht(io, {}) }) : /* @__PURE__ */ ht("div", { ref: Qe, style: { width: s, height: c }, className: a });
|
|
3225
3268
|
}
|
|
3226
3269
|
export {
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3270
|
+
fo as JsonDiffMergeEditor,
|
|
3271
|
+
Wr as analyzeConflicts,
|
|
3272
|
+
qr as analyzeTwoWayConflicts,
|
|
3273
|
+
uo as computeDiffs,
|
|
3274
|
+
zr as computeDiffsJsonPatch,
|
|
3275
|
+
Cr as computeLineConflictType
|
|
3233
3276
|
};
|
|
3234
3277
|
//# sourceMappingURL=index.mjs.map
|