@iodev/patch-and-resolve 1.0.6

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.
@@ -0,0 +1,1450 @@
1
+ import ze, { useState as $, useCallback as ge } from "react";
2
+ var ne = { exports: {} }, G = {};
3
+ /**
4
+ * @license React
5
+ * react-jsx-runtime.production.min.js
6
+ *
7
+ * Copyright (c) Facebook, Inc. and its affiliates.
8
+ *
9
+ * This source code is licensed under the MIT license found in the
10
+ * LICENSE file in the root directory of this source tree.
11
+ */
12
+ var We;
13
+ function xr() {
14
+ if (We) return G;
15
+ We = 1;
16
+ var s = ze, o = Symbol.for("react.element"), u = Symbol.for("react.fragment"), i = Object.prototype.hasOwnProperty, a = s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, g = { key: !0, ref: !0, __self: !0, __source: !0 };
17
+ function v(y, d, C) {
18
+ var m, l = {}, p = null, j = null;
19
+ C !== void 0 && (p = "" + C), d.key !== void 0 && (p = "" + d.key), d.ref !== void 0 && (j = d.ref);
20
+ for (m in d) i.call(d, m) && !g.hasOwnProperty(m) && (l[m] = d[m]);
21
+ if (y && y.defaultProps) for (m in d = y.defaultProps, d) l[m] === void 0 && (l[m] = d[m]);
22
+ return { $$typeof: o, type: y, key: p, ref: j, props: l, _owner: a.current };
23
+ }
24
+ return G.Fragment = u, G.jsx = v, G.jsxs = v, G;
25
+ }
26
+ var X = {};
27
+ /**
28
+ * @license React
29
+ * react-jsx-runtime.development.js
30
+ *
31
+ * Copyright (c) Facebook, Inc. and its affiliates.
32
+ *
33
+ * This source code is licensed under the MIT license found in the
34
+ * LICENSE file in the root directory of this source tree.
35
+ */
36
+ var Je;
37
+ function yr() {
38
+ return Je || (Je = 1, process.env.NODE_ENV !== "production" && (function() {
39
+ var s = ze, o = Symbol.for("react.element"), u = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), a = Symbol.for("react.strict_mode"), g = Symbol.for("react.profiler"), v = Symbol.for("react.provider"), y = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), C = Symbol.for("react.suspense"), m = Symbol.for("react.suspense_list"), l = Symbol.for("react.memo"), p = Symbol.for("react.lazy"), j = Symbol.for("react.offscreen"), P = Symbol.iterator, I = "@@iterator";
40
+ function D(e) {
41
+ if (e === null || typeof e != "object")
42
+ return null;
43
+ var r = P && e[P] || e[I];
44
+ return typeof r == "function" ? r : null;
45
+ }
46
+ var T = s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
47
+ function k(e) {
48
+ {
49
+ for (var r = arguments.length, t = new Array(r > 1 ? r - 1 : 0), c = 1; c < r; c++)
50
+ t[c - 1] = arguments[c];
51
+ W("error", e, t);
52
+ }
53
+ }
54
+ function W(e, r, t) {
55
+ {
56
+ var c = T.ReactDebugCurrentFrame, b = c.getStackAddendum();
57
+ b !== "" && (r += "%s", t = t.concat([b]));
58
+ var R = t.map(function(x) {
59
+ return String(x);
60
+ });
61
+ R.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, R);
62
+ }
63
+ }
64
+ var A = !1, M = !1, f = !1, E = !1, S = !1, Z;
65
+ Z = Symbol.for("react.module.reference");
66
+ function ae(e) {
67
+ return !!(typeof e == "string" || typeof e == "function" || e === i || e === g || S || e === a || e === C || e === m || E || e === j || A || M || f || typeof e == "object" && e !== null && (e.$$typeof === p || e.$$typeof === l || e.$$typeof === v || e.$$typeof === y || e.$$typeof === d || // This needs to include all possible module reference object
68
+ // types supported by any Flight configuration anywhere since
69
+ // we don't know which Flight build this will end up being used
70
+ // with.
71
+ e.$$typeof === Z || e.getModuleId !== void 0));
72
+ }
73
+ function ie(e, r, t) {
74
+ var c = e.displayName;
75
+ if (c)
76
+ return c;
77
+ var b = r.displayName || r.name || "";
78
+ return b !== "" ? t + "(" + b + ")" : t;
79
+ }
80
+ function H(e) {
81
+ return e.displayName || "Context";
82
+ }
83
+ function N(e) {
84
+ if (e == null)
85
+ return null;
86
+ if (typeof e.tag == "number" && k("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
87
+ return e.displayName || e.name || null;
88
+ if (typeof e == "string")
89
+ return e;
90
+ switch (e) {
91
+ case i:
92
+ return "Fragment";
93
+ case u:
94
+ return "Portal";
95
+ case g:
96
+ return "Profiler";
97
+ case a:
98
+ return "StrictMode";
99
+ case C:
100
+ return "Suspense";
101
+ case m:
102
+ return "SuspenseList";
103
+ }
104
+ if (typeof e == "object")
105
+ switch (e.$$typeof) {
106
+ case y:
107
+ var r = e;
108
+ return H(r) + ".Consumer";
109
+ case v:
110
+ var t = e;
111
+ return H(t._context) + ".Provider";
112
+ case d:
113
+ return ie(e, e.render, "ForwardRef");
114
+ case l:
115
+ var c = e.displayName || null;
116
+ return c !== null ? c : N(e.type) || "Memo";
117
+ case p: {
118
+ var b = e, R = b._payload, x = b._init;
119
+ try {
120
+ return N(x(R));
121
+ } catch {
122
+ return null;
123
+ }
124
+ }
125
+ }
126
+ return null;
127
+ }
128
+ var J = Object.assign, q = 0, xe, ye, me, be, Re, je, Ce;
129
+ function Ee() {
130
+ }
131
+ Ee.__reactDisabledLog = !0;
132
+ function Le() {
133
+ {
134
+ if (q === 0) {
135
+ xe = console.log, ye = console.info, me = console.warn, be = console.error, Re = console.group, je = console.groupCollapsed, Ce = console.groupEnd;
136
+ var e = {
137
+ configurable: !0,
138
+ enumerable: !0,
139
+ value: Ee,
140
+ writable: !0
141
+ };
142
+ Object.defineProperties(console, {
143
+ info: e,
144
+ log: e,
145
+ warn: e,
146
+ error: e,
147
+ group: e,
148
+ groupCollapsed: e,
149
+ groupEnd: e
150
+ });
151
+ }
152
+ q++;
153
+ }
154
+ }
155
+ function Ue() {
156
+ {
157
+ if (q--, q === 0) {
158
+ var e = {
159
+ configurable: !0,
160
+ enumerable: !0,
161
+ writable: !0
162
+ };
163
+ Object.defineProperties(console, {
164
+ log: J({}, e, {
165
+ value: xe
166
+ }),
167
+ info: J({}, e, {
168
+ value: ye
169
+ }),
170
+ warn: J({}, e, {
171
+ value: me
172
+ }),
173
+ error: J({}, e, {
174
+ value: be
175
+ }),
176
+ group: J({}, e, {
177
+ value: Re
178
+ }),
179
+ groupCollapsed: J({}, e, {
180
+ value: je
181
+ }),
182
+ groupEnd: J({}, e, {
183
+ value: Ce
184
+ })
185
+ });
186
+ }
187
+ q < 0 && k("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
188
+ }
189
+ }
190
+ var le = T.ReactCurrentDispatcher, ce;
191
+ function Q(e, r, t) {
192
+ {
193
+ if (ce === void 0)
194
+ try {
195
+ throw Error();
196
+ } catch (b) {
197
+ var c = b.stack.trim().match(/\n( *(at )?)/);
198
+ ce = c && c[1] || "";
199
+ }
200
+ return `
201
+ ` + ce + e;
202
+ }
203
+ }
204
+ var ue = !1, ee;
205
+ {
206
+ var Be = typeof WeakMap == "function" ? WeakMap : Map;
207
+ ee = new Be();
208
+ }
209
+ function Pe(e, r) {
210
+ if (!e || ue)
211
+ return "";
212
+ {
213
+ var t = ee.get(e);
214
+ if (t !== void 0)
215
+ return t;
216
+ }
217
+ var c;
218
+ ue = !0;
219
+ var b = Error.prepareStackTrace;
220
+ Error.prepareStackTrace = void 0;
221
+ var R;
222
+ R = le.current, le.current = null, Le();
223
+ try {
224
+ if (r) {
225
+ var x = function() {
226
+ throw Error();
227
+ };
228
+ if (Object.defineProperty(x.prototype, "props", {
229
+ set: function() {
230
+ throw Error();
231
+ }
232
+ }), typeof Reflect == "object" && Reflect.construct) {
233
+ try {
234
+ Reflect.construct(x, []);
235
+ } catch (F) {
236
+ c = F;
237
+ }
238
+ Reflect.construct(e, [], x);
239
+ } else {
240
+ try {
241
+ x.call();
242
+ } catch (F) {
243
+ c = F;
244
+ }
245
+ e.call(x.prototype);
246
+ }
247
+ } else {
248
+ try {
249
+ throw Error();
250
+ } catch (F) {
251
+ c = F;
252
+ }
253
+ e();
254
+ }
255
+ } catch (F) {
256
+ if (F && c && typeof F.stack == "string") {
257
+ for (var h = F.stack.split(`
258
+ `), O = c.stack.split(`
259
+ `), w = h.length - 1, _ = O.length - 1; w >= 1 && _ >= 0 && h[w] !== O[_]; )
260
+ _--;
261
+ for (; w >= 1 && _ >= 0; w--, _--)
262
+ if (h[w] !== O[_]) {
263
+ if (w !== 1 || _ !== 1)
264
+ do
265
+ if (w--, _--, _ < 0 || h[w] !== O[_]) {
266
+ var V = `
267
+ ` + h[w].replace(" at new ", " at ");
268
+ return e.displayName && V.includes("<anonymous>") && (V = V.replace("<anonymous>", e.displayName)), typeof e == "function" && ee.set(e, V), V;
269
+ }
270
+ while (w >= 1 && _ >= 0);
271
+ break;
272
+ }
273
+ }
274
+ } finally {
275
+ ue = !1, le.current = R, Ue(), Error.prepareStackTrace = b;
276
+ }
277
+ var L = e ? e.displayName || e.name : "", Y = L ? Q(L) : "";
278
+ return typeof e == "function" && ee.set(e, Y), Y;
279
+ }
280
+ function He(e, r, t) {
281
+ return Pe(e, !1);
282
+ }
283
+ function qe(e) {
284
+ var r = e.prototype;
285
+ return !!(r && r.isReactComponent);
286
+ }
287
+ function re(e, r, t) {
288
+ if (e == null)
289
+ return "";
290
+ if (typeof e == "function")
291
+ return Pe(e, qe(e));
292
+ if (typeof e == "string")
293
+ return Q(e);
294
+ switch (e) {
295
+ case C:
296
+ return Q("Suspense");
297
+ case m:
298
+ return Q("SuspenseList");
299
+ }
300
+ if (typeof e == "object")
301
+ switch (e.$$typeof) {
302
+ case d:
303
+ return He(e.render);
304
+ case l:
305
+ return re(e.type, r, t);
306
+ case p: {
307
+ var c = e, b = c._payload, R = c._init;
308
+ try {
309
+ return re(R(b), r, t);
310
+ } catch {
311
+ }
312
+ }
313
+ }
314
+ return "";
315
+ }
316
+ var K = Object.prototype.hasOwnProperty, we = {}, Se = T.ReactDebugCurrentFrame;
317
+ function te(e) {
318
+ if (e) {
319
+ var r = e._owner, t = re(e.type, e._source, r ? r.type : null);
320
+ Se.setExtraStackFrame(t);
321
+ } else
322
+ Se.setExtraStackFrame(null);
323
+ }
324
+ function Ke(e, r, t, c, b) {
325
+ {
326
+ var R = Function.call.bind(K);
327
+ for (var x in e)
328
+ if (R(e, x)) {
329
+ var h = void 0;
330
+ try {
331
+ if (typeof e[x] != "function") {
332
+ var O = Error((c || "React class") + ": " + t + " type `" + x + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[x] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
333
+ throw O.name = "Invariant Violation", O;
334
+ }
335
+ h = e[x](r, x, c, t, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
336
+ } catch (w) {
337
+ h = w;
338
+ }
339
+ h && !(h instanceof Error) && (te(b), k("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", c || "React class", t, x, typeof h), te(null)), h instanceof Error && !(h.message in we) && (we[h.message] = !0, te(b), k("Failed %s type: %s", t, h.message), te(null));
340
+ }
341
+ }
342
+ }
343
+ var Ge = Array.isArray;
344
+ function fe(e) {
345
+ return Ge(e);
346
+ }
347
+ function Xe(e) {
348
+ {
349
+ var r = typeof Symbol == "function" && Symbol.toStringTag, t = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
350
+ return t;
351
+ }
352
+ }
353
+ function Ze(e) {
354
+ try {
355
+ return _e(e), !1;
356
+ } catch {
357
+ return !0;
358
+ }
359
+ }
360
+ function _e(e) {
361
+ return "" + e;
362
+ }
363
+ function ke(e) {
364
+ if (Ze(e))
365
+ return k("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Xe(e)), _e(e);
366
+ }
367
+ var Te = T.ReactCurrentOwner, Qe = {
368
+ key: !0,
369
+ ref: !0,
370
+ __self: !0,
371
+ __source: !0
372
+ }, Oe, Ae;
373
+ function er(e) {
374
+ if (K.call(e, "ref")) {
375
+ var r = Object.getOwnPropertyDescriptor(e, "ref").get;
376
+ if (r && r.isReactWarning)
377
+ return !1;
378
+ }
379
+ return e.ref !== void 0;
380
+ }
381
+ function rr(e) {
382
+ if (K.call(e, "key")) {
383
+ var r = Object.getOwnPropertyDescriptor(e, "key").get;
384
+ if (r && r.isReactWarning)
385
+ return !1;
386
+ }
387
+ return e.key !== void 0;
388
+ }
389
+ function tr(e, r) {
390
+ typeof e.ref == "string" && Te.current;
391
+ }
392
+ function nr(e, r) {
393
+ {
394
+ var t = function() {
395
+ Oe || (Oe = !0, k("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
396
+ };
397
+ t.isReactWarning = !0, Object.defineProperty(e, "key", {
398
+ get: t,
399
+ configurable: !0
400
+ });
401
+ }
402
+ }
403
+ function or(e, r) {
404
+ {
405
+ var t = function() {
406
+ Ae || (Ae = !0, k("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
407
+ };
408
+ t.isReactWarning = !0, Object.defineProperty(e, "ref", {
409
+ get: t,
410
+ configurable: !0
411
+ });
412
+ }
413
+ }
414
+ var sr = function(e, r, t, c, b, R, x) {
415
+ var h = {
416
+ // This tag allows us to uniquely identify this as a React Element
417
+ $$typeof: o,
418
+ // Built-in properties that belong on the element
419
+ type: e,
420
+ key: r,
421
+ ref: t,
422
+ props: x,
423
+ // Record the component responsible for creating this element.
424
+ _owner: R
425
+ };
426
+ return h._store = {}, Object.defineProperty(h._store, "validated", {
427
+ configurable: !1,
428
+ enumerable: !1,
429
+ writable: !0,
430
+ value: !1
431
+ }), Object.defineProperty(h, "_self", {
432
+ configurable: !1,
433
+ enumerable: !1,
434
+ writable: !1,
435
+ value: c
436
+ }), Object.defineProperty(h, "_source", {
437
+ configurable: !1,
438
+ enumerable: !1,
439
+ writable: !1,
440
+ value: b
441
+ }), Object.freeze && (Object.freeze(h.props), Object.freeze(h)), h;
442
+ };
443
+ function ar(e, r, t, c, b) {
444
+ {
445
+ var R, x = {}, h = null, O = null;
446
+ t !== void 0 && (ke(t), h = "" + t), rr(r) && (ke(r.key), h = "" + r.key), er(r) && (O = r.ref, tr(r, b));
447
+ for (R in r)
448
+ K.call(r, R) && !Qe.hasOwnProperty(R) && (x[R] = r[R]);
449
+ if (e && e.defaultProps) {
450
+ var w = e.defaultProps;
451
+ for (R in w)
452
+ x[R] === void 0 && (x[R] = w[R]);
453
+ }
454
+ if (h || O) {
455
+ var _ = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
456
+ h && nr(x, _), O && or(x, _);
457
+ }
458
+ return sr(e, h, O, b, c, Te.current, x);
459
+ }
460
+ }
461
+ var de = T.ReactCurrentOwner, Fe = T.ReactDebugCurrentFrame;
462
+ function z(e) {
463
+ if (e) {
464
+ var r = e._owner, t = re(e.type, e._source, r ? r.type : null);
465
+ Fe.setExtraStackFrame(t);
466
+ } else
467
+ Fe.setExtraStackFrame(null);
468
+ }
469
+ var pe;
470
+ pe = !1;
471
+ function he(e) {
472
+ return typeof e == "object" && e !== null && e.$$typeof === o;
473
+ }
474
+ function Ie() {
475
+ {
476
+ if (de.current) {
477
+ var e = N(de.current.type);
478
+ if (e)
479
+ return `
480
+
481
+ Check the render method of \`` + e + "`.";
482
+ }
483
+ return "";
484
+ }
485
+ }
486
+ function ir(e) {
487
+ return "";
488
+ }
489
+ var De = {};
490
+ function lr(e) {
491
+ {
492
+ var r = Ie();
493
+ if (!r) {
494
+ var t = typeof e == "string" ? e : e.displayName || e.name;
495
+ t && (r = `
496
+
497
+ Check the top-level render call using <` + t + ">.");
498
+ }
499
+ return r;
500
+ }
501
+ }
502
+ function Ve(e, r) {
503
+ {
504
+ if (!e._store || e._store.validated || e.key != null)
505
+ return;
506
+ e._store.validated = !0;
507
+ var t = lr(r);
508
+ if (De[t])
509
+ return;
510
+ De[t] = !0;
511
+ var c = "";
512
+ e && e._owner && e._owner !== de.current && (c = " It was passed a child from " + N(e._owner.type) + "."), z(e), k('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', t, c), z(null);
513
+ }
514
+ }
515
+ function Ne(e, r) {
516
+ {
517
+ if (typeof e != "object")
518
+ return;
519
+ if (fe(e))
520
+ for (var t = 0; t < e.length; t++) {
521
+ var c = e[t];
522
+ he(c) && Ve(c, r);
523
+ }
524
+ else if (he(e))
525
+ e._store && (e._store.validated = !0);
526
+ else if (e) {
527
+ var b = D(e);
528
+ if (typeof b == "function" && b !== e.entries)
529
+ for (var R = b.call(e), x; !(x = R.next()).done; )
530
+ he(x.value) && Ve(x.value, r);
531
+ }
532
+ }
533
+ }
534
+ function cr(e) {
535
+ {
536
+ var r = e.type;
537
+ if (r == null || typeof r == "string")
538
+ return;
539
+ var t;
540
+ if (typeof r == "function")
541
+ t = r.propTypes;
542
+ else if (typeof r == "object" && (r.$$typeof === d || // Note: Memo only checks outer props here.
543
+ // Inner props are checked in the reconciler.
544
+ r.$$typeof === l))
545
+ t = r.propTypes;
546
+ else
547
+ return;
548
+ if (t) {
549
+ var c = N(r);
550
+ Ke(t, e.props, "prop", c, e);
551
+ } else if (r.PropTypes !== void 0 && !pe) {
552
+ pe = !0;
553
+ var b = N(r);
554
+ k("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", b || "Unknown");
555
+ }
556
+ typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && k("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
557
+ }
558
+ }
559
+ function ur(e) {
560
+ {
561
+ for (var r = Object.keys(e.props), t = 0; t < r.length; t++) {
562
+ var c = r[t];
563
+ if (c !== "children" && c !== "key") {
564
+ z(e), k("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", c), z(null);
565
+ break;
566
+ }
567
+ }
568
+ e.ref !== null && (z(e), k("Invalid attribute `ref` supplied to `React.Fragment`."), z(null));
569
+ }
570
+ }
571
+ var $e = {};
572
+ function Me(e, r, t, c, b, R) {
573
+ {
574
+ var x = ae(e);
575
+ if (!x) {
576
+ var h = "";
577
+ (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (h += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
578
+ var O = ir();
579
+ O ? h += O : h += Ie();
580
+ var w;
581
+ e === null ? w = "null" : fe(e) ? w = "array" : e !== void 0 && e.$$typeof === o ? (w = "<" + (N(e.type) || "Unknown") + " />", h = " Did you accidentally export a JSX literal instead of a component?") : w = typeof e, k("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", w, h);
582
+ }
583
+ var _ = ar(e, r, t, b, R);
584
+ if (_ == null)
585
+ return _;
586
+ if (x) {
587
+ var V = r.children;
588
+ if (V !== void 0)
589
+ if (c)
590
+ if (fe(V)) {
591
+ for (var L = 0; L < V.length; L++)
592
+ Ne(V[L], e);
593
+ Object.freeze && Object.freeze(V);
594
+ } else
595
+ k("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
596
+ else
597
+ Ne(V, e);
598
+ }
599
+ if (K.call(r, "key")) {
600
+ var Y = N(e), F = Object.keys(r).filter(function(gr) {
601
+ return gr !== "key";
602
+ }), ve = F.length > 0 ? "{key: someKey, " + F.join(": ..., ") + ": ...}" : "{key: someKey}";
603
+ if (!$e[Y + ve]) {
604
+ var vr = F.length > 0 ? "{" + F.join(": ..., ") + ": ...}" : "{}";
605
+ k(`A props object containing a "key" prop is being spread into JSX:
606
+ let props = %s;
607
+ <%s {...props} />
608
+ React keys must be passed directly to JSX without using spread:
609
+ let props = %s;
610
+ <%s key={someKey} {...props} />`, ve, Y, vr, Y), $e[Y + ve] = !0;
611
+ }
612
+ }
613
+ return e === i ? ur(_) : cr(_), _;
614
+ }
615
+ }
616
+ function fr(e, r, t) {
617
+ return Me(e, r, t, !0);
618
+ }
619
+ function dr(e, r, t) {
620
+ return Me(e, r, t, !1);
621
+ }
622
+ var pr = dr, hr = fr;
623
+ X.Fragment = i, X.jsx = pr, X.jsxs = hr;
624
+ })()), X;
625
+ }
626
+ var Ye;
627
+ function mr() {
628
+ return Ye || (Ye = 1, process.env.NODE_ENV === "production" ? ne.exports = xr() : ne.exports = yr()), ne.exports;
629
+ }
630
+ var n = mr();
631
+ const br = ({
632
+ conflicts: s,
633
+ onResolveAll: o,
634
+ onClose: u,
635
+ renderConflictValue: i
636
+ }) => {
637
+ const [a, g] = $(0), [v, y] = $(/* @__PURE__ */ new Map()), d = s[a], C = s.length, m = a === 0, l = a === C - 1, p = v.get(a), j = (A) => {
638
+ y(new Map(v.set(a, A)));
639
+ }, P = (A) => /* @__PURE__ */ n.jsx(
640
+ "pre",
641
+ {
642
+ style: {
643
+ backgroundColor: "#f5f5f5",
644
+ padding: "15px",
645
+ borderRadius: "4px",
646
+ overflow: "auto",
647
+ maxHeight: "300px",
648
+ fontSize: "13px",
649
+ margin: 0
650
+ },
651
+ children: JSON.stringify(A, null, 2)
652
+ }
653
+ ), I = (A, M) => {
654
+ const f = p === (M === "local" ? "use-local" : "use-remote");
655
+ return i ? i(A, {
656
+ conflict: d,
657
+ side: M,
658
+ isSelected: f
659
+ }) : P(A);
660
+ }, D = () => {
661
+ m || g(a - 1);
662
+ }, T = () => {
663
+ !l && p && g(a + 1);
664
+ }, k = () => {
665
+ if (v.size === C) {
666
+ const A = [];
667
+ v.forEach((M, f) => {
668
+ A.push({ conflictIndex: f, strategy: M });
669
+ }), o(A);
670
+ }
671
+ }, W = v.size === C;
672
+ return /* @__PURE__ */ n.jsx(
673
+ "div",
674
+ {
675
+ style: {
676
+ position: "fixed",
677
+ top: 0,
678
+ left: 0,
679
+ right: 0,
680
+ bottom: 0,
681
+ backgroundColor: "rgba(0, 0, 0, 0.5)",
682
+ display: "flex",
683
+ alignItems: "center",
684
+ justifyContent: "center",
685
+ zIndex: 1e3
686
+ },
687
+ children: /* @__PURE__ */ n.jsxs(
688
+ "div",
689
+ {
690
+ style: {
691
+ backgroundColor: "white",
692
+ padding: "30px",
693
+ borderRadius: "8px",
694
+ maxWidth: "900px",
695
+ width: "90%",
696
+ maxHeight: "80vh",
697
+ overflow: "auto"
698
+ },
699
+ children: [
700
+ /* @__PURE__ */ n.jsx("h2", { children: "Patch Conflict Resolution" }),
701
+ /* @__PURE__ */ n.jsxs("p", { style: { color: "#666" }, children: [
702
+ "Conflict ",
703
+ a + 1,
704
+ " of ",
705
+ C
706
+ ] }),
707
+ /* @__PURE__ */ n.jsxs(
708
+ "div",
709
+ {
710
+ style: {
711
+ backgroundColor: "#fff3cd",
712
+ padding: "15px",
713
+ borderRadius: "4px",
714
+ marginTop: "20px",
715
+ border: "1px solid #ffc107"
716
+ },
717
+ children: [
718
+ /* @__PURE__ */ n.jsxs("div", { style: { marginBottom: "10px" }, children: [
719
+ /* @__PURE__ */ n.jsx("strong", { children: "Field:" }),
720
+ " ",
721
+ /* @__PURE__ */ n.jsx("code", { children: d.path })
722
+ ] }),
723
+ d.remotePatchIndex !== void 0 && /* @__PURE__ */ n.jsxs("div", { style: { marginBottom: "10px", fontSize: "14px", color: "#666" }, children: [
724
+ "Conflict from remote patch #",
725
+ d.remotePatchIndex + 1
726
+ ] })
727
+ ]
728
+ }
729
+ ),
730
+ /* @__PURE__ */ n.jsxs("div", { style: { display: "flex", gap: "20px", marginTop: "20px" }, children: [
731
+ /* @__PURE__ */ n.jsxs("div", { style: { flex: 1 }, children: [
732
+ /* @__PURE__ */ n.jsx("h3", { children: "Local Value" }),
733
+ /* @__PURE__ */ n.jsx(
734
+ "div",
735
+ {
736
+ style: {
737
+ border: p === "use-local" ? "2px solid #4CAF50" : "1px solid #ddd",
738
+ borderRadius: "4px"
739
+ },
740
+ children: I(d.localValue, "local")
741
+ }
742
+ ),
743
+ /* @__PURE__ */ n.jsx(
744
+ "button",
745
+ {
746
+ onClick: () => j("use-local"),
747
+ style: {
748
+ marginTop: "10px",
749
+ padding: "10px 20px",
750
+ backgroundColor: p === "use-local" ? "#4CAF50" : "#ddd",
751
+ color: p === "use-local" ? "white" : "#333",
752
+ border: "none",
753
+ borderRadius: "4px",
754
+ cursor: "pointer",
755
+ width: "100%",
756
+ fontWeight: p === "use-local" ? "bold" : "normal"
757
+ },
758
+ children: p === "use-local" ? "✓ Selected" : "Use Local"
759
+ }
760
+ )
761
+ ] }),
762
+ /* @__PURE__ */ n.jsxs("div", { style: { flex: 1 }, children: [
763
+ /* @__PURE__ */ n.jsx("h3", { children: "Remote Value" }),
764
+ /* @__PURE__ */ n.jsx(
765
+ "div",
766
+ {
767
+ style: {
768
+ border: p === "use-remote" ? "2px solid #2196F3" : "1px solid #ddd",
769
+ borderRadius: "4px"
770
+ },
771
+ children: I(d.remoteValue, "remote")
772
+ }
773
+ ),
774
+ /* @__PURE__ */ n.jsx(
775
+ "button",
776
+ {
777
+ onClick: () => j("use-remote"),
778
+ style: {
779
+ marginTop: "10px",
780
+ padding: "10px 20px",
781
+ backgroundColor: p === "use-remote" ? "#2196F3" : "#ddd",
782
+ color: p === "use-remote" ? "white" : "#333",
783
+ border: "none",
784
+ borderRadius: "4px",
785
+ cursor: "pointer",
786
+ width: "100%",
787
+ fontWeight: p === "use-remote" ? "bold" : "normal"
788
+ },
789
+ children: p === "use-remote" ? "✓ Selected" : "Use Remote"
790
+ }
791
+ )
792
+ ] })
793
+ ] }),
794
+ /* @__PURE__ */ n.jsxs("div", { style: { display: "flex", gap: "10px", marginTop: "30px", justifyContent: "space-between" }, children: [
795
+ /* @__PURE__ */ n.jsxs("div", { style: { display: "flex", gap: "10px" }, children: [
796
+ /* @__PURE__ */ n.jsx(
797
+ "button",
798
+ {
799
+ onClick: D,
800
+ disabled: m,
801
+ style: {
802
+ padding: "10px 20px",
803
+ backgroundColor: m ? "#e0e0e0" : "#757575",
804
+ color: "white",
805
+ border: "none",
806
+ borderRadius: "4px",
807
+ cursor: m ? "not-allowed" : "pointer"
808
+ },
809
+ children: "← Previous"
810
+ }
811
+ ),
812
+ /* @__PURE__ */ n.jsx(
813
+ "button",
814
+ {
815
+ onClick: T,
816
+ disabled: l || !p,
817
+ style: {
818
+ padding: "10px 20px",
819
+ backgroundColor: l || !p ? "#e0e0e0" : "#757575",
820
+ color: "white",
821
+ border: "none",
822
+ borderRadius: "4px",
823
+ cursor: l || !p ? "not-allowed" : "pointer"
824
+ },
825
+ children: "Next →"
826
+ }
827
+ )
828
+ ] }),
829
+ /* @__PURE__ */ n.jsxs("div", { style: { display: "flex", gap: "10px" }, children: [
830
+ /* @__PURE__ */ n.jsx(
831
+ "button",
832
+ {
833
+ onClick: u,
834
+ style: {
835
+ padding: "10px 20px",
836
+ backgroundColor: "#999",
837
+ color: "white",
838
+ border: "none",
839
+ borderRadius: "4px",
840
+ cursor: "pointer"
841
+ },
842
+ children: "Cancel"
843
+ }
844
+ ),
845
+ /* @__PURE__ */ n.jsxs(
846
+ "button",
847
+ {
848
+ onClick: k,
849
+ disabled: !W,
850
+ style: {
851
+ padding: "10px 20px",
852
+ backgroundColor: W ? "#4CAF50" : "#e0e0e0",
853
+ color: "white",
854
+ border: "none",
855
+ borderRadius: "4px",
856
+ cursor: W ? "pointer" : "not-allowed",
857
+ fontWeight: "bold"
858
+ },
859
+ children: [
860
+ "Finish (",
861
+ v.size,
862
+ "/",
863
+ C,
864
+ ")"
865
+ ]
866
+ }
867
+ )
868
+ ] })
869
+ ] }),
870
+ !p && /* @__PURE__ */ n.jsx("p", { style: { marginTop: "15px", color: "#ff9800", fontSize: "14px", textAlign: "center" }, children: "Please select either Local or Remote to continue" })
871
+ ]
872
+ }
873
+ )
874
+ }
875
+ );
876
+ };
877
+ function U(s, o) {
878
+ const u = o.split(".");
879
+ let i = s;
880
+ for (const a of u) {
881
+ if (i == null)
882
+ return;
883
+ i = i[a];
884
+ }
885
+ return i;
886
+ }
887
+ function oe(s, o, u) {
888
+ const i = o.split(".");
889
+ let a = s;
890
+ for (let g = 0; g < i.length - 1; g++) {
891
+ const v = i[g];
892
+ (a[v] === null || typeof a[v] != "object") && (a[v] = {}), a = a[v];
893
+ }
894
+ a[i[i.length - 1]] = u;
895
+ }
896
+ function Er(s, o) {
897
+ const u = o.split(".");
898
+ let i = s;
899
+ for (const a of u) {
900
+ if (i === null || typeof i != "object" || !(a in i))
901
+ return !1;
902
+ i = i[a];
903
+ }
904
+ return !0;
905
+ }
906
+ function B(s, o = "") {
907
+ const u = [];
908
+ if (s === null || typeof s != "object" || Array.isArray(s))
909
+ return o ? [o] : [];
910
+ const i = Object.keys(s);
911
+ if (i.length === 0)
912
+ return o ? [o] : [];
913
+ for (const a of i) {
914
+ if (a === "version")
915
+ continue;
916
+ const g = o ? `${o}.${a}` : a, v = s[a];
917
+ if (v === null || typeof v != "object" || Array.isArray(v))
918
+ u.push(g);
919
+ else {
920
+ const y = B(v, g);
921
+ u.push(...y);
922
+ }
923
+ }
924
+ return u;
925
+ }
926
+ function se(s, o) {
927
+ if (s === o)
928
+ return !0;
929
+ if (s === null || o === null || typeof s != "object" || typeof o != "object" || Array.isArray(s) !== Array.isArray(o))
930
+ return !1;
931
+ if (Array.isArray(s))
932
+ return s.length !== o.length ? !1 : s.every((a, g) => se(a, o[g]));
933
+ const u = Object.keys(s), i = Object.keys(o);
934
+ return u.length !== i.length ? !1 : u.every((a) => i.includes(a) && se(s[a], o[a]));
935
+ }
936
+ class Rr {
937
+ /**
938
+ * Merge multiple remote patches into a local patch with deep (nested) conflict detection.
939
+ *
940
+ * **Conflict Rules:**
941
+ * - Conflicts occur ONLY when the exact same path is modified by both local and remote patches
942
+ * - Different paths merge automatically, even if they share a parent object
943
+ * - Example: local changes `user.name`, remote changes `user.address.city` → No conflict (different paths)
944
+ * - Example: local changes `user.name`, remote changes `user.name` → Conflict (same path)
945
+ *
946
+ * **Path Format:**
947
+ * - Uses dot notation: "user.name", "pages.0.container.text.fontSize"
948
+ * - Arrays are treated as single values (conflicts if entire array differs)
949
+ * - Flat objects work perfectly fine (treated as depth-1 nested objects)
950
+ *
951
+ * **Note:** Later remote patches can overwrite earlier remote patches without conflict.
952
+ * Conflicts only occur between the local patch and remote patches.
953
+ *
954
+ * @param localPatch - The base patch with potential nested structure
955
+ * @param remotePatches - Array of remote patches to merge
956
+ * @returns MergeResult with either merged patch or conflicts requiring resolution
957
+ */
958
+ mergePatches(o, u) {
959
+ const i = [], a = B(o), g = JSON.parse(JSON.stringify(o)), v = new Set(a);
960
+ for (let y = 0; y < u.length; y++) {
961
+ const d = u[y], C = B(d);
962
+ for (const l of C) {
963
+ if (v.has(l)) {
964
+ const j = U(o, l), P = U(d, l);
965
+ se(j, P) || i.find((D) => D.path === l) || i.push({
966
+ path: l,
967
+ localValue: j,
968
+ remoteValue: P,
969
+ remotePatchIndex: y
970
+ });
971
+ }
972
+ const p = U(d, l);
973
+ oe(g, l, p);
974
+ }
975
+ const m = this.getHigherVersion(g.version, d.version);
976
+ m !== void 0 && (g.version = m);
977
+ }
978
+ return i.length === 0 ? {
979
+ success: !0,
980
+ merged: g
981
+ } : {
982
+ success: !1,
983
+ conflicts: i,
984
+ basePatch: o
985
+ };
986
+ }
987
+ /**
988
+ * Apply conflict resolutions to produce the final merged patch.
989
+ *
990
+ * @param localPatch - The base patch with potential nested structure
991
+ * @param remotePatches - Array of remote patches
992
+ * @param resolutions - Array of conflict resolutions
993
+ * @returns Final resolved patch with deep merging
994
+ */
995
+ applyResolutions(o, u, i) {
996
+ const a = JSON.parse(JSON.stringify(o)), g = /* @__PURE__ */ new Map();
997
+ i.forEach((l) => {
998
+ g.set(l.conflictIndex, l);
999
+ });
1000
+ const v = [], y = B(o), d = new Set(y);
1001
+ for (let l = 0; l < u.length; l++) {
1002
+ const p = u[l], j = B(p);
1003
+ for (const P of j)
1004
+ if (d.has(P)) {
1005
+ const I = U(o, P), D = U(p, P);
1006
+ se(I, D) || v.push({
1007
+ path: P,
1008
+ localValue: I,
1009
+ remoteValue: D,
1010
+ remotePatchIndex: l
1011
+ });
1012
+ }
1013
+ }
1014
+ const C = /* @__PURE__ */ new Set();
1015
+ v.forEach((l, p) => {
1016
+ C.add(l.path);
1017
+ const j = g.get(p);
1018
+ j && (j.strategy === "use-local" ? oe(a, l.path, l.localValue) : oe(a, l.path, l.remoteValue));
1019
+ }), u.forEach((l) => {
1020
+ B(l).forEach((j) => {
1021
+ if (!C.has(j)) {
1022
+ const P = U(l, j);
1023
+ oe(a, j, P);
1024
+ }
1025
+ });
1026
+ });
1027
+ const m = [o.version, ...u.map((l) => l.version)].filter((l) => l !== void 0);
1028
+ return m.length > 0 && (a.version = Math.max(...m)), {
1029
+ resolutions: i,
1030
+ resolved: a
1031
+ };
1032
+ }
1033
+ /**
1034
+ * Get the higher version number from two optional versions
1035
+ */
1036
+ getHigherVersion(o, u) {
1037
+ if (!(o === void 0 && u === void 0))
1038
+ return o === void 0 ? u : u === void 0 ? o : Math.max(o, u);
1039
+ }
1040
+ }
1041
+ function jr(s) {
1042
+ const [o, u] = $(null), [i, a] = $(!1), [g, v] = $(null), [y, d] = $([]), C = new Rr(), m = ge(
1043
+ (j, P) => {
1044
+ var I, D;
1045
+ a(!0), v(j), d(P);
1046
+ try {
1047
+ const T = C.mergePatches(j, P);
1048
+ return u(T), T.success && T.merged ? (I = s == null ? void 0 : s.onMergeSuccess) == null || I.call(s, T.merged) : (D = s == null ? void 0 : s.onConflict) == null || D.call(s, T), T;
1049
+ } finally {
1050
+ a(!1);
1051
+ }
1052
+ },
1053
+ [s]
1054
+ ), l = ge(
1055
+ (j) => {
1056
+ if (!g || y.length === 0)
1057
+ return null;
1058
+ const P = C.applyResolutions(g, y, j);
1059
+ return u(null), v(null), d([]), P.resolved;
1060
+ },
1061
+ [g, y]
1062
+ ), p = ge(() => {
1063
+ u(null), v(null), d([]);
1064
+ }, []);
1065
+ return {
1066
+ merging: i,
1067
+ mergeResult: o,
1068
+ hasConflict: o && !o.success,
1069
+ mergePatches: m,
1070
+ applyResolutions: l,
1071
+ clearConflict: p
1072
+ };
1073
+ }
1074
+ const Pr = ({ onMergeComplete: s }) => {
1075
+ var A, M;
1076
+ const [o, u] = $(
1077
+ JSON.stringify({
1078
+ version: 15,
1079
+ message: "Hello from desktop",
1080
+ x: 100,
1081
+ y: 50,
1082
+ user: {
1083
+ name: "Alice",
1084
+ location: {
1085
+ city: "Boston",
1086
+ state: "MA",
1087
+ zip: "02101"
1088
+ }
1089
+ }
1090
+ }, null, 2)
1091
+ ), [i, a] = $([
1092
+ {
1093
+ version: 16,
1094
+ message: "Hello from mobile",
1095
+ x: 110,
1096
+ y: 60,
1097
+ user: {
1098
+ name: "Alice",
1099
+ location: {
1100
+ city: "New York",
1101
+ state: "NY",
1102
+ zip: "10001"
1103
+ }
1104
+ }
1105
+ },
1106
+ { version: 17, z: 300 }
1107
+ ]), [g, v] = $([
1108
+ JSON.stringify({
1109
+ version: 16,
1110
+ message: "Hello from mobile",
1111
+ x: 110,
1112
+ y: 60,
1113
+ user: {
1114
+ name: "Alice",
1115
+ location: {
1116
+ city: "New York",
1117
+ state: "NY",
1118
+ zip: "10001"
1119
+ }
1120
+ }
1121
+ }, null, 2),
1122
+ JSON.stringify({ version: 17, z: 300 }, null, 2)
1123
+ ]), [y, d] = $(null), [C, m] = $(!1), { mergePatches: l, applyResolutions: p } = jr({
1124
+ onMergeSuccess: (f) => {
1125
+ d({ success: !0, merged: f }), s == null || s(f);
1126
+ },
1127
+ onConflict: (f) => {
1128
+ d(f), m(!0);
1129
+ }
1130
+ }), j = () => {
1131
+ d(null);
1132
+ try {
1133
+ const f = JSON.parse(o), E = g.map((S) => JSON.parse(S));
1134
+ l(f, E);
1135
+ } catch (f) {
1136
+ d({
1137
+ success: !1,
1138
+ conflicts: [{
1139
+ path: "JSON Parse Error",
1140
+ localValue: "Invalid JSON",
1141
+ remoteValue: String(f)
1142
+ }]
1143
+ });
1144
+ }
1145
+ }, P = (f) => {
1146
+ const E = p(f);
1147
+ E && (d({ success: !0, merged: E }), m(!1), s == null || s(E));
1148
+ }, I = (f) => {
1149
+ u(f);
1150
+ }, D = (f, E) => {
1151
+ const S = [...g];
1152
+ S[f] = E, v(S);
1153
+ }, T = () => {
1154
+ const E = { version: Math.max(...i.map((S) => S.version || 0)) + 1 };
1155
+ a([...i, E]), v([...g, JSON.stringify(E, null, 2)]);
1156
+ }, k = (f) => {
1157
+ a(i.filter((E, S) => S !== f)), v(g.filter((E, S) => S !== f));
1158
+ }, W = (f, E) => {
1159
+ const { isSelected: S } = E;
1160
+ if (typeof f == "string")
1161
+ return /* @__PURE__ */ n.jsx(
1162
+ "div",
1163
+ {
1164
+ style: {
1165
+ backgroundColor: S ? "#e8f5e9" : "#f5f5f5",
1166
+ padding: "20px",
1167
+ borderRadius: "4px",
1168
+ display: "flex",
1169
+ alignItems: "center",
1170
+ justifyContent: "center",
1171
+ minHeight: "80px"
1172
+ },
1173
+ children: /* @__PURE__ */ n.jsx(
1174
+ "div",
1175
+ {
1176
+ style: {
1177
+ fontSize: "18px",
1178
+ fontWeight: "bold",
1179
+ color: S ? "#2e7d32" : "#1976d2"
1180
+ },
1181
+ children: f
1182
+ }
1183
+ )
1184
+ }
1185
+ );
1186
+ const Z = f && typeof f == "object" && "message" in f, ae = f && typeof f == "object" && ("x" in f || "y" in f);
1187
+ if (Z || ae) {
1188
+ const ie = f.message || "Preview", H = f.x || 0, N = f.y || 0;
1189
+ return /* @__PURE__ */ n.jsxs(
1190
+ "div",
1191
+ {
1192
+ style: {
1193
+ backgroundColor: S ? "#e8f5e9" : "#f5f5f5",
1194
+ padding: "20px",
1195
+ borderRadius: "4px",
1196
+ minHeight: "150px",
1197
+ position: "relative"
1198
+ },
1199
+ children: [
1200
+ /* @__PURE__ */ n.jsxs(
1201
+ "div",
1202
+ {
1203
+ style: {
1204
+ fontSize: "12px",
1205
+ color: "#666",
1206
+ marginBottom: "10px",
1207
+ fontFamily: "monospace"
1208
+ },
1209
+ children: [
1210
+ "Position: x=",
1211
+ H,
1212
+ ", y=",
1213
+ N
1214
+ ]
1215
+ }
1216
+ ),
1217
+ /* @__PURE__ */ n.jsx(
1218
+ "div",
1219
+ {
1220
+ style: {
1221
+ position: "absolute",
1222
+ left: `${20 + H}px`,
1223
+ top: `${40 + N / 10}px`,
1224
+ // Scale y for better visual
1225
+ padding: "8px 12px",
1226
+ backgroundColor: S ? "#4CAF50" : "#2196F3",
1227
+ color: "white",
1228
+ borderRadius: "4px",
1229
+ fontSize: "14px",
1230
+ boxShadow: "0 2px 4px rgba(0,0,0,0.2)",
1231
+ maxWidth: "200px",
1232
+ wordWrap: "break-word"
1233
+ },
1234
+ children: ie
1235
+ }
1236
+ ),
1237
+ /* @__PURE__ */ n.jsx(
1238
+ "pre",
1239
+ {
1240
+ style: {
1241
+ marginTop: "80px",
1242
+ fontSize: "11px",
1243
+ color: "#666",
1244
+ backgroundColor: "rgba(255,255,255,0.5)",
1245
+ padding: "8px",
1246
+ borderRadius: "4px",
1247
+ overflow: "auto"
1248
+ },
1249
+ children: JSON.stringify(f, null, 2)
1250
+ }
1251
+ )
1252
+ ]
1253
+ }
1254
+ );
1255
+ }
1256
+ return /* @__PURE__ */ n.jsx(
1257
+ "pre",
1258
+ {
1259
+ style: {
1260
+ backgroundColor: S ? "#e8f5e9" : "#f5f5f5",
1261
+ padding: "15px",
1262
+ borderRadius: "4px",
1263
+ overflow: "auto",
1264
+ maxHeight: "300px",
1265
+ fontSize: "13px",
1266
+ margin: 0
1267
+ },
1268
+ children: JSON.stringify(f, null, 2)
1269
+ }
1270
+ );
1271
+ };
1272
+ return /* @__PURE__ */ n.jsxs("div", { style: { padding: "20px", fontFamily: "system-ui, sans-serif" }, children: [
1273
+ /* @__PURE__ */ n.jsx("h1", { children: "Patch Merge Demo" }),
1274
+ /* @__PURE__ */ n.jsx("p", { children: "Merge multiple remote patches into a local patch. Example: Desktop has version 15, server has versions 16-20. Patches are merged sequentially. If any conflicts occur, step through them one at a time." }),
1275
+ /* @__PURE__ */ n.jsxs("div", { style: { display: "flex", gap: "20px", marginBottom: "20px" }, children: [
1276
+ /* @__PURE__ */ n.jsxs("div", { style: { flex: 1 }, children: [
1277
+ /* @__PURE__ */ n.jsx("h2", { children: "Local Patch (Your Changes)" }),
1278
+ /* @__PURE__ */ n.jsx(
1279
+ "textarea",
1280
+ {
1281
+ value: o,
1282
+ onChange: (f) => I(f.target.value),
1283
+ rows: 10,
1284
+ style: {
1285
+ width: "100%",
1286
+ fontFamily: "monospace",
1287
+ padding: "10px"
1288
+ }
1289
+ }
1290
+ )
1291
+ ] }),
1292
+ /* @__PURE__ */ n.jsxs("div", { style: { flex: 1 }, children: [
1293
+ /* @__PURE__ */ n.jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
1294
+ /* @__PURE__ */ n.jsx("h2", { children: "Remote Patches (From Server)" }),
1295
+ /* @__PURE__ */ n.jsx(
1296
+ "button",
1297
+ {
1298
+ onClick: T,
1299
+ style: {
1300
+ padding: "5px 10px",
1301
+ fontSize: "14px",
1302
+ cursor: "pointer",
1303
+ backgroundColor: "#2196F3",
1304
+ color: "white",
1305
+ border: "none",
1306
+ borderRadius: "4px"
1307
+ },
1308
+ children: "+ Add Patch"
1309
+ }
1310
+ )
1311
+ ] }),
1312
+ i.map((f, E) => /* @__PURE__ */ n.jsxs("div", { style: { marginBottom: "10px", position: "relative" }, children: [
1313
+ /* @__PURE__ */ n.jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: "5px" }, children: [
1314
+ /* @__PURE__ */ n.jsxs("small", { style: { color: "#666" }, children: [
1315
+ "Remote Patch #",
1316
+ E + 1,
1317
+ " ",
1318
+ f.version ? `(v${f.version})` : ""
1319
+ ] }),
1320
+ /* @__PURE__ */ n.jsx(
1321
+ "button",
1322
+ {
1323
+ onClick: () => k(E),
1324
+ style: {
1325
+ padding: "2px 6px",
1326
+ fontSize: "12px",
1327
+ cursor: "pointer",
1328
+ backgroundColor: "#f44336",
1329
+ color: "white",
1330
+ border: "none",
1331
+ borderRadius: "4px"
1332
+ },
1333
+ children: "× Remove"
1334
+ }
1335
+ )
1336
+ ] }),
1337
+ /* @__PURE__ */ n.jsx(
1338
+ "textarea",
1339
+ {
1340
+ value: g[E],
1341
+ onChange: (S) => D(E, S.target.value),
1342
+ rows: 4,
1343
+ style: {
1344
+ width: "100%",
1345
+ fontFamily: "monospace",
1346
+ padding: "10px",
1347
+ fontSize: "12px"
1348
+ }
1349
+ }
1350
+ )
1351
+ ] }, E))
1352
+ ] })
1353
+ ] }),
1354
+ /* @__PURE__ */ n.jsx(
1355
+ "button",
1356
+ {
1357
+ onClick: j,
1358
+ style: {
1359
+ padding: "10px 20px",
1360
+ fontSize: "16px",
1361
+ cursor: "pointer",
1362
+ backgroundColor: "#4CAF50",
1363
+ color: "white",
1364
+ border: "none",
1365
+ borderRadius: "4px"
1366
+ },
1367
+ children: "Merge Patches"
1368
+ }
1369
+ ),
1370
+ y && /* @__PURE__ */ n.jsx("div", { style: { marginTop: "20px" }, children: y.success ? /* @__PURE__ */ n.jsxs(
1371
+ "div",
1372
+ {
1373
+ style: {
1374
+ backgroundColor: "#d4edda",
1375
+ border: "1px solid #c3e6cb",
1376
+ padding: "15px",
1377
+ borderRadius: "4px"
1378
+ },
1379
+ children: [
1380
+ /* @__PURE__ */ n.jsx("h3", { style: { marginTop: 0, color: "#155724" }, children: "✓ Merged Successfully!" }),
1381
+ /* @__PURE__ */ n.jsx("pre", { style: { backgroundColor: "#fff", padding: "10px", borderRadius: "4px" }, children: JSON.stringify(y.merged, null, 2) })
1382
+ ]
1383
+ }
1384
+ ) : /* @__PURE__ */ n.jsxs(
1385
+ "div",
1386
+ {
1387
+ style: {
1388
+ backgroundColor: "#fff3cd",
1389
+ border: "1px solid #ffc107",
1390
+ padding: "15px",
1391
+ borderRadius: "4px"
1392
+ },
1393
+ children: [
1394
+ /* @__PURE__ */ n.jsxs("h3", { style: { marginTop: 0, color: "#856404" }, children: [
1395
+ "⚠ ",
1396
+ (A = y.conflicts) == null ? void 0 : A.length,
1397
+ " Conflict",
1398
+ ((M = y.conflicts) == null ? void 0 : M.length) !== 1 ? "s" : "",
1399
+ " Detected"
1400
+ ] }),
1401
+ /* @__PURE__ */ n.jsx("p", { children: "The patches modify the same fields. A modal will help you resolve them one at a time." })
1402
+ ]
1403
+ }
1404
+ ) }),
1405
+ C && y && !y.success && y.conflicts && /* @__PURE__ */ n.jsx(
1406
+ br,
1407
+ {
1408
+ conflicts: y.conflicts,
1409
+ onResolveAll: P,
1410
+ onClose: () => m(!1),
1411
+ renderConflictValue: W
1412
+ }
1413
+ )
1414
+ ] });
1415
+ };
1416
+ function wr(s) {
1417
+ const o = {};
1418
+ for (const u of s) {
1419
+ if (u.op !== "add" && u.op !== "replace")
1420
+ continue;
1421
+ const i = u.path.match(/^\/([^/]+)$/);
1422
+ if (!i) {
1423
+ console.warn(`jsonPatchToDiff: Ignoring nested or invalid path: ${u.path}`);
1424
+ continue;
1425
+ }
1426
+ const a = i[1];
1427
+ o[a] = u.value;
1428
+ }
1429
+ return o;
1430
+ }
1431
+ function Sr(s) {
1432
+ return Object.entries(s).filter(([o]) => o !== "version").map(([o, u]) => ({
1433
+ op: "replace",
1434
+ path: `/${o}`,
1435
+ value: u
1436
+ }));
1437
+ }
1438
+ export {
1439
+ br as ConflictModal,
1440
+ Rr as ConflictResolver,
1441
+ Pr as PatchManager,
1442
+ se as deepEqual,
1443
+ Sr as diffToJsonPatch,
1444
+ B as getAllPaths,
1445
+ U as getNestedValue,
1446
+ Er as hasNestedPath,
1447
+ wr as jsonPatchToDiff,
1448
+ oe as setNestedValue,
1449
+ jr as usePatchMerger
1450
+ };