@viamedici-spc/configurator-react 4.2.0 → 4.3.0-active-attributes-react-20261126133758

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.js CHANGED
@@ -1,90 +1,109 @@
1
- import { GlobalAttributeIdKeyBuilder as yt, globalAttributeIdKeyEq as Nt, globalAttributeIdEq as Wt, Logger as x, SessionFactory as Ot, DecisionKind as L, AttributeType as J, ExplainQuestionSubject as N, AttributeRefinements as rt, AttributeInterpreter as B, ExplainQuestionType as It, ChoiceValueInterpreter as Et } from "@viamedici-spc/configurator-ts";
2
- import { pipe as j, RA as k, RM as H, Ord as kt, O as K, identity as et, Eq as b, Bool as at, Str as Rt, TE as nt, E as Bt, T as Lt, constVoid as Kt } from "@viamedici-spc/fp-ts-extensions";
3
- import { atom as f, getDefaultStore as Qt, useSetAtom as Ft, useAtomValue as Ct, useAtom as G, Provider as $t } from "jotai";
4
- import { createContext as Dt, useContext as Mt, useMemo as X, useEffect as At } from "react";
5
- import { useStableMemo as Jt } from "fp-ts-react-stable-hooks";
6
- import { selectAtom as zt, atomFamily as _ } from "jotai/utils";
7
- import { jsx as q, Fragment as Pt, jsxs as Ht } from "react/jsx-runtime";
8
- import { guid as Xt } from "dyna-guid";
9
- import { atomEffect as ut } from "jotai-effect";
10
- import { atomWithMachine as Yt } from "jotai-xstate";
11
- import { fromPromise as Zt, setup as Gt, assign as ft, log as te, enqueueActions as gt } from "xstate";
12
- const E = "ConfigurationUninitialized";
13
- function D(t) {
1
+ import { GlobalAttributeIdKeyBuilder as T, globalAttributeIdKeyEq as Ht, globalAttributeIdEq as Pt, Logger as E, SessionFactory as Xt, DecisionKind as H, AttributeType as tt, ExplainQuestionSubject as K, AttributeRefinements as ft, AttributeInterpreter as J, ExplainQuestionType as qt, ChoiceValueInterpreter as Mt } from "@viamedici-spc/configurator-ts";
2
+ import { pipe as O, RA as M, RM as et, Ord as zt, O as X, identity as at, Eq as y, Bool as Dt, Str as Yt, TE as ut, E as Zt, T as Gt, constVoid as te } from "@viamedici-spc/fp-ts-extensions";
3
+ import { atom as f, getDefaultStore as ee, useSetAtom as Ut, useAtomValue as Y, useAtom as st, Provider as ne } from "jotai";
4
+ import { createContext as Ct, useContext as Rt, useMemo as Q, useEffect as ct, useLayoutEffect as B, useRef as ht, forwardRef as ie, useImperativeHandle as oe } from "react";
5
+ import { useStableMemo as jt } from "fp-ts-react-stable-hooks";
6
+ import { selectAtom as Ot, atomFamily as W } from "jotai/utils";
7
+ import { jsx as w, Fragment as Tt, jsxs as se } from "react/jsx-runtime";
8
+ import { useSyncExternalStore as re } from "use-sync-external-store/shim";
9
+ import { guid as ae } from "dyna-guid";
10
+ import { atomEffect as gt } from "jotai-effect";
11
+ import { atomWithMachine as ue } from "jotai-xstate";
12
+ import { fromPromise as ce, setup as le, assign as yt, log as de, enqueueActions as St } from "xstate";
13
+ var _t = {
14
+ equals: function(t, e) {
15
+ return t === e;
16
+ }
17
+ };
18
+ _t.equals;
19
+ var me = function(t) {
20
+ return {
21
+ equals: function(e, n) {
22
+ return e === n || t(e, n);
23
+ }
24
+ };
25
+ }, Lt = {
26
+ equals: function(t, e) {
27
+ return t === e;
28
+ }
29
+ };
30
+ Lt.equals;
31
+ const D = "ConfigurationUninitialized";
32
+ function I(t) {
14
33
  return f((e) => {
15
34
  try {
16
35
  return t(e, (n) => {
17
36
  const i = e(n);
18
- if (i === E)
19
- throw E;
37
+ if (i === D)
38
+ throw D;
20
39
  return i;
21
40
  });
22
41
  } catch (n) {
23
- if (n === E)
24
- return E;
42
+ if (n === D)
43
+ return D;
25
44
  throw n;
26
45
  }
27
46
  });
28
47
  }
29
- function ht(t) {
48
+ function vt(t) {
30
49
  const { guardedConfigurationAtom: e, guardedAttributesAtom: n } = t;
31
- function i(o, s) {
32
- const r = o === "all" ? "all" : j(
50
+ function i(o, r) {
51
+ const s = o === "all" ? "all" : O(
33
52
  o,
34
- k.map((u) => typeof u == "string" ? u : yt(u))
53
+ M.map((a) => typeof a == "string" ? a : T(a))
35
54
  );
36
- return D((u, a) => {
37
- if (r === "all")
38
- return j(e, a, (m) => m.attributes, H.values(kt.trivial));
39
- const c = a(n);
40
- return j(
41
- r,
42
- k.map((m) => u(c(m))),
43
- s ? k.filterMap(K.fromNullable) : et
55
+ return I((a, u) => {
56
+ if (s === "all")
57
+ return O(e, u, (l) => l.attributes, et.values(zt.trivial));
58
+ const c = u(n);
59
+ return O(
60
+ s,
61
+ M.map((l) => a(c(l))),
62
+ r ? M.filterMap(X.fromNullable) : at
44
63
  );
45
64
  });
46
65
  }
47
66
  return i;
48
67
  }
49
- const xt = globalThis.configuratorReactContexts ?? {
50
- AtomsContext: Dt(null),
51
- StoreContext: Dt(Qt())
68
+ const kt = globalThis.configuratorReactContexts ?? {
69
+ AtomsContext: Ct(null),
70
+ StoreContext: Ct(ee())
52
71
  };
53
- globalThis.configuratorReactContexts = xt;
54
- const Ut = xt.AtomsContext, qt = xt.StoreContext, W = () => Mt(Ut), ct = () => Mt(qt);
55
- function vt(t, e, n) {
56
- const i = b.tuple(b.eqNullable(at.Eq), n);
57
- return (o, ...s) => {
58
- const r = W(), u = ct(), a = Ft(r.selectors.subscriberAtom, { store: u }), c = Jt(() => o ?? !0 ? e(r, ...s) : t(r, ...s), [o, s], i), m = X(() => a(c), [a, c]);
59
- return At(() => () => {
60
- m.unsubscribe();
61
- }, [m]), Ct(c, { store: u });
72
+ globalThis.configuratorReactContexts = kt;
73
+ const Vt = kt.AtomsContext, Nt = kt.StoreContext, V = () => Rt(Vt), nt = () => Rt(Nt);
74
+ function It(t, e, n) {
75
+ const i = y.tuple(y.eqNullable(Dt.Eq), n);
76
+ return (o, ...r) => {
77
+ const s = V(), a = nt(), u = Ut(s.selectors.subscriberAtom, { store: a }), c = jt(() => o ?? !0 ? e(s, ...r) : t(s, ...r), [o, r], i), l = Q(() => u(c), [u, c]);
78
+ return ct(() => () => {
79
+ l.unsubscribe();
80
+ }, [l]), Y(c, { store: a });
62
81
  };
63
82
  }
64
- function y(t, e) {
65
- const n = vt((o) => t(o.selectors), (o) => e(o.suspended), b.tuple());
83
+ function v(t, e) {
84
+ const n = It((o) => t(o.selectors), (o) => e(o.suspended), y.tuple());
66
85
  function i(o) {
67
86
  return n(o);
68
87
  }
69
88
  return i;
70
89
  }
71
- function lt(t, e) {
72
- const n = vt((o, s) => t(o.selectors)(s), (o, s) => e(o.suspended)(s), b.tuple(Rt.Eq));
73
- function i(o, s) {
74
- const r = X(() => typeof o == "string" ? o : yt(o), [o]);
75
- return n(s, r);
90
+ function At(t, e) {
91
+ const n = It((o, r) => t(o.selectors)(r), (o, r) => e(o.suspended)(r), y.tuple(Yt.Eq));
92
+ function i(o, r) {
93
+ const s = Q(() => typeof o == "string" ? o : T(o), [o]);
94
+ return n(r, s);
76
95
  }
77
96
  return i;
78
97
  }
79
- function ee() {
98
+ function fe() {
80
99
  const t = {};
81
100
  return t.promise = new Promise((e, n) => {
82
101
  t.resolve = e, t.reject = n;
83
102
  }), t;
84
103
  }
85
- function g(t) {
86
- const e = zt(t, (n, i) => {
87
- if (n !== E)
104
+ function h(t) {
105
+ const e = Ot(t, (n, i) => {
106
+ if (n !== D)
88
107
  return (i == null ? void 0 : i.deferredPromise) != null ? (i.deferredPromise.resolve(n), {
89
108
  deferredPromise: null,
90
109
  result: i.deferredPromise.promise
@@ -92,7 +111,7 @@ function g(t) {
92
111
  deferredPromise: null,
93
112
  result: n
94
113
  };
95
- const o = (i == null ? void 0 : i.deferredPromise) ?? ee();
114
+ const o = (i == null ? void 0 : i.deferredPromise) ?? fe();
96
115
  return {
97
116
  deferredPromise: o,
98
117
  result: o.promise
@@ -100,100 +119,334 @@ function g(t) {
100
119
  });
101
120
  return f((n) => n(e).result);
102
121
  }
103
- const ne = b.union().with((t) => typeof t == "string", Nt).with((t) => typeof t == "object", Wt), ie = b.union().with((t) => t === "all", Rt.Eq).with((t) => Array.isArray(t), k.getEq(ne)), oe = vt(
104
- (t, e, n) => ht(t.selectors)(e, n),
105
- (t, e, n) => g(ht(t.selectors)(e, n)),
106
- b.tuple(ie, b.eqNullable(at.Eq))
122
+ const he = y.union().with((t) => typeof t == "string", Ht).with((t) => typeof t == "object", Pt), ge = y.union().with((t) => t === "all", Lt).with((t) => Array.isArray(t), M.getEq(he)), Ae = It(
123
+ (t, e, n) => vt(t.selectors)(e, n),
124
+ (t, e, n) => h(vt(t.selectors)(e, n)),
125
+ y.tuple(ge, y.eqNullable(_t))
107
126
  );
108
- function Rn(t, e, n) {
127
+ function pe(t, e, n) {
109
128
  const i = t == "all" ? e : n, o = t == "all" ? void 0 : e;
110
- return oe(i, t, o);
129
+ return Ae(i, t, o);
130
+ }
131
+ const Zn = At((t) => t.choiceAttributeAtomFamily, (t) => t.choiceAttributeAtomFamily), Gn = At((t) => t.numericAttributeAtomFamily, (t) => t.numericAttributeAtomFamily), ti = At((t) => t.booleanAttributeAtomFamily, (t) => t.booleanAttributeAtomFamily), ei = At((t) => t.componentAttributeAtomFamily, (t) => t.componentAttributeAtomFamily);
132
+ var be = function(t) {
133
+ return me(function(e, n) {
134
+ return e.length === n.length && e.every(function(i, o) {
135
+ return t.equals(i, n[o]);
136
+ });
137
+ });
138
+ };
139
+ function _(t) {
140
+ const e = t;
141
+ return typeof (e == null ? void 0 : e.getActiveAttributes) == "function" && typeof e.setActiveAttributes == "function" && typeof e.getPendingOperationCount == "function" && typeof e.addPendingOperationsChangedListener == "function";
142
+ }
143
+ function Wt(t) {
144
+ return (t == null ? void 0 : t.type) === "Boolean" ? t.isPossibleDecisionStatesImmutable === !0 && t.possibleDecisionStates.length === 0 : (t == null ? void 0 : t.type) === "Component" ? t.isPossibleDecisionStatesImmutable === !0 && t.possibleDecisionStates.length === 1 && t.possibleDecisionStates[0] === "Excluded" : (t == null ? void 0 : t.type) === "Choice" ? t.values.size > 0 && [...t.values.values()].every((e) => e.isPossibleDecisionStatesImmutable === !0 && e.possibleDecisionStates.length === 1 && e.possibleDecisionStates[0] === "Excluded") : !1;
145
+ }
146
+ class ye {
147
+ constructor() {
148
+ this.registrations = /* @__PURE__ */ new Map(), this.fullScopes = /* @__PURE__ */ new Set(), this.waiters = /* @__PURE__ */ new Set(), this.listeners = /* @__PURE__ */ new Set(), this.session = null, this.enabled = !1, this.scheduled = !1, this.running = !1, this.disposed = !1, this.generation = 0, this.applied = "all", this.activeAttributes = null, this.uncertain = !1, this.appliedAny = !1, this.error = null, this.snapshot = { activeAttributes: null, requestedAttributes: null, enabled: !1, isUpdating: !1, isScopeUpdating: !1, isScopeSettled: !1, isFullyPropagated: !1, supported: void 0, error: null }, this.subscribe = (e) => (this.listeners.add(e), () => {
149
+ this.listeners.delete(e);
150
+ }), this.getSnapshot = () => this.snapshot, this.retry = () => {
151
+ _(this.session) && (this.error = null, this.supported = void 0, this.uncertain = !0, this.changed());
152
+ }, this.retryScopedDecisionRefresh = () => {
153
+ var e, n;
154
+ _(this.session) && ((n = (e = this.session).retryScopedDecisionRefresh) == null || n.call(e));
155
+ }, this.withFullPropagation = async (e) => {
156
+ const n = {};
157
+ this.fullScopes.add(n), this.changed();
158
+ try {
159
+ return await new Promise((i, o) => {
160
+ let r = () => {
161
+ };
162
+ const s = (c) => {
163
+ r(), this.waiters.delete(a), c ? o(c) : i();
164
+ }, a = (c) => s(c), u = () => {
165
+ const c = this.getSnapshot();
166
+ c.error ? s(c.error) : c.isFullyPropagated && s();
167
+ };
168
+ this.waiters.add(a), r = this.subscribe(u), u();
169
+ }), await e();
170
+ } finally {
171
+ this.fullScopes.delete(n), this.changed();
172
+ }
173
+ };
174
+ }
175
+ setSession(e, n) {
176
+ var o;
177
+ if (this.disposed = !1, e === this.session && n === this.context) return;
178
+ for (const r of this.waiters) r(new Error("Configuration changed before full propagation completed."));
179
+ (o = this.unsubscribeSession) == null || o.call(this), this.session = e, this.context = n, this.generation++;
180
+ const i = _(e) ? e : null;
181
+ this.unsubscribeSession = i == null ? void 0 : i.addPendingOperationsChangedListener(() => this.changed()).unsubscribe, this.activeAttributes = (i == null ? void 0 : i.getActiveAttributes()) ?? null, this.applied = this.key(this.activeAttributes), this.error = null, this.uncertain = !1, this.appliedAny = this.applied !== "all", this.supported = e && !i ? !1 : void 0, this.changed();
182
+ }
183
+ setEnabled(e) {
184
+ e !== this.enabled && (this.enabled = e, e && _(this.session) && (this.supported = void 0), this.error = null, this.changed());
185
+ }
186
+ register(e, n) {
187
+ return this.registerMany(e, [n]);
188
+ }
189
+ registerMany(e, n) {
190
+ return this.registrations.set(e, structuredClone(n)), this.changed(), () => {
191
+ this.registrations.delete(e), this.changed();
192
+ };
193
+ }
194
+ requestFull(e, n) {
195
+ return n ? this.fullScopes.add(e) : this.fullScopes.delete(e), this.changed(), () => {
196
+ this.fullScopes.delete(e), this.changed();
197
+ };
198
+ }
199
+ dispose() {
200
+ var e;
201
+ for (const n of this.waiters) n(new Error("Configuration closed."));
202
+ (e = this.unsubscribeSession) == null || e.call(this), this.disposed = !0, this.generation++, this.session = null;
203
+ }
204
+ desired() {
205
+ var i;
206
+ if (!this.enabled || this.fullScopes.size || this.supported === !1 && !this.appliedAny) return null;
207
+ let e;
208
+ try {
209
+ e = (i = this.session) == null ? void 0 : i.getConfiguration().attributes;
210
+ } catch {
211
+ }
212
+ const n = /* @__PURE__ */ new Map();
213
+ for (const o of this.registrations.values())
214
+ for (const r of o) {
215
+ const s = T(r);
216
+ (!e || e.has(s)) && !Wt(e == null ? void 0 : e.get(s)) && n.set(s, r);
217
+ }
218
+ return [...n.entries()].sort(([o], [r]) => o.localeCompare(r)).map(([, o]) => o);
219
+ }
220
+ key(e) {
221
+ return e === null ? "all" : JSON.stringify(e.map(T).sort());
222
+ }
223
+ emit() {
224
+ var u, c;
225
+ if (this.disposed) return;
226
+ const e = this.desired(), n = this.key(e), i = n === this.key(this.snapshot.requestedAttributes) ? this.snapshot.requestedAttributes : e, o = !!this.session && (this.running || this.uncertain || n !== this.applied), r = o || _(this.session) && this.session.getPendingOperationCount() > 0, s = !!this.session && !r && !this.error, a = {
227
+ activeAttributes: this.activeAttributes,
228
+ requestedAttributes: i,
229
+ enabled: this.enabled && this.supported !== !1,
230
+ isUpdating: r && !this.error,
231
+ isScopeUpdating: o && !this.error,
232
+ isScopeSettled: s,
233
+ isFullyPropagated: s && n === "all",
234
+ supported: this.supported,
235
+ error: this.error,
236
+ scopedDecisionRefresh: _(this.session) ? (c = (u = this.session).getScopedDecisionRefreshState) == null ? void 0 : c.call(u) : void 0
237
+ };
238
+ if (Object.keys(a).some((l) => a[l] !== this.snapshot[l])) {
239
+ this.snapshot = a;
240
+ for (const l of this.listeners) l();
241
+ }
242
+ }
243
+ changed() {
244
+ this.disposed || (this.emit(), !(this.scheduled || this.running) && (this.scheduled = !0, queueMicrotask(() => {
245
+ this.scheduled = !1, this.pump();
246
+ })));
247
+ }
248
+ async pump() {
249
+ if (!(this.running || this.disposed || !this.session || this.error)) {
250
+ this.running = !0;
251
+ try {
252
+ for (; !this.disposed && _(this.session) && !this.error; ) {
253
+ const e = this.desired(), n = this.key(e);
254
+ if (n === this.applied && !this.uncertain) break;
255
+ const i = this.session, o = this.generation, r = this.uncertain;
256
+ this.uncertain = !0, this.emit();
257
+ try {
258
+ if (await i.setActiveAttributes(e), o !== this.generation) continue;
259
+ this.applied = n, this.uncertain = !1, this.supported = !0, this.activeAttributes = e, this.appliedAny || (this.appliedAny = e !== null);
260
+ } catch (s) {
261
+ if (o !== this.generation) continue;
262
+ if (s != null && s.activeAttributesUnsupported) {
263
+ if (this.appliedAny || r) {
264
+ try {
265
+ await i.setSessionContext(i.getSessionContext());
266
+ } catch (a) {
267
+ if (o !== this.generation) continue;
268
+ this.error = a;
269
+ break;
270
+ }
271
+ if (o !== this.generation) continue;
272
+ if (i.getActiveAttributes() !== null) {
273
+ this.error = new Error("The restarted session still has an active-attribute restriction.");
274
+ break;
275
+ }
276
+ }
277
+ this.supported = !1, this.uncertain = !1, this.applied = "all", this.activeAttributes = null, this.appliedAny = !1;
278
+ } else this.error = s;
279
+ }
280
+ }
281
+ } finally {
282
+ this.running = !1, this.emit();
283
+ }
284
+ }
285
+ }
111
286
  }
112
- const Fn = lt((t) => t.choiceAttributeAtomFamily, (t) => t.choiceAttributeAtomFamily), Mn = lt((t) => t.numericAttributeAtomFamily, (t) => t.numericAttributeAtomFamily), zn = lt((t) => t.booleanAttributeAtomFamily, (t) => t.booleanAttributeAtomFamily), Pn = lt((t) => t.componentAttributeAtomFamily, (t) => t.componentAttributeAtomFamily);
113
- function se() {
114
- const { effects: t } = W(), { addSessionListenersEffect: e, cleanupAtomFamiliesEffect: n, atomSubscriberEffect: i, atomSubscriptionCleanupEffect: o } = t;
115
- return G(e), G(n), G(i), G(o), null;
287
+ const Bt = Ct(null);
288
+ function Se({ enabled: t, children: e }) {
289
+ const n = V(), i = nt(), o = Y(n.selectors.configurationSessionAtom, { store: i }), r = Y(n.selectors.sessionUpdatingAtom, { store: i }), s = Q(() => new ye(), []);
290
+ let a = null, u = o;
291
+ try {
292
+ a = o == null ? void 0 : o.getSessionContext();
293
+ } catch {
294
+ u = null;
295
+ }
296
+ return B(() => {
297
+ s.setSession(u, a);
298
+ }, [s, u, a, r.isUpdating]), B(() => {
299
+ s.setEnabled(t);
300
+ }, [s, t]), ct(() => () => s.dispose(), [s]), /* @__PURE__ */ w(Bt.Provider, { value: s, children: e });
301
+ }
302
+ function it() {
303
+ const t = Rt(Bt);
304
+ if (!t) throw new Error("Active attributes require a Configuration provider.");
305
+ return t;
306
+ }
307
+ function ni(t, e = !0) {
308
+ const n = it(), i = ht({}).current, o = T(t);
309
+ B(() => e ? n.register(i, t) : void 0, [n, i, o, e]);
310
+ }
311
+ function Ce(t, e) {
312
+ const n = it(), i = ht({}).current, o = jt(() => t, t, be(Pt));
313
+ B(
314
+ () => e && o.length > 0 ? n.registerMany(i, o) : void 0,
315
+ [n, i, o, e]
316
+ );
116
317
  }
117
- const re = 30 * 1e3, ae = WeakRef != null ? (t) => new WeakRef(t) : (t) => ({
318
+ function ii(t) {
319
+ const e = it(), n = ht({}).current;
320
+ B(() => e.requestFull(n, t), [e, n, t]);
321
+ }
322
+ const oi = ie(function({ when: e = "visible", active: n = !0, hidden: i, ...o }, r) {
323
+ const s = it(), a = ht(null);
324
+ return oe(r, () => a.current, []), B(() => {
325
+ const u = a.current;
326
+ if (!n || i || !u) return;
327
+ const c = {};
328
+ if (e === "mounted") return s.requestFull(c, !0);
329
+ let l = !1, p;
330
+ const S = ve(u, (F) => {
331
+ l || F === !!p || (F ? p = s.requestFull(c, !0) : (p == null || p(), p = void 0));
332
+ });
333
+ return () => {
334
+ l = !0, S == null || S(), p == null || p();
335
+ };
336
+ }, [s, n, i, e]), /* @__PURE__ */ w("section", { ...o, hidden: i, ref: a });
337
+ });
338
+ function ve(t, e) {
339
+ const n = t.ownerDocument.defaultView;
340
+ if (!n) return;
341
+ if (typeof n.IntersectionObserver < "u") {
342
+ const o = new n.IntersectionObserver((r) => {
343
+ const s = r[r.length - 1];
344
+ s && e(s.isIntersecting && s.intersectionRatio > 0);
345
+ }, { rootMargin: "0px", threshold: [0, 1e-3] });
346
+ return o.observe(t), () => o.disconnect();
347
+ }
348
+ const i = () => {
349
+ const o = t.getBoundingClientRect();
350
+ e(o.width > 0 && o.height > 0 && o.bottom > 0 && o.top < n.innerHeight && o.right > 0 && o.left < n.innerWidth);
351
+ };
352
+ return i(), n.addEventListener("scroll", i, !0), n.addEventListener("resize", i), () => {
353
+ n.removeEventListener("scroll", i, !0), n.removeEventListener("resize", i);
354
+ };
355
+ }
356
+ function xe() {
357
+ const t = it();
358
+ return {
359
+ ...re(t.subscribe, t.getSnapshot, t.getSnapshot),
360
+ retry: t.retry,
361
+ retryScopedDecisionRefresh: t.retryScopedDecisionRefresh,
362
+ withFullPropagation: t.withFullPropagation,
363
+ getCurrentState: t.getSnapshot
364
+ };
365
+ }
366
+ function we() {
367
+ const { effects: t } = V(), { addSessionListenersEffect: e, cleanupAtomFamiliesEffect: n, atomSubscriberEffect: i, atomSubscriptionCleanupEffect: o } = t;
368
+ return st(e), st(n), st(i), st(o), null;
369
+ }
370
+ const Ee = 30 * 1e3, De = WeakRef != null ? (t) => new WeakRef(t) : (t) => ({
118
371
  deref: () => t
119
372
  });
120
- function ue() {
121
- return f(H.empty);
373
+ function Re() {
374
+ return f(et.empty);
122
375
  }
123
- function ce(t) {
376
+ function ke(t) {
124
377
  return f(null, (e, n, i) => {
125
- const o = Xt();
126
- x.debug("AtomSubscription:", "Creating subscription with id", o);
127
- const r = {
378
+ const o = ae();
379
+ E.debug("AtomSubscription:", "Creating subscription with id", o);
380
+ const s = {
128
381
  unsubscribe: () => {
129
- n(t.subscriptionsAtom, (u) => {
130
- const a = u.get(i);
131
- if (a == null)
132
- return u;
133
- const c = new Map(a);
382
+ n(t.subscriptionsAtom, (a) => {
383
+ const u = a.get(i);
384
+ if (u == null)
385
+ return a;
386
+ const c = new Map(u);
134
387
  c.delete(o);
135
- const m = new Map(u);
136
- return m.set(i, c), m;
388
+ const l = new Map(a);
389
+ return l.set(i, c), l;
137
390
  });
138
391
  }
139
392
  };
140
- return n(t.subscriptionsAtom, (u) => {
141
- const a = new Map(u.get(i) ?? H.empty);
142
- a.set(o, ae(r));
143
- const c = new Map(u);
144
- return c.set(i, a), c;
145
- }), r;
393
+ return n(t.subscriptionsAtom, (a) => {
394
+ const u = new Map(a.get(i) ?? et.empty);
395
+ u.set(o, De(s));
396
+ const c = new Map(a);
397
+ return c.set(i, u), c;
398
+ }), s;
146
399
  });
147
400
  }
148
- function le(t) {
149
- return ut((e) => {
401
+ function Ie(t) {
402
+ return gt((e) => {
150
403
  const i = [...e(t.subscriptionsAtom).keys()];
151
- x.debug("AtomSubscriber:", "There are", i.length, "Atoms to subscribe to.");
404
+ E.debug("AtomSubscriber:", "There are", i.length, "Atoms to subscribe to.");
152
405
  for (const o of i)
153
406
  e(o);
154
407
  });
155
408
  }
156
- function me(t) {
157
- return ut((e, n) => {
409
+ function Fe(t) {
410
+ return gt((e, n) => {
158
411
  const i = setInterval(() => {
159
- x.info("AtomSubscriptionCleanup:", "Running cleanup");
412
+ E.info("AtomSubscriptionCleanup:", "Running cleanup");
160
413
  let o = !1;
161
- n(t.subscriptionsAtom, (s) => {
162
- const r = new Map(s);
163
- for (const u of [...r.keys()]) {
164
- const a = new Map(r.get(u) ?? H.empty);
165
- for (const c of [...a.keys()]) {
166
- const m = a.get(c);
167
- (m === void 0 || m.deref() === void 0) && (x.debug("AtomSubscriptionCleanup:", "Deleting subscription", c, "because it got garbage collected."), a.delete(c), o = !0);
414
+ n(t.subscriptionsAtom, (r) => {
415
+ const s = new Map(r);
416
+ for (const a of [...s.keys()]) {
417
+ const u = new Map(s.get(a) ?? et.empty);
418
+ for (const c of [...u.keys()]) {
419
+ const l = u.get(c);
420
+ (l === void 0 || l.deref() === void 0) && (E.debug("AtomSubscriptionCleanup:", "Deleting subscription", c, "because it got garbage collected."), u.delete(c), o = !0);
168
421
  }
169
- r.set(u, a), a.size === 0 && (x.debug("AtomSubscriptionCleanup:", "Delete Atom with 0 subscriptions."), r.delete(u), o = !0);
422
+ s.set(a, u), u.size === 0 && (E.debug("AtomSubscriptionCleanup:", "Delete Atom with 0 subscriptions."), s.delete(a), o = !0);
170
423
  }
171
- return x.debug("AtomSubscriptionCleanup:", "There are", r.size, "Atoms with", [...r.values(), k.flatten].length, "subscriptions left."), o ? r : s;
424
+ return E.debug("AtomSubscriptionCleanup:", "There are", s.size, "Atoms with", [...s.values(), M.flatten].length, "subscriptions left."), o ? s : r;
172
425
  });
173
- }, re);
426
+ }, Ee);
174
427
  return () => {
175
428
  clearInterval(i);
176
429
  };
177
430
  });
178
431
  }
179
- const de = Zt(({ input: t }) => j(
432
+ const Me = ce(({ input: t }) => O(
180
433
  t.session,
181
- K.match(
182
- () => () => Ot.createSession(t.sessionContext),
434
+ X.match(
435
+ () => () => Xt.createSession(t.sessionContext),
183
436
  (e) => async () => (await e.setSessionContext(t.sessionContext), e)
184
437
  ),
185
- (e) => nt.tryCatch(e, (n) => n),
186
- nt.mapLeft((e) => ({
438
+ (e) => ut.tryCatch(e, (n) => n),
439
+ ut.mapLeft((e) => ({
187
440
  sessionContext: t.sessionContext,
188
441
  configurationError: e
189
442
  }))
190
- )()), fe = Gt({
443
+ )()), Pe = le({
191
444
  types: {
192
445
  context: {},
193
446
  events: {}
194
447
  },
195
448
  actors: {
196
- createOrUpdateSession: de
449
+ createOrUpdateSession: Me
197
450
  },
198
451
  guards: {
199
452
  shallProcess: ({ context: t }) => (
@@ -212,15 +465,15 @@ const de = Zt(({ input: t }) => j(
212
465
  on: {
213
466
  Retry: {
214
467
  actions: [
215
- ft({
468
+ yt({
216
469
  sessionCreateOrUpdateError: () => null
217
470
  })
218
471
  ]
219
472
  },
220
473
  SessionContextChanged: {
221
474
  actions: [
222
- te("SessionContextChanged"),
223
- ft({
475
+ de("SessionContextChanged"),
476
+ yt({
224
477
  desiredSessionContext: ({ event: t }) => t.sessionContext
225
478
  })
226
479
  ]
@@ -239,7 +492,7 @@ const de = Zt(({ input: t }) => j(
239
492
  },
240
493
  Processing: {
241
494
  entry: [
242
- ft({
495
+ yt({
243
496
  sessionCreateOrUpdateError: () => null
244
497
  })
245
498
  ],
@@ -247,13 +500,13 @@ const de = Zt(({ input: t }) => j(
247
500
  src: "createOrUpdateSession",
248
501
  input: ({ context: t }) => ({
249
502
  sessionContext: t.desiredSessionContext,
250
- session: K.fromNullable(t.configurationSession)
503
+ session: X.fromNullable(t.configurationSession)
251
504
  }),
252
505
  onDone: {
253
506
  target: "Idle",
254
507
  actions: [
255
- gt(({ event: t, enqueue: e }) => {
256
- Bt.isRight(t.output) ? e.assign({
508
+ St(({ event: t, enqueue: e }) => {
509
+ Zt.isRight(t.output) ? e.assign({
257
510
  configurationSession: t.output.right
258
511
  }) : e.assign({
259
512
  sessionCreateOrUpdateError: t.output.left
@@ -267,11 +520,11 @@ const de = Zt(({ input: t }) => j(
267
520
  always: [{
268
521
  target: "Idle",
269
522
  actions: [
270
- gt(({ enqueue: t, context: e }) => {
271
- nt.tryCatch(async () => {
523
+ St(({ enqueue: t, context: e }) => {
524
+ ut.tryCatch(async () => {
272
525
  var n;
273
526
  return await ((n = e.configurationSession) == null ? void 0 : n.close());
274
- }, et)(), t.assign({
527
+ }, at)(), t.assign({
275
528
  configurationSession: () => null,
276
529
  sessionCreateOrUpdateError: () => null
277
530
  });
@@ -283,11 +536,11 @@ const de = Zt(({ input: t }) => j(
283
536
  type: "final",
284
537
  id: "shutdown",
285
538
  entry: [
286
- gt(({ context: t, enqueue: e }) => {
287
- t.configurationSession && nt.tryCatch(async () => {
539
+ St(({ context: t, enqueue: e }) => {
540
+ t.configurationSession && ut.tryCatch(async () => {
288
541
  var n;
289
542
  return await ((n = t.configurationSession) == null ? void 0 : n.close());
290
- }, et)(), e.assign({
543
+ }, at)(), e.assign({
291
544
  configurationSession: () => null,
292
545
  desiredSessionContext: () => null,
293
546
  sessionCreateOrUpdateError: () => null
@@ -297,39 +550,39 @@ const de = Zt(({ input: t }) => j(
297
550
  }
298
551
  }
299
552
  });
300
- function ge() {
301
- return Yt(fe);
553
+ function qe() {
554
+ return ue(Pe);
302
555
  }
303
- function Ae(t) {
556
+ function ze(t) {
304
557
  return f((e) => e(t.sessionManagementMachineAtom).context.configurationSession);
305
558
  }
306
- function he(t) {
307
- const e = f((o, s) => {
308
- var m;
309
- const r = o(t.sessionManagementMachineAtom), u = r.matches("Processing"), a = r.context.configurationSession != null, c = (m = r.context.sessionCreateOrUpdateError) != null && m.configurationError ? {
310
- ...r.context.sessionCreateOrUpdateError.configurationError,
559
+ function Ue(t) {
560
+ const e = f((o, r) => {
561
+ var l;
562
+ const s = o(t.sessionManagementMachineAtom), a = s.matches("Processing"), u = s.context.configurationSession != null, c = (l = s.context.sessionCreateOrUpdateError) != null && l.configurationError ? {
563
+ ...s.context.sessionCreateOrUpdateError.configurationError,
311
564
  retry: () => {
312
- s.setSelf();
565
+ r.setSelf();
313
566
  }
314
567
  } : null;
315
568
  return {
316
- isProcessing: u,
317
- hasSession: a,
569
+ isProcessing: a,
570
+ hasSession: u,
318
571
  error: c
319
572
  };
320
- }, (o, s) => {
321
- s(t.sessionManagementMachineAtom, { type: "Retry" });
573
+ }, (o, r) => {
574
+ r(t.sessionManagementMachineAtom, { type: "Retry" });
322
575
  }), n = f((o) => {
323
- const { hasSession: s, error: r, isProcessing: u } = o(e);
576
+ const { hasSession: r, error: s, isProcessing: a } = o(e);
324
577
  return {
325
- isInitializing: !s && u,
326
- error: !s && r ? r : void 0
578
+ isInitializing: !r && a,
579
+ error: !r && s ? s : void 0
327
580
  };
328
581
  }), i = f((o) => {
329
- const { hasSession: s, error: r, isProcessing: u } = o(e);
582
+ const { hasSession: r, error: s, isProcessing: a } = o(e);
330
583
  return {
331
- isUpdating: s && u,
332
- error: s && r ? r : void 0
584
+ isUpdating: r && a,
585
+ error: r && s ? s : void 0
333
586
  };
334
587
  });
335
588
  return {
@@ -337,79 +590,79 @@ function he(t) {
337
590
  sessionUpdatingAtom: i
338
591
  };
339
592
  }
340
- const pe = () => _(() => f()), be = () => f(), Se = () => f(), ye = () => f(), Ce = () => f();
341
- function xe(t, e) {
342
- const { attributesAtom: n, configurationAtom: i, isSatisfiedAtom: o, canResetAtom: s } = t, { configurationSessionAtom: r } = e;
343
- return ut((u, a) => {
344
- const c = u(r);
593
+ const je = () => W(() => f()), Oe = () => f(), Te = () => f(), _e = () => f(), Le = () => f();
594
+ function Ve(t, e) {
595
+ const { attributesAtom: n, configurationAtom: i, isSatisfiedAtom: o, canResetAtom: r } = t, { configurationSessionAtom: s } = e;
596
+ return gt((a, u) => {
597
+ const c = a(s);
345
598
  if (!c) {
346
- a(i, void 0), a(o, void 0), a(n, void 0), a(s, void 0);
599
+ u(i, void 0), u(o, void 0), u(n, void 0), u(r, void 0);
347
600
  return;
348
601
  }
349
- const m = c.addConfigurationChangedListener((R, F) => {
350
- x.debug("SessionSubscription:", "Received ConfigurationChanged"), a(i, R), F.isSatisfied != null && a(o, F.isSatisfied);
351
- const Z = u.peek(n), V = Z ?? pe();
352
- F.attributes.added.forEach((C) => {
353
- a(V(C.key), C);
354
- }), F.attributes.changed.forEach((C) => {
355
- a(V(C.key), C);
356
- }), F.attributes.removed.forEach((C) => {
357
- a(V(yt(C)), void 0);
358
- }), Z == null && a(n, () => V);
359
- }), Y = c.addCanResetConfigurationChangedListener((R) => {
360
- x.debug("SessionSubscription:", "Received CanResetConfigurationChanged"), a(s, R);
602
+ const l = c.addConfigurationChangedListener((S, F) => {
603
+ E.debug("SessionSubscription:", "Received ConfigurationChanged"), u(i, S), u(o, S.isSatisfied);
604
+ const ot = a.peek(n), N = ot ?? je();
605
+ F.attributes.added.forEach((x) => {
606
+ u(N(x.key), x);
607
+ }), F.attributes.changed.forEach((x) => {
608
+ u(N(x.key), x);
609
+ }), F.attributes.removed.forEach((x) => {
610
+ u(N(T(x)), void 0);
611
+ }), ot == null && u(n, () => N);
612
+ }), p = c.addCanResetConfigurationChangedListener((S) => {
613
+ E.debug("SessionSubscription:", "Received CanResetConfigurationChanged"), u(r, S);
361
614
  });
362
615
  return () => {
363
- m.unsubscribe(), Y.unsubscribe();
616
+ l.unsubscribe(), p.unsubscribe();
364
617
  };
365
618
  });
366
619
  }
367
- function mt(t, e, n) {
620
+ function pt(t, e, n) {
368
621
  const i = f((o) => {
369
- const s = o(t);
370
- if (!s)
622
+ const r = o(t);
623
+ if (!r)
371
624
  return;
372
- const r = f();
373
- return r.onMount = (u) => {
374
- const a = e(s, (...c) => {
375
- u(c);
625
+ const s = f();
626
+ return s.onMount = (a) => {
627
+ const u = e(r, (...c) => {
628
+ a(c);
376
629
  });
377
630
  return () => {
378
- u(void 0), a.unsubscribe();
631
+ a(void 0), u.unsubscribe();
379
632
  };
380
- }, r;
633
+ }, s;
381
634
  });
382
635
  return f((o) => {
383
- const s = o(i);
384
- if (s == null)
636
+ const r = o(i);
637
+ if (r == null)
385
638
  return;
386
- const r = o(s);
387
- if (r != null)
388
- return n(...r);
639
+ const s = o(r);
640
+ if (s != null)
641
+ return n(...s);
389
642
  });
390
643
  }
391
- function ve(t) {
392
- return mt(t, (e, n) => e.addStoredConfigurationChangedListener(n), (e) => e);
644
+ function Ne(t) {
645
+ return pt(t, (e, n) => e.addStoredConfigurationChangedListener(n), (e) => e);
393
646
  }
394
- function we(t) {
395
- return mt(t, (e, n) => e.addDecisionsChangedListener(n), (e) => e);
647
+ function We(t) {
648
+ return pt(t, (e, n) => e.addDecisionsChangedListener(n), (e) => e);
396
649
  }
397
- function Ee(t) {
398
- return mt(t, (e, n) => e.addDecisionsChangedListener(L.Explicit, n), (e) => e);
650
+ function Be(t) {
651
+ return pt(t, (e, n) => e.addDecisionsChangedListener(H.Explicit, n), (e) => e);
399
652
  }
400
- function De(t) {
401
- return mt(t, (e, n) => e.addDecisionsChangedListener(L.Implicit, n), (e) => e);
653
+ function Ke(t) {
654
+ return pt(t, (e, n) => e.addDecisionsChangedListener(H.Implicit, n), (e) => e);
402
655
  }
403
- const Ie = () => ({
404
- sessionManagementMachineAtom: ge(),
405
- configurationAtom: be(),
406
- isSatisfiedAtom: Se(),
407
- canResetAtom: ye(),
408
- attributesAtom: Ce(),
409
- subscriptionsAtom: ue()
656
+ const Qe = () => ({
657
+ sessionManagementMachineAtom: qe(),
658
+ configurationAtom: Oe(),
659
+ isSatisfiedAtom: Te(),
660
+ canResetAtom: _e(),
661
+ attributesAtom: Le(),
662
+ subscriptionsAtom: Re()
410
663
  });
411
- function ke(t, e) {
412
- return D((n, i) => {
664
+ function $e(t, e) {
665
+ return I((n, i) => {
413
666
  const o = i(t);
414
667
  return {
415
668
  canResetConfiguration: i(e),
@@ -417,8 +670,8 @@ function ke(t, e) {
417
670
  };
418
671
  });
419
672
  }
420
- function Re(t) {
421
- return D((e, n) => {
673
+ function Je(t) {
674
+ return I((e, n) => {
422
675
  const i = n(t);
423
676
  return {
424
677
  explain: i.explain.bind(i),
@@ -426,212 +679,212 @@ function Re(t) {
426
679
  };
427
680
  });
428
681
  }
429
- function Fe(t) {
430
- return j(
682
+ function He(t) {
683
+ return O(
431
684
  t.values,
432
- H.values(kt.trivial),
433
- k.filter((e) => {
685
+ et.values(zt.trivial),
686
+ M.filter((e) => {
434
687
  var n;
435
- return ((n = e.decision) == null ? void 0 : n.kind) === L.Explicit;
688
+ return ((n = e.decision) == null ? void 0 : n.kind) === H.Explicit;
436
689
  }),
437
- k.map((e) => ({
438
- type: J.Choice,
690
+ M.map((e) => ({
691
+ type: tt.Choice,
439
692
  attributeId: t.id,
440
693
  choiceValueId: e.id,
441
694
  state: null
442
695
  }))
443
696
  );
444
697
  }
445
- const p = Symbol.for("@ts-pattern/matcher"), jt = Symbol.for("@ts-pattern/isVariadic"), it = "@ts-pattern/anonymous-select-key", pt = (t) => !!(t && typeof t == "object"), tt = (t) => t && !!t[p], A = (t, e, n) => {
446
- if (tt(t)) {
447
- const i = t[p](), { matched: o, selections: s } = i.match(e);
448
- return o && s && Object.keys(s).forEach((r) => n(r, s[r])), o;
698
+ const b = Symbol.for("@ts-pattern/matcher"), Kt = Symbol.for("@ts-pattern/isVariadic"), lt = "@ts-pattern/anonymous-select-key", xt = (t) => !!(t && typeof t == "object"), rt = (t) => t && !!t[b], g = (t, e, n) => {
699
+ if (rt(t)) {
700
+ const i = t[b](), { matched: o, selections: r } = i.match(e);
701
+ return o && r && Object.keys(r).forEach((s) => n(s, r[s])), o;
449
702
  }
450
- if (pt(t)) {
451
- if (!pt(e)) return !1;
703
+ if (xt(t)) {
704
+ if (!xt(e)) return !1;
452
705
  if (Array.isArray(t)) {
453
706
  if (!Array.isArray(e)) return !1;
454
- let i = [], o = [], s = [];
455
- for (const r of t.keys()) {
456
- const u = t[r];
457
- tt(u) && u[jt] ? s.push(u) : s.length ? o.push(u) : i.push(u);
707
+ let i = [], o = [], r = [];
708
+ for (const s of t.keys()) {
709
+ const a = t[s];
710
+ rt(a) && a[Kt] ? r.push(a) : r.length ? o.push(a) : i.push(a);
458
711
  }
459
- if (s.length) {
460
- if (s.length > 1) throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");
712
+ if (r.length) {
713
+ if (r.length > 1) throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");
461
714
  if (e.length < i.length + o.length) return !1;
462
- const r = e.slice(0, i.length), u = o.length === 0 ? [] : e.slice(-o.length), a = e.slice(i.length, o.length === 0 ? 1 / 0 : -o.length);
463
- return i.every((c, m) => A(c, r[m], n)) && o.every((c, m) => A(c, u[m], n)) && (s.length === 0 || A(s[0], a, n));
715
+ const s = e.slice(0, i.length), a = o.length === 0 ? [] : e.slice(-o.length), u = e.slice(i.length, o.length === 0 ? 1 / 0 : -o.length);
716
+ return i.every((c, l) => g(c, s[l], n)) && o.every((c, l) => g(c, a[l], n)) && (r.length === 0 || g(r[0], u, n));
464
717
  }
465
- return t.length === e.length && t.every((r, u) => A(r, e[u], n));
718
+ return t.length === e.length && t.every((s, a) => g(s, e[a], n));
466
719
  }
467
720
  return Reflect.ownKeys(t).every((i) => {
468
721
  const o = t[i];
469
- return (i in e || tt(s = o) && s[p]().matcherType === "optional") && A(o, e[i], n);
470
- var s;
722
+ return (i in e || rt(r = o) && r[b]().matcherType === "optional") && g(o, e[i], n);
723
+ var r;
471
724
  });
472
725
  }
473
726
  return Object.is(e, t);
474
- }, S = (t) => {
727
+ }, C = (t) => {
475
728
  var e, n, i;
476
- return pt(t) ? tt(t) ? (e = (n = (i = t[p]()).getSelectionKeys) == null ? void 0 : n.call(i)) != null ? e : [] : Array.isArray(t) ? Q(t, S) : Q(Object.values(t), S) : [];
477
- }, Q = (t, e) => t.reduce((n, i) => n.concat(e(i)), []);
478
- function Me(...t) {
729
+ return xt(t) ? rt(t) ? (e = (n = (i = t[b]()).getSelectionKeys) == null ? void 0 : n.call(i)) != null ? e : [] : Array.isArray(t) ? Z(t, C) : Z(Object.values(t), C) : [];
730
+ }, Z = (t, e) => t.reduce((n, i) => n.concat(e(i)), []);
731
+ function Xe(...t) {
479
732
  if (t.length === 1) {
480
733
  const [e] = t;
481
- return (n) => A(e, n, () => {
734
+ return (n) => g(e, n, () => {
482
735
  });
483
736
  }
484
737
  if (t.length === 2) {
485
738
  const [e, n] = t;
486
- return A(e, n, () => {
739
+ return g(e, n, () => {
487
740
  });
488
741
  }
489
742
  throw new Error(`isMatching wasn't given the right number of arguments: expected 1 or 2, received ${t.length}.`);
490
743
  }
491
- function h(t) {
492
- return Object.assign(t, { optional: () => wt(t), and: (e) => d(t, e), or: (e) => Tt(t, e), select: (e) => e === void 0 ? $(t) : $(e, t) });
744
+ function A(t) {
745
+ return Object.assign(t, { optional: () => Ft(t), and: (e) => m(t, e), or: (e) => Qt(t, e), select: (e) => e === void 0 ? G(t) : G(e, t) });
493
746
  }
494
- function bt(t) {
747
+ function wt(t) {
495
748
  return Object.assign(((e) => Object.assign(e, { [Symbol.iterator]() {
496
749
  let n = 0;
497
- const i = [{ value: Object.assign(e, { [jt]: !0 }), done: !1 }, { done: !0, value: void 0 }];
750
+ const i = [{ value: Object.assign(e, { [Kt]: !0 }), done: !1 }, { done: !0, value: void 0 }];
498
751
  return { next: () => {
499
752
  var o;
500
753
  return (o = i[n++]) != null ? o : i.at(-1);
501
754
  } };
502
- } }))(t), { optional: () => bt(wt(t)), select: (e) => bt(e === void 0 ? $(t) : $(e, t)) });
755
+ } }))(t), { optional: () => wt(Ft(t)), select: (e) => wt(e === void 0 ? G(t) : G(e, t)) });
503
756
  }
504
- function wt(t) {
505
- return h({ [p]: () => ({ match: (e) => {
757
+ function Ft(t) {
758
+ return A({ [b]: () => ({ match: (e) => {
506
759
  let n = {};
507
- const i = (o, s) => {
508
- n[o] = s;
760
+ const i = (o, r) => {
761
+ n[o] = r;
509
762
  };
510
- return e === void 0 ? (S(t).forEach((o) => i(o, void 0)), { matched: !0, selections: n }) : { matched: A(t, e, i), selections: n };
511
- }, getSelectionKeys: () => S(t), matcherType: "optional" }) });
763
+ return e === void 0 ? (C(t).forEach((o) => i(o, void 0)), { matched: !0, selections: n }) : { matched: g(t, e, i), selections: n };
764
+ }, getSelectionKeys: () => C(t), matcherType: "optional" }) });
512
765
  }
513
- const ze = (t, e) => {
766
+ const Ye = (t, e) => {
514
767
  for (const n of t) if (!e(n)) return !1;
515
768
  return !0;
516
- }, Pe = (t, e) => {
769
+ }, Ze = (t, e) => {
517
770
  for (const [n, i] of t.entries()) if (!e(i, n)) return !1;
518
771
  return !0;
519
772
  };
520
- function d(...t) {
521
- return h({ [p]: () => ({ match: (e) => {
773
+ function m(...t) {
774
+ return A({ [b]: () => ({ match: (e) => {
522
775
  let n = {};
523
- const i = (o, s) => {
524
- n[o] = s;
776
+ const i = (o, r) => {
777
+ n[o] = r;
525
778
  };
526
- return { matched: t.every((o) => A(o, e, i)), selections: n };
527
- }, getSelectionKeys: () => Q(t, S), matcherType: "and" }) });
779
+ return { matched: t.every((o) => g(o, e, i)), selections: n };
780
+ }, getSelectionKeys: () => Z(t, C), matcherType: "and" }) });
528
781
  }
529
- function Tt(...t) {
530
- return h({ [p]: () => ({ match: (e) => {
782
+ function Qt(...t) {
783
+ return A({ [b]: () => ({ match: (e) => {
531
784
  let n = {};
532
- const i = (o, s) => {
533
- n[o] = s;
785
+ const i = (o, r) => {
786
+ n[o] = r;
534
787
  };
535
- return Q(t, S).forEach((o) => i(o, void 0)), { matched: t.some((o) => A(o, e, i)), selections: n };
536
- }, getSelectionKeys: () => Q(t, S), matcherType: "or" }) });
788
+ return Z(t, C).forEach((o) => i(o, void 0)), { matched: t.some((o) => g(o, e, i)), selections: n };
789
+ }, getSelectionKeys: () => Z(t, C), matcherType: "or" }) });
537
790
  }
538
- function l(t) {
539
- return { [p]: () => ({ match: (e) => ({ matched: !!t(e) }) }) };
791
+ function d(t) {
792
+ return { [b]: () => ({ match: (e) => ({ matched: !!t(e) }) }) };
540
793
  }
541
- function $(...t) {
794
+ function G(...t) {
542
795
  const e = typeof t[0] == "string" ? t[0] : void 0, n = t.length === 2 ? t[1] : typeof t[0] == "string" ? void 0 : t[0];
543
- return h({ [p]: () => ({ match: (i) => {
544
- let o = { [e ?? it]: i };
545
- return { matched: n === void 0 || A(n, i, (s, r) => {
546
- o[s] = r;
796
+ return A({ [b]: () => ({ match: (i) => {
797
+ let o = { [e ?? lt]: i };
798
+ return { matched: n === void 0 || g(n, i, (r, s) => {
799
+ o[r] = s;
547
800
  }), selections: o };
548
- }, getSelectionKeys: () => [e ?? it].concat(n === void 0 ? [] : S(n)) }) });
801
+ }, getSelectionKeys: () => [e ?? lt].concat(n === void 0 ? [] : C(n)) }) });
549
802
  }
550
- function v(t) {
803
+ function R(t) {
551
804
  return typeof t == "number";
552
805
  }
553
- function M(t) {
806
+ function q(t) {
554
807
  return typeof t == "string";
555
808
  }
556
809
  function z(t) {
557
810
  return typeof t == "bigint";
558
811
  }
559
- const Vt = h(l(function(t) {
812
+ const $t = A(d(function(t) {
560
813
  return !0;
561
- })), Ue = Vt, P = (t) => Object.assign(h(t), { startsWith: (e) => {
562
- return P(d(t, (n = e, l((i) => M(i) && i.startsWith(n)))));
814
+ })), Ge = $t, U = (t) => Object.assign(A(t), { startsWith: (e) => {
815
+ return U(m(t, (n = e, d((i) => q(i) && i.startsWith(n)))));
563
816
  var n;
564
817
  }, endsWith: (e) => {
565
- return P(d(t, (n = e, l((i) => M(i) && i.endsWith(n)))));
818
+ return U(m(t, (n = e, d((i) => q(i) && i.endsWith(n)))));
566
819
  var n;
567
- }, minLength: (e) => P(d(t, ((n) => l((i) => M(i) && i.length >= n))(e))), length: (e) => P(d(t, ((n) => l((i) => M(i) && i.length === n))(e))), maxLength: (e) => P(d(t, ((n) => l((i) => M(i) && i.length <= n))(e))), includes: (e) => {
568
- return P(d(t, (n = e, l((i) => M(i) && i.includes(n)))));
820
+ }, minLength: (e) => U(m(t, ((n) => d((i) => q(i) && i.length >= n))(e))), length: (e) => U(m(t, ((n) => d((i) => q(i) && i.length === n))(e))), maxLength: (e) => U(m(t, ((n) => d((i) => q(i) && i.length <= n))(e))), includes: (e) => {
821
+ return U(m(t, (n = e, d((i) => q(i) && i.includes(n)))));
569
822
  var n;
570
823
  }, regex: (e) => {
571
- return P(d(t, (n = e, l((i) => M(i) && !!i.match(n)))));
824
+ return U(m(t, (n = e, d((i) => q(i) && !!i.match(n)))));
572
825
  var n;
573
- } }), qe = P(l(M)), w = (t) => Object.assign(h(t), { between: (e, n) => w(d(t, ((i, o) => l((s) => v(s) && i <= s && o >= s))(e, n))), lt: (e) => w(d(t, ((n) => l((i) => v(i) && i < n))(e))), gt: (e) => w(d(t, ((n) => l((i) => v(i) && i > n))(e))), lte: (e) => w(d(t, ((n) => l((i) => v(i) && i <= n))(e))), gte: (e) => w(d(t, ((n) => l((i) => v(i) && i >= n))(e))), int: () => w(d(t, l((e) => v(e) && Number.isInteger(e)))), finite: () => w(d(t, l((e) => v(e) && Number.isFinite(e)))), positive: () => w(d(t, l((e) => v(e) && e > 0))), negative: () => w(d(t, l((e) => v(e) && e < 0))) }), je = w(l(v)), U = (t) => Object.assign(h(t), { between: (e, n) => U(d(t, ((i, o) => l((s) => z(s) && i <= s && o >= s))(e, n))), lt: (e) => U(d(t, ((n) => l((i) => z(i) && i < n))(e))), gt: (e) => U(d(t, ((n) => l((i) => z(i) && i > n))(e))), lte: (e) => U(d(t, ((n) => l((i) => z(i) && i <= n))(e))), gte: (e) => U(d(t, ((n) => l((i) => z(i) && i >= n))(e))), positive: () => U(d(t, l((e) => z(e) && e > 0))), negative: () => U(d(t, l((e) => z(e) && e < 0))) }), Te = U(l(z)), Ve = h(l(function(t) {
826
+ } }), tn = U(d(q)), k = (t) => Object.assign(A(t), { between: (e, n) => k(m(t, ((i, o) => d((r) => R(r) && i <= r && o >= r))(e, n))), lt: (e) => k(m(t, ((n) => d((i) => R(i) && i < n))(e))), gt: (e) => k(m(t, ((n) => d((i) => R(i) && i > n))(e))), lte: (e) => k(m(t, ((n) => d((i) => R(i) && i <= n))(e))), gte: (e) => k(m(t, ((n) => d((i) => R(i) && i >= n))(e))), int: () => k(m(t, d((e) => R(e) && Number.isInteger(e)))), finite: () => k(m(t, d((e) => R(e) && Number.isFinite(e)))), positive: () => k(m(t, d((e) => R(e) && e > 0))), negative: () => k(m(t, d((e) => R(e) && e < 0))) }), en = k(d(R)), j = (t) => Object.assign(A(t), { between: (e, n) => j(m(t, ((i, o) => d((r) => z(r) && i <= r && o >= r))(e, n))), lt: (e) => j(m(t, ((n) => d((i) => z(i) && i < n))(e))), gt: (e) => j(m(t, ((n) => d((i) => z(i) && i > n))(e))), lte: (e) => j(m(t, ((n) => d((i) => z(i) && i <= n))(e))), gte: (e) => j(m(t, ((n) => d((i) => z(i) && i >= n))(e))), positive: () => j(m(t, d((e) => z(e) && e > 0))), negative: () => j(m(t, d((e) => z(e) && e < 0))) }), nn = j(d(z)), on = A(d(function(t) {
574
827
  return typeof t == "boolean";
575
- })), _e = h(l(function(t) {
828
+ })), sn = A(d(function(t) {
576
829
  return typeof t == "symbol";
577
- })), Ne = h(l(function(t) {
830
+ })), rn = A(d(function(t) {
578
831
  return t == null;
579
- })), We = h(l(function(t) {
832
+ })), an = A(d(function(t) {
580
833
  return t != null;
581
834
  }));
582
- var Oe = { __proto__: null, matcher: p, optional: wt, array: function(...t) {
583
- return bt({ [p]: () => ({ match: (e) => {
835
+ var un = { __proto__: null, matcher: b, optional: Ft, array: function(...t) {
836
+ return wt({ [b]: () => ({ match: (e) => {
584
837
  if (!Array.isArray(e)) return { matched: !1 };
585
838
  if (t.length === 0) return { matched: !0 };
586
839
  const n = t[0];
587
840
  let i = {};
588
- if (e.length === 0) return S(n).forEach((s) => {
589
- i[s] = [];
841
+ if (e.length === 0) return C(n).forEach((r) => {
842
+ i[r] = [];
590
843
  }), { matched: !0, selections: i };
591
- const o = (s, r) => {
592
- i[s] = (i[s] || []).concat([r]);
844
+ const o = (r, s) => {
845
+ i[r] = (i[r] || []).concat([s]);
593
846
  };
594
- return { matched: e.every((s) => A(n, s, o)), selections: i };
595
- }, getSelectionKeys: () => t.length === 0 ? [] : S(t[0]) }) });
847
+ return { matched: e.every((r) => g(n, r, o)), selections: i };
848
+ }, getSelectionKeys: () => t.length === 0 ? [] : C(t[0]) }) });
596
849
  }, set: function(...t) {
597
- return h({ [p]: () => ({ match: (e) => {
850
+ return A({ [b]: () => ({ match: (e) => {
598
851
  if (!(e instanceof Set)) return { matched: !1 };
599
852
  let n = {};
600
853
  if (e.size === 0) return { matched: !0, selections: n };
601
854
  if (t.length === 0) return { matched: !0 };
602
- const i = (s, r) => {
603
- n[s] = (n[s] || []).concat([r]);
855
+ const i = (r, s) => {
856
+ n[r] = (n[r] || []).concat([s]);
604
857
  }, o = t[0];
605
- return { matched: ze(e, (s) => A(o, s, i)), selections: n };
606
- }, getSelectionKeys: () => t.length === 0 ? [] : S(t[0]) }) });
858
+ return { matched: Ye(e, (r) => g(o, r, i)), selections: n };
859
+ }, getSelectionKeys: () => t.length === 0 ? [] : C(t[0]) }) });
607
860
  }, map: function(...t) {
608
- return h({ [p]: () => ({ match: (e) => {
861
+ return A({ [b]: () => ({ match: (e) => {
609
862
  if (!(e instanceof Map)) return { matched: !1 };
610
863
  let n = {};
611
864
  if (e.size === 0) return { matched: !0, selections: n };
612
- const i = (u, a) => {
613
- n[u] = (n[u] || []).concat([a]);
865
+ const i = (a, u) => {
866
+ n[a] = (n[a] || []).concat([u]);
614
867
  };
615
868
  if (t.length === 0) return { matched: !0 };
616
869
  var o;
617
870
  if (t.length === 1) throw new Error(`\`P.map\` wasn't given enough arguments. Expected (key, value), received ${(o = t[0]) == null ? void 0 : o.toString()}`);
618
- const [s, r] = t;
619
- return { matched: Pe(e, (u, a) => {
620
- const c = A(s, a, i), m = A(r, u, i);
621
- return c && m;
871
+ const [r, s] = t;
872
+ return { matched: Ze(e, (a, u) => {
873
+ const c = g(r, u, i), l = g(s, a, i);
874
+ return c && l;
622
875
  }), selections: n };
623
- }, getSelectionKeys: () => t.length === 0 ? [] : [...S(t[0]), ...S(t[1])] }) });
624
- }, intersection: d, union: Tt, not: function(t) {
625
- return h({ [p]: () => ({ match: (e) => ({ matched: !A(t, e, () => {
876
+ }, getSelectionKeys: () => t.length === 0 ? [] : [...C(t[0]), ...C(t[1])] }) });
877
+ }, intersection: m, union: Qt, not: function(t) {
878
+ return A({ [b]: () => ({ match: (e) => ({ matched: !g(t, e, () => {
626
879
  }) }), getSelectionKeys: () => [], matcherType: "not" }) });
627
- }, when: l, select: $, any: Vt, _: Ue, string: qe, number: je, bigint: Te, boolean: Ve, symbol: _e, nullish: Ne, nonNullable: We, instanceOf: function(t) {
628
- return h(l(/* @__PURE__ */ function(e) {
880
+ }, when: d, select: G, any: $t, _: Ge, string: tn, number: en, bigint: nn, boolean: on, symbol: sn, nullish: rn, nonNullable: an, instanceOf: function(t) {
881
+ return A(d(/* @__PURE__ */ function(e) {
629
882
  return (n) => n instanceof e;
630
883
  }(t)));
631
884
  }, shape: function(t) {
632
- return h(l(Me(t)));
885
+ return A(d(Xe(t)));
633
886
  } };
634
- class Be extends Error {
887
+ class cn extends Error {
635
888
  constructor(e) {
636
889
  let n;
637
890
  try {
@@ -642,11 +895,11 @@ class Be extends Error {
642
895
  super(`Pattern matching error: no pattern matches value ${n}`), this.input = void 0, this.input = e;
643
896
  }
644
897
  }
645
- const St = { matched: !1, value: void 0 };
646
- function ot(t) {
647
- return new st(t, St);
898
+ const Et = { matched: !1, value: void 0 };
899
+ function dt(t) {
900
+ return new mt(t, Et);
648
901
  }
649
- class st {
902
+ class mt {
650
903
  constructor(e, n) {
651
904
  this.input = void 0, this.state = void 0, this.input = e, this.state = n;
652
905
  }
@@ -655,23 +908,23 @@ class st {
655
908
  const n = e[e.length - 1], i = [e[0]];
656
909
  let o;
657
910
  e.length === 3 && typeof e[1] == "function" ? o = e[1] : e.length > 2 && i.push(...e.slice(1, e.length - 1));
658
- let s = !1, r = {};
659
- const u = (c, m) => {
660
- s = !0, r[c] = m;
661
- }, a = !i.some((c) => A(c, this.input, u)) || o && !o(this.input) ? St : { matched: !0, value: n(s ? it in r ? r[it] : r : this.input, this.input) };
662
- return new st(this.input, a);
911
+ let r = !1, s = {};
912
+ const a = (c, l) => {
913
+ r = !0, s[c] = l;
914
+ }, u = !i.some((c) => g(c, this.input, a)) || o && !o(this.input) ? Et : { matched: !0, value: n(r ? lt in s ? s[lt] : s : this.input, this.input) };
915
+ return new mt(this.input, u);
663
916
  }
664
917
  when(e, n) {
665
918
  if (this.state.matched) return this;
666
919
  const i = !!e(this.input);
667
- return new st(this.input, i ? { matched: !0, value: n(this.input, this.input) } : St);
920
+ return new mt(this.input, i ? { matched: !0, value: n(this.input, this.input) } : Et);
668
921
  }
669
922
  otherwise(e) {
670
923
  return this.state.matched ? this.state.value : e(this.input);
671
924
  }
672
925
  exhaustive() {
673
926
  if (this.state.matched) return this.state.value;
674
- throw new Be(this.input);
927
+ throw new cn(this.input);
675
928
  }
676
929
  run() {
677
930
  return this.exhaustive();
@@ -680,184 +933,184 @@ class st {
680
933
  return this;
681
934
  }
682
935
  }
683
- function T(t, e) {
936
+ function L(t, e) {
684
937
  var n = 0, i, o;
685
938
  e = e || {};
686
- function s() {
687
- var r = i, u = arguments.length, a, c;
688
- t: for (; r; ) {
689
- if (r.args.length !== arguments.length) {
690
- r = r.next;
939
+ function r() {
940
+ var s = i, a = arguments.length, u, c;
941
+ t: for (; s; ) {
942
+ if (s.args.length !== arguments.length) {
943
+ s = s.next;
691
944
  continue;
692
945
  }
693
- for (c = 0; c < u; c++)
694
- if (r.args[c] !== arguments[c]) {
695
- r = r.next;
946
+ for (c = 0; c < a; c++)
947
+ if (s.args[c] !== arguments[c]) {
948
+ s = s.next;
696
949
  continue t;
697
950
  }
698
- return r !== i && (r === o && (o = r.prev), r.prev.next = r.next, r.next && (r.next.prev = r.prev), r.next = i, r.prev = null, i.prev = r, i = r), r.val;
951
+ return s !== i && (s === o && (o = s.prev), s.prev.next = s.next, s.next && (s.next.prev = s.prev), s.next = i, s.prev = null, i.prev = s, i = s), s.val;
699
952
  }
700
- for (a = new Array(u), c = 0; c < u; c++)
701
- a[c] = arguments[c];
702
- return r = {
703
- args: a,
953
+ for (u = new Array(a), c = 0; c < a; c++)
954
+ u[c] = arguments[c];
955
+ return s = {
956
+ args: u,
704
957
  // Generate the result from original function
705
- val: t.apply(null, a)
706
- }, i ? (i.prev = r, r.next = i) : o = r, n === /** @type {MemizeOptions} */
958
+ val: t.apply(null, u)
959
+ }, i ? (i.prev = s, s.next = i) : o = s, n === /** @type {MemizeOptions} */
707
960
  e.maxSize ? (o = /** @type {MemizeCacheNode} */
708
- o.prev, o.next = null) : n++, i = r, r.val;
961
+ o.prev, o.next = null) : n++, i = s, s.val;
709
962
  }
710
- return s.clear = function() {
963
+ return r.clear = function() {
711
964
  i = null, o = null, n = 0;
712
- }, s;
965
+ }, r;
713
966
  }
714
- function Le(t, e, n) {
715
- return dt(
967
+ function ln(t, e, n) {
968
+ return bt(
716
969
  t,
717
970
  n,
718
- rt.choiceAttributeRefinement,
719
- N.choiceValue,
720
- (i, o, s) => {
721
- const { makeDecision: r, makeManyDecisions: u } = s(e);
971
+ ft.choiceAttributeRefinement,
972
+ K.choiceValue,
973
+ (i, o, r) => {
974
+ const { makeDecision: s, makeManyDecisions: a } = r(e);
722
975
  return {
723
- makeDecision: (a, c) => r({
724
- type: J.Choice,
976
+ makeDecision: (u, c) => s({
977
+ type: tt.Choice,
725
978
  attributeId: i.id,
726
- choiceValueId: a,
979
+ choiceValueId: u,
727
980
  state: c
728
981
  }),
729
- clearDecisions: () => j(
982
+ clearDecisions: () => O(
730
983
  i,
731
- Fe,
984
+ He,
732
985
  // Only execute if there are decisions to clear.
733
- K.fromPredicate(k.isNonEmpty),
734
- K.match(
986
+ X.fromPredicate(M.isNonEmpty),
987
+ X.match(
735
988
  () => () => Promise.resolve(),
736
- (a) => j(() => u(a, { type: "KeepExistingDecisions" }), Lt.map(Kt))
989
+ (u) => O(() => a(u, { type: "KeepExistingDecisions" }), Gt.map(te))
737
990
  )
738
991
  )(),
739
- isMultiSelect: T(() => B.isChoiceAttributeMultiSelect(i)),
740
- getAllowedChoiceValues: T(() => B.getAllowedChoiceValues(i)),
741
- getIncludedChoiceValues: T(() => B.getIncludedChoiceValues(i)),
742
- getBlockedChoiceValues: T(() => B.getBlockedChoiceValues(i)),
743
- isChoiceValueAllowed: T((a) => Et.isAllowed(a)),
744
- isChoiceValueBlocked: T((a) => Et.isBlocked(a))
992
+ isMultiSelect: L(() => J.isChoiceAttributeMultiSelect(i)),
993
+ getAllowedChoiceValues: L(() => J.getAllowedChoiceValues(i)),
994
+ getIncludedChoiceValues: L(() => J.getIncludedChoiceValues(i)),
995
+ getBlockedChoiceValues: L(() => J.getBlockedChoiceValues(i)),
996
+ isChoiceValueAllowed: L((u) => Mt.isAllowed(u)),
997
+ isChoiceValueBlocked: L((u) => Mt.isBlocked(u))
745
998
  };
746
999
  }
747
1000
  );
748
1001
  }
749
- function Ke(t, e, n) {
750
- return dt(
1002
+ function dn(t, e, n) {
1003
+ return bt(
751
1004
  t,
752
1005
  n,
753
- rt.numericAttributeRefinement,
754
- N.numeric,
755
- (i, o, s) => {
756
- const { makeDecision: r } = s(e);
1006
+ ft.numericAttributeRefinement,
1007
+ K.numeric,
1008
+ (i, o, r) => {
1009
+ const { makeDecision: s } = r(e);
757
1010
  return {
758
- makeDecision: (u) => r({
759
- type: J.Numeric,
1011
+ makeDecision: (a) => s({
1012
+ type: tt.Numeric,
760
1013
  attributeId: i.id,
761
- state: u
1014
+ state: a
762
1015
  })
763
1016
  };
764
1017
  }
765
1018
  );
766
1019
  }
767
- function Qe(t, e, n) {
768
- return dt(
1020
+ function mn(t, e, n) {
1021
+ return bt(
769
1022
  t,
770
1023
  n,
771
- rt.booleanAttributeRefinement,
772
- N.boolean,
773
- (i, o, s) => {
774
- const { makeDecision: r } = s(e);
1024
+ ft.booleanAttributeRefinement,
1025
+ K.boolean,
1026
+ (i, o, r) => {
1027
+ const { makeDecision: s } = r(e);
775
1028
  return {
776
- makeDecision: (u) => r({
777
- type: J.Boolean,
1029
+ makeDecision: (a) => s({
1030
+ type: tt.Boolean,
778
1031
  attributeId: i.id,
779
- state: u
1032
+ state: a
780
1033
  })
781
1034
  };
782
1035
  }
783
1036
  );
784
1037
  }
785
- function $e(t, e, n) {
786
- return dt(
1038
+ function fn(t, e, n) {
1039
+ return bt(
787
1040
  t,
788
1041
  n,
789
- rt.componentAttributeRefinement,
790
- N.component,
791
- (i, o, s) => {
792
- const { makeDecision: r } = s(e);
1042
+ ft.componentAttributeRefinement,
1043
+ K.component,
1044
+ (i, o, r) => {
1045
+ const { makeDecision: s } = r(e);
793
1046
  return {
794
- makeDecision: (u) => r({
795
- type: J.Component,
1047
+ makeDecision: (a) => s({
1048
+ type: tt.Component,
796
1049
  attributeId: i.id,
797
- state: u
1050
+ state: a
798
1051
  })
799
1052
  };
800
1053
  }
801
1054
  );
802
1055
  }
803
- function dt(t, e, n, i, o) {
804
- return _((s) => D((r, u) => {
805
- const a = u(t), c = r(a(s));
1056
+ function bt(t, e, n, i, o) {
1057
+ return W((r) => I((s, a) => {
1058
+ const u = a(t), c = s(u(r));
806
1059
  if (!c || !n(c))
807
1060
  return;
808
- const { explain: m, applySolution: Y } = u(e), R = o(c, r, u);
809
- return R === E ? E : {
1061
+ const { explain: l, applySolution: p } = a(e), S = o(c, s, a);
1062
+ return S === D ? D : {
810
1063
  attribute: c,
811
- isMandatory: T(() => B.isMandatory(c)),
812
- explain: (F, Z) => {
813
- const V = ot(F.question).with(It.whyIsNotSatisfied, () => N.attribute).otherwise(() => i), C = {
1064
+ isMandatory: L(() => J.isMandatory(c)),
1065
+ explain: (F, ot) => {
1066
+ const N = dt(F.question).with(qt.whyIsNotSatisfied, () => K.attribute).otherwise(() => i), x = {
814
1067
  ...F,
815
- subject: V,
1068
+ subject: N,
816
1069
  attributeId: c.id
817
1070
  };
818
- return ot(Z).with("decisions", (O) => m(C, O)).with("constraints", (O) => m(C, O)).with("full", (O) => m(C, O)).exhaustive();
1071
+ return dt(ot).with("decisions", ($) => l(x, $)).with("constraints", ($) => l(x, $)).with("full", ($) => l(x, $)).exhaustive();
819
1072
  },
820
- applySolution: Y,
821
- ...R
1073
+ applySolution: p,
1074
+ ...S
822
1075
  };
823
1076
  }));
824
1077
  }
825
- function _t(t, e) {
826
- const n = zt(t, et, e.equals);
827
- return "write" in t ? f((i) => i(n), (i, o, ...s) => o(t, ...s)) : n;
1078
+ function Jt(t, e) {
1079
+ const n = Ot(t, at, e.equals);
1080
+ return "write" in t ? f((i) => i(n), (i, o, ...r) => o(t, ...r)) : n;
828
1081
  }
829
- const Je = b.struct({
830
- isInitializing: at.Eq,
831
- error: b.eqNullable(b.eqStrict)
1082
+ const hn = y.struct({
1083
+ isInitializing: Dt.Eq,
1084
+ error: y.eqNullable(y.eqStrict)
832
1085
  });
833
- function He(t, e, n, i, o, s) {
834
- const r = [
1086
+ function gn(t, e, n, i, o, r) {
1087
+ const s = [
835
1088
  e,
836
1089
  n,
837
1090
  i,
838
1091
  o,
839
- s
840
- ], u = f((a) => {
841
- const c = j(
842
- r,
843
- k.every((R) => a(R) !== E)
844
- ), m = a(t);
1092
+ r
1093
+ ], a = f((u) => {
1094
+ const c = O(
1095
+ s,
1096
+ M.every((S) => u(S) !== D)
1097
+ ), l = u(t);
845
1098
  return {
846
- isInitializing: !(!m.isInitializing && c),
847
- error: m.error
1099
+ isInitializing: !(!l.isInitializing && c),
1100
+ error: l.error
848
1101
  };
849
1102
  });
850
- return _t(u, Je);
1103
+ return Jt(a, hn);
851
1104
  }
852
- const Xe = b.struct({
853
- isUpdating: at.Eq,
854
- error: b.eqNullable(b.eqStrict)
1105
+ const An = y.struct({
1106
+ isUpdating: Dt.Eq,
1107
+ error: y.eqNullable(y.eqStrict)
855
1108
  });
856
- function Ye(t) {
857
- return _t(t, Xe);
1109
+ function pn(t) {
1110
+ return Jt(t, An);
858
1111
  }
859
- function Ze(t) {
860
- return D((e, n) => {
1112
+ function bn(t) {
1113
+ return I((e, n) => {
861
1114
  const i = n(t);
862
1115
  return {
863
1116
  storeConfiguration: i.storeConfiguration.bind(i),
@@ -865,45 +1118,45 @@ function Ze(t) {
865
1118
  };
866
1119
  });
867
1120
  }
868
- function Ge(t, e) {
1121
+ function yn(t, e) {
869
1122
  const n = {
870
- question: It.whyIsNotSatisfied,
871
- subject: N.configuration
1123
+ question: qt.whyIsNotSatisfied,
1124
+ subject: K.configuration
872
1125
  };
873
- return D((i, o) => {
874
- const s = o(t);
1126
+ return I((i, o) => {
1127
+ const r = o(t);
875
1128
  return {
876
1129
  isSatisfied: o(e),
877
- explain: (u) => ot(u).with("full", (a) => s.explain(n, a)).with("decisions", (a) => s.explain(n, a)).with("constraints", (a) => s.explain(n, a)).exhaustive()
1130
+ explain: (a) => dt(a).with("full", (u) => r.explain(n, u)).with("decisions", (u) => r.explain(n, u)).with("constraints", (u) => r.explain(n, u)).exhaustive()
878
1131
  };
879
1132
  });
880
1133
  }
881
- function tn(t) {
882
- return D((e, n) => {
1134
+ function Sn(t) {
1135
+ return I((e, n) => {
883
1136
  const i = n(t);
884
1137
  return {
885
1138
  reinitializeSession: i.reinitialize.bind(i)
886
1139
  };
887
1140
  });
888
1141
  }
889
- function en(t) {
890
- return D((e, n) => {
1142
+ function Cn(t) {
1143
+ return I((e, n) => {
891
1144
  const i = n(t);
892
1145
  return {
893
1146
  scheduleTask: i.scheduleTask.bind(i)
894
1147
  };
895
1148
  });
896
1149
  }
897
- function nn(t) {
898
- return D((e, n) => {
1150
+ function vn(t) {
1151
+ return I((e, n) => {
899
1152
  const i = n(t);
900
1153
  return {
901
1154
  getDecisions: i.getDecisions.bind(i)
902
1155
  };
903
1156
  });
904
1157
  }
905
- function on(t) {
906
- return D((e, n) => {
1158
+ function xn(t) {
1159
+ return I((e, n) => {
907
1160
  const i = n(t);
908
1161
  return {
909
1162
  makeDecision: i.makeDecision.bind(i),
@@ -911,45 +1164,48 @@ function on(t) {
911
1164
  };
912
1165
  });
913
1166
  }
914
- function I(t) {
915
- return f((e) => e(t) ?? E);
916
- }
917
- function sn(t) {
918
- const { sessionInitializationAtom: e, sessionUpdatingAtom: n } = he(t), i = Ae(t), o = {
919
- guardedConfigurationSessionAtom: I(i),
920
- guardedConfigurationAtom: I(t.configurationAtom),
921
- guardedIsSatisfiedAtom: I(t.isSatisfiedAtom),
922
- guardedCanResetAtom: I(t.canResetAtom),
923
- guardedAttributesAtom: I(t.attributesAtom),
924
- guardedStoredConfigurationAtom: I(ve(i)),
925
- guardedDecisionsAtom: I(we(i)),
926
- guardedExplicitDecisionsAtom: I(Ee(i)),
927
- guardedImplicitDecisionsAtom: I(De(i))
928
- }, s = on(o.guardedConfigurationSessionAtom), r = Re(o.guardedConfigurationSessionAtom);
1167
+ function P(t) {
1168
+ return f((e) => e(t) ?? D);
1169
+ }
1170
+ function wn(t) {
1171
+ const { sessionInitializationAtom: e, sessionUpdatingAtom: n } = Ue(t), i = ze(t), o = {
1172
+ guardedConfigurationSessionAtom: P(i),
1173
+ guardedConfigurationAtom: P(t.configurationAtom),
1174
+ guardedIsSatisfiedAtom: f((a) => {
1175
+ const u = a(t.isSatisfiedAtom);
1176
+ return u === void 0 ? D : u;
1177
+ }),
1178
+ guardedCanResetAtom: P(t.canResetAtom),
1179
+ guardedAttributesAtom: P(t.attributesAtom),
1180
+ guardedStoredConfigurationAtom: P(Ne(i)),
1181
+ guardedDecisionsAtom: P(We(i)),
1182
+ guardedExplicitDecisionsAtom: P(Be(i)),
1183
+ guardedImplicitDecisionsAtom: P(Ke(i))
1184
+ }, r = xn(o.guardedConfigurationSessionAtom), s = Je(o.guardedConfigurationSessionAtom);
929
1185
  return {
930
1186
  ...o,
931
1187
  configurationSessionAtom: i,
932
1188
  sessionInitializationAtom: e,
933
1189
  sessionUpdatingAtom: n,
934
- configurationInitializationAtom: He(e, o.guardedConfigurationSessionAtom, o.guardedConfigurationAtom, o.guardedCanResetAtom, o.guardedIsSatisfiedAtom, o.guardedAttributesAtom),
935
- configurationUpdatingAtom: Ye(n),
936
- makeDecisionAtom: s,
937
- explainAtom: r,
938
- decisionQueriesAtom: nn(o.guardedConfigurationSessionAtom),
939
- taskSchedulingAtom: en(o.guardedConfigurationSessionAtom),
940
- configurationSatisfactionAtom: Ge(o.guardedConfigurationSessionAtom, o.guardedIsSatisfiedAtom),
941
- configurationStoringAtom: Ze(o.guardedConfigurationSessionAtom),
942
- configurationResetAtom: ke(o.guardedConfigurationSessionAtom, o.guardedCanResetAtom),
943
- sessionReinitializationAtom: tn(o.guardedConfigurationSessionAtom),
944
- choiceAttributeAtomFamily: Le(o.guardedAttributesAtom, s, r),
945
- numericAttributeAtomFamily: Ke(o.guardedAttributesAtom, s, r),
946
- booleanAttributeAtomFamily: Qe(o.guardedAttributesAtom, s, r),
947
- componentAttributeAtomFamily: $e(o.guardedAttributesAtom, s, r),
948
- subscriberAtom: ce(t)
1190
+ configurationInitializationAtom: gn(e, o.guardedConfigurationSessionAtom, o.guardedConfigurationAtom, o.guardedCanResetAtom, o.guardedIsSatisfiedAtom, o.guardedAttributesAtom),
1191
+ configurationUpdatingAtom: pn(n),
1192
+ makeDecisionAtom: r,
1193
+ explainAtom: s,
1194
+ decisionQueriesAtom: vn(o.guardedConfigurationSessionAtom),
1195
+ taskSchedulingAtom: Cn(o.guardedConfigurationSessionAtom),
1196
+ configurationSatisfactionAtom: yn(o.guardedConfigurationSessionAtom, o.guardedIsSatisfiedAtom),
1197
+ configurationStoringAtom: bn(o.guardedConfigurationSessionAtom),
1198
+ configurationResetAtom: $e(o.guardedConfigurationSessionAtom, o.guardedCanResetAtom),
1199
+ sessionReinitializationAtom: Sn(o.guardedConfigurationSessionAtom),
1200
+ choiceAttributeAtomFamily: ln(o.guardedAttributesAtom, r, s),
1201
+ numericAttributeAtomFamily: dn(o.guardedAttributesAtom, r, s),
1202
+ booleanAttributeAtomFamily: mn(o.guardedAttributesAtom, r, s),
1203
+ componentAttributeAtomFamily: fn(o.guardedAttributesAtom, r, s),
1204
+ subscriberAtom: ke(t)
949
1205
  };
950
1206
  }
951
- const rn = 30 * 1e3;
952
- function an(t, e, n) {
1207
+ const En = 30 * 1e3;
1208
+ function Dn(t, e, n) {
953
1209
  const i = [
954
1210
  e.choiceAttributeAtomFamily,
955
1211
  e.booleanAttributeAtomFamily,
@@ -960,109 +1216,109 @@ function an(t, e, n) {
960
1216
  n.numericAttributeAtomFamily,
961
1217
  n.componentAttributeAtomFamily
962
1218
  ];
963
- return ut((o) => {
1219
+ return gt((o) => {
964
1220
  o(t.configurationAtom);
965
- const s = o(t.attributesAtom);
966
- if (s == null)
1221
+ const r = o(t.attributesAtom);
1222
+ if (r == null)
967
1223
  return;
968
- x.debug("Scheduling atomFamily cleanup");
969
- const r = setTimeout(() => {
970
- x.debug("Cleaning up atomFamilies");
971
- for (const a of [...s.getParams()]) {
972
- const c = s(a);
973
- o.peek(c) == null && (x.debug("Removing attribute from attributes family because it is nullish", a), s.remove(a));
1224
+ E.debug("Scheduling atomFamily cleanup");
1225
+ const s = setTimeout(() => {
1226
+ E.debug("Cleaning up atomFamilies");
1227
+ for (const u of [...r.getParams()]) {
1228
+ const c = r(u);
1229
+ o.peek(c) == null && (E.debug("Removing attribute from attributes family because it is nullish", u), r.remove(u));
974
1230
  }
975
- const u = [...s.getParams()];
976
- for (const a of i)
977
- for (const c of [...a.getParams()])
978
- u.includes(c) || a.remove(c);
979
- }, rn);
1231
+ const a = [...r.getParams()];
1232
+ for (const u of i)
1233
+ for (const c of [...u.getParams()])
1234
+ a.includes(c) || u.remove(c);
1235
+ }, En);
980
1236
  return () => {
981
- clearTimeout(r);
1237
+ clearTimeout(s);
982
1238
  };
983
1239
  });
984
1240
  }
985
- function un(t, e, n) {
1241
+ function Rn(t, e, n) {
986
1242
  return {
987
- addSessionListenersEffect: xe(t, e),
988
- cleanupAtomFamiliesEffect: an(t, e, n),
989
- atomSubscriberEffect: le(t),
990
- atomSubscriptionCleanupEffect: me(t)
1243
+ addSessionListenersEffect: Ve(t, e),
1244
+ cleanupAtomFamiliesEffect: Dn(t, e, n),
1245
+ atomSubscriberEffect: Ie(t),
1246
+ atomSubscriptionCleanupEffect: Fe(t)
991
1247
  };
992
1248
  }
993
- function cn(t) {
1249
+ function kn(t) {
994
1250
  return {
995
- configurationAtom: g(t.guardedConfigurationAtom),
996
- configurationStoringAtom: g(t.configurationStoringAtom),
997
- configurationSatisfactionAtom: g(t.configurationSatisfactionAtom),
998
- storedConfigurationAtom: g(t.guardedStoredConfigurationAtom),
999
- decisionsAtom: g(t.guardedDecisionsAtom),
1000
- explicitDecisionsAtom: g(t.guardedExplicitDecisionsAtom),
1001
- implicitDecisionsAtom: g(t.guardedImplicitDecisionsAtom),
1002
- makeDecisionAtom: g(t.makeDecisionAtom),
1003
- decisionQueriesAtom: g(t.decisionQueriesAtom),
1004
- configurationResetAtom: g(t.configurationResetAtom),
1005
- sessionReinitializationAtom: g(t.sessionReinitializationAtom),
1006
- explainAtom: g(t.explainAtom),
1007
- taskSchedulingAtom: g(t.taskSchedulingAtom),
1008
- choiceAttributeAtomFamily: _((e) => g(t.choiceAttributeAtomFamily(e))),
1009
- numericAttributeAtomFamily: _((e) => g(t.numericAttributeAtomFamily(e))),
1010
- booleanAttributeAtomFamily: _((e) => g(t.booleanAttributeAtomFamily(e))),
1011
- componentAttributeAtomFamily: _((e) => g(t.componentAttributeAtomFamily(e)))
1251
+ configurationAtom: h(t.guardedConfigurationAtom),
1252
+ configurationStoringAtom: h(t.configurationStoringAtom),
1253
+ configurationSatisfactionAtom: h(t.configurationSatisfactionAtom),
1254
+ storedConfigurationAtom: h(t.guardedStoredConfigurationAtom),
1255
+ decisionsAtom: h(t.guardedDecisionsAtom),
1256
+ explicitDecisionsAtom: h(t.guardedExplicitDecisionsAtom),
1257
+ implicitDecisionsAtom: h(t.guardedImplicitDecisionsAtom),
1258
+ makeDecisionAtom: h(t.makeDecisionAtom),
1259
+ decisionQueriesAtom: h(t.decisionQueriesAtom),
1260
+ configurationResetAtom: h(t.configurationResetAtom),
1261
+ sessionReinitializationAtom: h(t.sessionReinitializationAtom),
1262
+ explainAtom: h(t.explainAtom),
1263
+ taskSchedulingAtom: h(t.taskSchedulingAtom),
1264
+ choiceAttributeAtomFamily: W((e) => h(t.choiceAttributeAtomFamily(e))),
1265
+ numericAttributeAtomFamily: W((e) => h(t.numericAttributeAtomFamily(e))),
1266
+ booleanAttributeAtomFamily: W((e) => h(t.booleanAttributeAtomFamily(e))),
1267
+ componentAttributeAtomFamily: W((e) => h(t.componentAttributeAtomFamily(e)))
1012
1268
  };
1013
1269
  }
1014
- function ln() {
1015
- const t = Ie(), e = sn(t), n = cn(e);
1270
+ function In() {
1271
+ const t = Qe(), e = wn(t), n = kn(e);
1016
1272
  return {
1017
1273
  primitives: t,
1018
1274
  selectors: e,
1019
1275
  suspended: n,
1020
- effects: un(t, e, n)
1276
+ effects: Rn(t, e, n)
1021
1277
  };
1022
1278
  }
1023
- const mn = "The session context is null or undefined. This will dispose the session that may exist. If this was not intended, make sure you pass valid session context data.";
1024
- function dn(t) {
1025
- const { primitives: { sessionManagementMachineAtom: e } } = W(), n = Ft(e);
1026
- return At(() => {
1027
- n({ type: "SessionContextChanged", sessionContext: t.sessionContext }), t.sessionContext || console.warn(mn);
1028
- }, [t.sessionContext]), At(() => () => {
1279
+ const Fn = "The session context is null or undefined. This will dispose the session that may exist. If this was not intended, make sure you pass valid session context data.";
1280
+ function Mn(t) {
1281
+ const { primitives: { sessionManagementMachineAtom: e } } = V(), n = Ut(e);
1282
+ return ct(() => {
1283
+ n({ type: "SessionContextChanged", sessionContext: t.sessionContext }), t.sessionContext || console.warn(Fn);
1284
+ }, [t.sessionContext]), ct(() => () => {
1029
1285
  n({ type: "Shutdown" });
1030
1286
  }, []), null;
1031
1287
  }
1032
- function Un(t) {
1033
- const e = X(() => ln(), []);
1034
- return /* @__PURE__ */ q(Pt, { children: /* @__PURE__ */ q(Ut.Provider, { value: e, children: /* @__PURE__ */ q(fn, { jotaiStore: t.jotaiStore, children: /* @__PURE__ */ Ht(gn, { children: [
1035
- /* @__PURE__ */ q(dn, { sessionContext: t.sessionContext }),
1036
- /* @__PURE__ */ q(se, {}),
1037
- t.children
1288
+ function si(t) {
1289
+ const e = Q(() => In(), []);
1290
+ return /* @__PURE__ */ w(Tt, { children: /* @__PURE__ */ w(Vt.Provider, { value: e, children: /* @__PURE__ */ w(Pn, { jotaiStore: t.jotaiStore, children: /* @__PURE__ */ se(qn, { children: [
1291
+ /* @__PURE__ */ w(Mn, { sessionContext: t.sessionContext }),
1292
+ /* @__PURE__ */ w(we, {}),
1293
+ /* @__PURE__ */ w(Se, { enabled: t.activeAttributesEnabled ?? !1, children: t.children })
1038
1294
  ] }) }) }) });
1039
1295
  }
1040
- function fn(t) {
1041
- return t.jotaiStore ? /* @__PURE__ */ q(qt.Provider, { value: t.jotaiStore, children: t.children }) : /* @__PURE__ */ q(Pt, { children: t.children });
1296
+ function Pn(t) {
1297
+ return t.jotaiStore ? /* @__PURE__ */ w(Nt.Provider, { value: t.jotaiStore, children: t.children }) : /* @__PURE__ */ w(Tt, { children: t.children });
1042
1298
  }
1043
- function gn(t) {
1044
- const e = ct();
1045
- return /* @__PURE__ */ q($t, { store: e, children: t.children });
1299
+ function qn(t) {
1300
+ const e = nt();
1301
+ return /* @__PURE__ */ w(ne, { store: e, children: t.children });
1046
1302
  }
1047
- function qn() {
1048
- const { selectors: { configurationInitializationAtom: t } } = W(), e = ct();
1049
- return Ct(t, { store: e });
1303
+ function zn() {
1304
+ const { selectors: { configurationInitializationAtom: t } } = V(), e = nt();
1305
+ return Y(t, { store: e });
1050
1306
  }
1051
- function jn() {
1052
- const { selectors: { configurationUpdatingAtom: t } } = W(), e = ct();
1053
- return Ct(t, { store: e });
1307
+ function Un() {
1308
+ const { selectors: { configurationUpdatingAtom: t } } = V(), e = nt();
1309
+ return Y(t, { store: e });
1054
1310
  }
1055
- const Tn = y((t) => t.explainAtom, (t) => t.explainAtom), Vn = y((t) => t.guardedConfigurationAtom, (t) => t.configurationAtom), _n = y((t) => t.configurationSatisfactionAtom, (t) => t.configurationSatisfactionAtom), Nn = y((t) => t.configurationStoringAtom, (t) => t.configurationStoringAtom), Wn = y((t) => t.configurationResetAtom, (t) => t.configurationResetAtom), On = y((t) => t.sessionReinitializationAtom, (t) => t.sessionReinitializationAtom), Bn = y((t) => t.taskSchedulingAtom, (t) => t.taskSchedulingAtom), Ln = y((t) => t.guardedStoredConfigurationAtom, (t) => t.storedConfigurationAtom), Kn = y((t) => t.makeDecisionAtom, (t) => t.makeDecisionAtom), Qn = y((t) => t.decisionQueriesAtom, (t) => t.decisionQueriesAtom), An = y((t) => t.guardedDecisionsAtom, (t) => t.decisionsAtom), hn = y((t) => t.guardedExplicitDecisionsAtom, (t) => t.explicitDecisionsAtom), pn = y((t) => t.guardedImplicitDecisionsAtom, (t) => t.implicitDecisionsAtom);
1056
- function $n(t, e) {
1057
- const n = typeof t == "string" ? t : void 0, i = typeof t == "boolean" ? t : e, o = X(() => ot(n).returnType().with(Oe.nullish, () => An).with(L.Explicit, () => hn).with(L.Implicit, () => pn).exhaustive(), [n]);
1311
+ const ri = v((t) => t.explainAtom, (t) => t.explainAtom), ai = v((t) => t.guardedConfigurationAtom, (t) => t.configurationAtom), ui = v((t) => t.configurationSatisfactionAtom, (t) => t.configurationSatisfactionAtom), ci = v((t) => t.configurationStoringAtom, (t) => t.configurationStoringAtom), li = v((t) => t.configurationResetAtom, (t) => t.configurationResetAtom), di = v((t) => t.sessionReinitializationAtom, (t) => t.sessionReinitializationAtom), mi = v((t) => t.taskSchedulingAtom, (t) => t.taskSchedulingAtom), fi = v((t) => t.guardedStoredConfigurationAtom, (t) => t.storedConfigurationAtom), hi = v((t) => t.makeDecisionAtom, (t) => t.makeDecisionAtom), gi = v((t) => t.decisionQueriesAtom, (t) => t.decisionQueriesAtom), jn = v((t) => t.guardedDecisionsAtom, (t) => t.decisionsAtom), On = v((t) => t.guardedExplicitDecisionsAtom, (t) => t.explicitDecisionsAtom), Tn = v((t) => t.guardedImplicitDecisionsAtom, (t) => t.implicitDecisionsAtom);
1312
+ function Ai(t, e) {
1313
+ const n = typeof t == "string" ? t : void 0, i = typeof t == "boolean" ? t : e, o = Q(() => dt(n).returnType().with(un.nullish, () => jn).with(H.Explicit, () => On).with(H.Implicit, () => Tn).exhaustive(), [n]);
1058
1314
  return i === !1 ? o(!1) : o();
1059
1315
  }
1060
- function Jn() {
1061
- const { selectors: t } = W();
1062
- return X(() => ({
1316
+ function pi() {
1317
+ const { selectors: t } = V();
1318
+ return Q(() => ({
1063
1319
  getConfigurationInitializationAtom: t.configurationInitializationAtom,
1064
1320
  getConfigurationUpdatingAtom: t.configurationUpdatingAtom,
1065
- createAttributesAtom: ht(t),
1321
+ createAttributesAtom: vt(t),
1066
1322
  getChoiceAttributeAtomFamily: t.choiceAttributeAtomFamily,
1067
1323
  getNumericAttributeAtomFamily: t.numericAttributeAtomFamily,
1068
1324
  getBooleanAttributeAtomFamily: t.booleanAttributeAtomFamily,
@@ -1082,29 +1338,55 @@ function Jn() {
1082
1338
  getImplicitDecisionsAtom: t.guardedImplicitDecisionsAtom
1083
1339
  }), [t]);
1084
1340
  }
1085
- const Hn = (t) => t !== E;
1341
+ const _n = (t) => t !== D;
1342
+ function bi(t, e = !0) {
1343
+ var a, u;
1344
+ Ce(t, e);
1345
+ const n = pe(e ? t : [], !1, !1), i = xe(), o = zn(), r = Un();
1346
+ if (!e) return { status: "inactive" };
1347
+ const s = o.error ?? r.error;
1348
+ if (s) return { status: "error", error: s, retry: s.retry };
1349
+ if (i.error) return { status: "error", error: i.error, retry: i.retry };
1350
+ if (((a = i.scopedDecisionRefresh) == null ? void 0 : a.status) === "error")
1351
+ return { status: "error", error: i.scopedDecisionRefresh.error, retry: i.retryScopedDecisionRefresh };
1352
+ if (o.isInitializing || r.isUpdating || !_n(n) || !i.isScopeSettled || ((u = i.scopedDecisionRefresh) == null ? void 0 : u.status) === "refreshing") return { status: "pending" };
1353
+ if (!n.every((c) => c !== void 0))
1354
+ return { status: "missing", missingIds: t.filter((c, l) => n[l] === void 0) };
1355
+ if (i.activeAttributes !== null) {
1356
+ const c = new Set(i.activeAttributes.map(T));
1357
+ if (n.some((l, p) => !Wt(l) && !c.has(T(t[p]))))
1358
+ return { status: "pending" };
1359
+ }
1360
+ return { status: "ready", attributes: n };
1361
+ }
1086
1362
  export {
1087
- Un as Configuration,
1088
- E as ConfigurationUninitialized,
1089
- Hn as isConfigurationInitialized,
1090
- Rn as useAttributes,
1091
- zn as useBooleanAttribute,
1092
- Fn as useChoiceAttribute,
1093
- Pn as useComponentAttribute,
1094
- Vn as useConfiguration,
1095
- qn as useConfigurationInitialization,
1096
- Wn as useConfigurationReset,
1097
- _n as useConfigurationSatisfaction,
1098
- Nn as useConfigurationStoring,
1099
- jn as useConfigurationUpdating,
1100
- ct as useConfiguratorStore,
1101
- Qn as useDecisionQueries,
1102
- $n as useDecisions,
1103
- Tn as useExplain,
1104
- Jn as useJotaiAtoms,
1105
- Kn as useMakeDecision,
1106
- Mn as useNumericAttribute,
1107
- On as useSessionReinitialization,
1108
- Ln as useStoredConfiguration,
1109
- Bn as useTaskScheduling
1363
+ si as Configuration,
1364
+ oi as ConfigurationResultsSection,
1365
+ D as ConfigurationUninitialized,
1366
+ _n as isConfigurationInitialized,
1367
+ Wt as isImmutablyExcluded,
1368
+ ni as useActiveAttribute,
1369
+ xe as useActiveAttributes,
1370
+ pe as useAttributes,
1371
+ ti as useBooleanAttribute,
1372
+ Zn as useChoiceAttribute,
1373
+ ei as useComponentAttribute,
1374
+ ai as useConfiguration,
1375
+ zn as useConfigurationInitialization,
1376
+ li as useConfigurationReset,
1377
+ ui as useConfigurationSatisfaction,
1378
+ ci as useConfigurationStoring,
1379
+ Un as useConfigurationUpdating,
1380
+ nt as useConfiguratorStore,
1381
+ gi as useDecisionQueries,
1382
+ Ai as useDecisions,
1383
+ ri as useExplain,
1384
+ ii as useFullPropagation,
1385
+ pi as useJotaiAtoms,
1386
+ bi as useLiveAttributes,
1387
+ hi as useMakeDecision,
1388
+ Gn as useNumericAttribute,
1389
+ di as useSessionReinitialization,
1390
+ fi as useStoredConfiguration,
1391
+ mi as useTaskScheduling
1110
1392
  };