@a-ludi/rjsf-formulas 0.5.0 → 0.6.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.
package/dist/index.mjs CHANGED
@@ -1,48 +1,48 @@
1
- import { findSchemaDefinition as ct } from "@rjsf/utils";
2
- import { jsx as it } from "react/jsx-runtime";
3
- import { useState as ut, useRef as m, useEffect as w, useCallback as Q, forwardRef as at, useMemo as V } from "react";
4
- import lt from "@rjsf/core";
5
- const X = Symbol("arrayIndex");
6
- function pt(t, r) {
1
+ import { findSchemaDefinition as ut } from "@rjsf/utils";
2
+ import { jsx as at } from "react/jsx-runtime";
3
+ import { useState as lt, useRef as g, useEffect as m, useCallback as K, forwardRef as pt, useMemo as Q } from "react";
4
+ import dt from "@rjsf/core";
5
+ const U = Symbol("arrayIndex");
6
+ function yt(t, r) {
7
7
  const e = (r == null ? void 0 : r.formulaKey) ?? "x-formula", s = (r == null ? void 0 : r.formulaContextKey) ?? "x-formula-context", n = (r == null ? void 0 : r.formulaConflictBehavior) ?? "warn", o = [];
8
8
  return O(t, [], o, e, s, n, !0, t), o;
9
9
  }
10
- function G(t, r) {
10
+ function W(t, r) {
11
11
  if (t === !0) return r;
12
12
  const e = t;
13
13
  return Array.isArray(e.allOf) ? { allOf: [...e.allOf, r] } : { allOf: [t, r] };
14
14
  }
15
- function yt(t, r) {
15
+ function gt(t, r) {
16
16
  return t === void 0 || t === "siblings" ? "siblings" : t === "extended" ? "extended" : (console.warn(
17
- `[rjsf-formulas] Unknown x-formula-context value "${t}" at path [${Y(r)}], treating as "siblings"`
17
+ `[rjsf-formulas] Unknown x-formula-context value "${t}" at path [${H(r)}], treating as "siblings"`
18
18
  ), "siblings");
19
19
  }
20
- function Y(t) {
20
+ function H(t) {
21
21
  return t.map((r) => typeof r == "symbol" ? "[*]" : String(r)).join(", ");
22
22
  }
23
- function W(t) {
23
+ function L(t) {
24
24
  return t.map((r) => typeof r == "symbol" ? "[*]" : String(r)).join(".");
25
25
  }
26
- function dt(t, r, e) {
27
- const s = W(t.path);
26
+ function mt(t, r, e) {
27
+ const s = L(t.path);
28
28
  if (e === "error")
29
29
  throw new TypeError(
30
- `[rjsf-formulas] Formula conflict at path [${Y(t.path)}]: "${t.formula}" vs "${r.formula}". Resolve the conflict or set formulaConflictBehavior to 'ignore' or 'warn'.`
30
+ `[rjsf-formulas] Formula conflict at path [${H(t.path)}]: "${t.formula}" vs "${r.formula}". Resolve the conflict or set formulaConflictBehavior to 'ignore' or 'warn'.`
31
31
  );
32
32
  e === "warn" && console.warn(
33
33
  `[rjsf-formulas] Formula conflict at path [${s}]: "${t.formula}" (earlier allOf branch) is overridden by "${r.formula}" (later allOf branch).`
34
34
  );
35
35
  }
36
- function mt(t, r, e) {
36
+ function ht(t, r, e) {
37
37
  for (const s of r) {
38
- const n = W(s.path), o = t.findIndex((i) => W(i.path) === n);
39
- o !== -1 ? (dt(t[o], s, e), t[o] = s) : t.push(s);
38
+ const n = L(s.path), o = t.findIndex((i) => L(i.path) === n);
39
+ o !== -1 ? (mt(t[o], s, e), t[o] = s) : t.push(s);
40
40
  }
41
41
  }
42
42
  function O(t, r, e, s, n, o, i, u) {
43
43
  const f = t;
44
44
  if (typeof f.$ref == "string") {
45
- const c = ct(f.$ref, u);
45
+ const c = ut(f.$ref, u);
46
46
  O(c, r, e, s, n, o, i, u);
47
47
  return;
48
48
  }
@@ -50,14 +50,14 @@ function O(t, r, e, s, n, o, i, u) {
50
50
  const c = f[s];
51
51
  if (typeof c != "string") {
52
52
  console.warn(
53
- `[rjsf-formulas] Formula at path [${Y(r)}] is not a string (got ${typeof c}), skipping.`
53
+ `[rjsf-formulas] Formula at path [${H(r)}] is not a string (got ${typeof c}), skipping.`
54
54
  );
55
55
  return;
56
56
  }
57
57
  e.push({
58
58
  path: r,
59
59
  formula: c,
60
- contextMode: yt(f[n], r),
60
+ contextMode: gt(f[n], r),
61
61
  condition: i
62
62
  });
63
63
  return;
@@ -75,13 +75,13 @@ function O(t, r, e, s, n, o, i, u) {
75
75
  i,
76
76
  u
77
77
  );
78
- if (l && (Array.isArray(f.prefixItems) && f.prefixItems.forEach((a, d) => {
79
- O(a, [...r, d], e, s, n, o, i, u);
80
- }), Array.isArray(t.items) && t.items.forEach((c, a) => {
78
+ if (l && (Array.isArray(f.prefixItems) && f.prefixItems.forEach((a, y) => {
79
+ O(a, [...r, y], e, s, n, o, i, u);
80
+ }), Array.isArray(t.items) && (t.items.forEach((c, a) => {
81
81
  O(c, [...r, a], e, s, n, o, i, u);
82
- }), t.items && !Array.isArray(t.items) && O(
82
+ }), t.additionalItems && typeof t.additionalItems == "object" && O(t.additionalItems, [...r, U], e, s, n, o, i, u)), t.items && !Array.isArray(t.items) && O(
83
83
  t.items,
84
- [...r, X],
84
+ [...r, U],
85
85
  e,
86
86
  s,
87
87
  n,
@@ -91,38 +91,38 @@ function O(t, r, e, s, n, o, i, u) {
91
91
  )), Array.isArray(f.allOf)) {
92
92
  const c = f.allOf;
93
93
  for (const a of c) {
94
- const d = [];
95
- O(a, r, d, s, n, o, i, u), mt(e, d, o);
94
+ const y = [];
95
+ O(a, r, y, s, n, o, i, u), ht(e, y, o);
96
96
  }
97
97
  }
98
98
  for (const c of ["oneOf", "anyOf"])
99
99
  if (Array.isArray(f[c])) {
100
100
  const a = f[c];
101
- for (const d of a) {
102
- const g = G(i, d);
103
- O(d, r, e, s, n, o, g, u);
101
+ for (const y of a) {
102
+ const w = W(i, y);
103
+ O(y, r, e, s, n, o, w, u);
104
104
  }
105
105
  }
106
106
  if ("if" in f) {
107
- const c = f.if, a = f.then, d = f.else;
107
+ const c = f.if, a = f.then, y = f.else;
108
108
  if (s in c && console.warn(
109
- `[rjsf-formulas] Formula key "${s}" found inside an "if" schema at path [${Y(r)}]. The "if" schema is a validation predicate and is never rendered — the formula will be ignored.`
109
+ `[rjsf-formulas] Formula key "${s}" found inside an "if" schema at path [${H(r)}]. The "if" schema is a validation predicate and is never rendered — the formula will be ignored.`
110
110
  ), a !== void 0) {
111
- const g = G(i, c);
112
- O(a, r, e, s, n, o, g, u);
111
+ const w = W(i, c);
112
+ O(a, r, e, s, n, o, w, u);
113
113
  }
114
- if (d !== void 0) {
115
- const g = G(i, { not: c });
116
- O(d, r, e, s, n, o, g, u);
114
+ if (y !== void 0) {
115
+ const w = W(i, { not: c });
116
+ O(y, r, e, s, n, o, w, u);
117
117
  }
118
118
  }
119
119
  }
120
- function gt(t) {
120
+ function jt(t) {
121
121
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
122
122
  }
123
- var H, tt;
124
- function ht() {
125
- return tt || (tt = 1, H = function t(r, e) {
123
+ var Z, et;
124
+ function wt() {
125
+ return et || (et = 1, Z = function t(r, e) {
126
126
  if (r === e) return !0;
127
127
  if (r && e && typeof r == "object" && typeof e == "object") {
128
128
  if (r.constructor !== e.constructor) return !1;
@@ -146,11 +146,11 @@ function ht() {
146
146
  return !0;
147
147
  }
148
148
  return r !== r && e !== e;
149
- }), H;
149
+ }), Z;
150
150
  }
151
- var wt = ht();
152
- const jt = /* @__PURE__ */ gt(wt);
153
- function At(t, r, e, s) {
151
+ var At = wt();
152
+ const Ot = /* @__PURE__ */ jt(At);
153
+ function xt(t, r, e, s) {
154
154
  const o = r.slice(0, -1).reduce((u, f) => {
155
155
  if (!(u == null || typeof u != "object"))
156
156
  return u[f];
@@ -163,41 +163,41 @@ function At(t, r, e, s) {
163
163
  [s.formulaPathKey]: [...r]
164
164
  }) : i;
165
165
  }
166
- function rt(t) {
166
+ function nt(t) {
167
167
  return t.map((r) => typeof r == "symbol" ? "[*]" : String(r)).join(", ");
168
168
  }
169
- function F(t, r) {
169
+ function M(t, r) {
170
170
  return r.reduce((e, s) => {
171
171
  if (!(e == null || typeof e != "object"))
172
172
  return e[s];
173
173
  }, t);
174
174
  }
175
- function Z(t, r, e) {
175
+ function B(t, r, e) {
176
176
  if (r.length === 0) return;
177
- const s = F(t, r.slice(0, -1));
177
+ const s = M(t, r.slice(0, -1));
178
178
  s != null && typeof s == "object" && (s[r[r.length - 1]] = e);
179
179
  }
180
- function M(t, r, e = []) {
180
+ function E(t, r, e = []) {
181
181
  if (t.length === 0) return [e];
182
182
  const [s, ...n] = t;
183
- if (s === X) {
184
- const o = F(r, e);
183
+ if (s === U) {
184
+ const o = M(r, e);
185
185
  if (!Array.isArray(o)) return [];
186
186
  const i = [];
187
187
  for (let u = 0; u < o.length; u++)
188
- i.push(...M(n, r, [...e, u]));
188
+ i.push(...E(n, r, [...e, u]));
189
189
  return i;
190
190
  }
191
- return M(n, r, [...e, s]);
191
+ return E(n, r, [...e, s]);
192
192
  }
193
- function B(t, r) {
194
- return jt(t, r);
193
+ function tt(t, r) {
194
+ return Ot(t, r);
195
195
  }
196
- async function et(t, r, e, s) {
196
+ async function st(t, r, e, s) {
197
197
  const n = structuredClone(t), o = [];
198
198
  for (const f of r)
199
- for (const l of M(f.path, n)) {
200
- const c = At(f, l, n, s);
199
+ for (const l of E(f.path, n)) {
200
+ const c = xt(f, l, n, s);
201
201
  o.push({ field: f, concretePath: l, context: c });
202
202
  }
203
203
  const i = await Promise.allSettled(
@@ -206,177 +206,186 @@ async function et(t, r, e, s) {
206
206
  for (let f = 0; f < o.length; f++) {
207
207
  const { concretePath: l } = o[f], c = i[f];
208
208
  if (c.status === "fulfilled")
209
- Z(n, l, c.value);
209
+ B(n, l, c.value);
210
210
  else {
211
211
  const a = c.reason instanceof Error ? c.reason : new Error(String(c.reason));
212
- u.push({ path: l, error: a }), Z(n, l, void 0);
212
+ u.push({ path: l, error: a }), B(n, l, void 0);
213
213
  }
214
214
  }
215
215
  return { data: n, errors: u };
216
216
  }
217
- function Ot(t, r, e) {
218
- for (const s of e)
219
- for (const n of M(s.path, r))
220
- if (!B(F(t, n), F(r, n)))
217
+ function Rt(t, r, e, s) {
218
+ for (const n of e)
219
+ for (const o of E(n.path, r))
220
+ if (!tt(
221
+ s(M(t, o), o),
222
+ s(M(r, o), o)
223
+ ))
221
224
  return !1;
222
225
  return !0;
223
226
  }
224
- async function xt(t, r, e, s, n, o, i, u, f) {
225
- const l = r.filter(
227
+ async function bt(t, r, e, s, n, o, i, u, f, l = (c) => c) {
228
+ const c = r.filter(
226
229
  (p) => p.condition === !0 || u(p.condition, t)
227
230
  );
228
- if (l.length === 0) return t;
229
- const c = /* @__PURE__ */ new Map(), a = [];
230
- for (const p of l) {
231
- const y = JSON.stringify(p.path);
232
- if (c.has(y)) {
231
+ if (c.length === 0) return t;
232
+ const a = /* @__PURE__ */ new Map(), y = [];
233
+ for (const p of c) {
234
+ const d = JSON.stringify(p.path);
235
+ if (a.has(d)) {
233
236
  if (f === "error")
234
237
  throw new TypeError(
235
- `[rjsf-formulas] Formula conflict: two active fields share path [${rt(p.path)}]`
238
+ `[rjsf-formulas] Formula conflict: two active fields share path [${nt(p.path)}]`
236
239
  );
237
240
  f === "warn" && console.warn(
238
- `[rjsf-formulas] Formula conflict: two active fields share path [${rt(p.path)}]; taking last`
241
+ `[rjsf-formulas] Formula conflict: two active fields share path [${nt(p.path)}]; taking last`
239
242
  );
240
- const h = a.indexOf(c.get(y));
241
- a[h] = p, c.set(y, p);
243
+ const h = y.indexOf(a.get(d));
244
+ y[h] = p, a.set(d, p);
242
245
  } else
243
- c.set(y, p), a.push(p);
246
+ a.set(d, p), y.push(p);
244
247
  }
245
- const d = { formulaDataKey: o, formulaPathKey: i };
246
- let g = t;
248
+ const w = { formulaDataKey: o, formulaPathKey: i };
249
+ let x = t;
247
250
  for (let p = 0; p < s; p++) {
248
- const { data: y, errors: h } = await et(g, a, e, d);
249
- if (Ot(g, y, a)) {
250
- for (const { path: j, error: b } of h)
251
- n == null || n(j, b);
252
- return y;
251
+ const { data: d, errors: h } = await st(x, y, e, w);
252
+ if (Rt(x, d, y, l)) {
253
+ for (const { path: A, error: b } of h)
254
+ n == null || n(A, b);
255
+ return d;
253
256
  }
254
- g = y;
257
+ x = d;
255
258
  }
256
- const { data: x } = await et(g, a, e, d), v = structuredClone(x);
257
- for (const p of a)
258
- for (const y of M(p.path, x))
259
- B(F(g, y), F(x, y)) || (n == null || n(
260
- y,
259
+ const { data: R } = await st(x, y, e, w), k = structuredClone(R);
260
+ for (const p of y)
261
+ for (const d of E(p.path, R))
262
+ tt(
263
+ l(M(x, d), d),
264
+ l(M(R, d), d)
265
+ ) || (n == null || n(
266
+ d,
261
267
  new Error(
262
- `[rjsf-formulas] Formula at [${y.join(", ")}] did not converge after ${s} passes`
268
+ `[rjsf-formulas] Formula at [${d.join(", ")}] did not converge after ${s} passes`
263
269
  )
264
- ), Z(v, y, void 0));
265
- return v;
270
+ ), B(k, d, void 0));
271
+ return k;
266
272
  }
267
- function bt(t) {
273
+ function It(t) {
268
274
  return JSON.stringify(t);
269
275
  }
270
- function Rt(t, r, e, s, n, o, i, u, f, l, c) {
271
- const [a, d] = ut(t), g = m(t), x = m(t), v = m(/* @__PURE__ */ new Map()), p = m(null), y = m(!1), h = m(o), j = m(i), b = m(e), S = m(r), U = m(n), E = m(u), k = m(f), _ = m(l);
272
- w(() => {
276
+ function $t(t, r, e, s, n, o, i, u, f, l, c, a) {
277
+ const [y, w] = lt(t), x = g(t), R = g(t), k = g(/* @__PURE__ */ new Map()), p = g(null), d = g(!1), h = g(o), A = g(i), b = g(e), J = g(r), z = g(n), q = g(u), _ = g(f), v = g(l), D = g(a);
278
+ m(() => {
273
279
  h.current = o;
274
- }, [o]), w(() => {
275
- j.current = i;
276
- }, [i]), w(() => {
280
+ }, [o]), m(() => {
281
+ A.current = i;
282
+ }, [i]), m(() => {
277
283
  b.current = e;
278
- }, [e]), w(() => {
279
- S.current = r;
280
- }, [r]), w(() => {
281
- U.current = n;
282
- }, [n]), w(() => {
283
- E.current = u;
284
- }, [u]), w(() => {
285
- k.current = f;
286
- }, [f]), w(() => {
287
- _.current = l;
288
- }, [l]);
289
- const D = Q(() => {
290
- if (y.current) return;
284
+ }, [e]), m(() => {
285
+ J.current = r;
286
+ }, [r]), m(() => {
287
+ z.current = n;
288
+ }, [n]), m(() => {
289
+ q.current = u;
290
+ }, [u]), m(() => {
291
+ _.current = f;
292
+ }, [f]), m(() => {
293
+ v.current = l;
294
+ }, [l]), m(() => {
295
+ D.current = a;
296
+ }, [a]);
297
+ const X = K(() => {
298
+ if (d.current) return;
291
299
  (async () => {
292
- var R, K;
293
- y.current = !0;
300
+ var P, V;
301
+ d.current = !0;
294
302
  try {
295
303
  for (; ; ) {
296
- const P = g.current, C = S.current, nt = C.filter(
297
- (I) => I.condition === !0 || k.current(I.condition, P)
298
- ), T = [];
299
- for (const I of nt)
300
- for (const ft of M(I.path, P))
301
- T.push(ft);
302
- const z = v.current;
303
- z.clear();
304
- for (const I of T) z.set(bt(I), "running");
305
- T.length > 0 && ((R = j.current) == null || R.call(j, T));
306
- const st = await xt(
307
- P,
308
- C,
304
+ const T = x.current, rt = J.current, ot = rt.filter(
305
+ ($) => $.condition === !0 || _.current($.condition, T)
306
+ ), N = [];
307
+ for (const $ of ot)
308
+ for (const it of E($.path, T))
309
+ N.push(it);
310
+ const G = k.current;
311
+ G.clear();
312
+ for (const $ of N) G.set(It($), "running");
313
+ N.length > 0 && ((P = A.current) == null || P.call(A, N));
314
+ const ft = await bt(
315
+ T,
316
+ rt,
309
317
  b.current,
310
- U.current,
318
+ z.current,
311
319
  h.current,
312
- E.current.formulaDataKey,
313
- E.current.formulaPathKey,
314
- k.current,
315
- _.current
320
+ q.current.formulaDataKey,
321
+ q.current.formulaPathKey,
322
+ _.current,
323
+ v.current,
324
+ D.current
316
325
  );
317
- if (J.current) break;
318
- const ot = [...z.values()].some((I) => I === "dirty");
319
- if (z.clear(), !ot) {
320
- d(st), T.length > 0 && ((K = j.current) == null || K.call(j, []));
326
+ if (j.current) break;
327
+ const ct = [...G.values()].some(($) => $ === "dirty");
328
+ if (G.clear(), !ct) {
329
+ w(ft), N.length > 0 && ((V = A.current) == null || V.call(A, []));
321
330
  break;
322
331
  }
323
332
  }
324
333
  } finally {
325
- y.current = !1;
334
+ d.current = !1;
326
335
  }
327
336
  })();
328
- }, []), q = Q(
329
- (A) => {
330
- g.current = A;
331
- const R = v.current;
332
- for (const [K, P] of R)
333
- P === "running" && R.set(K, "dirty");
334
- y.current || (p.current !== null && clearTimeout(p.current), p.current = setTimeout(() => {
335
- p.current = null, D();
337
+ }, []), I = K(
338
+ (F) => {
339
+ x.current = F;
340
+ const P = k.current;
341
+ for (const [V, T] of P)
342
+ T === "running" && P.set(V, "dirty");
343
+ d.current || (p.current !== null && clearTimeout(p.current), p.current = setTimeout(() => {
344
+ p.current = null, X();
336
345
  }, s));
337
346
  },
338
- [s, D]
339
- ), $ = m(!1), J = m(!1);
340
- return w(() => {
341
- $.current ? B(t, x.current) || (x.current = t, q(t)) : ($.current = !0, x.current = t, c !== "skip" && q(t));
342
- }), w(() => (J.current = !1, () => {
343
- J.current = !0, $.current = !1, p.current !== null && clearTimeout(p.current);
344
- }), []), { enrichedFormData: a, handleInput: q };
347
+ [s, X]
348
+ ), Y = g(!1), j = g(!1);
349
+ return m(() => {
350
+ Y.current ? tt(t, R.current) || (R.current = t, I(t)) : (Y.current = !0, R.current = t, c !== "skip" && I(t));
351
+ }), m(() => (j.current = !1, () => {
352
+ j.current = !0, Y.current = !1, p.current !== null && clearTimeout(p.current);
353
+ }), []), { enrichedFormData: y, handleInput: I };
345
354
  }
346
- function $t(t, r) {
347
- const e = structuredClone(t ?? {}), s = It(r);
355
+ function kt(t, r) {
356
+ const e = structuredClone(t ?? {}), s = _t(r);
348
357
  for (const n of r)
349
- N(e, n.path, s);
358
+ S(e, n.path, s);
350
359
  return e;
351
360
  }
352
- function It(t) {
361
+ function _t(t) {
353
362
  const r = /* @__PURE__ */ new Set();
354
363
  for (let e = 0; e < t.length; e++) {
355
364
  const s = t[e].path;
356
365
  for (let n = 0; n < s.length; n++) {
357
366
  const o = s[n];
358
- if (typeof o != "number" && o !== X) continue;
359
- const i = L(s.slice(0, n)), u = typeof o == "number";
367
+ if (typeof o != "number" && o !== U) continue;
368
+ const i = C(s.slice(0, n)), u = typeof o == "number";
360
369
  t.some((l, c) => {
361
- if (c === e || l.path.length <= n || L(l.path.slice(0, n)) !== i) return !1;
370
+ if (c === e || l.path.length <= n || C(l.path.slice(0, n)) !== i) return !1;
362
371
  const a = l.path[n];
363
- return u ? a === X : typeof a == "number";
372
+ return u ? a === U : typeof a == "number";
364
373
  }) && r.add(i);
365
374
  }
366
375
  }
367
376
  return r;
368
377
  }
369
- function L(t) {
378
+ function C(t) {
370
379
  return JSON.stringify(t.map((r) => typeof r == "symbol" ? "__ARRAY_INDEX__" : r));
371
380
  }
372
- function N(t, r, e, s = []) {
381
+ function S(t, r, e, s = []) {
373
382
  if (r.length === 0) {
374
383
  t["ui:readonly"] = !0;
375
384
  return;
376
385
  }
377
386
  const [n, ...o] = r;
378
387
  if (typeof n == "string") {
379
- (!t[n] || typeof t[n] != "object" || Array.isArray(t[n])) && (t[n] = {}), N(t[n], o, e, [...s, n]);
388
+ (!t[n] || typeof t[n] != "object" || Array.isArray(t[n])) && (t[n] = {}), S(t[n], o, e, [...s, n]);
380
389
  return;
381
390
  }
382
391
  if (typeof n == "number") {
@@ -386,18 +395,18 @@ function N(t, r, e, s = []) {
386
395
  }
387
396
  Array.isArray(t.items) || (t.items = []);
388
397
  const f = t.items;
389
- (!f[n] || typeof f[n] != "object") && (f[n] = {}), N(f[n], o, e, [...s, n]);
398
+ (!f[n] || typeof f[n] != "object") && (f[n] = {}), S(f[n], o, e, [...s, n]);
390
399
  return;
391
400
  }
392
- const i = L(s);
401
+ const i = C(s);
393
402
  if (e.has(i))
394
- (!t.additionalItems || typeof t.additionalItems != "object") && (t.additionalItems = {}), N(t.additionalItems, o, e, [...s, n]);
403
+ (!t.additionalItems || typeof t.additionalItems != "object") && (t.additionalItems = {}), S(t.additionalItems, o, e, [...s, n]);
395
404
  else {
396
405
  if (Array.isArray(t.items)) {
397
406
  console.warn("[rjsf-formulas] mergeReadOnly: cannot inject ui:readonly for uniform array because existing uiSchema has items as an array. Skipping.");
398
407
  return;
399
408
  }
400
- (!t.items || typeof t.items != "object") && (t.items = {}), N(t.items, o, e, [...s, n]);
409
+ (!t.items || typeof t.items != "object") && (t.items = {}), S(t.items, o, e, [...s, n]);
401
410
  }
402
411
  }
403
412
  function vt(t, r) {
@@ -407,77 +416,79 @@ function vt(t, r) {
407
416
  validator: n,
408
417
  uiSchema: o,
409
418
  evaluator: i,
410
- Form: u = lt,
419
+ Form: u = dt,
411
420
  formulaKey: f = "x-formula",
412
421
  formulaContextKey: l = "x-formula-context",
413
422
  formulaDataKey: c = "__formData__",
414
423
  formulaPathKey: a = "__path__",
415
- maxConvergencePasses: d = 10,
416
- debounceMs: g = 300,
424
+ maxConvergencePasses: y = 10,
425
+ debounceMs: w = 300,
417
426
  onFormulaError: x,
418
- onLoadingChange: v,
419
- formulaConflictBehavior: p = "warn",
420
- initialComputationMode: y = "always",
427
+ onLoadingChange: R,
428
+ formulaConflictBehavior: k = "warn",
429
+ initialComputationMode: p = "always",
430
+ convergenceKey: d = (j) => j,
421
431
  onChange: h,
422
- ...j
423
- } = t, b = V(
424
- () => pt(e, { formulaKey: f, formulaContextKey: l }),
432
+ ...A
433
+ } = t, b = Q(
434
+ () => yt(e, { formulaKey: f, formulaContextKey: l }),
425
435
  [e, f, l]
426
- ), S = V(
436
+ ), J = Q(
427
437
  () => ({ formulaDataKey: c, formulaPathKey: a }),
428
438
  [c, a]
429
- ), U = V(
430
- () => $t(o, b),
439
+ ), z = Q(
440
+ () => kt(o, b),
431
441
  [o, b]
432
- ), E = Q(
433
- (A, R) => n.isValid(A, R, e),
442
+ ), q = K(
443
+ (j, F) => n.isValid(j, F, e),
434
444
  [n, e]
435
- ), k = y === "always" ? 0 : y === "skip" ? 1 : 2, _ = m(k);
436
- w(() => (_.current = k, () => {
437
- _.current = k;
445
+ ), _ = p === "always" ? 0 : p === "skip" ? 1 : 2, v = g(_);
446
+ m(() => (v.current = _, () => {
447
+ v.current = _;
438
448
  }), []);
439
- const { enrichedFormData: D, handleInput: q } = Rt(
449
+ const { enrichedFormData: D, handleInput: X } = $t(
440
450
  s,
441
451
  b,
442
452
  i,
443
- g,
444
- d,
453
+ w,
454
+ y,
445
455
  x,
446
- v,
447
- S,
448
- E,
456
+ R,
457
+ J,
458
+ q,
459
+ k,
449
460
  p,
450
- y
451
- ), $ = m(h);
452
- return w(() => {
453
- $.current = h;
454
- }, [h]), w(() => {
455
- var A;
461
+ d
462
+ ), I = g(h);
463
+ return m(() => {
464
+ I.current = h;
465
+ }, [h]), m(() => {
466
+ var j;
456
467
  if (b.length !== 0) {
457
- if (_.current > 0) {
458
- _.current--;
468
+ if (v.current > 0) {
469
+ v.current--;
459
470
  return;
460
471
  }
461
- (A = $.current) == null || A.call($, { formData: D }, void 0);
472
+ (j = I.current) == null || j.call(I, { formData: D }, void 0);
462
473
  }
463
- }, [D]), /* @__PURE__ */ it(
474
+ }, [D]), /* @__PURE__ */ at(
464
475
  u,
465
476
  {
466
477
  ref: r,
467
- ...j,
478
+ ...A,
468
479
  schema: e,
469
480
  validator: n,
470
481
  formData: D,
471
- uiSchema: U,
472
- onChange: (A, R) => {
473
- q(A.formData), h == null || h(A, R);
482
+ uiSchema: z,
483
+ onChange: (j, F) => {
484
+ X(j.formData), h == null || h(j, F);
474
485
  }
475
486
  }
476
487
  );
477
488
  }
478
- const Mt = at(vt);
489
+ const qt = pt(vt);
479
490
  export {
480
- Mt as FormulaForm,
481
- pt as analyzeSchema
491
+ qt as FormulaForm,
492
+ yt as analyzeSchema
482
493
  };
483
494
  //# sourceMappingURL=index.mjs.map