@tricoteuses/tisseuse 0.13.11 → 0.13.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server.js +278 -275
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -136,25 +136,25 @@ function oe(e, t) {
|
|
|
136
136
|
stop: n.offset
|
|
137
137
|
};
|
|
138
138
|
}
|
|
139
|
-
function
|
|
139
|
+
function A(e, t) {
|
|
140
140
|
let n = /\d/u.exec(e.slice(t));
|
|
141
141
|
if (!n) return null;
|
|
142
142
|
let r = t + n.index;
|
|
143
143
|
return e.slice(t, r).trim().length > 0 ? null : oe(e, r);
|
|
144
144
|
}
|
|
145
|
-
function
|
|
145
|
+
function se(e) {
|
|
146
146
|
let t = /^la présente loi (?:s['’]appli(?:que|quent)|entr(?:e|ent) en vigueur) (?:[aà] compter (?:du|de|d['’])|au|le)\s*/u, n = /^la présente loi s['’]appli(?:que|quent)\s*:\s*/u, r = /\b[aà] compter (?:du|de|d['’])\s*/gu, i = [], a = "la présente loi", o = e.indexOf(a);
|
|
147
147
|
for (; o !== -1;) {
|
|
148
148
|
let s = e.indexOf(a, o + 15), c = e.slice(o, o + 1400), l = t.exec(c);
|
|
149
149
|
if (l) {
|
|
150
|
-
let e =
|
|
150
|
+
let e = A(c, l[0].length);
|
|
151
151
|
e && i.push(e.date);
|
|
152
152
|
}
|
|
153
153
|
let u = n.exec(c);
|
|
154
154
|
if (u) {
|
|
155
155
|
let e = /\barticle\s+\w/iu.exec(c), t = e === null ? c.slice(u[0].length) : c.slice(u[0].length, e.index);
|
|
156
156
|
for (r.lastIndex = 0; r.exec(t) !== null;) {
|
|
157
|
-
let e =
|
|
157
|
+
let e = A(t, r.lastIndex);
|
|
158
158
|
e && /^\s+pour\s+les\s+autres\s+dispositions\s+fiscales\b/iu.test(t.slice(e.stop)) && i.push(e.date);
|
|
159
159
|
}
|
|
160
160
|
}
|
|
@@ -162,20 +162,20 @@ function ce(e) {
|
|
|
162
162
|
}
|
|
163
163
|
return i;
|
|
164
164
|
}
|
|
165
|
-
function
|
|
166
|
-
let t =
|
|
165
|
+
function ce(e) {
|
|
166
|
+
let t = se(ae(e).toLowerCase()), n = Array.from(new Set(t));
|
|
167
167
|
return n.length === 1 ? n[0] : void 0;
|
|
168
168
|
}
|
|
169
|
-
function
|
|
169
|
+
function j(e) {
|
|
170
170
|
return D(e).replace(/[’]/gu, "'").replace(/[‐‑‒–—]/gu, "-").replace(/^(?:(?:article\s+[^:]+|[a-z][.)]|[ivxlcdm]+\.|\d+°)\s*(?:-\s*)?)+/iu, "");
|
|
171
171
|
}
|
|
172
|
-
function
|
|
172
|
+
function M(e) {
|
|
173
173
|
return e?.type === "tag";
|
|
174
174
|
}
|
|
175
|
-
function
|
|
175
|
+
function N(e, t) {
|
|
176
176
|
return e.html(t) ?? "";
|
|
177
177
|
}
|
|
178
|
-
function
|
|
178
|
+
function le(e, t) {
|
|
179
179
|
let n = [], r = /* @__PURE__ */ new Set();
|
|
180
180
|
for (let i of e(t).find("a").get()) {
|
|
181
181
|
let a = e(i).attr("href") ?? "", o = /\/legifrance\/(articles|sections|textes)\/([^?#"]+)/u.exec(a);
|
|
@@ -186,33 +186,33 @@ function de(e, t) {
|
|
|
186
186
|
let u = E(e(i).text());
|
|
187
187
|
n.push({
|
|
188
188
|
id: c,
|
|
189
|
-
...
|
|
189
|
+
...ue(e, t, i) ? { insideFrenchQuotes: !0 } : {},
|
|
190
190
|
...u ? { text: u } : {},
|
|
191
191
|
type: s
|
|
192
192
|
});
|
|
193
193
|
}
|
|
194
194
|
return n;
|
|
195
195
|
}
|
|
196
|
-
function
|
|
197
|
-
let r =
|
|
196
|
+
function ue(e, t, n) {
|
|
197
|
+
let r = de(e, t, n);
|
|
198
198
|
return (r.match(/«/gu) ?? []).length > (r.match(/»/gu) ?? []).length;
|
|
199
199
|
}
|
|
200
|
-
function
|
|
200
|
+
function de(e, t, n) {
|
|
201
201
|
if (t === n) return "";
|
|
202
202
|
if (t.type === "text") return t.data ?? "";
|
|
203
|
-
if (!
|
|
203
|
+
if (!M(t)) return "";
|
|
204
204
|
let r = "";
|
|
205
205
|
for (let i of e(t).contents().get()) {
|
|
206
206
|
if (i === n) return r;
|
|
207
|
-
if (
|
|
207
|
+
if (M(i) && e.contains(i, n)) return r + de(e, i, n);
|
|
208
208
|
r += e(i).text();
|
|
209
209
|
}
|
|
210
210
|
return r;
|
|
211
211
|
}
|
|
212
|
-
function
|
|
212
|
+
function fe(e, t) {
|
|
213
213
|
return t.map((t) => E(e(t).text())).filter(Boolean).join("\n");
|
|
214
214
|
}
|
|
215
|
-
function
|
|
215
|
+
function P(e) {
|
|
216
216
|
let t = E(e).replace(/\s+:\s+/u, " : "), n = w.exec(t), r = n?.[1]?.trim();
|
|
217
217
|
if (!r) return null;
|
|
218
218
|
let i = r.replace(/\s+/gu, ""), a = n?.[2]?.trim();
|
|
@@ -222,11 +222,11 @@ function M(e) {
|
|
|
222
222
|
title: a
|
|
223
223
|
};
|
|
224
224
|
}
|
|
225
|
-
function
|
|
225
|
+
function pe(e) {
|
|
226
226
|
let t = D(e);
|
|
227
227
|
return !t || T.test(t) ? "noise" : C.test(e) ? "directive_candidate" : "context";
|
|
228
228
|
}
|
|
229
|
-
async function
|
|
229
|
+
async function F(e, t, r) {
|
|
230
230
|
if (r === void 0) throw Error("A document date is required to add links to legal references.");
|
|
231
231
|
if (t.legiResolver === void 0 && t.canutesDb === void 0) throw Error("A Canutes database or an explicit legal resolver is required to add links to legal references.");
|
|
232
232
|
let { output: i } = await n({
|
|
@@ -241,18 +241,21 @@ async function N(e, t, r) {
|
|
|
241
241
|
});
|
|
242
242
|
return i ?? e;
|
|
243
243
|
}
|
|
244
|
-
function
|
|
244
|
+
function me(e, t) {
|
|
245
245
|
let n = e(t).closest("h1,h2,h3,h4,h5,h6,p,td,th").get(0), r = e(t).closest("table").get(0);
|
|
246
|
-
return
|
|
246
|
+
return M(r) && M(n) && e(n).parents("table").get(0) === r ? r : M(n) ? n : t;
|
|
247
247
|
}
|
|
248
|
-
function
|
|
248
|
+
function I(e) {
|
|
249
|
+
return `_TocArt${(e.num ?? e.label.replace(/^Article\s+/iu, "")).replace(/\s*\([^)]*\)\s*$/u, "").replace(/\s+/gu, "")}`;
|
|
250
|
+
}
|
|
251
|
+
function L(e) {
|
|
249
252
|
let t = [], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
250
253
|
e("a[id], span[id], h1[id], h2[id], h3[id], h4[id], h5[id], h6[id]").each((i, a) => {
|
|
251
|
-
let o =
|
|
254
|
+
let o = P(E(e(a).text()));
|
|
252
255
|
if (!o) return;
|
|
253
256
|
let s = e(a).attr("id");
|
|
254
257
|
if (!s || r.has(s)) return;
|
|
255
|
-
let c =
|
|
258
|
+
let c = me(e, a);
|
|
256
259
|
n.has(c) || (r.add(s), n.add(c), t.push({
|
|
257
260
|
id: s,
|
|
258
261
|
...o,
|
|
@@ -261,9 +264,9 @@ function P(e) {
|
|
|
261
264
|
}));
|
|
262
265
|
}), e("h1:not([id]), h2:not([id]), h3:not([id]), h4:not([id]), h5:not([id]), h6:not([id])").each((i, a) => {
|
|
263
266
|
if (n.has(a)) return;
|
|
264
|
-
let o =
|
|
267
|
+
let o = P(E(e(a).text()));
|
|
265
268
|
if (!o) return;
|
|
266
|
-
let s =
|
|
269
|
+
let s = I(o);
|
|
267
270
|
r.has(s) || (r.add(s), n.add(a), t.push({
|
|
268
271
|
id: s,
|
|
269
272
|
...o,
|
|
@@ -274,17 +277,17 @@ function P(e) {
|
|
|
274
277
|
let i = e("body *");
|
|
275
278
|
return t.sort((e, t) => i.index(e.container) - i.index(t.container)), t;
|
|
276
279
|
}
|
|
277
|
-
function
|
|
280
|
+
function he(e) {
|
|
278
281
|
let t = e.next;
|
|
279
282
|
for (; t !== null;) {
|
|
280
|
-
if (
|
|
283
|
+
if (M(t)) return t;
|
|
281
284
|
t = t.next;
|
|
282
285
|
}
|
|
283
286
|
return null;
|
|
284
287
|
}
|
|
285
|
-
function
|
|
288
|
+
function ge(e, t, n) {
|
|
286
289
|
let r = [t.container], i = n?.container;
|
|
287
|
-
for (let e =
|
|
290
|
+
for (let e = he(t.container); e !== null && e !== i; e = he(e)) r.push(e);
|
|
288
291
|
if (r.length > 1) return r;
|
|
289
292
|
let a = e("body *").index(t.container), o = i ? e("body *").index(i) : -1;
|
|
290
293
|
return e("body > *").get().filter((t) => {
|
|
@@ -300,82 +303,82 @@ function _e(e, t) {
|
|
|
300
303
|
}
|
|
301
304
|
return n;
|
|
302
305
|
}
|
|
303
|
-
function
|
|
306
|
+
function ve(e, t, n) {
|
|
304
307
|
let r = [], i = !1;
|
|
305
308
|
for (let a of _e(e, n)) {
|
|
306
309
|
let n = E(e(a).text());
|
|
307
310
|
if (!n) continue;
|
|
308
311
|
T.test(n) && (i = !0);
|
|
309
|
-
let o = i ? "noise" :
|
|
312
|
+
let o = i ? "noise" : pe(n), s = `${t}-b${r.length + 1}`;
|
|
310
313
|
e(a).attr("data-pjl-parsed-article-id", t), e(a).attr("data-pjl-parsed-block-id", s), r.push({
|
|
311
314
|
id: s,
|
|
312
315
|
articleId: t,
|
|
313
316
|
kind: o,
|
|
314
|
-
links:
|
|
317
|
+
links: le(e, a),
|
|
315
318
|
text: n,
|
|
316
|
-
html:
|
|
319
|
+
html: N(e, a)
|
|
317
320
|
});
|
|
318
321
|
}
|
|
319
322
|
return r;
|
|
320
323
|
}
|
|
321
|
-
function
|
|
324
|
+
function ye(e, t) {
|
|
322
325
|
if (t.length === 0) return e;
|
|
323
|
-
let n = `<div style="display: none;">\n${t.map((e) => `<p class="assnatTOC6"><a href="#${
|
|
326
|
+
let n = `<div style="display: none;">\n${t.map((e) => `<p class="assnatTOC6"><a href="#${e.id}"><span class="assnatHyperlink" style="font-weight:bold; text-decoration:none; color:#000000">${e.label.toUpperCase()}</span></a></p>`).join("\n")}\n</div>`;
|
|
324
327
|
return e.includes("class=\"assnatSection3\"") ? e.replace(/(<div class="assnatSection3">)/u, `${n}$1`) : e.includes("id=\"formCorrection:panel:1:table\"") ? e.replace(/(<div id="formCorrection:panel:1:table">)/u, `${n}$1`) : `${n}\n${e}`;
|
|
325
328
|
}
|
|
326
|
-
function
|
|
329
|
+
function be(t) {
|
|
327
330
|
let n = e(t);
|
|
328
|
-
for (let e of
|
|
329
|
-
let t =
|
|
330
|
-
i
|
|
331
|
+
for (let e of L(n)) {
|
|
332
|
+
let t = I(e), r = n(e.element), i = r.attr("id");
|
|
333
|
+
i !== t && (i?.startsWith("_Toc") && !xe(n, i, e.element) && r.before(n("<span></span>").attr("id", i)), r.attr("id", t));
|
|
331
334
|
}
|
|
332
|
-
let r =
|
|
335
|
+
let r = L(n);
|
|
333
336
|
for (let [e, t] of r.entries()) {
|
|
334
|
-
let i =
|
|
337
|
+
let i = ge(n, t, r[e + 1]).flatMap((e) => n(e).is("span.alinea[data-alinea]") ? [e] : n(e).find("span.alinea[data-alinea]").get());
|
|
335
338
|
for (let e of i) {
|
|
336
339
|
let r = n(e).attr("data-alinea")?.trim();
|
|
337
340
|
if (!r) continue;
|
|
338
341
|
let i = `${t.id}-alinea-${r.replace(/\s+/gu, "")}`;
|
|
339
|
-
if (
|
|
342
|
+
if (xe(n, i, e)) continue;
|
|
340
343
|
let a = n(e).attr("id");
|
|
341
344
|
a && a !== i ? n(e).before(n("<span></span>").attr("id", i)) : n(e).attr("id", i);
|
|
342
345
|
}
|
|
343
346
|
}
|
|
344
347
|
return n.html();
|
|
345
348
|
}
|
|
346
|
-
function
|
|
349
|
+
function xe(e, t, n) {
|
|
347
350
|
for (let r of e("[id]").get()) if (r !== n && e(r).attr("id") === t) return !0;
|
|
348
351
|
return !1;
|
|
349
352
|
}
|
|
350
|
-
function
|
|
351
|
-
let n =
|
|
353
|
+
function Se(e, t) {
|
|
354
|
+
let n = j("sourceText" in t ? t.sourceText : "");
|
|
352
355
|
if (n) return e.filter((e) => e.kind === "directive_candidate").find((e) => {
|
|
353
|
-
let t =
|
|
356
|
+
let t = j(e.text);
|
|
354
357
|
return t.length > 0 && (n.includes(t) || t.includes(n));
|
|
355
358
|
});
|
|
356
359
|
}
|
|
357
|
-
function
|
|
360
|
+
function Ce(e, t) {
|
|
358
361
|
if (t) return t.blockIds.map((t) => e.get(t)).find((e) => e?.kind === "directive_candidate");
|
|
359
362
|
}
|
|
360
|
-
function
|
|
363
|
+
function we(e) {
|
|
361
364
|
return e?.links.filter((e) => !e.insideFrenchQuotes && (e.type === "article" || e.type === "division")).map((e) => e.id) ?? [];
|
|
362
365
|
}
|
|
363
|
-
var
|
|
366
|
+
var Te = [
|
|
364
367
|
/^([IVXLCDM]+)\s*[.).]?\s*[–—-]/iu,
|
|
365
368
|
/^(\d+°)\s+/u,
|
|
366
369
|
/^([a-z])\)\s+/iu,
|
|
367
370
|
/^([ivxlcdm]+)\)\s+/iu
|
|
368
371
|
];
|
|
369
|
-
function
|
|
372
|
+
function Ee(e) {
|
|
370
373
|
let t = E(e);
|
|
371
374
|
if (!t) return;
|
|
372
|
-
let n =
|
|
375
|
+
let n = Te.findIndex((e) => e.test(t));
|
|
373
376
|
return n === -1 ? t.endsWith(":") ? 0 : void 0 : n + 1;
|
|
374
377
|
}
|
|
375
|
-
function
|
|
378
|
+
function De(e) {
|
|
376
379
|
let t = /* @__PURE__ */ new Map(), n = [];
|
|
377
380
|
for (let r of e) {
|
|
378
|
-
let e =
|
|
381
|
+
let e = Ee(r.text);
|
|
379
382
|
if (e === void 0) {
|
|
380
383
|
t.set(r.id, [...n, r]);
|
|
381
384
|
continue;
|
|
@@ -384,14 +387,14 @@ function we(e) {
|
|
|
384
387
|
}
|
|
385
388
|
return t;
|
|
386
389
|
}
|
|
387
|
-
function
|
|
390
|
+
function Oe(e, t) {
|
|
388
391
|
let n = [], r = /* @__PURE__ */ new Set();
|
|
389
392
|
for (let i of [...e ?? [], ...t]) i !== void 0 && (r.has(i.id) || (r.add(i.id), n.push(i)));
|
|
390
393
|
return n;
|
|
391
394
|
}
|
|
392
|
-
function
|
|
395
|
+
function ke(e, t, n) {
|
|
393
396
|
if (!t) return;
|
|
394
|
-
let r =
|
|
397
|
+
let r = Oe(e, t.blockIds.map((e) => n.get(e)).filter((e) => e !== void 0));
|
|
395
398
|
if (r.length === 0) return;
|
|
396
399
|
let i = r.map((e) => e.id);
|
|
397
400
|
if (i.length === t.blockIds.length && i.every((e, n) => e === t.blockIds[n])) return;
|
|
@@ -406,7 +409,7 @@ function Ee(e, t, n) {
|
|
|
406
409
|
}
|
|
407
410
|
};
|
|
408
411
|
}
|
|
409
|
-
function
|
|
412
|
+
function Ae(e) {
|
|
410
413
|
let t = [], n = 0;
|
|
411
414
|
for (let r of e.blocks) {
|
|
412
415
|
let i = e.directiveText.indexOf(r.text, n);
|
|
@@ -420,7 +423,7 @@ function De(e) {
|
|
|
420
423
|
}
|
|
421
424
|
return t;
|
|
422
425
|
}
|
|
423
|
-
function
|
|
426
|
+
function je(e, t, n) {
|
|
424
427
|
let { start: r, stop: i } = n.sourcePosition, a = t.filter((e) => e.stop >= r && e.start <= i);
|
|
425
428
|
if (a.length === 0) return;
|
|
426
429
|
let o = a[0], s = a[a.length - 1], c = o.start, l = s.stop;
|
|
@@ -434,7 +437,7 @@ function Oe(e, t, n) {
|
|
|
434
437
|
}
|
|
435
438
|
};
|
|
436
439
|
}
|
|
437
|
-
function
|
|
440
|
+
function Me(e, t, n) {
|
|
438
441
|
if (!t) return;
|
|
439
442
|
let r = e.directiveText.indexOf(t.text);
|
|
440
443
|
if (r === -1) return;
|
|
@@ -447,14 +450,14 @@ function ke(e, t, n) {
|
|
|
447
450
|
stop: a
|
|
448
451
|
};
|
|
449
452
|
}
|
|
450
|
-
function
|
|
451
|
-
let t =
|
|
453
|
+
function Ne(e) {
|
|
454
|
+
let t = Ae(e), n = new Map(e.blocks.map((e) => [e.id, e])), r = De(e.blocks), a = /* @__PURE__ */ new Map(), o = [];
|
|
452
455
|
for (let t of e.blocks) {
|
|
453
|
-
let e =
|
|
456
|
+
let e = we(t);
|
|
454
457
|
e.length > 0 && (o = e), a.set(t.id, o);
|
|
455
458
|
}
|
|
456
459
|
return i(e.directiveText).map((i) => {
|
|
457
|
-
let o =
|
|
460
|
+
let o = je(e, t, i), s = Ce(n, o) ?? Se(e.blocks, i), c = we(s), l = c.length > 0 ? c : s?.id === void 0 ? [] : a.get(s.id) ?? [], u = Me(e, s, i), d = ke(s?.id === void 0 ? void 0 : r.get(s.id), o, n);
|
|
458
461
|
return {
|
|
459
462
|
articleId: e.id,
|
|
460
463
|
blockId: s?.id,
|
|
@@ -474,7 +477,7 @@ function Ae(e) {
|
|
|
474
477
|
};
|
|
475
478
|
});
|
|
476
479
|
}
|
|
477
|
-
function
|
|
480
|
+
function Pe(e) {
|
|
478
481
|
let t = /* @__PURE__ */ new Map(), n = [], r = /* @__PURE__ */ new Set();
|
|
479
482
|
for (let i of e) {
|
|
480
483
|
let e = re(i.directive);
|
|
@@ -504,7 +507,7 @@ function je(e) {
|
|
|
504
507
|
definitions: n
|
|
505
508
|
};
|
|
506
509
|
}
|
|
507
|
-
function
|
|
510
|
+
function Fe(e, t, n) {
|
|
508
511
|
let r = new Map(t.map((e) => [O(e.num), e]));
|
|
509
512
|
return e.map((e) => {
|
|
510
513
|
let t = n.get(e), i = t?.[0], a = [...k(e.directive.reference)].map((e) => r.get(O(e))).filter((e) => e !== void 0 && e.definitionId !== i?.definitionId)[0], o = a === void 0 ? void 0 : {
|
|
@@ -523,7 +526,7 @@ function Me(e, t, n) {
|
|
|
523
526
|
};
|
|
524
527
|
});
|
|
525
528
|
}
|
|
526
|
-
function
|
|
529
|
+
function Ie(e, t, n, i, a, o, s = !0) {
|
|
527
530
|
let c = a.map((e) => e.directiveText).filter(Boolean).join("\n"), l = {
|
|
528
531
|
sourceFormat: e,
|
|
529
532
|
documentDate: i,
|
|
@@ -536,7 +539,7 @@ function Ne(e, t, n, i, a, o, s = !0) {
|
|
|
536
539
|
...l,
|
|
537
540
|
directives: []
|
|
538
541
|
};
|
|
539
|
-
let u =
|
|
542
|
+
let u = ce(a.map((e) => e.text).join("\n")), d = a.flatMap(Ne), { createdArticlesByDirective: f, definitions: p } = Pe(d), m = Fe(d, p, f);
|
|
540
543
|
return {
|
|
541
544
|
...l,
|
|
542
545
|
...u ? { globalApplicabilityDate: u } : {},
|
|
@@ -544,7 +547,7 @@ function Ne(e, t, n, i, a, o, s = !0) {
|
|
|
544
547
|
directives: m
|
|
545
548
|
};
|
|
546
549
|
}
|
|
547
|
-
function
|
|
550
|
+
function Le(e) {
|
|
548
551
|
let t = r(e.map((e) => e.directiveText).filter(Boolean).join("\n")), n = new Map(e.map((e) => [D(e.label), e.id])), i = 0;
|
|
549
552
|
function a(e) {
|
|
550
553
|
for (let t of e.articles ?? []) i += 1, t.id ??= n.get(D(t.line));
|
|
@@ -556,20 +559,20 @@ function Pe(e) {
|
|
|
556
559
|
type: "article"
|
|
557
560
|
})) };
|
|
558
561
|
}
|
|
559
|
-
async function
|
|
560
|
-
let r = new u("parseAssembleeBillRaw"), i = n.linkedHtml === void 0 ? await r.time("linkAssembleeBillRaw", () =>
|
|
561
|
-
let n =
|
|
562
|
+
async function Re(t, n) {
|
|
563
|
+
let r = new u("parseAssembleeBillRaw"), i = n.linkedHtml === void 0 ? await r.time("linkAssembleeBillRaw", () => ze(t, n)) : void 0, a = r.timeSync("applyArticleAnchorIds", () => be(n.linkedHtml ?? i.linkedHtml), { inputSize: t.length }), o = r.timeSync("cheerioLoadLinkedHtml", () => e(a)), s = r.timeSync("extractArticleHeadings", () => L(o)), c = r.timeSync("extractArticlesAndBlocks", () => s.map((e, t) => {
|
|
564
|
+
let n = ge(o, e, s[t + 1]), r = ve(o, e.id, n), i = r.filter((e) => e.kind !== "noise").map((e) => e.text).join("\n");
|
|
562
565
|
return {
|
|
563
566
|
id: e.id,
|
|
564
567
|
label: e.label,
|
|
565
568
|
num: e.num,
|
|
566
569
|
title: e.title,
|
|
567
|
-
text:
|
|
568
|
-
html: n.map((e) =>
|
|
570
|
+
text: fe(o, n),
|
|
571
|
+
html: n.map((e) => N(o, e)).join("\n"),
|
|
569
572
|
directiveText: i,
|
|
570
573
|
blocks: r
|
|
571
574
|
};
|
|
572
|
-
}), { count: s.length }), l = r.timeSync("injectHiddenArticleSummary", () =>
|
|
575
|
+
}), { count: s.length }), l = r.timeSync("injectHiddenArticleSummary", () => ye(o.html(), c)), d = r.timeSync("buildAssembleeTableOfContents", () => Le(c), { count: c.length }), f = r.timeSync("buildParsedDocument", () => Ie("assemblee-html", t, l, n.date, c, d, n.includeDirectiveAnalysis));
|
|
573
576
|
return r.log({
|
|
574
577
|
articleCount: f.articles.length,
|
|
575
578
|
blockCount: f.articles.reduce((e, t) => e + t.blocks.length, 0),
|
|
@@ -577,18 +580,18 @@ async function Fe(t, n) {
|
|
|
577
580
|
targetDirectiveCount: f.directives.filter((e) => e.targetIds !== void 0).length
|
|
578
581
|
}), f;
|
|
579
582
|
}
|
|
580
|
-
async function
|
|
583
|
+
async function ze(e, t) {
|
|
581
584
|
return {
|
|
582
585
|
sourceFormat: "assemblee-html",
|
|
583
586
|
documentDate: t.date,
|
|
584
587
|
html: e,
|
|
585
|
-
linkedHtml: await
|
|
588
|
+
linkedHtml: await F(e, t, t.date)
|
|
586
589
|
};
|
|
587
590
|
}
|
|
588
|
-
function
|
|
591
|
+
function R(e) {
|
|
589
592
|
return e.replace(/&/gu, "&").replace(/</gu, "<").replace(/>/gu, ">").replace(/"/gu, """);
|
|
590
593
|
}
|
|
591
|
-
function
|
|
594
|
+
function Be(e) {
|
|
592
595
|
let t = e;
|
|
593
596
|
for (let e = 0; e < 3; e++) {
|
|
594
597
|
let e = t;
|
|
@@ -596,25 +599,25 @@ function Le(e) {
|
|
|
596
599
|
}
|
|
597
600
|
return t;
|
|
598
601
|
}
|
|
599
|
-
function
|
|
602
|
+
function z(e) {
|
|
600
603
|
return /(?:<|&lt;)\/?(?:p|br|span|b|i|u|sup|sub|table|thead|tbody|tr|th|td|ul|ol|li)\b/iu.test(e);
|
|
601
604
|
}
|
|
602
|
-
function
|
|
605
|
+
function B(e) {
|
|
603
606
|
return e.name.replace(/^.*:/u, "");
|
|
604
607
|
}
|
|
605
|
-
function
|
|
608
|
+
function V(e, t) {
|
|
606
609
|
return t.children.map((t) => H(e, t)).filter(Boolean).join("");
|
|
607
610
|
}
|
|
608
|
-
function
|
|
609
|
-
return t.children.map((t) => t.type === "text" &&
|
|
611
|
+
function Ve(e, t) {
|
|
612
|
+
return t.children.map((t) => t.type === "text" && z(t.data) ? Be(t.data) : H(e, t)).filter(Boolean).join("");
|
|
610
613
|
}
|
|
611
614
|
function H(e, t) {
|
|
612
615
|
if (t.type === "text") {
|
|
613
616
|
let e = t.data.replace(/\s+\./gu, ".");
|
|
614
|
-
return
|
|
617
|
+
return z(e) ? Be(e) : R(e);
|
|
615
618
|
}
|
|
616
|
-
if (!
|
|
617
|
-
let n =
|
|
619
|
+
if (!M(t)) return "";
|
|
620
|
+
let n = B(t), r = V(e, t);
|
|
618
621
|
switch (n) {
|
|
619
622
|
case "p": return `<p${U(e, t, [
|
|
620
623
|
"id",
|
|
@@ -636,7 +639,7 @@ function H(e, t) {
|
|
|
636
639
|
"title",
|
|
637
640
|
"style"
|
|
638
641
|
])}>${r}</${n}>`;
|
|
639
|
-
case "a": return `<a href="${
|
|
642
|
+
case "a": return `<a href="${R(e(t).attr("href") ?? e(t).attr("target") ?? "#")}"${U(e, t, [
|
|
640
643
|
"id",
|
|
641
644
|
"class",
|
|
642
645
|
"title",
|
|
@@ -647,7 +650,7 @@ function H(e, t) {
|
|
|
647
650
|
case "tbody":
|
|
648
651
|
case "tr":
|
|
649
652
|
case "th":
|
|
650
|
-
case "td": return
|
|
653
|
+
case "td": return He(e, t, n, r);
|
|
651
654
|
case "caption": return `<caption${U(e, t, [
|
|
652
655
|
"id",
|
|
653
656
|
"class",
|
|
@@ -656,12 +659,12 @@ function H(e, t) {
|
|
|
656
659
|
])}>${r}</caption>`;
|
|
657
660
|
case "num": return `<span class="akn-num">${r}</span> `;
|
|
658
661
|
case "heading": return `<p class="akn-heading">${r}</p>`;
|
|
659
|
-
case "content": return
|
|
660
|
-
case "alinea": return
|
|
661
|
-
case "article": return
|
|
662
|
+
case "content": return Ve(e, t);
|
|
663
|
+
case "alinea": return K(e, t, "div", "akn-alinea");
|
|
664
|
+
case "article": return K(e, t, "article", "akn-article");
|
|
662
665
|
case "blockList":
|
|
663
666
|
case "list": return `<div class="akn-list">${r}</div>`;
|
|
664
|
-
case "item": return
|
|
667
|
+
case "item": return K(e, t, "div", "akn-item");
|
|
665
668
|
case "listIntroduction":
|
|
666
669
|
case "listWrapUp":
|
|
667
670
|
case "intro":
|
|
@@ -677,7 +680,7 @@ function H(e, t) {
|
|
|
677
680
|
case "book":
|
|
678
681
|
case "tome":
|
|
679
682
|
case "subchapter":
|
|
680
|
-
case "subsection": return
|
|
683
|
+
case "subsection": return K(e, t, "section", `akn-${n}`);
|
|
681
684
|
case "crossHeading": return `<p class="akn-cross-heading">${r}</p>`;
|
|
682
685
|
default: return r;
|
|
683
686
|
}
|
|
@@ -687,12 +690,12 @@ function U(e, t, n, r = {}) {
|
|
|
687
690
|
for (let r of n) {
|
|
688
691
|
if (r === "style") continue;
|
|
689
692
|
let n = e(t).attr(r);
|
|
690
|
-
n !== void 0 && i.push(`${r}="${
|
|
693
|
+
n !== void 0 && i.push(`${r}="${R(n)}"`);
|
|
691
694
|
}
|
|
692
695
|
let a = r.style ?? e(t).attr("style");
|
|
693
|
-
return a && i.push(`style="${
|
|
696
|
+
return a && i.push(`style="${R(a)}"`), i.length > 0 ? ` ${i.join(" ")}` : "";
|
|
694
697
|
}
|
|
695
|
-
function
|
|
698
|
+
function He(e, t, n, r) {
|
|
696
699
|
return `<${n}${U(e, t, [
|
|
697
700
|
"id",
|
|
698
701
|
"class",
|
|
@@ -706,105 +709,105 @@ function Ve(e, t, n, r) {
|
|
|
706
709
|
"cellspacing",
|
|
707
710
|
"cellpadding",
|
|
708
711
|
"style"
|
|
709
|
-
], { style:
|
|
712
|
+
], { style: Ue(e, t, n) })}>${r}</${n}>`;
|
|
710
713
|
}
|
|
711
|
-
function
|
|
714
|
+
function Ue(e, t, n) {
|
|
712
715
|
let r = e(t).attr("style") ?? "";
|
|
713
|
-
return (n === "td" || n === "th") && /font-weight\s*:\s*bold/iu.test(r) && !/text-align\s*:/iu.test(r) && (r =
|
|
716
|
+
return (n === "td" || n === "th") && /font-weight\s*:\s*bold/iu.test(r) && !/text-align\s*:/iu.test(r) && (r = We(r, "text-align", "center")), r || void 0;
|
|
714
717
|
}
|
|
715
|
-
function
|
|
718
|
+
function We(e, t, n) {
|
|
716
719
|
let r = e.trim();
|
|
717
720
|
return `${r}${r && !r.endsWith(";") ? ";" : ""} ${t}: ${n};`.trim();
|
|
718
721
|
}
|
|
719
|
-
function
|
|
722
|
+
function Ge(e, t) {
|
|
720
723
|
let n = [E(e(t).children("num").first().text()), E(e(t).children("heading").first().text())].filter(Boolean);
|
|
721
|
-
return n.length === 0 ? "" : `<p class="akn-heading">${
|
|
724
|
+
return n.length === 0 ? "" : `<p class="akn-heading">${R(n.join(" "))}</p>`;
|
|
722
725
|
}
|
|
723
|
-
function
|
|
726
|
+
function Ke(e, t) {
|
|
724
727
|
if (!t) return !1;
|
|
725
728
|
let n = (e) => E(e).replace(/\s+/gu, " ").replace(/\s*[..]\s*(?=[–—-])/gu, " ").trim();
|
|
726
729
|
return n(E(e.replace(/<[^>]*>/gu, " ").replace(/ /gu, " ").replace(/ /giu, " ").replace(/–/giu, "–"))).startsWith(n(t));
|
|
727
730
|
}
|
|
728
|
-
function
|
|
729
|
-
let t =
|
|
731
|
+
function qe(e) {
|
|
732
|
+
let t = R(e);
|
|
730
733
|
return `<p data-pastille="${t}" class="pastille"><span aria-label="pastille ${t}">${t}</span></p>`;
|
|
731
734
|
}
|
|
732
|
-
function
|
|
733
|
-
return
|
|
735
|
+
function Je(e, t) {
|
|
736
|
+
return Ye([Xe({
|
|
734
737
|
content: e,
|
|
735
738
|
pastille: t
|
|
736
739
|
})]);
|
|
737
740
|
}
|
|
738
|
-
function
|
|
741
|
+
function Ye(e) {
|
|
739
742
|
return `<table class="fixed-size large akn-pastille-table"><colgroup><col style="width: 5.0%;" class="texte-col-0 texte-col-pastille"><col style="width: 95.0%;" class="texte-col-1"></colgroup><tbody>${e.join("\n")}</tbody></table>`;
|
|
740
743
|
}
|
|
741
|
-
function
|
|
742
|
-
let i = n ? ` style="${
|
|
743
|
-
return `<tr${r ? ` class="${
|
|
744
|
+
function Xe({ content: e, pastille: t, style: n, contextClass: r }) {
|
|
745
|
+
let i = n ? ` style="${R(n)}"` : "", a = r ? ` ${R(r)}` : "";
|
|
746
|
+
return `<tr${r ? ` class="${R(r)} hideable"` : ""}><td style="overflow: hidden; width: 5.0%;" class="texte-col-0 texte-col-pastille no-right-border"><div class="tableauComparatifCell${a}">${qe(t)}</div></td><td style="overflow: hidden; width: 95.0%;" class="texte-col-1 no-right-border"><div class="tableauComparatifCell${a}"${i}>${e}</div></td></tr>`;
|
|
744
747
|
}
|
|
745
|
-
function
|
|
746
|
-
let r = t ? ` style="${
|
|
747
|
-
return `<tr${n ? ` class="${
|
|
748
|
+
function W({ content: e, style: t, contextClass: n }) {
|
|
749
|
+
let r = t ? ` style="${R(t)}"` : "", i = n ? ` ${R(n)}` : "";
|
|
750
|
+
return `<tr${n ? ` class="${R(n)} hideable"` : ""}><td style="overflow: hidden; width: 5.0%;" class="texte-col-0 no-right-border"><div class="tableauComparatifCell${i}"><p class="pastille"><br></p></div></td><td style="overflow: hidden; width: 95.0%;" class="texte-col-1 no-right-border"><div class="tableauComparatifCell${i}"${r}>${e}</div></td></tr>`;
|
|
748
751
|
}
|
|
749
|
-
function
|
|
752
|
+
function Ze(e, t) {
|
|
750
753
|
return e(t).attr("data:pastille") ?? e(t).attr("pastille");
|
|
751
754
|
}
|
|
752
|
-
function
|
|
755
|
+
function Qe(e, t) {
|
|
753
756
|
return e(t).find("alinea[data\\:pastille],alinea[pastille]").length > 0;
|
|
754
757
|
}
|
|
755
|
-
function
|
|
756
|
-
return e(t).children().get().filter((e) =>
|
|
758
|
+
function $e(e, t) {
|
|
759
|
+
return e(t).children().get().filter((e) => M(e) ? B(e) === "content" : !1).map((t) => H(e, t)).filter(Boolean).join("\n");
|
|
757
760
|
}
|
|
758
|
-
function
|
|
761
|
+
function et(e, t) {
|
|
759
762
|
let n = [];
|
|
760
763
|
return e(t).children().each((t, r) => {
|
|
761
|
-
if (!
|
|
762
|
-
let i =
|
|
764
|
+
if (!M(r)) return;
|
|
765
|
+
let i = B(r);
|
|
763
766
|
i === "num" || i === "heading" || i === "content" || n.push(H(e, r));
|
|
764
767
|
}), n.filter(Boolean);
|
|
765
768
|
}
|
|
766
|
-
function
|
|
767
|
-
let n = [], r =
|
|
769
|
+
function G(e, t) {
|
|
770
|
+
let n = [], r = B(t), i = r === "alinea" ? Ze(e, t) : void 0, a = $e(e, t), o = tt(e, t, r, i), s = st(e, t);
|
|
768
771
|
if (i) {
|
|
769
|
-
let r = [
|
|
770
|
-
E(r) && n.push(
|
|
772
|
+
let r = [Ke(a, E(e(t).children("num").first().text())) ? "" : Ge(e, t), a].filter(Boolean).join("\n");
|
|
773
|
+
E(r) && n.push(Xe({
|
|
771
774
|
content: r,
|
|
772
775
|
pastille: i,
|
|
773
776
|
style: o,
|
|
774
777
|
contextClass: s
|
|
775
778
|
}));
|
|
776
|
-
} else a && n.push(
|
|
779
|
+
} else a && n.push(W({
|
|
777
780
|
content: a,
|
|
778
781
|
style: o,
|
|
779
782
|
contextClass: s
|
|
780
783
|
}));
|
|
781
784
|
for (let r of e(t).children().get()) {
|
|
782
|
-
if (!
|
|
783
|
-
let t =
|
|
784
|
-
t === "num" || t === "heading" || t === "content" || (t === "alinea" ||
|
|
785
|
+
if (!M(r)) continue;
|
|
786
|
+
let t = B(r);
|
|
787
|
+
t === "num" || t === "heading" || t === "content" || (t === "alinea" || Qe(e, r)) && n.push(...G(e, r));
|
|
785
788
|
}
|
|
786
789
|
return n;
|
|
787
790
|
}
|
|
788
|
-
function
|
|
789
|
-
let i =
|
|
790
|
-
a ? `id="${
|
|
791
|
+
function K(e, t, n, r) {
|
|
792
|
+
let i = B(t), a = e(t).attr("eId") ?? e(t).attr("GUID"), o = Ze(e, t), s = tt(e, t, i, o), c = [`<${n} ${[
|
|
793
|
+
a ? `id="${R(a)}"` : void 0,
|
|
791
794
|
`class="${r}"`,
|
|
792
|
-
o ? `data-pastille="${
|
|
793
|
-
s ? `style="${
|
|
795
|
+
o ? `data-pastille="${R(o)}"` : void 0,
|
|
796
|
+
s ? `style="${R(s)}"` : void 0
|
|
794
797
|
].filter((e) => e !== void 0).join(" ")}>`];
|
|
795
798
|
if (i === "part" || i === "title") {
|
|
796
|
-
let r =
|
|
799
|
+
let r = it(e, t, i), a = ot(e, t), o = r ? [W({
|
|
797
800
|
content: r,
|
|
798
801
|
contextClass: a
|
|
799
802
|
})] : [], s = () => {
|
|
800
|
-
o.length !== 0 && (c.push(
|
|
803
|
+
o.length !== 0 && (c.push(rt(o)), o = []);
|
|
801
804
|
};
|
|
802
805
|
return e(t).children().each((t, n) => {
|
|
803
|
-
if (!
|
|
804
|
-
let r =
|
|
806
|
+
if (!M(n)) return;
|
|
807
|
+
let r = B(n);
|
|
805
808
|
if (!(r === "num" || r === "heading" || r === "content")) {
|
|
806
809
|
if (r === "alinea") {
|
|
807
|
-
o.push(...
|
|
810
|
+
o.push(...G(e, n));
|
|
808
811
|
return;
|
|
809
812
|
}
|
|
810
813
|
s(), c.push(H(e, n));
|
|
@@ -812,49 +815,49 @@ function q(e, t, n, r) {
|
|
|
812
815
|
}), s(), c.push(`</${n}>`), c.join("\n");
|
|
813
816
|
}
|
|
814
817
|
if (i === "article") {
|
|
815
|
-
let r = E(e(t).children("num").first().text()), i = E(e(t).children("heading").first().text()), a =
|
|
818
|
+
let r = E(e(t).children("num").first().text()), i = E(e(t).children("heading").first().text()), a = P(r) ?? {
|
|
816
819
|
label: r,
|
|
817
820
|
num: r
|
|
818
|
-
}, o = `<p class="TCNumArticle as-text toc-article dispositif" id="${
|
|
819
|
-
if (
|
|
820
|
-
let r = [
|
|
821
|
+
}, o = `<p class="TCNumArticle as-text toc-article dispositif" id="${R(`_TocArt${(a.num ?? r).replace(/\s+/gu, "")}`)}">${R(a.label)}${i ? ` : ${R(i)}` : ""}</p>`;
|
|
822
|
+
if (Qe(e, t)) {
|
|
823
|
+
let r = [W({
|
|
821
824
|
content: o,
|
|
822
|
-
contextClass:
|
|
823
|
-
}), ...
|
|
824
|
-
c.push(
|
|
825
|
-
for (let n of
|
|
825
|
+
contextClass: lt(a.label)
|
|
826
|
+
}), ...G(e, t)];
|
|
827
|
+
c.push(Ye(r));
|
|
828
|
+
for (let n of et(e, t)) n.includes("akn-pastille-table") || c.push(n);
|
|
826
829
|
return c.push(`</${n}>`), c.join("\n");
|
|
827
830
|
}
|
|
828
831
|
c.push(o);
|
|
829
832
|
}
|
|
830
833
|
let l = [];
|
|
831
834
|
for (let n of ["content", "children"]) e(t).children().each((t, r) => {
|
|
832
|
-
if (!
|
|
833
|
-
let i =
|
|
835
|
+
if (!M(r)) return;
|
|
836
|
+
let i = B(r);
|
|
834
837
|
i === "num" || i === "heading" || n === "content" && i !== "content" || n === "children" && i === "content" || l.push(H(e, r));
|
|
835
838
|
});
|
|
836
839
|
let u = l.join("\n");
|
|
837
840
|
if (i !== "article") {
|
|
838
|
-
let n =
|
|
841
|
+
let n = Ke(u, E(e(t).children("num").first().text())) ? "" : Ge(e, t);
|
|
839
842
|
n && c.push(n);
|
|
840
843
|
}
|
|
841
|
-
return c.push(o ?
|
|
844
|
+
return c.push(o ? Je(u, o) : u), c.push(`</${n}>`), c.join("\n");
|
|
842
845
|
}
|
|
843
|
-
function
|
|
844
|
-
let i =
|
|
845
|
-
return !r && n !== "article" && /font-weight\s*:\s*bold/iu.test(i) && !/text-align\s*:/iu.test(i) && (i =
|
|
846
|
+
function tt(e, t, n, r) {
|
|
847
|
+
let i = nt(e(t).attr("style") ?? "", "font-family");
|
|
848
|
+
return !r && n !== "article" && /font-weight\s*:\s*bold/iu.test(i) && !/text-align\s*:/iu.test(i) && (i = We(i, "text-align", "center")), i || void 0;
|
|
846
849
|
}
|
|
847
|
-
function
|
|
850
|
+
function nt(e, t) {
|
|
848
851
|
return e.split(";").map((e) => e.trim()).filter(Boolean).filter((e) => !e.toLowerCase().startsWith(`${t.toLowerCase()}:`)).join(";");
|
|
849
852
|
}
|
|
850
|
-
function
|
|
853
|
+
function rt(e) {
|
|
851
854
|
return `<table class="fixed-size large akn-section-table"><colgroup><col style="width: 5.0%;" class="texte-col-0 texte-col-pastille"><col style="width: 95.0%;" class="texte-col-1"></colgroup><tbody>${e.join("\n")}</tbody></table>`;
|
|
852
855
|
}
|
|
853
|
-
function
|
|
854
|
-
let r = E(e(t).children("num").first().text()), i = E(e(t).children("heading").first().text()), a =
|
|
855
|
-
return r && o.push(`<p class="${a.num} as-text dispositif"><span aria-label="">${
|
|
856
|
+
function it(e, t, n) {
|
|
857
|
+
let r = E(e(t).children("num").first().text()), i = E(e(t).children("heading").first().text()), a = at(n), o = [];
|
|
858
|
+
return r && o.push(`<p class="${a.num} as-text dispositif"><span aria-label="">${R(r)}</span></p>`), i && o.push(`<p class="${a.heading} as-text dispositif"><span aria-label="">${R(i)}</span></p>`), o.join("\n");
|
|
856
859
|
}
|
|
857
|
-
function
|
|
860
|
+
function at(e) {
|
|
858
861
|
switch (e) {
|
|
859
862
|
case "part": return {
|
|
860
863
|
num: "TCNumPartie",
|
|
@@ -878,21 +881,21 @@ function rt(e) {
|
|
|
878
881
|
};
|
|
879
882
|
}
|
|
880
883
|
}
|
|
881
|
-
function
|
|
882
|
-
let n =
|
|
884
|
+
function ot(e, t) {
|
|
885
|
+
let n = ct(E(e(t).children("num").first().text()));
|
|
883
886
|
if (n) return n;
|
|
884
887
|
for (let n of e(t).parents().get()) {
|
|
885
|
-
if (!
|
|
886
|
-
let t =
|
|
888
|
+
if (!M(n)) continue;
|
|
889
|
+
let t = B(n);
|
|
887
890
|
if (t !== "title" && t !== "part") continue;
|
|
888
|
-
let r =
|
|
891
|
+
let r = ct(E(e(n).children("num").first().text()));
|
|
889
892
|
if (r) return r;
|
|
890
893
|
}
|
|
891
894
|
}
|
|
892
|
-
function
|
|
893
|
-
return
|
|
895
|
+
function st(e, t) {
|
|
896
|
+
return ot(e, t);
|
|
894
897
|
}
|
|
895
|
-
function
|
|
898
|
+
function ct(e) {
|
|
896
899
|
let [t, ...n] = E(e).split(/\s+/u);
|
|
897
900
|
if (!t || n.length === 0) return;
|
|
898
901
|
let r = t.toLocaleLowerCase("fr-FR");
|
|
@@ -903,10 +906,10 @@ function ot(e) {
|
|
|
903
906
|
"section"
|
|
904
907
|
].includes(r)) return `${r}-${n.join("_")}`;
|
|
905
908
|
}
|
|
906
|
-
function
|
|
909
|
+
function lt(e) {
|
|
907
910
|
return `article-${E(e).replace(/^Article\s+/iu, "").replace(/\s+/gu, "_")} article`;
|
|
908
911
|
}
|
|
909
|
-
function
|
|
912
|
+
function ut(e) {
|
|
910
913
|
switch (e) {
|
|
911
914
|
case "part": return "partie";
|
|
912
915
|
case "book": return "livre";
|
|
@@ -918,11 +921,11 @@ function ct(e) {
|
|
|
918
921
|
default: return;
|
|
919
922
|
}
|
|
920
923
|
}
|
|
921
|
-
function
|
|
924
|
+
function dt(e, t) {
|
|
922
925
|
return [E(e(t).children("num").first().text()), E(e(t).children("heading").first().text())].filter(Boolean).join(" ");
|
|
923
926
|
}
|
|
924
|
-
function
|
|
925
|
-
let n = E(e(t).children("num").first().text()), r = E(e(t).children("heading").first().text()), i =
|
|
927
|
+
function ft(e, t) {
|
|
928
|
+
let n = E(e(t).children("num").first().text()), r = E(e(t).children("heading").first().text()), i = P(n) ?? {
|
|
926
929
|
label: n,
|
|
927
930
|
num: n
|
|
928
931
|
};
|
|
@@ -932,24 +935,24 @@ function ut(e, t) {
|
|
|
932
935
|
type: "article"
|
|
933
936
|
};
|
|
934
937
|
}
|
|
935
|
-
function
|
|
938
|
+
function pt(e, t) {
|
|
936
939
|
t.articles?.length && (e.articles ??= [], e.articles.push(...t.articles)), t.divisions?.length && (e.divisions ??= [], e.divisions.push(...t.divisions));
|
|
937
940
|
}
|
|
938
|
-
function
|
|
941
|
+
function q(e, t) {
|
|
939
942
|
let n = {};
|
|
940
943
|
return e(t).children().each((t, r) => {
|
|
941
|
-
if (!
|
|
942
|
-
let i =
|
|
944
|
+
if (!M(r)) return;
|
|
945
|
+
let i = B(r);
|
|
943
946
|
if (i === "article") {
|
|
944
|
-
n.articles ??= [], n.articles.push(
|
|
947
|
+
n.articles ??= [], n.articles.push(ft(e, r));
|
|
945
948
|
return;
|
|
946
949
|
}
|
|
947
|
-
let a =
|
|
950
|
+
let a = ut(i);
|
|
948
951
|
if (!a) {
|
|
949
|
-
|
|
952
|
+
pt(n, q(e, r));
|
|
950
953
|
return;
|
|
951
954
|
}
|
|
952
|
-
let o =
|
|
955
|
+
let o = dt(e, r), s = q(e, r);
|
|
953
956
|
!o && !s.articles?.length && !s.divisions?.length || (n.divisions ??= [], n.divisions.push({
|
|
954
957
|
...s,
|
|
955
958
|
id: e(r).attr("eId") ?? e(r).attr("GUID"),
|
|
@@ -958,26 +961,26 @@ function J(e, t) {
|
|
|
958
961
|
}));
|
|
959
962
|
}), n;
|
|
960
963
|
}
|
|
961
|
-
function
|
|
964
|
+
function mt(e) {
|
|
962
965
|
let t = e("body").first().get(0);
|
|
963
|
-
return t === void 0 ? {} :
|
|
966
|
+
return t === void 0 ? {} : q(e, t);
|
|
964
967
|
}
|
|
965
|
-
function
|
|
968
|
+
function ht(e) {
|
|
966
969
|
return e("FRBRExpression FRBRdate[name=\"#depot\"]").attr("date") ?? e("FRBRWork FRBRdate[name=\"#presentation\"]").attr("date");
|
|
967
970
|
}
|
|
968
|
-
function
|
|
971
|
+
function gt(e) {
|
|
969
972
|
let t = e("preamble").first(), n = e("body").first(), r = ["<div class=\"akn-bill\">"];
|
|
970
|
-
return t.length > 0 && (r.push("<section class=\"akn-preamble\">"), r.push(
|
|
971
|
-
|
|
973
|
+
return t.length > 0 && (r.push("<section class=\"akn-preamble\">"), r.push(V(e, t.get(0))), r.push("</section>")), r.push("<section class=\"akn-body\">"), n.children().each((t, n) => {
|
|
974
|
+
M(n) && r.push(B(n) === "article" ? K(e, n, "article", "akn-article") : H(e, n));
|
|
972
975
|
}), r.push("</section></div>"), r.join("\n");
|
|
973
976
|
}
|
|
974
|
-
function
|
|
977
|
+
function _t(t) {
|
|
975
978
|
let n = e(t, { xml: {
|
|
976
979
|
decodeEntities: !1,
|
|
977
980
|
lowerCaseTags: !1,
|
|
978
981
|
lowerCaseAttributeNames: !1,
|
|
979
982
|
xmlMode: !0
|
|
980
|
-
} }), r =
|
|
983
|
+
} }), r = ht(n), i = gt(n);
|
|
981
984
|
return {
|
|
982
985
|
sourceFormat: "akoma-ntoso",
|
|
983
986
|
documentDate: r,
|
|
@@ -985,42 +988,42 @@ function ht(t) {
|
|
|
985
988
|
linkedHtml: i
|
|
986
989
|
};
|
|
987
990
|
}
|
|
988
|
-
function
|
|
989
|
-
return
|
|
991
|
+
function vt(t) {
|
|
992
|
+
return yt(e(t));
|
|
990
993
|
}
|
|
991
|
-
function
|
|
994
|
+
function yt(e) {
|
|
992
995
|
let t = [];
|
|
993
996
|
return e("article.akn-article").each((n, r) => {
|
|
994
|
-
let i = e(r).children("p.TCNumArticle").first().get(0), a = E(i ? e(i).text() : ""), o =
|
|
997
|
+
let i = e(r).children("p.TCNumArticle").first().get(0), a = E(i ? e(i).text() : ""), o = P(a) ?? { label: a || `Article ${n + 1}` }, s = e(r).attr("id") ?? `akn-article-${String(n + 1).padStart(3, "0")}`, c = [r], l = ve(e, s, c), u = l.filter((e) => e.kind !== "noise").map((e) => e.text).join("\n");
|
|
995
998
|
t.push({
|
|
996
999
|
id: s,
|
|
997
1000
|
label: o.label,
|
|
998
1001
|
num: o.num,
|
|
999
1002
|
title: o.title,
|
|
1000
|
-
text:
|
|
1001
|
-
html:
|
|
1003
|
+
text: fe(e, c),
|
|
1004
|
+
html: N(e, r),
|
|
1002
1005
|
directiveText: u,
|
|
1003
1006
|
blocks: l
|
|
1004
1007
|
});
|
|
1005
1008
|
}), t;
|
|
1006
1009
|
}
|
|
1007
|
-
function
|
|
1010
|
+
function bt(t) {
|
|
1008
1011
|
let n = e(t);
|
|
1009
1012
|
return {
|
|
1010
|
-
articles:
|
|
1013
|
+
articles: yt(n),
|
|
1011
1014
|
htmlWithLinks: n.html()
|
|
1012
1015
|
};
|
|
1013
1016
|
}
|
|
1014
|
-
async function
|
|
1017
|
+
async function xt(t, n) {
|
|
1015
1018
|
let r = new u("parseAkomaNtosoBillRaw"), i = r.timeSync("cheerioLoadXml", () => e(t, { xml: {
|
|
1016
1019
|
decodeEntities: !1,
|
|
1017
1020
|
lowerCaseTags: !1,
|
|
1018
1021
|
lowerCaseAttributeNames: !1,
|
|
1019
1022
|
xmlMode: !0
|
|
1020
|
-
} })), a = n.date ??
|
|
1023
|
+
} })), a = n.date ?? ht(i), o = r.timeSync("renderAknHtml", () => gt(i), { inputSize: t.length }), s = n.linkedHtml ?? await r.time("addLinksToRenderedAknHtml", () => F(o, {
|
|
1021
1024
|
...n,
|
|
1022
1025
|
date: a
|
|
1023
|
-
}, a)), c = r.timeSync("extractRenderedAknArticles", () =>
|
|
1026
|
+
}, a)), c = r.timeSync("extractRenderedAknArticles", () => vt(o)), l = r.timeSync("injectHiddenArticleSummary", () => ye(s, c)), { articles: d, htmlWithLinks: f } = r.timeSync("extractLinkedAknArticlesAndTaggedHtml", () => bt(l)), p = d.length > 0 ? d : c, m = r.timeSync("extractAknTableOfContents", () => mt(i)), h = r.timeSync("buildParsedDocument", () => Ie("akoma-ntoso", o, d.length > 0 ? f : l, a, p, m));
|
|
1024
1027
|
return r.log({
|
|
1025
1028
|
articleCount: h.articles.length,
|
|
1026
1029
|
blockCount: h.articles.reduce((e, t) => e + t.blocks.length, 0),
|
|
@@ -1028,25 +1031,25 @@ async function yt(t, n) {
|
|
|
1028
1031
|
targetDirectiveCount: h.directives.filter((e) => e.targetIds !== void 0).length
|
|
1029
1032
|
}), h;
|
|
1030
1033
|
}
|
|
1031
|
-
async function
|
|
1032
|
-
let n =
|
|
1034
|
+
async function St(e, t) {
|
|
1035
|
+
let n = _t(e), r = t.date ?? n.documentDate;
|
|
1033
1036
|
return {
|
|
1034
1037
|
sourceFormat: "akoma-ntoso",
|
|
1035
1038
|
documentDate: r,
|
|
1036
1039
|
html: n.html,
|
|
1037
|
-
linkedHtml: await
|
|
1040
|
+
linkedHtml: await F(n.html, t, r)
|
|
1038
1041
|
};
|
|
1039
1042
|
}
|
|
1040
1043
|
//#endregion
|
|
1041
1044
|
//#region src/lib/server/assemblee_document_search.ts
|
|
1042
|
-
var
|
|
1043
|
-
function
|
|
1045
|
+
var Ct = /\bexpos[ée]\s+des\s+motifs\b/giu, wt = /\barticle\s+(?:premier|1er|\d+)/iu;
|
|
1046
|
+
function J(e) {
|
|
1044
1047
|
return e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim();
|
|
1045
1048
|
}
|
|
1046
|
-
function
|
|
1047
|
-
let n =
|
|
1049
|
+
function Y(t) {
|
|
1050
|
+
let n = J(e(t).text()), r = [...n.matchAll(Ct)], i = /* @__PURE__ */ new Set(), a = [];
|
|
1048
1051
|
for (let [e, t] of r.entries()) {
|
|
1049
|
-
let o = (t.index ?? 0) + t[0].length, s = n.slice(o), c =
|
|
1052
|
+
let o = (t.index ?? 0) + t[0].length, s = n.slice(o), c = wt.exec(s), l = J(s.slice(0, c?.index ?? s.length));
|
|
1050
1053
|
if (l.length < 20 || i.has(l)) continue;
|
|
1051
1054
|
i.add(l);
|
|
1052
1055
|
let u = `expose-des-motifs-${e + 1}`;
|
|
@@ -1062,8 +1065,8 @@ function Ct(t) {
|
|
|
1062
1065
|
}
|
|
1063
1066
|
return a;
|
|
1064
1067
|
}
|
|
1065
|
-
async function
|
|
1066
|
-
let i = await
|
|
1068
|
+
async function Tt({ date: e, html: t, linkBaseUrl: n, linkType: r }) {
|
|
1069
|
+
let i = await Re(t, {
|
|
1067
1070
|
date: e,
|
|
1068
1071
|
includeDirectiveAnalysis: !1,
|
|
1069
1072
|
linkBaseUrl: n,
|
|
@@ -1072,7 +1075,7 @@ async function wt({ date: e, html: t, linkBaseUrl: n, linkType: r }) {
|
|
|
1072
1075
|
});
|
|
1073
1076
|
return {
|
|
1074
1077
|
items: [...i.articles.map((e) => {
|
|
1075
|
-
let t =
|
|
1078
|
+
let t = J(e.directiveText || e.text);
|
|
1076
1079
|
if (t) return {
|
|
1077
1080
|
anchor: e.id,
|
|
1078
1081
|
articleNumber: e.num ?? null,
|
|
@@ -1082,17 +1085,17 @@ async function wt({ date: e, html: t, linkBaseUrl: n, linkType: r }) {
|
|
|
1082
1085
|
label: e.label,
|
|
1083
1086
|
title: e.title ?? null
|
|
1084
1087
|
};
|
|
1085
|
-
}).filter((e) => e !== void 0), ...
|
|
1088
|
+
}).filter((e) => e !== void 0), ...Y(t)],
|
|
1086
1089
|
tableOfContents: i.tableOfContents
|
|
1087
1090
|
};
|
|
1088
1091
|
}
|
|
1089
|
-
function
|
|
1092
|
+
function Et(e, t) {
|
|
1090
1093
|
return h("sha256").update(JSON.stringify({
|
|
1091
1094
|
item: e,
|
|
1092
1095
|
metadata: t
|
|
1093
1096
|
})).digest("hex");
|
|
1094
1097
|
}
|
|
1095
|
-
function
|
|
1098
|
+
function Dt(e) {
|
|
1096
1099
|
if (typeof e != "object" || !e) return;
|
|
1097
1100
|
let t = e.cycleDeVie?.chrono;
|
|
1098
1101
|
if (t !== void 0) for (let e of [
|
|
@@ -1107,11 +1110,11 @@ function Et(e) {
|
|
|
1107
1110
|
}
|
|
1108
1111
|
//#endregion
|
|
1109
1112
|
//#region src/lib/server/senat_amendment_search.ts
|
|
1110
|
-
function
|
|
1113
|
+
function Ot(t) {
|
|
1111
1114
|
return t?.trim() ? e(t).text().replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim() : "";
|
|
1112
1115
|
}
|
|
1113
|
-
function
|
|
1114
|
-
let n =
|
|
1116
|
+
function kt({ dispositifHtml: e, objetHtml: t }) {
|
|
1117
|
+
let n = Ot(e), r = Ot(t);
|
|
1115
1118
|
return [...n ? [{
|
|
1116
1119
|
content: n,
|
|
1117
1120
|
itemKind: "dispositif",
|
|
@@ -1122,7 +1125,7 @@ function Ot({ dispositifHtml: e, objetHtml: t }) {
|
|
|
1122
1125
|
label: "Objet"
|
|
1123
1126
|
}] : []];
|
|
1124
1127
|
}
|
|
1125
|
-
function
|
|
1128
|
+
function At(e, t) {
|
|
1126
1129
|
return h("sha256").update(JSON.stringify({
|
|
1127
1130
|
item: e,
|
|
1128
1131
|
metadata: t
|
|
@@ -1130,12 +1133,12 @@ function kt(e, t) {
|
|
|
1130
1133
|
}
|
|
1131
1134
|
//#endregion
|
|
1132
1135
|
//#region src/lib/server/senat_document_search.ts
|
|
1133
|
-
var
|
|
1136
|
+
var jt = /^article\s+(.+?)(?:\s*[::]\s*(.+))?$/iu;
|
|
1134
1137
|
function X(e) {
|
|
1135
1138
|
return e.replace(/\u00a0/gu, " ").replace(/\s+/gu, " ").trim();
|
|
1136
1139
|
}
|
|
1137
|
-
function
|
|
1138
|
-
let t = e.match(
|
|
1140
|
+
function Mt(e) {
|
|
1141
|
+
let t = e.match(jt);
|
|
1139
1142
|
if (!t) return {
|
|
1140
1143
|
articleNumber: null,
|
|
1141
1144
|
label: e,
|
|
@@ -1148,7 +1151,7 @@ function jt(e) {
|
|
|
1148
1151
|
title: r
|
|
1149
1152
|
};
|
|
1150
1153
|
}
|
|
1151
|
-
function
|
|
1154
|
+
function Nt(t) {
|
|
1152
1155
|
let n = e(t), r = [], i = X(n("section.akn-preamble").text());
|
|
1153
1156
|
return i && r.push({
|
|
1154
1157
|
anchor: "senat-expose-des-motifs",
|
|
@@ -1159,7 +1162,7 @@ function Mt(t) {
|
|
|
1159
1162
|
label: "Exposé des motifs",
|
|
1160
1163
|
title: null
|
|
1161
1164
|
}), n("article.akn-article").each((e, t) => {
|
|
1162
|
-
let i = n(t), a = i.attr("id") || `akn-article-${e + 1}`, o = X(i.children("p.TCNumArticle").first().text()), s = `Article ${e + 1}`, c =
|
|
1165
|
+
let i = n(t), a = i.attr("id") || `akn-article-${e + 1}`, o = X(i.children("p.TCNumArticle").first().text()), s = `Article ${e + 1}`, c = Mt(o || s), l = i.clone();
|
|
1163
1166
|
l.children("p.TCNumArticle").remove();
|
|
1164
1167
|
let u = X(l.text());
|
|
1165
1168
|
u && r.push({
|
|
@@ -1173,7 +1176,7 @@ function Mt(t) {
|
|
|
1173
1176
|
});
|
|
1174
1177
|
}), r;
|
|
1175
1178
|
}
|
|
1176
|
-
function
|
|
1179
|
+
function Pt(e, t) {
|
|
1177
1180
|
return h("sha256").update(JSON.stringify({
|
|
1178
1181
|
item: e,
|
|
1179
1182
|
metadata: t
|
|
@@ -1181,25 +1184,25 @@ function Nt(e, t) {
|
|
|
1181
1184
|
}
|
|
1182
1185
|
//#endregion
|
|
1183
1186
|
//#region src/lib/server/senat_document_sources.ts
|
|
1184
|
-
var
|
|
1185
|
-
function
|
|
1187
|
+
var Ft = new Set(["senat.fr", "www.senat.fr"]), Z = "https://www.senat.fr";
|
|
1188
|
+
function It(e) {
|
|
1186
1189
|
return e?.trim() || void 0;
|
|
1187
1190
|
}
|
|
1188
|
-
function
|
|
1191
|
+
function Lt(e) {
|
|
1189
1192
|
try {
|
|
1190
1193
|
let t = e.replace(/^\/+/, ""), n = /^https?:\/\//iu.test(e) ? new URL(e) : new URL(/^(?:akomantoso|leg)\//iu.test(t) ? `/${t}` : `/leg/${t}`, Z);
|
|
1191
|
-
return
|
|
1194
|
+
return Ft.has(n.hostname.toLowerCase()) ? n : void 0;
|
|
1192
1195
|
} catch {
|
|
1193
1196
|
return;
|
|
1194
1197
|
}
|
|
1195
1198
|
}
|
|
1196
|
-
function
|
|
1197
|
-
let t =
|
|
1199
|
+
function Rt(e) {
|
|
1200
|
+
let t = It(e);
|
|
1198
1201
|
if (t === void 0) return {
|
|
1199
1202
|
publicUrl: null,
|
|
1200
1203
|
status: "no_url"
|
|
1201
1204
|
};
|
|
1202
|
-
let n =
|
|
1205
|
+
let n = Lt(t);
|
|
1203
1206
|
if (n === void 0) return {
|
|
1204
1207
|
publicUrl: t,
|
|
1205
1208
|
status: "unsupported_source"
|
|
@@ -1220,12 +1223,12 @@ function Lt(e) {
|
|
|
1220
1223
|
status: "available"
|
|
1221
1224
|
};
|
|
1222
1225
|
}
|
|
1223
|
-
function
|
|
1226
|
+
function zt(e) {
|
|
1224
1227
|
return /^\s*(?:<\?xml\b[^>]*>\s*)?<akomaNtoso[\s/>]/iu.test(e);
|
|
1225
1228
|
}
|
|
1226
1229
|
//#endregion
|
|
1227
1230
|
//#region src/lib/alineas/alineas_numbers.ts
|
|
1228
|
-
var
|
|
1231
|
+
var Bt = {
|
|
1229
1232
|
"0150a855548f15a2af52ea057be53f5d": 1,
|
|
1230
1233
|
"039826cf379b94afefe90b25c6045ca0": 1,
|
|
1231
1234
|
"03a7e564b84662f4d957c51018e26244": 1,
|
|
@@ -20199,7 +20202,7 @@ var zt = {
|
|
|
20199
20202
|
d16d29c923bd60c7b095b66c6058fe60: 1664,
|
|
20200
20203
|
"1c14c2adf5cfda3220b2057160e10e91": 1665,
|
|
20201
20204
|
e44c55ca1ac46ff46420686a466c9fc6: 1665
|
|
20202
|
-
},
|
|
20205
|
+
}, Vt = "\np:has(.alinea) {\n margin: 0.6em 0;\n}\n.alinea {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 1.5em;\n height: 1.5em;\n padding: 0 0.3em;\n margin-right: 0.3em;\n font-size: 0.75em;\n font-weight: bold;\n color: #555;\n background-color: #f0f0f0;\n border: 1px solid #ccc;\n border-radius: 1em;\n vertical-align: middle;\n}\n", Ht = "\nh1 {\n font-size: 1.8em;\n margin: 1em 0 0.5em 0;\n}\nh2 {\n font-size: 1.5em;\n margin: 0.9em 0 0.4em 0;\n}\nh3 {\n font-size: 1.3em;\n margin: 0.8em 0 0.4em 0;\n}\nh4 {\n font-size: 1.15em;\n margin: 0.7em 0 0.3em 0;\n}\nh5 {\n font-size: 1.05em;\n margin: 0.6em 0 0.3em 0;\n}\nh6 {\n font-size: 1em;\n margin: 0.5em 0 0.3em 0;\n}\n", Ut = "\n.expose-motifs-titre {\n font-size: 1.1em;\n font-weight: bold;\n color: #0070b9;\n margin: 1em 0 0.5em 0;\n}\n.expose-motifs {\n border-left: 3px solid #0070b9;\n padding-left: 1em;\n margin: 0.5em 0 1em 0;\n color: #333;\n}\n.expose-motifs p {\n margin: 0.5em 0;\n}\n", Wt = "\nol {\n list-style: none;\n padding-left: 0;\n margin: 0.5em 0;\n counter-reset: list-counter;\n}\nol > li {\n counter-increment: list-counter;\n margin: 0.3em 0;\n padding-left: 2.3em;\n position: relative;\n}\nol > li::before {\n content: counter(list-counter);\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 1.5em;\n height: 1.5em;\n padding: 0 0.3em;\n font-size: 0.75em;\n font-weight: bold;\n color: #555;\n background-color: #f0f0f0;\n border: 1px solid #ccc;\n border-radius: 1em;\n position: absolute;\n left: 0;\n top: 0.1em;\n}\n", Gt = "\n.cover-title {\n font-size: 1.8em;\n font-weight: bold;\n color: #0070b9;\n text-align: center;\n margin: 1em 0;\n}\n.cover-subtitle {\n font-size: 1.4em;\n font-weight: bold;\n color: #0070b9;\n text-align: center;\n margin: 0.8em 0;\n}\n.cover-info {\n text-align: center;\n margin: 0.3em 0;\n color: #333;\n}\n.cover-year {\n font-size: 2em;\n font-weight: bold;\n color: #0070b9;\n text-align: center;\n margin: 1em 0;\n}\n", Kt = {
|
|
20203
20206
|
assnatetatagr: { bold: !0 },
|
|
20204
20207
|
assnatetatagrgr: { bold: !0 },
|
|
20205
20208
|
assnatetatatr: { bold: !0 },
|
|
@@ -20300,29 +20303,29 @@ var zt = {
|
|
|
20300
20303
|
assnatxl67: { align: "center" },
|
|
20301
20304
|
assnatenteteequilibre: { align: "center" }
|
|
20302
20305
|
};
|
|
20303
|
-
function
|
|
20304
|
-
let t = Object.keys(
|
|
20305
|
-
for (let n of t) if (e.includes(n)) return
|
|
20306
|
+
function qt(e) {
|
|
20307
|
+
let t = Object.keys(Kt).sort((e, t) => t.length - e.length);
|
|
20308
|
+
for (let n of t) if (e.includes(n)) return Kt[n];
|
|
20306
20309
|
return null;
|
|
20307
20310
|
}
|
|
20308
|
-
function
|
|
20311
|
+
function Jt(e) {
|
|
20309
20312
|
return m.createHash("md5").update(e).digest("hex");
|
|
20310
20313
|
}
|
|
20311
|
-
function
|
|
20314
|
+
function Yt(e) {
|
|
20312
20315
|
return e ? /font-weight\s*:\s*(bold|[6-9]00|1000)/i.test(e) || /font-family\s*:\s*[^;]*\bBold\b/i.test(e) : !1;
|
|
20313
20316
|
}
|
|
20314
|
-
function
|
|
20317
|
+
function Xt(e) {
|
|
20315
20318
|
return e ? /font-style\s*:\s*italic/i.test(e) || /font-family\s*:\s*[^;]*\bItalic\b/i.test(e) : !1;
|
|
20316
20319
|
}
|
|
20317
|
-
function
|
|
20320
|
+
function Zt(e) {
|
|
20318
20321
|
if (!e || !/vertical-align\s*:\s*super/i.test(e)) return !1;
|
|
20319
20322
|
let t = e.match(/font-size\s*:\s*([\d.]+)pt/i);
|
|
20320
20323
|
return !(t && parseFloat(t[1]) < 8);
|
|
20321
20324
|
}
|
|
20322
|
-
function
|
|
20325
|
+
function Qt(e) {
|
|
20323
20326
|
return e ? /vertical-align\s*:\s*sub/i.test(e) : !1;
|
|
20324
20327
|
}
|
|
20325
|
-
function
|
|
20328
|
+
function $t(e) {
|
|
20326
20329
|
if (!e) return;
|
|
20327
20330
|
let t = [
|
|
20328
20331
|
"width",
|
|
@@ -20357,15 +20360,15 @@ function Qt(e) {
|
|
|
20357
20360
|
}
|
|
20358
20361
|
return n.length > 0 ? n.join("; ") : void 0;
|
|
20359
20362
|
}
|
|
20360
|
-
function
|
|
20363
|
+
function en(e, t) {
|
|
20361
20364
|
return !!(e && /text-align\s*:\s*center/i.test(e) || t && /center/i.test(t));
|
|
20362
20365
|
}
|
|
20363
|
-
function
|
|
20366
|
+
function tn(e) {
|
|
20364
20367
|
if (!e) return null;
|
|
20365
20368
|
let t = e.match(/text-align\s*:\s*(left|center|right|justify)/i);
|
|
20366
20369
|
return t ? t[1].toLowerCase() : null;
|
|
20367
20370
|
}
|
|
20368
|
-
function
|
|
20371
|
+
function nn(e) {
|
|
20369
20372
|
if (!e) return null;
|
|
20370
20373
|
for (let [t, n] of [
|
|
20371
20374
|
[/assnat1Tome|assnatAN1PARTIE/i, 1],
|
|
@@ -20377,7 +20380,7 @@ function tn(e) {
|
|
|
20377
20380
|
]) if (t.test(e)) return n;
|
|
20378
20381
|
return null;
|
|
20379
20382
|
}
|
|
20380
|
-
function
|
|
20383
|
+
function rn(t, n = {}) {
|
|
20381
20384
|
let { keepAlignment: r = !0, removeEmptyParagraphs: i = !0, strictAlineas: a = !1 } = n, o = e(t, { xml: { decodeEntities: !1 } });
|
|
20382
20385
|
o("style, script, meta, link").remove(), o(".assnatHeader, .assnatFooter, .assnatHeaderLeft, .assnatHeaderandFooter").remove(), o(".assnatFARSautApres, .assnatFARSautAvant, .assnatFARSautPageNiv0, .assnatFARSautPageNiv1, .assnatFARSautPageNiv1PG").remove(), o(".assnatFARTT08Bleu").each((e, t) => {
|
|
20383
20386
|
let n = o(t).closest("table");
|
|
@@ -20403,7 +20406,7 @@ function nn(t, n = {}) {
|
|
|
20403
20406
|
if (i.length !== 0 && !(n.parents("del").length > 0 || n.find("del img").length > 0) && !(i.parent("del").length > 0)) {
|
|
20404
20407
|
let e = i.attr();
|
|
20405
20408
|
if (e && (e.width === "45" && (e.height === "31" || e.height === "30") || parseInt(e.width || "0", 10) < 50 && parseInt(e.height || "0", 10) < 50) && r.includes("position:absolute")) {
|
|
20406
|
-
let t = (e.src || "").match(/^data:image\/png;base64,(.+)$/), r = t ?
|
|
20409
|
+
let t = (e.src || "").match(/^data:image\/png;base64,(.+)$/), r = t ? Jt(t[1]) : void 0, i = r ? ` data-image-hash="${r}"` : "";
|
|
20407
20410
|
n.replaceWith(`<span class="alinea"${i}></span>`);
|
|
20408
20411
|
return;
|
|
20409
20412
|
}
|
|
@@ -20422,7 +20425,7 @@ function nn(t, n = {}) {
|
|
|
20422
20425
|
(!r || r === "\xA0") && n.remove();
|
|
20423
20426
|
}), o("span[style*=\"display:block\"][style*=\"position:absolute\"]:not(.alinea)").remove(), o("del").remove();
|
|
20424
20427
|
function s(e) {
|
|
20425
|
-
let t = o(e), n = t.attr("style"), r = e.tagName?.toLowerCase() || "", i =
|
|
20428
|
+
let t = o(e), n = t.attr("style"), r = e.tagName?.toLowerCase() || "", i = Yt(n) || r === "b" || r === "strong", a = Xt(n) || r === "i" || r === "em", s = Zt(n) || r === "sup", c = Qt(n) || r === "sub", l = t.attr("class") || "";
|
|
20426
20429
|
return /bold/i.test(l) && (i = !0), /strongemphasis/i.test(l) ? i = !0 : /italic|emphasis/i.test(l) && (a = !0), {
|
|
20427
20430
|
bold: i,
|
|
20428
20431
|
italic: a,
|
|
@@ -20456,7 +20459,7 @@ function nn(t, n = {}) {
|
|
|
20456
20459
|
l = e;
|
|
20457
20460
|
}
|
|
20458
20461
|
for (o("p").each((e, t) => {
|
|
20459
|
-
let n = o(t), i = n.attr("class") || "", a = n.attr("style"), s =
|
|
20462
|
+
let n = o(t), i = n.attr("class") || "", a = n.attr("style"), s = nn(i);
|
|
20460
20463
|
if (i.includes("assnatFARCouvTitreD")) {
|
|
20461
20464
|
let e = n.html() || "";
|
|
20462
20465
|
n.replaceWith(`<p class="cover-subtitle">${e}</p>`);
|
|
@@ -20489,11 +20492,11 @@ function nn(t, n = {}) {
|
|
|
20489
20492
|
let c = n.text().trim().startsWith("«");
|
|
20490
20493
|
if (s && !c) {
|
|
20491
20494
|
let e = o(`<h${s}>${n.html() || ""}</h${s}>`);
|
|
20492
|
-
r &&
|
|
20495
|
+
r && en(a, i) && e.attr("align", "center"), n.replaceWith(e);
|
|
20493
20496
|
} else {
|
|
20494
|
-
let e =
|
|
20497
|
+
let e = qt(i), t;
|
|
20495
20498
|
if (r) {
|
|
20496
|
-
let n =
|
|
20499
|
+
let n = tn(a);
|
|
20497
20500
|
n && n !== "justify" && n !== "left" ? t = n : e?.align && (t = e.align);
|
|
20498
20501
|
}
|
|
20499
20502
|
if (n.removeAttr("style").removeAttr("class"), t && n.attr("align", t), e?.bold) {
|
|
@@ -20503,7 +20506,7 @@ function nn(t, n = {}) {
|
|
|
20503
20506
|
}
|
|
20504
20507
|
}), o("h1, h2, h3, h4, h5, h6").each((e, t) => {
|
|
20505
20508
|
let n = o(t), i = n.attr("style"), a = n.attr("class");
|
|
20506
|
-
r &&
|
|
20509
|
+
r && en(i, a) ? (n.removeAttr("style").removeAttr("class"), n.attr("align", "center")) : n.removeAttr("style").removeAttr("class");
|
|
20507
20510
|
}), o("a").each((e, t) => {
|
|
20508
20511
|
let n = o(t), r = n.attr("href"), i = n.attr("id"), a = { ...t.attribs || {} };
|
|
20509
20512
|
for (let e of Object.keys(a)) e !== "href" && e !== "id" && n.removeAttr(e);
|
|
@@ -20542,7 +20545,7 @@ function nn(t, n = {}) {
|
|
|
20542
20545
|
}), o("br").each((e, t) => {
|
|
20543
20546
|
o(t).removeAttr("style").removeAttr("class");
|
|
20544
20547
|
}), o("table, tr, td, th, thead, tbody, tfoot").each((e, t) => {
|
|
20545
|
-
let n = o(t), r =
|
|
20548
|
+
let n = o(t), r = $t(n.attr("style"));
|
|
20546
20549
|
n.removeAttr("style").removeAttr("class"), r && n.attr("style", r);
|
|
20547
20550
|
}), o("td, th").each((e, t) => {
|
|
20548
20551
|
let n = o(t), r = n.children();
|
|
@@ -20560,17 +20563,17 @@ function nn(t, n = {}) {
|
|
|
20560
20563
|
!isNaN(e) && e > 1 && n.attr("style", `counter-reset: list-counter ${e - 1}`), n.attr("start", r);
|
|
20561
20564
|
}
|
|
20562
20565
|
}), o("li").each((e, t) => {
|
|
20563
|
-
let n = o(t), r =
|
|
20566
|
+
let n = o(t), r = tn(n.attr("style"));
|
|
20564
20567
|
n.removeAttr("style").removeAttr("class"), r === "center" && n.attr("style", "text-align: center");
|
|
20565
20568
|
let i = n.html() || "", a = i.replace(/^(\s| | |\u00a0)+/, "");
|
|
20566
20569
|
a !== i && n.html(a);
|
|
20567
|
-
}),
|
|
20570
|
+
}), an(o), on(o, a);
|
|
20568
20571
|
let u = o("body").html() || o.html(), d = u.includes("class=\"alinea"), f = o("ol").length > 0, p = o("h1, h2, h3, h4, h5, h6").length > 0, m = u.includes("class=\"expose-motifs"), h = u.includes("class=\"cover-title\"") || u.includes("class=\"cover-subtitle\"") || u.includes("class=\"cover-info\"") || u.includes("class=\"cover-year\""), g = "";
|
|
20569
|
-
h && (g +=
|
|
20572
|
+
h && (g += Gt), p && (g += Ht), m && (g += Ut), d && (g += Vt), f && (g += Wt);
|
|
20570
20573
|
let _ = g ? `<style>${g}</style>\n${u}` : u;
|
|
20571
|
-
return _ = _.replace(/>\s+</g, "> <").replace(/\r\n/g, "\n").replace(/\r/g, "\n").replace(/\n{3,}/g, "\n\n").split("\n").map((e) => e.trim()).filter((e) => e.length > 0).join("\n"), _ = _.replace(/ /g, "\xA0"), i && (_ = _.replace(/<p[^>]*>\s*( | | |\u00a0|\s)*\s*<\/p>/gi, "").replace(/<p[^>]*>\s*<(strong|em|b|i)>\s*( | | |\u00a0|\s)*\s*<\/\1>\s*<\/p>/gi, "")), _ = _.replace(/<span[^>]*>\s*<\/span>/gi, ""), _ = _.replace(/ class=""/g, ""), _ =
|
|
20574
|
+
return _ = _.replace(/>\s+</g, "> <").replace(/\r\n/g, "\n").replace(/\r/g, "\n").replace(/\n{3,}/g, "\n\n").split("\n").map((e) => e.trim()).filter((e) => e.length > 0).join("\n"), _ = _.replace(/ /g, "\xA0"), i && (_ = _.replace(/<p[^>]*>\s*( | | |\u00a0|\s)*\s*<\/p>/gi, "").replace(/<p[^>]*>\s*<(strong|em|b|i)>\s*( | | |\u00a0|\s)*\s*<\/\1>\s*<\/p>/gi, "")), _ = _.replace(/<span[^>]*>\s*<\/span>/gi, ""), _ = _.replace(/ class=""/g, ""), _ = sn(_), _ = _.replace(/<(strong|em|b|i|sup|sub)>\s*( | | |\u00a0|\s)*\s*<\/\1>/gi, "").replace(/<(strong|em|b|i)>( | | |\u00a0)+<\/\1>/gi, " ").replace(/<br\s*\/?>/gi, "<br/>").replace(/ +/g, " ").trim(), _;
|
|
20572
20575
|
}
|
|
20573
|
-
function
|
|
20576
|
+
function an(e) {
|
|
20574
20577
|
e("span[id]").each((t, n) => {
|
|
20575
20578
|
let r = e(n), i = r.attr("id"), a = n.attribs || {}, o = Object.keys(a);
|
|
20576
20579
|
if (o.length !== 1 || o[0] !== "id") return;
|
|
@@ -20593,13 +20596,13 @@ function rn(e) {
|
|
|
20593
20596
|
l.trim() === u.trim() && (s.attr("id", i), r.replaceWith(r.html() || ""));
|
|
20594
20597
|
});
|
|
20595
20598
|
}
|
|
20596
|
-
function
|
|
20599
|
+
function on(e, t = !1) {
|
|
20597
20600
|
let n = e("body");
|
|
20598
20601
|
if (n.length === 0) return;
|
|
20599
20602
|
let r = n.find("span.alinea[data-image-hash]"), i = -1;
|
|
20600
20603
|
r.each((n, r) => {
|
|
20601
20604
|
let a = e(r), o = a.attr("data-image-hash"), s;
|
|
20602
|
-
if (o &&
|
|
20605
|
+
if (o && Bt[o] !== void 0 && (s = Bt[o]), s === void 0) {
|
|
20603
20606
|
if (t) throw Error(`Missing alinea number mapping for image hash: "${o}". Please extract images, review them, and update the mapping in "src/lib/alineas/alineas_numbers.ts".`);
|
|
20604
20607
|
a.remove();
|
|
20605
20608
|
return;
|
|
@@ -20611,11 +20614,11 @@ function an(e, t = !1) {
|
|
|
20611
20614
|
i = s, a.attr("data-alinea", String(s)), a.text(String(s)), a.removeAttr("data-image-hash");
|
|
20612
20615
|
});
|
|
20613
20616
|
}
|
|
20614
|
-
function
|
|
20617
|
+
function sn(e) {
|
|
20615
20618
|
let t = e;
|
|
20616
20619
|
return t = t.replace(/<\/strong>(\s*)<strong>/gi, "$1"), t = t.replace(/<\/em>(\s*)<em>/gi, "$1"), t = t.replace(/<\/sup>(\s*)<sup>/gi, "$1"), t = t.replace(/<\/sub>(\s*)<sub>/gi, "$1"), t;
|
|
20617
20620
|
}
|
|
20618
|
-
function
|
|
20621
|
+
function cn(e, t = {}) {
|
|
20619
20622
|
return `<!DOCTYPE html>
|
|
20620
20623
|
<html lang="fr">
|
|
20621
20624
|
<head>
|
|
@@ -20623,7 +20626,7 @@ function sn(e, t = {}) {
|
|
|
20623
20626
|
<title>Document simplifié</title>
|
|
20624
20627
|
</head>
|
|
20625
20628
|
<body>
|
|
20626
|
-
${
|
|
20629
|
+
${rn(e, t)}
|
|
20627
20630
|
</body>
|
|
20628
20631
|
</html>`;
|
|
20629
20632
|
}
|
|
@@ -20642,10 +20645,10 @@ function Q(e, t) {
|
|
|
20642
20645
|
let { sourceMap: s, title: c } = g.readJsonSync(_.join(t, e), { encoding: "utf-8" });
|
|
20643
20646
|
o.sourceMap = s ?? [], o.title = c;
|
|
20644
20647
|
}
|
|
20645
|
-
return
|
|
20648
|
+
return ln(r, e), r;
|
|
20646
20649
|
}
|
|
20647
|
-
function
|
|
20648
|
-
if (e.input = t, e.transformations !== void 0) for (let n of e.transformations)
|
|
20650
|
+
function ln(e, t) {
|
|
20651
|
+
if (e.input = t, e.transformations !== void 0) for (let n of e.transformations) ln(n, t), t = n.output;
|
|
20649
20652
|
return t;
|
|
20650
20653
|
}
|
|
20651
20654
|
function $(e, t, n = "1") {
|
|
@@ -20667,7 +20670,7 @@ function $(e, t, n = "1") {
|
|
|
20667
20670
|
}
|
|
20668
20671
|
//#endregion
|
|
20669
20672
|
//#region src/lib/server/linkers/html.ts
|
|
20670
|
-
async function
|
|
20673
|
+
async function un({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, htmlFilePath: i, htmlTransformationsInputDir: c, htmlTransformationsOutputDir: l, htmlWithLinksFilePath: u, htmlWithLinksOrReferencesFilePath: d, htmlWithLinksTransformationsOutputDir: f, htmlWithReferencesFilePath: p, linkBaseUrl: m, linkType: h, logIgnoredReferencesTypes: _, logPartialReferences: v, logReferences: y, referredLegifranceTextsInfosFilePath: b }) {
|
|
20671
20674
|
let x = t ?? (e === void 0 ? void 0 : new o(e));
|
|
20672
20675
|
if (x === void 0) throw Error("A Canutes database or legal resolver is required");
|
|
20673
20676
|
let S = await g.readFile(i, { encoding: "utf-8" }), C;
|
|
@@ -20700,7 +20703,7 @@ async function ln({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, ht
|
|
|
20700
20703
|
}
|
|
20701
20704
|
//#endregion
|
|
20702
20705
|
//#region src/lib/server/tables_of_contents.ts
|
|
20703
|
-
async function
|
|
20706
|
+
async function dn(e, n, r, i) {
|
|
20704
20707
|
let a = Q(await g.readFile(e, { encoding: "utf-8" }), n), o = a.output, s = new p(o), c = await g.readJson(r, { encoding: "utf-8" });
|
|
20705
20708
|
for await (let e of t({
|
|
20706
20709
|
context: s,
|
|
@@ -20712,7 +20715,7 @@ async function un(e, n, r, i) {
|
|
|
20712
20715
|
spaces: 2
|
|
20713
20716
|
});
|
|
20714
20717
|
}
|
|
20715
|
-
async function
|
|
20718
|
+
async function fn(e, t, n) {
|
|
20716
20719
|
let i = Q(await g.readFile(e, { encoding: "utf-8" }), t).output, a = r(i);
|
|
20717
20720
|
await g.writeJson(n, a, {
|
|
20718
20721
|
encoding: "utf-8",
|
|
@@ -20721,8 +20724,8 @@ async function dn(e, t, n) {
|
|
|
20721
20724
|
}
|
|
20722
20725
|
//#endregion
|
|
20723
20726
|
//#region src/lib/server/legi/resolvers.ts
|
|
20724
|
-
function
|
|
20727
|
+
function pn({ canutesDb: e }) {
|
|
20725
20728
|
return new o(e);
|
|
20726
20729
|
}
|
|
20727
20730
|
//#endregion
|
|
20728
|
-
export { f as LegiResolver,
|
|
20731
|
+
export { f as LegiResolver, un as addLinksOrReferencesToHtmlFile, dn as addPositionsToTableOfContentsFile, d as buildAndInstallTextTitlesInfos, l as buildTextTitlesInfos, pn as createLegiResolver, x as extractAssembleeAmendmentSearchItems, Y as extractAssembleeExposesDesMotifs, kt as extractSenatAmendmentSearchItems, S as hashAssembleeAmendmentSearchItem, Et as hashAssembleeSearchItem, At as hashSenatAmendmentSearchItem, Pt as hashSenatSearchItem, zt as isAkomaNtosoXml, Dt as isoDateFromAssembleeDocument, St as linkAkomaNtosoBillRaw, ze as linkAssembleeBillRaw, xt as parseAkomaNtosoBillRaw, Re as parseAssembleeBillRaw, Tt as parseAssembleeDocumentSearchContent, Nt as parseSenatDocumentSearchContent, Q as readTransformation, _t as renderAkomaNtosoBillRaw, Rt as resolveSenatAkomaNtosoSource, fn as simplifiedHtmlBillFileToTableOfContentsFile, rn as simplifyWordHtml, cn as simplifyWordHtmlToDocument, $ as writeTransformation };
|