@tricoteuses/tisseuse 0.14.15 → 0.14.17
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 +10 -1
- package/dist/{html-C0Rw5Oc_.js → html-Bto5izwe.js} +918 -826
- package/dist/index.js +139 -122
- package/dist/server.js +667 -667
- package/dist/src/lib/index.d.ts +1 -1
- package/dist/src/lib/linkers/cited-article.test.d.ts +1 -0
- package/dist/src/lib/links.d.ts +7 -0
- package/package.json +1 -1
|
@@ -9862,51 +9862,79 @@ function mp(e, t) {
|
|
|
9862
9862
|
});
|
|
9863
9863
|
}
|
|
9864
9864
|
function hp(e) {
|
|
9865
|
-
if (e.count === void 0 || e.count <= 1 || !mp(e.first, e.last)) return
|
|
9865
|
+
if (e.count === void 0 || e.count <= 1 || !mp(e.first, e.last)) return {
|
|
9866
|
+
first: e.first,
|
|
9867
|
+
last: e.last
|
|
9868
|
+
};
|
|
9866
9869
|
let t = e.last.findLastIndex((e) => e.type === "alinéa" && typeof e.index == "number");
|
|
9867
|
-
if (t < 0) return
|
|
9870
|
+
if (t < 0) return {
|
|
9871
|
+
first: e.first,
|
|
9872
|
+
last: e.last
|
|
9873
|
+
};
|
|
9868
9874
|
let n = e.last[t];
|
|
9869
|
-
return !n || n.index === void 0 || n.index
|
|
9870
|
-
|
|
9871
|
-
|
|
9872
|
-
} : n
|
|
9875
|
+
return !n || n.index === void 0 || n.index === 0 ? {
|
|
9876
|
+
first: e.first,
|
|
9877
|
+
last: e.last
|
|
9878
|
+
} : n.index < 0 ? {
|
|
9879
|
+
first: e.first.map((n, r) => r === t ? {
|
|
9880
|
+
...n,
|
|
9881
|
+
index: n.index - e.count + 1
|
|
9882
|
+
} : n),
|
|
9883
|
+
last: e.last
|
|
9884
|
+
} : {
|
|
9885
|
+
first: e.first,
|
|
9886
|
+
last: e.last.map((n, r) => r === t ? {
|
|
9887
|
+
...n,
|
|
9888
|
+
index: n.index + e.count - 1
|
|
9889
|
+
} : n)
|
|
9890
|
+
};
|
|
9873
9891
|
}
|
|
9874
|
-
|
|
9875
|
-
|
|
9876
|
-
|
|
9892
|
+
function gp(e, t) {
|
|
9893
|
+
if (t <= 1) return e;
|
|
9894
|
+
let n = e.findLastIndex((e) => e.type === "alinéa" && typeof e.index == "number");
|
|
9895
|
+
if (n < 0) return e;
|
|
9896
|
+
let r = e[n];
|
|
9897
|
+
return !r || r.index === void 0 || r.index >= 0 ? e : e.map((e, r) => r === n ? {
|
|
9898
|
+
...e,
|
|
9899
|
+
index: e.index - t + 1
|
|
9900
|
+
} : e);
|
|
9877
9901
|
}
|
|
9902
|
+
var _p = String.raw`[A-Zİ]|[a-z]`, vp = new RegExp(String.raw`^\s*([IVXLCDM]+|${_p}|\d+)(?:\s+(?:${Se}))?(?:\s+\([^)]+\))?(?:\s*(?:°|\.|\)|-|–|—))+(?:\s+(?:${Se}))?(?:\s+\([^)]+\))?(?:\s+|(?=[\p{L}\p{N}]))`, "iu"), yp = /^\s*-\s*/u, bp = /^(partie|livre|titre|sous-titre|chapitre|section|sous-section|paragraphe|sous-paragraphe|sous-sous-paragraphe)\b/i;
|
|
9878
9903
|
function xp(e) {
|
|
9879
|
-
return
|
|
9904
|
+
return /^[IVXLCDM]+$/i.test(e);
|
|
9880
9905
|
}
|
|
9881
9906
|
function Sp(e) {
|
|
9882
|
-
|
|
9907
|
+
return Cp(e) !== void 0;
|
|
9908
|
+
}
|
|
9909
|
+
function Cp(e) {
|
|
9910
|
+
let t = e.trim().match(vp);
|
|
9883
9911
|
if (!t) return;
|
|
9884
|
-
let n =
|
|
9912
|
+
let n = Tp(t[0]), r = n?.num ?? t[1];
|
|
9885
9913
|
if (!r) return;
|
|
9886
|
-
let i = n?.index ??
|
|
9914
|
+
let i = n?.index ?? Ep(r);
|
|
9887
9915
|
if (!(n === null && i === void 0)) return {
|
|
9888
9916
|
...i === void 0 ? {} : { index: i },
|
|
9889
|
-
level:
|
|
9917
|
+
level: Dp(t[0] ?? r),
|
|
9890
9918
|
prefix: t[0],
|
|
9891
9919
|
restText: e.trim().slice(t[0].length).trim(),
|
|
9892
9920
|
token: r
|
|
9893
9921
|
};
|
|
9894
9922
|
}
|
|
9895
|
-
function
|
|
9923
|
+
function wp(e) {
|
|
9896
9924
|
return ye(e).output.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
|
|
9897
9925
|
}
|
|
9898
|
-
function
|
|
9899
|
-
let t = h(e, Ot) ?? h(
|
|
9926
|
+
function Tp(e) {
|
|
9927
|
+
let t = h(e, Ot) ?? h(wp(e), Ot);
|
|
9900
9928
|
return t && typeof t == "object" && t.type === "item" && typeof t.index == "number" && typeof t.num == "string" ? {
|
|
9901
9929
|
num: t.num,
|
|
9902
9930
|
index: t.index
|
|
9903
9931
|
} : null;
|
|
9904
9932
|
}
|
|
9905
|
-
function
|
|
9906
|
-
let t = e.trim(), n = t.split(/\s+/), r =
|
|
9933
|
+
function Ep(e) {
|
|
9934
|
+
let t = e.trim(), n = t.split(/\s+/), r = wp(n[0] ? n[0].replace(/[^\p{L}\p{N}]+/gu, "") : t), i = n.length > 1 ? n.slice(1).join(" ") : void 0, a = (() => {
|
|
9907
9935
|
if (/^\d+$/.test(r)) return Number(r);
|
|
9908
9936
|
if (/^[A-Z]$/i.test(r)) return r.toLowerCase().charCodeAt(0) - 97 + 1;
|
|
9909
|
-
if (
|
|
9937
|
+
if (xp(r)) return ie(r.toUpperCase());
|
|
9910
9938
|
})();
|
|
9911
9939
|
if (a === void 0) return;
|
|
9912
9940
|
if (!i) return a;
|
|
@@ -9917,24 +9945,24 @@ function Tp(e) {
|
|
|
9917
9945
|
}
|
|
9918
9946
|
return a;
|
|
9919
9947
|
}
|
|
9920
|
-
function Ep(e) {
|
|
9921
|
-
let t = e.trim().split(/\s+/)[0] ?? e, n = t.replace(/[^\p{L}\p{N}]+/gu, ""), r = Cp(n);
|
|
9922
|
-
return /^[ivxlcdm]+$/.test(r) && (r.length > 1 || /^[ivx]$/.test(r)) ? 105 : /^[IVXLCDM]+$/.test(n) && (n.length > 1 || /^[IVX]$/.test(n)) ? 100 : /^[A-Z]$/.test(r) ? 101 : /^\d+$/.test(r) && /°/.test(t) ? 103 : /^\d+$/.test(r) ? 102 : /^[a-z]$/.test(r) ? 104 : bp(r) ? 100 : 105;
|
|
9923
|
-
}
|
|
9924
9948
|
function Dp(e) {
|
|
9949
|
+
let t = e.trim().split(/\s+/)[0] ?? e, n = t.replace(/[^\p{L}\p{N}]+/gu, ""), r = wp(n);
|
|
9950
|
+
return /^[ivxlcdm]+$/.test(r) && (r.length > 1 || /^[ivx]$/.test(r)) ? 105 : /^[IVXLCDM]+$/.test(n) && (n.length > 1 || /^[IVX]$/.test(n)) ? 100 : /^[A-Z]$/.test(r) ? 101 : /^\d+$/.test(r) && /°/.test(t) ? 103 : /^\d+$/.test(r) ? 102 : /^[a-z]$/.test(r) ? 104 : xp(r) ? 100 : 105;
|
|
9951
|
+
}
|
|
9952
|
+
function Op(e) {
|
|
9925
9953
|
return e.children.filter((e) => e.type === "alinéa").length + 1;
|
|
9926
9954
|
}
|
|
9927
|
-
function
|
|
9955
|
+
function kp(e, t, n) {
|
|
9928
9956
|
let r = new RegExp(String.raw`</${t}\s*>`, "iu");
|
|
9929
9957
|
r.lastIndex = n;
|
|
9930
9958
|
let i = r.exec(e.slice(n));
|
|
9931
9959
|
return i ? n + i.index + i[0].length : e.length;
|
|
9932
9960
|
}
|
|
9933
|
-
function
|
|
9961
|
+
function Ap(e) {
|
|
9934
9962
|
return pp(e).text().replace(/\s+/g, " ").trim();
|
|
9935
9963
|
}
|
|
9936
|
-
function
|
|
9937
|
-
let o =
|
|
9964
|
+
function jp(e, t, n, r, i, a = {}) {
|
|
9965
|
+
let o = Ap(t);
|
|
9938
9966
|
o && e.push({
|
|
9939
9967
|
html: t,
|
|
9940
9968
|
htmlStart: n,
|
|
@@ -9944,9 +9972,9 @@ function Ap(e, t, n, r, i, a = {}) {
|
|
|
9944
9972
|
...a
|
|
9945
9973
|
});
|
|
9946
9974
|
}
|
|
9947
|
-
function
|
|
9975
|
+
function Mp(e) {
|
|
9948
9976
|
let t = [], n = /<\s*(table|p|br)\b[^>]*>/giu, r = 0, i = 0, a = null, o = (n) => {
|
|
9949
|
-
a !== null && (
|
|
9977
|
+
a !== null && (jp(t, e.slice(a, n), a, n, -1), a = null);
|
|
9950
9978
|
};
|
|
9951
9979
|
for (; i < e.length;) {
|
|
9952
9980
|
n.lastIndex = i;
|
|
@@ -9958,25 +9986,25 @@ function jp(e) {
|
|
|
9958
9986
|
continue;
|
|
9959
9987
|
}
|
|
9960
9988
|
if (o(c), u === "table") {
|
|
9961
|
-
let n =
|
|
9962
|
-
|
|
9989
|
+
let n = kp(e, "table", c + l.length);
|
|
9990
|
+
jp(t, e.slice(c, n), c, n, -1, { isTable: !0 }), i = n;
|
|
9963
9991
|
continue;
|
|
9964
9992
|
}
|
|
9965
9993
|
if (u === "p") {
|
|
9966
|
-
let n =
|
|
9994
|
+
let n = kp(e, "p", c + l.length), a = c + l.length, o = /<\/p\s*>\s*$/iu.exec(e.slice(a, n)), s = o ? a + o.index : n, u = e.slice(a, s), d = /<br\s*\/?>/giu, f = 0, p;
|
|
9967
9995
|
for (; (p = d.exec(u)) !== null;) {
|
|
9968
9996
|
let e = a + f, n = a + p.index;
|
|
9969
|
-
|
|
9997
|
+
jp(t, u.slice(f, p.index), e, n, r), f = p.index + p[0].length;
|
|
9970
9998
|
}
|
|
9971
|
-
|
|
9999
|
+
jp(t, u.slice(f), a + f, s, r), r += 1, i = n;
|
|
9972
10000
|
}
|
|
9973
10001
|
}
|
|
9974
10002
|
return i < e.length && a === null && (a = i), o(e.length), t;
|
|
9975
10003
|
}
|
|
9976
|
-
function
|
|
10004
|
+
function Np(e, t, n = t.text) {
|
|
9977
10005
|
return {
|
|
9978
10006
|
type: "alinéa",
|
|
9979
|
-
index:
|
|
10007
|
+
index: Op(e),
|
|
9980
10008
|
text: n,
|
|
9981
10009
|
html: t.html,
|
|
9982
10010
|
paragraphIndex: t.paragraphIndex,
|
|
@@ -9985,17 +10013,17 @@ function Mp(e, t, n = t.text) {
|
|
|
9985
10013
|
lineIndex: t.htmlStart
|
|
9986
10014
|
};
|
|
9987
10015
|
}
|
|
9988
|
-
function
|
|
10016
|
+
function Pp(e) {
|
|
9989
10017
|
let t = {
|
|
9990
10018
|
type: "article",
|
|
9991
10019
|
children: []
|
|
9992
10020
|
}, n = [{
|
|
9993
10021
|
level: -1,
|
|
9994
10022
|
node: t
|
|
9995
|
-
}], r =
|
|
10023
|
+
}], r = Mp(e), i = (e, t, r) => {
|
|
9996
10024
|
let i = e, a = t;
|
|
9997
10025
|
for (;;) {
|
|
9998
|
-
let e =
|
|
10026
|
+
let e = Cp(a);
|
|
9999
10027
|
if (!e) break;
|
|
10000
10028
|
let t = {
|
|
10001
10029
|
type: "item",
|
|
@@ -10009,16 +10037,16 @@ function Np(e) {
|
|
|
10009
10037
|
node: t
|
|
10010
10038
|
}), i = t, a = e.restText;
|
|
10011
10039
|
}
|
|
10012
|
-
a && i.children.push(
|
|
10040
|
+
a && i.children.push(Np(i, r, a));
|
|
10013
10041
|
};
|
|
10014
10042
|
for (let e of r) {
|
|
10015
10043
|
let r = e.text;
|
|
10016
10044
|
if (e.isTable) {
|
|
10017
10045
|
let i = n[n.length - 1]?.node ?? t;
|
|
10018
|
-
i.children.push(
|
|
10046
|
+
i.children.push(Np(i, e, r));
|
|
10019
10047
|
continue;
|
|
10020
10048
|
}
|
|
10021
|
-
let a =
|
|
10049
|
+
let a = Cp(r);
|
|
10022
10050
|
if (a) {
|
|
10023
10051
|
let r = a.level;
|
|
10024
10052
|
for (; n.length > 0 && n[n.length - 1].level >= r;) n.pop();
|
|
@@ -10034,16 +10062,16 @@ function Np(e) {
|
|
|
10034
10062
|
node: s
|
|
10035
10063
|
});
|
|
10036
10064
|
let c = a.restText;
|
|
10037
|
-
c && (
|
|
10065
|
+
c && (bp.test(c) ? s.label = c : Cp(c) ? i(s, c, e) : s.children.push(Np(s, e, c)));
|
|
10038
10066
|
continue;
|
|
10039
10067
|
}
|
|
10040
10068
|
let o = n[n.length - 1]?.node ?? t;
|
|
10041
|
-
o.children.push(
|
|
10069
|
+
o.children.push(Np(o, e, r));
|
|
10042
10070
|
}
|
|
10043
10071
|
return t;
|
|
10044
10072
|
}
|
|
10045
|
-
function
|
|
10046
|
-
return e.type === "parent-enfant" ? [...
|
|
10073
|
+
function Fp(e) {
|
|
10074
|
+
return e.type === "parent-enfant" ? [...Fp(e.parent), ...Fp(e.child)] : dt(e) && (ft(e) || pt(e)) ? [{
|
|
10047
10075
|
type: e.type,
|
|
10048
10076
|
index: e.index,
|
|
10049
10077
|
num: e.num,
|
|
@@ -10051,10 +10079,10 @@ function Pp(e) {
|
|
|
10051
10079
|
present: e.present
|
|
10052
10080
|
}] : [];
|
|
10053
10081
|
}
|
|
10054
|
-
function
|
|
10055
|
-
if (e.type === "reference_et_action") return
|
|
10082
|
+
function Ip(e) {
|
|
10083
|
+
if (e.type === "reference_et_action") return Ip(e.reference);
|
|
10056
10084
|
if (e.type === "parent-enfant") {
|
|
10057
|
-
let t =
|
|
10085
|
+
let t = Ip(e.parent), n = Ip(e.child);
|
|
10058
10086
|
if (t.length === 0) return n;
|
|
10059
10087
|
if (n.length === 0) return t;
|
|
10060
10088
|
let r = [];
|
|
@@ -10085,7 +10113,7 @@ function Fp(e) {
|
|
|
10085
10113
|
return r;
|
|
10086
10114
|
}
|
|
10087
10115
|
if (e.type === "bounded-interval") {
|
|
10088
|
-
let t =
|
|
10116
|
+
let t = Fp(e.first), n = Fp(e.last);
|
|
10089
10117
|
return t.length === 0 || n.length === 0 ? [] : [{
|
|
10090
10118
|
kind: "range",
|
|
10091
10119
|
first: t,
|
|
@@ -10093,23 +10121,23 @@ function Fp(e) {
|
|
|
10093
10121
|
}];
|
|
10094
10122
|
}
|
|
10095
10123
|
if (e.type === "counted-interval") {
|
|
10096
|
-
let t =
|
|
10097
|
-
return
|
|
10124
|
+
let t = Fp(e.first), n = gp(t, e.count);
|
|
10125
|
+
return n.length === 0 ? [] : [{
|
|
10098
10126
|
kind: "range",
|
|
10099
|
-
first:
|
|
10127
|
+
first: n,
|
|
10100
10128
|
last: t,
|
|
10101
10129
|
count: e.count
|
|
10102
10130
|
}];
|
|
10103
10131
|
}
|
|
10104
|
-
if (e.type === "enumeration") return [...
|
|
10105
|
-
if (e.type === "exclusion") return
|
|
10106
|
-
let t =
|
|
10132
|
+
if (e.type === "enumeration") return [...Ip(e.left), ...Ip(e.right)];
|
|
10133
|
+
if (e.type === "exclusion") return Ip(e.left);
|
|
10134
|
+
let t = Fp(e);
|
|
10107
10135
|
return t.length === 0 ? [] : [{
|
|
10108
10136
|
kind: "single",
|
|
10109
10137
|
steps: t
|
|
10110
10138
|
}];
|
|
10111
10139
|
}
|
|
10112
|
-
var
|
|
10140
|
+
var Lp = new Set([
|
|
10113
10141
|
"I",
|
|
10114
10142
|
"V",
|
|
10115
10143
|
"X",
|
|
@@ -10118,18 +10146,18 @@ var Ip = new Set([
|
|
|
10118
10146
|
"D",
|
|
10119
10147
|
"M"
|
|
10120
10148
|
]);
|
|
10121
|
-
function
|
|
10149
|
+
function Rp(e) {
|
|
10122
10150
|
return e ? /^([A-Z])(?:\s+\p{L}+)?$/iu.exec(e.trim())?.[1]?.toUpperCase() ?? null : null;
|
|
10123
10151
|
}
|
|
10124
|
-
function
|
|
10152
|
+
function zp(e) {
|
|
10125
10153
|
return e.toLowerCase().charCodeAt(0) - 97 + 1;
|
|
10126
10154
|
}
|
|
10127
|
-
function
|
|
10155
|
+
function Bp(e) {
|
|
10128
10156
|
let t = /* @__PURE__ */ new Map();
|
|
10129
10157
|
for (let [n, r] of e.entries()) {
|
|
10130
10158
|
if (r.kind !== "single") continue;
|
|
10131
10159
|
let e = r.steps.at(-1);
|
|
10132
|
-
if (e?.type !== "item" || !
|
|
10160
|
+
if (e?.type !== "item" || !Rp(e.num)) continue;
|
|
10133
10161
|
let i = JSON.stringify(r.steps.slice(0, -1)), a = t.get(i);
|
|
10134
10162
|
a ? a.push({
|
|
10135
10163
|
index: n,
|
|
@@ -10141,24 +10169,24 @@ function zp(e) {
|
|
|
10141
10169
|
}
|
|
10142
10170
|
let n = [...e];
|
|
10143
10171
|
for (let e of t.values()) if (e.some(({ step: e }) => {
|
|
10144
|
-
let t =
|
|
10145
|
-
return t !== null && !
|
|
10172
|
+
let t = Rp(e.num);
|
|
10173
|
+
return t !== null && !Lp.has(t);
|
|
10146
10174
|
})) for (let { index: t, step: r } of e) {
|
|
10147
|
-
let e =
|
|
10148
|
-
if (!e || !
|
|
10175
|
+
let e = Rp(r.num);
|
|
10176
|
+
if (!e || !Lp.has(e)) continue;
|
|
10149
10177
|
let i = n[t];
|
|
10150
10178
|
i?.kind === "single" && (n[t] = {
|
|
10151
10179
|
...i,
|
|
10152
10180
|
steps: i.steps.map((t, n) => n === i.steps.length - 1 ? {
|
|
10153
10181
|
...t,
|
|
10154
|
-
index:
|
|
10182
|
+
index: zp(e)
|
|
10155
10183
|
} : t)
|
|
10156
10184
|
});
|
|
10157
10185
|
}
|
|
10158
10186
|
return n;
|
|
10159
10187
|
}
|
|
10160
|
-
function
|
|
10161
|
-
let t =
|
|
10188
|
+
function Vp(e) {
|
|
10189
|
+
let t = Bp(Ip(e));
|
|
10162
10190
|
if (t.length === 0) return t;
|
|
10163
10191
|
let n = t[0];
|
|
10164
10192
|
if (n?.kind === "single" && n.steps.length > 1) {
|
|
@@ -10170,17 +10198,17 @@ function Bp(e) {
|
|
|
10170
10198
|
}
|
|
10171
10199
|
return t;
|
|
10172
10200
|
}
|
|
10173
|
-
function
|
|
10201
|
+
function Hp(e, t) {
|
|
10174
10202
|
if (t.num !== void 0 && e.num !== void 0) {
|
|
10175
|
-
let n = (e) =>
|
|
10203
|
+
let n = (e) => wp(e).toLowerCase().replace(/[.)]/g, "").trim();
|
|
10176
10204
|
if (n(t.num) !== n(e.num)) return !1;
|
|
10177
10205
|
}
|
|
10178
10206
|
return t.index !== void 0 && e.index !== void 0 ? t.index === e.index : t.num !== void 0 && e.num !== void 0;
|
|
10179
10207
|
}
|
|
10180
|
-
function
|
|
10208
|
+
function Up(e) {
|
|
10181
10209
|
return /[.!?…]/u.test(e);
|
|
10182
10210
|
}
|
|
10183
|
-
function
|
|
10211
|
+
function Wp(e, t) {
|
|
10184
10212
|
let n = e.slice(0, t), r = /([\p{L}]+)\.?$/u.exec(n)?.[1];
|
|
10185
10213
|
if (!r) return !1;
|
|
10186
10214
|
let i = e.slice(t + 1), a = /\S/u.exec(i)?.[0], o = (/^\s*([\p{L}\p{N}*]+)/u.exec(i)?.[1] ?? "").toLowerCase(), s = r.toLowerCase();
|
|
@@ -10208,7 +10236,7 @@ function Up(e, t) {
|
|
|
10208
10236
|
}
|
|
10209
10237
|
return !1;
|
|
10210
10238
|
}
|
|
10211
|
-
function
|
|
10239
|
+
function Gp(e) {
|
|
10212
10240
|
let t = e.text, n = [], r = 0, i = (e) => {
|
|
10213
10241
|
let i = r, a = e;
|
|
10214
10242
|
for (; i < a && /\s/u.test(t[i] ?? "");) i += 1;
|
|
@@ -10221,7 +10249,7 @@ function Wp(e) {
|
|
|
10221
10249
|
};
|
|
10222
10250
|
for (let e = 0; e < t.length; e += 1) {
|
|
10223
10251
|
let n = t[e] ?? "";
|
|
10224
|
-
if (!
|
|
10252
|
+
if (!Up(n) || n === "." && Wp(t, e)) continue;
|
|
10225
10253
|
let a = e + 1;
|
|
10226
10254
|
for (; a < t.length && /[»”")\]]/u.test(t[a] ?? "");) a += 1;
|
|
10227
10255
|
let o = t.slice(a);
|
|
@@ -10238,11 +10266,11 @@ function Wp(e) {
|
|
|
10238
10266
|
alinea: e
|
|
10239
10267
|
}));
|
|
10240
10268
|
}
|
|
10241
|
-
function
|
|
10269
|
+
function Kp(e, t) {
|
|
10242
10270
|
let n = (e) => "children" in e && (e.type === "article" || e.type === "item" || st.includes(e.type)) ? e.children : [], r = (e) => e.type === "alinéa" ? [e] : "children" in e && (e.type === "article" || e.type === "item" || st.includes(e.type)) ? e.children.flatMap(r) : [];
|
|
10243
10271
|
if (st.includes(t.type)) {
|
|
10244
10272
|
let r = n(e);
|
|
10245
|
-
for (let e of r) if (st.includes(e.type) && e.type === t.type &&
|
|
10273
|
+
for (let e of r) if (st.includes(e.type) && e.type === t.type && Hp(e, t)) return {
|
|
10246
10274
|
node: e,
|
|
10247
10275
|
path: [e]
|
|
10248
10276
|
};
|
|
@@ -10250,13 +10278,13 @@ function Gp(e, t) {
|
|
|
10250
10278
|
}
|
|
10251
10279
|
if (t.type === "item") {
|
|
10252
10280
|
let r = n(e);
|
|
10253
|
-
for (let e of r) if (e.type === "item" &&
|
|
10281
|
+
for (let e of r) if (e.type === "item" && Hp(e, t)) return {
|
|
10254
10282
|
node: e,
|
|
10255
10283
|
path: [e]
|
|
10256
10284
|
};
|
|
10257
10285
|
for (let e of r) {
|
|
10258
10286
|
if (e.type === "alinéa") continue;
|
|
10259
|
-
let n =
|
|
10287
|
+
let n = Kp(e, t);
|
|
10260
10288
|
if (n) return {
|
|
10261
10289
|
node: n.node,
|
|
10262
10290
|
path: [e, ...n.path]
|
|
@@ -10282,7 +10310,7 @@ function Gp(e, t) {
|
|
|
10282
10310
|
if (t.index === void 0) return null;
|
|
10283
10311
|
let n = e.type === "alinéa" ? [e] : r(e);
|
|
10284
10312
|
if (n.length === 0) return null;
|
|
10285
|
-
let i = n.flatMap(
|
|
10313
|
+
let i = n.flatMap(Gp), a = t.index, o = a < 0 ? i.length + a + 1 : a;
|
|
10286
10314
|
if (o < 1 || o > i.length) return null;
|
|
10287
10315
|
let s = i[o - 1];
|
|
10288
10316
|
return {
|
|
@@ -10292,14 +10320,14 @@ function Gp(e, t) {
|
|
|
10292
10320
|
}
|
|
10293
10321
|
return null;
|
|
10294
10322
|
}
|
|
10295
|
-
function
|
|
10323
|
+
function qp(e, t) {
|
|
10296
10324
|
if (t.kind === "range") {
|
|
10297
|
-
let n = hp(t), r =
|
|
10325
|
+
let n = hp(t), r = qp(e, {
|
|
10298
10326
|
kind: "single",
|
|
10299
|
-
steps:
|
|
10300
|
-
}), i =
|
|
10327
|
+
steps: n.first
|
|
10328
|
+
}), i = qp(e, {
|
|
10301
10329
|
kind: "single",
|
|
10302
|
-
steps: n
|
|
10330
|
+
steps: n.last
|
|
10303
10331
|
});
|
|
10304
10332
|
return !r || !i || !("node" in r) || !("node" in i) ? null : {
|
|
10305
10333
|
selector: t,
|
|
@@ -10311,7 +10339,7 @@ function Kp(e, t) {
|
|
|
10311
10339
|
}
|
|
10312
10340
|
let n = e, r = [];
|
|
10313
10341
|
for (let e of t.steps) {
|
|
10314
|
-
let t =
|
|
10342
|
+
let t = Kp(n, e);
|
|
10315
10343
|
if (!t) return null;
|
|
10316
10344
|
n = t.node, r.push(...t.path);
|
|
10317
10345
|
}
|
|
@@ -10323,14 +10351,14 @@ function Kp(e, t) {
|
|
|
10323
10351
|
}
|
|
10324
10352
|
//#endregion
|
|
10325
10353
|
//#region src/lib/text_parsers/citations.ts
|
|
10326
|
-
function
|
|
10354
|
+
function Jp(e, t = e) {
|
|
10327
10355
|
return {
|
|
10328
10356
|
content: [{ position: e }],
|
|
10329
10357
|
position: t,
|
|
10330
10358
|
type: "citation"
|
|
10331
10359
|
};
|
|
10332
10360
|
}
|
|
10333
|
-
var
|
|
10361
|
+
var Yp = _(String.raw`^« ?([^»\n]+)`, {
|
|
10334
10362
|
flags: "dm",
|
|
10335
10363
|
value: (e) => {
|
|
10336
10364
|
let t = e.indices[1], n = t[1];
|
|
@@ -10339,21 +10367,21 @@ var Jp = _(String.raw`^« ?([^»\n]+)`, {
|
|
|
10339
10367
|
stop: n
|
|
10340
10368
|
} };
|
|
10341
10369
|
}
|
|
10342
|
-
}),
|
|
10370
|
+
}), Xp = _(String.raw`« ?(.*?) ?»`, {
|
|
10343
10371
|
flags: "d",
|
|
10344
10372
|
value: (e, t) => {
|
|
10345
10373
|
let n = e.indices[1];
|
|
10346
|
-
return
|
|
10374
|
+
return Jp({
|
|
10347
10375
|
start: n[0],
|
|
10348
10376
|
stop: n[1]
|
|
10349
10377
|
}, t.position());
|
|
10350
10378
|
}
|
|
10351
10379
|
});
|
|
10352
|
-
function
|
|
10380
|
+
function Zp(e, t) {
|
|
10353
10381
|
let n = e.indexOf("\n", t);
|
|
10354
10382
|
return n === -1 ? !1 : /^[ \t]*«/u.test(e.slice(n + 1));
|
|
10355
10383
|
}
|
|
10356
|
-
function
|
|
10384
|
+
function Qp(e) {
|
|
10357
10385
|
return /»[.;]?\s*$/u.exec(e);
|
|
10358
10386
|
}
|
|
10359
10387
|
var Z = o((e) => {
|
|
@@ -10363,7 +10391,7 @@ var Z = o((e) => {
|
|
|
10363
10391
|
for (; r < t.length;) {
|
|
10364
10392
|
let a = t.indexOf("\n", r), o = a === -1 ? t.length : a, s = t.slice(r, o), c = /^[ \t]*« ?/u.exec(s);
|
|
10365
10393
|
if (c === null) break;
|
|
10366
|
-
let l = r + c[0].length, u = o, d =
|
|
10394
|
+
let l = r + c[0].length, u = o, d = Qp(s), f = Zp(t, o), p = s.slice(c[0].length).includes("«");
|
|
10367
10395
|
if (d !== null && (!f || !p)) for (u = r + d.index; u > l && /\s/u.test(t[u - 1]);) u--;
|
|
10368
10396
|
if (i.push({ position: {
|
|
10369
10397
|
start: l,
|
|
@@ -10379,7 +10407,7 @@ var Z = o((e) => {
|
|
|
10379
10407
|
if (a === -1) break;
|
|
10380
10408
|
r = a + 1;
|
|
10381
10409
|
}
|
|
10382
|
-
}, a([b(
|
|
10410
|
+
}, a([b(Yp, {
|
|
10383
10411
|
min: 1,
|
|
10384
10412
|
separator: _(String.raw`»?\n`),
|
|
10385
10413
|
value: (e) => e.map((e, t) => t === 0 ? e : e[1])
|
|
@@ -10387,8 +10415,8 @@ var Z = o((e) => {
|
|
|
10387
10415
|
content: e[0],
|
|
10388
10416
|
position: t.position(),
|
|
10389
10417
|
type: "citation"
|
|
10390
|
-
}) }), a([Pe,
|
|
10391
|
-
function
|
|
10418
|
+
}) }), a([Pe, Xp], { value: (e) => e[1] }));
|
|
10419
|
+
function $p(e, t) {
|
|
10392
10420
|
let n = 0, r = t.content[0].position, i = t.content.at(-1).position, a = t.content.map(({ position: t }) => e.input.slice(t.start, t.stop)).join("\n");
|
|
10393
10421
|
return {
|
|
10394
10422
|
input: e.text(t.position),
|
|
@@ -10419,12 +10447,12 @@ function Qp(e, t) {
|
|
|
10419
10447
|
title: "Conversion de citation"
|
|
10420
10448
|
};
|
|
10421
10449
|
}
|
|
10422
|
-
function
|
|
10423
|
-
return
|
|
10450
|
+
function em(e, t) {
|
|
10451
|
+
return $p(new x(e), t).output;
|
|
10424
10452
|
}
|
|
10425
10453
|
//#endregion
|
|
10426
10454
|
//#region src/lib/text_parsers/legal_text_aliases.ts
|
|
10427
|
-
var
|
|
10455
|
+
var tm = [
|
|
10428
10456
|
{
|
|
10429
10457
|
cid: "LEGITEXT000025024948",
|
|
10430
10458
|
nature: "CODE",
|
|
@@ -10434,7 +10462,7 @@ var em = [
|
|
|
10434
10462
|
{
|
|
10435
10463
|
cid: "LEGITEXT000006070716",
|
|
10436
10464
|
nature: "CODE",
|
|
10437
|
-
pattern: String.raw`c\.?\s*pr(?:oc(?:[eé]dure)?)?\.?\s*civ(?:il)?\.?|cpc`,
|
|
10465
|
+
pattern: String.raw`(?:code\s+de\s+|c\.?\s*)pr(?:oc(?:[eé]dure)?)?\.?\s*civ(?:il)?\.?|cpc`,
|
|
10438
10466
|
title: "Code de procédure civile"
|
|
10439
10467
|
},
|
|
10440
10468
|
{
|
|
@@ -10575,10 +10603,10 @@ var em = [
|
|
|
10575
10603
|
pattern: "(?:comofi|cmf)",
|
|
10576
10604
|
title: "Code monétaire et financier"
|
|
10577
10605
|
}
|
|
10578
|
-
],
|
|
10606
|
+
], nm = tm.map((e) => ({
|
|
10579
10607
|
alias: e,
|
|
10580
10608
|
regExp: RegExp(`^(?:${e.pattern})$`, "iv")
|
|
10581
|
-
})),
|
|
10609
|
+
})), rm = "cpce", im = {
|
|
10582
10610
|
execution: {
|
|
10583
10611
|
cid: "LEGITEXT000025024948",
|
|
10584
10612
|
nature: "CODE",
|
|
@@ -10589,26 +10617,26 @@ var em = [
|
|
|
10589
10617
|
nature: "CODE",
|
|
10590
10618
|
title: "Code des postes et des communications électroniques"
|
|
10591
10619
|
}
|
|
10592
|
-
},
|
|
10620
|
+
}, am = tm.map(({ cid: e, title: t }) => ({
|
|
10593
10621
|
cid: e,
|
|
10594
10622
|
normalizedTitle: t.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/gu, "").replace(/\s+/gu, " ").trim()
|
|
10595
10623
|
}));
|
|
10596
|
-
function
|
|
10597
|
-
let t = e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/gu, "").replace(/\s+/gu, " ").trim(), n =
|
|
10624
|
+
function om(e) {
|
|
10625
|
+
let t = e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/gu, "").replace(/\s+/gu, " ").trim(), n = nm.find(({ regExp: e }) => e.test(t));
|
|
10598
10626
|
if (n !== void 0) return n.alias.cid;
|
|
10599
10627
|
let r = t.match(/^(?:le\s+|la\s+|du\s+|de\s+la\s+|de\s+l')?(code\b.+)$/);
|
|
10600
10628
|
if (r === null || r[1] === void 0) return;
|
|
10601
|
-
let i = r[1], a =
|
|
10629
|
+
let i = r[1], a = am.filter(({ normalizedTitle: e }) => e.startsWith(i));
|
|
10602
10630
|
return a.length === 1 ? a[0].cid : void 0;
|
|
10603
10631
|
}
|
|
10604
|
-
new Set([...
|
|
10605
|
-
var
|
|
10606
|
-
info:
|
|
10632
|
+
new Set([...tm.map(({ cid: e }) => e), ...Object.values(im).map(({ cid: e }) => e)]);
|
|
10633
|
+
var sm = [{
|
|
10634
|
+
info: im.execution,
|
|
10607
10635
|
regExp: /code\s+des?\s+proc[eé]dures?\s+(?:civiles?\s+)?d['’]\s*ex(?:c)?[eé]cution/giu
|
|
10608
10636
|
}, {
|
|
10609
|
-
info:
|
|
10637
|
+
info: im.postes,
|
|
10610
10638
|
regExp: /code\s+des\s+postes\s+et\s+(?:des?\s+)?communications?\s+[eé]lectroniques?/giu
|
|
10611
|
-
}],
|
|
10639
|
+
}], cm = `(?:${[...tm.map(({ pattern: e }) => `(?:${e})`), rm].join("|")})`, lm = {
|
|
10612
10640
|
I: {
|
|
10613
10641
|
cid: "LEGITEXT000006069568",
|
|
10614
10642
|
nature: "CODE",
|
|
@@ -10630,9 +10658,9 @@ var om = [{
|
|
|
10630
10658
|
title: "Code général des impôts, annexe IV"
|
|
10631
10659
|
}
|
|
10632
10660
|
};
|
|
10633
|
-
function
|
|
10661
|
+
function um(e, t) {
|
|
10634
10662
|
let n = [];
|
|
10635
|
-
for (let { info: r, regExp: i } of
|
|
10663
|
+
for (let { info: r, regExp: i } of sm) {
|
|
10636
10664
|
i.lastIndex = 0;
|
|
10637
10665
|
for (let a of e.matchAll(i)) a.index <= t.start && n.push({
|
|
10638
10666
|
index: a.index,
|
|
@@ -10641,9 +10669,9 @@ function lm(e, t) {
|
|
|
10641
10669
|
}
|
|
10642
10670
|
return n.sort((e, t) => t.index - e.index), n[0]?.info;
|
|
10643
10671
|
}
|
|
10644
|
-
function
|
|
10645
|
-
if (/^cpce$/iv.test(e)) return t === void 0 ? void 0 :
|
|
10646
|
-
let n =
|
|
10672
|
+
function dm(e, t) {
|
|
10673
|
+
if (/^cpce$/iv.test(e)) return t === void 0 ? void 0 : um(t.input, t.position);
|
|
10674
|
+
let n = nm.find(({ regExp: t }) => t.test(e))?.alias;
|
|
10647
10675
|
if (n === void 0) return;
|
|
10648
10676
|
let { cid: r, nature: i, title: a } = n;
|
|
10649
10677
|
return {
|
|
@@ -10652,15 +10680,15 @@ function um(e, t) {
|
|
|
10652
10680
|
title: a
|
|
10653
10681
|
};
|
|
10654
10682
|
}
|
|
10655
|
-
function
|
|
10683
|
+
function fm(e, t) {
|
|
10656
10684
|
return e.cid === "LEGITEXT000006070716" && t !== void 0 && /^[LR]\d/u.test(t) ? {
|
|
10657
|
-
...
|
|
10685
|
+
...im.execution,
|
|
10658
10686
|
position: e.position,
|
|
10659
10687
|
type: "texte"
|
|
10660
10688
|
} : e;
|
|
10661
10689
|
}
|
|
10662
|
-
function
|
|
10663
|
-
let r =
|
|
10690
|
+
function pm(e, t, n) {
|
|
10691
|
+
let r = dm(e, n === void 0 ? void 0 : {
|
|
10664
10692
|
input: n,
|
|
10665
10693
|
position: t
|
|
10666
10694
|
});
|
|
@@ -10670,39 +10698,39 @@ function fm(e, t, n) {
|
|
|
10670
10698
|
type: "texte"
|
|
10671
10699
|
};
|
|
10672
10700
|
}
|
|
10673
|
-
var
|
|
10701
|
+
var mm = o(...tm.map(({ pattern: e }) => _(`${e}(?=$|\\P{Alphabetic})`, {
|
|
10674
10702
|
flags: "iv",
|
|
10675
|
-
value: (e, t) =>
|
|
10676
|
-
})), _(`${
|
|
10703
|
+
value: (e, t) => pm(e[0], t.position(), t.input)
|
|
10704
|
+
})), _(`${rm}(?=$|\\P{Alphabetic})`, {
|
|
10677
10705
|
flags: "iv",
|
|
10678
|
-
value: (e, t) =>
|
|
10706
|
+
value: (e, t) => pm(e[0], t.position(), t.input)
|
|
10679
10707
|
}));
|
|
10680
10708
|
//#endregion
|
|
10681
10709
|
//#region src/lib/text_parsers/doctrinal_references.ts
|
|
10682
|
-
function
|
|
10710
|
+
function hm(e, t) {
|
|
10683
10711
|
let n = e.indices?.groups?.[t];
|
|
10684
10712
|
return n === void 0 ? void 0 : {
|
|
10685
10713
|
start: n[0],
|
|
10686
10714
|
stop: n[1]
|
|
10687
10715
|
};
|
|
10688
10716
|
}
|
|
10689
|
-
function
|
|
10717
|
+
function gm(e) {
|
|
10690
10718
|
let t = e.match(/^(?<article>.*\d(?:[\p{L}\d-]*))\s+(?<subdivision>[IVXLCDM]+(?:\s+(?:bis|ter|quater))?|\d+\s*(?:°|º|er|e|ème))$/iu)?.groups?.article?.trim() ?? e;
|
|
10691
10719
|
return {
|
|
10692
10720
|
num: Yt(t),
|
|
10693
10721
|
parsedArticleText: t
|
|
10694
10722
|
};
|
|
10695
10723
|
}
|
|
10696
|
-
function
|
|
10724
|
+
function _m(e, t) {
|
|
10697
10725
|
let n = e.groups?.article?.trim(), r = e.groups?.text;
|
|
10698
10726
|
if (n === void 0 || r === void 0) return;
|
|
10699
|
-
let i =
|
|
10727
|
+
let i = hm(e, "articleKeyword");
|
|
10700
10728
|
if (i === void 0 && !/^(?:(?:L\.?\s*O|[LRDA])\*?\.?\s*)\d/iu.test(n)) return;
|
|
10701
|
-
let { num: a, parsedArticleText: o } =
|
|
10729
|
+
let { num: a, parsedArticleText: o } = gm(n), s = hm(e, "article"), c = hm(e, "text");
|
|
10702
10730
|
if (a === void 0 || s === void 0 || c === void 0) return;
|
|
10703
|
-
let l =
|
|
10731
|
+
let l = pm(r, c, t.input);
|
|
10704
10732
|
if (l === void 0) return;
|
|
10705
|
-
let u =
|
|
10733
|
+
let u = fm(l, a), d = {
|
|
10706
10734
|
num: a,
|
|
10707
10735
|
position: {
|
|
10708
10736
|
start: i?.start ?? s.start,
|
|
@@ -10720,17 +10748,17 @@ function gm(e, t) {
|
|
|
10720
10748
|
type: "parent-enfant"
|
|
10721
10749
|
};
|
|
10722
10750
|
}
|
|
10723
|
-
var
|
|
10751
|
+
var vm = _(String.raw`cgi\s*,\s*ann(?:exe)?\.?\s*(IV|III|II|I)`, {
|
|
10724
10752
|
flags: "i",
|
|
10725
10753
|
value: (e, t) => {
|
|
10726
|
-
let n =
|
|
10754
|
+
let n = lm[e[1].toUpperCase()];
|
|
10727
10755
|
return n === void 0 ? void 0 : {
|
|
10728
10756
|
...n,
|
|
10729
10757
|
position: t.position(),
|
|
10730
10758
|
type: "texte"
|
|
10731
10759
|
};
|
|
10732
10760
|
}
|
|
10733
|
-
}),
|
|
10761
|
+
}), ym = y($t, { value: (e, t) => {
|
|
10734
10762
|
let n = t.position(), r = t.text(n), i = r.match(/^(?<article>.*\d(?:[\p{L}\d-]*))\s+\d+\s*(?:°|º|er|e|ème)$/iu)?.groups?.article?.trim() ?? r;
|
|
10735
10763
|
return {
|
|
10736
10764
|
num: Yt(i),
|
|
@@ -10740,25 +10768,25 @@ var _m = _(String.raw`cgi\s*,\s*ann(?:exe)?\.?\s*(IV|III|II|I)`, {
|
|
|
10740
10768
|
},
|
|
10741
10769
|
type: "article"
|
|
10742
10770
|
};
|
|
10743
|
-
} }),
|
|
10771
|
+
} }), bm = a([_(String.raw`\s*,\s*art(?:icle)?\.?\s+`, { flags: "i" }), ym], { value: (e) => e[1] }), xm = a([
|
|
10744
10772
|
S(_(String.raw`(?:le|la|les)\s+`, { flags: "i" }), { default: "" }),
|
|
10745
|
-
o(
|
|
10746
|
-
|
|
10773
|
+
o(vm, mm),
|
|
10774
|
+
bm
|
|
10747
10775
|
], { value: (e, t) => {
|
|
10748
10776
|
let n = e[2];
|
|
10749
10777
|
return {
|
|
10750
10778
|
child: n,
|
|
10751
|
-
parent:
|
|
10779
|
+
parent: fm(e[1], n.num),
|
|
10752
10780
|
position: t.position(),
|
|
10753
10781
|
type: "parent-enfant"
|
|
10754
10782
|
};
|
|
10755
|
-
} }),
|
|
10783
|
+
} }), Sm = _(String.raw`(?:(?<articleKeyword>articles?)\s+)?(?<article>\S[^\n,;:\(\)]*?)\s+(?:(?:du|de\s+la|de\s+l['’])\s+)?(?<text>${cm})(?=$|\P{Alphabetic})`, {
|
|
10756
10784
|
flags: "div",
|
|
10757
|
-
value: (e, t) =>
|
|
10758
|
-
}),
|
|
10785
|
+
value: (e, t) => _m(e, t)
|
|
10786
|
+
}), Cm = _(String.raw`(?<article1>(?:(?:L\.?\s*O|[LRDA])\*?\.?\s*)\d[^\n,;:\(\)]*?)\s+(?<coordinator>et|ou)\s+(?<article2>(?:(?:L\.?\s*O|[LRDA])\*?\.?\s*)\d[^\n,;:\(\)]*?)\s+(?:(?:du|de\s+la|de\s+l['’])\s+)?(?<text>${cm})(?=$|\P{Alphabetic})`, {
|
|
10759
10787
|
flags: "div",
|
|
10760
10788
|
value: (e, t) => {
|
|
10761
|
-
let n =
|
|
10789
|
+
let n = hm(e, "article1"), r = hm(e, "article2"), i = hm(e, "text"), a = e.groups?.article1, o = e.groups?.article2, s = e.groups?.coordinator, c = a === void 0 ? void 0 : Yt(a.trim()), l = o === void 0 ? void 0 : Yt(o.trim()), u = e.groups?.text === void 0 || i === void 0 ? void 0 : pm(e.groups.text, i, t.input);
|
|
10762
10790
|
if (!(n === void 0 || r === void 0 || c === void 0 || l === void 0 || s !== "et" && s !== "ou" || u === void 0)) return {
|
|
10763
10791
|
child: {
|
|
10764
10792
|
coordinator: s,
|
|
@@ -10778,7 +10806,7 @@ var _m = _(String.raw`cgi\s*,\s*ann(?:exe)?\.?\s*(IV|III|II|I)`, {
|
|
|
10778
10806
|
},
|
|
10779
10807
|
type: "enumeration"
|
|
10780
10808
|
},
|
|
10781
|
-
parent:
|
|
10809
|
+
parent: fm(fm(u, c), l),
|
|
10782
10810
|
position: {
|
|
10783
10811
|
start: n.start,
|
|
10784
10812
|
stop: u.position.stop
|
|
@@ -10786,7 +10814,7 @@ var _m = _(String.raw`cgi\s*,\s*ann(?:exe)?\.?\s*(IV|III|II|I)`, {
|
|
|
10786
10814
|
type: "parent-enfant"
|
|
10787
10815
|
};
|
|
10788
10816
|
}
|
|
10789
|
-
}),
|
|
10817
|
+
}), wm = o(xm, Cm, Sm), Tm = (e) => {
|
|
10790
10818
|
let t = e.offset, n = /,\s*(?:par\s+)?/guy;
|
|
10791
10819
|
if (n.lastIndex = t, !n.exec(e.input)) return;
|
|
10792
10820
|
e.offset = n.lastIndex;
|
|
@@ -10802,7 +10830,7 @@ var _m = _(String.raw`cgi\s*,\s*ann(?:exe)?\.?\s*(IV|III|II|I)`, {
|
|
|
10802
10830
|
}
|
|
10803
10831
|
return e.offset = i.lastIndex, e.length = 0, e.usedInputs = e.input.slice(t, e.offset), r;
|
|
10804
10832
|
};
|
|
10805
|
-
function
|
|
10833
|
+
function Em(e) {
|
|
10806
10834
|
for (let t = 0; t < e.length; t += 1) {
|
|
10807
10835
|
let n = t === 0 ? void 0 : e[t - 1];
|
|
10808
10836
|
if (n && /[\p{L}\p{N}_]/u.test(n)) continue;
|
|
@@ -10811,7 +10839,7 @@ function Tm(e) {
|
|
|
10811
10839
|
}
|
|
10812
10840
|
return null;
|
|
10813
10841
|
}
|
|
10814
|
-
function
|
|
10842
|
+
function Dm(e, t) {
|
|
10815
10843
|
let n = e.slice(0, Math.max(0, t)), r = /(?:^|[^\p{L}\p{N}_])les\s+/giu, i = null;
|
|
10816
10844
|
for (; r.exec(n) !== null;) {
|
|
10817
10845
|
let e = new x(n, r.lastIndex), t = Oe(e);
|
|
@@ -10819,7 +10847,7 @@ function Em(e, t) {
|
|
|
10819
10847
|
}
|
|
10820
10848
|
return i;
|
|
10821
10849
|
}
|
|
10822
|
-
function
|
|
10850
|
+
function Om(e) {
|
|
10823
10851
|
let t = [], n = /(?:,\s*)?par\s+/giu, r = 0, i;
|
|
10824
10852
|
for (; (i = n.exec(e)) !== null;) {
|
|
10825
10853
|
let a = new x(e, n.lastIndex);
|
|
@@ -10831,17 +10859,17 @@ function Dm(e) {
|
|
|
10831
10859
|
}
|
|
10832
10860
|
//#endregion
|
|
10833
10861
|
//#region src/lib/text_parsers/actions.ts
|
|
10834
|
-
var
|
|
10862
|
+
var km = (e) => a([
|
|
10835
10863
|
_(e, { flags: "i" }),
|
|
10836
|
-
|
|
10864
|
+
Tm,
|
|
10837
10865
|
_(e === "est" ? "remplacée?" : "remplacée?s", { flags: "i" })
|
|
10838
|
-
], { value: "remplacer" }),
|
|
10866
|
+
], { value: "remplacer" }), Am = o(t(_("(modalités|conditions) d'application (de )?", { flags: "i" }), {
|
|
10839
10867
|
lookbackLength: 35,
|
|
10840
10868
|
value: { action: "précision" }
|
|
10841
10869
|
}), t(_("en application (de )?", { flags: "i" }), {
|
|
10842
10870
|
lookbackLength: 35,
|
|
10843
10871
|
value: { action: "application" }
|
|
10844
|
-
})),
|
|
10872
|
+
})), jm = xe("après|avant|ajoutée?s?|insérée?s?|complétée?s?|rédigée?s?|suit|modifiée?s?|rétablie?s?|remplacée?s?|supprimée?s?|abrogée?s?|devient", o(a([
|
|
10845
10873
|
w,
|
|
10846
10874
|
_("est complété par les mots ?", { flags: "i" }),
|
|
10847
10875
|
_(" ?:"),
|
|
@@ -10909,7 +10937,7 @@ var Om = (e) => a([
|
|
|
10909
10937
|
}), _("est rétablie? (ainsi qu'il|comme) suit", {
|
|
10910
10938
|
flags: "i",
|
|
10911
10939
|
value: "rétablir"
|
|
10912
|
-
}),
|
|
10940
|
+
}), km("est"), _("est remplacée?", {
|
|
10913
10941
|
flags: "i",
|
|
10914
10942
|
value: "remplacer"
|
|
10915
10943
|
}), _("sont ainsi modifiée?s", {
|
|
@@ -10924,7 +10952,7 @@ var Om = (e) => a([
|
|
|
10924
10952
|
}), _("sont rétablie?s (ainsi qu'il|comme) suit", {
|
|
10925
10953
|
flags: "i",
|
|
10926
10954
|
value: "rétablir"
|
|
10927
|
-
}),
|
|
10955
|
+
}), km("sont"), _("sont remplacée?s", {
|
|
10928
10956
|
flags: "i",
|
|
10929
10957
|
value: "remplacer"
|
|
10930
10958
|
}), _("sont renum[eé]rotée?s", {
|
|
@@ -10944,7 +10972,7 @@ var Om = (e) => a([
|
|
|
10944
10972
|
}), _("est remplacée?", {
|
|
10945
10973
|
flags: "i",
|
|
10946
10974
|
value: "remplacer"
|
|
10947
|
-
}),
|
|
10975
|
+
}), km("est"), km("sont"), _("sont remplacée?s", {
|
|
10948
10976
|
flags: "i",
|
|
10949
10977
|
value: "remplacer"
|
|
10950
10978
|
}), _("est modifiée?", {
|
|
@@ -11104,23 +11132,23 @@ var Om = (e) => a([
|
|
|
11104
11132
|
}), _("est supprimée?", {
|
|
11105
11133
|
flags: "i",
|
|
11106
11134
|
value: "supprimer"
|
|
11107
|
-
}))], { value: (e) => ({ action: e[1] }) }))),
|
|
11135
|
+
}))], { value: (e) => ({ action: e[1] }) }))), Mm = o(dn, Tn), Nm = o(pn, Sn, mm, Me), Pm = a([Mm, b(a([e, Nm], { value: (e) => e[1] }))], { value: (e, t) => vt(e[0], e[1], t.position()) }), Fm = a([Nm, b(a([e, Nm], { value: (e) => e[1] }))], { value: (e, t) => vt(e[0], e[1], t.position()) }), Im = a([ee, Pm], { value: (e) => e[1] }), Lm = o(a([e, Fm], { value: (e) => e[1] }), Im), Rm = o(a([Ut, S(Lm, { default: null })], { value: (e) => {
|
|
11108
11136
|
let t = e[0], n = e[1];
|
|
11109
11137
|
return n === null ? t : ht(n, t);
|
|
11110
|
-
} }),
|
|
11138
|
+
} }), Pm), zm = o(a([Wt, S(Lm, { default: null })], { value: (e) => {
|
|
11111
11139
|
let t = e[0], n = e[1];
|
|
11112
11140
|
return n === null ? t : ht(n, t);
|
|
11113
|
-
} }),
|
|
11114
|
-
S(
|
|
11141
|
+
} }), Fm), Bm = a([
|
|
11142
|
+
S(Am, { default: null }),
|
|
11115
11143
|
a([
|
|
11116
11144
|
oe,
|
|
11117
|
-
|
|
11145
|
+
Rm,
|
|
11118
11146
|
S([S(_(" modifiée?s", { flags: "i" }), { default: "" }), _(" susvisée?s", { flags: "i" })], { default: "" })
|
|
11119
11147
|
], { value: (e, t) => ({
|
|
11120
11148
|
...e[1],
|
|
11121
11149
|
position: t.position()
|
|
11122
11150
|
}) }),
|
|
11123
|
-
S(
|
|
11151
|
+
S(jm, { default: null })
|
|
11124
11152
|
], { value: (e, t) => {
|
|
11125
11153
|
let n = e[2] ?? e[0];
|
|
11126
11154
|
return n === null ? e[1] : {
|
|
@@ -11129,18 +11157,18 @@ var Om = (e) => a([
|
|
|
11129
11157
|
reference: e[1],
|
|
11130
11158
|
type: "reference_et_action"
|
|
11131
11159
|
};
|
|
11132
|
-
} }),
|
|
11133
|
-
S(
|
|
11160
|
+
} }), Vm = o(a([
|
|
11161
|
+
S(Am, { default: null }),
|
|
11134
11162
|
a([
|
|
11135
11163
|
ce,
|
|
11136
|
-
|
|
11164
|
+
zm,
|
|
11137
11165
|
S([S(_(" modifiée?", { flags: "i" }), { default: "" }), _(" susvisée?", { flags: "i" })], { default: "" }),
|
|
11138
11166
|
S(_(String.raw`, ?qui devient [^,]+ ","`, { flags: "i" }), { default: "" })
|
|
11139
11167
|
], { value: (e, t) => ({
|
|
11140
11168
|
...e[1],
|
|
11141
11169
|
position: t.position()
|
|
11142
11170
|
}) }),
|
|
11143
|
-
S(
|
|
11171
|
+
S(jm, { default: null })
|
|
11144
11172
|
], { value: (e, t) => {
|
|
11145
11173
|
let n = e[2] ?? e[0];
|
|
11146
11174
|
return n === null ? e[1] : {
|
|
@@ -11149,41 +11177,41 @@ var Om = (e) => a([
|
|
|
11149
11177
|
reference: e[1],
|
|
11150
11178
|
type: "reference_et_action"
|
|
11151
11179
|
};
|
|
11152
|
-
} }),
|
|
11180
|
+
} }), Bm), Hm = xe("article|loi|décret|code|alinéa|phrase|chapitre|titre|livre|partie|section|paragraphe|ordonnance|constitution|directive|règlement|\\d|[ivxlc]+|[a-zA-Z]", a([Vm, b([o(wt, Ct), Vm])], { value: (e, t) => gt(e[0], e[1], t.position()) })), Um = y(zm, { value: (e, t) => ({
|
|
11153
11181
|
...e,
|
|
11154
11182
|
position: t.position()
|
|
11155
|
-
}) }),
|
|
11183
|
+
}) }), Wm = o(b(Um, {
|
|
11156
11184
|
min: 2,
|
|
11157
11185
|
separator: i,
|
|
11158
11186
|
value: (e) => [e[0], ...e.slice(1).map(([, e]) => e)]
|
|
11159
|
-
}), b(
|
|
11187
|
+
}), b(Um, {
|
|
11160
11188
|
min: 2,
|
|
11161
11189
|
separator: _(String.raw`\n`),
|
|
11162
11190
|
value: (e) => [e[0], ...e.slice(1).map(([, e]) => e)]
|
|
11163
|
-
}), y(
|
|
11191
|
+
}), y(Um, { value: (e) => [e] }));
|
|
11164
11192
|
//#endregion
|
|
11165
11193
|
//#region src/lib/extractors/references.ts
|
|
11166
|
-
function
|
|
11194
|
+
function Gm({ text: e }) {
|
|
11167
11195
|
return /^\p{Lowercase_Letter}$/u.test(e);
|
|
11168
11196
|
}
|
|
11169
|
-
function
|
|
11197
|
+
function Km(e) {
|
|
11170
11198
|
return !/^[\p{Alphabetic}\p{Decimal_Number}]$/u.test(e);
|
|
11171
11199
|
}
|
|
11172
|
-
function
|
|
11200
|
+
function qm(e) {
|
|
11173
11201
|
return e !== void 0 && /^[\p{Alphabetic}\p{Decimal_Number}«]$/u.test(e);
|
|
11174
11202
|
}
|
|
11175
|
-
function
|
|
11203
|
+
function Jm(e, t) {
|
|
11176
11204
|
if (t <= 0) return !0;
|
|
11177
11205
|
let n = e[t - 1], r = e[t];
|
|
11178
|
-
return
|
|
11206
|
+
return qm(r) && (Km(n) || Km(r));
|
|
11179
11207
|
}
|
|
11180
|
-
function
|
|
11181
|
-
return e !== void 0 &&
|
|
11208
|
+
function Ym(e) {
|
|
11209
|
+
return e !== void 0 && Gm(e) ? 5 : void 0;
|
|
11182
11210
|
}
|
|
11183
|
-
function*
|
|
11211
|
+
function* Xm(e, t, n = {}) {
|
|
11184
11212
|
n.diagnostics !== void 0 && n.diagnostics.citationCount++;
|
|
11185
|
-
let r =
|
|
11186
|
-
for (let e of
|
|
11213
|
+
let r = $p(e, t), i = new x(r.output), a = g(r);
|
|
11214
|
+
for (let e of Qm(i, n)) {
|
|
11187
11215
|
e = structuredClone(e), t.references === void 0 && (t.references = []), t.references.push(e);
|
|
11188
11216
|
for (let t of St(e)) {
|
|
11189
11217
|
let e = t.position;
|
|
@@ -11192,134 +11220,138 @@ function* Ym(e, t, n = {}) {
|
|
|
11192
11220
|
yield e;
|
|
11193
11221
|
}
|
|
11194
11222
|
}
|
|
11195
|
-
function* Xm(e, t = {}) {
|
|
11196
|
-
yield* Zm(e, t);
|
|
11197
|
-
}
|
|
11198
11223
|
function* Zm(e, t = {}) {
|
|
11199
|
-
|
|
11224
|
+
yield* Qm(e, t);
|
|
11225
|
+
}
|
|
11226
|
+
function* Qm(e, t = {}) {
|
|
11227
|
+
let n = xe(String.raw`arrêtés?|circulaires?|code|constitution|décrets?(?:-loi)?|loi|ordonnance|art\.|articles?|chapitre|livre|paragraphe|partie|section|sous-paragraphe|sous-section|sous-sous-paragraphe|sous-titre|titre|alinéas?|phrases?|règlements?|directives?|décisions?|«|[IVXLCDM]+|[A-Z]|\d+`, o(Z, nn, vn, wm, Hm), 80, String.raw`(?<=^|\P{Alphabetic})(?:arrêtés?|circulaires?|code|constitution|décrets?(?:-loi)?|loi|ordonnance|art\.|articles?|chapitre|livre|paragraphe|partie|section|sous-paragraphe|sous-section|sous-sous-paragraphe|sous-titre|titre|alinéas?|phrases?|règlements?|directives?|décisions?|«|[IVXLCDM]+|[A-Z]|\d+)(?=$|\P{Alphabetic})`);
|
|
11200
11228
|
for (let r of n.extract(e, {
|
|
11201
|
-
canStartAtOffset:
|
|
11229
|
+
canStartAtOffset: Jm,
|
|
11202
11230
|
diagnostics: t.diagnostics?.fastPath,
|
|
11203
11231
|
overlapWindow: 80,
|
|
11204
|
-
overlapWindowForCandidate: (e, n) => t.overlapWindowForCandidate?.(e) ??
|
|
11205
|
-
})) if (r !== void 0) if (r.type === "citation") yield*
|
|
11232
|
+
overlapWindowForCandidate: (e, n) => t.overlapWindowForCandidate?.(e) ?? Ym(n)
|
|
11233
|
+
})) if (r !== void 0) if (r.type === "citation") yield* Xm(e, r, t);
|
|
11206
11234
|
else {
|
|
11207
11235
|
if (r.type === "reference_et_action" || r.type === "alinéa" || r.type === "article" || r.type === "chapitre" || r.type === "item" || r.type === "livre" || r.type === "paragraphe" || r.type === "partie" || r.type === "phrase" || r.type === "section" || r.type === "sous-paragraphe" || r.type === "sous-section" || r.type === "sous-sous-paragraphe" || r.type === "sous-titre" || r.type === "titre" || r.type === "texte" || r.type === "bounded-interval" || r.type === "counted-interval" || r.type === "enumeration" || r.type === "exclusion" || r.type === "parent-enfant" || r.type === "incomplete-header") {
|
|
11208
11236
|
for (let n of St(r)) if (n.type === "reference_et_action") {
|
|
11209
11237
|
let { originalCitations: r } = n.action;
|
|
11210
|
-
if (r !== void 0) for (let n of r) for (let r of
|
|
11238
|
+
if (r !== void 0) for (let n of r) for (let r of Xm(e, n, t));
|
|
11211
11239
|
}
|
|
11212
11240
|
}
|
|
11213
11241
|
yield r;
|
|
11214
11242
|
}
|
|
11215
11243
|
}
|
|
11216
|
-
function*
|
|
11244
|
+
function* $m(e, t, n = {}) {
|
|
11217
11245
|
let r = g(t);
|
|
11218
|
-
for (let t of
|
|
11246
|
+
for (let t of Zm(e, n)) {
|
|
11219
11247
|
for (let e of St(t, { citations: !0 })) e.position !== void 0 && (e.originalTransformation = s(r, e.position));
|
|
11220
11248
|
yield t;
|
|
11221
11249
|
}
|
|
11222
11250
|
}
|
|
11223
|
-
var
|
|
11251
|
+
var eh = (e) => [...Zm(e)], th = (e, t) => [...$m(e, t)], nh = "(?:avant|apr[eè]s)", rh = o(_("avant(?![-A-Za-zÀ-ÖØ-öø-ÿ0-9_])", {
|
|
11224
11252
|
flags: "i",
|
|
11225
11253
|
value: "before"
|
|
11226
11254
|
}), _("apr[eè]s(?![-A-Za-zÀ-ÖØ-öø-ÿ0-9_])", {
|
|
11227
11255
|
flags: "i",
|
|
11228
11256
|
value: "after"
|
|
11229
|
-
})),
|
|
11257
|
+
})), ih = o(_("(?:au|a[uù])\\s+d[eé]but\\b", {
|
|
11230
11258
|
flags: "i",
|
|
11231
11259
|
value: "start"
|
|
11232
11260
|
}), _("(?:a|à)\\s+la\\s+fin\\b", {
|
|
11233
11261
|
flags: "i",
|
|
11234
11262
|
value: "end"
|
|
11235
11263
|
}));
|
|
11236
|
-
function
|
|
11264
|
+
function ah(e) {
|
|
11237
11265
|
return e === "before" ? "insert_before" : "insert_after";
|
|
11238
11266
|
}
|
|
11239
|
-
function
|
|
11240
|
-
let t =
|
|
11267
|
+
function oh(e) {
|
|
11268
|
+
let t = ch(e), n = /(?:^|[^\p{L}\p{N}_-])(avant|apres)(?![\p{L}\p{N}_-])/u.exec(t);
|
|
11241
11269
|
return n ? n[1] === "avant" ? "before" : "after" : null;
|
|
11242
11270
|
}
|
|
11243
|
-
function
|
|
11271
|
+
function sh(e) {
|
|
11272
|
+
let t = ch(e), n = /(?:^|[^\p{L}\p{N}_-])(?:au|a[uù])\s+debut\b/u.exec(t), r = /(?:^|[^\p{L}\p{N}_-])a\s+la\s+fin\b/u.exec(t);
|
|
11273
|
+
return !n && !r ? null : n ? r ? n.index <= r.index ? "start" : "end" : "start" : "end";
|
|
11274
|
+
}
|
|
11275
|
+
function ch(e) {
|
|
11244
11276
|
return e.toLowerCase().normalize("NFD").replace(/\p{Diacritic}/gu, "");
|
|
11245
11277
|
}
|
|
11246
11278
|
//#endregion
|
|
11247
11279
|
//#region src/lib/text_parsers/action_words.ts
|
|
11248
|
-
var
|
|
11249
|
-
function
|
|
11280
|
+
var lh = /\b(ins[èe]re|ins[ée]r[ée]|ajout|remplac|supprim|abrog|compl[èeé]t|r[ée]dig|r[ée]tabl|modifi(?:e|é|ée|és|ées|er|ant|ent))/iu;
|
|
11281
|
+
function uh(e) {
|
|
11250
11282
|
return e.toLowerCase().normalize("NFD").replace(/\p{Diacritic}/gu, "");
|
|
11251
11283
|
}
|
|
11252
|
-
function
|
|
11284
|
+
function dh(e, t = e) {
|
|
11253
11285
|
return /\bredige\b|\bredigee\b|\bredigees\b|\brediges\b|\bainsi\b/.test(e) || /\bdispositions suivantes\b/.test(t);
|
|
11254
11286
|
}
|
|
11255
|
-
function
|
|
11256
|
-
return
|
|
11287
|
+
function fh(e) {
|
|
11288
|
+
return oh(e) === "after";
|
|
11257
11289
|
}
|
|
11258
|
-
function
|
|
11259
|
-
return
|
|
11290
|
+
function ph(e) {
|
|
11291
|
+
return oh(e) === "before";
|
|
11260
11292
|
}
|
|
11261
|
-
function
|
|
11293
|
+
function mh(e) {
|
|
11262
11294
|
return /\bretabl/.test(e);
|
|
11263
11295
|
}
|
|
11264
|
-
function
|
|
11296
|
+
function hh(e) {
|
|
11265
11297
|
return /\binsere(?:e|es|s)?\b|\bajoute\b|\bajoutee\b|\bajoutes\b|\bajoutees\b|\bcomplete(?:e|es|s)?\b/.test(e);
|
|
11266
11298
|
}
|
|
11267
|
-
function
|
|
11299
|
+
function gh(e) {
|
|
11268
11300
|
return /\bremplace\b|\bremplacee\b|\bremplaces\b|\bremplacees\b/.test(e);
|
|
11269
11301
|
}
|
|
11270
|
-
function
|
|
11302
|
+
function _h(e) {
|
|
11271
11303
|
return /\bsupprime\b|\bsupprimee\b|\bsupprimes\b|\bsupprimees\b|\babroge\b|\babrogee\b|\babroges\b|\babrogees\b/.test(e);
|
|
11272
11304
|
}
|
|
11273
|
-
function
|
|
11305
|
+
function vh(e) {
|
|
11274
11306
|
return /\b(remplace|modifie|redige|rediges|redigee|redigees)\b/.test(e);
|
|
11275
11307
|
}
|
|
11276
11308
|
//#endregion
|
|
11277
11309
|
//#region src/lib/extractors/portion_references.ts
|
|
11278
|
-
function
|
|
11310
|
+
function yh(e, t) {
|
|
11279
11311
|
e && (e.start += t, e.stop += t);
|
|
11280
11312
|
}
|
|
11281
|
-
function
|
|
11313
|
+
function bh(e, t) {
|
|
11282
11314
|
if (e.type === "parent-enfant") {
|
|
11283
|
-
|
|
11315
|
+
bh(e.parent, t), bh(e.child, t), yh(e.position, t);
|
|
11284
11316
|
return;
|
|
11285
11317
|
}
|
|
11286
11318
|
if (e.type === "bounded-interval") {
|
|
11287
|
-
|
|
11319
|
+
bh(e.first, t), bh(e.last, t), yh(e.position, t);
|
|
11288
11320
|
return;
|
|
11289
11321
|
}
|
|
11290
11322
|
if (e.type === "counted-interval") {
|
|
11291
|
-
|
|
11323
|
+
bh(e.first, t), yh(e.position, t);
|
|
11292
11324
|
return;
|
|
11293
11325
|
}
|
|
11294
11326
|
if (e.type === "enumeration" || e.type === "exclusion") {
|
|
11295
|
-
|
|
11327
|
+
bh(e.left, t), bh(e.right, t), yh(e.position, t);
|
|
11296
11328
|
return;
|
|
11297
11329
|
}
|
|
11298
11330
|
if (e.type === "reference_et_action") {
|
|
11299
|
-
|
|
11331
|
+
bh(e.reference, t), yh(e.position, t);
|
|
11300
11332
|
return;
|
|
11301
11333
|
}
|
|
11302
|
-
|
|
11334
|
+
yh(e.position, t);
|
|
11303
11335
|
}
|
|
11304
|
-
function
|
|
11336
|
+
function xh(e) {
|
|
11305
11337
|
return e.replace(/\b(de\s+l['’]?|de\s+la|de\s+le|du|des)\s*$/i, "");
|
|
11306
11338
|
}
|
|
11307
|
-
function
|
|
11339
|
+
function Sh(e) {
|
|
11308
11340
|
let t = /^(?:(?:[aà]\s+)?l['’]|(?:[aà]\s+)?la\b|(?:[aà]\s+)?le\b|les\b|des\b|aux\b|du\b)\s*/iu.exec(e)?.[0].length ?? 0, n = e.slice(t > 0 ? t : 0).trim();
|
|
11309
11341
|
return n ? {
|
|
11310
11342
|
text: n,
|
|
11311
11343
|
offset: t
|
|
11312
11344
|
} : null;
|
|
11313
11345
|
}
|
|
11314
|
-
function
|
|
11346
|
+
function Ch(e) {
|
|
11315
11347
|
return [...e.matchAll(/(?:^|\P{L})(\p{L})/gu)].map((e) => (e.index ?? 0) + e[0].length - (e[1]?.length ?? 0));
|
|
11316
11348
|
}
|
|
11317
|
-
function
|
|
11349
|
+
function wh(e) {
|
|
11318
11350
|
let t = new x(e), n = zt(t);
|
|
11319
11351
|
return !n || t.remaining().trim().length !== 0 ? null : n;
|
|
11320
11352
|
}
|
|
11321
|
-
function
|
|
11322
|
-
for (let t of
|
|
11353
|
+
function Th(e) {
|
|
11354
|
+
for (let t of Ch(e)) {
|
|
11323
11355
|
let n = new x(e, t), r = Dt(n);
|
|
11324
11356
|
if (!(r === void 0 || n.remaining().trim() !== "")) return {
|
|
11325
11357
|
nature: r,
|
|
@@ -11328,17 +11360,17 @@ function Ch(e) {
|
|
|
11328
11360
|
}
|
|
11329
11361
|
return null;
|
|
11330
11362
|
}
|
|
11331
|
-
function
|
|
11363
|
+
function Eh(e, t) {
|
|
11332
11364
|
let n = e.trim().replace(/[;:,]\s*$/u, "").replace(/\b(?:est|sont)\s*$/iu, "").trim();
|
|
11333
11365
|
if (!n) return null;
|
|
11334
|
-
for (let e of
|
|
11335
|
-
let r = n.slice(e).trim(), i =
|
|
11366
|
+
for (let e of Ch(n)) {
|
|
11367
|
+
let r = n.slice(e).trim(), i = Th(r);
|
|
11336
11368
|
if (!i) continue;
|
|
11337
|
-
let a =
|
|
11369
|
+
let a = Om(r.slice(0, i.start)).trim();
|
|
11338
11370
|
if (!a) continue;
|
|
11339
11371
|
let o = /\s*(,|\bet\b|\bou\b|(?<!\p{L})[aà](?!\p{L}))\s*/giu, s = [], c = 0, l;
|
|
11340
11372
|
for (; (l = o.exec(a)) !== null;) {
|
|
11341
|
-
let e =
|
|
11373
|
+
let e = uh(l[1] ?? "");
|
|
11342
11374
|
if (a.slice(c, l.index).trim() === "") {
|
|
11343
11375
|
e !== "a" && e !== "à" && (c = o.lastIndex);
|
|
11344
11376
|
continue;
|
|
@@ -11355,17 +11387,17 @@ function wh(e, t) {
|
|
|
11355
11387
|
}), s.length < 2) continue;
|
|
11356
11388
|
let u = s.some((e) => e.separator === "à"), d = [], f = [], p = !0, m = i.nature, h;
|
|
11357
11389
|
for (let [n, r] of s.entries()) {
|
|
11358
|
-
let i =
|
|
11390
|
+
let i = Sh(r.text);
|
|
11359
11391
|
if (!i) {
|
|
11360
11392
|
d.length = 0;
|
|
11361
11393
|
break;
|
|
11362
11394
|
}
|
|
11363
|
-
let a =
|
|
11395
|
+
let a = wh(`${i.text} ${m}`);
|
|
11364
11396
|
if (!a) {
|
|
11365
11397
|
d.length = 0;
|
|
11366
11398
|
break;
|
|
11367
11399
|
}
|
|
11368
|
-
|
|
11400
|
+
bh(a, t + e + r.start + i.offset), d.push(a), a.type !== m || a.index === void 0 || a.index < 1 ? p = !1 : (h !== void 0 && !u && a.index !== h + 1 && (p = !1), h = a.index), n < s.length - 1 && (f.push(r.separator ?? "et"), (r.separator ?? "et") === "ou" && (p = !1));
|
|
11369
11401
|
}
|
|
11370
11402
|
let [g, ..._] = d;
|
|
11371
11403
|
if (!g || _.length === 0) continue;
|
|
@@ -11382,16 +11414,16 @@ function wh(e, t) {
|
|
|
11382
11414
|
}
|
|
11383
11415
|
return null;
|
|
11384
11416
|
}
|
|
11385
|
-
function
|
|
11417
|
+
function Dh(e, t) {
|
|
11386
11418
|
let n = e.trim().replace(/[;:,]\s*$/u, "").replace(/\b(?:est|sont)\s*$/iu, "").trim();
|
|
11387
11419
|
if (!n) return null;
|
|
11388
|
-
for (let e of
|
|
11420
|
+
for (let e of Ch(n)) {
|
|
11389
11421
|
let r = n.slice(e);
|
|
11390
11422
|
if (!r) continue;
|
|
11391
11423
|
let i = new x(r), a = zt(i);
|
|
11392
11424
|
if (!a || i.offset === 0 || !ee(i)) continue;
|
|
11393
|
-
let o = i.offset, s =
|
|
11394
|
-
if (s) return
|
|
11425
|
+
let o = i.offset, s = Eh(r.slice(o), t + e + o);
|
|
11426
|
+
if (s) return bh(a, t + e), {
|
|
11395
11427
|
...ht(s, a),
|
|
11396
11428
|
position: {
|
|
11397
11429
|
start: a.position.start,
|
|
@@ -11401,57 +11433,57 @@ function Th(e, t) {
|
|
|
11401
11433
|
}
|
|
11402
11434
|
return null;
|
|
11403
11435
|
}
|
|
11404
|
-
function
|
|
11405
|
-
let n =
|
|
11436
|
+
function Oh(e, t) {
|
|
11437
|
+
let n = xh(e);
|
|
11406
11438
|
if (!n) return null;
|
|
11407
|
-
let r =
|
|
11439
|
+
let r = Dh(n, t);
|
|
11408
11440
|
if (r) return r;
|
|
11409
|
-
let i =
|
|
11441
|
+
let i = Eh(n, t);
|
|
11410
11442
|
if (i) return i;
|
|
11411
|
-
for (let e of
|
|
11443
|
+
for (let e of Ch(n)) {
|
|
11412
11444
|
let r = n.slice(e);
|
|
11413
11445
|
if (!r) continue;
|
|
11414
11446
|
let i = new x(r), a = zt(i);
|
|
11415
|
-
if (!(!a || i.offset === 0) && r.slice(i.offset).trim().length === 0) return
|
|
11447
|
+
if (!(!a || i.offset === 0) && r.slice(i.offset).trim().length === 0) return bh(a, t + e), a;
|
|
11416
11448
|
}
|
|
11417
11449
|
return null;
|
|
11418
11450
|
}
|
|
11419
|
-
function
|
|
11420
|
-
return Math.max(0, ...
|
|
11451
|
+
function kh(e) {
|
|
11452
|
+
return Math.max(0, ...Vp(e).map((e) => e.kind === "single" ? e.steps.length : Math.max(e.first.length, e.last.length)));
|
|
11421
11453
|
}
|
|
11422
|
-
function
|
|
11423
|
-
return
|
|
11454
|
+
function Ah(e) {
|
|
11455
|
+
return Vp(e).length;
|
|
11424
11456
|
}
|
|
11425
|
-
function
|
|
11457
|
+
function jh(e, t) {
|
|
11426
11458
|
if (!e) return t;
|
|
11427
11459
|
if (!t) return e;
|
|
11428
|
-
let n =
|
|
11429
|
-
return n === r ?
|
|
11460
|
+
let n = kh(e), r = kh(t);
|
|
11461
|
+
return n === r ? Ah(e) >= Ah(t) ? e : t : n > r ? e : t;
|
|
11430
11462
|
}
|
|
11431
|
-
function
|
|
11463
|
+
function Mh(e) {
|
|
11432
11464
|
return e.map((e) => ({
|
|
11433
11465
|
reference: e,
|
|
11434
|
-
specificity:
|
|
11466
|
+
specificity: kh(e)
|
|
11435
11467
|
})).filter((e) => e.specificity > 0).sort((e, t) => t.specificity - e.specificity)[0]?.reference ?? null;
|
|
11436
11468
|
}
|
|
11437
|
-
function
|
|
11469
|
+
function Nh(e, { actionIndex: t = e.length } = {}) {
|
|
11438
11470
|
let n = /\barticle\b/i.exec(e);
|
|
11439
11471
|
if (!n || n.index === void 0) return null;
|
|
11440
11472
|
let r = n.index, i = new x(e.slice(r)), a = pn(i);
|
|
11441
11473
|
if (!a) return null;
|
|
11442
|
-
|
|
11443
|
-
let o = e.slice(0, r), s = r + i.offset, c = e.slice(s, t), l =
|
|
11474
|
+
bh(a, r);
|
|
11475
|
+
let o = e.slice(0, r), s = r + i.offset, c = e.slice(s, t), l = jh(Mh(Ph(o)), Oh(o, 0)) ?? Mh(Ph(c)) ?? Oh(c, s);
|
|
11444
11476
|
return l ? ht(a, l) : null;
|
|
11445
11477
|
}
|
|
11446
|
-
function
|
|
11447
|
-
return
|
|
11478
|
+
function Ph(e) {
|
|
11479
|
+
return eh(new x(e));
|
|
11448
11480
|
}
|
|
11449
11481
|
//#endregion
|
|
11450
11482
|
//#region src/lib/extractors/quoted_text.ts
|
|
11451
|
-
function
|
|
11483
|
+
function Fh(e) {
|
|
11452
11484
|
return e.split(/\n+/).map((e) => e.replace(/^\s*[«“"]\s*/u, "").trim()).filter((e) => e.length > 0).join("\n").replace(/[»”"]\s*$/u, "").trim();
|
|
11453
11485
|
}
|
|
11454
|
-
function
|
|
11486
|
+
function Ih(e) {
|
|
11455
11487
|
let t = [], n = 0;
|
|
11456
11488
|
for (; n < e.length;) {
|
|
11457
11489
|
let r = e.indexOf("«", n);
|
|
@@ -11463,7 +11495,7 @@ function Ph(e) {
|
|
|
11463
11495
|
n = r + 1;
|
|
11464
11496
|
continue;
|
|
11465
11497
|
}
|
|
11466
|
-
let o =
|
|
11498
|
+
let o = Fh(em(e, a)), s = a.position ?? {
|
|
11467
11499
|
start: r,
|
|
11468
11500
|
stop: r + 1
|
|
11469
11501
|
};
|
|
@@ -11477,7 +11509,7 @@ function Ph(e) {
|
|
|
11477
11509
|
}
|
|
11478
11510
|
return t;
|
|
11479
11511
|
}
|
|
11480
|
-
function
|
|
11512
|
+
function Lh(e, t) {
|
|
11481
11513
|
if (t.length === 0) return e;
|
|
11482
11514
|
let n = 0, r = [];
|
|
11483
11515
|
for (let { start: i, end: a } of t) {
|
|
@@ -11486,7 +11518,7 @@ function Fh(e, t) {
|
|
|
11486
11518
|
}
|
|
11487
11519
|
return n < e.length && r.push(e.slice(n)), r.join("");
|
|
11488
11520
|
}
|
|
11489
|
-
function
|
|
11521
|
+
function Rh(e) {
|
|
11490
11522
|
let t = [], n = 0;
|
|
11491
11523
|
for (; n < e.length;) {
|
|
11492
11524
|
let r = e.indexOf("«", n);
|
|
@@ -11506,13 +11538,13 @@ function Ih(e) {
|
|
|
11506
11538
|
}
|
|
11507
11539
|
return t;
|
|
11508
11540
|
}
|
|
11509
|
-
function
|
|
11541
|
+
function zh(e, t) {
|
|
11510
11542
|
return e ? t.some((t) => e.start >= t.start && e.stop <= t.end) : !1;
|
|
11511
11543
|
}
|
|
11512
|
-
function
|
|
11513
|
-
return
|
|
11544
|
+
function Bh(e, t) {
|
|
11545
|
+
return zh(e, t);
|
|
11514
11546
|
}
|
|
11515
|
-
function
|
|
11547
|
+
function Vh(e) {
|
|
11516
11548
|
if (!e.includes("«")) return e;
|
|
11517
11549
|
let t = e.split(""), n = !1;
|
|
11518
11550
|
for (let e = 0; e < t.length; e++) {
|
|
@@ -11531,10 +11563,10 @@ function zh(e) {
|
|
|
11531
11563
|
}
|
|
11532
11564
|
//#endregion
|
|
11533
11565
|
//#region src/lib/text_parsers/action_citation_patterns.ts
|
|
11534
|
-
function
|
|
11566
|
+
function Hh(e) {
|
|
11535
11567
|
return `(?:${e.join("|")})`;
|
|
11536
11568
|
}
|
|
11537
|
-
var
|
|
11569
|
+
var Uh = [
|
|
11538
11570
|
"(?:à\\s+|de\\s+)?l[’']année",
|
|
11539
11571
|
"(?:à\\s+|de\\s+)?la date",
|
|
11540
11572
|
"(?:à\\s+|de\\s+)?la mention",
|
|
@@ -11552,7 +11584,7 @@ var Vh = [
|
|
|
11552
11584
|
"(?:aux|des|les)\\s+nombres",
|
|
11553
11585
|
"(?:aux|des|les)\\s+références",
|
|
11554
11586
|
"le tableau intitulé"
|
|
11555
|
-
],
|
|
11587
|
+
], Wh = [
|
|
11556
11588
|
"l[’']année",
|
|
11557
11589
|
"la date",
|
|
11558
11590
|
"la mention",
|
|
@@ -11570,10 +11602,10 @@ var Vh = [
|
|
|
11570
11602
|
"les mots",
|
|
11571
11603
|
"les nombres",
|
|
11572
11604
|
"les références"
|
|
11573
|
-
],
|
|
11605
|
+
], Gh = Hh(Uh), Kh = Hh(Wh);
|
|
11574
11606
|
//#endregion
|
|
11575
11607
|
//#region src/lib/text_parsers/action_directives.ts
|
|
11576
|
-
function
|
|
11608
|
+
function qh(e) {
|
|
11577
11609
|
return e.type === "reference_et_action" ? {
|
|
11578
11610
|
action: e.action,
|
|
11579
11611
|
reference: e.reference
|
|
@@ -11582,13 +11614,13 @@ function Gh(e) {
|
|
|
11582
11614
|
reference: e
|
|
11583
11615
|
};
|
|
11584
11616
|
}
|
|
11585
|
-
function
|
|
11617
|
+
function Jh(e) {
|
|
11586
11618
|
let t = e.indices?.[0]?.[0] ?? e.index, n = /« ?(.*?) ?»/dg, r = [], i;
|
|
11587
11619
|
for (; (i = n.exec(e[0])) !== null;) {
|
|
11588
11620
|
let e = i.indices?.[1], n = i.indices?.[0];
|
|
11589
11621
|
if (!e || !n) continue;
|
|
11590
11622
|
let a = e[0], o = e[1], s = n[0], c = n[1];
|
|
11591
|
-
r.push(
|
|
11623
|
+
r.push(Jp({
|
|
11592
11624
|
start: t + a,
|
|
11593
11625
|
stop: t + o
|
|
11594
11626
|
}, {
|
|
@@ -11598,21 +11630,21 @@ function Kh(e) {
|
|
|
11598
11630
|
}
|
|
11599
11631
|
return r;
|
|
11600
11632
|
}
|
|
11601
|
-
var
|
|
11602
|
-
_(`${
|
|
11633
|
+
var Yh = a([
|
|
11634
|
+
_(`${Gh}s?`, { flags: "i" }),
|
|
11603
11635
|
_(" ?: ?"),
|
|
11604
11636
|
Z
|
|
11605
|
-
], { value: (e) => e[2] }),
|
|
11606
|
-
_(`${
|
|
11637
|
+
], { value: (e) => e[2] }), Xh = a([
|
|
11638
|
+
_(`${Kh}s?(?: suivant(?:e)?s?)?`, { flags: "i" }),
|
|
11607
11639
|
_(" ?: ?"),
|
|
11608
11640
|
Z
|
|
11609
|
-
], { value: (e) => e[2] }),
|
|
11641
|
+
], { value: (e) => e[2] }), Zh = a([
|
|
11610
11642
|
w,
|
|
11611
|
-
|
|
11643
|
+
Yh,
|
|
11612
11644
|
C,
|
|
11613
11645
|
o(_("est remplacée? par", { flags: "i" }), _("sont remplacée?s par", { flags: "i" })),
|
|
11614
11646
|
C,
|
|
11615
|
-
|
|
11647
|
+
Xh
|
|
11616
11648
|
], { value: (e) => ({
|
|
11617
11649
|
action: {
|
|
11618
11650
|
action: "remplacer",
|
|
@@ -11623,9 +11655,9 @@ var qh = a([
|
|
|
11623
11655
|
replacementCitation: e[5],
|
|
11624
11656
|
targetCitation: e[1]
|
|
11625
11657
|
}
|
|
11626
|
-
}) }),
|
|
11658
|
+
}) }), Qh = o(_(`(?:, ?| )(?:${Gh}s? ?: ?« ?[^»]+ ?»(?: ?(?:,|et) ?)*)+(?:est|sont) (?:supprimée?s?|abrogée?s?)`, {
|
|
11627
11659
|
flags: "di",
|
|
11628
|
-
value: (e) =>
|
|
11660
|
+
value: (e) => Jh(e).map((e) => ({
|
|
11629
11661
|
action: {
|
|
11630
11662
|
action: "supprimer",
|
|
11631
11663
|
actionInContent: !0
|
|
@@ -11637,8 +11669,8 @@ var qh = a([
|
|
|
11637
11669
|
}))
|
|
11638
11670
|
}), a([
|
|
11639
11671
|
w,
|
|
11640
|
-
|
|
11641
|
-
b([_("(?:, ?| et )"),
|
|
11672
|
+
Yh,
|
|
11673
|
+
b([_("(?:, ?| et )"), Yh], { value: (e) => e.map((e) => e[1]) }),
|
|
11642
11674
|
C,
|
|
11643
11675
|
o(_("est supprimée?", { flags: "i" }), _("sont supprimée?s", { flags: "i" }), _("est abrogée?", { flags: "i" }), _("sont abrogée?s", { flags: "i" }))
|
|
11644
11676
|
], { value: (e) => [e[1], ...e[2] ?? []].map((e) => ({
|
|
@@ -11650,9 +11682,9 @@ var qh = a([
|
|
|
11650
11682
|
kind: "delete",
|
|
11651
11683
|
targetCitation: e
|
|
11652
11684
|
}
|
|
11653
|
-
})) })),
|
|
11685
|
+
})) })), $h = o(a([
|
|
11654
11686
|
w,
|
|
11655
|
-
|
|
11687
|
+
rh,
|
|
11656
11688
|
C,
|
|
11657
11689
|
_("(?:la référence|la mention|le mot|les mots|le signe)", { flags: "i" }),
|
|
11658
11690
|
_(" ?: ?"),
|
|
@@ -11668,10 +11700,10 @@ var qh = a([
|
|
|
11668
11700
|
},
|
|
11669
11701
|
operation: {
|
|
11670
11702
|
insertCitation: e[9],
|
|
11671
|
-
kind:
|
|
11703
|
+
kind: ah(e[1]),
|
|
11672
11704
|
targetCitation: e[5]
|
|
11673
11705
|
}
|
|
11674
|
-
}) }),
|
|
11706
|
+
}) }), Zh, Qh, a([
|
|
11675
11707
|
w,
|
|
11676
11708
|
o(_("est ainsi rédigée?", { flags: "i" }), _("sont ainsi rédigée?s", { flags: "i" }), _("est rédigée? (?:ainsi qu'il|comme) suit", { flags: "i" }), _("sont rédigée?s (?:ainsi qu'il|comme) suit", { flags: "i" })),
|
|
11677
11709
|
_(" ?: ?"),
|
|
@@ -11686,27 +11718,27 @@ var qh = a([
|
|
|
11686
11718
|
replacementCitation: e[3],
|
|
11687
11719
|
replacementKind: "text"
|
|
11688
11720
|
}
|
|
11689
|
-
}) })),
|
|
11721
|
+
}) })), eg = o($h, a([_(" et"), $h], { value: (e) => e[1] })), tg = S(o(a([
|
|
11690
11722
|
C,
|
|
11691
11723
|
_("par", { flags: "i" }),
|
|
11692
11724
|
C,
|
|
11693
|
-
|
|
11725
|
+
Xh
|
|
11694
11726
|
], { value: (e) => ({
|
|
11695
11727
|
citation: e[3],
|
|
11696
11728
|
kind: "replace"
|
|
11697
|
-
}) }), a([C,
|
|
11729
|
+
}) }), a([C, Xh], { value: (e) => ({
|
|
11698
11730
|
citation: e[1],
|
|
11699
11731
|
kind: "insert"
|
|
11700
11732
|
}) })), { default: null });
|
|
11701
|
-
function
|
|
11733
|
+
function ng(e) {
|
|
11702
11734
|
return typeof e == "object" && !!e && "action" in e && "operation" in e;
|
|
11703
11735
|
}
|
|
11704
|
-
function
|
|
11736
|
+
function rg(e) {
|
|
11705
11737
|
let t = [];
|
|
11706
|
-
for (let n of e)
|
|
11738
|
+
for (let n of e) ng(n) ? t.push(n) : Array.isArray(n) && t.push(...rg(n));
|
|
11707
11739
|
return t;
|
|
11708
11740
|
}
|
|
11709
|
-
function
|
|
11741
|
+
function ig(e, t) {
|
|
11710
11742
|
if (!e) return [];
|
|
11711
11743
|
let n = e.originalCitations ?? [];
|
|
11712
11744
|
if (e.action === "remplacer") {
|
|
@@ -11754,12 +11786,12 @@ function ng(e, t) {
|
|
|
11754
11786
|
}
|
|
11755
11787
|
return [];
|
|
11756
11788
|
}
|
|
11757
|
-
var
|
|
11758
|
-
|
|
11759
|
-
|
|
11760
|
-
b(
|
|
11789
|
+
var ag = xe("après|avant|remplacée?s?|supprimée?s?|abrogée?s?|ins[eé]r[eé]e?s?|ajout[eé]e?s?|rédigée?s?", a([
|
|
11790
|
+
Hm,
|
|
11791
|
+
tg,
|
|
11792
|
+
b(eg, { value: (e) => rg(e) })
|
|
11761
11793
|
], { value: (e, t) => {
|
|
11762
|
-
let { action: n, reference: r } =
|
|
11794
|
+
let { action: n, reference: r } = qh(e[0]), i = [...ig(n, e[1]), ...e[2] ?? []], a = n ?? i[0]?.action;
|
|
11763
11795
|
if (!(!a || i.length === 0)) return {
|
|
11764
11796
|
action: a,
|
|
11765
11797
|
operations: i.map(({ operation: e }) => e),
|
|
@@ -11767,7 +11799,7 @@ var rg = xe("après|avant|remplacée?s?|supprimée?s?|abrogée?s?|ins[eé]r[eé]
|
|
|
11767
11799
|
reference: r,
|
|
11768
11800
|
type: "action_directive"
|
|
11769
11801
|
};
|
|
11770
|
-
} }), 200),
|
|
11802
|
+
} }), 200), og = a([
|
|
11771
11803
|
_("la\\s+fin\\s+de\\s+", { flags: "i" }),
|
|
11772
11804
|
S(_("(?:la\\s+|l['’]\\s*)", { flags: "i" }), { default: "" }),
|
|
11773
11805
|
o(_("phrase", {
|
|
@@ -11784,14 +11816,14 @@ var rg = xe("après|avant|remplacée?s?|supprimée?s?|abrogée?s?|ins[eé]r[eé]
|
|
|
11784
11816
|
type: "tail_after_target",
|
|
11785
11817
|
unit: e[2]
|
|
11786
11818
|
}) });
|
|
11787
|
-
function
|
|
11819
|
+
function sg(e) {
|
|
11788
11820
|
if (e.type === "phrase") return "phrase";
|
|
11789
11821
|
if (e.type === "alinéa") return "alinéa";
|
|
11790
11822
|
if (e.type === "article") return "article";
|
|
11791
|
-
if (e.type === "parent-enfant") return
|
|
11823
|
+
if (e.type === "parent-enfant") return sg(e.child);
|
|
11792
11824
|
}
|
|
11793
|
-
function
|
|
11794
|
-
let t =
|
|
11825
|
+
function cg(e) {
|
|
11826
|
+
let t = uh(e);
|
|
11795
11827
|
if (!/\bla\s+fin\s+d/iu.test(t)) return null;
|
|
11796
11828
|
let n = /\bla\s+fin\s+(?:de\s+la|d['’]?une|du|de\s+l['’]?|des)\s*[^,;.]*\bphrase\b/u.test(t) ? "phrase" : /\bla\s+fin\s+(?:de\s+la|d['’]?un|du|de\s+l['’]?|des)\s*[^,;.]*\balinea\b/u.test(t) ? "alinéa" : /\bla\s+fin\s+(?:de\s+l['’]?|d['’]?)article\b/u.test(t) ? "article" : void 0;
|
|
11797
11829
|
return {
|
|
@@ -11801,10 +11833,10 @@ function og(e) {
|
|
|
11801
11833
|
}
|
|
11802
11834
|
//#endregion
|
|
11803
11835
|
//#region src/lib/text_parsers/action_occurrences.ts
|
|
11804
|
-
function
|
|
11836
|
+
function lg(e) {
|
|
11805
11837
|
return e.replace(/\s+/gu, " ").trim().normalize("NFD").replace(/[\u0300-\u036f]/gu, "").replace(/[’‘]/gu, "'").toLowerCase();
|
|
11806
11838
|
}
|
|
11807
|
-
function
|
|
11839
|
+
function ug(e, t) {
|
|
11808
11840
|
let n = e.slice(0, Math.max(0, t)), r = RegExp(`\\b(${_e})\\s+occurrence\\b`, "giu"), i = null, a;
|
|
11809
11841
|
for (; (a = r.exec(n)) !== null;) {
|
|
11810
11842
|
let e = ge(a[1] ?? "");
|
|
@@ -11812,13 +11844,13 @@ function cg(e, t) {
|
|
|
11812
11844
|
}
|
|
11813
11845
|
return i;
|
|
11814
11846
|
}
|
|
11815
|
-
function
|
|
11816
|
-
let t =
|
|
11817
|
-
return /\b(?:derniere\s+occurrence|a\s+la\s+fin)\b/u.test(t) ? "last" :
|
|
11847
|
+
function dg(e) {
|
|
11848
|
+
let t = lg(e);
|
|
11849
|
+
return /\b(?:derniere\s+occurrence|a\s+la\s+fin)\b/u.test(t) ? "last" : ug(e, e.length) ?? void 0;
|
|
11818
11850
|
}
|
|
11819
11851
|
//#endregion
|
|
11820
11852
|
//#region src/lib/extractors/action_directives.ts
|
|
11821
|
-
function
|
|
11853
|
+
function fg() {
|
|
11822
11854
|
return {
|
|
11823
11855
|
applyApplicabilityDatesMs: 0,
|
|
11824
11856
|
buildListItemTreeMs: 0,
|
|
@@ -11854,31 +11886,31 @@ function ug() {
|
|
|
11854
11886
|
function Q(e, t, n) {
|
|
11855
11887
|
e !== void 0 && (e[t] += Math.round((performance.now() - n) * 10) / 10);
|
|
11856
11888
|
}
|
|
11857
|
-
var
|
|
11858
|
-
function
|
|
11889
|
+
var pg = "(?:(?:alinea|alineas|section|sous-section|paragraphe|sous-paragraphe|sous-sous-paragraphe|chapitre|titre|livre|partie)|(?:[ivxlcdm]+|[a-z]|\\d+\\s*°?)(?:\\s+(?:bis|ter|quater|quinquies|sexies|septies|octies|nonies|decies|undecies|duodecies))?)", mg = "(?:un|une|l['’]?|le|la)";
|
|
11890
|
+
function hg(e) {
|
|
11859
11891
|
return /\b(?:les?|la|l['’]?)\s+(?:mots?|references?|mentions?|signes?|nombres?|montants?|taux|pourcentages?|dates?|annees?)\b/u.test(e);
|
|
11860
11892
|
}
|
|
11861
|
-
function
|
|
11893
|
+
function gg(e) {
|
|
11862
11894
|
return /\b(?:une|la|les?)\s+phrases?\b/u.test(e);
|
|
11863
11895
|
}
|
|
11864
|
-
function
|
|
11865
|
-
return new RegExp(String.raw`\b(?:insere(?:e|es|s)?|ajoute(?:e|es|s)?|complete(?:e|es|s)?|retabli(?:e|es|s)?)\b[\s\S]{0,90}\b${
|
|
11896
|
+
function _g(e) {
|
|
11897
|
+
return new RegExp(String.raw`\b(?:insere(?:e|es|s)?|ajoute(?:e|es|s)?|complete(?:e|es|s)?|retabli(?:e|es|s)?)\b[\s\S]{0,90}\b${mg}\s+${pg}\b`, "u").test(e) ? !0 : new RegExp(String.raw`\b${mg}\s+${pg}\b[\s\S]{0,90}\b(?:est|sont)\s+(?:ainsi\s+)?(?:insere(?:e|es|s)?|ajoute(?:e|es|s)?|complete(?:e|es|s)?|retabli(?:e|es|s)?)\b`, "u").test(e);
|
|
11866
11898
|
}
|
|
11867
|
-
function
|
|
11868
|
-
if (!
|
|
11899
|
+
function vg({ hasRedactionIntro: e, insertText: t, normalized: n }) {
|
|
11900
|
+
if (!hg(n) && !gg(n) && (_g(n) && /\balinea\b/u.test(n) || e && Sp(t))) return "block";
|
|
11869
11901
|
}
|
|
11870
|
-
function
|
|
11871
|
-
if (!
|
|
11902
|
+
function yg({ hasRedactionIntro: e, normalized: t, replacementText: n }) {
|
|
11903
|
+
if (!gg(t) && (e && /\balineas?\b/u.test(t) || e && Sp(n))) return "block";
|
|
11872
11904
|
}
|
|
11873
|
-
function
|
|
11874
|
-
let t =
|
|
11905
|
+
function bg(e) {
|
|
11906
|
+
let t = Cp(e);
|
|
11875
11907
|
return t ? t.restText : e;
|
|
11876
11908
|
}
|
|
11877
|
-
function
|
|
11878
|
-
let t =
|
|
11879
|
-
return t === e ? e.replace(
|
|
11909
|
+
function xg(e) {
|
|
11910
|
+
let t = bg(e);
|
|
11911
|
+
return t === e ? e.replace(yp, "") : t;
|
|
11880
11912
|
}
|
|
11881
|
-
function
|
|
11913
|
+
function Sg(e) {
|
|
11882
11914
|
let t = e.split("\n"), n = [], r = 0;
|
|
11883
11915
|
for (let e of t) {
|
|
11884
11916
|
let t = r, i = t + e.length;
|
|
@@ -11890,129 +11922,129 @@ function bg(e) {
|
|
|
11890
11922
|
}
|
|
11891
11923
|
return n;
|
|
11892
11924
|
}
|
|
11893
|
-
function
|
|
11894
|
-
return
|
|
11925
|
+
function Cg(e) {
|
|
11926
|
+
return Cp(e) !== void 0 || yp.test(e);
|
|
11895
11927
|
}
|
|
11896
|
-
function
|
|
11897
|
-
if (
|
|
11928
|
+
function wg(e) {
|
|
11929
|
+
if (yp.test(e)) return {
|
|
11898
11930
|
marker: "-",
|
|
11899
11931
|
level: 5
|
|
11900
11932
|
};
|
|
11901
|
-
let t =
|
|
11933
|
+
let t = Cp(e);
|
|
11902
11934
|
return t ? {
|
|
11903
11935
|
marker: t.token,
|
|
11904
|
-
level:
|
|
11936
|
+
level: Tg(t.token)
|
|
11905
11937
|
} : null;
|
|
11906
11938
|
}
|
|
11907
|
-
function
|
|
11939
|
+
function Tg(e) {
|
|
11908
11940
|
let t = e.trim().split(/\s+/u)[0]?.replace(/[^\p{L}\p{N}]+/gu, "") ?? "";
|
|
11909
|
-
return /^\d+$/u.test(t) ? 2 : /^[ivxlcdm]+$/u.test(t) && (t.length > 1 || /^[ivx]$/u.test(t)) ? 4 : /^[a-z]$/u.test(t) ? 3 :
|
|
11941
|
+
return /^\d+$/u.test(t) ? 2 : /^[ivxlcdm]+$/u.test(t) && (t.length > 1 || /^[ivx]$/u.test(t)) ? 4 : /^[a-z]$/u.test(t) ? 3 : xp(t) || /^[A-Z]$/u.test(t) ? 1 : 2;
|
|
11910
11942
|
}
|
|
11911
|
-
function
|
|
11943
|
+
function Eg(e) {
|
|
11912
11944
|
let t = [], n = e;
|
|
11913
11945
|
for (;;) {
|
|
11914
|
-
let e =
|
|
11946
|
+
let e = wg(n);
|
|
11915
11947
|
if (!e) return t;
|
|
11916
11948
|
t.push(e.marker);
|
|
11917
|
-
let r =
|
|
11949
|
+
let r = xg(n);
|
|
11918
11950
|
if (r === n) return t;
|
|
11919
11951
|
n = r.trimStart();
|
|
11920
11952
|
}
|
|
11921
11953
|
}
|
|
11922
|
-
function
|
|
11923
|
-
let t =
|
|
11954
|
+
function Dg(e) {
|
|
11955
|
+
let t = uh(Lh(e, Ih(e)));
|
|
11924
11956
|
return /(?:^|[;:.]\s*)(?:(?:il\s+)?est|sont)\s+(?:inseree?s?|ajoutee?s?)\s+(?:la\s+reference|la\s+mention|les\s+mots|le\s+mot|le\s+signe|les\s+references)?\s*:/.exec(t)?.index ?? null;
|
|
11925
11957
|
}
|
|
11926
|
-
function
|
|
11927
|
-
let t =
|
|
11958
|
+
function Og(e) {
|
|
11959
|
+
let t = Dg(e);
|
|
11928
11960
|
if (t !== null) return t;
|
|
11929
11961
|
for (let t = 0; t < e.length; t += 1) {
|
|
11930
11962
|
let n = new x(e.slice(t));
|
|
11931
|
-
if (
|
|
11963
|
+
if (jm(n) && n.offset > 0) return t;
|
|
11932
11964
|
}
|
|
11933
11965
|
return null;
|
|
11934
11966
|
}
|
|
11935
|
-
function
|
|
11967
|
+
function kg() {
|
|
11936
11968
|
return {
|
|
11937
11969
|
actionIndexByText: /* @__PURE__ */ new Map(),
|
|
11938
11970
|
quoteRangesByText: /* @__PURE__ */ new Map(),
|
|
11939
11971
|
referencesByText: /* @__PURE__ */ new Map()
|
|
11940
11972
|
};
|
|
11941
11973
|
}
|
|
11942
|
-
function
|
|
11943
|
-
if (e === void 0) return
|
|
11974
|
+
function Ag(e, t, n) {
|
|
11975
|
+
if (e === void 0) return Og(t);
|
|
11944
11976
|
if (e.actionIndexByText.has(t)) return n !== void 0 && (n.listActionIndexCacheHitCount += 1), e.actionIndexByText.get(t) ?? null;
|
|
11945
11977
|
n !== void 0 && (n.listActionIndexCacheMissCount += 1);
|
|
11946
|
-
let r =
|
|
11978
|
+
let r = Og(t);
|
|
11947
11979
|
return e.actionIndexByText.set(t, r), r;
|
|
11948
11980
|
}
|
|
11949
|
-
function
|
|
11950
|
-
if (e === void 0) return
|
|
11981
|
+
function jg(e, t, n) {
|
|
11982
|
+
if (e === void 0) return Rh(t);
|
|
11951
11983
|
let r = e.quoteRangesByText.get(t);
|
|
11952
11984
|
if (r !== void 0) return n !== void 0 && (n.listQuoteRangeCacheHitCount += 1), r;
|
|
11953
11985
|
n !== void 0 && (n.listQuoteRangeCacheMissCount += 1);
|
|
11954
|
-
let i =
|
|
11986
|
+
let i = Rh(t);
|
|
11955
11987
|
return e.quoteRangesByText.set(t, i), i;
|
|
11956
11988
|
}
|
|
11957
|
-
function
|
|
11958
|
-
if (e === void 0) return
|
|
11989
|
+
function Mg(e, t, n) {
|
|
11990
|
+
if (e === void 0) return eh(new x(t));
|
|
11959
11991
|
let r = e.referencesByText.get(t);
|
|
11960
11992
|
if (r !== void 0) return n !== void 0 && (n.listReferenceCacheHitCount += 1), structuredClone(r);
|
|
11961
11993
|
n !== void 0 && (n.listReferenceCacheMissCount += 1);
|
|
11962
|
-
let i =
|
|
11994
|
+
let i = eh(new x(t));
|
|
11963
11995
|
return e.referencesByText.set(t, structuredClone(i)), i;
|
|
11964
11996
|
}
|
|
11965
|
-
function
|
|
11997
|
+
function Ng(e) {
|
|
11966
11998
|
return e.type === "reference_et_action" ? e.reference : e;
|
|
11967
11999
|
}
|
|
11968
|
-
function
|
|
11969
|
-
let i =
|
|
11970
|
-
return
|
|
12000
|
+
function Pg(e, t, n, r = e.length) {
|
|
12001
|
+
let i = jg(t, e, n);
|
|
12002
|
+
return Mg(t, e, n).map(Ng).find((e) => xt(e) === "article" && !Bh(e.position, i) && (e.position?.start ?? 0) < r) || (W_(Vh(e).slice(0, r))?.reference ?? null);
|
|
11971
12003
|
}
|
|
11972
|
-
function
|
|
11973
|
-
let i =
|
|
12004
|
+
function Fg(e, t, n, r) {
|
|
12005
|
+
let i = jg(n, e, r), a = Mg(n, e, r), o = a.flatMap((e) => Array.from(D(Ng(e)))).filter((e) => e.type === "article" && e.position).map((e) => ({
|
|
11974
12006
|
start: e.position.start,
|
|
11975
12007
|
end: e.position.stop
|
|
11976
|
-
})), s = a.map(
|
|
11977
|
-
return d ?
|
|
12008
|
+
})), s = a.map(Ng).filter((e) => !Bh(e.position, i) && !zh(e.position, o) && xt(e) !== "article" && (e.position?.start ?? 0) < t).sort((e, t) => (e.position?.start ?? 0) - (t.position?.start ?? 0)), c = e.slice(0, t).trimEnd(), l = Oh(O_(c), 0) ?? Oh(c, 0) ?? Oh(c.replace(/\b(?:est|sont)\s*$/iu, "").trimEnd(), 0), u = l && !zh(l.position, o) ? l : null, d = s[0];
|
|
12009
|
+
return d ? jh(d, u) : u;
|
|
11978
12010
|
}
|
|
11979
|
-
function
|
|
11980
|
-
let r =
|
|
12011
|
+
function Ig(e, t, n) {
|
|
12012
|
+
let r = Ag(t, e, n) ?? e.length, i = jg(t, e, n), a = Mg(t, e, n).map(Ng).filter((e) => !Bh(e.position, i) && (e.position?.start ?? 0) < r).sort((e, t) => (e.position?.start ?? 0) - (t.position?.start ?? 0));
|
|
11981
12013
|
return a.length === 0 ? null : a.find((e) => xt(e) !== "article") ?? null ?? a[0] ?? null;
|
|
11982
12014
|
}
|
|
11983
|
-
function
|
|
11984
|
-
let r = [e,
|
|
12015
|
+
function Lg(e, t, n) {
|
|
12016
|
+
let r = [e, bg(e)].map((e) => e.trim()).filter((e, t, n) => e && n.indexOf(e) === t);
|
|
11985
12017
|
for (let e of r) {
|
|
11986
|
-
let r =
|
|
12018
|
+
let r = Ag(t, e, n) ?? e.length, i = Oh(e, 0) ?? Nh(e, { actionIndex: r }) ?? Ig(e, t, n) ?? Pg(e, t, n);
|
|
11987
12019
|
if (i) return i;
|
|
11988
12020
|
}
|
|
11989
12021
|
return null;
|
|
11990
12022
|
}
|
|
11991
|
-
function
|
|
12023
|
+
function Rg(e) {
|
|
11992
12024
|
return e?.toLowerCase().replace(/[.)]/g, "").trim();
|
|
11993
12025
|
}
|
|
11994
|
-
function
|
|
11995
|
-
return !(e.type !== t.type || e.index !== void 0 && t.index !== void 0 && e.index !== t.index || e.num !== void 0 && t.num !== void 0 &&
|
|
12026
|
+
function zg(e, t) {
|
|
12027
|
+
return !(e.type !== t.type || e.index !== void 0 && t.index !== void 0 && e.index !== t.index || e.num !== void 0 && t.num !== void 0 && Rg(e.num) !== Rg(t.num));
|
|
11996
12028
|
}
|
|
11997
|
-
function
|
|
12029
|
+
function Bg(e) {
|
|
11998
12030
|
let t = null;
|
|
11999
12031
|
for (let n of D(e)) t = n;
|
|
12000
12032
|
return t;
|
|
12001
12033
|
}
|
|
12002
|
-
function
|
|
12003
|
-
return t && e.type === "parent-enfant" &&
|
|
12034
|
+
function Vg(e, t) {
|
|
12035
|
+
return t && e.type === "parent-enfant" && zg(e.parent, t) ? e.child : e;
|
|
12004
12036
|
}
|
|
12005
|
-
function
|
|
12037
|
+
function Hg(e, t) {
|
|
12006
12038
|
let n = null;
|
|
12007
12039
|
for (let r of D(e)) r.type === t && r.relative === void 0 && (r.index === void 0 && r.num === void 0 || (n = r));
|
|
12008
12040
|
return n;
|
|
12009
12041
|
}
|
|
12010
|
-
function
|
|
12042
|
+
function Ug(e, t) {
|
|
12011
12043
|
if (!t) return e;
|
|
12012
12044
|
let n = structuredClone(e), r = (e) => {
|
|
12013
12045
|
if (e.type !== "parent-enfant" && e.type !== "bounded-interval" && e.type !== "counted-interval" && e.type !== "enumeration" && e.type !== "exclusion" && e.type !== "reference_et_action") {
|
|
12014
12046
|
if (e.relative === 0) {
|
|
12015
|
-
let n =
|
|
12047
|
+
let n = Hg(t, e.type);
|
|
12016
12048
|
n && (e.index = n.index, e.num = n.num, delete e.relative);
|
|
12017
12049
|
}
|
|
12018
12050
|
return;
|
|
@@ -12038,7 +12070,7 @@ function Vg(e, t) {
|
|
|
12038
12070
|
};
|
|
12039
12071
|
return r(n), n;
|
|
12040
12072
|
}
|
|
12041
|
-
function
|
|
12073
|
+
function Wg(e) {
|
|
12042
12074
|
let t = (e) => {
|
|
12043
12075
|
if (e.type !== "parent-enfant" && e.type !== "bounded-interval" && e.type !== "counted-interval" && e.type !== "enumeration" && e.type !== "exclusion" && e.type !== "reference_et_action") return e.relative !== void 0;
|
|
12044
12076
|
switch (e.type) {
|
|
@@ -12052,14 +12084,14 @@ function Hg(e) {
|
|
|
12052
12084
|
};
|
|
12053
12085
|
return t(e);
|
|
12054
12086
|
}
|
|
12055
|
-
function
|
|
12087
|
+
function Gg(e) {
|
|
12056
12088
|
let t = [], n = [];
|
|
12057
12089
|
for (let r of e) {
|
|
12058
|
-
if (!
|
|
12090
|
+
if (!Cg(r.text)) {
|
|
12059
12091
|
n[n.length - 1]?.body.push(r);
|
|
12060
12092
|
continue;
|
|
12061
12093
|
}
|
|
12062
|
-
let e =
|
|
12094
|
+
let e = wg(r.text), i = e?.level ?? 0, a = {
|
|
12063
12095
|
body: [],
|
|
12064
12096
|
children: [],
|
|
12065
12097
|
level: i,
|
|
@@ -12071,24 +12103,24 @@ function Ug(e) {
|
|
|
12071
12103
|
}
|
|
12072
12104
|
return t;
|
|
12073
12105
|
}
|
|
12074
|
-
function
|
|
12106
|
+
function Kg(e, t, n) {
|
|
12075
12107
|
for (let r of e) {
|
|
12076
|
-
let e =
|
|
12108
|
+
let e = Yg(r);
|
|
12077
12109
|
if (e) {
|
|
12078
|
-
let r = performance.now(), i =
|
|
12110
|
+
let r = performance.now(), i = Ag(t, e, n);
|
|
12079
12111
|
if (Q(n, "listFindActionIndexMs", r), i !== null) return !0;
|
|
12080
12112
|
}
|
|
12081
|
-
if (
|
|
12113
|
+
if (Kg(r.children, t, n)) return !0;
|
|
12082
12114
|
}
|
|
12083
12115
|
return !1;
|
|
12084
12116
|
}
|
|
12085
|
-
function
|
|
12117
|
+
function qg(e, t) {
|
|
12086
12118
|
if (!e) return t;
|
|
12087
12119
|
if (!t) return e;
|
|
12088
|
-
let n =
|
|
12120
|
+
let n = Vg(t, Bg(e));
|
|
12089
12121
|
return n.type === "article" || xt(n), ht(e, n);
|
|
12090
12122
|
}
|
|
12091
|
-
function
|
|
12123
|
+
function Jg(e, t) {
|
|
12092
12124
|
return {
|
|
12093
12125
|
...ht(e, t),
|
|
12094
12126
|
position: {
|
|
@@ -12097,16 +12129,16 @@ function Kg(e, t) {
|
|
|
12097
12129
|
}
|
|
12098
12130
|
};
|
|
12099
12131
|
}
|
|
12100
|
-
function
|
|
12101
|
-
return [
|
|
12132
|
+
function Yg(e) {
|
|
12133
|
+
return [xg(e.line.text), ...e.body.map((e) => e.text)].join("\n").trim();
|
|
12102
12134
|
}
|
|
12103
|
-
function
|
|
12135
|
+
function Xg(e) {
|
|
12104
12136
|
return e.body[e.body.length - 1]?.end ?? e.line.end;
|
|
12105
12137
|
}
|
|
12106
|
-
function
|
|
12138
|
+
function Zg(e) {
|
|
12107
12139
|
return (e ?? "").replace(/°/gu, "").replace(/\s+/gu, " ").trim();
|
|
12108
12140
|
}
|
|
12109
|
-
function
|
|
12141
|
+
function Qg(e, t) {
|
|
12110
12142
|
let n = new x(e, t), r = me(n);
|
|
12111
12143
|
return typeof r == "string" && n.offset > t ? {
|
|
12112
12144
|
date: r,
|
|
@@ -12114,14 +12146,14 @@ function Xg(e, t) {
|
|
|
12114
12146
|
stop: n.offset
|
|
12115
12147
|
} : null;
|
|
12116
12148
|
}
|
|
12117
|
-
function
|
|
12118
|
-
let t =
|
|
12149
|
+
function $g(e) {
|
|
12150
|
+
let t = Rh(e), n = [];
|
|
12119
12151
|
for (let r = 0; r < e.length; r += 1) {
|
|
12120
12152
|
let i = e[r];
|
|
12121
12153
|
if (i === void 0 || !/\d/u.test(i)) continue;
|
|
12122
|
-
let a =
|
|
12154
|
+
let a = Qg(e, r);
|
|
12123
12155
|
if (a) {
|
|
12124
|
-
if (
|
|
12156
|
+
if (zh(a, t)) {
|
|
12125
12157
|
r = Math.max(r, a.stop - 1);
|
|
12126
12158
|
continue;
|
|
12127
12159
|
}
|
|
@@ -12130,25 +12162,25 @@ function Zg(e) {
|
|
|
12130
12162
|
}
|
|
12131
12163
|
return n;
|
|
12132
12164
|
}
|
|
12133
|
-
function
|
|
12134
|
-
return
|
|
12165
|
+
function e_(e) {
|
|
12166
|
+
return uh(e).replace(/\s+/gu, " ");
|
|
12135
12167
|
}
|
|
12136
|
-
function
|
|
12137
|
-
let t =
|
|
12168
|
+
function t_(e) {
|
|
12169
|
+
let t = e_(e), n = /\b(?:entr(?:e|ent|era|eront)\s+en\s+vigueur|s['’]?\s*appli(?:que|quent)|est\s+applicable|sont\s+applicables?|applicables?)\b/giu, r = null, i;
|
|
12138
12170
|
for (; (i = n.exec(t)) !== null;) r = i;
|
|
12139
12171
|
return r;
|
|
12140
12172
|
}
|
|
12141
|
-
function
|
|
12142
|
-
let n =
|
|
12143
|
-
return !!(/\bau\s*$/u.test(n) && r.startsWith(",") || /\ba compter\s+(?:du|de la|de l['’]?|des)?\s*$/u.test(n) || /\babroge(?:e|es|s)?\s+a compter\s+(?:du|de la|de l['’]?|des)?\s*$/u.test(n) ||
|
|
12173
|
+
function n_(e, t) {
|
|
12174
|
+
let n = e_(e.slice(0, t.start)), r = e_(e.slice(t.stop));
|
|
12175
|
+
return !!(/\bau\s*$/u.test(n) && r.startsWith(",") || /\ba compter\s+(?:du|de la|de l['’]?|des)?\s*$/u.test(n) || /\babroge(?:e|es|s)?\s+a compter\s+(?:du|de la|de l['’]?|des)?\s*$/u.test(n) || t_(e.slice(0, t.start)));
|
|
12144
12176
|
}
|
|
12145
|
-
function
|
|
12146
|
-
return
|
|
12177
|
+
function r_(e) {
|
|
12178
|
+
return $g(e).find((t) => n_(e, t))?.date;
|
|
12147
12179
|
}
|
|
12148
|
-
function
|
|
12149
|
-
return e.map((e) =>
|
|
12180
|
+
function i_(e) {
|
|
12181
|
+
return e.map((e) => Zg(e.num)).filter((e) => e.length > 0);
|
|
12150
12182
|
}
|
|
12151
|
-
function
|
|
12183
|
+
function a_(e, t) {
|
|
12152
12184
|
let n = e.at(-1), r = t.at(-1);
|
|
12153
12185
|
if (!n || !r) return [e, t];
|
|
12154
12186
|
let i = e.slice(0, -1), a = t.slice(0, -1);
|
|
@@ -12159,51 +12191,51 @@ function r_(e, t) {
|
|
|
12159
12191
|
for (let e = o; e <= s; e += 1) c.push([...i, String(e)]);
|
|
12160
12192
|
return c;
|
|
12161
12193
|
}
|
|
12162
|
-
function
|
|
12194
|
+
function o_(e) {
|
|
12163
12195
|
if (e.kind === "single") {
|
|
12164
|
-
let t =
|
|
12196
|
+
let t = i_(e.steps);
|
|
12165
12197
|
return t.length > 0 ? [t] : [];
|
|
12166
12198
|
}
|
|
12167
|
-
let t =
|
|
12168
|
-
return t.length === 0 && n.length === 0 ? [] :
|
|
12199
|
+
let t = i_(e.first), n = i_(e.last);
|
|
12200
|
+
return t.length === 0 && n.length === 0 ? [] : a_(t, n);
|
|
12169
12201
|
}
|
|
12170
|
-
function
|
|
12171
|
-
let t =
|
|
12172
|
-
for (let e of t.map(
|
|
12202
|
+
function s_(e) {
|
|
12203
|
+
let t = eh(new x(e)), n = [];
|
|
12204
|
+
for (let e of t.map(Ng)) {
|
|
12173
12205
|
if (e.type === "article" && e.present) {
|
|
12174
12206
|
n.push([]);
|
|
12175
12207
|
continue;
|
|
12176
12208
|
}
|
|
12177
|
-
for (let t of
|
|
12209
|
+
for (let t of Vp(e)) n.push(...o_(t));
|
|
12178
12210
|
}
|
|
12179
12211
|
return n.filter((e, t, n) => n.findIndex((t) => t.join("\0") === e.join("\0")) === t);
|
|
12180
12212
|
}
|
|
12181
|
-
function
|
|
12213
|
+
function c_(e) {
|
|
12182
12214
|
let t = [], n = e.split(/(?<=[.;])\s+/u).map((e) => e.trim()).filter(Boolean);
|
|
12183
|
-
for (let e of n) for (let n of
|
|
12184
|
-
if (!
|
|
12185
|
-
let r =
|
|
12215
|
+
for (let e of n) for (let n of $g(e)) {
|
|
12216
|
+
if (!n_(e, n)) continue;
|
|
12217
|
+
let r = t_(e.slice(0, n.start));
|
|
12186
12218
|
if (!r) continue;
|
|
12187
|
-
let i =
|
|
12219
|
+
let i = s_(e.slice(0, r.index).trim());
|
|
12188
12220
|
if (i.length === 0) continue;
|
|
12189
12221
|
t.push({
|
|
12190
12222
|
date: n.date,
|
|
12191
12223
|
paths: i
|
|
12192
12224
|
});
|
|
12193
|
-
let a =
|
|
12225
|
+
let a = l_(e.slice(n.stop), i);
|
|
12194
12226
|
t.push(...a);
|
|
12195
12227
|
}
|
|
12196
12228
|
return t;
|
|
12197
12229
|
}
|
|
12198
|
-
function
|
|
12230
|
+
function l_(e, t) {
|
|
12199
12231
|
let n = /(?:^|[^\p{L}\p{N}_])(?:a|à)\s+l['’]exception\s+(.+?)(?:\bqui\b|\bentr(?:e|ent|era|eront)\s+en\s+vigueur\b)/iu.exec(e);
|
|
12200
12232
|
if (!n) return [];
|
|
12201
12233
|
let r = n.index + n[0].length, i = n[1]?.trim();
|
|
12202
12234
|
if (!i) return [];
|
|
12203
|
-
let a =
|
|
12235
|
+
let a = s_(i);
|
|
12204
12236
|
if (a.length === 0) return [];
|
|
12205
12237
|
let o = [];
|
|
12206
|
-
for (let n of
|
|
12238
|
+
for (let n of $g(e.slice(r))) {
|
|
12207
12239
|
let e = n.date;
|
|
12208
12240
|
o.push({
|
|
12209
12241
|
date: e,
|
|
@@ -12214,44 +12246,44 @@ function s_(e, t) {
|
|
|
12214
12246
|
}
|
|
12215
12247
|
return o;
|
|
12216
12248
|
}
|
|
12217
|
-
function
|
|
12249
|
+
function u_(e, t, n) {
|
|
12218
12250
|
return [
|
|
12219
12251
|
...e,
|
|
12220
|
-
|
|
12221
|
-
...
|
|
12252
|
+
Zg(t.marker),
|
|
12253
|
+
...Eg(n).map(Zg)
|
|
12222
12254
|
].filter((e) => e.length > 0);
|
|
12223
12255
|
}
|
|
12224
|
-
function
|
|
12256
|
+
function d_(e) {
|
|
12225
12257
|
let t = [];
|
|
12226
|
-
for (let n of e) t.push(...
|
|
12258
|
+
for (let n of e) t.push(...c_(Yg(n))), t.push(...d_(n.children));
|
|
12227
12259
|
return t;
|
|
12228
12260
|
}
|
|
12229
|
-
function
|
|
12261
|
+
function f_(e, t) {
|
|
12230
12262
|
return t.length > e.length ? !1 : t.every((t, n) => e[n] === t);
|
|
12231
12263
|
}
|
|
12232
|
-
function
|
|
12264
|
+
function p_(e, t) {
|
|
12233
12265
|
if (t.length > e.length) return !1;
|
|
12234
12266
|
let n = e.length - t.length;
|
|
12235
12267
|
return t.every((t, r) => e[n + r] === t);
|
|
12236
12268
|
}
|
|
12237
|
-
function
|
|
12238
|
-
return n ? n.some((n) =>
|
|
12269
|
+
function m_(e, t, n) {
|
|
12270
|
+
return n ? n.some((n) => m_(e, n) ? m_(e, f_(e, n) ? [...n, ...t] : t) : !1) : t.length === 0 ? !0 : f_(e, t) || p_(e, t);
|
|
12239
12271
|
}
|
|
12240
|
-
function
|
|
12272
|
+
function h_(e, t, n) {
|
|
12241
12273
|
if (e.length === 0 || n.length === 0) return;
|
|
12242
12274
|
let r = new Map(t.map((e) => [e.directive, e.sourcePath]));
|
|
12243
12275
|
for (let t of e) {
|
|
12244
12276
|
if (t.applicabilityDate) continue;
|
|
12245
12277
|
let e = r.get(t) ?? [], i, a = -1;
|
|
12246
12278
|
for (let t of n) for (let n of t.paths) {
|
|
12247
|
-
if (!
|
|
12279
|
+
if (!m_(e, n, t.parentPaths)) continue;
|
|
12248
12280
|
let r = n.length + Math.max(0, ...t.parentPaths?.map((e) => e.length) ?? [0]);
|
|
12249
12281
|
r > a && (i = t.date, a = r);
|
|
12250
12282
|
}
|
|
12251
12283
|
i && (t.applicabilityDate = i);
|
|
12252
12284
|
}
|
|
12253
12285
|
}
|
|
12254
|
-
function
|
|
12286
|
+
function g_(e, t) {
|
|
12255
12287
|
if (!e) return t;
|
|
12256
12288
|
if (!t) return e;
|
|
12257
12289
|
let n = t.rowIndex ?? e.rowIndex, r = t.columnIndex ?? e.columnIndex;
|
|
@@ -12261,23 +12293,23 @@ function m_(e, t) {
|
|
|
12261
12293
|
...r ? { columnIndex: r } : {}
|
|
12262
12294
|
};
|
|
12263
12295
|
}
|
|
12264
|
-
function
|
|
12296
|
+
function __(e) {
|
|
12265
12297
|
return e !== void 0 && (e.rowIndex !== void 0 || e.columnIndex !== void 0);
|
|
12266
12298
|
}
|
|
12267
|
-
function
|
|
12299
|
+
function v_(e, t, n, r, i = [], a = [], o, s) {
|
|
12268
12300
|
let c = [], l = t;
|
|
12269
12301
|
for (let u of e) {
|
|
12270
12302
|
s !== void 0 && (s.listItemCount += 1);
|
|
12271
|
-
let e =
|
|
12303
|
+
let e = xg(u.line.text), d = u_(i, u, e), f = Yg(u);
|
|
12272
12304
|
if (!f) continue;
|
|
12273
|
-
let p =
|
|
12305
|
+
let p = g_(r, D_(f, r !== void 0)), m, h, g = () => {
|
|
12274
12306
|
if (m !== void 0) return m;
|
|
12275
12307
|
let t = performance.now();
|
|
12276
|
-
return m =
|
|
12277
|
-
}, _ = () => (h === void 0 && (h =
|
|
12308
|
+
return m = Lg(e, o, s), Q(s, "listPickLineReferenceMs", t), m;
|
|
12309
|
+
}, _ = () => (h === void 0 && (h = qg(t, g())), h), v = performance.now(), y = Ag(o, f, s);
|
|
12278
12310
|
if (Q(s, "listFindActionIndexMs", v), y === null) {
|
|
12279
12311
|
if (h = _(), u.children.length > 0) {
|
|
12280
|
-
let e = h ?? t, r =
|
|
12312
|
+
let e = h ?? t, r = v_(u.children, e, n, p, d, a, o, s);
|
|
12281
12313
|
r.length > 0 && (c.push(...r), l = r[r.length - 1]?.reference ?? l);
|
|
12282
12314
|
continue;
|
|
12283
12315
|
}
|
|
@@ -12285,23 +12317,23 @@ function g_(e, t, n, r, i = [], a = [], o, s) {
|
|
|
12285
12317
|
continue;
|
|
12286
12318
|
}
|
|
12287
12319
|
s !== void 0 && (s.listActionItemCount += 1);
|
|
12288
|
-
let b = performance.now(), ee =
|
|
12320
|
+
let b = performance.now(), ee = Fg(f, y ?? f.length, o, s), te = ee === null ? Pg(f, o, s, y ?? f.length) : null, ne = ee ?? te ?? g();
|
|
12289
12321
|
Q(s, "listPickLocalReferenceMs", b);
|
|
12290
|
-
let x =
|
|
12322
|
+
let x = qg(t, ne) ?? te ?? h;
|
|
12291
12323
|
if (!x) {
|
|
12292
12324
|
if (u.children.length > 0) {
|
|
12293
|
-
let e =
|
|
12325
|
+
let e = v_(u.children, h ?? t, n, p, d, a, o, s);
|
|
12294
12326
|
c.push(...e);
|
|
12295
12327
|
}
|
|
12296
12328
|
continue;
|
|
12297
12329
|
}
|
|
12298
|
-
x =
|
|
12299
|
-
let re = performance.now(), ie =
|
|
12330
|
+
x = Ug(x, Wg(x) ? l ?? t : t);
|
|
12331
|
+
let re = performance.now(), ie = U_({
|
|
12300
12332
|
action: { action: "modifier" },
|
|
12301
12333
|
reference: x,
|
|
12302
12334
|
sourcePosition: {
|
|
12303
12335
|
start: u.line.start,
|
|
12304
|
-
stop:
|
|
12336
|
+
stop: Xg(u)
|
|
12305
12337
|
},
|
|
12306
12338
|
sourceText: f,
|
|
12307
12339
|
fullText: n,
|
|
@@ -12310,7 +12342,7 @@ function g_(e, t, n, r, i = [], a = [], o, s) {
|
|
|
12310
12342
|
if (Q(s, "listBuildActionDirectiveMs", re), !ie) {
|
|
12311
12343
|
if (l = x, u.children.length > 0) {
|
|
12312
12344
|
h = _();
|
|
12313
|
-
let e =
|
|
12345
|
+
let e = v_(u.children, h ?? x, n, p, d, a, o, s);
|
|
12314
12346
|
c.push(...e), l = e[e.length - 1]?.reference ?? l;
|
|
12315
12347
|
}
|
|
12316
12348
|
continue;
|
|
@@ -12327,28 +12359,28 @@ function g_(e, t, n, r, i = [], a = [], o, s) {
|
|
|
12327
12359
|
});
|
|
12328
12360
|
if (l = x, u.children.length > 0) {
|
|
12329
12361
|
h = _();
|
|
12330
|
-
let e =
|
|
12362
|
+
let e = v_(u.children, h ?? x, n, p, d, a, o, s);
|
|
12331
12363
|
e.length > 0 && (c.push(...e), l = e[e.length - 1]?.reference ?? l);
|
|
12332
12364
|
}
|
|
12333
12365
|
}
|
|
12334
|
-
return
|
|
12366
|
+
return H_(c);
|
|
12335
12367
|
}
|
|
12336
|
-
function
|
|
12337
|
-
let n =
|
|
12368
|
+
function y_(e, t) {
|
|
12369
|
+
let n = Sg(e), r = n.findIndex((e) => Cg(e.text));
|
|
12338
12370
|
if (r === -1) return null;
|
|
12339
|
-
let i =
|
|
12340
|
-
if (Q(t, "buildListItemTreeMs", a), !
|
|
12371
|
+
let i = kg(), a = performance.now(), o = Gg(n.slice(r));
|
|
12372
|
+
if (Q(t, "buildListItemTreeMs", a), !Kg(o, i, t)) return null;
|
|
12341
12373
|
let s = performance.now(), c = null;
|
|
12342
|
-
for (let e = r - 1; e >= 0 && (c =
|
|
12374
|
+
for (let e = r - 1; e >= 0 && (c = Lg(n[e]?.text ?? "", i, t), c === null); --e);
|
|
12343
12375
|
Q(t, "findBaseReferenceMs", s);
|
|
12344
|
-
let l = [], u = performance.now(), d =
|
|
12376
|
+
let l = [], u = performance.now(), d = v_(o, c, e, void 0, [], l, i, t);
|
|
12345
12377
|
Q(t, "processListItemNodesMs", u);
|
|
12346
|
-
let f = performance.now(), p =
|
|
12378
|
+
let f = performance.now(), p = d_(o);
|
|
12347
12379
|
Q(t, "collectApplicabilityScopesMs", f);
|
|
12348
12380
|
let m = performance.now();
|
|
12349
|
-
return
|
|
12381
|
+
return h_(d, l, p), Q(t, "applyApplicabilityDatesMs", m), d.length > 0 ? d : null;
|
|
12350
12382
|
}
|
|
12351
|
-
function
|
|
12383
|
+
function b_(e, t) {
|
|
12352
12384
|
let n = e.indexOf("«");
|
|
12353
12385
|
if (n === -1) return;
|
|
12354
12386
|
let r = e.indexOf("»", n + 1);
|
|
@@ -12363,40 +12395,40 @@ function v_(e, t) {
|
|
|
12363
12395
|
}
|
|
12364
12396
|
};
|
|
12365
12397
|
}
|
|
12366
|
-
function
|
|
12367
|
-
let t =
|
|
12398
|
+
function x_(e) {
|
|
12399
|
+
let t = uh(e);
|
|
12368
12400
|
return /\btableau\b/.test(t) && /\b(?:tableau|celui)\s+(?:suivant|ainsi\s+redigee?|ainsi\s+rediges|ainsi\s+redigees)\b/.test(t);
|
|
12369
12401
|
}
|
|
12370
|
-
function
|
|
12371
|
-
for (let t of
|
|
12372
|
-
if (!
|
|
12402
|
+
function S_(e) {
|
|
12403
|
+
for (let t of Sg(e)) {
|
|
12404
|
+
if (!x_(t.text)) continue;
|
|
12373
12405
|
let e = t.text.indexOf(":");
|
|
12374
12406
|
return e === -1 ? t.end : t.start + e + 1;
|
|
12375
12407
|
}
|
|
12376
12408
|
return null;
|
|
12377
12409
|
}
|
|
12378
|
-
function
|
|
12379
|
-
let n =
|
|
12380
|
-
return n === null ?
|
|
12410
|
+
function C_(e, t) {
|
|
12411
|
+
let n = S_(e);
|
|
12412
|
+
return n === null ? b_(e, t) : b_(e.slice(n), t + n);
|
|
12381
12413
|
}
|
|
12382
|
-
function
|
|
12383
|
-
return
|
|
12414
|
+
function w_(e, t) {
|
|
12415
|
+
return ug(e, t);
|
|
12384
12416
|
}
|
|
12385
|
-
function
|
|
12386
|
-
let n =
|
|
12417
|
+
function T_(e, t) {
|
|
12418
|
+
let n = Dm(e, t);
|
|
12387
12419
|
return n && n > 1 ? n : void 0;
|
|
12388
12420
|
}
|
|
12389
|
-
function
|
|
12421
|
+
function E_(e, t) {
|
|
12390
12422
|
if (!Array.isArray(e) || e.length < 2 || t.length < e.length) return e;
|
|
12391
12423
|
let n = e[0];
|
|
12392
12424
|
return e.some((e) => JSON.stringify(e) !== JSON.stringify(n)) ? e : n;
|
|
12393
12425
|
}
|
|
12394
|
-
function
|
|
12395
|
-
let n =
|
|
12426
|
+
function D_(e, t = !1) {
|
|
12427
|
+
let n = Lh(e, Ih(e)), r = uh(n), i = /\btableau\b/.test(r);
|
|
12396
12428
|
if (!i && !t) return;
|
|
12397
12429
|
let a = (e) => {
|
|
12398
12430
|
if (!e) return;
|
|
12399
|
-
let t = e.replace(/^(?:a|à)\s+la\s+/iu, "").trim(), n =
|
|
12431
|
+
let t = e.replace(/^(?:a|à)\s+la\s+/iu, "").trim(), n = uh(t);
|
|
12400
12432
|
if (/^derni(?:er|ere)s?\b/u.test(n)) return -1;
|
|
12401
12433
|
let r = ge(t);
|
|
12402
12434
|
return r && r > 0 ? r : void 0;
|
|
@@ -12417,30 +12449,30 @@ function T_(e, t = !1) {
|
|
|
12417
12449
|
let l = /\bla\s+(.+?)\s+ligne\b/iu.exec(n), u = /\bla\s+(.+?)\s+colonne\b/iu.exec(n);
|
|
12418
12450
|
return o(a(l?.[1]), a(u?.[1])) || (i ? { type: "table" } : void 0);
|
|
12419
12451
|
}
|
|
12420
|
-
function
|
|
12452
|
+
function O_(e) {
|
|
12421
12453
|
return e.replace(/(?:[,;:]\s*)?(?:(?:le|la|les|l['’])\s+)?(?:année|date|dispositions?|mention|montant|mot|mots|nombre|nombres|pourcentage|référence|références|signe|taux|texte|phrase|phrases|tableau)(?:\s+[^,;:]*)?\s*:?\s*$/iu, "").trimEnd();
|
|
12422
12454
|
}
|
|
12423
|
-
function
|
|
12455
|
+
function k_(e) {
|
|
12424
12456
|
return e.replace(/(?:[,;:]\s*)?(?:(?:le|la|les|l['’])\s+)?(?:année|date|dispositions?|mention|montant|mot|mots|nombre|nombres|pourcentage|référence|références|signe|taux|texte|tableau)(?:\s+[^,;:]*)?\s*:?\s*$/iu, "").trimEnd();
|
|
12425
12457
|
}
|
|
12426
|
-
var
|
|
12427
|
-
|
|
12428
|
-
|
|
12429
|
-
|
|
12458
|
+
var A_ = [
|
|
12459
|
+
j_("(?:la\\s+date\\s+d(?:u|e|[’']))"),
|
|
12460
|
+
j_("(?:le\\s+montant\\s+d(?:e|[’']))"),
|
|
12461
|
+
j_("(?:la\\s+référence\\s+à)")
|
|
12430
12462
|
];
|
|
12431
|
-
function
|
|
12463
|
+
function j_(e) {
|
|
12432
12464
|
return new RegExp(String.raw`(?:^|[,;:]\s*)${e}\s+(?<target>.+?)\s+(?:est|sont)\s+remplac[eé]e?s?\s+par\s+${e}\s+(?<replacement>.+?)(?=\s*(?:[.;]|$))`, "iu");
|
|
12433
12465
|
}
|
|
12434
|
-
function
|
|
12466
|
+
function M_(e) {
|
|
12435
12467
|
return e.replace(/\s+/gu, " ").replace(/\s+([,;])/gu, "$1").trim();
|
|
12436
12468
|
}
|
|
12437
|
-
function
|
|
12469
|
+
function N_(e) {
|
|
12438
12470
|
if (e.includes("«") || e.includes("»")) return null;
|
|
12439
|
-
for (let t of
|
|
12471
|
+
for (let t of A_) {
|
|
12440
12472
|
let n = t.exec(e), r = n?.groups?.target, i = n?.groups?.replacement;
|
|
12441
12473
|
if (!(!r || !i)) return {
|
|
12442
|
-
targetText:
|
|
12443
|
-
replacementText:
|
|
12474
|
+
targetText: M_(r),
|
|
12475
|
+
replacementText: M_(i),
|
|
12444
12476
|
operandRange: {
|
|
12445
12477
|
start: n.index,
|
|
12446
12478
|
end: n.index + n[0].length
|
|
@@ -12449,22 +12481,22 @@ function j_(e) {
|
|
|
12449
12481
|
}
|
|
12450
12482
|
return null;
|
|
12451
12483
|
}
|
|
12452
|
-
function
|
|
12453
|
-
let t =
|
|
12484
|
+
function P_(e) {
|
|
12485
|
+
let t = N_(e);
|
|
12454
12486
|
return t ? [t.operandRange] : [];
|
|
12455
12487
|
}
|
|
12456
|
-
function
|
|
12457
|
-
return
|
|
12488
|
+
function F_(e, t) {
|
|
12489
|
+
return zh(e.position, t) ? !0 : Array.from(D(Ng(e))).some((e) => zh(e.position, t));
|
|
12458
12490
|
}
|
|
12459
|
-
function
|
|
12460
|
-
let o =
|
|
12491
|
+
function I_(e, t, n, r, i, a) {
|
|
12492
|
+
let o = uh(e), s = uh(Lh(e, i)), c = dh(s, o), l = fh(s), u = ph(s), d = sh(s), f = n.action === "rétablir" || mh(s), p = hh(s) || f, m = gh(s), h = _h(s), g = x_(e), _ = u ? "insert_before" : "insert_after", v = l ? cg(s) : null, y = m ? v : null, b = h ? v : null, ee = () => {
|
|
12461
12493
|
let n = i[0]?.start;
|
|
12462
|
-
return (n === void 0 ? void 0 :
|
|
12463
|
-
},
|
|
12494
|
+
return (n === void 0 ? void 0 : T_(t, n)) ?? Em(e) ?? void 0;
|
|
12495
|
+
}, te = () => {
|
|
12464
12496
|
let e = i[0]?.start;
|
|
12465
|
-
return (e === void 0 ? void 0 :
|
|
12466
|
-
},
|
|
12467
|
-
let i =
|
|
12497
|
+
return (e === void 0 ? void 0 : w_(t, e)) ?? void 0;
|
|
12498
|
+
}, ne = ({ kind: e, targetText: t, insertText: n, expectsFollowingTable: r }) => {
|
|
12499
|
+
let i = vg({
|
|
12468
12500
|
hasRedactionIntro: c,
|
|
12469
12501
|
insertText: n,
|
|
12470
12502
|
normalized: o
|
|
@@ -12477,127 +12509,127 @@ function P_(e, t, n, r, i, a) {
|
|
|
12477
12509
|
...r ? { expectsFollowingTable: r } : {}
|
|
12478
12510
|
};
|
|
12479
12511
|
};
|
|
12480
|
-
if ((l || u) &&
|
|
12512
|
+
if ((l || u) && p && h && a.length >= 3) {
|
|
12481
12513
|
let e = a.slice(0, -2), t = a.at(-2), n = a.at(-1);
|
|
12482
12514
|
if (e.length > 0 && t && n) return [{
|
|
12483
12515
|
kind: "delete",
|
|
12484
12516
|
targetText: e[0],
|
|
12485
12517
|
extraTargetTexts: e.slice(1)
|
|
12486
|
-
},
|
|
12487
|
-
kind:
|
|
12518
|
+
}, ne({
|
|
12519
|
+
kind: _,
|
|
12488
12520
|
targetText: t,
|
|
12489
12521
|
insertText: n,
|
|
12490
|
-
expectsFollowingTable:
|
|
12522
|
+
expectsFollowingTable: g
|
|
12491
12523
|
})];
|
|
12492
12524
|
}
|
|
12493
|
-
if (!l && !u &&
|
|
12525
|
+
if (!l && !u && p && h && a.length >= 2 && /\best ajoutee?\s+une phrase\b|\bune phrase ainsi redigee\b/.test(o)) {
|
|
12494
12526
|
let e = a.slice(0, -1), t = a.at(-1);
|
|
12495
12527
|
if (e.length > 0 && t) return [{
|
|
12496
12528
|
kind: "delete",
|
|
12497
12529
|
targetText: e[0],
|
|
12498
12530
|
extraTargetTexts: e.slice(1)
|
|
12499
|
-
},
|
|
12531
|
+
}, ne({
|
|
12500
12532
|
kind: "insert_after",
|
|
12501
12533
|
targetText: "",
|
|
12502
12534
|
insertText: t,
|
|
12503
|
-
expectsFollowingTable:
|
|
12535
|
+
expectsFollowingTable: g
|
|
12504
12536
|
})];
|
|
12505
12537
|
}
|
|
12506
|
-
if ((l || u) &&
|
|
12538
|
+
if ((l || u) && p && m && a.length >= 4) {
|
|
12507
12539
|
let e = a.at(-2), t = a.at(-1);
|
|
12508
12540
|
if (e && t) return [{
|
|
12509
12541
|
kind: "replace",
|
|
12510
12542
|
targetText: a[0],
|
|
12511
12543
|
replacementText: a[1]
|
|
12512
|
-
},
|
|
12513
|
-
kind:
|
|
12544
|
+
}, ne({
|
|
12545
|
+
kind: _,
|
|
12514
12546
|
targetText: e,
|
|
12515
12547
|
insertText: t,
|
|
12516
|
-
expectsFollowingTable:
|
|
12548
|
+
expectsFollowingTable: g
|
|
12517
12549
|
})];
|
|
12518
12550
|
}
|
|
12519
|
-
if (
|
|
12551
|
+
if (m && h && !p && a.length >= 3) {
|
|
12520
12552
|
let e = o.search(/\bremplace(?:e|es|s)?\b/u), t = o.search(/\bsupprime(?:e|es|s)?\b/u);
|
|
12521
12553
|
if (e !== -1 && t !== -1 && e < t) return [{
|
|
12522
12554
|
kind: "replace",
|
|
12523
12555
|
targetText: a[0],
|
|
12524
12556
|
replacementText: a[1],
|
|
12525
|
-
...
|
|
12557
|
+
...y ? { targetScope: y } : {}
|
|
12526
12558
|
}, {
|
|
12527
12559
|
kind: "delete",
|
|
12528
12560
|
targetText: a[2],
|
|
12529
12561
|
extraTargetTexts: a.slice(3),
|
|
12530
|
-
...
|
|
12562
|
+
...b ? { targetScope: b } : {}
|
|
12531
12563
|
}];
|
|
12532
12564
|
if (e !== -1 && t !== -1 && t < e && a.length >= 4) return [{
|
|
12533
12565
|
kind: "delete",
|
|
12534
12566
|
targetText: a[0],
|
|
12535
12567
|
extraTargetTexts: a.slice(1, -2),
|
|
12536
|
-
...
|
|
12568
|
+
...b ? { targetScope: b } : {}
|
|
12537
12569
|
}, {
|
|
12538
12570
|
kind: "replace",
|
|
12539
12571
|
targetText: a.at(-2) ?? "",
|
|
12540
12572
|
replacementText: a.at(-1) ?? "",
|
|
12541
|
-
...
|
|
12573
|
+
...y ? { targetScope: y } : {}
|
|
12542
12574
|
}];
|
|
12543
12575
|
}
|
|
12544
|
-
let
|
|
12545
|
-
if (
|
|
12576
|
+
let x = s.match(/\bremplace(?:e|es|s)?\b/gu)?.length ?? 0;
|
|
12577
|
+
if (m && !p && a.length >= 4 && a.length % 2 == 0 && x >= 2) {
|
|
12546
12578
|
let e = [];
|
|
12547
12579
|
for (let t = 0; t < a.length; t += 2) e.push({
|
|
12548
12580
|
kind: "replace",
|
|
12549
12581
|
targetText: a[t],
|
|
12550
12582
|
replacementText: a[t + 1],
|
|
12551
|
-
...
|
|
12583
|
+
...y ? { targetScope: y } : {}
|
|
12552
12584
|
});
|
|
12553
12585
|
return e;
|
|
12554
12586
|
}
|
|
12555
|
-
if (n.action === "supprimer" ||
|
|
12587
|
+
if (n.action === "supprimer" || h) {
|
|
12556
12588
|
if (r === "article" && a.length === 0) return { kind: "delete_article" };
|
|
12557
12589
|
if (a.length >= 1) {
|
|
12558
|
-
let e = a.length === 1 ?
|
|
12590
|
+
let e = a.length === 1 ? ee() : void 0;
|
|
12559
12591
|
return {
|
|
12560
12592
|
kind: "delete",
|
|
12561
12593
|
targetText: a[0],
|
|
12562
12594
|
extraTargetTexts: a.slice(1),
|
|
12563
12595
|
...e ? { targetOccurrenceCount: e } : {},
|
|
12564
|
-
...
|
|
12596
|
+
...b ? { targetScope: b } : {}
|
|
12565
12597
|
};
|
|
12566
12598
|
}
|
|
12567
12599
|
return { kind: "delete_portion" };
|
|
12568
12600
|
}
|
|
12569
|
-
if (
|
|
12601
|
+
if (m && /\bpar\s+(?:le|un)\s+tableau\s+(?:suivant|ainsi\s+redigee?|ainsi\s+rediges|ainsi\s+redigees)\b/.test(o)) return {
|
|
12570
12602
|
kind: "replace_portion",
|
|
12571
12603
|
replacement: { type: "following_table" }
|
|
12572
12604
|
};
|
|
12573
|
-
if (
|
|
12574
|
-
let t =
|
|
12605
|
+
if (m && !p && !h && a.length === 0) {
|
|
12606
|
+
let t = N_(e);
|
|
12575
12607
|
if (t) return {
|
|
12576
12608
|
kind: "replace",
|
|
12577
12609
|
targetText: t.targetText,
|
|
12578
12610
|
replacementText: t.replacementText,
|
|
12579
|
-
...
|
|
12611
|
+
...y ? { targetScope: y } : {}
|
|
12580
12612
|
};
|
|
12581
12613
|
}
|
|
12582
|
-
if (
|
|
12583
|
-
let e =
|
|
12614
|
+
if (m && a.length >= 2) {
|
|
12615
|
+
let e = ee(), t = te();
|
|
12584
12616
|
return {
|
|
12585
12617
|
kind: "replace",
|
|
12586
12618
|
targetText: a[0],
|
|
12587
12619
|
replacementText: a[1],
|
|
12588
12620
|
...t ? { occurrenceIndex: t } : {},
|
|
12589
12621
|
...e ? { targetOccurrenceCount: e } : {},
|
|
12590
|
-
...
|
|
12622
|
+
...y ? { targetScope: y } : {}
|
|
12591
12623
|
};
|
|
12592
12624
|
}
|
|
12593
|
-
if (l && c && a.length >= 2 &&
|
|
12625
|
+
if (l && c && a.length >= 2 && v) return {
|
|
12594
12626
|
kind: "replace",
|
|
12595
12627
|
targetText: a[0],
|
|
12596
12628
|
replacementText: a[1],
|
|
12597
|
-
targetScope:
|
|
12629
|
+
targetScope: v
|
|
12598
12630
|
};
|
|
12599
|
-
if (!
|
|
12600
|
-
let e =
|
|
12631
|
+
if (!p && a.length === 1 && c) {
|
|
12632
|
+
let e = yg({
|
|
12601
12633
|
hasRedactionIntro: c,
|
|
12602
12634
|
normalized: o,
|
|
12603
12635
|
replacementText: a[0]
|
|
@@ -12611,7 +12643,7 @@ function P_(e, t, n, r, i, a) {
|
|
|
12611
12643
|
...e ? { replacementLayout: e } : {}
|
|
12612
12644
|
};
|
|
12613
12645
|
}
|
|
12614
|
-
if (
|
|
12646
|
+
if (p && g) return ne(u ? {
|
|
12615
12647
|
kind: "insert_before",
|
|
12616
12648
|
targetText: "",
|
|
12617
12649
|
insertText: "",
|
|
@@ -12622,42 +12654,42 @@ function P_(e, t, n, r, i, a) {
|
|
|
12622
12654
|
insertText: "",
|
|
12623
12655
|
expectsFollowingTable: !0
|
|
12624
12656
|
});
|
|
12625
|
-
if (
|
|
12626
|
-
if (l) return
|
|
12657
|
+
if (p && a.length >= 2) {
|
|
12658
|
+
if (l) return ne({
|
|
12627
12659
|
kind: "insert_after",
|
|
12628
12660
|
targetText: a[0],
|
|
12629
12661
|
insertText: a[1],
|
|
12630
|
-
expectsFollowingTable:
|
|
12662
|
+
expectsFollowingTable: g
|
|
12631
12663
|
});
|
|
12632
|
-
if (u) return
|
|
12664
|
+
if (u) return ne({
|
|
12633
12665
|
kind: "insert_before",
|
|
12634
12666
|
targetText: a[0],
|
|
12635
12667
|
insertText: a[1],
|
|
12636
|
-
expectsFollowingTable:
|
|
12668
|
+
expectsFollowingTable: g
|
|
12637
12669
|
});
|
|
12638
12670
|
}
|
|
12639
|
-
return
|
|
12671
|
+
return p && a.length === 1 ? ne(l ? {
|
|
12640
12672
|
kind: "insert_after",
|
|
12641
12673
|
targetText: "",
|
|
12642
12674
|
insertText: a[0],
|
|
12643
|
-
expectsFollowingTable:
|
|
12644
|
-
} : u ? {
|
|
12675
|
+
expectsFollowingTable: g
|
|
12676
|
+
} : u || d === "start" ? {
|
|
12645
12677
|
kind: "insert_before",
|
|
12646
12678
|
targetText: "",
|
|
12647
12679
|
insertText: a[0],
|
|
12648
|
-
expectsFollowingTable:
|
|
12680
|
+
expectsFollowingTable: g
|
|
12649
12681
|
} : {
|
|
12650
12682
|
kind: "insert_after",
|
|
12651
12683
|
targetText: "",
|
|
12652
12684
|
insertText: a[0],
|
|
12653
|
-
expectsFollowingTable:
|
|
12685
|
+
expectsFollowingTable: g
|
|
12654
12686
|
}) : null;
|
|
12655
12687
|
}
|
|
12656
|
-
function
|
|
12657
|
-
let t =
|
|
12688
|
+
function L_(e) {
|
|
12689
|
+
let t = uh(e);
|
|
12658
12690
|
return /\bapres\b/.test(t) && /\bla\s+fin\s+(?:(?:de\s+l['’]?)|d['’]?|de|du|des)?\s*$/u.test(t);
|
|
12659
12691
|
}
|
|
12660
|
-
function
|
|
12692
|
+
function R_(e) {
|
|
12661
12693
|
switch (e.kind) {
|
|
12662
12694
|
case "insert_after":
|
|
12663
12695
|
case "insert_before": return {
|
|
@@ -12701,7 +12733,7 @@ function I_(e) {
|
|
|
12701
12733
|
case "delete_article": return { kind: "delete_article" };
|
|
12702
12734
|
}
|
|
12703
12735
|
}
|
|
12704
|
-
function
|
|
12736
|
+
function z_(e) {
|
|
12705
12737
|
let t = (t) => {
|
|
12706
12738
|
let n = e[t];
|
|
12707
12739
|
return typeof n == "string" ? n : "";
|
|
@@ -12718,7 +12750,7 @@ function L_(e) {
|
|
|
12718
12750
|
o
|
|
12719
12751
|
].join("|");
|
|
12720
12752
|
}
|
|
12721
|
-
function
|
|
12753
|
+
function B_(e, t, n) {
|
|
12722
12754
|
return t.targetType === n.targetType && JSON.stringify(t.reference) === JSON.stringify(n.reference) && JSON.stringify(t.portionSelectors) === JSON.stringify(n.portionSelectors) ? e : {
|
|
12723
12755
|
...e,
|
|
12724
12756
|
targetType: t.targetType,
|
|
@@ -12726,10 +12758,10 @@ function R_(e, t, n) {
|
|
|
12726
12758
|
portionSelectors: t.portionSelectors
|
|
12727
12759
|
};
|
|
12728
12760
|
}
|
|
12729
|
-
function
|
|
12730
|
-
return (e.kind === "compound" ? e.operations : [
|
|
12761
|
+
function V_(e, t) {
|
|
12762
|
+
return (e.kind === "compound" ? e.operations : [R_(e)]).map((n) => B_(n, e, t));
|
|
12731
12763
|
}
|
|
12732
|
-
function
|
|
12764
|
+
function H_(e) {
|
|
12733
12765
|
let t = [];
|
|
12734
12766
|
for (let n = 0; n < e.length; n += 1) {
|
|
12735
12767
|
let r = e[n];
|
|
@@ -12744,14 +12776,14 @@ function B_(e) {
|
|
|
12744
12776
|
continue;
|
|
12745
12777
|
}
|
|
12746
12778
|
let o = i[0], s = [];
|
|
12747
|
-
for (let [e, t] of i.entries()) for (let [n, r] of
|
|
12779
|
+
for (let [e, t] of i.entries()) for (let [n, r] of V_(t, o).entries()) s.push({
|
|
12748
12780
|
directiveIndex: e,
|
|
12749
12781
|
operationIndex: n,
|
|
12750
12782
|
operation: r
|
|
12751
12783
|
});
|
|
12752
12784
|
let c = /* @__PURE__ */ new Set(), l = [];
|
|
12753
12785
|
for (let e = s.length - 1; e >= 0; --e) {
|
|
12754
|
-
let t = s[e], n =
|
|
12786
|
+
let t = s[e], n = z_(t.operation);
|
|
12755
12787
|
c.has(n) || (c.add(n), l.push(t));
|
|
12756
12788
|
}
|
|
12757
12789
|
l.sort((e, t) => e.directiveIndex - t.directiveIndex || e.operationIndex - t.operationIndex), t.push({
|
|
@@ -12770,14 +12802,14 @@ function B_(e) {
|
|
|
12770
12802
|
}
|
|
12771
12803
|
return t;
|
|
12772
12804
|
}
|
|
12773
|
-
function
|
|
12774
|
-
let o = e.target ?? xt(t), s =
|
|
12805
|
+
function U_({ action: e, reference: t, sourcePosition: n, sourceText: r, fullText: i, tableTarget: a }) {
|
|
12806
|
+
let o = e.target ?? xt(t), s = Vp(t), c = i && n.start < i.length ? i.slice(n.start) : r, l = i && n.start < i.length ? n.start : 0, u = i === r && n.start < r.length && !L_(r.slice(0, n.start)) ? r.slice(n.start) : r, d = Ih(u), f = I_(r, u, e, o, d, d.map((e) => e.text));
|
|
12775
12807
|
if (!f) return null;
|
|
12776
|
-
let p =
|
|
12808
|
+
let p = E_(f, s), m = r_(r), h = {
|
|
12777
12809
|
...m ? { applicabilityDate: m } : {},
|
|
12778
12810
|
sourcePosition: n,
|
|
12779
12811
|
sourceText: r
|
|
12780
|
-
}, g =
|
|
12812
|
+
}, g = C_(c, l), _ = (e) => {
|
|
12781
12813
|
switch (e.kind) {
|
|
12782
12814
|
case "insert_after":
|
|
12783
12815
|
case "insert_before": return {
|
|
@@ -12839,7 +12871,7 @@ function V_({ action: e, reference: t, sourcePosition: n, sourceText: r, fullTex
|
|
|
12839
12871
|
insertText: e.insertText,
|
|
12840
12872
|
...e.insertLayout ? { insertLayout: e.insertLayout } : {},
|
|
12841
12873
|
...e.expectsFollowingTable && g ? { citation: g } : {},
|
|
12842
|
-
...
|
|
12874
|
+
...__(a) ? { tableTarget: a } : {},
|
|
12843
12875
|
...h
|
|
12844
12876
|
};
|
|
12845
12877
|
case "replace": return {
|
|
@@ -12856,7 +12888,7 @@ function V_({ action: e, reference: t, sourcePosition: n, sourceText: r, fullTex
|
|
|
12856
12888
|
...e.occurrenceIndex === void 0 ? {} : { occurrenceIndex: e.occurrenceIndex },
|
|
12857
12889
|
...e.targetOccurrenceCount === void 0 ? {} : { targetOccurrenceCount: e.targetOccurrenceCount },
|
|
12858
12890
|
...e.targetScope ? { targetScope: e.targetScope } : {},
|
|
12859
|
-
...
|
|
12891
|
+
...__(a) ? { tableTarget: a } : {},
|
|
12860
12892
|
...h
|
|
12861
12893
|
};
|
|
12862
12894
|
case "replace_portion": return e.replacement.type === "following_table" && !g ? null : {
|
|
@@ -12868,11 +12900,11 @@ function V_({ action: e, reference: t, sourcePosition: n, sourceText: r, fullTex
|
|
|
12868
12900
|
replacement: e.replacement,
|
|
12869
12901
|
...e.replacementLayout ? { replacementLayout: e.replacementLayout } : {},
|
|
12870
12902
|
...e.replacement.type === "following_table" && g ? { citation: g } : {},
|
|
12871
|
-
...
|
|
12903
|
+
...__(a) ? { tableTarget: a } : {},
|
|
12872
12904
|
...h
|
|
12873
12905
|
};
|
|
12874
12906
|
case "delete": {
|
|
12875
|
-
let n = d.map((e) =>
|
|
12907
|
+
let n = d.map((e) => w_(u, e.start)), r = /* @__PURE__ */ new Map();
|
|
12876
12908
|
for (let [e, t] of d.entries()) r.has(t.text) || r.set(t.text, n[e] ?? null);
|
|
12877
12909
|
let i = [e.targetText, ...e.extraTargetTexts ?? []].filter((e) => e && e.trim().length > 0).filter((e, t, n) => n.indexOf(e) === t);
|
|
12878
12910
|
return i.length > 1 ? v(i.map((t) => ({
|
|
@@ -12881,7 +12913,7 @@ function V_({ action: e, reference: t, sourcePosition: n, sourceText: r, fullTex
|
|
|
12881
12913
|
...e.targetScope ? { targetScope: e.targetScope } : {},
|
|
12882
12914
|
occurrenceIndex: r.get(t) ?? void 0,
|
|
12883
12915
|
...t === e.targetText && e.targetOccurrenceCount !== void 0 ? { targetOccurrenceCount: e.targetOccurrenceCount } : {},
|
|
12884
|
-
...
|
|
12916
|
+
...__(a) ? { tableTarget: a } : {}
|
|
12885
12917
|
}))) : {
|
|
12886
12918
|
kind: "delete",
|
|
12887
12919
|
targetType: o,
|
|
@@ -12891,7 +12923,7 @@ function V_({ action: e, reference: t, sourcePosition: n, sourceText: r, fullTex
|
|
|
12891
12923
|
...e.targetScope ? { targetScope: e.targetScope } : {},
|
|
12892
12924
|
occurrenceIndex: r.get(e.targetText) ?? void 0,
|
|
12893
12925
|
...e.targetOccurrenceCount === void 0 ? {} : { targetOccurrenceCount: e.targetOccurrenceCount },
|
|
12894
|
-
...
|
|
12926
|
+
...__(a) ? { tableTarget: a } : {},
|
|
12895
12927
|
...h
|
|
12896
12928
|
};
|
|
12897
12929
|
}
|
|
@@ -12900,7 +12932,7 @@ function V_({ action: e, reference: t, sourcePosition: n, sourceText: r, fullTex
|
|
|
12900
12932
|
targetType: o,
|
|
12901
12933
|
reference: t,
|
|
12902
12934
|
portionSelectors: s,
|
|
12903
|
-
...
|
|
12935
|
+
...__(a) ? { tableTarget: a } : {},
|
|
12904
12936
|
...h
|
|
12905
12937
|
};
|
|
12906
12938
|
case "delete_article": return o === "article" ? {
|
|
@@ -12924,7 +12956,7 @@ function V_({ action: e, reference: t, sourcePosition: n, sourceText: r, fullTex
|
|
|
12924
12956
|
}
|
|
12925
12957
|
return y(p);
|
|
12926
12958
|
}
|
|
12927
|
-
function
|
|
12959
|
+
function W_(e) {
|
|
12928
12960
|
let t = /\barticle\s+([0-9]+(?:-[0-9]+)?(?:\s*[A-Z])?(?:\s+[a-z]+)?)\b/i.exec(e);
|
|
12929
12961
|
if (!t || t.index === void 0) return null;
|
|
12930
12962
|
let n = t.index, r = t.index + t[0].length;
|
|
@@ -12943,73 +12975,73 @@ function H_(e) {
|
|
|
12943
12975
|
}
|
|
12944
12976
|
};
|
|
12945
12977
|
}
|
|
12946
|
-
function
|
|
12978
|
+
function G_(e, t) {
|
|
12947
12979
|
let n = performance.now(), r = be(e);
|
|
12948
12980
|
Q(t.diagnostics, "simplifyMs", n);
|
|
12949
12981
|
let i = r.output;
|
|
12950
12982
|
if (t.allowListExtraction) {
|
|
12951
|
-
let e = performance.now(), n =
|
|
12983
|
+
let e = performance.now(), n = y_(i, t.diagnostics);
|
|
12952
12984
|
if (Q(t.diagnostics, "listExtractionMs", e), n) return t.diagnostics !== void 0 && (t.diagnostics.directiveCount = n.length), n;
|
|
12953
12985
|
}
|
|
12954
|
-
let a = performance.now(), o =
|
|
12986
|
+
let a = performance.now(), o = Rh(i), s = P_(i), c = Vh(i);
|
|
12955
12987
|
Q(t.diagnostics, "prepareRangesMs", a);
|
|
12956
|
-
let l = new x(i), u = performance.now(), d =
|
|
12988
|
+
let l = new x(i), u = performance.now(), d = eh(l);
|
|
12957
12989
|
Q(t.diagnostics, "extractReferencesMs", u);
|
|
12958
12990
|
let f = [...o, ...s];
|
|
12959
12991
|
if (f.length > 0) {
|
|
12960
12992
|
let e = performance.now();
|
|
12961
|
-
d = d.filter((e) => !
|
|
12993
|
+
d = d.filter((e) => !F_(e, f)), Q(t.diagnostics, "filterReferencesMs", e);
|
|
12962
12994
|
}
|
|
12963
12995
|
if (d.length === 0) {
|
|
12964
12996
|
let e = performance.now();
|
|
12965
|
-
d =
|
|
12997
|
+
d = eh(new x(c.split(",")[0] ?? c)), Q(t.diagnostics, "fallbackReferencesMs", e);
|
|
12966
12998
|
}
|
|
12967
12999
|
if (d.length === 0) {
|
|
12968
|
-
let e = performance.now(), n =
|
|
13000
|
+
let e = performance.now(), n = W_(c);
|
|
12969
13001
|
n && (d = [{
|
|
12970
13002
|
...n.reference,
|
|
12971
13003
|
position: n.position
|
|
12972
13004
|
}]), Q(t.diagnostics, "fallbackReferencesMs", e);
|
|
12973
13005
|
}
|
|
12974
13006
|
t.diagnostics !== void 0 && (t.diagnostics.referenceCount = d.length);
|
|
12975
|
-
let p = performance.now(), m =
|
|
13007
|
+
let p = performance.now(), m = Og(c);
|
|
12976
13008
|
if (d.length === 1 && d[0]?.type === "article") {
|
|
12977
|
-
let e =
|
|
13009
|
+
let e = Nh(c, { actionIndex: m ?? c.length });
|
|
12978
13010
|
e && (d = [e]);
|
|
12979
13011
|
}
|
|
12980
13012
|
if (m !== null) {
|
|
12981
|
-
let e = d.some((e) => xt(
|
|
13013
|
+
let e = d.some((e) => xt(Ng(e)) === "article"), t = d.some((e) => [...D(Ng(e))].some((e) => e.type === "article")), n = c.slice(0, m), r = Oh(O_(n), 0) ?? Oh(n, 0), i = d.map(Ng).sort((e, t) => kh(t) - kh(e) || Ah(t) - Ah(e))[0], a = jh(i ?? null, r);
|
|
12982
13014
|
if (!e && a && a === r && (d = [r]), !t) {
|
|
12983
13015
|
let e = i, t = n.indexOf(":");
|
|
12984
13016
|
if (t !== -1) {
|
|
12985
|
-
let r = t + 1, i =
|
|
12986
|
-
e && i &&
|
|
13017
|
+
let r = t + 1, i = Oh(k_(n.slice(r)), r), a = i ? Vp(i) : [];
|
|
13018
|
+
e && i && kh(e) > 0 && (a.length > 1 || a.some((e) => e.kind === "range")) && (d = [Jg(e, i)]);
|
|
12987
13019
|
}
|
|
12988
13020
|
}
|
|
12989
13021
|
if (t) {
|
|
12990
|
-
let e = d.map(
|
|
12991
|
-
t !== -1 && e && i &&
|
|
13022
|
+
let e = d.map(Ng).filter((e) => [...D(e)].some((e) => e.type === "article")).sort((e, t) => kh(t) - kh(e) || Ah(t) - Ah(e))[0], t = n.indexOf(":"), r = t === -1 ? 0 : t + 1, i = Oh(k_(n.slice(r)), r), a = i ? Vp(i) : [];
|
|
13023
|
+
t !== -1 && e && i && kh(e) > 0 && (a.length > 1 || a.some((e) => e.kind === "range")) && d.push(Jg(e, i));
|
|
12992
13024
|
}
|
|
12993
13025
|
}
|
|
12994
13026
|
Q(t.diagnostics, "refineReferencesMs", p);
|
|
12995
13027
|
let h = [], g = performance.now();
|
|
12996
13028
|
for (let e of d) {
|
|
12997
13029
|
if (e.type === "reference_et_action") {
|
|
12998
|
-
let t = e.position?.start ?? 0, n = i.lastIndexOf("\n", Math.max(0, t - 1)) + 1, r =
|
|
13030
|
+
let t = e.position?.start ?? 0, n = i.lastIndexOf("\n", Math.max(0, t - 1)) + 1, r = L_(i.slice(n, t)) ? n : t, a = {
|
|
12999
13031
|
start: r,
|
|
13000
13032
|
stop: i.length
|
|
13001
|
-
}, o = i.slice(r), s =
|
|
13033
|
+
}, o = i.slice(r), s = U_({
|
|
13002
13034
|
action: e.action,
|
|
13003
13035
|
reference: e.reference,
|
|
13004
13036
|
sourcePosition: a,
|
|
13005
13037
|
sourceText: o,
|
|
13006
13038
|
fullText: i,
|
|
13007
|
-
tableTarget:
|
|
13039
|
+
tableTarget: D_(o) ?? D_(i)
|
|
13008
13040
|
});
|
|
13009
13041
|
s && (Array.isArray(s) ? h.push(...s) : h.push(s));
|
|
13010
13042
|
continue;
|
|
13011
13043
|
}
|
|
13012
|
-
let t =
|
|
13044
|
+
let t = U_({
|
|
13013
13045
|
action: { action: "modifier" },
|
|
13014
13046
|
reference: e,
|
|
13015
13047
|
sourcePosition: e.position ?? {
|
|
@@ -13018,92 +13050,92 @@ function U_(e, t) {
|
|
|
13018
13050
|
},
|
|
13019
13051
|
sourceText: i,
|
|
13020
13052
|
fullText: i,
|
|
13021
|
-
tableTarget:
|
|
13053
|
+
tableTarget: D_(i)
|
|
13022
13054
|
});
|
|
13023
13055
|
t && (Array.isArray(t) ? h.push(...t) : h.push(t));
|
|
13024
13056
|
}
|
|
13025
13057
|
if (h.length === 0) {
|
|
13026
|
-
let e =
|
|
13058
|
+
let e = W_(c);
|
|
13027
13059
|
if (e) {
|
|
13028
|
-
let t =
|
|
13060
|
+
let t = U_({
|
|
13029
13061
|
action: { action: "modifier" },
|
|
13030
13062
|
reference: e.reference,
|
|
13031
13063
|
sourcePosition: e.position,
|
|
13032
13064
|
sourceText: i,
|
|
13033
13065
|
fullText: i,
|
|
13034
|
-
tableTarget:
|
|
13066
|
+
tableTarget: D_(i)
|
|
13035
13067
|
});
|
|
13036
13068
|
t && (Array.isArray(t) ? h.push(...t) : h.push(t));
|
|
13037
13069
|
}
|
|
13038
13070
|
}
|
|
13039
13071
|
Q(t.diagnostics, "buildDirectivesMs", g);
|
|
13040
|
-
let _ = performance.now(), v =
|
|
13072
|
+
let _ = performance.now(), v = H_(h);
|
|
13041
13073
|
return Q(t.diagnostics, "canonicalizeMs", _), t.diagnostics !== void 0 && (t.diagnostics.directiveCount = v.length), v;
|
|
13042
13074
|
}
|
|
13043
|
-
function
|
|
13075
|
+
function K_(e) {
|
|
13044
13076
|
let t = new x(be(e).output);
|
|
13045
|
-
return [...
|
|
13077
|
+
return [...ag.extract(t, { overlapWindow: 100 })];
|
|
13046
13078
|
}
|
|
13047
|
-
function
|
|
13048
|
-
return
|
|
13079
|
+
function q_(e, t) {
|
|
13080
|
+
return G_(e, {
|
|
13049
13081
|
allowListExtraction: !0,
|
|
13050
13082
|
diagnostics: t
|
|
13051
13083
|
});
|
|
13052
13084
|
}
|
|
13053
|
-
var
|
|
13054
|
-
function
|
|
13055
|
-
let t =
|
|
13056
|
-
return t.includes("«") || t.includes("»") || !e.trim().endsWith(":") ? !1 :
|
|
13085
|
+
var J_ = q_;
|
|
13086
|
+
function Y_(e) {
|
|
13087
|
+
let t = uh(e);
|
|
13088
|
+
return t.includes("«") || t.includes("»") || !e.trim().endsWith(":") ? !1 : vh(t);
|
|
13057
13089
|
}
|
|
13058
|
-
function
|
|
13090
|
+
function X_(e) {
|
|
13059
13091
|
return e.trimStart().startsWith("«");
|
|
13060
13092
|
}
|
|
13061
|
-
function
|
|
13093
|
+
function Z_(e) {
|
|
13062
13094
|
return /»[.;]?\s*$/u.test(e);
|
|
13063
13095
|
}
|
|
13064
|
-
function
|
|
13096
|
+
function Q_(e, t) {
|
|
13065
13097
|
for (let n = t; n < e.length; n += 1) {
|
|
13066
|
-
let t =
|
|
13098
|
+
let t = bg(e[n]).trim();
|
|
13067
13099
|
if (t.length > 0) return t;
|
|
13068
13100
|
}
|
|
13069
13101
|
}
|
|
13070
|
-
function
|
|
13102
|
+
function $_(e, t) {
|
|
13071
13103
|
let n = [], r = !1, i = t + 1;
|
|
13072
13104
|
for (; i < e.length;) {
|
|
13073
|
-
let t = e[i], a =
|
|
13105
|
+
let t = e[i], a = bg(t);
|
|
13074
13106
|
if (!r && a.includes("«") && (r = !0), r) {
|
|
13075
13107
|
n.push(a);
|
|
13076
|
-
let t =
|
|
13077
|
-
if (
|
|
13108
|
+
let t = Q_(e, i + 1);
|
|
13109
|
+
if (Z_(a) && (t === void 0 || !X_(t))) break;
|
|
13078
13110
|
} else if (a.trim().length > 0) break;
|
|
13079
13111
|
i += 1;
|
|
13080
13112
|
}
|
|
13081
13113
|
return !r || n.length === 0 ? null : {
|
|
13082
|
-
combinedText: [
|
|
13114
|
+
combinedText: [bg(e[t]), ...n].join("\n"),
|
|
13083
13115
|
endIndex: i
|
|
13084
13116
|
};
|
|
13085
13117
|
}
|
|
13086
|
-
function
|
|
13118
|
+
function ev(e) {
|
|
13087
13119
|
let t = v()(e).output.split("\n").map((e) => e.trim()).filter((e) => e.length > 0), n = [];
|
|
13088
13120
|
for (let e = 0; e < t.length; e += 1) {
|
|
13089
13121
|
let r = t[e];
|
|
13090
|
-
if (
|
|
13091
|
-
let r =
|
|
13122
|
+
if (Y_(r)) {
|
|
13123
|
+
let r = $_(t, e);
|
|
13092
13124
|
if (r) {
|
|
13093
|
-
let t =
|
|
13125
|
+
let t = q_(r.combinedText);
|
|
13094
13126
|
if (t.length > 0) {
|
|
13095
13127
|
n.push(...t), e = r.endIndex;
|
|
13096
13128
|
continue;
|
|
13097
13129
|
}
|
|
13098
13130
|
}
|
|
13099
13131
|
}
|
|
13100
|
-
let i =
|
|
13132
|
+
let i = G_(r, { allowListExtraction: !1 });
|
|
13101
13133
|
i.length > 0 && n.push(...i);
|
|
13102
13134
|
}
|
|
13103
13135
|
return n;
|
|
13104
13136
|
}
|
|
13105
|
-
var
|
|
13106
|
-
function
|
|
13137
|
+
var tv = ev, nv;
|
|
13138
|
+
function rv(e) {
|
|
13107
13139
|
return {
|
|
13108
13140
|
dateDebut: e.dateDebut ?? "0001-01-01",
|
|
13109
13141
|
dateFin: e.dateFin ?? "2999-01-01",
|
|
@@ -13112,7 +13144,7 @@ function tv(e) {
|
|
|
13112
13144
|
textId: e.textId
|
|
13113
13145
|
};
|
|
13114
13146
|
}
|
|
13115
|
-
function
|
|
13147
|
+
function iv(e) {
|
|
13116
13148
|
if (e.length === 0) return;
|
|
13117
13149
|
let t = /* @__PURE__ */ new Map();
|
|
13118
13150
|
for (let n of e) {
|
|
@@ -13131,7 +13163,7 @@ function nv(e) {
|
|
|
13131
13163
|
let [{ id: n }] = [...t.values()];
|
|
13132
13164
|
return { articleId: n };
|
|
13133
13165
|
}
|
|
13134
|
-
function
|
|
13166
|
+
function av(e) {
|
|
13135
13167
|
let t = e["@id"];
|
|
13136
13168
|
return t === void 0 ? null : {
|
|
13137
13169
|
dateDebut: e["@debut"] ?? null,
|
|
@@ -13141,10 +13173,10 @@ function rv(e) {
|
|
|
13141
13173
|
title: e["#text"] ?? null
|
|
13142
13174
|
};
|
|
13143
13175
|
}
|
|
13144
|
-
function
|
|
13176
|
+
function ov(e, t) {
|
|
13145
13177
|
return (e.dateDebut === null || e.dateDebut <= t) && (e.dateFin === null || e.dateFin >= t);
|
|
13146
13178
|
}
|
|
13147
|
-
var
|
|
13179
|
+
var sv = class extends Ae {
|
|
13148
13180
|
canutesDb;
|
|
13149
13181
|
articleHistoryInfoByTextAndNum = /* @__PURE__ */ new Map();
|
|
13150
13182
|
articleRowsByNumByTextAndDate = /* @__PURE__ */ new Map();
|
|
@@ -13170,12 +13202,12 @@ var av = class extends Ae {
|
|
|
13170
13202
|
WHERE
|
|
13171
13203
|
data -> 'CONTEXTE' -> 'TEXTE' ->> '@cid' = ${n}
|
|
13172
13204
|
AND num = ${t}
|
|
13173
|
-
`).map(
|
|
13205
|
+
`).map(rv), this.articleRowsByNumByTextAndDate.set(r, i)), i;
|
|
13174
13206
|
}
|
|
13175
13207
|
async getArticleHistoryInfo({ num: e, textId: t }) {
|
|
13176
13208
|
if (e === void 0) return;
|
|
13177
13209
|
let n = `${t}\0${e}`, r = this.articleHistoryInfoByTextAndNum.get(n);
|
|
13178
|
-
return r === void 0 && (r =
|
|
13210
|
+
return r === void 0 && (r = iv(await this.canutesDb`
|
|
13179
13211
|
SELECT
|
|
13180
13212
|
id,
|
|
13181
13213
|
data -> 'META' -> 'META_SPEC' -> 'META_ARTICLE' ->> 'DATE_DEBUT' AS "dateDebut",
|
|
@@ -13198,7 +13230,7 @@ var av = class extends Ae {
|
|
|
13198
13230
|
SELECT data
|
|
13199
13231
|
FROM legifrance.textelr
|
|
13200
13232
|
WHERE id = ${t}
|
|
13201
|
-
`)[0]?.data.STRUCT?.LIEN_SECTION_TA?.map(
|
|
13233
|
+
`)[0]?.data.STRUCT?.LIEN_SECTION_TA?.map(av).filter((e) => e !== null).filter((t) => ov(t, e)) ?? [] : i.map(av).filter((e) => e !== null).filter((t) => ov(t, e)), this.directSectionChildrenByParentAndDate.set(n, r);
|
|
13202
13234
|
}
|
|
13203
13235
|
return r;
|
|
13204
13236
|
}
|
|
@@ -13241,7 +13273,7 @@ var av = class extends Ae {
|
|
|
13241
13273
|
FROM legifrance.article
|
|
13242
13274
|
WHERE num = ${t}
|
|
13243
13275
|
LIMIT 100
|
|
13244
|
-
`).map(
|
|
13276
|
+
`).map(rv), this.globalArticleRowsByNumAndDate.set(n, r)), r;
|
|
13245
13277
|
}
|
|
13246
13278
|
async preloadTextTitlesInfos(e = {}) {
|
|
13247
13279
|
let t = (t, n = {}) => {
|
|
@@ -13256,7 +13288,7 @@ var av = class extends Ae {
|
|
|
13256
13288
|
return;
|
|
13257
13289
|
}
|
|
13258
13290
|
let n = new Ee("canutes.preloadTextTitlesInfos");
|
|
13259
|
-
|
|
13291
|
+
nv === void 0 ? (t("queryTextTitlesInfos:start"), nv = (async () => {
|
|
13260
13292
|
let e = await n.time("queryTextTitlesInfos", () => this.canutesDb`
|
|
13261
13293
|
SELECT
|
|
13262
13294
|
data -> 'META' -> 'META_SPEC' -> 'META_TEXTE_CHRONICLE' ->> 'CID' AS cid,
|
|
@@ -13286,8 +13318,8 @@ var av = class extends Ae {
|
|
|
13286
13318
|
`);
|
|
13287
13319
|
t("queryTextTitlesInfos:done", { count: e.length }), t("buildTextTitlesInfos:start", { count: e.length }), await we(e, { onProgress: ({ count: e, phase: n }) => t(`buildTextTitlesInfos:${n}`, { count: e }) }), t("buildTextTitlesInfos:done", { count: e.length }), t("setTextTitlesInfos:done");
|
|
13288
13320
|
})().catch((e) => {
|
|
13289
|
-
throw
|
|
13290
|
-
})) : t("waiting-for-shared-preload"), await
|
|
13321
|
+
throw nv = void 0, e;
|
|
13322
|
+
})) : t("waiting-for-shared-preload"), await nv, n.log(), this.textTitlesInfosLoaded = !0;
|
|
13291
13323
|
}
|
|
13292
13324
|
async preloadUniqueActiveArticlesByNums({ date: e, nums: t }) {
|
|
13293
13325
|
let n = [...new Set([...t].filter(Boolean))].filter((t) => !this.globalArticleRowsByNumAndDate.has(`${t}\0${e}`));
|
|
@@ -13301,7 +13333,7 @@ var av = class extends Ae {
|
|
|
13301
13333
|
data -> 'META' -> 'META_SPEC' -> 'META_ARTICLE' ->> 'DATE_FIN' AS "dateFin"
|
|
13302
13334
|
FROM legifrance.article
|
|
13303
13335
|
WHERE num IN ${this.canutesDb(n)}
|
|
13304
|
-
`).map(
|
|
13336
|
+
`).map(rv), i = /* @__PURE__ */ new Map();
|
|
13305
13337
|
for (let e of r) {
|
|
13306
13338
|
if (e.num === null) continue;
|
|
13307
13339
|
let t = i.get(e.num);
|
|
@@ -13312,7 +13344,7 @@ var av = class extends Ae {
|
|
|
13312
13344
|
};
|
|
13313
13345
|
//#endregion
|
|
13314
13346
|
//#region src/lib/extractors/links.ts
|
|
13315
|
-
function
|
|
13347
|
+
function cv() {
|
|
13316
13348
|
return {
|
|
13317
13349
|
citationCount: 0,
|
|
13318
13350
|
fastPath: {
|
|
@@ -13329,7 +13361,7 @@ function ov() {
|
|
|
13329
13361
|
}
|
|
13330
13362
|
};
|
|
13331
13363
|
}
|
|
13332
|
-
function
|
|
13364
|
+
function lv() {
|
|
13333
13365
|
return {
|
|
13334
13366
|
articleDefinitionLinkCount: 0,
|
|
13335
13367
|
articleDirectLookupMs: 0,
|
|
@@ -13359,7 +13391,7 @@ function sv() {
|
|
|
13359
13391
|
textLinkMs: 0
|
|
13360
13392
|
};
|
|
13361
13393
|
}
|
|
13362
|
-
function
|
|
13394
|
+
function uv() {
|
|
13363
13395
|
return {
|
|
13364
13396
|
alternativeTargetCandidateCount: 0,
|
|
13365
13397
|
getActiveArticlesByTextAndNumCount: 0,
|
|
@@ -13370,7 +13402,7 @@ function cv() {
|
|
|
13370
13402
|
uniqueFallbackCheckCount: 0
|
|
13371
13403
|
};
|
|
13372
13404
|
}
|
|
13373
|
-
function
|
|
13405
|
+
function dv(e, t, n, r, i) {
|
|
13374
13406
|
let a = e.get(t);
|
|
13375
13407
|
a === void 0 && (a = /* @__PURE__ */ new Map(), e.set(t, a));
|
|
13376
13408
|
let o = a.get(n) ?? {
|
|
@@ -13380,7 +13412,7 @@ function lv(e, t, n, r, i) {
|
|
|
13380
13412
|
};
|
|
13381
13413
|
o.count += 1, o.outputSize += i, o.totalMs += r, a.set(n, o);
|
|
13382
13414
|
}
|
|
13383
|
-
function
|
|
13415
|
+
function fv(e) {
|
|
13384
13416
|
return Object.fromEntries([...e.entries()].map(([e, t]) => {
|
|
13385
13417
|
let n = 0, r = 0, i = 0;
|
|
13386
13418
|
for (let e of t.values()) n += e.count, r += e.outputSize, i += e.totalMs;
|
|
@@ -13398,7 +13430,7 @@ function uv(e) {
|
|
|
13398
13430
|
}];
|
|
13399
13431
|
}));
|
|
13400
13432
|
}
|
|
13401
|
-
var
|
|
13433
|
+
var pv = class {
|
|
13402
13434
|
inner;
|
|
13403
13435
|
diagnostics;
|
|
13404
13436
|
constructor(e, t) {
|
|
@@ -13406,67 +13438,67 @@ var dv = class {
|
|
|
13406
13438
|
}
|
|
13407
13439
|
async getActiveArticlesByTextAndNum(e) {
|
|
13408
13440
|
let t = performance.now(), n = await this.inner.getActiveArticlesByTextAndNum(e);
|
|
13409
|
-
return
|
|
13441
|
+
return dv(this.diagnostics, "getActiveArticlesByTextAndNum", `${e.date}\0${e.textId}\0${e.num ?? ""}`, performance.now() - t, n.length), n;
|
|
13410
13442
|
}
|
|
13411
13443
|
async getArticleHistoryInfo(e) {
|
|
13412
13444
|
let t = performance.now(), n = await this.inner.getArticleHistoryInfo(e);
|
|
13413
|
-
return
|
|
13445
|
+
return dv(this.diagnostics, "getArticleHistoryInfo", `${e.textId}\0${e.num ?? ""}`, performance.now() - t, n === void 0 ? 0 : 1), n;
|
|
13414
13446
|
}
|
|
13415
13447
|
async getDirectSectionChildren(e) {
|
|
13416
13448
|
let t = performance.now(), n = await this.inner.getDirectSectionChildren(e);
|
|
13417
|
-
return
|
|
13449
|
+
return dv(this.diagnostics, "getDirectSectionChildren", `${e.date}\0${e.parentPath}`, performance.now() - t, n.length), n;
|
|
13418
13450
|
}
|
|
13419
13451
|
async getEuropeanTextUrl(e) {
|
|
13420
13452
|
let t = performance.now(), n = await this.inner.getEuropeanTextUrl(e);
|
|
13421
|
-
return
|
|
13453
|
+
return dv(this.diagnostics, "getEuropeanTextUrl", e, performance.now() - t, n === void 0 ? 0 : 1), n;
|
|
13422
13454
|
}
|
|
13423
13455
|
async getTextIdFromSegmentId(e) {
|
|
13424
13456
|
let t = performance.now(), n = await this.inner.getTextIdFromSegmentId(e);
|
|
13425
|
-
return
|
|
13457
|
+
return dv(this.diagnostics, "getTextIdFromSegmentId", e, performance.now() - t, n === void 0 ? 0 : 1), n;
|
|
13426
13458
|
}
|
|
13427
13459
|
async getUniqueActiveArticlesByNum(e) {
|
|
13428
13460
|
let t = performance.now(), n = await this.inner.getUniqueActiveArticlesByNum(e);
|
|
13429
|
-
return
|
|
13461
|
+
return dv(this.diagnostics, "getUniqueActiveArticlesByNum", `${e.date}\0${e.num ?? ""}`, performance.now() - t, n.length), n;
|
|
13430
13462
|
}
|
|
13431
13463
|
async preloadActiveArticlesByTextIds(e) {
|
|
13432
13464
|
let t = [...e.nums ?? []].filter((e) => e !== void 0).toSorted(), n = [...e.textIds].filter((e) => e !== void 0).toSorted(), r = performance.now();
|
|
13433
|
-
await this.inner.preloadActiveArticlesByTextIds(e),
|
|
13465
|
+
await this.inner.preloadActiveArticlesByTextIds(e), dv(this.diagnostics, "preloadActiveArticlesByTextIds", `${e.date}\0texts=${n.length}\0nums=${t.length}`, performance.now() - r, n.length * Math.max(1, t.length));
|
|
13434
13466
|
}
|
|
13435
13467
|
async preloadTextTitlesInfos(e) {
|
|
13436
13468
|
let t = performance.now();
|
|
13437
|
-
await this.inner.preloadTextTitlesInfos(e),
|
|
13469
|
+
await this.inner.preloadTextTitlesInfos(e), dv(this.diagnostics, "preloadTextTitlesInfos", "all", performance.now() - t, 1);
|
|
13438
13470
|
}
|
|
13439
13471
|
async preloadUniqueActiveArticlesByNums(e) {
|
|
13440
13472
|
let t = [...e.nums].filter((e) => e !== void 0).toSorted(), n = performance.now();
|
|
13441
13473
|
await this.inner.preloadUniqueActiveArticlesByNums({
|
|
13442
13474
|
...e,
|
|
13443
13475
|
nums: t
|
|
13444
|
-
}),
|
|
13476
|
+
}), dv(this.diagnostics, "preloadUniqueActiveArticlesByNums", `${e.date}\0nums=${t.length}`, performance.now() - n, t.length);
|
|
13445
13477
|
}
|
|
13446
13478
|
};
|
|
13447
13479
|
function $(e, t, n) {
|
|
13448
13480
|
e[t] += Math.round((performance.now() - n) * 10) / 10;
|
|
13449
13481
|
}
|
|
13450
|
-
function
|
|
13482
|
+
function mv(e) {
|
|
13451
13483
|
let t = {};
|
|
13452
13484
|
for (let n of e) t[n.type] = (t[n.type] ?? 0) + 1;
|
|
13453
13485
|
return t;
|
|
13454
13486
|
}
|
|
13455
|
-
function
|
|
13487
|
+
function hv(e, t = 20) {
|
|
13456
13488
|
return Object.entries(e).map(([e, t]) => ({
|
|
13457
13489
|
count: t,
|
|
13458
13490
|
value: e
|
|
13459
13491
|
})).toSorted((e, t) => t.count - e.count).slice(0, t);
|
|
13460
13492
|
}
|
|
13461
|
-
async function*
|
|
13462
|
-
let l = r ?? (e === void 0 ? void 0 : new
|
|
13493
|
+
async function* gv({ canutesDb: e, context: t, date: n, legiResolver: r, logIgnoredReferencesTypes: i, logPartialReferences: a, logReferences: o, state: s, transformation: c }) {
|
|
13494
|
+
let l = r ?? (e === void 0 ? void 0 : new sv(e));
|
|
13463
13495
|
if (l === void 0) throw Error("A Canutes database or legal resolver is required");
|
|
13464
|
-
let u = new Ee("extractTextLinks"), d = /* @__PURE__ */ new Map(), f = u.enabled ? new
|
|
13496
|
+
let u = new Ee("extractTextLinks"), d = /* @__PURE__ */ new Map(), f = u.enabled ? new pv(l, d) : l, p = cv(), m = lv(), h = uv(), _ = {}, v = c === void 0 ? void 0 : g(c), y = s === void 0 ? {} : structuredClone(s), b = u.timeSync("extractReferences", () => {
|
|
13465
13497
|
let e = [];
|
|
13466
|
-
for (let n of c === void 0 ?
|
|
13498
|
+
for (let n of c === void 0 ? Zm(t, { diagnostics: p }) : $m(t, c, { diagnostics: p })) o && console.log(`In "${t.input.slice(n.position.start, n.position.stop)}": \nReference "${t.text(n.position)}": ${JSON.stringify(n, null, 2)}`), e.push(n);
|
|
13467
13499
|
return e;
|
|
13468
13500
|
}, { inputSize: t.input.length }), ee = performance.now();
|
|
13469
|
-
for (let e of b) for (let n of
|
|
13501
|
+
for (let e of b) for (let n of Lv(t, e)) {
|
|
13470
13502
|
let r = n.type === "parent-enfant" ? n.parent : n;
|
|
13471
13503
|
switch (r.type) {
|
|
13472
13504
|
case "alinéa":
|
|
@@ -13495,7 +13527,7 @@ async function* mv({ canutesDb: e, context: t, date: n, legiResolver: r, logIgno
|
|
|
13495
13527
|
r.definition && y.textId === void 0 && a && console.log(`In "${t.input.slice(e.position.start, e.position.stop)}": Missing state.textId for division definition`);
|
|
13496
13528
|
break;
|
|
13497
13529
|
case "texte":
|
|
13498
|
-
|
|
13530
|
+
_v({
|
|
13499
13531
|
context: t,
|
|
13500
13532
|
logPartialReferences: a,
|
|
13501
13533
|
reference: e,
|
|
@@ -13511,14 +13543,14 @@ async function* mv({ canutesDb: e, context: t, date: n, legiResolver: r, logIgno
|
|
|
13511
13543
|
phase: "collectDefinitionsAndTextState"
|
|
13512
13544
|
});
|
|
13513
13545
|
let te = /* @__PURE__ */ new Set();
|
|
13514
|
-
for (let e of b) for (let t of
|
|
13515
|
-
let ne =
|
|
13546
|
+
for (let e of b) for (let t of Iv(e, { citations: !0 })) te.add(t);
|
|
13547
|
+
let ne = vv(t, b);
|
|
13516
13548
|
await u.time("preloadActiveArticlesByTextIds", () => f.preloadActiveArticlesByTextIds({
|
|
13517
13549
|
date: n,
|
|
13518
13550
|
nums: te,
|
|
13519
13551
|
textIds: ne
|
|
13520
13552
|
}), { count: ne.size });
|
|
13521
|
-
let x = await u.time("collectUniqueFallbackArticleNums", () =>
|
|
13553
|
+
let x = await u.time("collectUniqueFallbackArticleNums", () => yv({
|
|
13522
13554
|
context: t,
|
|
13523
13555
|
date: n,
|
|
13524
13556
|
legiResolver: f,
|
|
@@ -13532,7 +13564,7 @@ async function* mv({ canutesDb: e, context: t, date: n, legiResolver: r, logIgno
|
|
|
13532
13564
|
nums: x
|
|
13533
13565
|
}), { count: x.size }), y = s === void 0 ? {} : s;
|
|
13534
13566
|
let re = 0, ie = performance.now();
|
|
13535
|
-
for (let e of b) for await (let r of
|
|
13567
|
+
for (let e of b) for await (let r of Hv({
|
|
13536
13568
|
articleDefinitionByNumByTextId: _,
|
|
13537
13569
|
legiResolver: f,
|
|
13538
13570
|
context: t,
|
|
@@ -13551,12 +13583,12 @@ async function* mv({ canutesDb: e, context: t, date: n, legiResolver: r, logIgno
|
|
|
13551
13583
|
phase: "iterReferenceLinks"
|
|
13552
13584
|
}), u.log({
|
|
13553
13585
|
articleNumCount: te.size,
|
|
13554
|
-
referenceTypeCounts:
|
|
13586
|
+
referenceTypeCounts: mv(b),
|
|
13555
13587
|
referenceCount: b.length,
|
|
13556
13588
|
iterationDiagnostics: m,
|
|
13557
|
-
resolverCallDiagnostics:
|
|
13589
|
+
resolverCallDiagnostics: fv(d),
|
|
13558
13590
|
resolverDiagnostics: h,
|
|
13559
|
-
topFastPathAnchors:
|
|
13591
|
+
topFastPathAnchors: hv(p.fastPath.anchorCounts),
|
|
13560
13592
|
uniqueFallbackArticleNumCount: x.size,
|
|
13561
13593
|
fastPathCandidateCount: p.fastPath.candidateCount,
|
|
13562
13594
|
fastPathCheckedOffsetCount: p.fastPath.checkedOffsetCount,
|
|
@@ -13570,7 +13602,7 @@ async function* mv({ canutesDb: e, context: t, date: n, legiResolver: r, logIgno
|
|
|
13570
13602
|
extractReferencesCitationCount: p.citationCount
|
|
13571
13603
|
});
|
|
13572
13604
|
}
|
|
13573
|
-
function
|
|
13605
|
+
function _v({ context: e, logPartialReferences: t, reference: n, state: r, text: i }) {
|
|
13574
13606
|
switch (i.nature) {
|
|
13575
13607
|
case "ARRETE":
|
|
13576
13608
|
case "CIRCULAIRE":
|
|
@@ -13641,17 +13673,17 @@ function hv({ context: e, logPartialReferences: t, reference: n, state: r, text:
|
|
|
13641
13673
|
default: i.nature === void 0 ? delete r.textId : m("nature", i.nature);
|
|
13642
13674
|
}
|
|
13643
13675
|
}
|
|
13644
|
-
function
|
|
13676
|
+
function vv(e, t) {
|
|
13645
13677
|
let n = /* @__PURE__ */ new Set();
|
|
13646
|
-
for (let r of t) for (let t of
|
|
13678
|
+
for (let r of t) for (let t of Lv(e, r, { citations: !0 })) {
|
|
13647
13679
|
let e = t.type === "parent-enfant" ? t.parent : t;
|
|
13648
13680
|
e.type === "texte" && e.cid !== void 0 ? n.add(e.cid) : e.type === "article" && e.implicitText?.cid !== void 0 && n.add(e.implicitText.cid);
|
|
13649
13681
|
}
|
|
13650
13682
|
return n;
|
|
13651
13683
|
}
|
|
13652
|
-
async function
|
|
13684
|
+
async function yv({ context: e, date: t, legiResolver: n, logPartialReferences: r, resolverDiagnostics: i, references: a, state: o }) {
|
|
13653
13685
|
let s = /* @__PURE__ */ new Set();
|
|
13654
|
-
for (let c of a) await
|
|
13686
|
+
for (let c of a) await bv({
|
|
13655
13687
|
articleNums: s,
|
|
13656
13688
|
context: e,
|
|
13657
13689
|
date: t,
|
|
@@ -13663,8 +13695,8 @@ async function _v({ context: e, date: t, legiResolver: n, logPartialReferences:
|
|
|
13663
13695
|
});
|
|
13664
13696
|
return s;
|
|
13665
13697
|
}
|
|
13666
|
-
async function
|
|
13667
|
-
for (let c of
|
|
13698
|
+
async function bv({ articleNums: e, context: t, date: n, legiResolver: r, logPartialReferences: i, resolverDiagnostics: a, reference: o, state: s }) {
|
|
13699
|
+
for (let c of Lv(t, o)) await xv({
|
|
13668
13700
|
articleNums: e,
|
|
13669
13701
|
atomicOrParentChildReference: c,
|
|
13670
13702
|
context: t,
|
|
@@ -13680,7 +13712,7 @@ async function vv({ articleNums: e, context: t, date: n, legiResolver: r, logPar
|
|
|
13680
13712
|
if (c !== void 0) {
|
|
13681
13713
|
for (let o of c) if (o.references !== void 0) {
|
|
13682
13714
|
let c = structuredClone(s);
|
|
13683
|
-
for (let s of o.references) await
|
|
13715
|
+
for (let s of o.references) await bv({
|
|
13684
13716
|
articleNums: e,
|
|
13685
13717
|
context: t,
|
|
13686
13718
|
date: n,
|
|
@@ -13694,7 +13726,7 @@ async function vv({ articleNums: e, context: t, date: n, legiResolver: r, logPar
|
|
|
13694
13726
|
}
|
|
13695
13727
|
}
|
|
13696
13728
|
}
|
|
13697
|
-
async function
|
|
13729
|
+
async function xv({ articleNums: e, atomicOrParentChildReference: t, context: n, date: r, legiResolver: i, logPartialReferences: a, resolverDiagnostics: o, reference: s, state: c }) {
|
|
13698
13730
|
let l = t.type === "parent-enfant" ? t.parent : t, u = t.type === "parent-enfant" ? t : void 0;
|
|
13699
13731
|
switch (l.type) {
|
|
13700
13732
|
case "alinéa":
|
|
@@ -13703,7 +13735,7 @@ async function yv({ articleNums: e, atomicOrParentChildReference: t, context: n,
|
|
|
13703
13735
|
case "phrase": break;
|
|
13704
13736
|
case "article":
|
|
13705
13737
|
if (l.definition && c.textId !== void 0) break;
|
|
13706
|
-
await
|
|
13738
|
+
await Pv({
|
|
13707
13739
|
article: l,
|
|
13708
13740
|
date: r,
|
|
13709
13741
|
legiResolver: i,
|
|
@@ -13722,7 +13754,7 @@ async function yv({ articleNums: e, atomicOrParentChildReference: t, context: n,
|
|
|
13722
13754
|
case "sous-titre":
|
|
13723
13755
|
case "titre":
|
|
13724
13756
|
if (l.definition && c.textId !== void 0) break;
|
|
13725
|
-
u !== void 0 && await
|
|
13757
|
+
u !== void 0 && await bv({
|
|
13726
13758
|
articleNums: e,
|
|
13727
13759
|
context: n,
|
|
13728
13760
|
date: r,
|
|
@@ -13734,13 +13766,13 @@ async function yv({ articleNums: e, atomicOrParentChildReference: t, context: n,
|
|
|
13734
13766
|
});
|
|
13735
13767
|
break;
|
|
13736
13768
|
case "texte":
|
|
13737
|
-
|
|
13769
|
+
_v({
|
|
13738
13770
|
context: n,
|
|
13739
13771
|
logPartialReferences: a,
|
|
13740
13772
|
reference: s,
|
|
13741
13773
|
state: c,
|
|
13742
13774
|
text: l
|
|
13743
|
-
}), u !== void 0 && await
|
|
13775
|
+
}), u !== void 0 && await bv({
|
|
13744
13776
|
articleNums: e,
|
|
13745
13777
|
context: n,
|
|
13746
13778
|
date: r,
|
|
@@ -13754,14 +13786,14 @@ async function yv({ articleNums: e, atomicOrParentChildReference: t, context: n,
|
|
|
13754
13786
|
default: break;
|
|
13755
13787
|
}
|
|
13756
13788
|
}
|
|
13757
|
-
var
|
|
13789
|
+
var Sv = new Set([
|
|
13758
13790
|
"LEGITEXT000005634379",
|
|
13759
13791
|
"LEGITEXT000006069583",
|
|
13760
13792
|
"LEGITEXT000006070933",
|
|
13761
13793
|
"LEGITEXT000006072026",
|
|
13762
13794
|
"LEGITEXT000006073984",
|
|
13763
13795
|
"LEGITEXT000006074096"
|
|
13764
|
-
]),
|
|
13796
|
+
]), Cv = new Set([
|
|
13765
13797
|
"LEGITEXT000006069568",
|
|
13766
13798
|
"LEGITEXT000006069569",
|
|
13767
13799
|
"LEGITEXT000006069574",
|
|
@@ -13769,41 +13801,41 @@ var bv = new Set([
|
|
|
13769
13801
|
"LEGITEXT000006069577",
|
|
13770
13802
|
"LEGITEXT000006069583"
|
|
13771
13803
|
]);
|
|
13772
|
-
function
|
|
13804
|
+
function wv(e, t, n) {
|
|
13773
13805
|
let r = n.replace(/\s+/gu, " ").trim();
|
|
13774
13806
|
r !== "" && r !== t && e.add(r);
|
|
13775
13807
|
}
|
|
13776
|
-
function
|
|
13808
|
+
function Tv(e, t) {
|
|
13777
13809
|
let n = new Set([e]), r = new Set([e]);
|
|
13778
13810
|
for (let i = 0; i < 3; i++) {
|
|
13779
13811
|
let i = /* @__PURE__ */ new Set();
|
|
13780
13812
|
for (let a of r) {
|
|
13781
13813
|
let r = /* @__PURE__ */ new Set();
|
|
13782
|
-
|
|
13783
|
-
for (let t of a.matchAll(/-(?=\p{L})/gu))
|
|
13784
|
-
|
|
13814
|
+
wv(r, e, a.replace(/\s*-\s*/gu, "-")), wv(r, e, a.replace(/^(R\*)\s*(\d)/u, "$1 $2")), t === "LEGITEXT000006069583" && (wv(r, e, a.replace(/^(R)(\d)/u, "$1*$2")), wv(r, e, a.replace(/^(R)(\d)/u, "$1* $2"))), wv(r, e, a.replace(/^R\*/u, "*R")), wv(r, e, a.replace(/^R\*/u, "R"));
|
|
13815
|
+
for (let t of a.matchAll(/-(?=\p{L})/gu)) wv(r, e, `${a.slice(0, t.index)} ${a.slice(t.index + 1)}`);
|
|
13816
|
+
wv(r, e, a.replace(/-O(?=\p{L}|\s|$)/gu, "-0")), wv(r, e, a.replace(/-0(?=\p{L})/gu, "-0 "));
|
|
13785
13817
|
let o = a.match(/^((?:L\s*O|[LRDA])\*?\s*)(\d{4,})$/u);
|
|
13786
13818
|
if (o !== null) {
|
|
13787
13819
|
let [, t, n] = o;
|
|
13788
|
-
for (let i = 2; i < n.length; i++)
|
|
13820
|
+
for (let i = 2; i < n.length; i++) wv(r, e, `${t}${n.slice(0, i)}-${n.slice(i)}`);
|
|
13789
13821
|
}
|
|
13790
|
-
if (/^(?:L\s*O|[LRDA])\*?/u.test(a) &&
|
|
13822
|
+
if (/^(?:L\s*O|[LRDA])\*?/u.test(a) && wv(r, e, a.replace(/\s+(\d+)$/u, "-$1")), t === "LEGITEXT000006069576" && /^0\d+$/u.test(a) && wv(r, e, String(Number(a))), Sv.has(t) && /^\d/u.test(a)) for (let t of [
|
|
13791
13823
|
"L",
|
|
13792
13824
|
"R",
|
|
13793
13825
|
"D",
|
|
13794
13826
|
"A",
|
|
13795
13827
|
"R*",
|
|
13796
13828
|
"*R"
|
|
13797
|
-
])
|
|
13798
|
-
|
|
13829
|
+
]) wv(r, e, `${t}${a}`);
|
|
13830
|
+
wv(r, e, a.replace(/(\d)\s+0(?=\s*-?\s*\p{L})/gu, "$1-0")), wv(r, e, a.replace(/(\p{L})\s+(\d{2})-([\p{L}])$/u, "$1-$2 $3"));
|
|
13799
13831
|
for (let e of r) n.has(e) || (n.add(e), i.add(e));
|
|
13800
13832
|
}
|
|
13801
13833
|
r = i;
|
|
13802
13834
|
}
|
|
13803
13835
|
return n.delete(e), [...n];
|
|
13804
13836
|
}
|
|
13805
|
-
function
|
|
13806
|
-
if (!
|
|
13837
|
+
function Ev(e, t) {
|
|
13838
|
+
if (!Cv.has(t)) return [];
|
|
13807
13839
|
let n = [], r = e;
|
|
13808
13840
|
for (let e = 0; e < 4; e++) {
|
|
13809
13841
|
let e = r.replace(/(?:\s*-\s*|\s+)(?:[IVX]+|[1-9]\d*)(?:\s+(?:bis|ter|quater|quinquies|sexies))?$/iu, "").trim();
|
|
@@ -13812,10 +13844,10 @@ function wv(e, t) {
|
|
|
13812
13844
|
}
|
|
13813
13845
|
return n;
|
|
13814
13846
|
}
|
|
13815
|
-
function
|
|
13847
|
+
function Dv(e, t) {
|
|
13816
13848
|
return `${e}\0${t}`;
|
|
13817
13849
|
}
|
|
13818
|
-
var
|
|
13850
|
+
var Ov = new Map([
|
|
13819
13851
|
...[
|
|
13820
13852
|
"1594 F quinquies A",
|
|
13821
13853
|
"1594 F quinquies-D",
|
|
@@ -13823,7 +13855,7 @@ var Ev = new Map([
|
|
|
13823
13855
|
"1594 F quinquies E II",
|
|
13824
13856
|
"1594 F quinquies- E-I",
|
|
13825
13857
|
"1594 F quinquies K"
|
|
13826
|
-
].map((e) => [
|
|
13858
|
+
].map((e) => [Dv("LEGITEXT000006069577", e), {
|
|
13827
13859
|
num: "1594 F quinquies",
|
|
13828
13860
|
textId: "LEGITEXT000006069577"
|
|
13829
13861
|
}]),
|
|
@@ -13832,7 +13864,7 @@ var Ev = new Map([
|
|
|
13832
13864
|
"1594-0 G-A",
|
|
13833
13865
|
"1594-0 G-A-II",
|
|
13834
13866
|
"1594-0 G-A-VI"
|
|
13835
|
-
].map((e) => [
|
|
13867
|
+
].map((e) => [Dv("LEGITEXT000006069577", e), {
|
|
13836
13868
|
num: "1594-0 G",
|
|
13837
13869
|
textId: "LEGITEXT000006069577"
|
|
13838
13870
|
}]),
|
|
@@ -13844,23 +13876,23 @@ var Ev = new Map([
|
|
|
13844
13876
|
["38 B", "LEGITEXT000006069574"],
|
|
13845
13877
|
["49 octies D", "LEGITEXT000006069574"],
|
|
13846
13878
|
["199-0", "LEGITEXT000006069576"]
|
|
13847
|
-
].map(([e, t]) => [
|
|
13879
|
+
].map(([e, t]) => [Dv("LEGITEXT000006069577", e), {
|
|
13848
13880
|
num: e,
|
|
13849
13881
|
textId: t
|
|
13850
13882
|
}]),
|
|
13851
|
-
[
|
|
13883
|
+
[Dv("LEGITEXT000006069577", "L173"), {
|
|
13852
13884
|
num: "173",
|
|
13853
13885
|
textId: "LEGITEXT000006069577"
|
|
13854
13886
|
}],
|
|
13855
|
-
[
|
|
13887
|
+
[Dv("LEGITEXT000006069583", "L38 B"), {
|
|
13856
13888
|
num: "L38",
|
|
13857
13889
|
textId: "LEGITEXT000006069583"
|
|
13858
13890
|
}],
|
|
13859
|
-
...["L311-13 C", "L311-13 D"].map((e) => [
|
|
13891
|
+
...["L311-13 C", "L311-13 D"].map((e) => [Dv("LEGITEXT000006070158", e), {
|
|
13860
13892
|
num: "L311-13",
|
|
13861
13893
|
textId: "LEGITEXT000006070158"
|
|
13862
13894
|
}]),
|
|
13863
|
-
[
|
|
13895
|
+
[Dv("LEGITEXT000006071154", "226-14"), {
|
|
13864
13896
|
num: "226-14",
|
|
13865
13897
|
textId: "LEGITEXT000006070719"
|
|
13866
13898
|
}],
|
|
@@ -13868,17 +13900,17 @@ var Ev = new Map([
|
|
|
13868
13900
|
"1300-1",
|
|
13869
13901
|
"1300-2",
|
|
13870
13902
|
"1300-4"
|
|
13871
|
-
].map((e) => [
|
|
13903
|
+
].map((e) => [Dv("LEGITEXT000006070721", e), {
|
|
13872
13904
|
num: e,
|
|
13873
13905
|
textId: "LEGITEXT000006070716"
|
|
13874
13906
|
}])
|
|
13875
|
-
]),
|
|
13876
|
-
[
|
|
13877
|
-
[
|
|
13878
|
-
[
|
|
13879
|
-
[
|
|
13907
|
+
]), kv = new Map([
|
|
13908
|
+
[Dv("LEGITEXT000006069574", "382-0 C bis"), "LEGIARTI000036256024"],
|
|
13909
|
+
[Dv("LEGITEXT000006069577", "1586 quinquies"), "LEGIARTI000023380915"],
|
|
13910
|
+
[Dv("LEGITEXT000006069577", "1681 sexies"), "LEGIARTI000037986425"],
|
|
13911
|
+
[Dv("LEGITEXT000006069577", "286"), "LEGIARTI000033815246"]
|
|
13880
13912
|
]);
|
|
13881
|
-
function
|
|
13913
|
+
function Av(e, t) {
|
|
13882
13914
|
let n = /* @__PURE__ */ new Map(), r = (t, r) => {
|
|
13883
13915
|
let i = r.replace(/[.·]/gu, "-").replace(/\s*-\s*/gu, "-").replace(/\s+/gu, "-").replace(/-{2,}/gu, "-").replace(/^-|-$/gu, "").replace(/-(?=\s)/gu, "").replace(/\s+/gu, " ").trim();
|
|
13884
13916
|
i === "" || i === e || !/^(?:[LRDA]\s*)?\d+(?:-\d+)*(?:\s+(?:bis|ter|quater|quinquies|sexies|septies))?$/iu.test(i) || n.set(`${t}\0${i}`, {
|
|
@@ -13887,12 +13919,12 @@ function Ov(e, t) {
|
|
|
13887
13919
|
});
|
|
13888
13920
|
}, i = /^(.*\d)\s*[,,;]?\s*(css|cgi|cibs|lpf|cch|cja|casf|cgct|coj|cpi|csp|ceseda|cmf|comofi|cpce)$/iu.exec(e);
|
|
13889
13921
|
if (i !== null) {
|
|
13890
|
-
let e =
|
|
13922
|
+
let e = om(i[2]);
|
|
13891
13923
|
e !== void 0 && r(e, i[1]);
|
|
13892
13924
|
}
|
|
13893
13925
|
let a = /^(.*\d)[\s,;]+(?:du\s+|de\s+la\s+|de\s+l')?(code\b[\w'\s]*)$/iu.exec(e);
|
|
13894
13926
|
if (a !== null) {
|
|
13895
|
-
let e =
|
|
13927
|
+
let e = om(a[2]);
|
|
13896
13928
|
e !== void 0 && r(e, a[1]);
|
|
13897
13929
|
}
|
|
13898
13930
|
t !== void 0 && r(t, e);
|
|
@@ -13912,18 +13944,18 @@ function Ov(e, t) {
|
|
|
13912
13944
|
});
|
|
13913
13945
|
return o;
|
|
13914
13946
|
}
|
|
13915
|
-
function
|
|
13916
|
-
let t = new Set(e.flatMap(({ num: e, textId: t }) => e === null || t === null ? [] : [
|
|
13947
|
+
function jv(e) {
|
|
13948
|
+
let t = new Set(e.flatMap(({ num: e, textId: t }) => e === null || t === null ? [] : [Dv(t, e)]));
|
|
13917
13949
|
if (t.size !== 1) return;
|
|
13918
|
-
let n =
|
|
13950
|
+
let n = kv.get([...t][0]);
|
|
13919
13951
|
if (n !== void 0) return e.find(({ id: e }) => e === n);
|
|
13920
13952
|
}
|
|
13921
|
-
function
|
|
13953
|
+
function Mv(e) {
|
|
13922
13954
|
if (e.length < 2) return;
|
|
13923
13955
|
let [t, ...n] = [...e].sort((e, t) => t.dateDebut.localeCompare(e.dateDebut));
|
|
13924
13956
|
if (!n.some(({ dateDebut: e }) => e >= t.dateDebut)) return t;
|
|
13925
13957
|
}
|
|
13926
|
-
async function
|
|
13958
|
+
async function Nv({ alternatives: e, date: t, legiResolver: n, resolverDiagnostics: r }) {
|
|
13927
13959
|
let i = [];
|
|
13928
13960
|
r.alternativeTargetCandidateCount += e.length;
|
|
13929
13961
|
for (let { num: a, textId: o } of e) {
|
|
@@ -13937,7 +13969,7 @@ async function jv({ alternatives: e, date: t, legiResolver: n, resolverDiagnosti
|
|
|
13937
13969
|
}
|
|
13938
13970
|
return i.length === 1 ? i[0] : [];
|
|
13939
13971
|
}
|
|
13940
|
-
async function
|
|
13972
|
+
async function Pv({ article: e, date: t, legiResolver: n, resolverDiagnostics: r, state: i }) {
|
|
13941
13973
|
if (r.uniqueFallbackCheckCount++, e.present || e.num === void 0) return !1;
|
|
13942
13974
|
let a = e.implicitText?.cid ?? i.textId;
|
|
13943
13975
|
return !(a !== void 0 && (r.getActiveArticlesByTextAndNumCount++, (await n.getActiveArticlesByTextAndNum({
|
|
@@ -13950,7 +13982,7 @@ async function Mv({ article: e, date: t, legiResolver: n, resolverDiagnostics: r
|
|
|
13950
13982
|
textId: i.defaultTextId
|
|
13951
13983
|
})).length > 0));
|
|
13952
13984
|
}
|
|
13953
|
-
async function*
|
|
13985
|
+
async function* Fv({ ancestors: e, article: t, legiResolver: n, context: r, date: i, logPartialReferences: a, originalPositionsFromTransformedIterator: o, reference: c, iterationDiagnostics: l, resolverDiagnostics: u, state: d }) {
|
|
13954
13986
|
let f = performance.now();
|
|
13955
13987
|
if (t.present) {
|
|
13956
13988
|
$(l, "articleLinkMs", f);
|
|
@@ -13969,10 +14001,10 @@ async function* Nv({ ancestors: e, article: t, legiResolver: n, context: r, date
|
|
|
13969
14001
|
}), $(l, "articleDirectLookupMs", e), p.length > 0 && (h = p);
|
|
13970
14002
|
}
|
|
13971
14003
|
if (p.length === 0 && t.num !== void 0 && m !== void 0) {
|
|
13972
|
-
let e =
|
|
14004
|
+
let e = Ov.get(Dv(m, t.num));
|
|
13973
14005
|
if (e !== void 0) {
|
|
13974
14006
|
let t = performance.now();
|
|
13975
|
-
p = await
|
|
14007
|
+
p = await Nv({
|
|
13976
14008
|
alternatives: [e],
|
|
13977
14009
|
date: i,
|
|
13978
14010
|
legiResolver: n,
|
|
@@ -13982,8 +14014,8 @@ async function* Nv({ ancestors: e, article: t, legiResolver: n, context: r, date
|
|
|
13982
14014
|
}
|
|
13983
14015
|
if (p.length === 0 && t.num !== void 0 && m !== void 0) {
|
|
13984
14016
|
let e = performance.now();
|
|
13985
|
-
p = await
|
|
13986
|
-
alternatives:
|
|
14017
|
+
p = await Nv({
|
|
14018
|
+
alternatives: Tv(t.num, m).map((e) => ({
|
|
13987
14019
|
num: e,
|
|
13988
14020
|
textId: m
|
|
13989
14021
|
})),
|
|
@@ -13994,8 +14026,8 @@ async function* Nv({ ancestors: e, article: t, legiResolver: n, context: r, date
|
|
|
13994
14026
|
}
|
|
13995
14027
|
if (p.length === 0 && t.num !== void 0 && m !== void 0) {
|
|
13996
14028
|
let e = performance.now();
|
|
13997
|
-
p = await
|
|
13998
|
-
alternatives:
|
|
14029
|
+
p = await Nv({
|
|
14030
|
+
alternatives: Ev(t.num, m).map((e) => ({
|
|
13999
14031
|
num: e,
|
|
14000
14032
|
textId: m
|
|
14001
14033
|
})),
|
|
@@ -14005,7 +14037,7 @@ async function* Nv({ ancestors: e, article: t, legiResolver: n, context: r, date
|
|
|
14005
14037
|
}), $(l, "articleFiscalParentLookupMs", e);
|
|
14006
14038
|
}
|
|
14007
14039
|
let g = [];
|
|
14008
|
-
if (p.length === 0 && t.num !== void 0 && (g =
|
|
14040
|
+
if (p.length === 0 && t.num !== void 0 && (g = Av(t.num, m), g.length > 0 && (p = await Nv({
|
|
14009
14041
|
alternatives: g,
|
|
14010
14042
|
date: i,
|
|
14011
14043
|
legiResolver: n,
|
|
@@ -14034,10 +14066,10 @@ async function* Nv({ ancestors: e, article: t, legiResolver: n, context: r, date
|
|
|
14034
14066
|
if (n.length === 1) d.articleId = n[0].id;
|
|
14035
14067
|
else {
|
|
14036
14068
|
n.length !== 0 && (p = n);
|
|
14037
|
-
let e =
|
|
14069
|
+
let e = jv(p);
|
|
14038
14070
|
if (e !== void 0) d.articleId = e.id;
|
|
14039
14071
|
else {
|
|
14040
|
-
let e =
|
|
14072
|
+
let e = Mv(p.filter(({ dateDebut: e, dateFin: t }) => e <= i && t > i));
|
|
14041
14073
|
e === void 0 ? (n = p.filter(({ id: e }) => !d.textId?.startsWith("JORF") || e.startsWith("JORF")), n.length === 1 ? d.articleId = n[0].id : (n.length !== 0 && (p = n), a && console.warn(`In "${r.input.slice(t.position.start, t.position.stop)}": Unable to filter article ${t.num ?? null} of text ${d.textId ?? null} among IDs ${JSON.stringify(p.map(({ id: e }) => e), null, 2)} for reference ${JSON.stringify(t, null, 2)}`), delete d.articleId)) : d.articleId = e.id;
|
|
14042
14074
|
}
|
|
14043
14075
|
}
|
|
@@ -14066,7 +14098,7 @@ async function* Nv({ ancestors: e, article: t, legiResolver: n, context: r, date
|
|
|
14066
14098
|
});
|
|
14067
14099
|
$(l, "articleHistoryLookupMs", e), r !== void 0 && (v = r.articleId);
|
|
14068
14100
|
} else if (h.length === 0 && m !== void 0 && g.length !== 1) {
|
|
14069
|
-
let e = [], r = new Set([...
|
|
14101
|
+
let e = [], r = new Set([...Ev(t.num, m), ...Tv(t.num, m)]);
|
|
14070
14102
|
for (let t of r) {
|
|
14071
14103
|
u.getActiveArticlesByTextAndNumCount++;
|
|
14072
14104
|
let r = performance.now(), a = await n.getActiveArticlesByTextAndNum({
|
|
@@ -14102,91 +14134,91 @@ async function* Nv({ ancestors: e, article: t, legiResolver: n, context: r, date
|
|
|
14102
14134
|
type: "external_article"
|
|
14103
14135
|
}).filter(([, e]) => e !== void 0)), l.articleExternalLinkCount++, l.articleLinkCount++, $(l, "articleLinkMs", f);
|
|
14104
14136
|
}
|
|
14105
|
-
function*
|
|
14137
|
+
function* Iv(e, { citations: t = !1 } = {}) {
|
|
14106
14138
|
switch (e.type) {
|
|
14107
14139
|
case "article":
|
|
14108
14140
|
e.num !== void 0 && (yield e.num);
|
|
14109
14141
|
break;
|
|
14110
14142
|
case "bounded-interval":
|
|
14111
|
-
yield*
|
|
14143
|
+
yield* Iv(e.first, { citations: t }), yield* Iv(e.last, { citations: t });
|
|
14112
14144
|
break;
|
|
14113
14145
|
case "counted-interval":
|
|
14114
|
-
yield*
|
|
14146
|
+
yield* Iv(e.first, { citations: t });
|
|
14115
14147
|
break;
|
|
14116
14148
|
case "enumeration":
|
|
14117
14149
|
case "exclusion":
|
|
14118
|
-
yield*
|
|
14150
|
+
yield* Iv(e.left, { citations: t }), yield* Iv(e.right, { citations: t });
|
|
14119
14151
|
break;
|
|
14120
14152
|
case "parent-enfant":
|
|
14121
|
-
yield*
|
|
14153
|
+
yield* Iv(e.parent, { citations: t }), yield* Iv(e.child, { citations: t });
|
|
14122
14154
|
break;
|
|
14123
14155
|
case "reference_et_action":
|
|
14124
|
-
if (yield*
|
|
14156
|
+
if (yield* Iv(e.reference, { citations: t }), t) {
|
|
14125
14157
|
let { originalCitations: n } = e.action;
|
|
14126
14158
|
if (n !== void 0) {
|
|
14127
|
-
for (let e of n) if (e.references !== void 0) for (let n of e.references) yield*
|
|
14159
|
+
for (let e of n) if (e.references !== void 0) for (let n of e.references) yield* Iv(n, { citations: t });
|
|
14128
14160
|
}
|
|
14129
14161
|
}
|
|
14130
14162
|
break;
|
|
14131
14163
|
}
|
|
14132
14164
|
}
|
|
14133
|
-
function*
|
|
14165
|
+
function* Lv(e, t, { citations: n = !1 } = {}) {
|
|
14134
14166
|
switch (t.type) {
|
|
14135
14167
|
case "bounded-interval":
|
|
14136
|
-
yield*
|
|
14168
|
+
yield* Lv(e, t.first, { citations: n }), yield* Lv(e, t.last, { citations: n });
|
|
14137
14169
|
break;
|
|
14138
14170
|
case "counted-interval":
|
|
14139
|
-
yield*
|
|
14171
|
+
yield* Lv(e, t.first, { citations: n });
|
|
14140
14172
|
break;
|
|
14141
14173
|
case "enumeration":
|
|
14142
14174
|
case "exclusion":
|
|
14143
|
-
yield*
|
|
14175
|
+
yield* Lv(e, t.left, { citations: n }), yield* Lv(e, t.right, { citations: n });
|
|
14144
14176
|
break;
|
|
14145
14177
|
case "reference_et_action":
|
|
14146
|
-
if (yield*
|
|
14178
|
+
if (yield* Lv(e, t.reference, { citations: n }), n) {
|
|
14147
14179
|
let { originalCitations: r } = t.action;
|
|
14148
14180
|
if (r !== void 0) {
|
|
14149
|
-
for (let t of r) if (t.references !== void 0) for (let r of t.references) yield*
|
|
14181
|
+
for (let t of r) if (t.references !== void 0) for (let r of t.references) yield* Lv(e, r, { citations: n });
|
|
14150
14182
|
}
|
|
14151
14183
|
}
|
|
14152
14184
|
break;
|
|
14153
14185
|
default: yield t;
|
|
14154
14186
|
}
|
|
14155
14187
|
}
|
|
14156
|
-
function*
|
|
14188
|
+
function* Rv(e, t) {
|
|
14157
14189
|
if (t.type === "texte") console.error(`iterDeepestDivisionsOrArticles must not be called with a text:\n${JSON.stringify(t, null, 2)}`);
|
|
14158
14190
|
else if (ft(t) || t.type === "article") yield t;
|
|
14159
14191
|
else if (!(pt(t) || t.type === "incomplete-header")) switch (t.type) {
|
|
14160
14192
|
case "bounded-interval":
|
|
14161
|
-
yield*
|
|
14193
|
+
yield* Rv(e, t.first), yield* Rv(e, t.last);
|
|
14162
14194
|
break;
|
|
14163
14195
|
case "counted-interval":
|
|
14164
|
-
yield*
|
|
14196
|
+
yield* Rv(e, t.first);
|
|
14165
14197
|
break;
|
|
14166
14198
|
case "enumeration":
|
|
14167
14199
|
case "exclusion":
|
|
14168
|
-
yield*
|
|
14200
|
+
yield* Rv(e, t.left), yield* Rv(e, t.right);
|
|
14169
14201
|
break;
|
|
14170
14202
|
case "parent-enfant": {
|
|
14171
|
-
let n = [...
|
|
14172
|
-
n.length === 0 ? yield*
|
|
14203
|
+
let n = [...Rv(e, t.child)];
|
|
14204
|
+
n.length === 0 ? yield* Rv(e, t.parent) : yield* n;
|
|
14173
14205
|
break;
|
|
14174
14206
|
}
|
|
14175
14207
|
case "reference_et_action": {
|
|
14176
|
-
yield*
|
|
14208
|
+
yield* Rv(e, t.reference);
|
|
14177
14209
|
let { originalCitations: n } = t.action;
|
|
14178
14210
|
if (n !== void 0) {
|
|
14179
|
-
for (let t of n) if (t.references !== void 0) for (let n of t.references) yield*
|
|
14211
|
+
for (let t of n) if (t.references !== void 0) for (let n of t.references) yield* Rv(e, n);
|
|
14180
14212
|
}
|
|
14181
14213
|
break;
|
|
14182
14214
|
}
|
|
14183
14215
|
default: m("iterDeepestDivisionsOrArticles reference.type", t);
|
|
14184
14216
|
}
|
|
14185
14217
|
}
|
|
14186
|
-
function
|
|
14218
|
+
function zv(e) {
|
|
14187
14219
|
return e?.split(":")[0].trim().toLowerCase().split(/\s+/).map((e) => e.trim()).filter((e) => e !== "").join(" ");
|
|
14188
14220
|
}
|
|
14189
|
-
async function*
|
|
14221
|
+
async function* Bv({ ancestors: e, legiResolver: t, context: n, date: r, division: i, divisionChildReference: a, logIgnoredReferencesTypes: o, logPartialReferences: c, originalPositionsFromTransformedIterator: l, parentSectionChildren: u, reference: d, iterationDiagnostics: f, resolverDiagnostics: p, state: m }) {
|
|
14190
14222
|
let h = performance.now();
|
|
14191
14223
|
if (i.present) {
|
|
14192
14224
|
$(f, "divisionLinkMs", h);
|
|
@@ -14203,20 +14235,20 @@ async function* Rv({ ancestors: e, legiResolver: t, context: n, date: r, divisio
|
|
|
14203
14235
|
}
|
|
14204
14236
|
if (u !== void 0) {
|
|
14205
14237
|
for (let e of u) {
|
|
14206
|
-
let t =
|
|
14238
|
+
let t = zv(e.title);
|
|
14207
14239
|
if (t !== void 0) {
|
|
14208
14240
|
let n = !1;
|
|
14209
|
-
if (i.index !== void 0 && (n =
|
|
14241
|
+
if (i.index !== void 0 && (n = Vv(i.type, i.index).some((e) => e === t)), !n && i.num !== void 0 && (n = `${i.type} ${i.num.toLowerCase()}` === t), n) {
|
|
14210
14242
|
g = e;
|
|
14211
14243
|
break;
|
|
14212
14244
|
}
|
|
14213
14245
|
}
|
|
14214
14246
|
}
|
|
14215
14247
|
if (g === void 0 && (g = u.find((e) => {
|
|
14216
|
-
let t =
|
|
14248
|
+
let t = zv(e.title)?.split(/\s+/);
|
|
14217
14249
|
return t !== void 0 && t.length === 2 && st.includes(t[0]) && t[1] === "législative";
|
|
14218
14250
|
}), g !== void 0)) {
|
|
14219
|
-
let e =
|
|
14251
|
+
let e = zv(g.title).split(/\s+/), t = {
|
|
14220
14252
|
start: i.position.stop,
|
|
14221
14253
|
stop: i.position.stop
|
|
14222
14254
|
}, n = l === void 0 ? void 0 : s(l, t), r = Object.fromEntries(Object.entries({
|
|
@@ -14234,8 +14266,8 @@ async function* Rv({ ancestors: e, legiResolver: t, context: n, date: r, divisio
|
|
|
14234
14266
|
}).filter(([, e]) => e !== void 0)), i = r;
|
|
14235
14267
|
}
|
|
14236
14268
|
}
|
|
14237
|
-
let _ = a === void 0 ? [] : [...
|
|
14238
|
-
if (a !== void 0) for (let s of
|
|
14269
|
+
let _ = a === void 0 ? [] : [...Rv(n, a.child)], v = 0;
|
|
14270
|
+
if (a !== void 0) for (let s of Lv(n, a.child)) {
|
|
14239
14271
|
let u = s.type === "parent-enfant" ? s.parent : s, h = s.type === "parent-enfant" ? s : void 0;
|
|
14240
14272
|
switch (u.type) {
|
|
14241
14273
|
case "alinéa":
|
|
@@ -14244,7 +14276,7 @@ async function* Rv({ ancestors: e, legiResolver: t, context: n, date: r, divisio
|
|
|
14244
14276
|
case "phrase": break;
|
|
14245
14277
|
case "article": {
|
|
14246
14278
|
let a = performance.now();
|
|
14247
|
-
for await (let a of
|
|
14279
|
+
for await (let a of Fv({
|
|
14248
14280
|
ancestors: _.length === 1 ? [...e ?? [], i] : void 0,
|
|
14249
14281
|
article: u,
|
|
14250
14282
|
legiResolver: t,
|
|
@@ -14280,7 +14312,7 @@ async function* Rv({ ancestors: e, legiResolver: t, context: n, date: r, divisio
|
|
|
14280
14312
|
}), $(f, "divisionDirectChildrenLookupMs", e);
|
|
14281
14313
|
}
|
|
14282
14314
|
let s = performance.now();
|
|
14283
|
-
for await (let s of
|
|
14315
|
+
for await (let s of Bv({
|
|
14284
14316
|
ancestors: _.length === 1 ? [...e ?? [], i] : void 0,
|
|
14285
14317
|
legiResolver: t,
|
|
14286
14318
|
context: n,
|
|
@@ -14322,7 +14354,7 @@ async function* Rv({ ancestors: e, legiResolver: t, context: n, date: r, divisio
|
|
|
14322
14354
|
}
|
|
14323
14355
|
$(f, "divisionLinkMs", h);
|
|
14324
14356
|
}
|
|
14325
|
-
function*
|
|
14357
|
+
function* Vv(e, t) {
|
|
14326
14358
|
let n = Math.floor(t), i = Math.floor((t - n) * 1e3);
|
|
14327
14359
|
if (i === 0) {
|
|
14328
14360
|
for (let t of r(n)) yield `${t.toLowerCase()} ${e}`;
|
|
@@ -14332,9 +14364,9 @@ function* zv(e, t) {
|
|
|
14332
14364
|
for (let r of ne(n)) yield `${e} ${t} ${r.toLowerCase()}`;
|
|
14333
14365
|
}
|
|
14334
14366
|
}
|
|
14335
|
-
async function*
|
|
14336
|
-
let f = e ?? {}, p = u ??
|
|
14337
|
-
for (let e of
|
|
14367
|
+
async function* Hv({ articleDefinitionByNumByTextId: e, legiResolver: t, context: n, date: r, logIgnoredReferencesTypes: i, logPartialReferences: a, originalPositionsFromTransformedIterator: o, reference: c, iterationDiagnostics: l, resolverDiagnostics: u, state: d }) {
|
|
14368
|
+
let f = e ?? {}, p = u ?? uv(), m = l ?? lv(), h = d === void 0 ? {} : d;
|
|
14369
|
+
for (let e of Lv(n, c)) {
|
|
14338
14370
|
let l = e.type === "parent-enfant" ? e.parent : e, u = e.type === "parent-enfant" ? e : void 0;
|
|
14339
14371
|
switch (l.type) {
|
|
14340
14372
|
case "alinéa":
|
|
@@ -14345,7 +14377,7 @@ async function* Bv({ articleDefinitionByNumByTextId: e, legiResolver: t, context
|
|
|
14345
14377
|
if (l.definition && h.textId !== void 0) {
|
|
14346
14378
|
let e = f[h.textId]?.[l.num];
|
|
14347
14379
|
e !== void 0 && (e.originalTransformation === void 0 && o !== void 0 && (e.originalTransformation = s(o, e.position)), yield e, m.articleDefinitionLinkCount++, m.articleLinkCount++);
|
|
14348
|
-
} else for await (let e of
|
|
14380
|
+
} else for await (let e of Fv({
|
|
14349
14381
|
article: l,
|
|
14350
14382
|
legiResolver: t,
|
|
14351
14383
|
context: n,
|
|
@@ -14368,7 +14400,7 @@ async function* Bv({ articleDefinitionByNumByTextId: e, legiResolver: t, context
|
|
|
14368
14400
|
case "sous-sous-paragraphe":
|
|
14369
14401
|
case "sous-titre":
|
|
14370
14402
|
case "titre":
|
|
14371
|
-
if (!(l.definition && h.textId !== void 0)) for await (let e of
|
|
14403
|
+
if (!(l.definition && h.textId !== void 0)) for await (let e of Bv({
|
|
14372
14404
|
legiResolver: t,
|
|
14373
14405
|
context: n,
|
|
14374
14406
|
date: r,
|
|
@@ -14385,15 +14417,15 @@ async function* Bv({ articleDefinitionByNumByTextId: e, legiResolver: t, context
|
|
|
14385
14417
|
break;
|
|
14386
14418
|
case "texte": {
|
|
14387
14419
|
let e = performance.now();
|
|
14388
|
-
|
|
14420
|
+
_v({
|
|
14389
14421
|
context: n,
|
|
14390
14422
|
logPartialReferences: a,
|
|
14391
14423
|
reference: c,
|
|
14392
14424
|
state: h,
|
|
14393
14425
|
text: l
|
|
14394
14426
|
});
|
|
14395
|
-
let d = u === void 0 ? [] : [...
|
|
14396
|
-
if (u !== void 0) for (let e of
|
|
14427
|
+
let d = u === void 0 ? [] : [...Rv(n, u.child)], f = 0;
|
|
14428
|
+
if (u !== void 0) for (let e of Lv(n, u.child)) {
|
|
14397
14429
|
let s = e.type === "parent-enfant" ? e.parent : e, g = e.type === "parent-enfant" ? e : void 0;
|
|
14398
14430
|
switch (s.type) {
|
|
14399
14431
|
case "alinéa":
|
|
@@ -14402,7 +14434,7 @@ async function* Bv({ articleDefinitionByNumByTextId: e, legiResolver: t, context
|
|
|
14402
14434
|
case "phrase": break;
|
|
14403
14435
|
case "article": {
|
|
14404
14436
|
let e = performance.now();
|
|
14405
|
-
for await (let e of
|
|
14437
|
+
for await (let e of Fv({
|
|
14406
14438
|
ancestors: d.length === 1 ? [l] : void 0,
|
|
14407
14439
|
article: s,
|
|
14408
14440
|
legiResolver: t,
|
|
@@ -14438,7 +14470,7 @@ async function* Bv({ articleDefinitionByNumByTextId: e, legiResolver: t, context
|
|
|
14438
14470
|
}), $(m, "divisionDirectChildrenLookupMs", n);
|
|
14439
14471
|
}
|
|
14440
14472
|
let u = performance.now();
|
|
14441
|
-
for await (let u of
|
|
14473
|
+
for await (let u of Bv({
|
|
14442
14474
|
ancestors: d.length === 1 ? [l] : void 0,
|
|
14443
14475
|
legiResolver: t,
|
|
14444
14476
|
context: n,
|
|
@@ -14498,7 +14530,7 @@ async function* Bv({ articleDefinitionByNumByTextId: e, legiResolver: t, context
|
|
|
14498
14530
|
for (let c of s.references) {
|
|
14499
14531
|
m.citationReferenceCount++;
|
|
14500
14532
|
let s = performance.now();
|
|
14501
|
-
for await (let s of
|
|
14533
|
+
for await (let s of Hv({
|
|
14502
14534
|
articleDefinitionByNumByTextId: f,
|
|
14503
14535
|
legiResolver: t,
|
|
14504
14536
|
context: n,
|
|
@@ -14519,13 +14551,13 @@ async function* Bv({ articleDefinitionByNumByTextId: e, legiResolver: t, context
|
|
|
14519
14551
|
}
|
|
14520
14552
|
//#endregion
|
|
14521
14553
|
//#region src/lib/extractors/table_of_contents.ts
|
|
14522
|
-
function
|
|
14554
|
+
function Uv(e) {
|
|
14523
14555
|
let t = e;
|
|
14524
14556
|
return t.items ?? [...t.articles ?? [], ...t.divisions ?? []];
|
|
14525
14557
|
}
|
|
14526
|
-
function*
|
|
14558
|
+
function* Wv({ context: e, tableOfContents: t, transformation: n }) {
|
|
14527
14559
|
let r = 0, i = g(n);
|
|
14528
|
-
for (let n of
|
|
14560
|
+
for (let n of Kv(t)) {
|
|
14529
14561
|
let t = n.line.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), a = RegExp(`^${t}$`, "m");
|
|
14530
14562
|
a.lastIndex = r;
|
|
14531
14563
|
let o = a.exec(e.input);
|
|
@@ -14537,7 +14569,7 @@ function* Hv({ context: e, tableOfContents: t, transformation: n }) {
|
|
|
14537
14569
|
u.originalTransformation = l, u.position = c, yield u, r = c.stop;
|
|
14538
14570
|
}
|
|
14539
14571
|
}
|
|
14540
|
-
function
|
|
14572
|
+
function Gv(e) {
|
|
14541
14573
|
let t = new x(e), n = { items: [] }, r = [];
|
|
14542
14574
|
for (let e of En(t)) if (ft(e)) {
|
|
14543
14575
|
let i = r.findIndex(({ type: t }) => t === e.type);
|
|
@@ -14555,14 +14587,20 @@ function Uv(e) {
|
|
|
14555
14587
|
else throw Error(`Unexpected type "${e.type}" in definition:\n${JSON.stringify(e, null, 2)}`);
|
|
14556
14588
|
return n;
|
|
14557
14589
|
}
|
|
14558
|
-
function*
|
|
14590
|
+
function* Kv(e) {
|
|
14559
14591
|
e.type !== void 0 && (yield e);
|
|
14560
|
-
for (let t of
|
|
14592
|
+
for (let t of Uv(e)) t.type === "article" ? yield t : yield* Kv(t);
|
|
14561
14593
|
}
|
|
14562
14594
|
//#endregion
|
|
14563
14595
|
//#region src/lib/links.ts
|
|
14564
|
-
var
|
|
14565
|
-
function
|
|
14596
|
+
var qv = ["Exploratrice", "Forgejo"];
|
|
14597
|
+
function Jv(e) {
|
|
14598
|
+
let t = /^articles?\s+(?:n°\s*)?((?:1er|\d+)(?:\s+(?:bis|ter|quater|quinquies|septies))?(?:[-.·\s]\d+)*)\s+(?:du|de\s+la|de\s+l'|des|au|à)\b/iu.exec(e);
|
|
14599
|
+
if (t === null) return;
|
|
14600
|
+
let n = t[1].replace(/^(\d+)er\b/iu, "$1").replace(/[.·\s]/gu, "-").replace(/-{2,}/gu, "-").replace(/^-|-$/gu, "");
|
|
14601
|
+
return /^\d+(?:-\d+)*(?:-(?:bis|ter|quater|quinquies|septies))?$/iu.test(n) ? n : void 0;
|
|
14602
|
+
}
|
|
14603
|
+
function Yv(e, t, n) {
|
|
14566
14604
|
if (n.match(qe) === null) throw Error(`Unknown ID format: ${n}`);
|
|
14567
14605
|
switch (e) {
|
|
14568
14606
|
case "Exploratrice": return new URL(`legifrance/articles/${n}/versions`, t).toString();
|
|
@@ -14570,7 +14608,7 @@ function Kv(e, t, n) {
|
|
|
14570
14608
|
default: m("urlFromArticleVersionsId linkType", e);
|
|
14571
14609
|
}
|
|
14572
14610
|
}
|
|
14573
|
-
function
|
|
14611
|
+
function Xv(e, t, n) {
|
|
14574
14612
|
let r = n.match(qe);
|
|
14575
14613
|
if (r === null) throw Error(`Unknown ID format: ${n}`);
|
|
14576
14614
|
switch (e) {
|
|
@@ -14591,19 +14629,19 @@ function qv(e, t, n) {
|
|
|
14591
14629
|
}
|
|
14592
14630
|
//#endregion
|
|
14593
14631
|
//#region src/lib/linkers/html.ts
|
|
14594
|
-
function
|
|
14632
|
+
function Zv(e, t) {
|
|
14595
14633
|
if (e !== void 0) return e;
|
|
14596
|
-
if (t !== void 0) return new
|
|
14634
|
+
if (t !== void 0) return new sv(t);
|
|
14597
14635
|
throw Error("A Canutes database or legal resolver is required");
|
|
14598
14636
|
}
|
|
14599
|
-
function
|
|
14637
|
+
function Qv(e, t) {
|
|
14600
14638
|
return t.type === "reference_et_action" ? JSON.stringify({
|
|
14601
14639
|
...e,
|
|
14602
14640
|
action: t.action
|
|
14603
14641
|
}) : JSON.stringify(e);
|
|
14604
14642
|
}
|
|
14605
|
-
async function
|
|
14606
|
-
let f = new Ee("addLinksToHtml"), p =
|
|
14643
|
+
async function $v({ canutesDb: e, legiResolver: t, date: n, html: r, linkBaseUrl: i, linkType: a, logIgnoredReferencesTypes: o, logPartialReferences: s, logReferences: c, onLink: l, previousContext: u, state: d }) {
|
|
14644
|
+
let f = new Ee("addLinksToHtml"), p = Zv(t, e);
|
|
14607
14645
|
await f.time("preloadTextTitlesInfos", () => p.preloadTextTitlesInfos());
|
|
14608
14646
|
let h = f.timeSync("simplifyHtml", () => v({ removeAWithHref: !0 })(r), {
|
|
14609
14647
|
inputSize: r.length,
|
|
@@ -14612,7 +14650,7 @@ async function Xv({ canutesDb: e, legiResolver: t, date: n, html: r, linkBaseUrl
|
|
|
14612
14650
|
g.currentArticle = u?.currentArticle, g.currentText = u?.currentText;
|
|
14613
14651
|
let _ = [], y = { value: 0 }, b = -1;
|
|
14614
14652
|
await f.time("extractTextLinks", async () => {
|
|
14615
|
-
for await (let e of
|
|
14653
|
+
for await (let e of gv({
|
|
14616
14654
|
legiResolver: p,
|
|
14617
14655
|
context: g,
|
|
14618
14656
|
date: n,
|
|
@@ -14625,7 +14663,7 @@ async function Xv({ canutesDb: e, legiResolver: t, date: n, html: r, linkBaseUrl
|
|
|
14625
14663
|
case "article_definition": {
|
|
14626
14664
|
let { article: t, originalTransformation: n, textId: i } = e;
|
|
14627
14665
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in article definition: ${JSON.stringify(e, null, 2)}`);
|
|
14628
|
-
|
|
14666
|
+
ty({
|
|
14629
14667
|
inputHtml: r,
|
|
14630
14668
|
originalTransformation: n,
|
|
14631
14669
|
output: { replacements: _ },
|
|
@@ -14638,10 +14676,10 @@ async function Xv({ canutesDb: e, legiResolver: t, date: n, html: r, linkBaseUrl
|
|
|
14638
14676
|
let { articleId: t, historyArticleId: n, originalTransformation: o } = e;
|
|
14639
14677
|
if (t === void 0 && n === void 0) break;
|
|
14640
14678
|
if (o === void 0) throw Error(`Missing originalTransformation attribute in external article link: ${JSON.stringify(e, null, 2)}`);
|
|
14641
|
-
let s = t === void 0 ?
|
|
14679
|
+
let s = t === void 0 ? Yv(a, i, n) : Xv(a, i, t);
|
|
14642
14680
|
if (s === void 0) break;
|
|
14643
14681
|
let c = t === void 0 ? `class="lien_article_historique" href="${s}" title="Versions de l'article"` : `class="lien_article_externe" href="${s}"`;
|
|
14644
|
-
|
|
14682
|
+
ty({
|
|
14645
14683
|
inputHtml: r,
|
|
14646
14684
|
originalTransformation: o,
|
|
14647
14685
|
output: { replacements: _ },
|
|
@@ -14654,29 +14692,56 @@ async function Xv({ canutesDb: e, legiResolver: t, date: n, html: r, linkBaseUrl
|
|
|
14654
14692
|
let { originalTransformation: t, sectionTaId: n } = e;
|
|
14655
14693
|
if (n !== void 0) {
|
|
14656
14694
|
if (t === void 0) throw Error(`Missing originalTransformation attribute in external division link: ${JSON.stringify(e, null, 2)}`);
|
|
14657
|
-
|
|
14695
|
+
ty({
|
|
14658
14696
|
inputHtml: r,
|
|
14659
14697
|
originalTransformation: t,
|
|
14660
14698
|
output: { replacements: _ },
|
|
14661
14699
|
replacementCounter: y,
|
|
14662
|
-
tagHtmlFromOriginal: (e) => `<a class="lien_division_externe" href="${
|
|
14700
|
+
tagHtmlFromOriginal: (e) => `<a class="lien_division_externe" href="${Xv(a, i, n)}">${e}</a>`
|
|
14663
14701
|
});
|
|
14664
14702
|
}
|
|
14665
14703
|
break;
|
|
14666
14704
|
}
|
|
14667
14705
|
case "external_text": {
|
|
14668
|
-
let { originalTransformation: t, text:
|
|
14669
|
-
if (
|
|
14670
|
-
|
|
14706
|
+
let { originalTransformation: t, text: o } = e;
|
|
14707
|
+
if (o.cid === void 0) {
|
|
14708
|
+
o.relative !== 0 && s && console.error(`Link to text "${g.text(o.position)}" without CID: ${JSON.stringify(o, null, 2)}`);
|
|
14671
14709
|
continue;
|
|
14672
14710
|
}
|
|
14673
14711
|
if (t === void 0) throw Error(`Missing originalTransformation attribute in external text link: ${JSON.stringify(e, null, 2)}`);
|
|
14674
|
-
|
|
14712
|
+
let c = Jv(g.text(o.position)), l, u;
|
|
14713
|
+
if (c !== void 0) {
|
|
14714
|
+
let e = await p.getActiveArticlesByTextAndNum({
|
|
14715
|
+
date: n,
|
|
14716
|
+
num: c,
|
|
14717
|
+
textId: o.cid
|
|
14718
|
+
}), t = e.filter(({ dateDebut: e, dateFin: t }) => e <= n && t > n);
|
|
14719
|
+
if (t.length === 1) l = t[0].id;
|
|
14720
|
+
else if (e.length > 0) {
|
|
14721
|
+
let e = await p.getArticleHistoryInfo({
|
|
14722
|
+
num: c,
|
|
14723
|
+
textId: o.cid
|
|
14724
|
+
});
|
|
14725
|
+
e !== void 0 && (u = e.articleId);
|
|
14726
|
+
}
|
|
14727
|
+
}
|
|
14728
|
+
if (l === void 0 && u === void 0) {
|
|
14729
|
+
ty({
|
|
14730
|
+
inputHtml: r,
|
|
14731
|
+
originalTransformation: t,
|
|
14732
|
+
output: { replacements: _ },
|
|
14733
|
+
replacementCounter: y,
|
|
14734
|
+
tagHtmlFromOriginal: (e) => `<a class="lien_texte_externe" href="${Xv(a, i, o.cid)}">${e}</a>`
|
|
14735
|
+
});
|
|
14736
|
+
break;
|
|
14737
|
+
}
|
|
14738
|
+
let d = l ?? u, f = l === void 0 ? `class="lien_article_historique" href="${Yv(a, i, d)}" title="Versions de l'article"` : `class="lien_article_externe" href="${Xv(a, i, d)}"`;
|
|
14739
|
+
ty({
|
|
14675
14740
|
inputHtml: r,
|
|
14676
14741
|
originalTransformation: t,
|
|
14677
14742
|
output: { replacements: _ },
|
|
14678
14743
|
replacementCounter: y,
|
|
14679
|
-
tagHtmlFromOriginal: (e) => `<a
|
|
14744
|
+
tagHtmlFromOriginal: (e) => `<a ${f}>${e}</a>`
|
|
14680
14745
|
});
|
|
14681
14746
|
break;
|
|
14682
14747
|
}
|
|
@@ -14684,7 +14749,7 @@ async function Xv({ canutesDb: e, legiResolver: t, date: n, html: r, linkBaseUrl
|
|
|
14684
14749
|
let { url: t, originalTransformation: n } = e;
|
|
14685
14750
|
if (t === void 0) continue;
|
|
14686
14751
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in european text link: ${JSON.stringify(e, null, 2)}`);
|
|
14687
|
-
|
|
14752
|
+
ty({
|
|
14688
14753
|
inputHtml: r,
|
|
14689
14754
|
originalTransformation: n,
|
|
14690
14755
|
output: { replacements: _ },
|
|
@@ -14696,7 +14761,7 @@ async function Xv({ canutesDb: e, legiResolver: t, date: n, html: r, linkBaseUrl
|
|
|
14696
14761
|
case "internal_article": {
|
|
14697
14762
|
let { definition: t, originalTransformation: n } = e;
|
|
14698
14763
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in internal article link: ${JSON.stringify(e, null, 2)}`);
|
|
14699
|
-
|
|
14764
|
+
ty({
|
|
14700
14765
|
inputHtml: r,
|
|
14701
14766
|
originalTransformation: n,
|
|
14702
14767
|
output: { replacements: _ },
|
|
@@ -14708,7 +14773,7 @@ async function Xv({ canutesDb: e, legiResolver: t, date: n, html: r, linkBaseUrl
|
|
|
14708
14773
|
default: m("Link", e);
|
|
14709
14774
|
}
|
|
14710
14775
|
}, { count: b + 1 });
|
|
14711
|
-
let ee = f.timeSync("applyHtmlReplacements", () =>
|
|
14776
|
+
let ee = f.timeSync("applyHtmlReplacements", () => ey(r, _), {
|
|
14712
14777
|
count: _.length,
|
|
14713
14778
|
inputSize: r.length
|
|
14714
14779
|
});
|
|
@@ -14720,13 +14785,13 @@ async function Xv({ canutesDb: e, legiResolver: t, date: n, html: r, linkBaseUrl
|
|
|
14720
14785
|
output: _.length === 0 ? null : ee
|
|
14721
14786
|
};
|
|
14722
14787
|
}
|
|
14723
|
-
function
|
|
14788
|
+
function ey(e, t) {
|
|
14724
14789
|
if (t.length === 0) return e;
|
|
14725
14790
|
let n = [], r = 0;
|
|
14726
14791
|
for (let i of t.toSorted((e, t) => e.start - t.start || e.stop - t.stop || e.order - t.order)) i.start < r || (n.push(e.slice(r, i.start)), n.push(i.replacement), r = i.stop);
|
|
14727
14792
|
return n.push(e.slice(r)), n.join("");
|
|
14728
14793
|
}
|
|
14729
|
-
function
|
|
14794
|
+
function ty({ inputHtml: e, originalTransformation: t, output: n, replacementCounter: r, tagHtmlFromOriginal: i }) {
|
|
14730
14795
|
let a = te(t, i(p(e, t, 0) ?? ""));
|
|
14731
14796
|
n.replacements.push({
|
|
14732
14797
|
order: r.value++,
|
|
@@ -14735,11 +14800,11 @@ function Qv({ inputHtml: e, originalTransformation: t, output: n, replacementCou
|
|
|
14735
14800
|
stop: t.position.stop
|
|
14736
14801
|
});
|
|
14737
14802
|
}
|
|
14738
|
-
function
|
|
14803
|
+
function ny({ attributes: e, inputHtml: t, originalTransformation: n, outputByType: r, replacementCounter: i }) {
|
|
14739
14804
|
let a = Object.entries(e).map(([e, t]) => `${e}="${tt(t, !0)}"`).join(" ");
|
|
14740
14805
|
for (let e of ["links", "links_or_references"]) {
|
|
14741
14806
|
let o = r[e];
|
|
14742
|
-
o !== void 0 &&
|
|
14807
|
+
o !== void 0 && ty({
|
|
14743
14808
|
inputHtml: t,
|
|
14744
14809
|
originalTransformation: n,
|
|
14745
14810
|
output: o,
|
|
@@ -14748,11 +14813,11 @@ function $v({ attributes: e, inputHtml: t, originalTransformation: n, outputByTy
|
|
|
14748
14813
|
});
|
|
14749
14814
|
}
|
|
14750
14815
|
}
|
|
14751
|
-
function
|
|
14816
|
+
function ry({ id: e, outputByType: t }) {
|
|
14752
14817
|
return t.references !== void 0 || e === void 0 && t.links_or_references !== void 0;
|
|
14753
14818
|
}
|
|
14754
|
-
async function
|
|
14755
|
-
let p =
|
|
14819
|
+
async function iy({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, htmlTransformation: i, inputHtml: a, linkBaseUrl: o, linkType: s, logIgnoredReferencesTypes: c, logPartialReferences: l, logReferences: u, outputTypes: d, referredLegifranceTextsInfos: f }) {
|
|
14820
|
+
let p = Zv(t, e);
|
|
14756
14821
|
await p.preloadTextTitlesInfos();
|
|
14757
14822
|
let h = new x(i.output), g = {}, _ = {};
|
|
14758
14823
|
for (let e of d) _[e] = {
|
|
@@ -14761,7 +14826,7 @@ async function ty({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, ht
|
|
|
14761
14826
|
replacements: []
|
|
14762
14827
|
};
|
|
14763
14828
|
let v = { value: 0 };
|
|
14764
|
-
for await (let e of
|
|
14829
|
+
for await (let e of gv({
|
|
14765
14830
|
legiResolver: p,
|
|
14766
14831
|
context: h,
|
|
14767
14832
|
date: n,
|
|
@@ -14774,7 +14839,7 @@ async function ty({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, ht
|
|
|
14774
14839
|
case "article_definition": {
|
|
14775
14840
|
let { article: t, originalTransformation: n, textId: r } = e;
|
|
14776
14841
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in article definition: ${JSON.stringify(e, null, 2)}`);
|
|
14777
|
-
for (let e of Object.values(_))
|
|
14842
|
+
for (let e of Object.values(_)) ty({
|
|
14778
14843
|
inputHtml: a,
|
|
14779
14844
|
originalTransformation: n,
|
|
14780
14845
|
output: e,
|
|
@@ -14787,10 +14852,10 @@ async function ty({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, ht
|
|
|
14787
14852
|
let { article: t, articleId: n, historyArticleId: r, originalTransformation: i } = e;
|
|
14788
14853
|
if (i === void 0) throw Error(`Missing originalTransformation attribute in external article link: ${JSON.stringify(e, null, 2)}`);
|
|
14789
14854
|
if (n !== void 0) {
|
|
14790
|
-
if (
|
|
14855
|
+
if (ny({
|
|
14791
14856
|
attributes: {
|
|
14792
14857
|
class: "lien_article_externe",
|
|
14793
|
-
href:
|
|
14858
|
+
href: Xv(s, o, n)
|
|
14794
14859
|
},
|
|
14795
14860
|
inputHtml: a,
|
|
14796
14861
|
originalTransformation: i,
|
|
@@ -14801,8 +14866,8 @@ async function ty({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, ht
|
|
|
14801
14866
|
e != null && (g[e] = (g[e] ?? 0) + 1);
|
|
14802
14867
|
}
|
|
14803
14868
|
} else if (r !== void 0) {
|
|
14804
|
-
let e =
|
|
14805
|
-
e !== void 0 &&
|
|
14869
|
+
let e = Yv(s, o, r);
|
|
14870
|
+
e !== void 0 && ny({
|
|
14806
14871
|
attributes: {
|
|
14807
14872
|
class: "lien_article_historique",
|
|
14808
14873
|
href: e,
|
|
@@ -14814,14 +14879,14 @@ async function ty({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, ht
|
|
|
14814
14879
|
replacementCounter: v
|
|
14815
14880
|
});
|
|
14816
14881
|
}
|
|
14817
|
-
|
|
14882
|
+
ry({
|
|
14818
14883
|
id: n,
|
|
14819
14884
|
outputByType: _
|
|
14820
|
-
}) &&
|
|
14885
|
+
}) && ay({
|
|
14821
14886
|
attributes: {
|
|
14822
14887
|
class: "reference_article",
|
|
14823
14888
|
style: "background-color: #eae462",
|
|
14824
|
-
title:
|
|
14889
|
+
title: Qv(t, e.reference)
|
|
14825
14890
|
},
|
|
14826
14891
|
id: n,
|
|
14827
14892
|
inputHtml: a,
|
|
@@ -14834,10 +14899,10 @@ async function ty({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, ht
|
|
|
14834
14899
|
case "external_division": {
|
|
14835
14900
|
let { division: t, originalTransformation: n, sectionTaId: r } = e;
|
|
14836
14901
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in external division link: ${JSON.stringify(e, null, 2)}`);
|
|
14837
|
-
if (r !== void 0 && (
|
|
14902
|
+
if (r !== void 0 && (ny({
|
|
14838
14903
|
attributes: {
|
|
14839
14904
|
class: "lien_division_externe",
|
|
14840
|
-
href:
|
|
14905
|
+
href: Xv(s, o, r)
|
|
14841
14906
|
},
|
|
14842
14907
|
inputHtml: a,
|
|
14843
14908
|
originalTransformation: n,
|
|
@@ -14847,14 +14912,14 @@ async function ty({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, ht
|
|
|
14847
14912
|
let e = await p.getTextIdFromSegmentId(r);
|
|
14848
14913
|
e != null && (g[e] = (g[e] ?? 0) + 1);
|
|
14849
14914
|
}
|
|
14850
|
-
|
|
14915
|
+
ry({
|
|
14851
14916
|
id: r,
|
|
14852
14917
|
outputByType: _
|
|
14853
|
-
}) &&
|
|
14918
|
+
}) && ay({
|
|
14854
14919
|
attributes: {
|
|
14855
14920
|
class: "reference_division",
|
|
14856
14921
|
style: "background-color: #eae462",
|
|
14857
|
-
title:
|
|
14922
|
+
title: Qv(t, e.reference)
|
|
14858
14923
|
},
|
|
14859
14924
|
id: r,
|
|
14860
14925
|
inputHtml: a,
|
|
@@ -14867,7 +14932,7 @@ async function ty({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, ht
|
|
|
14867
14932
|
case "european_text": {
|
|
14868
14933
|
let { url: t, originalTransformation: n, text: r, titleId: i } = e;
|
|
14869
14934
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in external text link: ${JSON.stringify(e, null, 2)}`);
|
|
14870
|
-
|
|
14935
|
+
ny({
|
|
14871
14936
|
attributes: {
|
|
14872
14937
|
class: "lien_texte_european",
|
|
14873
14938
|
href: t,
|
|
@@ -14877,14 +14942,14 @@ async function ty({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, ht
|
|
|
14877
14942
|
originalTransformation: n,
|
|
14878
14943
|
outputByType: _,
|
|
14879
14944
|
replacementCounter: v
|
|
14880
|
-
}),
|
|
14945
|
+
}), ry({
|
|
14881
14946
|
id: i,
|
|
14882
14947
|
outputByType: _
|
|
14883
|
-
}) &&
|
|
14948
|
+
}) && ay({
|
|
14884
14949
|
attributes: {
|
|
14885
14950
|
class: "reference_texte",
|
|
14886
14951
|
style: "background-color: #eae462",
|
|
14887
|
-
title:
|
|
14952
|
+
title: Qv(r, e.reference)
|
|
14888
14953
|
},
|
|
14889
14954
|
id: i,
|
|
14890
14955
|
inputHtml: a,
|
|
@@ -14895,27 +14960,54 @@ async function ty({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, ht
|
|
|
14895
14960
|
break;
|
|
14896
14961
|
}
|
|
14897
14962
|
case "external_text": {
|
|
14898
|
-
let { originalTransformation: t, text:
|
|
14963
|
+
let { originalTransformation: t, text: r } = e;
|
|
14899
14964
|
if (t === void 0) throw Error(`Missing originalTransformation attribute in external text link: ${JSON.stringify(e, null, 2)}`);
|
|
14900
|
-
|
|
14901
|
-
|
|
14902
|
-
|
|
14903
|
-
|
|
14904
|
-
|
|
14905
|
-
|
|
14906
|
-
|
|
14907
|
-
|
|
14908
|
-
|
|
14909
|
-
|
|
14910
|
-
|
|
14965
|
+
if (r.cid === void 0) !r.present && l && console.error(`Link to text "${h.text(r.position)}" without CID: ${JSON.stringify(r, null, 2)}`);
|
|
14966
|
+
else {
|
|
14967
|
+
let e = Jv(h.text(r.position)), i;
|
|
14968
|
+
if (e !== void 0) {
|
|
14969
|
+
let t = await p.getActiveArticlesByTextAndNum({
|
|
14970
|
+
date: n,
|
|
14971
|
+
num: e,
|
|
14972
|
+
textId: r.cid
|
|
14973
|
+
}), a = t.filter(({ dateDebut: e, dateFin: t }) => e <= n && t > n);
|
|
14974
|
+
if (a.length === 1) i = {
|
|
14975
|
+
class: "lien_article_externe",
|
|
14976
|
+
href: Xv(s, o, a[0].id)
|
|
14977
|
+
};
|
|
14978
|
+
else if (t.length > 0) {
|
|
14979
|
+
let t = await p.getArticleHistoryInfo({
|
|
14980
|
+
num: e,
|
|
14981
|
+
textId: r.cid
|
|
14982
|
+
}), n = t === void 0 ? void 0 : Yv(s, o, t.articleId);
|
|
14983
|
+
n !== void 0 && (i = {
|
|
14984
|
+
class: "lien_article_historique",
|
|
14985
|
+
href: n,
|
|
14986
|
+
title: "Versions de l'article"
|
|
14987
|
+
});
|
|
14988
|
+
}
|
|
14989
|
+
}
|
|
14990
|
+
ny({
|
|
14991
|
+
attributes: i ?? {
|
|
14992
|
+
class: "lien_texte_externe",
|
|
14993
|
+
href: Xv(s, o, r.cid)
|
|
14994
|
+
},
|
|
14995
|
+
inputHtml: a,
|
|
14996
|
+
originalTransformation: t,
|
|
14997
|
+
outputByType: _,
|
|
14998
|
+
replacementCounter: v
|
|
14999
|
+
}), i === void 0 && f && (g[r.cid] = (g[r.cid] ?? 0) + 1);
|
|
15000
|
+
}
|
|
15001
|
+
ry({
|
|
15002
|
+
id: r.cid,
|
|
14911
15003
|
outputByType: _
|
|
14912
|
-
}) &&
|
|
15004
|
+
}) && ay({
|
|
14913
15005
|
attributes: {
|
|
14914
15006
|
class: "reference_texte",
|
|
14915
15007
|
style: "background-color: #eae462",
|
|
14916
|
-
title:
|
|
15008
|
+
title: Qv(r, e.reference)
|
|
14917
15009
|
},
|
|
14918
|
-
id:
|
|
15010
|
+
id: r.cid,
|
|
14919
15011
|
inputHtml: a,
|
|
14920
15012
|
originalTransformation: t,
|
|
14921
15013
|
outputByType: _,
|
|
@@ -14926,7 +15018,7 @@ async function ty({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, ht
|
|
|
14926
15018
|
case "internal_article": {
|
|
14927
15019
|
let { definition: t, originalTransformation: n } = e;
|
|
14928
15020
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in internal article link: ${JSON.stringify(e, null, 2)}`);
|
|
14929
|
-
for (let e of Object.values(_))
|
|
15021
|
+
for (let e of Object.values(_)) ty({
|
|
14930
15022
|
inputHtml: a,
|
|
14931
15023
|
originalTransformation: n,
|
|
14932
15024
|
output: e,
|
|
@@ -14937,18 +15029,18 @@ async function ty({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, ht
|
|
|
14937
15029
|
}
|
|
14938
15030
|
default: m("Link", e);
|
|
14939
15031
|
}
|
|
14940
|
-
for (let e of Object.values(_)) e.html =
|
|
15032
|
+
for (let e of Object.values(_)) e.html = ey(a, e.replacements);
|
|
14941
15033
|
return {
|
|
14942
15034
|
outputByType: _,
|
|
14943
15035
|
referredLegifranceTextCountByCid: g
|
|
14944
15036
|
};
|
|
14945
15037
|
}
|
|
14946
|
-
function
|
|
15038
|
+
function ay({ attributes: e, id: t, inputHtml: n, originalTransformation: r, outputByType: i, replacementCounter: a }) {
|
|
14947
15039
|
let o = Object.entries(e).map(([e, t]) => `${e}="${tt(t, !0)}"`).join(" ");
|
|
14948
15040
|
for (let e of ["links_or_references", "references"]) {
|
|
14949
15041
|
if (e === "links_or_references" && t !== void 0) continue;
|
|
14950
15042
|
let s = i[e];
|
|
14951
|
-
s !== void 0 &&
|
|
15043
|
+
s !== void 0 && ty({
|
|
14952
15044
|
inputHtml: n,
|
|
14953
15045
|
originalTransformation: r,
|
|
14954
15046
|
output: s,
|
|
@@ -14958,4 +15050,4 @@ function ny({ attributes: e, id: t, inputHtml: n, originalTransformation: r, out
|
|
|
14958
15050
|
}
|
|
14959
15051
|
}
|
|
14960
15052
|
//#endregion
|
|
14961
|
-
export {
|
|
15053
|
+
export { Vp as $, nh as A, gt as At, Nm as B, ot as Bt, ag as C, Vt as Ct, ih as D, Bt as Dt, lh as E, zt as Et, th as F, nt as Ft, xm as G, ut as Gt, wm as H, ft as Ht, Wm as I, rt as It, Yp as J, mm as K, lt as Kt, Hm as L, st as Lt, Zm as M, E as Mt, $m as N, D as Nt, ah as O, kt as Ot, eh as P, St as Pt, Pp as Q, Um as R, it as Rt, sg as S, Xt as St, Gh as T, Ot as Tt, Sm as U, pt as Ut, jm as V, dt as Vt, Cm as W, ct as Wt, em as X, Xp as Y, Jp as Z, J_ as _, cn as _t, Yv as a, vn as at, dg as b, Jt as bt, Gv as c, Tn as ct, gv as d, pn as dt, Sp as et, Hv as f, dn as ft, tv as g, rn as gt, K_ as h, on as ht, qv as i, En as it, Xm as j, vt as jt, rh as k, ht as kt, Uv as l, mn as lt, fg as m, an as mt, $v as n, qp as nt, Xv as o, yn as ot, sv as p, nn as pt, Z as q, Jv as r, pp as rt, Wv as s, Sn as st, iy as t, Cp as tt, Kv as u, _n as ut, ev as v, $t as vt, Kh as w, Ht as wt, og as x, Yt as xt, q_ as y, Zt as yt, Fm as z, at as zt };
|