@uipath/rules-tool 1.206.0-preview.306 → 1.207.0-preview.307

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.
Files changed (51) hide show
  1. package/dist/DmnFactory-2Z66XPBB-dcse77vg.js +10 -0
  2. package/dist/DmnModelTypes-QISEK3CY-vth5tgqd.js +8 -0
  3. package/dist/KieDmnMarshaller-KLYKOHUQ-jae862c0.js +8 -0
  4. package/dist/THIRD-PARTY-NOTICES.md +8 -8
  5. package/dist/{business-rules-zfzwr08c.js → business-rules-4b4d9pw6.js} +4 -4
  6. package/dist/{constants-1sdwfz26.js → constants-yt6m7vkn.js} +12 -12
  7. package/dist/{embedded-file-reader-pxpwcq3n.js → embedded-file-reader-k94wt612.js} +16 -16
  8. package/dist/{first-party-service-ej32b6j2.js → first-party-service-7qzcrnd0.js} +1 -1
  9. package/dist/hitPolicyResult-2NPUZW2E-rddfkhb2.js +14 -0
  10. package/dist/{index-y5yffb2s.js → index-189nh3zq.js} +642 -513
  11. package/dist/{index-s9wmt93c.js → index-d3xnveex.js} +1 -1
  12. package/dist/index-jm0j1yn2.js +212 -0
  13. package/dist/{index-88sps467.js → index-pxmthnvf.js} +7 -5
  14. package/dist/index-xvy3d6qz.js +8 -0
  15. package/dist/index.js +2 -2
  16. package/dist/{rule-catalog-780050xk.js → rule-catalog-fsxqr6cq.js} +34 -10
  17. package/dist/rules-command-error-5jq3z0ny.js +15 -0
  18. package/dist/{rules-debug-service-egk69m8m.js → rules-debug-service-mf2w6w2h.js} +16 -9
  19. package/dist/{rules-init-service-c2ef42yt.js → rules-init-service-91s2epmb.js} +7 -7
  20. package/dist/{rules-refresh-service-x3gfnfqt.js → rules-refresh-service-r7fpbbfv.js} +3 -3
  21. package/dist/{rules-validate-service-e47hgykv.js → rules-validate-service-jrw7c1q9.js} +8 -10
  22. package/dist/{solution-definition-helper-trxp0zbj.js → solution-definition-helper-g2pt2ssz.js} +1 -1
  23. package/dist/{tool-sjp6fvze.js → tool-2cxm18e8.js} +2 -2
  24. package/dist/tool-2grmcreg.js +117 -0
  25. package/dist/{tool-b475et36.js → tool-46g75ed0.js} +3 -3
  26. package/dist/{tool-syavphgt.js → tool-5sgkktdb.js} +287 -139
  27. package/dist/{tool-yfaf9b8c.js → tool-827rm6jp.js} +2986 -729
  28. package/dist/{tool-jzdt6z77.js → tool-c0peefw8.js} +7 -6
  29. package/dist/tool-e83bfqmj.js +192 -0
  30. package/dist/{tool-3755q59j.js → tool-fsmgxvqa.js} +189 -15
  31. package/dist/tool-fv5xtqv5.js +736 -0
  32. package/dist/{tool-n1y01eqv.js → tool-j6wcpmmk.js} +13 -6
  33. package/dist/{tool-vqm4apm6.js → tool-jykscmfk.js} +206 -203
  34. package/dist/{tool-0tbve332.js → tool-kmzhfjw8.js} +64 -10
  35. package/dist/tool-q02dmnzm.js +74 -0
  36. package/dist/{tool-93hqhaj3.js → tool-q3jw2emw.js} +100 -96
  37. package/dist/{tool-xw4zy3sj.js → tool-tybyvxq5.js} +28 -26
  38. package/dist/tool.js +2 -2
  39. package/package.json +2 -2
  40. package/dist/DmnFactory-L7MABUC6-q2sr3grz.js +0 -10
  41. package/dist/DmnModelTypes-ATR7FVKZ-h8srwcxk.js +0 -8
  42. package/dist/KieDmnMarshaller-LGE63WDG-nfkpv8f4.js +0 -8
  43. package/dist/hitPolicyResult-CGCR73CW-jz89f1aa.js +0 -12
  44. package/dist/index-egzwtc07.js +0 -19
  45. package/dist/index-z4kt2kt6.js +0 -8
  46. package/dist/index-zeszs1ra.js +0 -184
  47. package/dist/rules-command-error-2x1vm0wt.js +0 -13
  48. package/dist/tool-2nmqvfmt.js +0 -26
  49. package/dist/tool-89e90qrm.js +0 -777
  50. package/dist/tool-m59a481n.js +0 -49
  51. package/dist/tool-sbtf80ft.js +0 -218
