sovana-solver 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/data/public_rules_50.json +1379 -0
- package/data/terminology_vi.json +235 -0
- package/dist/core.d.ts +6 -0
- package/dist/core.d.ts.map +1 -0
- package/dist/core.js +6 -0
- package/dist/core.js.map +1 -0
- package/dist/dag.d.ts +4 -0
- package/dist/dag.d.ts.map +1 -0
- package/dist/dag.js +820 -0
- package/dist/dag.js.map +1 -0
- package/dist/data.browser.d.ts +16 -0
- package/dist/data.browser.d.ts.map +1 -0
- package/dist/data.browser.js +80 -0
- package/dist/data.browser.js.map +1 -0
- package/dist/data.d.ts +16 -0
- package/dist/data.d.ts.map +1 -0
- package/dist/data.js +61 -0
- package/dist/data.js.map +1 -0
- package/dist/hopban.d.ts +4 -0
- package/dist/hopban.d.ts.map +1 -0
- package/dist/hopban.js +435 -0
- package/dist/hopban.js.map +1 -0
- package/dist/index.browser.d.ts +3 -0
- package/dist/index.browser.d.ts.map +1 -0
- package/dist/index.browser.js +3 -0
- package/dist/index.browser.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/rectify.d.ts +21 -0
- package/dist/rectify.d.ts.map +1 -0
- package/dist/rectify.js +1128 -0
- package/dist/rectify.js.map +1 -0
- package/dist/store.d.ts +9 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +17 -0
- package/dist/store.js.map +1 -0
- package/dist/types.d.ts +389 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +77 -3
- package/README.md +0 -3
package/dist/dag.js
ADDED
|
@@ -0,0 +1,820 @@
|
|
|
1
|
+
import { floorMod } from 'sovana-geo-time';
|
|
2
|
+
import { loadSampleRules } from './store.js';
|
|
3
|
+
function cmpStr(a, b) {
|
|
4
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
5
|
+
}
|
|
6
|
+
function sortedUnique(items) {
|
|
7
|
+
if (items.length === 0)
|
|
8
|
+
return [];
|
|
9
|
+
const set = new Set(items);
|
|
10
|
+
return Array.from(set).sort(cmpStr);
|
|
11
|
+
}
|
|
12
|
+
const ELEMENT_INDEX = {
|
|
13
|
+
Mộc: 0,
|
|
14
|
+
Hỏa: 1,
|
|
15
|
+
Thổ: 2,
|
|
16
|
+
Kim: 3,
|
|
17
|
+
Thủy: 4,
|
|
18
|
+
};
|
|
19
|
+
// Branch 0=Tý .. 11=Hợi -> Five Element index (Mộc=0, Hỏa=1, Thổ=2, Kim=3, Thủy=4)
|
|
20
|
+
const BRANCH_ELEMENT_INDEX = [
|
|
21
|
+
4, // 0 Tý: Thủy
|
|
22
|
+
2, // 1 Sửu: Thổ
|
|
23
|
+
0, // 2 Dần: Mộc
|
|
24
|
+
0, // 3 Mão: Mộc
|
|
25
|
+
2, // 4 Thìn: Thổ
|
|
26
|
+
1, // 5 Tỵ: Hỏa
|
|
27
|
+
1, // 6 Ngọ: Hỏa
|
|
28
|
+
2, // 7 Mùi: Thổ
|
|
29
|
+
3, // 8 Thân: Kim
|
|
30
|
+
3, // 9 Dậu: Kim
|
|
31
|
+
2, // 10 Tuất: Thổ
|
|
32
|
+
4, // 11 Hợi: Thủy
|
|
33
|
+
];
|
|
34
|
+
const TIEN_THAN_PAIRS = new Set([
|
|
35
|
+
'11->0',
|
|
36
|
+
'2->3',
|
|
37
|
+
'5->6',
|
|
38
|
+
'8->9',
|
|
39
|
+
'1->4',
|
|
40
|
+
'4->7',
|
|
41
|
+
'7->10',
|
|
42
|
+
]);
|
|
43
|
+
const THOAI_THAN_PAIRS = new Set([
|
|
44
|
+
'0->11',
|
|
45
|
+
'3->2',
|
|
46
|
+
'6->5',
|
|
47
|
+
'9->8',
|
|
48
|
+
'4->1',
|
|
49
|
+
'7->4',
|
|
50
|
+
'10->7',
|
|
51
|
+
]);
|
|
52
|
+
function normalizePalaceKey(name) {
|
|
53
|
+
const trimmed = name.trim();
|
|
54
|
+
if (trimmed === 'Giao Hữu' || trimmed === 'Nô Bộc')
|
|
55
|
+
return 'Nô Bộc';
|
|
56
|
+
return trimmed;
|
|
57
|
+
}
|
|
58
|
+
function findPalace(ziwei, palaceQuery) {
|
|
59
|
+
const target = normalizePalaceKey(palaceQuery);
|
|
60
|
+
if (target === 'Thân') {
|
|
61
|
+
return ziwei.palaces.find((p) => p.isThan || p.branchIndex === ziwei.thanBranch);
|
|
62
|
+
}
|
|
63
|
+
return ziwei.palaces.find((p) => normalizePalaceKey(p.palaceName) === target);
|
|
64
|
+
}
|
|
65
|
+
function findPalaceByBranch(ziwei, branchIndex) {
|
|
66
|
+
const b = floorMod(branchIndex, 12);
|
|
67
|
+
return ziwei.palaces.find((p) => p.branchIndex === b);
|
|
68
|
+
}
|
|
69
|
+
function palaceHasStarOrTransform(palace, starOrTransform) {
|
|
70
|
+
for (const s of palace.majorStars) {
|
|
71
|
+
if (s.name === starOrTransform || s.sihuaTransform === starOrTransform)
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
for (const s of palace.minorStars) {
|
|
75
|
+
if (s.name === starOrTransform || s.sihuaTransform === starOrTransform)
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
if (palace.thaiTueStar === starOrTransform ||
|
|
79
|
+
palace.trangSinhStar === starOrTransform ||
|
|
80
|
+
palace.bacSyStar === starOrTransform) {
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
function selectZiweiChart(chart, ruleSilo, explicitSilo) {
|
|
86
|
+
const siloId = explicitSilo !== undefined ? explicitSilo : ruleSilo === 'toan-thu' ? 'toan-thu' : 'nam-phai';
|
|
87
|
+
return {
|
|
88
|
+
siloId,
|
|
89
|
+
ziwei: siloId === 'toan-thu' ? chart.ziweiToanThu : chart.ziweiNamPhai,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
function baziHasTenGod(chart, tenGod) {
|
|
93
|
+
const pillars = [
|
|
94
|
+
chart.bazi.yearPillar,
|
|
95
|
+
chart.bazi.monthPillar,
|
|
96
|
+
chart.bazi.dayPillar,
|
|
97
|
+
chart.bazi.hourPillar,
|
|
98
|
+
];
|
|
99
|
+
for (const p of pillars) {
|
|
100
|
+
if (p.position !== 'day' && p.stemTenGod === tenGod) {
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
103
|
+
for (const hs of p.hiddenStems) {
|
|
104
|
+
if (hs.tenGod === tenGod) {
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
function computeTheUngRelation(chart) {
|
|
112
|
+
const ly = chart.liuyao;
|
|
113
|
+
if (!ly)
|
|
114
|
+
return null;
|
|
115
|
+
const theLine = ly.lines.find((l) => l.isThe);
|
|
116
|
+
const ungLine = ly.lines.find((l) => l.isUng);
|
|
117
|
+
if (!theLine || !ungLine)
|
|
118
|
+
return null;
|
|
119
|
+
const eThe = ELEMENT_INDEX[theLine.elementVi];
|
|
120
|
+
const eUng = ELEMENT_INDEX[ungLine.elementVi];
|
|
121
|
+
if (eThe === undefined || eUng === undefined)
|
|
122
|
+
return null;
|
|
123
|
+
if (eThe === eUng)
|
|
124
|
+
return 'TY_HOA';
|
|
125
|
+
if ((eThe + 1) % 5 === eUng)
|
|
126
|
+
return 'THE_SINH_UNG';
|
|
127
|
+
if ((eUng + 1) % 5 === eThe)
|
|
128
|
+
return 'UNG_SINH_THE';
|
|
129
|
+
if ((eThe + 2) % 5 === eUng)
|
|
130
|
+
return 'THE_KHAC_UNG';
|
|
131
|
+
return 'UNG_KHAC_THE';
|
|
132
|
+
}
|
|
133
|
+
function evalLiuyaoFlag(chart, flag) {
|
|
134
|
+
const ly = chart.liuyao;
|
|
135
|
+
if (!ly)
|
|
136
|
+
return false;
|
|
137
|
+
const theLine = ly.lines.find((l) => l.isThe);
|
|
138
|
+
const ungLine = ly.lines.find((l) => l.isUng);
|
|
139
|
+
switch (flag) {
|
|
140
|
+
case 'theTuanKhong':
|
|
141
|
+
return Boolean(theLine?.isTuanKhong);
|
|
142
|
+
case 'theNguyetPha':
|
|
143
|
+
return Boolean(theLine?.isNguyetPha);
|
|
144
|
+
case 'ungTuanKhong':
|
|
145
|
+
return Boolean(ungLine?.isTuanKhong);
|
|
146
|
+
case 'ungNguyetPha':
|
|
147
|
+
return Boolean(ungLine?.isNguyetPha);
|
|
148
|
+
case 'theDong':
|
|
149
|
+
return Boolean(theLine?.isMoving);
|
|
150
|
+
case 'ungDong':
|
|
151
|
+
return Boolean(ungLine?.isMoving);
|
|
152
|
+
case 'hoaTienThan':
|
|
153
|
+
return ly.lines.some((l) => l.isMoving &&
|
|
154
|
+
l.transformedBranchIndex !== null &&
|
|
155
|
+
TIEN_THAN_PAIRS.has(`${l.branchIndex}->${l.transformedBranchIndex}`));
|
|
156
|
+
case 'hoaThoaiThan':
|
|
157
|
+
return ly.lines.some((l) => l.isMoving &&
|
|
158
|
+
l.transformedBranchIndex !== null &&
|
|
159
|
+
THOAI_THAN_PAIRS.has(`${l.branchIndex}->${l.transformedBranchIndex}`));
|
|
160
|
+
case 'hoaHoiDauSinh':
|
|
161
|
+
return ly.lines.some((l) => {
|
|
162
|
+
if (!l.isMoving || l.transformedElementVi === null)
|
|
163
|
+
return false;
|
|
164
|
+
const ePrim = ELEMENT_INDEX[l.elementVi];
|
|
165
|
+
const eTrans = ELEMENT_INDEX[l.transformedElementVi];
|
|
166
|
+
return ePrim !== undefined && eTrans !== undefined && (eTrans + 1) % 5 === ePrim;
|
|
167
|
+
});
|
|
168
|
+
case 'hoaHoiDauKhac':
|
|
169
|
+
return ly.lines.some((l) => {
|
|
170
|
+
if (!l.isMoving || l.transformedElementVi === null)
|
|
171
|
+
return false;
|
|
172
|
+
const ePrim = ELEMENT_INDEX[l.elementVi];
|
|
173
|
+
const eTrans = ELEMENT_INDEX[l.transformedElementVi];
|
|
174
|
+
return ePrim !== undefined && eTrans !== undefined && (eTrans + 2) % 5 === ePrim;
|
|
175
|
+
});
|
|
176
|
+
case 'theVuongTuong':
|
|
177
|
+
case 'theHuuTu': {
|
|
178
|
+
if (!theLine)
|
|
179
|
+
return false;
|
|
180
|
+
const eThe = ELEMENT_INDEX[theLine.elementVi];
|
|
181
|
+
const eMonth = BRANCH_ELEMENT_INDEX[floorMod(ly.monthBranchIndex, 12)];
|
|
182
|
+
if (eThe === undefined || eMonth === undefined)
|
|
183
|
+
return false;
|
|
184
|
+
const isVT = eThe === eMonth || (eMonth + 1) % 5 === eThe;
|
|
185
|
+
return flag === 'theVuongTuong' ? isVT : !isVT;
|
|
186
|
+
}
|
|
187
|
+
case 'hasPhucThan':
|
|
188
|
+
return ly.phucThan.length > 0;
|
|
189
|
+
case 'phiSinhPhuc':
|
|
190
|
+
return ly.phucThan.some((p) => {
|
|
191
|
+
const a = ELEMENT_INDEX[p.phiThanElementVi];
|
|
192
|
+
const b = ELEMENT_INDEX[p.elementVi];
|
|
193
|
+
return a !== undefined && b !== undefined && (a + 1) % 5 === b;
|
|
194
|
+
});
|
|
195
|
+
case 'phiKhacPhuc':
|
|
196
|
+
return ly.phucThan.some((p) => {
|
|
197
|
+
const a = ELEMENT_INDEX[p.phiThanElementVi];
|
|
198
|
+
const b = ELEMENT_INDEX[p.elementVi];
|
|
199
|
+
return a !== undefined && b !== undefined && (a + 2) % 5 === b;
|
|
200
|
+
});
|
|
201
|
+
case 'phiLamKhongPha':
|
|
202
|
+
return ly.phucThan.some((p) => {
|
|
203
|
+
const line = ly.lines[p.lineNumber - 1];
|
|
204
|
+
return line !== undefined && (line.isTuanKhong || line.isNguyetPha);
|
|
205
|
+
});
|
|
206
|
+
case 'theAmDong': {
|
|
207
|
+
if (!theLine || theLine.isMoving)
|
|
208
|
+
return false;
|
|
209
|
+
const eThe = ELEMENT_INDEX[theLine.elementVi];
|
|
210
|
+
const eMonth = BRANCH_ELEMENT_INDEX[floorMod(ly.monthBranchIndex, 12)];
|
|
211
|
+
if (eThe === undefined || eMonth === undefined)
|
|
212
|
+
return false;
|
|
213
|
+
const isVT = eThe === eMonth || (eMonth + 1) % 5 === eThe;
|
|
214
|
+
return isVT && floorMod(ly.nhatThanBranch + 6, 12) === theLine.branchIndex;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
const UNMATCHED = {
|
|
219
|
+
matched: false,
|
|
220
|
+
cost: 0,
|
|
221
|
+
parents: [],
|
|
222
|
+
facts: [],
|
|
223
|
+
};
|
|
224
|
+
function evaluateCondition(cond, chart, ruleSilo, derivedMap) {
|
|
225
|
+
switch (cond.op) {
|
|
226
|
+
case 'star_in_palace': {
|
|
227
|
+
const { siloId, ziwei } = selectZiweiChart(chart, ruleSilo, cond.silo);
|
|
228
|
+
const p = findPalace(ziwei, cond.palace);
|
|
229
|
+
if (!p || !palaceHasStarOrTransform(p, cond.star))
|
|
230
|
+
return UNMATCHED;
|
|
231
|
+
return {
|
|
232
|
+
matched: true,
|
|
233
|
+
cost: 0,
|
|
234
|
+
parents: [],
|
|
235
|
+
facts: [`ziwei:${siloId}:star_in_palace:${cond.palace}:${cond.star}`],
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
case 'star_in_tam_phuong': {
|
|
239
|
+
const { siloId, ziwei } = selectZiweiChart(chart, ruleSilo, cond.silo);
|
|
240
|
+
const basePalace = findPalace(ziwei, cond.palace);
|
|
241
|
+
if (!basePalace)
|
|
242
|
+
return UNMATCHED;
|
|
243
|
+
const b = basePalace.branchIndex;
|
|
244
|
+
const branches = [b, (b + 4) % 12, (b + 8) % 12, (b + 6) % 12];
|
|
245
|
+
const hit = branches.some((br) => {
|
|
246
|
+
const pal = findPalaceByBranch(ziwei, br);
|
|
247
|
+
return pal !== undefined && palaceHasStarOrTransform(pal, cond.star);
|
|
248
|
+
});
|
|
249
|
+
if (!hit)
|
|
250
|
+
return UNMATCHED;
|
|
251
|
+
return {
|
|
252
|
+
matched: true,
|
|
253
|
+
cost: 0,
|
|
254
|
+
parents: [],
|
|
255
|
+
facts: [`ziwei:${siloId}:star_in_tam_phuong:${cond.palace}:${cond.star}`],
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
case 'star_brightness_in': {
|
|
259
|
+
const { siloId, ziwei } = selectZiweiChart(chart, ruleSilo, cond.silo);
|
|
260
|
+
const searchPalaces = cond.palace !== undefined && cond.palace.length > 0
|
|
261
|
+
? (() => {
|
|
262
|
+
const p = findPalace(ziwei, cond.palace);
|
|
263
|
+
return p ? [p] : [];
|
|
264
|
+
})()
|
|
265
|
+
: ziwei.palaces;
|
|
266
|
+
for (const p of searchPalaces) {
|
|
267
|
+
const allStars = [...p.majorStars, ...p.minorStars];
|
|
268
|
+
for (const s of allStars) {
|
|
269
|
+
if (s.name === cond.star || s.sihuaTransform === cond.star) {
|
|
270
|
+
if (s.brightness !== null && cond.levels.includes(s.brightness)) {
|
|
271
|
+
const palLabel = cond.palace !== undefined && cond.palace.length > 0 ? cond.palace : '*';
|
|
272
|
+
return {
|
|
273
|
+
matched: true,
|
|
274
|
+
cost: 0,
|
|
275
|
+
parents: [],
|
|
276
|
+
facts: [`ziwei:${siloId}:star_brightness_in:${palLabel}:${cond.star}:${s.brightness}`],
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
return UNMATCHED;
|
|
283
|
+
}
|
|
284
|
+
case 'sihua_in_palace': {
|
|
285
|
+
const { siloId, ziwei } = selectZiweiChart(chart, ruleSilo, cond.silo);
|
|
286
|
+
const p = findPalace(ziwei, cond.palace);
|
|
287
|
+
if (!p || !palaceHasStarOrTransform(p, cond.transform))
|
|
288
|
+
return UNMATCHED;
|
|
289
|
+
return {
|
|
290
|
+
matched: true,
|
|
291
|
+
cost: 0,
|
|
292
|
+
parents: [],
|
|
293
|
+
facts: [`ziwei:${siloId}:sihua_in_palace:${cond.palace}:${cond.transform}`],
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
case 'palace_has_flag': {
|
|
297
|
+
const { siloId, ziwei } = selectZiweiChart(chart, ruleSilo, cond.silo);
|
|
298
|
+
const p = findPalace(ziwei, cond.palace);
|
|
299
|
+
if (!p)
|
|
300
|
+
return UNMATCHED;
|
|
301
|
+
const flagVal = cond.flag === 'tuanTrung' ? p.tuanTrung : p.trietLo;
|
|
302
|
+
if (!flagVal)
|
|
303
|
+
return UNMATCHED;
|
|
304
|
+
return {
|
|
305
|
+
matched: true,
|
|
306
|
+
cost: 0,
|
|
307
|
+
parents: [],
|
|
308
|
+
facts: [`ziwei:${siloId}:palace_has_flag:${cond.palace}:${cond.flag}`],
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
case 'palace_branch_in': {
|
|
312
|
+
const { siloId, ziwei } = selectZiweiChart(chart, ruleSilo, cond.silo);
|
|
313
|
+
const p = findPalace(ziwei, cond.palace);
|
|
314
|
+
if (!p || !cond.branches.includes(p.branchIndex))
|
|
315
|
+
return UNMATCHED;
|
|
316
|
+
return {
|
|
317
|
+
matched: true,
|
|
318
|
+
cost: 0,
|
|
319
|
+
parents: [],
|
|
320
|
+
facts: [`ziwei:${siloId}:palace_branch_in:${cond.palace}:${p.branchIndex}`],
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
case 'star_in_relative_palace': {
|
|
324
|
+
const { siloId, ziwei } = selectZiweiChart(chart, ruleSilo, cond.silo);
|
|
325
|
+
const basePalace = findPalace(ziwei, cond.palace);
|
|
326
|
+
if (!basePalace)
|
|
327
|
+
return UNMATCHED;
|
|
328
|
+
const b = basePalace.branchIndex;
|
|
329
|
+
let targetBranch;
|
|
330
|
+
switch (cond.relation) {
|
|
331
|
+
case 'opposite':
|
|
332
|
+
targetBranch = (b + 6) % 12;
|
|
333
|
+
break;
|
|
334
|
+
case 'prev':
|
|
335
|
+
targetBranch = (b + 11) % 12;
|
|
336
|
+
break;
|
|
337
|
+
case 'next':
|
|
338
|
+
targetBranch = (b + 1) % 12;
|
|
339
|
+
break;
|
|
340
|
+
case 'nhi_hop':
|
|
341
|
+
targetBranch = (13 - b) % 12;
|
|
342
|
+
break;
|
|
343
|
+
}
|
|
344
|
+
const targetPalace = findPalaceByBranch(ziwei, targetBranch);
|
|
345
|
+
if (!targetPalace || !palaceHasStarOrTransform(targetPalace, cond.star)) {
|
|
346
|
+
return UNMATCHED;
|
|
347
|
+
}
|
|
348
|
+
return {
|
|
349
|
+
matched: true,
|
|
350
|
+
cost: 0,
|
|
351
|
+
parents: [],
|
|
352
|
+
facts: [`ziwei:${siloId}:star_in_relative_palace:${cond.palace}:${cond.relation}:${cond.star}`],
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
case 'palace_major_count': {
|
|
356
|
+
const { siloId, ziwei } = selectZiweiChart(chart, ruleSilo, cond.silo);
|
|
357
|
+
const p = findPalace(ziwei, cond.palace);
|
|
358
|
+
if (!p)
|
|
359
|
+
return UNMATCHED;
|
|
360
|
+
const count = p.majorStars.length;
|
|
361
|
+
if ((cond.exact != null && count !== cond.exact) ||
|
|
362
|
+
(cond.min != null && count < cond.min) ||
|
|
363
|
+
(cond.max != null && count > cond.max)) {
|
|
364
|
+
return UNMATCHED;
|
|
365
|
+
}
|
|
366
|
+
return {
|
|
367
|
+
matched: true,
|
|
368
|
+
cost: 0,
|
|
369
|
+
parents: [],
|
|
370
|
+
facts: [`ziwei:${siloId}:palace_major_count:${cond.palace}:${count}`],
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
case 'palace_star_count_in': {
|
|
374
|
+
const { siloId, ziwei } = selectZiweiChart(chart, ruleSilo, cond.silo);
|
|
375
|
+
const p = findPalace(ziwei, cond.palace);
|
|
376
|
+
if (!p)
|
|
377
|
+
return UNMATCHED;
|
|
378
|
+
let count = 0;
|
|
379
|
+
for (const s of new Set(cond.stars)) {
|
|
380
|
+
if (palaceHasStarOrTransform(p, s))
|
|
381
|
+
count++;
|
|
382
|
+
}
|
|
383
|
+
if (count < cond.min || (cond.max != null && count > cond.max)) {
|
|
384
|
+
return UNMATCHED;
|
|
385
|
+
}
|
|
386
|
+
return {
|
|
387
|
+
matched: true,
|
|
388
|
+
cost: 0,
|
|
389
|
+
parents: [],
|
|
390
|
+
facts: [`ziwei:${siloId}:palace_star_count_in:${cond.palace}:${count}`],
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
case 'star_co_located': {
|
|
394
|
+
const uniq = sortedUnique(cond.stars);
|
|
395
|
+
if (uniq.length === 0)
|
|
396
|
+
return UNMATCHED;
|
|
397
|
+
const { siloId, ziwei } = selectZiweiChart(chart, ruleSilo, cond.silo);
|
|
398
|
+
const sortedJoined = uniq.join('+');
|
|
399
|
+
if (cond.palace != null && cond.palace.length > 0) {
|
|
400
|
+
const p = findPalace(ziwei, cond.palace);
|
|
401
|
+
if (!p || !uniq.every((s) => palaceHasStarOrTransform(p, s)))
|
|
402
|
+
return UNMATCHED;
|
|
403
|
+
return {
|
|
404
|
+
matched: true,
|
|
405
|
+
cost: 0,
|
|
406
|
+
parents: [],
|
|
407
|
+
facts: [`ziwei:${siloId}:star_co_located:${cond.palace}:${sortedJoined}`],
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
const sortedPalaces = [...ziwei.palaces].sort((a, b) => a.branchIndex - b.branchIndex);
|
|
411
|
+
const hit = sortedPalaces.find((p) => uniq.every((s) => palaceHasStarOrTransform(p, s)));
|
|
412
|
+
if (!hit)
|
|
413
|
+
return UNMATCHED;
|
|
414
|
+
return {
|
|
415
|
+
matched: true,
|
|
416
|
+
cost: 0,
|
|
417
|
+
parents: [],
|
|
418
|
+
facts: [`ziwei:${siloId}:star_co_located:palace_${hit.branchIndex}:${sortedJoined}`],
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
case 'vo_chinh_dieu': {
|
|
422
|
+
const { siloId, ziwei } = selectZiweiChart(chart, ruleSilo, cond.silo);
|
|
423
|
+
const p = findPalace(ziwei, cond.palace);
|
|
424
|
+
if (!p || p.voChinhDieu !== cond.value)
|
|
425
|
+
return UNMATCHED;
|
|
426
|
+
return {
|
|
427
|
+
matched: true,
|
|
428
|
+
cost: 0,
|
|
429
|
+
parents: [],
|
|
430
|
+
facts: [`ziwei:${siloId}:vo_chinh_dieu:${cond.palace}:${String(cond.value)}`],
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
case 'tam_khong_in_tam_phuong': {
|
|
434
|
+
const { siloId, ziwei } = selectZiweiChart(chart, ruleSilo, cond.silo);
|
|
435
|
+
const basePalace = findPalace(ziwei, cond.palace);
|
|
436
|
+
if (!basePalace)
|
|
437
|
+
return UNMATCHED;
|
|
438
|
+
const b = basePalace.branchIndex;
|
|
439
|
+
const found = new Set();
|
|
440
|
+
for (const br of [b, (b + 4) % 12, (b + 8) % 12, (b + 6) % 12]) {
|
|
441
|
+
const pal = findPalaceByBranch(ziwei, br);
|
|
442
|
+
if (pal) {
|
|
443
|
+
for (const tok of pal.tamKhongTypes) {
|
|
444
|
+
found.add(tok);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
const count = found.size;
|
|
449
|
+
if (count < cond.minCount)
|
|
450
|
+
return UNMATCHED;
|
|
451
|
+
return {
|
|
452
|
+
matched: true,
|
|
453
|
+
cost: 0,
|
|
454
|
+
parents: [],
|
|
455
|
+
facts: [`ziwei:${siloId}:tam_khong_in_tam_phuong:${cond.palace}:${count}`],
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
case 'thai_tue_tu_linh': {
|
|
459
|
+
const { siloId, ziwei } = selectZiweiChart(chart, ruleSilo, cond.silo);
|
|
460
|
+
const tt = ziwei.thaiTueTamHopTuLinh;
|
|
461
|
+
const hasTuLinh = cond.scope === 'tam_hop' ? tt.hasFullTuLinhInMenhTamHop : tt.hasFullTuLinhInMenhTamPhuong;
|
|
462
|
+
if (!tt.menhInThaiTueTamHop || !hasTuLinh)
|
|
463
|
+
return UNMATCHED;
|
|
464
|
+
return {
|
|
465
|
+
matched: true,
|
|
466
|
+
cost: 0,
|
|
467
|
+
parents: [],
|
|
468
|
+
facts: [`ziwei:${siloId}:thai_tue_tu_linh:${cond.scope}`],
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
case 'year_stem_in': {
|
|
472
|
+
const yStem = ruleSilo === 'bazi'
|
|
473
|
+
? chart.temporal.pillars.baziYearPillar.stemIndex
|
|
474
|
+
: chart.temporal.pillars.lunarYearPillar.stemIndex;
|
|
475
|
+
if (!cond.stems.includes(yStem))
|
|
476
|
+
return UNMATCHED;
|
|
477
|
+
return {
|
|
478
|
+
matched: true,
|
|
479
|
+
cost: 0,
|
|
480
|
+
parents: [],
|
|
481
|
+
facts: [`stem:year:${yStem}`],
|
|
482
|
+
};
|
|
483
|
+
}
|
|
484
|
+
case 'bazi_strength_is': {
|
|
485
|
+
if (chart.bazi.strengthClass !== cond.value)
|
|
486
|
+
return UNMATCHED;
|
|
487
|
+
return {
|
|
488
|
+
matched: true,
|
|
489
|
+
cost: 0,
|
|
490
|
+
parents: [],
|
|
491
|
+
facts: [`bazi:strength:${cond.value}`],
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
case 'day_stem_in': {
|
|
495
|
+
const dStem = chart.temporal.pillars.dayPillar.stemIndex;
|
|
496
|
+
if (!cond.stems.includes(dStem))
|
|
497
|
+
return UNMATCHED;
|
|
498
|
+
return {
|
|
499
|
+
matched: true,
|
|
500
|
+
cost: 0,
|
|
501
|
+
parents: [],
|
|
502
|
+
facts: [`bazi:day_stem:${dStem}`],
|
|
503
|
+
};
|
|
504
|
+
}
|
|
505
|
+
case 'month_branch_in': {
|
|
506
|
+
const mBranch = chart.temporal.pillars.baziMonthPillar.branchIndex;
|
|
507
|
+
if (!cond.branches.includes(mBranch))
|
|
508
|
+
return UNMATCHED;
|
|
509
|
+
return {
|
|
510
|
+
matched: true,
|
|
511
|
+
cost: 0,
|
|
512
|
+
parents: [],
|
|
513
|
+
facts: [`bazi:month_branch:${mBranch}`],
|
|
514
|
+
};
|
|
515
|
+
}
|
|
516
|
+
case 'bazi_has_ten_god': {
|
|
517
|
+
if (!baziHasTenGod(chart, cond.tenGod))
|
|
518
|
+
return UNMATCHED;
|
|
519
|
+
return {
|
|
520
|
+
matched: true,
|
|
521
|
+
cost: 0,
|
|
522
|
+
parents: [],
|
|
523
|
+
facts: [`bazi:ten_god:${cond.tenGod}`],
|
|
524
|
+
};
|
|
525
|
+
}
|
|
526
|
+
case 'liuyao_has_moving': {
|
|
527
|
+
if (!chart.liuyao)
|
|
528
|
+
return UNMATCHED;
|
|
529
|
+
const hasMoving = chart.liuyao.movingLines.length > 0;
|
|
530
|
+
if (hasMoving !== cond.value)
|
|
531
|
+
return UNMATCHED;
|
|
532
|
+
return {
|
|
533
|
+
matched: true,
|
|
534
|
+
cost: 0,
|
|
535
|
+
parents: [],
|
|
536
|
+
facts: [`liuyao:has_moving:${String(cond.value)}`],
|
|
537
|
+
};
|
|
538
|
+
}
|
|
539
|
+
case 'liuyao_the_ung_relation': {
|
|
540
|
+
const rel = computeTheUngRelation(chart);
|
|
541
|
+
if (rel !== cond.relation)
|
|
542
|
+
return UNMATCHED;
|
|
543
|
+
return {
|
|
544
|
+
matched: true,
|
|
545
|
+
cost: 0,
|
|
546
|
+
parents: [],
|
|
547
|
+
facts: [`liuyao:the_ung:${cond.relation}`],
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
case 'liuyao_state_flag': {
|
|
551
|
+
if (!evalLiuyaoFlag(chart, cond.flag))
|
|
552
|
+
return UNMATCHED;
|
|
553
|
+
return {
|
|
554
|
+
matched: true,
|
|
555
|
+
cost: 0,
|
|
556
|
+
parents: [],
|
|
557
|
+
facts: [`liuyao:flag:${cond.flag}`],
|
|
558
|
+
};
|
|
559
|
+
}
|
|
560
|
+
case 'derived_node': {
|
|
561
|
+
const parent = derivedMap.get(cond.nodeId);
|
|
562
|
+
if (!parent)
|
|
563
|
+
return UNMATCHED;
|
|
564
|
+
return {
|
|
565
|
+
matched: true,
|
|
566
|
+
cost: parent.proofDepth,
|
|
567
|
+
parents: [cond.nodeId],
|
|
568
|
+
facts: [`derived:${cond.nodeId}`],
|
|
569
|
+
};
|
|
570
|
+
}
|
|
571
|
+
case 'and': {
|
|
572
|
+
if (cond.args.length === 0) {
|
|
573
|
+
return { matched: true, cost: 0, parents: [], facts: [] };
|
|
574
|
+
}
|
|
575
|
+
let maxCost = 0;
|
|
576
|
+
const allParents = [];
|
|
577
|
+
const allFacts = [];
|
|
578
|
+
for (const arg of cond.args) {
|
|
579
|
+
const sub = evaluateCondition(arg, chart, ruleSilo, derivedMap);
|
|
580
|
+
if (!sub.matched)
|
|
581
|
+
return UNMATCHED;
|
|
582
|
+
if (sub.cost > maxCost)
|
|
583
|
+
maxCost = sub.cost;
|
|
584
|
+
allParents.push(...sub.parents);
|
|
585
|
+
allFacts.push(...sub.facts);
|
|
586
|
+
}
|
|
587
|
+
return {
|
|
588
|
+
matched: true,
|
|
589
|
+
cost: maxCost,
|
|
590
|
+
parents: sortedUnique(allParents),
|
|
591
|
+
facts: sortedUnique(allFacts),
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
case 'or': {
|
|
595
|
+
const matchedSubs = [];
|
|
596
|
+
for (const arg of cond.args) {
|
|
597
|
+
const sub = evaluateCondition(arg, chart, ruleSilo, derivedMap);
|
|
598
|
+
if (sub.matched)
|
|
599
|
+
matchedSubs.push(sub);
|
|
600
|
+
}
|
|
601
|
+
if (matchedSubs.length === 0)
|
|
602
|
+
return UNMATCHED;
|
|
603
|
+
let minCost = matchedSubs[0].cost;
|
|
604
|
+
for (const sub of matchedSubs) {
|
|
605
|
+
if (sub.cost < minCost)
|
|
606
|
+
minCost = sub.cost;
|
|
607
|
+
}
|
|
608
|
+
const bestParents = [];
|
|
609
|
+
const bestFacts = [];
|
|
610
|
+
for (const sub of matchedSubs) {
|
|
611
|
+
if (sub.cost === minCost) {
|
|
612
|
+
bestParents.push(...sub.parents);
|
|
613
|
+
bestFacts.push(...sub.facts);
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
return {
|
|
617
|
+
matched: true,
|
|
618
|
+
cost: minCost,
|
|
619
|
+
parents: sortedUnique(bestParents),
|
|
620
|
+
facts: sortedUnique(bestFacts),
|
|
621
|
+
};
|
|
622
|
+
}
|
|
623
|
+
case 'not': {
|
|
624
|
+
const sub = evaluateCondition(cond.arg, chart, ruleSilo, derivedMap);
|
|
625
|
+
if (sub.matched)
|
|
626
|
+
return UNMATCHED;
|
|
627
|
+
return {
|
|
628
|
+
matched: true,
|
|
629
|
+
cost: 0,
|
|
630
|
+
parents: [],
|
|
631
|
+
facts: [`not:${cond.arg.op}`],
|
|
632
|
+
};
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
function passesContextFilter(rule, filter) {
|
|
637
|
+
if (!filter)
|
|
638
|
+
return true;
|
|
639
|
+
if (filter.careerCategory !== undefined && filter.careerCategory !== null) {
|
|
640
|
+
if (rule.careerCategory !== undefined && rule.careerCategory !== null) {
|
|
641
|
+
if (rule.careerCategory !== filter.careerCategory)
|
|
642
|
+
return false;
|
|
643
|
+
}
|
|
644
|
+
if (rule.careerCategories !== undefined && rule.careerCategories !== null && rule.careerCategories.length > 0) {
|
|
645
|
+
if (!rule.careerCategories.includes(filter.careerCategory))
|
|
646
|
+
return false;
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
if (filter.setting !== undefined && filter.setting !== null) {
|
|
650
|
+
if (rule.setting !== undefined && rule.setting !== null) {
|
|
651
|
+
if (rule.setting !== filter.setting)
|
|
652
|
+
return false;
|
|
653
|
+
}
|
|
654
|
+
if (rule.settings !== undefined && rule.settings !== null && rule.settings.length > 0) {
|
|
655
|
+
if (!rule.settings.includes(filter.setting))
|
|
656
|
+
return false;
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
return true;
|
|
660
|
+
}
|
|
661
|
+
function arraysEqual(a, b) {
|
|
662
|
+
if (a.length !== b.length)
|
|
663
|
+
return false;
|
|
664
|
+
for (let i = 0; i < a.length; i++) {
|
|
665
|
+
if (a[i] !== b[i])
|
|
666
|
+
return false;
|
|
667
|
+
}
|
|
668
|
+
return true;
|
|
669
|
+
}
|
|
670
|
+
function detectParaconsistentConflicts(nodes) {
|
|
671
|
+
const domains = sortedUnique(nodes.map((n) => n.domain));
|
|
672
|
+
const conflicts = [];
|
|
673
|
+
for (const domain of domains) {
|
|
674
|
+
const domNodes = nodes.filter((n) => n.domain === domain);
|
|
675
|
+
// 1. Cross-Silo opposition (opposing polarities CAT vs HUNG across distinct silos, or nam-phai vs toan-thu fork)
|
|
676
|
+
const crossPosSet = new Set();
|
|
677
|
+
const crossNegSet = new Set();
|
|
678
|
+
let hasNamPhaiToanThuPair = false;
|
|
679
|
+
for (const u of domNodes) {
|
|
680
|
+
if (u.polarity !== 'CAT')
|
|
681
|
+
continue;
|
|
682
|
+
for (const v of domNodes) {
|
|
683
|
+
if (v.polarity !== 'HUNG' || v.silo === u.silo)
|
|
684
|
+
continue;
|
|
685
|
+
crossPosSet.add(u.nodeId);
|
|
686
|
+
crossNegSet.add(v.nodeId);
|
|
687
|
+
if ((u.silo === 'nam-phai' && v.silo === 'toan-thu') ||
|
|
688
|
+
(u.silo === 'toan-thu' && v.silo === 'nam-phai')) {
|
|
689
|
+
hasNamPhaiToanThuPair = true;
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
if (crossPosSet.size > 0 && crossNegSet.size > 0) {
|
|
694
|
+
conflicts.push({
|
|
695
|
+
conflictId: `conflict:${domain}:CROSS_SILO`,
|
|
696
|
+
domain,
|
|
697
|
+
kind: 'CROSS_SILO',
|
|
698
|
+
positiveNodeIds: Array.from(crossPosSet).sort(cmpStr),
|
|
699
|
+
negativeNodeIds: Array.from(crossNegSet).sort(cmpStr),
|
|
700
|
+
resolutionHintVi: hasNamPhaiToanThuPair
|
|
701
|
+
? `Bất đồng tiên đề Nam Phái ↔ Toàn Thư tại lĩnh vực '${domain}': bảo toàn cả hai nhánh suy diễn (lưỡng thuyết) và dùng câu hỏi Định Bàn thực chứng quá khứ để xác lập hệ tiên đề ứng hợp.`
|
|
702
|
+
: `Đối lập Cát/Hung liên hệ thống tại lĩnh vực '${domain}': bảo toàn cả hai mệnh đề và đối chiếu Dụng Thần Bát Tự cùng Đại Hạn Tử Vi trước khi kết luận.`,
|
|
703
|
+
});
|
|
704
|
+
}
|
|
705
|
+
// 2. Intra-Silo paraconsistent coexistence (CAT and HUNG within the same silo & domain)
|
|
706
|
+
const silos = sortedUnique(domNodes.map((n) => n.silo));
|
|
707
|
+
for (const silo of silos) {
|
|
708
|
+
const posIds = domNodes
|
|
709
|
+
.filter((n) => n.silo === silo && n.polarity === 'CAT')
|
|
710
|
+
.map((n) => n.nodeId)
|
|
711
|
+
.sort(cmpStr);
|
|
712
|
+
const negIds = domNodes
|
|
713
|
+
.filter((n) => n.silo === silo && n.polarity === 'HUNG')
|
|
714
|
+
.map((n) => n.nodeId)
|
|
715
|
+
.sort(cmpStr);
|
|
716
|
+
if (posIds.length > 0 && negIds.length > 0) {
|
|
717
|
+
conflicts.push({
|
|
718
|
+
conflictId: `conflict:${domain}:INTRA_SILO_PARACONSISTENT:${silo}`,
|
|
719
|
+
domain,
|
|
720
|
+
kind: 'INTRA_SILO_PARACONSISTENT',
|
|
721
|
+
positiveNodeIds: posIds,
|
|
722
|
+
negativeNodeIds: negIds,
|
|
723
|
+
resolutionHintVi: `Lưỡng thuyết nội phái (${silo}) tại lĩnh vực '${domain}': Cát tinh và Hung tinh đồng hiện, bảo toàn cả hai chiều thuận–nghịch theo từng giai đoạn vận hạn thay vì triệt tiêu.`,
|
|
724
|
+
});
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
conflicts.sort((a, b) => cmpStr(a.conflictId, b.conflictId));
|
|
729
|
+
return conflicts;
|
|
730
|
+
}
|
|
731
|
+
export function evaluateRulesDAG(chart, rules, contextFilter) {
|
|
732
|
+
const sourceRules = rules ?? loadSampleRules();
|
|
733
|
+
const activeRules = sourceRules.filter((r) => passesContextFilter(r, contextFilter));
|
|
734
|
+
// Deduplicate by rule.id deterministically and group by topological stratum
|
|
735
|
+
const byId = new Map();
|
|
736
|
+
for (const r of activeRules) {
|
|
737
|
+
if (!Number.isInteger(r.stratum) || r.stratum < 1) {
|
|
738
|
+
throw new Error(`Invalid rule stratum for '${r.id}': ${r.stratum} (must be integer >= 1)`);
|
|
739
|
+
}
|
|
740
|
+
if (!byId.has(r.id)) {
|
|
741
|
+
byId.set(r.id, r);
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
const canonicalRules = Array.from(byId.values()).sort((a, b) => a.stratum !== b.stratum ? a.stratum - b.stratum : cmpStr(a.id, b.id));
|
|
745
|
+
const strataSet = new Set();
|
|
746
|
+
for (const r of canonicalRules) {
|
|
747
|
+
strataSet.add(r.stratum);
|
|
748
|
+
}
|
|
749
|
+
const strataEvaluated = Array.from(strataSet).sort((a, b) => a - b);
|
|
750
|
+
const derivedMap = new Map();
|
|
751
|
+
for (const stratum of strataEvaluated) {
|
|
752
|
+
const stratumRules = canonicalRules.filter((r) => r.stratum === stratum);
|
|
753
|
+
let changed = true;
|
|
754
|
+
while (changed) {
|
|
755
|
+
changed = false;
|
|
756
|
+
for (const rule of stratumRules) {
|
|
757
|
+
const outcome = evaluateCondition(rule.when, chart, rule.silo, derivedMap);
|
|
758
|
+
if (!outcome.matched)
|
|
759
|
+
continue;
|
|
760
|
+
const candidateDepth = 1 + outcome.cost;
|
|
761
|
+
const existing = derivedMap.get(rule.id);
|
|
762
|
+
if (!existing) {
|
|
763
|
+
derivedMap.set(rule.id, {
|
|
764
|
+
nodeId: rule.id,
|
|
765
|
+
silo: rule.silo,
|
|
766
|
+
stratum: rule.stratum,
|
|
767
|
+
proofDepth: candidateDepth,
|
|
768
|
+
domain: rule.domain,
|
|
769
|
+
polarity: rule.polarity,
|
|
770
|
+
claimVi: rule.claimVi,
|
|
771
|
+
actionableAdviceVi: rule.actionableAdviceVi ?? null,
|
|
772
|
+
classicalSource: rule.classicalSource,
|
|
773
|
+
parentNodeIds: outcome.parents,
|
|
774
|
+
matchedFacts: outcome.facts,
|
|
775
|
+
});
|
|
776
|
+
changed = true;
|
|
777
|
+
}
|
|
778
|
+
else if (candidateDepth < existing.proofDepth ||
|
|
779
|
+
(candidateDepth === existing.proofDepth &&
|
|
780
|
+
(!arraysEqual(existing.parentNodeIds, outcome.parents) ||
|
|
781
|
+
!arraysEqual(existing.matchedFacts, outcome.facts)))) {
|
|
782
|
+
const mergedParents = candidateDepth < existing.proofDepth
|
|
783
|
+
? outcome.parents
|
|
784
|
+
: sortedUnique([...existing.parentNodeIds, ...outcome.parents]);
|
|
785
|
+
const mergedFacts = candidateDepth < existing.proofDepth
|
|
786
|
+
? outcome.facts
|
|
787
|
+
: sortedUnique([...existing.matchedFacts, ...outcome.facts]);
|
|
788
|
+
if (candidateDepth < existing.proofDepth ||
|
|
789
|
+
!arraysEqual(existing.parentNodeIds, mergedParents) ||
|
|
790
|
+
!arraysEqual(existing.matchedFacts, mergedFacts)) {
|
|
791
|
+
derivedMap.set(rule.id, {
|
|
792
|
+
...existing,
|
|
793
|
+
proofDepth: candidateDepth,
|
|
794
|
+
parentNodeIds: mergedParents,
|
|
795
|
+
matchedFacts: mergedFacts,
|
|
796
|
+
});
|
|
797
|
+
changed = true;
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
const nodes = Array.from(derivedMap.values()).sort((a, b) => a.stratum !== b.stratum ? a.stratum - b.stratum : cmpStr(a.nodeId, b.nodeId));
|
|
804
|
+
const conflicts = detectParaconsistentConflicts(nodes);
|
|
805
|
+
const normalizedContextFilter = contextFilter !== undefined
|
|
806
|
+
? {
|
|
807
|
+
careerCategory: contextFilter.careerCategory ?? null,
|
|
808
|
+
setting: contextFilter.setting ?? null,
|
|
809
|
+
}
|
|
810
|
+
: null;
|
|
811
|
+
return {
|
|
812
|
+
schemaVersion: '1.0.0',
|
|
813
|
+
totalRulesEvaluated: canonicalRules.length,
|
|
814
|
+
strataEvaluated,
|
|
815
|
+
contextFilter: normalizedContextFilter,
|
|
816
|
+
nodes,
|
|
817
|
+
conflicts,
|
|
818
|
+
};
|
|
819
|
+
}
|
|
820
|
+
//# sourceMappingURL=dag.js.map
|