@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.cjs +1 -1
- package/dist/index.js +283 -877
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,816 +1,222 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { createContext as
|
|
4
|
-
import { jsx as
|
|
5
|
-
import { createMachine as
|
|
6
|
-
import { log as
|
|
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 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(
|
|
13
|
+
throw new Error(W);
|
|
611
14
|
}
|
|
612
|
-
function
|
|
15
|
+
function P(e) {
|
|
613
16
|
if (!e)
|
|
614
|
-
throw new Error(
|
|
17
|
+
throw new Error(W);
|
|
615
18
|
}
|
|
616
|
-
function
|
|
617
|
-
const e =
|
|
618
|
-
return
|
|
19
|
+
function D() {
|
|
20
|
+
const e = N();
|
|
21
|
+
return T(e), u(() => ({
|
|
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 le = function(e) {
|
|
28
|
+
return e._tag === "Some";
|
|
29
|
+
}, x = function(e) {
|
|
624
30
|
return function(n) {
|
|
625
|
-
return
|
|
31
|
+
return le(e(n));
|
|
626
32
|
};
|
|
627
33
|
};
|
|
628
|
-
const
|
|
629
|
-
function
|
|
630
|
-
return e.decision != null && e.decision.kind ===
|
|
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
|
|
633
|
-
return
|
|
38
|
+
function X(e) {
|
|
39
|
+
return f(
|
|
634
40
|
e.values,
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
type:
|
|
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
|
|
645
|
-
return
|
|
50
|
+
function fe(e) {
|
|
51
|
+
return f(
|
|
646
52
|
e,
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
type:
|
|
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
|
|
656
|
-
return
|
|
61
|
+
function Ce(e) {
|
|
62
|
+
return f(
|
|
657
63
|
e,
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
type:
|
|
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
|
|
667
|
-
return
|
|
72
|
+
function me(e) {
|
|
73
|
+
return f(
|
|
668
74
|
e,
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
type:
|
|
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
|
|
678
|
-
return
|
|
679
|
-
|
|
680
|
-
(
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
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
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
92
|
+
f(
|
|
93
|
+
s,
|
|
94
|
+
a.filter(ue),
|
|
95
|
+
a.map(fe),
|
|
96
|
+
a.compact
|
|
691
97
|
),
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
98
|
+
f(
|
|
99
|
+
s,
|
|
100
|
+
a.filter(de),
|
|
101
|
+
a.map(Ce),
|
|
102
|
+
a.compact
|
|
697
103
|
),
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
104
|
+
f(
|
|
105
|
+
s,
|
|
106
|
+
a.filter(ge),
|
|
107
|
+
a.map(me),
|
|
108
|
+
a.compact
|
|
703
109
|
)
|
|
704
110
|
],
|
|
705
|
-
|
|
111
|
+
a.flatten
|
|
706
112
|
);
|
|
707
113
|
}
|
|
708
|
-
function
|
|
709
|
-
const
|
|
710
|
-
return
|
|
711
|
-
() =>
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
n ?? !1 ?
|
|
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
|
-
|
|
123
|
+
o.getOrElse(() => s.attributes)
|
|
718
124
|
),
|
|
719
|
-
[e,
|
|
125
|
+
[e, s, n]
|
|
720
126
|
);
|
|
721
127
|
}
|
|
722
|
-
function
|
|
723
|
-
const n =
|
|
724
|
-
|
|
725
|
-
const
|
|
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: (
|
|
729
|
-
type:
|
|
134
|
+
makeDecision: (m, l) => s({
|
|
135
|
+
type: C.Choice,
|
|
730
136
|
attributeId: e,
|
|
731
|
-
choiceValueId:
|
|
732
|
-
state:
|
|
137
|
+
choiceValueId: m,
|
|
138
|
+
state: l
|
|
733
139
|
}),
|
|
734
|
-
clearDecisions:
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
140
|
+
clearDecisions: f(
|
|
141
|
+
t,
|
|
142
|
+
o.fromNullable,
|
|
143
|
+
o.map(X),
|
|
738
144
|
// Only setMany if there are decisions to clear.
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
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,
|
|
745
|
-
...
|
|
746
|
-
attribute:
|
|
747
|
-
}), [
|
|
748
|
-
if (
|
|
749
|
-
return
|
|
750
|
-
}
|
|
751
|
-
function
|
|
752
|
-
const n =
|
|
753
|
-
|
|
754
|
-
const i =
|
|
755
|
-
makeDecision: (
|
|
756
|
-
type:
|
|
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:
|
|
164
|
+
state: d
|
|
759
165
|
})
|
|
760
|
-
}), [e,
|
|
761
|
-
...
|
|
166
|
+
}), [e, s]), r = u(() => ({
|
|
167
|
+
...t,
|
|
762
168
|
attribute: i
|
|
763
|
-
}), [i,
|
|
169
|
+
}), [i, t]);
|
|
764
170
|
if (i)
|
|
765
|
-
return
|
|
171
|
+
return r;
|
|
766
172
|
}
|
|
767
|
-
function
|
|
768
|
-
const n =
|
|
769
|
-
|
|
770
|
-
const i =
|
|
771
|
-
makeDecision: (
|
|
772
|
-
type:
|
|
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:
|
|
180
|
+
state: d
|
|
775
181
|
})
|
|
776
|
-
}), [e,
|
|
777
|
-
...
|
|
182
|
+
}), [e, s]), r = u(() => ({
|
|
183
|
+
...t,
|
|
778
184
|
attribute: i
|
|
779
|
-
}), [i,
|
|
185
|
+
}), [i, t]);
|
|
780
186
|
if (i)
|
|
781
|
-
return
|
|
782
|
-
}
|
|
783
|
-
function
|
|
784
|
-
const n =
|
|
785
|
-
|
|
786
|
-
const
|
|
787
|
-
makeDecision: (
|
|
788
|
-
type:
|
|
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:
|
|
196
|
+
state: l
|
|
791
197
|
}),
|
|
792
|
-
clearSubtree:
|
|
793
|
-
|
|
198
|
+
clearSubtree: f(
|
|
199
|
+
pe(e, t),
|
|
794
200
|
// Only setMany if there are decisions to clear.
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
201
|
+
o.fromPredicate(a.isNonEmpty),
|
|
202
|
+
o.map((l) => () => i(l, { type: "Default" })),
|
|
203
|
+
o.getOrElse(() => () => Promise.resolve())
|
|
798
204
|
)
|
|
799
|
-
}), [e,
|
|
800
|
-
...
|
|
801
|
-
attribute:
|
|
802
|
-
}), [
|
|
803
|
-
if (
|
|
804
|
-
return
|
|
805
|
-
}
|
|
806
|
-
const
|
|
807
|
-
attributeId:
|
|
808
|
-
decisions:
|
|
809
|
-
}),
|
|
810
|
-
configurationModelSource:
|
|
811
|
-
attributeRelations:
|
|
812
|
-
usageRuleParameters:
|
|
813
|
-
}),
|
|
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
|
-
|
|
245
|
+
g("Shutting down", "SessionManagement:"),
|
|
840
246
|
"disposeOldSession"
|
|
841
247
|
],
|
|
842
248
|
states: {
|
|
843
249
|
ProcessChanges: {
|
|
844
250
|
entry: [
|
|
845
|
-
|
|
846
|
-
|
|
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
|
-
|
|
860
|
-
|
|
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
|
-
|
|
873
|
-
|
|
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
|
-
|
|
894
|
-
|
|
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
|
-
|
|
312
|
+
g("Exiting SessionCreationFailed", "SessionManagement:"),
|
|
907
313
|
"clearSessionCreationError"
|
|
908
314
|
],
|
|
909
315
|
on: {
|
|
910
316
|
RetrySessionCreation: {
|
|
911
317
|
target: "ProcessChanges",
|
|
912
|
-
actions:
|
|
318
|
+
actions: g("Retrying session creation", "SessionManagement:")
|
|
913
319
|
}
|
|
914
320
|
}
|
|
915
321
|
},
|
|
916
322
|
UpdateSession: {
|
|
917
323
|
entry: [
|
|
918
|
-
|
|
919
|
-
|
|
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
|
-
|
|
939
|
-
|
|
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
|
-
|
|
357
|
+
g("Exiting SessionUpdateFailed", "SessionManagement:"),
|
|
952
358
|
"clearSessionUpdateError"
|
|
953
359
|
],
|
|
954
360
|
on: {
|
|
955
361
|
RetrySessionUpdate: {
|
|
956
362
|
target: "ProcessChanges",
|
|
957
|
-
actions:
|
|
363
|
+
actions: g("Retrying session update", "SessionManagement:")
|
|
958
364
|
}
|
|
959
365
|
}
|
|
960
366
|
}
|
|
961
367
|
}
|
|
962
368
|
}, {
|
|
963
369
|
actions: {
|
|
964
|
-
saveDesiredClient:
|
|
370
|
+
saveDesiredClient: c({
|
|
965
371
|
desiredClient: (e, n) => n.client
|
|
966
372
|
}),
|
|
967
|
-
saveDesiredSessionContext:
|
|
373
|
+
saveDesiredSessionContext: c({
|
|
968
374
|
desiredSessionContext: (e, n) => n.sessionContext
|
|
969
375
|
}),
|
|
970
|
-
disposeOldSession:
|
|
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:
|
|
381
|
+
setSessionCreationResult: c((e, n) => ({
|
|
976
382
|
session: n.data.session,
|
|
977
383
|
actualClient: n.data.client
|
|
978
384
|
})),
|
|
979
|
-
setSessionCreationError:
|
|
385
|
+
setSessionCreationError: c((e, n) => ({
|
|
980
386
|
sessionCreationError: n.data
|
|
981
387
|
})),
|
|
982
|
-
clearSessionCreationError:
|
|
983
|
-
setSessionUpdateError:
|
|
388
|
+
clearSessionCreationError: c({ sessionCreationError: () => null }),
|
|
389
|
+
setSessionUpdateError: c((e, n) => ({
|
|
984
390
|
sessionUpdateError: n.data
|
|
985
391
|
})),
|
|
986
|
-
clearSessionUpdateError:
|
|
987
|
-
setHasEverSuccessfullyCreatedSession:
|
|
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 || !
|
|
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 && !
|
|
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
|
-
!
|
|
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
|
-
!
|
|
421
|
+
!w.equals(e.desiredClient, e.actualClient) || !k(q).equals(e.desiredSessionContext, e.sessionUpdateError.sessionContext)
|
|
1016
422
|
)
|
|
1017
423
|
}
|
|
1018
424
|
});
|
|
1019
|
-
function
|
|
1020
|
-
const n = e === 0,
|
|
1021
|
-
return
|
|
1022
|
-
const
|
|
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
|
-
},
|
|
1026
|
-
isUpdating:
|
|
431
|
+
}, d = {
|
|
432
|
+
isUpdating: s && i.sessionUpdateError == null,
|
|
1027
433
|
errorType: i.sessionUpdateError && i.sessionUpdateError.type
|
|
1028
434
|
};
|
|
1029
|
-
return
|
|
435
|
+
return V({
|
|
1030
436
|
type: "SessionManagementStateChanged",
|
|
1031
|
-
sessionInitialization:
|
|
1032
|
-
sessionUpdating:
|
|
437
|
+
sessionInitialization: r,
|
|
438
|
+
sessionUpdating: d,
|
|
1033
439
|
session: i.session
|
|
1034
440
|
});
|
|
1035
441
|
});
|
|
1036
442
|
}
|
|
1037
|
-
const
|
|
443
|
+
const Ae = (e) => (n) => (n({
|
|
1038
444
|
type: "ConfigurationChanged",
|
|
1039
445
|
session: e,
|
|
1040
446
|
configuration: e.getConfiguration()
|
|
1041
|
-
}), e.setOnConfigurationChangedHandler((
|
|
447
|
+
}), e.setOnConfigurationChangedHandler((s) => {
|
|
1042
448
|
n({
|
|
1043
449
|
type: "ConfigurationChanged",
|
|
1044
450
|
session: e,
|
|
1045
|
-
configuration:
|
|
451
|
+
configuration: s
|
|
1046
452
|
});
|
|
1047
453
|
}), () => {
|
|
1048
454
|
e.setOnConfigurationChangedHandler(null);
|
|
1049
|
-
}),
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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) =>
|
|
508
|
+
src: (e, n) => Ae(e.session)
|
|
1103
509
|
}
|
|
1104
510
|
}
|
|
1105
511
|
}
|
|
1106
512
|
}, {
|
|
1107
513
|
actions: {
|
|
1108
|
-
saveSession:
|
|
514
|
+
saveSession: c((e, n) => ({
|
|
1109
515
|
session: n.session
|
|
1110
516
|
}))
|
|
1111
517
|
}
|
|
1112
|
-
}),
|
|
518
|
+
}), Re = () => {
|
|
1113
519
|
let e, n;
|
|
1114
520
|
return {
|
|
1115
|
-
promise: new Promise((i,
|
|
1116
|
-
e = i, n =
|
|
521
|
+
promise: new Promise((i, t) => {
|
|
522
|
+
e = i, n = t;
|
|
1117
523
|
}),
|
|
1118
524
|
resolve: e,
|
|
1119
525
|
reject: n
|
|
1120
526
|
};
|
|
1121
|
-
},
|
|
1122
|
-
const e =
|
|
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
|
-
},
|
|
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:
|
|
548
|
+
isReadyPromise: K()
|
|
1143
549
|
},
|
|
1144
550
|
entry: [
|
|
1145
|
-
|
|
1146
|
-
sessionManagementActor: () =>
|
|
1147
|
-
configurationSubscriptionManagementActor: () =>
|
|
551
|
+
c({
|
|
552
|
+
sessionManagementActor: () => B(Pe()),
|
|
553
|
+
configurationSubscriptionManagementActor: () => B(be())
|
|
1148
554
|
})
|
|
1149
555
|
],
|
|
1150
556
|
exit: [
|
|
1151
|
-
|
|
1152
|
-
|
|
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
|
-
|
|
564
|
+
b((e) => e.sessionManagementActor)
|
|
1159
565
|
]
|
|
1160
566
|
},
|
|
1161
567
|
ChangeSessionContext: {
|
|
1162
568
|
actions: [
|
|
1163
|
-
|
|
569
|
+
b((e) => e.sessionManagementActor)
|
|
1164
570
|
]
|
|
1165
571
|
},
|
|
1166
572
|
RetrySessionCreation: {
|
|
1167
573
|
actions: [
|
|
1168
|
-
|
|
574
|
+
b((e) => e.sessionManagementActor)
|
|
1169
575
|
]
|
|
1170
576
|
},
|
|
1171
577
|
RetrySessionUpdate: {
|
|
1172
578
|
actions: [
|
|
1173
|
-
|
|
579
|
+
b((e) => e.sessionManagementActor)
|
|
1174
580
|
]
|
|
1175
581
|
},
|
|
1176
582
|
SessionManagementStateChanged: {
|
|
1177
583
|
actions: [
|
|
1178
584
|
// Assign the received data
|
|
1179
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
1211
|
-
var
|
|
1212
|
-
const
|
|
1213
|
-
return e.isReadyPromise &&
|
|
1214
|
-
isReadyPromise: (() =>
|
|
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
|
|
1220
|
-
var
|
|
1221
|
-
const [n,
|
|
1222
|
-
logger: (...
|
|
625
|
+
function Me(e) {
|
|
626
|
+
var d, m;
|
|
627
|
+
const [n, s] = ae(ve, {
|
|
628
|
+
logger: (...l) => console.log("ConfigurationManagement:", ...l)
|
|
1223
629
|
});
|
|
1224
|
-
|
|
1225
|
-
|
|
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]),
|
|
1230
|
-
const
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
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
|
-
|
|
641
|
+
s({
|
|
1236
642
|
type: "ChangeSessionContext",
|
|
1237
|
-
sessionContext:
|
|
1238
|
-
}),
|
|
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 =
|
|
646
|
+
const i = u(
|
|
1241
647
|
() => {
|
|
1242
|
-
var
|
|
648
|
+
var l, S, _, O;
|
|
1243
649
|
return {
|
|
1244
|
-
isInitializing: ((
|
|
1245
|
-
isInitializingPromise: (
|
|
1246
|
-
error: ((
|
|
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: () =>
|
|
654
|
+
retry: () => s({ type: "RetrySessionCreation" })
|
|
1249
655
|
}
|
|
1250
656
|
};
|
|
1251
657
|
},
|
|
1252
658
|
[n.context.sessionInitialization, n.context.isReadyPromise]
|
|
1253
|
-
),
|
|
659
|
+
), t = u(
|
|
1254
660
|
() => {
|
|
1255
|
-
var
|
|
661
|
+
var l, S;
|
|
1256
662
|
return {
|
|
1257
|
-
isUpdating: (
|
|
1258
|
-
error: ((
|
|
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: () =>
|
|
666
|
+
retry: () => s({ type: "RetrySessionUpdate" })
|
|
1261
667
|
}
|
|
1262
668
|
};
|
|
1263
669
|
},
|
|
1264
670
|
[n.context.sessionUpdating]
|
|
1265
|
-
),
|
|
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:
|
|
674
|
+
configurationUpdating: t,
|
|
1269
675
|
session: n.context.session,
|
|
1270
|
-
configuration:
|
|
676
|
+
configuration: r
|
|
1271
677
|
};
|
|
1272
678
|
}
|
|
1273
|
-
function
|
|
1274
|
-
const { configurationInitialization: n, configurationUpdating:
|
|
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__ */
|
|
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
|
|
1281
|
-
return
|
|
686
|
+
function Ue() {
|
|
687
|
+
return U(J);
|
|
1282
688
|
}
|
|
1283
|
-
function
|
|
1284
|
-
return
|
|
689
|
+
function Ke() {
|
|
690
|
+
return U(L);
|
|
1285
691
|
}
|
|
1286
|
-
function
|
|
1287
|
-
const { children: n } = e, { isInitializingPromise:
|
|
1288
|
-
if (
|
|
1289
|
-
throw
|
|
1290
|
-
return /* @__PURE__ */
|
|
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
|
|
1293
|
-
const e =
|
|
1294
|
-
return
|
|
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
|
|
1310
|
-
const e =
|
|
1311
|
-
return
|
|
715
|
+
function Je() {
|
|
716
|
+
const e = N(), n = E();
|
|
717
|
+
return T(e), P(n), u(() => ({
|
|
1312
718
|
configuration: n,
|
|
1313
|
-
restoreConfiguration: (
|
|
719
|
+
restoreConfiguration: (s) => e.restoreConfiguration(s)
|
|
1314
720
|
}), [n, e]);
|
|
1315
721
|
}
|
|
1316
722
|
export {
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
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
|
};
|