@bridgeline-digital/hawkai-assistant 1.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +453 -0
- package/dist/api/client.d.ts +11 -0
- package/dist/api/types.d.ts +73 -0
- package/dist/bridge.d.ts +7 -0
- package/dist/components/App.d.ts +2 -0
- package/dist/components/AssistantButton.d.ts +7 -0
- package/dist/components/AssistantForm.d.ts +2 -0
- package/dist/components/AssistantWindow.d.ts +7 -0
- package/dist/components/LoadingIndicator.d.ts +2 -0
- package/dist/components/Message.d.ts +8 -0
- package/dist/components/MessageList.d.ts +2 -0
- package/dist/components/ProductCarousel.d.ts +7 -0
- package/dist/components/PromptOptions.d.ts +2 -0
- package/dist/components/RenderedTool.d.ts +7 -0
- package/dist/contexts/AssistantContext.d.ts +21 -0
- package/dist/hawkai-assistant.js +97 -0
- package/dist/hooks/useSendMessage.d.ts +7 -0
- package/dist/hooks/useTheme.d.ts +4 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3948 -0
- package/dist/main.d.ts +7 -0
- package/dist/session-manager.d.ts +8 -0
- package/dist/tools/display-products-tool.d.ts +6 -0
- package/dist/tools/page-context-tool.d.ts +12 -0
- package/dist/types.d.ts +81 -0
- package/dist/utilities/parseMarkdown.d.ts +28 -0
- package/package.json +54 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,3948 @@
|
|
|
1
|
+
//#region node_modules/.pnpm/preact@10.29.2/node_modules/preact/dist/preact.module.js
|
|
2
|
+
var e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h = {}, g = [], _ = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, ee = Array.isArray;
|
|
3
|
+
function v(e, t) {
|
|
4
|
+
for (var n in t) e[n] = t[n];
|
|
5
|
+
return e;
|
|
6
|
+
}
|
|
7
|
+
function te(e) {
|
|
8
|
+
e && e.parentNode && e.parentNode.removeChild(e);
|
|
9
|
+
}
|
|
10
|
+
function y(t, n, r) {
|
|
11
|
+
var i, a, o, s = {};
|
|
12
|
+
for (o in n) o == "key" ? i = n[o] : o == "ref" ? a = n[o] : s[o] = n[o];
|
|
13
|
+
if (arguments.length > 2 && (s.children = arguments.length > 3 ? e.call(arguments, 2) : r), typeof t == "function" && t.defaultProps != null) for (o in t.defaultProps) s[o] === void 0 && (s[o] = t.defaultProps[o]);
|
|
14
|
+
return b(t, s, i, a, null);
|
|
15
|
+
}
|
|
16
|
+
function b(e, r, i, a, o) {
|
|
17
|
+
var s = {
|
|
18
|
+
type: e,
|
|
19
|
+
props: r,
|
|
20
|
+
key: i,
|
|
21
|
+
ref: a,
|
|
22
|
+
__k: null,
|
|
23
|
+
__: null,
|
|
24
|
+
__b: 0,
|
|
25
|
+
__e: null,
|
|
26
|
+
__c: null,
|
|
27
|
+
constructor: void 0,
|
|
28
|
+
__v: o ?? ++n,
|
|
29
|
+
__i: -1,
|
|
30
|
+
__u: 0
|
|
31
|
+
};
|
|
32
|
+
return o == null && t.vnode != null && t.vnode(s), s;
|
|
33
|
+
}
|
|
34
|
+
function x(e) {
|
|
35
|
+
return e.children;
|
|
36
|
+
}
|
|
37
|
+
function S(e, t) {
|
|
38
|
+
this.props = e, this.context = t;
|
|
39
|
+
}
|
|
40
|
+
function C(e, t) {
|
|
41
|
+
if (t == null) return e.__ ? C(e.__, e.__i + 1) : null;
|
|
42
|
+
for (var n; t < e.__k.length; t++) if ((n = e.__k[t]) != null && n.__e != null) return n.__e;
|
|
43
|
+
return typeof e.type == "function" ? C(e) : null;
|
|
44
|
+
}
|
|
45
|
+
function ne(e) {
|
|
46
|
+
if (e.__P && e.__d) {
|
|
47
|
+
var n = e.__v, r = n.__e, i = [], a = [], o = v({}, n);
|
|
48
|
+
o.__v = n.__v + 1, t.vnode && t.vnode(o), fe(e.__P, o, n, e.__n, e.__P.namespaceURI, 32 & n.__u ? [r] : null, i, r ?? C(n), !!(32 & n.__u), a), o.__v = n.__v, o.__.__k[o.__i] = o, E(i, o, a), n.__e = n.__ = null, o.__e != r && re(o);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function re(e) {
|
|
52
|
+
if ((e = e.__) != null && e.__c != null) return e.__e = e.__c.base = null, e.__k.some(function(t) {
|
|
53
|
+
if (t != null && t.__e != null) return e.__e = e.__c.base = t.__e;
|
|
54
|
+
}), re(e);
|
|
55
|
+
}
|
|
56
|
+
function ie(e) {
|
|
57
|
+
(!e.__d && (e.__d = !0) && r.push(e) && !ae.__r++ || i != t.debounceRendering) && ((i = t.debounceRendering) || a)(ae);
|
|
58
|
+
}
|
|
59
|
+
function ae() {
|
|
60
|
+
try {
|
|
61
|
+
for (var e, t = 1; r.length;) r.length > t && r.sort(o), e = r.shift(), t = r.length, ne(e);
|
|
62
|
+
} finally {
|
|
63
|
+
r.length = ae.__r = 0;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function w(e, t, n, r, i, a, o, s, c, l, u) {
|
|
67
|
+
var d, f, p, m, _, ee, v, te = r && r.__k || g, y = t.length;
|
|
68
|
+
for (c = oe(n, t, te, c, y), d = 0; d < y; d++) (p = n.__k[d]) != null && (f = p.__i != -1 && te[p.__i] || h, p.__i = d, ee = fe(e, p, f, i, a, o, s, c, l, u), m = p.__e, p.ref && f.ref != p.ref && (f.ref && he(f.ref, null, p), u.push(p.ref, p.__c || m, p)), _ == null && m != null && (_ = m), (v = !!(4 & p.__u)) || f.__k === p.__k ? (c = se(p, c, e, v), v && f.__e && (f.__e = null)) : typeof p.type == "function" && ee !== void 0 ? c = ee : m && (c = m.nextSibling), p.__u &= -7);
|
|
69
|
+
return n.__e = _, c;
|
|
70
|
+
}
|
|
71
|
+
function oe(e, t, n, r, i) {
|
|
72
|
+
var a, o, s, c, l, u = n.length, d = u, f = 0;
|
|
73
|
+
for (e.__k = Array(i), a = 0; a < i; a++) (o = t[a]) != null && typeof o != "boolean" && typeof o != "function" ? (typeof o == "string" || typeof o == "number" || typeof o == "bigint" || o.constructor == String ? o = e.__k[a] = b(null, o, null, null, null) : ee(o) ? o = e.__k[a] = b(x, { children: o }, null, null, null) : o.constructor === void 0 && o.__b > 0 ? o = e.__k[a] = b(o.type, o.props, o.key, o.ref ? o.ref : null, o.__v) : e.__k[a] = o, c = a + f, o.__ = e, o.__b = e.__b + 1, s = null, (l = o.__i = ce(o, n, c, d)) != -1 && (d--, (s = n[l]) && (s.__u |= 2)), s == null || s.__v == null ? (l == -1 && (i > u ? f-- : i < u && f++), typeof o.type != "function" && (o.__u |= 4)) : l != c && (l == c - 1 ? f-- : l == c + 1 ? f++ : (l > c ? f-- : f++, o.__u |= 4))) : e.__k[a] = null;
|
|
74
|
+
if (d) for (a = 0; a < u; a++) (s = n[a]) != null && !(2 & s.__u) && (s.__e == r && (r = C(s)), O(s, s));
|
|
75
|
+
return r;
|
|
76
|
+
}
|
|
77
|
+
function se(e, t, n, r) {
|
|
78
|
+
var i, a;
|
|
79
|
+
if (typeof e.type == "function") {
|
|
80
|
+
for (i = e.__k, a = 0; i && a < i.length; a++) i[a] && (i[a].__ = e, t = se(i[a], t, n, r));
|
|
81
|
+
return t;
|
|
82
|
+
}
|
|
83
|
+
e.__e != t && (r && (t && e.type && !t.parentNode && (t = C(e)), n.insertBefore(e.__e, t || null)), t = e.__e);
|
|
84
|
+
do
|
|
85
|
+
t &&= t.nextSibling;
|
|
86
|
+
while (t != null && t.nodeType == 8);
|
|
87
|
+
return t;
|
|
88
|
+
}
|
|
89
|
+
function T(e, t) {
|
|
90
|
+
return t ||= [], e == null || typeof e == "boolean" || (ee(e) ? e.some(function(e) {
|
|
91
|
+
T(e, t);
|
|
92
|
+
}) : t.push(e)), t;
|
|
93
|
+
}
|
|
94
|
+
function ce(e, t, n, r) {
|
|
95
|
+
var i, a, o, s = e.key, c = e.type, l = t[n], u = l != null && (2 & l.__u) == 0;
|
|
96
|
+
if (l === null && s == null || u && s == l.key && c == l.type) return n;
|
|
97
|
+
if (r > +!!u) {
|
|
98
|
+
for (i = n - 1, a = n + 1; i >= 0 || a < t.length;) if ((l = t[o = i >= 0 ? i-- : a++]) != null && !(2 & l.__u) && s == l.key && c == l.type) return o;
|
|
99
|
+
}
|
|
100
|
+
return -1;
|
|
101
|
+
}
|
|
102
|
+
function le(e, t, n) {
|
|
103
|
+
t[0] == "-" ? e.setProperty(t, n ?? "") : e[t] = n == null ? "" : typeof n != "number" || _.test(t) ? n : n + "px";
|
|
104
|
+
}
|
|
105
|
+
function ue(e, t, n, r, i) {
|
|
106
|
+
var a, o;
|
|
107
|
+
n: if (t == "style") if (typeof n == "string") e.style.cssText = n;
|
|
108
|
+
else {
|
|
109
|
+
if (typeof r == "string" && (e.style.cssText = r = ""), r) for (t in r) n && t in n || le(e.style, t, "");
|
|
110
|
+
if (n) for (t in n) r && n[t] == r[t] || le(e.style, t, n[t]);
|
|
111
|
+
}
|
|
112
|
+
else if (t[0] == "o" && t[1] == "n") a = t != (t = t.replace(u, "$1")), o = t.toLowerCase(), t = o in e || t == "onFocusOut" || t == "onFocusIn" ? o.slice(2) : t.slice(2), e.l ||= {}, e.l[t + a] = n, n ? r ? n[l] = r[l] : (n[l] = d, e.addEventListener(t, a ? p : f, a)) : e.removeEventListener(t, a ? p : f, a);
|
|
113
|
+
else {
|
|
114
|
+
if (i == "http://www.w3.org/2000/svg") t = t.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
|
|
115
|
+
else if (t != "width" && t != "height" && t != "href" && t != "list" && t != "form" && t != "tabIndex" && t != "download" && t != "rowSpan" && t != "colSpan" && t != "role" && t != "popover" && t in e) try {
|
|
116
|
+
e[t] = n ?? "";
|
|
117
|
+
break n;
|
|
118
|
+
} catch {}
|
|
119
|
+
typeof n == "function" || (n == null || !1 === n && t[4] != "-" ? e.removeAttribute(t) : e.setAttribute(t, t == "popover" && n == 1 ? "" : n));
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function de(e) {
|
|
123
|
+
return function(n) {
|
|
124
|
+
if (this.l) {
|
|
125
|
+
var r = this.l[n.type + e];
|
|
126
|
+
if (n[c] == null) n[c] = d++;
|
|
127
|
+
else if (n[c] < r[l]) return;
|
|
128
|
+
return r(t.event ? t.event(n) : n);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
function fe(e, n, r, i, a, o, s, c, l, u) {
|
|
133
|
+
var d, f, p, m, h, _, y, b, C, ne, re, ie, ae, oe, se, T = n.type;
|
|
134
|
+
if (n.constructor !== void 0) return null;
|
|
135
|
+
128 & r.__u && (l = !!(32 & r.__u), o = [c = n.__e = r.__e]), (d = t.__b) && d(n);
|
|
136
|
+
n: if (typeof T == "function") try {
|
|
137
|
+
if (b = n.props, C = T.prototype && T.prototype.render, ne = (d = T.contextType) && i[d.__c], re = d ? ne ? ne.props.value : d.__ : i, r.__c ? y = (f = n.__c = r.__c).__ = f.__E : (C ? n.__c = f = new T(b, re) : (n.__c = f = new S(b, re), f.constructor = T, f.render = ge), ne && ne.sub(f), f.state ||= {}, f.__n = i, p = f.__d = !0, f.__h = [], f._sb = []), C && f.__s == null && (f.__s = f.state), C && T.getDerivedStateFromProps != null && (f.__s == f.state && (f.__s = v({}, f.__s)), v(f.__s, T.getDerivedStateFromProps(b, f.__s))), m = f.props, h = f.state, f.__v = n, p) C && T.getDerivedStateFromProps == null && f.componentWillMount != null && f.componentWillMount(), C && f.componentDidMount != null && f.__h.push(f.componentDidMount);
|
|
138
|
+
else {
|
|
139
|
+
if (C && T.getDerivedStateFromProps == null && b !== m && f.componentWillReceiveProps != null && f.componentWillReceiveProps(b, re), n.__v == r.__v || !f.__e && f.shouldComponentUpdate != null && !1 === f.shouldComponentUpdate(b, f.__s, re)) {
|
|
140
|
+
n.__v != r.__v && (f.props = b, f.state = f.__s, f.__d = !1), n.__e = r.__e, n.__k = r.__k, n.__k.some(function(e) {
|
|
141
|
+
e && (e.__ = n);
|
|
142
|
+
}), g.push.apply(f.__h, f._sb), f._sb = [], f.__h.length && s.push(f);
|
|
143
|
+
break n;
|
|
144
|
+
}
|
|
145
|
+
f.componentWillUpdate != null && f.componentWillUpdate(b, f.__s, re), C && f.componentDidUpdate != null && f.__h.push(function() {
|
|
146
|
+
f.componentDidUpdate(m, h, _);
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
if (f.context = re, f.props = b, f.__P = e, f.__e = !1, ie = t.__r, ae = 0, C) f.state = f.__s, f.__d = !1, ie && ie(n), d = f.render(f.props, f.state, f.context), g.push.apply(f.__h, f._sb), f._sb = [];
|
|
150
|
+
else do
|
|
151
|
+
f.__d = !1, ie && ie(n), d = f.render(f.props, f.state, f.context), f.state = f.__s;
|
|
152
|
+
while (f.__d && ++ae < 25);
|
|
153
|
+
f.state = f.__s, f.getChildContext != null && (i = v(v({}, i), f.getChildContext())), C && !p && f.getSnapshotBeforeUpdate != null && (_ = f.getSnapshotBeforeUpdate(m, h)), oe = d != null && d.type === x && d.key == null ? me(d.props.children) : d, c = w(e, ee(oe) ? oe : [oe], n, r, i, a, o, s, c, l, u), f.base = n.__e, n.__u &= -161, f.__h.length && s.push(f), y && (f.__E = f.__ = null);
|
|
154
|
+
} catch (e) {
|
|
155
|
+
if (n.__v = null, l || o != null) if (e.then) {
|
|
156
|
+
for (n.__u |= l ? 160 : 128; c && c.nodeType == 8 && c.nextSibling;) c = c.nextSibling;
|
|
157
|
+
o[o.indexOf(c)] = null, n.__e = c;
|
|
158
|
+
} else {
|
|
159
|
+
for (se = o.length; se--;) te(o[se]);
|
|
160
|
+
pe(n);
|
|
161
|
+
}
|
|
162
|
+
else n.__e = r.__e, n.__k = r.__k, e.then || pe(n);
|
|
163
|
+
t.__e(e, n, r);
|
|
164
|
+
}
|
|
165
|
+
else o == null && n.__v == r.__v ? (n.__k = r.__k, n.__e = r.__e) : c = n.__e = D(r.__e, n, r, i, a, o, s, l, u);
|
|
166
|
+
return (d = t.diffed) && d(n), 128 & n.__u ? void 0 : c;
|
|
167
|
+
}
|
|
168
|
+
function pe(e) {
|
|
169
|
+
e && (e.__c && (e.__c.__e = !0), e.__k && e.__k.some(pe));
|
|
170
|
+
}
|
|
171
|
+
function E(e, n, r) {
|
|
172
|
+
for (var i = 0; i < r.length; i++) he(r[i], r[++i], r[++i]);
|
|
173
|
+
t.__c && t.__c(n, e), e.some(function(n) {
|
|
174
|
+
try {
|
|
175
|
+
e = n.__h, n.__h = [], e.some(function(e) {
|
|
176
|
+
e.call(n);
|
|
177
|
+
});
|
|
178
|
+
} catch (e) {
|
|
179
|
+
t.__e(e, n.__v);
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
function me(e) {
|
|
184
|
+
return typeof e != "object" || !e || e.__b > 0 ? e : ee(e) ? e.map(me) : e.constructor === void 0 ? v({}, e) : null;
|
|
185
|
+
}
|
|
186
|
+
function D(n, r, i, a, o, s, c, l, u) {
|
|
187
|
+
var d, f, p, m, g, _, v, y = i.props || h, b = r.props, x = r.type;
|
|
188
|
+
if (x == "svg" ? o = "http://www.w3.org/2000/svg" : x == "math" ? o = "http://www.w3.org/1998/Math/MathML" : o ||= "http://www.w3.org/1999/xhtml", s != null) {
|
|
189
|
+
for (d = 0; d < s.length; d++) if ((g = s[d]) && "setAttribute" in g == !!x && (x ? g.localName == x : g.nodeType == 3)) {
|
|
190
|
+
n = g, s[d] = null;
|
|
191
|
+
break;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
if (n == null) {
|
|
195
|
+
if (x == null) return document.createTextNode(b);
|
|
196
|
+
n = document.createElementNS(o, x, b.is && b), l &&= (t.__m && t.__m(r, s), !1), s = null;
|
|
197
|
+
}
|
|
198
|
+
if (x == null) y === b || l && n.data == b || (n.data = b);
|
|
199
|
+
else {
|
|
200
|
+
if (s = x == "textarea" && b.defaultValue != null ? null : s && e.call(n.childNodes), !l && s != null) for (y = {}, d = 0; d < n.attributes.length; d++) y[(g = n.attributes[d]).name] = g.value;
|
|
201
|
+
for (d in y) g = y[d], d == "dangerouslySetInnerHTML" ? p = g : d == "children" || d in b || d == "value" && "defaultValue" in b || d == "checked" && "defaultChecked" in b || ue(n, d, null, g, o);
|
|
202
|
+
for (d in b) g = b[d], d == "children" ? m = g : d == "dangerouslySetInnerHTML" ? f = g : d == "value" ? _ = g : d == "checked" ? v = g : l && typeof g != "function" || y[d] === g || ue(n, d, g, y[d], o);
|
|
203
|
+
if (f) l || p && (f.__html == p.__html || f.__html == n.innerHTML) || (n.innerHTML = f.__html), r.__k = [];
|
|
204
|
+
else if (p && (n.innerHTML = ""), w(r.type == "template" ? n.content : n, ee(m) ? m : [m], r, i, a, x == "foreignObject" ? "http://www.w3.org/1999/xhtml" : o, s, c, s ? s[0] : i.__k && C(i, 0), l, u), s != null) for (d = s.length; d--;) te(s[d]);
|
|
205
|
+
l && x != "textarea" || (d = "value", x == "progress" && _ == null ? n.removeAttribute("value") : _ != null && (_ !== n[d] || x == "progress" && !_ || x == "option" && _ != y[d]) && ue(n, d, _, y[d], o), d = "checked", v != null && v != n[d] && ue(n, d, v, y[d], o));
|
|
206
|
+
}
|
|
207
|
+
return n;
|
|
208
|
+
}
|
|
209
|
+
function he(e, n, r) {
|
|
210
|
+
try {
|
|
211
|
+
if (typeof e == "function") {
|
|
212
|
+
var i = typeof e.__u == "function";
|
|
213
|
+
i && e.__u(), i && n == null || (e.__u = e(n));
|
|
214
|
+
} else e.current = n;
|
|
215
|
+
} catch (e) {
|
|
216
|
+
t.__e(e, r);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
function O(e, n, r) {
|
|
220
|
+
var i, a;
|
|
221
|
+
if (t.unmount && t.unmount(e), (i = e.ref) && (i.current && i.current != e.__e || he(i, null, n)), (i = e.__c) != null) {
|
|
222
|
+
if (i.componentWillUnmount) try {
|
|
223
|
+
i.componentWillUnmount();
|
|
224
|
+
} catch (e) {
|
|
225
|
+
t.__e(e, n);
|
|
226
|
+
}
|
|
227
|
+
i.base = i.__P = null;
|
|
228
|
+
}
|
|
229
|
+
if (i = e.__k) for (a = 0; a < i.length; a++) i[a] && O(i[a], n, r || typeof e.type != "function");
|
|
230
|
+
r || te(e.__e), e.__c = e.__ = e.__e = void 0;
|
|
231
|
+
}
|
|
232
|
+
function ge(e, t, n) {
|
|
233
|
+
return this.constructor(e, n);
|
|
234
|
+
}
|
|
235
|
+
function _e(n, r, i) {
|
|
236
|
+
var a, o, s, c;
|
|
237
|
+
r == document && (r = document.documentElement), t.__ && t.__(n, r), o = (a = typeof i == "function") ? null : i && i.__k || r.__k, s = [], c = [], fe(r, n = (!a && i || r).__k = y(x, null, [n]), o || h, h, r.namespaceURI, !a && i ? [i] : o ? null : r.firstChild ? e.call(r.childNodes) : null, s, !a && i ? i : o ? o.__e : r.firstChild, a, c), E(s, n, c);
|
|
238
|
+
}
|
|
239
|
+
function ve(e) {
|
|
240
|
+
function t(e) {
|
|
241
|
+
var n, r;
|
|
242
|
+
return this.getChildContext || (n = /* @__PURE__ */ new Set(), (r = {})[t.__c] = this, this.getChildContext = function() {
|
|
243
|
+
return r;
|
|
244
|
+
}, this.componentWillUnmount = function() {
|
|
245
|
+
n = null;
|
|
246
|
+
}, this.shouldComponentUpdate = function(e) {
|
|
247
|
+
this.props.value != e.value && n.forEach(function(e) {
|
|
248
|
+
e.__e = !0, ie(e);
|
|
249
|
+
});
|
|
250
|
+
}, this.sub = function(e) {
|
|
251
|
+
n.add(e);
|
|
252
|
+
var t = e.componentWillUnmount;
|
|
253
|
+
e.componentWillUnmount = function() {
|
|
254
|
+
n && n.delete(e), t && t.call(e);
|
|
255
|
+
};
|
|
256
|
+
}), e.children;
|
|
257
|
+
}
|
|
258
|
+
return t.__c = "__cC" + m++, t.__ = e, t.Provider = t.__l = (t.Consumer = function(e, t) {
|
|
259
|
+
return e.children(t);
|
|
260
|
+
}).contextType = t, t;
|
|
261
|
+
}
|
|
262
|
+
e = g.slice, t = { __e: function(e, t, n, r) {
|
|
263
|
+
for (var i, a, o; t = t.__;) if ((i = t.__c) && !i.__) try {
|
|
264
|
+
if ((a = i.constructor) && a.getDerivedStateFromError != null && (i.setState(a.getDerivedStateFromError(e)), o = i.__d), i.componentDidCatch != null && (i.componentDidCatch(e, r || {}), o = i.__d), o) return i.__E = i;
|
|
265
|
+
} catch (t) {
|
|
266
|
+
e = t;
|
|
267
|
+
}
|
|
268
|
+
throw e;
|
|
269
|
+
} }, n = 0, S.prototype.setState = function(e, t) {
|
|
270
|
+
var n = this.__s != null && this.__s != this.state ? this.__s : this.__s = v({}, this.state);
|
|
271
|
+
typeof e == "function" && (e = e(v({}, n), this.props)), e && v(n, e), e != null && this.__v && (t && this._sb.push(t), ie(this));
|
|
272
|
+
}, S.prototype.forceUpdate = function(e) {
|
|
273
|
+
this.__v && (this.__e = !0, e && this.__h.push(e), ie(this));
|
|
274
|
+
}, S.prototype.render = x, r = [], a = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, o = function(e, t) {
|
|
275
|
+
return e.__v.__b - t.__v.__b;
|
|
276
|
+
}, ae.__r = 0, s = Math.random().toString(8), c = "__d" + s, l = "__a" + s, u = /(PointerCapture)$|Capture$/i, d = 0, f = de(!1), p = de(!0), m = 0;
|
|
277
|
+
//#endregion
|
|
278
|
+
//#region src/bridge.ts
|
|
279
|
+
var k = {
|
|
280
|
+
setActorId: void 0,
|
|
281
|
+
toggle: void 0,
|
|
282
|
+
sendMessage: void 0,
|
|
283
|
+
clearChat: void 0
|
|
284
|
+
}, ye, A, be, xe, Se = 0, Ce = [], j = t, we = j.__b, Te = j.__r, Ee = j.diffed, De = j.__c, Oe = j.unmount, ke = j.__;
|
|
285
|
+
function Ae(e, t) {
|
|
286
|
+
j.__h && j.__h(A, e, Se || t), Se = 0;
|
|
287
|
+
var n = A.__H ||= {
|
|
288
|
+
__: [],
|
|
289
|
+
__h: []
|
|
290
|
+
};
|
|
291
|
+
return e >= n.__.length && n.__.push({}), n.__[e];
|
|
292
|
+
}
|
|
293
|
+
function M(e) {
|
|
294
|
+
return Se = 1, je(ze, e);
|
|
295
|
+
}
|
|
296
|
+
function je(e, t, n) {
|
|
297
|
+
var r = Ae(ye++, 2);
|
|
298
|
+
if (r.t = e, !r.__c && (r.__ = [n ? n(t) : ze(void 0, t), function(e) {
|
|
299
|
+
var t = r.__N ? r.__N[0] : r.__[0], n = r.t(t, e);
|
|
300
|
+
t !== n && (r.__N = [n, r.__[1]], r.__c.setState({}));
|
|
301
|
+
}], r.__c = A, !A.__f)) {
|
|
302
|
+
var i = function(e, t, n) {
|
|
303
|
+
if (!r.__c.__H) return !0;
|
|
304
|
+
var i = r.__c.__H.__.filter(function(e) {
|
|
305
|
+
return e.__c;
|
|
306
|
+
});
|
|
307
|
+
if (i.every(function(e) {
|
|
308
|
+
return !e.__N;
|
|
309
|
+
})) return !a || a.call(this, e, t, n);
|
|
310
|
+
var o = r.__c.props !== e;
|
|
311
|
+
return i.some(function(e) {
|
|
312
|
+
if (e.__N) {
|
|
313
|
+
var t = e.__[0];
|
|
314
|
+
e.__ = e.__N, e.__N = void 0, t !== e.__[0] && (o = !0);
|
|
315
|
+
}
|
|
316
|
+
}), a && a.call(this, e, t, n) || o;
|
|
317
|
+
};
|
|
318
|
+
A.__f = !0;
|
|
319
|
+
var a = A.shouldComponentUpdate, o = A.componentWillUpdate;
|
|
320
|
+
A.componentWillUpdate = function(e, t, n) {
|
|
321
|
+
if (this.__e) {
|
|
322
|
+
var r = a;
|
|
323
|
+
a = void 0, i(e, t, n), a = r;
|
|
324
|
+
}
|
|
325
|
+
o && o.call(this, e, t, n);
|
|
326
|
+
}, A.shouldComponentUpdate = i;
|
|
327
|
+
}
|
|
328
|
+
return r.__N || r.__;
|
|
329
|
+
}
|
|
330
|
+
function N(e, t) {
|
|
331
|
+
var n = Ae(ye++, 3);
|
|
332
|
+
!j.__s && F(n.__H, t) && (n.__ = e, n.u = t, A.__H.__h.push(n));
|
|
333
|
+
}
|
|
334
|
+
function P(e) {
|
|
335
|
+
return Se = 5, Me(function() {
|
|
336
|
+
return { current: e };
|
|
337
|
+
}, []);
|
|
338
|
+
}
|
|
339
|
+
function Me(e, t) {
|
|
340
|
+
var n = Ae(ye++, 7);
|
|
341
|
+
return F(n.__H, t) && (n.__ = e(), n.__H = t, n.__h = e), n.__;
|
|
342
|
+
}
|
|
343
|
+
function Ne(e) {
|
|
344
|
+
var t = A.context[e.__c], n = Ae(ye++, 9);
|
|
345
|
+
return n.c = e, t ? (n.__ ?? (n.__ = !0, t.sub(A)), t.props.value) : e.__;
|
|
346
|
+
}
|
|
347
|
+
function Pe() {
|
|
348
|
+
for (var e; e = Ce.shift();) {
|
|
349
|
+
var t = e.__H;
|
|
350
|
+
if (e.__P && t) try {
|
|
351
|
+
t.__h.some(Le), t.__h.some(Re), t.__h = [];
|
|
352
|
+
} catch (n) {
|
|
353
|
+
t.__h = [], j.__e(n, e.__v);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
j.__b = function(e) {
|
|
358
|
+
A = null, we && we(e);
|
|
359
|
+
}, j.__ = function(e, t) {
|
|
360
|
+
e && t.__k && t.__k.__m && (e.__m = t.__k.__m), ke && ke(e, t);
|
|
361
|
+
}, j.__r = function(e) {
|
|
362
|
+
Te && Te(e), ye = 0;
|
|
363
|
+
var t = (A = e.__c).__H;
|
|
364
|
+
t && (be === A ? (t.__h = [], A.__h = [], t.__.some(function(e) {
|
|
365
|
+
e.__N && (e.__ = e.__N), e.u = e.__N = void 0;
|
|
366
|
+
})) : (t.__h.some(Le), t.__h.some(Re), t.__h = [], ye = 0)), be = A;
|
|
367
|
+
}, j.diffed = function(e) {
|
|
368
|
+
Ee && Ee(e);
|
|
369
|
+
var t = e.__c;
|
|
370
|
+
t && t.__H && (t.__H.__h.length && (Ce.push(t) !== 1 && xe === j.requestAnimationFrame || ((xe = j.requestAnimationFrame) || Ie)(Pe)), t.__H.__.some(function(e) {
|
|
371
|
+
e.u && (e.__H = e.u), e.u = void 0;
|
|
372
|
+
})), be = A = null;
|
|
373
|
+
}, j.__c = function(e, t) {
|
|
374
|
+
t.some(function(e) {
|
|
375
|
+
try {
|
|
376
|
+
e.__h.some(Le), e.__h = e.__h.filter(function(e) {
|
|
377
|
+
return !e.__ || Re(e);
|
|
378
|
+
});
|
|
379
|
+
} catch (n) {
|
|
380
|
+
t.some(function(e) {
|
|
381
|
+
e.__h &&= [];
|
|
382
|
+
}), t = [], j.__e(n, e.__v);
|
|
383
|
+
}
|
|
384
|
+
}), De && De(e, t);
|
|
385
|
+
}, j.unmount = function(e) {
|
|
386
|
+
Oe && Oe(e);
|
|
387
|
+
var t, n = e.__c;
|
|
388
|
+
n && n.__H && (n.__H.__.some(function(e) {
|
|
389
|
+
try {
|
|
390
|
+
Le(e);
|
|
391
|
+
} catch (e) {
|
|
392
|
+
t = e;
|
|
393
|
+
}
|
|
394
|
+
}), n.__H = void 0, t && j.__e(t, n.__v));
|
|
395
|
+
};
|
|
396
|
+
var Fe = typeof requestAnimationFrame == "function";
|
|
397
|
+
function Ie(e) {
|
|
398
|
+
var t, n = function() {
|
|
399
|
+
clearTimeout(r), Fe && cancelAnimationFrame(t), setTimeout(e);
|
|
400
|
+
}, r = setTimeout(n, 35);
|
|
401
|
+
Fe && (t = requestAnimationFrame(n));
|
|
402
|
+
}
|
|
403
|
+
function Le(e) {
|
|
404
|
+
var t = A, n = e.__c;
|
|
405
|
+
typeof n == "function" && (e.__c = void 0, n()), A = t;
|
|
406
|
+
}
|
|
407
|
+
function Re(e) {
|
|
408
|
+
var t = A;
|
|
409
|
+
e.__c = e.__(), A = t;
|
|
410
|
+
}
|
|
411
|
+
function F(e, t) {
|
|
412
|
+
return !e || e.length !== t.length || t.some(function(t, n) {
|
|
413
|
+
return t !== e[n];
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
function ze(e, t) {
|
|
417
|
+
return typeof t == "function" ? t(e) : t;
|
|
418
|
+
}
|
|
419
|
+
//#endregion
|
|
420
|
+
//#region node_modules/.pnpm/eventsource-parser@3.0.8/node_modules/eventsource-parser/dist/index.js
|
|
421
|
+
var Be = class extends Error {
|
|
422
|
+
constructor(e, t) {
|
|
423
|
+
super(e), this.name = "ParseError", this.type = t.type, this.field = t.field, this.value = t.value, this.line = t.line;
|
|
424
|
+
}
|
|
425
|
+
}, Ve = 10, He = 13, Ue = 32;
|
|
426
|
+
function We(e) {}
|
|
427
|
+
function Ge(e) {
|
|
428
|
+
if (typeof e == "function") throw TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");
|
|
429
|
+
let { onEvent: t = We, onError: n = We, onRetry: r = We, onComment: i } = e, a = [], o = !0, s, c = "", l = 0, u;
|
|
430
|
+
function d(e) {
|
|
431
|
+
if (o && (o = !1, e.charCodeAt(0) === 239 && e.charCodeAt(1) === 187 && e.charCodeAt(2) === 191 && (e = e.slice(3))), a.length === 0) {
|
|
432
|
+
let t = f(e);
|
|
433
|
+
t !== "" && a.push(t);
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
if (e.indexOf("\n") === -1 && e.indexOf("\r") === -1) {
|
|
437
|
+
a.push(e);
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
a.push(e);
|
|
441
|
+
let t = a.join("");
|
|
442
|
+
a.length = 0;
|
|
443
|
+
let n = f(t);
|
|
444
|
+
n !== "" && a.push(n);
|
|
445
|
+
}
|
|
446
|
+
function f(e) {
|
|
447
|
+
let n = 0;
|
|
448
|
+
if (e.indexOf("\r") === -1) {
|
|
449
|
+
let r = e.indexOf("\n", n);
|
|
450
|
+
for (; r !== -1;) {
|
|
451
|
+
if (n === r) {
|
|
452
|
+
l > 0 && t({
|
|
453
|
+
id: s,
|
|
454
|
+
event: u,
|
|
455
|
+
data: c
|
|
456
|
+
}), s = void 0, c = "", l = 0, u = void 0, n = r + 1, r = e.indexOf("\n", n);
|
|
457
|
+
continue;
|
|
458
|
+
}
|
|
459
|
+
let i = e.charCodeAt(n);
|
|
460
|
+
if (Ke(e, n, i)) {
|
|
461
|
+
let i = e.charCodeAt(n + 5) === Ue ? n + 6 : n + 5, a = e.slice(i, r);
|
|
462
|
+
if (l === 0 && e.charCodeAt(r + 1) === Ve) {
|
|
463
|
+
t({
|
|
464
|
+
id: s,
|
|
465
|
+
event: u,
|
|
466
|
+
data: a
|
|
467
|
+
}), s = void 0, c = "", u = void 0, n = r + 2, r = e.indexOf("\n", n);
|
|
468
|
+
continue;
|
|
469
|
+
}
|
|
470
|
+
c = l === 0 ? a : `${c}
|
|
471
|
+
${a}`, l++;
|
|
472
|
+
} else qe(e, n, i) ? u = e.slice(e.charCodeAt(n + 6) === Ue ? n + 7 : n + 6, r) || void 0 : p(e, n, r);
|
|
473
|
+
n = r + 1, r = e.indexOf("\n", n);
|
|
474
|
+
}
|
|
475
|
+
return e.slice(n);
|
|
476
|
+
}
|
|
477
|
+
for (; n < e.length;) {
|
|
478
|
+
let t = e.indexOf("\r", n), r = e.indexOf("\n", n), i = -1;
|
|
479
|
+
if (t !== -1 && r !== -1 ? i = t < r ? t : r : t === -1 ? r !== -1 && (i = r) : i = t === e.length - 1 ? -1 : t, i === -1) break;
|
|
480
|
+
p(e, n, i), n = i + 1, e.charCodeAt(n - 1) === He && e.charCodeAt(n) === Ve && n++;
|
|
481
|
+
}
|
|
482
|
+
return e.slice(n);
|
|
483
|
+
}
|
|
484
|
+
function p(e, t, n) {
|
|
485
|
+
if (t === n) {
|
|
486
|
+
h();
|
|
487
|
+
return;
|
|
488
|
+
}
|
|
489
|
+
let r = e.charCodeAt(t);
|
|
490
|
+
if (Ke(e, t, r)) {
|
|
491
|
+
let r = e.charCodeAt(t + 5) === Ue ? t + 6 : t + 5, i = e.slice(r, n);
|
|
492
|
+
c = l === 0 ? i : `${c}
|
|
493
|
+
${i}`, l++;
|
|
494
|
+
return;
|
|
495
|
+
}
|
|
496
|
+
if (qe(e, t, r)) {
|
|
497
|
+
u = e.slice(e.charCodeAt(t + 6) === Ue ? t + 7 : t + 6, n) || void 0;
|
|
498
|
+
return;
|
|
499
|
+
}
|
|
500
|
+
if (r === 105 && e.charCodeAt(t + 1) === 100 && e.charCodeAt(t + 2) === 58) {
|
|
501
|
+
let r = e.slice(e.charCodeAt(t + 3) === Ue ? t + 4 : t + 3, n);
|
|
502
|
+
s = r.includes("\0") ? void 0 : r;
|
|
503
|
+
return;
|
|
504
|
+
}
|
|
505
|
+
if (r === 58) {
|
|
506
|
+
i && i(e.slice(t, n).slice(e.charCodeAt(t + 1) === Ue ? 2 : 1));
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
509
|
+
let a = e.slice(t, n), o = a.indexOf(":");
|
|
510
|
+
if (o === -1) {
|
|
511
|
+
m(a, "", a);
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
514
|
+
let d = a.slice(0, o), f = a.charCodeAt(o + 1) === Ue ? 2 : 1;
|
|
515
|
+
m(d, a.slice(o + f), a);
|
|
516
|
+
}
|
|
517
|
+
function m(e, t, i) {
|
|
518
|
+
switch (e) {
|
|
519
|
+
case "event":
|
|
520
|
+
u = t || void 0;
|
|
521
|
+
break;
|
|
522
|
+
case "data":
|
|
523
|
+
c = l === 0 ? t : `${c}
|
|
524
|
+
${t}`, l++;
|
|
525
|
+
break;
|
|
526
|
+
case "id":
|
|
527
|
+
s = t.includes("\0") ? void 0 : t;
|
|
528
|
+
break;
|
|
529
|
+
case "retry":
|
|
530
|
+
/^\d+$/.test(t) ? r(parseInt(t, 10)) : n(new Be(`Invalid \`retry\` value: "${t}"`, {
|
|
531
|
+
type: "invalid-retry",
|
|
532
|
+
value: t,
|
|
533
|
+
line: i
|
|
534
|
+
}));
|
|
535
|
+
break;
|
|
536
|
+
default:
|
|
537
|
+
n(new Be(`Unknown field "${e.length > 20 ? `${e.slice(0, 20)}\u2026` : e}"`, {
|
|
538
|
+
type: "unknown-field",
|
|
539
|
+
field: e,
|
|
540
|
+
value: t,
|
|
541
|
+
line: i
|
|
542
|
+
}));
|
|
543
|
+
break;
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
function h() {
|
|
547
|
+
l > 0 && t({
|
|
548
|
+
id: s,
|
|
549
|
+
event: u,
|
|
550
|
+
data: c
|
|
551
|
+
}), s = void 0, c = "", l = 0, u = void 0;
|
|
552
|
+
}
|
|
553
|
+
function g(e = {}) {
|
|
554
|
+
if (e.consume && a.length > 0) {
|
|
555
|
+
let e = a.join("");
|
|
556
|
+
p(e, 0, e.length);
|
|
557
|
+
}
|
|
558
|
+
o = !0, s = void 0, c = "", l = 0, u = void 0, a.length = 0;
|
|
559
|
+
}
|
|
560
|
+
return {
|
|
561
|
+
feed: d,
|
|
562
|
+
reset: g
|
|
563
|
+
};
|
|
564
|
+
}
|
|
565
|
+
function Ke(e, t, n) {
|
|
566
|
+
return n === 100 && e.charCodeAt(t + 1) === 97 && e.charCodeAt(t + 2) === 116 && e.charCodeAt(t + 3) === 97 && e.charCodeAt(t + 4) === 58;
|
|
567
|
+
}
|
|
568
|
+
function qe(e, t, n) {
|
|
569
|
+
return n === 101 && e.charCodeAt(t + 1) === 118 && e.charCodeAt(t + 2) === 101 && e.charCodeAt(t + 3) === 110 && e.charCodeAt(t + 4) === 116 && e.charCodeAt(t + 5) === 58;
|
|
570
|
+
}
|
|
571
|
+
//#endregion
|
|
572
|
+
//#region node_modules/.pnpm/uuid@14.0.0/node_modules/uuid/dist/stringify.js
|
|
573
|
+
var I = [];
|
|
574
|
+
for (let e = 0; e < 256; ++e) I.push((e + 256).toString(16).slice(1));
|
|
575
|
+
function Je(e, t = 0) {
|
|
576
|
+
return (I[e[t + 0]] + I[e[t + 1]] + I[e[t + 2]] + I[e[t + 3]] + "-" + I[e[t + 4]] + I[e[t + 5]] + "-" + I[e[t + 6]] + I[e[t + 7]] + "-" + I[e[t + 8]] + I[e[t + 9]] + "-" + I[e[t + 10]] + I[e[t + 11]] + I[e[t + 12]] + I[e[t + 13]] + I[e[t + 14]] + I[e[t + 15]]).toLowerCase();
|
|
577
|
+
}
|
|
578
|
+
//#endregion
|
|
579
|
+
//#region node_modules/.pnpm/uuid@14.0.0/node_modules/uuid/dist/rng.js
|
|
580
|
+
var Ye = new Uint8Array(16);
|
|
581
|
+
function Xe() {
|
|
582
|
+
return crypto.getRandomValues(Ye);
|
|
583
|
+
}
|
|
584
|
+
//#endregion
|
|
585
|
+
//#region node_modules/.pnpm/uuid@14.0.0/node_modules/uuid/dist/v4.js
|
|
586
|
+
function Ze(e, t, n) {
|
|
587
|
+
return !t && !e && crypto.randomUUID ? crypto.randomUUID() : Qe(e, t, n);
|
|
588
|
+
}
|
|
589
|
+
function Qe(e, t, n) {
|
|
590
|
+
e ||= {};
|
|
591
|
+
let r = e.random ?? e.rng?.() ?? Xe();
|
|
592
|
+
if (r.length < 16) throw Error("Random bytes length must be >= 16");
|
|
593
|
+
if (r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, t) {
|
|
594
|
+
if (n ||= 0, n < 0 || n + 16 > t.length) throw RangeError(`UUID byte range ${n}:${n + 15} is out of buffer bounds`);
|
|
595
|
+
for (let e = 0; e < 16; ++e) t[n + e] = r[e];
|
|
596
|
+
return t;
|
|
597
|
+
}
|
|
598
|
+
return Je(r);
|
|
599
|
+
}
|
|
600
|
+
//#endregion
|
|
601
|
+
//#region src/session-manager.ts
|
|
602
|
+
var $e = "hawkai-assistant:sessionId", et = "hawkai-assistant:actorId", L = "", R = "", tt, nt = (e) => {
|
|
603
|
+
try {
|
|
604
|
+
return localStorage.getItem(e);
|
|
605
|
+
} catch {
|
|
606
|
+
return null;
|
|
607
|
+
}
|
|
608
|
+
}, rt = (e, t) => {
|
|
609
|
+
try {
|
|
610
|
+
localStorage.setItem(e, t);
|
|
611
|
+
} catch {
|
|
612
|
+
return;
|
|
613
|
+
}
|
|
614
|
+
}, it = () => {
|
|
615
|
+
let e = nt($e);
|
|
616
|
+
e && (L = e), R = nt(et) || window.HawkAI.Assistant.config.actorId || Ze(), rt(et, R), tt = window.HawkAI.Assistant.config.context;
|
|
617
|
+
}, at = () => L, z = () => R, ot = () => {
|
|
618
|
+
L = Ze(), rt($e, L);
|
|
619
|
+
}, st = () => {
|
|
620
|
+
L || (L = Ze(), rt($e, L));
|
|
621
|
+
}, ct = (e) => {
|
|
622
|
+
R = e || Ze(), rt(et, R);
|
|
623
|
+
}, lt = () => tt, ut = (e) => {
|
|
624
|
+
tt = e;
|
|
625
|
+
}, dt = (e, t) => e instanceof Error && e.message ? e.message : t, ft = async (e) => {
|
|
626
|
+
let t = (await e.text()).trim();
|
|
627
|
+
return t ? `Assistant API error ${e.status}: ${t}` : `Assistant API error ${e.status}`;
|
|
628
|
+
}, pt = async (e, t, n, r) => {
|
|
629
|
+
st();
|
|
630
|
+
let i = window.HawkAI.Assistant.config, a = `${i.apiUrl}/invocations`, o = await fetch(a, {
|
|
631
|
+
method: "POST",
|
|
632
|
+
headers: {
|
|
633
|
+
"Content-Type": "application/json",
|
|
634
|
+
Accept: "text/event-stream",
|
|
635
|
+
Connection: "keep-alive"
|
|
636
|
+
},
|
|
637
|
+
body: JSON.stringify({
|
|
638
|
+
accountId: i.accountId,
|
|
639
|
+
agentId: i.agentId,
|
|
640
|
+
sessionId: at(),
|
|
641
|
+
actorId: z(),
|
|
642
|
+
prompt: e.text,
|
|
643
|
+
files: e.files,
|
|
644
|
+
context: lt(),
|
|
645
|
+
toolResults: e.toolResults?.map(({ toolUseId: e, output: t, status: n }) => ({
|
|
646
|
+
toolUseId: e,
|
|
647
|
+
content: t === void 0 ? [] : [n === "error" || typeof t == "string" ? { text: String(t) } : { json: t }],
|
|
648
|
+
status: n
|
|
649
|
+
})),
|
|
650
|
+
stream: !0,
|
|
651
|
+
tools: t.map(({ name: e, description: t, inputSchema: n }) => ({
|
|
652
|
+
name: e,
|
|
653
|
+
description: t,
|
|
654
|
+
inputSchema: n
|
|
655
|
+
}))
|
|
656
|
+
}),
|
|
657
|
+
signal: r
|
|
658
|
+
});
|
|
659
|
+
if (!o.ok) throw Error(await ft(o));
|
|
660
|
+
let s = "", c = [], l = Ge({ onEvent: (e) => {
|
|
661
|
+
if (!e.data || e.data === "[DONE]") return;
|
|
662
|
+
let t;
|
|
663
|
+
try {
|
|
664
|
+
t = JSON.parse(e.data);
|
|
665
|
+
} catch {
|
|
666
|
+
throw Error("Assistant API returned invalid JSON in the stream.");
|
|
667
|
+
}
|
|
668
|
+
if (e.event === "text") s += t.delta, n(s);
|
|
669
|
+
else if (e.event === "frontendTool") {
|
|
670
|
+
let e = t;
|
|
671
|
+
c.push(e);
|
|
672
|
+
}
|
|
673
|
+
} });
|
|
674
|
+
if (!o.body) return { role: "assistant" };
|
|
675
|
+
let u = o.body.getReader(), d = new TextDecoder();
|
|
676
|
+
for (;;) {
|
|
677
|
+
let { done: e, value: t } = await u.read();
|
|
678
|
+
if (e) break;
|
|
679
|
+
try {
|
|
680
|
+
l.feed(d.decode(t, { stream: !0 }));
|
|
681
|
+
} catch (e) {
|
|
682
|
+
throw Error(dt(e, "Assistant API returned an invalid stream."));
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
let f = { role: "assistant" };
|
|
686
|
+
return s && (f.text = s), c.length > 0 && (f.toolUses = c.map(({ toolUseId: e, tool: t, args: n }) => ({
|
|
687
|
+
id: e,
|
|
688
|
+
name: t,
|
|
689
|
+
input: n
|
|
690
|
+
}))), f;
|
|
691
|
+
}, mt = async (e, t, n, r) => {
|
|
692
|
+
let i = e;
|
|
693
|
+
for (; !r?.aborted;) {
|
|
694
|
+
n.onAssistantTurnStart();
|
|
695
|
+
let e = await pt(i, t, n.onAssistantTextDelta, r);
|
|
696
|
+
if (n.onAssistantTurnComplete(e), !e.toolUses?.length) break;
|
|
697
|
+
let a = {
|
|
698
|
+
role: "user",
|
|
699
|
+
toolResults: await Promise.all(e.toolUses.map(async (e) => {
|
|
700
|
+
let r = t.find((t) => t.name === e.name);
|
|
701
|
+
if (r) try {
|
|
702
|
+
let t = await r.execute(e.input ?? {});
|
|
703
|
+
return n.onToolResult(e.id, t, "success"), {
|
|
704
|
+
toolUseId: e.id,
|
|
705
|
+
output: t,
|
|
706
|
+
status: "success"
|
|
707
|
+
};
|
|
708
|
+
} catch (t) {
|
|
709
|
+
let r = dt(t, `Tool "${e.name}" failed.`);
|
|
710
|
+
return n.onToolResult(e.id, r, "error"), {
|
|
711
|
+
toolUseId: e.id,
|
|
712
|
+
output: r,
|
|
713
|
+
status: "error"
|
|
714
|
+
};
|
|
715
|
+
}
|
|
716
|
+
let i = `Tool "${e.name}" not found.`;
|
|
717
|
+
return n.onToolResult(e.id, i, "error"), {
|
|
718
|
+
toolUseId: e.id,
|
|
719
|
+
output: i,
|
|
720
|
+
status: "error"
|
|
721
|
+
};
|
|
722
|
+
}))
|
|
723
|
+
};
|
|
724
|
+
n.onToolResultsTurn(a), i = a;
|
|
725
|
+
}
|
|
726
|
+
}, ht = async () => {
|
|
727
|
+
if (!at()) return [];
|
|
728
|
+
let e = window.HawkAI.Assistant.config, t = `${e.apiUrl}/invocations`, n = at(), r = await fetch(t, {
|
|
729
|
+
method: "POST",
|
|
730
|
+
headers: {
|
|
731
|
+
"Content-Type": "application/json",
|
|
732
|
+
"x-agent-id": e.agentId
|
|
733
|
+
},
|
|
734
|
+
body: JSON.stringify({
|
|
735
|
+
accountId: e.accountId,
|
|
736
|
+
agentId: e.agentId,
|
|
737
|
+
sessionId: n,
|
|
738
|
+
actorId: z(),
|
|
739
|
+
action: "getHistory"
|
|
740
|
+
})
|
|
741
|
+
});
|
|
742
|
+
return r.ok ? (await r.json()).turns : (console.error("[HawkAI Assistant] Failed to retrieve conversation history for session:", n), []);
|
|
743
|
+
}, gt = 0;
|
|
744
|
+
Array.isArray;
|
|
745
|
+
function B(e, n, r, i, a, o) {
|
|
746
|
+
n ||= {};
|
|
747
|
+
var s, c, l = n;
|
|
748
|
+
if ("ref" in l) for (c in l = {}, n) c == "ref" ? s = n[c] : l[c] = n[c];
|
|
749
|
+
var u = {
|
|
750
|
+
type: e,
|
|
751
|
+
props: l,
|
|
752
|
+
key: r,
|
|
753
|
+
ref: s,
|
|
754
|
+
__k: null,
|
|
755
|
+
__: null,
|
|
756
|
+
__b: 0,
|
|
757
|
+
__e: null,
|
|
758
|
+
__c: null,
|
|
759
|
+
constructor: void 0,
|
|
760
|
+
__v: --gt,
|
|
761
|
+
__i: -1,
|
|
762
|
+
__u: 0,
|
|
763
|
+
__source: a,
|
|
764
|
+
__self: o
|
|
765
|
+
};
|
|
766
|
+
if (typeof e == "function" && (s = e.defaultProps)) for (c in s) l[c] === void 0 && (l[c] = s[c]);
|
|
767
|
+
return t.vnode && t.vnode(u), u;
|
|
768
|
+
}
|
|
769
|
+
//#endregion
|
|
770
|
+
//#region src/components/ProductCarousel.tsx
|
|
771
|
+
var _t = ({ product: e }) => {
|
|
772
|
+
let t = e.salePrice ?? e.price, n = window.HawkAI.Assistant.config.addToCart;
|
|
773
|
+
return /* @__PURE__ */ B("div", {
|
|
774
|
+
className: "hawkai-assistant__product flex w-32 shrink-0 flex-col overflow-hidden rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 text-xs text-gray-700 dark:text-gray-300",
|
|
775
|
+
children: [/* @__PURE__ */ B("a", {
|
|
776
|
+
href: e.url,
|
|
777
|
+
target: "_top",
|
|
778
|
+
rel: "noreferrer",
|
|
779
|
+
className: "flex flex-col hover:shadow-md",
|
|
780
|
+
children: [e.imageUrl && /* @__PURE__ */ B("img", {
|
|
781
|
+
src: e.imageUrl,
|
|
782
|
+
alt: e.title,
|
|
783
|
+
className: "hawkai-assistant__product__image h-20 w-full object-cover"
|
|
784
|
+
}), /* @__PURE__ */ B("div", {
|
|
785
|
+
className: "hawkai-assistant__product__info flex flex-col gap-1 p-2",
|
|
786
|
+
children: [/* @__PURE__ */ B("span", {
|
|
787
|
+
className: "hawkai-assistant__product__title line-clamp-2 font-medium leading-tight",
|
|
788
|
+
children: e.title
|
|
789
|
+
}), t !== void 0 && /* @__PURE__ */ B("span", {
|
|
790
|
+
className: "hawkai-assistant__product__price font-semibold text-primary",
|
|
791
|
+
children: ["$", t.toFixed(2)]
|
|
792
|
+
})]
|
|
793
|
+
})]
|
|
794
|
+
}), n && /* @__PURE__ */ B("button", {
|
|
795
|
+
type: "button",
|
|
796
|
+
className: "hawkai-assistant__product__add-to-cart-button w-full px-2 py-1 text-xs font-medium text-white bg-primary cursor-pointer hover:opacity-90",
|
|
797
|
+
onClick: (t) => {
|
|
798
|
+
t.stopPropagation(), n(e);
|
|
799
|
+
},
|
|
800
|
+
children: "Add to Cart"
|
|
801
|
+
})]
|
|
802
|
+
});
|
|
803
|
+
}, vt = ({ products: e }) => /* @__PURE__ */ B("div", {
|
|
804
|
+
className: "hawkai-assistant__carousel flex gap-2 overflow-x-auto py-1",
|
|
805
|
+
children: e.map((e) => /* @__PURE__ */ B(_t, { product: e }, e.id))
|
|
806
|
+
}), yt = () => ({
|
|
807
|
+
name: "display_products",
|
|
808
|
+
description: "Render a visual product carousel that is immediately visible to the user in the chat.\nCall this after a product search to show products that directly match what the user asked for.\nOnly include products that are genuinely relevant — if the user asked for shoes, exclude shoe organizers, shoe racks, or other accessories.\nWhen in doubt, omit the result rather than showing something tangentially related.\n\nYou may call this multiple times in a single response — once per product category when handling multi-part queries.\nUse your judgment on how to group results:\n- If a category search returns multiple relevant options for the user to choose between, give it its own labeled carousel (e.g. \"Hiking Boots:\").\n- If a category search returns only one clear match, do not give it its own carousel — instead, collect all such single picks together and show them in one combined carousel (e.g. \"Complete Hiking Outfit:\").\nThe goal is that a carousel represents either a set of options to choose from, or a curated complete set — never a sequence of single-item carousels one per category.\n\nWrite a short label (e.g. \"Hiking Boots:\") in your text before each carousel so the user knows what they're looking at.\nThe product cards are fully visible to the user including names, images, prices, and descriptions — do not follow up with tables, bullet lists, or summaries of the products shown.\nYour text after a carousel should only add context, comparisons, or recommendations beyond what the cards already show.\n\nCRITICAL — DO NOT REPEAT\nNever call display_products again with the same or substantially overlapping products that you already displayed in a prior turn of this conversation. Once a toolResult confirms a previous\ndisplay_products succeeded, your next assistant response must be CONVERSATIONAL TEXT ONLY — a follow-up question, recommendation, comparison, or a different tool call (e.g. add_to_cart).\nOnly call display_products again when the user explicitly asks for NEW or DIFFERENT products — e.g. \"show me goggles instead\", \"what about boots?\", \"filter by brand X\", \"add more\".\nIf the user submits a toolResult after a successful display_products call without asking for anything new, respond with text only.",
|
|
809
|
+
inputSchema: {
|
|
810
|
+
type: "object",
|
|
811
|
+
properties: { products: {
|
|
812
|
+
type: "array",
|
|
813
|
+
description: "The products to display.",
|
|
814
|
+
items: {
|
|
815
|
+
type: "object",
|
|
816
|
+
properties: {
|
|
817
|
+
id: {
|
|
818
|
+
type: "string",
|
|
819
|
+
description: "Unique product identifier."
|
|
820
|
+
},
|
|
821
|
+
title: {
|
|
822
|
+
type: "string",
|
|
823
|
+
description: "Product name."
|
|
824
|
+
},
|
|
825
|
+
url: {
|
|
826
|
+
type: "string",
|
|
827
|
+
description: "URL of the product page."
|
|
828
|
+
},
|
|
829
|
+
imageUrl: {
|
|
830
|
+
type: "string",
|
|
831
|
+
description: "URL of the product image."
|
|
832
|
+
},
|
|
833
|
+
price: {
|
|
834
|
+
type: "number",
|
|
835
|
+
description: "Regular price."
|
|
836
|
+
},
|
|
837
|
+
salePrice: {
|
|
838
|
+
type: "number",
|
|
839
|
+
description: "Sale price, if discounted."
|
|
840
|
+
},
|
|
841
|
+
rating: {
|
|
842
|
+
type: "number",
|
|
843
|
+
description: "Average rating (0–5)."
|
|
844
|
+
},
|
|
845
|
+
brand: {
|
|
846
|
+
type: "string",
|
|
847
|
+
description: "Brand name."
|
|
848
|
+
},
|
|
849
|
+
sku: {
|
|
850
|
+
type: "string",
|
|
851
|
+
description: "SKU or part number."
|
|
852
|
+
},
|
|
853
|
+
description: {
|
|
854
|
+
type: "string",
|
|
855
|
+
description: "Short product description."
|
|
856
|
+
}
|
|
857
|
+
},
|
|
858
|
+
required: [
|
|
859
|
+
"id",
|
|
860
|
+
"title",
|
|
861
|
+
"url"
|
|
862
|
+
]
|
|
863
|
+
}
|
|
864
|
+
} },
|
|
865
|
+
required: ["products"]
|
|
866
|
+
},
|
|
867
|
+
execute: async (e) => `Product cards have been displayed for products with IDs: ${e.products.map((e) => e.id).join(", ")}`,
|
|
868
|
+
render: ({ input: e }) => {
|
|
869
|
+
let t = e.products ?? [];
|
|
870
|
+
return t.length === 0 ? null : y(vt, { products: t });
|
|
871
|
+
}
|
|
872
|
+
}), bt = () => ({
|
|
873
|
+
name: "retrieve_page_context",
|
|
874
|
+
description: "Get information about the page the user is currently viewing: URL, title, headings, and main content. Call this when the user asks about the current page or when page details would materially improve the answer.",
|
|
875
|
+
inputSchema: {
|
|
876
|
+
type: "object",
|
|
877
|
+
properties: {}
|
|
878
|
+
},
|
|
879
|
+
execute: async (e) => {
|
|
880
|
+
let t = (e) => document.querySelector(`meta[name="${e}"]`)?.content || document.querySelector(`meta[property="${e}"]`)?.content || "", n = document.title || "", r = t("description") || t("og:description") || "", i = t("og:title") || "", a = document.querySelector("h1")?.textContent?.trim() || "", o = [];
|
|
881
|
+
document.querySelectorAll("script[type=\"application/ld+json\"]").forEach((e) => {
|
|
882
|
+
try {
|
|
883
|
+
o.push(JSON.parse(e.textContent ?? ""));
|
|
884
|
+
} catch {}
|
|
885
|
+
});
|
|
886
|
+
let s = document.querySelector("main") || document.querySelector("[role=\"main\"]") || document.querySelector("article") || document.querySelector(".content") || document.querySelector("#content"), c = 1700, l = (s?.textContent?.trim() || "").replace(/\n{3,}/g, "\n\n"), u = o.length ? JSON.stringify(o).slice(0, 300) : "", d = l.slice(0, c) + (l.length > c ? "…" : "");
|
|
887
|
+
return {
|
|
888
|
+
url: location.href,
|
|
889
|
+
title: n,
|
|
890
|
+
description: r,
|
|
891
|
+
ogTitle: i,
|
|
892
|
+
h1: a,
|
|
893
|
+
mainContent: d,
|
|
894
|
+
structuredData: u
|
|
895
|
+
};
|
|
896
|
+
}
|
|
897
|
+
}), xt = ve(null), St = "hawkai-assistant-closed", Ct = () => {
|
|
898
|
+
try {
|
|
899
|
+
return localStorage.getItem(St) === "true";
|
|
900
|
+
} catch {
|
|
901
|
+
return !1;
|
|
902
|
+
}
|
|
903
|
+
}, wt = ({ children: e }) => {
|
|
904
|
+
let [t, n] = M([]), [r, i] = M(!1), [a, o] = M(!1), [s, c] = M(Ct);
|
|
905
|
+
N(() => {
|
|
906
|
+
ht().then(n).finally(() => i(!0));
|
|
907
|
+
}, []), N(() => {
|
|
908
|
+
try {
|
|
909
|
+
localStorage.setItem(St, String(s));
|
|
910
|
+
} catch {
|
|
911
|
+
return;
|
|
912
|
+
}
|
|
913
|
+
}, [s]);
|
|
914
|
+
let l = (e) => {
|
|
915
|
+
n((t) => [...t, e]);
|
|
916
|
+
}, u = (e) => {
|
|
917
|
+
n((t) => t.length === 0 ? [e] : [...t.slice(0, -1), e]);
|
|
918
|
+
}, d = (e) => {
|
|
919
|
+
n((t) => {
|
|
920
|
+
if (t.length === 0) return t;
|
|
921
|
+
let n = t[t.length - 1];
|
|
922
|
+
return n.role === "assistant" ? [...t.slice(0, -1), {
|
|
923
|
+
...n,
|
|
924
|
+
text: e
|
|
925
|
+
}] : t;
|
|
926
|
+
});
|
|
927
|
+
}, f = [
|
|
928
|
+
bt(),
|
|
929
|
+
yt(),
|
|
930
|
+
...window.HawkAI.Assistant.config.tools ?? []
|
|
931
|
+
], p = () => {
|
|
932
|
+
ot(), n([]);
|
|
933
|
+
};
|
|
934
|
+
return N(() => (k.setActorId = (e) => {
|
|
935
|
+
ct(e), p();
|
|
936
|
+
}, () => {
|
|
937
|
+
k.setActorId = void 0;
|
|
938
|
+
}), []), r ? /* @__PURE__ */ B(xt.Provider, {
|
|
939
|
+
value: {
|
|
940
|
+
turns: t,
|
|
941
|
+
tools: f,
|
|
942
|
+
isStreaming: a,
|
|
943
|
+
setIsStreaming: o,
|
|
944
|
+
userClosed: s,
|
|
945
|
+
setUserClosed: c,
|
|
946
|
+
appendTurn: l,
|
|
947
|
+
replaceLastTurn: u,
|
|
948
|
+
updateLastAssistantText: d,
|
|
949
|
+
updateToolUse: (e, t) => {
|
|
950
|
+
n((n) => n.map((n) => {
|
|
951
|
+
if (n.role !== "assistant" || !n.toolUses?.length) return n;
|
|
952
|
+
let r = n.toolUses.findIndex((t) => t.id === e);
|
|
953
|
+
if (r === -1) return n;
|
|
954
|
+
let i = n.toolUses.slice();
|
|
955
|
+
return i[r] = {
|
|
956
|
+
...i[r],
|
|
957
|
+
...t
|
|
958
|
+
}, {
|
|
959
|
+
...n,
|
|
960
|
+
toolUses: i
|
|
961
|
+
};
|
|
962
|
+
}));
|
|
963
|
+
},
|
|
964
|
+
clearChat: p
|
|
965
|
+
},
|
|
966
|
+
children: e
|
|
967
|
+
}) : null;
|
|
968
|
+
}, Tt = () => {
|
|
969
|
+
let e = Ne(xt);
|
|
970
|
+
if (e === null) throw Error("useAssistant must be used inside AssistantProvider");
|
|
971
|
+
return e;
|
|
972
|
+
}, Et = () => window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light", Dt = (e = "automatic") => {
|
|
973
|
+
let [t, n] = M(() => e === "light" || e === "dark" ? e : Et());
|
|
974
|
+
return N(() => {
|
|
975
|
+
if (e === "light" || e === "dark") {
|
|
976
|
+
n(e);
|
|
977
|
+
return;
|
|
978
|
+
}
|
|
979
|
+
n(Et());
|
|
980
|
+
let t = window.matchMedia("(prefers-color-scheme: dark)"), r = (e) => {
|
|
981
|
+
n(e.matches ? "dark" : "light");
|
|
982
|
+
};
|
|
983
|
+
return t.addEventListener("change", r), () => t.removeEventListener("change", r);
|
|
984
|
+
}, [e]), t;
|
|
985
|
+
};
|
|
986
|
+
//#endregion
|
|
987
|
+
//#region node_modules/.pnpm/preact@10.29.2/node_modules/preact/compat/dist/compat.module.js
|
|
988
|
+
function Ot(e, t) {
|
|
989
|
+
for (var n in t) e[n] = t[n];
|
|
990
|
+
return e;
|
|
991
|
+
}
|
|
992
|
+
function kt(e, t) {
|
|
993
|
+
for (var n in e) if (n !== "__source" && !(n in t)) return !0;
|
|
994
|
+
for (var r in t) if (r !== "__source" && e[r] !== t[r]) return !0;
|
|
995
|
+
return !1;
|
|
996
|
+
}
|
|
997
|
+
function At(e, t) {
|
|
998
|
+
this.props = e, this.context = t;
|
|
999
|
+
}
|
|
1000
|
+
(At.prototype = new S()).isPureReactComponent = !0, At.prototype.shouldComponentUpdate = function(e, t) {
|
|
1001
|
+
return kt(this.props, e) || kt(this.state, t);
|
|
1002
|
+
};
|
|
1003
|
+
var jt = t.__b;
|
|
1004
|
+
t.__b = function(e) {
|
|
1005
|
+
e.type && e.type.__f && e.ref && (e.props.ref = e.ref, e.ref = null), jt && jt(e);
|
|
1006
|
+
};
|
|
1007
|
+
var Mt = typeof Symbol < "u" && Symbol.for && Symbol.for("react.forward_ref") || 3911;
|
|
1008
|
+
function Nt(e) {
|
|
1009
|
+
function t(t) {
|
|
1010
|
+
var n = Ot({}, t);
|
|
1011
|
+
return delete n.ref, e(n, t.ref || null);
|
|
1012
|
+
}
|
|
1013
|
+
return t.$$typeof = Mt, t.render = e, t.prototype.isReactComponent = t.__f = !0, t.displayName = "ForwardRef(" + (e.displayName || e.name) + ")", t;
|
|
1014
|
+
}
|
|
1015
|
+
var Pt = t.__e;
|
|
1016
|
+
t.__e = function(e, t, n, r) {
|
|
1017
|
+
if (e.then) {
|
|
1018
|
+
for (var i, a = t; a = a.__;) if ((i = a.__c) && i.__c) return t.__e ?? (t.__e = n.__e, t.__k = n.__k), i.__c(e, t);
|
|
1019
|
+
}
|
|
1020
|
+
Pt(e, t, n, r);
|
|
1021
|
+
};
|
|
1022
|
+
var Ft = t.unmount;
|
|
1023
|
+
function It(e, t, n) {
|
|
1024
|
+
return e && (e.__c && e.__c.__H && (e.__c.__H.__.forEach(function(e) {
|
|
1025
|
+
typeof e.__c == "function" && e.__c();
|
|
1026
|
+
}), e.__c.__H = null), (e = Ot({}, e)).__c != null && (e.__c.__P === n && (e.__c.__P = t), e.__c.__e = !0, e.__c = null), e.__k = e.__k && e.__k.map(function(e) {
|
|
1027
|
+
return It(e, t, n);
|
|
1028
|
+
})), e;
|
|
1029
|
+
}
|
|
1030
|
+
function Lt(e, t, n) {
|
|
1031
|
+
return e && n && (e.__v = null, e.__k = e.__k && e.__k.map(function(e) {
|
|
1032
|
+
return Lt(e, t, n);
|
|
1033
|
+
}), e.__c && e.__c.__P === t && (e.__e && n.appendChild(e.__e), e.__c.__e = !0, e.__c.__P = n)), e;
|
|
1034
|
+
}
|
|
1035
|
+
function Rt() {
|
|
1036
|
+
this.__u = 0, this.o = null, this.__b = null;
|
|
1037
|
+
}
|
|
1038
|
+
function zt(e) {
|
|
1039
|
+
var t = e.__ && e.__.__c;
|
|
1040
|
+
return t && t.__a && t.__a(e);
|
|
1041
|
+
}
|
|
1042
|
+
function Bt() {
|
|
1043
|
+
this.i = null, this.l = null;
|
|
1044
|
+
}
|
|
1045
|
+
t.unmount = function(e) {
|
|
1046
|
+
var t = e.__c;
|
|
1047
|
+
t && (t.__z = !0), t && t.__R && t.__R(), t && 32 & e.__u && (e.type = null), Ft && Ft(e);
|
|
1048
|
+
}, (Rt.prototype = new S()).__c = function(e, t) {
|
|
1049
|
+
var n = t.__c, r = this;
|
|
1050
|
+
r.o ??= [], r.o.push(n);
|
|
1051
|
+
var i = zt(r.__v), a = !1, o = function() {
|
|
1052
|
+
a || r.__z || (a = !0, n.__R = null, i ? i(c) : c());
|
|
1053
|
+
};
|
|
1054
|
+
n.__R = o;
|
|
1055
|
+
var s = n.__P;
|
|
1056
|
+
n.__P = null;
|
|
1057
|
+
var c = function() {
|
|
1058
|
+
if (!--r.__u) {
|
|
1059
|
+
if (r.state.__a) {
|
|
1060
|
+
var e = r.state.__a;
|
|
1061
|
+
r.__v.__k[0] = Lt(e, e.__c.__P, e.__c.__O);
|
|
1062
|
+
}
|
|
1063
|
+
var t;
|
|
1064
|
+
for (r.setState({ __a: r.__b = null }); t = r.o.pop();) t.__P = s, t.forceUpdate();
|
|
1065
|
+
}
|
|
1066
|
+
};
|
|
1067
|
+
r.__u++ || 32 & t.__u || r.setState({ __a: r.__b = r.__v.__k[0] }), e.then(o, o);
|
|
1068
|
+
}, Rt.prototype.componentWillUnmount = function() {
|
|
1069
|
+
this.o = [];
|
|
1070
|
+
}, Rt.prototype.render = function(e, t) {
|
|
1071
|
+
if (this.__b) {
|
|
1072
|
+
if (this.__v.__k) {
|
|
1073
|
+
var n = document.createElement("div"), r = this.__v.__k[0].__c;
|
|
1074
|
+
this.__v.__k[0] = It(this.__b, n, r.__O = r.__P);
|
|
1075
|
+
}
|
|
1076
|
+
this.__b = null;
|
|
1077
|
+
}
|
|
1078
|
+
var i = t.__a && y(x, null, e.fallback);
|
|
1079
|
+
return i && (i.__u &= -33), [y(x, null, t.__a ? null : e.children), i];
|
|
1080
|
+
};
|
|
1081
|
+
var Vt = function(e, t, n) {
|
|
1082
|
+
if (++n[1] === n[0] && e.l.delete(t), e.props.revealOrder && (e.props.revealOrder[0] !== "t" || !e.l.size)) for (n = e.i; n;) {
|
|
1083
|
+
for (; n.length > 3;) n.pop()();
|
|
1084
|
+
if (n[1] < n[0]) break;
|
|
1085
|
+
e.i = n = n[2];
|
|
1086
|
+
}
|
|
1087
|
+
};
|
|
1088
|
+
(Bt.prototype = new S()).__a = function(e) {
|
|
1089
|
+
var t = this, n = zt(t.__v), r = t.l.get(e);
|
|
1090
|
+
return r[0]++, function(i) {
|
|
1091
|
+
var a = function() {
|
|
1092
|
+
t.props.revealOrder ? (r.push(i), Vt(t, e, r)) : i();
|
|
1093
|
+
};
|
|
1094
|
+
n ? n(a) : a();
|
|
1095
|
+
};
|
|
1096
|
+
}, Bt.prototype.render = function(e) {
|
|
1097
|
+
this.i = null, this.l = /* @__PURE__ */ new Map();
|
|
1098
|
+
var t = T(e.children);
|
|
1099
|
+
e.revealOrder && e.revealOrder[0] === "b" && t.reverse();
|
|
1100
|
+
for (var n = t.length; n--;) this.l.set(t[n], this.i = [
|
|
1101
|
+
1,
|
|
1102
|
+
0,
|
|
1103
|
+
this.i
|
|
1104
|
+
]);
|
|
1105
|
+
return e.children;
|
|
1106
|
+
}, Bt.prototype.componentDidUpdate = Bt.prototype.componentDidMount = function() {
|
|
1107
|
+
var e = this;
|
|
1108
|
+
this.l.forEach(function(t, n) {
|
|
1109
|
+
Vt(e, n, t);
|
|
1110
|
+
});
|
|
1111
|
+
};
|
|
1112
|
+
var Ht = typeof Symbol < "u" && Symbol.for && Symbol.for("react.element") || 60103, Ut = /^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/, Wt = /^on(Ani|Tra|Tou|BeforeInp|Compo)/, Gt = /[A-Z0-9]/g, Kt = typeof document < "u", qt = function(e) {
|
|
1113
|
+
return (typeof Symbol < "u" && typeof Symbol() == "symbol" ? /fil|che|rad/ : /fil|che|ra/).test(e);
|
|
1114
|
+
};
|
|
1115
|
+
S.prototype.isReactComponent = !0, [
|
|
1116
|
+
"componentWillMount",
|
|
1117
|
+
"componentWillReceiveProps",
|
|
1118
|
+
"componentWillUpdate"
|
|
1119
|
+
].forEach(function(e) {
|
|
1120
|
+
Object.defineProperty(S.prototype, e, {
|
|
1121
|
+
configurable: !0,
|
|
1122
|
+
get: function() {
|
|
1123
|
+
return this["UNSAFE_" + e];
|
|
1124
|
+
},
|
|
1125
|
+
set: function(t) {
|
|
1126
|
+
Object.defineProperty(this, e, {
|
|
1127
|
+
configurable: !0,
|
|
1128
|
+
writable: !0,
|
|
1129
|
+
value: t
|
|
1130
|
+
});
|
|
1131
|
+
}
|
|
1132
|
+
});
|
|
1133
|
+
});
|
|
1134
|
+
var Jt = t.event;
|
|
1135
|
+
t.event = function(e) {
|
|
1136
|
+
return Jt && (e = Jt(e)), e.persist = function() {}, e.isPropagationStopped = function() {
|
|
1137
|
+
return this.cancelBubble;
|
|
1138
|
+
}, e.isDefaultPrevented = function() {
|
|
1139
|
+
return this.defaultPrevented;
|
|
1140
|
+
}, e.nativeEvent = e;
|
|
1141
|
+
};
|
|
1142
|
+
var Yt = {
|
|
1143
|
+
configurable: !0,
|
|
1144
|
+
get: function() {
|
|
1145
|
+
return this.class;
|
|
1146
|
+
}
|
|
1147
|
+
}, Xt = t.vnode;
|
|
1148
|
+
t.vnode = function(e) {
|
|
1149
|
+
typeof e.type == "string" && function(e) {
|
|
1150
|
+
var t = e.props, n = e.type, r = {}, i = n.indexOf("-") == -1;
|
|
1151
|
+
for (var a in t) {
|
|
1152
|
+
var o = t[a];
|
|
1153
|
+
if (!(a === "value" && "defaultValue" in t && o == null || Kt && a === "children" && n === "noscript" || a === "class" || a === "className")) {
|
|
1154
|
+
var s = a.toLowerCase();
|
|
1155
|
+
a === "defaultValue" && "value" in t && t.value == null ? a = "value" : a === "download" && !0 === o ? o = "" : s === "translate" && o === "no" ? o = !1 : s[0] === "o" && s[1] === "n" ? s === "ondoubleclick" ? a = "ondblclick" : s !== "onchange" || n !== "input" && n !== "textarea" || qt(t.type) ? s === "onfocus" ? a = "onfocusin" : s === "onblur" ? a = "onfocusout" : Wt.test(a) && (a = s) : s = a = "oninput" : i && Ut.test(a) ? a = a.replace(Gt, "-$&").toLowerCase() : o === null && (o = void 0), s === "oninput" && r[a = s] && (a = "oninputCapture"), r[a] = o;
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
n == "select" && (r.multiple && Array.isArray(r.value) && (r.value = T(t.children).forEach(function(e) {
|
|
1159
|
+
e.props.selected = r.value.indexOf(e.props.value) != -1;
|
|
1160
|
+
})), r.defaultValue != null && (r.value = T(t.children).forEach(function(e) {
|
|
1161
|
+
e.props.selected = r.multiple ? r.defaultValue.indexOf(e.props.value) != -1 : r.defaultValue == e.props.value;
|
|
1162
|
+
}))), t.class && !t.className ? (r.class = t.class, Object.defineProperty(r, "className", Yt)) : t.className && (r.class = r.className = t.className), e.props = r;
|
|
1163
|
+
}(e), e.$$typeof = Ht, Xt && Xt(e);
|
|
1164
|
+
};
|
|
1165
|
+
var Zt = t.__r;
|
|
1166
|
+
t.__r = function(e) {
|
|
1167
|
+
Zt && Zt(e), e.__c;
|
|
1168
|
+
};
|
|
1169
|
+
var Qt = t.diffed;
|
|
1170
|
+
t.diffed = function(e) {
|
|
1171
|
+
Qt && Qt(e);
|
|
1172
|
+
var t = e.props, n = e.__e;
|
|
1173
|
+
n != null && e.type === "textarea" && "value" in t && t.value !== n.value && (n.value = t.value == null ? "" : t.value);
|
|
1174
|
+
};
|
|
1175
|
+
//#endregion
|
|
1176
|
+
//#region node_modules/.pnpm/@heroicons+react@2.2.0_react@19.2.6/node_modules/@heroicons/react/24/outline/esm/ChatBubbleOvalLeftEllipsisIcon.js
|
|
1177
|
+
function $t({ title: e, titleId: t, ...n }, r) {
|
|
1178
|
+
return /* @__PURE__ */ y("svg", Object.assign({
|
|
1179
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1180
|
+
fill: "none",
|
|
1181
|
+
viewBox: "0 0 24 24",
|
|
1182
|
+
strokeWidth: 1.5,
|
|
1183
|
+
stroke: "currentColor",
|
|
1184
|
+
"aria-hidden": "true",
|
|
1185
|
+
"data-slot": "icon",
|
|
1186
|
+
ref: r,
|
|
1187
|
+
"aria-labelledby": t
|
|
1188
|
+
}, n), e ? /* @__PURE__ */ y("title", { id: t }, e) : null, /* @__PURE__ */ y("path", {
|
|
1189
|
+
strokeLinecap: "round",
|
|
1190
|
+
strokeLinejoin: "round",
|
|
1191
|
+
d: "M8.625 12a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Zm0 0H8.25m4.125 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Zm0 0H12m4.125 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Zm0 0h-.375M21 12c0 4.556-4.03 8.25-9 8.25a9.764 9.764 0 0 1-2.555-.337A5.972 5.972 0 0 1 5.41 20.97a5.969 5.969 0 0 1-.474-.065 4.48 4.48 0 0 0 .978-2.025c.09-.457-.133-.901-.467-1.226C3.93 16.178 3 14.189 3 12c0-4.556 4.03-8.25 9-8.25s9 3.694 9 8.25Z"
|
|
1192
|
+
}));
|
|
1193
|
+
}
|
|
1194
|
+
var en = /* @__PURE__ */ Nt($t);
|
|
1195
|
+
//#endregion
|
|
1196
|
+
//#region node_modules/.pnpm/@heroicons+react@2.2.0_react@19.2.6/node_modules/@heroicons/react/24/outline/esm/PaperClipIcon.js
|
|
1197
|
+
function tn({ title: e, titleId: t, ...n }, r) {
|
|
1198
|
+
return /* @__PURE__ */ y("svg", Object.assign({
|
|
1199
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1200
|
+
fill: "none",
|
|
1201
|
+
viewBox: "0 0 24 24",
|
|
1202
|
+
strokeWidth: 1.5,
|
|
1203
|
+
stroke: "currentColor",
|
|
1204
|
+
"aria-hidden": "true",
|
|
1205
|
+
"data-slot": "icon",
|
|
1206
|
+
ref: r,
|
|
1207
|
+
"aria-labelledby": t
|
|
1208
|
+
}, n), e ? /* @__PURE__ */ y("title", { id: t }, e) : null, /* @__PURE__ */ y("path", {
|
|
1209
|
+
strokeLinecap: "round",
|
|
1210
|
+
strokeLinejoin: "round",
|
|
1211
|
+
d: "m18.375 12.739-7.693 7.693a4.5 4.5 0 0 1-6.364-6.364l10.94-10.94A3 3 0 1 1 19.5 7.372L8.552 18.32m.009-.01-.01.01m5.699-9.941-7.81 7.81a1.5 1.5 0 0 0 2.112 2.13"
|
|
1212
|
+
}));
|
|
1213
|
+
}
|
|
1214
|
+
var nn = /* @__PURE__ */ Nt(tn);
|
|
1215
|
+
//#endregion
|
|
1216
|
+
//#region node_modules/.pnpm/@heroicons+react@2.2.0_react@19.2.6/node_modules/@heroicons/react/24/outline/esm/XMarkIcon.js
|
|
1217
|
+
function rn({ title: e, titleId: t, ...n }, r) {
|
|
1218
|
+
return /* @__PURE__ */ y("svg", Object.assign({
|
|
1219
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1220
|
+
fill: "none",
|
|
1221
|
+
viewBox: "0 0 24 24",
|
|
1222
|
+
strokeWidth: 1.5,
|
|
1223
|
+
stroke: "currentColor",
|
|
1224
|
+
"aria-hidden": "true",
|
|
1225
|
+
"data-slot": "icon",
|
|
1226
|
+
ref: r,
|
|
1227
|
+
"aria-labelledby": t
|
|
1228
|
+
}, n), e ? /* @__PURE__ */ y("title", { id: t }, e) : null, /* @__PURE__ */ y("path", {
|
|
1229
|
+
strokeLinecap: "round",
|
|
1230
|
+
strokeLinejoin: "round",
|
|
1231
|
+
d: "M6 18 18 6M6 6l12 12"
|
|
1232
|
+
}));
|
|
1233
|
+
}
|
|
1234
|
+
var an = /* @__PURE__ */ Nt(rn);
|
|
1235
|
+
//#endregion
|
|
1236
|
+
//#region node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
|
|
1237
|
+
function on(e) {
|
|
1238
|
+
var t, n, r = "";
|
|
1239
|
+
if (typeof e == "string" || typeof e == "number") r += e;
|
|
1240
|
+
else if (typeof e == "object") if (Array.isArray(e)) {
|
|
1241
|
+
var i = e.length;
|
|
1242
|
+
for (t = 0; t < i; t++) e[t] && (n = on(e[t])) && (r && (r += " "), r += n);
|
|
1243
|
+
} else for (n in e) e[n] && (r && (r += " "), r += n);
|
|
1244
|
+
return r;
|
|
1245
|
+
}
|
|
1246
|
+
function sn() {
|
|
1247
|
+
for (var e, t, n = 0, r = "", i = arguments.length; n < i; n++) (e = arguments[n]) && (t = on(e)) && (r && (r += " "), r += t);
|
|
1248
|
+
return r;
|
|
1249
|
+
}
|
|
1250
|
+
//#endregion
|
|
1251
|
+
//#region src/components/AssistantButton.tsx
|
|
1252
|
+
var cn = ({ isOpen: e, onClick: t }) => {
|
|
1253
|
+
let n = window.HawkAI.Assistant.config?.ui?.position ?? "right";
|
|
1254
|
+
return /* @__PURE__ */ B("button", {
|
|
1255
|
+
type: "button",
|
|
1256
|
+
onClick: t,
|
|
1257
|
+
className: sn({
|
|
1258
|
+
"hawkai-assistant__trigger fixed bottom-6 z-50 flex h-14 w-14 cursor-pointer items-center justify-center rounded-full bg-primary text-white shadow-lg/30 hover:bg-primary-hover focus:outline-none": !0,
|
|
1259
|
+
"hawkai-assistant__trigger--open": e,
|
|
1260
|
+
"hawkai-assistant__trigger--right right-6": n === "right",
|
|
1261
|
+
"hawkai-assistant__trigger--left left-6": n === "left"
|
|
1262
|
+
}),
|
|
1263
|
+
title: e ? "Close Assistant" : "Open Assistant",
|
|
1264
|
+
"aria-label": e ? "Close Assistant" : "Open Assistant",
|
|
1265
|
+
children: B(e ? an : en, {
|
|
1266
|
+
className: "size-6",
|
|
1267
|
+
strokeWidth: 2,
|
|
1268
|
+
"aria-hidden": !0
|
|
1269
|
+
})
|
|
1270
|
+
});
|
|
1271
|
+
};
|
|
1272
|
+
//#endregion
|
|
1273
|
+
//#region node_modules/.pnpm/@heroicons+react@2.2.0_react@19.2.6/node_modules/@heroicons/react/20/solid/esm/ArrowsPointingInIcon.js
|
|
1274
|
+
function ln({ title: e, titleId: t, ...n }, r) {
|
|
1275
|
+
return /* @__PURE__ */ y("svg", Object.assign({
|
|
1276
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1277
|
+
viewBox: "0 0 20 20",
|
|
1278
|
+
fill: "currentColor",
|
|
1279
|
+
"aria-hidden": "true",
|
|
1280
|
+
"data-slot": "icon",
|
|
1281
|
+
ref: r,
|
|
1282
|
+
"aria-labelledby": t
|
|
1283
|
+
}, n), e ? /* @__PURE__ */ y("title", { id: t }, e) : null, /* @__PURE__ */ y("path", { d: "M3.28 2.22a.75.75 0 0 0-1.06 1.06L5.44 6.5H2.75a.75.75 0 0 0 0 1.5h4.5A.75.75 0 0 0 8 7.25v-4.5a.75.75 0 0 0-1.5 0v2.69L3.28 2.22ZM13.5 2.75a.75.75 0 0 0-1.5 0v4.5c0 .414.336.75.75.75h4.5a.75.75 0 0 0 0-1.5h-2.69l3.22-3.22a.75.75 0 0 0-1.06-1.06L13.5 5.44V2.75ZM3.28 17.78l3.22-3.22v2.69a.75.75 0 0 0 1.5 0v-4.5a.75.75 0 0 0-.75-.75h-4.5a.75.75 0 0 0 0 1.5h2.69l-3.22 3.22a.75.75 0 1 0 1.06 1.06ZM13.5 14.56l3.22 3.22a.75.75 0 1 0 1.06-1.06l-3.22-3.22h2.69a.75.75 0 0 0 0-1.5h-4.5a.75.75 0 0 0-.75.75v4.5a.75.75 0 0 0 1.5 0v-2.69Z" }));
|
|
1284
|
+
}
|
|
1285
|
+
var un = /* @__PURE__ */ Nt(ln);
|
|
1286
|
+
//#endregion
|
|
1287
|
+
//#region node_modules/.pnpm/@heroicons+react@2.2.0_react@19.2.6/node_modules/@heroicons/react/20/solid/esm/ArrowsPointingOutIcon.js
|
|
1288
|
+
function dn({ title: e, titleId: t, ...n }, r) {
|
|
1289
|
+
return /* @__PURE__ */ y("svg", Object.assign({
|
|
1290
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1291
|
+
viewBox: "0 0 20 20",
|
|
1292
|
+
fill: "currentColor",
|
|
1293
|
+
"aria-hidden": "true",
|
|
1294
|
+
"data-slot": "icon",
|
|
1295
|
+
ref: r,
|
|
1296
|
+
"aria-labelledby": t
|
|
1297
|
+
}, n), e ? /* @__PURE__ */ y("title", { id: t }, e) : null, /* @__PURE__ */ y("path", { d: "m13.28 7.78 3.22-3.22v2.69a.75.75 0 0 0 1.5 0v-4.5a.75.75 0 0 0-.75-.75h-4.5a.75.75 0 0 0 0 1.5h2.69l-3.22 3.22a.75.75 0 0 0 1.06 1.06ZM2 17.25v-4.5a.75.75 0 0 1 1.5 0v2.69l3.22-3.22a.75.75 0 0 1 1.06 1.06L4.56 16.5h2.69a.75.75 0 0 1 0 1.5h-4.5a.747.747 0 0 1-.75-.75ZM12.22 13.28l3.22 3.22h-2.69a.75.75 0 0 0 0 1.5h4.5a.747.747 0 0 0 .75-.75v-4.5a.75.75 0 0 0-1.5 0v2.69l-3.22-3.22a.75.75 0 1 0-1.06 1.06ZM3.5 4.56l3.22 3.22a.75.75 0 0 0 1.06-1.06L4.56 3.5h2.69a.75.75 0 0 0 0-1.5h-4.5a.75.75 0 0 0-.75.75v4.5a.75.75 0 0 0 1.5 0V4.56Z" }));
|
|
1298
|
+
}
|
|
1299
|
+
var fn = /* @__PURE__ */ Nt(dn);
|
|
1300
|
+
//#endregion
|
|
1301
|
+
//#region node_modules/.pnpm/@heroicons+react@2.2.0_react@19.2.6/node_modules/@heroicons/react/20/solid/esm/PlusIcon.js
|
|
1302
|
+
function pn({ title: e, titleId: t, ...n }, r) {
|
|
1303
|
+
return /* @__PURE__ */ y("svg", Object.assign({
|
|
1304
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1305
|
+
viewBox: "0 0 20 20",
|
|
1306
|
+
fill: "currentColor",
|
|
1307
|
+
"aria-hidden": "true",
|
|
1308
|
+
"data-slot": "icon",
|
|
1309
|
+
ref: r,
|
|
1310
|
+
"aria-labelledby": t
|
|
1311
|
+
}, n), e ? /* @__PURE__ */ y("title", { id: t }, e) : null, /* @__PURE__ */ y("path", { d: "M10.75 4.75a.75.75 0 0 0-1.5 0v4.5h-4.5a.75.75 0 0 0 0 1.5h4.5v4.5a.75.75 0 0 0 1.5 0v-4.5h4.5a.75.75 0 0 0 0-1.5h-4.5v-4.5Z" }));
|
|
1312
|
+
}
|
|
1313
|
+
var mn = /* @__PURE__ */ Nt(pn);
|
|
1314
|
+
//#endregion
|
|
1315
|
+
//#region node_modules/.pnpm/@heroicons+react@2.2.0_react@19.2.6/node_modules/@heroicons/react/20/solid/esm/XMarkIcon.js
|
|
1316
|
+
function hn({ title: e, titleId: t, ...n }, r) {
|
|
1317
|
+
return /* @__PURE__ */ y("svg", Object.assign({
|
|
1318
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1319
|
+
viewBox: "0 0 20 20",
|
|
1320
|
+
fill: "currentColor",
|
|
1321
|
+
"aria-hidden": "true",
|
|
1322
|
+
"data-slot": "icon",
|
|
1323
|
+
ref: r,
|
|
1324
|
+
"aria-labelledby": t
|
|
1325
|
+
}, n), e ? /* @__PURE__ */ y("title", { id: t }, e) : null, /* @__PURE__ */ y("path", { d: "M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z" }));
|
|
1326
|
+
}
|
|
1327
|
+
var gn = /* @__PURE__ */ Nt(hn);
|
|
1328
|
+
//#endregion
|
|
1329
|
+
//#region node_modules/.pnpm/@heroicons+react@2.2.0_react@19.2.6/node_modules/@heroicons/react/24/solid/esm/PaperAirplaneIcon.js
|
|
1330
|
+
function _n({ title: e, titleId: t, ...n }, r) {
|
|
1331
|
+
return /* @__PURE__ */ y("svg", Object.assign({
|
|
1332
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1333
|
+
viewBox: "0 0 24 24",
|
|
1334
|
+
fill: "currentColor",
|
|
1335
|
+
"aria-hidden": "true",
|
|
1336
|
+
"data-slot": "icon",
|
|
1337
|
+
ref: r,
|
|
1338
|
+
"aria-labelledby": t
|
|
1339
|
+
}, n), e ? /* @__PURE__ */ y("title", { id: t }, e) : null, /* @__PURE__ */ y("path", { d: "M3.478 2.404a.75.75 0 0 0-.926.941l2.432 7.905H13.5a.75.75 0 0 1 0 1.5H4.984l-2.432 7.905a.75.75 0 0 0 .926.94 60.519 60.519 0 0 0 18.445-8.986.75.75 0 0 0 0-1.218A60.517 60.517 0 0 0 3.478 2.404Z" }));
|
|
1340
|
+
}
|
|
1341
|
+
var vn = /* @__PURE__ */ Nt(_n);
|
|
1342
|
+
//#endregion
|
|
1343
|
+
//#region node_modules/.pnpm/@heroicons+react@2.2.0_react@19.2.6/node_modules/@heroicons/react/24/solid/esm/StopIcon.js
|
|
1344
|
+
function yn({ title: e, titleId: t, ...n }, r) {
|
|
1345
|
+
return /* @__PURE__ */ y("svg", Object.assign({
|
|
1346
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1347
|
+
viewBox: "0 0 24 24",
|
|
1348
|
+
fill: "currentColor",
|
|
1349
|
+
"aria-hidden": "true",
|
|
1350
|
+
"data-slot": "icon",
|
|
1351
|
+
ref: r,
|
|
1352
|
+
"aria-labelledby": t
|
|
1353
|
+
}, n), e ? /* @__PURE__ */ y("title", { id: t }, e) : null, /* @__PURE__ */ y("path", {
|
|
1354
|
+
fillRule: "evenodd",
|
|
1355
|
+
d: "M4.5 7.5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-9a3 3 0 0 1-3-3v-9Z",
|
|
1356
|
+
clipRule: "evenodd"
|
|
1357
|
+
}));
|
|
1358
|
+
}
|
|
1359
|
+
var bn = /* @__PURE__ */ Nt(yn), xn = (e) => e instanceof Error && e.message ? `Sorry, something went wrong: ${e.message}` : "Sorry, something went wrong while generating a response.", Sn = (e) => new Promise((t, n) => {
|
|
1360
|
+
let r = new FileReader();
|
|
1361
|
+
r.onload = () => t(r.result.split(",")[1]), r.onerror = n, r.readAsDataURL(e);
|
|
1362
|
+
}), Cn = () => {
|
|
1363
|
+
let { tools: e, isStreaming: t, setIsStreaming: n, appendTurn: r, replaceLastTurn: i, updateLastAssistantText: a, updateToolUse: o } = Tt(), s = P(null);
|
|
1364
|
+
return {
|
|
1365
|
+
isStreaming: t,
|
|
1366
|
+
sendMessage: async (c, l = []) => {
|
|
1367
|
+
let u = c?.trim() ?? "";
|
|
1368
|
+
if (!u && !l.length || t) return;
|
|
1369
|
+
let d = await Promise.all(l.map(async (e) => ({
|
|
1370
|
+
name: e.name,
|
|
1371
|
+
mediaType: e.type,
|
|
1372
|
+
data: await Sn(e)
|
|
1373
|
+
}))), f = {
|
|
1374
|
+
role: "user",
|
|
1375
|
+
text: u || void 0,
|
|
1376
|
+
files: d.length > 0 ? d : void 0
|
|
1377
|
+
}, p = new AbortController();
|
|
1378
|
+
s.current = p, r(f), n(!0);
|
|
1379
|
+
try {
|
|
1380
|
+
await mt(f, e, {
|
|
1381
|
+
onAssistantTurnStart: () => r({
|
|
1382
|
+
role: "assistant",
|
|
1383
|
+
text: ""
|
|
1384
|
+
}),
|
|
1385
|
+
onAssistantTextDelta: (e) => a(e),
|
|
1386
|
+
onAssistantTurnComplete: (e) => i(e),
|
|
1387
|
+
onToolResultsTurn: (e) => r(e),
|
|
1388
|
+
onToolResult: (e, t, n) => o(e, {
|
|
1389
|
+
output: t,
|
|
1390
|
+
status: n
|
|
1391
|
+
})
|
|
1392
|
+
}, p.signal);
|
|
1393
|
+
} catch (e) {
|
|
1394
|
+
if (e instanceof DOMException && e.name === "AbortError") return;
|
|
1395
|
+
a(xn(e));
|
|
1396
|
+
} finally {
|
|
1397
|
+
s.current = null, n(!1);
|
|
1398
|
+
}
|
|
1399
|
+
},
|
|
1400
|
+
stopMessage: () => {
|
|
1401
|
+
s.current?.abort();
|
|
1402
|
+
}
|
|
1403
|
+
};
|
|
1404
|
+
}, wn = 3, Tn = () => {
|
|
1405
|
+
let [e, t] = M(""), [n, r] = M([]), i = P(null), { isStreaming: a, sendMessage: o, stopMessage: s } = Cn(), c = window.HawkAI.Assistant.config.ui, l = c?.allowFileUpload !== !1;
|
|
1406
|
+
N(() => (k.sendMessage = o, () => {
|
|
1407
|
+
k.sendMessage = void 0;
|
|
1408
|
+
}), [o]);
|
|
1409
|
+
let u = (e) => {
|
|
1410
|
+
let t = Array.from(e.target.files ?? []), i = wn - n.length;
|
|
1411
|
+
r((e) => [...e, ...t.slice(0, i)]), e.target.value = "";
|
|
1412
|
+
}, d = (e) => {
|
|
1413
|
+
r((t) => t.filter((t, n) => n !== e));
|
|
1414
|
+
}, f = async (i) => {
|
|
1415
|
+
i.preventDefault();
|
|
1416
|
+
let a = e, s = n;
|
|
1417
|
+
t(""), r([]), await o(a, s);
|
|
1418
|
+
}, p = (e) => {
|
|
1419
|
+
e.key === "Enter" && !e.shiftKey && (e.preventDefault(), f(e));
|
|
1420
|
+
}, m = e.trim() !== "" || n.length > 0;
|
|
1421
|
+
return /* @__PURE__ */ B("form", {
|
|
1422
|
+
onSubmit: f,
|
|
1423
|
+
className: "hawkai-assistant__form flex flex-col border-t border-solid border-gray-200 dark:border-gray-700 p-3 mt-auto gap-2",
|
|
1424
|
+
children: [n.length > 0 && /* @__PURE__ */ B("div", {
|
|
1425
|
+
className: "hawkai-assistant__form__file-list flex flex-wrap gap-1",
|
|
1426
|
+
children: n.map((e, t) => /* @__PURE__ */ B("div", {
|
|
1427
|
+
className: "hawkai-assistant__form__file flex items-center gap-1 rounded-full bg-gray-100 dark:bg-gray-800 px-2 py-1 text-xs text-gray-700 dark:text-gray-300",
|
|
1428
|
+
children: [/* @__PURE__ */ B("span", {
|
|
1429
|
+
className: "hawkai-assistant__form__file__name max-w-32 truncate",
|
|
1430
|
+
children: e.name
|
|
1431
|
+
}), /* @__PURE__ */ B("button", {
|
|
1432
|
+
type: "button",
|
|
1433
|
+
onClick: () => d(t),
|
|
1434
|
+
title: `Remove ${e.name}`,
|
|
1435
|
+
"aria-label": `Remove ${e.name}`,
|
|
1436
|
+
className: "hawkai-assistant__form__file__remove-button shrink-0 text-gray-400 dark:text-gray-500 cursor-pointer hover:text-gray-700 dark:hover:text-gray-300 focus:outline-none",
|
|
1437
|
+
children: /* @__PURE__ */ B(an, { className: "h-3 w-3" })
|
|
1438
|
+
})]
|
|
1439
|
+
}, t))
|
|
1440
|
+
}), /* @__PURE__ */ B("div", {
|
|
1441
|
+
className: "hawkai-assistant__form__input-row flex items-end gap-2",
|
|
1442
|
+
children: [
|
|
1443
|
+
/* @__PURE__ */ B("label", {
|
|
1444
|
+
htmlFor: "assistant-message",
|
|
1445
|
+
className: "hawkai-assistant__form__label sr-only",
|
|
1446
|
+
children: "Message"
|
|
1447
|
+
}),
|
|
1448
|
+
/* @__PURE__ */ B("textarea", {
|
|
1449
|
+
id: "assistant-message",
|
|
1450
|
+
className: "hawkai-assistant__form__text-input h-21 flex-1 resize-none rounded-lg border border-gray-200 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-100 p-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary",
|
|
1451
|
+
placeholder: c?.placeholder || "Enter your message here",
|
|
1452
|
+
value: e,
|
|
1453
|
+
onInput: (e) => t(e.target.value),
|
|
1454
|
+
onKeyDown: p,
|
|
1455
|
+
"aria-required": "true"
|
|
1456
|
+
}),
|
|
1457
|
+
/* @__PURE__ */ B("div", {
|
|
1458
|
+
className: "hawkai-assistant__form__actions flex shrink-0 flex-col gap-1",
|
|
1459
|
+
children: [l && /* @__PURE__ */ B(x, { children: [/* @__PURE__ */ B("input", {
|
|
1460
|
+
ref: i,
|
|
1461
|
+
type: "file",
|
|
1462
|
+
accept: "application/pdf,image/gif,image/jpeg,image/png,image/webp,text/csv,text/plain",
|
|
1463
|
+
multiple: !0,
|
|
1464
|
+
"aria-label": "Attach files",
|
|
1465
|
+
className: "hawkai-assistant__form__file-input hidden",
|
|
1466
|
+
onChange: u
|
|
1467
|
+
}), /* @__PURE__ */ B("button", {
|
|
1468
|
+
type: "button",
|
|
1469
|
+
disabled: n.length >= wn || a,
|
|
1470
|
+
title: "Attach files",
|
|
1471
|
+
"aria-label": "Attach files",
|
|
1472
|
+
onClick: () => i.current?.click(),
|
|
1473
|
+
className: "hawkai-assistant__form__attach-button flex h-10 w-10 items-center justify-center rounded-lg border border-gray-200 dark:border-gray-700 text-gray-500 dark:text-gray-400 cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-800 focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent",
|
|
1474
|
+
children: /* @__PURE__ */ B(nn, { className: "h-5 w-5" })
|
|
1475
|
+
})] }), a ? /* @__PURE__ */ B("button", {
|
|
1476
|
+
type: "button",
|
|
1477
|
+
onClick: s,
|
|
1478
|
+
title: "Stop",
|
|
1479
|
+
"aria-label": "Stop",
|
|
1480
|
+
className: "hawkai-assistant__form__stop-button flex h-10 w-10 items-center justify-center rounded-lg bg-primary text-white cursor-pointer hover:bg-primary-hover focus:outline-none",
|
|
1481
|
+
children: /* @__PURE__ */ B(bn, { className: "h-5 w-5" })
|
|
1482
|
+
}) : /* @__PURE__ */ B("button", {
|
|
1483
|
+
type: "submit",
|
|
1484
|
+
disabled: !m,
|
|
1485
|
+
title: "Send",
|
|
1486
|
+
"aria-label": "Send",
|
|
1487
|
+
className: "hawkai-assistant__form__send-button flex h-10 w-10 items-center justify-center rounded-lg bg-primary text-white cursor-pointer hover:bg-primary-hover focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-primary",
|
|
1488
|
+
children: /* @__PURE__ */ B(vn, { className: "h-5 w-5" })
|
|
1489
|
+
})]
|
|
1490
|
+
})
|
|
1491
|
+
]
|
|
1492
|
+
})]
|
|
1493
|
+
});
|
|
1494
|
+
}, En = () => /* @__PURE__ */ B("div", {
|
|
1495
|
+
className: "hawkai-assistant__loading-indicator w-fit rounded-2xl rounded-bl-sm bg-gray-100 dark:bg-gray-800 px-3 py-2 text-sm text-gray-900 dark:text-gray-100",
|
|
1496
|
+
children: /* @__PURE__ */ B("span", {
|
|
1497
|
+
className: "inline-flex gap-1",
|
|
1498
|
+
children: [
|
|
1499
|
+
/* @__PURE__ */ B("span", {
|
|
1500
|
+
className: "animate-bounce",
|
|
1501
|
+
style: { animationDelay: "0ms" },
|
|
1502
|
+
children: "•"
|
|
1503
|
+
}),
|
|
1504
|
+
/* @__PURE__ */ B("span", {
|
|
1505
|
+
className: "animate-bounce",
|
|
1506
|
+
style: { animationDelay: "150ms" },
|
|
1507
|
+
children: "•"
|
|
1508
|
+
}),
|
|
1509
|
+
/* @__PURE__ */ B("span", {
|
|
1510
|
+
className: "animate-bounce",
|
|
1511
|
+
style: { animationDelay: "300ms" },
|
|
1512
|
+
children: "•"
|
|
1513
|
+
})
|
|
1514
|
+
]
|
|
1515
|
+
})
|
|
1516
|
+
});
|
|
1517
|
+
//#endregion
|
|
1518
|
+
//#region node_modules/.pnpm/dompurify@3.4.5/node_modules/dompurify/dist/purify.es.mjs
|
|
1519
|
+
function Dn(e, t) {
|
|
1520
|
+
(t == null || t > e.length) && (t = e.length);
|
|
1521
|
+
for (var n = 0, r = Array(t); n < t; n++) r[n] = e[n];
|
|
1522
|
+
return r;
|
|
1523
|
+
}
|
|
1524
|
+
function On(e) {
|
|
1525
|
+
if (Array.isArray(e)) return e;
|
|
1526
|
+
}
|
|
1527
|
+
function kn(e, t) {
|
|
1528
|
+
var n = e == null ? null : typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
|
|
1529
|
+
if (n != null) {
|
|
1530
|
+
var r, i, a, o, s = [], c = !0, l = !1;
|
|
1531
|
+
try {
|
|
1532
|
+
if (a = (n = n.call(e)).next, t !== 0) for (; !(c = (r = a.call(n)).done) && (s.push(r.value), s.length !== t); c = !0);
|
|
1533
|
+
} catch (e) {
|
|
1534
|
+
l = !0, i = e;
|
|
1535
|
+
} finally {
|
|
1536
|
+
try {
|
|
1537
|
+
if (!c && n.return != null && (o = n.return(), Object(o) !== o)) return;
|
|
1538
|
+
} finally {
|
|
1539
|
+
if (l) throw i;
|
|
1540
|
+
}
|
|
1541
|
+
}
|
|
1542
|
+
return s;
|
|
1543
|
+
}
|
|
1544
|
+
}
|
|
1545
|
+
function An() {
|
|
1546
|
+
throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1547
|
+
}
|
|
1548
|
+
function jn(e, t) {
|
|
1549
|
+
return On(e) || kn(e, t) || Mn(e, t) || An();
|
|
1550
|
+
}
|
|
1551
|
+
function Mn(e, t) {
|
|
1552
|
+
if (e) {
|
|
1553
|
+
if (typeof e == "string") return Dn(e, t);
|
|
1554
|
+
var n = {}.toString.call(e).slice(8, -1);
|
|
1555
|
+
return n === "Object" && e.constructor && (n = e.constructor.name), n === "Map" || n === "Set" ? Array.from(e) : n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? Dn(e, t) : void 0;
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1558
|
+
var Nn = Object.entries, Pn = Object.setPrototypeOf, Fn = Object.isFrozen, In = Object.getPrototypeOf, Ln = Object.getOwnPropertyDescriptor, V = Object.freeze, H = Object.seal, Rn = Object.create, zn = typeof Reflect < "u" && Reflect, Bn = zn.apply, Vn = zn.construct;
|
|
1559
|
+
V ||= function(e) {
|
|
1560
|
+
return e;
|
|
1561
|
+
}, H ||= function(e) {
|
|
1562
|
+
return e;
|
|
1563
|
+
}, Bn ||= function(e, t) {
|
|
1564
|
+
var n = [...arguments].slice(2);
|
|
1565
|
+
return e.apply(t, n);
|
|
1566
|
+
}, Vn ||= function(e) {
|
|
1567
|
+
return new e(...[...arguments].slice(1));
|
|
1568
|
+
};
|
|
1569
|
+
var Hn = K(Array.prototype.forEach), Un = K(Array.prototype.lastIndexOf), Wn = K(Array.prototype.pop), Gn = K(Array.prototype.push), Kn = K(Array.prototype.splice), U = Array.isArray, qn = K(String.prototype.toLowerCase), Jn = K(String.prototype.toString), Yn = K(String.prototype.match), Xn = K(String.prototype.replace), Zn = K(String.prototype.indexOf), Qn = K(String.prototype.trim), $n = K(Number.prototype.toString), er = K(Boolean.prototype.toString), tr = typeof BigInt > "u" ? null : K(BigInt.prototype.toString), nr = typeof Symbol > "u" ? null : K(Symbol.prototype.toString), W = K(Object.prototype.hasOwnProperty), rr = K(Object.prototype.toString), G = K(RegExp.prototype.test), ir = ar(TypeError);
|
|
1570
|
+
function K(e) {
|
|
1571
|
+
return function(t) {
|
|
1572
|
+
t instanceof RegExp && (t.lastIndex = 0);
|
|
1573
|
+
var n = [...arguments].slice(1);
|
|
1574
|
+
return Bn(e, t, n);
|
|
1575
|
+
};
|
|
1576
|
+
}
|
|
1577
|
+
function ar(e) {
|
|
1578
|
+
return function() {
|
|
1579
|
+
return Vn(e, [...arguments]);
|
|
1580
|
+
};
|
|
1581
|
+
}
|
|
1582
|
+
function q(e, t) {
|
|
1583
|
+
let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : qn;
|
|
1584
|
+
if (Pn && Pn(e, null), !U(t)) return e;
|
|
1585
|
+
let r = t.length;
|
|
1586
|
+
for (; r--;) {
|
|
1587
|
+
let i = t[r];
|
|
1588
|
+
if (typeof i == "string") {
|
|
1589
|
+
let e = n(i);
|
|
1590
|
+
e !== i && (Fn(t) || (t[r] = e), i = e);
|
|
1591
|
+
}
|
|
1592
|
+
e[i] = !0;
|
|
1593
|
+
}
|
|
1594
|
+
return e;
|
|
1595
|
+
}
|
|
1596
|
+
function or(e) {
|
|
1597
|
+
for (let t = 0; t < e.length; t++) W(e, t) || (e[t] = null);
|
|
1598
|
+
return e;
|
|
1599
|
+
}
|
|
1600
|
+
function J(e) {
|
|
1601
|
+
let t = Rn(null);
|
|
1602
|
+
for (let r of Nn(e)) {
|
|
1603
|
+
var n = jn(r, 2);
|
|
1604
|
+
let i = n[0], a = n[1];
|
|
1605
|
+
W(e, i) && (U(a) ? t[i] = or(a) : a && typeof a == "object" && a.constructor === Object ? t[i] = J(a) : t[i] = a);
|
|
1606
|
+
}
|
|
1607
|
+
return t;
|
|
1608
|
+
}
|
|
1609
|
+
function sr(e) {
|
|
1610
|
+
switch (typeof e) {
|
|
1611
|
+
case "string": return e;
|
|
1612
|
+
case "number": return $n(e);
|
|
1613
|
+
case "boolean": return er(e);
|
|
1614
|
+
case "bigint": return tr ? tr(e) : "0";
|
|
1615
|
+
case "symbol": return nr ? nr(e) : "Symbol()";
|
|
1616
|
+
case "undefined": return rr(e);
|
|
1617
|
+
case "function":
|
|
1618
|
+
case "object": {
|
|
1619
|
+
if (e === null) return rr(e);
|
|
1620
|
+
let t = e, n = cr(t, "toString");
|
|
1621
|
+
if (typeof n == "function") {
|
|
1622
|
+
let e = n(t);
|
|
1623
|
+
return typeof e == "string" ? e : rr(e);
|
|
1624
|
+
}
|
|
1625
|
+
return rr(e);
|
|
1626
|
+
}
|
|
1627
|
+
default: return rr(e);
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1630
|
+
function cr(e, t) {
|
|
1631
|
+
for (; e !== null;) {
|
|
1632
|
+
let n = Ln(e, t);
|
|
1633
|
+
if (n) {
|
|
1634
|
+
if (n.get) return K(n.get);
|
|
1635
|
+
if (typeof n.value == "function") return K(n.value);
|
|
1636
|
+
}
|
|
1637
|
+
e = In(e);
|
|
1638
|
+
}
|
|
1639
|
+
function n() {
|
|
1640
|
+
return null;
|
|
1641
|
+
}
|
|
1642
|
+
return n;
|
|
1643
|
+
}
|
|
1644
|
+
function lr(e) {
|
|
1645
|
+
try {
|
|
1646
|
+
return G(e, ""), !0;
|
|
1647
|
+
} catch {
|
|
1648
|
+
return !1;
|
|
1649
|
+
}
|
|
1650
|
+
}
|
|
1651
|
+
var ur = V(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr".split(".")), dr = V(/* @__PURE__ */ "svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern".split(".")), fr = V([
|
|
1652
|
+
"feBlend",
|
|
1653
|
+
"feColorMatrix",
|
|
1654
|
+
"feComponentTransfer",
|
|
1655
|
+
"feComposite",
|
|
1656
|
+
"feConvolveMatrix",
|
|
1657
|
+
"feDiffuseLighting",
|
|
1658
|
+
"feDisplacementMap",
|
|
1659
|
+
"feDistantLight",
|
|
1660
|
+
"feDropShadow",
|
|
1661
|
+
"feFlood",
|
|
1662
|
+
"feFuncA",
|
|
1663
|
+
"feFuncB",
|
|
1664
|
+
"feFuncG",
|
|
1665
|
+
"feFuncR",
|
|
1666
|
+
"feGaussianBlur",
|
|
1667
|
+
"feImage",
|
|
1668
|
+
"feMerge",
|
|
1669
|
+
"feMergeNode",
|
|
1670
|
+
"feMorphology",
|
|
1671
|
+
"feOffset",
|
|
1672
|
+
"fePointLight",
|
|
1673
|
+
"feSpecularLighting",
|
|
1674
|
+
"feSpotLight",
|
|
1675
|
+
"feTile",
|
|
1676
|
+
"feTurbulence"
|
|
1677
|
+
]), pr = V([
|
|
1678
|
+
"animate",
|
|
1679
|
+
"color-profile",
|
|
1680
|
+
"cursor",
|
|
1681
|
+
"discard",
|
|
1682
|
+
"font-face",
|
|
1683
|
+
"font-face-format",
|
|
1684
|
+
"font-face-name",
|
|
1685
|
+
"font-face-src",
|
|
1686
|
+
"font-face-uri",
|
|
1687
|
+
"foreignobject",
|
|
1688
|
+
"hatch",
|
|
1689
|
+
"hatchpath",
|
|
1690
|
+
"mesh",
|
|
1691
|
+
"meshgradient",
|
|
1692
|
+
"meshpatch",
|
|
1693
|
+
"meshrow",
|
|
1694
|
+
"missing-glyph",
|
|
1695
|
+
"script",
|
|
1696
|
+
"set",
|
|
1697
|
+
"solidcolor",
|
|
1698
|
+
"unknown",
|
|
1699
|
+
"use"
|
|
1700
|
+
]), mr = V(/* @__PURE__ */ "math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts".split(".")), hr = V([
|
|
1701
|
+
"maction",
|
|
1702
|
+
"maligngroup",
|
|
1703
|
+
"malignmark",
|
|
1704
|
+
"mlongdiv",
|
|
1705
|
+
"mscarries",
|
|
1706
|
+
"mscarry",
|
|
1707
|
+
"msgroup",
|
|
1708
|
+
"mstack",
|
|
1709
|
+
"msline",
|
|
1710
|
+
"msrow",
|
|
1711
|
+
"semantics",
|
|
1712
|
+
"annotation",
|
|
1713
|
+
"annotation-xml",
|
|
1714
|
+
"mprescripts",
|
|
1715
|
+
"none"
|
|
1716
|
+
]), gr = V(["#text"]), _r = V(/* @__PURE__ */ "accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns".split(".")), vr = V(/* @__PURE__ */ "accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-rendering.textlength.type.u1.u2.unicode.values.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan".split(".")), yr = V(/* @__PURE__ */ "accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns".split(".")), br = V([
|
|
1717
|
+
"xlink:href",
|
|
1718
|
+
"xml:id",
|
|
1719
|
+
"xlink:title",
|
|
1720
|
+
"xml:space",
|
|
1721
|
+
"xmlns:xlink"
|
|
1722
|
+
]), xr = H(/{{[\w\W]*|^[\w\W]*}}/g), Sr = H(/<%[\w\W]*|^[\w\W]*%>/g), Cr = H(/\${[\w\W]*/g), wr = H(/^data-[\-\w.\u00B7-\uFFFF]+$/), Tr = H(/^aria-[\-\w]+$/), Er = H(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i), Dr = H(/^(?:\w+script|data):/i), Or = H(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g), kr = H(/^html$/i), Ar = H(/^[a-z][.\w]*(-[.\w]+)+$/i), jr = {
|
|
1723
|
+
element: 1,
|
|
1724
|
+
text: 3,
|
|
1725
|
+
progressingInstruction: 7,
|
|
1726
|
+
comment: 8,
|
|
1727
|
+
document: 9
|
|
1728
|
+
}, Mr = function() {
|
|
1729
|
+
return typeof window > "u" ? null : window;
|
|
1730
|
+
}, Nr = function(e, t) {
|
|
1731
|
+
if (typeof e != "object" || typeof e.createPolicy != "function") return null;
|
|
1732
|
+
let n = null, r = "data-tt-policy-suffix";
|
|
1733
|
+
t && t.hasAttribute(r) && (n = t.getAttribute(r));
|
|
1734
|
+
let i = "dompurify" + (n ? "#" + n : "");
|
|
1735
|
+
try {
|
|
1736
|
+
return e.createPolicy(i, {
|
|
1737
|
+
createHTML(e) {
|
|
1738
|
+
return e;
|
|
1739
|
+
},
|
|
1740
|
+
createScriptURL(e) {
|
|
1741
|
+
return e;
|
|
1742
|
+
}
|
|
1743
|
+
});
|
|
1744
|
+
} catch {
|
|
1745
|
+
return console.warn("TrustedTypes policy " + i + " could not be created."), null;
|
|
1746
|
+
}
|
|
1747
|
+
}, Pr = function() {
|
|
1748
|
+
return {
|
|
1749
|
+
afterSanitizeAttributes: [],
|
|
1750
|
+
afterSanitizeElements: [],
|
|
1751
|
+
afterSanitizeShadowDOM: [],
|
|
1752
|
+
beforeSanitizeAttributes: [],
|
|
1753
|
+
beforeSanitizeElements: [],
|
|
1754
|
+
beforeSanitizeShadowDOM: [],
|
|
1755
|
+
uponSanitizeAttribute: [],
|
|
1756
|
+
uponSanitizeElement: [],
|
|
1757
|
+
uponSanitizeShadowNode: []
|
|
1758
|
+
};
|
|
1759
|
+
};
|
|
1760
|
+
function Fr() {
|
|
1761
|
+
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Mr(), t = (e) => Fr(e);
|
|
1762
|
+
if (t.version = "3.4.5", t.removed = [], !e || !e.document || e.document.nodeType !== jr.document || !e.Element) return t.isSupported = !1, t;
|
|
1763
|
+
let n = e.document, r = n, i = r.currentScript, a = e.DocumentFragment, o = e.HTMLTemplateElement, s = e.Node, c = e.Element, l = e.NodeFilter, u = e.NamedNodeMap, d = u === void 0 ? e.NamedNodeMap || e.MozNamedAttrMap : u, f = e.HTMLFormElement, p = e.DOMParser, m = e.trustedTypes, h = c.prototype, g = cr(h, "cloneNode"), _ = cr(h, "remove"), ee = cr(h, "nextSibling"), v = cr(h, "childNodes"), te = cr(h, "parentNode"), y = s && s.prototype ? cr(s.prototype, "nodeType") : null;
|
|
1764
|
+
if (typeof o == "function") {
|
|
1765
|
+
let e = n.createElement("template");
|
|
1766
|
+
e.content && e.content.ownerDocument && (n = e.content.ownerDocument);
|
|
1767
|
+
}
|
|
1768
|
+
let b, x = "", S = n, C = S.implementation, ne = S.createNodeIterator, re = S.createDocumentFragment, ie = S.getElementsByTagName, ae = r.importNode, w = Pr();
|
|
1769
|
+
t.isSupported = typeof Nn == "function" && typeof te == "function" && C && C.createHTMLDocument !== void 0;
|
|
1770
|
+
let oe = xr, se = Sr, T = Cr, ce = wr, le = Tr, ue = Dr, de = Or, fe = Ar, pe = Er, E = null, me = q({}, [
|
|
1771
|
+
...ur,
|
|
1772
|
+
...dr,
|
|
1773
|
+
...fr,
|
|
1774
|
+
...mr,
|
|
1775
|
+
...gr
|
|
1776
|
+
]), D = null, he = q({}, [
|
|
1777
|
+
..._r,
|
|
1778
|
+
...vr,
|
|
1779
|
+
...yr,
|
|
1780
|
+
...br
|
|
1781
|
+
]), O = Object.seal(Rn(null, {
|
|
1782
|
+
tagNameCheck: {
|
|
1783
|
+
writable: !0,
|
|
1784
|
+
configurable: !1,
|
|
1785
|
+
enumerable: !0,
|
|
1786
|
+
value: null
|
|
1787
|
+
},
|
|
1788
|
+
attributeNameCheck: {
|
|
1789
|
+
writable: !0,
|
|
1790
|
+
configurable: !1,
|
|
1791
|
+
enumerable: !0,
|
|
1792
|
+
value: null
|
|
1793
|
+
},
|
|
1794
|
+
allowCustomizedBuiltInElements: {
|
|
1795
|
+
writable: !0,
|
|
1796
|
+
configurable: !1,
|
|
1797
|
+
enumerable: !0,
|
|
1798
|
+
value: !1
|
|
1799
|
+
}
|
|
1800
|
+
})), ge = null, _e = null, ve = Object.seal(Rn(null, {
|
|
1801
|
+
tagCheck: {
|
|
1802
|
+
writable: !0,
|
|
1803
|
+
configurable: !1,
|
|
1804
|
+
enumerable: !0,
|
|
1805
|
+
value: null
|
|
1806
|
+
},
|
|
1807
|
+
attributeCheck: {
|
|
1808
|
+
writable: !0,
|
|
1809
|
+
configurable: !1,
|
|
1810
|
+
enumerable: !0,
|
|
1811
|
+
value: null
|
|
1812
|
+
}
|
|
1813
|
+
})), k = !0, ye = !0, A = !1, be = !0, xe = !1, Se = !0, Ce = !1, j = !1, we = !1, Te = !1, Ee = !1, De = !1, Oe = !0, ke = !1, Ae = "user-content-", M = !0, je = !1, N = {}, P = null, Me = q({}, [
|
|
1814
|
+
"annotation-xml",
|
|
1815
|
+
"audio",
|
|
1816
|
+
"colgroup",
|
|
1817
|
+
"desc",
|
|
1818
|
+
"foreignobject",
|
|
1819
|
+
"head",
|
|
1820
|
+
"iframe",
|
|
1821
|
+
"math",
|
|
1822
|
+
"mi",
|
|
1823
|
+
"mn",
|
|
1824
|
+
"mo",
|
|
1825
|
+
"ms",
|
|
1826
|
+
"mtext",
|
|
1827
|
+
"noembed",
|
|
1828
|
+
"noframes",
|
|
1829
|
+
"noscript",
|
|
1830
|
+
"plaintext",
|
|
1831
|
+
"script",
|
|
1832
|
+
"style",
|
|
1833
|
+
"svg",
|
|
1834
|
+
"template",
|
|
1835
|
+
"thead",
|
|
1836
|
+
"title",
|
|
1837
|
+
"video",
|
|
1838
|
+
"xmp"
|
|
1839
|
+
]), Ne = null, Pe = q({}, [
|
|
1840
|
+
"audio",
|
|
1841
|
+
"video",
|
|
1842
|
+
"img",
|
|
1843
|
+
"source",
|
|
1844
|
+
"image",
|
|
1845
|
+
"track"
|
|
1846
|
+
]), Fe = null, Ie = q({}, [
|
|
1847
|
+
"alt",
|
|
1848
|
+
"class",
|
|
1849
|
+
"for",
|
|
1850
|
+
"id",
|
|
1851
|
+
"label",
|
|
1852
|
+
"name",
|
|
1853
|
+
"pattern",
|
|
1854
|
+
"placeholder",
|
|
1855
|
+
"role",
|
|
1856
|
+
"summary",
|
|
1857
|
+
"title",
|
|
1858
|
+
"value",
|
|
1859
|
+
"style",
|
|
1860
|
+
"xmlns"
|
|
1861
|
+
]), Le = "http://www.w3.org/1998/Math/MathML", Re = "http://www.w3.org/2000/svg", F = "http://www.w3.org/1999/xhtml", ze = F, Be = !1, Ve = null, He = q({}, [
|
|
1862
|
+
Le,
|
|
1863
|
+
Re,
|
|
1864
|
+
F
|
|
1865
|
+
], Jn), Ue = q({}, [
|
|
1866
|
+
"mi",
|
|
1867
|
+
"mo",
|
|
1868
|
+
"mn",
|
|
1869
|
+
"ms",
|
|
1870
|
+
"mtext"
|
|
1871
|
+
]), We = q({}, ["annotation-xml"]), Ge = q({}, [
|
|
1872
|
+
"title",
|
|
1873
|
+
"style",
|
|
1874
|
+
"font",
|
|
1875
|
+
"a",
|
|
1876
|
+
"script"
|
|
1877
|
+
]), Ke = null, qe = ["application/xhtml+xml", "text/html"], I = null, Je = null, Ye = n.createElement("form"), Xe = function(e) {
|
|
1878
|
+
return e instanceof RegExp || e instanceof Function;
|
|
1879
|
+
}, Ze = function() {
|
|
1880
|
+
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
1881
|
+
if (Je && Je === e) return;
|
|
1882
|
+
(!e || typeof e != "object") && (e = {}), e = J(e), Ke = qe.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? "text/html" : e.PARSER_MEDIA_TYPE, I = Ke === "application/xhtml+xml" ? Jn : qn, E = W(e, "ALLOWED_TAGS") && U(e.ALLOWED_TAGS) ? q({}, e.ALLOWED_TAGS, I) : me, D = W(e, "ALLOWED_ATTR") && U(e.ALLOWED_ATTR) ? q({}, e.ALLOWED_ATTR, I) : he, Ve = W(e, "ALLOWED_NAMESPACES") && U(e.ALLOWED_NAMESPACES) ? q({}, e.ALLOWED_NAMESPACES, Jn) : He, Fe = W(e, "ADD_URI_SAFE_ATTR") && U(e.ADD_URI_SAFE_ATTR) ? q(J(Ie), e.ADD_URI_SAFE_ATTR, I) : Ie, Ne = W(e, "ADD_DATA_URI_TAGS") && U(e.ADD_DATA_URI_TAGS) ? q(J(Pe), e.ADD_DATA_URI_TAGS, I) : Pe, P = W(e, "FORBID_CONTENTS") && U(e.FORBID_CONTENTS) ? q({}, e.FORBID_CONTENTS, I) : Me, ge = W(e, "FORBID_TAGS") && U(e.FORBID_TAGS) ? q({}, e.FORBID_TAGS, I) : J({}), _e = W(e, "FORBID_ATTR") && U(e.FORBID_ATTR) ? q({}, e.FORBID_ATTR, I) : J({}), N = W(e, "USE_PROFILES") ? e.USE_PROFILES && typeof e.USE_PROFILES == "object" ? J(e.USE_PROFILES) : e.USE_PROFILES : !1, k = e.ALLOW_ARIA_ATTR !== !1, ye = e.ALLOW_DATA_ATTR !== !1, A = e.ALLOW_UNKNOWN_PROTOCOLS || !1, be = e.ALLOW_SELF_CLOSE_IN_ATTR !== !1, xe = e.SAFE_FOR_TEMPLATES || !1, Se = e.SAFE_FOR_XML !== !1, Ce = e.WHOLE_DOCUMENT || !1, Te = e.RETURN_DOM || !1, Ee = e.RETURN_DOM_FRAGMENT || !1, De = e.RETURN_TRUSTED_TYPE || !1, we = e.FORCE_BODY || !1, Oe = e.SANITIZE_DOM !== !1, ke = e.SANITIZE_NAMED_PROPS || !1, M = e.KEEP_CONTENT !== !1, je = e.IN_PLACE || !1, pe = lr(e.ALLOWED_URI_REGEXP) ? e.ALLOWED_URI_REGEXP : Er, ze = typeof e.NAMESPACE == "string" ? e.NAMESPACE : F, Ue = W(e, "MATHML_TEXT_INTEGRATION_POINTS") && e.MATHML_TEXT_INTEGRATION_POINTS && typeof e.MATHML_TEXT_INTEGRATION_POINTS == "object" ? J(e.MATHML_TEXT_INTEGRATION_POINTS) : q({}, [
|
|
1883
|
+
"mi",
|
|
1884
|
+
"mo",
|
|
1885
|
+
"mn",
|
|
1886
|
+
"ms",
|
|
1887
|
+
"mtext"
|
|
1888
|
+
]), We = W(e, "HTML_INTEGRATION_POINTS") && e.HTML_INTEGRATION_POINTS && typeof e.HTML_INTEGRATION_POINTS == "object" ? J(e.HTML_INTEGRATION_POINTS) : q({}, ["annotation-xml"]);
|
|
1889
|
+
let t = W(e, "CUSTOM_ELEMENT_HANDLING") && e.CUSTOM_ELEMENT_HANDLING && typeof e.CUSTOM_ELEMENT_HANDLING == "object" ? J(e.CUSTOM_ELEMENT_HANDLING) : Rn(null);
|
|
1890
|
+
if (O = Rn(null), W(t, "tagNameCheck") && Xe(t.tagNameCheck) && (O.tagNameCheck = t.tagNameCheck), W(t, "attributeNameCheck") && Xe(t.attributeNameCheck) && (O.attributeNameCheck = t.attributeNameCheck), W(t, "allowCustomizedBuiltInElements") && typeof t.allowCustomizedBuiltInElements == "boolean" && (O.allowCustomizedBuiltInElements = t.allowCustomizedBuiltInElements), xe && (ye = !1), Ee && (Te = !0), N && (E = q({}, gr), D = Rn(null), N.html === !0 && (q(E, ur), q(D, _r)), N.svg === !0 && (q(E, dr), q(D, vr), q(D, br)), N.svgFilters === !0 && (q(E, fr), q(D, vr), q(D, br)), N.mathMl === !0 && (q(E, mr), q(D, yr), q(D, br))), ve.tagCheck = null, ve.attributeCheck = null, W(e, "ADD_TAGS") && (typeof e.ADD_TAGS == "function" ? ve.tagCheck = e.ADD_TAGS : U(e.ADD_TAGS) && (E === me && (E = J(E)), q(E, e.ADD_TAGS, I))), W(e, "ADD_ATTR") && (typeof e.ADD_ATTR == "function" ? ve.attributeCheck = e.ADD_ATTR : U(e.ADD_ATTR) && (D === he && (D = J(D)), q(D, e.ADD_ATTR, I))), W(e, "ADD_URI_SAFE_ATTR") && U(e.ADD_URI_SAFE_ATTR) && q(Fe, e.ADD_URI_SAFE_ATTR, I), W(e, "FORBID_CONTENTS") && U(e.FORBID_CONTENTS) && (P === Me && (P = J(P)), q(P, e.FORBID_CONTENTS, I)), W(e, "ADD_FORBID_CONTENTS") && U(e.ADD_FORBID_CONTENTS) && (P === Me && (P = J(P)), q(P, e.ADD_FORBID_CONTENTS, I)), M && (E["#text"] = !0), Ce && q(E, [
|
|
1891
|
+
"html",
|
|
1892
|
+
"head",
|
|
1893
|
+
"body"
|
|
1894
|
+
]), E.table && (q(E, ["tbody"]), delete ge.tbody), e.TRUSTED_TYPES_POLICY) {
|
|
1895
|
+
if (typeof e.TRUSTED_TYPES_POLICY.createHTML != "function") throw ir("TRUSTED_TYPES_POLICY configuration option must provide a \"createHTML\" hook.");
|
|
1896
|
+
if (typeof e.TRUSTED_TYPES_POLICY.createScriptURL != "function") throw ir("TRUSTED_TYPES_POLICY configuration option must provide a \"createScriptURL\" hook.");
|
|
1897
|
+
b = e.TRUSTED_TYPES_POLICY, x = b.createHTML("");
|
|
1898
|
+
} else b === void 0 && (b = Nr(m, i)), b !== null && typeof x == "string" && (x = b.createHTML(""));
|
|
1899
|
+
V && V(e), Je = e;
|
|
1900
|
+
}, Qe = q({}, [
|
|
1901
|
+
...dr,
|
|
1902
|
+
...fr,
|
|
1903
|
+
...pr
|
|
1904
|
+
]), $e = q({}, [...mr, ...hr]), et = function(e) {
|
|
1905
|
+
let t = te(e);
|
|
1906
|
+
(!t || !t.tagName) && (t = {
|
|
1907
|
+
namespaceURI: ze,
|
|
1908
|
+
tagName: "template"
|
|
1909
|
+
});
|
|
1910
|
+
let n = qn(e.tagName), r = qn(t.tagName);
|
|
1911
|
+
return Ve[e.namespaceURI] ? e.namespaceURI === Re ? t.namespaceURI === F ? n === "svg" : t.namespaceURI === Le ? n === "svg" && (r === "annotation-xml" || Ue[r]) : !!Qe[n] : e.namespaceURI === Le ? t.namespaceURI === F ? n === "math" : t.namespaceURI === Re ? n === "math" && We[r] : !!$e[n] : e.namespaceURI === F ? t.namespaceURI === Re && !We[r] || t.namespaceURI === Le && !Ue[r] ? !1 : !$e[n] && (Ge[n] || !Qe[n]) : !!(Ke === "application/xhtml+xml" && Ve[e.namespaceURI]) : !1;
|
|
1912
|
+
}, L = function(e) {
|
|
1913
|
+
Gn(t.removed, { element: e });
|
|
1914
|
+
try {
|
|
1915
|
+
te(e).removeChild(e);
|
|
1916
|
+
} catch {
|
|
1917
|
+
_(e);
|
|
1918
|
+
}
|
|
1919
|
+
}, R = function(e, n) {
|
|
1920
|
+
try {
|
|
1921
|
+
Gn(t.removed, {
|
|
1922
|
+
attribute: n.getAttributeNode(e),
|
|
1923
|
+
from: n
|
|
1924
|
+
});
|
|
1925
|
+
} catch {
|
|
1926
|
+
Gn(t.removed, {
|
|
1927
|
+
attribute: null,
|
|
1928
|
+
from: n
|
|
1929
|
+
});
|
|
1930
|
+
}
|
|
1931
|
+
if (n.removeAttribute(e), e === "is") if (Te || Ee) try {
|
|
1932
|
+
L(n);
|
|
1933
|
+
} catch {}
|
|
1934
|
+
else try {
|
|
1935
|
+
n.setAttribute(e, "");
|
|
1936
|
+
} catch {}
|
|
1937
|
+
}, tt = function(e) {
|
|
1938
|
+
let t = null, r = null;
|
|
1939
|
+
if (we) e = "<remove></remove>" + e;
|
|
1940
|
+
else {
|
|
1941
|
+
let t = Yn(e, /^[\r\n\t ]+/);
|
|
1942
|
+
r = t && t[0];
|
|
1943
|
+
}
|
|
1944
|
+
Ke === "application/xhtml+xml" && ze === F && (e = "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head></head><body>" + e + "</body></html>");
|
|
1945
|
+
let i = b ? b.createHTML(e) : e;
|
|
1946
|
+
if (ze === F) try {
|
|
1947
|
+
t = new p().parseFromString(i, Ke);
|
|
1948
|
+
} catch {}
|
|
1949
|
+
if (!t || !t.documentElement) {
|
|
1950
|
+
t = C.createDocument(ze, "template", null);
|
|
1951
|
+
try {
|
|
1952
|
+
t.documentElement.innerHTML = Be ? x : i;
|
|
1953
|
+
} catch {}
|
|
1954
|
+
}
|
|
1955
|
+
let a = t.body || t.documentElement;
|
|
1956
|
+
return e && r && a.insertBefore(n.createTextNode(r), a.childNodes[0] || null), ze === F ? ie.call(t, Ce ? "html" : "body")[0] : Ce ? t.documentElement : a;
|
|
1957
|
+
}, nt = function(e) {
|
|
1958
|
+
return ne.call(e.ownerDocument || e, e, l.SHOW_ELEMENT | l.SHOW_COMMENT | l.SHOW_TEXT | l.SHOW_PROCESSING_INSTRUCTION | l.SHOW_CDATA_SECTION, null);
|
|
1959
|
+
}, rt = function(e) {
|
|
1960
|
+
e.normalize();
|
|
1961
|
+
let t = ne.call(e.ownerDocument || e, e, l.SHOW_TEXT | l.SHOW_COMMENT | l.SHOW_CDATA_SECTION | l.SHOW_PROCESSING_INSTRUCTION, null), n = t.nextNode();
|
|
1962
|
+
for (; n;) {
|
|
1963
|
+
let e = n.data;
|
|
1964
|
+
Hn([
|
|
1965
|
+
oe,
|
|
1966
|
+
se,
|
|
1967
|
+
T
|
|
1968
|
+
], (t) => {
|
|
1969
|
+
e = Xn(e, t, " ");
|
|
1970
|
+
}), n.data = e, n = t.nextNode();
|
|
1971
|
+
}
|
|
1972
|
+
}, it = function(e) {
|
|
1973
|
+
return e instanceof f && (typeof e.nodeName != "string" || typeof e.textContent != "string" || typeof e.removeChild != "function" || !(e.attributes instanceof d) || typeof e.removeAttribute != "function" || typeof e.setAttribute != "function" || typeof e.namespaceURI != "string" || typeof e.insertBefore != "function" || typeof e.hasChildNodes != "function");
|
|
1974
|
+
}, at = function(e) {
|
|
1975
|
+
if (!y || typeof e != "object" || !e) return !1;
|
|
1976
|
+
try {
|
|
1977
|
+
return typeof y(e) == "number";
|
|
1978
|
+
} catch {
|
|
1979
|
+
return !1;
|
|
1980
|
+
}
|
|
1981
|
+
};
|
|
1982
|
+
function z(e, n, r) {
|
|
1983
|
+
Hn(e, (e) => {
|
|
1984
|
+
e.call(t, n, r, Je);
|
|
1985
|
+
});
|
|
1986
|
+
}
|
|
1987
|
+
let ot = function(e) {
|
|
1988
|
+
let n = null;
|
|
1989
|
+
if (z(w.beforeSanitizeElements, e, null), it(e)) return L(e), !0;
|
|
1990
|
+
let r = I(e.nodeName);
|
|
1991
|
+
if (z(w.uponSanitizeElement, e, {
|
|
1992
|
+
tagName: r,
|
|
1993
|
+
allowedTags: E
|
|
1994
|
+
}), Se && e.hasChildNodes() && !at(e.firstElementChild) && G(/<[/\w!]/g, e.innerHTML) && G(/<[/\w!]/g, e.textContent) || Se && e.namespaceURI === F && r === "style" && at(e.firstElementChild) || e.nodeType === jr.progressingInstruction || Se && e.nodeType === jr.comment && G(/<[/\w]/g, e.data)) return L(e), !0;
|
|
1995
|
+
if (ge[r] || !(ve.tagCheck instanceof Function && ve.tagCheck(r)) && !E[r]) {
|
|
1996
|
+
if (!ge[r] && lt(r) && (O.tagNameCheck instanceof RegExp && G(O.tagNameCheck, r) || O.tagNameCheck instanceof Function && O.tagNameCheck(r))) return !1;
|
|
1997
|
+
if (M && !P[r]) {
|
|
1998
|
+
let t = te(e) || e.parentNode, n = v(e) || e.childNodes;
|
|
1999
|
+
if (n && t) {
|
|
2000
|
+
let r = n.length;
|
|
2001
|
+
for (let i = r - 1; i >= 0; --i) {
|
|
2002
|
+
let r = g(n[i], !0);
|
|
2003
|
+
t.insertBefore(r, ee(e));
|
|
2004
|
+
}
|
|
2005
|
+
}
|
|
2006
|
+
}
|
|
2007
|
+
return L(e), !0;
|
|
2008
|
+
}
|
|
2009
|
+
return e instanceof c && !et(e) || (r === "noscript" || r === "noembed" || r === "noframes") && G(/<\/no(script|embed|frames)/i, e.innerHTML) ? (L(e), !0) : (xe && e.nodeType === jr.text && (n = e.textContent, Hn([
|
|
2010
|
+
oe,
|
|
2011
|
+
se,
|
|
2012
|
+
T
|
|
2013
|
+
], (e) => {
|
|
2014
|
+
n = Xn(n, e, " ");
|
|
2015
|
+
}), e.textContent !== n && (Gn(t.removed, { element: e.cloneNode() }), e.textContent = n)), z(w.afterSanitizeElements, e, null), !1);
|
|
2016
|
+
}, st = function(e, t, r) {
|
|
2017
|
+
if (_e[t] || Oe && (t === "id" || t === "name") && (r in n || r in Ye)) return !1;
|
|
2018
|
+
let i = D[t] || ve.attributeCheck instanceof Function && ve.attributeCheck(t, e);
|
|
2019
|
+
if (!(ye && !_e[t] && G(ce, t)) && !(k && G(le, t))) {
|
|
2020
|
+
if (!i || _e[t]) {
|
|
2021
|
+
if (!(lt(e) && (O.tagNameCheck instanceof RegExp && G(O.tagNameCheck, e) || O.tagNameCheck instanceof Function && O.tagNameCheck(e)) && (O.attributeNameCheck instanceof RegExp && G(O.attributeNameCheck, t) || O.attributeNameCheck instanceof Function && O.attributeNameCheck(t, e)) || t === "is" && O.allowCustomizedBuiltInElements && (O.tagNameCheck instanceof RegExp && G(O.tagNameCheck, r) || O.tagNameCheck instanceof Function && O.tagNameCheck(r)))) return !1;
|
|
2022
|
+
} else if (!Fe[t] && !G(pe, Xn(r, de, "")) && !((t === "src" || t === "xlink:href" || t === "href") && e !== "script" && Zn(r, "data:") === 0 && Ne[e]) && !(A && !G(ue, Xn(r, de, ""))) && r) return !1;
|
|
2023
|
+
}
|
|
2024
|
+
return !0;
|
|
2025
|
+
}, ct = q({}, [
|
|
2026
|
+
"annotation-xml",
|
|
2027
|
+
"color-profile",
|
|
2028
|
+
"font-face",
|
|
2029
|
+
"font-face-format",
|
|
2030
|
+
"font-face-name",
|
|
2031
|
+
"font-face-src",
|
|
2032
|
+
"font-face-uri",
|
|
2033
|
+
"missing-glyph"
|
|
2034
|
+
]), lt = function(e) {
|
|
2035
|
+
return !ct[qn(e)] && G(fe, e);
|
|
2036
|
+
}, ut = function(e) {
|
|
2037
|
+
z(w.beforeSanitizeAttributes, e, null);
|
|
2038
|
+
let n = e.attributes;
|
|
2039
|
+
if (!n || it(e)) return;
|
|
2040
|
+
let r = {
|
|
2041
|
+
attrName: "",
|
|
2042
|
+
attrValue: "",
|
|
2043
|
+
keepAttr: !0,
|
|
2044
|
+
allowedAttributes: D,
|
|
2045
|
+
forceKeepAttr: void 0
|
|
2046
|
+
}, i = n.length;
|
|
2047
|
+
for (; i--;) {
|
|
2048
|
+
let a = n[i], o = a.name, s = a.namespaceURI, c = a.value, l = I(o), u = c, d = o === "value" ? u : Qn(u);
|
|
2049
|
+
if (r.attrName = l, r.attrValue = d, r.keepAttr = !0, r.forceKeepAttr = void 0, z(w.uponSanitizeAttribute, e, r), d = r.attrValue, ke && (l === "id" || l === "name") && Zn(d, Ae) !== 0 && (R(o, e), d = Ae + d), Se && G(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, d)) {
|
|
2050
|
+
R(o, e);
|
|
2051
|
+
continue;
|
|
2052
|
+
}
|
|
2053
|
+
if (l === "attributename" && Yn(d, "href")) {
|
|
2054
|
+
R(o, e);
|
|
2055
|
+
continue;
|
|
2056
|
+
}
|
|
2057
|
+
if (r.forceKeepAttr) continue;
|
|
2058
|
+
if (!r.keepAttr) {
|
|
2059
|
+
R(o, e);
|
|
2060
|
+
continue;
|
|
2061
|
+
}
|
|
2062
|
+
if (!be && G(/\/>/i, d)) {
|
|
2063
|
+
R(o, e);
|
|
2064
|
+
continue;
|
|
2065
|
+
}
|
|
2066
|
+
xe && Hn([
|
|
2067
|
+
oe,
|
|
2068
|
+
se,
|
|
2069
|
+
T
|
|
2070
|
+
], (e) => {
|
|
2071
|
+
d = Xn(d, e, " ");
|
|
2072
|
+
});
|
|
2073
|
+
let f = I(e.nodeName);
|
|
2074
|
+
if (!st(f, l, d)) {
|
|
2075
|
+
R(o, e);
|
|
2076
|
+
continue;
|
|
2077
|
+
}
|
|
2078
|
+
if (b && typeof m == "object" && typeof m.getAttributeType == "function" && !s) switch (m.getAttributeType(f, l)) {
|
|
2079
|
+
case "TrustedHTML":
|
|
2080
|
+
d = b.createHTML(d);
|
|
2081
|
+
break;
|
|
2082
|
+
case "TrustedScriptURL":
|
|
2083
|
+
d = b.createScriptURL(d);
|
|
2084
|
+
break;
|
|
2085
|
+
}
|
|
2086
|
+
if (d !== u) try {
|
|
2087
|
+
s ? e.setAttributeNS(s, o, d) : e.setAttribute(o, d), it(e) ? L(e) : Wn(t.removed);
|
|
2088
|
+
} catch {
|
|
2089
|
+
R(o, e);
|
|
2090
|
+
}
|
|
2091
|
+
}
|
|
2092
|
+
z(w.afterSanitizeAttributes, e, null);
|
|
2093
|
+
}, dt = function(e) {
|
|
2094
|
+
let t = null, n = nt(e);
|
|
2095
|
+
for (z(w.beforeSanitizeShadowDOM, e, null); t = n.nextNode();) z(w.uponSanitizeShadowNode, t, null), ot(t), ut(t), t.content instanceof a && dt(t.content);
|
|
2096
|
+
z(w.afterSanitizeShadowDOM, e, null);
|
|
2097
|
+
}, ft = function(e) {
|
|
2098
|
+
if (e.nodeType === jr.element && e.shadowRoot instanceof a) {
|
|
2099
|
+
let t = e.shadowRoot;
|
|
2100
|
+
ft(t), dt(t);
|
|
2101
|
+
}
|
|
2102
|
+
let t = e.childNodes;
|
|
2103
|
+
if (!t) return;
|
|
2104
|
+
let n = [];
|
|
2105
|
+
Hn(t, (e) => {
|
|
2106
|
+
Gn(n, e);
|
|
2107
|
+
});
|
|
2108
|
+
for (let e of n) ft(e);
|
|
2109
|
+
};
|
|
2110
|
+
return t.sanitize = function(e) {
|
|
2111
|
+
let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, i = null, o = null, s = null, c = null;
|
|
2112
|
+
if (Be = !e, Be && (e = "<!-->"), typeof e != "string" && !at(e) && (e = sr(e), typeof e != "string")) throw ir("dirty is not a string, aborting");
|
|
2113
|
+
if (!t.isSupported) return e;
|
|
2114
|
+
if (j || Ze(n), t.removed = [], typeof e == "string" && (je = !1), je) {
|
|
2115
|
+
let t = e.nodeName;
|
|
2116
|
+
if (typeof t == "string") {
|
|
2117
|
+
let e = I(t);
|
|
2118
|
+
if (!E[e] || ge[e]) throw ir("root node is forbidden and cannot be sanitized in-place");
|
|
2119
|
+
}
|
|
2120
|
+
ft(e);
|
|
2121
|
+
} else if (at(e)) i = tt("<!---->"), o = i.ownerDocument.importNode(e, !0), o.nodeType === jr.element && o.nodeName === "BODY" || o.nodeName === "HTML" ? i = o : i.appendChild(o), ft(o);
|
|
2122
|
+
else {
|
|
2123
|
+
if (!Te && !xe && !Ce && e.indexOf("<") === -1) return b && De ? b.createHTML(e) : e;
|
|
2124
|
+
if (i = tt(e), !i) return Te ? null : De ? x : "";
|
|
2125
|
+
}
|
|
2126
|
+
i && we && L(i.firstChild);
|
|
2127
|
+
let l = nt(je ? e : i);
|
|
2128
|
+
for (; s = l.nextNode();) ot(s), ut(s), s.content instanceof a && dt(s.content);
|
|
2129
|
+
if (je) return xe && rt(e), e;
|
|
2130
|
+
if (Te) {
|
|
2131
|
+
if (xe && rt(i), Ee) for (c = re.call(i.ownerDocument); i.firstChild;) c.appendChild(i.firstChild);
|
|
2132
|
+
else c = i;
|
|
2133
|
+
return (D.shadowroot || D.shadowrootmode) && (c = ae.call(r, c, !0)), c;
|
|
2134
|
+
}
|
|
2135
|
+
let u = Ce ? i.outerHTML : i.innerHTML;
|
|
2136
|
+
return Ce && E["!doctype"] && i.ownerDocument && i.ownerDocument.doctype && i.ownerDocument.doctype.name && G(kr, i.ownerDocument.doctype.name) && (u = "<!DOCTYPE " + i.ownerDocument.doctype.name + ">\n" + u), xe && Hn([
|
|
2137
|
+
oe,
|
|
2138
|
+
se,
|
|
2139
|
+
T
|
|
2140
|
+
], (e) => {
|
|
2141
|
+
u = Xn(u, e, " ");
|
|
2142
|
+
}), b && De ? b.createHTML(u) : u;
|
|
2143
|
+
}, t.setConfig = function() {
|
|
2144
|
+
Ze(arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}), j = !0;
|
|
2145
|
+
}, t.clearConfig = function() {
|
|
2146
|
+
Je = null, j = !1;
|
|
2147
|
+
}, t.isValidAttribute = function(e, t, n) {
|
|
2148
|
+
return Je || Ze({}), st(I(e), I(t), n);
|
|
2149
|
+
}, t.addHook = function(e, t) {
|
|
2150
|
+
typeof t == "function" && Gn(w[e], t);
|
|
2151
|
+
}, t.removeHook = function(e, t) {
|
|
2152
|
+
if (t !== void 0) {
|
|
2153
|
+
let n = Un(w[e], t);
|
|
2154
|
+
return n === -1 ? void 0 : Kn(w[e], n, 1)[0];
|
|
2155
|
+
}
|
|
2156
|
+
return Wn(w[e]);
|
|
2157
|
+
}, t.removeHooks = function(e) {
|
|
2158
|
+
w[e] = [];
|
|
2159
|
+
}, t.removeAllHooks = function() {
|
|
2160
|
+
w = Pr();
|
|
2161
|
+
}, t;
|
|
2162
|
+
}
|
|
2163
|
+
var Ir = Fr();
|
|
2164
|
+
//#endregion
|
|
2165
|
+
//#region node_modules/.pnpm/marked@18.0.4/node_modules/marked/lib/marked.esm.js
|
|
2166
|
+
function Lr() {
|
|
2167
|
+
return {
|
|
2168
|
+
async: !1,
|
|
2169
|
+
breaks: !1,
|
|
2170
|
+
extensions: null,
|
|
2171
|
+
gfm: !0,
|
|
2172
|
+
hooks: null,
|
|
2173
|
+
pedantic: !1,
|
|
2174
|
+
renderer: null,
|
|
2175
|
+
silent: !1,
|
|
2176
|
+
tokenizer: null,
|
|
2177
|
+
walkTokens: null
|
|
2178
|
+
};
|
|
2179
|
+
}
|
|
2180
|
+
var Rr = Lr();
|
|
2181
|
+
function zr(e) {
|
|
2182
|
+
Rr = e;
|
|
2183
|
+
}
|
|
2184
|
+
var Br = { exec: () => null };
|
|
2185
|
+
function Vr(e) {
|
|
2186
|
+
let t = [];
|
|
2187
|
+
return (n) => {
|
|
2188
|
+
let r = Math.max(0, Math.min(3, n - 1)), i = t[r];
|
|
2189
|
+
return i || (i = e(r), t[r] = i), i;
|
|
2190
|
+
};
|
|
2191
|
+
}
|
|
2192
|
+
function Y(e, t = "") {
|
|
2193
|
+
let n = typeof e == "string" ? e : e.source, r = {
|
|
2194
|
+
replace: (e, t) => {
|
|
2195
|
+
let i = typeof t == "string" ? t : t.source;
|
|
2196
|
+
return i = i.replace(X.caret, "$1"), n = n.replace(e, i), r;
|
|
2197
|
+
},
|
|
2198
|
+
getRegex: () => new RegExp(n, t)
|
|
2199
|
+
};
|
|
2200
|
+
return r;
|
|
2201
|
+
}
|
|
2202
|
+
var Hr = ((e = "") => {
|
|
2203
|
+
try {
|
|
2204
|
+
return !!RegExp("(?<=1)(?<!1)" + e);
|
|
2205
|
+
} catch {
|
|
2206
|
+
return !1;
|
|
2207
|
+
}
|
|
2208
|
+
})(), X = {
|
|
2209
|
+
codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm,
|
|
2210
|
+
outputLinkReplace: /\\([\[\]])/g,
|
|
2211
|
+
indentCodeCompensation: /^(\s+)(?:```)/,
|
|
2212
|
+
beginningSpace: /^\s+/,
|
|
2213
|
+
endingHash: /#$/,
|
|
2214
|
+
startingSpaceChar: /^ /,
|
|
2215
|
+
endingSpaceChar: / $/,
|
|
2216
|
+
nonSpaceChar: /[^ ]/,
|
|
2217
|
+
newLineCharGlobal: /\n/g,
|
|
2218
|
+
tabCharGlobal: /\t/g,
|
|
2219
|
+
multipleSpaceGlobal: /\s+/g,
|
|
2220
|
+
blankLine: /^[ \t]*$/,
|
|
2221
|
+
doubleBlankLine: /\n[ \t]*\n[ \t]*$/,
|
|
2222
|
+
blockquoteStart: /^ {0,3}>/,
|
|
2223
|
+
blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g,
|
|
2224
|
+
blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm,
|
|
2225
|
+
listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g,
|
|
2226
|
+
listIsTask: /^\[[ xX]\] +\S/,
|
|
2227
|
+
listReplaceTask: /^\[[ xX]\] +/,
|
|
2228
|
+
listTaskCheckbox: /\[[ xX]\]/,
|
|
2229
|
+
anyLine: /\n.*\n/,
|
|
2230
|
+
hrefBrackets: /^<(.*)>$/,
|
|
2231
|
+
tableDelimiter: /[:|]/,
|
|
2232
|
+
tableAlignChars: /^\||\| *$/g,
|
|
2233
|
+
tableRowBlankLine: /\n[ \t]*$/,
|
|
2234
|
+
tableAlignRight: /^ *-+: *$/,
|
|
2235
|
+
tableAlignCenter: /^ *:-+: *$/,
|
|
2236
|
+
tableAlignLeft: /^ *:-+ *$/,
|
|
2237
|
+
startATag: /^<a /i,
|
|
2238
|
+
endATag: /^<\/a>/i,
|
|
2239
|
+
startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i,
|
|
2240
|
+
endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i,
|
|
2241
|
+
startAngleBracket: /^</,
|
|
2242
|
+
endAngleBracket: />$/,
|
|
2243
|
+
pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/,
|
|
2244
|
+
unicodeAlphaNumeric: /[\p{L}\p{N}]/u,
|
|
2245
|
+
escapeTest: /[&<>"']/,
|
|
2246
|
+
escapeReplace: /[&<>"']/g,
|
|
2247
|
+
escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,
|
|
2248
|
+
escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,
|
|
2249
|
+
caret: /(^|[^\[])\^/g,
|
|
2250
|
+
percentDecode: /%25/g,
|
|
2251
|
+
findPipe: /\|/g,
|
|
2252
|
+
splitPipe: / \|/,
|
|
2253
|
+
slashPipe: /\\\|/g,
|
|
2254
|
+
carriageReturn: /\r\n|\r/g,
|
|
2255
|
+
spaceLine: /^ +$/gm,
|
|
2256
|
+
notSpaceStart: /^\S*/,
|
|
2257
|
+
endingNewline: /\n$/,
|
|
2258
|
+
listItemRegex: (e) => RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),
|
|
2259
|
+
nextBulletRegex: Vr((e) => RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),
|
|
2260
|
+
hrRegex: Vr((e) => RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),
|
|
2261
|
+
fencesBeginRegex: Vr((e) => RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),
|
|
2262
|
+
headingBeginRegex: Vr((e) => RegExp(`^ {0,${e}}#`)),
|
|
2263
|
+
htmlBeginRegex: Vr((e) => RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`, "i")),
|
|
2264
|
+
blockquoteBeginRegex: Vr((e) => RegExp(`^ {0,${e}}>`))
|
|
2265
|
+
}, Ur = /^(?:[ \t]*(?:\n|$))+/, Wr = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Gr = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, Kr = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, qr = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, Jr = / {0,3}(?:[*+-]|\d{1,9}[.)])/, Yr = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, Xr = Y(Yr).replace(/bull/g, Jr).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), Zr = Y(Yr).replace(/bull/g, Jr).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), Qr = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, $r = /^[^\n]+/, ei = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, ti = Y(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", ei).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), ni = Y(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, Jr).getRegex(), ri = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", ii = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, ai = Y("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", ii).replace("tag", ri).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), oi = Y(Qr).replace("hr", Kr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", ri).getRegex(), si = {
|
|
2266
|
+
blockquote: Y(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", oi).getRegex(),
|
|
2267
|
+
code: Wr,
|
|
2268
|
+
def: ti,
|
|
2269
|
+
fences: Gr,
|
|
2270
|
+
heading: qr,
|
|
2271
|
+
hr: Kr,
|
|
2272
|
+
html: ai,
|
|
2273
|
+
lheading: Xr,
|
|
2274
|
+
list: ni,
|
|
2275
|
+
newline: Ur,
|
|
2276
|
+
paragraph: oi,
|
|
2277
|
+
table: Br,
|
|
2278
|
+
text: $r
|
|
2279
|
+
}, ci = Y("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", Kr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", ri).getRegex(), li = {
|
|
2280
|
+
...si,
|
|
2281
|
+
lheading: Zr,
|
|
2282
|
+
table: ci,
|
|
2283
|
+
paragraph: Y(Qr).replace("hr", Kr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", ci).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", ri).getRegex()
|
|
2284
|
+
}, ui = {
|
|
2285
|
+
...si,
|
|
2286
|
+
html: Y("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment", ii).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
|
|
2287
|
+
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
2288
|
+
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
2289
|
+
fences: Br,
|
|
2290
|
+
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
2291
|
+
paragraph: Y(Qr).replace("hr", Kr).replace("heading", " *#{1,6} *[^\n]").replace("lheading", Xr).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
|
|
2292
|
+
}, di = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, fi = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, pi = /^( {2,}|\\)\n(?!\s*$)/, mi = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, hi = /[\p{P}\p{S}]/u, gi = /[\s\p{P}\p{S}]/u, _i = /[^\s\p{P}\p{S}]/u, vi = Y(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, gi).getRegex(), yi = /(?!~)[\p{P}\p{S}]/u, bi = /(?!~)[\s\p{P}\p{S}]/u, xi = /(?:[^\s\p{P}\p{S}]|~)/u, Si = Y(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", Hr ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), Ci = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, wi = Y(Ci, "u").replace(/punct/g, hi).getRegex(), Ti = Y(Ci, "u").replace(/punct/g, yi).getRegex(), Ei = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Di = Y(Ei, "gu").replace(/notPunctSpace/g, _i).replace(/punctSpace/g, gi).replace(/punct/g, hi).getRegex(), Oi = Y(Ei, "gu").replace(/notPunctSpace/g, xi).replace(/punctSpace/g, bi).replace(/punct/g, yi).getRegex(), ki = Y("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, _i).replace(/punctSpace/g, gi).replace(/punct/g, hi).getRegex(), Ai = Y(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, hi).getRegex(), ji = Y("^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, _i).replace(/punctSpace/g, gi).replace(/punct/g, hi).getRegex(), Mi = Y(/\\(punct)/, "gu").replace(/punct/g, hi).getRegex(), Ni = Y(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), Pi = Y(ii).replace("(?:-->|$)", "-->").getRegex(), Fi = Y("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", Pi).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), Ii = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/, Li = Y(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", Ii).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), Ri = Y(/^!?\[(label)\]\[(ref)\]/).replace("label", Ii).replace("ref", ei).getRegex(), zi = Y(/^!?\[(ref)\](?:\[\])?/).replace("ref", ei).getRegex(), Bi = Y("reflink|nolink(?!\\()", "g").replace("reflink", Ri).replace("nolink", zi).getRegex(), Vi = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, Hi = {
|
|
2293
|
+
_backpedal: Br,
|
|
2294
|
+
anyPunctuation: Mi,
|
|
2295
|
+
autolink: Ni,
|
|
2296
|
+
blockSkip: Si,
|
|
2297
|
+
br: pi,
|
|
2298
|
+
code: fi,
|
|
2299
|
+
del: Br,
|
|
2300
|
+
delLDelim: Br,
|
|
2301
|
+
delRDelim: Br,
|
|
2302
|
+
emStrongLDelim: wi,
|
|
2303
|
+
emStrongRDelimAst: Di,
|
|
2304
|
+
emStrongRDelimUnd: ki,
|
|
2305
|
+
escape: di,
|
|
2306
|
+
link: Li,
|
|
2307
|
+
nolink: zi,
|
|
2308
|
+
punctuation: vi,
|
|
2309
|
+
reflink: Ri,
|
|
2310
|
+
reflinkSearch: Bi,
|
|
2311
|
+
tag: Fi,
|
|
2312
|
+
text: mi,
|
|
2313
|
+
url: Br
|
|
2314
|
+
}, Ui = {
|
|
2315
|
+
...Hi,
|
|
2316
|
+
link: Y(/^!?\[(label)\]\((.*?)\)/).replace("label", Ii).getRegex(),
|
|
2317
|
+
reflink: Y(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", Ii).getRegex()
|
|
2318
|
+
}, Wi = {
|
|
2319
|
+
...Hi,
|
|
2320
|
+
emStrongRDelimAst: Oi,
|
|
2321
|
+
emStrongLDelim: Ti,
|
|
2322
|
+
delLDelim: Ai,
|
|
2323
|
+
delRDelim: ji,
|
|
2324
|
+
url: Y(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", Vi).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
|
|
2325
|
+
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
2326
|
+
del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,
|
|
2327
|
+
text: Y(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", Vi).getRegex()
|
|
2328
|
+
}, Gi = {
|
|
2329
|
+
...Wi,
|
|
2330
|
+
br: Y(pi).replace("{2,}", "*").getRegex(),
|
|
2331
|
+
text: Y(Wi.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
2332
|
+
}, Ki = {
|
|
2333
|
+
normal: si,
|
|
2334
|
+
gfm: li,
|
|
2335
|
+
pedantic: ui
|
|
2336
|
+
}, qi = {
|
|
2337
|
+
normal: Hi,
|
|
2338
|
+
gfm: Wi,
|
|
2339
|
+
breaks: Gi,
|
|
2340
|
+
pedantic: Ui
|
|
2341
|
+
}, Ji = {
|
|
2342
|
+
"&": "&",
|
|
2343
|
+
"<": "<",
|
|
2344
|
+
">": ">",
|
|
2345
|
+
"\"": """,
|
|
2346
|
+
"'": "'"
|
|
2347
|
+
}, Yi = (e) => Ji[e];
|
|
2348
|
+
function Xi(e, t) {
|
|
2349
|
+
if (t) {
|
|
2350
|
+
if (X.escapeTest.test(e)) return e.replace(X.escapeReplace, Yi);
|
|
2351
|
+
} else if (X.escapeTestNoEncode.test(e)) return e.replace(X.escapeReplaceNoEncode, Yi);
|
|
2352
|
+
return e;
|
|
2353
|
+
}
|
|
2354
|
+
function Zi(e) {
|
|
2355
|
+
try {
|
|
2356
|
+
e = encodeURI(e).replace(X.percentDecode, "%");
|
|
2357
|
+
} catch {
|
|
2358
|
+
return null;
|
|
2359
|
+
}
|
|
2360
|
+
return e;
|
|
2361
|
+
}
|
|
2362
|
+
function Qi(e, t) {
|
|
2363
|
+
let n = e.replace(X.findPipe, (e, t, n) => {
|
|
2364
|
+
let r = !1, i = t;
|
|
2365
|
+
for (; --i >= 0 && n[i] === "\\";) r = !r;
|
|
2366
|
+
return r ? "|" : " |";
|
|
2367
|
+
}).split(X.splitPipe), r = 0;
|
|
2368
|
+
if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), t) if (n.length > t) n.splice(t);
|
|
2369
|
+
else for (; n.length < t;) n.push("");
|
|
2370
|
+
for (; r < n.length; r++) n[r] = n[r].trim().replace(X.slashPipe, "|");
|
|
2371
|
+
return n;
|
|
2372
|
+
}
|
|
2373
|
+
function $i(e, t, n) {
|
|
2374
|
+
let r = e.length;
|
|
2375
|
+
if (r === 0) return "";
|
|
2376
|
+
let i = 0;
|
|
2377
|
+
for (; i < r;) {
|
|
2378
|
+
let a = e.charAt(r - i - 1);
|
|
2379
|
+
if (a === t && !n) i++;
|
|
2380
|
+
else if (a !== t && n) i++;
|
|
2381
|
+
else break;
|
|
2382
|
+
}
|
|
2383
|
+
return e.slice(0, r - i);
|
|
2384
|
+
}
|
|
2385
|
+
function ea(e) {
|
|
2386
|
+
let t = e.split("\n"), n = t.length - 1;
|
|
2387
|
+
for (; n >= 0 && X.blankLine.test(t[n]);) n--;
|
|
2388
|
+
return t.length - n <= 2 ? e : t.slice(0, n + 1).join("\n");
|
|
2389
|
+
}
|
|
2390
|
+
function ta(e, t) {
|
|
2391
|
+
if (e.indexOf(t[1]) === -1) return -1;
|
|
2392
|
+
let n = 0;
|
|
2393
|
+
for (let r = 0; r < e.length; r++) if (e[r] === "\\") r++;
|
|
2394
|
+
else if (e[r] === t[0]) n++;
|
|
2395
|
+
else if (e[r] === t[1] && (n--, n < 0)) return r;
|
|
2396
|
+
return n > 0 ? -2 : -1;
|
|
2397
|
+
}
|
|
2398
|
+
function na(e, t = 0) {
|
|
2399
|
+
let n = t, r = "";
|
|
2400
|
+
for (let t of e) if (t === " ") {
|
|
2401
|
+
let e = 4 - n % 4;
|
|
2402
|
+
r += " ".repeat(e), n += e;
|
|
2403
|
+
} else r += t, n++;
|
|
2404
|
+
return r;
|
|
2405
|
+
}
|
|
2406
|
+
function ra(e, t, n, r, i) {
|
|
2407
|
+
let a = t.href, o = t.title || null, s = e[1].replace(i.other.outputLinkReplace, "$1");
|
|
2408
|
+
r.state.inLink = !0;
|
|
2409
|
+
let c = {
|
|
2410
|
+
type: e[0].charAt(0) === "!" ? "image" : "link",
|
|
2411
|
+
raw: n,
|
|
2412
|
+
href: a,
|
|
2413
|
+
title: o,
|
|
2414
|
+
text: s,
|
|
2415
|
+
tokens: r.inlineTokens(s)
|
|
2416
|
+
};
|
|
2417
|
+
return r.state.inLink = !1, c;
|
|
2418
|
+
}
|
|
2419
|
+
function ia(e, t, n) {
|
|
2420
|
+
let r = e.match(n.other.indentCodeCompensation);
|
|
2421
|
+
if (r === null) return t;
|
|
2422
|
+
let i = r[1];
|
|
2423
|
+
return t.split("\n").map((e) => {
|
|
2424
|
+
let t = e.match(n.other.beginningSpace);
|
|
2425
|
+
if (t === null) return e;
|
|
2426
|
+
let [r] = t;
|
|
2427
|
+
return r.length >= i.length ? e.slice(i.length) : e;
|
|
2428
|
+
}).join("\n");
|
|
2429
|
+
}
|
|
2430
|
+
var aa = class {
|
|
2431
|
+
options;
|
|
2432
|
+
rules;
|
|
2433
|
+
lexer;
|
|
2434
|
+
constructor(e) {
|
|
2435
|
+
this.options = e || Rr;
|
|
2436
|
+
}
|
|
2437
|
+
space(e) {
|
|
2438
|
+
let t = this.rules.block.newline.exec(e);
|
|
2439
|
+
if (t && t[0].length > 0) return {
|
|
2440
|
+
type: "space",
|
|
2441
|
+
raw: t[0]
|
|
2442
|
+
};
|
|
2443
|
+
}
|
|
2444
|
+
code(e) {
|
|
2445
|
+
let t = this.rules.block.code.exec(e);
|
|
2446
|
+
if (t) {
|
|
2447
|
+
let e = this.options.pedantic ? t[0] : ea(t[0]);
|
|
2448
|
+
return {
|
|
2449
|
+
type: "code",
|
|
2450
|
+
raw: e,
|
|
2451
|
+
codeBlockStyle: "indented",
|
|
2452
|
+
text: e.replace(this.rules.other.codeRemoveIndent, "")
|
|
2453
|
+
};
|
|
2454
|
+
}
|
|
2455
|
+
}
|
|
2456
|
+
fences(e) {
|
|
2457
|
+
let t = this.rules.block.fences.exec(e);
|
|
2458
|
+
if (t) {
|
|
2459
|
+
let e = t[0], n = ia(e, t[3] || "", this.rules);
|
|
2460
|
+
return {
|
|
2461
|
+
type: "code",
|
|
2462
|
+
raw: e,
|
|
2463
|
+
lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2],
|
|
2464
|
+
text: n
|
|
2465
|
+
};
|
|
2466
|
+
}
|
|
2467
|
+
}
|
|
2468
|
+
heading(e) {
|
|
2469
|
+
let t = this.rules.block.heading.exec(e);
|
|
2470
|
+
if (t) {
|
|
2471
|
+
let e = t[2].trim();
|
|
2472
|
+
if (this.rules.other.endingHash.test(e)) {
|
|
2473
|
+
let t = $i(e, "#");
|
|
2474
|
+
(this.options.pedantic || !t || this.rules.other.endingSpaceChar.test(t)) && (e = t.trim());
|
|
2475
|
+
}
|
|
2476
|
+
return {
|
|
2477
|
+
type: "heading",
|
|
2478
|
+
raw: $i(t[0], "\n"),
|
|
2479
|
+
depth: t[1].length,
|
|
2480
|
+
text: e,
|
|
2481
|
+
tokens: this.lexer.inline(e)
|
|
2482
|
+
};
|
|
2483
|
+
}
|
|
2484
|
+
}
|
|
2485
|
+
hr(e) {
|
|
2486
|
+
let t = this.rules.block.hr.exec(e);
|
|
2487
|
+
if (t) return {
|
|
2488
|
+
type: "hr",
|
|
2489
|
+
raw: $i(t[0], "\n")
|
|
2490
|
+
};
|
|
2491
|
+
}
|
|
2492
|
+
blockquote(e) {
|
|
2493
|
+
let t = this.rules.block.blockquote.exec(e);
|
|
2494
|
+
if (t) {
|
|
2495
|
+
let e = $i(t[0], "\n").split("\n"), n = "", r = "", i = [];
|
|
2496
|
+
for (; e.length > 0;) {
|
|
2497
|
+
let t = !1, a = [], o;
|
|
2498
|
+
for (o = 0; o < e.length; o++) if (this.rules.other.blockquoteStart.test(e[o])) a.push(e[o]), t = !0;
|
|
2499
|
+
else if (!t) a.push(e[o]);
|
|
2500
|
+
else break;
|
|
2501
|
+
e = e.slice(o);
|
|
2502
|
+
let s = a.join("\n"), c = s.replace(this.rules.other.blockquoteSetextReplace, "\n $1").replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
2503
|
+
n = n ? `${n}
|
|
2504
|
+
${s}` : s, r = r ? `${r}
|
|
2505
|
+
${c}` : c;
|
|
2506
|
+
let l = this.lexer.state.top;
|
|
2507
|
+
if (this.lexer.state.top = !0, this.lexer.blockTokens(c, i, !0), this.lexer.state.top = l, e.length === 0) break;
|
|
2508
|
+
let u = i.at(-1);
|
|
2509
|
+
if (u?.type === "code") break;
|
|
2510
|
+
if (u?.type === "blockquote") {
|
|
2511
|
+
let t = u, a = t.raw + "\n" + e.join("\n"), o = this.blockquote(a);
|
|
2512
|
+
i[i.length - 1] = o, n = n.substring(0, n.length - t.raw.length) + o.raw, r = r.substring(0, r.length - t.text.length) + o.text;
|
|
2513
|
+
break;
|
|
2514
|
+
} else if (u?.type === "list") {
|
|
2515
|
+
let t = u, a = t.raw + "\n" + e.join("\n"), o = this.list(a);
|
|
2516
|
+
i[i.length - 1] = o, n = n.substring(0, n.length - u.raw.length) + o.raw, r = r.substring(0, r.length - t.raw.length) + o.raw, e = a.substring(i.at(-1).raw.length).split("\n");
|
|
2517
|
+
continue;
|
|
2518
|
+
}
|
|
2519
|
+
}
|
|
2520
|
+
return {
|
|
2521
|
+
type: "blockquote",
|
|
2522
|
+
raw: n,
|
|
2523
|
+
tokens: i,
|
|
2524
|
+
text: r
|
|
2525
|
+
};
|
|
2526
|
+
}
|
|
2527
|
+
}
|
|
2528
|
+
list(e) {
|
|
2529
|
+
let t = this.rules.block.list.exec(e);
|
|
2530
|
+
if (t) {
|
|
2531
|
+
let n = t[1].trim(), r = n.length > 1, i = {
|
|
2532
|
+
type: "list",
|
|
2533
|
+
raw: "",
|
|
2534
|
+
ordered: r,
|
|
2535
|
+
start: r ? +n.slice(0, -1) : "",
|
|
2536
|
+
loose: !1,
|
|
2537
|
+
items: []
|
|
2538
|
+
};
|
|
2539
|
+
n = r ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = r ? n : "[*+-]");
|
|
2540
|
+
let a = this.rules.other.listItemRegex(n), o = !1;
|
|
2541
|
+
for (; e;) {
|
|
2542
|
+
let n = !1, r = "", s = "";
|
|
2543
|
+
if (!(t = a.exec(e)) || this.rules.block.hr.test(e)) break;
|
|
2544
|
+
r = t[0], e = e.substring(r.length);
|
|
2545
|
+
let c = na(t[2].split("\n", 1)[0], t[1].length), l = e.split("\n", 1)[0], u = !c.trim(), d = 0;
|
|
2546
|
+
if (this.options.pedantic ? (d = 2, s = c.trimStart()) : u ? d = t[1].length + 1 : (d = c.search(this.rules.other.nonSpaceChar), d = d > 4 ? 1 : d, s = c.slice(d), d += t[1].length), u && this.rules.other.blankLine.test(l) && (r += l + "\n", e = e.substring(l.length + 1), n = !0), !n) {
|
|
2547
|
+
let t = this.rules.other.nextBulletRegex(d), n = this.rules.other.hrRegex(d), i = this.rules.other.fencesBeginRegex(d), a = this.rules.other.headingBeginRegex(d), o = this.rules.other.htmlBeginRegex(d), f = this.rules.other.blockquoteBeginRegex(d);
|
|
2548
|
+
for (; e;) {
|
|
2549
|
+
let p = e.split("\n", 1)[0], m;
|
|
2550
|
+
if (l = p, this.options.pedantic ? (l = l.replace(this.rules.other.listReplaceNesting, " "), m = l) : m = l.replace(this.rules.other.tabCharGlobal, " "), i.test(l) || a.test(l) || o.test(l) || f.test(l) || t.test(l) || n.test(l)) break;
|
|
2551
|
+
if (m.search(this.rules.other.nonSpaceChar) >= d || !l.trim()) s += "\n" + m.slice(d);
|
|
2552
|
+
else {
|
|
2553
|
+
if (u || c.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || i.test(c) || a.test(c) || n.test(c)) break;
|
|
2554
|
+
s += "\n" + l;
|
|
2555
|
+
}
|
|
2556
|
+
u = !l.trim(), r += p + "\n", e = e.substring(p.length + 1), c = m.slice(d);
|
|
2557
|
+
}
|
|
2558
|
+
}
|
|
2559
|
+
i.loose || (o ? i.loose = !0 : this.rules.other.doubleBlankLine.test(r) && (o = !0)), i.items.push({
|
|
2560
|
+
type: "list_item",
|
|
2561
|
+
raw: r,
|
|
2562
|
+
task: !!this.options.gfm && this.rules.other.listIsTask.test(s),
|
|
2563
|
+
loose: !1,
|
|
2564
|
+
text: s,
|
|
2565
|
+
tokens: []
|
|
2566
|
+
}), i.raw += r;
|
|
2567
|
+
}
|
|
2568
|
+
let s = i.items.at(-1);
|
|
2569
|
+
if (s) s.raw = s.raw.trimEnd(), s.text = s.text.trimEnd();
|
|
2570
|
+
else return;
|
|
2571
|
+
i.raw = i.raw.trimEnd();
|
|
2572
|
+
for (let e of i.items) {
|
|
2573
|
+
this.lexer.state.top = !1, e.tokens = this.lexer.blockTokens(e.text, []);
|
|
2574
|
+
let t = e.tokens[0];
|
|
2575
|
+
if (e.task && (t?.type === "text" || t?.type === "paragraph")) {
|
|
2576
|
+
e.text = e.text.replace(this.rules.other.listReplaceTask, ""), t.raw = t.raw.replace(this.rules.other.listReplaceTask, ""), t.text = t.text.replace(this.rules.other.listReplaceTask, "");
|
|
2577
|
+
for (let e = this.lexer.inlineQueue.length - 1; e >= 0; e--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)) {
|
|
2578
|
+
this.lexer.inlineQueue[e].src = this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask, "");
|
|
2579
|
+
break;
|
|
2580
|
+
}
|
|
2581
|
+
let n = this.rules.other.listTaskCheckbox.exec(e.raw);
|
|
2582
|
+
if (n) {
|
|
2583
|
+
let t = {
|
|
2584
|
+
type: "checkbox",
|
|
2585
|
+
raw: n[0] + " ",
|
|
2586
|
+
checked: n[0] !== "[ ]"
|
|
2587
|
+
};
|
|
2588
|
+
e.checked = t.checked, i.loose ? e.tokens[0] && ["paragraph", "text"].includes(e.tokens[0].type) && "tokens" in e.tokens[0] && e.tokens[0].tokens ? (e.tokens[0].raw = t.raw + e.tokens[0].raw, e.tokens[0].text = t.raw + e.tokens[0].text, e.tokens[0].tokens.unshift(t)) : e.tokens.unshift({
|
|
2589
|
+
type: "paragraph",
|
|
2590
|
+
raw: t.raw,
|
|
2591
|
+
text: t.raw,
|
|
2592
|
+
tokens: [t]
|
|
2593
|
+
}) : e.tokens.unshift(t);
|
|
2594
|
+
}
|
|
2595
|
+
} else e.task &&= !1;
|
|
2596
|
+
if (!i.loose) {
|
|
2597
|
+
let t = e.tokens.filter((e) => e.type === "space");
|
|
2598
|
+
i.loose = t.length > 0 && t.some((e) => this.rules.other.anyLine.test(e.raw));
|
|
2599
|
+
}
|
|
2600
|
+
}
|
|
2601
|
+
if (i.loose) for (let e of i.items) {
|
|
2602
|
+
e.loose = !0;
|
|
2603
|
+
for (let t of e.tokens) t.type === "text" && (t.type = "paragraph");
|
|
2604
|
+
}
|
|
2605
|
+
return i;
|
|
2606
|
+
}
|
|
2607
|
+
}
|
|
2608
|
+
html(e) {
|
|
2609
|
+
let t = this.rules.block.html.exec(e);
|
|
2610
|
+
if (t) {
|
|
2611
|
+
let e = ea(t[0]);
|
|
2612
|
+
return {
|
|
2613
|
+
type: "html",
|
|
2614
|
+
block: !0,
|
|
2615
|
+
raw: e,
|
|
2616
|
+
pre: t[1] === "pre" || t[1] === "script" || t[1] === "style",
|
|
2617
|
+
text: e
|
|
2618
|
+
};
|
|
2619
|
+
}
|
|
2620
|
+
}
|
|
2621
|
+
def(e) {
|
|
2622
|
+
let t = this.rules.block.def.exec(e);
|
|
2623
|
+
if (t) {
|
|
2624
|
+
let e = t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), n = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", r = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
|
|
2625
|
+
return {
|
|
2626
|
+
type: "def",
|
|
2627
|
+
tag: e,
|
|
2628
|
+
raw: $i(t[0], "\n"),
|
|
2629
|
+
href: n,
|
|
2630
|
+
title: r
|
|
2631
|
+
};
|
|
2632
|
+
}
|
|
2633
|
+
}
|
|
2634
|
+
table(e) {
|
|
2635
|
+
let t = this.rules.block.table.exec(e);
|
|
2636
|
+
if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
|
|
2637
|
+
let n = Qi(t[1]), r = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), i = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split("\n") : [], a = {
|
|
2638
|
+
type: "table",
|
|
2639
|
+
raw: $i(t[0], "\n"),
|
|
2640
|
+
header: [],
|
|
2641
|
+
align: [],
|
|
2642
|
+
rows: []
|
|
2643
|
+
};
|
|
2644
|
+
if (n.length === r.length) {
|
|
2645
|
+
for (let e of r) this.rules.other.tableAlignRight.test(e) ? a.align.push("right") : this.rules.other.tableAlignCenter.test(e) ? a.align.push("center") : this.rules.other.tableAlignLeft.test(e) ? a.align.push("left") : a.align.push(null);
|
|
2646
|
+
for (let e = 0; e < n.length; e++) a.header.push({
|
|
2647
|
+
text: n[e],
|
|
2648
|
+
tokens: this.lexer.inline(n[e]),
|
|
2649
|
+
header: !0,
|
|
2650
|
+
align: a.align[e]
|
|
2651
|
+
});
|
|
2652
|
+
for (let e of i) a.rows.push(Qi(e, a.header.length).map((e, t) => ({
|
|
2653
|
+
text: e,
|
|
2654
|
+
tokens: this.lexer.inline(e),
|
|
2655
|
+
header: !1,
|
|
2656
|
+
align: a.align[t]
|
|
2657
|
+
})));
|
|
2658
|
+
return a;
|
|
2659
|
+
}
|
|
2660
|
+
}
|
|
2661
|
+
lheading(e) {
|
|
2662
|
+
let t = this.rules.block.lheading.exec(e);
|
|
2663
|
+
if (t) {
|
|
2664
|
+
let e = t[1].trim();
|
|
2665
|
+
return {
|
|
2666
|
+
type: "heading",
|
|
2667
|
+
raw: $i(t[0], "\n"),
|
|
2668
|
+
depth: t[2].charAt(0) === "=" ? 1 : 2,
|
|
2669
|
+
text: e,
|
|
2670
|
+
tokens: this.lexer.inline(e)
|
|
2671
|
+
};
|
|
2672
|
+
}
|
|
2673
|
+
}
|
|
2674
|
+
paragraph(e) {
|
|
2675
|
+
let t = this.rules.block.paragraph.exec(e);
|
|
2676
|
+
if (t) {
|
|
2677
|
+
let e = t[1].charAt(t[1].length - 1) === "\n" ? t[1].slice(0, -1) : t[1];
|
|
2678
|
+
return {
|
|
2679
|
+
type: "paragraph",
|
|
2680
|
+
raw: t[0],
|
|
2681
|
+
text: e,
|
|
2682
|
+
tokens: this.lexer.inline(e)
|
|
2683
|
+
};
|
|
2684
|
+
}
|
|
2685
|
+
}
|
|
2686
|
+
text(e) {
|
|
2687
|
+
let t = this.rules.block.text.exec(e);
|
|
2688
|
+
if (t) return {
|
|
2689
|
+
type: "text",
|
|
2690
|
+
raw: t[0],
|
|
2691
|
+
text: t[0],
|
|
2692
|
+
tokens: this.lexer.inline(t[0])
|
|
2693
|
+
};
|
|
2694
|
+
}
|
|
2695
|
+
escape(e) {
|
|
2696
|
+
let t = this.rules.inline.escape.exec(e);
|
|
2697
|
+
if (t) return {
|
|
2698
|
+
type: "escape",
|
|
2699
|
+
raw: t[0],
|
|
2700
|
+
text: t[1]
|
|
2701
|
+
};
|
|
2702
|
+
}
|
|
2703
|
+
tag(e) {
|
|
2704
|
+
let t = this.rules.inline.tag.exec(e);
|
|
2705
|
+
if (t) return !this.lexer.state.inLink && this.rules.other.startATag.test(t[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && this.rules.other.endATag.test(t[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(t[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(t[0]) && (this.lexer.state.inRawBlock = !1), {
|
|
2706
|
+
type: "html",
|
|
2707
|
+
raw: t[0],
|
|
2708
|
+
inLink: this.lexer.state.inLink,
|
|
2709
|
+
inRawBlock: this.lexer.state.inRawBlock,
|
|
2710
|
+
block: !1,
|
|
2711
|
+
text: t[0]
|
|
2712
|
+
};
|
|
2713
|
+
}
|
|
2714
|
+
link(e) {
|
|
2715
|
+
let t = this.rules.inline.link.exec(e);
|
|
2716
|
+
if (t) {
|
|
2717
|
+
let e = t[2].trim();
|
|
2718
|
+
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(e)) {
|
|
2719
|
+
if (!this.rules.other.endAngleBracket.test(e)) return;
|
|
2720
|
+
let t = $i(e.slice(0, -1), "\\");
|
|
2721
|
+
if ((e.length - t.length) % 2 == 0) return;
|
|
2722
|
+
} else {
|
|
2723
|
+
let e = ta(t[2], "()");
|
|
2724
|
+
if (e === -2) return;
|
|
2725
|
+
if (e > -1) {
|
|
2726
|
+
let n = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + e;
|
|
2727
|
+
t[2] = t[2].substring(0, e), t[0] = t[0].substring(0, n).trim(), t[3] = "";
|
|
2728
|
+
}
|
|
2729
|
+
}
|
|
2730
|
+
let n = t[2], r = "";
|
|
2731
|
+
if (this.options.pedantic) {
|
|
2732
|
+
let e = this.rules.other.pedanticHrefTitle.exec(n);
|
|
2733
|
+
e && (n = e[1], r = e[3]);
|
|
2734
|
+
} else r = t[3] ? t[3].slice(1, -1) : "";
|
|
2735
|
+
return n = n.trim(), this.rules.other.startAngleBracket.test(n) && (n = this.options.pedantic && !this.rules.other.endAngleBracket.test(e) ? n.slice(1) : n.slice(1, -1)), ra(t, {
|
|
2736
|
+
href: n && n.replace(this.rules.inline.anyPunctuation, "$1"),
|
|
2737
|
+
title: r && r.replace(this.rules.inline.anyPunctuation, "$1")
|
|
2738
|
+
}, t[0], this.lexer, this.rules);
|
|
2739
|
+
}
|
|
2740
|
+
}
|
|
2741
|
+
reflink(e, t) {
|
|
2742
|
+
let n;
|
|
2743
|
+
if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
|
|
2744
|
+
let e = t[(n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " ").toLowerCase()];
|
|
2745
|
+
if (!e) {
|
|
2746
|
+
let e = n[0].charAt(0);
|
|
2747
|
+
return {
|
|
2748
|
+
type: "text",
|
|
2749
|
+
raw: e,
|
|
2750
|
+
text: e
|
|
2751
|
+
};
|
|
2752
|
+
}
|
|
2753
|
+
return ra(n, e, n[0], this.lexer, this.rules);
|
|
2754
|
+
}
|
|
2755
|
+
}
|
|
2756
|
+
emStrong(e, t, n = "") {
|
|
2757
|
+
let r = this.rules.inline.emStrongLDelim.exec(e);
|
|
2758
|
+
if (!(!r || !r[1] && !r[2] && !r[3] && !r[4] || r[4] && n.match(this.rules.other.unicodeAlphaNumeric)) && (!(r[1] || r[3]) || !n || this.rules.inline.punctuation.exec(n))) {
|
|
2759
|
+
let n = [...r[0]].length - 1, i, a, o = n, s = 0, c = r[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
2760
|
+
for (c.lastIndex = 0, t = t.slice(-1 * e.length + n); (r = c.exec(t)) !== null;) {
|
|
2761
|
+
if (i = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !i) continue;
|
|
2762
|
+
if (a = [...i].length, r[3] || r[4]) {
|
|
2763
|
+
o += a;
|
|
2764
|
+
continue;
|
|
2765
|
+
} else if ((r[5] || r[6]) && n % 3 && !((n + a) % 3)) {
|
|
2766
|
+
s += a;
|
|
2767
|
+
continue;
|
|
2768
|
+
}
|
|
2769
|
+
if (o -= a, o > 0) continue;
|
|
2770
|
+
a = Math.min(a, a + o + s);
|
|
2771
|
+
let t = [...r[0]][0].length, c = e.slice(0, n + r.index + t + a);
|
|
2772
|
+
if (Math.min(n, a) % 2) {
|
|
2773
|
+
let e = c.slice(1, -1);
|
|
2774
|
+
return {
|
|
2775
|
+
type: "em",
|
|
2776
|
+
raw: c,
|
|
2777
|
+
text: e,
|
|
2778
|
+
tokens: this.lexer.inlineTokens(e)
|
|
2779
|
+
};
|
|
2780
|
+
}
|
|
2781
|
+
let l = c.slice(2, -2);
|
|
2782
|
+
return {
|
|
2783
|
+
type: "strong",
|
|
2784
|
+
raw: c,
|
|
2785
|
+
text: l,
|
|
2786
|
+
tokens: this.lexer.inlineTokens(l)
|
|
2787
|
+
};
|
|
2788
|
+
}
|
|
2789
|
+
}
|
|
2790
|
+
}
|
|
2791
|
+
codespan(e) {
|
|
2792
|
+
let t = this.rules.inline.code.exec(e);
|
|
2793
|
+
if (t) {
|
|
2794
|
+
let e = t[2].replace(this.rules.other.newLineCharGlobal, " "), n = this.rules.other.nonSpaceChar.test(e), r = this.rules.other.startingSpaceChar.test(e) && this.rules.other.endingSpaceChar.test(e);
|
|
2795
|
+
return n && r && (e = e.substring(1, e.length - 1)), {
|
|
2796
|
+
type: "codespan",
|
|
2797
|
+
raw: t[0],
|
|
2798
|
+
text: e
|
|
2799
|
+
};
|
|
2800
|
+
}
|
|
2801
|
+
}
|
|
2802
|
+
br(e) {
|
|
2803
|
+
let t = this.rules.inline.br.exec(e);
|
|
2804
|
+
if (t) return {
|
|
2805
|
+
type: "br",
|
|
2806
|
+
raw: t[0]
|
|
2807
|
+
};
|
|
2808
|
+
}
|
|
2809
|
+
del(e, t, n = "") {
|
|
2810
|
+
let r = this.rules.inline.delLDelim.exec(e);
|
|
2811
|
+
if (r && (!r[1] || !n || this.rules.inline.punctuation.exec(n))) {
|
|
2812
|
+
let n = [...r[0]].length - 1, i, a, o = n, s = this.rules.inline.delRDelim;
|
|
2813
|
+
for (s.lastIndex = 0, t = t.slice(-1 * e.length + n); (r = s.exec(t)) !== null;) {
|
|
2814
|
+
if (i = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !i || (a = [...i].length, a !== n)) continue;
|
|
2815
|
+
if (r[3] || r[4]) {
|
|
2816
|
+
o += a;
|
|
2817
|
+
continue;
|
|
2818
|
+
}
|
|
2819
|
+
if (o -= a, o > 0) continue;
|
|
2820
|
+
a = Math.min(a, a + o);
|
|
2821
|
+
let t = [...r[0]][0].length, s = e.slice(0, n + r.index + t + a), c = s.slice(n, -n);
|
|
2822
|
+
return {
|
|
2823
|
+
type: "del",
|
|
2824
|
+
raw: s,
|
|
2825
|
+
text: c,
|
|
2826
|
+
tokens: this.lexer.inlineTokens(c)
|
|
2827
|
+
};
|
|
2828
|
+
}
|
|
2829
|
+
}
|
|
2830
|
+
}
|
|
2831
|
+
autolink(e) {
|
|
2832
|
+
let t = this.rules.inline.autolink.exec(e);
|
|
2833
|
+
if (t) {
|
|
2834
|
+
let e, n;
|
|
2835
|
+
return t[2] === "@" ? (e = t[1], n = "mailto:" + e) : (e = t[1], n = e), {
|
|
2836
|
+
type: "link",
|
|
2837
|
+
raw: t[0],
|
|
2838
|
+
text: e,
|
|
2839
|
+
href: n,
|
|
2840
|
+
tokens: [{
|
|
2841
|
+
type: "text",
|
|
2842
|
+
raw: e,
|
|
2843
|
+
text: e
|
|
2844
|
+
}]
|
|
2845
|
+
};
|
|
2846
|
+
}
|
|
2847
|
+
}
|
|
2848
|
+
url(e) {
|
|
2849
|
+
let t;
|
|
2850
|
+
if (t = this.rules.inline.url.exec(e)) {
|
|
2851
|
+
let e, n;
|
|
2852
|
+
if (t[2] === "@") e = t[0], n = "mailto:" + e;
|
|
2853
|
+
else {
|
|
2854
|
+
let r;
|
|
2855
|
+
do
|
|
2856
|
+
r = t[0], t[0] = this.rules.inline._backpedal.exec(t[0])?.[0] ?? "";
|
|
2857
|
+
while (r !== t[0]);
|
|
2858
|
+
e = t[0], n = t[1] === "www." ? "http://" + t[0] : t[0];
|
|
2859
|
+
}
|
|
2860
|
+
return {
|
|
2861
|
+
type: "link",
|
|
2862
|
+
raw: t[0],
|
|
2863
|
+
text: e,
|
|
2864
|
+
href: n,
|
|
2865
|
+
tokens: [{
|
|
2866
|
+
type: "text",
|
|
2867
|
+
raw: e,
|
|
2868
|
+
text: e
|
|
2869
|
+
}]
|
|
2870
|
+
};
|
|
2871
|
+
}
|
|
2872
|
+
}
|
|
2873
|
+
inlineText(e) {
|
|
2874
|
+
let t = this.rules.inline.text.exec(e);
|
|
2875
|
+
if (t) {
|
|
2876
|
+
let e = this.lexer.state.inRawBlock;
|
|
2877
|
+
return {
|
|
2878
|
+
type: "text",
|
|
2879
|
+
raw: t[0],
|
|
2880
|
+
text: t[0],
|
|
2881
|
+
escaped: e
|
|
2882
|
+
};
|
|
2883
|
+
}
|
|
2884
|
+
}
|
|
2885
|
+
}, Z = class e {
|
|
2886
|
+
tokens;
|
|
2887
|
+
options;
|
|
2888
|
+
state;
|
|
2889
|
+
inlineQueue;
|
|
2890
|
+
tokenizer;
|
|
2891
|
+
constructor(e) {
|
|
2892
|
+
this.tokens = [], this.tokens.links = Object.create(null), this.options = e || Rr, this.options.tokenizer = this.options.tokenizer || new aa(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
|
|
2893
|
+
inLink: !1,
|
|
2894
|
+
inRawBlock: !1,
|
|
2895
|
+
top: !0
|
|
2896
|
+
};
|
|
2897
|
+
let t = {
|
|
2898
|
+
other: X,
|
|
2899
|
+
block: Ki.normal,
|
|
2900
|
+
inline: qi.normal
|
|
2901
|
+
};
|
|
2902
|
+
this.options.pedantic ? (t.block = Ki.pedantic, t.inline = qi.pedantic) : this.options.gfm && (t.block = Ki.gfm, this.options.breaks ? t.inline = qi.breaks : t.inline = qi.gfm), this.tokenizer.rules = t;
|
|
2903
|
+
}
|
|
2904
|
+
static get rules() {
|
|
2905
|
+
return {
|
|
2906
|
+
block: Ki,
|
|
2907
|
+
inline: qi
|
|
2908
|
+
};
|
|
2909
|
+
}
|
|
2910
|
+
static lex(t, n) {
|
|
2911
|
+
return new e(n).lex(t);
|
|
2912
|
+
}
|
|
2913
|
+
static lexInline(t, n) {
|
|
2914
|
+
return new e(n).inlineTokens(t);
|
|
2915
|
+
}
|
|
2916
|
+
lex(e) {
|
|
2917
|
+
e = e.replace(X.carriageReturn, "\n"), this.blockTokens(e, this.tokens);
|
|
2918
|
+
for (let e = 0; e < this.inlineQueue.length; e++) {
|
|
2919
|
+
let t = this.inlineQueue[e];
|
|
2920
|
+
this.inlineTokens(t.src, t.tokens);
|
|
2921
|
+
}
|
|
2922
|
+
return this.inlineQueue = [], this.tokens;
|
|
2923
|
+
}
|
|
2924
|
+
blockTokens(e, t = [], n = !1) {
|
|
2925
|
+
this.tokenizer.lexer = this, this.options.pedantic && (e = e.replace(X.tabCharGlobal, " ").replace(X.spaceLine, ""));
|
|
2926
|
+
let r = Infinity;
|
|
2927
|
+
for (; e;) {
|
|
2928
|
+
if (e.length < r) r = e.length;
|
|
2929
|
+
else {
|
|
2930
|
+
this.infiniteLoopError(e.charCodeAt(0));
|
|
2931
|
+
break;
|
|
2932
|
+
}
|
|
2933
|
+
let i;
|
|
2934
|
+
if (this.options.extensions?.block?.some((n) => (i = n.call({ lexer: this }, e, t)) ? (e = e.substring(i.raw.length), t.push(i), !0) : !1)) continue;
|
|
2935
|
+
if (i = this.tokenizer.space(e)) {
|
|
2936
|
+
e = e.substring(i.raw.length);
|
|
2937
|
+
let n = t.at(-1);
|
|
2938
|
+
i.raw.length === 1 && n !== void 0 ? n.raw += "\n" : t.push(i);
|
|
2939
|
+
continue;
|
|
2940
|
+
}
|
|
2941
|
+
if (i = this.tokenizer.code(e)) {
|
|
2942
|
+
e = e.substring(i.raw.length);
|
|
2943
|
+
let n = t.at(-1);
|
|
2944
|
+
n?.type === "paragraph" || n?.type === "text" ? (n.raw += (n.raw.endsWith("\n") ? "" : "\n") + i.raw, n.text += "\n" + i.text, this.inlineQueue.at(-1).src = n.text) : t.push(i);
|
|
2945
|
+
continue;
|
|
2946
|
+
}
|
|
2947
|
+
if (i = this.tokenizer.fences(e)) {
|
|
2948
|
+
e = e.substring(i.raw.length), t.push(i);
|
|
2949
|
+
continue;
|
|
2950
|
+
}
|
|
2951
|
+
if (i = this.tokenizer.heading(e)) {
|
|
2952
|
+
e = e.substring(i.raw.length), t.push(i);
|
|
2953
|
+
continue;
|
|
2954
|
+
}
|
|
2955
|
+
if (i = this.tokenizer.hr(e)) {
|
|
2956
|
+
e = e.substring(i.raw.length), t.push(i);
|
|
2957
|
+
continue;
|
|
2958
|
+
}
|
|
2959
|
+
if (i = this.tokenizer.blockquote(e)) {
|
|
2960
|
+
e = e.substring(i.raw.length), t.push(i);
|
|
2961
|
+
continue;
|
|
2962
|
+
}
|
|
2963
|
+
if (i = this.tokenizer.list(e)) {
|
|
2964
|
+
e = e.substring(i.raw.length), t.push(i);
|
|
2965
|
+
continue;
|
|
2966
|
+
}
|
|
2967
|
+
if (i = this.tokenizer.html(e)) {
|
|
2968
|
+
e = e.substring(i.raw.length), t.push(i);
|
|
2969
|
+
continue;
|
|
2970
|
+
}
|
|
2971
|
+
if (i = this.tokenizer.def(e)) {
|
|
2972
|
+
e = e.substring(i.raw.length);
|
|
2973
|
+
let n = t.at(-1);
|
|
2974
|
+
n?.type === "paragraph" || n?.type === "text" ? (n.raw += (n.raw.endsWith("\n") ? "" : "\n") + i.raw, n.text += "\n" + i.raw, this.inlineQueue.at(-1).src = n.text) : this.tokens.links[i.tag] || (this.tokens.links[i.tag] = {
|
|
2975
|
+
href: i.href,
|
|
2976
|
+
title: i.title
|
|
2977
|
+
}, t.push(i));
|
|
2978
|
+
continue;
|
|
2979
|
+
}
|
|
2980
|
+
if (i = this.tokenizer.table(e)) {
|
|
2981
|
+
e = e.substring(i.raw.length), t.push(i);
|
|
2982
|
+
continue;
|
|
2983
|
+
}
|
|
2984
|
+
if (i = this.tokenizer.lheading(e)) {
|
|
2985
|
+
e = e.substring(i.raw.length), t.push(i);
|
|
2986
|
+
continue;
|
|
2987
|
+
}
|
|
2988
|
+
let a = e;
|
|
2989
|
+
if (this.options.extensions?.startBlock) {
|
|
2990
|
+
let t = Infinity, n = e.slice(1), r;
|
|
2991
|
+
this.options.extensions.startBlock.forEach((e) => {
|
|
2992
|
+
r = e.call({ lexer: this }, n), typeof r == "number" && r >= 0 && (t = Math.min(t, r));
|
|
2993
|
+
}), t < Infinity && t >= 0 && (a = e.substring(0, t + 1));
|
|
2994
|
+
}
|
|
2995
|
+
if (this.state.top && (i = this.tokenizer.paragraph(a))) {
|
|
2996
|
+
let r = t.at(-1);
|
|
2997
|
+
n && r?.type === "paragraph" ? (r.raw += (r.raw.endsWith("\n") ? "" : "\n") + i.raw, r.text += "\n" + i.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = r.text) : t.push(i), n = a.length !== e.length, e = e.substring(i.raw.length);
|
|
2998
|
+
continue;
|
|
2999
|
+
}
|
|
3000
|
+
if (i = this.tokenizer.text(e)) {
|
|
3001
|
+
e = e.substring(i.raw.length);
|
|
3002
|
+
let n = t.at(-1);
|
|
3003
|
+
n?.type === "text" ? (n.raw += (n.raw.endsWith("\n") ? "" : "\n") + i.raw, n.text += "\n" + i.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = n.text) : t.push(i);
|
|
3004
|
+
continue;
|
|
3005
|
+
}
|
|
3006
|
+
if (e) {
|
|
3007
|
+
this.infiniteLoopError(e.charCodeAt(0));
|
|
3008
|
+
break;
|
|
3009
|
+
}
|
|
3010
|
+
}
|
|
3011
|
+
return this.state.top = !0, t;
|
|
3012
|
+
}
|
|
3013
|
+
inline(e, t = []) {
|
|
3014
|
+
return this.inlineQueue.push({
|
|
3015
|
+
src: e,
|
|
3016
|
+
tokens: t
|
|
3017
|
+
}), t;
|
|
3018
|
+
}
|
|
3019
|
+
inlineTokens(e, t = []) {
|
|
3020
|
+
this.tokenizer.lexer = this;
|
|
3021
|
+
let n = e, r = null;
|
|
3022
|
+
if (this.tokens.links) {
|
|
3023
|
+
let e = Object.keys(this.tokens.links);
|
|
3024
|
+
if (e.length > 0) for (; (r = this.tokenizer.rules.inline.reflinkSearch.exec(n)) !== null;) e.includes(r[0].slice(r[0].lastIndexOf("[") + 1, -1)) && (n = n.slice(0, r.index) + "[" + "a".repeat(r[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
|
|
3025
|
+
}
|
|
3026
|
+
for (; (r = this.tokenizer.rules.inline.anyPunctuation.exec(n)) !== null;) n = n.slice(0, r.index) + "++" + n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
|
3027
|
+
let i;
|
|
3028
|
+
for (; (r = this.tokenizer.rules.inline.blockSkip.exec(n)) !== null;) i = r[2] ? r[2].length : 0, n = n.slice(0, r.index + i) + "[" + "a".repeat(r[0].length - i - 2) + "]" + n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
3029
|
+
n = this.options.hooks?.emStrongMask?.call({ lexer: this }, n) ?? n;
|
|
3030
|
+
let a = !1, o = "", s = Infinity;
|
|
3031
|
+
for (; e;) {
|
|
3032
|
+
if (e.length < s) s = e.length;
|
|
3033
|
+
else {
|
|
3034
|
+
this.infiniteLoopError(e.charCodeAt(0));
|
|
3035
|
+
break;
|
|
3036
|
+
}
|
|
3037
|
+
a || (o = ""), a = !1;
|
|
3038
|
+
let r;
|
|
3039
|
+
if (this.options.extensions?.inline?.some((n) => (r = n.call({ lexer: this }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), !0) : !1)) continue;
|
|
3040
|
+
if (r = this.tokenizer.escape(e)) {
|
|
3041
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
3042
|
+
continue;
|
|
3043
|
+
}
|
|
3044
|
+
if (r = this.tokenizer.tag(e)) {
|
|
3045
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
3046
|
+
continue;
|
|
3047
|
+
}
|
|
3048
|
+
if (r = this.tokenizer.link(e)) {
|
|
3049
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
3050
|
+
continue;
|
|
3051
|
+
}
|
|
3052
|
+
if (r = this.tokenizer.reflink(e, this.tokens.links)) {
|
|
3053
|
+
e = e.substring(r.raw.length);
|
|
3054
|
+
let n = t.at(-1);
|
|
3055
|
+
r.type === "text" && n?.type === "text" ? (n.raw += r.raw, n.text += r.text) : t.push(r);
|
|
3056
|
+
continue;
|
|
3057
|
+
}
|
|
3058
|
+
if (r = this.tokenizer.emStrong(e, n, o)) {
|
|
3059
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
3060
|
+
continue;
|
|
3061
|
+
}
|
|
3062
|
+
if (r = this.tokenizer.codespan(e)) {
|
|
3063
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
3064
|
+
continue;
|
|
3065
|
+
}
|
|
3066
|
+
if (r = this.tokenizer.br(e)) {
|
|
3067
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
3068
|
+
continue;
|
|
3069
|
+
}
|
|
3070
|
+
if (r = this.tokenizer.del(e, n, o)) {
|
|
3071
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
3072
|
+
continue;
|
|
3073
|
+
}
|
|
3074
|
+
if (r = this.tokenizer.autolink(e)) {
|
|
3075
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
3076
|
+
continue;
|
|
3077
|
+
}
|
|
3078
|
+
if (!this.state.inLink && (r = this.tokenizer.url(e))) {
|
|
3079
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
3080
|
+
continue;
|
|
3081
|
+
}
|
|
3082
|
+
let i = e;
|
|
3083
|
+
if (this.options.extensions?.startInline) {
|
|
3084
|
+
let t = Infinity, n = e.slice(1), r;
|
|
3085
|
+
this.options.extensions.startInline.forEach((e) => {
|
|
3086
|
+
r = e.call({ lexer: this }, n), typeof r == "number" && r >= 0 && (t = Math.min(t, r));
|
|
3087
|
+
}), t < Infinity && t >= 0 && (i = e.substring(0, t + 1));
|
|
3088
|
+
}
|
|
3089
|
+
if (r = this.tokenizer.inlineText(i)) {
|
|
3090
|
+
e = e.substring(r.raw.length), r.raw.slice(-1) !== "_" && (o = r.raw.slice(-1)), a = !0;
|
|
3091
|
+
let n = t.at(-1);
|
|
3092
|
+
n?.type === "text" ? (n.raw += r.raw, n.text += r.text) : t.push(r);
|
|
3093
|
+
continue;
|
|
3094
|
+
}
|
|
3095
|
+
if (e) {
|
|
3096
|
+
this.infiniteLoopError(e.charCodeAt(0));
|
|
3097
|
+
break;
|
|
3098
|
+
}
|
|
3099
|
+
}
|
|
3100
|
+
return t;
|
|
3101
|
+
}
|
|
3102
|
+
infiniteLoopError(e) {
|
|
3103
|
+
let t = "Infinite loop on byte: " + e;
|
|
3104
|
+
if (this.options.silent) console.error(t);
|
|
3105
|
+
else throw Error(t);
|
|
3106
|
+
}
|
|
3107
|
+
}, oa = class {
|
|
3108
|
+
options;
|
|
3109
|
+
parser;
|
|
3110
|
+
constructor(e) {
|
|
3111
|
+
this.options = e || Rr;
|
|
3112
|
+
}
|
|
3113
|
+
space(e) {
|
|
3114
|
+
return "";
|
|
3115
|
+
}
|
|
3116
|
+
code({ text: e, lang: t, escaped: n }) {
|
|
3117
|
+
let r = (t || "").match(X.notSpaceStart)?.[0], i = e.replace(X.endingNewline, "") + "\n";
|
|
3118
|
+
return r ? "<pre><code class=\"language-" + Xi(r) + "\">" + (n ? i : Xi(i, !0)) + "</code></pre>\n" : "<pre><code>" + (n ? i : Xi(i, !0)) + "</code></pre>\n";
|
|
3119
|
+
}
|
|
3120
|
+
blockquote({ tokens: e }) {
|
|
3121
|
+
return `<blockquote>
|
|
3122
|
+
${this.parser.parse(e)}</blockquote>
|
|
3123
|
+
`;
|
|
3124
|
+
}
|
|
3125
|
+
html({ text: e }) {
|
|
3126
|
+
return e;
|
|
3127
|
+
}
|
|
3128
|
+
def(e) {
|
|
3129
|
+
return "";
|
|
3130
|
+
}
|
|
3131
|
+
heading({ tokens: e, depth: t }) {
|
|
3132
|
+
return `<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
3133
|
+
`;
|
|
3134
|
+
}
|
|
3135
|
+
hr(e) {
|
|
3136
|
+
return "<hr>\n";
|
|
3137
|
+
}
|
|
3138
|
+
list(e) {
|
|
3139
|
+
let t = e.ordered, n = e.start, r = "";
|
|
3140
|
+
for (let t = 0; t < e.items.length; t++) {
|
|
3141
|
+
let n = e.items[t];
|
|
3142
|
+
r += this.listitem(n);
|
|
3143
|
+
}
|
|
3144
|
+
let i = t ? "ol" : "ul", a = t && n !== 1 ? " start=\"" + n + "\"" : "";
|
|
3145
|
+
return "<" + i + a + ">\n" + r + "</" + i + ">\n";
|
|
3146
|
+
}
|
|
3147
|
+
listitem(e) {
|
|
3148
|
+
return `<li>${this.parser.parse(e.tokens)}</li>
|
|
3149
|
+
`;
|
|
3150
|
+
}
|
|
3151
|
+
checkbox({ checked: e }) {
|
|
3152
|
+
return "<input " + (e ? "checked=\"\" " : "") + "disabled=\"\" type=\"checkbox\"> ";
|
|
3153
|
+
}
|
|
3154
|
+
paragraph({ tokens: e }) {
|
|
3155
|
+
return `<p>${this.parser.parseInline(e)}</p>
|
|
3156
|
+
`;
|
|
3157
|
+
}
|
|
3158
|
+
table(e) {
|
|
3159
|
+
let t = "", n = "";
|
|
3160
|
+
for (let t = 0; t < e.header.length; t++) n += this.tablecell(e.header[t]);
|
|
3161
|
+
t += this.tablerow({ text: n });
|
|
3162
|
+
let r = "";
|
|
3163
|
+
for (let t = 0; t < e.rows.length; t++) {
|
|
3164
|
+
let i = e.rows[t];
|
|
3165
|
+
n = "";
|
|
3166
|
+
for (let e = 0; e < i.length; e++) n += this.tablecell(i[e]);
|
|
3167
|
+
r += this.tablerow({ text: n });
|
|
3168
|
+
}
|
|
3169
|
+
return r &&= `<tbody>${r}</tbody>`, "<table>\n<thead>\n" + t + "</thead>\n" + r + "</table>\n";
|
|
3170
|
+
}
|
|
3171
|
+
tablerow({ text: e }) {
|
|
3172
|
+
return `<tr>
|
|
3173
|
+
${e}</tr>
|
|
3174
|
+
`;
|
|
3175
|
+
}
|
|
3176
|
+
tablecell(e) {
|
|
3177
|
+
let t = this.parser.parseInline(e.tokens), n = e.header ? "th" : "td";
|
|
3178
|
+
return (e.align ? `<${n} align="${e.align}">` : `<${n}>`) + t + `</${n}>
|
|
3179
|
+
`;
|
|
3180
|
+
}
|
|
3181
|
+
strong({ tokens: e }) {
|
|
3182
|
+
return `<strong>${this.parser.parseInline(e)}</strong>`;
|
|
3183
|
+
}
|
|
3184
|
+
em({ tokens: e }) {
|
|
3185
|
+
return `<em>${this.parser.parseInline(e)}</em>`;
|
|
3186
|
+
}
|
|
3187
|
+
codespan({ text: e }) {
|
|
3188
|
+
return `<code>${Xi(e, !0)}</code>`;
|
|
3189
|
+
}
|
|
3190
|
+
br(e) {
|
|
3191
|
+
return "<br>";
|
|
3192
|
+
}
|
|
3193
|
+
del({ tokens: e }) {
|
|
3194
|
+
return `<del>${this.parser.parseInline(e)}</del>`;
|
|
3195
|
+
}
|
|
3196
|
+
link({ href: e, title: t, tokens: n }) {
|
|
3197
|
+
let r = this.parser.parseInline(n), i = Zi(e);
|
|
3198
|
+
if (i === null) return r;
|
|
3199
|
+
e = i;
|
|
3200
|
+
let a = "<a href=\"" + e + "\"";
|
|
3201
|
+
return t && (a += " title=\"" + Xi(t) + "\""), a += ">" + r + "</a>", a;
|
|
3202
|
+
}
|
|
3203
|
+
image({ href: e, title: t, text: n, tokens: r }) {
|
|
3204
|
+
r && (n = this.parser.parseInline(r, this.parser.textRenderer));
|
|
3205
|
+
let i = Zi(e);
|
|
3206
|
+
if (i === null) return Xi(n);
|
|
3207
|
+
e = i;
|
|
3208
|
+
let a = `<img src="${e}" alt="${Xi(n)}"`;
|
|
3209
|
+
return t && (a += ` title="${Xi(t)}"`), a += ">", a;
|
|
3210
|
+
}
|
|
3211
|
+
text(e) {
|
|
3212
|
+
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : Xi(e.text);
|
|
3213
|
+
}
|
|
3214
|
+
}, sa = class {
|
|
3215
|
+
strong({ text: e }) {
|
|
3216
|
+
return e;
|
|
3217
|
+
}
|
|
3218
|
+
em({ text: e }) {
|
|
3219
|
+
return e;
|
|
3220
|
+
}
|
|
3221
|
+
codespan({ text: e }) {
|
|
3222
|
+
return e;
|
|
3223
|
+
}
|
|
3224
|
+
del({ text: e }) {
|
|
3225
|
+
return e;
|
|
3226
|
+
}
|
|
3227
|
+
html({ text: e }) {
|
|
3228
|
+
return e;
|
|
3229
|
+
}
|
|
3230
|
+
text({ text: e }) {
|
|
3231
|
+
return e;
|
|
3232
|
+
}
|
|
3233
|
+
link({ text: e }) {
|
|
3234
|
+
return "" + e;
|
|
3235
|
+
}
|
|
3236
|
+
image({ text: e }) {
|
|
3237
|
+
return "" + e;
|
|
3238
|
+
}
|
|
3239
|
+
br() {
|
|
3240
|
+
return "";
|
|
3241
|
+
}
|
|
3242
|
+
checkbox({ raw: e }) {
|
|
3243
|
+
return e;
|
|
3244
|
+
}
|
|
3245
|
+
}, Q = class e {
|
|
3246
|
+
options;
|
|
3247
|
+
renderer;
|
|
3248
|
+
textRenderer;
|
|
3249
|
+
constructor(e) {
|
|
3250
|
+
this.options = e || Rr, this.options.renderer = this.options.renderer || new oa(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new sa();
|
|
3251
|
+
}
|
|
3252
|
+
static parse(t, n) {
|
|
3253
|
+
return new e(n).parse(t);
|
|
3254
|
+
}
|
|
3255
|
+
static parseInline(t, n) {
|
|
3256
|
+
return new e(n).parseInline(t);
|
|
3257
|
+
}
|
|
3258
|
+
parse(e) {
|
|
3259
|
+
this.renderer.parser = this;
|
|
3260
|
+
let t = "";
|
|
3261
|
+
for (let n = 0; n < e.length; n++) {
|
|
3262
|
+
let r = e[n];
|
|
3263
|
+
if (this.options.extensions?.renderers?.[r.type]) {
|
|
3264
|
+
let e = r, n = this.options.extensions.renderers[e.type].call({ parser: this }, e);
|
|
3265
|
+
if (n !== !1 || ![
|
|
3266
|
+
"space",
|
|
3267
|
+
"hr",
|
|
3268
|
+
"heading",
|
|
3269
|
+
"code",
|
|
3270
|
+
"table",
|
|
3271
|
+
"blockquote",
|
|
3272
|
+
"list",
|
|
3273
|
+
"html",
|
|
3274
|
+
"def",
|
|
3275
|
+
"paragraph",
|
|
3276
|
+
"text"
|
|
3277
|
+
].includes(e.type)) {
|
|
3278
|
+
t += n || "";
|
|
3279
|
+
continue;
|
|
3280
|
+
}
|
|
3281
|
+
}
|
|
3282
|
+
let i = r;
|
|
3283
|
+
switch (i.type) {
|
|
3284
|
+
case "space":
|
|
3285
|
+
t += this.renderer.space(i);
|
|
3286
|
+
break;
|
|
3287
|
+
case "hr":
|
|
3288
|
+
t += this.renderer.hr(i);
|
|
3289
|
+
break;
|
|
3290
|
+
case "heading":
|
|
3291
|
+
t += this.renderer.heading(i);
|
|
3292
|
+
break;
|
|
3293
|
+
case "code":
|
|
3294
|
+
t += this.renderer.code(i);
|
|
3295
|
+
break;
|
|
3296
|
+
case "table":
|
|
3297
|
+
t += this.renderer.table(i);
|
|
3298
|
+
break;
|
|
3299
|
+
case "blockquote":
|
|
3300
|
+
t += this.renderer.blockquote(i);
|
|
3301
|
+
break;
|
|
3302
|
+
case "list":
|
|
3303
|
+
t += this.renderer.list(i);
|
|
3304
|
+
break;
|
|
3305
|
+
case "checkbox":
|
|
3306
|
+
t += this.renderer.checkbox(i);
|
|
3307
|
+
break;
|
|
3308
|
+
case "html":
|
|
3309
|
+
t += this.renderer.html(i);
|
|
3310
|
+
break;
|
|
3311
|
+
case "def":
|
|
3312
|
+
t += this.renderer.def(i);
|
|
3313
|
+
break;
|
|
3314
|
+
case "paragraph":
|
|
3315
|
+
t += this.renderer.paragraph(i);
|
|
3316
|
+
break;
|
|
3317
|
+
case "text":
|
|
3318
|
+
t += this.renderer.text(i);
|
|
3319
|
+
break;
|
|
3320
|
+
default: {
|
|
3321
|
+
let e = "Token with \"" + i.type + "\" type was not found.";
|
|
3322
|
+
if (this.options.silent) return console.error(e), "";
|
|
3323
|
+
throw Error(e);
|
|
3324
|
+
}
|
|
3325
|
+
}
|
|
3326
|
+
}
|
|
3327
|
+
return t;
|
|
3328
|
+
}
|
|
3329
|
+
parseInline(e, t = this.renderer) {
|
|
3330
|
+
this.renderer.parser = this;
|
|
3331
|
+
let n = "";
|
|
3332
|
+
for (let r = 0; r < e.length; r++) {
|
|
3333
|
+
let i = e[r];
|
|
3334
|
+
if (this.options.extensions?.renderers?.[i.type]) {
|
|
3335
|
+
let e = this.options.extensions.renderers[i.type].call({ parser: this }, i);
|
|
3336
|
+
if (e !== !1 || ![
|
|
3337
|
+
"escape",
|
|
3338
|
+
"html",
|
|
3339
|
+
"link",
|
|
3340
|
+
"image",
|
|
3341
|
+
"strong",
|
|
3342
|
+
"em",
|
|
3343
|
+
"codespan",
|
|
3344
|
+
"br",
|
|
3345
|
+
"del",
|
|
3346
|
+
"text"
|
|
3347
|
+
].includes(i.type)) {
|
|
3348
|
+
n += e || "";
|
|
3349
|
+
continue;
|
|
3350
|
+
}
|
|
3351
|
+
}
|
|
3352
|
+
let a = i;
|
|
3353
|
+
switch (a.type) {
|
|
3354
|
+
case "escape":
|
|
3355
|
+
n += t.text(a);
|
|
3356
|
+
break;
|
|
3357
|
+
case "html":
|
|
3358
|
+
n += t.html(a);
|
|
3359
|
+
break;
|
|
3360
|
+
case "link":
|
|
3361
|
+
n += t.link(a);
|
|
3362
|
+
break;
|
|
3363
|
+
case "image":
|
|
3364
|
+
n += t.image(a);
|
|
3365
|
+
break;
|
|
3366
|
+
case "checkbox":
|
|
3367
|
+
n += t.checkbox(a);
|
|
3368
|
+
break;
|
|
3369
|
+
case "strong":
|
|
3370
|
+
n += t.strong(a);
|
|
3371
|
+
break;
|
|
3372
|
+
case "em":
|
|
3373
|
+
n += t.em(a);
|
|
3374
|
+
break;
|
|
3375
|
+
case "codespan":
|
|
3376
|
+
n += t.codespan(a);
|
|
3377
|
+
break;
|
|
3378
|
+
case "br":
|
|
3379
|
+
n += t.br(a);
|
|
3380
|
+
break;
|
|
3381
|
+
case "del":
|
|
3382
|
+
n += t.del(a);
|
|
3383
|
+
break;
|
|
3384
|
+
case "text":
|
|
3385
|
+
n += t.text(a);
|
|
3386
|
+
break;
|
|
3387
|
+
default: {
|
|
3388
|
+
let e = "Token with \"" + a.type + "\" type was not found.";
|
|
3389
|
+
if (this.options.silent) return console.error(e), "";
|
|
3390
|
+
throw Error(e);
|
|
3391
|
+
}
|
|
3392
|
+
}
|
|
3393
|
+
}
|
|
3394
|
+
return n;
|
|
3395
|
+
}
|
|
3396
|
+
}, ca = class {
|
|
3397
|
+
options;
|
|
3398
|
+
block;
|
|
3399
|
+
constructor(e) {
|
|
3400
|
+
this.options = e || Rr;
|
|
3401
|
+
}
|
|
3402
|
+
static passThroughHooks = new Set([
|
|
3403
|
+
"preprocess",
|
|
3404
|
+
"postprocess",
|
|
3405
|
+
"processAllTokens",
|
|
3406
|
+
"emStrongMask"
|
|
3407
|
+
]);
|
|
3408
|
+
static passThroughHooksRespectAsync = new Set([
|
|
3409
|
+
"preprocess",
|
|
3410
|
+
"postprocess",
|
|
3411
|
+
"processAllTokens"
|
|
3412
|
+
]);
|
|
3413
|
+
preprocess(e) {
|
|
3414
|
+
return e;
|
|
3415
|
+
}
|
|
3416
|
+
postprocess(e) {
|
|
3417
|
+
return e;
|
|
3418
|
+
}
|
|
3419
|
+
processAllTokens(e) {
|
|
3420
|
+
return e;
|
|
3421
|
+
}
|
|
3422
|
+
emStrongMask(e) {
|
|
3423
|
+
return e;
|
|
3424
|
+
}
|
|
3425
|
+
provideLexer(e = this.block) {
|
|
3426
|
+
return e ? Z.lex : Z.lexInline;
|
|
3427
|
+
}
|
|
3428
|
+
provideParser(e = this.block) {
|
|
3429
|
+
return e ? Q.parse : Q.parseInline;
|
|
3430
|
+
}
|
|
3431
|
+
}, la = class {
|
|
3432
|
+
defaults = Lr();
|
|
3433
|
+
options = this.setOptions;
|
|
3434
|
+
parse = this.parseMarkdown(!0);
|
|
3435
|
+
parseInline = this.parseMarkdown(!1);
|
|
3436
|
+
Parser = Q;
|
|
3437
|
+
Renderer = oa;
|
|
3438
|
+
TextRenderer = sa;
|
|
3439
|
+
Lexer = Z;
|
|
3440
|
+
Tokenizer = aa;
|
|
3441
|
+
Hooks = ca;
|
|
3442
|
+
constructor(...e) {
|
|
3443
|
+
this.use(...e);
|
|
3444
|
+
}
|
|
3445
|
+
walkTokens(e, t) {
|
|
3446
|
+
let n = [];
|
|
3447
|
+
for (let r of e) switch (n = n.concat(t.call(this, r)), r.type) {
|
|
3448
|
+
case "table": {
|
|
3449
|
+
let e = r;
|
|
3450
|
+
for (let r of e.header) n = n.concat(this.walkTokens(r.tokens, t));
|
|
3451
|
+
for (let r of e.rows) for (let e of r) n = n.concat(this.walkTokens(e.tokens, t));
|
|
3452
|
+
break;
|
|
3453
|
+
}
|
|
3454
|
+
case "list": {
|
|
3455
|
+
let e = r;
|
|
3456
|
+
n = n.concat(this.walkTokens(e.items, t));
|
|
3457
|
+
break;
|
|
3458
|
+
}
|
|
3459
|
+
default: {
|
|
3460
|
+
let e = r;
|
|
3461
|
+
this.defaults.extensions?.childTokens?.[e.type] ? this.defaults.extensions.childTokens[e.type].forEach((r) => {
|
|
3462
|
+
let i = e[r].flat(Infinity);
|
|
3463
|
+
n = n.concat(this.walkTokens(i, t));
|
|
3464
|
+
}) : e.tokens && (n = n.concat(this.walkTokens(e.tokens, t)));
|
|
3465
|
+
}
|
|
3466
|
+
}
|
|
3467
|
+
return n;
|
|
3468
|
+
}
|
|
3469
|
+
use(...e) {
|
|
3470
|
+
let t = this.defaults.extensions || {
|
|
3471
|
+
renderers: {},
|
|
3472
|
+
childTokens: {}
|
|
3473
|
+
};
|
|
3474
|
+
return e.forEach((e) => {
|
|
3475
|
+
let n = { ...e };
|
|
3476
|
+
if (n.async = this.defaults.async || n.async || !1, e.extensions && (e.extensions.forEach((e) => {
|
|
3477
|
+
if (!e.name) throw Error("extension name required");
|
|
3478
|
+
if ("renderer" in e) {
|
|
3479
|
+
let n = t.renderers[e.name];
|
|
3480
|
+
n ? t.renderers[e.name] = function(...t) {
|
|
3481
|
+
let r = e.renderer.apply(this, t);
|
|
3482
|
+
return r === !1 && (r = n.apply(this, t)), r;
|
|
3483
|
+
} : t.renderers[e.name] = e.renderer;
|
|
3484
|
+
}
|
|
3485
|
+
if ("tokenizer" in e) {
|
|
3486
|
+
if (!e.level || e.level !== "block" && e.level !== "inline") throw Error("extension level must be 'block' or 'inline'");
|
|
3487
|
+
let n = t[e.level];
|
|
3488
|
+
n ? n.unshift(e.tokenizer) : t[e.level] = [e.tokenizer], e.start && (e.level === "block" ? t.startBlock ? t.startBlock.push(e.start) : t.startBlock = [e.start] : e.level === "inline" && (t.startInline ? t.startInline.push(e.start) : t.startInline = [e.start]));
|
|
3489
|
+
}
|
|
3490
|
+
"childTokens" in e && e.childTokens && (t.childTokens[e.name] = e.childTokens);
|
|
3491
|
+
}), n.extensions = t), e.renderer) {
|
|
3492
|
+
let t = this.defaults.renderer || new oa(this.defaults);
|
|
3493
|
+
for (let n in e.renderer) {
|
|
3494
|
+
if (!(n in t)) throw Error(`renderer '${n}' does not exist`);
|
|
3495
|
+
if (["options", "parser"].includes(n)) continue;
|
|
3496
|
+
let r = n, i = e.renderer[r], a = t[r];
|
|
3497
|
+
t[r] = (...e) => {
|
|
3498
|
+
let n = i.apply(t, e);
|
|
3499
|
+
return n === !1 && (n = a.apply(t, e)), n || "";
|
|
3500
|
+
};
|
|
3501
|
+
}
|
|
3502
|
+
n.renderer = t;
|
|
3503
|
+
}
|
|
3504
|
+
if (e.tokenizer) {
|
|
3505
|
+
let t = this.defaults.tokenizer || new aa(this.defaults);
|
|
3506
|
+
for (let n in e.tokenizer) {
|
|
3507
|
+
if (!(n in t)) throw Error(`tokenizer '${n}' does not exist`);
|
|
3508
|
+
if ([
|
|
3509
|
+
"options",
|
|
3510
|
+
"rules",
|
|
3511
|
+
"lexer"
|
|
3512
|
+
].includes(n)) continue;
|
|
3513
|
+
let r = n, i = e.tokenizer[r], a = t[r];
|
|
3514
|
+
t[r] = (...e) => {
|
|
3515
|
+
let n = i.apply(t, e);
|
|
3516
|
+
return n === !1 && (n = a.apply(t, e)), n;
|
|
3517
|
+
};
|
|
3518
|
+
}
|
|
3519
|
+
n.tokenizer = t;
|
|
3520
|
+
}
|
|
3521
|
+
if (e.hooks) {
|
|
3522
|
+
let t = this.defaults.hooks || new ca();
|
|
3523
|
+
for (let n in e.hooks) {
|
|
3524
|
+
if (!(n in t)) throw Error(`hook '${n}' does not exist`);
|
|
3525
|
+
if (["options", "block"].includes(n)) continue;
|
|
3526
|
+
let r = n, i = e.hooks[r], a = t[r];
|
|
3527
|
+
ca.passThroughHooks.has(n) ? t[r] = (e) => {
|
|
3528
|
+
if (this.defaults.async && ca.passThroughHooksRespectAsync.has(n)) return (async () => {
|
|
3529
|
+
let n = await i.call(t, e);
|
|
3530
|
+
return a.call(t, n);
|
|
3531
|
+
})();
|
|
3532
|
+
let r = i.call(t, e);
|
|
3533
|
+
return a.call(t, r);
|
|
3534
|
+
} : t[r] = (...e) => {
|
|
3535
|
+
if (this.defaults.async) return (async () => {
|
|
3536
|
+
let n = await i.apply(t, e);
|
|
3537
|
+
return n === !1 && (n = await a.apply(t, e)), n;
|
|
3538
|
+
})();
|
|
3539
|
+
let n = i.apply(t, e);
|
|
3540
|
+
return n === !1 && (n = a.apply(t, e)), n;
|
|
3541
|
+
};
|
|
3542
|
+
}
|
|
3543
|
+
n.hooks = t;
|
|
3544
|
+
}
|
|
3545
|
+
if (e.walkTokens) {
|
|
3546
|
+
let t = this.defaults.walkTokens, r = e.walkTokens;
|
|
3547
|
+
n.walkTokens = function(e) {
|
|
3548
|
+
let n = [];
|
|
3549
|
+
return n.push(r.call(this, e)), t && (n = n.concat(t.call(this, e))), n;
|
|
3550
|
+
};
|
|
3551
|
+
}
|
|
3552
|
+
this.defaults = {
|
|
3553
|
+
...this.defaults,
|
|
3554
|
+
...n
|
|
3555
|
+
};
|
|
3556
|
+
}), this;
|
|
3557
|
+
}
|
|
3558
|
+
setOptions(e) {
|
|
3559
|
+
return this.defaults = {
|
|
3560
|
+
...this.defaults,
|
|
3561
|
+
...e
|
|
3562
|
+
}, this;
|
|
3563
|
+
}
|
|
3564
|
+
lexer(e, t) {
|
|
3565
|
+
return Z.lex(e, t ?? this.defaults);
|
|
3566
|
+
}
|
|
3567
|
+
parser(e, t) {
|
|
3568
|
+
return Q.parse(e, t ?? this.defaults);
|
|
3569
|
+
}
|
|
3570
|
+
parseMarkdown(e) {
|
|
3571
|
+
return (t, n) => {
|
|
3572
|
+
let r = { ...n }, i = {
|
|
3573
|
+
...this.defaults,
|
|
3574
|
+
...r
|
|
3575
|
+
}, a = this.onError(!!i.silent, !!i.async);
|
|
3576
|
+
if (this.defaults.async === !0 && r.async === !1) return a(/* @__PURE__ */ Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
|
|
3577
|
+
if (typeof t > "u" || t === null) return a(/* @__PURE__ */ Error("marked(): input parameter is undefined or null"));
|
|
3578
|
+
if (typeof t != "string") return a(/* @__PURE__ */ Error("marked(): input parameter is of type " + Object.prototype.toString.call(t) + ", string expected"));
|
|
3579
|
+
if (i.hooks && (i.hooks.options = i, i.hooks.block = e), i.async) return (async () => {
|
|
3580
|
+
let n = i.hooks ? await i.hooks.preprocess(t) : t, r = await (i.hooks ? await i.hooks.provideLexer(e) : e ? Z.lex : Z.lexInline)(n, i), a = i.hooks ? await i.hooks.processAllTokens(r) : r;
|
|
3581
|
+
i.walkTokens && await Promise.all(this.walkTokens(a, i.walkTokens));
|
|
3582
|
+
let o = await (i.hooks ? await i.hooks.provideParser(e) : e ? Q.parse : Q.parseInline)(a, i);
|
|
3583
|
+
return i.hooks ? await i.hooks.postprocess(o) : o;
|
|
3584
|
+
})().catch(a);
|
|
3585
|
+
try {
|
|
3586
|
+
i.hooks && (t = i.hooks.preprocess(t));
|
|
3587
|
+
let n = (i.hooks ? i.hooks.provideLexer(e) : e ? Z.lex : Z.lexInline)(t, i);
|
|
3588
|
+
i.hooks && (n = i.hooks.processAllTokens(n)), i.walkTokens && this.walkTokens(n, i.walkTokens);
|
|
3589
|
+
let r = (i.hooks ? i.hooks.provideParser(e) : e ? Q.parse : Q.parseInline)(n, i);
|
|
3590
|
+
return i.hooks && (r = i.hooks.postprocess(r)), r;
|
|
3591
|
+
} catch (e) {
|
|
3592
|
+
return a(e);
|
|
3593
|
+
}
|
|
3594
|
+
};
|
|
3595
|
+
}
|
|
3596
|
+
onError(e, t) {
|
|
3597
|
+
return (n) => {
|
|
3598
|
+
if (n.message += "\nPlease report this to https://github.com/markedjs/marked.", e) {
|
|
3599
|
+
let e = "<p>An error occurred:</p><pre>" + Xi(n.message + "", !0) + "</pre>";
|
|
3600
|
+
return t ? Promise.resolve(e) : e;
|
|
3601
|
+
}
|
|
3602
|
+
if (t) return Promise.reject(n);
|
|
3603
|
+
throw n;
|
|
3604
|
+
};
|
|
3605
|
+
}
|
|
3606
|
+
}, ua = new la();
|
|
3607
|
+
function $(e, t) {
|
|
3608
|
+
return ua.parse(e, t);
|
|
3609
|
+
}
|
|
3610
|
+
$.options = $.setOptions = function(e) {
|
|
3611
|
+
return ua.setOptions(e), $.defaults = ua.defaults, zr($.defaults), $;
|
|
3612
|
+
}, $.getDefaults = Lr, $.defaults = Rr, $.use = function(...e) {
|
|
3613
|
+
return ua.use(...e), $.defaults = ua.defaults, zr($.defaults), $;
|
|
3614
|
+
}, $.walkTokens = function(e, t) {
|
|
3615
|
+
return ua.walkTokens(e, t);
|
|
3616
|
+
}, $.parseInline = ua.parseInline, $.Parser = Q, $.parser = Q.parse, $.Renderer = oa, $.TextRenderer = sa, $.Lexer = Z, $.lexer = Z.lex, $.Tokenizer = aa, $.Hooks = ca, $.parse = $, $.options, $.setOptions, $.use, $.walkTokens, $.parseInline, Q.parse, Z.lex;
|
|
3617
|
+
//#endregion
|
|
3618
|
+
//#region src/utilities/parseMarkdown.tsx
|
|
3619
|
+
var da = {
|
|
3620
|
+
a: "text-blue-600 underline hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300",
|
|
3621
|
+
blockquote: "border-l-4 border-gray-300 dark:border-gray-700 pl-3 italic mb-2",
|
|
3622
|
+
code: "bg-gray-100 dark:bg-gray-800 dark:text-gray-200 rounded px-1 font-mono text-xs",
|
|
3623
|
+
em: "italic",
|
|
3624
|
+
h1: "text-2xl font-bold mb-2",
|
|
3625
|
+
h2: "text-xl font-bold mb-2",
|
|
3626
|
+
h3: "text-lg font-bold mb-2",
|
|
3627
|
+
h4: "font-bold mb-2",
|
|
3628
|
+
h5: "font-bold mb-2",
|
|
3629
|
+
h6: "font-bold mb-2",
|
|
3630
|
+
hr: "border-gray-300 dark:border-gray-700 mb-2",
|
|
3631
|
+
li: "",
|
|
3632
|
+
ol: "list-decimal pl-4 mb-2 last:mb-0",
|
|
3633
|
+
p: "mb-2 last:mb-0",
|
|
3634
|
+
pre: "bg-gray-100 dark:bg-gray-800 rounded p-2 mb-2 overflow-x-auto",
|
|
3635
|
+
strong: "font-bold",
|
|
3636
|
+
table: "border-collapse mb-2 w-full",
|
|
3637
|
+
tbody: "",
|
|
3638
|
+
td: "border border-gray-300 dark:border-gray-700 px-2 py-1",
|
|
3639
|
+
th: "border border-gray-300 dark:border-gray-700 px-2 py-1 font-bold",
|
|
3640
|
+
thead: "",
|
|
3641
|
+
tr: "",
|
|
3642
|
+
ul: "list-disc pl-4 mb-2 last:mb-0"
|
|
3643
|
+
}, fa = [
|
|
3644
|
+
"a",
|
|
3645
|
+
"blockquote",
|
|
3646
|
+
"code",
|
|
3647
|
+
"em",
|
|
3648
|
+
"h1",
|
|
3649
|
+
"h2",
|
|
3650
|
+
"h3",
|
|
3651
|
+
"h4",
|
|
3652
|
+
"h5",
|
|
3653
|
+
"h6",
|
|
3654
|
+
"hr",
|
|
3655
|
+
"li",
|
|
3656
|
+
"ol",
|
|
3657
|
+
"p",
|
|
3658
|
+
"pre",
|
|
3659
|
+
"strong",
|
|
3660
|
+
"table",
|
|
3661
|
+
"tbody",
|
|
3662
|
+
"td",
|
|
3663
|
+
"th",
|
|
3664
|
+
"thead",
|
|
3665
|
+
"tr",
|
|
3666
|
+
"ul"
|
|
3667
|
+
], pa = new la(), ma = (e, t) => {
|
|
3668
|
+
let n = {
|
|
3669
|
+
...da,
|
|
3670
|
+
...t
|
|
3671
|
+
}, r = pa.parse(e), i = Ir.sanitize(r, { ADD_ATTR: ["target"] }), a = document.createElement("div");
|
|
3672
|
+
a.innerHTML = i;
|
|
3673
|
+
for (let e of fa) {
|
|
3674
|
+
let t = n[e];
|
|
3675
|
+
t && a.querySelectorAll(e).forEach((e) => {
|
|
3676
|
+
e.classList.add(...t.split(" ").filter(Boolean));
|
|
3677
|
+
});
|
|
3678
|
+
}
|
|
3679
|
+
return a.querySelectorAll("a").forEach((e) => {
|
|
3680
|
+
e.setAttribute("target", "_blank"), e.setAttribute("rel", "noopener noreferrer");
|
|
3681
|
+
}), /* @__PURE__ */ B("div", { dangerouslySetInnerHTML: { __html: a.innerHTML } });
|
|
3682
|
+
}, ha = ({ children: e }) => {
|
|
3683
|
+
let t = P(null), n = e instanceof Promise, [r, i] = M(n ? null : e), [a, o] = M(n);
|
|
3684
|
+
return N(() => {
|
|
3685
|
+
if (!(e instanceof Promise)) {
|
|
3686
|
+
i(e), o(!1);
|
|
3687
|
+
return;
|
|
3688
|
+
}
|
|
3689
|
+
let t = !1;
|
|
3690
|
+
return e.then((e) => {
|
|
3691
|
+
t || (i(e), o(!1));
|
|
3692
|
+
}), () => {
|
|
3693
|
+
t = !0;
|
|
3694
|
+
};
|
|
3695
|
+
}, [e]), N(() => {
|
|
3696
|
+
let e = t.current;
|
|
3697
|
+
if (!(!e || !(r instanceof HTMLElement))) return e.appendChild(r), () => {
|
|
3698
|
+
e.contains(r) && e.removeChild(r);
|
|
3699
|
+
};
|
|
3700
|
+
}, [r]), a ? /* @__PURE__ */ B(En, {}) : r === null ? null : typeof r == "string" ? /* @__PURE__ */ B("div", {
|
|
3701
|
+
className: "hawkai-assistant__tool__text w-fit rounded-2xl rounded-bl-sm bg-gray-100 dark:bg-gray-800 px-3 py-2 text-sm text-gray-900 dark:text-gray-100",
|
|
3702
|
+
children: ma(r)
|
|
3703
|
+
}) : r instanceof HTMLElement ? /* @__PURE__ */ B("div", {
|
|
3704
|
+
ref: t,
|
|
3705
|
+
className: "hawkai-assistant__tool__element"
|
|
3706
|
+
}) : /* @__PURE__ */ B(x, { children: r });
|
|
3707
|
+
}, ga = ({ turn: e, isLoading: t }) => {
|
|
3708
|
+
let n = e.role === "user", { tools: r } = Tt(), { sendMessage: i } = Cn();
|
|
3709
|
+
if (n && !e.text && !e.files?.length) return null;
|
|
3710
|
+
let a = { sendMessage: i }, o = e.role === "assistant" && e.toolUses ? e.toolUses.map((e) => {
|
|
3711
|
+
let t = r.find((t) => t.name === e.name);
|
|
3712
|
+
if (!t?.render) return null;
|
|
3713
|
+
let n = t.render({
|
|
3714
|
+
input: e.input,
|
|
3715
|
+
status: e.status
|
|
3716
|
+
}, a);
|
|
3717
|
+
return n === null ? null : {
|
|
3718
|
+
id: e.id,
|
|
3719
|
+
result: n
|
|
3720
|
+
};
|
|
3721
|
+
}).filter((e) => e !== null) : [], s = !!e.text;
|
|
3722
|
+
return /* @__PURE__ */ B("div", {
|
|
3723
|
+
className: sn({
|
|
3724
|
+
"hawkai-assistant__message flex flex-col max-w-[90%]": !0,
|
|
3725
|
+
"hawkai-assistant__message--user items-end self-end": n,
|
|
3726
|
+
"hawkai-assistant__message--assistant items-start": !n
|
|
3727
|
+
}),
|
|
3728
|
+
children: [
|
|
3729
|
+
n && e.files?.map((e, t) => e.mediaType.startsWith("image/") && e.data ? /* @__PURE__ */ B("img", {
|
|
3730
|
+
src: `data:${e.mediaType};base64,${e.data}`,
|
|
3731
|
+
alt: e.name,
|
|
3732
|
+
className: "hawkai-assistant__message__image my-1 max-w-full rounded-xl max-h-32 object-contain"
|
|
3733
|
+
}, t) : /* @__PURE__ */ B("div", {
|
|
3734
|
+
className: "hawkai-assistant__message__file my-1 flex items-center gap-1 rounded-lg bg-gray-100 dark:bg-gray-800 px-3 py-2 text-xs text-gray-700 dark:text-gray-300",
|
|
3735
|
+
children: /* @__PURE__ */ B("span", { children: e.name })
|
|
3736
|
+
}, t)),
|
|
3737
|
+
t && !n && !e.text ? /* @__PURE__ */ B(En, {}) : s && /* @__PURE__ */ B("div", {
|
|
3738
|
+
className: sn({
|
|
3739
|
+
"hawkai-assistant__message__bubble rounded-2xl px-3 py-2 text-sm": !0,
|
|
3740
|
+
"hawkai-assistant__message__bubble--user bg-primary text-white rounded-br-sm whitespace-pre-wrap": n,
|
|
3741
|
+
"hawkai-assistant__message__bubble--assistant bg-gray-100 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-bl-sm": !n
|
|
3742
|
+
}),
|
|
3743
|
+
children: n ? e.text : ma(e.text)
|
|
3744
|
+
}),
|
|
3745
|
+
o.map(({ id: e, result: t }) => /* @__PURE__ */ B("div", {
|
|
3746
|
+
className: "hawkai-assistant__message__tool-result my-2 last:mb-0 w-full",
|
|
3747
|
+
children: /* @__PURE__ */ B(ha, { children: t })
|
|
3748
|
+
}, e))
|
|
3749
|
+
]
|
|
3750
|
+
});
|
|
3751
|
+
}, _a = "Hi - how can I help you search for what you need?", va = () => {
|
|
3752
|
+
let { turns: e, isStreaming: t } = Tt(), n = P(null), r = window.HawkAI.Assistant.config.ui, i = e[e.length - 1], a = t && !(i?.role === "assistant" && !i?.text);
|
|
3753
|
+
return N(() => {
|
|
3754
|
+
n.current && (n.current.scrollTop = n.current.scrollHeight);
|
|
3755
|
+
}, [e, t]), /* @__PURE__ */ B("div", {
|
|
3756
|
+
ref: n,
|
|
3757
|
+
className: "hawkai-assistant__message-list flex flex-1 flex-col gap-2 overflow-y-auto p-3",
|
|
3758
|
+
children: [
|
|
3759
|
+
/* @__PURE__ */ B(ga, { turn: {
|
|
3760
|
+
role: "assistant",
|
|
3761
|
+
text: r?.initialMessage ?? _a
|
|
3762
|
+
} }),
|
|
3763
|
+
e.map((n, r) => {
|
|
3764
|
+
let i = r === e.length - 1;
|
|
3765
|
+
return /* @__PURE__ */ B(ga, {
|
|
3766
|
+
turn: n,
|
|
3767
|
+
isLoading: t && i && n.role === "assistant" && !n.text
|
|
3768
|
+
}, r);
|
|
3769
|
+
}),
|
|
3770
|
+
a && /* @__PURE__ */ B("div", {
|
|
3771
|
+
className: "hawkai-assistant__loading-wrapper flex flex-col items-start",
|
|
3772
|
+
children: /* @__PURE__ */ B(En, {})
|
|
3773
|
+
})
|
|
3774
|
+
]
|
|
3775
|
+
});
|
|
3776
|
+
}, ya = () => {
|
|
3777
|
+
let { turns: e } = Tt(), { sendMessage: t } = Cn(), n = window.HawkAI.Assistant.config.ui?.promptOptions;
|
|
3778
|
+
return !n?.length || e.length > 0 ? null : /* @__PURE__ */ B("div", {
|
|
3779
|
+
className: "hawkai-assistant__prompt-options flex flex-wrap gap-2 px-4 py-3",
|
|
3780
|
+
children: n.map((e) => /* @__PURE__ */ B("button", {
|
|
3781
|
+
type: "button",
|
|
3782
|
+
onClick: () => t(e),
|
|
3783
|
+
className: "hawkai-assistant__prompt-options__button cursor-pointer rounded-2xl rounded-br-sm bg-primary px-3 py-2 text-left text-sm text-white focus:outline-none hover:opacity-90",
|
|
3784
|
+
children: e
|
|
3785
|
+
}, e))
|
|
3786
|
+
});
|
|
3787
|
+
}, ba = ({ visible: e, onClose: t }) => {
|
|
3788
|
+
let [n, r] = M(!1), { clearChat: i, isStreaming: a } = Tt();
|
|
3789
|
+
if (!e) return null;
|
|
3790
|
+
let o = window.HawkAI.Assistant.config?.ui, s = o?.logoUrl, c = o?.heading || "Assistant", l = o?.position ?? "right", u = o?.allowFullScreen !== !1, d = o?.display === "drawer", f = !d, p = "size-5";
|
|
3791
|
+
return /* @__PURE__ */ B("div", {
|
|
3792
|
+
className: sn({
|
|
3793
|
+
"hawkai-assistant__window fixed z-50 flex flex-col bg-white dark:bg-gray-900": !0,
|
|
3794
|
+
"hawkai-assistant__window--fullscreen inset-0": n,
|
|
3795
|
+
"hawkai-assistant__window--window": f,
|
|
3796
|
+
"hawkai-assistant__window--drawer": d,
|
|
3797
|
+
"hawkai-assistant__window--right": l === "right",
|
|
3798
|
+
"hawkai-assistant__window--left": l === "left"
|
|
3799
|
+
}, f && !n && {
|
|
3800
|
+
"inset-x-2 top-4 bottom-24 rounded-xl shadow-2xl ring-1 ring-black/5 dark:ring-white/10": !0,
|
|
3801
|
+
"sm:inset-x-auto sm:top-auto sm:h-160 sm:w-120": !0,
|
|
3802
|
+
"sm:right-6": l === "right",
|
|
3803
|
+
"sm:left-6": l === "left"
|
|
3804
|
+
}, d && !n && {
|
|
3805
|
+
"inset-y-0 w-full shadow-2xl sm:w-120": !0,
|
|
3806
|
+
"right-0": l === "right",
|
|
3807
|
+
"left-0": l === "left"
|
|
3808
|
+
}),
|
|
3809
|
+
children: [/* @__PURE__ */ B("header", {
|
|
3810
|
+
className: sn({
|
|
3811
|
+
"hawkai-assistant__window__header flex items-center justify-between bg-primary px-4 py-3": !0,
|
|
3812
|
+
"hawkai-assistant__window__header--fullscreen": n,
|
|
3813
|
+
"rounded-t-xl": !n && !d
|
|
3814
|
+
}),
|
|
3815
|
+
children: [
|
|
3816
|
+
s && /* @__PURE__ */ B("img", {
|
|
3817
|
+
src: s,
|
|
3818
|
+
alt: "",
|
|
3819
|
+
className: "hawkai-assistant__window__logo max-h-10 max-w-25"
|
|
3820
|
+
}),
|
|
3821
|
+
/* @__PURE__ */ B("span", {
|
|
3822
|
+
className: "hawkai-assistant__window__title text-md font-semibold text-white",
|
|
3823
|
+
children: c
|
|
3824
|
+
}),
|
|
3825
|
+
/* @__PURE__ */ B("div", {
|
|
3826
|
+
className: "hawkai-assistant__window__actions flex items-center gap-2",
|
|
3827
|
+
children: [
|
|
3828
|
+
/* @__PURE__ */ B("button", {
|
|
3829
|
+
type: "button",
|
|
3830
|
+
onClick: i,
|
|
3831
|
+
disabled: a,
|
|
3832
|
+
className: "hawkai-assistant__window__clear-button cursor-pointer text-white/90 hover:text-white focus:outline-none disabled:cursor-not-allowed disabled:opacity-40",
|
|
3833
|
+
title: "New conversation",
|
|
3834
|
+
"aria-label": "New conversation",
|
|
3835
|
+
children: /* @__PURE__ */ B(mn, {
|
|
3836
|
+
className: p,
|
|
3837
|
+
"aria-hidden": !0
|
|
3838
|
+
})
|
|
3839
|
+
}),
|
|
3840
|
+
u && /* @__PURE__ */ B("button", {
|
|
3841
|
+
type: "button",
|
|
3842
|
+
onClick: () => r((e) => !e),
|
|
3843
|
+
className: sn({
|
|
3844
|
+
"hawkai-assistant__window__fullscreen-button cursor-pointer text-white/90 hover:text-white focus:outline-none": !0,
|
|
3845
|
+
"hawkai-assistant__window__fullscreen-button--active": n
|
|
3846
|
+
}),
|
|
3847
|
+
title: n ? "Exit fullscreen" : "Enter fullscreen",
|
|
3848
|
+
"aria-label": n ? "Exit fullscreen" : "Enter fullscreen",
|
|
3849
|
+
children: B(n ? un : fn, {
|
|
3850
|
+
className: p,
|
|
3851
|
+
"aria-hidden": !0
|
|
3852
|
+
})
|
|
3853
|
+
}),
|
|
3854
|
+
d && /* @__PURE__ */ B("button", {
|
|
3855
|
+
type: "button",
|
|
3856
|
+
onClick: t,
|
|
3857
|
+
className: "hawkai-assistant__window__close-button cursor-pointer text-white/90 hover:text-white focus:outline-none",
|
|
3858
|
+
title: "Close",
|
|
3859
|
+
"aria-label": "Close",
|
|
3860
|
+
children: /* @__PURE__ */ B(gn, {
|
|
3861
|
+
className: p,
|
|
3862
|
+
"aria-hidden": !0
|
|
3863
|
+
})
|
|
3864
|
+
})
|
|
3865
|
+
]
|
|
3866
|
+
})
|
|
3867
|
+
]
|
|
3868
|
+
}), /* @__PURE__ */ B("div", {
|
|
3869
|
+
className: "hawkai-assistant__window__body flex flex-1 flex-col overflow-hidden",
|
|
3870
|
+
children: [
|
|
3871
|
+
/* @__PURE__ */ B(va, {}),
|
|
3872
|
+
/* @__PURE__ */ B(ya, {}),
|
|
3873
|
+
/* @__PURE__ */ B(Tn, {})
|
|
3874
|
+
]
|
|
3875
|
+
})]
|
|
3876
|
+
});
|
|
3877
|
+
}, xa = () => {
|
|
3878
|
+
let { turns: e, userClosed: t, setUserClosed: n, clearChat: r } = Tt(), [i, a] = M(() => (e.length > 0 || window.HawkAI.Assistant.config.ui?.open === !0) && !t), o = () => {
|
|
3879
|
+
a(!0), n(!1);
|
|
3880
|
+
}, s = () => {
|
|
3881
|
+
a(!1), n(!0);
|
|
3882
|
+
};
|
|
3883
|
+
return N(() => (k.toggle = (e) => {
|
|
3884
|
+
e ? o() : s();
|
|
3885
|
+
}, () => {
|
|
3886
|
+
k.toggle = void 0;
|
|
3887
|
+
}), []), N(() => (k.clearChat = r, () => {
|
|
3888
|
+
k.clearChat = void 0;
|
|
3889
|
+
}), [r]), /* @__PURE__ */ B(x, { children: [/* @__PURE__ */ B(cn, {
|
|
3890
|
+
isOpen: i,
|
|
3891
|
+
onClick: () => i ? s() : o()
|
|
3892
|
+
}), /* @__PURE__ */ B(ba, {
|
|
3893
|
+
visible: i,
|
|
3894
|
+
onClose: s
|
|
3895
|
+
})] });
|
|
3896
|
+
}, Sa = () => /* @__PURE__ */ B("div", {
|
|
3897
|
+
className: "hawkai-assistant",
|
|
3898
|
+
"data-theme": Dt(window.HawkAI.Assistant.config.ui?.theme),
|
|
3899
|
+
children: /* @__PURE__ */ B(wt, { children: /* @__PURE__ */ B(xa, {}) })
|
|
3900
|
+
}), Ca = "/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */\n@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;--color-blue-300:oklch(80.9% .105 251.813);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-600:oklch(54.6% .245 262.881);--color-blue-800:oklch(42.4% .199 265.638);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-gray-900:oklch(21% .034 264.665);--color-black:#000;--color-white:#fff;--spacing:.25rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--leading-tight:1.25;--radius-sm:.25rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--animate-bounce:bounce 1s infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-primary:#333;--color-primary-hover:#444}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}::marker{color:currentColor}}@layer components;@layer utilities{.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.fixed{position:fixed}.static{position:static}.inset-0{inset:calc(var(--spacing) * 0)}.inset-x-2{inset-inline:calc(var(--spacing) * 2)}.inset-y-0{inset-block:calc(var(--spacing) * 0)}.top-4{top:calc(var(--spacing) * 4)}.right-0{right:calc(var(--spacing) * 0)}.right-6{right:calc(var(--spacing) * 6)}.bottom-6{bottom:calc(var(--spacing) * 6)}.bottom-24{bottom:calc(var(--spacing) * 24)}.left-0{left:calc(var(--spacing) * 0)}.left-6{left:calc(var(--spacing) * 6)}.z-50{z-index:50}.container{width:100%}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}.my-1{margin-block:calc(var(--spacing) * 1)}.my-2{margin-block:calc(var(--spacing) * 2)}.mt-auto{margin-top:auto}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.flex{display:flex}.hidden{display:none}.inline{display:inline}.inline-flex{display:inline-flex}.table{display:table}.size-5{width:calc(var(--spacing) * 5);height:calc(var(--spacing) * 5)}.size-6{width:calc(var(--spacing) * 6);height:calc(var(--spacing) * 6)}.h-3{height:calc(var(--spacing) * 3)}.h-5{height:calc(var(--spacing) * 5)}.h-10{height:calc(var(--spacing) * 10)}.h-14{height:calc(var(--spacing) * 14)}.h-20{height:calc(var(--spacing) * 20)}.h-21{height:calc(var(--spacing) * 21)}.max-h-10{max-height:calc(var(--spacing) * 10)}.max-h-32{max-height:calc(var(--spacing) * 32)}.w-3{width:calc(var(--spacing) * 3)}.w-5{width:calc(var(--spacing) * 5)}.w-10{width:calc(var(--spacing) * 10)}.w-14{width:calc(var(--spacing) * 14)}.w-32{width:calc(var(--spacing) * 32)}.w-fit{width:fit-content}.w-full{width:100%}.max-w-25{max-width:calc(var(--spacing) * 25)}.max-w-32{max-width:calc(var(--spacing) * 32)}.max-w-\\[90\\%\\]{max-width:90%}.max-w-full{max-width:100%}.flex-1{flex:1}.shrink-0{flex-shrink:0}.border-collapse{border-collapse:collapse}.animate-bounce{animation:var(--animate-bounce)}.cursor-pointer{cursor:pointer}.resize-none{resize:none}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-1{gap:calc(var(--spacing) * 1)}.gap-2{gap:calc(var(--spacing) * 2)}.self-end{align-self:flex-end}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-t-xl{border-top-left-radius:var(--radius-xl);border-top-right-radius:var(--radius-xl)}.rounded-br-sm{border-bottom-right-radius:var(--radius-sm)}.rounded-bl-sm{border-bottom-left-radius:var(--radius-sm)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-l-4{border-left-style:var(--tw-border-style);border-left-width:4px}.border-solid{--tw-border-style:solid;border-style:solid}.border-gray-200{border-color:var(--color-gray-200)}.border-gray-300{border-color:var(--color-gray-300)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-primary{background-color:var(--color-primary)}.bg-white{background-color:var(--color-white)}.object-contain{object-fit:contain}.object-cover{object-fit:cover}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-3{padding-block:calc(var(--spacing) * 3)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-4{padding-left:calc(var(--spacing) * 4)}.text-left{text-align:left}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.whitespace-pre-wrap{white-space:pre-wrap}.text-blue-600{color:var(--color-blue-600)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-700{color:var(--color-gray-700)}.text-gray-900{color:var(--color-gray-900)}.text-primary{color:var(--color-primary)}.text-white{color:var(--color-white)}.text-white\\/90{color:#ffffffe6}@supports (color:color-mix(in lab, red, red)){.text-white\\/90{color:color-mix(in oklab, var(--color-white) 90%, transparent)}}.italic{font-style:italic}.underline{text-decoration-line:underline}.shadow-lg\\/30{--tw-shadow-alpha:30%;--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,oklab(0% 0 0/.3)), 0 4px 6px -4px var(--tw-shadow-color,oklab(0% 0 0/.3));box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-1{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-black\\/5{--tw-ring-color:#0000000d}@supports (color:color-mix(in lab, red, red)){.ring-black\\/5{--tw-ring-color:color-mix(in oklab, var(--color-black) 5%, transparent)}}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.last\\:mb-0:last-child{margin-bottom:calc(var(--spacing) * 0)}@media (hover:hover){.hover\\:bg-gray-100:hover{background-color:var(--color-gray-100)}.hover\\:bg-primary-hover:hover{background-color:var(--color-primary-hover)}.hover\\:text-blue-800:hover{color:var(--color-blue-800)}.hover\\:text-gray-700:hover{color:var(--color-gray-700)}.hover\\:text-white:hover{color:var(--color-white)}.hover\\:opacity-90:hover{opacity:.9}.hover\\:shadow-md:hover{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}}.focus\\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus\\:ring-primary:focus{--tw-ring-color:var(--color-primary)}.focus\\:outline-none:focus{--tw-outline-style:none;outline-style:none}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:opacity-40:disabled{opacity:.4}.disabled\\:opacity-50:disabled{opacity:.5}@media (hover:hover){.disabled\\:hover\\:bg-primary:disabled:hover{background-color:var(--color-primary)}.disabled\\:hover\\:bg-transparent:disabled:hover{background-color:#0000}}@media (width>=40rem){.sm\\:inset-x-auto{inset-inline:auto}.sm\\:top-auto{top:auto}.sm\\:right-6{right:calc(var(--spacing) * 6)}.sm\\:left-6{left:calc(var(--spacing) * 6)}.sm\\:h-160{height:calc(var(--spacing) * 160)}.sm\\:w-120{width:calc(var(--spacing) * 120)}}.dark\\:border-gray-700:where([data-theme=dark],[data-theme=dark] *){border-color:var(--color-gray-700)}.dark\\:bg-gray-800:where([data-theme=dark],[data-theme=dark] *){background-color:var(--color-gray-800)}.dark\\:bg-gray-900:where([data-theme=dark],[data-theme=dark] *){background-color:var(--color-gray-900)}.dark\\:text-blue-400:where([data-theme=dark],[data-theme=dark] *){color:var(--color-blue-400)}.dark\\:text-gray-100:where([data-theme=dark],[data-theme=dark] *){color:var(--color-gray-100)}.dark\\:text-gray-200:where([data-theme=dark],[data-theme=dark] *){color:var(--color-gray-200)}.dark\\:text-gray-300:where([data-theme=dark],[data-theme=dark] *){color:var(--color-gray-300)}.dark\\:text-gray-400:where([data-theme=dark],[data-theme=dark] *){color:var(--color-gray-400)}.dark\\:text-gray-500:where([data-theme=dark],[data-theme=dark] *){color:var(--color-gray-500)}.dark\\:ring-white\\/10:where([data-theme=dark],[data-theme=dark] *){--tw-ring-color:#ffffff1a}@supports (color:color-mix(in lab, red, red)){.dark\\:ring-white\\/10:where([data-theme=dark],[data-theme=dark] *){--tw-ring-color:color-mix(in oklab, var(--color-white) 10%, transparent)}}@media (hover:hover){.dark\\:hover\\:bg-gray-800:where([data-theme=dark],[data-theme=dark] *):hover{background-color:var(--color-gray-800)}.dark\\:hover\\:text-blue-300:where([data-theme=dark],[data-theme=dark] *):hover{color:var(--color-blue-300)}.dark\\:hover\\:text-gray-300:where([data-theme=dark],[data-theme=dark] *):hover{color:var(--color-gray-300)}}}@property --tw-border-style{syntax:\"*\";inherits:false;initial-value:solid}@property --tw-leading{syntax:\"*\";inherits:false}@property --tw-font-weight{syntax:\"*\";inherits:false}@property --tw-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:\"*\";inherits:false}@property --tw-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:\"*\";inherits:false}@property --tw-inset-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:\"*\";inherits:false}@property --tw-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:\"*\";inherits:false}@property --tw-inset-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:\"*\";inherits:false}@property --tw-ring-offset-width{syntax:\"<length>\";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:\"*\";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:\"*\";inherits:false}@property --tw-brightness{syntax:\"*\";inherits:false}@property --tw-contrast{syntax:\"*\";inherits:false}@property --tw-grayscale{syntax:\"*\";inherits:false}@property --tw-hue-rotate{syntax:\"*\";inherits:false}@property --tw-invert{syntax:\"*\";inherits:false}@property --tw-opacity{syntax:\"*\";inherits:false}@property --tw-saturate{syntax:\"*\";inherits:false}@property --tw-sepia{syntax:\"*\";inherits:false}@property --tw-drop-shadow{syntax:\"*\";inherits:false}@property --tw-drop-shadow-color{syntax:\"*\";inherits:false}@property --tw-drop-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:\"*\";inherits:false}@keyframes bounce{0%,to{animation-timing-function:cubic-bezier(.8,0,1,1);transform:translateY(-25%)}50%{animation-timing-function:cubic-bezier(0,0,.2,1);transform:none}}", wa = !1, Ta = (e) => {
|
|
3901
|
+
let t = [];
|
|
3902
|
+
if ((!e.apiUrl || typeof e.apiUrl != "string") && t.push("apiUrl"), (!e.agentId || typeof e.agentId != "string") && t.push("agentId"), t.length > 0) throw Error(`[HawkAI Assistant] invalid or missing configuration properties: ${t.join(", ")}`);
|
|
3903
|
+
}, Ea = () => {
|
|
3904
|
+
let e = new CSSStyleSheet();
|
|
3905
|
+
e.replaceSync(Ca.replace(/:root/gu, ":host"));
|
|
3906
|
+
let t = [];
|
|
3907
|
+
for (let n of Array.from(e.cssRules)) n instanceof CSSPropertyRule && n.initialValue && t.push(`${n.name}: ${n.initialValue}`);
|
|
3908
|
+
t.length > 0 && e.insertRule(`:host { ${t.join("; ")} }`);
|
|
3909
|
+
let n = window.HawkAI.Assistant.config.ui?.colors;
|
|
3910
|
+
return n?.primary && e.insertRule(`:host { --color-primary: ${n.primary.default}; --color-primary-hover: ${n.primary.hover}; }`, e.cssRules.length), e;
|
|
3911
|
+
}, Da = (e) => {
|
|
3912
|
+
if (Ta(e), wa) return;
|
|
3913
|
+
wa = !0, window.HawkAI.Assistant.config = e, Object.freeze(window.HawkAI.Assistant), it();
|
|
3914
|
+
let t = document.createElement("div");
|
|
3915
|
+
document.body.appendChild(t);
|
|
3916
|
+
let n = t.attachShadow({ mode: "open" }), r = [Ea()];
|
|
3917
|
+
if (e.ui?.styles) {
|
|
3918
|
+
let t = new CSSStyleSheet();
|
|
3919
|
+
t.replaceSync(e.ui.styles), r.push(t);
|
|
3920
|
+
}
|
|
3921
|
+
n.adoptedStyleSheets = r, _e(y(Sa, null), n), e.ui?.stylesheetUrl && fetch(e.ui.stylesheetUrl).then((e) => e.text()).then((e) => {
|
|
3922
|
+
let t = new CSSStyleSheet();
|
|
3923
|
+
t.replaceSync(e), n.adoptedStyleSheets = [...n.adoptedStyleSheets, t];
|
|
3924
|
+
});
|
|
3925
|
+
}, Oa = (e) => {
|
|
3926
|
+
k.setActorId?.(e);
|
|
3927
|
+
}, ka = (e) => {
|
|
3928
|
+
ut(e);
|
|
3929
|
+
}, Aa = (e) => {
|
|
3930
|
+
k.toggle?.(e);
|
|
3931
|
+
}, ja = async (e, t) => {
|
|
3932
|
+
k.toggle?.(!0), setTimeout(() => {
|
|
3933
|
+
k.sendMessage?.(e, t);
|
|
3934
|
+
}, 250);
|
|
3935
|
+
}, Ma = () => {
|
|
3936
|
+
k.clearChat?.();
|
|
3937
|
+
};
|
|
3938
|
+
window.HawkAI = window.HawkAI ?? {}, window.HawkAI.Assistant = {
|
|
3939
|
+
config: void 0,
|
|
3940
|
+
initialize: Da,
|
|
3941
|
+
setActorId: Oa,
|
|
3942
|
+
setContext: ka,
|
|
3943
|
+
toggle: Aa,
|
|
3944
|
+
sendMessage: ja,
|
|
3945
|
+
clearChat: Ma
|
|
3946
|
+
};
|
|
3947
|
+
//#endregion
|
|
3948
|
+
export { Ma as clearChat, Da as initialize, ja as sendMessage, Oa as setActorId, ka as setContext, Aa as toggle };
|