@viamedici-spc/configurator-react 0.1.0-alpha0018 → 0.1.0-alpha0019

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,816 +1,222 @@
1
- import { match as Je } from "ts-pattern";
2
- import { deepEqual as me } from "fast-equals";
3
- import { createContext as F, useContext as V, useMemo as m, useEffect as ce } from "react";
4
- import { jsx as z, Fragment as Le } from "react/jsx-runtime";
5
- import { createMachine as ne, assign as d, sendParent as he, spawn as le, forwardTo as B, send as Xe } from "xstate";
6
- import { log as C, pure as Ye, stop as fe } from "xstate/lib/actions";
7
- import { useMachine as Qe } from "@xstate/react";
8
- var Ze = globalThis && globalThis.__spreadArray || function(e, n, t) {
9
- if (t || arguments.length === 2)
10
- for (var i = 0, o = n.length, s; i < o; i++)
11
- (s || !(i in n)) && (s || (s = Array.prototype.slice.call(n, 0, i)), s[i] = n[i]);
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 C, ConfigurationInterpreter as y, DecisionKind as Y, globalAttributeIdEquals as F } from "@viamedici-spc/configurator-ts";
2
+ import { pipe as f, RA as a, O as o, some as R, none as v, flow as Z, identity as $, Eq as p, RR as ee, Str as ne, constVoid as se } from "@viamedici-spc/fp-ts-extensions";
3
+ import { createContext as M, useContext as U, useMemo as u, useEffect as j } from "react";
4
+ import { jsx as A, Fragment as ie } from "react/jsx-runtime";
5
+ import { createMachine as z, assign as c, sendParent as V, spawn as B, forwardTo as b, send as te } from "xstate";
6
+ import { log as g, pure as oe, stop as H } from "xstate/lib/actions";
7
+ import { eqNullable as k } from "@viamedici-spc/fp-ts-extensions/Eq";
8
+ import { deepEqual as re } from "fast-equals";
9
+ import { useMachine as ae } from "@xstate/react";
10
+ const G = M(null), J = M(null), L = M(null), Q = M(null), N = () => U(G), E = () => U(Q), W = "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 T(e) {
609
12
  if (!e)
610
- throw new Error(Ke);
13
+ throw new Error(W);
611
14
  }
