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