@versini/sassysaint 8.3.2 → 8.3.4

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.
@@ -0,0 +1,255 @@
1
+ import { convert as A, convertElement as u } from "./ChatBubbleAssistant.DDolAlrL.js";
2
+ const f = (
3
+ // Note: overloads like this are needed to support optional generics.
4
+ /**
5
+ * @type {(
6
+ * (<Kind extends UnistParent, Check extends Test>(parent: Kind, index: Child<Kind> | number, test: Check) => Matches<Child<Kind>, Check> | undefined) &
7
+ * (<Kind extends UnistParent>(parent: Kind, index: Child<Kind> | number, test?: null | undefined) => Child<Kind> | undefined)
8
+ * )}
9
+ */
10
+ /**
11
+ * @param {UnistParent} parent
12
+ * @param {UnistNode | number} index
13
+ * @param {Test} [test]
14
+ * @returns {UnistNode | undefined}
15
+ */
16
+ function(e, n, l) {
17
+ const r = A(l);
18
+ if (!e || !e.type || !e.children)
19
+ throw new Error("Expected parent node");
20
+ if (typeof n == "number") {
21
+ if (n < 0 || n === Number.POSITIVE_INFINITY)
22
+ throw new Error("Expected positive finite number as index");
23
+ } else if (n = e.children.indexOf(n), n < 0)
24
+ throw new Error("Expected child node or index");
25
+ for (; ++n < e.children.length; )
26
+ if (r(e.children[n], n, e))
27
+ return e.children[n];
28
+ }
29
+ ), d = /\n/g, g = /[\t ]+/g, p = u("br"), m = u(B), E = u("p"), b = u("tr"), T = u([
30
+ // List from: <https://html.spec.whatwg.org/multipage/rendering.html#hidden-elements>
31
+ "datalist",
32
+ "head",
33
+ "noembed",
34
+ "noframes",
35
+ "noscript",
36
+ // Act as if we support scripting.
37
+ "rp",
38
+ "script",
39
+ "style",
40
+ "template",
41
+ "title",
42
+ // Hidden attribute.
43
+ v,
44
+ // From: <https://html.spec.whatwg.org/multipage/rendering.html#flow-content-3>
45
+ S
46
+ ]), w = u([
47
+ "address",
48
+ // Flow content
49
+ "article",
50
+ // Sections and headings
51
+ "aside",
52
+ // Sections and headings
53
+ "blockquote",
54
+ // Flow content
55
+ "body",
56
+ // Page
57
+ "caption",
58
+ // `table-caption`
59
+ "center",
60
+ // Flow content (legacy)
61
+ "dd",
62
+ // Lists
63
+ "dialog",
64
+ // Flow content
65
+ "dir",
66
+ // Lists (legacy)
67
+ "dl",
68
+ // Lists
69
+ "dt",
70
+ // Lists
71
+ "div",
72
+ // Flow content
73
+ "figure",
74
+ // Flow content
75
+ "figcaption",
76
+ // Flow content
77
+ "footer",
78
+ // Flow content
79
+ "form,",
80
+ // Flow content
81
+ "h1",
82
+ // Sections and headings
83
+ "h2",
84
+ // Sections and headings
85
+ "h3",
86
+ // Sections and headings
87
+ "h4",
88
+ // Sections and headings
89
+ "h5",
90
+ // Sections and headings
91
+ "h6",
92
+ // Sections and headings
93
+ "header",
94
+ // Flow content
95
+ "hgroup",
96
+ // Sections and headings
97
+ "hr",
98
+ // Flow content
99
+ "html",
100
+ // Page
101
+ "legend",
102
+ // Flow content
103
+ "li",
104
+ // Lists (as `display: list-item`)
105
+ "listing",
106
+ // Flow content (legacy)
107
+ "main",
108
+ // Flow content
109
+ "menu",
110
+ // Lists
111
+ "nav",
112
+ // Sections and headings
113
+ "ol",
114
+ // Lists
115
+ "p",
116
+ // Flow content
117
+ "plaintext",
118
+ // Flow content (legacy)
119
+ "pre",
120
+ // Flow content
121
+ "section",
122
+ // Sections and headings
123
+ "ul",
124
+ // Lists
125
+ "xmp"
126
+ // Flow content (legacy)
127
+ ]);
128
+ function _(e, n) {
129
+ const l = n || {}, r = "children" in e ? e.children : [], s = w(e), i = y(e, {
130
+ whitespace: l.whitespace || "normal",
131
+ breakBefore: !1,
132
+ breakAfter: !1
133
+ }), t = [];
134
+ (e.type === "text" || e.type === "comment") && t.push(
135
+ ...k(e, {
136
+ whitespace: i,
137
+ breakBefore: !0,
138
+ breakAfter: !0
139
+ })
140
+ );
141
+ let c = -1;
142
+ for (; ++c < r.length; )
143
+ t.push(
144
+ ...x(
145
+ r[c],
146
+ // @ts-expect-error: `tree` is a parent if we’re here.
147
+ e,
148
+ {
149
+ whitespace: i,
150
+ breakBefore: c ? void 0 : s,
151
+ breakAfter: c < r.length - 1 ? p(r[c + 1]) : s
152
+ }
153
+ )
154
+ );
155
+ const o = [];
156
+ let h;
157
+ for (c = -1; ++c < t.length; ) {
158
+ const a = t[c];
159
+ typeof a == "number" ? h !== void 0 && a > h && (h = a) : a && (h !== void 0 && h > -1 && o.push(`
160
+ `.repeat(h) || " "), h = -1, o.push(a));
161
+ }
162
+ return o.join("");
163
+ }
164
+ function x(e, n, l) {
165
+ return e.type === "element" ? C(e, n, l) : e.type === "text" ? l.whitespace === "normal" ? k(e, l) : I(e) : [];
166
+ }
167
+ function C(e, n, l) {
168
+ const r = y(e, l), s = e.children || [];
169
+ let i = -1, t = [];
170
+ if (T(e))
171
+ return t;
172
+ let c, o;
173
+ for (p(e) || b(e) && // @ts-expect-error: something up with types of parents.
174
+ f(n, e, b) ? o = `
175
+ ` : E(e) ? (c = 2, o = 2) : w(e) && (c = 1, o = 1); ++i < s.length; )
176
+ t = t.concat(
177
+ x(s[i], e, {
178
+ whitespace: r,
179
+ breakBefore: i ? void 0 : c,
180
+ breakAfter: i < s.length - 1 ? p(s[i + 1]) : o
181
+ })
182
+ );
183
+ return m(e) && // @ts-expect-error: something up with types of parents.
184
+ f(n, e, m) && t.push(" "), c && t.unshift(c), o && t.push(o), t;
185
+ }
186
+ function k(e, n) {
187
+ const l = String(e.value), r = [], s = [];
188
+ let i = 0;
189
+ for (; i <= l.length; ) {
190
+ d.lastIndex = i;
191
+ const o = d.exec(l), h = o && "index" in o ? o.index : l.length;
192
+ r.push(
193
+ // Any sequence of collapsible spaces and tabs immediately preceding or
194
+ // following a segment break is removed.
195
+ N(
196
+ // […] ignoring bidi formatting characters (characters with the
197
+ // Bidi_Control property [UAX9]: ALM, LTR, RTL, LRE-RLO, LRI-PDI) as if
198
+ // they were not there.
199
+ l.slice(i, h).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g, ""),
200
+ i === 0 ? n.breakBefore : !0,
201
+ h === l.length ? n.breakAfter : !0
202
+ )
203
+ ), i = h + 1;
204
+ }
205
+ let t = -1, c;
206
+ for (; ++t < r.length; )
207
+ r[t].charCodeAt(r[t].length - 1) === 8203 || t < r.length - 1 && r[t + 1].charCodeAt(0) === 8203 ? (s.push(r[t]), c = void 0) : r[t] ? (typeof c == "number" && s.push(c), s.push(r[t]), c = 0) : (t === 0 || t === r.length - 1) && s.push(0);
208
+ return s;
209
+ }
210
+ function I(e) {
211
+ return [String(e.value)];
212
+ }
213
+ function N(e, n, l) {
214
+ const r = [];
215
+ let s = 0, i;
216
+ for (; s < e.length; ) {
217
+ g.lastIndex = s;
218
+ const t = g.exec(e);
219
+ i = t ? t.index : e.length, !s && !i && t && !n && r.push(""), s !== i && r.push(e.slice(s, i)), s = t ? i + t[0].length : i;
220
+ }
221
+ return s !== i && !l && r.push(""), r.join(" ");
222
+ }
223
+ function y(e, n) {
224
+ if (e.type === "element") {
225
+ const l = e.properties || {};
226
+ switch (e.tagName) {
227
+ case "listing":
228
+ case "plaintext":
229
+ case "xmp":
230
+ return "pre";
231
+ case "nobr":
232
+ return "nowrap";
233
+ case "pre":
234
+ return l.wrap ? "pre-wrap" : "pre";
235
+ case "td":
236
+ case "th":
237
+ return l.noWrap ? "nowrap" : n.whitespace;
238
+ case "textarea":
239
+ return "pre-wrap";
240
+ }
241
+ }
242
+ return n.whitespace;
243
+ }
244
+ function v(e) {
245
+ return !!(e.properties || {}).hidden;
246
+ }
247
+ function B(e) {
248
+ return e.tagName === "td" || e.tagName === "th";
249
+ }
250
+ function S(e) {
251
+ return e.tagName === "dialog" && !(e.properties || {}).open;
252
+ }
253
+ export {
254
+ _ as toText
255
+ };
@@ -0,0 +1,272 @@
1
+ import { factorySpace as M, markdownLineEnding as g } from "./ChatBubbleAssistant.DDolAlrL.js";
2
+ import { longestStreak as q } from "./index.Cyw5OC0t.js";
3
+ function b() {
4
+ return {
5
+ enter: {
6
+ mathFlow: t,
7
+ mathFlowFenceMeta: u,
8
+ mathText: c
9
+ },
10
+ exit: {
11
+ mathFlow: e,
12
+ mathFlowFence: i,
13
+ mathFlowFenceMeta: o,
14
+ mathFlowValue: m,
15
+ mathText: s,
16
+ mathTextData: m
17
+ }
18
+ };
19
+ function t(r) {
20
+ const l = {
21
+ type: "element",
22
+ tagName: "code",
23
+ properties: { className: ["language-math", "math-display"] },
24
+ children: []
25
+ };
26
+ this.enter(
27
+ {
28
+ type: "math",
29
+ meta: null,
30
+ value: "",
31
+ data: { hName: "pre", hChildren: [l] }
32
+ },
33
+ r
34
+ );
35
+ }
36
+ function u() {
37
+ this.buffer();
38
+ }
39
+ function o() {
40
+ const r = this.resume(), l = this.stack[this.stack.length - 1];
41
+ l.meta = r;
42
+ }
43
+ function i() {
44
+ this.data.mathFlowInside || (this.buffer(), this.data.mathFlowInside = !0);
45
+ }
46
+ function e(r) {
47
+ const l = this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g, ""), h = this.stack[this.stack.length - 1];
48
+ this.exit(r), h.value = l, /** @type {HastElement} */
49
+ h.data.hChildren[0].children.push({ type: "text", value: l }), this.data.mathFlowInside = void 0;
50
+ }
51
+ function c(r) {
52
+ this.enter(
53
+ {
54
+ type: "inlineMath",
55
+ value: "",
56
+ data: {
57
+ hName: "code",
58
+ hProperties: { className: ["language-math", "math-inline"] },
59
+ hChildren: []
60
+ }
61
+ },
62
+ r
63
+ ), this.buffer();
64
+ }
65
+ function s(r) {
66
+ const l = this.resume(), h = this.stack[this.stack.length - 1];
67
+ this.exit(r), h.value = l, /** @type {Array<HastElementContent>} */
68
+ // @ts-expect-error: we defined it in `enterMathFlow`.
69
+ h.data.hChildren.push({ type: "text", value: l });
70
+ }
71
+ function m(r) {
72
+ this.config.enter.data.call(this, r), this.config.exit.data.call(this, r);
73
+ }
74
+ }
75
+ function P(t) {
76
+ let u = (t || {}).singleDollarTextMath;
77
+ return u == null && (u = !0), i.peek = e, {
78
+ unsafe: [
79
+ { character: "\r", inConstruct: "mathFlowMeta" },
80
+ { character: `
81
+ `, inConstruct: "mathFlowMeta" },
82
+ {
83
+ character: "$",
84
+ after: u ? void 0 : "\\$",
85
+ inConstruct: "phrasing"
86
+ },
87
+ { character: "$", inConstruct: "mathFlowMeta" },
88
+ { atBreak: !0, character: "$", after: "\\$" }
89
+ ],
90
+ handlers: { math: o, inlineMath: i }
91
+ };
92
+ function o(c, s, m, r) {
93
+ const l = c.value || "", h = m.createTracker(r), p = "$".repeat(Math.max(q(l, "$") + 1, 2)), w = m.enter("mathFlow");
94
+ let x = h.move(p);
95
+ if (c.meta) {
96
+ const F = m.enter("mathFlowMeta");
97
+ x += h.move(
98
+ m.safe(c.meta, {
99
+ after: `
100
+ `,
101
+ before: x,
102
+ encode: ["$"],
103
+ ...h.current()
104
+ })
105
+ ), F();
106
+ }
107
+ return x += h.move(`
108
+ `), l && (x += h.move(l + `
109
+ `)), x += h.move(p), w(), x;
110
+ }
111
+ function i(c, s, m) {
112
+ let r = c.value || "", l = 1;
113
+ for (u || l++; new RegExp("(^|[^$])" + "\\$".repeat(l) + "([^$]|$)").test(r); )
114
+ l++;
115
+ const h = "$".repeat(l);
116
+ // Contains non-space.
117
+ /[^ \r\n]/.test(r) && // Starts with space and ends with space.
118
+ (/^[ \r\n]/.test(r) && /[ \r\n]$/.test(r) || // Starts or ends with dollar.
119
+ /^\$|\$$/.test(r)) && (r = " " + r + " ");
120
+ let p = -1;
121
+ for (; ++p < m.unsafe.length; ) {
122
+ const w = m.unsafe[p];
123
+ if (!w.atBreak) continue;
124
+ const x = m.compilePattern(w);
125
+ let F;
126
+ for (; F = x.exec(r); ) {
127
+ let a = F.index;
128
+ r.codePointAt(a) === 10 && r.codePointAt(a - 1) === 13 && a--, r = r.slice(0, a) + " " + r.slice(F.index + 1);
129
+ }
130
+ }
131
+ return h + r + h;
132
+ }
133
+ function e() {
134
+ return "$";
135
+ }
136
+ }
137
+ const D = {
138
+ tokenize: v,
139
+ concrete: !0,
140
+ name: "mathFlow"
141
+ }, E = {
142
+ tokenize: N,
143
+ partial: !0
144
+ };
145
+ function v(t, u, o) {
146
+ const i = this, e = i.events[i.events.length - 1], c = e && e[1].type === "linePrefix" ? e[2].sliceSerialize(e[1], !0).length : 0;
147
+ let s = 0;
148
+ return m;
149
+ function m(n) {
150
+ return t.enter("mathFlow"), t.enter("mathFlowFence"), t.enter("mathFlowFenceSequence"), r(n);
151
+ }
152
+ function r(n) {
153
+ return n === 36 ? (t.consume(n), s++, r) : s < 2 ? o(n) : (t.exit("mathFlowFenceSequence"), M(t, l, "whitespace")(n));
154
+ }
155
+ function l(n) {
156
+ return n === null || g(n) ? p(n) : (t.enter("mathFlowFenceMeta"), t.enter("chunkString", {
157
+ contentType: "string"
158
+ }), h(n));
159
+ }
160
+ function h(n) {
161
+ return n === null || g(n) ? (t.exit("chunkString"), t.exit("mathFlowFenceMeta"), p(n)) : n === 36 ? o(n) : (t.consume(n), h);
162
+ }
163
+ function p(n) {
164
+ return t.exit("mathFlowFence"), i.interrupt ? u(n) : t.attempt(E, w, f)(n);
165
+ }
166
+ function w(n) {
167
+ return t.attempt({
168
+ tokenize: z,
169
+ partial: !0
170
+ }, f, x)(n);
171
+ }
172
+ function x(n) {
173
+ return (c ? M(t, F, "linePrefix", c + 1) : F)(n);
174
+ }
175
+ function F(n) {
176
+ return n === null ? f(n) : g(n) ? t.attempt(E, w, f)(n) : (t.enter("mathFlowValue"), a(n));
177
+ }
178
+ function a(n) {
179
+ return n === null || g(n) ? (t.exit("mathFlowValue"), F(n)) : (t.consume(n), a);
180
+ }
181
+ function f(n) {
182
+ return t.exit("mathFlow"), u(n);
183
+ }
184
+ function z(n, C, k) {
185
+ let T = 0;
186
+ return M(n, $, "linePrefix", i.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4);
187
+ function $(d) {
188
+ return n.enter("mathFlowFence"), n.enter("mathFlowFenceSequence"), y(d);
189
+ }
190
+ function y(d) {
191
+ return d === 36 ? (T++, n.consume(d), y) : T < s ? k(d) : (n.exit("mathFlowFenceSequence"), M(n, S, "whitespace")(d));
192
+ }
193
+ function S(d) {
194
+ return d === null || g(d) ? (n.exit("mathFlowFence"), C(d)) : k(d);
195
+ }
196
+ }
197
+ }
198
+ function N(t, u, o) {
199
+ const i = this;
200
+ return e;
201
+ function e(s) {
202
+ return s === null ? u(s) : (t.enter("lineEnding"), t.consume(s), t.exit("lineEnding"), c);
203
+ }
204
+ function c(s) {
205
+ return i.parser.lazy[i.now().line] ? o(s) : u(s);
206
+ }
207
+ }
208
+ function I(t) {
209
+ let o = t.singleDollarTextMath;
210
+ return o == null && (o = !0), {
211
+ tokenize: i,
212
+ resolve: O,
213
+ previous: L,
214
+ name: "mathText"
215
+ };
216
+ function i(e, c, s) {
217
+ let m = 0, r, l;
218
+ return h;
219
+ function h(a) {
220
+ return e.enter("mathText"), e.enter("mathTextSequence"), p(a);
221
+ }
222
+ function p(a) {
223
+ return a === 36 ? (e.consume(a), m++, p) : m < 2 && !o ? s(a) : (e.exit("mathTextSequence"), w(a));
224
+ }
225
+ function w(a) {
226
+ return a === null ? s(a) : a === 36 ? (l = e.enter("mathTextSequence"), r = 0, F(a)) : a === 32 ? (e.enter("space"), e.consume(a), e.exit("space"), w) : g(a) ? (e.enter("lineEnding"), e.consume(a), e.exit("lineEnding"), w) : (e.enter("mathTextData"), x(a));
227
+ }
228
+ function x(a) {
229
+ return a === null || a === 32 || a === 36 || g(a) ? (e.exit("mathTextData"), w(a)) : (e.consume(a), x);
230
+ }
231
+ function F(a) {
232
+ return a === 36 ? (e.consume(a), r++, F) : r === m ? (e.exit("mathTextSequence"), e.exit("mathText"), c(a)) : (l.type = "mathTextData", x(a));
233
+ }
234
+ }
235
+ }
236
+ function O(t) {
237
+ let u = t.length - 4, o = 3, i, e;
238
+ if ((t[o][1].type === "lineEnding" || t[o][1].type === "space") && (t[u][1].type === "lineEnding" || t[u][1].type === "space")) {
239
+ for (i = o; ++i < u; )
240
+ if (t[i][1].type === "mathTextData") {
241
+ t[u][1].type = "mathTextPadding", t[o][1].type = "mathTextPadding", o += 2, u -= 2;
242
+ break;
243
+ }
244
+ }
245
+ for (i = o - 1, u++; ++i <= u; )
246
+ e === void 0 ? i !== u && t[i][1].type !== "lineEnding" && (e = i) : (i === u || t[i][1].type === "lineEnding") && (t[e][1].type = "mathTextData", i !== e + 2 && (t[e][1].end = t[i - 1][1].end, t.splice(e + 2, i - e - 2), u -= i - e - 2, i = e + 2), e = void 0);
247
+ return t;
248
+ }
249
+ function L(t) {
250
+ return t !== 36 || this.events[this.events.length - 1][1].type === "characterEscape";
251
+ }
252
+ function _(t) {
253
+ return {
254
+ flow: {
255
+ 36: D
256
+ },
257
+ text: {
258
+ 36: I(t)
259
+ }
260
+ };
261
+ }
262
+ const A = {};
263
+ function R(t) {
264
+ const u = (
265
+ /** @type {Processor} */
266
+ this
267
+ ), o = t || A, i = u.data(), e = i.micromarkExtensions || (i.micromarkExtensions = []), c = i.fromMarkdownExtensions || (i.fromMarkdownExtensions = []), s = i.toMarkdownExtensions || (i.toMarkdownExtensions = []);
268
+ e.push(_(o)), c.push(b()), s.push(P(o));
269
+ }
270
+ export {
271
+ R as default
272
+ };
@@ -0,0 +1,12 @@
1
+ function f(l, t) {
2
+ const i = String(l);
3
+ let e = i.indexOf(t), n = e, o = 0, r = 0;
4
+ if (typeof t != "string")
5
+ throw new TypeError("Expected substring");
6
+ for (; e !== -1; )
7
+ e === n ? ++o > r && (r = o) : o = 1, n = e + t.length, e = i.indexOf(t, n);
8
+ return r;
9
+ }
10
+ export {
11
+ f as longestStreak
12
+ };