@viamedici-spc/configurator-react 0.1.3 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +2 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +37 -8
- package/dist/index.js +322 -894
- package/package.json +9 -7
package/dist/index.js
CHANGED
|
@@ -1,816 +1,254 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { createContext as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return e.concat(s || Array.prototype.slice.call(n));
|
|
13
|
-
};
|
|
14
|
-
function O(e) {
|
|
15
|
-
return e;
|
|
16
|
-
}
|
|
17
|
-
function Ce(e) {
|
|
18
|
-
return function() {
|
|
19
|
-
return e;
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
var en = /* @__PURE__ */ Ce(null), ye = /* @__PURE__ */ Ce(void 0), nn = ye;
|
|
23
|
-
function Se(e, n, t, i, o, s, a, g, u) {
|
|
24
|
-
switch (arguments.length) {
|
|
25
|
-
case 1:
|
|
26
|
-
return e;
|
|
27
|
-
case 2:
|
|
28
|
-
return function() {
|
|
29
|
-
return n(e.apply(this, arguments));
|
|
30
|
-
};
|
|
31
|
-
case 3:
|
|
32
|
-
return function() {
|
|
33
|
-
return t(n(e.apply(this, arguments)));
|
|
34
|
-
};
|
|
35
|
-
case 4:
|
|
36
|
-
return function() {
|
|
37
|
-
return i(t(n(e.apply(this, arguments))));
|
|
38
|
-
};
|
|
39
|
-
case 5:
|
|
40
|
-
return function() {
|
|
41
|
-
return o(i(t(n(e.apply(this, arguments)))));
|
|
42
|
-
};
|
|
43
|
-
case 6:
|
|
44
|
-
return function() {
|
|
45
|
-
return s(o(i(t(n(e.apply(this, arguments))))));
|
|
46
|
-
};
|
|
47
|
-
case 7:
|
|
48
|
-
return function() {
|
|
49
|
-
return a(s(o(i(t(n(e.apply(this, arguments)))))));
|
|
50
|
-
};
|
|
51
|
-
case 8:
|
|
52
|
-
return function() {
|
|
53
|
-
return g(a(s(o(i(t(n(e.apply(this, arguments))))))));
|
|
54
|
-
};
|
|
55
|
-
case 9:
|
|
56
|
-
return function() {
|
|
57
|
-
return u(g(a(s(o(i(t(n(e.apply(this, arguments)))))))));
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
function r(e, n, t, i, o, s, a, g, u) {
|
|
62
|
-
switch (arguments.length) {
|
|
63
|
-
case 1:
|
|
64
|
-
return e;
|
|
65
|
-
case 2:
|
|
66
|
-
return n(e);
|
|
67
|
-
case 3:
|
|
68
|
-
return t(n(e));
|
|
69
|
-
case 4:
|
|
70
|
-
return i(t(n(e)));
|
|
71
|
-
case 5:
|
|
72
|
-
return o(i(t(n(e))));
|
|
73
|
-
case 6:
|
|
74
|
-
return s(o(i(t(n(e)))));
|
|
75
|
-
case 7:
|
|
76
|
-
return a(s(o(i(t(n(e))))));
|
|
77
|
-
case 8:
|
|
78
|
-
return g(a(s(o(i(t(n(e)))))));
|
|
79
|
-
case 9:
|
|
80
|
-
return u(g(a(s(o(i(t(n(e))))))));
|
|
81
|
-
default: {
|
|
82
|
-
for (var h = arguments[0], x = 1; x < arguments.length; x++)
|
|
83
|
-
h = arguments[x](h);
|
|
84
|
-
return h;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
var te = function(e, n) {
|
|
89
|
-
var t = typeof e == "number" ? function(i) {
|
|
90
|
-
return i.length >= e;
|
|
91
|
-
} : e;
|
|
92
|
-
return function() {
|
|
93
|
-
var i = Array.from(arguments);
|
|
94
|
-
return t(arguments) ? n.apply(this, i) : function(o) {
|
|
95
|
-
return n.apply(void 0, Ze([o], i, !1));
|
|
96
|
-
};
|
|
97
|
-
};
|
|
98
|
-
};
|
|
99
|
-
globalThis && globalThis.__spreadArray;
|
|
100
|
-
var ve = function(e) {
|
|
101
|
-
return e._tag === "Some";
|
|
102
|
-
}, Ee = { _tag: "None" }, Ae = function(e) {
|
|
103
|
-
return { _tag: "Some", value: e };
|
|
104
|
-
}, tn = function(e) {
|
|
105
|
-
return e.length > 0;
|
|
106
|
-
}, on = [], sn = Object.prototype.hasOwnProperty;
|
|
107
|
-
function rn(e) {
|
|
108
|
-
return function(n, t) {
|
|
109
|
-
return e.chain(n, function(i) {
|
|
110
|
-
return e.map(t(i), function() {
|
|
111
|
-
return i;
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
var v = function(e) {
|
|
117
|
-
return {
|
|
118
|
-
equals: function(n, t) {
|
|
119
|
-
return n === t || e(n, t);
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
}, S = function(e) {
|
|
123
|
-
return v(function(n, t) {
|
|
124
|
-
for (var i in e)
|
|
125
|
-
if (!e[i].equals(n[i], t[i]))
|
|
126
|
-
return !1;
|
|
127
|
-
return !0;
|
|
128
|
-
});
|
|
129
|
-
}, be = {
|
|
130
|
-
equals: function(e, n) {
|
|
131
|
-
return e === n;
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
be.equals;
|
|
135
|
-
var y = Ee, P = Ae;
|
|
136
|
-
function H(e) {
|
|
137
|
-
return function(n) {
|
|
138
|
-
return e(n) ? P(n) : y;
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
var an = function(e, n) {
|
|
142
|
-
return r(e, A(n));
|
|
143
|
-
}, un = function(e, n) {
|
|
144
|
-
return r(e, fn(n));
|
|
145
|
-
}, cn = "Option", ln = function(e) {
|
|
146
|
-
return {
|
|
147
|
-
equals: function(n, t) {
|
|
148
|
-
return n === t || (E(n) ? E(t) : E(t) ? !1 : e.equals(n.value, t.value));
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
}, A = function(e) {
|
|
152
|
-
return function(n) {
|
|
153
|
-
return E(n) ? y : P(e(n.value));
|
|
154
|
-
};
|
|
155
|
-
}, fn = function(e) {
|
|
156
|
-
return function(n) {
|
|
157
|
-
return E(n) || E(e) ? y : P(n.value(e.value));
|
|
158
|
-
};
|
|
159
|
-
}, Pe = /* @__PURE__ */ te(2, function(e, n) {
|
|
160
|
-
return E(e) ? y : n(e.value);
|
|
161
|
-
}), gn = {
|
|
162
|
-
URI: cn,
|
|
163
|
-
map: an,
|
|
164
|
-
ap: un,
|
|
165
|
-
chain: Pe
|
|
166
|
-
}, I = function(e) {
|
|
167
|
-
return function(n) {
|
|
168
|
-
return E(n) ? y : e(n.value) ? n : y;
|
|
169
|
-
};
|
|
170
|
-
}, E = function(e) {
|
|
171
|
-
return e._tag === "None";
|
|
172
|
-
}, dn = function(e, n) {
|
|
173
|
-
return function(t) {
|
|
174
|
-
return E(t) ? e() : n(t.value);
|
|
175
|
-
};
|
|
176
|
-
}, ie = dn, pn = function(e) {
|
|
177
|
-
return function(n) {
|
|
178
|
-
return E(n) ? e() : n.value;
|
|
179
|
-
};
|
|
180
|
-
}, U = pn, mn = /* @__PURE__ */ te(2, rn(gn)), l = function(e) {
|
|
181
|
-
return e == null ? y : P(e);
|
|
182
|
-
}, W = /* @__PURE__ */ ie(en, O), D = /* @__PURE__ */ ie(ye, O), hn = Pe, Cn = mn, oe = {
|
|
183
|
-
equals: function(e, n) {
|
|
184
|
-
return e === n;
|
|
185
|
-
}
|
|
186
|
-
}, yn = {
|
|
187
|
-
equals: oe.equals,
|
|
188
|
-
compare: function(e, n) {
|
|
189
|
-
return e < n ? -1 : e > n ? 1 : 0;
|
|
190
|
-
}
|
|
191
|
-
};
|
|
192
|
-
oe.equals, yn.compare;
|
|
193
|
-
globalThis && globalThis.__spreadArray;
|
|
194
|
-
var Sn = on, vn = tn;
|
|
195
|
-
globalThis && globalThis.__spreadArray;
|
|
196
|
-
var En = function(e) {
|
|
197
|
-
return e.length === 0;
|
|
198
|
-
}, Ie = vn, An = function(e) {
|
|
199
|
-
return function(n) {
|
|
200
|
-
if (En(n))
|
|
201
|
-
return In;
|
|
202
|
-
for (var t = [], i = 0; i < n.length; i++)
|
|
203
|
-
t.push.apply(t, e(i, n[i]));
|
|
204
|
-
return t;
|
|
205
|
-
};
|
|
206
|
-
};
|
|
207
|
-
function qe(e) {
|
|
208
|
-
return function(n) {
|
|
209
|
-
for (var t = 0; t < n.length; t++)
|
|
210
|
-
if (e(n[t]))
|
|
211
|
-
return Ae(n[t]);
|
|
212
|
-
return Ee;
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
var bn = function(e, n, t) {
|
|
216
|
-
for (var i = [], o = Math.min(e.length, n.length), s = 0; s < o; s++)
|
|
217
|
-
i[s] = t(e[s], n[s]);
|
|
218
|
-
return i;
|
|
219
|
-
};
|
|
220
|
-
function Me(e, n) {
|
|
221
|
-
return n === void 0 ? function(t) {
|
|
222
|
-
return Me(t, e);
|
|
223
|
-
} : bn(e, n, function(t, i) {
|
|
224
|
-
return [t, i];
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
var we = /* @__PURE__ */ te(2, function(e, n) {
|
|
228
|
-
return r(e, An(function(t, i) {
|
|
229
|
-
return n(i, t);
|
|
230
|
-
}));
|
|
231
|
-
}), xe = /* @__PURE__ */ we(O), b = function(e) {
|
|
232
|
-
return function(n) {
|
|
233
|
-
return n.map(function(t) {
|
|
234
|
-
return e(t);
|
|
235
|
-
});
|
|
236
|
-
};
|
|
237
|
-
}, p = function(e) {
|
|
238
|
-
return function(n) {
|
|
239
|
-
return n.filter(e);
|
|
240
|
-
};
|
|
241
|
-
}, Pn = function(e) {
|
|
242
|
-
return function(n) {
|
|
243
|
-
for (var t = [], i = 0; i < n.length; i++) {
|
|
244
|
-
var o = e(i, n[i]);
|
|
245
|
-
ve(o) && t.push(o.value);
|
|
246
|
-
}
|
|
247
|
-
return t;
|
|
248
|
-
};
|
|
249
|
-
}, w = function(e) {
|
|
250
|
-
return Pn(function(n, t) {
|
|
251
|
-
return e(t);
|
|
252
|
-
});
|
|
253
|
-
}, Y = /* @__PURE__ */ w(O), K = function(e) {
|
|
254
|
-
return v(function(n, t) {
|
|
255
|
-
return n.length === t.length && n.every(function(i, o) {
|
|
256
|
-
return e.equals(i, t[o]);
|
|
257
|
-
});
|
|
258
|
-
});
|
|
259
|
-
}, In = Sn;
|
|
260
|
-
function qn(e) {
|
|
261
|
-
return function(n) {
|
|
262
|
-
return n.every(e);
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
var Mn = we, c = {
|
|
266
|
-
equals: function(e, n) {
|
|
267
|
-
return e === n;
|
|
268
|
-
}
|
|
269
|
-
};
|
|
270
|
-
c.equals;
|
|
271
|
-
var Re = {
|
|
272
|
-
equals: function(e, n) {
|
|
273
|
-
return e === n;
|
|
274
|
-
}
|
|
275
|
-
};
|
|
276
|
-
Re.equals;
|
|
277
|
-
function Ue(e) {
|
|
278
|
-
return function(n, t) {
|
|
279
|
-
if (t === void 0) {
|
|
280
|
-
var i = Ue(e);
|
|
281
|
-
return function(s) {
|
|
282
|
-
return i(s, n);
|
|
283
|
-
};
|
|
284
|
-
}
|
|
285
|
-
for (var o in n)
|
|
286
|
-
if (!sn.call(t, o) || !e.equals(n[o], t[o]))
|
|
287
|
-
return !1;
|
|
288
|
-
return !0;
|
|
289
|
-
};
|
|
290
|
-
}
|
|
291
|
-
function De(e) {
|
|
292
|
-
var n = Ue(e);
|
|
293
|
-
return v(function(t, i) {
|
|
294
|
-
return n(t)(i) && n(i)(t);
|
|
295
|
-
});
|
|
296
|
-
}
|
|
297
|
-
function se(e) {
|
|
298
|
-
return {
|
|
299
|
-
equals(n, t) {
|
|
300
|
-
return n == null && t == null ? !0 : n == null || t === null || t === void 0 ? !1 : e.equals(n, t);
|
|
301
|
-
}
|
|
302
|
-
};
|
|
303
|
-
}
|
|
304
|
-
function $(e) {
|
|
305
|
-
return {
|
|
306
|
-
equals(n, t) {
|
|
307
|
-
const i = r(l(n), U(() => [])), o = r(l(t), U(() => []));
|
|
308
|
-
return K(e).equals(i, o);
|
|
309
|
-
}
|
|
310
|
-
};
|
|
311
|
-
}
|
|
312
|
-
const N = S({
|
|
313
|
-
localId: c,
|
|
314
|
-
componentPath: $(c),
|
|
315
|
-
sharedConfigurationModelId: se(c)
|
|
316
|
-
}), wn = S({
|
|
317
|
-
localId: c,
|
|
318
|
-
configurationModelId: c
|
|
319
|
-
}), xn = v((e, n) => Je({ x: e, y: n }).with({
|
|
320
|
-
x: {
|
|
321
|
-
type: "Choice"
|
|
322
|
-
/* Choice */
|
|
323
|
-
},
|
|
324
|
-
y: {
|
|
325
|
-
type: "Choice"
|
|
326
|
-
/* Choice */
|
|
327
|
-
}
|
|
328
|
-
}, (t) => Rn.equals(t.x, t.y)).with({
|
|
329
|
-
x: {
|
|
330
|
-
type: "Component"
|
|
331
|
-
/* Component */
|
|
332
|
-
},
|
|
333
|
-
y: {
|
|
334
|
-
type: "Component"
|
|
335
|
-
/* Component */
|
|
336
|
-
}
|
|
337
|
-
}, (t) => Un.equals(t.x, t.y)).with({
|
|
338
|
-
x: {
|
|
339
|
-
type: "Numeric"
|
|
340
|
-
/* Numeric */
|
|
341
|
-
},
|
|
342
|
-
y: {
|
|
343
|
-
type: "Numeric"
|
|
344
|
-
/* Numeric */
|
|
345
|
-
}
|
|
346
|
-
}, (t) => Dn.equals(t.x, t.y)).with({
|
|
347
|
-
x: {
|
|
348
|
-
type: "Boolean"
|
|
349
|
-
/* Boolean */
|
|
350
|
-
},
|
|
351
|
-
y: {
|
|
352
|
-
type: "Boolean"
|
|
353
|
-
/* Boolean */
|
|
354
|
-
}
|
|
355
|
-
}, (t) => Nn.equals(t.x, t.y)).otherwise(() => !1)), Rn = S({
|
|
356
|
-
type: c,
|
|
357
|
-
attributeId: N,
|
|
358
|
-
state: c,
|
|
359
|
-
choiceValueId: c
|
|
360
|
-
}), Un = S({
|
|
361
|
-
type: c,
|
|
362
|
-
attributeId: N,
|
|
363
|
-
state: c
|
|
364
|
-
}), Dn = S({
|
|
365
|
-
type: c,
|
|
366
|
-
attributeId: N,
|
|
367
|
-
state: oe
|
|
368
|
-
}), Nn = S({
|
|
369
|
-
type: c,
|
|
370
|
-
attributeId: N,
|
|
371
|
-
state: Re
|
|
372
|
-
});
|
|
373
|
-
var q = /* @__PURE__ */ ((e) => (e.whyIsNotSatisfied = "why-is-not-satisfied", e.whyIsStateNotPossible = "why-is-state-not-possible", e))(q || {}), M = /* @__PURE__ */ ((e) => (e.choiceValue = "choice-value", e.component = "component", e.boolean = "boolean", e.numeric = "numeric", e.configuration = "configuration", e.attribute = "attribute", e))(M || {}), f = /* @__PURE__ */ ((e) => (e.Boolean = "Boolean", e.Numeric = "Numeric", e.Choice = "Choice", e.Component = "Component", e))(f || {}), G = /* @__PURE__ */ ((e) => (e.Implicit = "Implicit", e.Explicit = "Explicit", e))(G || {});
|
|
374
|
-
const ge = S({
|
|
375
|
-
localId: c,
|
|
376
|
-
componentPath: $(c),
|
|
377
|
-
sharedConfigurationModel: se(c)
|
|
378
|
-
}), _n = ln(K(S({
|
|
379
|
-
attributeId: ge,
|
|
380
|
-
decisions: $(ge)
|
|
381
|
-
})));
|
|
382
|
-
S({
|
|
383
|
-
configurationModelSource: v((e, n) => me(e, n)),
|
|
384
|
-
decisionsToRespect: _n,
|
|
385
|
-
usageRuleParameters: De(c)
|
|
386
|
-
});
|
|
387
|
-
S({
|
|
388
|
-
localId: c,
|
|
389
|
-
componentPath: $(c),
|
|
390
|
-
sharedConfigurationModelId: se(c)
|
|
391
|
-
});
|
|
392
|
-
function Tn(e, n) {
|
|
393
|
-
return r(
|
|
394
|
-
e.values,
|
|
395
|
-
w((t) => r(
|
|
396
|
-
t.decision,
|
|
397
|
-
l,
|
|
398
|
-
I((i) => i.kind === n)
|
|
399
|
-
))
|
|
400
|
-
);
|
|
401
|
-
}
|
|
402
|
-
function kn(e) {
|
|
403
|
-
return r(
|
|
404
|
-
e.decision,
|
|
405
|
-
l,
|
|
406
|
-
I((n) => n.kind === G.Explicit),
|
|
407
|
-
W
|
|
408
|
-
);
|
|
409
|
-
}
|
|
410
|
-
function zn(e) {
|
|
411
|
-
return r(
|
|
412
|
-
e.decision,
|
|
413
|
-
l,
|
|
414
|
-
I((n) => n.kind === G.Explicit),
|
|
415
|
-
W
|
|
416
|
-
);
|
|
417
|
-
}
|
|
418
|
-
function On(e) {
|
|
419
|
-
return r(
|
|
420
|
-
e.decision,
|
|
421
|
-
l,
|
|
422
|
-
W
|
|
423
|
-
);
|
|
424
|
-
}
|
|
425
|
-
const Ne = (e) => e.type === f.Boolean, _e = (e) => e.type === f.Choice, Te = (e) => e.type === f.Numeric, ke = (e) => e.type === f.Component, $n = $(c);
|
|
426
|
-
function jn(e, n, t) {
|
|
427
|
-
var i;
|
|
428
|
-
const o = ((i = n.componentPath) == null ? void 0 : i.length) ?? 0;
|
|
429
|
-
return r(e, p((s) => {
|
|
430
|
-
var a;
|
|
431
|
-
const g = ((a = s.id.componentPath) == null ? void 0 : a.length) ?? 0;
|
|
432
|
-
return t ? o > g ? !1 : r(
|
|
433
|
-
s.id.componentPath ?? [],
|
|
434
|
-
Me(n.componentPath ?? []),
|
|
435
|
-
qn(([u, h]) => u === h)
|
|
436
|
-
) : $n.equals(s.id.componentPath, n.componentPath);
|
|
437
|
-
}));
|
|
438
|
-
}
|
|
439
|
-
function Bn(e, n, t) {
|
|
440
|
-
return [];
|
|
441
|
-
}
|
|
442
|
-
function Fn(e) {
|
|
443
|
-
return r(e, p((n) => {
|
|
444
|
-
const t = r(
|
|
445
|
-
n.id.componentPath,
|
|
446
|
-
l,
|
|
447
|
-
A((o) => o.length === 0),
|
|
448
|
-
U(() => !0)
|
|
449
|
-
), i = r(
|
|
450
|
-
n.id.sharedConfigurationModelId,
|
|
451
|
-
l,
|
|
452
|
-
ie(() => !0, () => !1)
|
|
453
|
-
);
|
|
454
|
-
return t && i;
|
|
455
|
-
}));
|
|
456
|
-
}
|
|
457
|
-
function Vn(e, n) {
|
|
458
|
-
return r(
|
|
459
|
-
ze(e),
|
|
460
|
-
b((t) => Tn(t, n)),
|
|
461
|
-
xe,
|
|
462
|
-
w((t) => l(t))
|
|
463
|
-
);
|
|
464
|
-
}
|
|
465
|
-
function Hn(e, n) {
|
|
466
|
-
return r(
|
|
467
|
-
$e(e),
|
|
468
|
-
p((t) => {
|
|
469
|
-
var i;
|
|
470
|
-
return ((i = t.decision) == null ? void 0 : i.kind) === n;
|
|
471
|
-
}),
|
|
472
|
-
b((t) => kn(t)),
|
|
473
|
-
w((t) => l(t))
|
|
474
|
-
);
|
|
475
|
-
}
|
|
476
|
-
function Wn(e, n) {
|
|
477
|
-
return r(
|
|
478
|
-
je(e),
|
|
479
|
-
p((t) => {
|
|
480
|
-
var i;
|
|
481
|
-
return ((i = t.decision) == null ? void 0 : i.kind) === n;
|
|
482
|
-
}),
|
|
483
|
-
b((t) => zn(t)),
|
|
484
|
-
w((t) => l(t))
|
|
485
|
-
);
|
|
486
|
-
}
|
|
487
|
-
function Kn(e, n) {
|
|
488
|
-
return r(
|
|
489
|
-
Oe(e),
|
|
490
|
-
p((t) => {
|
|
491
|
-
var i;
|
|
492
|
-
return ((i = t.decision) == null ? void 0 : i.kind) === n;
|
|
493
|
-
}),
|
|
494
|
-
b((t) => On(t)),
|
|
495
|
-
w((t) => l(t))
|
|
496
|
-
);
|
|
497
|
-
}
|
|
498
|
-
function ze(e) {
|
|
499
|
-
return r(
|
|
500
|
-
e.attributes,
|
|
501
|
-
p(_e)
|
|
502
|
-
);
|
|
503
|
-
}
|
|
504
|
-
function Oe(e) {
|
|
505
|
-
return r(
|
|
506
|
-
e.attributes,
|
|
507
|
-
p(ke)
|
|
508
|
-
);
|
|
509
|
-
}
|
|
510
|
-
function $e(e) {
|
|
511
|
-
return r(
|
|
512
|
-
e.attributes,
|
|
513
|
-
p(Te)
|
|
514
|
-
);
|
|
515
|
-
}
|
|
516
|
-
function je(e) {
|
|
517
|
-
return r(
|
|
518
|
-
e.attributes,
|
|
519
|
-
p(Ne)
|
|
520
|
-
);
|
|
521
|
-
}
|
|
522
|
-
function Gn(e, n) {
|
|
523
|
-
return r(
|
|
524
|
-
j(e, n),
|
|
525
|
-
D
|
|
526
|
-
);
|
|
527
|
-
}
|
|
528
|
-
function Jn(e, n) {
|
|
529
|
-
return r(
|
|
530
|
-
Be(e, n),
|
|
531
|
-
D
|
|
532
|
-
);
|
|
533
|
-
}
|
|
534
|
-
function Ln(e, n, t) {
|
|
535
|
-
return r(
|
|
536
|
-
Be(e, n),
|
|
537
|
-
A((i) => i.values),
|
|
538
|
-
hn(Se(qe((i) => i.id === t))),
|
|
539
|
-
D
|
|
540
|
-
);
|
|
541
|
-
}
|
|
542
|
-
function Xn(e, n) {
|
|
543
|
-
return r(
|
|
544
|
-
j(e, n),
|
|
545
|
-
I(Te),
|
|
546
|
-
D
|
|
547
|
-
);
|
|
548
|
-
}
|
|
549
|
-
function Yn(e, n) {
|
|
550
|
-
return r(
|
|
551
|
-
j(e, n),
|
|
552
|
-
I(Ne),
|
|
553
|
-
D
|
|
554
|
-
);
|
|
555
|
-
}
|
|
556
|
-
function Qn(e, n) {
|
|
557
|
-
return r(
|
|
558
|
-
j(e, n),
|
|
559
|
-
I(ke),
|
|
560
|
-
D
|
|
561
|
-
);
|
|
562
|
-
}
|
|
563
|
-
function j(e, n) {
|
|
564
|
-
return r(
|
|
565
|
-
e.attributes,
|
|
566
|
-
qe((t) => N.equals(t.id, n))
|
|
567
|
-
);
|
|
568
|
-
}
|
|
569
|
-
function Be(e, n) {
|
|
570
|
-
return r(
|
|
571
|
-
j(e, n),
|
|
572
|
-
I(_e)
|
|
573
|
-
);
|
|
574
|
-
}
|
|
575
|
-
const _ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
576
|
-
__proto__: null,
|
|
577
|
-
filterAttributesOfComponent: jn,
|
|
578
|
-
filterAttributesOfRoot: Fn,
|
|
579
|
-
filterAttributesOfShared: Bn,
|
|
580
|
-
getAttribute: Gn,
|
|
581
|
-
getBooleanAttribute: Yn,
|
|
582
|
-
getBooleanAttributes: je,
|
|
583
|
-
getBooleanDecisions: Wn,
|
|
584
|
-
getChoiceAttribute: Jn,
|
|
585
|
-
getChoiceAttributes: ze,
|
|
586
|
-
getChoiceDecisions: Vn,
|
|
587
|
-
getChoiceValue: Ln,
|
|
588
|
-
getComponentAttribute: Qn,
|
|
589
|
-
getComponentAttributes: Oe,
|
|
590
|
-
getComponentDecisions: Kn,
|
|
591
|
-
getNumericAttribute: Xn,
|
|
592
|
-
getNumericAttributes: $e,
|
|
593
|
-
getNumericDecisions: Hn
|
|
594
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
595
|
-
q.whyIsNotSatisfied, M.configuration;
|
|
596
|
-
const de = N.equals;
|
|
597
|
-
wn.equals;
|
|
598
|
-
xn.equals;
|
|
599
|
-
function ee(e) {
|
|
600
|
-
return v(
|
|
601
|
-
(n, t) => {
|
|
602
|
-
const i = n == null, o = t == null;
|
|
603
|
-
return i && o || !i && !o && e.equals(n, t);
|
|
604
|
-
}
|
|
605
|
-
);
|
|
606
|
-
}
|
|
607
|
-
const Fe = F(null), Ve = F(null), He = F(null), We = F(null), re = () => V(Fe), T = () => V(We), Ke = "The configuration is not initialized. Consider using the ConfigurationSuspender or unload components manually that make use of any unsafe hook while the configuration is initializing. Check the hooks documentation to see if it is safe to use while the configuration is initializing.";
|
|
608
|
-
function ae(e) {
|
|
1
|
+
import { AttributeType as S, ConfigurationInterpreter as E, DecisionKind as ie, ExplainQuestionSubject as A, ExplainQuestionType as te, globalAttributeIdEquals as oe, globalConstraintIdEquals as re, AllowedRulesInExplainType as h } from "@viamedici-spc/configurator-ts";
|
|
2
|
+
import { pipe as m, RA as l, O as a, some as w, none as M, flow as ae, identity as le, Eq as c, RR as ue, Str as U, constVoid as ce } from "@viamedici-spc/fp-ts-extensions";
|
|
3
|
+
import { createContext as D, useContext as I, useMemo as g, useRef as V, useEffect as de } from "react";
|
|
4
|
+
import { match as v } from "ts-pattern";
|
|
5
|
+
import { jsx as b, Fragment as ge } from "react/jsx-runtime";
|
|
6
|
+
import { createMachine as T, assign as f, sendParent as W, spawn as Q, forwardTo as P, send as fe } from "xstate";
|
|
7
|
+
import { log as C, pure as pe, stop as K } from "xstate/lib/actions";
|
|
8
|
+
import { deepEqual as Ce } from "fast-equals";
|
|
9
|
+
import { useMachine as me } from "@xstate/react";
|
|
10
|
+
const X = D(null), Y = D(null), Z = D(null), $ = D(null), F = () => I(X), x = () => I($), ee = "The configuration is not initialized. Consider using the ConfigurationSuspender or unload components manually that make use of any unsafe hook while the configuration is initializing. Check the hooks documentation to see if it is safe to use while the configuration is initializing.";
|
|
11
|
+
function j(e) {
|
|
609
12
|
if (!e)
|
|
610
|
-
throw new Error(
|
|
13
|
+
throw new Error(ee);
|
|
611
14
|
}
|
|
612
|
-
function
|
|
15
|
+
function R(e) {
|
|
613
16
|
if (!e)
|
|
614
|
-
throw new Error(
|
|
17
|
+
throw new Error(ee);
|
|
615
18
|
}
|
|
616
|
-
function
|
|
617
|
-
const e =
|
|
618
|
-
return
|
|
19
|
+
function N() {
|
|
20
|
+
const e = F();
|
|
21
|
+
return j(e), g(() => ({
|
|
619
22
|
makeDecision: (n) => e.makeDecision(n),
|
|
620
|
-
setManyDecision: (n,
|
|
23
|
+
setManyDecision: (n, s) => e.setMany(n, s)
|
|
621
24
|
}), [e]);
|
|
622
25
|
}
|
|
623
|
-
|
|
26
|
+
globalThis && globalThis.__spreadArray;
|
|
27
|
+
var Se = function(e) {
|
|
28
|
+
return e._tag === "Some";
|
|
29
|
+
}, k = function(e) {
|
|
624
30
|
return function(n) {
|
|
625
|
-
return
|
|
31
|
+
return Se(e(n));
|
|
626
32
|
};
|
|
627
33
|
};
|
|
628
|
-
const
|
|
629
|
-
function
|
|
630
|
-
return e.decision != null && e.decision.kind ===
|
|
34
|
+
const he = k((e) => e.type === S.Choice ? w(e) : M), ye = k((e) => e.type === S.Numeric ? w(e) : M), Ee = k((e) => e.type === S.Boolean ? w(e) : M), xe = k((e) => e.type === S.Component ? w(e) : M);
|
|
35
|
+
function z(e) {
|
|
36
|
+
return e.decision != null && e.decision.kind === ie.Explicit;
|
|
631
37
|
}
|
|
632
|
-
function
|
|
633
|
-
return
|
|
38
|
+
function ne(e) {
|
|
39
|
+
return m(
|
|
634
40
|
e.values,
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
type:
|
|
41
|
+
l.filter(z),
|
|
42
|
+
l.map((n) => ({
|
|
43
|
+
type: S.Choice,
|
|
638
44
|
attributeId: e.id,
|
|
639
45
|
choiceValueId: n.id,
|
|
640
46
|
state: null
|
|
641
47
|
}))
|
|
642
48
|
);
|
|
643
49
|
}
|
|
644
|
-
function
|
|
645
|
-
return
|
|
50
|
+
function Re(e) {
|
|
51
|
+
return m(
|
|
646
52
|
e,
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
type:
|
|
53
|
+
a.fromPredicate(z),
|
|
54
|
+
a.map(() => ({
|
|
55
|
+
type: S.Numeric,
|
|
650
56
|
attributeId: e.id,
|
|
651
57
|
state: null
|
|
652
58
|
}))
|
|
653
59
|
);
|
|
654
60
|
}
|
|
655
|
-
function
|
|
656
|
-
return
|
|
61
|
+
function be(e) {
|
|
62
|
+
return m(
|
|
657
63
|
e,
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
type:
|
|
64
|
+
a.fromPredicate(z),
|
|
65
|
+
a.map(() => ({
|
|
66
|
+
type: S.Boolean,
|
|
661
67
|
attributeId: e.id,
|
|
662
68
|
state: null
|
|
663
69
|
}))
|
|
664
70
|
);
|
|
665
71
|
}
|
|
666
|
-
function
|
|
667
|
-
return
|
|
72
|
+
function Ae(e) {
|
|
73
|
+
return m(
|
|
668
74
|
e,
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
type:
|
|
75
|
+
a.fromPredicate(z),
|
|
76
|
+
a.map(() => ({
|
|
77
|
+
type: S.Component,
|
|
672
78
|
attributeId: e.id,
|
|
673
79
|
state: null
|
|
674
80
|
}))
|
|
675
81
|
);
|
|
676
82
|
}
|
|
677
|
-
function
|
|
678
|
-
return
|
|
679
|
-
|
|
680
|
-
(
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
83
|
+
function Pe(e, n) {
|
|
84
|
+
return m(
|
|
85
|
+
E.filterAttributesOfComponent(n, e, !0),
|
|
86
|
+
(s) => [
|
|
87
|
+
m(
|
|
88
|
+
s,
|
|
89
|
+
l.filter(he),
|
|
90
|
+
l.chain(ne)
|
|
685
91
|
),
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
92
|
+
m(
|
|
93
|
+
s,
|
|
94
|
+
l.filter(ye),
|
|
95
|
+
l.map(Re),
|
|
96
|
+
l.compact
|
|
691
97
|
),
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
98
|
+
m(
|
|
99
|
+
s,
|
|
100
|
+
l.filter(Ee),
|
|
101
|
+
l.map(be),
|
|
102
|
+
l.compact
|
|
697
103
|
),
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
104
|
+
m(
|
|
105
|
+
s,
|
|
106
|
+
l.filter(xe),
|
|
107
|
+
l.map(Ae),
|
|
108
|
+
l.compact
|
|
703
109
|
)
|
|
704
110
|
],
|
|
705
|
-
|
|
111
|
+
l.flatten
|
|
706
112
|
);
|
|
707
113
|
}
|
|
708
|
-
function
|
|
709
|
-
const
|
|
710
|
-
return
|
|
711
|
-
() =>
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
114
|
+
function qe() {
|
|
115
|
+
const e = F();
|
|
116
|
+
return j(e), g(() => ({
|
|
117
|
+
explain: (n, s) => v(s).with("decisions", (i) => e.explain(n, i)).with("constraints", (i) => e.explain(n, i)).with("full", (i) => e.explain(n, i)).exhaustive(),
|
|
118
|
+
applySolution: (n) => e.applySolution(n)
|
|
119
|
+
}), [e]);
|
|
120
|
+
}
|
|
121
|
+
function en(e, n = !1) {
|
|
122
|
+
const s = x();
|
|
123
|
+
return R(s), g(
|
|
124
|
+
() => m(
|
|
125
|
+
a.fromNullable(e),
|
|
126
|
+
a.map(ae(
|
|
127
|
+
l.map((i) => E.getAttribute(s, i)),
|
|
128
|
+
n ? l.filterMap(a.fromNullable) : le
|
|
716
129
|
)),
|
|
717
|
-
|
|
130
|
+
a.getOrElse(() => s.attributes)
|
|
718
131
|
),
|
|
719
|
-
[e,
|
|
132
|
+
[e, s, n]
|
|
720
133
|
);
|
|
721
134
|
}
|
|
722
|
-
function
|
|
723
|
-
const n =
|
|
724
|
-
|
|
725
|
-
const o =
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
makeDecision: (g, u) => t({
|
|
729
|
-
type: f.Choice,
|
|
135
|
+
function nn(e) {
|
|
136
|
+
const n = x(), { makeDecision: s, setManyDecision: i } = N(), t = _(e, A.choiceValue);
|
|
137
|
+
R(n);
|
|
138
|
+
const o = E.getChoiceAttribute(n, e), u = g(() => ({
|
|
139
|
+
makeDecision: (r, p) => s({
|
|
140
|
+
type: S.Choice,
|
|
730
141
|
attributeId: e,
|
|
731
|
-
choiceValueId:
|
|
732
|
-
state:
|
|
142
|
+
choiceValueId: r,
|
|
143
|
+
state: p
|
|
733
144
|
}),
|
|
734
|
-
clearDecisions:
|
|
145
|
+
clearDecisions: m(
|
|
735
146
|
o,
|
|
736
|
-
|
|
737
|
-
|
|
147
|
+
a.fromNullable,
|
|
148
|
+
a.map(ne),
|
|
738
149
|
// Only setMany if there are decisions to clear.
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
)
|
|
743
|
-
|
|
744
|
-
}), [e, o,
|
|
745
|
-
...
|
|
150
|
+
a.filter(l.isNonEmpty),
|
|
151
|
+
a.map((r) => () => i(r, { type: "Default" })),
|
|
152
|
+
a.getOrElse(() => () => Promise.resolve())
|
|
153
|
+
),
|
|
154
|
+
...t
|
|
155
|
+
}), [e, o, s, i, t]), d = g(() => ({
|
|
156
|
+
...u,
|
|
746
157
|
attribute: o
|
|
747
|
-
}), [o,
|
|
158
|
+
}), [o, u]);
|
|
748
159
|
if (o)
|
|
749
|
-
return
|
|
750
|
-
}
|
|
751
|
-
function
|
|
752
|
-
const n =
|
|
753
|
-
|
|
754
|
-
const
|
|
755
|
-
makeDecision: (
|
|
756
|
-
type:
|
|
160
|
+
return d;
|
|
161
|
+
}
|
|
162
|
+
function sn(e) {
|
|
163
|
+
const n = x(), { makeDecision: s } = N(), i = _(e, A.numeric);
|
|
164
|
+
R(n);
|
|
165
|
+
const t = E.getNumericAttribute(n, e), o = g(() => ({
|
|
166
|
+
makeDecision: (d) => s({
|
|
167
|
+
type: S.Numeric,
|
|
757
168
|
attributeId: e,
|
|
758
|
-
state:
|
|
759
|
-
})
|
|
760
|
-
|
|
169
|
+
state: d
|
|
170
|
+
}),
|
|
171
|
+
...i
|
|
172
|
+
}), [e, s, i]), u = g(() => ({
|
|
761
173
|
...o,
|
|
762
|
-
attribute:
|
|
763
|
-
}), [
|
|
764
|
-
if (
|
|
765
|
-
return
|
|
766
|
-
}
|
|
767
|
-
function
|
|
768
|
-
const n =
|
|
769
|
-
|
|
770
|
-
const
|
|
771
|
-
makeDecision: (
|
|
772
|
-
type:
|
|
174
|
+
attribute: t
|
|
175
|
+
}), [t, o]);
|
|
176
|
+
if (t)
|
|
177
|
+
return u;
|
|
178
|
+
}
|
|
179
|
+
function tn(e) {
|
|
180
|
+
const n = x(), { makeDecision: s } = N(), i = _(e, A.boolean);
|
|
181
|
+
R(n);
|
|
182
|
+
const t = E.getBooleanAttribute(n, e), o = g(() => ({
|
|
183
|
+
makeDecision: (d) => s({
|
|
184
|
+
type: S.Boolean,
|
|
773
185
|
attributeId: e,
|
|
774
|
-
state:
|
|
775
|
-
})
|
|
776
|
-
|
|
186
|
+
state: d
|
|
187
|
+
}),
|
|
188
|
+
...i
|
|
189
|
+
}), [e, s, i]), u = g(() => ({
|
|
777
190
|
...o,
|
|
778
|
-
attribute:
|
|
779
|
-
}), [
|
|
780
|
-
if (
|
|
781
|
-
return
|
|
782
|
-
}
|
|
783
|
-
function
|
|
784
|
-
const n =
|
|
785
|
-
|
|
786
|
-
const o = n.attributes,
|
|
787
|
-
makeDecision: (
|
|
788
|
-
type:
|
|
191
|
+
attribute: t
|
|
192
|
+
}), [t, o]);
|
|
193
|
+
if (t)
|
|
194
|
+
return u;
|
|
195
|
+
}
|
|
196
|
+
function on(e) {
|
|
197
|
+
const n = x(), { makeDecision: s, setManyDecision: i } = N(), t = _(e, A.component);
|
|
198
|
+
R(n);
|
|
199
|
+
const o = n.attributes, u = E.getComponentAttribute(n, e), d = g(() => ({
|
|
200
|
+
makeDecision: (p) => s({
|
|
201
|
+
type: S.Component,
|
|
789
202
|
attributeId: e,
|
|
790
|
-
state:
|
|
203
|
+
state: p
|
|
791
204
|
}),
|
|
792
|
-
clearSubtree:
|
|
793
|
-
|
|
205
|
+
clearSubtree: m(
|
|
206
|
+
Pe(e, o),
|
|
794
207
|
// Only setMany if there are decisions to clear.
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
)
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
208
|
+
a.fromPredicate(l.isNonEmpty),
|
|
209
|
+
a.map((p) => () => i(p, { type: "Default" })),
|
|
210
|
+
a.getOrElse(() => () => Promise.resolve())
|
|
211
|
+
),
|
|
212
|
+
...t
|
|
213
|
+
}), [e, s, o, i, t]), r = g(() => ({
|
|
214
|
+
...d,
|
|
215
|
+
attribute: u
|
|
216
|
+
}), [u, d]);
|
|
217
|
+
if (u)
|
|
218
|
+
return r;
|
|
219
|
+
}
|
|
220
|
+
function _(e, n) {
|
|
221
|
+
const { explain: s, applySolution: i } = qe();
|
|
222
|
+
return g(() => ({
|
|
223
|
+
explain: (t, o) => {
|
|
224
|
+
const u = v(t.question).with(te.whyIsNotSatisfied, () => A.attribute).otherwise(() => n), d = {
|
|
225
|
+
...t,
|
|
226
|
+
subject: u,
|
|
227
|
+
attributeId: e
|
|
228
|
+
};
|
|
229
|
+
return v(o).with("decisions", (r) => s(d, r)).with("constraints", (r) => s(d, r)).with("full", (r) => s(d, r)).exhaustive();
|
|
230
|
+
},
|
|
231
|
+
applySolution: i
|
|
232
|
+
}), [e, n, s, i]);
|
|
233
|
+
}
|
|
234
|
+
const G = c.fromEquals(oe), ve = c.fromEquals(re), we = c.fromEquals((e, n) => ue.getEq(U.Eq).equals(e ?? {}, n ?? {})), Me = c.struct({
|
|
235
|
+
attributeId: G,
|
|
236
|
+
decisions: l.getEq(G)
|
|
237
|
+
}), Ue = c.fromEquals((e, n) => l.getEq(Me).equals(e ?? [], n ?? [])), De = c.struct({
|
|
238
|
+
type: U.Eq
|
|
239
|
+
}), Ie = c.struct({
|
|
240
|
+
type: U.Eq
|
|
241
|
+
}), Ne = c.struct({
|
|
242
|
+
type: U.Eq,
|
|
243
|
+
rules: l.getEq(ve)
|
|
244
|
+
}), ke = c.fromEquals((e, n) => v({ x: e, y: n }).returnType().with({ x: { type: h.all }, y: { type: h.all } }, ({ x: s, y: i }) => De.equals(s, i)).with({ x: { type: h.none }, y: { type: h.none } }, ({ x: s, y: i }) => Ie.equals(s, i)).with({ x: { type: h.specific }, y: { type: h.specific } }, ({ x: s, y: i }) => Ne.equals(s, i)).otherwise(() => !1)), ze = c.struct({
|
|
245
|
+
rules: c.eqNullable(ke)
|
|
246
|
+
}), se = c.struct({
|
|
247
|
+
configurationModelSource: c.fromEquals((e, n) => Ce(e, n)),
|
|
248
|
+
attributeRelations: Ue,
|
|
249
|
+
usageRuleParameters: we,
|
|
250
|
+
allowedInExplain: c.eqNullable(ze)
|
|
251
|
+
}), O = c.eqNullable(se), _e = c.eqStrict, q = c.eqNullable(_e), Oe = () => T({
|
|
814
252
|
predictableActionArguments: !0,
|
|
815
253
|
preserveActionOrder: !0,
|
|
816
254
|
schema: {
|
|
@@ -843,7 +281,7 @@ const at = v((e, n) => De(c).equals(e ?? {}, n ?? {})), ut = S({
|
|
|
843
281
|
ProcessChanges: {
|
|
844
282
|
entry: [
|
|
845
283
|
C("Entering ProcessChanges", "SessionManagement:"),
|
|
846
|
-
|
|
284
|
+
y(
|
|
847
285
|
2
|
|
848
286
|
/* Other */
|
|
849
287
|
)
|
|
@@ -857,7 +295,7 @@ const at = v((e, n) => De(c).equals(e ?? {}, n ?? {})), ut = S({
|
|
|
857
295
|
DisposeSession: {
|
|
858
296
|
entry: [
|
|
859
297
|
C("Entering DisposeSession", "SessionManagement:"),
|
|
860
|
-
|
|
298
|
+
y(
|
|
861
299
|
2
|
|
862
300
|
/* Other */
|
|
863
301
|
)
|
|
@@ -870,7 +308,7 @@ const at = v((e, n) => De(c).equals(e ?? {}, n ?? {})), ut = S({
|
|
|
870
308
|
CreateSession: {
|
|
871
309
|
entry: [
|
|
872
310
|
C("Entering CreateSession", "SessionManagement:"),
|
|
873
|
-
|
|
311
|
+
y(
|
|
874
312
|
0
|
|
875
313
|
/* CreateSession */
|
|
876
314
|
)
|
|
@@ -891,7 +329,7 @@ const at = v((e, n) => De(c).equals(e ?? {}, n ?? {})), ut = S({
|
|
|
891
329
|
SessionCreationFailed: {
|
|
892
330
|
entry: [
|
|
893
331
|
C("Entering SessionCreationFailed", "SessionManagement:"),
|
|
894
|
-
|
|
332
|
+
y(
|
|
895
333
|
2
|
|
896
334
|
/* Other */
|
|
897
335
|
)
|
|
@@ -916,7 +354,7 @@ const at = v((e, n) => De(c).equals(e ?? {}, n ?? {})), ut = S({
|
|
|
916
354
|
UpdateSession: {
|
|
917
355
|
entry: [
|
|
918
356
|
C("Entering UpdateSession", "SessionManagement:"),
|
|
919
|
-
|
|
357
|
+
y(
|
|
920
358
|
1
|
|
921
359
|
/* UpdateSession */
|
|
922
360
|
)
|
|
@@ -936,7 +374,7 @@ const at = v((e, n) => De(c).equals(e ?? {}, n ?? {})), ut = S({
|
|
|
936
374
|
SessionUpdateFailed: {
|
|
937
375
|
entry: [
|
|
938
376
|
C("Entering SessionUpdateFailed", "SessionManagement:"),
|
|
939
|
-
|
|
377
|
+
y(
|
|
940
378
|
2
|
|
941
379
|
/* Other */
|
|
942
380
|
)
|
|
@@ -961,30 +399,30 @@ const at = v((e, n) => De(c).equals(e ?? {}, n ?? {})), ut = S({
|
|
|
961
399
|
}
|
|
962
400
|
}, {
|
|
963
401
|
actions: {
|
|
964
|
-
saveDesiredClient:
|
|
402
|
+
saveDesiredClient: f({
|
|
965
403
|
desiredClient: (e, n) => n.client
|
|
966
404
|
}),
|
|
967
|
-
saveDesiredSessionContext:
|
|
405
|
+
saveDesiredSessionContext: f({
|
|
968
406
|
desiredSessionContext: (e, n) => n.sessionContext
|
|
969
407
|
}),
|
|
970
|
-
disposeOldSession:
|
|
408
|
+
disposeOldSession: f((e, n) => (e.session && e.session.close().then(ce).catch((s) => {
|
|
971
409
|
}), {
|
|
972
410
|
session: null,
|
|
973
411
|
actualClient: null
|
|
974
412
|
})),
|
|
975
|
-
setSessionCreationResult:
|
|
413
|
+
setSessionCreationResult: f((e, n) => ({
|
|
976
414
|
session: n.data.session,
|
|
977
415
|
actualClient: n.data.client
|
|
978
416
|
})),
|
|
979
|
-
setSessionCreationError:
|
|
417
|
+
setSessionCreationError: f((e, n) => ({
|
|
980
418
|
sessionCreationError: n.data
|
|
981
419
|
})),
|
|
982
|
-
clearSessionCreationError:
|
|
983
|
-
setSessionUpdateError:
|
|
420
|
+
clearSessionCreationError: f({ sessionCreationError: () => null }),
|
|
421
|
+
setSessionUpdateError: f((e, n) => ({
|
|
984
422
|
sessionUpdateError: n.data
|
|
985
423
|
})),
|
|
986
|
-
clearSessionUpdateError:
|
|
987
|
-
setHasEverSuccessfullyCreatedSession:
|
|
424
|
+
clearSessionUpdateError: f({ sessionUpdateError: () => null }),
|
|
425
|
+
setHasEverSuccessfullyCreatedSession: f({
|
|
988
426
|
hasEverSuccessfullyCreatedSession: () => !0
|
|
989
427
|
})
|
|
990
428
|
},
|
|
@@ -993,60 +431,60 @@ const at = v((e, n) => De(c).equals(e ?? {}, n ?? {})), ut = S({
|
|
|
993
431
|
session: n,
|
|
994
432
|
client: e.desiredClient
|
|
995
433
|
})).catch((n) => Promise.reject({
|
|
996
|
-
|
|
434
|
+
failureResult: n,
|
|
997
435
|
client: e.desiredClient,
|
|
998
436
|
sessionContext: e.desiredSessionContext
|
|
999
437
|
})),
|
|
1000
438
|
updateSession: (e) => e.session.setSessionContext(e.desiredSessionContext).catch((n) => Promise.reject({
|
|
1001
|
-
|
|
439
|
+
failureResult: n,
|
|
1002
440
|
sessionContext: e.desiredSessionContext
|
|
1003
441
|
}))
|
|
1004
442
|
},
|
|
1005
443
|
guards: {
|
|
1006
|
-
shallDisposeSession: (e) => e.session != null && (e.desiredSessionContext == null || e.desiredClient == null || !
|
|
444
|
+
shallDisposeSession: (e) => e.session != null && (e.desiredSessionContext == null || e.desiredClient == null || !q.equals(e.actualClient, e.desiredClient)),
|
|
1007
445
|
shallCreateSession: (e) => e.session == null && e.desiredClient != null && e.desiredSessionContext != null,
|
|
1008
|
-
shallUpdateSession: (e) => e.session != null && !
|
|
446
|
+
shallUpdateSession: (e) => e.session != null && !se.equals(e.session.getSessionContext(), e.desiredSessionContext),
|
|
1009
447
|
shallImmediatelyProcessChangesAfterSessionCreationError: (e) => (
|
|
1010
448
|
// The desired client and the desired session context is not the same that resulted in the error.
|
|
1011
|
-
!
|
|
449
|
+
!q.equals(e.desiredClient, e.sessionCreationError.client) || !O.equals(e.desiredSessionContext, e.sessionCreationError.sessionContext)
|
|
1012
450
|
),
|
|
1013
451
|
shallImmediatelyProcessChangesAfterSessionUpdateError: (e) => (
|
|
1014
452
|
// The desired client was changed
|
|
1015
|
-
!
|
|
453
|
+
!q.equals(e.desiredClient, e.actualClient) || !O.equals(e.desiredSessionContext, e.sessionUpdateError.sessionContext)
|
|
1016
454
|
)
|
|
1017
455
|
}
|
|
1018
456
|
});
|
|
1019
|
-
function
|
|
1020
|
-
const n = e === 0,
|
|
1021
|
-
return
|
|
1022
|
-
const
|
|
457
|
+
function y(e) {
|
|
458
|
+
const n = e === 0, s = e === 1;
|
|
459
|
+
return pe((i, t) => {
|
|
460
|
+
const o = {
|
|
1023
461
|
isInitializing: (!i.hasEverSuccessfullyCreatedSession || n) && i.sessionCreationError == null,
|
|
1024
|
-
|
|
1025
|
-
},
|
|
1026
|
-
isUpdating:
|
|
1027
|
-
|
|
462
|
+
failureResult: i.sessionCreationError && i.sessionCreationError.failureResult
|
|
463
|
+
}, u = {
|
|
464
|
+
isUpdating: s && i.sessionUpdateError == null,
|
|
465
|
+
failureResult: i.sessionUpdateError && i.sessionUpdateError.failureResult
|
|
1028
466
|
};
|
|
1029
|
-
return
|
|
467
|
+
return W({
|
|
1030
468
|
type: "SessionManagementStateChanged",
|
|
1031
|
-
sessionInitialization:
|
|
1032
|
-
sessionUpdating:
|
|
469
|
+
sessionInitialization: o,
|
|
470
|
+
sessionUpdating: u,
|
|
1033
471
|
session: i.session
|
|
1034
472
|
});
|
|
1035
473
|
});
|
|
1036
474
|
}
|
|
1037
|
-
const
|
|
475
|
+
const Te = (e) => (n) => (n({
|
|
1038
476
|
type: "ConfigurationChanged",
|
|
1039
477
|
session: e,
|
|
1040
478
|
configuration: e.getConfiguration()
|
|
1041
|
-
}), e.setOnConfigurationChangedHandler((
|
|
479
|
+
}), e.setOnConfigurationChangedHandler((s) => {
|
|
1042
480
|
n({
|
|
1043
481
|
type: "ConfigurationChanged",
|
|
1044
482
|
session: e,
|
|
1045
|
-
configuration:
|
|
483
|
+
configuration: s
|
|
1046
484
|
});
|
|
1047
485
|
}), () => {
|
|
1048
486
|
e.setOnConfigurationChangedHandler(null);
|
|
1049
|
-
}),
|
|
487
|
+
}), Fe = () => T({
|
|
1050
488
|
predictableActionArguments: !0,
|
|
1051
489
|
preserveActionOrder: !0,
|
|
1052
490
|
schema: {
|
|
@@ -1060,7 +498,7 @@ const gt = (e) => (n) => (n({
|
|
|
1060
498
|
// Forward the configuration data to the parent.
|
|
1061
499
|
ConfigurationChanged: {
|
|
1062
500
|
actions: [
|
|
1063
|
-
|
|
501
|
+
W((e, n) => n)
|
|
1064
502
|
]
|
|
1065
503
|
}
|
|
1066
504
|
},
|
|
@@ -1099,33 +537,40 @@ const gt = (e) => (n) => (n({
|
|
|
1099
537
|
},
|
|
1100
538
|
invoke: {
|
|
1101
539
|
id: "configurationSubscriptionActor",
|
|
1102
|
-
src: (e, n) =>
|
|
540
|
+
src: (e, n) => Te(e.session)
|
|
1103
541
|
}
|
|
1104
542
|
}
|
|
1105
543
|
}
|
|
1106
544
|
}, {
|
|
1107
545
|
actions: {
|
|
1108
|
-
saveSession:
|
|
546
|
+
saveSession: f((e, n) => ({
|
|
1109
547
|
session: n.session
|
|
1110
548
|
}))
|
|
1111
549
|
}
|
|
1112
|
-
}),
|
|
550
|
+
}), je = () => {
|
|
1113
551
|
let e, n;
|
|
1114
552
|
return {
|
|
1115
|
-
promise: new Promise((i,
|
|
1116
|
-
e = i, n =
|
|
553
|
+
promise: new Promise((i, t) => {
|
|
554
|
+
e = i, n = t;
|
|
1117
555
|
}),
|
|
1118
556
|
resolve: e,
|
|
1119
557
|
reject: n
|
|
1120
558
|
};
|
|
1121
|
-
},
|
|
1122
|
-
const e =
|
|
559
|
+
}, J = () => {
|
|
560
|
+
const e = je();
|
|
1123
561
|
return {
|
|
1124
562
|
capsule: { promise: e.promise },
|
|
1125
563
|
resolve: e.resolve,
|
|
1126
564
|
reject: e.reject
|
|
1127
565
|
};
|
|
1128
|
-
}
|
|
566
|
+
};
|
|
567
|
+
var Be = function(e, n, s) {
|
|
568
|
+
var i = V(), t = V(0);
|
|
569
|
+
return i.current == null && (i.current = e), n.equals(e, i.current) || (s && s.debug && process.env.NODE_ENV !== "production" && console.info("Stable hook update triggered:", { prev: i.current, value: e }), i.current = e, t.current += 1), [t.current];
|
|
570
|
+
}, L = function(e, n, s, i) {
|
|
571
|
+
return de(e, Be(n, s, i));
|
|
572
|
+
};
|
|
573
|
+
const He = () => T({
|
|
1129
574
|
predictableActionArguments: !0,
|
|
1130
575
|
preserveActionOrder: !0,
|
|
1131
576
|
schema: {
|
|
@@ -1139,50 +584,50 @@ const gt = (e) => (n) => (n({
|
|
|
1139
584
|
sessionUpdating: null,
|
|
1140
585
|
session: null,
|
|
1141
586
|
configuration: null,
|
|
1142
|
-
isReadyPromise:
|
|
587
|
+
isReadyPromise: J()
|
|
1143
588
|
},
|
|
1144
589
|
entry: [
|
|
1145
|
-
|
|
1146
|
-
sessionManagementActor: () =>
|
|
1147
|
-
configurationSubscriptionManagementActor: () =>
|
|
590
|
+
f({
|
|
591
|
+
sessionManagementActor: () => Q(Oe()),
|
|
592
|
+
configurationSubscriptionManagementActor: () => Q(Fe())
|
|
1148
593
|
})
|
|
1149
594
|
],
|
|
1150
595
|
exit: [
|
|
1151
|
-
|
|
1152
|
-
|
|
596
|
+
K((e) => e.sessionManagementActor),
|
|
597
|
+
K((e) => e.configurationSubscriptionManagementActor)
|
|
1153
598
|
],
|
|
1154
599
|
on: {
|
|
1155
600
|
// Forward events for sessionManagement
|
|
1156
601
|
ChangeConfigurationClient: {
|
|
1157
602
|
actions: [
|
|
1158
|
-
|
|
603
|
+
P((e) => e.sessionManagementActor)
|
|
1159
604
|
]
|
|
1160
605
|
},
|
|
1161
606
|
ChangeSessionContext: {
|
|
1162
607
|
actions: [
|
|
1163
|
-
|
|
608
|
+
P((e) => e.sessionManagementActor)
|
|
1164
609
|
]
|
|
1165
610
|
},
|
|
1166
611
|
RetrySessionCreation: {
|
|
1167
612
|
actions: [
|
|
1168
|
-
|
|
613
|
+
P((e) => e.sessionManagementActor)
|
|
1169
614
|
]
|
|
1170
615
|
},
|
|
1171
616
|
RetrySessionUpdate: {
|
|
1172
617
|
actions: [
|
|
1173
|
-
|
|
618
|
+
P((e) => e.sessionManagementActor)
|
|
1174
619
|
]
|
|
1175
620
|
},
|
|
1176
621
|
SessionManagementStateChanged: {
|
|
1177
622
|
actions: [
|
|
1178
623
|
// Assign the received data
|
|
1179
|
-
|
|
624
|
+
f((e, n) => ({
|
|
1180
625
|
session: n.session,
|
|
1181
626
|
sessionInitialization: n.sessionInitialization,
|
|
1182
627
|
sessionUpdating: n.sessionUpdating
|
|
1183
628
|
})),
|
|
1184
629
|
// Forward the session to the configuration subscription
|
|
1185
|
-
|
|
630
|
+
fe((e) => ({
|
|
1186
631
|
type: "ChangeSession",
|
|
1187
632
|
session: e.session
|
|
1188
633
|
}), { to: (e) => e.configurationSubscriptionManagementActor }),
|
|
@@ -1191,7 +636,7 @@ const gt = (e) => (n) => (n({
|
|
|
1191
636
|
},
|
|
1192
637
|
ConfigurationChanged: {
|
|
1193
638
|
actions: [
|
|
1194
|
-
|
|
639
|
+
f((e, n) => ({
|
|
1195
640
|
configuration: {
|
|
1196
641
|
session: n.session,
|
|
1197
642
|
configuration: n.configuration
|
|
@@ -1207,123 +652,106 @@ const gt = (e) => (n) => (n({
|
|
|
1207
652
|
}
|
|
1208
653
|
}, {
|
|
1209
654
|
actions: {
|
|
1210
|
-
calculateReadyState:
|
|
1211
|
-
var
|
|
1212
|
-
const
|
|
1213
|
-
return e.isReadyPromise &&
|
|
1214
|
-
isReadyPromise: (() =>
|
|
655
|
+
calculateReadyState: f((e, n) => {
|
|
656
|
+
var t;
|
|
657
|
+
const s = !((t = e.sessionInitialization) != null && t.isInitializing) && e.session != null && e.configuration != null && e.configuration.session === e.session;
|
|
658
|
+
return e.isReadyPromise && s && (e.isReadyPromise.resolve(), e.isReadyPromise.capsule.promise = null), {
|
|
659
|
+
isReadyPromise: (() => s ? null : e.isReadyPromise != null ? e.isReadyPromise : J())()
|
|
1215
660
|
};
|
|
1216
661
|
})
|
|
1217
662
|
}
|
|
1218
663
|
});
|
|
1219
|
-
function
|
|
1220
|
-
var
|
|
1221
|
-
const [n,
|
|
1222
|
-
logger: (...
|
|
664
|
+
function Ve(e) {
|
|
665
|
+
var u, d;
|
|
666
|
+
const [n, s] = me(He, {
|
|
667
|
+
logger: (...r) => console.log("ConfigurationManagement:", ...r)
|
|
1223
668
|
});
|
|
1224
|
-
|
|
1225
|
-
|
|
669
|
+
L(() => {
|
|
670
|
+
s({
|
|
1226
671
|
type: "ChangeConfigurationClient",
|
|
1227
672
|
client: e.configuratorClient
|
|
1228
673
|
}), e.configuratorClient || console.warn("The configurator client is null or undefined. This will dispose the session that may exist. If this was not intended, make sure you pass a valid client.");
|
|
1229
|
-
}, [e.configuratorClient]),
|
|
1230
|
-
const
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
674
|
+
}, [e.configuratorClient], c.tuple(q)), L(() => {
|
|
675
|
+
const r = m(
|
|
676
|
+
a.fromNullable(e.sessionContext),
|
|
677
|
+
a.chainFirst((p) => a.fromNullable(p.configurationModelSource)),
|
|
678
|
+
a.toNullable
|
|
1234
679
|
);
|
|
1235
|
-
|
|
680
|
+
s({
|
|
1236
681
|
type: "ChangeSessionContext",
|
|
1237
|
-
sessionContext:
|
|
1238
|
-
}),
|
|
1239
|
-
}, [e.sessionContext]);
|
|
1240
|
-
const i =
|
|
682
|
+
sessionContext: r
|
|
683
|
+
}), r || console.warn("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.");
|
|
684
|
+
}, [e.sessionContext], c.tuple(O));
|
|
685
|
+
const i = g(
|
|
1241
686
|
() => {
|
|
1242
|
-
var
|
|
687
|
+
var r, p, B, H;
|
|
1243
688
|
return {
|
|
1244
|
-
isInitializing: ((
|
|
1245
|
-
isInitializingPromise: (
|
|
1246
|
-
error: ((
|
|
1247
|
-
|
|
1248
|
-
retry: () =>
|
|
689
|
+
isInitializing: ((p = (r = n.context.isReadyPromise) == null ? void 0 : r.capsule) == null ? void 0 : p.promise) != null,
|
|
690
|
+
isInitializingPromise: (B = n.context.isReadyPromise) == null ? void 0 : B.capsule,
|
|
691
|
+
error: ((H = n.context.sessionInitialization) == null ? void 0 : H.failureResult) && {
|
|
692
|
+
...n.context.sessionInitialization.failureResult,
|
|
693
|
+
retry: () => s({ type: "RetrySessionCreation" })
|
|
1249
694
|
}
|
|
1250
695
|
};
|
|
1251
696
|
},
|
|
1252
697
|
[n.context.sessionInitialization, n.context.isReadyPromise]
|
|
1253
|
-
),
|
|
698
|
+
), t = g(
|
|
1254
699
|
() => {
|
|
1255
|
-
var
|
|
700
|
+
var r, p;
|
|
1256
701
|
return {
|
|
1257
|
-
isUpdating: (
|
|
1258
|
-
error: ((
|
|
1259
|
-
|
|
1260
|
-
retry: () =>
|
|
702
|
+
isUpdating: (r = n.context.sessionUpdating) == null ? void 0 : r.isUpdating,
|
|
703
|
+
error: ((p = n.context.sessionUpdating) == null ? void 0 : p.failureResult) && {
|
|
704
|
+
...n.context.sessionUpdating.failureResult,
|
|
705
|
+
retry: () => s({ type: "RetrySessionUpdate" })
|
|
1261
706
|
}
|
|
1262
707
|
};
|
|
1263
708
|
},
|
|
1264
709
|
[n.context.sessionUpdating]
|
|
1265
|
-
),
|
|
710
|
+
), o = ((u = n.context.configuration) == null ? void 0 : u.session) === n.context.session ? (d = n.context.configuration) == null ? void 0 : d.configuration : null;
|
|
1266
711
|
return {
|
|
1267
712
|
configurationInitialization: i,
|
|
1268
|
-
configurationUpdating:
|
|
713
|
+
configurationUpdating: t,
|
|
1269
714
|
session: n.context.session,
|
|
1270
|
-
configuration:
|
|
715
|
+
configuration: o
|
|
1271
716
|
};
|
|
1272
717
|
}
|
|
1273
|
-
function
|
|
1274
|
-
const {
|
|
1275
|
-
configuratorClient:
|
|
1276
|
-
sessionContext:
|
|
718
|
+
function rn(e) {
|
|
719
|
+
const { configuratorClient: n, ...s } = e, { configurationInitialization: i, configurationUpdating: t, session: o, configuration: u } = Ve({
|
|
720
|
+
configuratorClient: n,
|
|
721
|
+
sessionContext: s
|
|
1277
722
|
});
|
|
1278
|
-
return /* @__PURE__ */
|
|
723
|
+
return /* @__PURE__ */ b(Y.Provider, { value: i, children: /* @__PURE__ */ b(Z.Provider, { value: t, children: /* @__PURE__ */ b(X.Provider, { value: o, children: /* @__PURE__ */ b($.Provider, { value: u, children: e.children }) }) }) });
|
|
1279
724
|
}
|
|
1280
|
-
function
|
|
1281
|
-
return
|
|
725
|
+
function Qe() {
|
|
726
|
+
return I(Y);
|
|
1282
727
|
}
|
|
1283
|
-
function
|
|
1284
|
-
return
|
|
728
|
+
function an() {
|
|
729
|
+
return I(Z);
|
|
1285
730
|
}
|
|
1286
|
-
function
|
|
1287
|
-
const { children: n } = e, { isInitializingPromise:
|
|
1288
|
-
if (
|
|
1289
|
-
throw
|
|
1290
|
-
return /* @__PURE__ */
|
|
1291
|
-
}
|
|
1292
|
-
function Nt() {
|
|
1293
|
-
const e = re();
|
|
1294
|
-
return ae(e), m(() => ({
|
|
1295
|
-
// explainChoiceAttributeConsequence: (a, v, m) => configurationSession.explain({
|
|
1296
|
-
// type: ExplainType.ChoiceValue,
|
|
1297
|
-
// attributeId: a,
|
|
1298
|
-
// choiceValueId: v,
|
|
1299
|
-
// question: m
|
|
1300
|
-
// } as ExplainChoiceValue),
|
|
1301
|
-
// explainChoiceAttributeConsequences: (a, m) => configurationSession.explain({
|
|
1302
|
-
// type: ExplainType.Choice,
|
|
1303
|
-
// attributeId: a,
|
|
1304
|
-
// question: m
|
|
1305
|
-
// } as ExplainChoice),
|
|
1306
|
-
// applySolution: (s) => configurationSession.applySolution(s)
|
|
1307
|
-
}), [e]);
|
|
731
|
+
function ln(e) {
|
|
732
|
+
const { children: n } = e, { isInitializingPromise: s } = Qe();
|
|
733
|
+
if (s != null && s.promise)
|
|
734
|
+
throw s.promise;
|
|
735
|
+
return /* @__PURE__ */ b(ge, { children: n });
|
|
1308
736
|
}
|
|
1309
|
-
function
|
|
1310
|
-
const e =
|
|
1311
|
-
return
|
|
737
|
+
function un() {
|
|
738
|
+
const e = F(), n = x();
|
|
739
|
+
return j(e), R(n), g(() => ({
|
|
1312
740
|
configuration: n,
|
|
1313
|
-
restoreConfiguration: (
|
|
741
|
+
restoreConfiguration: (s) => e.restoreConfiguration(s)
|
|
1314
742
|
}), [n, e]);
|
|
1315
743
|
}
|
|
1316
744
|
export {
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
745
|
+
rn as Configuration,
|
|
746
|
+
ln as ConfigurationSuspender,
|
|
747
|
+
en as useAttributes,
|
|
748
|
+
tn as useBooleanAttribute,
|
|
749
|
+
nn as useChoiceAttribute,
|
|
750
|
+
on as useComponentAttribute,
|
|
751
|
+
un as useConfiguration,
|
|
752
|
+
Qe as useConfigurationInitialization,
|
|
753
|
+
an as useConfigurationUpdating,
|
|
754
|
+
N as useDecision,
|
|
755
|
+
qe as useExplain,
|
|
756
|
+
sn as useNumericAttribute
|
|
1329
757
|
};
|