obi-sdk 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,826 @@
1
+ const t$3 = globalThis, e$5 = t$3.ShadowRoot && (void 0 === t$3.ShadyCSS || t$3.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, s$4 = Symbol(), o$7 = /* @__PURE__ */ new WeakMap();
2
+ let n$6 = class n {
3
+ constructor(t2, e2, o2) {
4
+ if (this._$cssResult$ = true, o2 !== s$4)
5
+ throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
6
+ this.cssText = t2, this.t = e2;
7
+ }
8
+ get styleSheet() {
9
+ let t2 = this.o;
10
+ const s2 = this.t;
11
+ if (e$5 && void 0 === t2) {
12
+ const e2 = void 0 !== s2 && 1 === s2.length;
13
+ e2 && (t2 = o$7.get(s2)), void 0 === t2 && ((this.o = t2 = new CSSStyleSheet()).replaceSync(this.cssText), e2 && o$7.set(s2, t2));
14
+ }
15
+ return t2;
16
+ }
17
+ toString() {
18
+ return this.cssText;
19
+ }
20
+ };
21
+ const r$6 = (t2) => new n$6("string" == typeof t2 ? t2 : t2 + "", void 0, s$4), i$5 = (t2, ...e2) => {
22
+ const o2 = 1 === t2.length ? t2[0] : e2.reduce((e3, s2, o3) => e3 + ((t3) => {
23
+ if (true === t3._$cssResult$)
24
+ return t3.cssText;
25
+ if ("number" == typeof t3)
26
+ return t3;
27
+ throw Error("Value passed to 'css' function must be a 'css' function result: " + t3 + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
28
+ })(s2) + t2[o3 + 1], t2[0]);
29
+ return new n$6(o2, t2, s$4);
30
+ }, S$2 = (s2, o2) => {
31
+ if (e$5)
32
+ s2.adoptedStyleSheets = o2.map((t2) => t2 instanceof CSSStyleSheet ? t2 : t2.styleSheet);
33
+ else
34
+ for (const e2 of o2) {
35
+ const o3 = document.createElement("style"), n3 = t$3.litNonce;
36
+ void 0 !== n3 && o3.setAttribute("nonce", n3), o3.textContent = e2.cssText, s2.appendChild(o3);
37
+ }
38
+ }, c$4 = e$5 ? (t2) => t2 : (t2) => t2 instanceof CSSStyleSheet ? ((t3) => {
39
+ let e2 = "";
40
+ for (const s2 of t3.cssRules)
41
+ e2 += s2.cssText;
42
+ return r$6(e2);
43
+ })(t2) : t2;
44
+ const { is: i$4, defineProperty: e$4, getOwnPropertyDescriptor: h$4, getOwnPropertyNames: r$5, getOwnPropertySymbols: o$6, getPrototypeOf: n$5 } = Object, a$2 = globalThis, c$3 = a$2.trustedTypes, l$2 = c$3 ? c$3.emptyScript : "", p$2 = a$2.reactiveElementPolyfillSupport, d$2 = (t2, s2) => t2, u$2 = { toAttribute(t2, s2) {
45
+ switch (s2) {
46
+ case Boolean:
47
+ t2 = t2 ? l$2 : null;
48
+ break;
49
+ case Object:
50
+ case Array:
51
+ t2 = null == t2 ? t2 : JSON.stringify(t2);
52
+ }
53
+ return t2;
54
+ }, fromAttribute(t2, s2) {
55
+ let i3 = t2;
56
+ switch (s2) {
57
+ case Boolean:
58
+ i3 = null !== t2;
59
+ break;
60
+ case Number:
61
+ i3 = null === t2 ? null : Number(t2);
62
+ break;
63
+ case Object:
64
+ case Array:
65
+ try {
66
+ i3 = JSON.parse(t2);
67
+ } catch (t3) {
68
+ i3 = null;
69
+ }
70
+ }
71
+ return i3;
72
+ } }, f$4 = (t2, s2) => !i$4(t2, s2), b$2 = { attribute: true, type: String, converter: u$2, reflect: false, useDefault: false, hasChanged: f$4 };
73
+ Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), a$2.litPropertyMetadata ?? (a$2.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
74
+ let y$2 = class y extends HTMLElement {
75
+ static addInitializer(t2) {
76
+ this._$Ei(), (this.l ?? (this.l = [])).push(t2);
77
+ }
78
+ static get observedAttributes() {
79
+ return this.finalize(), this._$Eh && [...this._$Eh.keys()];
80
+ }
81
+ static createProperty(t2, s2 = b$2) {
82
+ if (s2.state && (s2.attribute = false), this._$Ei(), this.prototype.hasOwnProperty(t2) && ((s2 = Object.create(s2)).wrapped = true), this.elementProperties.set(t2, s2), !s2.noAccessor) {
83
+ const i3 = Symbol(), h2 = this.getPropertyDescriptor(t2, i3, s2);
84
+ void 0 !== h2 && e$4(this.prototype, t2, h2);
85
+ }
86
+ }
87
+ static getPropertyDescriptor(t2, s2, i3) {
88
+ const { get: e2, set: r2 } = h$4(this.prototype, t2) ?? { get() {
89
+ return this[s2];
90
+ }, set(t3) {
91
+ this[s2] = t3;
92
+ } };
93
+ return { get: e2, set(s3) {
94
+ const h2 = e2?.call(this);
95
+ r2?.call(this, s3), this.requestUpdate(t2, h2, i3);
96
+ }, configurable: true, enumerable: true };
97
+ }
98
+ static getPropertyOptions(t2) {
99
+ return this.elementProperties.get(t2) ?? b$2;
100
+ }
101
+ static _$Ei() {
102
+ if (this.hasOwnProperty(d$2("elementProperties")))
103
+ return;
104
+ const t2 = n$5(this);
105
+ t2.finalize(), void 0 !== t2.l && (this.l = [...t2.l]), this.elementProperties = new Map(t2.elementProperties);
106
+ }
107
+ static finalize() {
108
+ if (this.hasOwnProperty(d$2("finalized")))
109
+ return;
110
+ if (this.finalized = true, this._$Ei(), this.hasOwnProperty(d$2("properties"))) {
111
+ const t3 = this.properties, s2 = [...r$5(t3), ...o$6(t3)];
112
+ for (const i3 of s2)
113
+ this.createProperty(i3, t3[i3]);
114
+ }
115
+ const t2 = this[Symbol.metadata];
116
+ if (null !== t2) {
117
+ const s2 = litPropertyMetadata.get(t2);
118
+ if (void 0 !== s2)
119
+ for (const [t3, i3] of s2)
120
+ this.elementProperties.set(t3, i3);
121
+ }
122
+ this._$Eh = /* @__PURE__ */ new Map();
123
+ for (const [t3, s2] of this.elementProperties) {
124
+ const i3 = this._$Eu(t3, s2);
125
+ void 0 !== i3 && this._$Eh.set(i3, t3);
126
+ }
127
+ this.elementStyles = this.finalizeStyles(this.styles);
128
+ }
129
+ static finalizeStyles(s2) {
130
+ const i3 = [];
131
+ if (Array.isArray(s2)) {
132
+ const e2 = new Set(s2.flat(1 / 0).reverse());
133
+ for (const s3 of e2)
134
+ i3.unshift(c$4(s3));
135
+ } else
136
+ void 0 !== s2 && i3.push(c$4(s2));
137
+ return i3;
138
+ }
139
+ static _$Eu(t2, s2) {
140
+ const i3 = s2.attribute;
141
+ return false === i3 ? void 0 : "string" == typeof i3 ? i3 : "string" == typeof t2 ? t2.toLowerCase() : void 0;
142
+ }
143
+ constructor() {
144
+ super(), this._$Ep = void 0, this.isUpdatePending = false, this.hasUpdated = false, this._$Em = null, this._$Ev();
145
+ }
146
+ _$Ev() {
147
+ this._$ES = new Promise((t2) => this.enableUpdating = t2), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach((t2) => t2(this));
148
+ }
149
+ addController(t2) {
150
+ (this._$EO ?? (this._$EO = /* @__PURE__ */ new Set())).add(t2), void 0 !== this.renderRoot && this.isConnected && t2.hostConnected?.();
151
+ }
152
+ removeController(t2) {
153
+ this._$EO?.delete(t2);
154
+ }
155
+ _$E_() {
156
+ const t2 = /* @__PURE__ */ new Map(), s2 = this.constructor.elementProperties;
157
+ for (const i3 of s2.keys())
158
+ this.hasOwnProperty(i3) && (t2.set(i3, this[i3]), delete this[i3]);
159
+ t2.size > 0 && (this._$Ep = t2);
160
+ }
161
+ createRenderRoot() {
162
+ const t2 = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
163
+ return S$2(t2, this.constructor.elementStyles), t2;
164
+ }
165
+ connectedCallback() {
166
+ this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this.enableUpdating(true), this._$EO?.forEach((t2) => t2.hostConnected?.());
167
+ }
168
+ enableUpdating(t2) {
169
+ }
170
+ disconnectedCallback() {
171
+ this._$EO?.forEach((t2) => t2.hostDisconnected?.());
172
+ }
173
+ attributeChangedCallback(t2, s2, i3) {
174
+ this._$AK(t2, i3);
175
+ }
176
+ _$ET(t2, s2) {
177
+ const i3 = this.constructor.elementProperties.get(t2), e2 = this.constructor._$Eu(t2, i3);
178
+ if (void 0 !== e2 && true === i3.reflect) {
179
+ const h2 = (void 0 !== i3.converter?.toAttribute ? i3.converter : u$2).toAttribute(s2, i3.type);
180
+ this._$Em = t2, null == h2 ? this.removeAttribute(e2) : this.setAttribute(e2, h2), this._$Em = null;
181
+ }
182
+ }
183
+ _$AK(t2, s2) {
184
+ const i3 = this.constructor, e2 = i3._$Eh.get(t2);
185
+ if (void 0 !== e2 && this._$Em !== e2) {
186
+ const t3 = i3.getPropertyOptions(e2), h2 = "function" == typeof t3.converter ? { fromAttribute: t3.converter } : void 0 !== t3.converter?.fromAttribute ? t3.converter : u$2;
187
+ this._$Em = e2, this[e2] = h2.fromAttribute(s2, t3.type) ?? this._$Ej?.get(e2) ?? null, this._$Em = null;
188
+ }
189
+ }
190
+ requestUpdate(t2, s2, i3) {
191
+ if (void 0 !== t2) {
192
+ const e2 = this.constructor, h2 = this[t2];
193
+ if (i3 ?? (i3 = e2.getPropertyOptions(t2)), !((i3.hasChanged ?? f$4)(h2, s2) || i3.useDefault && i3.reflect && h2 === this._$Ej?.get(t2) && !this.hasAttribute(e2._$Eu(t2, i3))))
194
+ return;
195
+ this.C(t2, s2, i3);
196
+ }
197
+ false === this.isUpdatePending && (this._$ES = this._$EP());
198
+ }
199
+ C(t2, s2, { useDefault: i3, reflect: e2, wrapped: h2 }, r2) {
200
+ i3 && !(this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Map())).has(t2) && (this._$Ej.set(t2, r2 ?? s2 ?? this[t2]), true !== h2 || void 0 !== r2) || (this._$AL.has(t2) || (this.hasUpdated || i3 || (s2 = void 0), this._$AL.set(t2, s2)), true === e2 && this._$Em !== t2 && (this._$Eq ?? (this._$Eq = /* @__PURE__ */ new Set())).add(t2));
201
+ }
202
+ async _$EP() {
203
+ this.isUpdatePending = true;
204
+ try {
205
+ await this._$ES;
206
+ } catch (t3) {
207
+ Promise.reject(t3);
208
+ }
209
+ const t2 = this.scheduleUpdate();
210
+ return null != t2 && await t2, !this.isUpdatePending;
211
+ }
212
+ scheduleUpdate() {
213
+ return this.performUpdate();
214
+ }
215
+ performUpdate() {
216
+ if (!this.isUpdatePending)
217
+ return;
218
+ if (!this.hasUpdated) {
219
+ if (this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this._$Ep) {
220
+ for (const [t4, s3] of this._$Ep)
221
+ this[t4] = s3;
222
+ this._$Ep = void 0;
223
+ }
224
+ const t3 = this.constructor.elementProperties;
225
+ if (t3.size > 0)
226
+ for (const [s3, i3] of t3) {
227
+ const { wrapped: t4 } = i3, e2 = this[s3];
228
+ true !== t4 || this._$AL.has(s3) || void 0 === e2 || this.C(s3, void 0, i3, e2);
229
+ }
230
+ }
231
+ let t2 = false;
232
+ const s2 = this._$AL;
233
+ try {
234
+ t2 = this.shouldUpdate(s2), t2 ? (this.willUpdate(s2), this._$EO?.forEach((t3) => t3.hostUpdate?.()), this.update(s2)) : this._$EM();
235
+ } catch (s3) {
236
+ throw t2 = false, this._$EM(), s3;
237
+ }
238
+ t2 && this._$AE(s2);
239
+ }
240
+ willUpdate(t2) {
241
+ }
242
+ _$AE(t2) {
243
+ this._$EO?.forEach((t3) => t3.hostUpdated?.()), this.hasUpdated || (this.hasUpdated = true, this.firstUpdated(t2)), this.updated(t2);
244
+ }
245
+ _$EM() {
246
+ this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = false;
247
+ }
248
+ get updateComplete() {
249
+ return this.getUpdateComplete();
250
+ }
251
+ getUpdateComplete() {
252
+ return this._$ES;
253
+ }
254
+ shouldUpdate(t2) {
255
+ return true;
256
+ }
257
+ update(t2) {
258
+ this._$Eq && (this._$Eq = this._$Eq.forEach((t3) => this._$ET(t3, this[t3]))), this._$EM();
259
+ }
260
+ updated(t2) {
261
+ }
262
+ firstUpdated(t2) {
263
+ }
264
+ };
265
+ y$2.elementStyles = [], y$2.shadowRootOptions = { mode: "open" }, y$2[d$2("elementProperties")] = /* @__PURE__ */ new Map(), y$2[d$2("finalized")] = /* @__PURE__ */ new Map(), p$2?.({ ReactiveElement: y$2 }), (a$2.reactiveElementVersions ?? (a$2.reactiveElementVersions = [])).push("2.1.0");
266
+ const t$2 = globalThis, i$3 = t$2.trustedTypes, s$3 = i$3 ? i$3.createPolicy("lit-html", { createHTML: (t2) => t2 }) : void 0, e$3 = "$lit$", h$3 = `lit$${Math.random().toFixed(9).slice(2)}$`, o$5 = "?" + h$3, n$4 = `<${o$5}>`, r$4 = document, l$1 = () => r$4.createComment(""), c$2 = (t2) => null === t2 || "object" != typeof t2 && "function" != typeof t2, a$1 = Array.isArray, u$1 = (t2) => a$1(t2) || "function" == typeof t2?.[Symbol.iterator], d$1 = "[ \n\f\r]", f$3 = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, v$1 = /-->/g, _$1 = />/g, m$1 = RegExp(`>|${d$1}(?:([^\\s"'>=/]+)(${d$1}*=${d$1}*(?:[^
267
+ \f\r"'\`<>=]|("|')|))|$)`, "g"), p$1 = /'/g, g$1 = /"/g, $$1 = /^(?:script|style|textarea|title)$/i, y$1 = (t2) => (i3, ...s2) => ({ _$litType$: t2, strings: i3, values: s2 }), x$1 = y$1(1), b$1 = y$1(2), T$1 = Symbol.for("lit-noChange"), E$1 = Symbol.for("lit-nothing"), A$1 = /* @__PURE__ */ new WeakMap(), C = r$4.createTreeWalker(r$4, 129);
268
+ function P$1(t2, i3) {
269
+ if (!a$1(t2) || !t2.hasOwnProperty("raw"))
270
+ throw Error("invalid template strings array");
271
+ return void 0 !== s$3 ? s$3.createHTML(i3) : i3;
272
+ }
273
+ const V = (t2, i3) => {
274
+ const s2 = t2.length - 1, o2 = [];
275
+ let r2, l2 = 2 === i3 ? "<svg>" : 3 === i3 ? "<math>" : "", c2 = f$3;
276
+ for (let i4 = 0; i4 < s2; i4++) {
277
+ const s3 = t2[i4];
278
+ let a2, u2, d2 = -1, y3 = 0;
279
+ for (; y3 < s3.length && (c2.lastIndex = y3, u2 = c2.exec(s3), null !== u2); )
280
+ y3 = c2.lastIndex, c2 === f$3 ? "!--" === u2[1] ? c2 = v$1 : void 0 !== u2[1] ? c2 = _$1 : void 0 !== u2[2] ? ($$1.test(u2[2]) && (r2 = RegExp("</" + u2[2], "g")), c2 = m$1) : void 0 !== u2[3] && (c2 = m$1) : c2 === m$1 ? ">" === u2[0] ? (c2 = r2 ?? f$3, d2 = -1) : void 0 === u2[1] ? d2 = -2 : (d2 = c2.lastIndex - u2[2].length, a2 = u2[1], c2 = void 0 === u2[3] ? m$1 : '"' === u2[3] ? g$1 : p$1) : c2 === g$1 || c2 === p$1 ? c2 = m$1 : c2 === v$1 || c2 === _$1 ? c2 = f$3 : (c2 = m$1, r2 = void 0);
281
+ const x2 = c2 === m$1 && t2[i4 + 1].startsWith("/>") ? " " : "";
282
+ l2 += c2 === f$3 ? s3 + n$4 : d2 >= 0 ? (o2.push(a2), s3.slice(0, d2) + e$3 + s3.slice(d2) + h$3 + x2) : s3 + h$3 + (-2 === d2 ? i4 : x2);
283
+ }
284
+ return [P$1(t2, l2 + (t2[s2] || "<?>") + (2 === i3 ? "</svg>" : 3 === i3 ? "</math>" : "")), o2];
285
+ };
286
+ let N$1 = class N {
287
+ constructor({ strings: t2, _$litType$: s2 }, n3) {
288
+ let r2;
289
+ this.parts = [];
290
+ let c2 = 0, a2 = 0;
291
+ const u2 = t2.length - 1, d2 = this.parts, [f2, v2] = V(t2, s2);
292
+ if (this.el = N.createElement(f2, n3), C.currentNode = this.el.content, 2 === s2 || 3 === s2) {
293
+ const t3 = this.el.content.firstChild;
294
+ t3.replaceWith(...t3.childNodes);
295
+ }
296
+ for (; null !== (r2 = C.nextNode()) && d2.length < u2; ) {
297
+ if (1 === r2.nodeType) {
298
+ if (r2.hasAttributes())
299
+ for (const t3 of r2.getAttributeNames())
300
+ if (t3.endsWith(e$3)) {
301
+ const i3 = v2[a2++], s3 = r2.getAttribute(t3).split(h$3), e2 = /([.?@])?(.*)/.exec(i3);
302
+ d2.push({ type: 1, index: c2, name: e2[2], strings: s3, ctor: "." === e2[1] ? H : "?" === e2[1] ? I$1 : "@" === e2[1] ? L$1 : k$1 }), r2.removeAttribute(t3);
303
+ } else
304
+ t3.startsWith(h$3) && (d2.push({ type: 6, index: c2 }), r2.removeAttribute(t3));
305
+ if ($$1.test(r2.tagName)) {
306
+ const t3 = r2.textContent.split(h$3), s3 = t3.length - 1;
307
+ if (s3 > 0) {
308
+ r2.textContent = i$3 ? i$3.emptyScript : "";
309
+ for (let i3 = 0; i3 < s3; i3++)
310
+ r2.append(t3[i3], l$1()), C.nextNode(), d2.push({ type: 2, index: ++c2 });
311
+ r2.append(t3[s3], l$1());
312
+ }
313
+ }
314
+ } else if (8 === r2.nodeType)
315
+ if (r2.data === o$5)
316
+ d2.push({ type: 2, index: c2 });
317
+ else {
318
+ let t3 = -1;
319
+ for (; -1 !== (t3 = r2.data.indexOf(h$3, t3 + 1)); )
320
+ d2.push({ type: 7, index: c2 }), t3 += h$3.length - 1;
321
+ }
322
+ c2++;
323
+ }
324
+ }
325
+ static createElement(t2, i3) {
326
+ const s2 = r$4.createElement("template");
327
+ return s2.innerHTML = t2, s2;
328
+ }
329
+ };
330
+ function S$1(t2, i3, s2 = t2, e2) {
331
+ if (i3 === T$1)
332
+ return i3;
333
+ let h2 = void 0 !== e2 ? s2._$Co?.[e2] : s2._$Cl;
334
+ const o2 = c$2(i3) ? void 0 : i3._$litDirective$;
335
+ return h2?.constructor !== o2 && (h2?._$AO?.(false), void 0 === o2 ? h2 = void 0 : (h2 = new o2(t2), h2._$AT(t2, s2, e2)), void 0 !== e2 ? (s2._$Co ?? (s2._$Co = []))[e2] = h2 : s2._$Cl = h2), void 0 !== h2 && (i3 = S$1(t2, h2._$AS(t2, i3.values), h2, e2)), i3;
336
+ }
337
+ class M {
338
+ constructor(t2, i3) {
339
+ this._$AV = [], this._$AN = void 0, this._$AD = t2, this._$AM = i3;
340
+ }
341
+ get parentNode() {
342
+ return this._$AM.parentNode;
343
+ }
344
+ get _$AU() {
345
+ return this._$AM._$AU;
346
+ }
347
+ u(t2) {
348
+ const { el: { content: i3 }, parts: s2 } = this._$AD, e2 = (t2?.creationScope ?? r$4).importNode(i3, true);
349
+ C.currentNode = e2;
350
+ let h2 = C.nextNode(), o2 = 0, n3 = 0, l2 = s2[0];
351
+ for (; void 0 !== l2; ) {
352
+ if (o2 === l2.index) {
353
+ let i4;
354
+ 2 === l2.type ? i4 = new R(h2, h2.nextSibling, this, t2) : 1 === l2.type ? i4 = new l2.ctor(h2, l2.name, l2.strings, this, t2) : 6 === l2.type && (i4 = new z$2(h2, this, t2)), this._$AV.push(i4), l2 = s2[++n3];
355
+ }
356
+ o2 !== l2?.index && (h2 = C.nextNode(), o2++);
357
+ }
358
+ return C.currentNode = r$4, e2;
359
+ }
360
+ p(t2) {
361
+ let i3 = 0;
362
+ for (const s2 of this._$AV)
363
+ void 0 !== s2 && (void 0 !== s2.strings ? (s2._$AI(t2, s2, i3), i3 += s2.strings.length - 2) : s2._$AI(t2[i3])), i3++;
364
+ }
365
+ }
366
+ class R {
367
+ get _$AU() {
368
+ return this._$AM?._$AU ?? this._$Cv;
369
+ }
370
+ constructor(t2, i3, s2, e2) {
371
+ this.type = 2, this._$AH = E$1, this._$AN = void 0, this._$AA = t2, this._$AB = i3, this._$AM = s2, this.options = e2, this._$Cv = e2?.isConnected ?? true;
372
+ }
373
+ get parentNode() {
374
+ let t2 = this._$AA.parentNode;
375
+ const i3 = this._$AM;
376
+ return void 0 !== i3 && 11 === t2?.nodeType && (t2 = i3.parentNode), t2;
377
+ }
378
+ get startNode() {
379
+ return this._$AA;
380
+ }
381
+ get endNode() {
382
+ return this._$AB;
383
+ }
384
+ _$AI(t2, i3 = this) {
385
+ t2 = S$1(this, t2, i3), c$2(t2) ? t2 === E$1 || null == t2 || "" === t2 ? (this._$AH !== E$1 && this._$AR(), this._$AH = E$1) : t2 !== this._$AH && t2 !== T$1 && this._(t2) : void 0 !== t2._$litType$ ? this.$(t2) : void 0 !== t2.nodeType ? this.T(t2) : u$1(t2) ? this.k(t2) : this._(t2);
386
+ }
387
+ O(t2) {
388
+ return this._$AA.parentNode.insertBefore(t2, this._$AB);
389
+ }
390
+ T(t2) {
391
+ this._$AH !== t2 && (this._$AR(), this._$AH = this.O(t2));
392
+ }
393
+ _(t2) {
394
+ this._$AH !== E$1 && c$2(this._$AH) ? this._$AA.nextSibling.data = t2 : this.T(r$4.createTextNode(t2)), this._$AH = t2;
395
+ }
396
+ $(t2) {
397
+ const { values: i3, _$litType$: s2 } = t2, e2 = "number" == typeof s2 ? this._$AC(t2) : (void 0 === s2.el && (s2.el = N$1.createElement(P$1(s2.h, s2.h[0]), this.options)), s2);
398
+ if (this._$AH?._$AD === e2)
399
+ this._$AH.p(i3);
400
+ else {
401
+ const t3 = new M(e2, this), s3 = t3.u(this.options);
402
+ t3.p(i3), this.T(s3), this._$AH = t3;
403
+ }
404
+ }
405
+ _$AC(t2) {
406
+ let i3 = A$1.get(t2.strings);
407
+ return void 0 === i3 && A$1.set(t2.strings, i3 = new N$1(t2)), i3;
408
+ }
409
+ k(t2) {
410
+ a$1(this._$AH) || (this._$AH = [], this._$AR());
411
+ const i3 = this._$AH;
412
+ let s2, e2 = 0;
413
+ for (const h2 of t2)
414
+ e2 === i3.length ? i3.push(s2 = new R(this.O(l$1()), this.O(l$1()), this, this.options)) : s2 = i3[e2], s2._$AI(h2), e2++;
415
+ e2 < i3.length && (this._$AR(s2 && s2._$AB.nextSibling, e2), i3.length = e2);
416
+ }
417
+ _$AR(t2 = this._$AA.nextSibling, i3) {
418
+ for (this._$AP?.(false, true, i3); t2 && t2 !== this._$AB; ) {
419
+ const i4 = t2.nextSibling;
420
+ t2.remove(), t2 = i4;
421
+ }
422
+ }
423
+ setConnected(t2) {
424
+ void 0 === this._$AM && (this._$Cv = t2, this._$AP?.(t2));
425
+ }
426
+ }
427
+ let k$1 = class k {
428
+ get tagName() {
429
+ return this.element.tagName;
430
+ }
431
+ get _$AU() {
432
+ return this._$AM._$AU;
433
+ }
434
+ constructor(t2, i3, s2, e2, h2) {
435
+ this.type = 1, this._$AH = E$1, this._$AN = void 0, this.element = t2, this.name = i3, this._$AM = e2, this.options = h2, s2.length > 2 || "" !== s2[0] || "" !== s2[1] ? (this._$AH = Array(s2.length - 1).fill(new String()), this.strings = s2) : this._$AH = E$1;
436
+ }
437
+ _$AI(t2, i3 = this, s2, e2) {
438
+ const h2 = this.strings;
439
+ let o2 = false;
440
+ if (void 0 === h2)
441
+ t2 = S$1(this, t2, i3, 0), o2 = !c$2(t2) || t2 !== this._$AH && t2 !== T$1, o2 && (this._$AH = t2);
442
+ else {
443
+ const e3 = t2;
444
+ let n3, r2;
445
+ for (t2 = h2[0], n3 = 0; n3 < h2.length - 1; n3++)
446
+ r2 = S$1(this, e3[s2 + n3], i3, n3), r2 === T$1 && (r2 = this._$AH[n3]), o2 || (o2 = !c$2(r2) || r2 !== this._$AH[n3]), r2 === E$1 ? t2 = E$1 : t2 !== E$1 && (t2 += (r2 ?? "") + h2[n3 + 1]), this._$AH[n3] = r2;
447
+ }
448
+ o2 && !e2 && this.j(t2);
449
+ }
450
+ j(t2) {
451
+ t2 === E$1 ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t2 ?? "");
452
+ }
453
+ };
454
+ class H extends k$1 {
455
+ constructor() {
456
+ super(...arguments), this.type = 3;
457
+ }
458
+ j(t2) {
459
+ this.element[this.name] = t2 === E$1 ? void 0 : t2;
460
+ }
461
+ }
462
+ let I$1 = class I extends k$1 {
463
+ constructor() {
464
+ super(...arguments), this.type = 4;
465
+ }
466
+ j(t2) {
467
+ this.element.toggleAttribute(this.name, !!t2 && t2 !== E$1);
468
+ }
469
+ };
470
+ let L$1 = class L extends k$1 {
471
+ constructor(t2, i3, s2, e2, h2) {
472
+ super(t2, i3, s2, e2, h2), this.type = 5;
473
+ }
474
+ _$AI(t2, i3 = this) {
475
+ if ((t2 = S$1(this, t2, i3, 0) ?? E$1) === T$1)
476
+ return;
477
+ const s2 = this._$AH, e2 = t2 === E$1 && s2 !== E$1 || t2.capture !== s2.capture || t2.once !== s2.once || t2.passive !== s2.passive, h2 = t2 !== E$1 && (s2 === E$1 || e2);
478
+ e2 && this.element.removeEventListener(this.name, this, s2), h2 && this.element.addEventListener(this.name, this, t2), this._$AH = t2;
479
+ }
480
+ handleEvent(t2) {
481
+ "function" == typeof this._$AH ? this._$AH.call(this.options?.host ?? this.element, t2) : this._$AH.handleEvent(t2);
482
+ }
483
+ };
484
+ let z$2 = class z {
485
+ constructor(t2, i3, s2) {
486
+ this.element = t2, this.type = 6, this._$AN = void 0, this._$AM = i3, this.options = s2;
487
+ }
488
+ get _$AU() {
489
+ return this._$AM._$AU;
490
+ }
491
+ _$AI(t2) {
492
+ S$1(this, t2);
493
+ }
494
+ };
495
+ const j$1 = t$2.litHtmlPolyfillSupport;
496
+ j$1?.(N$1, R), (t$2.litHtmlVersions ?? (t$2.litHtmlVersions = [])).push("3.3.0");
497
+ const B$1 = (t2, i3, s2) => {
498
+ const e2 = s2?.renderBefore ?? i3;
499
+ let h2 = e2._$litPart$;
500
+ if (void 0 === h2) {
501
+ const t3 = s2?.renderBefore ?? null;
502
+ e2._$litPart$ = h2 = new R(i3.insertBefore(l$1(), t3), t3, void 0, s2 ?? {});
503
+ }
504
+ return h2._$AI(t2), h2;
505
+ };
506
+ const s$2 = globalThis;
507
+ let i$2 = class i extends y$2 {
508
+ constructor() {
509
+ super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
510
+ }
511
+ createRenderRoot() {
512
+ var _a;
513
+ const t2 = super.createRenderRoot();
514
+ return (_a = this.renderOptions).renderBefore ?? (_a.renderBefore = t2.firstChild), t2;
515
+ }
516
+ update(t2) {
517
+ const r2 = this.render();
518
+ this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t2), this._$Do = B$1(r2, this.renderRoot, this.renderOptions);
519
+ }
520
+ connectedCallback() {
521
+ super.connectedCallback(), this._$Do?.setConnected(true);
522
+ }
523
+ disconnectedCallback() {
524
+ super.disconnectedCallback(), this._$Do?.setConnected(false);
525
+ }
526
+ render() {
527
+ return T$1;
528
+ }
529
+ };
530
+ i$2._$litElement$ = true, i$2["finalized"] = true, s$2.litElementHydrateSupport?.({ LitElement: i$2 });
531
+ const o$4 = s$2.litElementPolyfillSupport;
532
+ o$4?.({ LitElement: i$2 });
533
+ (s$2.litElementVersions ?? (s$2.litElementVersions = [])).push("4.2.0");
534
+ const o$3 = { attribute: true, type: String, converter: u$2, reflect: false, hasChanged: f$4 }, r$3 = (t2 = o$3, e2, r2) => {
535
+ const { kind: n3, metadata: i3 } = r2;
536
+ let s2 = globalThis.litPropertyMetadata.get(i3);
537
+ if (void 0 === s2 && globalThis.litPropertyMetadata.set(i3, s2 = /* @__PURE__ */ new Map()), "setter" === n3 && ((t2 = Object.create(t2)).wrapped = true), s2.set(r2.name, t2), "accessor" === n3) {
538
+ const { name: o2 } = r2;
539
+ return { set(r3) {
540
+ const n4 = e2.get.call(this);
541
+ e2.set.call(this, r3), this.requestUpdate(o2, n4, t2);
542
+ }, init(e3) {
543
+ return void 0 !== e3 && this.C(o2, void 0, t2, e3), e3;
544
+ } };
545
+ }
546
+ if ("setter" === n3) {
547
+ const { name: o2 } = r2;
548
+ return function(r3) {
549
+ const n4 = this[o2];
550
+ e2.call(this, r3), this.requestUpdate(o2, n4, t2);
551
+ };
552
+ }
553
+ throw Error("Unsupported decorator location: " + n3);
554
+ };
555
+ function n$3(t2) {
556
+ return (e2, o2) => "object" == typeof o2 ? r$3(t2, e2, o2) : ((t3, e3, o3) => {
557
+ const r2 = e3.hasOwnProperty(o3);
558
+ return e3.constructor.createProperty(o3, t3), r2 ? Object.getOwnPropertyDescriptor(e3, o3) : void 0;
559
+ })(t2, e2, o2);
560
+ }
561
+ function r$2(r2) {
562
+ return n$3({ ...r2, state: true, attribute: false });
563
+ }
564
+ const t$1 = Symbol.for("@ts-pattern/matcher"), e$2 = Symbol.for("@ts-pattern/isVariadic"), n$2 = "@ts-pattern/anonymous-select-key", r$1 = (t2) => Boolean(t2 && "object" == typeof t2), i$1 = (e2) => e2 && !!e2[t$1], o$2 = (n3, s2, c2) => {
565
+ if (i$1(n3)) {
566
+ const e2 = n3[t$1](), { matched: r2, selections: i3 } = e2.match(s2);
567
+ return r2 && i3 && Object.keys(i3).forEach((t2) => c2(t2, i3[t2])), r2;
568
+ }
569
+ if (r$1(n3)) {
570
+ if (!r$1(s2))
571
+ return false;
572
+ if (Array.isArray(n3)) {
573
+ if (!Array.isArray(s2))
574
+ return false;
575
+ let t2 = [], r2 = [], a2 = [];
576
+ for (const o2 of n3.keys()) {
577
+ const s3 = n3[o2];
578
+ i$1(s3) && s3[e$2] ? a2.push(s3) : a2.length ? r2.push(s3) : t2.push(s3);
579
+ }
580
+ if (a2.length) {
581
+ if (a2.length > 1)
582
+ throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");
583
+ if (s2.length < t2.length + r2.length)
584
+ return false;
585
+ const e2 = s2.slice(0, t2.length), n4 = 0 === r2.length ? [] : s2.slice(-r2.length), i3 = s2.slice(t2.length, 0 === r2.length ? Infinity : -r2.length);
586
+ return t2.every((t3, n5) => o$2(t3, e2[n5], c2)) && r2.every((t3, e3) => o$2(t3, n4[e3], c2)) && (0 === a2.length || o$2(a2[0], i3, c2));
587
+ }
588
+ return n3.length === s2.length && n3.every((t3, e2) => o$2(t3, s2[e2], c2));
589
+ }
590
+ return Reflect.ownKeys(n3).every((e2) => {
591
+ const r2 = n3[e2];
592
+ return (e2 in s2 || i$1(a2 = r2) && "optional" === a2[t$1]().matcherType) && o$2(r2, s2[e2], c2);
593
+ var a2;
594
+ });
595
+ }
596
+ return Object.is(s2, n3);
597
+ }, s$1 = (e2) => {
598
+ var n3, o2, a2;
599
+ return r$1(e2) ? i$1(e2) ? null != (n3 = null == (o2 = (a2 = e2[t$1]()).getSelectionKeys) ? void 0 : o2.call(a2)) ? n3 : [] : Array.isArray(e2) ? c$1(e2, s$1) : c$1(Object.values(e2), s$1) : [];
600
+ }, c$1 = (t2, e2) => t2.reduce((t3, n3) => t3.concat(e2(n3)), []);
601
+ function a(...t2) {
602
+ if (1 === t2.length) {
603
+ const [e2] = t2;
604
+ return (t3) => o$2(e2, t3, () => {
605
+ });
606
+ }
607
+ if (2 === t2.length) {
608
+ const [e2, n3] = t2;
609
+ return o$2(e2, n3, () => {
610
+ });
611
+ }
612
+ throw new Error(`isMatching wasn't given the right number of arguments: expected 1 or 2, received ${t2.length}.`);
613
+ }
614
+ function u(t2) {
615
+ return Object.assign(t2, { optional: () => h$2(t2), and: (e2) => m(t2, e2), or: (e2) => d(t2, e2), select: (e2) => void 0 === e2 ? y2(t2) : y2(e2, t2) });
616
+ }
617
+ function l(t2) {
618
+ return Object.assign(((t3) => Object.assign(t3, { [Symbol.iterator]() {
619
+ let n3 = 0;
620
+ const r2 = [{ value: Object.assign(t3, { [e$2]: true }), done: false }, { done: true, value: void 0 }];
621
+ return { next: () => {
622
+ var t4;
623
+ return null != (t4 = r2[n3++]) ? t4 : r2.at(-1);
624
+ } };
625
+ } }))(t2), { optional: () => l(h$2(t2)), select: (e2) => l(void 0 === e2 ? y2(t2) : y2(e2, t2)) });
626
+ }
627
+ function h$2(e2) {
628
+ return u({ [t$1]: () => ({ match: (t2) => {
629
+ let n3 = {};
630
+ const r2 = (t3, e3) => {
631
+ n3[t3] = e3;
632
+ };
633
+ return void 0 === t2 ? (s$1(e2).forEach((t3) => r2(t3, void 0)), { matched: true, selections: n3 }) : { matched: o$2(e2, t2, r2), selections: n3 };
634
+ }, getSelectionKeys: () => s$1(e2), matcherType: "optional" }) });
635
+ }
636
+ const f$2 = (t2, e2) => {
637
+ for (const n3 of t2)
638
+ if (!e2(n3))
639
+ return false;
640
+ return true;
641
+ }, g = (t2, e2) => {
642
+ for (const [n3, r2] of t2.entries())
643
+ if (!e2(r2, n3))
644
+ return false;
645
+ return true;
646
+ };
647
+ function m(...e2) {
648
+ return u({ [t$1]: () => ({ match: (t2) => {
649
+ let n3 = {};
650
+ const r2 = (t3, e3) => {
651
+ n3[t3] = e3;
652
+ };
653
+ return { matched: e2.every((e3) => o$2(e3, t2, r2)), selections: n3 };
654
+ }, getSelectionKeys: () => c$1(e2, s$1), matcherType: "and" }) });
655
+ }
656
+ function d(...e2) {
657
+ return u({ [t$1]: () => ({ match: (t2) => {
658
+ let n3 = {};
659
+ const r2 = (t3, e3) => {
660
+ n3[t3] = e3;
661
+ };
662
+ return c$1(e2, s$1).forEach((t3) => r2(t3, void 0)), { matched: e2.some((e3) => o$2(e3, t2, r2)), selections: n3 };
663
+ }, getSelectionKeys: () => c$1(e2, s$1), matcherType: "or" }) });
664
+ }
665
+ function p(e2) {
666
+ return { [t$1]: () => ({ match: (t2) => ({ matched: Boolean(e2(t2)) }) }) };
667
+ }
668
+ function y2(...e2) {
669
+ const r2 = "string" == typeof e2[0] ? e2[0] : void 0, i3 = 2 === e2.length ? e2[1] : "string" == typeof e2[0] ? void 0 : e2[0];
670
+ return u({ [t$1]: () => ({ match: (t2) => {
671
+ let e3 = { [null != r2 ? r2 : n$2]: t2 };
672
+ return { matched: void 0 === i3 || o$2(i3, t2, (t3, n3) => {
673
+ e3[t3] = n3;
674
+ }), selections: e3 };
675
+ }, getSelectionKeys: () => [null != r2 ? r2 : n$2].concat(void 0 === i3 ? [] : s$1(i3)) }) });
676
+ }
677
+ function v(t2) {
678
+ return "number" == typeof t2;
679
+ }
680
+ function b(t2) {
681
+ return "string" == typeof t2;
682
+ }
683
+ function w(t2) {
684
+ return "bigint" == typeof t2;
685
+ }
686
+ const S = u(p(function(t2) {
687
+ return true;
688
+ })), O = S, j = (t2) => Object.assign(u(t2), { startsWith: (e2) => {
689
+ return j(m(t2, (n3 = e2, p((t3) => b(t3) && t3.startsWith(n3)))));
690
+ var n3;
691
+ }, endsWith: (e2) => {
692
+ return j(m(t2, (n3 = e2, p((t3) => b(t3) && t3.endsWith(n3)))));
693
+ var n3;
694
+ }, minLength: (e2) => j(m(t2, ((t3) => p((e3) => b(e3) && e3.length >= t3))(e2))), length: (e2) => j(m(t2, ((t3) => p((e3) => b(e3) && e3.length === t3))(e2))), maxLength: (e2) => j(m(t2, ((t3) => p((e3) => b(e3) && e3.length <= t3))(e2))), includes: (e2) => {
695
+ return j(m(t2, (n3 = e2, p((t3) => b(t3) && t3.includes(n3)))));
696
+ var n3;
697
+ }, regex: (e2) => {
698
+ return j(m(t2, (n3 = e2, p((t3) => b(t3) && Boolean(t3.match(n3))))));
699
+ var n3;
700
+ } }), K = j(p(b)), x = (t2) => Object.assign(u(t2), { between: (e2, n3) => x(m(t2, ((t3, e3) => p((n4) => v(n4) && t3 <= n4 && e3 >= n4))(e2, n3))), lt: (e2) => x(m(t2, ((t3) => p((e3) => v(e3) && e3 < t3))(e2))), gt: (e2) => x(m(t2, ((t3) => p((e3) => v(e3) && e3 > t3))(e2))), lte: (e2) => x(m(t2, ((t3) => p((e3) => v(e3) && e3 <= t3))(e2))), gte: (e2) => x(m(t2, ((t3) => p((e3) => v(e3) && e3 >= t3))(e2))), int: () => x(m(t2, p((t3) => v(t3) && Number.isInteger(t3)))), finite: () => x(m(t2, p((t3) => v(t3) && Number.isFinite(t3)))), positive: () => x(m(t2, p((t3) => v(t3) && t3 > 0))), negative: () => x(m(t2, p((t3) => v(t3) && t3 < 0))) }), E = x(p(v)), A = (t2) => Object.assign(u(t2), { between: (e2, n3) => A(m(t2, ((t3, e3) => p((n4) => w(n4) && t3 <= n4 && e3 >= n4))(e2, n3))), lt: (e2) => A(m(t2, ((t3) => p((e3) => w(e3) && e3 < t3))(e2))), gt: (e2) => A(m(t2, ((t3) => p((e3) => w(e3) && e3 > t3))(e2))), lte: (e2) => A(m(t2, ((t3) => p((e3) => w(e3) && e3 <= t3))(e2))), gte: (e2) => A(m(t2, ((t3) => p((e3) => w(e3) && e3 >= t3))(e2))), positive: () => A(m(t2, p((t3) => w(t3) && t3 > 0))), negative: () => A(m(t2, p((t3) => w(t3) && t3 < 0))) }), P = A(p(w)), T = u(p(function(t2) {
701
+ return "boolean" == typeof t2;
702
+ })), B = u(p(function(t2) {
703
+ return "symbol" == typeof t2;
704
+ })), _ = u(p(function(t2) {
705
+ return null == t2;
706
+ })), k2 = u(p(function(t2) {
707
+ return null != t2;
708
+ }));
709
+ var N2 = { __proto__: null, matcher: t$1, optional: h$2, array: function(...e2) {
710
+ return l({ [t$1]: () => ({ match: (t2) => {
711
+ if (!Array.isArray(t2))
712
+ return { matched: false };
713
+ if (0 === e2.length)
714
+ return { matched: true };
715
+ const n3 = e2[0];
716
+ let r2 = {};
717
+ if (0 === t2.length)
718
+ return s$1(n3).forEach((t3) => {
719
+ r2[t3] = [];
720
+ }), { matched: true, selections: r2 };
721
+ const i3 = (t3, e3) => {
722
+ r2[t3] = (r2[t3] || []).concat([e3]);
723
+ };
724
+ return { matched: t2.every((t3) => o$2(n3, t3, i3)), selections: r2 };
725
+ }, getSelectionKeys: () => 0 === e2.length ? [] : s$1(e2[0]) }) });
726
+ }, set: function(...e2) {
727
+ return u({ [t$1]: () => ({ match: (t2) => {
728
+ if (!(t2 instanceof Set))
729
+ return { matched: false };
730
+ let n3 = {};
731
+ if (0 === t2.size)
732
+ return { matched: true, selections: n3 };
733
+ if (0 === e2.length)
734
+ return { matched: true };
735
+ const r2 = (t3, e3) => {
736
+ n3[t3] = (n3[t3] || []).concat([e3]);
737
+ }, i3 = e2[0];
738
+ return { matched: f$2(t2, (t3) => o$2(i3, t3, r2)), selections: n3 };
739
+ }, getSelectionKeys: () => 0 === e2.length ? [] : s$1(e2[0]) }) });
740
+ }, map: function(...e2) {
741
+ return u({ [t$1]: () => ({ match: (t2) => {
742
+ if (!(t2 instanceof Map))
743
+ return { matched: false };
744
+ let n3 = {};
745
+ if (0 === t2.size)
746
+ return { matched: true, selections: n3 };
747
+ const r2 = (t3, e3) => {
748
+ n3[t3] = (n3[t3] || []).concat([e3]);
749
+ };
750
+ if (0 === e2.length)
751
+ return { matched: true };
752
+ var i3;
753
+ if (1 === e2.length)
754
+ throw new Error(`\`P.map\` wasn't given enough arguments. Expected (key, value), received ${null == (i3 = e2[0]) ? void 0 : i3.toString()}`);
755
+ const [s2, c2] = e2;
756
+ return { matched: g(t2, (t3, e3) => {
757
+ const n4 = o$2(s2, e3, r2), i4 = o$2(c2, t3, r2);
758
+ return n4 && i4;
759
+ }), selections: n3 };
760
+ }, getSelectionKeys: () => 0 === e2.length ? [] : [...s$1(e2[0]), ...s$1(e2[1])] }) });
761
+ }, intersection: m, union: d, not: function(e2) {
762
+ return u({ [t$1]: () => ({ match: (t2) => ({ matched: !o$2(e2, t2, () => {
763
+ }) }), getSelectionKeys: () => [], matcherType: "not" }) });
764
+ }, when: p, select: y2, any: S, _: O, string: K, number: E, bigint: P, boolean: T, symbol: B, nullish: _, nonNullable: k2, instanceOf: function(t2) {
765
+ return u(p(function(t3) {
766
+ return (e2) => e2 instanceof t3;
767
+ }(t2)));
768
+ }, shape: function(t2) {
769
+ return u(p(a(t2)));
770
+ } };
771
+ class W extends Error {
772
+ constructor(t2) {
773
+ let e2;
774
+ try {
775
+ e2 = JSON.stringify(t2);
776
+ } catch (n3) {
777
+ e2 = t2;
778
+ }
779
+ super(`Pattern matching error: no pattern matches value ${e2}`), this.input = void 0, this.input = t2;
780
+ }
781
+ }
782
+ const $ = { matched: false, value: void 0 };
783
+ function z$1(t2) {
784
+ return new I2(t2, $);
785
+ }
786
+ class I2 {
787
+ constructor(t2, e2) {
788
+ this.input = void 0, this.state = void 0, this.input = t2, this.state = e2;
789
+ }
790
+ with(...t2) {
791
+ if (this.state.matched)
792
+ return this;
793
+ const e2 = t2[t2.length - 1], r2 = [t2[0]];
794
+ let i3;
795
+ 3 === t2.length && "function" == typeof t2[1] ? i3 = t2[1] : t2.length > 2 && r2.push(...t2.slice(1, t2.length - 1));
796
+ let s2 = false, c2 = {};
797
+ const a2 = (t3, e3) => {
798
+ s2 = true, c2[t3] = e3;
799
+ }, u2 = !r2.some((t3) => o$2(t3, this.input, a2)) || i3 && !Boolean(i3(this.input)) ? $ : { matched: true, value: e2(s2 ? n$2 in c2 ? c2[n$2] : c2 : this.input, this.input) };
800
+ return new I2(this.input, u2);
801
+ }
802
+ when(t2, e2) {
803
+ if (this.state.matched)
804
+ return this;
805
+ const n3 = Boolean(t2(this.input));
806
+ return new I2(this.input, n3 ? { matched: true, value: e2(this.input, this.input) } : $);
807
+ }
808
+ otherwise(t2) {
809
+ return this.state.matched ? this.state.value : t2(this.input);
810
+ }
811
+ exhaustive(t2 = L2) {
812
+ return this.state.matched ? this.state.value : t2(this.input);
813
+ }
814
+ run() {
815
+ return this.exhaustive();
816
+ }
817
+ returnType() {
818
+ return this;
819
+ }
820
+ }
821
+ function L2(t2) {
822
+ throw new W(t2);
823
+ }
1
824
  var util;
