@tricoteuses/tisseuse 0.14.1 → 0.14.2
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/{html-BuWHzy52.js → html-_xYtGRXN.js} +798 -501
- package/dist/index.js +45 -45
- package/dist/server.js +697 -697
- package/dist/src/lib/extractors/links.doctrinal.test.d.ts +1 -0
- package/dist/src/lib/index.d.ts +2 -0
- package/dist/src/lib/server/shared_legal_text_sections.d.ts +10 -0
- package/dist/src/lib/server/shared_legal_text_sections.test.d.ts +1 -0
- package/dist/src/lib/server/sync_assemblee_legal_texts.d.ts +17 -0
- package/dist/src/lib/server/sync_assemblee_legal_texts.test.d.ts +1 -0
- package/dist/src/lib/text_parsers/doctrinal_references.d.ts +21 -0
- package/dist/src/lib/text_parsers/doctrinal_references.test.d.ts +1 -0
- package/dist/src/lib/text_parsers/legal_text_aliases.d.ts +12 -0
- package/package.json +1 -1
|
@@ -10392,8 +10392,305 @@ function Yp(e, t) {
|
|
|
10392
10392
|
return Jp(new n(e), t).output;
|
|
10393
10393
|
}
|
|
10394
10394
|
//#endregion
|
|
10395
|
-
//#region src/lib/text_parsers/
|
|
10396
|
-
var Xp =
|
|
10395
|
+
//#region src/lib/text_parsers/legal_text_aliases.ts
|
|
10396
|
+
var Xp = [
|
|
10397
|
+
{
|
|
10398
|
+
cid: "LEGITEXT000025024948",
|
|
10399
|
+
nature: "CODE",
|
|
10400
|
+
pattern: String.raw`(?:cpc|c\.?\s*pr(?:oc(?:[eé]dure)?)?\.?\s*civ(?:il)?\.?)\s*ex[eé]c(?:ution)?\.?`,
|
|
10401
|
+
title: "Code des procédures civiles d'exécution"
|
|
10402
|
+
},
|
|
10403
|
+
{
|
|
10404
|
+
cid: "LEGITEXT000006070716",
|
|
10405
|
+
nature: "CODE",
|
|
10406
|
+
pattern: String.raw`c\.?\s*pr(?:oc(?:[eé]dure)?)?\.?\s*civ(?:il)?\.?|cpc`,
|
|
10407
|
+
title: "Code de procédure civile"
|
|
10408
|
+
},
|
|
10409
|
+
{
|
|
10410
|
+
cid: "LEGITEXT000006071154",
|
|
10411
|
+
nature: "CODE",
|
|
10412
|
+
pattern: String.raw`c\.?\s*pr(?:oc(?:[eé]dure)?)?\.?\s*p[eé]n(?:al)?\.?|cpp`,
|
|
10413
|
+
title: "Code de procédure pénale"
|
|
10414
|
+
},
|
|
10415
|
+
{
|
|
10416
|
+
cid: "LEGITEXT000006070721",
|
|
10417
|
+
nature: "CODE",
|
|
10418
|
+
pattern: String.raw`c\.?\s*civ(?:il)?\.?`,
|
|
10419
|
+
title: "Code civil"
|
|
10420
|
+
},
|
|
10421
|
+
{
|
|
10422
|
+
cid: "LEGITEXT000005634379",
|
|
10423
|
+
nature: "CODE",
|
|
10424
|
+
pattern: String.raw`c\.?\s*com(?:merce)?\.?`,
|
|
10425
|
+
title: "Code de commerce"
|
|
10426
|
+
},
|
|
10427
|
+
{
|
|
10428
|
+
cid: "LEGITEXT000006072050",
|
|
10429
|
+
nature: "CODE",
|
|
10430
|
+
pattern: String.raw`c\.?\s*trav(?:ail)?\.?`,
|
|
10431
|
+
title: "Code du travail"
|
|
10432
|
+
},
|
|
10433
|
+
{
|
|
10434
|
+
cid: "LEGITEXT000006070719",
|
|
10435
|
+
nature: "CODE",
|
|
10436
|
+
pattern: String.raw`c\.?\s*p[eé]n(?:al)?\.?`,
|
|
10437
|
+
title: "Code pénal"
|
|
10438
|
+
},
|
|
10439
|
+
{
|
|
10440
|
+
cid: "LEGITEXT000006071367",
|
|
10441
|
+
nature: "CODE",
|
|
10442
|
+
pattern: String.raw`c\.?\s*rur(?:al)?\.?`,
|
|
10443
|
+
title: "Code rural et de la pêche maritime"
|
|
10444
|
+
},
|
|
10445
|
+
{
|
|
10446
|
+
cid: "LEGITEXT000006073984",
|
|
10447
|
+
nature: "CODE",
|
|
10448
|
+
pattern: String.raw`c\.?\s*assur(?:ances?)?\.?`,
|
|
10449
|
+
title: "Code des assurances"
|
|
10450
|
+
},
|
|
10451
|
+
{
|
|
10452
|
+
cid: "LEGITEXT000006069565",
|
|
10453
|
+
nature: "CODE",
|
|
10454
|
+
pattern: String.raw`c\.?\s*consom(?:mation)?\.?`,
|
|
10455
|
+
title: "Code de la consommation"
|
|
10456
|
+
},
|
|
10457
|
+
{
|
|
10458
|
+
cid: "LEGITEXT000006074075",
|
|
10459
|
+
nature: "CODE",
|
|
10460
|
+
pattern: String.raw`c\.?\s*urb(?:anisme)?\.?`,
|
|
10461
|
+
title: "Code de l'urbanisme"
|
|
10462
|
+
},
|
|
10463
|
+
{
|
|
10464
|
+
cid: "LEGITEXT000023086525",
|
|
10465
|
+
nature: "CODE",
|
|
10466
|
+
pattern: String.raw`c\.?\s*transp(?:orts?)?\.?`,
|
|
10467
|
+
title: "Code des transports"
|
|
10468
|
+
},
|
|
10469
|
+
{
|
|
10470
|
+
cid: "LEGITEXT000006069577",
|
|
10471
|
+
nature: "CODE",
|
|
10472
|
+
pattern: "cgi",
|
|
10473
|
+
title: "Code général des impôts"
|
|
10474
|
+
},
|
|
10475
|
+
{
|
|
10476
|
+
cid: "LEGITEXT000006069583",
|
|
10477
|
+
nature: "CODE",
|
|
10478
|
+
pattern: "lpf",
|
|
10479
|
+
title: "Livre des procédures fiscales"
|
|
10480
|
+
},
|
|
10481
|
+
{
|
|
10482
|
+
cid: "LEGITEXT000006073189",
|
|
10483
|
+
nature: "CODE",
|
|
10484
|
+
pattern: "css",
|
|
10485
|
+
title: "Code de la sécurité sociale"
|
|
10486
|
+
},
|
|
10487
|
+
{
|
|
10488
|
+
cid: "LEGITEXT000044595989",
|
|
10489
|
+
nature: "CODE",
|
|
10490
|
+
pattern: "cibs",
|
|
10491
|
+
title: "Code des impositions sur les biens et services"
|
|
10492
|
+
},
|
|
10493
|
+
{
|
|
10494
|
+
cid: "LEGITEXT000006070933",
|
|
10495
|
+
nature: "CODE",
|
|
10496
|
+
pattern: "cja",
|
|
10497
|
+
title: "Code de justice administrative"
|
|
10498
|
+
},
|
|
10499
|
+
{
|
|
10500
|
+
cid: "LEGITEXT000006074096",
|
|
10501
|
+
nature: "CODE",
|
|
10502
|
+
pattern: "cch",
|
|
10503
|
+
title: "Code de la construction et de l'habitation"
|
|
10504
|
+
},
|
|
10505
|
+
{
|
|
10506
|
+
cid: "LEGITEXT000006074069",
|
|
10507
|
+
nature: "CODE",
|
|
10508
|
+
pattern: "casf",
|
|
10509
|
+
title: "Code de l'action sociale et des familles"
|
|
10510
|
+
},
|
|
10511
|
+
{
|
|
10512
|
+
cid: "LEGITEXT000006070633",
|
|
10513
|
+
nature: "CODE",
|
|
10514
|
+
pattern: "cgct",
|
|
10515
|
+
title: "Code général des collectivités territoriales"
|
|
10516
|
+
},
|
|
10517
|
+
{
|
|
10518
|
+
cid: "LEGITEXT000006071164",
|
|
10519
|
+
nature: "CODE",
|
|
10520
|
+
pattern: "coj",
|
|
10521
|
+
title: "Code de l'organisation judiciaire"
|
|
10522
|
+
},
|
|
10523
|
+
{
|
|
10524
|
+
cid: "LEGITEXT000006069414",
|
|
10525
|
+
nature: "CODE",
|
|
10526
|
+
pattern: "cpi",
|
|
10527
|
+
title: "Code de la propriété intellectuelle"
|
|
10528
|
+
},
|
|
10529
|
+
{
|
|
10530
|
+
cid: "LEGITEXT000006070987",
|
|
10531
|
+
nature: "CODE",
|
|
10532
|
+
pattern: "cpce",
|
|
10533
|
+
title: "Code des postes et des communications électroniques"
|
|
10534
|
+
},
|
|
10535
|
+
{
|
|
10536
|
+
cid: "LEGITEXT000006072665",
|
|
10537
|
+
nature: "CODE",
|
|
10538
|
+
pattern: "csp",
|
|
10539
|
+
title: "Code de la santé publique"
|
|
10540
|
+
},
|
|
10541
|
+
{
|
|
10542
|
+
cid: "LEGITEXT000006070158",
|
|
10543
|
+
nature: "CODE",
|
|
10544
|
+
pattern: "ceseda",
|
|
10545
|
+
title: "Code de l'entrée et du séjour des étrangers et du droit d'asile"
|
|
10546
|
+
},
|
|
10547
|
+
{
|
|
10548
|
+
cid: "LEGITEXT000006072026",
|
|
10549
|
+
nature: "CODE",
|
|
10550
|
+
pattern: "(?:comofi|cmf)",
|
|
10551
|
+
title: "Code monétaire et financier"
|
|
10552
|
+
}
|
|
10553
|
+
], Zp = Xp.map((e) => ({
|
|
10554
|
+
alias: e,
|
|
10555
|
+
regExp: RegExp(`^(?:${e.pattern})$`, "iv")
|
|
10556
|
+
})), Qp = `(?:${Xp.map(({ pattern: e }) => `(?:${e})`).join("|")})`, $p = {
|
|
10557
|
+
I: {
|
|
10558
|
+
cid: "LEGITEXT000006069568",
|
|
10559
|
+
nature: "CODE",
|
|
10560
|
+
title: "Code général des impôts, annexe I"
|
|
10561
|
+
},
|
|
10562
|
+
II: {
|
|
10563
|
+
cid: "LEGITEXT000006069569",
|
|
10564
|
+
nature: "CODE",
|
|
10565
|
+
title: "Code général des impôts, annexe II"
|
|
10566
|
+
},
|
|
10567
|
+
III: {
|
|
10568
|
+
cid: "LEGITEXT000006069574",
|
|
10569
|
+
nature: "CODE",
|
|
10570
|
+
title: "Code général des impôts, annexe III"
|
|
10571
|
+
},
|
|
10572
|
+
IV: {
|
|
10573
|
+
cid: "LEGITEXT000006069576",
|
|
10574
|
+
nature: "CODE",
|
|
10575
|
+
title: "Code général des impôts, annexe IV"
|
|
10576
|
+
}
|
|
10577
|
+
};
|
|
10578
|
+
function em(e) {
|
|
10579
|
+
let t = Zp.find(({ regExp: t }) => t.test(e))?.alias;
|
|
10580
|
+
if (t === void 0) return;
|
|
10581
|
+
let { cid: n, nature: r, title: i } = t;
|
|
10582
|
+
return {
|
|
10583
|
+
cid: n,
|
|
10584
|
+
nature: r,
|
|
10585
|
+
title: i
|
|
10586
|
+
};
|
|
10587
|
+
}
|
|
10588
|
+
function tm(e, t) {
|
|
10589
|
+
let n = em(e);
|
|
10590
|
+
return n === void 0 ? void 0 : {
|
|
10591
|
+
...n,
|
|
10592
|
+
position: t,
|
|
10593
|
+
type: "texte"
|
|
10594
|
+
};
|
|
10595
|
+
}
|
|
10596
|
+
var nm = T(...Xp.map(({ pattern: e }) => C(`${e}(?=$|\\P{Alphabetic})`, {
|
|
10597
|
+
flags: "iv",
|
|
10598
|
+
value: (e, t) => tm(e[0], t.position())
|
|
10599
|
+
})));
|
|
10600
|
+
//#endregion
|
|
10601
|
+
//#region src/lib/text_parsers/doctrinal_references.ts
|
|
10602
|
+
function rm(e, t) {
|
|
10603
|
+
let n = e.indices?.groups?.[t];
|
|
10604
|
+
return n === void 0 ? void 0 : {
|
|
10605
|
+
start: n[0],
|
|
10606
|
+
stop: n[1]
|
|
10607
|
+
};
|
|
10608
|
+
}
|
|
10609
|
+
function im(e) {
|
|
10610
|
+
let t = e.groups?.article?.trim(), n = e.groups?.text;
|
|
10611
|
+
if (t === void 0 || n === void 0) return;
|
|
10612
|
+
let r = rm(e, "articleKeyword");
|
|
10613
|
+
if (r === void 0 && !/^(?:(?:L\.?\s*O|[LRDA])\*?\.?\s*)\d/iu.test(t)) return;
|
|
10614
|
+
let i = t.match(/^(?<article>.*\d(?:[\p{L}\d-]*))\s+(?<subdivision>[IVXLCDM]+(?:\s+(?:bis|ter|quater))?|\d+\s*(?:°|º))$/iu)?.groups?.article?.trim() ?? t, a = Jt(i), o = rm(e, "article"), s = rm(e, "text");
|
|
10615
|
+
if (a === void 0 || o === void 0 || s === void 0) return;
|
|
10616
|
+
let c = tm(n, s);
|
|
10617
|
+
if (c === void 0) return;
|
|
10618
|
+
let l = {
|
|
10619
|
+
num: a,
|
|
10620
|
+
position: {
|
|
10621
|
+
start: r?.start ?? o.start,
|
|
10622
|
+
stop: o.stop - (t.length - i.length)
|
|
10623
|
+
},
|
|
10624
|
+
type: "article"
|
|
10625
|
+
};
|
|
10626
|
+
return {
|
|
10627
|
+
child: l,
|
|
10628
|
+
parent: c,
|
|
10629
|
+
position: {
|
|
10630
|
+
start: Math.min(c.position.start, l.position.start),
|
|
10631
|
+
stop: Math.max(c.position.stop, l.position.stop)
|
|
10632
|
+
},
|
|
10633
|
+
type: "parent-enfant"
|
|
10634
|
+
};
|
|
10635
|
+
}
|
|
10636
|
+
var am = C(String.raw`cgi\s*,\s*ann(?:exe)?\.?\s*(IV|III|II|I)`, {
|
|
10637
|
+
flags: "i",
|
|
10638
|
+
value: (e, t) => {
|
|
10639
|
+
let n = $p[e[1].toUpperCase()];
|
|
10640
|
+
return n === void 0 ? void 0 : {
|
|
10641
|
+
...n,
|
|
10642
|
+
position: t.position(),
|
|
10643
|
+
type: "texte"
|
|
10644
|
+
};
|
|
10645
|
+
}
|
|
10646
|
+
}), om = o(Qt, { value: (e, t) => ({
|
|
10647
|
+
num: e,
|
|
10648
|
+
position: t.position(),
|
|
10649
|
+
type: "article"
|
|
10650
|
+
}) }), sm = x([C(String.raw`\s*,\s*art(?:icle)?\.?\s+`, { flags: "i" }), om], { value: (e) => e[1] }), cm = x([
|
|
10651
|
+
w(C(String.raw`(?:le|la|les)\s+`, { flags: "i" }), { default: "" }),
|
|
10652
|
+
T(am, nm),
|
|
10653
|
+
sm
|
|
10654
|
+
], { value: (e, t) => ({
|
|
10655
|
+
child: e[2],
|
|
10656
|
+
parent: e[1],
|
|
10657
|
+
position: t.position(),
|
|
10658
|
+
type: "parent-enfant"
|
|
10659
|
+
}) }), lm = C(String.raw`(?:(?<articleKeyword>articles?)\s+)?(?<article>\S[^\n,;:\(\)]*?)\s+(?:(?:du|de\s+la|de\s+l['’])\s+)?(?<text>${Qp})(?=$|\P{Alphabetic})`, {
|
|
10660
|
+
flags: "div",
|
|
10661
|
+
value: (e) => im(e)
|
|
10662
|
+
}), um = C(String.raw`(?<article1>(?:(?:L\.?\s*O|[LRDA])\*?\.?\s*)\d[^\n,;:\(\)]*?)\s+(?<coordinator>et|ou)\s+(?<article2>(?:(?:L\.?\s*O|[LRDA])\*?\.?\s*)\d[^\n,;:\(\)]*?)\s+(?:(?:du|de\s+la|de\s+l['’])\s+)?(?<text>${Qp})(?=$|\P{Alphabetic})`, {
|
|
10663
|
+
flags: "div",
|
|
10664
|
+
value: (e) => {
|
|
10665
|
+
let t = rm(e, "article1"), n = rm(e, "article2"), r = rm(e, "text"), i = e.groups?.article1, a = e.groups?.article2, o = e.groups?.coordinator, s = i === void 0 ? void 0 : Jt(i.trim()), c = a === void 0 ? void 0 : Jt(a.trim()), l = e.groups?.text === void 0 || r === void 0 ? void 0 : tm(e.groups.text, r);
|
|
10666
|
+
if (!(t === void 0 || n === void 0 || s === void 0 || c === void 0 || o !== "et" && o !== "ou" || l === void 0)) return {
|
|
10667
|
+
child: {
|
|
10668
|
+
coordinator: o,
|
|
10669
|
+
left: {
|
|
10670
|
+
num: s,
|
|
10671
|
+
position: t,
|
|
10672
|
+
type: "article"
|
|
10673
|
+
},
|
|
10674
|
+
position: {
|
|
10675
|
+
start: t.start,
|
|
10676
|
+
stop: n.stop
|
|
10677
|
+
},
|
|
10678
|
+
right: {
|
|
10679
|
+
num: c,
|
|
10680
|
+
position: n,
|
|
10681
|
+
type: "article"
|
|
10682
|
+
},
|
|
10683
|
+
type: "enumeration"
|
|
10684
|
+
},
|
|
10685
|
+
parent: l,
|
|
10686
|
+
position: {
|
|
10687
|
+
start: t.start,
|
|
10688
|
+
stop: l.position.stop
|
|
10689
|
+
},
|
|
10690
|
+
type: "parent-enfant"
|
|
10691
|
+
};
|
|
10692
|
+
}
|
|
10693
|
+
}), dm = T(cm, um, lm), fm = (e) => {
|
|
10397
10694
|
let t = e.offset, n = /,\s*(?:par\s+)?/guy;
|
|
10398
10695
|
if (n.lastIndex = t, !n.exec(e.input)) return;
|
|
10399
10696
|
e.offset = n.lastIndex;
|
|
@@ -10409,7 +10706,7 @@ var Xp = (e) => {
|
|
|
10409
10706
|
}
|
|
10410
10707
|
return e.offset = i.lastIndex, e.length = 0, e.usedInputs = e.input.slice(t, e.offset), r;
|
|
10411
10708
|
};
|
|
10412
|
-
function
|
|
10709
|
+
function pm(e) {
|
|
10413
10710
|
for (let t = 0; t < e.length; t += 1) {
|
|
10414
10711
|
let r = t === 0 ? void 0 : e[t - 1];
|
|
10415
10712
|
if (r && /[\p{L}\p{N}_]/u.test(r)) continue;
|
|
@@ -10418,7 +10715,7 @@ function Zp(e) {
|
|
|
10418
10715
|
}
|
|
10419
10716
|
return null;
|
|
10420
10717
|
}
|
|
10421
|
-
function
|
|
10718
|
+
function mm(e) {
|
|
10422
10719
|
let t = [], r = /(?:,\s*)?par\s+/giu, i = 0, a;
|
|
10423
10720
|
for (; (a = r.exec(e)) !== null;) {
|
|
10424
10721
|
let o = new n(e, r.lastIndex);
|
|
@@ -10430,17 +10727,17 @@ function Qp(e) {
|
|
|
10430
10727
|
}
|
|
10431
10728
|
//#endregion
|
|
10432
10729
|
//#region src/lib/text_parsers/actions.ts
|
|
10433
|
-
var
|
|
10730
|
+
var hm = (e) => x([
|
|
10434
10731
|
C(e, { flags: "i" }),
|
|
10435
|
-
|
|
10732
|
+
fm,
|
|
10436
10733
|
C(e === "est" ? "remplacée?" : "remplacée?s", { flags: "i" })
|
|
10437
|
-
], { value: "remplacer" }),
|
|
10734
|
+
], { value: "remplacer" }), gm = T(ee(C("(modalités|conditions) d'application (de )?", { flags: "i" }), {
|
|
10438
10735
|
lookbackLength: 35,
|
|
10439
10736
|
value: { action: "précision" }
|
|
10440
10737
|
}), ee(C("en application (de )?", { flags: "i" }), {
|
|
10441
10738
|
lookbackLength: 35,
|
|
10442
10739
|
value: { action: "application" }
|
|
10443
|
-
})),
|
|
10740
|
+
})), _m = i("après|avant|ajoutée?s?|insérée?s?|complétée?s?|rédigée?s?|suit|modifiée?s?|rétablie?s?|remplacée?s?|supprimée?s?|abrogée?s?|devient", T(x([
|
|
10444
10741
|
b,
|
|
10445
10742
|
C("est complété par les mots ?", { flags: "i" }),
|
|
10446
10743
|
C(" ?:"),
|
|
@@ -10508,7 +10805,7 @@ var $p = (e) => x([
|
|
|
10508
10805
|
}), C("est rétablie? (ainsi qu'il|comme) suit", {
|
|
10509
10806
|
flags: "i",
|
|
10510
10807
|
value: "rétablir"
|
|
10511
|
-
}),
|
|
10808
|
+
}), hm("est"), C("est remplacée?", {
|
|
10512
10809
|
flags: "i",
|
|
10513
10810
|
value: "remplacer"
|
|
10514
10811
|
}), C("sont ainsi modifiée?s", {
|
|
@@ -10523,7 +10820,7 @@ var $p = (e) => x([
|
|
|
10523
10820
|
}), C("sont rétablie?s (ainsi qu'il|comme) suit", {
|
|
10524
10821
|
flags: "i",
|
|
10525
10822
|
value: "rétablir"
|
|
10526
|
-
}),
|
|
10823
|
+
}), hm("sont"), C("sont remplacée?s", {
|
|
10527
10824
|
flags: "i",
|
|
10528
10825
|
value: "remplacer"
|
|
10529
10826
|
}), C("sont renum[eé]rotée?s", {
|
|
@@ -10543,7 +10840,7 @@ var $p = (e) => x([
|
|
|
10543
10840
|
}), C("est remplacée?", {
|
|
10544
10841
|
flags: "i",
|
|
10545
10842
|
value: "remplacer"
|
|
10546
|
-
}),
|
|
10843
|
+
}), hm("est"), hm("sont"), C("sont remplacée?s", {
|
|
10547
10844
|
flags: "i",
|
|
10548
10845
|
value: "remplacer"
|
|
10549
10846
|
}), C("est modifiée?", {
|
|
@@ -10703,23 +11000,23 @@ var $p = (e) => x([
|
|
|
10703
11000
|
}), C("est supprimée?", {
|
|
10704
11001
|
flags: "i",
|
|
10705
11002
|
value: "supprimer"
|
|
10706
|
-
}))], { value: (e) => ({ action: e[1] }) }))),
|
|
11003
|
+
}))], { value: (e) => ({ action: e[1] }) }))), vm = T(un, wn), ym = T(fn, xn, nm, he), bm = x([vm, _(x([le, ym], { value: (e) => e[1] }))], { value: (e, t) => _t(e[0], e[1], t.position()) }), xm = x([ym, _(x([le, ym], { value: (e) => e[1] }))], { value: (e, t) => _t(e[0], e[1], t.position()) }), Sm = x([se, bm], { value: (e) => e[1] }), Cm = T(x([le, xm], { value: (e) => e[1] }), Sm), wm = T(x([Ht, w(Cm, { default: null })], { value: (e) => {
|
|
10707
11004
|
let t = e[0], n = e[1];
|
|
10708
11005
|
return n === null ? t : mt(n, t);
|
|
10709
|
-
} }),
|
|
11006
|
+
} }), bm), Tm = T(x([Ut, w(Cm, { default: null })], { value: (e) => {
|
|
10710
11007
|
let t = e[0], n = e[1];
|
|
10711
11008
|
return n === null ? t : mt(n, t);
|
|
10712
|
-
} }),
|
|
10713
|
-
w(
|
|
11009
|
+
} }), xm), Em = x([
|
|
11010
|
+
w(gm, { default: null }),
|
|
10714
11011
|
x([
|
|
10715
11012
|
p,
|
|
10716
|
-
|
|
11013
|
+
wm,
|
|
10717
11014
|
w([w(C(" modifiée?s", { flags: "i" }), { default: "" }), C(" susvisée?s", { flags: "i" })], { default: "" })
|
|
10718
11015
|
], { value: (e, t) => ({
|
|
10719
11016
|
...e[1],
|
|
10720
11017
|
position: t.position()
|
|
10721
11018
|
}) }),
|
|
10722
|
-
w(
|
|
11019
|
+
w(_m, { default: null })
|
|
10723
11020
|
], { value: (e, t) => {
|
|
10724
11021
|
let n = e[2] ?? e[0];
|
|
10725
11022
|
return n === null ? e[1] : {
|
|
@@ -10728,18 +11025,18 @@ var $p = (e) => x([
|
|
|
10728
11025
|
reference: e[1],
|
|
10729
11026
|
type: "reference_et_action"
|
|
10730
11027
|
};
|
|
10731
|
-
} }),
|
|
10732
|
-
w(
|
|
11028
|
+
} }), Dm = T(x([
|
|
11029
|
+
w(gm, { default: null }),
|
|
10733
11030
|
x([
|
|
10734
11031
|
ce,
|
|
10735
|
-
|
|
11032
|
+
Tm,
|
|
10736
11033
|
w([w(C(" modifiée?", { flags: "i" }), { default: "" }), C(" susvisée?", { flags: "i" })], { default: "" }),
|
|
10737
11034
|
w(C(String.raw`, ?qui devient [^,]+ ","`, { flags: "i" }), { default: "" })
|
|
10738
11035
|
], { value: (e, t) => ({
|
|
10739
11036
|
...e[1],
|
|
10740
11037
|
position: t.position()
|
|
10741
11038
|
}) }),
|
|
10742
|
-
w(
|
|
11039
|
+
w(_m, { default: null })
|
|
10743
11040
|
], { value: (e, t) => {
|
|
10744
11041
|
let n = e[2] ?? e[0];
|
|
10745
11042
|
return n === null ? e[1] : {
|
|
@@ -10748,23 +11045,23 @@ var $p = (e) => x([
|
|
|
10748
11045
|
reference: e[1],
|
|
10749
11046
|
type: "reference_et_action"
|
|
10750
11047
|
};
|
|
10751
|
-
} }),
|
|
11048
|
+
} }), Em), Om = i("article|loi|décret|code|alinéa|phrase|chapitre|titre|livre|partie|section|paragraphe|ordonnance|constitution|directive|règlement|\\d|[ivxlc]+|[a-zA-Z]", x([Dm, _([T(Ct, St), Dm])], { value: (e, t) => ht(e[0], e[1], t.position()) })), km = o(Tm, { value: (e, t) => ({
|
|
10752
11049
|
...e,
|
|
10753
11050
|
position: t.position()
|
|
10754
|
-
}) }),
|
|
11051
|
+
}) }), Am = T(_(km, {
|
|
10755
11052
|
min: 2,
|
|
10756
11053
|
separator: Ne,
|
|
10757
11054
|
value: (e) => [e[0], ...e.slice(1).map(([, e]) => e)]
|
|
10758
|
-
}), _(
|
|
11055
|
+
}), _(km, {
|
|
10759
11056
|
min: 2,
|
|
10760
11057
|
separator: C(String.raw`\n`),
|
|
10761
11058
|
value: (e) => [e[0], ...e.slice(1).map(([, e]) => e)]
|
|
10762
|
-
}), o(
|
|
11059
|
+
}), o(km, { value: (e) => [e] }));
|
|
10763
11060
|
//#endregion
|
|
10764
11061
|
//#region src/lib/extractors/references.ts
|
|
10765
|
-
function*
|
|
11062
|
+
function* jm(e, t) {
|
|
10766
11063
|
let r = Jp(e, t), i = new n(r.output), a = _e(r);
|
|
10767
|
-
for (let e of
|
|
11064
|
+
for (let e of Nm(i)) {
|
|
10768
11065
|
e = structuredClone(e), t.references === void 0 && (t.references = []), t.references.push(e);
|
|
10769
11066
|
for (let t of xt(e)) {
|
|
10770
11067
|
let e = t.position;
|
|
@@ -10773,132 +11070,132 @@ function* hm(e, t) {
|
|
|
10773
11070
|
yield e;
|
|
10774
11071
|
}
|
|
10775
11072
|
}
|
|
10776
|
-
function*
|
|
10777
|
-
yield*
|
|
11073
|
+
function* Mm(e, t = {}) {
|
|
11074
|
+
yield* Nm(e, t);
|
|
10778
11075
|
}
|
|
10779
|
-
function*
|
|
10780
|
-
let n = i(String.raw`arrêtés?|circulaires?|code|constitution|décrets?(?:-loi)?|loi|ordonnance|art\.|articles?|chapitre|livre|paragraphe|partie|section|sous-paragraphe|sous-section|sous-sous-paragraphe|sous-titre|titre|alinéas?|phrases?|règlements?|directives?|décisions?|«|[IVXLCDM]+|[A-Z]|\d+`, T($, tn, _n,
|
|
11076
|
+
function* Nm(e, t = {}) {
|
|
11077
|
+
let n = i(String.raw`arrêtés?|circulaires?|code|constitution|décrets?(?:-loi)?|loi|ordonnance|art\.|articles?|chapitre|livre|paragraphe|partie|section|sous-paragraphe|sous-section|sous-sous-paragraphe|sous-titre|titre|alinéas?|phrases?|règlements?|directives?|décisions?|«|[IVXLCDM]+|[A-Z]|\d+`, T($, tn, _n, dm, Om), 80, String.raw`(?<=^|\P{Alphabetic})(?:arrêtés?|circulaires?|code|constitution|décrets?(?:-loi)?|loi|ordonnance|art\.|articles?|chapitre|livre|paragraphe|partie|section|sous-paragraphe|sous-section|sous-sous-paragraphe|sous-titre|titre|alinéas?|phrases?|règlements?|directives?|décisions?|«|[IVXLCDM]+|[A-Z]|\d+)(?=$|\P{Alphabetic})`);
|
|
10781
11078
|
for (let r of n.extract(e, {
|
|
10782
11079
|
overlapWindow: 80,
|
|
10783
11080
|
overlapWindowForCandidate: t.overlapWindowForCandidate
|
|
10784
|
-
})) if (r !== void 0) if (r.type === "citation") yield*
|
|
11081
|
+
})) if (r !== void 0) if (r.type === "citation") yield* jm(e, r);
|
|
10785
11082
|
else {
|
|
10786
11083
|
if (r.type === "reference_et_action" || r.type === "alinéa" || r.type === "article" || r.type === "chapitre" || r.type === "item" || r.type === "livre" || r.type === "paragraphe" || r.type === "partie" || r.type === "phrase" || r.type === "section" || r.type === "sous-paragraphe" || r.type === "sous-section" || r.type === "sous-sous-paragraphe" || r.type === "sous-titre" || r.type === "titre" || r.type === "texte" || r.type === "bounded-interval" || r.type === "counted-interval" || r.type === "enumeration" || r.type === "exclusion" || r.type === "parent-enfant" || r.type === "incomplete-header") {
|
|
10787
11084
|
for (let t of xt(r)) if (t.type === "reference_et_action") {
|
|
10788
11085
|
let { originalCitations: n } = t.action;
|
|
10789
|
-
if (n !== void 0) for (let t of n) for (let n of
|
|
11086
|
+
if (n !== void 0) for (let t of n) for (let n of jm(e, t));
|
|
10790
11087
|
}
|
|
10791
11088
|
}
|
|
10792
11089
|
yield r;
|
|
10793
11090
|
}
|
|
10794
11091
|
}
|
|
10795
|
-
function*
|
|
11092
|
+
function* Pm(e, t) {
|
|
10796
11093
|
let n = _e(t);
|
|
10797
|
-
for (let t of
|
|
11094
|
+
for (let t of Mm(e)) {
|
|
10798
11095
|
for (let e of xt(t, { citations: !0 })) e.position !== void 0 && (e.originalTransformation = v(n, e.position));
|
|
10799
11096
|
yield t;
|
|
10800
11097
|
}
|
|
10801
11098
|
}
|
|
10802
|
-
var
|
|
11099
|
+
var Fm = (e) => [...Mm(e)], Im = (e, t) => [...Pm(e, t)], Lm = "(?:avant|apr[eè]s)", Rm = T(C("avant(?![-A-Za-zÀ-ÖØ-öø-ÿ0-9_])", {
|
|
10803
11100
|
flags: "i",
|
|
10804
11101
|
value: "before"
|
|
10805
11102
|
}), C("apr[eè]s(?![-A-Za-zÀ-ÖØ-öø-ÿ0-9_])", {
|
|
10806
11103
|
flags: "i",
|
|
10807
11104
|
value: "after"
|
|
10808
|
-
})),
|
|
11105
|
+
})), zm = T(C("(?:au|a[uù])\\s+d[eé]but\\b", {
|
|
10809
11106
|
flags: "i",
|
|
10810
11107
|
value: "start"
|
|
10811
11108
|
}), C("(?:a|à)\\s+la\\s+fin\\b", {
|
|
10812
11109
|
flags: "i",
|
|
10813
11110
|
value: "end"
|
|
10814
11111
|
}));
|
|
10815
|
-
function
|
|
11112
|
+
function Bm(e) {
|
|
10816
11113
|
return e === "before" ? "insert_before" : "insert_after";
|
|
10817
11114
|
}
|
|
10818
|
-
function
|
|
10819
|
-
let t =
|
|
11115
|
+
function Vm(e) {
|
|
11116
|
+
let t = Hm(e), n = /(?:^|[^\p{L}\p{N}_-])(avant|apres)(?![\p{L}\p{N}_-])/u.exec(t);
|
|
10820
11117
|
return n ? n[1] === "avant" ? "before" : "after" : null;
|
|
10821
11118
|
}
|
|
10822
|
-
function
|
|
11119
|
+
function Hm(e) {
|
|
10823
11120
|
return e.toLowerCase().normalize("NFD").replace(/\p{Diacritic}/gu, "");
|
|
10824
11121
|
}
|
|
10825
11122
|
//#endregion
|
|
10826
11123
|
//#region src/lib/text_parsers/action_words.ts
|
|
10827
|
-
var
|
|
10828
|
-
function
|
|
11124
|
+
var Um = /\b(ins[èe]re|ins[ée]r[ée]|ajout|remplac|supprim|abrog|compl[èeé]t|r[ée]dig|r[ée]tabl|modifi(?:e|é|ée|és|ées|er|ant|ent))/iu;
|
|
11125
|
+
function Wm(e) {
|
|
10829
11126
|
return e.toLowerCase().normalize("NFD").replace(/\p{Diacritic}/gu, "");
|
|
10830
11127
|
}
|
|
10831
|
-
function
|
|
11128
|
+
function Gm(e, t = e) {
|
|
10832
11129
|
return /\bredige\b|\bredigee\b|\bredigees\b|\brediges\b|\bainsi\b/.test(e) || /\bdispositions suivantes\b/.test(t);
|
|
10833
11130
|
}
|
|
10834
|
-
function
|
|
10835
|
-
return
|
|
11131
|
+
function Km(e) {
|
|
11132
|
+
return Vm(e) === "after";
|
|
10836
11133
|
}
|
|
10837
|
-
function
|
|
10838
|
-
return
|
|
11134
|
+
function qm(e) {
|
|
11135
|
+
return Vm(e) === "before";
|
|
10839
11136
|
}
|
|
10840
|
-
function
|
|
11137
|
+
function Jm(e) {
|
|
10841
11138
|
return /\bretabl/.test(e);
|
|
10842
11139
|
}
|
|
10843
|
-
function
|
|
11140
|
+
function Ym(e) {
|
|
10844
11141
|
return /\binsere(?:e|es|s)?\b|\bajoute\b|\bajoutee\b|\bajoutes\b|\bajoutees\b|\bcomplete(?:e|es|s)?\b/.test(e);
|
|
10845
11142
|
}
|
|
10846
|
-
function
|
|
11143
|
+
function Xm(e) {
|
|
10847
11144
|
return /\bremplace\b|\bremplacee\b|\bremplaces\b|\bremplacees\b/.test(e);
|
|
10848
11145
|
}
|
|
10849
|
-
function
|
|
11146
|
+
function Zm(e) {
|
|
10850
11147
|
return /\bsupprime\b|\bsupprimee\b|\bsupprimes\b|\bsupprimees\b|\babroge\b|\babrogee\b|\babroges\b|\babrogees\b/.test(e);
|
|
10851
11148
|
}
|
|
10852
|
-
function
|
|
11149
|
+
function Qm(e) {
|
|
10853
11150
|
return /\b(remplace|modifie|redige|rediges|redigee|redigees)\b/.test(e);
|
|
10854
11151
|
}
|
|
10855
11152
|
//#endregion
|
|
10856
11153
|
//#region src/lib/extractors/portion_references.ts
|
|
10857
|
-
function
|
|
11154
|
+
function $m(e, t) {
|
|
10858
11155
|
e && (e.start += t, e.stop += t);
|
|
10859
11156
|
}
|
|
10860
|
-
function
|
|
11157
|
+
function eh(e, t) {
|
|
10861
11158
|
if (e.type === "parent-enfant") {
|
|
10862
|
-
|
|
11159
|
+
eh(e.parent, t), eh(e.child, t), $m(e.position, t);
|
|
10863
11160
|
return;
|
|
10864
11161
|
}
|
|
10865
11162
|
if (e.type === "bounded-interval") {
|
|
10866
|
-
|
|
11163
|
+
eh(e.first, t), eh(e.last, t), $m(e.position, t);
|
|
10867
11164
|
return;
|
|
10868
11165
|
}
|
|
10869
11166
|
if (e.type === "counted-interval") {
|
|
10870
|
-
|
|
11167
|
+
eh(e.first, t), $m(e.position, t);
|
|
10871
11168
|
return;
|
|
10872
11169
|
}
|
|
10873
11170
|
if (e.type === "enumeration" || e.type === "exclusion") {
|
|
10874
|
-
|
|
11171
|
+
eh(e.left, t), eh(e.right, t), $m(e.position, t);
|
|
10875
11172
|
return;
|
|
10876
11173
|
}
|
|
10877
11174
|
if (e.type === "reference_et_action") {
|
|
10878
|
-
|
|
11175
|
+
eh(e.reference, t), $m(e.position, t);
|
|
10879
11176
|
return;
|
|
10880
11177
|
}
|
|
10881
|
-
|
|
11178
|
+
$m(e.position, t);
|
|
10882
11179
|
}
|
|
10883
|
-
function
|
|
11180
|
+
function th(e) {
|
|
10884
11181
|
return e.replace(/\b(de\s+l['’]?|de\s+la|de\s+le|du|des)\s*$/i, "");
|
|
10885
11182
|
}
|
|
10886
|
-
function
|
|
11183
|
+
function nh(e) {
|
|
10887
11184
|
let t = /^(?:(?:[aà]\s+)?l['’]|(?:[aà]\s+)?la\b|(?:[aà]\s+)?le\b|les\b|des\b|aux\b|du\b)\s*/iu.exec(e)?.[0].length ?? 0, n = e.slice(t > 0 ? t : 0).trim();
|
|
10888
11185
|
return n ? {
|
|
10889
11186
|
text: n,
|
|
10890
11187
|
offset: t
|
|
10891
11188
|
} : null;
|
|
10892
11189
|
}
|
|
10893
|
-
function
|
|
11190
|
+
function rh(e) {
|
|
10894
11191
|
return [...e.matchAll(/(?:^|\P{L})(\p{L})/gu)].map((e) => (e.index ?? 0) + e[0].length - (e[1]?.length ?? 0));
|
|
10895
11192
|
}
|
|
10896
|
-
function
|
|
11193
|
+
function ih(e) {
|
|
10897
11194
|
let t = new n(e), r = Rt(t);
|
|
10898
11195
|
return !r || t.remaining().trim().length !== 0 ? null : r;
|
|
10899
11196
|
}
|
|
10900
|
-
function
|
|
10901
|
-
for (let t of
|
|
11197
|
+
function ah(e) {
|
|
11198
|
+
for (let t of rh(e)) {
|
|
10902
11199
|
let r = new n(e, t), i = Et(r);
|
|
10903
11200
|
if (!(i === void 0 || r.remaining().trim() !== "")) return {
|
|
10904
11201
|
nature: i,
|
|
@@ -10907,17 +11204,17 @@ function Um(e) {
|
|
|
10907
11204
|
}
|
|
10908
11205
|
return null;
|
|
10909
11206
|
}
|
|
10910
|
-
function
|
|
11207
|
+
function oh(e, t) {
|
|
10911
11208
|
let n = e.trim().replace(/[;:,]\s*$/u, "").replace(/\b(?:est|sont)\s*$/iu, "").trim();
|
|
10912
11209
|
if (!n) return null;
|
|
10913
|
-
for (let e of
|
|
10914
|
-
let r = n.slice(e).trim(), i =
|
|
11210
|
+
for (let e of rh(n)) {
|
|
11211
|
+
let r = n.slice(e).trim(), i = ah(r);
|
|
10915
11212
|
if (!i) continue;
|
|
10916
|
-
let a =
|
|
11213
|
+
let a = mm(r.slice(0, i.start)).trim();
|
|
10917
11214
|
if (!a) continue;
|
|
10918
11215
|
let o = /\s*(,|\bet\b|\bou\b|(?<!\p{L})[aà](?!\p{L}))\s*/giu, s = [], c = 0, l;
|
|
10919
11216
|
for (; (l = o.exec(a)) !== null;) {
|
|
10920
|
-
let e =
|
|
11217
|
+
let e = Wm(l[1] ?? "");
|
|
10921
11218
|
if (a.slice(c, l.index).trim() === "") {
|
|
10922
11219
|
e !== "a" && e !== "à" && (c = o.lastIndex);
|
|
10923
11220
|
continue;
|
|
@@ -10934,17 +11231,17 @@ function Wm(e, t) {
|
|
|
10934
11231
|
}), s.length < 2) continue;
|
|
10935
11232
|
let u = s.some((e) => e.separator === "à"), d = [], f = [], p = !0, m = i.nature, h;
|
|
10936
11233
|
for (let [n, r] of s.entries()) {
|
|
10937
|
-
let i =
|
|
11234
|
+
let i = nh(r.text);
|
|
10938
11235
|
if (!i) {
|
|
10939
11236
|
d.length = 0;
|
|
10940
11237
|
break;
|
|
10941
11238
|
}
|
|
10942
|
-
let a =
|
|
11239
|
+
let a = ih(`${i.text} ${m}`);
|
|
10943
11240
|
if (!a) {
|
|
10944
11241
|
d.length = 0;
|
|
10945
11242
|
break;
|
|
10946
11243
|
}
|
|
10947
|
-
|
|
11244
|
+
eh(a, t + e + r.start + i.offset), d.push(a), a.type !== m || a.index === void 0 || a.index < 1 ? p = !1 : (h !== void 0 && !u && a.index !== h + 1 && (p = !1), h = a.index), n < s.length - 1 && (f.push(r.separator ?? "et"), (r.separator ?? "et") === "ou" && (p = !1));
|
|
10948
11245
|
}
|
|
10949
11246
|
let [g, ..._] = d;
|
|
10950
11247
|
if (!g || _.length === 0) continue;
|
|
@@ -10961,16 +11258,16 @@ function Wm(e, t) {
|
|
|
10961
11258
|
}
|
|
10962
11259
|
return null;
|
|
10963
11260
|
}
|
|
10964
|
-
function
|
|
11261
|
+
function sh(e, t) {
|
|
10965
11262
|
let r = e.trim().replace(/[;:,]\s*$/u, "").replace(/\b(?:est|sont)\s*$/iu, "").trim();
|
|
10966
11263
|
if (!r) return null;
|
|
10967
|
-
for (let e of
|
|
11264
|
+
for (let e of rh(r)) {
|
|
10968
11265
|
let i = r.slice(e);
|
|
10969
11266
|
if (!i) continue;
|
|
10970
11267
|
let a = new n(i), o = Rt(a);
|
|
10971
11268
|
if (!o || a.offset === 0 || !se(a)) continue;
|
|
10972
|
-
let s = a.offset, c =
|
|
10973
|
-
if (c) return
|
|
11269
|
+
let s = a.offset, c = oh(i.slice(s), t + e + s);
|
|
11270
|
+
if (c) return eh(o, t + e), {
|
|
10974
11271
|
...mt(c, o),
|
|
10975
11272
|
position: {
|
|
10976
11273
|
start: o.position.start,
|
|
@@ -10980,57 +11277,57 @@ function Gm(e, t) {
|
|
|
10980
11277
|
}
|
|
10981
11278
|
return null;
|
|
10982
11279
|
}
|
|
10983
|
-
function
|
|
10984
|
-
let r =
|
|
11280
|
+
function ch(e, t) {
|
|
11281
|
+
let r = th(e);
|
|
10985
11282
|
if (!r) return null;
|
|
10986
|
-
let i =
|
|
11283
|
+
let i = sh(r, t);
|
|
10987
11284
|
if (i) return i;
|
|
10988
|
-
let a =
|
|
11285
|
+
let a = oh(r, t);
|
|
10989
11286
|
if (a) return a;
|
|
10990
|
-
for (let e of
|
|
11287
|
+
for (let e of rh(r)) {
|
|
10991
11288
|
let i = r.slice(e);
|
|
10992
11289
|
if (!i) continue;
|
|
10993
11290
|
let a = new n(i), o = Rt(a);
|
|
10994
|
-
if (!(!o || a.offset === 0) && i.slice(a.offset).trim().length === 0) return
|
|
11291
|
+
if (!(!o || a.offset === 0) && i.slice(a.offset).trim().length === 0) return eh(o, t + e), o;
|
|
10995
11292
|
}
|
|
10996
11293
|
return null;
|
|
10997
11294
|
}
|
|
10998
|
-
function
|
|
11295
|
+
function lh(e) {
|
|
10999
11296
|
return Math.max(0, ...Rp(e).map((e) => e.kind === "single" ? e.steps.length : Math.max(e.first.length, e.last.length)));
|
|
11000
11297
|
}
|
|
11001
|
-
function
|
|
11298
|
+
function uh(e) {
|
|
11002
11299
|
return Rp(e).length;
|
|
11003
11300
|
}
|
|
11004
|
-
function
|
|
11301
|
+
function dh(e, t) {
|
|
11005
11302
|
if (!e) return t;
|
|
11006
11303
|
if (!t) return e;
|
|
11007
|
-
let n =
|
|
11008
|
-
return n === r ?
|
|
11304
|
+
let n = lh(e), r = lh(t);
|
|
11305
|
+
return n === r ? uh(e) >= uh(t) ? e : t : n > r ? e : t;
|
|
11009
11306
|
}
|
|
11010
|
-
function
|
|
11307
|
+
function fh(e) {
|
|
11011
11308
|
return e.map((e) => ({
|
|
11012
11309
|
reference: e,
|
|
11013
|
-
specificity:
|
|
11310
|
+
specificity: lh(e)
|
|
11014
11311
|
})).filter((e) => e.specificity > 0).sort((e, t) => t.specificity - e.specificity)[0]?.reference ?? null;
|
|
11015
11312
|
}
|
|
11016
|
-
function
|
|
11313
|
+
function ph(e, { actionIndex: t = e.length } = {}) {
|
|
11017
11314
|
let r = /\barticle\b/i.exec(e);
|
|
11018
11315
|
if (!r || r.index === void 0) return null;
|
|
11019
11316
|
let i = r.index, a = new n(e.slice(i)), o = fn(a);
|
|
11020
11317
|
if (!o) return null;
|
|
11021
|
-
|
|
11022
|
-
let s = e.slice(0, i), c = i + a.offset, l = e.slice(c, t), u =
|
|
11318
|
+
eh(o, i);
|
|
11319
|
+
let s = e.slice(0, i), c = i + a.offset, l = e.slice(c, t), u = dh(fh(mh(s)), ch(s, 0)) ?? fh(mh(l)) ?? ch(l, c);
|
|
11023
11320
|
return u ? mt(o, u) : null;
|
|
11024
11321
|
}
|
|
11025
|
-
function
|
|
11026
|
-
return
|
|
11322
|
+
function mh(e) {
|
|
11323
|
+
return Fm(new n(e));
|
|
11027
11324
|
}
|
|
11028
11325
|
//#endregion
|
|
11029
11326
|
//#region src/lib/extractors/quoted_text.ts
|
|
11030
|
-
function
|
|
11327
|
+
function hh(e) {
|
|
11031
11328
|
return e.split(/\n+/).map((e) => e.replace(/^\s*[«“"]\s*/u, "").trim()).filter((e) => e.length > 0).join("\n").replace(/[»”"]\s*$/u, "").trim();
|
|
11032
11329
|
}
|
|
11033
|
-
function
|
|
11330
|
+
function gh(e) {
|
|
11034
11331
|
let t = [], r = 0;
|
|
11035
11332
|
for (; r < e.length;) {
|
|
11036
11333
|
let i = e.indexOf("«", r);
|
|
@@ -11042,7 +11339,7 @@ function eh(e) {
|
|
|
11042
11339
|
r = i + 1;
|
|
11043
11340
|
continue;
|
|
11044
11341
|
}
|
|
11045
|
-
let s =
|
|
11342
|
+
let s = hh(Yp(e, o)), c = o.position ?? {
|
|
11046
11343
|
start: i,
|
|
11047
11344
|
stop: i + 1
|
|
11048
11345
|
};
|
|
@@ -11056,7 +11353,7 @@ function eh(e) {
|
|
|
11056
11353
|
}
|
|
11057
11354
|
return t;
|
|
11058
11355
|
}
|
|
11059
|
-
function
|
|
11356
|
+
function _h(e, t) {
|
|
11060
11357
|
if (t.length === 0) return e;
|
|
11061
11358
|
let n = 0, r = [];
|
|
11062
11359
|
for (let { start: i, end: a } of t) {
|
|
@@ -11065,7 +11362,7 @@ function th(e, t) {
|
|
|
11065
11362
|
}
|
|
11066
11363
|
return n < e.length && r.push(e.slice(n)), r.join("");
|
|
11067
11364
|
}
|
|
11068
|
-
function
|
|
11365
|
+
function vh(e) {
|
|
11069
11366
|
let t = [], n = 0;
|
|
11070
11367
|
for (; n < e.length;) {
|
|
11071
11368
|
let r = e.indexOf("«", n);
|
|
@@ -11085,13 +11382,13 @@ function nh(e) {
|
|
|
11085
11382
|
}
|
|
11086
11383
|
return t;
|
|
11087
11384
|
}
|
|
11088
|
-
function
|
|
11385
|
+
function yh(e, t) {
|
|
11089
11386
|
return e ? t.some((t) => e.start >= t.start && e.stop <= t.end) : !1;
|
|
11090
11387
|
}
|
|
11091
|
-
function
|
|
11092
|
-
return
|
|
11388
|
+
function bh(e, t) {
|
|
11389
|
+
return yh(e, t);
|
|
11093
11390
|
}
|
|
11094
|
-
function
|
|
11391
|
+
function xh(e) {
|
|
11095
11392
|
if (!e.includes("«")) return e;
|
|
11096
11393
|
let t = e.split(""), n = !1;
|
|
11097
11394
|
for (let e = 0; e < t.length; e++) {
|
|
@@ -11110,10 +11407,10 @@ function ah(e) {
|
|
|
11110
11407
|
}
|
|
11111
11408
|
//#endregion
|
|
11112
11409
|
//#region src/lib/text_parsers/action_citation_patterns.ts
|
|
11113
|
-
function
|
|
11410
|
+
function Sh(e) {
|
|
11114
11411
|
return `(?:${e.join("|")})`;
|
|
11115
11412
|
}
|
|
11116
|
-
var
|
|
11413
|
+
var Ch = [
|
|
11117
11414
|
"(?:à\\s+|de\\s+)?l[’']année",
|
|
11118
11415
|
"(?:à\\s+|de\\s+)?la date",
|
|
11119
11416
|
"(?:à\\s+|de\\s+)?la mention",
|
|
@@ -11131,7 +11428,7 @@ var sh = [
|
|
|
11131
11428
|
"(?:aux|des|les)\\s+nombres",
|
|
11132
11429
|
"(?:aux|des|les)\\s+références",
|
|
11133
11430
|
"le tableau intitulé"
|
|
11134
|
-
],
|
|
11431
|
+
], wh = [
|
|
11135
11432
|
"l[’']année",
|
|
11136
11433
|
"la date",
|
|
11137
11434
|
"la mention",
|
|
@@ -11149,10 +11446,10 @@ var sh = [
|
|
|
11149
11446
|
"les mots",
|
|
11150
11447
|
"les nombres",
|
|
11151
11448
|
"les références"
|
|
11152
|
-
],
|
|
11449
|
+
], Th = Sh(Ch), Eh = Sh(wh);
|
|
11153
11450
|
//#endregion
|
|
11154
11451
|
//#region src/lib/text_parsers/action_directives.ts
|
|
11155
|
-
function
|
|
11452
|
+
function Dh(e) {
|
|
11156
11453
|
return e.type === "reference_et_action" ? {
|
|
11157
11454
|
action: e.action,
|
|
11158
11455
|
reference: e.reference
|
|
@@ -11161,7 +11458,7 @@ function dh(e) {
|
|
|
11161
11458
|
reference: e
|
|
11162
11459
|
};
|
|
11163
11460
|
}
|
|
11164
|
-
function
|
|
11461
|
+
function Oh(e) {
|
|
11165
11462
|
let t = e.indices?.[0]?.[0] ?? e.index, n = /« ?(.*?) ?»/dg, r = [], i;
|
|
11166
11463
|
for (; (i = n.exec(e[0])) !== null;) {
|
|
11167
11464
|
let e = i.indices?.[1], n = i.indices?.[0];
|
|
@@ -11177,21 +11474,21 @@ function fh(e) {
|
|
|
11177
11474
|
}
|
|
11178
11475
|
return r;
|
|
11179
11476
|
}
|
|
11180
|
-
var
|
|
11181
|
-
C(`${
|
|
11477
|
+
var kh = x([
|
|
11478
|
+
C(`${Th}s?`, { flags: "i" }),
|
|
11182
11479
|
C(" ?: ?"),
|
|
11183
11480
|
$
|
|
11184
|
-
], { value: (e) => e[2] }),
|
|
11185
|
-
C(`${
|
|
11481
|
+
], { value: (e) => e[2] }), Ah = x([
|
|
11482
|
+
C(`${Eh}s?(?: suivant(?:e)?s?)?`, { flags: "i" }),
|
|
11186
11483
|
C(" ?: ?"),
|
|
11187
11484
|
$
|
|
11188
|
-
], { value: (e) => e[2] }),
|
|
11485
|
+
], { value: (e) => e[2] }), jh = x([
|
|
11189
11486
|
b,
|
|
11190
|
-
|
|
11487
|
+
kh,
|
|
11191
11488
|
S,
|
|
11192
11489
|
T(C("est remplacée? par", { flags: "i" }), C("sont remplacée?s par", { flags: "i" })),
|
|
11193
11490
|
S,
|
|
11194
|
-
|
|
11491
|
+
Ah
|
|
11195
11492
|
], { value: (e) => ({
|
|
11196
11493
|
action: {
|
|
11197
11494
|
action: "remplacer",
|
|
@@ -11202,9 +11499,9 @@ var ph = x([
|
|
|
11202
11499
|
replacementCitation: e[5],
|
|
11203
11500
|
targetCitation: e[1]
|
|
11204
11501
|
}
|
|
11205
|
-
}) }),
|
|
11502
|
+
}) }), Mh = T(C(`(?:, ?| )(?:${Th}s? ?: ?« ?[^»]+ ?»(?: ?(?:,|et) ?)*)+(?:est|sont) (?:supprimée?s?|abrogée?s?)`, {
|
|
11206
11503
|
flags: "di",
|
|
11207
|
-
value: (e) =>
|
|
11504
|
+
value: (e) => Oh(e).map((e) => ({
|
|
11208
11505
|
action: {
|
|
11209
11506
|
action: "supprimer",
|
|
11210
11507
|
actionInContent: !0
|
|
@@ -11216,8 +11513,8 @@ var ph = x([
|
|
|
11216
11513
|
}))
|
|
11217
11514
|
}), x([
|
|
11218
11515
|
b,
|
|
11219
|
-
|
|
11220
|
-
_([C("(?:, ?| et )"),
|
|
11516
|
+
kh,
|
|
11517
|
+
_([C("(?:, ?| et )"), kh], { value: (e) => e.map((e) => e[1]) }),
|
|
11221
11518
|
S,
|
|
11222
11519
|
T(C("est supprimée?", { flags: "i" }), C("sont supprimée?s", { flags: "i" }), C("est abrogée?", { flags: "i" }), C("sont abrogée?s", { flags: "i" }))
|
|
11223
11520
|
], { value: (e) => [e[1], ...e[2] ?? []].map((e) => ({
|
|
@@ -11229,9 +11526,9 @@ var ph = x([
|
|
|
11229
11526
|
kind: "delete",
|
|
11230
11527
|
targetCitation: e
|
|
11231
11528
|
}
|
|
11232
|
-
})) })),
|
|
11529
|
+
})) })), Nh = T(x([
|
|
11233
11530
|
b,
|
|
11234
|
-
|
|
11531
|
+
Rm,
|
|
11235
11532
|
S,
|
|
11236
11533
|
C("(?:la référence|la mention|le mot|les mots|le signe)", { flags: "i" }),
|
|
11237
11534
|
C(" ?: ?"),
|
|
@@ -11247,10 +11544,10 @@ var ph = x([
|
|
|
11247
11544
|
},
|
|
11248
11545
|
operation: {
|
|
11249
11546
|
insertCitation: e[9],
|
|
11250
|
-
kind:
|
|
11547
|
+
kind: Bm(e[1]),
|
|
11251
11548
|
targetCitation: e[5]
|
|
11252
11549
|
}
|
|
11253
|
-
}) }),
|
|
11550
|
+
}) }), jh, Mh, x([
|
|
11254
11551
|
b,
|
|
11255
11552
|
T(C("est ainsi rédigée?", { flags: "i" }), C("sont ainsi rédigée?s", { flags: "i" }), C("est rédigée? (?:ainsi qu'il|comme) suit", { flags: "i" }), C("sont rédigée?s (?:ainsi qu'il|comme) suit", { flags: "i" })),
|
|
11256
11553
|
C(" ?: ?"),
|
|
@@ -11265,27 +11562,27 @@ var ph = x([
|
|
|
11265
11562
|
replacementCitation: e[3],
|
|
11266
11563
|
replacementKind: "text"
|
|
11267
11564
|
}
|
|
11268
|
-
}) })),
|
|
11565
|
+
}) })), Ph = T(Nh, x([C(" et"), Nh], { value: (e) => e[1] })), Fh = w(T(x([
|
|
11269
11566
|
S,
|
|
11270
11567
|
C("par", { flags: "i" }),
|
|
11271
11568
|
S,
|
|
11272
|
-
|
|
11569
|
+
Ah
|
|
11273
11570
|
], { value: (e) => ({
|
|
11274
11571
|
citation: e[3],
|
|
11275
11572
|
kind: "replace"
|
|
11276
|
-
}) }), x([S,
|
|
11573
|
+
}) }), x([S, Ah], { value: (e) => ({
|
|
11277
11574
|
citation: e[1],
|
|
11278
11575
|
kind: "insert"
|
|
11279
11576
|
}) })), { default: null });
|
|
11280
|
-
function
|
|
11577
|
+
function Ih(e) {
|
|
11281
11578
|
return typeof e == "object" && !!e && "action" in e && "operation" in e;
|
|
11282
11579
|
}
|
|
11283
|
-
function
|
|
11580
|
+
function Lh(e) {
|
|
11284
11581
|
let t = [];
|
|
11285
|
-
for (let n of e)
|
|
11582
|
+
for (let n of e) Ih(n) ? t.push(n) : Array.isArray(n) && t.push(...Lh(n));
|
|
11286
11583
|
return t;
|
|
11287
11584
|
}
|
|
11288
|
-
function
|
|
11585
|
+
function Rh(e, t) {
|
|
11289
11586
|
if (!e) return [];
|
|
11290
11587
|
let n = e.originalCitations ?? [];
|
|
11291
11588
|
if (e.action === "remplacer") {
|
|
@@ -11333,12 +11630,12 @@ function Sh(e, t) {
|
|
|
11333
11630
|
}
|
|
11334
11631
|
return [];
|
|
11335
11632
|
}
|
|
11336
|
-
var
|
|
11337
|
-
|
|
11338
|
-
|
|
11339
|
-
_(
|
|
11633
|
+
var zh = i("après|avant|remplacée?s?|supprimée?s?|abrogée?s?|ins[eé]r[eé]e?s?|ajout[eé]e?s?|rédigée?s?", x([
|
|
11634
|
+
Om,
|
|
11635
|
+
Fh,
|
|
11636
|
+
_(Ph, { value: (e) => Lh(e) })
|
|
11340
11637
|
], { value: (e, t) => {
|
|
11341
|
-
let { action: n, reference: r } =
|
|
11638
|
+
let { action: n, reference: r } = Dh(e[0]), i = [...Rh(n, e[1]), ...e[2] ?? []], a = n ?? i[0]?.action;
|
|
11342
11639
|
if (!(!a || i.length === 0)) return {
|
|
11343
11640
|
action: a,
|
|
11344
11641
|
operations: i.map(({ operation: e }) => e),
|
|
@@ -11346,7 +11643,7 @@ var Ch = i("après|avant|remplacée?s?|supprimée?s?|abrogée?s?|ins[eé]r[eé]e
|
|
|
11346
11643
|
reference: r,
|
|
11347
11644
|
type: "action_directive"
|
|
11348
11645
|
};
|
|
11349
|
-
} }), 200),
|
|
11646
|
+
} }), 200), Bh = x([
|
|
11350
11647
|
C("la\\s+fin\\s+de\\s+", { flags: "i" }),
|
|
11351
11648
|
w(C("(?:la\\s+|l['’]\\s*)", { flags: "i" }), { default: "" }),
|
|
11352
11649
|
T(C("phrase", {
|
|
@@ -11363,14 +11660,14 @@ var Ch = i("après|avant|remplacée?s?|supprimée?s?|abrogée?s?|ins[eé]r[eé]e
|
|
|
11363
11660
|
type: "tail_after_target",
|
|
11364
11661
|
unit: e[2]
|
|
11365
11662
|
}) });
|
|
11366
|
-
function
|
|
11663
|
+
function Vh(e) {
|
|
11367
11664
|
if (e.type === "phrase") return "phrase";
|
|
11368
11665
|
if (e.type === "alinéa") return "alinéa";
|
|
11369
11666
|
if (e.type === "article") return "article";
|
|
11370
|
-
if (e.type === "parent-enfant") return
|
|
11667
|
+
if (e.type === "parent-enfant") return Vh(e.child);
|
|
11371
11668
|
}
|
|
11372
|
-
function
|
|
11373
|
-
let t =
|
|
11669
|
+
function Hh(e) {
|
|
11670
|
+
let t = Wm(e);
|
|
11374
11671
|
if (!/\bla\s+fin\s+d/iu.test(t)) return null;
|
|
11375
11672
|
let n = /\bla\s+fin\s+(?:de\s+la|d['’]?une|du|de\s+l['’]?|des)\s*[^,;.]*\bphrase\b/u.test(t) ? "phrase" : /\bla\s+fin\s+(?:de\s+la|d['’]?un|du|de\s+l['’]?|des)\s*[^,;.]*\balinea\b/u.test(t) ? "alinéa" : /\bla\s+fin\s+(?:de\s+l['’]?|d['’]?)article\b/u.test(t) ? "article" : void 0;
|
|
11376
11673
|
return {
|
|
@@ -11380,10 +11677,10 @@ function Eh(e) {
|
|
|
11380
11677
|
}
|
|
11381
11678
|
//#endregion
|
|
11382
11679
|
//#region src/lib/text_parsers/action_occurrences.ts
|
|
11383
|
-
function
|
|
11680
|
+
function Uh(e) {
|
|
11384
11681
|
return e.replace(/\s+/gu, " ").trim().normalize("NFD").replace(/[\u0300-\u036f]/gu, "").replace(/[’‘]/gu, "'").toLowerCase();
|
|
11385
11682
|
}
|
|
11386
|
-
function
|
|
11683
|
+
function Wh(e, t) {
|
|
11387
11684
|
let n = e.slice(0, Math.max(0, t)), r = RegExp(`\\b(${we})\\s+occurrence\\b`, "giu"), i = null, a;
|
|
11388
11685
|
for (; (a = r.exec(n)) !== null;) {
|
|
11389
11686
|
let e = be(a[1] ?? "");
|
|
@@ -11391,37 +11688,37 @@ function Oh(e, t) {
|
|
|
11391
11688
|
}
|
|
11392
11689
|
return i;
|
|
11393
11690
|
}
|
|
11394
|
-
function
|
|
11395
|
-
let t =
|
|
11396
|
-
return /\b(?:derniere\s+occurrence|a\s+la\s+fin)\b/u.test(t) ? "last" :
|
|
11691
|
+
function Gh(e) {
|
|
11692
|
+
let t = Uh(e);
|
|
11693
|
+
return /\b(?:derniere\s+occurrence|a\s+la\s+fin)\b/u.test(t) ? "last" : Wh(e, e.length) ?? void 0;
|
|
11397
11694
|
}
|
|
11398
11695
|
//#endregion
|
|
11399
11696
|
//#region src/lib/extractors/action_directives.ts
|
|
11400
|
-
var
|
|
11401
|
-
function
|
|
11697
|
+
var Kh = "(?:(?:alinea|alineas|section|sous-section|paragraphe|sous-paragraphe|sous-sous-paragraphe|chapitre|titre|livre|partie)|(?:[ivxlcdm]+|[a-z]|\\d+\\s*°?)(?:\\s+(?:bis|ter|quater|quinquies|sexies|septies|octies|nonies|decies|undecies|duodecies))?)", qh = "(?:un|une|l['’]?|le|la)";
|
|
11698
|
+
function Jh(e) {
|
|
11402
11699
|
return /\b(?:les?|la|l['’]?)\s+(?:mots?|references?|mentions?|signes?|nombres?|montants?|taux|pourcentages?|dates?|annees?)\b/u.test(e);
|
|
11403
11700
|
}
|
|
11404
|
-
function
|
|
11701
|
+
function Yh(e) {
|
|
11405
11702
|
return /\b(?:une|la|les?)\s+phrases?\b/u.test(e);
|
|
11406
11703
|
}
|
|
11407
|
-
function
|
|
11408
|
-
return new RegExp(String.raw`\b(?:insere(?:e|es|s)?|ajoute(?:e|es|s)?|complete(?:e|es|s)?|retabli(?:e|es|s)?)\b[\s\S]{0,90}\b${
|
|
11704
|
+
function Xh(e) {
|
|
11705
|
+
return new RegExp(String.raw`\b(?:insere(?:e|es|s)?|ajoute(?:e|es|s)?|complete(?:e|es|s)?|retabli(?:e|es|s)?)\b[\s\S]{0,90}\b${qh}\s+${Kh}\b`, "u").test(e) ? !0 : new RegExp(String.raw`\b${qh}\s+${Kh}\b[\s\S]{0,90}\b(?:est|sont)\s+(?:ainsi\s+)?(?:insere(?:e|es|s)?|ajoute(?:e|es|s)?|complete(?:e|es|s)?|retabli(?:e|es|s)?)\b`, "u").test(e);
|
|
11409
11706
|
}
|
|
11410
|
-
function
|
|
11411
|
-
if (!
|
|
11707
|
+
function Zh({ hasRedactionIntro: e, insertText: t, normalized: n }) {
|
|
11708
|
+
if (!Jh(n) && !Yh(n) && (Xh(n) && /\balinea\b/u.test(n) || e && yp(t))) return "block";
|
|
11412
11709
|
}
|
|
11413
|
-
function
|
|
11414
|
-
if (!
|
|
11710
|
+
function Qh({ hasRedactionIntro: e, normalized: t, replacementText: n }) {
|
|
11711
|
+
if (!Yh(t) && (e && /\balineas?\b/u.test(t) || e && yp(n))) return "block";
|
|
11415
11712
|
}
|
|
11416
|
-
function
|
|
11713
|
+
function $h(e) {
|
|
11417
11714
|
let t = bp(e);
|
|
11418
11715
|
return t ? t.restText : e;
|
|
11419
11716
|
}
|
|
11420
|
-
function
|
|
11421
|
-
let t =
|
|
11717
|
+
function eg(e) {
|
|
11718
|
+
let t = $h(e);
|
|
11422
11719
|
return t === e ? e.replace(gp, "") : t;
|
|
11423
11720
|
}
|
|
11424
|
-
function
|
|
11721
|
+
function tg(e) {
|
|
11425
11722
|
let t = e.split("\n"), n = [], r = 0;
|
|
11426
11723
|
for (let e of t) {
|
|
11427
11724
|
let t = r, i = t + e.length;
|
|
@@ -11433,10 +11730,10 @@ function zh(e) {
|
|
|
11433
11730
|
}
|
|
11434
11731
|
return n;
|
|
11435
11732
|
}
|
|
11436
|
-
function
|
|
11733
|
+
function ng(e) {
|
|
11437
11734
|
return bp(e) !== void 0 || gp.test(e);
|
|
11438
11735
|
}
|
|
11439
|
-
function
|
|
11736
|
+
function rg(e) {
|
|
11440
11737
|
if (gp.test(e)) return {
|
|
11441
11738
|
marker: "-",
|
|
11442
11739
|
level: 5
|
|
@@ -11444,87 +11741,87 @@ function Vh(e) {
|
|
|
11444
11741
|
let t = bp(e);
|
|
11445
11742
|
return t ? {
|
|
11446
11743
|
marker: t.token,
|
|
11447
|
-
level:
|
|
11744
|
+
level: ig(t.token)
|
|
11448
11745
|
} : null;
|
|
11449
11746
|
}
|
|
11450
|
-
function
|
|
11747
|
+
function ig(e) {
|
|
11451
11748
|
let t = e.trim().split(/\s+/u)[0]?.replace(/[^\p{L}\p{N}]+/gu, "") ?? "";
|
|
11452
11749
|
return /^\d+$/u.test(t) ? 2 : /^[ivxlcdm]+$/u.test(t) && (t.length > 1 || /^[ivx]$/u.test(t)) ? 4 : /^[a-z]$/u.test(t) ? 3 : vp(t) || /^[A-Z]$/u.test(t) ? 1 : 2;
|
|
11453
11750
|
}
|
|
11454
|
-
function
|
|
11751
|
+
function ag(e) {
|
|
11455
11752
|
let t = [], n = e;
|
|
11456
11753
|
for (;;) {
|
|
11457
|
-
let e =
|
|
11754
|
+
let e = rg(n);
|
|
11458
11755
|
if (!e) return t;
|
|
11459
11756
|
t.push(e.marker);
|
|
11460
|
-
let r =
|
|
11757
|
+
let r = eg(n);
|
|
11461
11758
|
if (r === n) return t;
|
|
11462
11759
|
n = r.trimStart();
|
|
11463
11760
|
}
|
|
11464
11761
|
}
|
|
11465
|
-
function
|
|
11466
|
-
let t =
|
|
11762
|
+
function og(e) {
|
|
11763
|
+
let t = Wm(_h(e, gh(e)));
|
|
11467
11764
|
return /(?:^|[;:.]\s*)(?:(?:il\s+)?est|sont)\s+(?:inseree?s?|ajoutee?s?)\s+(?:la\s+reference|la\s+mention|les\s+mots|le\s+mot|le\s+signe|les\s+references)?\s*:/.exec(t)?.index ?? null;
|
|
11468
11765
|
}
|
|
11469
|
-
function
|
|
11470
|
-
let t =
|
|
11766
|
+
function sg(e) {
|
|
11767
|
+
let t = og(e);
|
|
11471
11768
|
if (t !== null) return t;
|
|
11472
11769
|
for (let t = 0; t < e.length; t += 1) {
|
|
11473
11770
|
let r = new n(e.slice(t));
|
|
11474
|
-
if (
|
|
11771
|
+
if (_m(r) && r.offset > 0) return t;
|
|
11475
11772
|
}
|
|
11476
11773
|
return null;
|
|
11477
11774
|
}
|
|
11478
|
-
function
|
|
11775
|
+
function cg(e) {
|
|
11479
11776
|
return e.type === "reference_et_action" ? e.reference : e;
|
|
11480
11777
|
}
|
|
11481
|
-
function
|
|
11482
|
-
return
|
|
11778
|
+
function lg(e) {
|
|
11779
|
+
return Fm(new n(e)).map(cg).find((e) => bt(e) === "article") || (__(e)?.reference ?? null);
|
|
11483
11780
|
}
|
|
11484
|
-
function
|
|
11485
|
-
let t =
|
|
11781
|
+
function ug(e) {
|
|
11782
|
+
let t = sg(e) ?? e.length, r = vh(e), i = Fm(new n(e)), a = i.flatMap((e) => Array.from(O(cg(e)))).filter((e) => e.type === "article" && e.position).map((e) => ({
|
|
11486
11783
|
start: e.position.start,
|
|
11487
11784
|
end: e.position.stop
|
|
11488
|
-
})), o = i.map(
|
|
11489
|
-
return u ?
|
|
11785
|
+
})), o = i.map(cg).filter((e) => !bh(e.position, r) && !yh(e.position, a) && bt(e) !== "article" && (e.position?.start ?? 0) < t).sort((e, t) => (e.position?.start ?? 0) - (t.position?.start ?? 0)), s = e.slice(0, t).trimEnd(), c = ch(t_(s), 0) ?? ch(s, 0) ?? ch(s.replace(/\b(?:est|sont)\s*$/iu, "").trimEnd(), 0), l = c && !yh(c.position, a) ? c : null, u = o[0];
|
|
11786
|
+
return u ? dh(u, l) : l;
|
|
11490
11787
|
}
|
|
11491
|
-
function
|
|
11492
|
-
let t =
|
|
11788
|
+
function dg(e) {
|
|
11789
|
+
let t = sg(e) ?? e.length, r = vh(e), i = Fm(new n(e)).map(cg).filter((e) => !bh(e.position, r) && (e.position?.start ?? 0) < t).sort((e, t) => (e.position?.start ?? 0) - (t.position?.start ?? 0));
|
|
11493
11790
|
return i.length === 0 ? null : i.find((e) => bt(e) !== "article") ?? null ?? i[0] ?? null;
|
|
11494
11791
|
}
|
|
11495
|
-
function
|
|
11496
|
-
let t = [e,
|
|
11792
|
+
function fg(e) {
|
|
11793
|
+
let t = [e, $h(e)].map((e) => e.trim()).filter((e, t, n) => e && n.indexOf(e) === t);
|
|
11497
11794
|
for (let e of t) {
|
|
11498
|
-
let t =
|
|
11795
|
+
let t = sg(e) ?? e.length, n = ch(e, 0) ?? ph(e, { actionIndex: t }) ?? dg(e) ?? lg(e);
|
|
11499
11796
|
if (n) return n;
|
|
11500
11797
|
}
|
|
11501
11798
|
return null;
|
|
11502
11799
|
}
|
|
11503
|
-
function
|
|
11800
|
+
function pg(e) {
|
|
11504
11801
|
return e?.toLowerCase().replace(/[.)]/g, "").trim();
|
|
11505
11802
|
}
|
|
11506
|
-
function
|
|
11507
|
-
return !(e.type !== t.type || e.index !== void 0 && t.index !== void 0 && e.index !== t.index || e.num !== void 0 && t.num !== void 0 &&
|
|
11803
|
+
function mg(e, t) {
|
|
11804
|
+
return !(e.type !== t.type || e.index !== void 0 && t.index !== void 0 && e.index !== t.index || e.num !== void 0 && t.num !== void 0 && pg(e.num) !== pg(t.num));
|
|
11508
11805
|
}
|
|
11509
|
-
function
|
|
11806
|
+
function hg(e) {
|
|
11510
11807
|
let t = null;
|
|
11511
11808
|
for (let n of O(e)) t = n;
|
|
11512
11809
|
return t;
|
|
11513
11810
|
}
|
|
11514
|
-
function
|
|
11515
|
-
return t && e.type === "parent-enfant" &&
|
|
11811
|
+
function gg(e, t) {
|
|
11812
|
+
return t && e.type === "parent-enfant" && mg(e.parent, t) ? e.child : e;
|
|
11516
11813
|
}
|
|
11517
|
-
function
|
|
11814
|
+
function _g(e, t) {
|
|
11518
11815
|
let n = null;
|
|
11519
11816
|
for (let r of O(e)) r.type === t && r.relative === void 0 && (r.index === void 0 && r.num === void 0 || (n = r));
|
|
11520
11817
|
return n;
|
|
11521
11818
|
}
|
|
11522
|
-
function
|
|
11819
|
+
function vg(e, t) {
|
|
11523
11820
|
if (!t) return e;
|
|
11524
11821
|
let n = structuredClone(e), r = (e) => {
|
|
11525
11822
|
if (e.type !== "parent-enfant" && e.type !== "bounded-interval" && e.type !== "counted-interval" && e.type !== "enumeration" && e.type !== "exclusion" && e.type !== "reference_et_action") {
|
|
11526
11823
|
if (e.relative === 0) {
|
|
11527
|
-
let n =
|
|
11824
|
+
let n = _g(t, e.type);
|
|
11528
11825
|
n && (e.index = n.index, e.num = n.num, delete e.relative);
|
|
11529
11826
|
}
|
|
11530
11827
|
return;
|
|
@@ -11550,7 +11847,7 @@ function ng(e, t) {
|
|
|
11550
11847
|
};
|
|
11551
11848
|
return r(n), n;
|
|
11552
11849
|
}
|
|
11553
|
-
function
|
|
11850
|
+
function yg(e) {
|
|
11554
11851
|
let t = (e) => {
|
|
11555
11852
|
if (e.type !== "parent-enfant" && e.type !== "bounded-interval" && e.type !== "counted-interval" && e.type !== "enumeration" && e.type !== "exclusion" && e.type !== "reference_et_action") return e.relative !== void 0;
|
|
11556
11853
|
switch (e.type) {
|
|
@@ -11564,14 +11861,14 @@ function rg(e) {
|
|
|
11564
11861
|
};
|
|
11565
11862
|
return t(e);
|
|
11566
11863
|
}
|
|
11567
|
-
function
|
|
11864
|
+
function bg(e) {
|
|
11568
11865
|
let t = [], n = [];
|
|
11569
11866
|
for (let r of e) {
|
|
11570
|
-
if (!
|
|
11867
|
+
if (!ng(r.text)) {
|
|
11571
11868
|
n[n.length - 1]?.body.push(r);
|
|
11572
11869
|
continue;
|
|
11573
11870
|
}
|
|
11574
|
-
let e =
|
|
11871
|
+
let e = rg(r.text), i = e?.level ?? 0, a = {
|
|
11575
11872
|
body: [],
|
|
11576
11873
|
children: [],
|
|
11577
11874
|
level: i,
|
|
@@ -11583,13 +11880,13 @@ function ig(e) {
|
|
|
11583
11880
|
}
|
|
11584
11881
|
return t;
|
|
11585
11882
|
}
|
|
11586
|
-
function
|
|
11883
|
+
function xg(e, t) {
|
|
11587
11884
|
if (!e) return t;
|
|
11588
11885
|
if (!t) return e;
|
|
11589
|
-
let n =
|
|
11886
|
+
let n = gg(t, hg(e));
|
|
11590
11887
|
return n.type === "article" || bt(n), mt(e, n);
|
|
11591
11888
|
}
|
|
11592
|
-
function
|
|
11889
|
+
function Sg(e, t) {
|
|
11593
11890
|
return {
|
|
11594
11891
|
...mt(e, t),
|
|
11595
11892
|
position: {
|
|
@@ -11598,16 +11895,16 @@ function og(e, t) {
|
|
|
11598
11895
|
}
|
|
11599
11896
|
};
|
|
11600
11897
|
}
|
|
11601
|
-
function
|
|
11602
|
-
return [
|
|
11898
|
+
function Cg(e) {
|
|
11899
|
+
return [eg(e.line.text), ...e.body.map((e) => e.text)].join("\n").trim();
|
|
11603
11900
|
}
|
|
11604
|
-
function
|
|
11901
|
+
function wg(e) {
|
|
11605
11902
|
return e.body[e.body.length - 1]?.end ?? e.line.end;
|
|
11606
11903
|
}
|
|
11607
|
-
function
|
|
11904
|
+
function Tg(e) {
|
|
11608
11905
|
return (e ?? "").replace(/°/gu, "").replace(/\s+/gu, " ").trim();
|
|
11609
11906
|
}
|
|
11610
|
-
function
|
|
11907
|
+
function Eg(e, t) {
|
|
11611
11908
|
let r = new n(e, t), i = te(r);
|
|
11612
11909
|
return typeof i == "string" && r.offset > t ? {
|
|
11613
11910
|
date: i,
|
|
@@ -11615,14 +11912,14 @@ function ug(e, t) {
|
|
|
11615
11912
|
stop: r.offset
|
|
11616
11913
|
} : null;
|
|
11617
11914
|
}
|
|
11618
|
-
function
|
|
11619
|
-
let t =
|
|
11915
|
+
function Dg(e) {
|
|
11916
|
+
let t = vh(e), n = [];
|
|
11620
11917
|
for (let r = 0; r < e.length; r += 1) {
|
|
11621
11918
|
let i = e[r];
|
|
11622
11919
|
if (i === void 0 || !/\d/u.test(i)) continue;
|
|
11623
|
-
let a =
|
|
11920
|
+
let a = Eg(e, r);
|
|
11624
11921
|
if (a) {
|
|
11625
|
-
if (
|
|
11922
|
+
if (yh(a, t)) {
|
|
11626
11923
|
r = Math.max(r, a.stop - 1);
|
|
11627
11924
|
continue;
|
|
11628
11925
|
}
|
|
@@ -11631,25 +11928,25 @@ function dg(e) {
|
|
|
11631
11928
|
}
|
|
11632
11929
|
return n;
|
|
11633
11930
|
}
|
|
11634
|
-
function
|
|
11635
|
-
return
|
|
11931
|
+
function Og(e) {
|
|
11932
|
+
return Wm(e).replace(/\s+/gu, " ");
|
|
11636
11933
|
}
|
|
11637
|
-
function
|
|
11638
|
-
let t =
|
|
11934
|
+
function kg(e) {
|
|
11935
|
+
let t = Og(e), n = /\b(?:entr(?:e|ent|era|eront)\s+en\s+vigueur|s['’]?\s*appli(?:que|quent)|est\s+applicable|sont\s+applicables?|applicables?)\b/giu, r = null, i;
|
|
11639
11936
|
for (; (i = n.exec(t)) !== null;) r = i;
|
|
11640
11937
|
return r;
|
|
11641
11938
|
}
|
|
11642
|
-
function
|
|
11643
|
-
let n =
|
|
11644
|
-
return !!(/\bau\s*$/u.test(n) && r.startsWith(",") || /\ba compter\s+(?:du|de la|de l['’]?|des)?\s*$/u.test(n) || /\babroge(?:e|es|s)?\s+a compter\s+(?:du|de la|de l['’]?|des)?\s*$/u.test(n) ||
|
|
11939
|
+
function Ag(e, t) {
|
|
11940
|
+
let n = Og(e.slice(0, t.start)), r = Og(e.slice(t.stop));
|
|
11941
|
+
return !!(/\bau\s*$/u.test(n) && r.startsWith(",") || /\ba compter\s+(?:du|de la|de l['’]?|des)?\s*$/u.test(n) || /\babroge(?:e|es|s)?\s+a compter\s+(?:du|de la|de l['’]?|des)?\s*$/u.test(n) || kg(e.slice(0, t.start)));
|
|
11645
11942
|
}
|
|
11646
|
-
function
|
|
11647
|
-
return
|
|
11943
|
+
function jg(e) {
|
|
11944
|
+
return Dg(e).find((t) => Ag(e, t))?.date;
|
|
11648
11945
|
}
|
|
11649
|
-
function
|
|
11650
|
-
return e.map((e) =>
|
|
11946
|
+
function Mg(e) {
|
|
11947
|
+
return e.map((e) => Tg(e.num)).filter((e) => e.length > 0);
|
|
11651
11948
|
}
|
|
11652
|
-
function
|
|
11949
|
+
function Ng(e, t) {
|
|
11653
11950
|
let n = e.at(-1), r = t.at(-1);
|
|
11654
11951
|
if (!n || !r) return [e, t];
|
|
11655
11952
|
let i = e.slice(0, -1), a = t.slice(0, -1);
|
|
@@ -11660,51 +11957,51 @@ function _g(e, t) {
|
|
|
11660
11957
|
for (let e = o; e <= s; e += 1) c.push([...i, String(e)]);
|
|
11661
11958
|
return c;
|
|
11662
11959
|
}
|
|
11663
|
-
function
|
|
11960
|
+
function Pg(e) {
|
|
11664
11961
|
if (e.kind === "single") {
|
|
11665
|
-
let t =
|
|
11962
|
+
let t = Mg(e.steps);
|
|
11666
11963
|
return t.length > 0 ? [t] : [];
|
|
11667
11964
|
}
|
|
11668
|
-
let t =
|
|
11669
|
-
return t.length === 0 && n.length === 0 ? [] :
|
|
11965
|
+
let t = Mg(e.first), n = Mg(e.last);
|
|
11966
|
+
return t.length === 0 && n.length === 0 ? [] : Ng(t, n);
|
|
11670
11967
|
}
|
|
11671
|
-
function
|
|
11672
|
-
let t =
|
|
11673
|
-
for (let e of t.map(
|
|
11968
|
+
function Fg(e) {
|
|
11969
|
+
let t = Fm(new n(e)), r = [];
|
|
11970
|
+
for (let e of t.map(cg)) {
|
|
11674
11971
|
if (e.type === "article" && e.present) {
|
|
11675
11972
|
r.push([]);
|
|
11676
11973
|
continue;
|
|
11677
11974
|
}
|
|
11678
|
-
for (let t of Rp(e)) r.push(...
|
|
11975
|
+
for (let t of Rp(e)) r.push(...Pg(t));
|
|
11679
11976
|
}
|
|
11680
11977
|
return r.filter((e, t, n) => n.findIndex((t) => t.join("\0") === e.join("\0")) === t);
|
|
11681
11978
|
}
|
|
11682
|
-
function
|
|
11979
|
+
function Ig(e) {
|
|
11683
11980
|
let t = [], n = e.split(/(?<=[.;])\s+/u).map((e) => e.trim()).filter(Boolean);
|
|
11684
|
-
for (let e of n) for (let n of
|
|
11685
|
-
if (!
|
|
11686
|
-
let r =
|
|
11981
|
+
for (let e of n) for (let n of Dg(e)) {
|
|
11982
|
+
if (!Ag(e, n)) continue;
|
|
11983
|
+
let r = kg(e.slice(0, n.start));
|
|
11687
11984
|
if (!r) continue;
|
|
11688
|
-
let i =
|
|
11985
|
+
let i = Fg(e.slice(0, r.index).trim());
|
|
11689
11986
|
if (i.length === 0) continue;
|
|
11690
11987
|
t.push({
|
|
11691
11988
|
date: n.date,
|
|
11692
11989
|
paths: i
|
|
11693
11990
|
});
|
|
11694
|
-
let a =
|
|
11991
|
+
let a = Lg(e.slice(n.stop), i);
|
|
11695
11992
|
t.push(...a);
|
|
11696
11993
|
}
|
|
11697
11994
|
return t;
|
|
11698
11995
|
}
|
|
11699
|
-
function
|
|
11996
|
+
function Lg(e, t) {
|
|
11700
11997
|
let n = /(?:^|[^\p{L}\p{N}_])(?:a|à)\s+l['’]exception\s+(.+?)(?:\bqui\b|\bentr(?:e|ent|era|eront)\s+en\s+vigueur\b)/iu.exec(e);
|
|
11701
11998
|
if (!n) return [];
|
|
11702
11999
|
let r = n.index + n[0].length, i = n[1]?.trim();
|
|
11703
12000
|
if (!i) return [];
|
|
11704
|
-
let a =
|
|
12001
|
+
let a = Fg(i);
|
|
11705
12002
|
if (a.length === 0) return [];
|
|
11706
12003
|
let o = [];
|
|
11707
|
-
for (let n of
|
|
12004
|
+
for (let n of Dg(e.slice(r))) {
|
|
11708
12005
|
let e = n.date;
|
|
11709
12006
|
o.push({
|
|
11710
12007
|
date: e,
|
|
@@ -11715,44 +12012,44 @@ function xg(e, t) {
|
|
|
11715
12012
|
}
|
|
11716
12013
|
return o;
|
|
11717
12014
|
}
|
|
11718
|
-
function
|
|
12015
|
+
function Rg(e, t, n) {
|
|
11719
12016
|
return [
|
|
11720
12017
|
...e,
|
|
11721
|
-
|
|
11722
|
-
...
|
|
12018
|
+
Tg(t.marker),
|
|
12019
|
+
...ag(n).map(Tg)
|
|
11723
12020
|
].filter((e) => e.length > 0);
|
|
11724
12021
|
}
|
|
11725
|
-
function
|
|
12022
|
+
function zg(e) {
|
|
11726
12023
|
let t = [];
|
|
11727
|
-
for (let n of e) t.push(...
|
|
12024
|
+
for (let n of e) t.push(...Ig(Cg(n))), t.push(...zg(n.children));
|
|
11728
12025
|
return t;
|
|
11729
12026
|
}
|
|
11730
|
-
function
|
|
12027
|
+
function Bg(e, t) {
|
|
11731
12028
|
return t.length > e.length ? !1 : t.every((t, n) => e[n] === t);
|
|
11732
12029
|
}
|
|
11733
|
-
function
|
|
12030
|
+
function Vg(e, t) {
|
|
11734
12031
|
if (t.length > e.length) return !1;
|
|
11735
12032
|
let n = e.length - t.length;
|
|
11736
12033
|
return t.every((t, r) => e[n + r] === t);
|
|
11737
12034
|
}
|
|
11738
|
-
function
|
|
11739
|
-
return n ? n.some((n) =>
|
|
12035
|
+
function Hg(e, t, n) {
|
|
12036
|
+
return n ? n.some((n) => Hg(e, n) ? Hg(e, Bg(e, n) ? [...n, ...t] : t) : !1) : t.length === 0 ? !0 : Bg(e, t) || Vg(e, t);
|
|
11740
12037
|
}
|
|
11741
|
-
function
|
|
12038
|
+
function Ug(e, t, n) {
|
|
11742
12039
|
if (e.length === 0 || n.length === 0) return;
|
|
11743
12040
|
let r = new Map(t.map((e) => [e.directive, e.sourcePath]));
|
|
11744
12041
|
for (let t of e) {
|
|
11745
12042
|
if (t.applicabilityDate) continue;
|
|
11746
12043
|
let e = r.get(t) ?? [], i, a = -1;
|
|
11747
12044
|
for (let t of n) for (let n of t.paths) {
|
|
11748
|
-
if (!
|
|
12045
|
+
if (!Hg(e, n, t.parentPaths)) continue;
|
|
11749
12046
|
let r = n.length + Math.max(0, ...t.parentPaths?.map((e) => e.length) ?? [0]);
|
|
11750
12047
|
r > a && (i = t.date, a = r);
|
|
11751
12048
|
}
|
|
11752
12049
|
i && (t.applicabilityDate = i);
|
|
11753
12050
|
}
|
|
11754
12051
|
}
|
|
11755
|
-
function
|
|
12052
|
+
function Wg(e, t) {
|
|
11756
12053
|
if (!e) return t;
|
|
11757
12054
|
if (!t) return e;
|
|
11758
12055
|
let n = t.rowIndex ?? e.rowIndex, r = t.columnIndex ?? e.columnIndex;
|
|
@@ -11762,39 +12059,39 @@ function Og(e, t) {
|
|
|
11762
12059
|
...r ? { columnIndex: r } : {}
|
|
11763
12060
|
};
|
|
11764
12061
|
}
|
|
11765
|
-
function
|
|
12062
|
+
function Gg(e) {
|
|
11766
12063
|
return e !== void 0 && (e.rowIndex !== void 0 || e.columnIndex !== void 0);
|
|
11767
12064
|
}
|
|
11768
|
-
function
|
|
12065
|
+
function Kg(e, t, n, r, i = [], a = []) {
|
|
11769
12066
|
let o = [], s = t;
|
|
11770
12067
|
for (let c of e) {
|
|
11771
|
-
let e =
|
|
12068
|
+
let e = eg(c.line.text), l = Rg(i, c, e), u = Cg(c);
|
|
11772
12069
|
if (!u) continue;
|
|
11773
|
-
let d =
|
|
11774
|
-
if (
|
|
12070
|
+
let d = Wg(r, e_(u, r !== void 0)), f = fg(e), p = xg(t, f);
|
|
12071
|
+
if (sg(u) === null) {
|
|
11775
12072
|
if (c.children.length > 0) {
|
|
11776
|
-
let e = p ?? t, r =
|
|
12073
|
+
let e = p ?? t, r = Kg(c.children, e, n, d, l, a);
|
|
11777
12074
|
r.length > 0 && (o.push(...r), s = r[r.length - 1]?.reference ?? s);
|
|
11778
12075
|
continue;
|
|
11779
12076
|
}
|
|
11780
12077
|
s = p ?? s;
|
|
11781
12078
|
continue;
|
|
11782
12079
|
}
|
|
11783
|
-
let m =
|
|
12080
|
+
let m = lg(u), h = xg(t, ug(u) ?? m ?? f) ?? m ?? p;
|
|
11784
12081
|
if (!h) {
|
|
11785
12082
|
if (c.children.length > 0) {
|
|
11786
|
-
let e =
|
|
12083
|
+
let e = Kg(c.children, p ?? t, n, d, l, a);
|
|
11787
12084
|
o.push(...e);
|
|
11788
12085
|
}
|
|
11789
12086
|
continue;
|
|
11790
12087
|
}
|
|
11791
|
-
h =
|
|
11792
|
-
let g =
|
|
12088
|
+
h = vg(h, yg(h) ? s ?? t : t);
|
|
12089
|
+
let g = g_({
|
|
11793
12090
|
action: { action: "modifier" },
|
|
11794
12091
|
reference: h,
|
|
11795
12092
|
sourcePosition: {
|
|
11796
12093
|
start: c.line.start,
|
|
11797
|
-
stop:
|
|
12094
|
+
stop: wg(c)
|
|
11798
12095
|
},
|
|
11799
12096
|
sourceText: u,
|
|
11800
12097
|
fullText: n,
|
|
@@ -11802,7 +12099,7 @@ function Ag(e, t, n, r, i = [], a = []) {
|
|
|
11802
12099
|
});
|
|
11803
12100
|
if (!g) {
|
|
11804
12101
|
if (s = h, c.children.length > 0) {
|
|
11805
|
-
let e =
|
|
12102
|
+
let e = Kg(c.children, p ?? h, n, d, l, a);
|
|
11806
12103
|
o.push(...e), s = e[e.length - 1]?.reference ?? s;
|
|
11807
12104
|
}
|
|
11808
12105
|
continue;
|
|
@@ -11818,19 +12115,19 @@ function Ag(e, t, n, r, i = [], a = []) {
|
|
|
11818
12115
|
sourcePath: l
|
|
11819
12116
|
});
|
|
11820
12117
|
if (s = h, c.children.length > 0) {
|
|
11821
|
-
let e =
|
|
12118
|
+
let e = Kg(c.children, p ?? h, n, d, l, a);
|
|
11822
12119
|
e.length > 0 && (o.push(...e), s = e[e.length - 1]?.reference ?? s);
|
|
11823
12120
|
}
|
|
11824
12121
|
}
|
|
11825
|
-
return
|
|
12122
|
+
return h_(o);
|
|
11826
12123
|
}
|
|
11827
|
-
function
|
|
11828
|
-
let t =
|
|
12124
|
+
function qg(e) {
|
|
12125
|
+
let t = tg(e), n = t.findIndex((e) => ng(e.text));
|
|
11829
12126
|
if (n === -1) return null;
|
|
11830
|
-
let r = t.slice(0, n).reverse().map((e) =>
|
|
11831
|
-
return
|
|
12127
|
+
let r = t.slice(0, n).reverse().map((e) => fg(e.text)).find((e) => e !== null) ?? null, i = bg(t.slice(n)), a = [], o = Kg(i, r, e, void 0, [], a);
|
|
12128
|
+
return Ug(o, a, zg(i)), o.length > 0 ? o : null;
|
|
11832
12129
|
}
|
|
11833
|
-
function
|
|
12130
|
+
function Jg(e, t) {
|
|
11834
12131
|
let n = e.indexOf("«");
|
|
11835
12132
|
if (n === -1) return;
|
|
11836
12133
|
let r = e.indexOf("»", n + 1);
|
|
@@ -11845,36 +12142,36 @@ function Mg(e, t) {
|
|
|
11845
12142
|
}
|
|
11846
12143
|
};
|
|
11847
12144
|
}
|
|
11848
|
-
function
|
|
11849
|
-
let t =
|
|
12145
|
+
function Yg(e) {
|
|
12146
|
+
let t = Wm(e);
|
|
11850
12147
|
return /\btableau\b/.test(t) && /\b(?:tableau|celui)\s+(?:suivant|ainsi\s+redigee?|ainsi\s+rediges|ainsi\s+redigees)\b/.test(t);
|
|
11851
12148
|
}
|
|
11852
|
-
function
|
|
11853
|
-
for (let t of
|
|
11854
|
-
if (!
|
|
12149
|
+
function Xg(e) {
|
|
12150
|
+
for (let t of tg(e)) {
|
|
12151
|
+
if (!Yg(t.text)) continue;
|
|
11855
12152
|
let e = t.text.indexOf(":");
|
|
11856
12153
|
return e === -1 ? t.end : t.start + e + 1;
|
|
11857
12154
|
}
|
|
11858
12155
|
return null;
|
|
11859
12156
|
}
|
|
11860
|
-
function
|
|
11861
|
-
let n =
|
|
11862
|
-
return n === null ?
|
|
12157
|
+
function Zg(e, t) {
|
|
12158
|
+
let n = Xg(e);
|
|
12159
|
+
return n === null ? Jg(e, t) : Jg(e.slice(n), t + n);
|
|
11863
12160
|
}
|
|
11864
|
-
function
|
|
11865
|
-
return
|
|
12161
|
+
function Qg(e, t) {
|
|
12162
|
+
return Wh(e, t);
|
|
11866
12163
|
}
|
|
11867
|
-
function
|
|
12164
|
+
function $g(e, t) {
|
|
11868
12165
|
if (!Array.isArray(e) || e.length < 2 || t.length < e.length) return e;
|
|
11869
12166
|
let n = e[0];
|
|
11870
12167
|
return e.some((e) => JSON.stringify(e) !== JSON.stringify(n)) ? e : n;
|
|
11871
12168
|
}
|
|
11872
|
-
function
|
|
11873
|
-
let n =
|
|
12169
|
+
function e_(e, t = !1) {
|
|
12170
|
+
let n = _h(e, gh(e)), r = Wm(n), i = /\btableau\b/.test(r);
|
|
11874
12171
|
if (!i && !t) return;
|
|
11875
12172
|
let a = (e) => {
|
|
11876
12173
|
if (!e) return;
|
|
11877
|
-
let t = e.replace(/^(?:a|à)\s+la\s+/iu, "").trim(), n =
|
|
12174
|
+
let t = e.replace(/^(?:a|à)\s+la\s+/iu, "").trim(), n = Wm(t);
|
|
11878
12175
|
if (/^derni(?:er|ere)s?\b/u.test(n)) return -1;
|
|
11879
12176
|
let r = be(t);
|
|
11880
12177
|
return r && r > 0 ? r : void 0;
|
|
@@ -11895,30 +12192,30 @@ function Rg(e, t = !1) {
|
|
|
11895
12192
|
let l = /\bla\s+(.+?)\s+ligne\b/iu.exec(n), u = /\bla\s+(.+?)\s+colonne\b/iu.exec(n);
|
|
11896
12193
|
return o(a(l?.[1]), a(u?.[1])) || (i ? { type: "table" } : void 0);
|
|
11897
12194
|
}
|
|
11898
|
-
function
|
|
12195
|
+
function t_(e) {
|
|
11899
12196
|
return e.replace(/(?:[,;:]\s*)?(?:(?:le|la|les|l['’])\s+)?(?:année|date|dispositions?|mention|montant|mot|mots|nombre|nombres|pourcentage|référence|références|signe|taux|texte|phrase|phrases|tableau)(?:\s+[^,;:]*)?\s*:?\s*$/iu, "").trimEnd();
|
|
11900
12197
|
}
|
|
11901
|
-
function
|
|
12198
|
+
function n_(e) {
|
|
11902
12199
|
return e.replace(/(?:[,;:]\s*)?(?:(?:le|la|les|l['’])\s+)?(?:année|date|dispositions?|mention|montant|mot|mots|nombre|nombres|pourcentage|référence|références|signe|taux|texte|tableau)(?:\s+[^,;:]*)?\s*:?\s*$/iu, "").trimEnd();
|
|
11903
12200
|
}
|
|
11904
|
-
var
|
|
11905
|
-
|
|
11906
|
-
|
|
11907
|
-
|
|
12201
|
+
var r_ = [
|
|
12202
|
+
i_("(?:la\\s+date\\s+d(?:u|e|[’']))"),
|
|
12203
|
+
i_("(?:le\\s+montant\\s+d(?:e|[’']))"),
|
|
12204
|
+
i_("(?:la\\s+référence\\s+à)")
|
|
11908
12205
|
];
|
|
11909
|
-
function
|
|
12206
|
+
function i_(e) {
|
|
11910
12207
|
return new RegExp(String.raw`(?:^|[,;:]\s*)${e}\s+(?<target>.+?)\s+(?:est|sont)\s+remplac[eé]e?s?\s+par\s+${e}\s+(?<replacement>.+?)(?=\s*(?:[.;]|$))`, "iu");
|
|
11911
12208
|
}
|
|
11912
|
-
function
|
|
12209
|
+
function a_(e) {
|
|
11913
12210
|
return e.replace(/\s+/gu, " ").replace(/\s+([,;])/gu, "$1").trim();
|
|
11914
12211
|
}
|
|
11915
|
-
function
|
|
12212
|
+
function o_(e) {
|
|
11916
12213
|
if (e.includes("«") || e.includes("»")) return null;
|
|
11917
|
-
for (let t of
|
|
12214
|
+
for (let t of r_) {
|
|
11918
12215
|
let n = t.exec(e), r = n?.groups?.target, i = n?.groups?.replacement;
|
|
11919
12216
|
if (!(!r || !i)) return {
|
|
11920
|
-
targetText:
|
|
11921
|
-
replacementText:
|
|
12217
|
+
targetText: a_(r),
|
|
12218
|
+
replacementText: a_(i),
|
|
11922
12219
|
operandRange: {
|
|
11923
12220
|
start: n.index,
|
|
11924
12221
|
end: n.index + n[0].length
|
|
@@ -11927,16 +12224,16 @@ function Wg(e) {
|
|
|
11927
12224
|
}
|
|
11928
12225
|
return null;
|
|
11929
12226
|
}
|
|
11930
|
-
function
|
|
11931
|
-
let t =
|
|
12227
|
+
function s_(e) {
|
|
12228
|
+
let t = o_(e);
|
|
11932
12229
|
return t ? [t.operandRange] : [];
|
|
11933
12230
|
}
|
|
11934
|
-
function
|
|
11935
|
-
return
|
|
12231
|
+
function c_(e, t) {
|
|
12232
|
+
return yh(e.position, t) ? !0 : Array.from(O(cg(e))).some((e) => yh(e.position, t));
|
|
11936
12233
|
}
|
|
11937
|
-
function
|
|
11938
|
-
let a =
|
|
11939
|
-
let i =
|
|
12234
|
+
function l_(e, t, n, r, i) {
|
|
12235
|
+
let a = Wm(e), o = Wm(_h(e, r)), s = Gm(o, a), c = Km(o), l = qm(o), u = t.action === "rétablir" || Jm(o), d = Ym(o) || u, f = Xm(o), p = Zm(o), m = Yg(e), h = l ? "insert_before" : "insert_after", g = c ? Hh(o) : null, _ = f ? g : null, v = p ? g : null, y = ({ kind: e, targetText: t, insertText: n, expectsFollowingTable: r }) => {
|
|
12236
|
+
let i = Zh({
|
|
11940
12237
|
hasRedactionIntro: s,
|
|
11941
12238
|
insertText: n,
|
|
11942
12239
|
normalized: a
|
|
@@ -12035,7 +12332,7 @@ function qg(e, t, n, r, i) {
|
|
|
12035
12332
|
replacement: { type: "following_table" }
|
|
12036
12333
|
};
|
|
12037
12334
|
if (f && !d && !p && i.length === 0) {
|
|
12038
|
-
let t =
|
|
12335
|
+
let t = o_(e);
|
|
12039
12336
|
if (t) return {
|
|
12040
12337
|
kind: "replace",
|
|
12041
12338
|
targetText: t.targetText,
|
|
@@ -12044,7 +12341,7 @@ function qg(e, t, n, r, i) {
|
|
|
12044
12341
|
};
|
|
12045
12342
|
}
|
|
12046
12343
|
if (f && i.length >= 2) {
|
|
12047
|
-
let t =
|
|
12344
|
+
let t = pm(e), n = {
|
|
12048
12345
|
kind: "replace",
|
|
12049
12346
|
targetText: i[0],
|
|
12050
12347
|
replacementText: i[1],
|
|
@@ -12059,7 +12356,7 @@ function qg(e, t, n, r, i) {
|
|
|
12059
12356
|
targetScope: g
|
|
12060
12357
|
};
|
|
12061
12358
|
if (!d && i.length === 1 && s) {
|
|
12062
|
-
let e =
|
|
12359
|
+
let e = Qh({
|
|
12063
12360
|
hasRedactionIntro: s,
|
|
12064
12361
|
normalized: a,
|
|
12065
12362
|
replacementText: i[0]
|
|
@@ -12115,11 +12412,11 @@ function qg(e, t, n, r, i) {
|
|
|
12115
12412
|
expectsFollowingTable: m
|
|
12116
12413
|
}) : null;
|
|
12117
12414
|
}
|
|
12118
|
-
function
|
|
12119
|
-
let t =
|
|
12415
|
+
function u_(e) {
|
|
12416
|
+
let t = Wm(e);
|
|
12120
12417
|
return /\bapres\b/.test(t) && /\bla\s+fin\s+(?:(?:de\s+l['’]?)|d['’]?|de|du|des)?\s*$/u.test(t);
|
|
12121
12418
|
}
|
|
12122
|
-
function
|
|
12419
|
+
function d_(e) {
|
|
12123
12420
|
switch (e.kind) {
|
|
12124
12421
|
case "insert_after":
|
|
12125
12422
|
case "insert_before": return {
|
|
@@ -12160,7 +12457,7 @@ function Yg(e) {
|
|
|
12160
12457
|
case "delete_article": return { kind: "delete_article" };
|
|
12161
12458
|
}
|
|
12162
12459
|
}
|
|
12163
|
-
function
|
|
12460
|
+
function f_(e) {
|
|
12164
12461
|
let t = (t) => {
|
|
12165
12462
|
let n = e[t];
|
|
12166
12463
|
return typeof n == "string" ? n : "";
|
|
@@ -12176,7 +12473,7 @@ function Xg(e) {
|
|
|
12176
12473
|
a
|
|
12177
12474
|
].join("|");
|
|
12178
12475
|
}
|
|
12179
|
-
function
|
|
12476
|
+
function p_(e, t, n) {
|
|
12180
12477
|
return t.targetType === n.targetType && JSON.stringify(t.reference) === JSON.stringify(n.reference) && JSON.stringify(t.portionSelectors) === JSON.stringify(n.portionSelectors) ? e : {
|
|
12181
12478
|
...e,
|
|
12182
12479
|
targetType: t.targetType,
|
|
@@ -12184,10 +12481,10 @@ function Zg(e, t, n) {
|
|
|
12184
12481
|
portionSelectors: t.portionSelectors
|
|
12185
12482
|
};
|
|
12186
12483
|
}
|
|
12187
|
-
function
|
|
12188
|
-
return (e.kind === "compound" ? e.operations : [
|
|
12484
|
+
function m_(e, t) {
|
|
12485
|
+
return (e.kind === "compound" ? e.operations : [d_(e)]).map((n) => p_(n, e, t));
|
|
12189
12486
|
}
|
|
12190
|
-
function
|
|
12487
|
+
function h_(e) {
|
|
12191
12488
|
let t = [];
|
|
12192
12489
|
for (let n = 0; n < e.length; n += 1) {
|
|
12193
12490
|
let r = e[n];
|
|
@@ -12202,14 +12499,14 @@ function $g(e) {
|
|
|
12202
12499
|
continue;
|
|
12203
12500
|
}
|
|
12204
12501
|
let o = i[0], s = [];
|
|
12205
|
-
for (let [e, t] of i.entries()) for (let [n, r] of
|
|
12502
|
+
for (let [e, t] of i.entries()) for (let [n, r] of m_(t, o).entries()) s.push({
|
|
12206
12503
|
directiveIndex: e,
|
|
12207
12504
|
operationIndex: n,
|
|
12208
12505
|
operation: r
|
|
12209
12506
|
});
|
|
12210
12507
|
let c = /* @__PURE__ */ new Set(), l = [];
|
|
12211
12508
|
for (let e = s.length - 1; e >= 0; --e) {
|
|
12212
|
-
let t = s[e], n =
|
|
12509
|
+
let t = s[e], n = f_(t.operation);
|
|
12213
12510
|
c.has(n) || (c.add(n), l.push(t));
|
|
12214
12511
|
}
|
|
12215
12512
|
l.sort((e, t) => e.directiveIndex - t.directiveIndex || e.operationIndex - t.operationIndex), t.push({
|
|
@@ -12228,14 +12525,14 @@ function $g(e) {
|
|
|
12228
12525
|
}
|
|
12229
12526
|
return t;
|
|
12230
12527
|
}
|
|
12231
|
-
function
|
|
12232
|
-
let o = e.target ?? bt(t), s = Rp(t), c = i && n.start < i.length ? i.slice(n.start) : r, l = i && n.start < i.length ? n.start : 0, u = i === r && n.start < r.length && !
|
|
12528
|
+
function g_({ action: e, reference: t, sourcePosition: n, sourceText: r, fullText: i, tableTarget: a }) {
|
|
12529
|
+
let o = e.target ?? bt(t), s = Rp(t), c = i && n.start < i.length ? i.slice(n.start) : r, l = i && n.start < i.length ? n.start : 0, u = i === r && n.start < r.length && !u_(r.slice(0, n.start)) ? r.slice(n.start) : r, d = gh(u), f = l_(r, e, o, d, d.map((e) => e.text));
|
|
12233
12530
|
if (!f) return null;
|
|
12234
|
-
let p =
|
|
12531
|
+
let p = $g(f, s), m = jg(r), h = {
|
|
12235
12532
|
...m ? { applicabilityDate: m } : {},
|
|
12236
12533
|
sourcePosition: n,
|
|
12237
12534
|
sourceText: r
|
|
12238
|
-
}, g =
|
|
12535
|
+
}, g = Zg(c, l), _ = (e) => {
|
|
12239
12536
|
switch (e.kind) {
|
|
12240
12537
|
case "insert_after":
|
|
12241
12538
|
case "insert_before": return {
|
|
@@ -12294,7 +12591,7 @@ function e_({ action: e, reference: t, sourcePosition: n, sourceText: r, fullTex
|
|
|
12294
12591
|
insertText: e.insertText,
|
|
12295
12592
|
...e.insertLayout ? { insertLayout: e.insertLayout } : {},
|
|
12296
12593
|
...e.expectsFollowingTable && g ? { citation: g } : {},
|
|
12297
|
-
...
|
|
12594
|
+
...Gg(a) ? { tableTarget: a } : {},
|
|
12298
12595
|
...h
|
|
12299
12596
|
};
|
|
12300
12597
|
case "replace": return {
|
|
@@ -12309,7 +12606,7 @@ function e_({ action: e, reference: t, sourcePosition: n, sourceText: r, fullTex
|
|
|
12309
12606
|
text: e.replacementText
|
|
12310
12607
|
},
|
|
12311
12608
|
...e.targetScope ? { targetScope: e.targetScope } : {},
|
|
12312
|
-
...
|
|
12609
|
+
...Gg(a) ? { tableTarget: a } : {},
|
|
12313
12610
|
...h
|
|
12314
12611
|
};
|
|
12315
12612
|
case "replace_portion": return e.replacement.type === "following_table" && !g ? null : {
|
|
@@ -12321,11 +12618,11 @@ function e_({ action: e, reference: t, sourcePosition: n, sourceText: r, fullTex
|
|
|
12321
12618
|
replacement: e.replacement,
|
|
12322
12619
|
...e.replacementLayout ? { replacementLayout: e.replacementLayout } : {},
|
|
12323
12620
|
...e.replacement.type === "following_table" && g ? { citation: g } : {},
|
|
12324
|
-
...
|
|
12621
|
+
...Gg(a) ? { tableTarget: a } : {},
|
|
12325
12622
|
...h
|
|
12326
12623
|
};
|
|
12327
12624
|
case "delete": {
|
|
12328
|
-
let n = d.map((e) =>
|
|
12625
|
+
let n = d.map((e) => Qg(u, e.start)), r = /* @__PURE__ */ new Map();
|
|
12329
12626
|
for (let [e, t] of d.entries()) r.has(t.text) || r.set(t.text, n[e] ?? null);
|
|
12330
12627
|
let i = [e.targetText, ...e.extraTargetTexts ?? []].filter((e) => e && e.trim().length > 0).filter((e, t, n) => n.indexOf(e) === t);
|
|
12331
12628
|
return i.length > 1 ? v(i.map((t) => ({
|
|
@@ -12333,7 +12630,7 @@ function e_({ action: e, reference: t, sourcePosition: n, sourceText: r, fullTex
|
|
|
12333
12630
|
targetText: t,
|
|
12334
12631
|
...e.targetScope ? { targetScope: e.targetScope } : {},
|
|
12335
12632
|
occurrenceIndex: r.get(t) ?? void 0,
|
|
12336
|
-
...
|
|
12633
|
+
...Gg(a) ? { tableTarget: a } : {}
|
|
12337
12634
|
}))) : {
|
|
12338
12635
|
kind: "delete",
|
|
12339
12636
|
targetType: o,
|
|
@@ -12342,7 +12639,7 @@ function e_({ action: e, reference: t, sourcePosition: n, sourceText: r, fullTex
|
|
|
12342
12639
|
targetText: e.targetText,
|
|
12343
12640
|
...e.targetScope ? { targetScope: e.targetScope } : {},
|
|
12344
12641
|
occurrenceIndex: r.get(e.targetText) ?? void 0,
|
|
12345
|
-
...
|
|
12642
|
+
...Gg(a) ? { tableTarget: a } : {},
|
|
12346
12643
|
...h
|
|
12347
12644
|
};
|
|
12348
12645
|
}
|
|
@@ -12351,7 +12648,7 @@ function e_({ action: e, reference: t, sourcePosition: n, sourceText: r, fullTex
|
|
|
12351
12648
|
targetType: o,
|
|
12352
12649
|
reference: t,
|
|
12353
12650
|
portionSelectors: s,
|
|
12354
|
-
...
|
|
12651
|
+
...Gg(a) ? { tableTarget: a } : {},
|
|
12355
12652
|
...h
|
|
12356
12653
|
};
|
|
12357
12654
|
case "delete_article": return o === "article" ? {
|
|
@@ -12375,7 +12672,7 @@ function e_({ action: e, reference: t, sourcePosition: n, sourceText: r, fullTex
|
|
|
12375
12672
|
}
|
|
12376
12673
|
return y(p);
|
|
12377
12674
|
}
|
|
12378
|
-
function
|
|
12675
|
+
function __(e) {
|
|
12379
12676
|
let t = /\barticle\s+([0-9]+(?:-[0-9]+)?(?:\s*[A-Z])?(?:\s+[a-z]+)?)\b/i.exec(e);
|
|
12380
12677
|
if (!t || t.index === void 0) return null;
|
|
12381
12678
|
let n = t.index, r = t.index + t[0].length;
|
|
@@ -12394,57 +12691,57 @@ function t_(e) {
|
|
|
12394
12691
|
}
|
|
12395
12692
|
};
|
|
12396
12693
|
}
|
|
12397
|
-
function
|
|
12694
|
+
function v_(e, t) {
|
|
12398
12695
|
let i = r(e).output;
|
|
12399
12696
|
if (t.allowListExtraction) {
|
|
12400
|
-
let e =
|
|
12697
|
+
let e = qg(i);
|
|
12401
12698
|
if (e) return e;
|
|
12402
12699
|
}
|
|
12403
|
-
let a =
|
|
12404
|
-
if (l.length > 0 && (c = c.filter((e) => !
|
|
12405
|
-
let e =
|
|
12700
|
+
let a = vh(i), o = s_(i), s = xh(i), c = Fm(new n(i)), l = [...a, ...o];
|
|
12701
|
+
if (l.length > 0 && (c = c.filter((e) => !c_(e, l))), c.length === 0 && (c = Fm(new n(s.split(",")[0] ?? s))), c.length === 0) {
|
|
12702
|
+
let e = __(s);
|
|
12406
12703
|
e && (c = [{
|
|
12407
12704
|
...e.reference,
|
|
12408
12705
|
position: e.position
|
|
12409
12706
|
}]);
|
|
12410
12707
|
}
|
|
12411
|
-
let u =
|
|
12708
|
+
let u = sg(s);
|
|
12412
12709
|
if (c.length === 1 && c[0]?.type === "article") {
|
|
12413
|
-
let e =
|
|
12710
|
+
let e = ph(s, { actionIndex: u ?? s.length });
|
|
12414
12711
|
e && (c = [e]);
|
|
12415
12712
|
}
|
|
12416
12713
|
if (u !== null) {
|
|
12417
|
-
let e = c.some((e) => bt(
|
|
12714
|
+
let e = c.some((e) => bt(cg(e)) === "article"), t = c.some((e) => [...O(cg(e))].some((e) => e.type === "article")), n = s.slice(0, u), r = ch(t_(n), 0) ?? ch(n, 0), i = c.map(cg).sort((e, t) => lh(t) - lh(e) || uh(t) - uh(e))[0], a = dh(i ?? null, r);
|
|
12418
12715
|
if (!e && a && a === r && (c = [r]), !t) {
|
|
12419
12716
|
let e = i, t = n.indexOf(":");
|
|
12420
12717
|
if (t !== -1) {
|
|
12421
|
-
let r = t + 1, i =
|
|
12422
|
-
e && i &&
|
|
12718
|
+
let r = t + 1, i = ch(n_(n.slice(r)), r), a = i ? Rp(i) : [];
|
|
12719
|
+
e && i && lh(e) > 0 && (a.length > 1 || a.some((e) => e.kind === "range")) && (c = [Sg(e, i)]);
|
|
12423
12720
|
}
|
|
12424
12721
|
}
|
|
12425
12722
|
if (t) {
|
|
12426
|
-
let e = c.map(
|
|
12427
|
-
t !== -1 && e && i &&
|
|
12723
|
+
let e = c.map(cg).filter((e) => [...O(e)].some((e) => e.type === "article")).sort((e, t) => lh(t) - lh(e) || uh(t) - uh(e))[0], t = n.indexOf(":"), r = t === -1 ? 0 : t + 1, i = ch(n_(n.slice(r)), r), a = i ? Rp(i) : [];
|
|
12724
|
+
t !== -1 && e && i && lh(e) > 0 && (a.length > 1 || a.some((e) => e.kind === "range")) && c.push(Sg(e, i));
|
|
12428
12725
|
}
|
|
12429
12726
|
}
|
|
12430
12727
|
let d = [];
|
|
12431
12728
|
for (let e of c) {
|
|
12432
12729
|
if (e.type === "reference_et_action") {
|
|
12433
|
-
let t = e.position?.start ?? 0, n = i.lastIndexOf("\n", Math.max(0, t - 1)) + 1, r =
|
|
12730
|
+
let t = e.position?.start ?? 0, n = i.lastIndexOf("\n", Math.max(0, t - 1)) + 1, r = u_(i.slice(n, t)) ? n : t, a = {
|
|
12434
12731
|
start: r,
|
|
12435
12732
|
stop: i.length
|
|
12436
|
-
}, o = i.slice(r), s =
|
|
12733
|
+
}, o = i.slice(r), s = g_({
|
|
12437
12734
|
action: e.action,
|
|
12438
12735
|
reference: e.reference,
|
|
12439
12736
|
sourcePosition: a,
|
|
12440
12737
|
sourceText: o,
|
|
12441
12738
|
fullText: i,
|
|
12442
|
-
tableTarget:
|
|
12739
|
+
tableTarget: e_(o) ?? e_(i)
|
|
12443
12740
|
});
|
|
12444
12741
|
s && (Array.isArray(s) ? d.push(...s) : d.push(s));
|
|
12445
12742
|
continue;
|
|
12446
12743
|
}
|
|
12447
|
-
let t =
|
|
12744
|
+
let t = g_({
|
|
12448
12745
|
action: { action: "modifier" },
|
|
12449
12746
|
reference: e,
|
|
12450
12747
|
sourcePosition: e.position ?? {
|
|
@@ -12453,73 +12750,73 @@ function n_(e, t) {
|
|
|
12453
12750
|
},
|
|
12454
12751
|
sourceText: i,
|
|
12455
12752
|
fullText: i,
|
|
12456
|
-
tableTarget:
|
|
12753
|
+
tableTarget: e_(i)
|
|
12457
12754
|
});
|
|
12458
12755
|
t && (Array.isArray(t) ? d.push(...t) : d.push(t));
|
|
12459
12756
|
}
|
|
12460
12757
|
if (d.length === 0) {
|
|
12461
|
-
let e =
|
|
12758
|
+
let e = __(s);
|
|
12462
12759
|
if (e) {
|
|
12463
|
-
let t =
|
|
12760
|
+
let t = g_({
|
|
12464
12761
|
action: { action: "modifier" },
|
|
12465
12762
|
reference: e.reference,
|
|
12466
12763
|
sourcePosition: e.position,
|
|
12467
12764
|
sourceText: i,
|
|
12468
12765
|
fullText: i,
|
|
12469
|
-
tableTarget:
|
|
12766
|
+
tableTarget: e_(i)
|
|
12470
12767
|
});
|
|
12471
12768
|
t && (Array.isArray(t) ? d.push(...t) : d.push(t));
|
|
12472
12769
|
}
|
|
12473
12770
|
}
|
|
12474
|
-
return
|
|
12771
|
+
return h_(d);
|
|
12475
12772
|
}
|
|
12476
|
-
function
|
|
12773
|
+
function y_(e) {
|
|
12477
12774
|
let t = new n(r(e).output);
|
|
12478
|
-
return [...
|
|
12775
|
+
return [...zh.extract(t, { overlapWindow: 100 })];
|
|
12479
12776
|
}
|
|
12480
|
-
function
|
|
12481
|
-
return
|
|
12777
|
+
function b_(e) {
|
|
12778
|
+
return v_(e, { allowListExtraction: !0 });
|
|
12482
12779
|
}
|
|
12483
|
-
var
|
|
12484
|
-
function
|
|
12485
|
-
let t =
|
|
12486
|
-
return t.includes("«") || t.includes("»") || !e.trim().endsWith(":") ? !1 :
|
|
12780
|
+
var x_ = b_;
|
|
12781
|
+
function S_(e) {
|
|
12782
|
+
let t = Wm(e);
|
|
12783
|
+
return t.includes("«") || t.includes("»") || !e.trim().endsWith(":") ? !1 : Qm(t);
|
|
12487
12784
|
}
|
|
12488
|
-
function
|
|
12785
|
+
function C_(e, t) {
|
|
12489
12786
|
let n = [], r = !1, i = t + 1;
|
|
12490
12787
|
for (; i < e.length;) {
|
|
12491
|
-
let t = e[i], a =
|
|
12788
|
+
let t = e[i], a = $h(t);
|
|
12492
12789
|
if (!r && a.includes("«") && (r = !0), r) {
|
|
12493
12790
|
if (n.push(a), a.includes("»")) break;
|
|
12494
12791
|
} else if (a.trim().length > 0) break;
|
|
12495
12792
|
i += 1;
|
|
12496
12793
|
}
|
|
12497
12794
|
return !r || n.length === 0 ? null : {
|
|
12498
|
-
combinedText: [
|
|
12795
|
+
combinedText: [$h(e[t]), ...n].join("\n"),
|
|
12499
12796
|
endIndex: i
|
|
12500
12797
|
};
|
|
12501
12798
|
}
|
|
12502
|
-
function
|
|
12799
|
+
function w_(e) {
|
|
12503
12800
|
let t = a()(e).output.split("\n").map((e) => e.trim()).filter((e) => e.length > 0), n = [];
|
|
12504
12801
|
for (let e = 0; e < t.length; e += 1) {
|
|
12505
12802
|
let r = t[e];
|
|
12506
|
-
if (
|
|
12507
|
-
let r =
|
|
12803
|
+
if (S_(r)) {
|
|
12804
|
+
let r = C_(t, e);
|
|
12508
12805
|
if (r) {
|
|
12509
|
-
let t =
|
|
12806
|
+
let t = b_(r.combinedText);
|
|
12510
12807
|
if (t.length > 0) {
|
|
12511
12808
|
n.push(...t), e = r.endIndex;
|
|
12512
12809
|
continue;
|
|
12513
12810
|
}
|
|
12514
12811
|
}
|
|
12515
12812
|
}
|
|
12516
|
-
let i =
|
|
12813
|
+
let i = v_(r, { allowListExtraction: !1 });
|
|
12517
12814
|
i.length > 0 && n.push(...i);
|
|
12518
12815
|
}
|
|
12519
12816
|
return n;
|
|
12520
12817
|
}
|
|
12521
|
-
var
|
|
12522
|
-
function
|
|
12818
|
+
var T_ = w_, E_;
|
|
12819
|
+
function D_(e) {
|
|
12523
12820
|
return {
|
|
12524
12821
|
dateDebut: e.dateDebut ?? "0001-01-01",
|
|
12525
12822
|
dateFin: e.dateFin ?? "2999-01-01",
|
|
@@ -12528,7 +12825,7 @@ function d_(e) {
|
|
|
12528
12825
|
textId: e.textId
|
|
12529
12826
|
};
|
|
12530
12827
|
}
|
|
12531
|
-
function
|
|
12828
|
+
function O_(e) {
|
|
12532
12829
|
let t = e["@id"];
|
|
12533
12830
|
return t === void 0 ? null : {
|
|
12534
12831
|
dateDebut: e["@debut"] ?? null,
|
|
@@ -12538,10 +12835,10 @@ function f_(e) {
|
|
|
12538
12835
|
title: e["#text"] ?? null
|
|
12539
12836
|
};
|
|
12540
12837
|
}
|
|
12541
|
-
function
|
|
12838
|
+
function k_(e, t) {
|
|
12542
12839
|
return (e.dateDebut === null || e.dateDebut <= t) && (e.dateFin === null || e.dateFin >= t);
|
|
12543
12840
|
}
|
|
12544
|
-
var
|
|
12841
|
+
var A_ = class extends ke {
|
|
12545
12842
|
canutesDb;
|
|
12546
12843
|
articleRowsByNumByTextAndDate = /* @__PURE__ */ new Map();
|
|
12547
12844
|
directSectionChildrenByParentAndDate = /* @__PURE__ */ new Map();
|
|
@@ -12566,7 +12863,7 @@ var m_ = class extends ke {
|
|
|
12566
12863
|
WHERE
|
|
12567
12864
|
data -> 'CONTEXTE' -> 'TEXTE' ->> '@cid' = ${n}
|
|
12568
12865
|
AND num = ${t}
|
|
12569
|
-
`).map(
|
|
12866
|
+
`).map(D_), this.articleRowsByNumByTextAndDate.set(r, i)), i;
|
|
12570
12867
|
}
|
|
12571
12868
|
async getDirectSectionChildren({ date: e, parentPath: t }) {
|
|
12572
12869
|
let n = `${t}\0${e}`, r = this.directSectionChildrenByParentAndDate.get(n);
|
|
@@ -12580,7 +12877,7 @@ var m_ = class extends ke {
|
|
|
12580
12877
|
SELECT data
|
|
12581
12878
|
FROM legifrance.textelr
|
|
12582
12879
|
WHERE id = ${t}
|
|
12583
|
-
`)[0]?.data.STRUCT?.LIEN_SECTION_TA?.map(
|
|
12880
|
+
`)[0]?.data.STRUCT?.LIEN_SECTION_TA?.map(O_).filter((e) => e !== null).filter((t) => k_(t, e)) ?? [] : i.map(O_).filter((e) => e !== null).filter((t) => k_(t, e)), this.directSectionChildrenByParentAndDate.set(n, r);
|
|
12584
12881
|
}
|
|
12585
12882
|
return r;
|
|
12586
12883
|
}
|
|
@@ -12623,7 +12920,7 @@ var m_ = class extends ke {
|
|
|
12623
12920
|
FROM legifrance.article
|
|
12624
12921
|
WHERE num = ${t}
|
|
12625
12922
|
LIMIT 100
|
|
12626
|
-
`).map(
|
|
12923
|
+
`).map(D_), this.globalArticleRowsByNumAndDate.set(n, r)), r;
|
|
12627
12924
|
}
|
|
12628
12925
|
async preloadTextTitlesInfos(e = {}) {
|
|
12629
12926
|
let t = (t, n = {}) => {
|
|
@@ -12638,7 +12935,7 @@ var m_ = class extends ke {
|
|
|
12638
12935
|
return;
|
|
12639
12936
|
}
|
|
12640
12937
|
let n = new xe("canutes.preloadTextTitlesInfos");
|
|
12641
|
-
|
|
12938
|
+
E_ === void 0 ? (t("queryTextTitlesInfos:start"), E_ = (async () => {
|
|
12642
12939
|
let e = await n.time("queryTextTitlesInfos", () => this.canutesDb`
|
|
12643
12940
|
SELECT
|
|
12644
12941
|
data -> 'META' -> 'META_SPEC' -> 'META_TEXTE_CHRONICLE' ->> 'CID' AS cid,
|
|
@@ -12668,8 +12965,8 @@ var m_ = class extends ke {
|
|
|
12668
12965
|
`);
|
|
12669
12966
|
t("queryTextTitlesInfos:done", { count: e.length }), t("buildTextTitlesInfos:start", { count: e.length }), await Ee(e, { onProgress: ({ count: e, phase: n }) => t(`buildTextTitlesInfos:${n}`, { count: e }) }), t("buildTextTitlesInfos:done", { count: e.length }), t("setTextTitlesInfos:done");
|
|
12670
12967
|
})().catch((e) => {
|
|
12671
|
-
throw
|
|
12672
|
-
})) : t("waiting-for-shared-preload"), await
|
|
12968
|
+
throw E_ = void 0, e;
|
|
12969
|
+
})) : t("waiting-for-shared-preload"), await E_, n.log(), this.textTitlesInfosLoaded = !0;
|
|
12673
12970
|
}
|
|
12674
12971
|
async preloadUniqueActiveArticlesByNums({ date: e, nums: t }) {
|
|
12675
12972
|
let n = [...new Set([...t].filter(Boolean))].filter((t) => !this.globalArticleRowsByNumAndDate.has(`${t}\0${e}`));
|
|
@@ -12683,7 +12980,7 @@ var m_ = class extends ke {
|
|
|
12683
12980
|
data -> 'META' -> 'META_SPEC' -> 'META_ARTICLE' ->> 'DATE_FIN' AS "dateFin"
|
|
12684
12981
|
FROM legifrance.article
|
|
12685
12982
|
WHERE num IN ${this.canutesDb(n)}
|
|
12686
|
-
`).map(
|
|
12983
|
+
`).map(D_), i = /* @__PURE__ */ new Map();
|
|
12687
12984
|
for (let e of r) {
|
|
12688
12985
|
if (e.num === null) continue;
|
|
12689
12986
|
let t = i.get(e.num);
|
|
@@ -12694,15 +12991,15 @@ var m_ = class extends ke {
|
|
|
12694
12991
|
};
|
|
12695
12992
|
//#endregion
|
|
12696
12993
|
//#region src/lib/extractors/links.ts
|
|
12697
|
-
async function*
|
|
12698
|
-
let l = r ?? (e === void 0 ? void 0 : new
|
|
12994
|
+
async function* j_({ canutesDb: e, context: t, date: n, legiResolver: r, logIgnoredReferencesTypes: i, logPartialReferences: a, logReferences: o, state: s, transformation: c }) {
|
|
12995
|
+
let l = r ?? (e === void 0 ? void 0 : new A_(e));
|
|
12699
12996
|
if (l === void 0) throw Error("A Canutes database or legal resolver is required");
|
|
12700
12997
|
let u = new xe("extractTextLinks"), d = {}, f = c === void 0 ? void 0 : _e(c), p = s === void 0 ? {} : structuredClone(s), m = u.timeSync("extractReferences", () => {
|
|
12701
12998
|
let e = [];
|
|
12702
|
-
for (let n of c === void 0 ?
|
|
12999
|
+
for (let n of c === void 0 ? Mm(t) : Pm(t, c)) o && console.log(`In "${t.input.slice(n.position.start, n.position.stop)}": \nReference "${t.text(n.position)}": ${JSON.stringify(n, null, 2)}`), e.push(n);
|
|
12703
13000
|
return e;
|
|
12704
13001
|
}, { inputSize: t.input.length }), h = performance.now();
|
|
12705
|
-
for (let e of m) for (let n of
|
|
13002
|
+
for (let e of m) for (let n of B_(t, e)) {
|
|
12706
13003
|
let r = n.type === "parent-enfant" ? n.parent : n;
|
|
12707
13004
|
switch (r.type) {
|
|
12708
13005
|
case "alinéa":
|
|
@@ -12731,7 +13028,7 @@ async function* h_({ canutesDb: e, context: t, date: n, legiResolver: r, logIgno
|
|
|
12731
13028
|
r.definition && p.textId === void 0 && a && console.log(`In "${t.input.slice(e.position.start, e.position.stop)}": Missing state.textId for division definition`);
|
|
12732
13029
|
break;
|
|
12733
13030
|
case "texte":
|
|
12734
|
-
|
|
13031
|
+
M_({
|
|
12735
13032
|
context: t,
|
|
12736
13033
|
logPartialReferences: a,
|
|
12737
13034
|
reference: e,
|
|
@@ -12747,14 +13044,14 @@ async function* h_({ canutesDb: e, context: t, date: n, legiResolver: r, logIgno
|
|
|
12747
13044
|
phase: "collectDefinitionsAndTextState"
|
|
12748
13045
|
});
|
|
12749
13046
|
let g = /* @__PURE__ */ new Set();
|
|
12750
|
-
for (let e of m) for (let t of
|
|
12751
|
-
let _ =
|
|
13047
|
+
for (let e of m) for (let t of z_(e, { citations: !0 })) g.add(t);
|
|
13048
|
+
let _ = N_(t, m);
|
|
12752
13049
|
await u.time("preloadActiveArticlesByTextIds", () => l.preloadActiveArticlesByTextIds({
|
|
12753
13050
|
date: n,
|
|
12754
13051
|
nums: g,
|
|
12755
13052
|
textIds: _
|
|
12756
13053
|
}), { count: _.size });
|
|
12757
|
-
let v = await u.time("collectUniqueFallbackArticleNums", () =>
|
|
13054
|
+
let v = await u.time("collectUniqueFallbackArticleNums", () => P_({
|
|
12758
13055
|
context: t,
|
|
12759
13056
|
date: n,
|
|
12760
13057
|
legiResolver: l,
|
|
@@ -12767,7 +13064,7 @@ async function* h_({ canutesDb: e, context: t, date: n, legiResolver: r, logIgno
|
|
|
12767
13064
|
nums: v
|
|
12768
13065
|
}), { count: v.size }), p = s === void 0 ? {} : s;
|
|
12769
13066
|
let y = 0, ee = performance.now();
|
|
12770
|
-
for (let e of m) for await (let r of
|
|
13067
|
+
for (let e of m) for await (let r of G_({
|
|
12771
13068
|
articleDefinitionByNumByTextId: d,
|
|
12772
13069
|
legiResolver: l,
|
|
12773
13070
|
context: t,
|
|
@@ -12784,7 +13081,7 @@ async function* h_({ canutesDb: e, context: t, date: n, legiResolver: r, logIgno
|
|
|
12784
13081
|
phase: "iterReferenceLinks"
|
|
12785
13082
|
}), u.log({ referenceCount: m.length });
|
|
12786
13083
|
}
|
|
12787
|
-
function
|
|
13084
|
+
function M_({ context: e, logPartialReferences: t, reference: n, state: r, text: i }) {
|
|
12788
13085
|
switch (i.nature) {
|
|
12789
13086
|
case "ARRETE":
|
|
12790
13087
|
case "CIRCULAIRE":
|
|
@@ -12855,17 +13152,17 @@ function g_({ context: e, logPartialReferences: t, reference: n, state: r, text:
|
|
|
12855
13152
|
default: i.nature === void 0 ? delete r.textId : c("nature", i.nature);
|
|
12856
13153
|
}
|
|
12857
13154
|
}
|
|
12858
|
-
function
|
|
13155
|
+
function N_(e, t) {
|
|
12859
13156
|
let n = /* @__PURE__ */ new Set();
|
|
12860
|
-
for (let r of t) for (let t of
|
|
13157
|
+
for (let r of t) for (let t of B_(e, r, { citations: !0 })) {
|
|
12861
13158
|
let e = t.type === "parent-enfant" ? t.parent : t;
|
|
12862
13159
|
e.type === "texte" && e.cid !== void 0 ? n.add(e.cid) : e.type === "article" && e.implicitText?.cid !== void 0 && n.add(e.implicitText.cid);
|
|
12863
13160
|
}
|
|
12864
13161
|
return n;
|
|
12865
13162
|
}
|
|
12866
|
-
async function
|
|
13163
|
+
async function P_({ context: e, date: t, legiResolver: n, logPartialReferences: r, references: i, state: a }) {
|
|
12867
13164
|
let o = /* @__PURE__ */ new Set();
|
|
12868
|
-
for (let s of i) await
|
|
13165
|
+
for (let s of i) await F_({
|
|
12869
13166
|
articleNums: o,
|
|
12870
13167
|
context: e,
|
|
12871
13168
|
date: t,
|
|
@@ -12876,8 +13173,8 @@ async function v_({ context: e, date: t, legiResolver: n, logPartialReferences:
|
|
|
12876
13173
|
});
|
|
12877
13174
|
return o;
|
|
12878
13175
|
}
|
|
12879
|
-
async function
|
|
12880
|
-
for (let s of
|
|
13176
|
+
async function F_({ articleNums: e, context: t, date: n, legiResolver: r, logPartialReferences: i, reference: a, state: o }) {
|
|
13177
|
+
for (let s of B_(t, a)) await I_({
|
|
12881
13178
|
articleNums: e,
|
|
12882
13179
|
atomicOrParentChildReference: s,
|
|
12883
13180
|
context: t,
|
|
@@ -12892,7 +13189,7 @@ async function y_({ articleNums: e, context: t, date: n, legiResolver: r, logPar
|
|
|
12892
13189
|
if (s !== void 0) {
|
|
12893
13190
|
for (let a of s) if (a.references !== void 0) {
|
|
12894
13191
|
let s = structuredClone(o);
|
|
12895
|
-
for (let o of a.references) await
|
|
13192
|
+
for (let o of a.references) await F_({
|
|
12896
13193
|
articleNums: e,
|
|
12897
13194
|
context: t,
|
|
12898
13195
|
date: n,
|
|
@@ -12905,7 +13202,7 @@ async function y_({ articleNums: e, context: t, date: n, legiResolver: r, logPar
|
|
|
12905
13202
|
}
|
|
12906
13203
|
}
|
|
12907
13204
|
}
|
|
12908
|
-
async function
|
|
13205
|
+
async function I_({ articleNums: e, atomicOrParentChildReference: t, context: n, date: r, legiResolver: i, logPartialReferences: a, reference: o, state: s }) {
|
|
12909
13206
|
let c = t.type === "parent-enfant" ? t.parent : t, l = t.type === "parent-enfant" ? t : void 0;
|
|
12910
13207
|
switch (c.type) {
|
|
12911
13208
|
case "alinéa":
|
|
@@ -12914,7 +13211,7 @@ async function b_({ articleNums: e, atomicOrParentChildReference: t, context: n,
|
|
|
12914
13211
|
case "phrase": break;
|
|
12915
13212
|
case "article":
|
|
12916
13213
|
if (c.definition && s.textId !== void 0) break;
|
|
12917
|
-
await
|
|
13214
|
+
await L_({
|
|
12918
13215
|
article: c,
|
|
12919
13216
|
date: r,
|
|
12920
13217
|
legiResolver: i,
|
|
@@ -12932,7 +13229,7 @@ async function b_({ articleNums: e, atomicOrParentChildReference: t, context: n,
|
|
|
12932
13229
|
case "sous-titre":
|
|
12933
13230
|
case "titre":
|
|
12934
13231
|
if (c.definition && s.textId !== void 0) break;
|
|
12935
|
-
l !== void 0 && await
|
|
13232
|
+
l !== void 0 && await F_({
|
|
12936
13233
|
articleNums: e,
|
|
12937
13234
|
context: n,
|
|
12938
13235
|
date: r,
|
|
@@ -12943,13 +13240,13 @@ async function b_({ articleNums: e, atomicOrParentChildReference: t, context: n,
|
|
|
12943
13240
|
});
|
|
12944
13241
|
break;
|
|
12945
13242
|
case "texte":
|
|
12946
|
-
|
|
13243
|
+
M_({
|
|
12947
13244
|
context: n,
|
|
12948
13245
|
logPartialReferences: a,
|
|
12949
13246
|
reference: o,
|
|
12950
13247
|
state: s,
|
|
12951
13248
|
text: c
|
|
12952
|
-
}), l !== void 0 && await
|
|
13249
|
+
}), l !== void 0 && await F_({
|
|
12953
13250
|
articleNums: e,
|
|
12954
13251
|
context: n,
|
|
12955
13252
|
date: r,
|
|
@@ -12962,7 +13259,7 @@ async function b_({ articleNums: e, atomicOrParentChildReference: t, context: n,
|
|
|
12962
13259
|
default: break;
|
|
12963
13260
|
}
|
|
12964
13261
|
}
|
|
12965
|
-
async function
|
|
13262
|
+
async function L_({ article: e, date: t, legiResolver: n, state: r }) {
|
|
12966
13263
|
if (e.present || e.num === void 0) return !1;
|
|
12967
13264
|
let i = e.implicitText?.cid ?? r.textId;
|
|
12968
13265
|
return !(i !== void 0 && (await n.getActiveArticlesByTextAndNum({
|
|
@@ -12975,7 +13272,7 @@ async function x_({ article: e, date: t, legiResolver: n, state: r }) {
|
|
|
12975
13272
|
textId: r.defaultTextId
|
|
12976
13273
|
})).length > 0);
|
|
12977
13274
|
}
|
|
12978
|
-
async function*
|
|
13275
|
+
async function* R_({ ancestors: e, article: t, legiResolver: n, context: r, date: i, logPartialReferences: a, originalPositionsFromTransformedIterator: o, reference: s, state: c }) {
|
|
12979
13276
|
if (t.present) return;
|
|
12980
13277
|
let l = [], u = t.implicitText?.cid ?? c.textId;
|
|
12981
13278
|
if (u !== void 0 && (l = await n.getActiveArticlesByTextAndNum({
|
|
@@ -13011,91 +13308,91 @@ async function* S_({ ancestors: e, article: t, legiResolver: n, context: r, date
|
|
|
13011
13308
|
type: "external_article"
|
|
13012
13309
|
}).filter(([, e]) => e !== void 0));
|
|
13013
13310
|
}
|
|
13014
|
-
function*
|
|
13311
|
+
function* z_(e, { citations: t = !1 } = {}) {
|
|
13015
13312
|
switch (e.type) {
|
|
13016
13313
|
case "article":
|
|
13017
13314
|
e.num !== void 0 && (yield e.num);
|
|
13018
13315
|
break;
|
|
13019
13316
|
case "bounded-interval":
|
|
13020
|
-
yield*
|
|
13317
|
+
yield* z_(e.first, { citations: t }), yield* z_(e.last, { citations: t });
|
|
13021
13318
|
break;
|
|
13022
13319
|
case "counted-interval":
|
|
13023
|
-
yield*
|
|
13320
|
+
yield* z_(e.first, { citations: t });
|
|
13024
13321
|
break;
|
|
13025
13322
|
case "enumeration":
|
|
13026
13323
|
case "exclusion":
|
|
13027
|
-
yield*
|
|
13324
|
+
yield* z_(e.left, { citations: t }), yield* z_(e.right, { citations: t });
|
|
13028
13325
|
break;
|
|
13029
13326
|
case "parent-enfant":
|
|
13030
|
-
yield*
|
|
13327
|
+
yield* z_(e.parent, { citations: t }), yield* z_(e.child, { citations: t });
|
|
13031
13328
|
break;
|
|
13032
13329
|
case "reference_et_action":
|
|
13033
|
-
if (yield*
|
|
13330
|
+
if (yield* z_(e.reference, { citations: t }), t) {
|
|
13034
13331
|
let { originalCitations: n } = e.action;
|
|
13035
13332
|
if (n !== void 0) {
|
|
13036
|
-
for (let e of n) if (e.references !== void 0) for (let n of e.references) yield*
|
|
13333
|
+
for (let e of n) if (e.references !== void 0) for (let n of e.references) yield* z_(n, { citations: t });
|
|
13037
13334
|
}
|
|
13038
13335
|
}
|
|
13039
13336
|
break;
|
|
13040
13337
|
}
|
|
13041
13338
|
}
|
|
13042
|
-
function*
|
|
13339
|
+
function* B_(e, t, { citations: n = !1 } = {}) {
|
|
13043
13340
|
switch (t.type) {
|
|
13044
13341
|
case "bounded-interval":
|
|
13045
|
-
yield*
|
|
13342
|
+
yield* B_(e, t.first, { citations: n }), yield* B_(e, t.last, { citations: n });
|
|
13046
13343
|
break;
|
|
13047
13344
|
case "counted-interval":
|
|
13048
|
-
yield*
|
|
13345
|
+
yield* B_(e, t.first, { citations: n });
|
|
13049
13346
|
break;
|
|
13050
13347
|
case "enumeration":
|
|
13051
13348
|
case "exclusion":
|
|
13052
|
-
yield*
|
|
13349
|
+
yield* B_(e, t.left, { citations: n }), yield* B_(e, t.right, { citations: n });
|
|
13053
13350
|
break;
|
|
13054
13351
|
case "reference_et_action":
|
|
13055
|
-
if (yield*
|
|
13352
|
+
if (yield* B_(e, t.reference, { citations: n }), n) {
|
|
13056
13353
|
let { originalCitations: r } = t.action;
|
|
13057
13354
|
if (r !== void 0) {
|
|
13058
|
-
for (let t of r) if (t.references !== void 0) for (let r of t.references) yield*
|
|
13355
|
+
for (let t of r) if (t.references !== void 0) for (let r of t.references) yield* B_(e, r, { citations: n });
|
|
13059
13356
|
}
|
|
13060
13357
|
}
|
|
13061
13358
|
break;
|
|
13062
13359
|
default: yield t;
|
|
13063
13360
|
}
|
|
13064
13361
|
}
|
|
13065
|
-
function*
|
|
13362
|
+
function* V_(e, t) {
|
|
13066
13363
|
if (t.type === "texte") console.error(`iterDeepestDivisionsOrArticles must not be called with a text:\n${JSON.stringify(t, null, 2)}`);
|
|
13067
13364
|
else if (dt(t) || t.type === "article") yield t;
|
|
13068
13365
|
else if (!(ft(t) || t.type === "incomplete-header")) switch (t.type) {
|
|
13069
13366
|
case "bounded-interval":
|
|
13070
|
-
yield*
|
|
13367
|
+
yield* V_(e, t.first), yield* V_(e, t.last);
|
|
13071
13368
|
break;
|
|
13072
13369
|
case "counted-interval":
|
|
13073
|
-
yield*
|
|
13370
|
+
yield* V_(e, t.first);
|
|
13074
13371
|
break;
|
|
13075
13372
|
case "enumeration":
|
|
13076
13373
|
case "exclusion":
|
|
13077
|
-
yield*
|
|
13374
|
+
yield* V_(e, t.left), yield* V_(e, t.right);
|
|
13078
13375
|
break;
|
|
13079
13376
|
case "parent-enfant": {
|
|
13080
|
-
let n = [...
|
|
13081
|
-
n.length === 0 ? yield*
|
|
13377
|
+
let n = [...V_(e, t.child)];
|
|
13378
|
+
n.length === 0 ? yield* V_(e, t.parent) : yield* n;
|
|
13082
13379
|
break;
|
|
13083
13380
|
}
|
|
13084
13381
|
case "reference_et_action": {
|
|
13085
|
-
yield*
|
|
13382
|
+
yield* V_(e, t.reference);
|
|
13086
13383
|
let { originalCitations: n } = t.action;
|
|
13087
13384
|
if (n !== void 0) {
|
|
13088
|
-
for (let t of n) if (t.references !== void 0) for (let n of t.references) yield*
|
|
13385
|
+
for (let t of n) if (t.references !== void 0) for (let n of t.references) yield* V_(e, n);
|
|
13089
13386
|
}
|
|
13090
13387
|
break;
|
|
13091
13388
|
}
|
|
13092
13389
|
default: c("iterDeepestDivisionsOrArticles reference.type", t);
|
|
13093
13390
|
}
|
|
13094
13391
|
}
|
|
13095
|
-
function
|
|
13392
|
+
function H_(e) {
|
|
13096
13393
|
return e?.split(":")[0].trim().toLowerCase().split(/\s+/).map((e) => e.trim()).filter((e) => e !== "").join(" ");
|
|
13097
13394
|
}
|
|
13098
|
-
async function*
|
|
13395
|
+
async function* U_({ ancestors: e, legiResolver: t, context: n, date: r, division: i, divisionChildReference: a, logIgnoredReferencesTypes: o, logPartialReferences: s, originalPositionsFromTransformedIterator: c, parentSectionChildren: l, reference: u, state: d }) {
|
|
13099
13396
|
if (i.present) return;
|
|
13100
13397
|
let f;
|
|
13101
13398
|
if (l === void 0 && d.textId !== void 0 && (l = await t.getDirectSectionChildren({
|
|
@@ -13103,20 +13400,20 @@ async function* D_({ ancestors: e, legiResolver: t, context: n, date: r, divisio
|
|
|
13103
13400
|
parentPath: d.textId
|
|
13104
13401
|
})), l !== void 0) {
|
|
13105
13402
|
for (let e of l) {
|
|
13106
|
-
let t =
|
|
13403
|
+
let t = H_(e.title);
|
|
13107
13404
|
if (t !== void 0) {
|
|
13108
13405
|
let n = !1;
|
|
13109
|
-
if (i.index !== void 0 && (n =
|
|
13406
|
+
if (i.index !== void 0 && (n = W_(i.type, i.index).some((e) => e === t)), !n && i.num !== void 0 && (n = `${i.type} ${i.num.toLowerCase()}` === t), n) {
|
|
13110
13407
|
f = e;
|
|
13111
13408
|
break;
|
|
13112
13409
|
}
|
|
13113
13410
|
}
|
|
13114
13411
|
}
|
|
13115
13412
|
if (f === void 0 && (f = l.find((e) => {
|
|
13116
|
-
let t =
|
|
13413
|
+
let t = H_(e.title)?.split(/\s+/);
|
|
13117
13414
|
return t !== void 0 && t.length === 2 && ot.includes(t[0]) && t[1] === "législative";
|
|
13118
13415
|
}), f !== void 0)) {
|
|
13119
|
-
let e =
|
|
13416
|
+
let e = H_(f.title).split(/\s+/), t = {
|
|
13120
13417
|
start: i.position.stop,
|
|
13121
13418
|
stop: i.position.stop
|
|
13122
13419
|
}, n = c === void 0 ? void 0 : v(c, t), r = Object.fromEntries(Object.entries({
|
|
@@ -13134,8 +13431,8 @@ async function* D_({ ancestors: e, legiResolver: t, context: n, date: r, divisio
|
|
|
13134
13431
|
}).filter(([, e]) => e !== void 0)), i = r;
|
|
13135
13432
|
}
|
|
13136
13433
|
}
|
|
13137
|
-
let p = a === void 0 ? [] : [...
|
|
13138
|
-
if (a !== void 0) for (let l of
|
|
13434
|
+
let p = a === void 0 ? [] : [...V_(n, a.child)], m = 0;
|
|
13435
|
+
if (a !== void 0) for (let l of B_(n, a.child)) {
|
|
13139
13436
|
let h = l.type === "parent-enfant" ? l.parent : l, g = l.type === "parent-enfant" ? l : void 0;
|
|
13140
13437
|
switch (h.type) {
|
|
13141
13438
|
case "alinéa":
|
|
@@ -13143,7 +13440,7 @@ async function* D_({ ancestors: e, legiResolver: t, context: n, date: r, divisio
|
|
|
13143
13440
|
case "item":
|
|
13144
13441
|
case "phrase": break;
|
|
13145
13442
|
case "article":
|
|
13146
|
-
yield*
|
|
13443
|
+
yield* R_({
|
|
13147
13444
|
ancestors: p.length === 1 ? [...e ?? [], i] : void 0,
|
|
13148
13445
|
article: h,
|
|
13149
13446
|
legiResolver: t,
|
|
@@ -13169,7 +13466,7 @@ async function* D_({ ancestors: e, legiResolver: t, context: n, date: r, divisio
|
|
|
13169
13466
|
f !== void 0 && (a = await t.getDirectSectionChildren({
|
|
13170
13467
|
date: r,
|
|
13171
13468
|
parentPath: f.path
|
|
13172
|
-
})), yield*
|
|
13469
|
+
})), yield* U_({
|
|
13173
13470
|
ancestors: p.length === 1 ? [...e ?? [], i] : void 0,
|
|
13174
13471
|
legiResolver: t,
|
|
13175
13472
|
context: n,
|
|
@@ -13207,7 +13504,7 @@ async function* D_({ ancestors: e, legiResolver: t, context: n, date: r, divisio
|
|
|
13207
13504
|
}).filter(([, e]) => e !== void 0));
|
|
13208
13505
|
}
|
|
13209
13506
|
}
|
|
13210
|
-
function*
|
|
13507
|
+
function* W_(e, t) {
|
|
13211
13508
|
let n = Math.floor(t), r = Math.floor((t - n) * 1e3);
|
|
13212
13509
|
if (r === 0) {
|
|
13213
13510
|
for (let t of re(n)) yield `${t.toLowerCase()} ${e}`;
|
|
@@ -13217,9 +13514,9 @@ function* O_(e, t) {
|
|
|
13217
13514
|
for (let r of f(n)) yield `${e} ${t} ${r.toLowerCase()}`;
|
|
13218
13515
|
}
|
|
13219
13516
|
}
|
|
13220
|
-
async function*
|
|
13517
|
+
async function* G_({ articleDefinitionByNumByTextId: e, legiResolver: t, context: n, date: r, logIgnoredReferencesTypes: i, logPartialReferences: a, originalPositionsFromTransformedIterator: o, reference: s, state: c }) {
|
|
13221
13518
|
let l = e ?? {}, u = c === void 0 ? {} : c;
|
|
13222
|
-
for (let e of
|
|
13519
|
+
for (let e of B_(n, s)) {
|
|
13223
13520
|
let c = e.type === "parent-enfant" ? e.parent : e, d = e.type === "parent-enfant" ? e : void 0;
|
|
13224
13521
|
switch (c.type) {
|
|
13225
13522
|
case "alinéa":
|
|
@@ -13230,7 +13527,7 @@ async function* k_({ articleDefinitionByNumByTextId: e, legiResolver: t, context
|
|
|
13230
13527
|
if (c.definition && u.textId !== void 0) {
|
|
13231
13528
|
let e = l[u.textId]?.[c.num];
|
|
13232
13529
|
e !== void 0 && (e.originalTransformation === void 0 && o !== void 0 && (e.originalTransformation = v(o, e.position)), yield e);
|
|
13233
|
-
} else yield*
|
|
13530
|
+
} else yield* R_({
|
|
13234
13531
|
article: c,
|
|
13235
13532
|
legiResolver: t,
|
|
13236
13533
|
context: n,
|
|
@@ -13251,7 +13548,7 @@ async function* k_({ articleDefinitionByNumByTextId: e, legiResolver: t, context
|
|
|
13251
13548
|
case "sous-sous-paragraphe":
|
|
13252
13549
|
case "sous-titre":
|
|
13253
13550
|
case "titre":
|
|
13254
|
-
c.definition && u.textId !== void 0 || (yield*
|
|
13551
|
+
c.definition && u.textId !== void 0 || (yield* U_({
|
|
13255
13552
|
legiResolver: t,
|
|
13256
13553
|
context: n,
|
|
13257
13554
|
date: r,
|
|
@@ -13265,15 +13562,15 @@ async function* k_({ articleDefinitionByNumByTextId: e, legiResolver: t, context
|
|
|
13265
13562
|
}));
|
|
13266
13563
|
break;
|
|
13267
13564
|
case "texte": {
|
|
13268
|
-
|
|
13565
|
+
M_({
|
|
13269
13566
|
context: n,
|
|
13270
13567
|
logPartialReferences: a,
|
|
13271
13568
|
reference: s,
|
|
13272
13569
|
state: u,
|
|
13273
13570
|
text: c
|
|
13274
13571
|
});
|
|
13275
|
-
let e = d === void 0 ? [] : [...
|
|
13276
|
-
if (d !== void 0) for (let f of
|
|
13572
|
+
let e = d === void 0 ? [] : [...V_(n, d.child)], l = 0;
|
|
13573
|
+
if (d !== void 0) for (let f of B_(n, d.child)) {
|
|
13277
13574
|
let p = f.type === "parent-enfant" ? f.parent : f, m = f.type === "parent-enfant" ? f : void 0;
|
|
13278
13575
|
switch (p.type) {
|
|
13279
13576
|
case "alinéa":
|
|
@@ -13281,7 +13578,7 @@ async function* k_({ articleDefinitionByNumByTextId: e, legiResolver: t, context
|
|
|
13281
13578
|
case "item":
|
|
13282
13579
|
case "phrase": break;
|
|
13283
13580
|
case "article":
|
|
13284
|
-
yield*
|
|
13581
|
+
yield* R_({
|
|
13285
13582
|
ancestors: e.length === 1 ? [c] : void 0,
|
|
13286
13583
|
article: p,
|
|
13287
13584
|
legiResolver: t,
|
|
@@ -13307,7 +13604,7 @@ async function* k_({ articleDefinitionByNumByTextId: e, legiResolver: t, context
|
|
|
13307
13604
|
u.textId !== void 0 && (d = await t.getDirectSectionChildren({
|
|
13308
13605
|
date: r,
|
|
13309
13606
|
parentPath: u.textId
|
|
13310
|
-
})), yield*
|
|
13607
|
+
})), yield* U_({
|
|
13311
13608
|
ancestors: e.length === 1 ? [c] : void 0,
|
|
13312
13609
|
legiResolver: t,
|
|
13313
13610
|
context: n,
|
|
@@ -13358,7 +13655,7 @@ async function* k_({ articleDefinitionByNumByTextId: e, legiResolver: t, context
|
|
|
13358
13655
|
if (e !== void 0) {
|
|
13359
13656
|
for (let s of e) if (s.references !== void 0) {
|
|
13360
13657
|
let e = structuredClone(u);
|
|
13361
|
-
for (let c of s.references) yield*
|
|
13658
|
+
for (let c of s.references) yield* G_({
|
|
13362
13659
|
articleDefinitionByNumByTextId: l,
|
|
13363
13660
|
legiResolver: t,
|
|
13364
13661
|
context: n,
|
|
@@ -13375,13 +13672,13 @@ async function* k_({ articleDefinitionByNumByTextId: e, legiResolver: t, context
|
|
|
13375
13672
|
}
|
|
13376
13673
|
//#endregion
|
|
13377
13674
|
//#region src/lib/extractors/table_of_contents.ts
|
|
13378
|
-
function
|
|
13675
|
+
function K_(e) {
|
|
13379
13676
|
let t = e;
|
|
13380
13677
|
return t.items ?? [...t.articles ?? [], ...t.divisions ?? []];
|
|
13381
13678
|
}
|
|
13382
|
-
function*
|
|
13679
|
+
function* q_({ context: e, tableOfContents: t, transformation: n }) {
|
|
13383
13680
|
let r = 0, i = _e(n);
|
|
13384
|
-
for (let n of
|
|
13681
|
+
for (let n of Y_(t)) {
|
|
13385
13682
|
let t = n.line.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), a = RegExp(`^${t}$`, "m");
|
|
13386
13683
|
a.lastIndex = r;
|
|
13387
13684
|
let o = a.exec(e.input);
|
|
@@ -13393,7 +13690,7 @@ function* j_({ context: e, tableOfContents: t, transformation: n }) {
|
|
|
13393
13690
|
l.originalTransformation = c, l.position = s, yield l, r = s.stop;
|
|
13394
13691
|
}
|
|
13395
13692
|
}
|
|
13396
|
-
function
|
|
13693
|
+
function J_(e) {
|
|
13397
13694
|
let t = new n(e), r = { items: [] }, i = [];
|
|
13398
13695
|
for (let e of Tn(t)) if (dt(e)) {
|
|
13399
13696
|
let n = i.findIndex(({ type: t }) => t === e.type);
|
|
@@ -13411,14 +13708,14 @@ function M_(e) {
|
|
|
13411
13708
|
else throw Error(`Unexpected type "${e.type}" in definition:\n${JSON.stringify(e, null, 2)}`);
|
|
13412
13709
|
return r;
|
|
13413
13710
|
}
|
|
13414
|
-
function*
|
|
13711
|
+
function* Y_(e) {
|
|
13415
13712
|
e.type !== void 0 && (yield e);
|
|
13416
|
-
for (let t of
|
|
13713
|
+
for (let t of K_(e)) t.type === "article" ? yield t : yield* Y_(t);
|
|
13417
13714
|
}
|
|
13418
13715
|
//#endregion
|
|
13419
13716
|
//#region src/lib/links.ts
|
|
13420
|
-
var
|
|
13421
|
-
function
|
|
13717
|
+
var X_ = ["Exploratrice", "Forgejo"];
|
|
13718
|
+
function Z_(e, t, n) {
|
|
13422
13719
|
let r = n.match(Ke);
|
|
13423
13720
|
if (r === null) throw Error(`Unknown ID format: ${n}`);
|
|
13424
13721
|
switch (e) {
|
|
@@ -13439,19 +13736,19 @@ function F_(e, t, n) {
|
|
|
13439
13736
|
}
|
|
13440
13737
|
//#endregion
|
|
13441
13738
|
//#region src/lib/linkers/html.ts
|
|
13442
|
-
function
|
|
13739
|
+
function Q_(e, t) {
|
|
13443
13740
|
if (e !== void 0) return e;
|
|
13444
|
-
if (t !== void 0) return new
|
|
13741
|
+
if (t !== void 0) return new A_(t);
|
|
13445
13742
|
throw Error("A Canutes database or legal resolver is required");
|
|
13446
13743
|
}
|
|
13447
|
-
function
|
|
13744
|
+
function $_(e, t) {
|
|
13448
13745
|
return t.type === "reference_et_action" ? JSON.stringify({
|
|
13449
13746
|
...e,
|
|
13450
13747
|
action: t.action
|
|
13451
13748
|
}) : JSON.stringify(e);
|
|
13452
13749
|
}
|
|
13453
|
-
async function
|
|
13454
|
-
let h = new xe("addLinksToHtml"), g =
|
|
13750
|
+
async function ev({ canutesDb: e, legiResolver: t, date: r, html: i, linkBaseUrl: o, linkType: s, logIgnoredReferencesTypes: l, logPartialReferences: u, logReferences: d, onLink: f, previousContext: p, state: m }) {
|
|
13751
|
+
let h = new xe("addLinksToHtml"), g = Q_(t, e);
|
|
13455
13752
|
await h.time("preloadTextTitlesInfos", () => g.preloadTextTitlesInfos());
|
|
13456
13753
|
let _ = h.timeSync("simplifyHtml", () => a({ removeAWithHref: !0 })(i), {
|
|
13457
13754
|
inputSize: i.length,
|
|
@@ -13460,7 +13757,7 @@ async function R_({ canutesDb: e, legiResolver: t, date: r, html: i, linkBaseUrl
|
|
|
13460
13757
|
v.currentArticle = p?.currentArticle, v.currentText = p?.currentText;
|
|
13461
13758
|
let y = [], ee = { value: 0 }, te = -1;
|
|
13462
13759
|
await h.time("extractTextLinks", async () => {
|
|
13463
|
-
for await (let e of
|
|
13760
|
+
for await (let e of j_({
|
|
13464
13761
|
legiResolver: g,
|
|
13465
13762
|
context: v,
|
|
13466
13763
|
date: r,
|
|
@@ -13473,7 +13770,7 @@ async function R_({ canutesDb: e, legiResolver: t, date: r, html: i, linkBaseUrl
|
|
|
13473
13770
|
case "article_definition": {
|
|
13474
13771
|
let { article: t, originalTransformation: n, textId: r } = e;
|
|
13475
13772
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in article definition: ${JSON.stringify(e, null, 2)}`);
|
|
13476
|
-
|
|
13773
|
+
nv({
|
|
13477
13774
|
inputHtml: i,
|
|
13478
13775
|
originalTransformation: n,
|
|
13479
13776
|
output: { replacements: y },
|
|
@@ -13486,12 +13783,12 @@ async function R_({ canutesDb: e, legiResolver: t, date: r, html: i, linkBaseUrl
|
|
|
13486
13783
|
let { articleId: t, originalTransformation: n } = e;
|
|
13487
13784
|
if (t !== void 0) {
|
|
13488
13785
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in external article link: ${JSON.stringify(e, null, 2)}`);
|
|
13489
|
-
|
|
13786
|
+
nv({
|
|
13490
13787
|
inputHtml: i,
|
|
13491
13788
|
originalTransformation: n,
|
|
13492
13789
|
output: { replacements: y },
|
|
13493
13790
|
replacementCounter: ee,
|
|
13494
|
-
tagHtmlFromOriginal: (e) => `<a class="lien_article_externe" href="${
|
|
13791
|
+
tagHtmlFromOriginal: (e) => `<a class="lien_article_externe" href="${Z_(s, o, t)}">${e}</a>`
|
|
13495
13792
|
});
|
|
13496
13793
|
}
|
|
13497
13794
|
break;
|
|
@@ -13500,12 +13797,12 @@ async function R_({ canutesDb: e, legiResolver: t, date: r, html: i, linkBaseUrl
|
|
|
13500
13797
|
let { originalTransformation: t, sectionTaId: n } = e;
|
|
13501
13798
|
if (n !== void 0) {
|
|
13502
13799
|
if (t === void 0) throw Error(`Missing originalTransformation attribute in external division link: ${JSON.stringify(e, null, 2)}`);
|
|
13503
|
-
|
|
13800
|
+
nv({
|
|
13504
13801
|
inputHtml: i,
|
|
13505
13802
|
originalTransformation: t,
|
|
13506
13803
|
output: { replacements: y },
|
|
13507
13804
|
replacementCounter: ee,
|
|
13508
|
-
tagHtmlFromOriginal: (e) => `<a class="lien_division_externe" href="${
|
|
13805
|
+
tagHtmlFromOriginal: (e) => `<a class="lien_division_externe" href="${Z_(s, o, n)}">${e}</a>`
|
|
13509
13806
|
});
|
|
13510
13807
|
}
|
|
13511
13808
|
break;
|
|
@@ -13517,12 +13814,12 @@ async function R_({ canutesDb: e, legiResolver: t, date: r, html: i, linkBaseUrl
|
|
|
13517
13814
|
continue;
|
|
13518
13815
|
}
|
|
13519
13816
|
if (t === void 0) throw Error(`Missing originalTransformation attribute in external text link: ${JSON.stringify(e, null, 2)}`);
|
|
13520
|
-
|
|
13817
|
+
nv({
|
|
13521
13818
|
inputHtml: i,
|
|
13522
13819
|
originalTransformation: t,
|
|
13523
13820
|
output: { replacements: y },
|
|
13524
13821
|
replacementCounter: ee,
|
|
13525
|
-
tagHtmlFromOriginal: (e) => `<a class="lien_texte_externe" href="${
|
|
13822
|
+
tagHtmlFromOriginal: (e) => `<a class="lien_texte_externe" href="${Z_(s, o, n.cid)}">${e}</a>`
|
|
13526
13823
|
});
|
|
13527
13824
|
break;
|
|
13528
13825
|
}
|
|
@@ -13530,7 +13827,7 @@ async function R_({ canutesDb: e, legiResolver: t, date: r, html: i, linkBaseUrl
|
|
|
13530
13827
|
let { url: t, originalTransformation: n } = e;
|
|
13531
13828
|
if (t === void 0) continue;
|
|
13532
13829
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in european text link: ${JSON.stringify(e, null, 2)}`);
|
|
13533
|
-
|
|
13830
|
+
nv({
|
|
13534
13831
|
inputHtml: i,
|
|
13535
13832
|
originalTransformation: n,
|
|
13536
13833
|
output: { replacements: y },
|
|
@@ -13542,7 +13839,7 @@ async function R_({ canutesDb: e, legiResolver: t, date: r, html: i, linkBaseUrl
|
|
|
13542
13839
|
case "internal_article": {
|
|
13543
13840
|
let { definition: t, originalTransformation: n } = e;
|
|
13544
13841
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in internal article link: ${JSON.stringify(e, null, 2)}`);
|
|
13545
|
-
|
|
13842
|
+
nv({
|
|
13546
13843
|
inputHtml: i,
|
|
13547
13844
|
originalTransformation: n,
|
|
13548
13845
|
output: { replacements: y },
|
|
@@ -13554,7 +13851,7 @@ async function R_({ canutesDb: e, legiResolver: t, date: r, html: i, linkBaseUrl
|
|
|
13554
13851
|
default: c("Link", e);
|
|
13555
13852
|
}
|
|
13556
13853
|
}, { count: te + 1 });
|
|
13557
|
-
let ne = h.timeSync("applyHtmlReplacements", () =>
|
|
13854
|
+
let ne = h.timeSync("applyHtmlReplacements", () => tv(i, y), {
|
|
13558
13855
|
count: y.length,
|
|
13559
13856
|
inputSize: i.length
|
|
13560
13857
|
});
|
|
@@ -13566,13 +13863,13 @@ async function R_({ canutesDb: e, legiResolver: t, date: r, html: i, linkBaseUrl
|
|
|
13566
13863
|
output: y.length === 0 ? null : ne
|
|
13567
13864
|
};
|
|
13568
13865
|
}
|
|
13569
|
-
function
|
|
13866
|
+
function tv(e, t) {
|
|
13570
13867
|
if (t.length === 0) return e;
|
|
13571
13868
|
let n = [], r = 0;
|
|
13572
13869
|
for (let i of t.toSorted((e, t) => e.start - t.start || e.stop - t.stop || e.order - t.order)) i.start < r || (n.push(e.slice(r, i.start)), n.push(i.replacement), r = i.stop);
|
|
13573
13870
|
return n.push(e.slice(r)), n.join("");
|
|
13574
13871
|
}
|
|
13575
|
-
function
|
|
13872
|
+
function nv({ inputHtml: e, originalTransformation: t, output: n, replacementCounter: r, tagHtmlFromOriginal: i }) {
|
|
13576
13873
|
let a = d(t, i(s(e, t, 0) ?? ""));
|
|
13577
13874
|
n.replacements.push({
|
|
13578
13875
|
order: r.value++,
|
|
@@ -13581,11 +13878,11 @@ function B_({ inputHtml: e, originalTransformation: t, output: n, replacementCou
|
|
|
13581
13878
|
stop: t.position.stop
|
|
13582
13879
|
});
|
|
13583
13880
|
}
|
|
13584
|
-
function
|
|
13881
|
+
function rv({ attributes: e, inputHtml: t, originalTransformation: n, outputByType: r, replacementCounter: i }) {
|
|
13585
13882
|
let a = Object.entries(e).map(([e, t]) => `${e}="${et(t, !0)}"`).join(" ");
|
|
13586
13883
|
for (let e of ["links", "links_or_references"]) {
|
|
13587
13884
|
let o = r[e];
|
|
13588
|
-
o !== void 0 &&
|
|
13885
|
+
o !== void 0 && nv({
|
|
13589
13886
|
inputHtml: t,
|
|
13590
13887
|
originalTransformation: n,
|
|
13591
13888
|
output: o,
|
|
@@ -13594,11 +13891,11 @@ function V_({ attributes: e, inputHtml: t, originalTransformation: n, outputByTy
|
|
|
13594
13891
|
});
|
|
13595
13892
|
}
|
|
13596
13893
|
}
|
|
13597
|
-
function
|
|
13894
|
+
function iv({ id: e, outputByType: t }) {
|
|
13598
13895
|
return t.references !== void 0 || e === void 0 && t.links_or_references !== void 0;
|
|
13599
13896
|
}
|
|
13600
|
-
async function
|
|
13601
|
-
let h =
|
|
13897
|
+
async function av({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, htmlTransformation: a, inputHtml: o, linkBaseUrl: s, linkType: l, logIgnoredReferencesTypes: u, logPartialReferences: d, logReferences: f, outputTypes: p, referredLegifranceTextsInfos: m }) {
|
|
13898
|
+
let h = Q_(t, e);
|
|
13602
13899
|
await h.preloadTextTitlesInfos();
|
|
13603
13900
|
let g = new n(a.output), _ = {}, v = {};
|
|
13604
13901
|
for (let e of p) v[e] = {
|
|
@@ -13607,7 +13904,7 @@ async function U_({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
13607
13904
|
replacements: []
|
|
13608
13905
|
};
|
|
13609
13906
|
let y = { value: 0 };
|
|
13610
|
-
for await (let e of
|
|
13907
|
+
for await (let e of j_({
|
|
13611
13908
|
legiResolver: h,
|
|
13612
13909
|
context: g,
|
|
13613
13910
|
date: r,
|
|
@@ -13620,7 +13917,7 @@ async function U_({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
13620
13917
|
case "article_definition": {
|
|
13621
13918
|
let { article: t, originalTransformation: n, textId: r } = e;
|
|
13622
13919
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in article definition: ${JSON.stringify(e, null, 2)}`);
|
|
13623
|
-
for (let e of Object.values(v))
|
|
13920
|
+
for (let e of Object.values(v)) nv({
|
|
13624
13921
|
inputHtml: o,
|
|
13625
13922
|
originalTransformation: n,
|
|
13626
13923
|
output: e,
|
|
@@ -13632,10 +13929,10 @@ async function U_({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
13632
13929
|
case "external_article": {
|
|
13633
13930
|
let { article: t, articleId: n, originalTransformation: r } = e;
|
|
13634
13931
|
if (r === void 0) throw Error(`Missing originalTransformation attribute in external article link: ${JSON.stringify(e, null, 2)}`);
|
|
13635
|
-
if (n !== void 0 && (
|
|
13932
|
+
if (n !== void 0 && (rv({
|
|
13636
13933
|
attributes: {
|
|
13637
13934
|
class: "lien_article_externe",
|
|
13638
|
-
href:
|
|
13935
|
+
href: Z_(l, s, n)
|
|
13639
13936
|
},
|
|
13640
13937
|
inputHtml: o,
|
|
13641
13938
|
originalTransformation: r,
|
|
@@ -13645,14 +13942,14 @@ async function U_({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
13645
13942
|
let e = await h.getTextIdFromSegmentId(n);
|
|
13646
13943
|
e != null && (_[e] = (_[e] ?? 0) + 1);
|
|
13647
13944
|
}
|
|
13648
|
-
|
|
13945
|
+
iv({
|
|
13649
13946
|
id: n,
|
|
13650
13947
|
outputByType: v
|
|
13651
|
-
}) &&
|
|
13948
|
+
}) && ov({
|
|
13652
13949
|
attributes: {
|
|
13653
13950
|
class: "reference_article",
|
|
13654
13951
|
style: "background-color: #eae462",
|
|
13655
|
-
title:
|
|
13952
|
+
title: $_(t, e.reference)
|
|
13656
13953
|
},
|
|
13657
13954
|
id: n,
|
|
13658
13955
|
inputHtml: o,
|
|
@@ -13665,10 +13962,10 @@ async function U_({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
13665
13962
|
case "external_division": {
|
|
13666
13963
|
let { division: t, originalTransformation: n, sectionTaId: r } = e;
|
|
13667
13964
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in external division link: ${JSON.stringify(e, null, 2)}`);
|
|
13668
|
-
if (r !== void 0 && (
|
|
13965
|
+
if (r !== void 0 && (rv({
|
|
13669
13966
|
attributes: {
|
|
13670
13967
|
class: "lien_division_externe",
|
|
13671
|
-
href:
|
|
13968
|
+
href: Z_(l, s, r)
|
|
13672
13969
|
},
|
|
13673
13970
|
inputHtml: o,
|
|
13674
13971
|
originalTransformation: n,
|
|
@@ -13678,14 +13975,14 @@ async function U_({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
13678
13975
|
let e = await h.getTextIdFromSegmentId(r);
|
|
13679
13976
|
e != null && (_[e] = (_[e] ?? 0) + 1);
|
|
13680
13977
|
}
|
|
13681
|
-
|
|
13978
|
+
iv({
|
|
13682
13979
|
id: r,
|
|
13683
13980
|
outputByType: v
|
|
13684
|
-
}) &&
|
|
13981
|
+
}) && ov({
|
|
13685
13982
|
attributes: {
|
|
13686
13983
|
class: "reference_division",
|
|
13687
13984
|
style: "background-color: #eae462",
|
|
13688
|
-
title:
|
|
13985
|
+
title: $_(t, e.reference)
|
|
13689
13986
|
},
|
|
13690
13987
|
id: r,
|
|
13691
13988
|
inputHtml: o,
|
|
@@ -13698,7 +13995,7 @@ async function U_({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
13698
13995
|
case "european_text": {
|
|
13699
13996
|
let { url: t, originalTransformation: n, text: r, titleId: i } = e;
|
|
13700
13997
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in external text link: ${JSON.stringify(e, null, 2)}`);
|
|
13701
|
-
|
|
13998
|
+
rv({
|
|
13702
13999
|
attributes: {
|
|
13703
14000
|
class: "lien_texte_european",
|
|
13704
14001
|
href: t,
|
|
@@ -13708,14 +14005,14 @@ async function U_({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
13708
14005
|
originalTransformation: n,
|
|
13709
14006
|
outputByType: v,
|
|
13710
14007
|
replacementCounter: y
|
|
13711
|
-
}),
|
|
14008
|
+
}), iv({
|
|
13712
14009
|
id: i,
|
|
13713
14010
|
outputByType: v
|
|
13714
|
-
}) &&
|
|
14011
|
+
}) && ov({
|
|
13715
14012
|
attributes: {
|
|
13716
14013
|
class: "reference_texte",
|
|
13717
14014
|
style: "background-color: #eae462",
|
|
13718
|
-
title:
|
|
14015
|
+
title: $_(r, e.reference)
|
|
13719
14016
|
},
|
|
13720
14017
|
id: i,
|
|
13721
14018
|
inputHtml: o,
|
|
@@ -13728,23 +14025,23 @@ async function U_({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
13728
14025
|
case "external_text": {
|
|
13729
14026
|
let { originalTransformation: t, text: n } = e;
|
|
13730
14027
|
if (t === void 0) throw Error(`Missing originalTransformation attribute in external text link: ${JSON.stringify(e, null, 2)}`);
|
|
13731
|
-
n.cid === void 0 ? !n.present && d && console.error(`Link to text "${g.text(n.position)}" without CID: ${JSON.stringify(n, null, 2)}`) : (
|
|
14028
|
+
n.cid === void 0 ? !n.present && d && console.error(`Link to text "${g.text(n.position)}" without CID: ${JSON.stringify(n, null, 2)}`) : (rv({
|
|
13732
14029
|
attributes: {
|
|
13733
14030
|
class: "lien_texte_externe",
|
|
13734
|
-
href:
|
|
14031
|
+
href: Z_(l, s, n.cid)
|
|
13735
14032
|
},
|
|
13736
14033
|
inputHtml: o,
|
|
13737
14034
|
originalTransformation: t,
|
|
13738
14035
|
outputByType: v,
|
|
13739
14036
|
replacementCounter: y
|
|
13740
|
-
}), m && (_[n.cid] = (_[n.cid] ?? 0) + 1)),
|
|
14037
|
+
}), m && (_[n.cid] = (_[n.cid] ?? 0) + 1)), iv({
|
|
13741
14038
|
id: n.cid,
|
|
13742
14039
|
outputByType: v
|
|
13743
|
-
}) &&
|
|
14040
|
+
}) && ov({
|
|
13744
14041
|
attributes: {
|
|
13745
14042
|
class: "reference_texte",
|
|
13746
14043
|
style: "background-color: #eae462",
|
|
13747
|
-
title:
|
|
14044
|
+
title: $_(n, e.reference)
|
|
13748
14045
|
},
|
|
13749
14046
|
id: n.cid,
|
|
13750
14047
|
inputHtml: o,
|
|
@@ -13757,7 +14054,7 @@ async function U_({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
13757
14054
|
case "internal_article": {
|
|
13758
14055
|
let { definition: t, originalTransformation: n } = e;
|
|
13759
14056
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in internal article link: ${JSON.stringify(e, null, 2)}`);
|
|
13760
|
-
for (let e of Object.values(v))
|
|
14057
|
+
for (let e of Object.values(v)) nv({
|
|
13761
14058
|
inputHtml: o,
|
|
13762
14059
|
originalTransformation: n,
|
|
13763
14060
|
output: e,
|
|
@@ -13768,18 +14065,18 @@ async function U_({ canutesDb: e, legiResolver: t, date: r, defaultTextId: i, ht
|
|
|
13768
14065
|
}
|
|
13769
14066
|
default: c("Link", e);
|
|
13770
14067
|
}
|
|
13771
|
-
for (let e of Object.values(v)) e.html =
|
|
14068
|
+
for (let e of Object.values(v)) e.html = tv(o, e.replacements);
|
|
13772
14069
|
return {
|
|
13773
14070
|
outputByType: v,
|
|
13774
14071
|
referredLegifranceTextCountByCid: _
|
|
13775
14072
|
};
|
|
13776
14073
|
}
|
|
13777
|
-
function
|
|
14074
|
+
function ov({ attributes: e, id: t, inputHtml: n, originalTransformation: r, outputByType: i, replacementCounter: a }) {
|
|
13778
14075
|
let o = Object.entries(e).map(([e, t]) => `${e}="${et(t, !0)}"`).join(" ");
|
|
13779
14076
|
for (let e of ["links_or_references", "references"]) {
|
|
13780
14077
|
if (e === "links_or_references" && t !== void 0) continue;
|
|
13781
14078
|
let s = i[e];
|
|
13782
|
-
s !== void 0 &&
|
|
14079
|
+
s !== void 0 && nv({
|
|
13783
14080
|
inputHtml: n,
|
|
13784
14081
|
originalTransformation: r,
|
|
13785
14082
|
output: s,
|
|
@@ -13789,4 +14086,4 @@ function W_({ attributes: e, id: t, inputHtml: n, originalTransformation: r, out
|
|
|
13789
14086
|
}
|
|
13790
14087
|
}
|
|
13791
14088
|
//#endregion
|
|
13792
|
-
export {
|
|
14089
|
+
export { Wp as $, Pm as A, O as At, lm as B, ft as Bt, Um as C, Rt as Ct, Lm as D, ht as Dt, Rm as E, mt as Et, km as F, rt as Ft, Kp as G, cm as H, lt as Ht, xm as I, it as It, Gp as J, qp as K, ym as L, at as Lt, Im as M, tt as Mt, Am as N, nt as Nt, jm as O, _t as Ot, Om as P, ot as Pt, bp as Q, _m as R, ut as Rt, Th as S, Dt as St, Bm as T, Ot as Tt, nm as U, ct as Ut, um as V, st as Vt, $ as W, Rp as X, jp as Y, yp as Z, Gh as _, qt as _t, q_ as a, wn as at, zh as b, Bt as bt, Y_ as c, fn as ct, A_ as d, rn as dt, dp as et, y_ as f, an as ft, b_ as g, Xt as gt, w_ as h, Qt as ht, Z_ as i, xn as it, Fm as j, xt as jt, Mm as k, D as kt, j_ as l, un as lt, x_ as m, sn as mt, ev as n, _n as nt, J_ as o, pn as ot, T_ as p, nn as pt, Yp as q, X_ as r, vn as rt, K_ as s, gn as st, av as t, Tn as tt, G_ as u, tn as ut, Bh as v, Jt as vt, zm as w, zt as wt, Eh as x, Vt as xt, Vh as y, Yt as yt, dm as z, dt as zt };
|