@orrery/core 0.2.1 → 0.4.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/README.en.md +241 -0
- package/README.ja.md +241 -0
- package/README.md +34 -14
- package/README.zh.md +241 -0
- package/dist/{chunk-TRSIZZ73.js → chunk-6PLRETU5.js} +33 -7
- package/dist/{chunk-KD6TCTRW.js → chunk-APL4STY7.js} +10 -1
- package/dist/{chunk-VJDUZB5T.js → chunk-EXYPMSUR.js} +119 -0
- package/dist/{chunk-DGSIRAXF.js → chunk-JLKMDX3R.js} +138 -11
- package/dist/chunk-NSFWX6RO.js +42099 -0
- package/dist/chunk-TW4ADZCX.js +33 -0
- package/dist/{chunk-OCPJGMZC.js → chunk-WOQT7EBV.js} +71 -51
- package/dist/cities.d.ts +4 -2
- package/dist/cities.js +1 -1
- package/dist/constants.d.ts +12 -1
- package/dist/constants.js +21 -1
- package/dist/index.d.ts +4 -5
- package/dist/index.js +20 -8
- package/dist/natal.d.ts +12 -5
- package/dist/natal.js +5 -3
- package/dist/pillars.d.ts +14 -6
- package/dist/pillars.js +10 -2
- package/dist/saju.js +4 -3
- package/dist/types.d.ts +44 -4
- package/dist/ziwei.js +3 -2
- package/package.json +2 -9
- package/dist/chunk-6PJQHSY6.js +0 -292
|
@@ -3,19 +3,28 @@ import {
|
|
|
3
3
|
BRANCH_BREAKS,
|
|
4
4
|
BRANCH_CLASHES,
|
|
5
5
|
BRANCH_COMBINES_6,
|
|
6
|
+
BRANCH_GWIMUN,
|
|
6
7
|
BRANCH_HARMS,
|
|
7
8
|
BRANCH_PUNISHMENTS,
|
|
8
9
|
BRANCH_SELF_PUNISHMENTS,
|
|
10
|
+
BRANCH_WONJIN,
|
|
11
|
+
CHEONDUK_MAP,
|
|
12
|
+
CHEONUL_MAP,
|
|
9
13
|
DIRECTIONAL_COMPOSES,
|
|
10
14
|
DIRECTIONAL_COMPOSE_ELEMENTS,
|
|
15
|
+
DOHWA_MAP,
|
|
11
16
|
EARTH,
|
|
12
17
|
EARTH_KR,
|
|
18
|
+
GEUMYEO_MAP,
|
|
13
19
|
GOEGANG_PILLARS,
|
|
20
|
+
GONGMANG_TABLE,
|
|
14
21
|
HALF_COMPOSES,
|
|
15
22
|
HGANJI,
|
|
23
|
+
HONGYEOM_PILLARS,
|
|
16
24
|
JIJANGGAN,
|
|
17
25
|
METEORS_12,
|
|
18
26
|
METEOR_LOOKUP,
|
|
27
|
+
MUNCHANG_MAP,
|
|
19
28
|
PILLAR_NAMES,
|
|
20
29
|
RELATIONS,
|
|
21
30
|
SKY,
|
|
@@ -26,9 +35,10 @@ import {
|
|
|
26
35
|
STEM_INFO,
|
|
27
36
|
TRIPLE_COMPOSES,
|
|
28
37
|
TRIPLE_COMPOSE_ELEMENTS,
|
|
38
|
+
WOLDUK_MAP,
|
|
29
39
|
YANGGAN,
|
|
30
40
|
YANGIN_MAP
|
|
31
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-EXYPMSUR.js";
|
|
32
42
|
|
|
33
43
|
// src/pillars.ts
|
|
34
44
|
function div(a, b) {
|
|
@@ -253,7 +263,7 @@ function dateFromMinutes(tmin, uyear, umonth, uday, uhour, umin) {
|
|
|
253
263
|
}
|
|
254
264
|
return [y1, mo1, d1, h1, mi1];
|
|
255
265
|
}
|
|
256
|
-
function calcPillarIndices(year, month, day, hour, min) {
|
|
266
|
+
function calcPillarIndices(year, month, day, hour, min, jasiMethod) {
|
|
257
267
|
const displ2min = minutesBetween(
|
|
258
268
|
UNIT.year,
|
|
259
269
|
UNIT.month,
|
|
@@ -325,11 +335,16 @@ function calcPillarIndices(year, month, day, hour, min) {
|
|
|
325
335
|
} else if (hour === 21 && min >= 30 || hour === 22 || hour === 23 && min < 30) {
|
|
326
336
|
i = 11;
|
|
327
337
|
} else {
|
|
328
|
-
so24day += 1;
|
|
329
|
-
if (so24day === 60) so24day = 0;
|
|
330
338
|
i = 0;
|
|
339
|
+
const method = jasiMethod ?? "unified";
|
|
340
|
+
if (method === "unified") {
|
|
341
|
+
so24day += 1;
|
|
342
|
+
if (so24day === 60) so24day = 0;
|
|
343
|
+
}
|
|
331
344
|
}
|
|
332
|
-
|
|
345
|
+
const isYajasi = i === 0 && hour === 23 && jasiMethod === "split";
|
|
346
|
+
const dayForHour = isYajasi ? (so24day + 1) % 60 : so24day;
|
|
347
|
+
t = dayForHour % 10;
|
|
333
348
|
t = t % 5;
|
|
334
349
|
t = t * 12 + i;
|
|
335
350
|
const so24hour = t;
|
|
@@ -407,12 +422,12 @@ function calcSolarTerms(year, month, day, hour, min) {
|
|
|
407
422
|
outgiMin
|
|
408
423
|
};
|
|
409
424
|
}
|
|
410
|
-
function getFourPillars(year, month, day, hour, minute) {
|
|
411
|
-
const [, y, m, d, h] = calcPillarIndices(year, month, day, hour, minute);
|
|
425
|
+
function getFourPillars(year, month, day, hour, minute, jasiMethod) {
|
|
426
|
+
const [, y, m, d, h] = calcPillarIndices(year, month, day, hour, minute, jasiMethod);
|
|
412
427
|
return [HGANJI[y], HGANJI[m], HGANJI[d], HGANJI[h]];
|
|
413
428
|
}
|
|
414
|
-
function getDaewoon(isMale, year, month, day, hour, minute) {
|
|
415
|
-
const [, sy, sm] = calcPillarIndices(year, month, day, hour, minute);
|
|
429
|
+
function getDaewoon(isMale, year, month, day, hour, minute, jasiMethod) {
|
|
430
|
+
const [, sy, sm] = calcPillarIndices(year, month, day, hour, minute, jasiMethod);
|
|
416
431
|
const yearStem = HGANJI[sy][0];
|
|
417
432
|
const isYangGan = YANGGAN.includes(yearStem);
|
|
418
433
|
const order = isMale && isYangGan || !isMale && !isYangGan;
|
|
@@ -512,6 +527,62 @@ function getTwelveSpirit(yearBranch, targetBranch) {
|
|
|
512
527
|
const offset = ((targetIdx - start) % 12 + 12) % 12;
|
|
513
528
|
return SPIRITS_12[offset].hanja;
|
|
514
529
|
}
|
|
530
|
+
var YANG_STEM_OF = {
|
|
531
|
+
tree: "\u7532",
|
|
532
|
+
fire: "\u4E19",
|
|
533
|
+
earth: "\u620A",
|
|
534
|
+
metal: "\u5E9A",
|
|
535
|
+
water: "\u58EC"
|
|
536
|
+
};
|
|
537
|
+
var SIPSIN_CATEGORIES = [
|
|
538
|
+
{ name: "\u6BD4\u52AB", interactions: ["same"] },
|
|
539
|
+
{ name: "\u98DF\u50B7", interactions: ["output"] },
|
|
540
|
+
{ name: "\u8CA1\u661F", interactions: ["sword"] },
|
|
541
|
+
{ name: "\u5B98\u661F", interactions: ["shield"] },
|
|
542
|
+
{ name: "\u5370\u661F", interactions: ["input"] }
|
|
543
|
+
];
|
|
544
|
+
function calculateJwabeop(dayStem, branches, dayBranch) {
|
|
545
|
+
return branches.map((branch) => {
|
|
546
|
+
const hidden = getHiddenStems(branch).replace(/ /g, "");
|
|
547
|
+
return [...hidden].map((stem) => {
|
|
548
|
+
const rel = getRelation(dayStem, stem);
|
|
549
|
+
const sipsin = rel ? rel.hanja : "?";
|
|
550
|
+
const unseong = getTwelveMeteor(stem, dayBranch);
|
|
551
|
+
return { stem, sipsin, unseong };
|
|
552
|
+
});
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
function calculateInjongbeop(dayStem, dayBranch) {
|
|
556
|
+
const dayInfo = STEM_INFO[dayStem];
|
|
557
|
+
if (!dayInfo) return [];
|
|
558
|
+
const hidden = getHiddenStems(dayBranch).replace(/ /g, "");
|
|
559
|
+
const presentInteractions = /* @__PURE__ */ new Set();
|
|
560
|
+
for (const stem of hidden) {
|
|
561
|
+
const info = STEM_INFO[stem];
|
|
562
|
+
if (!info) continue;
|
|
563
|
+
const interaction = getInteraction(dayInfo.element, info.element);
|
|
564
|
+
if (interaction) presentInteractions.add(interaction);
|
|
565
|
+
}
|
|
566
|
+
const result = [];
|
|
567
|
+
for (const cat of SIPSIN_CATEGORIES) {
|
|
568
|
+
const missing = cat.interactions.every((i) => !presentInteractions.has(i));
|
|
569
|
+
if (!missing) continue;
|
|
570
|
+
let targetElement = null;
|
|
571
|
+
for (const [el, info] of Object.entries(STEM_INFO)) {
|
|
572
|
+
if (info.yinyang !== "+") continue;
|
|
573
|
+
const inter = getInteraction(dayInfo.element, info.element);
|
|
574
|
+
if (inter && cat.interactions.includes(inter)) {
|
|
575
|
+
targetElement = info.element;
|
|
576
|
+
break;
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
if (!targetElement) continue;
|
|
580
|
+
const yangStem = YANG_STEM_OF[targetElement];
|
|
581
|
+
const unseong = getTwelveMeteor(yangStem, dayBranch);
|
|
582
|
+
result.push({ category: cat.name, yangStem, unseong });
|
|
583
|
+
}
|
|
584
|
+
return result;
|
|
585
|
+
}
|
|
515
586
|
function lookupPair(table, a, b) {
|
|
516
587
|
return table[`${a},${b}`] ?? table[`${b},${a}`];
|
|
517
588
|
}
|
|
@@ -547,6 +618,10 @@ function getBranchRelation(branch1, branch2) {
|
|
|
547
618
|
if (branch1 === branch2 && BRANCH_SELF_PUNISHMENTS.has(branch1)) {
|
|
548
619
|
results.push({ type: "\u5211", detail: "\u81EA\u5211" });
|
|
549
620
|
}
|
|
621
|
+
const wonjin = lookupPair(BRANCH_WONJIN, branch1, branch2);
|
|
622
|
+
if (wonjin) results.push({ type: wonjin, detail: null });
|
|
623
|
+
const gwimun = lookupPair(BRANCH_GWIMUN, branch1, branch2);
|
|
624
|
+
if (gwimun) results.push({ type: gwimun, detail: null });
|
|
550
625
|
return results;
|
|
551
626
|
}
|
|
552
627
|
function analyzePillarRelations(pillar1, pillar2) {
|
|
@@ -594,18 +669,66 @@ function analyzeAllRelations(pillars) {
|
|
|
594
669
|
directional: checkDirectionalCompose(branches)
|
|
595
670
|
};
|
|
596
671
|
}
|
|
597
|
-
function getSpecialSals(
|
|
672
|
+
function getSpecialSals(stems, branches, dayPillar) {
|
|
673
|
+
const dayStem = stems[1];
|
|
674
|
+
const dayBranch = branches[1];
|
|
675
|
+
const monthBranch = branches[2];
|
|
598
676
|
const yanginBranch = YANGIN_MAP[dayStem];
|
|
599
677
|
const yangin = yanginBranch ? branches.reduce((acc, b, i) => {
|
|
600
678
|
if (b === yanginBranch) acc.push(i);
|
|
601
679
|
return acc;
|
|
602
680
|
}, []) : [];
|
|
681
|
+
const dohwaBranch = DOHWA_MAP[dayBranch];
|
|
682
|
+
const dohwa = dohwaBranch ? branches.reduce((acc, b, i) => {
|
|
683
|
+
if (i !== 1 && b === dohwaBranch) acc.push(i);
|
|
684
|
+
return acc;
|
|
685
|
+
}, []) : [];
|
|
686
|
+
const cheonulBranches = CHEONUL_MAP[dayStem] ?? [];
|
|
687
|
+
const cheonul = branches.reduce((acc, b, i) => {
|
|
688
|
+
if (cheonulBranches.includes(b)) acc.push(i);
|
|
689
|
+
return acc;
|
|
690
|
+
}, []);
|
|
691
|
+
const cheondukChar = CHEONDUK_MAP[monthBranch];
|
|
692
|
+
const cheonduk = cheondukChar ? [...stems, ...branches].reduce((acc, ch, i) => {
|
|
693
|
+
if (ch === cheondukChar) acc.push(i % 4);
|
|
694
|
+
return acc;
|
|
695
|
+
}, []).filter((v, i, a) => a.indexOf(v) === i) : [];
|
|
696
|
+
const woldukChar = WOLDUK_MAP[monthBranch];
|
|
697
|
+
const wolduk = woldukChar ? stems.reduce((acc, s, i) => {
|
|
698
|
+
if (s === woldukChar) acc.push(i);
|
|
699
|
+
return acc;
|
|
700
|
+
}, []) : [];
|
|
701
|
+
const munchangBranch = MUNCHANG_MAP[dayStem];
|
|
702
|
+
const munchang = munchangBranch ? branches.reduce((acc, b, i) => {
|
|
703
|
+
if (b === munchangBranch) acc.push(i);
|
|
704
|
+
return acc;
|
|
705
|
+
}, []) : [];
|
|
706
|
+
const geumyeoBranch = GEUMYEO_MAP[dayStem];
|
|
707
|
+
const geumyeo = geumyeoBranch ? branches.reduce((acc, b, i) => {
|
|
708
|
+
if (b === geumyeoBranch) acc.push(i);
|
|
709
|
+
return acc;
|
|
710
|
+
}, []) : [];
|
|
603
711
|
return {
|
|
604
712
|
yangin,
|
|
605
713
|
baekho: BAEKHO_PILLARS.has(dayPillar),
|
|
606
|
-
goegang: GOEGANG_PILLARS.has(dayPillar)
|
|
714
|
+
goegang: GOEGANG_PILLARS.has(dayPillar),
|
|
715
|
+
dohwa,
|
|
716
|
+
cheonul,
|
|
717
|
+
cheonduk,
|
|
718
|
+
wolduk,
|
|
719
|
+
munchang,
|
|
720
|
+
hongyeom: HONGYEOM_PILLARS.has(dayPillar),
|
|
721
|
+
geumyeo
|
|
607
722
|
};
|
|
608
723
|
}
|
|
724
|
+
function getYearGanzi(year) {
|
|
725
|
+
return HGANJI[((12 + (year - 1996)) % 60 + 60) % 60];
|
|
726
|
+
}
|
|
727
|
+
function getGongmang(dayGanzi) {
|
|
728
|
+
const idx = HGANJI.indexOf(dayGanzi);
|
|
729
|
+
if (idx < 0) return ["", ""];
|
|
730
|
+
return GONGMANG_TABLE[Math.trunc(idx / 10)];
|
|
731
|
+
}
|
|
609
732
|
var IMPORTANT_RELATIONS = /* @__PURE__ */ new Set(["\u5408", "\u6C96", "\u5211"]);
|
|
610
733
|
function findTransits(natalPillars, months = 1, backward = false) {
|
|
611
734
|
const results = [];
|
|
@@ -687,6 +810,8 @@ export {
|
|
|
687
810
|
toHangul,
|
|
688
811
|
getTwelveMeteor,
|
|
689
812
|
getTwelveSpirit,
|
|
813
|
+
calculateJwabeop,
|
|
814
|
+
calculateInjongbeop,
|
|
690
815
|
getStemRelation,
|
|
691
816
|
getBranchRelation,
|
|
692
817
|
analyzePillarRelations,
|
|
@@ -694,5 +819,7 @@ export {
|
|
|
694
819
|
checkDirectionalCompose,
|
|
695
820
|
analyzeAllRelations,
|
|
696
821
|
getSpecialSals,
|
|
822
|
+
getYearGanzi,
|
|
823
|
+
getGongmang,
|
|
697
824
|
findTransits
|
|
698
825
|
};
|