@coxwave/tap-kit-types 2.0.0 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,5 +1,3 @@
1
- import * as v from 'valibot';
2
-
3
1
  var __defProp = Object.defineProperty;
4
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -161,178 +159,745 @@ var MaterialViewerError = class _MaterialViewerError extends TapKitError {
161
159
 
162
160
  // src/protocol/alarm.ts
163
161
  var ALARM_DURATION = 18e3;
164
- var CSSStyleSchema = v.record(
165
- v.string(),
166
- v.union([v.string(), v.number()])
162
+
163
+ // ../../node_modules/.pnpm/valibot@1.1.0_typescript@5.9.2/node_modules/valibot/dist/index.js
164
+ var store;
165
+ // @__NO_SIDE_EFFECTS__
166
+ function getGlobalConfig(config2) {
167
+ return {
168
+ lang: config2?.lang ?? store?.lang,
169
+ message: config2?.message,
170
+ abortEarly: config2?.abortEarly ?? store?.abortEarly,
171
+ abortPipeEarly: config2?.abortPipeEarly ?? store?.abortPipeEarly
172
+ };
173
+ }
174
+ var store2;
175
+ // @__NO_SIDE_EFFECTS__
176
+ function getGlobalMessage(lang) {
177
+ return store2?.get(lang);
178
+ }
179
+ var store3;
180
+ // @__NO_SIDE_EFFECTS__
181
+ function getSchemaMessage(lang) {
182
+ return store3?.get(lang);
183
+ }
184
+ var store4;
185
+ // @__NO_SIDE_EFFECTS__
186
+ function getSpecificMessage(reference, lang) {
187
+ return store4?.get(reference)?.get(lang);
188
+ }
189
+ // @__NO_SIDE_EFFECTS__
190
+ function _stringify(input) {
191
+ const type = typeof input;
192
+ if (type === "string") {
193
+ return `"${input}"`;
194
+ }
195
+ if (type === "number" || type === "bigint" || type === "boolean") {
196
+ return `${input}`;
197
+ }
198
+ if (type === "object" || type === "function") {
199
+ return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
200
+ }
201
+ return type;
202
+ }
203
+ function _addIssue(context, label, dataset, config2, other) {
204
+ const input = other && "input" in other ? other.input : dataset.value;
205
+ const expected = other?.expected ?? context.expects ?? null;
206
+ const received = other?.received ?? /* @__PURE__ */ _stringify(input);
207
+ const issue = {
208
+ kind: context.kind,
209
+ type: context.type,
210
+ input,
211
+ expected,
212
+ received,
213
+ message: `Invalid ${label}: ${expected ? `Expected ${expected} but r` : "R"}eceived ${received}`,
214
+ requirement: context.requirement,
215
+ path: other?.path,
216
+ issues: other?.issues,
217
+ lang: config2.lang,
218
+ abortEarly: config2.abortEarly,
219
+ abortPipeEarly: config2.abortPipeEarly
220
+ };
221
+ const isSchema = context.kind === "schema";
222
+ const message2 = other?.message ?? context.message ?? /* @__PURE__ */ getSpecificMessage(context.reference, issue.lang) ?? (isSchema ? /* @__PURE__ */ getSchemaMessage(issue.lang) : null) ?? config2.message ?? /* @__PURE__ */ getGlobalMessage(issue.lang);
223
+ if (message2 !== void 0) {
224
+ issue.message = typeof message2 === "function" ? (
225
+ // @ts-expect-error
226
+ message2(issue)
227
+ ) : message2;
228
+ }
229
+ if (isSchema) {
230
+ dataset.typed = false;
231
+ }
232
+ if (dataset.issues) {
233
+ dataset.issues.push(issue);
234
+ } else {
235
+ dataset.issues = [issue];
236
+ }
237
+ }
238
+ // @__NO_SIDE_EFFECTS__
239
+ function _getStandardProps(context) {
240
+ return {
241
+ version: 1,
242
+ vendor: "valibot",
243
+ validate(value2) {
244
+ return context["~run"]({ value: value2 }, /* @__PURE__ */ getGlobalConfig());
245
+ }
246
+ };
247
+ }
248
+ // @__NO_SIDE_EFFECTS__
249
+ function _isValidObjectKey(object2, key) {
250
+ return Object.hasOwn(object2, key) && key !== "__proto__" && key !== "prototype" && key !== "constructor";
251
+ }
252
+ // @__NO_SIDE_EFFECTS__
253
+ function _joinExpects(values2, separator) {
254
+ const list = [...new Set(values2)];
255
+ if (list.length > 1) {
256
+ return `(${list.join(` ${separator} `)})`;
257
+ }
258
+ return list[0] ?? "never";
259
+ }
260
+ // @__NO_SIDE_EFFECTS__
261
+ function getFallback(schema, dataset, config2) {
262
+ return typeof schema.fallback === "function" ? (
263
+ // @ts-expect-error
264
+ schema.fallback(dataset, config2)
265
+ ) : (
266
+ // @ts-expect-error
267
+ schema.fallback
268
+ );
269
+ }
270
+ // @__NO_SIDE_EFFECTS__
271
+ function getDefault(schema, dataset, config2) {
272
+ return typeof schema.default === "function" ? (
273
+ // @ts-expect-error
274
+ schema.default(dataset, config2)
275
+ ) : (
276
+ // @ts-expect-error
277
+ schema.default
278
+ );
279
+ }
280
+ // @__NO_SIDE_EFFECTS__
281
+ function any() {
282
+ return {
283
+ kind: "schema",
284
+ type: "any",
285
+ reference: any,
286
+ expects: "any",
287
+ async: false,
288
+ get "~standard"() {
289
+ return /* @__PURE__ */ _getStandardProps(this);
290
+ },
291
+ "~run"(dataset) {
292
+ dataset.typed = true;
293
+ return dataset;
294
+ }
295
+ };
296
+ }
297
+ // @__NO_SIDE_EFFECTS__
298
+ function array(item, message2) {
299
+ return {
300
+ kind: "schema",
301
+ type: "array",
302
+ reference: array,
303
+ expects: "Array",
304
+ async: false,
305
+ item,
306
+ message: message2,
307
+ get "~standard"() {
308
+ return /* @__PURE__ */ _getStandardProps(this);
309
+ },
310
+ "~run"(dataset, config2) {
311
+ const input = dataset.value;
312
+ if (Array.isArray(input)) {
313
+ dataset.typed = true;
314
+ dataset.value = [];
315
+ for (let key = 0; key < input.length; key++) {
316
+ const value2 = input[key];
317
+ const itemDataset = this.item["~run"]({ value: value2 }, config2);
318
+ if (itemDataset.issues) {
319
+ const pathItem = {
320
+ type: "array",
321
+ origin: "value",
322
+ input,
323
+ key,
324
+ value: value2
325
+ };
326
+ for (const issue of itemDataset.issues) {
327
+ if (issue.path) {
328
+ issue.path.unshift(pathItem);
329
+ } else {
330
+ issue.path = [pathItem];
331
+ }
332
+ dataset.issues?.push(issue);
333
+ }
334
+ if (!dataset.issues) {
335
+ dataset.issues = itemDataset.issues;
336
+ }
337
+ if (config2.abortEarly) {
338
+ dataset.typed = false;
339
+ break;
340
+ }
341
+ }
342
+ if (!itemDataset.typed) {
343
+ dataset.typed = false;
344
+ }
345
+ dataset.value.push(itemDataset.value);
346
+ }
347
+ } else {
348
+ _addIssue(this, "type", dataset, config2);
349
+ }
350
+ return dataset;
351
+ }
352
+ };
353
+ }
354
+ // @__NO_SIDE_EFFECTS__
355
+ function boolean(message2) {
356
+ return {
357
+ kind: "schema",
358
+ type: "boolean",
359
+ reference: boolean,
360
+ expects: "boolean",
361
+ async: false,
362
+ message: message2,
363
+ get "~standard"() {
364
+ return /* @__PURE__ */ _getStandardProps(this);
365
+ },
366
+ "~run"(dataset, config2) {
367
+ if (typeof dataset.value === "boolean") {
368
+ dataset.typed = true;
369
+ } else {
370
+ _addIssue(this, "type", dataset, config2);
371
+ }
372
+ return dataset;
373
+ }
374
+ };
375
+ }
376
+ // @__NO_SIDE_EFFECTS__
377
+ function lazy(getter) {
378
+ return {
379
+ kind: "schema",
380
+ type: "lazy",
381
+ reference: lazy,
382
+ expects: "unknown",
383
+ async: false,
384
+ getter,
385
+ get "~standard"() {
386
+ return /* @__PURE__ */ _getStandardProps(this);
387
+ },
388
+ "~run"(dataset, config2) {
389
+ return this.getter(dataset.value)["~run"](dataset, config2);
390
+ }
391
+ };
392
+ }
393
+ // @__NO_SIDE_EFFECTS__
394
+ function literal(literal_, message2) {
395
+ return {
396
+ kind: "schema",
397
+ type: "literal",
398
+ reference: literal,
399
+ expects: /* @__PURE__ */ _stringify(literal_),
400
+ async: false,
401
+ literal: literal_,
402
+ message: message2,
403
+ get "~standard"() {
404
+ return /* @__PURE__ */ _getStandardProps(this);
405
+ },
406
+ "~run"(dataset, config2) {
407
+ if (dataset.value === this.literal) {
408
+ dataset.typed = true;
409
+ } else {
410
+ _addIssue(this, "type", dataset, config2);
411
+ }
412
+ return dataset;
413
+ }
414
+ };
415
+ }
416
+ // @__NO_SIDE_EFFECTS__
417
+ function number(message2) {
418
+ return {
419
+ kind: "schema",
420
+ type: "number",
421
+ reference: number,
422
+ expects: "number",
423
+ async: false,
424
+ message: message2,
425
+ get "~standard"() {
426
+ return /* @__PURE__ */ _getStandardProps(this);
427
+ },
428
+ "~run"(dataset, config2) {
429
+ if (typeof dataset.value === "number" && !isNaN(dataset.value)) {
430
+ dataset.typed = true;
431
+ } else {
432
+ _addIssue(this, "type", dataset, config2);
433
+ }
434
+ return dataset;
435
+ }
436
+ };
437
+ }
438
+ // @__NO_SIDE_EFFECTS__
439
+ function object(entries2, message2) {
440
+ return {
441
+ kind: "schema",
442
+ type: "object",
443
+ reference: object,
444
+ expects: "Object",
445
+ async: false,
446
+ entries: entries2,
447
+ message: message2,
448
+ get "~standard"() {
449
+ return /* @__PURE__ */ _getStandardProps(this);
450
+ },
451
+ "~run"(dataset, config2) {
452
+ const input = dataset.value;
453
+ if (input && typeof input === "object") {
454
+ dataset.typed = true;
455
+ dataset.value = {};
456
+ for (const key in this.entries) {
457
+ const valueSchema = this.entries[key];
458
+ if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && // @ts-expect-error
459
+ valueSchema.default !== void 0) {
460
+ const value2 = key in input ? (
461
+ // @ts-expect-error
462
+ input[key]
463
+ ) : /* @__PURE__ */ getDefault(valueSchema);
464
+ const valueDataset = valueSchema["~run"]({ value: value2 }, config2);
465
+ if (valueDataset.issues) {
466
+ const pathItem = {
467
+ type: "object",
468
+ origin: "value",
469
+ input,
470
+ key,
471
+ value: value2
472
+ };
473
+ for (const issue of valueDataset.issues) {
474
+ if (issue.path) {
475
+ issue.path.unshift(pathItem);
476
+ } else {
477
+ issue.path = [pathItem];
478
+ }
479
+ dataset.issues?.push(issue);
480
+ }
481
+ if (!dataset.issues) {
482
+ dataset.issues = valueDataset.issues;
483
+ }
484
+ if (config2.abortEarly) {
485
+ dataset.typed = false;
486
+ break;
487
+ }
488
+ }
489
+ if (!valueDataset.typed) {
490
+ dataset.typed = false;
491
+ }
492
+ dataset.value[key] = valueDataset.value;
493
+ } else if (valueSchema.fallback !== void 0) {
494
+ dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
495
+ } else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
496
+ _addIssue(this, "key", dataset, config2, {
497
+ input: void 0,
498
+ expected: `"${key}"`,
499
+ path: [
500
+ {
501
+ type: "object",
502
+ origin: "key",
503
+ input,
504
+ key,
505
+ // @ts-expect-error
506
+ value: input[key]
507
+ }
508
+ ]
509
+ });
510
+ if (config2.abortEarly) {
511
+ break;
512
+ }
513
+ }
514
+ }
515
+ } else {
516
+ _addIssue(this, "type", dataset, config2);
517
+ }
518
+ return dataset;
519
+ }
520
+ };
521
+ }
522
+ // @__NO_SIDE_EFFECTS__
523
+ function optional(wrapped, default_) {
524
+ return {
525
+ kind: "schema",
526
+ type: "optional",
527
+ reference: optional,
528
+ expects: `(${wrapped.expects} | undefined)`,
529
+ async: false,
530
+ wrapped,
531
+ default: default_,
532
+ get "~standard"() {
533
+ return /* @__PURE__ */ _getStandardProps(this);
534
+ },
535
+ "~run"(dataset, config2) {
536
+ if (dataset.value === void 0) {
537
+ if (this.default !== void 0) {
538
+ dataset.value = /* @__PURE__ */ getDefault(this, dataset, config2);
539
+ }
540
+ if (dataset.value === void 0) {
541
+ dataset.typed = true;
542
+ return dataset;
543
+ }
544
+ }
545
+ return this.wrapped["~run"](dataset, config2);
546
+ }
547
+ };
548
+ }
549
+ // @__NO_SIDE_EFFECTS__
550
+ function record(key, value2, message2) {
551
+ return {
552
+ kind: "schema",
553
+ type: "record",
554
+ reference: record,
555
+ expects: "Object",
556
+ async: false,
557
+ key,
558
+ value: value2,
559
+ message: message2,
560
+ get "~standard"() {
561
+ return /* @__PURE__ */ _getStandardProps(this);
562
+ },
563
+ "~run"(dataset, config2) {
564
+ const input = dataset.value;
565
+ if (input && typeof input === "object") {
566
+ dataset.typed = true;
567
+ dataset.value = {};
568
+ for (const entryKey in input) {
569
+ if (/* @__PURE__ */ _isValidObjectKey(input, entryKey)) {
570
+ const entryValue = input[entryKey];
571
+ const keyDataset = this.key["~run"]({ value: entryKey }, config2);
572
+ if (keyDataset.issues) {
573
+ const pathItem = {
574
+ type: "object",
575
+ origin: "key",
576
+ input,
577
+ key: entryKey,
578
+ value: entryValue
579
+ };
580
+ for (const issue of keyDataset.issues) {
581
+ issue.path = [pathItem];
582
+ dataset.issues?.push(issue);
583
+ }
584
+ if (!dataset.issues) {
585
+ dataset.issues = keyDataset.issues;
586
+ }
587
+ if (config2.abortEarly) {
588
+ dataset.typed = false;
589
+ break;
590
+ }
591
+ }
592
+ const valueDataset = this.value["~run"](
593
+ { value: entryValue },
594
+ config2
595
+ );
596
+ if (valueDataset.issues) {
597
+ const pathItem = {
598
+ type: "object",
599
+ origin: "value",
600
+ input,
601
+ key: entryKey,
602
+ value: entryValue
603
+ };
604
+ for (const issue of valueDataset.issues) {
605
+ if (issue.path) {
606
+ issue.path.unshift(pathItem);
607
+ } else {
608
+ issue.path = [pathItem];
609
+ }
610
+ dataset.issues?.push(issue);
611
+ }
612
+ if (!dataset.issues) {
613
+ dataset.issues = valueDataset.issues;
614
+ }
615
+ if (config2.abortEarly) {
616
+ dataset.typed = false;
617
+ break;
618
+ }
619
+ }
620
+ if (!keyDataset.typed || !valueDataset.typed) {
621
+ dataset.typed = false;
622
+ }
623
+ if (keyDataset.typed) {
624
+ dataset.value[keyDataset.value] = valueDataset.value;
625
+ }
626
+ }
627
+ }
628
+ } else {
629
+ _addIssue(this, "type", dataset, config2);
630
+ }
631
+ return dataset;
632
+ }
633
+ };
634
+ }
635
+ // @__NO_SIDE_EFFECTS__
636
+ function string(message2) {
637
+ return {
638
+ kind: "schema",
639
+ type: "string",
640
+ reference: string,
641
+ expects: "string",
642
+ async: false,
643
+ message: message2,
644
+ get "~standard"() {
645
+ return /* @__PURE__ */ _getStandardProps(this);
646
+ },
647
+ "~run"(dataset, config2) {
648
+ if (typeof dataset.value === "string") {
649
+ dataset.typed = true;
650
+ } else {
651
+ _addIssue(this, "type", dataset, config2);
652
+ }
653
+ return dataset;
654
+ }
655
+ };
656
+ }
657
+ // @__NO_SIDE_EFFECTS__
658
+ function _subIssues(datasets) {
659
+ let issues;
660
+ if (datasets) {
661
+ for (const dataset of datasets) {
662
+ if (issues) {
663
+ issues.push(...dataset.issues);
664
+ } else {
665
+ issues = dataset.issues;
666
+ }
667
+ }
668
+ }
669
+ return issues;
670
+ }
671
+ // @__NO_SIDE_EFFECTS__
672
+ function union(options, message2) {
673
+ return {
674
+ kind: "schema",
675
+ type: "union",
676
+ reference: union,
677
+ expects: /* @__PURE__ */ _joinExpects(
678
+ options.map((option) => option.expects),
679
+ "|"
680
+ ),
681
+ async: false,
682
+ options,
683
+ message: message2,
684
+ get "~standard"() {
685
+ return /* @__PURE__ */ _getStandardProps(this);
686
+ },
687
+ "~run"(dataset, config2) {
688
+ let validDataset;
689
+ let typedDatasets;
690
+ let untypedDatasets;
691
+ for (const schema of this.options) {
692
+ const optionDataset = schema["~run"]({ value: dataset.value }, config2);
693
+ if (optionDataset.typed) {
694
+ if (optionDataset.issues) {
695
+ if (typedDatasets) {
696
+ typedDatasets.push(optionDataset);
697
+ } else {
698
+ typedDatasets = [optionDataset];
699
+ }
700
+ } else {
701
+ validDataset = optionDataset;
702
+ break;
703
+ }
704
+ } else {
705
+ if (untypedDatasets) {
706
+ untypedDatasets.push(optionDataset);
707
+ } else {
708
+ untypedDatasets = [optionDataset];
709
+ }
710
+ }
711
+ }
712
+ if (validDataset) {
713
+ return validDataset;
714
+ }
715
+ if (typedDatasets) {
716
+ if (typedDatasets.length === 1) {
717
+ return typedDatasets[0];
718
+ }
719
+ _addIssue(this, "type", dataset, config2, {
720
+ issues: /* @__PURE__ */ _subIssues(typedDatasets)
721
+ });
722
+ dataset.typed = true;
723
+ } else if (untypedDatasets?.length === 1) {
724
+ return untypedDatasets[0];
725
+ } else {
726
+ _addIssue(this, "type", dataset, config2, {
727
+ issues: /* @__PURE__ */ _subIssues(untypedDatasets)
728
+ });
729
+ }
730
+ return dataset;
731
+ }
732
+ };
733
+ }
734
+
735
+ // src/protocol/schema.ts
736
+ var CSSStyleSchema = record(
737
+ string(),
738
+ union([string(), number()])
167
739
  );
