@treeviz/gedcom-parser 1.0.16 → 1.0.18

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.
@@ -1,2 +1,2 @@
1
- export { ao as Common, az as CommonDate, aQ as CommonName, aS as CommonNote, an as CustomTags, am as Existed, aC as Fam, aj as FamType, aE as Families, aL as FamilySearchMatch, aM as FamilySearchSource, aF as GedCom, ak as GedComType, a3 as GenealogyMember, aa as GenerationIndiType, a9 as GenerationSpouseType, aK as Indi, a5 as IndiGenealogy, ab as IndiGenealogyGenerations, ac as IndiGenealogyResult, a6 as IndiMarker, a4 as IndiTree, a1 as IndiType, aO as Individuals, aP as List, a8 as MemberMain, a7 as MemberSide, ad as NonNullIndiGenealogyResult, aU as Obje, al as ObjeType, aW as Objects, af as Path, ae as PathItem, Z as ProxyOriginal, ai as Queue, ah as QueueItem, ag as ReducedPath, aX as Repo, $ as RepoType, aZ as Repositories, a_ as Sour, _ as SourType, b0 as Sources, b1 as Subm, a0 as SubmType, b3 as Submitters, a2 as TreeMember, aq as createCommon, aA as createCommonDate, aR as createCommonName, aT as createCommonNote, aD as createFam, aG as createGedCom, aN as createIndi, aV as createObje, ap as createProxy, aY as createRepo, a$ as createSour, b2 as createSubm, av as getListTag, aw as getValidKey, at as getValidKeys, au as getValidTag, ay as idGetter, aB as isCommonDate, aH as isGedcomString, ax as isId, ar as isOnlyMainProp, as as isValidKey, aJ as mergeGedcoms, aI as validateGedcomContent } from '../index-BvW-KWJP.js';
1
+ export { ao as Common, az as CommonDate, aQ as CommonName, aS as CommonNote, an as CustomTags, am as Existed, aC as Fam, aj as FamType, aE as Families, aL as FamilySearchMatch, aM as FamilySearchSource, aF as GedCom, ak as GedComType, a3 as GenealogyMember, aa as GenerationIndiType, a9 as GenerationSpouseType, aK as Indi, a5 as IndiGenealogy, ab as IndiGenealogyGenerations, ac as IndiGenealogyResult, a6 as IndiMarker, a4 as IndiTree, a1 as IndiType, aO as Individuals, aP as List, a8 as MemberMain, a7 as MemberSide, ad as NonNullIndiGenealogyResult, aU as Obje, al as ObjeType, aW as Objects, af as Path, ae as PathItem, Z as ProxyOriginal, ai as Queue, ah as QueueItem, ag as ReducedPath, aX as Repo, $ as RepoType, aZ as Repositories, a_ as Sour, _ as SourType, b0 as Sources, b1 as Subm, a0 as SubmType, b3 as Submitters, a2 as TreeMember, aq as createCommon, aA as createCommonDate, aR as createCommonName, aT as createCommonNote, aD as createFam, aG as createGedCom, aN as createIndi, aV as createObje, ap as createProxy, aY as createRepo, a$ as createSour, b2 as createSubm, av as getListTag, aw as getValidKey, at as getValidKeys, au as getValidTag, ay as idGetter, aB as isCommonDate, aH as isGedcomString, ax as isId, ar as isOnlyMainProp, as as isValidKey, aJ as mergeGedcoms, aI as validateGedcomContent } from '../index-DFTsiD5J.js';
2
2
  import 'date-fns';
