@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
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { createHash as e } from "node:crypto";
|
|
1
2
|
//#region ../../node_modules/@tricoteuses/legifrance/dist/numbers.js
|
|
2
|
-
var
|
|
3
|
+
var t = [
|
|
3
4
|
[],
|
|
4
5
|
["un"],
|
|
5
6
|
["du"],
|
|
@@ -10,7 +11,7 @@ var e = [
|
|
|
10
11
|
["sept"],
|
|
11
12
|
["oct"],
|
|
12
13
|
["nov"]
|
|
13
|
-
],
|
|
14
|
+
], n = [
|
|
14
15
|
[],
|
|
15
16
|
["decies"],
|
|
16
17
|
["vicies", "vecies"],
|
|
@@ -21,7 +22,7 @@ var e = [
|
|
|
21
22
|
["septuagies"],
|
|
22
23
|
["octogies"],
|
|
23
24
|
["nonagies"]
|
|
24
|
-
],
|
|
25
|
+
], r = [
|
|
25
26
|
[],
|
|
26
27
|
["semel"],
|
|
27
28
|
["bis"],
|
|
@@ -32,7 +33,7 @@ var e = [
|
|
|
32
33
|
["septies"],
|
|
33
34
|
["octies"],
|
|
34
35
|
["nonies", "novies"]
|
|
35
|
-
],
|
|
36
|
+
], i = [
|
|
36
37
|
1e3,
|
|
37
38
|
"M",
|
|
38
39
|
900,
|
|
@@ -59,7 +60,7 @@ var e = [
|
|
|
59
60
|
"IV",
|
|
60
61
|
1,
|
|
61
62
|
"I"
|
|
62
|
-
],
|
|
63
|
+
], a = [
|
|
63
64
|
"dix",
|
|
64
65
|
"onze",
|
|
65
66
|
"douze",
|
|
@@ -70,7 +71,7 @@ var e = [
|
|
|
70
71
|
"dix-sept",
|
|
71
72
|
"dix-huit",
|
|
72
73
|
"dix-neuf"
|
|
73
|
-
],
|
|
74
|
+
], o = [
|
|
74
75
|
"",
|
|
75
76
|
"dix",
|
|
76
77
|
"vingt",
|
|
@@ -81,7 +82,7 @@ var e = [
|
|
|
81
82
|
"soixante-dix",
|
|
82
83
|
"quatre-vingt",
|
|
83
84
|
"quatre-vingt-dix"
|
|
84
|
-
],
|
|
85
|
+
], s = [
|
|
85
86
|
"",
|
|
86
87
|
"un",
|
|
87
88
|
"deux",
|
|
@@ -93,89 +94,97 @@ var e = [
|
|
|
93
94
|
"huit",
|
|
94
95
|
"neuf"
|
|
95
96
|
];
|
|
96
|
-
function
|
|
97
|
+
function c(e) {
|
|
97
98
|
if (!(e < 0)) {
|
|
98
99
|
if (e === 0) return "zéro";
|
|
99
|
-
if (e < 10) return
|
|
100
|
-
if (e < 20) return
|
|
100
|
+
if (e < 10) return s[e];
|
|
101
|
+
if (e < 20) return a[e - 10];
|
|
101
102
|
if (e < 100) {
|
|
102
103
|
let t = Math.floor(e / 10), n = e % 10;
|
|
103
|
-
if (t === 7) return `soixante-${
|
|
104
|
-
if (t === 9) return `quatre-vingt-${
|
|
105
|
-
let r =
|
|
106
|
-
return n === 0 ? r : n === 1 && t !== 8 ? `${r} et ${
|
|
104
|
+
if (t === 7) return `soixante-${a[n]}`;
|
|
105
|
+
if (t === 9) return `quatre-vingt-${a[n]}`;
|
|
106
|
+
let r = o[t];
|
|
107
|
+
return n === 0 ? r : n === 1 && t !== 8 ? `${r} et ${s[n]}` : r + `-${s[n]}`;
|
|
107
108
|
}
|
|
108
109
|
if (e < 1e3) {
|
|
109
|
-
let t = Math.floor(e / 100), n = e % 100, r = t === 1 ? "cent" : `${
|
|
110
|
-
return n === 0 ? r : (t > 1 && n > 0 && (r = r.slice(0, -1)), `${r} ${
|
|
110
|
+
let t = Math.floor(e / 100), n = e % 100, r = t === 1 ? "cent" : `${s[t]} cents`;
|
|
111
|
+
return n === 0 ? r : (t > 1 && n > 0 && (r = r.slice(0, -1)), `${r} ${c(n)}`);
|
|
111
112
|
}
|
|
112
113
|
if (e < 1e6) {
|
|
113
|
-
let t = Math.floor(e / 1e3), n = e % 1e3, r = t === 1 ? "mille" : `${
|
|
114
|
-
return n === 0 ? r : r + ` ${
|
|
114
|
+
let t = Math.floor(e / 1e3), n = e % 1e3, r = t === 1 ? "mille" : `${c(t)} mille`;
|
|
115
|
+
return n === 0 ? r : r + ` ${c(n)}`;
|
|
115
116
|
}
|
|
116
117
|
throw Error("Number must be a less than one million.");
|
|
117
118
|
}
|
|
118
119
|
}
|
|
119
|
-
function*
|
|
120
|
+
function* l(e) {
|
|
120
121
|
e === 1 && (yield "premier", yield "première", yield "unique", yield "Ier", yield "Ière", yield "1er", yield "1ère");
|
|
121
|
-
let t =
|
|
122
|
+
let t = c(e);
|
|
122
123
|
t !== void 0 && (yield t);
|
|
123
|
-
let n =
|
|
124
|
+
let n = m(e);
|
|
124
125
|
n !== void 0 && (yield n), yield e.toString();
|
|
125
126
|
}
|
|
126
|
-
function*
|
|
127
|
-
if (!(
|
|
128
|
-
else if (
|
|
129
|
-
let
|
|
130
|
-
for (let
|
|
127
|
+
function* u(e) {
|
|
128
|
+
if (!(e <= 0)) if (e < 10) yield* r[e];
|
|
129
|
+
else if (e < 100) {
|
|
130
|
+
let r = Math.floor(e / 10), i = e % 10;
|
|
131
|
+
for (let e of n[r]) for (let n of t[i]) yield `${n}${[
|
|
131
132
|
2,
|
|
132
133
|
8,
|
|
133
134
|
9
|
|
134
|
-
].includes(i) &&
|
|
135
|
-
if (
|
|
136
|
-
let e =
|
|
135
|
+
].includes(i) && e[0] !== "o" ? "o" : ""}${e}`;
|
|
136
|
+
if (r < 9 && [8, 9].includes(i)) {
|
|
137
|
+
let e = n[r + 1];
|
|
137
138
|
for (let t of e) yield `${i === 8 ? "duo" : "un"}${t[0] === "o" ? "d" : "de"}${t}`;
|
|
138
139
|
}
|
|
139
140
|
} else throw Error("Number must be a less than 100.");
|
|
140
141
|
}
|
|
141
|
-
function*
|
|
142
|
+
function* d(e) {
|
|
142
143
|
if (e === 1) yield "premier", yield "première", yield "Ier", yield "Ière", yield "1er", yield "1ère";
|
|
143
144
|
else {
|
|
144
|
-
let t =
|
|
145
|
+
let t = p(e);
|
|
145
146
|
t !== void 0 && (yield t);
|
|
146
|
-
let n =
|
|
147
|
+
let n = m(e);
|
|
147
148
|
n !== void 0 && (yield `${n}e`, yield `${n}ème`), e > 0 && (yield `${e}e`, yield `${e}ème`), e === 2 && (yield "second", yield "seconde", yield "2nd", yield "2nde");
|
|
148
149
|
}
|
|
149
150
|
}
|
|
150
|
-
function
|
|
151
|
+
function f(e) {
|
|
151
152
|
e = e.toUpperCase();
|
|
152
153
|
let t = 0, n = 0;
|
|
153
|
-
for (let
|
|
154
|
+
for (let r = 0; r < i.length; r += 2) for (; e.substring(t, t + i[r + 1].length) === i[r + 1];) n += i[r], t += i[r + 1].length;
|
|
154
155
|
return n;
|
|
155
156
|
}
|
|
156
|
-
function
|
|
157
|
+
function p(e) {
|
|
157
158
|
if (e <= 0) return;
|
|
158
159
|
if (e === 1) return "premier";
|
|
159
|
-
let t =
|
|
160
|
+
let t = c(e);
|
|
160
161
|
if (t === void 0) return;
|
|
161
162
|
let n = t.match(/(^| )([^ ]+)$/)[2];
|
|
162
163
|
return n === "un" ? t.slice(0, -2) + "unième" : n === "cinq" ? t.slice(0, -4) + "cinquième" : n === "neuf" ? t.slice(0, -3) + "euvième" : n.endsWith("e") ? t.slice(0, -1) + "ième" : t + "ième";
|
|
163
164
|
}
|
|
164
|
-
function
|
|
165
|
+
function m(e) {
|
|
165
166
|
if (e < 0) return;
|
|
166
167
|
if (e === 0) return "0I";
|
|
167
168
|
let t = "";
|
|
168
|
-
for (let n = 0; n <
|
|
169
|
+
for (let n = 0; n < i.length; n += 2) for (; e >= i[n];) t += i[n + 1], e -= i[n];
|
|
169
170
|
return t;
|
|
170
171
|
}
|
|
171
172
|
//#endregion
|
|
173
|
+
//#region ../../node_modules/@tricoteuses/legifrance/dist/legal/ids.js
|
|
174
|
+
var h = /^(CNIL|JORF|KALI|LEGI)(ARTI|CONT|DOLE|SCTA|TEXT)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)$/;
|
|
175
|
+
function g(e, t) {
|
|
176
|
+
let n = e.match(h);
|
|
177
|
+
if (n === null) throw Error(`Unknown ID format: ${e}`);
|
|
178
|
+
return `${n.slice(1, -1).join("/")}/${e}${t}`;
|
|
179
|
+
}
|
|
180
|
+
//#endregion
|
|
172
181
|
//#region src/lib/asserts.ts
|
|
173
|
-
function
|
|
182
|
+
function _(e, t) {
|
|
174
183
|
throw `Unexpected type ${e}: ${t}`;
|
|
175
184
|
}
|
|
176
185
|
//#endregion
|
|
177
186
|
//#region src/lib/text_parsers/parsers.ts
|
|
178
|
-
var
|
|
187
|
+
var v = class {
|
|
179
188
|
input;
|
|
180
189
|
offset;
|
|
181
190
|
ignoreReferenceRepetitionQualifiers = !1;
|
|
@@ -201,19 +210,19 @@ var h = class {
|
|
|
201
210
|
return e === void 0 ? this.input.slice(this.offset, this.offset + this.length) : this.input.slice(e.start, e.stop);
|
|
202
211
|
}
|
|
203
212
|
textFromResults(e) {
|
|
204
|
-
return e === void 0 ? "" :
|
|
213
|
+
return e === void 0 ? "" : re(e);
|
|
205
214
|
}
|
|
206
|
-
},
|
|
215
|
+
}, y = (...e) => (t) => {
|
|
207
216
|
for (let n of e) {
|
|
208
|
-
let e = (Array.isArray(n) ?
|
|
217
|
+
let e = (Array.isArray(n) ? b(n, { exportVariables: !0 }) : n)(t);
|
|
209
218
|
if (e !== void 0) return e;
|
|
210
219
|
}
|
|
211
|
-
},
|
|
220
|
+
}, b = (e, { exportVariables: t, value: n } = {}) => (r) => {
|
|
212
221
|
let i = r.offset, a = r.variables;
|
|
213
222
|
r.variables = { ...a };
|
|
214
223
|
let o = [], s = [];
|
|
215
224
|
for (let n of e) {
|
|
216
|
-
let e = (Array.isArray(n) ?
|
|
225
|
+
let e = (Array.isArray(n) ? b(n, { exportVariables: t }) : n)(r);
|
|
217
226
|
if (e === void 0) {
|
|
218
227
|
r.length = 0, r.offset = i, r.usedInputs = void 0, r.variables = a;
|
|
219
228
|
return;
|
|
@@ -232,10 +241,10 @@ var h = class {
|
|
|
232
241
|
c = e;
|
|
233
242
|
} else c = n;
|
|
234
243
|
return r.offset += r.length, r.length = 0, t || (r.variables = a), c;
|
|
235
|
-
},
|
|
244
|
+
}, x = (e, { value: t }) => (n) => {
|
|
236
245
|
let r = n.offset, i = n.variables;
|
|
237
246
|
n.variables = { ...i };
|
|
238
|
-
let a = (Array.isArray(e) ?
|
|
247
|
+
let a = (Array.isArray(e) ? b(e, { exportVariables: !0 }) : e)(n);
|
|
239
248
|
if (a !== void 0) {
|
|
240
249
|
if (n.length = n.offset - r, n.offset -= n.length, typeof t == "function") {
|
|
241
250
|
let e = t(a, n);
|
|
@@ -247,10 +256,10 @@ var h = class {
|
|
|
247
256
|
}
|
|
248
257
|
return n.offset += n.length, n.length = 0, t;
|
|
249
258
|
}
|
|
250
|
-
},
|
|
259
|
+
}, ee = (e, t, n = 80, r) => {
|
|
251
260
|
let i = new RegExp(e, "i"), a = (e) => {
|
|
252
261
|
let r = e.input.slice(e.offset, e.offset + n);
|
|
253
|
-
if (i.test(r)) return (Array.isArray(t) ?
|
|
262
|
+
if (i.test(r)) return (Array.isArray(t) ? b(t, { exportVariables: !0 }) : t)(e);
|
|
254
263
|
};
|
|
255
264
|
return a.extract = function* (t, i) {
|
|
256
265
|
let o = new RegExp(r ?? e, i?.globalRegExpFlags ?? "gimv"), s = -1, c = "";
|
|
@@ -292,12 +301,12 @@ var h = class {
|
|
|
292
301
|
}
|
|
293
302
|
}
|
|
294
303
|
}, a;
|
|
295
|
-
},
|
|
304
|
+
}, te = (e, { lookbackLength: t = 50, value: n } = {}) => (r) => {
|
|
296
305
|
let i = Math.max(0, r.offset - t);
|
|
297
306
|
for (let t = r.offset; t >= i; t--) {
|
|
298
|
-
let i = new
|
|
307
|
+
let i = new v(r.input, t);
|
|
299
308
|
i.variables = { ...r.variables }, i.currentArticle = r.currentArticle, i.currentText = r.currentText, i.textTitlesInfos = r.textTitlesInfos;
|
|
300
|
-
let a = (Array.isArray(e) ?
|
|
309
|
+
let a = (Array.isArray(e) ? b(e, { exportVariables: !0 }) : e)(i);
|
|
301
310
|
if (a !== void 0 && i.offset === r.offset) {
|
|
302
311
|
let e = a;
|
|
303
312
|
if (n !== void 0) if (typeof n == "function") {
|
|
@@ -308,8 +317,8 @@ var h = class {
|
|
|
308
317
|
return r.variables = i.variables, r.length = 0, r.usedInputs = void 0, e;
|
|
309
318
|
}
|
|
310
319
|
}
|
|
311
|
-
},
|
|
312
|
-
let i = (Array.isArray(e) ?
|
|
320
|
+
}, S = (e, { default: t, value: n }) => (r) => {
|
|
321
|
+
let i = (Array.isArray(e) ? b(e, { exportVariables: !0 }) : e)(r);
|
|
313
322
|
if (i === void 0) i = typeof t == "function" ? t(r) : t;
|
|
314
323
|
else if (n !== void 0) if (typeof n == "function") {
|
|
315
324
|
let e = n(i, r);
|
|
@@ -320,7 +329,7 @@ var h = class {
|
|
|
320
329
|
i = e;
|
|
321
330
|
} else i = n;
|
|
322
331
|
return i;
|
|
323
|
-
},
|
|
332
|
+
}, ne = (e, t) => (Array.isArray(t) ? b(t) : t)(new v(e)), C = (e, { flags: t, value: n } = {}) => {
|
|
324
333
|
let r = new RegExp(e, "gy" + (t ?? ""));
|
|
325
334
|
return (e) => {
|
|
326
335
|
r.lastIndex = e.offset;
|
|
@@ -339,12 +348,12 @@ var h = class {
|
|
|
339
348
|
} else i = n;
|
|
340
349
|
return e.offset += e.length, e.length = 0, i;
|
|
341
350
|
};
|
|
342
|
-
},
|
|
351
|
+
}, w = (e, { max: t, min: n, separator: r, value: i } = {}) => (a) => {
|
|
343
352
|
let o = a.offset, s = a.variables;
|
|
344
353
|
a.variables = { ...s };
|
|
345
354
|
let c = [], l = [], u = 0;
|
|
346
355
|
for (; t === void 0 || u < t; u++) {
|
|
347
|
-
let t = (u === 0 || r === void 0 ? Array.isArray(e) ?
|
|
356
|
+
let t = (u === 0 || r === void 0 ? Array.isArray(e) ? b(e) : e : b([r, e]))(a);
|
|
348
357
|
if (t === void 0) break;
|
|
349
358
|
a.usedInputs !== void 0 && c.push(a.usedInputs), l.push(t);
|
|
350
359
|
}
|
|
@@ -364,10 +373,10 @@ var h = class {
|
|
|
364
373
|
d = e;
|
|
365
374
|
} else d = i;
|
|
366
375
|
return a.offset += a.length, a.length = 0, d;
|
|
367
|
-
},
|
|
376
|
+
}, re = (e) => e.filter((e) => e !== null).map((e) => typeof e == "string" ? e : re(e)).join(""), T = (e, t, { value: n } = {}) => (r) => {
|
|
368
377
|
let i = r.offset, a = r.variables;
|
|
369
378
|
r.variables = { ...a };
|
|
370
|
-
let o = (Array.isArray(t) ?
|
|
379
|
+
let o = (Array.isArray(t) ? b(t, { exportVariables: !0 }) : t)(r);
|
|
371
380
|
if (o === void 0) {
|
|
372
381
|
delete r.variables[e];
|
|
373
382
|
return;
|
|
@@ -382,10 +391,10 @@ var h = class {
|
|
|
382
391
|
return r.offset += r.length, r.length = 0, r.variables[e] = t, t;
|
|
383
392
|
}
|
|
384
393
|
return r.offset += r.length, r.length = 0, r.variables[e] = n, n;
|
|
385
|
-
},
|
|
394
|
+
}, ie = (e, { value: t } = {}) => (n) => {
|
|
386
395
|
let r = e, i = n.offset, a = /([\-\/\d\p{Alphabetic}'°]+)($|[^\-\/\d\p{Alphabetic}°]{1,10000})/gvy;
|
|
387
396
|
a.lastIndex = n.offset;
|
|
388
|
-
let o = [], s, c = (e) => /^[IVX]+$/g.test(e) ?
|
|
397
|
+
let o = [], s, c = (e) => /^[IVX]+$/g.test(e) ? f(e).toString() : e.toLowerCase().replace(/^no$/, "n°");
|
|
389
398
|
for (;;) {
|
|
390
399
|
let e = a.exec(n.input);
|
|
391
400
|
if (e === null) break;
|
|
@@ -429,142 +438,142 @@ var h = class {
|
|
|
429
438
|
u = e;
|
|
430
439
|
} else u = t;
|
|
431
440
|
return n.offset = i, n.length = 0, u;
|
|
432
|
-
},
|
|
441
|
+
}, ae = C(" ?['’] ?", { value: "'" }), E = C(" "), oe = C(" ?", { value: "" }), se = C("[a-z]", { flags: "i" }), ce = C(String.raw`(?=$|\P{Alphabetic})`, { flags: "iv" }), D = C("n ?[°o] ?", {
|
|
433
442
|
flags: "i",
|
|
434
443
|
value: "n° "
|
|
435
|
-
}),
|
|
444
|
+
}), le = C("-"), ue = C(", ?", { value: ", " }), de = C("(, ?| )", { value: ", " }), O = C("(èm)?e"), fe = y(C("1er", { value: (e, t) => ({
|
|
436
445
|
position: t.position(),
|
|
437
446
|
text: t.text(),
|
|
438
447
|
value: 1
|
|
439
|
-
}) }),
|
|
448
|
+
}) }), C("unique", { value: (e, t) => ({
|
|
440
449
|
position: t.position(),
|
|
441
450
|
text: t.text(),
|
|
442
451
|
value: 1
|
|
443
|
-
}) }),
|
|
452
|
+
}) }), b([C(String.raw`\d+`), S(O, { default: "" })], { value: (e, t) => ({
|
|
444
453
|
position: t.position(),
|
|
445
454
|
text: t.text(),
|
|
446
455
|
value: parseInt(e[0])
|
|
447
|
-
}) })), k =
|
|
456
|
+
}) })), k = C(String.raw`\d+`, { value: (e) => parseInt(e[0]) }), pe = y(C("1er", { value: 1 }), b([C(String.raw`\d+`), O], { value: (e) => parseInt(e[0]) })), me = C(String.raw`[IVXLCDM]+`, { value: (e) => f(e[0]) }), he = y(C("IER|Ier", { value: 1 }), b([C(String.raw`[IVXLCDM]+`), O], { value: (e) => f(e[0]) })), ge = y(C("0I", { value: (e, t) => ({
|
|
448
457
|
position: t.position(),
|
|
449
458
|
text: t.text(),
|
|
450
459
|
value: 0
|
|
451
|
-
}) }),
|
|
460
|
+
}) }), C("IER|Ier", { value: (e, t) => ({
|
|
452
461
|
position: t.position(),
|
|
453
462
|
text: t.text(),
|
|
454
463
|
value: 1
|
|
455
|
-
}) }),
|
|
464
|
+
}) }), b([C(String.raw`[IVXLCDM]+`), S(O, { default: "" })], { value: (e, t) => ({
|
|
456
465
|
position: t.position(),
|
|
457
466
|
text: t.text(),
|
|
458
|
-
value:
|
|
459
|
-
}) })),
|
|
467
|
+
value: f(e[0])
|
|
468
|
+
}) })), _e = y(C("dix", {
|
|
460
469
|
flags: "i",
|
|
461
470
|
value: 10
|
|
462
|
-
}),
|
|
471
|
+
}), C("onze?", {
|
|
463
472
|
flags: "i",
|
|
464
473
|
value: 11
|
|
465
|
-
}),
|
|
474
|
+
}), C("douze?", {
|
|
466
475
|
flags: "i",
|
|
467
476
|
value: 12
|
|
468
|
-
}),
|
|
477
|
+
}), C("treize?", {
|
|
469
478
|
flags: "i",
|
|
470
479
|
value: 13
|
|
471
|
-
}),
|
|
480
|
+
}), C("quatorze?", {
|
|
472
481
|
flags: "i",
|
|
473
482
|
value: 14
|
|
474
|
-
}),
|
|
483
|
+
}), C("quinze?", {
|
|
475
484
|
flags: "i",
|
|
476
485
|
value: 15
|
|
477
|
-
}),
|
|
486
|
+
}), C("seize?", {
|
|
478
487
|
flags: "i",
|
|
479
488
|
value: 16
|
|
480
|
-
})),
|
|
489
|
+
})), ve = y(C("vingt", {
|
|
481
490
|
flags: "i",
|
|
482
491
|
value: 20
|
|
483
|
-
}),
|
|
492
|
+
}), C("trente?", {
|
|
484
493
|
flags: "i",
|
|
485
494
|
value: 30
|
|
486
|
-
}),
|
|
495
|
+
}), C("quarante?", {
|
|
487
496
|
flags: "i",
|
|
488
497
|
value: 40
|
|
489
|
-
}),
|
|
498
|
+
}), C("cinquante?", {
|
|
490
499
|
flags: "i",
|
|
491
500
|
value: 50
|
|
492
|
-
}),
|
|
501
|
+
}), C("soixante?", {
|
|
493
502
|
flags: "i",
|
|
494
503
|
value: 60
|
|
495
|
-
}),
|
|
504
|
+
}), C("septante?", {
|
|
496
505
|
flags: "i",
|
|
497
506
|
value: 70
|
|
498
|
-
}),
|
|
507
|
+
}), C("quatre-vingt", {
|
|
499
508
|
flags: "i",
|
|
500
509
|
value: 80
|
|
501
|
-
}),
|
|
510
|
+
}), C("huitante?", {
|
|
502
511
|
flags: "i",
|
|
503
512
|
value: 80
|
|
504
|
-
}),
|
|
513
|
+
}), C("octante?", {
|
|
505
514
|
flags: "i",
|
|
506
515
|
value: 80
|
|
507
|
-
}),
|
|
516
|
+
}), C("nonante?", {
|
|
508
517
|
flags: "i",
|
|
509
518
|
value: 90
|
|
510
|
-
})),
|
|
519
|
+
})), ye = y(C("une?", {
|
|
511
520
|
flags: "i",
|
|
512
521
|
value: 1
|
|
513
|
-
}),
|
|
522
|
+
}), C("deux", {
|
|
514
523
|
flags: "i",
|
|
515
524
|
value: 2
|
|
516
|
-
}),
|
|
525
|
+
}), C("trois", {
|
|
517
526
|
flags: "i",
|
|
518
527
|
value: 3
|
|
519
|
-
}),
|
|
528
|
+
}), C("quatre?", {
|
|
520
529
|
flags: "i",
|
|
521
530
|
value: 4
|
|
522
|
-
}),
|
|
531
|
+
}), C("cinqu?", {
|
|
523
532
|
flags: "i",
|
|
524
533
|
value: 5
|
|
525
|
-
}),
|
|
534
|
+
}), C("six", {
|
|
526
535
|
flags: "i",
|
|
527
536
|
value: 6
|
|
528
|
-
}),
|
|
537
|
+
}), C("sept", {
|
|
529
538
|
flags: "i",
|
|
530
539
|
value: 7
|
|
531
|
-
}),
|
|
540
|
+
}), C("huit", {
|
|
532
541
|
flags: "i",
|
|
533
542
|
value: 8
|
|
534
|
-
}),
|
|
543
|
+
}), C("neu[fv]", {
|
|
535
544
|
flags: "i",
|
|
536
545
|
value: 9
|
|
537
|
-
})),
|
|
538
|
-
|
|
546
|
+
})), A = b([
|
|
547
|
+
T("centaines", S([T("centaine", S([ye, le], {
|
|
539
548
|
default: 0,
|
|
540
549
|
value: (e) => e[0]
|
|
541
|
-
})),
|
|
550
|
+
})), C("cent-", {
|
|
542
551
|
flags: "i",
|
|
543
552
|
value: 1
|
|
544
553
|
})], {
|
|
545
554
|
default: 0,
|
|
546
555
|
value: (e, { variables: t }) => 100 * t.centaine
|
|
547
556
|
})),
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
], { value: (e, { variables: t }) => t.centaines + t.dizaines + t.dix + t.unite }),
|
|
557
|
+
T("dizaines", S(ve, { default: 0 })),
|
|
558
|
+
S(C("-(et-)?", { flags: "i" }), { default: "" }),
|
|
559
|
+
T("dix", S(_e, { default: 0 })),
|
|
560
|
+
S(le, { default: "" }),
|
|
561
|
+
T("unite", S(ye, { default: 0 }))
|
|
562
|
+
], { value: (e, { variables: t }) => t.centaines + t.dizaines + t.dix + t.unite }), be = y(C("1(er|ère)", {
|
|
554
563
|
flags: "i",
|
|
555
564
|
value: 1
|
|
556
|
-
}),
|
|
565
|
+
}), C("premi(er|ère)", {
|
|
557
566
|
flags: "i",
|
|
558
567
|
value: 1
|
|
559
|
-
}), k,
|
|
568
|
+
}), k, A), j = y(C("premi(er|ère)", {
|
|
560
569
|
flags: "i",
|
|
561
570
|
value: 1
|
|
562
|
-
}),
|
|
571
|
+
}), C("seconde?", {
|
|
563
572
|
flags: "i",
|
|
564
573
|
value: 2
|
|
565
|
-
}),
|
|
566
|
-
function
|
|
567
|
-
let n = new
|
|
574
|
+
}), b([A, C("ième", { flags: "i" })], { value: (e) => e[0] })), xe = y(pe, j), Se = "[0-9]+(?:e|er|ere|ère)?|[A-Za-zÀ-ÖØ-öø-ÿ'’.-]+";
|
|
575
|
+
function Ce(e, t) {
|
|
576
|
+
let n = new v(e), r = t(n);
|
|
568
577
|
if (n.remaining().trim().length > 0) return null;
|
|
569
578
|
if (typeof r == "number") return r;
|
|
570
579
|
if (r && typeof r == "object" && "value" in r) {
|
|
@@ -573,20 +582,20 @@ function A(e, t) {
|
|
|
573
582
|
}
|
|
574
583
|
return null;
|
|
575
584
|
}
|
|
576
|
-
function
|
|
585
|
+
function we(e) {
|
|
577
586
|
return e.trim().replace(/[’]/gu, "'").replace(/iere$/iu, "ière").replace(/ieme$/iu, "ième");
|
|
578
587
|
}
|
|
579
|
-
function
|
|
588
|
+
function Te(e) {
|
|
580
589
|
let t = e.trim();
|
|
581
590
|
if (!t) return null;
|
|
582
|
-
let n = Array.from(new Set([t,
|
|
591
|
+
let n = Array.from(new Set([t, we(t)]));
|
|
583
592
|
for (let e of n) {
|
|
584
|
-
let t =
|
|
593
|
+
let t = Ce(e, xe) ?? Ce(e, be) ?? Ce(e, fe);
|
|
585
594
|
if (t !== null) return t;
|
|
586
595
|
}
|
|
587
596
|
return null;
|
|
588
597
|
}
|
|
589
|
-
var
|
|
598
|
+
var Ee = [
|
|
590
599
|
{
|
|
591
600
|
pattern: "bis",
|
|
592
601
|
value: 2
|
|
@@ -631,271 +640,1023 @@ var we = [
|
|
|
631
640
|
pattern: "semel",
|
|
632
641
|
value: 1
|
|
633
642
|
}
|
|
634
|
-
],
|
|
643
|
+
], De = Ee.filter((e) => e.pattern !== "semel").map((e) => e.pattern).join("|"), M = x(y(C("quinquagies", {
|
|
635
644
|
flags: "i",
|
|
636
645
|
value: 50
|
|
637
|
-
}),
|
|
646
|
+
}), C("sexagies", {
|
|
638
647
|
flags: "i",
|
|
639
648
|
value: 60
|
|
640
|
-
}),
|
|
649
|
+
}), C("septuagies", {
|
|
641
650
|
flags: "i",
|
|
642
651
|
value: 70
|
|
643
|
-
}),
|
|
652
|
+
}), C("octogies", {
|
|
644
653
|
flags: "i",
|
|
645
654
|
value: 80
|
|
646
|
-
}),
|
|
655
|
+
}), b([T("unites", S(y(C("unde?", {
|
|
647
656
|
flags: "i",
|
|
648
657
|
value: -1
|
|
649
|
-
}),
|
|
658
|
+
}), C("duode?", {
|
|
650
659
|
flags: "i",
|
|
651
660
|
value: -2
|
|
652
|
-
}),
|
|
661
|
+
}), C("un", {
|
|
653
662
|
flags: "i",
|
|
654
663
|
value: 1
|
|
655
|
-
}),
|
|
664
|
+
}), C("duo", {
|
|
656
665
|
flags: "i",
|
|
657
666
|
value: 2
|
|
658
|
-
}),
|
|
667
|
+
}), C("ter", {
|
|
659
668
|
flags: "i",
|
|
660
669
|
value: 3
|
|
661
|
-
}),
|
|
670
|
+
}), C("quater", {
|
|
662
671
|
flags: "i",
|
|
663
672
|
value: 4
|
|
664
|
-
}),
|
|
673
|
+
}), C("quin", {
|
|
665
674
|
flags: "i",
|
|
666
675
|
value: 5
|
|
667
|
-
}),
|
|
676
|
+
}), C("sept", {
|
|
668
677
|
flags: "i",
|
|
669
678
|
value: 7
|
|
670
|
-
}),
|
|
679
|
+
}), C("sex?", {
|
|
671
680
|
flags: "i",
|
|
672
681
|
value: 6
|
|
673
|
-
}),
|
|
682
|
+
}), C("octo", {
|
|
674
683
|
flags: "i",
|
|
675
684
|
value: 8
|
|
676
|
-
}),
|
|
685
|
+
}), C("novo", {
|
|
677
686
|
flags: "i",
|
|
678
687
|
value: 9
|
|
679
|
-
})), { default: 0 })),
|
|
688
|
+
})), { default: 0 })), T("dizaines", y(C("decies", {
|
|
680
689
|
flags: "i",
|
|
681
690
|
value: 10
|
|
682
|
-
}),
|
|
691
|
+
}), C("v[ei]cies", {
|
|
683
692
|
flags: "i",
|
|
684
693
|
value: 20
|
|
685
|
-
}),
|
|
694
|
+
}), C("tr[ei]cies", {
|
|
686
695
|
flags: "i",
|
|
687
696
|
value: 30
|
|
688
|
-
}),
|
|
697
|
+
}), C("quadragies", {
|
|
689
698
|
flags: "i",
|
|
690
699
|
value: 40
|
|
691
|
-
}),
|
|
700
|
+
}), C("quinquagies", {
|
|
692
701
|
flags: "i",
|
|
693
702
|
value: 50
|
|
694
|
-
}),
|
|
703
|
+
}), C("sexagies", {
|
|
695
704
|
flags: "i",
|
|
696
705
|
value: 60
|
|
697
|
-
}),
|
|
706
|
+
}), C("septuagies", {
|
|
698
707
|
flags: "i",
|
|
699
708
|
value: 70
|
|
700
|
-
}),
|
|
709
|
+
}), C("o?ctogies", {
|
|
701
710
|
flags: "i",
|
|
702
711
|
value: 80
|
|
703
|
-
}),
|
|
712
|
+
}), C("nonagies", {
|
|
704
713
|
flags: "i",
|
|
705
714
|
value: 90
|
|
706
|
-
})))], { value: (e, { variables: t }) => t.dizaines + t.unites }), ...
|
|
715
|
+
})))], { value: (e, { variables: t }) => t.dizaines + t.unites }), ...Ee.map((e) => C(e.pattern, {
|
|
707
716
|
flags: "i",
|
|
708
717
|
value: e.value
|
|
709
718
|
}))), { value: (e, t) => ({
|
|
710
719
|
position: t.position(),
|
|
711
720
|
text: t.text().toLowerCase(),
|
|
712
721
|
value: e
|
|
713
|
-
}) }),
|
|
722
|
+
}) }), Oe = C(String.raw`[12]\d{3}`), ke = x(y(me, C(String.raw`1[0-4]|\d`)), { value: (e) => m(parseInt(e)) }), Ae = y(C(String.raw`1\s*er`, {
|
|
714
723
|
flags: "i",
|
|
715
724
|
value: "01"
|
|
716
|
-
}),
|
|
725
|
+
}), C(String.raw`[12]\d|3[01]`, { value: (e) => e[0] }), C(String.raw`\d`, { value: (e) => "0" + e[0] })), je = y(C(String.raw`1\s*er`, {
|
|
717
726
|
flags: "i",
|
|
718
727
|
value: "1"
|
|
719
|
-
}),
|
|
728
|
+
}), C(String.raw`[12]\d|30`, { value: (e) => e[0] }), C(String.raw`\d`, { value: (e) => e[0] })), Me = y(C("janvier", {
|
|
720
729
|
flags: "i",
|
|
721
730
|
value: "01"
|
|
722
|
-
}),
|
|
731
|
+
}), C("février", {
|
|
723
732
|
flags: "i",
|
|
724
733
|
value: "02"
|
|
725
|
-
}),
|
|
734
|
+
}), C("mars", {
|
|
726
735
|
flags: "i",
|
|
727
736
|
value: "03"
|
|
728
|
-
}),
|
|
737
|
+
}), C("avril", {
|
|
729
738
|
flags: "i",
|
|
730
739
|
value: "04"
|
|
731
|
-
}),
|
|
740
|
+
}), C("mai", {
|
|
732
741
|
flags: "i",
|
|
733
742
|
value: "05"
|
|
734
|
-
}),
|
|
743
|
+
}), C("juin", {
|
|
735
744
|
flags: "i",
|
|
736
745
|
value: "06"
|
|
737
|
-
}),
|
|
746
|
+
}), C("juillet", {
|
|
738
747
|
flags: "i",
|
|
739
748
|
value: "07"
|
|
740
|
-
}),
|
|
749
|
+
}), C("août", {
|
|
741
750
|
flags: "i",
|
|
742
751
|
value: "08"
|
|
743
|
-
}),
|
|
752
|
+
}), C("septembre", {
|
|
744
753
|
flags: "i",
|
|
745
754
|
value: "09"
|
|
746
|
-
}),
|
|
755
|
+
}), C("octobre", {
|
|
747
756
|
flags: "i",
|
|
748
757
|
value: "10"
|
|
749
|
-
}),
|
|
758
|
+
}), C("novembre", {
|
|
750
759
|
flags: "i",
|
|
751
760
|
value: "11"
|
|
752
|
-
}),
|
|
761
|
+
}), C("décembre", {
|
|
753
762
|
flags: "i",
|
|
754
763
|
value: "12"
|
|
755
|
-
})),
|
|
764
|
+
})), Ne = y(C("vendémiaire", {
|
|
756
765
|
flags: "i",
|
|
757
766
|
value: "vendémiaire"
|
|
758
|
-
}),
|
|
767
|
+
}), C("brumaire", {
|
|
759
768
|
flags: "i",
|
|
760
769
|
value: "brumaire"
|
|
761
|
-
}),
|
|
770
|
+
}), C("frimaire", {
|
|
762
771
|
flags: "i",
|
|
763
772
|
value: "frimaire"
|
|
764
|
-
}),
|
|
773
|
+
}), C("nivôse", {
|
|
765
774
|
flags: "i",
|
|
766
775
|
value: "nivôse"
|
|
767
|
-
}),
|
|
776
|
+
}), C("pluviôse", {
|
|
768
777
|
flags: "i",
|
|
769
778
|
value: "pluviôse"
|
|
770
|
-
}),
|
|
779
|
+
}), C("ventôse", {
|
|
771
780
|
flags: "i",
|
|
772
781
|
value: "ventôse"
|
|
773
|
-
}),
|
|
782
|
+
}), C("germinal", {
|
|
774
783
|
flags: "i",
|
|
775
784
|
value: "germinal"
|
|
776
|
-
}),
|
|
785
|
+
}), C("floréal", {
|
|
777
786
|
flags: "i",
|
|
778
787
|
value: "floréal"
|
|
779
|
-
}),
|
|
788
|
+
}), C("prairial", {
|
|
780
789
|
flags: "i",
|
|
781
790
|
value: "prairial"
|
|
782
|
-
}),
|
|
791
|
+
}), C("messidor", {
|
|
783
792
|
flags: "i",
|
|
784
793
|
value: "messidor"
|
|
785
|
-
}),
|
|
794
|
+
}), C("thermidor", {
|
|
786
795
|
flags: "i",
|
|
787
796
|
value: "thermidor"
|
|
788
|
-
}),
|
|
797
|
+
}), C("fructidor", {
|
|
789
798
|
flags: "i",
|
|
790
799
|
value: "fructidor"
|
|
791
|
-
})),
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
], { value: (e, { variables: t }) => `${t.annee}-${t.mois}-${t.jour}` }),
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
], { value: (e, { variables: t }) => `${t.annee}-${t.mois}-${t.jour}` })),
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
], { value: (e, { variables: t }) => `${t.jour} ${t.mois} an ${t.annee}` }),
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
800
|
+
})), Pe = y(b([
|
|
801
|
+
T("jour", Ae),
|
|
802
|
+
E,
|
|
803
|
+
T("mois", Me),
|
|
804
|
+
E,
|
|
805
|
+
T("annee", Oe)
|
|
806
|
+
], { value: (e, { variables: t }) => `${t.annee}-${t.mois}-${t.jour}` }), b([
|
|
807
|
+
T("jour", Ae),
|
|
808
|
+
C("-"),
|
|
809
|
+
T("mois", y(C(String.raw`1[0-2]`, { value: (e) => e[0] }), C(String.raw`0?(\d)`, { value: (e) => "0" + e[1] }))),
|
|
810
|
+
C("-"),
|
|
811
|
+
T("annee", Oe)
|
|
812
|
+
], { value: (e, { variables: t }) => `${t.annee}-${t.mois}-${t.jour}` })), Fe = b([
|
|
813
|
+
T("jour", je),
|
|
814
|
+
E,
|
|
815
|
+
T("mois", Ne),
|
|
816
|
+
C(" an ", { flags: "i" }),
|
|
817
|
+
T("annee", ke)
|
|
818
|
+
], { value: (e, { variables: t }) => `${t.jour} ${t.mois} an ${t.annee}` }), N = b([S(C("du ", { flags: "i" }), { default: null }), y(b([Fe, S(b([
|
|
819
|
+
C(String.raw` \(`),
|
|
820
|
+
Pe,
|
|
821
|
+
C(String.raw`\)`)
|
|
813
822
|
], { value: (e) => e[1] }), { default: null })], { value: (e) => {
|
|
814
823
|
let t = { dateCalendrierRepublicain: e[0] }, n = e[1];
|
|
815
824
|
return n !== null && (t.date = n), t;
|
|
816
|
-
} }),
|
|
825
|
+
} }), x(Pe, { value: (e) => ({ date: e }) }))], { value: (e) => e[1] }), Ie = b([E, N], { value: (e) => e[1] }), Le = [
|
|
826
|
+
"article",
|
|
827
|
+
"portion",
|
|
828
|
+
"division",
|
|
829
|
+
"texte",
|
|
830
|
+
"unknown"
|
|
831
|
+
], Re = [
|
|
832
|
+
",",
|
|
833
|
+
"à",
|
|
834
|
+
"et",
|
|
835
|
+
"ou",
|
|
836
|
+
"sauf"
|
|
837
|
+
], ze = [
|
|
838
|
+
"ARRETEEURO",
|
|
839
|
+
"ARRETEURO",
|
|
840
|
+
"AVISEURO",
|
|
841
|
+
"DECISION_EURO",
|
|
842
|
+
"DECLARATIONEURO",
|
|
843
|
+
"DELIBERATIONEURO",
|
|
844
|
+
"DIRECTIVE_EURO",
|
|
845
|
+
"INFORMATIONEURO",
|
|
846
|
+
"INSTRUCTIONEURO",
|
|
847
|
+
"LETTREEURO",
|
|
848
|
+
"RECOMMANDATIONEURO",
|
|
849
|
+
"REGLEMENTEUROPEEN"
|
|
850
|
+
], Be = [
|
|
851
|
+
"ARRETE",
|
|
852
|
+
"CIRCULAIRE",
|
|
853
|
+
"CODE",
|
|
854
|
+
"CONSTITUTION",
|
|
855
|
+
"DECRET",
|
|
856
|
+
"DECRET_LOI",
|
|
857
|
+
"LOI",
|
|
858
|
+
"LOI_CONSTIT",
|
|
859
|
+
"LOI_ORGANIQUE",
|
|
860
|
+
"ORDONNANCE"
|
|
861
|
+
], Ve = ["CONVENTION"], He = [
|
|
862
|
+
"partie",
|
|
863
|
+
"livre",
|
|
864
|
+
"titre",
|
|
865
|
+
"sous-titre",
|
|
866
|
+
"chapitre",
|
|
867
|
+
"section",
|
|
868
|
+
"sous-section",
|
|
869
|
+
"paragraphe",
|
|
870
|
+
"sous-paragraphe",
|
|
871
|
+
"sous-sous-paragraphe"
|
|
872
|
+
], Ue = [
|
|
873
|
+
...ze,
|
|
874
|
+
...Be,
|
|
875
|
+
...Ve
|
|
876
|
+
], We = [
|
|
877
|
+
"item",
|
|
878
|
+
"alinéa",
|
|
879
|
+
"phrase"
|
|
880
|
+
], Ge = [
|
|
881
|
+
"après",
|
|
882
|
+
"avant",
|
|
883
|
+
"dessous",
|
|
884
|
+
"dessus"
|
|
885
|
+
];
|
|
886
|
+
function Ke(e) {
|
|
887
|
+
switch (e.type) {
|
|
888
|
+
case "alinéa":
|
|
889
|
+
case "article":
|
|
890
|
+
case "chapitre":
|
|
891
|
+
case "incomplete-header":
|
|
892
|
+
case "livre":
|
|
893
|
+
case "paragraphe":
|
|
894
|
+
case "item":
|
|
895
|
+
case "partie":
|
|
896
|
+
case "phrase":
|
|
897
|
+
case "section":
|
|
898
|
+
case "sous-paragraphe":
|
|
899
|
+
case "sous-section":
|
|
900
|
+
case "sous-sous-paragraphe":
|
|
901
|
+
case "sous-titre":
|
|
902
|
+
case "texte":
|
|
903
|
+
case "titre": return !0;
|
|
904
|
+
case "bounded-interval":
|
|
905
|
+
case "counted-interval":
|
|
906
|
+
case "enumeration":
|
|
907
|
+
case "exclusion":
|
|
908
|
+
case "parent-enfant":
|
|
909
|
+
case "reference_et_action": return !1;
|
|
910
|
+
default: _("isTextAstAtomicReference", e);
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
function qe(e) {
|
|
914
|
+
return He.includes(e.type);
|
|
915
|
+
}
|
|
916
|
+
function Je(e) {
|
|
917
|
+
return We.includes(e.type);
|
|
918
|
+
}
|
|
919
|
+
//#endregion
|
|
920
|
+
//#region src/lib/text_parsers/helpers.ts
|
|
921
|
+
var Ye = {
|
|
922
|
+
",": 1,
|
|
923
|
+
à: 3,
|
|
924
|
+
et: 1,
|
|
925
|
+
ou: 1,
|
|
926
|
+
sauf: 2
|
|
927
|
+
}, P = (e, t) => {
|
|
928
|
+
if (!Ke(e) && e.type !== "parent-enfant") switch (e.type) {
|
|
929
|
+
case "bounded-interval": return {
|
|
930
|
+
...e,
|
|
931
|
+
first: P(e.first, t),
|
|
932
|
+
last: P(e.last, t)
|
|
933
|
+
};
|
|
934
|
+
case "counted-interval": {
|
|
935
|
+
let n = e.first.position === void 0 ? {
|
|
936
|
+
...e.first,
|
|
937
|
+
position: e.position
|
|
938
|
+
} : e.first;
|
|
939
|
+
return {
|
|
940
|
+
...e,
|
|
941
|
+
first: P(n, t)
|
|
942
|
+
};
|
|
943
|
+
}
|
|
944
|
+
case "enumeration": return {
|
|
945
|
+
...e,
|
|
946
|
+
left: P(e.left, t),
|
|
947
|
+
right: P(e.right, t)
|
|
948
|
+
};
|
|
949
|
+
case "exclusion": return {
|
|
950
|
+
...e,
|
|
951
|
+
left: P(e.left, t)
|
|
952
|
+
};
|
|
953
|
+
case "reference_et_action": return {
|
|
954
|
+
...e,
|
|
955
|
+
reference: P(e.reference, t)
|
|
956
|
+
};
|
|
957
|
+
default: _("Neither AtomicReference nor ParentChild", e);
|
|
958
|
+
}
|
|
959
|
+
if (e.type === "parent-enfant") {
|
|
960
|
+
if (e.parent.type === "texte") for (let e of z(t)) e.type === "article" && delete e.implicitText;
|
|
961
|
+
return {
|
|
962
|
+
...e,
|
|
963
|
+
child: P(e.child, t),
|
|
964
|
+
position: {
|
|
965
|
+
start: Math.min(e.position.start, t.position.start),
|
|
966
|
+
stop: Math.max(e.position.stop, t.position.stop)
|
|
967
|
+
}
|
|
968
|
+
};
|
|
969
|
+
}
|
|
970
|
+
if (e.type === "texte") for (let e of z(t)) e.type === "article" && delete e.implicitText;
|
|
971
|
+
return {
|
|
972
|
+
child: t,
|
|
973
|
+
parent: e,
|
|
974
|
+
position: {
|
|
975
|
+
start: Math.min(e.position.start, t.position.start),
|
|
976
|
+
stop: Math.max(e.position.stop, t.position.stop)
|
|
977
|
+
},
|
|
978
|
+
type: "parent-enfant"
|
|
979
|
+
};
|
|
980
|
+
}, F = (e, t, n) => {
|
|
981
|
+
let r = t.at(-1);
|
|
982
|
+
if (r?.[1].type === "reference_et_action" && r[1].reference.type === "parent-enfant" && L(e) !== L(r[1].reference) && I(L(e), L(r[1].reference)) === L(r[1].reference) && ![e, ...t.slice(0, -1).map(([, e]) => e)].some((e) => [...B(e)].some((e) => e.type === "reference_et_action"))) {
|
|
983
|
+
let i = r[1];
|
|
984
|
+
return r[1] = i.reference, {
|
|
985
|
+
...i,
|
|
986
|
+
reference: F(e, t, {
|
|
987
|
+
start: n.start,
|
|
988
|
+
stop: i.reference.position.stop
|
|
989
|
+
}),
|
|
990
|
+
position: n
|
|
991
|
+
};
|
|
992
|
+
}
|
|
993
|
+
for (; t.length > 0;) e = Xe(e, t, n, 0);
|
|
994
|
+
return {
|
|
995
|
+
...e,
|
|
996
|
+
position: n
|
|
997
|
+
};
|
|
998
|
+
}, Xe = (e, t, n, r) => {
|
|
999
|
+
if (t.length > r) {
|
|
1000
|
+
let [i, a] = t[r], o = Ye[i], s = t[r + 1]?.[0];
|
|
1001
|
+
if (o < (s === void 0 ? 0 : Ye[s])) t[r][1] = Xe(a, t, {
|
|
1002
|
+
start: a.position.start,
|
|
1003
|
+
stop: n.stop
|
|
1004
|
+
}, r + 1);
|
|
1005
|
+
else {
|
|
1006
|
+
if (i === "sauf") {
|
|
1007
|
+
let t;
|
|
1008
|
+
for (let n = e; n.type === "enumeration"; n = n.right) t = n;
|
|
1009
|
+
t === void 0 ? e = {
|
|
1010
|
+
left: e,
|
|
1011
|
+
position: {
|
|
1012
|
+
start: e.position.start,
|
|
1013
|
+
stop: a.position.stop
|
|
1014
|
+
},
|
|
1015
|
+
right: a,
|
|
1016
|
+
type: "exclusion"
|
|
1017
|
+
} : t.right = {
|
|
1018
|
+
left: t.right,
|
|
1019
|
+
position: {
|
|
1020
|
+
start: t.right.position.start,
|
|
1021
|
+
stop: a.position.stop
|
|
1022
|
+
},
|
|
1023
|
+
right: a,
|
|
1024
|
+
type: "exclusion"
|
|
1025
|
+
};
|
|
1026
|
+
} else {
|
|
1027
|
+
let t = L(e), n = L(a), r = I(t, n), o;
|
|
1028
|
+
if (t === n) o = !0;
|
|
1029
|
+
else if (r === n && a.type === "parent-enfant") {
|
|
1030
|
+
o = !1;
|
|
1031
|
+
for (let t of z(e)) t.type === "article" && delete t.implicitText;
|
|
1032
|
+
e = {
|
|
1033
|
+
...a,
|
|
1034
|
+
child: i === "à" ? {
|
|
1035
|
+
first: e,
|
|
1036
|
+
last: a.child,
|
|
1037
|
+
position: {
|
|
1038
|
+
start: e.position.start,
|
|
1039
|
+
stop: a.child.position.stop
|
|
1040
|
+
},
|
|
1041
|
+
type: "bounded-interval"
|
|
1042
|
+
} : {
|
|
1043
|
+
coordinator: i,
|
|
1044
|
+
left: e,
|
|
1045
|
+
right: a.child,
|
|
1046
|
+
position: {
|
|
1047
|
+
start: e.position.start,
|
|
1048
|
+
stop: a.child.position.stop
|
|
1049
|
+
},
|
|
1050
|
+
type: "enumeration"
|
|
1051
|
+
},
|
|
1052
|
+
position: {
|
|
1053
|
+
start: e.position.start,
|
|
1054
|
+
stop: a.position.stop
|
|
1055
|
+
}
|
|
1056
|
+
};
|
|
1057
|
+
} else if (r === t && e.type === "parent-enfant") {
|
|
1058
|
+
o = !1;
|
|
1059
|
+
for (let e of z(a)) e.type === "article" && delete e.implicitText;
|
|
1060
|
+
e = {
|
|
1061
|
+
...e,
|
|
1062
|
+
child: i === "à" ? {
|
|
1063
|
+
first: e.child,
|
|
1064
|
+
last: a,
|
|
1065
|
+
position: {
|
|
1066
|
+
start: e.child.position.start,
|
|
1067
|
+
stop: a.position.stop
|
|
1068
|
+
},
|
|
1069
|
+
type: "bounded-interval"
|
|
1070
|
+
} : {
|
|
1071
|
+
coordinator: i,
|
|
1072
|
+
left: e.child,
|
|
1073
|
+
right: a,
|
|
1074
|
+
position: {
|
|
1075
|
+
start: e.child.position.start,
|
|
1076
|
+
stop: a.position.stop
|
|
1077
|
+
},
|
|
1078
|
+
type: "enumeration"
|
|
1079
|
+
},
|
|
1080
|
+
position: {
|
|
1081
|
+
start: e.position.start,
|
|
1082
|
+
stop: a.position.stop
|
|
1083
|
+
}
|
|
1084
|
+
};
|
|
1085
|
+
} else o = !0;
|
|
1086
|
+
o && (e = i === "à" ? {
|
|
1087
|
+
first: e,
|
|
1088
|
+
last: a,
|
|
1089
|
+
position: {
|
|
1090
|
+
start: e.position.start,
|
|
1091
|
+
stop: a.position.stop
|
|
1092
|
+
},
|
|
1093
|
+
type: "bounded-interval"
|
|
1094
|
+
} : {
|
|
1095
|
+
coordinator: i,
|
|
1096
|
+
left: e,
|
|
1097
|
+
position: {
|
|
1098
|
+
start: e.position.start,
|
|
1099
|
+
stop: a.position.stop
|
|
1100
|
+
},
|
|
1101
|
+
right: a,
|
|
1102
|
+
type: "enumeration"
|
|
1103
|
+
});
|
|
1104
|
+
}
|
|
1105
|
+
t.splice(r, 1);
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
return e;
|
|
1109
|
+
}, Ze = (e, t, n) => {
|
|
1110
|
+
for (let n of t) {
|
|
1111
|
+
if (n.type === "texte") for (let t of z(e)) t.type === "article" && delete t.implicitText;
|
|
1112
|
+
e = {
|
|
1113
|
+
child: e,
|
|
1114
|
+
parent: n,
|
|
1115
|
+
position: {
|
|
1116
|
+
start: e.position.start,
|
|
1117
|
+
stop: n.position.stop
|
|
1118
|
+
},
|
|
1119
|
+
type: "parent-enfant"
|
|
1120
|
+
};
|
|
1121
|
+
}
|
|
1122
|
+
return e.position = n, e;
|
|
1123
|
+
}, I = (e, t) => {
|
|
1124
|
+
for (let n of [
|
|
1125
|
+
"texte",
|
|
1126
|
+
...He,
|
|
1127
|
+
"article",
|
|
1128
|
+
...We
|
|
1129
|
+
]) if ([e, t].includes(n)) return n;
|
|
1130
|
+
return "incomplete-header";
|
|
1131
|
+
}, L = (e) => {
|
|
1132
|
+
if (Ke(e)) return e.type;
|
|
1133
|
+
switch (e.type) {
|
|
1134
|
+
case "bounded-interval": return I(L(e.first), L(e.last));
|
|
1135
|
+
case "counted-interval": return L(e.first);
|
|
1136
|
+
case "enumeration": return I(L(e.left), L(e.right));
|
|
1137
|
+
case "exclusion": return I(L(e.left), L(e.right));
|
|
1138
|
+
case "parent-enfant": return I(L(e.parent), L(e.child));
|
|
1139
|
+
case "reference_et_action": return L(e.reference);
|
|
1140
|
+
default: _("getReferenceHighestAtomicType reference.type", e);
|
|
1141
|
+
}
|
|
1142
|
+
};
|
|
1143
|
+
function* R(e) {
|
|
1144
|
+
switch (e.type) {
|
|
1145
|
+
case "bounded-interval":
|
|
1146
|
+
yield* R(e.first), yield* R(e.last);
|
|
1147
|
+
break;
|
|
1148
|
+
case "counted-interval":
|
|
1149
|
+
yield* R(e.first);
|
|
1150
|
+
break;
|
|
1151
|
+
case "enumeration":
|
|
1152
|
+
case "exclusion":
|
|
1153
|
+
yield* R(e.left), yield* R(e.right);
|
|
1154
|
+
break;
|
|
1155
|
+
case "parent-enfant":
|
|
1156
|
+
yield e.parent;
|
|
1157
|
+
break;
|
|
1158
|
+
case "reference_et_action":
|
|
1159
|
+
yield* R(e.reference);
|
|
1160
|
+
break;
|
|
1161
|
+
default: yield e;
|
|
1162
|
+
}
|
|
1163
|
+
}
|
|
1164
|
+
function* z(e) {
|
|
1165
|
+
switch (e.type) {
|
|
1166
|
+
case "bounded-interval":
|
|
1167
|
+
yield* z(e.first), yield* z(e.last);
|
|
1168
|
+
break;
|
|
1169
|
+
case "counted-interval":
|
|
1170
|
+
yield* z(e.first);
|
|
1171
|
+
break;
|
|
1172
|
+
case "enumeration":
|
|
1173
|
+
case "exclusion":
|
|
1174
|
+
yield* z(e.left), yield* z(e.right);
|
|
1175
|
+
break;
|
|
1176
|
+
case "parent-enfant":
|
|
1177
|
+
yield* z(e.parent), yield* z(e.child);
|
|
1178
|
+
break;
|
|
1179
|
+
case "reference_et_action":
|
|
1180
|
+
yield* z(e.reference);
|
|
1181
|
+
break;
|
|
1182
|
+
default: yield e;
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
function Qe(e) {
|
|
1186
|
+
let t = !1, n = !1, r = !1, i = !1;
|
|
1187
|
+
for (let a of z(e)) Je(a) ? t = !0 : a.type === "article" ? n = !0 : qe(a) ? r = !0 : a.type === "texte" && (i = !0);
|
|
1188
|
+
return t ? "portion" : n ? "article" : r ? "division" : i ? "texte" : "unknown";
|
|
1189
|
+
}
|
|
1190
|
+
function* B(e, { citations: t } = {}) {
|
|
1191
|
+
switch (yield e, e.type) {
|
|
1192
|
+
case "bounded-interval":
|
|
1193
|
+
yield* B(e.first, { citations: t }), yield* B(e.last, { citations: t });
|
|
1194
|
+
break;
|
|
1195
|
+
case "counted-interval":
|
|
1196
|
+
yield* B(e.first, { citations: t });
|
|
1197
|
+
break;
|
|
1198
|
+
case "enumeration":
|
|
1199
|
+
case "exclusion":
|
|
1200
|
+
yield* B(e.left, { citations: t }), yield* B(e.right, { citations: t });
|
|
1201
|
+
break;
|
|
1202
|
+
case "parent-enfant":
|
|
1203
|
+
yield* B(e.parent, { citations: t }), yield* B(e.child, { citations: t });
|
|
1204
|
+
break;
|
|
1205
|
+
case "reference_et_action": {
|
|
1206
|
+
yield* B(e.reference, { citations: t });
|
|
1207
|
+
let { originalCitations: n } = e.action;
|
|
1208
|
+
if (t && n !== void 0) {
|
|
1209
|
+
for (let e of n) if (e.references !== void 0) for (let n of e.references) yield* B(n, { citations: t });
|
|
1210
|
+
}
|
|
1211
|
+
break;
|
|
1212
|
+
}
|
|
1213
|
+
default:
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
//#endregion
|
|
1217
|
+
//#region src/lib/text_parsers/prepositions.ts
|
|
1218
|
+
var $e = C(String.raw`(?<=^|\P{Alphabetic})(aux|des|les)( |(?=dite?s ))`, { flags: "iv" }), et = y(C(String.raw`(?<=^|\P{Alphabetic})(au|du|le)( |(?=dit ))`, { flags: "iv" }), C(String.raw`(?<=^|\P{Alphabetic})([àa] )?la( |(?=dite ))`, { flags: "iv" }), C(String.raw`(?<=^|\P{Alphabetic})([àa] )?l'`, { flags: "iv" })), tt = b([y(C(String.raw`[ \n]de (?=ce(tte)?s )`, { flags: "i" }), C(String.raw`[ \n]des( |(?=dite?s ))`, { flags: "i" }))], { value: "des" }), nt = x(y(C(String.raw`de (?=ce(tte|t)? )`, { flags: "i" }), C(String.raw`de l'`, { flags: "i" }), C(String.raw`de la( |(?=dite ))`, { flags: "i" }), C(String.raw`du( |(?=dit ))`, { flags: "i" })), { value: "de" }), V = b([C(String.raw`[ \n]`), nt], { value: "de" }), rt = C("dite?s ", {
|
|
817
1219
|
flags: "i",
|
|
818
1220
|
value: !0
|
|
819
|
-
}),
|
|
1221
|
+
}), H = C("dite? ", {
|
|
820
1222
|
flags: "i",
|
|
821
1223
|
value: !0
|
|
822
|
-
}),
|
|
1224
|
+
}), it = y(C("(nouvel|nouveau|nouvelle) ", {
|
|
823
1225
|
flags: "i",
|
|
824
1226
|
value: "new"
|
|
825
|
-
}),
|
|
1227
|
+
}), C("(ancien|ancienne) ", {
|
|
826
1228
|
flags: "i",
|
|
827
1229
|
value: "old"
|
|
828
|
-
})),
|
|
1230
|
+
})), U = y(C("derni(er|ère)s", {
|
|
829
1231
|
flags: "i",
|
|
830
1232
|
value: (e, t) => ({
|
|
831
1233
|
index: -1,
|
|
832
1234
|
num: t.text()
|
|
833
1235
|
})
|
|
834
|
-
}),
|
|
1236
|
+
}), C("mêmes", {
|
|
835
1237
|
flags: "i",
|
|
836
1238
|
value: { relative: 0 }
|
|
837
|
-
}),
|
|
1239
|
+
}), C("premi(er|ère)s", {
|
|
838
1240
|
flags: "i",
|
|
839
1241
|
value: (e, t) => ({
|
|
840
1242
|
index: 1,
|
|
841
1243
|
num: t.text()
|
|
842
1244
|
})
|
|
843
|
-
}),
|
|
1245
|
+
}), C("présente?s", {
|
|
844
1246
|
flags: "i",
|
|
845
1247
|
value: { present: !0 }
|
|
846
|
-
}),
|
|
1248
|
+
}), C("suivante?s", {
|
|
847
1249
|
flags: "i",
|
|
848
1250
|
value: { relative: "+∞" }
|
|
849
|
-
})),
|
|
1251
|
+
})), W = y(C("antépénultième", {
|
|
850
1252
|
flags: "i",
|
|
851
1253
|
value: (e, t) => ({
|
|
852
1254
|
index: -3,
|
|
853
1255
|
num: t.text()
|
|
854
1256
|
})
|
|
855
|
-
}),
|
|
1257
|
+
}), C("avant-derni(er|ère)", {
|
|
856
1258
|
flags: "i",
|
|
857
1259
|
value: (e, t) => ({
|
|
858
1260
|
index: -2,
|
|
859
1261
|
num: t.text()
|
|
860
1262
|
})
|
|
861
|
-
}),
|
|
1263
|
+
}), C("derni(er|ère)", {
|
|
862
1264
|
flags: "i",
|
|
863
1265
|
value: (e, t) => ({
|
|
864
1266
|
index: -1,
|
|
865
1267
|
num: t.text()
|
|
866
1268
|
})
|
|
867
|
-
}),
|
|
1269
|
+
}), C("même", {
|
|
868
1270
|
flags: "i",
|
|
869
1271
|
value: { relative: 0 }
|
|
870
|
-
}),
|
|
1272
|
+
}), C("pénultième", {
|
|
871
1273
|
flags: "i",
|
|
872
1274
|
value: (e, t) => ({
|
|
873
1275
|
index: -2,
|
|
874
1276
|
num: t.text()
|
|
875
1277
|
})
|
|
876
|
-
}),
|
|
1278
|
+
}), C("précédente?", {
|
|
877
1279
|
flags: "i",
|
|
878
1280
|
value: { relative: -1 }
|
|
879
|
-
}),
|
|
1281
|
+
}), C("premi(er|ère)", {
|
|
880
1282
|
flags: "i",
|
|
881
1283
|
value: (e, t) => ({
|
|
882
1284
|
index: 1,
|
|
883
1285
|
num: t.text()
|
|
884
1286
|
})
|
|
885
|
-
}),
|
|
1287
|
+
}), C("présente?", {
|
|
886
1288
|
flags: "i",
|
|
887
1289
|
value: { present: !0 }
|
|
888
|
-
}),
|
|
1290
|
+
}), C("suivante?", {
|
|
889
1291
|
flags: "i",
|
|
890
1292
|
value: { relative: 1 }
|
|
891
|
-
})),
|
|
1293
|
+
})), G = C("ci ?- ?(après|avant|dessous|dessus)", {
|
|
892
1294
|
flags: "i",
|
|
893
1295
|
value: (e) => `ci-${e[1]}`
|
|
894
|
-
}),
|
|
1296
|
+
}), at = b([E, G], { value: (e) => e[1] }), ot = C(" précitée?", { flags: "i" }), st = y(G, U), ct = b([S(C("ces ", { flags: "i" }), { default: "" }), U], { value: (e) => e[1] }), lt = y(G, W), ut = C("ce(tte|t)?(?= )", {
|
|
895
1297
|
flags: "i",
|
|
896
1298
|
value: { relative: 0 }
|
|
897
|
-
}),
|
|
898
|
-
|
|
1299
|
+
}), K = y(b([S([ut, E], { default: "" }), W], { value: (e) => e[1] }), ut), q = y(b([E, y(C("ainsi que ", { flags: "i" }), C("ainsi qu'", { flags: "i" }))], { value: "et" }), b([
|
|
1300
|
+
E,
|
|
1301
|
+
T("etOu", y(C("et", { flags: "i" }), C("ou", { flags: "i" }))),
|
|
1302
|
+
E
|
|
1303
|
+
], { value: (e, { variables: t }) => t.etOu }), b([ue, S([T("etOu", y(C("et", { flags: "i" }), C("ou", { flags: "i" }))), E], { default: "" })], { value: (e, { variables: t }) => t.etOu ?? "," })), dt = b([de, C("à l'exception ", { flags: "i" })], { value: "sauf" }), J = C(" à ", {
|
|
1304
|
+
flags: "i",
|
|
1305
|
+
value: "à"
|
|
1306
|
+
}), ft = C("alinéa|phrase", {
|
|
1307
|
+
flags: "i",
|
|
1308
|
+
value: (e) => e[0].toLowerCase()
|
|
1309
|
+
}), pt = b([ft, C("s", { flags: "i" })], { value: (e) => e[0] }), mt = b([
|
|
1310
|
+
y(x(me, { value: (e, t) => ({
|
|
1311
|
+
position: t.position(),
|
|
1312
|
+
text: t.text(),
|
|
1313
|
+
value: e
|
|
1314
|
+
}) }), x(se, { value: (e, t) => ({
|
|
1315
|
+
position: t.position(),
|
|
1316
|
+
text: e,
|
|
1317
|
+
value: e.toLowerCase().charCodeAt(0) - 97 + 1
|
|
1318
|
+
}) }), b([k, C("[°o]?", { flags: "i" })], { value: (e, t) => ({
|
|
1319
|
+
position: t.position(),
|
|
1320
|
+
text: t.text(),
|
|
1321
|
+
value: e[0]
|
|
1322
|
+
}) })),
|
|
1323
|
+
S([E, M], { default: null }),
|
|
1324
|
+
(e) => {
|
|
1325
|
+
let t = e.offset, n = ae(e);
|
|
1326
|
+
return e.offset = t, e.length = 0, e.usedInputs = void 0, n === void 0 ? "" : void 0;
|
|
1327
|
+
},
|
|
1328
|
+
ce,
|
|
1329
|
+
(e) => {
|
|
1330
|
+
let t = e.offset;
|
|
1331
|
+
if (S([E], { default: null })(e) !== null) {
|
|
1332
|
+
let n = Me(e);
|
|
1333
|
+
if (e.offset = t, e.length = 0, n !== void 0) return;
|
|
1334
|
+
} else e.offset = t, e.length = 0;
|
|
1335
|
+
return "";
|
|
1336
|
+
}
|
|
1337
|
+
], { value: (e, t) => {
|
|
1338
|
+
let n = e[0], r = e[1]?.[1];
|
|
1339
|
+
return {
|
|
1340
|
+
index: n.value + (r === void 0 ? 0 : r.value / 1e3),
|
|
1341
|
+
num: `${n.text}${r === void 0 ? "" : ` ${r.text}`}`,
|
|
1342
|
+
position: t.position(),
|
|
1343
|
+
type: "item"
|
|
1344
|
+
};
|
|
1345
|
+
} }), ht = y(b([
|
|
1346
|
+
S([C("même", { flags: "i" }), E], { default: null }),
|
|
1347
|
+
ft,
|
|
1348
|
+
E,
|
|
1349
|
+
x(be, { value: (e) => ({ index: e }) })
|
|
1350
|
+
], { value: (e, t) => ({
|
|
1351
|
+
...e[3],
|
|
1352
|
+
position: t.position(),
|
|
1353
|
+
type: e[1]
|
|
1354
|
+
}) }), b([
|
|
1355
|
+
y(b([
|
|
1356
|
+
C("même", { flags: "i" }),
|
|
1357
|
+
E,
|
|
1358
|
+
j
|
|
1359
|
+
], { value: (e) => ({
|
|
1360
|
+
index: e[2],
|
|
1361
|
+
relative: 0
|
|
1362
|
+
}) }), x(j, { value: (e) => ({ index: e }) }), x(W, { value: (e) => e })),
|
|
1363
|
+
E,
|
|
1364
|
+
ft
|
|
1365
|
+
], { value: (e, t) => ({
|
|
1366
|
+
...e[0],
|
|
1367
|
+
position: t.position(),
|
|
1368
|
+
type: e[2]
|
|
1369
|
+
}) })), gt = y(x(A, { value: (e, t) => t.text().length === 0 ? void 0 : {
|
|
1370
|
+
index: e,
|
|
1371
|
+
num: t.text(),
|
|
1372
|
+
position: t.position()
|
|
1373
|
+
} }), mt), _t = b([
|
|
1374
|
+
pt,
|
|
1375
|
+
E,
|
|
1376
|
+
gt,
|
|
1377
|
+
w([y(q, J), gt], { min: 1 })
|
|
1378
|
+
], { value: (e, t) => {
|
|
1379
|
+
let n = e[0], r = e[2], i = e[3], a = t.position(), { num: o, ...s } = r;
|
|
1380
|
+
return F({
|
|
1381
|
+
...s,
|
|
1382
|
+
type: n,
|
|
1383
|
+
position: {
|
|
1384
|
+
start: a.start,
|
|
1385
|
+
stop: s.position.stop
|
|
1386
|
+
}
|
|
1387
|
+
}, i.map(([e, t]) => {
|
|
1388
|
+
let { num: r, ...i } = t;
|
|
1389
|
+
return [e, {
|
|
1390
|
+
...i,
|
|
1391
|
+
type: n
|
|
1392
|
+
}];
|
|
1393
|
+
}), a);
|
|
1394
|
+
} }), vt = x(j, { value: (e, t) => ({
|
|
1395
|
+
index: e,
|
|
1396
|
+
position: t.position()
|
|
1397
|
+
}) }), yt = b([
|
|
1398
|
+
vt,
|
|
1399
|
+
w([q, vt], { min: 1 }),
|
|
1400
|
+
E,
|
|
1401
|
+
x(pt, { value: (e) => e === "alinéa" ? e : void 0 })
|
|
1402
|
+
], { value: (e, t) => {
|
|
1403
|
+
let n = e[3], r = e[0], i = e[1];
|
|
1404
|
+
return F({
|
|
1405
|
+
...r,
|
|
1406
|
+
type: n
|
|
1407
|
+
}, i.map(([e, t]) => [e, {
|
|
1408
|
+
...t,
|
|
1409
|
+
type: n
|
|
1410
|
+
}]), t.position());
|
|
1411
|
+
} }), bt = y(ht, mt), Y = b([
|
|
1412
|
+
A,
|
|
1413
|
+
E,
|
|
1414
|
+
x(U, { value: (e) => e }),
|
|
1415
|
+
E,
|
|
1416
|
+
pt
|
|
1417
|
+
], { value: (e, t) => ({
|
|
1418
|
+
count: e[0],
|
|
1419
|
+
first: {
|
|
1420
|
+
...e[2],
|
|
1421
|
+
type: e[4]
|
|
1422
|
+
},
|
|
1423
|
+
position: t.position(),
|
|
1424
|
+
type: "counted-interval"
|
|
1425
|
+
}) }), xt = b([Y, w([y(q, J), y(ht, Y)])], { value: (e, t) => F(e[0], e[1], t.position()) }), St = b([y(bt, Y, _t), w([y(q, J), y(bt, Y)])], { value: (e, t) => F(e[0], e[1], t.position()) }), Ct = y(xt, b([y(bt, Y), w([y(q, J), y(bt, Y)], { min: 1 })], { value: (e, t) => F(e[0], e[1], t.position()) }), yt), wt = y(b([
|
|
1426
|
+
E,
|
|
1427
|
+
C(String.raw`\(`),
|
|
1428
|
+
oe,
|
|
1429
|
+
St,
|
|
1430
|
+
oe,
|
|
1431
|
+
C(String.raw`\)`)
|
|
1432
|
+
], { value: (e) => e[3] }), b([
|
|
1433
|
+
ue,
|
|
1434
|
+
St,
|
|
1435
|
+
C(",|$")
|
|
1436
|
+
], { value: (e) => e[1] })), Tt = y(b([
|
|
1437
|
+
V,
|
|
1438
|
+
C("même ", { flags: "i" }),
|
|
1439
|
+
mt
|
|
1440
|
+
], { value: (e) => e[2] }), b([
|
|
1441
|
+
V,
|
|
1442
|
+
S(H, { default: null }),
|
|
1443
|
+
St
|
|
1444
|
+
], { value: (e) => e[2] }), b([tt, Ct], { value: (e) => e[1] }), wt), Et = b([
|
|
1445
|
+
S(H, { default: null }),
|
|
1446
|
+
St,
|
|
1447
|
+
w(Tt)
|
|
1448
|
+
], { value: (e, t) => Ze(e[1], e[2], t.position()) }), Dt = b([
|
|
1449
|
+
S(rt, { default: null }),
|
|
1450
|
+
S(b([ct, E], { value: (e) => e[0] }), { default: null }),
|
|
1451
|
+
Ct,
|
|
1452
|
+
w(Tt)
|
|
1453
|
+
], { value: (e, t) => Ze(e[2], e[3], t.position()) }), Ot = b([et, Et], { value: (e, t) => ({
|
|
1454
|
+
...e[1],
|
|
1455
|
+
position: t.position()
|
|
1456
|
+
}) }), kt = b([$e, Dt], { value: (e, t) => ({
|
|
1457
|
+
...e[1],
|
|
1458
|
+
position: t.position()
|
|
1459
|
+
}) }), At = y(kt, Ot, b([nt, Et], { value: (e) => e[1] })), jt = b([Dt, w([q, At])], { value: (e, t) => F(e[0], e[1], t.position()) }), Mt = b([Et, w([q, At])], { value: (e, t) => F(e[0], e[1], t.position()) }), Nt = /^article\s+/iu, Pt = /\s*\((?:nouveau|supprimé|abrogé)\)\s*$/iu, Ft = /^(?:(\((?:nouveau|supprimé|abrogé)\))\s*)?(?:[::]\s*(.+))?$/iu;
|
|
1460
|
+
function It(e) {
|
|
1461
|
+
return e.replace(/\u00a0/gu, " ").replace(Pt, "");
|
|
1462
|
+
}
|
|
1463
|
+
function Lt(e) {
|
|
1464
|
+
let t = e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim();
|
|
1465
|
+
if (!t) return;
|
|
1466
|
+
let n = new v(t), r = Vt(n);
|
|
1467
|
+
if (!(typeof r != "string" || n.remaining().trim())) return It(r);
|
|
1468
|
+
}
|
|
1469
|
+
function Rt(e) {
|
|
1470
|
+
let t = e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim().replace(/\s+[::]\s+/u, " : "), n = Nt.exec(t);
|
|
1471
|
+
if (!n) return null;
|
|
1472
|
+
let r = new v(t, n[0].length), i = Ut(r);
|
|
1473
|
+
if (typeof i != "string") return null;
|
|
1474
|
+
let a = r.remaining().trim(), o = Ft.exec(a);
|
|
1475
|
+
if (a && !o) {
|
|
1476
|
+
let e = /^(\d+ [A-Z])(?:\s+(\((?:nouveau|supprimé|abrogé)\)))?(?:\s*[::]\s*(.+))?$/u.exec(t.slice(n[0].length));
|
|
1477
|
+
if (!e) return null;
|
|
1478
|
+
let [, r, i, a] = e;
|
|
1479
|
+
return {
|
|
1480
|
+
label: `Article ${r}${i ? ` ${i}` : ""}`,
|
|
1481
|
+
num: r,
|
|
1482
|
+
...a ? { title: a.trim() } : {}
|
|
1483
|
+
};
|
|
1484
|
+
}
|
|
1485
|
+
let s = t.slice(n[0].length, r.offset).trim(), c = o?.[1], l = c ? `${s} ${c}` : s, u = It(i), d = o?.[2]?.trim();
|
|
1486
|
+
return {
|
|
1487
|
+
label: `Article ${l}`,
|
|
1488
|
+
num: u,
|
|
1489
|
+
...d ? { title: d } : {}
|
|
1490
|
+
};
|
|
1491
|
+
}
|
|
1492
|
+
var zt = C("annexe|exécution|liminaire|préambule|préliminaire|premier|unique", {
|
|
1493
|
+
flags: "i",
|
|
1494
|
+
value: (e) => {
|
|
1495
|
+
let t = e[0].toLowerCase();
|
|
1496
|
+
return t === "premier" || t === "unique" ? "1" : t;
|
|
1497
|
+
}
|
|
1498
|
+
}), Bt = b([C(String.raw`\*?\*?`), S([
|
|
1499
|
+
y([C(String.raw`L\.?O`, { value: "LO" }), C(String.raw`\*?`)], C(String.raw`([ARDL]|LO)\*?`)),
|
|
1500
|
+
C(String.raw`\*?\*?`),
|
|
1501
|
+
C(String.raw`\.?\ ?`, { value: "" })
|
|
1502
|
+
], { default: "" })], { value: (e, t) => t.textFromResults(e) }), Vt = y(b([
|
|
1503
|
+
Bt,
|
|
1504
|
+
C(String.raw`\d+`),
|
|
1505
|
+
S(C("(ème|er|e|r)", { value: "" }), { default: "" }),
|
|
1506
|
+
w([y(C(" ?- ?"), C(String.raw` ?\.`), E), y([C(String.raw`[\dA-Z]+`), S(C("(ème|er|e|r)", { value: "" }), { default: "" })], x(M, { value: (e) => e.text }))])
|
|
1507
|
+
], { value: (e, t) => t.textFromResults(e) }), zt), Ht = y(b([
|
|
1508
|
+
Bt,
|
|
1509
|
+
C(String.raw`\d+`),
|
|
1510
|
+
S(C("(ème|er|e|r)", { value: "" }), { default: "" }),
|
|
1511
|
+
w([y(C("-"), C(String.raw` ?\.`), E), y([C(String.raw`[\dA-Z]+`), S(C("(ème|er|e|r)", { value: "" }), { default: "" })], x(M, { value: (e) => e.text }))])
|
|
1512
|
+
], { value: (e, t) => t.textFromResults(e) }), zt), Ut = y(b([
|
|
1513
|
+
C(String.raw`\d+`),
|
|
1514
|
+
S(C("(ème|er|e|r)", { value: "" }), { default: "" }),
|
|
1515
|
+
S(y(b([
|
|
1516
|
+
E,
|
|
1517
|
+
M,
|
|
1518
|
+
S([E, C(String.raw`[A-Z]+`)], {
|
|
1519
|
+
default: "",
|
|
1520
|
+
value: (e) => " " + e[1]
|
|
1521
|
+
})
|
|
1522
|
+
], { value: (e) => " " + e[1].text + e[2] }), b([E, C(String.raw`[A-Z]+`)], { value: (e) => " " + e[1] })), { default: "" }),
|
|
1523
|
+
S(C(String.raw` \((?:nouveau|supprimé|abrogé)\)`, { flags: "i" }), { default: "" })
|
|
1524
|
+
], { value: (e, t) => t.textFromResults(e) }), zt), Wt = b([b([C(String.raw`^art\. `, { flags: "im" }), Ht], { value: (e, t) => ({
|
|
1525
|
+
definition: !0,
|
|
1526
|
+
num: e[1],
|
|
1527
|
+
position: t.position(),
|
|
1528
|
+
type: "article"
|
|
1529
|
+
}) }), C(String.raw`\.? ?- ?`)], { value: (e) => e[0] });
|
|
1530
|
+
function Gt(e) {
|
|
1531
|
+
let t = [], n = /^[ \t]*(?:[«"][ \t]*)?/gmu, r;
|
|
1532
|
+
for (; (r = n.exec(e)) !== null;) {
|
|
1533
|
+
let i = r.index, a = r.index + r[0].length, o = new v(e.slice(a)), s = Wt(o);
|
|
1534
|
+
if (s?.type !== "article" || typeof s.num != "string") {
|
|
1535
|
+
r[0].length === 0 && (n.lastIndex = a + 1);
|
|
1536
|
+
continue;
|
|
1537
|
+
}
|
|
1538
|
+
t.push({
|
|
1539
|
+
num: It(s.num),
|
|
1540
|
+
position: {
|
|
1541
|
+
start: a + s.position.start,
|
|
1542
|
+
stop: a + s.position.stop
|
|
1543
|
+
},
|
|
1544
|
+
start: i
|
|
1545
|
+
}), n.lastIndex = a + o.offset;
|
|
1546
|
+
}
|
|
1547
|
+
return t;
|
|
1548
|
+
}
|
|
1549
|
+
var Kt = b([b([
|
|
1550
|
+
C("^article", { flags: "im" }),
|
|
1551
|
+
E,
|
|
1552
|
+
Ut
|
|
1553
|
+
], { value: (e, t) => ({
|
|
1554
|
+
definition: !0,
|
|
1555
|
+
num: e[2],
|
|
1556
|
+
position: t.position(),
|
|
1557
|
+
type: "article"
|
|
1558
|
+
}) }), C("( :)?$", { flags: "m" })], { value: (e) => {
|
|
1559
|
+
let t = e[0];
|
|
1560
|
+
return e[1] && (t.definitionSuffix = e[1]), t;
|
|
1561
|
+
} }), qt = b([Vt, S(at, { default: null })], { value: (e, t) => ({
|
|
1562
|
+
...e[1] ? { localizationAdverb: e[1] } : {},
|
|
1563
|
+
num: e[0],
|
|
1564
|
+
position: t.position(),
|
|
1565
|
+
type: "article"
|
|
1566
|
+
}) }), Jt = y(b([qt, S(wt, { default: null })], { value: (e, t) => {
|
|
1567
|
+
let n = e[0], r = e[1];
|
|
1568
|
+
return r === null ? n : {
|
|
1569
|
+
child: r,
|
|
1570
|
+
parent: n,
|
|
1571
|
+
position: t.position(),
|
|
1572
|
+
type: "parent-enfant"
|
|
1573
|
+
};
|
|
1574
|
+
} }), x(W, { value: (e, t) => ({
|
|
1575
|
+
...e,
|
|
1576
|
+
position: t.position(),
|
|
1577
|
+
type: "article"
|
|
1578
|
+
}) })), Yt = x(U, { value: (e, t) => ({
|
|
1579
|
+
...e,
|
|
1580
|
+
position: t.position(),
|
|
1581
|
+
type: "article"
|
|
1582
|
+
}) }), Xt = (e) => b([e, w([y(q, J), y(Yt, e)], { min: 1 })], { value: (e, t) => F(e[0], e[1], t.position()) }), Zt = y(Xt(qt), Xt(Jt)), Qt = y(Zt, x(st, { value: (e, t) => ({
|
|
1583
|
+
...e,
|
|
1584
|
+
position: t.position(),
|
|
1585
|
+
type: "article"
|
|
1586
|
+
}) })), $t = y(b([
|
|
1587
|
+
ct,
|
|
1588
|
+
E,
|
|
1589
|
+
C("articles", { flags: "i" }),
|
|
1590
|
+
S([E, Qt], { default: [] })
|
|
1591
|
+
], { value: (e, t) => {
|
|
1592
|
+
let n = e[3][1] ?? {
|
|
1593
|
+
position: t.position(),
|
|
1594
|
+
type: "article"
|
|
1595
|
+
};
|
|
1596
|
+
for (let t of R(n)) t.type === "incomplete-header" && (t.type = "article"), t.index === void 0 && t.relative === void 0 && !t.present && Object.assign(t, e[0]);
|
|
1597
|
+
return {
|
|
1598
|
+
...n,
|
|
1599
|
+
position: t.position()
|
|
1600
|
+
};
|
|
1601
|
+
} }), b([
|
|
1602
|
+
C("articles", { flags: "i" }),
|
|
1603
|
+
E,
|
|
1604
|
+
Qt
|
|
1605
|
+
], { value: (e, t) => ({
|
|
1606
|
+
...e[2],
|
|
1607
|
+
position: t.position()
|
|
1608
|
+
}) })), en = b([S(rt, { default: !1 }), $t], { value: (e, t) => {
|
|
1609
|
+
let n = e[1];
|
|
1610
|
+
if (e[0]) for (let e of R(n)) e.ofTheSaid = !0;
|
|
1611
|
+
if (t.currentText !== void 0) for (let e of R(n)) e.implicitText === void 0 && (e.implicitText = t.currentText);
|
|
1612
|
+
return delete t.currentArticle, {
|
|
1613
|
+
...n,
|
|
1614
|
+
position: t.position()
|
|
1615
|
+
};
|
|
1616
|
+
} }), tn = y(b([
|
|
1617
|
+
K,
|
|
1618
|
+
E,
|
|
1619
|
+
S(it, { default: null }),
|
|
1620
|
+
C("article", { flags: "i" }),
|
|
1621
|
+
S([E, Jt], { default: [] })
|
|
1622
|
+
], { value: (e, t) => {
|
|
1623
|
+
let n = e[2], r = e[4][1] ?? {
|
|
1624
|
+
position: t.position(),
|
|
1625
|
+
type: "article"
|
|
1626
|
+
};
|
|
1627
|
+
for (let t of R(r)) t.type === "incomplete-header" && (t.type = "article"), t.index === void 0 && t.relative === void 0 && !t.present && Object.assign(t, e[0]), n !== null && (t.newOrOld = n);
|
|
1628
|
+
return {
|
|
1629
|
+
...r,
|
|
1630
|
+
position: t.position()
|
|
1631
|
+
};
|
|
1632
|
+
} }), b([
|
|
1633
|
+
S(it, { default: null }),
|
|
1634
|
+
C("article", { flags: "i" }),
|
|
1635
|
+
E,
|
|
1636
|
+
Jt
|
|
1637
|
+
], { value: (e, t) => {
|
|
1638
|
+
let n = e[0], r = e[3];
|
|
1639
|
+
if (n !== null) for (let e of R(r)) e.newOrOld = n;
|
|
1640
|
+
return {
|
|
1641
|
+
...r,
|
|
1642
|
+
position: t.position()
|
|
1643
|
+
};
|
|
1644
|
+
} })), nn = b([
|
|
1645
|
+
S(H, { default: null }),
|
|
1646
|
+
tn,
|
|
1647
|
+
S(ot, { default: null })
|
|
1648
|
+
], { value: (e, t) => {
|
|
1649
|
+
let n = e[1];
|
|
1650
|
+
if (e[0]) for (let e of R(n)) e.ofTheSaid = !0;
|
|
1651
|
+
if (e[2]) for (let e of R(n)) e.previouslyCited = !0;
|
|
1652
|
+
if (t.currentText !== void 0) for (let e of R(n)) e.implicitText === void 0 && (e.implicitText = t.currentText);
|
|
1653
|
+
let r = {
|
|
1654
|
+
...n,
|
|
1655
|
+
position: t.position()
|
|
1656
|
+
};
|
|
1657
|
+
return t.currentArticle = r.type === "parent-enfant" ? r.parent : r, r;
|
|
1658
|
+
} }), rn = /^<\/?(!DOCTYPE|\?XML|[A-Z][A-Z0-9]*)/i;
|
|
1659
|
+
function an(e, t) {
|
|
899
1660
|
return (n) => {
|
|
900
1661
|
let r = [], i = n;
|
|
901
1662
|
for (let e of t) {
|
|
@@ -910,7 +1671,7 @@ function z(e, t) {
|
|
|
910
1671
|
};
|
|
911
1672
|
};
|
|
912
1673
|
}
|
|
913
|
-
function
|
|
1674
|
+
function on(e) {
|
|
914
1675
|
return (t) => {
|
|
915
1676
|
let n = [], r = [], i = 0, a = 0;
|
|
916
1677
|
for (let { start: o, stop: s } of e) {
|
|
@@ -930,16 +1691,16 @@ function Je(e) {
|
|
|
930
1691
|
};
|
|
931
1692
|
};
|
|
932
1693
|
}
|
|
933
|
-
function*
|
|
1694
|
+
function* sn(e) {
|
|
934
1695
|
if (e.transformations === void 0) yield e;
|
|
935
|
-
else for (let t of e.transformations) yield*
|
|
1696
|
+
else for (let t of e.transformations) yield* sn(t);
|
|
936
1697
|
}
|
|
937
|
-
function*
|
|
938
|
-
let t = [...
|
|
1698
|
+
function* cn(e) {
|
|
1699
|
+
let t = [...sn(e)].reverse(), n = { position: {
|
|
939
1700
|
start: 0,
|
|
940
1701
|
stop: 0
|
|
941
1702
|
} }, r = t.map((e) => {
|
|
942
|
-
let t =
|
|
1703
|
+
let t = ln(e);
|
|
943
1704
|
return t.next(n), t;
|
|
944
1705
|
}), i = yield n;
|
|
945
1706
|
for (; i !== void 0;) {
|
|
@@ -953,7 +1714,7 @@ function* Ye(e) {
|
|
|
953
1714
|
}
|
|
954
1715
|
for (let e of r) e.next(void 0);
|
|
955
1716
|
}
|
|
956
|
-
function*
|
|
1717
|
+
function* ln(e) {
|
|
957
1718
|
let t = yield { position: {
|
|
958
1719
|
start: 0,
|
|
959
1720
|
stop: 0
|
|
@@ -992,7 +1753,7 @@ function* Xe(e) {
|
|
|
992
1753
|
if (i + 1 < d) {
|
|
993
1754
|
let r = !1, o = n[i + 1];
|
|
994
1755
|
if (o.openingTag !== void 0 && o.outputIndex + o.outputLength < e.start) {
|
|
995
|
-
let e = o.openingTag.match(
|
|
1756
|
+
let e = o.openingTag.match(rn);
|
|
996
1757
|
if (e !== null) {
|
|
997
1758
|
let t = e[1], n = t.toUpperCase();
|
|
998
1759
|
[
|
|
@@ -1017,7 +1778,7 @@ function* Xe(e) {
|
|
|
1017
1778
|
if (i + 1 > f) {
|
|
1018
1779
|
let a = !1, s = n[r], l = n[i + 1];
|
|
1019
1780
|
if (s.openingTag !== void 0 && e.stop < l.outputIndex) {
|
|
1020
|
-
let e = s.openingTag.match(
|
|
1781
|
+
let e = s.openingTag.match(rn);
|
|
1021
1782
|
if (e !== null) {
|
|
1022
1783
|
let t = e[1], n = t.toUpperCase();
|
|
1023
1784
|
[
|
|
@@ -1057,19 +1818,19 @@ function* Xe(e) {
|
|
|
1057
1818
|
}).filter(([, e]) => e !== void 0));
|
|
1058
1819
|
}
|
|
1059
1820
|
}
|
|
1060
|
-
function
|
|
1061
|
-
let t =
|
|
1821
|
+
function un(e) {
|
|
1822
|
+
let t = cn(e);
|
|
1062
1823
|
return t.next({
|
|
1063
1824
|
start: 0,
|
|
1064
1825
|
stop: 0
|
|
1065
1826
|
}), t;
|
|
1066
1827
|
}
|
|
1067
|
-
function
|
|
1828
|
+
function dn(e, t) {
|
|
1068
1829
|
let n = t.map((e) => [e]);
|
|
1069
|
-
for (let { sourceMap: t } of [...
|
|
1830
|
+
for (let { sourceMap: t } of [...sn(e)].reverse()) n = fn(t, n);
|
|
1070
1831
|
return n;
|
|
1071
1832
|
}
|
|
1072
|
-
function
|
|
1833
|
+
function fn(e, t) {
|
|
1073
1834
|
let n = [];
|
|
1074
1835
|
e = [
|
|
1075
1836
|
{
|
|
@@ -1134,16 +1895,16 @@ function $e(e, t) {
|
|
|
1134
1895
|
}
|
|
1135
1896
|
return n;
|
|
1136
1897
|
}
|
|
1137
|
-
function
|
|
1138
|
-
let n =
|
|
1139
|
-
return t.map((e) =>
|
|
1898
|
+
function pn(e, t) {
|
|
1899
|
+
let n = un(e);
|
|
1900
|
+
return t.map((e) => mn(n, e));
|
|
1140
1901
|
}
|
|
1141
|
-
function
|
|
1902
|
+
function mn(e, t) {
|
|
1142
1903
|
let n = e.next(t);
|
|
1143
1904
|
if (n.done) throw Error(`Reverse transformation of position failed: ${t}`);
|
|
1144
1905
|
return n.value;
|
|
1145
1906
|
}
|
|
1146
|
-
var
|
|
1907
|
+
var hn = (e, t, n = 0) => t === void 0 ? e : (t.innerPrefix ?? "") + e.slice(t.position.start + n, t.position.stop + n) + (t.innerSuffix ?? ""), gn = (e, t) => (e.outerPrefix ?? "") + t + (e.outerSuffix ?? ""), _n = {
|
|
1147
1908
|
amp: "&",
|
|
1148
1909
|
apos: "'",
|
|
1149
1910
|
asymp: "≈",
|
|
@@ -1161,7 +1922,7 @@ var nt = (e, t, n = 0) => t === void 0 ? e : (t.innerPrefix ?? "") + e.slice(t.p
|
|
|
1161
1922
|
reg: "®",
|
|
1162
1923
|
trade: "™"
|
|
1163
1924
|
};
|
|
1164
|
-
function
|
|
1925
|
+
function vn({ removeAWithHref: e } = {}) {
|
|
1165
1926
|
return (t) => {
|
|
1166
1927
|
let n = 0, r = 0, i = [], a = [], o = [], s = "Conversion des éléments HTML en texte";
|
|
1167
1928
|
for (; n < t.length;) {
|
|
@@ -1179,12 +1940,12 @@ function at({ removeAWithHref: e } = {}) {
|
|
|
1179
1940
|
sourceMap: a,
|
|
1180
1941
|
title: s
|
|
1181
1942
|
};
|
|
1182
|
-
let u = t.slice(c, l + 1), d = u.startsWith("</"), f = u.length, p = u.match(
|
|
1943
|
+
let u = t.slice(c, l + 1), d = u.startsWith("</"), f = u.length, p = u.match(rn);
|
|
1183
1944
|
if (p === null) {
|
|
1184
1945
|
i.push(t.slice(n, l + 1).replace(/[\n\r]/g, " ")), n = l + 1;
|
|
1185
1946
|
continue;
|
|
1186
1947
|
}
|
|
1187
|
-
let
|
|
1948
|
+
let m = p[1].toUpperCase();
|
|
1188
1949
|
if (u.endsWith("/>") || [
|
|
1189
1950
|
"!DOCTYPE",
|
|
1190
1951
|
"?XML",
|
|
@@ -1202,13 +1963,13 @@ function at({ removeAWithHref: e } = {}) {
|
|
|
1202
1963
|
"SOURCE",
|
|
1203
1964
|
"TRACK",
|
|
1204
1965
|
"WBR"
|
|
1205
|
-
].includes(
|
|
1966
|
+
].includes(m)) if (d) c > n && i.push(t.slice(n, c).replace(/[\n\r]/g, " ")), a.push({
|
|
1206
1967
|
inputIndex: c,
|
|
1207
1968
|
inputLength: f,
|
|
1208
1969
|
outputIndex: c + r,
|
|
1209
1970
|
outputLength: 0
|
|
1210
1971
|
}), r -= f;
|
|
1211
|
-
else if (["BR", "HR"].includes(
|
|
1972
|
+
else if (["BR", "HR"].includes(m)) {
|
|
1212
1973
|
c > n && i.push(t.slice(n, c).replace(/[\n\r]/g, " "));
|
|
1213
1974
|
let e = l + 1 - c;
|
|
1214
1975
|
i.push("\n"), a.push({
|
|
@@ -1224,7 +1985,7 @@ function at({ removeAWithHref: e } = {}) {
|
|
|
1224
1985
|
"COL",
|
|
1225
1986
|
"IMG",
|
|
1226
1987
|
"INPUT"
|
|
1227
|
-
].includes(
|
|
1988
|
+
].includes(m) ? (c > n && i.push(t.slice(n, c).replace(/[\n\r]/g, " ")), a.push({
|
|
1228
1989
|
inputIndex: c,
|
|
1229
1990
|
inputLength: f,
|
|
1230
1991
|
openingTag: u,
|
|
@@ -1233,7 +1994,7 @@ function at({ removeAWithHref: e } = {}) {
|
|
|
1233
1994
|
}), r -= f) : i.push(t.slice(n, l + 1).replace(/[\n\r]/g, " "));
|
|
1234
1995
|
else if (d) {
|
|
1235
1996
|
let e = o.at(-1);
|
|
1236
|
-
if (
|
|
1997
|
+
if (m === e?.name) switch (o.pop(), e.action) {
|
|
1237
1998
|
case void 0:
|
|
1238
1999
|
i.push(t.slice(n, l + 1).replace(/[\n\r]/g, " "));
|
|
1239
2000
|
break;
|
|
@@ -1260,7 +2021,7 @@ function at({ removeAWithHref: e } = {}) {
|
|
|
1260
2021
|
}), r += e.closingTagReplacement.length - o;
|
|
1261
2022
|
break;
|
|
1262
2023
|
}
|
|
1263
|
-
default:
|
|
2024
|
+
default: _("TagInfos.action", e);
|
|
1264
2025
|
}
|
|
1265
2026
|
else c > n && i.push(t.slice(n, c).replace(/[\n\r]/g, " ")), a.push({
|
|
1266
2027
|
inputIndex: c,
|
|
@@ -1273,10 +2034,10 @@ function at({ removeAWithHref: e } = {}) {
|
|
|
1273
2034
|
"HEAD",
|
|
1274
2035
|
"SCRIPT",
|
|
1275
2036
|
"STYLE"
|
|
1276
|
-
].includes(
|
|
2037
|
+
].includes(m) || e && m === "A" && / href=/i.test(u) || m === "SPAN" && /\bdata-alinea\s*=/i.test(u) && /\bclass\s*=\s*(["'])[^"']*\balinea\b[^"']*\1/i.test(u) || m === "P" && /\bdata-pastille\s*=/i.test(u) && /\bclass\s*=\s*(["'])[^"']*\bpastille\b[^"']*\1/i.test(u)) c > n && i.push(t.slice(n, c).replace(/[\n\r]/g, " ")), o.push({
|
|
1277
2038
|
action: "ignore",
|
|
1278
2039
|
inputIndex: c,
|
|
1279
|
-
name:
|
|
2040
|
+
name: m,
|
|
1280
2041
|
outputFragments: i,
|
|
1281
2042
|
outputOffset: r,
|
|
1282
2043
|
sourceMap: a
|
|
@@ -1299,7 +2060,7 @@ function at({ removeAWithHref: e } = {}) {
|
|
|
1299
2060
|
"THEAD",
|
|
1300
2061
|
"TR",
|
|
1301
2062
|
"UL"
|
|
1302
|
-
].includes(
|
|
2063
|
+
].includes(m)) {
|
|
1303
2064
|
c > n && i.push(t.slice(n, c).replace(/[\n\r]/g, " "));
|
|
1304
2065
|
let e = a.length;
|
|
1305
2066
|
a.push({
|
|
@@ -1311,7 +2072,7 @@ function at({ removeAWithHref: e } = {}) {
|
|
|
1311
2072
|
}), r -= f, o.push({
|
|
1312
2073
|
action: "keep_content",
|
|
1313
2074
|
closingTagReplacement: "",
|
|
1314
|
-
name:
|
|
2075
|
+
name: m,
|
|
1315
2076
|
openingSegmentIndex: e
|
|
1316
2077
|
});
|
|
1317
2078
|
} else if ([
|
|
@@ -1330,7 +2091,7 @@ function at({ removeAWithHref: e } = {}) {
|
|
|
1330
2091
|
"P",
|
|
1331
2092
|
"TD",
|
|
1332
2093
|
"TH"
|
|
1333
|
-
].includes(
|
|
2094
|
+
].includes(m)) {
|
|
1334
2095
|
c > n && i.push(t.slice(n, c).replace(/[\n\r]/g, " ")), i.push("\n");
|
|
1335
2096
|
let e = a.length;
|
|
1336
2097
|
a.push({
|
|
@@ -1342,10 +2103,10 @@ function at({ removeAWithHref: e } = {}) {
|
|
|
1342
2103
|
}), r += 1 - f, o.push({
|
|
1343
2104
|
action: "keep_content",
|
|
1344
2105
|
closingTagReplacement: "\n",
|
|
1345
|
-
name:
|
|
2106
|
+
name: m,
|
|
1346
2107
|
openingSegmentIndex: e
|
|
1347
2108
|
});
|
|
1348
|
-
} else i.push(t.slice(n, l + 1).replace(/[\n\r]/g, " ")), o.push({ name:
|
|
2109
|
+
} else i.push(t.slice(n, l + 1).replace(/[\n\r]/g, " ")), o.push({ name: m });
|
|
1349
2110
|
n = l + 1;
|
|
1350
2111
|
}
|
|
1351
2112
|
return {
|
|
@@ -1356,12 +2117,12 @@ function at({ removeAWithHref: e } = {}) {
|
|
|
1356
2117
|
};
|
|
1357
2118
|
};
|
|
1358
2119
|
}
|
|
1359
|
-
function
|
|
2120
|
+
function yn(e) {
|
|
1360
2121
|
let t = 0, n = [];
|
|
1361
2122
|
return {
|
|
1362
2123
|
input: e,
|
|
1363
2124
|
output: e.replace(/&(amp|apos|asymp|copy|deg|euro|gt|lt|mdash|nbsp|ndash|ne|pound|quot|reg|trade);/gi, (e, r, i) => {
|
|
1364
|
-
let a =
|
|
2125
|
+
let a = _n[r.toLowerCase()];
|
|
1365
2126
|
return n.push({
|
|
1366
2127
|
inputIndex: i,
|
|
1367
2128
|
inputLength: e.length,
|
|
@@ -1373,7 +2134,7 @@ function ot(e) {
|
|
|
1373
2134
|
title: "Décodage des entités HTML nommées"
|
|
1374
2135
|
};
|
|
1375
2136
|
}
|
|
1376
|
-
function
|
|
2137
|
+
function bn(e) {
|
|
1377
2138
|
let t = 0, n = [];
|
|
1378
2139
|
return {
|
|
1379
2140
|
input: e,
|
|
@@ -1390,14 +2151,14 @@ function st(e) {
|
|
|
1390
2151
|
title: "Décodage des entités HTML numériques"
|
|
1391
2152
|
};
|
|
1392
2153
|
}
|
|
1393
|
-
function
|
|
2154
|
+
function xn(e) {
|
|
1394
2155
|
let t = [], n = e;
|
|
1395
2156
|
for (let [e, r] of [
|
|
1396
2157
|
[/<!--.*?-->/gs, ""],
|
|
1397
2158
|
[/<script.*?>.*?<\/script>/gis, ""],
|
|
1398
2159
|
[/<style.*?>.*?<\/style>/gis, ""]
|
|
1399
2160
|
]) {
|
|
1400
|
-
let i =
|
|
2161
|
+
let i = Sn(e, r)(n);
|
|
1401
2162
|
i.sourceMap.length !== 0 && (t.push(i), n = i.output);
|
|
1402
2163
|
}
|
|
1403
2164
|
return {
|
|
@@ -1407,7 +2168,7 @@ function ct(e) {
|
|
|
1407
2168
|
transformations: t
|
|
1408
2169
|
};
|
|
1409
2170
|
}
|
|
1410
|
-
function
|
|
2171
|
+
function Sn(e, t) {
|
|
1411
2172
|
return (n) => {
|
|
1412
2173
|
let r = [], i = n.replaceAll(e, (e, ...n) => {
|
|
1413
2174
|
let i = n.at(-2), a = t;
|
|
@@ -1427,14 +2188,14 @@ function V(e, t) {
|
|
|
1427
2188
|
};
|
|
1428
2189
|
};
|
|
1429
2190
|
}
|
|
1430
|
-
function
|
|
2191
|
+
function Cn(e) {
|
|
1431
2192
|
let t = [], n = e;
|
|
1432
2193
|
for (let [e, r] of [
|
|
1433
2194
|
[/(\sn°)([^\s])/gi, "$1 $2"],
|
|
1434
2195
|
[/[\u200E\u200F]/g, ""],
|
|
1435
2196
|
[/[\uF031-\uF039\uF041-\uF054\uF061-\uF06A]/g, ""]
|
|
1436
2197
|
]) {
|
|
1437
|
-
let i =
|
|
2198
|
+
let i = Sn(e, r)(n);
|
|
1438
2199
|
i.sourceMap.length !== 0 && (t.push(i), n = i.output);
|
|
1439
2200
|
}
|
|
1440
2201
|
return {
|
|
@@ -1444,25 +2205,25 @@ function H(e) {
|
|
|
1444
2205
|
transformations: t
|
|
1445
2206
|
};
|
|
1446
2207
|
}
|
|
1447
|
-
function
|
|
1448
|
-
return (t) =>
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
2208
|
+
function wn({ removeAWithHref: e } = {}) {
|
|
2209
|
+
return (t) => an("Simplification du HTML", [
|
|
2210
|
+
yn,
|
|
2211
|
+
bn,
|
|
2212
|
+
xn,
|
|
2213
|
+
Cn,
|
|
2214
|
+
Dn,
|
|
2215
|
+
vn({ removeAWithHref: e }),
|
|
2216
|
+
En
|
|
1456
2217
|
])(t);
|
|
1457
2218
|
}
|
|
1458
|
-
function
|
|
1459
|
-
return
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
2219
|
+
function Tn(e) {
|
|
2220
|
+
return an("Simplification du texte brut", [
|
|
2221
|
+
Cn,
|
|
2222
|
+
Dn,
|
|
2223
|
+
En
|
|
1463
2224
|
])(e);
|
|
1464
2225
|
}
|
|
1465
|
-
function
|
|
2226
|
+
function En(e) {
|
|
1466
2227
|
let t = [], n = e;
|
|
1467
2228
|
for (let [e, r, i] of [
|
|
1468
2229
|
[
|
|
@@ -1520,8 +2281,8 @@ function W(e) {
|
|
|
1520
2281
|
transformations: t
|
|
1521
2282
|
};
|
|
1522
2283
|
}
|
|
1523
|
-
function
|
|
1524
|
-
return
|
|
2284
|
+
function Dn(e) {
|
|
2285
|
+
return an("Simplification des caractères unicodes", [
|
|
1525
2286
|
["À", "À"],
|
|
1526
2287
|
["Â", "Â"],
|
|
1527
2288
|
["Ä", "Ä"],
|
|
@@ -1556,28 +2317,135 @@ function G(e) {
|
|
|
1556
2317
|
[/[‐‑–·]/g, "-"],
|
|
1557
2318
|
[/’/g, "'"],
|
|
1558
2319
|
["İ", "I"]
|
|
1559
|
-
].map(([e, t]) =>
|
|
2320
|
+
].map(([e, t]) => Sn(e, t)))(e);
|
|
2321
|
+
}
|
|
2322
|
+
//#endregion
|
|
2323
|
+
//#region src/lib/legi/europe_designation.ts
|
|
2324
|
+
var On = [
|
|
2325
|
+
"CE",
|
|
2326
|
+
"CEE",
|
|
2327
|
+
"UE",
|
|
2328
|
+
"EURATOM"
|
|
2329
|
+
], kn = [[
|
|
2330
|
+
"CE",
|
|
2331
|
+
"CEE",
|
|
2332
|
+
"UE"
|
|
2333
|
+
]];
|
|
2334
|
+
function An(e) {
|
|
2335
|
+
return kn.find((t) => t.includes(e)) ?? [e];
|
|
2336
|
+
}
|
|
2337
|
+
var jn = [
|
|
2338
|
+
{
|
|
2339
|
+
code: "CONSEIL_EUROPEEN",
|
|
2340
|
+
pattern: /^conseil\s+européen/iu
|
|
2341
|
+
},
|
|
2342
|
+
{
|
|
2343
|
+
code: "CONSEIL_EUROPE",
|
|
2344
|
+
pattern: /^conseil\s+de\s+l['’]europe/iu
|
|
2345
|
+
},
|
|
2346
|
+
{
|
|
2347
|
+
code: "BCE",
|
|
2348
|
+
pattern: /^banque\s+centrale\s+européenne/iu
|
|
2349
|
+
},
|
|
2350
|
+
{
|
|
2351
|
+
code: "CONSIL",
|
|
2352
|
+
pattern: /^conseil(?:\s+de\s+l['’]union\s+européenne)?/iu
|
|
2353
|
+
},
|
|
2354
|
+
{
|
|
2355
|
+
code: "COM",
|
|
2356
|
+
pattern: /^commission(?:\s+européenne)?/iu
|
|
2357
|
+
},
|
|
2358
|
+
{
|
|
2359
|
+
code: "EP",
|
|
2360
|
+
pattern: /^parlement(?:\s+européen)?/iu
|
|
2361
|
+
}
|
|
2362
|
+
], Mn = /^(?:,\s*)?(?:et\s+)?(?:du\s+|de\s+la\s+|de\s+l['’]\s*|des\s+|de\s+)/iu, Nn = String.raw`(?:du|de la|de l['’]|des)\s+\p{Lu}[\p{L}'’‐-]*(?:\s+[\p{L}'’‐-]+){0,12}`, Pn = new RegExp(String.raw`^\s+${Nn}(?:(?:,\s*|\s+et\s+)${Nn})*`, "u"), Fn = /^(?:,\s*|et\s+)(?:du|de la|de l['’]|des)\s+\p{Lu}/u, In = /^\s*(r[èé]glement|directive|d[ée]cision)(?:\s+(?:délégué[e]?|d['’]exécution))?\s*(?:\(\s*([^)]{2,30}?)\s*\))?\s*(?:n\s*[°ºo]\s*)?(\d{1,4})\s*\/\s*(\d{1,4})(?:\s*\/\s*(\p{L}+))?/iu;
|
|
2363
|
+
function Ln(e) {
|
|
2364
|
+
return e.replaceAll(/[\u00a0\u202f]/gu, " ").replaceAll(/\s+/gu, " ").trim();
|
|
2365
|
+
}
|
|
2366
|
+
function Rn(e) {
|
|
2367
|
+
let t = e.split(/\s*,\s*|\s+/u).map((e) => e.trim().toUpperCase()).filter((e) => e !== "");
|
|
2368
|
+
return {
|
|
2369
|
+
recognized: t.every((e) => On.includes(e)),
|
|
2370
|
+
tokens: t
|
|
2371
|
+
};
|
|
2372
|
+
}
|
|
2373
|
+
function zn({ numero: e, regime: t }) {
|
|
2374
|
+
let n = /* @__PURE__ */ new Set(), r = !0, i = t === void 0 || t.trim() === "" ? void 0 : Ln(t), a = e?.replaceAll(/\s/gu, "").match(/\/(\p{L}+)$/u)?.[1];
|
|
2375
|
+
for (let e of [i, a]) {
|
|
2376
|
+
if (e === void 0) continue;
|
|
2377
|
+
let t = Rn(e);
|
|
2378
|
+
r &&= t.recognized;
|
|
2379
|
+
for (let e of t.tokens) n.add(e);
|
|
2380
|
+
}
|
|
2381
|
+
return {
|
|
2382
|
+
recognized: r,
|
|
2383
|
+
written: [...n].sort()
|
|
2384
|
+
};
|
|
2385
|
+
}
|
|
2386
|
+
function Bn(e) {
|
|
2387
|
+
let t = Ln(e), n = /* @__PURE__ */ new Set();
|
|
2388
|
+
for (; t !== "";) {
|
|
2389
|
+
let e = t.replace(Mn, "");
|
|
2390
|
+
if (e === t) break;
|
|
2391
|
+
let r;
|
|
2392
|
+
for (let { code: t, pattern: i } of jn) {
|
|
2393
|
+
let a = i.exec(e);
|
|
2394
|
+
if (a !== null) {
|
|
2395
|
+
n.add(t), r = a[0];
|
|
2396
|
+
break;
|
|
2397
|
+
}
|
|
2398
|
+
}
|
|
2399
|
+
if (r === void 0) break;
|
|
2400
|
+
t = e.slice(r.length).trim();
|
|
2401
|
+
}
|
|
2402
|
+
if (!Fn.test(t)) return n.size === 0 ? void 0 : [...n].sort();
|
|
2403
|
+
}
|
|
2404
|
+
function Vn(e) {
|
|
2405
|
+
return (Pn.exec(e)?.[0].trim())?.replace(/\s+(?:du|de|des|de la|de l['’])$/iu, "");
|
|
2406
|
+
}
|
|
2407
|
+
function Hn(e, t, n) {
|
|
2408
|
+
let r = new Set(zn({
|
|
2409
|
+
numero: e,
|
|
2410
|
+
...n === void 0 ? {} : { regime: n }
|
|
2411
|
+
}).written);
|
|
2412
|
+
if (t !== void 0) {
|
|
2413
|
+
let e = Rn(t);
|
|
2414
|
+
if (e.recognized) for (let t of e.tokens) r.add(t);
|
|
2415
|
+
}
|
|
2416
|
+
return [...r].sort();
|
|
2417
|
+
}
|
|
2418
|
+
function Un(e) {
|
|
2419
|
+
let t = Ln(e), n = In.exec(t);
|
|
2420
|
+
if (n === null) return;
|
|
2421
|
+
let [, r, i, a, o, s] = n, c = `${a}/${o}`, l = Hn(c, i === void 0 ? void 0 : Ln(i), s), u = Bn(t.slice(n.index + n[0].length));
|
|
2422
|
+
return {
|
|
2423
|
+
...u === void 0 ? {} : { institutions: u },
|
|
2424
|
+
nature: r.toLowerCase().replace(/^réglement/u, "règlement"),
|
|
2425
|
+
numero: c,
|
|
2426
|
+
regimes: l
|
|
2427
|
+
};
|
|
1560
2428
|
}
|
|
1561
2429
|
//#endregion
|
|
1562
2430
|
//#region src/lib/text_parsers/texts.ts
|
|
1563
|
-
var
|
|
1564
|
-
function
|
|
1565
|
-
return
|
|
2431
|
+
var X = {}, Wn = {}, Gn = {}, Kn = {}, qn = {}, Jn = {}, Yn = 0;
|
|
2432
|
+
function Xn() {
|
|
2433
|
+
return Yn;
|
|
1566
2434
|
}
|
|
1567
|
-
function
|
|
1568
|
-
|
|
2435
|
+
function Zn(e) {
|
|
2436
|
+
Yn++;
|
|
1569
2437
|
let t = e ?? {};
|
|
1570
|
-
|
|
2438
|
+
Z(Wn, t.codeTitleVersionsByCid ?? {}), Z(Gn, t.textCidByOtherTitleWordsTree ?? {}), Z(Kn, t.textCidByTitleRestWordsTree ?? {}), Z(X, Object.fromEntries(Object.entries(t.textInfosByCid ?? {}).map(([e, t]) => [e, Array.isArray(t) ? {
|
|
1571
2439
|
nature: t[0],
|
|
1572
2440
|
title: t[1]
|
|
1573
|
-
} : t]))),
|
|
2441
|
+
} : t]))), Z(qn, t.textsCidsByNatureAndDate ?? {}), Z(Jn, t.textsCidsByNatureAndNum ?? {});
|
|
1574
2442
|
}
|
|
1575
|
-
function
|
|
1576
|
-
return [...new Set(e)].filter((e) => (
|
|
2443
|
+
function Qn(e, t) {
|
|
2444
|
+
return [...new Set(e)].filter((e) => (Wn[e] ?? []).some(({ debut: e, fin: n }) => e < n && e <= t && t < n));
|
|
1577
2445
|
}
|
|
1578
|
-
function
|
|
2446
|
+
function $n(e, t) {
|
|
1579
2447
|
let n = (e) => {
|
|
1580
|
-
let n =
|
|
2448
|
+
let n = Wn[e] ?? [], r = n.filter(({ debut: e, fin: n }) => e <= t && t < n), i = (r.length > 0 ? r : n.filter(({ debut: e }) => e <= t)).toSorted((e, t) => t.fin.localeCompare(e.fin) || t.debut.localeCompare(e.debut))[0];
|
|
1581
2449
|
return [
|
|
1582
2450
|
+(r.length > 0),
|
|
1583
2451
|
i?.fin ?? "",
|
|
@@ -1589,17 +2457,17 @@ function vt(e, t) {
|
|
|
1589
2457
|
return i[0] - r[0] || i[1].localeCompare(r[1]) || i[2].localeCompare(r[2]) || e.localeCompare(t);
|
|
1590
2458
|
});
|
|
1591
2459
|
}
|
|
1592
|
-
function
|
|
2460
|
+
function Z(e, t) {
|
|
1593
2461
|
let n = e;
|
|
1594
2462
|
for (let e of Object.keys(n)) delete n[e];
|
|
1595
2463
|
Object.assign(e, t);
|
|
1596
2464
|
}
|
|
1597
|
-
var
|
|
1598
|
-
function
|
|
2465
|
+
var er = (e) => Array.isArray(e) ? e : [e];
|
|
2466
|
+
function tr(e) {
|
|
1599
2467
|
if (e.size < 2) return;
|
|
1600
2468
|
let t = [...e].map((e) => ({
|
|
1601
2469
|
cid: e,
|
|
1602
|
-
...
|
|
2470
|
+
...X[e]
|
|
1603
2471
|
}));
|
|
1604
2472
|
if (t.some(({ cid: e, nature: t, title: n }) => !e.startsWith("JORFTEXT") || t === "CODE" || n === void 0)) return;
|
|
1605
2473
|
let n = t.filter(({ title: e }) => !/ \(rectificatif\)$/iu.test(e));
|
|
@@ -1610,7 +2478,7 @@ function bt(e) {
|
|
|
1610
2478
|
rectificatifCids: t.filter(({ cid: e }) => e !== r.cid).map(({ cid: e }) => e)
|
|
1611
2479
|
} : void 0;
|
|
1612
2480
|
}
|
|
1613
|
-
var
|
|
2481
|
+
var Q = x(y(C("Constitution", { value: "CONSTITUTION" }), C("arrêtés?|circulaires?|code professionnel local|code|décret-loi|décrets?|livre(?= des procédures fiscales)|loi constitutionnelle|loi d'orientation quinquennale|loi d'orientation|loi de programme|loi locale|loi organique|loi quinquennale|loi|ordonnance (?:du Roi|locale|ministérielle|royale)|ordonnance", {
|
|
1614
2482
|
flags: "i",
|
|
1615
2483
|
value: (e) => {
|
|
1616
2484
|
let t = e[0].toLowerCase();
|
|
@@ -1619,11 +2487,11 @@ var Y = v(g(S("Constitution", { value: "CONSTITUTION" }), S("arrêtés?|circulai
|
|
|
1619
2487
|
})), { value: (e) => ({
|
|
1620
2488
|
nature: e,
|
|
1621
2489
|
type: "texte"
|
|
1622
|
-
}) }),
|
|
2490
|
+
}) }), nr = b([S(D, { default: null }), C(String.raw`\d+(-\d+)?`)], { value: (e) => e[1] }), $ = y(N, b([nr, S(Ie, { default: null })], { value: (e) => e[1] === null ? { num: e[0] } : {
|
|
1623
2491
|
...e[1],
|
|
1624
2492
|
num: e[0]
|
|
1625
2493
|
} }));
|
|
1626
|
-
|
|
2494
|
+
C("décision( du Conseil constitutionnel)? (?<numero>[-/0-9A-Z]+ (QPC|DC|AN|D|ELEC|FNR|I|LOM|LP|L|ORGA|PDR|REF|SEN|AUTR|AR16))", {
|
|
1627
2495
|
flags: "i",
|
|
1628
2496
|
value: (e, t) => ({
|
|
1629
2497
|
num: e.groups.numero,
|
|
@@ -1631,84 +2499,84 @@ S("décision( du Conseil constitutionnel)? (?<numero>[-/0-9A-Z]+ (QPC|DC|AN|D|EL
|
|
|
1631
2499
|
type: "décision du Conseil constitutionnel"
|
|
1632
2500
|
})
|
|
1633
2501
|
});
|
|
1634
|
-
var
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
2502
|
+
var rr = S(y(C(" de la République française", { flags: "i" }), C(" du pays", { flags: "i" })), { default: null }), ir = y(b([
|
|
2503
|
+
Q,
|
|
2504
|
+
rr,
|
|
2505
|
+
E,
|
|
2506
|
+
$,
|
|
2507
|
+
C(".*")
|
|
1640
2508
|
], { value: (e) => {
|
|
1641
2509
|
let t = {
|
|
1642
2510
|
...e[0],
|
|
1643
2511
|
...e[3]
|
|
1644
2512
|
}, n = e[4].trim() || void 0;
|
|
1645
2513
|
return n !== void 0 && (t.titleRest = n), t;
|
|
1646
|
-
} }),
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
2514
|
+
} }), b([
|
|
2515
|
+
Q,
|
|
2516
|
+
C("[^()]+"),
|
|
2517
|
+
C(String.raw`\( ?`),
|
|
2518
|
+
$,
|
|
2519
|
+
C(String.raw` ?\)`)
|
|
1652
2520
|
], { value: (e) => {
|
|
1653
2521
|
let t = {
|
|
1654
2522
|
...e[0],
|
|
1655
2523
|
...e[3]
|
|
1656
2524
|
}, n = e[1].trim() || void 0;
|
|
1657
2525
|
return n !== void 0 && (t.titleRest = n), t;
|
|
1658
|
-
} }),
|
|
2526
|
+
} }), b([y(C("code", {
|
|
1659
2527
|
flags: "i",
|
|
1660
2528
|
value: "CODE"
|
|
1661
|
-
}),
|
|
2529
|
+
}), C("livre(?= des procédures fiscales)", {
|
|
1662
2530
|
flags: "i",
|
|
1663
2531
|
value: "CODE"
|
|
1664
|
-
})),
|
|
2532
|
+
})), C(".+")], { value: (e) => {
|
|
1665
2533
|
let t = { ...e[0] }, n = e[1].trim() || void 0;
|
|
1666
2534
|
return n !== void 0 && (t.titleRest = n), t;
|
|
1667
|
-
} })),
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
2535
|
+
} })), ar = y(b([
|
|
2536
|
+
Q,
|
|
2537
|
+
rr,
|
|
2538
|
+
S([E, $], {
|
|
1671
2539
|
default: null,
|
|
1672
2540
|
value: (e) => e[1]
|
|
1673
2541
|
}),
|
|
1674
|
-
|
|
2542
|
+
S([E, x((e) => ie(e.textTitlesInfos?.textCidByTitleRestWordsTree ?? Kn)(e), { value: (e, t) => ({
|
|
1675
2543
|
...e,
|
|
1676
2544
|
titleRest: t.text()
|
|
1677
2545
|
}) })], {
|
|
1678
2546
|
default: null,
|
|
1679
2547
|
value: (e) => e[1]
|
|
1680
2548
|
}),
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
2549
|
+
S([
|
|
2550
|
+
C(String.raw` ?\( ?`),
|
|
2551
|
+
$,
|
|
2552
|
+
C(String.raw` ?\)`)
|
|
1685
2553
|
], {
|
|
1686
2554
|
default: null,
|
|
1687
2555
|
value: (e) => e[1]
|
|
1688
2556
|
}),
|
|
1689
|
-
|
|
2557
|
+
S(ot, { default: "" })
|
|
1690
2558
|
], { value: (e, t) => {
|
|
1691
2559
|
let n = t.textTitlesInfos, r = (e) => {
|
|
1692
|
-
if (!n) return
|
|
2560
|
+
if (!n) return X[e];
|
|
1693
2561
|
let t = n.textInfosByCid[e];
|
|
1694
2562
|
return t && {
|
|
1695
2563
|
nature: t[0],
|
|
1696
2564
|
title: t[1]
|
|
1697
2565
|
};
|
|
1698
|
-
}, i = n?.textsCidsByNatureAndDate ??
|
|
2566
|
+
}, i = n?.textsCidsByNatureAndDate ?? qn, a = n?.textsCidsByNatureAndNum ?? Jn, { nature: o, type: s } = e[0], { date: c, num: l } = e[2] ?? e[4] ?? {}, { cid: u, titleRest: d } = e[3] ?? {};
|
|
1699
2567
|
if (u === void 0 && c === void 0 && l === void 0) return;
|
|
1700
2568
|
let f = /* @__PURE__ */ new Set();
|
|
1701
2569
|
if (c !== void 0) {
|
|
1702
2570
|
let e = i[o]?.[c];
|
|
1703
2571
|
if (e !== void 0) {
|
|
1704
|
-
let t =
|
|
2572
|
+
let t = er(e);
|
|
1705
2573
|
f = f.size === 0 ? new Set(t) : f.intersection(new Set(t));
|
|
1706
2574
|
}
|
|
1707
2575
|
}
|
|
1708
2576
|
if (l !== void 0) {
|
|
1709
2577
|
let e = a[o]?.[l];
|
|
1710
2578
|
if (e !== void 0) {
|
|
1711
|
-
let t =
|
|
2579
|
+
let t = er(e);
|
|
1712
2580
|
f = f.size === 0 ? new Set(t) : f.intersection(new Set(t));
|
|
1713
2581
|
}
|
|
1714
2582
|
}
|
|
@@ -1716,7 +2584,7 @@ var St = x(g(S(" de la République française", { flags: "i" }), S(" du pays", {
|
|
|
1716
2584
|
let e = Array.isArray(u) ? u : [u];
|
|
1717
2585
|
f = f.size === 0 ? new Set(e) : f.intersection(new Set(e.filter((e) => r(e)?.nature === o)));
|
|
1718
2586
|
}
|
|
1719
|
-
let p = f.size > 1 ?
|
|
2587
|
+
let p = f.size > 1 ? tr(f) : void 0, m = f.size === 1 ? f.values().next().value : p?.cid, h = m === void 0 ? void 0 : r(m);
|
|
1720
2588
|
return Object.fromEntries(Object.entries({
|
|
1721
2589
|
cid: m,
|
|
1722
2590
|
candidateCids: f.size > 1 ? [...f] : void 0,
|
|
@@ -1728,82 +2596,93 @@ var St = x(g(S(" de la République française", { flags: "i" }), S(" du pays", {
|
|
|
1728
2596
|
titleRest: d,
|
|
1729
2597
|
type: s
|
|
1730
2598
|
}).filter(([, e]) => e !== void 0));
|
|
1731
|
-
} }),
|
|
2599
|
+
} }), b([(e) => ie(e.textTitlesInfos?.textCidByOtherTitleWordsTree ?? Gn)(e), S(ot, { default: "" })], { value: (e, t) => {
|
|
1732
2600
|
let { cid: n } = e[0], r = typeof n == "string" ? t.textTitlesInfos?.textInfosByCid[n] : void 0, i = t.textTitlesInfos ? r && {
|
|
1733
2601
|
nature: r[0],
|
|
1734
2602
|
title: r[1]
|
|
1735
|
-
} : typeof n == "string" ?
|
|
2603
|
+
} : typeof n == "string" ? X[n] : void 0;
|
|
1736
2604
|
return Object.fromEntries(Object.entries({
|
|
1737
2605
|
cid: n,
|
|
1738
2606
|
...i ?? {},
|
|
1739
2607
|
type: "texte"
|
|
1740
2608
|
}).filter(([, e]) => e !== void 0));
|
|
1741
|
-
} })),
|
|
2609
|
+
} })), or = b([
|
|
1742
2610
|
k,
|
|
1743
|
-
|
|
2611
|
+
C("/"),
|
|
1744
2612
|
k,
|
|
1745
|
-
|
|
1746
|
-
], { value: (e) => `${e[0]}/${e[2]}${e[3] ? `/${e[3]}` : ""}` }),
|
|
2613
|
+
S(C(" ?/ ?(CEE?)", { value: (e) => e[1] }), { default: "" })
|
|
2614
|
+
], { value: (e) => `${e[0]}/${e[2]}${e[3] ? `/${e[3]}` : ""}` }), sr = b([S(D, { default: "" }), or], { value: (e) => e[1] }), cr = y(b([sr, S(Ie, { default: null })], { value: (e) => e[1] === null ? { num: e[0] } : {
|
|
1747
2615
|
...e[1],
|
|
1748
2616
|
num: e[0]
|
|
1749
|
-
} }),
|
|
2617
|
+
} }), N);
|
|
2618
|
+
function lr(e) {
|
|
2619
|
+
return /^\p{Lu}+$/u.test(e) || On.includes(e.toUpperCase());
|
|
2620
|
+
}
|
|
2621
|
+
var ur = b([C("arrêtés?|arrêts?|avis|décisions?|déclarations?|délibérations?|directive(?: d'exécution|déléguée)?|informations?|instructions?|lettres?|recommandations?|règlement(?: d'exécution)?", {
|
|
1750
2622
|
flags: "i",
|
|
1751
2623
|
value: (e) => {
|
|
1752
2624
|
let t = e[0].toLowerCase();
|
|
1753
2625
|
return t.startsWith("arrêté") ? "ARRETEEURO" : t.startsWith("arrêt") ? "ARRETEURO" : t.startsWith("avis") ? "AVISEURO" : t.startsWith("décision") ? "DECISION_EURO" : t.startsWith("déclaration") ? "DECLARATIONEURO" : t.startsWith("délibération") ? "DELIBERATIONEURO" : t.startsWith("directive") ? "DIRECTIVE_EURO" : t.startsWith("information") ? "INFORMATIONEURO" : t.startsWith("instruction") ? "INSTRUCTIONEURO" : t.startsWith("lettre") ? "LETTREEURO" : t.startsWith("recommandation") ? "RECOMMANDATIONEURO" : (t.startsWith("règlement"), "REGLEMENTEUROPEEN");
|
|
1754
2626
|
}
|
|
1755
|
-
}),
|
|
2627
|
+
}), S(C(String.raw`\s*\(\s*(\p{L}{2,10}(?:\s*,\s*\p{L}{2,10})?)\s*\)`, {
|
|
2628
|
+
flags: "v",
|
|
2629
|
+
value: (e) => {
|
|
2630
|
+
let t = e[1].replaceAll(/\s*,\s*/gu, ", ");
|
|
2631
|
+
return t.split(", ").every(lr) ? t : void 0;
|
|
2632
|
+
}
|
|
2633
|
+
}), { default: "" })], { value: (e) => ({
|
|
1756
2634
|
nature: e[0],
|
|
2635
|
+
...e[1] === "" ? {} : { regimeEuropeen: e[1] },
|
|
1757
2636
|
legislation: "UE",
|
|
1758
2637
|
type: "texte"
|
|
1759
|
-
}) }),
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
2638
|
+
}) }), dr = b([
|
|
2639
|
+
ur,
|
|
2640
|
+
E,
|
|
2641
|
+
cr
|
|
1763
2642
|
], { value: (e) => ({
|
|
1764
2643
|
...e[2],
|
|
1765
2644
|
...e[0]
|
|
1766
|
-
}) }),
|
|
2645
|
+
}) }), fr = C("convention", {
|
|
1767
2646
|
flags: "i",
|
|
1768
2647
|
value: {
|
|
1769
2648
|
nature: "CONVENTION",
|
|
1770
2649
|
legislation: "international",
|
|
1771
2650
|
type: "texte"
|
|
1772
2651
|
}
|
|
1773
|
-
}),
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
2652
|
+
}), pr = b([S(H, { default: !1 }), y(b([
|
|
2653
|
+
K,
|
|
2654
|
+
E,
|
|
2655
|
+
y(ar, dr, fr, Q, ur)
|
|
1777
2656
|
], { value: (e) => ({
|
|
1778
2657
|
...e[2],
|
|
1779
2658
|
...e[0] === void 0 ? {} : e[0]
|
|
1780
|
-
}) }),
|
|
2659
|
+
}) }), ar, dr, fr)], { value: (e, t) => {
|
|
1781
2660
|
let n = {
|
|
1782
2661
|
...e[1],
|
|
1783
2662
|
...e[0] ? { ofTheSaid: !0 } : {},
|
|
1784
2663
|
position: t.position()
|
|
1785
2664
|
};
|
|
1786
2665
|
return t.currentText = n, n;
|
|
1787
|
-
} }),
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
2666
|
+
} }), mr = b([C("annexe", { flags: "i" }), S([
|
|
2667
|
+
E,
|
|
2668
|
+
S(D, { default: "" }),
|
|
2669
|
+
b([y(me, k, b([se, C(String.raw`\b`)], { value: (e) => e[0] })), w([le, k])], { value: (e, t) => t.text() })
|
|
1791
2670
|
], {
|
|
1792
2671
|
default: "",
|
|
1793
2672
|
value: (e) => e[2]
|
|
1794
|
-
})], { value: (e) => e[1] }),
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
2673
|
+
})], { value: (e) => e[1] }), hr = y(V, [E, et]), gr = y(b([
|
|
2674
|
+
K,
|
|
2675
|
+
E,
|
|
2676
|
+
C("annexe\\b", { flags: "i" })
|
|
1798
2677
|
], { value: (e, t) => e[0].relative === 0 ? {
|
|
1799
2678
|
nature: "CODE",
|
|
1800
2679
|
sameAnnex: !0,
|
|
1801
2680
|
type: "texte",
|
|
1802
2681
|
position: t.position()
|
|
1803
|
-
} : void 0 }),
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
2682
|
+
} : void 0 }), b([
|
|
2683
|
+
mr,
|
|
2684
|
+
hr,
|
|
2685
|
+
pr
|
|
1807
2686
|
], { value: (e, t) => {
|
|
1808
2687
|
let n = e[2];
|
|
1809
2688
|
return n.nature === "CODE" ? {
|
|
@@ -1811,13 +2690,13 @@ var St = x(g(S(" de la République française", { flags: "i" }), S(" du pays", {
|
|
|
1811
2690
|
annex: e[0],
|
|
1812
2691
|
position: t.position()
|
|
1813
2692
|
} : void 0;
|
|
1814
|
-
} })),
|
|
1815
|
-
|
|
2693
|
+
} })), _r = b([
|
|
2694
|
+
x(mr, { value: (e, t) => ({
|
|
1816
2695
|
annex: e,
|
|
1817
2696
|
position: t.position()
|
|
1818
2697
|
}) }),
|
|
1819
|
-
|
|
1820
|
-
|
|
2698
|
+
hr,
|
|
2699
|
+
pr
|
|
1821
2700
|
], { value: (e, t) => {
|
|
1822
2701
|
let n = e[2];
|
|
1823
2702
|
if (n.nature === "CODE") return;
|
|
@@ -1836,24 +2715,24 @@ var St = x(g(S(" de la République française", { flags: "i" }), S(" du pays", {
|
|
|
1836
2715
|
type: "parent-enfant"
|
|
1837
2716
|
};
|
|
1838
2717
|
} });
|
|
1839
|
-
function
|
|
1840
|
-
let n = e === void 0 ? void 0 :
|
|
2718
|
+
function vr(e, t) {
|
|
2719
|
+
let n = e === void 0 ? void 0 : X[e];
|
|
1841
2720
|
if (n?.nature !== "CODE") return [];
|
|
1842
|
-
let r = new
|
|
2721
|
+
let r = new v(Tn(`${n.title}, annexe${t ? ` ${t}` : ""}`).output), i = ar(r);
|
|
1843
2722
|
return r.remaining() || i === void 0 ? [] : (i.candidateCids ?? (i.cid === void 0 ? [] : [i.cid])).filter((t) => t !== e);
|
|
1844
2723
|
}
|
|
1845
2724
|
//#endregion
|
|
1846
2725
|
//#region src/lib/timings.ts
|
|
1847
|
-
var
|
|
2726
|
+
var yr = class {
|
|
1848
2727
|
label;
|
|
1849
2728
|
enabled;
|
|
1850
2729
|
metrics = [];
|
|
1851
2730
|
startedAt = performance.now();
|
|
1852
|
-
constructor(e, t =
|
|
2731
|
+
constructor(e, t = br()) {
|
|
1853
2732
|
this.label = e, this.enabled = t;
|
|
1854
2733
|
}
|
|
1855
2734
|
add(e) {
|
|
1856
|
-
this.enabled && (this.metrics.push(e),
|
|
2735
|
+
this.enabled && (this.metrics.push(e), xr() && console.info(`[timing:${this.label}]`, JSON.stringify(e)));
|
|
1857
2736
|
}
|
|
1858
2737
|
async time(e, t, n) {
|
|
1859
2738
|
if (!this.enabled) return t();
|
|
@@ -1892,26 +2771,26 @@ var Ft = class {
|
|
|
1892
2771
|
}, null, 2));
|
|
1893
2772
|
}
|
|
1894
2773
|
};
|
|
1895
|
-
function
|
|
2774
|
+
function br() {
|
|
1896
2775
|
let e = globalThis.process?.env;
|
|
1897
2776
|
return e?.PJL_BUILD_TIMINGS === "1" || e?.PJL_BUILD_TIMINGS === "true";
|
|
1898
2777
|
}
|
|
1899
|
-
function
|
|
2778
|
+
function xr() {
|
|
1900
2779
|
let e = globalThis.process?.env;
|
|
1901
2780
|
return e?.PJL_BUILD_TIMINGS_PROGRESS === "1" || e?.PJL_BUILD_TIMINGS_PROGRESS === "true";
|
|
1902
2781
|
}
|
|
1903
2782
|
//#endregion
|
|
1904
2783
|
//#region src/lib/textes.ts
|
|
1905
|
-
var
|
|
2784
|
+
var Sr = (e) => e?.replace(/\n/g, " ").replace(/ {2,}/g, " ").replace(/ \(\d+\)\.?$/, "").replace(/\.$/, ""), Cr = (e) => {
|
|
1906
2785
|
let t = e.META.META_SPEC.META_TEXTE_VERSION.DATE_DEBUT;
|
|
1907
2786
|
return t === void 0 || ["2222-02-22", "2999-01-01"].includes(t) ? e.META.META_SPEC.META_TEXTE_CHRONICLE.DATE_PUBLI : t;
|
|
1908
|
-
},
|
|
2787
|
+
}, wr = (e) => {
|
|
1909
2788
|
let t = e.META.META_SPEC.META_TEXTE_CHRONICLE.DATE_TEXTE;
|
|
1910
2789
|
if (!["2222-02-22", "2999-01-01"].includes(t)) return t;
|
|
1911
2790
|
let n = e.META.META_SPEC.META_TEXTE_VERSION.DATE_DEBUT;
|
|
1912
2791
|
if (n !== void 0 && !["2222-02-22", "2999-01-01"].includes(n)) return n;
|
|
1913
2792
|
throw Error(`Missing date signature in text ${e.META.META_COMMUN.ID}`);
|
|
1914
|
-
},
|
|
2793
|
+
}, Tr = (e) => (t, n) => {
|
|
1915
2794
|
let r = e(t), i = e(n);
|
|
1916
2795
|
if (r !== i) return r.localeCompare(i);
|
|
1917
2796
|
let a = t.META.META_COMMUN, o = a.ORIGINE, s = n.META.META_COMMUN, c = s.ORIGINE;
|
|
@@ -1920,30 +2799,30 @@ var Rt = (e) => e?.replace(/\n/g, " ").replace(/ {2,}/g, " ").replace(/ \(\d+\)\
|
|
|
1920
2799
|
if (c === "JORF") return 1;
|
|
1921
2800
|
}
|
|
1922
2801
|
throw Error(`TODO: Unable to sort texts ${a.ID} & ${s.ID} by date.`);
|
|
1923
|
-
},
|
|
1924
|
-
function
|
|
2802
|
+
}, Er = "current";
|
|
2803
|
+
function Dr(e, t, n, r) {
|
|
1925
2804
|
n != null && ((e[t] ??= {})[n] ??= []).push(r);
|
|
1926
2805
|
}
|
|
1927
|
-
function
|
|
1928
|
-
return
|
|
2806
|
+
function Or(e) {
|
|
2807
|
+
return Tn(e).output;
|
|
1929
2808
|
}
|
|
1930
|
-
function
|
|
1931
|
-
let r =
|
|
2809
|
+
function kr(e, t, n) {
|
|
2810
|
+
let r = Or(Sr(t).replace(/[,()]/g, " ")).split(" ").map((e) => /^[IVX]+$/gi.test(e) ? f(e).toString() : e.toLowerCase().replace(/^no$/, "n°")), i = e;
|
|
1932
2811
|
for (let e of r) i = i[e] ??= {};
|
|
1933
2812
|
i.cid === void 0 ? i.cid = n : Array.isArray(i.cid) ? i.cid.push(n) : i.cid = [i.cid, n];
|
|
1934
2813
|
}
|
|
1935
|
-
async function
|
|
1936
|
-
|
|
2814
|
+
async function Ar(e, t = {}) {
|
|
2815
|
+
Mr(await Pr(e, t));
|
|
1937
2816
|
}
|
|
1938
|
-
var
|
|
1939
|
-
function
|
|
1940
|
-
|
|
2817
|
+
var jr = /* @__PURE__ */ new WeakMap();
|
|
2818
|
+
function Mr(e) {
|
|
2819
|
+
Zn(e), jr.set(e, Xn());
|
|
1941
2820
|
}
|
|
1942
|
-
function
|
|
1943
|
-
return
|
|
2821
|
+
function Nr(e) {
|
|
2822
|
+
return jr.get(e) === Xn();
|
|
1944
2823
|
}
|
|
1945
|
-
async function
|
|
1946
|
-
let n = new
|
|
2824
|
+
async function Pr(e, { onProgress: t } = {}) {
|
|
2825
|
+
let n = new yr("legi.buildTextTitlesInfos"), r = {}, i = {}, a = {}, o = {}, s = {}, c = {}, l = {
|
|
1947
2826
|
addOtherTitleWordsTreeMs: 0,
|
|
1948
2827
|
addTitleRestWordsTreeMs: 0,
|
|
1949
2828
|
cleanTitleMs: 0,
|
|
@@ -1969,12 +2848,12 @@ async function Xt(e, { onProgress: t } = {}) {
|
|
|
1969
2848
|
count: e.length,
|
|
1970
2849
|
phase: "parse:start"
|
|
1971
2850
|
});
|
|
1972
|
-
for (let [n, { cid: l, dateDebut: f, dateFin: p, dateTexte: m, nature:
|
|
2851
|
+
for (let [n, { cid: l, dateDebut: f, dateFin: p, dateTexte: m, nature: h, num: g, title: _ }] of e.entries()) {
|
|
1973
2852
|
n > 0 && n % 2e4 == 0 && (t?.({
|
|
1974
2853
|
count: n,
|
|
1975
2854
|
phase: "parse:progress"
|
|
1976
2855
|
}), await new Promise((e) => setTimeout(e, 0)));
|
|
1977
|
-
let e = d("cleanTitleMs", () =>
|
|
2856
|
+
let e = d("cleanTitleMs", () => Sr(_));
|
|
1978
2857
|
if ([
|
|
1979
2858
|
"code",
|
|
1980
2859
|
"décret",
|
|
@@ -1984,7 +2863,7 @@ async function Xt(e, { onProgress: t } = {}) {
|
|
|
1984
2863
|
u.skippedGenericTitleCount++;
|
|
1985
2864
|
continue;
|
|
1986
2865
|
}
|
|
1987
|
-
if (a[l] = [
|
|
2866
|
+
if (a[l] = [h, e], h === "CODE" && f && p) {
|
|
1988
2867
|
let e = o[l] ??= [];
|
|
1989
2868
|
e.some(({ debut: e, fin: t }) => e === f && t === p) || e.push({
|
|
1990
2869
|
debut: f,
|
|
@@ -2009,32 +2888,32 @@ async function Xt(e, { onProgress: t } = {}) {
|
|
|
2009
2888
|
case "Loi n° 77-1423 du 27 décembre 1977 77-1423 du 27 décembre 1977 autorisant l'approbation de la convention sur le commerce international des espèces de faune et de flore sauvages menacées d'extinction, ensemble quatre annexes, ouverte à la signature à Washington jusqu'au 30 avril 1973 et, après cette date, à Berne jusqu'au 31 décembre 1974":
|
|
2010
2889
|
b.add("Loi n° 77-1423 du 27 décembre 1977 autorisant l'approbation de la convention sur le commerce international des espèces de faune et de flore sauvages menacées d'extinction, ensemble quatre annexes, ouverte à la signature à Washington jusqu'au 30 avril 1973 et, après cette date, à Berne jusqu'au 31 décembre 1974");
|
|
2011
2890
|
break;
|
|
2012
|
-
default: if (b.add(e),
|
|
2891
|
+
default: if (b.add(e), h === "CODE") {
|
|
2013
2892
|
let t = e.replace(/\s+\((?:ancien|nouveau|édition\s+\d{4})\)$/iu, "");
|
|
2014
2893
|
t !== e && b.add(t);
|
|
2015
2894
|
}
|
|
2016
2895
|
}
|
|
2017
2896
|
}), u.otherTitleCount += y.size;
|
|
2018
2897
|
for (let e of b) {
|
|
2019
|
-
let t = d("parseTitleMs", () =>
|
|
2020
|
-
if (t === void 0 &&
|
|
2898
|
+
let t = d("parseTitleMs", () => ir(new v(Or(e))));
|
|
2899
|
+
if (t === void 0 && h === "DECRET" && (u.fallbackDecretTitleCount++, t = {
|
|
2021
2900
|
date: m ?? void 0,
|
|
2022
|
-
nature:
|
|
2023
|
-
num:
|
|
2901
|
+
nature: h,
|
|
2902
|
+
num: g ?? void 0,
|
|
2024
2903
|
titleRest: e.replace(/^Décrets?\s*/i, "").trim() || void 0,
|
|
2025
2904
|
type: "texte"
|
|
2026
|
-
}), t === void 0) throw Error(`Unparsable title of ${
|
|
2905
|
+
}), t === void 0) throw Error(`Unparsable title of ${h} n° ${g ?? ""} du ${m ?? ""} (${l}): ${e}`);
|
|
2027
2906
|
if (u.parsedTitleCount++, d("indexNatureDateNumMs", () => {
|
|
2028
|
-
|
|
2907
|
+
Dr(s, h, t.date, l), Dr(c, h, t.num, l);
|
|
2029
2908
|
}), t.titleRest !== void 0) {
|
|
2030
2909
|
let { titleRest: e } = t;
|
|
2031
2910
|
u.titleRestCount++, d("addTitleRestWordsTreeMs", () => {
|
|
2032
|
-
|
|
2911
|
+
kr(i, e, l);
|
|
2033
2912
|
});
|
|
2034
2913
|
}
|
|
2035
2914
|
}
|
|
2036
2915
|
for (let e of y) d("addOtherTitleWordsTreeMs", () => {
|
|
2037
|
-
|
|
2916
|
+
kr(r, e, l);
|
|
2038
2917
|
});
|
|
2039
2918
|
}
|
|
2040
2919
|
t?.({
|
|
@@ -2043,11 +2922,11 @@ async function Xt(e, { onProgress: t } = {}) {
|
|
|
2043
2922
|
}), t?.({ phase: "compact:start" }), await new Promise((e) => setTimeout(e, 0));
|
|
2044
2923
|
let f = await n.time("compact", async () => ({
|
|
2045
2924
|
codeTitleVersionsByCid: o,
|
|
2046
|
-
textCidByOtherTitleWordsTree:
|
|
2047
|
-
textCidByTitleRestWordsTree:
|
|
2925
|
+
textCidByOtherTitleWordsTree: Ir(r),
|
|
2926
|
+
textCidByTitleRestWordsTree: Ir(i),
|
|
2048
2927
|
textInfosByCid: a,
|
|
2049
|
-
textsCidsByNatureAndDate:
|
|
2050
|
-
textsCidsByNatureAndNum:
|
|
2928
|
+
textsCidsByNatureAndDate: Fr(s),
|
|
2929
|
+
textsCidsByNatureAndNum: Fr(c)
|
|
2051
2930
|
}));
|
|
2052
2931
|
t?.({ phase: "compact:done" });
|
|
2053
2932
|
for (let [e, t] of Object.entries(l)) n.add({
|
|
@@ -2059,10 +2938,10 @@ async function Xt(e, { onProgress: t } = {}) {
|
|
|
2059
2938
|
...u
|
|
2060
2939
|
}), f;
|
|
2061
2940
|
}
|
|
2062
|
-
function
|
|
2941
|
+
function Fr(e) {
|
|
2063
2942
|
return Object.fromEntries(Object.entries(e).map(([e, t]) => [e, Object.fromEntries(Object.entries(t).map(([e, t]) => [e, t.length === 1 ? t[0] : t]))]));
|
|
2064
2943
|
}
|
|
2065
|
-
function
|
|
2944
|
+
function Ir(e) {
|
|
2066
2945
|
let t = {};
|
|
2067
2946
|
e.cid !== void 0 && (t.cid = e.cid);
|
|
2068
2947
|
for (let [n, r] of Object.entries(e)) {
|
|
@@ -2072,13 +2951,13 @@ function $(e) {
|
|
|
2072
2951
|
let [[t, n]] = Object.entries(i);
|
|
2073
2952
|
e += ` ${t}`, i = n;
|
|
2074
2953
|
}
|
|
2075
|
-
t[e] =
|
|
2954
|
+
t[e] = Ir(i);
|
|
2076
2955
|
}
|
|
2077
2956
|
return t;
|
|
2078
2957
|
}
|
|
2079
2958
|
//#endregion
|
|
2080
2959
|
//#region src/lib/legi/article_history.ts
|
|
2081
|
-
function
|
|
2960
|
+
function Lr(e) {
|
|
2082
2961
|
if (e.length === 0) return;
|
|
2083
2962
|
let t = /* @__PURE__ */ new Map();
|
|
2084
2963
|
for (let n of e) {
|
|
@@ -2099,7 +2978,7 @@ function Qt(e) {
|
|
|
2099
2978
|
}
|
|
2100
2979
|
//#endregion
|
|
2101
2980
|
//#region src/lib/legi/publication_components.ts
|
|
2102
|
-
function
|
|
2981
|
+
function Rr(e, t) {
|
|
2103
2982
|
if (e.length !== 2 || new Set(e).size !== 2 || e.some((e) => !/^JORFTEXT\d{12}$/.test(e)) || t.length !== 2 || new Set(t.map(({ cid: e }) => e)).size !== 2 || t.some(({ cid: t }) => !e.includes(t))) return;
|
|
2104
2983
|
let n = t[0];
|
|
2105
2984
|
if (![
|
|
@@ -2124,7 +3003,7 @@ function $t(e, t) {
|
|
|
2124
3003
|
}
|
|
2125
3004
|
//#endregion
|
|
2126
3005
|
//#region src/lib/legi/article_abrogation.ts
|
|
2127
|
-
function
|
|
3006
|
+
function zr({ candidates: e, date: t, missingContext: n, num: r, rows: i, textId: a }) {
|
|
2128
3007
|
if (i.length === 0 || i.length > 128 || e.length !== i.length || n !== 0) return;
|
|
2129
3008
|
let o = new Map(i.map((e) => [e.id, e])), s = (e) => e !== null && /^\d{4}-\d{2}-\d{2}$/.test(e);
|
|
2130
3009
|
if (o.size !== i.length || new Set(e.map(({ id: e }) => e)).size !== i.length) return;
|
|
@@ -2152,15 +3031,15 @@ function en({ candidates: e, date: t, missingContext: n, num: r, rows: i, textId
|
|
|
2152
3031
|
}
|
|
2153
3032
|
//#endregion
|
|
2154
3033
|
//#region src/lib/legi/article_structure.ts
|
|
2155
|
-
function
|
|
3034
|
+
function Br(e, t) {
|
|
2156
3035
|
if (!(e === void 0 || e.length < 2 || e.some(({ dateDebut: e, dateFin: t }) => !/^\d{4}-\d{2}-\d{2}$/.test(e ?? "") || !/^\d{4}-\d{2}-\d{2}$/.test(t ?? "") || e >= t))) return e.every(({ dateDebut: e, dateFin: n }) => e <= t && t < n) ? "valable" : "invalide";
|
|
2157
3036
|
}
|
|
2158
|
-
function
|
|
3037
|
+
function Vr(e, t, n, r, i) {
|
|
2159
3038
|
let a = e.filter(({ dateDebut: e, dateFin: t }) => e < t && e <= n && n < t);
|
|
2160
3039
|
if (a.length < 2 || e.length > 128 || t.size !== a.length || new Set(e.map(({ id: e }) => e)).size !== e.length || e.some(({ id: e, textId: t, num: n }) => !/^LEGIARTI\d{12}$/.test(e) || t !== r || n !== i)) return;
|
|
2161
3040
|
let o = {};
|
|
2162
3041
|
for (let { id: e } of a) {
|
|
2163
|
-
let r =
|
|
3042
|
+
let r = Br(t.get(e), n);
|
|
2164
3043
|
if (r === void 0) return;
|
|
2165
3044
|
o[e] = r;
|
|
2166
3045
|
}
|
|
@@ -2170,8 +3049,54 @@ function nn(e, t, n, r, i) {
|
|
|
2170
3049
|
};
|
|
2171
3050
|
}
|
|
2172
3051
|
//#endregion
|
|
3052
|
+
//#region src/lib/legi/europe_attestation.ts
|
|
3053
|
+
function Hr(t) {
|
|
3054
|
+
return e("sha256").update(t, "utf8").digest("hex");
|
|
3055
|
+
}
|
|
3056
|
+
var Ur = /^[0-9a-f]{64}$/u, Wr = ["Exploratrice", "Forgejo"];
|
|
3057
|
+
function Gr(e) {
|
|
3058
|
+
let t = new v(Tn(e).output), n = nn(t);
|
|
3059
|
+
if (!(n?.type !== "article" || n.num === void 0)) return V(t) === void 0 ? void 0 : n.num;
|
|
3060
|
+
}
|
|
3061
|
+
function Kr(e, t, n) {
|
|
3062
|
+
if (n.match(h) === null) throw Error(`Unknown ID format: ${n}`);
|
|
3063
|
+
switch (e) {
|
|
3064
|
+
case "Exploratrice": return new URL(`legifrance/articles/${n}/versions`, t).toString();
|
|
3065
|
+
case "Forgejo": return;
|
|
3066
|
+
default: _("urlFromArticleVersionsId linkType", e);
|
|
3067
|
+
}
|
|
3068
|
+
}
|
|
3069
|
+
var qr = /^[a-z]+_[0-9a-z]+$/u;
|
|
3070
|
+
function Jr(e, t) {
|
|
3071
|
+
let n = `/europe/documents/${encodeURIComponent(e)}`;
|
|
3072
|
+
return t === void 0 || !qr.test(t.fragment) || !Ur.test(t.empreinte) ? n : `${n}?${new URLSearchParams({
|
|
3073
|
+
version: t.observation,
|
|
3074
|
+
empreinte: t.empreinte,
|
|
3075
|
+
ancre: t.fragment
|
|
3076
|
+
})}#${t.fragment}`;
|
|
3077
|
+
}
|
|
3078
|
+
function Yr(e, t, n) {
|
|
3079
|
+
let r = n.match(h);
|
|
3080
|
+
if (r === null) throw Error(`Unknown ID format: ${n}`);
|
|
3081
|
+
switch (e) {
|
|
3082
|
+
case "Exploratrice": {
|
|
3083
|
+
let e = r[2];
|
|
3084
|
+
switch (e) {
|
|
3085
|
+
case "ARTI": return new URL(`legifrance/articles/${n}`, t).toString();
|
|
3086
|
+
case "CONT": return new URL(`legifrance/journaux_officiels/${n}`, t).toString();
|
|
3087
|
+
case "SCTA": return new URL(`legifrance/sections/${n}`, t).toString();
|
|
3088
|
+
case "TEXT": return new URL(`legifrance/textes/${n}`, t).toString();
|
|
3089
|
+
default: _("urlFromLegalId Exploratrice idType", e);
|
|
3090
|
+
}
|
|
3091
|
+
break;
|
|
3092
|
+
}
|
|
3093
|
+
case "Forgejo": return new URL(g(n, ".md"), t).toString();
|
|
3094
|
+
default: _("urlFromLegalId linkType", e);
|
|
3095
|
+
}
|
|
3096
|
+
}
|
|
3097
|
+
//#endregion
|
|
2173
3098
|
//#region src/lib/legi/resolver.ts
|
|
2174
|
-
var
|
|
3099
|
+
var Xr = class {
|
|
2175
3100
|
getVerifiedPublicationComponents(e) {
|
|
2176
3101
|
return Promise.resolve(void 0);
|
|
2177
3102
|
}
|
|
@@ -2187,7 +3112,17 @@ var rn = class {
|
|
|
2187
3112
|
getArticleHistoryInfo(e) {
|
|
2188
3113
|
return Promise.resolve(void 0);
|
|
2189
3114
|
}
|
|
2190
|
-
|
|
3115
|
+
getEuropeanActIdentity(e) {
|
|
3116
|
+
return Promise.resolve(void 0);
|
|
3117
|
+
}
|
|
3118
|
+
async getEuropeanActCandidates(e) {
|
|
3119
|
+
return (await this.getEuropeanActIdentity(e))?.celexIds;
|
|
3120
|
+
}
|
|
3121
|
+
async getEuropeanTextUrl(e) {
|
|
3122
|
+
let t = await this.getEuropeanActCandidates({ numero: e });
|
|
3123
|
+
return t?.length === 1 ? Jr(t[0]) : void 0;
|
|
3124
|
+
}
|
|
3125
|
+
getEuropeanArticleFragment(e) {
|
|
2191
3126
|
return Promise.resolve(void 0);
|
|
2192
3127
|
}
|
|
2193
3128
|
preloadActiveArticlesByTextIds(e) {
|
|
@@ -2195,4 +3130,4 @@ var rn = class {
|
|
|
2195
3130
|
}
|
|
2196
3131
|
};
|
|
2197
3132
|
//#endregion
|
|
2198
|
-
export {
|
|
3133
|
+
export { En as $, z as $t, Q as A, se as An, q as At, Vn as B, te as Bn, K as Bt, yr as C, k as Cn, pt as Ct, vr as D, Se as Dn, Mt as Dt, _r as E, ge as En, jt as Et, $n as F, v as Fn, G as Ft, vn as G, T as Gn, et as Gt, An as H, ne as Hn, rt as Ht, pr as I, y as In, at as It, xn as J, l as Jn, Qe as Jt, yn as K, ie as Kn, tt as Kt, dr as L, b as Ln, st as Lt, sr as M, D as Mn, J as Mt, nr as N, ue as Nn, U as Nt, ir as O, Te as On, Dt as Ot, rr as P, de as Pn, W as Pt, Tn as Q, R as Qt, ar as R, x as Rn, ct as Rt, Tr as S, fe as Sn, kt as St, gr as T, he as Tn, Et as Tt, Un as U, C as Un, H as Ut, Bn as V, S as Vn, it as Vt, zn as W, w as Wn, $e as Wt, Cn as X, d as Xn, F as Xt, Sn as Y, u as Yn, P as Yt, wn as Z, f as Zn, Ze as Zt, Nr as _, xe as _n, zt as _t, Wr as a, Be as an, mn as at, Cr as b, M as bn, Rt as bt, Hr as c, qe as cn, gn as ct, zr as d, Ge as dn, Wt as dt, B as en, Dn as et, Rr as f, We as fn, Kt as ft, Mr as g, A as gn, Vt as gt, Pr as h, be as hn, Zt as ht, qr as i, ze as in, dn as it, $ as j, ce as jn, dt as jt, cr as k, E as kn, ht as kt, Ur as l, Je as ln, nn as lt, Ar as m, N as mn, Gt as mt, Gr as n, Re as nn, un as nt, Kr as o, Ve as on, pn as ot, Lr as p, Pe as pn, Jt as pt, bn as q, _ as qn, V as qt, Jr as r, He as rn, on as rt, Yr as s, Ke as sn, hn as st, Xr as t, Le as tn, an as tt, Vr as u, Ue as un, en as ut, Er as v, pe as vn, It as vt, Qn as w, me as wn, mt as wt, wr as x, De as xn, Ot as xt, Sr as y, j as yn, Lt as yt, fr as z, ee as zn, lt as zt };
|