@asgard-js/react 0.0.9 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,23 +1,26 @@
1
- import { jsx as c, jsxs as m, Fragment as mt } from "react/jsx-runtime";
2
- import * as g from "react";
3
- import { createContext as F, useMemo as v, useContext as W, useRef as R, useEffect as C, useState as w, useCallback as b, useLayoutEffect as rt, memo as ft } from "react";
4
- import { AsgardServiceClient as bt, EventType as V, Conversation as pt, Channel as Ct, MessageTemplateType as O } from "@asgard-js/core";
5
- function X(n) {
6
- return n !== null && typeof n == "object" && !Array.isArray(n);
7
- }
8
- function st(n, t) {
9
- const o = { ...n };
10
- if (!t) return o;
11
- for (const [e, r] of Object.entries(t)) {
12
- if (!X(r)) {
13
- o[e] = r;
1
+ var Lr = Object.defineProperty;
2
+ var Ir = (o, e, t) => e in o ? Lr(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
+ var S = (o, e, t) => Ir(o, typeof e != "symbol" ? e + "" : e, t);
4
+ import { jsx as d, jsxs as R, Fragment as Nr } from "react/jsx-runtime";
5
+ import * as L from "react";
6
+ import { createContext as Dt, useMemo as $, useContext as Pt, useRef as ce, useEffect as O, useState as V, useCallback as I, useLayoutEffect as qn, memo as Mr } from "react";
7
+ import { AsgardServiceClient as Or, EventType as Ie, Conversation as Dr, Channel as Pr, MessageTemplateType as He } from "@asgard-js/core";
8
+ function kn(o) {
9
+ return o !== null && typeof o == "object" && !Array.isArray(o);
10
+ }
11
+ function Gn(o, e) {
12
+ const t = { ...o };
13
+ if (!e) return t;
14
+ for (const [n, s] of Object.entries(e)) {
15
+ if (!kn(s)) {
16
+ t[n] = s;
14
17
  continue;
15
18
  }
16
- o[e] = st(X(o[e]) ? o[e] : {}, r);
19
+ t[n] = Gn(kn(t[n]) ? t[n] : {}, s);
17
20
  }
18
- return o;
21
+ return t;
19
22
  }
20
- const ct = {
23
+ const Wn = {
21
24
  chatbot: {
22
25
  width: "375px",
23
26
  height: "640px",
@@ -34,231 +37,231 @@ const ct = {
34
37
  color: "var(--asg-color-text)",
35
38
  backgroundColor: "var(--asg-color-primary)"
36
39
  }
37
- }, it = F(
38
- ct
40
+ }, Zn = Dt(
41
+ Wn
39
42
  );
40
- function vt(n) {
41
- const { children: t, theme: o = {} } = n, e = v(
42
- () => st(ct, o),
43
- [o]
43
+ function zr(o) {
44
+ const { children: e, theme: t = {} } = o, n = $(
45
+ () => Gn(Wn, t),
46
+ [t]
44
47
  );
45
- return /* @__PURE__ */ c(it.Provider, { value: e, children: t });
48
+ return /* @__PURE__ */ d(Zn.Provider, { value: n, children: e });
46
49
  }
47
- function L() {
48
- return W(it);
50
+ function ge() {
51
+ return Pt(Zn);
49
52
  }
50
- function xt(n) {
51
- const { config: t } = n, { onRunInit: o, onProcess: e, onMessage: r, onRunDone: s, onRunError: a } = t, i = R(null);
52
- return i.current || (i.current = new bt(t)), C(() => () => {
53
+ function $r(o) {
54
+ const { config: e } = o, { onRunInit: t, onProcess: n, onMessage: s, onRunDone: r, onRunError: a } = e, i = ce(null);
55
+ return i.current || (i.current = new Or(e)), O(() => () => {
53
56
  i.current && (i.current.close(), i.current = null);
54
- }, []), C(() => {
55
- !i.current || !o || i.current.on(V.INIT, o);
56
- }, [o]), C(() => {
57
- !i.current || !e || i.current.on(V.PROCESS, e);
58
- }, [e]), C(() => {
59
- !i.current || !r || i.current.on(V.MESSAGE, r);
60
- }, [r]), C(() => {
61
- !i.current || !s || i.current.on(V.DONE, s);
62
- }, [s]), C(() => {
63
- !i.current || !a || i.current.on(V.ERROR, a);
57
+ }, []), O(() => {
58
+ !i.current || !t || i.current.on(Ie.INIT, t);
59
+ }, [t]), O(() => {
60
+ !i.current || !n || i.current.on(Ie.PROCESS, n);
61
+ }, [n]), O(() => {
62
+ !i.current || !s || i.current.on(Ie.MESSAGE, s);
63
+ }, [s]), O(() => {
64
+ !i.current || !r || i.current.on(Ie.DONE, r);
65
+ }, [r]), O(() => {
66
+ !i.current || !a || i.current.on(Ie.ERROR, a);
64
67
  }, [a]), i.current;
65
68
  }
66
- function wt(n) {
67
- const { client: t, customChannelId: o, customMessageId: e, initMessages: r } = n;
68
- if (!t)
69
+ function Br(o) {
70
+ const { client: e, customChannelId: t, customMessageId: n, initMessages: s } = o;
71
+ if (!e)
69
72
  throw new Error("Client instance is required");
70
- if (!o)
73
+ if (!t)
71
74
  throw new Error("Custom channel id is required");
72
- const [s, a] = w(null), [i, u] = w(!0), [d, h] = w(!1), [_, l] = w(!1), [p, f] = w(null), x = b(async () => {
73
- const k = new pt({
75
+ const [r, a] = V(null), [i, p] = V(!0), [c, u] = V(!1), [m, f] = V(!1), [g, x] = V(null), k = I(async () => {
76
+ const D = new Dr({
74
77
  messages: new Map(
75
- r == null ? void 0 : r.map((H) => [H.messageId, H])
78
+ s == null ? void 0 : s.map((E) => [E.messageId, E])
76
79
  )
77
80
  });
78
- h(!0), l(!0), f(k);
79
- const gt = await Ct.reset(
81
+ u(!0), f(!0), x(D);
82
+ const K = await Pr.reset(
80
83
  {
81
- client: t,
82
- customChannelId: o,
83
- customMessageId: e,
84
- conversation: k,
85
- statesObserver: (H) => {
86
- l(H.isConnecting), f(H.conversation);
84
+ client: e,
85
+ customChannelId: t,
86
+ customMessageId: n,
87
+ conversation: D,
88
+ statesObserver: (E) => {
89
+ f(E.isConnecting), x(E.conversation);
87
90
  }
88
91
  },
89
92
  {
90
93
  onSseCompleted() {
91
- h(!1);
94
+ u(!1);
92
95
  },
93
96
  onSseError() {
94
- h(!1);
97
+ u(!1);
95
98
  }
96
99
  }
97
100
  );
98
- a(gt);
99
- }, [t, o, e, r]), N = b(() => {
100
- a((k) => (k == null || k.close(), null)), u(!1), h(!1), l(!1), f(null);
101
- }, []), K = b(
102
- (k) => s == null ? void 0 : s.sendMessage({ text: k }),
103
- [s]
101
+ a(K);
102
+ }, [e, t, n, s]), T = I(() => {
103
+ a((D) => (D == null || D.close(), null)), p(!1), u(!1), f(!1), x(null);
104
+ }, []), Y = I(
105
+ (D) => r == null ? void 0 : r.sendMessage(D),
106
+ [r]
104
107
  );
105
- return C(() => {
106
- !s && i && x();
107
- }, [s, i, x]), C(() => () => N(), [N]), v(
108
+ return O(() => {
109
+ !r && i && k();
110
+ }, [r, i, k]), O(() => () => T(), [T]), $(
108
111
  () => ({
109
112
  isOpen: i,
110
- isResetting: d,
111
- isConnecting: _,
112
- conversation: p,
113
- sendMessage: K,
114
- resetChannel: x,
115
- closeChannel: N
113
+ isResetting: c,
114
+ isConnecting: m,
115
+ conversation: g,
116
+ sendMessage: Y,
117
+ resetChannel: k,
118
+ closeChannel: T
116
119
  }),
117
120
  [
118
121
  i,
119
- d,
120
- _,
121
- p,
122
- K,
123
- x,
124
- N
122
+ c,
123
+ m,
124
+ g,
125
+ Y,
126
+ k,
127
+ T
125
128
  ]
126
129
  );
127
130
  }
128
- function yt(n, t) {
129
- const [o, e] = w(n);
130
- return C(() => {
131
- const r = window.setTimeout(() => {
132
- e(n);
133
- }, t ?? 300);
134
- return () => clearTimeout(r);
135
- }, [n, t]), o;
136
- }
137
- const q = typeof window < "u" ? rt : null;
138
- function Tt() {
131
+ function Hr(o, e) {
132
+ const [t, n] = V(o);
133
+ return O(() => {
134
+ const s = window.setTimeout(() => {
135
+ n(o);
136
+ }, e ?? 300);
137
+ return () => clearTimeout(s);
138
+ }, [o, e]), t;
139
+ }
140
+ const Ct = typeof window < "u" ? qn : null;
141
+ function Ur() {
139
142
  return window.visualViewport ? [window.visualViewport.width, window.visualViewport.height] : [window.innerWidth, window.innerHeight];
140
143
  }
141
- function Et() {
142
- const [n, t] = w(), o = b(() => {
143
- const e = Tt();
144
- t(
145
- (r) => r && r[0] === e[0] && r[1] === e[1] ? r : e
144
+ function Fr() {
145
+ const [o, e] = V(), t = I(() => {
146
+ const n = Ur();
147
+ e(
148
+ (s) => s && s[0] === n[0] && s[1] === n[1] ? s : n
146
149
  );
147
150
  }, []);
148
- return q == null || q(o, [o]), C(() => {
149
- var r;
150
- function e() {
151
- o(), setTimeout(o, 1e3);
151
+ return Ct == null || Ct(t, [t]), O(() => {
152
+ var s;
153
+ function n() {
154
+ t(), setTimeout(t, 1e3);
152
155
  }
153
- return window.addEventListener("resize", e), window.addEventListener("orientationchange", e), (r = window.visualViewport) == null || r.addEventListener("resize", e), () => {
154
- var s;
155
- window.removeEventListener("resize", e), window.removeEventListener("orientationchange", e), (s = window.visualViewport) == null || s.removeEventListener("resize", e);
156
+ return window.addEventListener("resize", n), window.addEventListener("orientationchange", n), (s = window.visualViewport) == null || s.addEventListener("resize", n), () => {
157
+ var r;
158
+ window.removeEventListener("resize", n), window.removeEventListener("orientationchange", n), (r = window.visualViewport) == null || r.removeEventListener("resize", n);
156
159
  };
157
- }, [o]), n;
158
- }
159
- function Y(n) {
160
- return ["INPUT", "TEXTAREA"].includes(n.tagName) && !["button", "submit", "checkbox", "file", "image"].includes(
161
- n.type
162
- ) || n.hasAttribute("contenteditable");
163
- }
164
- function Nt() {
165
- const [n, t] = w(!1);
166
- return C(() => {
167
- function o(r) {
168
- if (!r.target) return;
169
- const s = r.target;
170
- Y(s) && t(!0);
171
- }
172
- function e(r) {
173
- if (!r.target) return;
174
- const s = r.target;
175
- Y(s) && t(!1);
176
- }
177
- return document.addEventListener("focusin", o), document.addEventListener("focusout", e), () => {
178
- document.removeEventListener("focusin", o), document.removeEventListener("focusout", e);
160
+ }, [t]), o;
161
+ }
162
+ function wn(o) {
163
+ return ["INPUT", "TEXTAREA"].includes(o.tagName) && !["button", "submit", "checkbox", "file", "image"].includes(
164
+ o.type
165
+ ) || o.hasAttribute("contenteditable");
166
+ }
167
+ function qr() {
168
+ const [o, e] = V(!1);
169
+ return O(() => {
170
+ function t(s) {
171
+ if (!s.target) return;
172
+ const r = s.target;
173
+ wn(r) && e(!0);
174
+ }
175
+ function n(s) {
176
+ if (!s.target) return;
177
+ const r = s.target;
178
+ wn(r) && e(!1);
179
+ }
180
+ return document.addEventListener("focusin", t), document.addEventListener("focusout", n), () => {
181
+ document.removeEventListener("focusin", t), document.removeEventListener("focusout", n);
179
182
  };
180
- }, []), n;
183
+ }, []), o;
181
184
  }
182
- function kt() {
183
- C(() => {
184
- function n() {
185
+ function Gr() {
186
+ O(() => {
187
+ function o() {
185
188
  window.scrollTo(0, 0);
186
189
  }
187
- return window.addEventListener("scroll", n), () => {
188
- window.removeEventListener("scroll", n);
190
+ return window.addEventListener("scroll", o), () => {
191
+ window.removeEventListener("scroll", o);
189
192
  };
190
193
  }, []);
191
194
  }
192
- function at(n) {
193
- if (n.scrollHeight > n.offsetHeight)
194
- return n;
195
- const t = n.parentElement;
196
- if (t)
197
- return at(t);
198
- }
199
- function St(n) {
200
- C(() => {
201
- const t = n.current;
202
- if (!t) return;
203
- let o;
204
- function e(s) {
205
- s.touches.length === 1 && (o = s.touches[0]);
206
- }
207
- function r(s) {
208
- if (s.touches.length !== 1 || !o) return;
209
- const a = o.pageY - s.targetTouches[0].pageY, i = o.pageX - s.targetTouches[0].pageX;
195
+ function Vn(o) {
196
+ if (o.scrollHeight > o.offsetHeight)
197
+ return o;
198
+ const e = o.parentElement;
199
+ if (e)
200
+ return Vn(e);
201
+ }
202
+ function Wr(o) {
203
+ O(() => {
204
+ const e = o.current;
205
+ if (!e) return;
206
+ let t;
207
+ function n(r) {
208
+ r.touches.length === 1 && (t = r.touches[0]);
209
+ }
210
+ function s(r) {
211
+ if (r.touches.length !== 1 || !t) return;
212
+ const a = t.pageY - r.targetTouches[0].pageY, i = t.pageX - r.targetTouches[0].pageX;
210
213
  if (Math.abs(i) > Math.abs(a)) return;
211
- const u = s.target, d = at(u);
212
- if (!d) {
213
- s.preventDefault();
214
+ const p = r.target, c = Vn(p);
215
+ if (!c) {
216
+ r.preventDefault();
214
217
  return;
215
218
  }
216
- const h = a < 0, _ = d.scrollTop === 0;
217
- if (h && _) {
218
- s.preventDefault();
219
+ const u = a < 0, m = c.scrollTop === 0;
220
+ if (u && m) {
221
+ r.preventDefault();
219
222
  return;
220
223
  }
221
- const l = d.scrollTop === d.scrollHeight - d.clientHeight;
222
- if (!h && l) {
223
- s.preventDefault();
224
+ const f = c.scrollTop === c.scrollHeight - c.clientHeight;
225
+ if (!u && f) {
226
+ r.preventDefault();
224
227
  return;
225
228
  }
226
229
  }
227
- return t.addEventListener("touchstart", e), t.addEventListener("touchmove", r), () => {
228
- t.removeEventListener("touchstart", e), t.removeEventListener("touchmove", r);
230
+ return e.addEventListener("touchstart", n), e.addEventListener("touchmove", s), () => {
231
+ e.removeEventListener("touchstart", n), e.removeEventListener("touchmove", s);
229
232
  };
230
- }, [n]);
233
+ }, [o]);
231
234
  }
232
- const D = typeof window < "u" ? rt : null;
233
- function Rt(n) {
234
- const t = b(() => {
235
- const o = window.innerHeight * 0.01;
236
- n.current && n.current.style.setProperty("--vh", `${o}px`);
237
- }, [n]);
238
- D == null || D(t, [t]), C(() => {
239
- function o() {
240
- t(), setTimeout(t, 1e3);
235
+ const Et = typeof window < "u" ? qn : null;
236
+ function Zr(o) {
237
+ const e = I(() => {
238
+ const t = window.innerHeight * 0.01;
239
+ o.current && o.current.style.setProperty("--vh", `${t}px`);
240
+ }, [o]);
241
+ Et == null || Et(e, [e]), O(() => {
242
+ function t() {
243
+ e(), setTimeout(e, 1e3);
241
244
  }
242
- return t(), window.addEventListener("resize", o), () => {
243
- window.removeEventListener("resize", o);
245
+ return e(), window.addEventListener("resize", t), () => {
246
+ window.removeEventListener("resize", t);
244
247
  };
245
- }, [t]);
248
+ }, [e]);
246
249
  }
247
- function Lt(n) {
248
- const { ref: t, onResize: o } = n;
249
- C(() => {
250
- const e = new ResizeObserver((r) => {
251
- for (const s of r) {
252
- const { width: a, height: i } = s.contentRect;
253
- o(a, i);
250
+ function Vr(o) {
251
+ const { ref: e, onResize: t } = o;
252
+ O(() => {
253
+ const n = new ResizeObserver((s) => {
254
+ for (const r of s) {
255
+ const { width: a, height: i } = r.contentRect;
256
+ t(a, i);
254
257
  }
255
258
  });
256
- return t.current && e.observe(t.current), () => {
257
- e.disconnect();
259
+ return e.current && n.observe(e.current), () => {
260
+ n.disconnect();
258
261
  };
259
- }, [t, o]);
262
+ }, [e, t]);
260
263
  }
261
- const lt = F({
264
+ const jn = Dt({
262
265
  avatar: void 0,
263
266
  client: null,
264
267
  isOpen: !1,
@@ -268,84 +271,84 @@ const lt = F({
268
271
  messageBoxBottomRef: { current: null },
269
272
  botTypingPlaceholder: void 0
270
273
  });
271
- function Mt(n) {
274
+ function jr(o) {
272
275
  const {
273
- avatar: t,
274
- children: o,
275
- config: e,
276
- botTypingPlaceholder: r,
277
- customChannelId: s,
276
+ avatar: e,
277
+ children: t,
278
+ config: n,
279
+ botTypingPlaceholder: s,
280
+ customChannelId: r,
278
281
  initMessages: a
279
- } = n, i = R(null), u = xt({ config: e }), {
280
- isOpen: d,
281
- isResetting: h,
282
- isConnecting: _,
283
- conversation: l,
284
- sendMessage: p,
285
- resetChannel: f,
286
- closeChannel: x
287
- } = wt({
288
- client: u,
289
- customChannelId: s,
282
+ } = o, i = ce(null), p = $r({ config: n }), {
283
+ isOpen: c,
284
+ isResetting: u,
285
+ isConnecting: m,
286
+ conversation: f,
287
+ sendMessage: g,
288
+ resetChannel: x,
289
+ closeChannel: k
290
+ } = Br({
291
+ client: p,
292
+ customChannelId: r,
290
293
  initMessages: a
291
- }), N = v(
294
+ }), T = $(
292
295
  () => ({
293
- avatar: t,
294
- client: u,
295
- isOpen: d,
296
- isResetting: h,
297
- isConnecting: _,
298
- messages: (l == null ? void 0 : l.messages) ?? null,
299
- sendMessage: p,
300
- resetChannel: f,
301
- closeChannel: x,
302
- botTypingPlaceholder: r,
296
+ avatar: e,
297
+ client: p,
298
+ isOpen: c,
299
+ isResetting: u,
300
+ isConnecting: m,
301
+ messages: (f == null ? void 0 : f.messages) ?? null,
302
+ sendMessage: g,
303
+ resetChannel: x,
304
+ closeChannel: k,
305
+ botTypingPlaceholder: s,
303
306
  messageBoxBottomRef: i
304
307
  }),
305
308
  [
306
- t,
307
- u,
308
- d,
309
- h,
310
- _,
311
- l == null ? void 0 : l.messages,
309
+ e,
312
310
  p,
313
- f,
311
+ c,
312
+ u,
313
+ m,
314
+ f == null ? void 0 : f.messages,
315
+ g,
314
316
  x,
315
- r
317
+ k,
318
+ s
316
319
  ]
317
320
  );
318
- return /* @__PURE__ */ c(lt.Provider, { value: N, children: o });
321
+ return /* @__PURE__ */ d(jn.Provider, { value: T, children: t });
319
322
  }
320
- function T() {
321
- return W(lt);
323
+ function se() {
324
+ return Pt(jn);
322
325
  }
323
- const ut = F({
326
+ const Yn = Dt({
324
327
  onErrorClick: void 0,
325
328
  errorMessageRenderer: void 0
326
329
  });
327
- function zt(n) {
328
- const { children: t, onErrorClick: o, errorMessageRenderer: e } = n, r = v(
329
- () => ({ onErrorClick: o, errorMessageRenderer: e }),
330
- [e, o]
330
+ function Yr(o) {
331
+ const { children: e, onErrorClick: t, errorMessageRenderer: n } = o, s = $(
332
+ () => ({ onErrorClick: t, errorMessageRenderer: n }),
333
+ [n, t]
331
334
  );
332
- return /* @__PURE__ */ c(ut.Provider, { value: r, children: t });
333
- }
334
- function Ht() {
335
- return W(ut);
336
- }
337
- const Vt = "_chatbot_header_luxt4_1", At = "_chatbot_header__content_luxt4_4", Ot = "_chatbot_header__title_luxt4_12", Bt = "_chatbot_header__extra_luxt4_23", P = {
338
- chatbot_header: Vt,
339
- chatbot_header__content: At,
340
- chatbot_header__title: Ot,
341
- chatbot_header__extra: Bt
342
- }, It = (n) => /* @__PURE__ */ g.createElement("svg", { width: 33, height: 32, viewBox: "0 0 33 32", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...n }, /* @__PURE__ */ g.createElement("g", { clipPath: "url(#clip0_3084_29383)" }, /* @__PURE__ */ g.createElement("path", { d: "M0.410645 16C0.410645 7.16344 7.57409 0 16.4106 0C25.2472 0 32.4106 7.16344 32.4106 16C32.4106 24.8366 25.2472 32 16.4106 32C7.57409 32 0.410645 24.8366 0.410645 16Z", fill: "#333333" }), /* @__PURE__ */ g.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M16.5788 6.33398C19.8925 6.33398 22.5788 9.02028 22.5788 12.334C22.5788 14.2211 21.7075 15.9048 20.3453 17.0047C23.6487 18.3735 26.0607 21.6974 26.4106 25.6673H24.4569C24.0206 21.6274 20.9742 18.4911 17.2591 18.3397L16.9776 18.334H16.5788H15.8437C12.0019 18.334 8.81164 21.5258 8.36437 25.6673H6.41064C6.76857 21.607 9.28344 18.2225 12.7029 16.9143C11.4036 15.8137 10.5788 14.1701 10.5788 12.334C10.5788 9.02028 13.265 6.33398 16.5788 6.33398ZM16.5788 16.334C18.7879 16.334 20.5788 14.5431 20.5788 12.334C20.5788 10.1248 18.7879 8.33398 16.5788 8.33398C14.3696 8.33398 12.5788 10.1248 12.5788 12.334C12.5788 14.5431 14.3696 16.334 16.5788 16.334Z", fill: "#8C8C8C" })), /* @__PURE__ */ g.createElement("defs", null, /* @__PURE__ */ g.createElement("clipPath", { id: "clip0_3084_29383" }, /* @__PURE__ */ g.createElement("path", { d: "M0.410645 16C0.410645 7.16344 7.57409 0 16.4106 0C25.2472 0 32.4106 7.16344 32.4106 16C32.4106 24.8366 25.2472 32 16.4106 32C7.57409 32 0.410645 24.8366 0.410645 16Z", fill: "white" }))));
343
- function Pt(n) {
344
- const { avatar: t } = n;
345
- return t ? /* @__PURE__ */ c(
335
+ return /* @__PURE__ */ d(Yn.Provider, { value: s, children: e });
336
+ }
337
+ function Xr() {
338
+ return Pt(Yn);
339
+ }
340
+ const Qr = "_chatbot_header_luxt4_1", Kr = "_chatbot_header__content_luxt4_4", Jr = "_chatbot_header__title_luxt4_12", es = "_chatbot_header__extra_luxt4_23", Je = {
341
+ chatbot_header: Qr,
342
+ chatbot_header__content: Kr,
343
+ chatbot_header__title: Jr,
344
+ chatbot_header__extra: es
345
+ }, ts = (o) => /* @__PURE__ */ L.createElement("svg", { width: 33, height: 32, viewBox: "0 0 33 32", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...o }, /* @__PURE__ */ L.createElement("g", { clipPath: "url(#clip0_3084_29383)" }, /* @__PURE__ */ L.createElement("path", { d: "M0.410645 16C0.410645 7.16344 7.57409 0 16.4106 0C25.2472 0 32.4106 7.16344 32.4106 16C32.4106 24.8366 25.2472 32 16.4106 32C7.57409 32 0.410645 24.8366 0.410645 16Z", fill: "#333333" }), /* @__PURE__ */ L.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M16.5788 6.33398C19.8925 6.33398 22.5788 9.02028 22.5788 12.334C22.5788 14.2211 21.7075 15.9048 20.3453 17.0047C23.6487 18.3735 26.0607 21.6974 26.4106 25.6673H24.4569C24.0206 21.6274 20.9742 18.4911 17.2591 18.3397L16.9776 18.334H16.5788H15.8437C12.0019 18.334 8.81164 21.5258 8.36437 25.6673H6.41064C6.76857 21.607 9.28344 18.2225 12.7029 16.9143C11.4036 15.8137 10.5788 14.1701 10.5788 12.334C10.5788 9.02028 13.265 6.33398 16.5788 6.33398ZM16.5788 16.334C18.7879 16.334 20.5788 14.5431 20.5788 12.334C20.5788 10.1248 18.7879 8.33398 16.5788 8.33398C14.3696 8.33398 12.5788 10.1248 12.5788 12.334C12.5788 14.5431 14.3696 16.334 16.5788 16.334Z", fill: "#8C8C8C" })), /* @__PURE__ */ L.createElement("defs", null, /* @__PURE__ */ L.createElement("clipPath", { id: "clip0_3084_29383" }, /* @__PURE__ */ L.createElement("path", { d: "M0.410645 16C0.410645 7.16344 7.57409 0 16.4106 0C25.2472 0 32.4106 7.16344 32.4106 16C32.4106 24.8366 25.2472 32 16.4106 32C7.57409 32 0.410645 24.8366 0.410645 16Z", fill: "white" }))));
346
+ function ns(o) {
347
+ const { avatar: e } = o;
348
+ return e ? /* @__PURE__ */ d(
346
349
  "img",
347
350
  {
348
- src: t,
351
+ src: e,
349
352
  alt: "avatar",
350
353
  style: {
351
354
  width: 33,
@@ -353,630 +356,2775 @@ function Pt(n) {
353
356
  borderRadius: "50%"
354
357
  }
355
358
  }
356
- ) : /* @__PURE__ */ c(It, {});
359
+ ) : /* @__PURE__ */ d(ts, {});
357
360
  }
358
- const Zt = (n) => /* @__PURE__ */ g.createElement("svg", { width: 16, height: 16, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...n }, /* @__PURE__ */ g.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M3.49453 2.3352C6.44049 -0.226723 10.9105 -0.106316 13.7142 2.69633C16.6428 5.62613 16.6428 10.3739 13.7144 13.3035C10.7846 16.2322 6.03581 16.2322 3.1073 13.3036C2.30873 12.505 1.71132 11.5536 1.34188 10.5109L1.78892 10.3525L1.34171 10.5106L1.22791 10.162C1.01752 9.46018 0.910643 8.73159 0.910643 7.9997H2.4542L2.46382 8.33865C2.49584 8.9024 2.60763 9.46037 2.79674 9.99539L2.7968 9.99536L2.90116 10.2683C3.19714 10.9887 3.63414 11.6475 4.19876 12.2121C6.52451 14.5379 10.2961 14.5379 12.6229 12.212C14.9486 9.88539 14.9486 6.11464 12.6227 3.78781C10.3306 1.49653 6.63579 1.46263 4.30292 3.68622L6.68087 3.68698V5.22954H3.49394H1.95141V3.68698V0.5H3.49394L3.49453 2.3352Z", fill: "#8C8C8C" })), qt = (n) => /* @__PURE__ */ g.createElement("svg", { width: 15, height: 14, viewBox: "0 0 15 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...n }, /* @__PURE__ */ g.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M13.3496 0L7.41062 5.938L1.47162 0L0.411621 1.06L6.34962 6.999L0.411621 12.938L1.47162 13.999L7.41062 8.059L13.3496 13.999L14.4096 12.938L8.47162 6.999L14.4096 1.06L13.3496 0Z", fill: "#8C8C8C" }));
359
- function Dt(n) {
360
- const { title: t, onReset: o, onClose: e } = n, { chatbot: r } = L(), { avatar: s, isResetting: a, resetChannel: i, closeChannel: u } = T(), d = v(
361
+ const rs = (o) => /* @__PURE__ */ L.createElement("svg", { width: 16, height: 16, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...o }, /* @__PURE__ */ L.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M3.49453 2.3352C6.44049 -0.226723 10.9105 -0.106316 13.7142 2.69633C16.6428 5.62613 16.6428 10.3739 13.7144 13.3035C10.7846 16.2322 6.03581 16.2322 3.1073 13.3036C2.30873 12.505 1.71132 11.5536 1.34188 10.5109L1.78892 10.3525L1.34171 10.5106L1.22791 10.162C1.01752 9.46018 0.910643 8.73159 0.910643 7.9997H2.4542L2.46382 8.33865C2.49584 8.9024 2.60763 9.46037 2.79674 9.99539L2.7968 9.99536L2.90116 10.2683C3.19714 10.9887 3.63414 11.6475 4.19876 12.2121C6.52451 14.5379 10.2961 14.5379 12.6229 12.212C14.9486 9.88539 14.9486 6.11464 12.6227 3.78781C10.3306 1.49653 6.63579 1.46263 4.30292 3.68622L6.68087 3.68698V5.22954H3.49394H1.95141V3.68698V0.5H3.49394L3.49453 2.3352Z", fill: "#8C8C8C" })), ss = (o) => /* @__PURE__ */ L.createElement("svg", { width: 15, height: 14, viewBox: "0 0 15 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...o }, /* @__PURE__ */ L.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M13.3496 0L7.41062 5.938L1.47162 0L0.411621 1.06L6.34962 6.999L0.411621 12.938L1.47162 13.999L7.41062 8.059L13.3496 13.999L14.4096 12.938L8.47162 6.999L14.4096 1.06L13.3496 0Z", fill: "#8C8C8C" }));
362
+ function os(o) {
363
+ const { title: e, onReset: t, onClose: n } = o, { chatbot: s } = ge(), { avatar: r, isResetting: a, resetChannel: i, closeChannel: p } = se(), c = $(
361
364
  () => ({
362
- maxWidth: (r == null ? void 0 : r.contentMaxWidth) ?? "1200px",
363
- borderBottomColor: r == null ? void 0 : r.borderColor
365
+ maxWidth: (s == null ? void 0 : s.contentMaxWidth) ?? "1200px",
366
+ borderBottomColor: s == null ? void 0 : s.borderColor
364
367
  }),
365
- [r]
366
- ), h = b(
367
- (l) => {
368
- a || (l.stopPropagation(), o == null || o(), i == null || i());
368
+ [s]
369
+ ), u = I(
370
+ (f) => {
371
+ a || (f.stopPropagation(), t == null || t(), i == null || i());
369
372
  },
370
- [a, o, i]
371
- ), _ = b(
372
- (l) => {
373
- a || (l.stopPropagation(), e == null || e(), u == null || u());
373
+ [a, t, i]
374
+ ), m = I(
375
+ (f) => {
376
+ a || (f.stopPropagation(), n == null || n(), p == null || p());
374
377
  },
375
- [a, e, u]
378
+ [a, n, p]
376
379
  );
377
- return /* @__PURE__ */ c("div", { className: P.chatbot_header, children: /* @__PURE__ */ m("div", { className: P.chatbot_header__content, style: d, children: [
378
- /* @__PURE__ */ m("div", { className: P.chatbot_header__title, children: [
379
- /* @__PURE__ */ c(Pt, { avatar: s }),
380
- /* @__PURE__ */ c("h4", { children: t })
380
+ return /* @__PURE__ */ d("div", { className: Je.chatbot_header, children: /* @__PURE__ */ R("div", { className: Je.chatbot_header__content, style: c, children: [
381
+ /* @__PURE__ */ R("div", { className: Je.chatbot_header__title, children: [
382
+ /* @__PURE__ */ d(ns, { avatar: r }),
383
+ /* @__PURE__ */ d("h4", { children: e })
381
384
  ] }),
382
- /* @__PURE__ */ m("div", { className: P.chatbot_header__extra, children: [
383
- /* @__PURE__ */ c("div", { onClick: h, children: /* @__PURE__ */ c(Zt, {}) }),
384
- /* @__PURE__ */ c("div", { onClick: _, children: /* @__PURE__ */ c(qt, {}) })
385
+ /* @__PURE__ */ R("div", { className: Je.chatbot_header__extra, children: [
386
+ /* @__PURE__ */ d("div", { onClick: u, children: /* @__PURE__ */ d(rs, {}) }),
387
+ /* @__PURE__ */ d("div", { onClick: m, children: /* @__PURE__ */ d(ss, {}) })
385
388
  ] })
386
389
  ] }) });
387
390
  }
388
- const $t = "_chatbot_body_f6sqm_1", Ft = "_chatbot_body__content_f6sqm_5", J = {
389
- chatbot_body: $t,
390
- chatbot_body__content: Ft
391
- }, Wt = "_template_box_1ozig_1", M = {
392
- template_box: Wt,
391
+ const is = "_chatbot_body_f6sqm_1", as = "_chatbot_body__content_f6sqm_5", Tn = {
392
+ chatbot_body: is,
393
+ chatbot_body__content: as
394
+ }, ls = "_template_box_1ozig_1", ye = {
395
+ template_box: ls,
393
396
  "template_box--bot": "_template_box--bot_1ozig_7",
394
397
  "template_box--horizontal": "_template_box--horizontal_1ozig_7",
395
398
  "template_box--vertical": "_template_box--vertical_1ozig_10",
396
399
  "template_box--user": "_template_box--user_1ozig_14"
397
400
  };
398
- function dt(n) {
399
- var t, o, e = "";
400
- if (typeof n == "string" || typeof n == "number") e += n;
401
- else if (typeof n == "object") if (Array.isArray(n)) {
402
- var r = n.length;
403
- for (t = 0; t < r; t++) n[t] && (o = dt(n[t])) && (e && (e += " "), e += o);
404
- } else for (o in n) n[o] && (e && (e += " "), e += o);
405
- return e;
401
+ function Xn(o) {
402
+ var e, t, n = "";
403
+ if (typeof o == "string" || typeof o == "number") n += o;
404
+ else if (typeof o == "object") if (Array.isArray(o)) {
405
+ var s = o.length;
406
+ for (e = 0; e < s; e++) o[e] && (t = Xn(o[e])) && (n && (n += " "), n += t);
407
+ } else for (t in o) o[t] && (n && (n += " "), n += t);
408
+ return n;
406
409
  }
407
- function E() {
408
- for (var n, t, o = 0, e = "", r = arguments.length; o < r; o++) (n = arguments[o]) && (t = dt(n)) && (e && (e += " "), e += t);
409
- return e;
410
+ function ae() {
411
+ for (var o, e, t = 0, n = "", s = arguments.length; t < s; t++) (o = arguments[t]) && (e = Xn(o)) && (n && (n += " "), n += e);
412
+ return n;
410
413
  }
411
- function I(n) {
412
- const { type: t, direction: o = "horizontal", children: e } = n, r = v(() => {
413
- switch (t) {
414
+ function Ge(o) {
415
+ const { type: e, direction: t = "horizontal", children: n } = o, s = $(() => {
416
+ switch (e) {
414
417
  case "user":
415
- return E(M.template_box, M["template_box--user"]);
418
+ return ae(ye.template_box, ye["template_box--user"]);
416
419
  case "bot":
417
420
  default:
418
- return E(
419
- M.template_box,
420
- M["template_box--bot"],
421
- o === "horizontal" ? M["template_box--horizontal"] : M["template_box--vertical"]
421
+ return ae(
422
+ ye.template_box,
423
+ ye["template_box--bot"],
424
+ t === "horizontal" ? ye["template_box--horizontal"] : ye["template_box--vertical"]
422
425
  );
423
426
  }
424
- }, [o, t]);
425
- return /* @__PURE__ */ c("div", { className: r, children: e });
427
+ }, [t, e]);
428
+ return /* @__PURE__ */ d("div", { className: s, children: n });
426
429
  }
427
- const jt = "_template_box_content_fs2wk_1", Ut = "_content_fs2wk_8", G = {
428
- template_box_content: jt,
429
- content: Ut
430
- }, Kt = "_quick_replies_box_zoq7y_1", Xt = "_quick_reply_zoq7y_7", Q = {
431
- quick_replies_box: Kt,
432
- quick_reply: Xt
430
+ const cs = "_template_box_content_fs2wk_1", us = "_content_fs2wk_8", yn = {
431
+ template_box_content: cs,
432
+ content: us
433
+ }, ps = "_quick_replies_box_zoq7y_1", hs = "_quick_reply_zoq7y_7", Cn = {
434
+ quick_replies_box: ps,
435
+ quick_reply: hs
433
436
  };
434
- function Yt(n) {
435
- const { quickReplies: t } = n, { sendMessage: o, isConnecting: e } = T(), r = b(
436
- (s) => {
437
- o == null || o(s);
438
- },
439
- [o]
437
+ function fs(o) {
438
+ const { quickReplies: e } = o, { sendMessage: t, isConnecting: n } = se(), s = I(
439
+ (r) => t == null ? void 0 : t({ text: r }),
440
+ [t]
440
441
  );
441
- return t != null && t.length ? /* @__PURE__ */ c("div", { className: Q.quick_replies_box, children: t.map((s) => /* @__PURE__ */ c(
442
+ return e != null && e.length ? /* @__PURE__ */ d("div", { className: Cn.quick_replies_box, children: e.map((r) => /* @__PURE__ */ d(
442
443
  "button",
443
444
  {
444
- className: Q.quick_reply,
445
- disabled: e,
446
- onClick: () => r(s.text),
447
- children: s.text
445
+ className: Cn.quick_reply,
446
+ disabled: n,
447
+ onClick: () => s(r.text),
448
+ children: r.text
448
449
  },
449
- s.text
450
+ r.text
450
451
  )) }) : null;
451
452
  }
452
- function $(n) {
453
- return n.toLocaleTimeString("zh-TW", {
453
+ function It(o) {
454
+ return o.toLocaleTimeString("zh-TW", {
454
455
  timeZone: "Asia/Taipei",
455
456
  hour: "2-digit",
456
457
  minute: "2-digit",
457
458
  hour12: !1
458
459
  });
459
460
  }
460
- const Jt = "_time_rgg92_1", Gt = {
461
- time: Jt
461
+ const ds = "_time_rgg92_1", gs = {
462
+ time: ds
462
463
  };
463
- function j(n) {
464
- const { time: t, className: o } = n;
465
- return t ? /* @__PURE__ */ c("div", { className: E(Gt.time, o), children: $(t) }) : null;
466
- }
467
- function U(n) {
468
- const { quickReplies: t, time: o, children: e } = n;
469
- return /* @__PURE__ */ m("div", { className: G.template_box_content, children: [
470
- /* @__PURE__ */ m("div", { className: G.content, children: [
471
- e,
472
- /* @__PURE__ */ c(j, { time: o })
464
+ function zt(o) {
465
+ const { time: e, className: t } = o;
466
+ return e ? /* @__PURE__ */ d("div", { className: ae(gs.time, t), children: It(e) }) : null;
467
+ }
468
+ function $t(o) {
469
+ const { quickReplies: e, time: t, children: n } = o;
470
+ return /* @__PURE__ */ R("div", { className: yn.template_box_content, children: [
471
+ /* @__PURE__ */ R("div", { className: yn.content, children: [
472
+ n,
473
+ /* @__PURE__ */ d(zt, { time: t })
473
474
  ] }),
474
- !!(t != null && t.length) && /* @__PURE__ */ c(Yt, { quickReplies: t })
475
+ !!(e != null && e.length) && /* @__PURE__ */ d(fs, { quickReplies: e })
475
476
  ] });
476
477
  }
477
- const Qt = "_bot_avatar_xrs9x_1", tt = {
478
- bot_avatar: Qt
479
- }, te = (n) => /* @__PURE__ */ g.createElement("svg", { viewBox: "0 0 25 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...n }, /* @__PURE__ */ g.createElement("path", { d: "M0.40625 12C0.40625 5.37258 5.77883 0 12.4062 0C19.0337 0 24.4062 5.37258 24.4062 12C24.4062 18.6274 19.0337 24 12.4062 24C5.77883 24 0.40625 18.6274 0.40625 12Z", fill: "#585858" }), /* @__PURE__ */ g.createElement("path", { d: "M6.40625 18.75V15C6.40625 14.5875 6.55313 14.2344 6.84688 13.9406C7.14063 13.6469 7.49375 13.5 7.90625 13.5H16.9062C17.3188 13.5 17.6719 13.6469 17.9656 13.9406C18.2594 14.2344 18.4062 14.5875 18.4062 15V18.75H6.40625ZM10.1562 12.75C9.11875 12.75 8.23438 12.3844 7.50312 11.6531C6.77187 10.9219 6.40625 10.0375 6.40625 9C6.40625 7.9625 6.77187 7.07812 7.50312 6.34687C8.23438 5.61562 9.11875 5.25 10.1562 5.25H14.6562C15.6938 5.25 16.5781 5.61562 17.3094 6.34687C18.0406 7.07812 18.4062 7.9625 18.4062 9C18.4062 10.0375 18.0406 10.9219 17.3094 11.6531C16.5781 12.3844 15.6938 12.75 14.6562 12.75H10.1562ZM7.90625 17.25H16.9062V15H7.90625V17.25ZM10.1562 11.25H14.6562C15.2812 11.25 15.8125 11.0312 16.25 10.5938C16.6875 10.1562 16.9062 9.625 16.9062 9C16.9062 8.375 16.6875 7.84375 16.25 7.40625C15.8125 6.96875 15.2812 6.75 14.6562 6.75H10.1562C9.53125 6.75 9 6.96875 8.5625 7.40625C8.125 7.84375 7.90625 8.375 7.90625 9C7.90625 9.625 8.125 10.1562 8.5625 10.5938C9 11.0312 9.53125 11.25 10.1562 11.25ZM10.1562 9.75C10.3688 9.75 10.5469 9.67812 10.6906 9.53438C10.8344 9.39062 10.9062 9.2125 10.9062 9C10.9062 8.7875 10.8344 8.60938 10.6906 8.46562C10.5469 8.32187 10.3688 8.25 10.1562 8.25C9.94375 8.25 9.76562 8.32187 9.62187 8.46562C9.47812 8.60938 9.40625 8.7875 9.40625 9C9.40625 9.2125 9.47812 9.39062 9.62187 9.53438C9.76562 9.67812 9.94375 9.75 10.1562 9.75ZM14.6562 9.75C14.8687 9.75 15.0469 9.67812 15.1906 9.53438C15.3344 9.39062 15.4062 9.2125 15.4062 9C15.4062 8.7875 15.3344 8.60938 15.1906 8.46562C15.0469 8.32187 14.8687 8.25 14.6562 8.25C14.4438 8.25 14.2656 8.32187 14.1219 8.46562C13.9781 8.60938 13.9062 8.7875 13.9062 9C13.9062 9.2125 13.9781 9.39062 14.1219 9.53438C14.2656 9.67812 14.4438 9.75 14.6562 9.75Z", fill: "white" })), Z = ft((n) => {
480
- const { avatar: t } = n;
481
- return t ? /* @__PURE__ */ c("img", { src: t, alt: "Bot Avatar", className: tt.bot_avatar }) : /* @__PURE__ */ c("div", { className: tt.bot_avatar, children: /* @__PURE__ */ c(te, {}) });
482
- }), ee = "_card_root_1ygom_1", ne = "_card_content_1ygom_10", oe = "_card_title_1ygom_17", re = "_card_description_1ygom_23", se = "_card_actions_1ygom_37", A = {
483
- card_root: ee,
484
- card_content: ne,
485
- card_title: oe,
486
- card_description: re,
487
- card_actions: se
478
+ const ms = "_bot_avatar_xrs9x_1", En = {
479
+ bot_avatar: ms
480
+ }, _s = (o) => /* @__PURE__ */ L.createElement("svg", { viewBox: "0 0 25 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...o }, /* @__PURE__ */ L.createElement("path", { d: "M0.40625 12C0.40625 5.37258 5.77883 0 12.4062 0C19.0337 0 24.4062 5.37258 24.4062 12C24.4062 18.6274 19.0337 24 12.4062 24C5.77883 24 0.40625 18.6274 0.40625 12Z", fill: "#585858" }), /* @__PURE__ */ L.createElement("path", { d: "M6.40625 18.75V15C6.40625 14.5875 6.55313 14.2344 6.84688 13.9406C7.14063 13.6469 7.49375 13.5 7.90625 13.5H16.9062C17.3188 13.5 17.6719 13.6469 17.9656 13.9406C18.2594 14.2344 18.4062 14.5875 18.4062 15V18.75H6.40625ZM10.1562 12.75C9.11875 12.75 8.23438 12.3844 7.50312 11.6531C6.77187 10.9219 6.40625 10.0375 6.40625 9C6.40625 7.9625 6.77187 7.07812 7.50312 6.34687C8.23438 5.61562 9.11875 5.25 10.1562 5.25H14.6562C15.6938 5.25 16.5781 5.61562 17.3094 6.34687C18.0406 7.07812 18.4062 7.9625 18.4062 9C18.4062 10.0375 18.0406 10.9219 17.3094 11.6531C16.5781 12.3844 15.6938 12.75 14.6562 12.75H10.1562ZM7.90625 17.25H16.9062V15H7.90625V17.25ZM10.1562 11.25H14.6562C15.2812 11.25 15.8125 11.0312 16.25 10.5938C16.6875 10.1562 16.9062 9.625 16.9062 9C16.9062 8.375 16.6875 7.84375 16.25 7.40625C15.8125 6.96875 15.2812 6.75 14.6562 6.75H10.1562C9.53125 6.75 9 6.96875 8.5625 7.40625C8.125 7.84375 7.90625 8.375 7.90625 9C7.90625 9.625 8.125 10.1562 8.5625 10.5938C9 11.0312 9.53125 11.25 10.1562 11.25ZM10.1562 9.75C10.3688 9.75 10.5469 9.67812 10.6906 9.53438C10.8344 9.39062 10.9062 9.2125 10.9062 9C10.9062 8.7875 10.8344 8.60938 10.6906 8.46562C10.5469 8.32187 10.3688 8.25 10.1562 8.25C9.94375 8.25 9.76562 8.32187 9.62187 8.46562C9.47812 8.60938 9.40625 8.7875 9.40625 9C9.40625 9.2125 9.47812 9.39062 9.62187 9.53438C9.76562 9.67812 9.94375 9.75 10.1562 9.75ZM14.6562 9.75C14.8687 9.75 15.0469 9.67812 15.1906 9.53438C15.3344 9.39062 15.4062 9.2125 15.4062 9C15.4062 8.7875 15.3344 8.60938 15.1906 8.46562C15.0469 8.32187 14.8687 8.25 14.6562 8.25C14.4438 8.25 14.2656 8.32187 14.1219 8.46562C13.9781 8.60938 13.9062 8.7875 13.9062 9C13.9062 9.2125 13.9781 9.39062 14.1219 9.53438C14.2656 9.67812 14.4438 9.75 14.6562 9.75Z", fill: "white" })), at = Mr((o) => {
481
+ const { avatar: e } = o;
482
+ return e ? /* @__PURE__ */ d("img", { src: e, alt: "Bot Avatar", className: En.bot_avatar }) : /* @__PURE__ */ d("div", { className: En.bot_avatar, children: /* @__PURE__ */ d(_s, {}) });
483
+ }), bs = "_card_root_1qjc0_1", xs = "_card_content_1qjc0_12", ks = "_card_title_1qjc0_20", ws = "_card_description_1qjc0_26", Ts = "_card_actions_1qjc0_41", Ne = {
484
+ card_root: bs,
485
+ card_content: xs,
486
+ card_title: ks,
487
+ card_description: ws,
488
+ card_actions: Ts
488
489
  };
489
- function _t(n) {
490
+ function Qn(o) {
490
491
  var a;
491
- const { template: t } = n, { sendMessage: o } = T(), e = v(() => (t == null ? void 0 : t.thumbnailImageUrl.replace(/^http:/, "").replace(/^https:/, "")) || "https://via.assets.so/img.jpg?w=200&h=270&tc=white&bg=#eeeeee", [t]), r = v(() => {
492
- switch (t == null ? void 0 : t.imageAspectRatio) {
492
+ const { template: e } = o, { sendMessage: t } = se(), n = $(() => (e == null ? void 0 : e.thumbnailImageUrl.replace(/^http:/, "").replace(/^https:/, "")) || "https://via.assets.so/img.jpg?w=200&h=270&tc=white&bg=#eeeeee", [e]), s = $(() => {
493
+ switch (e == null ? void 0 : e.imageAspectRatio) {
493
494
  case "square":
494
495
  return "1 / 1";
495
496
  case "rectangle":
496
497
  default:
497
498
  return "1.51 / 1";
498
499
  }
499
- }, [t]), s = b(
500
+ }, [e]), r = I(
500
501
  (i) => function() {
501
502
  switch (i.type) {
502
503
  case "message":
503
- o == null || o(i.text);
504
+ t == null || t({ text: i.text });
504
505
  return;
505
506
  case "uri":
506
507
  window.open(i.uri, "_blank");
507
508
  return;
508
509
  }
509
510
  },
510
- [o]
511
+ [t]
511
512
  );
512
- return /* @__PURE__ */ m("div", { className: A.card_root, children: [
513
- (t == null ? void 0 : t.thumbnailImageUrl) && /* @__PURE__ */ c(
513
+ return /* @__PURE__ */ R("div", { className: Ne.card_root, children: [
514
+ (e == null ? void 0 : e.thumbnailImageUrl) && /* @__PURE__ */ d(
514
515
  "img",
515
516
  {
516
- alt: t == null ? void 0 : t.title,
517
- src: e,
517
+ alt: e == null ? void 0 : e.title,
518
+ src: n,
518
519
  style: {
519
520
  display: "block",
520
521
  width: "100%",
521
522
  maxHeight: "170px",
522
- objectFit: t == null ? void 0 : t.imageSize,
523
- aspectRatio: r
523
+ objectFit: e == null ? void 0 : e.imageSize,
524
+ aspectRatio: s
524
525
  }
525
526
  }
526
527
  ),
527
- /* @__PURE__ */ m("div", { className: A.card_content, children: [
528
- /* @__PURE__ */ c("h5", { className: A.card_title, children: t == null ? void 0 : t.title }),
529
- /* @__PURE__ */ c("div", { className: A.card_description, children: t == null ? void 0 : t.text }),
530
- /* @__PURE__ */ c("div", { className: A.card_actions, children: (a = t == null ? void 0 : t.buttons) == null ? void 0 : a.map((i, u) => /* @__PURE__ */ c("button", { onClick: s(i.action), children: i.label }, u)) })
528
+ /* @__PURE__ */ R("div", { className: Ne.card_content, children: [
529
+ /* @__PURE__ */ d("h5", { className: Ne.card_title, children: e == null ? void 0 : e.title }),
530
+ /* @__PURE__ */ d("div", { className: Ne.card_description, children: e == null ? void 0 : e.text }),
531
+ /* @__PURE__ */ d("div", { className: Ne.card_actions, children: (a = e == null ? void 0 : e.buttons) == null ? void 0 : a.map((i, p) => /* @__PURE__ */ d("button", { onClick: r(i.action), children: i.label }, p)) })
531
532
  ] })
532
533
  ] });
533
534
  }
534
- function ce(n) {
535
- const { message: t } = n, { avatar: o } = T(), e = t.message.template;
536
- return /* @__PURE__ */ m(I, { type: "bot", direction: "horizontal", children: [
537
- /* @__PURE__ */ c(Z, { avatar: o }),
538
- /* @__PURE__ */ c(
539
- U,
535
+ function ys(o) {
536
+ const { message: e } = o, { avatar: t } = se(), n = e.message.template;
537
+ return /* @__PURE__ */ R(Ge, { type: "bot", direction: "horizontal", children: [
538
+ /* @__PURE__ */ d(at, { avatar: t }),
539
+ /* @__PURE__ */ d(
540
+ $t,
540
541
  {
541
- time: t.time,
542
- quickReplies: e == null ? void 0 : e.quickReplies,
543
- children: /* @__PURE__ */ c(_t, { template: e })
542
+ time: e.time,
543
+ quickReplies: n == null ? void 0 : n.quickReplies,
544
+ children: /* @__PURE__ */ d(Qn, { template: n })
544
545
  }
545
546
  )
546
547
  ] });
547
548
  }
548
- const ie = "_text_5fknl_1", ae = "_dot_5fknl_31", y = {
549
- text: ie,
550
- "text--user": "_text--user_5fknl_8",
551
- "text--bot": "_text--bot_5fknl_14",
552
- "typing-indicator": "_typing-indicator_5fknl_26",
553
- dot: ae
549
+ const Cs = "_text_1afu9_1", Es = "_md_container_1afu9_11", Ss = "_dot_1afu9_41", ee = {
550
+ text: Cs,
551
+ md_container: Es,
552
+ "text--user": "_text--user_1afu9_18",
553
+ "text--bot": "_text--bot_1afu9_24",
554
+ "typing-indicator": "_typing-indicator_1afu9_36",
555
+ dot: Ss
554
556
  };
555
- function et(n) {
556
- var s;
557
- const { message: t } = n, { avatar: o } = T(), e = L(), r = v(() => {
558
- var a, i, u, d;
559
- switch (t.type) {
557
+ function Bt() {
558
+ return {
559
+ async: !1,
560
+ breaks: !1,
561
+ extensions: null,
562
+ gfm: !0,
563
+ hooks: null,
564
+ pedantic: !1,
565
+ renderer: null,
566
+ silent: !1,
567
+ tokenizer: null,
568
+ walkTokens: null
569
+ };
570
+ }
571
+ let me = Bt();
572
+ function Kn(o) {
573
+ me = o;
574
+ }
575
+ const Ue = { exec: () => null };
576
+ function y(o, e = "") {
577
+ let t = typeof o == "string" ? o : o.source;
578
+ const n = {
579
+ replace: (s, r) => {
580
+ let a = typeof r == "string" ? r : r.source;
581
+ return a = a.replace(q.caret, "$1"), t = t.replace(s, a), n;
582
+ },
583
+ getRegex: () => new RegExp(t, e)
584
+ };
585
+ return n;
586
+ }
587
+ const q = {
588
+ codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm,
589
+ outputLinkReplace: /\\([\[\]])/g,
590
+ indentCodeCompensation: /^(\s+)(?:```)/,
591
+ beginningSpace: /^\s+/,
592
+ endingHash: /#$/,
593
+ startingSpaceChar: /^ /,
594
+ endingSpaceChar: / $/,
595
+ nonSpaceChar: /[^ ]/,
596
+ newLineCharGlobal: /\n/g,
597
+ tabCharGlobal: /\t/g,
598
+ multipleSpaceGlobal: /\s+/g,
599
+ blankLine: /^[ \t]*$/,
600
+ doubleBlankLine: /\n[ \t]*\n[ \t]*$/,
601
+ blockquoteStart: /^ {0,3}>/,
602
+ blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g,
603
+ blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm,
604
+ listReplaceTabs: /^\t+/,
605
+ listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g,
606
+ listIsTask: /^\[[ xX]\] /,
607
+ listReplaceTask: /^\[[ xX]\] +/,
608
+ anyLine: /\n.*\n/,
609
+ hrefBrackets: /^<(.*)>$/,
610
+ tableDelimiter: /[:|]/,
611
+ tableAlignChars: /^\||\| *$/g,
612
+ tableRowBlankLine: /\n[ \t]*$/,
613
+ tableAlignRight: /^ *-+: *$/,
614
+ tableAlignCenter: /^ *:-+: *$/,
615
+ tableAlignLeft: /^ *:-+ *$/,
616
+ startATag: /^<a /i,
617
+ endATag: /^<\/a>/i,
618
+ startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i,
619
+ endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i,
620
+ startAngleBracket: /^</,
621
+ endAngleBracket: />$/,
622
+ pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/,
623
+ unicodeAlphaNumeric: /[\p{L}\p{N}]/u,
624
+ escapeTest: /[&<>"']/,
625
+ escapeReplace: /[&<>"']/g,
626
+ escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,
627
+ escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,
628
+ unescapeTest: /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,
629
+ caret: /(^|[^\[])\^/g,
630
+ percentDecode: /%25/g,
631
+ findPipe: /\|/g,
632
+ splitPipe: / \|/,
633
+ slashPipe: /\\\|/g,
634
+ carriageReturn: /\r\n|\r/g,
635
+ spaceLine: /^ +$/gm,
636
+ notSpaceStart: /^\S*/,
637
+ endingNewline: /\n$/,
638
+ listItemRegex: (o) => new RegExp(`^( {0,3}${o})((?:[ ][^\\n]*)?(?:\\n|$))`),
639
+ nextBulletRegex: (o) => new RegExp(`^ {0,${Math.min(3, o - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),
640
+ hrRegex: (o) => new RegExp(`^ {0,${Math.min(3, o - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),
641
+ fencesBeginRegex: (o) => new RegExp(`^ {0,${Math.min(3, o - 1)}}(?:\`\`\`|~~~)`),
642
+ headingBeginRegex: (o) => new RegExp(`^ {0,${Math.min(3, o - 1)}}#`),
643
+ htmlBeginRegex: (o) => new RegExp(`^ {0,${Math.min(3, o - 1)}}<(?:[a-z].*>|!--)`, "i")
644
+ }, As = /^(?:[ \t]*(?:\n|$))+/, Rs = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, vs = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, We = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Ls = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, Ht = /(?:[*+-]|\d{1,9}[.)])/, Jn = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, er = y(Jn).replace(/bull/g, Ht).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(), Is = y(Jn).replace(/bull/g, Ht).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(), Ut = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, Ns = /^[^\n]+/, Ft = /(?!\s*\])(?:\\.|[^\[\]\\])+/, Ms = y(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", Ft).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Os = y(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, Ht).getRegex(), lt = "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", qt = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Ds = 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", qt).replace("tag", lt).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), tr = y(Ut).replace("hr", We).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[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", lt).getRegex(), Ps = y(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", tr).getRegex(), Gt = {
645
+ blockquote: Ps,
646
+ code: Rs,
647
+ def: Ms,
648
+ fences: vs,
649
+ heading: Ls,
650
+ hr: We,
651
+ html: Ds,
652
+ lheading: er,
653
+ list: Os,
654
+ newline: As,
655
+ paragraph: tr,
656
+ table: Ue,
657
+ text: Ns
658
+ }, Sn = y("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", We).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[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", lt).getRegex(), zs = {
659
+ ...Gt,
660
+ lheading: Is,
661
+ table: Sn,
662
+ paragraph: y(Ut).replace("hr", We).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", Sn).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", lt).getRegex()
663
+ }, $s = {
664
+ ...Gt,
665
+ html: y(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", qt).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(),
666
+ def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
667
+ heading: /^(#{1,6})(.*)(?:\n+|$)/,
668
+ fences: Ue,
669
+ // fences not supported
670
+ lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
671
+ paragraph: y(Ut).replace("hr", We).replace("heading", ` *#{1,6} *[^
672
+ ]`).replace("lheading", er).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
673
+ }, Bs = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Hs = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, nr = /^( {2,}|\\)\n(?!\s*$)/, Us = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, ct = /[\p{P}\p{S}]/u, Wt = /[\s\p{P}\p{S}]/u, rr = /[^\s\p{P}\p{S}]/u, Fs = y(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, Wt).getRegex(), sr = /(?!~)[\p{P}\p{S}]/u, qs = /(?!~)[\s\p{P}\p{S}]/u, Gs = /(?:[^\s\p{P}\p{S}]|~)/u, Ws = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g, or = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, Zs = y(or, "u").replace(/punct/g, ct).getRegex(), Vs = y(or, "u").replace(/punct/g, sr).getRegex(), ir = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", js = y(ir, "gu").replace(/notPunctSpace/g, rr).replace(/punctSpace/g, Wt).replace(/punct/g, ct).getRegex(), Ys = y(ir, "gu").replace(/notPunctSpace/g, Gs).replace(/punctSpace/g, qs).replace(/punct/g, sr).getRegex(), Xs = y("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, rr).replace(/punctSpace/g, Wt).replace(/punct/g, ct).getRegex(), Qs = y(/\\(punct)/, "gu").replace(/punct/g, ct).getRegex(), Ks = 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(), Js = y(qt).replace("(?:-->|$)", "-->").getRegex(), eo = 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", Js).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), st = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/, to = y(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label", st).replace("href", /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), ar = y(/^!?\[(label)\]\[(ref)\]/).replace("label", st).replace("ref", Ft).getRegex(), lr = y(/^!?\[(ref)\](?:\[\])?/).replace("ref", Ft).getRegex(), no = y("reflink|nolink(?!\\()", "g").replace("reflink", ar).replace("nolink", lr).getRegex(), Zt = {
674
+ _backpedal: Ue,
675
+ // only used for GFM url
676
+ anyPunctuation: Qs,
677
+ autolink: Ks,
678
+ blockSkip: Ws,
679
+ br: nr,
680
+ code: Hs,
681
+ del: Ue,
682
+ emStrongLDelim: Zs,
683
+ emStrongRDelimAst: js,
684
+ emStrongRDelimUnd: Xs,
685
+ escape: Bs,
686
+ link: to,
687
+ nolink: lr,
688
+ punctuation: Fs,
689
+ reflink: ar,
690
+ reflinkSearch: no,
691
+ tag: eo,
692
+ text: Us,
693
+ url: Ue
694
+ }, ro = {
695
+ ...Zt,
696
+ link: y(/^!?\[(label)\]\((.*?)\)/).replace("label", st).getRegex(),
697
+ reflink: y(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", st).getRegex()
698
+ }, Nt = {
699
+ ...Zt,
700
+ emStrongRDelimAst: Ys,
701
+ emStrongLDelim: Vs,
702
+ url: y(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, "i").replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
703
+ _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
704
+ del: /^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,
705
+ text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
706
+ }, so = {
707
+ ...Nt,
708
+ br: y(nr).replace("{2,}", "*").getRegex(),
709
+ text: y(Nt.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
710
+ }, et = {
711
+ normal: Gt,
712
+ gfm: zs,
713
+ pedantic: $s
714
+ }, Me = {
715
+ normal: Zt,
716
+ gfm: Nt,
717
+ breaks: so,
718
+ pedantic: ro
719
+ }, oo = {
720
+ "&": "&amp;",
721
+ "<": "&lt;",
722
+ ">": "&gt;",
723
+ '"': "&quot;",
724
+ "'": "&#39;"
725
+ }, An = (o) => oo[o];
726
+ function re(o, e) {
727
+ if (e) {
728
+ if (q.escapeTest.test(o))
729
+ return o.replace(q.escapeReplace, An);
730
+ } else if (q.escapeTestNoEncode.test(o))
731
+ return o.replace(q.escapeReplaceNoEncode, An);
732
+ return o;
733
+ }
734
+ function Rn(o) {
735
+ try {
736
+ o = encodeURI(o).replace(q.percentDecode, "%");
737
+ } catch {
738
+ return null;
739
+ }
740
+ return o;
741
+ }
742
+ function vn(o, e) {
743
+ var r;
744
+ const t = o.replace(q.findPipe, (a, i, p) => {
745
+ let c = !1, u = i;
746
+ for (; --u >= 0 && p[u] === "\\"; )
747
+ c = !c;
748
+ return c ? "|" : " |";
749
+ }), n = t.split(q.splitPipe);
750
+ let s = 0;
751
+ if (n[0].trim() || n.shift(), n.length > 0 && !((r = n.at(-1)) != null && r.trim()) && n.pop(), e)
752
+ if (n.length > e)
753
+ n.splice(e);
754
+ else
755
+ for (; n.length < e; )
756
+ n.push("");
757
+ for (; s < n.length; s++)
758
+ n[s] = n[s].trim().replace(q.slashPipe, "|");
759
+ return n;
760
+ }
761
+ function Oe(o, e, t) {
762
+ const n = o.length;
763
+ if (n === 0)
764
+ return "";
765
+ let s = 0;
766
+ for (; s < n && o.charAt(n - s - 1) === e; )
767
+ s++;
768
+ return o.slice(0, n - s);
769
+ }
770
+ function io(o, e) {
771
+ if (o.indexOf(e[1]) === -1)
772
+ return -1;
773
+ let t = 0;
774
+ for (let n = 0; n < o.length; n++)
775
+ if (o[n] === "\\")
776
+ n++;
777
+ else if (o[n] === e[0])
778
+ t++;
779
+ else if (o[n] === e[1] && (t--, t < 0))
780
+ return n;
781
+ return -1;
782
+ }
783
+ function Ln(o, e, t, n, s) {
784
+ const r = e.href, a = e.title || null, i = o[1].replace(s.other.outputLinkReplace, "$1");
785
+ if (o[0].charAt(0) !== "!") {
786
+ n.state.inLink = !0;
787
+ const p = {
788
+ type: "link",
789
+ raw: t,
790
+ href: r,
791
+ title: a,
792
+ text: i,
793
+ tokens: n.inlineTokens(i)
794
+ };
795
+ return n.state.inLink = !1, p;
796
+ }
797
+ return {
798
+ type: "image",
799
+ raw: t,
800
+ href: r,
801
+ title: a,
802
+ text: i
803
+ };
804
+ }
805
+ function ao(o, e, t) {
806
+ const n = o.match(t.other.indentCodeCompensation);
807
+ if (n === null)
808
+ return e;
809
+ const s = n[1];
810
+ return e.split(`
811
+ `).map((r) => {
812
+ const a = r.match(t.other.beginningSpace);
813
+ if (a === null)
814
+ return r;
815
+ const [i] = a;
816
+ return i.length >= s.length ? r.slice(s.length) : r;
817
+ }).join(`
818
+ `);
819
+ }
820
+ class ot {
821
+ // set by the lexer
822
+ constructor(e) {
823
+ S(this, "options");
824
+ S(this, "rules");
825
+ // set by the lexer
826
+ S(this, "lexer");
827
+ this.options = e || me;
828
+ }
829
+ space(e) {
830
+ const t = this.rules.block.newline.exec(e);
831
+ if (t && t[0].length > 0)
832
+ return {
833
+ type: "space",
834
+ raw: t[0]
835
+ };
836
+ }
837
+ code(e) {
838
+ const t = this.rules.block.code.exec(e);
839
+ if (t) {
840
+ const n = t[0].replace(this.rules.other.codeRemoveIndent, "");
841
+ return {
842
+ type: "code",
843
+ raw: t[0],
844
+ codeBlockStyle: "indented",
845
+ text: this.options.pedantic ? n : Oe(n, `
846
+ `)
847
+ };
848
+ }
849
+ }
850
+ fences(e) {
851
+ const t = this.rules.block.fences.exec(e);
852
+ if (t) {
853
+ const n = t[0], s = ao(n, t[3] || "", this.rules);
854
+ return {
855
+ type: "code",
856
+ raw: n,
857
+ lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2],
858
+ text: s
859
+ };
860
+ }
861
+ }
862
+ heading(e) {
863
+ const t = this.rules.block.heading.exec(e);
864
+ if (t) {
865
+ let n = t[2].trim();
866
+ if (this.rules.other.endingHash.test(n)) {
867
+ const s = Oe(n, "#");
868
+ (this.options.pedantic || !s || this.rules.other.endingSpaceChar.test(s)) && (n = s.trim());
869
+ }
870
+ return {
871
+ type: "heading",
872
+ raw: t[0],
873
+ depth: t[1].length,
874
+ text: n,
875
+ tokens: this.lexer.inline(n)
876
+ };
877
+ }
878
+ }
879
+ hr(e) {
880
+ const t = this.rules.block.hr.exec(e);
881
+ if (t)
882
+ return {
883
+ type: "hr",
884
+ raw: Oe(t[0], `
885
+ `)
886
+ };
887
+ }
888
+ blockquote(e) {
889
+ const t = this.rules.block.blockquote.exec(e);
890
+ if (t) {
891
+ let n = Oe(t[0], `
892
+ `).split(`
893
+ `), s = "", r = "";
894
+ const a = [];
895
+ for (; n.length > 0; ) {
896
+ let i = !1;
897
+ const p = [];
898
+ let c;
899
+ for (c = 0; c < n.length; c++)
900
+ if (this.rules.other.blockquoteStart.test(n[c]))
901
+ p.push(n[c]), i = !0;
902
+ else if (!i)
903
+ p.push(n[c]);
904
+ else
905
+ break;
906
+ n = n.slice(c);
907
+ const u = p.join(`
908
+ `), m = u.replace(this.rules.other.blockquoteSetextReplace, `
909
+ $1`).replace(this.rules.other.blockquoteSetextReplace2, "");
910
+ s = s ? `${s}
911
+ ${u}` : u, r = r ? `${r}
912
+ ${m}` : m;
913
+ const f = this.lexer.state.top;
914
+ if (this.lexer.state.top = !0, this.lexer.blockTokens(m, a, !0), this.lexer.state.top = f, n.length === 0)
915
+ break;
916
+ const g = a.at(-1);
917
+ if ((g == null ? void 0 : g.type) === "code")
918
+ break;
919
+ if ((g == null ? void 0 : g.type) === "blockquote") {
920
+ const x = g, k = x.raw + `
921
+ ` + n.join(`
922
+ `), T = this.blockquote(k);
923
+ a[a.length - 1] = T, s = s.substring(0, s.length - x.raw.length) + T.raw, r = r.substring(0, r.length - x.text.length) + T.text;
924
+ break;
925
+ } else if ((g == null ? void 0 : g.type) === "list") {
926
+ const x = g, k = x.raw + `
927
+ ` + n.join(`
928
+ `), T = this.list(k);
929
+ a[a.length - 1] = T, s = s.substring(0, s.length - g.raw.length) + T.raw, r = r.substring(0, r.length - x.raw.length) + T.raw, n = k.substring(a.at(-1).raw.length).split(`
930
+ `);
931
+ continue;
932
+ }
933
+ }
934
+ return {
935
+ type: "blockquote",
936
+ raw: s,
937
+ tokens: a,
938
+ text: r
939
+ };
940
+ }
941
+ }
942
+ list(e) {
943
+ let t = this.rules.block.list.exec(e);
944
+ if (t) {
945
+ let n = t[1].trim();
946
+ const s = n.length > 1, r = {
947
+ type: "list",
948
+ raw: "",
949
+ ordered: s,
950
+ start: s ? +n.slice(0, -1) : "",
951
+ loose: !1,
952
+ items: []
953
+ };
954
+ n = s ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = s ? n : "[*+-]");
955
+ const a = this.rules.other.listItemRegex(n);
956
+ let i = !1;
957
+ for (; e; ) {
958
+ let c = !1, u = "", m = "";
959
+ if (!(t = a.exec(e)) || this.rules.block.hr.test(e))
960
+ break;
961
+ u = t[0], e = e.substring(u.length);
962
+ let f = t[2].split(`
963
+ `, 1)[0].replace(this.rules.other.listReplaceTabs, (D) => " ".repeat(3 * D.length)), g = e.split(`
964
+ `, 1)[0], x = !f.trim(), k = 0;
965
+ if (this.options.pedantic ? (k = 2, m = f.trimStart()) : x ? k = t[1].length + 1 : (k = t[2].search(this.rules.other.nonSpaceChar), k = k > 4 ? 1 : k, m = f.slice(k), k += t[1].length), x && this.rules.other.blankLine.test(g) && (u += g + `
966
+ `, e = e.substring(g.length + 1), c = !0), !c) {
967
+ const D = this.rules.other.nextBulletRegex(k), K = this.rules.other.hrRegex(k), E = this.rules.other.fencesBeginRegex(k), le = this.rules.other.headingBeginRegex(k), Ee = this.rules.other.htmlBeginRegex(k);
968
+ for (; e; ) {
969
+ const Se = e.split(`
970
+ `, 1)[0];
971
+ let ue;
972
+ if (g = Se, this.options.pedantic ? (g = g.replace(this.rules.other.listReplaceNesting, " "), ue = g) : ue = g.replace(this.rules.other.tabCharGlobal, " "), E.test(g) || le.test(g) || Ee.test(g) || D.test(g) || K.test(g))
973
+ break;
974
+ if (ue.search(this.rules.other.nonSpaceChar) >= k || !g.trim())
975
+ m += `
976
+ ` + ue.slice(k);
977
+ else {
978
+ if (x || f.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || E.test(f) || le.test(f) || K.test(f))
979
+ break;
980
+ m += `
981
+ ` + g;
982
+ }
983
+ !x && !g.trim() && (x = !0), u += Se + `
984
+ `, e = e.substring(Se.length + 1), f = ue.slice(k);
985
+ }
986
+ }
987
+ r.loose || (i ? r.loose = !0 : this.rules.other.doubleBlankLine.test(u) && (i = !0));
988
+ let T = null, Y;
989
+ this.options.gfm && (T = this.rules.other.listIsTask.exec(m), T && (Y = T[0] !== "[ ] ", m = m.replace(this.rules.other.listReplaceTask, ""))), r.items.push({
990
+ type: "list_item",
991
+ raw: u,
992
+ task: !!T,
993
+ checked: Y,
994
+ loose: !1,
995
+ text: m,
996
+ tokens: []
997
+ }), r.raw += u;
998
+ }
999
+ const p = r.items.at(-1);
1000
+ if (p)
1001
+ p.raw = p.raw.trimEnd(), p.text = p.text.trimEnd();
1002
+ else
1003
+ return;
1004
+ r.raw = r.raw.trimEnd();
1005
+ for (let c = 0; c < r.items.length; c++)
1006
+ if (this.lexer.state.top = !1, r.items[c].tokens = this.lexer.blockTokens(r.items[c].text, []), !r.loose) {
1007
+ const u = r.items[c].tokens.filter((f) => f.type === "space"), m = u.length > 0 && u.some((f) => this.rules.other.anyLine.test(f.raw));
1008
+ r.loose = m;
1009
+ }
1010
+ if (r.loose)
1011
+ for (let c = 0; c < r.items.length; c++)
1012
+ r.items[c].loose = !0;
1013
+ return r;
1014
+ }
1015
+ }
1016
+ html(e) {
1017
+ const t = this.rules.block.html.exec(e);
1018
+ if (t)
1019
+ return {
1020
+ type: "html",
1021
+ block: !0,
1022
+ raw: t[0],
1023
+ pre: t[1] === "pre" || t[1] === "script" || t[1] === "style",
1024
+ text: t[0]
1025
+ };
1026
+ }
1027
+ def(e) {
1028
+ const t = this.rules.block.def.exec(e);
1029
+ if (t) {
1030
+ const n = t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), s = 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];
1031
+ return {
1032
+ type: "def",
1033
+ tag: n,
1034
+ raw: t[0],
1035
+ href: s,
1036
+ title: r
1037
+ };
1038
+ }
1039
+ }
1040
+ table(e) {
1041
+ var i;
1042
+ const t = this.rules.block.table.exec(e);
1043
+ if (!t || !this.rules.other.tableDelimiter.test(t[2]))
1044
+ return;
1045
+ const n = vn(t[1]), s = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), r = (i = t[3]) != null && i.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`
1046
+ `) : [], a = {
1047
+ type: "table",
1048
+ raw: t[0],
1049
+ header: [],
1050
+ align: [],
1051
+ rows: []
1052
+ };
1053
+ if (n.length === s.length) {
1054
+ for (const p of s)
1055
+ this.rules.other.tableAlignRight.test(p) ? a.align.push("right") : this.rules.other.tableAlignCenter.test(p) ? a.align.push("center") : this.rules.other.tableAlignLeft.test(p) ? a.align.push("left") : a.align.push(null);
1056
+ for (let p = 0; p < n.length; p++)
1057
+ a.header.push({
1058
+ text: n[p],
1059
+ tokens: this.lexer.inline(n[p]),
1060
+ header: !0,
1061
+ align: a.align[p]
1062
+ });
1063
+ for (const p of r)
1064
+ a.rows.push(vn(p, a.header.length).map((c, u) => ({
1065
+ text: c,
1066
+ tokens: this.lexer.inline(c),
1067
+ header: !1,
1068
+ align: a.align[u]
1069
+ })));
1070
+ return a;
1071
+ }
1072
+ }
1073
+ lheading(e) {
1074
+ const t = this.rules.block.lheading.exec(e);
1075
+ if (t)
1076
+ return {
1077
+ type: "heading",
1078
+ raw: t[0],
1079
+ depth: t[2].charAt(0) === "=" ? 1 : 2,
1080
+ text: t[1],
1081
+ tokens: this.lexer.inline(t[1])
1082
+ };
1083
+ }
1084
+ paragraph(e) {
1085
+ const t = this.rules.block.paragraph.exec(e);
1086
+ if (t) {
1087
+ const n = t[1].charAt(t[1].length - 1) === `
1088
+ ` ? t[1].slice(0, -1) : t[1];
1089
+ return {
1090
+ type: "paragraph",
1091
+ raw: t[0],
1092
+ text: n,
1093
+ tokens: this.lexer.inline(n)
1094
+ };
1095
+ }
1096
+ }
1097
+ text(e) {
1098
+ const t = this.rules.block.text.exec(e);
1099
+ if (t)
1100
+ return {
1101
+ type: "text",
1102
+ raw: t[0],
1103
+ text: t[0],
1104
+ tokens: this.lexer.inline(t[0])
1105
+ };
1106
+ }
1107
+ escape(e) {
1108
+ const t = this.rules.inline.escape.exec(e);
1109
+ if (t)
1110
+ return {
1111
+ type: "escape",
1112
+ raw: t[0],
1113
+ text: t[1]
1114
+ };
1115
+ }
1116
+ tag(e) {
1117
+ const t = this.rules.inline.tag.exec(e);
1118
+ if (t)
1119
+ 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), {
1120
+ type: "html",
1121
+ raw: t[0],
1122
+ inLink: this.lexer.state.inLink,
1123
+ inRawBlock: this.lexer.state.inRawBlock,
1124
+ block: !1,
1125
+ text: t[0]
1126
+ };
1127
+ }
1128
+ link(e) {
1129
+ const t = this.rules.inline.link.exec(e);
1130
+ if (t) {
1131
+ const n = t[2].trim();
1132
+ if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n)) {
1133
+ if (!this.rules.other.endAngleBracket.test(n))
1134
+ return;
1135
+ const a = Oe(n.slice(0, -1), "\\");
1136
+ if ((n.length - a.length) % 2 === 0)
1137
+ return;
1138
+ } else {
1139
+ const a = io(t[2], "()");
1140
+ if (a > -1) {
1141
+ const p = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + a;
1142
+ t[2] = t[2].substring(0, a), t[0] = t[0].substring(0, p).trim(), t[3] = "";
1143
+ }
1144
+ }
1145
+ let s = t[2], r = "";
1146
+ if (this.options.pedantic) {
1147
+ const a = this.rules.other.pedanticHrefTitle.exec(s);
1148
+ a && (s = a[1], r = a[3]);
1149
+ } else
1150
+ r = t[3] ? t[3].slice(1, -1) : "";
1151
+ return s = s.trim(), this.rules.other.startAngleBracket.test(s) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? s = s.slice(1) : s = s.slice(1, -1)), Ln(t, {
1152
+ href: s && s.replace(this.rules.inline.anyPunctuation, "$1"),
1153
+ title: r && r.replace(this.rules.inline.anyPunctuation, "$1")
1154
+ }, t[0], this.lexer, this.rules);
1155
+ }
1156
+ }
1157
+ reflink(e, t) {
1158
+ let n;
1159
+ if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
1160
+ const s = (n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "), r = t[s.toLowerCase()];
1161
+ if (!r) {
1162
+ const a = n[0].charAt(0);
1163
+ return {
1164
+ type: "text",
1165
+ raw: a,
1166
+ text: a
1167
+ };
1168
+ }
1169
+ return Ln(n, r, n[0], this.lexer, this.rules);
1170
+ }
1171
+ }
1172
+ emStrong(e, t, n = "") {
1173
+ let s = this.rules.inline.emStrongLDelim.exec(e);
1174
+ if (!s || s[3] && n.match(this.rules.other.unicodeAlphaNumeric))
1175
+ return;
1176
+ if (!(s[1] || s[2] || "") || !n || this.rules.inline.punctuation.exec(n)) {
1177
+ const a = [...s[0]].length - 1;
1178
+ let i, p, c = a, u = 0;
1179
+ const m = s[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
1180
+ for (m.lastIndex = 0, t = t.slice(-1 * e.length + a); (s = m.exec(t)) != null; ) {
1181
+ if (i = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !i)
1182
+ continue;
1183
+ if (p = [...i].length, s[3] || s[4]) {
1184
+ c += p;
1185
+ continue;
1186
+ } else if ((s[5] || s[6]) && a % 3 && !((a + p) % 3)) {
1187
+ u += p;
1188
+ continue;
1189
+ }
1190
+ if (c -= p, c > 0)
1191
+ continue;
1192
+ p = Math.min(p, p + c + u);
1193
+ const f = [...s[0]][0].length, g = e.slice(0, a + s.index + f + p);
1194
+ if (Math.min(a, p) % 2) {
1195
+ const k = g.slice(1, -1);
1196
+ return {
1197
+ type: "em",
1198
+ raw: g,
1199
+ text: k,
1200
+ tokens: this.lexer.inlineTokens(k)
1201
+ };
1202
+ }
1203
+ const x = g.slice(2, -2);
1204
+ return {
1205
+ type: "strong",
1206
+ raw: g,
1207
+ text: x,
1208
+ tokens: this.lexer.inlineTokens(x)
1209
+ };
1210
+ }
1211
+ }
1212
+ }
1213
+ codespan(e) {
1214
+ const t = this.rules.inline.code.exec(e);
1215
+ if (t) {
1216
+ let n = t[2].replace(this.rules.other.newLineCharGlobal, " ");
1217
+ const s = this.rules.other.nonSpaceChar.test(n), r = this.rules.other.startingSpaceChar.test(n) && this.rules.other.endingSpaceChar.test(n);
1218
+ return s && r && (n = n.substring(1, n.length - 1)), {
1219
+ type: "codespan",
1220
+ raw: t[0],
1221
+ text: n
1222
+ };
1223
+ }
1224
+ }
1225
+ br(e) {
1226
+ const t = this.rules.inline.br.exec(e);
1227
+ if (t)
1228
+ return {
1229
+ type: "br",
1230
+ raw: t[0]
1231
+ };
1232
+ }
1233
+ del(e) {
1234
+ const t = this.rules.inline.del.exec(e);
1235
+ if (t)
1236
+ return {
1237
+ type: "del",
1238
+ raw: t[0],
1239
+ text: t[2],
1240
+ tokens: this.lexer.inlineTokens(t[2])
1241
+ };
1242
+ }
1243
+ autolink(e) {
1244
+ const t = this.rules.inline.autolink.exec(e);
1245
+ if (t) {
1246
+ let n, s;
1247
+ return t[2] === "@" ? (n = t[1], s = "mailto:" + n) : (n = t[1], s = n), {
1248
+ type: "link",
1249
+ raw: t[0],
1250
+ text: n,
1251
+ href: s,
1252
+ tokens: [
1253
+ {
1254
+ type: "text",
1255
+ raw: n,
1256
+ text: n
1257
+ }
1258
+ ]
1259
+ };
1260
+ }
1261
+ }
1262
+ url(e) {
1263
+ var n;
1264
+ let t;
1265
+ if (t = this.rules.inline.url.exec(e)) {
1266
+ let s, r;
1267
+ if (t[2] === "@")
1268
+ s = t[0], r = "mailto:" + s;
1269
+ else {
1270
+ let a;
1271
+ do
1272
+ a = t[0], t[0] = ((n = this.rules.inline._backpedal.exec(t[0])) == null ? void 0 : n[0]) ?? "";
1273
+ while (a !== t[0]);
1274
+ s = t[0], t[1] === "www." ? r = "http://" + t[0] : r = t[0];
1275
+ }
1276
+ return {
1277
+ type: "link",
1278
+ raw: t[0],
1279
+ text: s,
1280
+ href: r,
1281
+ tokens: [
1282
+ {
1283
+ type: "text",
1284
+ raw: s,
1285
+ text: s
1286
+ }
1287
+ ]
1288
+ };
1289
+ }
1290
+ }
1291
+ inlineText(e) {
1292
+ const t = this.rules.inline.text.exec(e);
1293
+ if (t) {
1294
+ const n = this.lexer.state.inRawBlock;
1295
+ return {
1296
+ type: "text",
1297
+ raw: t[0],
1298
+ text: t[0],
1299
+ escaped: n
1300
+ };
1301
+ }
1302
+ }
1303
+ }
1304
+ class j {
1305
+ constructor(e) {
1306
+ S(this, "tokens");
1307
+ S(this, "options");
1308
+ S(this, "state");
1309
+ S(this, "tokenizer");
1310
+ S(this, "inlineQueue");
1311
+ this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || me, this.options.tokenizer = this.options.tokenizer || new ot(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
1312
+ inLink: !1,
1313
+ inRawBlock: !1,
1314
+ top: !0
1315
+ };
1316
+ const t = {
1317
+ other: q,
1318
+ block: et.normal,
1319
+ inline: Me.normal
1320
+ };
1321
+ this.options.pedantic ? (t.block = et.pedantic, t.inline = Me.pedantic) : this.options.gfm && (t.block = et.gfm, this.options.breaks ? t.inline = Me.breaks : t.inline = Me.gfm), this.tokenizer.rules = t;
1322
+ }
1323
+ /**
1324
+ * Expose Rules
1325
+ */
1326
+ static get rules() {
1327
+ return {
1328
+ block: et,
1329
+ inline: Me
1330
+ };
1331
+ }
1332
+ /**
1333
+ * Static Lex Method
1334
+ */
1335
+ static lex(e, t) {
1336
+ return new j(t).lex(e);
1337
+ }
1338
+ /**
1339
+ * Static Lex Inline Method
1340
+ */
1341
+ static lexInline(e, t) {
1342
+ return new j(t).inlineTokens(e);
1343
+ }
1344
+ /**
1345
+ * Preprocessing
1346
+ */
1347
+ lex(e) {
1348
+ e = e.replace(q.carriageReturn, `
1349
+ `), this.blockTokens(e, this.tokens);
1350
+ for (let t = 0; t < this.inlineQueue.length; t++) {
1351
+ const n = this.inlineQueue[t];
1352
+ this.inlineTokens(n.src, n.tokens);
1353
+ }
1354
+ return this.inlineQueue = [], this.tokens;
1355
+ }
1356
+ blockTokens(e, t = [], n = !1) {
1357
+ var s, r, a;
1358
+ for (this.options.pedantic && (e = e.replace(q.tabCharGlobal, " ").replace(q.spaceLine, "")); e; ) {
1359
+ let i;
1360
+ if ((r = (s = this.options.extensions) == null ? void 0 : s.block) != null && r.some((c) => (i = c.call({ lexer: this }, e, t)) ? (e = e.substring(i.raw.length), t.push(i), !0) : !1))
1361
+ continue;
1362
+ if (i = this.tokenizer.space(e)) {
1363
+ e = e.substring(i.raw.length);
1364
+ const c = t.at(-1);
1365
+ i.raw.length === 1 && c !== void 0 ? c.raw += `
1366
+ ` : t.push(i);
1367
+ continue;
1368
+ }
1369
+ if (i = this.tokenizer.code(e)) {
1370
+ e = e.substring(i.raw.length);
1371
+ const c = t.at(-1);
1372
+ (c == null ? void 0 : c.type) === "paragraph" || (c == null ? void 0 : c.type) === "text" ? (c.raw += `
1373
+ ` + i.raw, c.text += `
1374
+ ` + i.text, this.inlineQueue.at(-1).src = c.text) : t.push(i);
1375
+ continue;
1376
+ }
1377
+ if (i = this.tokenizer.fences(e)) {
1378
+ e = e.substring(i.raw.length), t.push(i);
1379
+ continue;
1380
+ }
1381
+ if (i = this.tokenizer.heading(e)) {
1382
+ e = e.substring(i.raw.length), t.push(i);
1383
+ continue;
1384
+ }
1385
+ if (i = this.tokenizer.hr(e)) {
1386
+ e = e.substring(i.raw.length), t.push(i);
1387
+ continue;
1388
+ }
1389
+ if (i = this.tokenizer.blockquote(e)) {
1390
+ e = e.substring(i.raw.length), t.push(i);
1391
+ continue;
1392
+ }
1393
+ if (i = this.tokenizer.list(e)) {
1394
+ e = e.substring(i.raw.length), t.push(i);
1395
+ continue;
1396
+ }
1397
+ if (i = this.tokenizer.html(e)) {
1398
+ e = e.substring(i.raw.length), t.push(i);
1399
+ continue;
1400
+ }
1401
+ if (i = this.tokenizer.def(e)) {
1402
+ e = e.substring(i.raw.length);
1403
+ const c = t.at(-1);
1404
+ (c == null ? void 0 : c.type) === "paragraph" || (c == null ? void 0 : c.type) === "text" ? (c.raw += `
1405
+ ` + i.raw, c.text += `
1406
+ ` + i.raw, this.inlineQueue.at(-1).src = c.text) : this.tokens.links[i.tag] || (this.tokens.links[i.tag] = {
1407
+ href: i.href,
1408
+ title: i.title
1409
+ });
1410
+ continue;
1411
+ }
1412
+ if (i = this.tokenizer.table(e)) {
1413
+ e = e.substring(i.raw.length), t.push(i);
1414
+ continue;
1415
+ }
1416
+ if (i = this.tokenizer.lheading(e)) {
1417
+ e = e.substring(i.raw.length), t.push(i);
1418
+ continue;
1419
+ }
1420
+ let p = e;
1421
+ if ((a = this.options.extensions) != null && a.startBlock) {
1422
+ let c = 1 / 0;
1423
+ const u = e.slice(1);
1424
+ let m;
1425
+ this.options.extensions.startBlock.forEach((f) => {
1426
+ m = f.call({ lexer: this }, u), typeof m == "number" && m >= 0 && (c = Math.min(c, m));
1427
+ }), c < 1 / 0 && c >= 0 && (p = e.substring(0, c + 1));
1428
+ }
1429
+ if (this.state.top && (i = this.tokenizer.paragraph(p))) {
1430
+ const c = t.at(-1);
1431
+ n && (c == null ? void 0 : c.type) === "paragraph" ? (c.raw += `
1432
+ ` + i.raw, c.text += `
1433
+ ` + i.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = c.text) : t.push(i), n = p.length !== e.length, e = e.substring(i.raw.length);
1434
+ continue;
1435
+ }
1436
+ if (i = this.tokenizer.text(e)) {
1437
+ e = e.substring(i.raw.length);
1438
+ const c = t.at(-1);
1439
+ (c == null ? void 0 : c.type) === "text" ? (c.raw += `
1440
+ ` + i.raw, c.text += `
1441
+ ` + i.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = c.text) : t.push(i);
1442
+ continue;
1443
+ }
1444
+ if (e) {
1445
+ const c = "Infinite loop on byte: " + e.charCodeAt(0);
1446
+ if (this.options.silent) {
1447
+ console.error(c);
1448
+ break;
1449
+ } else
1450
+ throw new Error(c);
1451
+ }
1452
+ }
1453
+ return this.state.top = !0, t;
1454
+ }
1455
+ inline(e, t = []) {
1456
+ return this.inlineQueue.push({ src: e, tokens: t }), t;
1457
+ }
1458
+ /**
1459
+ * Lexing/Compiling
1460
+ */
1461
+ inlineTokens(e, t = []) {
1462
+ var i, p, c;
1463
+ let n = e, s = null;
1464
+ if (this.tokens.links) {
1465
+ const u = Object.keys(this.tokens.links);
1466
+ if (u.length > 0)
1467
+ for (; (s = this.tokenizer.rules.inline.reflinkSearch.exec(n)) != null; )
1468
+ u.includes(s[0].slice(s[0].lastIndexOf("[") + 1, -1)) && (n = n.slice(0, s.index) + "[" + "a".repeat(s[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
1469
+ }
1470
+ for (; (s = this.tokenizer.rules.inline.anyPunctuation.exec(n)) != null; )
1471
+ n = n.slice(0, s.index) + "++" + n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
1472
+ for (; (s = this.tokenizer.rules.inline.blockSkip.exec(n)) != null; )
1473
+ n = n.slice(0, s.index) + "[" + "a".repeat(s[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
1474
+ let r = !1, a = "";
1475
+ for (; e; ) {
1476
+ r || (a = ""), r = !1;
1477
+ let u;
1478
+ if ((p = (i = this.options.extensions) == null ? void 0 : i.inline) != null && p.some((f) => (u = f.call({ lexer: this }, e, t)) ? (e = e.substring(u.raw.length), t.push(u), !0) : !1))
1479
+ continue;
1480
+ if (u = this.tokenizer.escape(e)) {
1481
+ e = e.substring(u.raw.length), t.push(u);
1482
+ continue;
1483
+ }
1484
+ if (u = this.tokenizer.tag(e)) {
1485
+ e = e.substring(u.raw.length), t.push(u);
1486
+ continue;
1487
+ }
1488
+ if (u = this.tokenizer.link(e)) {
1489
+ e = e.substring(u.raw.length), t.push(u);
1490
+ continue;
1491
+ }
1492
+ if (u = this.tokenizer.reflink(e, this.tokens.links)) {
1493
+ e = e.substring(u.raw.length);
1494
+ const f = t.at(-1);
1495
+ u.type === "text" && (f == null ? void 0 : f.type) === "text" ? (f.raw += u.raw, f.text += u.text) : t.push(u);
1496
+ continue;
1497
+ }
1498
+ if (u = this.tokenizer.emStrong(e, n, a)) {
1499
+ e = e.substring(u.raw.length), t.push(u);
1500
+ continue;
1501
+ }
1502
+ if (u = this.tokenizer.codespan(e)) {
1503
+ e = e.substring(u.raw.length), t.push(u);
1504
+ continue;
1505
+ }
1506
+ if (u = this.tokenizer.br(e)) {
1507
+ e = e.substring(u.raw.length), t.push(u);
1508
+ continue;
1509
+ }
1510
+ if (u = this.tokenizer.del(e)) {
1511
+ e = e.substring(u.raw.length), t.push(u);
1512
+ continue;
1513
+ }
1514
+ if (u = this.tokenizer.autolink(e)) {
1515
+ e = e.substring(u.raw.length), t.push(u);
1516
+ continue;
1517
+ }
1518
+ if (!this.state.inLink && (u = this.tokenizer.url(e))) {
1519
+ e = e.substring(u.raw.length), t.push(u);
1520
+ continue;
1521
+ }
1522
+ let m = e;
1523
+ if ((c = this.options.extensions) != null && c.startInline) {
1524
+ let f = 1 / 0;
1525
+ const g = e.slice(1);
1526
+ let x;
1527
+ this.options.extensions.startInline.forEach((k) => {
1528
+ x = k.call({ lexer: this }, g), typeof x == "number" && x >= 0 && (f = Math.min(f, x));
1529
+ }), f < 1 / 0 && f >= 0 && (m = e.substring(0, f + 1));
1530
+ }
1531
+ if (u = this.tokenizer.inlineText(m)) {
1532
+ e = e.substring(u.raw.length), u.raw.slice(-1) !== "_" && (a = u.raw.slice(-1)), r = !0;
1533
+ const f = t.at(-1);
1534
+ (f == null ? void 0 : f.type) === "text" ? (f.raw += u.raw, f.text += u.text) : t.push(u);
1535
+ continue;
1536
+ }
1537
+ if (e) {
1538
+ const f = "Infinite loop on byte: " + e.charCodeAt(0);
1539
+ if (this.options.silent) {
1540
+ console.error(f);
1541
+ break;
1542
+ } else
1543
+ throw new Error(f);
1544
+ }
1545
+ }
1546
+ return t;
1547
+ }
1548
+ }
1549
+ class it {
1550
+ // set by the parser
1551
+ constructor(e) {
1552
+ S(this, "options");
1553
+ S(this, "parser");
1554
+ this.options = e || me;
1555
+ }
1556
+ space(e) {
1557
+ return "";
1558
+ }
1559
+ code({ text: e, lang: t, escaped: n }) {
1560
+ var a;
1561
+ const s = (a = (t || "").match(q.notSpaceStart)) == null ? void 0 : a[0], r = e.replace(q.endingNewline, "") + `
1562
+ `;
1563
+ return s ? '<pre><code class="language-' + re(s) + '">' + (n ? r : re(r, !0)) + `</code></pre>
1564
+ ` : "<pre><code>" + (n ? r : re(r, !0)) + `</code></pre>
1565
+ `;
1566
+ }
1567
+ blockquote({ tokens: e }) {
1568
+ return `<blockquote>
1569
+ ${this.parser.parse(e)}</blockquote>
1570
+ `;
1571
+ }
1572
+ html({ text: e }) {
1573
+ return e;
1574
+ }
1575
+ heading({ tokens: e, depth: t }) {
1576
+ return `<h${t}>${this.parser.parseInline(e)}</h${t}>
1577
+ `;
1578
+ }
1579
+ hr(e) {
1580
+ return `<hr>
1581
+ `;
1582
+ }
1583
+ list(e) {
1584
+ const t = e.ordered, n = e.start;
1585
+ let s = "";
1586
+ for (let i = 0; i < e.items.length; i++) {
1587
+ const p = e.items[i];
1588
+ s += this.listitem(p);
1589
+ }
1590
+ const r = t ? "ol" : "ul", a = t && n !== 1 ? ' start="' + n + '"' : "";
1591
+ return "<" + r + a + `>
1592
+ ` + s + "</" + r + `>
1593
+ `;
1594
+ }
1595
+ listitem(e) {
1596
+ var n;
1597
+ let t = "";
1598
+ if (e.task) {
1599
+ const s = this.checkbox({ checked: !!e.checked });
1600
+ e.loose ? ((n = e.tokens[0]) == null ? void 0 : n.type) === "paragraph" ? (e.tokens[0].text = s + " " + e.tokens[0].text, e.tokens[0].tokens && e.tokens[0].tokens.length > 0 && e.tokens[0].tokens[0].type === "text" && (e.tokens[0].tokens[0].text = s + " " + re(e.tokens[0].tokens[0].text), e.tokens[0].tokens[0].escaped = !0)) : e.tokens.unshift({
1601
+ type: "text",
1602
+ raw: s + " ",
1603
+ text: s + " ",
1604
+ escaped: !0
1605
+ }) : t += s + " ";
1606
+ }
1607
+ return t += this.parser.parse(e.tokens, !!e.loose), `<li>${t}</li>
1608
+ `;
1609
+ }
1610
+ checkbox({ checked: e }) {
1611
+ return "<input " + (e ? 'checked="" ' : "") + 'disabled="" type="checkbox">';
1612
+ }
1613
+ paragraph({ tokens: e }) {
1614
+ return `<p>${this.parser.parseInline(e)}</p>
1615
+ `;
1616
+ }
1617
+ table(e) {
1618
+ let t = "", n = "";
1619
+ for (let r = 0; r < e.header.length; r++)
1620
+ n += this.tablecell(e.header[r]);
1621
+ t += this.tablerow({ text: n });
1622
+ let s = "";
1623
+ for (let r = 0; r < e.rows.length; r++) {
1624
+ const a = e.rows[r];
1625
+ n = "";
1626
+ for (let i = 0; i < a.length; i++)
1627
+ n += this.tablecell(a[i]);
1628
+ s += this.tablerow({ text: n });
1629
+ }
1630
+ return s && (s = `<tbody>${s}</tbody>`), `<table>
1631
+ <thead>
1632
+ ` + t + `</thead>
1633
+ ` + s + `</table>
1634
+ `;
1635
+ }
1636
+ tablerow({ text: e }) {
1637
+ return `<tr>
1638
+ ${e}</tr>
1639
+ `;
1640
+ }
1641
+ tablecell(e) {
1642
+ const t = this.parser.parseInline(e.tokens), n = e.header ? "th" : "td";
1643
+ return (e.align ? `<${n} align="${e.align}">` : `<${n}>`) + t + `</${n}>
1644
+ `;
1645
+ }
1646
+ /**
1647
+ * span level renderer
1648
+ */
1649
+ strong({ tokens: e }) {
1650
+ return `<strong>${this.parser.parseInline(e)}</strong>`;
1651
+ }
1652
+ em({ tokens: e }) {
1653
+ return `<em>${this.parser.parseInline(e)}</em>`;
1654
+ }
1655
+ codespan({ text: e }) {
1656
+ return `<code>${re(e, !0)}</code>`;
1657
+ }
1658
+ br(e) {
1659
+ return "<br>";
1660
+ }
1661
+ del({ tokens: e }) {
1662
+ return `<del>${this.parser.parseInline(e)}</del>`;
1663
+ }
1664
+ link({ href: e, title: t, tokens: n }) {
1665
+ const s = this.parser.parseInline(n), r = Rn(e);
1666
+ if (r === null)
1667
+ return s;
1668
+ e = r;
1669
+ let a = '<a href="' + e + '"';
1670
+ return t && (a += ' title="' + re(t) + '"'), a += ">" + s + "</a>", a;
1671
+ }
1672
+ image({ href: e, title: t, text: n }) {
1673
+ const s = Rn(e);
1674
+ if (s === null)
1675
+ return re(n);
1676
+ e = s;
1677
+ let r = `<img src="${e}" alt="${n}"`;
1678
+ return t && (r += ` title="${re(t)}"`), r += ">", r;
1679
+ }
1680
+ text(e) {
1681
+ return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : re(e.text);
1682
+ }
1683
+ }
1684
+ class Vt {
1685
+ // no need for block level renderers
1686
+ strong({ text: e }) {
1687
+ return e;
1688
+ }
1689
+ em({ text: e }) {
1690
+ return e;
1691
+ }
1692
+ codespan({ text: e }) {
1693
+ return e;
1694
+ }
1695
+ del({ text: e }) {
1696
+ return e;
1697
+ }
1698
+ html({ text: e }) {
1699
+ return e;
1700
+ }
1701
+ text({ text: e }) {
1702
+ return e;
1703
+ }
1704
+ link({ text: e }) {
1705
+ return "" + e;
1706
+ }
1707
+ image({ text: e }) {
1708
+ return "" + e;
1709
+ }
1710
+ br() {
1711
+ return "";
1712
+ }
1713
+ }
1714
+ class X {
1715
+ constructor(e) {
1716
+ S(this, "options");
1717
+ S(this, "renderer");
1718
+ S(this, "textRenderer");
1719
+ this.options = e || me, this.options.renderer = this.options.renderer || new it(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new Vt();
1720
+ }
1721
+ /**
1722
+ * Static Parse Method
1723
+ */
1724
+ static parse(e, t) {
1725
+ return new X(t).parse(e);
1726
+ }
1727
+ /**
1728
+ * Static Parse Inline Method
1729
+ */
1730
+ static parseInline(e, t) {
1731
+ return new X(t).parseInline(e);
1732
+ }
1733
+ /**
1734
+ * Parse Loop
1735
+ */
1736
+ parse(e, t = !0) {
1737
+ var s, r;
1738
+ let n = "";
1739
+ for (let a = 0; a < e.length; a++) {
1740
+ const i = e[a];
1741
+ if ((r = (s = this.options.extensions) == null ? void 0 : s.renderers) != null && r[i.type]) {
1742
+ const c = i, u = this.options.extensions.renderers[c.type].call({ parser: this }, c);
1743
+ if (u !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(c.type)) {
1744
+ n += u || "";
1745
+ continue;
1746
+ }
1747
+ }
1748
+ const p = i;
1749
+ switch (p.type) {
1750
+ case "space": {
1751
+ n += this.renderer.space(p);
1752
+ continue;
1753
+ }
1754
+ case "hr": {
1755
+ n += this.renderer.hr(p);
1756
+ continue;
1757
+ }
1758
+ case "heading": {
1759
+ n += this.renderer.heading(p);
1760
+ continue;
1761
+ }
1762
+ case "code": {
1763
+ n += this.renderer.code(p);
1764
+ continue;
1765
+ }
1766
+ case "table": {
1767
+ n += this.renderer.table(p);
1768
+ continue;
1769
+ }
1770
+ case "blockquote": {
1771
+ n += this.renderer.blockquote(p);
1772
+ continue;
1773
+ }
1774
+ case "list": {
1775
+ n += this.renderer.list(p);
1776
+ continue;
1777
+ }
1778
+ case "html": {
1779
+ n += this.renderer.html(p);
1780
+ continue;
1781
+ }
1782
+ case "paragraph": {
1783
+ n += this.renderer.paragraph(p);
1784
+ continue;
1785
+ }
1786
+ case "text": {
1787
+ let c = p, u = this.renderer.text(c);
1788
+ for (; a + 1 < e.length && e[a + 1].type === "text"; )
1789
+ c = e[++a], u += `
1790
+ ` + this.renderer.text(c);
1791
+ t ? n += this.renderer.paragraph({
1792
+ type: "paragraph",
1793
+ raw: u,
1794
+ text: u,
1795
+ tokens: [{ type: "text", raw: u, text: u, escaped: !0 }]
1796
+ }) : n += u;
1797
+ continue;
1798
+ }
1799
+ default: {
1800
+ const c = 'Token with "' + p.type + '" type was not found.';
1801
+ if (this.options.silent)
1802
+ return console.error(c), "";
1803
+ throw new Error(c);
1804
+ }
1805
+ }
1806
+ }
1807
+ return n;
1808
+ }
1809
+ /**
1810
+ * Parse Inline Tokens
1811
+ */
1812
+ parseInline(e, t = this.renderer) {
1813
+ var s, r;
1814
+ let n = "";
1815
+ for (let a = 0; a < e.length; a++) {
1816
+ const i = e[a];
1817
+ if ((r = (s = this.options.extensions) == null ? void 0 : s.renderers) != null && r[i.type]) {
1818
+ const c = this.options.extensions.renderers[i.type].call({ parser: this }, i);
1819
+ if (c !== !1 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(i.type)) {
1820
+ n += c || "";
1821
+ continue;
1822
+ }
1823
+ }
1824
+ const p = i;
1825
+ switch (p.type) {
1826
+ case "escape": {
1827
+ n += t.text(p);
1828
+ break;
1829
+ }
1830
+ case "html": {
1831
+ n += t.html(p);
1832
+ break;
1833
+ }
1834
+ case "link": {
1835
+ n += t.link(p);
1836
+ break;
1837
+ }
1838
+ case "image": {
1839
+ n += t.image(p);
1840
+ break;
1841
+ }
1842
+ case "strong": {
1843
+ n += t.strong(p);
1844
+ break;
1845
+ }
1846
+ case "em": {
1847
+ n += t.em(p);
1848
+ break;
1849
+ }
1850
+ case "codespan": {
1851
+ n += t.codespan(p);
1852
+ break;
1853
+ }
1854
+ case "br": {
1855
+ n += t.br(p);
1856
+ break;
1857
+ }
1858
+ case "del": {
1859
+ n += t.del(p);
1860
+ break;
1861
+ }
1862
+ case "text": {
1863
+ n += t.text(p);
1864
+ break;
1865
+ }
1866
+ default: {
1867
+ const c = 'Token with "' + p.type + '" type was not found.';
1868
+ if (this.options.silent)
1869
+ return console.error(c), "";
1870
+ throw new Error(c);
1871
+ }
1872
+ }
1873
+ }
1874
+ return n;
1875
+ }
1876
+ }
1877
+ class Fe {
1878
+ constructor(e) {
1879
+ S(this, "options");
1880
+ S(this, "block");
1881
+ this.options = e || me;
1882
+ }
1883
+ /**
1884
+ * Process markdown before marked
1885
+ */
1886
+ preprocess(e) {
1887
+ return e;
1888
+ }
1889
+ /**
1890
+ * Process HTML after marked is finished
1891
+ */
1892
+ postprocess(e) {
1893
+ return e;
1894
+ }
1895
+ /**
1896
+ * Process all tokens before walk tokens
1897
+ */
1898
+ processAllTokens(e) {
1899
+ return e;
1900
+ }
1901
+ /**
1902
+ * Provide function to tokenize markdown
1903
+ */
1904
+ provideLexer() {
1905
+ return this.block ? j.lex : j.lexInline;
1906
+ }
1907
+ /**
1908
+ * Provide function to parse tokens
1909
+ */
1910
+ provideParser() {
1911
+ return this.block ? X.parse : X.parseInline;
1912
+ }
1913
+ }
1914
+ S(Fe, "passThroughHooks", /* @__PURE__ */ new Set([
1915
+ "preprocess",
1916
+ "postprocess",
1917
+ "processAllTokens"
1918
+ ]));
1919
+ class lo {
1920
+ constructor(...e) {
1921
+ S(this, "defaults", Bt());
1922
+ S(this, "options", this.setOptions);
1923
+ S(this, "parse", this.parseMarkdown(!0));
1924
+ S(this, "parseInline", this.parseMarkdown(!1));
1925
+ S(this, "Parser", X);
1926
+ S(this, "Renderer", it);
1927
+ S(this, "TextRenderer", Vt);
1928
+ S(this, "Lexer", j);
1929
+ S(this, "Tokenizer", ot);
1930
+ S(this, "Hooks", Fe);
1931
+ this.use(...e);
1932
+ }
1933
+ /**
1934
+ * Run callback for every token
1935
+ */
1936
+ walkTokens(e, t) {
1937
+ var s, r;
1938
+ let n = [];
1939
+ for (const a of e)
1940
+ switch (n = n.concat(t.call(this, a)), a.type) {
1941
+ case "table": {
1942
+ const i = a;
1943
+ for (const p of i.header)
1944
+ n = n.concat(this.walkTokens(p.tokens, t));
1945
+ for (const p of i.rows)
1946
+ for (const c of p)
1947
+ n = n.concat(this.walkTokens(c.tokens, t));
1948
+ break;
1949
+ }
1950
+ case "list": {
1951
+ const i = a;
1952
+ n = n.concat(this.walkTokens(i.items, t));
1953
+ break;
1954
+ }
1955
+ default: {
1956
+ const i = a;
1957
+ (r = (s = this.defaults.extensions) == null ? void 0 : s.childTokens) != null && r[i.type] ? this.defaults.extensions.childTokens[i.type].forEach((p) => {
1958
+ const c = i[p].flat(1 / 0);
1959
+ n = n.concat(this.walkTokens(c, t));
1960
+ }) : i.tokens && (n = n.concat(this.walkTokens(i.tokens, t)));
1961
+ }
1962
+ }
1963
+ return n;
1964
+ }
1965
+ use(...e) {
1966
+ const t = this.defaults.extensions || { renderers: {}, childTokens: {} };
1967
+ return e.forEach((n) => {
1968
+ const s = { ...n };
1969
+ if (s.async = this.defaults.async || s.async || !1, n.extensions && (n.extensions.forEach((r) => {
1970
+ if (!r.name)
1971
+ throw new Error("extension name required");
1972
+ if ("renderer" in r) {
1973
+ const a = t.renderers[r.name];
1974
+ a ? t.renderers[r.name] = function(...i) {
1975
+ let p = r.renderer.apply(this, i);
1976
+ return p === !1 && (p = a.apply(this, i)), p;
1977
+ } : t.renderers[r.name] = r.renderer;
1978
+ }
1979
+ if ("tokenizer" in r) {
1980
+ if (!r.level || r.level !== "block" && r.level !== "inline")
1981
+ throw new Error("extension level must be 'block' or 'inline'");
1982
+ const a = t[r.level];
1983
+ a ? a.unshift(r.tokenizer) : t[r.level] = [r.tokenizer], r.start && (r.level === "block" ? t.startBlock ? t.startBlock.push(r.start) : t.startBlock = [r.start] : r.level === "inline" && (t.startInline ? t.startInline.push(r.start) : t.startInline = [r.start]));
1984
+ }
1985
+ "childTokens" in r && r.childTokens && (t.childTokens[r.name] = r.childTokens);
1986
+ }), s.extensions = t), n.renderer) {
1987
+ const r = this.defaults.renderer || new it(this.defaults);
1988
+ for (const a in n.renderer) {
1989
+ if (!(a in r))
1990
+ throw new Error(`renderer '${a}' does not exist`);
1991
+ if (["options", "parser"].includes(a))
1992
+ continue;
1993
+ const i = a, p = n.renderer[i], c = r[i];
1994
+ r[i] = (...u) => {
1995
+ let m = p.apply(r, u);
1996
+ return m === !1 && (m = c.apply(r, u)), m || "";
1997
+ };
1998
+ }
1999
+ s.renderer = r;
2000
+ }
2001
+ if (n.tokenizer) {
2002
+ const r = this.defaults.tokenizer || new ot(this.defaults);
2003
+ for (const a in n.tokenizer) {
2004
+ if (!(a in r))
2005
+ throw new Error(`tokenizer '${a}' does not exist`);
2006
+ if (["options", "rules", "lexer"].includes(a))
2007
+ continue;
2008
+ const i = a, p = n.tokenizer[i], c = r[i];
2009
+ r[i] = (...u) => {
2010
+ let m = p.apply(r, u);
2011
+ return m === !1 && (m = c.apply(r, u)), m;
2012
+ };
2013
+ }
2014
+ s.tokenizer = r;
2015
+ }
2016
+ if (n.hooks) {
2017
+ const r = this.defaults.hooks || new Fe();
2018
+ for (const a in n.hooks) {
2019
+ if (!(a in r))
2020
+ throw new Error(`hook '${a}' does not exist`);
2021
+ if (["options", "block"].includes(a))
2022
+ continue;
2023
+ const i = a, p = n.hooks[i], c = r[i];
2024
+ Fe.passThroughHooks.has(a) ? r[i] = (u) => {
2025
+ if (this.defaults.async)
2026
+ return Promise.resolve(p.call(r, u)).then((f) => c.call(r, f));
2027
+ const m = p.call(r, u);
2028
+ return c.call(r, m);
2029
+ } : r[i] = (...u) => {
2030
+ let m = p.apply(r, u);
2031
+ return m === !1 && (m = c.apply(r, u)), m;
2032
+ };
2033
+ }
2034
+ s.hooks = r;
2035
+ }
2036
+ if (n.walkTokens) {
2037
+ const r = this.defaults.walkTokens, a = n.walkTokens;
2038
+ s.walkTokens = function(i) {
2039
+ let p = [];
2040
+ return p.push(a.call(this, i)), r && (p = p.concat(r.call(this, i))), p;
2041
+ };
2042
+ }
2043
+ this.defaults = { ...this.defaults, ...s };
2044
+ }), this;
2045
+ }
2046
+ setOptions(e) {
2047
+ return this.defaults = { ...this.defaults, ...e }, this;
2048
+ }
2049
+ lexer(e, t) {
2050
+ return j.lex(e, t ?? this.defaults);
2051
+ }
2052
+ parser(e, t) {
2053
+ return X.parse(e, t ?? this.defaults);
2054
+ }
2055
+ parseMarkdown(e) {
2056
+ return (n, s) => {
2057
+ const r = { ...s }, a = { ...this.defaults, ...r }, i = this.onError(!!a.silent, !!a.async);
2058
+ if (this.defaults.async === !0 && r.async === !1)
2059
+ return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
2060
+ if (typeof n > "u" || n === null)
2061
+ return i(new Error("marked(): input parameter is undefined or null"));
2062
+ if (typeof n != "string")
2063
+ return i(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
2064
+ a.hooks && (a.hooks.options = a, a.hooks.block = e);
2065
+ const p = a.hooks ? a.hooks.provideLexer() : e ? j.lex : j.lexInline, c = a.hooks ? a.hooks.provideParser() : e ? X.parse : X.parseInline;
2066
+ if (a.async)
2067
+ return Promise.resolve(a.hooks ? a.hooks.preprocess(n) : n).then((u) => p(u, a)).then((u) => a.hooks ? a.hooks.processAllTokens(u) : u).then((u) => a.walkTokens ? Promise.all(this.walkTokens(u, a.walkTokens)).then(() => u) : u).then((u) => c(u, a)).then((u) => a.hooks ? a.hooks.postprocess(u) : u).catch(i);
2068
+ try {
2069
+ a.hooks && (n = a.hooks.preprocess(n));
2070
+ let u = p(n, a);
2071
+ a.hooks && (u = a.hooks.processAllTokens(u)), a.walkTokens && this.walkTokens(u, a.walkTokens);
2072
+ let m = c(u, a);
2073
+ return a.hooks && (m = a.hooks.postprocess(m)), m;
2074
+ } catch (u) {
2075
+ return i(u);
2076
+ }
2077
+ };
2078
+ }
2079
+ onError(e, t) {
2080
+ return (n) => {
2081
+ if (n.message += `
2082
+ Please report this to https://github.com/markedjs/marked.`, e) {
2083
+ const s = "<p>An error occurred:</p><pre>" + re(n.message + "", !0) + "</pre>";
2084
+ return t ? Promise.resolve(s) : s;
2085
+ }
2086
+ if (t)
2087
+ return Promise.reject(n);
2088
+ throw n;
2089
+ };
2090
+ }
2091
+ }
2092
+ const de = new lo();
2093
+ function C(o, e) {
2094
+ return de.parse(o, e);
2095
+ }
2096
+ C.options = C.setOptions = function(o) {
2097
+ return de.setOptions(o), C.defaults = de.defaults, Kn(C.defaults), C;
2098
+ };
2099
+ C.getDefaults = Bt;
2100
+ C.defaults = me;
2101
+ C.use = function(...o) {
2102
+ return de.use(...o), C.defaults = de.defaults, Kn(C.defaults), C;
2103
+ };
2104
+ C.walkTokens = function(o, e) {
2105
+ return de.walkTokens(o, e);
2106
+ };
2107
+ C.parseInline = de.parseInline;
2108
+ C.Parser = X;
2109
+ C.parser = X.parse;
2110
+ C.Renderer = it;
2111
+ C.TextRenderer = Vt;
2112
+ C.Lexer = j;
2113
+ C.lexer = j.lex;
2114
+ C.Tokenizer = ot;
2115
+ C.Hooks = Fe;
2116
+ C.parse = C;
2117
+ C.options;
2118
+ C.setOptions;
2119
+ C.use;
2120
+ C.walkTokens;
2121
+ C.parseInline;
2122
+ X.parse;
2123
+ j.lex;
2124
+ /*! @license DOMPurify 3.2.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.5/LICENSE */
2125
+ const {
2126
+ entries: cr,
2127
+ setPrototypeOf: In,
2128
+ isFrozen: co,
2129
+ getPrototypeOf: uo,
2130
+ getOwnPropertyDescriptor: po
2131
+ } = Object;
2132
+ let {
2133
+ freeze: G,
2134
+ seal: Q,
2135
+ create: ur
2136
+ } = Object, {
2137
+ apply: Mt,
2138
+ construct: Ot
2139
+ } = typeof Reflect < "u" && Reflect;
2140
+ G || (G = function(e) {
2141
+ return e;
2142
+ });
2143
+ Q || (Q = function(e) {
2144
+ return e;
2145
+ });
2146
+ Mt || (Mt = function(e, t, n) {
2147
+ return e.apply(t, n);
2148
+ });
2149
+ Ot || (Ot = function(e, t) {
2150
+ return new e(...t);
2151
+ });
2152
+ const tt = W(Array.prototype.forEach), ho = W(Array.prototype.lastIndexOf), Nn = W(Array.prototype.pop), De = W(Array.prototype.push), fo = W(Array.prototype.splice), rt = W(String.prototype.toLowerCase), St = W(String.prototype.toString), Mn = W(String.prototype.match), Pe = W(String.prototype.replace), go = W(String.prototype.indexOf), mo = W(String.prototype.trim), J = W(Object.prototype.hasOwnProperty), F = W(RegExp.prototype.test), ze = _o(TypeError);
2153
+ function W(o) {
2154
+ return function(e) {
2155
+ e instanceof RegExp && (e.lastIndex = 0);
2156
+ for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0), s = 1; s < t; s++)
2157
+ n[s - 1] = arguments[s];
2158
+ return Mt(o, e, n);
2159
+ };
2160
+ }
2161
+ function _o(o) {
2162
+ return function() {
2163
+ for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++)
2164
+ t[n] = arguments[n];
2165
+ return Ot(o, t);
2166
+ };
2167
+ }
2168
+ function w(o, e) {
2169
+ let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : rt;
2170
+ In && In(o, null);
2171
+ let n = e.length;
2172
+ for (; n--; ) {
2173
+ let s = e[n];
2174
+ if (typeof s == "string") {
2175
+ const r = t(s);
2176
+ r !== s && (co(e) || (e[n] = r), s = r);
2177
+ }
2178
+ o[s] = !0;
2179
+ }
2180
+ return o;
2181
+ }
2182
+ function bo(o) {
2183
+ for (let e = 0; e < o.length; e++)
2184
+ J(o, e) || (o[e] = null);
2185
+ return o;
2186
+ }
2187
+ function fe(o) {
2188
+ const e = ur(null);
2189
+ for (const [t, n] of cr(o))
2190
+ J(o, t) && (Array.isArray(n) ? e[t] = bo(n) : n && typeof n == "object" && n.constructor === Object ? e[t] = fe(n) : e[t] = n);
2191
+ return e;
2192
+ }
2193
+ function $e(o, e) {
2194
+ for (; o !== null; ) {
2195
+ const n = po(o, e);
2196
+ if (n) {
2197
+ if (n.get)
2198
+ return W(n.get);
2199
+ if (typeof n.value == "function")
2200
+ return W(n.value);
2201
+ }
2202
+ o = uo(o);
2203
+ }
2204
+ function t() {
2205
+ return null;
2206
+ }
2207
+ return t;
2208
+ }
2209
+ const On = G(["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", "section", "select", "shadow", "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"]), At = G(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), Rt = G(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]), xo = G(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]), vt = G(["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"]), ko = G(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), Dn = G(["#text"]), Pn = G(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "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", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]), Lt = G(["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", "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"]), zn = G(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "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"]), nt = G(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), wo = Q(/\{\{[\w\W]*|[\w\W]*\}\}/gm), To = Q(/<%[\w\W]*|[\w\W]*%>/gm), yo = Q(/\$\{[\w\W]*/gm), Co = Q(/^data-[\-\w.\u00B7-\uFFFF]+$/), Eo = Q(/^aria-[\-\w]+$/), pr = Q(
2210
+ /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
2211
+ // eslint-disable-line no-useless-escape
2212
+ ), So = Q(/^(?:\w+script|data):/i), Ao = Q(
2213
+ /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
2214
+ // eslint-disable-line no-control-regex
2215
+ ), hr = Q(/^html$/i), Ro = Q(/^[a-z][.\w]*(-[.\w]+)+$/i);
2216
+ var $n = /* @__PURE__ */ Object.freeze({
2217
+ __proto__: null,
2218
+ ARIA_ATTR: Eo,
2219
+ ATTR_WHITESPACE: Ao,
2220
+ CUSTOM_ELEMENT: Ro,
2221
+ DATA_ATTR: Co,
2222
+ DOCTYPE_NAME: hr,
2223
+ ERB_EXPR: To,
2224
+ IS_ALLOWED_URI: pr,
2225
+ IS_SCRIPT_OR_DATA: So,
2226
+ MUSTACHE_EXPR: wo,
2227
+ TMPLIT_EXPR: yo
2228
+ });
2229
+ const Be = {
2230
+ element: 1,
2231
+ text: 3,
2232
+ // Deprecated
2233
+ progressingInstruction: 7,
2234
+ comment: 8,
2235
+ document: 9
2236
+ }, vo = function() {
2237
+ return typeof window > "u" ? null : window;
2238
+ }, Lo = function(e, t) {
2239
+ if (typeof e != "object" || typeof e.createPolicy != "function")
2240
+ return null;
2241
+ let n = null;
2242
+ const s = "data-tt-policy-suffix";
2243
+ t && t.hasAttribute(s) && (n = t.getAttribute(s));
2244
+ const r = "dompurify" + (n ? "#" + n : "");
2245
+ try {
2246
+ return e.createPolicy(r, {
2247
+ createHTML(a) {
2248
+ return a;
2249
+ },
2250
+ createScriptURL(a) {
2251
+ return a;
2252
+ }
2253
+ });
2254
+ } catch {
2255
+ return console.warn("TrustedTypes policy " + r + " could not be created."), null;
2256
+ }
2257
+ }, Bn = function() {
2258
+ return {
2259
+ afterSanitizeAttributes: [],
2260
+ afterSanitizeElements: [],
2261
+ afterSanitizeShadowDOM: [],
2262
+ beforeSanitizeAttributes: [],
2263
+ beforeSanitizeElements: [],
2264
+ beforeSanitizeShadowDOM: [],
2265
+ uponSanitizeAttribute: [],
2266
+ uponSanitizeElement: [],
2267
+ uponSanitizeShadowNode: []
2268
+ };
2269
+ };
2270
+ function fr() {
2271
+ let o = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : vo();
2272
+ const e = (b) => fr(b);
2273
+ if (e.version = "3.2.5", e.removed = [], !o || !o.document || o.document.nodeType !== Be.document || !o.Element)
2274
+ return e.isSupported = !1, e;
2275
+ let {
2276
+ document: t
2277
+ } = o;
2278
+ const n = t, s = n.currentScript, {
2279
+ DocumentFragment: r,
2280
+ HTMLTemplateElement: a,
2281
+ Node: i,
2282
+ Element: p,
2283
+ NodeFilter: c,
2284
+ NamedNodeMap: u = o.NamedNodeMap || o.MozNamedAttrMap,
2285
+ HTMLFormElement: m,
2286
+ DOMParser: f,
2287
+ trustedTypes: g
2288
+ } = o, x = p.prototype, k = $e(x, "cloneNode"), T = $e(x, "remove"), Y = $e(x, "nextSibling"), D = $e(x, "childNodes"), K = $e(x, "parentNode");
2289
+ if (typeof a == "function") {
2290
+ const b = t.createElement("template");
2291
+ b.content && b.content.ownerDocument && (t = b.content.ownerDocument);
2292
+ }
2293
+ let E, le = "";
2294
+ const {
2295
+ implementation: Ee,
2296
+ createNodeIterator: Se,
2297
+ createDocumentFragment: ue,
2298
+ getElementsByTagName: mr
2299
+ } = t, {
2300
+ importNode: _r
2301
+ } = n;
2302
+ let H = Bn();
2303
+ e.isSupported = typeof cr == "function" && typeof K == "function" && Ee && Ee.createHTMLDocument !== void 0;
2304
+ const {
2305
+ MUSTACHE_EXPR: ut,
2306
+ ERB_EXPR: pt,
2307
+ TMPLIT_EXPR: ht,
2308
+ DATA_ATTR: br,
2309
+ ARIA_ATTR: xr,
2310
+ IS_SCRIPT_OR_DATA: kr,
2311
+ ATTR_WHITESPACE: jt,
2312
+ CUSTOM_ELEMENT: wr
2313
+ } = $n;
2314
+ let {
2315
+ IS_ALLOWED_URI: Yt
2316
+ } = $n, N = null;
2317
+ const Xt = w({}, [...On, ...At, ...Rt, ...vt, ...Dn]);
2318
+ let P = null;
2319
+ const Qt = w({}, [...Pn, ...Lt, ...zn, ...nt]);
2320
+ let v = Object.seal(ur(null, {
2321
+ tagNameCheck: {
2322
+ writable: !0,
2323
+ configurable: !1,
2324
+ enumerable: !0,
2325
+ value: null
2326
+ },
2327
+ attributeNameCheck: {
2328
+ writable: !0,
2329
+ configurable: !1,
2330
+ enumerable: !0,
2331
+ value: null
2332
+ },
2333
+ allowCustomizedBuiltInElements: {
2334
+ writable: !0,
2335
+ configurable: !1,
2336
+ enumerable: !0,
2337
+ value: !1
2338
+ }
2339
+ })), Ae = null, ft = null, Kt = !0, dt = !0, Jt = !1, en = !0, _e = !1, gt = !0, pe = !1, mt = !1, _t = !1, be = !1, Ze = !1, Ve = !1, tn = !0, nn = !1;
2340
+ const Tr = "user-content-";
2341
+ let bt = !0, Re = !1, xe = {}, ke = null;
2342
+ const rn = w({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]);
2343
+ let sn = null;
2344
+ const on = w({}, ["audio", "video", "img", "source", "image", "track"]);
2345
+ let xt = null;
2346
+ const an = w({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), je = "http://www.w3.org/1998/Math/MathML", Ye = "http://www.w3.org/2000/svg", oe = "http://www.w3.org/1999/xhtml";
2347
+ let we = oe, kt = !1, wt = null;
2348
+ const yr = w({}, [je, Ye, oe], St);
2349
+ let Xe = w({}, ["mi", "mo", "mn", "ms", "mtext"]), Qe = w({}, ["annotation-xml"]);
2350
+ const Cr = w({}, ["title", "style", "font", "a", "script"]);
2351
+ let ve = null;
2352
+ const Er = ["application/xhtml+xml", "text/html"], Sr = "text/html";
2353
+ let M = null, Te = null;
2354
+ const Ar = t.createElement("form"), ln = function(l) {
2355
+ return l instanceof RegExp || l instanceof Function;
2356
+ }, Tt = function() {
2357
+ let l = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
2358
+ if (!(Te && Te === l)) {
2359
+ if ((!l || typeof l != "object") && (l = {}), l = fe(l), ve = // eslint-disable-next-line unicorn/prefer-includes
2360
+ Er.indexOf(l.PARSER_MEDIA_TYPE) === -1 ? Sr : l.PARSER_MEDIA_TYPE, M = ve === "application/xhtml+xml" ? St : rt, N = J(l, "ALLOWED_TAGS") ? w({}, l.ALLOWED_TAGS, M) : Xt, P = J(l, "ALLOWED_ATTR") ? w({}, l.ALLOWED_ATTR, M) : Qt, wt = J(l, "ALLOWED_NAMESPACES") ? w({}, l.ALLOWED_NAMESPACES, St) : yr, xt = J(l, "ADD_URI_SAFE_ATTR") ? w(fe(an), l.ADD_URI_SAFE_ATTR, M) : an, sn = J(l, "ADD_DATA_URI_TAGS") ? w(fe(on), l.ADD_DATA_URI_TAGS, M) : on, ke = J(l, "FORBID_CONTENTS") ? w({}, l.FORBID_CONTENTS, M) : rn, Ae = J(l, "FORBID_TAGS") ? w({}, l.FORBID_TAGS, M) : {}, ft = J(l, "FORBID_ATTR") ? w({}, l.FORBID_ATTR, M) : {}, xe = J(l, "USE_PROFILES") ? l.USE_PROFILES : !1, Kt = l.ALLOW_ARIA_ATTR !== !1, dt = l.ALLOW_DATA_ATTR !== !1, Jt = l.ALLOW_UNKNOWN_PROTOCOLS || !1, en = l.ALLOW_SELF_CLOSE_IN_ATTR !== !1, _e = l.SAFE_FOR_TEMPLATES || !1, gt = l.SAFE_FOR_XML !== !1, pe = l.WHOLE_DOCUMENT || !1, be = l.RETURN_DOM || !1, Ze = l.RETURN_DOM_FRAGMENT || !1, Ve = l.RETURN_TRUSTED_TYPE || !1, _t = l.FORCE_BODY || !1, tn = l.SANITIZE_DOM !== !1, nn = l.SANITIZE_NAMED_PROPS || !1, bt = l.KEEP_CONTENT !== !1, Re = l.IN_PLACE || !1, Yt = l.ALLOWED_URI_REGEXP || pr, we = l.NAMESPACE || oe, Xe = l.MATHML_TEXT_INTEGRATION_POINTS || Xe, Qe = l.HTML_INTEGRATION_POINTS || Qe, v = l.CUSTOM_ELEMENT_HANDLING || {}, l.CUSTOM_ELEMENT_HANDLING && ln(l.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (v.tagNameCheck = l.CUSTOM_ELEMENT_HANDLING.tagNameCheck), l.CUSTOM_ELEMENT_HANDLING && ln(l.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (v.attributeNameCheck = l.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), l.CUSTOM_ELEMENT_HANDLING && typeof l.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (v.allowCustomizedBuiltInElements = l.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), _e && (dt = !1), Ze && (be = !0), xe && (N = w({}, Dn), P = [], xe.html === !0 && (w(N, On), w(P, Pn)), xe.svg === !0 && (w(N, At), w(P, Lt), w(P, nt)), xe.svgFilters === !0 && (w(N, Rt), w(P, Lt), w(P, nt)), xe.mathMl === !0 && (w(N, vt), w(P, zn), w(P, nt))), l.ADD_TAGS && (N === Xt && (N = fe(N)), w(N, l.ADD_TAGS, M)), l.ADD_ATTR && (P === Qt && (P = fe(P)), w(P, l.ADD_ATTR, M)), l.ADD_URI_SAFE_ATTR && w(xt, l.ADD_URI_SAFE_ATTR, M), l.FORBID_CONTENTS && (ke === rn && (ke = fe(ke)), w(ke, l.FORBID_CONTENTS, M)), bt && (N["#text"] = !0), pe && w(N, ["html", "head", "body"]), N.table && (w(N, ["tbody"]), delete Ae.tbody), l.TRUSTED_TYPES_POLICY) {
2361
+ if (typeof l.TRUSTED_TYPES_POLICY.createHTML != "function")
2362
+ throw ze('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
2363
+ if (typeof l.TRUSTED_TYPES_POLICY.createScriptURL != "function")
2364
+ throw ze('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
2365
+ E = l.TRUSTED_TYPES_POLICY, le = E.createHTML("");
2366
+ } else
2367
+ E === void 0 && (E = Lo(g, s)), E !== null && typeof le == "string" && (le = E.createHTML(""));
2368
+ G && G(l), Te = l;
2369
+ }
2370
+ }, cn = w({}, [...At, ...Rt, ...xo]), un = w({}, [...vt, ...ko]), Rr = function(l) {
2371
+ let h = K(l);
2372
+ (!h || !h.tagName) && (h = {
2373
+ namespaceURI: we,
2374
+ tagName: "template"
2375
+ });
2376
+ const _ = rt(l.tagName), A = rt(h.tagName);
2377
+ return wt[l.namespaceURI] ? l.namespaceURI === Ye ? h.namespaceURI === oe ? _ === "svg" : h.namespaceURI === je ? _ === "svg" && (A === "annotation-xml" || Xe[A]) : !!cn[_] : l.namespaceURI === je ? h.namespaceURI === oe ? _ === "math" : h.namespaceURI === Ye ? _ === "math" && Qe[A] : !!un[_] : l.namespaceURI === oe ? h.namespaceURI === Ye && !Qe[A] || h.namespaceURI === je && !Xe[A] ? !1 : !un[_] && (Cr[_] || !cn[_]) : !!(ve === "application/xhtml+xml" && wt[l.namespaceURI]) : !1;
2378
+ }, te = function(l) {
2379
+ De(e.removed, {
2380
+ element: l
2381
+ });
2382
+ try {
2383
+ K(l).removeChild(l);
2384
+ } catch {
2385
+ T(l);
2386
+ }
2387
+ }, Ke = function(l, h) {
2388
+ try {
2389
+ De(e.removed, {
2390
+ attribute: h.getAttributeNode(l),
2391
+ from: h
2392
+ });
2393
+ } catch {
2394
+ De(e.removed, {
2395
+ attribute: null,
2396
+ from: h
2397
+ });
2398
+ }
2399
+ if (h.removeAttribute(l), l === "is")
2400
+ if (be || Ze)
2401
+ try {
2402
+ te(h);
2403
+ } catch {
2404
+ }
2405
+ else
2406
+ try {
2407
+ h.setAttribute(l, "");
2408
+ } catch {
2409
+ }
2410
+ }, pn = function(l) {
2411
+ let h = null, _ = null;
2412
+ if (_t)
2413
+ l = "<remove></remove>" + l;
2414
+ else {
2415
+ const z = Mn(l, /^[\r\n\t ]+/);
2416
+ _ = z && z[0];
2417
+ }
2418
+ ve === "application/xhtml+xml" && we === oe && (l = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + l + "</body></html>");
2419
+ const A = E ? E.createHTML(l) : l;
2420
+ if (we === oe)
2421
+ try {
2422
+ h = new f().parseFromString(A, ve);
2423
+ } catch {
2424
+ }
2425
+ if (!h || !h.documentElement) {
2426
+ h = Ee.createDocument(we, "template", null);
2427
+ try {
2428
+ h.documentElement.innerHTML = kt ? le : A;
2429
+ } catch {
2430
+ }
2431
+ }
2432
+ const B = h.body || h.documentElement;
2433
+ return l && _ && B.insertBefore(t.createTextNode(_), B.childNodes[0] || null), we === oe ? mr.call(h, pe ? "html" : "body")[0] : pe ? h.documentElement : B;
2434
+ }, hn = function(l) {
2435
+ return Se.call(
2436
+ l.ownerDocument || l,
2437
+ l,
2438
+ // eslint-disable-next-line no-bitwise
2439
+ c.SHOW_ELEMENT | c.SHOW_COMMENT | c.SHOW_TEXT | c.SHOW_PROCESSING_INSTRUCTION | c.SHOW_CDATA_SECTION,
2440
+ null
2441
+ );
2442
+ }, yt = function(l) {
2443
+ return l instanceof m && (typeof l.nodeName != "string" || typeof l.textContent != "string" || typeof l.removeChild != "function" || !(l.attributes instanceof u) || typeof l.removeAttribute != "function" || typeof l.setAttribute != "function" || typeof l.namespaceURI != "string" || typeof l.insertBefore != "function" || typeof l.hasChildNodes != "function");
2444
+ }, fn = function(l) {
2445
+ return typeof i == "function" && l instanceof i;
2446
+ };
2447
+ function ie(b, l, h) {
2448
+ tt(b, (_) => {
2449
+ _.call(e, l, h, Te);
2450
+ });
2451
+ }
2452
+ const dn = function(l) {
2453
+ let h = null;
2454
+ if (ie(H.beforeSanitizeElements, l, null), yt(l))
2455
+ return te(l), !0;
2456
+ const _ = M(l.nodeName);
2457
+ if (ie(H.uponSanitizeElement, l, {
2458
+ tagName: _,
2459
+ allowedTags: N
2460
+ }), l.hasChildNodes() && !fn(l.firstElementChild) && F(/<[/\w!]/g, l.innerHTML) && F(/<[/\w!]/g, l.textContent) || l.nodeType === Be.progressingInstruction || gt && l.nodeType === Be.comment && F(/<[/\w]/g, l.data))
2461
+ return te(l), !0;
2462
+ if (!N[_] || Ae[_]) {
2463
+ if (!Ae[_] && mn(_) && (v.tagNameCheck instanceof RegExp && F(v.tagNameCheck, _) || v.tagNameCheck instanceof Function && v.tagNameCheck(_)))
2464
+ return !1;
2465
+ if (bt && !ke[_]) {
2466
+ const A = K(l) || l.parentNode, B = D(l) || l.childNodes;
2467
+ if (B && A) {
2468
+ const z = B.length;
2469
+ for (let Z = z - 1; Z >= 0; --Z) {
2470
+ const ne = k(B[Z], !0);
2471
+ ne.__removalCount = (l.__removalCount || 0) + 1, A.insertBefore(ne, Y(l));
2472
+ }
2473
+ }
2474
+ }
2475
+ return te(l), !0;
2476
+ }
2477
+ return l instanceof p && !Rr(l) || (_ === "noscript" || _ === "noembed" || _ === "noframes") && F(/<\/no(script|embed|frames)/i, l.innerHTML) ? (te(l), !0) : (_e && l.nodeType === Be.text && (h = l.textContent, tt([ut, pt, ht], (A) => {
2478
+ h = Pe(h, A, " ");
2479
+ }), l.textContent !== h && (De(e.removed, {
2480
+ element: l.cloneNode()
2481
+ }), l.textContent = h)), ie(H.afterSanitizeElements, l, null), !1);
2482
+ }, gn = function(l, h, _) {
2483
+ if (tn && (h === "id" || h === "name") && (_ in t || _ in Ar))
2484
+ return !1;
2485
+ if (!(dt && !ft[h] && F(br, h))) {
2486
+ if (!(Kt && F(xr, h))) {
2487
+ if (!P[h] || ft[h]) {
2488
+ if (
2489
+ // First condition does a very basic check if a) it's basically a valid custom element tagname AND
2490
+ // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
2491
+ // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
2492
+ !(mn(l) && (v.tagNameCheck instanceof RegExp && F(v.tagNameCheck, l) || v.tagNameCheck instanceof Function && v.tagNameCheck(l)) && (v.attributeNameCheck instanceof RegExp && F(v.attributeNameCheck, h) || v.attributeNameCheck instanceof Function && v.attributeNameCheck(h)) || // Alternative, second condition checks if it's an `is`-attribute, AND
2493
+ // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
2494
+ h === "is" && v.allowCustomizedBuiltInElements && (v.tagNameCheck instanceof RegExp && F(v.tagNameCheck, _) || v.tagNameCheck instanceof Function && v.tagNameCheck(_)))
2495
+ ) return !1;
2496
+ } else if (!xt[h]) {
2497
+ if (!F(Yt, Pe(_, jt, ""))) {
2498
+ if (!((h === "src" || h === "xlink:href" || h === "href") && l !== "script" && go(_, "data:") === 0 && sn[l])) {
2499
+ if (!(Jt && !F(kr, Pe(_, jt, "")))) {
2500
+ if (_)
2501
+ return !1;
2502
+ }
2503
+ }
2504
+ }
2505
+ }
2506
+ }
2507
+ }
2508
+ return !0;
2509
+ }, mn = function(l) {
2510
+ return l !== "annotation-xml" && Mn(l, wr);
2511
+ }, _n = function(l) {
2512
+ ie(H.beforeSanitizeAttributes, l, null);
2513
+ const {
2514
+ attributes: h
2515
+ } = l;
2516
+ if (!h || yt(l))
2517
+ return;
2518
+ const _ = {
2519
+ attrName: "",
2520
+ attrValue: "",
2521
+ keepAttr: !0,
2522
+ allowedAttributes: P,
2523
+ forceKeepAttr: void 0
2524
+ };
2525
+ let A = h.length;
2526
+ for (; A--; ) {
2527
+ const B = h[A], {
2528
+ name: z,
2529
+ namespaceURI: Z,
2530
+ value: ne
2531
+ } = B, Le = M(z);
2532
+ let U = z === "value" ? ne : mo(ne);
2533
+ if (_.attrName = Le, _.attrValue = U, _.keepAttr = !0, _.forceKeepAttr = void 0, ie(H.uponSanitizeAttribute, l, _), U = _.attrValue, nn && (Le === "id" || Le === "name") && (Ke(z, l), U = Tr + U), gt && F(/((--!?|])>)|<\/(style|title)/i, U)) {
2534
+ Ke(z, l);
2535
+ continue;
2536
+ }
2537
+ if (_.forceKeepAttr || (Ke(z, l), !_.keepAttr))
2538
+ continue;
2539
+ if (!en && F(/\/>/i, U)) {
2540
+ Ke(z, l);
2541
+ continue;
2542
+ }
2543
+ _e && tt([ut, pt, ht], (xn) => {
2544
+ U = Pe(U, xn, " ");
2545
+ });
2546
+ const bn = M(l.nodeName);
2547
+ if (gn(bn, Le, U)) {
2548
+ if (E && typeof g == "object" && typeof g.getAttributeType == "function" && !Z)
2549
+ switch (g.getAttributeType(bn, Le)) {
2550
+ case "TrustedHTML": {
2551
+ U = E.createHTML(U);
2552
+ break;
2553
+ }
2554
+ case "TrustedScriptURL": {
2555
+ U = E.createScriptURL(U);
2556
+ break;
2557
+ }
2558
+ }
2559
+ try {
2560
+ Z ? l.setAttributeNS(Z, z, U) : l.setAttribute(z, U), yt(l) ? te(l) : Nn(e.removed);
2561
+ } catch {
2562
+ }
2563
+ }
2564
+ }
2565
+ ie(H.afterSanitizeAttributes, l, null);
2566
+ }, vr = function b(l) {
2567
+ let h = null;
2568
+ const _ = hn(l);
2569
+ for (ie(H.beforeSanitizeShadowDOM, l, null); h = _.nextNode(); )
2570
+ ie(H.uponSanitizeShadowNode, h, null), dn(h), _n(h), h.content instanceof r && b(h.content);
2571
+ ie(H.afterSanitizeShadowDOM, l, null);
2572
+ };
2573
+ return e.sanitize = function(b) {
2574
+ let l = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, h = null, _ = null, A = null, B = null;
2575
+ if (kt = !b, kt && (b = "<!-->"), typeof b != "string" && !fn(b))
2576
+ if (typeof b.toString == "function") {
2577
+ if (b = b.toString(), typeof b != "string")
2578
+ throw ze("dirty is not a string, aborting");
2579
+ } else
2580
+ throw ze("toString is not a function");
2581
+ if (!e.isSupported)
2582
+ return b;
2583
+ if (mt || Tt(l), e.removed = [], typeof b == "string" && (Re = !1), Re) {
2584
+ if (b.nodeName) {
2585
+ const ne = M(b.nodeName);
2586
+ if (!N[ne] || Ae[ne])
2587
+ throw ze("root node is forbidden and cannot be sanitized in-place");
2588
+ }
2589
+ } else if (b instanceof i)
2590
+ h = pn("<!---->"), _ = h.ownerDocument.importNode(b, !0), _.nodeType === Be.element && _.nodeName === "BODY" || _.nodeName === "HTML" ? h = _ : h.appendChild(_);
2591
+ else {
2592
+ if (!be && !_e && !pe && // eslint-disable-next-line unicorn/prefer-includes
2593
+ b.indexOf("<") === -1)
2594
+ return E && Ve ? E.createHTML(b) : b;
2595
+ if (h = pn(b), !h)
2596
+ return be ? null : Ve ? le : "";
2597
+ }
2598
+ h && _t && te(h.firstChild);
2599
+ const z = hn(Re ? b : h);
2600
+ for (; A = z.nextNode(); )
2601
+ dn(A), _n(A), A.content instanceof r && vr(A.content);
2602
+ if (Re)
2603
+ return b;
2604
+ if (be) {
2605
+ if (Ze)
2606
+ for (B = ue.call(h.ownerDocument); h.firstChild; )
2607
+ B.appendChild(h.firstChild);
2608
+ else
2609
+ B = h;
2610
+ return (P.shadowroot || P.shadowrootmode) && (B = _r.call(n, B, !0)), B;
2611
+ }
2612
+ let Z = pe ? h.outerHTML : h.innerHTML;
2613
+ return pe && N["!doctype"] && h.ownerDocument && h.ownerDocument.doctype && h.ownerDocument.doctype.name && F(hr, h.ownerDocument.doctype.name) && (Z = "<!DOCTYPE " + h.ownerDocument.doctype.name + `>
2614
+ ` + Z), _e && tt([ut, pt, ht], (ne) => {
2615
+ Z = Pe(Z, ne, " ");
2616
+ }), E && Ve ? E.createHTML(Z) : Z;
2617
+ }, e.setConfig = function() {
2618
+ let b = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
2619
+ Tt(b), mt = !0;
2620
+ }, e.clearConfig = function() {
2621
+ Te = null, mt = !1;
2622
+ }, e.isValidAttribute = function(b, l, h) {
2623
+ Te || Tt({});
2624
+ const _ = M(b), A = M(l);
2625
+ return gn(_, A, h);
2626
+ }, e.addHook = function(b, l) {
2627
+ typeof l == "function" && De(H[b], l);
2628
+ }, e.removeHook = function(b, l) {
2629
+ if (l !== void 0) {
2630
+ const h = ho(H[b], l);
2631
+ return h === -1 ? void 0 : fo(H[b], h, 1)[0];
2632
+ }
2633
+ return Nn(H[b]);
2634
+ }, e.removeHooks = function(b) {
2635
+ H[b] = [];
2636
+ }, e.removeAllHooks = function() {
2637
+ H = Bn();
2638
+ }, e;
2639
+ }
2640
+ var Io = fr();
2641
+ function No(o) {
2642
+ return o.trim().endsWith(`
2643
+
2644
+ `) || o.trim().endsWith(".") || o.trim().endsWith("。");
2645
+ }
2646
+ function dr(o, e = 100) {
2647
+ const [t, n] = V([]), [s, r] = V(""), a = ce(/* @__PURE__ */ new Map()), i = I((c) => (c == null ? void 0 : c.raw) || c.text || "", []);
2648
+ return O(() => {
2649
+ if (!o) {
2650
+ n([]), r(""), a.current.clear();
2651
+ return;
2652
+ }
2653
+ const c = setTimeout(() => {
2654
+ const u = j.lex(o);
2655
+ if (u.length === 0) {
2656
+ n([]), r("");
2657
+ return;
2658
+ }
2659
+ let m = u.length - 1;
2660
+ for (let T = u.length - 1; T >= 0; T--) {
2661
+ const Y = i(u[T]);
2662
+ if (No(Y)) {
2663
+ m = T;
2664
+ break;
2665
+ }
2666
+ }
2667
+ const f = u.slice(0, m + 1), g = u.slice(m + 1), x = [];
2668
+ for (const T of f) {
2669
+ const Y = i(T), D = a.current.get(Y);
2670
+ if (D)
2671
+ x.push(D);
2672
+ else {
2673
+ const K = C.parser([T]), E = Io.sanitize(K);
2674
+ a.current.set(Y, E), x.push(E);
2675
+ }
2676
+ }
2677
+ const k = g.map(i).join(`
2678
+ `);
2679
+ n(x), r(k);
2680
+ }, e);
2681
+ return () => clearTimeout(c);
2682
+ }, [o, e, i]), {
2683
+ htmlBlocks: $(() => /* @__PURE__ */ d(
2684
+ "div",
2685
+ {
2686
+ className: ee.md_container,
2687
+ dangerouslySetInnerHTML: { __html: t.join("") }
2688
+ }
2689
+ ), [t]),
2690
+ lastTypingText: s
2691
+ };
2692
+ }
2693
+ function Hn(o) {
2694
+ var i, p;
2695
+ const { message: e } = o, { avatar: t } = se(), n = ge(), { htmlBlocks: s, lastTypingText: r } = dr(
2696
+ ((i = e == null ? void 0 : e.message) == null ? void 0 : i.text) || "",
2697
+ 20
2698
+ ), a = $(() => {
2699
+ var c, u, m, f;
2700
+ switch (e.type) {
560
2701
  case "user":
561
2702
  return {
562
- color: (a = e == null ? void 0 : e.userMessage) == null ? void 0 : a.color,
563
- backgroundColor: (i = e == null ? void 0 : e.userMessage) == null ? void 0 : i.backgroundColor
2703
+ color: (c = n == null ? void 0 : n.userMessage) == null ? void 0 : c.color,
2704
+ backgroundColor: (u = n == null ? void 0 : n.userMessage) == null ? void 0 : u.backgroundColor
564
2705
  };
565
2706
  case "bot":
566
2707
  return {
567
- color: (u = e == null ? void 0 : e.botMessage) == null ? void 0 : u.color,
568
- backgroundColor: (d = e == null ? void 0 : e.botMessage) == null ? void 0 : d.backgroundColor
2708
+ color: (m = n == null ? void 0 : n.botMessage) == null ? void 0 : m.color,
2709
+ backgroundColor: (f = n == null ? void 0 : n.botMessage) == null ? void 0 : f.backgroundColor
569
2710
  };
570
2711
  default:
571
2712
  return {};
572
2713
  }
573
- }, [t, e]);
574
- return t.type === "error" ? null : t.type === "user" ? /* @__PURE__ */ m(I, { type: "user", direction: "horizontal", children: [
575
- /* @__PURE__ */ c(
2714
+ }, [e, n]);
2715
+ return e.type === "error" ? null : e.type === "user" ? /* @__PURE__ */ R(Ge, { type: "user", direction: "horizontal", children: [
2716
+ /* @__PURE__ */ d(
576
2717
  "div",
577
2718
  {
578
- className: E(y.text, y["text--user"]),
579
- style: r,
580
- children: t.text
2719
+ className: ae(ee.text, ee["text--user"]),
2720
+ style: a,
2721
+ children: e.text
581
2722
  }
582
2723
  ),
583
- /* @__PURE__ */ c(j, { time: t.time })
584
- ] }) : /* @__PURE__ */ m(I, { type: "bot", direction: "horizontal", children: [
585
- /* @__PURE__ */ c(Z, { avatar: o }),
586
- /* @__PURE__ */ c(
587
- U,
2724
+ /* @__PURE__ */ d(zt, { time: e.time })
2725
+ ] }) : /* @__PURE__ */ R(Ge, { type: "bot", direction: "horizontal", children: [
2726
+ /* @__PURE__ */ d(at, { avatar: t }),
2727
+ /* @__PURE__ */ d(
2728
+ $t,
588
2729
  {
589
- time: t.time,
590
- quickReplies: (s = t.message.template) == null ? void 0 : s.quickReplies,
591
- children: /* @__PURE__ */ c(
2730
+ time: e.time,
2731
+ quickReplies: (p = e.message.template) == null ? void 0 : p.quickReplies,
2732
+ children: /* @__PURE__ */ R(
592
2733
  "div",
593
2734
  {
594
- className: E(y.text, y["text--bot"]),
595
- style: r,
596
- children: t.message.text
2735
+ className: ae(ee.text, ee["text--bot"]),
2736
+ style: a,
2737
+ children: [
2738
+ s,
2739
+ r ?? ""
2740
+ ]
597
2741
  }
598
2742
  )
599
2743
  }
600
2744
  )
601
2745
  ] });
602
2746
  }
603
- function ht(n) {
604
- const { isTyping: t, typingText: o } = n, { messageBoxBottomRef: e, avatar: r } = T(), s = L(), a = R(null), i = b(() => {
605
- var _;
606
- (_ = e.current) == null || _.scrollIntoView({ behavior: "smooth" });
607
- }, [e]);
608
- Lt({ ref: a, onResize: i });
609
- const u = yt(t, 500), d = v(
2747
+ function gr(o) {
2748
+ const { isTyping: e, typingText: t } = o, { messageBoxBottomRef: n, avatar: s } = se(), r = ge(), a = ce(null), i = I(() => {
2749
+ var g;
2750
+ (g = n.current) == null || g.scrollIntoView({ behavior: "smooth" });
2751
+ }, [n]);
2752
+ Vr({ ref: a, onResize: i });
2753
+ const p = Hr(e, 500), { htmlBlocks: c, lastTypingText: u } = dr(
2754
+ t || "",
2755
+ 20
2756
+ ), m = $(
610
2757
  () => {
611
- var _, l;
2758
+ var g, x;
612
2759
  return {
613
- color: (_ = s == null ? void 0 : s.botMessage) == null ? void 0 : _.color,
614
- backgroundColor: (l = s == null ? void 0 : s.botMessage) == null ? void 0 : l.backgroundColor
2760
+ color: (g = r == null ? void 0 : r.botMessage) == null ? void 0 : g.color,
2761
+ backgroundColor: (x = r == null ? void 0 : r.botMessage) == null ? void 0 : x.backgroundColor
615
2762
  };
616
2763
  },
617
- [s]
618
- ), h = v(
2764
+ [r]
2765
+ ), f = $(
619
2766
  () => {
620
- var _;
2767
+ var g;
621
2768
  return {
622
- backgroundColor: (_ = s == null ? void 0 : s.botMessage) == null ? void 0 : _.color
2769
+ backgroundColor: (g = r == null ? void 0 : r.botMessage) == null ? void 0 : g.color
623
2770
  };
624
2771
  },
625
- [s]
2772
+ [r]
626
2773
  );
627
- return u ? /* @__PURE__ */ m(I, { type: "bot", direction: "horizontal", children: [
628
- /* @__PURE__ */ c(Z, { avatar: r }),
629
- /* @__PURE__ */ c(U, { time: /* @__PURE__ */ new Date(), children: /* @__PURE__ */ c(
2774
+ return p ? /* @__PURE__ */ R(Ge, { type: "bot", direction: "horizontal", children: [
2775
+ /* @__PURE__ */ d(at, { avatar: s }),
2776
+ /* @__PURE__ */ d($t, { time: /* @__PURE__ */ new Date(), children: /* @__PURE__ */ d(
630
2777
  "div",
631
2778
  {
632
2779
  ref: a,
633
- className: E(y.text, y["text--bot"]),
634
- style: d,
635
- children: /* @__PURE__ */ m("span", { children: [
636
- o ?? "",
637
- u && /* @__PURE__ */ m("span", { className: y["typing-indicator"], children: [
638
- /* @__PURE__ */ c("div", { className: y.dot, style: h }),
639
- /* @__PURE__ */ c("div", { className: y.dot, style: h }),
640
- /* @__PURE__ */ c("div", { className: y.dot, style: h })
2780
+ className: ae(ee.text, ee["text--bot"]),
2781
+ style: m,
2782
+ children: /* @__PURE__ */ R("span", { children: [
2783
+ c,
2784
+ u ?? "",
2785
+ p && /* @__PURE__ */ R("span", { className: ee["typing-indicator"], children: [
2786
+ /* @__PURE__ */ d("div", { className: ee.dot, style: f }),
2787
+ /* @__PURE__ */ d("div", { className: ee.dot, style: f }),
2788
+ /* @__PURE__ */ d("div", { className: ee.dot, style: f })
641
2789
  ] })
642
2790
  ] })
643
2791
  }
644
2792
  ) })
645
2793
  ] }) : null;
646
2794
  }
647
- function le(n) {
648
- const { placeholder: t } = n, { isConnecting: o, messages: e } = T(), r = v(
649
- () => Array.from((e == null ? void 0 : e.values()) ?? []).some(
650
- (s) => s.type === "bot" && s.isTyping
2795
+ function Mo(o) {
2796
+ const { placeholder: e } = o, { isConnecting: t, messages: n } = se(), s = $(
2797
+ () => Array.from((n == null ? void 0 : n.values()) ?? []).some(
2798
+ (r) => r.type === "bot" && r.isTyping
651
2799
  ),
652
- [e]
2800
+ [n]
653
2801
  );
654
- return o && !r ? /* @__PURE__ */ c(ht, { isTyping: !0, typingText: t }) : null;
2802
+ return t && !s ? /* @__PURE__ */ d(gr, { isTyping: !0, typingText: e }) : null;
655
2803
  }
656
- const ue = "_carousel_root_sv1hc_1", de = "_carousel_time_sv1hc_12", nt = {
657
- carousel_root: ue,
658
- carousel_time: de
2804
+ const Oo = "_carousel_root_sv1hc_1", Do = "_carousel_time_sv1hc_12", Un = {
2805
+ carousel_root: Oo,
2806
+ carousel_time: Do
659
2807
  };
660
- function _e(n) {
661
- var r;
662
- const { message: t } = n, { avatar: o } = T(), e = t.message.template;
663
- return /* @__PURE__ */ m(I, { type: "bot", direction: "vertical", children: [
664
- /* @__PURE__ */ c(Z, { avatar: o }),
665
- /* @__PURE__ */ c("div", { className: nt.carousel_root, children: (r = e.columns) == null ? void 0 : r.map((s, a) => /* @__PURE__ */ c(_t, { template: s }, a)) }),
666
- /* @__PURE__ */ c(j, { className: nt.carousel_time, time: t.time })
2808
+ function Po(o) {
2809
+ var s;
2810
+ const { message: e } = o, { avatar: t } = se(), n = e.message.template;
2811
+ return /* @__PURE__ */ R(Ge, { type: "bot", direction: "vertical", children: [
2812
+ /* @__PURE__ */ d(at, { avatar: t }),
2813
+ /* @__PURE__ */ d("div", { className: Un.carousel_root, children: (s = n.columns) == null ? void 0 : s.map((r, a) => /* @__PURE__ */ d(Qn, { template: r }, a)) }),
2814
+ /* @__PURE__ */ d(zt, { className: Un.carousel_time, time: e.time })
667
2815
  ] });
668
2816
  }
669
- const he = "_hint_root_1bw94_1", ge = "_error_hint_title_1bw94_16", me = "_error_hint_message_1bw94_22", fe = "_time_1bw94_31", z = {
670
- hint_root: he,
671
- error_hint_title: ge,
672
- error_hint_message: me,
673
- time: fe
2817
+ const zo = "_hint_root_iy66i_1", $o = "_error_hint_title_iy66i_17", Bo = "_error_hint_message_iy66i_23", Ho = "_time_iy66i_32", Ce = {
2818
+ hint_root: zo,
2819
+ error_hint_title: $o,
2820
+ error_hint_message: Bo,
2821
+ time: Ho
674
2822
  };
675
- function ot(n) {
676
- const { message: t } = n, { onErrorClick: o, errorMessageRenderer: e } = Ht(), r = b(() => {
677
- o == null || o(t);
678
- }, [t, o]);
679
- if (t.type === "user") return null;
680
- if (t.type === "error")
681
- return /* @__PURE__ */ c("div", { className: z.hint_root, children: (e == null ? void 0 : e(t)) ?? /* @__PURE__ */ m(mt, { children: [
682
- /* @__PURE__ */ m("div", { className: z.error_hint_title, children: [
683
- /* @__PURE__ */ c("span", { className: z.time, children: $(t.time) }),
684
- /* @__PURE__ */ c("span", { children: "Unexpected error" })
2823
+ function Fn(o) {
2824
+ const { message: e } = o, { onErrorClick: t, errorMessageRenderer: n } = Xr(), s = I(() => {
2825
+ t == null || t(e);
2826
+ }, [e, t]);
2827
+ if (e.type === "user") return null;
2828
+ if (e.type === "error")
2829
+ return /* @__PURE__ */ d("div", { className: Ce.hint_root, children: (n == null ? void 0 : n(e)) ?? /* @__PURE__ */ R(Nr, { children: [
2830
+ /* @__PURE__ */ R("div", { className: Ce.error_hint_title, children: [
2831
+ /* @__PURE__ */ d("span", { className: Ce.time, children: It(e.time) }),
2832
+ /* @__PURE__ */ d("span", { children: "Unexpected error" })
685
2833
  ] }),
686
- o && /* @__PURE__ */ m(
2834
+ t && /* @__PURE__ */ R(
687
2835
  "div",
688
2836
  {
689
- className: z.error_hint_message,
690
- onClick: r,
2837
+ className: Ce.error_hint_message,
2838
+ onClick: s,
691
2839
  children: [
692
2840
  "Click ",
693
- /* @__PURE__ */ c("span", { children: "here" }),
2841
+ /* @__PURE__ */ d("span", { children: "here" }),
694
2842
  " to view the report."
695
2843
  ]
696
2844
  }
697
2845
  )
698
2846
  ] }) });
699
- const s = t.message.template;
700
- return s.type !== O.HINT ? null : /* @__PURE__ */ m("div", { className: z.hint_root, children: [
701
- /* @__PURE__ */ c("div", { className: z.time, children: $(t.time) }),
702
- s.text
2847
+ const r = e.message.template;
2848
+ return r.type !== He.HINT ? null : /* @__PURE__ */ R("div", { className: Ce.hint_root, children: [
2849
+ /* @__PURE__ */ d("div", { className: Ce.time, children: It(e.time) }),
2850
+ r.text
703
2851
  ] });
704
2852
  }
705
- function be(n) {
706
- var o;
707
- const { message: t } = n;
708
- if (t.type === "user")
709
- return /* @__PURE__ */ c(et, { message: t });
710
- if (t.type === "error")
711
- return /* @__PURE__ */ c(ot, { message: t });
712
- if (t.isTyping)
713
- return /* @__PURE__ */ c(
714
- ht,
2853
+ function Uo(o) {
2854
+ var t;
2855
+ const { message: e } = o;
2856
+ if (e.type === "user")
2857
+ return /* @__PURE__ */ d(Hn, { message: e });
2858
+ if (e.type === "error")
2859
+ return /* @__PURE__ */ d(Fn, { message: e });
2860
+ if (e.isTyping)
2861
+ return /* @__PURE__ */ d(
2862
+ gr,
715
2863
  {
716
- isTyping: t.isTyping,
717
- typingText: t.typingText
2864
+ isTyping: e.isTyping,
2865
+ typingText: e.typingText
718
2866
  }
719
2867
  );
720
- switch ((o = t.message.template) == null ? void 0 : o.type) {
721
- case O.TEXT:
722
- return /* @__PURE__ */ c(et, { message: t });
723
- case O.HINT:
724
- return /* @__PURE__ */ c(ot, { message: t });
725
- case O.BUTTON:
726
- return /* @__PURE__ */ c(ce, { message: t });
727
- case O.CAROUSEL:
728
- return /* @__PURE__ */ c(_e, { message: t });
2868
+ switch ((t = e.message.template) == null ? void 0 : t.type) {
2869
+ case He.TEXT:
2870
+ return /* @__PURE__ */ d(Hn, { message: e });
2871
+ case He.HINT:
2872
+ return /* @__PURE__ */ d(Fn, { message: e });
2873
+ case He.BUTTON:
2874
+ return /* @__PURE__ */ d(ys, { message: e });
2875
+ case He.CAROUSEL:
2876
+ return /* @__PURE__ */ d(Po, { message: e });
729
2877
  default:
730
- return /* @__PURE__ */ c("div", {});
2878
+ return /* @__PURE__ */ d("div", {});
731
2879
  }
732
2880
  }
733
- function pe() {
734
- const { chatbot: n } = L(), { messages: t, messageBoxBottomRef: o, botTypingPlaceholder: e } = T();
735
- C(() => {
736
- var s;
737
- (s = o.current) == null || s.scrollIntoView({ behavior: "smooth" });
738
- }, [t, o]);
739
- const r = v(
2881
+ function Fo() {
2882
+ const { chatbot: o } = ge(), { messages: e, messageBoxBottomRef: t, botTypingPlaceholder: n } = se();
2883
+ O(() => {
2884
+ var r;
2885
+ (r = t.current) == null || r.scrollIntoView({ behavior: "smooth" });
2886
+ }, [e, t]);
2887
+ const s = $(
740
2888
  () => ({
741
- maxWidth: (n == null ? void 0 : n.contentMaxWidth) ?? "1200px"
2889
+ maxWidth: (o == null ? void 0 : o.contentMaxWidth) ?? "1200px"
742
2890
  }),
743
- [n]
2891
+ [o]
744
2892
  );
745
- return /* @__PURE__ */ c("div", { className: J.chatbot_body, children: /* @__PURE__ */ m("div", { className: J.chatbot_body__content, style: r, children: [
746
- Array.from((t == null ? void 0 : t.values()) ?? []).map((s) => /* @__PURE__ */ c(
747
- be,
2893
+ return /* @__PURE__ */ d("div", { className: Tn.chatbot_body, children: /* @__PURE__ */ R("div", { className: Tn.chatbot_body__content, style: s, children: [
2894
+ Array.from((e == null ? void 0 : e.values()) ?? []).map((r) => /* @__PURE__ */ d(
2895
+ Uo,
748
2896
  {
749
- message: s
2897
+ message: r
750
2898
  },
751
- s.messageId
2899
+ r.messageId
752
2900
  )),
753
- /* @__PURE__ */ c(
754
- le,
2901
+ /* @__PURE__ */ d(
2902
+ Mo,
755
2903
  {
756
- placeholder: e ?? "正在輸入訊息"
2904
+ placeholder: n ?? "正在輸入訊息"
757
2905
  }
758
2906
  ),
759
- /* @__PURE__ */ c("div", { ref: o })
2907
+ /* @__PURE__ */ d("div", { ref: t })
760
2908
  ] }) });
761
2909
  }
762
- const Ce = "_chatbot_footer_1slg7_1", ve = "_chatbot_footer__content_1slg7_4", xe = "_chatbot_textarea_1slg7_14", we = "_chatbot_submit_button_1slg7_29", ye = "_chatbot_submit_button__disabled_1slg7_54", S = {
763
- chatbot_footer: Ce,
764
- chatbot_footer__content: ve,
765
- chatbot_textarea: xe,
766
- chatbot_submit_button: we,
767
- chatbot_submit_button__disabled: ye
768
- }, Te = (n) => /* @__PURE__ */ g.createElement("svg", { width: 15, height: 12, viewBox: "0 0 15 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...n }, /* @__PURE__ */ g.createElement("path", { d: "M0.823242 11.6953V0.945312L14.3328 6.32031L0.823242 11.6953ZM1.90658 10.0911L11.3649 6.32031L1.90658 2.54948V4.98052L5.92574 6.32031L1.90658 7.6601V10.0911Z", fill: "white" })), Ee = (n) => /* @__PURE__ */ g.createElement("svg", { width: 11, height: 16, viewBox: "0 0 11 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...n }, /* @__PURE__ */ g.createElement("path", { d: "M5.40658 9.90397C4.82435 9.90397 4.33158 9.7023 3.92824 9.29897C3.52491 8.89564 3.32324 8.40286 3.32324 7.82064V2.82064C3.32324 2.23842 3.52491 1.74564 3.92824 1.3423C4.33158 0.938971 4.82435 0.737305 5.40658 0.737305C5.9888 0.737305 6.48158 0.938971 6.88491 1.3423C7.28824 1.74564 7.48991 2.23842 7.48991 2.82064V7.82064C7.48991 8.40286 7.28824 8.89564 6.88491 9.29897C6.48158 9.7023 5.9888 9.90397 5.40658 9.90397ZM4.86491 15.1123V12.8654C3.56213 12.7208 2.47949 12.1724 1.61699 11.2202C0.754492 10.2679 0.323242 9.13467 0.323242 7.82064H1.40658C1.40658 8.92731 1.79706 9.87064 2.57803 10.6506C3.35887 11.4306 4.30331 11.8206 5.41137 11.8206C6.51928 11.8206 7.46213 11.4306 8.23991 10.6506C9.01769 9.87064 9.40658 8.92731 9.40658 7.82064H10.4899C10.4899 9.13467 10.0587 10.2679 9.19616 11.2202C8.33366 12.1724 7.25102 12.7208 5.94824 12.8654V15.1123H4.86491ZM5.40658 8.82064C5.68991 8.82064 5.92741 8.7248 6.11908 8.53314C6.31074 8.34147 6.40658 8.10397 6.40658 7.82064V2.82064C6.40658 2.5373 6.31074 2.2998 6.11908 2.10814C5.92741 1.91647 5.68991 1.82064 5.40658 1.82064C5.12324 1.82064 4.88574 1.91647 4.69408 2.10814C4.50241 2.2998 4.40658 2.5373 4.40658 2.82064V7.82064C4.40658 8.10397 4.50241 8.34147 4.69408 8.53314C4.88574 8.7248 5.12324 8.82064 5.40658 8.82064Z", fill: "white" })), Ne = (n) => /* @__PURE__ */ g.createElement("svg", { width: 40, height: 40, viewBox: "0 0 40 40", xmlns: "http://www.w3.org/2000/svg", ...n }, /* @__PURE__ */ g.createElement("circle", { cx: 20, cy: 20, r: 18, fill: "#D04444" }), /* @__PURE__ */ g.createElement("rect", { x: 12, y: 12, width: 16, height: 16, fill: "#FFFFFF", rx: 2, ry: 2 }));
769
- function ke(n) {
770
- const { setValue: t, className: o } = n, [e, r] = w(!1), s = R(null);
771
- C(() => {
772
- const l = window.SpeechRecognition || window.webkitSpeechRecognition;
773
- if (!l) return;
774
- const p = new l();
775
- p.lang = "zh-TW", p.continuous = !0, p.interimResults = !0, p.onresult = (f) => {
776
- for (let x = f.resultIndex; x < f.results.length; x++)
777
- f.results[x].isFinal && t((N) => N + f.results[x][0].transcript);
778
- }, p.onerror = (f) => {
779
- alert(`語音識別錯誤: ${JSON.stringify(f.error)}`);
780
- }, p.onend = () => {
781
- r(!1);
782
- }, s.current = p;
783
- }, [t]);
784
- const a = b(() => {
785
- if (!s.current) {
2910
+ const qo = "_chatbot_footer_1slg7_1", Go = "_chatbot_footer__content_1slg7_4", Wo = "_chatbot_textarea_1slg7_14", Zo = "_chatbot_submit_button_1slg7_29", Vo = "_chatbot_submit_button__disabled_1slg7_54", he = {
2911
+ chatbot_footer: qo,
2912
+ chatbot_footer__content: Go,
2913
+ chatbot_textarea: Wo,
2914
+ chatbot_submit_button: Zo,
2915
+ chatbot_submit_button__disabled: Vo
2916
+ }, jo = (o) => /* @__PURE__ */ L.createElement("svg", { width: 15, height: 12, viewBox: "0 0 15 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...o }, /* @__PURE__ */ L.createElement("path", { d: "M0.823242 11.6953V0.945312L14.3328 6.32031L0.823242 11.6953ZM1.90658 10.0911L11.3649 6.32031L1.90658 2.54948V4.98052L5.92574 6.32031L1.90658 7.6601V10.0911Z", fill: "white" })), Yo = (o) => /* @__PURE__ */ L.createElement("svg", { width: 11, height: 16, viewBox: "0 0 11 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...o }, /* @__PURE__ */ L.createElement("path", { d: "M5.40658 9.90397C4.82435 9.90397 4.33158 9.7023 3.92824 9.29897C3.52491 8.89564 3.32324 8.40286 3.32324 7.82064V2.82064C3.32324 2.23842 3.52491 1.74564 3.92824 1.3423C4.33158 0.938971 4.82435 0.737305 5.40658 0.737305C5.9888 0.737305 6.48158 0.938971 6.88491 1.3423C7.28824 1.74564 7.48991 2.23842 7.48991 2.82064V7.82064C7.48991 8.40286 7.28824 8.89564 6.88491 9.29897C6.48158 9.7023 5.9888 9.90397 5.40658 9.90397ZM4.86491 15.1123V12.8654C3.56213 12.7208 2.47949 12.1724 1.61699 11.2202C0.754492 10.2679 0.323242 9.13467 0.323242 7.82064H1.40658C1.40658 8.92731 1.79706 9.87064 2.57803 10.6506C3.35887 11.4306 4.30331 11.8206 5.41137 11.8206C6.51928 11.8206 7.46213 11.4306 8.23991 10.6506C9.01769 9.87064 9.40658 8.92731 9.40658 7.82064H10.4899C10.4899 9.13467 10.0587 10.2679 9.19616 11.2202C8.33366 12.1724 7.25102 12.7208 5.94824 12.8654V15.1123H4.86491ZM5.40658 8.82064C5.68991 8.82064 5.92741 8.7248 6.11908 8.53314C6.31074 8.34147 6.40658 8.10397 6.40658 7.82064V2.82064C6.40658 2.5373 6.31074 2.2998 6.11908 2.10814C5.92741 1.91647 5.68991 1.82064 5.40658 1.82064C5.12324 1.82064 4.88574 1.91647 4.69408 2.10814C4.50241 2.2998 4.40658 2.5373 4.40658 2.82064V7.82064C4.40658 8.10397 4.50241 8.34147 4.69408 8.53314C4.88574 8.7248 5.12324 8.82064 5.40658 8.82064Z", fill: "white" })), Xo = (o) => /* @__PURE__ */ L.createElement("svg", { width: 40, height: 40, viewBox: "0 0 40 40", xmlns: "http://www.w3.org/2000/svg", ...o }, /* @__PURE__ */ L.createElement("circle", { cx: 20, cy: 20, r: 18, fill: "#D04444" }), /* @__PURE__ */ L.createElement("rect", { x: 12, y: 12, width: 16, height: 16, fill: "#FFFFFF", rx: 2, ry: 2 }));
2917
+ function Qo(o) {
2918
+ const { setValue: e, className: t } = o, [n, s] = V(!1), r = ce(null);
2919
+ O(() => {
2920
+ const f = window.SpeechRecognition || window.webkitSpeechRecognition;
2921
+ if (!f) return;
2922
+ const g = new f();
2923
+ g.lang = "zh-TW", g.continuous = !0, g.interimResults = !0, g.onresult = (x) => {
2924
+ for (let k = x.resultIndex; k < x.results.length; k++)
2925
+ x.results[k].isFinal && e((T) => T + x.results[k][0].transcript);
2926
+ }, g.onerror = (x) => {
2927
+ alert(`語音識別錯誤: ${JSON.stringify(x.error)}`);
2928
+ }, g.onend = () => {
2929
+ s(!1);
2930
+ }, r.current = g;
2931
+ }, [e]);
2932
+ const a = I(() => {
2933
+ if (!r.current) {
786
2934
  alert("無法開始辨識: 語音識別器未初始化,請檢查是否有授權使用麥克風");
787
2935
  return;
788
2936
  }
789
2937
  try {
790
- s.current.start(), r(!0);
791
- } catch (l) {
792
- alert(`無法開始辨識: ${JSON.stringify(l)}`);
793
- }
794
- }, []), i = b(() => {
795
- s.current && (s.current.stop(), r(!1));
796
- }, []), u = b(
797
- (l) => {
798
- e || (l.preventDefault(), a());
2938
+ r.current.start(), s(!0);
2939
+ } catch (f) {
2940
+ alert(`無法開始辨識: ${JSON.stringify(f)}`);
2941
+ }
2942
+ }, []), i = I(() => {
2943
+ r.current && (r.current.stop(), s(!1));
2944
+ }, []), p = I(
2945
+ (f) => {
2946
+ n || (f.preventDefault(), a());
799
2947
  },
800
- [e, a]
801
- ), d = b(
802
- (l) => {
803
- e && (l.preventDefault(), i());
2948
+ [n, a]
2949
+ ), c = I(
2950
+ (f) => {
2951
+ n && (f.preventDefault(), i());
804
2952
  },
805
- [e, i]
806
- ), h = b(
807
- (l) => {
808
- e || (l.preventDefault(), a());
2953
+ [n, i]
2954
+ ), u = I(
2955
+ (f) => {
2956
+ n || (f.preventDefault(), a());
809
2957
  },
810
- [e, a]
811
- ), _ = b(
812
- (l) => {
813
- e && (l.preventDefault(), i());
2958
+ [n, a]
2959
+ ), m = I(
2960
+ (f) => {
2961
+ n && (f.preventDefault(), i());
814
2962
  },
815
- [e, i]
2963
+ [n, i]
816
2964
  );
817
- return /* @__PURE__ */ c(
2965
+ return /* @__PURE__ */ d(
818
2966
  "div",
819
2967
  {
820
- className: o,
821
- onMouseDown: u,
822
- onMouseUp: d,
823
- onTouchStart: h,
824
- onTouchEnd: _,
825
- children: e ? /* @__PURE__ */ c(Ne, {}) : /* @__PURE__ */ c(Ee, {})
2968
+ className: t,
2969
+ onMouseDown: p,
2970
+ onMouseUp: c,
2971
+ onTouchStart: u,
2972
+ onTouchEnd: m,
2973
+ children: n ? /* @__PURE__ */ d(Xo, {}) : /* @__PURE__ */ d(Yo, {})
826
2974
  }
827
2975
  );
828
2976
  }
829
- function Se() {
830
- const { sendMessage: n, isConnecting: t } = T(), { chatbot: o } = L(), [e, r] = w(""), [s, a] = w(!1), i = R(null), u = v(
831
- () => t || !e.trim(),
832
- [t, e]
833
- ), d = v(
2977
+ function Ko() {
2978
+ const { sendMessage: o, isConnecting: e } = se(), { chatbot: t } = ge(), [n, s] = V(""), [r, a] = V(!1), i = ce(null), p = $(
2979
+ () => e || !n.trim(),
2980
+ [e, n]
2981
+ ), c = $(
834
2982
  () => ({
835
- maxWidth: (o == null ? void 0 : o.contentMaxWidth) ?? "1200px",
836
- borderTopColor: o == null ? void 0 : o.borderColor
2983
+ maxWidth: (t == null ? void 0 : t.contentMaxWidth) ?? "1200px",
2984
+ borderTopColor: t == null ? void 0 : t.borderColor
837
2985
  }),
838
- [o]
839
- ), h = b(
840
- (p) => {
841
- const f = p.target, x = f.value;
842
- f.style.height = "36px", x && (f.style.height = `${f.scrollHeight}px`), r(p.target.value);
2986
+ [t]
2987
+ ), u = I(
2988
+ (g) => {
2989
+ const x = g.target, k = x.value;
2990
+ x.style.height = "36px", k && (x.style.height = `${x.scrollHeight}px`), s(g.target.value);
843
2991
  },
844
2992
  []
845
- ), _ = b(() => {
846
- !s && !t && (n == null || n(e), r(""), i.current && (i.current.style.height = "36px"));
847
- }, [s, t, n, e]), l = b(
848
- (p) => {
849
- if (p.key === "Enter" && !s && !t && e.trim()) {
850
- n == null || n(e), r("");
851
- const f = p.target;
852
- f.style.height = "36px";
2993
+ ), m = I(() => {
2994
+ !r && !e && (o == null || o({ text: n }), s(""), i.current && (i.current.style.height = "36px"));
2995
+ }, [r, e, o, n]), f = I(
2996
+ (g) => {
2997
+ if (g.key === "Enter" && !r && !e && n.trim()) {
2998
+ o == null || o({ text: n }), s("");
2999
+ const x = g.target;
3000
+ x.style.height = "36px";
853
3001
  }
854
3002
  },
855
- [s, t, n, e]
3003
+ [r, e, o, n]
856
3004
  );
857
- return /* @__PURE__ */ c("div", { className: S.chatbot_footer, children: /* @__PURE__ */ m("div", { className: S.chatbot_footer__content, style: d, children: [
858
- /* @__PURE__ */ c(
3005
+ return /* @__PURE__ */ d("div", { className: he.chatbot_footer, children: /* @__PURE__ */ R("div", { className: he.chatbot_footer__content, style: c, children: [
3006
+ /* @__PURE__ */ d(
859
3007
  "textarea",
860
3008
  {
861
3009
  ref: i,
862
- className: S.chatbot_textarea,
863
- disabled: t,
3010
+ className: he.chatbot_textarea,
3011
+ disabled: e,
864
3012
  cols: 40,
865
- value: e,
3013
+ value: n,
866
3014
  placeholder: "Enter message",
867
- onChange: h,
868
- onKeyDown: l,
3015
+ onChange: u,
3016
+ onKeyDown: f,
869
3017
  onCompositionStart: () => a(!0),
870
3018
  onCompositionEnd: () => a(!1)
871
3019
  }
872
3020
  ),
873
- e ? /* @__PURE__ */ c(
3021
+ n ? /* @__PURE__ */ d(
874
3022
  "button",
875
3023
  {
876
- className: E(
877
- S.chatbot_submit_button,
878
- u && S.chatbot_submit_button__disabled
3024
+ className: ae(
3025
+ he.chatbot_submit_button,
3026
+ p && he.chatbot_submit_button__disabled
879
3027
  ),
880
- disabled: u,
881
- onClick: _,
882
- children: /* @__PURE__ */ c(Te, {})
3028
+ disabled: p,
3029
+ onClick: m,
3030
+ children: /* @__PURE__ */ d(jo, {})
883
3031
  }
884
- ) : /* @__PURE__ */ c(
885
- ke,
3032
+ ) : /* @__PURE__ */ d(
3033
+ Qo,
886
3034
  {
887
- setValue: r,
888
- className: E(
889
- S.chatbot_submit_button,
890
- t && S.chatbot_submit_button__disabled
3035
+ setValue: s,
3036
+ className: ae(
3037
+ he.chatbot_submit_button,
3038
+ e && he.chatbot_submit_button__disabled
891
3039
  )
892
3040
  }
893
3041
  )
894
3042
  ] }) });
895
3043
  }
896
- const Re = "_chatbot_root_1t5cx_1", Le = "_full_screen_1t5cx_122", Me = "_chatbot_container_1t5cx_130", ze = "_screen_keyboard_open_1t5cx_135", B = {
897
- chatbot_root: Re,
898
- full_screen: Le,
899
- chatbot_container: Me,
900
- screen_keyboard_open: ze
3044
+ const Jo = "_chatbot_root_lao40_1", ei = "_full_screen_lao40_135", ti = "_chatbot_container_lao40_143", ni = "_screen_keyboard_open_lao40_148", qe = {
3045
+ chatbot_root: Jo,
3046
+ full_screen: ei,
3047
+ chatbot_container: ti,
3048
+ screen_keyboard_open: ni
901
3049
  };
902
- function He(n) {
903
- const { children: t } = n, o = R(null), e = L();
904
- St(o), kt();
905
- const [, r] = Et() ?? [], s = Nt(), a = v(() => {
906
- var i, u;
3050
+ function ri(o) {
3051
+ const { children: e } = o, t = ce(null), n = ge();
3052
+ Wr(t), Gr();
3053
+ const [, s] = Fr() ?? [], r = qr(), a = $(() => {
3054
+ var i, p;
907
3055
  return Object.assign(
908
- (i = e == null ? void 0 : e.chatbot) != null && i.backgroundColor ? {
909
- backgroundColor: (u = e.chatbot) == null ? void 0 : u.backgroundColor
3056
+ (i = n == null ? void 0 : n.chatbot) != null && i.backgroundColor ? {
3057
+ backgroundColor: (p = n.chatbot) == null ? void 0 : p.backgroundColor
910
3058
  } : {},
911
- s ? { height: r } : {}
3059
+ r ? { height: s } : {}
912
3060
  );
913
- }, [r, s, e]);
914
- return /* @__PURE__ */ c("div", { className: B.full_screen, children: /* @__PURE__ */ c(
3061
+ }, [s, r, n]);
3062
+ return /* @__PURE__ */ d("div", { className: qe.full_screen, children: /* @__PURE__ */ d(
915
3063
  "div",
916
3064
  {
917
- ref: o,
918
- className: E(
919
- B.chatbot_container,
920
- s && B.screen_keyboard_open
3065
+ ref: t,
3066
+ className: ae(
3067
+ qe.chatbot_container,
3068
+ r && qe.screen_keyboard_open
921
3069
  ),
922
3070
  style: a,
923
- children: t
3071
+ children: e
924
3072
  }
925
3073
  ) });
926
3074
  }
927
- function Ve(n) {
928
- const { fullScreen: t, children: o } = n, e = R(null);
929
- Rt(e);
930
- const r = L();
931
- return /* @__PURE__ */ c("div", { ref: e, className: B.chatbot_root, children: t ? /* @__PURE__ */ c(He, { children: o }) : /* @__PURE__ */ c("div", { className: B.chatbot_container, style: r == null ? void 0 : r.chatbot, children: o }) });
3075
+ function si(o) {
3076
+ const { fullScreen: e, children: t } = o, n = ce(null);
3077
+ Zr(n);
3078
+ const s = ge();
3079
+ return /* @__PURE__ */ d("div", { ref: n, className: qe.chatbot_root, children: e ? /* @__PURE__ */ d(ri, { children: t }) : /* @__PURE__ */ d("div", { className: qe.chatbot_container, style: s == null ? void 0 : s.chatbot, children: t }) });
932
3080
  }
933
- function Ie(n) {
3081
+ function ci(o) {
934
3082
  const {
935
- title: t,
936
- theme: o,
937
- config: e,
938
- customChannelId: r,
939
- initMessages: s,
3083
+ title: e,
3084
+ theme: t,
3085
+ config: n,
3086
+ customChannelId: s,
3087
+ initMessages: r,
940
3088
  fullScreen: a = !1,
941
3089
  avatar: i,
942
- botTypingPlaceholder: u,
943
- onReset: d,
944
- onClose: h,
945
- onErrorClick: _,
946
- errorMessageRenderer: l
947
- } = n;
948
- return /* @__PURE__ */ c(vt, { theme: o, children: /* @__PURE__ */ c(
949
- Mt,
3090
+ botTypingPlaceholder: p,
3091
+ onReset: c,
3092
+ onClose: u,
3093
+ onErrorClick: m,
3094
+ errorMessageRenderer: f
3095
+ } = o;
3096
+ return /* @__PURE__ */ d(zr, { theme: t, children: /* @__PURE__ */ d(
3097
+ jr,
950
3098
  {
951
3099
  avatar: i,
952
- config: e,
953
- customChannelId: r,
954
- initMessages: s,
955
- botTypingPlaceholder: u,
956
- children: /* @__PURE__ */ m(Ve, { fullScreen: a, children: [
957
- /* @__PURE__ */ c(Dt, { title: t, onReset: d, onClose: h }),
958
- /* @__PURE__ */ c(
959
- zt,
3100
+ config: n,
3101
+ customChannelId: s,
3102
+ initMessages: r,
3103
+ botTypingPlaceholder: p,
3104
+ children: /* @__PURE__ */ R(si, { fullScreen: a, children: [
3105
+ /* @__PURE__ */ d(os, { title: e, onReset: c, onClose: u }),
3106
+ /* @__PURE__ */ d(
3107
+ Yr,
960
3108
  {
961
- onErrorClick: _,
962
- errorMessageRenderer: l,
963
- children: /* @__PURE__ */ c(pe, {})
3109
+ onErrorClick: m,
3110
+ errorMessageRenderer: f,
3111
+ children: /* @__PURE__ */ d(Fo, {})
964
3112
  }
965
3113
  ),
966
- /* @__PURE__ */ c(Se, {})
3114
+ /* @__PURE__ */ d(Ko, {})
967
3115
  ] })
968
3116
  }
969
3117
  ) });
970
3118
  }
971
3119
  export {
972
- Ie as Chatbot,
973
- xt as useAsgardServiceClient,
974
- wt as useChannel,
975
- yt as useDebounce,
976
- Nt as useIsOnScreenKeyboardOpen,
977
- kt as useOnScreenKeyboardScrollFix,
978
- St as usePreventOverScrolling,
979
- Lt as useResizeObserver,
980
- Rt as useUpdateVh,
981
- Et as useViewportSize
3120
+ ci as Chatbot,
3121
+ $r as useAsgardServiceClient,
3122
+ Br as useChannel,
3123
+ Hr as useDebounce,
3124
+ qr as useIsOnScreenKeyboardOpen,
3125
+ Gr as useOnScreenKeyboardScrollFix,
3126
+ Wr as usePreventOverScrolling,
3127
+ Vr as useResizeObserver,
3128
+ Zr as useUpdateVh,
3129
+ Fr as useViewportSize
982
3130
  };