@@ -369,7 +369,7 @@ var List = class _List {
369
369
  const [key, { getter }] = Object.entries(
370
370
  typeof groups === "string" ? { [groups]: {} } : groups
371
371
  )[0];
372
- const raw = item.get(key)?.toList().index(0);
372
+ const raw = item.get(key)?.index(0);
373
373
  let value = raw?.toValue();
374
374
  if (getter && typeof getter === "function") {
375
375
  value = getter(value, raw);
@@ -702,6 +702,9 @@ var Common = class _Common {
702
702
  this.id ? { [this.id]: this } : { ...[this] }
703
703
  );
704
704
  }
705
+ index(i) {
706
+ return this.toList()?.index(i);
707
+ }
705
708
  toValueList() {
706
709
  return new List().concat(
707
710
  this.value ? { [this.value]: this } : (
@@ -1008,7 +1011,7 @@ var nameFormatter = (indiName, settings, letterOnAll = true, indi, debug) => {
1008
1011
  maxSurnames = 0
1009
1012
  } = settings ?? {};
1010
1013
  const rawName = indiName instanceof Indi ? indiName?.NAME : createCommonName(void 0, void 0, indi).name(indiName);
1011
- const name = rawName?.toList().index(0);
1014
+ const name = rawName?.index(0);
1012
1015
  let givenname = name?.GIVN?.toValueList().first()?.value || "";
1013
1016
  let surname = name?.SURN?.toValueList().first()?.value || "";
1014
1017
  let suffix = name?.NSFX?.toValueList().first()?.value || "";
@@ -2988,8 +2991,8 @@ chars.reduce((acc, curr, idx) => {
2988
2991
  return acc;
2989
2992
  }, {});
2990
2993
  var getBirthAsc = (itemA, _keyA, itemB, _keyB) => {
2991
- const birthA = itemA?.BIRT?.toList().index(0);
2992
- const birthB = itemB?.BIRT?.toList().index(0);
2994
+ const birthA = itemA?.BIRT?.index(0);
2995
+ const birthB = itemB?.BIRT?.index(0);
2993
2996
  const valueA = birthA?.DATE?.rawValue;
2994
2997
  const valueB = birthB?.DATE?.rawValue;
2995
2998
  if (valueA?.getTime() === valueB?.getTime()) {
@@ -3240,8 +3243,8 @@ var Individuals = class _Individuals extends List {
3240
3243
  getFirstEvent() {
3241
3244
  const firstBirthPerson = this.getFirstBirth();
3242
3245
  const firstDeathPerson = this.getFirstDeath();
3243
- const firstBirth = firstBirthPerson?.BIRT?.toList().index(0);
3244
- const firstDeath = firstDeathPerson?.DEAT?.toList().index(0);
3246
+ const firstBirth = firstBirthPerson?.BIRT?.index(0);
3247
+ const firstDeath = firstDeathPerson?.DEAT?.index(0);
3245
3248
  if (!firstBirth?.DATE?.rawValue && !firstDeath?.DATE?.rawValue) {
3246
3249
  return void 0;
3247
3250
  }
@@ -3259,8 +3262,8 @@ var Individuals = class _Individuals extends List {
3259
3262
  getLastEvent() {
3260
3263
  const lastDeathPerson = this.getLastDeath();
3261
3264
  const lastBirthPerson = this.getLastBirth();
3262
- const lastBirth = lastBirthPerson?.BIRT?.toList().index(0);
3263
- const lastDeath = lastDeathPerson?.DEAT?.toList().index(0);
3265
+ const lastBirth = lastBirthPerson?.BIRT?.index(0);
3266
+ const lastDeath = lastDeathPerson?.DEAT?.index(0);
3264
3267
  if (!lastBirth?.DATE?.rawValue && !lastDeath?.DATE?.rawValue) {
3265
3268
  return void 0;
3266
3269
  }
@@ -3277,7 +3280,7 @@ var Individuals = class _Individuals extends List {
3277
3280
  }
3278
3281
  getFirstBirth() {
3279
3282
  return this.filter((item) => {
3280
- const birth = item.BIRT?.toList().index(0);
3283
+ const birth = item.BIRT?.index(0);
3281
3284
  if (birth?.DATE?.rawValue?.getTime() === 0) {
3282
3285
  return true;
3283
3286
  }
@@ -3286,7 +3289,7 @@ var Individuals = class _Individuals extends List {
3286
3289
  }
3287
3290
  getLastBirth() {
3288
3291
  return this.filter((item) => {
3289
- const birth = item.BIRT?.toList().index(0);
3292
+ const birth = item.BIRT?.index(0);
3290
3293
  if (birth?.DATE?.rawValue?.getTime() === 0) {
3291
3294
  return true;
3292
3295
  }
@@ -3295,7 +3298,7 @@ var Individuals = class _Individuals extends List {
3295
3298
  }
3296
3299
  getFirstDeath() {
3297
3300
  return this.filter((item) => {
3298
- const death = item.DEAT?.toList().index(0);
3301
+ const death = item.DEAT?.index(0);
3299
3302
  if (death?.DATE?.rawValue?.getTime() === 0) {
3300
3303
  return true;
3301
3304
  }
@@ -3304,7 +3307,7 @@ var Individuals = class _Individuals extends List {
3304
3307
  }
3305
3308
  getLastDeath() {
3306
3309
  return this.filter((item) => {
3307
- const death = item.DEAT?.toList().index(0);
3310
+ const death = item.DEAT?.index(0);
3308
3311
  if (death?.DATE?.rawValue?.getTime() === 0) {
3309
3312
  return true;
3310
3313
  }
@@ -4094,7 +4097,7 @@ var Indi = class extends Common {
4094
4097
  });
4095
4098
  }
4096
4099
  getGenealogy(onlyStraight = false, showDescendants = false) {
4097
- const id = this.get("FAMC")?.toList().index(0)?.toValue();
4100
+ const id = this.get("FAMC")?.index(0)?.toValue();
4098
4101
  if (!id) {
4099
4102
  return;
4100
4103
  }
@@ -4587,11 +4590,11 @@ var Indi = class extends Common {
4587
4590
  return dates.death || void 0;
4588
4591
  }
4589
4592
  getBirthPlace() {
4590
- const birthEvent = this.get("BIRT")?.toList().index(0);
4593
+ const birthEvent = this.get("BIRT")?.index(0);
4591
4594
  return birthEvent?.PLAC?.value;
4592
4595
  }
4593
4596
  getDeathPlace() {
4594
- const deathEvent = this.get("DEAT")?.toList().index(0);
4597
+ const deathEvent = this.get("DEAT")?.index(0);
4595
4598
  return deathEvent?.PLAC?.value;
4596
4599
  }
4597
4600
  isDead() {
@@ -5745,7 +5748,7 @@ var createIndi = (gedcom, id, main, parent) => {
5745
5748
 
5746
5749
  // package.json
5747
5750
  var package_default = {
5748
- version: "1.0.16"};
5751
+ version: "1.0.18"};
5749
5752
 
5750
5753
  // src/utils/get-product-details.ts
5751
5754
  var getVersion = () => package_default.version;
@@ -6118,7 +6121,7 @@ var GedCom = class extends Common {
6118
6121
  });
6119
6122
  const surnames = /* @__PURE__ */ new Map();
6120
6123
  indis?.forEach((indi) => {
6121
- const name = indi.NAME?.toValue();
6124
+ const name = indi.NAME?.index(0)?.toValue();
6122
6125
  if (name) {
6123
6126
  const match = name.match(/\/(.+?)\//);
6124
6127
  if (match) {
@@ -6130,7 +6133,7 @@ var GedCom = class extends Common {
6130
6133
  const topSurnames = Array.from(surnames.entries()).sort((a, b) => b[1] - a[1]).slice(0, 10).map(([surname, count]) => ({ surname, count }));
6131
6134
  const birthPlaces = /* @__PURE__ */ new Map();
6132
6135
  indis?.forEach((indi) => {
6133
- const place = indi.BIRT?.PLAC?.value;
6136
+ const place = indi.BIRT?.index(0)?.PLAC?.index(0)?.toValue();
6134
6137
  if (place) {
6135
6138
  birthPlaces.set(place, (birthPlaces.get(place) || 0) + 1);
6136
6139
  }
@@ -6138,14 +6141,14 @@ var GedCom = class extends Common {
6138
6141
  const topBirthPlaces = Array.from(birthPlaces.entries()).sort((a, b) => b[1] - a[1]).slice(0, 10).map(([place, count]) => ({ place, count }));
6139
6142
  const years = [];
6140
6143
  indis?.forEach((indi) => {
6141
- const birthDate = indi.BIRT?.DATE?.toValue();
6144
+ const birthDate = indi.BIRT?.index(0)?.DATE?.index(0)?.toValue();
6142
6145
  if (birthDate) {
6143
6146
  const match = birthDate.match(/\d{4}/);
6144
6147
  if (match) {
6145
6148
  years.push(parseInt(match[0], 10));
6146
6149
  }
6147
6150
  }
6148
- const deathDate = indi.DEAT?.DATE?.toValue();
6151
+ const deathDate = indi.DEAT?.index(0)?.DATE?.index(0)?.toValue();
6149
6152
  if (deathDate) {
6150
6153
  const match = deathDate.match(/\d{4}/);
6151
6154
  if (match) {
@@ -6157,8 +6160,8 @@ var GedCom = class extends Common {
6157
6160
  const maxYear = years.length > 0 ? Math.max(...years) : null;
6158
6161
  const lifespans = [];
6159
6162
  indis?.forEach((indi) => {
6160
- const birthDate = indi.BIRT?.DATE?.toValue();
6161
- const deathDate = indi.DEAT?.DATE?.toValue();
6163
+ const birthDate = indi.BIRT?.index(0)?.DATE?.index(0)?.toValue();
6164
+ const deathDate = indi.DEAT?.index(0)?.DATE?.index(0)?.toValue();
6162
6165
  if (birthDate && deathDate) {
6163
6166
  const birthMatch = birthDate.match(/\d{4}/);
6164
6167
  const deathMatch = deathDate.match(/\d{4}/);
@@ -6173,8 +6176,8 @@ var GedCom = class extends Common {
6173
6176
  });
6174
6177
  const avgLifespan = lifespans.length > 0 ? lifespans.reduce((sum, age) => sum + age, 0) / lifespans.length : null;
6175
6178
  const firstPerson = indis?.getFirstEvent();
6176
- const firstBirth = firstPerson?.BIRT?.toList().index(0);
6177
- const firstDeath = firstPerson?.DEAT?.toList().index(0);
6179
+ const firstBirth = firstPerson?.BIRT?.index(0);
6180
+ const firstDeath = firstPerson?.DEAT?.index(0);
6178
6181
  let firstPersonEvent = null;
6179
6182
  const firstBirthDate = firstBirth?.DATE?.rawValue;
6180
6183
  const firstDeathDate = firstDeath?.DATE?.rawValue;
@@ -6187,8 +6190,8 @@ var GedCom = class extends Common {
6187
6190
  };
6188
6191
  }
6189
6192
  const lastPerson = indis?.getLastEvent();
6190
- const lastBirth = lastPerson?.BIRT?.toList().index(0);
6191
- const lastDeath = lastPerson?.DEAT?.toList().index(0);
6193
+ const lastBirth = lastPerson?.BIRT?.index(0);
6194
+ const lastDeath = lastPerson?.DEAT?.index(0);
6192
6195
  let lastPersonEvent = null;
6193
6196
  const lastBirthDate = lastBirth?.DATE?.rawValue;
6194
6197
  const lastDeathDate = lastDeath?.DATE?.rawValue;
package/dist/cli/index.js CHANGED
@@ -305,7 +305,7 @@ var List = class _List {
305
305
  const [key, { getter }] = Object.entries(
306
306
  typeof groups === "string" ? { [groups]: {} } : groups
307
307
  )[0];
308
- const raw = item.get(key)?.toList().index(0);
308
+ const raw = item.get(key)?.index(0);
309
309
  let value = raw?.toValue();
310
310
  if (getter && typeof getter === "function") {
311
311
  value = getter(value, raw);
@@ -638,6 +638,9 @@ var Common = class _Common {
638
638
  this.id ? { [this.id]: this } : { ...[this] }
639
639
  );
640
640
  }
641
+ index(i) {
642
+ return this.toList()?.index(i);
643
+ }
641
644
  toValueList() {
642
645
  return new List().concat(
643
646
  this.value ? { [this.value]: this } : (
@@ -1660,7 +1663,7 @@ var Indi = class extends Common {
1660
1663
  });
1661
1664
  }
1662
1665
  getGenealogy(onlyStraight = false, showDescendants = false) {
1663
- const id = this.get("FAMC")?.toList().index(0)?.toValue();
1666
+ const id = this.get("FAMC")?.index(0)?.toValue();
1664
1667
  if (!id) {
1665
1668
  return;
1666
1669
  }
@@ -2153,11 +2156,11 @@ var Indi = class extends Common {
2153
2156
  return dates.death || void 0;
2154
2157
  }
2155
2158
  getBirthPlace() {
2156
- const birthEvent = this.get("BIRT")?.toList().index(0);
2159
+ const birthEvent = this.get("BIRT")?.index(0);
2157
2160
  return birthEvent?.PLAC?.value;
2158
2161
  }
2159
2162
  getDeathPlace() {
2160
- const deathEvent = this.get("DEAT")?.toList().index(0);
2163
+ const deathEvent = this.get("DEAT")?.index(0);
2161
2164
  return deathEvent?.PLAC?.value;
2162
2165
  }
2163
2166
  isDead() {
@@ -3317,7 +3320,7 @@ var nameFormatter = (indiName, settings, letterOnAll = true, indi, debug) => {
3317
3320
  maxSurnames = 0
3318
3321
  } = settings ?? {};
3319
3322
  const rawName = indiName instanceof Indi ? indiName?.NAME : createCommonName(void 0, void 0, indi).name(indiName);
3320
- const name = rawName?.toList().index(0);
3323
+ const name = rawName?.index(0);
3321
3324
  let givenname = name?.GIVN?.toValueList().first()?.value || "";
3322
3325
  let surname = name?.SURN?.toValueList().first()?.value || "";
3323
3326
  let suffix = name?.NSFX?.toValueList().first()?.value || "";
@@ -5101,8 +5104,8 @@ chars.reduce((acc, curr, idx) => {
5101
5104
  return acc;
5102
5105
  }, {});
5103
5106
  var getBirthAsc = (itemA, _keyA, itemB, _keyB) => {
5104
- const birthA = itemA?.BIRT?.toList().index(0);
5105
- const birthB = itemB?.BIRT?.toList().index(0);
5107
+ const birthA = itemA?.BIRT?.index(0);
5108
+ const birthB = itemB?.BIRT?.index(0);
5106
5109
  const valueA = birthA?.DATE?.rawValue;
5107
5110
  const valueB = birthB?.DATE?.rawValue;
5108
5111
  if (valueA?.getTime() === valueB?.getTime()) {
@@ -5225,8 +5228,8 @@ var Individuals = class _Individuals extends List {
5225
5228
  getFirstEvent() {
5226
5229
  const firstBirthPerson = this.getFirstBirth();
5227
5230
  const firstDeathPerson = this.getFirstDeath();
5228
- const firstBirth = firstBirthPerson?.BIRT?.toList().index(0);
5229
- const firstDeath = firstDeathPerson?.DEAT?.toList().index(0);
5231
+ const firstBirth = firstBirthPerson?.BIRT?.index(0);
5232
+ const firstDeath = firstDeathPerson?.DEAT?.index(0);
5230
5233
  if (!firstBirth?.DATE?.rawValue && !firstDeath?.DATE?.rawValue) {
5231
5234
  return void 0;
5232
5235
  }
@@ -5244,8 +5247,8 @@ var Individuals = class _Individuals extends List {
5244
5247
  getLastEvent() {
5245
5248
  const lastDeathPerson = this.getLastDeath();
5246
5249
  const lastBirthPerson = this.getLastBirth();
5247
- const lastBirth = lastBirthPerson?.BIRT?.toList().index(0);
5248
- const lastDeath = lastDeathPerson?.DEAT?.toList().index(0);
5250
+ const lastBirth = lastBirthPerson?.BIRT?.index(0);
5251
+ const lastDeath = lastDeathPerson?.DEAT?.index(0);
5249
5252
  if (!lastBirth?.DATE?.rawValue && !lastDeath?.DATE?.rawValue) {
5250
5253
  return void 0;
5251
5254
  }
@@ -5262,7 +5265,7 @@ var Individuals = class _Individuals extends List {
5262
5265
  }
5263
5266
  getFirstBirth() {
5264
5267
  return this.filter((item) => {
5265
- const birth = item.BIRT?.toList().index(0);
5268
+ const birth = item.BIRT?.index(0);
5266
5269
  if (birth?.DATE?.rawValue?.getTime() === 0) {
5267
5270
  return true;
5268
5271
  }
@@ -5271,7 +5274,7 @@ var Individuals = class _Individuals extends List {
5271
5274
  }
5272
5275
  getLastBirth() {
5273
5276
  return this.filter((item) => {
5274
- const birth = item.BIRT?.toList().index(0);
5277
+ const birth = item.BIRT?.index(0);
5275
5278
  if (birth?.DATE?.rawValue?.getTime() === 0) {
5276
5279
  return true;
5277
5280
  }
@@ -5280,7 +5283,7 @@ var Individuals = class _Individuals extends List {
5280
5283
  }
5281
5284
  getFirstDeath() {
5282
5285
  return this.filter((item) => {
5283
- const death = item.DEAT?.toList().index(0);
5286
+ const death = item.DEAT?.index(0);
5284
5287
  if (death?.DATE?.rawValue?.getTime() === 0) {
5285
5288
  return true;
5286
5289
  }
@@ -5289,7 +5292,7 @@ var Individuals = class _Individuals extends List {
5289
5292
  }
5290
5293
  getLastDeath() {
5291
5294
  return this.filter((item) => {
5292
- const death = item.DEAT?.toList().index(0);
5295
+ const death = item.DEAT?.index(0);
5293
5296
  if (death?.DATE?.rawValue?.getTime() === 0) {
5294
5297
  return true;
5295
5298
  }
@@ -5738,7 +5741,7 @@ var Families = class _Families extends List {
5738
5741
 
5739
5742
  // package.json
5740
5743
  var package_default = {
5741
- version: "1.0.16"};
5744
+ version: "1.0.18"};
5742
5745
 
5743
5746
  // src/utils/get-product-details.ts
5744
5747
  var isDevelopment = () => {
@@ -6114,7 +6117,7 @@ var GedCom = class extends Common {
6114
6117
  });
6115
6118
  const surnames = /* @__PURE__ */ new Map();
6116
6119
  indis?.forEach((indi) => {
6117
- const name = indi.NAME?.toValue();
6120
+ const name = indi.NAME?.index(0)?.toValue();
6118
6121
  if (name) {
6119
6122
  const match = name.match(/\/(.+?)\//);
6120
6123
  if (match) {
@@ -6126,7 +6129,7 @@ var GedCom = class extends Common {
6126
6129
  const topSurnames = Array.from(surnames.entries()).sort((a, b) => b[1] - a[1]).slice(0, 10).map(([surname, count]) => ({ surname, count }));
6127
6130
  const birthPlaces = /* @__PURE__ */ new Map();
6128
6131
  indis?.forEach((indi) => {
6129
- const place = indi.BIRT?.PLAC?.value;
6132
+ const place = indi.BIRT?.index(0)?.PLAC?.index(0)?.toValue();
6130
6133
  if (place) {
6131
6134
  birthPlaces.set(place, (birthPlaces.get(place) || 0) + 1);
6132
6135
  }
@@ -6134,14 +6137,14 @@ var GedCom = class extends Common {
6134
6137
  const topBirthPlaces = Array.from(birthPlaces.entries()).sort((a, b) => b[1] - a[1]).slice(0, 10).map(([place, count]) => ({ place, count }));
6135
6138
  const years = [];
6136
6139
  indis?.forEach((indi) => {
6137
- const birthDate = indi.BIRT?.DATE?.toValue();
6140
+ const birthDate = indi.BIRT?.index(0)?.DATE?.index(0)?.toValue();
6138
6141
  if (birthDate) {
6139
6142
  const match = birthDate.match(/\d{4}/);
6140
6143
  if (match) {
6141
6144
  years.push(parseInt(match[0], 10));
6142
6145
  }
6143
6146
  }
6144
- const deathDate = indi.DEAT?.DATE?.toValue();
6147
+ const deathDate = indi.DEAT?.index(0)?.DATE?.index(0)?.toValue();
6145
6148
  if (deathDate) {
6146
6149
  const match = deathDate.match(/\d{4}/);
6147
6150
  if (match) {
@@ -6153,8 +6156,8 @@ var GedCom = class extends Common {
6153
6156
  const maxYear = years.length > 0 ? Math.max(...years) : null;
6154
6157
  const lifespans = [];
6155
6158
  indis?.forEach((indi) => {
6156
- const birthDate = indi.BIRT?.DATE?.toValue();
6157
- const deathDate = indi.DEAT?.DATE?.toValue();
6159
+ const birthDate = indi.BIRT?.index(0)?.DATE?.index(0)?.toValue();
6160
+ const deathDate = indi.DEAT?.index(0)?.DATE?.index(0)?.toValue();
6158
6161
  if (birthDate && deathDate) {
6159
6162
  const birthMatch = birthDate.match(/\d{4}/);
6160
6163
  const deathMatch = deathDate.match(/\d{4}/);
@@ -6169,8 +6172,8 @@ var GedCom = class extends Common {
6169
6172
  });
6170
6173
  const avgLifespan = lifespans.length > 0 ? lifespans.reduce((sum, age) => sum + age, 0) / lifespans.length : null;
6171
6174
  const firstPerson = indis?.getFirstEvent();
6172
- const firstBirth = firstPerson?.BIRT?.toList().index(0);
6173
- const firstDeath = firstPerson?.DEAT?.toList().index(0);
6175
+ const firstBirth = firstPerson?.BIRT?.index(0);
6176
+ const firstDeath = firstPerson?.DEAT?.index(0);
6174
6177
  let firstPersonEvent = null;
6175
6178
  const firstBirthDate = firstBirth?.DATE?.rawValue;
6176
6179
  const firstDeathDate = firstDeath?.DATE?.rawValue;
@@ -6183,8 +6186,8 @@ var GedCom = class extends Common {
6183
6186
  };
6184
6187
  }
6185
6188
  const lastPerson = indis?.getLastEvent();
6186
- const lastBirth = lastPerson?.BIRT?.toList().index(0);
6187
- const lastDeath = lastPerson?.DEAT?.toList().index(0);
6189
+ const lastBirth = lastPerson?.BIRT?.index(0);
6190
+ const lastDeath = lastPerson?.DEAT?.index(0);
6188
6191
  let lastPersonEvent = null;
6189
6192
  const lastBirthDate = lastBirth?.DATE?.rawValue;
6190
6193
  const lastDeathDate = lastDeath?.DATE?.rawValue;
@@ -1,4 +1,4 @@
1
- import { x as Filter, y as RequiredFilter, W as RelationType, X as PartnerType, A as Order, K as NameOrder, B as OrderIterator, a1 as IndiType, n as IndiKey } from '../index-BvW-KWJP.js';
1
+ import { x as Filter, y as RequiredFilter, W as RelationType, X as PartnerType, A as Order, K as NameOrder, B as OrderIterator, a1 as IndiType, n as IndiKey } from '../index-DFTsiD5J.js';
2
2
  import 'date-fns';
3
3
 
4
4
  /**
@@ -559,6 +559,9 @@ var Common = class _Common {
559
559
  this.id ? { [this.id]: this } : { ...[this] }
560
560
  );
561
561
  }
562
+ index(i) {
563
+ return this.toList()?.index(i);
564
+ }
562
565
  toValueList() {
563
566
  return new List().concat(
564
567
  this.value ? { [this.value]: this } : (
@@ -1095,7 +1098,7 @@ var List = class _List {
1095
1098
  const [key, { getter }] = Object.entries(
1096
1099
  typeof groups === "string" ? { [groups]: {} } : groups
1097
1100
  )[0];
1098
- const raw = item.get(key)?.toList().index(0);
1101
+ const raw = item.get(key)?.index(0);
1099
1102
  let value = raw?.toValue();
1100
1103
  if (getter && typeof getter === "function") {
1101
1104
  value = getter(value, raw);
@@ -1373,8 +1376,8 @@ var Individuals = class _Individuals extends List {
1373
1376
  getFirstEvent() {
1374
1377
  const firstBirthPerson = this.getFirstBirth();
1375
1378
  const firstDeathPerson = this.getFirstDeath();
1376
- const firstBirth = firstBirthPerson?.BIRT?.toList().index(0);
1377
- const firstDeath = firstDeathPerson?.DEAT?.toList().index(0);
1379
+ const firstBirth = firstBirthPerson?.BIRT?.index(0);
1380
+ const firstDeath = firstDeathPerson?.DEAT?.index(0);
1378
1381
  if (!firstBirth?.DATE?.rawValue && !firstDeath?.DATE?.rawValue) {
1379
1382
  return void 0;
1380
1383
  }
@@ -1392,8 +1395,8 @@ var Individuals = class _Individuals extends List {
1392
1395
  getLastEvent() {
1393
1396
  const lastDeathPerson = this.getLastDeath();
1394
1397
  const lastBirthPerson = this.getLastBirth();
1395
- const lastBirth = lastBirthPerson?.BIRT?.toList().index(0);
1396
- const lastDeath = lastDeathPerson?.DEAT?.toList().index(0);
1398
+ const lastBirth = lastBirthPerson?.BIRT?.index(0);
1399
+ const lastDeath = lastDeathPerson?.DEAT?.index(0);
1397
1400
  if (!lastBirth?.DATE?.rawValue && !lastDeath?.DATE?.rawValue) {
1398
1401
  return void 0;
1399
1402
  }
@@ -1410,7 +1413,7 @@ var Individuals = class _Individuals extends List {
1410
1413
  }
1411
1414
  getFirstBirth() {
1412
1415
  return this.filter((item) => {
1413
- const birth = item.BIRT?.toList().index(0);
1416
+ const birth = item.BIRT?.index(0);
1414
1417
  if (birth?.DATE?.rawValue?.getTime() === 0) {
1415
1418
  return true;
1416
1419
  }
@@ -1419,7 +1422,7 @@ var Individuals = class _Individuals extends List {
1419
1422
  }
1420
1423
  getLastBirth() {
1421
1424
  return this.filter((item) => {
1422
- const birth = item.BIRT?.toList().index(0);
1425
+ const birth = item.BIRT?.index(0);
1423
1426
  if (birth?.DATE?.rawValue?.getTime() === 0) {
1424
1427
  return true;
1425
1428
  }
@@ -1428,7 +1431,7 @@ var Individuals = class _Individuals extends List {
1428
1431
  }
1429
1432
  getFirstDeath() {
1430
1433
  return this.filter((item) => {
1431
- const death = item.DEAT?.toList().index(0);
1434
+ const death = item.DEAT?.index(0);
1432
1435
  if (death?.DATE?.rawValue?.getTime() === 0) {
1433
1436
  return true;
1434
1437
  }
@@ -1437,7 +1440,7 @@ var Individuals = class _Individuals extends List {
1437
1440
  }
1438
1441
  getLastDeath() {
1439
1442
  return this.filter((item) => {
1440
- const death = item.DEAT?.toList().index(0);
1443
+ const death = item.DEAT?.index(0);
1441
1444
  if (death?.DATE?.rawValue?.getTime() === 0) {
1442
1445
  return true;
1443
1446
  }
@@ -2255,7 +2258,7 @@ var Indi = class extends Common {
2255
2258
  });
2256
2259
  }
2257
2260
  getGenealogy(onlyStraight = false, showDescendants = false) {
2258
- const id = this.get("FAMC")?.toList().index(0)?.toValue();
2261
+ const id = this.get("FAMC")?.index(0)?.toValue();
2259
2262
  if (!id) {
2260
2263
  return;
2261
2264
  }
@@ -2748,11 +2751,11 @@ var Indi = class extends Common {
2748
2751
  return dates.death || void 0;
2749
2752
  }
2750
2753
  getBirthPlace() {
2751
- const birthEvent = this.get("BIRT")?.toList().index(0);
2754
+ const birthEvent = this.get("BIRT")?.index(0);
2752
2755
  return birthEvent?.PLAC?.value;
2753
2756
  }
2754
2757
  getDeathPlace() {
2755
- const deathEvent = this.get("DEAT")?.toList().index(0);
2758
+ const deathEvent = this.get("DEAT")?.index(0);
2756
2759
  return deathEvent?.PLAC?.value;
2757
2760
  }
2758
2761
  isDead() {
@@ -3912,7 +3915,7 @@ var nameFormatter = (indiName, settings, letterOnAll = true, indi, debug) => {
3912
3915
  maxSurnames = 0
3913
3916
  } = settings ?? {};
3914
3917
  const rawName = indiName instanceof Indi ? indiName?.NAME : createCommonName(void 0, void 0, indi).name(indiName);
3915
- const name = rawName?.toList().index(0);
3918
+ const name = rawName?.index(0);
3916
3919
  let givenname = name?.GIVN?.toValueList().first()?.value || "";
3917
3920
  let surname = name?.SURN?.toValueList().first()?.value || "";
3918
3921
  let suffix = name?.NSFX?.toValueList().first()?.value || "";
@@ -5733,8 +5736,8 @@ var getNameAsc = (nameOrder = "first-last") => (itemA, _keyA, itemB, _keyB) => {
5733
5736
  );
5734
5737
  };
5735
5738
  var getBirthAsc = (itemA, _keyA, itemB, _keyB) => {
5736
- const birthA = itemA?.BIRT?.toList().index(0);
5737
- const birthB = itemB?.BIRT?.toList().index(0);
5739
+ const birthA = itemA?.BIRT?.index(0);
5740
+ const birthB = itemB?.BIRT?.index(0);
5738
5741
  const valueA = birthA?.DATE?.rawValue;
5739
5742
  const valueB = birthB?.DATE?.rawValue;
5740
5743
  if (valueA?.getTime() === valueB?.getTime()) {
@@ -1,6 +1,6 @@
1
- import { I as ICacheManager, P as PlaceParts } from '../place-parser-RlXCXZ8F.js';
1
+ import { I as ICacheManager, P as PlaceParts } from '../place-parser-BsrTDadc.js';
2
2
  import { Locale } from 'date-fns';
3
- import { a1 as IndiType, n as IndiKey, L as Language } from '../index-BvW-KWJP.js';
3
+ import { a1 as IndiType, n as IndiKey, L as Language } from '../index-DFTsiD5J.js';
4
4
 
5
5
  /**
6
6
  * Factory function type for creating cache manager instances.
@@ -628,7 +628,7 @@ var List = class _List {
628
628
  const [key, { getter }] = Object.entries(
629
629
  typeof groups === "string" ? { [groups]: {} } : groups
630
630
  )[0];
631
- const raw = item.get(key)?.toList().index(0);
631
+ const raw = item.get(key)?.index(0);
632
632
  let value = raw?.toValue();
633
633
  if (getter && typeof getter === "function") {
634
634
  value = getter(value, raw);
@@ -961,6 +961,9 @@ var Common = class _Common {
961
961
  this.id ? { [this.id]: this } : { ...[this] }
962
962
  );
963
963
  }
964
+ index(i) {
965
+ return this.toList()?.index(i);
966
+ }
964
967
  toValueList() {
965
968
  return new List().concat(
966
969
  this.value ? { [this.value]: this } : (
@@ -1520,8 +1523,8 @@ chars.reduce((acc, curr, idx) => {
1520
1523
  return acc;
1521
1524
  }, {});
1522
1525
  var getBirthAsc = (itemA, _keyA, itemB, _keyB) => {
1523
- const birthA = itemA?.BIRT?.toList().index(0);
1524
- const birthB = itemB?.BIRT?.toList().index(0);
1526
+ const birthA = itemA?.BIRT?.index(0);
1527
+ const birthB = itemB?.BIRT?.index(0);
1525
1528
  const valueA = birthA?.DATE?.rawValue;
1526
1529
  const valueB = birthB?.DATE?.rawValue;
1527
1530
  if (valueA?.getTime() === valueB?.getTime()) {
@@ -1796,8 +1799,8 @@ var Individuals = class _Individuals extends List {
1796
1799
  getFirstEvent() {
1797
1800
  const firstBirthPerson = this.getFirstBirth();
1798
1801
  const firstDeathPerson = this.getFirstDeath();
1799
- const firstBirth = firstBirthPerson?.BIRT?.toList().index(0);
1800
- const firstDeath = firstDeathPerson?.DEAT?.toList().index(0);
1802
+ const firstBirth = firstBirthPerson?.BIRT?.index(0);
1803
+ const firstDeath = firstDeathPerson?.DEAT?.index(0);
1801
1804
  if (!firstBirth?.DATE?.rawValue && !firstDeath?.DATE?.rawValue) {
1802
1805
  return void 0;
1803
1806
  }
@@ -1815,8 +1818,8 @@ var Individuals = class _Individuals extends List {
1815
1818
  getLastEvent() {
1816
1819
  const lastDeathPerson = this.getLastDeath();
1817
1820
  const lastBirthPerson = this.getLastBirth();
1818
- const lastBirth = lastBirthPerson?.BIRT?.toList().index(0);
1819
- const lastDeath = lastDeathPerson?.DEAT?.toList().index(0);
1821
+ const lastBirth = lastBirthPerson?.BIRT?.index(0);
1822
+ const lastDeath = lastDeathPerson?.DEAT?.index(0);
1820
1823
  if (!lastBirth?.DATE?.rawValue && !lastDeath?.DATE?.rawValue) {
1821
1824
  return void 0;
1822
1825
  }
@@ -1833,7 +1836,7 @@ var Individuals = class _Individuals extends List {
1833
1836
  }
1834
1837
  getFirstBirth() {
1835
1838
  return this.filter((item) => {
1836
- const birth = item.BIRT?.toList().index(0);
1839
+ const birth = item.BIRT?.index(0);
1837
1840
  if (birth?.DATE?.rawValue?.getTime() === 0) {
1838
1841
  return true;
1839
1842
  }
@@ -1842,7 +1845,7 @@ var Individuals = class _Individuals extends List {
1842
1845
  }
1843
1846
  getLastBirth() {
1844
1847
  return this.filter((item) => {
1845
- const birth = item.BIRT?.toList().index(0);
1848
+ const birth = item.BIRT?.index(0);
1846
1849
  if (birth?.DATE?.rawValue?.getTime() === 0) {
1847
1850
  return true;
1848
1851
  }
@@ -1851,7 +1854,7 @@ var Individuals = class _Individuals extends List {
1851
1854
  }
1852
1855
  getFirstDeath() {
1853
1856
  return this.filter((item) => {
1854
- const death = item.DEAT?.toList().index(0);
1857
+ const death = item.DEAT?.index(0);
1855
1858
  if (death?.DATE?.rawValue?.getTime() === 0) {
1856
1859
  return true;
1857
1860
  }
@@ -1860,7 +1863,7 @@ var Individuals = class _Individuals extends List {
1860
1863
  }
1861
1864
  getLastDeath() {
1862
1865
  return this.filter((item) => {
1863
- const death = item.DEAT?.toList().index(0);
1866
+ const death = item.DEAT?.index(0);
1864
1867
  if (death?.DATE?.rawValue?.getTime() === 0) {
1865
1868
  return true;
1866
1869
  }
@@ -2682,7 +2685,7 @@ var Indi = class extends Common {
2682
2685
  });
2683
2686
  }
2684
2687
  getGenealogy(onlyStraight = false, showDescendants = false) {
2685
- const id = this.get("FAMC")?.toList().index(0)?.toValue();
2688
+ const id = this.get("FAMC")?.index(0)?.toValue();
2686
2689
  if (!id) {
2687
2690
  return;
2688
2691
  }
@@ -3175,11 +3178,11 @@ var Indi = class extends Common {
3175
3178
  return dates.death || void 0;
3176
3179
  }
3177
3180
  getBirthPlace() {
3178
- const birthEvent = this.get("BIRT")?.toList().index(0);
3181
+ const birthEvent = this.get("BIRT")?.index(0);
3179
3182
  return birthEvent?.PLAC?.value;
3180
3183
  }
3181
3184
  getDeathPlace() {
3182
- const deathEvent = this.get("DEAT")?.toList().index(0);
3185
+ const deathEvent = this.get("DEAT")?.index(0);
3183
3186
  return deathEvent?.PLAC?.value;
3184
3187
  }
3185
3188
  isDead() {
@@ -4339,7 +4342,7 @@ var nameFormatter = (indiName, settings, letterOnAll = true, indi, debug) => {
4339
4342
  maxSurnames = 0
4340
4343
  } = settings ?? {};
4341
4344
  const rawName = indiName instanceof Indi ? indiName?.NAME : createCommonName(void 0, void 0, indi).name(indiName);
4342
- const name = rawName?.toList().index(0);
4345
+ const name = rawName?.index(0);
4343
4346
  let givenname = name?.GIVN?.toValueList().first()?.value || "";
4344
4347
  let surname = name?.SURN?.toValueList().first()?.value || "";
4345
4348
  let suffix = name?.NSFX?.toValueList().first()?.value || "";
@@ -1611,6 +1611,7 @@ declare class Common<T = string, I extends IdType = IdType> implements ICommon<T
1611
1611
  toValue(): T;
1612
1612
  toProp(tag: MultiTag): Common<T, I> | undefined;
1613
1613
  toList(): List<IdType, Common<string, IdType>>;
1614
+ index(i: number): Common<string, IdType>;
1614
1615
  toValueList(): List<IdType, Common<string, IdType>>;
1615
1616
  private standardizeObject;
1616
1617
  toJson(tag?: MultiTag, options?: ConvertOptions): string;
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  export { ACCEPTED_DATE_FORMATS, ACCEPTED_DATE_FORMATS_REGEX, GedcomTree, commonDateFormatter, create, dateFormatter, GedcomTree as default, getAllProp, getFamilyWith, getName, getRawSize, getVersion, hungarianOrdinalize, implemented, isDevelopment, marriageDateFormatter, nameFormatter, notImplemented, noteDateFormatter, ordinalize, placeTranslator, setNestedGroup } from './utils/index.js';
2
2
  export { CacheManagerFactory, DateLocaleProvider, I18nProvider, KinshipTranslatorConstructor, PlaceParserFunction, PlaceTranslatorFunction, getCacheManagerFactory, getDateLocale, getI18n, getKinshipTranslatorClass, getPlaceParserProvider, getPlaceTranslatorProvider, i18n, resetCacheManagerFactory, resetDateLocaleProvider, resetI18nProvider, resetKinshipTranslatorClass, resetPlaceParserProvider, resetPlaceTranslatorProvider, setCacheManagerFactory, setDateLocaleProvider, setI18nProvider, setKinshipTranslatorClass, setPlaceParserProvider, setPlaceTranslatorProvider } from './factories/index.js';
3
- export { C as CacheRelatives, I as ICacheManager, P as PlaceParts, g as getPlaceParts, p as pathCache, a as relativesCache, r as resetRelativesCache } from './place-parser-RlXCXZ8F.js';
3
+ export { C as CacheRelatives, I as ICacheManager, P as PlaceParts, g as getPlaceParts, p as pathCache, a as relativesCache, r as resetRelativesCache } from './place-parser-BsrTDadc.js';
4
4
  export { KinshipTranslator, KinshipTranslatorBasic, KinshipTranslatorDE, KinshipTranslatorEN, KinshipTranslatorES, KinshipTranslatorFR, KinshipTranslatorHU, translators } from './kinship-translator/index.js';
5
- export { C as Cases, ao as Common, az as CommonDate, aQ as CommonName, aS as CommonNote, m as ConvertType, j as CrossCase, k as CrossCases, an as CustomTags, am as Existed, aC as Fam, F as FamKey, aj as FamType, aE as Families, aL as FamilySearchMatch, aM as FamilySearchSource, x as Filter, w as FilterIterator, aF as GedCom, ak as GedComType, a3 as GenealogyMember, b9 as GeneratedIndiMethods, aa as GenerationIndiType, a9 as GenerationSpouseType, D as Group, G as GroupDefinition, H as GroupIterator, E as GroupMarker, bg as IAddress, bh as IAssociation, bi as IChangeDate, b4 as ICommon, bj as ICreationDate, bk as IDate, bl as IEventDetail, bl as IEventDetailStructure, b5 as IFam, b6 as IFamilies, bm as IFamily, b7 as IGedCom, bn as IGedcomStructure, b8 as IIndi, bq as IIndividual, bp as IIndividualEvent, bo as IIndividualEventDetail, bq as IIndividualStructure, ba as IIndividuals, br as ILdsOrdinanceDetail, bs as ILdsSpouseSealing, bb as IList, bt as IMarriageDate, bu as IMultimediaLink, bv as INonEvent, bw as INote, bc as IObje, bx as IPlace, bd as IRepo, by as IRepository, be as ISour, bB as ISource, bz as ISourceCitation, bA as ISourceRepositoryCitation, bf as ISubm, t as IdType, aK as Indi, a5 as IndiGenealogy, ab as IndiGenealogyGenerations, ac as IndiGenealogyResult, n as IndiKey, a6 as IndiMarker, a4 as IndiTree, a1 as IndiType, aO as Individuals, I as KinshipTranslatorInterface, L as Language, V as LinkedPersons, aP as List, v as ListTag, a8 as MemberMain, a7 as MemberSide, M as MultiTag, K as NameOrder, J as NestedGroup, ad as NonNullIndiGenealogyResult, N as NonStandard, aU as Obje, O as ObjeKey, al as ObjeType, aW as Objects, A as Order, z as OrderDefinition, B as OrderIterator, X as PartnerType, af as Path, ae as PathItem, bC as Place, Q as PlaceOrder, bD as PlaceType, P as PrimitiveRange, Z as ProxyOriginal, ai as Queue, ah as QueueItem, Y as Range, R as RangeType, ag as ReducedPath, W as RelationType, aX as Repo, o as RepoKey, $ as RepoType, aZ as Repositories, y as RequiredFilter, l as Settings, a_ as Sour, q as SourKey, _ as SourType, b0 as Sources, S as SplitResult, b1 as Subm, r as SubmKey, a0 as SubmType, b3 as Submitters, u as Tag, T as TagKey, a2 as TreeMember, U as UnknownKey, aq as createCommon, aA as createCommonDate, aR as createCommonName, aT as createCommonNote, aD as createFam, aG as createGedCom, aN as createIndi, aV as createObje, ap as createProxy, aY as createRepo, a$ as createSour, b2 as createSubm, h as extractSeparationYears, e as extractSplitPoints, d as findMatchingRangeForSplitRange, f as fromTuple, g as generateSplitRanges, av as getListTag, bE as getPlaces, aw as getValidKey, at as getValidKeys, au as getValidTag, ay as idGetter, i as inRange, aB as isCommonDate, aH as isGedcomString, ax as isId, a as isIntersectedRange, ar as isOnlyMainProp, b as isRangeContained, as as isValidKey, aJ as mergeGedcoms, p as parseRangeBounds, c as splitOverlappingRanges, s as splitRange, aI as validateGedcomContent } from './index-BvW-KWJP.js';
5
+ export { C as Cases, ao as Common, az as CommonDate, aQ as CommonName, aS as CommonNote, m as ConvertType, j as CrossCase, k as CrossCases, an as CustomTags, am as Existed, aC as Fam, F as FamKey, aj as FamType, aE as Families, aL as FamilySearchMatch, aM as FamilySearchSource, x as Filter, w as FilterIterator, aF as GedCom, ak as GedComType, a3 as GenealogyMember, b9 as GeneratedIndiMethods, aa as GenerationIndiType, a9 as GenerationSpouseType, D as Group, G as GroupDefinition, H as GroupIterator, E as GroupMarker, bg as IAddress, bh as IAssociation, bi as IChangeDate, b4 as ICommon, bj as ICreationDate, bk as IDate, bl as IEventDetail, bl as IEventDetailStructure, b5 as IFam, b6 as IFamilies, bm as IFamily, b7 as IGedCom, bn as IGedcomStructure, b8 as IIndi, bq as IIndividual, bp as IIndividualEvent, bo as IIndividualEventDetail, bq as IIndividualStructure, ba as IIndividuals, br as ILdsOrdinanceDetail, bs as ILdsSpouseSealing, bb as IList, bt as IMarriageDate, bu as IMultimediaLink, bv as INonEvent, bw as INote, bc as IObje, bx as IPlace, bd as IRepo, by as IRepository, be as ISour, bB as ISource, bz as ISourceCitation, bA as ISourceRepositoryCitation, bf as ISubm, t as IdType, aK as Indi, a5 as IndiGenealogy, ab as IndiGenealogyGenerations, ac as IndiGenealogyResult, n as IndiKey, a6 as IndiMarker, a4 as IndiTree, a1 as IndiType, aO as Individuals, I as KinshipTranslatorInterface, L as Language, V as LinkedPersons, aP as List, v as ListTag, a8 as MemberMain, a7 as MemberSide, M as MultiTag, K as NameOrder, J as NestedGroup, ad as NonNullIndiGenealogyResult, N as NonStandard, aU as Obje, O as ObjeKey, al as ObjeType, aW as Objects, A as Order, z as OrderDefinition, B as OrderIterator, X as PartnerType, af as Path, ae as PathItem, bC as Place, Q as PlaceOrder, bD as PlaceType, P as PrimitiveRange, Z as ProxyOriginal, ai as Queue, ah as QueueItem, Y as Range, R as RangeType, ag as ReducedPath, W as RelationType, aX as Repo, o as RepoKey, $ as RepoType, aZ as Repositories, y as RequiredFilter, l as Settings, a_ as Sour, q as SourKey, _ as SourType, b0 as Sources, S as SplitResult, b1 as Subm, r as SubmKey, a0 as SubmType, b3 as Submitters, u as Tag, T as TagKey, a2 as TreeMember, U as UnknownKey, aq as createCommon, aA as createCommonDate, aR as createCommonName, aT as createCommonNote, aD as createFam, aG as createGedCom, aN as createIndi, aV as createObje, ap as createProxy, aY as createRepo, a$ as createSour, b2 as createSubm, h as extractSeparationYears, e as extractSplitPoints, d as findMatchingRangeForSplitRange, f as fromTuple, g as generateSplitRanges, av as getListTag, bE as getPlaces, aw as getValidKey, at as getValidKeys, au as getValidTag, ay as idGetter, i as inRange, aB as isCommonDate, aH as isGedcomString, ax as isId, a as isIntersectedRange, ar as isOnlyMainProp, b as isRangeContained, as as isValidKey, aJ as mergeGedcoms, p as parseRangeBounds, c as splitOverlappingRanges, s as splitRange, aI as validateGedcomContent } from './index-DFTsiD5J.js';
6
6
  export { AncestryMedia } from './types/index.js';
7
7
  export { ADOPTED, BIOLOGICAL, BIRTH, BIRTH_ASC, BIRTH_DESC, DATE_ASC, DATE_DESC, DEATH_ASC, DEATH_DESC, DEFAULT, EVERY, FEMALE, FOSTER, FRIEND, ID_GETTER_REG, ID_REG, ID_SPLIT_REG, LINE_REG, MALE, MAX_FILE_SIZE_TO_SYNC, OTHER, PARTNER, REF_LINE_REG, SEALING, SINGLE, SPOUSE, STEP, UNKOWN, getBirthAsc, getMarriageAsc, getMarriageAscAndBirth, getMarriageAscAndChildBirth, getNameAsc, getNameAscAndBirth, getNameDesc } from './constants/index.js';
8
8
  export { IPersonalName, IPersonalNamePieces } from './structures/index.js';
package/dist/index.js CHANGED
@@ -300,7 +300,7 @@ var List = class _List {
300
300
  const [key, { getter }] = Object.entries(
301
301
  typeof groups === "string" ? { [groups]: {} } : groups
302
302
  )[0];
303
- const raw = item.get(key)?.toList().index(0);
303
+ const raw = item.get(key)?.index(0);
304
304
  let value = raw?.toValue();
305
305
  if (getter && typeof getter === "function") {
306
306
  value = getter(value, raw);
@@ -633,6 +633,9 @@ var Common = class _Common {
633
633
  this.id ? { [this.id]: this } : { ...[this] }
634
634
  );
635
635
  }
636
+ index(i) {
637
+ return this.toList()?.index(i);
638
+ }
636
639
  toValueList() {
637
640
  return new List().concat(
638
641
  this.value ? { [this.value]: this } : (
@@ -1760,7 +1763,7 @@ var Indi = class extends Common {
1760
1763
  });
1761
1764
  }
1762
1765
  getGenealogy(onlyStraight = false, showDescendants = false) {
1763
- const id = this.get("FAMC")?.toList().index(0)?.toValue();
1766
+ const id = this.get("FAMC")?.index(0)?.toValue();
1764
1767
  if (!id) {
1765
1768
  return;
1766
1769
  }
@@ -2253,11 +2256,11 @@ var Indi = class extends Common {
2253
2256
  return dates.death || void 0;
2254
2257
  }
2255
2258
  getBirthPlace() {
2256
- const birthEvent = this.get("BIRT")?.toList().index(0);
2259
+ const birthEvent = this.get("BIRT")?.index(0);
2257
2260
  return birthEvent?.PLAC?.value;
2258
2261
  }
2259
2262
  getDeathPlace() {
2260
- const deathEvent = this.get("DEAT")?.toList().index(0);
2263
+ const deathEvent = this.get("DEAT")?.index(0);
2261
2264
  return deathEvent?.PLAC?.value;
2262
2265
  }
2263
2266
  isDead() {
@@ -3417,7 +3420,7 @@ var nameFormatter = (indiName, settings, letterOnAll = true, indi, debug) => {
3417
3420
  maxSurnames = 0
3418
3421
  } = settings ?? {};
3419
3422
  const rawName = indiName instanceof Indi ? indiName?.NAME : createCommonName(void 0, void 0, indi).name(indiName);
3420
- const name = rawName?.toList().index(0);
3423
+ const name = rawName?.index(0);
3421
3424
  let givenname = name?.GIVN?.toValueList().first()?.value || "";
3422
3425
  let surname = name?.SURN?.toValueList().first()?.value || "";
3423
3426
  let suffix = name?.NSFX?.toValueList().first()?.value || "";
@@ -5470,8 +5473,8 @@ var getNameAsc = (nameOrder = "first-last") => (itemA, _keyA, itemB, _keyB) => {
5470
5473
  );
5471
5474
  };
5472
5475
  var getBirthAsc = (itemA, _keyA, itemB, _keyB) => {
5473
- const birthA = itemA?.BIRT?.toList().index(0);
5474
- const birthB = itemB?.BIRT?.toList().index(0);
5476
+ const birthA = itemA?.BIRT?.index(0);
5477
+ const birthB = itemB?.BIRT?.index(0);
5475
5478
  const valueA = birthA?.DATE?.rawValue;
5476
5479
  const valueB = birthB?.DATE?.rawValue;
5477
5480
  if (valueA?.getTime() === valueB?.getTime()) {
@@ -5613,8 +5616,8 @@ var Individuals = class _Individuals extends List {
5613
5616
  getFirstEvent() {
5614
5617
  const firstBirthPerson = this.getFirstBirth();
5615
5618
  const firstDeathPerson = this.getFirstDeath();
5616
- const firstBirth = firstBirthPerson?.BIRT?.toList().index(0);
5617
- const firstDeath = firstDeathPerson?.DEAT?.toList().index(0);
5619
+ const firstBirth = firstBirthPerson?.BIRT?.index(0);
5620
+ const firstDeath = firstDeathPerson?.DEAT?.index(0);
5618
5621
  if (!firstBirth?.DATE?.rawValue && !firstDeath?.DATE?.rawValue) {
5619
5622
  return void 0;
5620
5623
  }
@@ -5632,8 +5635,8 @@ var Individuals = class _Individuals extends List {
5632
5635
  getLastEvent() {
5633
5636
  const lastDeathPerson = this.getLastDeath();
5634
5637
  const lastBirthPerson = this.getLastBirth();
5635
- const lastBirth = lastBirthPerson?.BIRT?.toList().index(0);
5636
- const lastDeath = lastDeathPerson?.DEAT?.toList().index(0);
5638
+ const lastBirth = lastBirthPerson?.BIRT?.index(0);
5639
+ const lastDeath = lastDeathPerson?.DEAT?.index(0);
5637
5640
  if (!lastBirth?.DATE?.rawValue && !lastDeath?.DATE?.rawValue) {
5638
5641
  return void 0;
5639
5642
  }
@@ -5650,7 +5653,7 @@ var Individuals = class _Individuals extends List {
5650
5653
  }
5651
5654
  getFirstBirth() {
5652
5655
  return this.filter((item) => {
5653
- const birth = item.BIRT?.toList().index(0);
5656
+ const birth = item.BIRT?.index(0);
5654
5657
  if (birth?.DATE?.rawValue?.getTime() === 0) {
5655
5658
  return true;
5656
5659
  }
@@ -5659,7 +5662,7 @@ var Individuals = class _Individuals extends List {
5659
5662
  }
5660
5663
  getLastBirth() {
5661
5664
  return this.filter((item) => {
5662
- const birth = item.BIRT?.toList().index(0);
5665
+ const birth = item.BIRT?.index(0);
5663
5666
  if (birth?.DATE?.rawValue?.getTime() === 0) {
5664
5667
  return true;
5665
5668
  }
@@ -5668,7 +5671,7 @@ var Individuals = class _Individuals extends List {
5668
5671
  }
5669
5672
  getFirstDeath() {
5670
5673
  return this.filter((item) => {
5671
- const death = item.DEAT?.toList().index(0);
5674
+ const death = item.DEAT?.index(0);
5672
5675
  if (death?.DATE?.rawValue?.getTime() === 0) {
5673
5676
  return true;
5674
5677
  }
@@ -5677,7 +5680,7 @@ var Individuals = class _Individuals extends List {
5677
5680
  }
5678
5681
  getLastDeath() {
5679
5682
  return this.filter((item) => {
5680
- const death = item.DEAT?.toList().index(0);
5683
+ const death = item.DEAT?.index(0);
5681
5684
  if (death?.DATE?.rawValue?.getTime() === 0) {
5682
5685
  return true;
5683
5686
  }
@@ -6131,7 +6134,7 @@ var Families = class _Families extends List {
6131
6134
  // package.json
6132
6135
  var package_default = {
6133
6136
  name: "@treeviz/gedcom-parser",
6134
- version: "1.0.16"};
6137
+ version: "1.0.18"};
6135
6138
 
6136
6139
  // src/utils/get-product-details.ts
6137
6140
  var isDevelopment = () => {
@@ -6508,7 +6511,7 @@ var GedCom = class extends Common {
6508
6511
  });
6509
6512
  const surnames = /* @__PURE__ */ new Map();
6510
6513
  indis?.forEach((indi) => {
6511
- const name = indi.NAME?.toValue();
6514
+ const name = indi.NAME?.index(0)?.toValue();
6512
6515
  if (name) {
6513
6516
  const match = name.match(/\/(.+?)\//);
6514
6517
  if (match) {
@@ -6520,7 +6523,7 @@ var GedCom = class extends Common {
6520
6523
  const topSurnames = Array.from(surnames.entries()).sort((a, b) => b[1] - a[1]).slice(0, 10).map(([surname, count]) => ({ surname, count }));
6521
6524
  const birthPlaces = /* @__PURE__ */ new Map();
6522
6525
  indis?.forEach((indi) => {
6523
- const place = indi.BIRT?.PLAC?.value;
6526
+ const place = indi.BIRT?.index(0)?.PLAC?.index(0)?.toValue();
6524
6527
  if (place) {
6525
6528
  birthPlaces.set(place, (birthPlaces.get(place) || 0) + 1);
6526
6529
  }
@@ -6528,14 +6531,14 @@ var GedCom = class extends Common {
6528
6531
  const topBirthPlaces = Array.from(birthPlaces.entries()).sort((a, b) => b[1] - a[1]).slice(0, 10).map(([place, count]) => ({ place, count }));
6529
6532
  const years = [];
6530
6533
  indis?.forEach((indi) => {
6531
- const birthDate = indi.BIRT?.DATE?.toValue();
6534
+ const birthDate = indi.BIRT?.index(0)?.DATE?.index(0)?.toValue();
6532
6535
  if (birthDate) {
6533
6536
  const match = birthDate.match(/\d{4}/);
6534
6537
  if (match) {
6535
6538
  years.push(parseInt(match[0], 10));
6536
6539
  }
6537
6540
  }
6538
- const deathDate = indi.DEAT?.DATE?.toValue();
6541
+ const deathDate = indi.DEAT?.index(0)?.DATE?.index(0)?.toValue();
6539
6542
  if (deathDate) {
6540
6543
  const match = deathDate.match(/\d{4}/);
6541
6544
  if (match) {
@@ -6547,8 +6550,8 @@ var GedCom = class extends Common {
6547
6550
  const maxYear = years.length > 0 ? Math.max(...years) : null;
6548
6551
  const lifespans = [];
6549
6552
  indis?.forEach((indi) => {
6550
- const birthDate = indi.BIRT?.DATE?.toValue();
6551
- const deathDate = indi.DEAT?.DATE?.toValue();
6553
+ const birthDate = indi.BIRT?.index(0)?.DATE?.index(0)?.toValue();
6554
+ const deathDate = indi.DEAT?.index(0)?.DATE?.index(0)?.toValue();
6552
6555
  if (birthDate && deathDate) {
6553
6556
  const birthMatch = birthDate.match(/\d{4}/);
6554
6557
  const deathMatch = deathDate.match(/\d{4}/);
@@ -6563,8 +6566,8 @@ var GedCom = class extends Common {
6563
6566
  });
6564
6567
  const avgLifespan = lifespans.length > 0 ? lifespans.reduce((sum, age) => sum + age, 0) / lifespans.length : null;
6565
6568
  const firstPerson = indis?.getFirstEvent();
6566
- const firstBirth = firstPerson?.BIRT?.toList().index(0);
6567
- const firstDeath = firstPerson?.DEAT?.toList().index(0);
6569
+ const firstBirth = firstPerson?.BIRT?.index(0);
6570
+ const firstDeath = firstPerson?.DEAT?.index(0);
6568
6571
  let firstPersonEvent = null;
6569
6572
  const firstBirthDate = firstBirth?.DATE?.rawValue;
6570
6573
  const firstDeathDate = firstDeath?.DATE?.rawValue;
@@ -6577,8 +6580,8 @@ var GedCom = class extends Common {
6577
6580
  };
6578
6581
  }
6579
6582
  const lastPerson = indis?.getLastEvent();
6580
- const lastBirth = lastPerson?.BIRT?.toList().index(0);
6581
- const lastDeath = lastPerson?.DEAT?.toList().index(0);
6583
+ const lastBirth = lastPerson?.BIRT?.index(0);
6584
+ const lastDeath = lastPerson?.DEAT?.index(0);
6582
6585
  let lastPersonEvent = null;
6583
6586
  const lastBirthDate = lastBirth?.DATE?.rawValue;
6584
6587
  const lastDeathDate = lastDeath?.DATE?.rawValue;
@@ -1,2 +1,2 @@
1
- export { b9 as GeneratedIndiMethods, b4 as ICommon, b5 as IFam, b6 as IFamilies, b7 as IGedCom, b8 as IIndi, ba as IIndividuals, bb as IList, bc as IObje, bd as IRepo, be as ISour, bf as ISubm } from '../index-BvW-KWJP.js';
1
+ export { b9 as GeneratedIndiMethods, b4 as ICommon, b5 as IFam, b6 as IFamilies, b7 as IGedCom, b8 as IIndi, ba as IIndividuals, bb as IList, bc as IObje, bd as IRepo, be as ISour, bf as ISubm } from '../index-DFTsiD5J.js';
2
2
  import 'date-fns';
@@ -1,5 +1,5 @@
1
- import { I as IKinshipTranslator, af as Path, ae as PathItem, a1 as IndiType, n as IndiKey, L as Language } from '../index-BvW-KWJP.js';
2
- export { C as Cases, j as CrossCase, k as CrossCases } from '../index-BvW-KWJP.js';
1
+ import { I as IKinshipTranslator, af as Path, ae as PathItem, a1 as IndiType, n as IndiKey, L as Language } from '../index-DFTsiD5J.js';
2
+ export { C as Cases, j as CrossCase, k as CrossCases } from '../index-DFTsiD5J.js';
3
3
  import 'date-fns';
4
4
 
5
5
  declare class KinshipTranslatorBasic implements IKinshipTranslator {
@@ -1820,7 +1820,7 @@ var List = class _List {
1820
1820
  const [key, { getter }] = Object.entries(
1821
1821
  typeof groups === "string" ? { [groups]: {} } : groups
1822
1822
  )[0];
1823
- const raw = item.get(key)?.toList().index(0);
1823
+ const raw = item.get(key)?.index(0);
1824
1824
  let value = raw?.toValue();
1825
1825
  if (getter && typeof getter === "function") {
1826
1826
  value = getter(value, raw);
@@ -2153,6 +2153,9 @@ var Common = class _Common {
2153
2153
  this.id ? { [this.id]: this } : { ...[this] }
2154
2154
  );
2155
2155
  }
2156
+ index(i) {
2157
+ return this.toList()?.index(i);
2158
+ }
2156
2159
  toValueList() {
2157
2160
  return new List().concat(
2158
2161
  this.value ? { [this.value]: this } : (
@@ -2712,8 +2715,8 @@ chars.reduce((acc, curr, idx) => {
2712
2715
  return acc;
2713
2716
  }, {});
2714
2717
  var getBirthAsc = (itemA, _keyA, itemB, _keyB) => {
2715
- const birthA = itemA?.BIRT?.toList().index(0);
2716
- const birthB = itemB?.BIRT?.toList().index(0);
2718
+ const birthA = itemA?.BIRT?.index(0);
2719
+ const birthB = itemB?.BIRT?.index(0);
2717
2720
  const valueA = birthA?.DATE?.rawValue;
2718
2721
  const valueB = birthB?.DATE?.rawValue;
2719
2722
  if (valueA?.getTime() === valueB?.getTime()) {
@@ -2964,8 +2967,8 @@ var Individuals = class _Individuals extends List {
2964
2967
  getFirstEvent() {
2965
2968
  const firstBirthPerson = this.getFirstBirth();
2966
2969
  const firstDeathPerson = this.getFirstDeath();
2967
- const firstBirth = firstBirthPerson?.BIRT?.toList().index(0);
2968
- const firstDeath = firstDeathPerson?.DEAT?.toList().index(0);
2970
+ const firstBirth = firstBirthPerson?.BIRT?.index(0);
2971
+ const firstDeath = firstDeathPerson?.DEAT?.index(0);
2969
2972
  if (!firstBirth?.DATE?.rawValue && !firstDeath?.DATE?.rawValue) {
2970
2973
  return void 0;
2971
2974
  }
@@ -2983,8 +2986,8 @@ var Individuals = class _Individuals extends List {
2983
2986
  getLastEvent() {
2984
2987
  const lastDeathPerson = this.getLastDeath();
2985
2988
  const lastBirthPerson = this.getLastBirth();
2986
- const lastBirth = lastBirthPerson?.BIRT?.toList().index(0);
2987
- const lastDeath = lastDeathPerson?.DEAT?.toList().index(0);
2989
+ const lastBirth = lastBirthPerson?.BIRT?.index(0);
2990
+ const lastDeath = lastDeathPerson?.DEAT?.index(0);
2988
2991
  if (!lastBirth?.DATE?.rawValue && !lastDeath?.DATE?.rawValue) {
2989
2992
  return void 0;
2990
2993
  }
@@ -3001,7 +3004,7 @@ var Individuals = class _Individuals extends List {
3001
3004
  }
3002
3005
  getFirstBirth() {
3003
3006
  return this.filter((item) => {
3004
- const birth = item.BIRT?.toList().index(0);
3007
+ const birth = item.BIRT?.index(0);
3005
3008
  if (birth?.DATE?.rawValue?.getTime() === 0) {
3006
3009
  return true;
3007
3010
  }
@@ -3010,7 +3013,7 @@ var Individuals = class _Individuals extends List {
3010
3013
  }
3011
3014
  getLastBirth() {
3012
3015
  return this.filter((item) => {
3013
- const birth = item.BIRT?.toList().index(0);
3016
+ const birth = item.BIRT?.index(0);
3014
3017
  if (birth?.DATE?.rawValue?.getTime() === 0) {
3015
3018
  return true;
3016
3019
  }
@@ -3019,7 +3022,7 @@ var Individuals = class _Individuals extends List {
3019
3022
  }
3020
3023
  getFirstDeath() {
3021
3024
  return this.filter((item) => {
3022
- const death = item.DEAT?.toList().index(0);
3025
+ const death = item.DEAT?.index(0);
3023
3026
  if (death?.DATE?.rawValue?.getTime() === 0) {
3024
3027
  return true;
3025
3028
  }
@@ -3028,7 +3031,7 @@ var Individuals = class _Individuals extends List {
3028
3031
  }
3029
3032
  getLastDeath() {
3030
3033
  return this.filter((item) => {
3031
- const death = item.DEAT?.toList().index(0);
3034
+ const death = item.DEAT?.index(0);
3032
3035
  if (death?.DATE?.rawValue?.getTime() === 0) {
3033
3036
  return true;
3034
3037
  }
@@ -3846,7 +3849,7 @@ var Indi = class extends Common {
3846
3849
  });
3847
3850
  }
3848
3851
  getGenealogy(onlyStraight = false, showDescendants = false) {
3849
- const id = this.get("FAMC")?.toList().index(0)?.toValue();
3852
+ const id = this.get("FAMC")?.index(0)?.toValue();
3850
3853
  if (!id) {
3851
3854
  return;
3852
3855
  }
@@ -4339,11 +4342,11 @@ var Indi = class extends Common {
4339
4342
  return dates.death || void 0;
4340
4343
  }
4341
4344
  getBirthPlace() {
4342
- const birthEvent = this.get("BIRT")?.toList().index(0);
4345
+ const birthEvent = this.get("BIRT")?.index(0);
4343
4346
  return birthEvent?.PLAC?.value;
4344
4347
  }
4345
4348
  getDeathPlace() {
4346
- const deathEvent = this.get("DEAT")?.toList().index(0);
4349
+ const deathEvent = this.get("DEAT")?.index(0);
4347
4350
  return deathEvent?.PLAC?.value;
4348
4351
  }
4349
4352
  isDead() {
@@ -5503,7 +5506,7 @@ var nameFormatter = (indiName, settings, letterOnAll = true, indi, debug) => {
5503
5506
  maxSurnames = 0
5504
5507
  } = settings ?? {};
5505
5508
  const rawName = indiName instanceof Indi ? indiName?.NAME : createCommonName(void 0, void 0, indi).name(indiName);
5506
- const name = rawName?.toList().index(0);
5509
+ const name = rawName?.index(0);
5507
5510
  let givenname = name?.GIVN?.toValueList().first()?.value || "";
5508
5511
  let surname = name?.SURN?.toValueList().first()?.value || "";
5509
5512
  let suffix = name?.NSFX?.toValueList().first()?.value || "";
@@ -1,4 +1,4 @@
1
- import { n as IndiKey, af as Path, aO as Individuals } from './index-BvW-KWJP.js';
1
+ import { n as IndiKey, af as Path, aO as Individuals } from './index-DFTsiD5J.js';
2
2
 
3
3
  /**
4
4
  * Cache manager interface for pluggable cache implementations.
@@ -1,5 +1,5 @@
1
- import { ao as Common, bw as INoteStructure, bz as ISourceCitationStructure } from '../index-BvW-KWJP.js';
2
- export { bg as IAddress, bh as IAssociation, bi as IChangeDate, bj as ICreationDate, bk as IDate, bl as IEventDetail, bl as IEventDetailStructure, bm as IFamily, bn as IGedcomStructure, bq as IIndividual, bp as IIndividualEvent, bo as IIndividualEventDetail, bq as IIndividualStructure, br as ILdsOrdinanceDetail, bs as ILdsSpouseSealing, bt as IMarriageDate, bu as IMultimediaLink, bv as INonEvent, bx as IPlace, by as IRepository, bB as ISource, bA as ISourceRepositoryCitation } from '../index-BvW-KWJP.js';
1
+ import { ao as Common, bw as INoteStructure, bz as ISourceCitationStructure } from '../index-DFTsiD5J.js';
2
+ export { bg as IAddress, bh as IAssociation, bi as IChangeDate, bj as ICreationDate, bk as IDate, bl as IEventDetail, bl as IEventDetailStructure, bm as IFamily, bn as IGedcomStructure, bq as IIndividual, bp as IIndividualEvent, bo as IIndividualEventDetail, bq as IIndividualStructure, br as ILdsOrdinanceDetail, bs as ILdsSpouseSealing, bt as IMarriageDate, bu as IMultimediaLink, bv as INonEvent, bx as IPlace, by as IRepository, bB as ISource, bA as ISourceRepositoryCitation } from '../index-DFTsiD5J.js';
3
3
  import 'date-fns';
4
4
 
5
5
  interface IPersonalNamePiecesStructure extends Common {
@@ -1,4 +1,4 @@
1
- export { m as ConvertType, F as FamKey, x as Filter, w as FilterIterator, D as Group, G as GroupDefinition, H as GroupIterator, E as GroupMarker, t as IdType, n as IndiKey, V as LinkedPersons, v as ListTag, M as MultiTag, K as NameOrder, J as NestedGroup, N as NonStandard, O as ObjeKey, A as Order, z as OrderDefinition, B as OrderIterator, X as PartnerType, Q as PlaceOrder, Y as Range, W as RelationType, o as RepoKey, y as RequiredFilter, l as Settings, q as SourKey, r as SubmKey, u as Tag, T as TagKey, U as UnknownKey } from '../index-BvW-KWJP.js';
1
+ export { m as ConvertType, F as FamKey, x as Filter, w as FilterIterator, D as Group, G as GroupDefinition, H as GroupIterator, E as GroupMarker, t as IdType, n as IndiKey, V as LinkedPersons, v as ListTag, M as MultiTag, K as NameOrder, J as NestedGroup, N as NonStandard, O as ObjeKey, A as Order, z as OrderDefinition, B as OrderIterator, X as PartnerType, Q as PlaceOrder, Y as Range, W as RelationType, o as RepoKey, y as RequiredFilter, l as Settings, q as SourKey, r as SubmKey, u as Tag, T as TagKey, U as UnknownKey } from '../index-DFTsiD5J.js';
2
2
  import 'date-fns';
3
3
 
4
4
  interface AncestryMedia {
@@ -1,6 +1,6 @@
1
- export { C as CacheRelatives, I as ICacheManager, P as PlaceParts, g as getPlaceParts, p as pathCache, a as relativesCache, r as resetRelativesCache } from '../place-parser-RlXCXZ8F.js';
2
- import { l as Settings, ak as GedComType, M as MultiTag, ao as Common, t as IdType, bk as IDateStructure, aj as FamType, az as CommonDate, a1 as IndiType, n as IndiKey, J as NestedGroup, aO as Individuals } from '../index-BvW-KWJP.js';
3
- export { bC as Place, bD as PlaceType, P as PrimitiveRange, R as Range, S as SplitResult, h as extractSeparationYears, e as extractSplitPoints, d as findMatchingRangeForSplitRange, f as fromTuple, g as generateSplitRanges, bE as getPlaces, i as inRange, a as isIntersectedRange, b as isRangeContained, p as parseRangeBounds, c as splitOverlappingRanges, s as splitRange } from '../index-BvW-KWJP.js';
1
+ export { C as CacheRelatives, I as ICacheManager, P as PlaceParts, g as getPlaceParts, p as pathCache, a as relativesCache, r as resetRelativesCache } from '../place-parser-BsrTDadc.js';
2
+ import { l as Settings, ak as GedComType, M as MultiTag, ao as Common, t as IdType, bk as IDateStructure, aj as FamType, az as CommonDate, a1 as IndiType, n as IndiKey, J as NestedGroup, aO as Individuals } from '../index-DFTsiD5J.js';
3
+ export { bC as Place, bD as PlaceType, P as PrimitiveRange, R as Range, S as SplitResult, h as extractSeparationYears, e as extractSplitPoints, d as findMatchingRangeForSplitRange, f as fromTuple, g as generateSplitRanges, bE as getPlaces, i as inRange, a as isIntersectedRange, b as isRangeContained, p as parseRangeBounds, c as splitOverlappingRanges, s as splitRange } from '../index-DFTsiD5J.js';
4
4
  import 'date-fns';
5
5
 
6
6
  declare const GedcomTree: {
@@ -381,7 +381,7 @@ var List = class _List {
381
381
  const [key, { getter }] = Object.entries(
382
382
  typeof groups === "string" ? { [groups]: {} } : groups
383
383
  )[0];
384
- const raw = item.get(key)?.toList().index(0);
384
+ const raw = item.get(key)?.index(0);
385
385
  let value = raw?.toValue();
386
386
  if (getter && typeof getter === "function") {
387
387
  value = getter(value, raw);
@@ -714,6 +714,9 @@ var Common = class _Common {
714
714
  this.id ? { [this.id]: this } : { ...[this] }
715
715
  );
716
716
  }
717
+ index(i) {
718
+ return this.toList()?.index(i);
719
+ }
717
720
  toValueList() {
718
721
  return new List().concat(
719
722
  this.value ? { [this.value]: this } : (
@@ -1172,8 +1175,8 @@ chars.reduce((acc, curr, idx) => {
1172
1175
  return acc;
1173
1176
  }, {});
1174
1177
  var getBirthAsc = (itemA, _keyA, itemB, _keyB) => {
1175
- const birthA = itemA?.BIRT?.toList().index(0);
1176
- const birthB = itemB?.BIRT?.toList().index(0);
1178
+ const birthA = itemA?.BIRT?.index(0);
1179
+ const birthB = itemB?.BIRT?.index(0);
1177
1180
  const valueA = birthA?.DATE?.rawValue;
1178
1181
  const valueB = birthB?.DATE?.rawValue;
1179
1182
  if (valueA?.getTime() === valueB?.getTime()) {
@@ -1585,8 +1588,8 @@ var Individuals = class _Individuals extends List {
1585
1588
  getFirstEvent() {
1586
1589
  const firstBirthPerson = this.getFirstBirth();
1587
1590
  const firstDeathPerson = this.getFirstDeath();
1588
- const firstBirth = firstBirthPerson?.BIRT?.toList().index(0);
1589
- const firstDeath = firstDeathPerson?.DEAT?.toList().index(0);
1591
+ const firstBirth = firstBirthPerson?.BIRT?.index(0);
1592
+ const firstDeath = firstDeathPerson?.DEAT?.index(0);
1590
1593
  if (!firstBirth?.DATE?.rawValue && !firstDeath?.DATE?.rawValue) {
1591
1594
  return void 0;
1592
1595
  }
@@ -1604,8 +1607,8 @@ var Individuals = class _Individuals extends List {
1604
1607
  getLastEvent() {
1605
1608
  const lastDeathPerson = this.getLastDeath();
1606
1609
  const lastBirthPerson = this.getLastBirth();
1607
- const lastBirth = lastBirthPerson?.BIRT?.toList().index(0);
1608
- const lastDeath = lastDeathPerson?.DEAT?.toList().index(0);
1610
+ const lastBirth = lastBirthPerson?.BIRT?.index(0);
1611
+ const lastDeath = lastDeathPerson?.DEAT?.index(0);
1609
1612
  if (!lastBirth?.DATE?.rawValue && !lastDeath?.DATE?.rawValue) {
1610
1613
  return void 0;
1611
1614
  }
@@ -1622,7 +1625,7 @@ var Individuals = class _Individuals extends List {
1622
1625
  }
1623
1626
  getFirstBirth() {
1624
1627
  return this.filter((item) => {
1625
- const birth = item.BIRT?.toList().index(0);
1628
+ const birth = item.BIRT?.index(0);
1626
1629
  if (birth?.DATE?.rawValue?.getTime() === 0) {
1627
1630
  return true;
1628
1631
  }
@@ -1631,7 +1634,7 @@ var Individuals = class _Individuals extends List {
1631
1634
  }
1632
1635
  getLastBirth() {
1633
1636
  return this.filter((item) => {
1634
- const birth = item.BIRT?.toList().index(0);
1637
+ const birth = item.BIRT?.index(0);
1635
1638
  if (birth?.DATE?.rawValue?.getTime() === 0) {
1636
1639
  return true;
1637
1640
  }
@@ -1640,7 +1643,7 @@ var Individuals = class _Individuals extends List {
1640
1643
  }
1641
1644
  getFirstDeath() {
1642
1645
  return this.filter((item) => {
1643
- const death = item.DEAT?.toList().index(0);
1646
+ const death = item.DEAT?.index(0);
1644
1647
  if (death?.DATE?.rawValue?.getTime() === 0) {
1645
1648
  return true;
1646
1649
  }
@@ -1649,7 +1652,7 @@ var Individuals = class _Individuals extends List {
1649
1652
  }
1650
1653
  getLastDeath() {
1651
1654
  return this.filter((item) => {
1652
- const death = item.DEAT?.toList().index(0);
1655
+ const death = item.DEAT?.index(0);
1653
1656
  if (death?.DATE?.rawValue?.getTime() === 0) {
1654
1657
  return true;
1655
1658
  }
@@ -2472,7 +2475,7 @@ var Indi = class extends Common {
2472
2475
  });
2473
2476
  }
2474
2477
  getGenealogy(onlyStraight = false, showDescendants = false) {
2475
- const id = this.get("FAMC")?.toList().index(0)?.toValue();
2478
+ const id = this.get("FAMC")?.index(0)?.toValue();
2476
2479
  if (!id) {
2477
2480
  return;
2478
2481
  }
@@ -2965,11 +2968,11 @@ var Indi = class extends Common {
2965
2968
  return dates.death || void 0;
2966
2969
  }
2967
2970
  getBirthPlace() {
2968
- const birthEvent = this.get("BIRT")?.toList().index(0);
2971
+ const birthEvent = this.get("BIRT")?.index(0);
2969
2972
  return birthEvent?.PLAC?.value;
2970
2973
  }
2971
2974
  getDeathPlace() {
2972
- const deathEvent = this.get("DEAT")?.toList().index(0);
2975
+ const deathEvent = this.get("DEAT")?.index(0);
2973
2976
  return deathEvent?.PLAC?.value;
2974
2977
  }
2975
2978
  isDead() {
@@ -4129,7 +4132,7 @@ var nameFormatter = (indiName, settings, letterOnAll = true, indi, debug) => {
4129
4132
  maxSurnames = 0
4130
4133
  } = settings ?? {};
4131
4134
  const rawName = indiName instanceof Indi ? indiName?.NAME : createCommonName(void 0, void 0, indi).name(indiName);
4132
- const name = rawName?.toList().index(0);
4135
+ const name = rawName?.index(0);
4133
4136
  let givenname = name?.GIVN?.toValueList().first()?.value || "";
4134
4137
  let surname = name?.SURN?.toValueList().first()?.value || "";
4135
4138
  let suffix = name?.NSFX?.toValueList().first()?.value || "";
@@ -5967,7 +5970,7 @@ var isCommonDate = (value) => {
5967
5970
  // package.json
5968
5971
  var package_default = {
5969
5972
  name: "@treeviz/gedcom-parser",
5970
- version: "1.0.16"};
5973
+ version: "1.0.18"};
5971
5974
 
5972
5975
  // src/utils/get-product-details.ts
5973
5976
  var isDevelopment = () => {
@@ -6344,7 +6347,7 @@ var GedCom = class extends Common {
6344
6347
  });
6345
6348
  const surnames = /* @__PURE__ */ new Map();
6346
6349
  indis?.forEach((indi) => {
6347
- const name = indi.NAME?.toValue();
6350
+ const name = indi.NAME?.index(0)?.toValue();
6348
6351
  if (name) {
6349
6352
  const match = name.match(/\/(.+?)\//);
6350
6353
  if (match) {
@@ -6356,7 +6359,7 @@ var GedCom = class extends Common {
6356
6359
  const topSurnames = Array.from(surnames.entries()).sort((a, b) => b[1] - a[1]).slice(0, 10).map(([surname, count]) => ({ surname, count }));
6357
6360
  const birthPlaces = /* @__PURE__ */ new Map();
6358
6361
  indis?.forEach((indi) => {
6359
- const place = indi.BIRT?.PLAC?.value;
6362
+ const place = indi.BIRT?.index(0)?.PLAC?.index(0)?.toValue();
6360
6363
  if (place) {
6361
6364
  birthPlaces.set(place, (birthPlaces.get(place) || 0) + 1);
6362
6365
  }
@@ -6364,14 +6367,14 @@ var GedCom = class extends Common {
6364
6367
  const topBirthPlaces = Array.from(birthPlaces.entries()).sort((a, b) => b[1] - a[1]).slice(0, 10).map(([place, count]) => ({ place, count }));
6365
6368
  const years = [];
6366
6369
  indis?.forEach((indi) => {
6367
- const birthDate = indi.BIRT?.DATE?.toValue();
6370
+ const birthDate = indi.BIRT?.index(0)?.DATE?.index(0)?.toValue();
6368
6371
  if (birthDate) {
6369
6372
  const match = birthDate.match(/\d{4}/);
6370
6373
  if (match) {
6371
6374
  years.push(parseInt(match[0], 10));
6372
6375
  }
6373
6376
  }
6374
- const deathDate = indi.DEAT?.DATE?.toValue();
6377
+ const deathDate = indi.DEAT?.index(0)?.DATE?.index(0)?.toValue();
6375
6378
  if (deathDate) {
6376
6379
  const match = deathDate.match(/\d{4}/);
6377
6380
  if (match) {
@@ -6383,8 +6386,8 @@ var GedCom = class extends Common {
6383
6386
  const maxYear = years.length > 0 ? Math.max(...years) : null;
6384
6387
  const lifespans = [];
6385
6388
  indis?.forEach((indi) => {
6386
- const birthDate = indi.BIRT?.DATE?.toValue();
6387
- const deathDate = indi.DEAT?.DATE?.toValue();
6389
+ const birthDate = indi.BIRT?.index(0)?.DATE?.index(0)?.toValue();
6390
+ const deathDate = indi.DEAT?.index(0)?.DATE?.index(0)?.toValue();
6388
6391
  if (birthDate && deathDate) {
6389
6392
  const birthMatch = birthDate.match(/\d{4}/);
6390
6393
  const deathMatch = deathDate.match(/\d{4}/);
@@ -6399,8 +6402,8 @@ var GedCom = class extends Common {
6399
6402
  });
6400
6403
  const avgLifespan = lifespans.length > 0 ? lifespans.reduce((sum, age) => sum + age, 0) / lifespans.length : null;
6401
6404
  const firstPerson = indis?.getFirstEvent();
6402
- const firstBirth = firstPerson?.BIRT?.toList().index(0);
6403
- const firstDeath = firstPerson?.DEAT?.toList().index(0);
6405
+ const firstBirth = firstPerson?.BIRT?.index(0);
6406
+ const firstDeath = firstPerson?.DEAT?.index(0);
6404
6407
  let firstPersonEvent = null;
6405
6408
  const firstBirthDate = firstBirth?.DATE?.rawValue;
6406
6409
  const firstDeathDate = firstDeath?.DATE?.rawValue;
@@ -6413,8 +6416,8 @@ var GedCom = class extends Common {
6413
6416
  };
6414
6417
  }
6415
6418
  const lastPerson = indis?.getLastEvent();
6416
- const lastBirth = lastPerson?.BIRT?.toList().index(0);
6417
- const lastDeath = lastPerson?.DEAT?.toList().index(0);
6419
+ const lastBirth = lastPerson?.BIRT?.index(0);
6420
+ const lastDeath = lastPerson?.DEAT?.index(0);
6418
6421
  let lastPersonEvent = null;
6419
6422
  const lastBirthDate = lastBirth?.DATE?.rawValue;
6420
6423
  const lastDeathDate = lastDeath?.DATE?.rawValue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@treeviz/gedcom-parser",
3
- "version": "1.0.16",
3
+ "version": "1.0.18",
4
4
  "description": "Lightweight, pluggable GEDCOM parser for JavaScript/TypeScript with optional caching and place matching. Zero browser dependencies.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",