@treeviz/gedcom-parser 2.1.8 → 2.1.11
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.map +1 -1
- package/dist/classes/gedcom.d.ts +5 -0
- package/dist/classes/gedcom.d.ts.map +1 -1
- package/dist/classes/index.js +588 -75
- package/dist/classes/indi.d.ts.map +1 -1
- package/dist/classes/obje.d.ts.map +1 -1
- package/dist/cli/index.js +588 -75
- package/dist/constants/index.js +557 -70
- package/dist/factories/index.js +557 -70
- package/dist/index.js +593 -85
- package/dist/interfaces/indi.d.ts +1 -0
- package/dist/interfaces/indi.d.ts.map +1 -1
- package/dist/kinship-translator/index.d.ts +2 -0
- package/dist/kinship-translator/index.d.ts.map +1 -1
- package/dist/kinship-translator/index.js +558 -71
- package/dist/kinship-translator/kinship-translator.ja.d.ts +18 -0
- package/dist/kinship-translator/kinship-translator.ja.d.ts.map +1 -0
- package/dist/kinship-translator/kinship-translator.zh.d.ts +18 -0
- package/dist/kinship-translator/kinship-translator.zh.d.ts.map +1 -0
- package/dist/kinship-translator/patterns.ja.d.ts +2 -0
- package/dist/kinship-translator/patterns.ja.d.ts.map +1 -0
- package/dist/kinship-translator/patterns.zh.d.ts +2 -0
- package/dist/kinship-translator/patterns.zh.d.ts.map +1 -0
- package/dist/kinship-translator/translators.d.ts +2 -0
- package/dist/kinship-translator/translators.d.ts.map +1 -1
- package/dist/kinship-translator/types.d.ts +1 -1
- package/dist/kinship-translator/types.d.ts.map +1 -1
- package/dist/utils/cache.d.ts.map +1 -1
- package/dist/utils/gedzip.d.ts.map +1 -1
- package/dist/utils/index.js +593 -85
- package/dist/utils/local-media.d.ts +7 -3
- package/dist/utils/local-media.d.ts.map +1 -1
- package/dist/utils/media-utils.d.ts +20 -0
- package/dist/utils/media-utils.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -35,6 +35,82 @@ var appendGedcomTrailer = (serialized) => {
|
|
|
35
35
|
}
|
|
36
36
|
return `${trimmed}${newline}0 TRLR`;
|
|
37
37
|
};
|
|
38
|
+
|
|
39
|
+
// src/utils/media-utils.ts
|
|
40
|
+
var getFileExtension = (filename) => {
|
|
41
|
+
if (!filename) {
|
|
42
|
+
return "";
|
|
43
|
+
}
|
|
44
|
+
if (filename.startsWith("data:")) {
|
|
45
|
+
const mime = filename.slice(5).split(";")[0] || "";
|
|
46
|
+
const subtype = (mime.split("/")[1] || "").toLowerCase();
|
|
47
|
+
if (subtype === "jpeg") {
|
|
48
|
+
return "jpg";
|
|
49
|
+
}
|
|
50
|
+
return subtype.split("+")[0] || "";
|
|
51
|
+
}
|
|
52
|
+
const withoutQuery = filename.split(/[?#]/)[0] || filename;
|
|
53
|
+
const match = withoutQuery.match(/\.([^.]+)$/);
|
|
54
|
+
return match ? match[1].toLowerCase() : "";
|
|
55
|
+
};
|
|
56
|
+
var isImageFormat = (format2) => {
|
|
57
|
+
if (!format2) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
let normalized = format2.toLowerCase().trim();
|
|
61
|
+
if (normalized.startsWith("data:")) {
|
|
62
|
+
normalized = getFileExtension(normalized);
|
|
63
|
+
} else if (normalized.includes("/")) {
|
|
64
|
+
normalized = normalized.split("/")[1]?.split("+")[0] || "";
|
|
65
|
+
if (normalized === "jpeg") {
|
|
66
|
+
normalized = "jpg";
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const imageFormats = [
|
|
70
|
+
"jpg",
|
|
71
|
+
"jpeg",
|
|
72
|
+
"png",
|
|
73
|
+
"gif",
|
|
74
|
+
"bmp",
|
|
75
|
+
"webp",
|
|
76
|
+
"svg",
|
|
77
|
+
"tiff",
|
|
78
|
+
"tif"
|
|
79
|
+
];
|
|
80
|
+
return imageFormats.includes(normalized);
|
|
81
|
+
};
|
|
82
|
+
var resolveObjeForm = (obje) => {
|
|
83
|
+
const value = obje?.get?.("FILE.FORM")?.toValue?.() ?? obje?.get?.("FORM")?.toValue?.();
|
|
84
|
+
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
85
|
+
};
|
|
86
|
+
var mediaIdValue = (obje, path) => {
|
|
87
|
+
const value = obje?.get?.(path)?.toValue?.();
|
|
88
|
+
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
89
|
+
};
|
|
90
|
+
var resolveObjeMediaId = (obje) => mediaIdValue(obje, "RIN") || mediaIdValue(obje, "_CLON._OID") || mediaIdValue(obje, "_MSER._LKID") || mediaIdValue(obje, "_OID") || mediaIdValue(obje, "_LKID");
|
|
91
|
+
var ANCESTRY_MEDIA_RETRIEVAL_PREFIX = "https://www.ancestry.com/api/media/retrieval/v2/image";
|
|
92
|
+
var ANCESTRY_MEDIA_QUERY = "client=trees-mediaservice&imageQuality=hq";
|
|
93
|
+
var ancestryMediaPath = (namespace, imgId) => `/namespaces/${namespace}/media/${imgId}?${ANCESTRY_MEDIA_QUERY}`;
|
|
94
|
+
var ancestryMediaFileUrl = (namespace, imgId) => {
|
|
95
|
+
if (!namespace || !imgId) {
|
|
96
|
+
return void 0;
|
|
97
|
+
}
|
|
98
|
+
return `${ANCESTRY_MEDIA_RETRIEVAL_PREFIX}${ancestryMediaPath(namespace, imgId)}`;
|
|
99
|
+
};
|
|
100
|
+
var objeXrefKey = (obje, fallback = 0) => {
|
|
101
|
+
if (typeof obje?.id === "string" && obje.id) {
|
|
102
|
+
return obje.id;
|
|
103
|
+
}
|
|
104
|
+
const value = obje?.toValue?.();
|
|
105
|
+
if (typeof value === "string" && value.trim()) {
|
|
106
|
+
return value.trim();
|
|
107
|
+
}
|
|
108
|
+
if (typeof fallback === "string" && fallback.trim()) {
|
|
109
|
+
return fallback.trim();
|
|
110
|
+
}
|
|
111
|
+
return `@O${fallback}@`;
|
|
112
|
+
};
|
|
113
|
+
var objeNoteValue = (obje) => mediaIdValue(obje, "FILE.NOTE") || mediaIdValue(obje, "NOTE") || "";
|
|
38
114
|
var List = class _List {
|
|
39
115
|
// length = 0;
|
|
40
116
|
constructor(items) {
|
|
@@ -684,7 +760,7 @@ var Common = class _Common {
|
|
|
684
760
|
this,
|
|
685
761
|
options.obje.namespace,
|
|
686
762
|
options.obje.override,
|
|
687
|
-
void 0,
|
|
763
|
+
this.isAncestry() ? ancestryMediaFileUrl : void 0,
|
|
688
764
|
options.gedcomVersion
|
|
689
765
|
);
|
|
690
766
|
}
|
|
@@ -1240,11 +1316,8 @@ var storeCache = {
|
|
|
1240
1316
|
getCacheDbs().relativesOnDegreeCache.setItem(value);
|
|
1241
1317
|
}
|
|
1242
1318
|
}, 50),
|
|
1243
|
-
//
|
|
1319
|
+
// Image bytes are stored as one IndexedDB record per photo.
|
|
1244
1320
|
profilePictureCache: debounce((value) => {
|
|
1245
|
-
if (value) {
|
|
1246
|
-
getCacheDbs().profilePictureCache.setItem(value);
|
|
1247
|
-
}
|
|
1248
1321
|
}, 100)
|
|
1249
1322
|
};
|
|
1250
1323
|
var cacheInitialized = false;
|
|
@@ -1253,13 +1326,6 @@ var initializeCache = async () => {
|
|
|
1253
1326
|
return;
|
|
1254
1327
|
}
|
|
1255
1328
|
cacheInitialized = true;
|
|
1256
|
-
try {
|
|
1257
|
-
const profilePictureData = await getCacheDbs().profilePictureCache.getItem();
|
|
1258
|
-
if (profilePictureData) {
|
|
1259
|
-
caches.profilePictureCache = profilePictureData;
|
|
1260
|
-
}
|
|
1261
|
-
} catch (_error) {
|
|
1262
|
-
}
|
|
1263
1329
|
};
|
|
1264
1330
|
var resetRelativesCache = () => {
|
|
1265
1331
|
caches.relativesOnDegreeCache = {};
|
|
@@ -2058,7 +2124,9 @@ __export(translators_exports, {
|
|
|
2058
2124
|
es: () => KinshipTranslatorEs,
|
|
2059
2125
|
fr: () => KinshipTranslatorFr,
|
|
2060
2126
|
hu: () => KinshipTranslatorHU,
|
|
2061
|
-
|
|
2127
|
+
ja: () => KinshipTranslatorJa,
|
|
2128
|
+
ru: () => KinshipTranslatorRu,
|
|
2129
|
+
zh: () => KinshipTranslatorZh
|
|
2062
2130
|
});
|
|
2063
2131
|
|
|
2064
2132
|
// src/constants/filters.ts
|
|
@@ -2652,15 +2720,21 @@ var isRemoteOrEmbeddedMediaUrl = (path) => {
|
|
|
2652
2720
|
}
|
|
2653
2721
|
return path.startsWith("data:") || path.startsWith("blob:") || /^https?:\/\//i.test(path);
|
|
2654
2722
|
};
|
|
2655
|
-
var resolveLocalMediaUrl = async (path) => {
|
|
2723
|
+
var resolveLocalMediaUrl = async (path, context) => {
|
|
2656
2724
|
if (!path) {
|
|
2657
2725
|
return void 0;
|
|
2658
2726
|
}
|
|
2659
|
-
if (
|
|
2727
|
+
if (path.startsWith("data:") || path.startsWith("blob:")) {
|
|
2660
2728
|
return path;
|
|
2661
2729
|
}
|
|
2662
|
-
const resolved = await localMediaResolver?.(path);
|
|
2663
|
-
|
|
2730
|
+
const resolved = await localMediaResolver?.(path, context);
|
|
2731
|
+
if (resolved) {
|
|
2732
|
+
return resolved;
|
|
2733
|
+
}
|
|
2734
|
+
if (/^https?:\/\//i.test(path)) {
|
|
2735
|
+
return path;
|
|
2736
|
+
}
|
|
2737
|
+
return void 0;
|
|
2664
2738
|
};
|
|
2665
2739
|
var blobToDataUrl = async (blob) => {
|
|
2666
2740
|
const buffer = await blob.arrayBuffer();
|
|
@@ -2717,54 +2791,6 @@ var notImplemented = (type, ...args) => {
|
|
|
2717
2791
|
console.error(`[Not Implemented] ${type}`, ...args);
|
|
2718
2792
|
};
|
|
2719
2793
|
|
|
2720
|
-
// src/utils/media-utils.ts
|
|
2721
|
-
var getFileExtension = (filename) => {
|
|
2722
|
-
if (!filename) {
|
|
2723
|
-
return "";
|
|
2724
|
-
}
|
|
2725
|
-
if (filename.startsWith("data:")) {
|
|
2726
|
-
const mime = filename.slice(5).split(";")[0] || "";
|
|
2727
|
-
const subtype = (mime.split("/")[1] || "").toLowerCase();
|
|
2728
|
-
if (subtype === "jpeg") {
|
|
2729
|
-
return "jpg";
|
|
2730
|
-
}
|
|
2731
|
-
return subtype.split("+")[0] || "";
|
|
2732
|
-
}
|
|
2733
|
-
const withoutQuery = filename.split(/[?#]/)[0] || filename;
|
|
2734
|
-
const match = withoutQuery.match(/\.([^.]+)$/);
|
|
2735
|
-
return match ? match[1].toLowerCase() : "";
|
|
2736
|
-
};
|
|
2737
|
-
var isImageFormat = (format2) => {
|
|
2738
|
-
if (!format2) {
|
|
2739
|
-
return false;
|
|
2740
|
-
}
|
|
2741
|
-
let normalized = format2.toLowerCase().trim();
|
|
2742
|
-
if (normalized.startsWith("data:")) {
|
|
2743
|
-
normalized = getFileExtension(normalized);
|
|
2744
|
-
} else if (normalized.includes("/")) {
|
|
2745
|
-
normalized = normalized.split("/")[1]?.split("+")[0] || "";
|
|
2746
|
-
if (normalized === "jpeg") {
|
|
2747
|
-
normalized = "jpg";
|
|
2748
|
-
}
|
|
2749
|
-
}
|
|
2750
|
-
const imageFormats = [
|
|
2751
|
-
"jpg",
|
|
2752
|
-
"jpeg",
|
|
2753
|
-
"png",
|
|
2754
|
-
"gif",
|
|
2755
|
-
"bmp",
|
|
2756
|
-
"webp",
|
|
2757
|
-
"svg",
|
|
2758
|
-
"tiff",
|
|
2759
|
-
"tif"
|
|
2760
|
-
];
|
|
2761
|
-
return imageFormats.includes(normalized);
|
|
2762
|
-
};
|
|
2763
|
-
var resolveObjeForm = (obje) => {
|
|
2764
|
-
const value = obje?.get?.("FILE.FORM")?.toValue?.() ?? obje?.get?.("FORM")?.toValue?.();
|
|
2765
|
-
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
2766
|
-
};
|
|
2767
|
-
|
|
2768
2794
|
// src/factories/place-parser-provider.ts
|
|
2769
2795
|
var placeParserProvider;
|
|
2770
2796
|
var setPlaceParserProvider = (parser) => {
|
|
@@ -3980,22 +4006,19 @@ var Indi = class extends Common {
|
|
|
3980
4006
|
if (objeList) {
|
|
3981
4007
|
await Promise.all(
|
|
3982
4008
|
objeList.map(async (objeRef) => {
|
|
3983
|
-
const key = objeRef
|
|
4009
|
+
const key = objeXrefKey(objeRef, 0);
|
|
3984
4010
|
const obje = objeRef?.standardizeMedia(
|
|
3985
4011
|
namespace,
|
|
3986
4012
|
true,
|
|
3987
|
-
|
|
3988
|
-
return ns && iId ? `https://mediasvc.ancestry.com/v2/image/namespaces/${ns}/media/${iId}?client=trees-mediaservice&imageQuality=hq` : void 0;
|
|
3989
|
-
}
|
|
4013
|
+
ancestryMediaFileUrl
|
|
3990
4014
|
);
|
|
3991
4015
|
const isPrimary = obje?.get("_PRIM")?.toValue() === "Y";
|
|
3992
|
-
const media =
|
|
3993
|
-
const clone = obje?.get("_CLON._OID")?.toValue();
|
|
3994
|
-
const mser = obje?.get("_MSER._LKID")?.toValue();
|
|
4016
|
+
const media = resolveObjeMediaId(obje);
|
|
3995
4017
|
let url = obje?.get("FILE")?.toValue();
|
|
3996
4018
|
const title = obje?.get("FILE.TITL")?.toValue() ?? obje?.get("TITL")?.toValue() ?? "";
|
|
4019
|
+
const note = objeNoteValue(obje);
|
|
3997
4020
|
const type = resolveObjeForm(obje) ?? (url ? getFileExtension(url) : void 0) ?? "raw";
|
|
3998
|
-
let imgId =
|
|
4021
|
+
let imgId = media;
|
|
3999
4022
|
const hasEmbeddedOrLocalFile = !!url && (url.startsWith("data:") || url.startsWith("blob:") || !/^https?:\/\//i.test(url));
|
|
4000
4023
|
if (!hasEmbeddedOrLocalFile && (!www || !tree || !this.id)) {
|
|
4001
4024
|
return;
|
|
@@ -4031,6 +4054,7 @@ var Indi = class extends Common {
|
|
|
4031
4054
|
imgId,
|
|
4032
4055
|
person: this.id,
|
|
4033
4056
|
title,
|
|
4057
|
+
note,
|
|
4034
4058
|
url,
|
|
4035
4059
|
contentType: type,
|
|
4036
4060
|
downloadName: `${this.id.replaceAll("@", "")}_${this.toNaturalName()?.replaceAll(" ", "-") || ""}_${(title || key.replaceAll("@", "").toString()).replaceAll(" ", "-")}`
|
|
@@ -4069,7 +4093,7 @@ var Indi = class extends Common {
|
|
|
4069
4093
|
return;
|
|
4070
4094
|
}
|
|
4071
4095
|
const obje = o;
|
|
4072
|
-
const key =
|
|
4096
|
+
const key = objeXrefKey(obje, index);
|
|
4073
4097
|
obje.standardizeMedia();
|
|
4074
4098
|
const isPrimary = obje?.get("_PRIM")?.toValue() === "Y";
|
|
4075
4099
|
const url = obje?.get("FILE")?.toValue();
|
|
@@ -4088,6 +4112,7 @@ var Indi = class extends Common {
|
|
|
4088
4112
|
imgId,
|
|
4089
4113
|
person: this.id,
|
|
4090
4114
|
title,
|
|
4115
|
+
note: objeNoteValue(obje),
|
|
4091
4116
|
url,
|
|
4092
4117
|
contentType: type,
|
|
4093
4118
|
downloadName: `${this.id.replaceAll("@", "")}_${this.toNaturalName()?.replaceAll(" ", "-") || ""}_${(title || key.replaceAll("@", "").toString()).replaceAll(" ", "-")}`
|
|
@@ -4196,7 +4221,7 @@ var Indi = class extends Common {
|
|
|
4196
4221
|
if (!obje) {
|
|
4197
4222
|
return;
|
|
4198
4223
|
}
|
|
4199
|
-
const key =
|
|
4224
|
+
const key = objeXrefKey(obje, index);
|
|
4200
4225
|
const isPrimary = obje?.get("_PRIM")?.toValue() === "Y";
|
|
4201
4226
|
const url = obje?.get("FILE")?.toValue();
|
|
4202
4227
|
const title = obje?.get("TITL")?.toValue() ?? "";
|
|
@@ -4213,6 +4238,7 @@ var Indi = class extends Common {
|
|
|
4213
4238
|
imgId,
|
|
4214
4239
|
person: this.id,
|
|
4215
4240
|
title,
|
|
4241
|
+
note: objeNoteValue(obje),
|
|
4216
4242
|
url,
|
|
4217
4243
|
contentType: type,
|
|
4218
4244
|
downloadName: `${this.id.replaceAll("@", "")}_${this.toNaturalName()?.replaceAll(" ", "-") || ""}_${(title || key.replaceAll("@", "").toString()).replaceAll(" ", "-")}`
|
|
@@ -4236,7 +4262,7 @@ var Indi = class extends Common {
|
|
|
4236
4262
|
if (!obje) {
|
|
4237
4263
|
return;
|
|
4238
4264
|
}
|
|
4239
|
-
const key =
|
|
4265
|
+
const key = objeXrefKey(obje, index);
|
|
4240
4266
|
obje.standardizeMedia();
|
|
4241
4267
|
const isPrimary = obje?.get("_PRIM")?.toValue() === "Y";
|
|
4242
4268
|
const url = obje?.get("FILE")?.toValue();
|
|
@@ -4253,6 +4279,7 @@ var Indi = class extends Common {
|
|
|
4253
4279
|
imgId,
|
|
4254
4280
|
person: this.id,
|
|
4255
4281
|
title,
|
|
4282
|
+
note: objeNoteValue(obje),
|
|
4256
4283
|
url,
|
|
4257
4284
|
contentType: type,
|
|
4258
4285
|
downloadName: `${this.id.replaceAll("@", "")}_${this.toNaturalName()?.replaceAll(" ", "-") || ""}_${(title || key.replaceAll("@", "").toString()).replaceAll(" ", "-")}`
|
|
@@ -4284,7 +4311,12 @@ var Indi = class extends Common {
|
|
|
4284
4311
|
);
|
|
4285
4312
|
if (cached !== void 0) {
|
|
4286
4313
|
if (cached?.file && !isRemoteOrEmbeddedMediaUrl(cached.file)) {
|
|
4287
|
-
const resolvedCached = await resolveLocalMediaUrl(cached.file
|
|
4314
|
+
const resolvedCached = await resolveLocalMediaUrl(cached.file, {
|
|
4315
|
+
url: cached.file,
|
|
4316
|
+
person: this.id,
|
|
4317
|
+
tree: this.getTreeId?.(),
|
|
4318
|
+
treeName: this.getTreeName?.()
|
|
4319
|
+
});
|
|
4288
4320
|
if (resolvedCached && isRemoteOrEmbeddedMediaUrl(resolvedCached)) {
|
|
4289
4321
|
const refreshed = { ...cached, file: resolvedCached };
|
|
4290
4322
|
profilePictureCache(
|
|
@@ -4309,7 +4341,16 @@ var Indi = class extends Common {
|
|
|
4309
4341
|
}
|
|
4310
4342
|
const mediaArray = Object.values(mediaList);
|
|
4311
4343
|
const toDisplayableProfile = async (media, isPrimary) => {
|
|
4312
|
-
const resolvedFile = await resolveLocalMediaUrl(media.url
|
|
4344
|
+
const resolvedFile = await resolveLocalMediaUrl(media.url, {
|
|
4345
|
+
url: media.url,
|
|
4346
|
+
id: media.id,
|
|
4347
|
+
imgId: media.imgId,
|
|
4348
|
+
key: media.key,
|
|
4349
|
+
contentType: media.contentType,
|
|
4350
|
+
person: media.person || this.id,
|
|
4351
|
+
tree: media.tree || this.getTreeId?.(),
|
|
4352
|
+
treeName: this.getTreeName?.()
|
|
4353
|
+
});
|
|
4313
4354
|
if (!resolvedFile || !isRemoteOrEmbeddedMediaUrl(resolvedFile)) {
|
|
4314
4355
|
return void 0;
|
|
4315
4356
|
}
|
|
@@ -7504,6 +7545,445 @@ var KinshipTranslatorRu = class extends KinshipTranslatorBasic {
|
|
|
7504
7545
|
}
|
|
7505
7546
|
};
|
|
7506
7547
|
|
|
7548
|
+
// src/kinship-translator/patterns.ja.ts
|
|
7549
|
+
var InLawsJa = {
|
|
7550
|
+
"(\u5B50|\u5A18|\u606F\u5B50)\u306E\u914D\u5076\u8005": "\u7FA9\u7406\u306E\u5B50",
|
|
7551
|
+
"(\u5B50|\u5A18|\u606F\u5B50)\u306E\u59BB": "\u5AC1",
|
|
7552
|
+
"(\u5B50|\u5A18|\u606F\u5B50)\u306E\u592B": "\u5A7F",
|
|
7553
|
+
"(\u914D\u5076\u8005|\u59BB|\u592B)\u306E\u6BCD": "\u7FA9\u6BCD",
|
|
7554
|
+
"(\u914D\u5076\u8005|\u59BB|\u592B)\u306E\u7236": "\u7FA9\u7236",
|
|
7555
|
+
"(\u914D\u5076\u8005|\u59BB|\u592B)\u306E\u89AA": "\u7FA9\u7406\u306E\u89AA",
|
|
7556
|
+
"(\u7570\u7236\u6BCD\u306E)?(\u5144\u5F1F|\u59C9\u59B9|\u5144\u5F1F\u59C9\u59B9)\u306E\u59BB": "\u7FA9\u7406\u306E\u59C9\u59B9",
|
|
7557
|
+
"(\u7570\u7236\u6BCD\u306E)?(\u5144\u5F1F|\u59C9\u59B9|\u5144\u5F1F\u59C9\u59B9)\u306E\u592B": "\u7FA9\u7406\u306E\u5144\u5F1F",
|
|
7558
|
+
"(\u7570\u7236\u6BCD\u306E)?(\u5144\u5F1F|\u59C9\u59B9|\u5144\u5F1F\u59C9\u59B9)\u306E\u914D\u5076\u8005": "\u7FA9\u7406\u306E\u5144\u5F1F\u59C9\u59B9",
|
|
7559
|
+
"(\u7570\u7236\u6BCD\u306E)?\u59C9\u59B9\u306E(\u914D\u5076\u8005|\u59BB|\u592B)": "\u7FA9\u7406\u306E\u59C9\u59B9",
|
|
7560
|
+
"(\u7570\u7236\u6BCD\u306E)?\u5144\u5F1F\u306E(\u914D\u5076\u8005|\u59BB|\u592B)": "\u7FA9\u7406\u306E\u5144\u5F1F",
|
|
7561
|
+
"(\u7570\u7236\u6BCD\u306E)?\u5144\u5F1F\u59C9\u59B9\u306E(\u914D\u5076\u8005|\u59BB|\u592B)": "\u7FA9\u7406\u306E\u5144\u5F1F\u59C9\u59B9",
|
|
7562
|
+
"(\u7570\u7236\u6BCD\u306E)?(\u914D\u5076\u8005|\u59BB|\u592B)\u306E\u59C9\u59B9": "\u7FA9\u7406\u306E\u59C9\u59B9",
|
|
7563
|
+
"(\u7570\u7236\u6BCD\u306E)?(\u914D\u5076\u8005|\u59BB|\u592B)\u306E\u5144\u5F1F": "\u7FA9\u7406\u306E\u5144\u5F1F",
|
|
7564
|
+
"(\u7570\u7236\u6BCD\u306E)?(\u914D\u5076\u8005|\u59BB|\u592B)\u306E\u5144\u5F1F\u59C9\u59B9": "\u7FA9\u7406\u306E\u5144\u5F1F\u59C9\u59B9"
|
|
7565
|
+
};
|
|
7566
|
+
|
|
7567
|
+
// src/kinship-translator/kinship-translator.ja.ts
|
|
7568
|
+
var sexOf2 = (person) => {
|
|
7569
|
+
if (person?.isMale?.()) {
|
|
7570
|
+
return "m";
|
|
7571
|
+
}
|
|
7572
|
+
if (person?.isFemale?.()) {
|
|
7573
|
+
return "f";
|
|
7574
|
+
}
|
|
7575
|
+
return "n";
|
|
7576
|
+
};
|
|
7577
|
+
var pick = (sex, male, female, neutral) => {
|
|
7578
|
+
if (sex === "m") {
|
|
7579
|
+
return male;
|
|
7580
|
+
}
|
|
7581
|
+
if (sex === "f") {
|
|
7582
|
+
return female;
|
|
7583
|
+
}
|
|
7584
|
+
return neutral;
|
|
7585
|
+
};
|
|
7586
|
+
var lineal = (level, sex, kind) => {
|
|
7587
|
+
const L = Math.max(1, level);
|
|
7588
|
+
if (kind === "asc") {
|
|
7589
|
+
if (L <= 1) {
|
|
7590
|
+
return pick(sex, "\u7236", "\u6BCD", "\u89AA");
|
|
7591
|
+
}
|
|
7592
|
+
if (L === 2) {
|
|
7593
|
+
return pick(sex, "\u7956\u7236", "\u7956\u6BCD", "\u7956\u7236\u6BCD");
|
|
7594
|
+
}
|
|
7595
|
+
if (L === 3) {
|
|
7596
|
+
return pick(sex, "\u66FE\u7956\u7236", "\u66FE\u7956\u6BCD", "\u66FE\u7956\u7236\u6BCD");
|
|
7597
|
+
}
|
|
7598
|
+
if (L === 4) {
|
|
7599
|
+
return pick(sex, "\u9AD8\u7956\u7236", "\u9AD8\u7956\u6BCD", "\u9AD8\u7956\u7236\u6BCD");
|
|
7600
|
+
}
|
|
7601
|
+
return pick(
|
|
7602
|
+
sex,
|
|
7603
|
+
`${L - 1}\u4E16\u306E\u7956\u7236`,
|
|
7604
|
+
`${L - 1}\u4E16\u306E\u7956\u6BCD`,
|
|
7605
|
+
`${L - 1}\u4E16\u306E\u7956\u7236\u6BCD`
|
|
7606
|
+
);
|
|
7607
|
+
}
|
|
7608
|
+
if (L <= 1) {
|
|
7609
|
+
return pick(sex, "\u606F\u5B50", "\u5A18", "\u5B50");
|
|
7610
|
+
}
|
|
7611
|
+
if (L === 2) {
|
|
7612
|
+
return "\u5B6B";
|
|
7613
|
+
}
|
|
7614
|
+
if (L === 3) {
|
|
7615
|
+
return "\u66FE\u5B6B";
|
|
7616
|
+
}
|
|
7617
|
+
if (L === 4) {
|
|
7618
|
+
return "\u7384\u5B6B";
|
|
7619
|
+
}
|
|
7620
|
+
return `${L - 1}\u4E16\u306E\u5B6B`;
|
|
7621
|
+
};
|
|
7622
|
+
var cousinPlain = (degree) => {
|
|
7623
|
+
if (degree <= 1) {
|
|
7624
|
+
return "\u3044\u3068\u3053";
|
|
7625
|
+
}
|
|
7626
|
+
if (degree === 2) {
|
|
7627
|
+
return "\u307E\u305F\u3044\u3068\u3053";
|
|
7628
|
+
}
|
|
7629
|
+
if (degree === 3) {
|
|
7630
|
+
return "\u306F\u3068\u3053";
|
|
7631
|
+
}
|
|
7632
|
+
return `${degree}\u89AA\u7B49\u306E\u3044\u3068\u3053`;
|
|
7633
|
+
};
|
|
7634
|
+
var KinshipTranslatorJa = class extends KinshipTranslatorBasic {
|
|
7635
|
+
indirect() {
|
|
7636
|
+
let degree = Math.abs(this.pathN?.degree ?? 0);
|
|
7637
|
+
if (degree > 0) {
|
|
7638
|
+
degree = degree - 1;
|
|
7639
|
+
}
|
|
7640
|
+
return cousinPlain(degree);
|
|
7641
|
+
}
|
|
7642
|
+
removal() {
|
|
7643
|
+
const level = this.pathN?.level ?? 0;
|
|
7644
|
+
let degree = Math.abs(this.pathN?.degree ?? 0);
|
|
7645
|
+
if (degree > 0) {
|
|
7646
|
+
degree = degree - 1;
|
|
7647
|
+
}
|
|
7648
|
+
if (!degree) {
|
|
7649
|
+
return level < 0 ? this.nibling() : this.auncle();
|
|
7650
|
+
}
|
|
7651
|
+
const removed = Math.abs(level);
|
|
7652
|
+
return `${cousinPlain(degree)}\uFF08${removed}\u4E16\u4EE3\u9055\u3044\uFF09`;
|
|
7653
|
+
}
|
|
7654
|
+
auncle() {
|
|
7655
|
+
const level = Math.abs(this.pathN?.level ?? 0);
|
|
7656
|
+
const sex = sexOf2(this.personN);
|
|
7657
|
+
if (level <= 2) {
|
|
7658
|
+
return pick(sex, "\u304A\u3058", "\u304A\u3070", "\u304A\u3058/\u304A\u3070");
|
|
7659
|
+
}
|
|
7660
|
+
if (level === 3) {
|
|
7661
|
+
return pick(sex, "\u5927\u304A\u3058", "\u5927\u304A\u3070", "\u5927\u304A\u3058/\u5927\u304A\u3070");
|
|
7662
|
+
}
|
|
7663
|
+
return pick(
|
|
7664
|
+
sex,
|
|
7665
|
+
`${level - 2}\u4EE3\u524D\u306E\u304A\u3058`,
|
|
7666
|
+
`${level - 2}\u4EE3\u524D\u306E\u304A\u3070`,
|
|
7667
|
+
`${level - 2}\u4EE3\u524D\u306E\u304A\u3058/\u304A\u3070`
|
|
7668
|
+
);
|
|
7669
|
+
}
|
|
7670
|
+
nibling() {
|
|
7671
|
+
const level = Math.abs(this.pathN?.level ?? 0);
|
|
7672
|
+
const sex = sexOf2(this.personN);
|
|
7673
|
+
if (level <= 2) {
|
|
7674
|
+
return pick(sex, "\u7525", "\u59EA", "\u7525/\u59EA");
|
|
7675
|
+
}
|
|
7676
|
+
if (level === 3) {
|
|
7677
|
+
return pick(sex, "\u5927\u7525", "\u5927\u59EA", "\u5927\u7525/\u5927\u59EA");
|
|
7678
|
+
}
|
|
7679
|
+
return pick(
|
|
7680
|
+
sex,
|
|
7681
|
+
`${level - 2}\u4EE3\u4E0B\u306E\u7525`,
|
|
7682
|
+
`${level - 2}\u4EE3\u4E0B\u306E\u59EA`,
|
|
7683
|
+
`${level - 2}\u4EE3\u4E0B\u306E\u7525/\u59EA`
|
|
7684
|
+
);
|
|
7685
|
+
}
|
|
7686
|
+
parent() {
|
|
7687
|
+
return lineal(
|
|
7688
|
+
Math.abs(this.pathN?.level ?? 0),
|
|
7689
|
+
sexOf2(this.personN),
|
|
7690
|
+
"asc"
|
|
7691
|
+
);
|
|
7692
|
+
}
|
|
7693
|
+
child() {
|
|
7694
|
+
return lineal(
|
|
7695
|
+
Math.abs(this.pathN?.level ?? 0),
|
|
7696
|
+
sexOf2(this.personN),
|
|
7697
|
+
"desc"
|
|
7698
|
+
);
|
|
7699
|
+
}
|
|
7700
|
+
sibling() {
|
|
7701
|
+
return pick(sexOf2(this.personN), "\u5144\u5F1F", "\u59C9\u59B9", "\u5144\u5F1F\u59C9\u59B9");
|
|
7702
|
+
}
|
|
7703
|
+
halfBlood(relation) {
|
|
7704
|
+
if (!relation || !this.isHalfBlood) {
|
|
7705
|
+
return relation ?? "";
|
|
7706
|
+
}
|
|
7707
|
+
return `\u7570\u7236\u6BCD\u306E${relation}`;
|
|
7708
|
+
}
|
|
7709
|
+
spouse() {
|
|
7710
|
+
return pick(sexOf2(this.personN), "\u592B", "\u59BB", "\u914D\u5076\u8005");
|
|
7711
|
+
}
|
|
7712
|
+
ofSpouse(relation) {
|
|
7713
|
+
if (!relation) {
|
|
7714
|
+
return "";
|
|
7715
|
+
}
|
|
7716
|
+
const spouseType = pick(
|
|
7717
|
+
sexOf2(this.path?.[1].indi),
|
|
7718
|
+
"\u592B",
|
|
7719
|
+
"\u59BB",
|
|
7720
|
+
"\u914D\u5076\u8005"
|
|
7721
|
+
);
|
|
7722
|
+
return `${spouseType}\u306E${relation}`;
|
|
7723
|
+
}
|
|
7724
|
+
spouseOf(relation) {
|
|
7725
|
+
if (!relation) {
|
|
7726
|
+
return "";
|
|
7727
|
+
}
|
|
7728
|
+
const spouse = this.path?.[this.path.length - 1].indi;
|
|
7729
|
+
const spouseType = pick(sexOf2(spouse), "\u592B", "\u59BB", "\u914D\u5076\u8005");
|
|
7730
|
+
return `${relation}\u306E${spouseType}`;
|
|
7731
|
+
}
|
|
7732
|
+
of(relation) {
|
|
7733
|
+
const formattedName = nameFormatter(this.path?.[0]?.indi, {
|
|
7734
|
+
nameOrder: "last-first"
|
|
7735
|
+
});
|
|
7736
|
+
let name = formattedName.inOrder.filter(Boolean).join(" ");
|
|
7737
|
+
if (this.displayName === "none") {
|
|
7738
|
+
name = "";
|
|
7739
|
+
} else if (this.displayName === "givenname") {
|
|
7740
|
+
name = formattedName.givenname;
|
|
7741
|
+
} else if (this.displayName === "surname") {
|
|
7742
|
+
name = `${formattedName.surname}`;
|
|
7743
|
+
}
|
|
7744
|
+
if (!name || !relation) {
|
|
7745
|
+
return relation ?? "";
|
|
7746
|
+
}
|
|
7747
|
+
return `${name}\u306E${relation}`;
|
|
7748
|
+
}
|
|
7749
|
+
inLaw(relation) {
|
|
7750
|
+
let inLawRelation = relation;
|
|
7751
|
+
Object.keys(InLawsJa).find((pattern) => {
|
|
7752
|
+
const regex = new RegExp(`^${pattern}$`);
|
|
7753
|
+
if (relation?.match(regex)) {
|
|
7754
|
+
inLawRelation = InLawsJa[pattern];
|
|
7755
|
+
return true;
|
|
7756
|
+
}
|
|
7757
|
+
return false;
|
|
7758
|
+
});
|
|
7759
|
+
return inLawRelation ?? "";
|
|
7760
|
+
}
|
|
7761
|
+
relationType(relation) {
|
|
7762
|
+
if (!relation || !this.pathN?.relation) {
|
|
7763
|
+
return relation ?? "";
|
|
7764
|
+
}
|
|
7765
|
+
return `${this.pathN.relation}\u306E${relation}`;
|
|
7766
|
+
}
|
|
7767
|
+
};
|
|
7768
|
+
|
|
7769
|
+
// src/kinship-translator/patterns.zh.ts
|
|
7770
|
+
var InLawsZh = {
|
|
7771
|
+
"(\u5B50\u5973|\u5973\u513F|\u513F\u5B50)\u7684\u914D\u5076": "\u513F\u5AB3/\u5973\u5A7F",
|
|
7772
|
+
"(\u5B50\u5973|\u5973\u513F|\u513F\u5B50)\u7684\u59BB\u5B50": "\u513F\u5AB3",
|
|
7773
|
+
"(\u5B50\u5973|\u5973\u513F|\u513F\u5B50)\u7684\u4E08\u592B": "\u5973\u5A7F",
|
|
7774
|
+
"(\u914D\u5076|\u59BB\u5B50|\u4E08\u592B)\u7684\u6BCD\u4EB2": "\u5CB3\u6BCD/\u5A46\u5A46",
|
|
7775
|
+
"(\u914D\u5076|\u59BB\u5B50|\u4E08\u592B)\u7684\u7236\u4EB2": "\u5CB3\u7236/\u516C\u516C",
|
|
7776
|
+
"(\u914D\u5076|\u59BB\u5B50|\u4E08\u592B)\u7684\u7236\u6BCD": "\u5CB3\u7236\u5CB3\u6BCD/\u516C\u516C\u5A46\u5A46",
|
|
7777
|
+
"(\u5F02\u7236\u6BCD\u7684)?(\u5144\u5F1F\u59D0\u59B9|\u59D0\u59B9|\u5144\u5F1F)\u7684\u59BB\u5B50": "\u5AC2\u5B50/\u5F1F\u59B9",
|
|
7778
|
+
"(\u5F02\u7236\u6BCD\u7684)?(\u5144\u5F1F\u59D0\u59B9|\u59D0\u59B9|\u5144\u5F1F)\u7684\u4E08\u592B": "\u59D0\u592B/\u59B9\u592B",
|
|
7779
|
+
"(\u5F02\u7236\u6BCD\u7684)?(\u5144\u5F1F\u59D0\u59B9|\u59D0\u59B9|\u5144\u5F1F)\u7684\u914D\u5076": "\u59FB\u4EB2\u5144\u5F1F\u59D0\u59B9",
|
|
7780
|
+
"(\u5F02\u7236\u6BCD\u7684)?\u59D0\u59B9\u7684(\u914D\u5076|\u59BB\u5B50|\u4E08\u592B)": "\u59D0\u592B/\u59B9\u592B",
|
|
7781
|
+
"(\u5F02\u7236\u6BCD\u7684)?\u5144\u5F1F\u7684(\u914D\u5076|\u59BB\u5B50|\u4E08\u592B)": "\u5AC2\u5B50/\u5F1F\u59B9",
|
|
7782
|
+
"(\u5F02\u7236\u6BCD\u7684)?\u5144\u5F1F\u59D0\u59B9\u7684(\u914D\u5076|\u59BB\u5B50|\u4E08\u592B)": "\u59FB\u4EB2\u5144\u5F1F\u59D0\u59B9",
|
|
7783
|
+
"(\u5F02\u7236\u6BCD\u7684)?(\u914D\u5076|\u59BB\u5B50|\u4E08\u592B)\u7684\u59D0\u59B9": "\u59D1\u5B50/\u59E8\u5B50",
|
|
7784
|
+
"(\u5F02\u7236\u6BCD\u7684)?(\u914D\u5076|\u59BB\u5B50|\u4E08\u592B)\u7684\u5144\u5F1F": "\u5927\u4F2F/\u5C0F\u53D4/\u5185\u5144/\u5185\u5F1F",
|
|
7785
|
+
"(\u5F02\u7236\u6BCD\u7684)?(\u914D\u5076|\u59BB\u5B50|\u4E08\u592B)\u7684\u5144\u5F1F\u59D0\u59B9": "\u59FB\u4EB2\u5144\u5F1F\u59D0\u59B9"
|
|
7786
|
+
};
|
|
7787
|
+
|
|
7788
|
+
// src/kinship-translator/kinship-translator.zh.ts
|
|
7789
|
+
var sexOf3 = (person) => {
|
|
7790
|
+
if (person?.isMale?.()) {
|
|
7791
|
+
return "m";
|
|
7792
|
+
}
|
|
7793
|
+
if (person?.isFemale?.()) {
|
|
7794
|
+
return "f";
|
|
7795
|
+
}
|
|
7796
|
+
return "n";
|
|
7797
|
+
};
|
|
7798
|
+
var pick2 = (sex, male, female, neutral) => {
|
|
7799
|
+
if (sex === "m") {
|
|
7800
|
+
return male;
|
|
7801
|
+
}
|
|
7802
|
+
if (sex === "f") {
|
|
7803
|
+
return female;
|
|
7804
|
+
}
|
|
7805
|
+
return neutral;
|
|
7806
|
+
};
|
|
7807
|
+
var lineal2 = (level, sex, kind) => {
|
|
7808
|
+
const L = Math.max(1, level);
|
|
7809
|
+
if (kind === "asc") {
|
|
7810
|
+
if (L <= 1) {
|
|
7811
|
+
return pick2(sex, "\u7236\u4EB2", "\u6BCD\u4EB2", "\u7236\u6BCD");
|
|
7812
|
+
}
|
|
7813
|
+
if (L === 2) {
|
|
7814
|
+
return pick2(sex, "\u7956\u7236", "\u7956\u6BCD", "\u7956\u7236\u6BCD");
|
|
7815
|
+
}
|
|
7816
|
+
if (L === 3) {
|
|
7817
|
+
return pick2(sex, "\u66FE\u7956\u7236", "\u66FE\u7956\u6BCD", "\u66FE\u7956\u7236\u6BCD");
|
|
7818
|
+
}
|
|
7819
|
+
if (L === 4) {
|
|
7820
|
+
return pick2(sex, "\u9AD8\u7956\u7236", "\u9AD8\u7956\u6BCD", "\u9AD8\u7956\u7236\u6BCD");
|
|
7821
|
+
}
|
|
7822
|
+
return pick2(sex, `${L}\u4E16\u7956`, `${L}\u4E16\u7956\u6BCD`, `${L}\u4E16\u7956\u7236\u6BCD`);
|
|
7823
|
+
}
|
|
7824
|
+
if (L <= 1) {
|
|
7825
|
+
return pick2(sex, "\u513F\u5B50", "\u5973\u513F", "\u5B50\u5973");
|
|
7826
|
+
}
|
|
7827
|
+
if (L === 2) {
|
|
7828
|
+
return pick2(sex, "\u5B59\u5B50", "\u5B59\u5973", "\u5B59\u5B50\u5973");
|
|
7829
|
+
}
|
|
7830
|
+
if (L === 3) {
|
|
7831
|
+
return pick2(sex, "\u66FE\u5B59", "\u66FE\u5B59\u5973", "\u66FE\u5B59\u5B50\u5973");
|
|
7832
|
+
}
|
|
7833
|
+
if (L === 4) {
|
|
7834
|
+
return pick2(sex, "\u7384\u5B59", "\u7384\u5B59\u5973", "\u7384\u5B59\u5B50\u5973");
|
|
7835
|
+
}
|
|
7836
|
+
return pick2(sex, `${L}\u4E16\u5B59`, `${L}\u4E16\u5B59\u5973`, `${L}\u4E16\u5B59\u5B50\u5973`);
|
|
7837
|
+
};
|
|
7838
|
+
var cousinPlain2 = (degree, sex) => {
|
|
7839
|
+
if (degree <= 1) {
|
|
7840
|
+
return pick2(sex, "\u5802\u8868\u5144\u5F1F", "\u5802\u8868\u59D0\u59B9", "\u5802\u8868\u4EB2");
|
|
7841
|
+
}
|
|
7842
|
+
if (degree === 2) {
|
|
7843
|
+
return pick2(sex, "\u4ECE\u5802\u8868\u5144\u5F1F", "\u4ECE\u5802\u8868\u59D0\u59B9", "\u4ECE\u5802\u8868\u4EB2");
|
|
7844
|
+
}
|
|
7845
|
+
return pick2(
|
|
7846
|
+
sex,
|
|
7847
|
+
`${degree}\u4EE3\u5802\u8868\u5144\u5F1F`,
|
|
7848
|
+
`${degree}\u4EE3\u5802\u8868\u59D0\u59B9`,
|
|
7849
|
+
`${degree}\u4EE3\u5802\u8868\u4EB2`
|
|
7850
|
+
);
|
|
7851
|
+
};
|
|
7852
|
+
var KinshipTranslatorZh = class extends KinshipTranslatorBasic {
|
|
7853
|
+
indirect() {
|
|
7854
|
+
let degree = Math.abs(this.pathN?.degree ?? 0);
|
|
7855
|
+
if (degree > 0) {
|
|
7856
|
+
degree = degree - 1;
|
|
7857
|
+
}
|
|
7858
|
+
return cousinPlain2(degree, sexOf3(this.personN));
|
|
7859
|
+
}
|
|
7860
|
+
removal() {
|
|
7861
|
+
const level = this.pathN?.level ?? 0;
|
|
7862
|
+
let degree = Math.abs(this.pathN?.degree ?? 0);
|
|
7863
|
+
if (degree > 0) {
|
|
7864
|
+
degree = degree - 1;
|
|
7865
|
+
}
|
|
7866
|
+
if (!degree) {
|
|
7867
|
+
return level < 0 ? this.nibling() : this.auncle();
|
|
7868
|
+
}
|
|
7869
|
+
const removed = Math.abs(level);
|
|
7870
|
+
return `${cousinPlain2(degree, sexOf3(this.personN))}\uFF08\u9694${removed}\u4EE3\uFF09`;
|
|
7871
|
+
}
|
|
7872
|
+
auncle() {
|
|
7873
|
+
const level = Math.abs(this.pathN?.level ?? 0);
|
|
7874
|
+
const sex = sexOf3(this.personN);
|
|
7875
|
+
if (level <= 2) {
|
|
7876
|
+
return pick2(sex, "\u53D4\u53D4", "\u963F\u59E8", "\u53D4\u4F2F/\u59D1\u59E8");
|
|
7877
|
+
}
|
|
7878
|
+
if (level === 3) {
|
|
7879
|
+
return pick2(sex, "\u4F2F\u53D4\u7956\u7236", "\u59D1\u7956\u6BCD", "\u4F2F\u53D4\u7956\u7236\u6BCD");
|
|
7880
|
+
}
|
|
7881
|
+
return pick2(
|
|
7882
|
+
sex,
|
|
7883
|
+
`${level - 2}\u4EE3\u524D\u7684\u53D4\u53D4`,
|
|
7884
|
+
`${level - 2}\u4EE3\u524D\u7684\u963F\u59E8`,
|
|
7885
|
+
`${level - 2}\u4EE3\u524D\u7684\u53D4\u4F2F/\u59D1\u59E8`
|
|
7886
|
+
);
|
|
7887
|
+
}
|
|
7888
|
+
nibling() {
|
|
7889
|
+
const level = Math.abs(this.pathN?.level ?? 0);
|
|
7890
|
+
const sex = sexOf3(this.personN);
|
|
7891
|
+
if (level <= 2) {
|
|
7892
|
+
return pick2(sex, "\u4F84\u5B50", "\u4F84\u5973", "\u4F84\u5B50\u5973");
|
|
7893
|
+
}
|
|
7894
|
+
if (level === 3) {
|
|
7895
|
+
return pick2(sex, "\u4F84\u5B59", "\u4F84\u5B59\u5973", "\u4F84\u5B59\u5B50\u5973");
|
|
7896
|
+
}
|
|
7897
|
+
return pick2(
|
|
7898
|
+
sex,
|
|
7899
|
+
`${level - 2}\u4EE3\u4E0B\u7684\u4F84\u5B50`,
|
|
7900
|
+
`${level - 2}\u4EE3\u4E0B\u7684\u4F84\u5973`,
|
|
7901
|
+
`${level - 2}\u4EE3\u4E0B\u7684\u4F84\u5B50\u5973`
|
|
7902
|
+
);
|
|
7903
|
+
}
|
|
7904
|
+
parent() {
|
|
7905
|
+
return lineal2(
|
|
7906
|
+
Math.abs(this.pathN?.level ?? 0),
|
|
7907
|
+
sexOf3(this.personN),
|
|
7908
|
+
"asc"
|
|
7909
|
+
);
|
|
7910
|
+
}
|
|
7911
|
+
child() {
|
|
7912
|
+
return lineal2(
|
|
7913
|
+
Math.abs(this.pathN?.level ?? 0),
|
|
7914
|
+
sexOf3(this.personN),
|
|
7915
|
+
"desc"
|
|
7916
|
+
);
|
|
7917
|
+
}
|
|
7918
|
+
sibling() {
|
|
7919
|
+
return pick2(sexOf3(this.personN), "\u5144\u5F1F", "\u59D0\u59B9", "\u5144\u5F1F\u59D0\u59B9");
|
|
7920
|
+
}
|
|
7921
|
+
halfBlood(relation) {
|
|
7922
|
+
if (!relation || !this.isHalfBlood) {
|
|
7923
|
+
return relation ?? "";
|
|
7924
|
+
}
|
|
7925
|
+
return `\u5F02\u7236\u6BCD\u7684${relation}`;
|
|
7926
|
+
}
|
|
7927
|
+
spouse() {
|
|
7928
|
+
return pick2(sexOf3(this.personN), "\u4E08\u592B", "\u59BB\u5B50", "\u914D\u5076");
|
|
7929
|
+
}
|
|
7930
|
+
ofSpouse(relation) {
|
|
7931
|
+
if (!relation) {
|
|
7932
|
+
return "";
|
|
7933
|
+
}
|
|
7934
|
+
const spouseType = pick2(
|
|
7935
|
+
sexOf3(this.path?.[1].indi),
|
|
7936
|
+
"\u4E08\u592B",
|
|
7937
|
+
"\u59BB\u5B50",
|
|
7938
|
+
"\u914D\u5076"
|
|
7939
|
+
);
|
|
7940
|
+
return `${spouseType}\u7684${relation}`;
|
|
7941
|
+
}
|
|
7942
|
+
spouseOf(relation) {
|
|
7943
|
+
if (!relation) {
|
|
7944
|
+
return "";
|
|
7945
|
+
}
|
|
7946
|
+
const spouse = this.path?.[this.path.length - 1].indi;
|
|
7947
|
+
const spouseType = pick2(sexOf3(spouse), "\u4E08\u592B", "\u59BB\u5B50", "\u914D\u5076");
|
|
7948
|
+
return `${relation}\u7684${spouseType}`;
|
|
7949
|
+
}
|
|
7950
|
+
of(relation) {
|
|
7951
|
+
const formattedName = nameFormatter(this.path?.[0]?.indi, {
|
|
7952
|
+
nameOrder: "last-first"
|
|
7953
|
+
});
|
|
7954
|
+
let name = formattedName.inOrder.filter(Boolean).join(" ");
|
|
7955
|
+
if (this.displayName === "none") {
|
|
7956
|
+
name = "";
|
|
7957
|
+
} else if (this.displayName === "givenname") {
|
|
7958
|
+
name = formattedName.givenname;
|
|
7959
|
+
} else if (this.displayName === "surname") {
|
|
7960
|
+
name = `${formattedName.surname}`;
|
|
7961
|
+
}
|
|
7962
|
+
if (!name || !relation) {
|
|
7963
|
+
return relation ?? "";
|
|
7964
|
+
}
|
|
7965
|
+
return `${name}\u7684${relation}`;
|
|
7966
|
+
}
|
|
7967
|
+
inLaw(relation) {
|
|
7968
|
+
let inLawRelation = relation;
|
|
7969
|
+
Object.keys(InLawsZh).find((pattern) => {
|
|
7970
|
+
const regex = new RegExp(`^${pattern}$`);
|
|
7971
|
+
if (relation?.match(regex)) {
|
|
7972
|
+
inLawRelation = InLawsZh[pattern];
|
|
7973
|
+
return true;
|
|
7974
|
+
}
|
|
7975
|
+
return false;
|
|
7976
|
+
});
|
|
7977
|
+
return inLawRelation ?? "";
|
|
7978
|
+
}
|
|
7979
|
+
relationType(relation) {
|
|
7980
|
+
if (!relation || !this.pathN?.relation) {
|
|
7981
|
+
return relation ?? "";
|
|
7982
|
+
}
|
|
7983
|
+
return `${this.pathN.relation}${relation}`;
|
|
7984
|
+
}
|
|
7985
|
+
};
|
|
7986
|
+
|
|
7507
7987
|
// src/kinship-translator/kinship-translator.ts
|
|
7508
7988
|
var KinshipTranslator = class {
|
|
7509
7989
|
constructor(person1, person2, lang = "en", entirePath, displayName = "givenname") {
|
|
@@ -8565,7 +9045,9 @@ var downloadGedzipMedia = async (media, onProgress) => {
|
|
|
8565
9045
|
id: item.id,
|
|
8566
9046
|
imgId: item.imgId,
|
|
8567
9047
|
key: "key" in item ? item.key : void 0,
|
|
8568
|
-
contentType: item.contentType
|
|
9048
|
+
contentType: item.contentType,
|
|
9049
|
+
person: "person" in item ? item.person : void 0,
|
|
9050
|
+
tree: "tree" in item ? item.tree : void 0
|
|
8569
9051
|
});
|
|
8570
9052
|
if (!resolved?.content) {
|
|
8571
9053
|
return;
|
|
@@ -9090,7 +9572,7 @@ var collectExtensionTagsFrom = (node, into = /* @__PURE__ */ new Set()) => {
|
|
|
9090
9572
|
// package.json
|
|
9091
9573
|
var package_default = {
|
|
9092
9574
|
name: "@treeviz/gedcom-parser",
|
|
9093
|
-
version: "2.1.
|
|
9575
|
+
version: "2.1.11"};
|
|
9094
9576
|
|
|
9095
9577
|
// src/utils/get-product-details.ts
|
|
9096
9578
|
var isDevelopment = () => {
|
|
@@ -9175,16 +9657,26 @@ var Obje = class extends Common {
|
|
|
9175
9657
|
if (!this._gedcom) {
|
|
9176
9658
|
return this;
|
|
9177
9659
|
}
|
|
9660
|
+
if (typeof this.value === "string" && isId(this.value) && this.refType === "OBJE") {
|
|
9661
|
+
const resolved = this.ref;
|
|
9662
|
+
if (resolved && resolved !== this && typeof resolved.standardizeMedia === "function") {
|
|
9663
|
+
resolved.standardizeMedia(
|
|
9664
|
+
namespace,
|
|
9665
|
+
override,
|
|
9666
|
+
urlGetter,
|
|
9667
|
+
gedcomVersion
|
|
9668
|
+
);
|
|
9669
|
+
return this;
|
|
9670
|
+
}
|
|
9671
|
+
}
|
|
9178
9672
|
const rin = this?.get("RIN")?.toValue();
|
|
9179
|
-
const clone = this?.get("_CLON._OID")?.toValue();
|
|
9180
|
-
const mser = this?.get("_MSER._LKID")?.toValue();
|
|
9181
9673
|
const title = this?.get("FILE.TITL")?.toValue() ?? this?.get("TITL")?.toValue() ?? "";
|
|
9182
9674
|
const note = this?.get("FILE.NOTE")?.toValue() ?? this?.get("NOTE")?.toValue() ?? "";
|
|
9183
9675
|
const formRaw = this?.get("FILE.FORM")?.toValue() ?? this?.get("FORM")?.toValue();
|
|
9184
9676
|
const mediType = this?.get("FILE.FORM.TYPE")?.toValue() ?? this?.get("FORM.TYPE")?.toValue() ?? this?.get("MEDI")?.toValue();
|
|
9185
9677
|
const file = this?.get("FILE")?.toValue();
|
|
9186
|
-
const imgId =
|
|
9187
|
-
const url = file || namespace && urlGetter?.(namespace, imgId);
|
|
9678
|
+
const imgId = resolveObjeMediaId(this);
|
|
9679
|
+
const url = file || this.isAncestry() && namespace && urlGetter?.(namespace, imgId);
|
|
9188
9680
|
if (!url) {
|
|
9189
9681
|
return this;
|
|
9190
9682
|
}
|
|
@@ -9697,6 +10189,22 @@ var GedCom = class extends Common {
|
|
|
9697
10189
|
obje(index) {
|
|
9698
10190
|
return this.getMain(this.objes(), index);
|
|
9699
10191
|
}
|
|
10192
|
+
/**
|
|
10193
|
+
* People who link a shared multimedia record (`1 OBJE @On@`), i.e. Ancestry
|
|
10194
|
+
* face tags / everyone the photo is attached to.
|
|
10195
|
+
*/
|
|
10196
|
+
indisLinkingObje(objeKey) {
|
|
10197
|
+
const people = [];
|
|
10198
|
+
this.indis()?.forEach((indi) => {
|
|
10199
|
+
const linked = indi?.get("OBJE")?.toList()?.values()?.some(
|
|
10200
|
+
(item) => item?.toValue?.() === objeKey || item?.id === objeKey
|
|
10201
|
+
);
|
|
10202
|
+
if (linked && indi) {
|
|
10203
|
+
people.push(indi);
|
|
10204
|
+
}
|
|
10205
|
+
});
|
|
10206
|
+
return people;
|
|
10207
|
+
}
|
|
9700
10208
|
sour(index) {
|
|
9701
10209
|
return this.getMain(this.sours(), index);
|
|
9702
10210
|
}
|
|
@@ -10756,4 +11264,4 @@ var createEmptyGedcom = (options) => {
|
|
|
10756
11264
|
return gedcom;
|
|
10757
11265
|
};
|
|
10758
11266
|
|
|
10759
|
-
export { ACCEPTED_DATE_FORMATS, ACCEPTED_DATE_FORMATS_REGEX, ADOPTED, APP_BRANDING, BIOLOGICAL, BIRTH, BIRTH_ASC, BIRTH_DESC, Common, CommonDate, CommonName, CommonNote, CustomTags, DATE_ASC, DATE_DESC, DEATH_ASC, DEATH_DESC, DEFAULT, DEFAULT_GEDCOM_EXPORT_VERSION, EVERY, Existed, FEMALE, FOSTER, FRIEND, Fam, Families, GEDCOM7_CALENDARS, GEDCOM7_PEDI_VALUES, GEDCOM7_RESN_VALUES, GEDCOM7_ROLE_VALUES, GEDCOM7_SEX_VALUES, GEDCOM_EXPORT_VERSIONS, GEDZIP_EXTENSION, GEDZIP_GEDCOM_ENTRY, GEDZIP_MIME, GedCom, parser_default as GedcomTree, ID_GETTER_REG, ID_REG, ID_SPLIT_REG, Indi, Individuals, KinshipTranslator, KinshipTranslatorBasic, KinshipTranslatorDe as KinshipTranslatorDE, KinshipTranslatorEn as KinshipTranslatorEN, KinshipTranslatorEs as KinshipTranslatorES, KinshipTranslatorFr as KinshipTranslatorFR, KinshipTranslatorHU, KinshipTranslatorRu as KinshipTranslatorRU, LINE_REG, List, MALE, MAX_FILE_SIZE_TO_SYNC, ORIG_HEAD_TAG, OTHER, Obje, Objects, PARTNER, PEDIGREE_VALUES, PartnerType, PlaceType, REF_LINE_REG, Range, RelationType, Repo, Repositories, SEALING, SINGLE, SPOUSE, STEP, Sour, Sources, Subm, Submitters, TREEVIZ_EXTENSION_BASE_URI, TREEVIZ_EXTENSION_URIS, UNKOWN, addFamilyFact, addIndividualFact, addNonEvent, applyGedcom7DatePhrases, applyGedcom7Enumerations, applyGedcom7RecordMetadata, attachChildToFamily, attachSpouseToFamily, buildGedzip, buildGedzipBlob, bytesToDataUrl, cacheDiscoveredPath, canAttachAsSpouse, collectExtensionTagsFrom, commonDateFormatter, consolidateChildIntoFamily, coupleKeyForFam, create, createCommon, createCommonDate, createCommonName, createCommonNote, createEmptyGedcom, createFam, createGedCom, createGedcomUid, createIndi, createObje, createProxy, createRepo, createSour, createSubm, dateFormatter, parser_default as default, deleteIndividual, downloadGedzipMedia, ensureExtensionSchema, extractGedzip, extractGedzipGedcom, extractSeparationYears, extractSplitPoints, familyHasChild, familyHasParent, findDegenerateFamiliesForIndi, findDuplicateCoupleFamiliesForIndi, findMatchingRangeForSplitRange, findReusableParentChildFamily, firstPointerId, formatGedcom7Timestamp, fromTuple, generateSplitRanges, getAllProp, getBirthAsc, getCacheManagerFactory, getDateLocale, getExtensionSchema, getFamilyWith, getFileExtension, getI18n, getKinshipTranslatorClass, getListTag, getMarriageAsc, getMarriageAscAndBirth, getMarriageAscAndChildBirth, getName, getNameAsc, getNameAscAndBirth, getNameDesc, getPlaceParserProvider, getPlaceParts, getPlaceTranslatorProvider, getPlaces, getRawSize, getValidKey, getValidKeys, getValidTag, getVersion, hungarianOrdinalize, i18n, idGetter, implemented, inRange, inferMediaForm, initializeCache, isCommonDate, isDegenerateFamily, isDevelopment, isGedcom7, isGedcomString, isGedzipContainer, isId, isImageFormat, isIntersectedRange, isObjePointer, isOnlyMainProp, isRangeContained, isRemoteOrEmbeddedMediaUrl, isValidKey, makePointer, marriageDateFormatter, mergeDuplicateCoupleFamilies, mergeGedcoms, mergeMediaLists, nameFormatter, nextRecordId, normalizeGedcomVersion, notImplemented, noteDateFormatter, ordinalize, parseGedcom7CalendarPrefix, parseRangeBounds, pathCache, placeTranslator, pointerIds, profilePictureCache, pruneEmptyFamilies, pruneFamiliesByIds, registerExtensionTag, relativesCache, remountGedzipMediaAsDataUrls, removePointerByValue, resetCacheManagerFactory, resetDateLocaleProvider, resetI18nProvider, resetKinshipTranslatorClass, resetPlaceParserProvider, resetPlaceTranslatorProvider, resetRelativesCache, resolveLocalMediaUrl, resolveMediaContent, resolveObjeForm, rewriteGedcomFilePaths, setCacheManagerFactory, setCauseOfDeath, setChildPedigree, setDateLocaleProvider, setDeceased, setFamilyMarriage, setI18nProvider, setKinshipTranslatorClass, setLocalMediaResolver, setMediaContentResolver, setNestedGroup, setPlaceParserProvider, setPlaceTranslatorProvider, splitOverlappingRanges, splitRange, spouseTagFor, toGedcomPedigree, translators_exports as translators, unlinkRelative, updateFactRecord, validateGedcomContent, withGedcom7Calendar };
|
|
11267
|
+
export { ACCEPTED_DATE_FORMATS, ACCEPTED_DATE_FORMATS_REGEX, ADOPTED, ANCESTRY_MEDIA_RETRIEVAL_PREFIX, APP_BRANDING, BIOLOGICAL, BIRTH, BIRTH_ASC, BIRTH_DESC, Common, CommonDate, CommonName, CommonNote, CustomTags, DATE_ASC, DATE_DESC, DEATH_ASC, DEATH_DESC, DEFAULT, DEFAULT_GEDCOM_EXPORT_VERSION, EVERY, Existed, FEMALE, FOSTER, FRIEND, Fam, Families, GEDCOM7_CALENDARS, GEDCOM7_PEDI_VALUES, GEDCOM7_RESN_VALUES, GEDCOM7_ROLE_VALUES, GEDCOM7_SEX_VALUES, GEDCOM_EXPORT_VERSIONS, GEDZIP_EXTENSION, GEDZIP_GEDCOM_ENTRY, GEDZIP_MIME, GedCom, parser_default as GedcomTree, ID_GETTER_REG, ID_REG, ID_SPLIT_REG, Indi, Individuals, KinshipTranslator, KinshipTranslatorBasic, KinshipTranslatorDe as KinshipTranslatorDE, KinshipTranslatorEn as KinshipTranslatorEN, KinshipTranslatorEs as KinshipTranslatorES, KinshipTranslatorFr as KinshipTranslatorFR, KinshipTranslatorHU, KinshipTranslatorJa as KinshipTranslatorJA, KinshipTranslatorRu as KinshipTranslatorRU, KinshipTranslatorZh as KinshipTranslatorZH, LINE_REG, List, MALE, MAX_FILE_SIZE_TO_SYNC, ORIG_HEAD_TAG, OTHER, Obje, Objects, PARTNER, PEDIGREE_VALUES, PartnerType, PlaceType, REF_LINE_REG, Range, RelationType, Repo, Repositories, SEALING, SINGLE, SPOUSE, STEP, Sour, Sources, Subm, Submitters, TREEVIZ_EXTENSION_BASE_URI, TREEVIZ_EXTENSION_URIS, UNKOWN, addFamilyFact, addIndividualFact, addNonEvent, ancestryMediaFileUrl, applyGedcom7DatePhrases, applyGedcom7Enumerations, applyGedcom7RecordMetadata, attachChildToFamily, attachSpouseToFamily, buildGedzip, buildGedzipBlob, bytesToDataUrl, cacheDiscoveredPath, canAttachAsSpouse, collectExtensionTagsFrom, commonDateFormatter, consolidateChildIntoFamily, coupleKeyForFam, create, createCommon, createCommonDate, createCommonName, createCommonNote, createEmptyGedcom, createFam, createGedCom, createGedcomUid, createIndi, createObje, createProxy, createRepo, createSour, createSubm, dateFormatter, parser_default as default, deleteIndividual, downloadGedzipMedia, ensureExtensionSchema, extractGedzip, extractGedzipGedcom, extractSeparationYears, extractSplitPoints, familyHasChild, familyHasParent, findDegenerateFamiliesForIndi, findDuplicateCoupleFamiliesForIndi, findMatchingRangeForSplitRange, findReusableParentChildFamily, firstPointerId, formatGedcom7Timestamp, fromTuple, generateSplitRanges, getAllProp, getBirthAsc, getCacheManagerFactory, getDateLocale, getExtensionSchema, getFamilyWith, getFileExtension, getI18n, getKinshipTranslatorClass, getListTag, getMarriageAsc, getMarriageAscAndBirth, getMarriageAscAndChildBirth, getName, getNameAsc, getNameAscAndBirth, getNameDesc, getPlaceParserProvider, getPlaceParts, getPlaceTranslatorProvider, getPlaces, getRawSize, getValidKey, getValidKeys, getValidTag, getVersion, hungarianOrdinalize, i18n, idGetter, implemented, inRange, inferMediaForm, initializeCache, isCommonDate, isDegenerateFamily, isDevelopment, isGedcom7, isGedcomString, isGedzipContainer, isId, isImageFormat, isIntersectedRange, isObjePointer, isOnlyMainProp, isRangeContained, isRemoteOrEmbeddedMediaUrl, isValidKey, makePointer, marriageDateFormatter, mergeDuplicateCoupleFamilies, mergeGedcoms, mergeMediaLists, nameFormatter, nextRecordId, normalizeGedcomVersion, notImplemented, noteDateFormatter, objeNoteValue, objeXrefKey, ordinalize, parseGedcom7CalendarPrefix, parseRangeBounds, pathCache, placeTranslator, pointerIds, profilePictureCache, pruneEmptyFamilies, pruneFamiliesByIds, registerExtensionTag, relativesCache, remountGedzipMediaAsDataUrls, removePointerByValue, resetCacheManagerFactory, resetDateLocaleProvider, resetI18nProvider, resetKinshipTranslatorClass, resetPlaceParserProvider, resetPlaceTranslatorProvider, resetRelativesCache, resolveLocalMediaUrl, resolveMediaContent, resolveObjeForm, resolveObjeMediaId, rewriteGedcomFilePaths, setCacheManagerFactory, setCauseOfDeath, setChildPedigree, setDateLocaleProvider, setDeceased, setFamilyMarriage, setI18nProvider, setKinshipTranslatorClass, setLocalMediaResolver, setMediaContentResolver, setNestedGroup, setPlaceParserProvider, setPlaceTranslatorProvider, splitOverlappingRanges, splitRange, spouseTagFor, toGedcomPedigree, translators_exports as translators, unlinkRelative, updateFactRecord, validateGedcomContent, withGedcom7Calendar };
|