liuyao 0.4.6 → 0.5.1
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.md +1 -1
- package/dist/index.d.mts +119 -129
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/liuyao-skill/SKILL.md +1 -1
- package/liuyao-skill/books//345/205/255/344/272/262/344/272/272/344/272/213/347/261/273.txt +131 -131
- package/liuyao-skill/books//345/207/272/350/241/214/350/241/214/344/272/272/347/261/273.txt +76 -76
- package/liuyao-skill/books//345/215/207/351/200/211/344/273/225/351/200/224/347/261/273.txt +182 -182
- package/liuyao-skill/books//345/244/251/346/227/266/345/215/240.txt +300 -300
- package/liuyao-skill/books//345/251/232/345/247/273/350/203/216/344/272/247/347/261/273.txt +100 -100
- package/liuyao-skill/books//345/255/246/344/270/232/345/212/237/345/220/215/347/261/273.txt +152 -152
- package/liuyao-skill/books//345/256/230/351/235/236/350/257/211/350/256/274/347/261/273.txt +9 -9
- package/liuyao-skill/books//345/256/266/345/256/205/350/220/245/351/200/240/347/261/273.txt +113 -113
- package/liuyao-skill/books//346/261/202/350/264/242/350/264/270/346/230/223/347/261/273.txt +171 -171
- package/liuyao-skill/books//347/226/276/347/227/205/345/214/273/347/226/227/347/261/273.txt +128 -128
- package/liuyao-skill/books//350/272/253/345/221/275/345/257/277/345/205/203/347/261/273.txt +331 -331
- package/liuyao-skill/books//351/201/223/347/220/206/347/257/207.txt +1480 -1912
- package/liuyao-skill/books//351/243/216/346/260/264/350/214/224/350/221/254/347/261/273.txt +91 -91
- package/liuyao-skill/parser.skill.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,69 +1,45 @@
|
|
|
1
|
-
//#region src/core/setup-gram.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Kins and their corresponding earthly branches in the Liu Yao divination system, along with the type of relation (世 or 应).
|
|
4
|
-
* This information is crucial for interpreting the hexagrams and their changing lines in the context of a divination reading.
|
|
5
|
-
*/
|
|
6
|
-
interface SetupGramInfo {
|
|
7
|
-
/**
|
|
8
|
-
* There are 5 kins in total.
|
|
9
|
-
*
|
|
10
|
-
* - 兄弟 (Brothers): Representing peers, friends, or competitors.
|
|
11
|
-
* - 妻财 (Wife/Wealth): Representing spouse, wealth, or resources.
|
|
12
|
-
* - 子孙 (Children/Descendants): Representing offspring, students, or followers.
|
|
13
|
-
* - 官鬼 (Officials/Ghosts): Representing authority figures, adversaries, or hidden factors.
|
|
14
|
-
* - 父母 (Parents): Representing parents, mentors, or foundational influences.
|
|
15
|
-
*
|
|
16
|
-
* Each kin is associated with one of the twelve earthly branches (地支), which adds another layer of meaning to the hexagram lines.
|
|
17
|
-
*/
|
|
18
|
-
kin: '兄弟丑土' | '兄弟亥水' | '兄弟午火' | '兄弟卯木' | '兄弟子水' | '兄弟寅木' | '兄弟巳火' | '兄弟戌土' | '兄弟未土' | '兄弟申金' | '兄弟辰土' | '兄弟酉金' | '妻财丑土' | '妻财亥水' | '妻财午火' | '妻财卯木' | '妻财子水' | '妻财寅木' | '妻财巳火' | '妻财戌土' | '妻财未土' | '妻财申金' | '妻财辰土' | '妻财酉金' | '子孙丑土' | '子孙亥水' | '子孙午火' | '子孙卯木' | '子孙子水' | '子孙寅木' | '子孙巳火' | '子孙戌土' | '子孙未土' | '子孙申金' | '子孙辰土' | '子孙酉金' | '官鬼丑土' | '官鬼亥水' | '官鬼午火' | '官鬼卯木' | '官鬼子水' | '官鬼寅木' | '官鬼巳火' | '官鬼戌土' | '官鬼未土' | '官鬼申金' | '官鬼辰土' | '官鬼酉金' | '父母丑土' | '父母亥水' | '父母午火' | '父母卯木' | '父母子水' | '父母寅木' | '父母巳火' | '父母戌土' | '父母未土' | '父母申金' | '父母辰土' | '父母酉金';
|
|
19
|
-
/**
|
|
20
|
-
* Host(世)is the augur and Guest(应) is the person or things which to ask about.
|
|
21
|
-
*
|
|
22
|
-
* Indexes of Host and Guest satisfies this formula:
|
|
23
|
-
* ```js
|
|
24
|
-
* index_guest = (index_host + 3) % 6
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
hostGuest?: '世' | '应';
|
|
28
|
-
}
|
|
29
|
-
//#endregion
|
|
30
1
|
//#region src/core/common.d.ts
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
declare const PalaceOrderTable: PalaceOrderName[];
|
|
2
|
+
declare const PalaceOrderTable: string[];
|
|
3
|
+
type BranchPhase = '子水' | '寅木' | '辰土' | '午火' | '申金' | '戌土' | '寅木' | '辰土' | '午火' | '申金' | '戌土' | '子水' | '辰土' | '午火' | '申金' | '戌土' | '子水' | '寅木' | '子水' | '寅木' | '辰土' | '午火' | '申金' | '戌土' | '丑土' | '亥水' | '酉金' | '未土' | '巳火' | '卯木' | '卯木' | '丑土' | '亥水' | '酉金' | '未土' | '巳火' | '未土' | '巳火' | '卯木' | '丑土' | '亥水' | '酉金' | '巳火' | '卯木' | '丑土' | '亥水' | '酉金' | '未土';
|
|
4
|
+
type Phase = '金' | '木' | '水' | '火' | '土';
|
|
5
|
+
type TrigramName = '乾' | '兑' | '离' | '震' | '巽' | '坎' | '艮' | '坤';
|
|
36
6
|
interface HexagramInfo {
|
|
37
7
|
/**
|
|
38
|
-
* Binary representation of the hexagram, where 0
|
|
8
|
+
* Binary representation of the hexagram, where 0 image a yin line and 1 image a yang line. The lines are ordered from the bottom (first line) to the top (sixth line).
|
|
39
9
|
*/
|
|
40
|
-
binary:
|
|
10
|
+
binary: string;
|
|
41
11
|
/**
|
|
42
|
-
* Binary to
|
|
12
|
+
* Binary to yangs.
|
|
43
13
|
* e.g. `'000000'` 坤为地 -> `[2, 2, 2, 2, 2, 2]`, 2 means Shao Yin.
|
|
44
14
|
*/
|
|
45
|
-
|
|
15
|
+
yangs: number[];
|
|
46
16
|
/**
|
|
47
|
-
*
|
|
17
|
+
* Full name of the hexagram, which includes the names of the upper and lower trigrams.
|
|
48
18
|
*
|
|
49
19
|
* For example, "坤为地", "地雷复", "地水师", etc.
|
|
50
20
|
*/
|
|
51
21
|
id: string;
|
|
22
|
+
/**
|
|
23
|
+
* Name of the hexagram.
|
|
24
|
+
*
|
|
25
|
+
* For example, "地", "复", "师", etc.
|
|
26
|
+
*/
|
|
27
|
+
name: string;
|
|
52
28
|
/**
|
|
53
29
|
* 64 hexagrams correspond to Unicode characters.
|
|
54
|
-
* For example, "䷁" (U+4DC1)
|
|
30
|
+
* For example, "䷁" (U+4DC1) image the hexagram "坤为地".
|
|
55
31
|
*/
|
|
56
32
|
sign: string;
|
|
57
33
|
/**
|
|
58
34
|
* Five Phases (五行) associated with the hexagram, which can be one of "金" (Metal), "木" (Wood), "水" (Water), "火" (Fire), or "土" (Earth).
|
|
59
35
|
* It indicates the development and state of things.
|
|
60
36
|
*/
|
|
61
|
-
phase:
|
|
37
|
+
phase: Phase;
|
|
62
38
|
/**
|
|
63
39
|
* Eight Palaces (八宫) to which the hexagram belongs.
|
|
64
40
|
* 'Palace' is not a physical palace, but rather a category or family of hexagrams.
|
|
65
41
|
*/
|
|
66
|
-
palace:
|
|
42
|
+
palace: TrigramName;
|
|
67
43
|
/**
|
|
68
44
|
* Index of the hexagram within its palace, ranging from 0 to 7. This index helps to identify the specific hexagram within the context of its palace.
|
|
69
45
|
*
|
|
@@ -76,18 +52,12 @@ interface HexagramInfo {
|
|
|
76
52
|
* - 游魂卦 Wandering Soul, restores 4th yao of Fifth Generation
|
|
77
53
|
* - 归魂卦 Returning Soul, restores lower 3 yaos of Fifth Generation
|
|
78
54
|
*/
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Setup information of the hexagram. Includes Host-Guest(世应) and Six Kins (六亲) for each of the six lines. This information is crucial for interpreting the hexagrams and their changing lines in the context of a divination reading.
|
|
82
|
-
*
|
|
83
|
-
* Host(世)is the augur and Guest(应) is the person or things which to ask about.
|
|
84
|
-
*/
|
|
85
|
-
setupInfo: [SetupGramInfo, SetupGramInfo, SetupGramInfo, SetupGramInfo, SetupGramInfo, SetupGramInfo];
|
|
55
|
+
generation: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7;
|
|
86
56
|
}
|
|
87
57
|
declare const HexagramInfoTable: readonly HexagramInfo[];
|
|
88
58
|
interface TrigramInfo {
|
|
89
59
|
/**
|
|
90
|
-
* Presents the trigram as a 3-digit binary string. 1
|
|
60
|
+
* Presents the trigram as a 3-digit binary string. 1 image a Yang line and 0 image a Yin line.
|
|
91
61
|
*
|
|
92
62
|
* For example, "111" for 乾, "100" for 震, etc.
|
|
93
63
|
*/
|
|
@@ -95,33 +65,66 @@ interface TrigramInfo {
|
|
|
95
65
|
/**
|
|
96
66
|
* How many Yang Yaos are in the trigram, such as 0 for 坤, 1 for 震, 2 for 兑, etc.
|
|
97
67
|
*/
|
|
98
|
-
|
|
68
|
+
yangs: 0 | 1 | 2 | 3;
|
|
99
69
|
/**
|
|
100
70
|
* Name of the trigram in Chinese, such as "乾", "坤", "震", etc.
|
|
101
71
|
*/
|
|
102
72
|
id: string;
|
|
103
73
|
/**
|
|
104
|
-
*
|
|
74
|
+
* "象", means what the trigram represents in Chinese, such as "天", "地", "水", etc.
|
|
105
75
|
*/
|
|
106
|
-
|
|
76
|
+
image: string;
|
|
107
77
|
/**
|
|
108
|
-
*
|
|
78
|
+
* Unicode character representing the trigram, such as "☰" for 乾, "☷" for 坤, etc.
|
|
109
79
|
*/
|
|
110
|
-
|
|
80
|
+
sign: string;
|
|
111
81
|
/**
|
|
112
|
-
*
|
|
82
|
+
* Earth Stem and Five Phases when this gram performs a inner gram of a hexagram.
|
|
83
|
+
* @see 《增删卜易·浑天甲子章》
|
|
113
84
|
*/
|
|
114
|
-
|
|
85
|
+
inner: BranchPhase[];
|
|
115
86
|
/**
|
|
116
|
-
*
|
|
87
|
+
* Earth Stem and Five Phases when this gram performs a outer gram of a hexagram.
|
|
88
|
+
* @see 《增删卜易·浑天甲子章》
|
|
117
89
|
*/
|
|
118
|
-
|
|
90
|
+
outer: BranchPhase[];
|
|
119
91
|
}
|
|
120
92
|
/**
|
|
121
93
|
* List of all trigrams in the I Ching, with their binary representation, number of yang lines, name, what they represent, and their corresponding sign.
|
|
122
94
|
*/
|
|
123
95
|
declare const TrigramInfoTable: readonly TrigramInfo[];
|
|
124
96
|
//#endregion
|
|
97
|
+
//#region src/core/setup-gram.d.ts
|
|
98
|
+
/**
|
|
99
|
+
* Kins and their corresponding earthly branches in the Liu Yao divination system, along with the type of relation (世 or 应).
|
|
100
|
+
* This information is crucial for interpreting the hexagrams and their changing lines in the context of a divination reading.
|
|
101
|
+
*
|
|
102
|
+
* @deprecated This is for beginners.
|
|
103
|
+
*/
|
|
104
|
+
interface SetupGramInfo {
|
|
105
|
+
/**
|
|
106
|
+
* There are 5 kins in total.
|
|
107
|
+
*
|
|
108
|
+
* - 兄弟 (Brothers): Representing peers, friends, or competitors.
|
|
109
|
+
* - 妻财 (Wife/Wealth): Representing spouse, wealth, or resources.
|
|
110
|
+
* - 子孙 (Children/Descendants): Representing offspring, students, or followers.
|
|
111
|
+
* - 官鬼 (Officials/Ghosts): Representing authority figures, adversaries, or hidden factors.
|
|
112
|
+
* - 父母 (Parents): Representing parents, mentors, or foundational influences.
|
|
113
|
+
*
|
|
114
|
+
* Each kin is associated with one of the twelve earthly branches (地支), which adds another layer of meaning to the hexagram lines.
|
|
115
|
+
*/
|
|
116
|
+
kin: '兄弟丑土' | '兄弟亥水' | '兄弟午火' | '兄弟卯木' | '兄弟子水' | '兄弟寅木' | '兄弟巳火' | '兄弟戌土' | '兄弟未土' | '兄弟申金' | '兄弟辰土' | '兄弟酉金' | '妻财丑土' | '妻财亥水' | '妻财午火' | '妻财卯木' | '妻财子水' | '妻财寅木' | '妻财巳火' | '妻财戌土' | '妻财未土' | '妻财申金' | '妻财辰土' | '妻财酉金' | '子孙丑土' | '子孙亥水' | '子孙午火' | '子孙卯木' | '子孙子水' | '子孙寅木' | '子孙巳火' | '子孙戌土' | '子孙未土' | '子孙申金' | '子孙辰土' | '子孙酉金' | '官鬼丑土' | '官鬼亥水' | '官鬼午火' | '官鬼卯木' | '官鬼子水' | '官鬼寅木' | '官鬼巳火' | '官鬼戌土' | '官鬼未土' | '官鬼申金' | '官鬼辰土' | '官鬼酉金' | '父母丑土' | '父母亥水' | '父母午火' | '父母卯木' | '父母子水' | '父母寅木' | '父母巳火' | '父母戌土' | '父母未土' | '父母申金' | '父母辰土' | '父母酉金';
|
|
117
|
+
/**
|
|
118
|
+
* Host(世)is the augur and Guest(应) is the person or things which to ask about.
|
|
119
|
+
*
|
|
120
|
+
* Indexes of Host and Guest satisfies this formula:
|
|
121
|
+
* ```js
|
|
122
|
+
* index_guest = (index_host + 3) % 6
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
hostGuest?: '世' | '应';
|
|
126
|
+
}
|
|
127
|
+
//#endregion
|
|
125
128
|
//#region src/core/six-gods.d.ts
|
|
126
129
|
type SixGod = '玄武' | '白虎' | '螣蛇' | '勾陈' | '朱雀' | '青龙';
|
|
127
130
|
interface SixGodInfo {
|
|
@@ -152,7 +155,10 @@ declare const SixGodTable: readonly SixGodInfo[];
|
|
|
152
155
|
//#endregion
|
|
153
156
|
//#region src/classes/yao.d.ts
|
|
154
157
|
declare class Yao {
|
|
155
|
-
|
|
158
|
+
/**
|
|
159
|
+
* Returns 老阴、老阳、少阴、少阳
|
|
160
|
+
*/
|
|
161
|
+
static getName(yangs: number): "老阴" | "少阳" | "少阴" | "老阳";
|
|
156
162
|
/**
|
|
157
163
|
* Support creating a Yao from various types of input:
|
|
158
164
|
* - A symbol representing the Yao (e.g. '交', '单', '拆', '重')
|
|
@@ -184,47 +190,50 @@ declare class Yao {
|
|
|
184
190
|
static fromDigitString(digit: string): Yao | null;
|
|
185
191
|
/**
|
|
186
192
|
* Create a Yao from any Trigram field value.
|
|
187
|
-
* @param value `{id: '坤', binary: '000',
|
|
193
|
+
* @param value `{id: '坤', binary: '000', yangs: 0}`, so `'坤'`, `'000'` and `0` can all be used.
|
|
188
194
|
*/
|
|
189
195
|
static fromTrigramField(value: string | number): Yao | null;
|
|
190
|
-
private _yangCount;
|
|
191
196
|
/**
|
|
192
197
|
* How many faces of character of 3 coins in this Yao.
|
|
193
198
|
* It can only be 0, 1, 2 or 3, which corresponds to 老阴、少阳、少阴、老阳 respectively.
|
|
194
|
-
* - 0: 老阴 (all three coins are
|
|
195
|
-
* - 1: 少阳 (one coin is
|
|
196
|
-
* - 2: 少阴 (two coins are
|
|
197
|
-
* - 3: 老阳 (all three coins are
|
|
199
|
+
* - 0: 老阴 (all three coins are 阴面)
|
|
200
|
+
* - 1: 少阳 (one coin is 阳面, two coins are 阴面)
|
|
201
|
+
* - 2: 少阴 (two coins are 阳面, one coin is 阴面)
|
|
202
|
+
* - 3: 老阳 (all three coins are 阳面)
|
|
198
203
|
*/
|
|
199
|
-
|
|
204
|
+
readonly yangs: 0 | 1 | 2 | 3;
|
|
200
205
|
/**
|
|
201
|
-
*
|
|
202
|
-
* - 0 represents Yin 阴
|
|
203
|
-
* - 1 represents Yang 阳
|
|
206
|
+
* 两仪, aka 阴阳
|
|
204
207
|
*/
|
|
205
|
-
|
|
208
|
+
readonly polar: 0 | 1;
|
|
206
209
|
/**
|
|
207
210
|
* If this Yao is dynamic, which means it can change to another Yao. In LiuYao, only 老阴 and 老阳 are dynamic.
|
|
208
211
|
* - 老阴 (0) can change to 少阳 (1)
|
|
209
212
|
* - 老阳 (3) can change to 少阴 (2)
|
|
210
213
|
* - 少阳 (1) and 少阴 (2) cannot change, so they are static.
|
|
211
214
|
*/
|
|
212
|
-
|
|
215
|
+
readonly dynamic: boolean;
|
|
213
216
|
/**
|
|
214
217
|
* Whether this Yao has already changed to another Yao. Once a Yao is changed, it cannot change again.
|
|
215
218
|
*/
|
|
216
|
-
readonly
|
|
219
|
+
readonly changed: boolean;
|
|
220
|
+
/**
|
|
221
|
+
* The symbol representing this Yao, which is one of '×', '’', '”', '○'.
|
|
222
|
+
*/
|
|
223
|
+
readonly pattern: '×' | '’' | '”' | '○';
|
|
224
|
+
readonly name: '老阴' | '少阳' | '少阴' | '老阳';
|
|
225
|
+
readonly symbol: '单' | '拆' | '重' | '交';
|
|
226
|
+
constructor(yangs: number, isChanged?: boolean);
|
|
217
227
|
/**
|
|
218
|
-
*
|
|
228
|
+
* Consider the Yaos are same if `this.yangs` is same
|
|
219
229
|
*/
|
|
220
|
-
|
|
221
|
-
get symbolName(): string;
|
|
222
|
-
get name(): "老阴" | "少阳" | "少阴" | "老阳";
|
|
223
|
-
constructor(yangCount: number, isChanged?: boolean);
|
|
230
|
+
eq(other: Yao): boolean;
|
|
224
231
|
/**
|
|
225
|
-
*
|
|
232
|
+
* Consider the Yaos are `===` if:
|
|
233
|
+
* 1. `this.yangs` is same
|
|
234
|
+
* 2. `this.isChanged` is same
|
|
226
235
|
*/
|
|
227
|
-
|
|
236
|
+
eqeqeq(other: Yao): boolean;
|
|
228
237
|
clone(): Yao;
|
|
229
238
|
toChanged(): Yao;
|
|
230
239
|
}
|
|
@@ -238,7 +247,7 @@ declare const HexagramYaoOrder: readonly ["初爻", "二爻", "三爻", "四爻"
|
|
|
238
247
|
* - The hexagram can be constructed from an array of Yao or an array of counts of yang.
|
|
239
248
|
* - Creates “乾为天” by default.
|
|
240
249
|
*/
|
|
241
|
-
declare class Hexagram {
|
|
250
|
+
declare class Hexagram implements HexagramInfo {
|
|
242
251
|
/**
|
|
243
252
|
* Use tokens like `'012132'` to create a Hexagram, where each digit represents the count of Yang in the corresponding Yao (0 for 老阴, 1 for 少阳, 2 for 少阴, 3 for 老阳). The first digit represents the first Yao (初爻) and the last digit represents the sixth Yao (上爻).
|
|
244
253
|
*/
|
|
@@ -268,77 +277,58 @@ declare class Hexagram {
|
|
|
268
277
|
* Index from 0 to 5, where 0 is the first Yao (初爻) and 5 is the sixth Yao (上爻).
|
|
269
278
|
*/
|
|
270
279
|
readonly yaos: LiuYao;
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
280
|
+
readonly yangs: number[];
|
|
281
|
+
readonly binary: string;
|
|
282
|
+
readonly id: string;
|
|
283
|
+
readonly name: string;
|
|
284
|
+
readonly sign: string;
|
|
285
|
+
readonly palace: '乾' | '坤' | '震' | '巽' | '坎' | '离' | '艮' | '兑';
|
|
286
|
+
readonly phase: '金' | '木' | '水' | '火' | '土';
|
|
287
|
+
readonly generation: 0 | 6 | 1 | 2 | 3 | 4 | 5 | 7;
|
|
288
|
+
readonly palaceInfo: string;
|
|
276
289
|
/**
|
|
277
290
|
* Whether the 6 Yaos of this hexagram contain any dynamic Yao.
|
|
278
291
|
*/
|
|
279
|
-
|
|
292
|
+
readonly dynamic: boolean;
|
|
280
293
|
/**
|
|
281
294
|
* Whether this hexagram has already changed to another hexagram. Once a hexagram is changed, it cannot change again.
|
|
282
295
|
*/
|
|
283
|
-
|
|
296
|
+
readonly changed: boolean;
|
|
297
|
+
readonly inner: TrigramInfo;
|
|
298
|
+
readonly outer: TrigramInfo;
|
|
284
299
|
/**
|
|
285
|
-
*
|
|
286
|
-
* @returns A trigram if the outer trigram is dynamic.
|
|
300
|
+
* Whether this gram is 六冲、六合
|
|
287
301
|
*/
|
|
288
|
-
|
|
302
|
+
readonly specialType?: '六冲' | '六合';
|
|
289
303
|
/**
|
|
290
|
-
*
|
|
291
|
-
* @returns A trigram if the inner trigram is dynamic.
|
|
304
|
+
* Whether this gram is "八纯卦"
|
|
292
305
|
*/
|
|
293
|
-
|
|
306
|
+
readonly pure: boolean;
|
|
294
307
|
/**
|
|
295
|
-
*
|
|
308
|
+
* Includes 六亲、天干、地支、五行. Looks like "兄弟癸丑土" "官鬼辛卯木"
|
|
296
309
|
*/
|
|
297
|
-
|
|
310
|
+
readonly kins: string[];
|
|
298
311
|
/**
|
|
299
|
-
*
|
|
312
|
+
* Index of the 世爻
|
|
300
313
|
*/
|
|
301
|
-
|
|
314
|
+
readonly host: number;
|
|
302
315
|
/**
|
|
303
|
-
*
|
|
316
|
+
* Index of the 应爻
|
|
304
317
|
*/
|
|
305
|
-
|
|
306
|
-
setYao(index: number, yangCount: number): void;
|
|
307
|
-
toChanged(): Hexagram | null;
|
|
318
|
+
readonly guest: number;
|
|
308
319
|
/**
|
|
309
|
-
*
|
|
310
|
-
* - e.g.:“本卦乾为天,变卦坤为地,动爻:初爻、三爻”
|
|
320
|
+
* if it is a changed gram, this points to the primary one.
|
|
311
321
|
*/
|
|
312
|
-
|
|
322
|
+
readonly primary: Hexagram | null;
|
|
313
323
|
/**
|
|
314
|
-
*
|
|
324
|
+
* Create a Hexagram from an array of Yao with length 6.
|
|
315
325
|
*/
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
变卦: HexagramAIReadable | '无';
|
|
319
|
-
世应变化: string;
|
|
320
|
-
};
|
|
326
|
+
constructor(yaos: Yao[], primary?: Hexagram | null);
|
|
327
|
+
toChanged(): Hexagram | null;
|
|
321
328
|
clone(): Hexagram;
|
|
322
329
|
toString(): string;
|
|
323
330
|
[Symbol.toPrimitive](): string;
|
|
324
331
|
}
|
|
325
|
-
interface YaoInfo {
|
|
326
|
-
爻: string;
|
|
327
|
-
类型?: '世' | '应';
|
|
328
|
-
六亲: string;
|
|
329
|
-
}
|
|
330
|
-
interface HexagramAIReadable {
|
|
331
|
-
初爻: YaoInfo;
|
|
332
|
-
二爻: YaoInfo;
|
|
333
|
-
三爻: YaoInfo;
|
|
334
|
-
四爻: YaoInfo;
|
|
335
|
-
五爻: YaoInfo;
|
|
336
|
-
上爻: YaoInfo;
|
|
337
|
-
卦名: string;
|
|
338
|
-
宫: string;
|
|
339
|
-
变爻?: string[];
|
|
340
|
-
六冲六合: '六合卦' | '六冲卦' | '不是';
|
|
341
|
-
}
|
|
342
332
|
//#endregion
|
|
343
|
-
export { Hexagram, type HexagramInfo, HexagramInfoTable, HexagramYaoOrder, PalaceOrderTable
|
|
333
|
+
export { Hexagram, type HexagramInfo, HexagramInfoTable, HexagramYaoOrder, PalaceOrderTable, type SetupGramInfo, type SixGod, type SixGodInfo, SixGodTable, type TrigramInfo, TrigramInfoTable, Yao };
|
|
344
334
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=[{name:`本宫卦`,nameEn:`Original Palace`},{name:`一世卦`,nameEn:`First Generation`},{name:`二世卦`,nameEn:`Second Generation`},{name:`三世卦`,nameEn:`Third Generation`},{name:`四世卦`,nameEn:`Fourth Generation`},{name:`五世卦`,nameEn:`Fifth Generation`},{name:`游魂卦`,nameEn:`Wandering Soul`},{name:`归魂卦`,nameEn:`Returning Soul`}],t=Object.freeze([{binary:`000000`,id:`坤为地`,sign:`䷁`,phase:`土`,palace:`坤`,palaceIndex:0,setupInfo:[{kin:`兄弟未土`},{kin:`父母巳火`},{kin:`官鬼卯木`,hostGuest:`应`},{kin:`兄弟丑土`},{kin:`妻财亥水`},{kin:`子孙酉金`,hostGuest:`世`}],yangCounts:[2,2,2,2,2,2]},{binary:`100000`,id:`地雷复`,sign:`䷗`,phase:`土`,palace:`坤`,palaceIndex:1,setupInfo:[{kin:`妻财子水`,hostGuest:`世`},{kin:`官鬼寅木`},{kin:`兄弟辰土`},{kin:`兄弟丑土`,hostGuest:`应`},{kin:`妻财亥水`},{kin:`子孙酉金`}],yangCounts:[1,2,2,2,2,2]},{binary:`010000`,id:`地水师`,sign:`䷆`,phase:`水`,palace:`坎`,palaceIndex:7,setupInfo:[{kin:`子孙寅木`},{kin:`官鬼辰土`},{kin:`妻财午火`,hostGuest:`世`},{kin:`官鬼丑土`},{kin:`兄弟亥水`},{kin:`父母酉金`,hostGuest:`应`}],yangCounts:[2,1,2,2,2,2]},{binary:`110000`,id:`地泽临`,sign:`䷒`,phase:`土`,palace:`坤`,palaceIndex:2,setupInfo:[{kin:`父母巳火`},{kin:`官鬼卯木`,hostGuest:`世`},{kin:`兄弟丑土`},{kin:`兄弟丑土`},{kin:`妻财亥水`,hostGuest:`应`},{kin:`子孙酉金`}],yangCounts:[1,1,2,2,2,2]},{binary:`001000`,id:`地山谦`,sign:`䷎`,phase:`土`,palace:`兑`,palaceIndex:5,setupInfo:[{kin:`父母辰土`},{kin:`官鬼午火`,hostGuest:`应`},{kin:`兄弟申金`},{kin:`父母丑土`},{kin:`子孙亥水`,hostGuest:`世`},{kin:`兄弟酉金`}],yangCounts:[2,2,1,2,2,2]},{binary:`101000`,id:`地火明夷`,sign:`䷣`,phase:`水`,palace:`坎`,palaceIndex:6,setupInfo:[{kin:`子孙卯木`,hostGuest:`应`},{kin:`官鬼丑土`},{kin:`兄弟亥水`},{kin:`官鬼丑土`,hostGuest:`世`},{kin:`兄弟亥水`},{kin:`父母酉金`}],yangCounts:[1,2,1,2,2,2]},{binary:`011000`,id:`地风升`,sign:`䷭`,phase:`木`,palace:`震`,palaceIndex:4,setupInfo:[{kin:`妻财丑土`,hostGuest:`应`},{kin:`父母亥水`},{kin:`官鬼酉金`},{kin:`妻财丑土`,hostGuest:`世`},{kin:`父母亥水`},{kin:`官鬼酉金`}],yangCounts:[2,1,1,2,2,2]},{binary:`111000`,id:`地天泰`,sign:`䷊`,phase:`土`,palace:`坤`,palaceIndex:3,setupInfo:[{kin:`妻财子水`},{kin:`官鬼寅木`},{kin:`兄弟辰土`,hostGuest:`世`},{kin:`兄弟丑土`},{kin:`妻财亥水`},{kin:`子孙酉金`,hostGuest:`应`}],yangCounts:[1,1,1,2,2,2]},{binary:`000100`,id:`雷地豫`,sign:`䷏`,phase:`木`,palace:`震`,palaceIndex:1,setupInfo:[{kin:`妻财未土`,hostGuest:`世`},{kin:`子孙巳火`},{kin:`兄弟卯木`},{kin:`子孙午火`,hostGuest:`应`},{kin:`官鬼申金`},{kin:`妻财戌土`}],yangCounts:[2,2,2,1,2,2]},{binary:`100100`,id:`震为雷`,sign:`䷲`,phase:`木`,palace:`震`,palaceIndex:0,setupInfo:[{kin:`父母子水`},{kin:`兄弟寅木`},{kin:`妻财辰土`,hostGuest:`应`},{kin:`子孙午火`},{kin:`官鬼申金`},{kin:`妻财戌土`,hostGuest:`世`}],yangCounts:[1,2,2,1,2,2]},{binary:`010100`,id:`雷水解`,sign:`䷧`,phase:`木`,palace:`震`,palaceIndex:2,setupInfo:[{kin:`兄弟寅木`},{kin:`妻财辰土`,hostGuest:`世`},{kin:`子孙午火`},{kin:`子孙午火`},{kin:`官鬼申金`,hostGuest:`应`},{kin:`妻财戌土`}],yangCounts:[2,1,2,1,2,2]},{binary:`110100`,id:`雷泽归妹`,sign:`䷵`,phase:`金`,palace:`兑`,palaceIndex:7,setupInfo:[{kin:`官鬼巳火`},{kin:`妻财卯木`},{kin:`父母丑土`,hostGuest:`世`},{kin:`官鬼午火`},{kin:`兄弟申金`},{kin:`父母戌土`,hostGuest:`应`}],yangCounts:[1,1,2,1,2,2]},{binary:`001100`,id:`雷山小过`,sign:`䷽`,phase:`金`,palace:`兑`,palaceIndex:6,setupInfo:[{kin:`父母辰土`,hostGuest:`应`},{kin:`官鬼午火`},{kin:`兄弟申金`},{kin:`官鬼午火`,hostGuest:`世`},{kin:`兄弟申金`},{kin:`父母戌土`}],yangCounts:[2,2,1,1,2,2]},{binary:`101100`,id:`雷火丰`,sign:`䷶`,phase:`水`,palace:`坎`,palaceIndex:5,setupInfo:[{kin:`子孙卯木`},{kin:`官鬼丑土`,hostGuest:`应`},{kin:`兄弟亥水`},{kin:`妻财午火`},{kin:`父母申金`,hostGuest:`世`},{kin:`官鬼戌土`}],yangCounts:[1,2,1,1,2,2]},{binary:`011100`,id:`雷风恒`,sign:`䷟`,phase:`木`,palace:`震`,palaceIndex:3,setupInfo:[{kin:`妻财丑土`},{kin:`父母亥水`},{kin:`官鬼酉金`,hostGuest:`世`},{kin:`子孙午火`},{kin:`官鬼申金`},{kin:`妻财戌土`,hostGuest:`应`}],yangCounts:[2,1,1,1,2,2]},{binary:`111100`,id:`雷天大壮`,sign:`䷡`,phase:`土`,palace:`坤`,palaceIndex:4,setupInfo:[{kin:`妻财子水`,hostGuest:`应`},{kin:`官鬼寅木`},{kin:`兄弟辰土`},{kin:`父母午火`,hostGuest:`世`},{kin:`子孙申金`},{kin:`兄弟戌土`}],yangCounts:[1,1,1,1,2,2]},{binary:`000010`,id:`水地比`,sign:`䷇`,phase:`土`,palace:`坤`,palaceIndex:7,setupInfo:[{kin:`兄弟未土`},{kin:`父母巳火`},{kin:`官鬼卯木`,hostGuest:`世`},{kin:`子孙申金`},{kin:`兄弟戌土`},{kin:`妻财子水`,hostGuest:`应`}],yangCounts:[2,2,2,2,1,2]},{binary:`100010`,id:`水雷屯`,sign:`䷂`,phase:`水`,palace:`坎`,palaceIndex:2,setupInfo:[{kin:`兄弟子水`},{kin:`子孙寅木`,hostGuest:`世`},{kin:`官鬼辰土`},{kin:`父母申金`},{kin:`官鬼戌土`,hostGuest:`应`},{kin:`兄弟子水`}],yangCounts:[1,2,2,2,1,2]},{binary:`010010`,id:`坎为水`,sign:`䷜`,phase:`水`,palace:`坎`,palaceIndex:0,setupInfo:[{kin:`子孙寅木`},{kin:`官鬼辰土`},{kin:`妻财午火`,hostGuest:`应`},{kin:`父母申金`},{kin:`官鬼戌土`},{kin:`兄弟子水`,hostGuest:`世`}],yangCounts:[2,1,2,2,1,2]},{binary:`110010`,id:`水泽节`,sign:`䷻`,phase:`水`,palace:`坎`,palaceIndex:1,setupInfo:[{kin:`妻财巳火`,hostGuest:`世`},{kin:`子孙卯木`},{kin:`官鬼丑土`},{kin:`父母申金`,hostGuest:`应`},{kin:`官鬼戌土`},{kin:`兄弟子水`}],yangCounts:[1,1,2,2,1,2]},{binary:`001010`,id:`水山蹇`,sign:`䷦`,phase:`金`,palace:`兑`,palaceIndex:4,setupInfo:[{kin:`父母辰土`,hostGuest:`应`},{kin:`官鬼午火`},{kin:`兄弟申金`},{kin:`兄弟申金`,hostGuest:`世`},{kin:`父母戌土`},{kin:`子孙子水`}],yangCounts:[2,2,1,2,1,2]},{binary:`101010`,id:`水火既济`,sign:`䷾`,phase:`水`,palace:`坎`,palaceIndex:3,setupInfo:[{kin:`子孙卯木`},{kin:`官鬼丑土`},{kin:`兄弟亥水`,hostGuest:`世`},{kin:`父母申金`},{kin:`官鬼戌土`},{kin:`兄弟子水`,hostGuest:`应`}],yangCounts:[1,2,1,2,1,2]},{binary:`011010`,id:`水风井`,sign:`䷯`,phase:`木`,palace:`震`,palaceIndex:5,setupInfo:[{kin:`妻财丑土`},{kin:`父母亥水`,hostGuest:`应`},{kin:`官鬼酉金`},{kin:`官鬼申金`},{kin:`妻财戌土`,hostGuest:`世`},{kin:`父母子水`}],yangCounts:[2,1,1,2,1,2]},{binary:`111010`,id:`水天需`,sign:`䷄`,phase:`土`,palace:`坤`,palaceIndex:6,setupInfo:[{kin:`妻财子水`,hostGuest:`应`},{kin:`官鬼寅木`},{kin:`兄弟辰土`},{kin:`子孙申金`,hostGuest:`世`},{kin:`兄弟戌土`},{kin:`妻财子水`}],yangCounts:[1,1,1,2,1,2]},{binary:`000110`,id:`泽地萃`,sign:`䷬`,phase:`金`,palace:`兑`,palaceIndex:2,setupInfo:[{kin:`父母未土`},{kin:`官鬼巳火`,hostGuest:`世`},{kin:`妻财卯木`},{kin:`子孙亥水`},{kin:`兄弟酉金`,hostGuest:`应`},{kin:`父母未土`}],yangCounts:[2,2,2,1,1,2]},{binary:`100110`,id:`泽雷随`,sign:`䷐`,phase:`木`,palace:`震`,palaceIndex:7,setupInfo:[{kin:`父母子水`},{kin:`兄弟寅木`},{kin:`妻财辰土`,hostGuest:`世`},{kin:`父母亥水`},{kin:`官鬼酉金`},{kin:`妻财未土`,hostGuest:`应`}],yangCounts:[1,2,2,1,1,2]},{binary:`010110`,id:`泽水困`,sign:`䷮`,phase:`金`,palace:`兑`,palaceIndex:1,setupInfo:[{kin:`妻财卯木`,hostGuest:`世`},{kin:`父母辰土`},{kin:`官鬼午火`},{kin:`子孙亥水`,hostGuest:`应`},{kin:`兄弟酉金`},{kin:`父母未土`}],yangCounts:[2,1,2,1,1,2]},{binary:`110110`,id:`兑为泽`,sign:`䷹`,phase:`金`,palace:`兑`,palaceIndex:0,setupInfo:[{kin:`官鬼巳火`},{kin:`妻财卯木`},{kin:`父母丑土`,hostGuest:`应`},{kin:`子孙亥水`},{kin:`兄弟酉金`},{kin:`父母未土`,hostGuest:`世`}],yangCounts:[1,1,2,1,1,2]},{binary:`001110`,id:`泽山咸`,sign:`䷞`,phase:`金`,palace:`兑`,palaceIndex:3,setupInfo:[{kin:`父母辰土`},{kin:`官鬼午火`},{kin:`兄弟申金`,hostGuest:`世`},{kin:`子孙亥水`},{kin:`兄弟酉金`},{kin:`父母未土`,hostGuest:`应`}],yangCounts:[2,2,1,1,1,2]},{binary:`101110`,id:`泽火革`,sign:`䷰`,phase:`水`,palace:`坎`,palaceIndex:4,setupInfo:[{kin:`子孙卯木`,hostGuest:`应`},{kin:`官鬼丑土`},{kin:`兄弟亥水`},{kin:`兄弟亥水`,hostGuest:`世`},{kin:`父母酉金`},{kin:`官鬼未土`}],yangCounts:[1,2,1,1,1,2]},{binary:`011110`,id:`泽风大过`,sign:`䷛`,phase:`木`,palace:`震`,palaceIndex:6,setupInfo:[{kin:`妻财丑土`,hostGuest:`应`},{kin:`父母亥水`},{kin:`官鬼酉金`},{kin:`父母亥水`,hostGuest:`世`},{kin:`官鬼酉金`},{kin:`妻财未土`}],yangCounts:[2,1,1,1,1,2]},{binary:`111110`,id:`泽天夬`,sign:`䷪`,phase:`土`,palace:`坤`,palaceIndex:5,setupInfo:[{kin:`妻财子水`},{kin:`官鬼寅木`,hostGuest:`应`},{kin:`兄弟辰土`},{kin:`妻财亥水`},{kin:`子孙酉金`,hostGuest:`世`},{kin:`兄弟未土`}],yangCounts:[1,1,1,1,1,2]},{binary:`000001`,id:`山地剥`,sign:`䷖`,phase:`金`,palace:`乾`,palaceIndex:5,setupInfo:[{kin:`父母未土`},{kin:`官鬼巳火`,hostGuest:`应`},{kin:`妻财卯木`},{kin:`父母戌土`},{kin:`子孙子水`,hostGuest:`世`},{kin:`妻财卯木`}],yangCounts:[2,2,2,2,2,1]},{binary:`100001`,id:`山雷颐`,sign:`䷚`,phase:`木`,palace:`巽`,palaceIndex:6,setupInfo:[{kin:`父母子水`,hostGuest:`应`},{kin:`兄弟寅木`},{kin:`妻财辰土`},{kin:`妻财戌土`,hostGuest:`世`},{kin:`父母子水`},{kin:`兄弟寅木`}],yangCounts:[1,2,2,2,2,1]},{binary:`010001`,id:`山水蒙`,sign:`䷃`,phase:`火`,palace:`离`,palaceIndex:4,setupInfo:[{kin:`父母寅木`,hostGuest:`应`},{kin:`子孙辰土`},{kin:`兄弟午火`},{kin:`子孙戌土`,hostGuest:`世`},{kin:`官鬼子水`},{kin:`父母寅木`}],yangCounts:[2,1,2,2,2,1]},{binary:`110001`,id:`山泽损`,sign:`䷨`,phase:`土`,palace:`艮`,palaceIndex:3,setupInfo:[{kin:`父母巳火`},{kin:`官鬼卯木`},{kin:`兄弟丑土`,hostGuest:`世`},{kin:`兄弟戌土`},{kin:`妻财子水`},{kin:`官鬼寅木`,hostGuest:`应`}],yangCounts:[1,1,2,2,2,1]},{binary:`001001`,id:`艮为山`,sign:`䷳`,phase:`土`,palace:`艮`,palaceIndex:0,setupInfo:[{kin:`兄弟辰土`},{kin:`父母午火`},{kin:`子孙申金`,hostGuest:`应`},{kin:`兄弟戌土`},{kin:`妻财子水`},{kin:`官鬼寅木`,hostGuest:`世`}],yangCounts:[2,2,1,2,2,1]},{binary:`101001`,id:`山火贲`,sign:`䷕`,phase:`土`,palace:`艮`,palaceIndex:1,setupInfo:[{kin:`官鬼卯木`,hostGuest:`世`},{kin:`兄弟丑土`},{kin:`妻财亥水`},{kin:`兄弟戌土`,hostGuest:`应`},{kin:`妻财子水`},{kin:`官鬼寅木`}],yangCounts:[1,2,1,2,2,1]},{binary:`011001`,id:`山风蛊`,sign:`䷑`,phase:`木`,palace:`巽`,palaceIndex:7,setupInfo:[{kin:`妻财丑土`},{kin:`父母亥水`},{kin:`官鬼酉金`,hostGuest:`世`},{kin:`妻财戌土`},{kin:`父母子水`},{kin:`兄弟寅木`,hostGuest:`应`}],yangCounts:[2,1,1,2,2,1]},{binary:`111001`,id:`山天大畜`,sign:`䷙`,phase:`土`,palace:`艮`,palaceIndex:2,setupInfo:[{kin:`妻财子水`},{kin:`官鬼寅木`,hostGuest:`世`},{kin:`兄弟辰土`},{kin:`兄弟戌土`},{kin:`妻财子水`,hostGuest:`应`},{kin:`官鬼寅木`}],yangCounts:[1,1,1,2,2,1]},{binary:`000101`,id:`火地晋`,sign:`䷢`,phase:`金`,palace:`乾`,palaceIndex:6,setupInfo:[{kin:`父母未土`,hostGuest:`应`},{kin:`官鬼巳火`},{kin:`妻财卯木`},{kin:`兄弟酉金`,hostGuest:`世`},{kin:`父母未土`},{kin:`官鬼巳火`}],yangCounts:[2,2,2,1,2,1]},{binary:`100101`,id:`火雷噬嗑`,sign:`䷔`,phase:`木`,palace:`巽`,palaceIndex:5,setupInfo:[{kin:`父母子水`},{kin:`兄弟寅木`,hostGuest:`应`},{kin:`妻财辰土`},{kin:`官鬼酉金`},{kin:`妻财未土`,hostGuest:`世`},{kin:`子孙巳火`}],yangCounts:[1,2,2,1,2,1]},{binary:`010101`,id:`火水未济`,sign:`䷿`,phase:`火`,palace:`离`,palaceIndex:3,setupInfo:[{kin:`父母寅木`},{kin:`子孙辰土`},{kin:`兄弟午火`,hostGuest:`世`},{kin:`妻财酉金`},{kin:`子孙未土`},{kin:`兄弟巳火`,hostGuest:`应`}],yangCounts:[2,1,2,1,2,1]},{binary:`110101`,id:`火泽睽`,sign:`䷥`,phase:`土`,palace:`艮`,palaceIndex:4,setupInfo:[{kin:`父母巳火`,hostGuest:`应`},{kin:`官鬼卯木`},{kin:`兄弟丑土`},{kin:`子孙酉金`,hostGuest:`世`},{kin:`兄弟未土`},{kin:`父母巳火`}],yangCounts:[1,1,2,1,2,1]},{binary:`001101`,id:`火山旅`,sign:`䷷`,phase:`火`,palace:`离`,palaceIndex:1,setupInfo:[{kin:`子孙辰土`,hostGuest:`世`},{kin:`兄弟午火`},{kin:`妻财申金`},{kin:`妻财酉金`,hostGuest:`应`},{kin:`子孙未土`},{kin:`兄弟巳火`}],yangCounts:[2,2,1,1,2,1]},{binary:`101101`,id:`离为火`,sign:`䷝`,phase:`火`,palace:`离`,palaceIndex:0,setupInfo:[{kin:`父母卯木`},{kin:`子孙丑土`},{kin:`官鬼亥水`,hostGuest:`应`},{kin:`妻财酉金`},{kin:`子孙未土`},{kin:`兄弟巳火`,hostGuest:`世`}],yangCounts:[1,2,1,1,2,1]},{binary:`011101`,id:`火风鼎`,sign:`䷱`,phase:`火`,palace:`离`,palaceIndex:2,setupInfo:[{kin:`子孙丑土`},{kin:`官鬼亥水`,hostGuest:`世`},{kin:`妻财酉金`},{kin:`妻财酉金`},{kin:`子孙未土`,hostGuest:`应`},{kin:`兄弟巳火`}],yangCounts:[2,1,1,1,2,1]},{binary:`111101`,id:`火天大有`,sign:`䷍`,phase:`金`,palace:`乾`,palaceIndex:7,setupInfo:[{kin:`子孙子水`},{kin:`妻财寅木`},{kin:`父母辰土`,hostGuest:`世`},{kin:`兄弟酉金`},{kin:`父母未土`},{kin:`官鬼巳火`,hostGuest:`应`}],yangCounts:[1,1,1,1,2,1]},{binary:`000011`,id:`风地观`,sign:`䷓`,phase:`金`,palace:`乾`,palaceIndex:4,setupInfo:[{kin:`父母未土`,hostGuest:`应`},{kin:`官鬼巳火`},{kin:`妻财卯木`},{kin:`父母未土`,hostGuest:`世`},{kin:`官鬼巳火`},{kin:`妻财卯木`}],yangCounts:[2,2,2,2,1,1]},{binary:`100011`,id:`风雷益`,sign:`䷩`,phase:`木`,palace:`巽`,palaceIndex:3,setupInfo:[{kin:`父母子水`},{kin:`兄弟寅木`},{kin:`妻财辰土`,hostGuest:`世`},{kin:`妻财未土`},{kin:`子孙巳火`},{kin:`兄弟卯木`,hostGuest:`应`}],yangCounts:[1,2,2,2,1,1]},{binary:`010011`,id:`风水涣`,sign:`䷺`,phase:`火`,palace:`离`,palaceIndex:5,setupInfo:[{kin:`父母寅木`},{kin:`子孙辰土`,hostGuest:`应`},{kin:`兄弟午火`},{kin:`子孙未土`},{kin:`兄弟巳火`,hostGuest:`世`},{kin:`父母卯木`}],yangCounts:[2,1,2,2,1,1]},{binary:`110011`,id:`风泽中孚`,sign:`䷼`,phase:`土`,palace:`艮`,palaceIndex:6,setupInfo:[{kin:`父母巳火`,hostGuest:`应`},{kin:`官鬼卯木`},{kin:`兄弟丑土`},{kin:`兄弟未土`,hostGuest:`世`},{kin:`父母巳火`},{kin:`官鬼卯木`}],yangCounts:[1,1,2,2,1,1]},{binary:`001011`,id:`风山渐`,sign:`䷴`,phase:`土`,palace:`艮`,palaceIndex:7,setupInfo:[{kin:`兄弟辰土`},{kin:`父母午火`},{kin:`子孙申金`,hostGuest:`世`},{kin:`兄弟未土`},{kin:`父母巳火`},{kin:`官鬼卯木`,hostGuest:`应`}],yangCounts:[2,2,1,2,1,1]},{binary:`101011`,id:`风火家人`,sign:`䷤`,phase:`木`,palace:`巽`,palaceIndex:2,setupInfo:[{kin:`兄弟卯木`},{kin:`妻财丑土`,hostGuest:`世`},{kin:`父母亥水`},{kin:`妻财未土`},{kin:`子孙巳火`,hostGuest:`应`},{kin:`兄弟卯木`}],yangCounts:[1,2,1,2,1,1]},{binary:`011011`,id:`巽为风`,sign:`䷸`,phase:`木`,palace:`巽`,palaceIndex:0,setupInfo:[{kin:`妻财丑土`},{kin:`父母亥水`},{kin:`官鬼酉金`,hostGuest:`应`},{kin:`妻财未土`},{kin:`子孙巳火`},{kin:`兄弟卯木`,hostGuest:`世`}],yangCounts:[2,1,1,2,1,1]},{binary:`111011`,id:`风天小畜`,sign:`䷈`,phase:`木`,palace:`巽`,palaceIndex:1,setupInfo:[{kin:`父母子水`,hostGuest:`世`},{kin:`兄弟寅木`},{kin:`妻财辰土`},{kin:`妻财未土`,hostGuest:`应`},{kin:`子孙巳火`},{kin:`兄弟卯木`}],yangCounts:[1,1,1,2,1,1]},{binary:`000111`,id:`天地否`,sign:`䷋`,phase:`金`,palace:`乾`,palaceIndex:3,setupInfo:[{kin:`父母未土`},{kin:`官鬼巳火`},{kin:`妻财卯木`,hostGuest:`世`},{kin:`官鬼午火`},{kin:`兄弟申金`},{kin:`父母戌土`,hostGuest:`应`}],yangCounts:[2,2,2,1,1,1]},{binary:`100111`,id:`天雷无妄`,sign:`䷘`,phase:`木`,palace:`巽`,palaceIndex:4,setupInfo:[{kin:`父母子水`,hostGuest:`应`},{kin:`兄弟寅木`},{kin:`妻财辰土`},{kin:`子孙午火`,hostGuest:`世`},{kin:`官鬼申金`},{kin:`妻财戌土`}],yangCounts:[1,2,2,1,1,1]},{binary:`010111`,id:`天水讼`,sign:`䷅`,phase:`火`,palace:`离`,palaceIndex:6,setupInfo:[{kin:`父母寅木`,hostGuest:`应`},{kin:`子孙辰土`},{kin:`兄弟午火`},{kin:`兄弟午火`,hostGuest:`世`},{kin:`妻财申金`},{kin:`子孙戌土`}],yangCounts:[2,1,2,1,1,1]},{binary:`110111`,id:`天泽履`,sign:`䷉`,phase:`土`,palace:`艮`,palaceIndex:5,setupInfo:[{kin:`父母巳火`},{kin:`官鬼卯木`,hostGuest:`应`},{kin:`兄弟丑土`},{kin:`父母午火`},{kin:`子孙申金`,hostGuest:`世`},{kin:`兄弟戌土`}],yangCounts:[1,1,2,1,1,1]},{binary:`001111`,id:`天山遁`,sign:`䷠`,phase:`金`,palace:`乾`,palaceIndex:2,setupInfo:[{kin:`父母辰土`},{kin:`官鬼午火`,hostGuest:`世`},{kin:`兄弟申金`},{kin:`官鬼午火`},{kin:`兄弟申金`,hostGuest:`应`},{kin:`父母戌土`}],yangCounts:[2,2,1,1,1,1]},{binary:`101111`,id:`天火同人`,sign:`䷌`,phase:`火`,palace:`离`,palaceIndex:7,setupInfo:[{kin:`父母寅木`},{kin:`子孙辰土`},{kin:`兄弟午火`,hostGuest:`世`},{kin:`子孙未土`},{kin:`父母巳火`},{kin:`子孙戌土`,hostGuest:`应`}],yangCounts:[1,2,1,1,1,1]},{binary:`011111`,id:`天风姤`,sign:`䷫`,phase:`金`,palace:`乾`,palaceIndex:1,setupInfo:[{kin:`父母丑土`,hostGuest:`世`},{kin:`子孙亥水`},{kin:`兄弟酉金`},{kin:`官鬼午火`,hostGuest:`应`},{kin:`兄弟申金`},{kin:`父母戌土`}],yangCounts:[2,1,1,1,1,1]},{binary:`111111`,id:`乾为天`,sign:`䷀`,phase:`金`,palace:`乾`,palaceIndex:0,setupInfo:[{kin:`子孙子水`},{kin:`妻财寅木`},{kin:`父母辰土`,hostGuest:`应`},{kin:`官鬼午火`},{kin:`兄弟申金`},{kin:`父母戌土`,hostGuest:`世`}],yangCounts:[1,1,1,1,1,1]}]),n=Object.freeze([{id:`坤`,binary:`000`,yangCount:0,represents:`地`,nameEn:`kun`,representsEn:`earth`,sign:`☷`},{id:`震`,binary:`100`,yangCount:1,represents:`雷`,nameEn:`zhen`,representsEn:`thunder`,sign:`☳`},{id:`坎`,binary:`010`,yangCount:1,represents:`水`,nameEn:`kan`,representsEn:`water`,sign:`☵`},{id:`兑`,binary:`110`,yangCount:2,represents:`泽`,nameEn:`dui`,representsEn:`lake`,sign:`☱`},{id:`艮`,binary:`001`,yangCount:1,represents:`山`,nameEn:`gen`,representsEn:`mountain`,sign:`☶`},{id:`离`,binary:`101`,yangCount:2,represents:`火`,nameEn:`li`,representsEn:`fire`,sign:`☲`},{id:`巽`,binary:`011`,yangCount:2,represents:`风`,nameEn:`xun`,representsEn:`wind`,sign:`☴`},{id:`乾`,binary:`111`,yangCount:3,represents:`天`,nameEn:`qian`,representsEn:`heaven`,sign:`☰`}]),r=Object.freeze([{heavenlyStem:`甲`,gods:[`青龙`,`朱雀`,`勾陈`,`螣蛇`,`白虎`,`玄武`]},{heavenlyStem:`乙`,gods:[`青龙`,`朱雀`,`勾陈`,`螣蛇`,`白虎`,`玄武`]},{heavenlyStem:`丙`,gods:[`朱雀`,`勾陈`,`螣蛇`,`白虎`,`玄武`,`青龙`]},{heavenlyStem:`丁`,gods:[`朱雀`,`勾陈`,`螣蛇`,`白虎`,`玄武`,`青龙`]},{heavenlyStem:`戊`,gods:[`勾陈`,`螣蛇`,`白虎`,`玄武`,`青龙`,`朱雀`]},{heavenlyStem:`己`,gods:[`螣蛇`,`白虎`,`玄武`,`青龙`,`朱雀`,`勾陈`]},{heavenlyStem:`庚`,gods:[`白虎`,`玄武`,`青龙`,`朱雀`,`勾陈`,`螣蛇`]},{heavenlyStem:`辛`,gods:[`白虎`,`玄武`,`青龙`,`朱雀`,`勾陈`,`螣蛇`]},{heavenlyStem:`壬`,gods:[`玄武`,`青龙`,`朱雀`,`勾陈`,`螣蛇`,`白虎`]},{heavenlyStem:`癸`,gods:[`玄武`,`青龙`,`朱雀`,`勾陈`,`螣蛇`,`白虎`]}]),i=[`老阴`,`少阳`,`少阴`,`老阳`],a=`交单拆重`,o=`×’”○`,s=[1,1,2,2],c=[0,1,0,1];function l(e){if(e!==0&&e!==1&&e!==2&&e!==3)throw Error(`Count of yang must be 0, 1, 2 or 3`)}var u=class e{static getName(e){return i[e]}static fromSymbol(t){let n=o.indexOf(t);return n===-1?null:new e(n)}static fromSymbolName(t){let n=a.indexOf(t);return n===-1?null:new e(n)}static fromName(t){let n=i.indexOf(t);return n===-1?null:new e(n)}static fromDigitString(t){let n=`0123`.indexOf(t);return n===-1?null:new e(n)}static fromTrigramField(t){let r=n.find(e=>e.id===t||e.yangCount===t||e.binary===t||e.nameEn===t||e.represents===t||e.representsEn===t||e.sign===t);return r?new e(r.yangCount):null}_yangCount;get yangCount(){return this._yangCount}get polar(){return c[this.yangCount]}get isDynamic(){return this.yangCount===0||this.yangCount===3}isChanged;get symbol(){return o[this.yangCount]}get symbolName(){return a[this.yangCount]}get name(){return i[this.yangCount]}constructor(e,t=!1){l(e),this._yangCount=e,this.isChanged=t}set(e){l(e),this._yangCount=e}clone(){return new e(this.yangCount,this.isChanged)}toChanged(){return this.isDynamic?new e(s[this.yangCount],!0):new e(this.yangCount,!1)}};const d=[`初爻`,`二爻`,`三爻`,`四爻`,`五爻`,`上爻`];var f=class n{static fromQuaternary(e){let t=e.split(``).map(u.fromDigitString);return t.every(e=>e!==null)?new n(t):null}static fromSymbolName(e){let t=e.split(``).map(u.fromSymbolName);return t.every(e=>e!==null)?new n(t):null}static fromYangCounts(e){try{return new n(e.map(e=>new u(e)))}catch{return null}}static fromId(e){let r=t.find(t=>t.id===e||t.id.slice(2)===e||t.id.startsWith(e)&&e.length>1);return r?n.fromYangCounts(r.yangCounts):null}static fromPalace(e){let r=t.find(t=>t.id[2]===e);return r?n.fromYangCounts(r.yangCounts):null}yaos;get info(){return t.find(e=>e.binary===this.yaos.map(e=>e.polar).join(``))}get palace(){let t=this.info;return`${t.palace}宫(${t.phase})${e[t.palaceIndex].name}`}get isDynamic(){return this.yaos.some(e=>e.isDynamic||e.isChanged)}get isChanged(){return this.yaos.some(e=>e.isChanged)}get dynamicOuter(){return this.yaos.slice(3).some(e=>e.isDynamic||e.isChanged)}get dynamicInner(){return this.yaos.slice(0,3).some(e=>e.isDynamic||e.isChanged)}get isSixScattering(){return[`乾为天`,`坤为地`,`震为雷`,`巽为风`,`坎为水`,`离为火`,`艮为山`,`兑为泽`,`天雷无妄`,`雷天大壮`].includes(this.info.id)}get isSixGathering(){return[`天地否`,`地天泰`,`地雷复`,`雷地豫`,`山火贲`,`火山旅`,`泽水困`,`水泽节`].includes(this.info.id)}constructor(e){if(e.length!==6)throw Error(`Array length mismatch, A Hexagram must be constructed with exactly 6 Yaos or 6 counts of yang`);if(e.every(e=>e instanceof u))this.yaos=e.map(e=>e.clone());else throw Error(`Invalid Arguments, Hexagram must be constructed with exactly 6 Yaos or 6 counts of yang`)}setYao(e,t){this.yaos[e].set(t)}toChanged(){if(!this.isDynamic)return null;if(this.isChanged)throw Error(`已经是变卦了,无法再变`);return new n(this.yaos.map(e=>e.toChanged()))}toDescription(){let e=this.info.setupInfo.findIndex(e=>e.hostGuest===`世`),t=this.info.setupInfo.findIndex(e=>e.hostGuest===`应`),n=[`本卦${this.info.id}`,`世爻为${d[e]}`,`应爻为${d[t]}`],r=this.toChanged();if(r){n.push(`${this.yaos.map((e,t)=>e.isDynamic?`${d[t]}`:null).filter(e=>e!==null).join(`、`)}是动爻`),n.push(`变卦为${r.info.id}`);let e=r.info.setupInfo.findIndex(e=>e.hostGuest===`世`);this.yaos[e].isDynamic?n.push(`变卦世爻为${d[e]}`):n.push(`未变出新的世爻`);let t=r.info.setupInfo.findIndex(e=>e.hostGuest===`应`);this.yaos[t].isDynamic?n.push(`变卦应爻为${d[t]}`):n.push(`未变出新的应爻`)}else n.push(`无动爻`);return n.join(`,`)}toAIReadable(){let e=this.info.setupInfo,t=this.toChanged(),n=t?.info.setupInfo,r=[];if(n){let e=this.yaos.map((e,t)=>e.isDynamic?t:null).filter(e=>e!==null);n.forEach((n,i)=>{e.includes(i)&&(n.hostGuest===`世`&&r.push(`新世爻为${t.info.id}的${d[i]}`),n.hostGuest===`应`&&r.push(`新应爻为${t.info.id}的${d[i]}`))})}else r.push(`没有新的世应爻出现,世应不变`);let i=(e,t,n)=>{let r={爻:this.yaos[n].name,六亲:t[n].kin,类型:t[n].hostGuest};return r.类型||delete r.类型,r};return{本卦:{上爻:i(this.yaos,e,5),五爻:i(this.yaos,e,4),四爻:i(this.yaos,e,3),三爻:i(this.yaos,e,2),二爻:i(this.yaos,e,1),初爻:i(this.yaos,e,0),卦名:this.info.id,宫:this.palace,变爻:this.isDynamic?this.yaos.map((e,t)=>e.isDynamic?d[t]:null).filter(e=>e!==null):void 0,六冲六合:this.isSixScattering?`六冲卦`:this.isSixGathering?`六合卦`:`不是`},变卦:n?{上爻:i(t.yaos,n,5),五爻:i(t.yaos,n,4),四爻:i(t.yaos,n,3),三爻:i(t.yaos,n,2),二爻:i(t.yaos,n,1),初爻:i(t.yaos,n,0),卦名:t.info.id,宫:t.palace,六冲六合:t.isSixScattering?`六冲卦`:t.isSixGathering?`六合卦`:`不是`}:`无`,世应变化:r.join(`,`)}}clone(){return new n(this.yaos)}toString(){return this.info.id}[Symbol.toPrimitive](){return this.info.id}};export{f as Hexagram,t as HexagramInfoTable,d as HexagramYaoOrder,e as PalaceIndexTable,r as SixGodTable,n as TrigramInfoTable,u as Yao};
|
|
1
|
+
const e=[`本宫卦`,`一世卦`,`二世卦`,`三世卦`,`四世卦`,`五世卦`,`游魂卦`,`归魂卦`],t=[{binary:`000000`,id:`坤为地`,sign:`䷁`,phase:`土`,palace:`坤`,generation:0,yangs:[2,2,2,2,2,2],name:`地`},{binary:`100000`,id:`地雷复`,sign:`䷗`,phase:`土`,palace:`坤`,generation:1,yangs:[1,2,2,2,2,2],name:`复`},{binary:`010000`,id:`地水师`,sign:`䷆`,phase:`水`,palace:`坎`,generation:7,yangs:[2,1,2,2,2,2],name:`师`},{binary:`110000`,id:`地泽临`,sign:`䷒`,phase:`土`,palace:`坤`,generation:2,yangs:[1,1,2,2,2,2],name:`临`},{binary:`001000`,id:`地山谦`,sign:`䷎`,phase:`土`,palace:`兑`,generation:5,yangs:[2,2,1,2,2,2],name:`谦`},{binary:`101000`,id:`地火明夷`,sign:`䷣`,phase:`水`,palace:`坎`,generation:6,yangs:[1,2,1,2,2,2],name:`明夷`},{binary:`011000`,id:`地风升`,sign:`䷭`,phase:`木`,palace:`震`,generation:4,yangs:[2,1,1,2,2,2],name:`升`},{binary:`111000`,id:`地天泰`,sign:`䷊`,phase:`土`,palace:`坤`,generation:3,yangs:[1,1,1,2,2,2],name:`泰`},{binary:`000100`,id:`雷地豫`,sign:`䷏`,phase:`木`,palace:`震`,generation:1,yangs:[2,2,2,1,2,2],name:`豫`},{binary:`100100`,id:`震为雷`,sign:`䷲`,phase:`木`,palace:`震`,generation:0,yangs:[1,2,2,1,2,2],name:`雷`},{binary:`010100`,id:`雷水解`,sign:`䷧`,phase:`木`,palace:`震`,generation:2,yangs:[2,1,2,1,2,2],name:`解`},{binary:`110100`,id:`雷泽归妹`,sign:`䷵`,phase:`金`,palace:`兑`,generation:7,yangs:[1,1,2,1,2,2],name:`归妹`},{binary:`001100`,id:`雷山小过`,sign:`䷽`,phase:`金`,palace:`兑`,generation:6,yangs:[2,2,1,1,2,2],name:`小过`},{binary:`101100`,id:`雷火丰`,sign:`䷶`,phase:`水`,palace:`坎`,generation:5,yangs:[1,2,1,1,2,2],name:`丰`},{binary:`011100`,id:`雷风恒`,sign:`䷟`,phase:`木`,palace:`震`,generation:3,yangs:[2,1,1,1,2,2],name:`恒`},{binary:`111100`,id:`雷天大壮`,sign:`䷡`,phase:`土`,palace:`坤`,generation:4,yangs:[1,1,1,1,2,2],name:`大壮`},{binary:`000010`,id:`水地比`,sign:`䷇`,phase:`土`,palace:`坤`,generation:7,yangs:[2,2,2,2,1,2],name:`比`},{binary:`100010`,id:`水雷屯`,sign:`䷂`,phase:`水`,palace:`坎`,generation:2,yangs:[1,2,2,2,1,2],name:`屯`},{binary:`010010`,id:`坎为水`,sign:`䷜`,phase:`水`,palace:`坎`,generation:0,yangs:[2,1,2,2,1,2],name:`水`},{binary:`110010`,id:`水泽节`,sign:`䷻`,phase:`水`,palace:`坎`,generation:1,yangs:[1,1,2,2,1,2],name:`节`},{binary:`001010`,id:`水山蹇`,sign:`䷦`,phase:`金`,palace:`兑`,generation:4,yangs:[2,2,1,2,1,2],name:`蹇`},{binary:`101010`,id:`水火既济`,sign:`䷾`,phase:`水`,palace:`坎`,generation:3,yangs:[1,2,1,2,1,2],name:`既济`},{binary:`011010`,id:`水风井`,sign:`䷯`,phase:`木`,palace:`震`,generation:5,yangs:[2,1,1,2,1,2],name:`井`},{binary:`111010`,id:`水天需`,sign:`䷄`,phase:`土`,palace:`坤`,generation:6,yangs:[1,1,1,2,1,2],name:`需`},{binary:`000110`,id:`泽地萃`,sign:`䷬`,phase:`金`,palace:`兑`,generation:2,yangs:[2,2,2,1,1,2],name:`萃`},{binary:`100110`,id:`泽雷随`,sign:`䷐`,phase:`木`,palace:`震`,generation:7,yangs:[1,2,2,1,1,2],name:`随`},{binary:`010110`,id:`泽水困`,sign:`䷮`,phase:`金`,palace:`兑`,generation:1,yangs:[2,1,2,1,1,2],name:`困`},{binary:`110110`,id:`兑为泽`,sign:`䷹`,phase:`金`,palace:`兑`,generation:0,yangs:[1,1,2,1,1,2],name:`泽`},{binary:`001110`,id:`泽山咸`,sign:`䷞`,phase:`金`,palace:`兑`,generation:3,yangs:[2,2,1,1,1,2],name:`咸`},{binary:`101110`,id:`泽火革`,sign:`䷰`,phase:`水`,palace:`坎`,generation:4,yangs:[1,2,1,1,1,2],name:`革`},{binary:`011110`,id:`泽风大过`,sign:`䷛`,phase:`木`,palace:`震`,generation:6,yangs:[2,1,1,1,1,2],name:`大过`},{binary:`111110`,id:`泽天夬`,sign:`䷪`,phase:`土`,palace:`坤`,generation:5,yangs:[1,1,1,1,1,2],name:`夬`},{binary:`000001`,id:`山地剥`,sign:`䷖`,phase:`金`,palace:`乾`,generation:5,yangs:[2,2,2,2,2,1],name:`剥`},{binary:`100001`,id:`山雷颐`,sign:`䷚`,phase:`木`,palace:`巽`,generation:6,yangs:[1,2,2,2,2,1],name:`颐`},{binary:`010001`,id:`山水蒙`,sign:`䷃`,phase:`火`,palace:`离`,generation:4,yangs:[2,1,2,2,2,1],name:`蒙`},{binary:`110001`,id:`山泽损`,sign:`䷨`,phase:`土`,palace:`艮`,generation:3,yangs:[1,1,2,2,2,1],name:`损`},{binary:`001001`,id:`艮为山`,sign:`䷳`,phase:`土`,palace:`艮`,generation:0,yangs:[2,2,1,2,2,1],name:`山`},{binary:`101001`,id:`山火贲`,sign:`䷕`,phase:`土`,palace:`艮`,generation:1,yangs:[1,2,1,2,2,1],name:`贲`},{binary:`011001`,id:`山风蛊`,sign:`䷑`,phase:`木`,palace:`巽`,generation:7,yangs:[2,1,1,2,2,1],name:`蛊`},{binary:`111001`,id:`山天大畜`,sign:`䷙`,phase:`土`,palace:`艮`,generation:2,yangs:[1,1,1,2,2,1],name:`大畜`},{binary:`000101`,id:`火地晋`,sign:`䷢`,phase:`金`,palace:`乾`,generation:6,yangs:[2,2,2,1,2,1],name:`晋`},{binary:`100101`,id:`火雷噬嗑`,sign:`䷔`,phase:`木`,palace:`巽`,generation:5,yangs:[1,2,2,1,2,1],name:`噬嗑`},{binary:`010101`,id:`火水未济`,sign:`䷿`,phase:`火`,palace:`离`,generation:3,yangs:[2,1,2,1,2,1],name:`未济`},{binary:`110101`,id:`火泽睽`,sign:`䷥`,phase:`土`,palace:`艮`,generation:4,yangs:[1,1,2,1,2,1],name:`睽`},{binary:`001101`,id:`火山旅`,sign:`䷷`,phase:`火`,palace:`离`,generation:1,yangs:[2,2,1,1,2,1],name:`旅`},{binary:`101101`,id:`离为火`,sign:`䷝`,phase:`火`,palace:`离`,generation:0,yangs:[1,2,1,1,2,1],name:`火`},{binary:`011101`,id:`火风鼎`,sign:`䷱`,phase:`火`,palace:`离`,generation:2,yangs:[2,1,1,1,2,1],name:`鼎`},{binary:`111101`,id:`火天大有`,sign:`䷍`,phase:`金`,palace:`乾`,generation:7,yangs:[1,1,1,1,2,1],name:`大有`},{binary:`000011`,id:`风地观`,sign:`䷓`,phase:`金`,palace:`乾`,generation:4,yangs:[2,2,2,2,1,1],name:`观`},{binary:`100011`,id:`风雷益`,sign:`䷩`,phase:`木`,palace:`巽`,generation:3,yangs:[1,2,2,2,1,1],name:`益`},{binary:`010011`,id:`风水涣`,sign:`䷺`,phase:`火`,palace:`离`,generation:5,yangs:[2,1,2,2,1,1],name:`涣`},{binary:`110011`,id:`风泽中孚`,sign:`䷼`,phase:`土`,palace:`艮`,generation:6,yangs:[1,1,2,2,1,1],name:`中孚`},{binary:`001011`,id:`风山渐`,sign:`䷴`,phase:`土`,palace:`艮`,generation:7,yangs:[2,2,1,2,1,1],name:`渐`},{binary:`101011`,id:`风火家人`,sign:`䷤`,phase:`木`,palace:`巽`,generation:2,yangs:[1,2,1,2,1,1],name:`家人`},{binary:`011011`,id:`巽为风`,sign:`䷸`,phase:`木`,palace:`巽`,generation:0,yangs:[2,1,1,2,1,1],name:`风`},{binary:`111011`,id:`风天小畜`,sign:`䷈`,phase:`木`,palace:`巽`,generation:1,yangs:[1,1,1,2,1,1],name:`小畜`},{binary:`000111`,id:`天地否`,sign:`䷋`,phase:`金`,palace:`乾`,generation:3,yangs:[2,2,2,1,1,1],name:`否`},{binary:`100111`,id:`天雷无妄`,sign:`䷘`,phase:`木`,palace:`巽`,generation:4,yangs:[1,2,2,1,1,1],name:`无妄`},{binary:`010111`,id:`天水讼`,sign:`䷅`,phase:`火`,palace:`离`,generation:6,yangs:[2,1,2,1,1,1],name:`讼`},{binary:`110111`,id:`天泽履`,sign:`䷉`,phase:`土`,palace:`艮`,generation:5,yangs:[1,1,2,1,1,1],name:`履`},{binary:`001111`,id:`天山遁`,sign:`䷠`,phase:`金`,palace:`乾`,generation:2,yangs:[2,2,1,1,1,1],name:`遁`},{binary:`101111`,id:`天火同人`,sign:`䷌`,phase:`火`,palace:`离`,generation:7,yangs:[1,2,1,1,1,1],name:`同人`},{binary:`011111`,id:`天风姤`,sign:`䷫`,phase:`金`,palace:`乾`,generation:1,yangs:[2,1,1,1,1,1],name:`姤`},{binary:`111111`,id:`乾为天`,sign:`䷀`,phase:`金`,palace:`乾`,generation:0,yangs:[1,1,1,1,1,1],name:`天`}],n=[{id:`坤`,binary:`000`,yangs:0,image:`地`,sign:`☷`,inner:[`未土`,`巳火`,`卯木`],outer:[`丑土`,`亥水`,`酉金`]},{id:`震`,binary:`100`,yangs:1,image:`雷`,sign:`☳`,inner:[`子水`,`寅木`,`辰土`],outer:[`午火`,`申金`,`戌土`]},{id:`坎`,binary:`010`,yangs:1,image:`水`,sign:`☵`,inner:[`寅木`,`辰土`,`午火`],outer:[`申金`,`戌土`,`子水`]},{id:`兑`,binary:`110`,yangs:2,image:`泽`,sign:`☱`,inner:[`巳火`,`卯木`,`丑土`],outer:[`亥水`,`酉金`,`未土`]},{id:`艮`,binary:`001`,yangs:1,image:`山`,sign:`☶`,inner:[`辰土`,`午火`,`申金`],outer:[`戌土`,`子水`,`寅木`]},{id:`离`,binary:`101`,yangs:2,image:`火`,sign:`☲`,inner:[`卯木`,`丑土`,`亥水`],outer:[`酉金`,`未土`,`巳火`]},{id:`巽`,binary:`011`,yangs:2,image:`风`,sign:`☴`,inner:[`丑土`,`亥水`,`酉金`],outer:[`未土`,`巳火`,`卯木`]},{id:`乾`,binary:`111`,yangs:3,image:`天`,sign:`☰`,inner:[`子水`,`寅木`,`辰土`],outer:[`午火`,`申金`,`戌土`]}];Object.freeze(e),Object.freeze(t),Object.freeze(n);const r=[{heavenlyStem:`甲`,gods:[`青龙`,`朱雀`,`勾陈`,`螣蛇`,`白虎`,`玄武`]},{heavenlyStem:`乙`,gods:[`青龙`,`朱雀`,`勾陈`,`螣蛇`,`白虎`,`玄武`]},{heavenlyStem:`丙`,gods:[`朱雀`,`勾陈`,`螣蛇`,`白虎`,`玄武`,`青龙`]},{heavenlyStem:`丁`,gods:[`朱雀`,`勾陈`,`螣蛇`,`白虎`,`玄武`,`青龙`]},{heavenlyStem:`戊`,gods:[`勾陈`,`螣蛇`,`白虎`,`玄武`,`青龙`,`朱雀`]},{heavenlyStem:`己`,gods:[`螣蛇`,`白虎`,`玄武`,`青龙`,`朱雀`,`勾陈`]},{heavenlyStem:`庚`,gods:[`白虎`,`玄武`,`青龙`,`朱雀`,`勾陈`,`螣蛇`]},{heavenlyStem:`辛`,gods:[`白虎`,`玄武`,`青龙`,`朱雀`,`勾陈`,`螣蛇`]},{heavenlyStem:`壬`,gods:[`玄武`,`青龙`,`朱雀`,`勾陈`,`螣蛇`,`白虎`]},{heavenlyStem:`癸`,gods:[`玄武`,`青龙`,`朱雀`,`勾陈`,`螣蛇`,`白虎`]}];Object.freeze(r);const i={乾:{inner:`甲`,outer:`壬`},坤:{inner:`乙`,outer:`癸`},兑:{inner:`丁`,outer:`丁`},坎:{inner:`戊`,outer:`戊`},艮:{inner:`丙`,outer:`丙`},离:{inner:`己`,outer:`己`},震:{inner:`庚`,outer:`庚`},巽:{inner:`辛`,outer:`辛`}};function a(e){let t=i[e.inner.id].inner,n=i[e.outer.id].outer;return[t,t,t,n,n,n]}const o=[5,0,1,2,3,4,3,2],s=[2,3,4,5,0,1,0,5];function c(e){return{host:o[e.generation],guest:s[e.generation]}}function l(e,t,n,r,i,a,o,s,c,l,u){if(e.includes(t))return n;if(e.includes(r))return i;if(e.includes(a))return o;if(e.includes(s))return c;if(e.includes(l))return u;throw Error(`No BranchPhase[${e}] matches phase[${t},${r},${a},${s},${l}]`)}const u={乾:e=>l(e,`金`,`兄弟`,`土`,`父母`,`木`,`妻财`,`火`,`官鬼`,`水`,`子孙`),兑:e=>l(e,`金`,`兄弟`,`土`,`父母`,`木`,`妻财`,`火`,`官鬼`,`水`,`子孙`),坎:e=>l(e,`木`,`子孙`,`水`,`兄弟`,`金`,`父母`,`火`,`妻财`,`土`,`官鬼`),坤:e=>l(e,`土`,`兄弟`,`火`,`父母`,`木`,`官鬼`,`水`,`妻财`,`金`,`子孙`),艮:e=>l(e,`土`,`兄弟`,`火`,`父母`,`木`,`官鬼`,`水`,`妻财`,`金`,`子孙`),离:e=>l(e,`木`,`父母`,`土`,`子孙`,`水`,`官鬼`,`金`,`妻财`,`火`,`兄弟`),震:e=>l(e,`木`,`兄弟`,`水`,`父母`,`金`,`官鬼`,`火`,`子孙`,`土`,`妻财`),巽:e=>l(e,`木`,`兄弟`,`水`,`父母`,`金`,`官鬼`,`火`,`子孙`,`土`,`妻财`)};function d(e){let t=u[e.primary?e.primary.palace:e.palace];return[...e.inner.inner.map(t),...e.outer.outer.map(t)]}const f=[`老阴`,`少阳`,`少阴`,`老阳`],p=`交单拆重`,m=`×’”○`,h=[1,1,2,2],g=[0,1,0,1];var _=class e{static getName(e){return f[e]}static fromSymbol(t){let n=m.indexOf(t);return n===-1?null:new e(n)}static fromSymbolName(t){let n=p.indexOf(t);return n===-1?null:new e(n)}static fromName(t){let n=f.indexOf(t);return n===-1?null:new e(n)}static fromDigitString(t){let n=`0123`.indexOf(t);return n===-1?null:new e(n)}static fromTrigramField(t){let r=n.find(e=>e.id===t||e.yangs===t||e.binary===t||e.sign===t);return r?new e(r.yangs):null}yangs;polar;dynamic;changed;pattern;name;symbol;constructor(e,t=!1){if(e!==0&&e!==1&&e!==2&&e!==3)throw Error(`Count of yang must be 0, 1, 2 or 3`);if(this.yangs=e,this.changed=t,this.polar=g[e],this.dynamic=e===0||e===3,this.pattern=m[e],this.name=f[e],this.symbol=p[e],this.dynamic&&this.changed)throw Error(`Changed Yao should not be dynamic.`)}eq(e){return this.yangs===e.yangs}eqeqeq(e){return this.yangs===e.yangs&&this.changed===e.changed}clone(){return new e(this.yangs,this.changed)}toChanged(){return new e(h[this.yangs],this.dynamic)}};const v=[`初爻`,`二爻`,`三爻`,`四爻`,`五爻`,`上爻`],y=[`乾`,`坤`,`震`,`巽`,`坎`,`离`,`艮`,`兑`,`无妄`,`大壮`],b=[`否`,`泰`,`复`,`豫`,`贲`,`旅`,`困`,`节`],x=[`乾`,`坤`,`震`,`巽`,`坎`,`离`,`艮`,`兑`];var S=class r{static fromQuaternary(e){let t=e.split(``).map(_.fromDigitString);return t.every(e=>e!==null)?new r(t):null}static fromSymbolName(e){let t=e.split(``).map(_.fromSymbolName);return t.every(e=>e!==null)?new r(t):null}static fromYangCounts(e){try{return new r(e.map(e=>new _(e)))}catch{return null}}static fromId(e){let n=t.find(t=>t.id===e||t.id.slice(2)===e||t.id.startsWith(e)&&e.length>1);return n?r.fromYangCounts(n.yangs):null}static fromPalace(e){let n=t.find(t=>t.id[2]===e);return n?r.fromYangCounts(n.yangs):null}yaos;yangs;binary;id;name;sign;palace;phase;generation;palaceInfo;dynamic;changed;inner;outer;specialType;pure;kins;host;guest;primary;constructor(r,i=null){if(r.length!==6)throw Error(`Array length mismatch, A Hexagram must be constructed with exactly 6 Yaos or 6 counts of yang`);if(r.some(e=>!(e instanceof _)))throw Error(`Invalid Arguments, Hexagram must be constructed with exactly 6 Yaos or 6 counts of yang`);this.yaos=r.map(e=>e.clone()),this.binary=this.yaos.map(e=>e.polar).join(``);let o=t.find(e=>e.binary===this.binary);this.palace=o.palace,this.id=o.id,this.generation=o.generation,this.yangs=this.yaos.map(e=>e.yangs),this.phase=o.phase,this.name=o.name,this.sign=o.sign,this.palaceInfo=`${o.palace}宫(${o.phase})${e[o.generation]}`,this.dynamic=this.yaos.some(e=>e.dynamic||e.changed),this.changed=!!i,this.primary=i;let s=this.binary.slice(0,3),l=this.binary.slice(3);this.inner=n.find(e=>e.binary===s),this.outer=n.find(e=>e.binary===l);let u=d(this),f=a(this);this.kins=[...this.inner.inner.map((e,t)=>u[t]+f[t]+e),...this.outer.outer.map((e,t)=>u[t+3]+f[t+3]+e)];let p=c(this);this.host=p.host,this.guest=p.guest,y.includes(o.name)&&(this.specialType=`六冲`),b.includes(o.name)&&(this.specialType=`六合`),this.pure=x.includes(o.name)}toChanged(){if(!this.dynamic)return null;if(this.changed)throw Error(`The gram is already changed, cannot change again.`);return new r(this.yaos.map(e=>e.toChanged()),this)}clone(){return new r(this.yaos,this.primary)}toString(){return this.id}[Symbol.toPrimitive](){return this.id}};export{S as Hexagram,t as HexagramInfoTable,v as HexagramYaoOrder,e as PalaceOrderTable,r as SixGodTable,n as TrigramInfoTable,_ as Yao};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|