612
- function k(e) {
15
+ function P(e) {
613
16
  if (!e)
614
- throw new Error(Ke);
17
+ throw new Error(W);
615
18
  }
616
- function J() {
617
- const e = re();
618
- return ae(e), m(() => ({
19
+ function D() {
20
+ const e = N();
21
+ return T(e), u(() => ({
619
22
  makeDecision: (n) => e.makeDecision(n),
620
- setManyDecision: (n, t) => e.setMany(n, t)
23
+ setManyDecision: (n, s) => e.setMany(n, s)
621
24
  }), [e]);
622
25
  }
623
- var L = function(e) {
26
+ globalThis && globalThis.__spreadArray;
27
+ var le = function(e) {
28
+ return e._tag === "Some";
29
+ }, x = function(e) {
624
30
  return function(n) {
625
- return ve(e(n));
31
+ return le(e(n));
626
32
  };
627
33
  };
628
- const Zn = L((e) => e.type === f.Choice ? P(e) : y), et = L((e) => e.type === f.Numeric ? P(e) : y), nt = L((e) => e.type === f.Boolean ? P(e) : y), tt = L((e) => e.type === f.Component ? P(e) : y);
629
- function X(e) {
630
- return e.decision != null && e.decision.kind === G.Explicit;
34
+ const ce = x((e) => e.type === C.Choice ? R(e) : v), ue = x((e) => e.type === C.Numeric ? R(e) : v), de = x((e) => e.type === C.Boolean ? R(e) : v), ge = x((e) => e.type === C.Component ? R(e) : v);
35
+ function I(e) {
36
+ return e.decision != null && e.decision.kind === Y.Explicit;
631
37
  }
632
- function Ge(e) {
633
- return r(
38
+ function X(e) {
39
+ return f(
634
40
  e.values,
635
- p(X),
636
- b((n) => ({
637
- type: f.Choice,
41
+ a.filter(I),
42
+ a.map((n) => ({
43
+ type: C.Choice,
638
44
  attributeId: e.id,
639
45
  choiceValueId: n.id,
640
46
  state: null
641
47
  }))
642
48
  );
643
49
  }
644
- function it(e) {
645
- return r(
50
+ function fe(e) {
51
+ return f(
646
52
  e,
647
- H(X),
648
- A(() => ({
649
- type: f.Numeric,
53
+ o.fromPredicate(I),
54
+ o.map(() => ({
55
+ type: C.Numeric,
650
56
  attributeId: e.id,
651
57
  state: null
652
58
  }))
653
59
  );
654
60
  }
655
- function ot(e) {
656
- return r(
61
+ function Ce(e) {
62
+ return f(
657
63
  e,
658
- H(X),
659
- A(() => ({
660
- type: f.Boolean,
64
+ o.fromPredicate(I),
65
+ o.map(() => ({
66
+ type: C.Boolean,
661
67
  attributeId: e.id,
662
68
  state: null
663
69
  }))
664
70
  );
665
71
  }
666
- function st(e) {
667
- return r(
72
+ function me(e) {
73
+ return f(
668
74
  e,
669
- H(X),
670
- A(() => ({
671
- type: f.Component,
75
+ o.fromPredicate(I),
76
+ o.map(() => ({
77
+ type: C.Component,
672
78
  attributeId: e.id,
673
79
  state: null
674
80
  }))
675
81
  );
676
82
  }
677
- function rt(e, n) {
678
- return r(
679
- _.filterAttributesOfComponent(n, e, !0),
680
- (t) => [
681
- r(
682
- t,
683
- p(Zn),
684
- Mn(Ge)
83
+ function pe(e, n) {
84
+ return f(
85
+ y.filterAttributesOfComponent(n, e, !0),
86
+ (s) => [
87
+ f(
88
+ s,
89
+ a.filter(ce),
90
+ a.chain(X)
685
91
  ),
686
- r(
687
- t,
688
- p(et),
689
- b(it),
690
- Y
92
+ f(
93
+ s,
94
+ a.filter(ue),
95
+ a.map(fe),
96
+ a.compact
691
97
  ),
692
- r(
693
- t,
694
- p(nt),
695
- b(ot),
696
- Y
98
+ f(
99
+ s,
100
+ a.filter(de),
101
+ a.map(Ce),
102
+ a.compact
697
103
  ),
698
- r(
699
- t,
700
- p(tt),
701
- b(st),
702
- Y
104
+ f(
105
+ s,
106
+ a.filter(ge),
107
+ a.map(me),
108
+ a.compact
703
109
  )
704
110
  ],
705
- xe
111
+ a.flatten
706
112
  );
707
113
  }
708
- function It(e, n) {
709
- const t = T();
710
- return k(t), m(
711
- () => r(
712
- l(e),
713
- A(Se(
714
- b((i) => _.getAttribute(t, i)),
715
- n ?? !1 ? O : w(l)
114
+ function _e(e, n) {
115
+ const s = E();
116
+ return P(s), u(
117
+ () => f(
118
+ o.fromNullable(e),
119
+ o.map(Z(
120
+ a.map((i) => y.getAttribute(s, i)),
121
+ n ?? !1 ? $ : a.filterMap(o.fromNullable)
716
122
  )),
717
- U(() => t.attributes)
123
+ o.getOrElse(() => s.attributes)
718
124
  ),
719
- [e, t, n]
125
+ [e, s, n]
720
126
  );
721
127
  }
722
- function qt(e) {
723
- const n = T(), { makeDecision: t, setManyDecision: i } = J();
724
- k(n);
725
- const o = _.getChoiceAttribute(n, e), s = m(() => ({
128
+ function Oe(e) {
129
+ const n = E(), { makeDecision: s, setManyDecision: i } = D();
130
+ P(n);
131
+ const t = y.getChoiceAttribute(n, e), r = u(() => ({
726
132
  // explainConsequence: (choiceValueId: ChoiceValueId, mode?: ExplainMode) => explainChoiceAttributeConsequence(attributeId, choiceValueId, mode),
727
133
  // explainConsequences: (mode?: ExplainMode) => explainChoiceAttributeConsequences(attributeId, mode),
728
- makeDecision: (g, u) => t({
729
- type: f.Choice,
134
+ makeDecision: (m, l) => s({
135
+ type: C.Choice,
730
136
  attributeId: e,
731
- choiceValueId: g,
732
- state: u
137
+ choiceValueId: m,
138
+ state: l
733
139
  }),
734
- clearDecisions: r(
735
- o,
736
- l,
737
- A(Ge),
140
+ clearDecisions: f(
141
+ t,
142
+ o.fromNullable,
143
+ o.map(X),
738
144
  // Only setMany if there are decisions to clear.
739
- I(Ie),
740
- A((g) => () => i(g, { type: "Default" })),
741
- U(() => () => Promise.resolve())
145
+ o.filter(a.isNonEmpty),
146
+ o.map((m) => () => i(m, { type: "Default" })),
147
+ o.getOrElse(() => () => Promise.resolve())
742
148
  )
743
149
  // applySolution: applySolution
744
- }), [e, o, t, i]), a = m(() => ({
745
- ...s,
746
- attribute: o
747
- }), [o, s]);
748
- if (o)
749
- return a;
750
- }
751
- function Mt(e) {
752
- const n = T(), { makeDecision: t } = J();
753
- k(n);
754
- const i = _.getNumericAttribute(n, e), o = m(() => ({
755
- makeDecision: (a) => t({
756
- type: f.Numeric,
150
+ }), [e, t, s, i]), d = u(() => ({
151
+ ...r,
152
+ attribute: t
153
+ }), [t, r]);
154
+ if (t)
155
+ return d;
156
+ }
157
+ function Fe(e) {
158
+ const n = E(), { makeDecision: s } = D();
159
+ P(n);
160
+ const i = y.getNumericAttribute(n, e), t = u(() => ({
161
+ makeDecision: (d) => s({
162
+ type: C.Numeric,
757
163
  attributeId: e,
758
- state: a
164
+ state: d
759
165
  })
760
- }), [e, t]), s = m(() => ({
761
- ...o,
166
+ }), [e, s]), r = u(() => ({
167
+ ...t,
762
168
  attribute: i
763
- }), [i, o]);
169
+ }), [i, t]);
764
170
  if (i)
765
- return s;
171
+ return r;
766
172
  }
767
- function wt(e) {
768
- const n = T(), { makeDecision: t } = J();
769
- k(n);
770
- const i = _.getBooleanAttribute(n, e), o = m(() => ({
771
- makeDecision: (a) => t({
772
- type: f.Boolean,
173
+ function je(e) {
174
+ const n = E(), { makeDecision: s } = D();
175
+ P(n);
176
+ const i = y.getBooleanAttribute(n, e), t = u(() => ({
177
+ makeDecision: (d) => s({
178
+ type: C.Boolean,
773
179
  attributeId: e,
774
- state: a
180
+ state: d
775
181
  })
776
- }), [e, t]), s = m(() => ({
777
- ...o,
182
+ }), [e, s]), r = u(() => ({
183
+ ...t,
778
184
  attribute: i
779
- }), [i, o]);
185
+ }), [i, t]);
780
186
  if (i)
781
- return s;
782
- }
783
- function xt(e) {
784
- const n = T(), { makeDecision: t, setManyDecision: i } = J();
785
- k(n);
786
- const o = n.attributes, s = _.getComponentAttribute(n, e), a = m(() => ({
787
- makeDecision: (u) => t({
788
- type: f.Component,
187
+ return r;
188
+ }
189
+ function Be(e) {
190
+ const n = E(), { makeDecision: s, setManyDecision: i } = D();
191
+ P(n);
192
+ const t = n.attributes, r = y.getComponentAttribute(n, e), d = u(() => ({
193
+ makeDecision: (l) => s({
194
+ type: C.Component,
789
195
  attributeId: e,
790
- state: u
196
+ state: l
791
197
  }),
792
- clearSubtree: r(
793
- rt(e, o),
198
+ clearSubtree: f(
199
+ pe(e, t),
794
200
  // Only setMany if there are decisions to clear.
795
- H(Ie),
796
- A((u) => () => i(u, { type: "Default" })),
797
- U(() => () => Promise.resolve())
201
+ o.fromPredicate(a.isNonEmpty),
202
+ o.map((l) => () => i(l, { type: "Default" })),
203
+ o.getOrElse(() => () => Promise.resolve())
798
204
  )
799
- }), [e, t, o, i]), g = m(() => ({
800
- ...a,
801
- attribute: s
802
- }), [s, a]);
803
- if (s)
804
- return g;
805
- }
806
- const at = v((e, n) => De(c).equals(e ?? {}, n ?? {})), ut = S({
807
- attributeId: v(de),
808
- decisions: K(v(de))
809
- }), ct = v((e, n) => K(ut).equals(e ?? [], n ?? [])), Q = S({
810
- configurationModelSource: v((e, n) => me(e, n)),
811
- attributeRelations: ct,
812
- usageRuleParameters: at
813
- }), lt = be, Z = ee(lt), ft = () => ne({
205
+ }), [e, s, t, i]), m = u(() => ({
206
+ ...d,
207
+ attribute: r
208
+ }), [r, d]);
209
+ if (r)
210
+ return m;
211
+ }
212
+ const Se = p.fromEquals((e, n) => ee.getEq(ne.Eq).equals(e ?? {}, n ?? {})), he = p.struct({
213
+ attributeId: p.fromEquals(F),
214
+ decisions: a.getEq(p.fromEquals(F))
215
+ }), ye = p.fromEquals((e, n) => a.getEq(he).equals(e ?? [], n ?? [])), q = p.struct({
216
+ configurationModelSource: p.fromEquals((e, n) => re(e, n)),
217
+ attributeRelations: ye,
218
+ usageRuleParameters: Se
219
+ }), Ee = p.eqStrict, w = k(Ee), Pe = () => z({
814
220
  predictableActionArguments: !0,
815
221
  preserveActionOrder: !0,
816
222
  schema: {
@@ -836,14 +242,14 @@ const at = v((e, n) => De(c).equals(e ?? {}, n ?? {})), ut = S({
836
242
  }
837
243
  },
838
244
  exit: [
839
- C("Shutting down", "SessionManagement:"),
245
+ g("Shutting down", "SessionManagement:"),
840
246
  "disposeOldSession"
841
247
  ],
842
248
  states: {
843
249
  ProcessChanges: {
844
250
  entry: [
845
- C("Entering ProcessChanges", "SessionManagement:"),
846
- R(
251
+ g("Entering ProcessChanges", "SessionManagement:"),
252
+ h(
847
253
  2
848
254
  /* Other */
849
255
  )
@@ -856,8 +262,8 @@ const at = v((e, n) => De(c).equals(e ?? {}, n ?? {})), ut = S({
856
262
  },
857
263
  DisposeSession: {
858
264
  entry: [
859
- C("Entering DisposeSession", "SessionManagement:"),
860
- R(
265
+ g("Entering DisposeSession", "SessionManagement:"),
266
+ h(
861
267
  2
862
268
  /* Other */
863
269
  )
@@ -869,8 +275,8 @@ const at = v((e, n) => De(c).equals(e ?? {}, n ?? {})), ut = S({
869
275
  },
870
276
  CreateSession: {
871
277
  entry: [
872
- C("Entering CreateSession", "SessionManagement:"),
873
- R(
278
+ g("Entering CreateSession", "SessionManagement:"),
279
+ h(
874
280
  0
875
281
  /* CreateSession */
876
282
  )
@@ -890,8 +296,8 @@ const at = v((e, n) => De(c).equals(e ?? {}, n ?? {})), ut = S({
890
296
  },
891
297
  SessionCreationFailed: {
892
298
  entry: [
893
- C("Entering SessionCreationFailed", "SessionManagement:"),
894
- R(
299
+ g("Entering SessionCreationFailed", "SessionManagement:"),
300
+ h(
895
301
  2
896
302
  /* Other */
897
303
  )
@@ -903,20 +309,20 @@ const at = v((e, n) => De(c).equals(e ?? {}, n ?? {})), ut = S({
903
309
  cond: "shallImmediatelyProcessChangesAfterSessionCreationError"
904
310
  },
905
311
  exit: [
906
- C("Exiting SessionCreationFailed", "SessionManagement:"),
312
+ g("Exiting SessionCreationFailed", "SessionManagement:"),
907
313
  "clearSessionCreationError"
908
314
  ],
909
315
  on: {
910
316
  RetrySessionCreation: {
911
317
  target: "ProcessChanges",
912
- actions: C("Retrying session creation", "SessionManagement:")
318
+ actions: g("Retrying session creation", "SessionManagement:")
913
319
  }
914
320
  }
915
321
  },
916
322
  UpdateSession: {
917
323
  entry: [
918
- C("Entering UpdateSession", "SessionManagement:"),
919
- R(
324
+ g("Entering UpdateSession", "SessionManagement:"),
325
+ h(
920
326
  1
921
327
  /* UpdateSession */
922
328
  )
@@ -935,8 +341,8 @@ const at = v((e, n) => De(c).equals(e ?? {}, n ?? {})), ut = S({
935
341
  },
936
342
  SessionUpdateFailed: {
937
343
  entry: [
938
- C("Entering SessionUpdateFailed", "SessionManagement:"),
939
- R(
344
+ g("Entering SessionUpdateFailed", "SessionManagement:"),
345
+ h(
940
346
  2
941
347
  /* Other */
942
348
  )
@@ -948,43 +354,43 @@ const at = v((e, n) => De(c).equals(e ?? {}, n ?? {})), ut = S({
948
354
  cond: "shallImmediatelyProcessChangesAfterSessionUpdateError"
949
355
  },
950
356
  exit: [
951
- C("Exiting SessionUpdateFailed", "SessionManagement:"),
357
+ g("Exiting SessionUpdateFailed", "SessionManagement:"),
952
358
  "clearSessionUpdateError"
953
359
  ],
954
360
  on: {
955
361
  RetrySessionUpdate: {
956
362
  target: "ProcessChanges",
957
- actions: C("Retrying session update", "SessionManagement:")
363
+ actions: g("Retrying session update", "SessionManagement:")
958
364
  }
959
365
  }
960
366
  }
961
367
  }
962
368
  }, {
963
369
  actions: {
964
- saveDesiredClient: d({
370
+ saveDesiredClient: c({
965
371
  desiredClient: (e, n) => n.client
966
372
  }),
967
- saveDesiredSessionContext: d({
373
+ saveDesiredSessionContext: c({
968
374
  desiredSessionContext: (e, n) => n.sessionContext
969
375
  }),
970
- disposeOldSession: d((e, n) => (e.session && e.session.close().then(nn).catch((t) => {
376
+ disposeOldSession: c((e, n) => (e.session && e.session.close().then(se).catch((s) => {
971
377
  }), {
972
378
  session: null,
973
379
  actualClient: null
974
380
  })),
975
- setSessionCreationResult: d((e, n) => ({
381
+ setSessionCreationResult: c((e, n) => ({
976
382
  session: n.data.session,
977
383
  actualClient: n.data.client
978
384
  })),
979
- setSessionCreationError: d((e, n) => ({
385
+ setSessionCreationError: c((e, n) => ({
980
386
  sessionCreationError: n.data
981
387
  })),
982
- clearSessionCreationError: d({ sessionCreationError: () => null }),
983
- setSessionUpdateError: d((e, n) => ({
388
+ clearSessionCreationError: c({ sessionCreationError: () => null }),
389
+ setSessionUpdateError: c((e, n) => ({
984
390
  sessionUpdateError: n.data
985
391
  })),
986
- clearSessionUpdateError: d({ sessionUpdateError: () => null }),
987
- setHasEverSuccessfullyCreatedSession: d({
392
+ clearSessionUpdateError: c({ sessionUpdateError: () => null }),
393
+ setHasEverSuccessfullyCreatedSession: c({
988
394
  hasEverSuccessfullyCreatedSession: () => !0
989
395
  })
990
396
  },
@@ -1003,50 +409,50 @@ const at = v((e, n) => De(c).equals(e ?? {}, n ?? {})), ut = S({
1003
409
  }))
1004
410
  },
1005
411
  guards: {
1006
- shallDisposeSession: (e) => e.session != null && (e.desiredSessionContext == null || e.desiredClient == null || !Z.equals(e.actualClient, e.desiredClient)),
412
+ shallDisposeSession: (e) => e.session != null && (e.desiredSessionContext == null || e.desiredClient == null || !w.equals(e.actualClient, e.desiredClient)),
1007
413
  shallCreateSession: (e) => e.session == null && e.desiredClient != null && e.desiredSessionContext != null,
1008
- shallUpdateSession: (e) => e.session != null && !Q.equals(e.session.getSessionContext(), e.desiredSessionContext),
414
+ shallUpdateSession: (e) => e.session != null && !q.equals(e.session.getSessionContext(), e.desiredSessionContext),
1009
415
  shallImmediatelyProcessChangesAfterSessionCreationError: (e) => (
1010
416
  // The desired client and the desired session context is not the same that resulted in the error.
1011
- !Z.equals(e.desiredClient, e.sessionCreationError.client) || !ee(Q).equals(e.desiredSessionContext, e.sessionCreationError.sessionContext)
417
+ !w.equals(e.desiredClient, e.sessionCreationError.client) || !k(q).equals(e.desiredSessionContext, e.sessionCreationError.sessionContext)
1012
418
  ),
1013
419
  shallImmediatelyProcessChangesAfterSessionUpdateError: (e) => (
1014
420
  // The desired client was changed
1015
- !Z.equals(e.desiredClient, e.actualClient) || !ee(Q).equals(e.desiredSessionContext, e.sessionUpdateError.sessionContext)
421
+ !w.equals(e.desiredClient, e.actualClient) || !k(q).equals(e.desiredSessionContext, e.sessionUpdateError.sessionContext)
1016
422
  )
1017
423
  }
1018
424
  });
1019
- function R(e) {
1020
- const n = e === 0, t = e === 1;
1021
- return Ye((i, o) => {
1022
- const s = {
425
+ function h(e) {
426
+ const n = e === 0, s = e === 1;
427
+ return oe((i, t) => {
428
+ const r = {
1023
429
  isInitializing: (!i.hasEverSuccessfullyCreatedSession || n) && i.sessionCreationError == null,
1024
430
  errorType: i.sessionCreationError && i.sessionCreationError.type
1025
- }, a = {
1026
- isUpdating: t && i.sessionUpdateError == null,
431
+ }, d = {
432
+ isUpdating: s && i.sessionUpdateError == null,
1027
433
  errorType: i.sessionUpdateError && i.sessionUpdateError.type
1028
434
  };
1029
- return he({
435
+ return V({
1030
436
  type: "SessionManagementStateChanged",
1031
- sessionInitialization: s,
1032
- sessionUpdating: a,
437
+ sessionInitialization: r,
438
+ sessionUpdating: d,
1033
439
  session: i.session
1034
440
  });
1035
441
  });
1036
442
  }
1037
- const gt = (e) => (n) => (n({
443
+ const Ae = (e) => (n) => (n({
1038
444
  type: "ConfigurationChanged",
1039
445
  session: e,
1040
446
  configuration: e.getConfiguration()
1041
- }), e.setOnConfigurationChangedHandler((t) => {
447
+ }), e.setOnConfigurationChangedHandler((s) => {
1042
448
  n({
1043
449
  type: "ConfigurationChanged",
1044
450
  session: e,
1045
- configuration: t
451
+ configuration: s
1046
452
  });
1047
453
  }), () => {
1048
454
  e.setOnConfigurationChangedHandler(null);
1049
- }), dt = () => ne({
455
+ }), be = () => z({
1050
456
  predictableActionArguments: !0,
1051
457
  preserveActionOrder: !0,
1052
458
  schema: {
@@ -1060,7 +466,7 @@ const gt = (e) => (n) => (n({
1060
466
  // Forward the configuration data to the parent.
1061
467
  ConfigurationChanged: {
1062
468
  actions: [
1063
- he((e, n) => n)
469
+ V((e, n) => n)
1064
470
  ]
1065
471
  }
1066
472
  },
@@ -1068,7 +474,7 @@ const gt = (e) => (n) => (n({
1068
474
  states: {
1069
475
  ProcessChanges: {
1070
476
  entry: [
1071
- C("Entering ProcessChanges", "ConfigurationSubscriptionManagement:")
477
+ g("Entering ProcessChanges", "ConfigurationSubscriptionManagement:")
1072
478
  ],
1073
479
  on: {
1074
480
  ChangeSession: {
@@ -1086,7 +492,7 @@ const gt = (e) => (n) => (n({
1086
492
  },
1087
493
  Subscribe: {
1088
494
  entry: [
1089
- C("Entering Subscribe", "ConfigurationSubscriptionManagement:")
495
+ g("Entering Subscribe", "ConfigurationSubscriptionManagement:")
1090
496
  ],
1091
497
  on: {
1092
498
  ChangeSession: {
@@ -1099,33 +505,33 @@ const gt = (e) => (n) => (n({
1099
505
  },
1100
506
  invoke: {
1101
507
  id: "configurationSubscriptionActor",
1102
- src: (e, n) => gt(e.session)
508
+ src: (e, n) => Ae(e.session)
1103
509
  }
1104
510
  }
1105
511
  }
1106
512
  }, {
1107
513
  actions: {
1108
- saveSession: d((e, n) => ({
514
+ saveSession: c((e, n) => ({
1109
515
  session: n.session
1110
516
  }))
1111
517
  }
1112
- }), pt = () => {
518
+ }), Re = () => {
1113
519
  let e, n;
1114
520
  return {
1115
- promise: new Promise((i, o) => {
1116
- e = i, n = o;
521
+ promise: new Promise((i, t) => {
522
+ e = i, n = t;
1117
523
  }),
1118
524
  resolve: e,
1119
525
  reject: n
1120
526
  };
1121
- }, pe = () => {
1122
- const e = pt();
527
+ }, K = () => {
528
+ const e = Re();
1123
529
  return {
1124
530
  capsule: { promise: e.promise },
1125
531
  resolve: e.resolve,
1126
532
  reject: e.reject
1127
533
  };
1128
- }, mt = () => ne({
534
+ }, ve = () => z({
1129
535
  predictableActionArguments: !0,
1130
536
  preserveActionOrder: !0,
1131
537
  schema: {
@@ -1139,50 +545,50 @@ const gt = (e) => (n) => (n({
1139
545
  sessionUpdating: null,
1140
546
  session: null,
1141
547
  configuration: null,
1142
- isReadyPromise: pe()
548
+ isReadyPromise: K()
1143
549
  },
1144
550
  entry: [
1145
- d({
1146
- sessionManagementActor: () => le(ft()),
1147
- configurationSubscriptionManagementActor: () => le(dt())
551
+ c({
552
+ sessionManagementActor: () => B(Pe()),
553
+ configurationSubscriptionManagementActor: () => B(be())
1148
554
  })
1149
555
  ],
1150
556
  exit: [
1151
- fe((e) => e.sessionManagementActor),
1152
- fe((e) => e.configurationSubscriptionManagementActor)
557
+ H((e) => e.sessionManagementActor),
558
+ H((e) => e.configurationSubscriptionManagementActor)
1153
559
  ],
1154
560
  on: {
1155
561
  // Forward events for sessionManagement
1156
562
  ChangeConfigurationClient: {
1157
563
  actions: [
1158
- B((e) => e.sessionManagementActor)
564
+ b((e) => e.sessionManagementActor)
1159
565
  ]
1160
566
  },
1161
567
  ChangeSessionContext: {
1162
568
  actions: [
1163
- B((e) => e.sessionManagementActor)
569
+ b((e) => e.sessionManagementActor)
1164
570
  ]
1165
571
  },
1166
572
  RetrySessionCreation: {
1167
573
  actions: [
1168
- B((e) => e.sessionManagementActor)
574
+ b((e) => e.sessionManagementActor)
1169
575
  ]
1170
576
  },
1171
577
  RetrySessionUpdate: {
1172
578
  actions: [
1173
- B((e) => e.sessionManagementActor)
579
+ b((e) => e.sessionManagementActor)
1174
580
  ]
1175
581
  },
1176
582
  SessionManagementStateChanged: {
1177
583
  actions: [
1178
584
  // Assign the received data
1179
- d((e, n) => ({
585
+ c((e, n) => ({
1180
586
  session: n.session,
1181
587
  sessionInitialization: n.sessionInitialization,
1182
588
  sessionUpdating: n.sessionUpdating
1183
589
  })),
1184
590
  // Forward the session to the configuration subscription
1185
- Xe((e) => ({
591
+ te((e) => ({
1186
592
  type: "ChangeSession",
1187
593
  session: e.session
1188
594
  }), { to: (e) => e.configurationSubscriptionManagementActor }),
@@ -1191,7 +597,7 @@ const gt = (e) => (n) => (n({
1191
597
  },
1192
598
  ConfigurationChanged: {
1193
599
  actions: [
1194
- d((e, n) => ({
600
+ c((e, n) => ({
1195
601
  configuration: {
1196
602
  session: n.session,
1197
603
  configuration: n.configuration
@@ -1207,91 +613,91 @@ const gt = (e) => (n) => (n({
1207
613
  }
1208
614
  }, {
1209
615
  actions: {
1210
- calculateReadyState: d((e, n) => {
1211
- var o;
1212
- const t = !((o = e.sessionInitialization) != null && o.isInitializing) && e.session != null && e.configuration != null && e.configuration.session === e.session;
1213
- return e.isReadyPromise && t && (e.isReadyPromise.resolve(), e.isReadyPromise.capsule.promise = null), {
1214
- isReadyPromise: (() => t ? null : e.isReadyPromise != null ? e.isReadyPromise : pe())()
616
+ calculateReadyState: c((e, n) => {
617
+ var t;
618
+ const s = !((t = e.sessionInitialization) != null && t.isInitializing) && e.session != null && e.configuration != null && e.configuration.session === e.session;
619
+ return e.isReadyPromise && s && (e.isReadyPromise.resolve(), e.isReadyPromise.capsule.promise = null), {
620
+ isReadyPromise: (() => s ? null : e.isReadyPromise != null ? e.isReadyPromise : K())()
1215
621
  };
1216
622
  })
1217
623
  }
1218
624
  });
1219
- function ht(e) {
1220
- var a, g;
1221
- const [n, t] = Qe(mt, {
1222
- logger: (...u) => console.log("ConfigurationManagement:", ...u)
625
+ function Me(e) {
626
+ var d, m;
627
+ const [n, s] = ae(ve, {
628
+ logger: (...l) => console.log("ConfigurationManagement:", ...l)
1223
629
  });
1224
- ce(() => {
1225
- t({
630
+ j(() => {
631
+ s({
1226
632
  type: "ChangeConfigurationClient",
1227
633
  client: e.configuratorClient
1228
634
  }), 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]), ce(() => {
1230
- const u = r(
1231
- l(e.sessionContext),
1232
- Cn((h) => l(h.configurationModelSource)),
1233
- W
635
+ }, [e.configuratorClient]), j(() => {
636
+ const l = f(
637
+ o.fromNullable(e.sessionContext),
638
+ o.chainFirst((S) => o.fromNullable(S.configurationModelSource)),
639
+ o.toNullable
1234
640
  );
1235
- t({
641
+ s({
1236
642
  type: "ChangeSessionContext",
1237
- sessionContext: u
1238
- }), u || 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.");
643
+ sessionContext: l
644
+ }), l || 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.");
1239
645
  }, [e.sessionContext]);
1240
- const i = m(
646
+ const i = u(
1241
647
  () => {
1242
- var u, h, x, ue;
648
+ var l, S, _, O;
1243
649
  return {
1244
- isInitializing: ((h = (u = n.context.isReadyPromise) == null ? void 0 : u.capsule) == null ? void 0 : h.promise) != null,
1245
- isInitializingPromise: (x = n.context.isReadyPromise) == null ? void 0 : x.capsule,
1246
- error: ((ue = n.context.sessionInitialization) == null ? void 0 : ue.errorType) && {
650
+ isInitializing: ((S = (l = n.context.isReadyPromise) == null ? void 0 : l.capsule) == null ? void 0 : S.promise) != null,
651
+ isInitializingPromise: (_ = n.context.isReadyPromise) == null ? void 0 : _.capsule,
652
+ error: ((O = n.context.sessionInitialization) == null ? void 0 : O.errorType) && {
1247
653
  type: n.context.sessionInitialization.errorType,
1248
- retry: () => t({ type: "RetrySessionCreation" })
654
+ retry: () => s({ type: "RetrySessionCreation" })
1249
655
  }
1250
656
  };
1251
657
  },
1252
658
  [n.context.sessionInitialization, n.context.isReadyPromise]
1253
- ), o = m(
659
+ ), t = u(
1254
660
  () => {
1255
- var u, h;
661
+ var l, S;
1256
662
  return {
1257
- isUpdating: (u = n.context.sessionUpdating) == null ? void 0 : u.isUpdating,
1258
- error: ((h = n.context.sessionUpdating) == null ? void 0 : h.errorType) && {
663
+ isUpdating: (l = n.context.sessionUpdating) == null ? void 0 : l.isUpdating,
664
+ error: ((S = n.context.sessionUpdating) == null ? void 0 : S.errorType) && {
1259
665
  type: n.context.sessionUpdating.errorType,
1260
- retry: () => t({ type: "RetrySessionUpdate" })
666
+ retry: () => s({ type: "RetrySessionUpdate" })
1261
667
  }
1262
668
  };
1263
669
  },
1264
670
  [n.context.sessionUpdating]
1265
- ), s = ((a = n.context.configuration) == null ? void 0 : a.session) === n.context.session ? (g = n.context.configuration) == null ? void 0 : g.configuration : null;
671
+ ), r = ((d = n.context.configuration) == null ? void 0 : d.session) === n.context.session ? (m = n.context.configuration) == null ? void 0 : m.configuration : null;
1266
672
  return {
1267
673
  configurationInitialization: i,
1268
- configurationUpdating: o,
674
+ configurationUpdating: t,
1269
675
  session: n.context.session,
1270
- configuration: s
676
+ configuration: r
1271
677
  };
1272
678
  }
1273
- function Rt(e) {
1274
- const { configurationInitialization: n, configurationUpdating: t, session: i, configuration: o } = ht({
679
+ function He(e) {
680
+ const { configurationInitialization: n, configurationUpdating: s, session: i, configuration: t } = Me({
1275
681
  configuratorClient: e.configuratorClient,
1276
682
  sessionContext: e
1277
683
  });
1278
- return /* @__PURE__ */ z(Ve.Provider, { value: n, children: /* @__PURE__ */ z(He.Provider, { value: t, children: /* @__PURE__ */ z(Fe.Provider, { value: i, children: /* @__PURE__ */ z(We.Provider, { value: o, children: e.children }) }) }) });
684
+ return /* @__PURE__ */ A(J.Provider, { value: n, children: /* @__PURE__ */ A(L.Provider, { value: s, children: /* @__PURE__ */ A(G.Provider, { value: i, children: /* @__PURE__ */ A(Q.Provider, { value: t, children: e.children }) }) }) });
1279
685
  }
1280
- function Ct() {
1281
- return V(Ve);
686
+ function Ue() {
687
+ return U(J);
1282
688
  }
1283
- function Ut() {
1284
- return V(He);
689
+ function Ke() {
690
+ return U(L);
1285
691
  }
1286
- function Dt(e) {
1287
- const { children: n } = e, { isInitializingPromise: t } = Ct();
1288
- if (t != null && t.promise)
1289
- throw t.promise;
1290
- return /* @__PURE__ */ z(Le, { children: n });
692
+ function Ve(e) {
693
+ const { children: n } = e, { isInitializingPromise: s } = Ue();
694
+ if (s != null && s.promise)
695
+ throw s.promise;
696
+ return /* @__PURE__ */ A(ie, { children: n });
1291
697
  }
1292
- function Nt() {
1293
- const e = re();
1294
- return ae(e), m(() => ({
698
+ function Ge() {
699
+ const e = N();
700
+ return T(e), u(() => ({
1295
701
  // explainChoiceAttributeConsequence: (a, v, m) => configurationSession.explain({
1296
702
  // type: ExplainType.ChoiceValue,
1297
703
  // attributeId: a,
@@ -1306,24 +712,24 @@ function Nt() {
1306
712
  // applySolution: (s) => configurationSession.applySolution(s)
1307
713
  }), [e]);
1308
714
  }
1309
- function _t() {
1310
- const e = re(), n = T();
1311
- return ae(e), k(n), m(() => ({
715
+ function Je() {
716
+ const e = N(), n = E();
717
+ return T(e), P(n), u(() => ({
1312
718
  configuration: n,
1313
- restoreConfiguration: (t) => e.restoreConfiguration(t)
719
+ restoreConfiguration: (s) => e.restoreConfiguration(s)
1314
720
  }), [n, e]);
1315
721
  }
1316
722
  export {
1317
- Rt as Configuration,
1318
- Dt as ConfigurationSuspender,
1319
- It as useAttributes,
1320
- wt as useBooleanAttribute,
1321
- qt as useChoiceAttribute,
1322
- xt as useComponentAttribute,
1323
- _t as useConfiguration,
1324
- Ct as useConfigurationInitialization,
1325
- Ut as useConfigurationUpdating,
1326
- J as useDecision,
1327
- Nt as useExplain,
1328
- Mt as useNumericAttribute
723
+ He as Configuration,
724
+ Ve as ConfigurationSuspender,
725
+ _e as useAttributes,
726
+ je as useBooleanAttribute,
727
+ Oe as useChoiceAttribute,
728
+ Be as useComponentAttribute,
729
+ Je as useConfiguration,
730
+ Ue as useConfigurationInitialization,
731
+ Ke as useConfigurationUpdating,
732
+ D as useDecision,
733
+ Ge as useExplain,
734
+ Fe as useNumericAttribute
1329
735
  };