@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/README.md +42 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +98 -2
- package/dist/index.js +829 -547
- package/package.json +3 -1
package/dist/index.js
CHANGED
|
@@ -1,90 +1,109 @@
|
|
|
1
|
-
import { GlobalAttributeIdKeyBuilder as
|
|
2
|
-
import { pipe as
|
|
3
|
-
import { atom as f, getDefaultStore as
|
|
4
|
-
import { createContext as
|
|
5
|
-
import { useStableMemo as
|
|
6
|
-
import { selectAtom as
|
|
7
|
-
import { jsx as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
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 ===
|
|
19
|
-
throw
|
|
37
|
+
if (i === D)
|
|
38
|
+
throw D;
|
|
20
39
|
return i;
|
|
21
40
|
});
|
|
22
41
|
} catch (n) {
|
|
23
|
-
if (n ===
|
|
24
|
-
return
|
|
42
|
+
if (n === D)
|
|
43
|
+
return D;
|
|
25
44
|
throw n;
|
|
26
45
|
}
|
|
27
46
|
});
|
|
28
47
|
}
|
|
29
|
-
function
|
|
48
|
+
function vt(t) {
|
|
30
49
|
const { guardedConfigurationAtom: e, guardedAttributesAtom: n } = t;
|
|
31
|
-
function i(o,
|
|
32
|
-
const
|
|
50
|
+
function i(o, r) {
|
|
51
|
+
const s = o === "all" ? "all" : O(
|
|
33
52
|
o,
|
|
34
|
-
|
|
53
|
+
M.map((a) => typeof a == "string" ? a : T(a))
|
|
35
54
|
);
|
|
36
|
-
return
|
|
37
|
-
if (
|
|
38
|
-
return
|
|
39
|
-
const c =
|
|
40
|
-
return
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
|
50
|
-
AtomsContext:
|
|
51
|
-
StoreContext:
|
|
68
|
+
const kt = globalThis.configuratorReactContexts ?? {
|
|
69
|
+
AtomsContext: Ct(null),
|
|
70
|
+
StoreContext: Ct(ee())
|
|
52
71
|
};
|
|
53
|
-
globalThis.configuratorReactContexts =
|
|
54
|
-
const
|
|
55
|
-
function
|
|
56
|
-
const i =
|
|
57
|
-
return (o, ...
|
|
58
|
-
const
|
|
59
|
-
return
|
|
60
|
-
|
|
61
|
-
}, [
|
|
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
|
|
65
|
-
const n =
|
|
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
|
|
72
|
-
const n =
|
|
73
|
-
function i(o,
|
|
74
|
-
const
|
|
75
|
-
return n(
|
|
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
|
|
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
|
|
86
|
-
const e =
|
|
87
|
-
if (n !==
|
|
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) ??
|
|
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
|
|
104
|
-
(t, e, n) =>
|
|
105
|
-
(t, e, n) =>
|
|
106
|
-
|
|
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
|
|
127
|
+
function pe(t, e, n) {
|
|
109
128
|
const i = t == "all" ? e : n, o = t == "all" ? void 0 : e;
|
|
110
|
-
return
|
|
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
|
|
113
|
-
function
|
|
114
|
-
const
|
|
115
|
-
|
|
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
|
-
|
|
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
|
|
121
|
-
return f(
|
|
373
|
+
function Re() {
|
|
374
|
+
return f(et.empty);
|
|
122
375
|
}
|
|
123
|
-
function
|
|
376
|
+
function ke(t) {
|
|
124
377
|
return f(null, (e, n, i) => {
|
|
125
|
-
const o =
|
|
126
|
-
|
|
127
|
-
const
|
|
378
|
+
const o = ae();
|
|
379
|
+
E.debug("AtomSubscription:", "Creating subscription with id", o);
|
|
380
|
+
const s = {
|
|
128
381
|
unsubscribe: () => {
|
|
129
|
-
n(t.subscriptionsAtom, (
|
|
130
|
-
const
|
|
131
|
-
if (
|
|
132
|
-
return
|
|
133
|
-
const c = new Map(
|
|
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
|
|
136
|
-
return
|
|
388
|
+
const l = new Map(a);
|
|
389
|
+
return l.set(i, c), l;
|
|
137
390
|
});
|
|
138
391
|
}
|
|
139
392
|
};
|
|
140
|
-
return n(t.subscriptionsAtom, (
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
const c = new Map(
|
|
144
|
-
return c.set(i,
|
|
145
|
-
}),
|
|
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
|
|
149
|
-
return
|
|
401
|
+
function Ie(t) {
|
|
402
|
+
return gt((e) => {
|
|
150
403
|
const i = [...e(t.subscriptionsAtom).keys()];
|
|
151
|
-
|
|
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
|
|
157
|
-
return
|
|
409
|
+
function Fe(t) {
|
|
410
|
+
return gt((e, n) => {
|
|
158
411
|
const i = setInterval(() => {
|
|
159
|
-
|
|
412
|
+
E.info("AtomSubscriptionCleanup:", "Running cleanup");
|
|
160
413
|
let o = !1;
|
|
161
|
-
n(t.subscriptionsAtom, (
|
|
162
|
-
const
|
|
163
|
-
for (const
|
|
164
|
-
const
|
|
165
|
-
for (const c of [...
|
|
166
|
-
const
|
|
167
|
-
(
|
|
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
|
-
|
|
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
|
|
424
|
+
return E.debug("AtomSubscriptionCleanup:", "There are", s.size, "Atoms with", [...s.values(), M.flatten].length, "subscriptions left."), o ? s : r;
|
|
172
425
|
});
|
|
173
|
-
},
|
|
426
|
+
}, Ee);
|
|
174
427
|
return () => {
|
|
175
428
|
clearInterval(i);
|
|
176
429
|
};
|
|
177
430
|
});
|
|
178
431
|
}
|
|
179
|
-
const
|
|
432
|
+
const Me = ce(({ input: t }) => O(
|
|
180
433
|
t.session,
|
|
181
|
-
|
|
182
|
-
() => () =>
|
|
434
|
+
X.match(
|
|
435
|
+
() => () => Xt.createSession(t.sessionContext),
|
|
183
436
|
(e) => async () => (await e.setSessionContext(t.sessionContext), e)
|
|
184
437
|
),
|
|
185
|
-
(e) =>
|
|
186
|
-
|
|
438
|
+
(e) => ut.tryCatch(e, (n) => n),
|
|
439
|
+
ut.mapLeft((e) => ({
|
|
187
440
|
sessionContext: t.sessionContext,
|
|
188
441
|
configurationError: e
|
|
189
442
|
}))
|
|
190
|
-
)()),
|
|
443
|
+
)()), Pe = le({
|
|
191
444
|
types: {
|
|
192
445
|
context: {},
|
|
193
446
|
events: {}
|
|
194
447
|
},
|
|
195
448
|
actors: {
|
|
196
|
-
createOrUpdateSession:
|
|
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
|
-
|
|
468
|
+
yt({
|
|
216
469
|
sessionCreateOrUpdateError: () => null
|
|
217
470
|
})
|
|
218
471
|
]
|
|
219
472
|
},
|
|
220
473
|
SessionContextChanged: {
|
|
221
474
|
actions: [
|
|
222
|
-
|
|
223
|
-
|
|
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
|
-
|
|
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:
|
|
503
|
+
session: X.fromNullable(t.configurationSession)
|
|
251
504
|
}),
|
|
252
505
|
onDone: {
|
|
253
506
|
target: "Idle",
|
|
254
507
|
actions: [
|
|
255
|
-
|
|
256
|
-
|
|
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
|
-
|
|
271
|
-
|
|
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
|
-
},
|
|
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
|
-
|
|
287
|
-
t.configurationSession &&
|
|
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
|
-
},
|
|
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
|
|
301
|
-
return
|
|
553
|
+
function qe() {
|
|
554
|
+
return ue(Pe);
|
|
302
555
|
}
|
|
303
|
-
function
|
|
556
|
+
function ze(t) {
|
|
304
557
|
return f((e) => e(t.sessionManagementMachineAtom).context.configurationSession);
|
|
305
558
|
}
|
|
306
|
-
function
|
|
307
|
-
const e = f((o,
|
|
308
|
-
var
|
|
309
|
-
const
|
|
310
|
-
...
|
|
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
|
-
|
|
565
|
+
r.setSelf();
|
|
313
566
|
}
|
|
314
567
|
} : null;
|
|
315
568
|
return {
|
|
316
|
-
isProcessing:
|
|
317
|
-
hasSession:
|
|
569
|
+
isProcessing: a,
|
|
570
|
+
hasSession: u,
|
|
318
571
|
error: c
|
|
319
572
|
};
|
|
320
|
-
}, (o,
|
|
321
|
-
|
|
573
|
+
}, (o, r) => {
|
|
574
|
+
r(t.sessionManagementMachineAtom, { type: "Retry" });
|
|
322
575
|
}), n = f((o) => {
|
|
323
|
-
const { hasSession:
|
|
576
|
+
const { hasSession: r, error: s, isProcessing: a } = o(e);
|
|
324
577
|
return {
|
|
325
|
-
isInitializing: !
|
|
326
|
-
error: !
|
|
578
|
+
isInitializing: !r && a,
|
|
579
|
+
error: !r && s ? s : void 0
|
|
327
580
|
};
|
|
328
581
|
}), i = f((o) => {
|
|
329
|
-
const { hasSession:
|
|
582
|
+
const { hasSession: r, error: s, isProcessing: a } = o(e);
|
|
330
583
|
return {
|
|
331
|
-
isUpdating:
|
|
332
|
-
error:
|
|
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
|
|
341
|
-
function
|
|
342
|
-
const { attributesAtom: n, configurationAtom: i, isSatisfiedAtom: o, canResetAtom:
|
|
343
|
-
return
|
|
344
|
-
const c =
|
|
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
|
-
|
|
599
|
+
u(i, void 0), u(o, void 0), u(n, void 0), u(r, void 0);
|
|
347
600
|
return;
|
|
348
601
|
}
|
|
349
|
-
const
|
|
350
|
-
|
|
351
|
-
const
|
|
352
|
-
F.attributes.added.forEach((
|
|
353
|
-
|
|
354
|
-
}), F.attributes.changed.forEach((
|
|
355
|
-
|
|
356
|
-
}), F.attributes.removed.forEach((
|
|
357
|
-
|
|
358
|
-
}),
|
|
359
|
-
}),
|
|
360
|
-
|
|
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
|
-
|
|
616
|
+
l.unsubscribe(), p.unsubscribe();
|
|
364
617
|
};
|
|
365
618
|
});
|
|
366
619
|
}
|
|
367
|
-
function
|
|
620
|
+
function pt(t, e, n) {
|
|
368
621
|
const i = f((o) => {
|
|
369
|
-
const
|
|
370
|
-
if (!
|
|
622
|
+
const r = o(t);
|
|
623
|
+
if (!r)
|
|
371
624
|
return;
|
|
372
|
-
const
|
|
373
|
-
return
|
|
374
|
-
const
|
|
375
|
-
|
|
625
|
+
const s = f();
|
|
626
|
+
return s.onMount = (a) => {
|
|
627
|
+
const u = e(r, (...c) => {
|
|
628
|
+
a(c);
|
|
376
629
|
});
|
|
377
630
|
return () => {
|
|
378
|
-
|
|
631
|
+
a(void 0), u.unsubscribe();
|
|
379
632
|
};
|
|
380
|
-
},
|
|
633
|
+
}, s;
|
|
381
634
|
});
|
|
382
635
|
return f((o) => {
|
|
383
|
-
const
|
|
384
|
-
if (
|
|
636
|
+
const r = o(i);
|
|
637
|
+
if (r == null)
|
|
385
638
|
return;
|
|
386
|
-
const
|
|
387
|
-
if (
|
|
388
|
-
return n(...
|
|
639
|
+
const s = o(r);
|
|
640
|
+
if (s != null)
|
|
641
|
+
return n(...s);
|
|
389
642
|
});
|
|
390
643
|
}
|
|
391
|
-
function
|
|
392
|
-
return
|
|
644
|
+
function Ne(t) {
|
|
645
|
+
return pt(t, (e, n) => e.addStoredConfigurationChangedListener(n), (e) => e);
|
|
393
646
|
}
|
|
394
|
-
function
|
|
395
|
-
return
|
|
647
|
+
function We(t) {
|
|
648
|
+
return pt(t, (e, n) => e.addDecisionsChangedListener(n), (e) => e);
|
|
396
649
|
}
|
|
397
|
-
function
|
|
398
|
-
return
|
|
650
|
+
function Be(t) {
|
|
651
|
+
return pt(t, (e, n) => e.addDecisionsChangedListener(H.Explicit, n), (e) => e);
|
|
399
652
|
}
|
|
400
|
-
function
|
|
401
|
-
return
|
|
653
|
+
function Ke(t) {
|
|
654
|
+
return pt(t, (e, n) => e.addDecisionsChangedListener(H.Implicit, n), (e) => e);
|
|
402
655
|
}
|
|
403
|
-
const
|
|
404
|
-
sessionManagementMachineAtom:
|
|
405
|
-
configurationAtom:
|
|
406
|
-
isSatisfiedAtom:
|
|
407
|
-
canResetAtom:
|
|
408
|
-
attributesAtom:
|
|
409
|
-
subscriptionsAtom:
|
|
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
|
|
412
|
-
return
|
|
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
|
|
421
|
-
return
|
|
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
|
|
430
|
-
return
|
|
682
|
+
function He(t) {
|
|
683
|
+
return O(
|
|
431
684
|
t.values,
|
|
432
|
-
|
|
433
|
-
|
|
685
|
+
et.values(zt.trivial),
|
|
686
|
+
M.filter((e) => {
|
|
434
687
|
var n;
|
|
435
|
-
return ((n = e.decision) == null ? void 0 : n.kind) ===
|
|
688
|
+
return ((n = e.decision) == null ? void 0 : n.kind) === H.Explicit;
|
|
436
689
|
}),
|
|
437
|
-
|
|
438
|
-
type:
|
|
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
|
|
446
|
-
if (
|
|
447
|
-
const i = t[
|
|
448
|
-
return 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 (
|
|
451
|
-
if (!
|
|
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 = [],
|
|
455
|
-
for (const
|
|
456
|
-
const
|
|
457
|
-
|
|
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 (
|
|
460
|
-
if (
|
|
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
|
|
463
|
-
return i.every((c,
|
|
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((
|
|
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 ||
|
|
470
|
-
var
|
|
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
|
-
},
|
|
727
|
+
}, C = (t) => {
|
|
475
728
|
var e, n, i;
|
|
476
|
-
return
|
|
477
|
-
},
|
|
478
|
-
function
|
|
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) =>
|
|
734
|
+
return (n) => g(e, n, () => {
|
|
482
735
|
});
|
|
483
736
|
}
|
|
484
737
|
if (t.length === 2) {
|
|
485
738
|
const [e, n] = t;
|
|
486
|
-
return
|
|
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
|
|
492
|
-
return Object.assign(t, { optional: () =>
|
|
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
|
|
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, { [
|
|
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: () =>
|
|
755
|
+
} }))(t), { optional: () => wt(Ft(t)), select: (e) => wt(e === void 0 ? G(t) : G(e, t)) });
|
|
503
756
|
}
|
|
504
|
-
function
|
|
505
|
-
return
|
|
757
|
+
function Ft(t) {
|
|
758
|
+
return A({ [b]: () => ({ match: (e) => {
|
|
506
759
|
let n = {};
|
|
507
|
-
const i = (o,
|
|
508
|
-
n[o] =
|
|
760
|
+
const i = (o, r) => {
|
|
761
|
+
n[o] = r;
|
|
509
762
|
};
|
|
510
|
-
return e === void 0 ? (
|
|
511
|
-
}, getSelectionKeys: () =>
|
|
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
|
|
766
|
+
const Ye = (t, e) => {
|
|
514
767
|
for (const n of t) if (!e(n)) return !1;
|
|
515
768
|
return !0;
|
|
516
|
-
},
|
|
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
|
|
521
|
-
return
|
|
773
|
+
function m(...t) {
|
|
774
|
+
return A({ [b]: () => ({ match: (e) => {
|
|
522
775
|
let n = {};
|
|
523
|
-
const i = (o,
|
|
524
|
-
n[o] =
|
|
776
|
+
const i = (o, r) => {
|
|
777
|
+
n[o] = r;
|
|
525
778
|
};
|
|
526
|
-
return { matched: t.every((o) =>
|
|
527
|
-
}, getSelectionKeys: () =>
|
|
779
|
+
return { matched: t.every((o) => g(o, e, i)), selections: n };
|
|
780
|
+
}, getSelectionKeys: () => Z(t, C), matcherType: "and" }) });
|
|
528
781
|
}
|
|
529
|
-
function
|
|
530
|
-
return
|
|
782
|
+
function Qt(...t) {
|
|
783
|
+
return A({ [b]: () => ({ match: (e) => {
|
|
531
784
|
let n = {};
|
|
532
|
-
const i = (o,
|
|
533
|
-
n[o] =
|
|
785
|
+
const i = (o, r) => {
|
|
786
|
+
n[o] = r;
|
|
534
787
|
};
|
|
535
|
-
return
|
|
536
|
-
}, getSelectionKeys: () =>
|
|
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
|
|
539
|
-
return { [
|
|
791
|
+
function d(t) {
|
|
792
|
+
return { [b]: () => ({ match: (e) => ({ matched: !!t(e) }) }) };
|
|
540
793
|
}
|
|
541
|
-
function
|
|
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
|
|
544
|
-
let o = { [e ??
|
|
545
|
-
return { matched: n === void 0 ||
|
|
546
|
-
o[
|
|
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 ??
|
|
801
|
+
}, getSelectionKeys: () => [e ?? lt].concat(n === void 0 ? [] : C(n)) }) });
|
|
549
802
|
}
|
|
550
|
-
function
|
|
803
|
+
function R(t) {
|
|
551
804
|
return typeof t == "number";
|
|
552
805
|
}
|
|
553
|
-
function
|
|
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
|
|
812
|
+
const $t = A(d(function(t) {
|
|
560
813
|
return !0;
|
|
561
|
-
})),
|
|
562
|
-
return
|
|
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
|
|
818
|
+
return U(m(t, (n = e, d((i) => q(i) && i.endsWith(n)))));
|
|
566
819
|
var n;
|
|
567
|
-
}, minLength: (e) =>
|
|
568
|
-
return
|
|
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
|
|
824
|
+
return U(m(t, (n = e, d((i) => q(i) && !!i.match(n)))));
|
|
572
825
|
var n;
|
|
573
|
-
} }),
|
|
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
|
-
})),
|
|
828
|
+
})), sn = A(d(function(t) {
|
|
576
829
|
return typeof t == "symbol";
|
|
577
|
-
})),
|
|
830
|
+
})), rn = A(d(function(t) {
|
|
578
831
|
return t == null;
|
|
579
|
-
})),
|
|
832
|
+
})), an = A(d(function(t) {
|
|
580
833
|
return t != null;
|
|
581
834
|
}));
|
|
582
|
-
var
|
|
583
|
-
return
|
|
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
|
|
589
|
-
i[
|
|
841
|
+
if (e.length === 0) return C(n).forEach((r) => {
|
|
842
|
+
i[r] = [];
|
|
590
843
|
}), { matched: !0, selections: i };
|
|
591
|
-
const o = (
|
|
592
|
-
i[
|
|
844
|
+
const o = (r, s) => {
|
|
845
|
+
i[r] = (i[r] || []).concat([s]);
|
|
593
846
|
};
|
|
594
|
-
return { matched: e.every((
|
|
595
|
-
}, getSelectionKeys: () => t.length === 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
|
|
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 = (
|
|
603
|
-
n[
|
|
855
|
+
const i = (r, s) => {
|
|
856
|
+
n[r] = (n[r] || []).concat([s]);
|
|
604
857
|
}, o = t[0];
|
|
605
|
-
return { matched:
|
|
606
|
-
}, getSelectionKeys: () => t.length === 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
|
|
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 = (
|
|
613
|
-
n[
|
|
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 [
|
|
619
|
-
return { matched:
|
|
620
|
-
const c =
|
|
621
|
-
return c &&
|
|
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 ? [] : [...
|
|
624
|
-
}, intersection:
|
|
625
|
-
return
|
|
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:
|
|
628
|
-
return
|
|
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
|
|
885
|
+
return A(d(Xe(t)));
|
|
633
886
|
} };
|
|
634
|
-
class
|
|
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
|
|
646
|
-
function
|
|
647
|
-
return new
|
|
898
|
+
const Et = { matched: !1, value: void 0 };
|
|
899
|
+
function dt(t) {
|
|
900
|
+
return new mt(t, Et);
|
|
648
901
|
}
|
|
649
|
-
class
|
|
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
|
|
659
|
-
const
|
|
660
|
-
|
|
661
|
-
},
|
|
662
|
-
return new
|
|
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
|
|
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
|
|
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
|
|
936
|
+
function L(t, e) {
|
|
684
937
|
var n = 0, i, o;
|
|
685
938
|
e = e || {};
|
|
686
|
-
function
|
|
687
|
-
var
|
|
688
|
-
t: for (;
|
|
689
|
-
if (
|
|
690
|
-
|
|
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 <
|
|
694
|
-
if (
|
|
695
|
-
|
|
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
|
|
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 (
|
|
701
|
-
|
|
702
|
-
return
|
|
703
|
-
args:
|
|
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,
|
|
706
|
-
}, i ? (i.prev =
|
|
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 =
|
|
961
|
+
o.prev, o.next = null) : n++, i = s, s.val;
|
|
709
962
|
}
|
|
710
|
-
return
|
|
963
|
+
return r.clear = function() {
|
|
711
964
|
i = null, o = null, n = 0;
|
|
712
|
-
},
|
|
965
|
+
}, r;
|
|
713
966
|
}
|
|
714
|
-
function
|
|
715
|
-
return
|
|
967
|
+
function ln(t, e, n) {
|
|
968
|
+
return bt(
|
|
716
969
|
t,
|
|
717
970
|
n,
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
(i, o,
|
|
721
|
-
const { makeDecision:
|
|
971
|
+
ft.choiceAttributeRefinement,
|
|
972
|
+
K.choiceValue,
|
|
973
|
+
(i, o, r) => {
|
|
974
|
+
const { makeDecision: s, makeManyDecisions: a } = r(e);
|
|
722
975
|
return {
|
|
723
|
-
makeDecision: (
|
|
724
|
-
type:
|
|
976
|
+
makeDecision: (u, c) => s({
|
|
977
|
+
type: tt.Choice,
|
|
725
978
|
attributeId: i.id,
|
|
726
|
-
choiceValueId:
|
|
979
|
+
choiceValueId: u,
|
|
727
980
|
state: c
|
|
728
981
|
}),
|
|
729
|
-
clearDecisions: () =>
|
|
982
|
+
clearDecisions: () => O(
|
|
730
983
|
i,
|
|
731
|
-
|
|
984
|
+
He,
|
|
732
985
|
// Only execute if there are decisions to clear.
|
|
733
|
-
|
|
734
|
-
|
|
986
|
+
X.fromPredicate(M.isNonEmpty),
|
|
987
|
+
X.match(
|
|
735
988
|
() => () => Promise.resolve(),
|
|
736
|
-
(
|
|
989
|
+
(u) => O(() => a(u, { type: "KeepExistingDecisions" }), Gt.map(te))
|
|
737
990
|
)
|
|
738
991
|
)(),
|
|
739
|
-
isMultiSelect:
|
|
740
|
-
getAllowedChoiceValues:
|
|
741
|
-
getIncludedChoiceValues:
|
|
742
|
-
getBlockedChoiceValues:
|
|
743
|
-
isChoiceValueAllowed:
|
|
744
|
-
isChoiceValueBlocked:
|
|
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
|
|
750
|
-
return
|
|
1002
|
+
function dn(t, e, n) {
|
|
1003
|
+
return bt(
|
|
751
1004
|
t,
|
|
752
1005
|
n,
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
(i, o,
|
|
756
|
-
const { makeDecision:
|
|
1006
|
+
ft.numericAttributeRefinement,
|
|
1007
|
+
K.numeric,
|
|
1008
|
+
(i, o, r) => {
|
|
1009
|
+
const { makeDecision: s } = r(e);
|
|
757
1010
|
return {
|
|
758
|
-
makeDecision: (
|
|
759
|
-
type:
|
|
1011
|
+
makeDecision: (a) => s({
|
|
1012
|
+
type: tt.Numeric,
|
|
760
1013
|
attributeId: i.id,
|
|
761
|
-
state:
|
|
1014
|
+
state: a
|
|
762
1015
|
})
|
|
763
1016
|
};
|
|
764
1017
|
}
|
|
765
1018
|
);
|
|
766
1019
|
}
|
|
767
|
-
function
|
|
768
|
-
return
|
|
1020
|
+
function mn(t, e, n) {
|
|
1021
|
+
return bt(
|
|
769
1022
|
t,
|
|
770
1023
|
n,
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
(i, o,
|
|
774
|
-
const { makeDecision:
|
|
1024
|
+
ft.booleanAttributeRefinement,
|
|
1025
|
+
K.boolean,
|
|
1026
|
+
(i, o, r) => {
|
|
1027
|
+
const { makeDecision: s } = r(e);
|
|
775
1028
|
return {
|
|
776
|
-
makeDecision: (
|
|
777
|
-
type:
|
|
1029
|
+
makeDecision: (a) => s({
|
|
1030
|
+
type: tt.Boolean,
|
|
778
1031
|
attributeId: i.id,
|
|
779
|
-
state:
|
|
1032
|
+
state: a
|
|
780
1033
|
})
|
|
781
1034
|
};
|
|
782
1035
|
}
|
|
783
1036
|
);
|
|
784
1037
|
}
|
|
785
|
-
function
|
|
786
|
-
return
|
|
1038
|
+
function fn(t, e, n) {
|
|
1039
|
+
return bt(
|
|
787
1040
|
t,
|
|
788
1041
|
n,
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
(i, o,
|
|
792
|
-
const { makeDecision:
|
|
1042
|
+
ft.componentAttributeRefinement,
|
|
1043
|
+
K.component,
|
|
1044
|
+
(i, o, r) => {
|
|
1045
|
+
const { makeDecision: s } = r(e);
|
|
793
1046
|
return {
|
|
794
|
-
makeDecision: (
|
|
795
|
-
type:
|
|
1047
|
+
makeDecision: (a) => s({
|
|
1048
|
+
type: tt.Component,
|
|
796
1049
|
attributeId: i.id,
|
|
797
|
-
state:
|
|
1050
|
+
state: a
|
|
798
1051
|
})
|
|
799
1052
|
};
|
|
800
1053
|
}
|
|
801
1054
|
);
|
|
802
1055
|
}
|
|
803
|
-
function
|
|
804
|
-
return
|
|
805
|
-
const
|
|
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:
|
|
809
|
-
return
|
|
1061
|
+
const { explain: l, applySolution: p } = a(e), S = o(c, s, a);
|
|
1062
|
+
return S === D ? D : {
|
|
810
1063
|
attribute: c,
|
|
811
|
-
isMandatory:
|
|
812
|
-
explain: (F,
|
|
813
|
-
const
|
|
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:
|
|
1068
|
+
subject: N,
|
|
816
1069
|
attributeId: c.id
|
|
817
1070
|
};
|
|
818
|
-
return ot
|
|
1071
|
+
return dt(ot).with("decisions", ($) => l(x, $)).with("constraints", ($) => l(x, $)).with("full", ($) => l(x, $)).exhaustive();
|
|
819
1072
|
},
|
|
820
|
-
applySolution:
|
|
821
|
-
...
|
|
1073
|
+
applySolution: p,
|
|
1074
|
+
...S
|
|
822
1075
|
};
|
|
823
1076
|
}));
|
|
824
1077
|
}
|
|
825
|
-
function
|
|
826
|
-
const n =
|
|
827
|
-
return "write" in t ? f((i) => i(n), (i, o, ...
|
|
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
|
|
830
|
-
isInitializing:
|
|
831
|
-
error:
|
|
1082
|
+
const hn = y.struct({
|
|
1083
|
+
isInitializing: Dt.Eq,
|
|
1084
|
+
error: y.eqNullable(y.eqStrict)
|
|
832
1085
|
});
|
|
833
|
-
function
|
|
834
|
-
const
|
|
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
|
-
|
|
840
|
-
],
|
|
841
|
-
const c =
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
),
|
|
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: !(!
|
|
847
|
-
error:
|
|
1099
|
+
isInitializing: !(!l.isInitializing && c),
|
|
1100
|
+
error: l.error
|
|
848
1101
|
};
|
|
849
1102
|
});
|
|
850
|
-
return
|
|
1103
|
+
return Jt(a, hn);
|
|
851
1104
|
}
|
|
852
|
-
const
|
|
853
|
-
isUpdating:
|
|
854
|
-
error:
|
|
1105
|
+
const An = y.struct({
|
|
1106
|
+
isUpdating: Dt.Eq,
|
|
1107
|
+
error: y.eqNullable(y.eqStrict)
|
|
855
1108
|
});
|
|
856
|
-
function
|
|
857
|
-
return
|
|
1109
|
+
function pn(t) {
|
|
1110
|
+
return Jt(t, An);
|
|
858
1111
|
}
|
|
859
|
-
function
|
|
860
|
-
return
|
|
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
|
|
1121
|
+
function yn(t, e) {
|
|
869
1122
|
const n = {
|
|
870
|
-
question:
|
|
871
|
-
subject:
|
|
1123
|
+
question: qt.whyIsNotSatisfied,
|
|
1124
|
+
subject: K.configuration
|
|
872
1125
|
};
|
|
873
|
-
return
|
|
874
|
-
const
|
|
1126
|
+
return I((i, o) => {
|
|
1127
|
+
const r = o(t);
|
|
875
1128
|
return {
|
|
876
1129
|
isSatisfied: o(e),
|
|
877
|
-
explain: (
|
|
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
|
|
882
|
-
return
|
|
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
|
|
890
|
-
return
|
|
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
|
|
898
|
-
return
|
|
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
|
|
906
|
-
return
|
|
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
|
|
915
|
-
return f((e) => e(t) ??
|
|
916
|
-
}
|
|
917
|
-
function
|
|
918
|
-
const { sessionInitializationAtom: e, sessionUpdatingAtom: n } =
|
|
919
|
-
guardedConfigurationSessionAtom:
|
|
920
|
-
guardedConfigurationAtom:
|
|
921
|
-
guardedIsSatisfiedAtom:
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
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:
|
|
935
|
-
configurationUpdatingAtom:
|
|
936
|
-
makeDecisionAtom:
|
|
937
|
-
explainAtom:
|
|
938
|
-
decisionQueriesAtom:
|
|
939
|
-
taskSchedulingAtom:
|
|
940
|
-
configurationSatisfactionAtom:
|
|
941
|
-
configurationStoringAtom:
|
|
942
|
-
configurationResetAtom:
|
|
943
|
-
sessionReinitializationAtom:
|
|
944
|
-
choiceAttributeAtomFamily:
|
|
945
|
-
numericAttributeAtomFamily:
|
|
946
|
-
booleanAttributeAtomFamily:
|
|
947
|
-
componentAttributeAtomFamily:
|
|
948
|
-
subscriberAtom:
|
|
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
|
|
952
|
-
function
|
|
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
|
|
1219
|
+
return gt((o) => {
|
|
964
1220
|
o(t.configurationAtom);
|
|
965
|
-
const
|
|
966
|
-
if (
|
|
1221
|
+
const r = o(t.attributesAtom);
|
|
1222
|
+
if (r == null)
|
|
967
1223
|
return;
|
|
968
|
-
|
|
969
|
-
const
|
|
970
|
-
|
|
971
|
-
for (const
|
|
972
|
-
const c =
|
|
973
|
-
o.peek(c) == null && (
|
|
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
|
|
976
|
-
for (const
|
|
977
|
-
for (const c of [...
|
|
978
|
-
|
|
979
|
-
},
|
|
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(
|
|
1237
|
+
clearTimeout(s);
|
|
982
1238
|
};
|
|
983
1239
|
});
|
|
984
1240
|
}
|
|
985
|
-
function
|
|
1241
|
+
function Rn(t, e, n) {
|
|
986
1242
|
return {
|
|
987
|
-
addSessionListenersEffect:
|
|
988
|
-
cleanupAtomFamiliesEffect:
|
|
989
|
-
atomSubscriberEffect:
|
|
990
|
-
atomSubscriptionCleanupEffect:
|
|
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
|
|
1249
|
+
function kn(t) {
|
|
994
1250
|
return {
|
|
995
|
-
configurationAtom:
|
|
996
|
-
configurationStoringAtom:
|
|
997
|
-
configurationSatisfactionAtom:
|
|
998
|
-
storedConfigurationAtom:
|
|
999
|
-
decisionsAtom:
|
|
1000
|
-
explicitDecisionsAtom:
|
|
1001
|
-
implicitDecisionsAtom:
|
|
1002
|
-
makeDecisionAtom:
|
|
1003
|
-
decisionQueriesAtom:
|
|
1004
|
-
configurationResetAtom:
|
|
1005
|
-
sessionReinitializationAtom:
|
|
1006
|
-
explainAtom:
|
|
1007
|
-
taskSchedulingAtom:
|
|
1008
|
-
choiceAttributeAtomFamily:
|
|
1009
|
-
numericAttributeAtomFamily:
|
|
1010
|
-
booleanAttributeAtomFamily:
|
|
1011
|
-
componentAttributeAtomFamily:
|
|
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
|
|
1015
|
-
const t =
|
|
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:
|
|
1276
|
+
effects: Rn(t, e, n)
|
|
1021
1277
|
};
|
|
1022
1278
|
}
|
|
1023
|
-
const
|
|
1024
|
-
function
|
|
1025
|
-
const { primitives: { sessionManagementMachineAtom: e } } =
|
|
1026
|
-
return
|
|
1027
|
-
n({ type: "SessionContextChanged", sessionContext: t.sessionContext }), t.sessionContext || console.warn(
|
|
1028
|
-
}, [t.sessionContext]),
|
|
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
|
|
1033
|
-
const e =
|
|
1034
|
-
return /* @__PURE__ */
|
|
1035
|
-
/* @__PURE__ */
|
|
1036
|
-
/* @__PURE__ */
|
|
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
|
|
1041
|
-
return t.jotaiStore ? /* @__PURE__ */
|
|
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
|
|
1044
|
-
const e =
|
|
1045
|
-
return /* @__PURE__ */
|
|
1299
|
+
function qn(t) {
|
|
1300
|
+
const e = nt();
|
|
1301
|
+
return /* @__PURE__ */ w(ne, { store: e, children: t.children });
|
|
1046
1302
|
}
|
|
1047
|
-
function
|
|
1048
|
-
const { selectors: { configurationInitializationAtom: t } } =
|
|
1049
|
-
return
|
|
1303
|
+
function zn() {
|
|
1304
|
+
const { selectors: { configurationInitializationAtom: t } } = V(), e = nt();
|
|
1305
|
+
return Y(t, { store: e });
|
|
1050
1306
|
}
|
|
1051
|
-
function
|
|
1052
|
-
const { selectors: { configurationUpdatingAtom: t } } =
|
|
1053
|
-
return
|
|
1307
|
+
function Un() {
|
|
1308
|
+
const { selectors: { configurationUpdatingAtom: t } } = V(), e = nt();
|
|
1309
|
+
return Y(t, { store: e });
|
|
1054
1310
|
}
|
|
1055
|
-
const
|
|
1056
|
-
function
|
|
1057
|
-
const n = typeof t == "string" ? t : void 0, i = typeof t == "boolean" ? t : e, o =
|
|
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
|
|
1061
|
-
const { selectors: t } =
|
|
1062
|
-
return
|
|
1316
|
+
function pi() {
|
|
1317
|
+
const { selectors: t } = V();
|
|
1318
|
+
return Q(() => ({
|
|
1063
1319
|
getConfigurationInitializationAtom: t.configurationInitializationAtom,
|
|
1064
1320
|
getConfigurationUpdatingAtom: t.configurationUpdatingAtom,
|
|
1065
|
-
createAttributesAtom:
|
|
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
|
|
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
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
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
|
};
|