@visma-swno/gaia-chat-ui 0.0.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.
Files changed (119) hide show
  1. package/CHANGELOG.md +0 -0
  2. package/README.md +1 -0
  3. package/dist/components/avatar/avatar.d.ts +13 -0
  4. package/dist/components/avatar/avatar.d.ts.map +1 -0
  5. package/dist/components/avatar/avatar.styles.d.ts +2 -0
  6. package/dist/components/avatar/avatar.styles.d.ts.map +1 -0
  7. package/dist/components/base.d.ts +7 -0
  8. package/dist/components/base.d.ts.map +1 -0
  9. package/dist/components/button/button.d.ts +11 -0
  10. package/dist/components/button/button.d.ts.map +1 -0
  11. package/dist/components/button/button.styles.d.ts +2 -0
  12. package/dist/components/button/button.styles.d.ts.map +1 -0
  13. package/dist/components/card/card-content.d.ts +6 -0
  14. package/dist/components/card/card-content.d.ts.map +1 -0
  15. package/dist/components/card/card-content.styles.d.ts +2 -0
  16. package/dist/components/card/card-content.styles.d.ts.map +1 -0
  17. package/dist/components/card/card-footer.d.ts +6 -0
  18. package/dist/components/card/card-footer.d.ts.map +1 -0
  19. package/dist/components/card/card-footer.styles.d.ts +2 -0
  20. package/dist/components/card/card-footer.styles.d.ts.map +1 -0
  21. package/dist/components/card/card-header.d.ts +7 -0
  22. package/dist/components/card/card-header.d.ts.map +1 -0
  23. package/dist/components/card/card-header.styles.d.ts +2 -0
  24. package/dist/components/card/card-header.styles.d.ts.map +1 -0
  25. package/dist/components/card/card.d.ts +6 -0
  26. package/dist/components/card/card.d.ts.map +1 -0
  27. package/dist/components/card/card.styles.d.ts +2 -0
  28. package/dist/components/card/card.styles.d.ts.map +1 -0
  29. package/dist/components/chat/chat.d.ts +28 -0
  30. package/dist/components/chat/chat.d.ts.map +1 -0
  31. package/dist/components/chat/chat.styles.d.ts +2 -0
  32. package/dist/components/chat/chat.styles.d.ts.map +1 -0
  33. package/dist/components/chat-input/chat-input.d.ts +16 -0
  34. package/dist/components/chat-input/chat-input.d.ts.map +1 -0
  35. package/dist/components/chat-input/chat-input.styles.d.ts +2 -0
  36. package/dist/components/chat-input/chat-input.styles.d.ts.map +1 -0
  37. package/dist/components/chat-message/chat-message.d.ts +19 -0
  38. package/dist/components/chat-message/chat-message.d.ts.map +1 -0
  39. package/dist/components/chat-message/chat-message.styles.d.ts +2 -0
  40. package/dist/components/chat-message/chat-message.styles.d.ts.map +1 -0
  41. package/dist/components/chat-message/chat-message.utils.d.ts +2 -0
  42. package/dist/components/chat-message/chat-message.utils.d.ts.map +1 -0
  43. package/dist/components/chat-message/markdown.styles.d.ts +2 -0
  44. package/dist/components/chat-message/markdown.styles.d.ts.map +1 -0
  45. package/dist/components/index.d.ts +16 -0
  46. package/dist/components/index.d.ts.map +1 -0
  47. package/dist/components/loader/loader.d.ts +10 -0
  48. package/dist/components/loader/loader.d.ts.map +1 -0
  49. package/dist/components/loader/loader.styles.d.ts +2 -0
  50. package/dist/components/loader/loader.styles.d.ts.map +1 -0
  51. package/dist/components/menu/menu-item.d.ts +11 -0
  52. package/dist/components/menu/menu-item.d.ts.map +1 -0
  53. package/dist/components/menu/menu-item.styles.d.ts +2 -0
  54. package/dist/components/menu/menu-item.styles.d.ts.map +1 -0
  55. package/dist/components/menu/menu.d.ts +11 -0
  56. package/dist/components/menu/menu.d.ts.map +1 -0
  57. package/dist/components/menu/menu.styles.d.ts +2 -0
  58. package/dist/components/menu/menu.styles.d.ts.map +1 -0
  59. package/dist/components/popover/popover.d.ts +18 -0
  60. package/dist/components/popover/popover.d.ts.map +1 -0
  61. package/dist/components/popover/popover.styles.d.ts +2 -0
  62. package/dist/components/popover/popover.styles.d.ts.map +1 -0
  63. package/dist/components/spacing/spacing.d.ts +7 -0
  64. package/dist/components/spacing/spacing.d.ts.map +1 -0
  65. package/dist/components/spacing/spacing.styles.d.ts +2 -0
  66. package/dist/components/spacing/spacing.styles.d.ts.map +1 -0
  67. package/dist/components/tooltip/tooltip.d.ts +16 -0
  68. package/dist/components/tooltip/tooltip.d.ts.map +1 -0
  69. package/dist/components/tooltip/tooltip.styles.d.ts +2 -0
  70. package/dist/components/tooltip/tooltip.styles.d.ts.map +1 -0
  71. package/dist/config/constants.d.ts +51 -0
  72. package/dist/config/constants.d.ts.map +1 -0
  73. package/dist/constants/icon-map.d.ts +3 -0
  74. package/dist/constants/icon-map.d.ts.map +1 -0
  75. package/dist/controllers/chat-controller.d.ts +22 -0
  76. package/dist/controllers/chat-controller.d.ts.map +1 -0
  77. package/dist/controllers/support-controller.d.ts +36 -0
  78. package/dist/controllers/support-controller.d.ts.map +1 -0
  79. package/dist/gaia-chat-ui.es.js +5403 -0
  80. package/dist/gaia-chat-ui.es.js.map +1 -0
  81. package/dist/gaia-chat-ui.umd.js +2313 -0
  82. package/dist/gaia-chat-ui.umd.js.map +1 -0
  83. package/dist/index.d.ts +3 -0
  84. package/dist/index.d.ts.map +1 -0
  85. package/dist/services/base-service.d.ts +21 -0
  86. package/dist/services/base-service.d.ts.map +1 -0
  87. package/dist/services/chat-service.d.ts +14 -0
  88. package/dist/services/chat-service.d.ts.map +1 -0
  89. package/dist/services/chat-service.dto.d.ts +12 -0
  90. package/dist/services/chat-service.dto.d.ts.map +1 -0
  91. package/dist/services/liveleader-service.d.ts +10 -0
  92. package/dist/services/liveleader-service.d.ts.map +1 -0
  93. package/dist/services/liveleader-service.dto.d.ts +109 -0
  94. package/dist/services/liveleader-service.dto.d.ts.map +1 -0
  95. package/dist/services/websocket-manager.d.ts +38 -0
  96. package/dist/services/websocket-manager.d.ts.map +1 -0
  97. package/dist/styles.d.ts +2 -0
  98. package/dist/styles.d.ts.map +1 -0
  99. package/dist/types/events.d.ts +9 -0
  100. package/dist/types/events.d.ts.map +1 -0
  101. package/dist/types/icons.d.ts +2 -0
  102. package/dist/types/icons.d.ts.map +1 -0
  103. package/dist/types/index.d.ts +1 -0
  104. package/dist/types/index.d.ts.map +1 -0
  105. package/dist/types/interfaces/chat-controller-host.d.ts +9 -0
  106. package/dist/types/interfaces/chat-controller-host.d.ts.map +1 -0
  107. package/dist/types/models/chat-message.d.ts +75 -0
  108. package/dist/types/models/chat-message.d.ts.map +1 -0
  109. package/dist/types/models/conversation.d.ts +6 -0
  110. package/dist/types/models/conversation.d.ts.map +1 -0
  111. package/dist/types/server-sent-events.d.ts +29 -0
  112. package/dist/types/server-sent-events.d.ts.map +1 -0
  113. package/dist/utils/index.d.ts +1 -0
  114. package/dist/utils/index.d.ts.map +1 -0
  115. package/dist/utils/logger.d.ts +27 -0
  116. package/dist/utils/logger.d.ts.map +1 -0
  117. package/dist/utils/object.d.ts +3 -0
  118. package/dist/utils/object.d.ts.map +1 -0
  119. package/package.json +85 -0
