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