( value: unknown, )
| 602 | }; |
| 603 | |
| 604 | const normalizeWebcamSettings = ( |
| 605 | value: unknown, |
| 606 | ): ExtensionSettings["webcam"] => { |
| 607 | const webcam = |
| 608 | value && typeof value === "object" |
| 609 | ? (value as Partial<ExtensionSettings["webcam"]>) |
| 610 | : {}; |
| 611 | const size = |
| 612 | typeof webcam.size === "number" && Number.isFinite(webcam.size) |
| 613 | ? webcam.size |
| 614 | : defaultSettings.webcam.size; |
| 615 | const position = |
| 616 | webcam.position === "top-left" || |
| 617 | webcam.position === "top-right" || |
| 618 | webcam.position === "bottom-left" || |
| 619 | webcam.position === "bottom-right" |
| 620 | ? webcam.position |
| 621 | : defaultSettings.webcam.position; |
| 622 | const deviceId = |
| 623 | typeof webcam.deviceId === "string" && webcam.deviceId.trim().length > 0 |
| 624 | ? webcam.deviceId |
| 625 | : null; |
| 626 | |
| 627 | return { |
| 628 | enabled: |
| 629 | typeof webcam.enabled === "boolean" |
| 630 | ? webcam.enabled |
| 631 | : defaultSettings.webcam.enabled, |
| 632 | deviceId, |
| 633 | position, |
| 634 | size: Math.max(120, Math.min(420, size)), |
| 635 | shape: normalizeWebcamShape(webcam.shape), |
| 636 | mirror: typeof webcam.mirror === "boolean" ? webcam.mirror : false, |
| 637 | }; |
| 638 | }; |
| 639 | |
| 640 | const normalizeMicrophoneSettings = ( |
| 641 | value: unknown, |
no test coverage detected