@tricoteuses/tisseuse 0.15.3 → 0.16.1

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