@@ -1,777 +0,0 @@
1
- import {
2
- pe,
3
- me,
4
- ue,
5
- a,
6
- E,
7
- xe,
8
- j,
9
- X,
10
- Re,
11
- J,
12
- ee,
13
- Ce,
14
- te,
15
- ne
16
- } from "./tool-vqm4apm6.js";
17
- import {
18
- m2,
19
- _t,
20
- Is,
21
- Ft,
22
- bs,
23
- Ot,
24
- hs
25
- } from "./tool-93hqhaj3.js";
26
- import {
27
- R
28
- } from "./tool-m59a481n.js";
29
- import {
30
- e,
31
- t,
32
- r,
33
- x2,
34
- A2,
35
- Q,
36
- j2,
37
- q,
38
- y,
39
- I
40
- } from "./tool-sbtf80ft.js";
41
-
42
- // ../../node_modules/@uipath/dmn-editor-utils/dist/chunks/chunk-PMJFR7UV.js
43
- function fe(e2) {
44
- return e2["@_label"] ?? e2["@_name"] ?? "";
45
- }
46
- function v(e2) {
47
- return te("variable" in e2 ? e2.variable?.["@_name"] : undefined, e2["@_name"]);
48
- }
49
- function Ke(e2, n) {
50
- let [o = "", ...t2] = e2, i = n === "lower" ? o.toLowerCase() : o.toUpperCase();
51
- return (/^[\p{L}\p{N}_]+$/u.test(i) ? i : o) + t2.join("");
52
- }
53
- function F(e2) {
54
- let [n = "", ...o] = e2.split(/[^\p{L}\p{N}\p{M}_]+/u).filter(Boolean), t2 = [Ke(n, "lower"), ...o.map((i) => Ke(i, "upper"))].join("") || "element";
55
- return J(t2) ? t2 : J(`_${t2}`) ? `_${t2}` : "element";
56
- }
57
- function L(e2, n, o) {
58
- let t2 = new Set((e2.drgElement ?? []).filter((i) => !o || i["@_id"] !== o).map(v));
59
- return In(t2, F(n));
60
- }
61
- var In = (e2, n) => {
62
- let o = n, t2 = 2;
63
- for (;e2.has(o); )
64
- o = `${n}${t2}`, t2++;
65
- return o;
66
- };
67
- function pe2(e2, n) {
68
- if (n.length === 0)
69
- return;
70
- let o = "expression" in e2 ? e2.expression : undefined, t2 = (i, r) => {
71
- if (i === undefined)
72
- return;
73
- let s = n.reduce((a, [l, m, c]) => c === "callee" ? pe(a, l, m, r) : ue(a, l, m, r), i);
74
- return s === i ? undefined : s;
75
- };
76
- if (o?.__$$element === "literalExpression") {
77
- let i = t2(o.text?.__$$text, "expression");
78
- i !== undefined && (o.text = { ...o.text, __$$text: i });
79
- return;
80
- }
81
- if (o?.__$$element === "decisionTable") {
82
- for (let i of o.input ?? []) {
83
- let r = t2(i.inputExpression.text?.__$$text, "expression");
84
- r !== undefined && (i.inputExpression.text = { ...i.inputExpression.text, __$$text: r });
85
- let s = i.inputValues && t2(i.inputValues.text?.__$$text, "unaryTests");
86
- i.inputValues && s !== undefined && (i.inputValues.text = { ...i.inputValues.text, __$$text: s });
87
- }
88
- for (let i of o.output ?? []) {
89
- let r = i.outputValues && t2(i.outputValues.text?.__$$text, "unaryTests");
90
- i.outputValues && r !== undefined && (i.outputValues.text = { ...i.outputValues.text, __$$text: r });
91
- }
92
- for (let i of o.rule ?? []) {
93
- for (let r of i.inputEntry ?? []) {
94
- let s = t2(r.text?.__$$text, "unaryTests");
95
- s !== undefined && (r.text = { ...r.text, __$$text: s });
96
- }
97
- for (let r of i.outputEntry ?? []) {
98
- let s = t2(r.text?.__$$text, "expression");
99
- s !== undefined && (r.text = { ...r.text, __$$text: s });
100
- }
101
- }
102
- }
103
- }
104
- var jt = new Set([...r, "days and time duration", "years and months duration", "context", "list", "range", "function", "null"]);
105
- var An = (e2) => {
106
- let n = new Map, o = (t2, i) => t2?.forEach((r, s) => {
107
- let a = i?.[s];
108
- a && (n.set(r.id, a), o(r.components, a.itemComponent));
109
- });
110
- return o(A2(e2), e2.itemDefinition), n;
111
- };
112
- var vn = (e2) => e2.includes("/");
113
- var Cn = (e2, n) => {
114
- if (e2 !== undefined)
115
- return n?.text?.__$$text === e2 ? n : { ...n, "@_id": n?.["@_id"] ?? a("allowedValues"), text: { ...n?.text, __$$text: e2 } };
116
- };
117
- var Pn = (e2, n) => e2 ? true : n?.["@_isCollection"] === false ? false : undefined;
118
- var Ln = (e2, n) => {
119
- if (e2 !== undefined)
120
- return n?.__$$text === e2 ? n : { __$$text: e2 };
121
- };
122
- var Ye = (e2) => new Map((e2 ?? []).map((n) => [n.name, n.id]));
123
- var On = (e2, n, o) => {
124
- if (n === undefined)
125
- return false;
126
- if (e2 === n)
127
- return true;
128
- let t2 = o.before.get(x2(e2));
129
- return t2 !== undefined && t2 === o.after.get(x2(n));
130
- };
131
- var Xe = (e2, n, o) => {
132
- let t2 = n.get(e2.id), i = t2 !== undefined && (!!t2["@_isCollection"] !== e2.isCollection || !!t2.itemComponent?.length != !!e2.components?.length), r = t2?.allowedValues, s = t2?.typeRef !== undefined && !On(t2.typeRef.__$$text, e2.typeRef, o), a = i || s || r !== undefined && e2.allowedValues === undefined;
133
- return { ...t2, ...a ? { typeConstraint: undefined } : {}, allowedValues: Cn(e2.allowedValues, r), "@_id": vn(e2.id) ? t2?.["@_id"] : e2.id, "@_name": e2.name, "@_isCollection": Pn(e2.isCollection, t2), typeRef: Ln(e2.typeRef, t2?.typeRef), itemComponent: e2.components?.map((l) => Xe(l, n, o)) };
134
- };
135
- var Ze = (e2, n) => {
136
- let o = An(e2), t2 = { before: Ye(A2(e2)), after: Ye(n) }, i = n?.length ? n.map((r) => Xe(r, o, t2)) : undefined;
137
- i === undefined && e2.itemDefinition === undefined || (e2.itemDefinition = i);
138
- };
139
- var qn = (e2) => (n) => !!e2 && j2(n) === e2;
140
- var Qe = (e2, n, o, t2) => {
141
- let i = [];
142
- for (let r of e2.definitions.drgElement ?? [])
143
- if (!(r.__$$element !== "decision" || r.expression?.__$$element !== "decisionTable") && !(t2 !== undefined && r["@_id"] === t2))
144
- for (let s of r.expression.input ?? []) {
145
- let a = s.inputExpression;
146
- if (!a || !qn(n)(s))
147
- continue;
148
- let l = o(a["@_typeRef"]);
149
- l !== a["@_typeRef"] && (i.push(a["@_typeRef"]), a["@_typeRef"] = l);
150
- }
151
- return i;
152
- };
153
- var De = "http://uipath.com/schema/1.0/business-rules/uninitialized";
154
- var _e = "business-rule-uninitialized";
155
- var Kt = `<?xml version="1.0" encoding="UTF-8"?>
156
- <definitions xmlns="https://www.omg.org/spec/DMN/20230324/MODEL/" id="${_e}" name="" namespace="${De}" />
157
- `;
158
- var Je = `<?xml version="1.0" encoding="UTF-8"?>
159
- <definitions xmlns="https://www.omg.org/spec/DMN/20230324/MODEL/" xmlns:dmndi="https://www.omg.org/spec/DMN/20230324/DMNDI/" xmlns:dc="http://www.omg.org/spec/DMN/20180521/DC/" xmlns:di="http://www.omg.org/spec/DMN/20180521/DI/" xmlns:kie="https://kie.org/dmn/extensions/1.0" id="definitions_1" name="definitions" namespace="http://uipath.com/schema/1.0/dmn">
160
- <decision id="decision_1" name="">
161
- <decisionTable id="decisionTable_1">
162
- <input id="input1" label="">
163
- <inputExpression id="inputExpression1" typeRef="string">
164
- <text></text>
165
- </inputExpression>
166
- </input>
167
- <output id="output1" label="" name="" typeRef="string" />
168
- </decisionTable>
169
- </decision>
170
- <dmndi:DMNDI>
171
- <dmndi:DMNDiagram id="DMNDiagram_1">
172
- <dmndi:DMNShape id="DMNShape_1" dmnElementRef="decision_1">
173
- <dc:Bounds height="80" width="180" x="0" y="0" />
174
- </dmndi:DMNShape>
175
- </dmndi:DMNDiagram>
176
- </dmndi:DMNDI>
177
- </definitions>
178
- `;
179
- var ge = "http://uipath.com/schema/1.0/dmn/authoring";
180
- var en = "uipath";
181
- var j3 = "authoring";
182
- var kn = ["condition-rule", "decision-table", "decision-graph"];
183
- var Vn = ["condition-rule", "decision-table", "literal-expression"];
184
- var nn = new Set(kn);
185
- var Bn = new Set(Vn);
186
- function tn(e2) {
187
- return Object.entries(e2.definitions).flatMap(([n, o]) => o === ge && (n === "@_xmlns" || n.startsWith("@_xmlns:")) ? [n === "@_xmlns" ? "" : `${n.slice(8)}:`] : []);
188
- }
189
- function z2(e2, n) {
190
- let o = e2?.[n === "" ? "@_xmlns" : `@_xmlns:${n.slice(0, -1)}`];
191
- return o !== undefined && o !== ge;
192
- }
193
- function on(e2, n) {
194
- let o = n.extensionElements;
195
- for (let t2 of tn(e2)) {
196
- if (z2(o, t2))
197
- continue;
198
- let i = `${t2}${j3}`, r = o?.[i];
199
- if (r && !z2(Array.isArray(r) ? r[0] : r, t2))
200
- return { key: i, entry: r };
201
- }
202
- }
203
- function xe2(e2, n) {
204
- let o = on(e2, n)?.entry;
205
- return Array.isArray(o) ? o[0] : o;
206
- }
207
- function Un(e2, n) {
208
- let { definitions: o } = e2, t2 = en, i = 2;
209
- for (;o[`@_xmlns:${t2}`] || z2(n, `${t2}:`) || n[`${t2}:${j3}`] !== undefined; )
210
- t2 = `${en}${i++}`;
211
- return o[`@_xmlns:${t2}`] = ge, `${t2}:`;
212
- }
213
- function Fn(e2, n) {
214
- return tn(e2).filter((t2) => !z2(n, t2)).map((t2) => `${t2}${j3}`).find((t2) => n[t2] === undefined) ?? `${Un(e2, n)}${j3}`;
215
- }
216
- function rn(e2, n, o, t2) {
217
- let i = on(e2, n), r = n.extensionElements ?? {};
218
- n.extensionElements = r;
219
- let s = i?.key ?? Fn(e2, r), a = r[s], m = { ...Array.isArray(a) ? a[0] : a, [o]: t2 };
220
- Array.isArray(a) ? a[0] = m : r[s] = m;
221
- }
222
- function sn(e2) {
223
- let n = xe2(e2, e2.definitions)?.["@_surface"];
224
- return typeof n == "string" && nn.has(n) ? n : undefined;
225
- }
226
- function an(e2) {
227
- let n = xe2(e2, e2.definitions)?.["@_surface"];
228
- return typeof n != "string" || nn.has(n);
229
- }
230
- function dn(e2, n) {
231
- let o = xe2(e2, n)?.["@_editor"];
232
- return typeof o != "string" || Bn.has(o);
233
- }
234
- function un(e2, n) {
235
- rn(e2, e2.definitions, "@_surface", n);
236
- }
237
- function cn(e2, n, o) {
238
- rn(e2, n, "@_editor", o);
239
- }
240
- var E2 = { nodeWidth: 288, nodeHeight: 96, horizontalGap: 48, verticalGap: 72 };
241
- var ye = E2.nodeHeight + E2.verticalGap;
242
- var H2 = E2.nodeWidth + E2.horizontalGap;
243
- var ln = E2.nodeWidth * 0.75;
244
- function jn(e2, n) {
245
- return !(e2.x + e2.width + E2.horizontalGap <= n.x || n.x + n.width + E2.horizontalGap <= e2.x || e2.y + e2.height + E2.verticalGap <= n.y || n.y + n.height + E2.verticalGap <= e2.y);
246
- }
247
- function zn(e2, n) {
248
- let o = ({ x: r, y: s }) => [Math.abs(r) + Math.abs(s), Math.abs(s), -r, -s], [t2, i] = [o(e2), o(n)];
249
- for (let [r, s] of t2.entries())
250
- if (s !== i[r])
251
- return s - i[r];
252
- return 0;
253
- }
254
- function Hn(e2) {
255
- let n = [];
256
- for (let o = -e2;o <= e2; o++)
257
- for (let t2 = -e2;t2 <= e2; t2++)
258
- (Math.abs(o) === e2 || Math.abs(t2) === e2) && n.push({ x: o, y: t2 });
259
- return n.sort(zn);
260
- }
261
- function mn(e2, n) {
262
- let o = ({ x: t2, y: i }) => !n.some((r) => jn({ x: t2, y: i, width: E2.nodeWidth, height: E2.nodeHeight }, r));
263
- if (o(e2))
264
- return e2;
265
- for (let t2 = 1;t2 <= n.length; t2++)
266
- for (let i of Hn(t2)) {
267
- let r = { x: e2.x + i.x * H2, y: e2.y + i.y * ye };
268
- if (o(r))
269
- return r;
270
- }
271
- return { x: Math.max(...n.map((t2) => t2.x + t2.width)) + E2.horizontalGap, y: e2.y };
272
- }
273
- var Kn = "https://www.omg.org/spec/DMN/20230324/MODEL/";
274
- function Wn(e2) {
275
- return e2.__$$element === "decision";
276
- }
277
- function w(e2) {
278
- return (e2.drgElement ?? []).filter(Wn);
279
- }
280
- function g(e2) {
281
- return e2["@_id"] ?? "";
282
- }
283
- function _(e2, n) {
284
- return e2["@_id"] || (e2["@_id"] = a(n)), e2["@_id"];
285
- }
286
- function $(e2) {
287
- if (e2)
288
- return e2.startsWith("#") ? e2.slice(1) : e2.includes("#") || e2.includes(":") || e2.includes("/") ? undefined : e2;
289
- }
290
- function Ee(e2, n, o) {
291
- if (!e2)
292
- return;
293
- if (!e2.includes(":"))
294
- return e2.includes("#") || e2.includes("/") ? undefined : e2;
295
- let [t2, i, ...r] = e2.split(":");
296
- if (!t2 || !i || r.length > 0)
297
- return;
298
- let s = y(t2, I(o));
299
- return s === Kn || s === n["@_namespace"] ? i : undefined;
300
- }
301
- function Gn(e2, n, o) {
302
- let t2 = o.indexOf(":");
303
- if (t2 >= 0)
304
- return `${o.slice(0, t2)}:${e2}`;
305
- let i = n["@_namespace"];
306
- if (!i || n["@_xmlns"] === i)
307
- return e2;
308
- let r = Object.entries(n).find(([l, m]) => l.startsWith("@_xmlns:") && m === i)?.[0];
309
- if (r)
310
- return `${r.slice(8)}:${e2}`;
311
- let s = "tns", a = 2;
312
- for (;n[`@_xmlns:${s}`]; )
313
- s = `tns${a++}`;
314
- return n[`@_xmlns:${s}`] = i, `${s}:${e2}`;
315
- }
316
- function fn(e2, n, o) {
317
- let t2 = e2["dmndi:DMNDI"];
318
- if (t2)
319
- for (let i of t2["dmndi:DMNDiagram"] ?? [])
320
- i["dmndi:DMNDiagramElement"] = i["dmndi:DMNDiagramElement"]?.flatMap((r) => {
321
- let s = r["@_dmnElementRef"], a = Ee(s, e2, [r, i, t2, e2]);
322
- if (!a)
323
- return [r];
324
- let l = o?.get(a);
325
- return l ? [{ ...r, "@_dmnElementRef": Gn(l, e2, s ?? "") }] : n.has(a) ? [] : [r];
326
- });
327
- }
328
- function pn(e2, n) {
329
- return e2.drgElement?.find((t2) => t2["@_id"] === n)?.__$$element === "inputData" ? ln : E2.nodeWidth;
330
- }
331
- function Yn(e2, n, o) {
332
- return { __$$element: "dmndi:DMNShape", "@_id": a("DMNShape"), "@_dmnElementRef": n, "dc:Bounds": { "@_x": o.x, "@_y": o.y, "@_width": pn(e2, n), "@_height": E2.nodeHeight } };
333
- }
334
- function Dn(e2, n) {
335
- return e2.drgElement?.find((o) => o["@_id"] === n)?.__$$element;
336
- }
337
- function Xn(e2) {
338
- return e2["dc:Bounds"];
339
- }
340
- function Zn(e2, n) {
341
- let o = e2["dmndi:DMNDI"];
342
- return o ? (o["dmndi:DMNDiagram"] ?? []).flatMap((t2) => (t2["dmndi:DMNDiagramElement"] ?? []).flatMap((i) => {
343
- let r = Xn(i), s = Ee(i["@_dmnElementRef"], e2, [i, t2, o, e2]);
344
- return !r || n && s === n ? [] : [{ x: r["@_x"], y: r["@_y"], width: pn(e2, s ?? ""), height: Math.max(r["@_height"] ?? 0, E2.nodeHeight), kind: s ? Dn(e2, s) : undefined }];
345
- })) : [];
346
- }
347
- function Qn(e2, n) {
348
- let o = Zn(e2);
349
- return o.length === 0 ? { x: 0, y: 0 } : mn(Jn(e2, o, n), o);
350
- }
351
- function Jn(e2, n, o) {
352
- if (o && Dn(e2, o) === "inputData") {
353
- let t2 = n.filter((i) => i.kind === "inputData");
354
- if (t2.length > 0) {
355
- let i = t2.reduce((r, s) => s.x > r.x ? s : r, t2[0]);
356
- return { x: i.x + H2, y: i.y };
357
- }
358
- return { x: Math.min(...n.map((i) => i.x)), y: Math.max(...n.map((i) => i.y)) + ye };
359
- }
360
- return { x: Math.max(...n.map((t2) => t2.x)) + H2, y: Math.min(...n.map((t2) => t2.y)) };
361
- }
362
- function _n(e2, n) {
363
- let o = e2["dmndi:DMNDI"]?.["dmndi:DMNDiagram"]?.[0]?.["dmndi:DMNDiagramElement"];
364
- o?.length && o.push(Yn(e2, n, Qn(e2, n)));
365
- }
366
- var et = e.First;
367
- function nt(e2 = "string") {
368
- return { __$$element: "decisionTable", "@_id": a("decisionTable"), "@_hitPolicy": et, input: [{ "@_id": a("input"), "@_label": "Input 1", inputExpression: { "@_id": a("inputExpression"), "@_typeRef": "string", text: { __$$text: "" } } }], output: [{ "@_id": a("output"), "@_label": "Output 1", "@_name": "output1", "@_typeRef": e2 }], rule: [{ "@_id": a("rule"), inputEntry: [{ "@_id": a("inputEntry"), text: { __$$text: "-" } }], outputEntry: [{ "@_id": a("outputEntry"), text: { __$$text: X } }] }] };
369
- }
370
- function tt(e2) {
371
- return { __$$element: "literalExpression", "@_id": a("literalExpression"), ...e2 ? { "@_typeRef": e2 } : {}, text: { __$$text: "" } };
372
- }
373
- var it = { decisionTable: { editor: "decision-table", create: nt, labelKey: "drd_logic_decision_table", icon: "table" }, literalExpression: { editor: "literal-expression", create: tt, labelKey: "drd_logic_literal_expression", icon: "braces" } };
374
- var si = Object.keys(it);
375
- function be(e2, n, o) {
376
- let t2 = ot(o);
377
- for (let i of e2.drgElement ?? [])
378
- i["@_id"] !== n && pe2(i, t2);
379
- }
380
- function ot(e2) {
381
- let n = new Map(e2), o = [];
382
- for (;n.size > 0; ) {
383
- let t2 = [...n].find(([, i]) => !n.has(i));
384
- if (!t2)
385
- return [...o, ...n];
386
- o.push(t2), n.delete(t2[0]);
387
- }
388
- return o;
389
- }
390
- var gn = ["informationRequirement", "knowledgeRequirement", "authorityRequirement"];
391
- function xn(e2, n) {
392
- let o = new Map((e2.drgElement ?? []).map((r) => [r["@_id"] ?? "", r])), t2 = new Set, i = [n];
393
- for (;i.length > 0; ) {
394
- let r = o.get(i.shift() ?? "");
395
- if (!r)
396
- continue;
397
- let s = [...r.informationRequirement ?? [], ...r.knowledgeRequirement ?? [], ...r.authorityRequirement ?? []];
398
- for (let a of s) {
399
- let l = a.requiredInput?.["@_href"] ?? a.requiredDecision?.["@_href"] ?? a.requiredKnowledge?.["@_href"] ?? a.requiredAuthority?.["@_href"], m = $(l);
400
- !m || t2.has(m) || (t2.add(m), i.push(m));
401
- }
402
- }
403
- return t2;
404
- }
405
- var rt = new Set([..._t.map((e2) => m2[e2]), "feel"]);
406
- function O(e2) {
407
- return !!e2 && !rt.has(e2);
408
- }
409
- function N(e2) {
410
- return e2?.__$$text ?? "";
411
- }
412
- function y2(e2, n) {
413
- return { ...e2, __$$text: n };
414
- }
415
- function K(e2, n, o) {
416
- let t2 = _(n, o);
417
- return e2.has(t2) && (n["@_id"] = a(o), t2 = n["@_id"]), e2.add(t2), t2;
418
- }
419
- function q2(e2) {
420
- return !(e2.import?.length || e2.elementCollection?.length || e2.businessContextElement?.length || [e2["@_expressionLanguage"], e2["@_typeLanguage"]].some(O));
421
- }
422
- function W2(e2) {
423
- return !(e2.supportedObjective?.length || e2.impactedPerformanceIndicator?.length || e2.decisionMaker?.length || e2.decisionOwner?.length || e2.usingProcess?.length || e2.usingTask?.length);
424
- }
425
- function st(e2) {
426
- let n = "expression" in e2 ? e2.expression : undefined, o = n?.__$$element === "decisionTable" ? n.output ?? [] : [];
427
- if (Ce(o.length))
428
- return o.map((t2, i) => ({ name: ee({ id: t2["@_id"] ?? "", label: t2["@_label"], name: t2["@_name"] }, i), typeRef: t2["@_typeRef"] }));
429
- }
430
- function G(e2, n) {
431
- let o = new Set([...(n.informationRequirement ?? []).map((i) => i.requiredDecision?.["@_href"]), ...(n.knowledgeRequirement ?? []).map((i) => i.requiredKnowledge?.["@_href"])].flatMap((i) => {
432
- let r = $(i);
433
- return r ? [r] : [];
434
- })), t2 = g(n);
435
- return (e2.drgElement ?? []).flatMap((i) => {
436
- let r = g(i), s = !o.has(r) && r !== t2 && i.__$$element === "decision" && !xn(e2, r).has(t2);
437
- if (!o.has(r) && !s)
438
- return [];
439
- let a = i.variable, l = te(a?.["@_name"], i["@_name"]);
440
- return l ? [{ name: l, ...i["@_label"] && i["@_label"] !== l ? { label: i["@_label"] } : {}, typeRef: a?.["@_typeRef"], ...s ? { requirableId: r } : {}, members: st(i) }] : [];
441
- });
442
- }
443
- function $e(e2) {
444
- let n = new Set;
445
- for (let [o, t2] of e2)
446
- if (o)
447
- for (let i of me(o, t2))
448
- n.add(i.split(".")[0]);
449
- return n;
450
- }
451
- function C(e2) {
452
- return te(e2.variable?.["@_name"], e2["@_name"]);
453
- }
454
- function Y(e2, n, o) {
455
- return e2.map((t2) => {
456
- let i = _(t2, "inputData"), r = n.get(i), s = C(t2);
457
- return { id: i, name: t2["@_name"], label: t2["@_label"], variableId: t2.variable ? _(t2.variable, "variable") : a("variable"), variableName: t2.variable?.["@_name"], typeRef: t2.variable?.["@_typeRef"], description: t2.description?.__$$text, requirementId: r ? _(r, "informationRequirement") : undefined, requirementFromSource: !!r && !o.has(s) };
458
- });
459
- }
460
- function k(e2) {
461
- let n = new Map;
462
- for (let o of e2.informationRequirement ?? []) {
463
- let t2 = $(o.requiredInput?.["@_href"]);
464
- t2 && n.set(t2, o);
465
- }
466
- return n;
467
- }
468
- function at(e2, n) {
469
- let o = te(n.variableName, n.name) || (n.variableName ?? n.name), t2 = e2?.variable || n.variableId || n.variableName !== undefined || n.typeRef !== undefined ? { ...e2?.variable, "@_id": n.variableId, ...o !== undefined && { "@_name": o }, "@_typeRef": n.typeRef } : undefined;
470
- return { ...e2, __$$element: "inputData", "@_id": n.id, ...n.name !== undefined && { "@_name": n.name }, "@_label": n.label, description: n.description ? y2(e2?.description, n.description) : undefined, variable: t2 };
471
- }
472
- function X2(e2, n) {
473
- return e2.variable || n.variableId || n.variableName !== undefined || n.variableTypeRef !== undefined ? { ...e2.variable, "@_id": n.variableId, "@_name": te(n.variableName, n.name) || n.name, "@_typeRef": n.variableTypeRef } : undefined;
474
- }
475
- function Z(e2, n, o) {
476
- let t2 = new Map(e2.informationRequirement?.map((u) => [g(u), u]) ?? []), i = k(e2), r = (e2.informationRequirement ?? []).filter((u) => u.requiredDecision), s = (n.scopeVariables ?? []).filter((u) => u.requirableId), a2 = s.length > 0 ? o() : new Set, l = new Set(r.flatMap((u) => $(u.requiredDecision?.["@_href"]) ?? [])), m = s.flatMap((u) => a2.has(u.name) && !l.has(u.requirableId ?? "") ? [{ "@_id": a("informationRequirement"), requiredDecision: { "@_href": `#${u.requirableId}` } }] : []), c = n.inputData.flatMap((u) => {
477
- if (!u.requirementId)
478
- return [];
479
- let b = t2.get(u.requirementId) ?? i.get(u.id);
480
- return [{ ...b, "@_id": u.requirementId, requiredDecision: undefined, requiredInput: { ...b?.requiredInput, "@_href": `#${u.id}` } }];
481
- });
482
- return [...r, ...m, ...c];
483
- }
484
- function Q2(e2) {
485
- let n = new Map;
486
- for (let o of e2.drgElement ?? []) {
487
- let t2 = o, i = t2["@_name"];
488
- if (!i || t2["@_label"] || !/\s/.test(i))
489
- continue;
490
- let r = t2.variable?.["@_name"], s = r && !/\s/.test(r) ? r : L(e2, i);
491
- t2["@_label"] = i, t2["@_name"] = s, t2.variable && (t2.variable["@_name"] = s), i !== s && n.set(i, s);
492
- }
493
- for (let o of e2.drgElement ?? []) {
494
- let t2 = o, i = t2["@_name"], r = t2.variable?.["@_name"];
495
- !i || !r || r === i || r !== i.replace(/\s+/g, "") || (n.set(r, i), t2.variable && (t2.variable["@_name"] = i));
496
- }
497
- n.size > 0 && be(e2, "", n);
498
- }
499
- function dt(e2, n, o, t2) {
500
- let i = [];
501
- if (o.size === 0 && t2.size === 0 || (t2.size > 0 && be(e2, n, t2), o.size === 0))
502
- return i;
503
- for (let r of e2.drgElement ?? [])
504
- r.__$$element !== "decision" || g(r) === n || !r.informationRequirement || (r.informationRequirement = r.informationRequirement.filter((s) => {
505
- let a = $(s.requiredInput?.["@_href"]);
506
- return !a || !o.has(a) ? true : (i.push(g(s)), false);
507
- }));
508
- return i;
509
- }
510
- function J2(e2, n, o) {
511
- let t2 = structuredClone(e2.document), i = t2.definitions, r = i.drgElement?.find((d) => d.__$$element === "decision" && g(d) === e2.sourceDecisionId);
512
- if (!r)
513
- throw new Error("Business rule decision is missing");
514
- let s = new Set(e2.sourceInputDataIds), a = i.drgElement?.filter((d) => d.__$$element === "inputData" && s.has(g(d))) ?? [], l = new Map(a.map((d) => [g(d), d])), m = new Map(a.flatMap((d) => d.variable?.["@_id"] ? [[d.variable["@_id"], d]] : [])), c = n.inputData.map((d) => {
515
- let x = l.get(d.id) ?? (d.variableId ? m.get(d.variableId) : undefined);
516
- return { current: x, inputId: d.id, updated: at(x, d) };
517
- }), u = new Map(c.flatMap(({ current: d, updated: x }) => d?.["@_id"] ? [[d["@_id"], x]] : [])), b = c.flatMap(({ current: d, updated: x }) => d ? [] : [x]), T = o(r, n), p = new Set((r.informationRequirement ?? []).filter((d) => !d.requiredDecision).map(g)), h = new Set(n.inputData.map((d) => d.requirementId).filter((d) => !!d)), Re = new Set([...[...p].filter((d) => !h.has(d)), ...a.map(g).filter((d) => !u.has(d))]), f = new Map;
518
- r["@_id"] && r["@_id"] !== n.decision.id && f.set(r["@_id"], n.decision.id);
519
- for (let { current: d, inputId: x } of c)
520
- d?.["@_id"] && d["@_id"] !== x && f.set(d["@_id"], x);
521
- i["@_id"] = n.id, i["@_name"] = n.name, i["@_namespace"] = n.namespace, i["@_exporter"] = n.exporter, i["@_exporterVersion"] = n.exporterVersion, Ze(i, n.itemDefinitions);
522
- let R = new Set(a.map(g).filter((d) => !u.has(d))), Ie = new Map(c.flatMap(({ current: d, updated: x }) => {
523
- let I = d && C(d), A = C(x);
524
- return I && A && I !== A ? [[I, A]] : [];
525
- })), ne = C(r), te = C(T);
526
- ne && te && ne !== te && Ie.set(ne, te), i.drgElement = i.drgElement?.flatMap((d) => {
527
- let x = g(d);
528
- if (x === e2.sourceDecisionId)
529
- return [...b, T];
530
- if (s.has(x)) {
531
- let I = u.get(x);
532
- return I ? [I] : [];
533
- }
534
- return [d];
535
- });
536
- let Rn = dt(i, e2.sourceDecisionId, R, Ie);
537
- for (let { current: d, updated: x } of c) {
538
- let I = x.variable?.["@_typeRef"], A = C(x);
539
- d && A && I !== d.variable?.["@_typeRef"] && Qe(t2, A, () => I, T["@_id"]);
540
- }
541
- fn(i, new Set([...Re, ...Rn]), f);
542
- for (let d of b)
543
- _n(i, g(d));
544
- return t2;
545
- }
546
- function ut(e2) {
547
- return t.includes(e2);
548
- }
549
- function yn(e2, n) {
550
- return e2 ? { id: _(e2, n), text: N(e2.text) } : undefined;
551
- }
552
- var ct = new Set(["decision", "inputData", "businessKnowledgeModel", "knowledgeSource"]);
553
- var lt = new Set(["textAnnotation", "association"]);
554
- function he(e2) {
555
- let n = e2.definitions;
556
- return q2(n) ? (n.drgElement ?? []).every((t2) => ct.has(t2.__$$element)) && (n.artifact ?? []).every((t2) => lt.has(t2.__$$element)) : false;
557
- }
558
- function mt(e2, n) {
559
- let o = e2.definitions;
560
- w(o).length > 1 && Q2(o);
561
- let t2 = n !== undefined;
562
- if (!q2(o) || !t2 && o.artifact?.length)
563
- return;
564
- let i = w(o), r = o.drgElement?.filter((f) => f.__$$element === "inputData") ?? [];
565
- if (!t2 && (i.length !== 1 || i.length + r.length !== (o.drgElement?.length ?? 0)))
566
- return;
567
- let s = t2 ? i.find((f) => g(f) === n) : i[0];
568
- if (!s)
569
- return;
570
- let a = s.expression?.__$$element === "decisionTable" ? s.expression : undefined, l = new Set(r.map(g)), m = new Set;
571
- if (!a || !t2 && (s.knowledgeRequirement?.length || s.authorityRequirement?.length) || !W2(s) || s.informationRequirement?.some((f) => {
572
- if (f.requiredDecision)
573
- return !t2;
574
- let R = $(f.requiredInput?.["@_href"]);
575
- return !R || !l.has(R) || m.has(R) ? true : (m.add(R), false);
576
- }))
577
- return;
578
- let c = a["@_hitPolicy"] ?? e.Unique, u = a["@_aggregation"], b = a.input?.length ?? 0, T = a.output.length, p = a.annotation?.length ?? 0;
579
- if (!(!ut(c) || u !== undefined && (c !== e.Collect || !R(u)) || T === 0 || a.output.some((f) => f.defaultOutputEntry) || p > 1 || a.rule?.some((f) => (f.inputEntry?.length ?? 0) !== b || f.outputEntry.length !== T || (f.annotationEntry?.length ?? 0) !== p) || [...(a.input ?? []).flatMap((f) => [f.inputExpression["@_expressionLanguage"], f.inputValues?.["@_expressionLanguage"]]), ...a.output.map((f) => f.outputValues?.["@_expressionLanguage"]), ...a.rule?.flatMap((f) => [...f.inputEntry?.map((R) => R["@_expressionLanguage"]) ?? [], ...f.outputEntry.map((R) => R["@_expressionLanguage"])]) ?? []].some(O) || [...(a.input ?? []).map((f) => f.inputValues), ...a.output.map((f) => f.outputValues)].some((f) => f?.extensionElements !== undefined)))
580
- return { definitions: o, decision: s, table: a, inputData: r, scopeVariables: t2 ? G(o, s) : [], hitPolicy: c };
581
- }
582
- function ft(e2, n) {
583
- let o = mt(e2, n);
584
- if (!o)
585
- return;
586
- let { definitions: t2, decision: i, table: r, inputData: s, hitPolicy: a2 } = o, l = new Set, m = new Set, c = r.input?.map((p) => ({ id: K(l, p, "input"), label: p["@_label"], expressionId: _(p.inputExpression, "inputExpression"), expressionText: N(p.inputExpression.text), typeRef: p.inputExpression["@_typeRef"], allowedValues: yn(p.inputValues, "inputValues") })) ?? [], u = r.output.map((p) => ({ id: K(l, p, "output"), label: p["@_label"], name: p["@_name"], typeRef: p["@_typeRef"], allowedValues: yn(p.outputValues, "outputValues"), description: p.description?.__$$text })), b = r.rule?.map((p) => ({ id: K(m, p, "rule"), description: p.description?.__$$text, inputEntries: p.inputEntry?.map((h) => ({ id: _(h, "inputEntry"), text: N(h.text) })) ?? [], outputEntries: p.outputEntry.map((h) => ({ id: _(h, "outputEntry"), text: yt(N(h.text)) })), annotationEntries: r.annotation?.length ? p.annotationEntry?.map((h) => N(h.text)) ?? [] : [""] })) ?? [], T = xe({ inputs: c, outputs: u, rules: b });
587
- return { id: _(t2, "definitions"), name: t2["@_name"], ...o.scopeVariables.length ? { scopeVariables: o.scopeVariables } : {}, exporter: t2["@_exporter"], exporterVersion: t2["@_exporterVersion"], ...Q(t2), namespace: t2["@_namespace"], externalTypeRefs: q(t2, i), inputData: Y(s, k(i), T), decision: { id: _(i, "decision"), name: i["@_name"] ?? "", label: i["@_label"], variableId: i.variable ? _(i.variable, "variable") : a("variable"), variableName: i.variable?.["@_name"], variableTypeRef: i.variable?.["@_typeRef"], description: i.description?.__$$text, question: i.question?.__$$text, allowedAnswers: i.allowedAnswers?.__$$text, decisionTable: { id: _(r, "decisionTable"), label: r["@_label"], typeRef: r["@_typeRef"], outputLabel: r["@_outputLabel"], preferredOrientation: r["@_preferredOrientation"], hitPolicy: a2, aggregation: R(r["@_aggregation"]) ? r["@_aggregation"] : undefined, inputs: c, outputs: u, annotations: r.annotation?.length ? r.annotation.map((p) => ({ name: p["@_name"] })) : [{ name: j }], rules: b } } };
588
- }
589
- function pt(e2, n) {
590
- let o = structuredClone(e2), t2 = ft(o, n);
591
- return t2 ? { document: o, model: t2, sourceDecisionId: t2.decision.id, sourceInputDataIds: t2.inputData.map((i) => i.id) } : undefined;
592
- }
593
- function En(e2, n) {
594
- return n ? { ...e2, "@_id": n.id, text: y2(e2?.text, n.text) } : undefined;
595
- }
596
- function Dt(e2) {
597
- switch (e2) {
598
- case "Rule-as-Row":
599
- case "Rule-as-Column":
600
- case "CrossTable":
601
- return e2;
602
- default:
603
- return;
604
- }
605
- }
606
- function _t2(e2, n) {
607
- let o = !e2.annotation?.length && n.annotations.length === 1 && n.annotations[0].name === j && n.rules.every((s) => s.annotationEntries.length === 1 && s.annotationEntries[0] === ""), t2 = new Map(e2.input?.map((s) => [s["@_id"], s]) ?? []), i = new Map(e2.output.map((s) => [s["@_id"], s])), r = new Map(e2.rule?.map((s) => [s["@_id"], s]) ?? []);
608
- return { ...e2, "@_id": n.id, "@_label": n.label, "@_typeRef": n.typeRef, "@_outputLabel": n.outputLabel, "@_preferredOrientation": Dt(n.preferredOrientation), "@_hitPolicy": n.hitPolicy === e.Unique ? undefined : n.hitPolicy, "@_aggregation": n.hitPolicy === e.Collect ? n.aggregation : undefined, input: n.inputs.map((s) => {
609
- let a = t2.get(s.id);
610
- return { ...a, "@_id": s.id, "@_label": s.label, inputExpression: { ...a?.inputExpression, "@_id": s.expressionId, "@_typeRef": s.typeRef, text: y2(a?.inputExpression.text, s.expressionText) }, inputValues: En(a?.inputValues, s.allowedValues) };
611
- }), output: n.outputs.map((s) => {
612
- let a = i.get(s.id);
613
- return { ...a, "@_id": s.id, "@_label": s.label, "@_name": s.name, "@_typeRef": s.typeRef, description: s.description ? y2(a?.description, s.description) : undefined, outputValues: En(a?.outputValues, s.allowedValues) };
614
- }), annotation: o ? undefined : n.annotations.map((s, a) => ({ ...e2.annotation?.[a], "@_name": s.name })), rule: n.rules.map((s) => {
615
- let a = r.get(s.id), l = new Map(a?.inputEntry?.map((c) => [c["@_id"], c]) ?? []), m = new Map(a?.outputEntry.map((c) => [c["@_id"], c]) ?? []);
616
- return { ...a, "@_id": s.id, description: s.description === undefined ? undefined : y2(a?.description, s.description), inputEntry: s.inputEntries.map((c) => {
617
- let u = l.get(c.id);
618
- return { ...u, "@_id": c.id, text: y2(u?.text, c.text) };
619
- }), outputEntry: s.outputEntries.map((c) => {
620
- let u = m.get(c.id);
621
- return { ...u, "@_id": c.id, text: y2(u?.text, xt(c.text)) };
622
- }), annotationEntry: o ? undefined : s.annotationEntries.map((c, u) => ({ ...a?.annotationEntry?.[u], text: y2(a?.annotationEntry?.[u]?.text, c) })) };
623
- }) };
624
- }
625
- function gt(e2, n) {
626
- let o = e2.expression?.__$$element === "decisionTable" ? e2.expression : undefined;
627
- if (!o)
628
- throw new Error("Business rule decision table is missing");
629
- return { ...e2, __$$element: "decision", "@_id": n.decision.id, "@_name": n.decision.name, "@_label": n.decision.label, description: n.decision.description === undefined ? undefined : y2(e2.description, n.decision.description), question: n.decision.question === undefined ? undefined : y2(e2.question, n.decision.question), allowedAnswers: n.decision.allowedAnswers === undefined ? undefined : y2(e2.allowedAnswers, n.decision.allowedAnswers), variable: X2(e2, n.decision), informationRequirement: Z(e2, n, () => E(n.decision.decisionTable)), expression: _t2(o, n.decision.decisionTable) };
630
- }
631
- var xt = (e2) => e2.trim() ? e2 : X;
632
- var yt = (e2) => Re(e2) ? "" : e2;
633
- function Et(e2, n) {
634
- return J2(e2, n, gt);
635
- }
636
- var ee2 = { createEditorProjection: pt, updateDmnDocument: Et };
637
- function bt(e2, n) {
638
- let o = e2.definitions;
639
- w(o).length > 1 && Q2(o);
640
- let t2 = n !== undefined;
641
- if (!q2(o) || !t2 && o.artifact?.length)
642
- return;
643
- let i = w(o), r = o.drgElement?.filter((c) => c.__$$element === "inputData") ?? [];
644
- if (!t2 && (i.length !== 1 || i.length + r.length !== (o.drgElement?.length ?? 0)))
645
- return;
646
- let s = t2 ? i.find((c) => g(c) === n) : i[0];
647
- if (!s || !W2(s))
648
- return;
649
- let a = new Set(r.map(g)), l = new Set;
650
- if (!t2 && (s.knowledgeRequirement?.length || s.authorityRequirement?.length) || s.informationRequirement?.some((c) => {
651
- if (c.requiredDecision)
652
- return !t2;
653
- let u = $(c.requiredInput?.["@_href"]);
654
- return !u || !a.has(u) || l.has(u) ? true : (l.add(u), false);
655
- }))
656
- return;
657
- let m = s.expression?.__$$element === "literalExpression" ? s.expression : undefined;
658
- if (m && m.importedValues === undefined && !O(m["@_expressionLanguage"]))
659
- return { definitions: o, decision: s, expression: m, inputData: r, scopeVariables: G(o, s) };
660
- }
661
- function $t(e2, n) {
662
- let o = bt(e2, n);
663
- if (!o)
664
- return;
665
- let { definitions: t2, decision: i, expression: r, inputData: s } = o;
666
- return { id: _(t2, "definitions"), name: t2["@_name"], ...o.scopeVariables.length ? { scopeVariables: o.scopeVariables } : {}, exporter: t2["@_exporter"], exporterVersion: t2["@_exporterVersion"], ...Q(t2), namespace: t2["@_namespace"], externalTypeRefs: q(t2, i), inputData: Y(s, k(i), new Set), decision: { id: _(i, "decision"), name: i["@_name"] ?? "", label: i["@_label"], variableId: i.variable ? _(i.variable, "variable") : a("variable"), variableName: i.variable?.["@_name"], variableTypeRef: i.variable?.["@_typeRef"], description: i.description?.__$$text, question: i.question?.__$$text, allowedAnswers: i.allowedAnswers?.__$$text, literalExpression: { id: _(r, "literalExpression"), label: r["@_label"], typeRef: r["@_typeRef"], text: N(r.text), expressionLanguage: r["@_expressionLanguage"] } } };
667
- }
668
- function ht(e2, n) {
669
- let o = structuredClone(e2), t2 = $t(o, n);
670
- return t2 ? { document: o, model: t2, sourceDecisionId: t2.decision.id, sourceInputDataIds: t2.inputData.map((i) => i.id) } : undefined;
671
- }
672
- function Rt(e2, n) {
673
- return { ...e2, "@_id": n.id, "@_label": n.label, "@_typeRef": n.typeRef, "@_expressionLanguage": n.expressionLanguage, text: y2(e2.text, n.text) };
674
- }
675
- function It(e2, n) {
676
- let o = e2.expression?.__$$element === "literalExpression" ? e2.expression : undefined;
677
- if (!o)
678
- throw new Error("Business rule literal expression is missing");
679
- return { ...e2, __$$element: "decision", "@_id": n.decision.id, "@_name": n.decision.name, "@_label": n.decision.label, description: n.decision.description === undefined ? undefined : y2(e2.description, n.decision.description), question: n.decision.question === undefined ? undefined : y2(e2.question, n.decision.question), allowedAnswers: n.decision.allowedAnswers === undefined ? undefined : y2(e2.allowedAnswers, n.decision.allowedAnswers), variable: X2(e2, n.decision), informationRequirement: Z(e2, n, () => $e([[n.decision.literalExpression.text, "expression"]])), expression: Rt(o, n.decision.literalExpression) };
680
- }
681
- function Tt(e2) {
682
- if (e2.inputData.every((t2) => t2.requirementId))
683
- return e2;
684
- let n = $e([[e2.decision.literalExpression.text, "expression"]]), o = e2.inputData.map((t2) => t2.requirementId || !n.has(ne(t2)) ? t2 : { ...t2, requirementId: a("informationRequirement") });
685
- return { ...e2, inputData: o };
686
- }
687
- function wt(e2, n) {
688
- return J2(e2, Tt(n), It);
689
- }
690
- var bn = { createEditorProjection: ht, updateDmnDocument: wt };
691
- var V;
692
- function $n(e2) {
693
- let n = e2.definitions;
694
- for (let o of n.drgElement ?? []) {
695
- _(o, o.__$$element);
696
- for (let t2 of gn) {
697
- let i = o[t2];
698
- if (Array.isArray(i))
699
- for (let r of i)
700
- _(r, t2);
701
- }
702
- }
703
- for (let o of n.artifact ?? [])
704
- _(o, o.__$$element);
705
- return { kind: "drd", document: e2 };
706
- }
707
- var Nt = { "condition-rule": true, "decision-table": true, "decision-graph": false };
708
- function Mt(e2) {
709
- let n = sn(e2);
710
- return n === undefined || Nt[n];
711
- }
712
- function hn(e2, { allowDrdDocuments: n = false }) {
713
- let o = e2.definitions;
714
- if (o["@_namespace"] === De && o["@_id"] === _e && o["@_name"] === "" && Object.keys(o).every((i) => i.startsWith("@_xmlns") || i === "@_id" || i === "@_name" || i === "@_namespace"))
715
- return { kind: "uninitialized" };
716
- if (n && !Mt(e2))
717
- return he(e2) ? $n(e2) : { kind: "unsupported", reason: "unsupported-profile" };
718
- let t2 = ee2.createEditorProjection(e2);
719
- return t2 ? { kind: "decision-table", model: t2.model, context: { document: t2.document, sourceDecisionId: t2.sourceDecisionId, sourceInputDataIds: t2.sourceInputDataIds } } : n && he(e2) ? $n(e2) : { kind: "unsupported", reason: "unsupported-profile" };
720
- }
721
- function St(e2, n = {}) {
722
- if (V?.xml === e2 && V.allowDrdDocuments === !!n.allowDrdDocuments) {
723
- let { result: i } = V;
724
- return V = undefined, i;
725
- }
726
- if (!e2.trim())
727
- return { kind: "uninitialized" };
728
- let o = Ft(e2);
729
- if (o.status === "error")
730
- return { kind: "unsupported", reason: o.reason };
731
- let t2 = Is(o.losses);
732
- if (t2)
733
- return { kind: "unsupported", reason: t2 };
734
- if (o.originalVersion !== "1.1")
735
- try {
736
- return hn(Ot(e2), n);
737
- } catch (i) {
738
- return console.error("DMN: could not project a well-formed document", i), { kind: "unsupported", reason: "invalid-xml" };
739
- }
740
- }
741
- async function At(e2, n = {}) {
742
- let o = St(e2, n);
743
- if (o)
744
- return o;
745
- let t2 = await bs(e2);
746
- if (t2.status === "error")
747
- return { kind: "unsupported", reason: t2.reason };
748
- try {
749
- return hn(t2.document, n);
750
- } catch (i) {
751
- return console.error("DMN: could not project a well-formed document", i), { kind: "unsupported", reason: "invalid-xml" };
752
- }
753
- }
754
- function vt(e2, n, o) {
755
- let t2 = w(e2.definitions).find((i) => g(i) === n);
756
- t2 && dn(e2, t2) && cn(e2, t2, o);
757
- }
758
- function Ui(e2) {
759
- return bn.createEditorProjection(e2)?.model;
760
- }
761
- function Fi() {
762
- let e2 = ee2.createEditorProjection(Ot(Je));
763
- if (!e2)
764
- throw new Error("Default business rule is not a decision table");
765
- return { document: e2.document, sourceDecisionId: e2.sourceDecisionId, sourceInputDataIds: e2.sourceInputDataIds };
766
- }
767
- function ji(e2) {
768
- return hs(e2);
769
- }
770
- function zi(e2, n, o = "decision-table") {
771
- let t2 = ee2.updateDmnDocument(n, e2);
772
- return an(t2) && un(t2, o), vt(t2, e2.decision.id, "decision-table"), { document: t2, xml: hs(t2) };
773
- }
774
-
775
- export { fe, w, g, $, At, Ui, Fi, ji, zi };
776
-
777
- //# debugId=1D88B2D6E9BFF11564756E2164756E21