168
- var AlarmElementPropsSchema = v.object({
169
- style: v.optional(CSSStyleSchema),
170
- className: v.optional(v.string()),
171
- id: v.optional(v.string()),
172
- src: v.optional(v.string()),
173
- alt: v.optional(v.string()),
174
- href: v.optional(v.string()),
175
- target: v.optional(v.string()),
176
- type: v.optional(v.string()),
177
- placeholder: v.optional(v.string()),
178
- value: v.optional(v.string()),
179
- disabled: v.optional(v.boolean())
740
+ var AlarmElementPropsSchema = object({
741
+ style: optional(CSSStyleSchema),
742
+ className: optional(string()),
743
+ id: optional(string()),
744
+ src: optional(string()),
745
+ alt: optional(string()),
746
+ href: optional(string()),
747
+ target: optional(string()),
748
+ type: optional(string()),
749
+ placeholder: optional(string()),
750
+ value: optional(string()),
751
+ disabled: optional(boolean())
180
752
  });
181
- var AlarmElementSchema = v.lazy(
182
- () => v.object({
183
- tag: v.string(),
184
- props: v.optional(AlarmElementPropsSchema),
185
- children: v.optional(v.array(v.union([AlarmElementSchema, v.string()]))),
186
- payload: v.optional(
187
- v.object({
188
- message: v.string(),
189
- pingMessageId: v.optional(v.string())
753
+ var AlarmElementSchema = lazy(
754
+ () => object({
755
+ tag: string(),
756
+ props: optional(AlarmElementPropsSchema),
757
+ children: optional(array(union([AlarmElementSchema, string()]))),
758
+ payload: optional(
759
+ object({
760
+ message: string(),
761
+ pingMessageId: optional(string())
190
762
  })
191
763
  )
192
764
  })
193
765
  );
194
- var AlarmMessageInstanceSchema = v.object({
766
+ var AlarmMessageInstanceSchema = object({
195
767
  content: AlarmElementSchema,
196
- duration: v.optional(v.number())
768
+ duration: optional(number())
197
769
  });
198
- var TapReadySchema = v.object({
199
- type: v.literal("tap:ready"),
200
- gaId: v.string()
770
+ var TapReadySchema = object({
771
+ type: literal("tap:ready"),
772
+ gaId: string()
201
773
  });
202
- var TapCloseSchema = v.object({
203
- type: v.literal("tap:close")
774
+ var TapCloseSchema = object({
775
+ type: literal("tap:close")
204
776
  });
205
- var TimelineSeekSchema = v.object({
206
- type: v.literal("timeline:seek"),
207
- clipId: v.string(),
208
- clipPlayHead: v.number()
777
+ var TimelineSeekSchema = object({
778
+ type: literal("timeline:seek"),
779
+ clipId: string(),
780
+ clipPlayHead: number()
209
781
  });
210
- var AlarmClickSchema = v.object({
211
- type: v.literal("alarm:click"),
782
+ var AlarmClickSchema = object({
783
+ type: literal("alarm:click"),
212
784
  messageInfo: AlarmMessageInstanceSchema
213
785
  });
214
- var AlarmFadeInSchema = v.object({
215
- type: v.literal("alarm:fadeIn"),
786
+ var AlarmFadeInSchema = object({
787
+ type: literal("alarm:fadeIn"),
216
788
  messageInfo: AlarmMessageInstanceSchema
217
789
  });
218
- var PopUpOpenSchema = v.object({
219
- type: v.literal("popUp:open"),
220
- popUpInfo: v.object({
221
- html: v.string(),
222
- requestId: v.optional(v.string())
790
+ var PopUpOpenSchema = object({
791
+ type: literal("popUp:open"),
792
+ popUpInfo: object({
793
+ html: string(),
794
+ requestId: optional(string())
223
795
  })
224
796
  });
225
- var PopUpCloseSchema = v.object({
226
- type: v.literal("popUp:close")
797
+ var PopUpCloseSchema = object({
798
+ type: literal("popUp:close")
227
799
  });
228
- var MaterialViewOpenSchema = v.object({
229
- type: v.literal("material:view:open"),
230
- materialId: v.string(),
231
- presignedUrl: v.string(),
232
- pageStart: v.number(),
233
- pageEnd: v.number(),
234
- nonce: v.optional(v.union([v.string(), v.number()]))
800
+ var MaterialViewOpenSchema = object({
801
+ type: literal("material:view:open"),
802
+ materialId: string(),
803
+ presignedUrl: string(),
804
+ pageStart: number(),
805
+ pageEnd: number(),
806
+ nonce: optional(union([string(), number()]))
235
807
  });
236
- var MaterialViewCloseSchema = v.object({
237
- type: v.literal("material:view:close")
808
+ var MaterialViewCloseSchema = object({
809
+ type: literal("material:view:close")
238
810
  });
239
- var MaterialViewErrorSchema = v.object({
240
- type: v.literal("material:view:error"),
241
- materialId: v.string(),
242
- error: v.union([
243
- v.literal("fetch_failed"),
244
- v.literal("expired_url"),
245
- v.literal("extraction_failed"),
246
- v.literal("unknown")
811
+ var MaterialViewErrorSchema = object({
812
+ type: literal("material:view:error"),
813
+ materialId: string(),
814
+ error: union([
815
+ literal("fetch_failed"),
816
+ literal("expired_url"),
817
+ literal("extraction_failed"),
818
+ literal("unknown")
247
819
  ]),
248
- message: v.optional(v.string())
820
+ message: optional(string())
249
821
  });
250
- var ContainerModeChangeSchema = v.object({
251
- type: v.literal("container:mode:change"),
252
- mode: v.union([v.literal("floating"), v.literal("sidebar")]),
253
- nonce: v.optional(v.union([v.string(), v.number()]))
822
+ var ContainerModeChangeSchema = object({
823
+ type: literal("container:mode:change"),
824
+ mode: union([literal("floating"), literal("sidebar")]),
825
+ nonce: optional(union([string(), number()]))
254
826
  });
255
- var ContainerModeChangeAckSchema = v.object({
256
- type: v.literal("container:mode:change:ack"),
257
- success: v.boolean(),
258
- currentMode: v.union([
259
- v.literal("floating"),
260
- v.literal("sidebar"),
261
- v.literal("floating-forced")
827
+ var ContainerModeChangeAckSchema = object({
828
+ type: literal("container:mode:change:ack"),
829
+ success: boolean(),
830
+ currentMode: union([
831
+ literal("floating"),
832
+ literal("sidebar"),
833
+ literal("floating-forced")
262
834
  ]),
263
- nonce: v.optional(v.union([v.string(), v.number()]))
835
+ nonce: optional(union([string(), number()]))
264
836
  });
265
- var ContainerLayoutStateChangedSchema = v.object({
266
- type: v.literal("container:layout:state:changed"),
267
- layoutState: v.union([
268
- v.literal("floating"),
269
- v.literal("sidebar"),
270
- v.literal("floating-forced")
271
- ])
837
+ var ContainerLayoutStateChangedSchema = object({
838
+ type: literal("container:layout:state:changed"),
839
+ layoutState: union([literal("floating"), literal("sidebar")]),
840
+ isNarrowViewport: optional(boolean())
272
841
  });
273
- var ViewportResizeSchema = v.object({
274
- type: v.literal("viewport:resize"),
275
- viewportWidth: v.number()
842
+ var ViewportResizeSchema = object({
843
+ type: literal("viewport:resize"),
844
+ viewportWidth: number()
276
845
  });
277
- var ConfigUpdateSchema = v.object({
278
- type: v.literal("config:update"),
279
- apiKey: v.optional(v.string()),
280
- hostOrigin: v.optional(v.string()),
281
- tapUrl: v.optional(v.string()),
282
- apiUrl: v.optional(v.string()),
283
- environment: v.optional(
284
- v.union([
285
- v.literal("dev"),
286
- v.literal("prod"),
287
- v.literal("demo"),
288
- v.literal("staging")
846
+ var ConfigUpdateSchema = object({
847
+ type: literal("config:update"),
848
+ apiKey: optional(string()),
849
+ hostOrigin: optional(string()),
850
+ tapUrl: optional(string()),
851
+ apiUrl: optional(string()),
852
+ environment: optional(
853
+ union([
854
+ literal("dev"),
855
+ literal("prod"),
856
+ literal("demo"),
857
+ literal("staging")
289
858
  ])
290
859
  ),
291
- language: v.optional(v.string()),
292
- userId: v.optional(v.string()),
293
- courseId: v.optional(v.string()),
294
- clipId: v.optional(v.string()),
295
- clipPlayHead: v.optional(v.number()),
296
- inline: v.optional(v.boolean()),
297
- container: v.optional(
298
- v.object({
299
- mode: v.optional(
300
- v.union([
301
- v.literal("auto"),
302
- v.literal("floating"),
303
- v.literal("sidebar")
304
- ])
305
- ),
306
- floatingConfig: v.optional(
307
- v.object({
308
- position: v.optional(
309
- v.object({
310
- top: v.optional(v.string()),
311
- left: v.optional(v.string()),
312
- right: v.optional(v.string()),
313
- bottom: v.optional(v.string())
860
+ language: optional(string()),
861
+ userId: optional(string()),
862
+ courseId: optional(string()),
863
+ clipId: optional(string()),
864
+ clipPlayHead: optional(number()),
865
+ mode: optional(
866
+ union([literal("inline"), literal("floating"), literal("sidebar")])
867
+ ),
868
+ allowLayoutToggle: optional(boolean()),
869
+ container: optional(
870
+ object({
871
+ floatingConfig: optional(
872
+ object({
873
+ position: optional(
874
+ object({
875
+ top: optional(string()),
876
+ left: optional(string()),
877
+ right: optional(string()),
878
+ bottom: optional(string())
314
879
  })
315
880
  ),
316
- width: v.optional(v.string()),
317
- height: v.optional(v.string()),
318
- borderRadius: v.optional(v.string())
881
+ width: optional(string()),
882
+ height: optional(string()),
883
+ borderRadius: optional(string())
319
884
  })
320
885
  ),
321
- sidebarConfig: v.optional(
322
- v.object({
323
- maxWidth: v.optional(v.string()),
324
- minViewportWidth: v.optional(v.number())
886
+ sidebarConfig: optional(
887
+ object({
888
+ maxWidth: optional(string()),
889
+ minViewportWidth: optional(number())
325
890
  })
326
891
  )
327
892
  })
328
893
  )
329
894
  });
330
- var GAEventSchema = v.object({
331
- type: v.literal("GA_EVENT"),
332
- payload: v.record(v.string(), v.any())
895
+ var GAEventSchema = object({
896
+ type: literal("GA_EVENT"),
897
+ payload: record(string(), any())
333
898
  // 유연한 payload 구조
334
899
  });
335
- var TapMessageSchema = v.union([
900
+ var TapMessageSchema = union([
336
901
  TapReadySchema,
337
902
  TapCloseSchema,
338
903
  TimelineSeekSchema,