@cms.ai/brand_brain 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs ADDED
@@ -0,0 +1,1748 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region ../../node_modules/.pnpm/@orpc+shared@1.14.0_@opentelemetry+api@1.9.0/node_modules/@orpc/shared/dist/index.mjs
3
+ function resolveMaybeOptionalOptions(rest) {
4
+ return rest[0] ?? {};
5
+ }
6
+ function toArray(value) {
7
+ return Array.isArray(value) ? value : value === void 0 || value === null ? [] : [value];
8
+ }
9
+ const ORPC_NAME = "orpc";
10
+ const ORPC_SHARED_PACKAGE_NAME = "@orpc/shared";
11
+ const ORPC_SHARED_PACKAGE_VERSION = "1.14.0";
12
+ var AbortError = class extends Error {
13
+ constructor(...rest) {
14
+ super(...rest);
15
+ this.name = "AbortError";
16
+ }
17
+ };
18
+ function once(fn) {
19
+ let cached;
20
+ return () => {
21
+ if (cached) return cached.result;
22
+ const result = fn();
23
+ cached = { result };
24
+ return result;
25
+ };
26
+ }
27
+ function sequential(fn) {
28
+ let lastOperationPromise = Promise.resolve();
29
+ return (...args) => {
30
+ return lastOperationPromise = lastOperationPromise.catch(() => {}).then(() => {
31
+ return fn(...args);
32
+ });
33
+ };
34
+ }
35
+ const SPAN_ERROR_STATUS = 2;
36
+ const GLOBAL_OTEL_CONFIG_KEY = `__${ORPC_SHARED_PACKAGE_NAME}@${ORPC_SHARED_PACKAGE_VERSION}/otel/config__`;
37
+ function getGlobalOtelConfig() {
38
+ return globalThis[GLOBAL_OTEL_CONFIG_KEY];
39
+ }
40
+ function startSpan(name, options = {}, context) {
41
+ return (getGlobalOtelConfig()?.tracer)?.startSpan(name, options, context);
42
+ }
43
+ function setSpanError(span, error, options = {}) {
44
+ if (!span) return;
45
+ const exception = toOtelException(error);
46
+ span.recordException(exception);
47
+ if (!options.signal?.aborted || options.signal.reason !== error) span.setStatus({
48
+ code: SPAN_ERROR_STATUS,
49
+ message: exception.message
50
+ });
51
+ }
52
+ function toOtelException(error) {
53
+ if (error instanceof Error) {
54
+ const exception = {
55
+ message: error.message,
56
+ name: error.name,
57
+ stack: error.stack
58
+ };
59
+ if ("code" in error && (typeof error.code === "string" || typeof error.code === "number")) exception.code = error.code;
60
+ return exception;
61
+ }
62
+ return { message: String(error) };
63
+ }
64
+ async function runWithSpan({ name, context, ...options }, fn) {
65
+ const tracer = getGlobalOtelConfig()?.tracer;
66
+ if (!tracer) return fn();
67
+ const callback = async (span) => {
68
+ try {
69
+ return await fn(span);
70
+ } catch (e) {
71
+ setSpanError(span, e, options);
72
+ throw e;
73
+ } finally {
74
+ span.end();
75
+ }
76
+ };
77
+ if (context) return tracer.startActiveSpan(name, options, context, callback);
78
+ else return tracer.startActiveSpan(name, options, callback);
79
+ }
80
+ async function runInSpanContext(span, fn) {
81
+ const otelConfig = getGlobalOtelConfig();
82
+ if (!span || !otelConfig) return fn();
83
+ const ctx = otelConfig.trace.setSpan(otelConfig.context.active(), span);
84
+ return otelConfig.context.with(ctx, fn);
85
+ }
86
+ function isAsyncIteratorObject(maybe) {
87
+ if (!maybe || typeof maybe !== "object") return false;
88
+ return "next" in maybe && typeof maybe.next === "function" && Symbol.asyncIterator in maybe && typeof maybe[Symbol.asyncIterator] === "function";
89
+ }
90
+ const asyncDisposeSymbol = Symbol.asyncDispose ?? Symbol.for("asyncDispose");
91
+ var AsyncIteratorClass = class {
92
+ #isDone = false;
93
+ #isExecuteComplete = false;
94
+ #cleanup;
95
+ #next;
96
+ constructor(next, cleanup) {
97
+ this.#cleanup = cleanup;
98
+ this.#next = sequential(async () => {
99
+ if (this.#isDone) return {
100
+ done: true,
101
+ value: void 0
102
+ };
103
+ try {
104
+ const result = await next();
105
+ if (result.done) this.#isDone = true;
106
+ return result;
107
+ } catch (err) {
108
+ this.#isDone = true;
109
+ throw err;
110
+ } finally {
111
+ if (this.#isDone && !this.#isExecuteComplete) {
112
+ this.#isExecuteComplete = true;
113
+ await this.#cleanup("next");
114
+ }
115
+ }
116
+ });
117
+ }
118
+ next() {
119
+ return this.#next();
120
+ }
121
+ async return(value) {
122
+ this.#isDone = true;
123
+ if (!this.#isExecuteComplete) {
124
+ this.#isExecuteComplete = true;
125
+ await this.#cleanup("return");
126
+ }
127
+ return {
128
+ done: true,
129
+ value
130
+ };
131
+ }
132
+ async throw(err) {
133
+ this.#isDone = true;
134
+ if (!this.#isExecuteComplete) {
135
+ this.#isExecuteComplete = true;
136
+ await this.#cleanup("throw");
137
+ }
138
+ throw err;
139
+ }
140
+ /**
141
+ * asyncDispose symbol only available in esnext, we should fallback to Symbol.for('asyncDispose')
142
+ */
143
+ async [asyncDisposeSymbol]() {
144
+ this.#isDone = true;
145
+ if (!this.#isExecuteComplete) {
146
+ this.#isExecuteComplete = true;
147
+ await this.#cleanup("dispose");
148
+ }
149
+ }
150
+ [Symbol.asyncIterator]() {
151
+ return this;
152
+ }
153
+ };
154
+ function asyncIteratorWithSpan({ name, ...options }, iterator) {
155
+ let span;
156
+ return new AsyncIteratorClass(async () => {
157
+ span ??= startSpan(name);
158
+ try {
159
+ const result = await runInSpanContext(span, () => iterator.next());
160
+ span?.addEvent(result.done ? "completed" : "yielded");
161
+ return result;
162
+ } catch (err) {
163
+ setSpanError(span, err, options);
164
+ throw err;
165
+ }
166
+ }, async (reason) => {
167
+ try {
168
+ if (reason !== "next") await runInSpanContext(span, () => iterator.return?.());
169
+ } catch (err) {
170
+ setSpanError(span, err, options);
171
+ throw err;
172
+ } finally {
173
+ span?.end();
174
+ }
175
+ });
176
+ }
177
+ function intercept(interceptors, options, main) {
178
+ const next = (options2, index) => {
179
+ const interceptor = interceptors[index];
180
+ if (!interceptor) return main(options2);
181
+ return interceptor({
182
+ ...options2,
183
+ next: (newOptions = options2) => next(newOptions, index + 1)
184
+ });
185
+ };
186
+ return next(options, 0);
187
+ }
188
+ function parseEmptyableJSON(text) {
189
+ if (!text) return;
190
+ return JSON.parse(text);
191
+ }
192
+ function stringifyJSON(value) {
193
+ return JSON.stringify(value);
194
+ }
195
+ function getConstructor(value) {
196
+ if (!isTypescriptObject(value)) return null;
197
+ return Object.getPrototypeOf(value)?.constructor;
198
+ }
199
+ function isObject(value) {
200
+ if (!value || typeof value !== "object") return false;
201
+ const proto = Object.getPrototypeOf(value);
202
+ return proto === Object.prototype || !proto || !proto.constructor;
203
+ }
204
+ function isTypescriptObject(value) {
205
+ return !!value && (typeof value === "object" || typeof value === "function");
206
+ }
207
+ function value(value2, ...args) {
208
+ if (typeof value2 === "function") return value2(...args);
209
+ return value2;
210
+ }
211
+ function preventNativeAwait(target) {
212
+ return new Proxy(target, { get(target2, prop, receiver) {
213
+ const value2 = Reflect.get(target2, prop, receiver);
214
+ if (prop !== "then" || typeof value2 !== "function") return value2;
215
+ return new Proxy(value2, { apply(targetFn, thisArg, args) {
216
+ if (args.length !== 2 || args.some((arg) => !isNativeFunction(arg))) return Reflect.apply(targetFn, thisArg, args);
217
+ let shouldOmit = true;
218
+ args[0].call(thisArg, preventNativeAwait(new Proxy(target2, { get: (target3, prop2, receiver2) => {
219
+ if (shouldOmit && prop2 === "then") {
220
+ shouldOmit = false;
221
+ return;
222
+ }
223
+ return Reflect.get(target3, prop2, receiver2);
224
+ } })));
225
+ } });
226
+ } });
227
+ }
228
+ const NATIVE_FUNCTION_REGEX = /^\s*function\s*\(\)\s*\{\s*\[native code\]\s*\}\s*$/;
229
+ function isNativeFunction(fn) {
230
+ return typeof fn === "function" && NATIVE_FUNCTION_REGEX.test(fn.toString());
231
+ }
232
+ function tryDecodeURIComponent(value) {
233
+ try {
234
+ return decodeURIComponent(value);
235
+ } catch {
236
+ return value;
237
+ }
238
+ }
239
+ //#endregion
240
+ //#region ../../node_modules/.pnpm/@orpc+client@1.14.0_@opentelemetry+api@1.9.0/node_modules/@orpc/client/dist/shared/client.KWZYf6QD.mjs
241
+ const ORPC_CLIENT_PACKAGE_NAME = "@orpc/client";
242
+ const ORPC_CLIENT_PACKAGE_VERSION = "1.14.0";
243
+ const COMMON_ORPC_ERROR_DEFS = {
244
+ BAD_REQUEST: {
245
+ status: 400,
246
+ message: "Bad Request"
247
+ },
248
+ UNAUTHORIZED: {
249
+ status: 401,
250
+ message: "Unauthorized"
251
+ },
252
+ FORBIDDEN: {
253
+ status: 403,
254
+ message: "Forbidden"
255
+ },
256
+ NOT_FOUND: {
257
+ status: 404,
258
+ message: "Not Found"
259
+ },
260
+ METHOD_NOT_SUPPORTED: {
261
+ status: 405,
262
+ message: "Method Not Supported"
263
+ },
264
+ NOT_ACCEPTABLE: {
265
+ status: 406,
266
+ message: "Not Acceptable"
267
+ },
268
+ TIMEOUT: {
269
+ status: 408,
270
+ message: "Request Timeout"
271
+ },
272
+ CONFLICT: {
273
+ status: 409,
274
+ message: "Conflict"
275
+ },
276
+ PRECONDITION_FAILED: {
277
+ status: 412,
278
+ message: "Precondition Failed"
279
+ },
280
+ PAYLOAD_TOO_LARGE: {
281
+ status: 413,
282
+ message: "Payload Too Large"
283
+ },
284
+ UNSUPPORTED_MEDIA_TYPE: {
285
+ status: 415,
286
+ message: "Unsupported Media Type"
287
+ },
288
+ UNPROCESSABLE_CONTENT: {
289
+ status: 422,
290
+ message: "Unprocessable Content"
291
+ },
292
+ TOO_MANY_REQUESTS: {
293
+ status: 429,
294
+ message: "Too Many Requests"
295
+ },
296
+ CLIENT_CLOSED_REQUEST: {
297
+ status: 499,
298
+ message: "Client Closed Request"
299
+ },
300
+ INTERNAL_SERVER_ERROR: {
301
+ status: 500,
302
+ message: "Internal Server Error"
303
+ },
304
+ NOT_IMPLEMENTED: {
305
+ status: 501,
306
+ message: "Not Implemented"
307
+ },
308
+ BAD_GATEWAY: {
309
+ status: 502,
310
+ message: "Bad Gateway"
311
+ },
312
+ SERVICE_UNAVAILABLE: {
313
+ status: 503,
314
+ message: "Service Unavailable"
315
+ },
316
+ GATEWAY_TIMEOUT: {
317
+ status: 504,
318
+ message: "Gateway Timeout"
319
+ }
320
+ };
321
+ function fallbackORPCErrorStatus(code, status) {
322
+ return status ?? COMMON_ORPC_ERROR_DEFS[code]?.status ?? 500;
323
+ }
324
+ function fallbackORPCErrorMessage(code, message) {
325
+ return message || COMMON_ORPC_ERROR_DEFS[code]?.message || code;
326
+ }
327
+ const GLOBAL_ORPC_ERROR_CONSTRUCTORS_SYMBOL = Symbol.for(`__${ORPC_CLIENT_PACKAGE_NAME}@${ORPC_CLIENT_PACKAGE_VERSION}/error/ORPC_ERROR_CONSTRUCTORS__`);
328
+ globalThis[GLOBAL_ORPC_ERROR_CONSTRUCTORS_SYMBOL] ??= /* @__PURE__ */ new WeakSet();
329
+ const globalORPCErrorConstructors = globalThis[GLOBAL_ORPC_ERROR_CONSTRUCTORS_SYMBOL];
330
+ var ORPCError = class extends Error {
331
+ defined;
332
+ code;
333
+ status;
334
+ data;
335
+ constructor(code, ...rest) {
336
+ const options = resolveMaybeOptionalOptions(rest);
337
+ if (options.status !== void 0 && !isORPCErrorStatus(options.status)) throw new Error("[ORPCError] Invalid error status code.");
338
+ const message = fallbackORPCErrorMessage(code, options.message);
339
+ super(message, options);
340
+ this.code = code;
341
+ this.status = fallbackORPCErrorStatus(code, options.status);
342
+ this.defined = options.defined ?? false;
343
+ this.data = options.data;
344
+ }
345
+ toJSON() {
346
+ return {
347
+ defined: this.defined,
348
+ code: this.code,
349
+ status: this.status,
350
+ message: this.message,
351
+ data: this.data
352
+ };
353
+ }
354
+ /**
355
+ * Workaround for Next.js where different contexts use separate
356
+ * dependency graphs, causing multiple ORPCError constructors existing and breaking
357
+ * `instanceof` checks across contexts.
358
+ *
359
+ * This is particularly problematic with "Optimized SSR", where orpc-client
360
+ * executes in one context but is invoked from another. When an error is thrown
361
+ * in the execution context, `instanceof ORPCError` checks fail in the
362
+ * invocation context due to separate class constructors.
363
+ *
364
+ * @todo Remove this and related code if Next.js resolves the multiple dependency graph issue.
365
+ */
366
+ static [Symbol.hasInstance](instance) {
367
+ if (globalORPCErrorConstructors.has(this)) {
368
+ const constructor = getConstructor(instance);
369
+ if (constructor && globalORPCErrorConstructors.has(constructor)) return true;
370
+ }
371
+ return super[Symbol.hasInstance](instance);
372
+ }
373
+ };
374
+ globalORPCErrorConstructors.add(ORPCError);
375
+ function toORPCError(error) {
376
+ return error instanceof ORPCError ? error : new ORPCError("INTERNAL_SERVER_ERROR", {
377
+ message: "Internal server error",
378
+ cause: error
379
+ });
380
+ }
381
+ function isORPCErrorStatus(status) {
382
+ return status < 200 || status >= 400;
383
+ }
384
+ function isORPCErrorJson(json) {
385
+ if (!isObject(json)) return false;
386
+ const validKeys = [
387
+ "defined",
388
+ "code",
389
+ "status",
390
+ "message",
391
+ "data"
392
+ ];
393
+ if (Object.keys(json).some((k) => !validKeys.includes(k))) return false;
394
+ return "defined" in json && typeof json.defined === "boolean" && "code" in json && typeof json.code === "string" && "status" in json && typeof json.status === "number" && isORPCErrorStatus(json.status) && "message" in json && typeof json.message === "string";
395
+ }
396
+ function createORPCErrorFromJson(json, options = {}) {
397
+ return new ORPCError(json.code, {
398
+ ...options,
399
+ ...json
400
+ });
401
+ }
402
+ //#endregion
403
+ //#region ../../node_modules/.pnpm/@orpc+standard-server@1.14.0_@opentelemetry+api@1.9.0/node_modules/@orpc/standard-server/dist/index.mjs
404
+ var EventEncoderError = class extends TypeError {};
405
+ var EventDecoderError = class extends TypeError {};
406
+ var ErrorEvent = class extends Error {
407
+ data;
408
+ constructor(options) {
409
+ super(options?.message ?? "An error event was received", options);
410
+ this.data = options?.data;
411
+ }
412
+ };
413
+ function decodeEventMessage(encoded) {
414
+ const lines = encoded.replace(/\n+$/, "").split(/\n/);
415
+ const message = {
416
+ data: void 0,
417
+ event: void 0,
418
+ id: void 0,
419
+ retry: void 0,
420
+ comments: []
421
+ };
422
+ for (const line of lines) {
423
+ const index = line.indexOf(":");
424
+ const key = index === -1 ? line : line.slice(0, index);
425
+ const value = index === -1 ? "" : line.slice(index + 1).replace(/^\s/, "");
426
+ if (index === 0) message.comments.push(value);
427
+ else if (key === "data") {
428
+ message.data ??= "";
429
+ message.data += `${value}
430
+ `;
431
+ } else if (key === "event") message.event = value;
432
+ else if (key === "id") message.id = value;
433
+ else if (key === "retry") {
434
+ const maybeInteger = Number.parseInt(value);
435
+ if (Number.isInteger(maybeInteger) && maybeInteger >= 0 && maybeInteger.toString() === value) message.retry = maybeInteger;
436
+ }
437
+ }
438
+ message.data = message.data?.replace(/\n$/, "");
439
+ return message;
440
+ }
441
+ var EventDecoder = class {
442
+ constructor(options = {}) {
443
+ this.options = options;
444
+ }
445
+ incomplete = "";
446
+ feed(chunk) {
447
+ this.incomplete += chunk;
448
+ const lastCompleteIndex = this.incomplete.lastIndexOf("\n\n");
449
+ if (lastCompleteIndex === -1) return;
450
+ const completes = this.incomplete.slice(0, lastCompleteIndex).split(/\n\n/);
451
+ this.incomplete = this.incomplete.slice(lastCompleteIndex + 2);
452
+ for (const encoded of completes) {
453
+ const message = decodeEventMessage(`${encoded}
454
+
455
+ `);
456
+ if (this.options.onEvent) this.options.onEvent(message);
457
+ }
458
+ }
459
+ end() {
460
+ if (this.incomplete) throw new EventDecoderError("Event Iterator ended before complete");
461
+ }
462
+ };
463
+ var EventDecoderStream = class extends TransformStream {
464
+ constructor() {
465
+ let decoder;
466
+ super({
467
+ start(controller) {
468
+ decoder = new EventDecoder({ onEvent: (event) => {
469
+ controller.enqueue(event);
470
+ } });
471
+ },
472
+ transform(chunk) {
473
+ decoder.feed(chunk);
474
+ },
475
+ flush() {
476
+ decoder.end();
477
+ }
478
+ });
479
+ }
480
+ };
481
+ function assertEventId(id) {
482
+ if (id.includes("\n")) throw new EventEncoderError("Event's id must not contain a newline character");
483
+ }
484
+ function assertEventName(event) {
485
+ if (event.includes("\n")) throw new EventEncoderError("Event's event must not contain a newline character");
486
+ }
487
+ function assertEventRetry(retry) {
488
+ if (!Number.isInteger(retry) || retry < 0) throw new EventEncoderError("Event's retry must be a integer and >= 0");
489
+ }
490
+ function assertEventComment(comment) {
491
+ if (comment.includes("\n")) throw new EventEncoderError("Event's comment must not contain a newline character");
492
+ }
493
+ function encodeEventData(data) {
494
+ const lines = data?.split(/\n/) ?? [];
495
+ let output = "";
496
+ for (const line of lines) output += `data: ${line}
497
+ `;
498
+ return output;
499
+ }
500
+ function encodeEventComments(comments) {
501
+ let output = "";
502
+ for (const comment of comments ?? []) {
503
+ assertEventComment(comment);
504
+ output += `: ${comment}
505
+ `;
506
+ }
507
+ return output;
508
+ }
509
+ function encodeEventMessage(message) {
510
+ let output = "";
511
+ output += encodeEventComments(message.comments);
512
+ if (message.event !== void 0) {
513
+ assertEventName(message.event);
514
+ output += `event: ${message.event}
515
+ `;
516
+ }
517
+ if (message.retry !== void 0) {
518
+ assertEventRetry(message.retry);
519
+ output += `retry: ${message.retry}
520
+ `;
521
+ }
522
+ if (message.id !== void 0) {
523
+ assertEventId(message.id);
524
+ output += `id: ${message.id}
525
+ `;
526
+ }
527
+ output += encodeEventData(message.data);
528
+ output += "\n";
529
+ return output;
530
+ }
531
+ const EVENT_SOURCE_META_SYMBOL = Symbol("ORPC_EVENT_SOURCE_META");
532
+ function withEventMeta(container, meta) {
533
+ if (meta.id === void 0 && meta.retry === void 0 && !meta.comments?.length) return container;
534
+ if (meta.id !== void 0) assertEventId(meta.id);
535
+ if (meta.retry !== void 0) assertEventRetry(meta.retry);
536
+ if (meta.comments !== void 0) for (const comment of meta.comments) assertEventComment(comment);
537
+ return new Proxy(container, { get(target, prop, receiver) {
538
+ if (prop === EVENT_SOURCE_META_SYMBOL) return meta;
539
+ return Reflect.get(target, prop, receiver);
540
+ } });
541
+ }
542
+ function getEventMeta(container) {
543
+ return isTypescriptObject(container) ? Reflect.get(container, EVENT_SOURCE_META_SYMBOL) : void 0;
544
+ }
545
+ function generateContentDisposition(filename, disposition = "inline") {
546
+ return `${disposition}; filename="${filename.replace(/[^\x20-\x7E]/g, "_").replace(/"/g, "\\\"")}"; filename*=utf-8''${encodeURIComponent(filename).replace(/['()*]/g, (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`).replace(/%(7C|60|5E)/g, (str, hex) => String.fromCharCode(Number.parseInt(hex, 16)))}`;
547
+ }
548
+ function getFilenameFromContentDisposition(contentDisposition) {
549
+ const encodedFilenameStarMatch = contentDisposition.match(/filename\*=(UTF-8'')?([^;]*)/i);
550
+ if (encodedFilenameStarMatch && typeof encodedFilenameStarMatch[2] === "string") return tryDecodeURIComponent(encodedFilenameStarMatch[2]);
551
+ const encodedFilenameMatch = contentDisposition.match(/filename="((?:\\"|[^"])*)"/i);
552
+ if (encodedFilenameMatch && typeof encodedFilenameMatch[1] === "string") return encodedFilenameMatch[1].replace(/\\"/g, "\"");
553
+ }
554
+ function mergeStandardHeaders(a, b) {
555
+ const merged = { ...a };
556
+ for (const key in b) if (Array.isArray(b[key])) merged[key] = [...toArray(merged[key]), ...b[key]];
557
+ else if (b[key] !== void 0) if (Array.isArray(merged[key])) merged[key] = [...merged[key], b[key]];
558
+ else if (merged[key] !== void 0) merged[key] = [merged[key], b[key]];
559
+ else merged[key] = b[key];
560
+ return merged;
561
+ }
562
+ //#endregion
563
+ //#region ../../node_modules/.pnpm/@orpc+client@1.14.0_@opentelemetry+api@1.9.0/node_modules/@orpc/client/dist/shared/client.BLtwTQUg.mjs
564
+ function mapEventIterator(iterator, maps) {
565
+ const mapError = async (error) => {
566
+ let mappedError = await maps.error(error);
567
+ if (mappedError !== error) {
568
+ const meta = getEventMeta(error);
569
+ if (meta && isTypescriptObject(mappedError)) mappedError = withEventMeta(mappedError, meta);
570
+ }
571
+ return mappedError;
572
+ };
573
+ return new AsyncIteratorClass(async () => {
574
+ const { done, value } = await (async () => {
575
+ try {
576
+ return await iterator.next();
577
+ } catch (error) {
578
+ throw await mapError(error);
579
+ }
580
+ })();
581
+ let mappedValue = await maps.value(value, done);
582
+ if (mappedValue !== value) {
583
+ const meta = getEventMeta(value);
584
+ if (meta && isTypescriptObject(mappedValue)) mappedValue = withEventMeta(mappedValue, meta);
585
+ }
586
+ return {
587
+ done,
588
+ value: mappedValue
589
+ };
590
+ }, async () => {
591
+ try {
592
+ await iterator.return?.();
593
+ } catch (error) {
594
+ throw await mapError(error);
595
+ }
596
+ });
597
+ }
598
+ //#endregion
599
+ //#region ../../node_modules/.pnpm/@orpc+client@1.14.0_@opentelemetry+api@1.9.0/node_modules/@orpc/client/dist/index.mjs
600
+ function resolveFriendlyClientOptions(options) {
601
+ return {
602
+ ...options,
603
+ context: options.context ?? {}
604
+ };
605
+ }
606
+ function createORPCClient(link, options = {}) {
607
+ const path = options.path ?? [];
608
+ const procedureClient = async (...[input, options2 = {}]) => {
609
+ return await link.call(path, input, resolveFriendlyClientOptions(options2));
610
+ };
611
+ return preventNativeAwait(new Proxy(procedureClient, { get(target, key) {
612
+ if (typeof key !== "string") return Reflect.get(target, key);
613
+ return createORPCClient(link, {
614
+ ...options,
615
+ path: [...path, key]
616
+ });
617
+ } }));
618
+ }
619
+ //#endregion
620
+ //#region ../../node_modules/.pnpm/@orpc+standard-server-fetch@1.14.0_@opentelemetry+api@1.9.0/node_modules/@orpc/standard-server-fetch/dist/index.mjs
621
+ function toEventIterator(stream, options = {}) {
622
+ const reader = (stream?.pipeThrough(new TextDecoderStream()).pipeThrough(new EventDecoderStream()))?.getReader();
623
+ let span;
624
+ let isCancelled = false;
625
+ return new AsyncIteratorClass(async () => {
626
+ span ??= startSpan("consume_event_iterator_stream");
627
+ try {
628
+ while (true) {
629
+ if (reader === void 0) return {
630
+ done: true,
631
+ value: void 0
632
+ };
633
+ const { done, value } = await runInSpanContext(span, () => reader.read());
634
+ if (done) {
635
+ if (isCancelled) throw new AbortError("Stream was cancelled");
636
+ return {
637
+ done: true,
638
+ value: void 0
639
+ };
640
+ }
641
+ switch (value.event) {
642
+ case "message": {
643
+ let message = parseEmptyableJSON(value.data);
644
+ if (isTypescriptObject(message)) message = withEventMeta(message, value);
645
+ span?.addEvent("message");
646
+ return {
647
+ done: false,
648
+ value: message
649
+ };
650
+ }
651
+ case "error": {
652
+ let error = new ErrorEvent({ data: parseEmptyableJSON(value.data) });
653
+ error = withEventMeta(error, value);
654
+ span?.addEvent("error");
655
+ throw error;
656
+ }
657
+ case "done": {
658
+ let done2 = parseEmptyableJSON(value.data);
659
+ if (isTypescriptObject(done2)) done2 = withEventMeta(done2, value);
660
+ span?.addEvent("done");
661
+ return {
662
+ done: true,
663
+ value: done2
664
+ };
665
+ }
666
+ default: span?.addEvent("maybe_keepalive");
667
+ }
668
+ }
669
+ } catch (e) {
670
+ if (!(e instanceof ErrorEvent)) setSpanError(span, e, options);
671
+ throw e;
672
+ }
673
+ }, async (reason) => {
674
+ try {
675
+ if (reason !== "next") {
676
+ isCancelled = true;
677
+ span?.addEvent("cancelled");
678
+ }
679
+ await runInSpanContext(span, () => reader?.cancel());
680
+ } catch (e) {
681
+ setSpanError(span, e, options);
682
+ throw e;
683
+ } finally {
684
+ span?.end();
685
+ }
686
+ });
687
+ }
688
+ function toEventStream(iterator, options = {}) {
689
+ const keepAliveEnabled = options.eventIteratorKeepAliveEnabled ?? true;
690
+ const keepAliveInterval = options.eventIteratorKeepAliveInterval ?? 5e3;
691
+ const keepAliveComment = options.eventIteratorKeepAliveComment ?? "";
692
+ const initialCommentEnabled = options.eventIteratorInitialCommentEnabled ?? true;
693
+ const initialComment = options.eventIteratorInitialComment ?? "";
694
+ let cancelled = false;
695
+ let timeout;
696
+ let span;
697
+ return new ReadableStream({
698
+ start(controller) {
699
+ span = startSpan("stream_event_iterator");
700
+ if (initialCommentEnabled) controller.enqueue(encodeEventMessage({ comments: [initialComment] }));
701
+ },
702
+ async pull(controller) {
703
+ try {
704
+ if (keepAliveEnabled) timeout = setInterval(() => {
705
+ controller.enqueue(encodeEventMessage({ comments: [keepAliveComment] }));
706
+ span?.addEvent("keepalive");
707
+ }, keepAliveInterval);
708
+ const value = await runInSpanContext(span, () => iterator.next());
709
+ clearInterval(timeout);
710
+ if (cancelled) return;
711
+ const meta = getEventMeta(value.value);
712
+ if (!value.done || value.value !== void 0 || meta !== void 0) {
713
+ const event = value.done ? "done" : "message";
714
+ controller.enqueue(encodeEventMessage({
715
+ ...meta,
716
+ event,
717
+ data: stringifyJSON(value.value)
718
+ }));
719
+ span?.addEvent(event);
720
+ }
721
+ if (value.done) {
722
+ controller.close();
723
+ span?.end();
724
+ }
725
+ } catch (err) {
726
+ clearInterval(timeout);
727
+ if (cancelled) return;
728
+ if (err instanceof ErrorEvent) {
729
+ controller.enqueue(encodeEventMessage({
730
+ ...getEventMeta(err),
731
+ event: "error",
732
+ data: stringifyJSON(err.data)
733
+ }));
734
+ span?.addEvent("error");
735
+ controller.close();
736
+ } else {
737
+ setSpanError(span, err);
738
+ controller.error(err);
739
+ }
740
+ span?.end();
741
+ }
742
+ },
743
+ async cancel() {
744
+ try {
745
+ cancelled = true;
746
+ clearInterval(timeout);
747
+ span?.addEvent("cancelled");
748
+ await runInSpanContext(span, () => iterator.return?.());
749
+ } catch (e) {
750
+ setSpanError(span, e);
751
+ throw e;
752
+ } finally {
753
+ span?.end();
754
+ }
755
+ }
756
+ }).pipeThrough(new TextEncoderStream());
757
+ }
758
+ function toStandardBody(re, options = {}) {
759
+ return runWithSpan({
760
+ name: "parse_standard_body",
761
+ signal: options.signal
762
+ }, async () => {
763
+ const contentDisposition = re.headers.get("content-disposition");
764
+ if (typeof contentDisposition === "string") {
765
+ const fileName = getFilenameFromContentDisposition(contentDisposition) ?? "blob";
766
+ const blob2 = await re.blob();
767
+ return new File([blob2], fileName, { type: blob2.type });
768
+ }
769
+ const contentType = re.headers.get("content-type");
770
+ if (!contentType || contentType.startsWith("application/json")) return parseEmptyableJSON(await re.text());
771
+ if (contentType.startsWith("multipart/form-data")) return await re.formData();
772
+ if (contentType.startsWith("application/x-www-form-urlencoded")) {
773
+ const text = await re.text();
774
+ return new URLSearchParams(text);
775
+ }
776
+ if (contentType.startsWith("text/event-stream")) return toEventIterator(re.body, options);
777
+ if (contentType.startsWith("text/plain")) return await re.text();
778
+ const blob = await re.blob();
779
+ return new File([blob], "blob", { type: blob.type });
780
+ });
781
+ }
782
+ function toFetchBody(body, headers, options = {}) {
783
+ if (body instanceof ReadableStream) return body;
784
+ const currentContentDisposition = headers.get("content-disposition");
785
+ headers.delete("content-type");
786
+ headers.delete("content-disposition");
787
+ if (body === void 0) return;
788
+ if (body instanceof Blob) {
789
+ headers.set("content-type", body.type);
790
+ headers.set("content-length", body.size.toString());
791
+ headers.set("content-disposition", currentContentDisposition ?? generateContentDisposition(body instanceof File ? body.name : "blob"));
792
+ return body;
793
+ }
794
+ if (body instanceof FormData) return body;
795
+ if (body instanceof URLSearchParams) return body;
796
+ if (isAsyncIteratorObject(body)) {
797
+ headers.set("content-type", "text/event-stream");
798
+ return toEventStream(body, options);
799
+ }
800
+ headers.set("content-type", "application/json");
801
+ return stringifyJSON(body);
802
+ }
803
+ function toStandardHeaders$1(headers, standardHeaders = {}) {
804
+ headers.forEach((value, key) => {
805
+ if (Array.isArray(standardHeaders[key])) standardHeaders[key].push(value);
806
+ else if (standardHeaders[key] !== void 0) standardHeaders[key] = [standardHeaders[key], value];
807
+ else standardHeaders[key] = value;
808
+ });
809
+ return standardHeaders;
810
+ }
811
+ function toFetchHeaders(headers, fetchHeaders = new Headers()) {
812
+ for (const [key, value] of Object.entries(headers)) if (Array.isArray(value)) for (const v of value) fetchHeaders.append(key, v);
813
+ else if (value !== void 0) fetchHeaders.append(key, value);
814
+ return fetchHeaders;
815
+ }
816
+ function toFetchRequest(request, options = {}) {
817
+ const headers = toFetchHeaders(request.headers);
818
+ const body = toFetchBody(request.body, headers, options);
819
+ return new Request(request.url, {
820
+ signal: request.signal,
821
+ method: request.method,
822
+ headers,
823
+ body
824
+ });
825
+ }
826
+ function toStandardLazyResponse(response, options = {}) {
827
+ return {
828
+ body: once(() => toStandardBody(response, options)),
829
+ status: response.status,
830
+ get headers() {
831
+ const headers = toStandardHeaders$1(response.headers);
832
+ Object.defineProperty(this, "headers", {
833
+ value: headers,
834
+ writable: true
835
+ });
836
+ return headers;
837
+ },
838
+ set headers(value) {
839
+ Object.defineProperty(this, "headers", {
840
+ value,
841
+ writable: true
842
+ });
843
+ }
844
+ };
845
+ }
846
+ //#endregion
847
+ //#region ../../node_modules/.pnpm/@orpc+client@1.14.0_@opentelemetry+api@1.9.0/node_modules/@orpc/client/dist/shared/client.DrB9nq_G.mjs
848
+ var CompositeStandardLinkPlugin = class {
849
+ plugins;
850
+ constructor(plugins = []) {
851
+ this.plugins = [...plugins].sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
852
+ }
853
+ init(options) {
854
+ for (const plugin of this.plugins) plugin.init?.(options);
855
+ }
856
+ };
857
+ var StandardLink = class {
858
+ constructor(codec, sender, options = {}) {
859
+ this.codec = codec;
860
+ this.sender = sender;
861
+ new CompositeStandardLinkPlugin(options.plugins).init(options);
862
+ this.interceptors = toArray(options.interceptors);
863
+ this.clientInterceptors = toArray(options.clientInterceptors);
864
+ }
865
+ interceptors;
866
+ clientInterceptors;
867
+ call(path, input, options) {
868
+ return runWithSpan({
869
+ name: `${ORPC_NAME}.${path.join("/")}`,
870
+ signal: options.signal
871
+ }, (span) => {
872
+ span?.setAttribute("rpc.system", ORPC_NAME);
873
+ span?.setAttribute("rpc.method", path.join("."));
874
+ if (isAsyncIteratorObject(input)) input = asyncIteratorWithSpan({
875
+ name: "consume_event_iterator_input",
876
+ signal: options.signal
877
+ }, input);
878
+ return intercept(this.interceptors, {
879
+ ...options,
880
+ path,
881
+ input
882
+ }, async ({ path: path2, input: input2, ...options2 }) => {
883
+ const otelConfig = getGlobalOtelConfig();
884
+ let otelContext;
885
+ const currentSpan = otelConfig?.trace.getActiveSpan() ?? span;
886
+ if (currentSpan && otelConfig) otelContext = otelConfig?.trace.setSpan(otelConfig.context.active(), currentSpan);
887
+ const request = await runWithSpan({
888
+ name: "encode_request",
889
+ context: otelContext
890
+ }, () => this.codec.encode(path2, input2, options2));
891
+ const response = await intercept(this.clientInterceptors, {
892
+ ...options2,
893
+ input: input2,
894
+ path: path2,
895
+ request
896
+ }, ({ input: input3, path: path3, request: request2, ...options3 }) => {
897
+ return runWithSpan({
898
+ name: "send_request",
899
+ signal: options3.signal,
900
+ context: otelContext
901
+ }, () => this.sender.call(request2, options3, path3, input3));
902
+ });
903
+ const output = await runWithSpan({
904
+ name: "decode_response",
905
+ context: otelContext
906
+ }, () => this.codec.decode(response, options2, path2, input2));
907
+ if (isAsyncIteratorObject(output)) return asyncIteratorWithSpan({
908
+ name: "consume_event_iterator_output",
909
+ signal: options2.signal
910
+ }, output);
911
+ return output;
912
+ });
913
+ });
914
+ }
915
+ };
916
+ const STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES = {
917
+ BIGINT: 0,
918
+ DATE: 1,
919
+ NAN: 2,
920
+ UNDEFINED: 3,
921
+ URL: 4,
922
+ REGEXP: 5,
923
+ SET: 6,
924
+ MAP: 7
925
+ };
926
+ var StandardRPCJsonSerializer = class {
927
+ customSerializers;
928
+ constructor(options = {}) {
929
+ this.customSerializers = options.customJsonSerializers ?? [];
930
+ if (this.customSerializers.length !== new Set(this.customSerializers.map((custom) => custom.type)).size) throw new Error("Custom serializer type must be unique.");
931
+ }
932
+ serialize(data, segments = [], meta = [], maps = [], blobs = []) {
933
+ for (const custom of this.customSerializers) if (custom.condition(data)) {
934
+ const result = this.serialize(custom.serialize(data), segments, meta, maps, blobs);
935
+ meta.push([custom.type, ...segments]);
936
+ return result;
937
+ }
938
+ if (data instanceof Blob) {
939
+ maps.push(segments);
940
+ blobs.push(data);
941
+ return [
942
+ data,
943
+ meta,
944
+ maps,
945
+ blobs
946
+ ];
947
+ }
948
+ if (typeof data === "bigint") {
949
+ meta.push([STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES.BIGINT, ...segments]);
950
+ return [
951
+ data.toString(),
952
+ meta,
953
+ maps,
954
+ blobs
955
+ ];
956
+ }
957
+ if (data instanceof Date) {
958
+ meta.push([STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES.DATE, ...segments]);
959
+ if (Number.isNaN(data.getTime())) return [
960
+ null,
961
+ meta,
962
+ maps,
963
+ blobs
964
+ ];
965
+ return [
966
+ data.toISOString(),
967
+ meta,
968
+ maps,
969
+ blobs
970
+ ];
971
+ }
972
+ if (Number.isNaN(data)) {
973
+ meta.push([STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES.NAN, ...segments]);
974
+ return [
975
+ null,
976
+ meta,
977
+ maps,
978
+ blobs
979
+ ];
980
+ }
981
+ if (data instanceof URL) {
982
+ meta.push([STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES.URL, ...segments]);
983
+ return [
984
+ data.toString(),
985
+ meta,
986
+ maps,
987
+ blobs
988
+ ];
989
+ }
990
+ if (data instanceof RegExp) {
991
+ meta.push([STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES.REGEXP, ...segments]);
992
+ return [
993
+ data.toString(),
994
+ meta,
995
+ maps,
996
+ blobs
997
+ ];
998
+ }
999
+ if (data instanceof Set) {
1000
+ const result = this.serialize(Array.from(data), segments, meta, maps, blobs);
1001
+ meta.push([STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES.SET, ...segments]);
1002
+ return result;
1003
+ }
1004
+ if (data instanceof Map) {
1005
+ const result = this.serialize(Array.from(data.entries()), segments, meta, maps, blobs);
1006
+ meta.push([STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES.MAP, ...segments]);
1007
+ return result;
1008
+ }
1009
+ if (Array.isArray(data)) return [
1010
+ data.map((v, i) => {
1011
+ if (v === void 0) {
1012
+ meta.push([
1013
+ STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES.UNDEFINED,
1014
+ ...segments,
1015
+ i
1016
+ ]);
1017
+ return null;
1018
+ }
1019
+ return this.serialize(v, [...segments, i], meta, maps, blobs)[0];
1020
+ }),
1021
+ meta,
1022
+ maps,
1023
+ blobs
1024
+ ];
1025
+ if (isObject(data)) {
1026
+ const json = {};
1027
+ for (const k in data) {
1028
+ if (k === "toJSON" && typeof data[k] === "function") continue;
1029
+ json[k] = this.serialize(data[k], [...segments, k], meta, maps, blobs)[0];
1030
+ }
1031
+ return [
1032
+ json,
1033
+ meta,
1034
+ maps,
1035
+ blobs
1036
+ ];
1037
+ }
1038
+ return [
1039
+ data,
1040
+ meta,
1041
+ maps,
1042
+ blobs
1043
+ ];
1044
+ }
1045
+ deserialize(json, meta, maps, getBlob) {
1046
+ const ref = { data: json };
1047
+ if (maps && getBlob) maps.forEach((segments, i) => {
1048
+ let currentRef = ref;
1049
+ let preSegment = "data";
1050
+ segments.forEach((segment) => {
1051
+ currentRef = currentRef[preSegment];
1052
+ preSegment = segment;
1053
+ if (!Object.hasOwn(currentRef, preSegment)) throw new Error(`Security error: accessing non-existent path during deserialization. Path segment: ${preSegment}`);
1054
+ });
1055
+ currentRef[preSegment] = getBlob(i);
1056
+ });
1057
+ for (const item of meta) {
1058
+ const type = item[0];
1059
+ let currentRef = ref;
1060
+ let preSegment = "data";
1061
+ for (let i = 1; i < item.length; i++) {
1062
+ currentRef = currentRef[preSegment];
1063
+ preSegment = item[i];
1064
+ if (!Object.hasOwn(currentRef, preSegment)) throw new Error(`Security error: accessing non-existent path during deserialization. Path segment: ${preSegment}`);
1065
+ }
1066
+ for (const custom of this.customSerializers) if (custom.type === type) {
1067
+ currentRef[preSegment] = custom.deserialize(currentRef[preSegment]);
1068
+ break;
1069
+ }
1070
+ switch (type) {
1071
+ case STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES.BIGINT:
1072
+ currentRef[preSegment] = BigInt(currentRef[preSegment]);
1073
+ break;
1074
+ case STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES.DATE:
1075
+ currentRef[preSegment] = new Date(currentRef[preSegment] ?? "Invalid Date");
1076
+ break;
1077
+ case STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES.NAN:
1078
+ currentRef[preSegment] = NaN;
1079
+ break;
1080
+ case STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES.UNDEFINED:
1081
+ currentRef[preSegment] = void 0;
1082
+ break;
1083
+ case STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES.URL:
1084
+ currentRef[preSegment] = new URL(currentRef[preSegment]);
1085
+ break;
1086
+ case STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES.REGEXP: {
1087
+ const [, pattern, flags] = currentRef[preSegment].match(/^\/(.*)\/([a-z]*)$/);
1088
+ currentRef[preSegment] = new RegExp(pattern, flags);
1089
+ break;
1090
+ }
1091
+ case STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES.SET:
1092
+ currentRef[preSegment] = new Set(currentRef[preSegment]);
1093
+ break;
1094
+ case STANDARD_RPC_JSON_SERIALIZER_BUILT_IN_TYPES.MAP:
1095
+ currentRef[preSegment] = new Map(currentRef[preSegment]);
1096
+ break;
1097
+ }
1098
+ }
1099
+ return ref.data;
1100
+ }
1101
+ };
1102
+ function toHttpPath(path) {
1103
+ return `/${path.map(encodeURIComponent).join("/")}`;
1104
+ }
1105
+ function toStandardHeaders(headers) {
1106
+ if (typeof headers.forEach === "function") return toStandardHeaders$1(headers);
1107
+ return headers;
1108
+ }
1109
+ function getMalformedResponseErrorCode(status) {
1110
+ return Object.entries(COMMON_ORPC_ERROR_DEFS).find(([, def]) => def.status === status)?.[0] ?? "MALFORMED_ORPC_ERROR_RESPONSE";
1111
+ }
1112
+ var StandardRPCLinkCodec = class {
1113
+ constructor(serializer, options) {
1114
+ this.serializer = serializer;
1115
+ this.baseUrl = options.url;
1116
+ this.maxUrlLength = options.maxUrlLength ?? 2083;
1117
+ this.fallbackMethod = options.fallbackMethod ?? "POST";
1118
+ this.expectedMethod = options.method ?? this.fallbackMethod;
1119
+ this.headers = options.headers ?? {};
1120
+ }
1121
+ baseUrl;
1122
+ maxUrlLength;
1123
+ fallbackMethod;
1124
+ expectedMethod;
1125
+ headers;
1126
+ async encode(path, input, options) {
1127
+ let headers = toStandardHeaders(await value(this.headers, options, path, input));
1128
+ if (options.lastEventId !== void 0) headers = mergeStandardHeaders(headers, { "last-event-id": options.lastEventId });
1129
+ const expectedMethod = await value(this.expectedMethod, options, path, input);
1130
+ const baseUrl = await value(this.baseUrl, options, path, input);
1131
+ const url = new URL(baseUrl);
1132
+ url.pathname = `${url.pathname.replace(/\/$/, "")}${toHttpPath(path)}`;
1133
+ const serialized = this.serializer.serialize(input);
1134
+ if (expectedMethod === "GET" && !(serialized instanceof FormData) && !isAsyncIteratorObject(serialized)) {
1135
+ const maxUrlLength = await value(this.maxUrlLength, options, path, input);
1136
+ const getUrl = new URL(url);
1137
+ getUrl.searchParams.append("data", stringifyJSON(serialized));
1138
+ if (getUrl.toString().length <= maxUrlLength) return {
1139
+ body: void 0,
1140
+ method: expectedMethod,
1141
+ headers,
1142
+ url: getUrl,
1143
+ signal: options.signal
1144
+ };
1145
+ }
1146
+ return {
1147
+ url,
1148
+ method: expectedMethod === "GET" ? this.fallbackMethod : expectedMethod,
1149
+ headers,
1150
+ body: serialized,
1151
+ signal: options.signal
1152
+ };
1153
+ }
1154
+ async decode(response) {
1155
+ const isOk = !isORPCErrorStatus(response.status);
1156
+ const deserialized = await (async () => {
1157
+ let isBodyOk = false;
1158
+ try {
1159
+ const body = await response.body();
1160
+ isBodyOk = true;
1161
+ return this.serializer.deserialize(body);
1162
+ } catch (error) {
1163
+ if (!isBodyOk) throw new Error("Cannot parse response body, please check the response body and content-type.", { cause: error });
1164
+ throw new Error("Invalid RPC response format.", { cause: error });
1165
+ }
1166
+ })();
1167
+ if (!isOk) {
1168
+ if (isORPCErrorJson(deserialized)) throw createORPCErrorFromJson(deserialized);
1169
+ throw new ORPCError(getMalformedResponseErrorCode(response.status), {
1170
+ status: response.status,
1171
+ data: {
1172
+ ...response,
1173
+ body: deserialized
1174
+ }
1175
+ });
1176
+ }
1177
+ return deserialized;
1178
+ }
1179
+ };
1180
+ var StandardRPCSerializer = class {
1181
+ constructor(jsonSerializer) {
1182
+ this.jsonSerializer = jsonSerializer;
1183
+ }
1184
+ serialize(data) {
1185
+ if (isAsyncIteratorObject(data)) return mapEventIterator(data, {
1186
+ value: async (value) => this.#serialize(value, false),
1187
+ error: async (e) => {
1188
+ return new ErrorEvent({
1189
+ data: this.#serialize(toORPCError(e).toJSON(), false),
1190
+ cause: e
1191
+ });
1192
+ }
1193
+ });
1194
+ return this.#serialize(data, true);
1195
+ }
1196
+ #serialize(data, enableFormData) {
1197
+ const [json, meta_, maps, blobs] = this.jsonSerializer.serialize(data);
1198
+ const meta = meta_.length === 0 ? void 0 : meta_;
1199
+ if (!enableFormData || blobs.length === 0) return {
1200
+ json,
1201
+ meta
1202
+ };
1203
+ const form = new FormData();
1204
+ form.set("data", stringifyJSON({
1205
+ json,
1206
+ meta,
1207
+ maps
1208
+ }));
1209
+ blobs.forEach((blob, i) => {
1210
+ form.set(i.toString(), blob);
1211
+ });
1212
+ return form;
1213
+ }
1214
+ deserialize(data) {
1215
+ if (isAsyncIteratorObject(data)) return mapEventIterator(data, {
1216
+ value: async (value) => this.#deserialize(value),
1217
+ error: async (e) => {
1218
+ if (!(e instanceof ErrorEvent)) return e;
1219
+ const deserialized = this.#deserialize(e.data);
1220
+ if (isORPCErrorJson(deserialized)) return createORPCErrorFromJson(deserialized, { cause: e });
1221
+ return new ErrorEvent({
1222
+ data: deserialized,
1223
+ cause: e
1224
+ });
1225
+ }
1226
+ });
1227
+ return this.#deserialize(data);
1228
+ }
1229
+ #deserialize(data) {
1230
+ if (data === void 0) return;
1231
+ if (!(data instanceof FormData)) return this.jsonSerializer.deserialize(data.json, data.meta ?? []);
1232
+ const serialized = JSON.parse(data.get("data"));
1233
+ return this.jsonSerializer.deserialize(serialized.json, serialized.meta ?? [], serialized.maps, (i) => data.get(i.toString()));
1234
+ }
1235
+ };
1236
+ var StandardRPCLink = class extends StandardLink {
1237
+ constructor(linkClient, options) {
1238
+ const linkCodec = new StandardRPCLinkCodec(new StandardRPCSerializer(new StandardRPCJsonSerializer(options)), options);
1239
+ super(linkCodec, linkClient, options);
1240
+ }
1241
+ };
1242
+ //#endregion
1243
+ //#region ../../node_modules/.pnpm/@orpc+client@1.14.0_@opentelemetry+api@1.9.0/node_modules/@orpc/client/dist/adapters/fetch/index.mjs
1244
+ var CompositeLinkFetchPlugin = class extends CompositeStandardLinkPlugin {
1245
+ initRuntimeAdapter(options) {
1246
+ for (const plugin of this.plugins) plugin.initRuntimeAdapter?.(options);
1247
+ }
1248
+ };
1249
+ var LinkFetchClient = class {
1250
+ fetch;
1251
+ toFetchRequestOptions;
1252
+ adapterInterceptors;
1253
+ constructor(options) {
1254
+ new CompositeLinkFetchPlugin(options.plugins).initRuntimeAdapter(options);
1255
+ this.fetch = options.fetch ?? globalThis.fetch.bind(globalThis);
1256
+ this.toFetchRequestOptions = options;
1257
+ this.adapterInterceptors = toArray(options.adapterInterceptors);
1258
+ }
1259
+ async call(standardRequest, options, path, input) {
1260
+ const request = toFetchRequest(standardRequest, this.toFetchRequestOptions);
1261
+ return toStandardLazyResponse(await intercept(this.adapterInterceptors, {
1262
+ ...options,
1263
+ request,
1264
+ path,
1265
+ input,
1266
+ init: { redirect: "manual" }
1267
+ }, ({ request: request2, path: path2, input: input2, init, ...options2 }) => this.fetch(request2, init, options2, path2, input2)), { signal: request.signal });
1268
+ }
1269
+ };
1270
+ var RPCLink = class extends StandardRPCLink {
1271
+ constructor(options) {
1272
+ const linkClient = new LinkFetchClient(options);
1273
+ super(linkClient, options);
1274
+ }
1275
+ };
1276
+ //#endregion
1277
+ //#region ../orpc/src/shared/client.ts
1278
+ function createLink(options) {
1279
+ return new RPCLink({
1280
+ url: options.baseUrl,
1281
+ headers: async () => {
1282
+ const baseHeaders = { "Content-Type": "application/json" };
1283
+ const customHeaders = typeof options.headers === "function" ? await options.headers() : options.headers;
1284
+ if (customHeaders) Object.assign(baseHeaders, customHeaders);
1285
+ if (options.getAuthToken) {
1286
+ const token = await options.getAuthToken();
1287
+ if (token) baseHeaders["Cookie"] = `tourial-session=${token}`;
1288
+ }
1289
+ return baseHeaders;
1290
+ },
1291
+ fetch: options.fetch || options.onResponse ? async (request, init) => {
1292
+ const response = await (options.fetch || globalThis.fetch)(request, init);
1293
+ if (options.onResponse) await options.onResponse(response);
1294
+ return response;
1295
+ } : void 0
1296
+ });
1297
+ }
1298
+ //#endregion
1299
+ //#region ../orpc/src/live/client.ts
1300
+ /**
1301
+ * Create an HTTP client for calling live oRPC API endpoints
1302
+ */
1303
+ function createLiveHttpClient(options) {
1304
+ return createORPCClient(createLink(options));
1305
+ }
1306
+ //#endregion
1307
+ //#region src/api.ts
1308
+ /**
1309
+ * Normalize a branded-host origin into the `/api/v3` base the live API is served
1310
+ * under. Accepts a bare origin ("https://guide.acme.com") or a URL that already
1311
+ * ends with `/api/v3`.
1312
+ */
1313
+ function toApiBaseUrl(baseUrl) {
1314
+ const trimmed = baseUrl.replace(/\/+$/, "");
1315
+ return trimmed.endsWith("/api/v3") ? trimmed : `${trimmed}/api/v3`;
1316
+ }
1317
+ /**
1318
+ * Wrap a fetch implementation so every request carries the visitor cookies.
1319
+ * This is the load-bearing piece: the branded host is same-site with the
1320
+ * customer's page, so `credentials: "include"` lets the existing
1321
+ * `navless-live-*` cookies attach in every browser.
1322
+ */
1323
+ function withCredentials(fetchImpl) {
1324
+ return (input, init) => fetchImpl(input, {
1325
+ ...init,
1326
+ credentials: "include"
1327
+ });
1328
+ }
1329
+ /** Build the typed live oRPC client, reusing @navless/orpc's client factory. */
1330
+ function createApiClient(apiBaseUrl, fetchImpl) {
1331
+ return createLiveHttpClient({
1332
+ baseUrl: apiBaseUrl,
1333
+ fetch: withCredentials(fetchImpl)
1334
+ });
1335
+ }
1336
+ //#endregion
1337
+ //#region src/analytics.ts
1338
+ const UTM_KEYS = [
1339
+ "utm_source",
1340
+ "utm_medium",
1341
+ "utm_campaign",
1342
+ "utm_term",
1343
+ "utm_content"
1344
+ ];
1345
+ const INTEGRATION_COOKIE_KEYS = ["hubspotutk", "_mkto_trk"];
1346
+ /** Pull UTM attribution params out of a `location.search` string. */
1347
+ function extractUTMParams(search) {
1348
+ const params = new URLSearchParams(search);
1349
+ const result = {};
1350
+ for (const key of UTM_KEYS) {
1351
+ const value = params.get(key);
1352
+ if (value) result[key] = value;
1353
+ }
1354
+ return result;
1355
+ }
1356
+ /**
1357
+ * Pull first-party integration cookies (HubSpot, Marketo) out of a
1358
+ * `document.cookie` string so they can be forwarded for CRM stitching.
1359
+ */
1360
+ function extractIntegrationCookies(cookieString) {
1361
+ const cookies = {};
1362
+ for (const key of INTEGRATION_COOKIE_KEYS) {
1363
+ const match = cookieString.match(new RegExp(`(?:^|;\\s*)${key}=([^;]*)`));
1364
+ if (match?.[1]) cookies[key] = decodeURIComponent(match[1]);
1365
+ }
1366
+ return cookies;
1367
+ }
1368
+ /** Read `document.cookie`, swallowing the SecurityError thrown in opaque origins. */
1369
+ function safeCookieString() {
1370
+ if (typeof document === "undefined") return "";
1371
+ try {
1372
+ return document.cookie;
1373
+ } catch {
1374
+ return "";
1375
+ }
1376
+ }
1377
+ //#endregion
1378
+ //#region src/types.ts
1379
+ /** AG-UI protocol frame types written by the guide SSE stream. */
1380
+ const SSEMessageType = {
1381
+ RunStarted: "RUN_STARTED",
1382
+ RunFinished: "RUN_FINISHED",
1383
+ RunError: "RUN_ERROR",
1384
+ TextMessageStart: "TEXT_MESSAGE_START",
1385
+ TextMessageContent: "TEXT_MESSAGE_CONTENT",
1386
+ TextMessageEnd: "TEXT_MESSAGE_END",
1387
+ Custom: "CUSTOM"
1388
+ };
1389
+ /** The `name` on `CUSTOM` guide events (skill payloads). */
1390
+ const GuideEvent = {
1391
+ SkillStart: "skill_start",
1392
+ SkillContent: "skill_content",
1393
+ SkillDocuments: "skill_documents",
1394
+ SkillRecommendations: "skill_recommendations",
1395
+ SkillCTAs: "skill_ctas",
1396
+ SkillDiagnoseHeader: "skill_diagnose_header",
1397
+ SkillDiagnoseQuestion: "skill_diagnose_question",
1398
+ SkillPlaylistItems: "skill_playlist_items",
1399
+ SkillPlaylistHeader: "skill_playlist_header",
1400
+ SkillPlaylistRationale: "skill_playlist_rationale",
1401
+ SkillHowToOutline: "skill_howto_outline",
1402
+ SkillHowToSteps: "skill_howto_steps",
1403
+ SkillBusinessCaseChooser: "skill_businesscase_chooser",
1404
+ SkillBusinessCaseDelta: "skill_businesscase_delta",
1405
+ SkillSolutionDesignHeader: "skill_solutiondesign_header",
1406
+ SkillSolutionDesignDiagram: "skill_solutiondesign_diagram",
1407
+ SkillEnd: "skill_end",
1408
+ SkillError: "skill_error",
1409
+ SkillGate: "skill_gate",
1410
+ InputSuggestions: "input_suggestions"
1411
+ };
1412
+ /** The guide skill types. `answer` is always on; the rest are enabled per-guide. */
1413
+ const SkillResponseType = {
1414
+ Answer: "answer",
1415
+ HowTo: "howto",
1416
+ Diagnose: "diagnose",
1417
+ Recommend: "recommend",
1418
+ Playlist: "playlist",
1419
+ BusinessCase: "businesscase",
1420
+ SolutionDesign: "solutiondesign"
1421
+ };
1422
+ /** Consent tiers. `essential` is always granted server-side. */
1423
+ const ConsentTier = {
1424
+ Essential: "essential",
1425
+ Functional: "functional",
1426
+ Analytical: "analytical"
1427
+ };
1428
+ /** Analytics events fired by the SDK bootstrap. */
1429
+ const EmbedTrackingEvent = {
1430
+ EmbedLoaded: "embed_loaded",
1431
+ EmbedPageView: "embed_page_view",
1432
+ EmbedTriggerClicked: "embed_trigger_clicked",
1433
+ EmbedSideTabClicked: "embed_side_tab_clicked",
1434
+ EmbedSideTabDismissed: "embed_side_tab_dismissed"
1435
+ };
1436
+ //#endregion
1437
+ //#region src/chat-stream.ts
1438
+ const DATA_PREFIX = "data:";
1439
+ const DONE_SENTINEL = "[DONE]";
1440
+ /**
1441
+ * Stream a guide chat turn. POSTs the conversation to the SSE route
1442
+ * (`/api/v3/guide/conversation`) and yields normalized {@link GuideStreamEvent}s
1443
+ * until the server writes `data: [DONE]`. This is the one endpoint that is not
1444
+ * part of the typed oRPC router, so it is spoken by hand here.
1445
+ */
1446
+ async function* streamConversation(params) {
1447
+ const { apiBaseUrl, guideId, messages, forcedSkill, fetchImpl, signal } = params;
1448
+ const body = {
1449
+ guideId,
1450
+ messages: messages.map((m) => ({
1451
+ role: m.role,
1452
+ content: m.content
1453
+ }))
1454
+ };
1455
+ if (forcedSkill) body.forcedSkill = forcedSkill;
1456
+ const response = await fetchImpl(`${apiBaseUrl}/guide/conversation`, {
1457
+ method: "POST",
1458
+ headers: { "Content-Type": "application/json" },
1459
+ credentials: "include",
1460
+ body: JSON.stringify(body),
1461
+ signal
1462
+ });
1463
+ if (!response.ok || !response.body) throw new Error(`[brand_brain] Conversation request failed with status ${response.status}`);
1464
+ const reader = response.body.getReader();
1465
+ const decoder = new TextDecoder();
1466
+ let buffer = "";
1467
+ try {
1468
+ for (;;) {
1469
+ const { done, value } = await reader.read();
1470
+ if (done) break;
1471
+ buffer += decoder.decode(value, { stream: true });
1472
+ let separatorIndex = buffer.indexOf("\n\n");
1473
+ while (separatorIndex !== -1) {
1474
+ const rawEvent = buffer.slice(0, separatorIndex);
1475
+ buffer = buffer.slice(separatorIndex + 2);
1476
+ separatorIndex = buffer.indexOf("\n\n");
1477
+ const dataLine = rawEvent.split("\n").find((line) => line.startsWith(DATA_PREFIX));
1478
+ if (!dataLine) continue;
1479
+ const data = dataLine.slice(5).trim();
1480
+ if (data === DONE_SENTINEL) return;
1481
+ const mapped = mapFrame(JSON.parse(data));
1482
+ if (mapped) yield mapped;
1483
+ }
1484
+ }
1485
+ } finally {
1486
+ reader.releaseLock();
1487
+ }
1488
+ }
1489
+ function mapFrame(frame) {
1490
+ switch (frame.type) {
1491
+ case SSEMessageType.RunStarted: return {
1492
+ type: "run-started",
1493
+ runId: frame.runId ?? ""
1494
+ };
1495
+ case SSEMessageType.RunFinished: return {
1496
+ type: "run-finished",
1497
+ finishReason: frame.finishReason
1498
+ };
1499
+ case SSEMessageType.RunError: return {
1500
+ type: "error",
1501
+ message: frame.error?.message ?? "Unknown error",
1502
+ code: frame.error?.code
1503
+ };
1504
+ case SSEMessageType.TextMessageStart: return {
1505
+ type: "message-start",
1506
+ messageId: frame.messageId ?? "",
1507
+ role: frame.role ?? "assistant"
1508
+ };
1509
+ case SSEMessageType.TextMessageContent: return {
1510
+ type: "text",
1511
+ messageId: frame.messageId ?? "",
1512
+ delta: frame.delta ?? ""
1513
+ };
1514
+ case SSEMessageType.TextMessageEnd: return {
1515
+ type: "message-end",
1516
+ messageId: frame.messageId ?? ""
1517
+ };
1518
+ case SSEMessageType.Custom: return mapCustomFrame(frame);
1519
+ default: return null;
1520
+ }
1521
+ }
1522
+ function mapCustomFrame(frame) {
1523
+ if (!frame.name) return null;
1524
+ const value = frame.value ?? {};
1525
+ if (frame.name === GuideEvent.SkillGate) return {
1526
+ type: "gate",
1527
+ skill: value.skill,
1528
+ prompt: value.prompt,
1529
+ skillInstanceId: value.skillInstanceId
1530
+ };
1531
+ if (frame.name === GuideEvent.SkillError) return {
1532
+ type: "error",
1533
+ message: value.message ?? "Skill error",
1534
+ code: value.errorType
1535
+ };
1536
+ return {
1537
+ type: "skill",
1538
+ name: frame.name,
1539
+ value
1540
+ };
1541
+ }
1542
+ //#endregion
1543
+ //#region src/GuideClient.ts
1544
+ function resolveDomain(config) {
1545
+ if (config.domain) return config.domain;
1546
+ if (typeof window !== "undefined") return window.location.hostname;
1547
+ throw new Error("[brand_brain] `domain` is required when running without a browser `window`.");
1548
+ }
1549
+ /**
1550
+ * The client returned by {@link initGuide}. Holds the resolved guide, the
1551
+ * credentialed live API client, and the in-memory conversation history. Every
1552
+ * method reuses an existing public endpoint — the SDK adds no server surface.
1553
+ */
1554
+ var GuideClient = class GuideClient {
1555
+ #api;
1556
+ constructor(params) {
1557
+ this.history = [];
1558
+ this.conversations = {
1559
+ getOrCreate: () => this.#api.conversations.getOrCreate({
1560
+ guideId: this.guide.id,
1561
+ accountId: this.guide.accountId
1562
+ }),
1563
+ list: () => this.#api.conversations.list({
1564
+ guideId: this.guide.id,
1565
+ accountId: this.guide.accountId
1566
+ }),
1567
+ get: (conversationId, options) => this.#api.conversations.get({
1568
+ conversationId,
1569
+ accountId: this.guide.accountId,
1570
+ ...options
1571
+ }),
1572
+ delete: (conversationId) => this.#api.conversations.delete({
1573
+ conversationId,
1574
+ accountId: this.guide.accountId
1575
+ })
1576
+ };
1577
+ this.skills = {
1578
+ listHistory: () => this.#api.skillInstances.listHistory({
1579
+ accountId: this.guide.accountId,
1580
+ guideId: this.guide.id
1581
+ }),
1582
+ get: (skillInstanceId) => this.#api.skillInstances.get({ skillInstanceId }),
1583
+ update: (skillInstanceId, data) => this.#api.skillInstances.update({
1584
+ skillInstanceId,
1585
+ data
1586
+ }),
1587
+ selectDraft: (draftId) => this.#api.skillInstances.selectDraft({ draftId }),
1588
+ markShared: (skillInstanceId) => this.#api.skillInstances.markShared({ skillInstanceId }),
1589
+ importShared: (sourceSkillInstanceId) => this.#api.skillInstances.importShared({
1590
+ sourceSkillInstanceId,
1591
+ accountId: this.guide.accountId
1592
+ })
1593
+ };
1594
+ this.guide = params.guide;
1595
+ this.apiBaseUrl = params.apiBaseUrl;
1596
+ this.domain = params.domain;
1597
+ this.fetchImpl = params.fetchImpl;
1598
+ this.#api = createApiClient(this.apiBaseUrl, this.fetchImpl);
1599
+ }
1600
+ static async init(config) {
1601
+ const fetchImpl = config.fetch ?? globalThis.fetch.bind(globalThis);
1602
+ const apiBaseUrl = toApiBaseUrl(config.baseUrl);
1603
+ const domain = resolveDomain(config);
1604
+ const guide = await createApiClient(apiBaseUrl, fetchImpl).guides.resolve({
1605
+ domain,
1606
+ slug: config.slug
1607
+ });
1608
+ const client = new GuideClient({
1609
+ guide,
1610
+ apiBaseUrl,
1611
+ domain,
1612
+ fetchImpl
1613
+ });
1614
+ await client.applyInitialConsent(config.consent ?? "auto", guide.gdprEnabled);
1615
+ if (config.trackLoad ?? true) client.trackLoad();
1616
+ return client;
1617
+ }
1618
+ /** The account this guide belongs to (used implicitly by history calls). */
1619
+ get accountId() {
1620
+ return this.guide.accountId;
1621
+ }
1622
+ /** The in-memory conversation history accumulated by {@link ask}. */
1623
+ get messages() {
1624
+ return this.history;
1625
+ }
1626
+ /**
1627
+ * Send a message and stream the reply. Yields text deltas for the chat bubble
1628
+ * plus every structured skill event; the full 7-skill surface flows through
1629
+ * one stream. The user + assistant turns are appended to {@link messages}.
1630
+ */
1631
+ async *ask(message, options = {}) {
1632
+ this.history.push({
1633
+ id: crypto.randomUUID(),
1634
+ role: "user",
1635
+ content: message
1636
+ });
1637
+ let assistant = null;
1638
+ for await (const event of streamConversation({
1639
+ apiBaseUrl: this.apiBaseUrl,
1640
+ guideId: this.guide.id,
1641
+ messages: this.history,
1642
+ forcedSkill: options.forcedSkill,
1643
+ fetchImpl: this.fetchImpl,
1644
+ signal: options.signal
1645
+ })) {
1646
+ if (event.type === "message-start") {
1647
+ assistant = {
1648
+ id: event.messageId || crypto.randomUUID(),
1649
+ role: "assistant",
1650
+ content: ""
1651
+ };
1652
+ this.history.push(assistant);
1653
+ } else if (event.type === "text" && assistant) assistant.content += event.delta;
1654
+ yield event;
1655
+ }
1656
+ }
1657
+ /** Clear the in-memory conversation history (server-side history is unaffected). */
1658
+ reset() {
1659
+ this.history.length = 0;
1660
+ }
1661
+ /** Grant consent tiers. `essential` is always forced true server-side. */
1662
+ async setConsent(levels) {
1663
+ await this.#api.visitors.setConsent({
1664
+ domain: this.domain,
1665
+ consent: levels
1666
+ });
1667
+ }
1668
+ /** Read the current visitor's tracking + consent + email status. */
1669
+ getStatus() {
1670
+ return this.#api.visitors.getVisitorStatus();
1671
+ }
1672
+ /** Capture a lead email (sends a magic link when verification is required). */
1673
+ submitGate(email, options = {}) {
1674
+ return this.#api.visitors.submitGate({
1675
+ email,
1676
+ domain: this.domain,
1677
+ guideId: this.guide.id,
1678
+ ...options
1679
+ });
1680
+ }
1681
+ /**
1682
+ * Fire an analytics event. Fire-and-forget — never throws into the host page.
1683
+ * Uses a raw request (the same shape the embed script posts) so it stays
1684
+ * decoupled from the typed client's event enum.
1685
+ */
1686
+ track(eventType, properties) {
1687
+ this.fetchImpl(`${this.apiBaseUrl}/events/track`, {
1688
+ method: "POST",
1689
+ headers: { "Content-Type": "application/json" },
1690
+ credentials: "include",
1691
+ body: JSON.stringify({ json: {
1692
+ domain: this.domain,
1693
+ guideId: this.guide.id,
1694
+ eventType,
1695
+ properties: properties ?? {}
1696
+ } })
1697
+ }).catch(() => {});
1698
+ }
1699
+ /** Fire the initial `embed_loaded` (with attribution) + first page view. */
1700
+ trackLoad() {
1701
+ const search = typeof window !== "undefined" ? window.location.search : "";
1702
+ const parentUrl = typeof window !== "undefined" ? window.location.href : void 0;
1703
+ const referrer = typeof document !== "undefined" ? document.referrer : void 0;
1704
+ this.track(EmbedTrackingEvent.EmbedLoaded, {
1705
+ referrer,
1706
+ parentUrl,
1707
+ utmParams: extractUTMParams(search),
1708
+ integrationCookies: extractIntegrationCookies(safeCookieString())
1709
+ });
1710
+ this.trackPageView();
1711
+ }
1712
+ /** Record a page view (call on client-side route changes in an SPA). */
1713
+ trackPageView(url) {
1714
+ const pageUrl = url ?? (typeof window !== "undefined" ? window.location.href : void 0);
1715
+ this.track(EmbedTrackingEvent.EmbedPageView, { pageUrl });
1716
+ }
1717
+ /** End the current visit (best to call on `pagehide`). */
1718
+ async endSession() {
1719
+ await this.#api.sessions.endSession();
1720
+ }
1721
+ async applyInitialConsent(consent, gdprEnabled) {
1722
+ if (consent === false) return;
1723
+ try {
1724
+ if (consent === "auto") {
1725
+ if (!gdprEnabled) await this.setConsent({
1726
+ functional: true,
1727
+ analytical: true
1728
+ });
1729
+ return;
1730
+ }
1731
+ await this.setConsent(consent);
1732
+ } catch {}
1733
+ }
1734
+ };
1735
+ /** Bootstrap a guide session and return a ready-to-use {@link GuideClient}. */
1736
+ async function initGuide(config) {
1737
+ return GuideClient.init(config);
1738
+ }
1739
+ //#endregion
1740
+ exports.ConsentTier = ConsentTier;
1741
+ exports.EmbedTrackingEvent = EmbedTrackingEvent;
1742
+ exports.GuideClient = GuideClient;
1743
+ exports.GuideEvent = GuideEvent;
1744
+ exports.SSEMessageType = SSEMessageType;
1745
+ exports.SkillResponseType = SkillResponseType;
1746
+ exports.initGuide = initGuide;
1747
+
1748
+ //# sourceMappingURL=index.cjs.map