@tricoteuses/tisseuse 0.22.1 → 0.22.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -2
- package/dist/{html-BTaoaqX5.js → html-ClFZh0_V.js} +3991 -4556
- package/dist/index.js +53 -52
- package/dist/lib/extractors/links.d.ts +39 -5
- package/dist/lib/index.d.ts +3 -2
- package/dist/lib/legi/canutes_resolver.d.ts +24 -3
- package/dist/lib/legi/europe_attestation.d.ts +20 -0
- package/dist/lib/legi/europe_attestation.fixture.d.ts +8 -0
- package/dist/lib/legi/europe_attestation.test.d.ts +1 -0
- package/dist/lib/legi/europe_designation.d.ts +76 -0
- package/dist/lib/legi/europe_designation.test.d.ts +1 -0
- package/dist/lib/legi/europe_designation_cellar.test.d.ts +1 -0
- package/dist/lib/legi/europe_observation.d.ts +23 -0
- package/dist/lib/legi/europe_observation.test.d.ts +1 -0
- package/dist/lib/legi/resolver.d.ts +95 -0
- package/dist/lib/linkers/bascule_render_decisions.test.d.ts +1 -0
- package/dist/lib/linkers/html_european.test.d.ts +1 -0
- package/dist/lib/linkers/link_decision_metadata.d.ts +5 -0
- package/dist/lib/links.d.ts +29 -0
- package/dist/lib/text_parsers/ast.d.ts +6 -0
- package/dist/link-decision-metadata.js +8 -2
- package/dist/{resolver-GT7457lQ.js → resolver-C8c79uNU.js} +1341 -406
- package/dist/scripts/assemblee_install.integration.test.d.ts +1 -0
- package/dist/scripts/fixtures/assemblee-collation.d.ts +1 -0
- package/dist/scripts/fixtures/assemblee-empty-snapshot.d.ts +1 -0
- package/dist/scripts/installation-sandbox-locks.test.d.ts +1 -0
- package/dist/scripts/shared/assemblee_document_content.d.ts +46 -0
- package/dist/scripts/shared/assemblee_document_content.test.d.ts +1 -0
- package/dist/scripts/shared/assemblee_enqueue.d.ts +6 -0
- package/dist/scripts/sync_assemblee_queue.integration.test.d.ts +1 -0
- package/dist/server-f-legi.js +83 -83
- package/dist/server.js +445 -445
- package/package.json +18 -14
package/dist/server.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as e,
|
|
2
|
-
import {
|
|
1
|
+
import { A as e, C as t, D as n, E as r, I as i, K as a, M as o, O as s, Q as c, S as l, T as u, U as d, W as f, _ as p, b as m, d as h, f as g, ft as _, h as v, i as y, j as b, m as ee, n as x, nt as S, o as te, ot as ne, p as re, r as ie, rt as ae, t as oe, tt as se, u as ce, ut as le, x as ue, y as de } from "./html-ClFZh0_V.js";
|
|
2
|
+
import { $t as C, C as fe, Dn as pe, Fn as w, In as T, Ln as E, Q as me, Tt as he, Un as D, Vn as O, Z as ge, at as _e, bn as ve, bt as k, en as ye, h as be, kn as A, m as xe, mt as Se, nt as Ce, ot as we, pn as Te, t as Ee, vt as De, xt as Oe, yt as ke } from "./resolver-C8c79uNU.js";
|
|
3
3
|
import * as Ae from "node:crypto";
|
|
4
4
|
import { createHash as j } from "node:crypto";
|
|
5
5
|
import M from "fs-extra";
|
|
@@ -17,7 +17,7 @@ function Ne(e) {
|
|
|
17
17
|
return e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim();
|
|
18
18
|
}
|
|
19
19
|
function Pe(e) {
|
|
20
|
-
return Ne(
|
|
20
|
+
return Ne(_(e).text());
|
|
21
21
|
}
|
|
22
22
|
function Fe(e) {
|
|
23
23
|
let t = Ne([
|
|
@@ -64,7 +64,7 @@ function N(e) {
|
|
|
64
64
|
case "reference_et_action": return N(e.reference);
|
|
65
65
|
case "enumeration": return [...N(e.left), ...N(e.right)];
|
|
66
66
|
case "parent-enfant": {
|
|
67
|
-
let t = [...
|
|
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
|
|
@@ -89,12 +89,12 @@ function N(e) {
|
|
|
89
89
|
}
|
|
90
90
|
//#endregion
|
|
91
91
|
//#region src/lib/extractors/article_action_effects.ts
|
|
92
|
-
function Le(e,
|
|
93
|
-
if (
|
|
94
|
-
let
|
|
95
|
-
if (
|
|
96
|
-
let a =
|
|
97
|
-
return
|
|
92
|
+
function Le(e, t) {
|
|
93
|
+
if (t < 2) return null;
|
|
94
|
+
let n = me(e), r = v(e);
|
|
95
|
+
if (r.length !== t) return null;
|
|
96
|
+
let a = i(new w(n.output)), o = (e) => we(n, [e])[0].position;
|
|
97
|
+
return r.map((t, n) => ({
|
|
98
98
|
sourceText: e,
|
|
99
99
|
referencePosition: o({
|
|
100
100
|
start: (n === 0 ? a.find((e) => e.position.start <= t.reference.position.start && e.position.stop >= t.reference.position.stop) : void 0)?.position.start ?? t.reference.position.start,
|
|
@@ -103,105 +103,105 @@ function Le(e, n) {
|
|
|
103
103
|
actionPosition: o(t.position)
|
|
104
104
|
}));
|
|
105
105
|
}
|
|
106
|
-
function Re(e,
|
|
107
|
-
if (
|
|
108
|
-
let
|
|
109
|
-
if (
|
|
110
|
-
let
|
|
111
|
-
if (
|
|
112
|
-
let n =
|
|
113
|
-
return n.article.num !== e.article.num || n.article.position.start !== e.article.position.start || n.article.position.stop !== e.article.position.stop || !
|
|
114
|
-
}) ? null :
|
|
115
|
-
targetId:
|
|
106
|
+
function Re(e, t, n) {
|
|
107
|
+
if (t.length < 2) return null;
|
|
108
|
+
let r = me(e), a = r.output, o = (e) => we(r, [e])[0].position, s = i(new w(a)), c = s.flatMap(N);
|
|
109
|
+
if (c.length !== t.length || c.length < 2) return null;
|
|
110
|
+
let l = m(a);
|
|
111
|
+
if (l.length > 0) return n?.kind !== "replace_portion" || l.length !== c.length || l.some((e, t) => {
|
|
112
|
+
let n = c[t];
|
|
113
|
+
return n.article.num !== e.article.num || n.article.position.start !== e.article.position.start || n.article.position.stop !== e.article.position.stop || !ne(n.reference).some((t) => t.kind === "single" && t.steps.some((t) => t.type === "alinéa" && t.index === e.alineaIndex));
|
|
114
|
+
}) ? null : c.map((r, i) => ({
|
|
115
|
+
targetId: t[i],
|
|
116
116
|
directive: {
|
|
117
|
-
...
|
|
118
|
-
reference:
|
|
119
|
-
portionSelectors:
|
|
117
|
+
...n,
|
|
118
|
+
reference: r.reference,
|
|
119
|
+
portionSelectors: ne(r.reference),
|
|
120
120
|
tableTarget: {
|
|
121
121
|
type: "table",
|
|
122
|
-
rowIndex:
|
|
123
|
-
rowEndIndex:
|
|
122
|
+
rowIndex: l[i].rowIndex,
|
|
123
|
+
rowEndIndex: l[i].rowEndIndex
|
|
124
124
|
}
|
|
125
125
|
},
|
|
126
126
|
sourceAnnotation: {
|
|
127
127
|
sourceText: e,
|
|
128
|
-
referencePosition:
|
|
128
|
+
referencePosition: o(r.reference.position),
|
|
129
129
|
actionPosition: {
|
|
130
130
|
start: 0,
|
|
131
131
|
stop: e.length
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
}));
|
|
135
|
-
let
|
|
136
|
-
if (
|
|
137
|
-
let
|
|
138
|
-
if (
|
|
139
|
-
let
|
|
140
|
-
return !
|
|
141
|
-
targetId:
|
|
135
|
+
let u = c.filter(({ reference: e }) => e.type === "parent-enfant" && e.parent.type === "texte" && e.parent.nature !== "CODE");
|
|
136
|
+
if (u.length > 0 && u.length < c.length) {
|
|
137
|
+
let n = c.filter((e) => !u.includes(e));
|
|
138
|
+
if (n.length !== 1) return null;
|
|
139
|
+
let r = n[0], i = t[c.indexOf(r)], s = de(a);
|
|
140
|
+
return !i || s.length !== 1 || s[0].kind === "compound" ? null : [{
|
|
141
|
+
targetId: i,
|
|
142
142
|
sourceAnnotation: {
|
|
143
143
|
sourceText: e,
|
|
144
|
-
referencePosition:
|
|
144
|
+
referencePosition: o(r.reference.position),
|
|
145
145
|
actionPosition: {
|
|
146
146
|
start: 0,
|
|
147
147
|
stop: e.length
|
|
148
148
|
}
|
|
149
149
|
},
|
|
150
150
|
directive: {
|
|
151
|
-
...
|
|
152
|
-
reference:
|
|
151
|
+
...s[0],
|
|
152
|
+
reference: r.reference,
|
|
153
153
|
sourcePosition: {
|
|
154
154
|
start: 0,
|
|
155
|
-
stop:
|
|
155
|
+
stop: a.length
|
|
156
156
|
},
|
|
157
|
-
sourceText:
|
|
157
|
+
sourceText: a
|
|
158
158
|
}
|
|
159
159
|
}];
|
|
160
160
|
}
|
|
161
|
-
let
|
|
162
|
-
for (let e = 1; e <
|
|
163
|
-
let t =
|
|
164
|
-
t.type !== "reference_et_action" || N(t).length === 0 ||
|
|
161
|
+
let d = [], f = 0;
|
|
162
|
+
for (let e = 1; e < s.length; e += 1) {
|
|
163
|
+
let t = s[e];
|
|
164
|
+
t.type !== "reference_et_action" || N(t).length === 0 || s.slice(f, e).flatMap(N).length === 0 || de(a.slice(f === 0 ? 0 : s[f].position.start, t.position.start)).length === 1 && de(a.slice(t.position.start)).length === 1 && (d.push(e - 1), f = e);
|
|
165
165
|
}
|
|
166
|
-
|
|
167
|
-
let
|
|
168
|
-
for (let
|
|
169
|
-
let
|
|
170
|
-
if (
|
|
171
|
-
h =
|
|
166
|
+
d.push(s.length - 1);
|
|
167
|
+
let p = [], h = 0, g = 0;
|
|
168
|
+
for (let n of d) {
|
|
169
|
+
let r = s.slice(h, n + 1).flatMap(N);
|
|
170
|
+
if (r.length === 0) {
|
|
171
|
+
h = n + 1;
|
|
172
172
|
continue;
|
|
173
173
|
}
|
|
174
|
-
let
|
|
175
|
-
if (
|
|
176
|
-
let
|
|
177
|
-
for (let
|
|
178
|
-
let
|
|
179
|
-
if (!
|
|
180
|
-
|
|
181
|
-
targetId:
|
|
174
|
+
let i = h === 0 ? 0 : s[h].position.start, c = s[n + 1]?.position.start ?? a.length, l = de(a.slice(i, c));
|
|
175
|
+
if (l.length !== 1 || l[0].kind === "compound") return null;
|
|
176
|
+
let u = l[0];
|
|
177
|
+
for (let n of r) {
|
|
178
|
+
let r = t[g++];
|
|
179
|
+
if (!r) return null;
|
|
180
|
+
p.push({
|
|
181
|
+
targetId: r,
|
|
182
182
|
sourceAnnotation: {
|
|
183
183
|
sourceText: e,
|
|
184
|
-
referencePosition:
|
|
185
|
-
actionPosition:
|
|
186
|
-
start:
|
|
187
|
-
stop:
|
|
184
|
+
referencePosition: o(n.reference.position),
|
|
185
|
+
actionPosition: o({
|
|
186
|
+
start: i,
|
|
187
|
+
stop: c
|
|
188
188
|
})
|
|
189
189
|
},
|
|
190
190
|
directive: {
|
|
191
|
-
...
|
|
192
|
-
sourceText:
|
|
191
|
+
...u,
|
|
192
|
+
sourceText: a,
|
|
193
193
|
sourcePosition: {
|
|
194
194
|
start: 0,
|
|
195
|
-
stop:
|
|
195
|
+
stop: a.length
|
|
196
196
|
},
|
|
197
|
-
reference:
|
|
198
|
-
portionSelectors:
|
|
197
|
+
reference: n.reference,
|
|
198
|
+
portionSelectors: ne(n.reference)
|
|
199
199
|
}
|
|
200
200
|
});
|
|
201
201
|
}
|
|
202
|
-
h =
|
|
202
|
+
h = n + 1;
|
|
203
203
|
}
|
|
204
|
-
return g ===
|
|
204
|
+
return g === t.length ? p : null;
|
|
205
205
|
}
|
|
206
206
|
//#endregion
|
|
207
207
|
//#region src/lib/server/parsed_bills.ts
|
|
@@ -213,7 +213,7 @@ function F(e) {
|
|
|
213
213
|
return P(e).toLowerCase().normalize("NFD").replace(/\p{Diacritic}/gu, "");
|
|
214
214
|
}
|
|
215
215
|
function Be(e) {
|
|
216
|
-
return
|
|
216
|
+
return De(P(e));
|
|
217
217
|
}
|
|
218
218
|
function I(e) {
|
|
219
219
|
return `_TocArt${Be(e).replace(/\s+/gu, "")}`;
|
|
@@ -247,10 +247,10 @@ function We(e) {
|
|
|
247
247
|
}
|
|
248
248
|
function Ge(e) {
|
|
249
249
|
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);
|
|
250
|
-
if (n?.[1] !== void 0) return
|
|
250
|
+
if (n?.[1] !== void 0) return ke(n[1]);
|
|
251
251
|
}
|
|
252
252
|
function Ke(e) {
|
|
253
|
-
let t = We(e), n =
|
|
253
|
+
let t = We(e), n = Se(t ?? "");
|
|
254
254
|
if (n.length > 0 && t !== void 0) return n.map((e, r) => {
|
|
255
255
|
let i = e.start, a = n[r + 1]?.start ?? t.length, o = t.slice(i, a).trim();
|
|
256
256
|
return {
|
|
@@ -290,7 +290,7 @@ function Xe(e) {
|
|
|
290
290
|
return P(e).replace(/[’']/gu, "'").replace(/[‐‑‒–—]/gu, "-");
|
|
291
291
|
}
|
|
292
292
|
function Ze(e, t) {
|
|
293
|
-
let n = new
|
|
293
|
+
let n = new w(e, t), r = Te(n);
|
|
294
294
|
return typeof r != "string" || n.offset <= t ? null : {
|
|
295
295
|
date: r,
|
|
296
296
|
start: t,
|
|
@@ -367,7 +367,7 @@ function it(e, t, n) {
|
|
|
367
367
|
return at(e(t).text(), r.length);
|
|
368
368
|
}
|
|
369
369
|
function at(e, t) {
|
|
370
|
-
return
|
|
370
|
+
return ae(e, { allowUnclosed: !0 }).some((e) => e.position.start < t && t < e.position.stop);
|
|
371
371
|
}
|
|
372
372
|
function ot(e, t, n) {
|
|
373
373
|
if (t === n) return "";
|
|
@@ -386,13 +386,13 @@ function st(e, t) {
|
|
|
386
386
|
}
|
|
387
387
|
function ct(e) {
|
|
388
388
|
let t = F(e);
|
|
389
|
-
return !t || ze.test(t) ? "noise" :
|
|
389
|
+
return !t || ze.test(t) ? "noise" : n.test(e) ? "directive_candidate" : "context";
|
|
390
390
|
}
|
|
391
391
|
function lt(e, t) {
|
|
392
392
|
return t.tagName === "p" && (/pastille/iu.test(e(t).attr("class") ?? "") || e(t).is("[data-pastille]")) && /^\(\d+\)$/u.test(P(e(t).text()));
|
|
393
393
|
}
|
|
394
394
|
function ut(e) {
|
|
395
|
-
let t =
|
|
395
|
+
let t = _(e, { xml: {
|
|
396
396
|
xmlMode: !1,
|
|
397
397
|
withStartIndices: !0,
|
|
398
398
|
withEndIndices: !0
|
|
@@ -408,7 +408,7 @@ function ut(e) {
|
|
|
408
408
|
async function dt(e, t, n, r, i) {
|
|
409
409
|
if (n === void 0) throw Error("A document date is required to add links to legal references.");
|
|
410
410
|
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.");
|
|
411
|
-
let a = t.legiResolver ?? new
|
|
411
|
+
let a = t.legiResolver ?? new ce(t.canutesDb), { output: o } = await x({
|
|
412
412
|
callerDate: t.callerDate,
|
|
413
413
|
date: n,
|
|
414
414
|
...i === void 0 || t.linkDecisionDocumentId === void 0 ? {} : { decisionObserver: {
|
|
@@ -469,30 +469,30 @@ function ht(e, t) {
|
|
|
469
469
|
else for (let t of e.children) a(t);
|
|
470
470
|
};
|
|
471
471
|
a(t);
|
|
472
|
-
let
|
|
473
|
-
return
|
|
474
|
-
...
|
|
475
|
-
title:
|
|
472
|
+
let o = k(P(n)), s = P(r);
|
|
473
|
+
return o && !o.title && s ? {
|
|
474
|
+
...o,
|
|
475
|
+
title: s
|
|
476
476
|
} : null;
|
|
477
477
|
}
|
|
478
478
|
function gt(e) {
|
|
479
479
|
let t = [], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
480
480
|
e("a[id], span[id], h1[id], h2[id], h3[id], h4[id], h5[id], h6[id]").each((i, a) => {
|
|
481
481
|
if (Ve(e, a)) return;
|
|
482
|
-
let
|
|
483
|
-
if (!
|
|
484
|
-
let
|
|
485
|
-
|
|
486
|
-
id:
|
|
487
|
-
...
|
|
482
|
+
let o = P(e(a).text()), s = e(a).attr("id");
|
|
483
|
+
if (!s || r.has(s)) return;
|
|
484
|
+
let c = ft(e, a), l = e(a).closest("h1,h2,h3,h4,h5,h6,p.assnat9ArticleNum").get(0), u = k(o) ?? (L(l) && (a === l || e(a).find("br").length === 1) ? ht(e, l) : null);
|
|
485
|
+
u && pt(e, t, n, r, {
|
|
486
|
+
id: s,
|
|
487
|
+
...u,
|
|
488
488
|
element: a,
|
|
489
|
-
container:
|
|
489
|
+
container: c
|
|
490
490
|
});
|
|
491
491
|
}), e("h1:not([id]), h2:not([id]), h3:not([id]), h4:not([id]), h5:not([id]), h6:not([id])").each((i, a) => {
|
|
492
492
|
if (n.has(a)) return;
|
|
493
|
-
let
|
|
494
|
-
|
|
495
|
-
...
|
|
493
|
+
let o = k(P(e(a).text())) ?? ht(e, a);
|
|
494
|
+
o && pt(e, t, n, r, {
|
|
495
|
+
...o,
|
|
496
496
|
element: a,
|
|
497
497
|
container: a
|
|
498
498
|
});
|
|
@@ -511,9 +511,9 @@ function vt(e) {
|
|
|
511
511
|
let t = [], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
512
512
|
return e("p.assnat9ArticleNum,h1,h2,h3,h4,h5,h6,p").each((i, a) => {
|
|
513
513
|
if (Ve(e, a) || !e(a).hasClass("assnat9ArticleNum") && !_t(e, a)) return;
|
|
514
|
-
let
|
|
515
|
-
|
|
516
|
-
...
|
|
514
|
+
let o = k(e(a).text()) ?? ht(e, a);
|
|
515
|
+
o && pt(e, t, n, r, {
|
|
516
|
+
...o,
|
|
517
517
|
element: a,
|
|
518
518
|
container: a
|
|
519
519
|
});
|
|
@@ -547,7 +547,7 @@ function bt(e, t) {
|
|
|
547
547
|
return 0;
|
|
548
548
|
}
|
|
549
549
|
function xt(e) {
|
|
550
|
-
let t = new
|
|
550
|
+
let t = new w(e), n = ve(t);
|
|
551
551
|
if (!(n === void 0 || t.offset !== e.length) && !(typeof n != "object" || !n || !("value" in n) || typeof n.value != "number")) return n.value - 1;
|
|
552
552
|
}
|
|
553
553
|
function St(e) {
|
|
@@ -621,15 +621,15 @@ function Et(e, t, n) {
|
|
|
621
621
|
if (!r.is("p.assnat9ArticleNum")) return;
|
|
622
622
|
let i = r.parent(), a = i.parent();
|
|
623
623
|
if (!i.is("div") || i.children().length !== 1 || !a.is("div")) return;
|
|
624
|
-
let
|
|
625
|
-
if (
|
|
626
|
-
let
|
|
627
|
-
if (
|
|
628
|
-
let
|
|
629
|
-
if (!(
|
|
624
|
+
let o = a.children().get();
|
|
625
|
+
if (o.length !== 3 && o.length !== 4 || o[0] !== i.get(0) || o[1]?.tagName !== "span" || P(e(o[1]).text()) !== "") return;
|
|
626
|
+
let s = o.length === 4 ? o[2] : void 0;
|
|
627
|
+
if (s !== void 0 && (s.tagName !== "p" || !e(s).hasClass("assnat9ArticleNum") || !/^\(non modifié\)$/iu.test(P(e(s).text())))) return;
|
|
628
|
+
let c = o.at(-1);
|
|
629
|
+
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) => k(e(t).text()) !== null))) return [
|
|
630
630
|
t.container,
|
|
631
|
-
...
|
|
632
|
-
|
|
631
|
+
...s === void 0 ? [] : [s],
|
|
632
|
+
c
|
|
633
633
|
];
|
|
634
634
|
}
|
|
635
635
|
function Dt(e, t, n, r = mt(e)) {
|
|
@@ -672,7 +672,7 @@ function kt(e, t, n, r) {
|
|
|
672
672
|
}
|
|
673
673
|
function At(e, t, n, r) {
|
|
674
674
|
if (n.startIndex === null || n.startIndex >= r) return "";
|
|
675
|
-
if (n.type === "text") return n.endIndex !== null && n.endIndex < r ? n.data :
|
|
675
|
+
if (n.type === "text") return n.endIndex !== null && n.endIndex < r ? n.data : _(t.slice(n.startIndex, r), {}, !1).text();
|
|
676
676
|
if (!L(n)) return "";
|
|
677
677
|
let i = "";
|
|
678
678
|
for (let a of e(n).contents().get()) {
|
|
@@ -683,7 +683,7 @@ function At(e, t, n, r) {
|
|
|
683
683
|
}
|
|
684
684
|
function jt(e, t, n, r) {
|
|
685
685
|
if (n === void 0 || n.length === 0) return;
|
|
686
|
-
let i =
|
|
686
|
+
let i = _(e, { xml: {
|
|
687
687
|
xmlMode: !1,
|
|
688
688
|
withStartIndices: !0,
|
|
689
689
|
withEndIndices: !0
|
|
@@ -756,7 +756,7 @@ function Mt(e, t) {
|
|
|
756
756
|
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}`;
|
|
757
757
|
}
|
|
758
758
|
function Nt(e) {
|
|
759
|
-
let t =
|
|
759
|
+
let t = _(e), n = Pt(t);
|
|
760
760
|
for (let e of wt(t, { warn: !1 })) {
|
|
761
761
|
let r = I(e.num ?? e.label.replace(/^Article\s+/iu, "")), i = t(e.element), a = i.attr("id");
|
|
762
762
|
if (a !== r) {
|
|
@@ -839,41 +839,41 @@ function Wt(e) {
|
|
|
839
839
|
let t = F(e.text.split("«", 1)[0]).replace(/[’]/gu, "'").replace(/[‐‑‒–—]/gu, "-"), n = /^(?:(?:\d+°|[ivxlcdm]+[.)]|[a-z][.)])\s*)?(?:est|sont)\s+(?:ainsi\s+)?(?:abroge|modifie|complete|supprime|remplace|retabli)\w*\b/u.test(t) ? t : t.split(/\b(?:est|sont|il|elle|ils|elles)\b/iu, 1)[0];
|
|
840
840
|
return /(?:\b(?:articles?|livres?|titres?|sous[- ]?titres?|chapitres?|sections?|sous[- ]?sections?|parties?|paragraphes?|sous[- ]?paragraphes?|annexes?|etats?)\s+(?:[lrda]\s*\.?\s*-?\s*\d|\d|[ivxlcdm]+(?:er|re)?(?=\s|$|[.,;:])|(?:premier|premiere|deuxieme|troisieme|quatrieme|cinquieme|sixieme|septieme|huitieme|neuvieme|dixieme)\b)|\b(?:premier|premiere|deuxieme|troisieme|quatrieme|cinquieme|sixieme|septieme|huitieme|neuvieme|dixieme)\s+(?:article|livre|titre|chapitre|section|sous[- ]?section|partie|paragraphe)\b|\b(?:annexes?|etats?)\s+[a-z](?:\s|$))/iu.test(n);
|
|
841
841
|
}
|
|
842
|
-
function Gt(e,
|
|
843
|
-
if (!
|
|
844
|
-
let
|
|
845
|
-
if (/[«»]/u.test(
|
|
846
|
-
let a = /\btels? qu['’]ils resultent du (\d+)°/u.exec(
|
|
847
|
-
if (!a ||
|
|
848
|
-
let o =
|
|
849
|
-
if (/^\s*(\d+)°/u.exec(F(
|
|
842
|
+
function Gt(e, t) {
|
|
843
|
+
if (!t || t.articleId !== e.articleId || !/\br[ée]sultent\s+du\s+\d+°/iu.test(e.text)) return;
|
|
844
|
+
let n = (e) => F(e).replace(/[’]/gu, "'").replace(/[‐‑‒–—]/gu, "-"), r = n(e.text).replace(/«[^»]*»/gu, "");
|
|
845
|
+
if (/[«»]/u.test(r)) return;
|
|
846
|
+
let a = /\btels? qu['’]ils resultent du (\d+)°/u.exec(r);
|
|
847
|
+
if (!a || i(new w(r)).some((e) => [...C(e)].some((e) => e.type === "texte" && e.relative === void 0))) return;
|
|
848
|
+
let o = n(t.text);
|
|
849
|
+
if (/^\s*(\d+)°/u.exec(F(t.text))?.[1] !== a[1]) return;
|
|
850
850
|
let s = /\bles articles (.+?) deviennent respectivement les articles ([^;]+);?\s*$/u.exec(o);
|
|
851
851
|
if (!s) return;
|
|
852
|
-
let c = (e) =>
|
|
852
|
+
let c = (e) => ke(e.trim().replace(/^[lrda](?=[.\s\d])/u, (e) => e.toUpperCase())), l = (e) => {
|
|
853
853
|
let t = e.trim().split(/,\s*|\s+et\s+/u);
|
|
854
854
|
if (t.length === 0 || t.length > 64) return;
|
|
855
855
|
let n = t.map(c);
|
|
856
856
|
if (n.some((e) => e === void 0)) return;
|
|
857
857
|
let r = n;
|
|
858
858
|
return new Set(r).size === r.length ? r : void 0;
|
|
859
|
-
},
|
|
860
|
-
if (!
|
|
861
|
-
let
|
|
862
|
-
for (let e = 0; e <
|
|
863
|
-
let
|
|
859
|
+
}, u = l(s[1]), d = l(s[2].replace(/;\s*$/u, ""));
|
|
860
|
+
if (!u || !d || u.length !== d.length) return;
|
|
861
|
+
let f = t.linkDecisions === void 0 ? void 0 : new Set(t.linkDecisions.flatMap((e) => e.kind === "article" && !e.occurrence.insideFrenchQuotes && e.projection.mode === "etablie" ? e.projection.targetIds : [])), p = /* @__PURE__ */ new Map();
|
|
862
|
+
for (let e = 0; e < u.length; e++) {
|
|
863
|
+
let r = t.links.filter((t) => t.type === "article" && !t.consultationOnly && !t.insideFrenchQuotes && (f === void 0 || f.has(t.id)) && c(n(t.text ?? "")) === u[e]), i = [...new Set(r.map((e) => e.id))];
|
|
864
864
|
if (i.length !== 1 || !i[0]) return;
|
|
865
|
-
|
|
865
|
+
p.set(d[e], i[0]);
|
|
866
866
|
}
|
|
867
|
-
let
|
|
868
|
-
for (let e of
|
|
867
|
+
let m = [];
|
|
868
|
+
for (let e of r.matchAll(/\baux articles (.+?)(?=,?\s+tels? qu|,\s*la reference|;|$)/gu)) {
|
|
869
869
|
let t = l(e[1]);
|
|
870
870
|
if (!t) return;
|
|
871
|
-
|
|
871
|
+
m.push(...t);
|
|
872
872
|
}
|
|
873
|
-
if (!(
|
|
873
|
+
if (!(m.length === 0 || m.some((e) => !p.has(e)))) return [...new Set(m.map((e) => p.get(e)))];
|
|
874
874
|
}
|
|
875
875
|
function Kt(e) {
|
|
876
|
-
let t =
|
|
876
|
+
let t = d(e.text);
|
|
877
877
|
if (t.length !== 1) return;
|
|
878
878
|
let n = e.links.filter((e) => e.type === "article" && !e.insideFrenchQuotes), r = n.filter((n) => {
|
|
879
879
|
let r = n.text ?? "", i = e.text.indexOf(r);
|
|
@@ -890,11 +890,11 @@ function Kt(e) {
|
|
|
890
890
|
function qt(e, t) {
|
|
891
891
|
let n = P(e);
|
|
892
892
|
if (!n) return;
|
|
893
|
-
let r =
|
|
893
|
+
let r = le(n);
|
|
894
894
|
return r ? r.level : n.endsWith(":") ? (t ?? -1) + 1 : void 0;
|
|
895
895
|
}
|
|
896
896
|
function Jt(e) {
|
|
897
|
-
let t = /* @__PURE__ */ new Map(), n = [], r =
|
|
897
|
+
let t = /* @__PURE__ */ new Map(), n = [], r = re(e.map((e) => e.text)), i = -1;
|
|
898
898
|
for (let [a, o] of e.entries()) {
|
|
899
899
|
let e = r.get(a);
|
|
900
900
|
if (e && (i = e.endIndex), a <= i) {
|
|
@@ -981,7 +981,7 @@ function en(e, t, n) {
|
|
|
981
981
|
for (let r of [...t.get(e.id) ?? [e]].reverse()) {
|
|
982
982
|
let e = n.get(r.id);
|
|
983
983
|
if (!n.has(r.id)) {
|
|
984
|
-
let t = r.links.filter((e) => e.type === "text" && !e.insideFrenchQuotes), i = t.length > 0 ?
|
|
984
|
+
let t = r.links.filter((e) => e.type === "text" && !e.insideFrenchQuotes), i = t.length > 0 ? f(r.text) : [], a = [], o = !1;
|
|
985
985
|
for (let e of t) {
|
|
986
986
|
let t = e.text, n = t ? r.text.indexOf(t) : -1;
|
|
987
987
|
if (n < 0 || r.text.indexOf(t, n + 1) !== -1) {
|
|
@@ -1017,52 +1017,52 @@ function tn(e) {
|
|
|
1017
1017
|
return a === void 0 ? void 0 : en(a, i.contextByBlockId, i.textIdsByBlockId);
|
|
1018
1018
|
};
|
|
1019
1019
|
}
|
|
1020
|
-
function nn(e, n, r,
|
|
1020
|
+
function nn(e, t, n, r, a) {
|
|
1021
1021
|
let o = /* @__PURE__ */ new Map(), s = new Set(e.blocks.flatMap((e) => {
|
|
1022
1022
|
if (!e.text.includes("Art.")) return [];
|
|
1023
1023
|
let t = en(e, a, o);
|
|
1024
|
-
return t === void 0 ? [] :
|
|
1024
|
+
return t === void 0 ? [] : Se(me(e.text).output).map(({ num: e }) => z(t, e));
|
|
1025
1025
|
}));
|
|
1026
1026
|
if (s.size === 0) return /* @__PURE__ */ new Map();
|
|
1027
|
-
let c = new Set([...s].map((e) => e.slice(e.indexOf("\0") + 1))), l =
|
|
1027
|
+
let c = new Set([...s].map((e) => e.slice(e.indexOf("\0") + 1))), l = t.flatMap((t) => {
|
|
1028
1028
|
if (Je(t.reference)) return [];
|
|
1029
|
-
let
|
|
1030
|
-
if (![...
|
|
1031
|
-
let s = zt(
|
|
1029
|
+
let i = new Set([...C(t.reference)].filter((e) => e.type === "article" && e.num).map((e) => e.num));
|
|
1030
|
+
if (![...i].some((e) => c.has(He(e)))) return [];
|
|
1031
|
+
let s = zt(n, Qt(e, r, t)) ?? Rt(e.blocks, t);
|
|
1032
1032
|
if (!s) return [];
|
|
1033
1033
|
let l = en(s, a, o);
|
|
1034
1034
|
return l === void 0 ? [] : [{
|
|
1035
1035
|
block: s,
|
|
1036
1036
|
directive: t,
|
|
1037
|
-
nums:
|
|
1037
|
+
nums: i,
|
|
1038
1038
|
textId: l
|
|
1039
1039
|
}];
|
|
1040
1040
|
});
|
|
1041
1041
|
if (l.length === 0) return /* @__PURE__ */ new Map();
|
|
1042
|
-
let
|
|
1043
|
-
if (![...
|
|
1044
|
-
let
|
|
1045
|
-
let
|
|
1046
|
-
if (
|
|
1047
|
-
let s = zt(
|
|
1042
|
+
let u = new Set(l.flatMap(({ nums: e, textId: t }) => [...e].map((e) => z(t, e))));
|
|
1043
|
+
if (![...u].some((e) => s.has(e))) return /* @__PURE__ */ new Map();
|
|
1044
|
+
let d = new Set(t.flatMap((t) => {
|
|
1045
|
+
let i = Ke(t);
|
|
1046
|
+
if (i.length === 0) return [];
|
|
1047
|
+
let s = zt(n, Qt(e, r, t)) ?? Rt(e.blocks, t);
|
|
1048
1048
|
if (!s) return [];
|
|
1049
1049
|
let c = en(s, a, o);
|
|
1050
|
-
return c === void 0 ? [] :
|
|
1051
|
-
})),
|
|
1052
|
-
for (let { block: e, directive:
|
|
1053
|
-
if (![...
|
|
1054
|
-
let a = new Set(
|
|
1055
|
-
o.length > 0 &&
|
|
1050
|
+
return c === void 0 ? [] : i.map(({ num: e }) => z(c, e)).filter((e) => u.has(e));
|
|
1051
|
+
})), f = /* @__PURE__ */ new Map();
|
|
1052
|
+
for (let { block: e, directive: t, nums: n, textId: r } of l) {
|
|
1053
|
+
if (![...n].some((e) => s.has(z(r, e)))) continue;
|
|
1054
|
+
let a = new Set(i(new w(me(t.sourceText).output)).flatMap((e) => [...C(e)].filter((e) => e.type === "article" && e.num).map((e) => e.num))), o = [...n].filter((e) => s.has(z(r, e)) && !d.has(z(r, e)) && [...a].some((t) => He(t) === He(e)));
|
|
1055
|
+
o.length > 0 && f.set(e.id, [...new Set([...f.get(e.id) ?? [], ...o])]);
|
|
1056
1056
|
}
|
|
1057
|
-
return
|
|
1057
|
+
return f;
|
|
1058
1058
|
}
|
|
1059
1059
|
function rn(e, t) {
|
|
1060
1060
|
let n = performance.now(), r = performance.now(), i = Zt(e), a = performance.now() - r, o = performance.now(), s = new Map(e.blocks.map((e) => [e.id, e])), c = Jt(e.blocks);
|
|
1061
1061
|
for (let t of e.blocks) t.qualifiedVersion = Kt(t);
|
|
1062
|
-
let l = performance.now() - o, u = performance.now(), d =
|
|
1063
|
-
if (
|
|
1062
|
+
let l = performance.now() - o, u = performance.now(), d = ee(), f = e.blocks[0], m = e.title !== void 0 && f?.text.startsWith(`${e.label}\n`) && (e.directiveText === f.text || e.directiveText.startsWith(`${f.text}\n`)), h = m && e.text.startsWith(`${e.label} ${e.title}`) ? " " : "", g = p(m ? `${e.label}${h}${e.title}${e.directiveText.slice(f.text.length)}` : e.directiveText, t === void 0 ? void 0 : d);
|
|
1063
|
+
if (m && !h) {
|
|
1064
1064
|
let t = e.label.length;
|
|
1065
|
-
|
|
1065
|
+
g = g.map((e) => ({
|
|
1066
1066
|
...e,
|
|
1067
1067
|
sourcePosition: {
|
|
1068
1068
|
start: e.sourcePosition.start > t ? e.sourcePosition.start + 1 : e.sourcePosition.start,
|
|
@@ -1070,14 +1070,14 @@ function rn(e, t) {
|
|
|
1070
1070
|
}
|
|
1071
1071
|
}));
|
|
1072
1072
|
}
|
|
1073
|
-
let
|
|
1073
|
+
let _ = performance.now() - u, v = performance.now(), y = nn(e, g, s, i, c), b = /* @__PURE__ */ new Map(), x = /* @__PURE__ */ new Map(), S = /* @__PURE__ */ new Map(), te = [], ne = [], re, ie;
|
|
1074
1074
|
for (let t of e.blocks) {
|
|
1075
|
-
let e = Ht(t), n = [...new Set(t.linkDecisions?.flatMap((e) => e.projection.mode === "indicative" && e.kind === "article" && !e.occurrence.insideFrenchQuotes ? e.projection.candidateIds : []) ?? [])], r = e.length === 0 && !Bt(t) && !Ut(t) && !Vt(t) ? Gt(t,
|
|
1076
|
-
(e.length > 0 || r !== void 0 || t.qualifiedVersion || Bt(t) || Ut(t) || Vt(t) ||
|
|
1075
|
+
let e = Ht(t), n = [...new Set(t.linkDecisions?.flatMap((e) => e.projection.mode === "indicative" && e.kind === "article" && !e.occurrence.insideFrenchQuotes ? e.projection.candidateIds : []) ?? [])], r = e.length === 0 && !Bt(t) && !Ut(t) && !Vt(t) ? Gt(t, ie) : void 0;
|
|
1076
|
+
(e.length > 0 || r !== void 0 || t.qualifiedVersion || Bt(t) || Ut(t) || Vt(t) || y.has(t.id) || Wt(t)) && (te = y.has(t.id) ? [] : r ?? e, re = t.qualifiedVersion, ne = y.has(t.id) ? [] : n), b.set(t.id, te), x.set(t.id, ne), S.set(t.id, re), ie = t;
|
|
1077
1077
|
}
|
|
1078
|
-
l += performance.now() -
|
|
1079
|
-
let
|
|
1080
|
-
let n = Qt(e, i, t), r = zt(s, n) ?? Rt(e.blocks, t), a = [...new Set((n?.blockIds ?? (r?.id === void 0 ? [] : [r.id])).flatMap((e) => s.get(e)?.linkDecisions ?? []))], o = Ht(r), l = r?.id === void 0 ||
|
|
1078
|
+
l += performance.now() - v;
|
|
1079
|
+
let ae = performance.now(), oe = g.map((t) => {
|
|
1080
|
+
let n = Qt(e, i, t), r = zt(s, n) ?? Rt(e.blocks, t), a = [...new Set((n?.blockIds ?? (r?.id === void 0 ? [] : [r.id])).flatMap((e) => s.get(e)?.linkDecisions ?? []))], o = Ht(r), l = r?.id === void 0 || y.has(r.id) ? [] : x.get(r.id) ?? [], u = r?.id !== void 0 && y.has(r.id) ? [] : o.length > 0 ? o : r?.id === void 0 ? [] : b.get(r.id) ?? [], d = $t(e, r, t), f = Xt(r?.id === void 0 ? void 0 : c.get(r.id), n, s);
|
|
1081
1081
|
return {
|
|
1082
1082
|
articleId: e.id,
|
|
1083
1083
|
blockId: r?.id,
|
|
@@ -1095,23 +1095,23 @@ function rn(e, t) {
|
|
|
1095
1095
|
directive: t,
|
|
1096
1096
|
...a.length === 0 ? {} : { linkDecisions: a },
|
|
1097
1097
|
...l.length > 0 ? { indicativeTargetIds: l } : {},
|
|
1098
|
-
...r?.id !== void 0 &&
|
|
1099
|
-
...u.length > 0 || r?.id !== void 0 &&
|
|
1100
|
-
...r?.id !== void 0 &&
|
|
1098
|
+
...r?.id !== void 0 && y.has(r.id) ? { internallyCreatedTargetNums: y.get(r.id) } : {},
|
|
1099
|
+
...u.length > 0 || r?.id !== void 0 && y.has(r.id) ? { targetIds: u } : {},
|
|
1100
|
+
...r?.id !== void 0 && S.get(r.id) ? { qualifiedVersion: S.get(r.id) } : {}
|
|
1101
1101
|
};
|
|
1102
|
-
}),
|
|
1102
|
+
}), se = /* @__PURE__ */ new Set(), ce = /* @__PURE__ */ new Map(), le = oe.flatMap((e) => {
|
|
1103
1103
|
let t = e.blockId ? s.get(e.blockId) : void 0;
|
|
1104
1104
|
if (!t || e.internallyCreatedTargetNums?.length) return [e];
|
|
1105
|
-
if (
|
|
1106
|
-
let n =
|
|
1107
|
-
if (n === void 0 && (n = Re(t.text, Ht(t), e.directive),
|
|
1105
|
+
if (se.has(t.id)) return [];
|
|
1106
|
+
let n = ce.get(t.id);
|
|
1107
|
+
if (n === void 0 && (n = Re(t.text, Ht(t), e.directive), ce.set(t.id, n)), !n) {
|
|
1108
1108
|
let n = e.directive, r = e.targetIds?.length === 1 && n.kind === "compound" ? Le(t.text, n.operations.length) : null;
|
|
1109
1109
|
return [r ? {
|
|
1110
1110
|
...e,
|
|
1111
1111
|
sourceAnnotations: r
|
|
1112
1112
|
} : e];
|
|
1113
1113
|
}
|
|
1114
|
-
return
|
|
1114
|
+
return se.add(t.id), [{
|
|
1115
1115
|
...e,
|
|
1116
1116
|
effects: n.map((t) => ({
|
|
1117
1117
|
...t,
|
|
@@ -1122,19 +1122,19 @@ function rn(e, t) {
|
|
|
1122
1122
|
}
|
|
1123
1123
|
}))
|
|
1124
1124
|
}];
|
|
1125
|
-
}),
|
|
1125
|
+
}), ue = performance.now() - ae;
|
|
1126
1126
|
return t?.push({
|
|
1127
1127
|
actionDirectiveExtraction: d,
|
|
1128
1128
|
articleId: e.id,
|
|
1129
1129
|
blockCount: e.blocks.length,
|
|
1130
1130
|
buildRangesMs: Math.round(a * 10) / 10,
|
|
1131
|
-
directiveCount:
|
|
1131
|
+
directiveCount: le.length,
|
|
1132
1132
|
directiveTextSize: e.directiveText.length,
|
|
1133
|
-
extractActionDirectivesMs: Math.round(
|
|
1134
|
-
mapDirectivesMs: Math.round(
|
|
1133
|
+
extractActionDirectivesMs: Math.round(_ * 10) / 10,
|
|
1134
|
+
mapDirectivesMs: Math.round(ue * 10) / 10,
|
|
1135
1135
|
prepareBlockIndexesMs: Math.round(l * 10) / 10,
|
|
1136
1136
|
totalMs: Math.round((performance.now() - n) * 10) / 10
|
|
1137
|
-
}),
|
|
1137
|
+
}), le;
|
|
1138
1138
|
}
|
|
1139
1139
|
function an(e, t) {
|
|
1140
1140
|
let n = /* @__PURE__ */ new Map(), r = [], i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map();
|
|
@@ -1314,7 +1314,7 @@ function mn(e, t) {
|
|
|
1314
1314
|
});
|
|
1315
1315
|
}
|
|
1316
1316
|
function hn(e, t) {
|
|
1317
|
-
let n = new Map(e.flatMap((e) => [...
|
|
1317
|
+
let n = new Map(e.flatMap((e) => [...re(e.blocks.map((e) => e.text))].map(([t, n]) => [e.blocks[t].id, {
|
|
1318
1318
|
articleId: e.id,
|
|
1319
1319
|
blockIds: e.blocks.slice(t - 1, n.endIndex + 1).map((e) => e.id),
|
|
1320
1320
|
...n
|
|
@@ -1359,12 +1359,12 @@ function gn(e, t) {
|
|
|
1359
1359
|
});
|
|
1360
1360
|
}
|
|
1361
1361
|
function _n(e, t, n, r, i, a, o = !0, s, c) {
|
|
1362
|
-
let l = new
|
|
1362
|
+
let l = new fe("parsedBill.buildParsedDocument"), u = i.reduce((e, t) => e + t.blocks.length, 0), d = l.timeSync("buildDirectiveText", () => i.map((e) => e.directiveText).filter(Boolean).join("\n")), f = {
|
|
1363
1363
|
sourceFormat: e,
|
|
1364
1364
|
documentDate: r,
|
|
1365
1365
|
html: t,
|
|
1366
1366
|
htmlWithLinks: n,
|
|
1367
|
-
tableOfContents: a ?? l.timeSync("extractTableOfContents", () =>
|
|
1367
|
+
tableOfContents: a ?? l.timeSync("extractTableOfContents", () => y(d), { inputSize: d.length }),
|
|
1368
1368
|
articles: i,
|
|
1369
1369
|
...c === void 0 ? {} : { linkDecisions: c }
|
|
1370
1370
|
};
|
|
@@ -1388,26 +1388,26 @@ function _n(e, t, n, r, i, a, o = !0, s, c) {
|
|
|
1388
1388
|
e.push(...n);
|
|
1389
1389
|
}
|
|
1390
1390
|
return e;
|
|
1391
|
-
}, { count: i.length }), g = tn(i), { createdArticlesByDirective: _, definitions: v } = l.timeSync("buildInternalArticleDefinitions", () => an(h, g), { count: h.length }),
|
|
1392
|
-
...mn(i,
|
|
1393
|
-
...hn(i,
|
|
1394
|
-
...gn(i,
|
|
1395
|
-
], { count:
|
|
1391
|
+
}, { count: i.length }), g = tn(i), { createdArticlesByDirective: _, definitions: v } = l.timeSync("buildInternalArticleDefinitions", () => an(h, g), { count: h.length }), b = l.timeSync("attachInternalArticleMetadata", () => on(h, v, _, g), { count: h.length }), ee = l.timeSync("collectNestedFrenchQuoteDiagnostics", () => cn(b), { count: b.length }), x = [...s ?? [], ...ee], S = l.timeSync("collectNestedFrenchQuoteAnnotations", () => [
|
|
1392
|
+
...mn(i, b),
|
|
1393
|
+
...hn(i, b),
|
|
1394
|
+
...gn(i, b)
|
|
1395
|
+
], { count: b.length }), te = {
|
|
1396
1396
|
...f,
|
|
1397
1397
|
...p ? { globalApplicabilityDate: p } : {},
|
|
1398
1398
|
...v.length > 0 ? { internalArticleDefinitions: v } : {},
|
|
1399
|
-
directives:
|
|
1400
|
-
...
|
|
1399
|
+
directives: b,
|
|
1400
|
+
...S.length > 0 ? { annotations: S } : {},
|
|
1401
1401
|
...x.length > 0 ? { diagnostics: x } : {}
|
|
1402
1402
|
};
|
|
1403
1403
|
return l.log({
|
|
1404
|
-
annotationCount:
|
|
1404
|
+
annotationCount: S.length,
|
|
1405
1405
|
articleCount: i.length,
|
|
1406
1406
|
blockCount: u,
|
|
1407
1407
|
definitionCount: v.length,
|
|
1408
1408
|
diagnosticCount: x.length,
|
|
1409
1409
|
directiveAnalysisIncluded: !0,
|
|
1410
|
-
directiveCount:
|
|
1410
|
+
directiveCount: b.length,
|
|
1411
1411
|
actionDirectiveExtractionTotals: m.reduce((e, t) => ({
|
|
1412
1412
|
applyApplicabilityDatesMs: e.applyApplicabilityDatesMs + t.actionDirectiveExtraction.applyApplicabilityDatesMs,
|
|
1413
1413
|
buildListItemTreeMs: e.buildListItemTreeMs + t.actionDirectiveExtraction.buildListItemTreeMs,
|
|
@@ -1484,7 +1484,7 @@ function _n(e, t, n, r, i, a, o = !0, s, c) {
|
|
|
1484
1484
|
}),
|
|
1485
1485
|
directiveTextSize: d.length,
|
|
1486
1486
|
slowDirectiveArticles: m.toSorted((e, t) => t.totalMs - e.totalMs).slice(0, 10)
|
|
1487
|
-
}),
|
|
1487
|
+
}), te;
|
|
1488
1488
|
}
|
|
1489
1489
|
function vn(e) {
|
|
1490
1490
|
return { items: e.map((e) => ({
|
|
@@ -1494,10 +1494,10 @@ function vn(e) {
|
|
|
1494
1494
|
})) };
|
|
1495
1495
|
}
|
|
1496
1496
|
function yn(e) {
|
|
1497
|
-
return Array.from(
|
|
1497
|
+
return Array.from(te(e)).filter((e) => e.type === "article").map((e) => F(e.line.split(/[::]/u)[0]));
|
|
1498
1498
|
}
|
|
1499
1499
|
function bn(e, t, n, r) {
|
|
1500
|
-
let i = St(e), a = new Set(Array.from(n.matchAll(/\s+id=(?:"([^"]+)"|'([^']+)')/gu), (e) => e[1] ?? e[2])), o = Array.from(
|
|
1500
|
+
let i = St(e), a = new Set(Array.from(n.matchAll(/\s+id=(?:"([^"]+)"|'([^']+)')/gu), (e) => e[1] ?? e[2])), o = Array.from(te(t)).filter((e) => e.type === "article"), s = e.map((e) => r === "akoma-ntoso" ? e.num ? I(e.num) : _(e.html)("p.TCNumArticle").first().attr("id") ?? I(e.label) : e.id), c = o.map((e) => e.id);
|
|
1501
1501
|
(c.length !== s.length || c.some((e, t) => e !== s[t])) && i.push({
|
|
1502
1502
|
code: "article_toc_source_heading_mismatch",
|
|
1503
1503
|
message: "The table of contents differs from the parsed article headings",
|
|
@@ -1514,7 +1514,7 @@ function bn(e, t, n, r) {
|
|
|
1514
1514
|
return i;
|
|
1515
1515
|
}
|
|
1516
1516
|
function xn(e, t, n) {
|
|
1517
|
-
let r = yn(
|
|
1517
|
+
let r = yn(y(e.map((e) => e.directiveText).filter(Boolean).join("\n"))), i = e.map((e) => F(e.label)), a = vn(e), o = [...n, ...bn(e, a, t, "assemblee-html")];
|
|
1518
1518
|
if (r.length > 0 && (r.length !== i.length || r.some((e, t) => e !== i[t]))) {
|
|
1519
1519
|
let t = r.findIndex((e, t) => e !== i[t]);
|
|
1520
1520
|
o.push({
|
|
@@ -1539,7 +1539,7 @@ function xn(e, t, n) {
|
|
|
1539
1539
|
};
|
|
1540
1540
|
}
|
|
1541
1541
|
async function Sn(e, t) {
|
|
1542
|
-
let n = new
|
|
1542
|
+
let n = new fe("parseAssembleeBillRaw"), r = t.linkedHtml === void 0 ? await n.time("linkAssembleeBillRaw", () => Cn(e, t)) : void 0, i = n.timeSync("applyArticleAnchorIds", () => Nt(t.linkedHtml ?? r.linkedHtml), { inputSize: e.length }), a = n.timeSync("cheerioLoadLinkedHtml", () => _(i)), o = n.timeSync("extractArticleHeadings", () => wt(a)), s = new Set(o.map((e) => e.id)), c = vt(a).filter((e) => !s.has(I(e.num ?? e.label))).map((e) => e.label), l = c.length > 0 ? [{
|
|
1543
1543
|
code: "article_toc_source_heading_mismatch",
|
|
1544
1544
|
message: "Some structural article headings were not retained",
|
|
1545
1545
|
details: { discardedCandidates: c }
|
|
@@ -1808,18 +1808,18 @@ function Gn(e, t) {
|
|
|
1808
1808
|
return n;
|
|
1809
1809
|
}
|
|
1810
1810
|
function Kn(e, t, n, r) {
|
|
1811
|
-
let i = V(t), a = e(t).attr("eId") ?? e(t).attr("GUID"),
|
|
1811
|
+
let i = V(t), a = e(t).attr("eId") ?? e(t).attr("GUID"), o = Vn(e, t), s = qn(e, t, i, o), c = [`<${n} ${[
|
|
1812
1812
|
a ? `id="${B(a)}"` : void 0,
|
|
1813
1813
|
`class="${r}"`,
|
|
1814
|
-
|
|
1815
|
-
|
|
1814
|
+
o ? `data-pastille="${B(o)}"` : void 0,
|
|
1815
|
+
s ? `style="${B(s)}"` : void 0
|
|
1816
1816
|
].filter((e) => e !== void 0).join(" ")}>`];
|
|
1817
1817
|
if (i === "part" || i === "title") {
|
|
1818
1818
|
let r = Xn(e, t, i), a = Qn(e, t), o = r ? [Bn({
|
|
1819
1819
|
content: r,
|
|
1820
1820
|
contextClass: a
|
|
1821
1821
|
})] : [], s = () => {
|
|
1822
|
-
o.length !== 0 && (
|
|
1822
|
+
o.length !== 0 && (c.push(Yn(o)), o = []);
|
|
1823
1823
|
};
|
|
1824
1824
|
return e(t).children().each((t, n) => {
|
|
1825
1825
|
if (!L(n)) return;
|
|
@@ -1829,38 +1829,38 @@ function Kn(e, t, n, r) {
|
|
|
1829
1829
|
o.push(...Gn(e, n));
|
|
1830
1830
|
return;
|
|
1831
1831
|
}
|
|
1832
|
-
s(),
|
|
1832
|
+
s(), c.push(H(e, n));
|
|
1833
1833
|
}
|
|
1834
|
-
}), s(),
|
|
1834
|
+
}), s(), c.push(`</${n}>`), c.join("\n");
|
|
1835
1835
|
}
|
|
1836
1836
|
if (i === "article") {
|
|
1837
|
-
let r = P(e(t).children("num").first().text()), i = P(e(t).children("heading").first().text()), a =
|
|
1837
|
+
let r = P(e(t).children("num").first().text()), i = P(e(t).children("heading").first().text()), a = k(r) ?? {
|
|
1838
1838
|
label: r,
|
|
1839
1839
|
num: r
|
|
1840
|
-
},
|
|
1840
|
+
}, o = `<p class="TCNumArticle as-text toc-article dispositif" id="${B(`_TocArt${(a.num ?? r).replace(/\s+/gu, "")}`)}">${B(a.label)}${i ? ` : ${B(i)}` : ""}</p>`;
|
|
1841
1841
|
if (Hn(e, t)) {
|
|
1842
1842
|
let r = [Bn({
|
|
1843
|
-
content:
|
|
1843
|
+
content: o,
|
|
1844
1844
|
contextClass: tr(a.label)
|
|
1845
1845
|
}), ...Gn(e, t)];
|
|
1846
|
-
|
|
1847
|
-
for (let n of Wn(e, t)) n.includes("akn-pastille-table") ||
|
|
1848
|
-
return
|
|
1846
|
+
c.push(Rn(r));
|
|
1847
|
+
for (let n of Wn(e, t)) n.includes("akn-pastille-table") || c.push(n);
|
|
1848
|
+
return c.push(`</${n}>`), c.join("\n");
|
|
1849
1849
|
}
|
|
1850
|
-
|
|
1850
|
+
c.push(o);
|
|
1851
1851
|
}
|
|
1852
|
-
let
|
|
1852
|
+
let l = [];
|
|
1853
1853
|
for (let n of ["content", "children"]) e(t).children().each((t, r) => {
|
|
1854
1854
|
if (!L(r)) return;
|
|
1855
1855
|
let i = V(r);
|
|
1856
|
-
i === "num" || i === "heading" || n === "content" && i !== "content" || n === "children" && i === "content" ||
|
|
1856
|
+
i === "num" || i === "heading" || n === "content" && i !== "content" || n === "children" && i === "content" || l.push(H(e, r));
|
|
1857
1857
|
});
|
|
1858
|
-
let
|
|
1858
|
+
let u = l.join("\n");
|
|
1859
1859
|
if (i !== "article") {
|
|
1860
|
-
let n = Fn(
|
|
1861
|
-
n &&
|
|
1860
|
+
let n = Fn(u, P(e(t).children("num").first().text())) ? "" : Pn(e, t);
|
|
1861
|
+
n && c.push(n);
|
|
1862
1862
|
}
|
|
1863
|
-
return
|
|
1863
|
+
return c.push(o ? Ln(u, o) : u), c.push(`</${n}>`), c.join("\n");
|
|
1864
1864
|
}
|
|
1865
1865
|
function qn(e, t, n, r) {
|
|
1866
1866
|
let i = Jn(e(t).attr("style") ?? "", "font-family");
|
|
@@ -1944,7 +1944,7 @@ function rr(e, t) {
|
|
|
1944
1944
|
return [P(e(t).children("num").first().text()), P(e(t).children("heading").first().text())].filter(Boolean).join(" ");
|
|
1945
1945
|
}
|
|
1946
1946
|
function ir(e, t) {
|
|
1947
|
-
let n = P(e(t).children("num").first().text()), r = P(e(t).children("heading").first().text()), i =
|
|
1947
|
+
let n = P(e(t).children("num").first().text()), r = P(e(t).children("heading").first().text()), i = k(n) ?? {
|
|
1948
1948
|
label: n,
|
|
1949
1949
|
num: n
|
|
1950
1950
|
};
|
|
@@ -1995,7 +1995,7 @@ function lr(e) {
|
|
|
1995
1995
|
}), r.push("</section></div>"), r.join("\n");
|
|
1996
1996
|
}
|
|
1997
1997
|
function ur(e) {
|
|
1998
|
-
let t =
|
|
1998
|
+
let t = _(e, { xml: {
|
|
1999
1999
|
decodeEntities: !1,
|
|
2000
2000
|
lowerCaseTags: !1,
|
|
2001
2001
|
lowerCaseAttributeNames: !1,
|
|
@@ -2009,33 +2009,33 @@ function ur(e) {
|
|
|
2009
2009
|
};
|
|
2010
2010
|
}
|
|
2011
2011
|
function dr(e) {
|
|
2012
|
-
return fr(
|
|
2012
|
+
return fr(_(e));
|
|
2013
2013
|
}
|
|
2014
2014
|
function fr(e) {
|
|
2015
2015
|
let t = [];
|
|
2016
2016
|
return e("article.akn-article").each((n, r) => {
|
|
2017
|
-
let i = e(r).find("p.TCNumArticle").first().get(0), a = P(i ? e(i).text() : ""),
|
|
2017
|
+
let i = e(r).find("p.TCNumArticle").first().get(0), a = P(i ? e(i).text() : ""), o = k(a) ?? { label: a || `Article ${n + 1}` }, s = e(r).attr("id") ?? `akn-article-${String(n + 1).padStart(3, "0")}`, c = [r], l = kt(e, s, c), u = l.filter((e) => e.kind !== "noise").map((e) => e.text).join("\n");
|
|
2018
2018
|
t.push({
|
|
2019
|
-
id:
|
|
2020
|
-
label:
|
|
2021
|
-
num:
|
|
2022
|
-
title:
|
|
2023
|
-
text: st(e,
|
|
2019
|
+
id: s,
|
|
2020
|
+
label: o.label,
|
|
2021
|
+
num: o.num,
|
|
2022
|
+
title: o.title,
|
|
2023
|
+
text: st(e, c),
|
|
2024
2024
|
html: nt(e, r),
|
|
2025
|
-
directiveText:
|
|
2026
|
-
blocks:
|
|
2025
|
+
directiveText: u,
|
|
2026
|
+
blocks: l
|
|
2027
2027
|
});
|
|
2028
2028
|
}), t;
|
|
2029
2029
|
}
|
|
2030
2030
|
function pr(e) {
|
|
2031
|
-
let t =
|
|
2031
|
+
let t = _(e);
|
|
2032
2032
|
return {
|
|
2033
2033
|
articles: fr(t),
|
|
2034
2034
|
htmlWithLinks: t.html()
|
|
2035
2035
|
};
|
|
2036
2036
|
}
|
|
2037
2037
|
async function mr(e, t) {
|
|
2038
|
-
let n = new
|
|
2038
|
+
let n = new fe("parseAkomaNtosoBillRaw"), r = n.timeSync("cheerioLoadXml", () => _(e, { xml: {
|
|
2039
2039
|
decodeEntities: !1,
|
|
2040
2040
|
lowerCaseTags: !1,
|
|
2041
2041
|
lowerCaseAttributeNames: !1,
|
|
@@ -2070,7 +2070,7 @@ function vr(e) {
|
|
|
2070
2070
|
return e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim();
|
|
2071
2071
|
}
|
|
2072
2072
|
function yr(e) {
|
|
2073
|
-
let t = vr(
|
|
2073
|
+
let t = vr(_(e).text()), n = [...t.matchAll(gr)], r = /* @__PURE__ */ new Set(), i = [];
|
|
2074
2074
|
for (let [e, a] of n.entries()) {
|
|
2075
2075
|
let o = (a.index ?? 0) + a[0].length, s = t.slice(o), c = _r.exec(s), l = vr(s.slice(0, c?.index ?? s.length));
|
|
2076
2076
|
if (l.length < 20 || r.has(l)) continue;
|
|
@@ -2134,7 +2134,7 @@ function Sr(e) {
|
|
|
2134
2134
|
//#endregion
|
|
2135
2135
|
//#region src/lib/server/senat_amendment_search.ts
|
|
2136
2136
|
function Cr(e) {
|
|
2137
|
-
return e?.trim() ?
|
|
2137
|
+
return e?.trim() ? _(e).text().replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim() : "";
|
|
2138
2138
|
}
|
|
2139
2139
|
function wr({ dispositifHtml: e, objetHtml: t }) {
|
|
2140
2140
|
let n = Cr(e), r = Cr(t);
|
|
@@ -2163,157 +2163,157 @@ function U(e, t) {
|
|
|
2163
2163
|
type: "amendment_action_directive"
|
|
2164
2164
|
};
|
|
2165
2165
|
}
|
|
2166
|
-
function Er(e,
|
|
2166
|
+
function Er(e, n) {
|
|
2167
2167
|
return {
|
|
2168
2168
|
type: e === "start" ? "head_of_target" : "tail_after_target",
|
|
2169
|
-
unit:
|
|
2169
|
+
unit: n ? t(n) : "article"
|
|
2170
2170
|
};
|
|
2171
2171
|
}
|
|
2172
2172
|
function Dr(e) {
|
|
2173
2173
|
return e === "start" ? "insert_before" : "insert_after";
|
|
2174
2174
|
}
|
|
2175
|
-
var Or = O(
|
|
2176
|
-
let
|
|
2175
|
+
var Or = O(D("[\\s\\S]*?(?=supprimer|substituer|remplacer|ins[eé]rer|compl[eé]ter|r[eé]diger)", { flags: "i" }), { default: "" }), W = T(Oe, E([D("les?\\s+", { flags: "i" }), he], { value: (e) => e[1] }), he, a), kr = T(E([D("la\\s+fin\\s+de\\s+", { flags: "i" }), W], { value: (e) => {
|
|
2176
|
+
let n = e[1];
|
|
2177
2177
|
return {
|
|
2178
|
-
targetReference:
|
|
2178
|
+
targetReference: n,
|
|
2179
2179
|
targetScope: {
|
|
2180
2180
|
type: "tail_after_target",
|
|
2181
|
-
unit:
|
|
2181
|
+
unit: t(n)
|
|
2182
2182
|
}
|
|
2183
2183
|
};
|
|
2184
|
-
} }),
|
|
2185
|
-
O(
|
|
2186
|
-
O(
|
|
2184
|
+
} }), E([l], { value: (e) => ({ targetScope: e[0] }) })), G = O(E([
|
|
2185
|
+
O(D("(?:[aà]\\s+la\\s+fin\\s+(?:du|de\\s+la|de\\s+l['’]?)\\s*)", { flags: "i" }), { default: "" }),
|
|
2186
|
+
O(D("(?:au\\s+d[eé]but\\s+d(?:u|e\\s+la|e\\s+l['’]?)\\s*)", { flags: "i" }), { default: "" }),
|
|
2187
2187
|
W,
|
|
2188
|
-
O(
|
|
2188
|
+
O(D("\\s*,?\\s*(?:(?:[IVXLCDM]+)\\s*[.\\-–—]+\\s*|\\d+°\\s*|[a-z]\\)\\s*)?", { flags: "i" }), { default: "" })
|
|
2189
2189
|
], { value: (e, t) => ({
|
|
2190
2190
|
reference: e[2],
|
|
2191
2191
|
text: t.text()
|
|
2192
|
-
}) }), { default: null }), Ar = O(
|
|
2192
|
+
}) }), { default: null }), Ar = O(D(`(?:(?:[aà]\\s+)?la\\s+(?:derni(?:ère|ere)|${pe})\\s+occurrence\\s+)`, { flags: "i" }), { default: "" });
|
|
2193
2193
|
function K(e) {
|
|
2194
2194
|
return e?.text ?? "";
|
|
2195
2195
|
}
|
|
2196
|
-
function
|
|
2197
|
-
return { citation:
|
|
2196
|
+
function jr(e) {
|
|
2197
|
+
return { citation: S(e.position()) };
|
|
2198
2198
|
}
|
|
2199
|
-
var
|
|
2199
|
+
var q = T(E([c], { value: (e) => ({ citation: e[0] }) }), D("\\S[\\s\\S]*", { value: (e, t) => jr(t) })), Mr = D("\\S[\\s\\S]*", { value: (e, t) => jr(t) }), J = D("[^:«“\"]*(?::\\s*)?", { flags: "i" }), Nr = D("\\S[\\s\\S]*?(?=\\s+par\\s+(?:les?\\s+)?(?:mots?|montants?|taux|références?|mentions?|dates?|années?)\\s*:)", {
|
|
2200
2200
|
flags: "i",
|
|
2201
|
-
value: (e, t) =>
|
|
2202
|
-
}),
|
|
2201
|
+
value: (e, t) => jr(t)
|
|
2202
|
+
}), Pr = D("\\S[\\s\\S]*?(?=\\s+(?:ins[eé]rer|ajouter|supprimer|r[eé]diger)\\b)", {
|
|
2203
2203
|
flags: "i",
|
|
2204
|
-
value: (e, t) =>
|
|
2205
|
-
}),
|
|
2204
|
+
value: (e, t) => jr(t)
|
|
2205
|
+
}), Fr = D("\\S[\\s\\S]*?(?=\\s*(?:(?:[IVXLCDM]+)\\s*[.\\-–—]+\\s*|\\d+°\\s*|[a-z]\\)\\s*|$))", {
|
|
2206
2206
|
flags: "i",
|
|
2207
|
-
value: (e, t) =>
|
|
2208
|
-
}),
|
|
2207
|
+
value: (e, t) => jr(t)
|
|
2208
|
+
}), Ir = T(E([c], { value: (e) => ({ citation: e[0] }) }), Nr), Lr = T(E([c], { value: (e) => ({ citation: e[0] }) }), Fr), Rr = E([D(`${r}s?\\s*:?\\s*`, { flags: "i" }), Ir], { value: (e) => e[1] }), zr = E([D(`${u}s?(?: suivant(?:e)?s?)?\\s*:?\\s*`, { flags: "i" }), Lr], { value: (e) => e[1] }), Br = T(E([c], { value: (e) => ({ citation: e[0] }) }), Pr), Vr = E([
|
|
2209
2209
|
Ar,
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
], { value: (e) => e[2] }),
|
|
2210
|
+
D(`${r}s?\\s*:?\\s*`, { flags: "i" }),
|
|
2211
|
+
Br
|
|
2212
|
+
], { value: (e) => e[2] }), Hr = E([
|
|
2213
2213
|
Ar,
|
|
2214
|
-
|
|
2215
|
-
|
|
2214
|
+
D(`${r}s?\\s*:?\\s*`, { flags: "i" }),
|
|
2215
|
+
T(E([c], { value: (e) => ({ citation: e[0] }) }), Mr)
|
|
2216
2216
|
], { value: (e) => e[2] });
|
|
2217
|
-
function
|
|
2217
|
+
function Y(e) {
|
|
2218
2218
|
return e?.reference;
|
|
2219
2219
|
}
|
|
2220
|
-
var
|
|
2220
|
+
var Ur = E([Or, D("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e, t) => U(t, {
|
|
2221
2221
|
contextText: e[0],
|
|
2222
2222
|
kind: "delete_article"
|
|
2223
|
-
}) }),
|
|
2223
|
+
}) }), Wr = E([
|
|
2224
2224
|
G,
|
|
2225
|
-
|
|
2226
|
-
O(
|
|
2227
|
-
O(
|
|
2225
|
+
D("supprimer", { flags: "i" }),
|
|
2226
|
+
O(E([A, W], { value: (e) => e[1] }), { default: null }),
|
|
2227
|
+
O(E([A, Hr], { value: (e) => e[1] }), { default: null })
|
|
2228
2228
|
], { value: (e, t) => U(t, {
|
|
2229
2229
|
contextText: K(e[0]),
|
|
2230
2230
|
kind: "delete_portion",
|
|
2231
2231
|
targetCitation: e[3]?.citation ?? void 0,
|
|
2232
|
-
targetReference: e[2] ??
|
|
2233
|
-
}) }),
|
|
2232
|
+
targetReference: e[2] ?? Y(e[0])
|
|
2233
|
+
}) }), Gr = E([
|
|
2234
2234
|
G,
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2235
|
+
T(D("r[eé]diger\\s+ainsi", { flags: "i" }), D("r[eé]tablir", { flags: "i" })),
|
|
2236
|
+
J,
|
|
2237
|
+
q
|
|
2238
2238
|
], { value: (e, t) => U(t, {
|
|
2239
2239
|
contextText: K(e[0]),
|
|
2240
2240
|
kind: "rewrite_portion",
|
|
2241
2241
|
replacementCitation: e[3].citation,
|
|
2242
|
-
targetReference:
|
|
2243
|
-
}) }),
|
|
2242
|
+
targetReference: Y(e[0])
|
|
2243
|
+
}) }), Kr = E([
|
|
2244
2244
|
G,
|
|
2245
|
-
|
|
2246
|
-
|
|
2245
|
+
T(D("substituer", { flags: "i" }), D("remplacer", { flags: "i" })),
|
|
2246
|
+
A,
|
|
2247
2247
|
Ar,
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
O(
|
|
2251
|
-
|
|
2248
|
+
Rr,
|
|
2249
|
+
D("\\s*,?\\s*"),
|
|
2250
|
+
O(D("par\\s+", { flags: "i" }), { default: "" }),
|
|
2251
|
+
zr
|
|
2252
2252
|
], { value: (e, t) => U(t, {
|
|
2253
2253
|
contextText: K(e[0]),
|
|
2254
2254
|
kind: "replace",
|
|
2255
2255
|
replacementCitation: e[7].citation,
|
|
2256
2256
|
targetCitation: e[4].citation,
|
|
2257
|
-
targetReference:
|
|
2258
|
-
}) }),
|
|
2257
|
+
targetReference: Y(e[0])
|
|
2258
|
+
}) }), qr = E([
|
|
2259
2259
|
G,
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
O(
|
|
2260
|
+
D("substituer", { flags: "i" }),
|
|
2261
|
+
A,
|
|
2262
|
+
O(D("(?:[aà]|aux?|à la)\\s+", { flags: "i" }), { default: "" }),
|
|
2263
2263
|
W,
|
|
2264
|
-
|
|
2265
|
-
|
|
2264
|
+
D("[\\s\\S]*?(?=[«“\"]|$)"),
|
|
2265
|
+
q
|
|
2266
2266
|
], { value: (e, t) => U(t, {
|
|
2267
2267
|
contextText: K(e[0]),
|
|
2268
2268
|
kind: "rewrite_portion",
|
|
2269
2269
|
replacementCitation: e[6].citation,
|
|
2270
|
-
targetReference: e[4] ??
|
|
2271
|
-
}) }),
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2270
|
+
targetReference: e[4] ?? Y(e[0])
|
|
2271
|
+
}) }), Jr = E([
|
|
2272
|
+
b,
|
|
2273
|
+
A,
|
|
2274
|
+
D("l['’ ]article", { flags: "i" }),
|
|
2275
|
+
D("[\\s\\S]*?(?=ins[eé]rer)", { flags: "i" }),
|
|
2276
|
+
D("ins[eé]rer", { flags: "i" }),
|
|
2277
|
+
J,
|
|
2278
|
+
q
|
|
2279
2279
|
], { value: (e, t) => U(t, {
|
|
2280
2280
|
contextText: "",
|
|
2281
2281
|
insertCitation: e[6].citation,
|
|
2282
2282
|
kind: e[0] === "before" ? "insert_article_before" : "insert_article_after"
|
|
2283
|
-
}) }),
|
|
2284
|
-
|
|
2285
|
-
|
|
2283
|
+
}) }), Yr = E([
|
|
2284
|
+
b,
|
|
2285
|
+
A,
|
|
2286
2286
|
W,
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
], { value: (
|
|
2287
|
+
D("[\\s\\S]*?(?=ins[eé]rer|ajouter)", { flags: "i" }),
|
|
2288
|
+
T(D("ins[eé]rer", { flags: "i" }), D("ajouter", { flags: "i" })),
|
|
2289
|
+
J,
|
|
2290
|
+
q
|
|
2291
|
+
], { value: (t, n) => U(n, {
|
|
2292
2292
|
contextText: "",
|
|
2293
|
-
insertCitation:
|
|
2294
|
-
kind:
|
|
2295
|
-
targetReference:
|
|
2296
|
-
}) }),
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
], { value: (
|
|
2293
|
+
insertCitation: t[6].citation,
|
|
2294
|
+
kind: e(t[0]),
|
|
2295
|
+
targetReference: t[2]
|
|
2296
|
+
}) }), Xr = E([
|
|
2297
|
+
b,
|
|
2298
|
+
A,
|
|
2299
|
+
D("l['’ ]alin[eé]a", { flags: "i" }),
|
|
2300
|
+
D("[\\s\\S]*?(?=ins[eé]rer)", { flags: "i" }),
|
|
2301
|
+
D("ins[eé]rer", { flags: "i" }),
|
|
2302
|
+
J,
|
|
2303
|
+
q
|
|
2304
|
+
], { value: (t, n) => U(n, {
|
|
2305
2305
|
contextText: "",
|
|
2306
|
-
insertCitation:
|
|
2307
|
-
kind:
|
|
2308
|
-
}) }),
|
|
2306
|
+
insertCitation: t[6].citation,
|
|
2307
|
+
kind: e(t[0])
|
|
2308
|
+
}) }), Zr = E([
|
|
2309
2309
|
G,
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2310
|
+
s,
|
|
2311
|
+
D("[\\s\\S]*?(?=ins[eé]rer|ajouter)", { flags: "i" }),
|
|
2312
|
+
T(D("ins[eé]rer", { flags: "i" }), D("ajouter", { flags: "i" })),
|
|
2313
|
+
J,
|
|
2314
|
+
q
|
|
2315
2315
|
], { value: (e, t) => {
|
|
2316
|
-
let n = e[0], r =
|
|
2316
|
+
let n = e[0], r = Y(n), i = e[1];
|
|
2317
2317
|
return U(t, {
|
|
2318
2318
|
contextText: K(n),
|
|
2319
2319
|
insertCitation: e[5].citation,
|
|
@@ -2321,60 +2321,60 @@ var Hr = T([Or, E("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e,
|
|
|
2321
2321
|
targetReference: r,
|
|
2322
2322
|
targetScope: Er(i, r)
|
|
2323
2323
|
});
|
|
2324
|
-
} }),
|
|
2324
|
+
} }), Qr = E([
|
|
2325
2325
|
G,
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
], { value: (
|
|
2334
|
-
contextText: K(
|
|
2335
|
-
insertCitation:
|
|
2336
|
-
kind:
|
|
2337
|
-
targetCitation:
|
|
2338
|
-
targetReference:
|
|
2339
|
-
}) }),
|
|
2326
|
+
b,
|
|
2327
|
+
A,
|
|
2328
|
+
Vr,
|
|
2329
|
+
D("[\\s\\S]*?(?=ins[eé]rer)"),
|
|
2330
|
+
D("ins[eé]rer", { flags: "i" }),
|
|
2331
|
+
A,
|
|
2332
|
+
zr
|
|
2333
|
+
], { value: (t, n) => U(n, {
|
|
2334
|
+
contextText: K(t[0]),
|
|
2335
|
+
insertCitation: t[7].citation,
|
|
2336
|
+
kind: e(t[1]),
|
|
2337
|
+
targetCitation: t[3].citation,
|
|
2338
|
+
targetReference: Y(t[0])
|
|
2339
|
+
}) }), $r = E([
|
|
2340
2340
|
G,
|
|
2341
|
-
|
|
2342
|
-
|
|
2341
|
+
b,
|
|
2342
|
+
A,
|
|
2343
2343
|
W,
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
], { value: (
|
|
2349
|
-
contextText: K(
|
|
2350
|
-
insertCitation:
|
|
2351
|
-
kind:
|
|
2352
|
-
targetReference:
|
|
2353
|
-
}) }),
|
|
2344
|
+
D("[\\s\\S]*?(?=ins[eé]rer|ajouter)", { flags: "i" }),
|
|
2345
|
+
T(D("ins[eé]rer", { flags: "i" }), D("ajouter", { flags: "i" })),
|
|
2346
|
+
J,
|
|
2347
|
+
q
|
|
2348
|
+
], { value: (t, n) => U(n, {
|
|
2349
|
+
contextText: K(t[0]),
|
|
2350
|
+
insertCitation: t[7].citation,
|
|
2351
|
+
kind: e(t[1]),
|
|
2352
|
+
targetReference: Y(t[0]) ?? t[3]
|
|
2353
|
+
}) }), ei = T(Zr, Jr, Yr, Xr, qr, E([
|
|
2354
2354
|
G,
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2355
|
+
b,
|
|
2356
|
+
A,
|
|
2357
|
+
Vr,
|
|
2358
|
+
D("[\\s\\S]*?(?=supprimer|r[eé]diger)", { flags: "i" }),
|
|
2359
|
+
T(E([
|
|
2360
|
+
D("supprimer", {
|
|
2361
2361
|
flags: "i",
|
|
2362
2362
|
value: "delete_portion"
|
|
2363
2363
|
}),
|
|
2364
|
-
|
|
2364
|
+
A,
|
|
2365
2365
|
kr
|
|
2366
2366
|
], { value: (e) => ({
|
|
2367
2367
|
kind: e[0],
|
|
2368
2368
|
...e[2]
|
|
2369
|
-
}) }),
|
|
2370
|
-
|
|
2369
|
+
}) }), E([
|
|
2370
|
+
D("r[eé]diger\\s+ainsi", {
|
|
2371
2371
|
flags: "i",
|
|
2372
2372
|
value: "rewrite_portion"
|
|
2373
2373
|
}),
|
|
2374
|
-
|
|
2374
|
+
A,
|
|
2375
2375
|
kr,
|
|
2376
|
-
|
|
2377
|
-
|
|
2376
|
+
J,
|
|
2377
|
+
q
|
|
2378
2378
|
], { value: (e) => ({
|
|
2379
2379
|
kind: e[0],
|
|
2380
2380
|
replacementCitation: e[4].citation,
|
|
@@ -2387,44 +2387,44 @@ var Hr = T([Or, E("supprimer\\s+cet\\s+article", { flags: "i" })], { value: (e,
|
|
|
2387
2387
|
kind: n.kind,
|
|
2388
2388
|
replacementCitation: n.replacementCitation,
|
|
2389
2389
|
targetCitation: e[3].citation,
|
|
2390
|
-
targetReference:
|
|
2390
|
+
targetReference: Y(e[0]) ?? n.targetReference,
|
|
2391
2391
|
targetScope: n.targetScope
|
|
2392
2392
|
});
|
|
2393
|
-
} }),
|
|
2393
|
+
} }), Qr, $r, E([
|
|
2394
2394
|
Or,
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
], { value: (
|
|
2403
|
-
contextText:
|
|
2404
|
-
insertCitation:
|
|
2405
|
-
kind:
|
|
2406
|
-
targetCitation:
|
|
2407
|
-
}) }),
|
|
2395
|
+
D("ins[eé]rer", { flags: "i" }),
|
|
2396
|
+
D(`[\\s\\S]*?(?=${o})`, { flags: "i" }),
|
|
2397
|
+
b,
|
|
2398
|
+
J,
|
|
2399
|
+
c,
|
|
2400
|
+
J,
|
|
2401
|
+
c
|
|
2402
|
+
], { value: (t, n) => U(n, {
|
|
2403
|
+
contextText: t[0],
|
|
2404
|
+
insertCitation: t[8],
|
|
2405
|
+
kind: e(t[3]),
|
|
2406
|
+
targetCitation: t[6]
|
|
2407
|
+
}) }), Kr, Gr, E([
|
|
2408
2408
|
G,
|
|
2409
|
-
|
|
2410
|
-
O(
|
|
2411
|
-
|
|
2412
|
-
|
|
2409
|
+
D("compl[eé]ter", { flags: "i" }),
|
|
2410
|
+
O(E([A, W], { value: (e) => e[1] }), { default: null }),
|
|
2411
|
+
J,
|
|
2412
|
+
q
|
|
2413
2413
|
], { value: (e, t) => U(t, {
|
|
2414
2414
|
contextText: K(e[0]),
|
|
2415
2415
|
insertCitation: e[4].citation,
|
|
2416
2416
|
kind: "insert_after",
|
|
2417
|
-
targetReference: e[2] ??
|
|
2418
|
-
}) }),
|
|
2417
|
+
targetReference: e[2] ?? Y(e[0])
|
|
2418
|
+
}) }), Ur, Wr);
|
|
2419
2419
|
//#endregion
|
|
2420
2420
|
//#region src/lib/server/parsed_amendments.ts
|
|
2421
|
-
function
|
|
2421
|
+
function ti(e) {
|
|
2422
2422
|
return e.replace(/\s+/gu, " ").trim();
|
|
2423
2423
|
}
|
|
2424
|
-
function
|
|
2425
|
-
return e.split(/\n/gu).map(
|
|
2424
|
+
function ni(e) {
|
|
2425
|
+
return e.split(/\n/gu).map(ti).filter(Boolean).join("\n");
|
|
2426
2426
|
}
|
|
2427
|
-
function
|
|
2427
|
+
function ri(e, t) {
|
|
2428
2428
|
let { start: n, stop: r } = t;
|
|
2429
2429
|
for (; n < r && /\s/u.test(e[n]);) n++;
|
|
2430
2430
|
for (; r > n && /\s/u.test(e[r - 1]);) r--;
|
|
@@ -2433,16 +2433,16 @@ function ni(e, t) {
|
|
|
2433
2433
|
stop: r
|
|
2434
2434
|
} : null;
|
|
2435
2435
|
}
|
|
2436
|
-
function
|
|
2437
|
-
return
|
|
2436
|
+
function ii(e, t) {
|
|
2437
|
+
return _e(Ce(e), t);
|
|
2438
2438
|
}
|
|
2439
|
-
function
|
|
2439
|
+
function ai(e) {
|
|
2440
2440
|
return e === "before_article" || e === "on_article" || e === "after_article" ? e : "unknown";
|
|
2441
2441
|
}
|
|
2442
|
-
function
|
|
2442
|
+
function oi(e) {
|
|
2443
2443
|
return {
|
|
2444
2444
|
articleLabel: e.targetArticleLabel ?? null,
|
|
2445
|
-
targetPosition:
|
|
2445
|
+
targetPosition: ai(e.targetPosition),
|
|
2446
2446
|
alinea: e.targetAlinea ?? null,
|
|
2447
2447
|
alineaLabel: e.targetAlineaLabel ?? null,
|
|
2448
2448
|
subdivisionSourceId: e.targetSubdivisionSourceId ?? null,
|
|
@@ -2450,30 +2450,30 @@ function ai(e) {
|
|
|
2450
2450
|
subpos: e.targetSubpos ?? null
|
|
2451
2451
|
};
|
|
2452
2452
|
}
|
|
2453
|
-
function
|
|
2453
|
+
function X(e) {
|
|
2454
2454
|
return {
|
|
2455
2455
|
...e.originalTransformation === void 0 ? {} : { sourceOriginalTransformation: e.originalTransformation },
|
|
2456
2456
|
sourcePosition: e.position,
|
|
2457
2457
|
sourceText: e.text
|
|
2458
2458
|
};
|
|
2459
2459
|
}
|
|
2460
|
-
function
|
|
2460
|
+
function si(e) {
|
|
2461
2461
|
return {
|
|
2462
2462
|
...e.originalTransformation === void 0 ? {} : { sourceOriginalTransformation: e.originalTransformation },
|
|
2463
2463
|
sourcePosition: e.position,
|
|
2464
2464
|
sourceText: e.text
|
|
2465
2465
|
};
|
|
2466
2466
|
}
|
|
2467
|
-
function
|
|
2467
|
+
function ci(e) {
|
|
2468
2468
|
return {
|
|
2469
2469
|
...e?.originalTransformation === void 0 ? {} : { dispositifOriginalTransformation: e.originalTransformation },
|
|
2470
2470
|
...e === null ? {} : { dispositifPosition: e.position },
|
|
2471
2471
|
dispositifText: e?.text ?? null
|
|
2472
2472
|
};
|
|
2473
2473
|
}
|
|
2474
|
-
function
|
|
2474
|
+
function Z(e, t, n, r = ni(e.slice(n.start, n.stop))) {
|
|
2475
2475
|
return {
|
|
2476
|
-
originalTransformation:
|
|
2476
|
+
originalTransformation: ii(t, n),
|
|
2477
2477
|
position: n,
|
|
2478
2478
|
text: r
|
|
2479
2479
|
};
|
|
@@ -2481,12 +2481,12 @@ function ci(e, t, n, r = ti(e.slice(n.start, n.stop))) {
|
|
|
2481
2481
|
function li(e) {
|
|
2482
2482
|
let t = e.dispositifHtml ?? e.dispositifText;
|
|
2483
2483
|
if (!t) return null;
|
|
2484
|
-
let n = e.dispositifHtml ?
|
|
2484
|
+
let n = e.dispositifHtml ? ge()(t) : me(t), r = n.output, i = ri(r, {
|
|
2485
2485
|
start: 0,
|
|
2486
2486
|
stop: r.length
|
|
2487
2487
|
});
|
|
2488
2488
|
return {
|
|
2489
|
-
dispositif: i === null ? null :
|
|
2489
|
+
dispositif: i === null ? null : Z(r, n, i),
|
|
2490
2490
|
simplifiedText: r,
|
|
2491
2491
|
transformation: n
|
|
2492
2492
|
};
|
|
@@ -2503,7 +2503,7 @@ function Q(e) {
|
|
|
2503
2503
|
return t === void 0 ? [] : Array.from({ length: e.count }, (e, n) => t + n);
|
|
2504
2504
|
}
|
|
2505
2505
|
if (e.type === "exclusion") return Q(e.left);
|
|
2506
|
-
for (let t of
|
|
2506
|
+
for (let t of C(e)) if (t.type === "alinéa" && typeof t.index == "number" && t.index > 0) return [t.index];
|
|
2507
2507
|
return [];
|
|
2508
2508
|
}
|
|
2509
2509
|
function ui(e, t) {
|
|
@@ -2537,7 +2537,7 @@ function mi(e) {
|
|
|
2537
2537
|
return /^(?:apr[eè]s|avant|(?:au|a[uù])\s+d[eé]but|(?:a|à)\s+la\s+fin)\b/iu.test(di(e.text));
|
|
2538
2538
|
}
|
|
2539
2539
|
function hi(e, t, n, r) {
|
|
2540
|
-
return
|
|
2540
|
+
return Z(e, t, {
|
|
2541
2541
|
start: n.position.start,
|
|
2542
2542
|
stop: r.position.stop
|
|
2543
2543
|
});
|
|
@@ -2554,21 +2554,21 @@ function _i(e, t) {
|
|
|
2554
2554
|
stop: n.stop
|
|
2555
2555
|
});
|
|
2556
2556
|
}
|
|
2557
|
-
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),
|
|
2557
|
+
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), ri(e, n);
|
|
2558
2558
|
}
|
|
2559
2559
|
function vi(e) {
|
|
2560
|
-
return
|
|
2560
|
+
return ue(e);
|
|
2561
2561
|
}
|
|
2562
2562
|
function yi(e, t) {
|
|
2563
|
-
return
|
|
2563
|
+
return ei(new w(e.slice(0, t.stop), t.start)) ?? null;
|
|
2564
2564
|
}
|
|
2565
2565
|
function $(e, t, n) {
|
|
2566
|
-
if (n) return
|
|
2566
|
+
if (n) return Z(e, t, n.position, ni(se(e, n)));
|
|
2567
2567
|
}
|
|
2568
2568
|
function bi(e, t) {
|
|
2569
2569
|
if (!e) return;
|
|
2570
2570
|
let n = structuredClone(e);
|
|
2571
|
-
for (let e of
|
|
2571
|
+
for (let e of ye(n, { citations: !0 })) e.position !== void 0 && (e.originalTransformation = ii(t, e.position));
|
|
2572
2572
|
return n;
|
|
2573
2573
|
}
|
|
2574
2574
|
function xi(e, t, n, r) {
|
|
@@ -2576,17 +2576,17 @@ function xi(e, t, n, r) {
|
|
|
2576
2576
|
if (!i) return null;
|
|
2577
2577
|
let a = yi(e, i);
|
|
2578
2578
|
if (!a) return null;
|
|
2579
|
-
let o =
|
|
2579
|
+
let o = Z(e, t, i), s = bi(a.targetReference, t), c = ui(r, s), l = vi(o.text);
|
|
2580
2580
|
if (a.kind === "delete_article") return {
|
|
2581
2581
|
kind: "delete_article",
|
|
2582
|
-
...
|
|
2582
|
+
...X(o),
|
|
2583
2583
|
target: c
|
|
2584
2584
|
};
|
|
2585
2585
|
if (a.kind === "delete_portion") {
|
|
2586
2586
|
let n = $(e, t, a.targetCitation);
|
|
2587
2587
|
return {
|
|
2588
2588
|
kind: "delete_portion",
|
|
2589
|
-
...
|
|
2589
|
+
...X(o),
|
|
2590
2590
|
target: c,
|
|
2591
2591
|
...n === void 0 ? {} : {
|
|
2592
2592
|
targetCitation: n,
|
|
@@ -2603,7 +2603,7 @@ function xi(e, t, n, r) {
|
|
|
2603
2603
|
let r = $(e, t, a.targetCitation);
|
|
2604
2604
|
return {
|
|
2605
2605
|
kind: "rewrite_portion",
|
|
2606
|
-
...
|
|
2606
|
+
...X(o),
|
|
2607
2607
|
target: c,
|
|
2608
2608
|
...r === void 0 ? {} : {
|
|
2609
2609
|
targetCitation: r,
|
|
@@ -2620,7 +2620,7 @@ function xi(e, t, n, r) {
|
|
|
2620
2620
|
let n = $(e, t, a.replacementCitation), r = $(e, t, a.targetCitation);
|
|
2621
2621
|
return !n || !r ? null : {
|
|
2622
2622
|
kind: "replace",
|
|
2623
|
-
...
|
|
2623
|
+
...X(o),
|
|
2624
2624
|
target: c,
|
|
2625
2625
|
targetCitation: r,
|
|
2626
2626
|
targetText: r.text,
|
|
@@ -2634,7 +2634,7 @@ function xi(e, t, n, r) {
|
|
|
2634
2634
|
let n = $(e, t, a.insertCitation);
|
|
2635
2635
|
return n ? {
|
|
2636
2636
|
kind: "insert_article_after",
|
|
2637
|
-
...
|
|
2637
|
+
...X(o),
|
|
2638
2638
|
target: c,
|
|
2639
2639
|
insertCitation: n,
|
|
2640
2640
|
insertText: n.text
|
|
@@ -2644,7 +2644,7 @@ function xi(e, t, n, r) {
|
|
|
2644
2644
|
let n = $(e, t, a.insertCitation);
|
|
2645
2645
|
return n ? {
|
|
2646
2646
|
kind: "insert_article_before",
|
|
2647
|
-
...
|
|
2647
|
+
...X(o),
|
|
2648
2648
|
target: c,
|
|
2649
2649
|
insertCitation: n,
|
|
2650
2650
|
insertText: n.text
|
|
@@ -2656,7 +2656,7 @@ function xi(e, t, n, r) {
|
|
|
2656
2656
|
let r = $(e, t, a.targetCitation);
|
|
2657
2657
|
return {
|
|
2658
2658
|
kind: a.kind,
|
|
2659
|
-
...
|
|
2659
|
+
...X(o),
|
|
2660
2660
|
target: c,
|
|
2661
2661
|
...r === void 0 ? {} : {
|
|
2662
2662
|
targetCitation: r,
|
|
@@ -2674,11 +2674,11 @@ function xi(e, t, n, r) {
|
|
|
2674
2674
|
function Si(e, t) {
|
|
2675
2675
|
let n = [], r = 0, i = 0;
|
|
2676
2676
|
function a(r) {
|
|
2677
|
-
let a =
|
|
2677
|
+
let a = ri(e, {
|
|
2678
2678
|
start: i,
|
|
2679
2679
|
stop: r
|
|
2680
2680
|
});
|
|
2681
|
-
a !== null && n.push(
|
|
2681
|
+
a !== null && n.push(Z(e, t, a));
|
|
2682
2682
|
}
|
|
2683
2683
|
function o(t) {
|
|
2684
2684
|
let n = Math.max(e.lastIndexOf("\n", t - 1), e.lastIndexOf("\r", t - 1));
|
|
@@ -2709,7 +2709,7 @@ function Si(e, t) {
|
|
|
2709
2709
|
return a(e.length), n;
|
|
2710
2710
|
}
|
|
2711
2711
|
function Ci(e) {
|
|
2712
|
-
let t = li(e), n = t?.dispositif ?? null, r =
|
|
2712
|
+
let t = li(e), n = t?.dispositif ?? null, r = ci(n), i = [], a = [], o = oi(e);
|
|
2713
2713
|
if (e.sourceFormat === "senat-ameli" && e.sourceKind === "S") return i.push({
|
|
2714
2714
|
code: "unsupported_sub_amendment",
|
|
2715
2715
|
message: "Les sous-amendements ne sont pas encore projetés."
|
|
@@ -2747,14 +2747,14 @@ function Ci(e) {
|
|
|
2747
2747
|
}
|
|
2748
2748
|
a.length === 0 && (o.targetPosition === "after_article" || o.targetPosition === "before_article") && a.push({
|
|
2749
2749
|
kind: o.targetPosition === "before_article" ? "insert_article_before" : "insert_article_after",
|
|
2750
|
-
...
|
|
2750
|
+
...X(n),
|
|
2751
2751
|
target: o,
|
|
2752
2752
|
insertCitation: n,
|
|
2753
2753
|
insertText: n.text
|
|
2754
2754
|
}), a.length === 0 && i.push({
|
|
2755
2755
|
code: "unrecognized_dispositif",
|
|
2756
2756
|
message: "Le dispositif est présent mais aucune directive d'amendement n'a été reconnue.",
|
|
2757
|
-
...
|
|
2757
|
+
...si(n)
|
|
2758
2758
|
});
|
|
2759
2759
|
}
|
|
2760
2760
|
return {
|
|
@@ -2772,7 +2772,7 @@ function wi(e) {
|
|
|
2772
2772
|
return e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim();
|
|
2773
2773
|
}
|
|
2774
2774
|
function Ti(e) {
|
|
2775
|
-
let t =
|
|
2775
|
+
let t = k(e);
|
|
2776
2776
|
if (!t) return {
|
|
2777
2777
|
articleNumber: null,
|
|
2778
2778
|
label: e,
|
|
@@ -2786,7 +2786,7 @@ function Ti(e) {
|
|
|
2786
2786
|
};
|
|
2787
2787
|
}
|
|
2788
2788
|
function Ei(e) {
|
|
2789
|
-
let t =
|
|
2789
|
+
let t = _(e), n = [], r = wi(t("section.akn-preamble").text());
|
|
2790
2790
|
return r && n.push({
|
|
2791
2791
|
anchor: "senat-expose-des-motifs",
|
|
2792
2792
|
articleNumber: null,
|
|
@@ -22015,7 +22015,7 @@ function Xi(e) {
|
|
|
22015
22015
|
return null;
|
|
22016
22016
|
}
|
|
22017
22017
|
function Zi(e, t = {}) {
|
|
22018
|
-
let { keepAlignment: n = !0, removeEmptyParagraphs: r = !0, strictAlineas: i = !1 } = t, a =
|
|
22018
|
+
let { keepAlignment: n = !0, removeEmptyParagraphs: r = !0, strictAlineas: i = !1 } = t, a = _(e, { xml: { decodeEntities: !1 } });
|
|
22019
22019
|
a("style, script, meta, link").remove(), a(".assnatHeader, .assnatFooter, .assnatHeaderLeft, .assnatHeaderandFooter").remove(), a(".assnatFARSautApres, .assnatFARSautAvant, .assnatFARSautPageNiv0, .assnatFARSautPageNiv1, .assnatFARSautPageNiv1PG").remove(), a(".assnatFARTT08Bleu").each((e, t) => {
|
|
22020
22020
|
let n = a(t).closest("table");
|
|
22021
22021
|
n.length > 0 && n.remove();
|
|
@@ -22305,13 +22305,13 @@ function ia(e, t, n = "1") {
|
|
|
22305
22305
|
//#endregion
|
|
22306
22306
|
//#region src/lib/server/linkers/html.ts
|
|
22307
22307
|
async function aa({ 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 }) {
|
|
22308
|
-
let _ = t ?? (e === void 0 ? void 0 : new
|
|
22308
|
+
let _ = t ?? (e === void 0 ? void 0 : new ce(e));
|
|
22309
22309
|
if (_ === void 0) throw Error("A Canutes database or legal resolver is required");
|
|
22310
22310
|
let v = await M.readFile(i, { encoding: "utf-8" }), y;
|
|
22311
|
-
a === void 0 ? (y =
|
|
22311
|
+
a === void 0 ? (y = ge({ removeAWithHref: !0 })(v), o !== void 0 && ia(y, o)) : y = na(v, a);
|
|
22312
22312
|
let b = [];
|
|
22313
22313
|
s !== void 0 && b.push("links"), c !== void 0 && b.push("links_or_references"), u !== void 0 && b.push("references");
|
|
22314
|
-
let { outputByType:
|
|
22314
|
+
let { outputByType: ee, referredLegifranceTextCountByCid: x } = await oe({
|
|
22315
22315
|
legiResolver: _,
|
|
22316
22316
|
date: n,
|
|
22317
22317
|
defaultTextId: r,
|
|
@@ -22324,13 +22324,13 @@ async function aa({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, ht
|
|
|
22324
22324
|
logReferences: h,
|
|
22325
22325
|
outputTypes: b,
|
|
22326
22326
|
referredLegifranceTextsInfos: g !== void 0
|
|
22327
|
-
}),
|
|
22328
|
-
s !== void 0 && (
|
|
22329
|
-
for (let [e, t] of Object.entries(
|
|
22330
|
-
let n =
|
|
22327
|
+
}), S = {};
|
|
22328
|
+
s !== void 0 && (S.links = s), c !== void 0 && (S.links_or_references = c), u !== void 0 && (S.references = u);
|
|
22329
|
+
for (let [e, t] of Object.entries(ee)) {
|
|
22330
|
+
let n = S[e];
|
|
22331
22331
|
n !== void 0 && await M.writeFile(n, t.html, { encoding: "utf-8" });
|
|
22332
22332
|
}
|
|
22333
|
-
|
|
22333
|
+
ee.links !== void 0 && l !== void 0 && ia(ge()(ee.links.html), l), g !== void 0 && await M.writeJson(g, x, {
|
|
22334
22334
|
encoding: "utf-8",
|
|
22335
22335
|
spaces: 2
|
|
22336
22336
|
});
|
|
@@ -22338,8 +22338,8 @@ async function aa({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, ht
|
|
|
22338
22338
|
//#endregion
|
|
22339
22339
|
//#region src/lib/server/tables_of_contents.ts
|
|
22340
22340
|
async function oa(e, t, n, r) {
|
|
22341
|
-
let i = na(await M.readFile(e, { encoding: "utf-8" }), t), a = i.output, o = new
|
|
22342
|
-
for await (let e of
|
|
22341
|
+
let i = na(await M.readFile(e, { encoding: "utf-8" }), t), a = i.output, o = new w(a), s = await M.readJson(n, { encoding: "utf-8" });
|
|
22342
|
+
for await (let e of ie({
|
|
22343
22343
|
context: o,
|
|
22344
22344
|
tableOfContents: s,
|
|
22345
22345
|
transformation: i
|
|
@@ -22350,7 +22350,7 @@ async function oa(e, t, n, r) {
|
|
|
22350
22350
|
});
|
|
22351
22351
|
}
|
|
22352
22352
|
async function sa(e, t, n) {
|
|
22353
|
-
let r = na(await M.readFile(e, { encoding: "utf-8" }), t).output, i =
|
|
22353
|
+
let r = na(await M.readFile(e, { encoding: "utf-8" }), t).output, i = y(r);
|
|
22354
22354
|
await M.writeJson(n, i, {
|
|
22355
22355
|
encoding: "utf-8",
|
|
22356
22356
|
spaces: 2
|
|
@@ -22359,32 +22359,32 @@ async function sa(e, t, n) {
|
|
|
22359
22359
|
//#endregion
|
|
22360
22360
|
//#region src/lib/server/legi/resolvers.ts
|
|
22361
22361
|
function ca({ canutesDb: e }) {
|
|
22362
|
-
return new
|
|
22362
|
+
return new ce(e);
|
|
22363
22363
|
}
|
|
22364
22364
|
//#endregion
|
|
22365
22365
|
//#region src/lib/server/jurisprudence_citations.ts
|
|
22366
|
-
async function la({ document: e, resolve:
|
|
22367
|
-
let
|
|
22368
|
-
a.textTitlesInfos =
|
|
22369
|
-
for (let
|
|
22370
|
-
let
|
|
22371
|
-
if (!("position" in
|
|
22372
|
-
let s = e.texte.slice(
|
|
22366
|
+
async function la({ document: e, resolve: t, textTitlesInfos: n }) {
|
|
22367
|
+
let r = [], a = new w(e.texte);
|
|
22368
|
+
a.textTitlesInfos = n;
|
|
22369
|
+
for (let n of i(a)) {
|
|
22370
|
+
let i = [...C(n)], a = i.filter((e) => e.type === "texte" && e.nature === "CODE" && e.cid !== void 0), o = i.filter((e) => e.type === "article");
|
|
22371
|
+
if (!("position" in n) || n.position === void 0 || o.length === 0) continue;
|
|
22372
|
+
let s = e.texte.slice(n.position.start, n.position.stop);
|
|
22373
22373
|
for (let c of o) {
|
|
22374
|
-
let l = a.length === 1 && c.num ? await
|
|
22374
|
+
let l = a.length === 1 && c.num ? await t({
|
|
22375
22375
|
codeId: a[0].cid,
|
|
22376
22376
|
numero: c.num
|
|
22377
22377
|
}) : [], u = [...new Set(l)];
|
|
22378
|
-
|
|
22378
|
+
r.push({
|
|
22379
22379
|
mention: s,
|
|
22380
22380
|
position: {
|
|
22381
|
-
start:
|
|
22382
|
-
stop:
|
|
22381
|
+
start: n.position.start,
|
|
22382
|
+
stop: n.position.stop
|
|
22383
22383
|
},
|
|
22384
22384
|
passage: e.texte,
|
|
22385
|
-
articleId: l.length === 1 && o.length === 1 &&
|
|
22385
|
+
articleId: l.length === 1 && o.length === 1 && i.length === 2 ? l[0] : null,
|
|
22386
22386
|
candidats: u,
|
|
22387
|
-
selectionPossible: o.length === 1 &&
|
|
22387
|
+
selectionPossible: o.length === 1 && i.length === 2 && a.length === 1,
|
|
22388
22388
|
redaction: "indéterminée",
|
|
22389
22389
|
origine: "indéterminée",
|
|
22390
22390
|
relation: "citation"
|
|
@@ -22393,7 +22393,7 @@ async function la({ document: e, resolve: n, textTitlesInfos: r }) {
|
|
|
22393
22393
|
}
|
|
22394
22394
|
return {
|
|
22395
22395
|
document: e,
|
|
22396
|
-
citations:
|
|
22396
|
+
citations: r,
|
|
22397
22397
|
perimetre: "citations explicites d'articles de code"
|
|
22398
22398
|
};
|
|
22399
22399
|
}
|
|
@@ -22401,7 +22401,7 @@ async function la({ document: e, resolve: n, textTitlesInfos: r }) {
|
|
|
22401
22401
|
//#region src/lib/server/legifrance_article_search.ts
|
|
22402
22402
|
function ua(e) {
|
|
22403
22403
|
if (!e) return "";
|
|
22404
|
-
let t =
|
|
22404
|
+
let t = _(e);
|
|
22405
22405
|
return t("script, style").remove(), t.text().replace(/\u00a0/g, " ").replace(/\s+/g, " ").trim();
|
|
22406
22406
|
}
|
|
22407
22407
|
//#endregion
|
|
@@ -22477,14 +22477,14 @@ function ya(e) {
|
|
|
22477
22477
|
async function ba(e, t, n) {
|
|
22478
22478
|
let r = n ? Array.isArray(n) ? n : [n] : [];
|
|
22479
22479
|
if (r.some((e) => !e || typeof e.dateReference != "string" || !ya(e.dateReference) || typeof e.articleId != "string" || !e.articleId.trim() || Array.isArray(n) && !e.reference || e.reference && (e.reference.dataset !== "JADE" || typeof e.reference.path != "string" || typeof e.reference.revision != "string" || typeof e.reference.mention != "string" || !e.reference.position || !Number.isSafeInteger(e.reference.position.start) || !Number.isSafeInteger(e.reference.position.stop)))) throw Error("Sélection d'article invalide");
|
|
22480
|
-
return
|
|
22480
|
+
return g(e, async (e) => {
|
|
22481
22481
|
let i = await e`
|
|
22482
22482
|
SELECT dataset, path, id, juridiction, date_dec::text AS "dateDec", titre, data
|
|
22483
22483
|
FROM legifrance.jurisprudence WHERE dataset = 'JADE' AND path = ${t}
|
|
22484
22484
|
`;
|
|
22485
22485
|
if (i.length === 0) throw new ha("Représentation JADE absente");
|
|
22486
22486
|
if (i.length !== 1) throw new ha("Représentation JADE ambiguë");
|
|
22487
|
-
let a = i[0], o = await
|
|
22487
|
+
let a = i[0], o = await h(e), s = await be(o), c = /* @__PURE__ */ new Set(), l = va(e), u = await xa(a, async (e) => {
|
|
22488
22488
|
let t = await l(e);
|
|
22489
22489
|
return t.forEach((e) => c.add(e)), t;
|
|
22490
22490
|
}, s);
|
|
@@ -22514,13 +22514,13 @@ async function ba(e, t, n) {
|
|
|
22514
22514
|
}
|
|
22515
22515
|
let p = [...c].sort(), m = p.length === 0 ? [] : await e`
|
|
22516
22516
|
SELECT id, num, data FROM legifrance.article WHERE id = ANY(${e.array(p)}) ORDER BY id
|
|
22517
|
-
`,
|
|
22518
|
-
titles: o.map(
|
|
22517
|
+
`, g = (e) => JSON.stringify(e, (e, t) => typeof t == "object" && t && !Array.isArray(t) ? Object.fromEntries(Object.entries(t).sort(([e], [t]) => e.localeCompare(t))) : t), _ = j("sha256").update(g({
|
|
22518
|
+
titles: o.map(g).sort(),
|
|
22519
22519
|
articles: m
|
|
22520
22520
|
})).digest("hex");
|
|
22521
22521
|
return {
|
|
22522
22522
|
...u,
|
|
22523
|
-
referenceRevision:
|
|
22523
|
+
referenceRevision: _,
|
|
22524
22524
|
...n ? { selection: n } : {}
|
|
22525
22525
|
};
|
|
22526
22526
|
});
|
|
@@ -22556,7 +22556,7 @@ async function Ca(e, t, n = {}) {
|
|
|
22556
22556
|
};
|
|
22557
22557
|
},
|
|
22558
22558
|
async consultDecision(t) {
|
|
22559
|
-
return
|
|
22559
|
+
return g(e, async (e) => {
|
|
22560
22560
|
let [n] = await e`
|
|
22561
22561
|
SELECT extraction, traite_le::text AS "traiteLe" FROM ${a} WHERE path = ${t}`;
|
|
22562
22562
|
return n ? {
|
|
@@ -22569,7 +22569,7 @@ async function Ca(e, t, n = {}) {
|
|
|
22569
22569
|
});
|
|
22570
22570
|
},
|
|
22571
22571
|
async consultArticle(t) {
|
|
22572
|
-
return
|
|
22572
|
+
return g(e, async (e) => {
|
|
22573
22573
|
if ((await e`
|
|
22574
22574
|
SELECT path FROM ${a} ORDER BY path LIMIT ${i + 1}`).length > i) throw Error(`Consultation JADE indisponible : limite de ${i} extractions dépassée`);
|
|
22575
22575
|
let n = await e`
|
|
@@ -22593,7 +22593,7 @@ async function Ca(e, t, n = {}) {
|
|
|
22593
22593
|
});
|
|
22594
22594
|
},
|
|
22595
22595
|
async byDecision(t) {
|
|
22596
|
-
return
|
|
22596
|
+
return g(e, async (e) => {
|
|
22597
22597
|
let [n] = await e`
|
|
22598
22598
|
SELECT extraction, traite_le::text AS "traiteLe" FROM ${a} WHERE path = ${t}`;
|
|
22599
22599
|
return n ? {
|
|
@@ -22603,7 +22603,7 @@ async function Ca(e, t, n = {}) {
|
|
|
22603
22603
|
});
|
|
22604
22604
|
},
|
|
22605
22605
|
async byArticle(t) {
|
|
22606
|
-
return
|
|
22606
|
+
return g(e, async (e) => {
|
|
22607
22607
|
let n = await e`
|
|
22608
22608
|
SELECT path, extraction, traite_le::text AS "traiteLe" FROM ${a} ORDER BY path`, r = [];
|
|
22609
22609
|
for (let e of n) e.extraction.citations.some((e) => e.articleId === t) && r.push({
|
|
@@ -22666,4 +22666,4 @@ async function Ta(e, t, n = {}) {
|
|
|
22666
22666
|
};
|
|
22667
22667
|
}
|
|
22668
22668
|
//#endregion
|
|
22669
|
-
export {
|
|
22669
|
+
export { Ee as LegiResolver, aa as addLinksOrReferencesToHtmlFile, oa as addPositionsToTableOfContentsFile, xe as buildAndInstallTextTitlesInfos, be as buildTextTitlesInfos, Ta as createJurisprudenceConsultation, Ca as createJurisprudenceStore, ca as createLegiResolver, Fe as extractAssembleeAmendmentSearchItems, yr as extractAssembleeExposesDesMotifs, wr as extractSenatAmendmentSearchItems, Ie as hashAssembleeAmendmentSearchItem, xr as hashAssembleeSearchItem, Tr as hashSenatAmendmentSearchItem, Di as hashSenatSearchItem, Sa as initializeJurisprudenceStore, Ni as isAkomaNtosoXml, Sr as isoDateFromAssembleeDocument, hr as linkAkomaNtosoBillRaw, Cn as linkAssembleeBillRaw, mr as parseAkomaNtosoBillRaw, Ci as parseAmendment, Sn as parseAssembleeBillRaw, br as parseAssembleeDocumentSearchContent, Ei as parseSenatDocumentSearchContent, na as readTransformation, ur as renderAkomaNtosoBillRaw, Mi as resolveSenatAkomaNtosoSource, sa as simplifiedHtmlBillFileToTableOfContentsFile, Zi as simplifyWordHtml, ta as simplifyWordHtmlToDocument, ia as writeTransformation };
|