@tricoteuses/tisseuse 0.14.15 → 0.14.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -1
- package/dist/{html-C0Rw5Oc_.js → html-Bto5izwe.js} +918 -826
- package/dist/index.js +139 -122
- package/dist/server.js +667 -667
- package/dist/src/lib/index.d.ts +1 -1
- package/dist/src/lib/linkers/cited-article.test.d.ts +1 -0
- package/dist/src/lib/links.d.ts +7 -0
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Dt as
|
|
3
|
-
import * as
|
|
4
|
-
import { createHash as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import { A as e, Ct as t, D as n, E as r, Et as i, L as a, Nt as o, O as s, Pt as c, S as l, St as u, T as d, X as f, Z as p, _ as m, b as h, bt as g, c as _, gt as v, k as y, m as b, n as x, p as ee, q as S, rt as C, s as te, t as ne, tt as re, u as ie, w as ae, x as oe, xt as se } from "./html-Bto5izwe.js";
|
|
2
|
+
import { Dt as w, Et as T, F as ce, N as le, Nt as E, O as ue, Tt as de, ct as fe, et as pe, ht as me, jt as D, k as he, n as ge, o as _e, r as ve, t as ye, vt as O } from "./resolver-CuP8arVX.js";
|
|
3
|
+
import * as be from "node:crypto";
|
|
4
|
+
import { createHash as xe } from "node:crypto";
|
|
5
|
+
import k from "fs-extra";
|
|
6
|
+
import A from "node:path";
|
|
7
7
|
//#region src/lib/server/assemblee_amendment_search.ts
|
|
8
|
-
function
|
|
8
|
+
function Se(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 Se(e) {
|
|
17
|
-
return e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim();
|
|
18
|
-
}
|
|
19
16
|
function Ce(e) {
|
|
20
|
-
return
|
|
17
|
+
return e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim();
|
|
21
18
|
}
|
|
22
19
|
function we(e) {
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
return Ce(C(e).text());
|
|
21
|
+
}
|
|
22
|
+
function Te(e) {
|
|
23
|
+
let t = Ce([
|
|
24
|
+
Se(e, [
|
|
25
25
|
"corps",
|
|
26
26
|
"contenuAuteur",
|
|
27
27
|
"dispositif"
|
|
28
28
|
]),
|
|
29
|
-
|
|
29
|
+
Se(e, [
|
|
30
30
|
"corps",
|
|
31
31
|
"contenuAuteur",
|
|
32
32
|
"dispositifAmdtCreditPLF"
|
|
33
33
|
]),
|
|
34
|
-
|
|
34
|
+
Se(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) => we(e)).join("\n")), n = Se(e, [
|
|
40
40
|
"corps",
|
|
41
41
|
"contenuAuteur",
|
|
42
42
|
"exposeSommaire"
|
|
43
|
-
]), r = n === null ? "" :
|
|
43
|
+
]), r = n === null ? "" : we(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 Ee(e, t) {
|
|
55
|
+
return xe("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 De = /^expos[ée]\s+des\s+motifs\b/iu;
|
|
63
|
+
function j(e) {
|
|
64
64
|
return (e ?? "").replace(/\u00a0/g, " ").replace(/\s+/g, " ").trim();
|
|
65
65
|
}
|
|
66
|
-
function
|
|
67
|
-
return
|
|
68
|
-
}
|
|
69
|
-
function De(e) {
|
|
70
|
-
return oe(M(e));
|
|
66
|
+
function M(e) {
|
|
67
|
+
return j(e).toLowerCase().normalize("NFD").replace(/\p{Diacritic}/gu, "");
|
|
71
68
|
}
|
|
72
69
|
function Oe(e) {
|
|
73
|
-
return
|
|
70
|
+
return g(j(e));
|
|
74
71
|
}
|
|
75
|
-
function ke(e
|
|
76
|
-
return e
|
|
72
|
+
function ke(e) {
|
|
73
|
+
return `_TocArt${Oe(e).replace(/\s+/gu, "")}`;
|
|
77
74
|
}
|
|
78
|
-
function Ae(e) {
|
|
79
|
-
return
|
|
75
|
+
function Ae(e, t) {
|
|
76
|
+
return e(t).closest(".assnatTOC6,.assnatTOC5,.assnatTOC4").length > 0;
|
|
80
77
|
}
|
|
81
78
|
function je(e) {
|
|
82
|
-
return
|
|
79
|
+
return M(e).replace(/[‐‑‒–—]/gu, "-").replace(/\s*\.\s*/gu, ".");
|
|
83
80
|
}
|
|
84
81
|
function Me(e) {
|
|
82
|
+
return je(e).replace(/[^a-z0-9]+/gu, "-").replace(/^-|-$/gu, "");
|
|
83
|
+
}
|
|
84
|
+
function Ne(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 Ne(e) {
|
|
103
|
-
let t = M(e.sourceText), n = /\b(?:ins[ée]r[ée]s?|cr[ée][ée]s?|ajout[ée]s?|compl[ée]t[ée]s?\s+par)\b[\s\S]{0,160}?\barticle\s+(.+?)\s+ainsi\s+r[ée]dig[ée]s?\b/iu.exec(t);
|
|
104
|
-
if (n?.[1] !== void 0) return m(n[1]);
|
|
105
|
-
}
|
|
106
102
|
function Pe(e) {
|
|
107
|
-
let t =
|
|
103
|
+
let t = j(e.sourceText), n = /\b(?:ins[ée]r[ée]s?|cr[ée][ée]s?|ajout[ée]s?|compl[ée]t[ée]s?\s+par)\b[\s\S]{0,160}?\barticle\s+(.+?)\s+ainsi\s+r[ée]dig[ée]s?\b/iu.exec(t);
|
|
104
|
+
if (n?.[1] !== void 0) return se(n[1]);
|
|
105
|
+
}
|
|
106
|
+
function Fe(e) {
|
|
107
|
+
let t = Ne(e), n = v(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 = Pe(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 Ie(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) Ie(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)) Ie(e, t);
|
|
131
131
|
return t;
|
|
132
132
|
}
|
|
133
|
-
function
|
|
134
|
-
let t =
|
|
133
|
+
function Le(e) {
|
|
134
|
+
let t = M(e.sourceText);
|
|
135
135
|
return /\b(?:cree|cree[e]?s?|resultant|issu|prevu|mentionne)\b[\s\S]{0,80}\b(?:present|presente|pjl|projet\s+de\s+loi)\b/u.test(t);
|
|
136
136
|
}
|
|
137
|
-
function
|
|
138
|
-
return
|
|
137
|
+
function Re(e) {
|
|
138
|
+
return j(e).replace(/[’']/gu, "'").replace(/[‐‑‒–—]/gu, "-");
|
|
139
139
|
}
|
|
140
|
-
function
|
|
141
|
-
let n = new
|
|
140
|
+
function ze(e, t) {
|
|
141
|
+
let n = new de(e, t), r = pe(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 Be(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 : ze(e, r);
|
|
153
153
|
}
|
|
154
|
-
function
|
|
154
|
+
function Ve(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 = Be(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 = Be(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 He(e) {
|
|
175
|
+
let t = Ve(Re(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 Ue(e) {
|
|
179
|
+
return M(e).replace(/[’]/gu, "'").replace(/[‐‑‒–—]/gu, "-").replace(/^(?:(?:article\s+[^:]+|[a-z][.)]|[ivxlcdm]+\.|\d+°)\s*(?:-\s*)?)+/iu, "");
|
|
180
180
|
}
|
|
181
|
-
function
|
|
181
|
+
function N(e) {
|
|
182
182
|
return e?.type === "tag";
|
|
183
183
|
}
|
|
184
|
-
function
|
|
184
|
+
function We(e, t) {
|
|
185
185
|
return e.html(t) ?? "";
|
|
186
186
|
}
|
|
187
|
-
function
|
|
187
|
+
function Ge(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 = j(e(i).text());
|
|
196
196
|
n.push({
|
|
197
197
|
id: c,
|
|
198
|
-
...
|
|
198
|
+
...Ke(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 Ke(e, t, n) {
|
|
206
|
+
let r = qe(e, t, n);
|
|
207
207
|
return (r.match(/«/gu) ?? []).length > (r.match(/»/gu) ?? []).length;
|
|
208
208
|
}
|
|
209
|
-
function
|
|
209
|
+
function qe(e, t, n) {
|
|
210
210
|
if (t === n) return "";
|
|
211
211
|
if (t.type === "text") return t.data ?? "";
|
|
212
|
-
if (!
|
|
212
|
+
if (!N(t)) return "";
|
|
213
213
|
let r = "";
|
|
214
214
|
for (let i of e(t).contents().get()) {
|
|
215
215
|
if (i === n) return r;
|
|
216
|
-
if (
|
|
216
|
+
if (N(i) && e.contains(i, n)) return r + qe(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 Je(e, t) {
|
|
222
|
+
return t.map((t) => j(e(t).text())).filter(Boolean).join("\n");
|
|
223
223
|
}
|
|
224
|
-
function
|
|
225
|
-
let t =
|
|
226
|
-
return !t ||
|
|
224
|
+
function Ye(e) {
|
|
225
|
+
let t = M(e);
|
|
226
|
+
return !t || De.test(t) ? "noise" : r.test(e) ? "directive_candidate" : "context";
|
|
227
227
|
}
|
|
228
|
-
async function
|
|
228
|
+
async function Xe(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
231
|
let { output: r } = await x({
|
|
232
232
|
date: n,
|
|
233
233
|
html: e,
|
|
234
|
-
legiResolver: t.legiResolver ?? new
|
|
234
|
+
legiResolver: t.legiResolver ?? new ee(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 Ze(e, t) {
|
|
244
244
|
let n = e(t).closest("h1,h2,h3,h4,h5,h6,p,td,th").get(0), r = e(t).closest("table").get(0);
|
|
245
|
-
return
|
|
245
|
+
return N(r) && N(n) && e(n).parents("table").get(0) === r ? r : N(n) ? n : t;
|
|
246
246
|
}
|
|
247
|
-
function
|
|
247
|
+
function Qe(e, t, n, r) {
|
|
248
248
|
if (t.has(r.container)) return;
|
|
249
|
-
let i = r.id ??
|
|
249
|
+
let i = r.id ?? ke(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,25 +256,25 @@ function Ze(e, t, n, r) {
|
|
|
256
256
|
container: r.container
|
|
257
257
|
}));
|
|
258
258
|
}
|
|
259
|
-
function
|
|
259
|
+
function $e(e) {
|
|
260
260
|
let t = /* @__PURE__ */ new Map();
|
|
261
261
|
return e("body *").each((e, n) => {
|
|
262
262
|
t.set(n, e);
|
|
263
263
|
}), t;
|
|
264
264
|
}
|
|
265
|
-
function
|
|
265
|
+
function P(e, t) {
|
|
266
266
|
return e.get(t) ?? 2 ** 53 - 1;
|
|
267
267
|
}
|
|
268
|
-
function
|
|
268
|
+
function et(e) {
|
|
269
269
|
let t = [], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
270
270
|
e("a[id], span[id], h1[id], h2[id], h3[id], h4[id], h5[id], h6[id]").each((i, a) => {
|
|
271
|
-
if (
|
|
272
|
-
let o =
|
|
271
|
+
if (Ae(e, a)) return;
|
|
272
|
+
let o = u(j(e(a).text()));
|
|
273
273
|
if (!o) return;
|
|
274
274
|
let s = e(a).attr("id");
|
|
275
275
|
if (!s || r.has(s)) return;
|
|
276
|
-
let c =
|
|
277
|
-
|
|
276
|
+
let c = Ze(e, a);
|
|
277
|
+
Qe(t, n, r, {
|
|
278
278
|
id: s,
|
|
279
279
|
...o,
|
|
280
280
|
element: a,
|
|
@@ -282,37 +282,37 @@ function $e(e) {
|
|
|
282
282
|
});
|
|
283
283
|
}), e("h1:not([id]), h2:not([id]), h3:not([id]), h4:not([id]), h5:not([id]), h6:not([id])").each((i, a) => {
|
|
284
284
|
if (n.has(a)) return;
|
|
285
|
-
let o =
|
|
286
|
-
o &&
|
|
285
|
+
let o = u(j(e(a).text()));
|
|
286
|
+
o && Qe(t, n, r, {
|
|
287
287
|
...o,
|
|
288
288
|
element: a,
|
|
289
289
|
container: a
|
|
290
290
|
});
|
|
291
291
|
});
|
|
292
|
-
let i =
|
|
293
|
-
return t.sort((e, t) =>
|
|
292
|
+
let i = $e(e);
|
|
293
|
+
return t.sort((e, t) => P(i, e.container) - P(i, t.container)), t;
|
|
294
294
|
}
|
|
295
|
-
function
|
|
296
|
-
if (
|
|
295
|
+
function tt(e, t) {
|
|
296
|
+
if (Ae(e, t)) return !1;
|
|
297
297
|
let n = t.tagName?.toLowerCase();
|
|
298
298
|
if (n !== "p") return /^h[1-6]$/u.test(n ?? "");
|
|
299
299
|
let r = e(t).attr("style") ?? "", i = e(t).html() ?? "";
|
|
300
300
|
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));
|
|
301
301
|
}
|
|
302
|
-
function
|
|
302
|
+
function nt(e) {
|
|
303
303
|
let t = [], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
304
304
|
return e("p.assnat9ArticleNum,h1,h2,h3,h4,h5,h6,p").each((i, a) => {
|
|
305
|
-
if (
|
|
306
|
-
let o =
|
|
307
|
-
o &&
|
|
305
|
+
if (Ae(e, a) || !e(a).hasClass("assnat9ArticleNum") && !tt(e, a)) return;
|
|
306
|
+
let o = u(e(a).text());
|
|
307
|
+
o && Qe(t, n, r, {
|
|
308
308
|
...o,
|
|
309
309
|
element: a,
|
|
310
310
|
container: a
|
|
311
311
|
});
|
|
312
312
|
}), t;
|
|
313
313
|
}
|
|
314
|
-
function
|
|
315
|
-
let t =
|
|
314
|
+
function rt(e) {
|
|
315
|
+
let t = M(Oe(e ?? "")).replace(/[()]/gu, "").trim();
|
|
316
316
|
if (!t || t === "liminaire") return;
|
|
317
317
|
if (t === "unique") return {
|
|
318
318
|
base: 1,
|
|
@@ -321,21 +321,21 @@ function nt(e) {
|
|
|
321
321
|
};
|
|
322
322
|
let n = /^(?:(\d+)|1er|premier)(?:\s+([a-z]+))?$/u.exec(t);
|
|
323
323
|
if (!n) return;
|
|
324
|
-
let r = n[1] === void 0 ? 1 : Number.parseInt(n[1], 10), i = n[2], a = i === void 0 ? 0 :
|
|
324
|
+
let r = n[1] === void 0 ? 1 : Number.parseInt(n[1], 10), i = n[2], a = i === void 0 ? 0 : it(i);
|
|
325
325
|
if (a !== void 0) return {
|
|
326
326
|
base: r,
|
|
327
327
|
suffixOrder: a,
|
|
328
328
|
text: t
|
|
329
329
|
};
|
|
330
330
|
}
|
|
331
|
-
function
|
|
332
|
-
let t = new
|
|
331
|
+
function it(e) {
|
|
332
|
+
let t = new de(e), n = fe(t);
|
|
333
333
|
if (!(n === void 0 || t.offset !== e.length) && !(typeof n != "object" || !n || !("value" in n) || typeof n.value != "number")) return n.value - 1;
|
|
334
334
|
}
|
|
335
|
-
function
|
|
335
|
+
function at(e) {
|
|
336
336
|
let t = [], n = e.map((e) => ({
|
|
337
337
|
heading: e,
|
|
338
|
-
token:
|
|
338
|
+
token: rt(e.num)
|
|
339
339
|
}));
|
|
340
340
|
n.filter(({ token: e }) => e?.text === "unique").length > 0 && e.length > 1 && t.push("Article unique appears with other articles");
|
|
341
341
|
let r;
|
|
@@ -348,31 +348,31 @@ function it(e) {
|
|
|
348
348
|
}
|
|
349
349
|
t.length > 0 && process.env.TISSEUSE_WARN_ASSEMBLEE_HEADING_SEQUENCE === "1" && console.warn("Incoherent Assemblée article heading sequence", { issues: t });
|
|
350
350
|
}
|
|
351
|
-
function
|
|
352
|
-
let n =
|
|
353
|
-
if (n.length > 0) return t &&
|
|
354
|
-
let r =
|
|
355
|
-
return t &&
|
|
351
|
+
function ot(e, { warn: t = !0 } = {}) {
|
|
352
|
+
let n = et(e);
|
|
353
|
+
if (n.length > 0) return t && at(n), n;
|
|
354
|
+
let r = nt(e);
|
|
355
|
+
return t && at(r), r;
|
|
356
356
|
}
|
|
357
|
-
function
|
|
357
|
+
function st(e) {
|
|
358
358
|
let t = e.next;
|
|
359
359
|
for (; t !== null;) {
|
|
360
|
-
if (
|
|
360
|
+
if (N(t)) return t;
|
|
361
361
|
t = t.next;
|
|
362
362
|
}
|
|
363
363
|
return null;
|
|
364
364
|
}
|
|
365
|
-
function
|
|
365
|
+
function ct(e, t, n, r = $e(e)) {
|
|
366
366
|
let i = [t.container], a = n?.container;
|
|
367
|
-
for (let e =
|
|
367
|
+
for (let e = st(t.container); e !== null && e !== a; e = st(e)) i.push(e);
|
|
368
368
|
if (i.length > 1) return i;
|
|
369
|
-
let o =
|
|
369
|
+
let o = P(r, t.container), s = a ? P(r, a) : -1;
|
|
370
370
|
return e("body > *").get().filter((e) => {
|
|
371
|
-
let t =
|
|
371
|
+
let t = P(r, e);
|
|
372
372
|
return t >= o && (s === -1 || t < s);
|
|
373
373
|
});
|
|
374
374
|
}
|
|
375
|
-
function
|
|
375
|
+
function lt(e, t) {
|
|
376
376
|
let n = [], r = /* @__PURE__ */ new Set();
|
|
377
377
|
for (let i of t) {
|
|
378
378
|
let t = "p,li,table", a = e(i).is(t) ? [i] : e(i).find(t).get();
|
|
@@ -380,105 +380,105 @@ function ct(e, t) {
|
|
|
380
380
|
}
|
|
381
381
|
return n;
|
|
382
382
|
}
|
|
383
|
-
function
|
|
383
|
+
function ut(e, t, n) {
|
|
384
384
|
let r = [], i = !1;
|
|
385
|
-
for (let a of
|
|
386
|
-
let n =
|
|
385
|
+
for (let a of lt(e, n)) {
|
|
386
|
+
let n = j(e(a).text());
|
|
387
387
|
if (!n) continue;
|
|
388
|
-
|
|
389
|
-
let o = i ? "noise" :
|
|
388
|
+
De.test(n) && (i = !0);
|
|
389
|
+
let o = i ? "noise" : Ye(n), s = `${t}-b${r.length + 1}`;
|
|
390
390
|
e(a).attr("data-pjl-parsed-article-id", t), e(a).attr("data-pjl-parsed-block-id", s), r.push({
|
|
391
391
|
id: s,
|
|
392
392
|
articleId: t,
|
|
393
393
|
kind: o,
|
|
394
|
-
links:
|
|
394
|
+
links: Ge(e, a),
|
|
395
395
|
text: n,
|
|
396
|
-
html:
|
|
396
|
+
html: We(e, a)
|
|
397
397
|
});
|
|
398
398
|
}
|
|
399
399
|
return r;
|
|
400
400
|
}
|
|
401
|
-
function
|
|
401
|
+
function dt(e, t) {
|
|
402
402
|
if (t.length === 0) return e;
|
|
403
403
|
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>`;
|
|
404
404
|
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}`;
|
|
405
405
|
}
|
|
406
|
-
function
|
|
407
|
-
let t =
|
|
408
|
-
for (let e of
|
|
409
|
-
let r =
|
|
406
|
+
function ft(e) {
|
|
407
|
+
let t = C(e), n = pt(t);
|
|
408
|
+
for (let e of ot(t, { warn: !1 })) {
|
|
409
|
+
let r = ke(e.num ?? e.label.replace(/^Article\s+/iu, "")), i = t(e.element), a = i.attr("id");
|
|
410
410
|
if (a !== r) {
|
|
411
|
-
if (a?.startsWith("_Toc") && !
|
|
411
|
+
if (a?.startsWith("_Toc") && !ht(n, a, e.element)) {
|
|
412
412
|
let e = t("<span></span>").attr("id", a);
|
|
413
413
|
i.before(e);
|
|
414
414
|
let r = e.get(0);
|
|
415
|
-
|
|
415
|
+
N(r) && F(n, a, r);
|
|
416
416
|
}
|
|
417
|
-
a &&
|
|
417
|
+
a && mt(n, a, e.element), i.attr("id", r), F(n, r, e.element);
|
|
418
418
|
}
|
|
419
419
|
}
|
|
420
|
-
let r =
|
|
420
|
+
let r = ot(t), i = $e(t);
|
|
421
421
|
for (let [e, a] of r.entries()) {
|
|
422
|
-
let o =
|
|
422
|
+
let o = ct(t, a, r[e + 1], i).flatMap((e) => t(e).is("span.alinea[data-alinea]") ? [e] : t(e).find("span.alinea[data-alinea]").get());
|
|
423
423
|
for (let e of o) {
|
|
424
424
|
let r = t(e).attr("data-alinea")?.trim();
|
|
425
425
|
if (!r) continue;
|
|
426
426
|
let i = `${a.id}-alinea-${r.replace(/\s+/gu, "")}`;
|
|
427
|
-
if (
|
|
427
|
+
if (ht(n, i, e)) continue;
|
|
428
428
|
let o = t(e).attr("id");
|
|
429
429
|
if (o && o !== i) {
|
|
430
430
|
let r = t("<span></span>").attr("id", i);
|
|
431
431
|
t(e).before(r);
|
|
432
432
|
let a = r.get(0);
|
|
433
|
-
|
|
434
|
-
} else o &&
|
|
433
|
+
N(a) && F(n, i, a);
|
|
434
|
+
} else o && mt(n, o, e), t(e).attr("id", i), F(n, i, e);
|
|
435
435
|
}
|
|
436
436
|
}
|
|
437
437
|
return t.html();
|
|
438
438
|
}
|
|
439
|
-
function
|
|
439
|
+
function pt(e) {
|
|
440
440
|
let t = /* @__PURE__ */ new Map();
|
|
441
441
|
for (let n of e("[id]").get()) {
|
|
442
442
|
let r = e(n).attr("id");
|
|
443
|
-
r &&
|
|
443
|
+
r && F(t, r, n);
|
|
444
444
|
}
|
|
445
445
|
return t;
|
|
446
446
|
}
|
|
447
|
-
function
|
|
447
|
+
function F(e, t, n) {
|
|
448
448
|
let r = e.get(t);
|
|
449
449
|
r === void 0 && (r = /* @__PURE__ */ new Set(), e.set(t, r)), r.add(n);
|
|
450
450
|
}
|
|
451
|
-
function
|
|
451
|
+
function mt(e, t, n) {
|
|
452
452
|
let r = e.get(t);
|
|
453
453
|
r !== void 0 && (r.delete(n), r.size === 0 && e.delete(t));
|
|
454
454
|
}
|
|
455
|
-
function
|
|
455
|
+
function ht(e, t, n) {
|
|
456
456
|
for (let r of e.get(t) ?? []) if (r !== n) return !0;
|
|
457
457
|
return !1;
|
|
458
458
|
}
|
|
459
|
-
function
|
|
460
|
-
let n =
|
|
459
|
+
function gt(e, t) {
|
|
460
|
+
let n = Ue("sourceText" in t ? t.sourceText : "");
|
|
461
461
|
if (n) return e.filter((e) => e.kind === "directive_candidate").find((e) => {
|
|
462
|
-
let t =
|
|
462
|
+
let t = Ue(e.text);
|
|
463
463
|
return t.length > 0 && (n.includes(t) || t.includes(n));
|
|
464
464
|
});
|
|
465
465
|
}
|
|
466
|
-
function
|
|
466
|
+
function _t(e, t) {
|
|
467
467
|
if (t) return t.blockIds.map((t) => e.get(t)).find((e) => e?.kind === "directive_candidate");
|
|
468
468
|
}
|
|
469
|
-
function
|
|
469
|
+
function vt(e) {
|
|
470
470
|
return e?.links.filter((e) => !e.insideFrenchQuotes && (e.type === "article" || e.type === "division")).map((e) => e.id) ?? [];
|
|
471
471
|
}
|
|
472
|
-
function
|
|
473
|
-
let t =
|
|
472
|
+
function yt(e) {
|
|
473
|
+
let t = j(e);
|
|
474
474
|
if (!t) return;
|
|
475
|
-
let n =
|
|
475
|
+
let n = re(t);
|
|
476
476
|
return n ? n.level : t.endsWith(":") ? 0 : void 0;
|
|
477
477
|
}
|
|
478
|
-
function
|
|
478
|
+
function bt(e) {
|
|
479
479
|
let t = /* @__PURE__ */ new Map(), n = [];
|
|
480
480
|
for (let r of e) {
|
|
481
|
-
let e =
|
|
481
|
+
let e = yt(r.text);
|
|
482
482
|
if (e === void 0) {
|
|
483
483
|
t.set(r.id, [...n.map((e) => e.block), r]);
|
|
484
484
|
continue;
|
|
@@ -491,14 +491,14 @@ function yt(e) {
|
|
|
491
491
|
}
|
|
492
492
|
return t;
|
|
493
493
|
}
|
|
494
|
-
function
|
|
494
|
+
function xt(e, t) {
|
|
495
495
|
let n = [], r = /* @__PURE__ */ new Set();
|
|
496
496
|
for (let i of [...e ?? [], ...t]) i !== void 0 && (r.has(i.id) || (r.add(i.id), n.push(i)));
|
|
497
497
|
return n;
|
|
498
498
|
}
|
|
499
|
-
function
|
|
499
|
+
function St(e, t, n) {
|
|
500
500
|
if (!t) return;
|
|
501
|
-
let r =
|
|
501
|
+
let r = xt(e, t.blockIds.map((e) => n.get(e)).filter((e) => e !== void 0));
|
|
502
502
|
if (r.length === 0) return;
|
|
503
503
|
let i = r.map((e) => e.id);
|
|
504
504
|
if (i.length === t.blockIds.length && i.every((e, n) => e === t.blockIds[n])) return;
|
|
@@ -513,7 +513,7 @@ function xt(e, t, n) {
|
|
|
513
513
|
}
|
|
514
514
|
};
|
|
515
515
|
}
|
|
516
|
-
function
|
|
516
|
+
function Ct(e) {
|
|
517
517
|
let t = [], n = 0;
|
|
518
518
|
for (let r of e.blocks) {
|
|
519
519
|
let i = e.directiveText.indexOf(r.text, n);
|
|
@@ -527,7 +527,7 @@ function St(e) {
|
|
|
527
527
|
}
|
|
528
528
|
return t;
|
|
529
529
|
}
|
|
530
|
-
function
|
|
530
|
+
function wt(e, t, n) {
|
|
531
531
|
let { start: r, stop: i } = n.sourcePosition, a = t.filter((e) => e.stop >= r && e.start <= i);
|
|
532
532
|
if (a.length === 0) return;
|
|
533
533
|
let o = a[0], s = a[a.length - 1], c = o.start, l = s.stop;
|
|
@@ -541,7 +541,7 @@ function Ct(e, t, n) {
|
|
|
541
541
|
}
|
|
542
542
|
};
|
|
543
543
|
}
|
|
544
|
-
function
|
|
544
|
+
function Tt(e, t, n) {
|
|
545
545
|
if (!t) return;
|
|
546
546
|
let r = e.directiveText.indexOf(t.text);
|
|
547
547
|
if (r === -1) return;
|
|
@@ -554,14 +554,14 @@ function wt(e, t, n) {
|
|
|
554
554
|
stop: a
|
|
555
555
|
};
|
|
556
556
|
}
|
|
557
|
-
function
|
|
558
|
-
let n = performance.now(), r = performance.now(), i =
|
|
557
|
+
function Et(e, t) {
|
|
558
|
+
let n = performance.now(), r = performance.now(), i = Ct(e), a = performance.now() - r, o = performance.now(), s = new Map(e.blocks.map((e) => [e.id, e])), c = bt(e.blocks), l = /* @__PURE__ */ new Map(), u = [];
|
|
559
559
|
for (let t of e.blocks) {
|
|
560
|
-
let e =
|
|
560
|
+
let e = vt(t);
|
|
561
561
|
e.length > 0 && (u = e), l.set(t.id, u);
|
|
562
562
|
}
|
|
563
|
-
let d = performance.now() - o, f = performance.now(), p =
|
|
564
|
-
let n =
|
|
563
|
+
let d = performance.now() - o, f = performance.now(), p = b(), h = m(e.directiveText, t === void 0 ? void 0 : p), g = performance.now() - f, _ = performance.now(), v = h.map((t) => {
|
|
564
|
+
let n = wt(e, i, t), r = _t(s, n) ?? gt(e.blocks, t), a = vt(r), o = a.length > 0 ? a : r?.id === void 0 ? [] : l.get(r.id) ?? [], u = Tt(e, r, t), d = St(r?.id === void 0 ? void 0 : c.get(r.id), n, s);
|
|
565
565
|
return {
|
|
566
566
|
articleId: e.id,
|
|
567
567
|
blockId: r?.id,
|
|
@@ -579,7 +579,7 @@ function Tt(e, t) {
|
|
|
579
579
|
directive: t,
|
|
580
580
|
...o.length > 0 ? { targetIds: o } : {}
|
|
581
581
|
};
|
|
582
|
-
}), y = performance.now() -
|
|
582
|
+
}), y = performance.now() - _;
|
|
583
583
|
return t?.push({
|
|
584
584
|
actionDirectiveExtraction: p,
|
|
585
585
|
articleId: e.id,
|
|
@@ -587,19 +587,19 @@ function Tt(e, t) {
|
|
|
587
587
|
buildRangesMs: Math.round(a * 10) / 10,
|
|
588
588
|
directiveCount: v.length,
|
|
589
589
|
directiveTextSize: e.directiveText.length,
|
|
590
|
-
extractActionDirectivesMs: Math.round(
|
|
590
|
+
extractActionDirectivesMs: Math.round(g * 10) / 10,
|
|
591
591
|
mapDirectivesMs: Math.round(y * 10) / 10,
|
|
592
592
|
prepareBlockIndexesMs: Math.round(d * 10) / 10,
|
|
593
593
|
totalMs: Math.round((performance.now() - n) * 10) / 10
|
|
594
594
|
}), v;
|
|
595
595
|
}
|
|
596
|
-
function
|
|
596
|
+
function Dt(e) {
|
|
597
597
|
let t = /* @__PURE__ */ new Map(), n = [], r = /* @__PURE__ */ new Set();
|
|
598
598
|
for (let i of e) {
|
|
599
|
-
let e =
|
|
599
|
+
let e = Fe(i.directive);
|
|
600
600
|
if (e.length === 0) continue;
|
|
601
601
|
let a = e.map(({ num: e }) => ({
|
|
602
|
-
definitionId: `${i.articleId}:article:${
|
|
602
|
+
definitionId: `${i.articleId}:article:${Me(e)}`,
|
|
603
603
|
num: e
|
|
604
604
|
}));
|
|
605
605
|
t.set(i, a);
|
|
@@ -622,13 +622,13 @@ function Et(e) {
|
|
|
622
622
|
definitions: n
|
|
623
623
|
};
|
|
624
624
|
}
|
|
625
|
-
function
|
|
626
|
-
let r = new Map(t.map((e) => [
|
|
625
|
+
function Ot(e, t, n) {
|
|
626
|
+
let r = new Map(t.map((e) => [je(e.num), e]));
|
|
627
627
|
return e.map((e) => {
|
|
628
|
-
let t = n.get(e), i = t?.[0], a = [...
|
|
628
|
+
let t = n.get(e), i = t?.[0], a = [...Ie(e.directive.reference)].map((e) => r.get(je(e))).filter((e) => e !== void 0 && e.definitionId !== i?.definitionId)[0], o = a === void 0 ? void 0 : {
|
|
629
629
|
definitionId: a.definitionId,
|
|
630
630
|
num: a.num
|
|
631
|
-
}, s =
|
|
631
|
+
}, s = Le(e.directive), c = (e.targetIds?.length ?? 0) > 0;
|
|
632
632
|
return {
|
|
633
633
|
...e,
|
|
634
634
|
...i === void 0 ? {} : { createdArticle: i },
|
|
@@ -641,7 +641,7 @@ function Dt(e, t, n) {
|
|
|
641
641
|
};
|
|
642
642
|
});
|
|
643
643
|
}
|
|
644
|
-
function
|
|
644
|
+
function kt(e) {
|
|
645
645
|
switch (e.kind) {
|
|
646
646
|
case "insert_after":
|
|
647
647
|
case "insert_before": return [e.insertText];
|
|
@@ -659,8 +659,8 @@ function Ot(e) {
|
|
|
659
659
|
default: return [];
|
|
660
660
|
}
|
|
661
661
|
}
|
|
662
|
-
function
|
|
663
|
-
return e.flatMap((e) =>
|
|
662
|
+
function At(e) {
|
|
663
|
+
return e.flatMap((e) => kt(e.directive).filter((e) => /[«»]/u.test(e)).map((t) => ({
|
|
664
664
|
code: "nested_french_quote_in_redaction",
|
|
665
665
|
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.",
|
|
666
666
|
details: {
|
|
@@ -672,18 +672,18 @@ function kt(e) {
|
|
|
672
672
|
}
|
|
673
673
|
})));
|
|
674
674
|
}
|
|
675
|
-
function
|
|
676
|
-
return
|
|
675
|
+
function jt(e) {
|
|
676
|
+
return kt(e).map((t) => ({
|
|
677
677
|
directiveKind: e.kind,
|
|
678
678
|
text: t
|
|
679
679
|
}));
|
|
680
680
|
}
|
|
681
|
-
function
|
|
681
|
+
function Mt(e) {
|
|
682
682
|
let t = /* @__PURE__ */ new Set();
|
|
683
683
|
for (let n of e.matchAll(/«[^«»\n]+»/gu)) t.add(n[0]);
|
|
684
684
|
return Array.from(t);
|
|
685
685
|
}
|
|
686
|
-
function
|
|
686
|
+
function Nt(e, t) {
|
|
687
687
|
let n = new Map(e.blocks.map((e) => [e.id, e])), r = t.sourceBlockIds ?? e.blocks.map((e) => e.id), i = [], a = 0;
|
|
688
688
|
for (let e of r) {
|
|
689
689
|
let t = n.get(e);
|
|
@@ -695,11 +695,11 @@ function Mt(e, t) {
|
|
|
695
695
|
}
|
|
696
696
|
return i;
|
|
697
697
|
}
|
|
698
|
-
function
|
|
698
|
+
function Pt(e, t, n) {
|
|
699
699
|
return e.find((e) => t >= e.start && n <= e.stop);
|
|
700
700
|
}
|
|
701
|
-
function
|
|
702
|
-
let r =
|
|
701
|
+
function Ft(e, t, n) {
|
|
702
|
+
let r = Mt(n), i = r.flatMap((t) => {
|
|
703
703
|
for (let n of e.blocks) {
|
|
704
704
|
let e = n.text.indexOf(t);
|
|
705
705
|
if (e !== -1) return [{
|
|
@@ -718,7 +718,7 @@ function Pt(e, t, n) {
|
|
|
718
718
|
e.directiveText
|
|
719
719
|
].filter((e) => e !== void 0 && e.length > 0), o = a.find((e) => r.some((t) => e.includes(t))) ?? a[0];
|
|
720
720
|
if (!o) return [];
|
|
721
|
-
let s =
|
|
721
|
+
let s = Nt(e, t);
|
|
722
722
|
if (s.length === 0) return [];
|
|
723
723
|
let c = [], l = 0;
|
|
724
724
|
for (let e of r) {
|
|
@@ -726,7 +726,7 @@ function Pt(e, t, n) {
|
|
|
726
726
|
if (t === -1) continue;
|
|
727
727
|
let n = t + e.length;
|
|
728
728
|
l = n;
|
|
729
|
-
let r =
|
|
729
|
+
let r = Pt(s, t, n);
|
|
730
730
|
r && c.push({
|
|
731
731
|
blockId: r.block.id,
|
|
732
732
|
start: t - r.start,
|
|
@@ -736,15 +736,15 @@ function Pt(e, t, n) {
|
|
|
736
736
|
}
|
|
737
737
|
return c;
|
|
738
738
|
}
|
|
739
|
-
function
|
|
739
|
+
function It(e, t) {
|
|
740
740
|
let n = new Map(e.map((e) => [e.id, e]));
|
|
741
741
|
return t.flatMap((e) => {
|
|
742
742
|
let t = n.get(e.articleId);
|
|
743
|
-
return t ?
|
|
743
|
+
return t ? jt(e.directive).filter(({ text: e }) => /[«»]/u.test(e)).map(({ directiveKind: n, text: r }) => ({
|
|
744
744
|
articleId: e.articleId,
|
|
745
745
|
code: "nested_french_quote_in_redaction",
|
|
746
746
|
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.",
|
|
747
|
-
ranges:
|
|
747
|
+
ranges: Ft(t, e, r),
|
|
748
748
|
severity: "warning",
|
|
749
749
|
details: {
|
|
750
750
|
blockId: e.blockId,
|
|
@@ -755,13 +755,13 @@ function Ft(e, t) {
|
|
|
755
755
|
})) : [];
|
|
756
756
|
});
|
|
757
757
|
}
|
|
758
|
-
function
|
|
759
|
-
let c = new
|
|
758
|
+
function Lt(e, t, n, r, i, a, o = !0, s) {
|
|
759
|
+
let c = new _e("parsedBill.buildParsedDocument"), l = i.reduce((e, t) => e + t.blocks.length, 0), u = c.timeSync("buildDirectiveText", () => i.map((e) => e.directiveText).filter(Boolean).join("\n")), d = {
|
|
760
760
|
sourceFormat: e,
|
|
761
761
|
documentDate: r,
|
|
762
762
|
html: t,
|
|
763
763
|
htmlWithLinks: n,
|
|
764
|
-
tableOfContents: a ?? c.timeSync("extractTableOfContents", () =>
|
|
764
|
+
tableOfContents: a ?? c.timeSync("extractTableOfContents", () => _(u), { inputSize: u.length }),
|
|
765
765
|
articles: i
|
|
766
766
|
};
|
|
767
767
|
if (!o) {
|
|
@@ -776,29 +776,29 @@ function It(e, t, n, r, i, a, o = !0, s) {
|
|
|
776
776
|
directiveTextSize: u.length
|
|
777
777
|
}), e;
|
|
778
778
|
}
|
|
779
|
-
let f = c.timeSync("extractGlobalApplicabilityDate", () =>
|
|
779
|
+
let f = c.timeSync("extractGlobalApplicabilityDate", () => He(i.map((e) => e.text).join("\n"))), p = [], m = c.timeSync("extractDirectivesFromArticles", () => {
|
|
780
780
|
let e = [];
|
|
781
781
|
for (let t of i) {
|
|
782
|
-
let n =
|
|
782
|
+
let n = Et(t, c.enabled ? p : void 0);
|
|
783
783
|
e.push(...n);
|
|
784
784
|
}
|
|
785
785
|
return e;
|
|
786
|
-
}, { count: i.length }), { createdArticlesByDirective: h, definitions: g } = c.timeSync("buildInternalArticleDefinitions", () =>
|
|
786
|
+
}, { count: i.length }), { createdArticlesByDirective: h, definitions: g } = c.timeSync("buildInternalArticleDefinitions", () => Dt(m), { count: m.length }), v = c.timeSync("attachInternalArticleMetadata", () => Ot(m, g, h), { count: m.length }), y = c.timeSync("collectNestedFrenchQuoteDiagnostics", () => At(v), { count: v.length }), b = [...s ?? [], ...y], x = c.timeSync("collectNestedFrenchQuoteAnnotations", () => It(i, v), { count: v.length }), ee = {
|
|
787
787
|
...d,
|
|
788
788
|
...f ? { globalApplicabilityDate: f } : {},
|
|
789
789
|
...g.length > 0 ? { internalArticleDefinitions: g } : {},
|
|
790
|
-
directives:
|
|
791
|
-
...
|
|
792
|
-
...
|
|
790
|
+
directives: v,
|
|
791
|
+
...x.length > 0 ? { annotations: x } : {},
|
|
792
|
+
...b.length > 0 ? { diagnostics: b } : {}
|
|
793
793
|
};
|
|
794
794
|
return c.log({
|
|
795
|
-
annotationCount:
|
|
795
|
+
annotationCount: x.length,
|
|
796
796
|
articleCount: i.length,
|
|
797
797
|
blockCount: l,
|
|
798
798
|
definitionCount: g.length,
|
|
799
|
-
diagnosticCount:
|
|
799
|
+
diagnosticCount: b.length,
|
|
800
800
|
directiveAnalysisIncluded: !0,
|
|
801
|
-
directiveCount:
|
|
801
|
+
directiveCount: v.length,
|
|
802
802
|
actionDirectiveExtractionTotals: p.reduce((e, t) => ({
|
|
803
803
|
applyApplicabilityDatesMs: e.applyApplicabilityDatesMs + t.actionDirectiveExtraction.applyApplicabilityDatesMs,
|
|
804
804
|
buildListItemTreeMs: e.buildListItemTreeMs + t.actionDirectiveExtraction.buildListItemTreeMs,
|
|
@@ -875,20 +875,20 @@ function It(e, t, n, r, i, a, o = !0, s) {
|
|
|
875
875
|
}),
|
|
876
876
|
directiveTextSize: u.length,
|
|
877
877
|
slowDirectiveArticles: p.toSorted((e, t) => t.totalMs - e.totalMs).slice(0, 10)
|
|
878
|
-
}),
|
|
878
|
+
}), ee;
|
|
879
879
|
}
|
|
880
|
-
function
|
|
880
|
+
function Rt(e) {
|
|
881
881
|
return { items: e.map((e) => ({
|
|
882
882
|
id: e.id,
|
|
883
883
|
line: e.title ? `${e.label} : ${e.title}` : e.label,
|
|
884
884
|
type: "article"
|
|
885
885
|
})) };
|
|
886
886
|
}
|
|
887
|
-
function Rt(e) {
|
|
888
|
-
return Array.from(b(e)).filter((e) => e.type === "article").map((e) => N(e.line.split(/[::]/u)[0]));
|
|
889
|
-
}
|
|
890
887
|
function zt(e) {
|
|
891
|
-
|
|
888
|
+
return Array.from(ie(e)).filter((e) => e.type === "article").map((e) => M(e.line.split(/[::]/u)[0]));
|
|
889
|
+
}
|
|
890
|
+
function Bt(e) {
|
|
891
|
+
let t = zt(_(e.map((e) => e.directiveText).filter(Boolean).join("\n"))), n = e.map((e) => M(e.label)), r = [];
|
|
892
892
|
if (t.length > 0 && (t.length !== n.length || t.some((e, t) => e !== n[t]))) {
|
|
893
893
|
let i = t.findIndex((e, t) => e !== n[t]);
|
|
894
894
|
r.push({
|
|
@@ -909,23 +909,23 @@ function zt(e) {
|
|
|
909
909
|
}
|
|
910
910
|
return {
|
|
911
911
|
diagnostics: r,
|
|
912
|
-
tableOfContents:
|
|
912
|
+
tableOfContents: Rt(e)
|
|
913
913
|
};
|
|
914
914
|
}
|
|
915
|
-
async function
|
|
916
|
-
let n = new
|
|
917
|
-
let n =
|
|
915
|
+
async function Vt(e, t) {
|
|
916
|
+
let n = new _e("parseAssembleeBillRaw"), r = t.linkedHtml === void 0 ? await n.time("linkAssembleeBillRaw", () => Ht(e, t)) : void 0, i = n.timeSync("applyArticleAnchorIds", () => ft(t.linkedHtml ?? r.linkedHtml), { inputSize: e.length }), a = n.timeSync("cheerioLoadLinkedHtml", () => C(i)), o = n.timeSync("extractArticleHeadings", () => ot(a)), s = $e(a), c = n.timeSync("extractArticlesAndBlocks", () => o.map((e, t) => {
|
|
917
|
+
let n = ct(a, e, o[t + 1], s), r = ut(a, e.id, n), i = r.filter((e) => e.kind !== "noise").map((e) => e.text).join("\n");
|
|
918
918
|
return {
|
|
919
919
|
id: e.id,
|
|
920
920
|
label: e.label,
|
|
921
921
|
num: e.num,
|
|
922
922
|
title: e.title,
|
|
923
|
-
text:
|
|
924
|
-
html: n.map((e) =>
|
|
923
|
+
text: Je(a, n),
|
|
924
|
+
html: n.map((e) => We(a, e)).join("\n"),
|
|
925
925
|
directiveText: i,
|
|
926
926
|
blocks: r
|
|
927
927
|
};
|
|
928
|
-
}), { count: o.length }), l = n.timeSync("injectHiddenArticleSummary", () =>
|
|
928
|
+
}), { count: o.length }), l = n.timeSync("injectHiddenArticleSummary", () => dt(a.html(), c)), { diagnostics: u, tableOfContents: d } = n.timeSync("buildAssembleeTableOfContents", () => Bt(c), { count: c.length }), f = n.timeSync("buildParsedDocument", () => Lt("assemblee-html", e, l, t.date, c, d, t.includeDirectiveAnalysis, u));
|
|
929
929
|
return f.diagnostics?.length && process.env.TISSEUSE_WARN_PARSED_BILL_DIAGNOSTICS === "1" && console.warn("Assemblée bill parsing diagnostics", f.diagnostics), n.log({
|
|
930
930
|
articleCount: f.articles.length,
|
|
931
931
|
blockCount: f.articles.reduce((e, t) => e + t.blocks.length, 0),
|
|
@@ -933,18 +933,18 @@ async function Bt(e, t) {
|
|
|
933
933
|
targetDirectiveCount: f.directives.filter((e) => e.targetIds !== void 0).length
|
|
934
934
|
}), f;
|
|
935
935
|
}
|
|
936
|
-
async function
|
|
936
|
+
async function Ht(e, t) {
|
|
937
937
|
return {
|
|
938
938
|
sourceFormat: "assemblee-html",
|
|
939
939
|
documentDate: t.date,
|
|
940
940
|
html: e,
|
|
941
|
-
linkedHtml: await
|
|
941
|
+
linkedHtml: await Xe(e, t, t.date)
|
|
942
942
|
};
|
|
943
943
|
}
|
|
944
|
-
function
|
|
944
|
+
function I(e) {
|
|
945
945
|
return e.replace(/&/gu, "&").replace(/</gu, "<").replace(/>/gu, ">").replace(/"/gu, """);
|
|
946
946
|
}
|
|
947
|
-
function
|
|
947
|
+
function Ut(e) {
|
|
948
948
|
let t = e;
|
|
949
949
|
for (let e = 0; e < 3; e++) {
|
|
950
950
|
let e = t;
|
|
@@ -952,27 +952,27 @@ function Ht(e) {
|
|
|
952
952
|
}
|
|
953
953
|
return t;
|
|
954
954
|
}
|
|
955
|
-
function
|
|
955
|
+
function Wt(e) {
|
|
956
956
|
return /(?:<|&lt;)\/?(?:p|br|span|b|i|u|sup|sub|table|thead|tbody|tr|th|td|ul|ol|li)\b/iu.test(e);
|
|
957
957
|
}
|
|
958
|
-
function
|
|
958
|
+
function L(e) {
|
|
959
959
|
return e.name.replace(/^.*:/u, "");
|
|
960
960
|
}
|
|
961
|
-
function Wt(e, t) {
|
|
962
|
-
return t.children.map((t) => z(e, t)).filter(Boolean).join("");
|
|
963
|
-
}
|
|
964
961
|
function Gt(e, t) {
|
|
965
|
-
return t.children.map((t) =>
|
|
962
|
+
return t.children.map((t) => R(e, t)).filter(Boolean).join("");
|
|
963
|
+
}
|
|
964
|
+
function Kt(e, t) {
|
|
965
|
+
return t.children.map((t) => t.type === "text" && Wt(t.data) ? Ut(t.data) : R(e, t)).filter(Boolean).join("");
|
|
966
966
|
}
|
|
967
|
-
function
|
|
967
|
+
function R(e, t) {
|
|
968
968
|
if (t.type === "text") {
|
|
969
969
|
let e = t.data.replace(/\s+\./gu, ".");
|
|
970
|
-
return
|
|
970
|
+
return Wt(e) ? Ut(e) : I(e);
|
|
971
971
|
}
|
|
972
|
-
if (!
|
|
973
|
-
let n =
|
|
972
|
+
if (!N(t)) return "";
|
|
973
|
+
let n = L(t), r = Gt(e, t);
|
|
974
974
|
switch (n) {
|
|
975
|
-
case "p": return `<p${
|
|
975
|
+
case "p": return `<p${z(e, t, [
|
|
976
976
|
"id",
|
|
977
977
|
"class",
|
|
978
978
|
"align",
|
|
@@ -986,13 +986,13 @@ function z(e, t) {
|
|
|
986
986
|
case "u":
|
|
987
987
|
case "sup":
|
|
988
988
|
case "sub":
|
|
989
|
-
case "abbr": return `<${n}${
|
|
989
|
+
case "abbr": return `<${n}${z(e, t, [
|
|
990
990
|
"id",
|
|
991
991
|
"class",
|
|
992
992
|
"title",
|
|
993
993
|
"style"
|
|
994
994
|
])}>${r}</${n}>`;
|
|
995
|
-
case "a": return `<a href="${
|
|
995
|
+
case "a": return `<a href="${I(e(t).attr("href") ?? e(t).attr("target") ?? "#")}"${z(e, t, [
|
|
996
996
|
"id",
|
|
997
997
|
"class",
|
|
998
998
|
"title",
|
|
@@ -1003,8 +1003,8 @@ function z(e, t) {
|
|
|
1003
1003
|
case "tbody":
|
|
1004
1004
|
case "tr":
|
|
1005
1005
|
case "th":
|
|
1006
|
-
case "td": return
|
|
1007
|
-
case "caption": return `<caption${
|
|
1006
|
+
case "td": return qt(e, t, n, r);
|
|
1007
|
+
case "caption": return `<caption${z(e, t, [
|
|
1008
1008
|
"id",
|
|
1009
1009
|
"class",
|
|
1010
1010
|
"align",
|
|
@@ -1012,12 +1012,12 @@ function z(e, t) {
|
|
|
1012
1012
|
])}>${r}</caption>`;
|
|
1013
1013
|
case "num": return `<span class="akn-num">${r}</span> `;
|
|
1014
1014
|
case "heading": return `<p class="akn-heading">${r}</p>`;
|
|
1015
|
-
case "content": return
|
|
1016
|
-
case "alinea": return
|
|
1017
|
-
case "article": return
|
|
1015
|
+
case "content": return Kt(e, t);
|
|
1016
|
+
case "alinea": return B(e, t, "div", "akn-alinea");
|
|
1017
|
+
case "article": return B(e, t, "article", "akn-article");
|
|
1018
1018
|
case "blockList":
|
|
1019
1019
|
case "list": return `<div class="akn-list">${r}</div>`;
|
|
1020
|
-
case "item": return
|
|
1020
|
+
case "item": return B(e, t, "div", "akn-item");
|
|
1021
1021
|
case "listIntroduction":
|
|
1022
1022
|
case "listWrapUp":
|
|
1023
1023
|
case "intro":
|
|
@@ -1033,23 +1033,23 @@ function z(e, t) {
|
|
|
1033
1033
|
case "book":
|
|
1034
1034
|
case "tome":
|
|
1035
1035
|
case "subchapter":
|
|
1036
|
-
case "subsection": return
|
|
1036
|
+
case "subsection": return B(e, t, "section", `akn-${n}`);
|
|
1037
1037
|
case "crossHeading": return `<p class="akn-cross-heading">${r}</p>`;
|
|
1038
1038
|
default: return r;
|
|
1039
1039
|
}
|
|
1040
1040
|
}
|
|
1041
|
-
function
|
|
1041
|
+
function z(e, t, n, r = {}) {
|
|
1042
1042
|
let i = [];
|
|
1043
1043
|
for (let r of n) {
|
|
1044
1044
|
if (r === "style") continue;
|
|
1045
1045
|
let n = e(t).attr(r);
|
|
1046
|
-
n !== void 0 && i.push(`${r}="${
|
|
1046
|
+
n !== void 0 && i.push(`${r}="${I(n)}"`);
|
|
1047
1047
|
}
|
|
1048
1048
|
let a = r.style ?? e(t).attr("style");
|
|
1049
|
-
return a && i.push(`style="${
|
|
1049
|
+
return a && i.push(`style="${I(a)}"`), i.length > 0 ? ` ${i.join(" ")}` : "";
|
|
1050
1050
|
}
|
|
1051
|
-
function
|
|
1052
|
-
return `<${n}${
|
|
1051
|
+
function qt(e, t, n, r) {
|
|
1052
|
+
return `<${n}${z(e, t, [
|
|
1053
1053
|
"id",
|
|
1054
1054
|
"class",
|
|
1055
1055
|
"colspan",
|
|
@@ -1062,155 +1062,155 @@ function Kt(e, t, n, r) {
|
|
|
1062
1062
|
"cellspacing",
|
|
1063
1063
|
"cellpadding",
|
|
1064
1064
|
"style"
|
|
1065
|
-
], { style:
|
|
1065
|
+
], { style: Jt(e, t, n) })}>${r}</${n}>`;
|
|
1066
1066
|
}
|
|
1067
|
-
function
|
|
1067
|
+
function Jt(e, t, n) {
|
|
1068
1068
|
let r = e(t).attr("style") ?? "";
|
|
1069
|
-
return (n === "td" || n === "th") && /font-weight\s*:\s*bold/iu.test(r) && !/text-align\s*:/iu.test(r) && (r =
|
|
1069
|
+
return (n === "td" || n === "th") && /font-weight\s*:\s*bold/iu.test(r) && !/text-align\s*:/iu.test(r) && (r = Yt(r, "text-align", "center")), r || void 0;
|
|
1070
1070
|
}
|
|
1071
|
-
function
|
|
1071
|
+
function Yt(e, t, n) {
|
|
1072
1072
|
let r = e.trim();
|
|
1073
1073
|
return `${r}${r && !r.endsWith(";") ? ";" : ""} ${t}: ${n};`.trim();
|
|
1074
1074
|
}
|
|
1075
|
-
function Yt(e, t) {
|
|
1076
|
-
let n = [M(e(t).children("num").first().text()), M(e(t).children("heading").first().text())].filter(Boolean);
|
|
1077
|
-
return n.length === 0 ? "" : `<p class="akn-heading">${L(n.join(" "))}</p>`;
|
|
1078
|
-
}
|
|
1079
1075
|
function Xt(e, t) {
|
|
1076
|
+
let n = [j(e(t).children("num").first().text()), j(e(t).children("heading").first().text())].filter(Boolean);
|
|
1077
|
+
return n.length === 0 ? "" : `<p class="akn-heading">${I(n.join(" "))}</p>`;
|
|
1078
|
+
}
|
|
1079
|
+
function Zt(e, t) {
|
|
1080
1080
|
if (!t) return !1;
|
|
1081
|
-
let n = (e) =>
|
|
1082
|
-
return n(
|
|
1081
|
+
let n = (e) => j(e).replace(/\s+/gu, " ").replace(/\s*[..]\s*(?=[–—-])/gu, " ").trim();
|
|
1082
|
+
return n(j(e.replace(/<[^>]*>/gu, " ").replace(/ /gu, " ").replace(/ /giu, " ").replace(/–/giu, "–"))).startsWith(n(t));
|
|
1083
1083
|
}
|
|
1084
|
-
function
|
|
1085
|
-
let t =
|
|
1084
|
+
function Qt(e) {
|
|
1085
|
+
let t = I(e);
|
|
1086
1086
|
return `<p data-pastille="${t}" class="pastille"><span aria-label="pastille ${t}">${t}</span></p>`;
|
|
1087
1087
|
}
|
|
1088
|
-
function
|
|
1089
|
-
return
|
|
1088
|
+
function $t(e, t) {
|
|
1089
|
+
return en([tn({
|
|
1090
1090
|
content: e,
|
|
1091
1091
|
pastille: t
|
|
1092
1092
|
})]);
|
|
1093
1093
|
}
|
|
1094
|
-
function
|
|
1094
|
+
function en(e) {
|
|
1095
1095
|
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>`;
|
|
1096
1096
|
}
|
|
1097
|
-
function
|
|
1098
|
-
let i = n ? ` style="${
|
|
1099
|
-
return `<tr${r ? ` class="${
|
|
1097
|
+
function tn({ content: e, pastille: t, style: n, contextClass: r }) {
|
|
1098
|
+
let i = n ? ` style="${I(n)}"` : "", a = r ? ` ${I(r)}` : "";
|
|
1099
|
+
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}">${Qt(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>`;
|
|
1100
1100
|
}
|
|
1101
|
-
function
|
|
1102
|
-
let r = t ? ` style="${
|
|
1103
|
-
return `<tr${n ? ` class="${
|
|
1104
|
-
}
|
|
1105
|
-
function nn(e, t) {
|
|
1106
|
-
return e(t).attr("data:pastille") ?? e(t).attr("pastille");
|
|
1101
|
+
function nn({ content: e, style: t, contextClass: n }) {
|
|
1102
|
+
let r = t ? ` style="${I(t)}"` : "", i = n ? ` ${I(n)}` : "";
|
|
1103
|
+
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>`;
|
|
1107
1104
|
}
|
|
1108
1105
|
function rn(e, t) {
|
|
1109
|
-
return e(t).
|
|
1106
|
+
return e(t).attr("data:pastille") ?? e(t).attr("pastille");
|
|
1110
1107
|
}
|
|
1111
1108
|
function an(e, t) {
|
|
1112
|
-
return e(t).
|
|
1109
|
+
return e(t).find("alinea[data\\:pastille],alinea[pastille]").length > 0;
|
|
1113
1110
|
}
|
|
1114
1111
|
function on(e, t) {
|
|
1112
|
+
return e(t).children().get().filter((e) => N(e) ? L(e) === "content" : !1).map((t) => R(e, t)).filter(Boolean).join("\n");
|
|
1113
|
+
}
|
|
1114
|
+
function sn(e, t) {
|
|
1115
1115
|
let n = [];
|
|
1116
1116
|
return e(t).children().each((t, r) => {
|
|
1117
|
-
if (!
|
|
1118
|
-
let i =
|
|
1119
|
-
i === "num" || i === "heading" || i === "content" || n.push(
|
|
1117
|
+
if (!N(r)) return;
|
|
1118
|
+
let i = L(r);
|
|
1119
|
+
i === "num" || i === "heading" || i === "content" || n.push(R(e, r));
|
|
1120
1120
|
}), n.filter(Boolean);
|
|
1121
1121
|
}
|
|
1122
|
-
function
|
|
1123
|
-
let n = [], r =
|
|
1122
|
+
function cn(e, t) {
|
|
1123
|
+
let n = [], r = L(t), i = r === "alinea" ? rn(e, t) : void 0, a = on(e, t), o = ln(e, t, r, i), s = hn(e, t);
|
|
1124
1124
|
if (i) {
|
|
1125
|
-
let r = [
|
|
1126
|
-
|
|
1125
|
+
let r = [Zt(a, j(e(t).children("num").first().text())) ? "" : Xt(e, t), a].filter(Boolean).join("\n");
|
|
1126
|
+
j(r) && n.push(tn({
|
|
1127
1127
|
content: r,
|
|
1128
1128
|
pastille: i,
|
|
1129
1129
|
style: o,
|
|
1130
1130
|
contextClass: s
|
|
1131
1131
|
}));
|
|
1132
|
-
} else a && n.push(
|
|
1132
|
+
} else a && n.push(nn({
|
|
1133
1133
|
content: a,
|
|
1134
1134
|
style: o,
|
|
1135
1135
|
contextClass: s
|
|
1136
1136
|
}));
|
|
1137
1137
|
for (let r of e(t).children().get()) {
|
|
1138
|
-
if (!
|
|
1139
|
-
let t =
|
|
1140
|
-
t === "num" || t === "heading" || t === "content" || (t === "alinea" ||
|
|
1138
|
+
if (!N(r)) continue;
|
|
1139
|
+
let t = L(r);
|
|
1140
|
+
t === "num" || t === "heading" || t === "content" || (t === "alinea" || an(e, r)) && n.push(...cn(e, r));
|
|
1141
1141
|
}
|
|
1142
1142
|
return n;
|
|
1143
1143
|
}
|
|
1144
|
-
function
|
|
1145
|
-
let i =
|
|
1146
|
-
a ? `id="${
|
|
1144
|
+
function B(e, t, n, r) {
|
|
1145
|
+
let i = L(t), a = e(t).attr("eId") ?? e(t).attr("GUID"), o = rn(e, t), s = ln(e, t, i, o), c = [`<${n} ${[
|
|
1146
|
+
a ? `id="${I(a)}"` : void 0,
|
|
1147
1147
|
`class="${r}"`,
|
|
1148
|
-
o ? `data-pastille="${
|
|
1149
|
-
s ? `style="${
|
|
1148
|
+
o ? `data-pastille="${I(o)}"` : void 0,
|
|
1149
|
+
s ? `style="${I(s)}"` : void 0
|
|
1150
1150
|
].filter((e) => e !== void 0).join(" ")}>`];
|
|
1151
1151
|
if (i === "part" || i === "title") {
|
|
1152
|
-
let r =
|
|
1152
|
+
let r = fn(e, t, i), a = mn(e, t), o = r ? [nn({
|
|
1153
1153
|
content: r,
|
|
1154
1154
|
contextClass: a
|
|
1155
1155
|
})] : [], s = () => {
|
|
1156
|
-
o.length !== 0 && (c.push(
|
|
1156
|
+
o.length !== 0 && (c.push(dn(o)), o = []);
|
|
1157
1157
|
};
|
|
1158
1158
|
return e(t).children().each((t, n) => {
|
|
1159
|
-
if (!
|
|
1160
|
-
let r =
|
|
1159
|
+
if (!N(n)) return;
|
|
1160
|
+
let r = L(n);
|
|
1161
1161
|
if (!(r === "num" || r === "heading" || r === "content")) {
|
|
1162
1162
|
if (r === "alinea") {
|
|
1163
|
-
o.push(...
|
|
1163
|
+
o.push(...cn(e, n));
|
|
1164
1164
|
return;
|
|
1165
1165
|
}
|
|
1166
|
-
s(), c.push(
|
|
1166
|
+
s(), c.push(R(e, n));
|
|
1167
1167
|
}
|
|
1168
1168
|
}), s(), c.push(`</${n}>`), c.join("\n");
|
|
1169
1169
|
}
|
|
1170
1170
|
if (i === "article") {
|
|
1171
|
-
let r =
|
|
1171
|
+
let r = j(e(t).children("num").first().text()), i = j(e(t).children("heading").first().text()), a = u(r) ?? {
|
|
1172
1172
|
label: r,
|
|
1173
1173
|
num: r
|
|
1174
|
-
}, o = `<p class="TCNumArticle as-text toc-article dispositif" id="${
|
|
1175
|
-
if (
|
|
1176
|
-
let r = [
|
|
1174
|
+
}, 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>`;
|
|
1175
|
+
if (an(e, t)) {
|
|
1176
|
+
let r = [nn({
|
|
1177
1177
|
content: o,
|
|
1178
|
-
contextClass:
|
|
1179
|
-
}), ...
|
|
1180
|
-
c.push(
|
|
1181
|
-
for (let n of
|
|
1178
|
+
contextClass: _n(a.label)
|
|
1179
|
+
}), ...cn(e, t)];
|
|
1180
|
+
c.push(en(r));
|
|
1181
|
+
for (let n of sn(e, t)) n.includes("akn-pastille-table") || c.push(n);
|
|
1182
1182
|
return c.push(`</${n}>`), c.join("\n");
|
|
1183
1183
|
}
|
|
1184
1184
|
c.push(o);
|
|
1185
1185
|
}
|
|
1186
1186
|
let l = [];
|
|
1187
1187
|
for (let n of ["content", "children"]) e(t).children().each((t, r) => {
|
|
1188
|
-
if (!
|
|
1189
|
-
let i =
|
|
1190
|
-
i === "num" || i === "heading" || n === "content" && i !== "content" || n === "children" && i === "content" || l.push(
|
|
1188
|
+
if (!N(r)) return;
|
|
1189
|
+
let i = L(r);
|
|
1190
|
+
i === "num" || i === "heading" || n === "content" && i !== "content" || n === "children" && i === "content" || l.push(R(e, r));
|
|
1191
1191
|
});
|
|
1192
|
-
let
|
|
1192
|
+
let d = l.join("\n");
|
|
1193
1193
|
if (i !== "article") {
|
|
1194
|
-
let n =
|
|
1194
|
+
let n = Zt(d, j(e(t).children("num").first().text())) ? "" : Xt(e, t);
|
|
1195
1195
|
n && c.push(n);
|
|
1196
1196
|
}
|
|
1197
|
-
return c.push(o ?
|
|
1197
|
+
return c.push(o ? $t(d, o) : d), c.push(`</${n}>`), c.join("\n");
|
|
1198
1198
|
}
|
|
1199
|
-
function
|
|
1200
|
-
let i =
|
|
1201
|
-
return !r && n !== "article" && /font-weight\s*:\s*bold/iu.test(i) && !/text-align\s*:/iu.test(i) && (i =
|
|
1199
|
+
function ln(e, t, n, r) {
|
|
1200
|
+
let i = un(e(t).attr("style") ?? "", "font-family");
|
|
1201
|
+
return !r && n !== "article" && /font-weight\s*:\s*bold/iu.test(i) && !/text-align\s*:/iu.test(i) && (i = Yt(i, "text-align", "center")), i || void 0;
|
|
1202
1202
|
}
|
|
1203
|
-
function
|
|
1203
|
+
function un(e, t) {
|
|
1204
1204
|
return e.split(";").map((e) => e.trim()).filter(Boolean).filter((e) => !e.toLowerCase().startsWith(`${t.toLowerCase()}:`)).join(";");
|
|
1205
1205
|
}
|
|
1206
|
-
function
|
|
1206
|
+
function dn(e) {
|
|
1207
1207
|
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>`;
|
|
1208
1208
|
}
|
|
1209
|
-
function
|
|
1210
|
-
let r =
|
|
1211
|
-
return r && o.push(`<p class="${a.num} as-text dispositif"><span aria-label="">${
|
|
1209
|
+
function fn(e, t, n) {
|
|
1210
|
+
let r = j(e(t).children("num").first().text()), i = j(e(t).children("heading").first().text()), a = pn(n), o = [];
|
|
1211
|
+
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");
|
|
1212
1212
|
}
|
|
1213
|
-
function
|
|
1213
|
+
function pn(e) {
|
|
1214
1214
|
switch (e) {
|
|
1215
1215
|
case "part": return {
|
|
1216
1216
|
num: "TCNumPartie",
|
|
@@ -1234,22 +1234,22 @@ function fn(e) {
|
|
|
1234
1234
|
};
|
|
1235
1235
|
}
|
|
1236
1236
|
}
|
|
1237
|
-
function
|
|
1238
|
-
let n =
|
|
1237
|
+
function mn(e, t) {
|
|
1238
|
+
let n = gn(j(e(t).children("num").first().text()));
|
|
1239
1239
|
if (n) return n;
|
|
1240
1240
|
for (let n of e(t).parents().get()) {
|
|
1241
|
-
if (!
|
|
1242
|
-
let t =
|
|
1241
|
+
if (!N(n)) continue;
|
|
1242
|
+
let t = L(n);
|
|
1243
1243
|
if (t !== "title" && t !== "part") continue;
|
|
1244
|
-
let r =
|
|
1244
|
+
let r = gn(j(e(n).children("num").first().text()));
|
|
1245
1245
|
if (r) return r;
|
|
1246
1246
|
}
|
|
1247
1247
|
}
|
|
1248
|
-
function
|
|
1249
|
-
return
|
|
1248
|
+
function hn(e, t) {
|
|
1249
|
+
return mn(e, t);
|
|
1250
1250
|
}
|
|
1251
|
-
function
|
|
1252
|
-
let [t, ...n] =
|
|
1251
|
+
function gn(e) {
|
|
1252
|
+
let [t, ...n] = j(e).split(/\s+/u);
|
|
1253
1253
|
if (!t || n.length === 0) return;
|
|
1254
1254
|
let r = t.toLocaleLowerCase("fr-FR");
|
|
1255
1255
|
if ([
|
|
@@ -1259,10 +1259,10 @@ function hn(e) {
|
|
|
1259
1259
|
"section"
|
|
1260
1260
|
].includes(r)) return `${r}-${n.join("_")}`;
|
|
1261
1261
|
}
|
|
1262
|
-
function gn(e) {
|
|
1263
|
-
return `article-${M(e).replace(/^Article\s+/iu, "").replace(/\s+/gu, "_")} article`;
|
|
1264
|
-
}
|
|
1265
1262
|
function _n(e) {
|
|
1263
|
+
return `article-${j(e).replace(/^Article\s+/iu, "").replace(/\s+/gu, "_")} article`;
|
|
1264
|
+
}
|
|
1265
|
+
function vn(e) {
|
|
1266
1266
|
switch (e) {
|
|
1267
1267
|
case "part": return "partie";
|
|
1268
1268
|
case "book": return "livre";
|
|
@@ -1274,11 +1274,11 @@ function _n(e) {
|
|
|
1274
1274
|
default: return;
|
|
1275
1275
|
}
|
|
1276
1276
|
}
|
|
1277
|
-
function vn(e, t) {
|
|
1278
|
-
return [M(e(t).children("num").first().text()), M(e(t).children("heading").first().text())].filter(Boolean).join(" ");
|
|
1279
|
-
}
|
|
1280
1277
|
function yn(e, t) {
|
|
1281
|
-
|
|
1278
|
+
return [j(e(t).children("num").first().text()), j(e(t).children("heading").first().text())].filter(Boolean).join(" ");
|
|
1279
|
+
}
|
|
1280
|
+
function bn(e, t) {
|
|
1281
|
+
let n = j(e(t).children("num").first().text()), r = j(e(t).children("heading").first().text()), i = u(n) ?? {
|
|
1282
1282
|
label: n,
|
|
1283
1283
|
num: n
|
|
1284
1284
|
};
|
|
@@ -1288,24 +1288,24 @@ function yn(e, t) {
|
|
|
1288
1288
|
type: "article"
|
|
1289
1289
|
};
|
|
1290
1290
|
}
|
|
1291
|
-
function
|
|
1291
|
+
function xn(e, t) {
|
|
1292
1292
|
e.items.push(...t.items);
|
|
1293
1293
|
}
|
|
1294
|
-
function
|
|
1294
|
+
function Sn(e, t) {
|
|
1295
1295
|
let n = { items: [] };
|
|
1296
1296
|
return e(t).children().each((t, r) => {
|
|
1297
|
-
if (!
|
|
1298
|
-
let i =
|
|
1297
|
+
if (!N(r)) return;
|
|
1298
|
+
let i = L(r);
|
|
1299
1299
|
if (i === "article") {
|
|
1300
|
-
n.items.push(
|
|
1300
|
+
n.items.push(bn(e, r));
|
|
1301
1301
|
return;
|
|
1302
1302
|
}
|
|
1303
|
-
let a =
|
|
1303
|
+
let a = vn(i);
|
|
1304
1304
|
if (!a) {
|
|
1305
|
-
|
|
1305
|
+
xn(n, Sn(e, r));
|
|
1306
1306
|
return;
|
|
1307
1307
|
}
|
|
1308
|
-
let o =
|
|
1308
|
+
let o = yn(e, r), s = Sn(e, r);
|
|
1309
1309
|
!o && s.items.length === 0 || n.items.push({
|
|
1310
1310
|
...s,
|
|
1311
1311
|
id: e(r).attr("eId") ?? e(r).attr("GUID"),
|
|
@@ -1314,26 +1314,26 @@ function xn(e, t) {
|
|
|
1314
1314
|
});
|
|
1315
1315
|
}), n;
|
|
1316
1316
|
}
|
|
1317
|
-
function
|
|
1317
|
+
function Cn(e) {
|
|
1318
1318
|
let t = e("body").first().get(0);
|
|
1319
|
-
return t === void 0 ? { items: [] } :
|
|
1319
|
+
return t === void 0 ? { items: [] } : Sn(e, t);
|
|
1320
1320
|
}
|
|
1321
|
-
function
|
|
1321
|
+
function wn(e) {
|
|
1322
1322
|
return e("FRBRExpression FRBRdate[name=\"#depot\"]").attr("date") ?? e("FRBRWork FRBRdate[name=\"#presentation\"]").attr("date");
|
|
1323
1323
|
}
|
|
1324
|
-
function
|
|
1324
|
+
function Tn(e) {
|
|
1325
1325
|
let t = e("preamble").first(), n = e("body").first(), r = ["<div class=\"akn-bill\">"];
|
|
1326
|
-
return t.length > 0 && (r.push("<section class=\"akn-preamble\">"), r.push(
|
|
1327
|
-
|
|
1326
|
+
return t.length > 0 && (r.push("<section class=\"akn-preamble\">"), r.push(Gt(e, t.get(0))), r.push("</section>")), r.push("<section class=\"akn-body\">"), n.children().each((t, n) => {
|
|
1327
|
+
N(n) && r.push(L(n) === "article" ? B(e, n, "article", "akn-article") : R(e, n));
|
|
1328
1328
|
}), r.push("</section></div>"), r.join("\n");
|
|
1329
1329
|
}
|
|
1330
|
-
function
|
|
1331
|
-
let t =
|
|
1330
|
+
function En(e) {
|
|
1331
|
+
let t = C(e, { xml: {
|
|
1332
1332
|
decodeEntities: !1,
|
|
1333
1333
|
lowerCaseTags: !1,
|
|
1334
1334
|
lowerCaseAttributeNames: !1,
|
|
1335
1335
|
xmlMode: !0
|
|
1336
|
-
} }), n =
|
|
1336
|
+
} }), n = wn(t), r = Tn(t);
|
|
1337
1337
|
return {
|
|
1338
1338
|
sourceFormat: "akoma-ntoso",
|
|
1339
1339
|
documentDate: n,
|
|
@@ -1341,42 +1341,42 @@ function Tn(e) {
|
|
|
1341
1341
|
linkedHtml: r
|
|
1342
1342
|
};
|
|
1343
1343
|
}
|
|
1344
|
-
function En(e) {
|
|
1345
|
-
return Dn(S(e));
|
|
1346
|
-
}
|
|
1347
1344
|
function Dn(e) {
|
|
1345
|
+
return On(C(e));
|
|
1346
|
+
}
|
|
1347
|
+
function On(e) {
|
|
1348
1348
|
let t = [];
|
|
1349
1349
|
return e("article.akn-article").each((n, r) => {
|
|
1350
|
-
let i = e(r).children("p.TCNumArticle").first().get(0), a =
|
|
1350
|
+
let i = e(r).children("p.TCNumArticle").first().get(0), a = j(i ? e(i).text() : ""), o = u(a) ?? { label: a || `Article ${n + 1}` }, s = e(r).attr("id") ?? `akn-article-${String(n + 1).padStart(3, "0")}`, c = [r], l = ut(e, s, c), d = l.filter((e) => e.kind !== "noise").map((e) => e.text).join("\n");
|
|
1351
1351
|
t.push({
|
|
1352
1352
|
id: s,
|
|
1353
1353
|
label: o.label,
|
|
1354
1354
|
num: o.num,
|
|
1355
1355
|
title: o.title,
|
|
1356
|
-
text:
|
|
1357
|
-
html:
|
|
1358
|
-
directiveText:
|
|
1356
|
+
text: Je(e, c),
|
|
1357
|
+
html: We(e, r),
|
|
1358
|
+
directiveText: d,
|
|
1359
1359
|
blocks: l
|
|
1360
1360
|
});
|
|
1361
1361
|
}), t;
|
|
1362
1362
|
}
|
|
1363
|
-
function
|
|
1364
|
-
let t =
|
|
1363
|
+
function kn(e) {
|
|
1364
|
+
let t = C(e);
|
|
1365
1365
|
return {
|
|
1366
|
-
articles:
|
|
1366
|
+
articles: On(t),
|
|
1367
1367
|
htmlWithLinks: t.html()
|
|
1368
1368
|
};
|
|
1369
1369
|
}
|
|
1370
|
-
async function
|
|
1371
|
-
let n = new
|
|
1370
|
+
async function An(e, t) {
|
|
1371
|
+
let n = new _e("parseAkomaNtosoBillRaw"), r = n.timeSync("cheerioLoadXml", () => C(e, { xml: {
|
|
1372
1372
|
decodeEntities: !1,
|
|
1373
1373
|
lowerCaseTags: !1,
|
|
1374
1374
|
lowerCaseAttributeNames: !1,
|
|
1375
1375
|
xmlMode: !0
|
|
1376
|
-
} })), i = t.date ??
|
|
1376
|
+
} })), i = t.date ?? wn(r), a = n.timeSync("renderAknHtml", () => Tn(r), { inputSize: e.length }), o = t.linkedHtml ?? await n.time("addLinksToRenderedAknHtml", () => Xe(a, {
|
|
1377
1377
|
...t,
|
|
1378
1378
|
date: i
|
|
1379
|
-
}, i)), s = n.timeSync("extractRenderedAknArticles", () =>
|
|
1379
|
+
}, i)), s = n.timeSync("extractRenderedAknArticles", () => Dn(a)), c = n.timeSync("injectHiddenArticleSummary", () => dt(o, s)), { articles: l, htmlWithLinks: u } = n.timeSync("extractLinkedAknArticlesAndTaggedHtml", () => kn(c)), d = l.length > 0 ? l : s, f = n.timeSync("extractAknTableOfContents", () => Cn(r)), p = n.timeSync("buildParsedDocument", () => Lt("akoma-ntoso", a, l.length > 0 ? u : c, i, d, f, t.includeDirectiveAnalysis));
|
|
1380
1380
|
return n.log({
|
|
1381
1381
|
articleCount: p.articles.length,
|
|
1382
1382
|
blockCount: p.articles.reduce((e, t) => e + t.blocks.length, 0),
|
|
@@ -1384,25 +1384,25 @@ async function kn(e, t) {
|
|
|
1384
1384
|
targetDirectiveCount: p.directives.filter((e) => e.targetIds !== void 0).length
|
|
1385
1385
|
}), p;
|
|
1386
1386
|
}
|
|
1387
|
-
async function
|
|
1388
|
-
let n =
|
|
1387
|
+
async function jn(e, t) {
|
|
1388
|
+
let n = En(e), r = t.date ?? n.documentDate;
|
|
1389
1389
|
return {
|
|
1390
1390
|
sourceFormat: "akoma-ntoso",
|
|
1391
1391
|
documentDate: r,
|
|
1392
1392
|
html: n.html,
|
|
1393
|
-
linkedHtml: await
|
|
1393
|
+
linkedHtml: await Xe(n.html, t, r)
|
|
1394
1394
|
};
|
|
1395
1395
|
}
|
|
1396
1396
|
//#endregion
|
|
1397
1397
|
//#region src/lib/server/assemblee_document_search.ts
|
|
1398
|
-
var
|
|
1399
|
-
function
|
|
1398
|
+
var Mn = /\bexpos[ée]\s+des\s+motifs\b/giu, Nn = /\barticle\s+(?:premier|1er|\d+)/iu;
|
|
1399
|
+
function Pn(e) {
|
|
1400
1400
|
return e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim();
|
|
1401
1401
|
}
|
|
1402
|
-
function
|
|
1403
|
-
let t =
|
|
1402
|
+
function Fn(e) {
|
|
1403
|
+
let t = Pn(C(e).text()), n = [...t.matchAll(Mn)], r = /* @__PURE__ */ new Set(), i = [];
|
|
1404
1404
|
for (let [e, a] of n.entries()) {
|
|
1405
|
-
let o = (a.index ?? 0) + a[0].length, s = t.slice(o), c =
|
|
1405
|
+
let o = (a.index ?? 0) + a[0].length, s = t.slice(o), c = Nn.exec(s), l = Pn(s.slice(0, c?.index ?? s.length));
|
|
1406
1406
|
if (l.length < 20 || r.has(l)) continue;
|
|
1407
1407
|
r.add(l);
|
|
1408
1408
|
let u = `expose-des-motifs-${e + 1}`;
|
|
@@ -1418,8 +1418,8 @@ function Pn(e) {
|
|
|
1418
1418
|
}
|
|
1419
1419
|
return i;
|
|
1420
1420
|
}
|
|
1421
|
-
async function
|
|
1422
|
-
let i = await
|
|
1421
|
+
async function In({ date: e, html: t, linkBaseUrl: n, linkType: r }) {
|
|
1422
|
+
let i = await Vt(t, {
|
|
1423
1423
|
date: e,
|
|
1424
1424
|
includeDirectiveAnalysis: !1,
|
|
1425
1425
|
linkBaseUrl: n,
|
|
@@ -1428,7 +1428,7 @@ async function Fn({ date: e, html: t, linkBaseUrl: n, linkType: r }) {
|
|
|
1428
1428
|
});
|
|
1429
1429
|
return {
|
|
1430
1430
|
items: [...i.articles.map((e) => {
|
|
1431
|
-
let t =
|
|
1431
|
+
let t = Pn(e.directiveText || e.text);
|
|
1432
1432
|
if (t) return {
|
|
1433
1433
|
anchor: e.id,
|
|
1434
1434
|
articleNumber: e.num ?? null,
|
|
@@ -1438,17 +1438,17 @@ async function Fn({ date: e, html: t, linkBaseUrl: n, linkType: r }) {
|
|
|
1438
1438
|
label: e.label,
|
|
1439
1439
|
title: e.title ?? null
|
|
1440
1440
|
};
|
|
1441
|
-
}).filter((e) => e !== void 0), ...
|
|
1441
|
+
}).filter((e) => e !== void 0), ...Fn(t)],
|
|
1442
1442
|
tableOfContents: i.tableOfContents
|
|
1443
1443
|
};
|
|
1444
1444
|
}
|
|
1445
|
-
function
|
|
1446
|
-
return
|
|
1445
|
+
function Ln(e, t) {
|
|
1446
|
+
return xe("sha256").update(JSON.stringify({
|
|
1447
1447
|
item: e,
|
|
1448
1448
|
metadata: t
|
|
1449
1449
|
})).digest("hex");
|
|
1450
1450
|
}
|
|
1451
|
-
function
|
|
1451
|
+
function Rn(e) {
|
|
1452
1452
|
if (typeof e != "object" || !e) return;
|
|
1453
1453
|
let t = e.cycleDeVie?.chrono;
|
|
1454
1454
|
if (t !== void 0) for (let e of [
|
|
@@ -1463,11 +1463,11 @@ function Ln(e) {
|
|
|
1463
1463
|
}
|
|
1464
1464
|
//#endregion
|
|
1465
1465
|
//#region src/lib/server/senat_amendment_search.ts
|
|
1466
|
-
function
|
|
1467
|
-
return e?.trim() ?
|
|
1466
|
+
function zn(e) {
|
|
1467
|
+
return e?.trim() ? C(e).text().replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim() : "";
|
|
1468
1468
|
}
|
|
1469
|
-
function
|
|
1470
|
-
let n =
|
|
1469
|
+
function Bn({ dispositifHtml: e, objetHtml: t }) {
|
|
1470
|
+
let n = zn(e), r = zn(t);
|
|
1471
1471
|
return [...n ? [{
|
|
1472
1472
|
content: n,
|
|
1473
1473
|
itemKind: "dispositif",
|
|
@@ -1478,233 +1478,233 @@ function zn({ dispositifHtml: e, objetHtml: t }) {
|
|
|
1478
1478
|
label: "Objet"
|
|
1479
1479
|
}] : []];
|
|
1480
1480
|
}
|
|
1481
|
-
function
|
|
1482
|
-
return
|
|
1481
|
+
function Vn(e, t) {
|
|
1482
|
+
return xe("sha256").update(JSON.stringify({
|
|
1483
1483
|
item: e,
|
|
1484
1484
|
metadata: t
|
|
1485
1485
|
})).digest("hex");
|
|
1486
1486
|
}
|
|
1487
1487
|
//#endregion
|
|
1488
1488
|
//#region src/lib/text_parsers/amendment_action_directives.ts
|
|
1489
|
-
function
|
|
1489
|
+
function V(e, t) {
|
|
1490
1490
|
return {
|
|
1491
1491
|
...t,
|
|
1492
1492
|
position: e.position(),
|
|
1493
1493
|
type: "amendment_action_directive"
|
|
1494
1494
|
};
|
|
1495
1495
|
}
|
|
1496
|
-
function
|
|
1496
|
+
function Hn(e, t) {
|
|
1497
1497
|
return {
|
|
1498
1498
|
type: e === "start" ? "head_of_target" : "tail_after_target",
|
|
1499
|
-
unit: t ?
|
|
1499
|
+
unit: t ? l(t) : "article"
|
|
1500
1500
|
};
|
|
1501
1501
|
}
|
|
1502
|
-
function
|
|
1502
|
+
function Un(e) {
|
|
1503
1503
|
return e === "start" ? "insert_before" : "insert_after";
|
|
1504
1504
|
}
|
|
1505
|
-
var
|
|
1505
|
+
var Wn = D(E("[\\s\\S]*?(?=supprimer|substituer|remplacer|ins[eé]rer|compl[eé]ter|r[eé]diger)", { flags: "i" }), { default: "" }), H = T(t, w([E("les?\\s+", { flags: "i" }), i], { value: (e) => e[1] }), i, a), Gn = T(w([E("la\\s+fin\\s+de\\s+", { flags: "i" }), H], { value: (e) => {
|
|
1506
1506
|
let t = e[1];
|
|
1507
1507
|
return {
|
|
1508
1508
|
targetReference: t,
|
|
1509
1509
|
targetScope: {
|
|
1510
1510
|
type: "tail_after_target",
|
|
1511
|
-
unit:
|
|
1511
|
+
unit: l(t)
|
|
1512
1512
|
}
|
|
1513
1513
|
};
|
|
1514
|
-
} }),
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1514
|
+
} }), w([oe], { value: (e) => ({ targetScope: e[0] }) })), U = D(w([
|
|
1515
|
+
D(E("(?:[aà]\\s+la\\s+fin\\s+(?:du|de\\s+la|de\\s+l['’]?)\\s*)", { flags: "i" }), { default: "" }),
|
|
1516
|
+
D(E("(?:au\\s+d[eé]but\\s+d(?:u|e\\s+la|e\\s+l['’]?)\\s*)", { flags: "i" }), { default: "" }),
|
|
1517
|
+
H,
|
|
1518
|
+
D(E("\\s*,?\\s*(?:(?:[IVXLCDM]+)\\s*[.\\-–—]+\\s*|\\d+°\\s*|[a-z]\\)\\s*)?", { flags: "i" }), { default: "" })
|
|
1519
1519
|
], { value: (e, t) => ({
|
|
1520
1520
|
reference: e[2],
|
|
1521
1521
|
text: t.text()
|
|
1522
|
-
}) }), { default: null }),
|
|
1523
|
-
function
|
|
1522
|
+
}) }), { default: null }), Kn = D(E(`(?:(?:[aà]\\s+)?la\\s+(?:derni(?:ère|ere)|${me})\\s+occurrence\\s+)`, { flags: "i" }), { default: "" });
|
|
1523
|
+
function W(e) {
|
|
1524
1524
|
return e?.text ?? "";
|
|
1525
1525
|
}
|
|
1526
|
-
function
|
|
1527
|
-
return { citation:
|
|
1526
|
+
function G(e) {
|
|
1527
|
+
return { citation: p(e.position()) };
|
|
1528
1528
|
}
|
|
1529
|
-
var
|
|
1529
|
+
var K = T(w([S], { value: (e) => ({ citation: e[0] }) }), E("\\S[\\s\\S]*", { value: (e, t) => G(t) })), qn = E("\\S[\\s\\S]*", { value: (e, t) => G(t) }), q = E("[^:«“\"]*(?::\\s*)?", { flags: "i" }), Jn = E("\\S[\\s\\S]*?(?=\\s+par\\s+(?:les?\\s+)?(?:mots?|montants?|taux|références?|mentions?|dates?|années?)\\s*:)", {
|
|
1530
1530
|
flags: "i",
|
|
1531
|
-
value: (e, t) =>
|
|
1532
|
-
}),
|
|
1531
|
+
value: (e, t) => G(t)
|
|
1532
|
+
}), Yn = E("\\S[\\s\\S]*?(?=\\s+(?:ins[eé]rer|ajouter|supprimer|r[eé]diger)\\b)", {
|
|
1533
1533
|
flags: "i",
|
|
1534
|
-
value: (e, t) =>
|
|
1535
|
-
}),
|
|
1534
|
+
value: (e, t) => G(t)
|
|
1535
|
+
}), Xn = E("\\S[\\s\\S]*?(?=\\s*(?:(?:[IVXLCDM]+)\\s*[.\\-–—]+\\s*|\\d+°\\s*|[a-z]\\)\\s*|$))", {
|
|
1536
1536
|
flags: "i",
|
|
1537
|
-
value: (e, t) =>
|
|
1538
|
-
}),
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
], { value: (e) => e[2] }),
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1537
|
+
value: (e, t) => G(t)
|
|
1538
|
+
}), Zn = T(w([S], { value: (e) => ({ citation: e[0] }) }), Jn), Qn = T(w([S], { value: (e) => ({ citation: e[0] }) }), Xn), $n = w([E(`${d}s?\\s*:?\\s*`, { flags: "i" }), Zn], { value: (e) => e[1] }), er = w([E(`${ae}s?(?: suivant(?:e)?s?)?\\s*:?\\s*`, { flags: "i" }), Qn], { value: (e) => e[1] }), tr = T(w([S], { value: (e) => ({ citation: e[0] }) }), Yn), nr = w([
|
|
1539
|
+
Kn,
|
|
1540
|
+
E(`${d}s?\\s*:?\\s*`, { flags: "i" }),
|
|
1541
|
+
tr
|
|
1542
|
+
], { value: (e) => e[2] }), rr = w([
|
|
1543
|
+
Kn,
|
|
1544
|
+
E(`${d}s?\\s*:?\\s*`, { flags: "i" }),
|
|
1545
|
+
T(w([S], { value: (e) => ({ citation: e[0] }) }), qn)
|
|
1546
1546
|
], { value: (e) => e[2] });
|
|
1547
|
-
function
|
|
1547
|
+
function J(e) {
|
|
1548
1548
|
return e?.reference;
|
|
1549
1549
|
}
|
|
1550
|
-
var
|
|
1550
|
+
var ir = w([Wn, E("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e, t) => V(t, {
|
|
1551
1551
|
contextText: e[0],
|
|
1552
1552
|
kind: "delete_article"
|
|
1553
|
-
}) }),
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
], { value: (e, t) =>
|
|
1559
|
-
contextText:
|
|
1553
|
+
}) }), ar = w([
|
|
1554
|
+
U,
|
|
1555
|
+
E("supprimer", { flags: "i" }),
|
|
1556
|
+
D(w([O, H], { value: (e) => e[1] }), { default: null }),
|
|
1557
|
+
D(w([O, rr], { value: (e) => e[1] }), { default: null })
|
|
1558
|
+
], { value: (e, t) => V(t, {
|
|
1559
|
+
contextText: W(e[0]),
|
|
1560
1560
|
kind: "delete_portion",
|
|
1561
1561
|
targetCitation: e[3]?.citation ?? void 0,
|
|
1562
|
-
targetReference: e[2] ??
|
|
1563
|
-
}) }),
|
|
1564
|
-
|
|
1565
|
-
E(
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
], { value: (e, t) =>
|
|
1569
|
-
contextText:
|
|
1562
|
+
targetReference: e[2] ?? J(e[0])
|
|
1563
|
+
}) }), or = w([
|
|
1564
|
+
U,
|
|
1565
|
+
T(E("r[eé]diger\\s+ainsi", { flags: "i" }), E("r[eé]tablir", { flags: "i" })),
|
|
1566
|
+
q,
|
|
1567
|
+
K
|
|
1568
|
+
], { value: (e, t) => V(t, {
|
|
1569
|
+
contextText: W(e[0]),
|
|
1570
1570
|
kind: "rewrite_portion",
|
|
1571
1571
|
replacementCitation: e[3].citation,
|
|
1572
|
-
targetReference:
|
|
1573
|
-
}) }),
|
|
1574
|
-
|
|
1575
|
-
E(
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
], { value: (e, t) =>
|
|
1583
|
-
contextText:
|
|
1572
|
+
targetReference: J(e[0])
|
|
1573
|
+
}) }), sr = w([
|
|
1574
|
+
U,
|
|
1575
|
+
T(E("substituer", { flags: "i" }), E("remplacer", { flags: "i" })),
|
|
1576
|
+
O,
|
|
1577
|
+
Kn,
|
|
1578
|
+
$n,
|
|
1579
|
+
E("\\s*,?\\s*"),
|
|
1580
|
+
D(E("par\\s+", { flags: "i" }), { default: "" }),
|
|
1581
|
+
er
|
|
1582
|
+
], { value: (e, t) => V(t, {
|
|
1583
|
+
contextText: W(e[0]),
|
|
1584
1584
|
kind: "replace",
|
|
1585
1585
|
replacementCitation: e[7].citation,
|
|
1586
1586
|
targetCitation: e[4].citation,
|
|
1587
|
-
targetReference:
|
|
1588
|
-
}) }),
|
|
1589
|
-
W,
|
|
1590
|
-
D("substituer", { flags: "i" }),
|
|
1591
|
-
k,
|
|
1592
|
-
O(D("(?:[aà]|aux?|à la)\\s+", { flags: "i" }), { default: "" }),
|
|
1587
|
+
targetReference: J(e[0])
|
|
1588
|
+
}) }), cr = w([
|
|
1593
1589
|
U,
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
], {
|
|
1597
|
-
|
|
1590
|
+
E("substituer", { flags: "i" }),
|
|
1591
|
+
O,
|
|
1592
|
+
D(E("(?:[aà]|aux?|à la)\\s+", { flags: "i" }), { default: "" }),
|
|
1593
|
+
H,
|
|
1594
|
+
E("[\\s\\S]*?(?=[«“\"]|$)"),
|
|
1595
|
+
K
|
|
1596
|
+
], { value: (e, t) => V(t, {
|
|
1597
|
+
contextText: W(e[0]),
|
|
1598
1598
|
kind: "rewrite_portion",
|
|
1599
1599
|
replacementCitation: e[6].citation,
|
|
1600
|
-
targetReference: e[4] ??
|
|
1601
|
-
}) }),
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
], { value: (e, t) =>
|
|
1600
|
+
targetReference: e[4] ?? J(e[0])
|
|
1601
|
+
}) }), lr = w([
|
|
1602
|
+
y,
|
|
1603
|
+
O,
|
|
1604
|
+
E("l['’ ]article", { flags: "i" }),
|
|
1605
|
+
E("[\\s\\S]*?(?=ins[eé]rer)", { flags: "i" }),
|
|
1606
|
+
E("ins[eé]rer", { flags: "i" }),
|
|
1607
|
+
q,
|
|
1608
|
+
K
|
|
1609
|
+
], { value: (e, t) => V(t, {
|
|
1610
1610
|
contextText: "",
|
|
1611
1611
|
insertCitation: e[6].citation,
|
|
1612
1612
|
kind: e[0] === "before" ? "insert_article_before" : "insert_article_after"
|
|
1613
|
-
}) }),
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
E(
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
], { value: (e,
|
|
1613
|
+
}) }), ur = w([
|
|
1614
|
+
y,
|
|
1615
|
+
O,
|
|
1616
|
+
H,
|
|
1617
|
+
E("[\\s\\S]*?(?=ins[eé]rer|ajouter)", { flags: "i" }),
|
|
1618
|
+
T(E("ins[eé]rer", { flags: "i" }), E("ajouter", { flags: "i" })),
|
|
1619
|
+
q,
|
|
1620
|
+
K
|
|
1621
|
+
], { value: (e, t) => V(t, {
|
|
1622
1622
|
contextText: "",
|
|
1623
1623
|
insertCitation: e[6].citation,
|
|
1624
|
-
kind:
|
|
1624
|
+
kind: s(e[0]),
|
|
1625
1625
|
targetReference: e[2]
|
|
1626
|
-
}) }),
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
], { value: (e,
|
|
1626
|
+
}) }), dr = w([
|
|
1627
|
+
y,
|
|
1628
|
+
O,
|
|
1629
|
+
E("l['’ ]alin[eé]a", { flags: "i" }),
|
|
1630
|
+
E("[\\s\\S]*?(?=ins[eé]rer)", { flags: "i" }),
|
|
1631
|
+
E("ins[eé]rer", { flags: "i" }),
|
|
1632
|
+
q,
|
|
1633
|
+
K
|
|
1634
|
+
], { value: (e, t) => V(t, {
|
|
1635
1635
|
contextText: "",
|
|
1636
1636
|
insertCitation: e[6].citation,
|
|
1637
|
-
kind:
|
|
1638
|
-
}) }),
|
|
1639
|
-
|
|
1637
|
+
kind: s(e[0])
|
|
1638
|
+
}) }), fr = w([
|
|
1639
|
+
U,
|
|
1640
1640
|
n,
|
|
1641
|
-
|
|
1642
|
-
E(
|
|
1643
|
-
|
|
1644
|
-
|
|
1641
|
+
E("[\\s\\S]*?(?=ins[eé]rer|ajouter)", { flags: "i" }),
|
|
1642
|
+
T(E("ins[eé]rer", { flags: "i" }), E("ajouter", { flags: "i" })),
|
|
1643
|
+
q,
|
|
1644
|
+
K
|
|
1645
1645
|
], { value: (e, t) => {
|
|
1646
|
-
let n = e[0], r =
|
|
1647
|
-
return
|
|
1648
|
-
contextText:
|
|
1646
|
+
let n = e[0], r = J(n), i = e[1];
|
|
1647
|
+
return V(t, {
|
|
1648
|
+
contextText: W(n),
|
|
1649
1649
|
insertCitation: e[5].citation,
|
|
1650
|
-
kind:
|
|
1650
|
+
kind: Un(i),
|
|
1651
1651
|
targetReference: r,
|
|
1652
|
-
targetScope:
|
|
1652
|
+
targetScope: Hn(i, r)
|
|
1653
1653
|
});
|
|
1654
|
-
} }),
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
], { value: (e,
|
|
1664
|
-
contextText:
|
|
1654
|
+
} }), pr = w([
|
|
1655
|
+
U,
|
|
1656
|
+
y,
|
|
1657
|
+
O,
|
|
1658
|
+
nr,
|
|
1659
|
+
E("[\\s\\S]*?(?=ins[eé]rer)"),
|
|
1660
|
+
E("ins[eé]rer", { flags: "i" }),
|
|
1661
|
+
O,
|
|
1662
|
+
er
|
|
1663
|
+
], { value: (e, t) => V(t, {
|
|
1664
|
+
contextText: W(e[0]),
|
|
1665
1665
|
insertCitation: e[7].citation,
|
|
1666
|
-
kind:
|
|
1666
|
+
kind: s(e[1]),
|
|
1667
1667
|
targetCitation: e[3].citation,
|
|
1668
|
-
targetReference:
|
|
1669
|
-
}) }),
|
|
1670
|
-
W,
|
|
1671
|
-
s,
|
|
1672
|
-
k,
|
|
1668
|
+
targetReference: J(e[0])
|
|
1669
|
+
}) }), mr = w([
|
|
1673
1670
|
U,
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
], {
|
|
1679
|
-
|
|
1671
|
+
y,
|
|
1672
|
+
O,
|
|
1673
|
+
H,
|
|
1674
|
+
E("[\\s\\S]*?(?=ins[eé]rer|ajouter)", { flags: "i" }),
|
|
1675
|
+
T(E("ins[eé]rer", { flags: "i" }), E("ajouter", { flags: "i" })),
|
|
1676
|
+
q,
|
|
1677
|
+
K
|
|
1678
|
+
], { value: (e, t) => V(t, {
|
|
1679
|
+
contextText: W(e[0]),
|
|
1680
1680
|
insertCitation: e[7].citation,
|
|
1681
|
-
kind:
|
|
1682
|
-
targetReference:
|
|
1683
|
-
}) }),
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1681
|
+
kind: s(e[1]),
|
|
1682
|
+
targetReference: J(e[0]) ?? e[3]
|
|
1683
|
+
}) }), hr = T(fr, lr, ur, dr, cr, w([
|
|
1684
|
+
U,
|
|
1685
|
+
y,
|
|
1686
|
+
O,
|
|
1687
|
+
nr,
|
|
1688
|
+
E("[\\s\\S]*?(?=supprimer|r[eé]diger)", { flags: "i" }),
|
|
1689
|
+
T(w([
|
|
1690
|
+
E("supprimer", {
|
|
1691
1691
|
flags: "i",
|
|
1692
1692
|
value: "delete_portion"
|
|
1693
1693
|
}),
|
|
1694
|
-
|
|
1695
|
-
|
|
1694
|
+
O,
|
|
1695
|
+
Gn
|
|
1696
1696
|
], { value: (e) => ({
|
|
1697
1697
|
kind: e[0],
|
|
1698
1698
|
...e[2]
|
|
1699
|
-
}) }),
|
|
1700
|
-
|
|
1699
|
+
}) }), w([
|
|
1700
|
+
E("r[eé]diger\\s+ainsi", {
|
|
1701
1701
|
flags: "i",
|
|
1702
1702
|
value: "rewrite_portion"
|
|
1703
1703
|
}),
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1704
|
+
O,
|
|
1705
|
+
Gn,
|
|
1706
|
+
q,
|
|
1707
|
+
K
|
|
1708
1708
|
], { value: (e) => ({
|
|
1709
1709
|
kind: e[0],
|
|
1710
1710
|
replacementCitation: e[4].citation,
|
|
@@ -1712,49 +1712,49 @@ var rr = T([Un, D("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e,
|
|
|
1712
1712
|
}) }))
|
|
1713
1713
|
], { value: (e, t) => {
|
|
1714
1714
|
let n = e[5];
|
|
1715
|
-
return
|
|
1716
|
-
contextText:
|
|
1715
|
+
return V(t, {
|
|
1716
|
+
contextText: W(e[0]),
|
|
1717
1717
|
kind: n.kind,
|
|
1718
1718
|
replacementCitation: n.replacementCitation,
|
|
1719
1719
|
targetCitation: e[3].citation,
|
|
1720
|
-
targetReference:
|
|
1720
|
+
targetReference: J(e[0]) ?? n.targetReference,
|
|
1721
1721
|
targetScope: n.targetScope
|
|
1722
1722
|
});
|
|
1723
|
-
} }),
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
], { value: (e,
|
|
1723
|
+
} }), pr, mr, w([
|
|
1724
|
+
Wn,
|
|
1725
|
+
E("ins[eé]rer", { flags: "i" }),
|
|
1726
|
+
E(`[\\s\\S]*?(?=${e})`, { flags: "i" }),
|
|
1727
|
+
y,
|
|
1728
|
+
q,
|
|
1729
|
+
S,
|
|
1730
|
+
q,
|
|
1731
|
+
S
|
|
1732
|
+
], { value: (e, t) => V(t, {
|
|
1733
1733
|
contextText: e[0],
|
|
1734
1734
|
insertCitation: e[8],
|
|
1735
|
-
kind:
|
|
1735
|
+
kind: s(e[3]),
|
|
1736
1736
|
targetCitation: e[6]
|
|
1737
|
-
}) }),
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
], { value: (e, t) =>
|
|
1744
|
-
contextText:
|
|
1737
|
+
}) }), sr, or, w([
|
|
1738
|
+
U,
|
|
1739
|
+
E("compl[eé]ter", { flags: "i" }),
|
|
1740
|
+
D(w([O, H], { value: (e) => e[1] }), { default: null }),
|
|
1741
|
+
q,
|
|
1742
|
+
K
|
|
1743
|
+
], { value: (e, t) => V(t, {
|
|
1744
|
+
contextText: W(e[0]),
|
|
1745
1745
|
insertCitation: e[4].citation,
|
|
1746
1746
|
kind: "insert_after",
|
|
1747
|
-
targetReference: e[2] ??
|
|
1748
|
-
}) }),
|
|
1747
|
+
targetReference: e[2] ?? J(e[0])
|
|
1748
|
+
}) }), ir, ar);
|
|
1749
1749
|
//#endregion
|
|
1750
1750
|
//#region src/lib/server/parsed_amendments.ts
|
|
1751
|
-
function
|
|
1751
|
+
function gr(e) {
|
|
1752
1752
|
return e.replace(/\s+/gu, " ").trim();
|
|
1753
1753
|
}
|
|
1754
|
-
function
|
|
1755
|
-
return e.split(/\n/gu).map(
|
|
1754
|
+
function _r(e) {
|
|
1755
|
+
return e.split(/\n/gu).map(gr).filter(Boolean).join("\n");
|
|
1756
1756
|
}
|
|
1757
|
-
function
|
|
1757
|
+
function vr(e, t) {
|
|
1758
1758
|
let { start: n, stop: r } = t;
|
|
1759
1759
|
for (; n < r && /\s/u.test(e[n]);) n++;
|
|
1760
1760
|
for (; r > n && /\s/u.test(e[r - 1]);) r--;
|
|
@@ -1763,16 +1763,16 @@ function _r(e, t) {
|
|
|
1763
1763
|
stop: r
|
|
1764
1764
|
} : null;
|
|
1765
1765
|
}
|
|
1766
|
-
function
|
|
1767
|
-
return
|
|
1766
|
+
function yr(e, t) {
|
|
1767
|
+
return ce(le(e), t);
|
|
1768
1768
|
}
|
|
1769
|
-
function
|
|
1769
|
+
function br(e) {
|
|
1770
1770
|
return e === "before_article" || e === "on_article" || e === "after_article" ? e : "unknown";
|
|
1771
1771
|
}
|
|
1772
|
-
function
|
|
1772
|
+
function xr(e) {
|
|
1773
1773
|
return {
|
|
1774
1774
|
articleLabel: e.targetArticleLabel ?? null,
|
|
1775
|
-
targetPosition:
|
|
1775
|
+
targetPosition: br(e.targetPosition),
|
|
1776
1776
|
alinea: e.targetAlinea ?? null,
|
|
1777
1777
|
alineaLabel: e.targetAlineaLabel ?? null,
|
|
1778
1778
|
subdivisionSourceId: e.targetSubdivisionSourceId ?? null,
|
|
@@ -1780,75 +1780,75 @@ function br(e) {
|
|
|
1780
1780
|
subpos: e.targetSubpos ?? null
|
|
1781
1781
|
};
|
|
1782
1782
|
}
|
|
1783
|
-
function
|
|
1783
|
+
function Y(e) {
|
|
1784
1784
|
return {
|
|
1785
1785
|
...e.originalTransformation === void 0 ? {} : { sourceOriginalTransformation: e.originalTransformation },
|
|
1786
1786
|
sourcePosition: e.position,
|
|
1787
1787
|
sourceText: e.text
|
|
1788
1788
|
};
|
|
1789
1789
|
}
|
|
1790
|
-
function
|
|
1790
|
+
function Sr(e) {
|
|
1791
1791
|
return {
|
|
1792
1792
|
...e.originalTransformation === void 0 ? {} : { sourceOriginalTransformation: e.originalTransformation },
|
|
1793
1793
|
sourcePosition: e.position,
|
|
1794
1794
|
sourceText: e.text
|
|
1795
1795
|
};
|
|
1796
1796
|
}
|
|
1797
|
-
function
|
|
1797
|
+
function Cr(e) {
|
|
1798
1798
|
return {
|
|
1799
1799
|
...e?.originalTransformation === void 0 ? {} : { dispositifOriginalTransformation: e.originalTransformation },
|
|
1800
1800
|
...e === null ? {} : { dispositifPosition: e.position },
|
|
1801
1801
|
dispositifText: e?.text ?? null
|
|
1802
1802
|
};
|
|
1803
1803
|
}
|
|
1804
|
-
function
|
|
1804
|
+
function X(e, t, n, r = _r(e.slice(n.start, n.stop))) {
|
|
1805
1805
|
return {
|
|
1806
|
-
originalTransformation:
|
|
1806
|
+
originalTransformation: yr(t, n),
|
|
1807
1807
|
position: n,
|
|
1808
1808
|
text: r
|
|
1809
1809
|
};
|
|
1810
1810
|
}
|
|
1811
|
-
function
|
|
1811
|
+
function wr(e) {
|
|
1812
1812
|
let t = e.dispositifHtml ?? e.dispositifText;
|
|
1813
1813
|
if (!t) return null;
|
|
1814
|
-
let n = e.dispositifHtml ?
|
|
1814
|
+
let n = e.dispositifHtml ? ue()(t) : he(t), r = n.output, i = vr(r, {
|
|
1815
1815
|
start: 0,
|
|
1816
1816
|
stop: r.length
|
|
1817
1817
|
});
|
|
1818
1818
|
return {
|
|
1819
|
-
dispositif: i === null ? null :
|
|
1819
|
+
dispositif: i === null ? null : X(r, n, i),
|
|
1820
1820
|
simplifiedText: r,
|
|
1821
1821
|
transformation: n
|
|
1822
1822
|
};
|
|
1823
1823
|
}
|
|
1824
|
-
function
|
|
1824
|
+
function Z(e) {
|
|
1825
1825
|
if (!e) return [];
|
|
1826
|
-
if (e.type === "enumeration") return [...
|
|
1826
|
+
if (e.type === "enumeration") return [...Z(e.left), ...Z(e.right)];
|
|
1827
1827
|
if (e.type === "bounded-interval") {
|
|
1828
|
-
let t =
|
|
1828
|
+
let t = Z(e.first)[0], n = Z(e.last)[0];
|
|
1829
1829
|
return t !== void 0 && n !== void 0 && n >= t ? Array.from({ length: n - t + 1 }, (e, n) => t + n) : [t, n].filter((e) => e !== void 0);
|
|
1830
1830
|
}
|
|
1831
1831
|
if (e.type === "counted-interval") {
|
|
1832
|
-
let t =
|
|
1832
|
+
let t = Z(e.first)[0];
|
|
1833
1833
|
return t === void 0 ? [] : Array.from({ length: e.count }, (e, n) => t + n);
|
|
1834
1834
|
}
|
|
1835
|
-
if (e.type === "exclusion") return
|
|
1836
|
-
for (let t of
|
|
1835
|
+
if (e.type === "exclusion") return Z(e.left);
|
|
1836
|
+
for (let t of o(e)) if (t.type === "alinéa" && typeof t.index == "number" && t.index > 0) return [t.index];
|
|
1837
1837
|
return [];
|
|
1838
1838
|
}
|
|
1839
|
-
function
|
|
1840
|
-
let n =
|
|
1839
|
+
function Tr(e, t) {
|
|
1840
|
+
let n = Z(t);
|
|
1841
1841
|
return {
|
|
1842
1842
|
...e,
|
|
1843
1843
|
alinea: n[0] ?? e.alinea ?? null,
|
|
1844
1844
|
...n.length > 0 ? { alineas: n } : {}
|
|
1845
1845
|
};
|
|
1846
1846
|
}
|
|
1847
|
-
function
|
|
1847
|
+
function Er(e) {
|
|
1848
1848
|
return e.replace(/^\s*(?:[IVXLCDM]+)\s*(?:\.\s*)?[-–—]\s*/iu, "").replace(/^\s*(?:\d+°|[a-z]\))\s*/iu, "").trim();
|
|
1849
1849
|
}
|
|
1850
|
-
function
|
|
1851
|
-
let n = /^alin[eé]as?\s+(?:(\d+)|1er|premier)\b/iu.exec(
|
|
1850
|
+
function Dr(e, t) {
|
|
1851
|
+
let n = /^alin[eé]as?\s+(?:(\d+)|1er|premier)\b/iu.exec(Er(t.text));
|
|
1852
1852
|
if (!n) return null;
|
|
1853
1853
|
let r = n[1] === void 0 ? 1 : Number.parseInt(n[1], 10);
|
|
1854
1854
|
return !Number.isFinite(r) || r < 1 ? null : {
|
|
@@ -1857,25 +1857,25 @@ function Er(e, t) {
|
|
|
1857
1857
|
alineas: [r]
|
|
1858
1858
|
};
|
|
1859
1859
|
}
|
|
1860
|
-
function
|
|
1860
|
+
function Or(e, t) {
|
|
1861
1861
|
if (e) return e.unit === "article" && t.alinea !== null ? {
|
|
1862
1862
|
...e,
|
|
1863
1863
|
unit: "alinéa"
|
|
1864
1864
|
} : e;
|
|
1865
1865
|
}
|
|
1866
|
-
function
|
|
1867
|
-
return /^(?:apr[eè]s|avant|(?:au|a[uù])\s+d[eé]but|(?:a|à)\s+la\s+fin)\b/iu.test(
|
|
1866
|
+
function kr(e) {
|
|
1867
|
+
return /^(?:apr[eè]s|avant|(?:au|a[uù])\s+d[eé]but|(?:a|à)\s+la\s+fin)\b/iu.test(Er(e.text));
|
|
1868
1868
|
}
|
|
1869
|
-
function
|
|
1870
|
-
return
|
|
1869
|
+
function Ar(e, t, n, r) {
|
|
1870
|
+
return X(e, t, {
|
|
1871
1871
|
start: n.position.start,
|
|
1872
1872
|
stop: r.position.stop
|
|
1873
1873
|
});
|
|
1874
1874
|
}
|
|
1875
|
-
function
|
|
1875
|
+
function jr(e) {
|
|
1876
1876
|
return /^\s*(?:[IVXLCDM]+)\s*(?:\.\s*)?[-–—]\s*(?!alin[eé]a\b)/iu.test(e.text);
|
|
1877
1877
|
}
|
|
1878
|
-
function
|
|
1878
|
+
function Mr(e, t) {
|
|
1879
1879
|
let n = { ...t.position };
|
|
1880
1880
|
function r(t) {
|
|
1881
1881
|
let r = t.exec(e.slice(n.start, n.stop));
|
|
@@ -1884,39 +1884,39 @@ function jr(e, t) {
|
|
|
1884
1884
|
stop: n.stop
|
|
1885
1885
|
});
|
|
1886
1886
|
}
|
|
1887
|
-
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),
|
|
1887
|
+
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), vr(e, n);
|
|
1888
1888
|
}
|
|
1889
|
-
function
|
|
1890
|
-
return
|
|
1889
|
+
function Nr(e) {
|
|
1890
|
+
return h(e);
|
|
1891
1891
|
}
|
|
1892
|
-
function
|
|
1893
|
-
return
|
|
1892
|
+
function Pr(e, t) {
|
|
1893
|
+
return hr(new de(e.slice(0, t.stop), t.start)) ?? null;
|
|
1894
1894
|
}
|
|
1895
|
-
function
|
|
1896
|
-
if (n) return
|
|
1895
|
+
function Q(e, t, n) {
|
|
1896
|
+
if (n) return X(e, t, n.position, _r(f(e, n)));
|
|
1897
1897
|
}
|
|
1898
|
-
function
|
|
1898
|
+
function Fr(e, t) {
|
|
1899
1899
|
if (!e) return;
|
|
1900
1900
|
let n = structuredClone(e);
|
|
1901
|
-
for (let e of
|
|
1901
|
+
for (let e of c(n, { citations: !0 })) e.position !== void 0 && (e.originalTransformation = yr(t, e.position));
|
|
1902
1902
|
return n;
|
|
1903
1903
|
}
|
|
1904
|
-
function
|
|
1905
|
-
let i =
|
|
1904
|
+
function Ir(e, t, n, r) {
|
|
1905
|
+
let i = Mr(e, n);
|
|
1906
1906
|
if (!i) return null;
|
|
1907
|
-
let a =
|
|
1907
|
+
let a = Pr(e, i);
|
|
1908
1908
|
if (!a) return null;
|
|
1909
|
-
let o =
|
|
1909
|
+
let o = X(e, t, i), s = Fr(a.targetReference, t), c = Tr(r, s), l = Nr(o.text);
|
|
1910
1910
|
if (a.kind === "delete_article") return {
|
|
1911
1911
|
kind: "delete_article",
|
|
1912
|
-
...
|
|
1912
|
+
...Y(o),
|
|
1913
1913
|
target: c
|
|
1914
1914
|
};
|
|
1915
1915
|
if (a.kind === "delete_portion") {
|
|
1916
|
-
let n =
|
|
1916
|
+
let n = Q(e, t, a.targetCitation);
|
|
1917
1917
|
return {
|
|
1918
1918
|
kind: "delete_portion",
|
|
1919
|
-
...
|
|
1919
|
+
...Y(o),
|
|
1920
1920
|
target: c,
|
|
1921
1921
|
...n === void 0 ? {} : {
|
|
1922
1922
|
targetCitation: n,
|
|
@@ -1924,16 +1924,16 @@ function Fr(e, t, n, r) {
|
|
|
1924
1924
|
},
|
|
1925
1925
|
targetOccurrence: l,
|
|
1926
1926
|
targetReference: s,
|
|
1927
|
-
targetScope:
|
|
1927
|
+
targetScope: Or(a.targetScope, c)
|
|
1928
1928
|
};
|
|
1929
1929
|
}
|
|
1930
1930
|
if (a.kind === "rewrite_portion") {
|
|
1931
|
-
let n =
|
|
1931
|
+
let n = Q(e, t, a.replacementCitation);
|
|
1932
1932
|
if (!n) return null;
|
|
1933
|
-
let r =
|
|
1933
|
+
let r = Q(e, t, a.targetCitation);
|
|
1934
1934
|
return {
|
|
1935
1935
|
kind: "rewrite_portion",
|
|
1936
|
-
...
|
|
1936
|
+
...Y(o),
|
|
1937
1937
|
target: c,
|
|
1938
1938
|
...r === void 0 ? {} : {
|
|
1939
1939
|
targetCitation: r,
|
|
@@ -1941,16 +1941,16 @@ function Fr(e, t, n, r) {
|
|
|
1941
1941
|
},
|
|
1942
1942
|
targetOccurrence: l,
|
|
1943
1943
|
targetReference: s,
|
|
1944
|
-
targetScope:
|
|
1944
|
+
targetScope: Or(a.targetScope, c),
|
|
1945
1945
|
replacementCitation: n,
|
|
1946
1946
|
replacementText: n.text
|
|
1947
1947
|
};
|
|
1948
1948
|
}
|
|
1949
1949
|
if (a.kind === "replace") {
|
|
1950
|
-
let n =
|
|
1950
|
+
let n = Q(e, t, a.replacementCitation), r = Q(e, t, a.targetCitation);
|
|
1951
1951
|
return !n || !r ? null : {
|
|
1952
1952
|
kind: "replace",
|
|
1953
|
-
...
|
|
1953
|
+
...Y(o),
|
|
1954
1954
|
target: c,
|
|
1955
1955
|
targetCitation: r,
|
|
1956
1956
|
targetText: r.text,
|
|
@@ -1961,32 +1961,32 @@ function Fr(e, t, n, r) {
|
|
|
1961
1961
|
};
|
|
1962
1962
|
}
|
|
1963
1963
|
if (a.kind === "insert_article_after") {
|
|
1964
|
-
let n =
|
|
1964
|
+
let n = Q(e, t, a.insertCitation);
|
|
1965
1965
|
return n ? {
|
|
1966
1966
|
kind: "insert_article_after",
|
|
1967
|
-
...
|
|
1967
|
+
...Y(o),
|
|
1968
1968
|
target: c,
|
|
1969
1969
|
insertCitation: n,
|
|
1970
1970
|
insertText: n.text
|
|
1971
1971
|
} : null;
|
|
1972
1972
|
}
|
|
1973
1973
|
if (a.kind === "insert_article_before") {
|
|
1974
|
-
let n =
|
|
1974
|
+
let n = Q(e, t, a.insertCitation);
|
|
1975
1975
|
return n ? {
|
|
1976
1976
|
kind: "insert_article_before",
|
|
1977
|
-
...
|
|
1977
|
+
...Y(o),
|
|
1978
1978
|
target: c,
|
|
1979
1979
|
insertCitation: n,
|
|
1980
1980
|
insertText: n.text
|
|
1981
1981
|
} : null;
|
|
1982
1982
|
}
|
|
1983
1983
|
if (a.kind === "insert_after" || a.kind === "insert_before") {
|
|
1984
|
-
let n =
|
|
1984
|
+
let n = Q(e, t, a.insertCitation);
|
|
1985
1985
|
if (!n) return null;
|
|
1986
|
-
let r =
|
|
1986
|
+
let r = Q(e, t, a.targetCitation);
|
|
1987
1987
|
return {
|
|
1988
1988
|
kind: a.kind,
|
|
1989
|
-
...
|
|
1989
|
+
...Y(o),
|
|
1990
1990
|
target: c,
|
|
1991
1991
|
...r === void 0 ? {} : {
|
|
1992
1992
|
targetCitation: r,
|
|
@@ -1996,19 +1996,19 @@ function Fr(e, t, n, r) {
|
|
|
1996
1996
|
targetReference: s,
|
|
1997
1997
|
insertCitation: n,
|
|
1998
1998
|
insertText: n.text,
|
|
1999
|
-
targetScope:
|
|
1999
|
+
targetScope: Or(a.targetScope, c)
|
|
2000
2000
|
};
|
|
2001
2001
|
}
|
|
2002
2002
|
return null;
|
|
2003
2003
|
}
|
|
2004
|
-
function
|
|
2004
|
+
function Lr(e, t) {
|
|
2005
2005
|
let n = [], r = 0, i = 0;
|
|
2006
2006
|
function a(r) {
|
|
2007
|
-
let a =
|
|
2007
|
+
let a = vr(e, {
|
|
2008
2008
|
start: i,
|
|
2009
2009
|
stop: r
|
|
2010
2010
|
});
|
|
2011
|
-
a !== null && n.push(
|
|
2011
|
+
a !== null && n.push(X(e, t, a));
|
|
2012
2012
|
}
|
|
2013
2013
|
function o(t) {
|
|
2014
2014
|
let n = Math.max(e.lastIndexOf("\n", t - 1), e.lastIndexOf("\r", t - 1));
|
|
@@ -2026,7 +2026,7 @@ function Ir(e, t) {
|
|
|
2026
2026
|
continue;
|
|
2027
2027
|
}
|
|
2028
2028
|
if (r > 0) continue;
|
|
2029
|
-
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) &&
|
|
2029
|
+
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) && kr({
|
|
2030
2030
|
originalTransformation: void 0,
|
|
2031
2031
|
position: {
|
|
2032
2032
|
start: i,
|
|
@@ -2038,8 +2038,8 @@ function Ir(e, t) {
|
|
|
2038
2038
|
}
|
|
2039
2039
|
return a(e.length), n;
|
|
2040
2040
|
}
|
|
2041
|
-
function
|
|
2042
|
-
let t =
|
|
2041
|
+
function Rr(e) {
|
|
2042
|
+
let t = wr(e), n = t?.dispositif ?? null, r = Cr(n), i = [], a = [], o = xr(e);
|
|
2043
2043
|
if (e.sourceFormat === "senat-ameli" && e.sourceKind === "S") return i.push({
|
|
2044
2044
|
code: "unsupported_sub_amendment",
|
|
2045
2045
|
message: "Les sous-amendements ne sont pas encore projetés."
|
|
@@ -2057,9 +2057,9 @@ function Lr(e) {
|
|
|
2057
2057
|
});
|
|
2058
2058
|
else {
|
|
2059
2059
|
let { simplifiedText: e, transformation: r } = t, s = o, c = null;
|
|
2060
|
-
for (let t of
|
|
2061
|
-
|
|
2062
|
-
let n = c ?
|
|
2060
|
+
for (let t of Lr(e, r)) {
|
|
2061
|
+
jr(t) && (s = o, c = null);
|
|
2062
|
+
let n = c ? Ar(e, r, c, t) : t, i = Ir(e, r, n, s);
|
|
2063
2063
|
if (i) {
|
|
2064
2064
|
a.push(i), c = null, (i.target.alinea !== null || i.target.alineas) && (s = i.target);
|
|
2065
2065
|
continue;
|
|
@@ -2068,23 +2068,23 @@ function Lr(e) {
|
|
|
2068
2068
|
c = n;
|
|
2069
2069
|
continue;
|
|
2070
2070
|
}
|
|
2071
|
-
let l =
|
|
2071
|
+
let l = Dr(o, t);
|
|
2072
2072
|
if (l !== null) {
|
|
2073
2073
|
s = l;
|
|
2074
2074
|
continue;
|
|
2075
2075
|
}
|
|
2076
|
-
|
|
2076
|
+
kr(t) && (c = t);
|
|
2077
2077
|
}
|
|
2078
2078
|
a.length === 0 && (o.targetPosition === "after_article" || o.targetPosition === "before_article") && a.push({
|
|
2079
2079
|
kind: o.targetPosition === "before_article" ? "insert_article_before" : "insert_article_after",
|
|
2080
|
-
...
|
|
2080
|
+
...Y(n),
|
|
2081
2081
|
target: o,
|
|
2082
2082
|
insertCitation: n,
|
|
2083
2083
|
insertText: n.text
|
|
2084
2084
|
}), a.length === 0 && i.push({
|
|
2085
2085
|
code: "unrecognized_dispositif",
|
|
2086
2086
|
message: "Le dispositif est présent mais aucune directive d'amendement n'a été reconnue.",
|
|
2087
|
-
...
|
|
2087
|
+
...Sr(n)
|
|
2088
2088
|
});
|
|
2089
2089
|
}
|
|
2090
2090
|
return {
|
|
@@ -2098,17 +2098,17 @@ function Lr(e) {
|
|
|
2098
2098
|
}
|
|
2099
2099
|
//#endregion
|
|
2100
2100
|
//#region src/lib/server/senat_document_search.ts
|
|
2101
|
-
function
|
|
2101
|
+
function $(e) {
|
|
2102
2102
|
return e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim();
|
|
2103
2103
|
}
|
|
2104
2104
|
function zr(e) {
|
|
2105
|
-
let t =
|
|
2105
|
+
let t = u(e);
|
|
2106
2106
|
if (!t) return {
|
|
2107
2107
|
articleNumber: null,
|
|
2108
2108
|
label: e,
|
|
2109
2109
|
title: null
|
|
2110
2110
|
};
|
|
2111
|
-
let n =
|
|
2111
|
+
let n = $(t.num ?? "") || null, r = $(t.title ?? "") || null;
|
|
2112
2112
|
return {
|
|
2113
2113
|
articleNumber: n,
|
|
2114
2114
|
label: t.label,
|
|
@@ -2116,7 +2116,7 @@ function zr(e) {
|
|
|
2116
2116
|
};
|
|
2117
2117
|
}
|
|
2118
2118
|
function Br(e) {
|
|
2119
|
-
let t =
|
|
2119
|
+
let t = C(e), n = [], r = $(t("section.akn-preamble").text());
|
|
2120
2120
|
return r && n.push({
|
|
2121
2121
|
anchor: "senat-expose-des-motifs",
|
|
2122
2122
|
articleNumber: null,
|
|
@@ -2126,9 +2126,9 @@ function Br(e) {
|
|
|
2126
2126
|
label: "Exposé des motifs",
|
|
2127
2127
|
title: null
|
|
2128
2128
|
}), t("article.akn-article").each((e, r) => {
|
|
2129
|
-
let i = t(r), a = i.attr("id") || `akn-article-${e + 1}`, o =
|
|
2129
|
+
let i = t(r), a = i.attr("id") || `akn-article-${e + 1}`, o = $(i.children("p.TCNumArticle").first().text()), s = `Article ${e + 1}`, c = zr(o || s), l = i.clone();
|
|
2130
2130
|
l.children("p.TCNumArticle").remove();
|
|
2131
|
-
let u =
|
|
2131
|
+
let u = $(l.text());
|
|
2132
2132
|
u && n.push({
|
|
2133
2133
|
anchor: i.attr("id") || null,
|
|
2134
2134
|
articleNumber: c.articleNumber,
|
|
@@ -2141,7 +2141,7 @@ function Br(e) {
|
|
|
2141
2141
|
}), n;
|
|
2142
2142
|
}
|
|
2143
2143
|
function Vr(e, t) {
|
|
2144
|
-
return
|
|
2144
|
+
return xe("sha256").update(JSON.stringify({
|
|
2145
2145
|
item: e,
|
|
2146
2146
|
metadata: t
|
|
2147
2147
|
})).digest("hex");
|
|
@@ -21273,7 +21273,7 @@ function ti(e) {
|
|
|
21273
21273
|
return null;
|
|
21274
21274
|
}
|
|
21275
21275
|
function ni(e) {
|
|
21276
|
-
return
|
|
21276
|
+
return be.createHash("md5").update(e).digest("hex");
|
|
21277
21277
|
}
|
|
21278
21278
|
function ri(e) {
|
|
21279
21279
|
return e ? /font-weight\s*:\s*(bold|[6-9]00|1000)/i.test(e) || /font-family\s*:\s*[^;]*\bBold\b/i.test(e) : !1;
|
|
@@ -21345,7 +21345,7 @@ function ui(e) {
|
|
|
21345
21345
|
return null;
|
|
21346
21346
|
}
|
|
21347
21347
|
function di(e, t = {}) {
|
|
21348
|
-
let { keepAlignment: n = !0, removeEmptyParagraphs: r = !0, strictAlineas: i = !1 } = t, a =
|
|
21348
|
+
let { keepAlignment: n = !0, removeEmptyParagraphs: r = !0, strictAlineas: i = !1 } = t, a = C(e, { xml: { decodeEntities: !1 } });
|
|
21349
21349
|
a("style, script, meta, link").remove(), a(".assnatHeader, .assnatFooter, .assnatHeaderLeft, .assnatHeaderandFooter").remove(), a(".assnatFARSautApres, .assnatFARSautAvant, .assnatFARSautPageNiv0, .assnatFARSautPageNiv1, .assnatFARSautPageNiv1PG").remove(), a(".assnatFARTT08Bleu").each((e, t) => {
|
|
21350
21350
|
let n = a(t).closest("table");
|
|
21351
21351
|
n.length > 0 && n.remove();
|
|
@@ -21598,15 +21598,15 @@ ${di(e, t)}
|
|
|
21598
21598
|
//#region src/lib/server/text_parsers/transformers.ts
|
|
21599
21599
|
function gi(e, t) {
|
|
21600
21600
|
let n = "transformation_", r = {};
|
|
21601
|
-
for (let e of
|
|
21601
|
+
for (let e of k.readdirSync(t).toSorted()) if (e.startsWith(n) && e.endsWith(".json")) {
|
|
21602
21602
|
let i = e.slice(15, -5), a = i.split(".").map((e) => parseInt(e) - 1), o = r;
|
|
21603
21603
|
for (let e of a.slice(1)) {
|
|
21604
21604
|
let t = o.transformations ??= [];
|
|
21605
21605
|
for (; e >= t.length;) t.push({});
|
|
21606
21606
|
o = t[e];
|
|
21607
21607
|
}
|
|
21608
|
-
o.output =
|
|
21609
|
-
let { sourceMap: s, title: c } =
|
|
21608
|
+
o.output = k.readFileSync(A.join(t, `${n}${i}.html`), { encoding: "utf-8" });
|
|
21609
|
+
let { sourceMap: s, title: c } = k.readJsonSync(A.join(t, e), { encoding: "utf-8" });
|
|
21610
21610
|
o.sourceMap = s ?? [], o.title = c;
|
|
21611
21611
|
}
|
|
21612
21612
|
return _i(r, e), r;
|
|
@@ -21616,7 +21616,7 @@ function _i(e, t) {
|
|
|
21616
21616
|
return t;
|
|
21617
21617
|
}
|
|
21618
21618
|
function vi(e, t, n = "1") {
|
|
21619
|
-
if (
|
|
21619
|
+
if (k.ensureDirSync(t), e.transformations === void 0) k.writeJsonSync(A.join(t, `transformation_${n}.json`), {
|
|
21620
21620
|
sourceMap: e.sourceMap,
|
|
21621
21621
|
title: e.title
|
|
21622
21622
|
}, {
|
|
@@ -21624,43 +21624,43 @@ function vi(e, t, n = "1") {
|
|
|
21624
21624
|
spaces: 2
|
|
21625
21625
|
});
|
|
21626
21626
|
else {
|
|
21627
|
-
|
|
21627
|
+
k.writeJsonSync(A.join(t, `transformation_${n}.json`), { title: e.title }, {
|
|
21628
21628
|
encoding: "utf-8",
|
|
21629
21629
|
spaces: 2
|
|
21630
21630
|
});
|
|
21631
21631
|
for (let [r, i] of e.transformations.entries()) vi(i, t, `${n}.${r + 1}`);
|
|
21632
21632
|
}
|
|
21633
|
-
e.output !== void 0 &&
|
|
21633
|
+
e.output !== void 0 && k.writeFileSync(A.join(t, `transformation_${n}.html`), e.output, { encoding: "utf-8" });
|
|
21634
21634
|
}
|
|
21635
21635
|
//#endregion
|
|
21636
21636
|
//#region src/lib/server/linkers/html.ts
|
|
21637
|
-
async function yi({ 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:
|
|
21638
|
-
let
|
|
21639
|
-
if (
|
|
21640
|
-
let
|
|
21641
|
-
a === void 0 ? (
|
|
21642
|
-
let
|
|
21643
|
-
s !== void 0 &&
|
|
21644
|
-
let { outputByType:
|
|
21645
|
-
legiResolver:
|
|
21637
|
+
async function yi({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, htmlFilePath: i, htmlTransformationsInputDir: a, htmlTransformationsOutputDir: o, htmlWithLinksFilePath: s, htmlWithLinksOrReferencesFilePath: c, htmlWithLinksTransformationsOutputDir: l, htmlWithReferencesFilePath: u, linkBaseUrl: d, linkType: f, logIgnoredReferencesTypes: p, logPartialReferences: m, logReferences: h, referredLegifranceTextsInfosFilePath: g }) {
|
|
21638
|
+
let _ = t ?? (e === void 0 ? void 0 : new ee(e));
|
|
21639
|
+
if (_ === void 0) throw Error("A Canutes database or legal resolver is required");
|
|
21640
|
+
let v = await k.readFile(i, { encoding: "utf-8" }), y;
|
|
21641
|
+
a === void 0 ? (y = ue({ removeAWithHref: !0 })(v), o !== void 0 && vi(y, o)) : y = gi(v, a);
|
|
21642
|
+
let b = [];
|
|
21643
|
+
s !== void 0 && b.push("links"), c !== void 0 && b.push("links_or_references"), u !== void 0 && b.push("references");
|
|
21644
|
+
let { outputByType: x, referredLegifranceTextCountByCid: S } = await ne({
|
|
21645
|
+
legiResolver: _,
|
|
21646
21646
|
date: n,
|
|
21647
21647
|
defaultTextId: r,
|
|
21648
|
-
htmlTransformation:
|
|
21649
|
-
inputHtml:
|
|
21648
|
+
htmlTransformation: y,
|
|
21649
|
+
inputHtml: v,
|
|
21650
21650
|
linkBaseUrl: d,
|
|
21651
21651
|
linkType: f,
|
|
21652
21652
|
logIgnoredReferencesTypes: p,
|
|
21653
21653
|
logPartialReferences: m,
|
|
21654
21654
|
logReferences: h,
|
|
21655
|
-
outputTypes:
|
|
21656
|
-
referredLegifranceTextsInfos:
|
|
21655
|
+
outputTypes: b,
|
|
21656
|
+
referredLegifranceTextsInfos: g !== void 0
|
|
21657
21657
|
}), C = {};
|
|
21658
21658
|
s !== void 0 && (C.links = s), c !== void 0 && (C.links_or_references = c), u !== void 0 && (C.references = u);
|
|
21659
|
-
for (let [e, t] of Object.entries(
|
|
21659
|
+
for (let [e, t] of Object.entries(x)) {
|
|
21660
21660
|
let n = C[e];
|
|
21661
|
-
n !== void 0 && await
|
|
21661
|
+
n !== void 0 && await k.writeFile(n, t.html, { encoding: "utf-8" });
|
|
21662
21662
|
}
|
|
21663
|
-
|
|
21663
|
+
x.links !== void 0 && l !== void 0 && vi(ue()(x.links.html), l), g !== void 0 && await k.writeJson(g, S, {
|
|
21664
21664
|
encoding: "utf-8",
|
|
21665
21665
|
spaces: 2
|
|
21666
21666
|
});
|
|
@@ -21668,20 +21668,20 @@ async function yi({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, ht
|
|
|
21668
21668
|
//#endregion
|
|
21669
21669
|
//#region src/lib/server/tables_of_contents.ts
|
|
21670
21670
|
async function bi(e, t, n, r) {
|
|
21671
|
-
let i = gi(await
|
|
21672
|
-
for await (let e of
|
|
21671
|
+
let i = gi(await k.readFile(e, { encoding: "utf-8" }), t), a = i.output, o = new de(a), s = await k.readJson(n, { encoding: "utf-8" });
|
|
21672
|
+
for await (let e of te({
|
|
21673
21673
|
context: o,
|
|
21674
21674
|
tableOfContents: s,
|
|
21675
21675
|
transformation: i
|
|
21676
21676
|
}));
|
|
21677
|
-
await
|
|
21677
|
+
await k.writeJson(r, s, {
|
|
21678
21678
|
encoding: "utf-8",
|
|
21679
21679
|
spaces: 2
|
|
21680
21680
|
});
|
|
21681
21681
|
}
|
|
21682
21682
|
async function xi(e, t, n) {
|
|
21683
|
-
let r = gi(await
|
|
21684
|
-
await
|
|
21683
|
+
let r = gi(await k.readFile(e, { encoding: "utf-8" }), t).output, i = _(r);
|
|
21684
|
+
await k.writeJson(n, i, {
|
|
21685
21685
|
encoding: "utf-8",
|
|
21686
21686
|
spaces: 2
|
|
21687
21687
|
});
|
|
@@ -21689,7 +21689,7 @@ async function xi(e, t, n) {
|
|
|
21689
21689
|
//#endregion
|
|
21690
21690
|
//#region src/lib/server/legi/resolvers.ts
|
|
21691
21691
|
function Si({ canutesDb: e }) {
|
|
21692
|
-
return new
|
|
21692
|
+
return new ee(e);
|
|
21693
21693
|
}
|
|
21694
21694
|
//#endregion
|
|
21695
|
-
export {
|
|
21695
|
+
export { ye as LegiResolver, yi as addLinksOrReferencesToHtmlFile, bi as addPositionsToTableOfContentsFile, ge as buildAndInstallTextTitlesInfos, ve as buildTextTitlesInfos, Si as createLegiResolver, Te as extractAssembleeAmendmentSearchItems, Fn as extractAssembleeExposesDesMotifs, Bn as extractSenatAmendmentSearchItems, Ee as hashAssembleeAmendmentSearchItem, Ln as hashAssembleeSearchItem, Vn as hashSenatAmendmentSearchItem, Vr as hashSenatSearchItem, qr as isAkomaNtosoXml, Rn as isoDateFromAssembleeDocument, jn as linkAkomaNtosoBillRaw, Ht as linkAssembleeBillRaw, An as parseAkomaNtosoBillRaw, Rr as parseAmendment, Vt as parseAssembleeBillRaw, In as parseAssembleeDocumentSearchContent, Br as parseSenatDocumentSearchContent, gi as readTransformation, En as renderAkomaNtosoBillRaw, Kr as resolveSenatAkomaNtosoSource, xi as simplifiedHtmlBillFileToTableOfContentsFile, di as simplifyWordHtml, hi as simplifyWordHtmlToDocument, vi as writeTransformation };
|