@tricoteuses/tisseuse 0.16.2 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{html-BTeBbxJE.js → html-UaTiLfCR.js} +948 -843
- package/dist/index.js +55 -55
- package/dist/server.js +592 -616
- package/dist/src/lib/extractors/article_portions.d.ts +6 -0
- package/dist/src/lib/index.d.ts +1 -1
- package/dist/src/lib/text_parsers/table_row_targets.d.ts +2 -0
- package/dist/src/lib/text_parsers/table_unit_notes.d.ts +1 -0
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import * as
|
|
4
|
-
import { createHash as
|
|
1
|
+
import { $ as e, A as t, C as n, D as r, Dt as i, E as a, Et as o, I as s, M as c, O as l, Ot as u, Q as d, Rt as f, S as p, Tt as m, V as h, Y as g, b as _, c as v, ct as y, g as b, h as x, j as S, jt as C, k as ee, m as te, n as ne, ot as re, p as ie, rt as ae, s as oe, t as se, u as ce, v as le, w as ue, x as de, xt as fe, z as pe, zt as me } from "./html-UaTiLfCR.js";
|
|
2
|
+
import { Dt as w, Et as T, F as he, I as ge, N as _e, Nt as E, O as ve, Tt as D, ct as ye, et as be, ht as xe, jt as O, k as Se, kt as Ce, n as we, o as Te, r as Ee, t as De, vt as k } from "./resolver-CuP8arVX.js";
|
|
3
|
+
import * as Oe from "node:crypto";
|
|
4
|
+
import { createHash as ke } from "node:crypto";
|
|
5
5
|
import A from "fs-extra";
|
|
6
|
-
import
|
|
6
|
+
import Ae from "node:path";
|
|
7
7
|
//#region src/lib/server/assemblee_amendment_search.ts
|
|
8
|
-
function
|
|
8
|
+
function je(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 Pe(e, t) {
|
|
|
13
13
|
}
|
|
14
14
|
return typeof n == "string" && n.trim() ? n.trim() : null;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function Me(e) {
|
|
17
17
|
return e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim();
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
return
|
|
19
|
+
function Ne(e) {
|
|
20
|
+
return Me(y(e).text());
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
let t =
|
|
24
|
-
|
|
22
|
+
function Pe(e) {
|
|
23
|
+
let t = Me([
|
|
24
|
+
je(e, [
|
|
25
25
|
"corps",
|
|
26
26
|
"contenuAuteur",
|
|
27
27
|
"dispositif"
|
|
28
28
|
]),
|
|
29
|
-
|
|
29
|
+
je(e, [
|
|
30
30
|
"corps",
|
|
31
31
|
"contenuAuteur",
|
|
32
32
|
"dispositifAmdtCreditPLF"
|
|
33
33
|
]),
|
|
34
|
-
|
|
34
|
+
je(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) => Ne(e)).join("\n")), n = je(e, [
|
|
40
40
|
"corps",
|
|
41
41
|
"contenuAuteur",
|
|
42
42
|
"exposeSommaire"
|
|
43
|
-
]), r = n === null ? "" :
|
|
43
|
+
]), r = n === null ? "" : Ne(n);
|
|
44
44
|
return [...t ? [{
|
|
45
45
|
content: t,
|
|
46
46
|
itemKind: "dispositif",
|
|
@@ -51,8 +51,8 @@ function Le(e) {
|
|
|
51
51
|
label: "Exposé sommaire"
|
|
52
52
|
}] : []];
|
|
53
53
|
}
|
|
54
|
-
function
|
|
55
|
-
return
|
|
54
|
+
function Fe(e, t) {
|
|
55
|
+
return ke("sha256").update(JSON.stringify({
|
|
56
56
|
item: e,
|
|
57
57
|
metadata: t
|
|
58
58
|
})).digest("hex");
|
|
@@ -64,7 +64,7 @@ function j(e) {
|
|
|
64
64
|
case "reference_et_action": return j(e.reference);
|
|
65
65
|
case "enumeration": return [...j(e.left), ...j(e.right)];
|
|
66
66
|
case "parent-enfant": {
|
|
67
|
-
let t = [...
|
|
67
|
+
let t = [...f(e.parent)].filter((e) => e.type === "article");
|
|
68
68
|
return t.length === 1 ? [{
|
|
69
69
|
article: t[0],
|
|
70
70
|
reference: e
|
|
@@ -88,36 +88,12 @@ function j(e) {
|
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
//#endregion
|
|
91
|
-
//#region src/lib/text_parsers/table_row_targets.ts
|
|
92
|
-
var ze = Te("lignes du tableau constituant", w([
|
|
93
|
-
E("les ", { flags: "i" }),
|
|
94
|
-
ke,
|
|
95
|
-
E(" et ", { flags: "i" }),
|
|
96
|
-
ke,
|
|
97
|
-
E(" lignes du tableau constituant le ", { flags: "i" }),
|
|
98
|
-
te,
|
|
99
|
-
ge,
|
|
100
|
-
ae
|
|
101
|
-
], { value: (e, t) => {
|
|
102
|
-
let n = e[1], r = e[3], i = e[5];
|
|
103
|
-
if (!(i.type !== "alinéa" || i.index === void 0 || n < 1 || r !== n + 1)) return {
|
|
104
|
-
article: e[7],
|
|
105
|
-
alineaIndex: i.index,
|
|
106
|
-
rowIndex: n,
|
|
107
|
-
rowEndIndex: r,
|
|
108
|
-
position: t.position()
|
|
109
|
-
};
|
|
110
|
-
} }));
|
|
111
|
-
function Be(e) {
|
|
112
|
-
return [...ze.extract(new D(e), { overlapWindow: 50 })];
|
|
113
|
-
}
|
|
114
|
-
//#endregion
|
|
115
91
|
//#region src/lib/extractors/article_action_effects.ts
|
|
116
|
-
function
|
|
92
|
+
function Ie(e, t) {
|
|
117
93
|
if (t < 2) return null;
|
|
118
|
-
let n =
|
|
94
|
+
let n = Se(e), r = b(e);
|
|
119
95
|
if (r.length !== t) return null;
|
|
120
|
-
let i = s(new D(n.output)), a = (e) =>
|
|
96
|
+
let i = s(new D(n.output)), a = (e) => ge(n, [e])[0].position;
|
|
121
97
|
return r.map((t, n) => ({
|
|
122
98
|
sourceText: e,
|
|
123
99
|
referencePosition: a({
|
|
@@ -127,20 +103,20 @@ function Ve(e, t) {
|
|
|
127
103
|
actionPosition: a(t.position)
|
|
128
104
|
}));
|
|
129
105
|
}
|
|
130
|
-
function
|
|
106
|
+
function Le(e, t, n) {
|
|
131
107
|
if (t.length < 2) return null;
|
|
132
|
-
let r =
|
|
108
|
+
let r = Se(e), i = r.output, a = (e) => ge(r, [e])[0].position, o = s(new D(i)), c = o.flatMap(j);
|
|
133
109
|
if (c.length !== t.length || c.length < 2) return null;
|
|
134
|
-
let l =
|
|
110
|
+
let l = de(i);
|
|
135
111
|
if (l.length > 0) return n?.kind !== "replace_portion" || l.length !== c.length || l.some((e, t) => {
|
|
136
112
|
let n = c[t];
|
|
137
|
-
return n.article.num !== e.article.num || n.article.position.start !== e.article.position.start || n.article.position.stop !== e.article.position.stop || !
|
|
113
|
+
return n.article.num !== e.article.num || n.article.position.start !== e.article.position.start || n.article.position.stop !== e.article.position.stop || !ae(n.reference).some((t) => t.kind === "single" && t.steps.some((t) => t.type === "alinéa" && t.index === e.alineaIndex));
|
|
138
114
|
}) ? null : c.map((r, i) => ({
|
|
139
115
|
targetId: t[i],
|
|
140
116
|
directive: {
|
|
141
117
|
...n,
|
|
142
118
|
reference: r.reference,
|
|
143
|
-
portionSelectors:
|
|
119
|
+
portionSelectors: ae(r.reference),
|
|
144
120
|
tableTarget: {
|
|
145
121
|
type: "table",
|
|
146
122
|
rowIndex: l[i].rowIndex,
|
|
@@ -160,7 +136,7 @@ function He(e, t, n) {
|
|
|
160
136
|
if (u.length > 0 && u.length < c.length) {
|
|
161
137
|
let n = c.filter((e) => !u.includes(e));
|
|
162
138
|
if (n.length !== 1) return null;
|
|
163
|
-
let r = n[0], o = t[c.indexOf(r)], s =
|
|
139
|
+
let r = n[0], o = t[c.indexOf(r)], s = _(i);
|
|
164
140
|
return !o || s.length !== 1 || s[0].kind === "compound" ? null : [{
|
|
165
141
|
targetId: o,
|
|
166
142
|
sourceAnnotation: {
|
|
@@ -185,7 +161,7 @@ function He(e, t, n) {
|
|
|
185
161
|
let d = [], f = 0;
|
|
186
162
|
for (let e = 1; e < o.length; e += 1) {
|
|
187
163
|
let t = o[e];
|
|
188
|
-
t.type !== "reference_et_action" || j(t).length === 0 || o.slice(f, e).flatMap(j).length === 0 ||
|
|
164
|
+
t.type !== "reference_et_action" || j(t).length === 0 || o.slice(f, e).flatMap(j).length === 0 || _(i.slice(f === 0 ? 0 : o[f].position.start, t.position.start)).length === 1 && _(i.slice(t.position.start)).length === 1 && (d.push(e - 1), f = e);
|
|
189
165
|
}
|
|
190
166
|
d.push(o.length - 1);
|
|
191
167
|
let p = [], m = 0, h = 0;
|
|
@@ -195,7 +171,7 @@ function He(e, t, n) {
|
|
|
195
171
|
m = n + 1;
|
|
196
172
|
continue;
|
|
197
173
|
}
|
|
198
|
-
let s = m === 0 ? 0 : o[m].position.start, c = o[n + 1]?.position.start ?? i.length, l =
|
|
174
|
+
let s = m === 0 ? 0 : o[m].position.start, c = o[n + 1]?.position.start ?? i.length, l = _(i.slice(s, c));
|
|
199
175
|
if (l.length !== 1 || l[0].kind === "compound") return null;
|
|
200
176
|
let u = l[0];
|
|
201
177
|
for (let n of r) {
|
|
@@ -219,7 +195,7 @@ function He(e, t, n) {
|
|
|
219
195
|
stop: i.length
|
|
220
196
|
},
|
|
221
197
|
reference: n.reference,
|
|
222
|
-
portionSelectors:
|
|
198
|
+
portionSelectors: ae(n.reference)
|
|
223
199
|
}
|
|
224
200
|
});
|
|
225
201
|
}
|
|
@@ -227,16 +203,16 @@ function He(e, t, n) {
|
|
|
227
203
|
}
|
|
228
204
|
return h === t.length ? p : null;
|
|
229
205
|
}
|
|
230
|
-
var
|
|
206
|
+
var Re = Ce("dans sa rédaction", w([w([E("dans sa rédaction ", { flags: "i" }), T(E("issue ", { flags: "i" }), E("résultante ", { flags: "i" }), E("résultant ", { flags: "i" }))], { value: "qualified-version-redaction" }), T(w([E("de l'", { flags: "i" }), h], { value: (e) => e[1] }), pe)], { value: (e) => e[1] }));
|
|
231
207
|
//#endregion
|
|
232
208
|
//#region src/lib/extractors/qualified_versions.ts
|
|
233
|
-
function
|
|
234
|
-
let t =
|
|
235
|
-
for (let e of
|
|
209
|
+
function ze(e) {
|
|
210
|
+
let t = Se(e), n = [];
|
|
211
|
+
for (let e of Re.extract(new D(t.output), { jumpExact: !0 })) for (let r of me(e)) {
|
|
236
212
|
if (r.type !== "parent-enfant" || r.parent.type !== "texte" || r.parent.nature !== "LOI") continue;
|
|
237
|
-
let e = [...
|
|
213
|
+
let e = [...f(r.child)].filter((e) => e.type === "article" && e.position.start < r.parent.position.start);
|
|
238
214
|
if (e.length === 1) {
|
|
239
|
-
n.push(
|
|
215
|
+
n.push(ge(t, [e[0].position])[0].position);
|
|
240
216
|
break;
|
|
241
217
|
}
|
|
242
218
|
}
|
|
@@ -244,29 +220,29 @@ function We(e) {
|
|
|
244
220
|
}
|
|
245
221
|
//#endregion
|
|
246
222
|
//#region src/lib/server/parsed_bills.ts
|
|
247
|
-
var
|
|
223
|
+
var Be = /^expos[ée]\s+des\s+motifs\b/iu;
|
|
248
224
|
function M(e) {
|
|
249
225
|
return (e ?? "").replace(/\u00a0/g, " ").replace(/\s+/g, " ").trim();
|
|
250
226
|
}
|
|
251
227
|
function N(e) {
|
|
252
228
|
return M(e).toLowerCase().normalize("NFD").replace(/\p{Diacritic}/gu, "");
|
|
253
229
|
}
|
|
254
|
-
function
|
|
255
|
-
return
|
|
230
|
+
function Ve(e) {
|
|
231
|
+
return m(M(e));
|
|
256
232
|
}
|
|
257
233
|
function P(e) {
|
|
258
|
-
return `_TocArt${
|
|
234
|
+
return `_TocArt${Ve(e).replace(/\s+/gu, "")}`;
|
|
259
235
|
}
|
|
260
|
-
function
|
|
236
|
+
function He(e, t) {
|
|
261
237
|
return e(t).closest(".assnatTOC6,.assnatTOC5,.assnatTOC4").length > 0;
|
|
262
238
|
}
|
|
263
|
-
function
|
|
239
|
+
function Ue(e) {
|
|
264
240
|
return N(e).replace(/[‐‑‒–—]/gu, "-").replace(/\s*\.\s*/gu, ".");
|
|
265
241
|
}
|
|
266
|
-
function
|
|
267
|
-
return
|
|
242
|
+
function We(e) {
|
|
243
|
+
return Ue(e).replace(/[^a-z0-9]+/gu, "-").replace(/^-|-$/gu, "");
|
|
268
244
|
}
|
|
269
|
-
function
|
|
245
|
+
function Ge(e) {
|
|
270
246
|
switch (e.kind) {
|
|
271
247
|
case "insert_after":
|
|
272
248
|
case "insert_before": return e.insertText;
|
|
@@ -284,12 +260,12 @@ function Xe(e) {
|
|
|
284
260
|
default: return;
|
|
285
261
|
}
|
|
286
262
|
}
|
|
287
|
-
function
|
|
263
|
+
function Ke(e) {
|
|
288
264
|
let t = M(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);
|
|
289
|
-
if (n?.[1] !== void 0) return
|
|
265
|
+
if (n?.[1] !== void 0) return o(n[1]);
|
|
290
266
|
}
|
|
291
|
-
function
|
|
292
|
-
let t =
|
|
267
|
+
function qe(e) {
|
|
268
|
+
let t = Ge(e), n = fe(t ?? "");
|
|
293
269
|
if (n.length > 0 && t !== void 0) return n.map((e, r) => {
|
|
294
270
|
let i = e.start, a = n[r + 1]?.start ?? t.length, o = t.slice(i, a).trim();
|
|
295
271
|
return {
|
|
@@ -297,58 +273,58 @@ function Qe(e) {
|
|
|
297
273
|
text: o
|
|
298
274
|
};
|
|
299
275
|
});
|
|
300
|
-
let r =
|
|
276
|
+
let r = Ke(e);
|
|
301
277
|
return r === void 0 ? [] : [{
|
|
302
278
|
num: r,
|
|
303
279
|
text: t ?? e.sourceText
|
|
304
280
|
}];
|
|
305
281
|
}
|
|
306
|
-
function
|
|
282
|
+
function Je(e, t = /* @__PURE__ */ new Set()) {
|
|
307
283
|
if (e == null) return t;
|
|
308
284
|
if (Array.isArray(e)) {
|
|
309
|
-
for (let n of e)
|
|
285
|
+
for (let n of e) Je(n, t);
|
|
310
286
|
return t;
|
|
311
287
|
}
|
|
312
288
|
if (typeof e != "object") return t;
|
|
313
289
|
let n = e;
|
|
314
290
|
n.type === "article" && typeof n.num == "string" && t.add(n.num);
|
|
315
|
-
for (let e of Object.values(n))
|
|
291
|
+
for (let e of Object.values(n)) Je(e, t);
|
|
316
292
|
return t;
|
|
317
293
|
}
|
|
318
|
-
function
|
|
294
|
+
function Ye(e) {
|
|
319
295
|
let t = N(e.sourceText);
|
|
320
296
|
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);
|
|
321
297
|
}
|
|
322
|
-
function
|
|
298
|
+
function Xe(e) {
|
|
323
299
|
return M(e).replace(/[’']/gu, "'").replace(/[‐‑‒–—]/gu, "-");
|
|
324
300
|
}
|
|
325
|
-
function
|
|
326
|
-
let n = new D(e, t), r =
|
|
301
|
+
function Ze(e, t) {
|
|
302
|
+
let n = new D(e, t), r = be(n);
|
|
327
303
|
return typeof r != "string" || n.offset <= t ? null : {
|
|
328
304
|
date: r,
|
|
329
305
|
start: t,
|
|
330
306
|
stop: n.offset
|
|
331
307
|
};
|
|
332
308
|
}
|
|
333
|
-
function
|
|
309
|
+
function Qe(e, t) {
|
|
334
310
|
let n = /\d/u.exec(e.slice(t));
|
|
335
311
|
if (!n) return null;
|
|
336
312
|
let r = t + n.index;
|
|
337
|
-
return e.slice(t, r).trim().length > 0 ? null :
|
|
313
|
+
return e.slice(t, r).trim().length > 0 ? null : Ze(e, r);
|
|
338
314
|
}
|
|
339
|
-
function
|
|
315
|
+
function $e(e) {
|
|
340
316
|
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);
|
|
341
317
|
for (; o !== -1;) {
|
|
342
318
|
let s = e.indexOf(a, o + 15), c = e.slice(o, o + 1400), l = t.exec(c);
|
|
343
319
|
if (l) {
|
|
344
|
-
let e =
|
|
320
|
+
let e = Qe(c, l[0].length);
|
|
345
321
|
e && i.push(e.date);
|
|
346
322
|
}
|
|
347
323
|
let u = n.exec(c);
|
|
348
324
|
if (u) {
|
|
349
325
|
let e = /\barticle\s+\w/iu.exec(c), t = e === null ? c.slice(u[0].length) : c.slice(u[0].length, e.index);
|
|
350
326
|
for (r.lastIndex = 0; r.exec(t) !== null;) {
|
|
351
|
-
let e =
|
|
327
|
+
let e = Qe(t, r.lastIndex);
|
|
352
328
|
e && /^\s+pour\s+les\s+autres\s+dispositions\s+fiscales\b/iu.test(t.slice(e.stop)) && i.push(e.date);
|
|
353
329
|
}
|
|
354
330
|
}
|
|
@@ -356,20 +332,20 @@ function it(e) {
|
|
|
356
332
|
}
|
|
357
333
|
return i;
|
|
358
334
|
}
|
|
359
|
-
function
|
|
360
|
-
let t =
|
|
335
|
+
function et(e) {
|
|
336
|
+
let t = $e(Xe(e).toLowerCase()), n = Array.from(new Set(t));
|
|
361
337
|
return n.length === 1 ? n[0] : void 0;
|
|
362
338
|
}
|
|
363
|
-
function
|
|
339
|
+
function tt(e) {
|
|
364
340
|
return N(e).replace(/[’]/gu, "'").replace(/[‐‑‒–—]/gu, "-").replace(/^(?:(?:article\s+[^:]+|[a-z][.)]|[ivxlcdm]+\.|\d+°)\s*(?:-\s*)?)+/iu, "");
|
|
365
341
|
}
|
|
366
342
|
function F(e) {
|
|
367
343
|
return e?.type === "tag";
|
|
368
344
|
}
|
|
369
|
-
function
|
|
345
|
+
function nt(e, t) {
|
|
370
346
|
return e.html(t) ?? "";
|
|
371
347
|
}
|
|
372
|
-
function
|
|
348
|
+
function rt(e, t) {
|
|
373
349
|
let n = [], r = /* @__PURE__ */ new Set();
|
|
374
350
|
for (let i of e(t).find("a").get()) {
|
|
375
351
|
let a = e(i).attr("href") ?? "", o = /\/legifrance\/(articles|sections|textes)\/([^?#"]+)/u.exec(a);
|
|
@@ -380,40 +356,40 @@ function ct(e, t) {
|
|
|
380
356
|
let u = M(e(i).text());
|
|
381
357
|
n.push({
|
|
382
358
|
id: c,
|
|
383
|
-
...
|
|
359
|
+
...it(e, t, i) ? { insideFrenchQuotes: !0 } : {},
|
|
384
360
|
...u ? { text: u } : {},
|
|
385
361
|
type: s
|
|
386
362
|
});
|
|
387
363
|
}
|
|
388
364
|
return n;
|
|
389
365
|
}
|
|
390
|
-
function
|
|
391
|
-
let r =
|
|
366
|
+
function it(e, t, n) {
|
|
367
|
+
let r = at(e, t, n);
|
|
392
368
|
return (r.match(/«/gu) ?? []).length > (r.match(/»/gu) ?? []).length;
|
|
393
369
|
}
|
|
394
|
-
function
|
|
370
|
+
function at(e, t, n) {
|
|
395
371
|
if (t === n) return "";
|
|
396
372
|
if (t.type === "text") return t.data ?? "";
|
|
397
373
|
if (!F(t)) return "";
|
|
398
374
|
let r = "";
|
|
399
375
|
for (let i of e(t).contents().get()) {
|
|
400
376
|
if (i === n) return r;
|
|
401
|
-
if (F(i) && e.contains(i, n)) return r +
|
|
377
|
+
if (F(i) && e.contains(i, n)) return r + at(e, i, n);
|
|
402
378
|
r += e(i).text();
|
|
403
379
|
}
|
|
404
380
|
return r;
|
|
405
381
|
}
|
|
406
|
-
function
|
|
382
|
+
function ot(e, t) {
|
|
407
383
|
return t.map((t) => M(e(t).text())).filter(Boolean).join("\n");
|
|
408
384
|
}
|
|
409
|
-
function
|
|
385
|
+
function st(e) {
|
|
410
386
|
let t = N(e);
|
|
411
|
-
return !t ||
|
|
387
|
+
return !t || Be.test(t) ? "noise" : l.test(e) ? "directive_candidate" : "context";
|
|
412
388
|
}
|
|
413
|
-
async function
|
|
389
|
+
async function ct(e, t, n) {
|
|
414
390
|
if (n === void 0) throw Error("A document date is required to add links to legal references.");
|
|
415
391
|
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.");
|
|
416
|
-
let r = t.legiResolver ?? new
|
|
392
|
+
let r = t.legiResolver ?? new ie(t.canutesDb), { output: i } = await ne({
|
|
417
393
|
date: n,
|
|
418
394
|
html: e,
|
|
419
395
|
includeInternalArticleLinks: t.includeInternalArticleLinks,
|
|
@@ -426,11 +402,11 @@ async function pt(e, t, n) {
|
|
|
426
402
|
});
|
|
427
403
|
return i ?? e;
|
|
428
404
|
}
|
|
429
|
-
function
|
|
405
|
+
function lt(e, t) {
|
|
430
406
|
let n = e(t).closest("h1,h2,h3,h4,h5,h6,p,td,th").get(0), r = e(t).closest("table").get(0);
|
|
431
407
|
return F(r) && F(n) && e(n).parents("table").get(0) === r ? r : F(n) ? n : t;
|
|
432
408
|
}
|
|
433
|
-
function
|
|
409
|
+
function ut(e, t, n, r) {
|
|
434
410
|
if (t.has(r.container)) return;
|
|
435
411
|
let i = r.id ?? P(r.num ?? r.label);
|
|
436
412
|
n.has(i) || (n.add(i), t.add(r.container), e.push({
|
|
@@ -451,54 +427,54 @@ function I(e) {
|
|
|
451
427
|
function L(e, t) {
|
|
452
428
|
return e.get(t) ?? 2 ** 53 - 1;
|
|
453
429
|
}
|
|
454
|
-
function
|
|
430
|
+
function dt(e) {
|
|
455
431
|
let t = [], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
456
|
-
e("a[id], span[id], h1[id], h2[id], h3[id], h4[id], h5[id], h6[id]").each((
|
|
457
|
-
if (
|
|
458
|
-
let
|
|
459
|
-
if (!
|
|
460
|
-
let
|
|
461
|
-
if (!
|
|
462
|
-
let
|
|
463
|
-
|
|
464
|
-
id:
|
|
465
|
-
...
|
|
466
|
-
element:
|
|
467
|
-
container:
|
|
432
|
+
e("a[id], span[id], h1[id], h2[id], h3[id], h4[id], h5[id], h6[id]").each((a, o) => {
|
|
433
|
+
if (He(e, o)) return;
|
|
434
|
+
let s = i(M(e(o).text()));
|
|
435
|
+
if (!s) return;
|
|
436
|
+
let c = e(o).attr("id");
|
|
437
|
+
if (!c || r.has(c)) return;
|
|
438
|
+
let l = lt(e, o);
|
|
439
|
+
ut(t, n, r, {
|
|
440
|
+
id: c,
|
|
441
|
+
...s,
|
|
442
|
+
element: o,
|
|
443
|
+
container: l
|
|
468
444
|
});
|
|
469
|
-
}), e("h1:not([id]), h2:not([id]), h3:not([id]), h4:not([id]), h5:not([id]), h6:not([id])").each((
|
|
470
|
-
if (n.has(
|
|
471
|
-
let
|
|
472
|
-
|
|
473
|
-
...
|
|
474
|
-
element:
|
|
475
|
-
container:
|
|
445
|
+
}), e("h1:not([id]), h2:not([id]), h3:not([id]), h4:not([id]), h5:not([id]), h6:not([id])").each((a, o) => {
|
|
446
|
+
if (n.has(o)) return;
|
|
447
|
+
let s = i(M(e(o).text()));
|
|
448
|
+
s && ut(t, n, r, {
|
|
449
|
+
...s,
|
|
450
|
+
element: o,
|
|
451
|
+
container: o
|
|
476
452
|
});
|
|
477
453
|
});
|
|
478
|
-
let
|
|
479
|
-
return t.sort((e, t) => L(
|
|
454
|
+
let a = I(e);
|
|
455
|
+
return t.sort((e, t) => L(a, e.container) - L(a, t.container)), t;
|
|
480
456
|
}
|
|
481
|
-
function
|
|
482
|
-
if (
|
|
457
|
+
function ft(e, t) {
|
|
458
|
+
if (He(e, t)) return !1;
|
|
483
459
|
let n = t.tagName?.toLowerCase();
|
|
484
460
|
if (n !== "p") return /^h[1-6]$/u.test(n ?? "");
|
|
485
461
|
let r = e(t).attr("style") ?? "", i = e(t).html() ?? "";
|
|
486
462
|
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));
|
|
487
463
|
}
|
|
488
|
-
function
|
|
464
|
+
function pt(e) {
|
|
489
465
|
let t = [], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
490
|
-
return e("p.assnat9ArticleNum,h1,h2,h3,h4,h5,h6,p").each((
|
|
491
|
-
if (
|
|
492
|
-
let
|
|
493
|
-
|
|
494
|
-
...
|
|
495
|
-
element:
|
|
496
|
-
container:
|
|
466
|
+
return e("p.assnat9ArticleNum,h1,h2,h3,h4,h5,h6,p").each((a, o) => {
|
|
467
|
+
if (He(e, o) || !e(o).hasClass("assnat9ArticleNum") && !ft(e, o)) return;
|
|
468
|
+
let s = i(e(o).text());
|
|
469
|
+
s && ut(t, n, r, {
|
|
470
|
+
...s,
|
|
471
|
+
element: o,
|
|
472
|
+
container: o
|
|
497
473
|
});
|
|
498
474
|
}), t;
|
|
499
475
|
}
|
|
500
|
-
function
|
|
501
|
-
let t =
|
|
476
|
+
function mt(e) {
|
|
477
|
+
let t = Ve(e ?? "").replace(/[()]/gu, "").trim();
|
|
502
478
|
if (!t || t.toLowerCase() === "liminaire") return;
|
|
503
479
|
if (t.toLowerCase() === "unique") return {
|
|
504
480
|
base: 1,
|
|
@@ -507,7 +483,7 @@ function yt(e) {
|
|
|
507
483
|
};
|
|
508
484
|
let n = /^(\d+|premier)(?:\s+([a-z]+))?(?:\s+([A-Z]+))?$/u.exec(t);
|
|
509
485
|
if (!n) return;
|
|
510
|
-
let r = n[1] === "premier" ? 1 : Number.parseInt(n[1], 10), i = n[2], a = i === void 0 ? 0 :
|
|
486
|
+
let r = n[1] === "premier" ? 1 : Number.parseInt(n[1], 10), i = n[2], a = i === void 0 ? 0 : gt(i);
|
|
511
487
|
if (a !== void 0) return {
|
|
512
488
|
base: r,
|
|
513
489
|
suffixOrder: a,
|
|
@@ -515,7 +491,7 @@ function yt(e) {
|
|
|
515
491
|
text: t
|
|
516
492
|
};
|
|
517
493
|
}
|
|
518
|
-
function
|
|
494
|
+
function ht(e, t) {
|
|
519
495
|
if (t.base !== e.base) return t.base - e.base;
|
|
520
496
|
if (t.suffixOrder !== e.suffixOrder) return t.suffixOrder - e.suffixOrder;
|
|
521
497
|
for (let n = 0; n <= Math.max(e.letters?.length ?? 0, t.letters?.length ?? 0); n++) {
|
|
@@ -524,14 +500,14 @@ function bt(e, t) {
|
|
|
524
500
|
}
|
|
525
501
|
return 0;
|
|
526
502
|
}
|
|
527
|
-
function
|
|
528
|
-
let t = new D(e), n =
|
|
503
|
+
function gt(e) {
|
|
504
|
+
let t = new D(e), n = ye(t);
|
|
529
505
|
if (!(n === void 0 || t.offset !== e.length) && !(typeof n != "object" || !n || !("value" in n) || typeof n.value != "number")) return n.value - 1;
|
|
530
506
|
}
|
|
531
|
-
function
|
|
507
|
+
function _t(e) {
|
|
532
508
|
let t = [], n = e.map((e) => ({
|
|
533
509
|
heading: e,
|
|
534
|
-
token:
|
|
510
|
+
token: mt(e.num)
|
|
535
511
|
}));
|
|
536
512
|
n.filter(({ token: e }) => e?.text === "unique").length > 0 && e.length > 1 && t.push({
|
|
537
513
|
code: "article_toc_out_of_order",
|
|
@@ -540,7 +516,7 @@ function St(e) {
|
|
|
540
516
|
let r;
|
|
541
517
|
for (let { heading: e, token: i } of n) if (!(i === void 0 || i.text === "unique")) {
|
|
542
518
|
if (r !== void 0) {
|
|
543
|
-
let n =
|
|
519
|
+
let n = ht(r, i);
|
|
544
520
|
n === 0 ? t.push({
|
|
545
521
|
code: "article_toc_duplicate_number",
|
|
546
522
|
message: `Article ${e.num ?? e.label} is repeated`,
|
|
@@ -569,13 +545,13 @@ function St(e) {
|
|
|
569
545
|
}
|
|
570
546
|
return t;
|
|
571
547
|
}
|
|
572
|
-
function
|
|
573
|
-
let t =
|
|
548
|
+
function vt(e) {
|
|
549
|
+
let t = _t(e);
|
|
574
550
|
t.length > 0 && process.env.TISSEUSE_WARN_ASSEMBLEE_HEADING_SEQUENCE === "1" && console.warn("Incoherent Assemblée article heading sequence", { issues: t.map((e) => e.message) });
|
|
575
551
|
}
|
|
576
|
-
function
|
|
577
|
-
let n =
|
|
578
|
-
if (n.length === 0) return t &&
|
|
552
|
+
function yt(e, { warn: t = !0 } = {}) {
|
|
553
|
+
let n = dt(e), r = pt(e);
|
|
554
|
+
if (n.length === 0) return t && vt(r), r;
|
|
579
555
|
let i = I(e), a = (e, t) => {
|
|
580
556
|
let n = new Set(e.map((e) => e.container)), r = new Set(e.map((e) => P(e.num ?? e.label)));
|
|
581
557
|
for (let i of t) {
|
|
@@ -583,10 +559,10 @@ function wt(e, { warn: t = !0 } = {}) {
|
|
|
583
559
|
n.has(i.container) || r.has(t) || (n.add(i.container), r.add(t), e.push(i));
|
|
584
560
|
}
|
|
585
561
|
return e.sort((e, t) => L(i, e.container) - L(i, t.container)), e;
|
|
586
|
-
}, o = r.filter((t) => e(t.element).is("p.assnat9ArticleNum,h1,h2,h3,h4,h5,h6")), s = a([...n], o), c = a([...s], r.filter((e) => !o.includes(e))), l = s.length >= 2 &&
|
|
587
|
-
return t &&
|
|
562
|
+
}, o = r.filter((t) => e(t.element).is("p.assnat9ArticleNum,h1,h2,h3,h4,h5,h6")), s = a([...n], o), c = a([...s], r.filter((e) => !o.includes(e))), l = s.length >= 2 && _t(c).length > _t(s).length ? s : c;
|
|
563
|
+
return t && vt(l), l;
|
|
588
564
|
}
|
|
589
|
-
function
|
|
565
|
+
function bt(e) {
|
|
590
566
|
let t = e.next;
|
|
591
567
|
for (; t !== null;) {
|
|
592
568
|
if (F(t)) return t;
|
|
@@ -594,27 +570,27 @@ function Tt(e) {
|
|
|
594
570
|
}
|
|
595
571
|
return null;
|
|
596
572
|
}
|
|
597
|
-
function
|
|
573
|
+
function xt(e, t, n) {
|
|
598
574
|
let r = e(t.container);
|
|
599
575
|
if (!r.is("p.assnat9ArticleNum")) return;
|
|
600
|
-
let
|
|
601
|
-
if (!
|
|
602
|
-
let
|
|
603
|
-
if (
|
|
604
|
-
let
|
|
605
|
-
if (
|
|
606
|
-
let
|
|
607
|
-
if (!(
|
|
576
|
+
let a = r.parent(), o = a.parent();
|
|
577
|
+
if (!a.is("div") || a.children().length !== 1 || !o.is("div")) return;
|
|
578
|
+
let s = o.children().get();
|
|
579
|
+
if (s.length !== 3 && s.length !== 4 || s[0] !== a.get(0) || s[1]?.tagName !== "span" || M(e(s[1]).text()) !== "") return;
|
|
580
|
+
let c = s.length === 4 ? s[2] : void 0;
|
|
581
|
+
if (c !== void 0 && (c.tagName !== "p" || !e(c).hasClass("assnat9ArticleNum") || !/^\(non modifié\)$/iu.test(M(e(c).text())))) return;
|
|
582
|
+
let l = s.at(-1);
|
|
583
|
+
if (!(l.tagName !== "div" || n !== void 0 && e.contains(l, n.container) || e(l).find("p.assnat9ArticleNum,h1,h2,h3,h4,h5,h6").toArray().some((t) => i(e(t).text()) !== null))) return [
|
|
608
584
|
t.container,
|
|
609
|
-
...
|
|
610
|
-
|
|
585
|
+
...c === void 0 ? [] : [c],
|
|
586
|
+
l
|
|
611
587
|
];
|
|
612
588
|
}
|
|
613
|
-
function
|
|
589
|
+
function St(e, t, n, r = I(e)) {
|
|
614
590
|
let i = [t.container], a = n?.container;
|
|
615
|
-
for (let e =
|
|
591
|
+
for (let e = bt(t.container); e !== null && e !== a; e = bt(e)) i.push(e);
|
|
616
592
|
if (i.length > 1) return i;
|
|
617
|
-
let o =
|
|
593
|
+
let o = xt(e, t, n);
|
|
618
594
|
if (o !== void 0) return o;
|
|
619
595
|
let s = L(r, t.container), c = a ? L(r, a) : -1;
|
|
620
596
|
return e("body > *").get().filter((e) => {
|
|
@@ -622,7 +598,7 @@ function Dt(e, t, n, r = I(e)) {
|
|
|
622
598
|
return t >= s && (c === -1 || t < c);
|
|
623
599
|
});
|
|
624
600
|
}
|
|
625
|
-
function
|
|
601
|
+
function Ct(e, t) {
|
|
626
602
|
let n = [], r = /* @__PURE__ */ new Set();
|
|
627
603
|
for (let i of t) {
|
|
628
604
|
let t = "p,li,table", a = e(i).is(t) ? [i] : e(i).find(t).get();
|
|
@@ -630,63 +606,63 @@ function Ot(e, t) {
|
|
|
630
606
|
}
|
|
631
607
|
return n;
|
|
632
608
|
}
|
|
633
|
-
function
|
|
609
|
+
function wt(e, t, n) {
|
|
634
610
|
let r = [], i = !1;
|
|
635
|
-
for (let a of
|
|
636
|
-
let n = e(a).is("table.akn-quoted-table") ?
|
|
611
|
+
for (let a of Ct(e, n)) {
|
|
612
|
+
let n = e(a).is("table.akn-quoted-table") ? fn(e, a) : M(e(a).text());
|
|
637
613
|
if (!n) continue;
|
|
638
|
-
|
|
639
|
-
let o = i ? "noise" :
|
|
614
|
+
Be.test(n) && (i = !0);
|
|
615
|
+
let o = i ? "noise" : st(n), s = `${t}-b${r.length + 1}`;
|
|
640
616
|
e(a).attr("data-pjl-parsed-article-id", t), e(a).attr("data-pjl-parsed-block-id", s), r.push({
|
|
641
617
|
id: s,
|
|
642
618
|
articleId: t,
|
|
643
619
|
kind: o,
|
|
644
|
-
links:
|
|
620
|
+
links: rt(e, a),
|
|
645
621
|
text: n,
|
|
646
|
-
html:
|
|
622
|
+
html: nt(e, a)
|
|
647
623
|
});
|
|
648
624
|
}
|
|
649
625
|
return r;
|
|
650
626
|
}
|
|
651
|
-
function
|
|
627
|
+
function Tt(e, t) {
|
|
652
628
|
if (t.length === 0) return e;
|
|
653
629
|
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>`;
|
|
654
630
|
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}`;
|
|
655
631
|
}
|
|
656
|
-
function
|
|
657
|
-
let t =
|
|
658
|
-
for (let e of
|
|
632
|
+
function Et(e) {
|
|
633
|
+
let t = y(e), n = Dt(t);
|
|
634
|
+
for (let e of yt(t, { warn: !1 })) {
|
|
659
635
|
let r = P(e.num ?? e.label.replace(/^Article\s+/iu, "")), i = t(e.element), a = i.attr("id");
|
|
660
636
|
if (a !== r) {
|
|
661
|
-
if (a?.startsWith("_Toc") && !
|
|
637
|
+
if (a?.startsWith("_Toc") && !kt(n, a, e.element)) {
|
|
662
638
|
let e = t("<span></span>").attr("id", a);
|
|
663
639
|
i.before(e);
|
|
664
640
|
let r = e.get(0);
|
|
665
641
|
F(r) && R(n, a, r);
|
|
666
642
|
}
|
|
667
|
-
a &&
|
|
643
|
+
a && Ot(n, a, e.element), i.attr("id", r), R(n, r, e.element);
|
|
668
644
|
}
|
|
669
645
|
}
|
|
670
|
-
let r =
|
|
646
|
+
let r = yt(t), i = I(t);
|
|
671
647
|
for (let [e, a] of r.entries()) {
|
|
672
|
-
let o =
|
|
648
|
+
let o = St(t, a, r[e + 1], i).flatMap((e) => t(e).is("span.alinea[data-alinea]") ? [e] : t(e).find("span.alinea[data-alinea]").get());
|
|
673
649
|
for (let e of o) {
|
|
674
650
|
let r = t(e).attr("data-alinea")?.trim();
|
|
675
651
|
if (!r) continue;
|
|
676
652
|
let i = `${a.id}-alinea-${r.replace(/\s+/gu, "")}`;
|
|
677
|
-
if (
|
|
653
|
+
if (kt(n, i, e)) continue;
|
|
678
654
|
let o = t(e).attr("id");
|
|
679
655
|
if (o && o !== i) {
|
|
680
656
|
let r = t("<span></span>").attr("id", i);
|
|
681
657
|
t(e).before(r);
|
|
682
658
|
let a = r.get(0);
|
|
683
659
|
F(a) && R(n, i, a);
|
|
684
|
-
} else o &&
|
|
660
|
+
} else o && Ot(n, o, e), t(e).attr("id", i), R(n, i, e);
|
|
685
661
|
}
|
|
686
662
|
}
|
|
687
663
|
return t.html();
|
|
688
664
|
}
|
|
689
|
-
function
|
|
665
|
+
function Dt(e) {
|
|
690
666
|
let t = /* @__PURE__ */ new Map();
|
|
691
667
|
for (let n of e("[id]").get()) {
|
|
692
668
|
let r = e(n).attr("id");
|
|
@@ -698,29 +674,29 @@ function R(e, t, n) {
|
|
|
698
674
|
let r = e.get(t);
|
|
699
675
|
r === void 0 && (r = /* @__PURE__ */ new Set(), e.set(t, r)), r.add(n);
|
|
700
676
|
}
|
|
701
|
-
function
|
|
677
|
+
function Ot(e, t, n) {
|
|
702
678
|
let r = e.get(t);
|
|
703
679
|
r !== void 0 && (r.delete(n), r.size === 0 && e.delete(t));
|
|
704
680
|
}
|
|
705
|
-
function
|
|
681
|
+
function kt(e, t, n) {
|
|
706
682
|
for (let r of e.get(t) ?? []) if (r !== n) return !0;
|
|
707
683
|
return !1;
|
|
708
684
|
}
|
|
709
|
-
function
|
|
710
|
-
let n =
|
|
685
|
+
function At(e, t) {
|
|
686
|
+
let n = tt("sourceText" in t ? t.sourceText : "");
|
|
711
687
|
if (n) return e.filter((e) => e.kind === "directive_candidate").find((e) => {
|
|
712
|
-
let t =
|
|
688
|
+
let t = tt(e.text);
|
|
713
689
|
return t.length > 0 && (n.includes(t) || t.includes(n));
|
|
714
690
|
});
|
|
715
691
|
}
|
|
716
|
-
function
|
|
692
|
+
function jt(e, t) {
|
|
717
693
|
if (t) return t.blockIds.map((t) => e.get(t)).find((e) => e?.kind === "directive_candidate");
|
|
718
694
|
}
|
|
719
|
-
function
|
|
695
|
+
function Mt(e) {
|
|
720
696
|
return e?.links.filter((t) => !t.insideFrenchQuotes && (t.type === "article" || t.type === "division") && t.id !== e.qualifiedVersion?.modifyingArticleId).map((e) => e.id) ?? [];
|
|
721
697
|
}
|
|
722
|
-
function
|
|
723
|
-
let t =
|
|
698
|
+
function Nt(e) {
|
|
699
|
+
let t = ze(e.text);
|
|
724
700
|
if (t.length !== 1) return;
|
|
725
701
|
let n = e.links.filter((e) => e.type === "article" && !e.insideFrenchQuotes), r = n.filter((n) => {
|
|
726
702
|
let r = n.text ?? "", i = e.text.indexOf(r);
|
|
@@ -734,21 +710,21 @@ function Rt(e) {
|
|
|
734
710
|
modifyingArticleLabel: i.text ?? ""
|
|
735
711
|
};
|
|
736
712
|
}
|
|
737
|
-
function
|
|
713
|
+
function Pt(e, t) {
|
|
738
714
|
let n = M(e);
|
|
739
715
|
if (!n) return;
|
|
740
|
-
let r =
|
|
716
|
+
let r = re(n);
|
|
741
717
|
return r ? r.level : n.endsWith(":") ? (t ?? -1) + 1 : void 0;
|
|
742
718
|
}
|
|
743
|
-
function
|
|
744
|
-
let t = /* @__PURE__ */ new Map(), n = [], r =
|
|
719
|
+
function Ft(e) {
|
|
720
|
+
let t = /* @__PURE__ */ new Map(), n = [], r = te(e.map((e) => e.text)), i = -1;
|
|
745
721
|
for (let [a, o] of e.entries()) {
|
|
746
722
|
let e = r.get(a);
|
|
747
723
|
if (e && (i = e.endIndex), a <= i) {
|
|
748
724
|
t.set(o.id, [...n.map((e) => e.block), o]);
|
|
749
725
|
continue;
|
|
750
726
|
}
|
|
751
|
-
let s =
|
|
727
|
+
let s = Pt(o.text, n.at(-1)?.level);
|
|
752
728
|
if (s === void 0) {
|
|
753
729
|
t.set(o.id, [...n.map((e) => e.block), o]);
|
|
754
730
|
continue;
|
|
@@ -761,14 +737,14 @@ function Bt(e) {
|
|
|
761
737
|
}
|
|
762
738
|
return t;
|
|
763
739
|
}
|
|
764
|
-
function
|
|
740
|
+
function It(e, t) {
|
|
765
741
|
let n = [], r = /* @__PURE__ */ new Set();
|
|
766
742
|
for (let i of [...e ?? [], ...t]) i !== void 0 && (r.has(i.id) || (r.add(i.id), n.push(i)));
|
|
767
743
|
return n;
|
|
768
744
|
}
|
|
769
|
-
function
|
|
745
|
+
function Lt(e, t, n) {
|
|
770
746
|
if (!t) return;
|
|
771
|
-
let r =
|
|
747
|
+
let r = It(e, t.blockIds.map((e) => n.get(e)).filter((e) => e !== void 0));
|
|
772
748
|
if (r.length === 0) return;
|
|
773
749
|
let i = r.map((e) => e.id);
|
|
774
750
|
if (i.length === t.blockIds.length && i.every((e, n) => e === t.blockIds[n])) return;
|
|
@@ -783,7 +759,7 @@ function Ht(e, t, n) {
|
|
|
783
759
|
}
|
|
784
760
|
};
|
|
785
761
|
}
|
|
786
|
-
function
|
|
762
|
+
function Rt(e) {
|
|
787
763
|
let t = [], n = 0;
|
|
788
764
|
for (let r of e.blocks) {
|
|
789
765
|
let i = e.directiveText.indexOf(r.text, n);
|
|
@@ -797,7 +773,7 @@ function Ut(e) {
|
|
|
797
773
|
}
|
|
798
774
|
return t;
|
|
799
775
|
}
|
|
800
|
-
function
|
|
776
|
+
function zt(e, t, n) {
|
|
801
777
|
let { start: r, stop: i } = n.sourcePosition, a = t.filter((e) => e.stop > r && e.start < i);
|
|
802
778
|
if (a.length === 0) return;
|
|
803
779
|
let o = a[0], s = a[a.length - 1], c = o.start, l = s.stop;
|
|
@@ -811,7 +787,7 @@ function Wt(e, t, n) {
|
|
|
811
787
|
}
|
|
812
788
|
};
|
|
813
789
|
}
|
|
814
|
-
function
|
|
790
|
+
function Bt(e, t, n) {
|
|
815
791
|
if (!t) return;
|
|
816
792
|
let r = e.directiveText.indexOf(t.text);
|
|
817
793
|
if (r === -1) return;
|
|
@@ -824,15 +800,15 @@ function Gt(e, t, n) {
|
|
|
824
800
|
stop: a
|
|
825
801
|
};
|
|
826
802
|
}
|
|
827
|
-
function
|
|
828
|
-
let n = performance.now(), r = performance.now(), i =
|
|
803
|
+
function Vt(e, t) {
|
|
804
|
+
let n = performance.now(), r = performance.now(), i = Rt(e), a = performance.now() - r, o = performance.now(), s = new Map(e.blocks.map((e) => [e.id, e])), c = Ft(e.blocks), l = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map(), d = [], f;
|
|
829
805
|
for (let t of e.blocks) {
|
|
830
|
-
t.qualifiedVersion =
|
|
831
|
-
let e =
|
|
806
|
+
t.qualifiedVersion = Nt(t);
|
|
807
|
+
let e = Mt(t);
|
|
832
808
|
(e.length > 0 || t.qualifiedVersion) && (d = e, f = t.qualifiedVersion), l.set(t.id, d), u.set(t.id, f);
|
|
833
809
|
}
|
|
834
|
-
let p = performance.now() - o, m = performance.now(), h = x(), g =
|
|
835
|
-
let n =
|
|
810
|
+
let p = performance.now() - o, m = performance.now(), h = x(), g = le(e.directiveText, t === void 0 ? void 0 : h), _ = performance.now() - m, v = performance.now(), y = g.map((t) => {
|
|
811
|
+
let n = zt(e, i, t), r = jt(s, n) ?? At(e.blocks, t), a = Mt(r), o = a.length > 0 ? a : r?.id === void 0 ? [] : l.get(r.id) ?? [], d = Bt(e, r, t), f = Lt(r?.id === void 0 ? void 0 : c.get(r.id), n, s);
|
|
836
812
|
return {
|
|
837
813
|
articleId: e.id,
|
|
838
814
|
blockId: r?.id,
|
|
@@ -851,13 +827,13 @@ function Kt(e, t) {
|
|
|
851
827
|
...o.length > 0 ? { targetIds: o } : {},
|
|
852
828
|
...r?.id !== void 0 && u.get(r.id) ? { qualifiedVersion: u.get(r.id) } : {}
|
|
853
829
|
};
|
|
854
|
-
}), b = /* @__PURE__ */ new Set(),
|
|
830
|
+
}), b = /* @__PURE__ */ new Set(), S = /* @__PURE__ */ new Map(), C = y.flatMap((e) => {
|
|
855
831
|
let t = e.blockId ? s.get(e.blockId) : void 0;
|
|
856
832
|
if (!t) return [e];
|
|
857
833
|
if (b.has(t.id)) return [];
|
|
858
|
-
let n =
|
|
859
|
-
if (n === void 0 && (n =
|
|
860
|
-
let n = e.directive, r = e.targetIds?.length === 1 && n.kind === "compound" ?
|
|
834
|
+
let n = S.get(t.id);
|
|
835
|
+
if (n === void 0 && (n = Le(t.text, Mt(t), e.directive), S.set(t.id, n)), !n) {
|
|
836
|
+
let n = e.directive, r = e.targetIds?.length === 1 && n.kind === "compound" ? Ie(t.text, n.operations.length) : null;
|
|
861
837
|
return [r ? {
|
|
862
838
|
...e,
|
|
863
839
|
sourceAnnotations: r
|
|
@@ -874,27 +850,27 @@ function Kt(e, t) {
|
|
|
874
850
|
}
|
|
875
851
|
}))
|
|
876
852
|
}];
|
|
877
|
-
}),
|
|
853
|
+
}), ee = performance.now() - v;
|
|
878
854
|
return t?.push({
|
|
879
855
|
actionDirectiveExtraction: h,
|
|
880
856
|
articleId: e.id,
|
|
881
857
|
blockCount: e.blocks.length,
|
|
882
858
|
buildRangesMs: Math.round(a * 10) / 10,
|
|
883
|
-
directiveCount:
|
|
859
|
+
directiveCount: C.length,
|
|
884
860
|
directiveTextSize: e.directiveText.length,
|
|
885
861
|
extractActionDirectivesMs: Math.round(_ * 10) / 10,
|
|
886
|
-
mapDirectivesMs: Math.round(
|
|
862
|
+
mapDirectivesMs: Math.round(ee * 10) / 10,
|
|
887
863
|
prepareBlockIndexesMs: Math.round(p * 10) / 10,
|
|
888
864
|
totalMs: Math.round((performance.now() - n) * 10) / 10
|
|
889
|
-
}),
|
|
865
|
+
}), C;
|
|
890
866
|
}
|
|
891
|
-
function
|
|
867
|
+
function Ht(e) {
|
|
892
868
|
let t = /* @__PURE__ */ new Map(), n = [], r = /* @__PURE__ */ new Set();
|
|
893
869
|
for (let i of e) {
|
|
894
|
-
let e =
|
|
870
|
+
let e = qe(i.directive);
|
|
895
871
|
if (e.length === 0) continue;
|
|
896
872
|
let a = e.map(({ num: e }) => ({
|
|
897
|
-
definitionId: `${i.articleId}:article:${
|
|
873
|
+
definitionId: `${i.articleId}:article:${We(e)}`,
|
|
898
874
|
num: e
|
|
899
875
|
}));
|
|
900
876
|
t.set(i, a);
|
|
@@ -917,13 +893,13 @@ function qt(e) {
|
|
|
917
893
|
definitions: n
|
|
918
894
|
};
|
|
919
895
|
}
|
|
920
|
-
function
|
|
921
|
-
let r = new Map(t.map((e) => [
|
|
896
|
+
function Ut(e, t, n) {
|
|
897
|
+
let r = new Map(t.map((e) => [Ue(e.num), e]));
|
|
922
898
|
return e.map((e) => {
|
|
923
|
-
let t = n.get(e), i = t?.[0], a = [
|
|
899
|
+
let t = n.get(e), i = t?.[0], a = [...Je(e.directive.reference)].map((e) => r.get(Ue(e))).filter((e) => e !== void 0 && e.definitionId !== i?.definitionId)[0], o = a === void 0 ? void 0 : {
|
|
924
900
|
definitionId: a.definitionId,
|
|
925
901
|
num: a.num
|
|
926
|
-
}, s =
|
|
902
|
+
}, s = Ye(e.directive), c = (e.targetIds?.length ?? 0) > 0;
|
|
927
903
|
return {
|
|
928
904
|
...e,
|
|
929
905
|
...i === void 0 ? {} : { createdArticle: i },
|
|
@@ -936,7 +912,7 @@ function Jt(e, t, n) {
|
|
|
936
912
|
};
|
|
937
913
|
});
|
|
938
914
|
}
|
|
939
|
-
function
|
|
915
|
+
function Wt(e) {
|
|
940
916
|
switch (e.kind) {
|
|
941
917
|
case "insert_after":
|
|
942
918
|
case "insert_before": return [e.insertText];
|
|
@@ -954,8 +930,8 @@ function Yt(e) {
|
|
|
954
930
|
default: return [];
|
|
955
931
|
}
|
|
956
932
|
}
|
|
957
|
-
function
|
|
958
|
-
return e.flatMap((e) =>
|
|
933
|
+
function Gt(e) {
|
|
934
|
+
return e.flatMap((e) => Wt(e.directive).filter((e) => /[«»]/u.test(e)).map((t) => ({
|
|
959
935
|
code: "nested_french_quote_in_redaction",
|
|
960
936
|
message: "Écart à la règle légistique détecté : une citation imbriquée dans une rédaction devrait utiliser des guillemets anglais et non des guillemets français.",
|
|
961
937
|
details: {
|
|
@@ -967,18 +943,18 @@ function Xt(e) {
|
|
|
967
943
|
}
|
|
968
944
|
})));
|
|
969
945
|
}
|
|
970
|
-
function
|
|
971
|
-
return
|
|
946
|
+
function Kt(e) {
|
|
947
|
+
return Wt(e).map((t) => ({
|
|
972
948
|
directiveKind: e.kind,
|
|
973
949
|
text: t
|
|
974
950
|
}));
|
|
975
951
|
}
|
|
976
|
-
function
|
|
952
|
+
function qt(e) {
|
|
977
953
|
let t = /* @__PURE__ */ new Set();
|
|
978
954
|
for (let n of e.matchAll(/«[^«»\n]+»/gu)) t.add(n[0]);
|
|
979
955
|
return Array.from(t);
|
|
980
956
|
}
|
|
981
|
-
function
|
|
957
|
+
function Jt(e, t) {
|
|
982
958
|
let n = new Map(e.blocks.map((e) => [e.id, e])), r = t.sourceBlockIds ?? e.blocks.map((e) => e.id), i = [], a = 0;
|
|
983
959
|
for (let e of r) {
|
|
984
960
|
let t = n.get(e);
|
|
@@ -990,11 +966,11 @@ function $t(e, t) {
|
|
|
990
966
|
}
|
|
991
967
|
return i;
|
|
992
968
|
}
|
|
993
|
-
function
|
|
969
|
+
function Yt(e, t, n) {
|
|
994
970
|
return e.find((e) => t >= e.start && n <= e.stop);
|
|
995
971
|
}
|
|
996
|
-
function
|
|
997
|
-
let r =
|
|
972
|
+
function Xt(e, t, n) {
|
|
973
|
+
let r = qt(n), i = r.flatMap((t) => {
|
|
998
974
|
for (let n of e.blocks) {
|
|
999
975
|
let e = n.text.indexOf(t);
|
|
1000
976
|
if (e !== -1) return [{
|
|
@@ -1013,7 +989,7 @@ function tn(e, t, n) {
|
|
|
1013
989
|
e.directiveText
|
|
1014
990
|
].filter((e) => e !== void 0 && e.length > 0), o = a.find((e) => r.some((t) => e.includes(t))) ?? a[0];
|
|
1015
991
|
if (!o) return [];
|
|
1016
|
-
let s =
|
|
992
|
+
let s = Jt(e, t);
|
|
1017
993
|
if (s.length === 0) return [];
|
|
1018
994
|
let c = [], l = 0;
|
|
1019
995
|
for (let e of r) {
|
|
@@ -1021,7 +997,7 @@ function tn(e, t, n) {
|
|
|
1021
997
|
if (t === -1) continue;
|
|
1022
998
|
let n = t + e.length;
|
|
1023
999
|
l = n;
|
|
1024
|
-
let r =
|
|
1000
|
+
let r = Yt(s, t, n);
|
|
1025
1001
|
r && c.push({
|
|
1026
1002
|
blockId: r.block.id,
|
|
1027
1003
|
start: t - r.start,
|
|
@@ -1031,15 +1007,15 @@ function tn(e, t, n) {
|
|
|
1031
1007
|
}
|
|
1032
1008
|
return c;
|
|
1033
1009
|
}
|
|
1034
|
-
function
|
|
1010
|
+
function Zt(e, t) {
|
|
1035
1011
|
let n = new Map(e.map((e) => [e.id, e]));
|
|
1036
1012
|
return t.flatMap((e) => {
|
|
1037
1013
|
let t = n.get(e.articleId);
|
|
1038
|
-
return t ?
|
|
1014
|
+
return t ? Kt(e.directive).filter(({ text: e }) => /[«»]/u.test(e)).map(({ directiveKind: n, text: r }) => ({
|
|
1039
1015
|
articleId: e.articleId,
|
|
1040
1016
|
code: "nested_french_quote_in_redaction",
|
|
1041
1017
|
message: "Écart à la règle légistique détecté : une citation imbriquée dans une rédaction devrait utiliser des guillemets anglais et non des guillemets français.",
|
|
1042
|
-
ranges:
|
|
1018
|
+
ranges: Xt(t, e, r),
|
|
1043
1019
|
severity: "warning",
|
|
1044
1020
|
details: {
|
|
1045
1021
|
blockId: e.blockId,
|
|
@@ -1050,8 +1026,8 @@ function nn(e, t) {
|
|
|
1050
1026
|
})) : [];
|
|
1051
1027
|
});
|
|
1052
1028
|
}
|
|
1053
|
-
function
|
|
1054
|
-
let n = new Map(e.flatMap((e) => [...
|
|
1029
|
+
function Qt(e, t) {
|
|
1030
|
+
let n = new Map(e.flatMap((e) => [...te(e.blocks.map((e) => e.text))].map(([t, n]) => [e.blocks[t].id, {
|
|
1055
1031
|
articleId: e.id,
|
|
1056
1032
|
blockIds: e.blocks.slice(t - 1, n.endIndex + 1).map((e) => e.id),
|
|
1057
1033
|
...n
|
|
@@ -1073,13 +1049,13 @@ function rn(e, t) {
|
|
|
1073
1049
|
}];
|
|
1074
1050
|
});
|
|
1075
1051
|
}
|
|
1076
|
-
function
|
|
1077
|
-
let c = new
|
|
1052
|
+
function $t(e, t, n, r, i, a, o = !0, s) {
|
|
1053
|
+
let c = new Te("parsedBill.buildParsedDocument"), l = i.reduce((e, t) => e + t.blocks.length, 0), u = c.timeSync("buildDirectiveText", () => i.map((e) => e.directiveText).filter(Boolean).join("\n")), d = {
|
|
1078
1054
|
sourceFormat: e,
|
|
1079
1055
|
documentDate: r,
|
|
1080
1056
|
html: t,
|
|
1081
1057
|
htmlWithLinks: n,
|
|
1082
|
-
tableOfContents: a ?? c.timeSync("extractTableOfContents", () =>
|
|
1058
|
+
tableOfContents: a ?? c.timeSync("extractTableOfContents", () => v(u), { inputSize: u.length }),
|
|
1083
1059
|
articles: i
|
|
1084
1060
|
};
|
|
1085
1061
|
if (!o) {
|
|
@@ -1095,14 +1071,14 @@ function an(e, t, n, r, i, a, o = !0, s) {
|
|
|
1095
1071
|
directiveTextSize: u.length
|
|
1096
1072
|
}), e;
|
|
1097
1073
|
}
|
|
1098
|
-
let f = c.timeSync("extractGlobalApplicabilityDate", () =>
|
|
1074
|
+
let f = c.timeSync("extractGlobalApplicabilityDate", () => et(i.map((e) => e.text).join("\n"))), p = [], m = c.timeSync("extractDirectivesFromArticles", () => {
|
|
1099
1075
|
let e = [];
|
|
1100
1076
|
for (let t of i) {
|
|
1101
|
-
let n =
|
|
1077
|
+
let n = Vt(t, c.enabled ? p : void 0);
|
|
1102
1078
|
e.push(...n);
|
|
1103
1079
|
}
|
|
1104
1080
|
return e;
|
|
1105
|
-
}, { count: i.length }), { createdArticlesByDirective: h, definitions: g } = c.timeSync("buildInternalArticleDefinitions", () =>
|
|
1081
|
+
}, { count: i.length }), { createdArticlesByDirective: h, definitions: g } = c.timeSync("buildInternalArticleDefinitions", () => Ht(m), { count: m.length }), _ = c.timeSync("attachInternalArticleMetadata", () => Ut(m, g, h), { count: m.length }), y = c.timeSync("collectNestedFrenchQuoteDiagnostics", () => Gt(_), { count: _.length }), b = [...s ?? [], ...y], x = c.timeSync("collectNestedFrenchQuoteAnnotations", () => [...Zt(i, _), ...Qt(i, _)], { count: _.length }), S = {
|
|
1106
1082
|
...d,
|
|
1107
1083
|
...f ? { globalApplicabilityDate: f } : {},
|
|
1108
1084
|
...g.length > 0 ? { internalArticleDefinitions: g } : {},
|
|
@@ -1194,20 +1170,20 @@ function an(e, t, n, r, i, a, o = !0, s) {
|
|
|
1194
1170
|
}),
|
|
1195
1171
|
directiveTextSize: u.length,
|
|
1196
1172
|
slowDirectiveArticles: p.toSorted((e, t) => t.totalMs - e.totalMs).slice(0, 10)
|
|
1197
|
-
}),
|
|
1173
|
+
}), S;
|
|
1198
1174
|
}
|
|
1199
|
-
function
|
|
1175
|
+
function en(e) {
|
|
1200
1176
|
return { items: e.map((e) => ({
|
|
1201
1177
|
id: e.id,
|
|
1202
1178
|
line: e.title ? `${e.label} : ${e.title}` : e.label,
|
|
1203
1179
|
type: "article"
|
|
1204
1180
|
})) };
|
|
1205
1181
|
}
|
|
1206
|
-
function
|
|
1207
|
-
return Array.from(
|
|
1182
|
+
function tn(e) {
|
|
1183
|
+
return Array.from(ce(e)).filter((e) => e.type === "article").map((e) => N(e.line.split(/[::]/u)[0]));
|
|
1208
1184
|
}
|
|
1209
|
-
function
|
|
1210
|
-
let i =
|
|
1185
|
+
function nn(e, t, n, r) {
|
|
1186
|
+
let i = _t(e), a = new Set(Array.from(n.matchAll(/\s+id=(?:"([^"]+)"|'([^']+)')/gu), (e) => e[1] ?? e[2])), o = Array.from(ce(t)).filter((e) => e.type === "article"), s = e.map((e) => r === "akoma-ntoso" ? e.num ? P(e.num) : y(e.html)("p.TCNumArticle").first().attr("id") ?? P(e.label) : e.id), c = o.map((e) => e.id);
|
|
1211
1187
|
(c.length !== s.length || c.some((e, t) => e !== s[t])) && i.push({
|
|
1212
1188
|
code: "article_toc_source_heading_mismatch",
|
|
1213
1189
|
message: "The table of contents differs from the parsed article headings",
|
|
@@ -1223,8 +1199,8 @@ function cn(e, t, n, r) {
|
|
|
1223
1199
|
});
|
|
1224
1200
|
return i;
|
|
1225
1201
|
}
|
|
1226
|
-
function
|
|
1227
|
-
let r =
|
|
1202
|
+
function rn(e, t, n) {
|
|
1203
|
+
let r = tn(v(e.map((e) => e.directiveText).filter(Boolean).join("\n"))), i = e.map((e) => N(e.label)), a = en(e), o = [...n, ...nn(e, a, t, "assemblee-html")];
|
|
1228
1204
|
if (r.length > 0 && (r.length !== i.length || r.some((e, t) => e !== i[t]))) {
|
|
1229
1205
|
let t = r.findIndex((e, t) => e !== i[t]);
|
|
1230
1206
|
o.push({
|
|
@@ -1248,24 +1224,24 @@ function ln(e, t, n) {
|
|
|
1248
1224
|
tableOfContents: a
|
|
1249
1225
|
};
|
|
1250
1226
|
}
|
|
1251
|
-
async function
|
|
1252
|
-
let n = new
|
|
1227
|
+
async function an(e, t) {
|
|
1228
|
+
let n = new Te("parseAssembleeBillRaw"), r = t.linkedHtml === void 0 ? await n.time("linkAssembleeBillRaw", () => on(e, t)) : void 0, i = n.timeSync("applyArticleAnchorIds", () => Et(t.linkedHtml ?? r.linkedHtml), { inputSize: e.length }), a = n.timeSync("cheerioLoadLinkedHtml", () => y(i)), o = n.timeSync("extractArticleHeadings", () => yt(a)), s = new Set(o.map((e) => e.id)), c = pt(a).filter((e) => !s.has(P(e.num ?? e.label))).map((e) => e.label), l = c.length > 0 ? [{
|
|
1253
1229
|
code: "article_toc_source_heading_mismatch",
|
|
1254
1230
|
message: "Some structural article headings were not retained",
|
|
1255
1231
|
details: { discardedCandidates: c }
|
|
1256
1232
|
}] : [], u = I(a), d = n.timeSync("extractArticlesAndBlocks", () => o.map((e, t) => {
|
|
1257
|
-
let n =
|
|
1233
|
+
let n = St(a, e, o[t + 1], u), r = wt(a, e.id, n), i = r.filter((e) => e.kind !== "noise").map((e) => e.text).join("\n");
|
|
1258
1234
|
return {
|
|
1259
1235
|
id: e.id,
|
|
1260
1236
|
label: e.label,
|
|
1261
1237
|
num: e.num,
|
|
1262
1238
|
title: e.title,
|
|
1263
|
-
text:
|
|
1264
|
-
html: n.map((e) =>
|
|
1239
|
+
text: ot(a, n),
|
|
1240
|
+
html: n.map((e) => nt(a, e)).join("\n"),
|
|
1265
1241
|
directiveText: i,
|
|
1266
1242
|
blocks: r
|
|
1267
1243
|
};
|
|
1268
|
-
}), { count: o.length }), f = n.timeSync("injectHiddenArticleSummary", () =>
|
|
1244
|
+
}), { count: o.length }), f = n.timeSync("injectHiddenArticleSummary", () => Tt(a.html(), d)), { diagnostics: p, tableOfContents: m } = n.timeSync("buildAssembleeTableOfContents", () => rn(d, f, l), { count: d.length }), h = n.timeSync("buildParsedDocument", () => $t("assemblee-html", e, f, t.date, d, m, t.includeDirectiveAnalysis, p));
|
|
1269
1245
|
return h.diagnostics?.length && process.env.TISSEUSE_WARN_PARSED_BILL_DIAGNOSTICS === "1" && console.warn("Assemblée bill parsing diagnostics", h.diagnostics), n.log({
|
|
1270
1246
|
articleCount: h.articles.length,
|
|
1271
1247
|
blockCount: h.articles.reduce((e, t) => e + t.blocks.length, 0),
|
|
@@ -1273,18 +1249,18 @@ async function un(e, t) {
|
|
|
1273
1249
|
targetDirectiveCount: h.directives.filter((e) => e.targetIds !== void 0).length
|
|
1274
1250
|
}), h;
|
|
1275
1251
|
}
|
|
1276
|
-
async function
|
|
1252
|
+
async function on(e, t) {
|
|
1277
1253
|
return {
|
|
1278
1254
|
sourceFormat: "assemblee-html",
|
|
1279
1255
|
documentDate: t.date,
|
|
1280
1256
|
html: e,
|
|
1281
|
-
linkedHtml: await
|
|
1257
|
+
linkedHtml: await ct(e, t, t.date)
|
|
1282
1258
|
};
|
|
1283
1259
|
}
|
|
1284
1260
|
function z(e) {
|
|
1285
1261
|
return e.replace(/&/gu, "&").replace(/</gu, "<").replace(/>/gu, ">").replace(/"/gu, """);
|
|
1286
1262
|
}
|
|
1287
|
-
function
|
|
1263
|
+
function sn(e) {
|
|
1288
1264
|
let t = e;
|
|
1289
1265
|
for (let e = 0; e < 3; e++) {
|
|
1290
1266
|
let e = t;
|
|
@@ -1292,25 +1268,25 @@ function fn(e) {
|
|
|
1292
1268
|
}
|
|
1293
1269
|
return t;
|
|
1294
1270
|
}
|
|
1295
|
-
function
|
|
1271
|
+
function cn(e) {
|
|
1296
1272
|
return /(?:<|&lt;)\/?(?:p|br|span|b|i|u|sup|sub|table|thead|tbody|tr|th|td|ul|ol|li)\b/iu.test(e);
|
|
1297
1273
|
}
|
|
1298
1274
|
function B(e) {
|
|
1299
1275
|
return e.name.replace(/^.*:/u, "");
|
|
1300
1276
|
}
|
|
1301
|
-
function
|
|
1277
|
+
function ln(e, t) {
|
|
1302
1278
|
return t.children.map((t) => V(e, t)).filter(Boolean).join("");
|
|
1303
1279
|
}
|
|
1304
|
-
function
|
|
1305
|
-
return t.children.map((t) => t.type === "text" &&
|
|
1280
|
+
function un(e, t) {
|
|
1281
|
+
return t.children.map((t) => t.type === "text" && cn(t.data) ? sn(t.data) : V(e, t)).filter(Boolean).join("");
|
|
1306
1282
|
}
|
|
1307
1283
|
function V(e, t) {
|
|
1308
1284
|
if (t.type === "text") {
|
|
1309
1285
|
let e = t.data.replace(/\s+\./gu, ".");
|
|
1310
|
-
return
|
|
1286
|
+
return cn(e) ? sn(e) : z(e);
|
|
1311
1287
|
}
|
|
1312
1288
|
if (!F(t)) return "";
|
|
1313
|
-
let n = B(t), r =
|
|
1289
|
+
let n = B(t), r = ln(e, t);
|
|
1314
1290
|
switch (n) {
|
|
1315
1291
|
case "p": return `<p${H(e, t, [
|
|
1316
1292
|
"id",
|
|
@@ -1343,7 +1319,7 @@ function V(e, t) {
|
|
|
1343
1319
|
case "tbody":
|
|
1344
1320
|
case "tr":
|
|
1345
1321
|
case "th":
|
|
1346
|
-
case "td": return
|
|
1322
|
+
case "td": return pn(e, t, n, r);
|
|
1347
1323
|
case "caption": return `<caption${H(e, t, [
|
|
1348
1324
|
"id",
|
|
1349
1325
|
"class",
|
|
@@ -1352,7 +1328,7 @@ function V(e, t) {
|
|
|
1352
1328
|
])}>${r}</caption>`;
|
|
1353
1329
|
case "num": return `<span class="akn-num">${r}</span> `;
|
|
1354
1330
|
case "heading": return `<p class="akn-heading">${r}</p>`;
|
|
1355
|
-
case "content": return
|
|
1331
|
+
case "content": return un(e, t);
|
|
1356
1332
|
case "alinea": return U(e, t, "div", "akn-alinea");
|
|
1357
1333
|
case "article": return U(e, t, "article", "akn-article");
|
|
1358
1334
|
case "blockList":
|
|
@@ -1378,7 +1354,7 @@ function V(e, t) {
|
|
|
1378
1354
|
default: return r;
|
|
1379
1355
|
}
|
|
1380
1356
|
}
|
|
1381
|
-
function
|
|
1357
|
+
function dn(e, t) {
|
|
1382
1358
|
let n = e(t).text();
|
|
1383
1359
|
if (!n.includes("«") || !n.includes("»") || e(t).find("table").length > 0) return;
|
|
1384
1360
|
let r = e(t).find("tr").get().filter((n) => e(n).closest("table").get(0) === t);
|
|
@@ -1394,7 +1370,7 @@ function gn(e, t) {
|
|
|
1394
1370
|
for (let [t, n] of i) e(t).addClass("akn-quote-column"), e(n).addClass("akn-quote-column");
|
|
1395
1371
|
}
|
|
1396
1372
|
}
|
|
1397
|
-
function
|
|
1373
|
+
function fn(e, t) {
|
|
1398
1374
|
let n = e(t).find("td,th").get(), r = e(n.find((t) => e(t).hasClass("akn-quote-column") && /^»\s*;?$/u.test(M(e(t).text())))).text();
|
|
1399
1375
|
return `« ${n.filter((t) => !e(t).hasClass("akn-quote-column")).map((t) => M(e(t).text())).filter(Boolean).join(" ")} »${r.includes(";") ? " ;" : ""}`;
|
|
1400
1376
|
}
|
|
@@ -1408,7 +1384,7 @@ function H(e, t, n, r = {}) {
|
|
|
1408
1384
|
let a = r.style ?? e(t).attr("style");
|
|
1409
1385
|
return a && i.push(`style="${z(a)}"`), i.length > 0 ? ` ${i.join(" ")}` : "";
|
|
1410
1386
|
}
|
|
1411
|
-
function
|
|
1387
|
+
function pn(e, t, n, r) {
|
|
1412
1388
|
return `<${n}${H(e, t, [
|
|
1413
1389
|
"id",
|
|
1414
1390
|
"class",
|
|
@@ -1422,56 +1398,56 @@ function vn(e, t, n, r) {
|
|
|
1422
1398
|
"cellspacing",
|
|
1423
1399
|
"cellpadding",
|
|
1424
1400
|
"style"
|
|
1425
|
-
], { style:
|
|
1401
|
+
], { style: mn(e, t, n) })}>${r}</${n}>`;
|
|
1426
1402
|
}
|
|
1427
|
-
function
|
|
1403
|
+
function mn(e, t, n) {
|
|
1428
1404
|
let r = e(t).attr("style") ?? "";
|
|
1429
|
-
return (n === "td" || n === "th") && /font-weight\s*:\s*bold/iu.test(r) && !/text-align\s*:/iu.test(r) && (r =
|
|
1405
|
+
return (n === "td" || n === "th") && /font-weight\s*:\s*bold/iu.test(r) && !/text-align\s*:/iu.test(r) && (r = hn(r, "text-align", "center")), r || void 0;
|
|
1430
1406
|
}
|
|
1431
|
-
function
|
|
1407
|
+
function hn(e, t, n) {
|
|
1432
1408
|
let r = e.trim();
|
|
1433
1409
|
return `${r}${r && !r.endsWith(";") ? ";" : ""} ${t}: ${n};`.trim();
|
|
1434
1410
|
}
|
|
1435
|
-
function
|
|
1411
|
+
function gn(e, t) {
|
|
1436
1412
|
let n = [M(e(t).children("num").first().text()), M(e(t).children("heading").first().text())].filter(Boolean);
|
|
1437
1413
|
return n.length === 0 ? "" : `<p class="akn-heading">${z(n.join(" "))}</p>`;
|
|
1438
1414
|
}
|
|
1439
|
-
function
|
|
1415
|
+
function _n(e, t) {
|
|
1440
1416
|
if (!t) return !1;
|
|
1441
1417
|
let n = (e) => M(e).replace(/\s+/gu, " ").replace(/\s*[..]\s*(?=[–—-])/gu, " ").trim();
|
|
1442
1418
|
return n(M(e.replace(/<[^>]*>/gu, " ").replace(/ /gu, " ").replace(/ /giu, " ").replace(/–/giu, "–"))).startsWith(n(t));
|
|
1443
1419
|
}
|
|
1444
|
-
function
|
|
1420
|
+
function vn(e) {
|
|
1445
1421
|
let t = z(e);
|
|
1446
1422
|
return `<p data-pastille="${t}" class="pastille"><span aria-label="pastille ${t}" data-pastille="${t}"></span></p>`;
|
|
1447
1423
|
}
|
|
1448
|
-
function
|
|
1449
|
-
return
|
|
1424
|
+
function yn(e, t) {
|
|
1425
|
+
return bn([xn({
|
|
1450
1426
|
content: e,
|
|
1451
1427
|
pastille: t
|
|
1452
1428
|
})]);
|
|
1453
1429
|
}
|
|
1454
|
-
function
|
|
1430
|
+
function bn(e) {
|
|
1455
1431
|
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>`;
|
|
1456
1432
|
}
|
|
1457
|
-
function
|
|
1433
|
+
function xn({ content: e, pastille: t, style: n, contextClass: r }) {
|
|
1458
1434
|
let i = n ? ` style="${z(n)}"` : "", a = r ? ` ${z(r)}` : "";
|
|
1459
|
-
return `<tr${r ? ` class="${z(r)} hideable"` : ""}><td style="overflow: hidden; width: 5.0%;" class="texte-col-0 texte-col-pastille no-right-border"><div class="tableauComparatifCell${a}">${
|
|
1435
|
+
return `<tr${r ? ` class="${z(r)} hideable"` : ""}><td style="overflow: hidden; width: 5.0%;" class="texte-col-0 texte-col-pastille no-right-border"><div class="tableauComparatifCell${a}">${vn(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>`;
|
|
1460
1436
|
}
|
|
1461
|
-
function
|
|
1437
|
+
function Sn({ content: e, style: t, contextClass: n }) {
|
|
1462
1438
|
let r = t ? ` style="${z(t)}"` : "", i = n ? ` ${z(n)}` : "";
|
|
1463
1439
|
return `<tr${n ? ` class="${z(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>`;
|
|
1464
1440
|
}
|
|
1465
|
-
function
|
|
1441
|
+
function Cn(e, t) {
|
|
1466
1442
|
return e(t).attr("data:pastille") ?? e(t).attr("pastille");
|
|
1467
1443
|
}
|
|
1468
|
-
function
|
|
1444
|
+
function wn(e, t) {
|
|
1469
1445
|
return e(t).find("alinea[data\\:pastille],alinea[pastille]").length > 0;
|
|
1470
1446
|
}
|
|
1471
|
-
function
|
|
1447
|
+
function Tn(e, t) {
|
|
1472
1448
|
return e(t).children().get().filter((e) => F(e) ? B(e) === "content" : !1).map((t) => V(e, t)).filter(Boolean).join("\n");
|
|
1473
1449
|
}
|
|
1474
|
-
function
|
|
1450
|
+
function En(e, t) {
|
|
1475
1451
|
let n = [];
|
|
1476
1452
|
return e(t).children().each((t, r) => {
|
|
1477
1453
|
if (!F(r)) return;
|
|
@@ -1479,17 +1455,17 @@ function jn(e, t) {
|
|
|
1479
1455
|
i === "num" || i === "heading" || i === "content" || n.push(V(e, r));
|
|
1480
1456
|
}), n.filter(Boolean);
|
|
1481
1457
|
}
|
|
1482
|
-
function
|
|
1483
|
-
let n = [], r = B(t), i = r === "alinea" ?
|
|
1458
|
+
function Dn(e, t) {
|
|
1459
|
+
let n = [], r = B(t), i = r === "alinea" ? Cn(e, t) : void 0, a = Tn(e, t), o = On(e, t, r, i), s = Pn(e, t);
|
|
1484
1460
|
if (i) {
|
|
1485
|
-
let r = [
|
|
1486
|
-
M(r) && n.push(
|
|
1461
|
+
let r = [_n(a, M(e(t).children("num").first().text())) ? "" : gn(e, t), a].filter(Boolean).join("\n");
|
|
1462
|
+
M(r) && n.push(xn({
|
|
1487
1463
|
content: r,
|
|
1488
1464
|
pastille: i,
|
|
1489
1465
|
style: o,
|
|
1490
1466
|
contextClass: s
|
|
1491
1467
|
}));
|
|
1492
|
-
} else a && n.push(
|
|
1468
|
+
} else a && n.push(Sn({
|
|
1493
1469
|
content: a,
|
|
1494
1470
|
style: o,
|
|
1495
1471
|
contextClass: s
|
|
@@ -1497,80 +1473,80 @@ function Mn(e, t) {
|
|
|
1497
1473
|
for (let r of e(t).children().get()) {
|
|
1498
1474
|
if (!F(r)) continue;
|
|
1499
1475
|
let t = B(r);
|
|
1500
|
-
t === "num" || t === "heading" || t === "content" || (t === "alinea" ||
|
|
1476
|
+
t === "num" || t === "heading" || t === "content" || (t === "alinea" || wn(e, r)) && n.push(...Dn(e, r));
|
|
1501
1477
|
}
|
|
1502
1478
|
return n;
|
|
1503
1479
|
}
|
|
1504
1480
|
function U(e, t, n, r) {
|
|
1505
|
-
let
|
|
1506
|
-
|
|
1481
|
+
let a = B(t), o = e(t).attr("eId") ?? e(t).attr("GUID"), s = Cn(e, t), c = On(e, t, a, s), l = [`<${n} ${[
|
|
1482
|
+
o ? `id="${z(o)}"` : void 0,
|
|
1507
1483
|
`class="${r}"`,
|
|
1508
|
-
|
|
1509
|
-
|
|
1484
|
+
s ? `data-pastille="${z(s)}"` : void 0,
|
|
1485
|
+
c ? `style="${z(c)}"` : void 0
|
|
1510
1486
|
].filter((e) => e !== void 0).join(" ")}>`];
|
|
1511
|
-
if (
|
|
1512
|
-
let r =
|
|
1487
|
+
if (a === "part" || a === "title") {
|
|
1488
|
+
let r = jn(e, t, a), i = Nn(e, t), o = r ? [Sn({
|
|
1513
1489
|
content: r,
|
|
1514
|
-
contextClass:
|
|
1490
|
+
contextClass: i
|
|
1515
1491
|
})] : [], s = () => {
|
|
1516
|
-
o.length !== 0 && (
|
|
1492
|
+
o.length !== 0 && (l.push(An(o)), o = []);
|
|
1517
1493
|
};
|
|
1518
1494
|
return e(t).children().each((t, n) => {
|
|
1519
1495
|
if (!F(n)) return;
|
|
1520
1496
|
let r = B(n);
|
|
1521
1497
|
if (!(r === "num" || r === "heading" || r === "content")) {
|
|
1522
1498
|
if (r === "alinea") {
|
|
1523
|
-
o.push(...
|
|
1499
|
+
o.push(...Dn(e, n));
|
|
1524
1500
|
return;
|
|
1525
1501
|
}
|
|
1526
|
-
s(),
|
|
1502
|
+
s(), l.push(V(e, n));
|
|
1527
1503
|
}
|
|
1528
|
-
}), s(),
|
|
1504
|
+
}), s(), l.push(`</${n}>`), l.join("\n");
|
|
1529
1505
|
}
|
|
1530
|
-
if (
|
|
1531
|
-
let r = M(e(t).children("num").first().text()),
|
|
1506
|
+
if (a === "article") {
|
|
1507
|
+
let r = M(e(t).children("num").first().text()), a = M(e(t).children("heading").first().text()), o = i(r) ?? {
|
|
1532
1508
|
label: r,
|
|
1533
1509
|
num: r
|
|
1534
|
-
},
|
|
1535
|
-
if (
|
|
1536
|
-
let r = [
|
|
1537
|
-
content:
|
|
1538
|
-
contextClass:
|
|
1539
|
-
}), ...
|
|
1540
|
-
|
|
1541
|
-
for (let n of
|
|
1542
|
-
return
|
|
1510
|
+
}, s = `<p class="TCNumArticle as-text toc-article dispositif" id="${z(`_TocArt${(o.num ?? r).replace(/\s+/gu, "")}`)}">${z(o.label)}${a ? ` : ${z(a)}` : ""}</p>`;
|
|
1511
|
+
if (wn(e, t)) {
|
|
1512
|
+
let r = [Sn({
|
|
1513
|
+
content: s,
|
|
1514
|
+
contextClass: In(o.label)
|
|
1515
|
+
}), ...Dn(e, t)];
|
|
1516
|
+
l.push(bn(r));
|
|
1517
|
+
for (let n of En(e, t)) n.includes("akn-pastille-table") || l.push(n);
|
|
1518
|
+
return l.push(`</${n}>`), l.join("\n");
|
|
1543
1519
|
}
|
|
1544
|
-
|
|
1520
|
+
l.push(s);
|
|
1545
1521
|
}
|
|
1546
|
-
let
|
|
1522
|
+
let u = [];
|
|
1547
1523
|
for (let n of ["content", "children"]) e(t).children().each((t, r) => {
|
|
1548
1524
|
if (!F(r)) return;
|
|
1549
1525
|
let i = B(r);
|
|
1550
|
-
i === "num" || i === "heading" || n === "content" && i !== "content" || n === "children" && i === "content" ||
|
|
1526
|
+
i === "num" || i === "heading" || n === "content" && i !== "content" || n === "children" && i === "content" || u.push(V(e, r));
|
|
1551
1527
|
});
|
|
1552
|
-
let
|
|
1553
|
-
if (
|
|
1554
|
-
let n =
|
|
1555
|
-
n &&
|
|
1528
|
+
let d = u.join("\n");
|
|
1529
|
+
if (a !== "article") {
|
|
1530
|
+
let n = _n(d, M(e(t).children("num").first().text())) ? "" : gn(e, t);
|
|
1531
|
+
n && l.push(n);
|
|
1556
1532
|
}
|
|
1557
|
-
return
|
|
1533
|
+
return l.push(s ? yn(d, s) : d), l.push(`</${n}>`), l.join("\n");
|
|
1558
1534
|
}
|
|
1559
|
-
function
|
|
1560
|
-
let i =
|
|
1561
|
-
return !r && n !== "article" && /font-weight\s*:\s*bold/iu.test(i) && !/text-align\s*:/iu.test(i) && (i =
|
|
1535
|
+
function On(e, t, n, r) {
|
|
1536
|
+
let i = kn(e(t).attr("style") ?? "", "font-family");
|
|
1537
|
+
return !r && n !== "article" && /font-weight\s*:\s*bold/iu.test(i) && !/text-align\s*:/iu.test(i) && (i = hn(i, "text-align", "center")), i || void 0;
|
|
1562
1538
|
}
|
|
1563
|
-
function
|
|
1539
|
+
function kn(e, t) {
|
|
1564
1540
|
return e.split(";").map((e) => e.trim()).filter(Boolean).filter((e) => !e.toLowerCase().startsWith(`${t.toLowerCase()}:`)).join(";");
|
|
1565
1541
|
}
|
|
1566
|
-
function
|
|
1542
|
+
function An(e) {
|
|
1567
1543
|
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>`;
|
|
1568
1544
|
}
|
|
1569
|
-
function
|
|
1570
|
-
let r = M(e(t).children("num").first().text()), i = M(e(t).children("heading").first().text()), a =
|
|
1545
|
+
function jn(e, t, n) {
|
|
1546
|
+
let r = M(e(t).children("num").first().text()), i = M(e(t).children("heading").first().text()), a = Mn(n), o = [];
|
|
1571
1547
|
return r && o.push(`<p class="${a.num} as-text dispositif"><span aria-label="">${z(r)}</span></p>`), i && o.push(`<p class="${a.heading} as-text dispositif"><span aria-label="">${z(i)}</span></p>`), o.join("\n");
|
|
1572
1548
|
}
|
|
1573
|
-
function
|
|
1549
|
+
function Mn(e) {
|
|
1574
1550
|
switch (e) {
|
|
1575
1551
|
case "part": return {
|
|
1576
1552
|
num: "TCNumPartie",
|
|
@@ -1594,21 +1570,21 @@ function Ln(e) {
|
|
|
1594
1570
|
};
|
|
1595
1571
|
}
|
|
1596
1572
|
}
|
|
1597
|
-
function
|
|
1598
|
-
let n =
|
|
1573
|
+
function Nn(e, t) {
|
|
1574
|
+
let n = Fn(M(e(t).children("num").first().text()));
|
|
1599
1575
|
if (n) return n;
|
|
1600
1576
|
for (let n of e(t).parents().get()) {
|
|
1601
1577
|
if (!F(n)) continue;
|
|
1602
1578
|
let t = B(n);
|
|
1603
1579
|
if (t !== "title" && t !== "part") continue;
|
|
1604
|
-
let r =
|
|
1580
|
+
let r = Fn(M(e(n).children("num").first().text()));
|
|
1605
1581
|
if (r) return r;
|
|
1606
1582
|
}
|
|
1607
1583
|
}
|
|
1608
|
-
function
|
|
1609
|
-
return
|
|
1584
|
+
function Pn(e, t) {
|
|
1585
|
+
return Nn(e, t);
|
|
1610
1586
|
}
|
|
1611
|
-
function
|
|
1587
|
+
function Fn(e) {
|
|
1612
1588
|
let [t, ...n] = M(e).split(/\s+/u);
|
|
1613
1589
|
if (!t || n.length === 0) return;
|
|
1614
1590
|
let r = t.toLocaleLowerCase("fr-FR");
|
|
@@ -1619,10 +1595,10 @@ function Bn(e) {
|
|
|
1619
1595
|
"section"
|
|
1620
1596
|
].includes(r)) return `${r}-${n.join("_")}`;
|
|
1621
1597
|
}
|
|
1622
|
-
function
|
|
1598
|
+
function In(e) {
|
|
1623
1599
|
return `article-${M(e).replace(/^Article\s+/iu, "").replace(/\s+/gu, "_")} article`;
|
|
1624
1600
|
}
|
|
1625
|
-
function
|
|
1601
|
+
function Ln(e) {
|
|
1626
1602
|
switch (e) {
|
|
1627
1603
|
case "part": return "partie";
|
|
1628
1604
|
case "book": return "livre";
|
|
@@ -1634,38 +1610,38 @@ function Hn(e) {
|
|
|
1634
1610
|
default: return;
|
|
1635
1611
|
}
|
|
1636
1612
|
}
|
|
1637
|
-
function
|
|
1613
|
+
function Rn(e, t) {
|
|
1638
1614
|
return [M(e(t).children("num").first().text()), M(e(t).children("heading").first().text())].filter(Boolean).join(" ");
|
|
1639
1615
|
}
|
|
1640
|
-
function
|
|
1641
|
-
let n = M(e(t).children("num").first().text()), r = M(e(t).children("heading").first().text()),
|
|
1616
|
+
function zn(e, t) {
|
|
1617
|
+
let n = M(e(t).children("num").first().text()), r = M(e(t).children("heading").first().text()), a = i(n) ?? {
|
|
1642
1618
|
label: n,
|
|
1643
1619
|
num: n
|
|
1644
1620
|
};
|
|
1645
1621
|
return {
|
|
1646
|
-
id: `_TocArt${(
|
|
1647
|
-
line: [
|
|
1622
|
+
id: `_TocArt${(a.num ?? n).replace(/\s+/gu, "")}`,
|
|
1623
|
+
line: [a.label, r].filter(Boolean).join(" : "),
|
|
1648
1624
|
type: "article"
|
|
1649
1625
|
};
|
|
1650
1626
|
}
|
|
1651
|
-
function
|
|
1627
|
+
function Bn(e, t) {
|
|
1652
1628
|
e.items.push(...t.items);
|
|
1653
1629
|
}
|
|
1654
|
-
function
|
|
1630
|
+
function Vn(e, t) {
|
|
1655
1631
|
let n = { items: [] };
|
|
1656
1632
|
return e(t).children().each((t, r) => {
|
|
1657
1633
|
if (!F(r)) return;
|
|
1658
1634
|
let i = B(r);
|
|
1659
1635
|
if (i === "article") {
|
|
1660
|
-
n.items.push(
|
|
1636
|
+
n.items.push(zn(e, r));
|
|
1661
1637
|
return;
|
|
1662
1638
|
}
|
|
1663
|
-
let a =
|
|
1639
|
+
let a = Ln(i);
|
|
1664
1640
|
if (!a) {
|
|
1665
|
-
|
|
1641
|
+
Bn(n, Vn(e, r));
|
|
1666
1642
|
return;
|
|
1667
1643
|
}
|
|
1668
|
-
let o =
|
|
1644
|
+
let o = Rn(e, r), s = Vn(e, r);
|
|
1669
1645
|
!o && s.items.length === 0 || n.items.push({
|
|
1670
1646
|
...s,
|
|
1671
1647
|
id: e(r).attr("eId") ?? e(r).attr("GUID"),
|
|
@@ -1674,27 +1650,27 @@ function Kn(e, t) {
|
|
|
1674
1650
|
});
|
|
1675
1651
|
}), n;
|
|
1676
1652
|
}
|
|
1677
|
-
function
|
|
1653
|
+
function Hn(e) {
|
|
1678
1654
|
let t = e("body").first().get(0);
|
|
1679
|
-
return t === void 0 ? { items: [] } :
|
|
1655
|
+
return t === void 0 ? { items: [] } : Vn(e, t);
|
|
1680
1656
|
}
|
|
1681
|
-
function
|
|
1657
|
+
function Un(e) {
|
|
1682
1658
|
return e("FRBRExpression FRBRdate[name=\"#depot\"]").attr("date") ?? e("FRBRWork FRBRdate[name=\"#presentation\"]").attr("date");
|
|
1683
1659
|
}
|
|
1684
|
-
function
|
|
1685
|
-
e("table").each((t, n) =>
|
|
1660
|
+
function Wn(e) {
|
|
1661
|
+
e("table").each((t, n) => dn(e, n));
|
|
1686
1662
|
let t = e("preamble").first(), n = e("body").first(), r = ["<div class=\"akn-bill\">", "<style>.akn-bill p.pastille span:empty::before{content:attr(data-pastille)}</style>"];
|
|
1687
|
-
return t.length > 0 && (r.push("<section class=\"akn-preamble\">"), r.push(
|
|
1663
|
+
return t.length > 0 && (r.push("<section class=\"akn-preamble\">"), r.push(ln(e, t.get(0))), r.push("</section>")), r.push("<section class=\"akn-body\">"), n.children().each((t, n) => {
|
|
1688
1664
|
F(n) && r.push(B(n) === "article" ? U(e, n, "article", "akn-article") : V(e, n));
|
|
1689
1665
|
}), r.push("</section></div>"), r.join("\n");
|
|
1690
1666
|
}
|
|
1691
|
-
function
|
|
1692
|
-
let t =
|
|
1667
|
+
function Gn(e) {
|
|
1668
|
+
let t = y(e, { xml: {
|
|
1693
1669
|
decodeEntities: !1,
|
|
1694
1670
|
lowerCaseTags: !1,
|
|
1695
1671
|
lowerCaseAttributeNames: !1,
|
|
1696
1672
|
xmlMode: !0
|
|
1697
|
-
} }), n =
|
|
1673
|
+
} }), n = Un(t), r = Wn(t);
|
|
1698
1674
|
return {
|
|
1699
1675
|
sourceFormat: "akoma-ntoso",
|
|
1700
1676
|
documentDate: n,
|
|
@@ -1702,42 +1678,42 @@ function Xn(e) {
|
|
|
1702
1678
|
linkedHtml: r
|
|
1703
1679
|
};
|
|
1704
1680
|
}
|
|
1705
|
-
function
|
|
1706
|
-
return
|
|
1681
|
+
function Kn(e) {
|
|
1682
|
+
return qn(y(e));
|
|
1707
1683
|
}
|
|
1708
|
-
function
|
|
1684
|
+
function qn(e) {
|
|
1709
1685
|
let t = [];
|
|
1710
1686
|
return e("article.akn-article").each((n, r) => {
|
|
1711
|
-
let
|
|
1687
|
+
let a = e(r).find("p.TCNumArticle").first().get(0), o = M(a ? e(a).text() : ""), s = i(o) ?? { label: o || `Article ${n + 1}` }, c = e(r).attr("id") ?? `akn-article-${String(n + 1).padStart(3, "0")}`, l = [r], u = wt(e, c, l), d = u.filter((e) => e.kind !== "noise").map((e) => e.text).join("\n");
|
|
1712
1688
|
t.push({
|
|
1713
|
-
id:
|
|
1714
|
-
label:
|
|
1715
|
-
num:
|
|
1716
|
-
title:
|
|
1717
|
-
text:
|
|
1718
|
-
html:
|
|
1719
|
-
directiveText:
|
|
1720
|
-
blocks:
|
|
1689
|
+
id: c,
|
|
1690
|
+
label: s.label,
|
|
1691
|
+
num: s.num,
|
|
1692
|
+
title: s.title,
|
|
1693
|
+
text: ot(e, l),
|
|
1694
|
+
html: nt(e, r),
|
|
1695
|
+
directiveText: d,
|
|
1696
|
+
blocks: u
|
|
1721
1697
|
});
|
|
1722
1698
|
}), t;
|
|
1723
1699
|
}
|
|
1724
|
-
function
|
|
1725
|
-
let t =
|
|
1700
|
+
function Jn(e) {
|
|
1701
|
+
let t = y(e);
|
|
1726
1702
|
return {
|
|
1727
|
-
articles:
|
|
1703
|
+
articles: qn(t),
|
|
1728
1704
|
htmlWithLinks: t.html()
|
|
1729
1705
|
};
|
|
1730
1706
|
}
|
|
1731
|
-
async function
|
|
1732
|
-
let n = new
|
|
1707
|
+
async function Yn(e, t) {
|
|
1708
|
+
let n = new Te("parseAkomaNtosoBillRaw"), r = n.timeSync("cheerioLoadXml", () => y(e, { xml: {
|
|
1733
1709
|
decodeEntities: !1,
|
|
1734
1710
|
lowerCaseTags: !1,
|
|
1735
1711
|
lowerCaseAttributeNames: !1,
|
|
1736
1712
|
xmlMode: !0
|
|
1737
|
-
} })), i = t.date ??
|
|
1713
|
+
} })), i = t.date ?? Un(r), a = n.timeSync("renderAknHtml", () => Wn(r), { inputSize: e.length }), o = t.linkedHtml ?? await n.time("addLinksToRenderedAknHtml", () => ct(a, {
|
|
1738
1714
|
...t,
|
|
1739
1715
|
date: i
|
|
1740
|
-
}, i)), s = n.timeSync("extractRenderedAknArticles", () =>
|
|
1716
|
+
}, i)), s = n.timeSync("extractRenderedAknArticles", () => Kn(a)), c = n.timeSync("injectHiddenArticleSummary", () => Tt(o, s)), { articles: l, htmlWithLinks: u } = n.timeSync("extractLinkedAknArticlesAndTaggedHtml", () => Jn(c)), d = l.length > 0 ? l : s, f = n.timeSync("extractAknTableOfContents", () => Hn(r)), p = n.timeSync("buildParsedDocument", () => $t("akoma-ntoso", a, l.length > 0 ? u : c, i, d, f, t.includeDirectiveAnalysis, nn(d, f, l.length > 0 ? u : c, "akoma-ntoso")));
|
|
1741
1717
|
return n.log({
|
|
1742
1718
|
articleCount: p.articles.length,
|
|
1743
1719
|
blockCount: p.articles.reduce((e, t) => e + t.blocks.length, 0),
|
|
@@ -1745,25 +1721,25 @@ async function er(e, t) {
|
|
|
1745
1721
|
targetDirectiveCount: p.directives.filter((e) => e.targetIds !== void 0).length
|
|
1746
1722
|
}), p;
|
|
1747
1723
|
}
|
|
1748
|
-
async function
|
|
1749
|
-
let n =
|
|
1724
|
+
async function Xn(e, t) {
|
|
1725
|
+
let n = Gn(e), r = t.date ?? n.documentDate;
|
|
1750
1726
|
return {
|
|
1751
1727
|
sourceFormat: "akoma-ntoso",
|
|
1752
1728
|
documentDate: r,
|
|
1753
1729
|
html: n.html,
|
|
1754
|
-
linkedHtml: await
|
|
1730
|
+
linkedHtml: await ct(n.html, t, r)
|
|
1755
1731
|
};
|
|
1756
1732
|
}
|
|
1757
1733
|
//#endregion
|
|
1758
1734
|
//#region src/lib/server/assemblee_document_search.ts
|
|
1759
|
-
var
|
|
1760
|
-
function
|
|
1735
|
+
var Zn = /\bexpos[ée]\s+des\s+motifs\b/giu, Qn = /\barticle\s+(?:premier|1er|\d+)/iu;
|
|
1736
|
+
function $n(e) {
|
|
1761
1737
|
return e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim();
|
|
1762
1738
|
}
|
|
1763
|
-
function
|
|
1764
|
-
let t =
|
|
1739
|
+
function er(e) {
|
|
1740
|
+
let t = $n(y(e).text()), n = [...t.matchAll(Zn)], r = /* @__PURE__ */ new Set(), i = [];
|
|
1765
1741
|
for (let [e, a] of n.entries()) {
|
|
1766
|
-
let o = (a.index ?? 0) + a[0].length, s = t.slice(o), c =
|
|
1742
|
+
let o = (a.index ?? 0) + a[0].length, s = t.slice(o), c = Qn.exec(s), l = $n(s.slice(0, c?.index ?? s.length));
|
|
1767
1743
|
if (l.length < 20 || r.has(l)) continue;
|
|
1768
1744
|
r.add(l);
|
|
1769
1745
|
let u = `expose-des-motifs-${e + 1}`;
|
|
@@ -1779,8 +1755,8 @@ function ar(e) {
|
|
|
1779
1755
|
}
|
|
1780
1756
|
return i;
|
|
1781
1757
|
}
|
|
1782
|
-
async function
|
|
1783
|
-
let i = await
|
|
1758
|
+
async function tr({ date: e, html: t, linkBaseUrl: n, linkType: r }) {
|
|
1759
|
+
let i = await an(t, {
|
|
1784
1760
|
date: e,
|
|
1785
1761
|
includeDirectiveAnalysis: !1,
|
|
1786
1762
|
linkBaseUrl: n,
|
|
@@ -1789,7 +1765,7 @@ async function or({ date: e, html: t, linkBaseUrl: n, linkType: r }) {
|
|
|
1789
1765
|
});
|
|
1790
1766
|
return {
|
|
1791
1767
|
items: [...i.articles.map((e) => {
|
|
1792
|
-
let t =
|
|
1768
|
+
let t = $n(e.directiveText || e.text);
|
|
1793
1769
|
if (t) return {
|
|
1794
1770
|
anchor: e.id,
|
|
1795
1771
|
articleNumber: e.num ?? null,
|
|
@@ -1799,17 +1775,17 @@ async function or({ date: e, html: t, linkBaseUrl: n, linkType: r }) {
|
|
|
1799
1775
|
label: e.label,
|
|
1800
1776
|
title: e.title ?? null
|
|
1801
1777
|
};
|
|
1802
|
-
}).filter((e) => e !== void 0), ...
|
|
1778
|
+
}).filter((e) => e !== void 0), ...er(t)],
|
|
1803
1779
|
tableOfContents: i.tableOfContents
|
|
1804
1780
|
};
|
|
1805
1781
|
}
|
|
1806
|
-
function
|
|
1807
|
-
return
|
|
1782
|
+
function nr(e, t) {
|
|
1783
|
+
return ke("sha256").update(JSON.stringify({
|
|
1808
1784
|
item: e,
|
|
1809
1785
|
metadata: t
|
|
1810
1786
|
})).digest("hex");
|
|
1811
1787
|
}
|
|
1812
|
-
function
|
|
1788
|
+
function rr(e) {
|
|
1813
1789
|
if (typeof e != "object" || !e) return;
|
|
1814
1790
|
let t = e.cycleDeVie?.chrono;
|
|
1815
1791
|
if (t !== void 0) for (let e of [
|
|
@@ -1824,11 +1800,11 @@ function cr(e) {
|
|
|
1824
1800
|
}
|
|
1825
1801
|
//#endregion
|
|
1826
1802
|
//#region src/lib/server/senat_amendment_search.ts
|
|
1827
|
-
function
|
|
1828
|
-
return e?.trim() ?
|
|
1803
|
+
function ir(e) {
|
|
1804
|
+
return e?.trim() ? y(e).text().replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim() : "";
|
|
1829
1805
|
}
|
|
1830
|
-
function
|
|
1831
|
-
let n =
|
|
1806
|
+
function ar({ dispositifHtml: e, objetHtml: t }) {
|
|
1807
|
+
let n = ir(e), r = ir(t);
|
|
1832
1808
|
return [...n ? [{
|
|
1833
1809
|
content: n,
|
|
1834
1810
|
itemKind: "dispositif",
|
|
@@ -1839,8 +1815,8 @@ function ur({ dispositifHtml: e, objetHtml: t }) {
|
|
|
1839
1815
|
label: "Objet"
|
|
1840
1816
|
}] : []];
|
|
1841
1817
|
}
|
|
1842
|
-
function
|
|
1843
|
-
return
|
|
1818
|
+
function or(e, t) {
|
|
1819
|
+
return ke("sha256").update(JSON.stringify({
|
|
1844
1820
|
item: e,
|
|
1845
1821
|
metadata: t
|
|
1846
1822
|
})).digest("hex");
|
|
@@ -1854,25 +1830,25 @@ function W(e, t) {
|
|
|
1854
1830
|
type: "amendment_action_directive"
|
|
1855
1831
|
};
|
|
1856
1832
|
}
|
|
1857
|
-
function
|
|
1833
|
+
function sr(e, t) {
|
|
1858
1834
|
return {
|
|
1859
1835
|
type: e === "start" ? "head_of_target" : "tail_after_target",
|
|
1860
|
-
unit: t ?
|
|
1836
|
+
unit: t ? ue(t) : "article"
|
|
1861
1837
|
};
|
|
1862
1838
|
}
|
|
1863
|
-
function
|
|
1839
|
+
function cr(e) {
|
|
1864
1840
|
return e === "start" ? "insert_before" : "insert_after";
|
|
1865
1841
|
}
|
|
1866
|
-
var
|
|
1842
|
+
var lr = O(E("[\\s\\S]*?(?=supprimer|substituer|remplacer|ins[eé]rer|compl[eé]ter|r[eé]diger)", { flags: "i" }), { default: "" }), G = T(u, w([E("les?\\s+", { flags: "i" }), C], { value: (e) => e[1] }), C, pe), ur = T(w([E("la\\s+fin\\s+de\\s+", { flags: "i" }), G], { value: (e) => {
|
|
1867
1843
|
let t = e[1];
|
|
1868
1844
|
return {
|
|
1869
1845
|
targetReference: t,
|
|
1870
1846
|
targetScope: {
|
|
1871
1847
|
type: "tail_after_target",
|
|
1872
|
-
unit:
|
|
1848
|
+
unit: ue(t)
|
|
1873
1849
|
}
|
|
1874
1850
|
};
|
|
1875
|
-
} }), w([
|
|
1851
|
+
} }), w([n], { value: (e) => ({ targetScope: e[0] }) })), K = O(w([
|
|
1876
1852
|
O(E("(?:[aà]\\s+la\\s+fin\\s+(?:du|de\\s+la|de\\s+l['’]?)\\s*)", { flags: "i" }), { default: "" }),
|
|
1877
1853
|
O(E("(?:au\\s+d[eé]but\\s+d(?:u|e\\s+la|e\\s+l['’]?)\\s*)", { flags: "i" }), { default: "" }),
|
|
1878
1854
|
G,
|
|
@@ -1880,48 +1856,48 @@ var mr = O(E("[\\s\\S]*?(?=supprimer|substituer|remplacer|ins[eé]rer|compl[eé]
|
|
|
1880
1856
|
], { value: (e, t) => ({
|
|
1881
1857
|
reference: e[2],
|
|
1882
1858
|
text: t.text()
|
|
1883
|
-
}) }), { default: null }),
|
|
1859
|
+
}) }), { default: null }), dr = O(E(`(?:(?:[aà]\\s+)?la\\s+(?:derni(?:ère|ere)|${xe})\\s+occurrence\\s+)`, { flags: "i" }), { default: "" });
|
|
1884
1860
|
function q(e) {
|
|
1885
1861
|
return e?.text ?? "";
|
|
1886
1862
|
}
|
|
1887
|
-
function
|
|
1888
|
-
return { citation:
|
|
1863
|
+
function fr(t) {
|
|
1864
|
+
return { citation: e(t.position()) };
|
|
1889
1865
|
}
|
|
1890
|
-
var J = T(w([
|
|
1866
|
+
var J = T(w([g], { value: (e) => ({ citation: e[0] }) }), E("\\S[\\s\\S]*", { value: (e, t) => fr(t) })), pr = E("\\S[\\s\\S]*", { value: (e, t) => fr(t) }), Y = E("[^:«“\"]*(?::\\s*)?", { flags: "i" }), mr = E("\\S[\\s\\S]*?(?=\\s+par\\s+(?:les?\\s+)?(?:mots?|montants?|taux|références?|mentions?|dates?|années?)\\s*:)", {
|
|
1891
1867
|
flags: "i",
|
|
1892
|
-
value: (e, t) =>
|
|
1893
|
-
}),
|
|
1868
|
+
value: (e, t) => fr(t)
|
|
1869
|
+
}), hr = E("\\S[\\s\\S]*?(?=\\s+(?:ins[eé]rer|ajouter|supprimer|r[eé]diger)\\b)", {
|
|
1894
1870
|
flags: "i",
|
|
1895
|
-
value: (e, t) =>
|
|
1896
|
-
}),
|
|
1871
|
+
value: (e, t) => fr(t)
|
|
1872
|
+
}), gr = E("\\S[\\s\\S]*?(?=\\s*(?:(?:[IVXLCDM]+)\\s*[.\\-–—]+\\s*|\\d+°\\s*|[a-z]\\)\\s*|$))", {
|
|
1897
1873
|
flags: "i",
|
|
1898
|
-
value: (e, t) =>
|
|
1899
|
-
}),
|
|
1900
|
-
|
|
1901
|
-
E(`${
|
|
1902
|
-
|
|
1903
|
-
], { value: (e) => e[2] }),
|
|
1904
|
-
|
|
1905
|
-
E(`${
|
|
1906
|
-
T(w([
|
|
1874
|
+
value: (e, t) => fr(t)
|
|
1875
|
+
}), _r = T(w([g], { value: (e) => ({ citation: e[0] }) }), mr), vr = T(w([g], { value: (e) => ({ citation: e[0] }) }), gr), yr = w([E(`${r}s?\\s*:?\\s*`, { flags: "i" }), _r], { value: (e) => e[1] }), br = w([E(`${a}s?(?: suivant(?:e)?s?)?\\s*:?\\s*`, { flags: "i" }), vr], { value: (e) => e[1] }), xr = T(w([g], { value: (e) => ({ citation: e[0] }) }), hr), Sr = w([
|
|
1876
|
+
dr,
|
|
1877
|
+
E(`${r}s?\\s*:?\\s*`, { flags: "i" }),
|
|
1878
|
+
xr
|
|
1879
|
+
], { value: (e) => e[2] }), Cr = w([
|
|
1880
|
+
dr,
|
|
1881
|
+
E(`${r}s?\\s*:?\\s*`, { flags: "i" }),
|
|
1882
|
+
T(w([g], { value: (e) => ({ citation: e[0] }) }), pr)
|
|
1907
1883
|
], { value: (e) => e[2] });
|
|
1908
1884
|
function X(e) {
|
|
1909
1885
|
return e?.reference;
|
|
1910
1886
|
}
|
|
1911
|
-
var
|
|
1887
|
+
var wr = w([lr, E("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e, t) => W(t, {
|
|
1912
1888
|
contextText: e[0],
|
|
1913
1889
|
kind: "delete_article"
|
|
1914
|
-
}) }),
|
|
1890
|
+
}) }), Tr = w([
|
|
1915
1891
|
K,
|
|
1916
1892
|
E("supprimer", { flags: "i" }),
|
|
1917
1893
|
O(w([k, G], { value: (e) => e[1] }), { default: null }),
|
|
1918
|
-
O(w([k,
|
|
1894
|
+
O(w([k, Cr], { value: (e) => e[1] }), { default: null })
|
|
1919
1895
|
], { value: (e, t) => W(t, {
|
|
1920
1896
|
contextText: q(e[0]),
|
|
1921
1897
|
kind: "delete_portion",
|
|
1922
1898
|
targetCitation: e[3]?.citation ?? void 0,
|
|
1923
1899
|
targetReference: e[2] ?? X(e[0])
|
|
1924
|
-
}) }),
|
|
1900
|
+
}) }), Er = w([
|
|
1925
1901
|
K,
|
|
1926
1902
|
T(E("r[eé]diger\\s+ainsi", { flags: "i" }), E("r[eé]tablir", { flags: "i" })),
|
|
1927
1903
|
Y,
|
|
@@ -1931,22 +1907,22 @@ var kr = w([mr, E("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e,
|
|
|
1931
1907
|
kind: "rewrite_portion",
|
|
1932
1908
|
replacementCitation: e[3].citation,
|
|
1933
1909
|
targetReference: X(e[0])
|
|
1934
|
-
}) }),
|
|
1910
|
+
}) }), Dr = w([
|
|
1935
1911
|
K,
|
|
1936
1912
|
T(E("substituer", { flags: "i" }), E("remplacer", { flags: "i" })),
|
|
1937
1913
|
k,
|
|
1938
|
-
|
|
1939
|
-
|
|
1914
|
+
dr,
|
|
1915
|
+
yr,
|
|
1940
1916
|
E("\\s*,?\\s*"),
|
|
1941
1917
|
O(E("par\\s+", { flags: "i" }), { default: "" }),
|
|
1942
|
-
|
|
1918
|
+
br
|
|
1943
1919
|
], { value: (e, t) => W(t, {
|
|
1944
1920
|
contextText: q(e[0]),
|
|
1945
1921
|
kind: "replace",
|
|
1946
1922
|
replacementCitation: e[7].citation,
|
|
1947
1923
|
targetCitation: e[4].citation,
|
|
1948
1924
|
targetReference: X(e[0])
|
|
1949
|
-
}) }),
|
|
1925
|
+
}) }), Or = w([
|
|
1950
1926
|
K,
|
|
1951
1927
|
E("substituer", { flags: "i" }),
|
|
1952
1928
|
k,
|
|
@@ -1959,8 +1935,8 @@ var kr = w([mr, E("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e,
|
|
|
1959
1935
|
kind: "rewrite_portion",
|
|
1960
1936
|
replacementCitation: e[6].citation,
|
|
1961
1937
|
targetReference: e[4] ?? X(e[0])
|
|
1962
|
-
}) }),
|
|
1963
|
-
|
|
1938
|
+
}) }), kr = w([
|
|
1939
|
+
S,
|
|
1964
1940
|
k,
|
|
1965
1941
|
E("l['’ ]article", { flags: "i" }),
|
|
1966
1942
|
E("[\\s\\S]*?(?=ins[eé]rer)", { flags: "i" }),
|
|
@@ -1971,34 +1947,34 @@ var kr = w([mr, E("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e,
|
|
|
1971
1947
|
contextText: "",
|
|
1972
1948
|
insertCitation: e[6].citation,
|
|
1973
1949
|
kind: e[0] === "before" ? "insert_article_before" : "insert_article_after"
|
|
1974
|
-
}) }),
|
|
1975
|
-
|
|
1950
|
+
}) }), Ar = w([
|
|
1951
|
+
S,
|
|
1976
1952
|
k,
|
|
1977
1953
|
G,
|
|
1978
1954
|
E("[\\s\\S]*?(?=ins[eé]rer|ajouter)", { flags: "i" }),
|
|
1979
1955
|
T(E("ins[eé]rer", { flags: "i" }), E("ajouter", { flags: "i" })),
|
|
1980
1956
|
Y,
|
|
1981
1957
|
J
|
|
1982
|
-
], { value: (e,
|
|
1958
|
+
], { value: (e, n) => W(n, {
|
|
1983
1959
|
contextText: "",
|
|
1984
1960
|
insertCitation: e[6].citation,
|
|
1985
|
-
kind:
|
|
1961
|
+
kind: t(e[0]),
|
|
1986
1962
|
targetReference: e[2]
|
|
1987
|
-
}) }),
|
|
1988
|
-
|
|
1963
|
+
}) }), jr = w([
|
|
1964
|
+
S,
|
|
1989
1965
|
k,
|
|
1990
1966
|
E("l['’ ]alin[eé]a", { flags: "i" }),
|
|
1991
1967
|
E("[\\s\\S]*?(?=ins[eé]rer)", { flags: "i" }),
|
|
1992
1968
|
E("ins[eé]rer", { flags: "i" }),
|
|
1993
1969
|
Y,
|
|
1994
1970
|
J
|
|
1995
|
-
], { value: (e,
|
|
1971
|
+
], { value: (e, n) => W(n, {
|
|
1996
1972
|
contextText: "",
|
|
1997
1973
|
insertCitation: e[6].citation,
|
|
1998
|
-
kind:
|
|
1999
|
-
}) }),
|
|
1974
|
+
kind: t(e[0])
|
|
1975
|
+
}) }), Mr = w([
|
|
2000
1976
|
K,
|
|
2001
|
-
|
|
1977
|
+
ee,
|
|
2002
1978
|
E("[\\s\\S]*?(?=ins[eé]rer|ajouter)", { flags: "i" }),
|
|
2003
1979
|
T(E("ins[eé]rer", { flags: "i" }), E("ajouter", { flags: "i" })),
|
|
2004
1980
|
Y,
|
|
@@ -2008,44 +1984,44 @@ var kr = w([mr, E("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e,
|
|
|
2008
1984
|
return W(t, {
|
|
2009
1985
|
contextText: q(n),
|
|
2010
1986
|
insertCitation: e[5].citation,
|
|
2011
|
-
kind:
|
|
1987
|
+
kind: cr(i),
|
|
2012
1988
|
targetReference: r,
|
|
2013
|
-
targetScope:
|
|
1989
|
+
targetScope: sr(i, r)
|
|
2014
1990
|
});
|
|
2015
|
-
} }),
|
|
1991
|
+
} }), Nr = w([
|
|
2016
1992
|
K,
|
|
2017
|
-
|
|
1993
|
+
S,
|
|
2018
1994
|
k,
|
|
2019
|
-
|
|
1995
|
+
Sr,
|
|
2020
1996
|
E("[\\s\\S]*?(?=ins[eé]rer)"),
|
|
2021
1997
|
E("ins[eé]rer", { flags: "i" }),
|
|
2022
1998
|
k,
|
|
2023
|
-
|
|
2024
|
-
], { value: (e,
|
|
1999
|
+
br
|
|
2000
|
+
], { value: (e, n) => W(n, {
|
|
2025
2001
|
contextText: q(e[0]),
|
|
2026
2002
|
insertCitation: e[7].citation,
|
|
2027
|
-
kind:
|
|
2003
|
+
kind: t(e[1]),
|
|
2028
2004
|
targetCitation: e[3].citation,
|
|
2029
2005
|
targetReference: X(e[0])
|
|
2030
|
-
}) }),
|
|
2006
|
+
}) }), Pr = w([
|
|
2031
2007
|
K,
|
|
2032
|
-
|
|
2008
|
+
S,
|
|
2033
2009
|
k,
|
|
2034
2010
|
G,
|
|
2035
2011
|
E("[\\s\\S]*?(?=ins[eé]rer|ajouter)", { flags: "i" }),
|
|
2036
2012
|
T(E("ins[eé]rer", { flags: "i" }), E("ajouter", { flags: "i" })),
|
|
2037
2013
|
Y,
|
|
2038
2014
|
J
|
|
2039
|
-
], { value: (e,
|
|
2015
|
+
], { value: (e, n) => W(n, {
|
|
2040
2016
|
contextText: q(e[0]),
|
|
2041
2017
|
insertCitation: e[7].citation,
|
|
2042
|
-
kind:
|
|
2018
|
+
kind: t(e[1]),
|
|
2043
2019
|
targetReference: X(e[0]) ?? e[3]
|
|
2044
|
-
}) }),
|
|
2020
|
+
}) }), Fr = T(Mr, kr, Ar, jr, Or, w([
|
|
2045
2021
|
K,
|
|
2046
|
-
|
|
2022
|
+
S,
|
|
2047
2023
|
k,
|
|
2048
|
-
|
|
2024
|
+
Sr,
|
|
2049
2025
|
E("[\\s\\S]*?(?=supprimer|r[eé]diger)", { flags: "i" }),
|
|
2050
2026
|
T(w([
|
|
2051
2027
|
E("supprimer", {
|
|
@@ -2053,7 +2029,7 @@ var kr = w([mr, E("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e,
|
|
|
2053
2029
|
value: "delete_portion"
|
|
2054
2030
|
}),
|
|
2055
2031
|
k,
|
|
2056
|
-
|
|
2032
|
+
ur
|
|
2057
2033
|
], { value: (e) => ({
|
|
2058
2034
|
kind: e[0],
|
|
2059
2035
|
...e[2]
|
|
@@ -2063,7 +2039,7 @@ var kr = w([mr, E("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e,
|
|
|
2063
2039
|
value: "rewrite_portion"
|
|
2064
2040
|
}),
|
|
2065
2041
|
k,
|
|
2066
|
-
|
|
2042
|
+
ur,
|
|
2067
2043
|
Y,
|
|
2068
2044
|
J
|
|
2069
2045
|
], { value: (e) => ({
|
|
@@ -2081,21 +2057,21 @@ var kr = w([mr, E("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e,
|
|
|
2081
2057
|
targetReference: X(e[0]) ?? n.targetReference,
|
|
2082
2058
|
targetScope: n.targetScope
|
|
2083
2059
|
});
|
|
2084
|
-
} }),
|
|
2085
|
-
|
|
2060
|
+
} }), Nr, Pr, w([
|
|
2061
|
+
lr,
|
|
2086
2062
|
E("ins[eé]rer", { flags: "i" }),
|
|
2087
|
-
E(`[\\s\\S]*?(?=${
|
|
2088
|
-
|
|
2063
|
+
E(`[\\s\\S]*?(?=${c})`, { flags: "i" }),
|
|
2064
|
+
S,
|
|
2089
2065
|
Y,
|
|
2090
|
-
|
|
2066
|
+
g,
|
|
2091
2067
|
Y,
|
|
2092
|
-
|
|
2093
|
-
], { value: (e,
|
|
2068
|
+
g
|
|
2069
|
+
], { value: (e, n) => W(n, {
|
|
2094
2070
|
contextText: e[0],
|
|
2095
2071
|
insertCitation: e[8],
|
|
2096
|
-
kind:
|
|
2072
|
+
kind: t(e[3]),
|
|
2097
2073
|
targetCitation: e[6]
|
|
2098
|
-
}) }),
|
|
2074
|
+
}) }), Dr, Er, w([
|
|
2099
2075
|
K,
|
|
2100
2076
|
E("compl[eé]ter", { flags: "i" }),
|
|
2101
2077
|
O(w([k, G], { value: (e) => e[1] }), { default: null }),
|
|
@@ -2106,16 +2082,16 @@ var kr = w([mr, E("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e,
|
|
|
2106
2082
|
insertCitation: e[4].citation,
|
|
2107
2083
|
kind: "insert_after",
|
|
2108
2084
|
targetReference: e[2] ?? X(e[0])
|
|
2109
|
-
}) }),
|
|
2085
|
+
}) }), wr, Tr);
|
|
2110
2086
|
//#endregion
|
|
2111
2087
|
//#region src/lib/server/parsed_amendments.ts
|
|
2112
|
-
function
|
|
2088
|
+
function Ir(e) {
|
|
2113
2089
|
return e.replace(/\s+/gu, " ").trim();
|
|
2114
2090
|
}
|
|
2115
|
-
function
|
|
2116
|
-
return e.split(/\n/gu).map(
|
|
2091
|
+
function Lr(e) {
|
|
2092
|
+
return e.split(/\n/gu).map(Ir).filter(Boolean).join("\n");
|
|
2117
2093
|
}
|
|
2118
|
-
function
|
|
2094
|
+
function Rr(e, t) {
|
|
2119
2095
|
let { start: n, stop: r } = t;
|
|
2120
2096
|
for (; n < r && /\s/u.test(e[n]);) n++;
|
|
2121
2097
|
for (; r > n && /\s/u.test(e[r - 1]);) r--;
|
|
@@ -2124,16 +2100,16 @@ function Ur(e, t) {
|
|
|
2124
2100
|
stop: r
|
|
2125
2101
|
} : null;
|
|
2126
2102
|
}
|
|
2127
|
-
function
|
|
2128
|
-
return _e(
|
|
2103
|
+
function zr(e, t) {
|
|
2104
|
+
return he(_e(e), t);
|
|
2129
2105
|
}
|
|
2130
|
-
function
|
|
2106
|
+
function Br(e) {
|
|
2131
2107
|
return e === "before_article" || e === "on_article" || e === "after_article" ? e : "unknown";
|
|
2132
2108
|
}
|
|
2133
|
-
function
|
|
2109
|
+
function Vr(e) {
|
|
2134
2110
|
return {
|
|
2135
2111
|
articleLabel: e.targetArticleLabel ?? null,
|
|
2136
|
-
targetPosition:
|
|
2112
|
+
targetPosition: Br(e.targetPosition),
|
|
2137
2113
|
alinea: e.targetAlinea ?? null,
|
|
2138
2114
|
alineaLabel: e.targetAlineaLabel ?? null,
|
|
2139
2115
|
subdivisionSourceId: e.targetSubdivisionSourceId ?? null,
|
|
@@ -2148,36 +2124,36 @@ function Z(e) {
|
|
|
2148
2124
|
sourceText: e.text
|
|
2149
2125
|
};
|
|
2150
2126
|
}
|
|
2151
|
-
function
|
|
2127
|
+
function Hr(e) {
|
|
2152
2128
|
return {
|
|
2153
2129
|
...e.originalTransformation === void 0 ? {} : { sourceOriginalTransformation: e.originalTransformation },
|
|
2154
2130
|
sourcePosition: e.position,
|
|
2155
2131
|
sourceText: e.text
|
|
2156
2132
|
};
|
|
2157
2133
|
}
|
|
2158
|
-
function
|
|
2134
|
+
function Ur(e) {
|
|
2159
2135
|
return {
|
|
2160
2136
|
...e?.originalTransformation === void 0 ? {} : { dispositifOriginalTransformation: e.originalTransformation },
|
|
2161
2137
|
...e === null ? {} : { dispositifPosition: e.position },
|
|
2162
2138
|
dispositifText: e?.text ?? null
|
|
2163
2139
|
};
|
|
2164
2140
|
}
|
|
2165
|
-
function
|
|
2141
|
+
function Wr(e, t, n, r = Lr(e.slice(n.start, n.stop))) {
|
|
2166
2142
|
return {
|
|
2167
|
-
originalTransformation:
|
|
2143
|
+
originalTransformation: zr(t, n),
|
|
2168
2144
|
position: n,
|
|
2169
2145
|
text: r
|
|
2170
2146
|
};
|
|
2171
2147
|
}
|
|
2172
|
-
function
|
|
2148
|
+
function Gr(e) {
|
|
2173
2149
|
let t = e.dispositifHtml ?? e.dispositifText;
|
|
2174
2150
|
if (!t) return null;
|
|
2175
|
-
let n = e.dispositifHtml ?
|
|
2151
|
+
let n = e.dispositifHtml ? ve()(t) : Se(t), r = n.output, i = Rr(r, {
|
|
2176
2152
|
start: 0,
|
|
2177
2153
|
stop: r.length
|
|
2178
2154
|
});
|
|
2179
2155
|
return {
|
|
2180
|
-
dispositif: i === null ? null :
|
|
2156
|
+
dispositif: i === null ? null : Wr(r, n, i),
|
|
2181
2157
|
simplifiedText: r,
|
|
2182
2158
|
transformation: n
|
|
2183
2159
|
};
|
|
@@ -2194,10 +2170,10 @@ function Q(e) {
|
|
|
2194
2170
|
return t === void 0 ? [] : Array.from({ length: e.count }, (e, n) => t + n);
|
|
2195
2171
|
}
|
|
2196
2172
|
if (e.type === "exclusion") return Q(e.left);
|
|
2197
|
-
for (let t of
|
|
2173
|
+
for (let t of f(e)) if (t.type === "alinéa" && typeof t.index == "number" && t.index > 0) return [t.index];
|
|
2198
2174
|
return [];
|
|
2199
2175
|
}
|
|
2200
|
-
function
|
|
2176
|
+
function Kr(e, t) {
|
|
2201
2177
|
let n = Q(t);
|
|
2202
2178
|
return {
|
|
2203
2179
|
...e,
|
|
@@ -2205,11 +2181,11 @@ function Zr(e, t) {
|
|
|
2205
2181
|
...n.length > 0 ? { alineas: n } : {}
|
|
2206
2182
|
};
|
|
2207
2183
|
}
|
|
2208
|
-
function
|
|
2184
|
+
function qr(e) {
|
|
2209
2185
|
return e.replace(/^\s*(?:[IVXLCDM]+)\s*(?:\.\s*)?[-–—]\s*/iu, "").replace(/^\s*(?:\d+°|[a-z]\))\s*/iu, "").trim();
|
|
2210
2186
|
}
|
|
2211
|
-
function
|
|
2212
|
-
let n = /^alin[eé]as?\s+(?:(\d+)|1er|premier)\b/iu.exec(
|
|
2187
|
+
function Jr(e, t) {
|
|
2188
|
+
let n = /^alin[eé]as?\s+(?:(\d+)|1er|premier)\b/iu.exec(qr(t.text));
|
|
2213
2189
|
if (!n) return null;
|
|
2214
2190
|
let r = n[1] === void 0 ? 1 : Number.parseInt(n[1], 10);
|
|
2215
2191
|
return !Number.isFinite(r) || r < 1 ? null : {
|
|
@@ -2218,25 +2194,25 @@ function $r(e, t) {
|
|
|
2218
2194
|
alineas: [r]
|
|
2219
2195
|
};
|
|
2220
2196
|
}
|
|
2221
|
-
function
|
|
2197
|
+
function Yr(e, t) {
|
|
2222
2198
|
if (e) return e.unit === "article" && t.alinea !== null ? {
|
|
2223
2199
|
...e,
|
|
2224
2200
|
unit: "alinéa"
|
|
2225
2201
|
} : e;
|
|
2226
2202
|
}
|
|
2227
|
-
function
|
|
2228
|
-
return /^(?:apr[eè]s|avant|(?:au|a[uù])\s+d[eé]but|(?:a|à)\s+la\s+fin)\b/iu.test(
|
|
2203
|
+
function Xr(e) {
|
|
2204
|
+
return /^(?:apr[eè]s|avant|(?:au|a[uù])\s+d[eé]but|(?:a|à)\s+la\s+fin)\b/iu.test(qr(e.text));
|
|
2229
2205
|
}
|
|
2230
|
-
function
|
|
2231
|
-
return
|
|
2206
|
+
function Zr(e, t, n, r) {
|
|
2207
|
+
return Wr(e, t, {
|
|
2232
2208
|
start: n.position.start,
|
|
2233
2209
|
stop: r.position.stop
|
|
2234
2210
|
});
|
|
2235
2211
|
}
|
|
2236
|
-
function
|
|
2212
|
+
function Qr(e) {
|
|
2237
2213
|
return /^\s*(?:[IVXLCDM]+)\s*(?:\.\s*)?[-–—]\s*(?!alin[eé]a\b)/iu.test(e.text);
|
|
2238
2214
|
}
|
|
2239
|
-
function
|
|
2215
|
+
function $r(e, t) {
|
|
2240
2216
|
let n = { ...t.position };
|
|
2241
2217
|
function r(t) {
|
|
2242
2218
|
let r = t.exec(e.slice(n.start, n.stop));
|
|
@@ -2245,29 +2221,29 @@ function ii(e, t) {
|
|
|
2245
2221
|
stop: n.stop
|
|
2246
2222
|
});
|
|
2247
2223
|
}
|
|
2248
|
-
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),
|
|
2224
|
+
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), Rr(e, n);
|
|
2249
2225
|
}
|
|
2250
|
-
function
|
|
2251
|
-
return
|
|
2226
|
+
function ei(e) {
|
|
2227
|
+
return p(e);
|
|
2252
2228
|
}
|
|
2253
|
-
function
|
|
2254
|
-
return
|
|
2229
|
+
function ti(e, t) {
|
|
2230
|
+
return Fr(new D(e.slice(0, t.stop), t.start)) ?? null;
|
|
2255
2231
|
}
|
|
2256
2232
|
function $(e, t, n) {
|
|
2257
|
-
if (n) return
|
|
2233
|
+
if (n) return Wr(e, t, n.position, Lr(d(e, n)));
|
|
2258
2234
|
}
|
|
2259
|
-
function
|
|
2235
|
+
function ni(e, t) {
|
|
2260
2236
|
if (!e) return;
|
|
2261
2237
|
let n = structuredClone(e);
|
|
2262
|
-
for (let e of
|
|
2238
|
+
for (let e of me(n, { citations: !0 })) e.position !== void 0 && (e.originalTransformation = zr(t, e.position));
|
|
2263
2239
|
return n;
|
|
2264
2240
|
}
|
|
2265
|
-
function
|
|
2266
|
-
let i =
|
|
2241
|
+
function ri(e, t, n, r) {
|
|
2242
|
+
let i = $r(e, n);
|
|
2267
2243
|
if (!i) return null;
|
|
2268
|
-
let a =
|
|
2244
|
+
let a = ti(e, i);
|
|
2269
2245
|
if (!a) return null;
|
|
2270
|
-
let o =
|
|
2246
|
+
let o = Wr(e, t, i), s = ni(a.targetReference, t), c = Kr(r, s), l = ei(o.text);
|
|
2271
2247
|
if (a.kind === "delete_article") return {
|
|
2272
2248
|
kind: "delete_article",
|
|
2273
2249
|
...Z(o),
|
|
@@ -2285,7 +2261,7 @@ function ci(e, t, n, r) {
|
|
|
2285
2261
|
},
|
|
2286
2262
|
targetOccurrence: l,
|
|
2287
2263
|
targetReference: s,
|
|
2288
|
-
targetScope:
|
|
2264
|
+
targetScope: Yr(a.targetScope, c)
|
|
2289
2265
|
};
|
|
2290
2266
|
}
|
|
2291
2267
|
if (a.kind === "rewrite_portion") {
|
|
@@ -2302,7 +2278,7 @@ function ci(e, t, n, r) {
|
|
|
2302
2278
|
},
|
|
2303
2279
|
targetOccurrence: l,
|
|
2304
2280
|
targetReference: s,
|
|
2305
|
-
targetScope:
|
|
2281
|
+
targetScope: Yr(a.targetScope, c),
|
|
2306
2282
|
replacementCitation: n,
|
|
2307
2283
|
replacementText: n.text
|
|
2308
2284
|
};
|
|
@@ -2357,19 +2333,19 @@ function ci(e, t, n, r) {
|
|
|
2357
2333
|
targetReference: s,
|
|
2358
2334
|
insertCitation: n,
|
|
2359
2335
|
insertText: n.text,
|
|
2360
|
-
targetScope:
|
|
2336
|
+
targetScope: Yr(a.targetScope, c)
|
|
2361
2337
|
};
|
|
2362
2338
|
}
|
|
2363
2339
|
return null;
|
|
2364
2340
|
}
|
|
2365
|
-
function
|
|
2341
|
+
function ii(e, t) {
|
|
2366
2342
|
let n = [], r = 0, i = 0;
|
|
2367
2343
|
function a(r) {
|
|
2368
|
-
let a =
|
|
2344
|
+
let a = Rr(e, {
|
|
2369
2345
|
start: i,
|
|
2370
2346
|
stop: r
|
|
2371
2347
|
});
|
|
2372
|
-
a !== null && n.push(
|
|
2348
|
+
a !== null && n.push(Wr(e, t, a));
|
|
2373
2349
|
}
|
|
2374
2350
|
function o(t) {
|
|
2375
2351
|
let n = Math.max(e.lastIndexOf("\n", t - 1), e.lastIndexOf("\r", t - 1));
|
|
@@ -2387,7 +2363,7 @@ function li(e, t) {
|
|
|
2387
2363
|
continue;
|
|
2388
2364
|
}
|
|
2389
2365
|
if (r > 0) continue;
|
|
2390
|
-
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) &&
|
|
2366
|
+
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) && Xr({
|
|
2391
2367
|
originalTransformation: void 0,
|
|
2392
2368
|
position: {
|
|
2393
2369
|
start: i,
|
|
@@ -2399,8 +2375,8 @@ function li(e, t) {
|
|
|
2399
2375
|
}
|
|
2400
2376
|
return a(e.length), n;
|
|
2401
2377
|
}
|
|
2402
|
-
function
|
|
2403
|
-
let t =
|
|
2378
|
+
function ai(e) {
|
|
2379
|
+
let t = Gr(e), n = t?.dispositif ?? null, r = Ur(n), i = [], a = [], o = Vr(e);
|
|
2404
2380
|
if (e.sourceFormat === "senat-ameli" && e.sourceKind === "S") return i.push({
|
|
2405
2381
|
code: "unsupported_sub_amendment",
|
|
2406
2382
|
message: "Les sous-amendements ne sont pas encore projetés."
|
|
@@ -2418,9 +2394,9 @@ function ui(e) {
|
|
|
2418
2394
|
});
|
|
2419
2395
|
else {
|
|
2420
2396
|
let { simplifiedText: e, transformation: r } = t, s = o, c = null;
|
|
2421
|
-
for (let t of
|
|
2422
|
-
|
|
2423
|
-
let n = c ?
|
|
2397
|
+
for (let t of ii(e, r)) {
|
|
2398
|
+
Qr(t) && (s = o, c = null);
|
|
2399
|
+
let n = c ? Zr(e, r, c, t) : t, i = ri(e, r, n, s);
|
|
2424
2400
|
if (i) {
|
|
2425
2401
|
a.push(i), c = null, (i.target.alinea !== null || i.target.alineas) && (s = i.target);
|
|
2426
2402
|
continue;
|
|
@@ -2429,12 +2405,12 @@ function ui(e) {
|
|
|
2429
2405
|
c = n;
|
|
2430
2406
|
continue;
|
|
2431
2407
|
}
|
|
2432
|
-
let l =
|
|
2408
|
+
let l = Jr(o, t);
|
|
2433
2409
|
if (l !== null) {
|
|
2434
2410
|
s = l;
|
|
2435
2411
|
continue;
|
|
2436
2412
|
}
|
|
2437
|
-
|
|
2413
|
+
Xr(t) && (c = t);
|
|
2438
2414
|
}
|
|
2439
2415
|
a.length === 0 && (o.targetPosition === "after_article" || o.targetPosition === "before_article") && a.push({
|
|
2440
2416
|
kind: o.targetPosition === "before_article" ? "insert_article_before" : "insert_article_after",
|
|
@@ -2445,7 +2421,7 @@ function ui(e) {
|
|
|
2445
2421
|
}), a.length === 0 && i.push({
|
|
2446
2422
|
code: "unrecognized_dispositif",
|
|
2447
2423
|
message: "Le dispositif est présent mais aucune directive d'amendement n'a été reconnue.",
|
|
2448
|
-
...
|
|
2424
|
+
...Hr(n)
|
|
2449
2425
|
});
|
|
2450
2426
|
}
|
|
2451
2427
|
return {
|
|
@@ -2459,25 +2435,25 @@ function ui(e) {
|
|
|
2459
2435
|
}
|
|
2460
2436
|
//#endregion
|
|
2461
2437
|
//#region src/lib/server/senat_document_search.ts
|
|
2462
|
-
function
|
|
2438
|
+
function oi(e) {
|
|
2463
2439
|
return e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim();
|
|
2464
2440
|
}
|
|
2465
|
-
function
|
|
2466
|
-
let t =
|
|
2441
|
+
function si(e) {
|
|
2442
|
+
let t = i(e);
|
|
2467
2443
|
if (!t) return {
|
|
2468
2444
|
articleNumber: null,
|
|
2469
2445
|
label: e,
|
|
2470
2446
|
title: null
|
|
2471
2447
|
};
|
|
2472
|
-
let n =
|
|
2448
|
+
let n = oi(t.num ?? "") || null, r = oi(t.title ?? "") || null;
|
|
2473
2449
|
return {
|
|
2474
2450
|
articleNumber: n,
|
|
2475
2451
|
label: t.label,
|
|
2476
2452
|
title: r
|
|
2477
2453
|
};
|
|
2478
2454
|
}
|
|
2479
|
-
function
|
|
2480
|
-
let t =
|
|
2455
|
+
function ci(e) {
|
|
2456
|
+
let t = y(e), n = [], r = oi(t("section.akn-preamble").text());
|
|
2481
2457
|
return r && n.push({
|
|
2482
2458
|
anchor: "senat-expose-des-motifs",
|
|
2483
2459
|
articleNumber: null,
|
|
@@ -2487,9 +2463,9 @@ function pi(e) {
|
|
|
2487
2463
|
label: "Exposé des motifs",
|
|
2488
2464
|
title: null
|
|
2489
2465
|
}), t("article.akn-article").each((e, r) => {
|
|
2490
|
-
let i = t(r), a = i.attr("id") || `akn-article-${e + 1}`, o =
|
|
2466
|
+
let i = t(r), a = i.attr("id") || `akn-article-${e + 1}`, o = oi(i.children("p.TCNumArticle").first().text()), s = `Article ${e + 1}`, c = si(o || s), l = i.clone();
|
|
2491
2467
|
l.children("p.TCNumArticle").remove();
|
|
2492
|
-
let u =
|
|
2468
|
+
let u = oi(l.text());
|
|
2493
2469
|
u && n.push({
|
|
2494
2470
|
anchor: i.attr("id") || null,
|
|
2495
2471
|
articleNumber: c.articleNumber,
|
|
@@ -2501,40 +2477,40 @@ function pi(e) {
|
|
|
2501
2477
|
});
|
|
2502
2478
|
}), n;
|
|
2503
2479
|
}
|
|
2504
|
-
function
|
|
2505
|
-
return
|
|
2480
|
+
function li(e, t) {
|
|
2481
|
+
return ke("sha256").update(JSON.stringify({
|
|
2506
2482
|
item: e,
|
|
2507
2483
|
metadata: t
|
|
2508
2484
|
})).digest("hex");
|
|
2509
2485
|
}
|
|
2510
2486
|
//#endregion
|
|
2511
2487
|
//#region src/lib/server/senat_document_sources.ts
|
|
2512
|
-
var
|
|
2513
|
-
function
|
|
2488
|
+
var ui = new Set(["senat.fr", "www.senat.fr"]), di = "https://www.senat.fr";
|
|
2489
|
+
function fi(e) {
|
|
2514
2490
|
return e?.trim() || void 0;
|
|
2515
2491
|
}
|
|
2516
|
-
function
|
|
2492
|
+
function pi(e) {
|
|
2517
2493
|
try {
|
|
2518
|
-
let t = e.replace(/^\/+/, ""), n = /^https?:\/\//iu.test(e) ? new URL(e) : new URL(/^(?:akomantoso|leg)\//iu.test(t) ? `/${t}` : `/leg/${t}`,
|
|
2519
|
-
return
|
|
2494
|
+
let t = e.replace(/^\/+/, ""), n = /^https?:\/\//iu.test(e) ? new URL(e) : new URL(/^(?:akomantoso|leg)\//iu.test(t) ? `/${t}` : `/leg/${t}`, di);
|
|
2495
|
+
return ui.has(n.hostname.toLowerCase()) ? n : void 0;
|
|
2520
2496
|
} catch {
|
|
2521
2497
|
return;
|
|
2522
2498
|
}
|
|
2523
2499
|
}
|
|
2524
|
-
function
|
|
2525
|
-
let t =
|
|
2500
|
+
function mi(e) {
|
|
2501
|
+
let t = fi(e);
|
|
2526
2502
|
if (t === void 0) return {
|
|
2527
2503
|
publicUrl: null,
|
|
2528
2504
|
status: "no_url"
|
|
2529
2505
|
};
|
|
2530
|
-
let n =
|
|
2506
|
+
let n = pi(t);
|
|
2531
2507
|
if (n === void 0) return {
|
|
2532
2508
|
publicUrl: t,
|
|
2533
2509
|
status: "unsupported_source"
|
|
2534
2510
|
};
|
|
2535
2511
|
let r = n.pathname;
|
|
2536
2512
|
if (/^\/akomantoso\/[^/]+\.akn\.xml$/iu.test(r)) return {
|
|
2537
|
-
akomaNtosoUrl: `${
|
|
2513
|
+
akomaNtosoUrl: `${di}${r}`,
|
|
2538
2514
|
publicUrl: n.toString(),
|
|
2539
2515
|
status: "available"
|
|
2540
2516
|
};
|
|
@@ -2543,17 +2519,17 @@ function yi(e) {
|
|
|
2543
2519
|
publicUrl: n.toString(),
|
|
2544
2520
|
status: "unsupported_source"
|
|
2545
2521
|
} : {
|
|
2546
|
-
akomaNtosoUrl: `${
|
|
2522
|
+
akomaNtosoUrl: `${di}/akomantoso/${i.replace(/\.html$/iu, ".akn.xml")}`,
|
|
2547
2523
|
publicUrl: n.toString(),
|
|
2548
2524
|
status: "available"
|
|
2549
2525
|
};
|
|
2550
2526
|
}
|
|
2551
|
-
function
|
|
2527
|
+
function hi(e) {
|
|
2552
2528
|
return /^\s*(?:<\?xml\b[^>]*>\s*)?<akomaNtoso[\s/>]/iu.test(e);
|
|
2553
2529
|
}
|
|
2554
2530
|
//#endregion
|
|
2555
2531
|
//#region src/lib/alineas/alineas_numbers.ts
|
|
2556
|
-
var
|
|
2532
|
+
var gi = {
|
|
2557
2533
|
"0150a855548f15a2af52ea057be53f5d": 1,
|
|
2558
2534
|
"039826cf379b94afefe90b25c6045ca0": 1,
|
|
2559
2535
|
"03a7e564b84662f4d957c51018e26244": 1,
|
|
@@ -21527,7 +21503,7 @@ var xi = {
|
|
|
21527
21503
|
d16d29c923bd60c7b095b66c6058fe60: 1664,
|
|
21528
21504
|
"1c14c2adf5cfda3220b2057160e10e91": 1665,
|
|
21529
21505
|
e44c55ca1ac46ff46420686a466c9fc6: 1665
|
|
21530
|
-
},
|
|
21506
|
+
}, _i = "\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", vi = "\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", yi = "\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", bi = "\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", xi = "\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", Si = {
|
|
21531
21507
|
assnatetatagr: { bold: !0 },
|
|
21532
21508
|
assnatetatagrgr: { bold: !0 },
|
|
21533
21509
|
assnatetatatr: { bold: !0 },
|
|
@@ -21628,29 +21604,29 @@ var xi = {
|
|
|
21628
21604
|
assnatxl67: { align: "center" },
|
|
21629
21605
|
assnatenteteequilibre: { align: "center" }
|
|
21630
21606
|
};
|
|
21631
|
-
function
|
|
21632
|
-
let t = Object.keys(
|
|
21633
|
-
for (let n of t) if (e.includes(n)) return
|
|
21607
|
+
function Ci(e) {
|
|
21608
|
+
let t = Object.keys(Si).sort((e, t) => t.length - e.length);
|
|
21609
|
+
for (let n of t) if (e.includes(n)) return Si[n];
|
|
21634
21610
|
return null;
|
|
21635
21611
|
}
|
|
21636
|
-
function
|
|
21637
|
-
return
|
|
21612
|
+
function wi(e) {
|
|
21613
|
+
return Oe.createHash("md5").update(e).digest("hex");
|
|
21638
21614
|
}
|
|
21639
|
-
function
|
|
21615
|
+
function Ti(e) {
|
|
21640
21616
|
return e ? /font-weight\s*:\s*(bold|[6-9]00|1000)/i.test(e) || /font-family\s*:\s*[^;]*\bBold\b/i.test(e) : !1;
|
|
21641
21617
|
}
|
|
21642
|
-
function
|
|
21618
|
+
function Ei(e) {
|
|
21643
21619
|
return e ? /font-style\s*:\s*italic/i.test(e) || /font-family\s*:\s*[^;]*\bItalic\b/i.test(e) : !1;
|
|
21644
21620
|
}
|
|
21645
|
-
function
|
|
21621
|
+
function Di(e) {
|
|
21646
21622
|
if (!e || !/vertical-align\s*:\s*super/i.test(e)) return !1;
|
|
21647
21623
|
let t = e.match(/font-size\s*:\s*([\d.]+)pt/i);
|
|
21648
21624
|
return !(t && parseFloat(t[1]) < 8);
|
|
21649
21625
|
}
|
|
21650
|
-
function
|
|
21626
|
+
function Oi(e) {
|
|
21651
21627
|
return e ? /vertical-align\s*:\s*sub/i.test(e) : !1;
|
|
21652
21628
|
}
|
|
21653
|
-
function
|
|
21629
|
+
function ki(e) {
|
|
21654
21630
|
if (!e) return;
|
|
21655
21631
|
let t = [
|
|
21656
21632
|
"width",
|
|
@@ -21685,15 +21661,15 @@ function Pi(e) {
|
|
|
21685
21661
|
}
|
|
21686
21662
|
return n.length > 0 ? n.join("; ") : void 0;
|
|
21687
21663
|
}
|
|
21688
|
-
function
|
|
21664
|
+
function Ai(e, t) {
|
|
21689
21665
|
return !!(e && /text-align\s*:\s*center/i.test(e) || t && /center/i.test(t));
|
|
21690
21666
|
}
|
|
21691
|
-
function
|
|
21667
|
+
function ji(e) {
|
|
21692
21668
|
if (!e) return null;
|
|
21693
21669
|
let t = e.match(/text-align\s*:\s*(left|center|right|justify)/i);
|
|
21694
21670
|
return t ? t[1].toLowerCase() : null;
|
|
21695
21671
|
}
|
|
21696
|
-
function
|
|
21672
|
+
function Mi(e) {
|
|
21697
21673
|
if (!e) return null;
|
|
21698
21674
|
for (let [t, n] of [
|
|
21699
21675
|
[/assnat1Tome|assnatAN1PARTIE/i, 1],
|
|
@@ -21705,8 +21681,8 @@ function Li(e) {
|
|
|
21705
21681
|
]) if (t.test(e)) return n;
|
|
21706
21682
|
return null;
|
|
21707
21683
|
}
|
|
21708
|
-
function
|
|
21709
|
-
let { keepAlignment: n = !0, removeEmptyParagraphs: r = !0, strictAlineas: i = !1 } = t, a =
|
|
21684
|
+
function Ni(e, t = {}) {
|
|
21685
|
+
let { keepAlignment: n = !0, removeEmptyParagraphs: r = !0, strictAlineas: i = !1 } = t, a = y(e, { xml: { decodeEntities: !1 } });
|
|
21710
21686
|
a("style, script, meta, link").remove(), a(".assnatHeader, .assnatFooter, .assnatHeaderLeft, .assnatHeaderandFooter").remove(), a(".assnatFARSautApres, .assnatFARSautAvant, .assnatFARSautPageNiv0, .assnatFARSautPageNiv1, .assnatFARSautPageNiv1PG").remove(), a(".assnatFARTT08Bleu").each((e, t) => {
|
|
21711
21687
|
let n = a(t).closest("table");
|
|
21712
21688
|
n.length > 0 && n.remove();
|
|
@@ -21731,7 +21707,7 @@ function Ri(e, t = {}) {
|
|
|
21731
21707
|
if (i.length !== 0 && !(n.parents("del").length > 0 || n.find("del img").length > 0) && !(i.parent("del").length > 0)) {
|
|
21732
21708
|
let e = i.attr();
|
|
21733
21709
|
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")) {
|
|
21734
|
-
let t = (e.src || "").match(/^data:image\/png;base64,(.+)$/), r = t ?
|
|
21710
|
+
let t = (e.src || "").match(/^data:image\/png;base64,(.+)$/), r = t ? wi(t[1]) : void 0, i = r ? ` data-image-hash="${r}"` : "";
|
|
21735
21711
|
n.replaceWith(`<span class="alinea"${i}></span>`);
|
|
21736
21712
|
return;
|
|
21737
21713
|
}
|
|
@@ -21750,7 +21726,7 @@ function Ri(e, t = {}) {
|
|
|
21750
21726
|
(!r || r === "\xA0") && n.remove();
|
|
21751
21727
|
}), a("span[style*=\"display:block\"][style*=\"position:absolute\"]:not(.alinea)").remove(), a("del").remove();
|
|
21752
21728
|
function o(e) {
|
|
21753
|
-
let t = a(e), n = t.attr("style"), r = e.tagName?.toLowerCase() || "", i =
|
|
21729
|
+
let t = a(e), n = t.attr("style"), r = e.tagName?.toLowerCase() || "", i = Ti(n) || r === "b" || r === "strong", o = Ei(n) || r === "i" || r === "em", s = Di(n) || r === "sup", c = Oi(n) || r === "sub", l = t.attr("class") || "";
|
|
21754
21730
|
return /bold/i.test(l) && (i = !0), /strongemphasis/i.test(l) ? i = !0 : /italic|emphasis/i.test(l) && (o = !0), {
|
|
21755
21731
|
bold: i,
|
|
21756
21732
|
italic: o,
|
|
@@ -21784,7 +21760,7 @@ function Ri(e, t = {}) {
|
|
|
21784
21760
|
c = e;
|
|
21785
21761
|
}
|
|
21786
21762
|
for (a("p").each((e, t) => {
|
|
21787
|
-
let r = a(t), i = r.attr("class") || "", o = r.attr("style"), s =
|
|
21763
|
+
let r = a(t), i = r.attr("class") || "", o = r.attr("style"), s = Mi(i);
|
|
21788
21764
|
if (i.includes("assnatFARCouvTitreD")) {
|
|
21789
21765
|
let e = r.html() || "";
|
|
21790
21766
|
r.replaceWith(`<p class="cover-subtitle">${e}</p>`);
|
|
@@ -21817,11 +21793,11 @@ function Ri(e, t = {}) {
|
|
|
21817
21793
|
let c = r.text().trim().startsWith("«");
|
|
21818
21794
|
if (s && !c) {
|
|
21819
21795
|
let e = a(`<h${s}>${r.html() || ""}</h${s}>`);
|
|
21820
|
-
n &&
|
|
21796
|
+
n && Ai(o, i) && e.attr("align", "center"), r.replaceWith(e);
|
|
21821
21797
|
} else {
|
|
21822
|
-
let e =
|
|
21798
|
+
let e = Ci(i), t;
|
|
21823
21799
|
if (n) {
|
|
21824
|
-
let n =
|
|
21800
|
+
let n = ji(o);
|
|
21825
21801
|
n && n !== "justify" && n !== "left" ? t = n : e?.align && (t = e.align);
|
|
21826
21802
|
}
|
|
21827
21803
|
if (r.removeAttr("style").removeAttr("class"), t && r.attr("align", t), e?.bold) {
|
|
@@ -21831,7 +21807,7 @@ function Ri(e, t = {}) {
|
|
|
21831
21807
|
}
|
|
21832
21808
|
}), a("h1, h2, h3, h4, h5, h6").each((e, t) => {
|
|
21833
21809
|
let r = a(t), i = r.attr("style"), o = r.attr("class");
|
|
21834
|
-
n &&
|
|
21810
|
+
n && Ai(i, o) ? (r.removeAttr("style").removeAttr("class"), r.attr("align", "center")) : r.removeAttr("style").removeAttr("class");
|
|
21835
21811
|
}), a("a").each((e, t) => {
|
|
21836
21812
|
let n = a(t), r = n.attr("href"), i = n.attr("id"), o = { ...t.attribs || {} };
|
|
21837
21813
|
for (let e of Object.keys(o)) e !== "href" && e !== "id" && n.removeAttr(e);
|
|
@@ -21870,7 +21846,7 @@ function Ri(e, t = {}) {
|
|
|
21870
21846
|
}), a("br").each((e, t) => {
|
|
21871
21847
|
a(t).removeAttr("style").removeAttr("class");
|
|
21872
21848
|
}), a("table, tr, td, th, thead, tbody, tfoot").each((e, t) => {
|
|
21873
|
-
let n = a(t), r =
|
|
21849
|
+
let n = a(t), r = ki(n.attr("style"));
|
|
21874
21850
|
n.removeAttr("style").removeAttr("class"), r && n.attr("style", r);
|
|
21875
21851
|
}), a("td, th").each((e, t) => {
|
|
21876
21852
|
let n = a(t), r = n.children();
|
|
@@ -21888,17 +21864,17 @@ function Ri(e, t = {}) {
|
|
|
21888
21864
|
!isNaN(e) && e > 1 && n.attr("style", `counter-reset: list-counter ${e - 1}`), n.attr("start", r);
|
|
21889
21865
|
}
|
|
21890
21866
|
}), a("li").each((e, t) => {
|
|
21891
|
-
let n = a(t), r =
|
|
21867
|
+
let n = a(t), r = ji(n.attr("style"));
|
|
21892
21868
|
n.removeAttr("style").removeAttr("class"), r === "center" && n.attr("style", "text-align: center");
|
|
21893
21869
|
let i = n.html() || "", o = i.replace(/^(\s| | |\u00a0)+/, "");
|
|
21894
21870
|
o !== i && n.html(o);
|
|
21895
|
-
}),
|
|
21871
|
+
}), Pi(a), Fi(a, i);
|
|
21896
21872
|
let l = a("body").html() || a.html(), u = l.includes("class=\"alinea"), d = a("ol").length > 0, f = a("h1, h2, h3, h4, h5, h6").length > 0, p = l.includes("class=\"expose-motifs"), m = l.includes("class=\"cover-title\"") || l.includes("class=\"cover-subtitle\"") || l.includes("class=\"cover-info\"") || l.includes("class=\"cover-year\""), h = "";
|
|
21897
|
-
m && (h +=
|
|
21873
|
+
m && (h += xi), f && (h += vi), p && (h += yi), u && (h += _i), d && (h += bi);
|
|
21898
21874
|
let g = h ? `<style>${h}</style>\n${l}` : l;
|
|
21899
|
-
return g = g.replace(/>\s+</g, "> <").replace(/\r\n/g, "\n").replace(/\r/g, "\n").replace(/\n{3,}/g, "\n\n").split("\n").map((e) => e.trim()).filter((e) => e.length > 0).join("\n"), g = g.replace(/ /g, "\xA0"), r && (g = g.replace(/<p[^>]*>\s*( | | |\u00a0|\s)*\s*<\/p>/gi, "").replace(/<p[^>]*>\s*<(strong|em|b|i)>\s*( | | |\u00a0|\s)*\s*<\/\1>\s*<\/p>/gi, "")), g = g.replace(/<span[^>]*>\s*<\/span>/gi, ""), g = g.replace(/ class=""/g, ""), g =
|
|
21875
|
+
return g = g.replace(/>\s+</g, "> <").replace(/\r\n/g, "\n").replace(/\r/g, "\n").replace(/\n{3,}/g, "\n\n").split("\n").map((e) => e.trim()).filter((e) => e.length > 0).join("\n"), g = g.replace(/ /g, "\xA0"), r && (g = g.replace(/<p[^>]*>\s*( | | |\u00a0|\s)*\s*<\/p>/gi, "").replace(/<p[^>]*>\s*<(strong|em|b|i)>\s*( | | |\u00a0|\s)*\s*<\/\1>\s*<\/p>/gi, "")), g = g.replace(/<span[^>]*>\s*<\/span>/gi, ""), g = g.replace(/ class=""/g, ""), g = Ii(g), g = g.replace(/<(strong|em|b|i|sup|sub)>\s*( | | |\u00a0|\s)*\s*<\/\1>/gi, "").replace(/<(strong|em|b|i)>( | | |\u00a0)+<\/\1>/gi, " ").replace(/<br\s*\/?>/gi, "<br/>").replace(/ +/g, " ").trim(), g;
|
|
21900
21876
|
}
|
|
21901
|
-
function
|
|
21877
|
+
function Pi(e) {
|
|
21902
21878
|
e("span[id]").each((t, n) => {
|
|
21903
21879
|
let r = e(n), i = r.attr("id"), a = n.attribs || {}, o = Object.keys(a);
|
|
21904
21880
|
if (o.length !== 1 || o[0] !== "id") return;
|
|
@@ -21921,13 +21897,13 @@ function zi(e) {
|
|
|
21921
21897
|
l.trim() === u.trim() && (s.attr("id", i), r.replaceWith(r.html() || ""));
|
|
21922
21898
|
});
|
|
21923
21899
|
}
|
|
21924
|
-
function
|
|
21900
|
+
function Fi(e, t = !1) {
|
|
21925
21901
|
let n = e("body");
|
|
21926
21902
|
if (n.length === 0) return;
|
|
21927
21903
|
let r = n.find("span.alinea[data-image-hash]"), i = -1;
|
|
21928
21904
|
r.each((n, r) => {
|
|
21929
21905
|
let a = e(r), o = a.attr("data-image-hash"), s;
|
|
21930
|
-
if (o &&
|
|
21906
|
+
if (o && gi[o] !== void 0 && (s = gi[o]), s === void 0) {
|
|
21931
21907
|
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".`);
|
|
21932
21908
|
a.remove();
|
|
21933
21909
|
return;
|
|
@@ -21939,11 +21915,11 @@ function Bi(e, t = !1) {
|
|
|
21939
21915
|
i = s, a.attr("data-alinea", String(s)), a.text(String(s)), a.removeAttr("data-image-hash");
|
|
21940
21916
|
});
|
|
21941
21917
|
}
|
|
21942
|
-
function
|
|
21918
|
+
function Ii(e) {
|
|
21943
21919
|
let t = e;
|
|
21944
21920
|
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;
|
|
21945
21921
|
}
|
|
21946
|
-
function
|
|
21922
|
+
function Li(e, t = {}) {
|
|
21947
21923
|
return `<!DOCTYPE html>
|
|
21948
21924
|
<html lang="fr">
|
|
21949
21925
|
<head>
|
|
@@ -21951,13 +21927,13 @@ function Hi(e, t = {}) {
|
|
|
21951
21927
|
<title>Document simplifié</title>
|
|
21952
21928
|
</head>
|
|
21953
21929
|
<body>
|
|
21954
|
-
${
|
|
21930
|
+
${Ni(e, t)}
|
|
21955
21931
|
</body>
|
|
21956
21932
|
</html>`;
|
|
21957
21933
|
}
|
|
21958
21934
|
//#endregion
|
|
21959
21935
|
//#region src/lib/server/text_parsers/transformers.ts
|
|
21960
|
-
function
|
|
21936
|
+
function Ri(e, t) {
|
|
21961
21937
|
let n = "transformation_", r = {};
|
|
21962
21938
|
for (let e of A.readdirSync(t).toSorted()) if (e.startsWith(n) && e.endsWith(".json")) {
|
|
21963
21939
|
let i = e.slice(15, -5), a = i.split(".").map((e) => parseInt(e) - 1), o = r;
|
|
@@ -21966,18 +21942,18 @@ function Ui(e, t) {
|
|
|
21966
21942
|
for (; e >= t.length;) t.push({});
|
|
21967
21943
|
o = t[e];
|
|
21968
21944
|
}
|
|
21969
|
-
o.output = A.readFileSync(
|
|
21970
|
-
let { sourceMap: s, title: c } = A.readJsonSync(
|
|
21945
|
+
o.output = A.readFileSync(Ae.join(t, `${n}${i}.html`), { encoding: "utf-8" });
|
|
21946
|
+
let { sourceMap: s, title: c } = A.readJsonSync(Ae.join(t, e), { encoding: "utf-8" });
|
|
21971
21947
|
o.sourceMap = s ?? [], o.title = c;
|
|
21972
21948
|
}
|
|
21973
|
-
return
|
|
21949
|
+
return zi(r, e), r;
|
|
21974
21950
|
}
|
|
21975
|
-
function
|
|
21976
|
-
if (e.input = t, e.transformations !== void 0) for (let n of e.transformations)
|
|
21951
|
+
function zi(e, t) {
|
|
21952
|
+
if (e.input = t, e.transformations !== void 0) for (let n of e.transformations) zi(n, t), t = n.output;
|
|
21977
21953
|
return t;
|
|
21978
21954
|
}
|
|
21979
|
-
function
|
|
21980
|
-
if (A.ensureDirSync(t), e.transformations === void 0) A.writeJsonSync(
|
|
21955
|
+
function Bi(e, t, n = "1") {
|
|
21956
|
+
if (A.ensureDirSync(t), e.transformations === void 0) A.writeJsonSync(Ae.join(t, `transformation_${n}.json`), {
|
|
21981
21957
|
sourceMap: e.sourceMap,
|
|
21982
21958
|
title: e.title
|
|
21983
21959
|
}, {
|
|
@@ -21985,24 +21961,24 @@ function Gi(e, t, n = "1") {
|
|
|
21985
21961
|
spaces: 2
|
|
21986
21962
|
});
|
|
21987
21963
|
else {
|
|
21988
|
-
A.writeJsonSync(
|
|
21964
|
+
A.writeJsonSync(Ae.join(t, `transformation_${n}.json`), { title: e.title }, {
|
|
21989
21965
|
encoding: "utf-8",
|
|
21990
21966
|
spaces: 2
|
|
21991
21967
|
});
|
|
21992
|
-
for (let [r, i] of e.transformations.entries())
|
|
21968
|
+
for (let [r, i] of e.transformations.entries()) Bi(i, t, `${n}.${r + 1}`);
|
|
21993
21969
|
}
|
|
21994
|
-
e.output !== void 0 && A.writeFileSync(
|
|
21970
|
+
e.output !== void 0 && A.writeFileSync(Ae.join(t, `transformation_${n}.html`), e.output, { encoding: "utf-8" });
|
|
21995
21971
|
}
|
|
21996
21972
|
//#endregion
|
|
21997
21973
|
//#region src/lib/server/linkers/html.ts
|
|
21998
|
-
async function
|
|
21999
|
-
let _ = t ?? (e === void 0 ? void 0 : new
|
|
21974
|
+
async function Vi({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, htmlFilePath: i, htmlTransformationsInputDir: a, htmlTransformationsOutputDir: o, htmlWithLinksFilePath: s, htmlWithLinksOrReferencesFilePath: c, htmlWithLinksTransformationsOutputDir: l, htmlWithReferencesFilePath: u, linkBaseUrl: d, linkType: f, logIgnoredReferencesTypes: p, logPartialReferences: m, logReferences: h, referredLegifranceTextsInfosFilePath: g }) {
|
|
21975
|
+
let _ = t ?? (e === void 0 ? void 0 : new ie(e));
|
|
22000
21976
|
if (_ === void 0) throw Error("A Canutes database or legal resolver is required");
|
|
22001
21977
|
let v = await A.readFile(i, { encoding: "utf-8" }), y;
|
|
22002
|
-
a === void 0 ? (y =
|
|
21978
|
+
a === void 0 ? (y = ve({ removeAWithHref: !0 })(v), o !== void 0 && Bi(y, o)) : y = Ri(v, a);
|
|
22003
21979
|
let b = [];
|
|
22004
21980
|
s !== void 0 && b.push("links"), c !== void 0 && b.push("links_or_references"), u !== void 0 && b.push("references");
|
|
22005
|
-
let { outputByType: x, referredLegifranceTextCountByCid:
|
|
21981
|
+
let { outputByType: x, referredLegifranceTextCountByCid: S } = await se({
|
|
22006
21982
|
legiResolver: _,
|
|
22007
21983
|
date: n,
|
|
22008
21984
|
defaultTextId: r,
|
|
@@ -22015,22 +21991,22 @@ async function Ki({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, ht
|
|
|
22015
21991
|
logReferences: h,
|
|
22016
21992
|
outputTypes: b,
|
|
22017
21993
|
referredLegifranceTextsInfos: g !== void 0
|
|
22018
|
-
}),
|
|
22019
|
-
s !== void 0 && (
|
|
21994
|
+
}), C = {};
|
|
21995
|
+
s !== void 0 && (C.links = s), c !== void 0 && (C.links_or_references = c), u !== void 0 && (C.references = u);
|
|
22020
21996
|
for (let [e, t] of Object.entries(x)) {
|
|
22021
|
-
let n =
|
|
21997
|
+
let n = C[e];
|
|
22022
21998
|
n !== void 0 && await A.writeFile(n, t.html, { encoding: "utf-8" });
|
|
22023
21999
|
}
|
|
22024
|
-
x.links !== void 0 && l !== void 0 &&
|
|
22000
|
+
x.links !== void 0 && l !== void 0 && Bi(ve()(x.links.html), l), g !== void 0 && await A.writeJson(g, S, {
|
|
22025
22001
|
encoding: "utf-8",
|
|
22026
22002
|
spaces: 2
|
|
22027
22003
|
});
|
|
22028
22004
|
}
|
|
22029
22005
|
//#endregion
|
|
22030
22006
|
//#region src/lib/server/tables_of_contents.ts
|
|
22031
|
-
async function
|
|
22032
|
-
let i =
|
|
22033
|
-
for await (let e of
|
|
22007
|
+
async function Hi(e, t, n, r) {
|
|
22008
|
+
let i = Ri(await A.readFile(e, { encoding: "utf-8" }), t), a = i.output, o = new D(a), s = await A.readJson(n, { encoding: "utf-8" });
|
|
22009
|
+
for await (let e of oe({
|
|
22034
22010
|
context: o,
|
|
22035
22011
|
tableOfContents: s,
|
|
22036
22012
|
transformation: i
|
|
@@ -22040,8 +22016,8 @@ async function qi(e, t, n, r) {
|
|
|
22040
22016
|
spaces: 2
|
|
22041
22017
|
});
|
|
22042
22018
|
}
|
|
22043
|
-
async function
|
|
22044
|
-
let r =
|
|
22019
|
+
async function Ui(e, t, n) {
|
|
22020
|
+
let r = Ri(await A.readFile(e, { encoding: "utf-8" }), t).output, i = v(r);
|
|
22045
22021
|
await A.writeJson(n, i, {
|
|
22046
22022
|
encoding: "utf-8",
|
|
22047
22023
|
spaces: 2
|
|
@@ -22049,8 +22025,8 @@ async function Ji(e, t, n) {
|
|
|
22049
22025
|
}
|
|
22050
22026
|
//#endregion
|
|
22051
22027
|
//#region src/lib/server/legi/resolvers.ts
|
|
22052
|
-
function
|
|
22053
|
-
return new
|
|
22028
|
+
function Wi({ canutesDb: e }) {
|
|
22029
|
+
return new ie(e);
|
|
22054
22030
|
}
|
|
22055
22031
|
//#endregion
|
|
22056
|
-
export {
|
|
22032
|
+
export { De as LegiResolver, Vi as addLinksOrReferencesToHtmlFile, Hi as addPositionsToTableOfContentsFile, we as buildAndInstallTextTitlesInfos, Ee as buildTextTitlesInfos, Wi as createLegiResolver, Pe as extractAssembleeAmendmentSearchItems, er as extractAssembleeExposesDesMotifs, ar as extractSenatAmendmentSearchItems, Fe as hashAssembleeAmendmentSearchItem, nr as hashAssembleeSearchItem, or as hashSenatAmendmentSearchItem, li as hashSenatSearchItem, hi as isAkomaNtosoXml, rr as isoDateFromAssembleeDocument, Xn as linkAkomaNtosoBillRaw, on as linkAssembleeBillRaw, Yn as parseAkomaNtosoBillRaw, ai as parseAmendment, an as parseAssembleeBillRaw, tr as parseAssembleeDocumentSearchContent, ci as parseSenatDocumentSearchContent, Ri as readTransformation, Gn as renderAkomaNtosoBillRaw, mi as resolveSenatAkomaNtosoSource, Ui as simplifiedHtmlBillFileToTableOfContentsFile, Ni as simplifyWordHtml, Li as simplifyWordHtmlToDocument, Bi as writeTransformation };
|