@@ -0,0 +1,2313 @@
1
+ (function(b,p){typeof exports=="object"&&typeof module<"u"?p(exports,require("lit"),require("lit/decorators.js"),require("lit/directives/unsafe-svg.js"),require("lit/directives/unsafe-html.js"),require("lit/directives/ref.js")):typeof define=="function"&&define.amd?define(["exports","lit","lit/decorators.js","lit/directives/unsafe-svg.js","lit/directives/unsafe-html.js","lit/directives/ref.js"],p):(b=typeof globalThis<"u"?globalThis:b||self,p(b.GaiaChatUI={},b.Lit,b.decorators_js,b.unsafeSvg_js,b.unsafeHtml_js,b.ref_js))})(this,function(b,p,g,ie,j,Le){"use strict";var yn=Object.defineProperty;var kn=(b,p,g)=>p in b?yn(b,p,{enumerable:!0,configurable:!0,writable:!0,value:g}):b[p]=g;var y=(b,p,g)=>kn(b,typeof p!="symbol"?p+"":p,g);const gt=p.css`
2
+ :host {
3
+ position: relative;
4
+ display: inline-block;
5
+ box-sizing: border-box;
6
+ aspect-ratio: 1 / 1;
7
+ overflow: hidden;
8
+ }
9
+
10
+ :host([size='xs']) {
11
+ width: var(--size-16);
12
+ height: var(--size-16);
13
+ font-weight: var(--font-weight-medium);
14
+ font-size: var(--font-size-xs);
15
+ line-height: var(--lineheight-xs);
16
+ letter-spacing: var(--tracking-xs);
17
+ }
18
+
19
+ :host([size='sm']) {
20
+ width: var(--size-24);
21
+ height: var(--size-24);
22
+ font-weight: var(--font-weight-bold);
23
+ font-size: var(--font-size-sm);
24
+ line-height: var(--lineheight-sm);
25
+ letter-spacing: var(--tracking-sm);
26
+ }
27
+
28
+ :host([size='md']) {
29
+ width: var(--size-40);
30
+ height: var(--size-40);
31
+ font-weight: var(--font-weight-bold);
32
+ font-size: var(--font-size-lg);
33
+ line-height: var(--lineheight-lg);
34
+ letter-spacing: var(--tracking-lg);
35
+ }
36
+
37
+ :host([size='lg']) {
38
+ width: var(--size-64);
39
+ height: var(--size-64);
40
+ font-weight: var(--font-weight-bold);
41
+ font-size: var(--font-size-2xl);
42
+ line-height: var(--lineheight-2xl);
43
+ letter-spacing: var(--tracking-2xl);
44
+ }
45
+
46
+ .avatar {
47
+ position: relative;
48
+ display: inline-flex;
49
+ width: 100%;
50
+ height: 100%;
51
+ box-sizing: border-box;
52
+ align-items: center;
53
+ justify-content: center;
54
+ border-radius: 50%;
55
+ border: var(--border-width-sm) solid var(--border-disabled);
56
+ background-color: var(--surface-disabled);
57
+ overflow: hidden;
58
+ }
59
+
60
+ .avatar > img {
61
+ width: 100%;
62
+ height: 100%;
63
+ object-fit: cover;
64
+ object-position: center;
65
+ border-radius: 50%;
66
+ }
67
+
68
+ .avatar__overlay {
69
+ position: absolute;
70
+ inset: 0;
71
+ background: #13344540;
72
+ pointer-events: none;
73
+ opacity: 0;
74
+ z-index: 1;
75
+ }
76
+
77
+ :host(:not([disabled])) .avatar,
78
+ :host(:not([disabled])) .avatar__overlay {
79
+ transition-property:
80
+ color, background-color, border-color, text-decoration-color, opacity, fill, stroke;
81
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
82
+ transition-duration: 150ms;
83
+ }
84
+
85
+ :host([disabled]) .avatar > img {
86
+ filter: saturate(0%);
87
+ }
88
+
89
+ :host([disabled]) .avatar__overlay {
90
+ background: #ffffffb2;
91
+ opacity: 1;
92
+ }
93
+
94
+ .avatar:has(.avatar__initials) {
95
+ background-color: var(--surface-primary);
96
+ border-color: var(--border-primary);
97
+ }
98
+
99
+ :host(:not([disabled])) .avatar:hover {
100
+ cursor: pointer;
101
+ }
102
+
103
+ :host(:not([disabled])) .avatar:hover:has(.avatar__initials) {
104
+ background-color: var(--surface-action-hover-2);
105
+ border-color: var(--border-action-hover);
106
+ color: var(--text-action);
107
+ }
108
+
109
+ :host([disabled]) .avatar:has(.avatar__initials) {
110
+ background-color: var(--surface-disabled);
111
+ border-color: var(--border-disabled);
112
+ color: var(--text-on-disabled);
113
+ }
114
+
115
+ :host(:not([disabled])) .avatar:hover:has(.avatar__image) .avatar__overlay {
116
+ opacity: 1;
117
+ }
118
+
119
+ .avatar__status-container {
120
+ position: absolute;
121
+ box-sizing: border-box;
122
+ bottom: -1px;
123
+ right: -1px;
124
+ aspect-ratio: 1 / 1;
125
+ border-radius: 50%;
126
+ background-color: var(--surface-primary);
127
+ z-index: 2;
128
+ border: var(--border-width-sm) solid var(--surface-primary);
129
+ }
130
+
131
+ :host([size='xs']) .avatar__status-container {
132
+ visibility: hidden;
133
+ opacity: 0;
134
+ }
135
+
136
+ :host([size='sm']) .avatar__status-container {
137
+ width: 14px;
138
+ height: 14px;
139
+ }
140
+
141
+ :host([size='md']) .avatar__status-container {
142
+ width: 20px;
143
+ height: 20px;
144
+ padding: 2px;
145
+ }
146
+
147
+ :host([size='lg']) .avatar__status-container {
148
+ width: 30px;
149
+ height: 30px;
150
+ padding: 2px;
151
+ }
152
+
153
+ .avatar__status-icon {
154
+ width: 100%;
155
+ height: 100%;
156
+ box-sizing: border-box;
157
+ border-radius: inherit;
158
+ background-color: var(--icon-success);
159
+ border: var(--border-width-sm) solid var(--surface-primary);
160
+ }
161
+ `;var ut=Object.defineProperty,ft=Object.getOwnPropertyDescriptor,O=(o,e,t,r)=>{for(var n=r>1?void 0:r?ft(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&ut(e,t,n),n};let A=class extends p.LitElement{constructor(){super(...arguments),this.size="md",this.disabled=!1,this.status=void 0,this.src=void 0,this.initials=void 0,this.fallback="https://github.com/shadcn.png"}_renderAvatar(){return this.src?p.html`<img class="avatar__image" src=${this.src} alt="Avatar" />
162
+ <div class="avatar__overlay"></div>`:this.initials?p.html`<div class="avatar__initials">
163
+ ${this.initials.substring(0,2).toUpperCase()}
164
+ </div>`:p.html`<img class="avatar__image" src=${this.fallback} alt="Avatar" />
165
+ <div class="avatar__overlay"></div>`}render(){return p.html`
166
+ <div class="avatar">${this._renderAvatar()}</div>
167
+ ${this.status?p.html`<div class="avatar__status-container">
168
+ <div class="avatar__status-icon"></div>
169
+ </div>`:""}
170
+ `}};A.styles=[gt],O([g.property({type:String,attribute:"size",reflect:!0})],A.prototype,"size",2),O([g.property({type:Boolean,attribute:"disabled",reflect:!0})],A.prototype,"disabled",2),O([g.property({type:String,attribute:"status",reflect:!0})],A.prototype,"status",2),O([g.property({type:String,attribute:"src"})],A.prototype,"src",2),O([g.property({type:String,attribute:"initials"})],A.prototype,"initials",2),O([g.property({type:String,attribute:"fallback"})],A.prototype,"fallback",2),A=O([g.customElement("gaia-avatar")],A);function mt(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var be={exports:{}};/*!
171
+ Copyright (c) 2018 Jed Watson.
172
+ Licensed under the MIT License (MIT), see
173
+ http://jedwatson.github.io/classnames
174
+ */var De;function vt(){return De||(De=1,function(o){(function(){var e={}.hasOwnProperty;function t(){for(var i="",s=0;s<arguments.length;s++){var a=arguments[s];a&&(i=n(i,r(a)))}return i}function r(i){if(typeof i=="string"||typeof i=="number")return i;if(typeof i!="object")return"";if(Array.isArray(i))return t.apply(null,i);if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]"))return i.toString();var s="";for(var a in i)e.call(i,a)&&i[a]&&(s=n(s,a));return s}function n(i,s){return s?i?i+" "+s:i+s:i}o.exports?(t.default=t,o.exports=t):window.classNames=t})()}(be)),be.exports}var bt=vt();const N=mt(bt);/**
175
+ * @license lucide-static v0.510.0 - ISC
176
+ *
177
+ * This source code is licensed under the ISC license.
178
+ * See the LICENSE file in the root directory of this source tree.
179
+ */const wt=`
180
+ <svg
181
+ class="lucide lucide-arrow-up-right"
182
+ xmlns="http://www.w3.org/2000/svg"
183
+ width="24"
184
+ height="24"
185
+ viewBox="0 0 24 24"
186
+ fill="none"
187
+ stroke="currentColor"
188
+ stroke-width="2"
189
+ stroke-linecap="round"
190
+ stroke-linejoin="round"
191
+ >
192
+ <path d="M7 7h10v10" />
193
+ <path d="M7 17 17 7" />
194
+ </svg>
195
+ `;/**
196
+ * @license lucide-static v0.510.0 - ISC
197
+ *
198
+ * This source code is licensed under the ISC license.
199
+ * See the LICENSE file in the root directory of this source tree.
200
+ */const yt=`
201
+ <svg
202
+ class="lucide lucide-arrow-up"
203
+ xmlns="http://www.w3.org/2000/svg"
204
+ width="24"
205
+ height="24"
206
+ viewBox="0 0 24 24"
207
+ fill="none"
208
+ stroke="currentColor"
209
+ stroke-width="2"
210
+ stroke-linecap="round"
211
+ stroke-linejoin="round"
212
+ >
213
+ <path d="m5 12 7-7 7 7" />
214
+ <path d="M12 19V5" />
215
+ </svg>
216
+ `;/**
217
+ * @license lucide-static v0.510.0 - ISC
218
+ *
219
+ * This source code is licensed under the ISC license.
220
+ * See the LICENSE file in the root directory of this source tree.
221
+ */const kt=`
222
+ <svg
223
+ class="lucide lucide-copy"
224
+ xmlns="http://www.w3.org/2000/svg"
225
+ width="24"
226
+ height="24"
227
+ viewBox="0 0 24 24"
228
+ fill="none"
229
+ stroke="currentColor"
230
+ stroke-width="2"
231
+ stroke-linecap="round"
232
+ stroke-linejoin="round"
233
+ >
234
+ <rect width="14" height="14" x="8" y="8" rx="2" ry="2" />
235
+ <path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" />
236
+ </svg>
237
+ `;/**
238
+ * @license lucide-static v0.510.0 - ISC
239
+ *
240
+ * This source code is licensed under the ISC license.
241
+ * See the LICENSE file in the root directory of this source tree.
242
+ */const xt=`
243
+ <svg
244
+ class="lucide lucide-ellipsis"
245
+ xmlns="http://www.w3.org/2000/svg"
246
+ width="24"
247
+ height="24"
248
+ viewBox="0 0 24 24"
249
+ fill="none"
250
+ stroke="currentColor"
251
+ stroke-width="2"
252
+ stroke-linecap="round"
253
+ stroke-linejoin="round"
254
+ >
255
+ <circle cx="12" cy="12" r="1" />
256
+ <circle cx="19" cy="12" r="1" />
257
+ <circle cx="5" cy="12" r="1" />
258
+ </svg>
259
+ `;/**
260
+ * @license lucide-static v0.510.0 - ISC
261
+ *
262
+ * This source code is licensed under the ISC license.
263
+ * See the LICENSE file in the root directory of this source tree.
264
+ */const zt=`
265
+ <svg
266
+ class="lucide lucide-info"
267
+ xmlns="http://www.w3.org/2000/svg"
268
+ width="24"
269
+ height="24"
270
+ viewBox="0 0 24 24"
271
+ fill="none"
272
+ stroke="currentColor"
273
+ stroke-width="2"
274
+ stroke-linecap="round"
275
+ stroke-linejoin="round"
276
+ >
277
+ <circle cx="12" cy="12" r="10" />
278
+ <path d="M12 16v-4" />
279
+ <path d="M12 8h.01" />
280
+ </svg>
281
+ `;/**
282
+ * @license lucide-static v0.510.0 - ISC
283
+ *
284
+ * This source code is licensed under the ISC license.
285
+ * See the LICENSE file in the root directory of this source tree.
286
+ */const St=`
287
+ <svg
288
+ class="lucide lucide-pin"
289
+ xmlns="http://www.w3.org/2000/svg"
290
+ width="24"
291
+ height="24"
292
+ viewBox="0 0 24 24"
293
+ fill="none"
294
+ stroke="currentColor"
295
+ stroke-width="2"
296
+ stroke-linecap="round"
297
+ stroke-linejoin="round"
298
+ >
299
+ <path d="M12 17v5" />
300
+ <path d="M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z" />
301
+ </svg>
302
+ `;/**
303
+ * @license lucide-static v0.510.0 - ISC
304
+ *
305
+ * This source code is licensed under the ISC license.
306
+ * See the LICENSE file in the root directory of this source tree.
307
+ */const _t=`
308
+ <svg
309
+ class="lucide lucide-refresh-cw"
310
+ xmlns="http://www.w3.org/2000/svg"
311
+ width="24"
312
+ height="24"
313
+ viewBox="0 0 24 24"
314
+ fill="none"
315
+ stroke="currentColor"
316
+ stroke-width="2"
317
+ stroke-linecap="round"
318
+ stroke-linejoin="round"
319
+ >
320
+ <path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8" />
321
+ <path d="M21 3v5h-5" />
322
+ <path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16" />
323
+ <path d="M8 16H3v5" />
324
+ </svg>
325
+ `;/**
326
+ * @license lucide-static v0.510.0 - ISC
327
+ *
328
+ * This source code is licensed under the ISC license.
329
+ * See the LICENSE file in the root directory of this source tree.
330
+ */const Et=`
331
+ <svg
332
+ class="lucide lucide-shield"
333
+ xmlns="http://www.w3.org/2000/svg"
334
+ width="24"
335
+ height="24"
336
+ viewBox="0 0 24 24"
337
+ fill="none"
338
+ stroke="currentColor"
339
+ stroke-width="2"
340
+ stroke-linecap="round"
341
+ stroke-linejoin="round"
342
+ >
343
+ <path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z" />
344
+ </svg>
345
+ `;/**
346
+ * @license lucide-static v0.510.0 - ISC
347
+ *
348
+ * This source code is licensed under the ISC license.
349
+ * See the LICENSE file in the root directory of this source tree.
350
+ */const Ue=`
351
+ <svg
352
+ class="lucide lucide-square-arrow-out-up-right"
353
+ xmlns="http://www.w3.org/2000/svg"
354
+ width="24"
355
+ height="24"
356
+ viewBox="0 0 24 24"
357
+ fill="none"
358
+ stroke="currentColor"
359
+ stroke-width="2"
360
+ stroke-linecap="round"
361
+ stroke-linejoin="round"
362
+ >
363
+ <path d="M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6" />
364
+ <path d="m21 3-9 9" />
365
+ <path d="M15 3h6v6" />
366
+ </svg>
367
+ `;/**
368
+ * @license lucide-static v0.510.0 - ISC
369
+ *
370
+ * This source code is licensed under the ISC license.
371
+ * See the LICENSE file in the root directory of this source tree.
372
+ */const Ct=`
373
+ <svg
374
+ class="lucide lucide-square-pen"
375
+ xmlns="http://www.w3.org/2000/svg"
376
+ width="24"
377
+ height="24"
378
+ viewBox="0 0 24 24"
379
+ fill="none"
380
+ stroke="currentColor"
381
+ stroke-width="2"
382
+ stroke-linecap="round"
383
+ stroke-linejoin="round"
384
+ >
385
+ <path d="M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" />
386
+ <path d="M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z" />
387
+ </svg>
388
+ `;/**
389
+ * @license lucide-static v0.510.0 - ISC
390
+ *
391
+ * This source code is licensed under the ISC license.
392
+ * See the LICENSE file in the root directory of this source tree.
393
+ */const $t=`
394
+ <svg
395
+ class="lucide lucide-text"
396
+ xmlns="http://www.w3.org/2000/svg"
397
+ width="24"
398
+ height="24"
399
+ viewBox="0 0 24 24"
400
+ fill="none"
401
+ stroke="currentColor"
402
+ stroke-width="2"
403
+ stroke-linecap="round"
404
+ stroke-linejoin="round"
405
+ >
406
+ <path d="M15 18H3" />
407
+ <path d="M17 6H3" />
408
+ <path d="M21 12H3" />
409
+ </svg>
410
+ `;/**
411
+ * @license lucide-static v0.510.0 - ISC
412
+ *
413
+ * This source code is licensed under the ISC license.
414
+ * See the LICENSE file in the root directory of this source tree.
415
+ */const It=`
416
+ <svg
417
+ class="lucide lucide-thumbs-down"
418
+ xmlns="http://www.w3.org/2000/svg"
419
+ width="24"
420
+ height="24"
421
+ viewBox="0 0 24 24"
422
+ fill="none"
423
+ stroke="currentColor"
424
+ stroke-width="2"
425
+ stroke-linecap="round"
426
+ stroke-linejoin="round"
427
+ >
428
+ <path d="M17 14V2" />
429
+ <path d="M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z" />
430
+ </svg>
431
+ `;/**
432
+ * @license lucide-static v0.510.0 - ISC
433
+ *
434
+ * This source code is licensed under the ISC license.
435
+ * See the LICENSE file in the root directory of this source tree.
436
+ */const Rt=`
437
+ <svg
438
+ class="lucide lucide-thumbs-up"
439
+ xmlns="http://www.w3.org/2000/svg"
440
+ width="24"
441
+ height="24"
442
+ viewBox="0 0 24 24"
443
+ fill="none"
444
+ stroke="currentColor"
445
+ stroke-width="2"
446
+ stroke-linecap="round"
447
+ stroke-linejoin="round"
448
+ >
449
+ <path d="M7 10v12" />
450
+ <path d="M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z" />
451
+ </svg>
452
+ `;/**
453
+ * @license lucide-static v0.510.0 - ISC
454
+ *
455
+ * This source code is licensed under the ISC license.
456
+ * See the LICENSE file in the root directory of this source tree.
457
+ */const we={"arrow-up":yt,"arrow-up-right":wt,copy:kt,ellipsis:xt,info:zt,pin:St,"refresh-cw":_t,shield:Et,"square-arrow-out-up-right":Ue,"square-pen":Ct,text:$t,"thumbs-down":It,"thumbs-up":Rt,"trash-2":`
458
+ <svg
459
+ class="lucide lucide-trash-2"
460
+ xmlns="http://www.w3.org/2000/svg"
461
+ width="24"
462
+ height="24"
463
+ viewBox="0 0 24 24"
464
+ fill="none"
465
+ stroke="currentColor"
466
+ stroke-width="2"
467
+ stroke-linecap="round"
468
+ stroke-linejoin="round"
469
+ >
470
+ <path d="M3 6h18" />
471
+ <path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6" />
472
+ <path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2" />
473
+ <line x1="10" x2="10" y1="11" y2="17" />
474
+ <line x1="14" x2="14" y1="11" y2="17" />
475
+ </svg>
476
+ `},Tt=p.css`
477
+ :host {
478
+ display: inline-flex;
479
+ align-items: center;
480
+ justify-content: center;
481
+ box-sizing: border-box;
482
+ }
483
+
484
+ button {
485
+ display: inline-flex;
486
+ box-sizing: border-box;
487
+ flex-shrink: 0;
488
+ align-items: center;
489
+ justify-content: center;
490
+ gap: var(--size-8);
491
+ white-space: nowrap;
492
+ background: none;
493
+ border: 1px solid transparent;
494
+ border-radius: var(--radius-default);
495
+ transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
496
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
497
+ transition-duration: 150ms;
498
+ font-weight: var(--font-weight-medium);
499
+ line-height: var(--lineheight-lg);
500
+ }
501
+
502
+ button:not(:disabled) {
503
+ cursor: pointer;
504
+ }
505
+
506
+ button:focus-visible {
507
+ outline-color: var(--border-focus);
508
+ outline-width: var(--border-width-md);
509
+ outline-style: solid;
510
+ outline-offset: var(--size-2);
511
+ }
512
+
513
+ svg {
514
+ display: block;
515
+ flex-shrink: 0;
516
+ fill: none;
517
+ stroke: currentColor;
518
+ pointer-events: none;
519
+ width: var(--size-24);
520
+ height: var(--size-24);
521
+ stroke-width: 2;
522
+ stroke-linecap: round;
523
+ stroke-linejoin: round;
524
+ }
525
+
526
+ .btn--default {
527
+ height: var(--size-40);
528
+ padding: var(--size-8) var(--size-16);
529
+ }
530
+
531
+ .btn--icon {
532
+ height: var(--size-40);
533
+ width: var(--size-40);
534
+ }
535
+
536
+ .btn--icon-sm {
537
+ height: var(--size-24);
538
+ width: var(--size-24);
539
+ }
540
+
541
+ .btn--icon-sm > svg {
542
+ width: var(--size-16);
543
+ height: var(--size-16);
544
+ }
545
+
546
+ .btn--icon > .btn__text,
547
+ .btn--icon-sm > .btn__text {
548
+ display: none;
549
+ }
550
+
551
+ .btn--primary {
552
+ background-color: var(--surface-action);
553
+ color: var(--text-on-action);
554
+ }
555
+
556
+ .btn--primary > svg {
557
+ color: var(--icon-on-action);
558
+ }
559
+
560
+ .btn--primary:hover {
561
+ background-color: var(--surface-action-hover);
562
+ }
563
+
564
+ .btn--primary:disabled {
565
+ background-color: var(--surface-disabled);
566
+ color: var(--text-disable-selected);
567
+ }
568
+
569
+ .btn--primary:disabled > svg {
570
+ color: var(--icon-on-disabled);
571
+ }
572
+
573
+ .btn--secondary {
574
+ background-color: var(--surface-primary);
575
+ color: var(--text-action);
576
+ border-color: var(--border-action);
577
+ }
578
+
579
+ .btn--secondary > svg {
580
+ color: var(--icon-action);
581
+ }
582
+
583
+ .btn--secondary:hover {
584
+ background-color: var(--surface-action-hover-2);
585
+ color: var(--text-action-hover);
586
+ }
587
+
588
+ .btn--secondary:hover > svg {
589
+ color: var(--icon-action-hover);
590
+ }
591
+
592
+ .btn--secondary:disabled {
593
+ background-color: var(--surface-page);
594
+ color: var(--text-disabled);
595
+ border-color: var(--border-disabled);
596
+ }
597
+
598
+ .btn--secondary:disabled > svg {
599
+ color: var(--icon-on-disabled);
600
+ }
601
+
602
+ .btn--ghost {
603
+ color: var(--text-action);
604
+ }
605
+
606
+ .btn--ghost > svg {
607
+ color: var(--icon-action);
608
+ }
609
+
610
+ .btn--ghost:hover {
611
+ color: var(--text-action-hover);
612
+ }
613
+
614
+ .btn--ghost:hover > svg {
615
+ color: var(--icon-action-hover);
616
+ }
617
+
618
+ .btn--ghost:disabled {
619
+ color: var(--text-disabled);
620
+ }
621
+
622
+ .btn--ghost:disabled > svg {
623
+ color: var(--icon-disabled);
624
+ }
625
+ `;var At=Object.defineProperty,Mt=Object.getOwnPropertyDescriptor,F=(o,e,t,r)=>{for(var n=r>1?void 0:r?Mt(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&At(e,t,n),n};let P=class extends p.LitElement{constructor(){super(...arguments),this.variant="primary",this.size="default",this.disabled=!1,this.icon=void 0}render(){return p.html`
626
+ <button
627
+ ?disabled=${this.disabled}
628
+ class=${N({"btn--primary":this.variant==="primary","btn--secondary":this.variant==="secondary","btn--ghost":this.variant==="ghost","btn--default":this.size==="default","btn--icon":this.size==="icon","btn--icon-sm":this.size==="icon-sm"})}
629
+ >
630
+ ${this.icon?ie.unsafeSVG(we[this.icon]):""}
631
+ <slot class="btn__text"></slot>
632
+ </button>
633
+ `}};P.styles=[Tt],F([g.property({type:String})],P.prototype,"variant",2),F([g.property({type:String})],P.prototype,"size",2),F([g.property({type:Boolean})],P.prototype,"disabled",2),F([g.property({type:String})],P.prototype,"icon",2),P=F([g.customElement("gaia-button")],P);const Ot=p.css`
634
+ .card {
635
+ height: 100%;
636
+ max-height: 100vh;
637
+ display: flex;
638
+ flex-direction: column;
639
+ overflow: hidden;
640
+ }
641
+ `;var Pt=Object.getOwnPropertyDescriptor,Lt=(o,e,t,r)=>{for(var n=r>1?void 0:r?Pt(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=s(n)||n);return n};let ye=class extends p.LitElement{render(){return p.html`
642
+ <div class="card">
643
+ <slot></slot>
644
+ </div>
645
+ `}};ye.styles=[Ot],ye=Lt([g.customElement("gaia-card")],ye);const Dt=p.css`
646
+ :host {
647
+ overflow: hidden;
648
+ display: flex;
649
+ flex: 1 0 0;
650
+ padding: var(--size-8) var(--size-4);
651
+ background-color: var(--surface-primary);
652
+ }
653
+
654
+ @supports selector(::-webkit-scrollbar) {
655
+ .scroller::-webkit-scrollbar-thumb {
656
+ background: var(--icon-disabled);
657
+ border-radius: var(--radius-default);
658
+ cursor: pointer;
659
+ }
660
+ .scroller::-webkit-scrollbar-track {
661
+ background: var(--surface-page);
662
+ }
663
+ .scroller::-webkit-scrollbar-thumb:hover {
664
+ background: var(--icon-on-disabled);
665
+ }
666
+ .scroller::-webkit-scrollbar {
667
+ max-width: var(--size-4);
668
+ max-height: var(--size-4);
669
+ }
670
+ }
671
+
672
+ .scroller {
673
+ width: 100%;
674
+ height: 100%;
675
+ position: relative;
676
+
677
+ &:has(.content) {
678
+ overflow-y: auto;
679
+ overscroll-behavior: contain;
680
+ }
681
+
682
+ .content {
683
+ padding-right: var(--size-8);
684
+ *:first-child {
685
+ margin-top: 0;
686
+ }
687
+ *:last-child {
688
+ margin-bottom: 0;
689
+ }
690
+ }
691
+ }
692
+ `;var Ut=Object.getOwnPropertyDescriptor,Bt=(o,e,t,r)=>{for(var n=r>1?void 0:r?Ut(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=s(n)||n);return n};let ke=class extends p.LitElement{render(){return p.html`
693
+ <div class="scroller">
694
+ <div class="content">
695
+ <slot></slot>
696
+ </div>
697
+ </div>
698
+ `}};ke.styles=[Dt],ke=Bt([g.customElement("gaia-card-content")],ke);const qt=p.css`
699
+ :host {
700
+ background-color: var(--surface-primary);
701
+ }
702
+ .card-footer {
703
+ display: flex;
704
+ align-items: center;
705
+ padding: var(--size-8) var(--size-16) var(--size-16) var(--size-16);
706
+ border: var(--border-width-none);
707
+ }
708
+ `;var Nt=Object.getOwnPropertyDescriptor,Ht=(o,e,t,r)=>{for(var n=r>1?void 0:r?Nt(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=s(n)||n);return n};let xe=class extends p.LitElement{render(){return p.html`
709
+ <div class="card-footer">
710
+ <slot></slot>
711
+ </div>
712
+ `}};xe.styles=[qt],xe=Ht([g.customElement("gaia-card-footer")],xe);const Gt=p.css`
713
+ :host {
714
+ box-sizing: border-box;
715
+ background-color: var(--surface-primary);
716
+ }
717
+
718
+ .card-header {
719
+ display: flex;
720
+ align-items: center;
721
+ justify-content: space-between;
722
+ padding: var(--size-16);
723
+ border-bottom: var(--border-width-sm) solid var(--color-neutral-20);
724
+ }
725
+
726
+ .card-header__title {
727
+ color: var(--text-body);
728
+ font-weight: var(--font-weight-bold);
729
+ }
730
+ `;var Vt=Object.defineProperty,jt=Object.getOwnPropertyDescriptor,Be=(o,e,t,r)=>{for(var n=r>1?void 0:r?jt(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&Vt(e,t,n),n};let se=class extends p.LitElement{constructor(){super(...arguments),this.title=""}render(){return p.html`
731
+ <div class="card-header">
732
+ <div class="card-header__title">${this.title}</div>
733
+ <div class="card-header__actions">
734
+ <slot></slot>
735
+ </div>
736
+ </div>
737
+ `}};se.styles=[Gt],Be([g.property({type:String})],se.prototype,"title",2),se=Be([g.customElement("gaia-card-header")],se);const Ft=p.css`
738
+ :host {
739
+ display: flex;
740
+ flex: 1 1 0;
741
+ flex-direction: row;
742
+ justify-content: space-between;
743
+ align-items: flex-end;
744
+ gap: var(--size-8);
745
+ width: 100%;
746
+ border-radius: var(--radius-default);
747
+ padding: var(--size-8);
748
+ background-color: var(--surface-primary);
749
+ border: var(--border-width-sm) solid var(--border-primary);
750
+ overflow: hidden;
751
+
752
+ --chat-input-height: 24px;
753
+ --chat-input-max-rows: 5;
754
+ }
755
+
756
+ :host:has(textarea:disabled) {
757
+ background-color: var(--surface-disabled);
758
+ border-color: var(--border-disabled);
759
+ }
760
+
761
+ :host:has(textarea:focus-visible) {
762
+ outline: var(--border-width-md) solid var(--border-focus);
763
+ }
764
+
765
+ textarea.chat-input__textarea {
766
+ width: 100%;
767
+ height: var(--chat-input-height);
768
+ max-height: calc(var(--chat-input-height) * var(--chat-input-max-rows));
769
+ padding: 0;
770
+ resize: none;
771
+ border: none;
772
+ outline: none;
773
+ border-radius: 0;
774
+ position: relative;
775
+ font-family: var(--font-family-base);
776
+ font-size: var(--font-size-md);
777
+ line-height: var(--chat-input-height);
778
+ font-weight: var(--font-weight-regular);
779
+ color: var(--text-body);
780
+ background: none;
781
+ }
782
+
783
+ .chat-input__loader {
784
+ height: var(--size-24);
785
+ width: var(--size-24);
786
+ }
787
+
788
+ textarea::placeholder {
789
+ color: var(--text-disabled);
790
+ }
791
+
792
+ textarea:disabled::placeholder {
793
+ color: var(--text-disable-selected);
794
+ }
795
+
796
+ textarea::-webkit-scrollbar-thumb {
797
+ background: var(--icon-disabled);
798
+ border-radius: var(--radius-default);
799
+ cursor: pointer;
800
+ }
801
+ textarea::-webkit-scrollbar-track {
802
+ background: var(--surface-page);
803
+ }
804
+ textarea::-webkit-scrollbar-thumb:hover {
805
+ background: var(--icon-on-disabled);
806
+ }
807
+ textarea::-webkit-scrollbar {
808
+ max-width: var(--size-4);
809
+ max-height: var(--size-4);
810
+ }
811
+ `;var Wt=Object.defineProperty,Zt=Object.getOwnPropertyDescriptor,W=(o,e,t,r)=>{for(var n=r>1?void 0:r?Zt(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&Wt(e,t,n),n};let L=class extends p.LitElement{constructor(){super(...arguments),this.disabled=!1,this.loading=!1,this.isButtonDisabled=!0}getChatInputHeight(){const o=getComputedStyle(this);return Number(o.getPropertyValue("--chat-input-height").trim().replace("px",""))}getChatInputMaxRows(){const o=getComputedStyle(this);return Number(o.getPropertyValue("--chat-input-max-rows").trim())}updateTextareaStyles(){if(!this.textarea)return;const o=this.getChatInputHeight(),e=o*this.getChatInputMaxRows();if(this.textarea.value===""){this.textarea.style.height=`${o}px`;return}this.isButtonDisabled=this.textarea.value==="",this.textarea.style.height=`${this.textarea.scrollHeight}px`,this.textarea.scrollHeight>e?this.textarea.style.overflowY="auto":this.textarea.style.overflowY="hidden"}handleInput(){this.updateTextareaStyles()}handleKeyDown(o){o.key==="Enter"&&!o.shiftKey&&(o.preventDefault(),this.sendMessage())}sendMessage(){!this.textarea||!this.textarea.value||(this.dispatchEvent(new CustomEvent("send-message",{detail:this.textarea.value})),this.textarea.value="",this.updateTextareaStyles())}render(){return p.html`
812
+ <textarea
813
+ class="chat-input__textarea"
814
+ name="message"
815
+ autocomplete="off"
816
+ spellcheck="false"
817
+ placeholder="Ask anything"
818
+ rows="1"
819
+ ?disabled=${this.disabled}
820
+ @input=${this.handleInput}
821
+ @keydown=${this.handleKeyDown}
822
+ ></textarea>
823
+ ${this.loading&&!this.disabled?p.html`<gaia-loader class="chat-input__loader" size="sm"></gaia-loader>`:p.html`<gaia-button
824
+ ?disabled=${this.isButtonDisabled||this.disabled}
825
+ class="chat-input__button"
826
+ size="icon-sm"
827
+ icon="arrow-up"
828
+ @click=${this.sendMessage}
829
+ ></gaia-button>`}
830
+ `}};L.styles=[Ft],W([g.property({type:Boolean,attribute:!1})],L.prototype,"disabled",2),W([g.property({type:Boolean,attribute:!1})],L.prototype,"loading",2),W([g.state()],L.prototype,"isButtonDisabled",2),W([g.query("textarea.chat-input__textarea")],L.prototype,"textarea",2),L=W([g.customElement("gaia-chat-input")],L);function ze(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let D=ze();function qe(o){D=o}const Z={exec:()=>null};function w(o,e=""){let t=typeof o=="string"?o:o.source;const r={replace:(n,i)=>{let s=typeof i=="string"?i:i.source;return s=s.replace(S.caret,"$1"),t=t.replace(n,s),r},getRegex:()=>new RegExp(t,e)};return r}const S={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:o=>new RegExp(`^( {0,3}${o})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:o=>new RegExp(`^ {0,${Math.min(3,o-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:o=>new RegExp(`^ {0,${Math.min(3,o-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:o=>new RegExp(`^ {0,${Math.min(3,o-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:o=>new RegExp(`^ {0,${Math.min(3,o-1)}}#`),htmlBeginRegex:o=>new RegExp(`^ {0,${Math.min(3,o-1)}}<(?:[a-z].*>|!--)`,"i")},Yt=/^(?:[ \t]*(?:\n|$))+/,Qt=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Xt=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Y=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Jt=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Se=/(?:[*+-]|\d{1,9}[.)])/,Ne=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,He=w(Ne).replace(/bull/g,Se).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Kt=w(Ne).replace(/bull/g,Se).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),_e=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,er=/^[^\n]+/,Ee=/(?!\s*\])(?:\\.|[^\[\]\\])+/,tr=w(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ee).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),rr=w(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Se).getRegex(),oe="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Ce=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,nr=w("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Ce).replace("tag",oe).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Ge=w(_e).replace("hr",Y).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",oe).getRegex(),$e={blockquote:w(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Ge).getRegex(),code:Qt,def:tr,fences:Xt,heading:Jt,hr:Y,html:nr,lheading:He,list:rr,newline:Yt,paragraph:Ge,table:Z,text:er},Ve=w("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Y).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",oe).getRegex(),ir={...$e,lheading:Kt,table:Ve,paragraph:w(_e).replace("hr",Y).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Ve).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",oe).getRegex()},sr={...$e,html:w(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ce).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Z,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:w(_e).replace("hr",Y).replace("heading",` *#{1,6} *[^
831
+ ]`).replace("lheading",He).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},or=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ar=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,je=/^( {2,}|\\)\n(?!\s*$)/,lr=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ae=/[\p{P}\p{S}]/u,Ie=/[\s\p{P}\p{S}]/u,Fe=/[^\s\p{P}\p{S}]/u,cr=w(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Ie).getRegex(),We=/(?!~)[\p{P}\p{S}]/u,hr=/(?!~)[\s\p{P}\p{S}]/u,pr=/(?:[^\s\p{P}\p{S}]|~)/u,dr=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,Ze=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,gr=w(Ze,"u").replace(/punct/g,ae).getRegex(),ur=w(Ze,"u").replace(/punct/g,We).getRegex(),Ye="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",fr=w(Ye,"gu").replace(/notPunctSpace/g,Fe).replace(/punctSpace/g,Ie).replace(/punct/g,ae).getRegex(),mr=w(Ye,"gu").replace(/notPunctSpace/g,pr).replace(/punctSpace/g,hr).replace(/punct/g,We).getRegex(),vr=w("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Fe).replace(/punctSpace/g,Ie).replace(/punct/g,ae).getRegex(),br=w(/\\(punct)/,"gu").replace(/punct/g,ae).getRegex(),wr=w(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),yr=w(Ce).replace("(?:-->|$)","-->").getRegex(),kr=w("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",yr).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),le=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,xr=w(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",le).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Qe=w(/^!?\[(label)\]\[(ref)\]/).replace("label",le).replace("ref",Ee).getRegex(),Xe=w(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ee).getRegex(),zr=w("reflink|nolink(?!\\()","g").replace("reflink",Qe).replace("nolink",Xe).getRegex(),Re={_backpedal:Z,anyPunctuation:br,autolink:wr,blockSkip:dr,br:je,code:ar,del:Z,emStrongLDelim:gr,emStrongRDelimAst:fr,emStrongRDelimUnd:vr,escape:or,link:xr,nolink:Xe,punctuation:cr,reflink:Qe,reflinkSearch:zr,tag:kr,text:lr,url:Z},Sr={...Re,link:w(/^!?\[(label)\]\((.*?)\)/).replace("label",le).getRegex(),reflink:w(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",le).getRegex()},Te={...Re,emStrongRDelimAst:mr,emStrongLDelim:ur,url:w(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},_r={...Te,br:w(je).replace("{2,}","*").getRegex(),text:w(Te.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ce={normal:$e,gfm:ir,pedantic:sr},Q={normal:Re,gfm:Te,breaks:_r,pedantic:Sr},Er={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Je=o=>Er[o];function R(o,e){if(e){if(S.escapeTest.test(o))return o.replace(S.escapeReplace,Je)}else if(S.escapeTestNoEncode.test(o))return o.replace(S.escapeReplaceNoEncode,Je);return o}function Ke(o){try{o=encodeURI(o).replace(S.percentDecode,"%")}catch{return null}return o}function et(o,e){var i;const t=o.replace(S.findPipe,(s,a,h)=>{let c=!1,l=a;for(;--l>=0&&h[l]==="\\";)c=!c;return c?"|":" |"}),r=t.split(S.splitPipe);let n=0;if(r[0].trim()||r.shift(),r.length>0&&!((i=r.at(-1))!=null&&i.trim())&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;n<r.length;n++)r[n]=r[n].trim().replace(S.slashPipe,"|");return r}function X(o,e,t){const r=o.length;if(r===0)return"";let n=0;for(;n<r&&o.charAt(r-n-1)===e;)n++;return o.slice(0,r-n)}function Cr(o,e){if(o.indexOf(e[1])===-1)return-1;let t=0;for(let r=0;r<o.length;r++)if(o[r]==="\\")r++;else if(o[r]===e[0])t++;else if(o[r]===e[1]&&(t--,t<0))return r;return t>0?-2:-1}function tt(o,e,t,r,n){const i=e.href,s=e.title||null,a=o[1].replace(n.other.outputLinkReplace,"$1");r.state.inLink=!0;const h={type:o[0].charAt(0)==="!"?"image":"link",raw:t,href:i,title:s,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,h}function $r(o,e,t){const r=o.match(t.other.indentCodeCompensation);if(r===null)return e;const n=r[1];return e.split(`
832
+ `).map(i=>{const s=i.match(t.other.beginningSpace);if(s===null)return i;const[a]=s;return a.length>=n.length?i.slice(n.length):i}).join(`
833
+ `)}class he{constructor(e){y(this,"options");y(this,"rules");y(this,"lexer");this.options=e||D}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const r=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?r:X(r,`
834
+ `)}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const r=t[0],n=$r(r,t[3]||"",this.rules);return{type:"code",raw:r,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let r=t[2].trim();if(this.rules.other.endingHash.test(r)){const n=X(r,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceChar.test(n))&&(r=n.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:X(t[0],`
835
+ `)}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let r=X(t[0],`
836
+ `).split(`
837
+ `),n="",i="";const s=[];for(;r.length>0;){let a=!1;const h=[];let c;for(c=0;c<r.length;c++)if(this.rules.other.blockquoteStart.test(r[c]))h.push(r[c]),a=!0;else if(!a)h.push(r[c]);else break;r=r.slice(c);const l=h.join(`
838
+ `),u=l.replace(this.rules.other.blockquoteSetextReplace,`
839
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n}
840
+ ${l}`:l,i=i?`${i}
841
+ ${u}`:u;const f=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,s,!0),this.lexer.state.top=f,r.length===0)break;const m=s.at(-1);if((m==null?void 0:m.type)==="code")break;if((m==null?void 0:m.type)==="blockquote"){const x=m,k=x.raw+`
842
+ `+r.join(`
843
+ `),I=this.blockquote(k);s[s.length-1]=I,n=n.substring(0,n.length-x.raw.length)+I.raw,i=i.substring(0,i.length-x.text.length)+I.text;break}else if((m==null?void 0:m.type)==="list"){const x=m,k=x.raw+`
844
+ `+r.join(`
845
+ `),I=this.list(k);s[s.length-1]=I,n=n.substring(0,n.length-m.raw.length)+I.raw,i=i.substring(0,i.length-x.raw.length)+I.raw,r=k.substring(s.at(-1).raw.length).split(`
846
+ `);continue}}return{type:"blockquote",raw:n,tokens:s,text:i}}}list(e){let t=this.rules.block.list.exec(e);if(t){let r=t[1].trim();const n=r.length>1,i={type:"list",raw:"",ordered:n,start:n?+r.slice(0,-1):"",loose:!1,items:[]};r=n?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=n?r:"[*+-]");const s=this.rules.other.listItemRegex(r);let a=!1;for(;e;){let c=!1,l="",u="";if(!(t=s.exec(e))||this.rules.block.hr.test(e))break;l=t[0],e=e.substring(l.length);let f=t[2].split(`
847
+ `,1)[0].replace(this.rules.other.listReplaceTabs,Oe=>" ".repeat(3*Oe.length)),m=e.split(`
848
+ `,1)[0],x=!f.trim(),k=0;if(this.options.pedantic?(k=2,u=f.trimStart()):x?k=t[1].length+1:(k=t[2].search(this.rules.other.nonSpaceChar),k=k>4?1:k,u=f.slice(k),k+=t[1].length),x&&this.rules.other.blankLine.test(m)&&(l+=m+`
849
+ `,e=e.substring(m.length+1),c=!0),!c){const Oe=this.rules.other.nextBulletRegex(k),ht=this.rules.other.hrRegex(k),pt=this.rules.other.fencesBeginRegex(k),dt=this.rules.other.headingBeginRegex(k),wn=this.rules.other.htmlBeginRegex(k);for(;e;){const Pe=e.split(`
850
+ `,1)[0];let ne;if(m=Pe,this.options.pedantic?(m=m.replace(this.rules.other.listReplaceNesting," "),ne=m):ne=m.replace(this.rules.other.tabCharGlobal," "),pt.test(m)||dt.test(m)||wn.test(m)||Oe.test(m)||ht.test(m))break;if(ne.search(this.rules.other.nonSpaceChar)>=k||!m.trim())u+=`
851
+ `+ne.slice(k);else{if(x||f.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||pt.test(f)||dt.test(f)||ht.test(f))break;u+=`
852
+ `+m}!x&&!m.trim()&&(x=!0),l+=Pe+`
853
+ `,e=e.substring(Pe.length+1),f=ne.slice(k)}}i.loose||(a?i.loose=!0:this.rules.other.doubleBlankLine.test(l)&&(a=!0));let I=null,ct;this.options.gfm&&(I=this.rules.other.listIsTask.exec(u),I&&(ct=I[0]!=="[ ] ",u=u.replace(this.rules.other.listReplaceTask,""))),i.items.push({type:"list_item",raw:l,task:!!I,checked:ct,loose:!1,text:u,tokens:[]}),i.raw+=l}const h=i.items.at(-1);if(h)h.raw=h.raw.trimEnd(),h.text=h.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let c=0;c<i.items.length;c++)if(this.lexer.state.top=!1,i.items[c].tokens=this.lexer.blockTokens(i.items[c].text,[]),!i.loose){const l=i.items[c].tokens.filter(f=>f.type==="space"),u=l.length>0&&l.some(f=>this.rules.other.anyLine.test(f.raw));i.loose=u}if(i.loose)for(let c=0;c<i.items.length;c++)i.items[c].loose=!0;return i}}html(e){const t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){const t=this.rules.block.def.exec(e);if(t){const r=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:r,raw:t[0],href:n,title:i}}}table(e){var a;const t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;const r=et(t[1]),n=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=(a=t[3])!=null&&a.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
854
+ `):[],s={type:"table",raw:t[0],header:[],align:[],rows:[]};if(r.length===n.length){for(const h of n)this.rules.other.tableAlignRight.test(h)?s.align.push("right"):this.rules.other.tableAlignCenter.test(h)?s.align.push("center"):this.rules.other.tableAlignLeft.test(h)?s.align.push("left"):s.align.push(null);for(let h=0;h<r.length;h++)s.header.push({text:r[h],tokens:this.lexer.inline(r[h]),header:!0,align:s.align[h]});for(const h of i)s.rows.push(et(h,s.header.length).map((c,l)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:s.align[l]})));return s}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const r=t[1].charAt(t[1].length-1)===`
855
+ `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:r,tokens:this.lexer.inline(r)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const r=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;const s=X(r.slice(0,-1),"\\");if((r.length-s.length)%2===0)return}else{const s=Cr(t[2],"()");if(s===-2)return;if(s>-1){const h=(t[0].indexOf("!")===0?5:4)+t[1].length+s;t[2]=t[2].substring(0,s),t[0]=t[0].substring(0,h).trim(),t[3]=""}}let n=t[2],i="";if(this.options.pedantic){const s=this.rules.other.pedanticHrefTitle.exec(n);s&&(n=s[1],i=s[3])}else i=t[3]?t[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?n=n.slice(1):n=n.slice(1,-1)),tt(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let r;if((r=this.rules.inline.reflink.exec(e))||(r=this.rules.inline.nolink.exec(e))){const n=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=t[n.toLowerCase()];if(!i){const s=r[0].charAt(0);return{type:"text",raw:s,text:s}}return tt(r,i,r[0],this.lexer,this.rules)}}emStrong(e,t,r=""){let n=this.rules.inline.emStrongLDelim.exec(e);if(!n||n[3]&&r.match(this.rules.other.unicodeAlphaNumeric))return;if(!(n[1]||n[2]||"")||!r||this.rules.inline.punctuation.exec(r)){const s=[...n[0]].length-1;let a,h,c=s,l=0;const u=n[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,t=t.slice(-1*e.length+s);(n=u.exec(t))!=null;){if(a=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!a)continue;if(h=[...a].length,n[3]||n[4]){c+=h;continue}else if((n[5]||n[6])&&s%3&&!((s+h)%3)){l+=h;continue}if(c-=h,c>0)continue;h=Math.min(h,h+c+l);const f=[...n[0]][0].length,m=e.slice(0,s+n.index+f+h);if(Math.min(s,h)%2){const k=m.slice(1,-1);return{type:"em",raw:m,text:k,tokens:this.lexer.inlineTokens(k)}}const x=m.slice(2,-2);return{type:"strong",raw:m,text:x,tokens:this.lexer.inlineTokens(x)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let r=t[2].replace(this.rules.other.newLineCharGlobal," ");const n=this.rules.other.nonSpaceChar.test(r),i=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return n&&i&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:t[0],text:r}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let r,n;return t[2]==="@"?(r=t[1],n="mailto:"+r):(r=t[1],n=r),{type:"link",raw:t[0],text:r,href:n,tokens:[{type:"text",raw:r,text:r}]}}}url(e){var r;let t;if(t=this.rules.inline.url.exec(e)){let n,i;if(t[2]==="@")n=t[0],i="mailto:"+n;else{let s;do s=t[0],t[0]=((r=this.rules.inline._backpedal.exec(t[0]))==null?void 0:r[0])??"";while(s!==t[0]);n=t[0],t[1]==="www."?i="http://"+t[0]:i=t[0]}return{type:"link",raw:t[0],text:n,href:i,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){const r=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:r}}}}class C{constructor(e){y(this,"tokens");y(this,"options");y(this,"state");y(this,"tokenizer");y(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||D,this.options.tokenizer=this.options.tokenizer||new he,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={other:S,block:ce.normal,inline:Q.normal};this.options.pedantic?(t.block=ce.pedantic,t.inline=Q.pedantic):this.options.gfm&&(t.block=ce.gfm,this.options.breaks?t.inline=Q.breaks:t.inline=Q.gfm),this.tokenizer.rules=t}static get rules(){return{block:ce,inline:Q}}static lex(e,t){return new C(t).lex(e)}static lexInline(e,t){return new C(t).inlineTokens(e)}lex(e){e=e.replace(S.carriageReturn,`
856
+ `),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){const r=this.inlineQueue[t];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],r=!1){var n,i,s;for(this.options.pedantic&&(e=e.replace(S.tabCharGlobal," ").replace(S.spaceLine,""));e;){let a;if((i=(n=this.options.extensions)==null?void 0:n.block)!=null&&i.some(c=>(a=c.call({lexer:this},e,t))?(e=e.substring(a.raw.length),t.push(a),!0):!1))continue;if(a=this.tokenizer.space(e)){e=e.substring(a.raw.length);const c=t.at(-1);a.raw.length===1&&c!==void 0?c.raw+=`
857
+ `:t.push(a);continue}if(a=this.tokenizer.code(e)){e=e.substring(a.raw.length);const c=t.at(-1);(c==null?void 0:c.type)==="paragraph"||(c==null?void 0:c.type)==="text"?(c.raw+=`
858
+ `+a.raw,c.text+=`
859
+ `+a.text,this.inlineQueue.at(-1).src=c.text):t.push(a);continue}if(a=this.tokenizer.fences(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.heading(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.hr(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.blockquote(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.list(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.html(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.def(e)){e=e.substring(a.raw.length);const c=t.at(-1);(c==null?void 0:c.type)==="paragraph"||(c==null?void 0:c.type)==="text"?(c.raw+=`
860
+ `+a.raw,c.text+=`
861
+ `+a.raw,this.inlineQueue.at(-1).src=c.text):this.tokens.links[a.tag]||(this.tokens.links[a.tag]={href:a.href,title:a.title});continue}if(a=this.tokenizer.table(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.lheading(e)){e=e.substring(a.raw.length),t.push(a);continue}let h=e;if((s=this.options.extensions)!=null&&s.startBlock){let c=1/0;const l=e.slice(1);let u;this.options.extensions.startBlock.forEach(f=>{u=f.call({lexer:this},l),typeof u=="number"&&u>=0&&(c=Math.min(c,u))}),c<1/0&&c>=0&&(h=e.substring(0,c+1))}if(this.state.top&&(a=this.tokenizer.paragraph(h))){const c=t.at(-1);r&&(c==null?void 0:c.type)==="paragraph"?(c.raw+=`
862
+ `+a.raw,c.text+=`
863
+ `+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):t.push(a),r=h.length!==e.length,e=e.substring(a.raw.length);continue}if(a=this.tokenizer.text(e)){e=e.substring(a.raw.length);const c=t.at(-1);(c==null?void 0:c.type)==="text"?(c.raw+=`
864
+ `+a.raw,c.text+=`
865
+ `+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):t.push(a);continue}if(e){const c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){var a,h,c;let r=e,n=null;if(this.tokens.links){const l=Object.keys(this.tokens.links);if(l.length>0)for(;(n=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)l.includes(n[0].slice(n[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,n.index)+"["+"a".repeat(n[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(n=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,n.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(n=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)r=r.slice(0,n.index)+"["+"a".repeat(n[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let i=!1,s="";for(;e;){i||(s=""),i=!1;let l;if((h=(a=this.options.extensions)==null?void 0:a.inline)!=null&&h.some(f=>(l=f.call({lexer:this},e,t))?(e=e.substring(l.raw.length),t.push(l),!0):!1))continue;if(l=this.tokenizer.escape(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.tag(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.link(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(l.raw.length);const f=t.at(-1);l.type==="text"&&(f==null?void 0:f.type)==="text"?(f.raw+=l.raw,f.text+=l.text):t.push(l);continue}if(l=this.tokenizer.emStrong(e,r,s)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.codespan(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.br(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.del(e)){e=e.substring(l.raw.length),t.push(l);continue}if(l=this.tokenizer.autolink(e)){e=e.substring(l.raw.length),t.push(l);continue}if(!this.state.inLink&&(l=this.tokenizer.url(e))){e=e.substring(l.raw.length),t.push(l);continue}let u=e;if((c=this.options.extensions)!=null&&c.startInline){let f=1/0;const m=e.slice(1);let x;this.options.extensions.startInline.forEach(k=>{x=k.call({lexer:this},m),typeof x=="number"&&x>=0&&(f=Math.min(f,x))}),f<1/0&&f>=0&&(u=e.substring(0,f+1))}if(l=this.tokenizer.inlineText(u)){e=e.substring(l.raw.length),l.raw.slice(-1)!=="_"&&(s=l.raw.slice(-1)),i=!0;const f=t.at(-1);(f==null?void 0:f.type)==="text"?(f.raw+=l.raw,f.text+=l.text):t.push(l);continue}if(e){const f="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(f);break}else throw new Error(f)}}return t}}class pe{constructor(e){y(this,"options");y(this,"parser");this.options=e||D}space(e){return""}code({text:e,lang:t,escaped:r}){var s;const n=(s=(t||"").match(S.notSpaceStart))==null?void 0:s[0],i=e.replace(S.endingNewline,"")+`
866
+ `;return n?'<pre><code class="language-'+R(n)+'">'+(r?i:R(i,!0))+`</code></pre>
867
+ `:"<pre><code>"+(r?i:R(i,!0))+`</code></pre>
868
+ `}blockquote({tokens:e}){return`<blockquote>
869
+ ${this.parser.parse(e)}</blockquote>
870
+ `}html({text:e}){return e}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
871
+ `}hr(e){return`<hr>
872
+ `}list(e){const t=e.ordered,r=e.start;let n="";for(let a=0;a<e.items.length;a++){const h=e.items[a];n+=this.listitem(h)}const i=t?"ol":"ul",s=t&&r!==1?' start="'+r+'"':"";return"<"+i+s+`>
873
+ `+n+"</"+i+`>
874
+ `}listitem(e){var r;let t="";if(e.task){const n=this.checkbox({checked:!!e.checked});e.loose?((r=e.tokens[0])==null?void 0:r.type)==="paragraph"?(e.tokens[0].text=n+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=n+" "+R(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:n+" ",text:n+" ",escaped:!0}):t+=n+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
875
+ `}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
876
+ `}table(e){let t="",r="";for(let i=0;i<e.header.length;i++)r+=this.tablecell(e.header[i]);t+=this.tablerow({text:r});let n="";for(let i=0;i<e.rows.length;i++){const s=e.rows[i];r="";for(let a=0;a<s.length;a++)r+=this.tablecell(s[a]);n+=this.tablerow({text:r})}return n&&(n=`<tbody>${n}</tbody>`),`<table>
877
+ <thead>
878
+ `+t+`</thead>
879
+ `+n+`</table>
880
+ `}tablerow({text:e}){return`<tr>
881
+ ${e}</tr>
882
+ `}tablecell(e){const t=this.parser.parseInline(e.tokens),r=e.header?"th":"td";return(e.align?`<${r} align="${e.align}">`:`<${r}>`)+t+`</${r}>
883
+ `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${R(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:r}){const n=this.parser.parseInline(r),i=Ke(e);if(i===null)return n;e=i;let s='<a href="'+e+'"';return t&&(s+=' title="'+R(t)+'"'),s+=">"+n+"</a>",s}image({href:e,title:t,text:r,tokens:n}){n&&(r=this.parser.parseInline(n,this.parser.textRenderer));const i=Ke(e);if(i===null)return R(r);e=i;let s=`<img src="${e}" alt="${r}"`;return t&&(s+=` title="${R(t)}"`),s+=">",s}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:R(e.text)}}class Ae{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}}class ${constructor(e){y(this,"options");y(this,"renderer");y(this,"textRenderer");this.options=e||D,this.options.renderer=this.options.renderer||new pe,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Ae}static parse(e,t){return new $(t).parse(e)}static parseInline(e,t){return new $(t).parseInline(e)}parse(e,t=!0){var n,i;let r="";for(let s=0;s<e.length;s++){const a=e[s];if((i=(n=this.options.extensions)==null?void 0:n.renderers)!=null&&i[a.type]){const c=a,l=this.options.extensions.renderers[c.type].call({parser:this},c);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(c.type)){r+=l||"";continue}}const h=a;switch(h.type){case"space":{r+=this.renderer.space(h);continue}case"hr":{r+=this.renderer.hr(h);continue}case"heading":{r+=this.renderer.heading(h);continue}case"code":{r+=this.renderer.code(h);continue}case"table":{r+=this.renderer.table(h);continue}case"blockquote":{r+=this.renderer.blockquote(h);continue}case"list":{r+=this.renderer.list(h);continue}case"html":{r+=this.renderer.html(h);continue}case"paragraph":{r+=this.renderer.paragraph(h);continue}case"text":{let c=h,l=this.renderer.text(c);for(;s+1<e.length&&e[s+1].type==="text";)c=e[++s],l+=`
884
+ `+this.renderer.text(c);t?r+=this.renderer.paragraph({type:"paragraph",raw:l,text:l,tokens:[{type:"text",raw:l,text:l,escaped:!0}]}):r+=l;continue}default:{const c='Token with "'+h.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return r}parseInline(e,t=this.renderer){var n,i;let r="";for(let s=0;s<e.length;s++){const a=e[s];if((i=(n=this.options.extensions)==null?void 0:n.renderers)!=null&&i[a.type]){const c=this.options.extensions.renderers[a.type].call({parser:this},a);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){r+=c||"";continue}}const h=a;switch(h.type){case"escape":{r+=t.text(h);break}case"html":{r+=t.html(h);break}case"link":{r+=t.link(h);break}case"image":{r+=t.image(h);break}case"strong":{r+=t.strong(h);break}case"em":{r+=t.em(h);break}case"codespan":{r+=t.codespan(h);break}case"br":{r+=t.br(h);break}case"del":{r+=t.del(h);break}case"text":{r+=t.text(h);break}default:{const c='Token with "'+h.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return r}}class J{constructor(e){y(this,"options");y(this,"block");this.options=e||D}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?C.lex:C.lexInline}provideParser(){return this.block?$.parse:$.parseInline}}y(J,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class Ir{constructor(...e){y(this,"defaults",ze());y(this,"options",this.setOptions);y(this,"parse",this.parseMarkdown(!0));y(this,"parseInline",this.parseMarkdown(!1));y(this,"Parser",$);y(this,"Renderer",pe);y(this,"TextRenderer",Ae);y(this,"Lexer",C);y(this,"Tokenizer",he);y(this,"Hooks",J);this.use(...e)}walkTokens(e,t){var n,i;let r=[];for(const s of e)switch(r=r.concat(t.call(this,s)),s.type){case"table":{const a=s;for(const h of a.header)r=r.concat(this.walkTokens(h.tokens,t));for(const h of a.rows)for(const c of h)r=r.concat(this.walkTokens(c.tokens,t));break}case"list":{const a=s;r=r.concat(this.walkTokens(a.items,t));break}default:{const a=s;(i=(n=this.defaults.extensions)==null?void 0:n.childTokens)!=null&&i[a.type]?this.defaults.extensions.childTokens[a.type].forEach(h=>{const c=a[h].flat(1/0);r=r.concat(this.walkTokens(c,t))}):a.tokens&&(r=r.concat(this.walkTokens(a.tokens,t)))}}return r}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(r=>{const n={...r};if(n.async=this.defaults.async||n.async||!1,r.extensions&&(r.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){const s=t.renderers[i.name];s?t.renderers[i.name]=function(...a){let h=i.renderer.apply(this,a);return h===!1&&(h=s.apply(this,a)),h}:t.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const s=t[i.level];s?s.unshift(i.tokenizer):t[i.level]=[i.tokenizer],i.start&&(i.level==="block"?t.startBlock?t.startBlock.push(i.start):t.startBlock=[i.start]:i.level==="inline"&&(t.startInline?t.startInline.push(i.start):t.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(t.childTokens[i.name]=i.childTokens)}),n.extensions=t),r.renderer){const i=this.defaults.renderer||new pe(this.defaults);for(const s in r.renderer){if(!(s in i))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;const a=s,h=r.renderer[a],c=i[a];i[a]=(...l)=>{let u=h.apply(i,l);return u===!1&&(u=c.apply(i,l)),u||""}}n.renderer=i}if(r.tokenizer){const i=this.defaults.tokenizer||new he(this.defaults);for(const s in r.tokenizer){if(!(s in i))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;const a=s,h=r.tokenizer[a],c=i[a];i[a]=(...l)=>{let u=h.apply(i,l);return u===!1&&(u=c.apply(i,l)),u}}n.tokenizer=i}if(r.hooks){const i=this.defaults.hooks||new J;for(const s in r.hooks){if(!(s in i))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;const a=s,h=r.hooks[a],c=i[a];J.passThroughHooks.has(s)?i[a]=l=>{if(this.defaults.async)return Promise.resolve(h.call(i,l)).then(f=>c.call(i,f));const u=h.call(i,l);return c.call(i,u)}:i[a]=(...l)=>{let u=h.apply(i,l);return u===!1&&(u=c.apply(i,l)),u}}n.hooks=i}if(r.walkTokens){const i=this.defaults.walkTokens,s=r.walkTokens;n.walkTokens=function(a){let h=[];return h.push(s.call(this,a)),i&&(h=h.concat(i.call(this,a))),h}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return C.lex(e,t??this.defaults)}parser(e,t){return $.parse(e,t??this.defaults)}parseMarkdown(e){return(r,n)=>{const i={...n},s={...this.defaults,...i},a=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&i.async===!1)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof r>"u"||r===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof r!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));s.hooks&&(s.hooks.options=s,s.hooks.block=e);const h=s.hooks?s.hooks.provideLexer():e?C.lex:C.lexInline,c=s.hooks?s.hooks.provideParser():e?$.parse:$.parseInline;if(s.async)return Promise.resolve(s.hooks?s.hooks.preprocess(r):r).then(l=>h(l,s)).then(l=>s.hooks?s.hooks.processAllTokens(l):l).then(l=>s.walkTokens?Promise.all(this.walkTokens(l,s.walkTokens)).then(()=>l):l).then(l=>c(l,s)).then(l=>s.hooks?s.hooks.postprocess(l):l).catch(a);try{s.hooks&&(r=s.hooks.preprocess(r));let l=h(r,s);s.hooks&&(l=s.hooks.processAllTokens(l)),s.walkTokens&&this.walkTokens(l,s.walkTokens);let u=c(l,s);return s.hooks&&(u=s.hooks.postprocess(u)),u}catch(l){return a(l)}}}onError(e,t){return r=>{if(r.message+=`
885
+ Please report this to https://github.com/markedjs/marked.`,e){const n="<p>An error occurred:</p><pre>"+R(r.message+"",!0)+"</pre>";return t?Promise.resolve(n):n}if(t)return Promise.reject(r);throw r}}}const U=new Ir;function v(o,e){return U.parse(o,e)}v.options=v.setOptions=function(o){return U.setOptions(o),v.defaults=U.defaults,qe(v.defaults),v},v.getDefaults=ze,v.defaults=D,v.use=function(...o){return U.use(...o),v.defaults=U.defaults,qe(v.defaults),v},v.walkTokens=function(o,e){return U.walkTokens(o,e)},v.parseInline=U.parseInline,v.Parser=$,v.parser=$.parse,v.Renderer=pe,v.TextRenderer=Ae,v.Lexer=C,v.lexer=C.lex,v.Tokenizer=he,v.Hooks=J,v.parse=v,v.options,v.setOptions,v.use,v.walkTokens,v.parseInline,$.parse,C.lex;class Rr extends CustomEvent{constructor(e,t){super("action-approval",{detail:{messageId:e,isApproved:t}})}}function Tr(o){return o.role==="user"}function Ar(o){return o.role==="assistant"}function Mr(o){return o.role==="system"}function Or(o){return o.role==="visitor"}function Pr(o){return o.role==="operator"}const Lr=p.css`
886
+ :host {
887
+ display: block;
888
+ width: 100%;
889
+ color: var(--text-body);
890
+ box-sizing: border-box;
891
+ }
892
+
893
+ .message {
894
+ display: flex;
895
+ flex-direction: row;
896
+ position: relative;
897
+ padding: var(--size-8) 0;
898
+ max-width: 100%;
899
+ }
900
+
901
+ .button-group {
902
+ display: flex;
903
+ flex-direction: row;
904
+ height: 100%;
905
+ gap: var(--size-4);
906
+ align-items: center;
907
+ padding-top: var(--size-8);
908
+ }
909
+
910
+ .message__content--left {
911
+ display: inline-flex;
912
+ align-items: flex-start;
913
+ justify-content: center;
914
+ width: var(--size-24);
915
+ padding: var(--size-6) var(--size-0) var(--size-4) var(--size-0);
916
+ flex-shrink: 0;
917
+ }
918
+
919
+ .message__content--right {
920
+ display: flex;
921
+ flex-direction: column;
922
+ height: 100%;
923
+ border-radius: var(--radius-default);
924
+ padding: var(--size-8);
925
+ overflow: hidden;
926
+ }
927
+
928
+ .message--user {
929
+ justify-content: flex-end;
930
+ }
931
+
932
+ .message--user > .message__content--right {
933
+ background-color: var(--color-neutral-10);
934
+ }
935
+
936
+ .message--assistant {
937
+ align-self: flex-start;
938
+ padding-left: var(--size-16);
939
+ }
940
+
941
+ .message--system {
942
+ justify-content: center;
943
+ min-width: 100px;
944
+ }
945
+
946
+ .message--system .message__content--right .markdown {
947
+ font-size: var(--font-size-xs);
948
+ line-height: var(--lineheight-xs);
949
+ font-weight: var(--font-weight-regular);
950
+ letter-spacing: var(--tracking-xs);
951
+ color: var(--text-body);
952
+ text-align: center;
953
+ }
954
+
955
+ .message--system.status--warning > .message__content--right {
956
+ background-color: #fcf0e7;
957
+ border: 1px solid #bb5822;
958
+ }
959
+
960
+ .message--system.status--info > .message__content--right {
961
+ background-color: #edf4fe;
962
+ border: 1px solid #366af6;
963
+ }
964
+
965
+ .message--system.status--success > .message__content--right {
966
+ background-color: #eef5ee;
967
+ border: 1px solid #448548;
968
+ }
969
+
970
+ .message--system.status--error > .message__content--right {
971
+ background-color: #fcf1ee;
972
+ border: 1px solid #cc453e;
973
+ }
974
+
975
+ .message__citations {
976
+ display: flex;
977
+ flex-direction: column;
978
+ align-items: flex-start;
979
+ padding-top: var(--size-8);
980
+ gap: var(--size-4);
981
+ }
982
+
983
+ .citation {
984
+ display: flex;
985
+ padding: 0 var(--size-2);
986
+ transition-property: color, fill, stroke;
987
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
988
+ transition-duration: 150ms;
989
+ }
990
+
991
+ .citation a {
992
+ display: flex;
993
+ flex-direction: row;
994
+ align-items: center;
995
+ gap: var(--size-4);
996
+ font-size: var(--font-size-sm);
997
+ line-height: var(--lineheight-sm);
998
+ font-weight: var(--font-weight-regular);
999
+ letter-spacing: var(--tracking-sm);
1000
+ color: var(--text-action);
1001
+ text-decoration: none;
1002
+ transition-property: inherit;
1003
+ transition-timing-function: inherit;
1004
+ transition-duration: inherit;
1005
+ }
1006
+
1007
+ .citation a > svg {
1008
+ color: var(--icon-action);
1009
+ width: var(--size-16);
1010
+ height: var(--size-16);
1011
+ flex-shrink: 0;
1012
+ transition-property: inherit;
1013
+ transition-timing-function: inherit;
1014
+ transition-duration: inherit;
1015
+ }
1016
+
1017
+ .citation:hover a {
1018
+ color: var(--text-action-hover);
1019
+ }
1020
+
1021
+ .citation:hover a > svg {
1022
+ color: var(--icon-action-hover);
1023
+ }
1024
+ `,Dr=p.css`
1025
+ .markdown {
1026
+ color: var(--text-body);
1027
+ font-size: var(--font-size-md);
1028
+ line-height: var(--lineheight-md);
1029
+ letter-spacing: var(--tracking-md);
1030
+ font-weight: var(--font-weight-regular);
1031
+
1032
+ overflow-x: hidden;
1033
+ overflow-wrap: break-word;
1034
+ }
1035
+
1036
+ .markdown > pre {
1037
+ white-space: pre-wrap;
1038
+ }
1039
+ .markdown {
1040
+ color: var(--text-body);
1041
+ }
1042
+
1043
+ .markdown > *::-webkit-scrollbar-thumb {
1044
+ background: var(--icon-disabled);
1045
+ border-radius: var(--radius-default);
1046
+ cursor: pointer;
1047
+ }
1048
+ .markdown > *::-webkit-scrollbar-track {
1049
+ background: var(--surface-page);
1050
+ }
1051
+ .markdown > *::-webkit-scrollbar-thumb:hover {
1052
+ background: var(--icon-on-disabled);
1053
+ }
1054
+ .markdown > *::-webkit-scrollbar {
1055
+ max-width: var(--size-4);
1056
+ max-height: var(--size-4);
1057
+ }
1058
+
1059
+ .markdown :where(p) {
1060
+ margin-top: var(--size-16);
1061
+ margin-bottom: var(--size-16);
1062
+ }
1063
+ .markdown :where(a) {
1064
+ font-weight: var(--font-weight-semibold);
1065
+ color: var(--text-action);
1066
+ text-decoration: none;
1067
+ }
1068
+ .markdown :where(a:hover) {
1069
+ color: var(--text-action-hover);
1070
+ }
1071
+ .markdown :where(a:visited) {
1072
+ color: var(--text-link-visited);
1073
+ }
1074
+ .markdown :where(strong) {
1075
+ color: var(--text-headings);
1076
+ font-weight: var(--font-weight-semibold);
1077
+ }
1078
+ .markdown :where(a strong) {
1079
+ color: inherit;
1080
+ }
1081
+ .markdown :where(blockquote strong) {
1082
+ color: inherit;
1083
+ }
1084
+ .markdown :where(thead th strong) {
1085
+ color: inherit;
1086
+ }
1087
+ .markdown :where(ol) {
1088
+ list-style-type: decimal;
1089
+ margin-top: var(--size-16);
1090
+ margin-bottom: var(--size-16);
1091
+ padding-inline-start: var(--size-28);
1092
+ }
1093
+ .markdown :where(ol[type='A']) {
1094
+ list-style-type: upper-alpha;
1095
+ }
1096
+ .markdown :where(ol[type='a']) {
1097
+ list-style-type: lower-alpha;
1098
+ }
1099
+ .markdown :where(ol[type='A s']) {
1100
+ list-style-type: upper-alpha;
1101
+ }
1102
+ .markdown :where(ol[type='a s']) {
1103
+ list-style-type: lower-alpha;
1104
+ }
1105
+ .markdown :where(ol[type='I']) {
1106
+ list-style-type: upper-roman;
1107
+ }
1108
+ .markdown :where(ol[type='i']) {
1109
+ list-style-type: lower-roman;
1110
+ }
1111
+ .markdown :where(ol[type='I s']) {
1112
+ list-style-type: upper-roman;
1113
+ }
1114
+ .markdown :where(ol[type='i s']) {
1115
+ list-style-type: lower-roman;
1116
+ }
1117
+ .markdown :where(ol[type='1']) {
1118
+ list-style-type: decimal;
1119
+ }
1120
+ .markdown :where(ul) {
1121
+ list-style-type: disc;
1122
+ margin-top: var(--size-16);
1123
+ margin-bottom: var(--size-16);
1124
+ padding-inline-start: var(--size-28);
1125
+ }
1126
+ .markdown :where(ol > li)::marker {
1127
+ font-weight: var(--font-weight-medium);
1128
+ color: var(--text-body);
1129
+ }
1130
+ .markdown :where(ul > li)::marker {
1131
+ color: var(--text-body);
1132
+ }
1133
+ .markdown :where(dt) {
1134
+ color: var(--text-headings);
1135
+ font-weight: var(--font-weight-semibold);
1136
+ margin-top: var(--size-16);
1137
+ }
1138
+ .markdown :where(hr) {
1139
+ border-top: var(--border-width-sm) solid var(--border-primary);
1140
+ margin-top: var(--size-32);
1141
+ margin-bottom: var(--size-32);
1142
+ }
1143
+ .markdown :where(blockquote) {
1144
+ font-weight: var(--font-weight-medium);
1145
+ font-style: italic;
1146
+ color: var(--text-body);
1147
+ border-left: var(--border-width-lg) solid var(--border-primary);
1148
+ quotes: '“' '”' '‘' '’';
1149
+ margin-top: var(--size-24);
1150
+ margin-bottom: var(--size-24);
1151
+ padding-inline-start: var(--size-16);
1152
+ margin-inline-start: 0;
1153
+ }
1154
+ .markdown :where(blockquote p:first-of-type):before {
1155
+ content: open-quote;
1156
+ }
1157
+ .markdown :where(blockquote p:last-of-type):after {
1158
+ content: close-quote;
1159
+ }
1160
+ .markdown :where(h1) {
1161
+ color: var(--text-headings);
1162
+ font-weight: var(--font-weight-medium);
1163
+ font-size: var(--font-size-2xl);
1164
+ line-height: var(--lineheight-2xl);
1165
+ letter-spacing: var(--tracking-2xl);
1166
+ margin-top: var(--size-16);
1167
+ margin-bottom: var(--size-16);
1168
+ }
1169
+ .markdown :where(h1 strong) {
1170
+ font-weight: var(--font-weight-bold);
1171
+ color: inherit;
1172
+ }
1173
+ .markdown :where(h2) {
1174
+ color: var(--text-headings);
1175
+ font-weight: var(--font-weight-medium);
1176
+ font-size: var(--font-size-xl);
1177
+ line-height: var(--lineheight-xl);
1178
+ letter-spacing: var(--tracking-xl);
1179
+ margin-top: var(--size-16);
1180
+ margin-bottom: var(--size-16);
1181
+ }
1182
+ .markdown :where(h2 strong) {
1183
+ font-weight: var(--font-weight-bold);
1184
+ color: inherit;
1185
+ }
1186
+ .markdown :where(h3) {
1187
+ color: var(--text-headings);
1188
+ font-weight: var(--font-weight-medium);
1189
+ font-size: var(--font-size-lg);
1190
+ line-height: var(--lineheight-lg);
1191
+ letter-spacing: var(--tracking-lg);
1192
+ margin-top: var(--size-16);
1193
+ margin-bottom: var(--size-8);
1194
+ }
1195
+ .markdown :where(h3 strong) {
1196
+ font-weight: var(--font-weight-bold);
1197
+ color: inherit;
1198
+ }
1199
+ .markdown :where(h4) {
1200
+ color: var(--text-headings);
1201
+ font-weight: var(--font-weight-medium);
1202
+ font-size: var(--font-size-md);
1203
+ line-height: var(--lineheight-md);
1204
+ letter-spacing: var(--tracking-md);
1205
+ margin-top: var(--size-16);
1206
+ margin-bottom: var(--size-8);
1207
+ }
1208
+ .markdown :where(h4 strong) {
1209
+ font-weight: var(--font-weight-bold);
1210
+ color: inherit;
1211
+ }
1212
+ .markdown :where(h5) {
1213
+ color: var(--text-headings);
1214
+ font-weight: var(--font-weight-semibold);
1215
+ font-size: var(--font-size-sm);
1216
+ line-height: var(--lineheight-sm);
1217
+ letter-spacing: var(--tracking-sm);
1218
+ margin-top: var(--size-16);
1219
+ margin-bottom: var(--size-4);
1220
+ }
1221
+ .markdown :where(h5 strong) {
1222
+ font-weight: var(--font-weight-bold);
1223
+ color: inherit;
1224
+ }
1225
+ .markdown :where(h6) {
1226
+ color: var(--text-headings);
1227
+ font-weight: var(--font-weight-bold);
1228
+ font-size: var(--font-size-xs);
1229
+ line-height: var(--lineheight-xs);
1230
+ letter-spacing: var(--tracking-xs);
1231
+ margin-top: var(--size-16);
1232
+ margin-bottom: var(--size-0);
1233
+ }
1234
+ .markdown :where(h6 strong) {
1235
+ font-weight: var(--font-weight-bold);
1236
+ color: inherit;
1237
+ }
1238
+ .markdown :where(img) {
1239
+ object-fit: contain;
1240
+ object-position: center;
1241
+ width: 100%;
1242
+ margin-top: var(--size-16);
1243
+ margin-bottom: var(--size-16);
1244
+ }
1245
+ .markdown :where(picture) {
1246
+ display: block;
1247
+ margin-top: var(--size-16);
1248
+ margin-bottom: var(--size-16);
1249
+ }
1250
+ .markdown :where(video) {
1251
+ margin-top: var(--size-16);
1252
+ margin-bottom: var(--size-16);
1253
+ }
1254
+ .markdown :where(kbd) {
1255
+ font-weight: var(--font-weight-medium);
1256
+ font-family: inherit;
1257
+ color: var(--text-action);
1258
+ box-shadow:
1259
+ 0 0 0 1px rgb(17 24 39 / 10%),
1260
+ 0 3px rgb(17 24 39 / 10%);
1261
+ font-size: var(--font-size-sm);
1262
+ line-height: var(--lineheight-sm);
1263
+ letter-spacing: var(--tracking-sm);
1264
+ border-radius: var(--radius-default);
1265
+ padding-top: var(--size-4);
1266
+ padding-inline-end: var(--size-8);
1267
+ padding-bottom: var(--size-4);
1268
+ padding-inline-start: var(--size-8);
1269
+ }
1270
+ .markdown :where(code) {
1271
+ font-weight: var(--font-weight-semibold);
1272
+ font-size: var(--font-size-sm);
1273
+ line-height: var(--lineheight-sm);
1274
+ letter-spacing: var(--tracking-sm);
1275
+ color: var(--text-information);
1276
+ background-color: var(--surface-information);
1277
+ border-radius: var(--radius-default);
1278
+ padding: 2px var(--size-4);
1279
+ }
1280
+ .markdown :where(a code) {
1281
+ color: inherit;
1282
+ }
1283
+ .markdown :where(h1 code) {
1284
+ color: inherit;
1285
+ }
1286
+ .markdown :where(h2 code) {
1287
+ color: inherit;
1288
+ font-size: var(--font-size-sm);
1289
+ line-height: var(--lineheight-sm);
1290
+ letter-spacing: var(--tracking-sm);
1291
+ }
1292
+ .markdown :where(h3 code) {
1293
+ color: inherit;
1294
+ font-size: var(--font-size-sm);
1295
+ line-height: var(--lineheight-sm);
1296
+ letter-spacing: var(--tracking-sm);
1297
+ }
1298
+ .markdown :where(h4 code) {
1299
+ color: inherit;
1300
+ font-size: var(--font-size-sm);
1301
+ line-height: var(--lineheight-sm);
1302
+ letter-spacing: var(--tracking-sm);
1303
+ }
1304
+ .markdown :where(h5 code) {
1305
+ color: inherit;
1306
+ font-size: var(--font-size-sm);
1307
+ line-height: var(--lineheight-sm);
1308
+ letter-spacing: var(--tracking-sm);
1309
+ }
1310
+ .markdown :where(h6 code) {
1311
+ color: inherit;
1312
+ font-size: var(--font-size-sm);
1313
+ line-height: var(--lineheight-sm);
1314
+ letter-spacing: var(--tracking-sm);
1315
+ }
1316
+ .markdown :where(blockquote code) {
1317
+ color: inherit;
1318
+ }
1319
+ .markdown :where(thead th code) {
1320
+ color: inherit;
1321
+ }
1322
+ .markdown :where(pre) {
1323
+ color: var(--text-code);
1324
+ background-color: var(--surface-code);
1325
+ overflow-x: auto;
1326
+ font-weight: var(--font-weight-regular);
1327
+ font-size: var(--font-size-sm);
1328
+ line-height: var(--lineheight-sm);
1329
+ letter-spacing: var(--tracking-sm);
1330
+ margin-top: var(--size-16);
1331
+ margin-bottom: var(--size-16);
1332
+ border-radius: var(--radius-default);
1333
+ padding-top: var(--size-14);
1334
+ padding-inline-end: var(--size-20);
1335
+ padding-bottom: var(--size-14);
1336
+ padding-inline-start: var(--size-20);
1337
+ }
1338
+ .markdown :where(pre code) {
1339
+ background-color: transparent;
1340
+ border-width: 0;
1341
+ border-radius: 0;
1342
+ padding: 0;
1343
+ font-weight: inherit;
1344
+ color: inherit;
1345
+ font-size: inherit;
1346
+ line-height: inherit;
1347
+ letter-spacing: inherit;
1348
+ font-family: inherit;
1349
+ }
1350
+ .markdown :where(pre code):before {
1351
+ content: none;
1352
+ }
1353
+ .markdown :where(pre code):after {
1354
+ content: none;
1355
+ }
1356
+ .markdown :where(table) {
1357
+ border-collapse: collapse;
1358
+ width: 100%;
1359
+ table-layout: auto;
1360
+ margin-top: var(--size-16);
1361
+ margin-bottom: var(--size-16);
1362
+ border-spacing: 0;
1363
+ font-size: var(--font-size-sm);
1364
+ line-height: var(--lineheight-sm);
1365
+ letter-spacing: var(--tracking-sm);
1366
+ display: block;
1367
+ overflow-x: auto;
1368
+ }
1369
+ .markdown :where(thead th) {
1370
+ color: var(--text-headings);
1371
+ font-weight: var(--font-weight-semibold);
1372
+ vertical-align: bottom;
1373
+ padding-inline-end: var(--size-8);
1374
+ padding-top: var(--size-8);
1375
+ padding-bottom: var(--size-8);
1376
+ padding-inline-start: var(--size-8);
1377
+ }
1378
+ .markdown :where(tbody tr:last-child) {
1379
+ border-bottom-width: 0;
1380
+ }
1381
+ .markdown :where(tbody td) {
1382
+ vertical-align: baseline;
1383
+ }
1384
+ .markdown :where(tfoot td) {
1385
+ vertical-align: top;
1386
+ }
1387
+ .markdown :where(th, td) {
1388
+ text-align: start;
1389
+ border: var(--border-width-sm) solid var(--border-primary);
1390
+ }
1391
+ .markdown :where(figure > *) {
1392
+ margin-top: 0;
1393
+ margin-bottom: 0;
1394
+ }
1395
+ .markdown :where(figcaption) {
1396
+ color: var(--text-body);
1397
+ font-size: var(--font-size-sm);
1398
+ line-height: var(--lineheight-sm);
1399
+ letter-spacing: var(--tracking-sm);
1400
+ margin-top: var(--size-14);
1401
+ }
1402
+ .markdown :where(picture > img) {
1403
+ margin-top: 0;
1404
+ margin-bottom: 0;
1405
+ }
1406
+ .markdown :where(li) {
1407
+ margin-top: var(--size-8);
1408
+ margin-bottom: var(--size-8);
1409
+ }
1410
+ .markdown :where(ol > li) {
1411
+ padding-inline-start: var(--size-8);
1412
+ }
1413
+ .markdown :where(ul > li) {
1414
+ padding-inline-start: var(--size-8);
1415
+ }
1416
+ .markdown :where(.markdown > ul > li p) {
1417
+ margin-top: var(--size-12);
1418
+ margin-bottom: var(--size-12);
1419
+ }
1420
+ .markdown :where(.markdown > ul > li > p:first-child) {
1421
+ margin-top: var(--size-16);
1422
+ }
1423
+ .markdown :where(.markdown > ul > li > p:last-child) {
1424
+ margin-bottom: var(--size-16);
1425
+ }
1426
+ .markdown :where(.markdown > ol > li > p:first-child) {
1427
+ margin-top: var(--size-16);
1428
+ }
1429
+ .markdown :where(.markdown > ol > li > p:last-child) {
1430
+ margin-bottom: var(--size-16);
1431
+ }
1432
+ .markdown :where(ul ul, ul ol, ol ul, ol ol) {
1433
+ margin-top: var(--size-12);
1434
+ margin-bottom: var(--size-12);
1435
+ }
1436
+ .markdown :where(dl) {
1437
+ margin-top: var(--size-16);
1438
+ margin-bottom: var(--size-16);
1439
+ }
1440
+ .markdown :where(dd) {
1441
+ margin-top: var(--size-8);
1442
+ padding-inline-start: var(--size-28);
1443
+ }
1444
+ .markdown :where(hr + *) {
1445
+ margin-top: 0;
1446
+ }
1447
+ .markdown :where(h2 + *) {
1448
+ margin-top: 0;
1449
+ }
1450
+ .markdown :where(h3 + *) {
1451
+ margin-top: 0;
1452
+ }
1453
+ .markdown :where(h4 + *) {
1454
+ margin-top: 0;
1455
+ }
1456
+ .markdown :where(h5 + *) {
1457
+ margin-top: 0;
1458
+ }
1459
+ .markdown :where(h6 + *) {
1460
+ margin-top: 0;
1461
+ }
1462
+ .markdown :where(tbody td, tfoot td) {
1463
+ padding-top: var(--size-8);
1464
+ padding-inline-end: var(--size-8);
1465
+ padding-bottom: var(--size-8);
1466
+ padding-inline-start: var(--size-8);
1467
+ }
1468
+ .markdown :where(figure) {
1469
+ margin-top: var(--size-16);
1470
+ margin-bottom: var(--size-16);
1471
+ }
1472
+ .markdown :where(.markdown > :first-child) {
1473
+ margin-top: 0;
1474
+ }
1475
+ .markdown :where(.markdown > :last-child) {
1476
+ margin-bottom: 0;
1477
+ }
1478
+ `;var Ur=Object.defineProperty,Br=Object.getOwnPropertyDescriptor,de=(o,e,t,r)=>{for(var n=r>1?void 0:r?Br(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&Ur(e,t,n),n};let H=class extends p.LitElement{constructor(){super(...arguments),this.data=null,this.loading=!1,this.loadingText="Thinking..."}submitActionApproval(o){var e;if(!((e=this.data)!=null&&e.id))throw new Error("Message ID is required");this.dispatchEvent(new Rr(this.data.id,o))}renderUserMessage(o){return p.html`
1479
+ <div class="message__content--left"></div>
1480
+ <div class="message__content--right">
1481
+ <div class="markdown">
1482
+ ${j.unsafeHTML(v(o.content,{async:!1}))}
1483
+ </div>
1484
+ </div>
1485
+ `}_copyToClipboard(o){navigator.clipboard.writeText(o)}renderAssistantMessage(o){const e=()=>{var t;switch(o.status){case"completed":return p.html`
1486
+ ${(t=o.metadata)!=null&&t.citations&&o.metadata.citations.length>0?p.html`<div class="message__citations">
1487
+ ${o.metadata.citations.map(r=>p.html`
1488
+ <div class="citation">
1489
+ <a href="${r.url}" target="_blank"
1490
+ >${r.title} ${ie.unsafeSVG(Ue)}</a
1491
+ >
1492
+ </div>
1493
+ `)}
1494
+ </div> `:""}
1495
+ <div class="button-group">
1496
+ <gaia-tooltip text="Copy" position="bottom">
1497
+ <gaia-button
1498
+ icon="copy"
1499
+ variant="ghost"
1500
+ size="icon-sm"
1501
+ @click=${()=>this._copyToClipboard(o.content)}
1502
+ ></gaia-button>
1503
+ </gaia-tooltip>
1504
+ <gaia-spacing direction="vertical"></gaia-spacing>
1505
+ <gaia-tooltip text="Good response" position="bottom">
1506
+ <gaia-button icon="thumbs-up" variant="ghost" size="icon-sm"></gaia-button>
1507
+ </gaia-tooltip>
1508
+ <gaia-tooltip text="Bad response" position="bottom">
1509
+ <gaia-button icon="thumbs-down" variant="ghost" size="icon-sm"></gaia-button>
1510
+ </gaia-tooltip>
1511
+ </div>
1512
+ `;case"waitingForApproval":return p.html`<div class="button-group">
1513
+ <gaia-button variant="secondary" @click=${()=>this.submitActionApproval(!0)}
1514
+ >Yes</gaia-button
1515
+ >
1516
+ <gaia-button variant="secondary" @click=${()=>this.submitActionApproval(!1)}
1517
+ >No</gaia-button
1518
+ >
1519
+ </div>`;default:return""}};return p.html`
1520
+ <div class="message__content--left">
1521
+ <gaia-avatar size="sm" initials="AI"></gaia-avatar>
1522
+ </div>
1523
+
1524
+ <div class="message__content--right">
1525
+ <div class="markdown">
1526
+ ${j.unsafeHTML(v(o.content,{async:!1}))}
1527
+ </div>
1528
+ ${e()}
1529
+ </div>
1530
+ `}renderVisitorMessage(o){return p.html`
1531
+ <div class="message__content--left"></div>
1532
+ <div class="message__content--right">
1533
+ <div class="markdown">
1534
+ ${j.unsafeHTML(v(o.content,{async:!1}))}
1535
+ </div>
1536
+ </div>
1537
+ `}renderOperatorMessage(o){return p.html`
1538
+ <div class="message__content--left">
1539
+ <gaia-tooltip text="Active" position="right">
1540
+ <gaia-avatar
1541
+ size="sm"
1542
+ status="active"
1543
+ .src=${o.operatorAvatar??void 0}
1544
+ ></gaia-avatar>
1545
+ </gaia-tooltip>
1546
+ </div>
1547
+
1548
+ <div class="message__content--right">
1549
+ <div class="markdown">
1550
+ ${o.status==="typing"?p.html`<gaia-loader type="typing"></gaia-loader>`:j.unsafeHTML(v(o.content,{async:!1}))}
1551
+ </div>
1552
+ </div>
1553
+ `}renderSystemMessage(o){return p.html`
1554
+ <div class="message__content--left"></div>
1555
+ <div class="message__content--right">
1556
+ <div class="message__content markdown">
1557
+ ${j.unsafeHTML(v(o.content,{async:!1}))}
1558
+ </div>
1559
+ </div>
1560
+ `}renderLoadingMessage(){return p.html`<div class="message__content--left">
1561
+ <gaia-loader type="thinking"></gaia-loader>
1562
+ </div>
1563
+ <div class="message__content--right">
1564
+ <div class="markdown">${this.loadingText}</div>
1565
+ </div> `}renderMessage(o){return Tr(o)?this.renderUserMessage(o):Or(o)?this.renderVisitorMessage(o):Ar(o)?this.renderAssistantMessage(o):Pr(o)?this.renderOperatorMessage(o):Mr(o)?this.renderSystemMessage(o):""}render(){return this.loading?p.html` <div class="message message--assistant">${this.renderLoadingMessage()}</div> `:!this.data||this.data.status!=="typing"&&this.data.content===""?null:p.html`
1566
+ <div
1567
+ class="message ${N({"message--user":this.data.role==="user"||this.data.role==="visitor","message--assistant":this.data.role==="assistant"||this.data.role==="operator","message--system":this.data.role==="system","status--error":this.data.status==="error","status--info":this.data.status==="info","status--warning":this.data.status==="warning","status--success":this.data.status==="success"})}"
1568
+ >
1569
+ ${this.renderMessage(this.data)}
1570
+ </div>
1571
+ `}};H.styles=[Lr,Dr],de([g.property({type:Object})],H.prototype,"data",2),de([g.property({type:Boolean,attribute:"loading"})],H.prototype,"loading",2),de([g.property({type:String,attribute:"loading-text"})],H.prototype,"loadingText",2),H=de([g.customElement("gaia-chat-message")],H);let ge;const qr=new Uint8Array(16);function Nr(){if(!ge&&(ge=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ge))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ge(qr)}const z=[];for(let o=0;o<256;++o)z.push((o+256).toString(16).slice(1));function Hr(o,e=0){return z[o[e+0]]+z[o[e+1]]+z[o[e+2]]+z[o[e+3]]+"-"+z[o[e+4]]+z[o[e+5]]+"-"+z[o[e+6]]+z[o[e+7]]+"-"+z[o[e+8]]+z[o[e+9]]+"-"+z[o[e+10]]+z[o[e+11]]+z[o[e+12]]+z[o[e+13]]+z[o[e+14]]+z[o[e+15]]}const rt={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Me(o,e,t){if(rt.randomUUID&&!o)return rt.randomUUID();o=o||{};const r=o.random||(o.rng||Nr)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,Hr(r)}const ue={PING_INTERVAL:60*1e3,REQUEST_TIMEOUT:30*1e3,RETRY_ATTEMPTS:3,RETRY_DELAY:1e3},K={PING:"ping",CLOSE:"close",TEXT:"text",TYPING:"typing",SEEN:"seen"},_={USER:"user",ASSISTANT:"assistant",OPERATOR:"operator",VISITOR:"visitor",SYSTEM:"system",TOOL:"tool"},E={PENDING:"pending",COMPLETED:"completed",FAILED:"failed",CANCELLED:"cancelled",WAITING_FOR_APPROVAL:"waitingForApproval",APPROVED:"approved",DECLINED:"declined",TYPING:"typing",INFO:"info",ERROR:"error",WARNING:"warning",SUCCESS:"success"},ee={UPDATE:"update",MESSAGE:"message",ERROR:"error",CLOSE:"close"},fe={LOADING_TEXT:"Thinking...",OPERATOR_NAME:"Support Agent",VISITOR_NAME:"John Doe",VISITOR_EMAIL:"john@example.com",START_URL:"https://visma.com"};var nt=(o=>(o[o.DEBUG=0]="DEBUG",o[o.INFO=1]="INFO",o[o.WARN=2]="WARN",o[o.ERROR=3]="ERROR",o))(nt||{});class G{constructor(){this.minLevel=1}static getInstance(){return G.instance||(G.instance=new G),G.instance}setLevel(e){this.minLevel=e}log(e,t,r,n){if(e<this.minLevel)return;const i={timestamp:new Date},s=nt[e];let h=`[${i.timestamp.toISOString()}] ${s}: ${t}`;switch(r&&(h+=` ${JSON.stringify(r)}`),e){case 0:console.debug(h);break;case 1:console.info(h);break;case 2:console.warn(h);break;case 3:console.error(h);break}}debug(e,t){this.log(0,e,t)}info(e,t){this.log(1,e,t)}warn(e,t){this.log(2,e,t)}error(e,t,r){this.log(3,e,t,r)}}const d=G.getInstance();class it{constructor(e){this.baseUrl="",this.defaultHeaders={"Content-Type":"application/json"},e&&(this.baseUrl=e)}setBaseUrl(e){this.baseUrl=e}async request(e,t={}){const{timeout:r=ue.REQUEST_TIMEOUT,headers:n={},...i}=t,s=this.buildUrl(e),a={...this.defaultHeaders,...n},h=new AbortController,c=setTimeout(()=>h.abort(),r);try{d.debug("Making HTTP request",{url:s,method:i.method||"GET"});const l=await fetch(s,{...i,headers:a,signal:h.signal});if(clearTimeout(c),!l.ok){const f=new Error(`HTTP ${l.status}: ${l.statusText}`);throw f.status=l.status,f.response=l,f}const u=l.headers.get("content-type");return u!=null&&u.includes("application/json")?await l.json():await l.text()}catch(l){throw clearTimeout(c),l instanceof DOMException&&l.name==="AbortError"?new Error("Request timeout"):l}}async get(e,t){return this.request(e,{...t,method:"GET"})}async post(e,t,r){return this.request(e,{...r,method:"POST",body:t?JSON.stringify(t):void 0})}async put(e,t,r){return this.request(e,{...r,method:"PUT",body:t?JSON.stringify(t):void 0})}async delete(e,t){return this.request(e,{...t,method:"DELETE"})}buildUrl(e){if(e.startsWith("http"))return e;const t=this.baseUrl.endsWith("/")?this.baseUrl.slice(0,-1):this.baseUrl,r=e.startsWith("/")?e:`/${e}`;return`${t}${r}`}}class Gr extends it{constructor(e){super(e),this.abortController=null}async*streamMessages(e){this.abort(),this.abortController=new AbortController;try{d.info("Starting message stream",{conversationId:e.conversationId});const t=await fetch(`${this.baseUrl}/api/v1/conversations/stream`,{method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json"},signal:this.abortController.signal});if(!t.ok)throw new Error(`Failed to send message: ${t.status}`);if(!t.body)throw new Error("Response body is empty");yield*this.processStreamResponse(t.body)}catch(t){const r=t instanceof Error?t.message:"Unknown error";if(d.error("Error in message stream",{error:r},t instanceof Error?t:void 0),!(t instanceof DOMException&&t.name==="AbortError"))throw t}finally{this.abort()}}async*processStreamResponse(e){const t=new TextDecoder,r=e.getReader();let n="",i=!1;try{for(;!i;){const{value:s,done:a}=await r.read();if(i=a,!s)continue;const h=t.decode(s,{stream:!0});n+=h;const c=n.split(`
1572
+
1573
+ `);n=c.pop()||"";for(const l of c){const u=this.parseSSEChunk(l);u&&(yield u)}}}catch(s){const a=s instanceof Error?s.message:"Unknown error";throw d.error("Error processing stream response",{error:a},s instanceof Error?s:void 0),s}finally{r.releaseLock()}}parseSSEChunk(e){const t=/event: (.*)\ndata: (.*)/gm.exec(e);if(!t)return d.warn("Malformed SSE chunk",{chunk:e}),null;const[r,n]=t.slice(1);if(!this.isValidEventType(r))return d.warn("Unknown SSE event type",{eventType:r}),null;try{return{type:r,data:JSON.parse(n)}}catch(i){const s=i instanceof Error?i.message:"Unknown error";return d.error("Failed to parse SSE data",{jsonString:n,error:s},i instanceof Error?i:void 0),null}}isValidEventType(e){return Object.values(ee).includes(e)}async submitActionApproval(e){const{conversationId:t,messageId:r,isApproved:n}=e;d.info("Submitting action approval",{conversationId:t,messageId:r,isApproved:n}),await this.post(`/api/v1/conversations/${t}/messages/${r}/approve`,{approved:n})}abort(){this.abortController&&!this.abortController.signal.aborted&&(d.debug("Aborting chat service request"),this.abortController.abort()),this.abortController=null}}function Vr(o,e,t,r){const n=e.split("/");function i(s,a){if(a===n.length-1){const h=n[a];if(t==="set")return{...s,[h]:r};if(t==="append"){const c=s[h];let l;if(Array.isArray(c))l=Array.isArray(r)?[...c,...r]:[...c,r];else if(typeof c=="string"||typeof c=="number")l=c+r;else throw new Error(`Cannot perform 'append' on non-string/non-number at path '${e}'`);return{...s,[h]:l}}throw new Error(`Unknown operation '${t}'`)}else{const h=n[a];return{...s,[h]:i(s[h],a+1)}}}return i(o,0)}class jr{constructor(e){this.currentPath="",this.currentOperation="set",(this.host=e).addController(this),this.chatService=new Gr}hostConnected(){this.chatService.setBaseUrl(this.host.baseUrl),d.debug("Chat controller host connected",{baseUrl:this.host.baseUrl})}hostDisconnected(){d.debug("Chat controller host disconnected"),this.chatService.abort()}async sendMessage(e){if(!this.host.profileId)throw new Error("Profile ID is required");const t=this.createUserMessage(e);this.addMessage(t),this.host.loading=!0;try{d.info("Sending message to AI assistant",{profileId:this.host.profileId,conversationId:this.host.conversation.id,messageId:t.id});for await(const r of this.chatService.streamMessages({profileId:this.host.profileId,conversationId:this.host.conversation.id,messageId:t.id,content:e}))this.handleStreamEvent(r);d.info("Message sent to AI assistant successfully",{profileId:this.host.profileId,messageId:t.id})}catch(r){const n="An error occurred while sending the message";d.error(n,{profileId:this.host.profileId,messageId:t.id,error:r instanceof Error?r.message:"Unknown error"},r instanceof Error?r:void 0),this.addMessage(this.createSystemMessage(n,E.ERROR))}finally{this.host.loading&&(this.host.loading=!1,this.host.requestUpdate())}}handleStreamEvent(e){switch(e.type){case ee.UPDATE:this.host.loading&&this.isLoadingComplete()?(this.host.loading=!1,this.host.requestUpdate(),this.updateConversation(e)):(this.updateConversation(e),this.requestUpdate());break;case ee.MESSAGE:this.addMessage(this.createSystemMessage(e.data.message,E.INFO));break;case ee.ERROR:this.addMessage(this.createSystemMessage(e.data.message,E.ERROR)),d.error("Error from AI assistant",{error:e.data.message});break;case ee.CLOSE:d.info("AI assistant stream closed"),this.requestUpdate();break;default:d.warn("Unknown event type from AI assistant",{type:e.type})}}async sendActionApproval(e){if(!this.host.conversation.id)throw new Error("Conversation ID is required");try{d.info("Submitting action approval",{conversationId:this.host.conversation.id,messageId:e.detail.messageId,isApproved:e.detail.isApproved}),await this.chatService.submitActionApproval({conversationId:this.host.conversation.id,messageId:e.detail.messageId,isApproved:e.detail.isApproved}),d.info("Action approval submitted successfully",{messageId:e.detail.messageId,isApproved:e.detail.isApproved})}catch(t){const r="Failed to submit action approval";throw d.error(r,{messageId:e.detail.messageId,error:t instanceof Error?t.message:"Unknown error"},t instanceof Error?t:void 0),this.addMessage(this.createSystemMessage(r,E.ERROR)),t}}requestUpdate(){this.host.loading||this.host.requestUpdate()}isLoadingComplete(){const e=Object.values(this.host.conversation.messages),t=e[e.length-1];return t&&t.role===_.ASSISTANT&&t.content.length>0}updateConversation(e){const{p:t,o:r,v:n}=e.data;this.currentPath=t??this.currentPath,this.currentOperation=r??this.currentOperation;try{this.host.conversation=Vr(this.host.conversation,this.currentPath,this.currentOperation,n),this.host.requestUpdate()}catch(i){d.error("Failed to update conversation",{path:this.currentPath,operation:this.currentOperation,error:i instanceof Error?i.message:"Unknown error"},i instanceof Error?i:void 0)}}addMessage(e){const t={...this.host.conversation.messages,[e.id]:e};this.host.conversation={...this.host.conversation,messages:t},this.host.requestUpdate()}createUserMessage(e){return{id:Me(),role:_.USER,content:e,status:E.PENDING,timestamp:new Date().toISOString()}}createSystemMessage(e,t){return{id:Me(),role:_.SYSTEM,content:e,status:t,timestamp:new Date().toISOString()}}}class Fr extends it{constructor(e){super(e)}async startConversation(e){d.info("Starting LiveLeader conversation",{teamId:e.teamId,messageCount:e.messages.length});try{const t=await this.post("/api/v1/liveleader/conversations",e);return d.info("LiveLeader conversation started successfully",{conversationId:t.id}),t}catch(t){throw d.error("Failed to start LiveLeader conversation",{teamId:e.teamId,error:t instanceof Error?t.message:"Unknown error"},t instanceof Error?t:void 0),t}}async sendMessage(e){const{conversationId:t,message:r}=e;d.info("Sending message to LiveLeader",{conversationId:t,messageRole:r.role});try{const n=await this.post(`/api/v1/liveleader/conversations/${t}/messages`,e);return d.info("Message sent successfully to LiveLeader",{conversationId:t,messageId:n.id}),n}catch(n){throw d.error("Failed to send message to LiveLeader",{conversationId:t,error:n instanceof Error?n.message:"Unknown error"},n instanceof Error?n:void 0),n}}async getGroupById(e){d.info("Fetching group information from LiveLeader",{teamId:e});try{const t=await this.get(`/api/v1/liveleader/groups/${e}`);return d.info("Group information fetched successfully",{teamId:e,groupName:t.name,available:t.available}),t}catch(t){throw d.error("Failed to fetch group information",{teamId:e,error:t instanceof Error?t.message:"Unknown error"},t instanceof Error?t:void 0),t}}async getOperatorById(e){d.info("Fetching operator information from LiveLeader",{operatorId:e});try{const t=await this.get(`/api/v1/liveleader/operators/${e}`);return d.info("Operator information fetched successfully",{operatorId:e,operatorName:t.name,operatorEmail:t.email,operatorPicture:t.picture}),t}catch(t){throw d.error("Failed to fetch operator information",{operatorId:e,error:t instanceof Error?t.message:"Unknown error"},t instanceof Error?t:void 0),t}}}class Wr{constructor(e){this.ws=null,this.pingInterval=null,this.pingCounter=0,this.reconnectAttempts=0,this.isManualClose=!1,this.messageHandlers=new Map,this.connectionHandlers={},this.config={pingInterval:ue.PING_INTERVAL,reconnectAttempts:ue.RETRY_ATTEMPTS,reconnectDelay:ue.RETRY_DELAY,...e}}connect(){return new Promise((e,t)=>{try{d.info("Connecting to WebSocket",{url:this.config.url}),this.ws=new WebSocket(this.config.url),this.isManualClose=!1,this.ws.onopen=()=>{var r,n;d.info("WebSocket connection established"),this.reconnectAttempts=0,this.startPingInterval(),(n=(r=this.connectionHandlers).onOpen)==null||n.call(r),e()},this.ws.onclose=r=>{this.handleClose(r)},this.ws.onerror=r=>{var n,i;d.error("WebSocket error",{error:r.type}),(i=(n=this.connectionHandlers).onError)==null||i.call(n,r),t(new Error("WebSocket connection failed"))},this.ws.onmessage=r=>{this.handleMessage(r)}}catch(r){d.error("Failed to create WebSocket connection",{error:r instanceof Error?r.message:"Unknown error"},r instanceof Error?r:void 0),t(r)}})}disconnect(e){d.info("Disconnecting WebSocket",{reason:e}),this.isManualClose=!0,this.stopPingInterval(),this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.close(1e3,e),this.ws=null}send(e){if(!this.isConnected())throw new Error("WebSocket is not connected");const t=typeof e=="string"?e:JSON.stringify(e);d.debug("Sending WebSocket message",{type:typeof e=="object"?e.type:"raw",size:t.length}),this.ws.send(t)}isConnected(){var e;return((e=this.ws)==null?void 0:e.readyState)===WebSocket.OPEN}onMessage(e,t){this.messageHandlers.set(e,t)}offMessage(e){this.messageHandlers.delete(e)}onConnection(e){this.connectionHandlers=e}handleMessage(e){try{if(e.data.startsWith("ping:"))return;const t=JSON.parse(e.data);d.debug("Received WebSocket message",{type:t.type});const r=this.messageHandlers.get(t.type);r?r(t):d.warn("No handler for WebSocket message type",{type:t.type})}catch(t){d.error("Failed to parse WebSocket message",{data:e.data,error:t instanceof Error?t.message:"Unknown error"},t instanceof Error?t:void 0)}}handleClose(e){var r,n;d.info("WebSocket connection closed",{code:e.code,reason:e.reason,wasClean:e.wasClean}),this.stopPingInterval();const t=e.reason||(e.wasClean?"Normal closure":"Connection lost");(n=(r=this.connectionHandlers).onClose)==null||n.call(r,t),!this.isManualClose&&this.reconnectAttempts<this.config.reconnectAttempts&&this.attemptReconnect()}attemptReconnect(){this.reconnectAttempts++;const e=this.config.reconnectDelay*Math.pow(2,this.reconnectAttempts-1);d.info("Attempting WebSocket reconnection",{attempt:this.reconnectAttempts,maxAttempts:this.config.reconnectAttempts,delay:e}),setTimeout(()=>{this.connect().catch(t=>{d.error("WebSocket reconnection failed",{attempt:this.reconnectAttempts,error:t instanceof Error?t.message:"Unknown error"},t instanceof Error?t:void 0)})},e)}startPingInterval(){this.stopPingInterval(),this.pingInterval=setInterval(()=>{this.isConnected()&&(this.send(`${K.PING}:${this.pingCounter}`),this.pingCounter++)},this.config.pingInterval)}stopPingInterval(){this.pingInterval&&(clearInterval(this.pingInterval),this.pingInterval=null)}}class Zr{constructor(e,t){this._websocketManager=null,this._conversationId=null,this._operatorCache=new Map,this.isConnected=!1,(this._host=e).addController(this),this._config=t||{},this._liveleaderService=new Fr}hostConnected(){this._liveleaderService.setBaseUrl(this._host.baseUrl),d.debug("Support controller host connected")}hostDisconnected(){d.debug("Support controller host disconnected"),this.disconnectFromSupport()}updateConfig(e){this._config={...this._config,...e}}async connectToSupport(e,t){var r,n;try{if(d.info("Connecting to support",{teamId:t}),!t)throw new Error("Team ID is required");if(!Object.keys(e.messages).length)throw new Error("Conversation is empty");const i=await this._liveleaderService.startConversation({teamId:t,startUrl:fe.START_URL,messages:this.mapConversationToLiveLeaderMessages(e),visitor:{name:((r=this._config.visitor)==null?void 0:r.name)||fe.VISITOR_NAME,email:((n=this._config.visitor)==null?void 0:n.email)||fe.VISITOR_EMAIL},routeToPartner:void 0});this._conversationId=i.id,await this.establishWebSocketConnection(i.webSocketUrl),this.addMessage(this.createSystemMessage("You have been connected to support",E.INFO)),d.info("Successfully connected to support",{conversationId:this._conversationId})}catch(i){const s="Failed to connect to support";throw d.error(s,{teamId:t,error:i instanceof Error?i.message:"Unknown error"},i instanceof Error?i:void 0),this.addMessage(this.createSystemMessage(s,E.ERROR)),i}}async establishWebSocketConnection(e){this._websocketManager=new Wr({url:e}),this._websocketManager.onConnection({onOpen:()=>{this.isConnected=!0,d.info("WebSocket connection established for support")},onClose:t=>{this.isConnected=!1;const r=t||"You have been disconnected from support";this.addMessage(this.createSystemMessage(r,E.INFO)),d.info("WebSocket connection closed for support",{reason:t})},onError:t=>{d.error("WebSocket error in support",{error:t.type}),this.addMessage(this.createSystemMessage("An error occurred with the support connection",E.ERROR))}}),this._websocketManager.onMessage(K.CLOSE,()=>{this.disconnectFromSupport("The operator has closed the conversation")}),this._websocketManager.onMessage(K.TEXT,async t=>{this.addMessage(await this.createOperatorMessage(t))}),this._websocketManager.onMessage(K.TYPING,t=>{this.handleTypingMessage(t)}),this._websocketManager.onMessage(K.SEEN,t=>{this.handleSeenMessage(t)}),await this._websocketManager.connect()}async sendMessage(e){if(!this._conversationId)throw new Error("No active support conversation");if(!this.isConnected)throw new Error("Not connected to support");try{d.info("Sending message to support",{conversationId:this._conversationId});const t=await this._liveleaderService.sendMessage({message:{role:_.VISITOR,text:e,time:new Date().toISOString()},conversationId:this._conversationId});this.addMessage(this.createVisitorMessage(t)),d.info("Message sent to support successfully",{conversationId:this._conversationId,messageId:t.id})}catch(t){const r="Failed to send message to support";throw d.error(r,{conversationId:this._conversationId,error:t instanceof Error?t.message:"Unknown error"},t instanceof Error?t:void 0),this.addMessage(this.createSystemMessage(r,E.ERROR)),t}}disconnectFromSupport(e){d.info("Disconnecting from support",{reason:e}),this._conversationId=null,this.isConnected=!1,this._websocketManager&&(this._websocketManager.disconnect(e),this._websocketManager=null),this._operatorCache.clear()}async getOperatorInfo(e){if(this._operatorCache.has(e))return d.debug("Using cached operator information",{operatorId:e}),this._operatorCache.get(e);try{d.info("Fetching operator information",{operatorId:e});const t=await this._liveleaderService.getOperatorById(e);return this._operatorCache.set(e,t),t}catch(t){return d.error("Failed to fetch operator information",{operatorId:e,error:t instanceof Error?t.message:"Unknown error"},t instanceof Error?t:void 0),{id:e,name:fe.OPERATOR_NAME,email:"",picture:""}}}async handleTypingMessage(e){try{const t=await this.getOperatorInfo(e.operatorId);if(t.id in this._host.conversation.messages)return;d.debug("Operator typing",{operatorId:e.operatorId,operatorName:t.name});const r={id:e.operatorId,role:_.OPERATOR,content:"",status:E.TYPING,timestamp:e.time,operatorId:e.operatorId,operatorName:t.name,operatorAvatar:t.picture};this.addMessage(r),setTimeout(()=>{this.removeTypingMessage(e.operatorId)},1e4)}catch(t){d.error("Error handling typing message",{error:t instanceof Error?t.message:"Unknown error"})}}async handleSeenMessage(e){try{const t=await this.getOperatorInfo(e.operatorId);d.debug("Message seen by operator",{operatorId:e.operatorId,operatorName:t.name,seenMessageId:e.seenMessageId})}catch(t){d.error("Error handling seen message",{error:t instanceof Error?t.message:"Unknown error"})}}mapConversationToLiveLeaderMessages(e){const t=[];for(const r of Object.values(e.messages))(r.role===_.USER||r.role===_.ASSISTANT)&&t.push({role:r.role===_.USER?_.VISITOR:_.ASSISTANT,text:r.content,time:r.timestamp});return t}addMessage(e){const t={...this._host.conversation.messages,[e.id]:e};this._host.conversation={...this._host.conversation,messages:t},this._host.requestUpdate()}createVisitorMessage(e){return{id:e.id,role:_.VISITOR,content:e.text,timestamp:e.time,status:E.COMPLETED}}removeTypingMessage(e){const t={...this._host.conversation.messages};delete t[e],this._host.conversation={...this._host.conversation,messages:t},this._host.requestUpdate()}async createOperatorMessage(e){const t=await this.getOperatorInfo(e.operatorId);return e.operatorId in this._host.conversation.messages&&this.removeTypingMessage(e.operatorId),{id:e.id,role:_.OPERATOR,content:e.text,timestamp:e.time,status:E.COMPLETED,operatorId:e.operatorId,operatorName:t.name,operatorAvatar:t.picture}}createSystemMessage(e,t){return{id:Me(),role:_.SYSTEM,content:e,status:t,timestamp:new Date().toISOString()}}}const Yr=p.css`
1574
+ :host,
1575
+ :root {
1576
+ --font-family-base: 'Inter', sans-serif;
1577
+ --font-size-xs: 11px;
1578
+ --font-size-sm: 12px;
1579
+ --font-size-md: 14px;
1580
+ --font-size-lg: 16px;
1581
+ --font-size-xl: 20px;
1582
+ --font-size-2xl: 24px;
1583
+ --font-size-3xl: 36px;
1584
+
1585
+ --font-size-body-sm: var(--font-size-sm);
1586
+ --font-size-body-md: var(--font-size-md);
1587
+ --font-size-body-lg: var(--font-size-lg);
1588
+
1589
+ --font-weight-regular: 400;
1590
+ --font-weight-medium: 500;
1591
+ --font-weight-semibold: 600;
1592
+ --font-weight-bold: 700;
1593
+
1594
+ --lineheight-xs: var(--size-16);
1595
+ --lineheight-sm: var(--size-20);
1596
+ --lineheight-md: var(--size-20);
1597
+ --lineheight-lg: var(--size-24);
1598
+ --lineheight-xl: var(--size-32);
1599
+ --lineheight-2xl: var(--size-36);
1600
+ --lineheight-3xl: var(--size-56);
1601
+
1602
+ --tracking-xs: 0.08px;
1603
+ --tracking-sm: 0px;
1604
+ --tracking-md: -0.096px;
1605
+ --tracking-lg: -0.176px;
1606
+ --tracking-xl: -0.272px;
1607
+ --tracking-2xl: -0.304px;
1608
+ --tracking-3xl: -0.352px;
1609
+
1610
+ --color-primary-70: #2a6480;
1611
+ --color-primary-90: #133445;
1612
+ --color-secondary-default: #fae0ce;
1613
+ --color-neutral-10: #f2f3f5;
1614
+ --color-neutral-20: #e2e4e9;
1615
+
1616
+ --text-headings: #133445;
1617
+ --text-body: #133445;
1618
+ --text-action: #1f4e66;
1619
+ --text-action-hover: #133445;
1620
+ --text-disabled: #b9b9b9;
1621
+ --text-information: #133445;
1622
+ --text-on-action: #fcf0e7;
1623
+ --text-link-visited: #591ab5;
1624
+ --text-disable-selected: #6f7687;
1625
+ --text-on-disabled: #6f7687;
1626
+ --text-code: #e5e7eb;
1627
+
1628
+ --surface-primary: #ffffff;
1629
+ --surface-page: #f2f3f5;
1630
+ --surface-disabled: #e2e4e9;
1631
+ --surface-information: #edf4fe;
1632
+ --surface-action: #1f4e66;
1633
+ --surface-action-hover: #133445;
1634
+ --surface-action-hover-2: #fae0ce;
1635
+ --surface-code: #1f2937;
1636
+
1637
+ --border-primary: #cccfd7;
1638
+ --border-disabled: #cccfd7;
1639
+ --border-action: #1f4e66;
1640
+ --border-action-hover: #377ea0;
1641
+ --border-action-hover-2: #f5c3a1;
1642
+ --border-focus: #1f4e66;
1643
+
1644
+ --icon-primary: #133445;
1645
+ --icon-success: #448548;
1646
+ --icon-error: #cc453e;
1647
+ --icon-on-disabled: #6f7687;
1648
+ --icon-on-action: #fae0ce;
1649
+ --icon-action: #1f4e66;
1650
+ --icon-action-hover: #377ea0;
1651
+ --icon-disabled: #cccfd7;
1652
+
1653
+ --border-width-none: 0px;
1654
+ --border-width-sm: 1px;
1655
+ --border-width-md: 2px;
1656
+ --border-width-lg: 4px;
1657
+
1658
+ --radius-round: 100%;
1659
+ --radius-default: 4px;
1660
+ --radius-sharp: 0.28px;
1661
+
1662
+ --size-0: 0px;
1663
+ --size-2: 2px;
1664
+ --size-4: 4px;
1665
+ --size-6: 6px;
1666
+ --size-8: 8px;
1667
+ --size-10: 10px;
1668
+ --size-12: 12px;
1669
+ --size-14: 14px;
1670
+ --size-16: 16px;
1671
+ --size-20: 20px;
1672
+ --size-24: 24px;
1673
+ --size-28: 28px;
1674
+ --size-30: 30px;
1675
+ --size-32: 32px;
1676
+ --size-36: 36px;
1677
+ --size-40: 40px;
1678
+ --size-48: 48px;
1679
+ --size-56: 56px;
1680
+ --size-64: 64px;
1681
+
1682
+ font-family: var(--font-family-base);
1683
+ font-optical-sizing: auto;
1684
+ font-style: normal;
1685
+ font-weight: var(--font-weight-bold);
1686
+ font-size: var(--font-size-md);
1687
+ line-height: var(--lineheight-md);
1688
+ letter-spacing: var(--tracking-md);
1689
+ }
1690
+ `,Qr=o=>class extends o{connectedCallback(){super.connectedCallback(),this.shadowRoot&&p.adoptStyles(this.shadowRoot,[Yr,...this.shadowRoot.adoptedStyleSheets])}};class st extends Qr(p.LitElement){constructor(){super();const e=document.createElement("link");e.href="https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap",e.rel="stylesheet",document.head.appendChild(e)}}const Xr=p.css`
1691
+ :host {
1692
+ display: flex;
1693
+ flex-direction: column;
1694
+ height: 100%;
1695
+ width: 100%;
1696
+ }
1697
+ .chat-container {
1698
+ flex: 1 1 0;
1699
+ }
1700
+ `;var Jr=Object.defineProperty,Kr=Object.getOwnPropertyDescriptor,V=(o,e,t,r)=>{for(var n=r>1?void 0:r?Kr(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&Jr(e,t,n),n};b.ChatContainer=class extends st{constructor(){super(),this.cardContentRef=Le.createRef(),this.profileId=null,this.baseUrl="https://ca-aiasst-api-stag-noe.salmonsea-e473e4fa.norwayeast.azurecontainerapps.io",this.teamId=null,this.conversation={id:null,messages:{}},this.loading=!1,this.chatController=new jr(this),this.supportController=new Zr(this)}onMessageAdded(){this.requestUpdate();const e=this.cardContentRef.value;if(!(e!=null&&e.shadowRoot))return;const t=e.shadowRoot.querySelector(".content"),r=e.shadowRoot.querySelector(".scroller"),n=e.shadowRoot.querySelector("slot");if(!t||!r||!n)return;const i=n.assignedElements();if(i.length===0)return;const s=i[i.length-1],h=r.getBoundingClientRect().height-52-8;t.style.height=`${s.offsetTop+s.offsetHeight+h}px`;const c=s.offsetTop-(r.clientHeight-s.offsetHeight-h);r.scrollTo({top:c,behavior:"smooth"}),r.scrollTop<0&&(r.scrollTop=0)}_newConversation(){this.supportController.disconnectFromSupport(),this.conversation={id:null,messages:{}}}handleConnectSupport(){this.teamId&&this.supportController.connectToSupport(this.conversation,this.teamId)}handleSendMessage(e){this.onMessageAdded(),this.supportController.isConnected?this.supportController.sendMessage(e.detail):this.chatController.sendMessage(e.detail)}handleActionApproval(e){this.chatController.sendActionApproval(e)}render(){return p.html`
1701
+ <div class="chat-container">
1702
+ <gaia-card>
1703
+ <gaia-card-header title="Assistant">
1704
+ <gaia-button
1705
+ variant="ghost"
1706
+ size="icon-sm"
1707
+ icon="square-pen"
1708
+ @click=${this._newConversation}
1709
+ ></gaia-button>
1710
+ <gaia-menu>
1711
+ <gaia-menu-item iconLeft="trash-2" label="Clear data history">
1712
+ By clearing data history, the chat will be restarted.
1713
+ </gaia-menu-item>
1714
+ <gaia-spacing></gaia-spacing>
1715
+ <gaia-menu-item
1716
+ iconLeft="info"
1717
+ iconRight="arrow-up-right"
1718
+ label="Learn more"
1719
+ ></gaia-menu-item>
1720
+ <gaia-menu-item
1721
+ iconLeft="text"
1722
+ iconRight="arrow-up-right"
1723
+ label="Terms of use"
1724
+ ></gaia-menu-item>
1725
+ <gaia-menu-item
1726
+ iconLeft="shield"
1727
+ iconRight="arrow-up-right"
1728
+ label="Privacy statement"
1729
+ ></gaia-menu-item>
1730
+ <gaia-spacing></gaia-spacing>
1731
+ <gaia-menu-item
1732
+ iconLeft="thumbs-up"
1733
+ iconRight="arrow-up-right"
1734
+ label="Give feedback"
1735
+ ></gaia-menu-item>
1736
+ </gaia-menu>
1737
+ </gaia-card-header>
1738
+ <gaia-card-content ${Le.ref(this.cardContentRef)}>
1739
+ <!--
1740
+ Uncomment this to enable support chat
1741
+ <gaia-button @click=${this.handleConnectSupport}>Connect to support</gaia-button>
1742
+ -->
1743
+ ${Object.values(this.conversation.messages).filter(e=>e.role!=="tool").map(e=>p.html`
1744
+ <gaia-chat-message
1745
+ .data=${e}
1746
+ @action-approval=${this.handleActionApproval}
1747
+ ></gaia-chat-message>
1748
+ `)}
1749
+ ${this.loading?p.html`<gaia-chat-message loading></gaia-chat-message>`:""}
1750
+ </gaia-card-content>
1751
+ <gaia-card-footer>
1752
+ <gaia-chat-input @send-message=${this.handleSendMessage}></gaia-chat-input>
1753
+ </gaia-card-footer>
1754
+ </gaia-card>
1755
+ </div>
1756
+ `}},b.ChatContainer.styles=[Xr],V([g.property({type:String,attribute:"profile-id"})],b.ChatContainer.prototype,"profileId",2),V([g.property({type:String,attribute:"base-url"})],b.ChatContainer.prototype,"baseUrl",2),V([g.property({type:String,attribute:"team-id"})],b.ChatContainer.prototype,"teamId",2),V([g.state()],b.ChatContainer.prototype,"conversation",2),V([g.state()],b.ChatContainer.prototype,"loading",2),b.ChatContainer=V([g.customElement("gaia-chat")],b.ChatContainer);const en=p.css`
1757
+ :host {
1758
+ display: inline-flex;
1759
+ align-items: center;
1760
+ justify-content: center;
1761
+ box-sizing: border-box;
1762
+ font-size: var(--font-size-sm);
1763
+ font-weight: var(--font-weight-regular);
1764
+ line-height: var(--lineheight-sm);
1765
+ letter-spacing: var(--tracking-sm);
1766
+ color: var(--text-body);
1767
+ gap: var(--size-4);
1768
+ }
1769
+
1770
+ :host([alignment='right']) {
1771
+ flex-direction: row-reverse;
1772
+ }
1773
+
1774
+ .loader-text {
1775
+ box-sizing: border-box;
1776
+ }
1777
+
1778
+ /**
1779
+ * Spinner Animation
1780
+ */
1781
+
1782
+ :host([type='spinner']) .loader {
1783
+ width: var(--size-16);
1784
+ height: var(--size-16);
1785
+ border-style: solid;
1786
+ border-color: var(--color-secondary-default);
1787
+ border-top-color: var(--color-primary-70);
1788
+ border-radius: 50%;
1789
+ display: inline-flex;
1790
+ align-items: center;
1791
+ justify-content: center;
1792
+ box-sizing: border-box;
1793
+ animation: spin 1.2s linear infinite;
1794
+ }
1795
+
1796
+ @keyframes spin {
1797
+ 0% {
1798
+ transform: rotate(0);
1799
+ }
1800
+ 25% {
1801
+ transform: rotate(90deg);
1802
+ }
1803
+ 50% {
1804
+ transform: rotate(180deg);
1805
+ }
1806
+ 75% {
1807
+ transform: rotate(270deg);
1808
+ }
1809
+ 100% {
1810
+ transform: rotate(360deg);
1811
+ }
1812
+ }
1813
+
1814
+ /**
1815
+ * Typing Animation
1816
+ */
1817
+
1818
+ :host([type='typing']) {
1819
+ --typing-dot-size: 8px;
1820
+ --typing-dot-padding: 4px;
1821
+ --typing-dot-highlight-color: var(--icon-primary);
1822
+ --typing-dot-color: var(--surface-disabled);
1823
+ }
1824
+
1825
+ :host([type='typing']) .loader {
1826
+ width: var(--typing-dot-size);
1827
+ height: var(--typing-dot-size);
1828
+ transform: translateX(calc(var(--typing-dot-size) + var(--typing-dot-padding)));
1829
+ border-radius: 50%;
1830
+ margin-right: calc((var(--typing-dot-size) + var(--typing-dot-padding)) * 2);
1831
+ display: block;
1832
+ position: relative;
1833
+ background: var(--typing-dot-color);
1834
+ box-shadow:
1835
+ calc((var(--typing-dot-size) + var(--typing-dot-padding)) * -1) 0 var(--typing-dot-color),
1836
+ calc(var(--typing-dot-size) + var(--typing-dot-padding)) 0 var(--typing-dot-color);
1837
+ animation: typing 3s linear infinite;
1838
+ }
1839
+
1840
+ @keyframes typing {
1841
+ 33% {
1842
+ background: var(--typing-dot-color);
1843
+ box-shadow:
1844
+ calc((var(--typing-dot-size) + var(--typing-dot-padding)) * -1) 0
1845
+ var(--typing-dot-highlight-color),
1846
+ calc(var(--typing-dot-size) + var(--typing-dot-padding)) 0 var(--typing-dot-color);
1847
+ }
1848
+ 66% {
1849
+ background: var(--typing-dot-highlight-color);
1850
+ box-shadow:
1851
+ calc((var(--typing-dot-size) + var(--typing-dot-padding)) * -1) 0 var(--typing-dot-color),
1852
+ calc(var(--typing-dot-size) + var(--typing-dot-padding)) 0 var(--typing-dot-color);
1853
+ }
1854
+ 100% {
1855
+ background: var(--typing-dot-color);
1856
+ box-shadow:
1857
+ calc((var(--typing-dot-size) + var(--typing-dot-padding)) * -1) 0 var(--typing-dot-color),
1858
+ calc(var(--typing-dot-size) + var(--typing-dot-padding)) 0 var(--typing-dot-highlight-color);
1859
+ }
1860
+ }
1861
+
1862
+ /**
1863
+ * Thinking Animation
1864
+ */
1865
+
1866
+ :host([type='thinking']) {
1867
+ --thinking-dot-size: 24px;
1868
+ --thinking-dot-color: var(--icon-primary);
1869
+ }
1870
+
1871
+ :host([type='thinking']) .loader {
1872
+ width: var(--thinking-dot-size);
1873
+ height: var(--thinking-dot-size);
1874
+ display: inline-block;
1875
+ position: relative;
1876
+ }
1877
+
1878
+ :host([type='thinking']) .loader::after,
1879
+ :host([type='thinking']) .loader::before {
1880
+ content: '';
1881
+ box-sizing: border-box;
1882
+ width: var(--thinking-dot-size);
1883
+ height: var(--thinking-dot-size);
1884
+ border-radius: 50%;
1885
+ background: var(--thinking-dot-color);
1886
+ position: absolute;
1887
+ left: 0;
1888
+ top: 0;
1889
+ opacity: 0;
1890
+ animation: thinking 1500ms linear infinite;
1891
+ }
1892
+ :host([type='thinking']) .loader::after {
1893
+ animation-delay: 750ms;
1894
+ }
1895
+
1896
+ @keyframes thinking {
1897
+ 0% {
1898
+ transform: scale(0);
1899
+ opacity: 1;
1900
+ }
1901
+ 100% {
1902
+ transform: scale(1);
1903
+ opacity: 0;
1904
+ }
1905
+ }
1906
+ `;var tn=Object.defineProperty,rn=Object.getOwnPropertyDescriptor,te=(o,e,t,r)=>{for(var n=r>1?void 0:r?rn(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&tn(e,t,n),n};let B=class extends p.LitElement{constructor(){super(...arguments),this.type="spinner",this.alignment="left",this.showText=!0,this.text=void 0}render(){return p.html`
1907
+ <div class="loader" role="status" aria-live="polite" aria-busy="true"></div>
1908
+ ${this.text&&this.showText?p.html`<span class="loader-text">${this.text}</span>`:""}
1909
+ `}};B.styles=[en],te([g.property({type:String,attribute:"type",reflect:!0})],B.prototype,"type",2),te([g.property({type:String,attribute:"alignment",reflect:!0})],B.prototype,"alignment",2),te([g.property({type:Boolean,attribute:"show-text"})],B.prototype,"showText",2),te([g.property({type:String,attribute:"text"})],B.prototype,"text",2),B=te([g.customElement("gaia-loader")],B);const nn=p.css`
1910
+ .menu {
1911
+ display: inline-flex;
1912
+ position: relative;
1913
+ }
1914
+
1915
+ .menu__button {
1916
+ display: inline-flex;
1917
+ border-radius: var(--radius-default);
1918
+ }
1919
+
1920
+ .menu__button.active {
1921
+ outline: var(--border-width-md) solid var(--border-focus);
1922
+ }
1923
+
1924
+ .menu__content {
1925
+ display: none;
1926
+ }
1927
+
1928
+ .menu__content.open {
1929
+ display: block;
1930
+ width: 206px;
1931
+ position: absolute;
1932
+ z-index: 1000;
1933
+ transform: translateY(var(--border-width-md)) translateX(var(--border-width-md));
1934
+ /* padding: var(--size-4) var(--size-0) var(--size-4) var(--size-8); */
1935
+ top: 100%;
1936
+ right: 0;
1937
+ background-color: var(--surface-primary);
1938
+ border: var(--border-width-sm) solid var(--border-primary);
1939
+ border-radius: var(--radius-default);
1940
+ box-shadow:
1941
+ -2px 0px 5px 0px #1334451a,
1942
+ -8px 0px 8px 0px #13344517,
1943
+ -19px 0px 11px 0px #1334450d,
1944
+ -34px 0px 14px 0px #13344503,
1945
+ -53px 0px 15px 0px #13344500;
1946
+ }
1947
+ `;var sn=Object.defineProperty,on=Object.getOwnPropertyDescriptor,ot=(o,e,t,r)=>{for(var n=r>1?void 0:r?on(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&sn(e,t,n),n};let me=class extends p.LitElement{constructor(){super(...arguments),this.open=!1,this.boundHandleClickOutside=this.handleClickOutside.bind(this)}toggleDropdown(o){o.stopPropagation(),this.open=!this.open,this.open?document.addEventListener("click",this.boundHandleClickOutside):document.removeEventListener("click",this.boundHandleClickOutside)}handleClickOutside(o){this.open&&!this.contains(o.target)&&(this.open=!1,document.removeEventListener("click",this.boundHandleClickOutside))}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this.boundHandleClickOutside)}render(){return p.html`
1948
+ <div class="menu">
1949
+ <div
1950
+ class=${N("menu__button",{active:this.open})}
1951
+ >
1952
+ <gaia-button
1953
+ variant="ghost"
1954
+ size="icon-sm"
1955
+ icon="ellipsis"
1956
+ @click=${this.toggleDropdown}
1957
+ ></gaia-button>
1958
+ </div>
1959
+ <div
1960
+ class=${N("menu__content",{open:this.open})}
1961
+ >
1962
+ <slot></slot>
1963
+ </div>
1964
+ </div>
1965
+ `}};me.styles=[nn],ot([g.state()],me.prototype,"open",2),me=ot([g.customElement("gaia-menu")],me);const an=p.css`
1966
+ .menu-item {
1967
+ display: flex;
1968
+ align-items: flex-start;
1969
+ gap: var(--size-8);
1970
+ padding: var(--size-8) var(--size-12) var(--size-8) var(--size-12);
1971
+ border-bottom-width: var(--border-width-sm);
1972
+ transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
1973
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
1974
+ transition-duration: 150ms;
1975
+ }
1976
+
1977
+ .menu-item:hover:not(.menu-item--disabled) {
1978
+ background-color: var(--surface-action-hover-2);
1979
+ cursor: pointer;
1980
+ }
1981
+
1982
+ .menu-item:hover:not(.menu-item--disabled) .menu-item__label {
1983
+ color: var(--text-action-hover);
1984
+ }
1985
+
1986
+ .menu-item__content {
1987
+ display: inline-flex;
1988
+ flex-direction: column;
1989
+ align-items: flex-start;
1990
+ justify-content: flex-start;
1991
+ width: 100%;
1992
+ flex: 1 1 0;
1993
+ }
1994
+
1995
+ .menu-item__label {
1996
+ display: inline-flex;
1997
+ align-items: center;
1998
+ height: var(--size-20);
1999
+ font-weight: var(--font-weight-medium);
2000
+ line-height: var(--size-16);
2001
+ color: var(--text-action);
2002
+ }
2003
+
2004
+ .menu-item__description {
2005
+ font-size: var(--font-size-xs);
2006
+ font-weight: var(--font-weight-regular);
2007
+ line-height: var(--lineheight-xs);
2008
+ letter-spacing: var(--tracking-xs);
2009
+ color: var(--text-disable-selected);
2010
+ }
2011
+
2012
+ .menu-item__icon {
2013
+ display: inline-flex;
2014
+ justify-content: center;
2015
+ align-items: center;
2016
+ padding-top: var(--size-2);
2017
+ padding-bottom: var(--size-2);
2018
+ }
2019
+
2020
+ .menu-item__icon svg {
2021
+ color: var(--icon-primary);
2022
+ width: var(--size-16);
2023
+ height: var(--size-16);
2024
+ }
2025
+
2026
+ .menu-item--disabled .menu-item__label {
2027
+ color: var(--text-disable-selected);
2028
+ }
2029
+
2030
+ .menu-item--disabled .menu-item__icon svg {
2031
+ color: var(--icon-on-disabled);
2032
+ }
2033
+
2034
+ .menu-item--disabled .menu-item__description {
2035
+ color: var(--text-disable-selected);
2036
+ }
2037
+ `;var ln=Object.defineProperty,cn=Object.getOwnPropertyDescriptor,re=(o,e,t,r)=>{for(var n=r>1?void 0:r?cn(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&ln(e,t,n),n};let q=class extends p.LitElement{constructor(){super(...arguments),this.disabled=!1}render(){return p.html`
2038
+ <div
2039
+ class="menu-item ${N({"menu-item--disabled":this.disabled})}"
2040
+ >
2041
+ ${this.iconLeft&&p.html`<div class="menu-item__icon menu-item__icon--left">
2042
+ ${ie.unsafeSVG(we[this.iconLeft])}
2043
+ </div>`}
2044
+ <span class="menu-item__content">
2045
+ <span class="menu-item__label">${this.label}</span>
2046
+ <span class="menu-item__description">
2047
+ <slot></slot>
2048
+ </span>
2049
+ </span>
2050
+ ${this.iconRight&&p.html`<div class="menu-item__icon menu-item__icon--right">
2051
+ ${ie.unsafeSVG(we[this.iconRight])}
2052
+ </div>`}
2053
+ </div>
2054
+ `}};q.styles=[an],re([g.property({type:Boolean})],q.prototype,"disabled",2),re([g.property({type:String})],q.prototype,"iconLeft",2),re([g.property({type:String})],q.prototype,"iconRight",2),re([g.property({type:String})],q.prototype,"label",2),q=re([g.customElement("gaia-menu-item")],q);const hn=p.css`
2055
+ :host {
2056
+ display: none;
2057
+ box-sizing: border-box;
2058
+ position: relative;
2059
+ height: 100%;
2060
+ width: 100%;
2061
+ background-color: var(--surface-primary);
2062
+ border: var(--border-width-sm) solid var(--color-neutral-20);
2063
+ box-shadow:
2064
+ -2px 0px 5px 0px #1334451a,
2065
+ -8px 0px 8px 0px #13344517,
2066
+ -19px 0px 11px 0px #1334450d,
2067
+ -34px 0px 14px 0px #13344503,
2068
+ -53px 0px 15px 0px #13344500;
2069
+ }
2070
+
2071
+ :host([open]) {
2072
+ display: flex;
2073
+ }
2074
+ `;var pn=Object.defineProperty,dn=Object.getOwnPropertyDescriptor,at=(o,e,t,r)=>{for(var n=r>1?void 0:r?dn(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&pn(e,t,n),n};b.Popover=class extends st{constructor(){super(...arguments),this.open=!0,this.boundHandleClickOutside=this.handleClickOutside.bind(this)}updated(e){e.has("open")&&this.toggle()}toggle(){this.open?document.addEventListener("click",this.boundHandleClickOutside):document.removeEventListener("click",this.boundHandleClickOutside)}handleClickOutside(e){this.open&&!this.contains(e.target)&&this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this.boundHandleClickOutside)}render(){return p.html` <slot></slot> `}},b.Popover.styles=[hn],at([g.property({type:Boolean,attribute:"open",reflect:!0})],b.Popover.prototype,"open",2),b.Popover=at([g.customElement("gaia-popover")],b.Popover);const gn=p.css`
2075
+ :host {
2076
+ align-items: center;
2077
+ }
2078
+
2079
+ :host:has(.spacing--horizontal) {
2080
+ display: flex;
2081
+ width: 100%;
2082
+ flex-direction: row;
2083
+ }
2084
+
2085
+ :host:has(.spacing--vertical) {
2086
+ display: inline-flex;
2087
+ height: 100%;
2088
+ flex-direction: column;
2089
+ }
2090
+
2091
+ .spacing {
2092
+ background-color: var(--border-primary);
2093
+ }
2094
+
2095
+ .spacing--horizontal {
2096
+ height: 1px;
2097
+ width: 100%;
2098
+ margin: var(--size-4) 0;
2099
+ }
2100
+
2101
+ .spacing--vertical {
2102
+ display: inline-flex;
2103
+ width: 1px;
2104
+ margin: 0 var(--size-4);
2105
+ height: var(--size-16);
2106
+ }
2107
+ `;var un=Object.defineProperty,fn=Object.getOwnPropertyDescriptor,lt=(o,e,t,r)=>{for(var n=r>1?void 0:r?fn(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&un(e,t,n),n};let ve=class extends p.LitElement{constructor(){super(...arguments),this.direction="horizontal"}render(){return p.html`
2108
+ <div
2109
+ class="spacing ${N({"spacing--vertical":this.direction==="vertical","spacing--horizontal":this.direction==="horizontal"})}"
2110
+ ></div>
2111
+ `}};ve.styles=[gn],lt([g.property({type:String})],ve.prototype,"direction",2),ve=lt([g.customElement("gaia-spacing")],ve);const mn=p.css`
2112
+ :host {
2113
+ position: relative;
2114
+ display: inline-flex;
2115
+ }
2116
+
2117
+ .tooltip {
2118
+ position: absolute;
2119
+ background-color: var(--surface-action-hover);
2120
+ display: flex;
2121
+ min-width: fit-content;
2122
+ width: max-content;
2123
+ max-width: 400px;
2124
+ flex-direction: column;
2125
+ gap: var(--size-4);
2126
+ padding: var(--size-8);
2127
+ border-radius: var(--radius-default);
2128
+ color: var(--text-on-action);
2129
+ pointer-events: none;
2130
+ z-index: 1000;
2131
+ opacity: 0;
2132
+ visibility: hidden;
2133
+ transition:
2134
+ opacity 300ms ease-in-out,
2135
+ visibility 300ms ease-in-out;
2136
+ }
2137
+
2138
+ .tooltip[open] {
2139
+ opacity: 1;
2140
+ visibility: visible;
2141
+ }
2142
+
2143
+ .tooltip::after {
2144
+ content: '';
2145
+ position: absolute;
2146
+ box-sizing: border-box;
2147
+ border-width: 8px;
2148
+ border-style: solid;
2149
+ }
2150
+
2151
+ .tooltip .tooltip__title {
2152
+ font-weight: var(--font-weight-semibold);
2153
+ }
2154
+
2155
+ .tooltip .tooltip__text {
2156
+ font-weight: var(--font-weight-regular);
2157
+ }
2158
+
2159
+ /* Bottom */
2160
+
2161
+ :host([position='bottom']) .tooltip {
2162
+ top: calc(100% + var(--size-10));
2163
+ }
2164
+
2165
+ :host([position='bottom']) .tooltip::after {
2166
+ bottom: 100%;
2167
+ border-color: transparent transparent var(--surface-action-hover) transparent;
2168
+ }
2169
+
2170
+ :host([position='bottom'][alignment='start']) .tooltip {
2171
+ left: 0;
2172
+ }
2173
+
2174
+ :host([position='bottom'][alignment='start']) .tooltip::after {
2175
+ left: var(--size-24);
2176
+ }
2177
+
2178
+ :host([position='bottom'][alignment='center']) .tooltip {
2179
+ left: 50%;
2180
+ transform: translateX(-50%);
2181
+ }
2182
+
2183
+ :host([position='bottom'][alignment='center']) .tooltip::after {
2184
+ left: 50%;
2185
+ transform: translateX(-50%);
2186
+ }
2187
+
2188
+ :host([position='bottom'][alignment='end']) .tooltip {
2189
+ right: 0;
2190
+ }
2191
+
2192
+ :host([position='bottom'][alignment='end']) .tooltip::after {
2193
+ right: var(--size-24);
2194
+ }
2195
+
2196
+ /* Right */
2197
+
2198
+ :host([position='right']) .tooltip {
2199
+ left: calc(100% + var(--size-10));
2200
+ }
2201
+
2202
+ :host([position='right']) .tooltip::after {
2203
+ right: 100%;
2204
+ border-color: transparent var(--surface-action-hover) transparent transparent;
2205
+ }
2206
+
2207
+ :host([position='right'][alignment='start']) .tooltip {
2208
+ top: 0;
2209
+ }
2210
+
2211
+ :host([position='right'][alignment='start']) .tooltip::after {
2212
+ top: var(--size-24);
2213
+ }
2214
+
2215
+ :host([position='right'][alignment='center']) .tooltip {
2216
+ top: 50%;
2217
+ transform: translateY(-50%);
2218
+ }
2219
+
2220
+ :host([position='right'][alignment='center']) .tooltip::after {
2221
+ top: 50%;
2222
+ transform: translateY(-50%);
2223
+ }
2224
+
2225
+ :host([position='right'][alignment='end']) .tooltip {
2226
+ bottom: 0;
2227
+ }
2228
+
2229
+ :host([position='right'][alignment='end']) .tooltip::after {
2230
+ bottom: var(--size-24);
2231
+ }
2232
+
2233
+ /* Top */
2234
+
2235
+ :host([position='top']) .tooltip {
2236
+ bottom: calc(100% + var(--size-10));
2237
+ }
2238
+
2239
+ :host([position='top']) .tooltip::after {
2240
+ top: 100%;
2241
+ border-color: var(--surface-action-hover) transparent transparent transparent;
2242
+ }
2243
+
2244
+ :host([position='top'][alignment='start']) .tooltip {
2245
+ left: 0;
2246
+ }
2247
+
2248
+ :host([position='top'][alignment='start']) .tooltip::after {
2249
+ left: var(--size-24);
2250
+ }
2251
+
2252
+ :host([position='top'][alignment='center']) .tooltip {
2253
+ left: 50%;
2254
+ transform: translateX(-50%);
2255
+ }
2256
+
2257
+ :host([position='top'][alignment='center']) .tooltip::after {
2258
+ left: 50%;
2259
+ transform: translateX(-50%);
2260
+ }
2261
+
2262
+ :host([position='top'][alignment='end']) .tooltip {
2263
+ right: 0;
2264
+ }
2265
+
2266
+ :host([position='top'][alignment='end']) .tooltip::after {
2267
+ right: var(--size-24);
2268
+ }
2269
+
2270
+ /* Left */
2271
+
2272
+ :host([position='left']) .tooltip {
2273
+ right: calc(100% + var(--size-10));
2274
+ }
2275
+
2276
+ :host([position='left']) .tooltip::after {
2277
+ left: 100%;
2278
+ border-color: transparent transparent transparent var(--surface-action-hover);
2279
+ }
2280
+
2281
+ :host([position='left'][alignment='start']) .tooltip {
2282
+ top: 0;
2283
+ }
2284
+
2285
+ :host([position='left'][alignment='start']) .tooltip::after {
2286
+ top: var(--size-24);
2287
+ }
2288
+
2289
+ :host([position='left'][alignment='center']) .tooltip {
2290
+ top: 50%;
2291
+ transform: translateY(-50%);
2292
+ }
2293
+
2294
+ :host([position='left'][alignment='center']) .tooltip::after {
2295
+ top: 50%;
2296
+ transform: translateY(-50%);
2297
+ }
2298
+
2299
+ :host([position='left'][alignment='end']) .tooltip {
2300
+ bottom: 0;
2301
+ }
2302
+
2303
+ :host([position='left'][alignment='end']) .tooltip::after {
2304
+ bottom: var(--size-24);
2305
+ }
2306
+ `;var vn=Object.defineProperty,bn=Object.getOwnPropertyDescriptor,M=(o,e,t,r)=>{for(var n=r>1?void 0:r?bn(e,t):e,i=o.length-1,s;i>=0;i--)(s=o[i])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&vn(e,t,n),n};let T=class extends p.LitElement{constructor(){super(...arguments),this._open=!1,this.position="top",this.alignment="center",this.title="",this.text="",this.delay=500,this.disabled=!0}_show(){this.disabled||(this._timeoutId=window.setTimeout(()=>{this._open=!0},this.delay))}_hide(){this._timeoutId&&(clearTimeout(this._timeoutId),this._timeoutId=void 0),this._open=!1}render(){return p.html`
2307
+ <slot @mouseenter=${this._show} @mouseleave=${this._hide}></slot>
2308
+ <div class="tooltip" ?open=${this._open}>
2309
+ ${this.title&&this.title.length>0?p.html`<div class="tooltip__title">${this.title}</div>`:null}
2310
+ <div class="tooltip__text">${this.text}</div>
2311
+ </div>
2312
+ `}};T.styles=[mn],M([g.state()],T.prototype,"_open",2),M([g.property({type:String,attribute:"position",reflect:!0})],T.prototype,"position",2),M([g.property({type:String,attribute:"alignment",reflect:!0})],T.prototype,"alignment",2),M([g.property({type:String,attribute:"title"})],T.prototype,"title",2),M([g.property({type:String,attribute:"text"})],T.prototype,"text",2),M([g.property({type:Number,attribute:"delay"})],T.prototype,"delay",2),M([g.property({type:Boolean,attribute:"disabled"})],T.prototype,"disabled",2),T=M([g.customElement("gaia-tooltip")],T),Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})});
2313
+ //# sourceMappingURL=gaia-chat-ui.umd.js.map