2
825
  (function(util2) {
3
826
  util2.assertEqual = (val) => val;
@@ -16,10 +839,10 @@ var util;
16
839
  return obj;
17
840
  };
18
841
  util2.getValidEnumValues = (obj) => {
19
- const validKeys = util2.objectKeys(obj).filter((k2) => typeof obj[obj[k2]] !== "number");
842
+ const validKeys = util2.objectKeys(obj).filter((k3) => typeof obj[obj[k3]] !== "number");
20
843
  const filtered = {};
21
- for (const k2 of validKeys) {
22
- filtered[k2] = obj[k2];
844
+ for (const k3 of validKeys) {
845
+ filtered[k3] = obj[k3];
23
846
  }
24
847
  return util2.objectValues(filtered);
25
848
  };
@@ -190,10 +1013,10 @@ class ZodError extends Error {
190
1013
  fieldErrors._errors.push(mapper(issue));
191
1014
  } else {
192
1015
  let curr = fieldErrors;
193
- let i2 = 0;
194
- while (i2 < issue.path.length) {
195
- const el = issue.path[i2];
196
- const terminal = i2 === issue.path.length - 1;
1016
+ let i3 = 0;
1017
+ while (i3 < issue.path.length) {
1018
+ const el = issue.path[i3];
1019
+ const terminal = i3 === issue.path.length - 1;
197
1020
  if (!terminal) {
198
1021
  curr[el] = curr[el] || { _errors: [] };
199
1022
  } else {
@@ -201,7 +1024,7 @@ class ZodError extends Error {
201
1024
  curr[el]._errors.push(mapper(issue));
202
1025
  }
203
1026
  curr = curr[el];
204
- i2++;
1027
+ i3++;
205
1028
  }
206
1029
  }
207
1030
  }
@@ -2185,14 +3008,14 @@ class ZodArray extends ZodType {
2185
3008
  }
2186
3009
  }
2187
3010
  if (ctx.common.async) {
2188
- return Promise.all([...ctx.data].map((item, i2) => {
2189
- return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i2));
3011
+ return Promise.all([...ctx.data].map((item, i3) => {
3012
+ return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i3));
2190
3013
  })).then((result2) => {
2191
3014
  return ParseStatus.mergeArray(status, result2);
2192
3015
  });
2193
3016
  }
2194
- const result = [...ctx.data].map((item, i2) => {
2195
- return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i2));
3017
+ const result = [...ctx.data].map((item, i3) => {
3018
+ return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i3));
2196
3019
  });
