@tricoteuses/tisseuse 0.14.1 → 0.14.3
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-IERGWCi4.js} +963 -589
- package/dist/index.js +45 -45
- package/dist/server.js +534 -419
- package/dist/src/lib/extractors/action_directives.d.ts +4 -0
- 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/index.d.ts +1 -1
- package/dist/src/lib/server/parsed_bills.d.ts +16 -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/ast.d.ts +2 -0
- package/dist/src/lib/text_parsers/citations.d.ts +4 -4
- 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/dist/src/lib/text_parsers/repeated_actions.d.ts +1 -0
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Ct as
|
|
3
|
-
import * as
|
|
4
|
-
import { createHash as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import { At as e, C as t, Ct as n, D as r, E as i, J as a, P as o, Q as s, S as c, T as l, W as u, _ as d, _t as f, a as p, bt as m, c as h, d as g, et as _, jt as ee, m as v, n as y, o as b, pt as x, q as te, t as ne, v as S, vt as re, w as ie, x as ae, y as oe, yt as C } from "./html-IERGWCi4.js";
|
|
2
|
+
import { Ct as w, D as se, E as ce, N as le, Q as ue, Tt as T, gt as E, i as de, j as fe, jt as D, kt as O, n as pe, ot as me, pt as he, r as ge, t as _e, wt as k } from "./resolver-CLdkzY2R.js";
|
|
3
|
+
import * as ve from "node:crypto";
|
|
4
|
+
import { createHash as A } from "node:crypto";
|
|
5
|
+
import j from "fs-extra";
|
|
6
|
+
import M from "node:path";
|
|
7
7
|
//#region src/lib/server/assemblee_amendment_search.ts
|
|
8
|
-
function
|
|
8
|
+
function ye(e, t) {
|
|
9
9
|
let n = e;
|
|
10
10
|
for (let e of t) {
|
|
11
11
|
if (typeof n != "object" || !n) return null;
|
|
@@ -17,26 +17,26 @@ function be(e) {
|
|
|
17
17
|
return e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim();
|
|
18
18
|
}
|
|
19
19
|
function xe(e) {
|
|
20
|
-
return be(
|
|
20
|
+
return be(_(e).text());
|
|
21
21
|
}
|
|
22
22
|
function Se(e) {
|
|
23
23
|
let t = be([
|
|
24
|
-
|
|
24
|
+
ye(e, [
|
|
25
25
|
"corps",
|
|
26
26
|
"contenuAuteur",
|
|
27
27
|
"dispositif"
|
|
28
28
|
]),
|
|
29
|
-
|
|
29
|
+
ye(e, [
|
|
30
30
|
"corps",
|
|
31
31
|
"contenuAuteur",
|
|
32
32
|
"dispositifAmdtCreditPLF"
|
|
33
33
|
]),
|
|
34
|
-
|
|
34
|
+
ye(e, [
|
|
35
35
|
"corps",
|
|
36
36
|
"contenuAuteur",
|
|
37
37
|
"dispositifAmdtCreditPLFR"
|
|
38
38
|
])
|
|
39
|
-
].filter((e) => e !== null).map((e) => xe(e)).join("\n")), n =
|
|
39
|
+
].filter((e) => e !== null).map((e) => xe(e)).join("\n")), n = ye(e, [
|
|
40
40
|
"corps",
|
|
41
41
|
"contenuAuteur",
|
|
42
42
|
"exposeSommaire"
|
|
@@ -52,7 +52,7 @@ function Se(e) {
|
|
|
52
52
|
}] : []];
|
|
53
53
|
}
|
|
54
54
|
function Ce(e, t) {
|
|
55
|
-
return
|
|
55
|
+
return A("sha256").update(JSON.stringify({
|
|
56
56
|
item: e,
|
|
57
57
|
metadata: t
|
|
58
58
|
})).digest("hex");
|
|
@@ -67,7 +67,7 @@ function P(e) {
|
|
|
67
67
|
return N(e).toLowerCase().normalize("NFD").replace(/\p{Diacritic}/gu, "");
|
|
68
68
|
}
|
|
69
69
|
function Te(e) {
|
|
70
|
-
return
|
|
70
|
+
return f(N(e));
|
|
71
71
|
}
|
|
72
72
|
function Ee(e) {
|
|
73
73
|
return `_TocArt${Te(e).replace(/\s+/gu, "")}`;
|
|
@@ -101,10 +101,10 @@ function Ae(e) {
|
|
|
101
101
|
}
|
|
102
102
|
function je(e) {
|
|
103
103
|
let t = N(e.sourceText), n = /\b(?:ins[ée]r[ée]s?|cr[ée][ée]s?|ajout[ée]s?|compl[ée]t[ée]s?\s+par)\b[\s\S]{0,160}?\barticle\s+(.+?)\s+ainsi\s+r[ée]dig[ée]s?\b/iu.exec(t);
|
|
104
|
-
if (n?.[1] !== void 0) return
|
|
104
|
+
if (n?.[1] !== void 0) return re(n[1]);
|
|
105
105
|
}
|
|
106
106
|
function Me(e) {
|
|
107
|
-
let t = Ae(e), n =
|
|
107
|
+
let t = Ae(e), n = x(t ?? "");
|
|
108
108
|
if (n.length > 0 && t !== void 0) return n.map((e, r) => {
|
|
109
109
|
let i = e.start, a = n[r + 1]?.start ?? t.length, o = t.slice(i, a).trim();
|
|
110
110
|
return {
|
|
@@ -138,7 +138,7 @@ function Fe(e) {
|
|
|
138
138
|
return N(e).replace(/[’']/gu, "'").replace(/[‐‑‒–—]/gu, "-");
|
|
139
139
|
}
|
|
140
140
|
function Ie(e, t) {
|
|
141
|
-
let n = new
|
|
141
|
+
let n = new w(e, t), r = ue(n);
|
|
142
142
|
return typeof r != "string" || n.offset <= t ? null : {
|
|
143
143
|
date: r,
|
|
144
144
|
start: t,
|
|
@@ -221,9 +221,9 @@ function We(e, t, n) {
|
|
|
221
221
|
function Ge(e, t) {
|
|
222
222
|
return t.map((t) => N(e(t).text())).filter(Boolean).join("\n");
|
|
223
223
|
}
|
|
224
|
-
function Ke(
|
|
225
|
-
let n = P(
|
|
226
|
-
return !n || we.test(n) ? "noise" :
|
|
224
|
+
function Ke(e) {
|
|
225
|
+
let n = P(e);
|
|
226
|
+
return !n || we.test(n) ? "noise" : t.test(e) ? "directive_candidate" : "context";
|
|
227
227
|
}
|
|
228
228
|
async function qe(e, t, n) {
|
|
229
229
|
if (n === void 0) throw Error("A document date is required to add links to legal references.");
|
|
@@ -231,7 +231,7 @@ async function qe(e, t, n) {
|
|
|
231
231
|
let { output: r } = await y({
|
|
232
232
|
date: n,
|
|
233
233
|
html: e,
|
|
234
|
-
legiResolver: t.legiResolver ?? new
|
|
234
|
+
legiResolver: t.legiResolver ?? new g(t.canutesDb),
|
|
235
235
|
linkBaseUrl: t.linkBaseUrl,
|
|
236
236
|
linkType: t.linkType,
|
|
237
237
|
logIgnoredReferencesTypes: t.logIgnoredReferencesTypes,
|
|
@@ -260,7 +260,7 @@ function Xe(e) {
|
|
|
260
260
|
let t = [], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
261
261
|
e("a[id], span[id], h1[id], h2[id], h3[id], h4[id], h5[id], h6[id]").each((i, a) => {
|
|
262
262
|
if (De(e, a)) return;
|
|
263
|
-
let o =
|
|
263
|
+
let o = C(N(e(a).text()));
|
|
264
264
|
if (!o) return;
|
|
265
265
|
let s = e(a).attr("id");
|
|
266
266
|
if (!s || r.has(s)) return;
|
|
@@ -273,7 +273,7 @@ function Xe(e) {
|
|
|
273
273
|
});
|
|
274
274
|
}), e("h1:not([id]), h2:not([id]), h3:not([id]), h4:not([id]), h5:not([id]), h6:not([id])").each((i, a) => {
|
|
275
275
|
if (n.has(a)) return;
|
|
276
|
-
let o =
|
|
276
|
+
let o = C(N(e(a).text()));
|
|
277
277
|
o && Ye(t, n, r, {
|
|
278
278
|
...o,
|
|
279
279
|
element: a,
|
|
@@ -294,7 +294,7 @@ function Qe(e) {
|
|
|
294
294
|
let t = [], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
295
295
|
return e("p.assnat9ArticleNum,h1,h2,h3,h4,h5,h6,p").each((i, a) => {
|
|
296
296
|
if (De(e, a) || !e(a).hasClass("assnat9ArticleNum") && !Ze(e, a)) return;
|
|
297
|
-
let o =
|
|
297
|
+
let o = C(e(a).text());
|
|
298
298
|
o && Ye(t, n, r, {
|
|
299
299
|
...o,
|
|
300
300
|
element: a,
|
|
@@ -320,7 +320,7 @@ function $e(e) {
|
|
|
320
320
|
};
|
|
321
321
|
}
|
|
322
322
|
function et(e) {
|
|
323
|
-
let t = new
|
|
323
|
+
let t = new w(e), n = me(t);
|
|
324
324
|
if (!(n === void 0 || t.offset !== e.length) && !(typeof n != "object" || !n || !("value" in n) || typeof n.value != "number")) return n.value - 1;
|
|
325
325
|
}
|
|
326
326
|
function tt(e) {
|
|
@@ -395,7 +395,7 @@ function st(e, t) {
|
|
|
395
395
|
return e.includes("class=\"assnatSection3\"") ? e.replace(/(<div class="assnatSection3">)/u, `${n}$1`) : e.includes("id=\"formCorrection:panel:1:table\"") ? e.replace(/(<div id="formCorrection:panel:1:table">)/u, `${n}$1`) : `${n}\n${e}`;
|
|
396
396
|
}
|
|
397
397
|
function ct(e) {
|
|
398
|
-
let t =
|
|
398
|
+
let t = _(e);
|
|
399
399
|
for (let e of nt(t, { warn: !1 })) {
|
|
400
400
|
let n = Ee(e.num ?? e.label.replace(/^Article\s+/iu, "")), r = t(e.element), i = r.attr("id");
|
|
401
401
|
i !== n && (i?.startsWith("_Toc") && !lt(t, i, e.element) && r.before(t("<span></span>").attr("id", i)), r.attr("id", n));
|
|
@@ -434,7 +434,7 @@ function ft(e) {
|
|
|
434
434
|
function pt(e) {
|
|
435
435
|
let t = N(e);
|
|
436
436
|
if (!t) return;
|
|
437
|
-
let n =
|
|
437
|
+
let n = s(t);
|
|
438
438
|
return n ? n.level : t.endsWith(":") ? 0 : void 0;
|
|
439
439
|
}
|
|
440
440
|
function mt(e) {
|
|
@@ -522,7 +522,7 @@ function bt(e) {
|
|
|
522
522
|
let e = ft(t);
|
|
523
523
|
e.length > 0 && (a = e), i.set(t.id, a);
|
|
524
524
|
}
|
|
525
|
-
return
|
|
525
|
+
return v(e.directiveText).map((a) => {
|
|
526
526
|
let o = vt(e, t, a), s = dt(n, o) ?? ut(e.blocks, a), c = ft(s), l = c.length > 0 ? c : s?.id === void 0 ? [] : i.get(s.id) ?? [], u = yt(e, s, a), d = gt(s?.id === void 0 ? void 0 : r.get(s.id), o, n);
|
|
527
527
|
return {
|
|
528
528
|
articleId: e.id,
|
|
@@ -591,7 +591,121 @@ function St(e, t, n) {
|
|
|
591
591
|
};
|
|
592
592
|
});
|
|
593
593
|
}
|
|
594
|
-
function Ct(e
|
|
594
|
+
function Ct(e) {
|
|
595
|
+
switch (e.kind) {
|
|
596
|
+
case "insert_after":
|
|
597
|
+
case "insert_before": return [e.insertText];
|
|
598
|
+
case "replace": return [e.replacementText];
|
|
599
|
+
case "replace_portion": return e.replacement.type === "text" ? [e.replacement.text] : [];
|
|
600
|
+
case "compound": return e.operations.flatMap((e) => {
|
|
601
|
+
switch (e.kind) {
|
|
602
|
+
case "insert_after":
|
|
603
|
+
case "insert_before": return [e.insertText];
|
|
604
|
+
case "replace": return [e.replacementText];
|
|
605
|
+
case "replace_portion": return e.replacement.type === "text" ? [e.replacement.text] : [];
|
|
606
|
+
default: return [];
|
|
607
|
+
}
|
|
608
|
+
});
|
|
609
|
+
default: return [];
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
function wt(e) {
|
|
613
|
+
return e.flatMap((e) => Ct(e.directive).filter((e) => /[«»]/u.test(e)).map((t) => ({
|
|
614
|
+
code: "nested_french_quote_in_redaction",
|
|
615
|
+
message: "Écart à la règle légistique détecté : une citation imbriquée dans une rédaction devrait utiliser des guillemets anglais et non des guillemets français.",
|
|
616
|
+
details: {
|
|
617
|
+
articleId: e.articleId,
|
|
618
|
+
blockId: e.blockId,
|
|
619
|
+
directiveKind: e.directive.kind,
|
|
620
|
+
redactionText: t,
|
|
621
|
+
sourceText: e.directive.sourceText
|
|
622
|
+
}
|
|
623
|
+
})));
|
|
624
|
+
}
|
|
625
|
+
function Tt(e) {
|
|
626
|
+
return Ct(e).map((t) => ({
|
|
627
|
+
directiveKind: e.kind,
|
|
628
|
+
text: t
|
|
629
|
+
}));
|
|
630
|
+
}
|
|
631
|
+
function Et(e) {
|
|
632
|
+
let t = /* @__PURE__ */ new Set();
|
|
633
|
+
for (let n of e.matchAll(/«[^«»\n]+»/gu)) t.add(n[0]);
|
|
634
|
+
return Array.from(t);
|
|
635
|
+
}
|
|
636
|
+
function Dt(e, t) {
|
|
637
|
+
let n = new Map(e.blocks.map((e) => [e.id, e])), r = t.sourceBlockIds ?? e.blocks.map((e) => e.id), i = [], a = 0;
|
|
638
|
+
for (let e of r) {
|
|
639
|
+
let t = n.get(e);
|
|
640
|
+
t && (i.push({
|
|
641
|
+
block: t,
|
|
642
|
+
start: a,
|
|
643
|
+
stop: a + t.text.length
|
|
644
|
+
}), a += t.text.length + 1);
|
|
645
|
+
}
|
|
646
|
+
return i;
|
|
647
|
+
}
|
|
648
|
+
function Ot(e, t, n) {
|
|
649
|
+
return e.find((e) => t >= e.start && n <= e.stop);
|
|
650
|
+
}
|
|
651
|
+
function kt(e, t, n) {
|
|
652
|
+
let r = Et(n), i = r.flatMap((t) => {
|
|
653
|
+
for (let n of e.blocks) {
|
|
654
|
+
let e = n.text.indexOf(t);
|
|
655
|
+
if (e !== -1) return [{
|
|
656
|
+
blockId: n.id,
|
|
657
|
+
start: e,
|
|
658
|
+
stop: e + t.length,
|
|
659
|
+
text: t
|
|
660
|
+
}];
|
|
661
|
+
}
|
|
662
|
+
return [];
|
|
663
|
+
});
|
|
664
|
+
if (i.length > 0) return i;
|
|
665
|
+
let a = [
|
|
666
|
+
t.sourceBlockText,
|
|
667
|
+
t.directive.sourceText,
|
|
668
|
+
e.directiveText
|
|
669
|
+
].filter((e) => e !== void 0 && e.length > 0), o = a.find((e) => r.some((t) => e.includes(t))) ?? a[0];
|
|
670
|
+
if (!o) return [];
|
|
671
|
+
let s = Dt(e, t);
|
|
672
|
+
if (s.length === 0) return [];
|
|
673
|
+
let c = [], l = 0;
|
|
674
|
+
for (let e of r) {
|
|
675
|
+
let t = o.indexOf(e, l);
|
|
676
|
+
if (t === -1) continue;
|
|
677
|
+
let n = t + e.length;
|
|
678
|
+
l = n;
|
|
679
|
+
let r = Ot(s, t, n);
|
|
680
|
+
r && c.push({
|
|
681
|
+
blockId: r.block.id,
|
|
682
|
+
start: t - r.start,
|
|
683
|
+
stop: n - r.start,
|
|
684
|
+
text: e
|
|
685
|
+
});
|
|
686
|
+
}
|
|
687
|
+
return c;
|
|
688
|
+
}
|
|
689
|
+
function At(e, t) {
|
|
690
|
+
let n = new Map(e.map((e) => [e.id, e]));
|
|
691
|
+
return t.flatMap((e) => {
|
|
692
|
+
let t = n.get(e.articleId);
|
|
693
|
+
return t ? Tt(e.directive).filter(({ text: e }) => /[«»]/u.test(e)).map(({ directiveKind: n, text: r }) => ({
|
|
694
|
+
articleId: e.articleId,
|
|
695
|
+
code: "nested_french_quote_in_redaction",
|
|
696
|
+
message: "Écart à la règle légistique détecté : une citation imbriquée dans une rédaction devrait utiliser des guillemets anglais et non des guillemets français.",
|
|
697
|
+
ranges: kt(t, e, r),
|
|
698
|
+
severity: "warning",
|
|
699
|
+
details: {
|
|
700
|
+
blockId: e.blockId,
|
|
701
|
+
directiveKind: n,
|
|
702
|
+
redactionText: r,
|
|
703
|
+
sourceText: e.directive.sourceText
|
|
704
|
+
}
|
|
705
|
+
})) : [];
|
|
706
|
+
});
|
|
707
|
+
}
|
|
708
|
+
function jt(e, t, n, r, i, a, o = !0, s) {
|
|
595
709
|
let c = i.map((e) => e.directiveText).filter(Boolean).join("\n"), l = {
|
|
596
710
|
sourceFormat: e,
|
|
597
711
|
documentDate: r,
|
|
@@ -604,27 +718,28 @@ function Ct(e, t, n, r, i, a, o = !0, s) {
|
|
|
604
718
|
...l,
|
|
605
719
|
directives: []
|
|
606
720
|
};
|
|
607
|
-
let u = ze(i.map((e) => e.text).join("\n")), d = i.flatMap(bt), { createdArticlesByDirective: f, definitions: p } = xt(d), m = St(d, p, f);
|
|
721
|
+
let u = ze(i.map((e) => e.text).join("\n")), d = i.flatMap(bt), { createdArticlesByDirective: f, definitions: p } = xt(d), m = St(d, p, f), h = [...s ?? [], ...wt(m)], g = At(i, m);
|
|
608
722
|
return {
|
|
609
723
|
...l,
|
|
610
724
|
...u ? { globalApplicabilityDate: u } : {},
|
|
611
725
|
...p.length > 0 ? { internalArticleDefinitions: p } : {},
|
|
612
726
|
directives: m,
|
|
613
|
-
...
|
|
727
|
+
...g.length > 0 ? { annotations: g } : {},
|
|
728
|
+
...h.length > 0 ? { diagnostics: h } : {}
|
|
614
729
|
};
|
|
615
730
|
}
|
|
616
|
-
function
|
|
731
|
+
function Mt(e) {
|
|
617
732
|
return { items: e.map((e) => ({
|
|
618
733
|
id: e.id,
|
|
619
734
|
line: e.title ? `${e.label} : ${e.title}` : e.label,
|
|
620
735
|
type: "article"
|
|
621
736
|
})) };
|
|
622
737
|
}
|
|
623
|
-
function
|
|
624
|
-
return Array.from(
|
|
738
|
+
function Nt(e) {
|
|
739
|
+
return Array.from(h(e)).filter((e) => e.type === "article").map((e) => P(e.line.split(/[::]/u)[0]));
|
|
625
740
|
}
|
|
626
|
-
function
|
|
627
|
-
let t =
|
|
741
|
+
function Pt(e) {
|
|
742
|
+
let t = Nt(b(e.map((e) => e.directiveText).filter(Boolean).join("\n"))), n = e.map((e) => P(e.label)), r = [];
|
|
628
743
|
if (t.length > 0 && (t.length !== n.length || t.some((e, t) => e !== n[t]))) {
|
|
629
744
|
let i = t.findIndex((e, t) => e !== n[t]);
|
|
630
745
|
r.push({
|
|
@@ -645,11 +760,11 @@ function Et(e) {
|
|
|
645
760
|
}
|
|
646
761
|
return {
|
|
647
762
|
diagnostics: r,
|
|
648
|
-
tableOfContents:
|
|
763
|
+
tableOfContents: Mt(e)
|
|
649
764
|
};
|
|
650
765
|
}
|
|
651
|
-
async function
|
|
652
|
-
let n = new
|
|
766
|
+
async function Ft(e, t) {
|
|
767
|
+
let n = new pe("parseAssembleeBillRaw"), r = t.linkedHtml === void 0 ? await n.time("linkAssembleeBillRaw", () => It(e, t)) : void 0, i = n.timeSync("applyArticleAnchorIds", () => ct(t.linkedHtml ?? r.linkedHtml), { inputSize: e.length }), a = n.timeSync("cheerioLoadLinkedHtml", () => _(i)), o = n.timeSync("extractArticleHeadings", () => nt(a)), s = n.timeSync("extractArticlesAndBlocks", () => o.map((e, t) => {
|
|
653
768
|
let n = it(a, e, o[t + 1]), r = ot(a, e.id, n), i = r.filter((e) => e.kind !== "noise").map((e) => e.text).join("\n");
|
|
654
769
|
return {
|
|
655
770
|
id: e.id,
|
|
@@ -661,15 +776,15 @@ async function Dt(e, t) {
|
|
|
661
776
|
directiveText: i,
|
|
662
777
|
blocks: r
|
|
663
778
|
};
|
|
664
|
-
}), { count: o.length }), c = n.timeSync("injectHiddenArticleSummary", () => st(a.html(), s)), { diagnostics: l, tableOfContents:
|
|
665
|
-
return
|
|
666
|
-
articleCount:
|
|
667
|
-
blockCount:
|
|
668
|
-
directiveCount:
|
|
669
|
-
targetDirectiveCount:
|
|
670
|
-
}),
|
|
779
|
+
}), { count: o.length }), c = n.timeSync("injectHiddenArticleSummary", () => st(a.html(), s)), { diagnostics: l, tableOfContents: u } = n.timeSync("buildAssembleeTableOfContents", () => Pt(s), { count: s.length }), d = n.timeSync("buildParsedDocument", () => jt("assemblee-html", e, c, t.date, s, u, t.includeDirectiveAnalysis, l));
|
|
780
|
+
return d.diagnostics?.length && process.env.TISSEUSE_WARN_PARSED_BILL_DIAGNOSTICS === "1" && console.warn("Assemblée bill parsing diagnostics", d.diagnostics), n.log({
|
|
781
|
+
articleCount: d.articles.length,
|
|
782
|
+
blockCount: d.articles.reduce((e, t) => e + t.blocks.length, 0),
|
|
783
|
+
directiveCount: d.directives.length,
|
|
784
|
+
targetDirectiveCount: d.directives.filter((e) => e.targetIds !== void 0).length
|
|
785
|
+
}), d;
|
|
671
786
|
}
|
|
672
|
-
async function
|
|
787
|
+
async function It(e, t) {
|
|
673
788
|
return {
|
|
674
789
|
sourceFormat: "assemblee-html",
|
|
675
790
|
documentDate: t.date,
|
|
@@ -680,7 +795,7 @@ async function Ot(e, t) {
|
|
|
680
795
|
function I(e) {
|
|
681
796
|
return e.replace(/&/gu, "&").replace(/</gu, "<").replace(/>/gu, ">").replace(/"/gu, """);
|
|
682
797
|
}
|
|
683
|
-
function
|
|
798
|
+
function Lt(e) {
|
|
684
799
|
let t = e;
|
|
685
800
|
for (let e = 0; e < 3; e++) {
|
|
686
801
|
let e = t;
|
|
@@ -688,25 +803,25 @@ function kt(e) {
|
|
|
688
803
|
}
|
|
689
804
|
return t;
|
|
690
805
|
}
|
|
691
|
-
function
|
|
806
|
+
function Rt(e) {
|
|
692
807
|
return /(?:<|&lt;)\/?(?:p|br|span|b|i|u|sup|sub|table|thead|tbody|tr|th|td|ul|ol|li)\b/iu.test(e);
|
|
693
808
|
}
|
|
694
809
|
function L(e) {
|
|
695
810
|
return e.name.replace(/^.*:/u, "");
|
|
696
811
|
}
|
|
697
|
-
function
|
|
812
|
+
function zt(e, t) {
|
|
698
813
|
return t.children.map((t) => R(e, t)).filter(Boolean).join("");
|
|
699
814
|
}
|
|
700
|
-
function
|
|
701
|
-
return t.children.map((t) => t.type === "text" &&
|
|
815
|
+
function Bt(e, t) {
|
|
816
|
+
return t.children.map((t) => t.type === "text" && Rt(t.data) ? Lt(t.data) : R(e, t)).filter(Boolean).join("");
|
|
702
817
|
}
|
|
703
818
|
function R(e, t) {
|
|
704
819
|
if (t.type === "text") {
|
|
705
820
|
let e = t.data.replace(/\s+\./gu, ".");
|
|
706
|
-
return
|
|
821
|
+
return Rt(e) ? Lt(e) : I(e);
|
|
707
822
|
}
|
|
708
823
|
if (!F(t)) return "";
|
|
709
|
-
let n = L(t), r =
|
|
824
|
+
let n = L(t), r = zt(e, t);
|
|
710
825
|
switch (n) {
|
|
711
826
|
case "p": return `<p${z(e, t, [
|
|
712
827
|
"id",
|
|
@@ -739,7 +854,7 @@ function R(e, t) {
|
|
|
739
854
|
case "tbody":
|
|
740
855
|
case "tr":
|
|
741
856
|
case "th":
|
|
742
|
-
case "td": return
|
|
857
|
+
case "td": return Vt(e, t, n, r);
|
|
743
858
|
case "caption": return `<caption${z(e, t, [
|
|
744
859
|
"id",
|
|
745
860
|
"class",
|
|
@@ -748,7 +863,7 @@ function R(e, t) {
|
|
|
748
863
|
])}>${r}</caption>`;
|
|
749
864
|
case "num": return `<span class="akn-num">${r}</span> `;
|
|
750
865
|
case "heading": return `<p class="akn-heading">${r}</p>`;
|
|
751
|
-
case "content": return
|
|
866
|
+
case "content": return Bt(e, t);
|
|
752
867
|
case "alinea": return B(e, t, "div", "akn-alinea");
|
|
753
868
|
case "article": return B(e, t, "article", "akn-article");
|
|
754
869
|
case "blockList":
|
|
@@ -784,7 +899,7 @@ function z(e, t, n, r = {}) {
|
|
|
784
899
|
let a = r.style ?? e(t).attr("style");
|
|
785
900
|
return a && i.push(`style="${I(a)}"`), i.length > 0 ? ` ${i.join(" ")}` : "";
|
|
786
901
|
}
|
|
787
|
-
function
|
|
902
|
+
function Vt(e, t, n, r) {
|
|
788
903
|
return `<${n}${z(e, t, [
|
|
789
904
|
"id",
|
|
790
905
|
"class",
|
|
@@ -798,56 +913,56 @@ function Nt(e, t, n, r) {
|
|
|
798
913
|
"cellspacing",
|
|
799
914
|
"cellpadding",
|
|
800
915
|
"style"
|
|
801
|
-
], { style:
|
|
916
|
+
], { style: Ht(e, t, n) })}>${r}</${n}>`;
|
|
802
917
|
}
|
|
803
|
-
function
|
|
918
|
+
function Ht(e, t, n) {
|
|
804
919
|
let r = e(t).attr("style") ?? "";
|
|
805
|
-
return (n === "td" || n === "th") && /font-weight\s*:\s*bold/iu.test(r) && !/text-align\s*:/iu.test(r) && (r =
|
|
920
|
+
return (n === "td" || n === "th") && /font-weight\s*:\s*bold/iu.test(r) && !/text-align\s*:/iu.test(r) && (r = Ut(r, "text-align", "center")), r || void 0;
|
|
806
921
|
}
|
|
807
|
-
function
|
|
922
|
+
function Ut(e, t, n) {
|
|
808
923
|
let r = e.trim();
|
|
809
924
|
return `${r}${r && !r.endsWith(";") ? ";" : ""} ${t}: ${n};`.trim();
|
|
810
925
|
}
|
|
811
|
-
function
|
|
926
|
+
function Wt(e, t) {
|
|
812
927
|
let n = [N(e(t).children("num").first().text()), N(e(t).children("heading").first().text())].filter(Boolean);
|
|
813
928
|
return n.length === 0 ? "" : `<p class="akn-heading">${I(n.join(" "))}</p>`;
|
|
814
929
|
}
|
|
815
|
-
function
|
|
930
|
+
function Gt(e, t) {
|
|
816
931
|
if (!t) return !1;
|
|
817
932
|
let n = (e) => N(e).replace(/\s+/gu, " ").replace(/\s*[..]\s*(?=[–—-])/gu, " ").trim();
|
|
818
933
|
return n(N(e.replace(/<[^>]*>/gu, " ").replace(/ /gu, " ").replace(/ /giu, " ").replace(/–/giu, "–"))).startsWith(n(t));
|
|
819
934
|
}
|
|
820
|
-
function
|
|
935
|
+
function Kt(e) {
|
|
821
936
|
let t = I(e);
|
|
822
937
|
return `<p data-pastille="${t}" class="pastille"><span aria-label="pastille ${t}">${t}</span></p>`;
|
|
823
938
|
}
|
|
824
|
-
function
|
|
825
|
-
return
|
|
939
|
+
function qt(e, t) {
|
|
940
|
+
return Jt([Yt({
|
|
826
941
|
content: e,
|
|
827
942
|
pastille: t
|
|
828
943
|
})]);
|
|
829
944
|
}
|
|
830
|
-
function
|
|
945
|
+
function Jt(e) {
|
|
831
946
|
return `<table class="fixed-size large akn-pastille-table"><colgroup><col style="width: 5.0%;" class="texte-col-0 texte-col-pastille"><col style="width: 95.0%;" class="texte-col-1"></colgroup><tbody>${e.join("\n")}</tbody></table>`;
|
|
832
947
|
}
|
|
833
|
-
function
|
|
948
|
+
function Yt({ content: e, pastille: t, style: n, contextClass: r }) {
|
|
834
949
|
let i = n ? ` style="${I(n)}"` : "", a = r ? ` ${I(r)}` : "";
|
|
835
|
-
return `<tr${r ? ` class="${I(r)} hideable"` : ""}><td style="overflow: hidden; width: 5.0%;" class="texte-col-0 texte-col-pastille no-right-border"><div class="tableauComparatifCell${a}">${
|
|
950
|
+
return `<tr${r ? ` class="${I(r)} hideable"` : ""}><td style="overflow: hidden; width: 5.0%;" class="texte-col-0 texte-col-pastille no-right-border"><div class="tableauComparatifCell${a}">${Kt(t)}</div></td><td style="overflow: hidden; width: 95.0%;" class="texte-col-1 no-right-border"><div class="tableauComparatifCell${a}"${i}>${e}</div></td></tr>`;
|
|
836
951
|
}
|
|
837
|
-
function
|
|
952
|
+
function Xt({ content: e, style: t, contextClass: n }) {
|
|
838
953
|
let r = t ? ` style="${I(t)}"` : "", i = n ? ` ${I(n)}` : "";
|
|
839
954
|
return `<tr${n ? ` class="${I(n)} hideable"` : ""}><td style="overflow: hidden; width: 5.0%;" class="texte-col-0 no-right-border"><div class="tableauComparatifCell${i}"><p class="pastille"><br></p></div></td><td style="overflow: hidden; width: 95.0%;" class="texte-col-1 no-right-border"><div class="tableauComparatifCell${i}"${r}>${e}</div></td></tr>`;
|
|
840
955
|
}
|
|
841
|
-
function
|
|
956
|
+
function Zt(e, t) {
|
|
842
957
|
return e(t).attr("data:pastille") ?? e(t).attr("pastille");
|
|
843
958
|
}
|
|
844
|
-
function
|
|
959
|
+
function Qt(e, t) {
|
|
845
960
|
return e(t).find("alinea[data\\:pastille],alinea[pastille]").length > 0;
|
|
846
961
|
}
|
|
847
|
-
function
|
|
962
|
+
function $t(e, t) {
|
|
848
963
|
return e(t).children().get().filter((e) => F(e) ? L(e) === "content" : !1).map((t) => R(e, t)).filter(Boolean).join("\n");
|
|
849
964
|
}
|
|
850
|
-
function
|
|
965
|
+
function en(e, t) {
|
|
851
966
|
let n = [];
|
|
852
967
|
return e(t).children().each((t, r) => {
|
|
853
968
|
if (!F(r)) return;
|
|
@@ -855,17 +970,17 @@ function Kt(e, t) {
|
|
|
855
970
|
i === "num" || i === "heading" || i === "content" || n.push(R(e, r));
|
|
856
971
|
}), n.filter(Boolean);
|
|
857
972
|
}
|
|
858
|
-
function
|
|
859
|
-
let n = [], r = L(t), i = r === "alinea" ?
|
|
973
|
+
function tn(e, t) {
|
|
974
|
+
let n = [], r = L(t), i = r === "alinea" ? Zt(e, t) : void 0, a = $t(e, t), o = nn(e, t, r, i), s = ln(e, t);
|
|
860
975
|
if (i) {
|
|
861
|
-
let r = [
|
|
862
|
-
N(r) && n.push(
|
|
976
|
+
let r = [Gt(a, N(e(t).children("num").first().text())) ? "" : Wt(e, t), a].filter(Boolean).join("\n");
|
|
977
|
+
N(r) && n.push(Yt({
|
|
863
978
|
content: r,
|
|
864
979
|
pastille: i,
|
|
865
980
|
style: o,
|
|
866
981
|
contextClass: s
|
|
867
982
|
}));
|
|
868
|
-
} else a && n.push(
|
|
983
|
+
} else a && n.push(Xt({
|
|
869
984
|
content: a,
|
|
870
985
|
style: o,
|
|
871
986
|
contextClass: s
|
|
@@ -873,30 +988,30 @@ function qt(e, t) {
|
|
|
873
988
|
for (let r of e(t).children().get()) {
|
|
874
989
|
if (!F(r)) continue;
|
|
875
990
|
let t = L(r);
|
|
876
|
-
t === "num" || t === "heading" || t === "content" || (t === "alinea" ||
|
|
991
|
+
t === "num" || t === "heading" || t === "content" || (t === "alinea" || Qt(e, r)) && n.push(...tn(e, r));
|
|
877
992
|
}
|
|
878
993
|
return n;
|
|
879
994
|
}
|
|
880
995
|
function B(e, t, n, r) {
|
|
881
|
-
let i = L(t), a = e(t).attr("eId") ?? e(t).attr("GUID"), o =
|
|
996
|
+
let i = L(t), a = e(t).attr("eId") ?? e(t).attr("GUID"), o = Zt(e, t), s = nn(e, t, i, o), c = [`<${n} ${[
|
|
882
997
|
a ? `id="${I(a)}"` : void 0,
|
|
883
998
|
`class="${r}"`,
|
|
884
999
|
o ? `data-pastille="${I(o)}"` : void 0,
|
|
885
1000
|
s ? `style="${I(s)}"` : void 0
|
|
886
1001
|
].filter((e) => e !== void 0).join(" ")}>`];
|
|
887
1002
|
if (i === "part" || i === "title") {
|
|
888
|
-
let r =
|
|
1003
|
+
let r = on(e, t, i), a = cn(e, t), o = r ? [Xt({
|
|
889
1004
|
content: r,
|
|
890
1005
|
contextClass: a
|
|
891
1006
|
})] : [], s = () => {
|
|
892
|
-
o.length !== 0 && (c.push(
|
|
1007
|
+
o.length !== 0 && (c.push(an(o)), o = []);
|
|
893
1008
|
};
|
|
894
1009
|
return e(t).children().each((t, n) => {
|
|
895
1010
|
if (!F(n)) return;
|
|
896
1011
|
let r = L(n);
|
|
897
1012
|
if (!(r === "num" || r === "heading" || r === "content")) {
|
|
898
1013
|
if (r === "alinea") {
|
|
899
|
-
o.push(...
|
|
1014
|
+
o.push(...tn(e, n));
|
|
900
1015
|
return;
|
|
901
1016
|
}
|
|
902
1017
|
s(), c.push(R(e, n));
|
|
@@ -904,17 +1019,17 @@ function B(e, t, n, r) {
|
|
|
904
1019
|
}), s(), c.push(`</${n}>`), c.join("\n");
|
|
905
1020
|
}
|
|
906
1021
|
if (i === "article") {
|
|
907
|
-
let r = N(e(t).children("num").first().text()), i = N(e(t).children("heading").first().text()), a =
|
|
1022
|
+
let r = N(e(t).children("num").first().text()), i = N(e(t).children("heading").first().text()), a = C(r) ?? {
|
|
908
1023
|
label: r,
|
|
909
1024
|
num: r
|
|
910
1025
|
}, o = `<p class="TCNumArticle as-text toc-article dispositif" id="${I(`_TocArt${(a.num ?? r).replace(/\s+/gu, "")}`)}">${I(a.label)}${i ? ` : ${I(i)}` : ""}</p>`;
|
|
911
|
-
if (
|
|
912
|
-
let r = [
|
|
1026
|
+
if (Qt(e, t)) {
|
|
1027
|
+
let r = [Xt({
|
|
913
1028
|
content: o,
|
|
914
|
-
contextClass:
|
|
915
|
-
}), ...
|
|
916
|
-
c.push(
|
|
917
|
-
for (let n of
|
|
1029
|
+
contextClass: dn(a.label)
|
|
1030
|
+
}), ...tn(e, t)];
|
|
1031
|
+
c.push(Jt(r));
|
|
1032
|
+
for (let n of en(e, t)) n.includes("akn-pastille-table") || c.push(n);
|
|
918
1033
|
return c.push(`</${n}>`), c.join("\n");
|
|
919
1034
|
}
|
|
920
1035
|
c.push(o);
|
|
@@ -927,26 +1042,26 @@ function B(e, t, n, r) {
|
|
|
927
1042
|
});
|
|
928
1043
|
let u = l.join("\n");
|
|
929
1044
|
if (i !== "article") {
|
|
930
|
-
let n =
|
|
1045
|
+
let n = Gt(u, N(e(t).children("num").first().text())) ? "" : Wt(e, t);
|
|
931
1046
|
n && c.push(n);
|
|
932
1047
|
}
|
|
933
|
-
return c.push(o ?
|
|
1048
|
+
return c.push(o ? qt(u, o) : u), c.push(`</${n}>`), c.join("\n");
|
|
934
1049
|
}
|
|
935
|
-
function
|
|
936
|
-
let i =
|
|
937
|
-
return !r && n !== "article" && /font-weight\s*:\s*bold/iu.test(i) && !/text-align\s*:/iu.test(i) && (i =
|
|
1050
|
+
function nn(e, t, n, r) {
|
|
1051
|
+
let i = rn(e(t).attr("style") ?? "", "font-family");
|
|
1052
|
+
return !r && n !== "article" && /font-weight\s*:\s*bold/iu.test(i) && !/text-align\s*:/iu.test(i) && (i = Ut(i, "text-align", "center")), i || void 0;
|
|
938
1053
|
}
|
|
939
|
-
function
|
|
1054
|
+
function rn(e, t) {
|
|
940
1055
|
return e.split(";").map((e) => e.trim()).filter(Boolean).filter((e) => !e.toLowerCase().startsWith(`${t.toLowerCase()}:`)).join(";");
|
|
941
1056
|
}
|
|
942
|
-
function
|
|
1057
|
+
function an(e) {
|
|
943
1058
|
return `<table class="fixed-size large akn-section-table"><colgroup><col style="width: 5.0%;" class="texte-col-0 texte-col-pastille"><col style="width: 95.0%;" class="texte-col-1"></colgroup><tbody>${e.join("\n")}</tbody></table>`;
|
|
944
1059
|
}
|
|
945
|
-
function
|
|
946
|
-
let r = N(e(t).children("num").first().text()), i = N(e(t).children("heading").first().text()), a =
|
|
1060
|
+
function on(e, t, n) {
|
|
1061
|
+
let r = N(e(t).children("num").first().text()), i = N(e(t).children("heading").first().text()), a = sn(n), o = [];
|
|
947
1062
|
return r && o.push(`<p class="${a.num} as-text dispositif"><span aria-label="">${I(r)}</span></p>`), i && o.push(`<p class="${a.heading} as-text dispositif"><span aria-label="">${I(i)}</span></p>`), o.join("\n");
|
|
948
1063
|
}
|
|
949
|
-
function
|
|
1064
|
+
function sn(e) {
|
|
950
1065
|
switch (e) {
|
|
951
1066
|
case "part": return {
|
|
952
1067
|
num: "TCNumPartie",
|
|
@@ -970,21 +1085,21 @@ function Qt(e) {
|
|
|
970
1085
|
};
|
|
971
1086
|
}
|
|
972
1087
|
}
|
|
973
|
-
function
|
|
974
|
-
let n =
|
|
1088
|
+
function cn(e, t) {
|
|
1089
|
+
let n = un(N(e(t).children("num").first().text()));
|
|
975
1090
|
if (n) return n;
|
|
976
1091
|
for (let n of e(t).parents().get()) {
|
|
977
1092
|
if (!F(n)) continue;
|
|
978
1093
|
let t = L(n);
|
|
979
1094
|
if (t !== "title" && t !== "part") continue;
|
|
980
|
-
let r =
|
|
1095
|
+
let r = un(N(e(n).children("num").first().text()));
|
|
981
1096
|
if (r) return r;
|
|
982
1097
|
}
|
|
983
1098
|
}
|
|
984
|
-
function
|
|
985
|
-
return
|
|
1099
|
+
function ln(e, t) {
|
|
1100
|
+
return cn(e, t);
|
|
986
1101
|
}
|
|
987
|
-
function
|
|
1102
|
+
function un(e) {
|
|
988
1103
|
let [t, ...n] = N(e).split(/\s+/u);
|
|
989
1104
|
if (!t || n.length === 0) return;
|
|
990
1105
|
let r = t.toLocaleLowerCase("fr-FR");
|
|
@@ -995,10 +1110,10 @@ function tn(e) {
|
|
|
995
1110
|
"section"
|
|
996
1111
|
].includes(r)) return `${r}-${n.join("_")}`;
|
|
997
1112
|
}
|
|
998
|
-
function
|
|
1113
|
+
function dn(e) {
|
|
999
1114
|
return `article-${N(e).replace(/^Article\s+/iu, "").replace(/\s+/gu, "_")} article`;
|
|
1000
1115
|
}
|
|
1001
|
-
function
|
|
1116
|
+
function fn(e) {
|
|
1002
1117
|
switch (e) {
|
|
1003
1118
|
case "part": return "partie";
|
|
1004
1119
|
case "book": return "livre";
|
|
@@ -1010,11 +1125,11 @@ function rn(e) {
|
|
|
1010
1125
|
default: return;
|
|
1011
1126
|
}
|
|
1012
1127
|
}
|
|
1013
|
-
function
|
|
1128
|
+
function pn(e, t) {
|
|
1014
1129
|
return [N(e(t).children("num").first().text()), N(e(t).children("heading").first().text())].filter(Boolean).join(" ");
|
|
1015
1130
|
}
|
|
1016
|
-
function
|
|
1017
|
-
let n = N(e(t).children("num").first().text()), r = N(e(t).children("heading").first().text()), i =
|
|
1131
|
+
function mn(e, t) {
|
|
1132
|
+
let n = N(e(t).children("num").first().text()), r = N(e(t).children("heading").first().text()), i = C(n) ?? {
|
|
1018
1133
|
label: n,
|
|
1019
1134
|
num: n
|
|
1020
1135
|
};
|
|
@@ -1024,24 +1139,24 @@ function on(e, t) {
|
|
|
1024
1139
|
type: "article"
|
|
1025
1140
|
};
|
|
1026
1141
|
}
|
|
1027
|
-
function
|
|
1142
|
+
function hn(e, t) {
|
|
1028
1143
|
e.items.push(...t.items);
|
|
1029
1144
|
}
|
|
1030
|
-
function
|
|
1145
|
+
function gn(e, t) {
|
|
1031
1146
|
let n = { items: [] };
|
|
1032
1147
|
return e(t).children().each((t, r) => {
|
|
1033
1148
|
if (!F(r)) return;
|
|
1034
1149
|
let i = L(r);
|
|
1035
1150
|
if (i === "article") {
|
|
1036
|
-
n.items.push(
|
|
1151
|
+
n.items.push(mn(e, r));
|
|
1037
1152
|
return;
|
|
1038
1153
|
}
|
|
1039
|
-
let a =
|
|
1154
|
+
let a = fn(i);
|
|
1040
1155
|
if (!a) {
|
|
1041
|
-
|
|
1156
|
+
hn(n, gn(e, r));
|
|
1042
1157
|
return;
|
|
1043
1158
|
}
|
|
1044
|
-
let o =
|
|
1159
|
+
let o = pn(e, r), s = gn(e, r);
|
|
1045
1160
|
!o && s.items.length === 0 || n.items.push({
|
|
1046
1161
|
...s,
|
|
1047
1162
|
id: e(r).attr("eId") ?? e(r).attr("GUID"),
|
|
@@ -1050,26 +1165,26 @@ function cn(e, t) {
|
|
|
1050
1165
|
});
|
|
1051
1166
|
}), n;
|
|
1052
1167
|
}
|
|
1053
|
-
function
|
|
1168
|
+
function _n(e) {
|
|
1054
1169
|
let t = e("body").first().get(0);
|
|
1055
|
-
return t === void 0 ? { items: [] } :
|
|
1170
|
+
return t === void 0 ? { items: [] } : gn(e, t);
|
|
1056
1171
|
}
|
|
1057
|
-
function
|
|
1172
|
+
function vn(e) {
|
|
1058
1173
|
return e("FRBRExpression FRBRdate[name=\"#depot\"]").attr("date") ?? e("FRBRWork FRBRdate[name=\"#presentation\"]").attr("date");
|
|
1059
1174
|
}
|
|
1060
|
-
function
|
|
1175
|
+
function yn(e) {
|
|
1061
1176
|
let t = e("preamble").first(), n = e("body").first(), r = ["<div class=\"akn-bill\">"];
|
|
1062
|
-
return t.length > 0 && (r.push("<section class=\"akn-preamble\">"), r.push(
|
|
1177
|
+
return t.length > 0 && (r.push("<section class=\"akn-preamble\">"), r.push(zt(e, t.get(0))), r.push("</section>")), r.push("<section class=\"akn-body\">"), n.children().each((t, n) => {
|
|
1063
1178
|
F(n) && r.push(L(n) === "article" ? B(e, n, "article", "akn-article") : R(e, n));
|
|
1064
1179
|
}), r.push("</section></div>"), r.join("\n");
|
|
1065
1180
|
}
|
|
1066
|
-
function
|
|
1067
|
-
let t =
|
|
1181
|
+
function bn(e) {
|
|
1182
|
+
let t = _(e, { xml: {
|
|
1068
1183
|
decodeEntities: !1,
|
|
1069
1184
|
lowerCaseTags: !1,
|
|
1070
1185
|
lowerCaseAttributeNames: !1,
|
|
1071
1186
|
xmlMode: !0
|
|
1072
|
-
} }), n =
|
|
1187
|
+
} }), n = vn(t), r = yn(t);
|
|
1073
1188
|
return {
|
|
1074
1189
|
sourceFormat: "akoma-ntoso",
|
|
1075
1190
|
documentDate: n,
|
|
@@ -1077,13 +1192,13 @@ function fn(e) {
|
|
|
1077
1192
|
linkedHtml: r
|
|
1078
1193
|
};
|
|
1079
1194
|
}
|
|
1080
|
-
function
|
|
1081
|
-
return
|
|
1195
|
+
function xn(e) {
|
|
1196
|
+
return Sn(_(e));
|
|
1082
1197
|
}
|
|
1083
|
-
function
|
|
1198
|
+
function Sn(e) {
|
|
1084
1199
|
let t = [];
|
|
1085
1200
|
return e("article.akn-article").each((n, r) => {
|
|
1086
|
-
let i = e(r).children("p.TCNumArticle").first().get(0), a = N(i ? e(i).text() : ""), o =
|
|
1201
|
+
let i = e(r).children("p.TCNumArticle").first().get(0), a = N(i ? e(i).text() : ""), o = C(a) ?? { label: a || `Article ${n + 1}` }, s = e(r).attr("id") ?? `akn-article-${String(n + 1).padStart(3, "0")}`, c = [r], l = ot(e, s, c), u = l.filter((e) => e.kind !== "noise").map((e) => e.text).join("\n");
|
|
1087
1202
|
t.push({
|
|
1088
1203
|
id: s,
|
|
1089
1204
|
label: o.label,
|
|
@@ -1096,32 +1211,32 @@ function mn(e) {
|
|
|
1096
1211
|
});
|
|
1097
1212
|
}), t;
|
|
1098
1213
|
}
|
|
1099
|
-
function
|
|
1100
|
-
let t =
|
|
1214
|
+
function Cn(e) {
|
|
1215
|
+
let t = _(e);
|
|
1101
1216
|
return {
|
|
1102
|
-
articles:
|
|
1217
|
+
articles: Sn(t),
|
|
1103
1218
|
htmlWithLinks: t.html()
|
|
1104
1219
|
};
|
|
1105
1220
|
}
|
|
1106
|
-
async function
|
|
1107
|
-
let n = new
|
|
1221
|
+
async function wn(e, t) {
|
|
1222
|
+
let n = new pe("parseAkomaNtosoBillRaw"), r = n.timeSync("cheerioLoadXml", () => _(e, { xml: {
|
|
1108
1223
|
decodeEntities: !1,
|
|
1109
1224
|
lowerCaseTags: !1,
|
|
1110
1225
|
lowerCaseAttributeNames: !1,
|
|
1111
1226
|
xmlMode: !0
|
|
1112
|
-
} })), i = t.date ??
|
|
1227
|
+
} })), i = t.date ?? vn(r), a = n.timeSync("renderAknHtml", () => yn(r), { inputSize: e.length }), o = t.linkedHtml ?? await n.time("addLinksToRenderedAknHtml", () => qe(a, {
|
|
1113
1228
|
...t,
|
|
1114
1229
|
date: i
|
|
1115
|
-
}, i)), s = n.timeSync("extractRenderedAknArticles", () =>
|
|
1230
|
+
}, i)), s = n.timeSync("extractRenderedAknArticles", () => xn(a)), c = n.timeSync("injectHiddenArticleSummary", () => st(o, s)), { articles: l, htmlWithLinks: u } = n.timeSync("extractLinkedAknArticlesAndTaggedHtml", () => Cn(c)), d = l.length > 0 ? l : s, f = n.timeSync("extractAknTableOfContents", () => _n(r)), p = n.timeSync("buildParsedDocument", () => jt("akoma-ntoso", a, l.length > 0 ? u : c, i, d, f, t.includeDirectiveAnalysis));
|
|
1116
1231
|
return n.log({
|
|
1117
|
-
articleCount:
|
|
1118
|
-
blockCount:
|
|
1119
|
-
directiveCount:
|
|
1120
|
-
targetDirectiveCount:
|
|
1121
|
-
}),
|
|
1232
|
+
articleCount: p.articles.length,
|
|
1233
|
+
blockCount: p.articles.reduce((e, t) => e + t.blocks.length, 0),
|
|
1234
|
+
directiveCount: p.directives.length,
|
|
1235
|
+
targetDirectiveCount: p.directives.filter((e) => e.targetIds !== void 0).length
|
|
1236
|
+
}), p;
|
|
1122
1237
|
}
|
|
1123
|
-
async function
|
|
1124
|
-
let n =
|
|
1238
|
+
async function Tn(e, t) {
|
|
1239
|
+
let n = bn(e), r = t.date ?? n.documentDate;
|
|
1125
1240
|
return {
|
|
1126
1241
|
sourceFormat: "akoma-ntoso",
|
|
1127
1242
|
documentDate: r,
|
|
@@ -1131,14 +1246,14 @@ async function _n(e, t) {
|
|
|
1131
1246
|
}
|
|
1132
1247
|
//#endregion
|
|
1133
1248
|
//#region src/lib/server/assemblee_document_search.ts
|
|
1134
|
-
var
|
|
1135
|
-
function
|
|
1249
|
+
var En = /\bexpos[ée]\s+des\s+motifs\b/giu, Dn = /\barticle\s+(?:premier|1er|\d+)/iu;
|
|
1250
|
+
function On(e) {
|
|
1136
1251
|
return e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim();
|
|
1137
1252
|
}
|
|
1138
|
-
function
|
|
1139
|
-
let t =
|
|
1253
|
+
function kn(e) {
|
|
1254
|
+
let t = On(_(e).text()), n = [...t.matchAll(En)], r = /* @__PURE__ */ new Set(), i = [];
|
|
1140
1255
|
for (let [e, a] of n.entries()) {
|
|
1141
|
-
let o = (a.index ?? 0) + a[0].length, s = t.slice(o), c =
|
|
1256
|
+
let o = (a.index ?? 0) + a[0].length, s = t.slice(o), c = Dn.exec(s), l = On(s.slice(0, c?.index ?? s.length));
|
|
1142
1257
|
if (l.length < 20 || r.has(l)) continue;
|
|
1143
1258
|
r.add(l);
|
|
1144
1259
|
let u = `expose-des-motifs-${e + 1}`;
|
|
@@ -1154,8 +1269,8 @@ function xn(e) {
|
|
|
1154
1269
|
}
|
|
1155
1270
|
return i;
|
|
1156
1271
|
}
|
|
1157
|
-
async function
|
|
1158
|
-
let i = await
|
|
1272
|
+
async function An({ date: e, html: t, linkBaseUrl: n, linkType: r }) {
|
|
1273
|
+
let i = await Ft(t, {
|
|
1159
1274
|
date: e,
|
|
1160
1275
|
includeDirectiveAnalysis: !1,
|
|
1161
1276
|
linkBaseUrl: n,
|
|
@@ -1164,7 +1279,7 @@ async function Sn({ date: e, html: t, linkBaseUrl: n, linkType: r }) {
|
|
|
1164
1279
|
});
|
|
1165
1280
|
return {
|
|
1166
1281
|
items: [...i.articles.map((e) => {
|
|
1167
|
-
let t =
|
|
1282
|
+
let t = On(e.directiveText || e.text);
|
|
1168
1283
|
if (t) return {
|
|
1169
1284
|
anchor: e.id,
|
|
1170
1285
|
articleNumber: e.num ?? null,
|
|
@@ -1174,17 +1289,17 @@ async function Sn({ date: e, html: t, linkBaseUrl: n, linkType: r }) {
|
|
|
1174
1289
|
label: e.label,
|
|
1175
1290
|
title: e.title ?? null
|
|
1176
1291
|
};
|
|
1177
|
-
}).filter((e) => e !== void 0), ...
|
|
1292
|
+
}).filter((e) => e !== void 0), ...kn(t)],
|
|
1178
1293
|
tableOfContents: i.tableOfContents
|
|
1179
1294
|
};
|
|
1180
1295
|
}
|
|
1181
|
-
function
|
|
1182
|
-
return
|
|
1296
|
+
function jn(e, t) {
|
|
1297
|
+
return A("sha256").update(JSON.stringify({
|
|
1183
1298
|
item: e,
|
|
1184
1299
|
metadata: t
|
|
1185
1300
|
})).digest("hex");
|
|
1186
1301
|
}
|
|
1187
|
-
function
|
|
1302
|
+
function Mn(e) {
|
|
1188
1303
|
if (typeof e != "object" || !e) return;
|
|
1189
1304
|
let t = e.cycleDeVie?.chrono;
|
|
1190
1305
|
if (t !== void 0) for (let e of [
|
|
@@ -1199,11 +1314,11 @@ function wn(e) {
|
|
|
1199
1314
|
}
|
|
1200
1315
|
//#endregion
|
|
1201
1316
|
//#region src/lib/server/senat_amendment_search.ts
|
|
1202
|
-
function
|
|
1203
|
-
return e?.trim() ?
|
|
1317
|
+
function Nn(e) {
|
|
1318
|
+
return e?.trim() ? _(e).text().replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim() : "";
|
|
1204
1319
|
}
|
|
1205
|
-
function
|
|
1206
|
-
let n =
|
|
1320
|
+
function Pn({ dispositifHtml: e, objetHtml: t }) {
|
|
1321
|
+
let n = Nn(e), r = Nn(t);
|
|
1207
1322
|
return [...n ? [{
|
|
1208
1323
|
content: n,
|
|
1209
1324
|
itemKind: "dispositif",
|
|
@@ -1214,8 +1329,8 @@ function En({ dispositifHtml: e, objetHtml: t }) {
|
|
|
1214
1329
|
label: "Objet"
|
|
1215
1330
|
}] : []];
|
|
1216
1331
|
}
|
|
1217
|
-
function
|
|
1218
|
-
return
|
|
1332
|
+
function Fn(e, t) {
|
|
1333
|
+
return A("sha256").update(JSON.stringify({
|
|
1219
1334
|
item: e,
|
|
1220
1335
|
metadata: t
|
|
1221
1336
|
})).digest("hex");
|
|
@@ -1229,76 +1344,76 @@ function V(e, t) {
|
|
|
1229
1344
|
type: "amendment_action_directive"
|
|
1230
1345
|
};
|
|
1231
1346
|
}
|
|
1232
|
-
function
|
|
1347
|
+
function In(e, t) {
|
|
1233
1348
|
return {
|
|
1234
1349
|
type: e === "start" ? "head_of_target" : "tail_after_target",
|
|
1235
|
-
unit: t ?
|
|
1350
|
+
unit: t ? oe(t) : "article"
|
|
1236
1351
|
};
|
|
1237
1352
|
}
|
|
1238
|
-
function
|
|
1353
|
+
function Ln(e) {
|
|
1239
1354
|
return e === "start" ? "insert_before" : "insert_after";
|
|
1240
1355
|
}
|
|
1241
|
-
var
|
|
1356
|
+
var Rn = O(D("[\\s\\S]*?(?=supprimer|substituer|remplacer|ins[eé]rer|compl[eé]ter|r[eé]diger)", { flags: "i" }), { default: "" }), H = k(m, T([D("les?\\s+", { flags: "i" }), n], { value: (e) => e[1] }), n, o), zn = k(T([D("la\\s+fin\\s+de\\s+", { flags: "i" }), H], { value: (e) => {
|
|
1242
1357
|
let t = e[1];
|
|
1243
1358
|
return {
|
|
1244
1359
|
targetReference: t,
|
|
1245
1360
|
targetScope: {
|
|
1246
1361
|
type: "tail_after_target",
|
|
1247
|
-
unit:
|
|
1362
|
+
unit: oe(t)
|
|
1248
1363
|
}
|
|
1249
1364
|
};
|
|
1250
|
-
} }),
|
|
1251
|
-
D(
|
|
1252
|
-
D(
|
|
1365
|
+
} }), T([S], { value: (e) => ({ targetScope: e[0] }) })), U = O(T([
|
|
1366
|
+
O(D("(?:[aà]\\s+la\\s+fin\\s+(?:du|de\\s+la|de\\s+l['’]?)\\s*)", { flags: "i" }), { default: "" }),
|
|
1367
|
+
O(D("(?:au\\s+d[eé]but\\s+d(?:u|e\\s+la|e\\s+l['’]?)\\s*)", { flags: "i" }), { default: "" }),
|
|
1253
1368
|
H,
|
|
1254
|
-
D(
|
|
1369
|
+
O(D("\\s*,?\\s*(?:(?:[IVXLCDM]+)\\s*[.\\-–—]+\\s*|\\d+°\\s*|[a-z]\\)\\s*)?", { flags: "i" }), { default: "" })
|
|
1255
1370
|
], { value: (e, t) => ({
|
|
1256
1371
|
reference: e[2],
|
|
1257
1372
|
text: t.text()
|
|
1258
|
-
}) }), { default: null }),
|
|
1373
|
+
}) }), { default: null }), Bn = O(D(`(?:(?:[aà]\\s+)?la\\s+(?:derni(?:ère|ere)|${he})\\s+occurrence\\s+)`, { flags: "i" }), { default: "" });
|
|
1259
1374
|
function W(e) {
|
|
1260
1375
|
return e?.text ?? "";
|
|
1261
1376
|
}
|
|
1262
1377
|
function G(e) {
|
|
1263
|
-
return { citation:
|
|
1378
|
+
return { citation: a(e.position()) };
|
|
1264
1379
|
}
|
|
1265
|
-
var K =
|
|
1380
|
+
var K = k(T([u], { value: (e) => ({ citation: e[0] }) }), D("\\S[\\s\\S]*", { value: (e, t) => G(t) })), Vn = D("\\S[\\s\\S]*", { value: (e, t) => G(t) }), q = D("[^:«“\"]*(?::\\s*)?", { flags: "i" }), Hn = D("\\S[\\s\\S]*?(?=\\s+par\\s+(?:les?\\s+)?(?:mots?|montants?|taux|références?|mentions?|dates?|années?)\\s*:)", {
|
|
1266
1381
|
flags: "i",
|
|
1267
1382
|
value: (e, t) => G(t)
|
|
1268
|
-
}),
|
|
1383
|
+
}), Un = D("\\S[\\s\\S]*?(?=\\s+(?:ins[eé]rer|ajouter|supprimer|r[eé]diger)\\b)", {
|
|
1269
1384
|
flags: "i",
|
|
1270
1385
|
value: (e, t) => G(t)
|
|
1271
|
-
}),
|
|
1386
|
+
}), Wn = D("\\S[\\s\\S]*?(?=\\s*(?:(?:[IVXLCDM]+)\\s*[.\\-–—]+\\s*|\\d+°\\s*|[a-z]\\)\\s*|$))", {
|
|
1272
1387
|
flags: "i",
|
|
1273
1388
|
value: (e, t) => G(t)
|
|
1274
|
-
}),
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
], { value: (e) => e[2] }),
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1389
|
+
}), Gn = k(T([u], { value: (e) => ({ citation: e[0] }) }), Hn), Kn = k(T([u], { value: (e) => ({ citation: e[0] }) }), Wn), qn = T([D(`${c}s?\\s*:?\\s*`, { flags: "i" }), Gn], { value: (e) => e[1] }), Jn = T([D(`${ae}s?(?: suivant(?:e)?s?)?\\s*:?\\s*`, { flags: "i" }), Kn], { value: (e) => e[1] }), Yn = k(T([u], { value: (e) => ({ citation: e[0] }) }), Un), Xn = T([
|
|
1390
|
+
Bn,
|
|
1391
|
+
D(`${c}s?\\s*:?\\s*`, { flags: "i" }),
|
|
1392
|
+
Yn
|
|
1393
|
+
], { value: (e) => e[2] }), Zn = T([
|
|
1394
|
+
Bn,
|
|
1395
|
+
D(`${c}s?\\s*:?\\s*`, { flags: "i" }),
|
|
1396
|
+
k(T([u], { value: (e) => ({ citation: e[0] }) }), Vn)
|
|
1282
1397
|
], { value: (e) => e[2] });
|
|
1283
1398
|
function J(e) {
|
|
1284
1399
|
return e?.reference;
|
|
1285
1400
|
}
|
|
1286
|
-
var
|
|
1401
|
+
var Qn = T([Rn, D("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e, t) => V(t, {
|
|
1287
1402
|
contextText: e[0],
|
|
1288
1403
|
kind: "delete_article"
|
|
1289
|
-
}) }),
|
|
1404
|
+
}) }), $n = T([
|
|
1290
1405
|
U,
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1406
|
+
D("supprimer", { flags: "i" }),
|
|
1407
|
+
O(T([E, H], { value: (e) => e[1] }), { default: null }),
|
|
1408
|
+
O(T([E, Zn], { value: (e) => e[1] }), { default: null })
|
|
1294
1409
|
], { value: (e, t) => V(t, {
|
|
1295
1410
|
contextText: W(e[0]),
|
|
1296
1411
|
kind: "delete_portion",
|
|
1297
1412
|
targetCitation: e[3]?.citation ?? void 0,
|
|
1298
1413
|
targetReference: e[2] ?? J(e[0])
|
|
1299
|
-
}) }),
|
|
1414
|
+
}) }), er = T([
|
|
1300
1415
|
U,
|
|
1301
|
-
|
|
1416
|
+
k(D("r[eé]diger\\s+ainsi", { flags: "i" }), D("r[eé]tablir", { flags: "i" })),
|
|
1302
1417
|
q,
|
|
1303
1418
|
K
|
|
1304
1419
|
], { value: (e, t) => V(t, {
|
|
@@ -1306,76 +1421,76 @@ var Wn = w([An, E("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e,
|
|
|
1306
1421
|
kind: "rewrite_portion",
|
|
1307
1422
|
replacementCitation: e[3].citation,
|
|
1308
1423
|
targetReference: J(e[0])
|
|
1309
|
-
}) }),
|
|
1424
|
+
}) }), tr = T([
|
|
1310
1425
|
U,
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
D(
|
|
1317
|
-
|
|
1426
|
+
k(D("substituer", { flags: "i" }), D("remplacer", { flags: "i" })),
|
|
1427
|
+
E,
|
|
1428
|
+
Bn,
|
|
1429
|
+
qn,
|
|
1430
|
+
D("\\s*,?\\s*"),
|
|
1431
|
+
O(D("par\\s+", { flags: "i" }), { default: "" }),
|
|
1432
|
+
Jn
|
|
1318
1433
|
], { value: (e, t) => V(t, {
|
|
1319
1434
|
contextText: W(e[0]),
|
|
1320
1435
|
kind: "replace",
|
|
1321
1436
|
replacementCitation: e[7].citation,
|
|
1322
1437
|
targetCitation: e[4].citation,
|
|
1323
1438
|
targetReference: J(e[0])
|
|
1324
|
-
}) }),
|
|
1439
|
+
}) }), nr = T([
|
|
1325
1440
|
U,
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
D(
|
|
1441
|
+
D("substituer", { flags: "i" }),
|
|
1442
|
+
E,
|
|
1443
|
+
O(D("(?:[aà]|aux?|à la)\\s+", { flags: "i" }), { default: "" }),
|
|
1329
1444
|
H,
|
|
1330
|
-
|
|
1445
|
+
D("[\\s\\S]*?(?=[«“\"]|$)"),
|
|
1331
1446
|
K
|
|
1332
1447
|
], { value: (e, t) => V(t, {
|
|
1333
1448
|
contextText: W(e[0]),
|
|
1334
1449
|
kind: "rewrite_portion",
|
|
1335
1450
|
replacementCitation: e[6].citation,
|
|
1336
1451
|
targetReference: e[4] ?? J(e[0])
|
|
1337
|
-
}) }),
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1452
|
+
}) }), rr = T([
|
|
1453
|
+
i,
|
|
1454
|
+
E,
|
|
1455
|
+
D("l['’ ]article", { flags: "i" }),
|
|
1456
|
+
D("[\\s\\S]*?(?=ins[eé]rer)", { flags: "i" }),
|
|
1457
|
+
D("ins[eé]rer", { flags: "i" }),
|
|
1343
1458
|
q,
|
|
1344
1459
|
K
|
|
1345
1460
|
], { value: (e, t) => V(t, {
|
|
1346
1461
|
contextText: "",
|
|
1347
1462
|
insertCitation: e[6].citation,
|
|
1348
1463
|
kind: e[0] === "before" ? "insert_article_before" : "insert_article_after"
|
|
1349
|
-
}) }),
|
|
1350
|
-
|
|
1351
|
-
|
|
1464
|
+
}) }), ir = T([
|
|
1465
|
+
i,
|
|
1466
|
+
E,
|
|
1352
1467
|
H,
|
|
1353
|
-
|
|
1354
|
-
|
|
1468
|
+
D("[\\s\\S]*?(?=ins[eé]rer|ajouter)", { flags: "i" }),
|
|
1469
|
+
k(D("ins[eé]rer", { flags: "i" }), D("ajouter", { flags: "i" })),
|
|
1355
1470
|
q,
|
|
1356
1471
|
K
|
|
1357
1472
|
], { value: (e, t) => V(t, {
|
|
1358
1473
|
contextText: "",
|
|
1359
1474
|
insertCitation: e[6].citation,
|
|
1360
|
-
kind:
|
|
1475
|
+
kind: l(e[0]),
|
|
1361
1476
|
targetReference: e[2]
|
|
1362
|
-
}) }),
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1477
|
+
}) }), ar = T([
|
|
1478
|
+
i,
|
|
1479
|
+
E,
|
|
1480
|
+
D("l['’ ]alin[eé]a", { flags: "i" }),
|
|
1481
|
+
D("[\\s\\S]*?(?=ins[eé]rer)", { flags: "i" }),
|
|
1482
|
+
D("ins[eé]rer", { flags: "i" }),
|
|
1368
1483
|
q,
|
|
1369
1484
|
K
|
|
1370
1485
|
], { value: (e, t) => V(t, {
|
|
1371
1486
|
contextText: "",
|
|
1372
1487
|
insertCitation: e[6].citation,
|
|
1373
|
-
kind:
|
|
1374
|
-
}) }),
|
|
1488
|
+
kind: l(e[0])
|
|
1489
|
+
}) }), or = T([
|
|
1375
1490
|
U,
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1491
|
+
ie,
|
|
1492
|
+
D("[\\s\\S]*?(?=ins[eé]rer|ajouter)", { flags: "i" }),
|
|
1493
|
+
k(D("ins[eé]rer", { flags: "i" }), D("ajouter", { flags: "i" })),
|
|
1379
1494
|
q,
|
|
1380
1495
|
K
|
|
1381
1496
|
], { value: (e, t) => {
|
|
@@ -1383,62 +1498,62 @@ var Wn = w([An, E("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e,
|
|
|
1383
1498
|
return V(t, {
|
|
1384
1499
|
contextText: W(n),
|
|
1385
1500
|
insertCitation: e[5].citation,
|
|
1386
|
-
kind:
|
|
1501
|
+
kind: Ln(i),
|
|
1387
1502
|
targetReference: r,
|
|
1388
|
-
targetScope:
|
|
1503
|
+
targetScope: In(i, r)
|
|
1389
1504
|
});
|
|
1390
|
-
} }),
|
|
1505
|
+
} }), sr = T([
|
|
1391
1506
|
U,
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1507
|
+
i,
|
|
1508
|
+
E,
|
|
1509
|
+
Xn,
|
|
1510
|
+
D("[\\s\\S]*?(?=ins[eé]rer)"),
|
|
1511
|
+
D("ins[eé]rer", { flags: "i" }),
|
|
1512
|
+
E,
|
|
1513
|
+
Jn
|
|
1399
1514
|
], { value: (e, t) => V(t, {
|
|
1400
1515
|
contextText: W(e[0]),
|
|
1401
1516
|
insertCitation: e[7].citation,
|
|
1402
|
-
kind:
|
|
1517
|
+
kind: l(e[1]),
|
|
1403
1518
|
targetCitation: e[3].citation,
|
|
1404
1519
|
targetReference: J(e[0])
|
|
1405
|
-
}) }),
|
|
1520
|
+
}) }), cr = T([
|
|
1406
1521
|
U,
|
|
1407
|
-
|
|
1408
|
-
|
|
1522
|
+
i,
|
|
1523
|
+
E,
|
|
1409
1524
|
H,
|
|
1410
|
-
|
|
1411
|
-
|
|
1525
|
+
D("[\\s\\S]*?(?=ins[eé]rer|ajouter)", { flags: "i" }),
|
|
1526
|
+
k(D("ins[eé]rer", { flags: "i" }), D("ajouter", { flags: "i" })),
|
|
1412
1527
|
q,
|
|
1413
1528
|
K
|
|
1414
1529
|
], { value: (e, t) => V(t, {
|
|
1415
1530
|
contextText: W(e[0]),
|
|
1416
1531
|
insertCitation: e[7].citation,
|
|
1417
|
-
kind:
|
|
1532
|
+
kind: l(e[1]),
|
|
1418
1533
|
targetReference: J(e[0]) ?? e[3]
|
|
1419
|
-
}) }),
|
|
1534
|
+
}) }), lr = k(or, rr, ir, ar, nr, T([
|
|
1420
1535
|
U,
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1536
|
+
i,
|
|
1537
|
+
E,
|
|
1538
|
+
Xn,
|
|
1539
|
+
D("[\\s\\S]*?(?=supprimer|r[eé]diger)", { flags: "i" }),
|
|
1540
|
+
k(T([
|
|
1541
|
+
D("supprimer", {
|
|
1427
1542
|
flags: "i",
|
|
1428
1543
|
value: "delete_portion"
|
|
1429
1544
|
}),
|
|
1430
|
-
|
|
1431
|
-
|
|
1545
|
+
E,
|
|
1546
|
+
zn
|
|
1432
1547
|
], { value: (e) => ({
|
|
1433
1548
|
kind: e[0],
|
|
1434
1549
|
...e[2]
|
|
1435
|
-
}) }),
|
|
1436
|
-
|
|
1550
|
+
}) }), T([
|
|
1551
|
+
D("r[eé]diger\\s+ainsi", {
|
|
1437
1552
|
flags: "i",
|
|
1438
1553
|
value: "rewrite_portion"
|
|
1439
1554
|
}),
|
|
1440
|
-
|
|
1441
|
-
|
|
1555
|
+
E,
|
|
1556
|
+
zn,
|
|
1442
1557
|
q,
|
|
1443
1558
|
K
|
|
1444
1559
|
], { value: (e) => ({
|
|
@@ -1456,24 +1571,24 @@ var Wn = w([An, E("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e,
|
|
|
1456
1571
|
targetReference: J(e[0]) ?? n.targetReference,
|
|
1457
1572
|
targetScope: n.targetScope
|
|
1458
1573
|
});
|
|
1459
|
-
} }),
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1574
|
+
} }), sr, cr, T([
|
|
1575
|
+
Rn,
|
|
1576
|
+
D("ins[eé]rer", { flags: "i" }),
|
|
1577
|
+
D(`[\\s\\S]*?(?=${r})`, { flags: "i" }),
|
|
1578
|
+
i,
|
|
1464
1579
|
q,
|
|
1465
|
-
|
|
1580
|
+
u,
|
|
1466
1581
|
q,
|
|
1467
|
-
|
|
1582
|
+
u
|
|
1468
1583
|
], { value: (e, t) => V(t, {
|
|
1469
1584
|
contextText: e[0],
|
|
1470
1585
|
insertCitation: e[8],
|
|
1471
|
-
kind:
|
|
1586
|
+
kind: l(e[3]),
|
|
1472
1587
|
targetCitation: e[6]
|
|
1473
|
-
}) }),
|
|
1588
|
+
}) }), tr, er, T([
|
|
1474
1589
|
U,
|
|
1475
|
-
|
|
1476
|
-
|
|
1590
|
+
D("compl[eé]ter", { flags: "i" }),
|
|
1591
|
+
O(T([E, H], { value: (e) => e[1] }), { default: null }),
|
|
1477
1592
|
q,
|
|
1478
1593
|
K
|
|
1479
1594
|
], { value: (e, t) => V(t, {
|
|
@@ -1481,16 +1596,16 @@ var Wn = w([An, E("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e,
|
|
|
1481
1596
|
insertCitation: e[4].citation,
|
|
1482
1597
|
kind: "insert_after",
|
|
1483
1598
|
targetReference: e[2] ?? J(e[0])
|
|
1484
|
-
}) }),
|
|
1599
|
+
}) }), Qn, $n);
|
|
1485
1600
|
//#endregion
|
|
1486
1601
|
//#region src/lib/server/parsed_amendments.ts
|
|
1487
|
-
function
|
|
1602
|
+
function ur(e) {
|
|
1488
1603
|
return e.replace(/\s+/gu, " ").trim();
|
|
1489
1604
|
}
|
|
1490
|
-
function
|
|
1491
|
-
return e.split(/\n/gu).map(
|
|
1605
|
+
function dr(e) {
|
|
1606
|
+
return e.split(/\n/gu).map(ur).filter(Boolean).join("\n");
|
|
1492
1607
|
}
|
|
1493
|
-
function
|
|
1608
|
+
function fr(e, t) {
|
|
1494
1609
|
let { start: n, stop: r } = t;
|
|
1495
1610
|
for (; n < r && /\s/u.test(e[n]);) n++;
|
|
1496
1611
|
for (; r > n && /\s/u.test(e[r - 1]);) r--;
|
|
@@ -1499,16 +1614,16 @@ function ir(e, t) {
|
|
|
1499
1614
|
stop: r
|
|
1500
1615
|
} : null;
|
|
1501
1616
|
}
|
|
1502
|
-
function
|
|
1503
|
-
return
|
|
1617
|
+
function pr(e, t) {
|
|
1618
|
+
return le(fe(e), t);
|
|
1504
1619
|
}
|
|
1505
|
-
function
|
|
1620
|
+
function mr(e) {
|
|
1506
1621
|
return e === "before_article" || e === "on_article" || e === "after_article" ? e : "unknown";
|
|
1507
1622
|
}
|
|
1508
|
-
function
|
|
1623
|
+
function hr(e) {
|
|
1509
1624
|
return {
|
|
1510
1625
|
articleLabel: e.targetArticleLabel ?? null,
|
|
1511
|
-
targetPosition:
|
|
1626
|
+
targetPosition: mr(e.targetPosition),
|
|
1512
1627
|
alinea: e.targetAlinea ?? null,
|
|
1513
1628
|
alineaLabel: e.targetAlineaLabel ?? null,
|
|
1514
1629
|
subdivisionSourceId: e.targetSubdivisionSourceId ?? null,
|
|
@@ -1523,31 +1638,31 @@ function Y(e) {
|
|
|
1523
1638
|
sourceText: e.text
|
|
1524
1639
|
};
|
|
1525
1640
|
}
|
|
1526
|
-
function
|
|
1641
|
+
function gr(e) {
|
|
1527
1642
|
return {
|
|
1528
1643
|
...e.originalTransformation === void 0 ? {} : { sourceOriginalTransformation: e.originalTransformation },
|
|
1529
1644
|
sourcePosition: e.position,
|
|
1530
1645
|
sourceText: e.text
|
|
1531
1646
|
};
|
|
1532
1647
|
}
|
|
1533
|
-
function
|
|
1648
|
+
function _r(e) {
|
|
1534
1649
|
return {
|
|
1535
1650
|
...e?.originalTransformation === void 0 ? {} : { dispositifOriginalTransformation: e.originalTransformation },
|
|
1536
1651
|
...e === null ? {} : { dispositifPosition: e.position },
|
|
1537
1652
|
dispositifText: e?.text ?? null
|
|
1538
1653
|
};
|
|
1539
1654
|
}
|
|
1540
|
-
function X(e, t, n, r =
|
|
1655
|
+
function X(e, t, n, r = dr(e.slice(n.start, n.stop))) {
|
|
1541
1656
|
return {
|
|
1542
|
-
originalTransformation:
|
|
1657
|
+
originalTransformation: pr(t, n),
|
|
1543
1658
|
position: n,
|
|
1544
1659
|
text: r
|
|
1545
1660
|
};
|
|
1546
1661
|
}
|
|
1547
|
-
function
|
|
1662
|
+
function vr(e) {
|
|
1548
1663
|
let t = e.dispositifHtml ?? e.dispositifText;
|
|
1549
1664
|
if (!t) return null;
|
|
1550
|
-
let n = e.dispositifHtml ?
|
|
1665
|
+
let n = e.dispositifHtml ? ce()(t) : se(t), r = n.output, i = fr(r, {
|
|
1551
1666
|
start: 0,
|
|
1552
1667
|
stop: r.length
|
|
1553
1668
|
});
|
|
@@ -1557,22 +1672,22 @@ function ur(e) {
|
|
|
1557
1672
|
transformation: n
|
|
1558
1673
|
};
|
|
1559
1674
|
}
|
|
1560
|
-
function Z(
|
|
1561
|
-
if (!
|
|
1562
|
-
if (
|
|
1563
|
-
if (
|
|
1564
|
-
let
|
|
1565
|
-
return
|
|
1675
|
+
function Z(t) {
|
|
1676
|
+
if (!t) return [];
|
|
1677
|
+
if (t.type === "enumeration") return [...Z(t.left), ...Z(t.right)];
|
|
1678
|
+
if (t.type === "bounded-interval") {
|
|
1679
|
+
let e = Z(t.first)[0], n = Z(t.last)[0];
|
|
1680
|
+
return e !== void 0 && n !== void 0 && n >= e ? Array.from({ length: n - e + 1 }, (t, n) => e + n) : [e, n].filter((e) => e !== void 0);
|
|
1566
1681
|
}
|
|
1567
|
-
if (
|
|
1568
|
-
let
|
|
1569
|
-
return
|
|
1682
|
+
if (t.type === "counted-interval") {
|
|
1683
|
+
let e = Z(t.first)[0];
|
|
1684
|
+
return e === void 0 ? [] : Array.from({ length: t.count }, (t, n) => e + n);
|
|
1570
1685
|
}
|
|
1571
|
-
if (
|
|
1572
|
-
for (let
|
|
1686
|
+
if (t.type === "exclusion") return Z(t.left);
|
|
1687
|
+
for (let n of e(t)) if (n.type === "alinéa" && typeof n.index == "number" && n.index > 0) return [n.index];
|
|
1573
1688
|
return [];
|
|
1574
1689
|
}
|
|
1575
|
-
function
|
|
1690
|
+
function yr(e, t) {
|
|
1576
1691
|
let n = Z(t);
|
|
1577
1692
|
return {
|
|
1578
1693
|
...e,
|
|
@@ -1580,11 +1695,11 @@ function dr(e, t) {
|
|
|
1580
1695
|
...n.length > 0 ? { alineas: n } : {}
|
|
1581
1696
|
};
|
|
1582
1697
|
}
|
|
1583
|
-
function
|
|
1698
|
+
function br(e) {
|
|
1584
1699
|
return e.replace(/^\s*(?:[IVXLCDM]+)\s*(?:\.\s*)?[-–—]\s*/iu, "").replace(/^\s*(?:\d+°|[a-z]\))\s*/iu, "").trim();
|
|
1585
1700
|
}
|
|
1586
|
-
function
|
|
1587
|
-
let n = /^alin[eé]as?\s+(?:(\d+)|1er|premier)\b/iu.exec(
|
|
1701
|
+
function xr(e, t) {
|
|
1702
|
+
let n = /^alin[eé]as?\s+(?:(\d+)|1er|premier)\b/iu.exec(br(t.text));
|
|
1588
1703
|
if (!n) return null;
|
|
1589
1704
|
let r = n[1] === void 0 ? 1 : Number.parseInt(n[1], 10);
|
|
1590
1705
|
return !Number.isFinite(r) || r < 1 ? null : {
|
|
@@ -1593,25 +1708,25 @@ function pr(e, t) {
|
|
|
1593
1708
|
alineas: [r]
|
|
1594
1709
|
};
|
|
1595
1710
|
}
|
|
1596
|
-
function
|
|
1711
|
+
function Sr(e, t) {
|
|
1597
1712
|
if (e) return e.unit === "article" && t.alinea !== null ? {
|
|
1598
1713
|
...e,
|
|
1599
1714
|
unit: "alinéa"
|
|
1600
1715
|
} : e;
|
|
1601
1716
|
}
|
|
1602
|
-
function
|
|
1603
|
-
return /^(?:apr[eè]s|avant|(?:au|a[uù])\s+d[eé]but|(?:a|à)\s+la\s+fin)\b/iu.test(
|
|
1717
|
+
function Cr(e) {
|
|
1718
|
+
return /^(?:apr[eè]s|avant|(?:au|a[uù])\s+d[eé]but|(?:a|à)\s+la\s+fin)\b/iu.test(br(e.text));
|
|
1604
1719
|
}
|
|
1605
|
-
function
|
|
1720
|
+
function wr(e, t, n, r) {
|
|
1606
1721
|
return X(e, t, {
|
|
1607
1722
|
start: n.position.start,
|
|
1608
1723
|
stop: r.position.stop
|
|
1609
1724
|
});
|
|
1610
1725
|
}
|
|
1611
|
-
function
|
|
1726
|
+
function Tr(e) {
|
|
1612
1727
|
return /^\s*(?:[IVXLCDM]+)\s*(?:\.\s*)?[-–—]\s*(?!alin[eé]a\b)/iu.test(e.text);
|
|
1613
1728
|
}
|
|
1614
|
-
function
|
|
1729
|
+
function Er(e, t) {
|
|
1615
1730
|
let n = { ...t.position };
|
|
1616
1731
|
function r(t) {
|
|
1617
1732
|
let r = t.exec(e.slice(n.start, n.stop));
|
|
@@ -1620,29 +1735,29 @@ function vr(e, t) {
|
|
|
1620
1735
|
stop: n.stop
|
|
1621
1736
|
});
|
|
1622
1737
|
}
|
|
1623
|
-
return r(/^(?:(?:[IVXLCDM]+)\s*(?:\.\s*)?[-–—]\s*|[a-z]\)\s*(?:[.\-–—]\s*)*|\d+°\s*)/iu), r(/^[.\-–—]\s*/u), r(/^en\s+cons[ée]quence\s*,\s*/iu),
|
|
1738
|
+
return r(/^(?:(?:[IVXLCDM]+)\s*(?:\.\s*)?[-–—]\s*|[a-z]\)\s*(?:[.\-–—]\s*)*|\d+°\s*)/iu), r(/^[.\-–—]\s*/u), r(/^en\s+cons[ée]quence\s*,\s*/iu), fr(e, n);
|
|
1624
1739
|
}
|
|
1625
|
-
function
|
|
1740
|
+
function Dr(e) {
|
|
1626
1741
|
return d(e);
|
|
1627
1742
|
}
|
|
1628
|
-
function
|
|
1629
|
-
return
|
|
1743
|
+
function Or(e, t) {
|
|
1744
|
+
return lr(new w(e.slice(0, t.stop), t.start)) ?? null;
|
|
1630
1745
|
}
|
|
1631
1746
|
function Q(e, t, n) {
|
|
1632
|
-
if (n) return X(e, t, n.position,
|
|
1747
|
+
if (n) return X(e, t, n.position, dr(te(e, n)));
|
|
1633
1748
|
}
|
|
1634
|
-
function
|
|
1749
|
+
function kr(e, t) {
|
|
1635
1750
|
if (!e) return;
|
|
1636
1751
|
let n = structuredClone(e);
|
|
1637
|
-
for (let e of
|
|
1752
|
+
for (let e of ee(n, { citations: !0 })) e.position !== void 0 && (e.originalTransformation = pr(t, e.position));
|
|
1638
1753
|
return n;
|
|
1639
1754
|
}
|
|
1640
|
-
function
|
|
1641
|
-
let i =
|
|
1755
|
+
function Ar(e, t, n, r) {
|
|
1756
|
+
let i = Er(e, n);
|
|
1642
1757
|
if (!i) return null;
|
|
1643
|
-
let a =
|
|
1758
|
+
let a = Or(e, i);
|
|
1644
1759
|
if (!a) return null;
|
|
1645
|
-
let o = X(e, t, i), s =
|
|
1760
|
+
let o = X(e, t, i), s = kr(a.targetReference, t), c = yr(r, s), l = Dr(o.text);
|
|
1646
1761
|
if (a.kind === "delete_article") return {
|
|
1647
1762
|
kind: "delete_article",
|
|
1648
1763
|
...Y(o),
|
|
@@ -1660,7 +1775,7 @@ function Sr(e, t, n, r) {
|
|
|
1660
1775
|
},
|
|
1661
1776
|
targetOccurrence: l,
|
|
1662
1777
|
targetReference: s,
|
|
1663
|
-
targetScope:
|
|
1778
|
+
targetScope: Sr(a.targetScope, c)
|
|
1664
1779
|
};
|
|
1665
1780
|
}
|
|
1666
1781
|
if (a.kind === "rewrite_portion") {
|
|
@@ -1677,7 +1792,7 @@ function Sr(e, t, n, r) {
|
|
|
1677
1792
|
},
|
|
1678
1793
|
targetOccurrence: l,
|
|
1679
1794
|
targetReference: s,
|
|
1680
|
-
targetScope:
|
|
1795
|
+
targetScope: Sr(a.targetScope, c),
|
|
1681
1796
|
replacementCitation: n,
|
|
1682
1797
|
replacementText: n.text
|
|
1683
1798
|
};
|
|
@@ -1732,15 +1847,15 @@ function Sr(e, t, n, r) {
|
|
|
1732
1847
|
targetReference: s,
|
|
1733
1848
|
insertCitation: n,
|
|
1734
1849
|
insertText: n.text,
|
|
1735
|
-
targetScope:
|
|
1850
|
+
targetScope: Sr(a.targetScope, c)
|
|
1736
1851
|
};
|
|
1737
1852
|
}
|
|
1738
1853
|
return null;
|
|
1739
1854
|
}
|
|
1740
|
-
function
|
|
1855
|
+
function jr(e, t) {
|
|
1741
1856
|
let n = [], r = 0, i = 0;
|
|
1742
1857
|
function a(r) {
|
|
1743
|
-
let a =
|
|
1858
|
+
let a = fr(e, {
|
|
1744
1859
|
start: i,
|
|
1745
1860
|
stop: r
|
|
1746
1861
|
});
|
|
@@ -1762,7 +1877,7 @@ function Cr(e, t) {
|
|
|
1762
1877
|
continue;
|
|
1763
1878
|
}
|
|
1764
1879
|
if (r > 0) continue;
|
|
1765
|
-
let s = e.slice(t + 1), c = /[\n\r]/u.test(n), l = /[.;]/u.test(n), u = e.slice(i, l ? t + 1 : t), d = /^\s*(?:(?:[IVXLCDM]+)\s*[.\-–—]+\s*|\d+°\s*|[a-z]\)\s*|(?:Supprimer|Après|Avant|Compléter|Rédiger|Substituer|Remplacer)\b)/iu.test(s), f = c && /^\s*(?:R[eé]diger|Ins[eé]rer|Ajouter|Supprimer)\b/iu.test(s) &&
|
|
1880
|
+
let s = e.slice(t + 1), c = /[\n\r]/u.test(n), l = /[.;]/u.test(n), u = e.slice(i, l ? t + 1 : t), d = /^\s*(?:(?:[IVXLCDM]+)\s*[.\-–—]+\s*|\d+°\s*|[a-z]\)\s*|(?:Supprimer|Après|Avant|Compléter|Rédiger|Substituer|Remplacer)\b)/iu.test(s), f = c && /^\s*(?:R[eé]diger|Ins[eé]rer|Ajouter|Supprimer)\b/iu.test(s) && Cr({
|
|
1766
1881
|
originalTransformation: void 0,
|
|
1767
1882
|
position: {
|
|
1768
1883
|
start: i,
|
|
@@ -1774,8 +1889,8 @@ function Cr(e, t) {
|
|
|
1774
1889
|
}
|
|
1775
1890
|
return a(e.length), n;
|
|
1776
1891
|
}
|
|
1777
|
-
function
|
|
1778
|
-
let t =
|
|
1892
|
+
function Mr(e) {
|
|
1893
|
+
let t = vr(e), n = t?.dispositif ?? null, r = _r(n), i = [], a = [], o = hr(e);
|
|
1779
1894
|
if (e.sourceFormat === "senat-ameli" && e.sourceKind === "S") return i.push({
|
|
1780
1895
|
code: "unsupported_sub_amendment",
|
|
1781
1896
|
message: "Les sous-amendements ne sont pas encore projetés."
|
|
@@ -1793,9 +1908,9 @@ function wr(e) {
|
|
|
1793
1908
|
});
|
|
1794
1909
|
else {
|
|
1795
1910
|
let { simplifiedText: e, transformation: r } = t, s = o, c = null;
|
|
1796
|
-
for (let t of
|
|
1797
|
-
|
|
1798
|
-
let n = c ?
|
|
1911
|
+
for (let t of jr(e, r)) {
|
|
1912
|
+
Tr(t) && (s = o, c = null);
|
|
1913
|
+
let n = c ? wr(e, r, c, t) : t, i = Ar(e, r, n, s);
|
|
1799
1914
|
if (i) {
|
|
1800
1915
|
a.push(i), c = null, (i.target.alinea !== null || i.target.alineas) && (s = i.target);
|
|
1801
1916
|
continue;
|
|
@@ -1804,12 +1919,12 @@ function wr(e) {
|
|
|
1804
1919
|
c = n;
|
|
1805
1920
|
continue;
|
|
1806
1921
|
}
|
|
1807
|
-
let l =
|
|
1922
|
+
let l = xr(o, t);
|
|
1808
1923
|
if (l !== null) {
|
|
1809
1924
|
s = l;
|
|
1810
1925
|
continue;
|
|
1811
1926
|
}
|
|
1812
|
-
|
|
1927
|
+
Cr(t) && (c = t);
|
|
1813
1928
|
}
|
|
1814
1929
|
a.length === 0 && (o.targetPosition === "after_article" || o.targetPosition === "before_article") && a.push({
|
|
1815
1930
|
kind: o.targetPosition === "before_article" ? "insert_article_before" : "insert_article_after",
|
|
@@ -1820,7 +1935,7 @@ function wr(e) {
|
|
|
1820
1935
|
}), a.length === 0 && i.push({
|
|
1821
1936
|
code: "unrecognized_dispositif",
|
|
1822
1937
|
message: "Le dispositif est présent mais aucune directive d'amendement n'a été reconnue.",
|
|
1823
|
-
...
|
|
1938
|
+
...gr(n)
|
|
1824
1939
|
});
|
|
1825
1940
|
}
|
|
1826
1941
|
return {
|
|
@@ -1837,8 +1952,8 @@ function wr(e) {
|
|
|
1837
1952
|
function $(e) {
|
|
1838
1953
|
return e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim();
|
|
1839
1954
|
}
|
|
1840
|
-
function
|
|
1841
|
-
let t =
|
|
1955
|
+
function Nr(e) {
|
|
1956
|
+
let t = C(e);
|
|
1842
1957
|
if (!t) return {
|
|
1843
1958
|
articleNumber: null,
|
|
1844
1959
|
label: e,
|
|
@@ -1851,8 +1966,8 @@ function Tr(e) {
|
|
|
1851
1966
|
title: r
|
|
1852
1967
|
};
|
|
1853
1968
|
}
|
|
1854
|
-
function
|
|
1855
|
-
let t =
|
|
1969
|
+
function Pr(e) {
|
|
1970
|
+
let t = _(e), n = [], r = $(t("section.akn-preamble").text());
|
|
1856
1971
|
return r && n.push({
|
|
1857
1972
|
anchor: "senat-expose-des-motifs",
|
|
1858
1973
|
articleNumber: null,
|
|
@@ -1862,7 +1977,7 @@ function Er(e) {
|
|
|
1862
1977
|
label: "Exposé des motifs",
|
|
1863
1978
|
title: null
|
|
1864
1979
|
}), t("article.akn-article").each((e, r) => {
|
|
1865
|
-
let i = t(r), a = i.attr("id") || `akn-article-${e + 1}`, o = $(i.children("p.TCNumArticle").first().text()), s = `Article ${e + 1}`, c =
|
|
1980
|
+
let i = t(r), a = i.attr("id") || `akn-article-${e + 1}`, o = $(i.children("p.TCNumArticle").first().text()), s = `Article ${e + 1}`, c = Nr(o || s), l = i.clone();
|
|
1866
1981
|
l.children("p.TCNumArticle").remove();
|
|
1867
1982
|
let u = $(l.text());
|
|
1868
1983
|
u && n.push({
|
|
@@ -1876,40 +1991,40 @@ function Er(e) {
|
|
|
1876
1991
|
});
|
|
1877
1992
|
}), n;
|
|
1878
1993
|
}
|
|
1879
|
-
function
|
|
1880
|
-
return
|
|
1994
|
+
function Fr(e, t) {
|
|
1995
|
+
return A("sha256").update(JSON.stringify({
|
|
1881
1996
|
item: e,
|
|
1882
1997
|
metadata: t
|
|
1883
1998
|
})).digest("hex");
|
|
1884
1999
|
}
|
|
1885
2000
|
//#endregion
|
|
1886
2001
|
//#region src/lib/server/senat_document_sources.ts
|
|
1887
|
-
var
|
|
1888
|
-
function
|
|
2002
|
+
var Ir = new Set(["senat.fr", "www.senat.fr"]), Lr = "https://www.senat.fr";
|
|
2003
|
+
function Rr(e) {
|
|
1889
2004
|
return e?.trim() || void 0;
|
|
1890
2005
|
}
|
|
1891
|
-
function
|
|
2006
|
+
function zr(e) {
|
|
1892
2007
|
try {
|
|
1893
|
-
let t = e.replace(/^\/+/, ""), n = /^https?:\/\//iu.test(e) ? new URL(e) : new URL(/^(?:akomantoso|leg)\//iu.test(t) ? `/${t}` : `/leg/${t}`,
|
|
1894
|
-
return
|
|
2008
|
+
let t = e.replace(/^\/+/, ""), n = /^https?:\/\//iu.test(e) ? new URL(e) : new URL(/^(?:akomantoso|leg)\//iu.test(t) ? `/${t}` : `/leg/${t}`, Lr);
|
|
2009
|
+
return Ir.has(n.hostname.toLowerCase()) ? n : void 0;
|
|
1895
2010
|
} catch {
|
|
1896
2011
|
return;
|
|
1897
2012
|
}
|
|
1898
2013
|
}
|
|
1899
|
-
function
|
|
1900
|
-
let t =
|
|
2014
|
+
function Br(e) {
|
|
2015
|
+
let t = Rr(e);
|
|
1901
2016
|
if (t === void 0) return {
|
|
1902
2017
|
publicUrl: null,
|
|
1903
2018
|
status: "no_url"
|
|
1904
2019
|
};
|
|
1905
|
-
let n =
|
|
2020
|
+
let n = zr(t);
|
|
1906
2021
|
if (n === void 0) return {
|
|
1907
2022
|
publicUrl: t,
|
|
1908
2023
|
status: "unsupported_source"
|
|
1909
2024
|
};
|
|
1910
2025
|
let r = n.pathname;
|
|
1911
2026
|
if (/^\/akomantoso\/[^/]+\.akn\.xml$/iu.test(r)) return {
|
|
1912
|
-
akomaNtosoUrl: `${
|
|
2027
|
+
akomaNtosoUrl: `${Lr}${r}`,
|
|
1913
2028
|
publicUrl: n.toString(),
|
|
1914
2029
|
status: "available"
|
|
1915
2030
|
};
|
|
@@ -1918,17 +2033,17 @@ function Mr(e) {
|
|
|
1918
2033
|
publicUrl: n.toString(),
|
|
1919
2034
|
status: "unsupported_source"
|
|
1920
2035
|
} : {
|
|
1921
|
-
akomaNtosoUrl: `${
|
|
2036
|
+
akomaNtosoUrl: `${Lr}/akomantoso/${i.replace(/\.html$/iu, ".akn.xml")}`,
|
|
1922
2037
|
publicUrl: n.toString(),
|
|
1923
2038
|
status: "available"
|
|
1924
2039
|
};
|
|
1925
2040
|
}
|
|
1926
|
-
function
|
|
2041
|
+
function Vr(e) {
|
|
1927
2042
|
return /^\s*(?:<\?xml\b[^>]*>\s*)?<akomaNtoso[\s/>]/iu.test(e);
|
|
1928
2043
|
}
|
|
1929
2044
|
//#endregion
|
|
1930
2045
|
//#region src/lib/alineas/alineas_numbers.ts
|
|
1931
|
-
var
|
|
2046
|
+
var Hr = {
|
|
1932
2047
|
"0150a855548f15a2af52ea057be53f5d": 1,
|
|
1933
2048
|
"039826cf379b94afefe90b25c6045ca0": 1,
|
|
1934
2049
|
"03a7e564b84662f4d957c51018e26244": 1,
|
|
@@ -20902,7 +21017,7 @@ var Pr = {
|
|
|
20902
21017
|
d16d29c923bd60c7b095b66c6058fe60: 1664,
|
|
20903
21018
|
"1c14c2adf5cfda3220b2057160e10e91": 1665,
|
|
20904
21019
|
e44c55ca1ac46ff46420686a466c9fc6: 1665
|
|
20905
|
-
},
|
|
21020
|
+
}, Ur = "\np:has(.alinea) {\n margin: 0.6em 0;\n}\n.alinea {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 1.5em;\n height: 1.5em;\n padding: 0 0.3em;\n margin-right: 0.3em;\n font-size: 0.75em;\n font-weight: bold;\n color: #555;\n background-color: #f0f0f0;\n border: 1px solid #ccc;\n border-radius: 1em;\n vertical-align: middle;\n}\n", Wr = "\nh1 {\n font-size: 1.8em;\n margin: 1em 0 0.5em 0;\n}\nh2 {\n font-size: 1.5em;\n margin: 0.9em 0 0.4em 0;\n}\nh3 {\n font-size: 1.3em;\n margin: 0.8em 0 0.4em 0;\n}\nh4 {\n font-size: 1.15em;\n margin: 0.7em 0 0.3em 0;\n}\nh5 {\n font-size: 1.05em;\n margin: 0.6em 0 0.3em 0;\n}\nh6 {\n font-size: 1em;\n margin: 0.5em 0 0.3em 0;\n}\n", Gr = "\n.expose-motifs-titre {\n font-size: 1.1em;\n font-weight: bold;\n color: #0070b9;\n margin: 1em 0 0.5em 0;\n}\n.expose-motifs {\n border-left: 3px solid #0070b9;\n padding-left: 1em;\n margin: 0.5em 0 1em 0;\n color: #333;\n}\n.expose-motifs p {\n margin: 0.5em 0;\n}\n", Kr = "\nol {\n list-style: none;\n padding-left: 0;\n margin: 0.5em 0;\n counter-reset: list-counter;\n}\nol > li {\n counter-increment: list-counter;\n margin: 0.3em 0;\n padding-left: 2.3em;\n position: relative;\n}\nol > li::before {\n content: counter(list-counter);\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 1.5em;\n height: 1.5em;\n padding: 0 0.3em;\n font-size: 0.75em;\n font-weight: bold;\n color: #555;\n background-color: #f0f0f0;\n border: 1px solid #ccc;\n border-radius: 1em;\n position: absolute;\n left: 0;\n top: 0.1em;\n}\n", qr = "\n.cover-title {\n font-size: 1.8em;\n font-weight: bold;\n color: #0070b9;\n text-align: center;\n margin: 1em 0;\n}\n.cover-subtitle {\n font-size: 1.4em;\n font-weight: bold;\n color: #0070b9;\n text-align: center;\n margin: 0.8em 0;\n}\n.cover-info {\n text-align: center;\n margin: 0.3em 0;\n color: #333;\n}\n.cover-year {\n font-size: 2em;\n font-weight: bold;\n color: #0070b9;\n text-align: center;\n margin: 1em 0;\n}\n", Jr = {
|
|
20906
21021
|
assnatetatagr: { bold: !0 },
|
|
20907
21022
|
assnatetatagrgr: { bold: !0 },
|
|
20908
21023
|
assnatetatatr: { bold: !0 },
|
|
@@ -21003,29 +21118,29 @@ var Pr = {
|
|
|
21003
21118
|
assnatxl67: { align: "center" },
|
|
21004
21119
|
assnatenteteequilibre: { align: "center" }
|
|
21005
21120
|
};
|
|
21006
|
-
function
|
|
21007
|
-
let t = Object.keys(
|
|
21008
|
-
for (let n of t) if (e.includes(n)) return
|
|
21121
|
+
function Yr(e) {
|
|
21122
|
+
let t = Object.keys(Jr).sort((e, t) => t.length - e.length);
|
|
21123
|
+
for (let n of t) if (e.includes(n)) return Jr[n];
|
|
21009
21124
|
return null;
|
|
21010
21125
|
}
|
|
21011
|
-
function
|
|
21012
|
-
return
|
|
21126
|
+
function Xr(e) {
|
|
21127
|
+
return ve.createHash("md5").update(e).digest("hex");
|
|
21013
21128
|
}
|
|
21014
|
-
function
|
|
21129
|
+
function Zr(e) {
|
|
21015
21130
|
return e ? /font-weight\s*:\s*(bold|[6-9]00|1000)/i.test(e) || /font-family\s*:\s*[^;]*\bBold\b/i.test(e) : !1;
|
|
21016
21131
|
}
|
|
21017
|
-
function
|
|
21132
|
+
function Qr(e) {
|
|
21018
21133
|
return e ? /font-style\s*:\s*italic/i.test(e) || /font-family\s*:\s*[^;]*\bItalic\b/i.test(e) : !1;
|
|
21019
21134
|
}
|
|
21020
|
-
function
|
|
21135
|
+
function $r(e) {
|
|
21021
21136
|
if (!e || !/vertical-align\s*:\s*super/i.test(e)) return !1;
|
|
21022
21137
|
let t = e.match(/font-size\s*:\s*([\d.]+)pt/i);
|
|
21023
21138
|
return !(t && parseFloat(t[1]) < 8);
|
|
21024
21139
|
}
|
|
21025
|
-
function
|
|
21140
|
+
function ei(e) {
|
|
21026
21141
|
return e ? /vertical-align\s*:\s*sub/i.test(e) : !1;
|
|
21027
21142
|
}
|
|
21028
|
-
function
|
|
21143
|
+
function ti(e) {
|
|
21029
21144
|
if (!e) return;
|
|
21030
21145
|
let t = [
|
|
21031
21146
|
"width",
|
|
@@ -21060,15 +21175,15 @@ function qr(e) {
|
|
|
21060
21175
|
}
|
|
21061
21176
|
return n.length > 0 ? n.join("; ") : void 0;
|
|
21062
21177
|
}
|
|
21063
|
-
function
|
|
21178
|
+
function ni(e, t) {
|
|
21064
21179
|
return !!(e && /text-align\s*:\s*center/i.test(e) || t && /center/i.test(t));
|
|
21065
21180
|
}
|
|
21066
|
-
function
|
|
21181
|
+
function ri(e) {
|
|
21067
21182
|
if (!e) return null;
|
|
21068
21183
|
let t = e.match(/text-align\s*:\s*(left|center|right|justify)/i);
|
|
21069
21184
|
return t ? t[1].toLowerCase() : null;
|
|
21070
21185
|
}
|
|
21071
|
-
function
|
|
21186
|
+
function ii(e) {
|
|
21072
21187
|
if (!e) return null;
|
|
21073
21188
|
for (let [t, n] of [
|
|
21074
21189
|
[/assnat1Tome|assnatAN1PARTIE/i, 1],
|
|
@@ -21080,8 +21195,8 @@ function Xr(e) {
|
|
|
21080
21195
|
]) if (t.test(e)) return n;
|
|
21081
21196
|
return null;
|
|
21082
21197
|
}
|
|
21083
|
-
function
|
|
21084
|
-
let { keepAlignment: n = !0, removeEmptyParagraphs: r = !0, strictAlineas: i = !1 } = t, a =
|
|
21198
|
+
function ai(e, t = {}) {
|
|
21199
|
+
let { keepAlignment: n = !0, removeEmptyParagraphs: r = !0, strictAlineas: i = !1 } = t, a = _(e, { xml: { decodeEntities: !1 } });
|
|
21085
21200
|
a("style, script, meta, link").remove(), a(".assnatHeader, .assnatFooter, .assnatHeaderLeft, .assnatHeaderandFooter").remove(), a(".assnatFARSautApres, .assnatFARSautAvant, .assnatFARSautPageNiv0, .assnatFARSautPageNiv1, .assnatFARSautPageNiv1PG").remove(), a(".assnatFARTT08Bleu").each((e, t) => {
|
|
21086
21201
|
let n = a(t).closest("table");
|
|
21087
21202
|
n.length > 0 && n.remove();
|
|
@@ -21106,7 +21221,7 @@ function Zr(e, t = {}) {
|
|
|
21106
21221
|
if (i.length !== 0 && !(n.parents("del").length > 0 || n.find("del img").length > 0) && !(i.parent("del").length > 0)) {
|
|
21107
21222
|
let e = i.attr();
|
|
21108
21223
|
if (e && (e.width === "45" && (e.height === "31" || e.height === "30") || parseInt(e.width || "0", 10) < 50 && parseInt(e.height || "0", 10) < 50) && r.includes("position:absolute")) {
|
|
21109
|
-
let t = (e.src || "").match(/^data:image\/png;base64,(.+)$/), r = t ?
|
|
21224
|
+
let t = (e.src || "").match(/^data:image\/png;base64,(.+)$/), r = t ? Xr(t[1]) : void 0, i = r ? ` data-image-hash="${r}"` : "";
|
|
21110
21225
|
n.replaceWith(`<span class="alinea"${i}></span>`);
|
|
21111
21226
|
return;
|
|
21112
21227
|
}
|
|
@@ -21125,7 +21240,7 @@ function Zr(e, t = {}) {
|
|
|
21125
21240
|
(!r || r === "\xA0") && n.remove();
|
|
21126
21241
|
}), a("span[style*=\"display:block\"][style*=\"position:absolute\"]:not(.alinea)").remove(), a("del").remove();
|
|
21127
21242
|
function o(e) {
|
|
21128
|
-
let t = a(e), n = t.attr("style"), r = e.tagName?.toLowerCase() || "", i =
|
|
21243
|
+
let t = a(e), n = t.attr("style"), r = e.tagName?.toLowerCase() || "", i = Zr(n) || r === "b" || r === "strong", o = Qr(n) || r === "i" || r === "em", s = $r(n) || r === "sup", c = ei(n) || r === "sub", l = t.attr("class") || "";
|
|
21129
21244
|
return /bold/i.test(l) && (i = !0), /strongemphasis/i.test(l) ? i = !0 : /italic|emphasis/i.test(l) && (o = !0), {
|
|
21130
21245
|
bold: i,
|
|
21131
21246
|
italic: o,
|
|
@@ -21159,7 +21274,7 @@ function Zr(e, t = {}) {
|
|
|
21159
21274
|
c = e;
|
|
21160
21275
|
}
|
|
21161
21276
|
for (a("p").each((e, t) => {
|
|
21162
|
-
let r = a(t), i = r.attr("class") || "", o = r.attr("style"), s =
|
|
21277
|
+
let r = a(t), i = r.attr("class") || "", o = r.attr("style"), s = ii(i);
|
|
21163
21278
|
if (i.includes("assnatFARCouvTitreD")) {
|
|
21164
21279
|
let e = r.html() || "";
|
|
21165
21280
|
r.replaceWith(`<p class="cover-subtitle">${e}</p>`);
|
|
@@ -21192,11 +21307,11 @@ function Zr(e, t = {}) {
|
|
|
21192
21307
|
let c = r.text().trim().startsWith("«");
|
|
21193
21308
|
if (s && !c) {
|
|
21194
21309
|
let e = a(`<h${s}>${r.html() || ""}</h${s}>`);
|
|
21195
|
-
n &&
|
|
21310
|
+
n && ni(o, i) && e.attr("align", "center"), r.replaceWith(e);
|
|
21196
21311
|
} else {
|
|
21197
|
-
let e =
|
|
21312
|
+
let e = Yr(i), t;
|
|
21198
21313
|
if (n) {
|
|
21199
|
-
let n =
|
|
21314
|
+
let n = ri(o);
|
|
21200
21315
|
n && n !== "justify" && n !== "left" ? t = n : e?.align && (t = e.align);
|
|
21201
21316
|
}
|
|
21202
21317
|
if (r.removeAttr("style").removeAttr("class"), t && r.attr("align", t), e?.bold) {
|
|
@@ -21206,7 +21321,7 @@ function Zr(e, t = {}) {
|
|
|
21206
21321
|
}
|
|
21207
21322
|
}), a("h1, h2, h3, h4, h5, h6").each((e, t) => {
|
|
21208
21323
|
let r = a(t), i = r.attr("style"), o = r.attr("class");
|
|
21209
|
-
n &&
|
|
21324
|
+
n && ni(i, o) ? (r.removeAttr("style").removeAttr("class"), r.attr("align", "center")) : r.removeAttr("style").removeAttr("class");
|
|
21210
21325
|
}), a("a").each((e, t) => {
|
|
21211
21326
|
let n = a(t), r = n.attr("href"), i = n.attr("id"), o = { ...t.attribs || {} };
|
|
21212
21327
|
for (let e of Object.keys(o)) e !== "href" && e !== "id" && n.removeAttr(e);
|
|
@@ -21245,7 +21360,7 @@ function Zr(e, t = {}) {
|
|
|
21245
21360
|
}), a("br").each((e, t) => {
|
|
21246
21361
|
a(t).removeAttr("style").removeAttr("class");
|
|
21247
21362
|
}), a("table, tr, td, th, thead, tbody, tfoot").each((e, t) => {
|
|
21248
|
-
let n = a(t), r =
|
|
21363
|
+
let n = a(t), r = ti(n.attr("style"));
|
|
21249
21364
|
n.removeAttr("style").removeAttr("class"), r && n.attr("style", r);
|
|
21250
21365
|
}), a("td, th").each((e, t) => {
|
|
21251
21366
|
let n = a(t), r = n.children();
|
|
@@ -21263,17 +21378,17 @@ function Zr(e, t = {}) {
|
|
|
21263
21378
|
!isNaN(e) && e > 1 && n.attr("style", `counter-reset: list-counter ${e - 1}`), n.attr("start", r);
|
|
21264
21379
|
}
|
|
21265
21380
|
}), a("li").each((e, t) => {
|
|
21266
|
-
let n = a(t), r =
|
|
21381
|
+
let n = a(t), r = ri(n.attr("style"));
|
|
21267
21382
|
n.removeAttr("style").removeAttr("class"), r === "center" && n.attr("style", "text-align: center");
|
|
21268
21383
|
let i = n.html() || "", o = i.replace(/^(\s| | |\u00a0)+/, "");
|
|
21269
21384
|
o !== i && n.html(o);
|
|
21270
|
-
}),
|
|
21271
|
-
let l = a("body").html() || a.html(),
|
|
21272
|
-
|
|
21273
|
-
let
|
|
21274
|
-
return
|
|
21385
|
+
}), oi(a), si(a, i);
|
|
21386
|
+
let l = a("body").html() || a.html(), u = l.includes("class=\"alinea"), d = a("ol").length > 0, f = a("h1, h2, h3, h4, h5, h6").length > 0, p = l.includes("class=\"expose-motifs"), m = l.includes("class=\"cover-title\"") || l.includes("class=\"cover-subtitle\"") || l.includes("class=\"cover-info\"") || l.includes("class=\"cover-year\""), h = "";
|
|
21387
|
+
m && (h += qr), f && (h += Wr), p && (h += Gr), u && (h += Ur), d && (h += Kr);
|
|
21388
|
+
let g = h ? `<style>${h}</style>\n${l}` : l;
|
|
21389
|
+
return g = g.replace(/>\s+</g, "> <").replace(/\r\n/g, "\n").replace(/\r/g, "\n").replace(/\n{3,}/g, "\n\n").split("\n").map((e) => e.trim()).filter((e) => e.length > 0).join("\n"), g = g.replace(/ /g, "\xA0"), r && (g = g.replace(/<p[^>]*>\s*( | | |\u00a0|\s)*\s*<\/p>/gi, "").replace(/<p[^>]*>\s*<(strong|em|b|i)>\s*( | | |\u00a0|\s)*\s*<\/\1>\s*<\/p>/gi, "")), g = g.replace(/<span[^>]*>\s*<\/span>/gi, ""), g = g.replace(/ class=""/g, ""), g = ci(g), g = g.replace(/<(strong|em|b|i|sup|sub)>\s*( | | |\u00a0|\s)*\s*<\/\1>/gi, "").replace(/<(strong|em|b|i)>( | | |\u00a0)+<\/\1>/gi, " ").replace(/<br\s*\/?>/gi, "<br/>").replace(/ +/g, " ").trim(), g;
|
|
21275
21390
|
}
|
|
21276
|
-
function
|
|
21391
|
+
function oi(e) {
|
|
21277
21392
|
e("span[id]").each((t, n) => {
|
|
21278
21393
|
let r = e(n), i = r.attr("id"), a = n.attribs || {}, o = Object.keys(a);
|
|
21279
21394
|
if (o.length !== 1 || o[0] !== "id") return;
|
|
@@ -21296,13 +21411,13 @@ function Qr(e) {
|
|
|
21296
21411
|
l.trim() === u.trim() && (s.attr("id", i), r.replaceWith(r.html() || ""));
|
|
21297
21412
|
});
|
|
21298
21413
|
}
|
|
21299
|
-
function
|
|
21414
|
+
function si(e, t = !1) {
|
|
21300
21415
|
let n = e("body");
|
|
21301
21416
|
if (n.length === 0) return;
|
|
21302
21417
|
let r = n.find("span.alinea[data-image-hash]"), i = -1;
|
|
21303
21418
|
r.each((n, r) => {
|
|
21304
21419
|
let a = e(r), o = a.attr("data-image-hash"), s;
|
|
21305
|
-
if (o &&
|
|
21420
|
+
if (o && Hr[o] !== void 0 && (s = Hr[o]), s === void 0) {
|
|
21306
21421
|
if (t) throw Error(`Missing alinea number mapping for image hash: "${o}". Please extract images, review them, and update the mapping in "src/lib/alineas/alineas_numbers.ts".`);
|
|
21307
21422
|
a.remove();
|
|
21308
21423
|
return;
|
|
@@ -21314,11 +21429,11 @@ function $r(e, t = !1) {
|
|
|
21314
21429
|
i = s, a.attr("data-alinea", String(s)), a.text(String(s)), a.removeAttr("data-image-hash");
|
|
21315
21430
|
});
|
|
21316
21431
|
}
|
|
21317
|
-
function
|
|
21432
|
+
function ci(e) {
|
|
21318
21433
|
let t = e;
|
|
21319
21434
|
return t = t.replace(/<\/strong>(\s*)<strong>/gi, "$1"), t = t.replace(/<\/em>(\s*)<em>/gi, "$1"), t = t.replace(/<\/sup>(\s*)<sup>/gi, "$1"), t = t.replace(/<\/sub>(\s*)<sub>/gi, "$1"), t;
|
|
21320
21435
|
}
|
|
21321
|
-
function
|
|
21436
|
+
function li(e, t = {}) {
|
|
21322
21437
|
return `<!DOCTYPE html>
|
|
21323
21438
|
<html lang="fr">
|
|
21324
21439
|
<head>
|
|
@@ -21326,33 +21441,33 @@ function ti(e, t = {}) {
|
|
|
21326
21441
|
<title>Document simplifié</title>
|
|
21327
21442
|
</head>
|
|
21328
21443
|
<body>
|
|
21329
|
-
${
|
|
21444
|
+
${ai(e, t)}
|
|
21330
21445
|
</body>
|
|
21331
21446
|
</html>`;
|
|
21332
21447
|
}
|
|
21333
21448
|
//#endregion
|
|
21334
21449
|
//#region src/lib/server/text_parsers/transformers.ts
|
|
21335
|
-
function
|
|
21450
|
+
function ui(e, t) {
|
|
21336
21451
|
let n = "transformation_", r = {};
|
|
21337
|
-
for (let e of
|
|
21452
|
+
for (let e of j.readdirSync(t).toSorted()) if (e.startsWith(n) && e.endsWith(".json")) {
|
|
21338
21453
|
let i = e.slice(15, -5), a = i.split(".").map((e) => parseInt(e) - 1), o = r;
|
|
21339
21454
|
for (let e of a.slice(1)) {
|
|
21340
21455
|
let t = o.transformations ??= [];
|
|
21341
21456
|
for (; e >= t.length;) t.push({});
|
|
21342
21457
|
o = t[e];
|
|
21343
21458
|
}
|
|
21344
|
-
o.output =
|
|
21345
|
-
let { sourceMap: s, title: c } =
|
|
21459
|
+
o.output = j.readFileSync(M.join(t, `${n}${i}.html`), { encoding: "utf-8" });
|
|
21460
|
+
let { sourceMap: s, title: c } = j.readJsonSync(M.join(t, e), { encoding: "utf-8" });
|
|
21346
21461
|
o.sourceMap = s ?? [], o.title = c;
|
|
21347
21462
|
}
|
|
21348
|
-
return
|
|
21463
|
+
return di(r, e), r;
|
|
21349
21464
|
}
|
|
21350
|
-
function
|
|
21351
|
-
if (e.input = t, e.transformations !== void 0) for (let n of e.transformations)
|
|
21465
|
+
function di(e, t) {
|
|
21466
|
+
if (e.input = t, e.transformations !== void 0) for (let n of e.transformations) di(n, t), t = n.output;
|
|
21352
21467
|
return t;
|
|
21353
21468
|
}
|
|
21354
|
-
function
|
|
21355
|
-
if (
|
|
21469
|
+
function fi(e, t, n = "1") {
|
|
21470
|
+
if (j.ensureDirSync(t), e.transformations === void 0) j.writeJsonSync(M.join(t, `transformation_${n}.json`), {
|
|
21356
21471
|
sourceMap: e.sourceMap,
|
|
21357
21472
|
title: e.title
|
|
21358
21473
|
}, {
|
|
@@ -21360,24 +21475,24 @@ function ii(e, t, n = "1") {
|
|
|
21360
21475
|
spaces: 2
|
|
21361
21476
|
});
|
|
21362
21477
|
else {
|
|
21363
|
-
|
|
21478
|
+
j.writeJsonSync(M.join(t, `transformation_${n}.json`), { title: e.title }, {
|
|
21364
21479
|
encoding: "utf-8",
|
|
21365
21480
|
spaces: 2
|
|
21366
21481
|
});
|
|
21367
|
-
for (let [r, i] of e.transformations.entries())
|
|
21482
|
+
for (let [r, i] of e.transformations.entries()) fi(i, t, `${n}.${r + 1}`);
|
|
21368
21483
|
}
|
|
21369
|
-
e.output !== void 0 &&
|
|
21484
|
+
e.output !== void 0 && j.writeFileSync(M.join(t, `transformation_${n}.html`), e.output, { encoding: "utf-8" });
|
|
21370
21485
|
}
|
|
21371
21486
|
//#endregion
|
|
21372
21487
|
//#region src/lib/server/linkers/html.ts
|
|
21373
|
-
async function
|
|
21374
|
-
let ee = t ?? (e === void 0 ? void 0 : new
|
|
21488
|
+
async function pi({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, htmlFilePath: i, htmlTransformationsInputDir: a, htmlTransformationsOutputDir: o, htmlWithLinksFilePath: s, htmlWithLinksOrReferencesFilePath: c, htmlWithLinksTransformationsOutputDir: l, htmlWithReferencesFilePath: u, linkBaseUrl: d, linkType: f, logIgnoredReferencesTypes: p, logPartialReferences: m, logReferences: h, referredLegifranceTextsInfosFilePath: _ }) {
|
|
21489
|
+
let ee = t ?? (e === void 0 ? void 0 : new g(e));
|
|
21375
21490
|
if (ee === void 0) throw Error("A Canutes database or legal resolver is required");
|
|
21376
|
-
let v = await
|
|
21377
|
-
a === void 0 ? (y =
|
|
21491
|
+
let v = await j.readFile(i, { encoding: "utf-8" }), y;
|
|
21492
|
+
a === void 0 ? (y = ce({ removeAWithHref: !0 })(v), o !== void 0 && fi(y, o)) : y = ui(v, a);
|
|
21378
21493
|
let b = [];
|
|
21379
21494
|
s !== void 0 && b.push("links"), c !== void 0 && b.push("links_or_references"), u !== void 0 && b.push("references");
|
|
21380
|
-
let { outputByType:
|
|
21495
|
+
let { outputByType: x, referredLegifranceTextCountByCid: te } = await ne({
|
|
21381
21496
|
legiResolver: ee,
|
|
21382
21497
|
date: n,
|
|
21383
21498
|
defaultTextId: r,
|
|
@@ -21387,45 +21502,45 @@ async function ai({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, ht
|
|
|
21387
21502
|
linkType: f,
|
|
21388
21503
|
logIgnoredReferencesTypes: p,
|
|
21389
21504
|
logPartialReferences: m,
|
|
21390
|
-
logReferences:
|
|
21505
|
+
logReferences: h,
|
|
21391
21506
|
outputTypes: b,
|
|
21392
21507
|
referredLegifranceTextsInfos: _ !== void 0
|
|
21393
|
-
}),
|
|
21394
|
-
s !== void 0 && (
|
|
21395
|
-
for (let [e, t] of Object.entries(
|
|
21396
|
-
let n =
|
|
21397
|
-
n !== void 0 && await
|
|
21508
|
+
}), S = {};
|
|
21509
|
+
s !== void 0 && (S.links = s), c !== void 0 && (S.links_or_references = c), u !== void 0 && (S.references = u);
|
|
21510
|
+
for (let [e, t] of Object.entries(x)) {
|
|
21511
|
+
let n = S[e];
|
|
21512
|
+
n !== void 0 && await j.writeFile(n, t.html, { encoding: "utf-8" });
|
|
21398
21513
|
}
|
|
21399
|
-
|
|
21514
|
+
x.links !== void 0 && l !== void 0 && fi(ce()(x.links.html), l), _ !== void 0 && await j.writeJson(_, te, {
|
|
21400
21515
|
encoding: "utf-8",
|
|
21401
21516
|
spaces: 2
|
|
21402
21517
|
});
|
|
21403
21518
|
}
|
|
21404
21519
|
//#endregion
|
|
21405
21520
|
//#region src/lib/server/tables_of_contents.ts
|
|
21406
|
-
async function
|
|
21407
|
-
let i =
|
|
21408
|
-
for await (let e of
|
|
21521
|
+
async function mi(e, t, n, r) {
|
|
21522
|
+
let i = ui(await j.readFile(e, { encoding: "utf-8" }), t), a = i.output, o = new w(a), s = await j.readJson(n, { encoding: "utf-8" });
|
|
21523
|
+
for await (let e of p({
|
|
21409
21524
|
context: o,
|
|
21410
21525
|
tableOfContents: s,
|
|
21411
21526
|
transformation: i
|
|
21412
21527
|
}));
|
|
21413
|
-
await
|
|
21528
|
+
await j.writeJson(r, s, {
|
|
21414
21529
|
encoding: "utf-8",
|
|
21415
21530
|
spaces: 2
|
|
21416
21531
|
});
|
|
21417
21532
|
}
|
|
21418
|
-
async function
|
|
21419
|
-
let r =
|
|
21420
|
-
await
|
|
21533
|
+
async function hi(e, t, n) {
|
|
21534
|
+
let r = ui(await j.readFile(e, { encoding: "utf-8" }), t).output, i = b(r);
|
|
21535
|
+
await j.writeJson(n, i, {
|
|
21421
21536
|
encoding: "utf-8",
|
|
21422
21537
|
spaces: 2
|
|
21423
21538
|
});
|
|
21424
21539
|
}
|
|
21425
21540
|
//#endregion
|
|
21426
21541
|
//#region src/lib/server/legi/resolvers.ts
|
|
21427
|
-
function
|
|
21428
|
-
return new
|
|
21542
|
+
function gi({ canutesDb: e }) {
|
|
21543
|
+
return new g(e);
|
|
21429
21544
|
}
|
|
21430
21545
|
//#endregion
|
|
21431
|
-
export {
|
|
21546
|
+
export { _e as LegiResolver, pi as addLinksOrReferencesToHtmlFile, mi as addPositionsToTableOfContentsFile, ge as buildAndInstallTextTitlesInfos, de as buildTextTitlesInfos, gi as createLegiResolver, Se as extractAssembleeAmendmentSearchItems, kn as extractAssembleeExposesDesMotifs, Pn as extractSenatAmendmentSearchItems, Ce as hashAssembleeAmendmentSearchItem, jn as hashAssembleeSearchItem, Fn as hashSenatAmendmentSearchItem, Fr as hashSenatSearchItem, Vr as isAkomaNtosoXml, Mn as isoDateFromAssembleeDocument, Tn as linkAkomaNtosoBillRaw, It as linkAssembleeBillRaw, wn as parseAkomaNtosoBillRaw, Mr as parseAmendment, Ft as parseAssembleeBillRaw, An as parseAssembleeDocumentSearchContent, Pr as parseSenatDocumentSearchContent, ui as readTransformation, bn as renderAkomaNtosoBillRaw, Br as resolveSenatAkomaNtosoSource, hi as simplifiedHtmlBillFileToTableOfContentsFile, ai as simplifyWordHtml, li as simplifyWordHtmlToDocument, fi as writeTransformation };
|