@commercelayer/app-elements 2.12.1 → 3.0.1

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.
@@ -1,7 +1,7 @@
1
1
  "use client";
2
- import { j as se, I as Ee } from "./main-s5Y-GzBf.js";
3
- import q, { memo as ce, useState as V, useRef as w, useCallback as ue, useEffect as $, forwardRef as Ie } from "react";
4
- function Ce(e, t, r) {
2
+ import { j as se, I as Ee } from "./main-r1-D6uI_.js";
3
+ import z, { memo as ce, useState as U, useRef as w, useCallback as ue, useEffect as $, forwardRef as Ce } from "react";
4
+ function Ie(e, t, r) {
5
5
  return t in e ? Object.defineProperty(e, t, {
6
6
  value: r,
7
7
  enumerable: !0,
@@ -23,7 +23,7 @@ function de(e) {
23
23
  for (var t = 1; t < arguments.length; t++) {
24
24
  var r = arguments[t] != null ? arguments[t] : {};
25
25
  t % 2 ? fe(Object(r), !0).forEach(function(n) {
26
- Ce(e, n, r[n]);
26
+ Ie(e, n, r[n]);
27
27
  }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : fe(Object(r)).forEach(function(n) {
28
28
  Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
29
29
  });
@@ -48,19 +48,19 @@ function Le(e, t) {
48
48
  return r;
49
49
  }
50
50
  function Ae(e, t) {
51
- return De(e) || xe(e, t) || Te(e, t) || Re();
51
+ return xe(e) || De(e, t) || Te(e, t) || Re();
52
52
  }
53
- function De(e) {
53
+ function xe(e) {
54
54
  if (Array.isArray(e)) return e;
55
55
  }
56
- function xe(e, t) {
56
+ function De(e, t) {
57
57
  if (!(typeof Symbol > "u" || !(Symbol.iterator in Object(e)))) {
58
58
  var r = [], n = !0, i = !1, o = void 0;
59
59
  try {
60
- for (var a = e[Symbol.iterator](), f; !(n = (f = a.next()).done) && (r.push(f.value), !(t && r.length === t)); n = !0)
60
+ for (var a = e[Symbol.iterator](), l; !(n = (l = a.next()).done) && (r.push(l.value), !(t && r.length === t)); n = !0)
61
61
  ;
62
- } catch (s) {
63
- i = !0, o = s;
62
+ } catch (p) {
63
+ i = !0, o = p;
64
64
  } finally {
65
65
  try {
66
66
  !n && a.return != null && a.return();
@@ -131,9 +131,9 @@ function H(e) {
131
131
  for (var r = this, n = arguments.length, i = new Array(n), o = 0; o < n; o++)
132
132
  i[o] = arguments[o];
133
133
  return i.length >= e.length ? e.apply(this, i) : function() {
134
- for (var a = arguments.length, f = new Array(a), s = 0; s < a; s++)
135
- f[s] = arguments[s];
136
- return t.apply(r, [].concat(i, f));
134
+ for (var a = arguments.length, l = new Array(a), p = 0; p < a; p++)
135
+ l[p] = arguments[p];
136
+ return t.apply(r, [].concat(i, l));
137
137
  };
138
138
  };
139
139
  }
@@ -150,20 +150,20 @@ function Ve(e, t) {
150
150
  return Object.prototype.hasOwnProperty.call(e, t);
151
151
  }
152
152
  function ze(e, t) {
153
- return ee(t) || x("changeType"), Object.keys(t).some(function(r) {
153
+ return ee(t) || D("changeType"), Object.keys(t).some(function(r) {
154
154
  return !Ve(e, r);
155
- }) && x("changeField"), t;
155
+ }) && D("changeField"), t;
156
156
  }
157
157
  function Ue(e) {
158
- K(e) || x("selectorType");
158
+ K(e) || D("selectorType");
159
159
  }
160
160
  function We(e) {
161
- K(e) || ee(e) || x("handlerType"), ee(e) && Object.values(e).some(function(t) {
161
+ K(e) || ee(e) || D("handlerType"), ee(e) && Object.values(e).some(function(t) {
162
162
  return !K(t);
163
- }) && x("handlersType");
163
+ }) && D("handlersType");
164
164
  }
165
165
  function Fe(e) {
166
- e || x("initialIsRequired"), ee(e) || x("initialType"), qe(e) && x("initialContent");
166
+ e || D("initialIsRequired"), ee(e) || D("initialType"), qe(e) && D("initialContent");
167
167
  }
168
168
  function ke(e, t) {
169
169
  throw new Error(e[t] || e.default);
@@ -178,7 +178,7 @@ var He = {
178
178
  changeType: "provided value of changes should be an object",
179
179
  changeField: 'it seams you want to change a field in the state which is not specified in the "initial" state',
180
180
  default: "an unknown error accured in `state-local` package"
181
- }, x = H(ke)(He), Q = {
181
+ }, D = H(ke)(He), Q = {
182
182
  changes: ze,
183
183
  selector: Ue,
184
184
  handler: We,
@@ -190,16 +190,16 @@ function Be(e) {
190
190
  var r = {
191
191
  current: e
192
192
  }, n = H(Je)(r, t), i = H(Ge)(r), o = H(Q.changes)(e), a = H(Ke)(r);
193
- function f() {
194
- var v = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : function(y) {
193
+ function l() {
194
+ var g = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : function(y) {
195
195
  return y;
196
196
  };
197
- return Q.selector(v), v(r.current);
197
+ return Q.selector(g), g(r.current);
198
198
  }
199
- function s(v) {
200
- _e(n, i, o, a)(v);
199
+ function p(g) {
200
+ _e(n, i, o, a)(g);
201
201
  }
202
- return [f, s];
202
+ return [l, p];
203
203
  }
204
204
  function Ke(e, t) {
205
205
  return K(t) ? t(e.current) : t;
@@ -225,9 +225,9 @@ function Qe(e) {
225
225
  for (var r = this, n = arguments.length, i = new Array(n), o = 0; o < n; o++)
226
226
  i[o] = arguments[o];
227
227
  return i.length >= e.length ? e.apply(this, i) : function() {
228
- for (var a = arguments.length, f = new Array(a), s = 0; s < a; s++)
229
- f[s] = arguments[s];
230
- return t.apply(r, [].concat(i, f));
228
+ for (var a = arguments.length, l = new Array(a), p = 0; p < a; p++)
229
+ l[p] = arguments[p];
230
+ return t.apply(r, [].concat(i, l));
231
231
  };
232
232
  };
233
233
  }
@@ -383,11 +383,11 @@ var oe = new Promise(function(e, t) {
383
383
  __getMonacoInstance: pt
384
384
  }, gt = { wrapper: { display: "flex", position: "relative", textAlign: "initial" }, fullWidth: { width: "100%" }, hide: { display: "none" } }, ae = gt, ht = { container: { display: "flex", height: "100%", width: "100%", justifyContent: "center", alignItems: "center" } }, mt = ht;
385
385
  function vt({ children: e }) {
386
- return q.createElement("div", { style: mt.container }, e);
386
+ return z.createElement("div", { style: mt.container }, e);
387
387
  }
388
388
  var bt = vt, wt = bt;
389
389
  function yt({ width: e, height: t, isEditorReady: r, loading: n, _ref: i, className: o, wrapperProps: a }) {
390
- return q.createElement("section", { style: { ...ae.wrapper, width: e, height: t }, ...a }, !r && q.createElement(wt, null, n), q.createElement("div", { ref: i, style: { ...ae.fullWidth, ...!r && ae.hide }, className: o }));
390
+ return z.createElement("section", { style: { ...ae.wrapper, width: e, height: t }, ...a }, !r && z.createElement(wt, null, n), z.createElement("div", { ref: i, style: { ...ae.fullWidth, ...!r && ae.hide }, className: o }));
391
391
  }
392
392
  var Ot = yt, je = ce(Ot);
393
393
  function jt(e) {
@@ -400,10 +400,10 @@ function Mt(e, t, r = !0) {
400
400
  n.current = !1;
401
401
  } : e, t);
402
402
  }
403
- var P = Mt;
403
+ var E = Mt;
404
404
  function B() {
405
405
  }
406
- function _(e, t, r, n) {
406
+ function V(e, t, r, n) {
407
407
  return St(e, n) || Pt(e, t, r, n);
408
408
  }
409
409
  function St(e, t) {
@@ -415,63 +415,63 @@ function Pt(e, t, r, n) {
415
415
  function Me(e, t) {
416
416
  return e.Uri.parse(t);
417
417
  }
418
- function Et({ original: e, modified: t, language: r, originalLanguage: n, modifiedLanguage: i, originalModelPath: o, modifiedModelPath: a, keepCurrentOriginalModel: f = !1, keepCurrentModifiedModel: s = !1, theme: v = "light", loading: y = "Loading...", options: O = {}, height: L = "100%", width: J = "100%", className: C, wrapperProps: E = {}, beforeMount: A = B, onMount: z = B }) {
419
- let [j, b] = V(!1), [I, d] = V(!0), g = w(null), c = w(null), U = w(null), M = w(z), p = w(A), T = w(!1);
418
+ function Et({ original: e, modified: t, language: r, originalLanguage: n, modifiedLanguage: i, originalModelPath: o, modifiedModelPath: a, keepCurrentOriginalModel: l = !1, keepCurrentModifiedModel: p = !1, theme: g = "light", loading: y = "Loading...", options: O = {}, height: T = "100%", width: L = "100%", className: J, wrapperProps: I = {}, beforeMount: C = B, onMount: A = B }) {
419
+ let [j, R] = U(!1), [m, b] = U(!0), d = w(null), s = w(null), M = w(null), S = w(A), f = w(C), N = w(!1);
420
420
  le(() => {
421
421
  let u = te.init();
422
- return u.then((h) => (c.current = h) && d(!1)).catch((h) => (h == null ? void 0 : h.type) !== "cancelation" && console.error("Monaco initialization: error:", h)), () => g.current ? W() : u.cancel();
423
- }), P(() => {
424
- if (g.current && c.current) {
425
- let u = g.current.getOriginalEditor(), h = _(c.current, e || "", n || r || "text", o || "");
422
+ return u.then((h) => (s.current = h) && b(!1)).catch((h) => (h == null ? void 0 : h.type) !== "cancelation" && console.error("Monaco initialization: error:", h)), () => d.current ? W() : u.cancel();
423
+ }), E(() => {
424
+ if (d.current && s.current) {
425
+ let u = d.current.getOriginalEditor(), h = V(s.current, e || "", n || r || "text", o || "");
426
426
  h !== u.getModel() && u.setModel(h);
427
427
  }
428
- }, [o], j), P(() => {
429
- if (g.current && c.current) {
430
- let u = g.current.getModifiedEditor(), h = _(c.current, t || "", i || r || "text", a || "");
428
+ }, [o], j), E(() => {
429
+ if (d.current && s.current) {
430
+ let u = d.current.getModifiedEditor(), h = V(s.current, t || "", i || r || "text", a || "");
431
431
  h !== u.getModel() && u.setModel(h);
432
432
  }
433
- }, [a], j), P(() => {
434
- let u = g.current.getModifiedEditor();
435
- u.getOption(c.current.editor.EditorOption.readOnly) ? u.setValue(t || "") : t !== u.getValue() && (u.executeEdits("", [{ range: u.getModel().getFullModelRange(), text: t || "", forceMoveMarkers: !0 }]), u.pushUndoStop());
436
- }, [t], j), P(() => {
433
+ }, [a], j), E(() => {
434
+ let u = d.current.getModifiedEditor();
435
+ u.getOption(s.current.editor.EditorOption.readOnly) ? u.setValue(t || "") : t !== u.getValue() && (u.executeEdits("", [{ range: u.getModel().getFullModelRange(), text: t || "", forceMoveMarkers: !0 }]), u.pushUndoStop());
436
+ }, [t], j), E(() => {
437
437
  var u, h;
438
- (h = (u = g.current) == null ? void 0 : u.getModel()) == null || h.original.setValue(e || "");
439
- }, [e], j), P(() => {
440
- let { original: u, modified: h } = g.current.getModel();
441
- c.current.editor.setModelLanguage(u, n || r || "text"), c.current.editor.setModelLanguage(h, i || r || "text");
442
- }, [r, n, i], j), P(() => {
438
+ (h = (u = d.current) == null ? void 0 : u.getModel()) == null || h.original.setValue(e || "");
439
+ }, [e], j), E(() => {
440
+ let { original: u, modified: h } = d.current.getModel();
441
+ s.current.editor.setModelLanguage(u, n || r || "text"), s.current.editor.setModelLanguage(h, i || r || "text");
442
+ }, [r, n, i], j), E(() => {
443
443
  var u;
444
- (u = c.current) == null || u.editor.setTheme(v);
445
- }, [v], j), P(() => {
444
+ (u = s.current) == null || u.editor.setTheme(g);
445
+ }, [g], j), E(() => {
446
446
  var u;
447
- (u = g.current) == null || u.updateOptions(O);
447
+ (u = d.current) == null || u.updateOptions(O);
448
448
  }, [O], j);
449
449
  let Y = ue(() => {
450
- var D;
451
- if (!c.current) return;
452
- p.current(c.current);
453
- let u = _(c.current, e || "", n || r || "text", o || ""), h = _(c.current, t || "", i || r || "text", a || "");
454
- (D = g.current) == null || D.setModel({ original: u, modified: h });
450
+ var x;
451
+ if (!s.current) return;
452
+ f.current(s.current);
453
+ let u = V(s.current, e || "", n || r || "text", o || ""), h = V(s.current, t || "", i || r || "text", a || "");
454
+ (x = d.current) == null || x.setModel({ original: u, modified: h });
455
455
  }, [r, t, i, e, n, o, a]), Z = ue(() => {
456
456
  var u;
457
- !T.current && U.current && (g.current = c.current.editor.createDiffEditor(U.current, { automaticLayout: !0, ...O }), Y(), (u = c.current) == null || u.editor.setTheme(v), b(!0), T.current = !0);
458
- }, [O, v, Y]);
457
+ !N.current && M.current && (d.current = s.current.editor.createDiffEditor(M.current, { automaticLayout: !0, ...O }), Y(), (u = s.current) == null || u.editor.setTheme(g), R(!0), N.current = !0);
458
+ }, [O, g, Y]);
459
459
  $(() => {
460
- j && M.current(g.current, c.current);
460
+ j && S.current(d.current, s.current);
461
461
  }, [j]), $(() => {
462
- !I && !j && Z();
463
- }, [I, j, Z]);
462
+ !m && !j && Z();
463
+ }, [m, j, Z]);
464
464
  function W() {
465
- var h, D, R, F;
466
- let u = (h = g.current) == null ? void 0 : h.getModel();
467
- f || ((D = u == null ? void 0 : u.original) == null || D.dispose()), s || ((R = u == null ? void 0 : u.modified) == null || R.dispose()), (F = g.current) == null || F.dispose();
465
+ var h, x, _, F;
466
+ let u = (h = d.current) == null ? void 0 : h.getModel();
467
+ l || ((x = u == null ? void 0 : u.original) == null || x.dispose()), p || ((_ = u == null ? void 0 : u.modified) == null || _.dispose()), (F = d.current) == null || F.dispose();
468
468
  }
469
- return q.createElement(je, { width: J, height: L, isEditorReady: j, loading: y, _ref: U, className: C, wrapperProps: E });
469
+ return z.createElement(je, { width: L, height: T, isEditorReady: j, loading: y, _ref: M, className: J, wrapperProps: I });
470
470
  }
471
- var It = Et;
472
- ce(It);
473
- function Ct() {
474
- let [e, t] = V(te.__getMonacoInstance());
471
+ var Ct = Et;
472
+ ce(Ct);
473
+ function It() {
474
+ let [e, t] = U(te.__getMonacoInstance());
475
475
  return le(() => {
476
476
  let r;
477
477
  return e || (r = te.init(), r.then((n) => {
@@ -479,7 +479,7 @@ function Ct() {
479
479
  })), () => r == null ? void 0 : r.cancel();
480
480
  }), e;
481
481
  }
482
- var $t = Ct;
482
+ var $t = It;
483
483
  function Lt(e) {
484
484
  let t = w();
485
485
  return $(() => {
@@ -487,72 +487,72 @@ function Lt(e) {
487
487
  }, [e]), t.current;
488
488
  }
489
489
  var At = Lt, X = /* @__PURE__ */ new Map();
490
- function Dt({ defaultValue: e, defaultLanguage: t, defaultPath: r, value: n, language: i, path: o, theme: a = "light", line: f, loading: s = "Loading...", options: v = {}, overrideServices: y = {}, saveViewState: O = !0, keepCurrentModel: L = !1, width: J = "100%", height: C = "100%", className: E, wrapperProps: A = {}, beforeMount: z = B, onMount: j = B, onChange: b, onValidate: I = B }) {
491
- let [d, g] = V(!1), [c, U] = V(!0), M = w(null), p = w(null), T = w(null), Y = w(j), Z = w(z), W = w(), u = w(n), h = At(o), D = w(!1), R = w(!1);
490
+ function xt({ defaultValue: e, defaultLanguage: t, defaultPath: r, value: n, language: i, path: o, theme: a = "light", line: l, loading: p = "Loading...", options: g = {}, overrideServices: y = {}, saveViewState: O = !0, keepCurrentModel: T = !1, width: L = "100%", height: J = "100%", className: I, wrapperProps: C = {}, beforeMount: A = B, onMount: j = B, onChange: R, onValidate: m = B }) {
491
+ let [b, d] = U(!1), [s, M] = U(!0), S = w(null), f = w(null), N = w(null), Y = w(j), Z = w(A), W = w(), u = w(n), h = At(o), x = w(!1), _ = w(!1);
492
492
  le(() => {
493
- let l = te.init();
494
- return l.then((m) => (M.current = m) && U(!1)).catch((m) => (m == null ? void 0 : m.type) !== "cancelation" && console.error("Monaco initialization: error:", m)), () => p.current ? Pe() : l.cancel();
495
- }), P(() => {
496
- var m, S, k, N;
497
- let l = _(M.current, e || n || "", t || i || "", o || r || "");
498
- l !== ((m = p.current) == null ? void 0 : m.getModel()) && (O && X.set(h, (S = p.current) == null ? void 0 : S.saveViewState()), (k = p.current) == null || k.setModel(l), O && ((N = p.current) == null || N.restoreViewState(X.get(o))));
499
- }, [o], d), P(() => {
500
- var l;
501
- (l = p.current) == null || l.updateOptions(v);
502
- }, [v], d), P(() => {
503
- !p.current || n === void 0 || (p.current.getOption(M.current.editor.EditorOption.readOnly) ? p.current.setValue(n) : n !== p.current.getValue() && (R.current = !0, p.current.executeEdits("", [{ range: p.current.getModel().getFullModelRange(), text: n, forceMoveMarkers: !0 }]), p.current.pushUndoStop(), R.current = !1));
504
- }, [n], d), P(() => {
505
- var m, S;
506
- let l = (m = p.current) == null ? void 0 : m.getModel();
507
- l && i && ((S = M.current) == null || S.editor.setModelLanguage(l, i));
508
- }, [i], d), P(() => {
509
- var l;
510
- f !== void 0 && ((l = p.current) == null || l.revealLine(f));
511
- }, [f], d), P(() => {
512
- var l;
513
- (l = M.current) == null || l.editor.setTheme(a);
514
- }, [a], d);
493
+ let c = te.init();
494
+ return c.then((v) => (S.current = v) && M(!1)).catch((v) => (v == null ? void 0 : v.type) !== "cancelation" && console.error("Monaco initialization: error:", v)), () => f.current ? Pe() : c.cancel();
495
+ }), E(() => {
496
+ var v, P, k, q;
497
+ let c = V(S.current, e || n || "", t || i || "", o || r || "");
498
+ c !== ((v = f.current) == null ? void 0 : v.getModel()) && (O && X.set(h, (P = f.current) == null ? void 0 : P.saveViewState()), (k = f.current) == null || k.setModel(c), O && ((q = f.current) == null || q.restoreViewState(X.get(o))));
499
+ }, [o], b), E(() => {
500
+ var c;
501
+ (c = f.current) == null || c.updateOptions(g);
502
+ }, [g], b), E(() => {
503
+ !f.current || n === void 0 || (f.current.getOption(S.current.editor.EditorOption.readOnly) ? f.current.setValue(n) : n !== f.current.getValue() && (_.current = !0, f.current.executeEdits("", [{ range: f.current.getModel().getFullModelRange(), text: n, forceMoveMarkers: !0 }]), f.current.pushUndoStop(), _.current = !1));
504
+ }, [n], b), E(() => {
505
+ var v, P;
506
+ let c = (v = f.current) == null ? void 0 : v.getModel();
507
+ c && i && ((P = S.current) == null || P.editor.setModelLanguage(c, i));
508
+ }, [i], b), E(() => {
509
+ var c;
510
+ l !== void 0 && ((c = f.current) == null || c.revealLine(l));
511
+ }, [l], b), E(() => {
512
+ var c;
513
+ (c = S.current) == null || c.editor.setTheme(a);
514
+ }, [a], b);
515
515
  let F = ue(() => {
516
- var l;
517
- if (!(!T.current || !M.current) && !D.current) {
518
- Z.current(M.current);
519
- let m = o || r, S = _(M.current, n || e || "", t || i || "", m || "");
520
- p.current = (l = M.current) == null ? void 0 : l.editor.create(T.current, { model: S, automaticLayout: !0, ...v }, y), O && p.current.restoreViewState(X.get(m)), M.current.editor.setTheme(a), f !== void 0 && p.current.revealLine(f), g(!0), D.current = !0;
516
+ var c;
517
+ if (!(!N.current || !S.current) && !x.current) {
518
+ Z.current(S.current);
519
+ let v = o || r, P = V(S.current, n || e || "", t || i || "", v || "");
520
+ f.current = (c = S.current) == null ? void 0 : c.editor.create(N.current, { model: P, automaticLayout: !0, ...g }, y), O && f.current.restoreViewState(X.get(v)), S.current.editor.setTheme(a), l !== void 0 && f.current.revealLine(l), d(!0), x.current = !0;
521
521
  }
522
- }, [e, t, r, n, i, o, v, y, O, a, f]);
522
+ }, [e, t, r, n, i, o, g, y, O, a, l]);
523
523
  $(() => {
524
- d && Y.current(p.current, M.current);
525
- }, [d]), $(() => {
526
- !c && !d && F();
527
- }, [c, d, F]), u.current = n, $(() => {
528
- var l, m;
529
- d && b && ((l = W.current) == null || l.dispose(), W.current = (m = p.current) == null ? void 0 : m.onDidChangeModelContent((S) => {
530
- R.current || b(p.current.getValue(), S);
524
+ b && Y.current(f.current, S.current);
525
+ }, [b]), $(() => {
526
+ !s && !b && F();
527
+ }, [s, b, F]), u.current = n, $(() => {
528
+ var c, v;
529
+ b && R && ((c = W.current) == null || c.dispose(), W.current = (v = f.current) == null ? void 0 : v.onDidChangeModelContent((P) => {
530
+ _.current || R(f.current.getValue(), P);
531
531
  }));
532
- }, [d, b]), $(() => {
533
- if (d) {
534
- let l = M.current.editor.onDidChangeMarkers((m) => {
532
+ }, [b, R]), $(() => {
533
+ if (b) {
534
+ let c = S.current.editor.onDidChangeMarkers((v) => {
535
535
  var k;
536
- let S = (k = p.current.getModel()) == null ? void 0 : k.uri;
537
- if (S && m.find((N) => N.path === S.path)) {
538
- let N = M.current.editor.getModelMarkers({ resource: S });
539
- I == null || I(N);
536
+ let P = (k = f.current.getModel()) == null ? void 0 : k.uri;
537
+ if (P && v.find((q) => q.path === P.path)) {
538
+ let q = S.current.editor.getModelMarkers({ resource: P });
539
+ m == null || m(q);
540
540
  }
541
541
  });
542
542
  return () => {
543
- l == null || l.dispose();
543
+ c == null || c.dispose();
544
544
  };
545
545
  }
546
546
  return () => {
547
547
  };
548
- }, [d, I]);
548
+ }, [b, m]);
549
549
  function Pe() {
550
- var l, m;
551
- (l = W.current) == null || l.dispose(), L ? O && X.set(o, p.current.saveViewState()) : (m = p.current.getModel()) == null || m.dispose(), p.current.dispose();
550
+ var c, v;
551
+ (c = W.current) == null || c.dispose(), T ? O && X.set(o, f.current.saveViewState()) : (v = f.current.getModel()) == null || v.dispose(), f.current.dispose();
552
552
  }
553
- return q.createElement(je, { width: J, height: C, isEditorReady: d, loading: s, _ref: T, className: E, wrapperProps: A });
553
+ return z.createElement(je, { width: L, height: J, isEditorReady: b, loading: p, _ref: N, className: I, wrapperProps: C });
554
554
  }
555
- var xt = Dt, Tt = ce(xt), Rt = Tt;
555
+ var Dt = xt, Tt = ce(Dt), Rt = Tt;
556
556
  const Nt = /* @__PURE__ */ (() => {
557
557
  let e;
558
558
  return async () => (e != null || (e = await fetch("https://core.commercelayer.io/api/public/resources").then(async (t) => await t.json()).then(
@@ -562,7 +562,7 @@ const Nt = /* @__PURE__ */ (() => {
562
562
  fields: Object.entries(n.attributes.fields).filter(([a]) => !a.startsWith("_")),
563
563
  relationships: Object.entries(n.attributes.relationships).filter(([a]) => !a.startsWith("_")).filter(
564
564
  ([, a]) => t.find(
565
- (f) => f.id === Se(a.class_name)
565
+ (l) => l.id === Se(a.class_name)
566
566
  ) != null
567
567
  )
568
568
  }
@@ -595,16 +595,16 @@ async function qt(e, t) {
595
595
  const r = await Nt(), n = e.replace(/\.$/, "").split("."), i = n.shift();
596
596
  return t ?? (t = r[i ?? ""]), n.reduce(
597
597
  (o, a) => {
598
- var v, y;
599
- const f = (y = (v = o.obj) == null ? void 0 : v.relationships.find(
598
+ var g, y;
599
+ const l = (y = (g = o.obj) == null ? void 0 : g.relationships.find(
600
600
  ([O]) => O === a
601
601
  )) == null ? void 0 : y[1].class_name;
602
- if (f == null)
602
+ if (l == null)
603
603
  return o;
604
- const s = r[Se(f)];
605
- return s == null ? o : {
604
+ const p = r[Se(l)];
605
+ return p == null ? o : {
606
606
  path: `${o.path == null ? "" : `${o.path}.`}${a}`,
607
- obj: s
607
+ obj: p
608
608
  };
609
609
  },
610
610
  { path: t != null ? i ?? "" : "", obj: t }
@@ -613,77 +613,78 @@ async function qt(e, t) {
613
613
  function Se(e) {
614
614
  return e.replace(/([A-Z])/g, "_$1").replace(/^_/, "").toLowerCase();
615
615
  }
616
- const Vt = Ut(500), zt = Ie(
616
+ const Vt = Ut(500), zt = Ce(
617
617
  ({
618
618
  feedback: e,
619
619
  hint: t,
620
620
  inline: r,
621
621
  label: n,
622
622
  defaultValue: i,
623
- value: o,
624
- language: a = "plaintext",
625
- height: f = "220px",
626
- jsonSchema: s = "none",
627
- onValidate: v,
628
- onValid: y,
629
- onChange: O,
623
+ readOnly: o,
624
+ value: a,
625
+ language: l = "plaintext",
626
+ height: p = "220px",
627
+ jsonSchema: g = "none",
628
+ onValidate: y,
629
+ onValid: O,
630
+ onChange: T,
630
631
  ...L
631
632
  }, J) => {
632
- const C = $t(), E = w(), [A, z] = V(null), j = (b, I) => {
633
- z(b), b.onDidPaste(() => {
633
+ const I = $t(), C = w(), [A, j] = U(null), R = (m, b) => {
634
+ j(m), m.onDidPaste(() => {
634
635
  var d;
635
- (d = b.getAction("editor.action.formatDocument")) == null || d.run();
636
- }), b.onDidChangeModelDecorations(() => {
637
- const d = b.getModel(), g = I.editor.getModelMarkers({
636
+ (d = m.getAction("editor.action.formatDocument")) == null || d.run();
637
+ }), m.onDidChangeModelContent(() => {
638
+ const d = m.getModel(), s = b.editor.getModelMarkers({
638
639
  resource: d == null ? void 0 : d.uri
639
- }), c = b.getValue();
640
+ }), M = m.getValue();
640
641
  Vt(() => {
641
- v == null || v(g.length > 0 ? g : null), O == null || O(c), g.length === 0 && (y == null || y(c));
642
+ y == null || y(s.length > 0 ? s : null), T == null || T(M), s.length === 0 && (O == null || O(M));
642
643
  });
643
644
  });
644
645
  };
645
646
  return $(() => (async function() {
646
- var I, d;
647
- const b = (I = A == null ? void 0 : A.getModel()) == null ? void 0 : I.uri.toString();
648
- if (C != null && b != null && s != null) {
649
- (d = E.current) == null || d.call(E);
650
- const g = C.languages.json.jsonDefaults.diagnosticsOptions.schemas ?? [];
651
- switch (s) {
647
+ var b, d;
648
+ const m = (b = A == null ? void 0 : A.getModel()) == null ? void 0 : b.uri.toString();
649
+ if (I != null && m != null && g != null) {
650
+ (d = C.current) == null || d.call(C);
651
+ const s = I.languages.json.jsonDefaults.diagnosticsOptions.schemas ?? [];
652
+ switch (g) {
652
653
  case "none":
653
654
  break;
654
655
  case "order-rules": {
655
- g.push({
656
+ s.push({
656
657
  schema: await fetch(
657
658
  "https://core.commercelayer.io/api/public/schemas/order_rules"
658
- ).then(async (c) => await c.json()).then((c) => re(c)),
659
- uri: `file:///json-schema--${s}.json`,
660
- fileMatch: [b]
661
- }), E.current = ve(C, b, ["order"]);
659
+ ).then(async (M) => await M.json()).then((M) => re(M)),
660
+ uri: `file:///json-schema--${g}.json`,
661
+ fileMatch: [m]
662
+ }), C.current = ve(I, m, ["order"]);
662
663
  break;
663
664
  }
664
665
  case "price-rules": {
665
- g.push({
666
+ s.push({
666
667
  schema: await fetch(
667
668
  "https://core.commercelayer.io/api/public/schemas/price_rules"
668
- ).then(async (c) => await c.json()).then((c) => re(c)),
669
- uri: `file:///json-schema--${s}.json`,
670
- fileMatch: [b]
671
- }), E.current = ve(C, b, ["price"]);
669
+ ).then(async (M) => await M.json()).then((M) => re(M)),
670
+ uri: `file:///json-schema--${g}.json`,
671
+ fileMatch: [m]
672
+ }), C.current = ve(I, m, ["price"]);
672
673
  break;
673
674
  }
674
675
  }
675
- C.languages.json.jsonDefaults.setDiagnosticsOptions({
676
+ I.languages.json.jsonDefaults.setDiagnosticsOptions({
676
677
  enableSchemaRequest: !0,
677
678
  schemaRequest: "ignore",
678
679
  schemaValidation: "error",
679
680
  validate: !0,
680
- schemas: g
681
+ schemas: s
681
682
  });
682
683
  }
683
684
  }(), () => {
684
- var b;
685
- (b = E.current) == null || b.call(E);
686
- }), [C, A, s]), /* @__PURE__ */ se.jsx(
685
+ var m;
686
+ (m = C.current) == null || m.call(C);
687
+ }), [I, A, g]), /* @__PURE__ */ se.jsx(
687
688
  Ee,
688
689
  {
689
690
  label: n,
@@ -697,14 +698,15 @@ const Vt = Ut(500), zt = Ie(
697
698
  defaultPath: L.id ?? L.name,
698
699
  className: "[&>.monaco-editor]:rounded [&>.monaco-editor>.overflow-guard]:rounded",
699
700
  theme: "vs-dark",
700
- language: a,
701
- height: f,
701
+ language: l,
702
+ height: p,
702
703
  defaultValue: i,
703
- value: o,
704
- onMount: j,
704
+ value: a,
705
+ onMount: R,
705
706
  options: {
706
707
  quickSuggestions: !0,
707
- readOnly: !1,
708
+ readOnly: o,
709
+ domReadOnly: !0,
708
710
  automaticLayout: !0,
709
711
  insertSpaces: !0,
710
712
  tabSize: 2,
@@ -747,13 +749,13 @@ function ve(e, t, r) {
747
749
  };
748
750
  const o = n.getWordUntilPosition(i), a = n.getLineContent(i.lineNumber).substring(0, i.column - 1);
749
751
  if (/"(field|selector)"\s*:\s*"[^"]*$/.test(a)) {
750
- const s = o.word;
751
- if (s != null)
752
+ const p = o.word;
753
+ if (p != null)
752
754
  return {
753
755
  incomplete: !1,
754
756
  suggestions: (await _t(
755
757
  r,
756
- s
758
+ p
757
759
  )).map((y) => ({
758
760
  kind: y.type === "relationship" ? e.languages.CompletionItemKind.Module : e.languages.CompletionItemKind.Value,
759
761
  label: y.value,