@tricoteuses/tisseuse 0.12.10 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/README.md +46 -0
  2. package/dist/index.js +143 -1397
  3. package/dist/server.js +2739 -158
  4. package/dist/src/lib/extractors/action_directives.d.ts +84 -22
  5. package/dist/src/lib/extractors/article_portions.d.ts +15 -1
  6. package/dist/src/lib/extractors/references.d.ts +3 -1
  7. package/dist/src/lib/extractors/table_of_contents.d.ts +2 -0
  8. package/dist/src/lib/f_legi/extractors/links.d.ts +134 -0
  9. package/dist/src/lib/f_legi/linkers/html.d.ts +51 -0
  10. package/dist/src/lib/f_legi/resolver.d.ts +54 -0
  11. package/dist/src/lib/index.d.ts +4 -3
  12. package/dist/src/lib/legi/canutes_resolver.d.ts +33 -0
  13. package/dist/src/lib/legi/resolver.d.ts +48 -0
  14. package/dist/src/lib/server/databases/index.d.ts +1 -1
  15. package/dist/src/lib/server/f_legi/databases/index.d.ts +2 -0
  16. package/dist/src/lib/server/f_legi/linkers/html.d.ts +20 -0
  17. package/dist/src/lib/server/index.d.ts +3 -0
  18. package/dist/src/lib/server/legi/resolvers.d.ts +10 -0
  19. package/dist/src/lib/server/parsed_bills.d.ts +105 -0
  20. package/dist/src/lib/server/parsed_bills.test.d.ts +1 -0
  21. package/dist/src/lib/test/text_titles_infos.d.ts +1 -0
  22. package/dist/src/lib/text_parsers/action_directives.d.ts +3 -0
  23. package/dist/src/lib/text_parsers/action_directives.test.d.ts +1 -0
  24. package/dist/src/lib/text_parsers/ast.d.ts +53 -1
  25. package/dist/src/lib/text_parsers/parsers.d.ts +2 -0
  26. package/dist/src/lib/text_parsers/texts.d.ts +1 -0
  27. package/dist/src/lib/timings.d.ts +19 -0
  28. package/dist/src/scripts/f_legi/add_links_to_html_document.d.ts +0 -0
  29. package/dist/src/scripts/parse_akoma_ntoso_bill_raw.d.ts +1 -0
  30. package/dist/src/scripts/parse_assemblee_bill_raw.d.ts +1 -0
  31. package/dist/{html-DAKCS7I8.js → textes-8dVwaLo9.js} +5161 -3078
  32. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as e, $t as t, A as n, An as r, At as i, B as a, Bt as o, C as s, Cn as c, Ct as l, D as u, Dn as d, Dt as f, E as p, En as m, Et as h, F as g, Fn as ee, Ft as te, G as ne, Gt as re, H as ie, Ht as ae, I as oe, In as _, It as se, J as ce, Jt as le, K as ue, Kt as de, L as fe, Lt as v, M as pe, Mn as me, Mt as y, N as he, Nn as ge, Nt as b, O as _e, On as ve, Ot as ye, P as be, Pn as xe, Pt as Se, Q as Ce, Qt as we, R as Te, Rt as Ee, S as De, Sn as x, St as Oe, T as ke, Tn as Ae, Tt as je, U as Me, Ut as Ne, V as Pe, Vt as S, W as Fe, Wt as Ie, X as Le, Xt as Re, Y as ze, Yt as Be, Z as Ve, Zt as He, _ as Ue, _n as C, _t as We, a as Ge, an as Ke, at as qe, b as Je, bn as Ye, bt as Xe, c as Ze, cn as Qe, ct as $e, d as et, dn as tt, dt as nt, en as rt, et as it, f as at, fn as ot, ft as st, g as ct, gn as w, gt as lt, h as ut, hn as dt, ht as ft, i as T, in as pt, it as mt, j as E, jn as ht, jt as gt, k as _t, kn as D, kt as vt, l as yt, ln as bt, lt as xt, m as St, mn as Ct, mt as wt, n as Tt, nn as Et, nt as Dt, o as Ot, on as kt, ot as At, p as jt, pn as Mt, pt as Nt, q as Pt, qt as Ft, r as It, rn as Lt, rt as Rt, s as zt, sn as Bt, st as Vt, t as Ht, tn as Ut, tt as Wt, u as Gt, un as Kt, ut as qt, v as Jt, vn as O, vt as Yt, w as Xt, wn as Zt, wt as Qt, x as $t, xn as en, xt as tn, y as nn, yn as rn, yt as an, z as on, zt as sn } from "./html-DAKCS7I8.js";
1
+ import { $ as e, $t as t, A as n, An as r, At as i, B as a, Bn as o, Bt as s, C as c, Cn as l, Ct as u, D as d, Dn as f, Dt as p, E as m, En as h, Et as ee, F as te, Fn as ne, Ft as re, G as ie, Gn as ae, Gt as oe, H as se, Hn as ce, Ht as le, I as ue, In as de, It as fe, J as pe, Jt as me, K as he, Kn as g, Kt as ge, Ln as _, Lt as _e, M as ve, Mn as v, Mt as ye, N as be, Nn as xe, Nt as Se, O as Ce, On as y, Ot as b, P as we, Pn as Te, Pt as Ee, Q as De, Qt as Oe, R as x, Rn as S, Rt as C, S as w, Sn as T, St as ke, T as Ae, Tn as je, Tt as Me, U as Ne, Un as Pe, Ut as Fe, V as Ie, Vn as Le, Vt as Re, W as ze, Wn as Be, Wt as Ve, X as He, Xt as Ue, Y as We, Yt as Ge, Z as Ke, Zt as qe, _ as Je, _n as Ye, _t as Xe, a as Ze, an as Qe, at as $e, b as et, bn as tt, bt as nt, c as E, cn as rt, ct as it, d as at, dn as ot, dt as D, en as st, et as ct, f as O, fn as k, ft as A, g as lt, gn as ut, gt as dt, h as ft, hn as pt, ht as mt, i as ht, in as gt, it as _t, j as vt, jn as yt, jt as bt, k as xt, kn as j, kt as St, l as Ct, ln as wt, lt as Tt, m as Et, mn as Dt, mt as Ot, n as kt, nn as M, nt as At, o as jt, on as Mt, ot as Nt, p as Pt, pn as Ft, q as It, qt as Lt, r as Rt, rn as zt, rt as N, s as Bt, sn as Vt, st as Ht, t as Ut, tn as Wt, tt as Gt, u as Kt, un as qt, ut as Jt, v as Yt, vn as Xt, vt as Zt, w as Qt, wn as $t, wt as en, x as tn, xn as P, xt as nn, y as rn, yn as an, yt as on, z as F, zn as I, zt as sn } from "./textes-8dVwaLo9.js";
2
2
  //#region ../../node_modules/@tricoteuses/legifrance/dist/legal/index.js
