@treeviz/gedcom-parser 2.1.7 → 2.1.9

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/dist/cli/index.js CHANGED
@@ -1769,7 +1769,9 @@ __export(translators_exports, {
1769
1769
  es: () => KinshipTranslatorEs,
1770
1770
  fr: () => KinshipTranslatorFr,
1771
1771
  hu: () => KinshipTranslatorHU,
1772
- ru: () => KinshipTranslatorRu
1772
+ ja: () => KinshipTranslatorJa,
1773
+ ru: () => KinshipTranslatorRu,
1774
+ zh: () => KinshipTranslatorZh
1773
1775
  });
1774
1776
 
1775
1777
  // src/constants/filters.ts
@@ -4322,14 +4324,29 @@ var Indi = class extends Common {
4322
4324
  getAkas(limit) {
4323
4325
  return this.getFacts(limit, "AKA");
4324
4326
  }
4327
+ /**
4328
+ * Collect event/attribute facts.
4329
+ * @param limit Max records per tag
4330
+ * @param filter Whitelist tags, or `{ include?, exclude? }`.
4331
+ * - string/array: include only these tags (and custom EVEN/FACT TYPE values)
4332
+ * - `{ exclude: ["BIRT","DEAT"] }`: all facts except those tags
4333
+ */
4325
4334
  getFacts(limit, filter) {
4326
- const filters = (Array.isArray(filter) ? filter : [filter]).filter(
4327
- Boolean
4335
+ const asList = (value) => (Array.isArray(value) ? value : [value]).filter(Boolean);
4336
+ const isFilterObject = !!filter && typeof filter === "object" && !Array.isArray(filter) && ("include" in filter || "exclude" in filter);
4337
+ const filters = asList(
4338
+ isFilterObject ? filter.include : filter
4339
+ );
4340
+ const excludes = asList(
4341
+ isFilterObject ? filter.exclude : void 0
4328
4342
  );
4329
4343
  const facts = new List();
4330
4344
  let id = 0;
4331
4345
  ALLOWED_FACTS.forEach((fact) => {
4332
4346
  const isCustom = ["EVEN", "FACT"].includes(fact);
4347
+ if (excludes.length && excludes.includes(fact) && !isCustom) {
4348
+ return;
4349
+ }
4333
4350
  if (filters.length && !filters.includes(fact) && !isCustom) {
4334
4351
  return;
4335
4352
  }
@@ -4352,6 +4369,9 @@ var Indi = class extends Common {
4352
4369
  if (!type || DISALLOWED_CUSTOM_FACTS.includes(type)) {
4353
4370
  return;
4354
4371
  }
4372
+ if (excludes.length && excludes.includes(type)) {
4373
+ return;
4374
+ }
4355
4375
  if (filters.length && !filters.includes(type) && isCustom) {
4356
4376
  return;
4357
4377
  }
@@ -7001,6 +7021,445 @@ var KinshipTranslatorRu = class extends KinshipTranslatorBasic {
7001
7021
  }
7002
7022
  };
7003
7023
 
7024
+ // src/kinship-translator/patterns.ja.ts
7025
+ var InLawsJa = {
7026
+ "(\u5B50|\u5A18|\u606F\u5B50)\u306E\u914D\u5076\u8005": "\u7FA9\u7406\u306E\u5B50",
7027
+ "(\u5B50|\u5A18|\u606F\u5B50)\u306E\u59BB": "\u5AC1",
7028
+ "(\u5B50|\u5A18|\u606F\u5B50)\u306E\u592B": "\u5A7F",
7029
+ "(\u914D\u5076\u8005|\u59BB|\u592B)\u306E\u6BCD": "\u7FA9\u6BCD",
7030
+ "(\u914D\u5076\u8005|\u59BB|\u592B)\u306E\u7236": "\u7FA9\u7236",
7031
+ "(\u914D\u5076\u8005|\u59BB|\u592B)\u306E\u89AA": "\u7FA9\u7406\u306E\u89AA",
7032
+ "(\u7570\u7236\u6BCD\u306E)?(\u5144\u5F1F|\u59C9\u59B9|\u5144\u5F1F\u59C9\u59B9)\u306E\u59BB": "\u7FA9\u7406\u306E\u59C9\u59B9",
7033
+ "(\u7570\u7236\u6BCD\u306E)?(\u5144\u5F1F|\u59C9\u59B9|\u5144\u5F1F\u59C9\u59B9)\u306E\u592B": "\u7FA9\u7406\u306E\u5144\u5F1F",
7034
+ "(\u7570\u7236\u6BCD\u306E)?(\u5144\u5F1F|\u59C9\u59B9|\u5144\u5F1F\u59C9\u59B9)\u306E\u914D\u5076\u8005": "\u7FA9\u7406\u306E\u5144\u5F1F\u59C9\u59B9",
7035
+ "(\u7570\u7236\u6BCD\u306E)?\u59C9\u59B9\u306E(\u914D\u5076\u8005|\u59BB|\u592B)": "\u7FA9\u7406\u306E\u59C9\u59B9",
7036
+ "(\u7570\u7236\u6BCD\u306E)?\u5144\u5F1F\u306E(\u914D\u5076\u8005|\u59BB|\u592B)": "\u7FA9\u7406\u306E\u5144\u5F1F",
7037
+ "(\u7570\u7236\u6BCD\u306E)?\u5144\u5F1F\u59C9\u59B9\u306E(\u914D\u5076\u8005|\u59BB|\u592B)": "\u7FA9\u7406\u306E\u5144\u5F1F\u59C9\u59B9",
7038
+ "(\u7570\u7236\u6BCD\u306E)?(\u914D\u5076\u8005|\u59BB|\u592B)\u306E\u59C9\u59B9": "\u7FA9\u7406\u306E\u59C9\u59B9",
7039
+ "(\u7570\u7236\u6BCD\u306E)?(\u914D\u5076\u8005|\u59BB|\u592B)\u306E\u5144\u5F1F": "\u7FA9\u7406\u306E\u5144\u5F1F",
7040
+ "(\u7570\u7236\u6BCD\u306E)?(\u914D\u5076\u8005|\u59BB|\u592B)\u306E\u5144\u5F1F\u59C9\u59B9": "\u7FA9\u7406\u306E\u5144\u5F1F\u59C9\u59B9"
7041
+ };
7042
+
7043
+ // src/kinship-translator/kinship-translator.ja.ts
7044
+ var sexOf2 = (person) => {
7045
+ if (person?.isMale?.()) {
7046
+ return "m";
7047
+ }
7048
+ if (person?.isFemale?.()) {
7049
+ return "f";
7050
+ }
7051
+ return "n";
7052
+ };
7053
+ var pick = (sex, male, female, neutral) => {
7054
+ if (sex === "m") {
7055
+ return male;
7056
+ }
7057
+ if (sex === "f") {
7058
+ return female;
7059
+ }
7060
+ return neutral;
7061
+ };
7062
+ var lineal = (level, sex, kind) => {
7063
+ const L = Math.max(1, level);
7064
+ if (kind === "asc") {
7065
+ if (L <= 1) {
7066
+ return pick(sex, "\u7236", "\u6BCD", "\u89AA");
7067
+ }
7068
+ if (L === 2) {
7069
+ return pick(sex, "\u7956\u7236", "\u7956\u6BCD", "\u7956\u7236\u6BCD");
7070
+ }
7071
+ if (L === 3) {
7072
+ return pick(sex, "\u66FE\u7956\u7236", "\u66FE\u7956\u6BCD", "\u66FE\u7956\u7236\u6BCD");
7073
+ }
7074
+ if (L === 4) {
7075
+ return pick(sex, "\u9AD8\u7956\u7236", "\u9AD8\u7956\u6BCD", "\u9AD8\u7956\u7236\u6BCD");
7076
+ }
7077
+ return pick(
7078
+ sex,
7079
+ `${L - 1}\u4E16\u306E\u7956\u7236`,
7080
+ `${L - 1}\u4E16\u306E\u7956\u6BCD`,
7081
+ `${L - 1}\u4E16\u306E\u7956\u7236\u6BCD`
7082
+ );
7083
+ }
7084
+ if (L <= 1) {
7085
+ return pick(sex, "\u606F\u5B50", "\u5A18", "\u5B50");
7086
+ }
7087
+ if (L === 2) {
7088
+ return "\u5B6B";
7089
+ }
7090
+ if (L === 3) {
7091
+ return "\u66FE\u5B6B";
7092
+ }
7093
+ if (L === 4) {
7094
+ return "\u7384\u5B6B";
7095
+ }
7096
+ return `${L - 1}\u4E16\u306E\u5B6B`;
7097
+ };
7098
+ var cousinPlain = (degree) => {
7099
+ if (degree <= 1) {
7100
+ return "\u3044\u3068\u3053";
7101
+ }
7102
+ if (degree === 2) {
7103
+ return "\u307E\u305F\u3044\u3068\u3053";
7104
+ }
7105
+ if (degree === 3) {
7106
+ return "\u306F\u3068\u3053";
7107
+ }
7108
+ return `${degree}\u89AA\u7B49\u306E\u3044\u3068\u3053`;
7109
+ };
7110
+ var KinshipTranslatorJa = class extends KinshipTranslatorBasic {
7111
+ indirect() {
7112
+ let degree = Math.abs(this.pathN?.degree ?? 0);
7113
+ if (degree > 0) {
7114
+ degree = degree - 1;
7115
+ }
7116
+ return cousinPlain(degree);
7117
+ }
7118
+ removal() {
7119
+ const level = this.pathN?.level ?? 0;
7120
+ let degree = Math.abs(this.pathN?.degree ?? 0);
7121
+ if (degree > 0) {
7122
+ degree = degree - 1;
7123
+ }
7124
+ if (!degree) {
7125
+ return level < 0 ? this.nibling() : this.auncle();
7126
+ }
7127
+ const removed = Math.abs(level);
7128
+ return `${cousinPlain(degree)}\uFF08${removed}\u4E16\u4EE3\u9055\u3044\uFF09`;
7129
+ }
7130
+ auncle() {
7131
+ const level = Math.abs(this.pathN?.level ?? 0);
7132
+ const sex = sexOf2(this.personN);
7133
+ if (level <= 2) {
7134
+ return pick(sex, "\u304A\u3058", "\u304A\u3070", "\u304A\u3058/\u304A\u3070");
7135
+ }
7136
+ if (level === 3) {
7137
+ return pick(sex, "\u5927\u304A\u3058", "\u5927\u304A\u3070", "\u5927\u304A\u3058/\u5927\u304A\u3070");
7138
+ }
7139
+ return pick(
7140
+ sex,
7141
+ `${level - 2}\u4EE3\u524D\u306E\u304A\u3058`,
7142
+ `${level - 2}\u4EE3\u524D\u306E\u304A\u3070`,
7143
+ `${level - 2}\u4EE3\u524D\u306E\u304A\u3058/\u304A\u3070`
7144
+ );
7145
+ }
7146
+ nibling() {
7147
+ const level = Math.abs(this.pathN?.level ?? 0);
7148
+ const sex = sexOf2(this.personN);
7149
+ if (level <= 2) {
7150
+ return pick(sex, "\u7525", "\u59EA", "\u7525/\u59EA");
7151
+ }
7152
+ if (level === 3) {
7153
+ return pick(sex, "\u5927\u7525", "\u5927\u59EA", "\u5927\u7525/\u5927\u59EA");
7154
+ }
7155
+ return pick(
7156
+ sex,
7157
+ `${level - 2}\u4EE3\u4E0B\u306E\u7525`,
7158
+ `${level - 2}\u4EE3\u4E0B\u306E\u59EA`,
7159
+ `${level - 2}\u4EE3\u4E0B\u306E\u7525/\u59EA`
7160
+ );
7161
+ }
7162
+ parent() {
7163
+ return lineal(
7164
+ Math.abs(this.pathN?.level ?? 0),
7165
+ sexOf2(this.personN),
7166
+ "asc"
7167
+ );
7168
+ }
7169
+ child() {
7170
+ return lineal(
7171
+ Math.abs(this.pathN?.level ?? 0),
7172
+ sexOf2(this.personN),
7173
+ "desc"
7174
+ );
7175
+ }
7176
+ sibling() {
7177
+ return pick(sexOf2(this.personN), "\u5144\u5F1F", "\u59C9\u59B9", "\u5144\u5F1F\u59C9\u59B9");
7178
+ }
7179
+ halfBlood(relation) {
7180
+ if (!relation || !this.isHalfBlood) {
7181
+ return relation ?? "";
7182
+ }
7183
+ return `\u7570\u7236\u6BCD\u306E${relation}`;
7184
+ }
7185
+ spouse() {
7186
+ return pick(sexOf2(this.personN), "\u592B", "\u59BB", "\u914D\u5076\u8005");
7187
+ }
7188
+ ofSpouse(relation) {
7189
+ if (!relation) {
7190
+ return "";
7191
+ }
7192
+ const spouseType = pick(
7193
+ sexOf2(this.path?.[1].indi),
7194
+ "\u592B",
7195
+ "\u59BB",
7196
+ "\u914D\u5076\u8005"
7197
+ );
7198
+ return `${spouseType}\u306E${relation}`;
7199
+ }
7200
+ spouseOf(relation) {
7201
+ if (!relation) {
7202
+ return "";
7203
+ }
7204
+ const spouse = this.path?.[this.path.length - 1].indi;
7205
+ const spouseType = pick(sexOf2(spouse), "\u592B", "\u59BB", "\u914D\u5076\u8005");
7206
+ return `${relation}\u306E${spouseType}`;
7207
+ }
7208
+ of(relation) {
7209
+ const formattedName = nameFormatter(this.path?.[0]?.indi, {
7210
+ nameOrder: "last-first"
7211
+ });
7212
+ let name = formattedName.inOrder.filter(Boolean).join(" ");
7213
+ if (this.displayName === "none") {
7214
+ name = "";
7215
+ } else if (this.displayName === "givenname") {
7216
+ name = formattedName.givenname;
7217
+ } else if (this.displayName === "surname") {
7218
+ name = `${formattedName.surname}`;
7219
+ }
7220
+ if (!name || !relation) {
7221
+ return relation ?? "";
7222
+ }
7223
+ return `${name}\u306E${relation}`;
7224
+ }
7225
+ inLaw(relation) {
7226
+ let inLawRelation = relation;
7227
+ Object.keys(InLawsJa).find((pattern) => {
7228
+ const regex = new RegExp(`^${pattern}$`);
7229
+ if (relation?.match(regex)) {
7230
+ inLawRelation = InLawsJa[pattern];
7231
+ return true;
7232
+ }
7233
+ return false;
7234
+ });
7235
+ return inLawRelation ?? "";
7236
+ }
7237
+ relationType(relation) {
7238
+ if (!relation || !this.pathN?.relation) {
7239
+ return relation ?? "";
7240
+ }
7241
+ return `${this.pathN.relation}\u306E${relation}`;
7242
+ }
7243
+ };
7244
+
7245
+ // src/kinship-translator/patterns.zh.ts
7246
+ var InLawsZh = {
7247
+ "(\u5B50\u5973|\u5973\u513F|\u513F\u5B50)\u7684\u914D\u5076": "\u513F\u5AB3/\u5973\u5A7F",
7248
+ "(\u5B50\u5973|\u5973\u513F|\u513F\u5B50)\u7684\u59BB\u5B50": "\u513F\u5AB3",
7249
+ "(\u5B50\u5973|\u5973\u513F|\u513F\u5B50)\u7684\u4E08\u592B": "\u5973\u5A7F",
7250
+ "(\u914D\u5076|\u59BB\u5B50|\u4E08\u592B)\u7684\u6BCD\u4EB2": "\u5CB3\u6BCD/\u5A46\u5A46",
7251
+ "(\u914D\u5076|\u59BB\u5B50|\u4E08\u592B)\u7684\u7236\u4EB2": "\u5CB3\u7236/\u516C\u516C",
7252
+ "(\u914D\u5076|\u59BB\u5B50|\u4E08\u592B)\u7684\u7236\u6BCD": "\u5CB3\u7236\u5CB3\u6BCD/\u516C\u516C\u5A46\u5A46",
7253
+ "(\u5F02\u7236\u6BCD\u7684)?(\u5144\u5F1F\u59D0\u59B9|\u59D0\u59B9|\u5144\u5F1F)\u7684\u59BB\u5B50": "\u5AC2\u5B50/\u5F1F\u59B9",
7254
+ "(\u5F02\u7236\u6BCD\u7684)?(\u5144\u5F1F\u59D0\u59B9|\u59D0\u59B9|\u5144\u5F1F)\u7684\u4E08\u592B": "\u59D0\u592B/\u59B9\u592B",
7255
+ "(\u5F02\u7236\u6BCD\u7684)?(\u5144\u5F1F\u59D0\u59B9|\u59D0\u59B9|\u5144\u5F1F)\u7684\u914D\u5076": "\u59FB\u4EB2\u5144\u5F1F\u59D0\u59B9",
7256
+ "(\u5F02\u7236\u6BCD\u7684)?\u59D0\u59B9\u7684(\u914D\u5076|\u59BB\u5B50|\u4E08\u592B)": "\u59D0\u592B/\u59B9\u592B",
7257
+ "(\u5F02\u7236\u6BCD\u7684)?\u5144\u5F1F\u7684(\u914D\u5076|\u59BB\u5B50|\u4E08\u592B)": "\u5AC2\u5B50/\u5F1F\u59B9",
7258
+ "(\u5F02\u7236\u6BCD\u7684)?\u5144\u5F1F\u59D0\u59B9\u7684(\u914D\u5076|\u59BB\u5B50|\u4E08\u592B)": "\u59FB\u4EB2\u5144\u5F1F\u59D0\u59B9",
7259
+ "(\u5F02\u7236\u6BCD\u7684)?(\u914D\u5076|\u59BB\u5B50|\u4E08\u592B)\u7684\u59D0\u59B9": "\u59D1\u5B50/\u59E8\u5B50",
7260
+ "(\u5F02\u7236\u6BCD\u7684)?(\u914D\u5076|\u59BB\u5B50|\u4E08\u592B)\u7684\u5144\u5F1F": "\u5927\u4F2F/\u5C0F\u53D4/\u5185\u5144/\u5185\u5F1F",
7261
+ "(\u5F02\u7236\u6BCD\u7684)?(\u914D\u5076|\u59BB\u5B50|\u4E08\u592B)\u7684\u5144\u5F1F\u59D0\u59B9": "\u59FB\u4EB2\u5144\u5F1F\u59D0\u59B9"
7262
+ };
7263
+
7264
+ // src/kinship-translator/kinship-translator.zh.ts
7265
+ var sexOf3 = (person) => {
7266
+ if (person?.isMale?.()) {
7267
+ return "m";
7268
+ }
7269
+ if (person?.isFemale?.()) {
7270
+ return "f";
7271
+ }
7272
+ return "n";
7273
+ };
7274
+ var pick2 = (sex, male, female, neutral) => {
7275
+ if (sex === "m") {
7276
+ return male;
7277
+ }
7278
+ if (sex === "f") {
7279
+ return female;
7280
+ }
7281
+ return neutral;
7282
+ };
7283
+ var lineal2 = (level, sex, kind) => {
7284
+ const L = Math.max(1, level);
7285
+ if (kind === "asc") {
7286
+ if (L <= 1) {
7287
+ return pick2(sex, "\u7236\u4EB2", "\u6BCD\u4EB2", "\u7236\u6BCD");
7288
+ }
7289
+ if (L === 2) {
7290
+ return pick2(sex, "\u7956\u7236", "\u7956\u6BCD", "\u7956\u7236\u6BCD");
7291
+ }
7292
+ if (L === 3) {
7293
+ return pick2(sex, "\u66FE\u7956\u7236", "\u66FE\u7956\u6BCD", "\u66FE\u7956\u7236\u6BCD");
7294
+ }
7295
+ if (L === 4) {
7296
+ return pick2(sex, "\u9AD8\u7956\u7236", "\u9AD8\u7956\u6BCD", "\u9AD8\u7956\u7236\u6BCD");
7297
+ }
7298
+ return pick2(sex, `${L}\u4E16\u7956`, `${L}\u4E16\u7956\u6BCD`, `${L}\u4E16\u7956\u7236\u6BCD`);
7299
+ }
7300
+ if (L <= 1) {
7301
+ return pick2(sex, "\u513F\u5B50", "\u5973\u513F", "\u5B50\u5973");
7302
+ }
7303
+ if (L === 2) {
7304
+ return pick2(sex, "\u5B59\u5B50", "\u5B59\u5973", "\u5B59\u5B50\u5973");
7305
+ }
7306
+ if (L === 3) {
7307
+ return pick2(sex, "\u66FE\u5B59", "\u66FE\u5B59\u5973", "\u66FE\u5B59\u5B50\u5973");
7308
+ }
7309
+ if (L === 4) {
7310
+ return pick2(sex, "\u7384\u5B59", "\u7384\u5B59\u5973", "\u7384\u5B59\u5B50\u5973");
7311
+ }
7312
+ return pick2(sex, `${L}\u4E16\u5B59`, `${L}\u4E16\u5B59\u5973`, `${L}\u4E16\u5B59\u5B50\u5973`);
7313
+ };
7314
+ var cousinPlain2 = (degree, sex) => {
7315
+ if (degree <= 1) {
7316
+ return pick2(sex, "\u5802\u8868\u5144\u5F1F", "\u5802\u8868\u59D0\u59B9", "\u5802\u8868\u4EB2");
7317
+ }
7318
+ if (degree === 2) {
7319
+ return pick2(sex, "\u4ECE\u5802\u8868\u5144\u5F1F", "\u4ECE\u5802\u8868\u59D0\u59B9", "\u4ECE\u5802\u8868\u4EB2");
7320
+ }
7321
+ return pick2(
7322
+ sex,
7323
+ `${degree}\u4EE3\u5802\u8868\u5144\u5F1F`,
7324
+ `${degree}\u4EE3\u5802\u8868\u59D0\u59B9`,
7325
+ `${degree}\u4EE3\u5802\u8868\u4EB2`
7326
+ );
7327
+ };
7328
+ var KinshipTranslatorZh = class extends KinshipTranslatorBasic {
7329
+ indirect() {
7330
+ let degree = Math.abs(this.pathN?.degree ?? 0);
7331
+ if (degree > 0) {
7332
+ degree = degree - 1;
7333
+ }
7334
+ return cousinPlain2(degree, sexOf3(this.personN));
7335
+ }
7336
+ removal() {
7337
+ const level = this.pathN?.level ?? 0;
7338
+ let degree = Math.abs(this.pathN?.degree ?? 0);
7339
+ if (degree > 0) {
7340
+ degree = degree - 1;
7341
+ }
7342
+ if (!degree) {
7343
+ return level < 0 ? this.nibling() : this.auncle();
7344
+ }
7345
+ const removed = Math.abs(level);
7346
+ return `${cousinPlain2(degree, sexOf3(this.personN))}\uFF08\u9694${removed}\u4EE3\uFF09`;
7347
+ }
7348
+ auncle() {
7349
+ const level = Math.abs(this.pathN?.level ?? 0);
7350
+ const sex = sexOf3(this.personN);
7351
+ if (level <= 2) {
7352
+ return pick2(sex, "\u53D4\u53D4", "\u963F\u59E8", "\u53D4\u4F2F/\u59D1\u59E8");
7353
+ }
7354
+ if (level === 3) {
7355
+ return pick2(sex, "\u4F2F\u53D4\u7956\u7236", "\u59D1\u7956\u6BCD", "\u4F2F\u53D4\u7956\u7236\u6BCD");
7356
+ }
7357
+ return pick2(
7358
+ sex,
7359
+ `${level - 2}\u4EE3\u524D\u7684\u53D4\u53D4`,
7360
+ `${level - 2}\u4EE3\u524D\u7684\u963F\u59E8`,
7361
+ `${level - 2}\u4EE3\u524D\u7684\u53D4\u4F2F/\u59D1\u59E8`
7362
+ );
7363
+ }
7364
+ nibling() {
7365
+ const level = Math.abs(this.pathN?.level ?? 0);
7366
+ const sex = sexOf3(this.personN);
7367
+ if (level <= 2) {
7368
+ return pick2(sex, "\u4F84\u5B50", "\u4F84\u5973", "\u4F84\u5B50\u5973");
7369
+ }
7370
+ if (level === 3) {
7371
+ return pick2(sex, "\u4F84\u5B59", "\u4F84\u5B59\u5973", "\u4F84\u5B59\u5B50\u5973");
7372
+ }
7373
+ return pick2(
7374
+ sex,
7375
+ `${level - 2}\u4EE3\u4E0B\u7684\u4F84\u5B50`,
7376
+ `${level - 2}\u4EE3\u4E0B\u7684\u4F84\u5973`,
7377
+ `${level - 2}\u4EE3\u4E0B\u7684\u4F84\u5B50\u5973`
7378
+ );
7379
+ }
7380
+ parent() {
7381
+ return lineal2(
7382
+ Math.abs(this.pathN?.level ?? 0),
7383
+ sexOf3(this.personN),
7384
+ "asc"
7385
+ );
7386
+ }
7387
+ child() {
7388
+ return lineal2(
7389
+ Math.abs(this.pathN?.level ?? 0),
7390
+ sexOf3(this.personN),
7391
+ "desc"
7392
+ );
7393
+ }
7394
+ sibling() {
7395
+ return pick2(sexOf3(this.personN), "\u5144\u5F1F", "\u59D0\u59B9", "\u5144\u5F1F\u59D0\u59B9");
7396
+ }
7397
+ halfBlood(relation) {
7398
+ if (!relation || !this.isHalfBlood) {
7399
+ return relation ?? "";
7400
+ }
7401
+ return `\u5F02\u7236\u6BCD\u7684${relation}`;
7402
+ }
7403
+ spouse() {
7404
+ return pick2(sexOf3(this.personN), "\u4E08\u592B", "\u59BB\u5B50", "\u914D\u5076");
7405
+ }
7406
+ ofSpouse(relation) {
7407
+ if (!relation) {
7408
+ return "";
7409
+ }
7410
+ const spouseType = pick2(
7411
+ sexOf3(this.path?.[1].indi),
7412
+ "\u4E08\u592B",
7413
+ "\u59BB\u5B50",
7414
+ "\u914D\u5076"
7415
+ );
7416
+ return `${spouseType}\u7684${relation}`;
7417
+ }
7418
+ spouseOf(relation) {
7419
+ if (!relation) {
7420
+ return "";
7421
+ }
7422
+ const spouse = this.path?.[this.path.length - 1].indi;
7423
+ const spouseType = pick2(sexOf3(spouse), "\u4E08\u592B", "\u59BB\u5B50", "\u914D\u5076");
7424
+ return `${relation}\u7684${spouseType}`;
7425
+ }
7426
+ of(relation) {
7427
+ const formattedName = nameFormatter(this.path?.[0]?.indi, {
7428
+ nameOrder: "last-first"
7429
+ });
7430
+ let name = formattedName.inOrder.filter(Boolean).join(" ");
7431
+ if (this.displayName === "none") {
7432
+ name = "";
7433
+ } else if (this.displayName === "givenname") {
7434
+ name = formattedName.givenname;
7435
+ } else if (this.displayName === "surname") {
7436
+ name = `${formattedName.surname}`;
7437
+ }
7438
+ if (!name || !relation) {
7439
+ return relation ?? "";
7440
+ }
7441
+ return `${name}\u7684${relation}`;
7442
+ }
7443
+ inLaw(relation) {
7444
+ let inLawRelation = relation;
7445
+ Object.keys(InLawsZh).find((pattern) => {
7446
+ const regex = new RegExp(`^${pattern}$`);
7447
+ if (relation?.match(regex)) {
7448
+ inLawRelation = InLawsZh[pattern];
7449
+ return true;
7450
+ }
7451
+ return false;
7452
+ });
7453
+ return inLawRelation ?? "";
7454
+ }
7455
+ relationType(relation) {
7456
+ if (!relation || !this.pathN?.relation) {
7457
+ return relation ?? "";
7458
+ }
7459
+ return `${this.pathN.relation}${relation}`;
7460
+ }
7461
+ };
7462
+
7004
7463
  // src/kinship-translator/kinship-translator.ts
7005
7464
  var KinshipTranslator = class {
7006
7465
  constructor(person1, person2, lang = "en", entirePath, displayName = "givenname") {
@@ -8152,7 +8611,7 @@ var ensureExtensionSchema = (gedcom, extraTags) => {
8152
8611
 
8153
8612
  // package.json
8154
8613
  var package_default = {
8155
- version: "2.1.7"};
8614
+ version: "2.1.9"};
8156
8615
 
8157
8616
  // src/utils/get-product-details.ts
8158
8617
  var isDevelopment = () => {