@tricoteuses/tisseuse 0.14.14 → 0.14.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{html-CnfkCnJt.js → html-DA1zf9Pf.js} +844 -811
- package/dist/index.js +1 -1
- package/dist/server.js +1 -1
- 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",
|
|
@@ -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,128 +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
|
-
|
|
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);
|
|
11970
12003
|
}
|
|
11971
|
-
function
|
|
11972
|
-
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) => ({
|
|
11973
12006
|
start: e.position.start,
|
|
11974
12007
|
end: e.position.stop
|
|
11975
|
-
})), s = a.map(
|
|
11976
|
-
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;
|
|
11977
12010
|
}
|
|
11978
|
-
function
|
|
11979
|
-
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));
|
|
11980
12013
|
return a.length === 0 ? null : a.find((e) => xt(e) !== "article") ?? null ?? a[0] ?? null;
|
|
11981
12014
|
}
|
|
11982
|
-
function
|
|
11983
|
-
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);
|
|
11984
12017
|
for (let e of r) {
|
|
11985
|
-
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);
|
|
11986
12019
|
if (i) return i;
|
|
11987
12020
|
}
|
|
11988
12021
|
return null;
|
|
11989
12022
|
}
|
|
11990
|
-
function
|
|
12023
|
+
function Rg(e) {
|
|
11991
12024
|
return e?.toLowerCase().replace(/[.)]/g, "").trim();
|
|
11992
12025
|
}
|
|
11993
|
-
function
|
|
11994
|
-
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));
|
|
11995
12028
|
}
|
|
11996
|
-
function
|
|
12029
|
+
function Bg(e) {
|
|
11997
12030
|
let t = null;
|
|
11998
12031
|
for (let n of D(e)) t = n;
|
|
11999
12032
|
return t;
|
|
12000
12033
|
}
|
|
12001
|
-
function
|
|
12002
|
-
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;
|
|
12003
12036
|
}
|
|
12004
|
-
function
|
|
12037
|
+
function Hg(e, t) {
|
|
12005
12038
|
let n = null;
|
|
12006
12039
|
for (let r of D(e)) r.type === t && r.relative === void 0 && (r.index === void 0 && r.num === void 0 || (n = r));
|
|
12007
12040
|
return n;
|
|
12008
12041
|
}
|
|
12009
|
-
function
|
|
12042
|
+
function Ug(e, t) {
|
|
12010
12043
|
if (!t) return e;
|
|
12011
12044
|
let n = structuredClone(e), r = (e) => {
|
|
12012
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") {
|
|
12013
12046
|
if (e.relative === 0) {
|
|
12014
|
-
let n =
|
|
12047
|
+
let n = Hg(t, e.type);
|
|
12015
12048
|
n && (e.index = n.index, e.num = n.num, delete e.relative);
|
|
12016
12049
|
}
|
|
12017
12050
|
return;
|
|
@@ -12037,7 +12070,7 @@ function Vg(e, t) {
|
|
|
12037
12070
|
};
|
|
12038
12071
|
return r(n), n;
|
|
12039
12072
|
}
|
|
12040
|
-
function
|
|
12073
|
+
function Wg(e) {
|
|
12041
12074
|
let t = (e) => {
|
|
12042
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;
|
|
12043
12076
|
switch (e.type) {
|
|
@@ -12051,14 +12084,14 @@ function Hg(e) {
|
|
|
12051
12084
|
};
|
|
12052
12085
|
return t(e);
|
|
12053
12086
|
}
|
|
12054
|
-
function
|
|
12087
|
+
function Gg(e) {
|
|
12055
12088
|
let t = [], n = [];
|
|
12056
12089
|
for (let r of e) {
|
|
12057
|
-
if (!
|
|
12090
|
+
if (!Cg(r.text)) {
|
|
12058
12091
|
n[n.length - 1]?.body.push(r);
|
|
12059
12092
|
continue;
|
|
12060
12093
|
}
|
|
12061
|
-
let e =
|
|
12094
|
+
let e = wg(r.text), i = e?.level ?? 0, a = {
|
|
12062
12095
|
body: [],
|
|
12063
12096
|
children: [],
|
|
12064
12097
|
level: i,
|
|
@@ -12070,24 +12103,24 @@ function Ug(e) {
|
|
|
12070
12103
|
}
|
|
12071
12104
|
return t;
|
|
12072
12105
|
}
|
|
12073
|
-
function
|
|
12106
|
+
function Kg(e, t, n) {
|
|
12074
12107
|
for (let r of e) {
|
|
12075
|
-
let e =
|
|
12108
|
+
let e = Yg(r);
|
|
12076
12109
|
if (e) {
|
|
12077
|
-
let r = performance.now(), i =
|
|
12110
|
+
let r = performance.now(), i = Ag(t, e, n);
|
|
12078
12111
|
if (Q(n, "listFindActionIndexMs", r), i !== null) return !0;
|
|
12079
12112
|
}
|
|
12080
|
-
if (
|
|
12113
|
+
if (Kg(r.children, t, n)) return !0;
|
|
12081
12114
|
}
|
|
12082
12115
|
return !1;
|
|
12083
12116
|
}
|
|
12084
|
-
function
|
|
12117
|
+
function qg(e, t) {
|
|
12085
12118
|
if (!e) return t;
|
|
12086
12119
|
if (!t) return e;
|
|
12087
|
-
let n =
|
|
12120
|
+
let n = Vg(t, Bg(e));
|
|
12088
12121
|
return n.type === "article" || xt(n), ht(e, n);
|
|
12089
12122
|
}
|
|
12090
|
-
function
|
|
12123
|
+
function Jg(e, t) {
|
|
12091
12124
|
return {
|
|
12092
12125
|
...ht(e, t),
|
|
12093
12126
|
position: {
|
|
@@ -12096,16 +12129,16 @@ function Kg(e, t) {
|
|
|
12096
12129
|
}
|
|
12097
12130
|
};
|
|
12098
12131
|
}
|
|
12099
|
-
function
|
|
12100
|
-
return [
|
|
12132
|
+
function Yg(e) {
|
|
12133
|
+
return [xg(e.line.text), ...e.body.map((e) => e.text)].join("\n").trim();
|
|
12101
12134
|
}
|
|
12102
|
-
function
|
|
12135
|
+
function Xg(e) {
|
|
12103
12136
|
return e.body[e.body.length - 1]?.end ?? e.line.end;
|
|
12104
12137
|
}
|
|
12105
|
-
function
|
|
12138
|
+
function Zg(e) {
|
|
12106
12139
|
return (e ?? "").replace(/°/gu, "").replace(/\s+/gu, " ").trim();
|
|
12107
12140
|
}
|
|
12108
|
-
function
|
|
12141
|
+
function Qg(e, t) {
|
|
12109
12142
|
let n = new x(e, t), r = me(n);
|
|
12110
12143
|
return typeof r == "string" && n.offset > t ? {
|
|
12111
12144
|
date: r,
|
|
@@ -12113,14 +12146,14 @@ function Xg(e, t) {
|
|
|
12113
12146
|
stop: n.offset
|
|
12114
12147
|
} : null;
|
|
12115
12148
|
}
|
|
12116
|
-
function
|
|
12117
|
-
let t =
|
|
12149
|
+
function $g(e) {
|
|
12150
|
+
let t = Rh(e), n = [];
|
|
12118
12151
|
for (let r = 0; r < e.length; r += 1) {
|
|
12119
12152
|
let i = e[r];
|
|
12120
12153
|
if (i === void 0 || !/\d/u.test(i)) continue;
|
|
12121
|
-
let a =
|
|
12154
|
+
let a = Qg(e, r);
|
|
12122
12155
|
if (a) {
|
|
12123
|
-
if (
|
|
12156
|
+
if (zh(a, t)) {
|
|
12124
12157
|
r = Math.max(r, a.stop - 1);
|
|
12125
12158
|
continue;
|
|
12126
12159
|
}
|
|
@@ -12129,25 +12162,25 @@ function Zg(e) {
|
|
|
12129
12162
|
}
|
|
12130
12163
|
return n;
|
|
12131
12164
|
}
|
|
12132
|
-
function
|
|
12133
|
-
return
|
|
12165
|
+
function e_(e) {
|
|
12166
|
+
return uh(e).replace(/\s+/gu, " ");
|
|
12134
12167
|
}
|
|
12135
|
-
function
|
|
12136
|
-
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;
|
|
12137
12170
|
for (; (i = n.exec(t)) !== null;) r = i;
|
|
12138
12171
|
return r;
|
|
12139
12172
|
}
|
|
12140
|
-
function
|
|
12141
|
-
let n =
|
|
12142
|
-
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)));
|
|
12143
12176
|
}
|
|
12144
|
-
function
|
|
12145
|
-
return
|
|
12177
|
+
function r_(e) {
|
|
12178
|
+
return $g(e).find((t) => n_(e, t))?.date;
|
|
12146
12179
|
}
|
|
12147
|
-
function
|
|
12148
|
-
return e.map((e) =>
|
|
12180
|
+
function i_(e) {
|
|
12181
|
+
return e.map((e) => Zg(e.num)).filter((e) => e.length > 0);
|
|
12149
12182
|
}
|
|
12150
|
-
function
|
|
12183
|
+
function a_(e, t) {
|
|
12151
12184
|
let n = e.at(-1), r = t.at(-1);
|
|
12152
12185
|
if (!n || !r) return [e, t];
|
|
12153
12186
|
let i = e.slice(0, -1), a = t.slice(0, -1);
|
|
@@ -12158,51 +12191,51 @@ function r_(e, t) {
|
|
|
12158
12191
|
for (let e = o; e <= s; e += 1) c.push([...i, String(e)]);
|
|
12159
12192
|
return c;
|
|
12160
12193
|
}
|
|
12161
|
-
function
|
|
12194
|
+
function o_(e) {
|
|
12162
12195
|
if (e.kind === "single") {
|
|
12163
|
-
let t =
|
|
12196
|
+
let t = i_(e.steps);
|
|
12164
12197
|
return t.length > 0 ? [t] : [];
|
|
12165
12198
|
}
|
|
12166
|
-
let t =
|
|
12167
|
-
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);
|
|
12168
12201
|
}
|
|
12169
|
-
function
|
|
12170
|
-
let t =
|
|
12171
|
-
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)) {
|
|
12172
12205
|
if (e.type === "article" && e.present) {
|
|
12173
12206
|
n.push([]);
|
|
12174
12207
|
continue;
|
|
12175
12208
|
}
|
|
12176
|
-
for (let t of
|
|
12209
|
+
for (let t of Vp(e)) n.push(...o_(t));
|
|
12177
12210
|
}
|
|
12178
12211
|
return n.filter((e, t, n) => n.findIndex((t) => t.join("\0") === e.join("\0")) === t);
|
|
12179
12212
|
}
|
|
12180
|
-
function
|
|
12213
|
+
function c_(e) {
|
|
12181
12214
|
let t = [], n = e.split(/(?<=[.;])\s+/u).map((e) => e.trim()).filter(Boolean);
|
|
12182
|
-
for (let e of n) for (let n of
|
|
12183
|
-
if (!
|
|
12184
|
-
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));
|
|
12185
12218
|
if (!r) continue;
|
|
12186
|
-
let i =
|
|
12219
|
+
let i = s_(e.slice(0, r.index).trim());
|
|
12187
12220
|
if (i.length === 0) continue;
|
|
12188
12221
|
t.push({
|
|
12189
12222
|
date: n.date,
|
|
12190
12223
|
paths: i
|
|
12191
12224
|
});
|
|
12192
|
-
let a =
|
|
12225
|
+
let a = l_(e.slice(n.stop), i);
|
|
12193
12226
|
t.push(...a);
|
|
12194
12227
|
}
|
|
12195
12228
|
return t;
|
|
12196
12229
|
}
|
|
12197
|
-
function
|
|
12230
|
+
function l_(e, t) {
|
|
12198
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);
|
|
12199
12232
|
if (!n) return [];
|
|
12200
12233
|
let r = n.index + n[0].length, i = n[1]?.trim();
|
|
12201
12234
|
if (!i) return [];
|
|
12202
|
-
let a =
|
|
12235
|
+
let a = s_(i);
|
|
12203
12236
|
if (a.length === 0) return [];
|
|
12204
12237
|
let o = [];
|
|
12205
|
-
for (let n of
|
|
12238
|
+
for (let n of $g(e.slice(r))) {
|
|
12206
12239
|
let e = n.date;
|
|
12207
12240
|
o.push({
|
|
12208
12241
|
date: e,
|
|
@@ -12213,44 +12246,44 @@ function s_(e, t) {
|
|
|
12213
12246
|
}
|
|
12214
12247
|
return o;
|
|
12215
12248
|
}
|
|
12216
|
-
function
|
|
12249
|
+
function u_(e, t, n) {
|
|
12217
12250
|
return [
|
|
12218
12251
|
...e,
|
|
12219
|
-
|
|
12220
|
-
...
|
|
12252
|
+
Zg(t.marker),
|
|
12253
|
+
...Eg(n).map(Zg)
|
|
12221
12254
|
].filter((e) => e.length > 0);
|
|
12222
12255
|
}
|
|
12223
|
-
function
|
|
12256
|
+
function d_(e) {
|
|
12224
12257
|
let t = [];
|
|
12225
|
-
for (let n of e) t.push(...
|
|
12258
|
+
for (let n of e) t.push(...c_(Yg(n))), t.push(...d_(n.children));
|
|
12226
12259
|
return t;
|
|
12227
12260
|
}
|
|
12228
|
-
function
|
|
12261
|
+
function f_(e, t) {
|
|
12229
12262
|
return t.length > e.length ? !1 : t.every((t, n) => e[n] === t);
|
|
12230
12263
|
}
|
|
12231
|
-
function
|
|
12264
|
+
function p_(e, t) {
|
|
12232
12265
|
if (t.length > e.length) return !1;
|
|
12233
12266
|
let n = e.length - t.length;
|
|
12234
12267
|
return t.every((t, r) => e[n + r] === t);
|
|
12235
12268
|
}
|
|
12236
|
-
function
|
|
12237
|
-
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);
|
|
12238
12271
|
}
|
|
12239
|
-
function
|
|
12272
|
+
function h_(e, t, n) {
|
|
12240
12273
|
if (e.length === 0 || n.length === 0) return;
|
|
12241
12274
|
let r = new Map(t.map((e) => [e.directive, e.sourcePath]));
|
|
12242
12275
|
for (let t of e) {
|
|
12243
12276
|
if (t.applicabilityDate) continue;
|
|
12244
12277
|
let e = r.get(t) ?? [], i, a = -1;
|
|
12245
12278
|
for (let t of n) for (let n of t.paths) {
|
|
12246
|
-
if (!
|
|
12279
|
+
if (!m_(e, n, t.parentPaths)) continue;
|
|
12247
12280
|
let r = n.length + Math.max(0, ...t.parentPaths?.map((e) => e.length) ?? [0]);
|
|
12248
12281
|
r > a && (i = t.date, a = r);
|
|
12249
12282
|
}
|
|
12250
12283
|
i && (t.applicabilityDate = i);
|
|
12251
12284
|
}
|
|
12252
12285
|
}
|
|
12253
|
-
function
|
|
12286
|
+
function g_(e, t) {
|
|
12254
12287
|
if (!e) return t;
|
|
12255
12288
|
if (!t) return e;
|
|
12256
12289
|
let n = t.rowIndex ?? e.rowIndex, r = t.columnIndex ?? e.columnIndex;
|
|
@@ -12260,23 +12293,23 @@ function m_(e, t) {
|
|
|
12260
12293
|
...r ? { columnIndex: r } : {}
|
|
12261
12294
|
};
|
|
12262
12295
|
}
|
|
12263
|
-
function
|
|
12296
|
+
function __(e) {
|
|
12264
12297
|
return e !== void 0 && (e.rowIndex !== void 0 || e.columnIndex !== void 0);
|
|
12265
12298
|
}
|
|
12266
|
-
function
|
|
12299
|
+
function v_(e, t, n, r, i = [], a = [], o, s) {
|
|
12267
12300
|
let c = [], l = t;
|
|
12268
12301
|
for (let u of e) {
|
|
12269
12302
|
s !== void 0 && (s.listItemCount += 1);
|
|
12270
|
-
let e =
|
|
12303
|
+
let e = xg(u.line.text), d = u_(i, u, e), f = Yg(u);
|
|
12271
12304
|
if (!f) continue;
|
|
12272
|
-
let p =
|
|
12305
|
+
let p = g_(r, D_(f, r !== void 0)), m, h, g = () => {
|
|
12273
12306
|
if (m !== void 0) return m;
|
|
12274
12307
|
let t = performance.now();
|
|
12275
|
-
return m =
|
|
12276
|
-
}, _ = () => (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);
|
|
12277
12310
|
if (Q(s, "listFindActionIndexMs", v), y === null) {
|
|
12278
12311
|
if (h = _(), u.children.length > 0) {
|
|
12279
|
-
let e = h ?? t, r =
|
|
12312
|
+
let e = h ?? t, r = v_(u.children, e, n, p, d, a, o, s);
|
|
12280
12313
|
r.length > 0 && (c.push(...r), l = r[r.length - 1]?.reference ?? l);
|
|
12281
12314
|
continue;
|
|
12282
12315
|
}
|
|
@@ -12284,23 +12317,23 @@ function g_(e, t, n, r, i = [], a = [], o, s) {
|
|
|
12284
12317
|
continue;
|
|
12285
12318
|
}
|
|
12286
12319
|
s !== void 0 && (s.listActionItemCount += 1);
|
|
12287
|
-
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();
|
|
12288
12321
|
Q(s, "listPickLocalReferenceMs", b);
|
|
12289
|
-
let x =
|
|
12322
|
+
let x = qg(t, ne) ?? te ?? h;
|
|
12290
12323
|
if (!x) {
|
|
12291
12324
|
if (u.children.length > 0) {
|
|
12292
|
-
let e =
|
|
12325
|
+
let e = v_(u.children, h ?? t, n, p, d, a, o, s);
|
|
12293
12326
|
c.push(...e);
|
|
12294
12327
|
}
|
|
12295
12328
|
continue;
|
|
12296
12329
|
}
|
|
12297
|
-
x =
|
|
12298
|
-
let re = performance.now(), ie =
|
|
12330
|
+
x = Ug(x, Wg(x) ? l ?? t : t);
|
|
12331
|
+
let re = performance.now(), ie = U_({
|
|
12299
12332
|
action: { action: "modifier" },
|
|
12300
12333
|
reference: x,
|
|
12301
12334
|
sourcePosition: {
|
|
12302
12335
|
start: u.line.start,
|
|
12303
|
-
stop:
|
|
12336
|
+
stop: Xg(u)
|
|
12304
12337
|
},
|
|
12305
12338
|
sourceText: f,
|
|
12306
12339
|
fullText: n,
|
|
@@ -12309,7 +12342,7 @@ function g_(e, t, n, r, i = [], a = [], o, s) {
|
|
|
12309
12342
|
if (Q(s, "listBuildActionDirectiveMs", re), !ie) {
|
|
12310
12343
|
if (l = x, u.children.length > 0) {
|
|
12311
12344
|
h = _();
|
|
12312
|
-
let e =
|
|
12345
|
+
let e = v_(u.children, h ?? x, n, p, d, a, o, s);
|
|
12313
12346
|
c.push(...e), l = e[e.length - 1]?.reference ?? l;
|
|
12314
12347
|
}
|
|
12315
12348
|
continue;
|
|
@@ -12326,28 +12359,28 @@ function g_(e, t, n, r, i = [], a = [], o, s) {
|
|
|
12326
12359
|
});
|
|
12327
12360
|
if (l = x, u.children.length > 0) {
|
|
12328
12361
|
h = _();
|
|
12329
|
-
let e =
|
|
12362
|
+
let e = v_(u.children, h ?? x, n, p, d, a, o, s);
|
|
12330
12363
|
e.length > 0 && (c.push(...e), l = e[e.length - 1]?.reference ?? l);
|
|
12331
12364
|
}
|
|
12332
12365
|
}
|
|
12333
|
-
return
|
|
12366
|
+
return H_(c);
|
|
12334
12367
|
}
|
|
12335
|
-
function
|
|
12336
|
-
let n =
|
|
12368
|
+
function y_(e, t) {
|
|
12369
|
+
let n = Sg(e), r = n.findIndex((e) => Cg(e.text));
|
|
12337
12370
|
if (r === -1) return null;
|
|
12338
|
-
let i =
|
|
12339
|
-
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;
|
|
12340
12373
|
let s = performance.now(), c = null;
|
|
12341
|
-
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);
|
|
12342
12375
|
Q(t, "findBaseReferenceMs", s);
|
|
12343
|
-
let l = [], u = performance.now(), d =
|
|
12376
|
+
let l = [], u = performance.now(), d = v_(o, c, e, void 0, [], l, i, t);
|
|
12344
12377
|
Q(t, "processListItemNodesMs", u);
|
|
12345
|
-
let f = performance.now(), p =
|
|
12378
|
+
let f = performance.now(), p = d_(o);
|
|
12346
12379
|
Q(t, "collectApplicabilityScopesMs", f);
|
|
12347
12380
|
let m = performance.now();
|
|
12348
|
-
return
|
|
12381
|
+
return h_(d, l, p), Q(t, "applyApplicabilityDatesMs", m), d.length > 0 ? d : null;
|
|
12349
12382
|
}
|
|
12350
|
-
function
|
|
12383
|
+
function b_(e, t) {
|
|
12351
12384
|
let n = e.indexOf("«");
|
|
12352
12385
|
if (n === -1) return;
|
|
12353
12386
|
let r = e.indexOf("»", n + 1);
|
|
@@ -12362,40 +12395,40 @@ function v_(e, t) {
|
|
|
12362
12395
|
}
|
|
12363
12396
|
};
|
|
12364
12397
|
}
|
|
12365
|
-
function
|
|
12366
|
-
let t =
|
|
12398
|
+
function x_(e) {
|
|
12399
|
+
let t = uh(e);
|
|
12367
12400
|
return /\btableau\b/.test(t) && /\b(?:tableau|celui)\s+(?:suivant|ainsi\s+redigee?|ainsi\s+rediges|ainsi\s+redigees)\b/.test(t);
|
|
12368
12401
|
}
|
|
12369
|
-
function
|
|
12370
|
-
for (let t of
|
|
12371
|
-
if (!
|
|
12402
|
+
function S_(e) {
|
|
12403
|
+
for (let t of Sg(e)) {
|
|
12404
|
+
if (!x_(t.text)) continue;
|
|
12372
12405
|
let e = t.text.indexOf(":");
|
|
12373
12406
|
return e === -1 ? t.end : t.start + e + 1;
|
|
12374
12407
|
}
|
|
12375
12408
|
return null;
|
|
12376
12409
|
}
|
|
12377
|
-
function
|
|
12378
|
-
let n =
|
|
12379
|
-
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);
|
|
12380
12413
|
}
|
|
12381
|
-
function
|
|
12382
|
-
return
|
|
12414
|
+
function w_(e, t) {
|
|
12415
|
+
return ug(e, t);
|
|
12383
12416
|
}
|
|
12384
|
-
function
|
|
12385
|
-
let n =
|
|
12417
|
+
function T_(e, t) {
|
|
12418
|
+
let n = Dm(e, t);
|
|
12386
12419
|
return n && n > 1 ? n : void 0;
|
|
12387
12420
|
}
|
|
12388
|
-
function
|
|
12421
|
+
function E_(e, t) {
|
|
12389
12422
|
if (!Array.isArray(e) || e.length < 2 || t.length < e.length) return e;
|
|
12390
12423
|
let n = e[0];
|
|
12391
12424
|
return e.some((e) => JSON.stringify(e) !== JSON.stringify(n)) ? e : n;
|
|
12392
12425
|
}
|
|
12393
|
-
function
|
|
12394
|
-
let n =
|
|
12426
|
+
function D_(e, t = !1) {
|
|
12427
|
+
let n = Lh(e, Ih(e)), r = uh(n), i = /\btableau\b/.test(r);
|
|
12395
12428
|
if (!i && !t) return;
|
|
12396
12429
|
let a = (e) => {
|
|
12397
12430
|
if (!e) return;
|
|
12398
|
-
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);
|
|
12399
12432
|
if (/^derni(?:er|ere)s?\b/u.test(n)) return -1;
|
|
12400
12433
|
let r = ge(t);
|
|
12401
12434
|
return r && r > 0 ? r : void 0;
|
|
@@ -12416,30 +12449,30 @@ function T_(e, t = !1) {
|
|
|
12416
12449
|
let l = /\bla\s+(.+?)\s+ligne\b/iu.exec(n), u = /\bla\s+(.+?)\s+colonne\b/iu.exec(n);
|
|
12417
12450
|
return o(a(l?.[1]), a(u?.[1])) || (i ? { type: "table" } : void 0);
|
|
12418
12451
|
}
|
|
12419
|
-
function
|
|
12452
|
+
function O_(e) {
|
|
12420
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();
|
|
12421
12454
|
}
|
|
12422
|
-
function
|
|
12455
|
+
function k_(e) {
|
|
12423
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();
|
|
12424
12457
|
}
|
|
12425
|
-
var
|
|
12426
|
-
|
|
12427
|
-
|
|
12428
|
-
|
|
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+à)")
|
|
12429
12462
|
];
|
|
12430
|
-
function
|
|
12463
|
+
function j_(e) {
|
|
12431
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");
|
|
12432
12465
|
}
|
|
12433
|
-
function
|
|
12466
|
+
function M_(e) {
|
|
12434
12467
|
return e.replace(/\s+/gu, " ").replace(/\s+([,;])/gu, "$1").trim();
|
|
12435
12468
|
}
|
|
12436
|
-
function
|
|
12469
|
+
function N_(e) {
|
|
12437
12470
|
if (e.includes("«") || e.includes("»")) return null;
|
|
12438
|
-
for (let t of
|
|
12471
|
+
for (let t of A_) {
|
|
12439
12472
|
let n = t.exec(e), r = n?.groups?.target, i = n?.groups?.replacement;
|
|
12440
12473
|
if (!(!r || !i)) return {
|
|
12441
|
-
targetText:
|
|
12442
|
-
replacementText:
|
|
12474
|
+
targetText: M_(r),
|
|
12475
|
+
replacementText: M_(i),
|
|
12443
12476
|
operandRange: {
|
|
12444
12477
|
start: n.index,
|
|
12445
12478
|
end: n.index + n[0].length
|
|
@@ -12448,22 +12481,22 @@ function j_(e) {
|
|
|
12448
12481
|
}
|
|
12449
12482
|
return null;
|
|
12450
12483
|
}
|
|
12451
|
-
function
|
|
12452
|
-
let t =
|
|
12484
|
+
function P_(e) {
|
|
12485
|
+
let t = N_(e);
|
|
12453
12486
|
return t ? [t.operandRange] : [];
|
|
12454
12487
|
}
|
|
12455
|
-
function
|
|
12456
|
-
return
|
|
12488
|
+
function F_(e, t) {
|
|
12489
|
+
return zh(e.position, t) ? !0 : Array.from(D(Ng(e))).some((e) => zh(e.position, t));
|
|
12457
12490
|
}
|
|
12458
|
-
function
|
|
12459
|
-
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 = () => {
|
|
12460
12493
|
let n = i[0]?.start;
|
|
12461
|
-
return (n === void 0 ? void 0 :
|
|
12462
|
-
},
|
|
12494
|
+
return (n === void 0 ? void 0 : T_(t, n)) ?? Em(e) ?? void 0;
|
|
12495
|
+
}, te = () => {
|
|
12463
12496
|
let e = i[0]?.start;
|
|
12464
|
-
return (e === void 0 ? void 0 :
|
|
12465
|
-
},
|
|
12466
|
-
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({
|
|
12467
12500
|
hasRedactionIntro: c,
|
|
12468
12501
|
insertText: n,
|
|
12469
12502
|
normalized: o
|
|
@@ -12476,127 +12509,127 @@ function P_(e, t, n, r, i, a) {
|
|
|
12476
12509
|
...r ? { expectsFollowingTable: r } : {}
|
|
12477
12510
|
};
|
|
12478
12511
|
};
|
|
12479
|
-
if ((l || u) &&
|
|
12512
|
+
if ((l || u) && p && h && a.length >= 3) {
|
|
12480
12513
|
let e = a.slice(0, -2), t = a.at(-2), n = a.at(-1);
|
|
12481
12514
|
if (e.length > 0 && t && n) return [{
|
|
12482
12515
|
kind: "delete",
|
|
12483
12516
|
targetText: e[0],
|
|
12484
12517
|
extraTargetTexts: e.slice(1)
|
|
12485
|
-
},
|
|
12486
|
-
kind:
|
|
12518
|
+
}, ne({
|
|
12519
|
+
kind: _,
|
|
12487
12520
|
targetText: t,
|
|
12488
12521
|
insertText: n,
|
|
12489
|
-
expectsFollowingTable:
|
|
12522
|
+
expectsFollowingTable: g
|
|
12490
12523
|
})];
|
|
12491
12524
|
}
|
|
12492
|
-
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)) {
|
|
12493
12526
|
let e = a.slice(0, -1), t = a.at(-1);
|
|
12494
12527
|
if (e.length > 0 && t) return [{
|
|
12495
12528
|
kind: "delete",
|
|
12496
12529
|
targetText: e[0],
|
|
12497
12530
|
extraTargetTexts: e.slice(1)
|
|
12498
|
-
},
|
|
12531
|
+
}, ne({
|
|
12499
12532
|
kind: "insert_after",
|
|
12500
12533
|
targetText: "",
|
|
12501
12534
|
insertText: t,
|
|
12502
|
-
expectsFollowingTable:
|
|
12535
|
+
expectsFollowingTable: g
|
|
12503
12536
|
})];
|
|
12504
12537
|
}
|
|
12505
|
-
if ((l || u) &&
|
|
12538
|
+
if ((l || u) && p && m && a.length >= 4) {
|
|
12506
12539
|
let e = a.at(-2), t = a.at(-1);
|
|
12507
12540
|
if (e && t) return [{
|
|
12508
12541
|
kind: "replace",
|
|
12509
12542
|
targetText: a[0],
|
|
12510
12543
|
replacementText: a[1]
|
|
12511
|
-
},
|
|
12512
|
-
kind:
|
|
12544
|
+
}, ne({
|
|
12545
|
+
kind: _,
|
|
12513
12546
|
targetText: e,
|
|
12514
12547
|
insertText: t,
|
|
12515
|
-
expectsFollowingTable:
|
|
12548
|
+
expectsFollowingTable: g
|
|
12516
12549
|
})];
|
|
12517
12550
|
}
|
|
12518
|
-
if (
|
|
12551
|
+
if (m && h && !p && a.length >= 3) {
|
|
12519
12552
|
let e = o.search(/\bremplace(?:e|es|s)?\b/u), t = o.search(/\bsupprime(?:e|es|s)?\b/u);
|
|
12520
12553
|
if (e !== -1 && t !== -1 && e < t) return [{
|
|
12521
12554
|
kind: "replace",
|
|
12522
12555
|
targetText: a[0],
|
|
12523
12556
|
replacementText: a[1],
|
|
12524
|
-
...
|
|
12557
|
+
...y ? { targetScope: y } : {}
|
|
12525
12558
|
}, {
|
|
12526
12559
|
kind: "delete",
|
|
12527
12560
|
targetText: a[2],
|
|
12528
12561
|
extraTargetTexts: a.slice(3),
|
|
12529
|
-
...
|
|
12562
|
+
...b ? { targetScope: b } : {}
|
|
12530
12563
|
}];
|
|
12531
12564
|
if (e !== -1 && t !== -1 && t < e && a.length >= 4) return [{
|
|
12532
12565
|
kind: "delete",
|
|
12533
12566
|
targetText: a[0],
|
|
12534
12567
|
extraTargetTexts: a.slice(1, -2),
|
|
12535
|
-
...
|
|
12568
|
+
...b ? { targetScope: b } : {}
|
|
12536
12569
|
}, {
|
|
12537
12570
|
kind: "replace",
|
|
12538
12571
|
targetText: a.at(-2) ?? "",
|
|
12539
12572
|
replacementText: a.at(-1) ?? "",
|
|
12540
|
-
...
|
|
12573
|
+
...y ? { targetScope: y } : {}
|
|
12541
12574
|
}];
|
|
12542
12575
|
}
|
|
12543
|
-
let
|
|
12544
|
-
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) {
|
|
12545
12578
|
let e = [];
|
|
12546
12579
|
for (let t = 0; t < a.length; t += 2) e.push({
|
|
12547
12580
|
kind: "replace",
|
|
12548
12581
|
targetText: a[t],
|
|
12549
12582
|
replacementText: a[t + 1],
|
|
12550
|
-
...
|
|
12583
|
+
...y ? { targetScope: y } : {}
|
|
12551
12584
|
});
|
|
12552
12585
|
return e;
|
|
12553
12586
|
}
|
|
12554
|
-
if (n.action === "supprimer" ||
|
|
12587
|
+
if (n.action === "supprimer" || h) {
|
|
12555
12588
|
if (r === "article" && a.length === 0) return { kind: "delete_article" };
|
|
12556
12589
|
if (a.length >= 1) {
|
|
12557
|
-
let e = a.length === 1 ?
|
|
12590
|
+
let e = a.length === 1 ? ee() : void 0;
|
|
12558
12591
|
return {
|
|
12559
12592
|
kind: "delete",
|
|
12560
12593
|
targetText: a[0],
|
|
12561
12594
|
extraTargetTexts: a.slice(1),
|
|
12562
12595
|
...e ? { targetOccurrenceCount: e } : {},
|
|
12563
|
-
...
|
|
12596
|
+
...b ? { targetScope: b } : {}
|
|
12564
12597
|
};
|
|
12565
12598
|
}
|
|
12566
12599
|
return { kind: "delete_portion" };
|
|
12567
12600
|
}
|
|
12568
|
-
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 {
|
|
12569
12602
|
kind: "replace_portion",
|
|
12570
12603
|
replacement: { type: "following_table" }
|
|
12571
12604
|
};
|
|
12572
|
-
if (
|
|
12573
|
-
let t =
|
|
12605
|
+
if (m && !p && !h && a.length === 0) {
|
|
12606
|
+
let t = N_(e);
|
|
12574
12607
|
if (t) return {
|
|
12575
12608
|
kind: "replace",
|
|
12576
12609
|
targetText: t.targetText,
|
|
12577
12610
|
replacementText: t.replacementText,
|
|
12578
|
-
...
|
|
12611
|
+
...y ? { targetScope: y } : {}
|
|
12579
12612
|
};
|
|
12580
12613
|
}
|
|
12581
|
-
if (
|
|
12582
|
-
let e =
|
|
12614
|
+
if (m && a.length >= 2) {
|
|
12615
|
+
let e = ee(), t = te();
|
|
12583
12616
|
return {
|
|
12584
12617
|
kind: "replace",
|
|
12585
12618
|
targetText: a[0],
|
|
12586
12619
|
replacementText: a[1],
|
|
12587
12620
|
...t ? { occurrenceIndex: t } : {},
|
|
12588
12621
|
...e ? { targetOccurrenceCount: e } : {},
|
|
12589
|
-
...
|
|
12622
|
+
...y ? { targetScope: y } : {}
|
|
12590
12623
|
};
|
|
12591
12624
|
}
|
|
12592
|
-
if (l && c && a.length >= 2 &&
|
|
12625
|
+
if (l && c && a.length >= 2 && v) return {
|
|
12593
12626
|
kind: "replace",
|
|
12594
12627
|
targetText: a[0],
|
|
12595
12628
|
replacementText: a[1],
|
|
12596
|
-
targetScope:
|
|
12629
|
+
targetScope: v
|
|
12597
12630
|
};
|
|
12598
|
-
if (!
|
|
12599
|
-
let e =
|
|
12631
|
+
if (!p && a.length === 1 && c) {
|
|
12632
|
+
let e = yg({
|
|
12600
12633
|
hasRedactionIntro: c,
|
|
12601
12634
|
normalized: o,
|
|
12602
12635
|
replacementText: a[0]
|
|
@@ -12610,7 +12643,7 @@ function P_(e, t, n, r, i, a) {
|
|
|
12610
12643
|
...e ? { replacementLayout: e } : {}
|
|
12611
12644
|
};
|
|
12612
12645
|
}
|
|
12613
|
-
if (
|
|
12646
|
+
if (p && g) return ne(u ? {
|
|
12614
12647
|
kind: "insert_before",
|
|
12615
12648
|
targetText: "",
|
|
12616
12649
|
insertText: "",
|
|
@@ -12621,42 +12654,42 @@ function P_(e, t, n, r, i, a) {
|
|
|
12621
12654
|
insertText: "",
|
|
12622
12655
|
expectsFollowingTable: !0
|
|
12623
12656
|
});
|
|
12624
|
-
if (
|
|
12625
|
-
if (l) return
|
|
12657
|
+
if (p && a.length >= 2) {
|
|
12658
|
+
if (l) return ne({
|
|
12626
12659
|
kind: "insert_after",
|
|
12627
12660
|
targetText: a[0],
|
|
12628
12661
|
insertText: a[1],
|
|
12629
|
-
expectsFollowingTable:
|
|
12662
|
+
expectsFollowingTable: g
|
|
12630
12663
|
});
|
|
12631
|
-
if (u) return
|
|
12664
|
+
if (u) return ne({
|
|
12632
12665
|
kind: "insert_before",
|
|
12633
12666
|
targetText: a[0],
|
|
12634
12667
|
insertText: a[1],
|
|
12635
|
-
expectsFollowingTable:
|
|
12668
|
+
expectsFollowingTable: g
|
|
12636
12669
|
});
|
|
12637
12670
|
}
|
|
12638
|
-
return
|
|
12671
|
+
return p && a.length === 1 ? ne(l ? {
|
|
12639
12672
|
kind: "insert_after",
|
|
12640
12673
|
targetText: "",
|
|
12641
12674
|
insertText: a[0],
|
|
12642
|
-
expectsFollowingTable:
|
|
12643
|
-
} : u ? {
|
|
12675
|
+
expectsFollowingTable: g
|
|
12676
|
+
} : u || d === "start" ? {
|
|
12644
12677
|
kind: "insert_before",
|
|
12645
12678
|
targetText: "",
|
|
12646
12679
|
insertText: a[0],
|
|
12647
|
-
expectsFollowingTable:
|
|
12680
|
+
expectsFollowingTable: g
|
|
12648
12681
|
} : {
|
|
12649
12682
|
kind: "insert_after",
|
|
12650
12683
|
targetText: "",
|
|
12651
12684
|
insertText: a[0],
|
|
12652
|
-
expectsFollowingTable:
|
|
12685
|
+
expectsFollowingTable: g
|
|
12653
12686
|
}) : null;
|
|
12654
12687
|
}
|
|
12655
|
-
function
|
|
12656
|
-
let t =
|
|
12688
|
+
function L_(e) {
|
|
12689
|
+
let t = uh(e);
|
|
12657
12690
|
return /\bapres\b/.test(t) && /\bla\s+fin\s+(?:(?:de\s+l['’]?)|d['’]?|de|du|des)?\s*$/u.test(t);
|
|
12658
12691
|
}
|
|
12659
|
-
function
|
|
12692
|
+
function R_(e) {
|
|
12660
12693
|
switch (e.kind) {
|
|
12661
12694
|
case "insert_after":
|
|
12662
12695
|
case "insert_before": return {
|
|
@@ -12700,7 +12733,7 @@ function I_(e) {
|
|
|
12700
12733
|
case "delete_article": return { kind: "delete_article" };
|
|
12701
12734
|
}
|
|
12702
12735
|
}
|
|
12703
|
-
function
|
|
12736
|
+
function z_(e) {
|
|
12704
12737
|
let t = (t) => {
|
|
12705
12738
|
let n = e[t];
|
|
12706
12739
|
return typeof n == "string" ? n : "";
|
|
@@ -12717,7 +12750,7 @@ function L_(e) {
|
|
|
12717
12750
|
o
|
|
12718
12751
|
].join("|");
|
|
12719
12752
|
}
|
|
12720
|
-
function
|
|
12753
|
+
function B_(e, t, n) {
|
|
12721
12754
|
return t.targetType === n.targetType && JSON.stringify(t.reference) === JSON.stringify(n.reference) && JSON.stringify(t.portionSelectors) === JSON.stringify(n.portionSelectors) ? e : {
|
|
12722
12755
|
...e,
|
|
12723
12756
|
targetType: t.targetType,
|
|
@@ -12725,10 +12758,10 @@ function R_(e, t, n) {
|
|
|
12725
12758
|
portionSelectors: t.portionSelectors
|
|
12726
12759
|
};
|
|
12727
12760
|
}
|
|
12728
|
-
function
|
|
12729
|
-
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));
|
|
12730
12763
|
}
|
|
12731
|
-
function
|
|
12764
|
+
function H_(e) {
|
|
12732
12765
|
let t = [];
|
|
12733
12766
|
for (let n = 0; n < e.length; n += 1) {
|
|
12734
12767
|
let r = e[n];
|
|
@@ -12743,14 +12776,14 @@ function B_(e) {
|
|
|
12743
12776
|
continue;
|
|
12744
12777
|
}
|
|
12745
12778
|
let o = i[0], s = [];
|
|
12746
|
-
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({
|
|
12747
12780
|
directiveIndex: e,
|
|
12748
12781
|
operationIndex: n,
|
|
12749
12782
|
operation: r
|
|
12750
12783
|
});
|
|
12751
12784
|
let c = /* @__PURE__ */ new Set(), l = [];
|
|
12752
12785
|
for (let e = s.length - 1; e >= 0; --e) {
|
|
12753
|
-
let t = s[e], n =
|
|
12786
|
+
let t = s[e], n = z_(t.operation);
|
|
12754
12787
|
c.has(n) || (c.add(n), l.push(t));
|
|
12755
12788
|
}
|
|
12756
12789
|
l.sort((e, t) => e.directiveIndex - t.directiveIndex || e.operationIndex - t.operationIndex), t.push({
|
|
@@ -12769,14 +12802,14 @@ function B_(e) {
|
|
|
12769
12802
|
}
|
|
12770
12803
|
return t;
|
|
12771
12804
|
}
|
|
12772
|
-
function
|
|
12773
|
-
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));
|
|
12774
12807
|
if (!f) return null;
|
|
12775
|
-
let p =
|
|
12808
|
+
let p = E_(f, s), m = r_(r), h = {
|
|
12776
12809
|
...m ? { applicabilityDate: m } : {},
|
|
12777
12810
|
sourcePosition: n,
|
|
12778
12811
|
sourceText: r
|
|
12779
|
-
}, g =
|
|
12812
|
+
}, g = C_(c, l), _ = (e) => {
|
|
12780
12813
|
switch (e.kind) {
|
|
12781
12814
|
case "insert_after":
|
|
12782
12815
|
case "insert_before": return {
|
|
@@ -12838,7 +12871,7 @@ function V_({ action: e, reference: t, sourcePosition: n, sourceText: r, fullTex
|
|
|
12838
12871
|
insertText: e.insertText,
|
|
12839
12872
|
...e.insertLayout ? { insertLayout: e.insertLayout } : {},
|
|
12840
12873
|
...e.expectsFollowingTable && g ? { citation: g } : {},
|
|
12841
|
-
...
|
|
12874
|
+
...__(a) ? { tableTarget: a } : {},
|
|
12842
12875
|
...h
|
|
12843
12876
|
};
|
|
12844
12877
|
case "replace": return {
|
|
@@ -12855,7 +12888,7 @@ function V_({ action: e, reference: t, sourcePosition: n, sourceText: r, fullTex
|
|
|
12855
12888
|
...e.occurrenceIndex === void 0 ? {} : { occurrenceIndex: e.occurrenceIndex },
|
|
12856
12889
|
...e.targetOccurrenceCount === void 0 ? {} : { targetOccurrenceCount: e.targetOccurrenceCount },
|
|
12857
12890
|
...e.targetScope ? { targetScope: e.targetScope } : {},
|
|
12858
|
-
...
|
|
12891
|
+
...__(a) ? { tableTarget: a } : {},
|
|
12859
12892
|
...h
|
|
12860
12893
|
};
|
|
12861
12894
|
case "replace_portion": return e.replacement.type === "following_table" && !g ? null : {
|
|
@@ -12867,11 +12900,11 @@ function V_({ action: e, reference: t, sourcePosition: n, sourceText: r, fullTex
|
|
|
12867
12900
|
replacement: e.replacement,
|
|
12868
12901
|
...e.replacementLayout ? { replacementLayout: e.replacementLayout } : {},
|
|
12869
12902
|
...e.replacement.type === "following_table" && g ? { citation: g } : {},
|
|
12870
|
-
...
|
|
12903
|
+
...__(a) ? { tableTarget: a } : {},
|
|
12871
12904
|
...h
|
|
12872
12905
|
};
|
|
12873
12906
|
case "delete": {
|
|
12874
|
-
let n = d.map((e) =>
|
|
12907
|
+
let n = d.map((e) => w_(u, e.start)), r = /* @__PURE__ */ new Map();
|
|
12875
12908
|
for (let [e, t] of d.entries()) r.has(t.text) || r.set(t.text, n[e] ?? null);
|
|
12876
12909
|
let i = [e.targetText, ...e.extraTargetTexts ?? []].filter((e) => e && e.trim().length > 0).filter((e, t, n) => n.indexOf(e) === t);
|
|
12877
12910
|
return i.length > 1 ? v(i.map((t) => ({
|
|
@@ -12880,7 +12913,7 @@ function V_({ action: e, reference: t, sourcePosition: n, sourceText: r, fullTex
|
|
|
12880
12913
|
...e.targetScope ? { targetScope: e.targetScope } : {},
|
|
12881
12914
|
occurrenceIndex: r.get(t) ?? void 0,
|
|
12882
12915
|
...t === e.targetText && e.targetOccurrenceCount !== void 0 ? { targetOccurrenceCount: e.targetOccurrenceCount } : {},
|
|
12883
|
-
...
|
|
12916
|
+
...__(a) ? { tableTarget: a } : {}
|
|
12884
12917
|
}))) : {
|
|
12885
12918
|
kind: "delete",
|
|
12886
12919
|
targetType: o,
|
|
@@ -12890,7 +12923,7 @@ function V_({ action: e, reference: t, sourcePosition: n, sourceText: r, fullTex
|
|
|
12890
12923
|
...e.targetScope ? { targetScope: e.targetScope } : {},
|
|
12891
12924
|
occurrenceIndex: r.get(e.targetText) ?? void 0,
|
|
12892
12925
|
...e.targetOccurrenceCount === void 0 ? {} : { targetOccurrenceCount: e.targetOccurrenceCount },
|
|
12893
|
-
...
|
|
12926
|
+
...__(a) ? { tableTarget: a } : {},
|
|
12894
12927
|
...h
|
|
12895
12928
|
};
|
|
12896
12929
|
}
|
|
@@ -12899,7 +12932,7 @@ function V_({ action: e, reference: t, sourcePosition: n, sourceText: r, fullTex
|
|
|
12899
12932
|
targetType: o,
|
|
12900
12933
|
reference: t,
|
|
12901
12934
|
portionSelectors: s,
|
|
12902
|
-
...
|
|
12935
|
+
...__(a) ? { tableTarget: a } : {},
|
|
12903
12936
|
...h
|
|
12904
12937
|
};
|
|
12905
12938
|
case "delete_article": return o === "article" ? {
|
|
@@ -12923,7 +12956,7 @@ function V_({ action: e, reference: t, sourcePosition: n, sourceText: r, fullTex
|
|
|
12923
12956
|
}
|
|
12924
12957
|
return y(p);
|
|
12925
12958
|
}
|
|
12926
|
-
function
|
|
12959
|
+
function W_(e) {
|
|
12927
12960
|
let t = /\barticle\s+([0-9]+(?:-[0-9]+)?(?:\s*[A-Z])?(?:\s+[a-z]+)?)\b/i.exec(e);
|
|
12928
12961
|
if (!t || t.index === void 0) return null;
|
|
12929
12962
|
let n = t.index, r = t.index + t[0].length;
|
|
@@ -12942,73 +12975,73 @@ function H_(e) {
|
|
|
12942
12975
|
}
|
|
12943
12976
|
};
|
|
12944
12977
|
}
|
|
12945
|
-
function
|
|
12978
|
+
function G_(e, t) {
|
|
12946
12979
|
let n = performance.now(), r = be(e);
|
|
12947
12980
|
Q(t.diagnostics, "simplifyMs", n);
|
|
12948
12981
|
let i = r.output;
|
|
12949
12982
|
if (t.allowListExtraction) {
|
|
12950
|
-
let e = performance.now(), n =
|
|
12983
|
+
let e = performance.now(), n = y_(i, t.diagnostics);
|
|
12951
12984
|
if (Q(t.diagnostics, "listExtractionMs", e), n) return t.diagnostics !== void 0 && (t.diagnostics.directiveCount = n.length), n;
|
|
12952
12985
|
}
|
|
12953
|
-
let a = performance.now(), o =
|
|
12986
|
+
let a = performance.now(), o = Rh(i), s = P_(i), c = Vh(i);
|
|
12954
12987
|
Q(t.diagnostics, "prepareRangesMs", a);
|
|
12955
|
-
let l = new x(i), u = performance.now(), d =
|
|
12988
|
+
let l = new x(i), u = performance.now(), d = eh(l);
|
|
12956
12989
|
Q(t.diagnostics, "extractReferencesMs", u);
|
|
12957
12990
|
let f = [...o, ...s];
|
|
12958
12991
|
if (f.length > 0) {
|
|
12959
12992
|
let e = performance.now();
|
|
12960
|
-
d = d.filter((e) => !
|
|
12993
|
+
d = d.filter((e) => !F_(e, f)), Q(t.diagnostics, "filterReferencesMs", e);
|
|
12961
12994
|
}
|
|
12962
12995
|
if (d.length === 0) {
|
|
12963
12996
|
let e = performance.now();
|
|
12964
|
-
d =
|
|
12997
|
+
d = eh(new x(c.split(",")[0] ?? c)), Q(t.diagnostics, "fallbackReferencesMs", e);
|
|
12965
12998
|
}
|
|
12966
12999
|
if (d.length === 0) {
|
|
12967
|
-
let e = performance.now(), n =
|
|
13000
|
+
let e = performance.now(), n = W_(c);
|
|
12968
13001
|
n && (d = [{
|
|
12969
13002
|
...n.reference,
|
|
12970
13003
|
position: n.position
|
|
12971
13004
|
}]), Q(t.diagnostics, "fallbackReferencesMs", e);
|
|
12972
13005
|
}
|
|
12973
13006
|
t.diagnostics !== void 0 && (t.diagnostics.referenceCount = d.length);
|
|
12974
|
-
let p = performance.now(), m =
|
|
13007
|
+
let p = performance.now(), m = Og(c);
|
|
12975
13008
|
if (d.length === 1 && d[0]?.type === "article") {
|
|
12976
|
-
let e =
|
|
13009
|
+
let e = Nh(c, { actionIndex: m ?? c.length });
|
|
12977
13010
|
e && (d = [e]);
|
|
12978
13011
|
}
|
|
12979
13012
|
if (m !== null) {
|
|
12980
|
-
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);
|
|
12981
13014
|
if (!e && a && a === r && (d = [r]), !t) {
|
|
12982
13015
|
let e = i, t = n.indexOf(":");
|
|
12983
13016
|
if (t !== -1) {
|
|
12984
|
-
let r = t + 1, i =
|
|
12985
|
-
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)]);
|
|
12986
13019
|
}
|
|
12987
13020
|
}
|
|
12988
13021
|
if (t) {
|
|
12989
|
-
let e = d.map(
|
|
12990
|
-
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));
|
|
12991
13024
|
}
|
|
12992
13025
|
}
|
|
12993
13026
|
Q(t.diagnostics, "refineReferencesMs", p);
|
|
12994
13027
|
let h = [], g = performance.now();
|
|
12995
13028
|
for (let e of d) {
|
|
12996
13029
|
if (e.type === "reference_et_action") {
|
|
12997
|
-
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 = {
|
|
12998
13031
|
start: r,
|
|
12999
13032
|
stop: i.length
|
|
13000
|
-
}, o = i.slice(r), s =
|
|
13033
|
+
}, o = i.slice(r), s = U_({
|
|
13001
13034
|
action: e.action,
|
|
13002
13035
|
reference: e.reference,
|
|
13003
13036
|
sourcePosition: a,
|
|
13004
13037
|
sourceText: o,
|
|
13005
13038
|
fullText: i,
|
|
13006
|
-
tableTarget:
|
|
13039
|
+
tableTarget: D_(o) ?? D_(i)
|
|
13007
13040
|
});
|
|
13008
13041
|
s && (Array.isArray(s) ? h.push(...s) : h.push(s));
|
|
13009
13042
|
continue;
|
|
13010
13043
|
}
|
|
13011
|
-
let t =
|
|
13044
|
+
let t = U_({
|
|
13012
13045
|
action: { action: "modifier" },
|
|
13013
13046
|
reference: e,
|
|
13014
13047
|
sourcePosition: e.position ?? {
|
|
@@ -13017,92 +13050,92 @@ function U_(e, t) {
|
|
|
13017
13050
|
},
|
|
13018
13051
|
sourceText: i,
|
|
13019
13052
|
fullText: i,
|
|
13020
|
-
tableTarget:
|
|
13053
|
+
tableTarget: D_(i)
|
|
13021
13054
|
});
|
|
13022
13055
|
t && (Array.isArray(t) ? h.push(...t) : h.push(t));
|
|
13023
13056
|
}
|
|
13024
13057
|
if (h.length === 0) {
|
|
13025
|
-
let e =
|
|
13058
|
+
let e = W_(c);
|
|
13026
13059
|
if (e) {
|
|
13027
|
-
let t =
|
|
13060
|
+
let t = U_({
|
|
13028
13061
|
action: { action: "modifier" },
|
|
13029
13062
|
reference: e.reference,
|
|
13030
13063
|
sourcePosition: e.position,
|
|
13031
13064
|
sourceText: i,
|
|
13032
13065
|
fullText: i,
|
|
13033
|
-
tableTarget:
|
|
13066
|
+
tableTarget: D_(i)
|
|
13034
13067
|
});
|
|
13035
13068
|
t && (Array.isArray(t) ? h.push(...t) : h.push(t));
|
|
13036
13069
|
}
|
|
13037
13070
|
}
|
|
13038
13071
|
Q(t.diagnostics, "buildDirectivesMs", g);
|
|
13039
|
-
let _ = performance.now(), v =
|
|
13072
|
+
let _ = performance.now(), v = H_(h);
|
|
13040
13073
|
return Q(t.diagnostics, "canonicalizeMs", _), t.diagnostics !== void 0 && (t.diagnostics.directiveCount = v.length), v;
|
|
13041
13074
|
}
|
|
13042
|
-
function
|
|
13075
|
+
function K_(e) {
|
|
13043
13076
|
let t = new x(be(e).output);
|
|
13044
|
-
return [...
|
|
13077
|
+
return [...ag.extract(t, { overlapWindow: 100 })];
|
|
13045
13078
|
}
|
|
13046
|
-
function
|
|
13047
|
-
return
|
|
13079
|
+
function q_(e, t) {
|
|
13080
|
+
return G_(e, {
|
|
13048
13081
|
allowListExtraction: !0,
|
|
13049
13082
|
diagnostics: t
|
|
13050
13083
|
});
|
|
13051
13084
|
}
|
|
13052
|
-
var
|
|
13053
|
-
function
|
|
13054
|
-
let t =
|
|
13055
|
-
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);
|
|
13056
13089
|
}
|
|
13057
|
-
function
|
|
13090
|
+
function X_(e) {
|
|
13058
13091
|
return e.trimStart().startsWith("«");
|
|
13059
13092
|
}
|
|
13060
|
-
function
|
|
13093
|
+
function Z_(e) {
|
|
13061
13094
|
return /»[.;]?\s*$/u.test(e);
|
|
13062
13095
|
}
|
|
13063
|
-
function
|
|
13096
|
+
function Q_(e, t) {
|
|
13064
13097
|
for (let n = t; n < e.length; n += 1) {
|
|
13065
|
-
let t =
|
|
13098
|
+
let t = bg(e[n]).trim();
|
|
13066
13099
|
if (t.length > 0) return t;
|
|
13067
13100
|
}
|
|
13068
13101
|
}
|
|
13069
|
-
function
|
|
13102
|
+
function $_(e, t) {
|
|
13070
13103
|
let n = [], r = !1, i = t + 1;
|
|
13071
13104
|
for (; i < e.length;) {
|
|
13072
|
-
let t = e[i], a =
|
|
13105
|
+
let t = e[i], a = bg(t);
|
|
13073
13106
|
if (!r && a.includes("«") && (r = !0), r) {
|
|
13074
13107
|
n.push(a);
|
|
13075
|
-
let t =
|
|
13076
|
-
if (
|
|
13108
|
+
let t = Q_(e, i + 1);
|
|
13109
|
+
if (Z_(a) && (t === void 0 || !X_(t))) break;
|
|
13077
13110
|
} else if (a.trim().length > 0) break;
|
|
13078
13111
|
i += 1;
|
|
13079
13112
|
}
|
|
13080
13113
|
return !r || n.length === 0 ? null : {
|
|
13081
|
-
combinedText: [
|
|
13114
|
+
combinedText: [bg(e[t]), ...n].join("\n"),
|
|
13082
13115
|
endIndex: i
|
|
13083
13116
|
};
|
|
13084
13117
|
}
|
|
13085
|
-
function
|
|
13118
|
+
function ev(e) {
|
|
13086
13119
|
let t = v()(e).output.split("\n").map((e) => e.trim()).filter((e) => e.length > 0), n = [];
|
|
13087
13120
|
for (let e = 0; e < t.length; e += 1) {
|
|
13088
13121
|
let r = t[e];
|
|
13089
|
-
if (
|
|
13090
|
-
let r =
|
|
13122
|
+
if (Y_(r)) {
|
|
13123
|
+
let r = $_(t, e);
|
|
13091
13124
|
if (r) {
|
|
13092
|
-
let t =
|
|
13125
|
+
let t = q_(r.combinedText);
|
|
13093
13126
|
if (t.length > 0) {
|
|
13094
13127
|
n.push(...t), e = r.endIndex;
|
|
13095
13128
|
continue;
|
|
13096
13129
|
}
|
|
13097
13130
|
}
|
|
13098
13131
|
}
|
|
13099
|
-
let i =
|
|
13132
|
+
let i = G_(r, { allowListExtraction: !1 });
|
|
13100
13133
|
i.length > 0 && n.push(...i);
|
|
13101
13134
|
}
|
|
13102
13135
|
return n;
|
|
13103
13136
|
}
|
|
13104
|
-
var
|
|
13105
|
-
function
|
|
13137
|
+
var tv = ev, nv;
|
|
13138
|
+
function rv(e) {
|
|
13106
13139
|
return {
|
|
13107
13140
|
dateDebut: e.dateDebut ?? "0001-01-01",
|
|
13108
13141
|
dateFin: e.dateFin ?? "2999-01-01",
|
|
@@ -13111,7 +13144,7 @@ function tv(e) {
|
|
|
13111
13144
|
textId: e.textId
|
|
13112
13145
|
};
|
|
13113
13146
|
}
|
|
13114
|
-
function
|
|
13147
|
+
function iv(e) {
|
|
13115
13148
|
if (e.length === 0) return;
|
|
13116
13149
|
let t = /* @__PURE__ */ new Map();
|
|
13117
13150
|
for (let n of e) {
|
|
@@ -13130,7 +13163,7 @@ function nv(e) {
|
|
|
13130
13163
|
let [{ id: n }] = [...t.values()];
|
|
13131
13164
|
return { articleId: n };
|
|
13132
13165
|
}
|
|
13133
|
-
function
|
|
13166
|
+
function av(e) {
|
|
13134
13167
|
let t = e["@id"];
|
|
13135
13168
|
return t === void 0 ? null : {
|
|
13136
13169
|
dateDebut: e["@debut"] ?? null,
|
|
@@ -13140,10 +13173,10 @@ function rv(e) {
|
|
|
13140
13173
|
title: e["#text"] ?? null
|
|
13141
13174
|
};
|
|
13142
13175
|
}
|
|
13143
|
-
function
|
|
13176
|
+
function ov(e, t) {
|
|
13144
13177
|
return (e.dateDebut === null || e.dateDebut <= t) && (e.dateFin === null || e.dateFin >= t);
|
|
13145
13178
|
}
|
|
13146
|
-
var
|
|
13179
|
+
var sv = class extends Ae {
|
|
13147
13180
|
canutesDb;
|
|
13148
13181
|
articleHistoryInfoByTextAndNum = /* @__PURE__ */ new Map();
|
|
13149
13182
|
articleRowsByNumByTextAndDate = /* @__PURE__ */ new Map();
|
|
@@ -13169,12 +13202,12 @@ var av = class extends Ae {
|
|
|
13169
13202
|
WHERE
|
|
13170
13203
|
data -> 'CONTEXTE' -> 'TEXTE' ->> '@cid' = ${n}
|
|
13171
13204
|
AND num = ${t}
|
|
13172
|
-
`).map(
|
|
13205
|
+
`).map(rv), this.articleRowsByNumByTextAndDate.set(r, i)), i;
|
|
13173
13206
|
}
|
|
13174
13207
|
async getArticleHistoryInfo({ num: e, textId: t }) {
|
|
13175
13208
|
if (e === void 0) return;
|
|
13176
13209
|
let n = `${t}\0${e}`, r = this.articleHistoryInfoByTextAndNum.get(n);
|
|
13177
|
-
return r === void 0 && (r =
|
|
13210
|
+
return r === void 0 && (r = iv(await this.canutesDb`
|
|
13178
13211
|
SELECT
|
|
13179
13212
|
id,
|
|
13180
13213
|
data -> 'META' -> 'META_SPEC' -> 'META_ARTICLE' ->> 'DATE_DEBUT' AS "dateDebut",
|
|
@@ -13197,7 +13230,7 @@ var av = class extends Ae {
|
|
|
13197
13230
|
SELECT data
|
|
13198
13231
|
FROM legifrance.textelr
|
|
13199
13232
|
WHERE id = ${t}
|
|
13200
|
-
`)[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);
|
|
13201
13234
|
}
|
|
13202
13235
|
return r;
|
|
13203
13236
|
}
|
|
@@ -13240,7 +13273,7 @@ var av = class extends Ae {
|
|
|
13240
13273
|
FROM legifrance.article
|
|
13241
13274
|
WHERE num = ${t}
|
|
13242
13275
|
LIMIT 100
|
|
13243
|
-
`).map(
|
|
13276
|
+
`).map(rv), this.globalArticleRowsByNumAndDate.set(n, r)), r;
|
|
13244
13277
|
}
|
|
13245
13278
|
async preloadTextTitlesInfos(e = {}) {
|
|
13246
13279
|
let t = (t, n = {}) => {
|
|
@@ -13255,7 +13288,7 @@ var av = class extends Ae {
|
|
|
13255
13288
|
return;
|
|
13256
13289
|
}
|
|
13257
13290
|
let n = new Ee("canutes.preloadTextTitlesInfos");
|
|
13258
|
-
|
|
13291
|
+
nv === void 0 ? (t("queryTextTitlesInfos:start"), nv = (async () => {
|
|
13259
13292
|
let e = await n.time("queryTextTitlesInfos", () => this.canutesDb`
|
|
13260
13293
|
SELECT
|
|
13261
13294
|
data -> 'META' -> 'META_SPEC' -> 'META_TEXTE_CHRONICLE' ->> 'CID' AS cid,
|
|
@@ -13285,8 +13318,8 @@ var av = class extends Ae {
|
|
|
13285
13318
|
`);
|
|
13286
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");
|
|
13287
13320
|
})().catch((e) => {
|
|
13288
|
-
throw
|
|
13289
|
-
})) : 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;
|
|
13290
13323
|
}
|
|
13291
13324
|
async preloadUniqueActiveArticlesByNums({ date: e, nums: t }) {
|
|
13292
13325
|
let n = [...new Set([...t].filter(Boolean))].filter((t) => !this.globalArticleRowsByNumAndDate.has(`${t}\0${e}`));
|
|
@@ -13300,7 +13333,7 @@ var av = class extends Ae {
|
|
|
13300
13333
|
data -> 'META' -> 'META_SPEC' -> 'META_ARTICLE' ->> 'DATE_FIN' AS "dateFin"
|
|
13301
13334
|
FROM legifrance.article
|
|
13302
13335
|
WHERE num IN ${this.canutesDb(n)}
|
|
13303
|
-
`).map(
|
|
13336
|
+
`).map(rv), i = /* @__PURE__ */ new Map();
|
|
13304
13337
|
for (let e of r) {
|
|
13305
13338
|
if (e.num === null) continue;
|
|
13306
13339
|
let t = i.get(e.num);
|
|
@@ -13311,7 +13344,7 @@ var av = class extends Ae {
|
|
|
13311
13344
|
};
|
|
13312
13345
|
//#endregion
|
|
13313
13346
|
//#region src/lib/extractors/links.ts
|
|
13314
|
-
function
|
|
13347
|
+
function cv() {
|
|
13315
13348
|
return {
|
|
13316
13349
|
citationCount: 0,
|
|
13317
13350
|
fastPath: {
|
|
@@ -13328,7 +13361,7 @@ function ov() {
|
|
|
13328
13361
|
}
|
|
13329
13362
|
};
|
|
13330
13363
|
}
|
|
13331
|
-
function
|
|
13364
|
+
function lv() {
|
|
13332
13365
|
return {
|
|
13333
13366
|
articleDefinitionLinkCount: 0,
|
|
13334
13367
|
articleDirectLookupMs: 0,
|
|
@@ -13358,7 +13391,7 @@ function sv() {
|
|
|
13358
13391
|
textLinkMs: 0
|
|
13359
13392
|
};
|
|
13360
13393
|
}
|
|
13361
|
-
function
|
|
13394
|
+
function uv() {
|
|
13362
13395
|
return {
|
|
13363
13396
|
alternativeTargetCandidateCount: 0,
|
|
13364
13397
|
getActiveArticlesByTextAndNumCount: 0,
|
|
@@ -13369,7 +13402,7 @@ function cv() {
|
|
|
13369
13402
|
uniqueFallbackCheckCount: 0
|
|
13370
13403
|
};
|
|
13371
13404
|
}
|
|
13372
|
-
function
|
|
13405
|
+
function dv(e, t, n, r, i) {
|
|
13373
13406
|
let a = e.get(t);
|
|
13374
13407
|
a === void 0 && (a = /* @__PURE__ */ new Map(), e.set(t, a));
|
|
13375
13408
|
let o = a.get(n) ?? {
|
|
@@ -13379,7 +13412,7 @@ function lv(e, t, n, r, i) {
|
|
|
13379
13412
|
};
|
|
13380
13413
|
o.count += 1, o.outputSize += i, o.totalMs += r, a.set(n, o);
|
|
13381
13414
|
}
|
|
13382
|
-
function
|
|
13415
|
+
function fv(e) {
|
|
13383
13416
|
return Object.fromEntries([...e.entries()].map(([e, t]) => {
|
|
13384
13417
|
let n = 0, r = 0, i = 0;
|
|
13385
13418
|
for (let e of t.values()) n += e.count, r += e.outputSize, i += e.totalMs;
|
|
@@ -13397,7 +13430,7 @@ function uv(e) {
|
|
|
13397
13430
|
}];
|
|
13398
13431
|
}));
|
|
13399
13432
|
}
|
|
13400
|
-
var
|
|
13433
|
+
var pv = class {
|
|
13401
13434
|
inner;
|
|
13402
13435
|
diagnostics;
|
|
13403
13436
|
constructor(e, t) {
|
|
@@ -13405,67 +13438,67 @@ var dv = class {
|
|
|
13405
13438
|
}
|
|
13406
13439
|
async getActiveArticlesByTextAndNum(e) {
|
|
13407
13440
|
let t = performance.now(), n = await this.inner.getActiveArticlesByTextAndNum(e);
|
|
13408
|
-
return
|
|
13441
|
+
return dv(this.diagnostics, "getActiveArticlesByTextAndNum", `${e.date}\0${e.textId}\0${e.num ?? ""}`, performance.now() - t, n.length), n;
|
|
13409
13442
|
}
|
|
13410
13443
|
async getArticleHistoryInfo(e) {
|
|
13411
13444
|
let t = performance.now(), n = await this.inner.getArticleHistoryInfo(e);
|
|
13412
|
-
return
|
|
13445
|
+
return dv(this.diagnostics, "getArticleHistoryInfo", `${e.textId}\0${e.num ?? ""}`, performance.now() - t, n === void 0 ? 0 : 1), n;
|
|
13413
13446
|
}
|
|
13414
13447
|
async getDirectSectionChildren(e) {
|
|
13415
13448
|
let t = performance.now(), n = await this.inner.getDirectSectionChildren(e);
|
|
13416
|
-
return
|
|
13449
|
+
return dv(this.diagnostics, "getDirectSectionChildren", `${e.date}\0${e.parentPath}`, performance.now() - t, n.length), n;
|
|
13417
13450
|
}
|
|
13418
13451
|
async getEuropeanTextUrl(e) {
|
|
13419
13452
|
let t = performance.now(), n = await this.inner.getEuropeanTextUrl(e);
|
|
13420
|
-
return
|
|
13453
|
+
return dv(this.diagnostics, "getEuropeanTextUrl", e, performance.now() - t, n === void 0 ? 0 : 1), n;
|
|
13421
13454
|
}
|
|
13422
13455
|
async getTextIdFromSegmentId(e) {
|
|
13423
13456
|
let t = performance.now(), n = await this.inner.getTextIdFromSegmentId(e);
|
|
13424
|
-
return
|
|
13457
|
+
return dv(this.diagnostics, "getTextIdFromSegmentId", e, performance.now() - t, n === void 0 ? 0 : 1), n;
|
|
13425
13458
|
}
|
|
13426
13459
|
async getUniqueActiveArticlesByNum(e) {
|
|
13427
13460
|
let t = performance.now(), n = await this.inner.getUniqueActiveArticlesByNum(e);
|
|
13428
|
-
return
|
|
13461
|
+
return dv(this.diagnostics, "getUniqueActiveArticlesByNum", `${e.date}\0${e.num ?? ""}`, performance.now() - t, n.length), n;
|
|
13429
13462
|
}
|
|
13430
13463
|
async preloadActiveArticlesByTextIds(e) {
|
|
13431
13464
|
let t = [...e.nums ?? []].filter((e) => e !== void 0).toSorted(), n = [...e.textIds].filter((e) => e !== void 0).toSorted(), r = performance.now();
|
|
13432
|
-
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));
|
|
13433
13466
|
}
|
|
13434
13467
|
async preloadTextTitlesInfos(e) {
|
|
13435
13468
|
let t = performance.now();
|
|
13436
|
-
await this.inner.preloadTextTitlesInfos(e),
|
|
13469
|
+
await this.inner.preloadTextTitlesInfos(e), dv(this.diagnostics, "preloadTextTitlesInfos", "all", performance.now() - t, 1);
|
|
13437
13470
|
}
|
|
13438
13471
|
async preloadUniqueActiveArticlesByNums(e) {
|
|
13439
13472
|
let t = [...e.nums].filter((e) => e !== void 0).toSorted(), n = performance.now();
|
|
13440
13473
|
await this.inner.preloadUniqueActiveArticlesByNums({
|
|
13441
13474
|
...e,
|
|
13442
13475
|
nums: t
|
|
13443
|
-
}),
|
|
13476
|
+
}), dv(this.diagnostics, "preloadUniqueActiveArticlesByNums", `${e.date}\0nums=${t.length}`, performance.now() - n, t.length);
|
|
13444
13477
|
}
|
|
13445
13478
|
};
|
|
13446
13479
|
function $(e, t, n) {
|
|
13447
13480
|
e[t] += Math.round((performance.now() - n) * 10) / 10;
|
|
13448
13481
|
}
|
|
13449
|
-
function
|
|
13482
|
+
function mv(e) {
|
|
13450
13483
|
let t = {};
|
|
13451
13484
|
for (let n of e) t[n.type] = (t[n.type] ?? 0) + 1;
|
|
13452
13485
|
return t;
|
|
13453
13486
|
}
|
|
13454
|
-
function
|
|
13487
|
+
function hv(e, t = 20) {
|
|
13455
13488
|
return Object.entries(e).map(([e, t]) => ({
|
|
13456
13489
|
count: t,
|
|
13457
13490
|
value: e
|
|
13458
13491
|
})).toSorted((e, t) => t.count - e.count).slice(0, t);
|
|
13459
13492
|
}
|
|
13460
|
-
async function*
|
|
13461
|
-
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));
|
|
13462
13495
|
if (l === void 0) throw Error("A Canutes database or legal resolver is required");
|
|
13463
|
-
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", () => {
|
|
13464
13497
|
let e = [];
|
|
13465
|
-
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);
|
|
13466
13499
|
return e;
|
|
13467
13500
|
}, { inputSize: t.input.length }), ee = performance.now();
|
|
13468
|
-
for (let e of b) for (let n of
|
|
13501
|
+
for (let e of b) for (let n of Lv(t, e)) {
|
|
13469
13502
|
let r = n.type === "parent-enfant" ? n.parent : n;
|
|
13470
13503
|
switch (r.type) {
|
|
13471
13504
|
case "alinéa":
|
|
@@ -13494,7 +13527,7 @@ async function* mv({ canutesDb: e, context: t, date: n, legiResolver: r, logIgno
|
|
|
13494
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`);
|
|
13495
13528
|
break;
|
|
13496
13529
|
case "texte":
|
|
13497
|
-
|
|
13530
|
+
_v({
|
|
13498
13531
|
context: t,
|
|
13499
13532
|
logPartialReferences: a,
|
|
13500
13533
|
reference: e,
|
|
@@ -13510,14 +13543,14 @@ async function* mv({ canutesDb: e, context: t, date: n, legiResolver: r, logIgno
|
|
|
13510
13543
|
phase: "collectDefinitionsAndTextState"
|
|
13511
13544
|
});
|
|
13512
13545
|
let te = /* @__PURE__ */ new Set();
|
|
13513
|
-
for (let e of b) for (let t of
|
|
13514
|
-
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);
|
|
13515
13548
|
await u.time("preloadActiveArticlesByTextIds", () => f.preloadActiveArticlesByTextIds({
|
|
13516
13549
|
date: n,
|
|
13517
13550
|
nums: te,
|
|
13518
13551
|
textIds: ne
|
|
13519
13552
|
}), { count: ne.size });
|
|
13520
|
-
let x = await u.time("collectUniqueFallbackArticleNums", () =>
|
|
13553
|
+
let x = await u.time("collectUniqueFallbackArticleNums", () => yv({
|
|
13521
13554
|
context: t,
|
|
13522
13555
|
date: n,
|
|
13523
13556
|
legiResolver: f,
|
|
@@ -13531,7 +13564,7 @@ async function* mv({ canutesDb: e, context: t, date: n, legiResolver: r, logIgno
|
|
|
13531
13564
|
nums: x
|
|
13532
13565
|
}), { count: x.size }), y = s === void 0 ? {} : s;
|
|
13533
13566
|
let re = 0, ie = performance.now();
|
|
13534
|
-
for (let e of b) for await (let r of
|
|
13567
|
+
for (let e of b) for await (let r of Hv({
|
|
13535
13568
|
articleDefinitionByNumByTextId: _,
|
|
13536
13569
|
legiResolver: f,
|
|
13537
13570
|
context: t,
|
|
@@ -13550,12 +13583,12 @@ async function* mv({ canutesDb: e, context: t, date: n, legiResolver: r, logIgno
|
|
|
13550
13583
|
phase: "iterReferenceLinks"
|
|
13551
13584
|
}), u.log({
|
|
13552
13585
|
articleNumCount: te.size,
|
|
13553
|
-
referenceTypeCounts:
|
|
13586
|
+
referenceTypeCounts: mv(b),
|
|
13554
13587
|
referenceCount: b.length,
|
|
13555
13588
|
iterationDiagnostics: m,
|
|
13556
|
-
resolverCallDiagnostics:
|
|
13589
|
+
resolverCallDiagnostics: fv(d),
|
|
13557
13590
|
resolverDiagnostics: h,
|
|
13558
|
-
topFastPathAnchors:
|
|
13591
|
+
topFastPathAnchors: hv(p.fastPath.anchorCounts),
|
|
13559
13592
|
uniqueFallbackArticleNumCount: x.size,
|
|
13560
13593
|
fastPathCandidateCount: p.fastPath.candidateCount,
|
|
13561
13594
|
fastPathCheckedOffsetCount: p.fastPath.checkedOffsetCount,
|
|
@@ -13569,7 +13602,7 @@ async function* mv({ canutesDb: e, context: t, date: n, legiResolver: r, logIgno
|
|
|
13569
13602
|
extractReferencesCitationCount: p.citationCount
|
|
13570
13603
|
});
|
|
13571
13604
|
}
|
|
13572
|
-
function
|
|
13605
|
+
function _v({ context: e, logPartialReferences: t, reference: n, state: r, text: i }) {
|
|
13573
13606
|
switch (i.nature) {
|
|
13574
13607
|
case "ARRETE":
|
|
13575
13608
|
case "CIRCULAIRE":
|
|
@@ -13640,17 +13673,17 @@ function hv({ context: e, logPartialReferences: t, reference: n, state: r, text:
|
|
|
13640
13673
|
default: i.nature === void 0 ? delete r.textId : m("nature", i.nature);
|
|
13641
13674
|
}
|
|
13642
13675
|
}
|
|
13643
|
-
function
|
|
13676
|
+
function vv(e, t) {
|
|
13644
13677
|
let n = /* @__PURE__ */ new Set();
|
|
13645
|
-
for (let r of t) for (let t of
|
|
13678
|
+
for (let r of t) for (let t of Lv(e, r, { citations: !0 })) {
|
|
13646
13679
|
let e = t.type === "parent-enfant" ? t.parent : t;
|
|
13647
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);
|
|
13648
13681
|
}
|
|
13649
13682
|
return n;
|
|
13650
13683
|
}
|
|
13651
|
-
async function
|
|
13684
|
+
async function yv({ context: e, date: t, legiResolver: n, logPartialReferences: r, resolverDiagnostics: i, references: a, state: o }) {
|
|
13652
13685
|
let s = /* @__PURE__ */ new Set();
|
|
13653
|
-
for (let c of a) await
|
|
13686
|
+
for (let c of a) await bv({
|
|
13654
13687
|
articleNums: s,
|
|
13655
13688
|
context: e,
|
|
13656
13689
|
date: t,
|
|
@@ -13662,8 +13695,8 @@ async function _v({ context: e, date: t, legiResolver: n, logPartialReferences:
|
|
|
13662
13695
|
});
|
|
13663
13696
|
return s;
|
|
13664
13697
|
}
|
|
13665
|
-
async function
|
|
13666
|
-
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({
|
|
13667
13700
|
articleNums: e,
|
|
13668
13701
|
atomicOrParentChildReference: c,
|
|
13669
13702
|
context: t,
|
|
@@ -13679,7 +13712,7 @@ async function vv({ articleNums: e, context: t, date: n, legiResolver: r, logPar
|
|
|
13679
13712
|
if (c !== void 0) {
|
|
13680
13713
|
for (let o of c) if (o.references !== void 0) {
|
|
13681
13714
|
let c = structuredClone(s);
|
|
13682
|
-
for (let s of o.references) await
|
|
13715
|
+
for (let s of o.references) await bv({
|
|
13683
13716
|
articleNums: e,
|
|
13684
13717
|
context: t,
|
|
13685
13718
|
date: n,
|
|
@@ -13693,7 +13726,7 @@ async function vv({ articleNums: e, context: t, date: n, legiResolver: r, logPar
|
|
|
13693
13726
|
}
|
|
13694
13727
|
}
|
|
13695
13728
|
}
|
|
13696
|
-
async function
|
|
13729
|
+
async function xv({ articleNums: e, atomicOrParentChildReference: t, context: n, date: r, legiResolver: i, logPartialReferences: a, resolverDiagnostics: o, reference: s, state: c }) {
|
|
13697
13730
|
let l = t.type === "parent-enfant" ? t.parent : t, u = t.type === "parent-enfant" ? t : void 0;
|
|
13698
13731
|
switch (l.type) {
|
|
13699
13732
|
case "alinéa":
|
|
@@ -13702,7 +13735,7 @@ async function yv({ articleNums: e, atomicOrParentChildReference: t, context: n,
|
|
|
13702
13735
|
case "phrase": break;
|
|
13703
13736
|
case "article":
|
|
13704
13737
|
if (l.definition && c.textId !== void 0) break;
|
|
13705
|
-
await
|
|
13738
|
+
await Pv({
|
|
13706
13739
|
article: l,
|
|
13707
13740
|
date: r,
|
|
13708
13741
|
legiResolver: i,
|
|
@@ -13721,7 +13754,7 @@ async function yv({ articleNums: e, atomicOrParentChildReference: t, context: n,
|
|
|
13721
13754
|
case "sous-titre":
|
|
13722
13755
|
case "titre":
|
|
13723
13756
|
if (l.definition && c.textId !== void 0) break;
|
|
13724
|
-
u !== void 0 && await
|
|
13757
|
+
u !== void 0 && await bv({
|
|
13725
13758
|
articleNums: e,
|
|
13726
13759
|
context: n,
|
|
13727
13760
|
date: r,
|
|
@@ -13733,13 +13766,13 @@ async function yv({ articleNums: e, atomicOrParentChildReference: t, context: n,
|
|
|
13733
13766
|
});
|
|
13734
13767
|
break;
|
|
13735
13768
|
case "texte":
|
|
13736
|
-
|
|
13769
|
+
_v({
|
|
13737
13770
|
context: n,
|
|
13738
13771
|
logPartialReferences: a,
|
|
13739
13772
|
reference: s,
|
|
13740
13773
|
state: c,
|
|
13741
13774
|
text: l
|
|
13742
|
-
}), u !== void 0 && await
|
|
13775
|
+
}), u !== void 0 && await bv({
|
|
13743
13776
|
articleNums: e,
|
|
13744
13777
|
context: n,
|
|
13745
13778
|
date: r,
|
|
@@ -13753,14 +13786,14 @@ async function yv({ articleNums: e, atomicOrParentChildReference: t, context: n,
|
|
|
13753
13786
|
default: break;
|
|
13754
13787
|
}
|
|
13755
13788
|
}
|
|
13756
|
-
var
|
|
13789
|
+
var Sv = new Set([
|
|
13757
13790
|
"LEGITEXT000005634379",
|
|
13758
13791
|
"LEGITEXT000006069583",
|
|
13759
13792
|
"LEGITEXT000006070933",
|
|
13760
13793
|
"LEGITEXT000006072026",
|
|
13761
13794
|
"LEGITEXT000006073984",
|
|
13762
13795
|
"LEGITEXT000006074096"
|
|
13763
|
-
]),
|
|
13796
|
+
]), Cv = new Set([
|
|
13764
13797
|
"LEGITEXT000006069568",
|
|
13765
13798
|
"LEGITEXT000006069569",
|
|
13766
13799
|
"LEGITEXT000006069574",
|
|
@@ -13768,41 +13801,41 @@ var bv = new Set([
|
|
|
13768
13801
|
"LEGITEXT000006069577",
|
|
13769
13802
|
"LEGITEXT000006069583"
|
|
13770
13803
|
]);
|
|
13771
|
-
function
|
|
13804
|
+
function wv(e, t, n) {
|
|
13772
13805
|
let r = n.replace(/\s+/gu, " ").trim();
|
|
13773
13806
|
r !== "" && r !== t && e.add(r);
|
|
13774
13807
|
}
|
|
13775
|
-
function
|
|
13808
|
+
function Tv(e, t) {
|
|
13776
13809
|
let n = new Set([e]), r = new Set([e]);
|
|
13777
13810
|
for (let i = 0; i < 3; i++) {
|
|
13778
13811
|
let i = /* @__PURE__ */ new Set();
|
|
13779
13812
|
for (let a of r) {
|
|
13780
13813
|
let r = /* @__PURE__ */ new Set();
|
|
13781
|
-
|
|
13782
|
-
for (let t of a.matchAll(/-(?=\p{L})/gu))
|
|
13783
|
-
|
|
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 "));
|
|
13784
13817
|
let o = a.match(/^((?:L\s*O|[LRDA])\*?\s*)(\d{4,})$/u);
|
|
13785
13818
|
if (o !== null) {
|
|
13786
13819
|
let [, t, n] = o;
|
|
13787
|
-
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)}`);
|
|
13788
13821
|
}
|
|
13789
|
-
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 [
|
|
13790
13823
|
"L",
|
|
13791
13824
|
"R",
|
|
13792
13825
|
"D",
|
|
13793
13826
|
"A",
|
|
13794
13827
|
"R*",
|
|
13795
13828
|
"*R"
|
|
13796
|
-
])
|
|
13797
|
-
|
|
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"));
|
|
13798
13831
|
for (let e of r) n.has(e) || (n.add(e), i.add(e));
|
|
13799
13832
|
}
|
|
13800
13833
|
r = i;
|
|
13801
13834
|
}
|
|
13802
13835
|
return n.delete(e), [...n];
|
|
13803
13836
|
}
|
|
13804
|
-
function
|
|
13805
|
-
if (!
|
|
13837
|
+
function Ev(e, t) {
|
|
13838
|
+
if (!Cv.has(t)) return [];
|
|
13806
13839
|
let n = [], r = e;
|
|
13807
13840
|
for (let e = 0; e < 4; e++) {
|
|
13808
13841
|
let e = r.replace(/(?:\s*-\s*|\s+)(?:[IVX]+|[1-9]\d*)(?:\s+(?:bis|ter|quater|quinquies|sexies))?$/iu, "").trim();
|
|
@@ -13811,10 +13844,10 @@ function wv(e, t) {
|
|
|
13811
13844
|
}
|
|
13812
13845
|
return n;
|
|
13813
13846
|
}
|
|
13814
|
-
function
|
|
13847
|
+
function Dv(e, t) {
|
|
13815
13848
|
return `${e}\0${t}`;
|
|
13816
13849
|
}
|
|
13817
|
-
var
|
|
13850
|
+
var Ov = new Map([
|
|
13818
13851
|
...[
|
|
13819
13852
|
"1594 F quinquies A",
|
|
13820
13853
|
"1594 F quinquies-D",
|
|
@@ -13822,7 +13855,7 @@ var Ev = new Map([
|
|
|
13822
13855
|
"1594 F quinquies E II",
|
|
13823
13856
|
"1594 F quinquies- E-I",
|
|
13824
13857
|
"1594 F quinquies K"
|
|
13825
|
-
].map((e) => [
|
|
13858
|
+
].map((e) => [Dv("LEGITEXT000006069577", e), {
|
|
13826
13859
|
num: "1594 F quinquies",
|
|
13827
13860
|
textId: "LEGITEXT000006069577"
|
|
13828
13861
|
}]),
|
|
@@ -13831,7 +13864,7 @@ var Ev = new Map([
|
|
|
13831
13864
|
"1594-0 G-A",
|
|
13832
13865
|
"1594-0 G-A-II",
|
|
13833
13866
|
"1594-0 G-A-VI"
|
|
13834
|
-
].map((e) => [
|
|
13867
|
+
].map((e) => [Dv("LEGITEXT000006069577", e), {
|
|
13835
13868
|
num: "1594-0 G",
|
|
13836
13869
|
textId: "LEGITEXT000006069577"
|
|
13837
13870
|
}]),
|
|
@@ -13843,23 +13876,23 @@ var Ev = new Map([
|
|
|
13843
13876
|
["38 B", "LEGITEXT000006069574"],
|
|
13844
13877
|
["49 octies D", "LEGITEXT000006069574"],
|
|
13845
13878
|
["199-0", "LEGITEXT000006069576"]
|
|
13846
|
-
].map(([e, t]) => [
|
|
13879
|
+
].map(([e, t]) => [Dv("LEGITEXT000006069577", e), {
|
|
13847
13880
|
num: e,
|
|
13848
13881
|
textId: t
|
|
13849
13882
|
}]),
|
|
13850
|
-
[
|
|
13883
|
+
[Dv("LEGITEXT000006069577", "L173"), {
|
|
13851
13884
|
num: "173",
|
|
13852
13885
|
textId: "LEGITEXT000006069577"
|
|
13853
13886
|
}],
|
|
13854
|
-
[
|
|
13887
|
+
[Dv("LEGITEXT000006069583", "L38 B"), {
|
|
13855
13888
|
num: "L38",
|
|
13856
13889
|
textId: "LEGITEXT000006069583"
|
|
13857
13890
|
}],
|
|
13858
|
-
...["L311-13 C", "L311-13 D"].map((e) => [
|
|
13891
|
+
...["L311-13 C", "L311-13 D"].map((e) => [Dv("LEGITEXT000006070158", e), {
|
|
13859
13892
|
num: "L311-13",
|
|
13860
13893
|
textId: "LEGITEXT000006070158"
|
|
13861
13894
|
}]),
|
|
13862
|
-
[
|
|
13895
|
+
[Dv("LEGITEXT000006071154", "226-14"), {
|
|
13863
13896
|
num: "226-14",
|
|
13864
13897
|
textId: "LEGITEXT000006070719"
|
|
13865
13898
|
}],
|
|
@@ -13867,17 +13900,17 @@ var Ev = new Map([
|
|
|
13867
13900
|
"1300-1",
|
|
13868
13901
|
"1300-2",
|
|
13869
13902
|
"1300-4"
|
|
13870
|
-
].map((e) => [
|
|
13903
|
+
].map((e) => [Dv("LEGITEXT000006070721", e), {
|
|
13871
13904
|
num: e,
|
|
13872
13905
|
textId: "LEGITEXT000006070716"
|
|
13873
13906
|
}])
|
|
13874
|
-
]),
|
|
13875
|
-
[
|
|
13876
|
-
[
|
|
13877
|
-
[
|
|
13878
|
-
[
|
|
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"]
|
|
13879
13912
|
]);
|
|
13880
|
-
function
|
|
13913
|
+
function Av(e, t) {
|
|
13881
13914
|
let n = /* @__PURE__ */ new Map(), r = (t, r) => {
|
|
13882
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();
|
|
13883
13916
|
i === "" || i === e || !/^(?:[LRDA]\s*)?\d+(?:-\d+)*(?:\s+(?:bis|ter|quater|quinquies|sexies|septies))?$/iu.test(i) || n.set(`${t}\0${i}`, {
|
|
@@ -13886,12 +13919,12 @@ function Ov(e, t) {
|
|
|
13886
13919
|
});
|
|
13887
13920
|
}, i = /^(.*\d)\s*[,,;]?\s*(css|cgi|cibs|lpf|cch|cja|casf|cgct|coj|cpi|csp|ceseda|cmf|comofi|cpce)$/iu.exec(e);
|
|
13888
13921
|
if (i !== null) {
|
|
13889
|
-
let e =
|
|
13922
|
+
let e = om(i[2]);
|
|
13890
13923
|
e !== void 0 && r(e, i[1]);
|
|
13891
13924
|
}
|
|
13892
13925
|
let a = /^(.*\d)[\s,;]+(?:du\s+|de\s+la\s+|de\s+l')?(code\b[\w'\s]*)$/iu.exec(e);
|
|
13893
13926
|
if (a !== null) {
|
|
13894
|
-
let e =
|
|
13927
|
+
let e = om(a[2]);
|
|
13895
13928
|
e !== void 0 && r(e, a[1]);
|
|
13896
13929
|
}
|
|
13897
13930
|
t !== void 0 && r(t, e);
|
|
@@ -13911,18 +13944,18 @@ function Ov(e, t) {
|
|
|
13911
13944
|
});
|
|
13912
13945
|
return o;
|
|
13913
13946
|
}
|
|
13914
|
-
function
|
|
13915
|
-
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)]));
|
|
13916
13949
|
if (t.size !== 1) return;
|
|
13917
|
-
let n =
|
|
13950
|
+
let n = kv.get([...t][0]);
|
|
13918
13951
|
if (n !== void 0) return e.find(({ id: e }) => e === n);
|
|
13919
13952
|
}
|
|
13920
|
-
function
|
|
13953
|
+
function Mv(e) {
|
|
13921
13954
|
if (e.length < 2) return;
|
|
13922
13955
|
let [t, ...n] = [...e].sort((e, t) => t.dateDebut.localeCompare(e.dateDebut));
|
|
13923
13956
|
if (!n.some(({ dateDebut: e }) => e >= t.dateDebut)) return t;
|
|
13924
13957
|
}
|
|
13925
|
-
async function
|
|
13958
|
+
async function Nv({ alternatives: e, date: t, legiResolver: n, resolverDiagnostics: r }) {
|
|
13926
13959
|
let i = [];
|
|
13927
13960
|
r.alternativeTargetCandidateCount += e.length;
|
|
13928
13961
|
for (let { num: a, textId: o } of e) {
|
|
@@ -13936,7 +13969,7 @@ async function jv({ alternatives: e, date: t, legiResolver: n, resolverDiagnosti
|
|
|
13936
13969
|
}
|
|
13937
13970
|
return i.length === 1 ? i[0] : [];
|
|
13938
13971
|
}
|
|
13939
|
-
async function
|
|
13972
|
+
async function Pv({ article: e, date: t, legiResolver: n, resolverDiagnostics: r, state: i }) {
|
|
13940
13973
|
if (r.uniqueFallbackCheckCount++, e.present || e.num === void 0) return !1;
|
|
13941
13974
|
let a = e.implicitText?.cid ?? i.textId;
|
|
13942
13975
|
return !(a !== void 0 && (r.getActiveArticlesByTextAndNumCount++, (await n.getActiveArticlesByTextAndNum({
|
|
@@ -13949,7 +13982,7 @@ async function Mv({ article: e, date: t, legiResolver: n, resolverDiagnostics: r
|
|
|
13949
13982
|
textId: i.defaultTextId
|
|
13950
13983
|
})).length > 0));
|
|
13951
13984
|
}
|
|
13952
|
-
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 }) {
|
|
13953
13986
|
let f = performance.now();
|
|
13954
13987
|
if (t.present) {
|
|
13955
13988
|
$(l, "articleLinkMs", f);
|
|
@@ -13968,10 +14001,10 @@ async function* Nv({ ancestors: e, article: t, legiResolver: n, context: r, date
|
|
|
13968
14001
|
}), $(l, "articleDirectLookupMs", e), p.length > 0 && (h = p);
|
|
13969
14002
|
}
|
|
13970
14003
|
if (p.length === 0 && t.num !== void 0 && m !== void 0) {
|
|
13971
|
-
let e =
|
|
14004
|
+
let e = Ov.get(Dv(m, t.num));
|
|
13972
14005
|
if (e !== void 0) {
|
|
13973
14006
|
let t = performance.now();
|
|
13974
|
-
p = await
|
|
14007
|
+
p = await Nv({
|
|
13975
14008
|
alternatives: [e],
|
|
13976
14009
|
date: i,
|
|
13977
14010
|
legiResolver: n,
|
|
@@ -13981,8 +14014,8 @@ async function* Nv({ ancestors: e, article: t, legiResolver: n, context: r, date
|
|
|
13981
14014
|
}
|
|
13982
14015
|
if (p.length === 0 && t.num !== void 0 && m !== void 0) {
|
|
13983
14016
|
let e = performance.now();
|
|
13984
|
-
p = await
|
|
13985
|
-
alternatives:
|
|
14017
|
+
p = await Nv({
|
|
14018
|
+
alternatives: Tv(t.num, m).map((e) => ({
|
|
13986
14019
|
num: e,
|
|
13987
14020
|
textId: m
|
|
13988
14021
|
})),
|
|
@@ -13993,8 +14026,8 @@ async function* Nv({ ancestors: e, article: t, legiResolver: n, context: r, date
|
|
|
13993
14026
|
}
|
|
13994
14027
|
if (p.length === 0 && t.num !== void 0 && m !== void 0) {
|
|
13995
14028
|
let e = performance.now();
|
|
13996
|
-
p = await
|
|
13997
|
-
alternatives:
|
|
14029
|
+
p = await Nv({
|
|
14030
|
+
alternatives: Ev(t.num, m).map((e) => ({
|
|
13998
14031
|
num: e,
|
|
13999
14032
|
textId: m
|
|
14000
14033
|
})),
|
|
@@ -14004,7 +14037,7 @@ async function* Nv({ ancestors: e, article: t, legiResolver: n, context: r, date
|
|
|
14004
14037
|
}), $(l, "articleFiscalParentLookupMs", e);
|
|
14005
14038
|
}
|
|
14006
14039
|
let g = [];
|
|
14007
|
-
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({
|
|
14008
14041
|
alternatives: g,
|
|
14009
14042
|
date: i,
|
|
14010
14043
|
legiResolver: n,
|
|
@@ -14033,10 +14066,10 @@ async function* Nv({ ancestors: e, article: t, legiResolver: n, context: r, date
|
|
|
14033
14066
|
if (n.length === 1) d.articleId = n[0].id;
|
|
14034
14067
|
else {
|
|
14035
14068
|
n.length !== 0 && (p = n);
|
|
14036
|
-
let e =
|
|
14069
|
+
let e = jv(p);
|
|
14037
14070
|
if (e !== void 0) d.articleId = e.id;
|
|
14038
14071
|
else {
|
|
14039
|
-
let e =
|
|
14072
|
+
let e = Mv(p.filter(({ dateDebut: e, dateFin: t }) => e <= i && t > i));
|
|
14040
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;
|
|
14041
14074
|
}
|
|
14042
14075
|
}
|
|
@@ -14065,7 +14098,7 @@ async function* Nv({ ancestors: e, article: t, legiResolver: n, context: r, date
|
|
|
14065
14098
|
});
|
|
14066
14099
|
$(l, "articleHistoryLookupMs", e), r !== void 0 && (v = r.articleId);
|
|
14067
14100
|
} else if (h.length === 0 && m !== void 0 && g.length !== 1) {
|
|
14068
|
-
let e = [], r = new Set([...
|
|
14101
|
+
let e = [], r = new Set([...Ev(t.num, m), ...Tv(t.num, m)]);
|
|
14069
14102
|
for (let t of r) {
|
|
14070
14103
|
u.getActiveArticlesByTextAndNumCount++;
|
|
14071
14104
|
let r = performance.now(), a = await n.getActiveArticlesByTextAndNum({
|
|
@@ -14101,91 +14134,91 @@ async function* Nv({ ancestors: e, article: t, legiResolver: n, context: r, date
|
|
|
14101
14134
|
type: "external_article"
|
|
14102
14135
|
}).filter(([, e]) => e !== void 0)), l.articleExternalLinkCount++, l.articleLinkCount++, $(l, "articleLinkMs", f);
|
|
14103
14136
|
}
|
|
14104
|
-
function*
|
|
14137
|
+
function* Iv(e, { citations: t = !1 } = {}) {
|
|
14105
14138
|
switch (e.type) {
|
|
14106
14139
|
case "article":
|
|
14107
14140
|
e.num !== void 0 && (yield e.num);
|
|
14108
14141
|
break;
|
|
14109
14142
|
case "bounded-interval":
|
|
14110
|
-
yield*
|
|
14143
|
+
yield* Iv(e.first, { citations: t }), yield* Iv(e.last, { citations: t });
|
|
14111
14144
|
break;
|
|
14112
14145
|
case "counted-interval":
|
|
14113
|
-
yield*
|
|
14146
|
+
yield* Iv(e.first, { citations: t });
|
|
14114
14147
|
break;
|
|
14115
14148
|
case "enumeration":
|
|
14116
14149
|
case "exclusion":
|
|
14117
|
-
yield*
|
|
14150
|
+
yield* Iv(e.left, { citations: t }), yield* Iv(e.right, { citations: t });
|
|
14118
14151
|
break;
|
|
14119
14152
|
case "parent-enfant":
|
|
14120
|
-
yield*
|
|
14153
|
+
yield* Iv(e.parent, { citations: t }), yield* Iv(e.child, { citations: t });
|
|
14121
14154
|
break;
|
|
14122
14155
|
case "reference_et_action":
|
|
14123
|
-
if (yield*
|
|
14156
|
+
if (yield* Iv(e.reference, { citations: t }), t) {
|
|
14124
14157
|
let { originalCitations: n } = e.action;
|
|
14125
14158
|
if (n !== void 0) {
|
|
14126
|
-
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 });
|
|
14127
14160
|
}
|
|
14128
14161
|
}
|
|
14129
14162
|
break;
|
|
14130
14163
|
}
|
|
14131
14164
|
}
|
|
14132
|
-
function*
|
|
14165
|
+
function* Lv(e, t, { citations: n = !1 } = {}) {
|
|
14133
14166
|
switch (t.type) {
|
|
14134
14167
|
case "bounded-interval":
|
|
14135
|
-
yield*
|
|
14168
|
+
yield* Lv(e, t.first, { citations: n }), yield* Lv(e, t.last, { citations: n });
|
|
14136
14169
|
break;
|
|
14137
14170
|
case "counted-interval":
|
|
14138
|
-
yield*
|
|
14171
|
+
yield* Lv(e, t.first, { citations: n });
|
|
14139
14172
|
break;
|
|
14140
14173
|
case "enumeration":
|
|
14141
14174
|
case "exclusion":
|
|
14142
|
-
yield*
|
|
14175
|
+
yield* Lv(e, t.left, { citations: n }), yield* Lv(e, t.right, { citations: n });
|
|
14143
14176
|
break;
|
|
14144
14177
|
case "reference_et_action":
|
|
14145
|
-
if (yield*
|
|
14178
|
+
if (yield* Lv(e, t.reference, { citations: n }), n) {
|
|
14146
14179
|
let { originalCitations: r } = t.action;
|
|
14147
14180
|
if (r !== void 0) {
|
|
14148
|
-
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 });
|
|
14149
14182
|
}
|
|
14150
14183
|
}
|
|
14151
14184
|
break;
|
|
14152
14185
|
default: yield t;
|
|
14153
14186
|
}
|
|
14154
14187
|
}
|
|
14155
|
-
function*
|
|
14188
|
+
function* Rv(e, t) {
|
|
14156
14189
|
if (t.type === "texte") console.error(`iterDeepestDivisionsOrArticles must not be called with a text:\n${JSON.stringify(t, null, 2)}`);
|
|
14157
14190
|
else if (ft(t) || t.type === "article") yield t;
|
|
14158
14191
|
else if (!(pt(t) || t.type === "incomplete-header")) switch (t.type) {
|
|
14159
14192
|
case "bounded-interval":
|
|
14160
|
-
yield*
|
|
14193
|
+
yield* Rv(e, t.first), yield* Rv(e, t.last);
|
|
14161
14194
|
break;
|
|
14162
14195
|
case "counted-interval":
|
|
14163
|
-
yield*
|
|
14196
|
+
yield* Rv(e, t.first);
|
|
14164
14197
|
break;
|
|
14165
14198
|
case "enumeration":
|
|
14166
14199
|
case "exclusion":
|
|
14167
|
-
yield*
|
|
14200
|
+
yield* Rv(e, t.left), yield* Rv(e, t.right);
|
|
14168
14201
|
break;
|
|
14169
14202
|
case "parent-enfant": {
|
|
14170
|
-
let n = [...
|
|
14171
|
-
n.length === 0 ? yield*
|
|
14203
|
+
let n = [...Rv(e, t.child)];
|
|
14204
|
+
n.length === 0 ? yield* Rv(e, t.parent) : yield* n;
|
|
14172
14205
|
break;
|
|
14173
14206
|
}
|
|
14174
14207
|
case "reference_et_action": {
|
|
14175
|
-
yield*
|
|
14208
|
+
yield* Rv(e, t.reference);
|
|
14176
14209
|
let { originalCitations: n } = t.action;
|
|
14177
14210
|
if (n !== void 0) {
|
|
14178
|
-
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);
|
|
14179
14212
|
}
|
|
14180
14213
|
break;
|
|
14181
14214
|
}
|
|
14182
14215
|
default: m("iterDeepestDivisionsOrArticles reference.type", t);
|
|
14183
14216
|
}
|
|
14184
14217
|
}
|
|
14185
|
-
function
|
|
14218
|
+
function zv(e) {
|
|
14186
14219
|
return e?.split(":")[0].trim().toLowerCase().split(/\s+/).map((e) => e.trim()).filter((e) => e !== "").join(" ");
|
|
14187
14220
|
}
|
|
14188
|
-
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 }) {
|
|
14189
14222
|
let h = performance.now();
|
|
14190
14223
|
if (i.present) {
|
|
14191
14224
|
$(f, "divisionLinkMs", h);
|
|
@@ -14202,20 +14235,20 @@ async function* Rv({ ancestors: e, legiResolver: t, context: n, date: r, divisio
|
|
|
14202
14235
|
}
|
|
14203
14236
|
if (u !== void 0) {
|
|
14204
14237
|
for (let e of u) {
|
|
14205
|
-
let t =
|
|
14238
|
+
let t = zv(e.title);
|
|
14206
14239
|
if (t !== void 0) {
|
|
14207
14240
|
let n = !1;
|
|
14208
|
-
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) {
|
|
14209
14242
|
g = e;
|
|
14210
14243
|
break;
|
|
14211
14244
|
}
|
|
14212
14245
|
}
|
|
14213
14246
|
}
|
|
14214
14247
|
if (g === void 0 && (g = u.find((e) => {
|
|
14215
|
-
let t =
|
|
14248
|
+
let t = zv(e.title)?.split(/\s+/);
|
|
14216
14249
|
return t !== void 0 && t.length === 2 && st.includes(t[0]) && t[1] === "législative";
|
|
14217
14250
|
}), g !== void 0)) {
|
|
14218
|
-
let e =
|
|
14251
|
+
let e = zv(g.title).split(/\s+/), t = {
|
|
14219
14252
|
start: i.position.stop,
|
|
14220
14253
|
stop: i.position.stop
|
|
14221
14254
|
}, n = l === void 0 ? void 0 : s(l, t), r = Object.fromEntries(Object.entries({
|
|
@@ -14233,8 +14266,8 @@ async function* Rv({ ancestors: e, legiResolver: t, context: n, date: r, divisio
|
|
|
14233
14266
|
}).filter(([, e]) => e !== void 0)), i = r;
|
|
14234
14267
|
}
|
|
14235
14268
|
}
|
|
14236
|
-
let _ = a === void 0 ? [] : [...
|
|
14237
|
-
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)) {
|
|
14238
14271
|
let u = s.type === "parent-enfant" ? s.parent : s, h = s.type === "parent-enfant" ? s : void 0;
|
|
14239
14272
|
switch (u.type) {
|
|
14240
14273
|
case "alinéa":
|
|
@@ -14243,7 +14276,7 @@ async function* Rv({ ancestors: e, legiResolver: t, context: n, date: r, divisio
|
|
|
14243
14276
|
case "phrase": break;
|
|
14244
14277
|
case "article": {
|
|
14245
14278
|
let a = performance.now();
|
|
14246
|
-
for await (let a of
|
|
14279
|
+
for await (let a of Fv({
|
|
14247
14280
|
ancestors: _.length === 1 ? [...e ?? [], i] : void 0,
|
|
14248
14281
|
article: u,
|
|
14249
14282
|
legiResolver: t,
|
|
@@ -14279,7 +14312,7 @@ async function* Rv({ ancestors: e, legiResolver: t, context: n, date: r, divisio
|
|
|
14279
14312
|
}), $(f, "divisionDirectChildrenLookupMs", e);
|
|
14280
14313
|
}
|
|
14281
14314
|
let s = performance.now();
|
|
14282
|
-
for await (let s of
|
|
14315
|
+
for await (let s of Bv({
|
|
14283
14316
|
ancestors: _.length === 1 ? [...e ?? [], i] : void 0,
|
|
14284
14317
|
legiResolver: t,
|
|
14285
14318
|
context: n,
|
|
@@ -14321,7 +14354,7 @@ async function* Rv({ ancestors: e, legiResolver: t, context: n, date: r, divisio
|
|
|
14321
14354
|
}
|
|
14322
14355
|
$(f, "divisionLinkMs", h);
|
|
14323
14356
|
}
|
|
14324
|
-
function*
|
|
14357
|
+
function* Vv(e, t) {
|
|
14325
14358
|
let n = Math.floor(t), i = Math.floor((t - n) * 1e3);
|
|
14326
14359
|
if (i === 0) {
|
|
14327
14360
|
for (let t of r(n)) yield `${t.toLowerCase()} ${e}`;
|
|
@@ -14331,9 +14364,9 @@ function* zv(e, t) {
|
|
|
14331
14364
|
for (let r of ne(n)) yield `${e} ${t} ${r.toLowerCase()}`;
|
|
14332
14365
|
}
|
|
14333
14366
|
}
|
|
14334
|
-
async function*
|
|
14335
|
-
let f = e ?? {}, p = u ??
|
|
14336
|
-
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)) {
|
|
14337
14370
|
let l = e.type === "parent-enfant" ? e.parent : e, u = e.type === "parent-enfant" ? e : void 0;
|
|
14338
14371
|
switch (l.type) {
|
|
14339
14372
|
case "alinéa":
|
|
@@ -14344,7 +14377,7 @@ async function* Bv({ articleDefinitionByNumByTextId: e, legiResolver: t, context
|
|
|
14344
14377
|
if (l.definition && h.textId !== void 0) {
|
|
14345
14378
|
let e = f[h.textId]?.[l.num];
|
|
14346
14379
|
e !== void 0 && (e.originalTransformation === void 0 && o !== void 0 && (e.originalTransformation = s(o, e.position)), yield e, m.articleDefinitionLinkCount++, m.articleLinkCount++);
|
|
14347
|
-
} else for await (let e of
|
|
14380
|
+
} else for await (let e of Fv({
|
|
14348
14381
|
article: l,
|
|
14349
14382
|
legiResolver: t,
|
|
14350
14383
|
context: n,
|
|
@@ -14367,7 +14400,7 @@ async function* Bv({ articleDefinitionByNumByTextId: e, legiResolver: t, context
|
|
|
14367
14400
|
case "sous-sous-paragraphe":
|
|
14368
14401
|
case "sous-titre":
|
|
14369
14402
|
case "titre":
|
|
14370
|
-
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({
|
|
14371
14404
|
legiResolver: t,
|
|
14372
14405
|
context: n,
|
|
14373
14406
|
date: r,
|
|
@@ -14384,15 +14417,15 @@ async function* Bv({ articleDefinitionByNumByTextId: e, legiResolver: t, context
|
|
|
14384
14417
|
break;
|
|
14385
14418
|
case "texte": {
|
|
14386
14419
|
let e = performance.now();
|
|
14387
|
-
|
|
14420
|
+
_v({
|
|
14388
14421
|
context: n,
|
|
14389
14422
|
logPartialReferences: a,
|
|
14390
14423
|
reference: c,
|
|
14391
14424
|
state: h,
|
|
14392
14425
|
text: l
|
|
14393
14426
|
});
|
|
14394
|
-
let d = u === void 0 ? [] : [...
|
|
14395
|
-
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)) {
|
|
14396
14429
|
let s = e.type === "parent-enfant" ? e.parent : e, g = e.type === "parent-enfant" ? e : void 0;
|
|
14397
14430
|
switch (s.type) {
|
|
14398
14431
|
case "alinéa":
|
|
@@ -14401,7 +14434,7 @@ async function* Bv({ articleDefinitionByNumByTextId: e, legiResolver: t, context
|
|
|
14401
14434
|
case "phrase": break;
|
|
14402
14435
|
case "article": {
|
|
14403
14436
|
let e = performance.now();
|
|
14404
|
-
for await (let e of
|
|
14437
|
+
for await (let e of Fv({
|
|
14405
14438
|
ancestors: d.length === 1 ? [l] : void 0,
|
|
14406
14439
|
article: s,
|
|
14407
14440
|
legiResolver: t,
|
|
@@ -14437,7 +14470,7 @@ async function* Bv({ articleDefinitionByNumByTextId: e, legiResolver: t, context
|
|
|
14437
14470
|
}), $(m, "divisionDirectChildrenLookupMs", n);
|
|
14438
14471
|
}
|
|
14439
14472
|
let u = performance.now();
|
|
14440
|
-
for await (let u of
|
|
14473
|
+
for await (let u of Bv({
|
|
14441
14474
|
ancestors: d.length === 1 ? [l] : void 0,
|
|
14442
14475
|
legiResolver: t,
|
|
14443
14476
|
context: n,
|
|
@@ -14497,7 +14530,7 @@ async function* Bv({ articleDefinitionByNumByTextId: e, legiResolver: t, context
|
|
|
14497
14530
|
for (let c of s.references) {
|
|
14498
14531
|
m.citationReferenceCount++;
|
|
14499
14532
|
let s = performance.now();
|
|
14500
|
-
for await (let s of
|
|
14533
|
+
for await (let s of Hv({
|
|
14501
14534
|
articleDefinitionByNumByTextId: f,
|
|
14502
14535
|
legiResolver: t,
|
|
14503
14536
|
context: n,
|
|
@@ -14518,13 +14551,13 @@ async function* Bv({ articleDefinitionByNumByTextId: e, legiResolver: t, context
|
|
|
14518
14551
|
}
|
|
14519
14552
|
//#endregion
|
|
14520
14553
|
//#region src/lib/extractors/table_of_contents.ts
|
|
14521
|
-
function
|
|
14554
|
+
function Uv(e) {
|
|
14522
14555
|
let t = e;
|
|
14523
14556
|
return t.items ?? [...t.articles ?? [], ...t.divisions ?? []];
|
|
14524
14557
|
}
|
|
14525
|
-
function*
|
|
14558
|
+
function* Wv({ context: e, tableOfContents: t, transformation: n }) {
|
|
14526
14559
|
let r = 0, i = g(n);
|
|
14527
|
-
for (let n of
|
|
14560
|
+
for (let n of Kv(t)) {
|
|
14528
14561
|
let t = n.line.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), a = RegExp(`^${t}$`, "m");
|
|
14529
14562
|
a.lastIndex = r;
|
|
14530
14563
|
let o = a.exec(e.input);
|
|
@@ -14536,7 +14569,7 @@ function* Hv({ context: e, tableOfContents: t, transformation: n }) {
|
|
|
14536
14569
|
u.originalTransformation = l, u.position = c, yield u, r = c.stop;
|
|
14537
14570
|
}
|
|
14538
14571
|
}
|
|
14539
|
-
function
|
|
14572
|
+
function Gv(e) {
|
|
14540
14573
|
let t = new x(e), n = { items: [] }, r = [];
|
|
14541
14574
|
for (let e of En(t)) if (ft(e)) {
|
|
14542
14575
|
let i = r.findIndex(({ type: t }) => t === e.type);
|
|
@@ -14554,14 +14587,14 @@ function Uv(e) {
|
|
|
14554
14587
|
else throw Error(`Unexpected type "${e.type}" in definition:\n${JSON.stringify(e, null, 2)}`);
|
|
14555
14588
|
return n;
|
|
14556
14589
|
}
|
|
14557
|
-
function*
|
|
14590
|
+
function* Kv(e) {
|
|
14558
14591
|
e.type !== void 0 && (yield e);
|
|
14559
|
-
for (let t of
|
|
14592
|
+
for (let t of Uv(e)) t.type === "article" ? yield t : yield* Kv(t);
|
|
14560
14593
|
}
|
|
14561
14594
|
//#endregion
|
|
14562
14595
|
//#region src/lib/links.ts
|
|
14563
|
-
var
|
|
14564
|
-
function
|
|
14596
|
+
var qv = ["Exploratrice", "Forgejo"];
|
|
14597
|
+
function Jv(e, t, n) {
|
|
14565
14598
|
if (n.match(qe) === null) throw Error(`Unknown ID format: ${n}`);
|
|
14566
14599
|
switch (e) {
|
|
14567
14600
|
case "Exploratrice": return new URL(`legifrance/articles/${n}/versions`, t).toString();
|
|
@@ -14569,7 +14602,7 @@ function Kv(e, t, n) {
|
|
|
14569
14602
|
default: m("urlFromArticleVersionsId linkType", e);
|
|
14570
14603
|
}
|
|
14571
14604
|
}
|
|
14572
|
-
function
|
|
14605
|
+
function Yv(e, t, n) {
|
|
14573
14606
|
let r = n.match(qe);
|
|
14574
14607
|
if (r === null) throw Error(`Unknown ID format: ${n}`);
|
|
14575
14608
|
switch (e) {
|
|
@@ -14590,19 +14623,19 @@ function qv(e, t, n) {
|
|
|
14590
14623
|
}
|
|
14591
14624
|
//#endregion
|
|
14592
14625
|
//#region src/lib/linkers/html.ts
|
|
14593
|
-
function
|
|
14626
|
+
function Xv(e, t) {
|
|
14594
14627
|
if (e !== void 0) return e;
|
|
14595
|
-
if (t !== void 0) return new
|
|
14628
|
+
if (t !== void 0) return new sv(t);
|
|
14596
14629
|
throw Error("A Canutes database or legal resolver is required");
|
|
14597
14630
|
}
|
|
14598
|
-
function
|
|
14631
|
+
function Zv(e, t) {
|
|
14599
14632
|
return t.type === "reference_et_action" ? JSON.stringify({
|
|
14600
14633
|
...e,
|
|
14601
14634
|
action: t.action
|
|
14602
14635
|
}) : JSON.stringify(e);
|
|
14603
14636
|
}
|
|
14604
|
-
async function
|
|
14605
|
-
let f = new Ee("addLinksToHtml"), p =
|
|
14637
|
+
async function Qv({ canutesDb: e, legiResolver: t, date: n, html: r, linkBaseUrl: i, linkType: a, logIgnoredReferencesTypes: o, logPartialReferences: s, logReferences: c, onLink: l, previousContext: u, state: d }) {
|
|
14638
|
+
let f = new Ee("addLinksToHtml"), p = Xv(t, e);
|
|
14606
14639
|
await f.time("preloadTextTitlesInfos", () => p.preloadTextTitlesInfos());
|
|
14607
14640
|
let h = f.timeSync("simplifyHtml", () => v({ removeAWithHref: !0 })(r), {
|
|
14608
14641
|
inputSize: r.length,
|
|
@@ -14611,7 +14644,7 @@ async function Xv({ canutesDb: e, legiResolver: t, date: n, html: r, linkBaseUrl
|
|
|
14611
14644
|
g.currentArticle = u?.currentArticle, g.currentText = u?.currentText;
|
|
14612
14645
|
let _ = [], y = { value: 0 }, b = -1;
|
|
14613
14646
|
await f.time("extractTextLinks", async () => {
|
|
14614
|
-
for await (let e of
|
|
14647
|
+
for await (let e of gv({
|
|
14615
14648
|
legiResolver: p,
|
|
14616
14649
|
context: g,
|
|
14617
14650
|
date: n,
|
|
@@ -14624,7 +14657,7 @@ async function Xv({ canutesDb: e, legiResolver: t, date: n, html: r, linkBaseUrl
|
|
|
14624
14657
|
case "article_definition": {
|
|
14625
14658
|
let { article: t, originalTransformation: n, textId: i } = e;
|
|
14626
14659
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in article definition: ${JSON.stringify(e, null, 2)}`);
|
|
14627
|
-
|
|
14660
|
+
ey({
|
|
14628
14661
|
inputHtml: r,
|
|
14629
14662
|
originalTransformation: n,
|
|
14630
14663
|
output: { replacements: _ },
|
|
@@ -14637,10 +14670,10 @@ async function Xv({ canutesDb: e, legiResolver: t, date: n, html: r, linkBaseUrl
|
|
|
14637
14670
|
let { articleId: t, historyArticleId: n, originalTransformation: o } = e;
|
|
14638
14671
|
if (t === void 0 && n === void 0) break;
|
|
14639
14672
|
if (o === void 0) throw Error(`Missing originalTransformation attribute in external article link: ${JSON.stringify(e, null, 2)}`);
|
|
14640
|
-
let s = t === void 0 ?
|
|
14673
|
+
let s = t === void 0 ? Jv(a, i, n) : Yv(a, i, t);
|
|
14641
14674
|
if (s === void 0) break;
|
|
14642
14675
|
let c = t === void 0 ? `class="lien_article_historique" href="${s}" title="Versions de l'article"` : `class="lien_article_externe" href="${s}"`;
|
|
14643
|
-
|
|
14676
|
+
ey({
|
|
14644
14677
|
inputHtml: r,
|
|
14645
14678
|
originalTransformation: o,
|
|
14646
14679
|
output: { replacements: _ },
|
|
@@ -14653,12 +14686,12 @@ async function Xv({ canutesDb: e, legiResolver: t, date: n, html: r, linkBaseUrl
|
|
|
14653
14686
|
let { originalTransformation: t, sectionTaId: n } = e;
|
|
14654
14687
|
if (n !== void 0) {
|
|
14655
14688
|
if (t === void 0) throw Error(`Missing originalTransformation attribute in external division link: ${JSON.stringify(e, null, 2)}`);
|
|
14656
|
-
|
|
14689
|
+
ey({
|
|
14657
14690
|
inputHtml: r,
|
|
14658
14691
|
originalTransformation: t,
|
|
14659
14692
|
output: { replacements: _ },
|
|
14660
14693
|
replacementCounter: y,
|
|
14661
|
-
tagHtmlFromOriginal: (e) => `<a class="lien_division_externe" href="${
|
|
14694
|
+
tagHtmlFromOriginal: (e) => `<a class="lien_division_externe" href="${Yv(a, i, n)}">${e}</a>`
|
|
14662
14695
|
});
|
|
14663
14696
|
}
|
|
14664
14697
|
break;
|
|
@@ -14670,12 +14703,12 @@ async function Xv({ canutesDb: e, legiResolver: t, date: n, html: r, linkBaseUrl
|
|
|
14670
14703
|
continue;
|
|
14671
14704
|
}
|
|
14672
14705
|
if (t === void 0) throw Error(`Missing originalTransformation attribute in external text link: ${JSON.stringify(e, null, 2)}`);
|
|
14673
|
-
|
|
14706
|
+
ey({
|
|
14674
14707
|
inputHtml: r,
|
|
14675
14708
|
originalTransformation: t,
|
|
14676
14709
|
output: { replacements: _ },
|
|
14677
14710
|
replacementCounter: y,
|
|
14678
|
-
tagHtmlFromOriginal: (e) => `<a class="lien_texte_externe" href="${
|
|
14711
|
+
tagHtmlFromOriginal: (e) => `<a class="lien_texte_externe" href="${Yv(a, i, n.cid)}">${e}</a>`
|
|
14679
14712
|
});
|
|
14680
14713
|
break;
|
|
14681
14714
|
}
|
|
@@ -14683,7 +14716,7 @@ async function Xv({ canutesDb: e, legiResolver: t, date: n, html: r, linkBaseUrl
|
|
|
14683
14716
|
let { url: t, originalTransformation: n } = e;
|
|
14684
14717
|
if (t === void 0) continue;
|
|
14685
14718
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in european text link: ${JSON.stringify(e, null, 2)}`);
|
|
14686
|
-
|
|
14719
|
+
ey({
|
|
14687
14720
|
inputHtml: r,
|
|
14688
14721
|
originalTransformation: n,
|
|
14689
14722
|
output: { replacements: _ },
|
|
@@ -14695,7 +14728,7 @@ async function Xv({ canutesDb: e, legiResolver: t, date: n, html: r, linkBaseUrl
|
|
|
14695
14728
|
case "internal_article": {
|
|
14696
14729
|
let { definition: t, originalTransformation: n } = e;
|
|
14697
14730
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in internal article link: ${JSON.stringify(e, null, 2)}`);
|
|
14698
|
-
|
|
14731
|
+
ey({
|
|
14699
14732
|
inputHtml: r,
|
|
14700
14733
|
originalTransformation: n,
|
|
14701
14734
|
output: { replacements: _ },
|
|
@@ -14707,7 +14740,7 @@ async function Xv({ canutesDb: e, legiResolver: t, date: n, html: r, linkBaseUrl
|
|
|
14707
14740
|
default: m("Link", e);
|
|
14708
14741
|
}
|
|
14709
14742
|
}, { count: b + 1 });
|
|
14710
|
-
let ee = f.timeSync("applyHtmlReplacements", () =>
|
|
14743
|
+
let ee = f.timeSync("applyHtmlReplacements", () => $v(r, _), {
|
|
14711
14744
|
count: _.length,
|
|
14712
14745
|
inputSize: r.length
|
|
14713
14746
|
});
|
|
@@ -14719,13 +14752,13 @@ async function Xv({ canutesDb: e, legiResolver: t, date: n, html: r, linkBaseUrl
|
|
|
14719
14752
|
output: _.length === 0 ? null : ee
|
|
14720
14753
|
};
|
|
14721
14754
|
}
|
|
14722
|
-
function
|
|
14755
|
+
function $v(e, t) {
|
|
14723
14756
|
if (t.length === 0) return e;
|
|
14724
14757
|
let n = [], r = 0;
|
|
14725
14758
|
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);
|
|
14726
14759
|
return n.push(e.slice(r)), n.join("");
|
|
14727
14760
|
}
|
|
14728
|
-
function
|
|
14761
|
+
function ey({ inputHtml: e, originalTransformation: t, output: n, replacementCounter: r, tagHtmlFromOriginal: i }) {
|
|
14729
14762
|
let a = te(t, i(p(e, t, 0) ?? ""));
|
|
14730
14763
|
n.replacements.push({
|
|
14731
14764
|
order: r.value++,
|
|
@@ -14734,11 +14767,11 @@ function Qv({ inputHtml: e, originalTransformation: t, output: n, replacementCou
|
|
|
14734
14767
|
stop: t.position.stop
|
|
14735
14768
|
});
|
|
14736
14769
|
}
|
|
14737
|
-
function
|
|
14770
|
+
function ty({ attributes: e, inputHtml: t, originalTransformation: n, outputByType: r, replacementCounter: i }) {
|
|
14738
14771
|
let a = Object.entries(e).map(([e, t]) => `${e}="${tt(t, !0)}"`).join(" ");
|
|
14739
14772
|
for (let e of ["links", "links_or_references"]) {
|
|
14740
14773
|
let o = r[e];
|
|
14741
|
-
o !== void 0 &&
|
|
14774
|
+
o !== void 0 && ey({
|
|
14742
14775
|
inputHtml: t,
|
|
14743
14776
|
originalTransformation: n,
|
|
14744
14777
|
output: o,
|
|
@@ -14747,11 +14780,11 @@ function $v({ attributes: e, inputHtml: t, originalTransformation: n, outputByTy
|
|
|
14747
14780
|
});
|
|
14748
14781
|
}
|
|
14749
14782
|
}
|
|
14750
|
-
function
|
|
14783
|
+
function ny({ id: e, outputByType: t }) {
|
|
14751
14784
|
return t.references !== void 0 || e === void 0 && t.links_or_references !== void 0;
|
|
14752
14785
|
}
|
|
14753
|
-
async function
|
|
14754
|
-
let p =
|
|
14786
|
+
async function ry({ 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 }) {
|
|
14787
|
+
let p = Xv(t, e);
|
|
14755
14788
|
await p.preloadTextTitlesInfos();
|
|
14756
14789
|
let h = new x(i.output), g = {}, _ = {};
|
|
14757
14790
|
for (let e of d) _[e] = {
|
|
@@ -14760,7 +14793,7 @@ async function ty({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, ht
|
|
|
14760
14793
|
replacements: []
|
|
14761
14794
|
};
|
|
14762
14795
|
let v = { value: 0 };
|
|
14763
|
-
for await (let e of
|
|
14796
|
+
for await (let e of gv({
|
|
14764
14797
|
legiResolver: p,
|
|
14765
14798
|
context: h,
|
|
14766
14799
|
date: n,
|
|
@@ -14773,7 +14806,7 @@ async function ty({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, ht
|
|
|
14773
14806
|
case "article_definition": {
|
|
14774
14807
|
let { article: t, originalTransformation: n, textId: r } = e;
|
|
14775
14808
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in article definition: ${JSON.stringify(e, null, 2)}`);
|
|
14776
|
-
for (let e of Object.values(_))
|
|
14809
|
+
for (let e of Object.values(_)) ey({
|
|
14777
14810
|
inputHtml: a,
|
|
14778
14811
|
originalTransformation: n,
|
|
14779
14812
|
output: e,
|
|
@@ -14786,10 +14819,10 @@ async function ty({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, ht
|
|
|
14786
14819
|
let { article: t, articleId: n, historyArticleId: r, originalTransformation: i } = e;
|
|
14787
14820
|
if (i === void 0) throw Error(`Missing originalTransformation attribute in external article link: ${JSON.stringify(e, null, 2)}`);
|
|
14788
14821
|
if (n !== void 0) {
|
|
14789
|
-
if (
|
|
14822
|
+
if (ty({
|
|
14790
14823
|
attributes: {
|
|
14791
14824
|
class: "lien_article_externe",
|
|
14792
|
-
href:
|
|
14825
|
+
href: Yv(s, o, n)
|
|
14793
14826
|
},
|
|
14794
14827
|
inputHtml: a,
|
|
14795
14828
|
originalTransformation: i,
|
|
@@ -14800,8 +14833,8 @@ async function ty({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, ht
|
|
|
14800
14833
|
e != null && (g[e] = (g[e] ?? 0) + 1);
|
|
14801
14834
|
}
|
|
14802
14835
|
} else if (r !== void 0) {
|
|
14803
|
-
let e =
|
|
14804
|
-
e !== void 0 &&
|
|
14836
|
+
let e = Jv(s, o, r);
|
|
14837
|
+
e !== void 0 && ty({
|
|
14805
14838
|
attributes: {
|
|
14806
14839
|
class: "lien_article_historique",
|
|
14807
14840
|
href: e,
|
|
@@ -14813,14 +14846,14 @@ async function ty({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, ht
|
|
|
14813
14846
|
replacementCounter: v
|
|
14814
14847
|
});
|
|
14815
14848
|
}
|
|
14816
|
-
|
|
14849
|
+
ny({
|
|
14817
14850
|
id: n,
|
|
14818
14851
|
outputByType: _
|
|
14819
|
-
}) &&
|
|
14852
|
+
}) && iy({
|
|
14820
14853
|
attributes: {
|
|
14821
14854
|
class: "reference_article",
|
|
14822
14855
|
style: "background-color: #eae462",
|
|
14823
|
-
title:
|
|
14856
|
+
title: Zv(t, e.reference)
|
|
14824
14857
|
},
|
|
14825
14858
|
id: n,
|
|
14826
14859
|
inputHtml: a,
|
|
@@ -14833,10 +14866,10 @@ async function ty({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, ht
|
|
|
14833
14866
|
case "external_division": {
|
|
14834
14867
|
let { division: t, originalTransformation: n, sectionTaId: r } = e;
|
|
14835
14868
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in external division link: ${JSON.stringify(e, null, 2)}`);
|
|
14836
|
-
if (r !== void 0 && (
|
|
14869
|
+
if (r !== void 0 && (ty({
|
|
14837
14870
|
attributes: {
|
|
14838
14871
|
class: "lien_division_externe",
|
|
14839
|
-
href:
|
|
14872
|
+
href: Yv(s, o, r)
|
|
14840
14873
|
},
|
|
14841
14874
|
inputHtml: a,
|
|
14842
14875
|
originalTransformation: n,
|
|
@@ -14846,14 +14879,14 @@ async function ty({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, ht
|
|
|
14846
14879
|
let e = await p.getTextIdFromSegmentId(r);
|
|
14847
14880
|
e != null && (g[e] = (g[e] ?? 0) + 1);
|
|
14848
14881
|
}
|
|
14849
|
-
|
|
14882
|
+
ny({
|
|
14850
14883
|
id: r,
|
|
14851
14884
|
outputByType: _
|
|
14852
|
-
}) &&
|
|
14885
|
+
}) && iy({
|
|
14853
14886
|
attributes: {
|
|
14854
14887
|
class: "reference_division",
|
|
14855
14888
|
style: "background-color: #eae462",
|
|
14856
|
-
title:
|
|
14889
|
+
title: Zv(t, e.reference)
|
|
14857
14890
|
},
|
|
14858
14891
|
id: r,
|
|
14859
14892
|
inputHtml: a,
|
|
@@ -14866,7 +14899,7 @@ async function ty({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, ht
|
|
|
14866
14899
|
case "european_text": {
|
|
14867
14900
|
let { url: t, originalTransformation: n, text: r, titleId: i } = e;
|
|
14868
14901
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in external text link: ${JSON.stringify(e, null, 2)}`);
|
|
14869
|
-
|
|
14902
|
+
ty({
|
|
14870
14903
|
attributes: {
|
|
14871
14904
|
class: "lien_texte_european",
|
|
14872
14905
|
href: t,
|
|
@@ -14876,14 +14909,14 @@ async function ty({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, ht
|
|
|
14876
14909
|
originalTransformation: n,
|
|
14877
14910
|
outputByType: _,
|
|
14878
14911
|
replacementCounter: v
|
|
14879
|
-
}),
|
|
14912
|
+
}), ny({
|
|
14880
14913
|
id: i,
|
|
14881
14914
|
outputByType: _
|
|
14882
|
-
}) &&
|
|
14915
|
+
}) && iy({
|
|
14883
14916
|
attributes: {
|
|
14884
14917
|
class: "reference_texte",
|
|
14885
14918
|
style: "background-color: #eae462",
|
|
14886
|
-
title:
|
|
14919
|
+
title: Zv(r, e.reference)
|
|
14887
14920
|
},
|
|
14888
14921
|
id: i,
|
|
14889
14922
|
inputHtml: a,
|
|
@@ -14896,23 +14929,23 @@ async function ty({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, ht
|
|
|
14896
14929
|
case "external_text": {
|
|
14897
14930
|
let { originalTransformation: t, text: n } = e;
|
|
14898
14931
|
if (t === void 0) throw Error(`Missing originalTransformation attribute in external text link: ${JSON.stringify(e, null, 2)}`);
|
|
14899
|
-
n.cid === void 0 ? !n.present && l && console.error(`Link to text "${h.text(n.position)}" without CID: ${JSON.stringify(n, null, 2)}`) : (
|
|
14932
|
+
n.cid === void 0 ? !n.present && l && console.error(`Link to text "${h.text(n.position)}" without CID: ${JSON.stringify(n, null, 2)}`) : (ty({
|
|
14900
14933
|
attributes: {
|
|
14901
14934
|
class: "lien_texte_externe",
|
|
14902
|
-
href:
|
|
14935
|
+
href: Yv(s, o, n.cid)
|
|
14903
14936
|
},
|
|
14904
14937
|
inputHtml: a,
|
|
14905
14938
|
originalTransformation: t,
|
|
14906
14939
|
outputByType: _,
|
|
14907
14940
|
replacementCounter: v
|
|
14908
|
-
}), f && (g[n.cid] = (g[n.cid] ?? 0) + 1)),
|
|
14941
|
+
}), f && (g[n.cid] = (g[n.cid] ?? 0) + 1)), ny({
|
|
14909
14942
|
id: n.cid,
|
|
14910
14943
|
outputByType: _
|
|
14911
|
-
}) &&
|
|
14944
|
+
}) && iy({
|
|
14912
14945
|
attributes: {
|
|
14913
14946
|
class: "reference_texte",
|
|
14914
14947
|
style: "background-color: #eae462",
|
|
14915
|
-
title:
|
|
14948
|
+
title: Zv(n, e.reference)
|
|
14916
14949
|
},
|
|
14917
14950
|
id: n.cid,
|
|
14918
14951
|
inputHtml: a,
|
|
@@ -14925,7 +14958,7 @@ async function ty({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, ht
|
|
|
14925
14958
|
case "internal_article": {
|
|
14926
14959
|
let { definition: t, originalTransformation: n } = e;
|
|
14927
14960
|
if (n === void 0) throw Error(`Missing originalTransformation attribute in internal article link: ${JSON.stringify(e, null, 2)}`);
|
|
14928
|
-
for (let e of Object.values(_))
|
|
14961
|
+
for (let e of Object.values(_)) ey({
|
|
14929
14962
|
inputHtml: a,
|
|
14930
14963
|
originalTransformation: n,
|
|
14931
14964
|
output: e,
|
|
@@ -14936,18 +14969,18 @@ async function ty({ canutesDb: e, legiResolver: t, date: n, defaultTextId: r, ht
|
|
|
14936
14969
|
}
|
|
14937
14970
|
default: m("Link", e);
|
|
14938
14971
|
}
|
|
14939
|
-
for (let e of Object.values(_)) e.html =
|
|
14972
|
+
for (let e of Object.values(_)) e.html = $v(a, e.replacements);
|
|
14940
14973
|
return {
|
|
14941
14974
|
outputByType: _,
|
|
14942
14975
|
referredLegifranceTextCountByCid: g
|
|
14943
14976
|
};
|
|
14944
14977
|
}
|
|
14945
|
-
function
|
|
14978
|
+
function iy({ attributes: e, id: t, inputHtml: n, originalTransformation: r, outputByType: i, replacementCounter: a }) {
|
|
14946
14979
|
let o = Object.entries(e).map(([e, t]) => `${e}="${tt(t, !0)}"`).join(" ");
|
|
14947
14980
|
for (let e of ["links_or_references", "references"]) {
|
|
14948
14981
|
if (e === "links_or_references" && t !== void 0) continue;
|
|
14949
14982
|
let s = i[e];
|
|
14950
|
-
s !== void 0 &&
|
|
14983
|
+
s !== void 0 && ey({
|
|
14951
14984
|
inputHtml: n,
|
|
14952
14985
|
originalTransformation: r,
|
|
14953
14986
|
output: s,
|
|
@@ -14957,4 +14990,4 @@ function ny({ attributes: e, id: t, inputHtml: n, originalTransformation: r, out
|
|
|
14957
14990
|
}
|
|
14958
14991
|
}
|
|
14959
14992
|
//#endregion
|
|
14960
|
-
export {
|
|
14993
|
+
export { Sp as $, Xm as A, vt as At, jm as B, dt as Bt, Kh as C, Ht as Ct, ah as D, kt as Dt, ih as E, Bt as Et, Wm as F, rt as Ft, mm as G, lt as Gt, Sm as H, pt as Ht, Hm as I, st as It, Xp as J, Z as K, Um as L, it as Lt, $m as M, D as Mt, eh as N, St as Nt, rh as O, ht as Ot, th as P, nt as Pt, Vp as Q, Fm as R, at as Rt, ag as S, Vt as St, lh as T, zt as Tt, Cm as U, ct as Ut, wm as V, ft as Vt, xm as W, ut as Wt, Jp as X, em as Y, Pp as Z, ev as _, $t as _t, Yv as a, yn as at, og as b, Yt as bt, Uv as c, mn as ct, Hv as d, dn as dt, Cp as et, sv as f, nn as ft, J_ as g, cn as gt, tv as h, rn as ht, Jv as i, vn as it, Zm as j, E as jt, nh as k, gt as kt, Kv as l, _n as lt, K_ as m, on as mt, Qv as n, pp as nt, Wv as o, Sn as ot, fg as p, an as pt, Yp as q, qv as r, En as rt, Gv as s, Tn as st, ry as t, qp as tt, gv as u, pn as ut, q_ as v, Zt as vt, Gh as w, Ot as wt, sg as x, Xt as xt, dg as y, Jt as yt, Nm as z, ot as zt };
|