@floegence/floe-webapp-core 0.86.48 → 0.86.50
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.
|
@@ -1,38 +1,40 @@
|
|
|
1
|
-
function
|
|
2
|
-
let L = 0, b = [], C = 0, I = !1
|
|
3
|
-
const
|
|
4
|
-
|
|
1
|
+
function X(k) {
|
|
2
|
+
let L = 0, b = [], C = 0, I = !1;
|
|
3
|
+
const a = [];
|
|
4
|
+
let d = /* @__PURE__ */ Object.create(null), v = /* @__PURE__ */ Object.create(null), R = 1, o = 0, g, O, S = !1, M = 0, W = 0;
|
|
5
|
+
const m = /* @__PURE__ */ new Map();
|
|
6
|
+
function U(e) {
|
|
5
7
|
let t = 0, n = b.length;
|
|
6
8
|
for (; t < n; ) {
|
|
7
9
|
const s = t + n >>> 1;
|
|
8
10
|
b[s].start <= e ? t = s + 1 : n = s;
|
|
9
11
|
}
|
|
10
|
-
const
|
|
11
|
-
return b.slice(
|
|
12
|
+
const i = Math.max(0, t - 1);
|
|
13
|
+
return b.slice(i).map((s, l) => l === 0 ? s.text.slice(e - s.start) : s.text).join("");
|
|
12
14
|
}
|
|
13
15
|
function F(e, t) {
|
|
14
16
|
W += e.length;
|
|
15
|
-
const n = new
|
|
17
|
+
const n = new k.Lexer({ ...k.defaults });
|
|
16
18
|
return n.tokens.links = { ...t }, n.lex(e);
|
|
17
19
|
}
|
|
18
|
-
function
|
|
20
|
+
function w(e) {
|
|
19
21
|
return { changes: e, links: d, sourceLength: C };
|
|
20
22
|
}
|
|
21
23
|
function $(e) {
|
|
22
24
|
return { id: e.id, start: e.start, token: structuredClone(e.token) };
|
|
23
25
|
}
|
|
24
|
-
function
|
|
26
|
+
function q(e) {
|
|
25
27
|
for (const t of e.token.raw.matchAll(/\[((?:\\[^\n]|[^\]\n\\])+)\]/g)) {
|
|
26
28
|
const n = t[1].toLowerCase().replace(/\s+/g, " ");
|
|
27
29
|
e.references.add(n);
|
|
28
|
-
let
|
|
29
|
-
|
|
30
|
+
let i = m.get(n);
|
|
31
|
+
i || m.set(n, i = /* @__PURE__ */ new Set()), i.add(e);
|
|
30
32
|
}
|
|
31
33
|
}
|
|
32
|
-
function
|
|
34
|
+
function B(e) {
|
|
33
35
|
for (const t of e.references) {
|
|
34
|
-
const n =
|
|
35
|
-
n?.delete(e), n?.size ||
|
|
36
|
+
const n = m.get(t);
|
|
37
|
+
n?.delete(e), n?.size || m.delete(t);
|
|
36
38
|
}
|
|
37
39
|
}
|
|
38
40
|
function E(e, t) {
|
|
@@ -44,23 +46,34 @@ function V(O) {
|
|
|
44
46
|
} else t.candidate && (n === t.mark && t.indent <= 3 ? t.count++ : n === " " && t.count === 0 && t.indent < 3 ? t.indent++ : (n !== " " && n !== " " || t.count === 0) && (t.candidate = !1));
|
|
45
47
|
return t.candidate && t.count >= t.minimum;
|
|
46
48
|
}
|
|
47
|
-
function z(e
|
|
49
|
+
function z(e) {
|
|
50
|
+
const t = k.defaults.extensions;
|
|
51
|
+
if (!t || !t.inline?.length) return !1;
|
|
52
|
+
const n = t.startInline ?? [];
|
|
53
|
+
if (n.length < t.inline.length) return !0;
|
|
54
|
+
const i = new k.Lexer({ ...k.defaults });
|
|
55
|
+
return n.some((s) => {
|
|
56
|
+
const l = s.call({ lexer: i }, e);
|
|
57
|
+
return typeof l == "number" && l >= 0;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function _(e, t = 0) {
|
|
48
61
|
const n = e.tokens;
|
|
49
|
-
let
|
|
62
|
+
let i = -1;
|
|
50
63
|
for (let f = t; f < n.length; f++) {
|
|
51
64
|
const u = n[f];
|
|
52
|
-
if (u.type === "text" && /[\\\x60*_[<~]/u.test(u.raw)) {
|
|
53
|
-
|
|
65
|
+
if (u.type === "text" && (/[\\\x60*_[<~]/u.test(u.raw) || z(u.raw))) {
|
|
66
|
+
i = f;
|
|
54
67
|
break;
|
|
55
68
|
}
|
|
56
69
|
}
|
|
57
|
-
let s =
|
|
70
|
+
let s = i >= 0 ? i : Math.max(t, n.length - 1);
|
|
58
71
|
s > t && n[s]?.type === "text" && !/\s/u.test(n[s].raw) && n[s - 1]?.type === "link" && s--;
|
|
59
|
-
const
|
|
60
|
-
if (
|
|
61
|
-
const f =
|
|
72
|
+
const l = n[s];
|
|
73
|
+
if (i < 0 && l?.type === "text" && l.raw === l.text) {
|
|
74
|
+
const f = l.raw.lastIndexOf(" ");
|
|
62
75
|
if (f > 0) {
|
|
63
|
-
const u =
|
|
76
|
+
const u = l;
|
|
64
77
|
n.splice(
|
|
65
78
|
s,
|
|
66
79
|
1,
|
|
@@ -70,80 +83,81 @@ function V(O) {
|
|
|
70
83
|
}
|
|
71
84
|
}
|
|
72
85
|
const p = n.slice(s).map((f) => f.raw).join("");
|
|
73
|
-
|
|
86
|
+
O = {
|
|
74
87
|
from: s,
|
|
75
88
|
source: p,
|
|
76
|
-
unresolved:
|
|
89
|
+
unresolved: i >= 0,
|
|
90
|
+
extensionPending: z(p),
|
|
77
91
|
lastChar: p.slice(-1)
|
|
78
92
|
};
|
|
79
93
|
}
|
|
80
|
-
function
|
|
81
|
-
g = void 0,
|
|
82
|
-
const e =
|
|
94
|
+
function G() {
|
|
95
|
+
g = void 0, O = void 0, S = !1;
|
|
96
|
+
const e = a.at(-1)?.token;
|
|
83
97
|
if (e?.type === "paragraph") {
|
|
84
|
-
|
|
85
|
-
const
|
|
86
|
-
`) + 1, p = e.raw.slice(
|
|
87
|
-
|
|
98
|
+
_(e);
|
|
99
|
+
const l = e.raw.lastIndexOf(`
|
|
100
|
+
`) + 1, p = e.raw.slice(l, l + 32);
|
|
101
|
+
S = !e.raw.endsWith(`
|
|
88
102
|
`) && !/^(?: {0,3}(?:[-+*_]+|[0-9]{1,9}[.)]?)[ \t]*$| {0,3}[[<\x60~#|=])/u.test(p);
|
|
89
103
|
}
|
|
90
104
|
if (e?.type !== "code") return;
|
|
91
105
|
const t = /^(\x60{3,}|~{3,})[^\n]*\n/.exec(e.raw);
|
|
92
106
|
if (!t) return;
|
|
93
|
-
const n = t[1],
|
|
107
|
+
const n = t[1], i = e.raw.slice(t[0].length), s = {
|
|
94
108
|
mark: n[0],
|
|
95
109
|
minimum: n.length,
|
|
96
110
|
count: 0,
|
|
97
111
|
indent: 0,
|
|
98
112
|
candidate: !0,
|
|
99
|
-
pendingNewline:
|
|
113
|
+
pendingNewline: i.endsWith(`
|
|
100
114
|
`)
|
|
101
115
|
};
|
|
102
|
-
E(
|
|
116
|
+
E(i, s) || (g = s);
|
|
103
117
|
}
|
|
104
|
-
function
|
|
105
|
-
const t =
|
|
106
|
-
for (const
|
|
107
|
-
const
|
|
118
|
+
function N(e = !1) {
|
|
119
|
+
const t = a[o]?.start ?? 0, n = a.splice(o);
|
|
120
|
+
for (const r of n) B(r);
|
|
121
|
+
const i = F(U(t), v), s = d;
|
|
108
122
|
d = Object.freeze(
|
|
109
123
|
Object.fromEntries(
|
|
110
|
-
Object.entries(
|
|
124
|
+
Object.entries(i.links).map(([r, c]) => [r, Object.freeze({ ...c })])
|
|
111
125
|
)
|
|
112
126
|
);
|
|
113
|
-
const
|
|
127
|
+
const l = [];
|
|
114
128
|
let p = t;
|
|
115
|
-
for (let
|
|
116
|
-
const c = r
|
|
117
|
-
id: h?.start === p ? h.id :
|
|
129
|
+
for (let r = 0; r < i.length; r++) {
|
|
130
|
+
const c = i[r], h = n[r], x = {
|
|
131
|
+
id: h?.start === p ? h.id : R++,
|
|
118
132
|
start: p,
|
|
119
133
|
token: c,
|
|
120
134
|
references: /* @__PURE__ */ new Set()
|
|
121
135
|
};
|
|
122
|
-
|
|
136
|
+
a.push(x), q(x), r === i.length - 1 && c.type === "paragraph" && _(c), (!e || !h || JSON.stringify(h.token) !== JSON.stringify(c)) && l.push({ kind: "replace", block: $(x) }), p += c.raw.length;
|
|
123
137
|
}
|
|
124
|
-
const f = new Set(
|
|
125
|
-
for (const
|
|
126
|
-
f.has(
|
|
138
|
+
const f = new Set(a.slice(o).map((r) => r.id));
|
|
139
|
+
for (const r of n)
|
|
140
|
+
f.has(r.id) || l.push({ kind: "remove", id: r.id });
|
|
127
141
|
const u = /* @__PURE__ */ new Set();
|
|
128
|
-
for (const
|
|
129
|
-
if (!(s[
|
|
130
|
-
for (const c of
|
|
142
|
+
for (const r of /* @__PURE__ */ new Set([...Object.keys(s), ...Object.keys(d)]))
|
|
143
|
+
if (!(s[r]?.href === d[r]?.href && s[r]?.title === d[r]?.title))
|
|
144
|
+
for (const c of m.get(r) ?? [])
|
|
131
145
|
c.start < t && u.add(c);
|
|
132
|
-
for (const
|
|
133
|
-
const c = F(
|
|
134
|
-
c.length === 1 && (
|
|
146
|
+
for (const r of u) {
|
|
147
|
+
const c = F(r.token.raw, d);
|
|
148
|
+
c.length === 1 && (r.token = c[0], l.push({ kind: "replace", block: $(r) }));
|
|
135
149
|
}
|
|
136
|
-
const
|
|
137
|
-
o = Math.max(0,
|
|
150
|
+
const P = o;
|
|
151
|
+
o = Math.max(0, a.length - 1), a[o]?.token.type === "space" ? o = Math.max(0, o - 1) : o > 0 && !a[o - 1].token.raw.endsWith(`
|
|
138
152
|
|
|
139
|
-
`) && (
|
|
140
|
-
const
|
|
141
|
-
o > 1 &&
|
|
142
|
-
for (let
|
|
143
|
-
const c =
|
|
144
|
-
c.type === "def" && !
|
|
153
|
+
`) && (a[o - 1]?.token.type !== "space" ? o-- : /\n[ \t]*\n/u.test(a[o - 1].token.raw) || (o = Math.max(0, o - 2)));
|
|
154
|
+
const y = a.at(-1)?.token;
|
|
155
|
+
o > 1 && a[o - 1]?.token.type === "space" && a[o - 2]?.token.type === "list" && (y?.type === "list" || y?.type === "paragraph" && /^ {0,3}(?:[0-9]{1,9}[.)]?|[-+*])[ \t]*$/u.test(y.raw)) && (o -= 2);
|
|
156
|
+
for (let r = P; r < o; r++) {
|
|
157
|
+
const c = a[r].token;
|
|
158
|
+
c.type === "def" && !v[c.tag] && (v[c.tag] = { href: c.href, title: c.title });
|
|
145
159
|
}
|
|
146
|
-
return
|
|
160
|
+
return G(), w(l);
|
|
147
161
|
}
|
|
148
162
|
function J(e) {
|
|
149
163
|
const t = I && e.startsWith(`
|
|
@@ -151,95 +165,90 @@ function V(O) {
|
|
|
151
165
|
return I = e.endsWith("\r"), (t ? e.slice(1) : e).replace(/\r\n?/g, `
|
|
152
166
|
`);
|
|
153
167
|
}
|
|
154
|
-
function
|
|
155
|
-
if (!e) return
|
|
156
|
-
if (C += e.length, e = J(e), !e) return
|
|
168
|
+
function H(e) {
|
|
169
|
+
if (!e) return w([]);
|
|
170
|
+
if (C += e.length, e = J(e), !e) return w([]);
|
|
157
171
|
b.push({ start: L, text: e }), L += e.length;
|
|
158
|
-
const t =
|
|
159
|
-
if (t && o ===
|
|
172
|
+
const t = a.at(-1), n = t?.token;
|
|
173
|
+
if (t && o === a.length - 1 && n?.type === "code" && g && !e.includes("\r") && !E(e, g)) {
|
|
160
174
|
const s = (g.pendingNewline ? `
|
|
161
175
|
` : "") + (e.endsWith(`
|
|
162
176
|
`) ? e.slice(0, -1) : e);
|
|
163
177
|
return g.pendingNewline = e.endsWith(`
|
|
164
|
-
`), n.raw += e, n.text += s,
|
|
178
|
+
`), n.raw += e, n.text += s, w(s ? [{ kind: "append_text", id: t.id, text: s, code: !0 }] : []);
|
|
165
179
|
}
|
|
166
|
-
const
|
|
167
|
-
if (t && o ===
|
|
168
|
-
const s =
|
|
169
|
-
if (
|
|
170
|
-
const c =
|
|
171
|
-
if (
|
|
180
|
+
const i = n?.type === "paragraph" ? n : void 0;
|
|
181
|
+
if (t && o === a.length - 1 && i && O && S && !/[\n\r]/u.test(e)) {
|
|
182
|
+
const s = O, l = i.tokens.at(-1), p = l?.type === "text" && s.from === i.tokens.length - 1 && !z(e) && !s.extensionPending && !/[\\\x60*_[\]<>~&:/.@;|="'()-]/u.test(e) && !/[\\\x60*_[\]<>~&:/.@;|="'()-]$/u.test(s.lastChar);
|
|
183
|
+
if (i.raw += e, i.text += e, p) {
|
|
184
|
+
const c = l, h = s.unresolved ? -1 : e.lastIndexOf(" "), x = h > 0 ? e.slice(0, h) : h === 0 ? "" : e, T = [], A = i.tokens.length - 1;
|
|
185
|
+
if (x && (c.raw += x, c.text += x, T.push({
|
|
172
186
|
kind: "append_text",
|
|
173
187
|
id: t.id,
|
|
174
|
-
text:
|
|
188
|
+
text: x,
|
|
175
189
|
code: !1,
|
|
176
190
|
inlineIndex: A
|
|
177
191
|
})), h >= 0) {
|
|
178
|
-
const j = e.slice(h),
|
|
179
|
-
|
|
192
|
+
const j = e.slice(h), D = { type: "text", raw: j, text: j };
|
|
193
|
+
i.tokens.push(D), T.push({
|
|
180
194
|
kind: "inline",
|
|
181
195
|
id: t.id,
|
|
182
196
|
from: A + 1,
|
|
183
197
|
deleteCount: 0,
|
|
184
|
-
tokens: [structuredClone(
|
|
185
|
-
}),
|
|
198
|
+
tokens: [structuredClone(D)]
|
|
199
|
+
}), O = {
|
|
186
200
|
from: A + 1,
|
|
187
201
|
source: j,
|
|
188
202
|
unresolved: !1,
|
|
203
|
+
extensionPending: !1,
|
|
189
204
|
lastChar: j.slice(-1)
|
|
190
205
|
};
|
|
191
206
|
} else
|
|
192
207
|
s.source += e, s.lastChar = e.slice(-1);
|
|
193
|
-
return
|
|
208
|
+
return w(T);
|
|
194
209
|
}
|
|
195
|
-
const f = new
|
|
210
|
+
const f = new k.Lexer({ ...k.defaults });
|
|
196
211
|
f.tokens.links = d;
|
|
197
212
|
const u = s.source + e;
|
|
198
213
|
W += u.length;
|
|
199
|
-
const
|
|
200
|
-
|
|
201
|
-
const
|
|
202
|
-
return
|
|
214
|
+
const P = f.inlineTokens(u), y = i.tokens.length - s.from;
|
|
215
|
+
i.tokens.splice(s.from, y, ...P), _(i, s.from);
|
|
216
|
+
const r = i.tokens.slice(s.from);
|
|
217
|
+
return w([
|
|
203
218
|
{
|
|
204
219
|
kind: "inline",
|
|
205
220
|
id: t.id,
|
|
206
221
|
from: s.from,
|
|
207
|
-
deleteCount:
|
|
208
|
-
tokens: structuredClone(
|
|
222
|
+
deleteCount: y,
|
|
223
|
+
tokens: structuredClone(r)
|
|
209
224
|
}
|
|
210
225
|
]);
|
|
211
226
|
}
|
|
212
|
-
return
|
|
227
|
+
return N();
|
|
213
228
|
}
|
|
214
|
-
function
|
|
215
|
-
const t = l.map((s) => ({
|
|
216
|
-
kind: "remove",
|
|
217
|
-
id: s.id
|
|
218
|
-
}));
|
|
229
|
+
function K(e = "") {
|
|
219
230
|
C = e.length, I = !1;
|
|
220
|
-
const
|
|
221
|
-
L =
|
|
222
|
-
const r = _();
|
|
223
|
-
return { ...r, changes: [...t, ...r.changes] };
|
|
231
|
+
const t = J(e);
|
|
232
|
+
return L = t.length, b = t ? [{ start: 0, text: t }] : [], d = /* @__PURE__ */ Object.create(null), v = /* @__PURE__ */ Object.create(null), m.clear(), o = 0, g = void 0, M++, N(!0);
|
|
224
233
|
}
|
|
225
|
-
function
|
|
226
|
-
const e =
|
|
234
|
+
function Q() {
|
|
235
|
+
const e = a.map((t) => structuredClone(t.token));
|
|
227
236
|
return e.links = { ...d }, e;
|
|
228
237
|
}
|
|
229
|
-
function
|
|
230
|
-
return
|
|
238
|
+
function V() {
|
|
239
|
+
return M++, o = 0, v = /* @__PURE__ */ Object.create(null), N(!0);
|
|
231
240
|
}
|
|
232
241
|
return {
|
|
233
|
-
append:
|
|
234
|
-
reset:
|
|
235
|
-
finish:
|
|
236
|
-
snapshot:
|
|
242
|
+
append: H,
|
|
243
|
+
reset: K,
|
|
244
|
+
finish: V,
|
|
245
|
+
snapshot: Q,
|
|
237
246
|
get sourceLength() {
|
|
238
247
|
return C;
|
|
239
248
|
},
|
|
240
|
-
diagnostics: () => ({ fullParses:
|
|
249
|
+
diagnostics: () => ({ fullParses: M, parsedCharacters: W, blocks: a.length })
|
|
241
250
|
};
|
|
242
251
|
}
|
|
243
252
|
export {
|
|
244
|
-
|
|
253
|
+
X as createIncrementalMarkdownParser
|
|
245
254
|
};
|