@a-ludi/rjsf-formulas 0.4.1 → 0.5.0

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