@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/constants/index.js
CHANGED
|
@@ -409,6 +409,30 @@ var mediaIdValue = (obje, path) => {
|
|
|
409
409
|
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
410
410
|
};
|
|
411
411
|
var resolveObjeMediaId = (obje) => mediaIdValue(obje, "RIN") || mediaIdValue(obje, "_CLON._OID") || mediaIdValue(obje, "_MSER._LKID") || mediaIdValue(obje, "_OID") || mediaIdValue(obje, "_LKID");
|
|
412
|
+
var ANCESTRY_TREE_MEDIA_NAMESPACE = 1093;
|
|
413
|
+
var ANCESTRY_NAMESPACE_IN_URL = /\/namespaces\/(\d+)\/media\//i;
|
|
414
|
+
var parseAncestryNamespaceFromUrl = (url) => {
|
|
415
|
+
if (!url) {
|
|
416
|
+
return void 0;
|
|
417
|
+
}
|
|
418
|
+
const match = url.match(ANCESTRY_NAMESPACE_IN_URL);
|
|
419
|
+
const namespace = match?.[1] ? Number(match[1]) : NaN;
|
|
420
|
+
return Number.isFinite(namespace) ? namespace : void 0;
|
|
421
|
+
};
|
|
422
|
+
var isAncestryOriginObje = (obje) => {
|
|
423
|
+
if (!obje) {
|
|
424
|
+
return false;
|
|
425
|
+
}
|
|
426
|
+
const orig = mediaIdValue(obje, "_ORIG");
|
|
427
|
+
if (orig?.toLowerCase() === "acom") {
|
|
428
|
+
return true;
|
|
429
|
+
}
|
|
430
|
+
const file = mediaIdValue(obje, "FILE") ?? "";
|
|
431
|
+
if (parseAncestryNamespaceFromUrl(file)) {
|
|
432
|
+
return true;
|
|
433
|
+
}
|
|
434
|
+
return Boolean(resolveObjeMediaId(obje) && !file.trim());
|
|
435
|
+
};
|
|
412
436
|
var ANCESTRY_MEDIA_RETRIEVAL_PREFIX = "https://www.ancestry.com/api/media/retrieval/v2/image";
|
|
413
437
|
var ANCESTRY_MEDIA_QUERY = "client=trees-mediaservice&imageQuality=hq";
|
|
414
438
|
var ancestryMediaPath = (namespace, imgId) => `/namespaces/${namespace}/media/${imgId}?${ANCESTRY_MEDIA_QUERY}`;
|
|
@@ -784,8 +808,25 @@ var Common = class _Common {
|
|
|
784
808
|
getHeadRecord() {
|
|
785
809
|
return get(this, "HEAD") || get(this.getGedcom(), "HEAD");
|
|
786
810
|
}
|
|
811
|
+
unwrapHeadRecord(node) {
|
|
812
|
+
if (!node) {
|
|
813
|
+
return void 0;
|
|
814
|
+
}
|
|
815
|
+
const common = node instanceof List ? node.index(0) : node;
|
|
816
|
+
if (!common || typeof common.get !== "function") {
|
|
817
|
+
return void 0;
|
|
818
|
+
}
|
|
819
|
+
const nested = common.get("HEAD");
|
|
820
|
+
if (nested instanceof List) {
|
|
821
|
+
return nested.index(0) ?? common;
|
|
822
|
+
}
|
|
823
|
+
if (nested instanceof _Common) {
|
|
824
|
+
return nested;
|
|
825
|
+
}
|
|
826
|
+
return common;
|
|
827
|
+
}
|
|
787
828
|
getOriginalHeadRecord() {
|
|
788
|
-
return get(this, ORIG_HEAD_TAG) || get(this.getGedcom(), ORIG_HEAD_TAG) || get(this.getHeadRecord(), ORIG_HEAD_TAG);
|
|
829
|
+
return this.unwrapHeadRecord(get(this, ORIG_HEAD_TAG)) || this.unwrapHeadRecord(get(this.getGedcom(), ORIG_HEAD_TAG)) || this.unwrapHeadRecord(get(this.getHeadRecord(), ORIG_HEAD_TAG));
|
|
789
830
|
}
|
|
790
831
|
getSourceHeads() {
|
|
791
832
|
const heads = [this.getOriginalHeadRecord(), this.getHeadRecord()];
|
|
@@ -793,9 +834,23 @@ var Common = class _Common {
|
|
|
793
834
|
return Boolean(head && heads.indexOf(head) === index);
|
|
794
835
|
});
|
|
795
836
|
}
|
|
837
|
+
sourceHeadField(head, path) {
|
|
838
|
+
const normalized = path.endsWith(".value") ? path.slice(0, -".value".length) : path;
|
|
839
|
+
const node = head.get(normalized);
|
|
840
|
+
if (!node) {
|
|
841
|
+
return void 0;
|
|
842
|
+
}
|
|
843
|
+
if (node instanceof List) {
|
|
844
|
+
return node.index(0)?.toValue();
|
|
845
|
+
}
|
|
846
|
+
if (typeof node.toValue === "function") {
|
|
847
|
+
return node.toValue();
|
|
848
|
+
}
|
|
849
|
+
return void 0;
|
|
850
|
+
}
|
|
796
851
|
getFromSourceHeads(path) {
|
|
797
852
|
for (const head of this.getSourceHeads()) {
|
|
798
|
-
const value =
|
|
853
|
+
const value = this.sourceHeadField(head, path);
|
|
799
854
|
if (value !== void 0 && value !== null && value !== "") {
|
|
800
855
|
return value;
|
|
801
856
|
}
|
|
@@ -804,8 +859,8 @@ var Common = class _Common {
|
|
|
804
859
|
}
|
|
805
860
|
sourStartsWith(prefix) {
|
|
806
861
|
return this.getSourceHeads().some((head) => {
|
|
807
|
-
const sour =
|
|
808
|
-
return
|
|
862
|
+
const sour = this.sourceHeadField(head, "SOUR");
|
|
863
|
+
return typeof sour === "string" && sour.toLowerCase().startsWith(prefix);
|
|
809
864
|
});
|
|
810
865
|
}
|
|
811
866
|
isGenoPro() {
|
|
@@ -815,7 +870,7 @@ var Common = class _Common {
|
|
|
815
870
|
return this.sourStartsWith("ahnenblatt");
|
|
816
871
|
}
|
|
817
872
|
isGeni() {
|
|
818
|
-
return this.sourStartsWith("geni");
|
|
873
|
+
return this.sourStartsWith("geni.com");
|
|
819
874
|
}
|
|
820
875
|
isAncestry() {
|
|
821
876
|
return this.sourStartsWith("ancestry");
|
|
@@ -823,6 +878,51 @@ var Common = class _Common {
|
|
|
823
878
|
isMyHeritage() {
|
|
824
879
|
return this.sourStartsWith("myheritage");
|
|
825
880
|
}
|
|
881
|
+
/**
|
|
882
|
+
* GEDCOM root for Ancestry media helpers.
|
|
883
|
+
* `this._gedcom` when called on a child record; `this` when called on the file root.
|
|
884
|
+
*
|
|
885
|
+
* Cannot use `instanceof GedCom`: `GedComType` is a type alias (erased at runtime),
|
|
886
|
+
* and importing the `GedCom` class here would cycle (`GedCom extends Common`).
|
|
887
|
+
* The root is the only Common with an `objes()` method.
|
|
888
|
+
*/
|
|
889
|
+
hostGedcom() {
|
|
890
|
+
const linked = this.getGedcom();
|
|
891
|
+
if (linked) {
|
|
892
|
+
return linked;
|
|
893
|
+
}
|
|
894
|
+
if ("objes" in this && typeof this.objes === "function") {
|
|
895
|
+
return this;
|
|
896
|
+
}
|
|
897
|
+
return void 0;
|
|
898
|
+
}
|
|
899
|
+
/** True when the file still has Ancestry tree media (`_ORIG acom`, `_OID`, retrieval URL). */
|
|
900
|
+
hasAncestryOriginMedia() {
|
|
901
|
+
const objes = this.hostGedcom()?.objes?.();
|
|
902
|
+
return objes?.values().some((obje) => isAncestryOriginObje(obje)) ?? false;
|
|
903
|
+
}
|
|
904
|
+
/**
|
|
905
|
+
* Namespace for Ancestry tree photos. Prefer a `namespaces/{id}` FILE URL
|
|
906
|
+
* (TreeViz GEDCOM 7 / GEDZIP export), otherwise 1093 for member-tree media.
|
|
907
|
+
*/
|
|
908
|
+
getAncestryMediaNamespace() {
|
|
909
|
+
const objes = this.hostGedcom()?.objes?.();
|
|
910
|
+
if (objes) {
|
|
911
|
+
for (const obje of objes.values()) {
|
|
912
|
+
const file = obje?.get("FILE")?.toValue();
|
|
913
|
+
const fromUrl = parseAncestryNamespaceFromUrl(
|
|
914
|
+
typeof file === "string" ? file : void 0
|
|
915
|
+
);
|
|
916
|
+
if (fromUrl) {
|
|
917
|
+
return fromUrl;
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
if (this.isAncestry() || this.hasAncestryOriginMedia()) {
|
|
922
|
+
return ANCESTRY_TREE_MEDIA_NAMESPACE;
|
|
923
|
+
}
|
|
924
|
+
return void 0;
|
|
925
|
+
}
|
|
826
926
|
/**
|
|
827
927
|
* Get the source type as a string (for prefixing tree IDs and names)
|
|
828
928
|
* Returns the detected source type or undefined if unknown
|
|
@@ -839,13 +939,13 @@ var Common = class _Common {
|
|
|
839
939
|
}
|
|
840
940
|
isFamilySearch() {
|
|
841
941
|
return this.getSourceHeads().some((head) => {
|
|
842
|
-
const sourName =
|
|
942
|
+
const sourName = this.sourceHeadField(head, "SOUR.NAME");
|
|
843
943
|
return sourName === "FamilySearch API";
|
|
844
944
|
});
|
|
845
945
|
}
|
|
846
946
|
isGNO2GED() {
|
|
847
947
|
return this.getSourceHeads().some((head) => {
|
|
848
|
-
const sour =
|
|
948
|
+
const sour = this.sourceHeadField(head, "SOUR");
|
|
849
949
|
return sour === "GNO2GED";
|
|
850
950
|
});
|
|
851
951
|
}
|
|
@@ -890,8 +990,7 @@ var Common = class _Common {
|
|
|
890
990
|
return this.getFromSourceHeads("SOUR._TREE.value") || (get(this, "HEAD.SOUR._TREE.value") || get(this.getGedcom(), "HEAD.SOUR._TREE.value"));
|
|
891
991
|
}
|
|
892
992
|
getMyHeritageTreeName() {
|
|
893
|
-
const
|
|
894
|
-
const treeDetails = get(this, path) || get(this.getGedcom(), path);
|
|
993
|
+
const treeDetails = this.getFromSourceHeads("FILE.value") || (get(this, "HEAD.FILE.value") || get(this.getGedcom(), "HEAD.FILE.value"));
|
|
895
994
|
return treeDetails?.match(
|
|
896
995
|
/Exported by MyHeritage.com from (?<tree>.+) in.+$/
|
|
897
996
|
)?.groups?.tree;
|
|
@@ -908,7 +1007,7 @@ var Common = class _Common {
|
|
|
908
1007
|
if (treeName) {
|
|
909
1008
|
return treeName;
|
|
910
1009
|
}
|
|
911
|
-
const fileName = get(this, "HEAD.FILE.value") || get(this.getGedcom(), "HEAD.FILE.value");
|
|
1010
|
+
const fileName = this.getFromSourceHeads("FILE.value") || get(this, "HEAD.FILE.value") || get(this.getGedcom(), "HEAD.FILE.value");
|
|
912
1011
|
return fileName || "FamilySearch Import";
|
|
913
1012
|
}
|
|
914
1013
|
getAhnenblattTreeId() {
|
|
@@ -2273,6 +2372,28 @@ var resolveLocalMediaUrl = async (path, context) => {
|
|
|
2273
2372
|
};
|
|
2274
2373
|
var implemented = (type, ...args) => {
|
|
2275
2374
|
};
|
|
2375
|
+
|
|
2376
|
+
// src/utils/multimedia.ts
|
|
2377
|
+
var mergeMediaListsByObjeKey = (...lists) => {
|
|
2378
|
+
const merged = {};
|
|
2379
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2380
|
+
for (const list of lists) {
|
|
2381
|
+
if (!list) {
|
|
2382
|
+
continue;
|
|
2383
|
+
}
|
|
2384
|
+
for (const [id, item] of Object.entries(list)) {
|
|
2385
|
+
const objeKey = item.key ? String(item.key) : "";
|
|
2386
|
+
if (objeKey && seen.has(objeKey)) {
|
|
2387
|
+
continue;
|
|
2388
|
+
}
|
|
2389
|
+
merged[id] = item;
|
|
2390
|
+
if (objeKey) {
|
|
2391
|
+
seen.add(objeKey);
|
|
2392
|
+
}
|
|
2393
|
+
}
|
|
2394
|
+
}
|
|
2395
|
+
return merged;
|
|
2396
|
+
};
|
|
2276
2397
|
var uniqueItemsCache = /* @__PURE__ */ new WeakMap();
|
|
2277
2398
|
var setNestedGroup = (obj, key, value, uniqueCounting = true) => {
|
|
2278
2399
|
const parts = Array.isArray(key) ? key : key.split(/,\s*/);
|
|
@@ -3046,10 +3167,12 @@ var relativesOnLevelCache = relativesCache("relativesOnLevelCache");
|
|
|
3046
3167
|
var relativesOnDegreeCache = relativesCache("relativesOnDegreeCache");
|
|
3047
3168
|
var Indi = class extends Common {
|
|
3048
3169
|
toName() {
|
|
3049
|
-
|
|
3170
|
+
const name = this.get("NAME");
|
|
3171
|
+
const value = name?.index(0)?.toValue() ?? name?.toValue();
|
|
3172
|
+
return typeof value === "string" ? value : void 0;
|
|
3050
3173
|
}
|
|
3051
3174
|
toNaturalName() {
|
|
3052
|
-
return this.
|
|
3175
|
+
return this.toName()?.replaceAll("/", "");
|
|
3053
3176
|
}
|
|
3054
3177
|
toList() {
|
|
3055
3178
|
return new Individuals().concat(
|
|
@@ -3532,7 +3655,10 @@ var Indi = class extends Common {
|
|
|
3532
3655
|
return result;
|
|
3533
3656
|
}
|
|
3534
3657
|
ancestryLink() {
|
|
3535
|
-
|
|
3658
|
+
let www = this.getFromSourceHeads("SOUR.CORP.WWW.value") || this._gedcom?.HEAD?.SOUR?.CORP?.WWW?.value;
|
|
3659
|
+
if (!www || /treeviz/i.test(String(www))) {
|
|
3660
|
+
www = "www.ancestry.com";
|
|
3661
|
+
}
|
|
3536
3662
|
const tree = this.getAncestryTreeId();
|
|
3537
3663
|
if (this.id) {
|
|
3538
3664
|
return `https://${www}/family-tree/person/tree/${tree}/person/${this.id.replace(
|
|
@@ -3544,14 +3670,15 @@ var Indi = class extends Common {
|
|
|
3544
3670
|
async ancestryMedia(namespace) {
|
|
3545
3671
|
const list = {};
|
|
3546
3672
|
const objeList = this.get("OBJE")?.toList().copy();
|
|
3547
|
-
|
|
3673
|
+
this.getFromSourceHeads("SOUR.CORP.WWW.value") || this._gedcom?.HEAD?.SOUR?.CORP?.WWW?.value;
|
|
3548
3674
|
const tree = this.getAncestryTreeId();
|
|
3675
|
+
const usedNamespace = namespace || this.getAncestryMediaNamespace() || ANCESTRY_TREE_MEDIA_NAMESPACE;
|
|
3549
3676
|
if (objeList) {
|
|
3550
3677
|
await Promise.all(
|
|
3551
3678
|
objeList.map(async (objeRef) => {
|
|
3552
3679
|
const key = objeXrefKey(objeRef, 0);
|
|
3553
3680
|
const obje = objeRef?.standardizeMedia(
|
|
3554
|
-
|
|
3681
|
+
usedNamespace,
|
|
3555
3682
|
true,
|
|
3556
3683
|
ancestryMediaFileUrl
|
|
3557
3684
|
);
|
|
@@ -3563,27 +3690,9 @@ var Indi = class extends Common {
|
|
|
3563
3690
|
const type = resolveObjeForm(obje) ?? (url ? getFileExtension(url) : void 0) ?? "raw";
|
|
3564
3691
|
let imgId = media;
|
|
3565
3692
|
const hasEmbeddedOrLocalFile = !!url && (url.startsWith("data:") || url.startsWith("blob:") || !/^https?:\/\//i.test(url));
|
|
3566
|
-
if (!hasEmbeddedOrLocalFile && (!www || !tree || !this.id)) {
|
|
3567
|
-
return;
|
|
3568
|
-
}
|
|
3569
3693
|
if (!this.id) {
|
|
3570
3694
|
return;
|
|
3571
3695
|
}
|
|
3572
|
-
if (!namespace && !url) {
|
|
3573
|
-
try {
|
|
3574
|
-
if (media) {
|
|
3575
|
-
const mediaDetailsResponse = await fetch(
|
|
3576
|
-
`https://www.ancestry.com/api/media/viewer/v2/trees/${tree}/media?id=${media}`
|
|
3577
|
-
);
|
|
3578
|
-
const mediaDetails = await mediaDetailsResponse.json();
|
|
3579
|
-
if (mediaDetails.url) {
|
|
3580
|
-
url = `${mediaDetails.url}&imageQuality=hq`;
|
|
3581
|
-
}
|
|
3582
|
-
}
|
|
3583
|
-
} catch (_e) {
|
|
3584
|
-
}
|
|
3585
|
-
url = url || `https://${www}/mediaui-viewer/tree/${tree}/media/${media}`;
|
|
3586
|
-
}
|
|
3587
3696
|
if (!imgId && hasEmbeddedOrLocalFile && url) {
|
|
3588
3697
|
imgId = typeof media === "string" && media || `local-${String(key).replace(/[@]/g, "")}-${getFileExtension(url) || "bin"}`;
|
|
3589
3698
|
}
|
|
@@ -3608,14 +3717,25 @@ var Indi = class extends Common {
|
|
|
3608
3717
|
}
|
|
3609
3718
|
return list;
|
|
3610
3719
|
}
|
|
3611
|
-
myheritageLink(poolId = 0) {
|
|
3612
|
-
|
|
3720
|
+
myheritageLink(poolId = 0, treeToken) {
|
|
3721
|
+
let www = (this.getFromSourceHeads("SOUR.CORP.value") || this._gedcom?.HEAD?.SOUR?.CORP?.value)?.toLowerCase().replace(/^www\./gi, "");
|
|
3722
|
+
if (!www || /treeviz/i.test(www)) {
|
|
3723
|
+
www = "myheritage.com";
|
|
3724
|
+
}
|
|
3725
|
+
if (!this.id) {
|
|
3726
|
+
return;
|
|
3727
|
+
}
|
|
3728
|
+
const id = Number(this.id.replace(/@|I/g, "")) + poolId;
|
|
3729
|
+
if (!Number.isFinite(id)) {
|
|
3730
|
+
return;
|
|
3731
|
+
}
|
|
3732
|
+
const slug = this.toNaturalName()?.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "") || String(id);
|
|
3733
|
+
if (treeToken) {
|
|
3734
|
+
return `https://www.${www}/profile-${treeToken}-${id}/${slug}`;
|
|
3735
|
+
}
|
|
3613
3736
|
const site = this.getMyHeritageTreeId();
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
if (normalizedFile && this.id) {
|
|
3617
|
-
const id = Number(this.id.replace(/@|I/g, "")) + poolId;
|
|
3618
|
-
return `https://www.${www}/site-family-tree-${site}/${normalizedFile}#!profile-${id}-info`;
|
|
3737
|
+
if (site) {
|
|
3738
|
+
return `https://www.${www}/person-${id}_${site}_${site}/${slug}`;
|
|
3619
3739
|
}
|
|
3620
3740
|
}
|
|
3621
3741
|
myheritageMedia() {
|
|
@@ -3664,6 +3784,14 @@ var Indi = class extends Common {
|
|
|
3664
3784
|
});
|
|
3665
3785
|
return list;
|
|
3666
3786
|
}
|
|
3787
|
+
geniLink() {
|
|
3788
|
+
if (!this.id) {
|
|
3789
|
+
return;
|
|
3790
|
+
}
|
|
3791
|
+
const id = this.id.replace(/@|I/g, "");
|
|
3792
|
+
const given = this.toNaturalName()?.trim().split(/\s+/)[0] || id;
|
|
3793
|
+
return `https://www.geni.com/people/${given}/${id}`;
|
|
3794
|
+
}
|
|
3667
3795
|
familySearchLink() {
|
|
3668
3796
|
const wwwTags = this.get("WWW")?.toList();
|
|
3669
3797
|
const wwwTag = wwwTags?.find((wwwTag2) => {
|
|
@@ -3832,16 +3960,26 @@ var Indi = class extends Common {
|
|
|
3832
3960
|
return list;
|
|
3833
3961
|
}
|
|
3834
3962
|
async multimedia(namespace) {
|
|
3835
|
-
|
|
3836
|
-
|
|
3963
|
+
const lists = [];
|
|
3964
|
+
const ownObjes = this.get("OBJE")?.toList()?.values() ?? [];
|
|
3965
|
+
const ownAncestryMedia = ownObjes.some(
|
|
3966
|
+
(obje) => !!obje && (isAncestryOriginObje(obje) || isAncestryOriginObje(obje.ref))
|
|
3967
|
+
);
|
|
3968
|
+
if (this.isAncestry() || ownAncestryMedia) {
|
|
3969
|
+
lists.push(
|
|
3970
|
+
await this.ancestryMedia(
|
|
3971
|
+
namespace || this.getAncestryMediaNamespace()
|
|
3972
|
+
)
|
|
3973
|
+
);
|
|
3837
3974
|
}
|
|
3838
3975
|
if (this?.isMyHeritage()) {
|
|
3839
|
-
|
|
3976
|
+
lists.push(this.myheritageMedia());
|
|
3840
3977
|
}
|
|
3841
3978
|
if (this?.isGeni()) {
|
|
3842
|
-
|
|
3979
|
+
lists.push(this.geniMedia());
|
|
3843
3980
|
}
|
|
3844
|
-
|
|
3981
|
+
lists.push(this.universalMedia());
|
|
3982
|
+
return mergeMediaListsByObjeKey(...lists);
|
|
3845
3983
|
}
|
|
3846
3984
|
async getProfilePicture(namespace, onlyPrimary = true) {
|
|
3847
3985
|
if (!this.id) {
|
|
@@ -3934,12 +4072,15 @@ var Indi = class extends Common {
|
|
|
3934
4072
|
);
|
|
3935
4073
|
return void 0;
|
|
3936
4074
|
}
|
|
3937
|
-
link(poolId) {
|
|
4075
|
+
link(poolId, treeToken) {
|
|
3938
4076
|
if (this?.isAncestry()) {
|
|
3939
4077
|
return this.ancestryLink();
|
|
3940
4078
|
}
|
|
3941
4079
|
if (this?.isMyHeritage()) {
|
|
3942
|
-
return this.myheritageLink(poolId);
|
|
4080
|
+
return this.myheritageLink(poolId, treeToken);
|
|
4081
|
+
}
|
|
4082
|
+
if (this?.isGeni()) {
|
|
4083
|
+
return this.geniLink();
|
|
3943
4084
|
}
|
|
3944
4085
|
if (this?.isFamilySearch()) {
|
|
3945
4086
|
return this.familySearchLink();
|
|
@@ -5692,11 +5833,28 @@ var KinshipTranslatorBasic = class {
|
|
|
5692
5833
|
// src/kinship-translator/patterns.hu.ts
|
|
5693
5834
|
var parentRelationsHu = {
|
|
5694
5835
|
step: "mostoha",
|
|
5695
|
-
foster: "nevelt",
|
|
5836
|
+
foster: { ancestor: "nevel\u0151", other: "nevelt" },
|
|
5696
5837
|
birth: "v\xE9rszerinti",
|
|
5697
5838
|
biological: "v\xE9rszerinti",
|
|
5698
|
-
adopted: "\xF6r\xF6kbefogadott"
|
|
5839
|
+
adopted: { ancestor: "\xF6r\xF6kbefogad\xF3", other: "\xF6r\xF6kbefogadott" }
|
|
5840
|
+
};
|
|
5841
|
+
var parentRelationPrefix = (relation, ancestor) => {
|
|
5842
|
+
const label = parentRelationsHu[relation];
|
|
5843
|
+
if (!label) {
|
|
5844
|
+
return;
|
|
5845
|
+
}
|
|
5846
|
+
if (typeof label === "string") {
|
|
5847
|
+
return label;
|
|
5848
|
+
}
|
|
5849
|
+
return ancestor ? label.ancestor : label.other;
|
|
5699
5850
|
};
|
|
5851
|
+
var parentRelationModifiers = [
|
|
5852
|
+
...new Set(
|
|
5853
|
+
Object.values(parentRelationsHu).flatMap(
|
|
5854
|
+
(label) => typeof label === "string" ? [label] : [label.ancestor, label.other]
|
|
5855
|
+
)
|
|
5856
|
+
)
|
|
5857
|
+
].join("|");
|
|
5700
5858
|
var nominativus = {
|
|
5701
5859
|
apa: { nominativus: "apa", dativus: "apj\xE1nak", possessivus: "apja" },
|
|
5702
5860
|
anya: { nominativus: "anya", dativus: "anyj\xE1nak", possessivus: "anyja" },
|
|
@@ -5774,15 +5932,9 @@ var casesHu = {
|
|
|
5774
5932
|
var InLawsHu = {
|
|
5775
5933
|
"gyermek feles\xE9ge": "meny",
|
|
5776
5934
|
"gyermek f\xE9rje": "v\u0151",
|
|
5777
|
-
[`(f\xE9rj|feles\xE9g) (?<mod1>(${
|
|
5778
|
-
|
|
5779
|
-
)}) )?
|
|
5780
|
-
[`(f\xE9rj|feles\xE9g) (?<mod1>(${Object.values(parentRelationsHu).join(
|
|
5781
|
-
"|"
|
|
5782
|
-
)}) )?apja`]: "ap\xF3s",
|
|
5783
|
-
[`(f\xE9rj|feles\xE9g) (?<mod1>(${Object.values(parentRelationsHu).join(
|
|
5784
|
-
"|"
|
|
5785
|
-
)}) )?(f\xE9l)?testv\xE9re`]: (indi) => {
|
|
5935
|
+
[`(f\xE9rj|feles\xE9g) (?<mod1>(${parentRelationModifiers}) )?anyja`]: "any\xF3s",
|
|
5936
|
+
[`(f\xE9rj|feles\xE9g) (?<mod1>(${parentRelationModifiers}) )?apja`]: "ap\xF3s",
|
|
5937
|
+
[`(f\xE9rj|feles\xE9g) (?<mod1>(${parentRelationModifiers}) )?(f\xE9l)?testv\xE9re`]: (indi) => {
|
|
5786
5938
|
if (indi?.isMale()) {
|
|
5787
5939
|
return "s\xF3gor";
|
|
5788
5940
|
}
|
|
@@ -6059,7 +6211,12 @@ var KinshipTranslatorHU = class extends KinshipTranslatorBasic {
|
|
|
6059
6211
|
if (!relation || !this.pathN?.relation) {
|
|
6060
6212
|
return relation ?? "";
|
|
6061
6213
|
}
|
|
6062
|
-
|
|
6214
|
+
const isAncestor = (this.pathN.level ?? 0) > 0 && (this.pathN.degree ?? 0) === 0;
|
|
6215
|
+
const prefix = parentRelationPrefix(this.pathN.relation, isAncestor);
|
|
6216
|
+
if (!prefix) {
|
|
6217
|
+
return relation;
|
|
6218
|
+
}
|
|
6219
|
+
return `${prefix} ${relation}`;
|
|
6063
6220
|
}
|
|
6064
6221
|
};
|
|
6065
6222
|
|
|
@@ -6259,6 +6416,10 @@ var KinshipTranslatorEn = class extends KinshipTranslatorBasic {
|
|
|
6259
6416
|
if (!relation || !this.pathN?.relation) {
|
|
6260
6417
|
return relation ?? "";
|
|
6261
6418
|
}
|
|
6419
|
+
if (this.pathN.relation === "adopted") {
|
|
6420
|
+
const isAncestor = (this.pathN.level ?? 0) > 0 && (this.pathN.degree ?? 0) === 0;
|
|
6421
|
+
return `${isAncestor ? "adoptive" : "adopted"} ${relation}`;
|
|
6422
|
+
}
|
|
6262
6423
|
return `${this.pathN.relation} ${relation}`;
|
|
6263
6424
|
}
|
|
6264
6425
|
};
|
|
@@ -7417,6 +7578,39 @@ var lineal = (level, sex, kind) => {
|
|
|
7417
7578
|
}
|
|
7418
7579
|
return `${L - 1}\u4E16\u306E\u5B6B`;
|
|
7419
7580
|
};
|
|
7581
|
+
var adoptedRelation = (relation) => {
|
|
7582
|
+
if (relation === "\u7236") {
|
|
7583
|
+
return "\u990A\u7236";
|
|
7584
|
+
}
|
|
7585
|
+
if (relation === "\u6BCD") {
|
|
7586
|
+
return "\u990A\u6BCD";
|
|
7587
|
+
}
|
|
7588
|
+
if (relation === "\u89AA") {
|
|
7589
|
+
return "\u990A\u89AA";
|
|
7590
|
+
}
|
|
7591
|
+
if (relation === "\u606F\u5B50" || relation === "\u5B50") {
|
|
7592
|
+
return "\u990A\u5B50";
|
|
7593
|
+
}
|
|
7594
|
+
if (relation === "\u5A18") {
|
|
7595
|
+
return "\u990A\u5973";
|
|
7596
|
+
}
|
|
7597
|
+
return `\u990A${relation}`;
|
|
7598
|
+
};
|
|
7599
|
+
var fosterRelation = (relation) => {
|
|
7600
|
+
if (relation === "\u7236") {
|
|
7601
|
+
return "\u91CC\u7236";
|
|
7602
|
+
}
|
|
7603
|
+
if (relation === "\u6BCD") {
|
|
7604
|
+
return "\u91CC\u6BCD";
|
|
7605
|
+
}
|
|
7606
|
+
if (relation === "\u89AA") {
|
|
7607
|
+
return "\u91CC\u89AA";
|
|
7608
|
+
}
|
|
7609
|
+
if (relation === "\u606F\u5B50" || relation === "\u5A18" || relation === "\u5B50") {
|
|
7610
|
+
return "\u91CC\u5B50";
|
|
7611
|
+
}
|
|
7612
|
+
return `\u91CC${relation}`;
|
|
7613
|
+
};
|
|
7420
7614
|
var cousinPlain = (degree) => {
|
|
7421
7615
|
if (degree <= 1) {
|
|
7422
7616
|
return "\u3044\u3068\u3053";
|
|
@@ -7576,10 +7770,10 @@ var KinshipTranslatorJa = class extends KinshipTranslatorBasic {
|
|
|
7576
7770
|
return `\u7D99${relation}`;
|
|
7577
7771
|
}
|
|
7578
7772
|
if (this.pathN.relation === "adopted") {
|
|
7579
|
-
return
|
|
7773
|
+
return adoptedRelation(relation);
|
|
7580
7774
|
}
|
|
7581
7775
|
if (this.pathN.relation === "foster") {
|
|
7582
|
-
return
|
|
7776
|
+
return fosterRelation(relation);
|
|
7583
7777
|
}
|
|
7584
7778
|
return relation;
|
|
7585
7779
|
}
|