2197
3020
  return ParseStatus.mergeArray(status, result);
2198
3021
  }
@@ -3121,7 +3944,7 @@ class ZodSet extends ZodType {
3121
3944
  }
3122
3945
  return { status: status.value, value: parsedSet };
3123
3946
  }
3124
- const elements = [...ctx.data.values()].map((item, i2) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i2)));
3947
+ const elements = [...ctx.data.values()].map((item, i3) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i3)));
3125
3948
  if (ctx.common.async) {
3126
3949
  return Promise.all(elements).then((elements2) => finalizeSet(elements2));
3127
3950
  } else {
@@ -3949,7 +4772,7 @@ const coerce = {
3949
4772
  date: (arg) => ZodDate.create({ ...arg, coerce: true })
3950
4773
  };
3951
4774
  const NEVER = INVALID;
3952
- var z$1 = /* @__PURE__ */ Object.freeze({
4775
+ var z2 = /* @__PURE__ */ Object.freeze({
3953
4776
  __proto__: null,
3954
4777
  defaultErrorMap: errorMap,
3955
4778
  setErrorMap,
@@ -4065,12 +4888,17 @@ var z$1 = /* @__PURE__ */ Object.freeze({
4065
4888
  quotelessJson,
4066
4889
  ZodError
4067
4890
  });
4068
- const ObiSDKConfigSchema = z$1.object({
4069
- apiKey: z$1.string().optional(),
4070
- baseUrl: z$1.string().default("https://iamobi.ai/api"),
4071
- enableVoice: z$1.boolean().default(true),
4072
- enableScreenCapture: z$1.boolean().default(true),
4073
- debug: z$1.boolean().default(false)
4891
+ const API_BASE_URL = "https://iamobi.ai/api";
4892
+ const ObiSDKConfigSchema = z2.object({
4893
+ apiKey: z2.string().optional(),
4894
+ enableVoice: z2.boolean().default(true),
4895
+ enableScreenCapture: z2.boolean().default(true),
4896
+ debug: z2.boolean().default(false),
4897
+ user: z2.object({
4898
+ id: z2.string(),
4899
+ email: z2.string().optional(),
4900
+ metadata: z2.any().optional()
4901
+ }).optional()
4074
4902
  });
4075
4903
  var EventType = /* @__PURE__ */ ((EventType2) => {
4076
4904
  EventType2["READY"] = "ready";
@@ -4094,271 +4922,1448 @@ var SDKState = /* @__PURE__ */ ((SDKState2) => {
4094
4922
  SDKState2["AWAITING_USER_INPUT"] = "awaiting_user_input";
4095
4923
  return SDKState2;
4096
4924
  })(SDKState || {});
4097
- const t = Symbol.for("@ts-pattern/matcher"), e = Symbol.for("@ts-pattern/isVariadic"), n = "@ts-pattern/anonymous-select-key", r = (t2) => Boolean(t2 && "object" == typeof t2), i = (e2) => e2 && !!e2[t], o = (n2, s2, c2) => {
4098
- if (i(n2)) {
4099
- const e2 = n2[t](), { matched: r2, selections: i2 } = e2.match(s2);
4100
- return r2 && i2 && Object.keys(i2).forEach((t2) => c2(t2, i2[t2])), r2;
4925
+ var __defProp$6 = Object.defineProperty;
4926
+ var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
4927
+ var __decorateClass$6 = (decorators, target, key, kind) => {
4928
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target;
4929
+ for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
4930
+ if (decorator = decorators[i3])
4931
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
4932
+ if (kind && result)
4933
+ __defProp$6(target, key, result);
4934
+ return result;
4935
+ };
4936
+ class NavIcon extends i$2 {
4937
+ constructor() {
4938
+ super(...arguments);
4939
+ this.id = "";
4940
+ this.isActive = false;
4941
+ this.isSpecial = false;
4942
+ }
4943
+ handleClick(e2) {
4944
+ e2.preventDefault();
4945
+ e2.stopPropagation();
4946
+ const event = new CustomEvent("click", {
4947
+ detail: {
4948
+ id: this.id,
4949
+ isActive: !this.isActive
4950
+ },
4951
+ bubbles: true,
4952
+ composed: true
4953
+ });
4954
+ this.dispatchEvent(event);
4955
+ if (this.onClick) {
4956
+ this.onClick(this.id, !this.isActive);
4957
+ }
4958
+ }
4959
+ render() {
4960
+ return x$1`
4961
+ <button
4962
+ id="obi-nav-${this.id}"
4963
+ class=${this.isSpecial ? "special" : ""}
4964
+ ?active=${this.isActive}
4965
+ @click=${this.handleClick}
4966
+ aria-label="${this.id} control"
4967
+ >
4968
+ <slot></slot>
4969
+ </button>
4970
+ `;
4971
+ }
4972
+ }
4973
+ NavIcon.styles = i$5`
4974
+ :host {
4975
+ display: block;
4976
+ }
4977
+
4978
+ button {
4979
+ display: flex;
4980
+ height: 40px;
4981
+ width: 40px;
4982
+ align-items: center;
4983
+ justify-content: center;
4984
+ border-radius: 2px;
4985
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
4986
+ transition: all 0.2s;
4987
+ cursor: pointer;
4988
+ margin: 4px 0;
4989
+ padding: 0;
4990
+ border: none;
4991
+ color: black;
4992
+ }
4993
+
4994
+ button.special {
4995
+ color: #fff;
4996
+ background-color: #000;
4997
+ }
4998
+
4999
+ button.special svg {
5000
+ stroke: #fff;
5001
+ }
5002
+
5003
+ button.special.active {
5004
+ background-color: black;
5005
+ color: white;
5006
+ }
5007
+
5008
+ button.special.active:hover {
5009
+ background-color: #27272a;
5010
+ }
5011
+
5012
+ button:not(.special) {
5013
+ background-color: white;
5014
+ color: black;
5015
+ }
5016
+
5017
+ button:not(.special):hover {
5018
+ background-color: #e5e5e5;
5019
+ }
5020
+
5021
+ ::slotted(*) {
5022
+ width: 18px;
5023
+ height: 18px;
5024
+ }
5025
+ `;
5026
+ __decorateClass$6([
5027
+ n$3({ type: String })
5028
+ ], NavIcon.prototype, "id", 2);
5029
+ __decorateClass$6([
5030
+ n$3({ type: Boolean })
5031
+ ], NavIcon.prototype, "isActive", 2);
5032
+ __decorateClass$6([
5033
+ n$3({ type: Boolean })
5034
+ ], NavIcon.prototype, "isSpecial", 2);
5035
+ __decorateClass$6([
5036
+ n$3({ type: Function })
5037
+ ], NavIcon.prototype, "onClick", 2);
5038
+ if (!customElements.get("obi-nav-icon")) {
5039
+ customElements.define("obi-nav-icon", NavIcon);
5040
+ }
5041
+ const navIcon = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5042
+ __proto__: null,
5043
+ NavIcon
5044
+ }, Symbol.toStringTag, { value: "Module" }));
5045
+ const svgWrapper = (content) => x$1`
5046
+ <svg
5047
+ xmlns="http://www.w3.org/2000/svg"
5048
+ width="24"
5049
+ height="24"
5050
+ viewBox="0 0 24 24"
5051
+ fill="none"
5052
+ stroke="currentColor"
5053
+ stroke-width="2"
5054
+ stroke-linecap="round"
5055
+ stroke-linejoin="round"
5056
+ class="lucide"
5057
+ style="display: block;"
5058
+ >
5059
+ ${content}
5060
+ </svg>
5061
+ `;
5062
+ const pauseIcon = svgWrapper(b$1`
5063
+ <rect x="14" y="4" width="4" height="16" rx="1"/><rect x="6" y="4" width="4" height="16" rx="1"/>
5064
+ `);
5065
+ const playIcon = svgWrapper(b$1`<polygon points="6 3 20 12 6 21 6 3"/>`);
5066
+ const powerIcon = svgWrapper(b$1`
5067
+ <path d="M12 2v10"/><path d="M18.4 6.6a9 9 0 1 1-12.77.04"/>
5068
+ `);
5069
+ const closeIcon = svgWrapper(b$1`
5070
+ <path d="M18 6 6 18"/><path d="m6 6 12 12"/>
5071
+ `);
5072
+ const bookOpenIcon = svgWrapper(b$1`
5073
+ <path d="M12 7v14" />
5074
+ <path
5075
+ d="M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z"
5076
+ />
5077
+ `);
5078
+ const obiIcon = x$1`
5079
+ <img
5080
+ class="widget-icon"
5081
+ src="data:image/svg+xml;base64,${btoa(`<?xml version="1.0" encoding="UTF-8"?>
5082
+ <svg width="32" height="32" viewBox="0 0 32 34" fill="none" xmlns="http://www.w3.org/2000/svg">
5083
+ <g id="obi-icon">
5084
+ <g id="Subtract">
5085
+ <path d="M15.5845 9.29177L8.20527 5.00637L8.20527 13.4502L15.5845 17.7356L15.5845 9.29177Z" fill="white" />
5086
+ <path d="M15.5896 27.7146L8.21035 31.9994L8.21032 23.4698L15.5896 19.1843L15.5896 27.7146Z" fill="white" />
5087
+ <path d="M16.4104 27.7146L16.4104 19.1786L23.7897 23.4641L23.7897 32L16.4104 27.7146Z" fill="white" />
5088
+ <path d="M32 27.7142L24.6207 31.9996L24.6207 23.47L32 19.1846L32 27.7142Z" fill="white" />
5089
+ <path d="M24.2048 22.748L31.5911 18.4585L24.2845 14.2154L16.8983 18.5048L24.2048 22.748Z" fill="white" />
5090
+ <path d="M23.7948 5.01235L23.7948 13.4564L16.4156 17.7418L16.4156 9.29775L23.7948 5.01235Z" fill="white" />
5091
+ <path d="M16.0052 0L23.3865 4.2866L16.0003 8.57606L8.61897 4.28946L16.0052 0Z" fill="white" />
5092
+ <path d="M7.72042 14.2182L15.1017 18.5048L7.79445 22.7477L0.413699 18.4615L7.72042 14.2182Z" fill="white" />
5093
+ <path d="M7.37926 31.9997L7.37926 23.4638L0 19.1784L3.79636e-05 27.7143L7.37926 31.9997Z" fill="white" />
5094
+ </g>
5095
+ </g>
5096
+ </svg>`)}"
5097
+ alt="Obi Icon"
5098
+ />
5099
+ `;
5100
+ var __defProp$5 = Object.defineProperty;
5101
+ var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
5102
+ var __decorateClass$5 = (decorators, target, key, kind) => {
5103
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
5104
+ for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
5105
+ if (decorator = decorators[i3])
5106
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
5107
+ if (kind && result)
5108
+ __defProp$5(target, key, result);
5109
+ return result;
5110
+ };
5111
+ class NavigationBar extends i$2 {
5112
+ constructor() {
5113
+ super();
5114
+ this.isActive = false;
5115
+ this.isScreenActive = false;
5116
+ this.position = { top: 0, left: 0 };
5117
+ this.currentState = SDKState.READY;
5118
+ this.direction = "up";
5119
+ }
5120
+ connectedCallback() {
5121
+ super.connectedCallback();
5122
+ }
5123
+ handleIconClick(id, isActive) {
5124
+ if (this.onItemSelect) {
5125
+ this.onItemSelect(id, isActive);
5126
+ }
5127
+ }
5128
+ render() {
5129
+ return x$1`
5130
+ ${this.isActive ? x$1`
5131
+ <obi-nav-icon
5132
+ id="pause"
5133
+ ?isActive=${this.currentState === SDKState.PAUSED}
5134
+ @click=${() => this.handleIconClick("pause", this.currentState === SDKState.PAUSED ? false : true)}
5135
+ >
5136
+ ${this.currentState === SDKState.PAUSED ? playIcon : pauseIcon}
5137
+ </obi-nav-icon>
5138
+ <obi-nav-icon
5139
+ id="activate"
5140
+ ?isActive=${this.isActive}
5141
+ ?isSpecial=${true}
5142
+ @click=${() => this.handleIconClick("activate", this.isActive ? false : true)}
5143
+ >
5144
+ ${this.isActive ? closeIcon : powerIcon}
5145
+ </obi-nav-icon>
5146
+ ` : x$1`
5147
+ <obi-nav-icon
5148
+ id="experiences"
5149
+ @click=${() => this.handleIconClick("experiences", true)}
5150
+ >
5151
+ ${bookOpenIcon}
5152
+ </obi-nav-icon>
5153
+ `}
5154
+ `;
5155
+ }
5156
+ }
5157
+ NavigationBar.styles = i$5`
5158
+ :host {
5159
+ display: flex;
5160
+ position: absolute;
5161
+ z-index: 10000;
5162
+ width: 40px;
5163
+ transition: all 0.2s ease-in-out;
5164
+ opacity: 1;
5165
+ transform: scale(1);
5166
+ pointer-events: auto;
5167
+ background-color: #fff;
5168
+ }
5169
+
5170
+ :host([data-direction="up"]) {
5171
+ bottom: 64px;
5172
+ top: auto;
5173
+ flex-direction: column-reverse;
5174
+ }
5175
+
5176
+ :host([data-direction="down"]) {
5177
+ top: 64px;
5178
+ bottom: auto;
5179
+ flex-direction: column;
5180
+ }
5181
+ `;
5182
+ __decorateClass$5([
5183
+ n$3({ type: Boolean })
5184
+ ], NavigationBar.prototype, "isActive", 2);
5185
+ __decorateClass$5([
5186
+ n$3({ type: Boolean })
5187
+ ], NavigationBar.prototype, "isScreenActive", 2);
5188
+ __decorateClass$5([
5189
+ n$3({ type: Object })
5190
+ ], NavigationBar.prototype, "position", 2);
5191
+ __decorateClass$5([
5192
+ n$3({ type: String })
5193
+ ], NavigationBar.prototype, "currentState", 2);
5194
+ __decorateClass$5([
5195
+ n$3({ type: String })
5196
+ ], NavigationBar.prototype, "direction", 2);
5197
+ __decorateClass$5([
5198
+ n$3({ type: Function })
5199
+ ], NavigationBar.prototype, "onItemSelect", 2);
5200
+ if (!customElements.get("obi-navigation-bar")) {
5201
+ customElements.define("obi-navigation-bar", NavigationBar);
5202
+ }
5203
+ const navigationBar = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5204
+ __proto__: null,
5205
+ NavigationBar
5206
+ }, Symbol.toStringTag, { value: "Module" }));
5207
+ var __defProp$4 = Object.defineProperty;
5208
+ var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
5209
+ var __decorateClass$4 = (decorators, target, key, kind) => {
5210
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target;
5211
+ for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
5212
+ if (decorator = decorators[i3])
5213
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
5214
+ if (kind && result)
5215
+ __defProp$4(target, key, result);
5216
+ return result;
5217
+ };
5218
+ class Course extends i$2 {
5219
+ constructor() {
5220
+ super(...arguments);
5221
+ this.id = "";
5222
+ this.name = "";
5223
+ this.description = "";
5224
+ this.imageSrc = "";
5225
+ }
5226
+ handleClick() {
5227
+ if (this.onSelect) {
5228
+ this.onSelect(this.id);
5229
+ }
5230
+ this.dispatchEvent(
5231
+ new CustomEvent("course-select", {
5232
+ detail: { id: this.id },
5233
+ bubbles: true,
5234
+ composed: true
5235
+ })
5236
+ );
5237
+ }
5238
+ render() {
5239
+ return x$1`
5240
+ <div class="course-container" @click=${this.handleClick}>
5241
+ <img src=${this.imageSrc} alt="Course Preview" class="course-image" />
5242
+ <h2 class="course-title">${this.name}</h2>
5243
+ ${this.description ? x$1`<p class="course-description">${this.description}</p>` : ""}
5244
+ </div>
5245
+ `;
5246
+ }
5247
+ }
5248
+ Course.styles = i$5`
5249
+ :host {
5250
+ display: block;
5251
+ }
5252
+
5253
+ .course-container {
5254
+ padding: 16px 12px;
5255
+ gap: 12px;
5256
+ border-radius: 4px;
5257
+ border: 1px solid #e5e7eb;
5258
+ cursor: pointer;
5259
+ transition: all 0.2s;
5260
+ }
5261
+
5262
+ .course-container:hover {
5263
+ background-color: #f9fafb;
5264
+ border-color: #d1d5db;
5265
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
5266
+ }
5267
+
5268
+ .course-container:active {
5269
+ transform: scale(0.98);
5270
+ }
5271
+
5272
+ .course-image {
5273
+ max-height: 160px;
5274
+ border-radius: 2px;
5275
+ border: 1px solid #e5e7eb;
5276
+ object-fit: cover;
5277
+ width: 100%;
5278
+ margin-bottom: 12px;
5279
+ }
5280
+
5281
+ .course-title {
5282
+ font-size: 14px;
5283
+ font-weight: bold;
5284
+ margin: 0;
5285
+ margin-bottom: 12px;
5286
+ }
5287
+
5288
+ .course-description {
5289
+ font-size: 14px;
5290
+ color: #71717a;
5291
+ margin: 0;
5292
+ }
5293
+ `;
5294
+ __decorateClass$4([
5295
+ n$3({ type: String })
5296
+ ], Course.prototype, "id", 2);
5297
+ __decorateClass$4([
5298
+ n$3({ type: String })
5299
+ ], Course.prototype, "name", 2);
5300
+ __decorateClass$4([
5301
+ n$3({ type: String })
5302
+ ], Course.prototype, "description", 2);
5303
+ __decorateClass$4([
5304
+ n$3({ type: String })
5305
+ ], Course.prototype, "imageSrc", 2);
5306
+ __decorateClass$4([
5307
+ n$3({ type: Function })
5308
+ ], Course.prototype, "onSelect", 2);
5309
+ class CourseList extends i$2 {
5310
+ constructor() {
5311
+ super(...arguments);
5312
+ this.courses = [];
5313
+ this.loading = false;
5314
+ this.error = "";
5315
+ }
5316
+ handleCourseSelect(e2) {
5317
+ if (this.onCourseSelect) {
5318
+ this.onCourseSelect(e2.detail.id);
5319
+ }
5320
+ }
5321
+ render() {
5322
+ if (this.loading) {
5323
+ return x$1`<div class="loading">Loading...</div>`;
5324
+ }
5325
+ if (this.error) {
5326
+ return x$1`<div class="error">${this.error}</div>`;
5327
+ }
5328
+ if (!this.courses || this.courses.length === 0) {
5329
+ return x$1`<div class="empty">No courses available</div>`;
5330
+ }
5331
+ const gridClass = this.courses.length === 1 ? "grid-cols-1" : this.courses.length === 2 ? "grid-cols-2" : "grid-cols-3";
5332
+ return x$1`
5333
+ <div class="course-grid ${gridClass}">
5334
+ ${this.courses.map(
5335
+ (course) => x$1`
5336
+ <obi-course
5337
+ id=${course.id}
5338
+ name=${course.name}
5339
+ description=${course.description || ""}
5340
+ imageSrc=${course.imageSrc}
5341
+ @course-select=${this.handleCourseSelect}
5342
+ ></obi-course>
5343
+ `
5344
+ )}
5345
+ </div>
5346
+ `;
5347
+ }
5348
+ }
5349
+ CourseList.styles = i$5`
5350
+ :host {
5351
+ display: block;
5352
+ }
5353
+
5354
+ .course-grid {
5355
+ display: grid;
5356
+ gap: 12px;
5357
+ margin-top: 24px;
5358
+ }
5359
+
5360
+ .course-grid.grid-cols-1 {
5361
+ grid-template-columns: 1fr;
5362
+ }
5363
+
5364
+ .course-grid.grid-cols-2 {
5365
+ grid-template-columns: 1fr 1fr;
5366
+ }
5367
+
5368
+ .course-grid.grid-cols-3 {
5369
+ grid-template-columns: 1fr 1fr 1fr;
5370
+ }
5371
+
5372
+ .loading,
5373
+ .error,
5374
+ .empty {
5375
+ display: flex;
5376
+ justify-content: center;
5377
+ align-items: center;
5378
+ margin-top: 16px;
5379
+ }
5380
+
5381
+ .error {
5382
+ color: #ef4444;
5383
+ }
5384
+ `;
5385
+ __decorateClass$4([
5386
+ n$3({ type: Array })
5387
+ ], CourseList.prototype, "courses", 2);
5388
+ __decorateClass$4([
5389
+ n$3({ type: Boolean })
5390
+ ], CourseList.prototype, "loading", 2);
5391
+ __decorateClass$4([
5392
+ n$3({ type: String })
5393
+ ], CourseList.prototype, "error", 2);
5394
+ __decorateClass$4([
5395
+ n$3({ type: Function })
5396
+ ], CourseList.prototype, "onCourseSelect", 2);
5397
+ if (!customElements.get("obi-course")) {
5398
+ customElements.define("obi-course", Course);
5399
+ }
5400
+ if (!customElements.get("obi-course-list")) {
5401
+ customElements.define("obi-course-list", CourseList);
5402
+ }
5403
+ const courses = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5404
+ __proto__: null,
5405
+ Course,
5406
+ CourseList
5407
+ }, Symbol.toStringTag, { value: "Module" }));
5408
+ var __defProp$3 = Object.defineProperty;
5409
+ var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
5410
+ var __decorateClass$3 = (decorators, target, key, kind) => {
5411
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target;
5412
+ for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
5413
+ if (decorator = decorators[i3])
5414
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
5415
+ if (kind && result)
5416
+ __defProp$3(target, key, result);
5417
+ return result;
5418
+ };
5419
+ class CourseModal extends i$2 {
5420
+ constructor() {
5421
+ super(...arguments);
5422
+ this.courses = [];
5423
+ this.loading = true;
5424
+ this.error = "";
5425
+ this.apiBaseUrl = "";
5426
+ this.apiKey = "";
5427
+ }
5428
+ handleCourseSelect(e2) {
5429
+ if (this.onCourseSelect) {
5430
+ this.onCourseSelect(e2.detail.id);
5431
+ }
5432
+ }
5433
+ handleClose() {
5434
+ if (this.onClose) {
5435
+ this.onClose();
5436
+ }
4101
5437
  }
4102
- if (r(n2)) {
4103
- if (!r(s2))
4104
- return false;
4105
- if (Array.isArray(n2)) {
4106
- if (!Array.isArray(s2))
4107
- return false;
4108
- let t2 = [], r2 = [], a2 = [];
4109
- for (const o2 of n2.keys()) {
4110
- const s3 = n2[o2];
4111
- i(s3) && s3[e] ? a2.push(s3) : a2.length ? r2.push(s3) : t2.push(s3);
4112
- }
4113
- if (a2.length) {
4114
- if (a2.length > 1)
4115
- throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");
4116
- if (s2.length < t2.length + r2.length)
4117
- return false;
4118
- const e2 = s2.slice(0, t2.length), n3 = 0 === r2.length ? [] : s2.slice(-r2.length), i2 = s2.slice(t2.length, 0 === r2.length ? Infinity : -r2.length);
4119
- return t2.every((t3, n4) => o(t3, e2[n4], c2)) && r2.every((t3, e3) => o(t3, n3[e3], c2)) && (0 === a2.length || o(a2[0], i2, c2));
4120
- }
4121
- return n2.length === s2.length && n2.every((t3, e2) => o(t3, s2[e2], c2));
5438
+ async fetchCourses() {
5439
+ try {
5440
+ this.loading = true;
5441
+ const raw_response = await fetch(`${this.apiBaseUrl}/sessions?token=${this.apiKey}`);
5442
+ const response = await raw_response.json();
5443
+ const mappedCourses = response.map((session) => ({
5444
+ id: session.uuid,
5445
+ name: session.onboarding_plan.name,
5446
+ description: session.onboarding_plan.description,
5447
+ imageSrc: session.onboarding_plan.screen_url || "https://corproductionsydney-storagebucket5cb7c8ea-atg4gmftc6sk.s3.amazonaws.com/static/generic-course.png"
5448
+ }));
5449
+ const filteredCourses = mappedCourses.filter((course) => !!course.name);
5450
+ this.courses = [...filteredCourses];
5451
+ this.requestUpdate();
5452
+ } catch (err) {
5453
+ console.error("Fetch error:", err);
5454
+ this.error = "Failed to fetch courses";
5455
+ } finally {
5456
+ this.loading = false;
5457
+ this.requestUpdate();
4122
5458
  }
4123
- return Reflect.ownKeys(n2).every((e2) => {
4124
- const r2 = n2[e2];
4125
- return (e2 in s2 || i(a2 = r2) && "optional" === a2[t]().matcherType) && o(r2, s2[e2], c2);
4126
- var a2;
4127
- });
4128
5459
  }
4129
- return Object.is(s2, n2);
4130
- }, s = (e2) => {
4131
- var n2, o2, a2;
4132
- return r(e2) ? i(e2) ? null != (n2 = null == (o2 = (a2 = e2[t]()).getSelectionKeys) ? void 0 : o2.call(a2)) ? n2 : [] : Array.isArray(e2) ? c(e2, s) : c(Object.values(e2), s) : [];
4133
- }, c = (t2, e2) => t2.reduce((t3, n2) => t3.concat(e2(n2)), []);
4134
- function a(...t2) {
4135
- if (1 === t2.length) {
4136
- const [e2] = t2;
4137
- return (t3) => o(e2, t3, () => {
4138
- });
5460
+ connectedCallback() {
5461
+ super.connectedCallback();
5462
+ if (window.obiWidgetConfig?.apiKey) {
5463
+ this.apiKey = window.obiWidgetConfig.apiKey;
5464
+ }
5465
+ this.apiBaseUrl = API_BASE_URL;
5466
+ if (this.apiBaseUrl && this.apiKey) {
5467
+ this.fetchCourses();
5468
+ } else {
5469
+ this.loading = false;
5470
+ this.error = "API base URL or API key is missing";
5471
+ }
4139
5472
  }
4140
- if (2 === t2.length) {
4141
- const [e2, n2] = t2;
4142
- return o(e2, n2, () => {
4143
- });
5473
+ render() {
5474
+ return x$1`
5475
+ <div class="backdrop" @click=${this.handleClose}></div>
5476
+ <div class="container">
5477
+ <button class="close-button" @click=${this.handleClose}>×</button>
5478
+ <div class="header">
5479
+ <h1>Give Obi a try!</h1>
5480
+ <p class="subtitle">Pick a tour, share your screen, and Obi will take it from there.</p>
5481
+ </div>
5482
+
5483
+ <obi-course-list
5484
+ .courses=${this.courses}
5485
+ .loading=${this.loading}
5486
+ .error=${this.error}
5487
+ @course-select=${this.handleCourseSelect}
5488
+ ></obi-course-list>
5489
+ </div>
5490
+ `;
4144
5491
  }
4145
- throw new Error(`isMatching wasn't given the right number of arguments: expected 1 or 2, received ${t2.length}.`);
4146
- }
4147
- function u(t2) {
4148
- return Object.assign(t2, { optional: () => h(t2), and: (e2) => m(t2, e2), or: (e2) => d(t2, e2), select: (e2) => void 0 === e2 ? y(t2) : y(e2, t2) });
4149
5492
  }
4150
- function l(t2) {
4151
- return Object.assign(((t3) => Object.assign(t3, { [Symbol.iterator]() {
4152
- let n2 = 0;
4153
- const r2 = [{ value: Object.assign(t3, { [e]: true }), done: false }, { done: true, value: void 0 }];
4154
- return { next: () => {
4155
- var t4;
4156
- return null != (t4 = r2[n2++]) ? t4 : r2.at(-1);
4157
- } };
4158
- } }))(t2), { optional: () => l(h(t2)), select: (e2) => l(void 0 === e2 ? y(t2) : y(e2, t2)) });
5493
+ CourseModal.styles = i$5`
5494
+ :host {
5495
+ display: block;
5496
+ font-family: "Syne", sans-serif;
5497
+ }
5498
+
5499
+ .backdrop {
5500
+ position: fixed;
5501
+ top: 0;
5502
+ right: 0;
5503
+ bottom: 0;
5504
+ left: 0;
5505
+ background-color: black;
5506
+ opacity: 0.7;
5507
+ z-index: 40;
5508
+ }
5509
+
5510
+ .container {
5511
+ position: fixed;
5512
+ background-color: white;
5513
+ color: black;
5514
+ border: 1px solid #e5e7eb;
5515
+ width: 640px;
5516
+ max-height: 80vh;
5517
+ overflow-y: auto;
5518
+ padding: 48px;
5519
+ gap: 12px;
5520
+ top: 50%;
5521
+ left: 50%;
5522
+ transform: translate(-50%, -50%);
5523
+ border-radius: 4px;
5524
+ z-index: 50;
5525
+ display: flex;
5526
+ flex-direction: column;
5527
+ text-align: center;
5528
+ }
5529
+
5530
+ .container:hover {
5531
+ cursor: auto;
5532
+ }
5533
+
5534
+ .container::-webkit-scrollbar {
5535
+ width: 0.5rem;
5536
+ }
5537
+
5538
+ .container::-webkit-scrollbar-track {
5539
+ background-color: #f3f4f6;
5540
+ border-radius: 9999px;
5541
+ }
5542
+
5543
+ .container::-webkit-scrollbar-thumb {
5544
+ background-color: #d1d5db;
5545
+ border-radius: 9999px;
5546
+ }
5547
+
5548
+ .header {
5549
+ margin-bottom: 24px;
5550
+ text-align: center;
5551
+ }
5552
+
5553
+ h1 {
5554
+ font-size: 32px;
5555
+ font-weight: 700;
5556
+ margin: 0;
5557
+ margin-bottom: 8px;
5558
+ }
5559
+
5560
+ .subtitle {
5561
+ font-size: 20px;
5562
+ color: rgb(113 113 122 / 1);
5563
+ margin: 0;
5564
+ }
5565
+
5566
+ .close-button {
5567
+ position: absolute;
5568
+ top: 16px;
5569
+ right: 16px;
5570
+ background: none;
5571
+ border: none;
5572
+ cursor: pointer;
5573
+ font-size: 24px;
5574
+ color: #6b7280;
5575
+ }
5576
+ `;
5577
+ __decorateClass$3([
5578
+ n$3({ type: Array })
5579
+ ], CourseModal.prototype, "courses", 2);
5580
+ __decorateClass$3([
5581
+ n$3({ type: Boolean })
5582
+ ], CourseModal.prototype, "loading", 2);
5583
+ __decorateClass$3([
5584
+ n$3({ type: String })
5585
+ ], CourseModal.prototype, "error", 2);
5586
+ __decorateClass$3([
5587
+ n$3({ type: String })
5588
+ ], CourseModal.prototype, "apiBaseUrl", 2);
5589
+ __decorateClass$3([
5590
+ n$3({ type: String })
5591
+ ], CourseModal.prototype, "apiKey", 2);
5592
+ __decorateClass$3([
5593
+ n$3({ type: Function })
5594
+ ], CourseModal.prototype, "onCourseSelect", 2);
5595
+ __decorateClass$3([
5596
+ n$3({ type: Function })
5597
+ ], CourseModal.prototype, "onClose", 2);
5598
+ if (!customElements.get("obi-course-modal")) {
5599
+ customElements.define("obi-course-modal", CourseModal);
4159
5600
  }
4160
- function h(e2) {
4161
- return u({ [t]: () => ({ match: (t2) => {
4162
- let n2 = {};
4163
- const r2 = (t3, e3) => {
4164
- n2[t3] = e3;
4165
- };
4166
- return void 0 === t2 ? (s(e2).forEach((t3) => r2(t3, void 0)), { matched: true, selections: n2 }) : { matched: o(e2, t2, r2), selections: n2 };
4167
- }, getSelectionKeys: () => s(e2), matcherType: "optional" }) });
5601
+ const courseModal = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5602
+ __proto__: null,
5603
+ CourseModal
5604
+ }, Symbol.toStringTag, { value: "Module" }));
5605
+ const f$1 = (o2) => void 0 === o2.strings;
5606
+ const t = { ATTRIBUTE: 1, CHILD: 2, PROPERTY: 3, BOOLEAN_ATTRIBUTE: 4, EVENT: 5, ELEMENT: 6 }, e$1 = (t2) => (...e2) => ({ _$litDirective$: t2, values: e2 });
5607
+ class i2 {
5608
+ constructor(t2) {
5609
+ }
5610
+ get _$AU() {
5611
+ return this._$AM._$AU;
5612
+ }
5613
+ _$AT(t2, e2, i3) {
5614
+ this._$Ct = t2, this._$AM = e2, this._$Ci = i3;
5615
+ }
5616
+ _$AS(t2, e2) {
5617
+ return this.update(t2, e2);
5618
+ }
5619
+ update(t2, e2) {
5620
+ return this.render(...e2);
5621
+ }
4168
5622
  }
4169
- const f = (t2, e2) => {
4170
- for (const n2 of t2)
4171
- if (!e2(n2))
4172
- return false;
4173
- return true;
4174
- }, g = (t2, e2) => {
4175
- for (const [n2, r2] of t2.entries())
4176
- if (!e2(r2, n2))
4177
- return false;
5623
+ const s = (i3, t2) => {
5624
+ const e2 = i3._$AN;
5625
+ if (void 0 === e2)
5626
+ return false;
5627
+ for (const i4 of e2)
5628
+ i4._$AO?.(t2, false), s(i4, t2);
4178
5629
  return true;
5630
+ }, o$1 = (i3) => {
5631
+ let t2, e2;
5632
+ do {
5633
+ if (void 0 === (t2 = i3._$AM))
5634
+ break;
5635
+ e2 = t2._$AN, e2.delete(i3), i3 = t2;
5636
+ } while (0 === e2?.size);
5637
+ }, r = (i3) => {
5638
+ for (let t2; t2 = i3._$AM; i3 = t2) {
5639
+ let e2 = t2._$AN;
5640
+ if (void 0 === e2)
5641
+ t2._$AN = e2 = /* @__PURE__ */ new Set();
5642
+ else if (e2.has(i3))
5643
+ break;
5644
+ e2.add(i3), c(t2);
5645
+ }
4179
5646
  };
4180
- function m(...e2) {
4181
- return u({ [t]: () => ({ match: (t2) => {
4182
- let n2 = {};
4183
- const r2 = (t3, e3) => {
4184
- n2[t3] = e3;
4185
- };
4186
- return { matched: e2.every((e3) => o(e3, t2, r2)), selections: n2 };
4187
- }, getSelectionKeys: () => c(e2, s), matcherType: "and" }) });
5647
+ function h$1(i3) {
5648
+ void 0 !== this._$AN ? (o$1(this), this._$AM = i3, r(this)) : this._$AM = i3;
4188
5649
  }
4189
- function d(...e2) {
4190
- return u({ [t]: () => ({ match: (t2) => {
4191
- let n2 = {};
4192
- const r2 = (t3, e3) => {
4193
- n2[t3] = e3;
4194
- };
4195
- return c(e2, s).forEach((t3) => r2(t3, void 0)), { matched: e2.some((e3) => o(e3, t2, r2)), selections: n2 };
4196
- }, getSelectionKeys: () => c(e2, s), matcherType: "or" }) });
5650
+ function n$1(i3, t2 = false, e2 = 0) {
5651
+ const r2 = this._$AH, h2 = this._$AN;
5652
+ if (void 0 !== h2 && 0 !== h2.size)
5653
+ if (t2)
5654
+ if (Array.isArray(r2))
5655
+ for (let i4 = e2; i4 < r2.length; i4++)
5656
+ s(r2[i4], false), o$1(r2[i4]);
5657
+ else
5658
+ null != r2 && (s(r2, false), o$1(r2));
5659
+ else
5660
+ s(this, i3);
4197
5661
  }
4198
- function p(e2) {
4199
- return { [t]: () => ({ match: (t2) => ({ matched: Boolean(e2(t2)) }) }) };
5662
+ const c = (i3) => {
5663
+ i3.type == t.CHILD && (i3._$AP ?? (i3._$AP = n$1), i3._$AQ ?? (i3._$AQ = h$1));
5664
+ };
5665
+ class f extends i2 {
5666
+ constructor() {
5667
+ super(...arguments), this._$AN = void 0;
5668
+ }
5669
+ _$AT(i3, t2, e2) {
5670
+ super._$AT(i3, t2, e2), r(this), this.isConnected = i3._$AU;
5671
+ }
5672
+ _$AO(i3, t2 = true) {
5673
+ i3 !== this.isConnected && (this.isConnected = i3, i3 ? this.reconnected?.() : this.disconnected?.()), t2 && (s(this, i3), o$1(this));
5674
+ }
5675
+ setValue(t2) {
5676
+ if (f$1(this._$Ct))
5677
+ this._$Ct._$AI(t2, this);
5678
+ else {
5679
+ const i3 = [...this._$Ct._$AH];
5680
+ i3[this._$Ci] = t2, this._$Ct._$AI(i3, this, 0);
5681
+ }
5682
+ }
5683
+ disconnected() {
5684
+ }
5685
+ reconnected() {
5686
+ }
4200
5687
  }
4201
- function y(...e2) {
4202
- const r2 = "string" == typeof e2[0] ? e2[0] : void 0, i2 = 2 === e2.length ? e2[1] : "string" == typeof e2[0] ? void 0 : e2[0];
4203
- return u({ [t]: () => ({ match: (t2) => {
4204
- let e3 = { [null != r2 ? r2 : n]: t2 };
4205
- return { matched: void 0 === i2 || o(i2, t2, (t3, n2) => {
4206
- e3[t3] = n2;
4207
- }), selections: e3 };
4208
- }, getSelectionKeys: () => [null != r2 ? r2 : n].concat(void 0 === i2 ? [] : s(i2)) }) });
5688
+ const e = () => new h();
5689
+ class h {
4209
5690
  }
4210
- function v(t2) {
4211
- return "number" == typeof t2;
5691
+ const o = /* @__PURE__ */ new WeakMap(), n2 = e$1(class extends f {
5692
+ render(i3) {
5693
+ return E$1;
5694
+ }
5695
+ update(i3, [s2]) {
5696
+ const e2 = s2 !== this.G;
5697
+ return e2 && void 0 !== this.G && this.rt(void 0), (e2 || this.lt !== this.ct) && (this.G = s2, this.ht = i3.options?.host, this.rt(this.ct = i3.element)), E$1;
5698
+ }
5699
+ rt(t2) {
5700
+ if (this.isConnected || (t2 = void 0), "function" == typeof this.G) {
5701
+ const i3 = this.ht ?? globalThis;
5702
+ let s2 = o.get(i3);
5703
+ void 0 === s2 && (s2 = /* @__PURE__ */ new WeakMap(), o.set(i3, s2)), void 0 !== s2.get(this.G) && this.G.call(this.ht, void 0), s2.set(this.G, t2), void 0 !== t2 && this.G.call(this.ht, t2);
5704
+ } else
5705
+ this.G.value = t2;
5706
+ }
5707
+ get lt() {
5708
+ return "function" == typeof this.G ? o.get(this.ht ?? globalThis)?.get(this.G) : this.G?.value;
5709
+ }
5710
+ disconnected() {
5711
+ this.lt === this.ct && this.rt(void 0);
5712
+ }
5713
+ reconnected() {
5714
+ this.rt(this.ct);
5715
+ }
5716
+ });
5717
+ var __defProp$2 = Object.defineProperty;
5718
+ var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
5719
+ var __decorateClass$2 = (decorators, target, key, kind) => {
5720
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
5721
+ for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
5722
+ if (decorator = decorators[i3])
5723
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
5724
+ if (kind && result)
5725
+ __defProp$2(target, key, result);
5726
+ return result;
5727
+ };
5728
+ class AudioEqualizer extends i$2 {
5729
+ constructor() {
5730
+ super(...arguments);
5731
+ this.volume = { speaker: "ASSISTANT", volume: 0, spectrum: [] };
5732
+ this.canvasRef = e();
5733
+ this.barCount = 8;
5734
+ this.animationFrame = null;
5735
+ }
5736
+ connectedCallback() {
5737
+ super.connectedCallback();
5738
+ this.startAnimation();
5739
+ }
5740
+ disconnectedCallback() {
5741
+ super.disconnectedCallback();
5742
+ this.stopAnimation();
5743
+ }
5744
+ startAnimation() {
5745
+ const animate = () => {
5746
+ this.drawEqualizer();
5747
+ this.animationFrame = requestAnimationFrame(animate);
5748
+ };
5749
+ this.animationFrame = requestAnimationFrame(animate);
5750
+ }
5751
+ stopAnimation() {
5752
+ if (this.animationFrame) {
5753
+ cancelAnimationFrame(this.animationFrame);
5754
+ this.animationFrame = null;
5755
+ }
5756
+ }
5757
+ drawEqualizer() {
5758
+ const canvas = this.canvasRef.value;
5759
+ if (!canvas)
5760
+ return;
5761
+ const ctx = canvas.getContext("2d");
5762
+ if (!ctx)
5763
+ return;
5764
+ const dpr = window.devicePixelRatio || 1;
5765
+ const displayWidth = canvas.clientWidth;
5766
+ const displayHeight = canvas.clientHeight;
5767
+ canvas.width = displayWidth * dpr;
5768
+ canvas.height = displayHeight * dpr;
5769
+ ctx.scale(dpr, dpr);
5770
+ ctx.clearRect(0, 0, displayWidth, displayHeight);
5771
+ const gap = 3;
5772
+ const barWidth = Math.max(1, (displayWidth - (this.barCount - 1) * gap) / this.barCount);
5773
+ const barMaxHeight = displayHeight / 2;
5774
+ const currentVolume = this.volume.speaker === "USER" ? this.volume.volume : this.volume.volume;
5775
+ const currentSpectrum = this.volume.speaker === "USER" ? this.volume.spectrum : this.volume.spectrum;
5776
+ if (currentVolume === 0)
5777
+ return;
5778
+ let processedSpectrum = [];
5779
+ if (currentSpectrum && currentSpectrum.length > 0) {
5780
+ const spectrumLength = currentSpectrum.length;
5781
+ const regionSize = Math.ceil(spectrumLength / 10);
5782
+ let energyByRegion = [];
5783
+ for (let i3 = 0; i3 < 10; i3++) {
5784
+ const start = i3 * regionSize;
5785
+ const end = Math.min((i3 + 1) * regionSize, spectrumLength);
5786
+ let regionEnergy = 0;
5787
+ for (let j2 = start; j2 < end; j2++) {
5788
+ regionEnergy += currentSpectrum[j2] || 0;
5789
+ }
5790
+ energyByRegion.push({ region: i3, startIdx: start, endIdx: end, energy: regionEnergy });
5791
+ }
5792
+ energyByRegion.sort((a2, b2) => b2.energy - a2.energy);
5793
+ const topRegions = energyByRegion.slice(0, 3);
5794
+ const startIdx = Math.min(...topRegions.map((r2) => r2.startIdx));
5795
+ const endIdx = Math.max(...topRegions.map((r2) => r2.endIdx));
5796
+ if (endIdx > startIdx) {
5797
+ for (let i3 = 0; i3 < this.barCount; i3++) {
5798
+ const position = startIdx + i3 / (this.barCount - 1) * (endIdx - startIdx);
5799
+ const index = Math.min(spectrumLength - 1, Math.floor(position));
5800
+ processedSpectrum[i3] = currentSpectrum[index] || 0;
5801
+ }
5802
+ } else {
5803
+ for (let i3 = 0; i3 < this.barCount; i3++) {
5804
+ const position = i3 / (this.barCount - 1) * (spectrumLength / 2);
5805
+ const index = Math.min(spectrumLength - 1, Math.floor(position));
5806
+ processedSpectrum[i3] = currentSpectrum[index] || 0;
5807
+ }
5808
+ }
5809
+ const maxSpectrumValue = Math.max(...processedSpectrum, 1);
5810
+ const amplificationFactorRoot = this.volume.speaker === "USER" ? 0.7 : 0.6;
5811
+ processedSpectrum = processedSpectrum.map((value, index) => {
5812
+ const relativeValue = value / maxSpectrumValue;
5813
+ const amplificationFactor = amplificationFactorRoot + index / (this.barCount - 1) * 0.3;
5814
+ return Math.min(1, relativeValue * amplificationFactor);
5815
+ });
5816
+ } else {
5817
+ if (this.volume.speaker !== "USER") {
5818
+ for (let i3 = 0; i3 < this.barCount; i3++) {
5819
+ const time = Date.now() * 2e-3;
5820
+ const value = 0.3 + 0.2 * Math.sin(time + i3 * 0.7);
5821
+ processedSpectrum[i3] = value;
5822
+ }
5823
+ }
5824
+ }
5825
+ for (let i3 = 0; i3 < this.barCount; i3++) {
5826
+ const spectrumValue = processedSpectrum.length > 0 ? processedSpectrum[i3] !== void 0 ? processedSpectrum[i3] : currentVolume : currentVolume;
5827
+ if (this.volume.speaker === "USER") {
5828
+ ctx.fillStyle = `rgba(109, 40, 217, ${spectrumValue * 0.5 + 0.5})`;
5829
+ } else {
5830
+ ctx.fillStyle = `rgba(255, 255, 255, ${spectrumValue * 0.5 + 0.5})`;
5831
+ }
5832
+ const barHeight = Math.max(2, spectrumValue * 0.8 * barMaxHeight);
5833
+ const x2 = displayWidth - (this.barCount - i3) * (barWidth + gap);
5834
+ const radius = barWidth / 2;
5835
+ ctx.beginPath();
5836
+ ctx.moveTo(x2 + radius, displayHeight / 2 - barHeight);
5837
+ ctx.lineTo(x2 + barWidth - radius, displayHeight / 2 - barHeight);
5838
+ ctx.quadraticCurveTo(
5839
+ x2 + barWidth,
5840
+ displayHeight / 2 - barHeight,
5841
+ x2 + barWidth,
5842
+ displayHeight / 2 - barHeight + radius
5843
+ );
5844
+ ctx.lineTo(x2 + barWidth, displayHeight / 2);
5845
+ ctx.lineTo(x2, displayHeight / 2);
5846
+ ctx.lineTo(x2, displayHeight / 2 - barHeight + radius);
5847
+ ctx.quadraticCurveTo(
5848
+ x2,
5849
+ displayHeight / 2 - barHeight,
5850
+ x2 + radius,
5851
+ displayHeight / 2 - barHeight
5852
+ );
5853
+ ctx.fill();
5854
+ ctx.beginPath();
5855
+ ctx.moveTo(x2, displayHeight / 2);
5856
+ ctx.lineTo(x2 + barWidth, displayHeight / 2);
5857
+ ctx.lineTo(x2 + barWidth, displayHeight / 2 + barHeight - radius);
5858
+ ctx.quadraticCurveTo(
5859
+ x2 + barWidth,
5860
+ displayHeight / 2 + barHeight,
5861
+ x2 + barWidth - radius,
5862
+ displayHeight / 2 + barHeight
5863
+ );
5864
+ ctx.lineTo(x2 + radius, displayHeight / 2 + barHeight);
5865
+ ctx.quadraticCurveTo(
5866
+ x2,
5867
+ displayHeight / 2 + barHeight,
5868
+ x2,
5869
+ displayHeight / 2 + barHeight - radius
5870
+ );
5871
+ ctx.lineTo(x2, displayHeight / 2);
5872
+ ctx.fill();
5873
+ }
5874
+ }
5875
+ render() {
5876
+ return x$1` <canvas ${n2(this.canvasRef)} width="52" height="52"></canvas> `;
5877
+ }
4212
5878
  }
4213
- function b(t2) {
4214
- return "string" == typeof t2;
5879
+ AudioEqualizer.styles = i$5`
5880
+ :host {
5881
+ display: block;
5882
+ width: 40px;
5883
+ height: 40px;
5884
+ margin: 4px;
5885
+ }
5886
+
5887
+ canvas {
5888
+ width: 100%;
5889
+ height: 100%;
5890
+ }
5891
+ `;
5892
+ __decorateClass$2([
5893
+ n$3({ type: Object })
5894
+ ], AudioEqualizer.prototype, "volume", 2);
5895
+ __decorateClass$2([
5896
+ r$2()
5897
+ ], AudioEqualizer.prototype, "canvasRef", 2);
5898
+ if (!customElements.get("obi-audio-equalizer")) {
5899
+ customElements.define("obi-audio-equalizer", AudioEqualizer);
4215
5900
  }
4216
- function w(t2) {
4217
- return "bigint" == typeof t2;
5901
+ const audioEqualizer = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5902
+ __proto__: null,
5903
+ AudioEqualizer
5904
+ }, Symbol.toStringTag, { value: "Module" }));
5905
+ var __defProp$1 = Object.defineProperty;
5906
+ var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
5907
+ var __decorateClass$1 = (decorators, target, key, kind) => {
5908
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
5909
+ for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
5910
+ if (decorator = decorators[i3])
5911
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
5912
+ if (kind && result)
5913
+ __defProp$1(target, key, result);
5914
+ return result;
5915
+ };
5916
+ class DotLoader extends i$2 {
5917
+ constructor() {
5918
+ super(...arguments);
5919
+ this.activeDots = Array(5).fill(false);
5920
+ this.numDots = 5;
5921
+ this.containerWidth = 32;
5922
+ this.dotSize = 2;
5923
+ this.bounceHeight = 12;
5924
+ this.animationDuration = 200;
5925
+ this.pauseDuration = 300;
5926
+ this.overlapFactor = 0.7;
5927
+ this.color = "#FFF";
5928
+ this.timeoutIds = [];
5929
+ }
5930
+ connectedCallback() {
5931
+ super.connectedCallback();
5932
+ this.startAnimation();
5933
+ this.style.setProperty("--dot-loader-width", `${this.containerWidth}px`);
5934
+ this.style.setProperty("--dot-size", `${this.dotSize}px`);
5935
+ this.style.setProperty("--dot-color", this.color);
5936
+ }
5937
+ disconnectedCallback() {
5938
+ super.disconnectedCallback();
5939
+ this.stopAnimation();
5940
+ }
5941
+ startAnimation() {
5942
+ this.animateSequence();
5943
+ }
5944
+ stopAnimation() {
5945
+ this.timeoutIds.forEach((id) => window.clearTimeout(id));
5946
+ this.timeoutIds = [];
5947
+ }
5948
+ animateSequence() {
5949
+ this.activeDots = Array(this.numDots).fill(false);
5950
+ for (let i3 = 0; i3 < this.numDots; i3++) {
5951
+ const delay = i3 * (this.animationDuration * this.overlapFactor);
5952
+ const bounceStartId = window.setTimeout(() => {
5953
+ this.activeDots = [...this.activeDots];
5954
+ this.activeDots[i3] = true;
5955
+ const bounceEndId = window.setTimeout(() => {
5956
+ this.activeDots = [...this.activeDots];
5957
+ this.activeDots[i3] = false;
5958
+ }, this.animationDuration);
5959
+ this.timeoutIds.push(bounceEndId);
5960
+ }, delay);
5961
+ this.timeoutIds.push(bounceStartId);
5962
+ }
5963
+ const nextSequenceId = window.setTimeout(
5964
+ () => {
5965
+ this.animateSequence();
5966
+ },
5967
+ this.numDots * this.animationDuration * this.overlapFactor + this.pauseDuration
5968
+ );
5969
+ this.timeoutIds.push(nextSequenceId);
5970
+ }
5971
+ render() {
5972
+ return x$1`
5973
+ <div class="dot-loader">
5974
+ ${this.activeDots.map(
5975
+ (isActive) => x$1`
5976
+ <div
5977
+ class="dot"
5978
+ style="transform: ${isActive ? `translateY(-${this.bounceHeight}px)` : "translateY(0)"}"
5979
+ ></div>
5980
+ `
5981
+ )}
5982
+ </div>
5983
+ `;
5984
+ }
4218
5985
  }
4219
- const S = u(p(function(t2) {
4220
- return true;
4221
- })), O = S, j = (t2) => Object.assign(u(t2), { startsWith: (e2) => {
4222
- return j(m(t2, (n2 = e2, p((t3) => b(t3) && t3.startsWith(n2)))));
4223
- var n2;
4224
- }, endsWith: (e2) => {
4225
- return j(m(t2, (n2 = e2, p((t3) => b(t3) && t3.endsWith(n2)))));
4226
- var n2;
4227
- }, minLength: (e2) => j(m(t2, ((t3) => p((e3) => b(e3) && e3.length >= t3))(e2))), length: (e2) => j(m(t2, ((t3) => p((e3) => b(e3) && e3.length === t3))(e2))), maxLength: (e2) => j(m(t2, ((t3) => p((e3) => b(e3) && e3.length <= t3))(e2))), includes: (e2) => {
4228
- return j(m(t2, (n2 = e2, p((t3) => b(t3) && t3.includes(n2)))));
4229
- var n2;
4230
- }, regex: (e2) => {
4231
- return j(m(t2, (n2 = e2, p((t3) => b(t3) && Boolean(t3.match(n2))))));
4232
- var n2;
4233
- } }), K = j(p(b)), x = (t2) => Object.assign(u(t2), { between: (e2, n2) => x(m(t2, ((t3, e3) => p((n3) => v(n3) && t3 <= n3 && e3 >= n3))(e2, n2))), lt: (e2) => x(m(t2, ((t3) => p((e3) => v(e3) && e3 < t3))(e2))), gt: (e2) => x(m(t2, ((t3) => p((e3) => v(e3) && e3 > t3))(e2))), lte: (e2) => x(m(t2, ((t3) => p((e3) => v(e3) && e3 <= t3))(e2))), gte: (e2) => x(m(t2, ((t3) => p((e3) => v(e3) && e3 >= t3))(e2))), int: () => x(m(t2, p((t3) => v(t3) && Number.isInteger(t3)))), finite: () => x(m(t2, p((t3) => v(t3) && Number.isFinite(t3)))), positive: () => x(m(t2, p((t3) => v(t3) && t3 > 0))), negative: () => x(m(t2, p((t3) => v(t3) && t3 < 0))) }), E = x(p(v)), A = (t2) => Object.assign(u(t2), { between: (e2, n2) => A(m(t2, ((t3, e3) => p((n3) => w(n3) && t3 <= n3 && e3 >= n3))(e2, n2))), lt: (e2) => A(m(t2, ((t3) => p((e3) => w(e3) && e3 < t3))(e2))), gt: (e2) => A(m(t2, ((t3) => p((e3) => w(e3) && e3 > t3))(e2))), lte: (e2) => A(m(t2, ((t3) => p((e3) => w(e3) && e3 <= t3))(e2))), gte: (e2) => A(m(t2, ((t3) => p((e3) => w(e3) && e3 >= t3))(e2))), positive: () => A(m(t2, p((t3) => w(t3) && t3 > 0))), negative: () => A(m(t2, p((t3) => w(t3) && t3 < 0))) }), P = A(p(w)), T = u(p(function(t2) {
4234
- return "boolean" == typeof t2;
4235
- })), B = u(p(function(t2) {
4236
- return "symbol" == typeof t2;
4237
- })), _ = u(p(function(t2) {
4238
- return null == t2;
4239
- })), k = u(p(function(t2) {
4240
- return null != t2;
4241
- }));
4242
- var N = { __proto__: null, matcher: t, optional: h, array: function(...e2) {
4243
- return l({ [t]: () => ({ match: (t2) => {
4244
- if (!Array.isArray(t2))
4245
- return { matched: false };
4246
- if (0 === e2.length)
4247
- return { matched: true };
4248
- const n2 = e2[0];
4249
- let r2 = {};
4250
- if (0 === t2.length)
4251
- return s(n2).forEach((t3) => {
4252
- r2[t3] = [];
4253
- }), { matched: true, selections: r2 };
4254
- const i2 = (t3, e3) => {
4255
- r2[t3] = (r2[t3] || []).concat([e3]);
4256
- };
4257
- return { matched: t2.every((t3) => o(n2, t3, i2)), selections: r2 };
4258
- }, getSelectionKeys: () => 0 === e2.length ? [] : s(e2[0]) }) });
4259
- }, set: function(...e2) {
4260
- return u({ [t]: () => ({ match: (t2) => {
4261
- if (!(t2 instanceof Set))
4262
- return { matched: false };
4263
- let n2 = {};
4264
- if (0 === t2.size)
4265
- return { matched: true, selections: n2 };
4266
- if (0 === e2.length)
4267
- return { matched: true };
4268
- const r2 = (t3, e3) => {
4269
- n2[t3] = (n2[t3] || []).concat([e3]);
4270
- }, i2 = e2[0];
4271
- return { matched: f(t2, (t3) => o(i2, t3, r2)), selections: n2 };
4272
- }, getSelectionKeys: () => 0 === e2.length ? [] : s(e2[0]) }) });
4273
- }, map: function(...e2) {
4274
- return u({ [t]: () => ({ match: (t2) => {
4275
- if (!(t2 instanceof Map))
4276
- return { matched: false };
4277
- let n2 = {};
4278
- if (0 === t2.size)
4279
- return { matched: true, selections: n2 };
4280
- const r2 = (t3, e3) => {
4281
- n2[t3] = (n2[t3] || []).concat([e3]);
4282
- };
4283
- if (0 === e2.length)
4284
- return { matched: true };
4285
- var i2;
4286
- if (1 === e2.length)
4287
- throw new Error(`\`P.map\` wasn't given enough arguments. Expected (key, value), received ${null == (i2 = e2[0]) ? void 0 : i2.toString()}`);
4288
- const [s2, c2] = e2;
4289
- return { matched: g(t2, (t3, e3) => {
4290
- const n3 = o(s2, e3, r2), i3 = o(c2, t3, r2);
4291
- return n3 && i3;
4292
- }), selections: n2 };
4293
- }, getSelectionKeys: () => 0 === e2.length ? [] : [...s(e2[0]), ...s(e2[1])] }) });
4294
- }, intersection: m, union: d, not: function(e2) {
4295
- return u({ [t]: () => ({ match: (t2) => ({ matched: !o(e2, t2, () => {
4296
- }) }), getSelectionKeys: () => [], matcherType: "not" }) });
4297
- }, when: p, select: y, any: S, _: O, string: K, number: E, bigint: P, boolean: T, symbol: B, nullish: _, nonNullable: k, instanceOf: function(t2) {
4298
- return u(p(function(t3) {
4299
- return (e2) => e2 instanceof t3;
4300
- }(t2)));
4301
- }, shape: function(t2) {
4302
- return u(p(a(t2)));
4303
- } };
4304
- class W extends Error {
4305
- constructor(t2) {
4306
- let e2;
4307
- try {
4308
- e2 = JSON.stringify(t2);
4309
- } catch (n2) {
4310
- e2 = t2;
5986
+ DotLoader.styles = i$5`
5987
+ :host {
5988
+ display: block;
4311
5989
  }
4312
- super(`Pattern matching error: no pattern matches value ${e2}`), this.input = void 0, this.input = t2;
5990
+
5991
+ .dot-loader {
5992
+ display: flex;
5993
+ flex-direction: row;
5994
+ width: var(--dot-loader-width, 32px);
5995
+ height: 14px;
5996
+ justify-content: center;
5997
+ align-items: center;
5998
+ padding: 0;
5999
+ margin: 0;
6000
+ gap: 4px;
6001
+ }
6002
+
6003
+ .dot {
6004
+ width: var(--dot-size, 2px);
6005
+ height: var(--dot-size, 2px);
6006
+ border-radius: 50%;
6007
+ background-color: var(--dot-color, #fff);
6008
+ margin: 0;
6009
+ padding: 0;
6010
+ transition: transform 0.2s ease-in-out;
6011
+ opacity: 1;
6012
+ }
6013
+ `;
6014
+ __decorateClass$1([
6015
+ r$2()
6016
+ ], DotLoader.prototype, "activeDots", 2);
6017
+ if (!customElements.get("obi-dot-loader")) {
6018
+ customElements.define("obi-dot-loader", DotLoader);
6019
+ }
6020
+ const dotLoader = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6021
+ __proto__: null,
6022
+ DotLoader
6023
+ }, Symbol.toStringTag, { value: "Module" }));
6024
+ class SearchingLoader extends i$2 {
6025
+ render() {
6026
+ return x$1`
6027
+ <obi-dot-loader loading style="margin-left: 2px"></obi-dot-loader>
6028
+ <span class="text">Searching the knowledge base</span>
6029
+ `;
4313
6030
  }
4314
6031
  }
4315
- const $ = { matched: false, value: void 0 };
4316
- function z(t2) {
4317
- return new I(t2, $);
6032
+ SearchingLoader.styles = i$5`
6033
+ :host {
6034
+ display: flex;
6035
+ align-items: center;
6036
+ gap: 12px;
6037
+ background-color: #7c3aed;
6038
+ border-radius: 12px;
6039
+ padding: 8px 12px;
6040
+ }
6041
+
6042
+ .text {
6043
+ color: white;
6044
+ font-weight: 500;
6045
+ font-size: 14px;
6046
+ }
6047
+ `;
6048
+ if (!customElements.get("obi-searching-loader")) {
6049
+ customElements.define("obi-searching-loader", SearchingLoader);
4318
6050
  }
4319
- class I {
4320
- constructor(t2, e2) {
4321
- this.input = void 0, this.state = void 0, this.input = t2, this.state = e2;
6051
+ const searchingLoader = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6052
+ __proto__: null,
6053
+ SearchingLoader
6054
+ }, Symbol.toStringTag, { value: "Module" }));
6055
+ var __defProp = Object.defineProperty;
6056
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6057
+ var __decorateClass = (decorators, target, key, kind) => {
6058
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
6059
+ for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
6060
+ if (decorator = decorators[i3])
6061
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
6062
+ if (kind && result)
6063
+ __defProp(target, key, result);
6064
+ return result;
6065
+ };
6066
+ class ObiWidget extends i$2 {
6067
+ constructor() {
6068
+ super();
6069
+ this.apiBaseUrl = API_BASE_URL;
6070
+ this.apiKey = "";
6071
+ this.position = "bottom-right";
6072
+ this.user = null;
6073
+ this.state = SDKState.READY;
6074
+ this.showCourseModal = false;
6075
+ this.isHovering = false;
6076
+ this.navVisible = false;
6077
+ this.activeSession = null;
6078
+ this.volume = {
6079
+ speaker: "ASSISTANT",
6080
+ volume: 0,
6081
+ spectrum: []
6082
+ };
6083
+ this.closeNavTimeoutRef = null;
6084
+ if (window.obiWidgetConfig) {
6085
+ if (window.obiWidgetConfig.apiKey) {
6086
+ this.apiKey = window.obiWidgetConfig.apiKey;
6087
+ }
6088
+ if (window.obiWidgetConfig.position) {
6089
+ this.position = window.obiWidgetConfig.position;
6090
+ }
6091
+ if (window.obiWidgetConfig.user) {
6092
+ this.user = window.obiWidgetConfig.user;
6093
+ }
6094
+ }
4322
6095
  }
4323
- with(...t2) {
4324
- if (this.state.matched)
4325
- return this;
4326
- const e2 = t2[t2.length - 1], r2 = [t2[0]];
4327
- let i2;
4328
- 3 === t2.length && "function" == typeof t2[1] ? i2 = t2[1] : t2.length > 2 && r2.push(...t2.slice(1, t2.length - 1));
4329
- let s2 = false, c2 = {};
4330
- const a2 = (t3, e3) => {
4331
- s2 = true, c2[t3] = e3;
4332
- }, u2 = !r2.some((t3) => o(t3, this.input, a2)) || i2 && !Boolean(i2(this.input)) ? $ : { matched: true, value: e2(s2 ? n in c2 ? c2[n] : c2 : this.input, this.input) };
4333
- return new I(this.input, u2);
6096
+ connectedCallback() {
6097
+ super.connectedCallback();
6098
+ if (!window.obiWidgetConfig) {
6099
+ window.obiWidgetConfig = {
6100
+ apiKey: this.apiKey || ""
6101
+ };
6102
+ }
6103
+ if (this.apiKey) {
6104
+ window.obiWidgetConfig.apiKey = this.apiKey;
6105
+ }
6106
+ this.setAttribute("position", this.position);
4334
6107
  }
4335
- when(t2, e2) {
4336
- if (this.state.matched)
4337
- return this;
4338
- const n2 = Boolean(t2(this.input));
4339
- return new I(this.input, n2 ? { matched: true, value: e2(this.input, this.input) } : $);
6108
+ disconnectedCallback() {
6109
+ super.disconnectedCallback();
6110
+ if (this.closeNavTimeoutRef !== null) {
6111
+ window.clearTimeout(this.closeNavTimeoutRef);
6112
+ }
6113
+ if (this.activeSession) {
6114
+ this.activeSession.disconnect();
6115
+ this.activeSession = null;
6116
+ }
4340
6117
  }
4341
- otherwise(t2) {
4342
- return this.state.matched ? this.state.value : t2(this.input);
6118
+ handleMouseEnter() {
6119
+ this.isHovering = true;
6120
+ this.navVisible = true;
4343
6121
  }
4344
- exhaustive(t2 = L) {
4345
- return this.state.matched ? this.state.value : t2(this.input);
6122
+ handleMouseLeave() {
6123
+ this.isHovering = false;
6124
+ if (this.closeNavTimeoutRef !== null) {
6125
+ window.clearTimeout(this.closeNavTimeoutRef);
6126
+ }
6127
+ this.closeNavTimeoutRef = window.setTimeout(() => {
6128
+ if (!this.isHovering) {
6129
+ this.navVisible = false;
6130
+ }
6131
+ this.closeNavTimeoutRef = null;
6132
+ }, 300);
4346
6133
  }
4347
- run() {
4348
- return this.exhaustive();
6134
+ handleItemSelect(id, itemIsActive) {
6135
+ if (id === "experiences") {
6136
+ this.showCourseModal = true;
6137
+ return;
6138
+ }
6139
+ z$1([id, itemIsActive]).with(["pause", true], () => {
6140
+ this.activeSession?.pauseRecording();
6141
+ }).with(["pause", false], () => {
6142
+ this.activeSession?.resumeRecording();
6143
+ }).with(["activate", false], () => {
6144
+ this.activeSession?.disconnect();
6145
+ }).otherwise(() => {
6146
+ return;
6147
+ });
4349
6148
  }
4350
- returnType() {
4351
- return this;
6149
+ async handleSessionStart(sessionToken) {
6150
+ this.showCourseModal = false;
6151
+ this.state = SDKState.LOADING;
6152
+ try {
6153
+ const { ObiSession } = await import("./session-88fd0dca.js");
6154
+ const session = new ObiSession({ token: sessionToken, apiBaseUrl: this.apiBaseUrl });
6155
+ session.on("stateChanged", (data) => {
6156
+ this.state = data.newState;
6157
+ });
6158
+ session.on("volume", (data) => {
6159
+ this.volume = data;
6160
+ });
6161
+ session.on("error", (data) => {
6162
+ console.error("Session error:", data.error);
6163
+ this.state = SDKState.ERROR;
6164
+ this.activeSession = null;
6165
+ });
6166
+ await session.connect();
6167
+ this.activeSession = session;
6168
+ } catch (error) {
6169
+ console.error("Failed to connect to session:", error);
6170
+ this.state = SDKState.ERROR;
6171
+ }
6172
+ }
6173
+ render() {
6174
+ const stateRender = z$1(this.state).with(SDKState.LOADING, () => x$1`<obi-dot-loader></obi-dot-loader>`).with(SDKState.RESEARCHING, () => x$1`<obi-searching-loader></obi-searching-loader>`).with(
6175
+ N2.union(SDKState.USER_SPEAKING, SDKState.AGENT_SPEAKING),
6176
+ () => x$1`<obi-audio-equalizer .volume=${this.volume}></obi-audio-equalizer>`
6177
+ ).with(SDKState.PAUSED, () => obiIcon).otherwise(() => obiIcon);
6178
+ return x$1`
6179
+ <div
6180
+ class="widget-container ${this.state === SDKState.USER_SPEAKING || this.state === SDKState.AGENT_SPEAKING ? "pulse" : ""} ${this.state !== SDKState.READY || this.navVisible ? "rounded" : ""} ${this.state === SDKState.RESEARCHING ? "researching" : ""} ${this.state === SDKState.USER_SPEAKING ? "user-speaking" : ""}"
6181
+ @mouseenter=${this.handleMouseEnter}
6182
+ @mouseleave=${this.handleMouseLeave}
6183
+ >
6184
+ ${stateRender}
6185
+ ${this.navVisible && this.state !== SDKState.RESEARCHING ? x$1`
6186
+ <obi-navigation-bar
6187
+ ?isActive=${this.state !== SDKState.READY}
6188
+ .position=${this.position}
6189
+ data-direction="up"
6190
+ .currentState=${this.state}
6191
+ .onItemSelect=${this.handleItemSelect.bind(this)}
6192
+ ></obi-navigation-bar>
6193
+ ` : E$1}
6194
+ </div>
6195
+ ${this.showCourseModal ? x$1`<obi-course-modal
6196
+ .onClose=${() => this.showCourseModal = false}
6197
+ .onCourseSelect=${this.handleSessionStart.bind(this)}
6198
+ .apiBaseUrl=${this.apiBaseUrl}
6199
+ .apiKey=${this.apiKey}
6200
+ ></obi-course-modal>` : E$1}
6201
+ `;
4352
6202
  }
4353
6203
  }
4354
- function L(t2) {
4355
- throw new W(t2);
6204
+ ObiWidget.styles = i$5`
6205
+ :host {
6206
+ display: block;
6207
+ position: fixed;
6208
+ z-index: 9999;
6209
+ font-family: Arial, sans-serif;
6210
+ --obi-primary: #7c3aed;
6211
+ --obi-danger: #ef4444;
6212
+ --obi-gray: #6b7280;
6213
+ }
6214
+
6215
+ /* Position-specific styles */
6216
+ :host([position="bottom-right"]) {
6217
+ bottom: 80px;
6218
+ right: 80px;
6219
+ }
6220
+
6221
+ :host([position="bottom-left"]) {
6222
+ bottom: 80px;
6223
+ left: 20px;
6224
+ }
6225
+
6226
+ :host([position="top-right"]) {
6227
+ top: 20px;
6228
+ right: 80px;
6229
+ }
6230
+
6231
+ :host([position="top-left"]) {
6232
+ top: 20px;
6233
+ left: 20px;
6234
+ }
6235
+
6236
+ /* Adjust position when in researching state to accommodate wider container */
6237
+ :host([position="bottom-right"]) .widget-container.researching {
6238
+ right: 20px;
6239
+ }
6240
+
6241
+ :host([position="top-right"]) .widget-container.researching {
6242
+ right: 20px;
6243
+ }
6244
+
6245
+ .widget-container {
6246
+ position: fixed;
6247
+ width: 56px;
6248
+ height: 56px;
6249
+ border-radius: 28px;
6250
+ border-color: transparent;
6251
+ background-color: var(--obi-primary);
6252
+ display: flex;
6253
+ align-items: center;
6254
+ justify-content: center;
6255
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
6256
+ transition: all 0.2s ease-out;
6257
+ }
6258
+
6259
+ .widget-container.user-speaking {
6260
+ background:
6261
+ linear-gradient(0deg, #c4b5fd, #c4b5fd),
6262
+ linear-gradient(195.84deg, rgba(192, 132, 252, 0) 11.05%, #c084fc 117.01%);
6263
+ }
6264
+
6265
+ .widget-container:hover {
6266
+ border-radius: 12px;
6267
+ }
6268
+
6269
+ .widget-container.rounded {
6270
+ border-radius: 12px;
6271
+ }
6272
+
6273
+ .widget-container.researching {
6274
+ width: 265px;
6275
+ border-radius: 12px;
6276
+ }
6277
+
6278
+ .widget-icon {
6279
+ width: 32px;
6280
+ height: 32px;
6281
+ transition: transform 0.5s ease-in-out;
6282
+ }
6283
+
6284
+ .widget-container.rounded .widget-icon {
6285
+ transform: rotate(110deg);
6286
+ }
6287
+
6288
+ @keyframes pulse-shadow {
6289
+ 0% {
6290
+ box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.4);
6291
+ }
6292
+ 70% {
6293
+ box-shadow: 0 0 0 10px rgba(124, 58, 237, 0);
6294
+ }
6295
+ 100% {
6296
+ box-shadow: 0 0 0 0 rgba(124, 58, 237, 0);
6297
+ }
6298
+ }
6299
+
6300
+ .pulse {
6301
+ animation: pulse-shadow 2s ease-in-out infinite;
6302
+ }
6303
+ `;
6304
+ __decorateClass([
6305
+ n$3({ type: String })
6306
+ ], ObiWidget.prototype, "apiBaseUrl", 2);
6307
+ __decorateClass([
6308
+ n$3({ type: String })
6309
+ ], ObiWidget.prototype, "apiKey", 2);
6310
+ __decorateClass([
6311
+ n$3({ type: String })
6312
+ ], ObiWidget.prototype, "position", 2);
6313
+ __decorateClass([
6314
+ n$3({ type: Object })
6315
+ ], ObiWidget.prototype, "user", 2);
6316
+ __decorateClass([
6317
+ r$2()
6318
+ ], ObiWidget.prototype, "state", 2);
6319
+ __decorateClass([
6320
+ r$2()
6321
+ ], ObiWidget.prototype, "showCourseModal", 2);
6322
+ __decorateClass([
6323
+ r$2()
6324
+ ], ObiWidget.prototype, "isHovering", 2);
6325
+ __decorateClass([
6326
+ r$2()
6327
+ ], ObiWidget.prototype, "navVisible", 2);
6328
+ __decorateClass([
6329
+ r$2()
6330
+ ], ObiWidget.prototype, "activeSession", 2);
6331
+ __decorateClass([
6332
+ r$2()
6333
+ ], ObiWidget.prototype, "volume", 2);
6334
+ if (!customElements.get("obi-widget")) {
6335
+ customElements.define("obi-widget", ObiWidget);
4356
6336
  }
6337
+ const obiWidget = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
6338
+ __proto__: null,
6339
+ ObiWidget
6340
+ }, Symbol.toStringTag, { value: "Module" }));
4357
6341
  export {
6342
+ API_BASE_URL as A,
6343
+ Course as C,
6344
+ DotLoader as D,
4358
6345
  EventType as E,
4359
- N,
6346
+ NavIcon as N,
4360
6347
  ObiSDKConfigSchema as O,
4361
6348
  SDKState as S,
4362
- z
6349
+ ObiWidget as a,
6350
+ i$2 as b,
6351
+ AudioEqualizer as c,
6352
+ NavigationBar as d,
6353
+ SearchingLoader as e,
6354
+ CourseList as f,
6355
+ CourseModal as g,
6356
+ navIcon as h,
6357
+ i$5 as i,
6358
+ navigationBar as j,
6359
+ courses as k,
6360
+ courseModal as l,
6361
+ audioEqualizer as m,
6362
+ n$3 as n,
6363
+ dotLoader as o,
6364
+ obiWidget as p,
6365
+ searchingLoader as s,
6366
+ x$1 as x,
6367
+ z$1 as z
4363
6368
  };
4364
- //# sourceMappingURL=index-634e0df5.js.map
6369
+ //# sourceMappingURL=obi-widget-0d63936f.js.map