@enegelai/bot-widget 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,4433 @@
1
+ var pt = Object.defineProperty;
2
+ var ht = (t, e, o) => e in t ? pt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o;
3
+ var $ = (t, e, o) => (ht(t, typeof e != "symbol" ? e + "" : e, o), o);
4
+ import { css as w, LitElement as le, html as l } from "lit";
5
+ import { property as c, customElement as x, queryAll as ut, eventOptions as qe, query as Ce } from "lit/decorators.js";
6
+ import { unsafeHTML as De } from "lit-html/directives/unsafe-html.js";
7
+ import "@shoelace-style/shoelace/dist/themes/light.css";
8
+ import "@shoelace-style/shoelace/dist/themes/dark.css";
9
+ import "@shoelace-style/shoelace/dist/components/button/button.js";
10
+ import "@shoelace-style/shoelace/dist/components/avatar/avatar.js";
11
+ import "@shoelace-style/shoelace/dist/components/input/input.js";
12
+ import "@shoelace-style/shoelace/dist/components/textarea/textarea.js";
13
+ import "@shoelace-style/shoelace/dist/components/dialog/dialog.js";
14
+ import "@shoelace-style/shoelace/dist/components/tab-group/tab-group.js";
15
+ import "@shoelace-style/shoelace/dist/components/tab/tab.js";
16
+ import "@shoelace-style/shoelace/dist/components/tab-panel/tab-panel.js";
17
+ import "@shoelace-style/shoelace/dist/components/radio/radio.js";
18
+ import "@shoelace-style/shoelace/dist/components/radio-group/radio-group.js";
19
+ import "@shoelace-style/shoelace/dist/components/radio-button/radio-button.js";
20
+ import "@shoelace-style/shoelace/dist/components/switch/switch.js";
21
+ import "@shoelace-style/shoelace/dist/components/tooltip/tooltip.js";
22
+ import "@shoelace-style/shoelace/dist/components/spinner/spinner.js";
23
+ import "@shoelace-style/shoelace/dist/components/alert/alert.js";
24
+ import { repeat as fe } from "lit/directives/repeat.js";
25
+ import { when as B } from "lit/directives/when.js";
26
+ import { until as Ae } from "lit-html/directives/until.js";
27
+ import bt from "markdown-it";
28
+ import gt from "markdown-it-link-attributes";
29
+ import ge from "highlight.js";
30
+ function Fe(t) {
31
+ return typeof t == "function" ? t() : t;
32
+ }
33
+ const ie = class ie extends Event {
34
+ /**
35
+ * @param {string} key of the state that has changed
36
+ * @param {unknown} value for the changed key
37
+ */
38
+ constructor(o, a, r) {
39
+ super(ie.eventName, {
40
+ cancelable: !1
41
+ });
42
+ $(this, "key");
43
+ $(this, "state");
44
+ $(this, "value");
45
+ this.key = o, this.value = a, this.state = r;
46
+ }
47
+ };
48
+ $(ie, "eventName", "lit-state-changed");
49
+ let E = ie;
50
+ const mt = (t, e) => e !== t && (e === e || t === t);
51
+ class G extends EventTarget {
52
+ constructor() {
53
+ super();
54
+ // hold a reference to hooks
55
+ $(this, "hookMap", /* @__PURE__ */ new Map());
56
+ this.constructor.finalize(), this.propertyMap && [...this.propertyMap].forEach(([o, a]) => {
57
+ if (a.initialValue !== void 0) {
58
+ const r = Fe(a.initialValue);
59
+ this[o] = r, a.value = r;
60
+ }
61
+ });
62
+ }
63
+ get propertyMap() {
64
+ return this.constructor.propertyMap;
65
+ }
66
+ get stateValue() {
67
+ return Object.fromEntries([...this.propertyMap].map(([o]) => [o, this[o]]));
68
+ }
69
+ static finalize() {
70
+ if (this.finalized)
71
+ return !1;
72
+ this.finalized = !0;
73
+ const o = Object.keys(this.properties || {});
74
+ for (const a of o)
75
+ this.createProperty(a, this.properties[a]);
76
+ return !0;
77
+ }
78
+ static createProperty(o, a) {
79
+ this.finalize();
80
+ const r = typeof o == "symbol" ? Symbol() : `__${o}`, s = this.getPropertyDescriptor(o, r, a);
81
+ Object.defineProperty(this.prototype, o, s);
82
+ }
83
+ static getPropertyDescriptor(o, a, r) {
84
+ const s = (r == null ? void 0 : r.hasChanged) || mt;
85
+ return {
86
+ get() {
87
+ return this[a];
88
+ },
89
+ set(n) {
90
+ const i = this[o];
91
+ this[a] = n, s(n, i) === !0 && this.dispatchStateEvent(o, n, this);
92
+ },
93
+ configurable: !0,
94
+ enumerable: !0
95
+ };
96
+ }
97
+ /**
98
+ * Reset the state to its original values, skipping
99
+ * properties marked as skipReset
100
+ */
101
+ reset() {
102
+ this.hookMap.forEach((o) => o.reset()), [...this.propertyMap].filter(([o, a]) => !(a.skipReset === !0 || a.resetValue === void 0)).forEach(([o, a]) => {
103
+ this[o] = a.resetValue;
104
+ });
105
+ }
106
+ /**
107
+ * subscribe to state change event. The callback will be called anytime
108
+ * a state property change if `nameOrNames` is undefined, or only for matching
109
+ * property values specified by `nameOrNames`
110
+ * @param callback the callback function to call
111
+ * @param nameOrNames
112
+ * @returns a unsubscribe function.
113
+ */
114
+ subscribe(o, a, r) {
115
+ a && !Array.isArray(a) && (a = [a]);
116
+ const s = (n) => {
117
+ (!a || a.includes(n.key)) && o(n.key, n.value, this);
118
+ };
119
+ return this.addEventListener(E.eventName, s, r), () => this.removeEventListener(E.eventName, s);
120
+ }
121
+ dispatchStateEvent(o, a, r) {
122
+ this.dispatchEvent(new E(o, a, r));
123
+ }
124
+ }
125
+ // a map holding decorators definition.
126
+ $(G, "propertyMap"), $(G, "properties"), $(G, "finalized", !1);
127
+ class ft {
128
+ constructor(e, o, a) {
129
+ $(this, "host");
130
+ $(this, "state");
131
+ $(this, "callback");
132
+ this.host = e, this.state = o, this.host.addController(this), this.callback = a || (() => this.host.requestUpdate());
133
+ }
134
+ hostConnected() {
135
+ this.state.addEventListener(E.eventName, this.callback), this.callback();
136
+ }
137
+ hostDisconnected() {
138
+ this.state.removeEventListener(E.eventName, this.callback);
139
+ }
140
+ }
141
+ /**
142
+ * @license
143
+ * Copyright 2017 Google LLC
144
+ * SPDX-License-Identifier: BSD-3-Clause
145
+ */
146
+ const Ze = ({ finisher: t, descriptor: e }) => (o, a) => {
147
+ var r;
148
+ if (a === void 0) {
149
+ const s = (r = o.originalKey) !== null && r !== void 0 ? r : o.key, n = e != null ? { kind: "method", placement: "prototype", key: s, descriptor: e(o.key) } : { ...o, key: s };
150
+ return t != null && (n.finisher = function(i) {
151
+ t(i, s);
152
+ }), n;
153
+ }
154
+ {
155
+ const s = o.constructor;
156
+ e !== void 0 && Object.defineProperty(o, a, e(a)), t == null || t(s, a);
157
+ }
158
+ };
159
+ function I(t) {
160
+ return Ze({
161
+ // @ts-ignore ctor is typof State and not typeof ReactiveElement
162
+ finisher: (e, o) => {
163
+ if (Object.getOwnPropertyDescriptor(e.prototype, o))
164
+ throw new Error("@property must be called before all state decorators");
165
+ return e.propertyMap || (e.propertyMap = /* @__PURE__ */ new Map()), e.propertyMap.set(o, { ...t, initialValue: t == null ? void 0 : t.value, resetValue: t == null ? void 0 : t.value }), e.createProperty(o, t);
166
+ }
167
+ });
168
+ }
169
+ function yt(t, e) {
170
+ if (t !== null && (e === Boolean || e === Number || e === Array || e === Object))
171
+ try {
172
+ t = JSON.parse(t);
173
+ } catch {
174
+ console.warn("cannot parse value", t);
175
+ }
176
+ return t;
177
+ }
178
+ new URL(window.location.href);
179
+ const vt = {
180
+ prefix: "_ls"
181
+ };
182
+ function D(t) {
183
+ return t = { ...vt, ...t }, Ze({
184
+ // @ts-ignore ctor is typof State and not typeof ReactiveElement
185
+ finisher: (e, o) => {
186
+ const a = Object.getOwnPropertyDescriptor(e.prototype, o);
187
+ if (!a)
188
+ throw new Error("@local-storage decorator need to be called after @property");
189
+ const r = `${(t == null ? void 0 : t.prefix) || ""}_${(t == null ? void 0 : t.key) || String(o)}`, s = e.propertyMap.get(o), n = s == null ? void 0 : s.type;
190
+ if (s) {
191
+ const m = s.initialValue;
192
+ s.initialValue = () => yt(localStorage.getItem(r), n) ?? Fe(m), e.propertyMap.set(o, { ...s, ...t });
193
+ }
194
+ const i = a == null ? void 0 : a.set, g = {
195
+ ...a,
196
+ set: function(m) {
197
+ m !== void 0 && localStorage.setItem(r, n === Object || n === Array ? JSON.stringify(m) : m), i && i.call(this, m);
198
+ }
199
+ };
200
+ Object.defineProperty(e.prototype, o, g);
201
+ }
202
+ });
203
+ }
204
+ var wt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
205
+ function xt(t) {
206
+ return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
207
+ }
208
+ var Ue = { exports: {} };
209
+ (function(t) {
210
+ (function(e, o) {
211
+ t.exports ? t.exports = o() : e.log = o();
212
+ })(wt, function() {
213
+ var e = function() {
214
+ }, o = "undefined", a = typeof window !== o && typeof window.navigator !== o && /Trident\/|MSIE /.test(window.navigator.userAgent), r = [
215
+ "trace",
216
+ "debug",
217
+ "info",
218
+ "warn",
219
+ "error"
220
+ ];
221
+ function s(h, f) {
222
+ var y = h[f];
223
+ if (typeof y.bind == "function")
224
+ return y.bind(h);
225
+ try {
226
+ return Function.prototype.bind.call(y, h);
227
+ } catch {
228
+ return function() {
229
+ return Function.prototype.apply.apply(y, [h, arguments]);
230
+ };
231
+ }
232
+ }
233
+ function n() {
234
+ console.log && (console.log.apply ? console.log.apply(console, arguments) : Function.prototype.apply.apply(console.log, [console, arguments])), console.trace && console.trace();
235
+ }
236
+ function i(h) {
237
+ return h === "debug" && (h = "log"), typeof console === o ? !1 : h === "trace" && a ? n : console[h] !== void 0 ? s(console, h) : console.log !== void 0 ? s(console, "log") : e;
238
+ }
239
+ function u(h, f) {
240
+ for (var y = 0; y < r.length; y++) {
241
+ var p = r[y];
242
+ this[p] = y < h ? e : this.methodFactory(p, h, f);
243
+ }
244
+ this.log = this.debug;
245
+ }
246
+ function g(h, f, y) {
247
+ return function() {
248
+ typeof console !== o && (u.call(this, f, y), this[h].apply(this, arguments));
249
+ };
250
+ }
251
+ function m(h, f, y) {
252
+ return i(h) || g.apply(this, arguments);
253
+ }
254
+ function he(h, f, y) {
255
+ var p = this, Oe;
256
+ f = f ?? "WARN";
257
+ var M = "loglevel";
258
+ typeof h == "string" ? M += ":" + h : typeof h == "symbol" && (M = void 0);
259
+ function lt(d) {
260
+ var P = (r[d] || "silent").toUpperCase();
261
+ if (!(typeof window === o || !M)) {
262
+ try {
263
+ window.localStorage[M] = P;
264
+ return;
265
+ } catch {
266
+ }
267
+ try {
268
+ window.document.cookie = encodeURIComponent(M) + "=" + P + ";";
269
+ } catch {
270
+ }
271
+ }
272
+ }
273
+ function He() {
274
+ var d;
275
+ if (!(typeof window === o || !M)) {
276
+ try {
277
+ d = window.localStorage[M];
278
+ } catch {
279
+ }
280
+ if (typeof d === o)
281
+ try {
282
+ var P = window.document.cookie, J = P.indexOf(
283
+ encodeURIComponent(M) + "="
284
+ );
285
+ J !== -1 && (d = /^([^;]+)/.exec(P.slice(J))[1]);
286
+ } catch {
287
+ }
288
+ return p.levels[d] === void 0 && (d = void 0), d;
289
+ }
290
+ }
291
+ function ct() {
292
+ if (!(typeof window === o || !M)) {
293
+ try {
294
+ window.localStorage.removeItem(M);
295
+ return;
296
+ } catch {
297
+ }
298
+ try {
299
+ window.document.cookie = encodeURIComponent(M) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
300
+ } catch {
301
+ }
302
+ }
303
+ }
304
+ p.name = h, p.levels = {
305
+ TRACE: 0,
306
+ DEBUG: 1,
307
+ INFO: 2,
308
+ WARN: 3,
309
+ ERROR: 4,
310
+ SILENT: 5
311
+ }, p.methodFactory = y || m, p.getLevel = function() {
312
+ return Oe;
313
+ }, p.setLevel = function(d, P) {
314
+ if (typeof d == "string" && p.levels[d.toUpperCase()] !== void 0 && (d = p.levels[d.toUpperCase()]), typeof d == "number" && d >= 0 && d <= p.levels.SILENT) {
315
+ if (Oe = d, P !== !1 && lt(d), u.call(p, d, h), typeof console === o && d < p.levels.SILENT)
316
+ return "No console available for logging";
317
+ } else
318
+ throw "log.setLevel() called with invalid level: " + d;
319
+ }, p.setDefaultLevel = function(d) {
320
+ f = d, He() || p.setLevel(d, !1);
321
+ }, p.resetLevel = function() {
322
+ p.setLevel(f, !1), ct();
323
+ }, p.enableAll = function(d) {
324
+ p.setLevel(p.levels.TRACE, d);
325
+ }, p.disableAll = function(d) {
326
+ p.setLevel(p.levels.SILENT, d);
327
+ };
328
+ var be = He();
329
+ be == null && (be = f), p.setLevel(be, !1);
330
+ }
331
+ var j = new he(), ue = {};
332
+ j.getLogger = function(f) {
333
+ if (typeof f != "symbol" && typeof f != "string" || f === "")
334
+ throw new TypeError("You must supply a name when creating a logger.");
335
+ var y = ue[f];
336
+ return y || (y = ue[f] = new he(
337
+ f,
338
+ j.getLevel(),
339
+ j.methodFactory
340
+ )), y;
341
+ };
342
+ var it = typeof window !== o ? window.log : void 0;
343
+ return j.noConflict = function() {
344
+ return typeof window !== o && window.log === j && (window.log = it), j;
345
+ }, j.getLoggers = function() {
346
+ return ue;
347
+ }, j.default = j, j;
348
+ });
349
+ })(Ue);
350
+ var kt = Ue.exports;
351
+ const ce = /* @__PURE__ */ xt(kt), _t = w`
352
+ :host {
353
+ }
354
+ .cb-wrapper {
355
+ color: var(--sl-color-neutral-600);
356
+ width: 420px;
357
+ overflow: hidden;
358
+ display: flex;
359
+ flex-direction: column;
360
+ justify-content: space-between;
361
+ align-items: center;
362
+ box-sizing: border-box;
363
+ border-radius: 6px;
364
+
365
+ height: calc(100% - 120px);
366
+ max-height: 800px;
367
+ position: fixed;
368
+ right: 25px;
369
+ bottom: 100px;
370
+ background: rgb(255, 255, 255);
371
+ overflow: hidden;
372
+
373
+ box-shadow: rgba(148, 149, 150, 0.2) 20px 20px 40px 20px;
374
+
375
+ //font-family: Inter, sans-serif, Avenir, Helvetica, Arial;
376
+ font-family: system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
377
+ //font-size: 0.9rem;
378
+ font-size: 100%;
379
+ font-style: normal;
380
+ letter-spacing: normal;
381
+ font-stretch: normal;
382
+ font-variant: normal;
383
+ font-weight: 400;
384
+ line-height: 20px;
385
+
386
+ z-index: 100;
387
+
388
+ //animation: fadeIn 0.1s ease-in-out;
389
+ }
390
+
391
+ .cb-alert-box {
392
+ width: 100%;
393
+ box-sizing: border-box;
394
+ padding: 5px 10px;
395
+ }
396
+
397
+ @keyframes fadeIn {
398
+ from {
399
+ opacity: 0;
400
+ display: none;
401
+ }
402
+ to {
403
+ opacity: 1;
404
+ display: block;
405
+ }
406
+ }
407
+
408
+ @media (max-width: 450px) {
409
+ .cb-wrapper {
410
+ width: 100%;
411
+ height: 100%;
412
+ max-height: 100%;
413
+ right: 0;
414
+ bottom: 0;
415
+ border-radius: 0;
416
+ }
417
+ }
418
+ `, S = w`
419
+ :host {
420
+ --primary-color: var(--sl-color-primary-600);
421
+ }
422
+
423
+ .link__item,
424
+ .link__item:visited,
425
+ .link__item:active {
426
+ color: var(--primary-color);
427
+ }
428
+
429
+ .link__item.inverse,
430
+ .link__item.inverse:visited,
431
+ .link__item.inverse:active {
432
+ color: white;
433
+ }
434
+
435
+ sl-button.icon {
436
+ display: flex;
437
+ justify-content: center;
438
+ align-items: center;
439
+ }
440
+
441
+ .color-white {
442
+ color: white;
443
+ }
444
+
445
+ .color-default {
446
+ color: var(--sl-color-neutral-600);
447
+ }
448
+
449
+ .color-primary {
450
+ color: var(--sl-color-primary-600);
451
+ }
452
+
453
+ .color-success,
454
+ .color-green {
455
+ color: var(--sl-color-success-600);
456
+ }
457
+
458
+ .color-warning {
459
+ color: var(--sl-color-warning-600);
460
+ }
461
+
462
+ .color-danger,
463
+ .color-error {
464
+ color: var(--sl-color-danger-600);
465
+ }
466
+
467
+ .color-default {
468
+ color: var(--sl-color-neutral-600);
469
+ }
470
+
471
+ .text-button {
472
+ cursor: pointer;
473
+ }
474
+
475
+ .text-button:hover {
476
+ text-decoration: underline;
477
+ }
478
+ `, Ne = w`
479
+ ${S}
480
+
481
+ :host {
482
+ display: inline-flex;
483
+ justify-content: center;
484
+ align-items: center;
485
+ vertical-align: sub;
486
+ font-size: 1.2rem;
487
+ }
488
+
489
+ .cb-icon {
490
+ display: inline-flex;
491
+ justify-content: center;
492
+ align-items: center;
493
+ vertical-align: sub;
494
+ font-size: 1.2rem;
495
+ }
496
+
497
+ .color-white {
498
+ color: white;
499
+ }
500
+ `;
501
+ var Ct = Object.defineProperty, $t = Object.getOwnPropertyDescriptor, $e = (t, e, o, a) => {
502
+ for (var r = a > 1 ? void 0 : a ? $t(e, o) : e, s = t.length - 1, n; s >= 0; s--)
503
+ (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
504
+ return a && r && Ct(e, o, r), r;
505
+ };
506
+ let U = class extends le {
507
+ constructor() {
508
+ super(...arguments), this.color = "primary", this.svg = "";
509
+ }
510
+ render() {
511
+ return l`<span class="cb-icon color-${this.color}" part="base"
512
+ >${De(this.svg)}</span
513
+ >`;
514
+ }
515
+ };
516
+ U.styles = Ne;
517
+ $e([
518
+ c({ type: String })
519
+ ], U.prototype, "color", 2);
520
+ $e([
521
+ c({ type: String })
522
+ ], U.prototype, "svg", 2);
523
+ U = $e([
524
+ x("cb-icon")
525
+ ], U);
526
+ const jt = w`
527
+ ${S}
528
+ :host {
529
+ position: relative;
530
+ font-weight: bold;
531
+ font-size: 16px;
532
+ line-height: 2rem;
533
+ padding: 10px;
534
+ box-shadow: 0 2px 3px rgba(0, 0, 0, 0.2);
535
+ width: 100%;
536
+ text-align: left;
537
+ color: rgba(255, 255, 255, 1);
538
+ border-radius-top-left: 6px;
539
+ border-radius-top-right: 6px;
540
+ top: 0;
541
+ box-sizing: border-box;
542
+
543
+ //background: var(--primary-color);
544
+ background: rgb(0, 208, 117);
545
+
546
+ // position: fixed;
547
+ // z-index: 100;
548
+ // top: 0;
549
+ }
550
+
551
+ .cb-header {
552
+ display: flex;
553
+ flex-direction: row;
554
+ justify-content: space-between;
555
+ align-items: center;
556
+ position: relative;
557
+ }
558
+
559
+ .title {
560
+ justify-items: center;
561
+ }
562
+
563
+ .cb-setting-button {
564
+ font-size: 1.5rem;
565
+ color: white;
566
+ }
567
+ `;
568
+ var Mt = Object.defineProperty, Lt = Object.getOwnPropertyDescriptor, St = (t, e, o, a) => {
569
+ for (var r = a > 1 ? void 0 : a ? Lt(e, o) : e, s = t.length - 1, n; s >= 0; s--)
570
+ (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
571
+ return a && r && Mt(e, o, r), r;
572
+ };
573
+ class C extends le {
574
+ constructor() {
575
+ super(...arguments), this.lang = "en";
576
+ }
577
+ emit(e, o) {
578
+ const a = new CustomEvent(e, {
579
+ bubbles: !0,
580
+ cancelable: !1,
581
+ composed: !0,
582
+ detail: {},
583
+ ...o
584
+ });
585
+ return this.dispatchEvent(a), a;
586
+ }
587
+ }
588
+ St([
589
+ c({ type: String })
590
+ ], C.prototype, "lang", 2);
591
+ const je = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" d="M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8L2.146 2.854Z"/></svg>';
592
+ var Ot = Object.defineProperty, Ht = Object.getOwnPropertyDescriptor, We = (t, e, o, a) => {
593
+ for (var r = a > 1 ? void 0 : a ? Ht(e, o) : e, s = t.length - 1, n; s >= 0; s--)
594
+ (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
595
+ return a && r && Ot(e, o, r), r;
596
+ };
597
+ const At = `<svg width="32" height="24" viewBox="0 0 32 24" fill="none" xmlns="http://www.w3.org/2000/svg">
598
+ <g>
599
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M24.3481 14.0672C22.533 17.2743 20.3563 19.0776 15.6489 19.598C10.4618 20.1771 6.17492 16.8088 4.48156 14.2944C6.64105 15.0536 8.94167 15.3339 11.2218 15.1154C15.4497 14.7306 17.8624 13.0702 19.5927 10.3506C19.8546 9.94378 20.5629 8.66828 19.3234 8.23945C18.1871 7.84727 17.143 7.83627 16.3314 9.02014C15.0143 10.9517 13.4722 11.6921 10.2442 12.044C5.9425 12.5021 0.777569 9.67256 0.179913 10.2627C-0.889966 11.3182 2.58161 22.9224 15.3759 22.7795C19.9837 22.7281 23.2192 21.1668 26.2481 17.2816C26.9859 16.3396 26.7572 15.1961 25.9492 14.1222C25.4512 13.4587 24.7429 13.4111 24.3629 14.0818" fill="#FFFFFF"/>
600
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M27.7123 7.10689C29.4278 2.66462 27.7713 -0.131961 27.1368 -1.24653e-05C26.6203 0.11361 25.6611 3.03481 24.296 4.73548C19.7066 2.64629 16.8253 4.54489 16.8917 5.55283C16.9471 6.39217 20.7249 5.7874 24.2702 8.85154C28.0369 12.0953 28.1476 15.6102 29.2249 15.5956C30.0881 15.5956 31.9217 12.1759 27.7123 7.10689Z" fill="#FFFFFF"/>
601
+ </g>
602
+ </svg>`;
603
+ let te = class extends C {
604
+ constructor() {
605
+ super(...arguments), this.title = "ChatBot";
606
+ }
607
+ render() {
608
+ return l` <header class="cb-header" part="header">
609
+ <span class="left">
610
+ <sl-button
611
+ @click=${this._clickHandler}
612
+ class="cb-setting-button"
613
+ variant="text"
614
+ circle
615
+ >
616
+ <cb-icon color="white" svg="${At}"></cb-icon>
617
+ </sl-button>
618
+ </span>
619
+ <span class="center title">${this.title}</span>
620
+ <span class="right">
621
+ <sl-button
622
+ @click=${this._clickCloseHandler}
623
+ class="cb-setting-button"
624
+ variant="text"
625
+ circle
626
+ >
627
+ <cb-icon color="white" svg="${je}"></cb-icon>
628
+ </sl-button>
629
+ </span>
630
+ </header>`;
631
+ }
632
+ _clickHandler() {
633
+ this.emit("setting:show");
634
+ }
635
+ _clickCloseHandler() {
636
+ this.emit("chatbot:toggle", {
637
+ detail: {
638
+ open: !1
639
+ }
640
+ });
641
+ }
642
+ };
643
+ te.styles = jt;
644
+ We([
645
+ c({ type: String, attribute: "title" })
646
+ ], te.prototype, "title", 2);
647
+ te = We([
648
+ x("cb-header")
649
+ ], te);
650
+ const Pt = w`
651
+ ${S}
652
+ .cb-footer {
653
+ line-height: 60px;
654
+ font-size: 16px;
655
+ }
656
+
657
+ .p-2 {
658
+ padding: 0.5rem;
659
+ }
660
+
661
+ .link__item {
662
+ color: var(--primary-color);
663
+ }
664
+ `;
665
+ var zt = Object.defineProperty, Et = Object.getOwnPropertyDescriptor, Tt = (t, e, o, a) => {
666
+ for (var r = a > 1 ? void 0 : a ? Et(e, o) : e, s = t.length - 1, n; s >= 0; s--)
667
+ (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
668
+ return a && r && zt(e, o, r), r;
669
+ };
670
+ let ye = class extends C {
671
+ constructor() {
672
+ super(...arguments), this.year = (/* @__PURE__ */ new Date()).getFullYear();
673
+ }
674
+ render() {
675
+ return l`
676
+ <div class="cb-footer" part="footer">
677
+ yugasun@${this.year}
678
+ <a
679
+ class="link__item underline"
680
+ href="https://github.com/yugasun/chatbot"
681
+ target="_blank"
682
+ >
683
+ Github
684
+ </a>
685
+ <span class="p-2"> | </span>
686
+ <a
687
+ class="link__item underline"
688
+ href="https://lit.dev/"
689
+ target="_blank"
690
+ >
691
+ Lit
692
+ </a>
693
+ <span class="p-2"> | </span>
694
+ <a
695
+ class="link__item underline"
696
+ href="https://vitejs.dev"
697
+ target="_blank"
698
+ >
699
+ Vite
700
+ </a>
701
+ </div>
702
+ `;
703
+ }
704
+ };
705
+ ye.styles = Pt;
706
+ ye = Tt([
707
+ x("cb-footer")
708
+ ], ye);
709
+ const It = w`
710
+ ${S}
711
+
712
+ :host {
713
+ width: 100%;
714
+ height: 100%;
715
+ box-sizing: border-box;
716
+ overflow-y: auto;
717
+ background-size: 100%;
718
+ padding: 20px 10px;
719
+ }
720
+
721
+ /*
722
+ :host::-webkit-scrollbar {
723
+ width: 10px;
724
+ }
725
+ :host::-webkit-scrollbar-track {
726
+ border-radius: 8px;
727
+ background-color: #e7e7e7;
728
+ border: 1px solid #cacaca;
729
+ }
730
+ :host::-webkit-scrollbar-thumb {
731
+ border-radius: 8px;
732
+ background-color: #d55959;
733
+ }
734
+ */
735
+
736
+ /* total width */
737
+ :host::-webkit-scrollbar {
738
+ background-color: #fff;
739
+ width: 16px;
740
+ }
741
+
742
+ /* background of the scrollbar except button or resizer */
743
+ :host::-webkit-scrollbar-track {
744
+ background-color: #fff;
745
+ }
746
+
747
+ /* scrollbar itself */
748
+ :host::-webkit-scrollbar-thumb {
749
+ background-color: #babac0;
750
+ border-radius: 16px;
751
+ border: 4px solid #fff;
752
+ }
753
+
754
+ /* set button(top and bottom of the scrollbar) */
755
+ :host::-webkit-scrollbar-button {
756
+ display: none;
757
+ }
758
+
759
+ .cb-actions-list {
760
+ margin: 10px 0px 0px 0px;
761
+ padding: 10px 0px;
762
+ //border-top: 1px solid rgba(0, 0, 0, 0.1);
763
+ display: flex;
764
+ justify-content: center;
765
+ }
766
+
767
+ .cb-action {
768
+ padding: 6px 6px;
769
+ margin: 1px 4px;
770
+ border-radius: 6px;
771
+ cursor: pointer;
772
+ color: rgba(255, 255, 255, 1);
773
+ background-color: #ff9119;
774
+ display: flex;
775
+ align-items: center;
776
+ font-size: 14px;
777
+ font-weight: 500;
778
+ }
779
+
780
+ .cb-action svg {
781
+ color: rgba(255, 255, 255, 0.7);
782
+ }
783
+ .cb-action:hover svg {
784
+ color: rgba(255, 255, 255, 1);
785
+ }
786
+
787
+ .cb-action:hover {
788
+ background-color: rgba(255, 145, 25, 0.8);
789
+ }
790
+
791
+ .cb-action-icon {
792
+ width: 18px;
793
+ height: 18px;
794
+ margin-right: 6px;
795
+ }
796
+
797
+ /* Ripple effect */
798
+ .ripple {
799
+ background-position: center;
800
+ transition: background 0.8s;
801
+ }
802
+ .ripple:hover {
803
+ background: #ff9119 radial-gradient(circle, transparent 1%, #ff9119 1%) center/15000%;
804
+ }
805
+ .ripple:active {
806
+ background-color: #fdba74;
807
+ background-size: 100%;
808
+ transition: background 0s;
809
+ }
810
+ `;
811
+ var Rt = Object.defineProperty, Bt = Object.getOwnPropertyDescriptor, Vt = (t, e, o, a) => {
812
+ for (var r = a > 1 ? void 0 : a ? Bt(e, o) : e, s = t.length - 1, n; s >= 0; s--)
813
+ (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
814
+ return a && r && Rt(e, o, r), r;
815
+ };
816
+ let ve = class extends le {
817
+ render() {
818
+ return l` <div class="cb-thinking" style="color: rgb(34, 34, 34);"><span></span><span></span><span></span></div>`;
819
+ }
820
+ };
821
+ ve.styles = w`
822
+ .cb-thinking {
823
+ text-align: center;
824
+ }
825
+
826
+ .cb-thinking span {
827
+ display: inline-block;
828
+ background-color: #b6b5ba;
829
+ width: 10px;
830
+ height: 10px;
831
+ border-radius: 100%;
832
+ margin-right: 3px;
833
+ animation: jump 2s infinite;
834
+ }
835
+
836
+ .cb-thinking span:first-child {
837
+ animation-delay: -1s;
838
+ }
839
+
840
+ .cb-thinking span:nth-child(2) {
841
+ animation-delay: -0.85s;
842
+ }
843
+
844
+ .cb-thinking span:nth-child(3) {
845
+ animation-delay: -0.7s;
846
+ }
847
+
848
+ @keyframes jump {
849
+ 10% {
850
+ transform: translateY(-10px);
851
+ opacity: 0.9;
852
+ }
853
+ 50% {
854
+ transform: translateY(0);
855
+ opacity: 1;
856
+ }
857
+ }
858
+ `;
859
+ ve = Vt([
860
+ x("cb-thinking")
861
+ ], ve);
862
+ var qt = Object.defineProperty, Dt = Object.getOwnPropertyDescriptor, Ke = (t, e, o, a) => {
863
+ for (var r = a > 1 ? void 0 : a ? Dt(e, o) : e, s = t.length - 1, n; s >= 0; s--)
864
+ (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
865
+ return a && r && qt(e, o, r), r;
866
+ };
867
+ let oe = class extends C {
868
+ constructor() {
869
+ super(...arguments), this.files = [];
870
+ }
871
+ render() {
872
+ return l` <div class="cb-uploading">
873
+ <div class="cb-uploading__title">
874
+ <sl-spinner class="cb-spinner"></sl-spinner>
875
+ <span>Uploading...</span>
876
+ </div>
877
+ <div class="cb-uploading__filelist">
878
+ ${this.files.map((t) => l`${t.name}<br />`)}
879
+ </div>
880
+ </div>`;
881
+ }
882
+ };
883
+ oe.styles = w`
884
+ .cb-uploading {
885
+ text-align: left;
886
+ }
887
+
888
+ .cb-uploading__title {
889
+ font-size: 1rem;
890
+ display: flex;
891
+ align-items: center;
892
+ }
893
+
894
+ .cb-spinner {
895
+ font-size: 1rem;
896
+ --indicator-color: var(--primary-color);
897
+ --track-color: white;
898
+ margin-right: 5px;
899
+ }
900
+ `;
901
+ Ke([
902
+ c({ type: Array })
903
+ ], oe.prototype, "files", 2);
904
+ oe = Ke([
905
+ x("cb-uploading")
906
+ ], oe);
907
+ const Ft = w`
908
+ ${S}
909
+ :host {
910
+ }
911
+
912
+ .cb-file {
913
+ width: 100%;
914
+ border-radius: 0.2rem;
915
+ display: flex;
916
+ flex-direction: row;
917
+ justify-content: flex-start;
918
+ align-items: center;
919
+ gap: 1;
920
+ color: white;
921
+ }
922
+
923
+ .cb-file-icon {
924
+ font-size: 2em;
925
+ margin-right: 0.2em;
926
+ }
927
+ `;
928
+ var Zt = Object.defineProperty, Ut = Object.getOwnPropertyDescriptor, Me = (t, e, o, a) => {
929
+ for (var r = a > 1 ? void 0 : a ? Ut(e, o) : e, s = t.length - 1, n; s >= 0; s--)
930
+ (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
931
+ return a && r && Zt(e, o, r), r;
932
+ };
933
+ let N = class extends le {
934
+ constructor() {
935
+ super(...arguments), this.url = "", this.inverse = !1;
936
+ }
937
+ render() {
938
+ return l`
939
+ <a
940
+ class="
941
+ cb-external-link link__item
942
+ ${this.inverse ? "inverse" : ""}}
943
+ "
944
+ href="${this.url}"
945
+ target="_blank"
946
+ reference="noopener noreferrer"
947
+ >
948
+ <slot></slot>
949
+ </a>
950
+ `;
951
+ }
952
+ };
953
+ N.styles = w`
954
+ :host {
955
+ --primary-color: var(--sl-color-primary-600);
956
+ }
957
+
958
+ .cb-external-link {
959
+ display: inline-block;
960
+ }
961
+
962
+ .link__item,
963
+ .link__item:visited,
964
+ .link__item:active {
965
+ color: var(--primary-color);
966
+ }
967
+
968
+ .link__item.inverse,
969
+ .link__item.inverse:visited,
970
+ .link__item.inverse:active {
971
+ color: white;
972
+ }
973
+
974
+ .cb-external-link:hover {
975
+ text-decoration: underline;
976
+ }
977
+ `;
978
+ Me([
979
+ c({ type: String })
980
+ ], N.prototype, "url", 2);
981
+ Me([
982
+ c({ type: Boolean })
983
+ ], N.prototype, "inverse", 2);
984
+ N = Me([
985
+ x("cb-external-link")
986
+ ], N);
987
+ const Nt = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2h-2v-1h2a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5ZM1.928 15.849v-3.337h1.136v-.662H0v.662h1.134v3.337h.794Zm4.689-3.999h-.894L4.9 13.289h-.035l-.832-1.439h-.932l1.228 1.983l-1.24 2.016h.862l.853-1.415h.035l.85 1.415h.907l-1.253-1.992l1.274-2.007Zm1.93.662v3.337h-.794v-3.337H6.619v-.662h3.064v.662H8.546Z"/></svg>', Wt = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2h-1v-1h1a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5ZM1.6 11.85H0v3.999h.791v-1.342h.803c.287 0 .531-.057.732-.173c.203-.117.358-.275.463-.474a1.42 1.42 0 0 0 .161-.677c0-.25-.053-.476-.158-.677a1.176 1.176 0 0 0-.46-.477c-.2-.12-.443-.179-.732-.179Zm.545 1.333a.795.795 0 0 1-.085.38a.574.574 0 0 1-.238.241a.794.794 0 0 1-.375.082H.788V12.48h.66c.218 0 .389.06.512.181c.123.122.185.296.185.522Zm1.217-1.333v3.999h1.46c.401 0 .734-.08.998-.237a1.45 1.45 0 0 0 .595-.689c.13-.3.196-.662.196-1.084c0-.42-.065-.778-.196-1.075a1.426 1.426 0 0 0-.589-.68c-.264-.156-.599-.234-1.005-.234H3.362Zm.791.645h.563c.248 0 .45.05.609.152a.89.89 0 0 1 .354.454c.079.201.118.452.118.753a2.3 2.3 0 0 1-.068.592a1.14 1.14 0 0 1-.196.422a.8.8 0 0 1-.334.252a1.298 1.298 0 0 1-.483.082h-.563v-2.707Zm3.743 1.763v1.591h-.79V11.85h2.548v.653H7.896v1.117h1.606v.638H7.896Z"/></svg>', Kt = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2H9v-1h3a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5ZM.706 13.189v2.66H0V11.85h.806l1.14 2.596h.026l1.14-2.596h.8v3.999h-.716v-2.66h-.038l-.946 2.159h-.516l-.952-2.16H.706Zm3.919 2.66V11.85h1.459c.406 0 .741.078 1.005.234c.263.157.46.383.589.68c.13.297.196.655.196 1.075c0 .422-.066.784-.196 1.084c-.131.301-.33.53-.595.689c-.264.158-.597.237-1 .237H4.626Zm1.353-3.354h-.562v2.707h.562c.186 0 .347-.028.484-.082a.8.8 0 0 0 .334-.252a1.14 1.14 0 0 0 .196-.422c.045-.168.067-.365.067-.592a2.1 2.1 0 0 0-.117-.753a.89.89 0 0 0-.354-.454c-.159-.102-.362-.152-.61-.152Z"/></svg>', Jt = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2h-1v-1h1a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5ZM3.517 14.841a1.13 1.13 0 0 0 .401.823c.13.108.289.192.478.252c.19.061.411.091.665.091c.338 0 .624-.053.859-.158c.236-.105.416-.252.539-.44c.125-.189.187-.408.187-.656c0-.224-.045-.41-.134-.56a1.001 1.001 0 0 0-.375-.357a2.027 2.027 0 0 0-.566-.21l-.621-.144a.97.97 0 0 1-.404-.176a.37.37 0 0 1-.144-.299c0-.156.062-.284.185-.384c.125-.101.296-.152.512-.152c.143 0 .266.023.37.068a.624.624 0 0 1 .246.181a.56.56 0 0 1 .12.258h.75a1.092 1.092 0 0 0-.2-.566a1.21 1.21 0 0 0-.5-.41a1.813 1.813 0 0 0-.78-.152c-.293 0-.551.05-.776.15c-.225.099-.4.24-.527.421c-.127.182-.19.395-.19.639c0 .201.04.376.122.524c.082.149.2.27.352.367c.152.095.332.167.539.213l.618.144c.207.049.361.113.463.193a.387.387 0 0 1 .152.326a.505.505 0 0 1-.085.29a.559.559 0 0 1-.255.193c-.111.047-.249.07-.413.07c-.117 0-.223-.013-.32-.04a.838.838 0 0 1-.248-.115a.578.578 0 0 1-.255-.384h-.765ZM.806 13.693c0-.248.034-.46.102-.633a.868.868 0 0 1 .302-.399a.814.814 0 0 1 .475-.137c.15 0 .283.032.398.097a.7.7 0 0 1 .272.26a.85.85 0 0 1 .12.381h.765v-.072a1.33 1.33 0 0 0-.466-.964a1.441 1.441 0 0 0-.489-.272a1.838 1.838 0 0 0-.606-.097c-.356 0-.66.074-.911.223c-.25.148-.44.359-.572.632c-.13.274-.196.6-.196.979v.498c0 .379.064.704.193.976c.131.271.322.48.572.626c.25.145.554.217.914.217c.293 0 .554-.055.785-.164c.23-.11.414-.26.55-.454a1.27 1.27 0 0 0 .226-.674v-.076h-.764a.799.799 0 0 1-.118.363a.7.7 0 0 1-.272.25a.874.874 0 0 1-.401.087a.845.845 0 0 1-.478-.132a.833.833 0 0 1-.299-.392a1.699 1.699 0 0 1-.102-.627v-.495Zm8.239 2.238h-.953l-1.338-3.999h.917l.896 3.138h.038l.888-3.138h.879l-1.327 4Z"/></svg>', Yt = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2h-1v-1h1a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5ZM1.6 11.85H0v3.999h.791v-1.342h.803c.287 0 .531-.057.732-.173c.203-.117.358-.275.463-.474a1.42 1.42 0 0 0 .161-.677c0-.25-.053-.476-.158-.677a1.176 1.176 0 0 0-.46-.477c-.2-.12-.443-.179-.732-.179Zm.545 1.333a.795.795 0 0 1-.085.38a.574.574 0 0 1-.238.241a.794.794 0 0 1-.375.082H.788V12.48h.66c.218 0 .389.06.512.181c.123.122.185.296.185.522Zm2.817-1.333h-1.6v3.999h.791v-1.342h.803c.287 0 .531-.057.732-.173c.203-.117.358-.275.463-.474c.108-.201.161-.427.161-.677c0-.25-.052-.476-.158-.677a1.176 1.176 0 0 0-.46-.477c-.2-.12-.443-.179-.732-.179Zm.545 1.333a.795.795 0 0 1-.085.38a.574.574 0 0 1-.238.241a.793.793 0 0 1-.375.082H4.15V12.48h.66c.218 0 .389.06.512.181c.123.122.185.296.185.522Zm2.767-.67v3.336H7.48v-3.337H6.346v-.662h3.065v.662H8.274Z"/></svg>', Gt = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V14a2 2 0 0 1-2 2v-1a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5Zm-7.839 9.166v.522c0 .256-.039.47-.117.641a.861.861 0 0 1-.322.387a.877.877 0 0 1-.469.126a.883.883 0 0 1-.471-.126a.868.868 0 0 1-.32-.386a1.55 1.55 0 0 1-.117-.642v-.522c0-.257.04-.471.117-.641a.868.868 0 0 1 .32-.387a.868.868 0 0 1 .471-.129c.176 0 .332.043.469.13a.861.861 0 0 1 .322.386c.078.17.117.384.117.641Zm.803.519v-.513c0-.377-.068-.7-.205-.972a1.46 1.46 0 0 0-.589-.63c-.254-.147-.56-.22-.917-.22c-.355 0-.662.073-.92.22a1.441 1.441 0 0 0-.589.627c-.136.271-.205.596-.205.975v.513c0 .375.069.7.205.973c.137.271.333.48.59.627c.257.144.564.216.92.216c.357 0 .662-.072.916-.216c.256-.147.452-.356.59-.627c.136-.274.204-.598.204-.973ZM0 11.926v4h1.459c.402 0 .735-.08.999-.238a1.45 1.45 0 0 0 .595-.689c.13-.3.196-.662.196-1.084c0-.42-.065-.778-.196-1.075a1.426 1.426 0 0 0-.59-.68c-.263-.156-.598-.234-1.004-.234H0Zm.791.645h.563c.248 0 .45.05.609.152a.89.89 0 0 1 .354.454c.079.201.118.452.118.753a2.3 2.3 0 0 1-.068.592a1.141 1.141 0 0 1-.196.422a.8.8 0 0 1-.334.252a1.298 1.298 0 0 1-.483.082H.79V12.57Zm7.422.483a1.732 1.732 0 0 0-.103.633v.495c0 .246.034.455.103.627a.834.834 0 0 0 .298.393a.845.845 0 0 0 .478.131a.868.868 0 0 0 .401-.088a.699.699 0 0 0 .273-.248a.8.8 0 0 0 .117-.364h.765v.076a1.268 1.268 0 0 1-.226.674c-.137.194-.32.345-.55.454a1.81 1.81 0 0 1-.786.164c-.36 0-.664-.072-.914-.216a1.424 1.424 0 0 1-.571-.627c-.13-.272-.194-.597-.194-.976v-.498c0-.379.066-.705.197-.978c.13-.274.321-.485.571-.633c.252-.149.556-.223.911-.223c.219 0 .421.032.607.097c.187.062.35.153.489.272a1.326 1.326 0 0 1 .466.964v.073H9.78a.85.85 0 0 0-.12-.38a.7.7 0 0 0-.273-.261a.802.802 0 0 0-.398-.097a.814.814 0 0 0-.475.138a.868.868 0 0 0-.301.398Z"/></svg>', Qt = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" fill-rule="evenodd" d="M14 4.5V11h-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5L14 4.5Zm-6.839 9.688v-.522a1.54 1.54 0 0 0-.117-.641a.861.861 0 0 0-.322-.387a.862.862 0 0 0-.469-.129a.868.868 0 0 0-.471.13a.868.868 0 0 0-.32.386a1.54 1.54 0 0 0-.117.641v.522c0 .256.04.47.117.641a.868.868 0 0 0 .32.387a.883.883 0 0 0 .471.126a.877.877 0 0 0 .469-.126a.861.861 0 0 0 .322-.386a1.55 1.55 0 0 0 .117-.642Zm.803-.516v.513c0 .375-.068.7-.205.973a1.47 1.47 0 0 1-.589.627c-.254.144-.56.216-.917.216a1.86 1.86 0 0 1-.92-.216a1.463 1.463 0 0 1-.589-.627a2.151 2.151 0 0 1-.205-.973v-.513c0-.379.069-.704.205-.975c.137-.274.333-.483.59-.627c.257-.147.564-.22.92-.22c.357 0 .662.073.916.22c.256.146.452.356.59.63c.136.271.204.595.204.972ZM1 15.925v-3.999h1.459c.406 0 .741.078 1.005.235c.264.156.46.382.589.68c.13.296.196.655.196 1.074c0 .422-.065.784-.196 1.084c-.131.301-.33.53-.595.689c-.264.158-.597.237-.999.237H1Zm1.354-3.354H1.79v2.707h.563c.185 0 .346-.028.483-.082a.8.8 0 0 0 .334-.252c.088-.114.153-.254.196-.422a2.3 2.3 0 0 0 .068-.592c0-.3-.04-.552-.118-.753a.89.89 0 0 0-.354-.454c-.158-.102-.361-.152-.61-.152Zm6.756 1.116c0-.248.034-.46.103-.633a.868.868 0 0 1 .301-.398a.814.814 0 0 1 .475-.138c.15 0 .283.032.398.097a.7.7 0 0 1 .273.26a.85.85 0 0 1 .12.381h.765v-.073a1.33 1.33 0 0 0-.466-.964a1.44 1.44 0 0 0-.49-.272a1.836 1.836 0 0 0-.606-.097c-.355 0-.66.074-.911.223c-.25.148-.44.359-.571.633c-.131.273-.197.6-.197.978v.498c0 .379.065.704.194.976c.13.271.321.48.571.627c.25.144.555.216.914.216c.293 0 .555-.054.785-.164c.23-.11.414-.26.551-.454a1.27 1.27 0 0 0 .226-.674v-.076h-.765a.8.8 0 0 1-.117.364a.699.699 0 0 1-.273.248a.874.874 0 0 1-.401.088a.845.845 0 0 1-.478-.131a.834.834 0 0 1-.298-.393a1.7 1.7 0 0 1-.103-.627v-.495Zm5.092-1.76h.894l-1.275 2.006l1.254 1.992h-.908l-.85-1.415h-.035l-.852 1.415h-.862l1.24-2.015l-1.228-1.984h.932l.832 1.439h.035l.823-1.439Z"/></svg>';
988
+ var Xt = Object.defineProperty, eo = Object.getOwnPropertyDescriptor, Le = (t, e, o, a) => {
989
+ for (var r = a > 1 ? void 0 : a ? eo(e, o) : e, s = t.length - 1, n; s >= 0; s--)
990
+ (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
991
+ return a && r && Xt(e, o, r), r;
992
+ };
993
+ const Pe = {
994
+ pdf: Wt,
995
+ txt: Nt,
996
+ md: Kt,
997
+ csv: Jt,
998
+ ppd: Yt,
999
+ doc: Gt,
1000
+ docx: Qt
1001
+ };
1002
+ let W = class extends C {
1003
+ constructor() {
1004
+ super(...arguments), this.filename = "", this.url = "";
1005
+ }
1006
+ get type() {
1007
+ const t = "txt";
1008
+ if (!this.filename)
1009
+ return t;
1010
+ const e = this.filename.split(".").pop();
1011
+ return e ? e.toLowerCase() : t;
1012
+ }
1013
+ render() {
1014
+ return l`
1015
+ <cb-external-link url="${this.url}" inverse>
1016
+ <div class="cb-file">
1017
+ ${this.renderFileIcon()}
1018
+ <span class="cb-file-name">${this.filename}</span>
1019
+ </div>
1020
+ </cb-external-link>
1021
+ `;
1022
+ }
1023
+ renderFileIcon() {
1024
+ return l`
1025
+ <cb-icon
1026
+ class="cb-file-icon"
1027
+ svg="${Pe[this.type] || Pe.txt}"
1028
+ ></cb-icon>
1029
+ `;
1030
+ }
1031
+ };
1032
+ W.styles = Ft;
1033
+ Le([
1034
+ c({ type: String })
1035
+ ], W.prototype, "filename", 2);
1036
+ Le([
1037
+ c({ type: String })
1038
+ ], W.prototype, "url", 2);
1039
+ W = Le([
1040
+ x("cb-file")
1041
+ ], W);
1042
+ const to = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><g fill="currentColor"><path d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5Zm2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5Zm3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V6Z"/><path d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1v1ZM4.118 4L4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4H4.118ZM2.5 3h11V2h-11v1Z"/></g></svg>', oo = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" d="M8 8a3 3 0 1 0 0-6a3 3 0 0 0 0 6Zm2-3a2 2 0 1 1-4 0a2 2 0 0 1 4 0Zm4 8c0 1-1 1-1 1H3s-1 0-1-1s1-4 6-4s6 3 6 4Zm-1-.004c-.001-.246-.154-.986-.832-1.664C11.516 10.68 10.289 10 8 10c-2.29 0-3.516.68-4.168 1.332c-.678.678-.83 1.418-.832 1.664h10Z"/></svg>', ro = w`
1043
+ pre code.hljs {
1044
+ display: block;
1045
+ overflow-x: auto;
1046
+ padding: 1em;
1047
+ }
1048
+ code.hljs {
1049
+ padding: 3px 5px;
1050
+ }
1051
+ .hljs {
1052
+ color: #abb2bf;
1053
+ background: #282c34;
1054
+ }
1055
+ .hljs-keyword,
1056
+ .hljs-operator,
1057
+ .hljs-pattern-match {
1058
+ color: #f92672;
1059
+ }
1060
+ .hljs-function,
1061
+ .hljs-pattern-match .hljs-constructor {
1062
+ color: #61aeee;
1063
+ }
1064
+ .hljs-function .hljs-params {
1065
+ color: #a6e22e;
1066
+ }
1067
+ .hljs-function .hljs-params .hljs-typing {
1068
+ color: #fd971f;
1069
+ }
1070
+ .hljs-module-access .hljs-module {
1071
+ color: #7e57c2;
1072
+ }
1073
+ .hljs-constructor {
1074
+ color: #e2b93d;
1075
+ }
1076
+ .hljs-constructor .hljs-string {
1077
+ color: #9ccc65;
1078
+ }
1079
+ .hljs-comment,
1080
+ .hljs-quote {
1081
+ color: #b18eb1;
1082
+ font-style: italic;
1083
+ }
1084
+ .hljs-doctag,
1085
+ .hljs-formula {
1086
+ color: #c678dd;
1087
+ }
1088
+ .hljs-deletion,
1089
+ .hljs-name,
1090
+ .hljs-section,
1091
+ .hljs-selector-tag,
1092
+ .hljs-subst {
1093
+ color: #e06c75;
1094
+ }
1095
+ .hljs-literal {
1096
+ color: #56b6c2;
1097
+ }
1098
+ .hljs-addition,
1099
+ .hljs-attribute,
1100
+ .hljs-meta .hljs-string,
1101
+ .hljs-regexp,
1102
+ .hljs-string {
1103
+ color: #98c379;
1104
+ }
1105
+ .hljs-built_in,
1106
+ .hljs-class .hljs-title,
1107
+ .hljs-title.class_ {
1108
+ color: #e6c07b;
1109
+ }
1110
+ .hljs-attr,
1111
+ .hljs-number,
1112
+ .hljs-selector-attr,
1113
+ .hljs-selector-class,
1114
+ .hljs-selector-pseudo,
1115
+ .hljs-template-variable,
1116
+ .hljs-type,
1117
+ .hljs-variable {
1118
+ color: #d19a66;
1119
+ }
1120
+ .hljs-bullet,
1121
+ .hljs-link,
1122
+ .hljs-meta,
1123
+ .hljs-selector-id,
1124
+ .hljs-symbol,
1125
+ .hljs-title {
1126
+ color: #61aeee;
1127
+ }
1128
+ .hljs-emphasis {
1129
+ font-style: italic;
1130
+ }
1131
+ .hljs-strong {
1132
+ font-weight: 700;
1133
+ }
1134
+ .hljs-link {
1135
+ text-decoration: underline;
1136
+ }
1137
+ pre code.hljs {
1138
+ display: block;
1139
+ overflow-x: auto;
1140
+ padding: 1em;
1141
+ }
1142
+ code.hljs {
1143
+ padding: 3px 5px;
1144
+ }
1145
+ .hljs {
1146
+ color: #383a42;
1147
+ background: #fafafa;
1148
+ }
1149
+ .hljs-comment,
1150
+ .hljs-quote {
1151
+ color: #a0a1a7;
1152
+ font-style: italic;
1153
+ }
1154
+ .hljs-doctag,
1155
+ .hljs-formula,
1156
+ .hljs-keyword {
1157
+ color: #a626a4;
1158
+ }
1159
+ .hljs-deletion,
1160
+ .hljs-name,
1161
+ .hljs-section,
1162
+ .hljs-selector-tag,
1163
+ .hljs-subst {
1164
+ color: #e45649;
1165
+ }
1166
+ .hljs-literal {
1167
+ color: #0184bb;
1168
+ }
1169
+ .hljs-addition,
1170
+ .hljs-attribute,
1171
+ .hljs-meta .hljs-string,
1172
+ .hljs-regexp,
1173
+ .hljs-string {
1174
+ color: #50a14f;
1175
+ }
1176
+ .hljs-attr,
1177
+ .hljs-number,
1178
+ .hljs-selector-attr,
1179
+ .hljs-selector-class,
1180
+ .hljs-selector-pseudo,
1181
+ .hljs-template-variable,
1182
+ .hljs-type,
1183
+ .hljs-variable {
1184
+ color: #986801;
1185
+ }
1186
+ .hljs-bullet,
1187
+ .hljs-link,
1188
+ .hljs-meta,
1189
+ .hljs-selector-id,
1190
+ .hljs-symbol,
1191
+ .hljs-title {
1192
+ color: #4078f2;
1193
+ }
1194
+ .hljs-built_in,
1195
+ .hljs-class .hljs-title,
1196
+ .hljs-title.class_ {
1197
+ color: #c18401;
1198
+ }
1199
+ .hljs-emphasis {
1200
+ font-style: italic;
1201
+ }
1202
+ .hljs-strong {
1203
+ font-weight: 700;
1204
+ }
1205
+ .hljs-link {
1206
+ text-decoration: underline;
1207
+ }
1208
+ .markdown-body {
1209
+ color-scheme: dark;
1210
+ --color-prettylights-syntax-comment: #8b949e;
1211
+ --color-prettylights-syntax-constant: #79c0ff;
1212
+ --color-prettylights-syntax-entity: #d2a8ff;
1213
+ --color-prettylights-syntax-storage-modifier-import: #c9d1d9;
1214
+ --color-prettylights-syntax-entity-tag: #7ee787;
1215
+ --color-prettylights-syntax-keyword: #ff7b72;
1216
+ --color-prettylights-syntax-string: #a5d6ff;
1217
+ --color-prettylights-syntax-variable: #ffa657;
1218
+ --color-prettylights-syntax-brackethighlighter-unmatched: #f85149;
1219
+ --color-prettylights-syntax-invalid-illegal-text: #f0f6fc;
1220
+ --color-prettylights-syntax-invalid-illegal-bg: #8e1519;
1221
+ --color-prettylights-syntax-carriage-return-text: #f0f6fc;
1222
+ --color-prettylights-syntax-carriage-return-bg: #b62324;
1223
+ --color-prettylights-syntax-string-regexp: #7ee787;
1224
+ --color-prettylights-syntax-markup-list: #f2cc60;
1225
+ --color-prettylights-syntax-markup-heading: #1f6feb;
1226
+ --color-prettylights-syntax-markup-italic: #c9d1d9;
1227
+ --color-prettylights-syntax-markup-bold: #c9d1d9;
1228
+ --color-prettylights-syntax-markup-deleted-text: #ffdcd7;
1229
+ --color-prettylights-syntax-markup-deleted-bg: #67060c;
1230
+ --color-prettylights-syntax-markup-inserted-text: #aff5b4;
1231
+ --color-prettylights-syntax-markup-inserted-bg: #033a16;
1232
+ --color-prettylights-syntax-markup-changed-text: #ffdfb6;
1233
+ --color-prettylights-syntax-markup-changed-bg: #5a1e02;
1234
+ --color-prettylights-syntax-markup-ignored-text: #c9d1d9;
1235
+ --color-prettylights-syntax-markup-ignored-bg: #1158c7;
1236
+ --color-prettylights-syntax-meta-diff-range: #d2a8ff;
1237
+ --color-prettylights-syntax-brackethighlighter-angle: #8b949e;
1238
+ --color-prettylights-syntax-sublimelinter-gutter-mark: #484f58;
1239
+ --color-prettylights-syntax-constant-other-reference-link: #a5d6ff;
1240
+ --color-fg-default: #c9d1d9;
1241
+ --color-fg-muted: #8b949e;
1242
+ --color-fg-subtle: #6e7681;
1243
+ --color-canvas-default: #0d1117;
1244
+ --color-canvas-subtle: #161b22;
1245
+ --color-border-default: #30363d;
1246
+ --color-border-muted: #21262d;
1247
+ --color-neutral-muted: rgba(110, 118, 129, 0.4);
1248
+ --color-accent-fg: #58a6ff;
1249
+ --color-accent-emphasis: #1f6feb;
1250
+ --color-attention-subtle: rgba(187, 128, 9, 0.15);
1251
+ --color-danger-fg: #f85149;
1252
+ }
1253
+ .markdown-body {
1254
+ color-scheme: light;
1255
+ --color-prettylights-syntax-comment: #6e7781;
1256
+ --color-prettylights-syntax-constant: #0550ae;
1257
+ --color-prettylights-syntax-entity: #8250df;
1258
+ --color-prettylights-syntax-storage-modifier-import: #24292f;
1259
+ --color-prettylights-syntax-entity-tag: #116329;
1260
+ --color-prettylights-syntax-keyword: #cf222e;
1261
+ --color-prettylights-syntax-string: #0a3069;
1262
+ --color-prettylights-syntax-variable: #953800;
1263
+ --color-prettylights-syntax-brackethighlighter-unmatched: #82071e;
1264
+ --color-prettylights-syntax-invalid-illegal-text: #f6f8fa;
1265
+ --color-prettylights-syntax-invalid-illegal-bg: #82071e;
1266
+ --color-prettylights-syntax-carriage-return-text: #f6f8fa;
1267
+ --color-prettylights-syntax-carriage-return-bg: #cf222e;
1268
+ --color-prettylights-syntax-string-regexp: #116329;
1269
+ --color-prettylights-syntax-markup-list: #3b2300;
1270
+ --color-prettylights-syntax-markup-heading: #0550ae;
1271
+ --color-prettylights-syntax-markup-italic: #24292f;
1272
+ --color-prettylights-syntax-markup-bold: #24292f;
1273
+ --color-prettylights-syntax-markup-deleted-text: #82071e;
1274
+ --color-prettylights-syntax-markup-deleted-bg: #ffebe9;
1275
+ --color-prettylights-syntax-markup-inserted-text: #116329;
1276
+ --color-prettylights-syntax-markup-inserted-bg: #dafbe1;
1277
+ --color-prettylights-syntax-markup-changed-text: #953800;
1278
+ --color-prettylights-syntax-markup-changed-bg: #ffd8b5;
1279
+ --color-prettylights-syntax-markup-ignored-text: #eaeef2;
1280
+ --color-prettylights-syntax-markup-ignored-bg: #0550ae;
1281
+ --color-prettylights-syntax-meta-diff-range: #8250df;
1282
+ --color-prettylights-syntax-brackethighlighter-angle: #57606a;
1283
+ --color-prettylights-syntax-sublimelinter-gutter-mark: #8c959f;
1284
+ --color-prettylights-syntax-constant-other-reference-link: #0a3069;
1285
+ --color-fg-default: #24292f;
1286
+ --color-fg-muted: #57606a;
1287
+ --color-fg-subtle: #6e7781;
1288
+ --color-canvas-default: #ffffff;
1289
+ --color-canvas-subtle: #f6f8fa;
1290
+ --color-border-default: #d0d7de;
1291
+ --color-border-muted: hsl(210, 18%, 87%);
1292
+ --color-neutral-muted: rgba(175, 184, 193, 0.2);
1293
+ --color-accent-fg: #0969da;
1294
+ --color-accent-emphasis: #0969da;
1295
+ --color-attention-subtle: #fff8c5;
1296
+ --color-danger-fg: #cf222e;
1297
+ }
1298
+ .markdown-body {
1299
+ -ms-text-size-adjust: 100%;
1300
+ -webkit-text-size-adjust: 100%;
1301
+ margin: 0;
1302
+ color: var(--color-fg-default);
1303
+ background-color: var(--color-canvas-default);
1304
+ font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Noto Sans,
1305
+ Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji';
1306
+ font-size: 16px;
1307
+ line-height: 1.5;
1308
+ word-wrap: break-word;
1309
+ }
1310
+ .markdown-body .octicon {
1311
+ display: inline-block;
1312
+ fill: currentColor;
1313
+ vertical-align: text-bottom;
1314
+ }
1315
+ .markdown-body h1:hover .anchor .octicon-link:before,
1316
+ .markdown-body h2:hover .anchor .octicon-link:before,
1317
+ .markdown-body h3:hover .anchor .octicon-link:before,
1318
+ .markdown-body h4:hover .anchor .octicon-link:before,
1319
+ .markdown-body h5:hover .anchor .octicon-link:before,
1320
+ .markdown-body h6:hover .anchor .octicon-link:before {
1321
+ width: 16px;
1322
+ height: 16px;
1323
+ content: ' ';
1324
+ display: inline-block;
1325
+ background-color: currentColor;
1326
+ -webkit-mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' version='1.1' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg>");
1327
+ mask-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' version='1.1' aria-hidden='true'><path fill-rule='evenodd' d='M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z'></path></svg>");
1328
+ }
1329
+ .markdown-body details,
1330
+ .markdown-body figcaption,
1331
+ .markdown-body figure {
1332
+ display: block;
1333
+ }
1334
+ .markdown-body summary {
1335
+ display: list-item;
1336
+ }
1337
+ .markdown-body [hidden] {
1338
+ display: none !important;
1339
+ }
1340
+ .markdown-body a {
1341
+ background-color: transparent;
1342
+ color: var(--color-accent-fg);
1343
+ text-decoration: none;
1344
+ }
1345
+ .markdown-body abbr[title] {
1346
+ border-bottom: none;
1347
+ -webkit-text-decoration: underline dotted;
1348
+ text-decoration: underline dotted;
1349
+ }
1350
+ .markdown-body b,
1351
+ .markdown-body strong {
1352
+ font-weight: var(--base-text-weight-semibold, 600);
1353
+ }
1354
+ .markdown-body dfn {
1355
+ font-style: italic;
1356
+ }
1357
+ .markdown-body h1 {
1358
+ margin: 0.67em 0;
1359
+ font-weight: var(--base-text-weight-semibold, 600);
1360
+ padding-bottom: 0.3em;
1361
+ font-size: 2em;
1362
+ border-bottom: 1px solid var(--color-border-muted);
1363
+ }
1364
+ .markdown-body mark {
1365
+ background-color: var(--color-attention-subtle);
1366
+ color: var(--color-fg-default);
1367
+ }
1368
+ .markdown-body small {
1369
+ font-size: 90%;
1370
+ }
1371
+ .markdown-body sub,
1372
+ .markdown-body sup {
1373
+ font-size: 75%;
1374
+ line-height: 0;
1375
+ position: relative;
1376
+ vertical-align: baseline;
1377
+ }
1378
+ .markdown-body sub {
1379
+ bottom: -0.25em;
1380
+ }
1381
+ .markdown-body sup {
1382
+ top: -0.5em;
1383
+ }
1384
+ .markdown-body img {
1385
+ border-style: none;
1386
+ max-width: 100%;
1387
+ box-sizing: content-box;
1388
+ background-color: var(--color-canvas-default);
1389
+ }
1390
+ .markdown-body code,
1391
+ .markdown-body kbd,
1392
+ .markdown-body pre,
1393
+ .markdown-body samp {
1394
+ font-family: monospace;
1395
+ font-size: 1em;
1396
+ }
1397
+ .markdown-body figure {
1398
+ margin: 1em 40px;
1399
+ }
1400
+ .markdown-body hr {
1401
+ box-sizing: content-box;
1402
+ overflow: hidden;
1403
+ background: transparent;
1404
+ border-bottom: 1px solid var(--color-border-muted);
1405
+ height: 0.25em;
1406
+ padding: 0;
1407
+ margin: 24px 0;
1408
+ background-color: var(--color-border-default);
1409
+ border: 0;
1410
+ }
1411
+ .markdown-body input {
1412
+ font: inherit;
1413
+ margin: 0;
1414
+ overflow: visible;
1415
+ font-family: inherit;
1416
+ font-size: inherit;
1417
+ line-height: inherit;
1418
+ }
1419
+ .markdown-body [type='button'],
1420
+ .markdown-body [type='reset'],
1421
+ .markdown-body [type='submit'] {
1422
+ -webkit-appearance: button;
1423
+ }
1424
+ .markdown-body [type='checkbox'],
1425
+ .markdown-body [type='radio'] {
1426
+ box-sizing: border-box;
1427
+ padding: 0;
1428
+ }
1429
+ .markdown-body [type='number']::-webkit-inner-spin-button,
1430
+ .markdown-body [type='number']::-webkit-outer-spin-button {
1431
+ height: auto;
1432
+ }
1433
+ .markdown-body [type='search']::-webkit-search-cancel-button,
1434
+ .markdown-body [type='search']::-webkit-search-decoration {
1435
+ -webkit-appearance: none;
1436
+ }
1437
+ .markdown-body ::-webkit-input-placeholder {
1438
+ color: inherit;
1439
+ opacity: 0.54;
1440
+ }
1441
+ .markdown-body ::-webkit-file-upload-button {
1442
+ -webkit-appearance: button;
1443
+ font: inherit;
1444
+ }
1445
+ .markdown-body a:hover {
1446
+ text-decoration: underline;
1447
+ }
1448
+ .markdown-body ::-moz-placeholder {
1449
+ color: var(--color-fg-subtle);
1450
+ opacity: 1;
1451
+ }
1452
+ .markdown-body ::placeholder {
1453
+ color: var(--color-fg-subtle);
1454
+ opacity: 1;
1455
+ }
1456
+ .markdown-body hr:before {
1457
+ display: table;
1458
+ content: '';
1459
+ }
1460
+ .markdown-body hr:after {
1461
+ display: table;
1462
+ clear: both;
1463
+ content: '';
1464
+ }
1465
+ .markdown-body table {
1466
+ border-spacing: 0;
1467
+ border-collapse: collapse;
1468
+ display: block;
1469
+ width: -moz-max-content;
1470
+ width: max-content;
1471
+ max-width: 100%;
1472
+ overflow: auto;
1473
+ }
1474
+ .markdown-body td,
1475
+ .markdown-body th {
1476
+ padding: 0;
1477
+ }
1478
+ .markdown-body details summary {
1479
+ cursor: pointer;
1480
+ }
1481
+ .markdown-body details:not([open]) > *:not(summary) {
1482
+ display: none !important;
1483
+ }
1484
+ .markdown-body a:focus,
1485
+ .markdown-body [role='button']:focus,
1486
+ .markdown-body input[type='radio']:focus,
1487
+ .markdown-body input[type='checkbox']:focus {
1488
+ outline: 2px solid var(--color-accent-fg);
1489
+ outline-offset: -2px;
1490
+ box-shadow: none;
1491
+ }
1492
+ .markdown-body a:focus:not(:focus-visible),
1493
+ .markdown-body [role='button']:focus:not(:focus-visible),
1494
+ .markdown-body input[type='radio']:focus:not(:focus-visible),
1495
+ .markdown-body input[type='checkbox']:focus:not(:focus-visible) {
1496
+ outline: solid 1px transparent;
1497
+ }
1498
+ .markdown-body a:focus-visible,
1499
+ .markdown-body [role='button']:focus-visible,
1500
+ .markdown-body input[type='radio']:focus-visible,
1501
+ .markdown-body input[type='checkbox']:focus-visible {
1502
+ outline: 2px solid var(--color-accent-fg);
1503
+ outline-offset: -2px;
1504
+ box-shadow: none;
1505
+ }
1506
+ .markdown-body a:not([class]):focus,
1507
+ .markdown-body a:not([class]):focus-visible,
1508
+ .markdown-body input[type='radio']:focus,
1509
+ .markdown-body input[type='radio']:focus-visible,
1510
+ .markdown-body input[type='checkbox']:focus,
1511
+ .markdown-body input[type='checkbox']:focus-visible {
1512
+ outline-offset: 0;
1513
+ }
1514
+ .markdown-body kbd {
1515
+ display: inline-block;
1516
+ padding: 3px 5px;
1517
+ font: 11px ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas,
1518
+ Liberation Mono, monospace;
1519
+ line-height: 10px;
1520
+ color: var(--color-fg-default);
1521
+ vertical-align: middle;
1522
+ background-color: var(--color-canvas-subtle);
1523
+ border: solid 1px var(--color-neutral-muted);
1524
+ border-bottom-color: var(--color-neutral-muted);
1525
+ border-radius: 6px;
1526
+ box-shadow: inset 0 -1px 0 var(--color-neutral-muted);
1527
+ }
1528
+ .markdown-body h1,
1529
+ .markdown-body h2,
1530
+ .markdown-body h3,
1531
+ .markdown-body h4,
1532
+ .markdown-body h5,
1533
+ .markdown-body h6 {
1534
+ margin-top: 24px;
1535
+ margin-bottom: 16px;
1536
+ font-weight: var(--base-text-weight-semibold, 600);
1537
+ line-height: 1.25;
1538
+ }
1539
+ .markdown-body h2 {
1540
+ font-weight: var(--base-text-weight-semibold, 600);
1541
+ padding-bottom: 0.3em;
1542
+ font-size: 1.5em;
1543
+ border-bottom: 1px solid var(--color-border-muted);
1544
+ }
1545
+ .markdown-body h3 {
1546
+ font-weight: var(--base-text-weight-semibold, 600);
1547
+ font-size: 1.25em;
1548
+ }
1549
+ .markdown-body h4 {
1550
+ font-weight: var(--base-text-weight-semibold, 600);
1551
+ font-size: 1em;
1552
+ }
1553
+ .markdown-body h5 {
1554
+ font-weight: var(--base-text-weight-semibold, 600);
1555
+ font-size: 0.875em;
1556
+ }
1557
+ .markdown-body h6 {
1558
+ font-weight: var(--base-text-weight-semibold, 600);
1559
+ font-size: 0.85em;
1560
+ color: var(--color-fg-muted);
1561
+ }
1562
+ .markdown-body p {
1563
+ margin-top: 0;
1564
+ margin-bottom: 10px;
1565
+ }
1566
+ .markdown-body blockquote {
1567
+ margin: 0;
1568
+ padding: 0 1em;
1569
+ color: var(--color-fg-muted);
1570
+ border-left: 0.25em solid var(--color-border-default);
1571
+ }
1572
+ .markdown-body ul,
1573
+ .markdown-body ol {
1574
+ margin-top: 0;
1575
+ margin-bottom: 0;
1576
+ padding-left: 2em;
1577
+ }
1578
+ .markdown-body ol ol,
1579
+ .markdown-body ul ol {
1580
+ list-style-type: lower-roman;
1581
+ }
1582
+ .markdown-body ul ul ol,
1583
+ .markdown-body ul ol ol,
1584
+ .markdown-body ol ul ol,
1585
+ .markdown-body ol ol ol {
1586
+ list-style-type: lower-alpha;
1587
+ }
1588
+ .markdown-body dd {
1589
+ margin-left: 0;
1590
+ }
1591
+ .markdown-body tt,
1592
+ .markdown-body code,
1593
+ .markdown-body samp {
1594
+ font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas,
1595
+ Liberation Mono, monospace;
1596
+ font-size: 12px;
1597
+ }
1598
+ .markdown-body pre {
1599
+ margin-top: 0;
1600
+ margin-bottom: 0;
1601
+ font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas,
1602
+ Liberation Mono, monospace;
1603
+ font-size: 12px;
1604
+ word-wrap: normal;
1605
+ }
1606
+ .markdown-body .octicon {
1607
+ display: inline-block;
1608
+ overflow: visible !important;
1609
+ vertical-align: text-bottom;
1610
+ fill: currentColor;
1611
+ }
1612
+ .markdown-body input::-webkit-outer-spin-button,
1613
+ .markdown-body input::-webkit-inner-spin-button {
1614
+ margin: 0;
1615
+ -webkit-appearance: none;
1616
+ appearance: none;
1617
+ }
1618
+ .markdown-body:before {
1619
+ display: table;
1620
+ content: '';
1621
+ }
1622
+ .markdown-body:after {
1623
+ display: table;
1624
+ clear: both;
1625
+ content: '';
1626
+ }
1627
+ .markdown-body > *:first-child {
1628
+ margin-top: 0 !important;
1629
+ }
1630
+ .markdown-body > *:last-child {
1631
+ margin-bottom: 0 !important;
1632
+ }
1633
+ .markdown-body a:not([href]) {
1634
+ color: inherit;
1635
+ text-decoration: none;
1636
+ }
1637
+ .markdown-body .absent {
1638
+ color: var(--color-danger-fg);
1639
+ }
1640
+ .markdown-body .anchor {
1641
+ float: left;
1642
+ padding-right: 4px;
1643
+ margin-left: -20px;
1644
+ line-height: 1;
1645
+ }
1646
+ .markdown-body .anchor:focus {
1647
+ outline: none;
1648
+ }
1649
+ .markdown-body p,
1650
+ .markdown-body blockquote,
1651
+ .markdown-body ul,
1652
+ .markdown-body ol,
1653
+ .markdown-body dl,
1654
+ .markdown-body table,
1655
+ .markdown-body pre,
1656
+ .markdown-body details {
1657
+ margin-top: 0;
1658
+ margin-bottom: 16px;
1659
+ }
1660
+ .markdown-body blockquote > :first-child {
1661
+ margin-top: 0;
1662
+ }
1663
+ .markdown-body blockquote > :last-child {
1664
+ margin-bottom: 0;
1665
+ }
1666
+ .markdown-body h1 .octicon-link,
1667
+ .markdown-body h2 .octicon-link,
1668
+ .markdown-body h3 .octicon-link,
1669
+ .markdown-body h4 .octicon-link,
1670
+ .markdown-body h5 .octicon-link,
1671
+ .markdown-body h6 .octicon-link {
1672
+ color: var(--color-fg-default);
1673
+ vertical-align: middle;
1674
+ visibility: hidden;
1675
+ }
1676
+ .markdown-body h1:hover .anchor,
1677
+ .markdown-body h2:hover .anchor,
1678
+ .markdown-body h3:hover .anchor,
1679
+ .markdown-body h4:hover .anchor,
1680
+ .markdown-body h5:hover .anchor,
1681
+ .markdown-body h6:hover .anchor {
1682
+ text-decoration: none;
1683
+ }
1684
+ .markdown-body h1:hover .anchor .octicon-link,
1685
+ .markdown-body h2:hover .anchor .octicon-link,
1686
+ .markdown-body h3:hover .anchor .octicon-link,
1687
+ .markdown-body h4:hover .anchor .octicon-link,
1688
+ .markdown-body h5:hover .anchor .octicon-link,
1689
+ .markdown-body h6:hover .anchor .octicon-link {
1690
+ visibility: visible;
1691
+ }
1692
+ .markdown-body h1 tt,
1693
+ .markdown-body h1 code,
1694
+ .markdown-body h2 tt,
1695
+ .markdown-body h2 code,
1696
+ .markdown-body h3 tt,
1697
+ .markdown-body h3 code,
1698
+ .markdown-body h4 tt,
1699
+ .markdown-body h4 code,
1700
+ .markdown-body h5 tt,
1701
+ .markdown-body h5 code,
1702
+ .markdown-body h6 tt,
1703
+ .markdown-body h6 code {
1704
+ padding: 0 0.2em;
1705
+ font-size: inherit;
1706
+ }
1707
+ .markdown-body summary h1,
1708
+ .markdown-body summary h2,
1709
+ .markdown-body summary h3,
1710
+ .markdown-body summary h4,
1711
+ .markdown-body summary h5,
1712
+ .markdown-body summary h6 {
1713
+ display: inline-block;
1714
+ }
1715
+ .markdown-body summary h1 .anchor,
1716
+ .markdown-body summary h2 .anchor,
1717
+ .markdown-body summary h3 .anchor,
1718
+ .markdown-body summary h4 .anchor,
1719
+ .markdown-body summary h5 .anchor,
1720
+ .markdown-body summary h6 .anchor {
1721
+ margin-left: -40px;
1722
+ }
1723
+ .markdown-body summary h1,
1724
+ .markdown-body summary h2 {
1725
+ padding-bottom: 0;
1726
+ border-bottom: 0;
1727
+ }
1728
+ .markdown-body ul.no-list,
1729
+ .markdown-body ol.no-list {
1730
+ padding: 0;
1731
+ list-style-type: none;
1732
+ }
1733
+ .markdown-body ol[type='a'] {
1734
+ list-style-type: lower-alpha;
1735
+ }
1736
+ .markdown-body ol[type='A'] {
1737
+ list-style-type: upper-alpha;
1738
+ }
1739
+ .markdown-body ol[type='i'] {
1740
+ list-style-type: lower-roman;
1741
+ }
1742
+ .markdown-body ol[type='I'] {
1743
+ list-style-type: upper-roman;
1744
+ }
1745
+ .markdown-body ol[type='1'] {
1746
+ list-style-type: decimal;
1747
+ }
1748
+ .markdown-body div > ol:not([type]) {
1749
+ list-style-type: decimal;
1750
+ }
1751
+ .markdown-body ul ul,
1752
+ .markdown-body ul ol,
1753
+ .markdown-body ol ol,
1754
+ .markdown-body ol ul {
1755
+ margin-top: 0;
1756
+ margin-bottom: 0;
1757
+ }
1758
+ .markdown-body li > p {
1759
+ margin-top: 16px;
1760
+ }
1761
+ .markdown-body li + li {
1762
+ margin-top: 0.25em;
1763
+ }
1764
+ .markdown-body dl {
1765
+ padding: 0;
1766
+ }
1767
+ .markdown-body dl dt {
1768
+ padding: 0;
1769
+ margin-top: 16px;
1770
+ font-size: 1em;
1771
+ font-style: italic;
1772
+ font-weight: var(--base-text-weight-semibold, 600);
1773
+ }
1774
+ .markdown-body dl dd {
1775
+ padding: 0 16px;
1776
+ margin-bottom: 16px;
1777
+ }
1778
+ .markdown-body table th {
1779
+ font-weight: var(--base-text-weight-semibold, 600);
1780
+ }
1781
+ .markdown-body table th,
1782
+ .markdown-body table td {
1783
+ padding: 6px 13px;
1784
+ border: 1px solid var(--color-border-default);
1785
+ }
1786
+ .markdown-body table tr {
1787
+ background-color: var(--color-canvas-default);
1788
+ border-top: 1px solid var(--color-border-muted);
1789
+ }
1790
+ .markdown-body table tr:nth-child(2n) {
1791
+ background-color: var(--color-canvas-subtle);
1792
+ }
1793
+ .markdown-body table img {
1794
+ background-color: transparent;
1795
+ }
1796
+ .markdown-body img[align='right'] {
1797
+ padding-left: 20px;
1798
+ }
1799
+ .markdown-body img[align='left'] {
1800
+ padding-right: 20px;
1801
+ }
1802
+ .markdown-body .emoji {
1803
+ max-width: none;
1804
+ vertical-align: text-top;
1805
+ background-color: transparent;
1806
+ }
1807
+ .markdown-body span.frame {
1808
+ display: block;
1809
+ overflow: hidden;
1810
+ }
1811
+ .markdown-body span.frame > span {
1812
+ display: block;
1813
+ float: left;
1814
+ width: auto;
1815
+ padding: 7px;
1816
+ margin: 13px 0 0;
1817
+ overflow: hidden;
1818
+ border: 1px solid var(--color-border-default);
1819
+ }
1820
+ .markdown-body span.frame span img {
1821
+ display: block;
1822
+ float: left;
1823
+ }
1824
+ .markdown-body span.frame span span {
1825
+ display: block;
1826
+ padding: 5px 0 0;
1827
+ clear: both;
1828
+ color: var(--color-fg-default);
1829
+ }
1830
+ .markdown-body span.align-center {
1831
+ display: block;
1832
+ overflow: hidden;
1833
+ clear: both;
1834
+ }
1835
+ .markdown-body span.align-center > span {
1836
+ display: block;
1837
+ margin: 13px auto 0;
1838
+ overflow: hidden;
1839
+ text-align: center;
1840
+ }
1841
+ .markdown-body span.align-center span img {
1842
+ margin: 0 auto;
1843
+ text-align: center;
1844
+ }
1845
+ .markdown-body span.align-right {
1846
+ display: block;
1847
+ overflow: hidden;
1848
+ clear: both;
1849
+ }
1850
+ .markdown-body span.align-right > span {
1851
+ display: block;
1852
+ margin: 13px 0 0;
1853
+ overflow: hidden;
1854
+ text-align: right;
1855
+ }
1856
+ .markdown-body span.align-right span img {
1857
+ margin: 0;
1858
+ text-align: right;
1859
+ }
1860
+ .markdown-body span.float-left {
1861
+ display: block;
1862
+ float: left;
1863
+ margin-right: 13px;
1864
+ overflow: hidden;
1865
+ }
1866
+ .markdown-body span.float-left span {
1867
+ margin: 13px 0 0;
1868
+ }
1869
+ .markdown-body span.float-right {
1870
+ display: block;
1871
+ float: right;
1872
+ margin-left: 13px;
1873
+ overflow: hidden;
1874
+ }
1875
+ .markdown-body span.float-right > span {
1876
+ display: block;
1877
+ margin: 13px auto 0;
1878
+ overflow: hidden;
1879
+ text-align: right;
1880
+ }
1881
+ .markdown-body code,
1882
+ .markdown-body tt {
1883
+ padding: 0.2em 0.4em;
1884
+ margin: 0;
1885
+ font-size: 85%;
1886
+ white-space: break-spaces;
1887
+ background-color: var(--color-neutral-muted);
1888
+ border-radius: 6px;
1889
+ }
1890
+ .markdown-body code br,
1891
+ .markdown-body tt br {
1892
+ display: none;
1893
+ }
1894
+ .markdown-body del code {
1895
+ text-decoration: inherit;
1896
+ }
1897
+ .markdown-body samp {
1898
+ font-size: 85%;
1899
+ }
1900
+ .markdown-body pre code {
1901
+ font-size: 100%;
1902
+ }
1903
+ .markdown-body pre > code {
1904
+ padding: 0;
1905
+ margin: 0;
1906
+ word-break: normal;
1907
+ white-space: pre;
1908
+ background: transparent;
1909
+ border: 0;
1910
+ }
1911
+ .markdown-body .highlight {
1912
+ margin-bottom: 16px;
1913
+ }
1914
+ .markdown-body .highlight pre {
1915
+ margin-bottom: 0;
1916
+ word-break: normal;
1917
+ }
1918
+ .markdown-body .highlight pre,
1919
+ .markdown-body pre {
1920
+ padding: 16px;
1921
+ overflow: auto;
1922
+ font-size: 85%;
1923
+ line-height: 1.45;
1924
+ background-color: var(--color-canvas-subtle);
1925
+ border-radius: 6px;
1926
+ }
1927
+ .markdown-body pre code,
1928
+ .markdown-body pre tt {
1929
+ display: inline;
1930
+ max-width: auto;
1931
+ padding: 0;
1932
+ margin: 0;
1933
+ overflow: visible;
1934
+ line-height: inherit;
1935
+ word-wrap: normal;
1936
+ background-color: transparent;
1937
+ border: 0;
1938
+ }
1939
+ .markdown-body .csv-data td,
1940
+ .markdown-body .csv-data th {
1941
+ padding: 5px;
1942
+ overflow: hidden;
1943
+ font-size: 12px;
1944
+ line-height: 1;
1945
+ text-align: left;
1946
+ white-space: nowrap;
1947
+ }
1948
+ .markdown-body .csv-data .blob-num {
1949
+ padding: 10px 8px 9px;
1950
+ text-align: right;
1951
+ background: var(--color-canvas-default);
1952
+ border: 0;
1953
+ }
1954
+ .markdown-body .csv-data tr {
1955
+ border-top: 0;
1956
+ }
1957
+ .markdown-body .csv-data th {
1958
+ font-weight: var(--base-text-weight-semibold, 600);
1959
+ background: var(--color-canvas-subtle);
1960
+ border-top: 0;
1961
+ }
1962
+ .markdown-body [data-footnote-ref]:before {
1963
+ content: '[';
1964
+ }
1965
+ .markdown-body [data-footnote-ref]:after {
1966
+ content: ']';
1967
+ }
1968
+ .markdown-body .footnotes {
1969
+ font-size: 12px;
1970
+ color: var(--color-fg-muted);
1971
+ border-top: 1px solid var(--color-border-default);
1972
+ }
1973
+ .markdown-body .footnotes ol {
1974
+ padding-left: 16px;
1975
+ }
1976
+ .markdown-body .footnotes ol ul {
1977
+ display: inline-block;
1978
+ padding-left: 16px;
1979
+ margin-top: 16px;
1980
+ }
1981
+ .markdown-body .footnotes li {
1982
+ position: relative;
1983
+ }
1984
+ .markdown-body .footnotes li:target:before {
1985
+ position: absolute;
1986
+ top: -8px;
1987
+ right: -8px;
1988
+ bottom: -8px;
1989
+ left: -24px;
1990
+ pointer-events: none;
1991
+ content: '';
1992
+ border: 2px solid var(--color-accent-emphasis);
1993
+ border-radius: 6px;
1994
+ }
1995
+ .markdown-body .footnotes li:target {
1996
+ color: var(--color-fg-default);
1997
+ }
1998
+ .markdown-body .footnotes .data-footnote-backref g-emoji {
1999
+ font-family: monospace;
2000
+ }
2001
+ .markdown-body .pl-c {
2002
+ color: var(--color-prettylights-syntax-comment);
2003
+ }
2004
+ .markdown-body .pl-c1,
2005
+ .markdown-body .pl-s .pl-v {
2006
+ color: var(--color-prettylights-syntax-constant);
2007
+ }
2008
+ .markdown-body .pl-e,
2009
+ .markdown-body .pl-en {
2010
+ color: var(--color-prettylights-syntax-entity);
2011
+ }
2012
+ .markdown-body .pl-smi,
2013
+ .markdown-body .pl-s .pl-s1 {
2014
+ color: var(--color-prettylights-syntax-storage-modifier-import);
2015
+ }
2016
+ .markdown-body .pl-ent {
2017
+ color: var(--color-prettylights-syntax-entity-tag);
2018
+ }
2019
+ .markdown-body .pl-k {
2020
+ color: var(--color-prettylights-syntax-keyword);
2021
+ }
2022
+ .markdown-body .pl-s,
2023
+ .markdown-body .pl-pds,
2024
+ .markdown-body .pl-s .pl-pse .pl-s1,
2025
+ .markdown-body .pl-sr,
2026
+ .markdown-body .pl-sr .pl-cce,
2027
+ .markdown-body .pl-sr .pl-sre,
2028
+ .markdown-body .pl-sr .pl-sra {
2029
+ color: var(--color-prettylights-syntax-string);
2030
+ }
2031
+ .markdown-body .pl-v,
2032
+ .markdown-body .pl-smw {
2033
+ color: var(--color-prettylights-syntax-variable);
2034
+ }
2035
+ .markdown-body .pl-bu {
2036
+ color: var(--color-prettylights-syntax-brackethighlighter-unmatched);
2037
+ }
2038
+ .markdown-body .pl-ii {
2039
+ color: var(--color-prettylights-syntax-invalid-illegal-text);
2040
+ background-color: var(--color-prettylights-syntax-invalid-illegal-bg);
2041
+ }
2042
+ .markdown-body .pl-c2 {
2043
+ color: var(--color-prettylights-syntax-carriage-return-text);
2044
+ background-color: var(--color-prettylights-syntax-carriage-return-bg);
2045
+ }
2046
+ .markdown-body .pl-sr .pl-cce {
2047
+ font-weight: 700;
2048
+ color: var(--color-prettylights-syntax-string-regexp);
2049
+ }
2050
+ .markdown-body .pl-ml {
2051
+ color: var(--color-prettylights-syntax-markup-list);
2052
+ }
2053
+ .markdown-body .pl-mh,
2054
+ .markdown-body .pl-mh .pl-en,
2055
+ .markdown-body .pl-ms {
2056
+ font-weight: 700;
2057
+ color: var(--color-prettylights-syntax-markup-heading);
2058
+ }
2059
+ .markdown-body .pl-mi {
2060
+ font-style: italic;
2061
+ color: var(--color-prettylights-syntax-markup-italic);
2062
+ }
2063
+ .markdown-body .pl-mb {
2064
+ font-weight: 700;
2065
+ color: var(--color-prettylights-syntax-markup-bold);
2066
+ }
2067
+ .markdown-body .pl-md {
2068
+ color: var(--color-prettylights-syntax-markup-deleted-text);
2069
+ background-color: var(--color-prettylights-syntax-markup-deleted-bg);
2070
+ }
2071
+ .markdown-body .pl-mi1 {
2072
+ color: var(--color-prettylights-syntax-markup-inserted-text);
2073
+ background-color: var(--color-prettylights-syntax-markup-inserted-bg);
2074
+ }
2075
+ .markdown-body .pl-mc {
2076
+ color: var(--color-prettylights-syntax-markup-changed-text);
2077
+ background-color: var(--color-prettylights-syntax-markup-changed-bg);
2078
+ }
2079
+ .markdown-body .pl-mi2 {
2080
+ color: var(--color-prettylights-syntax-markup-ignored-text);
2081
+ background-color: var(--color-prettylights-syntax-markup-ignored-bg);
2082
+ }
2083
+ .markdown-body .pl-mdr {
2084
+ font-weight: 700;
2085
+ color: var(--color-prettylights-syntax-meta-diff-range);
2086
+ }
2087
+ .markdown-body .pl-ba {
2088
+ color: var(--color-prettylights-syntax-brackethighlighter-angle);
2089
+ }
2090
+ .markdown-body .pl-sg {
2091
+ color: var(--color-prettylights-syntax-sublimelinter-gutter-mark);
2092
+ }
2093
+ .markdown-body .pl-corl {
2094
+ text-decoration: underline;
2095
+ color: var(--color-prettylights-syntax-constant-other-reference-link);
2096
+ }
2097
+ .markdown-body g-emoji {
2098
+ display: inline-block;
2099
+ min-width: 1ch;
2100
+ font-family: 'Apple Color Emoji', 'Segoe UI Emoji', Segoe UI Symbol;
2101
+ font-size: 1em;
2102
+ font-style: normal !important;
2103
+ font-weight: var(--base-text-weight-normal, 400);
2104
+ line-height: 1;
2105
+ vertical-align: -0.075em;
2106
+ }
2107
+ .markdown-body g-emoji img {
2108
+ width: 1em;
2109
+ height: 1em;
2110
+ }
2111
+ .markdown-body .task-list-item {
2112
+ list-style-type: none;
2113
+ }
2114
+ .markdown-body .task-list-item label {
2115
+ font-weight: var(--base-text-weight-normal, 400);
2116
+ }
2117
+ .markdown-body .task-list-item.enabled label {
2118
+ cursor: pointer;
2119
+ }
2120
+ .markdown-body .task-list-item + .task-list-item {
2121
+ margin-top: 4px;
2122
+ }
2123
+ .markdown-body .task-list-item .handle {
2124
+ display: none;
2125
+ }
2126
+ .markdown-body .task-list-item-checkbox {
2127
+ margin: 0 0.2em 0.25em -1.4em;
2128
+ vertical-align: middle;
2129
+ }
2130
+ .markdown-body .contains-task-list:dir(rtl) .task-list-item-checkbox {
2131
+ margin: 0 -1.6em 0.25em 0.2em;
2132
+ }
2133
+ .markdown-body .contains-task-list {
2134
+ position: relative;
2135
+ }
2136
+ .markdown-body .contains-task-list:hover .task-list-item-convert-container,
2137
+ .markdown-body
2138
+ .contains-task-list:focus-within
2139
+ .task-list-item-convert-container {
2140
+ display: block;
2141
+ width: auto;
2142
+ height: 24px;
2143
+ overflow: visible;
2144
+ clip: auto;
2145
+ }
2146
+ .markdown-body ::-webkit-calendar-picker-indicator {
2147
+ filter: invert(50%);
2148
+ }
2149
+
2150
+ .markdown-body {
2151
+ background-color: transparent;
2152
+ font-size: 14px;
2153
+ }
2154
+ .markdown-body p {
2155
+ white-space: pre-wrap;
2156
+ }
2157
+ .markdown-body ol {
2158
+ list-style-type: decimal;
2159
+ }
2160
+ .markdown-body ul {
2161
+ list-style-type: disc;
2162
+ }
2163
+ .markdown-body pre code,
2164
+ .markdown-body pre tt {
2165
+ line-height: 1.65;
2166
+ }
2167
+ .markdown-body .highlight pre,
2168
+ .markdown-body pre {
2169
+ background-color: #fff;
2170
+ }
2171
+ .markdown-body code.hljs {
2172
+ padding: 0;
2173
+ }
2174
+ .markdown-body .code-block-wrapper {
2175
+ position: relative;
2176
+ padding-top: 24px;
2177
+ }
2178
+ .markdown-body .code-block-header {
2179
+ position: absolute;
2180
+ top: 5px;
2181
+ right: 0;
2182
+ width: 100%;
2183
+ padding: 0 1rem;
2184
+ display: flex;
2185
+ justify-content: flex-end;
2186
+ align-items: center;
2187
+ color: #b3b3b3;
2188
+ }
2189
+ .markdown-body .code-block-header__copy {
2190
+ cursor: pointer;
2191
+ margin-left: 0.5rem;
2192
+ -webkit-user-select: none;
2193
+ -moz-user-select: none;
2194
+ user-select: none;
2195
+ }
2196
+ .markdown-body .code-block-header__copy:hover {
2197
+ color: #65a665;
2198
+ }
2199
+ .message-reply .whitespace-pre-wrap {
2200
+ white-space: pre-wrap;
2201
+ color: var(--n-text-color);
2202
+ }
2203
+ .highlight pre,
2204
+ pre {
2205
+ background-color: #282c34;
2206
+ }
2207
+ `, ao = w`
2208
+ ${S}
2209
+ ${ro}
2210
+
2211
+ .cb-message-row {
2212
+ width: 100%;
2213
+ }
2214
+ .cb-message {
2215
+ display: flex;
2216
+ flex-direction: row;
2217
+ width: 100%;
2218
+ margin-top: 10px;
2219
+ }
2220
+
2221
+ .cb-message__content {
2222
+ max-width: 80%;
2223
+ }
2224
+
2225
+ .cb-message__content.thinking {
2226
+ max-width: 5rem;
2227
+ }
2228
+
2229
+ .cb-message__content:hover .cb-message__buttons {
2230
+ z-index: 1;
2231
+ }
2232
+
2233
+ .cb-message__content:hover .cb-message__buttons.left {
2234
+ left: -30px;
2235
+ }
2236
+
2237
+ .cb-message__content:hover .cb-message__buttons.right {
2238
+ right: -30px;
2239
+ }
2240
+
2241
+ .cb-message__buttons {
2242
+ position: absolute;
2243
+ height: 100%;
2244
+ top: 0;
2245
+ z-index: -1;
2246
+ transition: all 0.2s ease-in-out;
2247
+ }
2248
+ .cb-message__buttons.left {
2249
+ left: 0px;
2250
+ }
2251
+ .cb-message__buttons.left.show {
2252
+ left: -30px;
2253
+ }
2254
+
2255
+ .cb-message__buttons.right {
2256
+ right: 0px;
2257
+ }
2258
+ .cb-message__buttons.right.show {
2259
+ right: -30px;
2260
+ }
2261
+
2262
+ .cb-message__blank {
2263
+ flex: 1;
2264
+ max-width: 20%;
2265
+ }
2266
+
2267
+ .user-avatar {
2268
+ margin-right: 2px;
2269
+ //color: rgba(0, 208, 117, 0.2);
2270
+ color: rgba(0, 0, 0, 0.1);
2271
+ }
2272
+
2273
+ .assistant-avatar {
2274
+ font-size: 8px;
2275
+ z-index: 20;
2276
+ }
2277
+ .assistant-avatar img {
2278
+ border-radius: 4px;
2279
+ }
2280
+ .assistant-avatar svg {
2281
+ color: rgba(0, 0, 0, 0.1);
2282
+ //color: rgba(0, 208, 117, 0.2);
2283
+ }
2284
+
2285
+ .user-message,
2286
+ .assistant-message,
2287
+ .system-message {
2288
+ //padding: 0.5rem;
2289
+ //max-width: calc(100% - 120px);
2290
+ word-wrap: break-word;
2291
+
2292
+ border-radius: 6px;
2293
+ font-size: 14px;
2294
+ position: relative;
2295
+ -webkit-font-smoothing: subpixel-antialiased;
2296
+ }
2297
+
2298
+ .user-message {
2299
+ //margin-right: 0px;
2300
+ //margin-left: auto;
2301
+ color: rgb(255, 255, 255);
2302
+ //background-color: var(--primary-color);
2303
+ background-color: rgba(0, 208, 117, 1);
2304
+ text-align: left;
2305
+ padding: 6px 12px;
2306
+ }
2307
+
2308
+ .user-message.cb-message__content {
2309
+ max-width: 75%;
2310
+ }
2311
+
2312
+ .assistant-message {
2313
+ margin-right: auto;
2314
+ //margin-left: -12px;
2315
+ margin-left: 0px;
2316
+ margin-top: 2px;
2317
+ color: rgb(34, 34, 34);
2318
+ background-color: rgba(234, 234, 234, 0.3);
2319
+ padding: 4px 12px 6px 12px;
2320
+ }
2321
+
2322
+ .system-message {
2323
+ margin-right: auto;
2324
+ //margin-left: -12px;
2325
+ margin-left: 0px;
2326
+ margin-top: 2px;
2327
+ color: rgba(34, 34, 34, 0.6);
2328
+ background-color: rgba(254, 243, 199, 0.5);
2329
+ padding: 4px 12px 6px 12px;
2330
+ }
2331
+
2332
+ .assistant-message.cb-message__content {
2333
+ max-width: 85%;
2334
+ }
2335
+
2336
+ .cb-bot-message-wrapper {
2337
+ padding: 4px 4px;
2338
+ //display: flex;
2339
+ //background-color: rgba(234, 234, 234, 0.3);
2340
+ }
2341
+
2342
+ sl-avatar.small {
2343
+ --size: 2.5rem;
2344
+ }
2345
+
2346
+ sl-avatar.xsmall {
2347
+ --size: 2rem;
2348
+ }
2349
+
2350
+ .cb-message-text {
2351
+ text-align: left;
2352
+ }
2353
+
2354
+ .cb-message-text p {
2355
+ padding: 0;
2356
+ margin: 0;
2357
+ }
2358
+
2359
+ cb-icon::part(base) {
2360
+ font-size: 1em;
2361
+ }
2362
+ `;
2363
+ function ze(t, e) {
2364
+ return `<pre class="code-block-wrapper"><div class="code-block-header"><span class="code-block-header__lang">${e}</span><span class="code-block-header__copy">Copy</span></div><code class="hljs code-block-body ${e}">${t}</code></pre>`;
2365
+ }
2366
+ function so() {
2367
+ const t = new bt({
2368
+ linkify: !0,
2369
+ highlight(e, o) {
2370
+ if (!!(o && ge.getLanguage(o))) {
2371
+ const r = o ?? "";
2372
+ return ze(ge.highlight(e, { language: r }).value, r);
2373
+ }
2374
+ return ze(ge.highlightAuto(e).value, "");
2375
+ }
2376
+ });
2377
+ return t.use(gt, { attrs: { target: "_blank", rel: "noopener" } }), t;
2378
+ }
2379
+ async function Ee(t) {
2380
+ const e = so();
2381
+ return l`${De(e.render(t))}`;
2382
+ }
2383
+ let no = (t) => crypto.getRandomValues(new Uint8Array(t)), io = (t, e, o) => {
2384
+ let a = (2 << Math.log(t.length - 1) / Math.LN2) - 1, r = -~(1.6 * a * e / t.length);
2385
+ return (s = e) => {
2386
+ let n = "";
2387
+ for (; ; ) {
2388
+ let i = o(r), u = r;
2389
+ for (; u--; )
2390
+ if (n += t[i[u] & a] || "", n.length === s)
2391
+ return n;
2392
+ }
2393
+ };
2394
+ }, lo = (t, e = 21) => io(t, e, no);
2395
+ const co = lo("1234567890abcdefghijklmnopqrstuvwxyz", 10);
2396
+ function we(t = 10) {
2397
+ return co(t);
2398
+ }
2399
+ function po(t) {
2400
+ return new Promise((e, o) => {
2401
+ try {
2402
+ navigator.clipboard.writeText(t).then(() => {
2403
+ e(t);
2404
+ });
2405
+ } catch (a) {
2406
+ o(a);
2407
+ }
2408
+ });
2409
+ }
2410
+ function ho(t = !0) {
2411
+ return new Promise((e) => {
2412
+ const o = document.createElement("input");
2413
+ o.type = "file", t && (o.multiple = !0), o.style.display = "none", o.addEventListener("change", () => {
2414
+ const a = Array.prototype.slice.call(o.files);
2415
+ e(a);
2416
+ }), o.click();
2417
+ });
2418
+ }
2419
+ var uo = Object.defineProperty, bo = Object.getOwnPropertyDescriptor, de = (t, e, o, a) => {
2420
+ for (var r = a > 1 ? void 0 : a ? bo(e, o) : e, s = t.length - 1, n; s >= 0; s--)
2421
+ (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
2422
+ return a && r && uo(e, o, r), r;
2423
+ };
2424
+ let V = class extends C {
2425
+ constructor() {
2426
+ super(...arguments), this.type = "assistant";
2427
+ }
2428
+ disconnectedCallback() {
2429
+ super.disconnectedCallback(), this._removeCopyEvents();
2430
+ }
2431
+ /**
2432
+ * updated lifecycle hook: same to vue mounted or react useEffect
2433
+ * @param changedProperties
2434
+ */
2435
+ updated(t) {
2436
+ super.updated(t), t.has("message") && requestIdleCallback(() => {
2437
+ this._addCopyEvents();
2438
+ });
2439
+ }
2440
+ get _isBot() {
2441
+ return this.message.author === "assistant" || this.message.author === "system";
2442
+ }
2443
+ _removeMessageHandler() {
2444
+ this.emit("message:remove", {
2445
+ detail: this.message
2446
+ });
2447
+ }
2448
+ _addCopyEvents() {
2449
+ this.copyBtns.forEach((t) => {
2450
+ t.addEventListener("click", () => {
2451
+ var o, a;
2452
+ const e = (a = (o = t.parentElement) == null ? void 0 : o.nextElementSibling) == null ? void 0 : a.textContent;
2453
+ e && po(e).then(() => {
2454
+ t.textContent = "Success", setTimeout(() => {
2455
+ t.textContent = "Copy";
2456
+ }, 500);
2457
+ });
2458
+ });
2459
+ });
2460
+ }
2461
+ _removeCopyEvents() {
2462
+ this.copyBtns.forEach((t) => {
2463
+ t.removeEventListener("click", () => {
2464
+ });
2465
+ });
2466
+ }
2467
+ render() {
2468
+ return B(
2469
+ this.message.data || this.message.isThinking,
2470
+ () => l`
2471
+ <div class="cb-message-row" part="cb-message-row">
2472
+ <!-- message -->
2473
+ ${B(
2474
+ this._isBot,
2475
+ () => this.renderBotMessage(this.message),
2476
+ () => this.renderUserMessage(this.message)
2477
+ )}
2478
+ </div>
2479
+ `,
2480
+ () => null
2481
+ );
2482
+ }
2483
+ renderButtons(t = "left") {
2484
+ return l`<div class="cb-message__buttons ${t}">
2485
+ <!-- delete button -->
2486
+ <sl-button class="cb-message__delete-button" name="trash" @click=${this._removeMessageHandler} circle variant="text" size="small">
2487
+ <cb-icon svg="${to}" style="font-size: 1em !important;"></cb-icon>
2488
+ </sl-button>
2489
+ </div>`;
2490
+ }
2491
+ renderMessage(t) {
2492
+ return l`
2493
+ <div
2494
+ class="cb-message__content
2495
+ ${t.author}-message
2496
+ message-type-${t.type}
2497
+ ${t.isThinking ? "thinking" : ""}"
2498
+ style="display: flex"
2499
+ >
2500
+ ${this.renderMessageContent(t)}
2501
+ </div>
2502
+ `;
2503
+ }
2504
+ async _getMessageText(t) {
2505
+ return Ee(t.data.text);
2506
+ }
2507
+ renderMessageContent(t) {
2508
+ var e;
2509
+ return console.log("renderMessageContent!"), t.isThinking ? l`<cb-thinking></cb-thinking>` : t.isUploading ? l`<cb-uploading .files="${t.data.files || []}"></cb-uploading>` : t.type === "text" ? l`<div class="cb-message-text">
2510
+ ${B(
2511
+ t.data.userName,
2512
+ () => l`<div style="font-size: 12px; color:#9ca3af">${t.data.userName}</div>`,
2513
+ () => null
2514
+ )}
2515
+ ${Ae(
2516
+ this._getMessageText(t).then((o) => l`${o}`)
2517
+ )}
2518
+ </div>` : t.type === "file" ? l`${fe(
2519
+ t.data.files || [],
2520
+ (o) => o.id,
2521
+ (o) => l`<cb-file filename="${o.name}" url="${o.url}"></cb-file>`
2522
+ )}` : l`<div class="cb-message-text">
2523
+ ${Ae(
2524
+ Ee(((e = t.data.text) == null ? void 0 : e.toString()) || "").then((o) => l`${o}`)
2525
+ )}
2526
+ </div>`;
2527
+ }
2528
+ renderBotMessageAvatar(t) {
2529
+ if (t.data.userName && t.data.userName !== "") {
2530
+ const e = t.data.userAvatar || "";
2531
+ return l` <img src="${e}" style="width: 24px;height: 24px;" /> `;
2532
+ }
2533
+ return t.author === "system" ? l` <svg fill="currentColor" style="width: 24px;height: 24px;" viewBox="0 0 24 24">
2534
+ <path
2535
+ d="M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M11,17H13V11H11V17Z"
2536
+ />
2537
+ </svg>` : l` <svg fill="currentColor" style="width: 24px;height: 24px;" viewBox="0 0 24 24">
2538
+ <path
2539
+ d="M8,14.25L4.75,11H7C7.25,5.39 9.39,1 12,1C14,1 15.77,3.64 16.55,7.45C20.36,8.23 23,10 23,12C23,13.83 20.83,15.43 17.6,16.3L17.89,14.27C19.8,13.72 21,12.91 21,12C21,10.94 19.35,10 16.87,9.5C16.95,10.29 17,11.13 17,12C17,18.08 14.76,23 12,23C10.17,23 8.57,20.83 7.7,17.6L9.73,17.89C10.28,19.8 11.09,21 12,21C13.66,21 15,16.97 15,12C15,11 14.95,10.05 14.85,9.15C13.95,9.05 13,9 12,9L10.14,9.06L10.43,7.05L12,7C12.87,7 13.71,7.05 14.5,7.13C14,4.65 13.06,3 12,3C10.46,3 9.18,6.5 9,11H11.25L8,14.25M14.25,16L11,19.25V17C5.39,16.75 1,14.61 1,12C1,10.17 3.17,8.57 6.4,7.7L6.11,9.73C4.2,10.28 3,11.09 3,12C3,13.54 6.5,14.82 11,15V12.75L14.25,16Z"
2540
+ />
2541
+ </svg>`;
2542
+ }
2543
+ renderBotMessage(t) {
2544
+ return l`
2545
+ <div class="cb-message cb-bot-message-wrapper" part="cb-message">
2546
+ <div class="avatar assistant-avatar xsmall" style="margin-top:4px;">${this.renderBotMessageAvatar(t)}</div>
2547
+ <div style="margin-left: 4px;width: 100%">${this.renderMessage(t)}</div>
2548
+ </div>
2549
+ `;
2550
+ }
2551
+ renderUserMessage(t) {
2552
+ return l`
2553
+ <div class="cb-message" part="cb-message" style="display: flex; justify-content: end;align-items: start;">
2554
+ <!--<sl-avatar class="avatar user-avatar small" label="User">
2555
+ <cb-icon slot="icon" svg="${oo}" color="white"></cb-icon>
2556
+ </sl-avatar>-->
2557
+ <div class="avatar user-avatar">
2558
+ <svg viewBox="0 0 24 24" width="1.2em" height="1.2em" style="width: 24px;height: 24px;">
2559
+ <path fill="currentColor" d="M12 4a4 4 0 0 1 4 4a4 4 0 0 1-4 4a4 4 0 0 1-4-4a4 4 0 0 1 4-4m0 10c4.42 0 8 1.79 8 4v2H4v-2c0-2.21 3.58-4 8-4Z" />
2560
+ </svg>
2561
+ </div>
2562
+ ${this.renderMessage(t)}
2563
+ </div>
2564
+ `;
2565
+ }
2566
+ };
2567
+ V.styles = ao;
2568
+ de([
2569
+ c({ type: Object })
2570
+ ], V.prototype, "message", 2);
2571
+ de([
2572
+ c({ type: String })
2573
+ ], V.prototype, "type", 2);
2574
+ de([
2575
+ ut(".code-block-header__copy")
2576
+ ], V.prototype, "copyBtns", 2);
2577
+ V = de([
2578
+ x("cb-message")
2579
+ ], V);
2580
+ const k = ce.noConflict();
2581
+ k.setLevel("info");
2582
+ class go {
2583
+ constructor(e = {}) {
2584
+ this.id = 0, this.url = (e == null ? void 0 : e.url) || null, this._options = e || {}, this._ws = null, this.started = !1, this.connected = !1, this.onMessage = (e == null ? void 0 : e.onMessage) || null, this.queue = [], this.pause = (o) => new Promise((a) => setTimeout(a, o)), k.info(`WSC: Created, url: ${this.url}`);
2585
+ }
2586
+ connect(e = {}) {
2587
+ if (this.url = (e == null ? void 0 : e.url) || this.url, this.connected = !1, !this.url)
2588
+ return k.error("WSC: URL must be provided to connect"), null;
2589
+ const o = this.url;
2590
+ k.info(`WSC: Connecting to ${o} ...`), this._ws = new WebSocket(o);
2591
+ let a = setTimeout(() => {
2592
+ k.error("WSC: connected message not received in time - terminating"), this._ws.close(), this._ws = null, this.connected = !1;
2593
+ }, 15e3);
2594
+ this._ws.onopen = () => {
2595
+ k.info(`WSC: Connection to ${o} opened`);
2596
+ }, this._ws.onmessage = (r) => {
2597
+ let s = (r == null ? void 0 : r.data) || null;
2598
+ if (!s)
2599
+ return;
2600
+ let n = null;
2601
+ try {
2602
+ n = JSON.parse(s);
2603
+ } catch {
2604
+ k.error(`Failed to parse message: ${s}`);
2605
+ return;
2606
+ }
2607
+ (n == null ? void 0 : n.type) === "connected" && (k.info(`WS[${this.id}] Connected`), clearTimeout(a), this.connected = !0, this.sendQueuedMessages()), this.handleWscMessage(n);
2608
+ }, this._ws.onerror = (r) => {
2609
+ k.error("WSC: Socket error"), clearTimeout(a), this.connected = !1, this._ws = null;
2610
+ }, this._ws.onclose = (r) => {
2611
+ k.info(`WSC: Closed - code:${r.code}, reason:"${r.reason}"`), this.connected = !1, this._ws = null, this.reconnect();
2612
+ };
2613
+ }
2614
+ reconnect() {
2615
+ this.started && setTimeout(() => {
2616
+ this.connect();
2617
+ }, 1e3);
2618
+ }
2619
+ disconnect() {
2620
+ if (!this._ws) {
2621
+ k.info("WSC: already disconnected");
2622
+ return;
2623
+ }
2624
+ k.info("WSC: disconnect"), this._ws.close();
2625
+ }
2626
+ async start() {
2627
+ this.started = !0, this.connect();
2628
+ }
2629
+ async stop() {
2630
+ this.started = !1, this.disconnect();
2631
+ }
2632
+ // Attempt to connect, and reconnect if failed
2633
+ async startOld() {
2634
+ let e = 1, o = !0;
2635
+ for (; o; ) {
2636
+ if (k.info(`WSC: start: connecting, attempt ${e}`), await this.connect(), this.connected)
2637
+ return k.info("WSC: connected"), !0;
2638
+ e++, o = e <= 4, o && await this.pause(1e3);
2639
+ }
2640
+ return k.error(`WSC: start: failed to connect after ${e} attempts, exiting`), !1;
2641
+ }
2642
+ handleWscMessage(e) {
2643
+ this.onMessage && typeof this.onMessage == "function" && this.onMessage(e);
2644
+ }
2645
+ sendMessage(e) {
2646
+ if (!this.connected) {
2647
+ this.queue.push(JSON.stringify(e));
2648
+ return;
2649
+ }
2650
+ this._ws.send(JSON.stringify(e));
2651
+ }
2652
+ sendQueuedMessages() {
2653
+ if (Array.isArray(this.queue) && this.queue.length > 0)
2654
+ for (let e = 0; e < this.queue.length; e++)
2655
+ k.info("Sending queued message", this.queue[e]), this._ws.send(this.queue[e]);
2656
+ this.queue = [];
2657
+ }
2658
+ // Request assumes that response will be received.
2659
+ // We wait for the response, and then return it.
2660
+ // TODO Reconsider - disabled for now
2661
+ /*
2662
+ executeRequest(payload) {
2663
+ return new Promise((resolve, reject) => {
2664
+ if (!this._ws) {
2665
+ logger.error(`WS[${this.id}]: _ws is NULL - exiting`);
2666
+ resolve(null);
2667
+ }
2668
+
2669
+ const id = `${this.idCounter++}`;
2670
+ const req = Object.assign({ id: id }, payload);
2671
+ this._ws.send(JSON.stringify(req));
2672
+
2673
+ // Setting up timeout for max time to wait for the response
2674
+ let timerId = setTimeout(() => {
2675
+ timerId = null;
2676
+ logger.error(`WS[${this.id}]: Error: request timeout id:${id}, req:${JSON.stringify(req)}`);
2677
+ reject(new Error(`WS[${this.id}]: Error: request timeout id:${id}, req:${JSON.stringify(req)}`));
2678
+ }, 5000);
2679
+ // Wait for response
2680
+ this.once(`res-${id}`, (data) => {
2681
+ logger.info(`WS: Response: ${id}: ${JSON.stringify(data)}`);
2682
+ if (timerId) {
2683
+ clearTimeout(timerId);
2684
+ resolve(data);
2685
+ }
2686
+ });
2687
+ });
2688
+ }*/
2689
+ }
2690
+ var mo = Object.defineProperty, fo = Object.getOwnPropertyDescriptor, R = (t, e, o, a) => {
2691
+ for (var r = a > 1 ? void 0 : a ? fo(e, o) : e, s = t.length - 1, n; s >= 0; s--)
2692
+ (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
2693
+ return a && r && mo(e, o, r), r;
2694
+ };
2695
+ const z = ce.noConflict();
2696
+ z.setLevel("info");
2697
+ const F = "cb_";
2698
+ class A extends G {
2699
+ constructor() {
2700
+ super(...arguments), this.actionIdCounter = 0, this.wsClient = null, this.replyMessage = null;
2701
+ }
2702
+ // this is called at startup
2703
+ setSetting(e) {
2704
+ z.info("appState: Startup: setSetting", e), this.setting = e, Array.isArray(this.messages) && this.messages.length <= 0 && this.addMessage({
2705
+ author: "assistant",
2706
+ type: "text",
2707
+ data: {
2708
+ text: this.setting.welcomeMessage
2709
+ }
2710
+ }), this.connectWs === "true" && (z.info("appState: connectWs is true"), this.getWsClient().catch((o) => {
2711
+ z.info(`Exception during ws client startup: ${o.message}`);
2712
+ }));
2713
+ }
2714
+ clearConversation() {
2715
+ this.wsClient && (this.wsClient.stop().then(() => {
2716
+ }), this.wsClient = null), this.conversationId = we(), this.connectWs = "false", this.messages = [], this.actions = [], this.addMessage({
2717
+ author: "assistant",
2718
+ type: "text",
2719
+ data: {
2720
+ text: this.setting.welcomeMessage
2721
+ }
2722
+ });
2723
+ }
2724
+ // set language
2725
+ setLanguage(e) {
2726
+ this.language = e;
2727
+ }
2728
+ // set theme
2729
+ setTheme(e) {
2730
+ this.theme = e;
2731
+ }
2732
+ // Lazy initialization: avoid connecting until we actually need to send something
2733
+ // TODO Depending on state, start ws & connect immediately when initialized
2734
+ // use case: page refresh in the middle of the conversation
2735
+ async getWsClient() {
2736
+ if (this.wsClient)
2737
+ return this.wsClient;
2738
+ const e = `${this.setting.url}/api/bot/connect/${this.setting.orgId}/${this.setting.botId}/${this.conversationId}`;
2739
+ return z.info(`Initiating ws connection to ${e} ...`), this.wsClient = new go({
2740
+ url: e
2741
+ }), await this.wsClient.start(), this.wsClient.onMessage = (o) => {
2742
+ this.handleWscMessage(o);
2743
+ }, this.wsClient;
2744
+ }
2745
+ handleWscMessage(e) {
2746
+ switch (e == null ? void 0 : e.type) {
2747
+ case "message": {
2748
+ if (this.replyMessage)
2749
+ this.replyMessage.data.text = e.text, this.updateMessage(this.replyMessage, ""), this.replyMessage = null;
2750
+ else {
2751
+ const o = {
2752
+ type: "text",
2753
+ author: "assistant",
2754
+ data: {
2755
+ text: e.text
2756
+ }
2757
+ };
2758
+ "userName" in e && (o.data.userName = e.userName, this.connectWs = "true"), "userAvatar" in e && (o.data.userAvatar = e.userAvatar, this.connectWs = "true");
2759
+ const a = this.formatMessage(o);
2760
+ this.messages = this.messages.concat([a]);
2761
+ }
2762
+ break;
2763
+ }
2764
+ case "message-chunk": {
2765
+ this.replyMessage && (this.replyMessage = this.updateMessage(this.replyMessage, e.text));
2766
+ break;
2767
+ }
2768
+ case "typing": {
2769
+ this.replyMessage = {
2770
+ author: "assistant",
2771
+ type: "text",
2772
+ isThinking: !0,
2773
+ data: {
2774
+ text: ""
2775
+ }
2776
+ }, this.addMessage(this.replyMessage);
2777
+ break;
2778
+ }
2779
+ case "actions": {
2780
+ this.addActions((e == null ? void 0 : e.actions) || []);
2781
+ break;
2782
+ }
2783
+ }
2784
+ }
2785
+ addActions(e) {
2786
+ if (Array.isArray(e) && e.length > 0) {
2787
+ const o = e.map((a) => Object.assign(a, { internalId: this.actionIdCounter++ }));
2788
+ this.actions = this.actions.concat(o);
2789
+ }
2790
+ }
2791
+ removeAction(e) {
2792
+ const o = this.actions.findIndex((a) => a.internalId === e);
2793
+ if (o !== -1) {
2794
+ this.actions.splice(o, 1);
2795
+ const a = [];
2796
+ this.actions = a.concat(this.actions);
2797
+ }
2798
+ }
2799
+ async sendMessage(e) {
2800
+ e = this.formatMessage(e), z.info("Send Message:", e), this.messages = this.messages.concat([e]);
2801
+ const o = await this.getWsClient();
2802
+ if (!o) {
2803
+ z.error("Error - failed to obtain ws client"), this.replyMessage = null;
2804
+ return;
2805
+ }
2806
+ o.sendMessage({
2807
+ type: "message",
2808
+ id: e.id,
2809
+ text: e.data.text
2810
+ });
2811
+ }
2812
+ // TODO revisit below
2813
+ formatMessage(e) {
2814
+ var o;
2815
+ return e.id || (e.id = we()), e.timestamp = Date.now(), e.author === "assistant" && (e.replyId = (o = this.messages[this.messages.length - 1]) == null ? void 0 : o.id), e;
2816
+ }
2817
+ // add message
2818
+ addMessage(e) {
2819
+ e = this.formatMessage(e), this.messages = this.messages.concat([e]);
2820
+ }
2821
+ addSystemMessage(e) {
2822
+ this.addMessage({
2823
+ type: "text",
2824
+ author: "system",
2825
+ data: {
2826
+ text: e
2827
+ }
2828
+ });
2829
+ }
2830
+ // update message
2831
+ updateMessage(e, o) {
2832
+ const a = this.formatMessage(e);
2833
+ return a.isThinking = !1, o && (a.data.text += o), this.messages = this.messages.map((r) => r.id === a.id ? a : r), a;
2834
+ }
2835
+ // remove message
2836
+ removeMessage(e) {
2837
+ this.messages = this.messages.filter((o) => o.id !== e);
2838
+ }
2839
+ // clear messages
2840
+ clearMessages() {
2841
+ this.messages = [];
2842
+ }
2843
+ }
2844
+ R([
2845
+ D({ prefix: F }),
2846
+ I({ value: "en" })
2847
+ ], A.prototype, "language", 2);
2848
+ R([
2849
+ D({ prefix: F }),
2850
+ I({ value: "light" })
2851
+ ], A.prototype, "theme", 2);
2852
+ R([
2853
+ D({ prefix: F }),
2854
+ I({ value: "false" })
2855
+ ], A.prototype, "connectWs", 2);
2856
+ R([
2857
+ D({ prefix: F }),
2858
+ I({ value: we() })
2859
+ ], A.prototype, "conversationId", 2);
2860
+ R([
2861
+ D({ prefix: F }),
2862
+ I({ type: Array, value: [] })
2863
+ ], A.prototype, "messages", 2);
2864
+ R([
2865
+ I({
2866
+ type: Array,
2867
+ value: []
2868
+ /*value: [
2869
+ {
2870
+ internalId: 1,
2871
+ type: 'calendlyMeeting',
2872
+ title: 'Book 1:1 meeting',
2873
+ url: 'https://calendly.com/slava-sayko/1-1-meeting-with-sales?hide_gdpr_banner=1',
2874
+ // TODO Any other properties
2875
+ },
2876
+ {
2877
+ internalId: 2,
2878
+ type: 'link',
2879
+ title: 'Sign Up',
2880
+ url: 'https://signup.ticketspice.com/',
2881
+ // TODO Any other properties
2882
+ },
2883
+ ],*/
2884
+ })
2885
+ ], A.prototype, "actions", 2);
2886
+ R([
2887
+ D({ prefix: F }),
2888
+ I({
2889
+ type: Object,
2890
+ value: {
2891
+ orgId: null,
2892
+ botId: null,
2893
+ url: null,
2894
+ welcomeMessage: null
2895
+ }
2896
+ })
2897
+ ], A.prototype, "setting", 2);
2898
+ const b = new A();
2899
+ var yo = Object.defineProperty, vo = Object.getOwnPropertyDescriptor, K = (t, e, o, a) => {
2900
+ for (var r = a > 1 ? void 0 : a ? vo(e, o) : e, s = t.length - 1, n; s >= 0; s--)
2901
+ (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
2902
+ return a && r && yo(e, o, r), r;
2903
+ };
2904
+ const Q = ce.noConflict();
2905
+ Q.setLevel("info");
2906
+ let T = class extends C {
2907
+ constructor() {
2908
+ super(...arguments), this.messages = [], this.actions = [], this.calendlyInjected = !1, this.activeCalendlyAction = -1;
2909
+ }
2910
+ render() {
2911
+ return l`
2912
+ <div class="cb-message-list" part="cb-message-list">
2913
+ ${fe(
2914
+ this.messages,
2915
+ (t) => t.id + JSON.stringify(t.data),
2916
+ (t) => l`<cb-message .message="${t}"></cb-message>`
2917
+ )}
2918
+ ${this.renderActions()}
2919
+ </div>
2920
+ `;
2921
+ }
2922
+ renderActions() {
2923
+ return !Array.isArray(this.actions) || this.actions.length <= 0 ? null : l`
2924
+ <div class="cb-actions-list">
2925
+ ${fe(
2926
+ this.actions,
2927
+ (t) => t,
2928
+ (t) => this.renderAction(t)
2929
+ )}
2930
+ </div>
2931
+ `;
2932
+ }
2933
+ renderAction(t) {
2934
+ switch (t.type) {
2935
+ case "calendlyMeeting":
2936
+ return this.renderCalendlyAction(t);
2937
+ case "link":
2938
+ return this.renderLinkAction(t);
2939
+ }
2940
+ return null;
2941
+ }
2942
+ handleCalendlyEvent(t) {
2943
+ switch (Q.info("Got Calendly Event:", t.data), t.data.event) {
2944
+ case "calendly.event_scheduled": {
2945
+ const e = this.activeCalendlyAction;
2946
+ e >= 0 && (b.removeAction(e), b.addSystemMessage("Your meeting has been scheduled!"), this.activeCalendlyAction = -1);
2947
+ }
2948
+ }
2949
+ }
2950
+ invokeLinkAction(t = {}) {
2951
+ Q.info("invokeLinkAction:", t), window.open(t.url, "_blank");
2952
+ }
2953
+ invokeCalendlyAction(t = {}) {
2954
+ return Q.info("invokeCalendlyAction:", t), "Calendly" in window && (this.activeCalendlyAction = t.internalId, window.Calendly.initPopupWidget({ url: t.url })), !1;
2955
+ }
2956
+ renderCalendlyAction(t) {
2957
+ if (!("Calendly" in window) && !this.calendlyInjected) {
2958
+ let e = document.createElement("link");
2959
+ e.href = "https://assets.calendly.com/assets/external/widget.css", e.rel = "stylesheet", document.body.appendChild(e);
2960
+ let o = document.createElement("script");
2961
+ o.type = "text/javascript", o.src = "https://assets.calendly.com/assets/external/widget.js", document.body.appendChild(o), console.log("Injected Calendly"), window.addEventListener("message", (a) => {
2962
+ a.origin === "https://calendly.com" && a.data.event && a.data.event.indexOf("calendly.") !== -1 && this.handleCalendlyEvent(a);
2963
+ }), this.calendlyInjected = !0;
2964
+ }
2965
+ return l`
2966
+ <div class="cb-actions-list">
2967
+ <div class="cb-action ripple" @click="${this.invokeCalendlyAction.bind(this, t)}">
2968
+ <div class="cb-action-icon">
2969
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
2970
+ <path
2971
+ d="M22.86 17.74C22.77 17.85 22.65 17.91 22.53 17.94L20.66 18.3L21.95 21.14C22.11 21.43 21.97 21.79 21.67 21.93L19.53 22.94C19.44 23 19.36 23 19.27 23C19.05 23 18.84 22.88 18.74 22.66L17.45 19.83L15.96 21.04C15.86 21.12 15.74 21.17 15.59 21.17C15.26 21.17 15 20.9 15 20.57V11.6C15 11.27 15.26 11 15.59 11C15.74 11 15.88 11.05 16 11.13L22.77 16.89C23.04 17.12 23.07 17.5 22.86 17.74M12 15V10H7V15H12M19 3H18V1H16V3H8V1H6V3H5C3.89 3 3 3.9 3 5V19C3 20.1 3.89 21 5 21H13V19H5V8H19V11.06L21 12.76V5C21 3.9 20.1 3 19 3Z"
2972
+ fill="currentColor"
2973
+ />
2974
+ </svg>
2975
+ </div>
2976
+ ${t.title}
2977
+ </div>
2978
+ </div>
2979
+ `;
2980
+ }
2981
+ renderLinkAction(t) {
2982
+ return l`
2983
+ <div class="cb-actions-list">
2984
+ <div class="cb-action ripple" @click="${this.invokeLinkAction.bind(this, t)}">
2985
+ <div class="cb-action-icon">
2986
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
2987
+ <path d="M14,3V5H17.59L7.76,14.83L9.17,16.24L19,6.41V10H21V3M19,19H5V5H12V3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V12H19V19Z" fill="currentColor" />
2988
+ </svg>
2989
+ </div>
2990
+ ${t.title}
2991
+ </div>
2992
+ </div>
2993
+ `;
2994
+ }
2995
+ };
2996
+ T.styles = It;
2997
+ K([
2998
+ c({ type: Array })
2999
+ ], T.prototype, "messages", 2);
3000
+ K([
3001
+ c({ type: Array })
3002
+ ], T.prototype, "actions", 2);
3003
+ K([
3004
+ qe({ capture: !1, passive: !0 })
3005
+ ], T.prototype, "invokeLinkAction", 1);
3006
+ K([
3007
+ qe({ capture: !1, passive: !0 })
3008
+ ], T.prototype, "invokeCalendlyAction", 1);
3009
+ T = K([
3010
+ x("cb-message-list")
3011
+ ], T);
3012
+ const wo = w`
3013
+ ${S}
3014
+
3015
+ :host {
3016
+ width: 100%;
3017
+ background: rgb(244, 247, 249);
3018
+ position: relative;
3019
+ padding: 6px 5px;
3020
+ box-sizing: border-box;
3021
+ border-radius-bottom-left: 6px;
3022
+ border-radius-bottom-right: 6px;
3023
+ }
3024
+
3025
+ .cb-user-input-wrapper {
3026
+ display: flex;
3027
+ flex-direction: row;
3028
+ justify-content: space-between;
3029
+ align-items: center;
3030
+ }
3031
+
3032
+ .cb-user-input {
3033
+ flex: 1;
3034
+ }
3035
+
3036
+ .send-button {
3037
+ font-size: 1.5rem;
3038
+ }
3039
+
3040
+ .paperclip-button {
3041
+ font-size: 1.5rem;
3042
+ position: relative;
3043
+ }
3044
+
3045
+ .file-input {
3046
+ visibility: hidden;
3047
+ width: 100%;
3048
+ height: 100%;
3049
+ position: absolute;
3050
+ }
3051
+
3052
+ .cb-input-buttons {
3053
+ padding: 0 5px;
3054
+ }
3055
+ `, xo = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" d="M15.854.146a.5.5 0 0 1 .11.54l-5.819 14.547a.75.75 0 0 1-1.329.124l-3.178-4.995L.643 7.184a.75.75 0 0 1 .124-1.33L15.314.037a.5.5 0 0 1 .54.11ZM6.636 10.07l2.761 4.338L14.13 2.576L6.636 10.07Zm6.787-8.201L1.591 6.602l4.339 2.76l7.494-7.493Z"/></svg>', ko = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" d="M4.5 3a2.5 2.5 0 0 1 5 0v9a1.5 1.5 0 0 1-3 0V5a.5.5 0 0 1 1 0v7a.5.5 0 0 0 1 0V3a1.5 1.5 0 1 0-3 0v9a2.5 2.5 0 0 0 5 0V5a.5.5 0 0 1 1 0v7a3.5 3.5 0 1 1-7 0V3z"/></svg>';
3056
+ var _o = Object.defineProperty, Co = Object.getOwnPropertyDescriptor, O = (t, e, o, a) => {
3057
+ for (var r = a > 1 ? void 0 : a ? Co(e, o) : e, s = t.length - 1, n; s >= 0; s--)
3058
+ (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
3059
+ return a && r && _o(e, o, r), r;
3060
+ };
3061
+ let L = class extends C {
3062
+ constructor() {
3063
+ super(...arguments), this.placeholder = "Type a message...", this.sendButtonLabel = "Send", this.enableFileUpload = !1, this.value = "", this.loading = !1, this.disabled = !1, this.currentKey = "";
3064
+ }
3065
+ _inputChangeHandler(t) {
3066
+ const e = t.target;
3067
+ this.value = e.value;
3068
+ }
3069
+ _sendHandler() {
3070
+ this.emit("message:send", {
3071
+ detail: {
3072
+ timestamp: Date.now(),
3073
+ author: "user",
3074
+ type: "text",
3075
+ data: {
3076
+ text: this.value
3077
+ }
3078
+ }
3079
+ }), this.value = "", this.inputElement.blur();
3080
+ }
3081
+ async _sendFileHandler() {
3082
+ const t = await ho();
3083
+ this.emit("message:send:file", {
3084
+ detail: {
3085
+ files: t
3086
+ }
3087
+ });
3088
+ }
3089
+ render() {
3090
+ return l`
3091
+ <div class="cb-user-input-wrapper" part="user-input-wrapper">
3092
+ <sl-textarea
3093
+ @sl-input=${this._inputChangeHandler}
3094
+ placeholder=${this.placeholder}
3095
+ class="cb-user-input"
3096
+ clearable="true"
3097
+ value=${this.value}
3098
+ rows="1"
3099
+ resize="auto"
3100
+ filled
3101
+ ?disabled=${this.disabled}
3102
+ enterkeyhint="send"
3103
+ @keydown=${this._keyDownHandler}
3104
+ ></sl-textarea>
3105
+
3106
+ <span class="cb-input-buttons">
3107
+ ${B(
3108
+ this.enableFileUpload,
3109
+ () => l`
3110
+ <sl-button
3111
+ @click=${this._sendFileHandler}
3112
+ name="paperclip"
3113
+ label="Attachment"
3114
+ size="large"
3115
+ class="paperclip-button"
3116
+ variant="text"
3117
+ circle
3118
+ >
3119
+ <cb-icon svg="${ko}"></cb-icon>
3120
+ <!-- select file input -->
3121
+ <input
3122
+ type="file"
3123
+ id="file"
3124
+ name="file"
3125
+ class="file-input"
3126
+ />
3127
+ </sl-button>
3128
+ `,
3129
+ () => l``
3130
+ )}
3131
+ <sl-button
3132
+ @click=${this._sendHandler}
3133
+ name="send"
3134
+ label="Send"
3135
+ size="small"
3136
+ class="send-button"
3137
+ variant="text"
3138
+ ?disabled=${this.value.length === 0}
3139
+ ?loading=${this.loading}
3140
+ circle
3141
+ >
3142
+ <cb-icon svg="${xo}"></cb-icon>
3143
+ </sl-button>
3144
+ </span>
3145
+ </div>
3146
+ `;
3147
+ }
3148
+ _keyDownHandler(t) {
3149
+ t.key === "Enter" && !t.shiftKey && this._sendHandler();
3150
+ }
3151
+ };
3152
+ L.styles = wo;
3153
+ O([
3154
+ c({ type: String, attribute: "placeholder" })
3155
+ ], L.prototype, "placeholder", 2);
3156
+ O([
3157
+ c({ type: String, attribute: "send-button-label" })
3158
+ ], L.prototype, "sendButtonLabel", 2);
3159
+ O([
3160
+ c({ type: Boolean, attribute: "enable-file-upload" })
3161
+ ], L.prototype, "enableFileUpload", 2);
3162
+ O([
3163
+ c({ type: String })
3164
+ ], L.prototype, "value", 2);
3165
+ O([
3166
+ c({ type: Boolean })
3167
+ ], L.prototype, "loading", 2);
3168
+ O([
3169
+ c({ type: Boolean })
3170
+ ], L.prototype, "disabled", 2);
3171
+ O([
3172
+ c({ type: String })
3173
+ ], L.prototype, "currentKey", 2);
3174
+ O([
3175
+ Ce("sl-textarea")
3176
+ ], L.prototype, "inputElement", 2);
3177
+ L = O([
3178
+ x("cb-user-input")
3179
+ ], L);
3180
+ const $o = w`
3181
+ ${S}
3182
+
3183
+ sl-dialog::part(base) {
3184
+ z-index: 1000;
3185
+ }
3186
+
3187
+ .cb-header {
3188
+ display: flex;
3189
+ padding: 0px 0px 20px 0px;
3190
+ flex-direction: row;
3191
+ justify-content: space-between;
3192
+ align-items: center;
3193
+ }
3194
+
3195
+ .cb-header .title {
3196
+ font-weight: bold;
3197
+ font-size: 1.3rem;
3198
+ }
3199
+
3200
+ .cb-dialog__body {
3201
+ flex: 1 1 auto;
3202
+ display: block;
3203
+ padding: var(--body-spacing) 0;
3204
+ overflow: auto;
3205
+ }
3206
+
3207
+ .cb-dialog__footer {
3208
+ display: flex;
3209
+ padding: var(--body-spacing) 0;
3210
+ overflow: auto;
3211
+ justify-content: flex-end;
3212
+ gap: 8px;
3213
+ }
3214
+ `;
3215
+ var jo = Object.defineProperty, Mo = Object.getOwnPropertyDescriptor, pe = (t, e, o, a) => {
3216
+ for (var r = a > 1 ? void 0 : a ? Mo(e, o) : e, s = t.length - 1, n; s >= 0; s--)
3217
+ (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
3218
+ return a && r && jo(e, o, r), r;
3219
+ };
3220
+ let q = class extends C {
3221
+ constructor() {
3222
+ super(...arguments), this.open = !1, this.label = "Dialog", this.zindex = 100;
3223
+ }
3224
+ _settingCancelHandler() {
3225
+ this.emit("cancel");
3226
+ }
3227
+ render() {
3228
+ return l` <sl-dialog
3229
+ label="Setting"
3230
+ class="cb-dialog"
3231
+ style="sl-dialog::part(base) { z-index: ${this.zindex}; }"
3232
+ ?open=${this.open}
3233
+ ?no-header=${!0}
3234
+ @sl-hide=${this._settingCancelHandler}
3235
+ >
3236
+ <header class="cb-header">
3237
+ <div class="cb-header__left">
3238
+ ${this.label ? l`<span class="title">${this.label}</span>` : ""}
3239
+ </div>
3240
+ <sl-button
3241
+ @click=${this._settingCancelHandler}
3242
+ name="close"
3243
+ label="Close"
3244
+ class="close-button"
3245
+ variant="text"
3246
+ circle
3247
+ >
3248
+ <cb-icon
3249
+ color="default"
3250
+ style="font-size: 1em;"
3251
+ svg="${je}"
3252
+ ></cb-icon>
3253
+ </sl-button>
3254
+ </header>
3255
+ <div class="cb-dialog__body">
3256
+ <slot></slot>
3257
+ </div>
3258
+ <div part="footer" class="cb-dialog__footer">
3259
+ <slot name="cb-footer"></slot>
3260
+ </div>
3261
+ </sl-dialog>`;
3262
+ }
3263
+ };
3264
+ q.styles = $o;
3265
+ pe([
3266
+ c({ type: Boolean })
3267
+ ], q.prototype, "open", 2);
3268
+ pe([
3269
+ c({ type: String, attribute: "label" })
3270
+ ], q.prototype, "label", 2);
3271
+ pe([
3272
+ c({ type: Number })
3273
+ ], q.prototype, "zindex", 2);
3274
+ q = pe([
3275
+ x("cb-dialog")
3276
+ ], q);
3277
+ var Lo = Object.defineProperty, So = Object.getOwnPropertyDescriptor, Je = (t, e, o, a) => {
3278
+ for (var r = a > 1 ? void 0 : a ? So(e, o) : e, s = t.length - 1, n; s >= 0; s--)
3279
+ (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
3280
+ return a && r && Lo(e, o, r), r;
3281
+ };
3282
+ let re = class extends C {
3283
+ constructor() {
3284
+ super(...arguments), this.open = !1;
3285
+ }
3286
+ render() {
3287
+ return l` <cb-dialog
3288
+ label="Confirm"
3289
+ class="cb-clear-message-dialog"
3290
+ ?open=${this.open}
3291
+ zindex="1000"
3292
+ @cancel=${this._cancelHandler}
3293
+ >
3294
+ Confirm to clear all history messages?
3295
+ <sl-button
3296
+ slot="cb-footer"
3297
+ variant="primary"
3298
+ @click=${this._confirmHandler}
3299
+ >Confirm</sl-button
3300
+ >
3301
+ <sl-button
3302
+ slot="cb-footer"
3303
+ variant="default"
3304
+ @click=${this._cancelHandler}
3305
+ >Close</sl-button
3306
+ >
3307
+ </cb-dialog>`;
3308
+ }
3309
+ _confirmHandler() {
3310
+ this.emit("confirm");
3311
+ }
3312
+ _cancelHandler() {
3313
+ this.emit("cancel");
3314
+ }
3315
+ };
3316
+ re.styles = w`
3317
+ .cb-clear-message-dialog {
3318
+ }
3319
+
3320
+ sl-dialog::part(base) {
3321
+ z-index: 1000;
3322
+ }
3323
+ `;
3324
+ Je([
3325
+ c({ type: Boolean })
3326
+ ], re.prototype, "open", 2);
3327
+ re = Je([
3328
+ x("cb-clear-message-dialog")
3329
+ ], re);
3330
+ const Oo = w`
3331
+ :host {
3332
+ // width: 380px;
3333
+
3334
+ --label-width: 7.6rem;
3335
+ }
3336
+
3337
+ // sl-dialog.cb-dialog {
3338
+ // --width: 380px;
3339
+ // }
3340
+
3341
+ // sl-dialog::part(base) {
3342
+ // justify-content: flex-end;
3343
+ // }
3344
+ // sl-dialog::part(panel) {
3345
+ // }
3346
+
3347
+ .form-item {
3348
+ margin-bottom: var(--sl-spacing-medium);
3349
+ display: flex;
3350
+ flex-direction: row;
3351
+ align-items: center;
3352
+ justify-content: flex-start;
3353
+ }
3354
+
3355
+ .form-item .label {
3356
+ width: var(--label-width);
3357
+ }
3358
+
3359
+ .form-item sl-input {
3360
+ flex: 1;
3361
+ }
3362
+
3363
+ .setting-input {
3364
+ min-width: 15rem;
3365
+ }
3366
+
3367
+ .setting-input::part(form-control-input) {
3368
+ min-width: 20rem;
3369
+ }
3370
+
3371
+ .setting-input + .setting-input {
3372
+ margin-top: var(--sl-spacing-medium);
3373
+ }
3374
+
3375
+ .setting-input::part(form-control) {
3376
+ display: grid;
3377
+ grid: auto / var(--label-width) 1fr;
3378
+ gap: var(--sl-spacing-3x-small) var(--gap-width);
3379
+ align-items: center;
3380
+ }
3381
+
3382
+ .setting-input::part(form-control-label) {
3383
+ text-align: right;
3384
+ }
3385
+
3386
+ .setting-input::part(form-control-help-text) {
3387
+ grid-column-start: 2;
3388
+ }
3389
+ `;
3390
+ var Ho = Object.defineProperty, Ao = Object.getOwnPropertyDescriptor, Z = (t, e, o, a) => {
3391
+ for (var r = a > 1 ? void 0 : a ? Ao(e, o) : e, s = t.length - 1, n; s >= 0; s--)
3392
+ (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
3393
+ return a && r && Ho(e, o, r), r;
3394
+ };
3395
+ let H = class extends C {
3396
+ constructor() {
3397
+ super(...arguments), this.open = !1, this.clearMessageDialogOpen = !1, this.customRequest = !1;
3398
+ }
3399
+ render() {
3400
+ return this.customRequest = this.setting.customRequest, l`
3401
+ <cb-dialog
3402
+ label="Setting"
3403
+ class="cb-dialog"
3404
+ ?open=${this.open}
3405
+ ?no-header=${!0}
3406
+ @cancel=${this._settingCancelHandler}
3407
+ >
3408
+ <form>
3409
+ <div class="form-item">
3410
+ <label class="label">Clear Cache</label>
3411
+ <sl-button
3412
+ variant="danger"
3413
+ size="small"
3414
+ @click=${() => {
3415
+ this.clearMessageDialogOpen = !0;
3416
+ }}
3417
+ >
3418
+ Clear
3419
+ </sl-button>
3420
+ </div>
3421
+ <!-- <div class="form-item">
3422
+ <label class="label"> Custom Request </label>
3423
+
3424
+ <sl-switch
3425
+ class="item"
3426
+ label="Custom Request"
3427
+ name="customRequest"
3428
+ ?checked="${this.customRequest}"
3429
+ @sl-change=${this._checkChangeHandler}
3430
+ >
3431
+ Enable it for your own backend.
3432
+ </sl-switch>
3433
+ </div> -->
3434
+ ${B(
3435
+ this.customRequest,
3436
+ () => null,
3437
+ () => this.renderInternalServices()
3438
+ )}
3439
+
3440
+ <div class="form-item">
3441
+ <label class="label">Streaming</label>
3442
+ <sl-switch
3443
+ class="item"
3444
+ label="Stream"
3445
+ name="stream"
3446
+ ?checked="${this.setting.stream}"
3447
+ @sl-change=${this._checkChangeHandler}
3448
+ ></sl-switch>
3449
+ </div>
3450
+ <div class="form-item">
3451
+ <label class="label">Use Context</label>
3452
+ <sl-switch
3453
+ class="item"
3454
+ label="Use Context"
3455
+ name="useContext"
3456
+ ?checked="${this.setting.useContext}"
3457
+ @sl-change=${this._checkChangeHandler}
3458
+ ></sl-switch>
3459
+ <!-- <sl-input
3460
+ size="small"
3461
+ type="number"
3462
+ name="maxContextLength"
3463
+ value=${this.setting.maxContextLength}
3464
+ placeholder="Number of consecutive sessions"
3465
+ ></sl-input> -->
3466
+ </div>
3467
+ </form>
3468
+
3469
+ <sl-button
3470
+ slot="cb-footer"
3471
+ variant="primary"
3472
+ @click=${this._settingConfirmHandler}
3473
+ >
3474
+ Confirm
3475
+ </sl-button>
3476
+ <sl-button
3477
+ slot="cb-footer"
3478
+ variant="default"
3479
+ @click=${this._settingCancelHandler}
3480
+ >Cancel</sl-button
3481
+ >
3482
+ </cb-dialog>
3483
+ <cb-clear-message-dialog
3484
+ .open=${this.clearMessageDialogOpen}
3485
+ @confirm=${this._clearCacheHandler}
3486
+ @cancel=${() => {
3487
+ this.clearMessageDialogOpen = !1;
3488
+ }}
3489
+ ></cb-clear-message-dialog>
3490
+ `;
3491
+ }
3492
+ renderInternalServices() {
3493
+ return l`
3494
+ <div class="form-item">
3495
+ <label class="label">Service</label>
3496
+ <sl-radio-group name="openai" value="openai" size="small">
3497
+ <sl-radio-button value="openai">OpenAI</sl-radio-button>
3498
+ </sl-radio-group>
3499
+ </div>
3500
+
3501
+ <div class="form-item">
3502
+ <label class="label">API Key</label>
3503
+ <sl-input
3504
+ autofocus
3505
+ size="small"
3506
+ name="openai.apiKey"
3507
+ value=${this.setting.openai.apiKey}
3508
+ placeholder="Please input api key for openai"
3509
+ @sl-change=${this._inputChangeHandler}
3510
+ ></sl-input>
3511
+ </div>
3512
+ <div class="form-item">
3513
+ <label class="label">API Base</label>
3514
+ <sl-input
3515
+ autofocus
3516
+ size="small"
3517
+ name="openai.apiBase"
3518
+ value=${this.setting.openai.apiBase}
3519
+ placeholder="Please input api base for openai"
3520
+ @sl-change=${this._inputChangeHandler}
3521
+ ></sl-input>
3522
+ </div>
3523
+ `;
3524
+ }
3525
+ // clear message cache handler
3526
+ _clearCacheHandler() {
3527
+ this.emit("message:clear"), this.clearMessageDialogOpen = !1;
3528
+ }
3529
+ // input change handler
3530
+ _inputChangeHandler(t) {
3531
+ const { name: e, value: o } = t.target, [a, r] = e.split(".");
3532
+ r ? this.setting[a][r] = o : this.setting[a] = o;
3533
+ }
3534
+ // checked change handler
3535
+ _checkChangeHandler(t) {
3536
+ const { name: e, checked: o } = t.target, [a, r] = e.split(".");
3537
+ r ? this.setting[a][r] = o : this.setting[a] = o, a === "customRequest" && (this.customRequest = o);
3538
+ }
3539
+ // emit setting confirm event
3540
+ _settingConfirmHandler() {
3541
+ this.emit("setting:confirm", {
3542
+ detail: {
3543
+ setting: this.setting
3544
+ }
3545
+ });
3546
+ }
3547
+ // emit setting cancel event
3548
+ _settingCancelHandler() {
3549
+ this.emit("setting:hide");
3550
+ }
3551
+ updated(t) {
3552
+ var e;
3553
+ super.updated(t), (e = this.dialog) == null || e.addEventListener("sl-request-close", (o) => {
3554
+ o.detail.source === "overlay" && o.preventDefault();
3555
+ });
3556
+ }
3557
+ };
3558
+ H.styles = Oo;
3559
+ Z([
3560
+ c({ type: Boolean })
3561
+ ], H.prototype, "open", 2);
3562
+ Z([
3563
+ c({ type: Object })
3564
+ ], H.prototype, "setting", 2);
3565
+ Z([
3566
+ c({ type: Boolean })
3567
+ ], H.prototype, "clearMessageDialogOpen", 2);
3568
+ Z([
3569
+ Ce("sl-dialog")
3570
+ ], H.prototype, "dialog", 2);
3571
+ Z([
3572
+ c({ type: Boolean })
3573
+ ], H.prototype, "customRequest", 2);
3574
+ H = Z([
3575
+ x("cb-setting")
3576
+ ], H);
3577
+ const Po = w`
3578
+ ${S}
3579
+ :host {
3580
+ --primary-color: var(--sl-color-primary-600);
3581
+
3582
+ --anchor-width: 50px;
3583
+ }
3584
+
3585
+ .cb-anchor {
3586
+ width: var(--anchor-width);
3587
+ height: var(--anchor-width);
3588
+ //background-color: var(--primary-color);
3589
+ background: rgb(0, 208, 117);
3590
+
3591
+ position: fixed;
3592
+ right: 25px;
3593
+ bottom: 25px;
3594
+ border-radius: 50%;
3595
+
3596
+ display: flex;
3597
+ justify-content: center;
3598
+ align-items: center;
3599
+ color: white;
3600
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
3601
+
3602
+ transition: all 0.3s ease-in-out;
3603
+
3604
+ z-index: 100;
3605
+ }
3606
+
3607
+ .cb-anchor:hover {
3608
+ transform: scale(1.1);
3609
+ box-shadow: 0 0 100px rgba(0, 0, 0, 0.3);
3610
+ }
3611
+
3612
+ .anchor-button {
3613
+ font-size: 1.4em;
3614
+ }
3615
+
3616
+ sl-button[variant="primary"]::part(base) {
3617
+ background-color: rgb(0, 208, 117);
3618
+ border-color: rgb(0, 208, 117);
3619
+ }
3620
+ `, zo = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><path fill="currentColor" d="M16 8c0 3.866-3.582 7-8 7a9.06 9.06 0 0 1-2.347-.306c-.584.296-1.925.864-4.181 1.234c-.2.032-.352-.176-.273-.362c.354-.836.674-1.95.77-2.966C.744 11.37 0 9.76 0 8c0-3.866 3.582-7 8-7s8 3.134 8 7zM5 8a1 1 0 1 0-2 0a1 1 0 0 0 2 0zm4 0a1 1 0 1 0-2 0a1 1 0 0 0 2 0zm3 1a1 1 0 1 0 0-2a1 1 0 0 0 0 2z"/></svg>';
3621
+ var Eo = Object.defineProperty, To = Object.getOwnPropertyDescriptor, Ye = (t, e, o, a) => {
3622
+ for (var r = a > 1 ? void 0 : a ? To(e, o) : e, s = t.length - 1, n; s >= 0; s--)
3623
+ (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
3624
+ return a && r && Eo(e, o, r), r;
3625
+ };
3626
+ let ae = class extends C {
3627
+ constructor() {
3628
+ super(...arguments), this.open = !1;
3629
+ }
3630
+ // handler click
3631
+ _clickHandler() {
3632
+ const t = !this.open;
3633
+ this.emit("chatbot:toggle", {
3634
+ detail: {
3635
+ open: t
3636
+ }
3637
+ }), this.open = t;
3638
+ }
3639
+ render() {
3640
+ return l`
3641
+ <div
3642
+ class="cb-anchor ${this.open ? "open" : ""}"
3643
+ part="cb-anchor"
3644
+ @click=${this._clickHandler.bind(this)}
3645
+ >
3646
+ <sl-button
3647
+ label="Start"
3648
+ size="large"
3649
+ variant="primary"
3650
+ class="icon anchor-button"
3651
+ circle
3652
+ >
3653
+ ${B(
3654
+ this.open,
3655
+ () => l`<cb-icon
3656
+ color="white"
3657
+ svg="${je}"
3658
+ ></cb-icon>`,
3659
+ () => l`<cb-icon
3660
+ color="white"
3661
+ svg="${zo}"
3662
+ ></cb-icon>`
3663
+ )}
3664
+ </sl-button>
3665
+ </div>
3666
+ `;
3667
+ }
3668
+ };
3669
+ ae.styles = Po;
3670
+ Ye([
3671
+ c({ type: Boolean })
3672
+ ], ae.prototype, "open", 2);
3673
+ ae = Ye([
3674
+ x("cb-anchor")
3675
+ ], ae);
3676
+ const Io = w`
3677
+ ${S}
3678
+ `, xe = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><g fill="currentColor"><path d="M4.54.146A.5.5 0 0 1 4.893 0h6.214a.5.5 0 0 1 .353.146l4.394 4.394a.5.5 0 0 1 .146.353v6.214a.5.5 0 0 1-.146.353l-4.394 4.394a.5.5 0 0 1-.353.146H4.893a.5.5 0 0 1-.353-.146L.146 11.46A.5.5 0 0 1 0 11.107V4.893a.5.5 0 0 1 .146-.353L4.54.146zM5.1 1L1 5.1v5.8L5.1 15h5.8l4.1-4.1V5.1L10.9 1H5.1z"/><path d="M7.002 11a1 1 0 1 1 2 0a1 1 0 0 1-2 0zM7.1 4.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 4.995z"/></g></svg>', Ge = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><g fill="currentColor"><path d="M7.938 2.016A.13.13 0 0 1 8.002 2a.13.13 0 0 1 .063.016a.146.146 0 0 1 .054.057l6.857 11.667c.036.06.035.124.002.183a.163.163 0 0 1-.054.06a.116.116 0 0 1-.066.017H1.146a.115.115 0 0 1-.066-.017a.163.163 0 0 1-.054-.06a.176.176 0 0 1 .002-.183L7.884 2.073a.147.147 0 0 1 .054-.057zm1.044-.45a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566z"/><path d="M7.002 12a1 1 0 1 1 2 0a1 1 0 0 1-2 0zM7.1 5.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995z"/></g></svg>', Qe = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><g fill="currentColor"><path d="M2.5 8a5.5 5.5 0 0 1 8.25-4.764a.5.5 0 0 0 .5-.866A6.5 6.5 0 1 0 14.5 8a.5.5 0 0 0-1 0a5.5 5.5 0 1 1-11 0z"/><path d="M15.354 3.354a.5.5 0 0 0-.708-.708L8 9.293L5.354 6.646a.5.5 0 1 0-.708.708l3 3a.5.5 0 0 0 .708 0l7-7z"/></g></svg>', Xe = '<svg viewBox="0 0 16 16" width="1.2em" height="1.2em" ><g fill="currentColor"><path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/><path d="m8.93 6.588l-2.29.287l-.082.38l.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319c.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246c-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0a1 1 0 0 1 2 0z"/></g></svg>';
3679
+ var Ro = Object.defineProperty, Bo = Object.getOwnPropertyDescriptor, et = (t, e, o, a) => {
3680
+ for (var r = a > 1 ? void 0 : a ? Bo(e, o) : e, s = t.length - 1, n; s >= 0; s--)
3681
+ (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
3682
+ return a && r && Ro(e, o, r), r;
3683
+ };
3684
+ const Te = {
3685
+ error: {
3686
+ variant: "danger",
3687
+ icon: xe
3688
+ },
3689
+ danger: {
3690
+ variant: "danger",
3691
+ icon: xe
3692
+ },
3693
+ warning: {
3694
+ variant: "warning",
3695
+ icon: Ge
3696
+ },
3697
+ success: {
3698
+ variant: "success",
3699
+ icon: Qe
3700
+ },
3701
+ info: {
3702
+ variant: "primary",
3703
+ icon: Xe
3704
+ }
3705
+ };
3706
+ let se = class extends C {
3707
+ constructor() {
3708
+ super(...arguments), this.status = "info";
3709
+ }
3710
+ render() {
3711
+ const { variant: t, icon: e } = Te[this.status] || Te.info;
3712
+ return l`<cb-icon svg=${e} color="${t}"></cb-icon>`;
3713
+ }
3714
+ };
3715
+ se.styles = Ne;
3716
+ et([
3717
+ c({ type: String })
3718
+ ], se.prototype, "status", 2);
3719
+ se = et([
3720
+ x("cb-status-icon")
3721
+ ], se);
3722
+ var Vo = Object.defineProperty, qo = Object.getOwnPropertyDescriptor, Do = (t, e, o, a) => {
3723
+ for (var r = a > 1 ? void 0 : a ? qo(e, o) : e, s = t.length - 1, n; s >= 0; s--)
3724
+ (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
3725
+ return a && r && Vo(e, o, r), r;
3726
+ };
3727
+ let ke = class extends C {
3728
+ render() {
3729
+ return l` <sl-alert variant="danger" open>
3730
+ <cb-status-icon status="error" slot="icon"></cb-status-icon>
3731
+ Please config openai api key in the settings.
3732
+ <span
3733
+ @click="${this._handleConfig}"
3734
+ class="color-primary text-button"
3735
+ >Config Now</span
3736
+ >
3737
+ </sl-alert>`;
3738
+ }
3739
+ _handleConfig() {
3740
+ this.emit("setting:show");
3741
+ }
3742
+ };
3743
+ ke.styles = Io;
3744
+ ke = Do([
3745
+ x("cb-auth-alert")
3746
+ ], ke);
3747
+ class Ie extends Error {
3748
+ constructor(e, o, a) {
3749
+ const r = e.status || e.status === 0 ? e.status : "", s = e.statusText || "", n = `${r} ${s}`.trim(), i = n ? `status code ${n}` : "an unknown error";
3750
+ super(`Request failed with ${i}`), Object.defineProperty(this, "response", {
3751
+ enumerable: !0,
3752
+ configurable: !0,
3753
+ writable: !0,
3754
+ value: void 0
3755
+ }), Object.defineProperty(this, "request", {
3756
+ enumerable: !0,
3757
+ configurable: !0,
3758
+ writable: !0,
3759
+ value: void 0
3760
+ }), Object.defineProperty(this, "options", {
3761
+ enumerable: !0,
3762
+ configurable: !0,
3763
+ writable: !0,
3764
+ value: void 0
3765
+ }), this.name = "HTTPError", this.response = e, this.request = o, this.options = a;
3766
+ }
3767
+ }
3768
+ class tt extends Error {
3769
+ constructor(e) {
3770
+ super("Request timed out"), Object.defineProperty(this, "request", {
3771
+ enumerable: !0,
3772
+ configurable: !0,
3773
+ writable: !0,
3774
+ value: void 0
3775
+ }), this.name = "TimeoutError", this.request = e;
3776
+ }
3777
+ }
3778
+ const X = (t) => t !== null && typeof t == "object", Y = (...t) => {
3779
+ for (const e of t)
3780
+ if ((!X(e) || Array.isArray(e)) && typeof e < "u")
3781
+ throw new TypeError("The `options` argument must be an object");
3782
+ return Se({}, ...t);
3783
+ }, ot = (t = {}, e = {}) => {
3784
+ const o = new globalThis.Headers(t), a = e instanceof globalThis.Headers, r = new globalThis.Headers(e);
3785
+ for (const [s, n] of r.entries())
3786
+ a && n === "undefined" || n === void 0 ? o.delete(s) : o.set(s, n);
3787
+ return o;
3788
+ }, Se = (...t) => {
3789
+ let e = {}, o = {};
3790
+ for (const a of t)
3791
+ if (Array.isArray(a))
3792
+ Array.isArray(e) || (e = []), e = [...e, ...a];
3793
+ else if (X(a)) {
3794
+ for (let [r, s] of Object.entries(a))
3795
+ X(s) && r in e && (s = Se(e[r], s)), e = { ...e, [r]: s };
3796
+ X(a.headers) && (o = ot(o, a.headers), e.headers = o);
3797
+ }
3798
+ return e;
3799
+ }, Fo = (() => {
3800
+ let t = !1, e = !1;
3801
+ const o = typeof globalThis.ReadableStream == "function", a = typeof globalThis.Request == "function";
3802
+ return o && a && (e = new globalThis.Request("https://a.com", {
3803
+ body: new globalThis.ReadableStream(),
3804
+ method: "POST",
3805
+ // @ts-expect-error - Types are outdated.
3806
+ get duplex() {
3807
+ return t = !0, "half";
3808
+ }
3809
+ }).headers.has("Content-Type")), t && !e;
3810
+ })(), Zo = typeof globalThis.AbortController == "function", Uo = typeof globalThis.ReadableStream == "function", No = typeof globalThis.FormData == "function", rt = ["get", "post", "put", "patch", "head", "delete"], Wo = {
3811
+ json: "application/json",
3812
+ text: "text/*",
3813
+ formData: "multipart/form-data",
3814
+ arrayBuffer: "*/*",
3815
+ blob: "*/*"
3816
+ }, me = 2147483647, at = Symbol("stop"), Ko = (t) => rt.includes(t) ? t.toUpperCase() : t, Jo = ["get", "put", "head", "delete", "options", "trace"], Yo = [408, 413, 429, 500, 502, 503, 504], st = [413, 429, 503], Re = {
3817
+ limit: 2,
3818
+ methods: Jo,
3819
+ statusCodes: Yo,
3820
+ afterStatusCodes: st,
3821
+ maxRetryAfter: Number.POSITIVE_INFINITY,
3822
+ backoffLimit: Number.POSITIVE_INFINITY
3823
+ }, Go = (t = {}) => {
3824
+ if (typeof t == "number")
3825
+ return {
3826
+ ...Re,
3827
+ limit: t
3828
+ };
3829
+ if (t.methods && !Array.isArray(t.methods))
3830
+ throw new Error("retry.methods must be an array");
3831
+ if (t.statusCodes && !Array.isArray(t.statusCodes))
3832
+ throw new Error("retry.statusCodes must be an array");
3833
+ return {
3834
+ ...Re,
3835
+ ...t,
3836
+ afterStatusCodes: st
3837
+ };
3838
+ };
3839
+ async function Qo(t, e, o) {
3840
+ return new Promise((a, r) => {
3841
+ const s = setTimeout(() => {
3842
+ e && e.abort(), r(new tt(t));
3843
+ }, o.timeout);
3844
+ o.fetch(t).then(a).catch(r).then(() => {
3845
+ clearTimeout(s);
3846
+ });
3847
+ });
3848
+ }
3849
+ const Xo = !!globalThis.DOMException;
3850
+ function Be(t) {
3851
+ if (Xo)
3852
+ return new DOMException((t == null ? void 0 : t.reason) ?? "The operation was aborted.", "AbortError");
3853
+ const e = new Error((t == null ? void 0 : t.reason) ?? "The operation was aborted.");
3854
+ return e.name = "AbortError", e;
3855
+ }
3856
+ async function er(t, { signal: e }) {
3857
+ return new Promise((o, a) => {
3858
+ if (e) {
3859
+ if (e.aborted) {
3860
+ a(Be(e));
3861
+ return;
3862
+ }
3863
+ e.addEventListener("abort", r, { once: !0 });
3864
+ }
3865
+ function r() {
3866
+ a(Be(e)), clearTimeout(s);
3867
+ }
3868
+ const s = setTimeout(() => {
3869
+ e == null || e.removeEventListener("abort", r), o();
3870
+ }, t);
3871
+ });
3872
+ }
3873
+ class ne {
3874
+ // eslint-disable-next-line @typescript-eslint/promise-function-async
3875
+ static create(e, o) {
3876
+ const a = new ne(e, o), r = async () => {
3877
+ if (a._options.timeout > me)
3878
+ throw new RangeError(`The \`timeout\` option cannot be greater than ${me}`);
3879
+ await Promise.resolve();
3880
+ let i = await a._fetch();
3881
+ for (const u of a._options.hooks.afterResponse) {
3882
+ const g = await u(a.request, a._options, a._decorateResponse(i.clone()));
3883
+ g instanceof globalThis.Response && (i = g);
3884
+ }
3885
+ if (a._decorateResponse(i), !i.ok && a._options.throwHttpErrors) {
3886
+ let u = new Ie(i, a.request, a._options);
3887
+ for (const g of a._options.hooks.beforeError)
3888
+ u = await g(u);
3889
+ throw u;
3890
+ }
3891
+ if (a._options.onDownloadProgress) {
3892
+ if (typeof a._options.onDownloadProgress != "function")
3893
+ throw new TypeError("The `onDownloadProgress` option must be a function");
3894
+ if (!Uo)
3895
+ throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
3896
+ return a._stream(i.clone(), a._options.onDownloadProgress);
3897
+ }
3898
+ return i;
3899
+ }, n = a._options.retry.methods.includes(a.request.method.toLowerCase()) ? a._retry(r) : r();
3900
+ for (const [i, u] of Object.entries(Wo))
3901
+ n[i] = async () => {
3902
+ a.request.headers.set("accept", a.request.headers.get("accept") || u);
3903
+ const m = (await n).clone();
3904
+ if (i === "json") {
3905
+ if (m.status === 204 || (await m.clone().arrayBuffer()).byteLength === 0)
3906
+ return "";
3907
+ if (o.parseJson)
3908
+ return o.parseJson(await m.text());
3909
+ }
3910
+ return m[i]();
3911
+ };
3912
+ return n;
3913
+ }
3914
+ // eslint-disable-next-line complexity
3915
+ constructor(e, o = {}) {
3916
+ if (Object.defineProperty(this, "request", {
3917
+ enumerable: !0,
3918
+ configurable: !0,
3919
+ writable: !0,
3920
+ value: void 0
3921
+ }), Object.defineProperty(this, "abortController", {
3922
+ enumerable: !0,
3923
+ configurable: !0,
3924
+ writable: !0,
3925
+ value: void 0
3926
+ }), Object.defineProperty(this, "_retryCount", {
3927
+ enumerable: !0,
3928
+ configurable: !0,
3929
+ writable: !0,
3930
+ value: 0
3931
+ }), Object.defineProperty(this, "_input", {
3932
+ enumerable: !0,
3933
+ configurable: !0,
3934
+ writable: !0,
3935
+ value: void 0
3936
+ }), Object.defineProperty(this, "_options", {
3937
+ enumerable: !0,
3938
+ configurable: !0,
3939
+ writable: !0,
3940
+ value: void 0
3941
+ }), this._input = e, this._options = {
3942
+ // TODO: credentials can be removed when the spec change is implemented in all browsers. Context: https://www.chromestatus.com/feature/4539473312350208
3943
+ credentials: this._input.credentials || "same-origin",
3944
+ ...o,
3945
+ headers: ot(this._input.headers, o.headers),
3946
+ hooks: Se({
3947
+ beforeRequest: [],
3948
+ beforeRetry: [],
3949
+ beforeError: [],
3950
+ afterResponse: []
3951
+ }, o.hooks),
3952
+ method: Ko(o.method ?? this._input.method),
3953
+ // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
3954
+ prefixUrl: String(o.prefixUrl || ""),
3955
+ retry: Go(o.retry),
3956
+ throwHttpErrors: o.throwHttpErrors !== !1,
3957
+ timeout: typeof o.timeout > "u" ? 1e4 : o.timeout,
3958
+ fetch: o.fetch ?? globalThis.fetch.bind(globalThis)
3959
+ }, typeof this._input != "string" && !(this._input instanceof URL || this._input instanceof globalThis.Request))
3960
+ throw new TypeError("`input` must be a string, URL, or Request");
3961
+ if (this._options.prefixUrl && typeof this._input == "string") {
3962
+ if (this._input.startsWith("/"))
3963
+ throw new Error("`input` must not begin with a slash when using `prefixUrl`");
3964
+ this._options.prefixUrl.endsWith("/") || (this._options.prefixUrl += "/"), this._input = this._options.prefixUrl + this._input;
3965
+ }
3966
+ if (Zo) {
3967
+ if (this.abortController = new globalThis.AbortController(), this._options.signal) {
3968
+ const a = this._options.signal;
3969
+ this._options.signal.addEventListener("abort", () => {
3970
+ this.abortController.abort(a.reason);
3971
+ });
3972
+ }
3973
+ this._options.signal = this.abortController.signal;
3974
+ }
3975
+ if (Fo && (this._options.duplex = "half"), this.request = new globalThis.Request(this._input, this._options), this._options.searchParams) {
3976
+ const r = "?" + (typeof this._options.searchParams == "string" ? this._options.searchParams.replace(/^\?/, "") : new URLSearchParams(this._options.searchParams).toString()), s = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, r);
3977
+ (No && this._options.body instanceof globalThis.FormData || this._options.body instanceof URLSearchParams) && !(this._options.headers && this._options.headers["content-type"]) && this.request.headers.delete("content-type"), this.request = new globalThis.Request(new globalThis.Request(s, { ...this.request }), this._options);
3978
+ }
3979
+ this._options.json !== void 0 && (this._options.body = JSON.stringify(this._options.json), this.request.headers.set("content-type", this._options.headers.get("content-type") ?? "application/json"), this.request = new globalThis.Request(this.request, { body: this._options.body }));
3980
+ }
3981
+ _calculateRetryDelay(e) {
3982
+ if (this._retryCount++, this._retryCount < this._options.retry.limit && !(e instanceof tt)) {
3983
+ if (e instanceof Ie) {
3984
+ if (!this._options.retry.statusCodes.includes(e.response.status))
3985
+ return 0;
3986
+ const a = e.response.headers.get("Retry-After");
3987
+ if (a && this._options.retry.afterStatusCodes.includes(e.response.status)) {
3988
+ let r = Number(a);
3989
+ return Number.isNaN(r) ? r = Date.parse(a) - Date.now() : r *= 1e3, typeof this._options.retry.maxRetryAfter < "u" && r > this._options.retry.maxRetryAfter ? 0 : r;
3990
+ }
3991
+ if (e.response.status === 413)
3992
+ return 0;
3993
+ }
3994
+ const o = 0.3;
3995
+ return Math.min(this._options.retry.backoffLimit, o * 2 ** (this._retryCount - 1) * 1e3);
3996
+ }
3997
+ return 0;
3998
+ }
3999
+ _decorateResponse(e) {
4000
+ return this._options.parseJson && (e.json = async () => this._options.parseJson(await e.text())), e;
4001
+ }
4002
+ async _retry(e) {
4003
+ try {
4004
+ return await e();
4005
+ } catch (o) {
4006
+ const a = Math.min(this._calculateRetryDelay(o), me);
4007
+ if (a !== 0 && this._retryCount > 0) {
4008
+ await er(a, { signal: this._options.signal });
4009
+ for (const r of this._options.hooks.beforeRetry)
4010
+ if (await r({
4011
+ request: this.request,
4012
+ options: this._options,
4013
+ error: o,
4014
+ retryCount: this._retryCount
4015
+ }) === at)
4016
+ return;
4017
+ return this._retry(e);
4018
+ }
4019
+ throw o;
4020
+ }
4021
+ }
4022
+ async _fetch() {
4023
+ for (const e of this._options.hooks.beforeRequest) {
4024
+ const o = await e(this.request, this._options);
4025
+ if (o instanceof Request) {
4026
+ this.request = o;
4027
+ break;
4028
+ }
4029
+ if (o instanceof Response)
4030
+ return o;
4031
+ }
4032
+ return this._options.timeout === !1 ? this._options.fetch(this.request.clone()) : Qo(this.request.clone(), this.abortController, this._options);
4033
+ }
4034
+ /* istanbul ignore next */
4035
+ _stream(e, o) {
4036
+ const a = Number(e.headers.get("content-length")) || 0;
4037
+ let r = 0;
4038
+ return e.status === 204 ? (o && o({ percent: 1, totalBytes: a, transferredBytes: r }, new Uint8Array()), new globalThis.Response(null, {
4039
+ status: e.status,
4040
+ statusText: e.statusText,
4041
+ headers: e.headers
4042
+ })) : new globalThis.Response(new globalThis.ReadableStream({
4043
+ async start(s) {
4044
+ const n = e.body.getReader();
4045
+ o && o({ percent: 0, transferredBytes: 0, totalBytes: a }, new Uint8Array());
4046
+ async function i() {
4047
+ const { done: u, value: g } = await n.read();
4048
+ if (u) {
4049
+ s.close();
4050
+ return;
4051
+ }
4052
+ if (o) {
4053
+ r += g.byteLength;
4054
+ const m = a === 0 ? 0 : r / a;
4055
+ o({ percent: m, transferredBytes: r, totalBytes: a }, g);
4056
+ }
4057
+ s.enqueue(g), await i();
4058
+ }
4059
+ await i();
4060
+ }
4061
+ }), {
4062
+ status: e.status,
4063
+ statusText: e.statusText,
4064
+ headers: e.headers
4065
+ });
4066
+ }
4067
+ }
4068
+ /*! MIT License © Sindre Sorhus */
4069
+ const _e = (t) => {
4070
+ const e = (o, a) => ne.create(o, Y(t, a));
4071
+ for (const o of rt)
4072
+ e[o] = (a, r) => ne.create(a, Y(t, r, { method: o }));
4073
+ return e.create = (o) => _e(Y(o)), e.extend = (o) => _e(Y(t, o)), e.stop = at, e;
4074
+ }, tr = _e(), or = tr, nt = or.extend({
4075
+ hooks: {
4076
+ beforeRequest: [
4077
+ () => {
4078
+ }
4079
+ ]
4080
+ }
4081
+ });
4082
+ async function rr(t, e) {
4083
+ const { onmessage: o, onclose: a, ...r } = e, s = async (n, i) => {
4084
+ const { value: u, done: g } = await i.read();
4085
+ g ? (n.close(), a == null || a()) : (o == null || o(u), n.enqueue(u), s(n, i));
4086
+ };
4087
+ return r.body && typeof r.body == "object" && (r.body = JSON.stringify(r.body)), console.log("Fetching:", r), fetch(t, r).then((n) => {
4088
+ const i = n.body.getReader();
4089
+ return new ReadableStream({
4090
+ start(g) {
4091
+ s(
4092
+ g,
4093
+ i
4094
+ );
4095
+ }
4096
+ });
4097
+ }).then(
4098
+ (n) => new Response(n, {
4099
+ headers: { "Content-Type": "text/html" }
4100
+ }).text()
4101
+ );
4102
+ }
4103
+ async function ar(t, e) {
4104
+ const o = t.getReader(), a = new TextDecoder("utf-8");
4105
+ let r = !1;
4106
+ for (; !r; ) {
4107
+ const { value: s, done: n } = await o.read();
4108
+ if (s) {
4109
+ let i = a.decode(s);
4110
+ const u = i.lastIndexOf("data:"), g = i.lastIndexOf(`
4111
+ `);
4112
+ if (u !== -1 && (i = i.slice(u + 6)), g !== -1 && (i = i.slice(0, g)), i = i.trim(), i === `
4113
+ ` || i === "")
4114
+ continue;
4115
+ if (i === "[DONE]") {
4116
+ r = !0;
4117
+ continue;
4118
+ }
4119
+ try {
4120
+ const m = JSON.parse(i);
4121
+ e(null, m);
4122
+ } catch (m) {
4123
+ console.log("error", m), e(m, null);
4124
+ }
4125
+ }
4126
+ r = n;
4127
+ }
4128
+ }
4129
+ async function sr(t) {
4130
+ var r;
4131
+ if (!t.apiKey)
4132
+ throw new Error("apiKey is required");
4133
+ const e = t.options ?? {};
4134
+ e.model || (e.model = "gpt-3.5-turbo");
4135
+ const o = await nt.post(t.url, {
4136
+ json: {
4137
+ messages: t.messages,
4138
+ ...t.options ?? {}
4139
+ },
4140
+ headers: {
4141
+ "Content-Type": "application/json",
4142
+ Authorization: `Bearer ${t.apiKey}`
4143
+ },
4144
+ timeout: 1e3 * 60 * 10,
4145
+ signal: t.signal
4146
+ }), a = o.body;
4147
+ if (!a)
4148
+ throw new Error("No data");
4149
+ if ((r = t.options) != null && r.stream) {
4150
+ await ar(a, t.onMessage);
4151
+ return;
4152
+ }
4153
+ return o.json();
4154
+ }
4155
+ async function nr(t, e) {
4156
+ const o = new FormData();
4157
+ for (let r = 0; r < e.length; r++)
4158
+ o.append("files", e[r]);
4159
+ const a = await nt.post(t, {
4160
+ body: o
4161
+ });
4162
+ try {
4163
+ return await a.json();
4164
+ } catch (r) {
4165
+ return {
4166
+ code: 1,
4167
+ url: "",
4168
+ message: r.message
4169
+ };
4170
+ }
4171
+ }
4172
+ const Ve = {
4173
+ error: {
4174
+ variant: "danger",
4175
+ icon: xe
4176
+ },
4177
+ warning: {
4178
+ variant: "warning",
4179
+ icon: Ge
4180
+ },
4181
+ success: {
4182
+ variant: "success",
4183
+ icon: Qe
4184
+ },
4185
+ info: {
4186
+ variant: "primary",
4187
+ icon: Xe
4188
+ }
4189
+ };
4190
+ function ir(t) {
4191
+ const e = document.createElement("div");
4192
+ return e.textContent = t, e.innerHTML;
4193
+ }
4194
+ function lr(t = "info", e, o = 1e8) {
4195
+ const { variant: a, icon: r } = Ve[t] || Ve.info, s = Object.assign(document.createElement("sl-alert"), {
4196
+ variant: a,
4197
+ closable: !0,
4198
+ duration: o,
4199
+ innerHTML: `
4200
+ <cb-status-icon slot="icon" status="${t}"></cb-status-icon>
4201
+ ${ir(e)}
4202
+ `
4203
+ });
4204
+ return document.body.append(s), s.toast();
4205
+ }
4206
+ var cr = Object.defineProperty, dr = Object.getOwnPropertyDescriptor, _ = (t, e, o, a) => {
4207
+ for (var r = a > 1 ? void 0 : a ? dr(e, o) : e, s = t.length - 1, n; s >= 0; s--)
4208
+ (n = t[s]) && (r = (a ? n(e, o, r) : n(r)) || r);
4209
+ return a && r && cr(e, o, r), r;
4210
+ };
4211
+ const ee = ce.noConflict();
4212
+ ee.setLevel("info");
4213
+ let v = class extends C {
4214
+ constructor() {
4215
+ super(...arguments), this.store = new ft(this, b), this.displayLicense = !1, this.name = "ChatBot", this.orgId = "", this.botId = "", this.url = "ws://localhost:3070", this.welcomeMessage = "Hello! How can I help you today ?", this.stream = !1, this.customRequest = !1, this.enableFileUpload = !1, this.uploadFileUrl = "", this.open = !1, this.loading = !1, this.showSetting = !1, this.showAuthAlert = !1, this.fetchStream = rr;
4216
+ }
4217
+ /**
4218
+ * decodeStreamData
4219
+ */
4220
+ decodeStreamData(t) {
4221
+ return new TextDecoder().decode(t);
4222
+ }
4223
+ addMessage() {
4224
+ const t = {
4225
+ author: "assistant",
4226
+ type: "text",
4227
+ isThinking: !0,
4228
+ data: {}
4229
+ };
4230
+ return b.addMessage(t), t;
4231
+ }
4232
+ render() {
4233
+ return l`
4234
+ <div class="cb-wrapper" style="${this.open ? "display:flex" : "display:none"}">
4235
+ <cb-header title="${this.name}"></cb-header>
4236
+ <cb-message-list .messages=${b.messages} .actions=${b.actions}></cb-message-list>
4237
+ <cb-user-input ?loading=${this.loading} ?disabled=${this.loading || this.showAuthAlert} ?enable-file-upload=${this.enableFileUpload}></cb-user-input>
4238
+ </div>
4239
+ <cb-anchor ?open=${this.open}></cb-anchor>
4240
+ `;
4241
+ }
4242
+ connectedCallback() {
4243
+ super.connectedCallback(), ee.info("connectedCallback"), addEventListener("setting:show", () => {
4244
+ this.showSetting = !0;
4245
+ }), addEventListener("message:send", this._addMessageHandler.bind(this)), addEventListener("message:remove", this._deleteMessageHandler.bind(this)), addEventListener("setting:confirm", this._settingConfirmHandler.bind(this)), addEventListener("setting:hide", () => {
4246
+ this.showSetting = !1;
4247
+ }), addEventListener("chatbot:toggle", (t) => {
4248
+ const e = t.detail;
4249
+ this.open = e.open;
4250
+ }), addEventListener("message:clear", () => {
4251
+ b.clearMessages();
4252
+ }), addEventListener("message:send:file", this._sendFileHandler.bind(this)), addEventListener("setting:show", () => {
4253
+ this.showSetting = !0;
4254
+ });
4255
+ }
4256
+ // This is called when component is loaded, with all the settings (props) values
4257
+ // Use to initialize
4258
+ // This is also called when state changes - ??? - i.e. when message added to the array
4259
+ updated(t) {
4260
+ super.updated(t), ee.info("updated,_changedProperties:", t), t.size > 0 && this._initSetting(), setTimeout(() => {
4261
+ this._scrollToBottom();
4262
+ }, 0);
4263
+ }
4264
+ // initialize setting
4265
+ _initSetting() {
4266
+ ee.info("_initSetting");
4267
+ const t = b.setting;
4268
+ t.orgId = this.orgId, t.botId = this.botId, t.url = this.url, t.welcomeMessage = this.welcomeMessage, b.setSetting(t);
4269
+ }
4270
+ setLoading(t) {
4271
+ this.loading = t;
4272
+ }
4273
+ clearConversation() {
4274
+ b.clearConversation();
4275
+ }
4276
+ // check auth
4277
+ _checkAuth() {
4278
+ }
4279
+ // send to openai
4280
+ async _sendToOpenai(t, e) {
4281
+ let o = "";
4282
+ const a = b.setting.openai.apiBase || "https://api.openai.com/v1", r = await sr({
4283
+ url: `${a}/chat/completions`,
4284
+ apiKey: b.setting.openai.apiKey,
4285
+ messages: e,
4286
+ options: {
4287
+ stream: b.setting.stream,
4288
+ model: b.setting.openai.model
4289
+ // temperature: 0.9,
4290
+ },
4291
+ onMessage: (s, n) => {
4292
+ var i;
4293
+ if (s) {
4294
+ console.error(s);
4295
+ return;
4296
+ }
4297
+ n && ((i = n.choices[0].delta) != null && i.content) && requestIdleCallback(() => {
4298
+ o += n.choices[0].delta.content, b.updateMessage(t, o);
4299
+ });
4300
+ }
4301
+ });
4302
+ !b.setting.stream && r && b.updateMessage(t, r.choices[0].message.content);
4303
+ }
4304
+ // send to bot service
4305
+ async _sendHandler(t) {
4306
+ this.setLoading(!0);
4307
+ const e = {
4308
+ author: "assistant",
4309
+ type: "text",
4310
+ isThinking: !0,
4311
+ data: {}
4312
+ };
4313
+ if (b.addMessage(e), this.customRequest)
4314
+ await this.emit("chatbot:send", {
4315
+ detail: {
4316
+ newMessage: e,
4317
+ messages: t
4318
+ },
4319
+ bubbles: !0,
4320
+ composed: !0
4321
+ });
4322
+ else
4323
+ try {
4324
+ await this._sendToOpenai(e, t);
4325
+ } catch (o) {
4326
+ lr("error", o.message), console.error(o);
4327
+ }
4328
+ this.setLoading(!1);
4329
+ }
4330
+ _addMessageHandler(t) {
4331
+ const e = t.detail;
4332
+ b.sendMessage(e);
4333
+ }
4334
+ _deleteMessageHandler(t) {
4335
+ const e = t.detail;
4336
+ b.removeMessage(e.id);
4337
+ }
4338
+ async _sendFileHandler(t) {
4339
+ const e = t.detail, a = {
4340
+ author: "user",
4341
+ type: "file",
4342
+ isUploading: !0,
4343
+ data: {
4344
+ files: e.files.map((r, s) => ({
4345
+ id: `${r.name}-${s}`,
4346
+ name: r.name,
4347
+ size: r.size,
4348
+ type: r.type,
4349
+ url: ""
4350
+ }))
4351
+ }
4352
+ };
4353
+ if (b.addMessage(a), this.uploadFileUrl) {
4354
+ const r = await nr(this.uploadFileUrl, e.files);
4355
+ r.code === 0 && r.data && (a.isUploading = !1, a.data = {
4356
+ files: r.data
4357
+ }, b.updateMessage(a));
4358
+ }
4359
+ this.emit("chatbot:file:send", {
4360
+ detail: {
4361
+ files: e.files,
4362
+ message: a
4363
+ }
4364
+ });
4365
+ }
4366
+ // setting confirm handler
4367
+ _settingConfirmHandler(t) {
4368
+ const e = t.detail;
4369
+ b.setSetting(e.setting), this.showSetting = !1, this._checkAuth();
4370
+ }
4371
+ // scroll to bottom
4372
+ _scrollToBottom(t = !1) {
4373
+ requestIdleCallback(() => {
4374
+ var e;
4375
+ (e = this._messageList) == null || e.scrollTo({
4376
+ top: this._messageList.scrollHeight,
4377
+ behavior: t ? "smooth" : "auto"
4378
+ });
4379
+ });
4380
+ }
4381
+ };
4382
+ v.styles = _t;
4383
+ _([
4384
+ c({ type: Boolean, attribute: "display-license" })
4385
+ ], v.prototype, "displayLicense", 2);
4386
+ _([
4387
+ c({ type: String, attribute: "name" })
4388
+ ], v.prototype, "name", 2);
4389
+ _([
4390
+ c({ type: String, attribute: "org-id" })
4391
+ ], v.prototype, "orgId", 2);
4392
+ _([
4393
+ c({ type: String, attribute: "bot-id" })
4394
+ ], v.prototype, "botId", 2);
4395
+ _([
4396
+ c({ type: String, attribute: "url" })
4397
+ ], v.prototype, "url", 2);
4398
+ _([
4399
+ c({ type: String, attribute: "welcome-message" })
4400
+ ], v.prototype, "welcomeMessage", 2);
4401
+ _([
4402
+ c({ type: Boolean, attribute: "stream" })
4403
+ ], v.prototype, "stream", 2);
4404
+ _([
4405
+ c({ type: Boolean, attribute: "custom-request" })
4406
+ ], v.prototype, "customRequest", 2);
4407
+ _([
4408
+ c({ type: Boolean, attribute: "enable-file-upload" })
4409
+ ], v.prototype, "enableFileUpload", 2);
4410
+ _([
4411
+ c({ type: String, attribute: "upload-file-url" })
4412
+ ], v.prototype, "uploadFileUrl", 2);
4413
+ _([
4414
+ c({ type: Boolean, attribute: "open" })
4415
+ ], v.prototype, "open", 2);
4416
+ _([
4417
+ c({ type: Boolean })
4418
+ ], v.prototype, "loading", 2);
4419
+ _([
4420
+ c({ type: Boolean })
4421
+ ], v.prototype, "showSetting", 2);
4422
+ _([
4423
+ c({ type: Boolean })
4424
+ ], v.prototype, "showAuthAlert", 2);
4425
+ _([
4426
+ Ce("cb-message-list")
4427
+ ], v.prototype, "_messageList", 2);
4428
+ v = _([
4429
+ x("chat-bot")
4430
+ ], v);
4431
+ export {
4432
+ v as default
4433
+ };