@uipath/rules-tool 1.206.0-preview.301 → 1.207.0-preview.305

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