@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.
@@ -1422,7 +1422,9 @@ __export(translators_exports, {
1422
1422
  es: () => KinshipTranslatorEs,
1423
1423
  fr: () => KinshipTranslatorFr,
1424
1424
  hu: () => KinshipTranslatorHU,
1425
- ru: () => KinshipTranslatorRu
1425
+ ja: () => KinshipTranslatorJa,
1426
+ ru: () => KinshipTranslatorRu,
1427
+ zh: () => KinshipTranslatorZh
1426
1428
  });
1427
1429
 
1428
1430
  // src/constants/filters.ts
@@ -4920,14 +4922,29 @@ var Indi = class extends Common {
4920
4922
  getAkas(limit) {
4921
4923
  return this.getFacts(limit, "AKA");
4922
4924
  }
4925
+ /**
4926
+ * Collect event/attribute facts.
4927
+ * @param limit Max records per tag
4928
+ * @param filter Whitelist tags, or `{ include?, exclude? }`.
4929
+ * - string/array: include only these tags (and custom EVEN/FACT TYPE values)
4930
+ * - `{ exclude: ["BIRT","DEAT"] }`: all facts except those tags
4931
+ */
4923
4932
  getFacts(limit, filter) {
4924
- const filters = (Array.isArray(filter) ? filter : [filter]).filter(
4925
- Boolean
4933
+ const asList = (value) => (Array.isArray(value) ? value : [value]).filter(Boolean);
4934
+ const isFilterObject = !!filter && typeof filter === "object" && !Array.isArray(filter) && ("include" in filter || "exclude" in filter);
4935
+ const filters = asList(
4936
+ isFilterObject ? filter.include : filter
4937
+ );
4938
+ const excludes = asList(
4939
+ isFilterObject ? filter.exclude : void 0
4926
4940
  );
4927
4941
  const facts = new List();
4928
4942
  let id = 0;
4929
4943
  ALLOWED_FACTS.forEach((fact) => {
4930
4944
  const isCustom = ["EVEN", "FACT"].includes(fact);
4945
+ if (excludes.length && excludes.includes(fact) && !isCustom) {
4946
+ return;
4947
+ }
4931
4948
  if (filters.length && !filters.includes(fact) && !isCustom) {
4932
4949
  return;
4933
4950
  }
@@ -4950,6 +4967,9 @@ var Indi = class extends Common {
4950
4967
  if (!type || DISALLOWED_CUSTOM_FACTS.includes(type)) {
4951
4968
  return;
4952
4969
  }
4970
+ if (excludes.length && excludes.includes(type)) {
4971
+ return;
4972
+ }
4953
4973
  if (filters.length && !filters.includes(type) && isCustom) {
4954
4974
  return;
4955
4975
  }
@@ -7606,6 +7626,445 @@ var KinshipTranslatorRu = class extends KinshipTranslatorBasic {
7606
7626
  }
7607
7627
  };
7608
7628
 
7629
+ // src/kinship-translator/patterns.ja.ts
7630
+ var InLawsJa = {
7631
+ "(\u5B50|\u5A18|\u606F\u5B50)\u306E\u914D\u5076\u8005": "\u7FA9\u7406\u306E\u5B50",
7632
+ "(\u5B50|\u5A18|\u606F\u5B50)\u306E\u59BB": "\u5AC1",
7633
+ "(\u5B50|\u5A18|\u606F\u5B50)\u306E\u592B": "\u5A7F",
7634
+ "(\u914D\u5076\u8005|\u59BB|\u592B)\u306E\u6BCD": "\u7FA9\u6BCD",
7635
+ "(\u914D\u5076\u8005|\u59BB|\u592B)\u306E\u7236": "\u7FA9\u7236",
7636
+ "(\u914D\u5076\u8005|\u59BB|\u592B)\u306E\u89AA": "\u7FA9\u7406\u306E\u89AA",
7637
+ "(\u7570\u7236\u6BCD\u306E)?(\u5144\u5F1F|\u59C9\u59B9|\u5144\u5F1F\u59C9\u59B9)\u306E\u59BB": "\u7FA9\u7406\u306E\u59C9\u59B9",
7638
+ "(\u7570\u7236\u6BCD\u306E)?(\u5144\u5F1F|\u59C9\u59B9|\u5144\u5F1F\u59C9\u59B9)\u306E\u592B": "\u7FA9\u7406\u306E\u5144\u5F1F",
7639
+ "(\u7570\u7236\u6BCD\u306E)?(\u5144\u5F1F|\u59C9\u59B9|\u5144\u5F1F\u59C9\u59B9)\u306E\u914D\u5076\u8005": "\u7FA9\u7406\u306E\u5144\u5F1F\u59C9\u59B9",
7640
+ "(\u7570\u7236\u6BCD\u306E)?\u59C9\u59B9\u306E(\u914D\u5076\u8005|\u59BB|\u592B)": "\u7FA9\u7406\u306E\u59C9\u59B9",
7641
+ "(\u7570\u7236\u6BCD\u306E)?\u5144\u5F1F\u306E(\u914D\u5076\u8005|\u59BB|\u592B)": "\u7FA9\u7406\u306E\u5144\u5F1F",
7642
+ "(\u7570\u7236\u6BCD\u306E)?\u5144\u5F1F\u59C9\u59B9\u306E(\u914D\u5076\u8005|\u59BB|\u592B)": "\u7FA9\u7406\u306E\u5144\u5F1F\u59C9\u59B9",
7643
+ "(\u7570\u7236\u6BCD\u306E)?(\u914D\u5076\u8005|\u59BB|\u592B)\u306E\u59C9\u59B9": "\u7FA9\u7406\u306E\u59C9\u59B9",
7644
+ "(\u7570\u7236\u6BCD\u306E)?(\u914D\u5076\u8005|\u59BB|\u592B)\u306E\u5144\u5F1F": "\u7FA9\u7406\u306E\u5144\u5F1F",
7645
+ "(\u7570\u7236\u6BCD\u306E)?(\u914D\u5076\u8005|\u59BB|\u592B)\u306E\u5144\u5F1F\u59C9\u59B9": "\u7FA9\u7406\u306E\u5144\u5F1F\u59C9\u59B9"
7646
+ };
7647
+
7648
+ // src/kinship-translator/kinship-translator.ja.ts
7649
+ var sexOf2 = (person) => {
7650
+ if (person?.isMale?.()) {
7651
+ return "m";
7652
+ }
7653
+ if (person?.isFemale?.()) {
7654
+ return "f";
7655
+ }
7656
+ return "n";
7657
+ };
7658
+ var pick = (sex, male, female, neutral) => {
7659
+ if (sex === "m") {
7660
+ return male;
7661
+ }
7662
+ if (sex === "f") {
7663
+ return female;
7664
+ }
7665
+ return neutral;
7666
+ };
7667
+ var lineal = (level, sex, kind) => {
7668
+ const L = Math.max(1, level);
7669
+ if (kind === "asc") {
7670
+ if (L <= 1) {
7671
+ return pick(sex, "\u7236", "\u6BCD", "\u89AA");
7672
+ }
7673
+ if (L === 2) {
7674
+ return pick(sex, "\u7956\u7236", "\u7956\u6BCD", "\u7956\u7236\u6BCD");
7675
+ }
7676
+ if (L === 3) {
7677
+ return pick(sex, "\u66FE\u7956\u7236", "\u66FE\u7956\u6BCD", "\u66FE\u7956\u7236\u6BCD");
7678
+ }
7679
+ if (L === 4) {
7680
+ return pick(sex, "\u9AD8\u7956\u7236", "\u9AD8\u7956\u6BCD", "\u9AD8\u7956\u7236\u6BCD");
7681
+ }
7682
+ return pick(
7683
+ sex,
7684
+ `${L - 1}\u4E16\u306E\u7956\u7236`,
7685
+ `${L - 1}\u4E16\u306E\u7956\u6BCD`,
7686
+ `${L - 1}\u4E16\u306E\u7956\u7236\u6BCD`
7687
+ );
7688
+ }
7689
+ if (L <= 1) {
7690
+ return pick(sex, "\u606F\u5B50", "\u5A18", "\u5B50");
7691
+ }
7692
+ if (L === 2) {
7693
+ return "\u5B6B";
7694
+ }
7695
+ if (L === 3) {
7696
+ return "\u66FE\u5B6B";
7697
+ }
7698
+ if (L === 4) {
7699
+ return "\u7384\u5B6B";
7700
+ }
7701
+ return `${L - 1}\u4E16\u306E\u5B6B`;
7702
+ };
7703
+ var cousinPlain = (degree) => {
7704
+ if (degree <= 1) {
7705
+ return "\u3044\u3068\u3053";
7706
+ }
7707
+ if (degree === 2) {
7708
+ return "\u307E\u305F\u3044\u3068\u3053";
7709
+ }
7710
+ if (degree === 3) {
7711
+ return "\u306F\u3068\u3053";
7712
+ }
7713
+ return `${degree}\u89AA\u7B49\u306E\u3044\u3068\u3053`;
7714
+ };
7715
+ var KinshipTranslatorJa = class extends KinshipTranslatorBasic {
7716
+ indirect() {
7717
+ let degree = Math.abs(this.pathN?.degree ?? 0);
7718
+ if (degree > 0) {
7719
+ degree = degree - 1;
7720
+ }
7721
+ return cousinPlain(degree);
7722
+ }
7723
+ removal() {
7724
+ const level = this.pathN?.level ?? 0;
7725
+ let degree = Math.abs(this.pathN?.degree ?? 0);
7726
+ if (degree > 0) {
7727
+ degree = degree - 1;
7728
+ }
7729
+ if (!degree) {
7730
+ return level < 0 ? this.nibling() : this.auncle();
7731
+ }
7732
+ const removed = Math.abs(level);
7733
+ return `${cousinPlain(degree)}\uFF08${removed}\u4E16\u4EE3\u9055\u3044\uFF09`;
7734
+ }
7735
+ auncle() {
7736
+ const level = Math.abs(this.pathN?.level ?? 0);
7737
+ const sex = sexOf2(this.personN);
7738
+ if (level <= 2) {
7739
+ return pick(sex, "\u304A\u3058", "\u304A\u3070", "\u304A\u3058/\u304A\u3070");
7740
+ }
7741
+ if (level === 3) {
7742
+ return pick(sex, "\u5927\u304A\u3058", "\u5927\u304A\u3070", "\u5927\u304A\u3058/\u5927\u304A\u3070");
7743
+ }
7744
+ return pick(
7745
+ sex,
7746
+ `${level - 2}\u4EE3\u524D\u306E\u304A\u3058`,
7747
+ `${level - 2}\u4EE3\u524D\u306E\u304A\u3070`,
7748
+ `${level - 2}\u4EE3\u524D\u306E\u304A\u3058/\u304A\u3070`
7749
+ );
7750
+ }
7751
+ nibling() {
7752
+ const level = Math.abs(this.pathN?.level ?? 0);
7753
+ const sex = sexOf2(this.personN);
7754
+ if (level <= 2) {
7755
+ return pick(sex, "\u7525", "\u59EA", "\u7525/\u59EA");
7756
+ }
7757
+ if (level === 3) {
7758
+ return pick(sex, "\u5927\u7525", "\u5927\u59EA", "\u5927\u7525/\u5927\u59EA");
7759
+ }
7760
+ return pick(
7761
+ sex,
7762
+ `${level - 2}\u4EE3\u4E0B\u306E\u7525`,
7763
+ `${level - 2}\u4EE3\u4E0B\u306E\u59EA`,
7764
+ `${level - 2}\u4EE3\u4E0B\u306E\u7525/\u59EA`
7765
+ );
7766
+ }
7767
+ parent() {
7768
+ return lineal(
7769
+ Math.abs(this.pathN?.level ?? 0),
7770
+ sexOf2(this.personN),
7771
+ "asc"
7772
+ );
7773
+ }
7774
+ child() {
7775
+ return lineal(
7776
+ Math.abs(this.pathN?.level ?? 0),
7777
+ sexOf2(this.personN),
7778
+ "desc"
7779
+ );
7780
+ }
7781
+ sibling() {
7782
+ return pick(sexOf2(this.personN), "\u5144\u5F1F", "\u59C9\u59B9", "\u5144\u5F1F\u59C9\u59B9");
7783
+ }
7784
+ halfBlood(relation) {
7785
+ if (!relation || !this.isHalfBlood) {
7786
+ return relation ?? "";
7787
+ }
7788
+ return `\u7570\u7236\u6BCD\u306E${relation}`;
7789
+ }
7790
+ spouse() {
7791
+ return pick(sexOf2(this.personN), "\u592B", "\u59BB", "\u914D\u5076\u8005");
7792
+ }
7793
+ ofSpouse(relation) {
7794
+ if (!relation) {
7795
+ return "";
7796
+ }
7797
+ const spouseType = pick(
7798
+ sexOf2(this.path?.[1].indi),
7799
+ "\u592B",
7800
+ "\u59BB",
7801
+ "\u914D\u5076\u8005"
7802
+ );
7803
+ return `${spouseType}\u306E${relation}`;
7804
+ }
7805
+ spouseOf(relation) {
7806
+ if (!relation) {
7807
+ return "";
7808
+ }
7809
+ const spouse = this.path?.[this.path.length - 1].indi;
7810
+ const spouseType = pick(sexOf2(spouse), "\u592B", "\u59BB", "\u914D\u5076\u8005");
7811
+ return `${relation}\u306E${spouseType}`;
7812
+ }
7813
+ of(relation) {
7814
+ const formattedName = nameFormatter(this.path?.[0]?.indi, {
7815
+ nameOrder: "last-first"
7816
+ });
7817
+ let name = formattedName.inOrder.filter(Boolean).join(" ");
7818
+ if (this.displayName === "none") {
7819
+ name = "";
7820
+ } else if (this.displayName === "givenname") {
7821
+ name = formattedName.givenname;
7822
+ } else if (this.displayName === "surname") {
7823
+ name = `${formattedName.surname}`;
7824
+ }
7825
+ if (!name || !relation) {
7826
+ return relation ?? "";
7827
+ }
7828
+ return `${name}\u306E${relation}`;
7829
+ }
7830
+ inLaw(relation) {
7831
+ let inLawRelation = relation;
7832
+ Object.keys(InLawsJa).find((pattern) => {
7833
+ const regex = new RegExp(`^${pattern}$`);
7834
+ if (relation?.match(regex)) {
7835
+ inLawRelation = InLawsJa[pattern];
7836
+ return true;
7837
+ }
7838
+ return false;
7839
+ });
7840
+ return inLawRelation ?? "";
7841
+ }
7842
+ relationType(relation) {
7843
+ if (!relation || !this.pathN?.relation) {
7844
+ return relation ?? "";
7845
+ }
7846
+ return `${this.pathN.relation}\u306E${relation}`;
7847
+ }
7848
+ };
7849
+
7850
+ // src/kinship-translator/patterns.zh.ts
7851
+ var InLawsZh = {
7852
+ "(\u5B50\u5973|\u5973\u513F|\u513F\u5B50)\u7684\u914D\u5076": "\u513F\u5AB3/\u5973\u5A7F",
7853
+ "(\u5B50\u5973|\u5973\u513F|\u513F\u5B50)\u7684\u59BB\u5B50": "\u513F\u5AB3",
7854
+ "(\u5B50\u5973|\u5973\u513F|\u513F\u5B50)\u7684\u4E08\u592B": "\u5973\u5A7F",
7855
+ "(\u914D\u5076|\u59BB\u5B50|\u4E08\u592B)\u7684\u6BCD\u4EB2": "\u5CB3\u6BCD/\u5A46\u5A46",
7856
+ "(\u914D\u5076|\u59BB\u5B50|\u4E08\u592B)\u7684\u7236\u4EB2": "\u5CB3\u7236/\u516C\u516C",
7857
+ "(\u914D\u5076|\u59BB\u5B50|\u4E08\u592B)\u7684\u7236\u6BCD": "\u5CB3\u7236\u5CB3\u6BCD/\u516C\u516C\u5A46\u5A46",
7858
+ "(\u5F02\u7236\u6BCD\u7684)?(\u5144\u5F1F\u59D0\u59B9|\u59D0\u59B9|\u5144\u5F1F)\u7684\u59BB\u5B50": "\u5AC2\u5B50/\u5F1F\u59B9",
7859
+ "(\u5F02\u7236\u6BCD\u7684)?(\u5144\u5F1F\u59D0\u59B9|\u59D0\u59B9|\u5144\u5F1F)\u7684\u4E08\u592B": "\u59D0\u592B/\u59B9\u592B",
7860
+ "(\u5F02\u7236\u6BCD\u7684)?(\u5144\u5F1F\u59D0\u59B9|\u59D0\u59B9|\u5144\u5F1F)\u7684\u914D\u5076": "\u59FB\u4EB2\u5144\u5F1F\u59D0\u59B9",
7861
+ "(\u5F02\u7236\u6BCD\u7684)?\u59D0\u59B9\u7684(\u914D\u5076|\u59BB\u5B50|\u4E08\u592B)": "\u59D0\u592B/\u59B9\u592B",
7862
+ "(\u5F02\u7236\u6BCD\u7684)?\u5144\u5F1F\u7684(\u914D\u5076|\u59BB\u5B50|\u4E08\u592B)": "\u5AC2\u5B50/\u5F1F\u59B9",
7863
+ "(\u5F02\u7236\u6BCD\u7684)?\u5144\u5F1F\u59D0\u59B9\u7684(\u914D\u5076|\u59BB\u5B50|\u4E08\u592B)": "\u59FB\u4EB2\u5144\u5F1F\u59D0\u59B9",
7864
+ "(\u5F02\u7236\u6BCD\u7684)?(\u914D\u5076|\u59BB\u5B50|\u4E08\u592B)\u7684\u59D0\u59B9": "\u59D1\u5B50/\u59E8\u5B50",
7865
+ "(\u5F02\u7236\u6BCD\u7684)?(\u914D\u5076|\u59BB\u5B50|\u4E08\u592B)\u7684\u5144\u5F1F": "\u5927\u4F2F/\u5C0F\u53D4/\u5185\u5144/\u5185\u5F1F",
7866
+ "(\u5F02\u7236\u6BCD\u7684)?(\u914D\u5076|\u59BB\u5B50|\u4E08\u592B)\u7684\u5144\u5F1F\u59D0\u59B9": "\u59FB\u4EB2\u5144\u5F1F\u59D0\u59B9"
7867
+ };
7868
+
7869
+ // src/kinship-translator/kinship-translator.zh.ts
7870
+ var sexOf3 = (person) => {
7871
+ if (person?.isMale?.()) {
7872
+ return "m";
7873
+ }
7874
+ if (person?.isFemale?.()) {
7875
+ return "f";
7876
+ }
7877
+ return "n";
7878
+ };
7879
+ var pick2 = (sex, male, female, neutral) => {
7880
+ if (sex === "m") {
7881
+ return male;
7882
+ }
7883
+ if (sex === "f") {
7884
+ return female;
7885
+ }
7886
+ return neutral;
7887
+ };
7888
+ var lineal2 = (level, sex, kind) => {
7889
+ const L = Math.max(1, level);
7890
+ if (kind === "asc") {
7891
+ if (L <= 1) {
7892
+ return pick2(sex, "\u7236\u4EB2", "\u6BCD\u4EB2", "\u7236\u6BCD");
7893
+ }
7894
+ if (L === 2) {
7895
+ return pick2(sex, "\u7956\u7236", "\u7956\u6BCD", "\u7956\u7236\u6BCD");
7896
+ }
7897
+ if (L === 3) {
7898
+ return pick2(sex, "\u66FE\u7956\u7236", "\u66FE\u7956\u6BCD", "\u66FE\u7956\u7236\u6BCD");
7899
+ }
7900
+ if (L === 4) {
7901
+ return pick2(sex, "\u9AD8\u7956\u7236", "\u9AD8\u7956\u6BCD", "\u9AD8\u7956\u7236\u6BCD");
7902
+ }
7903
+ return pick2(sex, `${L}\u4E16\u7956`, `${L}\u4E16\u7956\u6BCD`, `${L}\u4E16\u7956\u7236\u6BCD`);
7904
+ }
7905
+ if (L <= 1) {
7906
+ return pick2(sex, "\u513F\u5B50", "\u5973\u513F", "\u5B50\u5973");
7907
+ }
7908
+ if (L === 2) {
7909
+ return pick2(sex, "\u5B59\u5B50", "\u5B59\u5973", "\u5B59\u5B50\u5973");
7910
+ }
7911
+ if (L === 3) {
7912
+ return pick2(sex, "\u66FE\u5B59", "\u66FE\u5B59\u5973", "\u66FE\u5B59\u5B50\u5973");
7913
+ }
7914
+ if (L === 4) {
7915
+ return pick2(sex, "\u7384\u5B59", "\u7384\u5B59\u5973", "\u7384\u5B59\u5B50\u5973");
7916
+ }
7917
+ return pick2(sex, `${L}\u4E16\u5B59`, `${L}\u4E16\u5B59\u5973`, `${L}\u4E16\u5B59\u5B50\u5973`);
7918
+ };
7919
+ var cousinPlain2 = (degree, sex) => {
7920
+ if (degree <= 1) {
7921
+ return pick2(sex, "\u5802\u8868\u5144\u5F1F", "\u5802\u8868\u59D0\u59B9", "\u5802\u8868\u4EB2");
7922
+ }
7923
+ if (degree === 2) {
7924
+ return pick2(sex, "\u4ECE\u5802\u8868\u5144\u5F1F", "\u4ECE\u5802\u8868\u59D0\u59B9", "\u4ECE\u5802\u8868\u4EB2");
7925
+ }
7926
+ return pick2(
7927
+ sex,
7928
+ `${degree}\u4EE3\u5802\u8868\u5144\u5F1F`,
7929
+ `${degree}\u4EE3\u5802\u8868\u59D0\u59B9`,
7930
+ `${degree}\u4EE3\u5802\u8868\u4EB2`
7931
+ );
7932
+ };
7933
+ var KinshipTranslatorZh = class extends KinshipTranslatorBasic {
7934
+ indirect() {
7935
+ let degree = Math.abs(this.pathN?.degree ?? 0);
7936
+ if (degree > 0) {
7937
+ degree = degree - 1;
7938
+ }
7939
+ return cousinPlain2(degree, sexOf3(this.personN));
7940
+ }
7941
+ removal() {
7942
+ const level = this.pathN?.level ?? 0;
7943
+ let degree = Math.abs(this.pathN?.degree ?? 0);
7944
+ if (degree > 0) {
7945
+ degree = degree - 1;
7946
+ }
7947
+ if (!degree) {
7948
+ return level < 0 ? this.nibling() : this.auncle();
7949
+ }
7950
+ const removed = Math.abs(level);
7951
+ return `${cousinPlain2(degree, sexOf3(this.personN))}\uFF08\u9694${removed}\u4EE3\uFF09`;
7952
+ }
7953
+ auncle() {
7954
+ const level = Math.abs(this.pathN?.level ?? 0);
7955
+ const sex = sexOf3(this.personN);
7956
+ if (level <= 2) {
7957
+ return pick2(sex, "\u53D4\u53D4", "\u963F\u59E8", "\u53D4\u4F2F/\u59D1\u59E8");
7958
+ }
7959
+ if (level === 3) {
7960
+ return pick2(sex, "\u4F2F\u53D4\u7956\u7236", "\u59D1\u7956\u6BCD", "\u4F2F\u53D4\u7956\u7236\u6BCD");
7961
+ }
7962
+ return pick2(
7963
+ sex,
7964
+ `${level - 2}\u4EE3\u524D\u7684\u53D4\u53D4`,
7965
+ `${level - 2}\u4EE3\u524D\u7684\u963F\u59E8`,
7966
+ `${level - 2}\u4EE3\u524D\u7684\u53D4\u4F2F/\u59D1\u59E8`
7967
+ );
7968
+ }
7969
+ nibling() {
7970
+ const level = Math.abs(this.pathN?.level ?? 0);
7971
+ const sex = sexOf3(this.personN);
7972
+ if (level <= 2) {
7973
+ return pick2(sex, "\u4F84\u5B50", "\u4F84\u5973", "\u4F84\u5B50\u5973");
7974
+ }
7975
+ if (level === 3) {
7976
+ return pick2(sex, "\u4F84\u5B59", "\u4F84\u5B59\u5973", "\u4F84\u5B59\u5B50\u5973");
7977
+ }
7978
+ return pick2(
7979
+ sex,
7980
+ `${level - 2}\u4EE3\u4E0B\u7684\u4F84\u5B50`,
7981
+ `${level - 2}\u4EE3\u4E0B\u7684\u4F84\u5973`,
7982
+ `${level - 2}\u4EE3\u4E0B\u7684\u4F84\u5B50\u5973`
7983
+ );
7984
+ }
7985
+ parent() {
7986
+ return lineal2(
7987
+ Math.abs(this.pathN?.level ?? 0),
7988
+ sexOf3(this.personN),
7989
+ "asc"
7990
+ );
7991
+ }
7992
+ child() {
7993
+ return lineal2(
7994
+ Math.abs(this.pathN?.level ?? 0),
7995
+ sexOf3(this.personN),
7996
+ "desc"
7997
+ );
7998
+ }
7999
+ sibling() {
8000
+ return pick2(sexOf3(this.personN), "\u5144\u5F1F", "\u59D0\u59B9", "\u5144\u5F1F\u59D0\u59B9");
8001
+ }
8002
+ halfBlood(relation) {
8003
+ if (!relation || !this.isHalfBlood) {
8004
+ return relation ?? "";
8005
+ }
8006
+ return `\u5F02\u7236\u6BCD\u7684${relation}`;
8007
+ }
8008
+ spouse() {
8009
+ return pick2(sexOf3(this.personN), "\u4E08\u592B", "\u59BB\u5B50", "\u914D\u5076");
8010
+ }
8011
+ ofSpouse(relation) {
8012
+ if (!relation) {
8013
+ return "";
8014
+ }
8015
+ const spouseType = pick2(
8016
+ sexOf3(this.path?.[1].indi),
8017
+ "\u4E08\u592B",
8018
+ "\u59BB\u5B50",
8019
+ "\u914D\u5076"
8020
+ );
8021
+ return `${spouseType}\u7684${relation}`;
8022
+ }
8023
+ spouseOf(relation) {
8024
+ if (!relation) {
8025
+ return "";
8026
+ }
8027
+ const spouse = this.path?.[this.path.length - 1].indi;
8028
+ const spouseType = pick2(sexOf3(spouse), "\u4E08\u592B", "\u59BB\u5B50", "\u914D\u5076");
8029
+ return `${relation}\u7684${spouseType}`;
8030
+ }
8031
+ of(relation) {
8032
+ const formattedName = nameFormatter(this.path?.[0]?.indi, {
8033
+ nameOrder: "last-first"
8034
+ });
8035
+ let name = formattedName.inOrder.filter(Boolean).join(" ");
8036
+ if (this.displayName === "none") {
8037
+ name = "";
8038
+ } else if (this.displayName === "givenname") {
8039
+ name = formattedName.givenname;
8040
+ } else if (this.displayName === "surname") {
8041
+ name = `${formattedName.surname}`;
8042
+ }
8043
+ if (!name || !relation) {
8044
+ return relation ?? "";
8045
+ }
8046
+ return `${name}\u7684${relation}`;
8047
+ }
8048
+ inLaw(relation) {
8049
+ let inLawRelation = relation;
8050
+ Object.keys(InLawsZh).find((pattern) => {
8051
+ const regex = new RegExp(`^${pattern}$`);
8052
+ if (relation?.match(regex)) {
8053
+ inLawRelation = InLawsZh[pattern];
8054
+ return true;
8055
+ }
8056
+ return false;
8057
+ });
8058
+ return inLawRelation ?? "";
8059
+ }
8060
+ relationType(relation) {
8061
+ if (!relation || !this.pathN?.relation) {
8062
+ return relation ?? "";
8063
+ }
8064
+ return `${this.pathN.relation}${relation}`;
8065
+ }
8066
+ };
8067
+
7609
8068
  // src/kinship-translator/kinship-translator.ts
7610
8069
  var KinshipTranslator = class {
7611
8070
  constructor(person1, person2, lang = "en", entirePath, displayName = "givenname") {
@@ -8906,7 +9365,7 @@ var collectExtensionTagsFrom = (node, into = /* @__PURE__ */ new Set()) => {
8906
9365
  // package.json
8907
9366
  var package_default = {
8908
9367
  name: "@treeviz/gedcom-parser",
8909
- version: "2.1.7"};
9368
+ version: "2.1.9"};
8910
9369
 
8911
9370
  // src/utils/get-product-details.ts
8912
9371
  var isDevelopment = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@treeviz/gedcom-parser",
3
- "version": "2.1.7",
3
+ "version": "2.1.9",
4
4
  "description": "Lightweight, pluggable GEDCOM parser for JavaScript/TypeScript with optional caching and place matching. Zero browser dependencies.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",