@treeviz/gedcom-parser 2.1.17 → 2.1.22
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/classes/common.d.ts +19 -1
- package/dist/classes/common.d.ts.map +1 -1
- package/dist/classes/index.js +276 -80
- package/dist/classes/indi.d.ts +3 -2
- package/dist/classes/indi.d.ts.map +1 -1
- package/dist/classes/obje.d.ts +1 -1
- package/dist/classes/obje.d.ts.map +1 -1
- package/dist/cli/index.js +277 -80
- package/dist/constants/index.js +255 -61
- package/dist/factories/index.js +255 -61
- package/dist/index.js +281 -83
- package/dist/kinship-translator/index.js +255 -61
- package/dist/kinship-translator/kinship-translator.en.d.ts.map +1 -1
- package/dist/kinship-translator/kinship-translator.hu.d.ts.map +1 -1
- package/dist/kinship-translator/kinship-translator.ja.d.ts.map +1 -1
- package/dist/kinship-translator/patterns.hu.d.ts +12 -1
- package/dist/kinship-translator/patterns.hu.d.ts.map +1 -1
- package/dist/utils/gedzip.d.ts.map +1 -1
- package/dist/utils/index.js +281 -83
- package/dist/utils/media-utils.d.ts +10 -0
- package/dist/utils/media-utils.d.ts.map +1 -1
- package/dist/utils/multimedia.d.ts +5 -0
- package/dist/utils/multimedia.d.ts.map +1 -1
- package/dist/utils/parser.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/factories/index.js
CHANGED
|
@@ -165,6 +165,30 @@ var mediaIdValue = (obje, path) => {
|
|
|
165
165
|
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
166
166
|
};
|
|
167
167
|
var resolveObjeMediaId = (obje) => mediaIdValue(obje, "RIN") || mediaIdValue(obje, "_CLON._OID") || mediaIdValue(obje, "_MSER._LKID") || mediaIdValue(obje, "_OID") || mediaIdValue(obje, "_LKID");
|
|
168
|
+
var ANCESTRY_TREE_MEDIA_NAMESPACE = 1093;
|
|
169
|
+
var ANCESTRY_NAMESPACE_IN_URL = /\/namespaces\/(\d+)\/media\//i;
|
|
170
|
+
var parseAncestryNamespaceFromUrl = (url) => {
|
|
171
|
+
if (!url) {
|
|
172
|
+
return void 0;
|
|
173
|
+
}
|
|
174
|
+
const match = url.match(ANCESTRY_NAMESPACE_IN_URL);
|
|
175
|
+
const namespace = match?.[1] ? Number(match[1]) : NaN;
|
|
176
|
+
return Number.isFinite(namespace) ? namespace : void 0;
|
|
177
|
+
};
|
|
178
|
+
var isAncestryOriginObje = (obje) => {
|
|
179
|
+
if (!obje) {
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
const orig = mediaIdValue(obje, "_ORIG");
|
|
183
|
+
if (orig?.toLowerCase() === "acom") {
|
|
184
|
+
return true;
|
|
185
|
+
}
|
|
186
|
+
const file = mediaIdValue(obje, "FILE") ?? "";
|
|
187
|
+
if (parseAncestryNamespaceFromUrl(file)) {
|
|
188
|
+
return true;
|
|
189
|
+
}
|
|
190
|
+
return Boolean(resolveObjeMediaId(obje) && !file.trim());
|
|
191
|
+
};
|
|
168
192
|
var ANCESTRY_MEDIA_RETRIEVAL_PREFIX = "https://www.ancestry.com/api/media/retrieval/v2/image";
|
|
169
193
|
var ANCESTRY_MEDIA_QUERY = "client=trees-mediaservice&imageQuality=hq";
|
|
170
194
|
var ancestryMediaPath = (namespace, imgId) => `/namespaces/${namespace}/media/${imgId}?${ANCESTRY_MEDIA_QUERY}`;
|
|
@@ -540,8 +564,25 @@ var Common = class _Common {
|
|
|
540
564
|
getHeadRecord() {
|
|
541
565
|
return get(this, "HEAD") || get(this.getGedcom(), "HEAD");
|
|
542
566
|
}
|
|
567
|
+
unwrapHeadRecord(node) {
|
|
568
|
+
if (!node) {
|
|
569
|
+
return void 0;
|
|
570
|
+
}
|
|
571
|
+
const common = node instanceof List ? node.index(0) : node;
|
|
572
|
+
if (!common || typeof common.get !== "function") {
|
|
573
|
+
return void 0;
|
|
574
|
+
}
|
|
575
|
+
const nested = common.get("HEAD");
|
|
576
|
+
if (nested instanceof List) {
|
|
577
|
+
return nested.index(0) ?? common;
|
|
578
|
+
}
|
|
579
|
+
if (nested instanceof _Common) {
|
|
580
|
+
return nested;
|
|
581
|
+
}
|
|
582
|
+
return common;
|
|
583
|
+
}
|
|
543
584
|
getOriginalHeadRecord() {
|
|
544
|
-
return get(this, ORIG_HEAD_TAG) || get(this.getGedcom(), ORIG_HEAD_TAG) || get(this.getHeadRecord(), ORIG_HEAD_TAG);
|
|
585
|
+
return this.unwrapHeadRecord(get(this, ORIG_HEAD_TAG)) || this.unwrapHeadRecord(get(this.getGedcom(), ORIG_HEAD_TAG)) || this.unwrapHeadRecord(get(this.getHeadRecord(), ORIG_HEAD_TAG));
|
|
545
586
|
}
|
|
546
587
|
getSourceHeads() {
|
|
547
588
|
const heads = [this.getOriginalHeadRecord(), this.getHeadRecord()];
|
|
@@ -549,9 +590,23 @@ var Common = class _Common {
|
|
|
549
590
|
return Boolean(head && heads.indexOf(head) === index);
|
|
550
591
|
});
|
|
551
592
|
}
|
|
593
|
+
sourceHeadField(head, path) {
|
|
594
|
+
const normalized = path.endsWith(".value") ? path.slice(0, -".value".length) : path;
|
|
595
|
+
const node = head.get(normalized);
|
|
596
|
+
if (!node) {
|
|
597
|
+
return void 0;
|
|
598
|
+
}
|
|
599
|
+
if (node instanceof List) {
|
|
600
|
+
return node.index(0)?.toValue();
|
|
601
|
+
}
|
|
602
|
+
if (typeof node.toValue === "function") {
|
|
603
|
+
return node.toValue();
|
|
604
|
+
}
|
|
605
|
+
return void 0;
|
|
606
|
+
}
|
|
552
607
|
getFromSourceHeads(path) {
|
|
553
608
|
for (const head of this.getSourceHeads()) {
|
|
554
|
-
const value =
|
|
609
|
+
const value = this.sourceHeadField(head, path);
|
|
555
610
|
if (value !== void 0 && value !== null && value !== "") {
|
|
556
611
|
return value;
|
|
557
612
|
}
|
|
@@ -560,8 +615,8 @@ var Common = class _Common {
|
|
|
560
615
|
}
|
|
561
616
|
sourStartsWith(prefix) {
|
|
562
617
|
return this.getSourceHeads().some((head) => {
|
|
563
|
-
const sour =
|
|
564
|
-
return
|
|
618
|
+
const sour = this.sourceHeadField(head, "SOUR");
|
|
619
|
+
return typeof sour === "string" && sour.toLowerCase().startsWith(prefix);
|
|
565
620
|
});
|
|
566
621
|
}
|
|
567
622
|
isGenoPro() {
|
|
@@ -571,7 +626,7 @@ var Common = class _Common {
|
|
|
571
626
|
return this.sourStartsWith("ahnenblatt");
|
|
572
627
|
}
|
|
573
628
|
isGeni() {
|
|
574
|
-
return this.sourStartsWith("geni");
|
|
629
|
+
return this.sourStartsWith("geni.com");
|
|
575
630
|
}
|
|
576
631
|
isAncestry() {
|
|
577
632
|
return this.sourStartsWith("ancestry");
|
|
@@ -579,6 +634,51 @@ var Common = class _Common {
|
|
|
579
634
|
isMyHeritage() {
|
|
580
635
|
return this.sourStartsWith("myheritage");
|
|
581
636
|
}
|
|
637
|
+
/**
|
|
638
|
+
* GEDCOM root for Ancestry media helpers.
|
|
639
|
+
* `this._gedcom` when called on a child record; `this` when called on the file root.
|
|
640
|
+
*
|
|
641
|
+
* Cannot use `instanceof GedCom`: `GedComType` is a type alias (erased at runtime),
|
|
642
|
+
* and importing the `GedCom` class here would cycle (`GedCom extends Common`).
|
|
643
|
+
* The root is the only Common with an `objes()` method.
|
|
644
|
+
*/
|
|
645
|
+
hostGedcom() {
|
|
646
|
+
const linked = this.getGedcom();
|
|
647
|
+
if (linked) {
|
|
648
|
+
return linked;
|
|
649
|
+
}
|
|
650
|
+
if ("objes" in this && typeof this.objes === "function") {
|
|
651
|
+
return this;
|
|
652
|
+
}
|
|
653
|
+
return void 0;
|
|
654
|
+
}
|
|
655
|
+
/** True when the file still has Ancestry tree media (`_ORIG acom`, `_OID`, retrieval URL). */
|
|
656
|
+
hasAncestryOriginMedia() {
|
|
657
|
+
const objes = this.hostGedcom()?.objes?.();
|
|
658
|
+
return objes?.values().some((obje) => isAncestryOriginObje(obje)) ?? false;
|
|
659
|
+
}
|
|
660
|
+
/**
|
|
661
|
+
* Namespace for Ancestry tree photos. Prefer a `namespaces/{id}` FILE URL
|
|
662
|
+
* (TreeViz GEDCOM 7 / GEDZIP export), otherwise 1093 for member-tree media.
|
|
663
|
+
*/
|
|
664
|
+
getAncestryMediaNamespace() {
|
|
665
|
+
const objes = this.hostGedcom()?.objes?.();
|
|
666
|
+
if (objes) {
|
|
667
|
+
for (const obje of objes.values()) {
|
|
668
|
+
const file = obje?.get("FILE")?.toValue();
|
|
669
|
+
const fromUrl = parseAncestryNamespaceFromUrl(
|
|
670
|
+
typeof file === "string" ? file : void 0
|
|
671
|
+
);
|
|
672
|
+
if (fromUrl) {
|
|
673
|
+
return fromUrl;
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
if (this.isAncestry() || this.hasAncestryOriginMedia()) {
|
|
678
|
+
return ANCESTRY_TREE_MEDIA_NAMESPACE;
|
|
679
|
+
}
|
|
680
|
+
return void 0;
|
|
681
|
+
}
|
|
582
682
|
/**
|
|
583
683
|
* Get the source type as a string (for prefixing tree IDs and names)
|
|
584
684
|
* Returns the detected source type or undefined if unknown
|
|
@@ -595,13 +695,13 @@ var Common = class _Common {
|
|
|
595
695
|
}
|
|
596
696
|
isFamilySearch() {
|
|
597
697
|
return this.getSourceHeads().some((head) => {
|
|
598
|
-
const sourName =
|
|
698
|
+
const sourName = this.sourceHeadField(head, "SOUR.NAME");
|
|
599
699
|
return sourName === "FamilySearch API";
|
|
600
700
|
});
|
|
601
701
|
}
|
|
602
702
|
isGNO2GED() {
|
|
603
703
|
return this.getSourceHeads().some((head) => {
|
|
604
|
-
const sour =
|
|
704
|
+
const sour = this.sourceHeadField(head, "SOUR");
|
|
605
705
|
return sour === "GNO2GED";
|
|
606
706
|
});
|
|
607
707
|
}
|
|
@@ -646,8 +746,7 @@ var Common = class _Common {
|
|
|
646
746
|
return this.getFromSourceHeads("SOUR._TREE.value") || (get(this, "HEAD.SOUR._TREE.value") || get(this.getGedcom(), "HEAD.SOUR._TREE.value"));
|
|
647
747
|
}
|
|
648
748
|
getMyHeritageTreeName() {
|
|
649
|
-
const
|
|
650
|
-
const treeDetails = get(this, path) || get(this.getGedcom(), path);
|
|
749
|
+
const treeDetails = this.getFromSourceHeads("FILE.value") || (get(this, "HEAD.FILE.value") || get(this.getGedcom(), "HEAD.FILE.value"));
|
|
651
750
|
return treeDetails?.match(
|
|
652
751
|
/Exported by MyHeritage.com from (?<tree>.+) in.+$/
|
|
653
752
|
)?.groups?.tree;
|
|
@@ -664,7 +763,7 @@ var Common = class _Common {
|
|
|
664
763
|
if (treeName) {
|
|
665
764
|
return treeName;
|
|
666
765
|
}
|
|
667
|
-
const fileName = get(this, "HEAD.FILE.value") || get(this.getGedcom(), "HEAD.FILE.value");
|
|
766
|
+
const fileName = this.getFromSourceHeads("FILE.value") || get(this, "HEAD.FILE.value") || get(this.getGedcom(), "HEAD.FILE.value");
|
|
668
767
|
return fileName || "FamilySearch Import";
|
|
669
768
|
}
|
|
670
769
|
getAhnenblattTreeId() {
|
|
@@ -2745,6 +2844,28 @@ var resolveLocalMediaUrl = async (path, context) => {
|
|
|
2745
2844
|
var implemented = (type, ...args) => {
|
|
2746
2845
|
};
|
|
2747
2846
|
|
|
2847
|
+
// src/utils/multimedia.ts
|
|
2848
|
+
var mergeMediaListsByObjeKey = (...lists) => {
|
|
2849
|
+
const merged = {};
|
|
2850
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2851
|
+
for (const list of lists) {
|
|
2852
|
+
if (!list) {
|
|
2853
|
+
continue;
|
|
2854
|
+
}
|
|
2855
|
+
for (const [id, item] of Object.entries(list)) {
|
|
2856
|
+
const objeKey = item.key ? String(item.key) : "";
|
|
2857
|
+
if (objeKey && seen.has(objeKey)) {
|
|
2858
|
+
continue;
|
|
2859
|
+
}
|
|
2860
|
+
merged[id] = item;
|
|
2861
|
+
if (objeKey) {
|
|
2862
|
+
seen.add(objeKey);
|
|
2863
|
+
}
|
|
2864
|
+
}
|
|
2865
|
+
}
|
|
2866
|
+
return merged;
|
|
2867
|
+
};
|
|
2868
|
+
|
|
2748
2869
|
// src/factories/place-parser-provider.ts
|
|
2749
2870
|
var placeParserProvider;
|
|
2750
2871
|
var setPlaceParserProvider = (parser) => {
|
|
@@ -3545,10 +3666,12 @@ var relativesOnLevelCache = relativesCache("relativesOnLevelCache");
|
|
|
3545
3666
|
var relativesOnDegreeCache = relativesCache("relativesOnDegreeCache");
|
|
3546
3667
|
var Indi = class extends Common {
|
|
3547
3668
|
toName() {
|
|
3548
|
-
|
|
3669
|
+
const name = this.get("NAME");
|
|
3670
|
+
const value = name?.index(0)?.toValue() ?? name?.toValue();
|
|
3671
|
+
return typeof value === "string" ? value : void 0;
|
|
3549
3672
|
}
|
|
3550
3673
|
toNaturalName() {
|
|
3551
|
-
return this.
|
|
3674
|
+
return this.toName()?.replaceAll("/", "");
|
|
3552
3675
|
}
|
|
3553
3676
|
toList() {
|
|
3554
3677
|
return new Individuals().concat(
|
|
@@ -4031,7 +4154,10 @@ var Indi = class extends Common {
|
|
|
4031
4154
|
return result;
|
|
4032
4155
|
}
|
|
4033
4156
|
ancestryLink() {
|
|
4034
|
-
|
|
4157
|
+
let www = this.getFromSourceHeads("SOUR.CORP.WWW.value") || this._gedcom?.HEAD?.SOUR?.CORP?.WWW?.value;
|
|
4158
|
+
if (!www || /treeviz/i.test(String(www))) {
|
|
4159
|
+
www = "www.ancestry.com";
|
|
4160
|
+
}
|
|
4035
4161
|
const tree = this.getAncestryTreeId();
|
|
4036
4162
|
if (this.id) {
|
|
4037
4163
|
return `https://${www}/family-tree/person/tree/${tree}/person/${this.id.replace(
|
|
@@ -4043,14 +4169,15 @@ var Indi = class extends Common {
|
|
|
4043
4169
|
async ancestryMedia(namespace) {
|
|
4044
4170
|
const list = {};
|
|
4045
4171
|
const objeList = this.get("OBJE")?.toList().copy();
|
|
4046
|
-
|
|
4172
|
+
this.getFromSourceHeads("SOUR.CORP.WWW.value") || this._gedcom?.HEAD?.SOUR?.CORP?.WWW?.value;
|
|
4047
4173
|
const tree = this.getAncestryTreeId();
|
|
4174
|
+
const usedNamespace = namespace || this.getAncestryMediaNamespace() || ANCESTRY_TREE_MEDIA_NAMESPACE;
|
|
4048
4175
|
if (objeList) {
|
|
4049
4176
|
await Promise.all(
|
|
4050
4177
|
objeList.map(async (objeRef) => {
|
|
4051
4178
|
const key = objeXrefKey(objeRef, 0);
|
|
4052
4179
|
const obje = objeRef?.standardizeMedia(
|
|
4053
|
-
|
|
4180
|
+
usedNamespace,
|
|
4054
4181
|
true,
|
|
4055
4182
|
ancestryMediaFileUrl
|
|
4056
4183
|
);
|
|
@@ -4062,27 +4189,9 @@ var Indi = class extends Common {
|
|
|
4062
4189
|
const type = resolveObjeForm(obje) ?? (url ? getFileExtension(url) : void 0) ?? "raw";
|
|
4063
4190
|
let imgId = media;
|
|
4064
4191
|
const hasEmbeddedOrLocalFile = !!url && (url.startsWith("data:") || url.startsWith("blob:") || !/^https?:\/\//i.test(url));
|
|
4065
|
-
if (!hasEmbeddedOrLocalFile && (!www || !tree || !this.id)) {
|
|
4066
|
-
return;
|
|
4067
|
-
}
|
|
4068
4192
|
if (!this.id) {
|
|
4069
4193
|
return;
|
|
4070
4194
|
}
|
|
4071
|
-
if (!namespace && !url) {
|
|
4072
|
-
try {
|
|
4073
|
-
if (media) {
|
|
4074
|
-
const mediaDetailsResponse = await fetch(
|
|
4075
|
-
`https://www.ancestry.com/api/media/viewer/v2/trees/${tree}/media?id=${media}`
|
|
4076
|
-
);
|
|
4077
|
-
const mediaDetails = await mediaDetailsResponse.json();
|
|
4078
|
-
if (mediaDetails.url) {
|
|
4079
|
-
url = `${mediaDetails.url}&imageQuality=hq`;
|
|
4080
|
-
}
|
|
4081
|
-
}
|
|
4082
|
-
} catch (_e) {
|
|
4083
|
-
}
|
|
4084
|
-
url = url || `https://${www}/mediaui-viewer/tree/${tree}/media/${media}`;
|
|
4085
|
-
}
|
|
4086
4195
|
if (!imgId && hasEmbeddedOrLocalFile && url) {
|
|
4087
4196
|
imgId = typeof media === "string" && media || `local-${String(key).replace(/[@]/g, "")}-${getFileExtension(url) || "bin"}`;
|
|
4088
4197
|
}
|
|
@@ -4107,14 +4216,25 @@ var Indi = class extends Common {
|
|
|
4107
4216
|
}
|
|
4108
4217
|
return list;
|
|
4109
4218
|
}
|
|
4110
|
-
myheritageLink(poolId = 0) {
|
|
4111
|
-
|
|
4219
|
+
myheritageLink(poolId = 0, treeToken) {
|
|
4220
|
+
let www = (this.getFromSourceHeads("SOUR.CORP.value") || this._gedcom?.HEAD?.SOUR?.CORP?.value)?.toLowerCase().replace(/^www\./gi, "");
|
|
4221
|
+
if (!www || /treeviz/i.test(www)) {
|
|
4222
|
+
www = "myheritage.com";
|
|
4223
|
+
}
|
|
4224
|
+
if (!this.id) {
|
|
4225
|
+
return;
|
|
4226
|
+
}
|
|
4227
|
+
const id = Number(this.id.replace(/@|I/g, "")) + poolId;
|
|
4228
|
+
if (!Number.isFinite(id)) {
|
|
4229
|
+
return;
|
|
4230
|
+
}
|
|
4231
|
+
const slug = this.toNaturalName()?.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || String(id);
|
|
4232
|
+
if (treeToken) {
|
|
4233
|
+
return `https://www.${www}/profile-${treeToken}-${id}/${slug}`;
|
|
4234
|
+
}
|
|
4112
4235
|
const site = this.getMyHeritageTreeId();
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
if (normalizedFile && this.id) {
|
|
4116
|
-
const id = Number(this.id.replace(/@|I/g, "")) + poolId;
|
|
4117
|
-
return `https://www.${www}/site-family-tree-${site}/${normalizedFile}#!profile-${id}-info`;
|
|
4236
|
+
if (site) {
|
|
4237
|
+
return `https://www.${www}/person-${id}_${site}_${site}/${slug}`;
|
|
4118
4238
|
}
|
|
4119
4239
|
}
|
|
4120
4240
|
myheritageMedia() {
|
|
@@ -4163,6 +4283,14 @@ var Indi = class extends Common {
|
|
|
4163
4283
|
});
|
|
4164
4284
|
return list;
|
|
4165
4285
|
}
|
|
4286
|
+
geniLink() {
|
|
4287
|
+
if (!this.id) {
|
|
4288
|
+
return;
|
|
4289
|
+
}
|
|
4290
|
+
const id = this.id.replace(/@|I/g, "");
|
|
4291
|
+
const given = this.toNaturalName()?.trim().split(/\s+/)[0] || id;
|
|
4292
|
+
return `https://www.geni.com/people/${given}/${id}`;
|
|
4293
|
+
}
|
|
4166
4294
|
familySearchLink() {
|
|
4167
4295
|
const wwwTags = this.get("WWW")?.toList();
|
|
4168
4296
|
const wwwTag = wwwTags?.find((wwwTag2) => {
|
|
@@ -4331,16 +4459,26 @@ var Indi = class extends Common {
|
|
|
4331
4459
|
return list;
|
|
4332
4460
|
}
|
|
4333
4461
|
async multimedia(namespace) {
|
|
4334
|
-
|
|
4335
|
-
|
|
4462
|
+
const lists = [];
|
|
4463
|
+
const ownObjes = this.get("OBJE")?.toList()?.values() ?? [];
|
|
4464
|
+
const ownAncestryMedia = ownObjes.some(
|
|
4465
|
+
(obje) => !!obje && (isAncestryOriginObje(obje) || isAncestryOriginObje(obje.ref))
|
|
4466
|
+
);
|
|
4467
|
+
if (this.isAncestry() || ownAncestryMedia) {
|
|
4468
|
+
lists.push(
|
|
4469
|
+
await this.ancestryMedia(
|
|
4470
|
+
namespace || this.getAncestryMediaNamespace()
|
|
4471
|
+
)
|
|
4472
|
+
);
|
|
4336
4473
|
}
|
|
4337
4474
|
if (this?.isMyHeritage()) {
|
|
4338
|
-
|
|
4475
|
+
lists.push(this.myheritageMedia());
|
|
4339
4476
|
}
|
|
4340
4477
|
if (this?.isGeni()) {
|
|
4341
|
-
|
|
4478
|
+
lists.push(this.geniMedia());
|
|
4342
4479
|
}
|
|
4343
|
-
|
|
4480
|
+
lists.push(this.universalMedia());
|
|
4481
|
+
return mergeMediaListsByObjeKey(...lists);
|
|
4344
4482
|
}
|
|
4345
4483
|
async getProfilePicture(namespace, onlyPrimary = true) {
|
|
4346
4484
|
if (!this.id) {
|
|
@@ -4433,12 +4571,15 @@ var Indi = class extends Common {
|
|
|
4433
4571
|
);
|
|
4434
4572
|
return void 0;
|
|
4435
4573
|
}
|
|
4436
|
-
link(poolId) {
|
|
4574
|
+
link(poolId, treeToken) {
|
|
4437
4575
|
if (this?.isAncestry()) {
|
|
4438
4576
|
return this.ancestryLink();
|
|
4439
4577
|
}
|
|
4440
4578
|
if (this?.isMyHeritage()) {
|
|
4441
|
-
return this.myheritageLink(poolId);
|
|
4579
|
+
return this.myheritageLink(poolId, treeToken);
|
|
4580
|
+
}
|
|
4581
|
+
if (this?.isGeni()) {
|
|
4582
|
+
return this.geniLink();
|
|
4442
4583
|
}
|
|
4443
4584
|
if (this?.isFamilySearch()) {
|
|
4444
4585
|
return this.familySearchLink();
|
|
@@ -6191,11 +6332,28 @@ var KinshipTranslatorBasic = class {
|
|
|
6191
6332
|
// src/kinship-translator/patterns.hu.ts
|
|
6192
6333
|
var parentRelationsHu = {
|
|
6193
6334
|
step: "mostoha",
|
|
6194
|
-
foster: "nevelt",
|
|
6335
|
+
foster: { ancestor: "nevel\u0151", other: "nevelt" },
|
|
6195
6336
|
birth: "v\xE9rszerinti",
|
|
6196
6337
|
biological: "v\xE9rszerinti",
|
|
6197
|
-
adopted: "\xF6r\xF6kbefogadott"
|
|
6338
|
+
adopted: { ancestor: "\xF6r\xF6kbefogad\xF3", other: "\xF6r\xF6kbefogadott" }
|
|
6339
|
+
};
|
|
6340
|
+
var parentRelationPrefix = (relation, ancestor) => {
|
|
6341
|
+
const label = parentRelationsHu[relation];
|
|
6342
|
+
if (!label) {
|
|
6343
|
+
return;
|
|
6344
|
+
}
|
|
6345
|
+
if (typeof label === "string") {
|
|
6346
|
+
return label;
|
|
6347
|
+
}
|
|
6348
|
+
return ancestor ? label.ancestor : label.other;
|
|
6198
6349
|
};
|
|
6350
|
+
var parentRelationModifiers = [
|
|
6351
|
+
...new Set(
|
|
6352
|
+
Object.values(parentRelationsHu).flatMap(
|
|
6353
|
+
(label) => typeof label === "string" ? [label] : [label.ancestor, label.other]
|
|
6354
|
+
)
|
|
6355
|
+
)
|
|
6356
|
+
].join("|");
|
|
6199
6357
|
var nominativus = {
|
|
6200
6358
|
apa: { nominativus: "apa", dativus: "apj\xE1nak", possessivus: "apja" },
|
|
6201
6359
|
anya: { nominativus: "anya", dativus: "anyj\xE1nak", possessivus: "anyja" },
|
|
@@ -6273,15 +6431,9 @@ var casesHu = {
|
|
|
6273
6431
|
var InLawsHu = {
|
|
6274
6432
|
"gyermek feles\xE9ge": "meny",
|
|
6275
6433
|
"gyermek f\xE9rje": "v\u0151",
|
|
6276
|
-
[`(f\xE9rj|feles\xE9g) (?<mod1>(${
|
|
6277
|
-
|
|
6278
|
-
)}) )?
|
|
6279
|
-
[`(f\xE9rj|feles\xE9g) (?<mod1>(${Object.values(parentRelationsHu).join(
|
|
6280
|
-
"|"
|
|
6281
|
-
)}) )?apja`]: "ap\xF3s",
|
|
6282
|
-
[`(f\xE9rj|feles\xE9g) (?<mod1>(${Object.values(parentRelationsHu).join(
|
|
6283
|
-
"|"
|
|
6284
|
-
)}) )?(f\xE9l)?testv\xE9re`]: (indi) => {
|
|
6434
|
+
[`(f\xE9rj|feles\xE9g) (?<mod1>(${parentRelationModifiers}) )?anyja`]: "any\xF3s",
|
|
6435
|
+
[`(f\xE9rj|feles\xE9g) (?<mod1>(${parentRelationModifiers}) )?apja`]: "ap\xF3s",
|
|
6436
|
+
[`(f\xE9rj|feles\xE9g) (?<mod1>(${parentRelationModifiers}) )?(f\xE9l)?testv\xE9re`]: (indi) => {
|
|
6285
6437
|
if (indi?.isMale()) {
|
|
6286
6438
|
return "s\xF3gor";
|
|
6287
6439
|
}
|
|
@@ -6558,7 +6710,12 @@ var KinshipTranslatorHU = class extends KinshipTranslatorBasic {
|
|
|
6558
6710
|
if (!relation || !this.pathN?.relation) {
|
|
6559
6711
|
return relation ?? "";
|
|
6560
6712
|
}
|
|
6561
|
-
|
|
6713
|
+
const isAncestor = (this.pathN.level ?? 0) > 0 && (this.pathN.degree ?? 0) === 0;
|
|
6714
|
+
const prefix = parentRelationPrefix(this.pathN.relation, isAncestor);
|
|
6715
|
+
if (!prefix) {
|
|
6716
|
+
return relation;
|
|
6717
|
+
}
|
|
6718
|
+
return `${prefix} ${relation}`;
|
|
6562
6719
|
}
|
|
6563
6720
|
};
|
|
6564
6721
|
|
|
@@ -6758,6 +6915,10 @@ var KinshipTranslatorEn = class extends KinshipTranslatorBasic {
|
|
|
6758
6915
|
if (!relation || !this.pathN?.relation) {
|
|
6759
6916
|
return relation ?? "";
|
|
6760
6917
|
}
|
|
6918
|
+
if (this.pathN.relation === "adopted") {
|
|
6919
|
+
const isAncestor = (this.pathN.level ?? 0) > 0 && (this.pathN.degree ?? 0) === 0;
|
|
6920
|
+
return `${isAncestor ? "adoptive" : "adopted"} ${relation}`;
|
|
6921
|
+
}
|
|
6761
6922
|
return `${this.pathN.relation} ${relation}`;
|
|
6762
6923
|
}
|
|
6763
6924
|
};
|
|
@@ -7916,6 +8077,39 @@ var lineal = (level, sex, kind) => {
|
|
|
7916
8077
|
}
|
|
7917
8078
|
return `${L - 1}\u4E16\u306E\u5B6B`;
|
|
7918
8079
|
};
|
|
8080
|
+
var adoptedRelation = (relation) => {
|
|
8081
|
+
if (relation === "\u7236") {
|
|
8082
|
+
return "\u990A\u7236";
|
|
8083
|
+
}
|
|
8084
|
+
if (relation === "\u6BCD") {
|
|
8085
|
+
return "\u990A\u6BCD";
|
|
8086
|
+
}
|
|
8087
|
+
if (relation === "\u89AA") {
|
|
8088
|
+
return "\u990A\u89AA";
|
|
8089
|
+
}
|
|
8090
|
+
if (relation === "\u606F\u5B50" || relation === "\u5B50") {
|
|
8091
|
+
return "\u990A\u5B50";
|
|
8092
|
+
}
|
|
8093
|
+
if (relation === "\u5A18") {
|
|
8094
|
+
return "\u990A\u5973";
|
|
8095
|
+
}
|
|
8096
|
+
return `\u990A${relation}`;
|
|
8097
|
+
};
|
|
8098
|
+
var fosterRelation = (relation) => {
|
|
8099
|
+
if (relation === "\u7236") {
|
|
8100
|
+
return "\u91CC\u7236";
|
|
8101
|
+
}
|
|
8102
|
+
if (relation === "\u6BCD") {
|
|
8103
|
+
return "\u91CC\u6BCD";
|
|
8104
|
+
}
|
|
8105
|
+
if (relation === "\u89AA") {
|
|
8106
|
+
return "\u91CC\u89AA";
|
|
8107
|
+
}
|
|
8108
|
+
if (relation === "\u606F\u5B50" || relation === "\u5A18" || relation === "\u5B50") {
|
|
8109
|
+
return "\u91CC\u5B50";
|
|
8110
|
+
}
|
|
8111
|
+
return `\u91CC${relation}`;
|
|
8112
|
+
};
|
|
7919
8113
|
var cousinPlain = (degree) => {
|
|
7920
8114
|
if (degree <= 1) {
|
|
7921
8115
|
return "\u3044\u3068\u3053";
|
|
@@ -8075,10 +8269,10 @@ var KinshipTranslatorJa = class extends KinshipTranslatorBasic {
|
|
|
8075
8269
|
return `\u7D99${relation}`;
|
|
8076
8270
|
}
|
|
8077
8271
|
if (this.pathN.relation === "adopted") {
|
|
8078
|
-
return
|
|
8272
|
+
return adoptedRelation(relation);
|
|
8079
8273
|
}
|
|
8080
8274
|
if (this.pathN.relation === "foster") {
|
|
8081
|
-
return
|
|
8275
|
+
return fosterRelation(relation);
|
|
8082
8276
|
}
|
|
8083
8277
|
return relation;
|
|
8084
8278
|
}
|