@tricoteuses/tisseuse 0.14.0 → 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/README.md +10 -1
- package/dist/{html-BKxA21Bq.js → html-_xYtGRXN.js} +2462 -2119
- package/dist/index.js +47 -47
- package/dist/{resolver-dqOM1G7A.js → resolver-CLdkzY2R.js} +2 -20
- package/dist/server-f-legi.js +1 -1
- package/dist/server.js +697 -697
- package/dist/src/lib/extractors/links.doctrinal.test.d.ts +1 -0
- package/dist/src/lib/extractors/links.european.test.d.ts +1 -0
- package/dist/src/lib/index.d.ts +2 -0
- package/dist/src/lib/legi/canutes_resolver_europe.test.d.ts +1 -0
- package/dist/src/lib/server/administrative_acts_autocompletion.d.ts +20 -0
- package/dist/src/lib/server/administrative_acts_autocompletion.test.d.ts +1 -0
- package/dist/src/lib/server/ameli_autocompletion.d.ts +17 -0
- package/dist/src/lib/server/ameli_autocompletion.test.d.ts +1 -0
- package/dist/src/lib/server/bofip_autocompletion.d.ts +22 -0
- package/dist/src/lib/server/bofip_autocompletion.test.d.ts +1 -0
- package/dist/src/lib/server/boss_autocompletion.d.ts +18 -0
- package/dist/src/lib/server/boss_autocompletion.test.d.ts +1 -0
- package/dist/src/lib/server/europe_autocompletion.d.ts +18 -0
- package/dist/src/lib/server/europe_autocompletion.test.d.ts +1 -0
- package/dist/src/lib/server/international_treaties_autocompletion.d.ts +16 -0
- package/dist/src/lib/server/international_treaties_autocompletion.test.d.ts +1 -0
- package/dist/src/lib/server/local_acts_autocompletion.d.ts +20 -0
- package/dist/src/lib/server/local_acts_autocompletion.test.d.ts +1 -0
- package/dist/src/lib/server/raa_autocompletion.d.ts +20 -0
- package/dist/src/lib/server/raa_autocompletion.test.d.ts +1 -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_administrative_act_titles.d.ts +16 -0
- package/dist/src/lib/server/sync_administrative_act_titles.test.d.ts +1 -0
- package/dist/src/lib/server/sync_ameli_titles.d.ts +16 -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/server/sync_boss_titles.d.ts +16 -0
- package/dist/src/lib/server/sync_europe_titles.d.ts +16 -0
- package/dist/src/lib/server/sync_international_treaty_titles.d.ts +16 -0
- package/dist/src/lib/server/sync_local_act_titles.d.ts +16 -0
- package/dist/src/lib/server/sync_local_act_titles.test.d.ts +1 -0
- package/dist/src/lib/server/sync_raa_titles.d.ts +16 -0
- package/dist/src/lib/server/typesense_blue_green.d.ts +15 -0
- package/dist/src/lib/server/typesense_blue_green.test.d.ts +1 -0
- package/dist/src/lib/server/typesense_index_lock.d.ts +9 -0
- package/dist/src/lib/server/typesense_index_lock.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/dist/src/lib/text_parsers/portions.d.ts +2 -2
- package/dist/src/lib/text_parsers/simplifiers.d.ts +1 -1
- package/dist/src/scripts/shared/assemblee_legislature.d.ts +2 -0
- package/dist/src/scripts/shared/assemblee_legislature.test.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 ee, c as m, d as h, et as g, jt as te, m as _, n as v, o as y, pt as b, q as ne, t as re, v as x, vt as ie, w as ae, x as oe, y as se, yt as S } from "./html-_xYtGRXN.js";
|
|
2
|
+
import { Ct as ce, D as le, E as ue, N as de, Q as fe, Tt as C, gt as w, i as pe, j as me, jt as T, kt as E, n as he, ot as ge, pt as _e, r as ve, t as ye, wt as D } from "./resolver-CLdkzY2R.js";
|
|
3
|
+
import * as be from "node:crypto";
|
|
4
|
+
import { createHash as O } from "node:crypto";
|
|
5
|
+
import k from "fs-extra";
|
|
6
|
+
import A from "node:path";
|
|
7
7
|
//#region src/lib/server/assemblee_amendment_search.ts
|
|
8
|
-
function
|
|
8
|
+
function xe(e, t) {
|
|
9
9
|
let n = e;
|
|
10
10
|
for (let e of t) {
|
|
11
11
|
if (typeof n != "object" || !n) return null;
|
|
@@ -13,34 +13,34 @@ function M(e, t) {
|
|
|
13
13
|
}
|
|
14
14
|
return typeof n == "string" && n.trim() ? n.trim() : null;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function Se(e) {
|
|
17
17
|
return e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim();
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
return
|
|
19
|
+
function Ce(e) {
|
|
20
|
+
return Se(g(e).text());
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
let t =
|
|
24
|
-
|
|
22
|
+
function we(e) {
|
|
23
|
+
let t = Se([
|
|
24
|
+
xe(e, [
|
|
25
25
|
"corps",
|
|
26
26
|
"contenuAuteur",
|
|
27
27
|
"dispositif"
|
|
28
28
|
]),
|
|
29
|
-
|
|
29
|
+
xe(e, [
|
|
30
30
|
"corps",
|
|
31
31
|
"contenuAuteur",
|
|
32
32
|
"dispositifAmdtCreditPLF"
|
|
33
33
|
]),
|
|
34
|
-
|
|
34
|
+
xe(e, [
|
|
35
35
|
"corps",
|
|
36
36
|
"contenuAuteur",
|
|
37
37
|
"dispositifAmdtCreditPLFR"
|
|
38
38
|
])
|
|
39
|
-
].filter((e) => e !== null).map((e) =>
|
|
39
|
+
].filter((e) => e !== null).map((e) => Ce(e)).join("\n")), n = xe(e, [
|
|
40
40
|
"corps",
|
|
41
41
|
"contenuAuteur",
|
|
42
42
|
"exposeSommaire"
|
|
43
|
-
]), r = n === null ? "" :
|
|
43
|
+
]), r = n === null ? "" : Ce(n);
|
|
44
44
|
return [...t ? [{
|
|
45
45
|
content: t,
|
|
46
46
|
itemKind: "dispositif",
|
|
@@ -51,37 +51,37 @@ function Se(e) {
|
|
|
51
51
|
label: "Exposé sommaire"
|
|
52
52
|
}] : []];
|
|
53
53
|
}
|
|
54
|
-
function
|
|
55
|
-
return
|
|
54
|
+
function Te(e, t) {
|
|
55
|
+
return O("sha256").update(JSON.stringify({
|
|
56
56
|
item: e,
|
|
57
57
|
metadata: t
|
|
58
58
|
})).digest("hex");
|
|
59
59
|
}
|
|
60
60
|
//#endregion
|
|
61
61
|
//#region src/lib/server/parsed_bills.ts
|
|
62
|
-
var
|
|
63
|
-
function
|
|
62
|
+
var Ee = /^expos[ée]\s+des\s+motifs\b/iu;
|
|
63
|
+
function j(e) {
|
|
64
64
|
return (e ?? "").replace(/\u00a0/g, " ").replace(/\s+/g, " ").trim();
|
|
65
65
|
}
|
|
66
|
-
function
|
|
67
|
-
return
|
|
66
|
+
function M(e) {
|
|
67
|
+
return j(e).toLowerCase().normalize("NFD").replace(/\p{Diacritic}/gu, "");
|
|
68
68
|
}
|
|
69
|
-
function
|
|
70
|
-
return
|
|
69
|
+
function De(e) {
|
|
70
|
+
return f(j(e));
|
|
71
71
|
}
|
|
72
|
-
function
|
|
73
|
-
return `_TocArt${
|
|
72
|
+
function Oe(e) {
|
|
73
|
+
return `_TocArt${De(e).replace(/\s+/gu, "")}`;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function ke(e, t) {
|
|
76
76
|
return e(t).closest(".assnatTOC6,.assnatTOC5,.assnatTOC4").length > 0;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
79
|
-
return
|
|
78
|
+
function Ae(e) {
|
|
79
|
+
return M(e).replace(/[‐‑‒–—]/gu, "-").replace(/\s*\.\s*/gu, ".");
|
|
80
80
|
}
|
|
81
|
-
function
|
|
82
|
-
return
|
|
81
|
+
function je(e) {
|
|
82
|
+
return Ae(e).replace(/[^a-z0-9]+/gu, "-").replace(/^-|-$/gu, "");
|
|
83
83
|
}
|
|
84
|
-
function
|
|
84
|
+
function Me(e) {
|
|
85
85
|
switch (e.kind) {
|
|
86
86
|
case "insert_after":
|
|
87
87
|
case "insert_before": return e.insertText;
|
|
@@ -99,12 +99,12 @@ function Ae(e) {
|
|
|
99
99
|
default: return;
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
-
function
|
|
103
|
-
let t =
|
|
104
|
-
if (n?.[1] !== void 0) return
|
|
102
|
+
function Ne(e) {
|
|
103
|
+
let t = j(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 ie(n[1]);
|
|
105
105
|
}
|
|
106
|
-
function
|
|
107
|
-
let t =
|
|
106
|
+
function Pe(e) {
|
|
107
|
+
let t = Me(e), n = b(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 {
|
|
@@ -112,58 +112,58 @@ function Me(e) {
|
|
|
112
112
|
text: o
|
|
113
113
|
};
|
|
114
114
|
});
|
|
115
|
-
let r =
|
|
115
|
+
let r = Ne(e);
|
|
116
116
|
return r === void 0 ? [] : [{
|
|
117
117
|
num: r,
|
|
118
118
|
text: t ?? e.sourceText
|
|
119
119
|
}];
|
|
120
120
|
}
|
|
121
|
-
function
|
|
121
|
+
function Fe(e, t = /* @__PURE__ */ new Set()) {
|
|
122
122
|
if (e == null) return t;
|
|
123
123
|
if (Array.isArray(e)) {
|
|
124
|
-
for (let n of e)
|
|
124
|
+
for (let n of e) Fe(n, t);
|
|
125
125
|
return t;
|
|
126
126
|
}
|
|
127
127
|
if (typeof e != "object") return t;
|
|
128
128
|
let n = e;
|
|
129
129
|
n.type === "article" && typeof n.num == "string" && t.add(n.num);
|
|
130
|
-
for (let e of Object.values(n))
|
|
130
|
+
for (let e of Object.values(n)) Fe(e, t);
|
|
131
131
|
return t;
|
|
132
132
|
}
|
|
133
|
-
function
|
|
134
|
-
let t =
|
|
133
|
+
function Ie(e) {
|
|
134
|
+
let t = M(e.sourceText);
|
|
135
135
|
return /\b(?:cree|cree[e]?s?|resultant|issu|prevu|mentionne)\b[\s\S]{0,80}\b(?:present|presente|pjl|projet\s+de\s+loi)\b/u.test(t);
|
|
136
136
|
}
|
|
137
|
-
function
|
|
138
|
-
return
|
|
137
|
+
function Le(e) {
|
|
138
|
+
return j(e).replace(/[’']/gu, "'").replace(/[‐‑‒–—]/gu, "-");
|
|
139
139
|
}
|
|
140
|
-
function
|
|
141
|
-
let n = new
|
|
140
|
+
function Re(e, t) {
|
|
141
|
+
let n = new ce(e, t), r = fe(n);
|
|
142
142
|
return typeof r != "string" || n.offset <= t ? null : {
|
|
143
143
|
date: r,
|
|
144
144
|
start: t,
|
|
145
145
|
stop: n.offset
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
|
-
function
|
|
148
|
+
function ze(e, t) {
|
|
149
149
|
let n = /\d/u.exec(e.slice(t));
|
|
150
150
|
if (!n) return null;
|
|
151
151
|
let r = t + n.index;
|
|
152
|
-
return e.slice(t, r).trim().length > 0 ? null :
|
|
152
|
+
return e.slice(t, r).trim().length > 0 ? null : Re(e, r);
|
|
153
153
|
}
|
|
154
|
-
function
|
|
154
|
+
function Be(e) {
|
|
155
155
|
let t = /^la présente loi (?:s['’]appli(?:que|quent)|entr(?:e|ent) en vigueur) (?:[aà] compter (?:du|de|d['’])|au|le)\s*/u, n = /^la présente loi s['’]appli(?:que|quent)\s*:\s*/u, r = /\b[aà] compter (?:du|de|d['’])\s*/gu, i = [], a = "la présente loi", o = e.indexOf(a);
|
|
156
156
|
for (; o !== -1;) {
|
|
157
157
|
let s = e.indexOf(a, o + 15), c = e.slice(o, o + 1400), l = t.exec(c);
|
|
158
158
|
if (l) {
|
|
159
|
-
let e =
|
|
159
|
+
let e = ze(c, l[0].length);
|
|
160
160
|
e && i.push(e.date);
|
|
161
161
|
}
|
|
162
162
|
let u = n.exec(c);
|
|
163
163
|
if (u) {
|
|
164
164
|
let e = /\barticle\s+\w/iu.exec(c), t = e === null ? c.slice(u[0].length) : c.slice(u[0].length, e.index);
|
|
165
165
|
for (r.lastIndex = 0; r.exec(t) !== null;) {
|
|
166
|
-
let e =
|
|
166
|
+
let e = ze(t, r.lastIndex);
|
|
167
167
|
e && /^\s+pour\s+les\s+autres\s+dispositions\s+fiscales\b/iu.test(t.slice(e.stop)) && i.push(e.date);
|
|
168
168
|
}
|
|
169
169
|
}
|
|
@@ -171,20 +171,20 @@ function Re(e) {
|
|
|
171
171
|
}
|
|
172
172
|
return i;
|
|
173
173
|
}
|
|
174
|
-
function
|
|
175
|
-
let t =
|
|
174
|
+
function Ve(e) {
|
|
175
|
+
let t = Be(Le(e).toLowerCase()), n = Array.from(new Set(t));
|
|
176
176
|
return n.length === 1 ? n[0] : void 0;
|
|
177
177
|
}
|
|
178
|
-
function
|
|
179
|
-
return
|
|
178
|
+
function He(e) {
|
|
179
|
+
return M(e).replace(/[’]/gu, "'").replace(/[‐‑‒–—]/gu, "-").replace(/^(?:(?:article\s+[^:]+|[a-z][.)]|[ivxlcdm]+\.|\d+°)\s*(?:-\s*)?)+/iu, "");
|
|
180
180
|
}
|
|
181
|
-
function
|
|
181
|
+
function N(e) {
|
|
182
182
|
return e?.type === "tag";
|
|
183
183
|
}
|
|
184
|
-
function
|
|
184
|
+
function Ue(e, t) {
|
|
185
185
|
return e.html(t) ?? "";
|
|
186
186
|
}
|
|
187
|
-
function
|
|
187
|
+
function We(e, t) {
|
|
188
188
|
let n = [], r = /* @__PURE__ */ new Set();
|
|
189
189
|
for (let i of e(t).find("a").get()) {
|
|
190
190
|
let a = e(i).attr("href") ?? "", o = /\/legifrance\/(articles|sections|textes)\/([^?#"]+)/u.exec(a);
|
|
@@ -192,43 +192,43 @@ function He(e, t) {
|
|
|
192
192
|
let s = o[1] === "articles" ? "article" : o[1] === "sections" ? "division" : "text", c = o[2].replace(/\.md$/u, ""), l = `${s}\0${c}`;
|
|
193
193
|
if (r.has(l)) continue;
|
|
194
194
|
r.add(l);
|
|
195
|
-
let u =
|
|
195
|
+
let u = j(e(i).text());
|
|
196
196
|
n.push({
|
|
197
197
|
id: c,
|
|
198
|
-
...
|
|
198
|
+
...Ge(e, t, i) ? { insideFrenchQuotes: !0 } : {},
|
|
199
199
|
...u ? { text: u } : {},
|
|
200
200
|
type: s
|
|
201
201
|
});
|
|
202
202
|
}
|
|
203
203
|
return n;
|
|
204
204
|
}
|
|
205
|
-
function
|
|
206
|
-
let r =
|
|
205
|
+
function Ge(e, t, n) {
|
|
206
|
+
let r = Ke(e, t, n);
|
|
207
207
|
return (r.match(/«/gu) ?? []).length > (r.match(/»/gu) ?? []).length;
|
|
208
208
|
}
|
|
209
|
-
function
|
|
209
|
+
function Ke(e, t, n) {
|
|
210
210
|
if (t === n) return "";
|
|
211
211
|
if (t.type === "text") return t.data ?? "";
|
|
212
|
-
if (!
|
|
212
|
+
if (!N(t)) return "";
|
|
213
213
|
let r = "";
|
|
214
214
|
for (let i of e(t).contents().get()) {
|
|
215
215
|
if (i === n) return r;
|
|
216
|
-
if (
|
|
216
|
+
if (N(i) && e.contains(i, n)) return r + Ke(e, i, n);
|
|
217
217
|
r += e(i).text();
|
|
218
218
|
}
|
|
219
219
|
return r;
|
|
220
220
|
}
|
|
221
|
-
function
|
|
222
|
-
return t.map((t) =>
|
|
221
|
+
function qe(e, t) {
|
|
222
|
+
return t.map((t) => j(e(t).text())).filter(Boolean).join("\n");
|
|
223
223
|
}
|
|
224
|
-
function
|
|
225
|
-
let n =
|
|
226
|
-
return !n ||
|
|
224
|
+
function Je(e) {
|
|
225
|
+
let n = M(e);
|
|
226
|
+
return !n || Ee.test(n) ? "noise" : t.test(e) ? "directive_candidate" : "context";
|
|
227
227
|
}
|
|
228
|
-
async function
|
|
228
|
+
async function Ye(e, t, n) {
|
|
229
229
|
if (n === void 0) throw Error("A document date is required to add links to legal references.");
|
|
230
230
|
if (t.legiResolver === void 0 && t.canutesDb === void 0) throw Error("A Canutes database or an explicit legal resolver is required to add links to legal references.");
|
|
231
|
-
let { output: r } = await
|
|
231
|
+
let { output: r } = await v({
|
|
232
232
|
date: n,
|
|
233
233
|
html: e,
|
|
234
234
|
legiResolver: t.legiResolver ?? new h(t.canutesDb),
|
|
@@ -240,13 +240,13 @@ async function qe(e, t, n) {
|
|
|
240
240
|
});
|
|
241
241
|
return r ?? e;
|
|
242
242
|
}
|
|
243
|
-
function
|
|
243
|
+
function Xe(e, t) {
|
|
244
244
|
let n = e(t).closest("h1,h2,h3,h4,h5,h6,p,td,th").get(0), r = e(t).closest("table").get(0);
|
|
245
|
-
return
|
|
245
|
+
return N(r) && N(n) && e(n).parents("table").get(0) === r ? r : N(n) ? n : t;
|
|
246
246
|
}
|
|
247
|
-
function
|
|
247
|
+
function Ze(e, t, n, r) {
|
|
248
248
|
if (t.has(r.container)) return;
|
|
249
|
-
let i = r.id ??
|
|
249
|
+
let i = r.id ?? Oe(r.num ?? r.label);
|
|
250
250
|
n.has(i) || (n.add(i), t.add(r.container), e.push({
|
|
251
251
|
id: i,
|
|
252
252
|
label: r.label,
|
|
@@ -256,16 +256,16 @@ function Ye(e, t, n, r) {
|
|
|
256
256
|
container: r.container
|
|
257
257
|
}));
|
|
258
258
|
}
|
|
259
|
-
function
|
|
259
|
+
function Qe(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
|
-
if (
|
|
263
|
-
let o =
|
|
262
|
+
if (ke(e, a)) return;
|
|
263
|
+
let o = S(j(e(a).text()));
|
|
264
264
|
if (!o) return;
|
|
265
265
|
let s = e(a).attr("id");
|
|
266
266
|
if (!s || r.has(s)) return;
|
|
267
|
-
let c =
|
|
268
|
-
|
|
267
|
+
let c = Xe(e, a);
|
|
268
|
+
Ze(t, n, r, {
|
|
269
269
|
id: s,
|
|
270
270
|
...o,
|
|
271
271
|
element: a,
|
|
@@ -273,8 +273,8 @@ 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 =
|
|
277
|
-
o &&
|
|
276
|
+
let o = S(j(e(a).text()));
|
|
277
|
+
o && Ze(t, n, r, {
|
|
278
278
|
...o,
|
|
279
279
|
element: a,
|
|
280
280
|
container: a
|
|
@@ -283,27 +283,27 @@ function Xe(e) {
|
|
|
283
283
|
let i = e("body *");
|
|
284
284
|
return t.sort((e, t) => i.index(e.container) - i.index(t.container)), t;
|
|
285
285
|
}
|
|
286
|
-
function
|
|
287
|
-
if (
|
|
286
|
+
function $e(e, t) {
|
|
287
|
+
if (ke(e, t)) return !1;
|
|
288
288
|
let n = t.tagName?.toLowerCase();
|
|
289
289
|
if (n !== "p") return /^h[1-6]$/u.test(n ?? "");
|
|
290
290
|
let r = e(t).attr("style") ?? "", i = e(t).html() ?? "";
|
|
291
291
|
return /text-align\s*:\s*center/iu.test(r) && (/font-weight\s*:\s*bold/iu.test(r) || /font-weight\s*:\s*bold/iu.test(i) || /<(?:strong|b)(?:\s|>)/iu.test(i));
|
|
292
292
|
}
|
|
293
|
-
function
|
|
293
|
+
function et(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
|
-
if (
|
|
297
|
-
let o =
|
|
298
|
-
o &&
|
|
296
|
+
if (ke(e, a) || !e(a).hasClass("assnat9ArticleNum") && !$e(e, a)) return;
|
|
297
|
+
let o = S(e(a).text());
|
|
298
|
+
o && Ze(t, n, r, {
|
|
299
299
|
...o,
|
|
300
300
|
element: a,
|
|
301
301
|
container: a
|
|
302
302
|
});
|
|
303
303
|
}), t;
|
|
304
304
|
}
|
|
305
|
-
function
|
|
306
|
-
let t =
|
|
305
|
+
function tt(e) {
|
|
306
|
+
let t = M(De(e ?? "")).replace(/[()]/gu, "").trim();
|
|
307
307
|
if (!t || t === "liminaire") return;
|
|
308
308
|
if (t === "unique") return {
|
|
309
309
|
base: 1,
|
|
@@ -312,21 +312,21 @@ function $e(e) {
|
|
|
312
312
|
};
|
|
313
313
|
let n = /^(?:(\d+)|1er|premier)(?:\s+([a-z]+))?$/u.exec(t);
|
|
314
314
|
if (!n) return;
|
|
315
|
-
let r = n[1] === void 0 ? 1 : Number.parseInt(n[1], 10), i = n[2], a = i === void 0 ? 0 :
|
|
315
|
+
let r = n[1] === void 0 ? 1 : Number.parseInt(n[1], 10), i = n[2], a = i === void 0 ? 0 : nt(i);
|
|
316
316
|
if (a !== void 0) return {
|
|
317
317
|
base: r,
|
|
318
318
|
suffixOrder: a,
|
|
319
319
|
text: t
|
|
320
320
|
};
|
|
321
321
|
}
|
|
322
|
-
function
|
|
323
|
-
let t = new
|
|
322
|
+
function nt(e) {
|
|
323
|
+
let t = new ce(e), n = ge(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
|
-
function
|
|
326
|
+
function rt(e) {
|
|
327
327
|
let t = [], n = e.map((e) => ({
|
|
328
328
|
heading: e,
|
|
329
|
-
token:
|
|
329
|
+
token: tt(e.num)
|
|
330
330
|
}));
|
|
331
331
|
n.filter(({ token: e }) => e?.text === "unique").length > 0 && e.length > 1 && t.push("Article unique appears with other articles");
|
|
332
332
|
let r;
|
|
@@ -339,23 +339,23 @@ function tt(e) {
|
|
|
339
339
|
}
|
|
340
340
|
t.length > 0 && process.env.TISSEUSE_WARN_ASSEMBLEE_HEADING_SEQUENCE === "1" && console.warn("Incoherent Assemblée article heading sequence", { issues: t });
|
|
341
341
|
}
|
|
342
|
-
function
|
|
343
|
-
let n =
|
|
344
|
-
if (n.length > 0) return t &&
|
|
345
|
-
let r =
|
|
346
|
-
return t &&
|
|
342
|
+
function it(e, { warn: t = !0 } = {}) {
|
|
343
|
+
let n = Qe(e);
|
|
344
|
+
if (n.length > 0) return t && rt(n), n;
|
|
345
|
+
let r = et(e);
|
|
346
|
+
return t && rt(r), r;
|
|
347
347
|
}
|
|
348
|
-
function
|
|
348
|
+
function at(e) {
|
|
349
349
|
let t = e.next;
|
|
350
350
|
for (; t !== null;) {
|
|
351
|
-
if (
|
|
351
|
+
if (N(t)) return t;
|
|
352
352
|
t = t.next;
|
|
353
353
|
}
|
|
354
354
|
return null;
|
|
355
355
|
}
|
|
356
|
-
function
|
|
356
|
+
function ot(e, t, n) {
|
|
357
357
|
let r = [t.container], i = n?.container;
|
|
358
|
-
for (let e =
|
|
358
|
+
for (let e = at(t.container); e !== null && e !== i; e = at(e)) r.push(e);
|
|
359
359
|
if (r.length > 1) return r;
|
|
360
360
|
let a = e("body *").index(t.container), o = i ? e("body *").index(i) : -1;
|
|
361
361
|
return e("body > *").get().filter((t) => {
|
|
@@ -363,7 +363,7 @@ function it(e, t, n) {
|
|
|
363
363
|
return n >= a && (o === -1 || n < o);
|
|
364
364
|
});
|
|
365
365
|
}
|
|
366
|
-
function
|
|
366
|
+
function st(e, t) {
|
|
367
367
|
let n = [], r = /* @__PURE__ */ new Set();
|
|
368
368
|
for (let i of t) {
|
|
369
369
|
let t = "p,li,table", a = e(i).is(t) ? [i] : e(i).find(t).get();
|
|
@@ -371,76 +371,76 @@ function at(e, t) {
|
|
|
371
371
|
}
|
|
372
372
|
return n;
|
|
373
373
|
}
|
|
374
|
-
function
|
|
374
|
+
function ct(e, t, n) {
|
|
375
375
|
let r = [], i = !1;
|
|
376
|
-
for (let a of
|
|
377
|
-
let n =
|
|
376
|
+
for (let a of st(e, n)) {
|
|
377
|
+
let n = j(e(a).text());
|
|
378
378
|
if (!n) continue;
|
|
379
|
-
|
|
380
|
-
let o = i ? "noise" :
|
|
379
|
+
Ee.test(n) && (i = !0);
|
|
380
|
+
let o = i ? "noise" : Je(n), s = `${t}-b${r.length + 1}`;
|
|
381
381
|
e(a).attr("data-pjl-parsed-article-id", t), e(a).attr("data-pjl-parsed-block-id", s), r.push({
|
|
382
382
|
id: s,
|
|
383
383
|
articleId: t,
|
|
384
384
|
kind: o,
|
|
385
|
-
links:
|
|
385
|
+
links: We(e, a),
|
|
386
386
|
text: n,
|
|
387
|
-
html:
|
|
387
|
+
html: Ue(e, a)
|
|
388
388
|
});
|
|
389
389
|
}
|
|
390
390
|
return r;
|
|
391
391
|
}
|
|
392
|
-
function
|
|
392
|
+
function lt(e, t) {
|
|
393
393
|
if (t.length === 0) return e;
|
|
394
394
|
let n = `<div style="display: none;">\n${t.map((e) => `<p class="assnatTOC6"><a href="#${e.id}"><span class="assnatHyperlink" style="font-weight:bold; text-decoration:none; color:#000000">${e.label.toUpperCase()}</span></a></p>`).join("\n")}\n</div>`;
|
|
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
|
-
function
|
|
398
|
-
let t =
|
|
399
|
-
for (let e of
|
|
400
|
-
let n =
|
|
401
|
-
i !== n && (i?.startsWith("_Toc") && !
|
|
397
|
+
function ut(e) {
|
|
398
|
+
let t = g(e);
|
|
399
|
+
for (let e of it(t, { warn: !1 })) {
|
|
400
|
+
let n = Oe(e.num ?? e.label.replace(/^Article\s+/iu, "")), r = t(e.element), i = r.attr("id");
|
|
401
|
+
i !== n && (i?.startsWith("_Toc") && !dt(t, i, e.element) && r.before(t("<span></span>").attr("id", i)), r.attr("id", n));
|
|
402
402
|
}
|
|
403
|
-
let n =
|
|
403
|
+
let n = it(t);
|
|
404
404
|
for (let [e, r] of n.entries()) {
|
|
405
|
-
let i =
|
|
405
|
+
let i = ot(t, r, n[e + 1]).flatMap((e) => t(e).is("span.alinea[data-alinea]") ? [e] : t(e).find("span.alinea[data-alinea]").get());
|
|
406
406
|
for (let e of i) {
|
|
407
407
|
let n = t(e).attr("data-alinea")?.trim();
|
|
408
408
|
if (!n) continue;
|
|
409
409
|
let i = `${r.id}-alinea-${n.replace(/\s+/gu, "")}`;
|
|
410
|
-
if (
|
|
410
|
+
if (dt(t, i, e)) continue;
|
|
411
411
|
let a = t(e).attr("id");
|
|
412
412
|
a && a !== i ? t(e).before(t("<span></span>").attr("id", i)) : t(e).attr("id", i);
|
|
413
413
|
}
|
|
414
414
|
}
|
|
415
415
|
return t.html();
|
|
416
416
|
}
|
|
417
|
-
function
|
|
417
|
+
function dt(e, t, n) {
|
|
418
418
|
for (let r of e("[id]").get()) if (r !== n && e(r).attr("id") === t) return !0;
|
|
419
419
|
return !1;
|
|
420
420
|
}
|
|
421
|
-
function
|
|
422
|
-
let n =
|
|
421
|
+
function ft(e, t) {
|
|
422
|
+
let n = He("sourceText" in t ? t.sourceText : "");
|
|
423
423
|
if (n) return e.filter((e) => e.kind === "directive_candidate").find((e) => {
|
|
424
|
-
let t =
|
|
424
|
+
let t = He(e.text);
|
|
425
425
|
return t.length > 0 && (n.includes(t) || t.includes(n));
|
|
426
426
|
});
|
|
427
427
|
}
|
|
428
|
-
function
|
|
428
|
+
function pt(e, t) {
|
|
429
429
|
if (t) return t.blockIds.map((t) => e.get(t)).find((e) => e?.kind === "directive_candidate");
|
|
430
430
|
}
|
|
431
|
-
function
|
|
431
|
+
function mt(e) {
|
|
432
432
|
return e?.links.filter((e) => !e.insideFrenchQuotes && (e.type === "article" || e.type === "division")).map((e) => e.id) ?? [];
|
|
433
433
|
}
|
|
434
|
-
function
|
|
435
|
-
let t =
|
|
434
|
+
function ht(e) {
|
|
435
|
+
let t = j(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
|
-
function
|
|
440
|
+
function gt(e) {
|
|
441
441
|
let t = /* @__PURE__ */ new Map(), n = [];
|
|
442
442
|
for (let r of e) {
|
|
443
|
-
let e =
|
|
443
|
+
let e = ht(r.text);
|
|
444
444
|
if (e === void 0) {
|
|
445
445
|
t.set(r.id, [...n.map((e) => e.block), r]);
|
|
446
446
|
continue;
|
|
@@ -453,14 +453,14 @@ function mt(e) {
|
|
|
453
453
|
}
|
|
454
454
|
return t;
|
|
455
455
|
}
|
|
456
|
-
function
|
|
456
|
+
function _t(e, t) {
|
|
457
457
|
let n = [], r = /* @__PURE__ */ new Set();
|
|
458
458
|
for (let i of [...e ?? [], ...t]) i !== void 0 && (r.has(i.id) || (r.add(i.id), n.push(i)));
|
|
459
459
|
return n;
|
|
460
460
|
}
|
|
461
|
-
function
|
|
461
|
+
function vt(e, t, n) {
|
|
462
462
|
if (!t) return;
|
|
463
|
-
let r =
|
|
463
|
+
let r = _t(e, t.blockIds.map((e) => n.get(e)).filter((e) => e !== void 0));
|
|
464
464
|
if (r.length === 0) return;
|
|
465
465
|
let i = r.map((e) => e.id);
|
|
466
466
|
if (i.length === t.blockIds.length && i.every((e, n) => e === t.blockIds[n])) return;
|
|
@@ -475,7 +475,7 @@ function gt(e, t, n) {
|
|
|
475
475
|
}
|
|
476
476
|
};
|
|
477
477
|
}
|
|
478
|
-
function
|
|
478
|
+
function yt(e) {
|
|
479
479
|
let t = [], n = 0;
|
|
480
480
|
for (let r of e.blocks) {
|
|
481
481
|
let i = e.directiveText.indexOf(r.text, n);
|
|
@@ -489,7 +489,7 @@ function _t(e) {
|
|
|
489
489
|
}
|
|
490
490
|
return t;
|
|
491
491
|
}
|
|
492
|
-
function
|
|
492
|
+
function bt(e, t, n) {
|
|
493
493
|
let { start: r, stop: i } = n.sourcePosition, a = t.filter((e) => e.stop >= r && e.start <= i);
|
|
494
494
|
if (a.length === 0) return;
|
|
495
495
|
let o = a[0], s = a[a.length - 1], c = o.start, l = s.stop;
|
|
@@ -503,7 +503,7 @@ function vt(e, t, n) {
|
|
|
503
503
|
}
|
|
504
504
|
};
|
|
505
505
|
}
|
|
506
|
-
function
|
|
506
|
+
function xt(e, t, n) {
|
|
507
507
|
if (!t) return;
|
|
508
508
|
let r = e.directiveText.indexOf(t.text);
|
|
509
509
|
if (r === -1) return;
|
|
@@ -516,14 +516,14 @@ function yt(e, t, n) {
|
|
|
516
516
|
stop: a
|
|
517
517
|
};
|
|
518
518
|
}
|
|
519
|
-
function
|
|
520
|
-
let t =
|
|
519
|
+
function St(e) {
|
|
520
|
+
let t = yt(e), n = new Map(e.blocks.map((e) => [e.id, e])), r = gt(e.blocks), i = /* @__PURE__ */ new Map(), a = [];
|
|
521
521
|
for (let t of e.blocks) {
|
|
522
|
-
let e =
|
|
522
|
+
let e = mt(t);
|
|
523
523
|
e.length > 0 && (a = e), i.set(t.id, a);
|
|
524
524
|
}
|
|
525
|
-
return
|
|
526
|
-
let o =
|
|
525
|
+
return _(e.directiveText).map((a) => {
|
|
526
|
+
let o = bt(e, t, a), s = pt(n, o) ?? ft(e.blocks, a), c = mt(s), l = c.length > 0 ? c : s?.id === void 0 ? [] : i.get(s.id) ?? [], u = xt(e, s, a), d = vt(s?.id === void 0 ? void 0 : r.get(s.id), o, n);
|
|
527
527
|
return {
|
|
528
528
|
articleId: e.id,
|
|
529
529
|
blockId: s?.id,
|
|
@@ -543,13 +543,13 @@ function bt(e) {
|
|
|
543
543
|
};
|
|
544
544
|
});
|
|
545
545
|
}
|
|
546
|
-
function
|
|
546
|
+
function Ct(e) {
|
|
547
547
|
let t = /* @__PURE__ */ new Map(), n = [], r = /* @__PURE__ */ new Set();
|
|
548
548
|
for (let i of e) {
|
|
549
|
-
let e =
|
|
549
|
+
let e = Pe(i.directive);
|
|
550
550
|
if (e.length === 0) continue;
|
|
551
551
|
let a = e.map(({ num: e }) => ({
|
|
552
|
-
definitionId: `${i.articleId}:article:${
|
|
552
|
+
definitionId: `${i.articleId}:article:${je(e)}`,
|
|
553
553
|
num: e
|
|
554
554
|
}));
|
|
555
555
|
t.set(i, a);
|
|
@@ -572,13 +572,13 @@ function xt(e) {
|
|
|
572
572
|
definitions: n
|
|
573
573
|
};
|
|
574
574
|
}
|
|
575
|
-
function
|
|
576
|
-
let r = new Map(t.map((e) => [
|
|
575
|
+
function wt(e, t, n) {
|
|
576
|
+
let r = new Map(t.map((e) => [Ae(e.num), e]));
|
|
577
577
|
return e.map((e) => {
|
|
578
|
-
let t = n.get(e), i = t?.[0], a = [...
|
|
578
|
+
let t = n.get(e), i = t?.[0], a = [...Fe(e.directive.reference)].map((e) => r.get(Ae(e))).filter((e) => e !== void 0 && e.definitionId !== i?.definitionId)[0], o = a === void 0 ? void 0 : {
|
|
579
579
|
definitionId: a.definitionId,
|
|
580
580
|
num: a.num
|
|
581
|
-
}, s =
|
|
581
|
+
}, s = Ie(e.directive), c = (e.targetIds?.length ?? 0) > 0;
|
|
582
582
|
return {
|
|
583
583
|
...e,
|
|
584
584
|
...i === void 0 ? {} : { createdArticle: i },
|
|
@@ -591,40 +591,40 @@ function St(e, t, n) {
|
|
|
591
591
|
};
|
|
592
592
|
});
|
|
593
593
|
}
|
|
594
|
-
function
|
|
594
|
+
function Tt(e, t, n, r, i, a, o = !0, s) {
|
|
595
595
|
let c = i.map((e) => e.directiveText).filter(Boolean).join("\n"), l = {
|
|
596
596
|
sourceFormat: e,
|
|
597
597
|
documentDate: r,
|
|
598
598
|
html: t,
|
|
599
599
|
htmlWithLinks: n,
|
|
600
|
-
tableOfContents: a ??
|
|
600
|
+
tableOfContents: a ?? y(c),
|
|
601
601
|
articles: i
|
|
602
602
|
};
|
|
603
603
|
if (!o) return {
|
|
604
604
|
...l,
|
|
605
605
|
directives: []
|
|
606
606
|
};
|
|
607
|
-
let u =
|
|
607
|
+
let u = Ve(i.map((e) => e.text).join("\n")), d = i.flatMap(St), { createdArticlesByDirective: f, definitions: p } = Ct(d), ee = wt(d, p, f);
|
|
608
608
|
return {
|
|
609
609
|
...l,
|
|
610
610
|
...u ? { globalApplicabilityDate: u } : {},
|
|
611
611
|
...p.length > 0 ? { internalArticleDefinitions: p } : {},
|
|
612
|
-
directives:
|
|
612
|
+
directives: ee,
|
|
613
613
|
...s !== void 0 && s.length > 0 ? { diagnostics: s } : {}
|
|
614
614
|
};
|
|
615
615
|
}
|
|
616
|
-
function
|
|
616
|
+
function Et(e) {
|
|
617
617
|
return { items: e.map((e) => ({
|
|
618
618
|
id: e.id,
|
|
619
619
|
line: e.title ? `${e.label} : ${e.title}` : e.label,
|
|
620
620
|
type: "article"
|
|
621
621
|
})) };
|
|
622
622
|
}
|
|
623
|
-
function
|
|
624
|
-
return Array.from(
|
|
623
|
+
function Dt(e) {
|
|
624
|
+
return Array.from(m(e)).filter((e) => e.type === "article").map((e) => M(e.line.split(/[::]/u)[0]));
|
|
625
625
|
}
|
|
626
|
-
function
|
|
627
|
-
let t =
|
|
626
|
+
function Ot(e) {
|
|
627
|
+
let t = Dt(y(e.map((e) => e.directiveText).filter(Boolean).join("\n"))), n = e.map((e) => M(e.label)), r = [];
|
|
628
628
|
if (t.length > 0 && (t.length !== n.length || t.some((e, t) => e !== n[t]))) {
|
|
629
629
|
let i = t.findIndex((e, t) => e !== n[t]);
|
|
630
630
|
r.push({
|
|
@@ -645,42 +645,42 @@ function Et(e) {
|
|
|
645
645
|
}
|
|
646
646
|
return {
|
|
647
647
|
diagnostics: r,
|
|
648
|
-
tableOfContents:
|
|
648
|
+
tableOfContents: Et(e)
|
|
649
649
|
};
|
|
650
650
|
}
|
|
651
|
-
async function
|
|
652
|
-
let n = new
|
|
653
|
-
let n =
|
|
651
|
+
async function kt(e, t) {
|
|
652
|
+
let n = new he("parseAssembleeBillRaw"), r = t.linkedHtml === void 0 ? await n.time("linkAssembleeBillRaw", () => At(e, t)) : void 0, i = n.timeSync("applyArticleAnchorIds", () => ut(t.linkedHtml ?? r.linkedHtml), { inputSize: e.length }), a = n.timeSync("cheerioLoadLinkedHtml", () => g(i)), o = n.timeSync("extractArticleHeadings", () => it(a)), s = n.timeSync("extractArticlesAndBlocks", () => o.map((e, t) => {
|
|
653
|
+
let n = ot(a, e, o[t + 1]), r = ct(a, e.id, n), i = r.filter((e) => e.kind !== "noise").map((e) => e.text).join("\n");
|
|
654
654
|
return {
|
|
655
655
|
id: e.id,
|
|
656
656
|
label: e.label,
|
|
657
657
|
num: e.num,
|
|
658
658
|
title: e.title,
|
|
659
|
-
text:
|
|
660
|
-
html: n.map((e) =>
|
|
659
|
+
text: qe(a, n),
|
|
660
|
+
html: n.map((e) => Ue(a, e)).join("\n"),
|
|
661
661
|
directiveText: i,
|
|
662
662
|
blocks: r
|
|
663
663
|
};
|
|
664
|
-
}), { count: o.length }), c = n.timeSync("injectHiddenArticleSummary", () =>
|
|
665
|
-
return
|
|
666
|
-
articleCount:
|
|
667
|
-
blockCount:
|
|
668
|
-
directiveCount:
|
|
669
|
-
targetDirectiveCount:
|
|
670
|
-
}),
|
|
664
|
+
}), { count: o.length }), c = n.timeSync("injectHiddenArticleSummary", () => lt(a.html(), s)), { diagnostics: l, tableOfContents: u } = n.timeSync("buildAssembleeTableOfContents", () => Ot(s), { count: s.length }), d = n.timeSync("buildParsedDocument", () => Tt("assemblee-html", e, c, t.date, s, u, t.includeDirectiveAnalysis, l));
|
|
665
|
+
return d.diagnostics?.length && process.env.TISSEUSE_WARN_PARSED_BILL_DIAGNOSTICS === "1" && console.warn("Assemblée bill parsing diagnostics", d.diagnostics), n.log({
|
|
666
|
+
articleCount: d.articles.length,
|
|
667
|
+
blockCount: d.articles.reduce((e, t) => e + t.blocks.length, 0),
|
|
668
|
+
directiveCount: d.directives.length,
|
|
669
|
+
targetDirectiveCount: d.directives.filter((e) => e.targetIds !== void 0).length
|
|
670
|
+
}), d;
|
|
671
671
|
}
|
|
672
|
-
async function
|
|
672
|
+
async function At(e, t) {
|
|
673
673
|
return {
|
|
674
674
|
sourceFormat: "assemblee-html",
|
|
675
675
|
documentDate: t.date,
|
|
676
676
|
html: e,
|
|
677
|
-
linkedHtml: await
|
|
677
|
+
linkedHtml: await Ye(e, t, t.date)
|
|
678
678
|
};
|
|
679
679
|
}
|
|
680
|
-
function
|
|
680
|
+
function P(e) {
|
|
681
681
|
return e.replace(/&/gu, "&").replace(/</gu, "<").replace(/>/gu, ">").replace(/"/gu, """);
|
|
682
682
|
}
|
|
683
|
-
function
|
|
683
|
+
function jt(e) {
|
|
684
684
|
let t = e;
|
|
685
685
|
for (let e = 0; e < 3; e++) {
|
|
686
686
|
let e = t;
|
|
@@ -688,27 +688,27 @@ function kt(e) {
|
|
|
688
688
|
}
|
|
689
689
|
return t;
|
|
690
690
|
}
|
|
691
|
-
function
|
|
691
|
+
function Mt(e) {
|
|
692
692
|
return /(?:<|&lt;)\/?(?:p|br|span|b|i|u|sup|sub|table|thead|tbody|tr|th|td|ul|ol|li)\b/iu.test(e);
|
|
693
693
|
}
|
|
694
|
-
function
|
|
694
|
+
function F(e) {
|
|
695
695
|
return e.name.replace(/^.*:/u, "");
|
|
696
696
|
}
|
|
697
|
-
function
|
|
698
|
-
return t.children.map((t) =>
|
|
697
|
+
function Nt(e, t) {
|
|
698
|
+
return t.children.map((t) => I(e, t)).filter(Boolean).join("");
|
|
699
699
|
}
|
|
700
|
-
function
|
|
701
|
-
return t.children.map((t) => t.type === "text" &&
|
|
700
|
+
function Pt(e, t) {
|
|
701
|
+
return t.children.map((t) => t.type === "text" && Mt(t.data) ? jt(t.data) : I(e, t)).filter(Boolean).join("");
|
|
702
702
|
}
|
|
703
|
-
function
|
|
703
|
+
function I(e, t) {
|
|
704
704
|
if (t.type === "text") {
|
|
705
705
|
let e = t.data.replace(/\s+\./gu, ".");
|
|
706
|
-
return
|
|
706
|
+
return Mt(e) ? jt(e) : P(e);
|
|
707
707
|
}
|
|
708
|
-
if (!
|
|
709
|
-
let n =
|
|
708
|
+
if (!N(t)) return "";
|
|
709
|
+
let n = F(t), r = Nt(e, t);
|
|
710
710
|
switch (n) {
|
|
711
|
-
case "p": return `<p${
|
|
711
|
+
case "p": return `<p${L(e, t, [
|
|
712
712
|
"id",
|
|
713
713
|
"class",
|
|
714
714
|
"align",
|
|
@@ -722,13 +722,13 @@ function R(e, t) {
|
|
|
722
722
|
case "u":
|
|
723
723
|
case "sup":
|
|
724
724
|
case "sub":
|
|
725
|
-
case "abbr": return `<${n}${
|
|
725
|
+
case "abbr": return `<${n}${L(e, t, [
|
|
726
726
|
"id",
|
|
727
727
|
"class",
|
|
728
728
|
"title",
|
|
729
729
|
"style"
|
|
730
730
|
])}>${r}</${n}>`;
|
|
731
|
-
case "a": return `<a href="${
|
|
731
|
+
case "a": return `<a href="${P(e(t).attr("href") ?? e(t).attr("target") ?? "#")}"${L(e, t, [
|
|
732
732
|
"id",
|
|
733
733
|
"class",
|
|
734
734
|
"title",
|
|
@@ -739,8 +739,8 @@ function R(e, t) {
|
|
|
739
739
|
case "tbody":
|
|
740
740
|
case "tr":
|
|
741
741
|
case "th":
|
|
742
|
-
case "td": return
|
|
743
|
-
case "caption": return `<caption${
|
|
742
|
+
case "td": return Ft(e, t, n, r);
|
|
743
|
+
case "caption": return `<caption${L(e, t, [
|
|
744
744
|
"id",
|
|
745
745
|
"class",
|
|
746
746
|
"align",
|
|
@@ -748,12 +748,12 @@ function R(e, t) {
|
|
|
748
748
|
])}>${r}</caption>`;
|
|
749
749
|
case "num": return `<span class="akn-num">${r}</span> `;
|
|
750
750
|
case "heading": return `<p class="akn-heading">${r}</p>`;
|
|
751
|
-
case "content": return
|
|
752
|
-
case "alinea": return
|
|
753
|
-
case "article": return
|
|
751
|
+
case "content": return Pt(e, t);
|
|
752
|
+
case "alinea": return R(e, t, "div", "akn-alinea");
|
|
753
|
+
case "article": return R(e, t, "article", "akn-article");
|
|
754
754
|
case "blockList":
|
|
755
755
|
case "list": return `<div class="akn-list">${r}</div>`;
|
|
756
|
-
case "item": return
|
|
756
|
+
case "item": return R(e, t, "div", "akn-item");
|
|
757
757
|
case "listIntroduction":
|
|
758
758
|
case "listWrapUp":
|
|
759
759
|
case "intro":
|
|
@@ -769,23 +769,23 @@ function R(e, t) {
|
|
|
769
769
|
case "book":
|
|
770
770
|
case "tome":
|
|
771
771
|
case "subchapter":
|
|
772
|
-
case "subsection": return
|
|
772
|
+
case "subsection": return R(e, t, "section", `akn-${n}`);
|
|
773
773
|
case "crossHeading": return `<p class="akn-cross-heading">${r}</p>`;
|
|
774
774
|
default: return r;
|
|
775
775
|
}
|
|
776
776
|
}
|
|
777
|
-
function
|
|
777
|
+
function L(e, t, n, r = {}) {
|
|
778
778
|
let i = [];
|
|
779
779
|
for (let r of n) {
|
|
780
780
|
if (r === "style") continue;
|
|
781
781
|
let n = e(t).attr(r);
|
|
782
|
-
n !== void 0 && i.push(`${r}="${
|
|
782
|
+
n !== void 0 && i.push(`${r}="${P(n)}"`);
|
|
783
783
|
}
|
|
784
784
|
let a = r.style ?? e(t).attr("style");
|
|
785
|
-
return a && i.push(`style="${
|
|
785
|
+
return a && i.push(`style="${P(a)}"`), i.length > 0 ? ` ${i.join(" ")}` : "";
|
|
786
786
|
}
|
|
787
|
-
function
|
|
788
|
-
return `<${n}${
|
|
787
|
+
function Ft(e, t, n, r) {
|
|
788
|
+
return `<${n}${L(e, t, [
|
|
789
789
|
"id",
|
|
790
790
|
"class",
|
|
791
791
|
"colspan",
|
|
@@ -798,155 +798,155 @@ function Nt(e, t, n, r) {
|
|
|
798
798
|
"cellspacing",
|
|
799
799
|
"cellpadding",
|
|
800
800
|
"style"
|
|
801
|
-
], { style:
|
|
801
|
+
], { style: It(e, t, n) })}>${r}</${n}>`;
|
|
802
802
|
}
|
|
803
|
-
function
|
|
803
|
+
function It(e, t, n) {
|
|
804
804
|
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 =
|
|
805
|
+
return (n === "td" || n === "th") && /font-weight\s*:\s*bold/iu.test(r) && !/text-align\s*:/iu.test(r) && (r = Lt(r, "text-align", "center")), r || void 0;
|
|
806
806
|
}
|
|
807
|
-
function
|
|
807
|
+
function Lt(e, t, n) {
|
|
808
808
|
let r = e.trim();
|
|
809
809
|
return `${r}${r && !r.endsWith(";") ? ";" : ""} ${t}: ${n};`.trim();
|
|
810
810
|
}
|
|
811
|
-
function
|
|
812
|
-
let n = [
|
|
813
|
-
return n.length === 0 ? "" : `<p class="akn-heading">${
|
|
811
|
+
function Rt(e, t) {
|
|
812
|
+
let n = [j(e(t).children("num").first().text()), j(e(t).children("heading").first().text())].filter(Boolean);
|
|
813
|
+
return n.length === 0 ? "" : `<p class="akn-heading">${P(n.join(" "))}</p>`;
|
|
814
814
|
}
|
|
815
|
-
function
|
|
815
|
+
function zt(e, t) {
|
|
816
816
|
if (!t) return !1;
|
|
817
|
-
let n = (e) =>
|
|
818
|
-
return n(
|
|
817
|
+
let n = (e) => j(e).replace(/\s+/gu, " ").replace(/\s*[..]\s*(?=[–—-])/gu, " ").trim();
|
|
818
|
+
return n(j(e.replace(/<[^>]*>/gu, " ").replace(/ /gu, " ").replace(/ /giu, " ").replace(/–/giu, "–"))).startsWith(n(t));
|
|
819
819
|
}
|
|
820
|
-
function
|
|
821
|
-
let t =
|
|
820
|
+
function Bt(e) {
|
|
821
|
+
let t = P(e);
|
|
822
822
|
return `<p data-pastille="${t}" class="pastille"><span aria-label="pastille ${t}">${t}</span></p>`;
|
|
823
823
|
}
|
|
824
|
-
function
|
|
825
|
-
return
|
|
824
|
+
function Vt(e, t) {
|
|
825
|
+
return Ht([Ut({
|
|
826
826
|
content: e,
|
|
827
827
|
pastille: t
|
|
828
828
|
})]);
|
|
829
829
|
}
|
|
830
|
-
function
|
|
830
|
+
function Ht(e) {
|
|
831
831
|
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
832
|
}
|
|
833
|
-
function
|
|
834
|
-
let i = n ? ` style="${
|
|
835
|
-
return `<tr${r ? ` class="${
|
|
833
|
+
function Ut({ content: e, pastille: t, style: n, contextClass: r }) {
|
|
834
|
+
let i = n ? ` style="${P(n)}"` : "", a = r ? ` ${P(r)}` : "";
|
|
835
|
+
return `<tr${r ? ` class="${P(r)} hideable"` : ""}><td style="overflow: hidden; width: 5.0%;" class="texte-col-0 texte-col-pastille no-right-border"><div class="tableauComparatifCell${a}">${Bt(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
836
|
}
|
|
837
|
-
function
|
|
838
|
-
let r = t ? ` style="${
|
|
839
|
-
return `<tr${n ? ` class="${
|
|
837
|
+
function Wt({ content: e, style: t, contextClass: n }) {
|
|
838
|
+
let r = t ? ` style="${P(t)}"` : "", i = n ? ` ${P(n)}` : "";
|
|
839
|
+
return `<tr${n ? ` class="${P(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
840
|
}
|
|
841
|
-
function
|
|
841
|
+
function Gt(e, t) {
|
|
842
842
|
return e(t).attr("data:pastille") ?? e(t).attr("pastille");
|
|
843
843
|
}
|
|
844
|
-
function
|
|
844
|
+
function Kt(e, t) {
|
|
845
845
|
return e(t).find("alinea[data\\:pastille],alinea[pastille]").length > 0;
|
|
846
846
|
}
|
|
847
|
-
function
|
|
848
|
-
return e(t).children().get().filter((e) =>
|
|
847
|
+
function qt(e, t) {
|
|
848
|
+
return e(t).children().get().filter((e) => N(e) ? F(e) === "content" : !1).map((t) => I(e, t)).filter(Boolean).join("\n");
|
|
849
849
|
}
|
|
850
|
-
function
|
|
850
|
+
function Jt(e, t) {
|
|
851
851
|
let n = [];
|
|
852
852
|
return e(t).children().each((t, r) => {
|
|
853
|
-
if (!
|
|
854
|
-
let i =
|
|
855
|
-
i === "num" || i === "heading" || i === "content" || n.push(
|
|
853
|
+
if (!N(r)) return;
|
|
854
|
+
let i = F(r);
|
|
855
|
+
i === "num" || i === "heading" || i === "content" || n.push(I(e, r));
|
|
856
856
|
}), n.filter(Boolean);
|
|
857
857
|
}
|
|
858
|
-
function
|
|
859
|
-
let n = [], r =
|
|
858
|
+
function Yt(e, t) {
|
|
859
|
+
let n = [], r = F(t), i = r === "alinea" ? Gt(e, t) : void 0, a = qt(e, t), o = Xt(e, t, r, i), s = nn(e, t);
|
|
860
860
|
if (i) {
|
|
861
|
-
let r = [
|
|
862
|
-
|
|
861
|
+
let r = [zt(a, j(e(t).children("num").first().text())) ? "" : Rt(e, t), a].filter(Boolean).join("\n");
|
|
862
|
+
j(r) && n.push(Ut({
|
|
863
863
|
content: r,
|
|
864
864
|
pastille: i,
|
|
865
865
|
style: o,
|
|
866
866
|
contextClass: s
|
|
867
867
|
}));
|
|
868
|
-
} else a && n.push(
|
|
868
|
+
} else a && n.push(Wt({
|
|
869
869
|
content: a,
|
|
870
870
|
style: o,
|
|
871
871
|
contextClass: s
|
|
872
872
|
}));
|
|
873
873
|
for (let r of e(t).children().get()) {
|
|
874
|
-
if (!
|
|
875
|
-
let t =
|
|
876
|
-
t === "num" || t === "heading" || t === "content" || (t === "alinea" ||
|
|
874
|
+
if (!N(r)) continue;
|
|
875
|
+
let t = F(r);
|
|
876
|
+
t === "num" || t === "heading" || t === "content" || (t === "alinea" || Kt(e, r)) && n.push(...Yt(e, r));
|
|
877
877
|
}
|
|
878
878
|
return n;
|
|
879
879
|
}
|
|
880
|
-
function
|
|
881
|
-
let i =
|
|
882
|
-
a ? `id="${
|
|
880
|
+
function R(e, t, n, r) {
|
|
881
|
+
let i = F(t), a = e(t).attr("eId") ?? e(t).attr("GUID"), o = Gt(e, t), s = Xt(e, t, i, o), c = [`<${n} ${[
|
|
882
|
+
a ? `id="${P(a)}"` : void 0,
|
|
883
883
|
`class="${r}"`,
|
|
884
|
-
o ? `data-pastille="${
|
|
885
|
-
s ? `style="${
|
|
884
|
+
o ? `data-pastille="${P(o)}"` : void 0,
|
|
885
|
+
s ? `style="${P(s)}"` : void 0
|
|
886
886
|
].filter((e) => e !== void 0).join(" ")}>`];
|
|
887
887
|
if (i === "part" || i === "title") {
|
|
888
|
-
let r =
|
|
888
|
+
let r = $t(e, t, i), a = tn(e, t), o = r ? [Wt({
|
|
889
889
|
content: r,
|
|
890
890
|
contextClass: a
|
|
891
891
|
})] : [], s = () => {
|
|
892
|
-
o.length !== 0 && (c.push(
|
|
892
|
+
o.length !== 0 && (c.push(Qt(o)), o = []);
|
|
893
893
|
};
|
|
894
894
|
return e(t).children().each((t, n) => {
|
|
895
|
-
if (!
|
|
896
|
-
let r =
|
|
895
|
+
if (!N(n)) return;
|
|
896
|
+
let r = F(n);
|
|
897
897
|
if (!(r === "num" || r === "heading" || r === "content")) {
|
|
898
898
|
if (r === "alinea") {
|
|
899
|
-
o.push(...
|
|
899
|
+
o.push(...Yt(e, n));
|
|
900
900
|
return;
|
|
901
901
|
}
|
|
902
|
-
s(), c.push(
|
|
902
|
+
s(), c.push(I(e, n));
|
|
903
903
|
}
|
|
904
904
|
}), s(), c.push(`</${n}>`), c.join("\n");
|
|
905
905
|
}
|
|
906
906
|
if (i === "article") {
|
|
907
|
-
let r =
|
|
907
|
+
let r = j(e(t).children("num").first().text()), i = j(e(t).children("heading").first().text()), a = S(r) ?? {
|
|
908
908
|
label: r,
|
|
909
909
|
num: r
|
|
910
|
-
}, o = `<p class="TCNumArticle as-text toc-article dispositif" id="${
|
|
911
|
-
if (
|
|
912
|
-
let r = [
|
|
910
|
+
}, o = `<p class="TCNumArticle as-text toc-article dispositif" id="${P(`_TocArt${(a.num ?? r).replace(/\s+/gu, "")}`)}">${P(a.label)}${i ? ` : ${P(i)}` : ""}</p>`;
|
|
911
|
+
if (Kt(e, t)) {
|
|
912
|
+
let r = [Wt({
|
|
913
913
|
content: o,
|
|
914
|
-
contextClass:
|
|
915
|
-
}), ...
|
|
916
|
-
c.push(
|
|
917
|
-
for (let n of
|
|
914
|
+
contextClass: an(a.label)
|
|
915
|
+
}), ...Yt(e, t)];
|
|
916
|
+
c.push(Ht(r));
|
|
917
|
+
for (let n of Jt(e, t)) n.includes("akn-pastille-table") || c.push(n);
|
|
918
918
|
return c.push(`</${n}>`), c.join("\n");
|
|
919
919
|
}
|
|
920
920
|
c.push(o);
|
|
921
921
|
}
|
|
922
922
|
let l = [];
|
|
923
923
|
for (let n of ["content", "children"]) e(t).children().each((t, r) => {
|
|
924
|
-
if (!
|
|
925
|
-
let i =
|
|
926
|
-
i === "num" || i === "heading" || n === "content" && i !== "content" || n === "children" && i === "content" || l.push(
|
|
924
|
+
if (!N(r)) return;
|
|
925
|
+
let i = F(r);
|
|
926
|
+
i === "num" || i === "heading" || n === "content" && i !== "content" || n === "children" && i === "content" || l.push(I(e, r));
|
|
927
927
|
});
|
|
928
928
|
let u = l.join("\n");
|
|
929
929
|
if (i !== "article") {
|
|
930
|
-
let n =
|
|
930
|
+
let n = zt(u, j(e(t).children("num").first().text())) ? "" : Rt(e, t);
|
|
931
931
|
n && c.push(n);
|
|
932
932
|
}
|
|
933
|
-
return c.push(o ?
|
|
933
|
+
return c.push(o ? Vt(u, o) : u), c.push(`</${n}>`), c.join("\n");
|
|
934
934
|
}
|
|
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 =
|
|
935
|
+
function Xt(e, t, n, r) {
|
|
936
|
+
let i = Zt(e(t).attr("style") ?? "", "font-family");
|
|
937
|
+
return !r && n !== "article" && /font-weight\s*:\s*bold/iu.test(i) && !/text-align\s*:/iu.test(i) && (i = Lt(i, "text-align", "center")), i || void 0;
|
|
938
938
|
}
|
|
939
|
-
function
|
|
939
|
+
function Zt(e, t) {
|
|
940
940
|
return e.split(";").map((e) => e.trim()).filter(Boolean).filter((e) => !e.toLowerCase().startsWith(`${t.toLowerCase()}:`)).join(";");
|
|
941
941
|
}
|
|
942
|
-
function
|
|
942
|
+
function Qt(e) {
|
|
943
943
|
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
944
|
}
|
|
945
|
-
function
|
|
946
|
-
let r =
|
|
947
|
-
return r && o.push(`<p class="${a.num} as-text dispositif"><span aria-label="">${
|
|
945
|
+
function $t(e, t, n) {
|
|
946
|
+
let r = j(e(t).children("num").first().text()), i = j(e(t).children("heading").first().text()), a = en(n), o = [];
|
|
947
|
+
return r && o.push(`<p class="${a.num} as-text dispositif"><span aria-label="">${P(r)}</span></p>`), i && o.push(`<p class="${a.heading} as-text dispositif"><span aria-label="">${P(i)}</span></p>`), o.join("\n");
|
|
948
948
|
}
|
|
949
|
-
function
|
|
949
|
+
function en(e) {
|
|
950
950
|
switch (e) {
|
|
951
951
|
case "part": return {
|
|
952
952
|
num: "TCNumPartie",
|
|
@@ -970,22 +970,22 @@ function Qt(e) {
|
|
|
970
970
|
};
|
|
971
971
|
}
|
|
972
972
|
}
|
|
973
|
-
function
|
|
974
|
-
let n =
|
|
973
|
+
function tn(e, t) {
|
|
974
|
+
let n = rn(j(e(t).children("num").first().text()));
|
|
975
975
|
if (n) return n;
|
|
976
976
|
for (let n of e(t).parents().get()) {
|
|
977
|
-
if (!
|
|
978
|
-
let t =
|
|
977
|
+
if (!N(n)) continue;
|
|
978
|
+
let t = F(n);
|
|
979
979
|
if (t !== "title" && t !== "part") continue;
|
|
980
|
-
let r =
|
|
980
|
+
let r = rn(j(e(n).children("num").first().text()));
|
|
981
981
|
if (r) return r;
|
|
982
982
|
}
|
|
983
983
|
}
|
|
984
|
-
function
|
|
985
|
-
return
|
|
984
|
+
function nn(e, t) {
|
|
985
|
+
return tn(e, t);
|
|
986
986
|
}
|
|
987
|
-
function
|
|
988
|
-
let [t, ...n] =
|
|
987
|
+
function rn(e) {
|
|
988
|
+
let [t, ...n] = j(e).split(/\s+/u);
|
|
989
989
|
if (!t || n.length === 0) return;
|
|
990
990
|
let r = t.toLocaleLowerCase("fr-FR");
|
|
991
991
|
if ([
|
|
@@ -995,10 +995,10 @@ function tn(e) {
|
|
|
995
995
|
"section"
|
|
996
996
|
].includes(r)) return `${r}-${n.join("_")}`;
|
|
997
997
|
}
|
|
998
|
-
function
|
|
999
|
-
return `article-${
|
|
998
|
+
function an(e) {
|
|
999
|
+
return `article-${j(e).replace(/^Article\s+/iu, "").replace(/\s+/gu, "_")} article`;
|
|
1000
1000
|
}
|
|
1001
|
-
function
|
|
1001
|
+
function on(e) {
|
|
1002
1002
|
switch (e) {
|
|
1003
1003
|
case "part": return "partie";
|
|
1004
1004
|
case "book": return "livre";
|
|
@@ -1010,11 +1010,11 @@ function rn(e) {
|
|
|
1010
1010
|
default: return;
|
|
1011
1011
|
}
|
|
1012
1012
|
}
|
|
1013
|
-
function
|
|
1014
|
-
return [
|
|
1013
|
+
function sn(e, t) {
|
|
1014
|
+
return [j(e(t).children("num").first().text()), j(e(t).children("heading").first().text())].filter(Boolean).join(" ");
|
|
1015
1015
|
}
|
|
1016
|
-
function
|
|
1017
|
-
let n =
|
|
1016
|
+
function cn(e, t) {
|
|
1017
|
+
let n = j(e(t).children("num").first().text()), r = j(e(t).children("heading").first().text()), i = S(n) ?? {
|
|
1018
1018
|
label: n,
|
|
1019
1019
|
num: n
|
|
1020
1020
|
};
|
|
@@ -1024,24 +1024,24 @@ function on(e, t) {
|
|
|
1024
1024
|
type: "article"
|
|
1025
1025
|
};
|
|
1026
1026
|
}
|
|
1027
|
-
function
|
|
1027
|
+
function ln(e, t) {
|
|
1028
1028
|
e.items.push(...t.items);
|
|
1029
1029
|
}
|
|
1030
|
-
function
|
|
1030
|
+
function un(e, t) {
|
|
1031
1031
|
let n = { items: [] };
|
|
1032
1032
|
return e(t).children().each((t, r) => {
|
|
1033
|
-
if (!
|
|
1034
|
-
let i =
|
|
1033
|
+
if (!N(r)) return;
|
|
1034
|
+
let i = F(r);
|
|
1035
1035
|
if (i === "article") {
|
|
1036
|
-
n.items.push(
|
|
1036
|
+
n.items.push(cn(e, r));
|
|
1037
1037
|
return;
|
|
1038
1038
|
}
|
|
1039
|
-
let a =
|
|
1039
|
+
let a = on(i);
|
|
1040
1040
|
if (!a) {
|
|
1041
|
-
|
|
1041
|
+
ln(n, un(e, r));
|
|
1042
1042
|
return;
|
|
1043
1043
|
}
|
|
1044
|
-
let o =
|
|
1044
|
+
let o = sn(e, r), s = un(e, r);
|
|
1045
1045
|
!o && s.items.length === 0 || n.items.push({
|
|
1046
1046
|
...s,
|
|
1047
1047
|
id: e(r).attr("eId") ?? e(r).attr("GUID"),
|
|
@@ -1050,26 +1050,26 @@ function cn(e, t) {
|
|
|
1050
1050
|
});
|
|
1051
1051
|
}), n;
|
|
1052
1052
|
}
|
|
1053
|
-
function
|
|
1053
|
+
function dn(e) {
|
|
1054
1054
|
let t = e("body").first().get(0);
|
|
1055
|
-
return t === void 0 ? { items: [] } :
|
|
1055
|
+
return t === void 0 ? { items: [] } : un(e, t);
|
|
1056
1056
|
}
|
|
1057
|
-
function
|
|
1057
|
+
function fn(e) {
|
|
1058
1058
|
return e("FRBRExpression FRBRdate[name=\"#depot\"]").attr("date") ?? e("FRBRWork FRBRdate[name=\"#presentation\"]").attr("date");
|
|
1059
1059
|
}
|
|
1060
|
-
function
|
|
1060
|
+
function pn(e) {
|
|
1061
1061
|
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(
|
|
1063
|
-
|
|
1062
|
+
return t.length > 0 && (r.push("<section class=\"akn-preamble\">"), r.push(Nt(e, t.get(0))), r.push("</section>")), r.push("<section class=\"akn-body\">"), n.children().each((t, n) => {
|
|
1063
|
+
N(n) && r.push(F(n) === "article" ? R(e, n, "article", "akn-article") : I(e, n));
|
|
1064
1064
|
}), r.push("</section></div>"), r.join("\n");
|
|
1065
1065
|
}
|
|
1066
|
-
function
|
|
1067
|
-
let t =
|
|
1066
|
+
function mn(e) {
|
|
1067
|
+
let t = g(e, { xml: {
|
|
1068
1068
|
decodeEntities: !1,
|
|
1069
1069
|
lowerCaseTags: !1,
|
|
1070
1070
|
lowerCaseAttributeNames: !1,
|
|
1071
1071
|
xmlMode: !0
|
|
1072
|
-
} }), n =
|
|
1072
|
+
} }), n = fn(t), r = pn(t);
|
|
1073
1073
|
return {
|
|
1074
1074
|
sourceFormat: "akoma-ntoso",
|
|
1075
1075
|
documentDate: n,
|
|
@@ -1077,68 +1077,68 @@ function fn(e) {
|
|
|
1077
1077
|
linkedHtml: r
|
|
1078
1078
|
};
|
|
1079
1079
|
}
|
|
1080
|
-
function
|
|
1081
|
-
return
|
|
1080
|
+
function hn(e) {
|
|
1081
|
+
return gn(g(e));
|
|
1082
1082
|
}
|
|
1083
|
-
function
|
|
1083
|
+
function gn(e) {
|
|
1084
1084
|
let t = [];
|
|
1085
1085
|
return e("article.akn-article").each((n, r) => {
|
|
1086
|
-
let i = e(r).children("p.TCNumArticle").first().get(0), a =
|
|
1086
|
+
let i = e(r).children("p.TCNumArticle").first().get(0), a = j(i ? e(i).text() : ""), o = S(a) ?? { label: a || `Article ${n + 1}` }, s = e(r).attr("id") ?? `akn-article-${String(n + 1).padStart(3, "0")}`, c = [r], l = ct(e, s, c), u = l.filter((e) => e.kind !== "noise").map((e) => e.text).join("\n");
|
|
1087
1087
|
t.push({
|
|
1088
1088
|
id: s,
|
|
1089
1089
|
label: o.label,
|
|
1090
1090
|
num: o.num,
|
|
1091
1091
|
title: o.title,
|
|
1092
|
-
text:
|
|
1093
|
-
html:
|
|
1092
|
+
text: qe(e, c),
|
|
1093
|
+
html: Ue(e, r),
|
|
1094
1094
|
directiveText: u,
|
|
1095
1095
|
blocks: l
|
|
1096
1096
|
});
|
|
1097
1097
|
}), t;
|
|
1098
1098
|
}
|
|
1099
|
-
function
|
|
1100
|
-
let t =
|
|
1099
|
+
function _n(e) {
|
|
1100
|
+
let t = g(e);
|
|
1101
1101
|
return {
|
|
1102
|
-
articles:
|
|
1102
|
+
articles: gn(t),
|
|
1103
1103
|
htmlWithLinks: t.html()
|
|
1104
1104
|
};
|
|
1105
1105
|
}
|
|
1106
|
-
async function
|
|
1107
|
-
let n = new
|
|
1106
|
+
async function vn(e, t) {
|
|
1107
|
+
let n = new he("parseAkomaNtosoBillRaw"), r = n.timeSync("cheerioLoadXml", () => g(e, { xml: {
|
|
1108
1108
|
decodeEntities: !1,
|
|
1109
1109
|
lowerCaseTags: !1,
|
|
1110
1110
|
lowerCaseAttributeNames: !1,
|
|
1111
1111
|
xmlMode: !0
|
|
1112
|
-
} })), i = t.date ??
|
|
1112
|
+
} })), i = t.date ?? fn(r), a = n.timeSync("renderAknHtml", () => pn(r), { inputSize: e.length }), o = t.linkedHtml ?? await n.time("addLinksToRenderedAknHtml", () => Ye(a, {
|
|
1113
1113
|
...t,
|
|
1114
1114
|
date: i
|
|
1115
|
-
}, i)), s = n.timeSync("extractRenderedAknArticles", () =>
|
|
1115
|
+
}, i)), s = n.timeSync("extractRenderedAknArticles", () => hn(a)), c = n.timeSync("injectHiddenArticleSummary", () => lt(o, s)), { articles: l, htmlWithLinks: u } = n.timeSync("extractLinkedAknArticlesAndTaggedHtml", () => _n(c)), d = l.length > 0 ? l : s, f = n.timeSync("extractAknTableOfContents", () => dn(r)), p = n.timeSync("buildParsedDocument", () => Tt("akoma-ntoso", a, l.length > 0 ? u : c, i, d, f, t.includeDirectiveAnalysis));
|
|
1116
1116
|
return n.log({
|
|
1117
|
-
articleCount:
|
|
1118
|
-
blockCount:
|
|
1119
|
-
directiveCount:
|
|
1120
|
-
targetDirectiveCount:
|
|
1121
|
-
}),
|
|
1117
|
+
articleCount: p.articles.length,
|
|
1118
|
+
blockCount: p.articles.reduce((e, t) => e + t.blocks.length, 0),
|
|
1119
|
+
directiveCount: p.directives.length,
|
|
1120
|
+
targetDirectiveCount: p.directives.filter((e) => e.targetIds !== void 0).length
|
|
1121
|
+
}), p;
|
|
1122
1122
|
}
|
|
1123
|
-
async function
|
|
1124
|
-
let n =
|
|
1123
|
+
async function yn(e, t) {
|
|
1124
|
+
let n = mn(e), r = t.date ?? n.documentDate;
|
|
1125
1125
|
return {
|
|
1126
1126
|
sourceFormat: "akoma-ntoso",
|
|
1127
1127
|
documentDate: r,
|
|
1128
1128
|
html: n.html,
|
|
1129
|
-
linkedHtml: await
|
|
1129
|
+
linkedHtml: await Ye(n.html, t, r)
|
|
1130
1130
|
};
|
|
1131
1131
|
}
|
|
1132
1132
|
//#endregion
|
|
1133
1133
|
//#region src/lib/server/assemblee_document_search.ts
|
|
1134
|
-
var
|
|
1135
|
-
function
|
|
1134
|
+
var bn = /\bexpos[ée]\s+des\s+motifs\b/giu, xn = /\barticle\s+(?:premier|1er|\d+)/iu;
|
|
1135
|
+
function Sn(e) {
|
|
1136
1136
|
return e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim();
|
|
1137
1137
|
}
|
|
1138
|
-
function
|
|
1139
|
-
let t =
|
|
1138
|
+
function Cn(e) {
|
|
1139
|
+
let t = Sn(g(e).text()), n = [...t.matchAll(bn)], r = /* @__PURE__ */ new Set(), i = [];
|
|
1140
1140
|
for (let [e, a] of n.entries()) {
|
|
1141
|
-
let o = (a.index ?? 0) + a[0].length, s = t.slice(o), c =
|
|
1141
|
+
let o = (a.index ?? 0) + a[0].length, s = t.slice(o), c = xn.exec(s), l = Sn(s.slice(0, c?.index ?? s.length));
|
|
1142
1142
|
if (l.length < 20 || r.has(l)) continue;
|
|
1143
1143
|
r.add(l);
|
|
1144
1144
|
let u = `expose-des-motifs-${e + 1}`;
|
|
@@ -1154,8 +1154,8 @@ function xn(e) {
|
|
|
1154
1154
|
}
|
|
1155
1155
|
return i;
|
|
1156
1156
|
}
|
|
1157
|
-
async function
|
|
1158
|
-
let i = await
|
|
1157
|
+
async function wn({ date: e, html: t, linkBaseUrl: n, linkType: r }) {
|
|
1158
|
+
let i = await kt(t, {
|
|
1159
1159
|
date: e,
|
|
1160
1160
|
includeDirectiveAnalysis: !1,
|
|
1161
1161
|
linkBaseUrl: n,
|
|
@@ -1164,7 +1164,7 @@ async function Sn({ date: e, html: t, linkBaseUrl: n, linkType: r }) {
|
|
|
1164
1164
|
});
|
|
1165
1165
|
return {
|
|
1166
1166
|
items: [...i.articles.map((e) => {
|
|
1167
|
-
let t =
|
|
1167
|
+
let t = Sn(e.directiveText || e.text);
|
|
1168
1168
|
if (t) return {
|
|
1169
1169
|
anchor: e.id,
|
|
1170
1170
|
articleNumber: e.num ?? null,
|
|
@@ -1174,17 +1174,17 @@ async function Sn({ date: e, html: t, linkBaseUrl: n, linkType: r }) {
|
|
|
1174
1174
|
label: e.label,
|
|
1175
1175
|
title: e.title ?? null
|
|
1176
1176
|
};
|
|
1177
|
-
}).filter((e) => e !== void 0), ...
|
|
1177
|
+
}).filter((e) => e !== void 0), ...Cn(t)],
|
|
1178
1178
|
tableOfContents: i.tableOfContents
|
|
1179
1179
|
};
|
|
1180
1180
|
}
|
|
1181
|
-
function
|
|
1182
|
-
return
|
|
1181
|
+
function Tn(e, t) {
|
|
1182
|
+
return O("sha256").update(JSON.stringify({
|
|
1183
1183
|
item: e,
|
|
1184
1184
|
metadata: t
|
|
1185
1185
|
})).digest("hex");
|
|
1186
1186
|
}
|
|
1187
|
-
function
|
|
1187
|
+
function En(e) {
|
|
1188
1188
|
if (typeof e != "object" || !e) return;
|
|
1189
1189
|
let t = e.cycleDeVie?.chrono;
|
|
1190
1190
|
if (t !== void 0) for (let e of [
|
|
@@ -1199,11 +1199,11 @@ function wn(e) {
|
|
|
1199
1199
|
}
|
|
1200
1200
|
//#endregion
|
|
1201
1201
|
//#region src/lib/server/senat_amendment_search.ts
|
|
1202
|
-
function
|
|
1203
|
-
return e?.trim() ?
|
|
1202
|
+
function Dn(e) {
|
|
1203
|
+
return e?.trim() ? g(e).text().replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim() : "";
|
|
1204
1204
|
}
|
|
1205
|
-
function
|
|
1206
|
-
let n =
|
|
1205
|
+
function On({ dispositifHtml: e, objetHtml: t }) {
|
|
1206
|
+
let n = Dn(e), r = Dn(t);
|
|
1207
1207
|
return [...n ? [{
|
|
1208
1208
|
content: n,
|
|
1209
1209
|
itemKind: "dispositif",
|
|
@@ -1214,31 +1214,31 @@ function En({ dispositifHtml: e, objetHtml: t }) {
|
|
|
1214
1214
|
label: "Objet"
|
|
1215
1215
|
}] : []];
|
|
1216
1216
|
}
|
|
1217
|
-
function
|
|
1218
|
-
return
|
|
1217
|
+
function kn(e, t) {
|
|
1218
|
+
return O("sha256").update(JSON.stringify({
|
|
1219
1219
|
item: e,
|
|
1220
1220
|
metadata: t
|
|
1221
1221
|
})).digest("hex");
|
|
1222
1222
|
}
|
|
1223
1223
|
//#endregion
|
|
1224
1224
|
//#region src/lib/text_parsers/amendment_action_directives.ts
|
|
1225
|
-
function
|
|
1225
|
+
function z(e, t) {
|
|
1226
1226
|
return {
|
|
1227
1227
|
...t,
|
|
1228
1228
|
position: e.position(),
|
|
1229
1229
|
type: "amendment_action_directive"
|
|
1230
1230
|
};
|
|
1231
1231
|
}
|
|
1232
|
-
function
|
|
1232
|
+
function An(e, t) {
|
|
1233
1233
|
return {
|
|
1234
1234
|
type: e === "start" ? "head_of_target" : "tail_after_target",
|
|
1235
1235
|
unit: t ? se(t) : "article"
|
|
1236
1236
|
};
|
|
1237
1237
|
}
|
|
1238
|
-
function
|
|
1238
|
+
function jn(e) {
|
|
1239
1239
|
return e === "start" ? "insert_before" : "insert_after";
|
|
1240
1240
|
}
|
|
1241
|
-
var
|
|
1241
|
+
var Mn = E(T("[\\s\\S]*?(?=supprimer|substituer|remplacer|ins[eé]rer|compl[eé]ter|r[eé]diger)", { flags: "i" }), { default: "" }), B = D(ee, C([T("les?\\s+", { flags: "i" }), n], { value: (e) => e[1] }), n, o), Nn = D(C([T("la\\s+fin\\s+de\\s+", { flags: "i" }), B], { value: (e) => {
|
|
1242
1242
|
let t = e[1];
|
|
1243
1243
|
return {
|
|
1244
1244
|
targetReference: t,
|
|
@@ -1247,200 +1247,200 @@ var An = D(E("[\\s\\S]*?(?=supprimer|substituer|remplacer|ins[eé]rer|compl[eé]
|
|
|
1247
1247
|
unit: se(t)
|
|
1248
1248
|
}
|
|
1249
1249
|
};
|
|
1250
|
-
} }),
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1250
|
+
} }), C([x], { value: (e) => ({ targetScope: e[0] }) })), V = E(C([
|
|
1251
|
+
E(T("(?:[aà]\\s+la\\s+fin\\s+(?:du|de\\s+la|de\\s+l['’]?)\\s*)", { flags: "i" }), { default: "" }),
|
|
1252
|
+
E(T("(?:au\\s+d[eé]but\\s+d(?:u|e\\s+la|e\\s+l['’]?)\\s*)", { flags: "i" }), { default: "" }),
|
|
1253
|
+
B,
|
|
1254
|
+
E(T("\\s*,?\\s*(?:(?:[IVXLCDM]+)\\s*[.\\-–—]+\\s*|\\d+°\\s*|[a-z]\\)\\s*)?", { flags: "i" }), { default: "" })
|
|
1255
1255
|
], { value: (e, t) => ({
|
|
1256
1256
|
reference: e[2],
|
|
1257
1257
|
text: t.text()
|
|
1258
|
-
}) }), { default: null }),
|
|
1259
|
-
function
|
|
1258
|
+
}) }), { default: null }), Pn = E(T(`(?:(?:[aà]\\s+)?la\\s+(?:derni(?:ère|ere)|${_e})\\s+occurrence\\s+)`, { flags: "i" }), { default: "" });
|
|
1259
|
+
function H(e) {
|
|
1260
1260
|
return e?.text ?? "";
|
|
1261
1261
|
}
|
|
1262
|
-
function
|
|
1263
|
-
return { citation:
|
|
1262
|
+
function U(e) {
|
|
1263
|
+
return { citation: a(e.position()) };
|
|
1264
1264
|
}
|
|
1265
|
-
var
|
|
1265
|
+
var W = D(C([u], { value: (e) => ({ citation: e[0] }) }), T("\\S[\\s\\S]*", { value: (e, t) => U(t) })), Fn = T("\\S[\\s\\S]*", { value: (e, t) => U(t) }), G = T("[^:«“\"]*(?::\\s*)?", { flags: "i" }), In = T("\\S[\\s\\S]*?(?=\\s+par\\s+(?:les?\\s+)?(?:mots?|montants?|taux|références?|mentions?|dates?|années?)\\s*:)", {
|
|
1266
1266
|
flags: "i",
|
|
1267
|
-
value: (e, t) =>
|
|
1268
|
-
}),
|
|
1267
|
+
value: (e, t) => U(t)
|
|
1268
|
+
}), Ln = T("\\S[\\s\\S]*?(?=\\s+(?:ins[eé]rer|ajouter|supprimer|r[eé]diger)\\b)", {
|
|
1269
1269
|
flags: "i",
|
|
1270
|
-
value: (e, t) =>
|
|
1271
|
-
}),
|
|
1270
|
+
value: (e, t) => U(t)
|
|
1271
|
+
}), Rn = T("\\S[\\s\\S]*?(?=\\s*(?:(?:[IVXLCDM]+)\\s*[.\\-–—]+\\s*|\\d+°\\s*|[a-z]\\)\\s*|$))", {
|
|
1272
1272
|
flags: "i",
|
|
1273
|
-
value: (e, t) =>
|
|
1274
|
-
}),
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
], { value: (e) => e[2] }),
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1273
|
+
value: (e, t) => U(t)
|
|
1274
|
+
}), zn = D(C([u], { value: (e) => ({ citation: e[0] }) }), In), Bn = D(C([u], { value: (e) => ({ citation: e[0] }) }), Rn), Vn = C([T(`${c}s?\\s*:?\\s*`, { flags: "i" }), zn], { value: (e) => e[1] }), Hn = C([T(`${oe}s?(?: suivant(?:e)?s?)?\\s*:?\\s*`, { flags: "i" }), Bn], { value: (e) => e[1] }), Un = D(C([u], { value: (e) => ({ citation: e[0] }) }), Ln), Wn = C([
|
|
1275
|
+
Pn,
|
|
1276
|
+
T(`${c}s?\\s*:?\\s*`, { flags: "i" }),
|
|
1277
|
+
Un
|
|
1278
|
+
], { value: (e) => e[2] }), Gn = C([
|
|
1279
|
+
Pn,
|
|
1280
|
+
T(`${c}s?\\s*:?\\s*`, { flags: "i" }),
|
|
1281
|
+
D(C([u], { value: (e) => ({ citation: e[0] }) }), Fn)
|
|
1282
1282
|
], { value: (e) => e[2] });
|
|
1283
|
-
function
|
|
1283
|
+
function K(e) {
|
|
1284
1284
|
return e?.reference;
|
|
1285
1285
|
}
|
|
1286
|
-
var
|
|
1286
|
+
var Kn = C([Mn, T("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e, t) => z(t, {
|
|
1287
1287
|
contextText: e[0],
|
|
1288
1288
|
kind: "delete_article"
|
|
1289
|
-
}) }),
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
], { value: (e, t) =>
|
|
1295
|
-
contextText:
|
|
1289
|
+
}) }), qn = C([
|
|
1290
|
+
V,
|
|
1291
|
+
T("supprimer", { flags: "i" }),
|
|
1292
|
+
E(C([w, B], { value: (e) => e[1] }), { default: null }),
|
|
1293
|
+
E(C([w, Gn], { value: (e) => e[1] }), { default: null })
|
|
1294
|
+
], { value: (e, t) => z(t, {
|
|
1295
|
+
contextText: H(e[0]),
|
|
1296
1296
|
kind: "delete_portion",
|
|
1297
1297
|
targetCitation: e[3]?.citation ?? void 0,
|
|
1298
|
-
targetReference: e[2] ??
|
|
1299
|
-
}) }),
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
], { value: (e, t) =>
|
|
1305
|
-
contextText:
|
|
1298
|
+
targetReference: e[2] ?? K(e[0])
|
|
1299
|
+
}) }), Jn = C([
|
|
1300
|
+
V,
|
|
1301
|
+
D(T("r[eé]diger\\s+ainsi", { flags: "i" }), T("r[eé]tablir", { flags: "i" })),
|
|
1302
|
+
G,
|
|
1303
|
+
W
|
|
1304
|
+
], { value: (e, t) => z(t, {
|
|
1305
|
+
contextText: H(e[0]),
|
|
1306
1306
|
kind: "rewrite_portion",
|
|
1307
1307
|
replacementCitation: e[3].citation,
|
|
1308
|
-
targetReference:
|
|
1309
|
-
}) }),
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
], { value: (e, t) =>
|
|
1319
|
-
contextText:
|
|
1308
|
+
targetReference: K(e[0])
|
|
1309
|
+
}) }), Yn = C([
|
|
1310
|
+
V,
|
|
1311
|
+
D(T("substituer", { flags: "i" }), T("remplacer", { flags: "i" })),
|
|
1312
|
+
w,
|
|
1313
|
+
Pn,
|
|
1314
|
+
Vn,
|
|
1315
|
+
T("\\s*,?\\s*"),
|
|
1316
|
+
E(T("par\\s+", { flags: "i" }), { default: "" }),
|
|
1317
|
+
Hn
|
|
1318
|
+
], { value: (e, t) => z(t, {
|
|
1319
|
+
contextText: H(e[0]),
|
|
1320
1320
|
kind: "replace",
|
|
1321
1321
|
replacementCitation: e[7].citation,
|
|
1322
1322
|
targetCitation: e[4].citation,
|
|
1323
|
-
targetReference:
|
|
1324
|
-
}) }),
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
], { value: (e, t) =>
|
|
1333
|
-
contextText:
|
|
1323
|
+
targetReference: K(e[0])
|
|
1324
|
+
}) }), Xn = C([
|
|
1325
|
+
V,
|
|
1326
|
+
T("substituer", { flags: "i" }),
|
|
1327
|
+
w,
|
|
1328
|
+
E(T("(?:[aà]|aux?|à la)\\s+", { flags: "i" }), { default: "" }),
|
|
1329
|
+
B,
|
|
1330
|
+
T("[\\s\\S]*?(?=[«“\"]|$)"),
|
|
1331
|
+
W
|
|
1332
|
+
], { value: (e, t) => z(t, {
|
|
1333
|
+
contextText: H(e[0]),
|
|
1334
1334
|
kind: "rewrite_portion",
|
|
1335
1335
|
replacementCitation: e[6].citation,
|
|
1336
|
-
targetReference: e[4] ??
|
|
1337
|
-
}) }),
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
], { value: (e, t) =>
|
|
1336
|
+
targetReference: e[4] ?? K(e[0])
|
|
1337
|
+
}) }), Zn = C([
|
|
1338
|
+
i,
|
|
1339
|
+
w,
|
|
1340
|
+
T("l['’ ]article", { flags: "i" }),
|
|
1341
|
+
T("[\\s\\S]*?(?=ins[eé]rer)", { flags: "i" }),
|
|
1342
|
+
T("ins[eé]rer", { flags: "i" }),
|
|
1343
|
+
G,
|
|
1344
|
+
W
|
|
1345
|
+
], { value: (e, t) => z(t, {
|
|
1346
1346
|
contextText: "",
|
|
1347
1347
|
insertCitation: e[6].citation,
|
|
1348
1348
|
kind: e[0] === "before" ? "insert_article_before" : "insert_article_after"
|
|
1349
|
-
}) }),
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
], { value: (e, t) =>
|
|
1349
|
+
}) }), Qn = C([
|
|
1350
|
+
i,
|
|
1351
|
+
w,
|
|
1352
|
+
B,
|
|
1353
|
+
T("[\\s\\S]*?(?=ins[eé]rer|ajouter)", { flags: "i" }),
|
|
1354
|
+
D(T("ins[eé]rer", { flags: "i" }), T("ajouter", { flags: "i" })),
|
|
1355
|
+
G,
|
|
1356
|
+
W
|
|
1357
|
+
], { value: (e, t) => z(t, {
|
|
1358
1358
|
contextText: "",
|
|
1359
1359
|
insertCitation: e[6].citation,
|
|
1360
|
-
kind:
|
|
1360
|
+
kind: l(e[0]),
|
|
1361
1361
|
targetReference: e[2]
|
|
1362
|
-
}) }),
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
], { value: (e, t) =>
|
|
1362
|
+
}) }), $n = C([
|
|
1363
|
+
i,
|
|
1364
|
+
w,
|
|
1365
|
+
T("l['’ ]alin[eé]a", { flags: "i" }),
|
|
1366
|
+
T("[\\s\\S]*?(?=ins[eé]rer)", { flags: "i" }),
|
|
1367
|
+
T("ins[eé]rer", { flags: "i" }),
|
|
1368
|
+
G,
|
|
1369
|
+
W
|
|
1370
|
+
], { value: (e, t) => z(t, {
|
|
1371
1371
|
contextText: "",
|
|
1372
1372
|
insertCitation: e[6].citation,
|
|
1373
|
-
kind:
|
|
1374
|
-
}) }),
|
|
1375
|
-
|
|
1373
|
+
kind: l(e[0])
|
|
1374
|
+
}) }), er = C([
|
|
1375
|
+
V,
|
|
1376
1376
|
ae,
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1377
|
+
T("[\\s\\S]*?(?=ins[eé]rer|ajouter)", { flags: "i" }),
|
|
1378
|
+
D(T("ins[eé]rer", { flags: "i" }), T("ajouter", { flags: "i" })),
|
|
1379
|
+
G,
|
|
1380
|
+
W
|
|
1381
1381
|
], { value: (e, t) => {
|
|
1382
|
-
let n = e[0], r =
|
|
1383
|
-
return
|
|
1384
|
-
contextText:
|
|
1382
|
+
let n = e[0], r = K(n), i = e[1];
|
|
1383
|
+
return z(t, {
|
|
1384
|
+
contextText: H(n),
|
|
1385
1385
|
insertCitation: e[5].citation,
|
|
1386
|
-
kind:
|
|
1386
|
+
kind: jn(i),
|
|
1387
1387
|
targetReference: r,
|
|
1388
|
-
targetScope:
|
|
1388
|
+
targetScope: An(i, r)
|
|
1389
1389
|
});
|
|
1390
|
-
} }),
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
], { value: (e, t) =>
|
|
1400
|
-
contextText:
|
|
1390
|
+
} }), tr = C([
|
|
1391
|
+
V,
|
|
1392
|
+
i,
|
|
1393
|
+
w,
|
|
1394
|
+
Wn,
|
|
1395
|
+
T("[\\s\\S]*?(?=ins[eé]rer)"),
|
|
1396
|
+
T("ins[eé]rer", { flags: "i" }),
|
|
1397
|
+
w,
|
|
1398
|
+
Hn
|
|
1399
|
+
], { value: (e, t) => z(t, {
|
|
1400
|
+
contextText: H(e[0]),
|
|
1401
1401
|
insertCitation: e[7].citation,
|
|
1402
|
-
kind:
|
|
1402
|
+
kind: l(e[1]),
|
|
1403
1403
|
targetCitation: e[3].citation,
|
|
1404
|
-
targetReference:
|
|
1405
|
-
}) }),
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
], { value: (e, t) =>
|
|
1415
|
-
contextText:
|
|
1404
|
+
targetReference: K(e[0])
|
|
1405
|
+
}) }), nr = C([
|
|
1406
|
+
V,
|
|
1407
|
+
i,
|
|
1408
|
+
w,
|
|
1409
|
+
B,
|
|
1410
|
+
T("[\\s\\S]*?(?=ins[eé]rer|ajouter)", { flags: "i" }),
|
|
1411
|
+
D(T("ins[eé]rer", { flags: "i" }), T("ajouter", { flags: "i" })),
|
|
1412
|
+
G,
|
|
1413
|
+
W
|
|
1414
|
+
], { value: (e, t) => z(t, {
|
|
1415
|
+
contextText: H(e[0]),
|
|
1416
1416
|
insertCitation: e[7].citation,
|
|
1417
|
-
kind:
|
|
1418
|
-
targetReference:
|
|
1419
|
-
}) }),
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1417
|
+
kind: l(e[1]),
|
|
1418
|
+
targetReference: K(e[0]) ?? e[3]
|
|
1419
|
+
}) }), rr = D(er, Zn, Qn, $n, Xn, C([
|
|
1420
|
+
V,
|
|
1421
|
+
i,
|
|
1422
|
+
w,
|
|
1423
|
+
Wn,
|
|
1424
|
+
T("[\\s\\S]*?(?=supprimer|r[eé]diger)", { flags: "i" }),
|
|
1425
|
+
D(C([
|
|
1426
|
+
T("supprimer", {
|
|
1427
1427
|
flags: "i",
|
|
1428
1428
|
value: "delete_portion"
|
|
1429
1429
|
}),
|
|
1430
|
-
|
|
1431
|
-
|
|
1430
|
+
w,
|
|
1431
|
+
Nn
|
|
1432
1432
|
], { value: (e) => ({
|
|
1433
1433
|
kind: e[0],
|
|
1434
1434
|
...e[2]
|
|
1435
|
-
}) }),
|
|
1436
|
-
|
|
1435
|
+
}) }), C([
|
|
1436
|
+
T("r[eé]diger\\s+ainsi", {
|
|
1437
1437
|
flags: "i",
|
|
1438
1438
|
value: "rewrite_portion"
|
|
1439
1439
|
}),
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1440
|
+
w,
|
|
1441
|
+
Nn,
|
|
1442
|
+
G,
|
|
1443
|
+
W
|
|
1444
1444
|
], { value: (e) => ({
|
|
1445
1445
|
kind: e[0],
|
|
1446
1446
|
replacementCitation: e[4].citation,
|
|
@@ -1448,49 +1448,49 @@ var Wn = w([An, E("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e,
|
|
|
1448
1448
|
}) }))
|
|
1449
1449
|
], { value: (e, t) => {
|
|
1450
1450
|
let n = e[5];
|
|
1451
|
-
return
|
|
1452
|
-
contextText:
|
|
1451
|
+
return z(t, {
|
|
1452
|
+
contextText: H(e[0]),
|
|
1453
1453
|
kind: n.kind,
|
|
1454
1454
|
replacementCitation: n.replacementCitation,
|
|
1455
1455
|
targetCitation: e[3].citation,
|
|
1456
|
-
targetReference:
|
|
1456
|
+
targetReference: K(e[0]) ?? n.targetReference,
|
|
1457
1457
|
targetScope: n.targetScope
|
|
1458
1458
|
});
|
|
1459
|
-
} }),
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
], { value: (e, t) =>
|
|
1459
|
+
} }), tr, nr, C([
|
|
1460
|
+
Mn,
|
|
1461
|
+
T("ins[eé]rer", { flags: "i" }),
|
|
1462
|
+
T(`[\\s\\S]*?(?=${r})`, { flags: "i" }),
|
|
1463
|
+
i,
|
|
1464
|
+
G,
|
|
1465
|
+
u,
|
|
1466
|
+
G,
|
|
1467
|
+
u
|
|
1468
|
+
], { value: (e, t) => z(t, {
|
|
1469
1469
|
contextText: e[0],
|
|
1470
1470
|
insertCitation: e[8],
|
|
1471
|
-
kind:
|
|
1471
|
+
kind: l(e[3]),
|
|
1472
1472
|
targetCitation: e[6]
|
|
1473
|
-
}) }),
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
], { value: (e, t) =>
|
|
1480
|
-
contextText:
|
|
1473
|
+
}) }), Yn, Jn, C([
|
|
1474
|
+
V,
|
|
1475
|
+
T("compl[eé]ter", { flags: "i" }),
|
|
1476
|
+
E(C([w, B], { value: (e) => e[1] }), { default: null }),
|
|
1477
|
+
G,
|
|
1478
|
+
W
|
|
1479
|
+
], { value: (e, t) => z(t, {
|
|
1480
|
+
contextText: H(e[0]),
|
|
1481
1481
|
insertCitation: e[4].citation,
|
|
1482
1482
|
kind: "insert_after",
|
|
1483
|
-
targetReference: e[2] ??
|
|
1484
|
-
}) }),
|
|
1483
|
+
targetReference: e[2] ?? K(e[0])
|
|
1484
|
+
}) }), Kn, qn);
|
|
1485
1485
|
//#endregion
|
|
1486
1486
|
//#region src/lib/server/parsed_amendments.ts
|
|
1487
|
-
function
|
|
1487
|
+
function ir(e) {
|
|
1488
1488
|
return e.replace(/\s+/gu, " ").trim();
|
|
1489
1489
|
}
|
|
1490
|
-
function
|
|
1491
|
-
return e.split(/\n/gu).map(
|
|
1490
|
+
function ar(e) {
|
|
1491
|
+
return e.split(/\n/gu).map(ir).filter(Boolean).join("\n");
|
|
1492
1492
|
}
|
|
1493
|
-
function
|
|
1493
|
+
function or(e, t) {
|
|
1494
1494
|
let { start: n, stop: r } = t;
|
|
1495
1495
|
for (; n < r && /\s/u.test(e[n]);) n++;
|
|
1496
1496
|
for (; r > n && /\s/u.test(e[r - 1]);) r--;
|
|
@@ -1499,16 +1499,16 @@ function ir(e, t) {
|
|
|
1499
1499
|
stop: r
|
|
1500
1500
|
} : null;
|
|
1501
1501
|
}
|
|
1502
|
-
function
|
|
1503
|
-
return
|
|
1502
|
+
function sr(e, t) {
|
|
1503
|
+
return de(me(e), t);
|
|
1504
1504
|
}
|
|
1505
|
-
function
|
|
1505
|
+
function cr(e) {
|
|
1506
1506
|
return e === "before_article" || e === "on_article" || e === "after_article" ? e : "unknown";
|
|
1507
1507
|
}
|
|
1508
|
-
function
|
|
1508
|
+
function lr(e) {
|
|
1509
1509
|
return {
|
|
1510
1510
|
articleLabel: e.targetArticleLabel ?? null,
|
|
1511
|
-
targetPosition:
|
|
1511
|
+
targetPosition: cr(e.targetPosition),
|
|
1512
1512
|
alinea: e.targetAlinea ?? null,
|
|
1513
1513
|
alineaLabel: e.targetAlineaLabel ?? null,
|
|
1514
1514
|
subdivisionSourceId: e.targetSubdivisionSourceId ?? null,
|
|
@@ -1516,75 +1516,75 @@ function sr(e) {
|
|
|
1516
1516
|
subpos: e.targetSubpos ?? null
|
|
1517
1517
|
};
|
|
1518
1518
|
}
|
|
1519
|
-
function
|
|
1519
|
+
function q(e) {
|
|
1520
1520
|
return {
|
|
1521
1521
|
...e.originalTransformation === void 0 ? {} : { sourceOriginalTransformation: e.originalTransformation },
|
|
1522
1522
|
sourcePosition: e.position,
|
|
1523
1523
|
sourceText: e.text
|
|
1524
1524
|
};
|
|
1525
1525
|
}
|
|
1526
|
-
function
|
|
1526
|
+
function ur(e) {
|
|
1527
1527
|
return {
|
|
1528
1528
|
...e.originalTransformation === void 0 ? {} : { sourceOriginalTransformation: e.originalTransformation },
|
|
1529
1529
|
sourcePosition: e.position,
|
|
1530
1530
|
sourceText: e.text
|
|
1531
1531
|
};
|
|
1532
1532
|
}
|
|
1533
|
-
function
|
|
1533
|
+
function dr(e) {
|
|
1534
1534
|
return {
|
|
1535
1535
|
...e?.originalTransformation === void 0 ? {} : { dispositifOriginalTransformation: e.originalTransformation },
|
|
1536
1536
|
...e === null ? {} : { dispositifPosition: e.position },
|
|
1537
1537
|
dispositifText: e?.text ?? null
|
|
1538
1538
|
};
|
|
1539
1539
|
}
|
|
1540
|
-
function
|
|
1540
|
+
function J(e, t, n, r = ar(e.slice(n.start, n.stop))) {
|
|
1541
1541
|
return {
|
|
1542
|
-
originalTransformation:
|
|
1542
|
+
originalTransformation: sr(t, n),
|
|
1543
1543
|
position: n,
|
|
1544
1544
|
text: r
|
|
1545
1545
|
};
|
|
1546
1546
|
}
|
|
1547
|
-
function
|
|
1547
|
+
function fr(e) {
|
|
1548
1548
|
let t = e.dispositifHtml ?? e.dispositifText;
|
|
1549
1549
|
if (!t) return null;
|
|
1550
|
-
let n = e.dispositifHtml ?
|
|
1550
|
+
let n = e.dispositifHtml ? ue()(t) : le(t), r = n.output, i = or(r, {
|
|
1551
1551
|
start: 0,
|
|
1552
1552
|
stop: r.length
|
|
1553
1553
|
});
|
|
1554
1554
|
return {
|
|
1555
|
-
dispositif: i === null ? null :
|
|
1555
|
+
dispositif: i === null ? null : J(r, n, i),
|
|
1556
1556
|
simplifiedText: r,
|
|
1557
1557
|
transformation: n
|
|
1558
1558
|
};
|
|
1559
1559
|
}
|
|
1560
|
-
function
|
|
1561
|
-
if (!
|
|
1562
|
-
if (
|
|
1563
|
-
if (
|
|
1564
|
-
let
|
|
1565
|
-
return
|
|
1560
|
+
function Y(t) {
|
|
1561
|
+
if (!t) return [];
|
|
1562
|
+
if (t.type === "enumeration") return [...Y(t.left), ...Y(t.right)];
|
|
1563
|
+
if (t.type === "bounded-interval") {
|
|
1564
|
+
let e = Y(t.first)[0], n = Y(t.last)[0];
|
|
1565
|
+
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
1566
|
}
|
|
1567
|
-
if (
|
|
1568
|
-
let
|
|
1569
|
-
return
|
|
1567
|
+
if (t.type === "counted-interval") {
|
|
1568
|
+
let e = Y(t.first)[0];
|
|
1569
|
+
return e === void 0 ? [] : Array.from({ length: t.count }, (t, n) => e + n);
|
|
1570
1570
|
}
|
|
1571
|
-
if (
|
|
1572
|
-
for (let
|
|
1571
|
+
if (t.type === "exclusion") return Y(t.left);
|
|
1572
|
+
for (let n of e(t)) if (n.type === "alinéa" && typeof n.index == "number" && n.index > 0) return [n.index];
|
|
1573
1573
|
return [];
|
|
1574
1574
|
}
|
|
1575
|
-
function
|
|
1576
|
-
let n =
|
|
1575
|
+
function pr(e, t) {
|
|
1576
|
+
let n = Y(t);
|
|
1577
1577
|
return {
|
|
1578
1578
|
...e,
|
|
1579
1579
|
alinea: n[0] ?? e.alinea ?? null,
|
|
1580
1580
|
...n.length > 0 ? { alineas: n } : {}
|
|
1581
1581
|
};
|
|
1582
1582
|
}
|
|
1583
|
-
function
|
|
1583
|
+
function mr(e) {
|
|
1584
1584
|
return e.replace(/^\s*(?:[IVXLCDM]+)\s*(?:\.\s*)?[-–—]\s*/iu, "").replace(/^\s*(?:\d+°|[a-z]\))\s*/iu, "").trim();
|
|
1585
1585
|
}
|
|
1586
|
-
function
|
|
1587
|
-
let n = /^alin[eé]as?\s+(?:(\d+)|1er|premier)\b/iu.exec(
|
|
1586
|
+
function hr(e, t) {
|
|
1587
|
+
let n = /^alin[eé]as?\s+(?:(\d+)|1er|premier)\b/iu.exec(mr(t.text));
|
|
1588
1588
|
if (!n) return null;
|
|
1589
1589
|
let r = n[1] === void 0 ? 1 : Number.parseInt(n[1], 10);
|
|
1590
1590
|
return !Number.isFinite(r) || r < 1 ? null : {
|
|
@@ -1593,25 +1593,25 @@ function pr(e, t) {
|
|
|
1593
1593
|
alineas: [r]
|
|
1594
1594
|
};
|
|
1595
1595
|
}
|
|
1596
|
-
function
|
|
1596
|
+
function gr(e, t) {
|
|
1597
1597
|
if (e) return e.unit === "article" && t.alinea !== null ? {
|
|
1598
1598
|
...e,
|
|
1599
1599
|
unit: "alinéa"
|
|
1600
1600
|
} : e;
|
|
1601
1601
|
}
|
|
1602
|
-
function
|
|
1603
|
-
return /^(?:apr[eè]s|avant|(?:au|a[uù])\s+d[eé]but|(?:a|à)\s+la\s+fin)\b/iu.test(
|
|
1602
|
+
function _r(e) {
|
|
1603
|
+
return /^(?:apr[eè]s|avant|(?:au|a[uù])\s+d[eé]but|(?:a|à)\s+la\s+fin)\b/iu.test(mr(e.text));
|
|
1604
1604
|
}
|
|
1605
|
-
function
|
|
1606
|
-
return
|
|
1605
|
+
function vr(e, t, n, r) {
|
|
1606
|
+
return J(e, t, {
|
|
1607
1607
|
start: n.position.start,
|
|
1608
1608
|
stop: r.position.stop
|
|
1609
1609
|
});
|
|
1610
1610
|
}
|
|
1611
|
-
function
|
|
1611
|
+
function yr(e) {
|
|
1612
1612
|
return /^\s*(?:[IVXLCDM]+)\s*(?:\.\s*)?[-–—]\s*(?!alin[eé]a\b)/iu.test(e.text);
|
|
1613
1613
|
}
|
|
1614
|
-
function
|
|
1614
|
+
function br(e, t) {
|
|
1615
1615
|
let n = { ...t.position };
|
|
1616
1616
|
function r(t) {
|
|
1617
1617
|
let r = t.exec(e.slice(n.start, n.stop));
|
|
@@ -1620,39 +1620,39 @@ function vr(e, t) {
|
|
|
1620
1620
|
stop: n.stop
|
|
1621
1621
|
});
|
|
1622
1622
|
}
|
|
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),
|
|
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), or(e, n);
|
|
1624
1624
|
}
|
|
1625
|
-
function
|
|
1625
|
+
function xr(e) {
|
|
1626
1626
|
return d(e);
|
|
1627
1627
|
}
|
|
1628
|
-
function
|
|
1629
|
-
return
|
|
1628
|
+
function Sr(e, t) {
|
|
1629
|
+
return rr(new ce(e.slice(0, t.stop), t.start)) ?? null;
|
|
1630
1630
|
}
|
|
1631
|
-
function
|
|
1632
|
-
if (n) return
|
|
1631
|
+
function X(e, t, n) {
|
|
1632
|
+
if (n) return J(e, t, n.position, ar(ne(e, n)));
|
|
1633
1633
|
}
|
|
1634
|
-
function
|
|
1634
|
+
function Cr(e, t) {
|
|
1635
1635
|
if (!e) return;
|
|
1636
1636
|
let n = structuredClone(e);
|
|
1637
|
-
for (let e of
|
|
1637
|
+
for (let e of te(n, { citations: !0 })) e.position !== void 0 && (e.originalTransformation = sr(t, e.position));
|
|
1638
1638
|
return n;
|
|
1639
1639
|
}
|
|
1640
|
-
function
|
|
1641
|
-
let i =
|
|
1640
|
+
function wr(e, t, n, r) {
|
|
1641
|
+
let i = br(e, n);
|
|
1642
1642
|
if (!i) return null;
|
|
1643
|
-
let a =
|
|
1643
|
+
let a = Sr(e, i);
|
|
1644
1644
|
if (!a) return null;
|
|
1645
|
-
let o =
|
|
1645
|
+
let o = J(e, t, i), s = Cr(a.targetReference, t), c = pr(r, s), l = xr(o.text);
|
|
1646
1646
|
if (a.kind === "delete_article") return {
|
|
1647
1647
|
kind: "delete_article",
|
|
1648
|
-
...
|
|
1648
|
+
...q(o),
|
|
1649
1649
|
target: c
|
|
1650
1650
|
};
|
|
1651
1651
|
if (a.kind === "delete_portion") {
|
|
1652
|
-
let n =
|
|
1652
|
+
let n = X(e, t, a.targetCitation);
|
|
1653
1653
|
return {
|
|
1654
1654
|
kind: "delete_portion",
|
|
1655
|
-
...
|
|
1655
|
+
...q(o),
|
|
1656
1656
|
target: c,
|
|
1657
1657
|
...n === void 0 ? {} : {
|
|
1658
1658
|
targetCitation: n,
|
|
@@ -1660,16 +1660,16 @@ function Sr(e, t, n, r) {
|
|
|
1660
1660
|
},
|
|
1661
1661
|
targetOccurrence: l,
|
|
1662
1662
|
targetReference: s,
|
|
1663
|
-
targetScope:
|
|
1663
|
+
targetScope: gr(a.targetScope, c)
|
|
1664
1664
|
};
|
|
1665
1665
|
}
|
|
1666
1666
|
if (a.kind === "rewrite_portion") {
|
|
1667
|
-
let n =
|
|
1667
|
+
let n = X(e, t, a.replacementCitation);
|
|
1668
1668
|
if (!n) return null;
|
|
1669
|
-
let r =
|
|
1669
|
+
let r = X(e, t, a.targetCitation);
|
|
1670
1670
|
return {
|
|
1671
1671
|
kind: "rewrite_portion",
|
|
1672
|
-
...
|
|
1672
|
+
...q(o),
|
|
1673
1673
|
target: c,
|
|
1674
1674
|
...r === void 0 ? {} : {
|
|
1675
1675
|
targetCitation: r,
|
|
@@ -1677,16 +1677,16 @@ function Sr(e, t, n, r) {
|
|
|
1677
1677
|
},
|
|
1678
1678
|
targetOccurrence: l,
|
|
1679
1679
|
targetReference: s,
|
|
1680
|
-
targetScope:
|
|
1680
|
+
targetScope: gr(a.targetScope, c),
|
|
1681
1681
|
replacementCitation: n,
|
|
1682
1682
|
replacementText: n.text
|
|
1683
1683
|
};
|
|
1684
1684
|
}
|
|
1685
1685
|
if (a.kind === "replace") {
|
|
1686
|
-
let n =
|
|
1686
|
+
let n = X(e, t, a.replacementCitation), r = X(e, t, a.targetCitation);
|
|
1687
1687
|
return !n || !r ? null : {
|
|
1688
1688
|
kind: "replace",
|
|
1689
|
-
...
|
|
1689
|
+
...q(o),
|
|
1690
1690
|
target: c,
|
|
1691
1691
|
targetCitation: r,
|
|
1692
1692
|
targetText: r.text,
|
|
@@ -1697,32 +1697,32 @@ function Sr(e, t, n, r) {
|
|
|
1697
1697
|
};
|
|
1698
1698
|
}
|
|
1699
1699
|
if (a.kind === "insert_article_after") {
|
|
1700
|
-
let n =
|
|
1700
|
+
let n = X(e, t, a.insertCitation);
|
|
1701
1701
|
return n ? {
|
|
1702
1702
|
kind: "insert_article_after",
|
|
1703
|
-
...
|
|
1703
|
+
...q(o),
|
|
1704
1704
|
target: c,
|
|
1705
1705
|
insertCitation: n,
|
|
1706
1706
|
insertText: n.text
|
|
1707
1707
|
} : null;
|
|
1708
1708
|
}
|
|
1709
1709
|
if (a.kind === "insert_article_before") {
|
|
1710
|
-
let n =
|
|
1710
|
+
let n = X(e, t, a.insertCitation);
|
|
1711
1711
|
return n ? {
|
|
1712
1712
|
kind: "insert_article_before",
|
|
1713
|
-
...
|
|
1713
|
+
...q(o),
|
|
1714
1714
|
target: c,
|
|
1715
1715
|
insertCitation: n,
|
|
1716
1716
|
insertText: n.text
|
|
1717
1717
|
} : null;
|
|
1718
1718
|
}
|
|
1719
1719
|
if (a.kind === "insert_after" || a.kind === "insert_before") {
|
|
1720
|
-
let n =
|
|
1720
|
+
let n = X(e, t, a.insertCitation);
|
|
1721
1721
|
if (!n) return null;
|
|
1722
|
-
let r =
|
|
1722
|
+
let r = X(e, t, a.targetCitation);
|
|
1723
1723
|
return {
|
|
1724
1724
|
kind: a.kind,
|
|
1725
|
-
...
|
|
1725
|
+
...q(o),
|
|
1726
1726
|
target: c,
|
|
1727
1727
|
...r === void 0 ? {} : {
|
|
1728
1728
|
targetCitation: r,
|
|
@@ -1732,19 +1732,19 @@ function Sr(e, t, n, r) {
|
|
|
1732
1732
|
targetReference: s,
|
|
1733
1733
|
insertCitation: n,
|
|
1734
1734
|
insertText: n.text,
|
|
1735
|
-
targetScope:
|
|
1735
|
+
targetScope: gr(a.targetScope, c)
|
|
1736
1736
|
};
|
|
1737
1737
|
}
|
|
1738
1738
|
return null;
|
|
1739
1739
|
}
|
|
1740
|
-
function
|
|
1740
|
+
function Tr(e, t) {
|
|
1741
1741
|
let n = [], r = 0, i = 0;
|
|
1742
1742
|
function a(r) {
|
|
1743
|
-
let a =
|
|
1743
|
+
let a = or(e, {
|
|
1744
1744
|
start: i,
|
|
1745
1745
|
stop: r
|
|
1746
1746
|
});
|
|
1747
|
-
a !== null && n.push(
|
|
1747
|
+
a !== null && n.push(J(e, t, a));
|
|
1748
1748
|
}
|
|
1749
1749
|
function o(t) {
|
|
1750
1750
|
let n = Math.max(e.lastIndexOf("\n", t - 1), e.lastIndexOf("\r", t - 1));
|
|
@@ -1762,7 +1762,7 @@ function Cr(e, t) {
|
|
|
1762
1762
|
continue;
|
|
1763
1763
|
}
|
|
1764
1764
|
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) &&
|
|
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) && _r({
|
|
1766
1766
|
originalTransformation: void 0,
|
|
1767
1767
|
position: {
|
|
1768
1768
|
start: i,
|
|
@@ -1774,8 +1774,8 @@ function Cr(e, t) {
|
|
|
1774
1774
|
}
|
|
1775
1775
|
return a(e.length), n;
|
|
1776
1776
|
}
|
|
1777
|
-
function
|
|
1778
|
-
let t =
|
|
1777
|
+
function Er(e) {
|
|
1778
|
+
let t = fr(e), n = t?.dispositif ?? null, r = dr(n), i = [], a = [], o = lr(e);
|
|
1779
1779
|
if (e.sourceFormat === "senat-ameli" && e.sourceKind === "S") return i.push({
|
|
1780
1780
|
code: "unsupported_sub_amendment",
|
|
1781
1781
|
message: "Les sous-amendements ne sont pas encore projetés."
|
|
@@ -1793,9 +1793,9 @@ function wr(e) {
|
|
|
1793
1793
|
});
|
|
1794
1794
|
else {
|
|
1795
1795
|
let { simplifiedText: e, transformation: r } = t, s = o, c = null;
|
|
1796
|
-
for (let t of
|
|
1797
|
-
|
|
1798
|
-
let n = c ?
|
|
1796
|
+
for (let t of Tr(e, r)) {
|
|
1797
|
+
yr(t) && (s = o, c = null);
|
|
1798
|
+
let n = c ? vr(e, r, c, t) : t, i = wr(e, r, n, s);
|
|
1799
1799
|
if (i) {
|
|
1800
1800
|
a.push(i), c = null, (i.target.alinea !== null || i.target.alineas) && (s = i.target);
|
|
1801
1801
|
continue;
|
|
@@ -1804,23 +1804,23 @@ function wr(e) {
|
|
|
1804
1804
|
c = n;
|
|
1805
1805
|
continue;
|
|
1806
1806
|
}
|
|
1807
|
-
let l =
|
|
1807
|
+
let l = hr(o, t);
|
|
1808
1808
|
if (l !== null) {
|
|
1809
1809
|
s = l;
|
|
1810
1810
|
continue;
|
|
1811
1811
|
}
|
|
1812
|
-
|
|
1812
|
+
_r(t) && (c = t);
|
|
1813
1813
|
}
|
|
1814
1814
|
a.length === 0 && (o.targetPosition === "after_article" || o.targetPosition === "before_article") && a.push({
|
|
1815
1815
|
kind: o.targetPosition === "before_article" ? "insert_article_before" : "insert_article_after",
|
|
1816
|
-
...
|
|
1816
|
+
...q(n),
|
|
1817
1817
|
target: o,
|
|
1818
1818
|
insertCitation: n,
|
|
1819
1819
|
insertText: n.text
|
|
1820
1820
|
}), a.length === 0 && i.push({
|
|
1821
1821
|
code: "unrecognized_dispositif",
|
|
1822
1822
|
message: "Le dispositif est présent mais aucune directive d'amendement n'a été reconnue.",
|
|
1823
|
-
...
|
|
1823
|
+
...ur(n)
|
|
1824
1824
|
});
|
|
1825
1825
|
}
|
|
1826
1826
|
return {
|
|
@@ -1834,25 +1834,25 @@ function wr(e) {
|
|
|
1834
1834
|
}
|
|
1835
1835
|
//#endregion
|
|
1836
1836
|
//#region src/lib/server/senat_document_search.ts
|
|
1837
|
-
function
|
|
1837
|
+
function Z(e) {
|
|
1838
1838
|
return e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim();
|
|
1839
1839
|
}
|
|
1840
|
-
function
|
|
1841
|
-
let t =
|
|
1840
|
+
function Dr(e) {
|
|
1841
|
+
let t = S(e);
|
|
1842
1842
|
if (!t) return {
|
|
1843
1843
|
articleNumber: null,
|
|
1844
1844
|
label: e,
|
|
1845
1845
|
title: null
|
|
1846
1846
|
};
|
|
1847
|
-
let n =
|
|
1847
|
+
let n = Z(t.num ?? "") || null, r = Z(t.title ?? "") || null;
|
|
1848
1848
|
return {
|
|
1849
1849
|
articleNumber: n,
|
|
1850
1850
|
label: t.label,
|
|
1851
1851
|
title: r
|
|
1852
1852
|
};
|
|
1853
1853
|
}
|
|
1854
|
-
function
|
|
1855
|
-
let t =
|
|
1854
|
+
function Or(e) {
|
|
1855
|
+
let t = g(e), n = [], r = Z(t("section.akn-preamble").text());
|
|
1856
1856
|
return r && n.push({
|
|
1857
1857
|
anchor: "senat-expose-des-motifs",
|
|
1858
1858
|
articleNumber: null,
|
|
@@ -1862,9 +1862,9 @@ function Er(e) {
|
|
|
1862
1862
|
label: "Exposé des motifs",
|
|
1863
1863
|
title: null
|
|
1864
1864
|
}), t("article.akn-article").each((e, r) => {
|
|
1865
|
-
let i = t(r), a = i.attr("id") || `akn-article-${e + 1}`, o =
|
|
1865
|
+
let i = t(r), a = i.attr("id") || `akn-article-${e + 1}`, o = Z(i.children("p.TCNumArticle").first().text()), s = `Article ${e + 1}`, c = Dr(o || s), l = i.clone();
|
|
1866
1866
|
l.children("p.TCNumArticle").remove();
|
|
1867
|
-
let u =
|
|
1867
|
+
let u = Z(l.text());
|
|
1868
1868
|
u && n.push({
|
|
1869
1869
|
anchor: i.attr("id") || null,
|
|
1870
1870
|
articleNumber: c.articleNumber,
|
|
@@ -1876,40 +1876,40 @@ function Er(e) {
|
|
|
1876
1876
|
});
|
|
1877
1877
|
}), n;
|
|
1878
1878
|
}
|
|
1879
|
-
function
|
|
1880
|
-
return
|
|
1879
|
+
function kr(e, t) {
|
|
1880
|
+
return O("sha256").update(JSON.stringify({
|
|
1881
1881
|
item: e,
|
|
1882
1882
|
metadata: t
|
|
1883
1883
|
})).digest("hex");
|
|
1884
1884
|
}
|
|
1885
1885
|
//#endregion
|
|
1886
1886
|
//#region src/lib/server/senat_document_sources.ts
|
|
1887
|
-
var
|
|
1888
|
-
function
|
|
1887
|
+
var Ar = new Set(["senat.fr", "www.senat.fr"]), jr = "https://www.senat.fr";
|
|
1888
|
+
function Mr(e) {
|
|
1889
1889
|
return e?.trim() || void 0;
|
|
1890
1890
|
}
|
|
1891
|
-
function
|
|
1891
|
+
function Nr(e) {
|
|
1892
1892
|
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
|
|
1893
|
+
let t = e.replace(/^\/+/, ""), n = /^https?:\/\//iu.test(e) ? new URL(e) : new URL(/^(?:akomantoso|leg)\//iu.test(t) ? `/${t}` : `/leg/${t}`, jr);
|
|
1894
|
+
return Ar.has(n.hostname.toLowerCase()) ? n : void 0;
|
|
1895
1895
|
} catch {
|
|
1896
1896
|
return;
|
|
1897
1897
|
}
|
|
1898
1898
|
}
|
|
1899
|
-
function
|
|
1900
|
-
let t =
|
|
1899
|
+
function Pr(e) {
|
|
1900
|
+
let t = Mr(e);
|
|
1901
1901
|
if (t === void 0) return {
|
|
1902
1902
|
publicUrl: null,
|
|
1903
1903
|
status: "no_url"
|
|
1904
1904
|
};
|
|
1905
|
-
let n =
|
|
1905
|
+
let n = Nr(t);
|
|
1906
1906
|
if (n === void 0) return {
|
|
1907
1907
|
publicUrl: t,
|
|
1908
1908
|
status: "unsupported_source"
|
|
1909
1909
|
};
|
|
1910
1910
|
let r = n.pathname;
|
|
1911
1911
|
if (/^\/akomantoso\/[^/]+\.akn\.xml$/iu.test(r)) return {
|
|
1912
|
-
akomaNtosoUrl: `${
|
|
1912
|
+
akomaNtosoUrl: `${jr}${r}`,
|
|
1913
1913
|
publicUrl: n.toString(),
|
|
1914
1914
|
status: "available"
|
|
1915
1915
|
};
|
|
@@ -1918,17 +1918,17 @@ function Mr(e) {
|
|
|
1918
1918
|
publicUrl: n.toString(),
|
|
1919
1919
|
status: "unsupported_source"
|
|
1920
1920
|
} : {
|
|
1921
|
-
akomaNtosoUrl: `${
|
|
1921
|
+
akomaNtosoUrl: `${jr}/akomantoso/${i.replace(/\.html$/iu, ".akn.xml")}`,
|
|
1922
1922
|
publicUrl: n.toString(),
|
|
1923
1923
|
status: "available"
|
|
1924
1924
|
};
|
|
1925
1925
|
}
|
|
1926
|
-
function
|
|
1926
|
+
function Fr(e) {
|
|
1927
1927
|
return /^\s*(?:<\?xml\b[^>]*>\s*)?<akomaNtoso[\s/>]/iu.test(e);
|
|
1928
1928
|
}
|
|
1929
1929
|
//#endregion
|
|
1930
1930
|
//#region src/lib/alineas/alineas_numbers.ts
|
|
1931
|
-
var
|
|
1931
|
+
var Ir = {
|
|
1932
1932
|
"0150a855548f15a2af52ea057be53f5d": 1,
|
|
1933
1933
|
"039826cf379b94afefe90b25c6045ca0": 1,
|
|
1934
1934
|
"03a7e564b84662f4d957c51018e26244": 1,
|
|
@@ -20902,7 +20902,7 @@ var Pr = {
|
|
|
20902
20902
|
d16d29c923bd60c7b095b66c6058fe60: 1664,
|
|
20903
20903
|
"1c14c2adf5cfda3220b2057160e10e91": 1665,
|
|
20904
20904
|
e44c55ca1ac46ff46420686a466c9fc6: 1665
|
|
20905
|
-
},
|
|
20905
|
+
}, Lr = "\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", Rr = "\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", zr = "\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", Br = "\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", Vr = "\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", Hr = {
|
|
20906
20906
|
assnatetatagr: { bold: !0 },
|
|
20907
20907
|
assnatetatagrgr: { bold: !0 },
|
|
20908
20908
|
assnatetatatr: { bold: !0 },
|
|
@@ -21003,29 +21003,29 @@ var Pr = {
|
|
|
21003
21003
|
assnatxl67: { align: "center" },
|
|
21004
21004
|
assnatenteteequilibre: { align: "center" }
|
|
21005
21005
|
};
|
|
21006
|
-
function
|
|
21007
|
-
let t = Object.keys(
|
|
21008
|
-
for (let n of t) if (e.includes(n)) return
|
|
21006
|
+
function Ur(e) {
|
|
21007
|
+
let t = Object.keys(Hr).sort((e, t) => t.length - e.length);
|
|
21008
|
+
for (let n of t) if (e.includes(n)) return Hr[n];
|
|
21009
21009
|
return null;
|
|
21010
21010
|
}
|
|
21011
|
-
function
|
|
21012
|
-
return
|
|
21011
|
+
function Wr(e) {
|
|
21012
|
+
return be.createHash("md5").update(e).digest("hex");
|
|
21013
21013
|
}
|
|
21014
|
-
function
|
|
21014
|
+
function Gr(e) {
|
|
21015
21015
|
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
21016
|
}
|
|
21017
|
-
function
|
|
21017
|
+
function Kr(e) {
|
|
21018
21018
|
return e ? /font-style\s*:\s*italic/i.test(e) || /font-family\s*:\s*[^;]*\bItalic\b/i.test(e) : !1;
|
|
21019
21019
|
}
|
|
21020
|
-
function
|
|
21020
|
+
function qr(e) {
|
|
21021
21021
|
if (!e || !/vertical-align\s*:\s*super/i.test(e)) return !1;
|
|
21022
21022
|
let t = e.match(/font-size\s*:\s*([\d.]+)pt/i);
|
|
21023
21023
|
return !(t && parseFloat(t[1]) < 8);
|
|
21024
21024
|
}
|
|
21025
|
-
function
|
|
21025
|
+
function Jr(e) {
|
|
21026
21026
|
return e ? /vertical-align\s*:\s*sub/i.test(e) : !1;
|
|
21027
21027
|
}
|
|
21028
|
-
function
|
|
21028
|
+
function Yr(e) {
|
|
21029
21029
|
if (!e) return;
|
|
21030
21030
|
let t = [
|
|
21031
21031
|
"width",
|
|
@@ -21060,15 +21060,15 @@ function qr(e) {
|
|
|
21060
21060
|
}
|
|
21061
21061
|
return n.length > 0 ? n.join("; ") : void 0;
|
|
21062
21062
|
}
|
|
21063
|
-
function
|
|
21063
|
+
function Xr(e, t) {
|
|
21064
21064
|
return !!(e && /text-align\s*:\s*center/i.test(e) || t && /center/i.test(t));
|
|
21065
21065
|
}
|
|
21066
|
-
function
|
|
21066
|
+
function Zr(e) {
|
|
21067
21067
|
if (!e) return null;
|
|
21068
21068
|
let t = e.match(/text-align\s*:\s*(left|center|right|justify)/i);
|
|
21069
21069
|
return t ? t[1].toLowerCase() : null;
|
|
21070
21070
|
}
|
|
21071
|
-
function
|
|
21071
|
+
function Qr(e) {
|
|
21072
21072
|
if (!e) return null;
|
|
21073
21073
|
for (let [t, n] of [
|
|
21074
21074
|
[/assnat1Tome|assnatAN1PARTIE/i, 1],
|
|
@@ -21080,8 +21080,8 @@ function Xr(e) {
|
|
|
21080
21080
|
]) if (t.test(e)) return n;
|
|
21081
21081
|
return null;
|
|
21082
21082
|
}
|
|
21083
|
-
function
|
|
21084
|
-
let { keepAlignment: n = !0, removeEmptyParagraphs: r = !0, strictAlineas: i = !1 } = t, a =
|
|
21083
|
+
function $r(e, t = {}) {
|
|
21084
|
+
let { keepAlignment: n = !0, removeEmptyParagraphs: r = !0, strictAlineas: i = !1 } = t, a = g(e, { xml: { decodeEntities: !1 } });
|
|
21085
21085
|
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
21086
|
let n = a(t).closest("table");
|
|
21087
21087
|
n.length > 0 && n.remove();
|
|
@@ -21106,7 +21106,7 @@ function Zr(e, t = {}) {
|
|
|
21106
21106
|
if (i.length !== 0 && !(n.parents("del").length > 0 || n.find("del img").length > 0) && !(i.parent("del").length > 0)) {
|
|
21107
21107
|
let e = i.attr();
|
|
21108
21108
|
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 ?
|
|
21109
|
+
let t = (e.src || "").match(/^data:image\/png;base64,(.+)$/), r = t ? Wr(t[1]) : void 0, i = r ? ` data-image-hash="${r}"` : "";
|
|
21110
21110
|
n.replaceWith(`<span class="alinea"${i}></span>`);
|
|
21111
21111
|
return;
|
|
21112
21112
|
}
|
|
@@ -21125,7 +21125,7 @@ function Zr(e, t = {}) {
|
|
|
21125
21125
|
(!r || r === "\xA0") && n.remove();
|
|
21126
21126
|
}), a("span[style*=\"display:block\"][style*=\"position:absolute\"]:not(.alinea)").remove(), a("del").remove();
|
|
21127
21127
|
function o(e) {
|
|
21128
|
-
let t = a(e), n = t.attr("style"), r = e.tagName?.toLowerCase() || "", i =
|
|
21128
|
+
let t = a(e), n = t.attr("style"), r = e.tagName?.toLowerCase() || "", i = Gr(n) || r === "b" || r === "strong", o = Kr(n) || r === "i" || r === "em", s = qr(n) || r === "sup", c = Jr(n) || r === "sub", l = t.attr("class") || "";
|
|
21129
21129
|
return /bold/i.test(l) && (i = !0), /strongemphasis/i.test(l) ? i = !0 : /italic|emphasis/i.test(l) && (o = !0), {
|
|
21130
21130
|
bold: i,
|
|
21131
21131
|
italic: o,
|
|
@@ -21159,7 +21159,7 @@ function Zr(e, t = {}) {
|
|
|
21159
21159
|
c = e;
|
|
21160
21160
|
}
|
|
21161
21161
|
for (a("p").each((e, t) => {
|
|
21162
|
-
let r = a(t), i = r.attr("class") || "", o = r.attr("style"), s =
|
|
21162
|
+
let r = a(t), i = r.attr("class") || "", o = r.attr("style"), s = Qr(i);
|
|
21163
21163
|
if (i.includes("assnatFARCouvTitreD")) {
|
|
21164
21164
|
let e = r.html() || "";
|
|
21165
21165
|
r.replaceWith(`<p class="cover-subtitle">${e}</p>`);
|
|
@@ -21192,11 +21192,11 @@ function Zr(e, t = {}) {
|
|
|
21192
21192
|
let c = r.text().trim().startsWith("«");
|
|
21193
21193
|
if (s && !c) {
|
|
21194
21194
|
let e = a(`<h${s}>${r.html() || ""}</h${s}>`);
|
|
21195
|
-
n &&
|
|
21195
|
+
n && Xr(o, i) && e.attr("align", "center"), r.replaceWith(e);
|
|
21196
21196
|
} else {
|
|
21197
|
-
let e =
|
|
21197
|
+
let e = Ur(i), t;
|
|
21198
21198
|
if (n) {
|
|
21199
|
-
let n =
|
|
21199
|
+
let n = Zr(o);
|
|
21200
21200
|
n && n !== "justify" && n !== "left" ? t = n : e?.align && (t = e.align);
|
|
21201
21201
|
}
|
|
21202
21202
|
if (r.removeAttr("style").removeAttr("class"), t && r.attr("align", t), e?.bold) {
|
|
@@ -21206,7 +21206,7 @@ function Zr(e, t = {}) {
|
|
|
21206
21206
|
}
|
|
21207
21207
|
}), a("h1, h2, h3, h4, h5, h6").each((e, t) => {
|
|
21208
21208
|
let r = a(t), i = r.attr("style"), o = r.attr("class");
|
|
21209
|
-
n &&
|
|
21209
|
+
n && Xr(i, o) ? (r.removeAttr("style").removeAttr("class"), r.attr("align", "center")) : r.removeAttr("style").removeAttr("class");
|
|
21210
21210
|
}), a("a").each((e, t) => {
|
|
21211
21211
|
let n = a(t), r = n.attr("href"), i = n.attr("id"), o = { ...t.attribs || {} };
|
|
21212
21212
|
for (let e of Object.keys(o)) e !== "href" && e !== "id" && n.removeAttr(e);
|
|
@@ -21245,7 +21245,7 @@ function Zr(e, t = {}) {
|
|
|
21245
21245
|
}), a("br").each((e, t) => {
|
|
21246
21246
|
a(t).removeAttr("style").removeAttr("class");
|
|
21247
21247
|
}), a("table, tr, td, th, thead, tbody, tfoot").each((e, t) => {
|
|
21248
|
-
let n = a(t), r =
|
|
21248
|
+
let n = a(t), r = Yr(n.attr("style"));
|
|
21249
21249
|
n.removeAttr("style").removeAttr("class"), r && n.attr("style", r);
|
|
21250
21250
|
}), a("td, th").each((e, t) => {
|
|
21251
21251
|
let n = a(t), r = n.children();
|
|
@@ -21263,17 +21263,17 @@ function Zr(e, t = {}) {
|
|
|
21263
21263
|
!isNaN(e) && e > 1 && n.attr("style", `counter-reset: list-counter ${e - 1}`), n.attr("start", r);
|
|
21264
21264
|
}
|
|
21265
21265
|
}), a("li").each((e, t) => {
|
|
21266
|
-
let n = a(t), r =
|
|
21266
|
+
let n = a(t), r = Zr(n.attr("style"));
|
|
21267
21267
|
n.removeAttr("style").removeAttr("class"), r === "center" && n.attr("style", "text-align: center");
|
|
21268
21268
|
let i = n.html() || "", o = i.replace(/^(\s| | |\u00a0)+/, "");
|
|
21269
21269
|
o !== i && n.html(o);
|
|
21270
|
-
}),
|
|
21271
|
-
let l = a("body").html() || a.html(),
|
|
21272
|
-
|
|
21273
|
-
let
|
|
21274
|
-
return
|
|
21270
|
+
}), ei(a), ti(a, i);
|
|
21271
|
+
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"), ee = l.includes("class=\"cover-title\"") || l.includes("class=\"cover-subtitle\"") || l.includes("class=\"cover-info\"") || l.includes("class=\"cover-year\""), m = "";
|
|
21272
|
+
ee && (m += Vr), f && (m += Rr), p && (m += zr), u && (m += Lr), d && (m += Br);
|
|
21273
|
+
let h = m ? `<style>${m}</style>\n${l}` : l;
|
|
21274
|
+
return h = h.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"), h = h.replace(/ /g, "\xA0"), r && (h = h.replace(/<p[^>]*>\s*( | | |\u00a0|\s)*\s*<\/p>/gi, "").replace(/<p[^>]*>\s*<(strong|em|b|i)>\s*( | | |\u00a0|\s)*\s*<\/\1>\s*<\/p>/gi, "")), h = h.replace(/<span[^>]*>\s*<\/span>/gi, ""), h = h.replace(/ class=""/g, ""), h = ni(h), h = h.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(), h;
|
|
21275
21275
|
}
|
|
21276
|
-
function
|
|
21276
|
+
function ei(e) {
|
|
21277
21277
|
e("span[id]").each((t, n) => {
|
|
21278
21278
|
let r = e(n), i = r.attr("id"), a = n.attribs || {}, o = Object.keys(a);
|
|
21279
21279
|
if (o.length !== 1 || o[0] !== "id") return;
|
|
@@ -21296,13 +21296,13 @@ function Qr(e) {
|
|
|
21296
21296
|
l.trim() === u.trim() && (s.attr("id", i), r.replaceWith(r.html() || ""));
|
|
21297
21297
|
});
|
|
21298
21298
|
}
|
|
21299
|
-
function
|
|
21299
|
+
function ti(e, t = !1) {
|
|
21300
21300
|
let n = e("body");
|
|
21301
21301
|
if (n.length === 0) return;
|
|
21302
21302
|
let r = n.find("span.alinea[data-image-hash]"), i = -1;
|
|
21303
21303
|
r.each((n, r) => {
|
|
21304
21304
|
let a = e(r), o = a.attr("data-image-hash"), s;
|
|
21305
|
-
if (o &&
|
|
21305
|
+
if (o && Ir[o] !== void 0 && (s = Ir[o]), s === void 0) {
|
|
21306
21306
|
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
21307
|
a.remove();
|
|
21308
21308
|
return;
|
|
@@ -21314,11 +21314,11 @@ function $r(e, t = !1) {
|
|
|
21314
21314
|
i = s, a.attr("data-alinea", String(s)), a.text(String(s)), a.removeAttr("data-image-hash");
|
|
21315
21315
|
});
|
|
21316
21316
|
}
|
|
21317
|
-
function
|
|
21317
|
+
function ni(e) {
|
|
21318
21318
|
let t = e;
|
|
21319
21319
|
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
21320
|
}
|
|
21321
|
-
function
|
|
21321
|
+
function ri(e, t = {}) {
|
|
21322
21322
|
return `<!DOCTYPE html>
|
|
21323
21323
|
<html lang="fr">
|
|
21324
21324
|
<head>
|
|
@@ -21326,33 +21326,33 @@ function ti(e, t = {}) {
|
|
|
21326
21326
|
<title>Document simplifié</title>
|
|
21327
21327
|
</head>
|
|
21328
21328
|
<body>
|
|
21329
|
-
${
|
|
21329
|
+
${$r(e, t)}
|
|
21330
21330
|
</body>
|
|
21331
21331
|
</html>`;
|
|
21332
21332
|
}
|
|
21333
21333
|
//#endregion
|
|
21334
21334
|
//#region src/lib/server/text_parsers/transformers.ts
|
|
21335
|
-
function
|
|
21335
|
+
function Q(e, t) {
|
|
21336
21336
|
let n = "transformation_", r = {};
|
|
21337
|
-
for (let e of
|
|
21337
|
+
for (let e of k.readdirSync(t).toSorted()) if (e.startsWith(n) && e.endsWith(".json")) {
|
|
21338
21338
|
let i = e.slice(15, -5), a = i.split(".").map((e) => parseInt(e) - 1), o = r;
|
|
21339
21339
|
for (let e of a.slice(1)) {
|
|
21340
21340
|
let t = o.transformations ??= [];
|
|
21341
21341
|
for (; e >= t.length;) t.push({});
|
|
21342
21342
|
o = t[e];
|
|
21343
21343
|
}
|
|
21344
|
-
o.output =
|
|
21345
|
-
let { sourceMap: s, title: c } =
|
|
21344
|
+
o.output = k.readFileSync(A.join(t, `${n}${i}.html`), { encoding: "utf-8" });
|
|
21345
|
+
let { sourceMap: s, title: c } = k.readJsonSync(A.join(t, e), { encoding: "utf-8" });
|
|
21346
21346
|
o.sourceMap = s ?? [], o.title = c;
|
|
21347
21347
|
}
|
|
21348
|
-
return
|
|
21348
|
+
return ii(r, e), r;
|
|
21349
21349
|
}
|
|
21350
|
-
function
|
|
21351
|
-
if (e.input = t, e.transformations !== void 0) for (let n of e.transformations)
|
|
21350
|
+
function ii(e, t) {
|
|
21351
|
+
if (e.input = t, e.transformations !== void 0) for (let n of e.transformations) ii(n, t), t = n.output;
|
|
21352
21352
|
return t;
|
|
21353
21353
|
}
|
|
21354
|
-
function
|
|
21355
|
-
if (
|
|
21354
|
+
function $(e, t, n = "1") {
|
|
21355
|
+
if (k.ensureDirSync(t), e.transformations === void 0) k.writeJsonSync(A.join(t, `transformation_${n}.json`), {
|
|
21356
21356
|
sourceMap: e.sourceMap,
|
|
21357
21357
|
title: e.title
|
|
21358
21358
|
}, {
|
|
@@ -21360,43 +21360,43 @@ function ii(e, t, n = "1") {
|
|
|
21360
21360
|
spaces: 2
|
|
21361
21361
|
});
|
|
21362
21362
|
else {
|
|
21363
|
-
|
|
21363
|
+
k.writeJsonSync(A.join(t, `transformation_${n}.json`), { title: e.title }, {
|
|
21364
21364
|
encoding: "utf-8",
|
|
21365
21365
|
spaces: 2
|
|
21366
21366
|
});
|
|
21367
|
-
for (let [r, i] of e.transformations.entries())
|
|
21367
|
+
for (let [r, i] of e.transformations.entries()) $(i, t, `${n}.${r + 1}`);
|
|
21368
21368
|
}
|
|
21369
|
-
e.output !== void 0 &&
|
|
21369
|
+
e.output !== void 0 && k.writeFileSync(A.join(t, `transformation_${n}.html`), e.output, { encoding: "utf-8" });
|
|
21370
21370
|
}
|
|
21371
21371
|
//#endregion
|
|
21372
21372
|
//#region src/lib/server/linkers/html.ts
|
|
21373
|
-
async function ai({ 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:
|
|
21374
|
-
let
|
|
21375
|
-
if (
|
|
21376
|
-
let
|
|
21377
|
-
a === void 0 ? (
|
|
21378
|
-
let
|
|
21379
|
-
s !== void 0 &&
|
|
21380
|
-
let { outputByType:
|
|
21381
|
-
legiResolver:
|
|
21373
|
+
async function ai({ 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: ee, logReferences: m, referredLegifranceTextsInfosFilePath: g }) {
|
|
21374
|
+
let te = t ?? (e === void 0 ? void 0 : new h(e));
|
|
21375
|
+
if (te === void 0) throw Error("A Canutes database or legal resolver is required");
|
|
21376
|
+
let _ = await k.readFile(i, { encoding: "utf-8" }), v;
|
|
21377
|
+
a === void 0 ? (v = ue({ removeAWithHref: !0 })(_), o !== void 0 && $(v, o)) : v = Q(_, a);
|
|
21378
|
+
let y = [];
|
|
21379
|
+
s !== void 0 && y.push("links"), c !== void 0 && y.push("links_or_references"), u !== void 0 && y.push("references");
|
|
21380
|
+
let { outputByType: b, referredLegifranceTextCountByCid: ne } = await re({
|
|
21381
|
+
legiResolver: te,
|
|
21382
21382
|
date: n,
|
|
21383
21383
|
defaultTextId: r,
|
|
21384
|
-
htmlTransformation:
|
|
21385
|
-
inputHtml:
|
|
21384
|
+
htmlTransformation: v,
|
|
21385
|
+
inputHtml: _,
|
|
21386
21386
|
linkBaseUrl: d,
|
|
21387
21387
|
linkType: f,
|
|
21388
21388
|
logIgnoredReferencesTypes: p,
|
|
21389
|
-
logPartialReferences:
|
|
21390
|
-
logReferences:
|
|
21391
|
-
outputTypes:
|
|
21392
|
-
referredLegifranceTextsInfos:
|
|
21389
|
+
logPartialReferences: ee,
|
|
21390
|
+
logReferences: m,
|
|
21391
|
+
outputTypes: y,
|
|
21392
|
+
referredLegifranceTextsInfos: g !== void 0
|
|
21393
21393
|
}), x = {};
|
|
21394
21394
|
s !== void 0 && (x.links = s), c !== void 0 && (x.links_or_references = c), u !== void 0 && (x.references = u);
|
|
21395
|
-
for (let [e, t] of Object.entries(
|
|
21395
|
+
for (let [e, t] of Object.entries(b)) {
|
|
21396
21396
|
let n = x[e];
|
|
21397
|
-
n !== void 0 && await
|
|
21397
|
+
n !== void 0 && await k.writeFile(n, t.html, { encoding: "utf-8" });
|
|
21398
21398
|
}
|
|
21399
|
-
|
|
21399
|
+
b.links !== void 0 && l !== void 0 && $(ue()(b.links.html), l), g !== void 0 && await k.writeJson(g, ne, {
|
|
21400
21400
|
encoding: "utf-8",
|
|
21401
21401
|
spaces: 2
|
|
21402
21402
|
});
|
|
@@ -21404,20 +21404,20 @@ async function ai({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, ht
|
|
|
21404
21404
|
//#endregion
|
|
21405
21405
|
//#region src/lib/server/tables_of_contents.ts
|
|
21406
21406
|
async function oi(e, t, n, r) {
|
|
21407
|
-
let i =
|
|
21408
|
-
for await (let e of
|
|
21407
|
+
let i = Q(await k.readFile(e, { encoding: "utf-8" }), t), a = i.output, o = new ce(a), s = await k.readJson(n, { encoding: "utf-8" });
|
|
21408
|
+
for await (let e of p({
|
|
21409
21409
|
context: o,
|
|
21410
21410
|
tableOfContents: s,
|
|
21411
21411
|
transformation: i
|
|
21412
21412
|
}));
|
|
21413
|
-
await
|
|
21413
|
+
await k.writeJson(r, s, {
|
|
21414
21414
|
encoding: "utf-8",
|
|
21415
21415
|
spaces: 2
|
|
21416
21416
|
});
|
|
21417
21417
|
}
|
|
21418
21418
|
async function si(e, t, n) {
|
|
21419
|
-
let r =
|
|
21420
|
-
await
|
|
21419
|
+
let r = Q(await k.readFile(e, { encoding: "utf-8" }), t).output, i = y(r);
|
|
21420
|
+
await k.writeJson(n, i, {
|
|
21421
21421
|
encoding: "utf-8",
|
|
21422
21422
|
spaces: 2
|
|
21423
21423
|
});
|
|
@@ -21428,4 +21428,4 @@ function ci({ canutesDb: e }) {
|
|
|
21428
21428
|
return new h(e);
|
|
21429
21429
|
}
|
|
21430
21430
|
//#endregion
|
|
21431
|
-
export {
|
|
21431
|
+
export { ye as LegiResolver, ai as addLinksOrReferencesToHtmlFile, oi as addPositionsToTableOfContentsFile, ve as buildAndInstallTextTitlesInfos, pe as buildTextTitlesInfos, ci as createLegiResolver, we as extractAssembleeAmendmentSearchItems, Cn as extractAssembleeExposesDesMotifs, On as extractSenatAmendmentSearchItems, Te as hashAssembleeAmendmentSearchItem, Tn as hashAssembleeSearchItem, kn as hashSenatAmendmentSearchItem, kr as hashSenatSearchItem, Fr as isAkomaNtosoXml, En as isoDateFromAssembleeDocument, yn as linkAkomaNtosoBillRaw, At as linkAssembleeBillRaw, vn as parseAkomaNtosoBillRaw, Er as parseAmendment, kt as parseAssembleeBillRaw, wn as parseAssembleeDocumentSearchContent, Or as parseSenatDocumentSearchContent, Q as readTransformation, mn as renderAkomaNtosoBillRaw, Pr as resolveSenatAkomaNtosoSource, si as simplifiedHtmlBillFileToTableOfContentsFile, $r as simplifyWordHtml, ri as simplifyWordHtmlToDocument, $ as writeTransformation };
|