3
3
  function cn(e, t) {
4
4
  if (e != null) {
@@ -7,53 +7,53 @@ function cn(e, t) {
7
7
  return e[0];
8
8
  }
9
9
  }
10
- function* k(e) {
11
- yield e, e.TM !== void 0 && (yield* k(e.TM));
10
+ function* L(e) {
11
+ yield e, e.TM !== void 0 && (yield* L(e.TM));
12
12
  }
13
13
  //#endregion
14
14
  //#region src/lib/articles.ts
15
- var A = ["2222-02-22", "2999-01-01"], ln = (e) => {
15
+ var R = ["2222-02-22", "2999-01-01"], ln = (e) => {
16
16
  if (e !== void 0) for (let t = 0; t < e.length; ++t) {
17
- let n = rt(new w(e, t));
17
+ let n = k(new h(e, t));
18
18
  if (typeof n == "string") return n;
19
19
  }
20
- }, un = (e) => (e === void 0 ? [] : Array.isArray(e) ? e : [e]).map((e) => ln(e["#text"])).find((e) => e !== void 0), dn = (e) => {
20
+ }, z = (e) => (e === void 0 ? [] : Array.isArray(e) ? e : [e]).map((e) => ln(e["#text"])).find((e) => e !== void 0), un = (e) => {
21
21
  let t = e.META.META_SPEC.META_ARTICLE.DATE_DEBUT;
22
- if (t !== void 0 && !A.includes(t)) return t;
23
- let n = e.CONTEXTE.TEXTE, r = n.TITRE_TXT, i = [...r === void 0 ? [] : (Array.isArray(r) ? r : [r]).map((e) => e["@debut"]), ...n.TM === void 0 ? [] : k(n.TM).map((e) => (Array.isArray(e.TITRE_TM) ? e.TITRE_TM : [e.TITRE_TM]).map((e) => e["@debut"])).toArray().flat()].filter((e) => !A.includes(e));
22
+ if (t !== void 0 && !R.includes(t)) return t;
23
+ let n = e.CONTEXTE.TEXTE, r = n.TITRE_TXT, i = [...r === void 0 ? [] : (Array.isArray(r) ? r : [r]).map((e) => e["@debut"]), ...n.TM === void 0 ? [] : L(n.TM).map((e) => (Array.isArray(e.TITRE_TM) ? e.TITRE_TM : [e.TITRE_TM]).map((e) => e["@debut"])).toArray().flat()].filter((e) => !R.includes(e));
24
24
  if (i.length > 0) return i.sort().at(-1);
25
25
  let a = n["@date_publi"];
26
- if (a !== void 0 && !A.includes(a)) return a;
26
+ if (a !== void 0 && !R.includes(a)) return a;
27
27
  let o = n["@date_signature"];
28
- if (o !== void 0 && !A.includes(o)) return o;
28
+ if (o !== void 0 && !R.includes(o)) return o;
29
29
  let s = e.META.META_SPEC.META_ARTICLE.DATE_FIN;
30
- if (s !== void 0 && !A.includes(s)) return s;
31
- let c = un(r);
30
+ if (s !== void 0 && !R.includes(s)) return s;
31
+ let c = z(r);
32
32
  if (c !== void 0) return c;
33
- if (A.includes(t ?? "")) return t;
33
+ if (R.includes(t ?? "")) return t;
34
34
  throw Error(`Missing date signature in article ${e.META.META_COMMUN.ID}`);
35
- }, j = (e) => {
35
+ }, B = (e) => {
36
36
  let t = e.META.META_SPEC.META_ARTICLE.DATE_DEBUT;
37
- if (t !== void 0 && !A.includes(t)) return t;
37
+ if (t !== void 0 && !R.includes(t)) return t;
38
38
  let n = e.CONTEXTE.TEXTE, r = n["@date_signature"];
39
- if (r !== void 0 && !A.includes(r)) return r;
39
+ if (r !== void 0 && !R.includes(r)) return r;
40
40
  let i = n["@date_publi"];
41
- if (i !== void 0 && !A.includes(i)) return i;
42
- let a = n.TITRE_TXT, o = [...a === void 0 ? [] : (Array.isArray(a) ? a : [a]).map((e) => e["@debut"]), ...n.TM === void 0 ? [] : k(n.TM).map((e) => (Array.isArray(e.TITRE_TM) ? e.TITRE_TM : [e.TITRE_TM]).map((e) => e["@debut"])).toArray().flat()].filter((e) => !A.includes(e));
41
+ if (i !== void 0 && !R.includes(i)) return i;
42
+ let a = n.TITRE_TXT, o = [...a === void 0 ? [] : (Array.isArray(a) ? a : [a]).map((e) => e["@debut"]), ...n.TM === void 0 ? [] : L(n.TM).map((e) => (Array.isArray(e.TITRE_TM) ? e.TITRE_TM : [e.TITRE_TM]).map((e) => e["@debut"])).toArray().flat()].filter((e) => !R.includes(e));
43
43
  if (o.length > 0) return o.sort().at(-1);
44
44
  let s = e.META.META_SPEC.META_ARTICLE.DATE_FIN;
45
- if (s !== void 0 && !A.includes(s)) return s;
46
- let c = un(a);
45
+ if (s !== void 0 && !R.includes(s)) return s;
46
+ let c = z(a);
47
47
  if (c !== void 0) return c;
48
- if (A.includes(t ?? "")) return t;
48
+ if (R.includes(t ?? "")) return t;
49
49
  throw Error(`Missing date signature in article ${e.META.META_COMMUN.ID}`);
50
50
  };
51
- async function fn(e, t, n, r) {
52
- let i = await d(e, t, n);
51
+ async function dn(e, t, n, r) {
52
+ let i = await _(e, t, n);
53
53
  if (i === void 0) return;
54
- let a = j(i), o = i.META.META_COMMUN.ORIGINE, s = i.CONTEXTE.TEXTE;
54
+ let a = B(i), o = i.META.META_COMMUN.ORIGINE, s = i.CONTEXTE.TEXTE;
55
55
  if (s.TM === void 0) return;
56
- let c = k(s.TM).toArray().reverse(), l;
56
+ let c = L(s.TM).toArray().reverse(), l;
57
57
  switch (o) {
58
58
  case "JORF":
59
59
  l = c.map((e) => e.TITRE_TM["@id"]);
@@ -61,14 +61,14 @@ async function fn(e, t, n, r) {
61
61
  case "LEGI":
62
62
  l = c.map((e) => cn(e.TITRE_TM, a)?.["@id"]);
63
63
  break;
64
- default: _("getOrLoadArticleSiblingId origine", o);
64
+ default: g("getOrLoadArticleSiblingId origine", o);
65
65
  }
66
- return await (r === -1 ? N : M)(e, t, n, a, i.num, l);
66
+ return await (r === -1 ? G : W)(e, t, n, a, i.num, l);
67
67
  }
68
- async function pn(e, t, n, r, i, a) {
68
+ async function V(e, t, n, r, i, a) {
69
69
  let o = r[n];
70
70
  if (o === void 0) {
71
- let s = await D(e, t, n);
71
+ let s = await I(e, t, n);
72
72
  if (s === void 0) return;
73
73
  let c = s.STRUCTURE_TA;
74
74
  if (c === void 0) return;
@@ -96,8 +96,8 @@ async function pn(e, t, n, r, i, a) {
96
96
  }
97
97
  return o;
98
98
  }
99
- async function mn(e, t, n) {
100
- let r = await D(e, t, n);
99
+ async function H(e, t, n) {
100
+ let r = await I(e, t, n);
101
101
  if (r === void 0) return;
102
102
  let i = r.STRUCTURE_TA;
103
103
  if (i === void 0) return;
@@ -105,86 +105,86 @@ async function mn(e, t, n) {
105
105
  if (a !== void 0) return a[0]["@id"];
106
106
  let o = i.LIEN_SECTION_TA;
107
107
  if (o !== void 0) for (let n of o) {
108
- let r = await mn(e, t, n["@id"]);
108
+ let r = await H(e, t, n["@id"]);
109
109
  if (r !== void 0) return r;
110
110
  }
111
111
  }
112
- async function hn(e, t, n) {
113
- let r = await D(e, t, n);
112
+ async function U(e, t, n) {
113
+ let r = await I(e, t, n);
114
114
  if (r === void 0) return;
115
115
  let i = r.STRUCTURE_TA;
116
116
  if (i === void 0) return;
117
117
  let a = i.LIEN_SECTION_TA;
118
118
  if (a !== void 0) for (let n of a.toReversed()) {
119
- let r = await hn(e, t, n["@id"]);
119
+ let r = await U(e, t, n["@id"]);
120
120
  if (r !== void 0) return r;
121
121
  }
122
122
  return i.LIEN_ART?.at(-1)?.["@id"];
123
123
  }
124
- async function M(e, t, n, r, i, a, o = 0, s = {}, c = void 0) {
124
+ async function W(e, t, n, r, i, a, o = 0, s = {}, c = void 0) {
125
125
  let l = a[o];
126
126
  if (l === void 0) return;
127
- let u = await pn(e, t, l, s, n, c);
127
+ let u = await V(e, t, l, s, n, c);
128
128
  if (u === void 0) return;
129
- let { area: f, index: p, sectionTa: m } = u, h = m.STRUCTURE_TA;
130
- switch (f) {
129
+ let { area: d, index: f, sectionTa: p } = u, m = p.STRUCTURE_TA;
130
+ switch (d) {
131
131
  case "LIEN_ART": {
132
- let c = h.LIEN_ART;
133
- for (let n = p + 1; n < c.length; n++) {
132
+ let c = m.LIEN_ART;
133
+ for (let n = f + 1; n < c.length; n++) {
134
134
  let a = c[n];
135
135
  if (a["@num"] !== i) {
136
- let n = await d(e, t, a["@id"]);
137
- if (n !== void 0 && j(n) <= r) return a["@id"];
136
+ let n = await _(e, t, a["@id"]);
137
+ if (n !== void 0 && B(n) <= r) return a["@id"];
138
138
  }
139
139
  }
140
- let u = h.LIEN_SECTION_TA;
140
+ let u = m.LIEN_SECTION_TA;
141
141
  if (u !== void 0) for (let n of u) {
142
- let r = await mn(e, t, n["@id"]);
142
+ let r = await H(e, t, n["@id"]);
143
143
  if (r !== void 0) return r;
144
144
  }
145
- return await M(e, t, n, r, i, a, o + 1, s, l);
145
+ return await W(e, t, n, r, i, a, o + 1, s, l);
146
146
  }
147
147
  case "LIEN_SECTION_TA": {
148
- let c = h.LIEN_SECTION_TA;
149
- for (let n = p + 1; n < c.length; n++) {
150
- let r = await mn(e, t, c[n]["@id"]);
148
+ let c = m.LIEN_SECTION_TA;
149
+ for (let n = f + 1; n < c.length; n++) {
150
+ let r = await H(e, t, c[n]["@id"]);
151
151
  if (r !== void 0) return r;
152
152
  }
153
- return await M(e, t, n, r, i, a, o + 1, s, l);
153
+ return await W(e, t, n, r, i, a, o + 1, s, l);
154
154
  }
155
- default: _("moveToNextArticleId area", f);
155
+ default: g("moveToNextArticleId area", d);
156
156
  }
157
157
  }
158
- async function N(e, t, n, r, i, a, o = 0, s = {}, c = void 0) {
158
+ async function G(e, t, n, r, i, a, o = 0, s = {}, c = void 0) {
159
159
  let l = a[o];
160
160
  if (l === void 0) return;
161
- let u = await pn(e, t, l, s, n, c);
161
+ let u = await V(e, t, l, s, n, c);
162
162
  if (u === void 0) return;
163
- let { area: f, index: p, sectionTa: m } = u, h = m.STRUCTURE_TA;
164
- switch (f) {
163
+ let { area: d, index: f, sectionTa: p } = u, m = p.STRUCTURE_TA;
164
+ switch (d) {
165
165
  case "LIEN_ART": {
166
- let c = h.LIEN_ART;
167
- for (let n = p - 1; n >= 0; n--) {
166
+ let c = m.LIEN_ART;
167
+ for (let n = f - 1; n >= 0; n--) {
168
168
  let a = c[n];
169
169
  if (a["@num"] !== i) {
170
- let n = await d(e, t, a["@id"]);
171
- if (n !== void 0 && j(n) <= r) return a["@id"];
170
+ let n = await _(e, t, a["@id"]);
171
+ if (n !== void 0 && B(n) <= r) return a["@id"];
172
172
  }
173
173
  }
174
- return await N(e, t, n, r, i, a, o + 1, s, l);
174
+ return await G(e, t, n, r, i, a, o + 1, s, l);
175
175
  }
176
176
  case "LIEN_SECTION_TA": {
177
- for (let n = p - 1; n >= 0; n--) {
178
- let r = await hn(e, t, h.LIEN_SECTION_TA[n]["@id"]);
177
+ for (let n = f - 1; n >= 0; n--) {
178
+ let r = await U(e, t, m.LIEN_SECTION_TA[n]["@id"]);
179
179
  if (r !== void 0) return r;
180
180
  }
181
- let c = h.LIEN_ART;
182
- return c === void 0 ? await N(e, t, n, r, i, a, o + 1, s, l) : (u.area = "LIEN_ART", u.index = c.length, await N(e, t, n, r, i, a, o, s));
181
+ let c = m.LIEN_ART;
182
+ return c === void 0 ? await G(e, t, n, r, i, a, o + 1, s, l) : (u.area = "LIEN_ART", u.index = c.length, await G(e, t, n, r, i, a, o, s));
183
183
  }
184
- default: _("moveToPreviousArticleId area", f);
184
+ default: g("moveToPreviousArticleId area", d);
185
185
  }
186
186
  }
187
- var gn = (e) => (t, n) => {
187
+ var fn = (e) => (t, n) => {
188
188
  let r = e(t), i = e(n);
189
189
  if (r !== i) return r.localeCompare(i);
190
190
  let a = t.META.META_COMMUN, o = a.ORIGINE, s = n.META.META_COMMUN, c = s.ORIGINE;
@@ -203,1321 +203,85 @@ var gn = (e) => (t, n) => {
203
203
  if (m <= i) return 1;
204
204
  }
205
205
  throw Error(`TODO: Unable to sort articles ${a.ID} & ${s.ID} by date.`);
206
- }, _n = new Intl.DateTimeFormat("fr-FR", { dateStyle: "long" });
207
- function vn(e) {
208
- return _n.format(new Date(e)).replace(/^1 /, "1er ");
209
- }
210
- //#endregion
211
- //#region src/lib/extractors/article_portions.ts
212
- var P = new RegExp(String.raw`^\s*([IVXLCDM]+|[A-Z]|[a-z]|\d+)(?:\s+(?:${Ke}))?(?:\s*(?:°|\.|\)|-|–|—))+(?:\s+(?:${Ke}))?(?:\s+|(?=[\p{L}\p{N}]))`, "iu"), yn = /^\s*-\s*/u, bn = /^\s*(partie|livre|titre|sous-titre|chapitre|section|sous-section|paragraphe|sous-paragraphe|sous-sous-paragraphe)\s+([IVXLCDM]+|[A-Z]|\d+)(?:\s*(?:°|\.|\)|-))?\s*/iu, xn = /^(partie|livre|titre|sous-titre|chapitre|section|sous-section|paragraphe|sous-paragraphe|sous-sous-paragraphe)\b/i, Sn = {
213
- partie: 0,
214
- livre: 1,
215
- titre: 2,
216
- "sous-titre": 3,
217
- chapitre: 4,
218
- section: 5,
219
- "sous-section": 6,
220
- paragraphe: 7,
221
- "sous-paragraphe": 8,
222
- "sous-sous-paragraphe": 9
223
- };
224
- function Cn(e) {
225
- return /^[IVXLCDM]+$/i.test(e);
226
- }
227
- function wn(e) {
228
- let t = en(e, We);
229
- return t && typeof t == "object" && t.type === "item" && typeof t.index == "number" && typeof t.num == "string" ? {
230
- num: t.num,
231
- index: t.index
232
- } : null;
233
- }
234
- function Tn(e) {
235
- let t = {
236
- I: 1,
237
- V: 5,
238
- X: 10,
239
- L: 50,
240
- C: 100,
241
- D: 500,
242
- M: 1e3
243
- }, n = 0, r = 0;
244
- for (let i of e.toUpperCase()) {
245
- let e = t[i];
246
- if (!e) return;
247
- e > r ? n += e - 2 * r : n += e, r = e;
248
- }
249
- return n || void 0;
250
- }
251
- function En(e) {
252
- let t = e.trim(), n = t.split(/\s+/), r = n[0] ? n[0].replace(/[^\p{L}\p{N}]+/gu, "") : t, i = n.length > 1 ? n.slice(1).join(" ") : void 0, a = (() => {
253
- if (/^\d+$/.test(r)) return Number(r);
254
- if (/^[A-Z]$/i.test(r)) return r.toLowerCase().charCodeAt(0) - 97 + 1;
255
- if (Cn(r)) return Tn(r);
256
- })();
257
- if (a === void 0) return;
258
- if (!i) return a;
259
- let o = en(i, pt);
260
- if (o && typeof o == "object" && "value" in o) {
261
- let e = o.value;
262
- if (typeof e == "number") return a + e / 1e3;
263
- }
264
- return a;
265
- }
266
- function Dn(e) {
267
- let t = e.trim().split(/\s+/)[0] ?? e, n = t.replace(/[^\p{L}\p{N}]+/gu, "");
268
- return /^[ivxlcdm]+$/.test(n) && (n.length > 1 || /^[ivx]$/.test(n)) ? 105 : /^[A-Z]$/.test(n) ? 101 : /^\d+$/.test(n) && /°/.test(t) ? 103 : /^\d+$/.test(n) ? 102 : /^[a-z]$/.test(n) ? 104 : Cn(n) ? 100 : 105;
269
- }
270
- function F(e) {
271
- return e.children.filter((e) => e.type === "alinéa").length + 1;
272
- }
273
- function On(t) {
274
- let n = e(t), r = {
275
- type: "article",
276
- children: []
277
- }, i = [{
278
- level: -1,
279
- node: r
280
- }], a = n("p").toArray(), o = (t) => {
281
- let n = t.split(/<br\s*\/?>/i), r = [];
282
- for (let t of n) {
283
- let n = e(t).text().replace(/\s+/g, " ").trim();
284
- n && r.push({
285
- text: n,
286
- html: t
287
- });
288
- }
289
- return r.length > 0 ? r : [];
290
- };
291
- return a.forEach((e, t) => {
292
- let a = n(e), s = a.html() ?? "", c = o(s);
293
- if (c.length === 0) {
294
- let e = (a.text() || "").replace(/\s+/g, " ").trim();
295
- if (!e) return;
296
- c.push({
297
- text: e,
298
- html: s
299
- });
300
- }
301
- let l = (e, n, r) => {
302
- let a = e, o = n;
303
- for (;;) {
304
- let e = o.match(P);
305
- if (!e) break;
306
- let t = wn(e[0]), n = t?.num ?? e[1], r = {
307
- type: "item",
308
- index: t?.index ?? En(n),
309
- num: n,
310
- label: void 0,
311
- children: []
312
- };
313
- a.children.push(r), i.push({
314
- level: Dn(n),
315
- node: r
316
- }), a = r, o = o.slice(e[0].length).trim();
317
- }
318
- o && a.children.push({
319
- type: "alinéa",
320
- index: F(a),
321
- text: o,
322
- html: r,
323
- paragraphIndex: t
324
- });
325
- };
326
- for (let e of c) {
327
- let n = e.text, a = n.match(bn);
328
- if (a) {
329
- let o = a[1].toLowerCase(), s = a[2], c = Sn[o];
330
- for (; i.length > 0 && i[i.length - 1].level >= c;) i.pop();
331
- let u = i[i.length - 1]?.node ?? r, d = {
332
- type: o,
333
- index: En(s),
334
- num: s,
335
- label: void 0,
336
- children: []
337
- };
338
- u.children.push(d), i.push({
339
- level: c,
340
- node: d
341
- });
342
- let f = n.slice(a[0].length).trim();
343
- f && (xn.test(f) ? d.label = f : P.test(f) ? l(d, f, e.html) : d.children.push({
344
- type: "alinéa",
345
- index: F(d),
346
- text: f,
347
- html: e.html,
348
- paragraphIndex: t
349
- }));
350
- continue;
351
- }
352
- let o = n.match(P);
353
- if (o) {
354
- let a = wn(o[0]), s = a?.num ?? o[1], c = Dn(s);
355
- for (; i.length > 0 && i[i.length - 1].level >= c;) i.pop();
356
- let u = i[i.length - 1]?.node ?? r, d = {
357
- type: "item",
358
- index: a?.index ?? En(s),
359
- num: s,
360
- label: void 0,
361
- children: []
362
- };
363
- u.children.push(d), i.push({
364
- level: c,
365
- node: d
366
- });
367
- let f = n.slice(o[0].length).trim();
368
- f && (xn.test(f) ? d.label = f : P.test(f) ? l(d, f, e.html) : d.children.push({
369
- type: "alinéa",
370
- index: F(d),
371
- text: f,
372
- html: e.html,
373
- paragraphIndex: t
374
- }));
375
- continue;
376
- }
377
- let s = i[i.length - 1]?.node ?? r;
378
- s.children.push({
379
- type: "alinéa",
380
- index: F(s),
381
- text: n,
382
- html: e.html,
383
- paragraphIndex: t
384
- });
385
- }
386
- }), r;
387
- }
388
- function I(e) {
389
- return e.type === "parent-enfant" ? [...I(e.parent), ...I(e.child)] : re(e) && (de(e) || Ft(e)) ? [{
390
- type: e.type,
391
- index: e.index,
392
- num: e.num,
393
- relative: e.relative,
394
- present: e.present
395
- }] : [];
396
- }
397
- function L(e) {
398
- if (e.type === "reference_et_action") return L(e.reference);
399
- if (e.type === "parent-enfant") {
400
- let t = L(e.parent), n = L(e.child);
401
- if (t.length === 0) return n;
402
- if (n.length === 0) return t;
403
- let r = [];
404
- for (let e of t) for (let t of n) {
405
- if (e.kind === "single" && t.kind === "single") {
406
- r.push({
407
- kind: "single",
408
- steps: [...e.steps, ...t.steps]
409
- });
410
- continue;
411
- }
412
- if (e.kind === "single" && t.kind === "range") {
413
- r.push({
414
- kind: "range",
415
- first: [...e.steps, ...t.first],
416
- last: [...e.steps, ...t.last],
417
- count: t.count
418
- });
419
- continue;
420
- }
421
- e.kind === "range" && t.kind === "single" && r.push({
422
- kind: "range",
423
- first: [...e.first, ...t.steps],
424
- last: [...e.last, ...t.steps],
425
- count: e.count
426
- });
427
- }
428
- return r;
429
- }
430
- if (e.type === "bounded-interval") {
431
- let t = I(e.first), n = I(e.last);
432
- return t.length === 0 || n.length === 0 ? [] : [{
433
- kind: "range",
434
- first: t,
435
- last: n
436
- }];
437
- }
438
- if (e.type === "counted-interval") {
439
- let t = I(e.first);
440
- return t.length === 0 ? [] : [{
441
- kind: "range",
442
- first: t,
443
- last: t,
444
- count: e.count
445
- }];
446
- }
447
- if (e.type === "enumeration") return [...L(e.left), ...L(e.right)];
448
- if (e.type === "exclusion") return L(e.left);
449
- let t = I(e);
450
- return t.length === 0 ? [] : [{
451
- kind: "single",
452
- steps: t
453
- }];
454
- }
455
- function kn(e) {
456
- let t = L(e);
457
- if (t.length === 0) return t;
458
- let n = t[0];
459
- if (n?.kind === "single" && n.steps.length > 1) {
460
- let [e, t] = n.steps;
461
- if (e?.type === "item" && typeof e.num == "string" && /^\d+$/.test(e.num) && t?.type === "item" && typeof t.num == "string" && /°/.test(t.num)) return [n, {
462
- kind: "single",
463
- steps: n.steps.slice(1)
464
- }];
465
- }
466
- return t;
467
- }
468
- function An(e, t) {
469
- if (t.num !== void 0 && e.num !== void 0) {
470
- let n = (e) => e.toLowerCase().replace(/[.)]/g, "").trim();
471
- if (n(t.num) !== n(e.num)) return !1;
472
- }
473
- return t.index !== void 0 && e.index !== void 0 ? t.index === e.index : t.num !== void 0 && e.num !== void 0;
474
- }
475
- function jn(e, t) {
476
- let n = (e) => "children" in e && (e.type === "article" || e.type === "item" || S.includes(e.type)) ? e.children : [], r = (e) => e.type === "alinéa" ? [e] : e.type === "article" || e.type === "item" || S.includes(e.type) ? e.children.flatMap(r) : [];
477
- if (S.includes(t.type)) {
478
- let r = n(e);
479
- for (let e of r) if (S.includes(e.type) && e.type === t.type && An(e, t)) return {
480
- node: e,
481
- path: [e]
482
- };
483
- return null;
484
- }
485
- if (t.type === "item") {
486
- let r = n(e);
487
- for (let e of r) if (e.type === "item" && An(e, t)) return {
488
- node: e,
489
- path: [e]
490
- };
491
- for (let e of r) {
492
- if (e.type === "alinéa") continue;
493
- let n = jn(e, t);
494
- if (n) return {
495
- node: n.node,
496
- path: [e, ...n.path]
497
- };
498
- }
499
- return null;
500
- }
501
- if (t.type === "alinéa") {
502
- let i = n(e).filter((e) => e.type === "alinéa");
503
- if (i.length === 0) return null;
504
- if (t.index !== void 0) {
505
- let n = t.index, a = r(e), o = n < 0 || n > i.length && n <= a.length ? a : i;
506
- if (o.length === 0) return null;
507
- let s = n < 0 ? o.length + n + 1 : n;
508
- if (s < 1 || s > o.length) return null;
509
- let c = o[s - 1];
510
- return {
511
- node: c,
512
- path: [c]
513
- };
514
- }
515
- return null;
516
- }
517
- if (t.type === "phrase") {
518
- if (t.index === void 0) return null;
519
- let r = e.type === "alinéa" ? [e] : n(e).filter((e) => e.type === "alinéa");
520
- if (r.length === 0) return null;
521
- let i = r.flatMap((e) => e.text.split(/(?<=[.!?;:])\s+/).map((e) => e.trim()).filter(Boolean).map((t) => ({
522
- alinea: e,
523
- text: t
524
- }))), a = t.index, o = a < 0 ? i.length + a + 1 : a;
525
- if (o < 1 || o > i.length) return null;
526
- let s = i[o - 1];
527
- return {
528
- node: {
529
- type: "alinéa",
530
- index: s.alinea.index,
531
- text: s.text,
532
- html: s.alinea.html,
533
- paragraphIndex: s.alinea.paragraphIndex
534
- },
535
- path: [s.alinea]
536
- };
537
- }
538
- return null;
539
- }
540
- function Mn(e, t) {
541
- if (t.kind === "range") {
542
- let n = Mn(e, {
543
- kind: "single",
544
- steps: t.first
545
- }), r = Mn(e, {
546
- kind: "single",
547
- steps: t.last
548
- });
549
- return !n || !r || !("node" in n) || !("node" in r) ? null : {
550
- selector: t,
551
- start: n.node,
552
- end: r.node,
553
- pathStart: n.path,
554
- pathEnd: r.path
555
- };
556
- }
557
- let n = e, r = [];
558
- for (let e of t.steps) {
559
- let t = jn(n, e);
560
- if (!t) return null;
561
- n = t.node, r.push(...t.path);
562
- }
563
- return {
564
- selector: t,
565
- node: n,
566
- path: r
567
- };
568
- }
569
- //#endregion
570
- //#region src/lib/extractors/action_directives.ts
571
- function R(e) {
572
- return e.toLowerCase().normalize("NFD").replace(/\p{Diacritic}/gu, "");
573
- }
574
- function z(e) {
575
- return e.replace(P, "");
576
- }
577
- function Nn(e) {
578
- let t = z(e);
579
- return t === e ? e.replace(yn, "") : t;
580
- }
581
- function Pn(e) {
582
- let t = e.split("\n"), n = [], r = 0;
583
- for (let e of t) {
584
- let t = r, i = t + e.length;
585
- n.push({
586
- text: e,
587
- start: t,
588
- end: i
589
- }), r = i + 1;
590
- }
591
- return n;
592
- }
593
- function Fn(e) {
594
- return P.test(e) || yn.test(e);
595
- }
596
- function In(e) {
597
- if (yn.test(e)) return {
598
- marker: "-",
599
- level: 5
600
- };
601
- let t = P.exec(e);
602
- if (!t) return null;
603
- let n = t[1] ?? "";
604
- return n ? /^\d+$/.test(n) ? {
605
- marker: n,
606
- level: 2
607
- } : /^[ivxlcdm]+$/.test(n) && (n.length > 1 || /^[ivx]$/.test(n)) ? {
608
- marker: n,
609
- level: 4
610
- } : /^[a-z]$/.test(n) ? {
611
- marker: n,
612
- level: 3
613
- } : Cn(n) || /^[A-Z]$/.test(n) ? {
614
- marker: n,
615
- level: 1
616
- } : {
617
- marker: n,
618
- level: 2
619
- } : null;
620
- }
621
- function B(e) {
622
- for (let t = 0; t < e.length; t += 1) {
623
- let n = new w(e.slice(t));
624
- if (ce(n) && n.offset > 0) return t;
625
- }
626
- return null;
627
- }
628
- function V(e) {
629
- return e.type === "reference_et_action" ? e.reference : e;
630
- }
631
- function Ln(e) {
632
- return s(new w(e)).map(V).find((e) => y(e) === "article") || (Y(e)?.reference ?? null);
633
- }
634
- function Rn(e) {
635
- let t = B(e) ?? e.length, n = dr(e), r = s(new w(e)), i = r.flatMap((e) => Array.from(v(V(e)))).filter((e) => e.type === "article" && e.position).map((e) => ({
636
- start: e.position.start,
637
- end: e.position.stop
638
- })), a = r.map(V).filter((e) => !fr(e.position, n) && !ur(e.position, i) && y(e) !== "article" && (e.position?.start ?? 0) < t).sort((e, t) => (e.position?.start ?? 0) - (t.position?.start ?? 0)), o = e.slice(0, t).trimEnd(), c = K(o, 0) ?? K(o.replace(/\b(?:est|sont)\s*$/iu, "").trimEnd(), 0), l = c && !ur(c.position, i) ? c : null, u = a[0];
639
- return !u || l && q(l) > q(u) ? l : u;
640
- }
641
- function zn(e) {
642
- let t = B(e) ?? e.length, n = dr(e), r = s(new w(e)).map(V).filter((e) => !fr(e.position, n) && (e.position?.start ?? 0) < t).sort((e, t) => (e.position?.start ?? 0) - (t.position?.start ?? 0));
643
- return r.length === 0 ? null : r.find((e) => y(e) !== "article") ?? null ?? r[0] ?? null;
644
- }
645
- function Bn(e) {
646
- let t = [e, z(e)].map((e) => e.trim()).filter((e, t, n) => e && n.indexOf(e) === t);
647
- for (let e of t) {
648
- let t = yr(e, 0) ?? Sr(e) ?? zn(e) ?? Ln(e);
649
- if (t) return t;
650
- }
651
- return null;
652
- }
653
- function Vn(e) {
654
- return e?.toLowerCase().replace(/[.)]/g, "").trim();
655
- }
656
- function Hn(e, t) {
657
- return !(e.type !== t.type || e.index !== void 0 && t.index !== void 0 && e.index !== t.index || e.num !== void 0 && t.num !== void 0 && Vn(e.num) !== Vn(t.num));
658
- }
659
- function Un(e) {
660
- let t = null;
661
- for (let n of v(e)) t = n;
662
- return t;
663
- }
664
- function Wn(e, t) {
665
- return t && e.type === "parent-enfant" && Hn(e.parent, t) ? e.child : e;
666
- }
667
- function Gn(e, t) {
668
- let n = null;
669
- for (let r of v(e)) r.type === t && r.relative === void 0 && (r.index === void 0 && r.num === void 0 || (n = r));
670
- return n;
671
- }
672
- function Kn(e, t) {
673
- if (!t) return e;
674
- let n = structuredClone(e), r = (e) => {
675
- if (e.type !== "parent-enfant" && e.type !== "bounded-interval" && e.type !== "counted-interval" && e.type !== "enumeration" && e.type !== "exclusion" && e.type !== "reference_et_action") {
676
- if (e.relative === 0) {
677
- let n = Gn(t, e.type);
678
- n && (e.index = n.index, e.num = n.num, delete e.relative);
679
- }
680
- return;
681
- }
682
- switch (e.type) {
683
- case "parent-enfant":
684
- r(e.parent), r(e.child);
685
- break;
686
- case "bounded-interval":
687
- r(e.first), r(e.last);
688
- break;
689
- case "counted-interval":
690
- r(e.first);
691
- break;
692
- case "enumeration":
693
- case "exclusion":
694
- r(e.left), r(e.right);
695
- break;
696
- case "reference_et_action":
697
- r(e.reference);
698
- break;
699
- }
700
- };
701
- return r(n), n;
702
- }
703
- function qn(e) {
704
- let t = (e) => {
705
- if (e.type !== "parent-enfant" && e.type !== "bounded-interval" && e.type !== "counted-interval" && e.type !== "enumeration" && e.type !== "exclusion" && e.type !== "reference_et_action") return e.relative !== void 0;
706
- switch (e.type) {
707
- case "parent-enfant": return t(e.parent) || t(e.child);
708
- case "bounded-interval": return t(e.first) || t(e.last);
709
- case "counted-interval": return t(e.first);
710
- case "enumeration":
711
- case "exclusion": return t(e.left) || t(e.right);
712
- case "reference_et_action": return t(e.reference);
713
- }
714
- };
715
- return t(e);
716
- }
717
- function Jn(e) {
718
- let t = [], n = [];
719
- for (let r of e) {
720
- if (!Fn(r.text)) {
721
- n[n.length - 1]?.body.push(r);
722
- continue;
723
- }
724
- let e = In(r.text)?.level ?? 0, i = {
725
- body: [],
726
- children: [],
727
- level: e,
728
- line: r
729
- };
730
- for (; n.length > 0 && n[n.length - 1].level >= e;) n.pop();
731
- n.length === 0 ? t.push(i) : n[n.length - 1]?.children.push(i), n.push(i);
732
- }
733
- return t;
734
- }
735
- function Yn(e, t) {
736
- if (!e) return t;
737
- if (!t) return e;
738
- let n = Wn(t, Un(e));
739
- return n.type === "article" || y(n), b(e, n);
740
- }
741
- function Xn(e) {
742
- return [Nn(e.line.text), ...e.body.map((e) => e.text)].join("\n").trim();
743
- }
744
- function Zn(e) {
745
- return e.body[e.body.length - 1]?.end ?? e.line.end;
746
- }
747
- function Qn(e, t) {
748
- if (!e) return t;
749
- if (!t) return e;
750
- let n = t.rowIndex ?? e.rowIndex, r = t.columnIndex ?? e.columnIndex;
751
- return {
752
- type: "table",
753
- ...n ? { rowIndex: n } : {},
754
- ...r ? { columnIndex: r } : {}
755
- };
756
- }
757
- function H(e) {
758
- return e !== void 0 && (e.rowIndex !== void 0 || e.columnIndex !== void 0);
759
- }
760
- function $n(e, t, n, r) {
761
- let i = [], a = t;
762
- for (let o of e) {
763
- let e = Nn(o.line.text), s = Xn(o);
764
- if (!s) continue;
765
- let c = Qn(r, U(s, r !== void 0)), l = Bn(e), u = Yn(t, l), d = B(s) !== null;
766
- if (o.children.length > 0) {
767
- let e = u ?? t, r = $n(o.children, e, n, c);
768
- r.length > 0 && (i.push(...r), a = r[r.length - 1]?.reference ?? a);
769
- continue;
770
- }
771
- if (!d) {
772
- a = u ?? a;
773
- continue;
774
- }
775
- let f = Ln(s), p = Yn(t, Rn(s) ?? f ?? l) ?? f ?? u;
776
- if (!p) continue;
777
- p = Kn(p, qn(p) ? a ?? t : t);
778
- let m = J({
779
- action: { action: "modifier" },
780
- reference: p,
781
- sourcePosition: {
782
- start: o.line.start,
783
- stop: Zn(o)
784
- },
785
- sourceText: s,
786
- fullText: n,
787
- tableTarget: c
788
- });
789
- if (!m) {
790
- a = p;
791
- continue;
792
- }
793
- Array.isArray(m) ? i.push(...m) : i.push(m), a = p;
794
- }
795
- return i;
796
- }
797
- function er(e) {
798
- let t = Pn(e), n = t.findIndex((e) => Fn(e.text));
799
- if (n === -1) return null;
800
- let r = t.slice(0, n).reverse().map((e) => Bn(e.text)).find((e) => e !== null) ?? null, i = $n(Jn(t.slice(n)), r, e);
801
- return i.length > 0 ? i : null;
802
- }
803
- function tr(e) {
804
- return e.split(/\n+/).map((e) => e.replace(/^\s*[«“"]\s*/u, "").trim()).filter((e) => e.length > 0).join("\n").replace(/[»”"]\s*$/u, "").trim();
805
- }
806
- function nr(e) {
807
- let t = [], n = 0;
808
- for (; n < e.length;) {
809
- let r = e.indexOf("«", n);
810
- if (r === -1) break;
811
- let i = new w(e);
812
- i.offset = r;
813
- let a = ze(i);
814
- if (!a) {
815
- n = r + 1;
816
- continue;
817
- }
818
- let o = tr(Ce(i, a).output), s = a.position ?? {
819
- start: r,
820
- stop: r + 1
821
- };
822
- t.push({
823
- text: o,
824
- start: s.start,
825
- end: s.stop
826
- });
827
- let c = s.stop ?? r + 1;
828
- n = Math.max(c, r + 1);
829
- }
830
- return t;
831
- }
832
- function rr(e, t) {
833
- let n = e.indexOf("«");
834
- if (n === -1) return;
835
- let r = e.indexOf("»", n + 1);
836
- if (r === -1) return;
837
- let i = e.slice(n + 1, r);
838
- if (i.trim()) return {
839
- type: "citation",
840
- text: i,
841
- sourcePosition: {
842
- start: t + n + 1,
843
- stop: t + r
844
- }
845
- };
846
- }
847
- function ir(e) {
848
- let t = R(e);
849
- return /\btableau\b/.test(t) && /\b(?:tableau|celui)\s+(?:suivant|ainsi\s+redigee?|ainsi\s+rediges|ainsi\s+redigees)\b/.test(t);
850
- }
851
- function ar(e) {
852
- for (let t of Pn(e)) {
853
- if (!ir(t.text)) continue;
854
- let e = t.text.indexOf(":");
855
- return e === -1 ? t.end : t.start + e + 1;
856
- }
857
- return null;
858
- }
859
- function or(e, t) {
860
- let n = ar(e);
861
- return n === null ? rr(e, t) : rr(e.slice(n), t + n);
862
- }
863
- function sr(e, t) {
864
- if (t.length === 0) return e;
865
- let n = 0, r = [];
866
- for (let { start: i, end: a } of t) {
867
- let t = Math.max(0, Math.min(i, e.length)), o = Math.max(t, Math.min(a, e.length));
868
- t > n && r.push(e.slice(n, t)), o > t && r.push(" "), n = o;
869
- }
870
- return n < e.length && r.push(e.slice(n)), r.join("");
871
- }
872
- function cr(e) {
873
- let t = e.trim();
874
- if (!t) return null;
875
- let n = Et(new w(t));
876
- if (typeof n == "number") return n;
877
- if (n && typeof n == "object" && "value" in n) {
878
- let e = n.value;
879
- return Number.isFinite(e) ? e : null;
880
- }
881
- let r = kt(new w(t));
882
- if (r && typeof r == "object" && "value" in r) {
883
- let e = r.value;
884
- return Number.isFinite(e) ? e : null;
885
- }
886
- return typeof r == "number" ? r : null;
887
- }
888
- function lr(e, t) {
889
- let n = e.slice(0, t), r = /([0-9A-Za-zÀ-ÖØ-öø-ÿ'’.-]+)\s+occurrence\b/giu, i = null, a;
890
- for (; (a = r.exec(n)) !== null;) i = a;
891
- if (!i) return null;
892
- let o = i[1], s = cr(o);
893
- return !s || s < 1 ? null : s;
894
- }
895
- function U(e, t = !1) {
896
- let n = sr(e, nr(e)), r = R(n), i = /\btableau\b/.test(r);
897
- if (!i && !t) return;
898
- let a = (e) => {
899
- if (!e) return;
900
- let t = cr(e.replace(/^(?:a|à)\s+la\s+/iu, ""));
901
- return t && t > 0 ? t : void 0;
902
- }, o = (e, t) => e || t ? {
903
- type: "table",
904
- ...e ? { rowIndex: e } : {},
905
- ...t ? { columnIndex: t } : {}
906
- } : void 0, s = /(?:^|[^\p{L}\p{N}_])(?:a|à)\s+la\s+(.+?)\s+ligne\s+de\s+la\s+(.+?)\s+colonne\b/iu.exec(n);
907
- if (s) {
908
- let e = o(a(s[1]), a(s[2]));
909
- if (e) return e;
910
- }
911
- let c = /(?:^|[^\p{L}\p{N}_])(?:a|à)\s+la\s+(.+?)\s+colonne\s+de\s+la\s+(.+?)\s+ligne\b/iu.exec(n);
912
- if (c) {
913
- let e = a(c[1]), t = o(a(c[2]), e);
914
- if (t) return t;
915
- }
916
- let l = /\bla\s+(.+?)\s+ligne\b/iu.exec(n), u = /\bla\s+(.+?)\s+colonne\b/iu.exec(n);
917
- return o(a(l?.[1]), a(u?.[1])) || (i ? { type: "table" } : void 0);
918
- }
919
- function ur(e, t) {
920
- return e ? t.some((t) => e.start >= t.start && e.stop <= t.end) : !1;
921
- }
922
- function dr(e) {
923
- let t = [], n = 0;
924
- for (; n < e.length;) {
925
- let r = e.indexOf("«", n);
926
- if (r === -1) break;
927
- let i = e.indexOf("»", r + 1);
928
- if (i === -1) {
929
- t.push({
930
- start: r,
931
- end: e.length
932
- });
933
- break;
934
- }
935
- t.push({
936
- start: r,
937
- end: i + 1
938
- }), n = i + 1;
939
- }
940
- return t;
941
- }
942
- function fr(e, t) {
943
- return ur(e, t);
944
- }
945
- function pr(e) {
946
- if (!e.includes("«")) return e;
947
- let t = e.split(""), n = !1;
948
- for (let e = 0; e < t.length; e++) {
949
- let r = t[e];
950
- if (r === "«") {
951
- n = !0;
952
- continue;
953
- }
954
- if (r === "»") {
955
- n = !1;
956
- continue;
957
- }
958
- n && (t[e] = " ");
959
- }
960
- return t.join("");
961
- }
962
- function W(e, t) {
963
- e && (e.start += t, e.stop += t);
964
- }
965
- function G(e, t) {
966
- if (e.type === "parent-enfant") {
967
- G(e.parent, t), G(e.child, t), W(e.position, t);
968
- return;
969
- }
970
- if (e.type === "bounded-interval") {
971
- G(e.first, t), G(e.last, t), W(e.position, t);
972
- return;
973
- }
974
- if (e.type === "counted-interval") {
975
- G(e.first, t), W(e.position, t);
976
- return;
977
- }
978
- if (e.type === "enumeration" || e.type === "exclusion") {
979
- G(e.left, t), G(e.right, t), W(e.position, t);
980
- return;
981
- }
982
- if (e.type === "reference_et_action") {
983
- G(e.reference, t), W(e.position, t);
984
- return;
985
- }
986
- W(e.position, t);
987
- }
988
- function mr(e) {
989
- return e.replace(/\b(de\s+l['’]?|de\s+la|de\s+le|du|des)\s*$/i, "");
990
- }
991
- function hr(e) {
992
- let t = R(e);
993
- return t.startsWith("alinea") ? "alinéa" : t.startsWith("phrase") ? "phrase" : null;
994
- }
995
- function gr(e) {
996
- let t = /^(?:(?:[aà]\s+)?l['’]|(?:[aà]\s+)?la\b|(?:[aà]\s+)?le\b|les\b|des\b|aux\b|du\b)\s*/iu.exec(e)?.[0].length ?? 0, n = e.slice(t > 0 ? t : 0).trim();
997
- return n ? {
998
- text: n,
999
- offset: t
1000
- } : null;
1001
- }
1002
- function _r(e) {
1003
- return [...e.matchAll(/(?:^|\P{L})(\p{L})/gu)].map((e) => (e.index ?? 0) + e[0].length - (e[1]?.length ?? 0));
1004
- }
1005
- function vr(e) {
1006
- let t = new w(e), n = Yt(t);
1007
- return !n || t.remaining().trim().length !== 0 ? null : n;
1008
- }
1009
- function yr(e, t) {
1010
- let n = e.trim().replace(/[;:,]\s*$/u, "").replace(/\b(?:est|sont)\s*$/iu, "").trim();
1011
- if (!n) return null;
1012
- for (let e of _r(n)) {
1013
- let r = n.slice(e).trim(), i = /\b(alinéas?|phrases?)\b\s*$/iu.exec(r);
1014
- if (!i || i.index === void 0) continue;
1015
- let a = hr(i[1] ?? "");
1016
- if (!a) continue;
1017
- let o = r.slice(0, i.index).trim();
1018
- if (!o) continue;
1019
- let s = /\s*(,|\bet\b|\bou\b|(?<!\p{L})[aà](?!\p{L}))\s*/giu, c = [], l = 0, u;
1020
- for (; (u = s.exec(o)) !== null;) {
1021
- let e = R(u[1] ?? "");
1022
- c.push({
1023
- separator: e === "ou" ? "ou" : e === "," ? "," : e === "a" ? "à" : "et",
1024
- start: l,
1025
- text: o.slice(l, u.index)
1026
- }), l = s.lastIndex;
1027
- }
1028
- if (c.push({
1029
- start: l,
1030
- text: o.slice(l)
1031
- }), c.length < 2) continue;
1032
- let d = c.some((e) => e.separator === "à"), f = [], p = [], m = !0, h;
1033
- for (let [n, r] of c.entries()) {
1034
- let i = gr(r.text);
1035
- if (!i) {
1036
- f.length = 0;
1037
- break;
1038
- }
1039
- let o = vr(`${i.text} ${a}`);
1040
- if (!o) {
1041
- f.length = 0;
1042
- break;
1043
- }
1044
- G(o, t + e + r.start + i.offset), f.push(o), o.type !== a || o.index === void 0 || o.index < 1 ? m = !1 : (h !== void 0 && !d && o.index !== h + 1 && (m = !1), h = o.index), n < c.length - 1 && (p.push(r.separator ?? "et"), (r.separator ?? "et") === "ou" && (m = !1));
1045
- }
1046
- let [g, ...ee] = f;
1047
- if (!g || ee.length === 0) continue;
1048
- let te = {
1049
- start: t + e + c[0].start,
1050
- stop: t + e + r.length
1051
- };
1052
- return m ? {
1053
- first: g,
1054
- last: f[f.length - 1],
1055
- position: te,
1056
- type: "bounded-interval"
1057
- } : Se(g, ee.map((e, t) => [p[t] ?? "et", e]), te);
1058
- }
1059
- return null;
1060
- }
1061
- function br(e, t) {
1062
- let n = e.trim().replace(/[;:,]\s*$/u, "").replace(/\b(?:est|sont)\s*$/iu, "").trim();
1063
- if (!n) return null;
1064
- for (let e of _r(n)) {
1065
- let r = n.slice(e);
1066
- if (!r) continue;
1067
- let a = new w(r), o = Yt(a);
1068
- if (!o || a.offset === 0 || !i(a)) continue;
1069
- let s = a.offset, c = yr(r.slice(s), t + e + s);
1070
- if (c) return G(o, t + e), {
1071
- ...b(c, o),
1072
- position: {
1073
- start: o.position.start,
1074
- stop: c.position.stop
1075
- }
1076
- };
1077
- }
1078
- return null;
1079
- }
1080
- function K(e, t) {
1081
- let n = mr(e);
1082
- if (!n) return null;
1083
- let r = br(n, t);
1084
- if (r) return r;
1085
- let i = yr(n, t);
1086
- if (i) return i;
1087
- for (let e of _r(n)) {
1088
- let r = n.slice(e);
1089
- if (!r) continue;
1090
- let i = new w(r), a = Yt(i);
1091
- if (!(!a || i.offset === 0) && r.slice(i.offset).trim().length === 0) return G(a, t + e), a;
1092
- }
1093
- return null;
1094
- }
1095
- function q(e) {
1096
- return Math.max(0, ...kn(e).map((e) => e.kind === "single" ? e.steps.length : Math.max(e.first.length, e.last.length)));
1097
- }
1098
- function xr(e) {
1099
- return s(new w(e)).map(V).map((e) => ({
1100
- reference: e,
1101
- specificity: q(e)
1102
- })).filter((e) => e.specificity > 0).sort((e, t) => t.specificity - e.specificity)[0]?.reference ?? null;
1103
- }
1104
- function Sr(e) {
1105
- let t = /\barticle\b/i.exec(e);
1106
- if (!t || t.index === void 0) return null;
1107
- let n = t.index, r = new w(e.slice(n)), i = Vt(r);
1108
- if (!i) return null;
1109
- G(i, n);
1110
- let a = e.slice(0, n), o = n + r.offset, s = B(e) ?? e.length, c = e.slice(o, s), l = xr(a) ?? K(a, 0) ?? xr(c) ?? K(c, o);
1111
- return l ? b(i, l) : null;
1112
- }
1113
- function Cr(e, t, n, r, i) {
1114
- let a = R(e), o = R(sr(e, r)), s = /\bredige\b|\bredigee\b|\bredigees\b|\brediges\b|\bainsi\b/.test(a) || /\bdispositions suivantes\b/.test(a), c = /\bapres\b/.test(o) || /\bapres (la|les) reference\b|\bapres (le|les) mots\b|\bapres la mention\b/.test(o), l = /\bavant\b/.test(o) || /\bavant (la|les) reference\b|\bavant (le|les) mots\b|\bavant la mention\b/.test(o), u = t.action === "rétablir" || /\bretabl/.test(a), d = /\binsere(?:e|es|s)?\b|\bajoute\b|\bajoutee\b|\bajoutes\b|\bajoutees\b|\bcomplete(?:e|es|s)?\b/.test(a) || u, f = /\bremplace\b|\bremplacee\b|\bremplaces\b|\bremplacees\b/.test(a), p = /\bsupprime\b|\bsupprimee\b|\bsupprimes\b|\bsupprimees\b|\babroge\b|\babrogee\b|\babroges\b|\babrogees\b/.test(a), m = ir(e), h = l ? "insert_before" : "insert_after";
1115
- if ((c || l) && d && p && i.length >= 3) {
1116
- let e = i.slice(0, -2), t = i.at(-2), n = i.at(-1);
1117
- if (e.length > 0 && t && n) return [{
1118
- kind: "delete",
1119
- targetText: e[0],
1120
- extraTargetTexts: e.slice(1)
1121
- }, {
1122
- kind: h,
1123
- targetText: t,
1124
- insertText: n,
1125
- expectsFollowingTable: m
1126
- }];
1127
- }
1128
- if (!c && !l && d && p && i.length >= 2 && /\best ajoutee?\s+une phrase\b|\bune phrase ainsi redigee\b/.test(a)) {
1129
- let e = i.slice(0, -1), t = i.at(-1);
1130
- if (e.length > 0 && t) return [{
1131
- kind: "delete",
1132
- targetText: e[0],
1133
- extraTargetTexts: e.slice(1)
1134
- }, {
1135
- kind: "insert_after",
1136
- targetText: "",
1137
- insertText: t,
1138
- expectsFollowingTable: m
1139
- }];
1140
- }
1141
- if ((c || l) && d && f && i.length >= 4) {
1142
- let e = i.at(-2), t = i.at(-1);
1143
- if (e && t) return [{
1144
- kind: "replace",
1145
- targetText: i[0],
1146
- replacementText: i[1]
1147
- }, {
1148
- kind: h,
1149
- targetText: e,
1150
- insertText: t,
1151
- expectsFollowingTable: m
1152
- }];
1153
- }
1154
- if (t.action === "supprimer" || p) return n === "article" && i.length === 0 ? { kind: "delete_article" } : i.length >= 1 ? {
1155
- kind: "delete",
1156
- targetText: i[0],
1157
- extraTargetTexts: i.slice(1)
1158
- } : { kind: "delete_portion" };
1159
- if (f && /\bpar\s+(?:le|un)\s+tableau\s+(?:suivant|ainsi\s+redigee?|ainsi\s+rediges|ainsi\s+redigees)\b/.test(a)) return {
1160
- kind: "replace_portion",
1161
- replacement: { type: "following_table" }
1162
- };
1163
- if (f && i.length >= 2) return {
1164
- kind: "replace",
1165
- targetText: i[0],
1166
- replacementText: i[1]
1167
- };
1168
- if (f && i.length === 1 && s) return {
1169
- kind: "replace_portion",
1170
- replacement: {
1171
- type: "text",
1172
- text: i[0]
1173
- }
1174
- };
1175
- if (d && m) return l ? {
1176
- kind: "insert_before",
1177
- targetText: "",
1178
- insertText: "",
1179
- expectsFollowingTable: !0
1180
- } : {
1181
- kind: "insert_after",
1182
- targetText: "",
1183
- insertText: "",
1184
- expectsFollowingTable: !0
1185
- };
1186
- if (d && i.length >= 2) {
1187
- if (c) return {
1188
- kind: "insert_after",
1189
- targetText: i[0],
1190
- insertText: i[1],
1191
- expectsFollowingTable: m
1192
- };
1193
- if (l) return {
1194
- kind: "insert_before",
1195
- targetText: i[0],
1196
- insertText: i[1],
1197
- expectsFollowingTable: m
1198
- };
1199
- }
1200
- return d && i.length === 1 ? c ? {
1201
- kind: "insert_after",
1202
- targetText: "",
1203
- insertText: i[0],
1204
- expectsFollowingTable: m
1205
- } : l ? {
1206
- kind: "insert_before",
1207
- targetText: "",
1208
- insertText: i[0],
1209
- expectsFollowingTable: m
1210
- } : {
1211
- kind: "insert_after",
1212
- targetText: "",
1213
- insertText: i[0],
1214
- expectsFollowingTable: m
1215
- } : null;
1216
- }
1217
- function J({ action: e, reference: t, sourcePosition: n, sourceText: r, fullText: i, tableTarget: a }) {
1218
- let o = e.target ?? y(t), s = kn(t), c = i && n.start < i.length ? i.slice(n.start) : r, l = i && n.start < i.length ? n.start : 0, u = i === r && n.start < r.length ? r.slice(n.start) : r, d = nr(u), f = Cr(r, e, o, d, d.map((e) => e.text));
1219
- if (!f) return null;
1220
- let p = or(c, l), m = (e) => {
1221
- switch (e.kind) {
1222
- case "insert_after":
1223
- case "insert_before": return e.expectsFollowingTable && !p ? null : {
1224
- kind: e.kind,
1225
- targetType: o,
1226
- reference: t,
1227
- portionSelectors: s,
1228
- targetText: e.targetText,
1229
- insertText: e.insertText,
1230
- ...e.expectsFollowingTable && p ? { citation: p } : {},
1231
- ...H(a) ? { tableTarget: a } : {},
1232
- sourcePosition: n,
1233
- sourceText: r
1234
- };
1235
- case "replace": return {
1236
- kind: "replace",
1237
- targetType: o,
1238
- reference: t,
1239
- portionSelectors: s,
1240
- targetText: e.targetText,
1241
- replacementText: e.replacementText,
1242
- replacement: {
1243
- type: "text",
1244
- text: e.replacementText
1245
- },
1246
- ...H(a) ? { tableTarget: a } : {},
1247
- sourcePosition: n,
1248
- sourceText: r
1249
- };
1250
- case "replace_portion": return e.replacement.type === "following_table" && !p ? null : {
1251
- kind: "replace_portion",
1252
- targetType: o,
1253
- reference: t,
1254
- portionSelectors: s,
1255
- replacementText: e.replacement.type === "text" ? e.replacement.text : "",
1256
- replacement: e.replacement,
1257
- ...e.replacement.type === "following_table" && p ? { citation: p } : {},
1258
- ...H(a) ? { tableTarget: a } : {},
1259
- sourcePosition: n,
1260
- sourceText: r
1261
- };
1262
- case "delete": {
1263
- let i = d.map((e) => lr(u, e.start)), c = /* @__PURE__ */ new Map();
1264
- for (let [e, t] of d.entries()) c.has(t.text) || c.set(t.text, i[e] ?? null);
1265
- let l = [e.targetText, ...e.extraTargetTexts ?? []].filter((e) => e && e.trim().length > 0).filter((e, t, n) => n.indexOf(e) === t);
1266
- return l.length > 1 ? l.map((e) => ({
1267
- kind: "delete",
1268
- targetType: o,
1269
- reference: t,
1270
- portionSelectors: s,
1271
- targetText: e,
1272
- occurrenceIndex: c.get(e) ?? void 0,
1273
- ...H(a) ? { tableTarget: a } : {},
1274
- sourcePosition: n,
1275
- sourceText: r
1276
- })) : {
1277
- kind: "delete",
1278
- targetType: o,
1279
- reference: t,
1280
- portionSelectors: s,
1281
- targetText: e.targetText,
1282
- occurrenceIndex: c.get(e.targetText) ?? void 0,
1283
- ...H(a) ? { tableTarget: a } : {},
1284
- sourcePosition: n,
1285
- sourceText: r
1286
- };
1287
- }
1288
- case "delete_portion": return {
1289
- kind: "delete_portion",
1290
- targetType: o,
1291
- reference: t,
1292
- portionSelectors: s,
1293
- ...H(a) ? { tableTarget: a } : {},
1294
- sourcePosition: n,
1295
- sourceText: r
1296
- };
1297
- case "delete_article": return o === "article" ? {
1298
- kind: "delete_article",
1299
- targetType: o,
1300
- reference: t,
1301
- portionSelectors: s,
1302
- sourcePosition: n,
1303
- sourceText: r
1304
- } : null;
1305
- default: return null;
1306
- }
1307
- };
1308
- if (Array.isArray(f)) {
1309
- let e = [];
1310
- for (let t of f) {
1311
- let n = m(t);
1312
- n && (Array.isArray(n) ? e.push(...n) : e.push(n));
1313
- }
1314
- return e.length > 0 ? e : null;
1315
- }
1316
- return m(f);
1317
- }
1318
- function Y(e) {
1319
- let t = /\barticle\s+([0-9]+(?:-[0-9]+)?(?:\s*[A-Z])?(?:\s+[a-z]+)?)\b/i.exec(e);
1320
- if (!t || t.index === void 0) return null;
1321
- let n = t.index, r = t.index + t[0].length;
1322
- return {
1323
- reference: {
1324
- num: t[1].trim(),
1325
- position: {
1326
- start: n,
1327
- stop: r
1328
- },
1329
- type: "article"
1330
- },
1331
- position: {
1332
- start: n,
1333
- stop: r
1334
- }
1335
- };
1336
- }
1337
- function wr(e, t) {
1338
- let n = Ue(e).output;
1339
- if (t.allowListExtraction) {
1340
- let e = er(n);
1341
- if (e) return e;
1342
- }
1343
- let r = dr(n), i = pr(n), a = s(new w(n));
1344
- if (r.length > 0 && (a = a.filter((e) => !fr(e.position, r))), a.length === 0 && (a = s(new w(i.split(",")[0] ?? i))), a.length === 0) {
1345
- let e = Y(i);
1346
- e && (a = [{
1347
- ...e.reference,
1348
- position: e.position
1349
- }]);
1350
- }
1351
- if (a.length === 1 && a[0]?.type === "article") {
1352
- let e = Sr(i);
1353
- e && (a = [e]);
1354
- }
1355
- let o = B(i);
1356
- if (o !== null) {
1357
- let e = a.some((e) => y(V(e)) === "article"), t = K(i.slice(0, o), 0), n = t ? q(t) : 0, r = Math.max(0, ...a.map((e) => q(V(e))));
1358
- !e && t && n > r && (a = [t]);
1359
- }
1360
- let c = [];
1361
- for (let e of a) {
1362
- if (e.type === "reference_et_action") {
1363
- let t = e.position?.start ?? 0, r = {
1364
- start: t,
1365
- stop: n.length
1366
- }, i = n.slice(t), a = J({
1367
- action: e.action,
1368
- reference: e.reference,
1369
- sourcePosition: r,
1370
- sourceText: i,
1371
- fullText: n,
1372
- tableTarget: U(i)
1373
- });
1374
- a && (Array.isArray(a) ? c.push(...a) : c.push(a));
1375
- continue;
1376
- }
1377
- let t = J({
1378
- action: { action: "modifier" },
1379
- reference: e,
1380
- sourcePosition: e.position ?? {
1381
- start: 0,
1382
- stop: n.length
1383
- },
1384
- sourceText: n,
1385
- fullText: n,
1386
- tableTarget: U(n)
1387
- });
1388
- t && (Array.isArray(t) ? c.push(...t) : c.push(t));
1389
- }
1390
- if (c.length === 0) {
1391
- let e = Y(i);
1392
- if (e) {
1393
- let t = J({
1394
- action: { action: "modifier" },
1395
- reference: e.reference,
1396
- sourcePosition: e.position,
1397
- sourceText: n,
1398
- fullText: n,
1399
- tableTarget: U(n)
1400
- });
1401
- t && (Array.isArray(t) ? c.push(...t) : c.push(t));
1402
- }
1403
- }
1404
- return c;
1405
- }
1406
- function Tr(e) {
1407
- return wr(e, { allowListExtraction: !0 });
1408
- }
1409
- function Er(e) {
1410
- let t = R(e);
1411
- return t.includes("«") || t.includes("»") || !e.trim().endsWith(":") ? !1 : /\b(remplace|modifie|redige|rediges|redigee|redigees)\b/.test(t);
1412
- }
1413
- function Dr(e, t) {
1414
- let n = [], r = !1, i = t + 1;
1415
- for (; i < e.length;) {
1416
- let t = e[i], a = z(t);
1417
- if (!r && a.includes("«") && (r = !0), r) {
1418
- if (n.push(a), a.includes("»")) break;
1419
- } else if (a.trim().length > 0) break;
1420
- i += 1;
1421
- }
1422
- return !r || n.length === 0 ? null : {
1423
- combinedText: [z(e[t]), ...n].join("\n"),
1424
- endIndex: i
1425
- };
1426
- }
1427
- function Or(e) {
1428
- let t = ct()(e).output.split("\n").map((e) => e.trim()).filter((e) => e.length > 0), n = [];
1429
- for (let e = 0; e < t.length; e += 1) {
1430
- let r = t[e];
1431
- if (Er(r)) {
1432
- let r = Dr(t, e);
1433
- if (r) {
1434
- let t = Tr(r.combinedText);
1435
- if (t.length > 0) {
1436
- n.push(...t), e = r.endIndex;
1437
- continue;
1438
- }
1439
- }
1440
- }
1441
- let i = wr(r, { allowListExtraction: !1 });
1442
- i.length > 0 && n.push(...i);
1443
- }
1444
- return n;
206
+ }, pn = new Intl.DateTimeFormat("fr-FR", { dateStyle: "long" });
207
+ function mn(e) {
208
+ return pn.format(new Date(e)).replace(/^1 /, "1er ");
1445
209
  }
1446
210
  //#endregion
1447
211
  //#region src/lib/json.ts
1448
- var kr = (e, t) => t instanceof Object && !Array.isArray(t) ? Object.keys(t).sort().reduce((e, n) => (e[n] = t[n], e), {}) : t;
212
+ var hn = (e, t) => t instanceof Object && !Array.isArray(t) ? Object.keys(t).sort().reduce((e, n) => (e[n] = t[n], e), {}) : t;
1449
213
  //#endregion
1450
214
  //#region src/lib/markdown.ts
1451
- function X(e) {
215
+ function K(e) {
1452
216
  return e?.replace(/\s+/g, " ").replaceAll("[", "\\[").replaceAll("]", "\\]");
1453
217
  }
1454
218
  //#endregion
1455
219
  //#region src/lib/linkers/markdown.ts
1456
- async function Ar({ canutesDb: e, date: t, linkBaseUrl: r, linkType: i, previousContext: a, text: o }) {
1457
- let s = Ue(o), c = new w(s.output);
1458
- c.currentArticle = a?.currentArticle, c.currentText = a?.currentText;
1459
- let l = o, u = 0;
1460
- for await (let a of Ze({
220
+ async function q({ canutesDb: e, date: t, linkBaseUrl: n, linkType: r, previousContext: i, text: a }) {
221
+ let o = N(a), s = new h(o.output);
222
+ s.currentArticle = i?.currentArticle, s.currentText = i?.currentText;
223
+ let c = a, l = 0;
224
+ for await (let i of O({
1461
225
  canutesDb: e,
1462
- context: c,
226
+ context: s,
1463
227
  date: t,
1464
- transformation: s
1465
- })) switch (a.type) {
228
+ transformation: o
229
+ })) switch (i.type) {
1466
230
  case "article_definition": break;
1467
231
  case "external_article": {
1468
- let { articleId: e, originalTransformation: t } = a;
232
+ let { articleId: e, originalTransformation: t } = i;
1469
233
  if (e !== void 0) {
1470
- if (t === void 0) throw Error(`Missing originalTransformation attribute in external article link: ${JSON.stringify(a, null, 2)}`);
1471
- let o = E(t, `[${X(n(l, t, u))}](${T(i, r, e)})`);
1472
- l = l.slice(0, t.position.start + u) + o + l.slice(t.position.stop + u), u += o.length - (t.position.stop - t.position.start);
234
+ if (t === void 0) throw Error(`Missing originalTransformation attribute in external article link: ${JSON.stringify(i, null, 2)}`);
235
+ let a = A(t, `[${K(D(c, t, l))}](${E(r, n, e)})`);
236
+ c = c.slice(0, t.position.start + l) + a + c.slice(t.position.stop + l), l += a.length - (t.position.stop - t.position.start);
1473
237
  }
1474
238
  break;
1475
239
  }
1476
240
  case "external_division": {
1477
- let { originalTransformation: e, sectionTaId: t } = a;
241
+ let { originalTransformation: e, sectionTaId: t } = i;
1478
242
  if (t !== void 0) {
1479
- if (e === void 0) throw Error(`Missing originalTransformation attribute in external division link: ${JSON.stringify(a, null, 2)}`);
1480
- let o = E(e, `[${X(n(l, e, u))}](${T(i, r, t)})`);
1481
- l = l.slice(0, e.position.start + u) + o + l.slice(e.position.stop + u), u += o.length - (e.position.stop - e.position.start);
243
+ if (e === void 0) throw Error(`Missing originalTransformation attribute in external division link: ${JSON.stringify(i, null, 2)}`);
244
+ let a = A(e, `[${K(D(c, e, l))}](${E(r, n, t)})`);
245
+ c = c.slice(0, e.position.start + l) + a + c.slice(e.position.stop + l), l += a.length - (e.position.stop - e.position.start);
1482
246
  }
1483
247
  break;
1484
248
  }
1485
249
  case "external_text": {
1486
- let { originalTransformation: e, text: t } = a;
250
+ let { originalTransformation: e, text: t } = i;
1487
251
  if (t.cid === void 0) {
1488
- t.relative !== 0 && console.error(`Link to text "${c.text(t.position)}" without CID: ${JSON.stringify(t, null, 2)}`);
252
+ t.relative !== 0 && console.error(`Link to text "${s.text(t.position)}" without CID: ${JSON.stringify(t, null, 2)}`);
1489
253
  continue;
1490
254
  }
1491
- if (e === void 0) throw Error(`Missing originalTransformation attribute in external text link: ${JSON.stringify(a, null, 2)}`);
1492
- let o = E(e, `[${X(n(l, e, u))}](${T(i, r, t.cid)})`);
1493
- l = l.slice(0, e.position.start + u) + o + l.slice(e.position.stop + u), u += o.length - (e.position.stop - e.position.start);
255
+ if (e === void 0) throw Error(`Missing originalTransformation attribute in external text link: ${JSON.stringify(i, null, 2)}`);
256
+ let a = A(e, `[${K(D(c, e, l))}](${E(r, n, t.cid)})`);
257
+ c = c.slice(0, e.position.start + l) + a + c.slice(e.position.stop + l), l += a.length - (e.position.stop - e.position.start);
1494
258
  break;
1495
259
  }
1496
260
  case "internal_article": {
1497
- let { definition: e, originalTransformation: t } = a;
1498
- if (t === void 0) throw Error(`Missing originalTransformation attribute in internal article link: ${JSON.stringify(a, null, 2)}`);
1499
- let r = E(t, `[${X(n(l, t, u))}](#definition_article_${e.textId}_${e.article.num.replaceAll(" ", "_")})`);
1500
- l = l.slice(0, t.position.start + u) + r + l.slice(t.position.stop + u), u += r.length - (t.position.stop - t.position.start);
261
+ let { definition: e, originalTransformation: t } = i;
262
+ if (t === void 0) throw Error(`Missing originalTransformation attribute in internal article link: ${JSON.stringify(i, null, 2)}`);
263
+ let n = A(t, `[${K(D(c, t, l))}](#definition_article_${e.textId}_${e.article.num.replaceAll(" ", "_")})`);
264
+ c = c.slice(0, t.position.start + l) + n + c.slice(t.position.stop + l), l += n.length - (t.position.stop - t.position.start);
1501
265
  break;
1502
266
  }
1503
267
  case "european_text": {
1504
- let { url: e, originalTransformation: t } = a;
268
+ let { url: e, originalTransformation: t } = i;
1505
269
  if (e === void 0) continue;
1506
- if (t === void 0) throw Error(`Missing originalTransformation attribute in european text link: ${JSON.stringify(a, null, 2)}`);
1507
- let r = E(t, `<a class="lien_texte_european" href="${e}" target="_blank">${n(l, t, u)}</a>`);
1508
- l = l.slice(0, t.position.start + u) + r + l.slice(t.position.stop + u), u += r.length - (t.position.stop - t.position.start);
270
+ if (t === void 0) throw Error(`Missing originalTransformation attribute in european text link: ${JSON.stringify(i, null, 2)}`);
271
+ let n = A(t, `<a class="lien_texte_european" href="${e}" target="_blank">${D(c, t, l)}</a>`);
272
+ c = c.slice(0, t.position.start + l) + n + c.slice(t.position.stop + l), l += n.length - (t.position.stop - t.position.start);
1509
273
  break;
1510
274
  }
1511
- default: _("Link", a);
275
+ default: g("Link", i);
1512
276
  }
1513
277
  return {
1514
- context: c,
1515
- output: l === o ? null : l
278
+ context: s,
279
+ output: c === a ? null : c
1516
280
  };
1517
281
  }
1518
282
  //#endregion
1519
283
  //#region src/lib/loaders/assemblee.ts
1520
- async function jr(e, t, n) {
284
+ async function gn(e, t, n) {
1521
285
  let r = t.get("Document");
1522
286
  r === void 0 && (r = /* @__PURE__ */ new Map(), t.set("Document", r));
1523
287
  let i = r.get(n);
@@ -1527,7 +291,7 @@ async function jr(e, t, n) {
1527
291
  WHERE uid = ${n}
1528
292
  `)[0]?.data, r.set(n, i ?? null)), i ?? void 0;
1529
293
  }
1530
- async function Mr(e, t, n) {
294
+ async function _n(e, t, n) {
1531
295
  let r = t.get("Document");
1532
296
  return r === void 0 && (r = /* @__PURE__ */ new Map(), t.set("Document", r)), (await e`
1533
297
  SELECT data, uid
@@ -1535,7 +299,7 @@ async function Mr(e, t, n) {
1535
299
  WHERE dossier_uid = ${n}
1536
300
  `).map(({ data: e, uid: t }) => (r.set(t, e ?? null), e));
1537
301
  }
1538
- async function Nr(e, t, n) {
302
+ async function vn(e, t, n) {
1539
303
  let r = t.get("DossierParlementaire");
1540
304
  r === void 0 && (r = /* @__PURE__ */ new Map(), t.set("DossierParlementaire", r));
1541
305
  let i = r.get(n);
@@ -1547,15 +311,15 @@ async function Nr(e, t, n) {
1547
311
  }
1548
312
  //#endregion
1549
313
  //#region src/lib/text_parsers/search_queries.ts
1550
- var Pr = x("art(?:icle|icl|ic|i|s)?\\.?|al(?:inéa|inea|in|i)?\\.?", { flags: "i" }), Z = O([
1551
- Pr,
1552
- Ye(tt, { default: "" }),
1553
- C(Nt, wt)
314
+ var J = v("art(?:icle|icl|ic|i|s)?\\.?|al(?:inéa|inea|in|i)?\\.?", { flags: "i" }), Y = y([
315
+ J,
316
+ r(P, { default: "" }),
317
+ f(p, b)
1554
318
  ], { value: (e, t) => ({
1555
319
  num: e[2],
1556
320
  position: t.position(),
1557
321
  type: "article"
1558
- }) }), Fr = C(x("c(?:ode|\\.)? ?civ(?:il)?", {
322
+ }) }), X = f(v("c(?:ode|\\.)? ?civ(?:il)?", {
1559
323
  flags: "i",
1560
324
  value: (e, t) => ({
1561
325
  cid: "LEGITEXT000006070721",
@@ -1564,7 +328,7 @@ var Pr = x("art(?:icle|icl|ic|i|s)?\\.?|al(?:inéa|inea|in|i)?\\.?", { flags: "i
1564
328
  title: "Code civil",
1565
329
  type: "texte"
1566
330
  })
1567
- }), x("c(?:ode|\\.)? ?trav(?:ail)?", {
331
+ }), v("c(?:ode|\\.)? ?trav(?:ail)?", {
1568
332
  flags: "i",
1569
333
  value: (e, t) => ({
1570
334
  cid: "LEGITEXT000006072050",
@@ -1573,7 +337,7 @@ var Pr = x("art(?:icle|icl|ic|i|s)?\\.?|al(?:inéa|inea|in|i)?\\.?", { flags: "i
1573
337
  title: "Code du travail",
1574
338
  type: "texte"
1575
339
  })
1576
- }), x("c(?:ode|\\.)? ?p[eé]n(?:al)?", {
340
+ }), v("c(?:ode|\\.)? ?p[eé]n(?:al)?", {
1577
341
  flags: "i",
1578
342
  value: (e, t) => ({
1579
343
  cid: "LEGITEXT000006070719",
@@ -1582,7 +346,7 @@ var Pr = x("art(?:icle|icl|ic|i|s)?\\.?|al(?:inéa|inea|in|i)?\\.?", { flags: "i
1582
346
  title: "Code pénal",
1583
347
  type: "texte"
1584
348
  })
1585
- }), x("c(?:ode|\\.)? ?pr(?:oc(?:[eé]dure)?)? ?p[eé]n(?:al)?|cpp", {
349
+ }), v("c(?:ode|\\.)? ?pr(?:oc(?:[eé]dure)?)? ?p[eé]n(?:al)?|cpp", {
1586
350
  flags: "i",
1587
351
  value: (e, t) => ({
1588
352
  cid: "LEGITEXT000006071154",
@@ -1591,7 +355,7 @@ var Pr = x("art(?:icle|icl|ic|i|s)?\\.?|al(?:inéa|inea|in|i)?\\.?", { flags: "i
1591
355
  title: "Code de procédure pénale",
1592
356
  type: "texte"
1593
357
  })
1594
- }), x("c(?:ode|\\.)? ?pr(?:oc(?:[eé]dure)?)? ?civ(?:il)?|cpc", {
358
+ }), v("c(?:ode|\\.)? ?pr(?:oc(?:[eé]dure)?)? ?civ(?:il)?|cpc", {
1595
359
  flags: "i",
1596
360
  value: (e, t) => ({
1597
361
  cid: "LEGITEXT000006070716",
@@ -1600,7 +364,7 @@ var Pr = x("art(?:icle|icl|ic|i|s)?\\.?|al(?:inéa|inea|in|i)?\\.?", { flags: "i
1600
364
  title: "Code de procédure civile",
1601
365
  type: "texte"
1602
366
  })
1603
- }), x("c(?:ode|\\.)? ?s[eé]cur(?:it[eé])? ?soc(?:iale)?|css", {
367
+ }), v("c(?:ode|\\.)? ?s[eé]cur(?:it[eé])? ?soc(?:iale)?|css", {
1604
368
  flags: "i",
1605
369
  value: (e, t) => ({
1606
370
  cid: "LEGITEXT000006073189",
@@ -1609,7 +373,7 @@ var Pr = x("art(?:icle|icl|ic|i|s)?\\.?|al(?:inéa|inea|in|i)?\\.?", { flags: "i
1609
373
  title: "Code de la sécurité sociale",
1610
374
  type: "texte"
1611
375
  })
1612
- }), x("c(?:ode|\\.)? ?rur(?:al)?(?: et de la p[êe]che maritime)?", {
376
+ }), v("c(?:ode|\\.)? ?rur(?:al)?(?: et de la p[êe]che maritime)?", {
1613
377
  flags: "i",
1614
378
  value: (e, t) => ({
1615
379
  cid: "LEGITEXT000006071367",
@@ -1618,7 +382,7 @@ var Pr = x("art(?:icle|icl|ic|i|s)?\\.?|al(?:inéa|inea|in|i)?\\.?", { flags: "i
1618
382
  title: "Code rural et de la pêche maritime",
1619
383
  type: "texte"
1620
384
  })
1621
- }), x("c(?:ode|\\.)? ?env(?:ironnement)?", {
385
+ }), v("c(?:ode|\\.)? ?env(?:ironnement)?", {
1622
386
  flags: "i",
1623
387
  value: (e, t) => ({
1624
388
  cid: "LEGITEXT000006074220",
@@ -1627,7 +391,7 @@ var Pr = x("art(?:icle|icl|ic|i|s)?\\.?|al(?:inéa|inea|in|i)?\\.?", { flags: "i
1627
391
  title: "Code de l'environnement",
1628
392
  type: "texte"
1629
393
  })
1630
- }), x("c(?:ode|\\.)? ?urb(?:anisme)?", {
394
+ }), v("c(?:ode|\\.)? ?urb(?:anisme)?", {
1631
395
  flags: "i",
1632
396
  value: (e, t) => ({
1633
397
  cid: "LEGITEXT000006074075",
@@ -1636,7 +400,7 @@ var Pr = x("art(?:icle|icl|ic|i|s)?\\.?|al(?:inéa|inea|in|i)?\\.?", { flags: "i
1636
400
  title: "Code de l'urbanisme",
1637
401
  type: "texte"
1638
402
  })
1639
- }), x("c(?:ode|\\.)? ?jus(?:tice)? ?adm(?:in(?:istrative)?)?|cja", {
403
+ }), v("c(?:ode|\\.)? ?jus(?:tice)? ?adm(?:in(?:istrative)?)?|cja", {
1640
404
  flags: "i",
1641
405
  value: (e, t) => ({
1642
406
  cid: "LEGITEXT000006070933",
@@ -1645,7 +409,7 @@ var Pr = x("art(?:icle|icl|ic|i|s)?\\.?|al(?:inéa|inea|in|i)?\\.?", { flags: "i
1645
409
  title: "Code de justice administrative",
1646
410
  type: "texte"
1647
411
  })
1648
- }), x("cgi", {
412
+ }), v("cgi", {
1649
413
  flags: "i",
1650
414
  value: (e, t) => ({
1651
415
  cid: "LEGITEXT000006069577",
@@ -1654,7 +418,7 @@ var Pr = x("art(?:icle|icl|ic|i|s)?\\.?|al(?:inéa|inea|in|i)?\\.?", { flags: "i
1654
418
  title: "Code général des impôts",
1655
419
  type: "texte"
1656
420
  })
1657
- }), x("c(?:ode|\\.)? ?com(?:merce)?", {
421
+ }), v("c(?:ode|\\.)? ?com(?:merce)?", {
1658
422
  flags: "i",
1659
423
  value: (e, t) => ({
1660
424
  cid: "LEGITEXT000005634379",
@@ -1663,30 +427,30 @@ var Pr = x("art(?:icle|icl|ic|i|s)?\\.?|al(?:inéa|inea|in|i)?\\.?", { flags: "i
1663
427
  title: "Code de commerce",
1664
428
  type: "texte"
1665
429
  })
1666
- })), Q = C(Fr, rn(ue, { value: (e, t) => e === void 0 ? void 0 : {
430
+ })), Z = f(X, j(a, { value: (e, t) => e === void 0 ? void 0 : {
1667
431
  ...e,
1668
432
  position: t.position()
1669
- } }), rn(ne, { value: (e, t) => ({
433
+ } }), j(F, { value: (e, t) => ({
1670
434
  ...e,
1671
435
  position: t.position()
1672
- }) })), $ = Ye(x(" (?:du |de la |de l'|des |de |d')?", { flags: "i" }), { default: "" }), Ir = x(".+?(?=\\s*(?:du |de la |de l'|des |de |d')?\\s*(?:art(?:icle|icl|ic|i|s)?\\.?|al(?:inéa|inea|in|i)?\\.?))", {
436
+ }) })), Q = r(v(" (?:du |de la |de l'|des |de |d')?", { flags: "i" }), { default: "" }), yn = v(".+?(?=\\s*(?:du |de la |de l'|des |de |d')?\\s*(?:art(?:icle|icl|ic|i|s)?\\.?|al(?:inéa|inea|in|i)?\\.?))", {
1673
437
  flags: "i",
1674
438
  value: (e, t) => ({
1675
439
  type: "texte",
1676
440
  title: e[0].trim(),
1677
441
  position: t.position()
1678
442
  })
1679
- }), Lr = x(".+", {
443
+ }), $ = v(".+", {
1680
444
  flags: "i",
1681
445
  value: (e, t) => ({
1682
446
  type: "texte",
1683
447
  title: e[0].trim(),
1684
448
  position: t.position()
1685
449
  })
1686
- }), Rr = C(O([
450
+ }), bn = f(y([
451
+ Z,
1687
452
  Q,
1688
- $,
1689
- Z
453
+ Y
1690
454
  ], { value: (e, t) => {
1691
455
  let n = e[0];
1692
456
  return {
@@ -1695,19 +459,19 @@ var Pr = x("art(?:icle|icl|ic|i|s)?\\.?|al(?:inéa|inea|in|i)?\\.?", { flags: "i
1695
459
  position: t.position(),
1696
460
  type: "parent-enfant"
1697
461
  };
1698
- } }), O([
1699
- Z,
1700
- $,
1701
- Q
462
+ } }), y([
463
+ Y,
464
+ Q,
465
+ Z
1702
466
  ], { value: (e, t) => ({
1703
467
  child: e[0],
1704
468
  parent: e[2],
1705
469
  position: t.position(),
1706
470
  type: "parent-enfant"
1707
- }) }), O([
1708
- Ir,
1709
- $,
1710
- Z
471
+ }) }), y([
472
+ yn,
473
+ Q,
474
+ Y
1711
475
  ], { value: (e, t) => {
1712
476
  let n = e[0];
1713
477
  return {
@@ -1716,33 +480,15 @@ var Pr = x("art(?:icle|icl|ic|i|s)?\\.?|al(?:inéa|inea|in|i)?\\.?", { flags: "i
1716
480
  position: t.position(),
1717
481
  type: "parent-enfant"
1718
482
  };
1719
- } }), O([
1720
- Z,
1721
- $,
1722
- Lr
483
+ } }), y([
484
+ Y,
485
+ Q,
486
+ $
1723
487
  ], { value: (e, t) => ({
1724
488
  child: e[0],
1725
489
  parent: e[2],
1726
490
  position: t.position(),
1727
491
  type: "parent-enfant"
1728
- }) }), Z, Q, Lr), zr = (e) => e?.replace(/\n/g, " ").replace(/ {2,}/g, " ").replace(/ \(\d+\)\.?$/, "").replace(/\.$/, ""), Br = (e) => {
1729
- let t = e.META.META_SPEC.META_TEXTE_VERSION.DATE_DEBUT;
1730
- return t === void 0 || ["2222-02-22", "2999-01-01"].includes(t) ? e.META.META_SPEC.META_TEXTE_CHRONICLE.DATE_PUBLI : t;
1731
- }, Vr = (e) => {
1732
- let t = e.META.META_SPEC.META_TEXTE_CHRONICLE.DATE_TEXTE;
1733
- if (!["2222-02-22", "2999-01-01"].includes(t)) return t;
1734
- let n = e.META.META_SPEC.META_TEXTE_VERSION.DATE_DEBUT;
1735
- if (n !== void 0 && !["2222-02-22", "2999-01-01"].includes(n)) return n;
1736
- throw Error(`Missing date signature in text ${e.META.META_COMMUN.ID}`);
1737
- }, Hr = (e) => (t, n) => {
1738
- let r = e(t), i = e(n);
1739
- if (r !== i) return r.localeCompare(i);
1740
- let a = t.META.META_COMMUN, o = a.ORIGINE, s = n.META.META_COMMUN, c = s.ORIGINE;
1741
- if (o !== c) {
1742
- if (o === "JORF") return -1;
1743
- if (c === "JORF") return 1;
1744
- }
1745
- throw Error(`TODO: Unable to sort texts ${a.ID} & ${s.ID} by date.`);
1746
- }, Ur = Ar;
492
+ }) }), Y, Z, $), xn = q;
1747
493
  //#endregion
1748
- export { w as TextParserContext, ce as action, sn as actionTargets, b as addChildLeftToLastChild, Ht as addLinksOrReferencesToHtmlPage, Tt as addLinksToHtml, Ar as addLinksToMarkdown, Ur as addLinksToText, Ge as addPositionsToTableOfContentsItems, Lt as adjectifNumeralOrdinalCourt, je as adjectifTemporelSingulier, pt as adverbeMultiplicatifLatin, tn as adverbeRelatif, C as alternatives, Vt as article, $e as articles, _ as assertNever, ft as auPortion, lt as auxPortions, On as buildArticlePortionTreeFromHtml, O as chain, ke as chainTransformers, ze as citation, Le as citationLigne, Ve as citationSimple, zr as cleanTexteTitle, o as compoundReferencesSeparators, rn as convert, Gt as convertHtmlElementsToText, Se as createEnumerationOrBoundedInterval, te as createParentChildTreeFromReferences, rt as date, et as decodeNamedHtmlEntities, at as decodeNumericHtmlEntities, xt as definitionArticleDansCitation, qt as definitionArticleDansProjetOuPropositionLoi, Wt as definitionDivision, fe as definitionTexteFrancais, nt as designationArticle, Dt as designationDivision, h as ditPluriel, f as ditSingulier, Rt as division, S as divisionTypes, mt as divisions, Ut as duDate, tt as espace, Oe as espaceAdverbeRelatif, ae as europeanLawNatures, m as extendLoadedArticle, Or as extractActionDirectivesFromHtml, Tr as extractActionDirectivesFromText, it as extractBillDefinitions, Je as extractCitationReferences, kn as extractPortionSelectors, $t as extractReferences, De as extractReferencesWithOriginalTransformations, Ze as extractTextLinks, vn as formatLongDate, Ne as frenchLawNatures, dn as getArticleDateDebut, j as getArticleDateSignature, s as getExtractedReferences, Xt as getExtractedReferencesWithOriginalTransformations, Ot as getExtractedTableOfContentsFromTextBill, d as getOrLoadArticle, fn as getOrLoadArticleSiblingId, jr as getOrLoadDocument, Mr as getOrLoadDocumentsByDossierParlementaireUid, Nr as getOrLoadDossierParlementaire, ve as getOrLoadJo, D as getOrLoadSectionTa, r as getOrLoadSectionsTa, ht as getOrLoadTexteVersion, me as getOrLoadTextelr, ge as getOrLoadTextesVersions, xe as getOrLoadTexteslr, Br as getTexteVersionDateDebut, Vr as getTexteVersionDateSignature, Te as identificationTexteEuropeen, Ie as internationalLawNatures, ye as introPluriel, vt as introSingulier, re as isTextAstAtomicReference, de as isTextAstDivision, Ft as isTextAstPortion, se as iterAtomicFirstParentReferences, v as iterAtomicReferences, Ee as iterIncludedReferences, yt as iterReferenceLinks, kr as jsonReplacer, le as lawNatures, ot as lettreAscii, i as liaisonPluriel, gt as liaisonSingulier, It as linkTypes, st as listeArticles, pe as listeReferencesSeules, ee as loadArticles, Be as localizationAdverbs, qe as natureDivisionSingulier, on as natureTexteFrancais, He as newAssembleeObjectCache, we as newLegifranceObjectCache, t as newObjectCache, p as newReverseTransformationsMergedFromPositionsIterator, Nt as nomArticle, wt as nomSpecialArticle, kt as nombreAsTextAstNumber, Bt as nombreCardinal, Qe as nombreRomainCardinal, bt as nombreRomainOrdinal, Kt as nombreRomainOu0iAsTextAstNumber, Mt as nonLettre, Ct as numero, At as numeroDivision, a as numeroEtOuDateTexteFrancais, We as numeroPortion, Pe as numeroTexteEuropeen, ie as numeroTexteFrancais, Ye as optional, Me as optionalEspaceDuTerritoire, en as parseText, Re as portionTypes, an as portions, he as reference, be as referenceSeule, x as regExp, l as relatifPlurielPrepose, Qt as relatifSingulierPrepose, c as repeat, jt as replaceHtmlPatterns, St as replacePattern, ut as replaceTextPatterns, Mn as resolvePortionSelector, u as reversePositionsSplitFromPositions, _e as reverseTransformationFromPosition, _t as reverseTransformationsMergedFromPositions, n as reverseTransformedInnerFragment, E as reverseTransformedReplacement, Z as searchArticle, Pr as searchArticleKeyword, Rr as searchQueryReference, Q as searchTexte, Fr as searchTexteAbbreviations, ct as simplifyHtml, Ue as simplifyPlainText, Jt as simplifyText, nn as simplifyUnicodeCharacters, gn as sortArticlesByDate, Hr as sortTextesVersionsByDate, Fe as texte, ne as texteEuropeen, ue as texteFrancais, Pt as texteInternational, Xe as unePortion, g as uniteBasePreciseeSingulier, oe as uniteBaseSingulier, T as urlFromLegalId, Zt as variable, dt as virguleOuEspace, zt as walkTableOfContents, Ae as wordsTree };
494
+ export { h as TextParserContext, se as action, rn as actionDirective, qe as actionTargets, oe as addChildLeftToLastChild, Ze as addLinksOrReferencesToHtmlPage, jt as addLinksToHtml, q as addLinksToMarkdown, xn as addLinksToText, Ct as addPositionsToTableOfContentsItems, Dt as adjectifNumeralOrdinalCourt, C as adjectifTemporelSingulier, pt as adverbeMultiplicatifLatin, Ee as adverbeRelatif, f as alternatives, nn as article, ke as articles, g as assertNever, St as auPortion, i as auxPortions, he as buildArticlePortionTreeFromHtml, y as chain, Nt as chainTransformers, Ne as citation, ze as citationLigne, ie as citationSimple, Ut as cleanTexteTitle, Oe as compoundReferencesSeparators, j as convert, He as convertHtmlElementsToText, ge as createEnumerationOrBoundedInterval, Lt as createParentChildTreeFromReferences, k as date, Ke as decodeNamedHtmlEntities, De as decodeNumericHtmlEntities, u as definitionArticleDansCitation, en as definitionArticleDansProjetOuPropositionLoi, mt as definitionDivision, n as definitionTexteFrancais, Me as designationArticle, dt as designationDivision, sn as ditPluriel, s as ditSingulier, Xe as division, t as divisionTypes, Zt as divisions, Ft as duDate, P as espace, re as espaceAdverbeRelatif, st as europeanLawNatures, de as extendLoadedArticle, Et as extractActionDirectiveAstsFromText, ft as extractActionDirectivesFromHtml, lt as extractActionDirectivesFromText, Ot as extractBillDefinitions, et as extractCitationReferences, It as extractPortionSelectors, tn as extractReferences, w as extractReferencesWithOriginalTransformations, O as extractTextLinks, mn as formatLongDate, Wt as frenchLawNatures, un as getArticleDateDebut, B as getArticleDateSignature, c as getExtractedReferences, Qt as getExtractedReferencesWithOriginalTransformations, Kt as getExtractedTableOfContentsFromTextBill, _ as getOrLoadArticle, dn as getOrLoadArticleSiblingId, gn as getOrLoadDocument, _n as getOrLoadDocumentsByDossierParlementaireUid, vn as getOrLoadDossierParlementaire, S as getOrLoadJo, I as getOrLoadSectionTa, o as getOrLoadSectionsTa, Le as getOrLoadTexteVersion, ce as getOrLoadTextelr, Pe as getOrLoadTextesVersions, Be as getOrLoadTexteslr, kt as getTexteVersionDateDebut, Rt as getTexteVersionDateSignature, vt as identificationTexteEuropeen, M as internationalLawNatures, Re as introPluriel, le as introSingulier, pe as isArticlePortionStructuralStart, zt as isTextAstAtomicReference, gt as isTextAstDivision, Qe as isTextAstPortion, me as iterAtomicFirstParentReferences, Ge as iterAtomicReferences, Ue as iterIncludedReferences, Pt as iterReferenceLinks, hn as jsonReplacer, Mt as lawNatures, T as lettreAscii, Fe as liaisonPluriel, Ve as liaisonSingulier, Bt as linkTypes, ee as listeArticles, Ae as listeReferencesSeules, ae as loadArticles, Vt as localizationAdverbs, on as natureDivisionSingulier, ve as natureTexteFrancais, wt as newAssembleeObjectCache, qt as newLegifranceObjectCache, ot as newObjectCache, Ht as newReverseTransformationsMergedFromPositionsIterator, p as nomArticle, b as nomSpecialArticle, ut as nombreAsTextAstNumber, Ye as nombreCardinal, Xt as nombreRomainCardinal, an as nombreRomainOrdinal, tt as nombreRomainOu0iAsTextAstNumber, l as nonLettre, $t as numero, nt as numeroDivision, be as numeroEtOuDateTexteFrancais, bt as numeroPortion, we as numeroTexteEuropeen, te as numeroTexteFrancais, r as optional, ue as optionalEspaceDuTerritoire, yt as parseText, rt as portionTypes, ye as portions, m as reference, d as referenceSeule, v as regExp, fe as relatifPlurielPrepose, _e as relatifSingulierPrepose, xe as repeat, e as replaceHtmlPatterns, ct as replacePattern, Gt as replaceTextPatterns, Je as resolveActionDirectivesFromHtml, Yt as resolveActionDirectivesFromText, We as resolvePortionSelector, it as reversePositionsSplitFromPositions, Tt as reverseTransformationFromPosition, Jt as reverseTransformationsMergedFromPositions, D as reverseTransformedInnerFragment, A as reverseTransformedReplacement, Y as searchArticle, J as searchArticleKeyword, bn as searchQueryReference, Z as searchTexte, X as searchTexteAbbreviations, At as simplifyHtml, N as simplifyPlainText, _t as simplifyText, $e as simplifyUnicodeCharacters, fn as sortArticlesByDate, ht as sortTextesVersionsByDate, x as texte, F as texteEuropeen, a as texteFrancais, Ie as texteInternational, Se as unePortion, Ce as uniteBasePreciseeSingulier, xt as uniteBaseSingulier, E as urlFromLegalId, Te as variable, je as virguleOuEspace, at as walkTableOfContents, ne as wordsTree };