@microblink/camera-manager 7.0.0-next.9 → 7.0.0
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/camera-manager.js +1645 -1024
- package/package.json +5 -5
- package/types/core/Camera.d.ts +40 -2
- package/types/core/Camera.d.ts.map +1 -1
- package/types/core/CameraManager.d.ts +42 -39
- package/types/core/CameraManager.d.ts.map +1 -1
- package/types/core/VideoFrameProcessor.d.ts +61 -0
- package/types/core/VideoFrameProcessor.d.ts.map +1 -0
- package/types/core/cameraManagerStore.d.ts +2 -1
- package/types/core/cameraManagerStore.d.ts.map +1 -1
- package/types/core/cameraNames.d.ts.map +1 -1
- package/types/core/cameraUtils.d.ts +14 -7
- package/types/core/cameraUtils.d.ts.map +1 -1
- package/types/core/utils.d.ts.map +1 -1
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
- package/types/index.rollup.d.ts +182 -42
- package/types/media-mock/MediaMocker.d.ts +4 -779
- package/types/media-mock/MediaMocker.d.ts.map +1 -1
- package/types/media-mock/createInputDeviceInfo.d.ts.map +1 -1
- package/types/media-mock/fake-devices.d.ts +1 -788
- package/types/media-mock/fake-devices.d.ts.map +1 -1
- package/types/media-mock/fakeDevices/SamsungS21FE.d.ts +6 -0
- package/types/media-mock/fakeDevices/SamsungS21FE.d.ts.map +1 -0
- package/types/media-mock/fakeDevices/iPhone15.d.ts +6 -0
- package/types/media-mock/fakeDevices/iPhone15.d.ts.map +1 -0
- package/types/media-mock/fakeDevices/iPhoneSE.d.ts +9 -0
- package/types/media-mock/fakeDevices/iPhoneSE.d.ts.map +1 -0
- package/types/media-mock/utils.d.ts +4 -0
- package/types/media-mock/utils.d.ts.map +1 -1
- package/types/ui/CameraErrorModal.d.ts +7 -0
- package/types/ui/CameraErrorModal.d.ts.map +1 -0
- package/types/ui/CameraSelector.d.ts.map +1 -1
- package/types/ui/CameraUiStoreContext.d.ts +15 -2
- package/types/ui/CameraUiStoreContext.d.ts.map +1 -1
- package/types/ui/CaptureScreen.d.ts +2 -0
- package/types/ui/CaptureScreen.d.ts.map +1 -1
- package/types/ui/Header.d.ts.map +1 -1
- package/types/ui/RootComponent.d.ts.map +1 -1
- package/types/ui/SolidShadowRoot.d.ts +1 -12
- package/types/ui/SolidShadowRoot.d.ts.map +1 -1
- package/types/ui/createCameraManagerUi.d.ts +16 -8
- package/types/ui/createCameraManagerUi.d.ts.map +1 -1
- package/types/ui/determineFitMode.d.ts +35 -0
- package/types/ui/determineFitMode.d.ts.map +1 -0
- package/types/ui/determineFitMode.test.d.ts +5 -0
- package/types/ui/determineFitMode.test.d.ts.map +1 -0
- package/types/ui/getVisibleVideoArea.d.ts +10 -0
- package/types/ui/getVisibleVideoArea.d.ts.map +1 -0
- package/types/ui/getVisibleVideoArea.test.d.ts +5 -0
- package/types/ui/getVisibleVideoArea.test.d.ts.map +1 -0
- package/types/ui/locales/en.d.ts +7 -1
- package/types/ui/locales/en.d.ts.map +1 -1
- package/types/ui/zustandRefStore.d.ts +2 -0
- package/types/ui/zustandRefStore.d.ts.map +1 -1
- package/types/core/createCustomImageData.d.ts +0 -14
- package/types/core/createCustomImageData.d.ts.map +0 -1
- package/types/core/imageDataUtils.d.ts +0 -6
- package/types/core/imageDataUtils.d.ts.map +0 -1
- package/types/core/videoToImageData.d.ts +0 -5
- package/types/core/videoToImageData.d.ts.map +0 -1
- package/types/ui/ErrorAlert.d.ts +0 -8
- package/types/ui/ErrorAlert.d.ts.map +0 -1
package/dist/camera-manager.js
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
(function(){"use strict";(a=>{window.__mbCameraManagerCssCode=a})("*,:before,:after{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / .5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }::backdrop{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / .5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.left-0{left:calc(var(--mb-size)*0rem)}.right-0{right:calc(var(--mb-size)*0rem)}.right-4{right:calc(var(--mb-size)*1rem)}.top-\\[-1px\\]{top:-1px}.top-0{top:calc(var(--mb-size)*0rem)}.has-\\[\\[data-scope\\]\\]\\:z-2:has([data-scope]),.z-2{z-index:2}.z-1{z-index:1}.z-20{z-index:20}.z-9999{z-index:9999}.grid{display:grid}.auto-cols-auto{grid-auto-columns:auto}.grid-cols-\\[1fr_auto_1fr\\]{grid-template-columns:1fr auto 1fr}.block{display:block}.size-12{width:calc(var(--mb-size)*3rem);height:calc(var(--mb-size)*3rem)}.size-6{width:calc(var(--mb-size)*1.5rem);height:calc(var(--mb-size)*1.5rem)}.size-full{width:100%;height:100%}.h-\\[1px\\]{height:1px}.h-full{height:100%}.h-vh{height:100vh}.max-w-\\[100\\%\\]{max-width:100%}.min-h-\\[300px\\]{min-height:300px}.min-w-0{min-width:calc(var(--mb-size)*0rem)}.w-full{width:100%}.flex{display:flex}.shrink-0{flex-shrink:0}.flex-nowrap{flex-wrap:nowrap}.data-\\[state\\=open\\]\\:scale-y-\\[-1\\][data-state=open]{--un-scale-y:-1;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.transform{transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.cursor-pointer{cursor:pointer}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.select-none{-webkit-user-select:none;user-select:none}.appearance-none{-webkit-appearance:none;appearance:none}.place-items-center{place-items:center}.place-self-center{place-self:center}.items-center{align-items:center}.justify-between{justify-content:space-between}.justify-self-start{justify-self:start}.justify-self-end{justify-self:end}.justify-self-center{justify-self:center}.gap-\\[1px\\]{gap:1px}.gap-2{gap:calc(var(--mb-size)*.5rem)}.gap-4{gap:calc(var(--mb-size)*1rem)}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.rounded-4{border-radius:calc(var(--mb-size)*1rem)}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.border-none{border-style:none}.bg-dark-100{--un-bg-opacity:1;background-color:rgb(60 60 60 / var(--un-bg-opacity))}.bg-dark-100\\/50{background-color:#3c3c3c80}.bg-dark-500{--un-bg-opacity:1;background-color:rgb(31 31 31 / var(--un-bg-opacity))}.bg-white{--un-bg-opacity:1;background-color:rgb(255 255 255 / var(--un-bg-opacity))}.data-\\[highlighted\\]\\:bg-gray-500\\/50[data-highlighted]{background-color:#6b728080}.bg-opacity-50{--un-bg-opacity:.5}.object-contain{object-fit:contain}.p-2{padding:calc(var(--mb-size)*.5rem)}.p-4{padding:calc(var(--mb-size)*1rem)}.px-4{padding-left:calc(var(--mb-size)*1rem);padding-right:calc(var(--mb-size)*1rem)}.py-2{padding-top:calc(var(--mb-size)*.5rem);padding-bottom:calc(var(--mb-size)*.5rem)}.py-3{padding-top:calc(var(--mb-size)*.75rem);padding-bottom:calc(var(--mb-size)*.75rem)}.py-4{padding-top:calc(var(--mb-size)*1rem);padding-bottom:calc(var(--mb-size)*1rem)}.pl-4{padding-left:calc(var(--mb-size)*1rem)}.pr-12{padding-right:calc(var(--mb-size)*3rem)}.text-align-center{text-align:center}.text-base{font-size:calc(var(--mb-size)*1rem);line-height:calc(var(--mb-size)*1.5rem)}.text-sm{font-size:calc(var(--mb-size)*.875rem);line-height:calc(var(--mb-size)*1.25rem)}.text-size-sm{font-size:calc(var(--mb-size)*.875rem)}.color-dark-9{--un-text-opacity:1;color:rgb(15 15 15 / var(--un-text-opacity))}.color-white{--un-text-opacity:1;color:rgb(255 255 255 / var(--un-text-opacity))}.font-500{font-weight:500}.disabled\\:opacity-50:disabled{opacity:.5}.shadow{--un-shadow:var(--un-shadow-inset) 0 1px 3px 0 var(--un-shadow-color, rgb(0 0 0 / .1)),var(--un-shadow-inset) 0 1px 2px -1px var(--un-shadow-color, rgb(0 0 0 / .1));box-shadow:var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}.shadow-lg{--un-shadow:var(--un-shadow-inset) 0 10px 15px -3px var(--un-shadow-color, rgb(0 0 0 / .1)),var(--un-shadow-inset) 0 4px 6px -4px var(--un-shadow-color, rgb(0 0 0 / .1));box-shadow:var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}.backdrop-blur{--un-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--un-backdrop-blur) var(--un-backdrop-brightness) var(--un-backdrop-contrast) var(--un-backdrop-grayscale) var(--un-backdrop-hue-rotate) var(--un-backdrop-invert) var(--un-backdrop-opacity) var(--un-backdrop-saturate) var(--un-backdrop-sepia);backdrop-filter:var(--un-backdrop-blur) var(--un-backdrop-brightness) var(--un-backdrop-contrast) var(--un-backdrop-grayscale) var(--un-backdrop-hue-rotate) var(--un-backdrop-invert) var(--un-backdrop-opacity) var(--un-backdrop-saturate) var(--un-backdrop-sepia)}.backdrop-blur-xl{--un-backdrop-blur:blur(24px);-webkit-backdrop-filter:var(--un-backdrop-blur) var(--un-backdrop-brightness) var(--un-backdrop-contrast) var(--un-backdrop-grayscale) var(--un-backdrop-hue-rotate) var(--un-backdrop-invert) var(--un-backdrop-opacity) var(--un-backdrop-saturate) var(--un-backdrop-sepia);backdrop-filter:var(--un-backdrop-blur) var(--un-backdrop-brightness) var(--un-backdrop-contrast) var(--un-backdrop-grayscale) var(--un-backdrop-hue-rotate) var(--un-backdrop-invert) var(--un-backdrop-opacity) var(--un-backdrop-saturate) var(--un-backdrop-sepia)}.drop-shadow-md{--un-drop-shadow:drop-shadow(0 4px 3px var(--un-drop-shadow-color, rgb(0 0 0 / .07))) drop-shadow(0 2px 2px var(--un-drop-shadow-color, rgb(0 0 0 / .06)));filter:var(--un-blur) var(--un-brightness) var(--un-contrast) var(--un-drop-shadow) var(--un-grayscale) var(--un-hue-rotate) var(--un-invert) var(--un-saturate) var(--un-sepia)}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.lerp\\:px-3\\@xs\\,8\\@lg{padding-inline:clamp(calc(var(--mb-size)*.75rem),calc(var(--mb-size)*.75rem) + (100vw - 380px) * .031055900621118012,calc(var(--mb-size)*2rem))}@supports (height:100dvh){.supports-\\[\\(height\\:100dvh\\)\\]\\:h-dvh{height:100dvh}}")})();
|
|
2
|
-
import { subscribeWithSelector as
|
|
3
|
-
import { createStore as
|
|
4
|
-
import { createComponent as s, use as
|
|
5
|
-
import { createContext as
|
|
6
|
-
import { createWithSignal as
|
|
7
|
-
import { createStore as
|
|
8
|
-
import { EnvironmentProvider as
|
|
1
|
+
(function(){"use strict";(r=>{window.__mbCameraManagerCssCode=r})("._dialogPositioner_worsp_1{position:fixed;top:calc(var(--mb-size)*0rem);left:calc(var(--mb-size)*0rem);display:grid;height:100vh;width:100%;padding:calc(var(--mb-size)*2rem)}@supports (height:100dvh){._dialogPositioner_worsp_1{height:100dvh}}._dialogBackdrop_worsp_5{position:absolute;top:calc(var(--mb-size)*0rem);left:calc(var(--mb-size)*0rem);width:100%;height:100%;--un-bg-opacity:1;background-color:rgb(var(--color-black-rgb-value) / var(--un-bg-opacity));--un-bg-opacity:.5;--un-backdrop-blur:blur(4px);-webkit-backdrop-filter:var(--un-backdrop-blur) var(--un-backdrop-brightness) var(--un-backdrop-contrast) var(--un-backdrop-grayscale) var(--un-backdrop-hue-rotate) var(--un-backdrop-invert) var(--un-backdrop-opacity) var(--un-backdrop-saturate) var(--un-backdrop-sepia);backdrop-filter:var(--un-backdrop-blur) var(--un-backdrop-brightness) var(--un-backdrop-contrast) var(--un-backdrop-grayscale) var(--un-backdrop-hue-rotate) var(--un-backdrop-invert) var(--un-backdrop-opacity) var(--un-backdrop-saturate) var(--un-backdrop-sepia)}._dialogContent_worsp_9{position:relative;max-height:calc(100dvh - 4rem);max-width:28rem;display:flex;flex-direction:column;place-self:center;border-radius:.5rem;--un-bg-opacity:1;background-color:rgb(var(--color-white-rgb-value) / var(--un-bg-opacity));padding-left:min(8%,3rem);padding-right:min(8%,3rem);padding-top:min(8%,1.5rem);padding-bottom:min(8%,1.5rem);--un-text-opacity:1;color:rgb(15 15 15 / var(--un-text-opacity));--un-shadow:var(--un-shadow-inset) 0 10px 15px -3px var(--un-shadow-color, rgb(0 0 0 / .1)),var(--un-shadow-inset) 0 4px 6px -4px var(--un-shadow-color, rgb(0 0 0 / .1));box-shadow:var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}._dialogContent_worsp_9._large_worsp_13{padding-left:min(8%,4rem);padding-right:min(8%,4rem);padding-top:min(8%,3rem);padding-bottom:min(8%,3rem)}._dialogContent_worsp_9._compact_worsp_16{padding:min(8%,1.5rem)}@media (min-width: 640px){._dialogContent_worsp_9{max-width:36rem}}@media (min-width: 1024px){._dialogContent_worsp_9{max-width:28rem}}._dialogTitle_worsp_30{text-align:center;font-size:calc(var(--mb-size)*1.5rem);line-height:calc(var(--mb-size)*2rem);font-weight:700}._contentOut_worsp_34{overflow-y:auto}._closeButton_worsp_38{position:absolute;top:.625rem;right:.625rem;width:calc(var(--mb-size)*2rem);height:calc(var(--mb-size)*2rem);display:flex;align-items:center;justify-content:center;border-radius:9999px;border-style:none;background-color:transparent;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s;transition-duration:.1s}._closeButton_worsp_38:hover{--un-bg-opacity:1;background-color:rgb(var(--color-gray-100-rgb-value) / var(--un-bg-opacity))}._closeButton_worsp_38:active{--un-bg-opacity:1;background-color:rgb(var(--color-gray-200-rgb-value) / var(--un-bg-opacity))}._closeButtonInner_worsp_44{display:flex;--un-translate-y:-2px;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z));align-items:center;justify-content:center;font-size:calc(var(--mb-size)*1.875rem);line-height:calc(var(--mb-size)*2.25rem);--un-text-opacity:1;color:rgb(var(--color-black-rgb-value) / var(--un-text-opacity));font-weight:200;line-height:1}._primaryActionButton_worsp_49{height:2.5rem;-webkit-appearance:none;appearance:none;border-radius:calc(var(--mb-size)*2.5rem);border-style:none;--un-bg-opacity:1;background-color:rgb(var(--color-primary) / var(--un-bg-opacity));padding-left:calc(var(--mb-size)*1.25rem);padding-right:calc(var(--mb-size)*1.25rem);padding-top:calc(var(--mb-size)*.25rem);padding-bottom:calc(var(--mb-size)*.25rem);text-wrap:nowrap;font-size:calc(var(--mb-size)*.875rem);line-height:calc(var(--mb-size)*1.25rem);--un-text-opacity:1;color:rgb(var(--color-white-rgb-value) / var(--un-text-opacity));transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s;transition-duration:.1s}._primaryActionButton_worsp_49[disabled]{cursor:not-allowed;--un-bg-opacity:1;background-color:rgb(var(--color-gray-200-rgb-value) / var(--un-bg-opacity));--un-text-opacity:1;color:rgb(var(--color-gray-500-rgb-value) / var(--un-text-opacity));--un-ring-width:0px;--un-ring-offset-shadow:var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color);--un-ring-shadow:var(--un-ring-inset) 0 0 0 calc(var(--un-ring-width) + var(--un-ring-offset-width)) var(--un-ring-color);box-shadow:var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}._primaryActionButton_worsp_49[disabled]:hover{--un-bg-opacity:1;background-color:rgb(var(--color-gray-200-rgb-value) / var(--un-bg-opacity));--un-text-opacity:1;color:rgb(var(--color-gray-500-rgb-value) / var(--un-text-opacity))}._primaryActionButton_worsp_49:hover{--un-bg-opacity:1;background-color:rgb(var(--color-accent-700-rgb-value) / var(--un-bg-opacity))}._primaryActionButton_worsp_49:active{--un-bg-opacity:1;background-color:rgb(var(--color-accent-800-rgb-value) / var(--un-bg-opacity))}._primaryActionButton_worsp_49:focus{outline-width:2px;--un-outline-color-opacity:1;outline-color:rgb(var(--color-accent-400-rgb-value) / var(--un-outline-color-opacity));outline-offset:4px;outline-style:solid}._secondaryActionButton_worsp_53{height:2.5rem;-webkit-appearance:none;appearance:none;border-radius:calc(var(--mb-size)*2.5rem);border-style:none;background-color:transparent;padding-left:calc(var(--mb-size)*1.25rem);padding-right:calc(var(--mb-size)*1.25rem);padding-top:calc(var(--mb-size)*.25rem);padding-bottom:calc(var(--mb-size)*.25rem);text-wrap:nowrap;font-size:calc(var(--mb-size)*.875rem);line-height:calc(var(--mb-size)*1.25rem);--un-text-opacity:1;color:rgb(var(--color-primary) / var(--un-text-opacity));--un-ring-width:1px;--un-ring-offset-shadow:var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color);--un-ring-shadow:var(--un-ring-inset) 0 0 0 calc(var(--un-ring-width) + var(--un-ring-offset-width)) var(--un-ring-color);box-shadow:var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow);--un-ring-opacity:1;--un-ring-color:rgb(var(--color-primary) / var(--un-ring-opacity)) ;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s;transition-duration:.1s}._secondaryActionButton_worsp_53[disabled]{cursor:not-allowed;--un-bg-opacity:1;background-color:rgb(var(--color-gray-200-rgb-value) / var(--un-bg-opacity));--un-text-opacity:1;color:rgb(var(--color-gray-500-rgb-value) / var(--un-text-opacity));--un-ring-width:0px;--un-ring-offset-shadow:var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color);--un-ring-shadow:var(--un-ring-inset) 0 0 0 calc(var(--un-ring-width) + var(--un-ring-offset-width)) var(--un-ring-color);box-shadow:var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}._secondaryActionButton_worsp_53[disabled]:hover{--un-bg-opacity:1;background-color:rgb(var(--color-gray-200-rgb-value) / var(--un-bg-opacity));--un-text-opacity:1;color:rgb(var(--color-gray-500-rgb-value) / var(--un-text-opacity))}._secondaryActionButton_worsp_53:hover{--un-bg-opacity:1;background-color:rgb(var(--color-accent-25-rgb-value) / var(--un-bg-opacity));--un-text-opacity:1;color:rgb(var(--color-accent-700-rgb-value) / var(--un-text-opacity));--un-ring-opacity:1;--un-ring-color:rgb(var(--color-accent-700-rgb-value) / var(--un-ring-opacity)) }._secondaryActionButton_worsp_53:active{--un-bg-opacity:1;background-color:rgb(var(--color-accent-50-rgb-value) / var(--un-bg-opacity));--un-text-opacity:1;color:rgb(var(--color-accent-800-rgb-value) / var(--un-text-opacity));--un-ring-opacity:1;--un-ring-color:rgb(var(--color-accent-800-rgb-value) / var(--un-ring-opacity)) }._secondaryActionButton_worsp_53:focus{outline-width:2px;--un-outline-color-opacity:1;outline-color:rgb(var(--color-accent-400-rgb-value) / var(--un-outline-color-opacity));outline-offset:4px;outline-style:solid}._actions_worsp_57{display:flex;gap:calc(var(--mb-size)*1rem)}._actions_worsp_57 ._primaryActionButton_worsp_49,._actions_worsp_57 ._secondaryActionButton_worsp_53{width:50%}._alertTitle_worsp_64{font-size:calc(var(--mb-size)*1.125rem);line-height:calc(var(--mb-size)*1.75rem);--un-text-opacity:1;color:rgb(var(--color-gray-700-rgb-value) / var(--un-text-opacity));font-weight:400}._alertText_worsp_68{margin-top:calc(var(--mb-size)*1rem);margin-bottom:calc(var(--mb-size)*2rem);padding-left:calc(var(--mb-size)*.5rem);padding-right:calc(var(--mb-size)*.5rem);text-align:center;text-wrap:pretty;--un-text-opacity:1;color:rgb(var(--color-gray-500-rgb-value) / var(--un-text-opacity));font-weight:300;line-height:1.5}*,:before,:after{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / .5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }::backdrop{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / .5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.left-0{left:calc(var(--mb-size)*0rem)}.right-0{right:calc(var(--mb-size)*0rem)}.right-4{right:calc(var(--mb-size)*1rem)}.top-\\[-1px\\]{top:-1px}.top-0{top:calc(var(--mb-size)*0rem)}.has-\\[\\[data-scope\\]\\]\\:z-2:has([data-scope]),.z-2{z-index:2}.z-1{z-index:1}.grid{display:grid}.auto-cols-auto{grid-auto-columns:auto}.grid-cols-\\[1fr_auto_1fr\\]{grid-template-columns:1fr auto 1fr}.block{display:block}.size-12{width:calc(var(--mb-size)*3rem);height:calc(var(--mb-size)*3rem)}.size-6{width:calc(var(--mb-size)*1.5rem);height:calc(var(--mb-size)*1.5rem)}.size-full{width:100%;height:100%}.h-\\[1px\\]{height:1px}.h-full{height:100%}.h-vh{height:100vh}.max-w-\\[100\\%\\]{max-width:100%}.min-h-\\[300px\\]{min-height:300px}.min-w-0{min-width:calc(var(--mb-size)*0rem)}.w-full{width:100%}.flex{display:flex}.shrink-0{flex-shrink:0}.flex-nowrap{flex-wrap:nowrap}.data-\\[state\\=open\\]\\:scale-y-\\[-1\\][data-state=open]{--un-scale-y:-1;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.transform{transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}.cursor-pointer{cursor:pointer}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.select-none{-webkit-user-select:none;user-select:none}.resize{resize:both}.appearance-none{-webkit-appearance:none;appearance:none}.place-items-center{place-items:center}.items-center{align-items:center}.justify-between{justify-content:space-between}.justify-self-start{justify-self:start}.justify-self-end{justify-self:end}.justify-self-center{justify-self:center}.gap-\\[1px\\]{gap:1px}.gap-2{gap:calc(var(--mb-size)*.5rem)}.gap-4{gap:calc(var(--mb-size)*1rem)}.overflow-hidden{overflow:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.rounded-4{border-radius:calc(var(--mb-size)*1rem)}.rounded-full{border-radius:9999px}.rounded-md{border-radius:.375rem}.border-none{border-style:none}.bg-dark-100\\/50{background-color:#3c3c3c80}.bg-dark-500{--un-bg-opacity:1;background-color:rgb(31 31 31 / var(--un-bg-opacity))}.bg-white{--un-bg-opacity:1;background-color:rgb(var(--color-white-rgb-value) / var(--un-bg-opacity))}.data-\\[highlighted\\]\\:bg-gray-500\\/50[data-highlighted]{background-color:rgb(var(--color-gray-500-rgb-value) / .5)}.bg-opacity-50{--un-bg-opacity:.5}.p-2{padding:calc(var(--mb-size)*.5rem)}.px-4{padding-left:calc(var(--mb-size)*1rem);padding-right:calc(var(--mb-size)*1rem)}.py-2{padding-top:calc(var(--mb-size)*.5rem);padding-bottom:calc(var(--mb-size)*.5rem)}.py-3{padding-top:calc(var(--mb-size)*.75rem);padding-bottom:calc(var(--mb-size)*.75rem)}.py-4{padding-top:calc(var(--mb-size)*1rem);padding-bottom:calc(var(--mb-size)*1rem)}.pl-4{padding-left:calc(var(--mb-size)*1rem)}.pr-12{padding-right:calc(var(--mb-size)*3rem)}.text-align-center{text-align:center}.text-base{font-size:calc(var(--mb-size)*1rem);line-height:calc(var(--mb-size)*1.5rem)}.text-sm{font-size:calc(var(--mb-size)*.875rem);line-height:calc(var(--mb-size)*1.25rem)}.color-white{--un-text-opacity:1;color:rgb(var(--color-white-rgb-value) / var(--un-text-opacity))}.font-500{font-weight:500}.disabled\\:opacity-50:disabled{opacity:.5}.shadow{--un-shadow:var(--un-shadow-inset) 0 1px 3px 0 var(--un-shadow-color, rgb(0 0 0 / .1)),var(--un-shadow-inset) 0 1px 2px -1px var(--un-shadow-color, rgb(0 0 0 / .1));box-shadow:var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}.backdrop-blur{--un-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--un-backdrop-blur) var(--un-backdrop-brightness) var(--un-backdrop-contrast) var(--un-backdrop-grayscale) var(--un-backdrop-hue-rotate) var(--un-backdrop-invert) var(--un-backdrop-opacity) var(--un-backdrop-saturate) var(--un-backdrop-sepia);backdrop-filter:var(--un-backdrop-blur) var(--un-backdrop-brightness) var(--un-backdrop-contrast) var(--un-backdrop-grayscale) var(--un-backdrop-hue-rotate) var(--un-backdrop-invert) var(--un-backdrop-opacity) var(--un-backdrop-saturate) var(--un-backdrop-sepia)}.backdrop-blur-xl{--un-backdrop-blur:blur(24px);-webkit-backdrop-filter:var(--un-backdrop-blur) var(--un-backdrop-brightness) var(--un-backdrop-contrast) var(--un-backdrop-grayscale) var(--un-backdrop-hue-rotate) var(--un-backdrop-invert) var(--un-backdrop-opacity) var(--un-backdrop-saturate) var(--un-backdrop-sepia);backdrop-filter:var(--un-backdrop-blur) var(--un-backdrop-brightness) var(--un-backdrop-contrast) var(--un-backdrop-grayscale) var(--un-backdrop-hue-rotate) var(--un-backdrop-invert) var(--un-backdrop-opacity) var(--un-backdrop-saturate) var(--un-backdrop-sepia)}.drop-shadow-md{--un-drop-shadow:drop-shadow(0 4px 3px var(--un-drop-shadow-color, rgb(0 0 0 / .07))) drop-shadow(0 2px 2px var(--un-drop-shadow-color, rgb(0 0 0 / .06)));filter:var(--un-blur) var(--un-brightness) var(--un-contrast) var(--un-drop-shadow) var(--un-grayscale) var(--un-hue-rotate) var(--un-invert) var(--un-saturate) var(--un-sepia)}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.lerp\\:px-3\\@xs\\,8\\@lg{padding-inline:clamp(calc(var(--mb-size)*.75rem),calc(var(--mb-size)*.75rem) + (100vw - 380px) * .031055900621118012,calc(var(--mb-size)*2rem))}@supports (height:100dvh){.supports-\\[\\(height\\:100dvh\\)\\]\\:h-dvh{height:100dvh}}")})();
|
|
2
|
+
import { subscribeWithSelector as he } from "zustand/middleware";
|
|
3
|
+
import { createStore as me } from "zustand/vanilla";
|
|
4
|
+
import { createComponent as s, use as O, template as S, spread as D, mergeProps as K, insert as w, memo as ge, isServer as Be, delegateEvents as Ve, effect as H, className as V, Portal as fe, Dynamic as Ue, render as je } from "solid-js/web";
|
|
5
|
+
import { createContext as be, onCleanup as ie, useContext as pe, onMount as Q, createSignal as z, Show as E, Index as qe, createRoot as He, getOwner as ve, splitProps as We, createEffect as Ge } from "solid-js";
|
|
6
|
+
import { createWithSignal as we } from "solid-zustand";
|
|
7
|
+
import { createStore as Xe } from "solid-js/store";
|
|
8
|
+
import { EnvironmentProvider as Ke } from "@ark-ui/solid/environment";
|
|
9
9
|
import { Dialog as $ } from "@ark-ui/solid/dialog";
|
|
10
|
-
import { Select as
|
|
11
|
-
import { Tooltip as
|
|
12
|
-
typeof HTMLVideoElement < "u" && !("requestVideoFrameCallback" in HTMLVideoElement.prototype) && "getVideoPlaybackQuality" in HTMLVideoElement.prototype && (HTMLVideoElement.prototype._rvfcpolyfillmap = {}, HTMLVideoElement.prototype.requestVideoFrameCallback = function(
|
|
13
|
-
const e = performance.now(),
|
|
14
|
-
const
|
|
15
|
-
if (
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
presentationTime: i +
|
|
19
|
-
expectedDisplayTime: i +
|
|
10
|
+
import { Select as A, createListCollection as Qe } from "@ark-ui/solid/select";
|
|
11
|
+
import { Tooltip as G } from "@ark-ui/solid/tooltip";
|
|
12
|
+
typeof HTMLVideoElement < "u" && !("requestVideoFrameCallback" in HTMLVideoElement.prototype) && "getVideoPlaybackQuality" in HTMLVideoElement.prototype && (HTMLVideoElement.prototype._rvfcpolyfillmap = {}, HTMLVideoElement.prototype.requestVideoFrameCallback = function(r) {
|
|
13
|
+
const e = performance.now(), t = this.getVideoPlaybackQuality(), a = this.mozPresentedFrames || this.mozPaintedFrames || t.totalVideoFrames - t.droppedVideoFrames, n = (o, i) => {
|
|
14
|
+
const l = this.getVideoPlaybackQuality(), c = this.mozPresentedFrames || this.mozPaintedFrames || l.totalVideoFrames - l.droppedVideoFrames;
|
|
15
|
+
if (c > a) {
|
|
16
|
+
const f = this.mozFrameDelay || l.totalFrameDelay - t.totalFrameDelay || 0, g = i - o;
|
|
17
|
+
r(i, {
|
|
18
|
+
presentationTime: i + f * 1e3,
|
|
19
|
+
expectedDisplayTime: i + g,
|
|
20
20
|
width: this.videoWidth,
|
|
21
21
|
height: this.videoHeight,
|
|
22
|
-
mediaTime: Math.max(0, this.currentTime || 0) +
|
|
23
|
-
presentedFrames:
|
|
24
|
-
processingDuration:
|
|
22
|
+
mediaTime: Math.max(0, this.currentTime || 0) + g / 1e3,
|
|
23
|
+
presentedFrames: c,
|
|
24
|
+
processingDuration: f
|
|
25
25
|
}), delete this._rvfcpolyfillmap[e];
|
|
26
26
|
} else
|
|
27
|
-
this._rvfcpolyfillmap[e] = requestAnimationFrame((
|
|
27
|
+
this._rvfcpolyfillmap[e] = requestAnimationFrame((f) => n(i, f));
|
|
28
28
|
};
|
|
29
|
-
return this._rvfcpolyfillmap[e] = requestAnimationFrame((
|
|
30
|
-
}, HTMLVideoElement.prototype.cancelVideoFrameCallback = function(
|
|
31
|
-
cancelAnimationFrame(this._rvfcpolyfillmap[
|
|
29
|
+
return this._rvfcpolyfillmap[e] = requestAnimationFrame((o) => n(e, o)), e;
|
|
30
|
+
}, HTMLVideoElement.prototype.cancelVideoFrameCallback = function(r) {
|
|
31
|
+
cancelAnimationFrame(this._rvfcpolyfillmap[r]), delete this._rvfcpolyfillmap[r];
|
|
32
32
|
});
|
|
33
|
-
const
|
|
33
|
+
const ye = {
|
|
34
34
|
cameras: [],
|
|
35
35
|
facingFilter: void 0,
|
|
36
36
|
videoElement: void 0,
|
|
@@ -40,14 +40,14 @@ const ge = {
|
|
|
40
40
|
isQueryingCameras: !1,
|
|
41
41
|
mirrorX: !1,
|
|
42
42
|
errorState: void 0
|
|
43
|
-
}, d =
|
|
43
|
+
}, d = me()(
|
|
44
44
|
// this is important! Otherwise solid-zustand will start mutating the initial state
|
|
45
|
-
|
|
46
|
-
),
|
|
47
|
-
console.debug("resetting
|
|
48
|
-
|
|
49
|
-
}), d.setState(structuredClone(
|
|
50
|
-
},
|
|
45
|
+
he(() => structuredClone(ye))
|
|
46
|
+
), Ye = () => {
|
|
47
|
+
console.debug("Stopping all cameras and resetting the `cameraManagerStore`."), d.getState().cameras.forEach((r) => {
|
|
48
|
+
r.stopStream();
|
|
49
|
+
}), d.setState(structuredClone(ye));
|
|
50
|
+
}, Je = [
|
|
51
51
|
// English
|
|
52
52
|
"back",
|
|
53
53
|
"rear",
|
|
@@ -118,7 +118,7 @@ const ge = {
|
|
|
118
118
|
"बैक",
|
|
119
119
|
// Latin American Spanish
|
|
120
120
|
"posterior"
|
|
121
|
-
],
|
|
121
|
+
], Ze = [
|
|
122
122
|
// English
|
|
123
123
|
"front",
|
|
124
124
|
// German
|
|
@@ -185,38 +185,38 @@ const ge = {
|
|
|
185
185
|
"फ्रंट",
|
|
186
186
|
// Latin American Spanish
|
|
187
187
|
"frontal"
|
|
188
|
-
],
|
|
189
|
-
var
|
|
190
|
-
function
|
|
191
|
-
for (var a = 0; a <
|
|
192
|
-
var
|
|
193
|
-
|
|
188
|
+
], Se = (r, e) => e.some((t) => r.toLowerCase().includes(t)), Ce = (r) => Se(r, Je), ke = (r) => Se(r, Ze);
|
|
189
|
+
var et = /* @__PURE__ */ function() {
|
|
190
|
+
function r(e, t) {
|
|
191
|
+
for (var a = 0; a < t.length; a++) {
|
|
192
|
+
var n = t[a];
|
|
193
|
+
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n);
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
|
-
return function(e,
|
|
197
|
-
return
|
|
196
|
+
return function(e, t, a) {
|
|
197
|
+
return t && r(e.prototype, t), a && r(e, a), e;
|
|
198
198
|
};
|
|
199
|
-
}(),
|
|
200
|
-
function
|
|
201
|
-
return Object.freeze(Object.defineProperties(
|
|
199
|
+
}(), tt = rt(["", ""], ["", ""]);
|
|
200
|
+
function rt(r, e) {
|
|
201
|
+
return Object.freeze(Object.defineProperties(r, { raw: { value: Object.freeze(e) } }));
|
|
202
202
|
}
|
|
203
|
-
function
|
|
204
|
-
if (!(
|
|
203
|
+
function at(r, e) {
|
|
204
|
+
if (!(r instanceof e))
|
|
205
205
|
throw new TypeError("Cannot call a class as a function");
|
|
206
206
|
}
|
|
207
|
-
var
|
|
208
|
-
function
|
|
209
|
-
for (var e = this,
|
|
210
|
-
a[
|
|
211
|
-
return
|
|
212
|
-
for (var i = arguments.length,
|
|
213
|
-
c
|
|
214
|
-
return typeof
|
|
215
|
-
}, a.length > 0 && Array.isArray(a[0]) && (a = a[0]), this.transformers = a.map(function(
|
|
216
|
-
return typeof
|
|
207
|
+
var _ = function() {
|
|
208
|
+
function r() {
|
|
209
|
+
for (var e = this, t = arguments.length, a = Array(t), n = 0; n < t; n++)
|
|
210
|
+
a[n] = arguments[n];
|
|
211
|
+
return at(this, r), this.tag = function(o) {
|
|
212
|
+
for (var i = arguments.length, l = Array(i > 1 ? i - 1 : 0), c = 1; c < i; c++)
|
|
213
|
+
l[c - 1] = arguments[c];
|
|
214
|
+
return typeof o == "function" ? e.interimTag.bind(e, o) : typeof o == "string" ? e.transformEndResult(o) : (o = o.map(e.transformString.bind(e)), e.transformEndResult(o.reduce(e.processSubstitutions.bind(e, l))));
|
|
215
|
+
}, a.length > 0 && Array.isArray(a[0]) && (a = a[0]), this.transformers = a.map(function(o) {
|
|
216
|
+
return typeof o == "function" ? o() : o;
|
|
217
217
|
}), this.tag;
|
|
218
218
|
}
|
|
219
|
-
return
|
|
219
|
+
return et(r, [{
|
|
220
220
|
key: "interimTag",
|
|
221
221
|
/**
|
|
222
222
|
* An intermediary template tag that receives a template tag and passes the result of calling the template with the received
|
|
@@ -226,10 +226,10 @@ var S = function() {
|
|
|
226
226
|
* @param {...*} ...substitutions - `substitutions` is an array of all substitutions in the template
|
|
227
227
|
* @return {*} - the final processed value
|
|
228
228
|
*/
|
|
229
|
-
value: function(
|
|
230
|
-
for (var
|
|
231
|
-
|
|
232
|
-
return this.tag(
|
|
229
|
+
value: function(t, a) {
|
|
230
|
+
for (var n = arguments.length, o = Array(n > 2 ? n - 2 : 0), i = 2; i < n; i++)
|
|
231
|
+
o[i - 2] = arguments[i];
|
|
232
|
+
return this.tag(tt, t.apply(void 0, [a].concat(o)));
|
|
233
233
|
}
|
|
234
234
|
/**
|
|
235
235
|
* Performs bulk processing on the tagged template, transforming each substitution and then
|
|
@@ -241,9 +241,9 @@ var S = function() {
|
|
|
241
241
|
*/
|
|
242
242
|
}, {
|
|
243
243
|
key: "processSubstitutions",
|
|
244
|
-
value: function(
|
|
245
|
-
var
|
|
246
|
-
return "".concat(a,
|
|
244
|
+
value: function(t, a, n) {
|
|
245
|
+
var o = this.transformSubstitution(t.shift(), a);
|
|
246
|
+
return "".concat(a, o, n);
|
|
247
247
|
}
|
|
248
248
|
/**
|
|
249
249
|
* Iterate through each transformer, applying the transformer's `onString` method to the template
|
|
@@ -253,11 +253,11 @@ var S = function() {
|
|
|
253
253
|
*/
|
|
254
254
|
}, {
|
|
255
255
|
key: "transformString",
|
|
256
|
-
value: function(
|
|
257
|
-
var a = function(
|
|
258
|
-
return i.onString ? i.onString(
|
|
256
|
+
value: function(t) {
|
|
257
|
+
var a = function(o, i) {
|
|
258
|
+
return i.onString ? i.onString(o) : o;
|
|
259
259
|
};
|
|
260
|
-
return this.transformers.reduce(a,
|
|
260
|
+
return this.transformers.reduce(a, t);
|
|
261
261
|
}
|
|
262
262
|
/**
|
|
263
263
|
* When a substitution is encountered, iterates through each transformer and applies the transformer's
|
|
@@ -268,11 +268,11 @@ var S = function() {
|
|
|
268
268
|
*/
|
|
269
269
|
}, {
|
|
270
270
|
key: "transformSubstitution",
|
|
271
|
-
value: function(
|
|
272
|
-
var
|
|
273
|
-
return
|
|
271
|
+
value: function(t, a) {
|
|
272
|
+
var n = function(i, l) {
|
|
273
|
+
return l.onSubstitution ? l.onSubstitution(i, a) : i;
|
|
274
274
|
};
|
|
275
|
-
return this.transformers.reduce(
|
|
275
|
+
return this.transformers.reduce(n, t);
|
|
276
276
|
}
|
|
277
277
|
/**
|
|
278
278
|
* Iterates through each transformer, applying the transformer's `onEndResult` method to the
|
|
@@ -282,14 +282,14 @@ var S = function() {
|
|
|
282
282
|
*/
|
|
283
283
|
}, {
|
|
284
284
|
key: "transformEndResult",
|
|
285
|
-
value: function(
|
|
286
|
-
var a = function(
|
|
287
|
-
return i.onEndResult ? i.onEndResult(
|
|
285
|
+
value: function(t) {
|
|
286
|
+
var a = function(o, i) {
|
|
287
|
+
return i.onEndResult ? i.onEndResult(o) : o;
|
|
288
288
|
};
|
|
289
|
-
return this.transformers.reduce(a,
|
|
289
|
+
return this.transformers.reduce(a, t);
|
|
290
290
|
}
|
|
291
|
-
}]),
|
|
292
|
-
}(),
|
|
291
|
+
}]), r;
|
|
292
|
+
}(), T = function() {
|
|
293
293
|
var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
|
|
294
294
|
return {
|
|
295
295
|
onEndResult: function(a) {
|
|
@@ -303,24 +303,24 @@ var S = function() {
|
|
|
303
303
|
}
|
|
304
304
|
};
|
|
305
305
|
};
|
|
306
|
-
function
|
|
307
|
-
if (Array.isArray(
|
|
308
|
-
for (var e = 0,
|
|
309
|
-
|
|
310
|
-
return
|
|
306
|
+
function nt(r) {
|
|
307
|
+
if (Array.isArray(r)) {
|
|
308
|
+
for (var e = 0, t = Array(r.length); e < r.length; e++)
|
|
309
|
+
t[e] = r[e];
|
|
310
|
+
return t;
|
|
311
311
|
} else
|
|
312
|
-
return Array.from(
|
|
312
|
+
return Array.from(r);
|
|
313
313
|
}
|
|
314
314
|
var L = function() {
|
|
315
315
|
var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "initial";
|
|
316
316
|
return {
|
|
317
317
|
onEndResult: function(a) {
|
|
318
318
|
if (e === "initial") {
|
|
319
|
-
var
|
|
320
|
-
return
|
|
319
|
+
var n = a.match(/^[^\S\n]*(?=\S)/gm), o = n && Math.min.apply(Math, nt(n.map(function(l) {
|
|
320
|
+
return l.length;
|
|
321
321
|
})));
|
|
322
|
-
if (
|
|
323
|
-
var i = new RegExp("^.{" +
|
|
322
|
+
if (o) {
|
|
323
|
+
var i = new RegExp("^.{" + o + "}", "gm");
|
|
324
324
|
return a.replace(i, "");
|
|
325
325
|
}
|
|
326
326
|
return a;
|
|
@@ -330,208 +330,520 @@ var L = function() {
|
|
|
330
330
|
throw new Error("Unknown type: " + e);
|
|
331
331
|
}
|
|
332
332
|
};
|
|
333
|
-
},
|
|
333
|
+
}, j = function(e, t) {
|
|
334
334
|
return {
|
|
335
|
-
onEndResult: function(
|
|
336
|
-
if (e == null ||
|
|
335
|
+
onEndResult: function(n) {
|
|
336
|
+
if (e == null || t == null)
|
|
337
337
|
throw new Error("replaceResultTransformer requires at least 2 arguments.");
|
|
338
|
-
return
|
|
338
|
+
return n.replace(e, t);
|
|
339
339
|
}
|
|
340
340
|
};
|
|
341
|
-
},
|
|
341
|
+
}, B = function(e, t) {
|
|
342
342
|
return {
|
|
343
|
-
onSubstitution: function(
|
|
344
|
-
if (e == null ||
|
|
343
|
+
onSubstitution: function(n, o) {
|
|
344
|
+
if (e == null || t == null)
|
|
345
345
|
throw new Error("replaceSubstitutionTransformer requires at least 2 arguments.");
|
|
346
|
-
return
|
|
346
|
+
return n == null ? n : n.toString().replace(e, t);
|
|
347
347
|
}
|
|
348
348
|
};
|
|
349
|
-
},
|
|
349
|
+
}, ot = {
|
|
350
350
|
separator: "",
|
|
351
351
|
conjunction: "",
|
|
352
352
|
serial: !1
|
|
353
|
-
},
|
|
354
|
-
var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] :
|
|
353
|
+
}, I = function() {
|
|
354
|
+
var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : ot;
|
|
355
355
|
return {
|
|
356
|
-
onSubstitution: function(a,
|
|
356
|
+
onSubstitution: function(a, n) {
|
|
357
357
|
if (Array.isArray(a)) {
|
|
358
|
-
var
|
|
359
|
-
if (
|
|
360
|
-
var
|
|
361
|
-
a = a.slice(0,
|
|
358
|
+
var o = a.length, i = e.separator, l = e.conjunction, c = e.serial, f = n.match(/(\n?[^\S\n]+)$/);
|
|
359
|
+
if (f ? a = a.join(i + f[1]) : a = a.join(i + " "), l && o > 1) {
|
|
360
|
+
var g = a.lastIndexOf(i);
|
|
361
|
+
a = a.slice(0, g) + (c ? i : "") + " " + l + a.slice(g + 1);
|
|
362
362
|
}
|
|
363
363
|
}
|
|
364
364
|
return a;
|
|
365
365
|
}
|
|
366
366
|
};
|
|
367
|
-
},
|
|
367
|
+
}, Ee = function(e) {
|
|
368
368
|
return {
|
|
369
|
-
onSubstitution: function(a,
|
|
369
|
+
onSubstitution: function(a, n) {
|
|
370
370
|
return typeof a == "string" && a.includes(e) && (a = a.split(e)), a;
|
|
371
371
|
}
|
|
372
372
|
};
|
|
373
|
-
},
|
|
373
|
+
}, le = function(e) {
|
|
374
374
|
return e != null && !Number.isNaN(e) && typeof e != "boolean";
|
|
375
|
-
},
|
|
375
|
+
}, it = function() {
|
|
376
376
|
return {
|
|
377
|
-
onSubstitution: function(
|
|
378
|
-
return Array.isArray(
|
|
377
|
+
onSubstitution: function(t) {
|
|
378
|
+
return Array.isArray(t) ? t.filter(le) : le(t) ? t : "";
|
|
379
379
|
}
|
|
380
380
|
};
|
|
381
381
|
};
|
|
382
|
-
new
|
|
383
|
-
new
|
|
384
|
-
new
|
|
385
|
-
new
|
|
386
|
-
`),
|
|
387
|
-
new
|
|
388
|
-
`),
|
|
389
|
-
new
|
|
390
|
-
new
|
|
391
|
-
new
|
|
392
|
-
new
|
|
393
|
-
new
|
|
394
|
-
new
|
|
395
|
-
new
|
|
396
|
-
new
|
|
397
|
-
var
|
|
398
|
-
const
|
|
399
|
-
|
|
382
|
+
new _(I({ separator: "," }), L, T);
|
|
383
|
+
new _(I({ separator: ",", conjunction: "and" }), L, T);
|
|
384
|
+
new _(I({ separator: ",", conjunction: "or" }), L, T);
|
|
385
|
+
new _(Ee(`
|
|
386
|
+
`), it, I, L, T);
|
|
387
|
+
new _(Ee(`
|
|
388
|
+
`), I, L, T, B(/&/g, "&"), B(/</g, "<"), B(/>/g, ">"), B(/"/g, """), B(/'/g, "'"), B(/`/g, "`"));
|
|
389
|
+
new _(j(/(?:\n(?:\s*))+/g, " "), T);
|
|
390
|
+
new _(j(/(?:\n\s*)/g, ""), T);
|
|
391
|
+
new _(I({ separator: "," }), j(/(?:\s+)/g, " "), T);
|
|
392
|
+
new _(I({ separator: ",", conjunction: "or" }), j(/(?:\s+)/g, " "), T);
|
|
393
|
+
new _(I({ separator: ",", conjunction: "and" }), j(/(?:\s+)/g, " "), T);
|
|
394
|
+
new _(I, L, T);
|
|
395
|
+
new _(I, j(/(?:\s+)/g, " "), T);
|
|
396
|
+
new _(L, T);
|
|
397
|
+
var _e = new _(L("all"), T);
|
|
398
|
+
const st = [
|
|
399
|
+
"Cameră dublă cu obiectiv superangular spate",
|
|
400
|
+
"מצלמה כפולה רחבה אחורית",
|
|
401
|
+
"Артқы қос кең бұрышты камера",
|
|
402
|
+
"Câmara grande angular dupla traseira",
|
|
403
|
+
"Πίσω διπλή ευρεία κάμερα",
|
|
404
|
+
"後置雙廣角鏡頭相機",
|
|
405
|
+
"Задна двойна широкоъгълна камера",
|
|
406
|
+
"Càmera dual posterior amb gran angular",
|
|
407
|
+
"Zadná duálna širokouhlá kamera",
|
|
408
|
+
"كاميرا خلفية مزدوجة عريضة",
|
|
409
|
+
"Задняя двойная широкоугольная камера",
|
|
410
|
+
"Задня здвоєна ширококутна камера",
|
|
411
|
+
"Cámara amplia posterior doble",
|
|
412
|
+
"Dwikamera Lebar Belakang",
|
|
413
|
+
"Tylny dwuobiektywowy aparat szerokokątny",
|
|
414
|
+
"Dubbel vidvinkelkamera på baksidan",
|
|
415
|
+
"Back Dual Wide Camera",
|
|
416
|
+
"Hátsó, kettős, széles látószögű kamera",
|
|
417
|
+
"후면 듀얼 와이드 카메라",
|
|
418
|
+
"Double caméra grand angle arrière",
|
|
419
|
+
"Fotocamera doppia con grandangolo (posteriore)",
|
|
420
|
+
"Double appareil photo grand angle arrière",
|
|
421
|
+
"Zadní duální širokoúhlý fotoaparát",
|
|
422
|
+
"Çift Geniş Kamera Arka Yüzü",
|
|
423
|
+
"Laajakulmainen kaksoistakakamera",
|
|
424
|
+
"Rückseitige Dual-Weitwinkelkamera",
|
|
425
|
+
"बैक ड्युअल वाइड कैमरा",
|
|
426
|
+
"后置双广角镜头",
|
|
427
|
+
"Câmera Dupla Grande-Angular Traseira",
|
|
428
|
+
"後置雙廣角相機",
|
|
429
|
+
"กล้องคู่ด้านหลังมุมกว้าง",
|
|
430
|
+
"Kamera Lebar Belakang Ganda",
|
|
431
|
+
"Dobbelt vidvinkelkamera bak",
|
|
432
|
+
"Camera kép rộng mặt sau",
|
|
433
|
+
"Cámara trasera dual con gran angular",
|
|
434
|
+
"背面デュアル広角カメラ",
|
|
435
|
+
"Stražnja dvostruka široka kamera"
|
|
436
|
+
], X = (r) => {
|
|
437
|
+
if (r instanceof Error) return r;
|
|
438
|
+
try {
|
|
439
|
+
return new Error(JSON.stringify(r));
|
|
440
|
+
} catch {
|
|
441
|
+
return new Error(String(r));
|
|
442
|
+
}
|
|
443
|
+
};
|
|
444
|
+
class Te extends Error {
|
|
445
|
+
code;
|
|
446
|
+
constructor(e, t, a) {
|
|
447
|
+
super(e), this.code = t, this.cause = a;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
const lt = async () => {
|
|
451
|
+
try {
|
|
452
|
+
const r = await navigator.mediaDevices.getUserMedia({
|
|
453
|
+
video: !0
|
|
454
|
+
});
|
|
455
|
+
xe(r);
|
|
456
|
+
} catch (r) {
|
|
457
|
+
throw console.log(r), new Te(
|
|
458
|
+
"Camera permission not given",
|
|
459
|
+
"PERMISSION_DENIED",
|
|
460
|
+
X(r)
|
|
461
|
+
);
|
|
462
|
+
}
|
|
463
|
+
}, ct = async () => {
|
|
464
|
+
if (!isSecureContext)
|
|
465
|
+
throw new Error(_e`
|
|
466
|
+
Cameras can only be used in a secure context:
|
|
467
|
+
https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts
|
|
468
|
+
`);
|
|
469
|
+
return await lt(), (await navigator.mediaDevices.enumerateDevices()).filter((t) => t.kind === "videoinput");
|
|
470
|
+
}, xe = (r) => {
|
|
471
|
+
const e = r.getTracks();
|
|
472
|
+
for (const t of e)
|
|
473
|
+
t.stop();
|
|
474
|
+
}, ut = (r, e, t) => ({
|
|
475
|
+
video: {
|
|
476
|
+
deviceId: t ? { exact: t } : void 0,
|
|
477
|
+
frameRate: 30,
|
|
478
|
+
aspectRatio: {
|
|
479
|
+
exact: P[r].width / P[r].height
|
|
480
|
+
},
|
|
481
|
+
width: {
|
|
482
|
+
ideal: P[r].width
|
|
483
|
+
},
|
|
484
|
+
height: {
|
|
485
|
+
ideal: P[r].height
|
|
486
|
+
},
|
|
487
|
+
facingMode: e
|
|
488
|
+
},
|
|
489
|
+
audio: !1
|
|
490
|
+
}), dt = async (r, e = "4k", t = "back") => {
|
|
491
|
+
if (r.length === 0)
|
|
492
|
+
throw new Error("No cameras found");
|
|
493
|
+
if (t === "back") {
|
|
494
|
+
const o = r.find(
|
|
495
|
+
(i) => st.includes(i.name)
|
|
496
|
+
);
|
|
497
|
+
if (o)
|
|
498
|
+
return await o.startStream(e), o;
|
|
499
|
+
}
|
|
500
|
+
const a = r.filter((o) => t === "back" || t === void 0 ? Ce(o.name) : ke(o.name));
|
|
501
|
+
if (a.length === 1 && a[0].facingMode === t)
|
|
502
|
+
return await a[0].startStream(e), a[0];
|
|
503
|
+
if (a.length > 0 && t === "front") {
|
|
504
|
+
const o = a[a.length - 1];
|
|
505
|
+
return await o.startStream(e), o;
|
|
506
|
+
}
|
|
507
|
+
a.length === 0 && (console.debug("No camera found with requested facing, using all cameras"), a.push(...r));
|
|
508
|
+
const n = /* @__PURE__ */ new Map();
|
|
509
|
+
r.forEach((o) => n.set(o, 0));
|
|
510
|
+
for (let o = a.length - 1; o >= 0; o--) {
|
|
511
|
+
const i = a[o];
|
|
512
|
+
if (await i.startStream(e), !i.facingMode)
|
|
513
|
+
return console.debug("No facing mode, returning last camera"), i;
|
|
514
|
+
if (i.facingMode && i.facingMode !== t) {
|
|
515
|
+
console.debug("Mismatched facing mode, moving on to the next camera"), i.stopStream();
|
|
516
|
+
continue;
|
|
517
|
+
}
|
|
518
|
+
if (i.torchSupported && i.singleShotSupported)
|
|
519
|
+
return console.debug("Camera supports torch and single shot, returning"), i;
|
|
520
|
+
if (i.torchSupported && n.set(i, n.get(i) + 1), i.singleShotSupported && n.set(i, n.get(i) + 1), o === 0) {
|
|
521
|
+
console.debug("Last camera in the pool, picking the best one");
|
|
522
|
+
let l, c = -1 / 0;
|
|
523
|
+
return n.forEach((f, g) => {
|
|
524
|
+
f > c && (c = f, l = g);
|
|
525
|
+
}), l;
|
|
526
|
+
}
|
|
527
|
+
i.stopStream();
|
|
528
|
+
}
|
|
529
|
+
throw new Error("No camera found, should not happen");
|
|
530
|
+
};
|
|
531
|
+
function ht(r) {
|
|
532
|
+
const e = [];
|
|
533
|
+
for (const t of r) {
|
|
534
|
+
const a = new Me(t);
|
|
535
|
+
a !== null && e.push(a);
|
|
536
|
+
}
|
|
537
|
+
return e;
|
|
538
|
+
}
|
|
539
|
+
const P = {
|
|
540
|
+
"720p": { width: 1280, height: 720 },
|
|
541
|
+
"1080p": { width: 1920, height: 1080 },
|
|
542
|
+
"4k": { width: 3840, height: 2160 }
|
|
543
|
+
};
|
|
544
|
+
function mt(r) {
|
|
545
|
+
return Math.max(r.width, r.height);
|
|
546
|
+
}
|
|
547
|
+
function gt(r) {
|
|
548
|
+
const e = {
|
|
549
|
+
width: Math.max(r.width, r.height),
|
|
550
|
+
height: Math.min(r.width, r.height)
|
|
551
|
+
};
|
|
552
|
+
return Math.abs(e.width / e.height - 16 / 9) > 1e-4 && console.warn(
|
|
553
|
+
`Resolution ${JSON.stringify(
|
|
554
|
+
r
|
|
555
|
+
)} is not 16:9, may cause issues with some video players.`
|
|
556
|
+
), e;
|
|
557
|
+
}
|
|
558
|
+
function ft(r) {
|
|
559
|
+
const e = mt(r);
|
|
560
|
+
return e > 1920 ? "4k" : e > 1280 ? "1080p" : "720p";
|
|
561
|
+
}
|
|
562
|
+
function bt(r) {
|
|
563
|
+
const e = gt(r), t = Object.entries(P).find(
|
|
564
|
+
([n, o]) => o.width === e.width && o.height === e.height
|
|
565
|
+
);
|
|
566
|
+
if (!t) {
|
|
567
|
+
const n = ft(r);
|
|
568
|
+
return console.warn(
|
|
569
|
+
`No exact resolution match found for ${JSON.stringify(r)}, categorizing as ${n}`
|
|
570
|
+
), n;
|
|
571
|
+
}
|
|
572
|
+
return t[0];
|
|
573
|
+
}
|
|
574
|
+
class Me {
|
|
575
|
+
deviceInfo;
|
|
576
|
+
/**
|
|
577
|
+
* Stream capabilities as reported by the stream.
|
|
578
|
+
*
|
|
579
|
+
* On iOS it's the same as `deviceCapabilities`. Firefox is only reporting
|
|
580
|
+
* rudimentary capabilities, so we can't rely on this for picking the right
|
|
581
|
+
* camera.
|
|
582
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack/getCapabilities
|
|
583
|
+
*/
|
|
584
|
+
streamCapabilities;
|
|
585
|
+
activeStream;
|
|
586
|
+
name;
|
|
587
|
+
facingMode;
|
|
588
|
+
torchSupported = !1;
|
|
589
|
+
torchEnabled = !1;
|
|
590
|
+
singleShotSupported = !1;
|
|
591
|
+
maxSupportedResolution;
|
|
592
|
+
/**
|
|
593
|
+
* Reference to the original instance before it was proxied.
|
|
594
|
+
*/
|
|
595
|
+
original = this;
|
|
596
|
+
notify;
|
|
597
|
+
notifyStateChange;
|
|
598
|
+
/**
|
|
599
|
+
* Device capabilities as reported by the device.
|
|
600
|
+
*
|
|
601
|
+
* Not available on Firefox.
|
|
602
|
+
* Chrome doesn't report the torch capability, so we have to check for it on the stream.
|
|
603
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/InputDeviceInfo/getCapabilities
|
|
604
|
+
*
|
|
605
|
+
* @deprecated Not used. Reconsider using once Firefox and Chrome align on this.
|
|
606
|
+
*/
|
|
607
|
+
#e;
|
|
608
|
+
constructor(e) {
|
|
609
|
+
if (e.kind !== "videoinput")
|
|
610
|
+
throw new Error("Device is not a video input device");
|
|
611
|
+
this.deviceInfo = e, this.name = e.label, ke(e.label) && (this.facingMode = "front"), Ce(e.label) && (this.facingMode = "back");
|
|
612
|
+
const t = this, a = new Proxy(this, {
|
|
613
|
+
set(n, o, i, l) {
|
|
614
|
+
const c = Reflect.get(n, o, l), f = {
|
|
615
|
+
property: o,
|
|
616
|
+
oldValue: c,
|
|
617
|
+
value: i
|
|
618
|
+
};
|
|
619
|
+
return t.notify(f), Reflect.set(n, o, i, l);
|
|
620
|
+
}
|
|
621
|
+
});
|
|
622
|
+
return this.notify = (n) => {
|
|
623
|
+
this.notifyStateChange?.(a, n);
|
|
624
|
+
}, a;
|
|
625
|
+
}
|
|
626
|
+
async startStream(e) {
|
|
627
|
+
if (this.activeStream)
|
|
628
|
+
return this.activeStream;
|
|
629
|
+
this.maxSupportedResolution && (e = this.maxSupportedResolution);
|
|
630
|
+
const t = await this.acquireStreamWithFallback(e);
|
|
631
|
+
this.populateCapabilities(t), this.activeStream = t;
|
|
632
|
+
const a = t.getVideoTracks()[0];
|
|
633
|
+
return a.onended = (n) => {
|
|
634
|
+
this.stopStream(), this.notify({
|
|
635
|
+
event: n,
|
|
636
|
+
payload: "TRACK_END"
|
|
637
|
+
});
|
|
638
|
+
}, t;
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* Acquires a camera stream with the specified resolution.
|
|
642
|
+
* If acquisition fails, it tries a lower resolution as fallback.
|
|
643
|
+
*/
|
|
644
|
+
async acquireStreamWithFallback(e) {
|
|
645
|
+
try {
|
|
646
|
+
const t = ut(
|
|
647
|
+
e,
|
|
648
|
+
this.facingMode,
|
|
649
|
+
this.deviceInfo.deviceId
|
|
650
|
+
);
|
|
651
|
+
return await navigator.mediaDevices.getUserMedia(t);
|
|
652
|
+
} catch (t) {
|
|
653
|
+
console.warn(
|
|
654
|
+
`Can't get camera stream for ${this.name} at ${e}`,
|
|
655
|
+
t
|
|
656
|
+
);
|
|
657
|
+
let a = Object.keys(P).indexOf(e);
|
|
658
|
+
if (a === 0)
|
|
659
|
+
throw new Error("Failed to get camera stream");
|
|
660
|
+
const n = Object.keys(P)[a - 1];
|
|
661
|
+
return await this.acquireStreamWithFallback(n);
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
/**
|
|
665
|
+
* Populates the camera instance with capabilities from the stream.
|
|
666
|
+
*/
|
|
667
|
+
populateCapabilities(e) {
|
|
668
|
+
this.streamCapabilities = e.getVideoTracks()[0].getCapabilities();
|
|
669
|
+
const a = e.getVideoTracks()[0].getSettings();
|
|
670
|
+
if (!a.width || !a.height)
|
|
671
|
+
throw new Error(
|
|
672
|
+
"Video track resolution not available. Should not happen."
|
|
673
|
+
);
|
|
674
|
+
const n = {
|
|
675
|
+
width: a.width,
|
|
676
|
+
height: a.height
|
|
677
|
+
}, o = bt(n);
|
|
678
|
+
!this.maxSupportedResolution && o && (this.maxSupportedResolution = o), "torch" in this.streamCapabilities && (this.torchSupported = !0), "focusMode" in this.streamCapabilities && this.streamCapabilities.focusMode?.includes("single-shot") && (this.singleShotSupported = !0), this.facingMode === "front" && this.streamCapabilities.facingMode?.includes("environment") && (this.facingMode = "back", console.warn("Front camera selected, but facingMode is environment")), this.facingMode === "back" && this.streamCapabilities.facingMode?.includes("user") && (this.facingMode = "front", console.warn("Back camera selected, but facingMode is user")), this.facingMode || (this.streamCapabilities.facingMode?.includes("environment") && (this.facingMode = "back"), this.streamCapabilities.facingMode?.includes("user") && (this.facingMode = "front"));
|
|
679
|
+
}
|
|
680
|
+
async toggleTorch() {
|
|
681
|
+
const e = this.getVideoTrack();
|
|
682
|
+
if (!e)
|
|
683
|
+
throw new Error("No active stream on Camera instance.");
|
|
684
|
+
if (!this.torchSupported)
|
|
685
|
+
throw new Error("Torch not supported on this device.");
|
|
686
|
+
try {
|
|
687
|
+
await e.applyConstraints({
|
|
688
|
+
advanced: [
|
|
689
|
+
{
|
|
690
|
+
torch: !this.torchEnabled
|
|
691
|
+
}
|
|
692
|
+
]
|
|
693
|
+
}), this.torchEnabled = !this.torchEnabled;
|
|
694
|
+
} catch (t) {
|
|
695
|
+
throw console.error("Failed to toggle torch", t), this.torchEnabled = !1, this.torchSupported = !1, new Error("Failed to toggle torch", { cause: t });
|
|
696
|
+
}
|
|
697
|
+
return this.torchEnabled;
|
|
698
|
+
}
|
|
699
|
+
stopStream() {
|
|
700
|
+
this.activeStream && (console.debug(`Stopping active stream on ${this.name}`), xe(this.activeStream), this.activeStream = void 0, this.streamCapabilities = void 0, this.torchEnabled = !1);
|
|
701
|
+
}
|
|
702
|
+
getVideoTrack() {
|
|
703
|
+
if (!this.activeStream) {
|
|
704
|
+
console.warn(`No active stream on Camera instance: ${this.name}.`);
|
|
705
|
+
return;
|
|
706
|
+
}
|
|
707
|
+
return this.activeStream.getVideoTracks()[0];
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
const ce = Element.prototype.attachShadow;
|
|
711
|
+
function se() {
|
|
400
712
|
return typeof window.ShadyDOM < "u" && typeof ShadowRoot < "u";
|
|
401
713
|
}
|
|
402
|
-
function
|
|
714
|
+
function pt() {
|
|
403
715
|
return typeof ShadowRoot < "u";
|
|
404
716
|
}
|
|
405
|
-
function
|
|
406
|
-
|
|
407
|
-
const
|
|
408
|
-
return t
|
|
717
|
+
function vt(r) {
|
|
718
|
+
ce == null || se() || (Element.prototype.attachShadow = function(e) {
|
|
719
|
+
const t = ce.call(this, e);
|
|
720
|
+
return r(t), t;
|
|
409
721
|
});
|
|
410
722
|
}
|
|
411
|
-
function
|
|
412
|
-
const
|
|
723
|
+
function wt(r, ...e) {
|
|
724
|
+
const t = new Set(e);
|
|
413
725
|
let a = !1;
|
|
414
|
-
const
|
|
415
|
-
for (const
|
|
416
|
-
|
|
417
|
-
|
|
726
|
+
const n = () => {
|
|
727
|
+
for (const o of t)
|
|
728
|
+
r(o);
|
|
729
|
+
t.clear();
|
|
418
730
|
};
|
|
419
731
|
return {
|
|
420
732
|
isRunning() {
|
|
421
733
|
return a;
|
|
422
734
|
},
|
|
423
|
-
schedule(
|
|
424
|
-
|
|
735
|
+
schedule(o) {
|
|
736
|
+
t.add(o), a && n();
|
|
425
737
|
},
|
|
426
738
|
stop() {
|
|
427
739
|
a = !1;
|
|
428
740
|
},
|
|
429
741
|
run() {
|
|
430
|
-
a || (a = !0,
|
|
742
|
+
a || (a = !0, n());
|
|
431
743
|
}
|
|
432
744
|
};
|
|
433
745
|
}
|
|
434
|
-
const
|
|
746
|
+
const yt = {
|
|
435
747
|
childList: !0,
|
|
436
748
|
subtree: !0
|
|
437
|
-
},
|
|
438
|
-
typeof queueMicrotask < "u" ? queueMicrotask(
|
|
749
|
+
}, St = (r) => {
|
|
750
|
+
typeof queueMicrotask < "u" ? queueMicrotask(r) : typeof Promise < "u" ? Promise.resolve().then(() => r()) : setTimeout(() => r(), 0);
|
|
439
751
|
};
|
|
440
|
-
function
|
|
441
|
-
if (typeof Symbol < "u" &&
|
|
442
|
-
return [...
|
|
752
|
+
function ue(r) {
|
|
753
|
+
if (typeof Symbol < "u" && r[Symbol.iterator] != null)
|
|
754
|
+
return [...r];
|
|
443
755
|
{
|
|
444
756
|
const e = [];
|
|
445
|
-
for (let
|
|
446
|
-
e[
|
|
757
|
+
for (let t = 0; t < r.length; t++)
|
|
758
|
+
e[t] = r[t];
|
|
447
759
|
return e;
|
|
448
760
|
}
|
|
449
761
|
}
|
|
450
|
-
function
|
|
451
|
-
return
|
|
762
|
+
function Ct(r, e) {
|
|
763
|
+
return se() ? new Set(ue(window.ShadyDOM.nativeMethods.querySelectorAll.call(document.documentElement, e))) : new Set("querySelectorAll" in r ? ue(r.querySelectorAll(e)) : []);
|
|
452
764
|
}
|
|
453
|
-
function
|
|
454
|
-
return /* @__PURE__ */ new Set([...
|
|
765
|
+
function kt(r, e) {
|
|
766
|
+
return /* @__PURE__ */ new Set([...r ?? [], ...e ?? []]);
|
|
455
767
|
}
|
|
456
|
-
function
|
|
457
|
-
return "activeElement" in
|
|
768
|
+
function Et(r) {
|
|
769
|
+
return "activeElement" in r;
|
|
458
770
|
}
|
|
459
|
-
function
|
|
460
|
-
if (
|
|
771
|
+
function Re(r = document.documentElement) {
|
|
772
|
+
if (Et(r) && Ae(r), se() && r instanceof ShadowRoot || !pt())
|
|
461
773
|
return;
|
|
462
|
-
const e =
|
|
463
|
-
for (const a of [...e, ...
|
|
464
|
-
|
|
774
|
+
const e = r.childNodes, t = "shadowRoot" in r && r.shadowRoot != null ? [r.shadowRoot] : [];
|
|
775
|
+
for (const a of [...e, ...t])
|
|
776
|
+
Re(a);
|
|
465
777
|
}
|
|
466
|
-
function
|
|
467
|
-
return "isConnected" in Node.prototype ?
|
|
778
|
+
function _t(r) {
|
|
779
|
+
return "isConnected" in Node.prototype ? r.isConnected : r.ownerDocument == null || !(r.ownerDocument.compareDocumentPosition(r) & r.DOCUMENT_POSITION_DISCONNECTED);
|
|
468
780
|
}
|
|
469
|
-
const
|
|
470
|
-
function
|
|
471
|
-
const
|
|
472
|
-
let i = !1,
|
|
473
|
-
const
|
|
474
|
-
|
|
475
|
-
const
|
|
476
|
-
|
|
477
|
-
},
|
|
478
|
-
i || (i = !0,
|
|
479
|
-
},
|
|
480
|
-
|
|
481
|
-
},
|
|
482
|
-
const
|
|
483
|
-
return
|
|
484
|
-
},
|
|
781
|
+
const W = /* @__PURE__ */ new Map();
|
|
782
|
+
function Tt(r, e) {
|
|
783
|
+
const t = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new WeakMap();
|
|
784
|
+
let i = !1, l = !1, c = !1;
|
|
785
|
+
const f = () => {
|
|
786
|
+
l = !0;
|
|
787
|
+
const v = [...t];
|
|
788
|
+
v.length > 0 && e(v, r), t.clear(), i = !1, l = !1;
|
|
789
|
+
}, g = () => {
|
|
790
|
+
i || (i = !0, St(f));
|
|
791
|
+
}, y = (v) => {
|
|
792
|
+
t.add(v), l || g();
|
|
793
|
+
}, u = () => {
|
|
794
|
+
const v = [...t];
|
|
795
|
+
return t.clear(), v;
|
|
796
|
+
}, h = () => {
|
|
485
797
|
a.clear();
|
|
486
|
-
},
|
|
487
|
-
let
|
|
488
|
-
const
|
|
489
|
-
|
|
490
|
-
},
|
|
491
|
-
for (const
|
|
492
|
-
const
|
|
493
|
-
|
|
494
|
-
connected:
|
|
495
|
-
target:
|
|
798
|
+
}, p = (v, x) => {
|
|
799
|
+
let R = n.get(v);
|
|
800
|
+
const F = Ct(v, x), M = R?.get(x), Pe = kt(F, M);
|
|
801
|
+
C(Pe), R == null && (R = /* @__PURE__ */ new Map(), n.set(v, R)), R.set(x, F);
|
|
802
|
+
}, C = (v) => {
|
|
803
|
+
for (const x of v) {
|
|
804
|
+
const R = o.get(x), F = _t(x);
|
|
805
|
+
R !== F && (o.set(x, F), y({
|
|
806
|
+
connected: F,
|
|
807
|
+
target: x
|
|
496
808
|
}));
|
|
497
809
|
}
|
|
498
|
-
},
|
|
810
|
+
}, b = {
|
|
499
811
|
observedTargets: a,
|
|
500
|
-
queryRootAndHandleMutationChanges:
|
|
501
|
-
handleMutationChange:
|
|
502
|
-
addObservedTarget: (
|
|
503
|
-
if (
|
|
504
|
-
|
|
812
|
+
queryRootAndHandleMutationChanges: p,
|
|
813
|
+
handleMutationChange: C,
|
|
814
|
+
addObservedTarget: (v) => {
|
|
815
|
+
if (ae.run(), c || (c = !0, Re()), a.add(v), typeof v != "string")
|
|
816
|
+
C([v]);
|
|
505
817
|
else
|
|
506
|
-
for (const
|
|
507
|
-
|
|
818
|
+
for (const x of re)
|
|
819
|
+
p(x, v);
|
|
508
820
|
},
|
|
509
|
-
clearObservedTargets:
|
|
510
|
-
clearQueue:
|
|
821
|
+
clearObservedTargets: h,
|
|
822
|
+
clearQueue: u
|
|
511
823
|
};
|
|
512
|
-
|
|
824
|
+
W.set(r, b);
|
|
513
825
|
}
|
|
514
|
-
const
|
|
515
|
-
for (const e of
|
|
826
|
+
const xt = (r) => {
|
|
827
|
+
for (const e of r)
|
|
516
828
|
if (e.type === "childList")
|
|
517
|
-
for (const
|
|
518
|
-
for (const a of
|
|
519
|
-
typeof a == "string" ?
|
|
520
|
-
},
|
|
521
|
-
let
|
|
829
|
+
for (const t of W.values())
|
|
830
|
+
for (const a of t.observedTargets)
|
|
831
|
+
typeof a == "string" ? t.queryRootAndHandleMutationChanges(e.target, a) : t.handleMutationChange([a]);
|
|
832
|
+
}, re = /* @__PURE__ */ new Set(), Ae = /* @__PURE__ */ (() => {
|
|
833
|
+
let r;
|
|
522
834
|
return function(e) {
|
|
523
|
-
|
|
835
|
+
re.has(e) || (re.add(e), r == null && (r = new MutationObserver(xt)), r.observe(e, yt));
|
|
524
836
|
};
|
|
525
|
-
})(),
|
|
526
|
-
class
|
|
837
|
+
})(), ae = wt(Ae, document.documentElement);
|
|
838
|
+
class N {
|
|
527
839
|
constructor(e) {
|
|
528
840
|
if (new.target === void 0)
|
|
529
|
-
throw new TypeError(`Constructor ${
|
|
841
|
+
throw new TypeError(`Constructor ${N.name} requires 'new'`);
|
|
530
842
|
if (e === void 0)
|
|
531
|
-
throw new ReferenceError(`Failed to construct '${
|
|
843
|
+
throw new ReferenceError(`Failed to construct '${N.name}': 1 argument required, but only 0 present.`);
|
|
532
844
|
if (typeof e != "function")
|
|
533
|
-
throw new TypeError(`Failed to construct '${
|
|
534
|
-
|
|
845
|
+
throw new TypeError(`Failed to construct '${N.name}': The callback provided as parameter 1 is not a function.`);
|
|
846
|
+
Tt(this, e);
|
|
535
847
|
}
|
|
536
848
|
/**
|
|
537
849
|
* The Symbol.@@toStringTag value
|
|
@@ -547,87 +859,269 @@ class D {
|
|
|
547
859
|
*/
|
|
548
860
|
observe(e) {
|
|
549
861
|
if (e === void 0)
|
|
550
|
-
throw new ReferenceError(`Failed to execute '${this.observe.name}' on '${
|
|
862
|
+
throw new ReferenceError(`Failed to execute '${this.observe.name}' on '${N.name}': 1 argument required, but only 0 present.`);
|
|
551
863
|
if (typeof e != "string" && !(e instanceof Node))
|
|
552
|
-
throw new TypeError(`Failed to execute '${this.observe.name}' on '${
|
|
553
|
-
const
|
|
554
|
-
|
|
864
|
+
throw new TypeError(`Failed to execute '${this.observe.name}' on '${N.name}': parameter 1 is not of type 'Node' or a DOMString.`);
|
|
865
|
+
const t = W.get(this);
|
|
866
|
+
t?.addObservedTarget(e);
|
|
555
867
|
}
|
|
556
868
|
/**
|
|
557
869
|
* Takes the records immediately (instead of waiting for the next flush)
|
|
558
870
|
*/
|
|
559
871
|
takeRecords() {
|
|
560
|
-
const e =
|
|
872
|
+
const e = W.get(this);
|
|
561
873
|
return e == null ? [] : e.clearQueue();
|
|
562
874
|
}
|
|
563
875
|
/**
|
|
564
876
|
* Disconnects the ConnectionObserver such that none of its callbacks will be invoked any longer
|
|
565
877
|
*/
|
|
566
878
|
disconnect() {
|
|
567
|
-
const e =
|
|
879
|
+
const e = W.get(this);
|
|
568
880
|
e?.clearObservedTargets();
|
|
569
881
|
}
|
|
570
882
|
}
|
|
571
|
-
|
|
572
|
-
function
|
|
573
|
-
return
|
|
574
|
-
|
|
883
|
+
vt(ae.schedule.bind(ae));
|
|
884
|
+
function Mt(r, ...e) {
|
|
885
|
+
return r.addEventListener(...e), () => {
|
|
886
|
+
r.removeEventListener(...e);
|
|
575
887
|
};
|
|
576
888
|
}
|
|
577
|
-
function
|
|
578
|
-
let
|
|
579
|
-
if (e((a,
|
|
580
|
-
|
|
581
|
-
}), !
|
|
889
|
+
function Rt(r, e) {
|
|
890
|
+
let t;
|
|
891
|
+
if (e((a, n) => {
|
|
892
|
+
r.addEventListener(a, n), t = () => r.removeEventListener(a, n);
|
|
893
|
+
}), !t)
|
|
582
894
|
throw new Error("you forgot to add event listener");
|
|
583
|
-
return
|
|
895
|
+
return t;
|
|
584
896
|
}
|
|
585
|
-
|
|
586
|
-
|
|
897
|
+
function ne(r) {
|
|
898
|
+
const e = $e(r);
|
|
899
|
+
if ("detached" in e)
|
|
900
|
+
return e.detached;
|
|
587
901
|
try {
|
|
588
|
-
return new
|
|
902
|
+
return new Uint8Array(e), !1;
|
|
589
903
|
} catch {
|
|
590
|
-
return
|
|
904
|
+
return !0;
|
|
591
905
|
}
|
|
592
|
-
};
|
|
593
|
-
let O;
|
|
594
|
-
function dt(t, e = !1) {
|
|
595
|
-
O || (O = document.createElement("canvas"));
|
|
596
|
-
const r = O.getContext("2d", {
|
|
597
|
-
willReadFrequently: !0,
|
|
598
|
-
alpha: !1
|
|
599
|
-
});
|
|
600
|
-
if (!r)
|
|
601
|
-
throw new Error("CanvasRenderingContext2D is missing!");
|
|
602
|
-
const a = t.videoWidth, o = t.videoHeight;
|
|
603
|
-
return O.width = a, O.height = o, r.drawImage(t, 0, 0, a, o), e && r.scale(-1, 1), r.getImageData(0, 0, a, o);
|
|
604
906
|
}
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
907
|
+
class At {
|
|
908
|
+
#e;
|
|
909
|
+
#o = null;
|
|
910
|
+
#a = null;
|
|
911
|
+
#r = null;
|
|
912
|
+
#n = null;
|
|
913
|
+
#t = null;
|
|
914
|
+
#s = 0;
|
|
915
|
+
#l = 0;
|
|
916
|
+
#i;
|
|
917
|
+
#u = 4;
|
|
918
|
+
constructor(e = {}) {
|
|
919
|
+
const { canvasRenderingMode: t = "webgl2", fallbackWebGlTo2d: a = !0 } = e;
|
|
920
|
+
if (this.#i = t, this.#e = document.createElement("canvas"), t === "2d")
|
|
921
|
+
this.#d();
|
|
922
|
+
else if (t === "webgl2")
|
|
923
|
+
try {
|
|
924
|
+
this.#h();
|
|
925
|
+
} catch (n) {
|
|
926
|
+
if (a)
|
|
927
|
+
console.warn(
|
|
928
|
+
"Failed to create WebGL2 context, falling back to 2D canvas"
|
|
929
|
+
), this.#i = "2d", this.#d();
|
|
930
|
+
else
|
|
931
|
+
throw n;
|
|
932
|
+
}
|
|
933
|
+
else
|
|
934
|
+
throw new Error(
|
|
935
|
+
`Unsupported rendering context: ${t}`
|
|
936
|
+
);
|
|
937
|
+
}
|
|
938
|
+
/**
|
|
939
|
+
* Initializes the 2D canvas context
|
|
940
|
+
*/
|
|
941
|
+
#d() {
|
|
942
|
+
const e = this.#e.getContext("2d", {
|
|
943
|
+
alpha: !1,
|
|
944
|
+
willReadFrequently: !0
|
|
945
|
+
});
|
|
946
|
+
if (!e) throw new Error("CanvasRenderingContext2D is missing!");
|
|
947
|
+
this.#o = e;
|
|
948
|
+
}
|
|
949
|
+
/**
|
|
950
|
+
* Initializes the WebGL2 context and resources
|
|
951
|
+
*/
|
|
952
|
+
#h() {
|
|
953
|
+
const e = this.#e.getContext("webgl2", {
|
|
954
|
+
alpha: !1,
|
|
955
|
+
depth: !1,
|
|
956
|
+
stencil: !1,
|
|
957
|
+
antialias: !1,
|
|
958
|
+
premultipliedAlpha: !1,
|
|
959
|
+
preserveDrawingBuffer: !1,
|
|
960
|
+
desynchronized: !1,
|
|
961
|
+
powerPreference: "high-performance"
|
|
962
|
+
});
|
|
963
|
+
if (!e) throw new Error("WebGL2RenderingContext is missing!");
|
|
964
|
+
this.#a = e;
|
|
965
|
+
const t = e.createTexture();
|
|
966
|
+
if (!t) throw new Error("Failed to create WebGL texture");
|
|
967
|
+
this.#r = t, e.bindTexture(e.TEXTURE_2D, t), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, e.NEAREST), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MAG_FILTER, e.NEAREST);
|
|
968
|
+
const a = e.createFramebuffer();
|
|
969
|
+
if (!a) throw new Error("Failed to create framebuffer");
|
|
970
|
+
this.#n = a, e.bindFramebuffer(e.FRAMEBUFFER, a), e.framebufferTexture2D(
|
|
971
|
+
e.FRAMEBUFFER,
|
|
972
|
+
e.COLOR_ATTACHMENT0,
|
|
973
|
+
e.TEXTURE_2D,
|
|
974
|
+
t,
|
|
975
|
+
0
|
|
976
|
+
);
|
|
977
|
+
}
|
|
978
|
+
/**
|
|
979
|
+
* Returns ownership of an ArrayBuffer to the processor for reuse
|
|
980
|
+
* This should only be called with ArrayBuffers that were originally from this processor
|
|
981
|
+
* Typically used after transferring the buffer to/from a worker
|
|
982
|
+
*/
|
|
983
|
+
reattachArrayBuffer(e) {
|
|
984
|
+
const t = $e(e);
|
|
985
|
+
if (ne(t))
|
|
986
|
+
throw new Error("Can't use a detached array buffer!");
|
|
987
|
+
const a = this.#s * this.#l * 4;
|
|
988
|
+
if (t.byteLength === a)
|
|
989
|
+
this.#t = new Uint8ClampedArray(t);
|
|
990
|
+
else
|
|
991
|
+
throw new Error(
|
|
992
|
+
`ArrayBuffer size mismatch: expected ${a}, got ${t.byteLength}`
|
|
993
|
+
);
|
|
994
|
+
}
|
|
995
|
+
/**
|
|
996
|
+
* Used to check if the processor owns the buffer
|
|
997
|
+
*/
|
|
998
|
+
isBufferDetached() {
|
|
999
|
+
if (!this.#t)
|
|
1000
|
+
throw new Error("Buffer is missing!");
|
|
1001
|
+
return ne(this.#t.buffer);
|
|
1002
|
+
}
|
|
1003
|
+
/**
|
|
1004
|
+
* Extracts image data from a source element
|
|
1005
|
+
*/
|
|
1006
|
+
getImageData(e, t) {
|
|
1007
|
+
return this.#i === "2d" ? this.#m(e, t) : this.#g(e, t);
|
|
1008
|
+
}
|
|
1009
|
+
/**
|
|
1010
|
+
* Used to get the current ImageData object with the current buffer. Useful
|
|
1011
|
+
* when you need to get the same `ImageData` object multiple times after the
|
|
1012
|
+
* original `ImageData` buffer has been detached
|
|
1013
|
+
* @returns ImageData object with the current buffer
|
|
1014
|
+
*/
|
|
1015
|
+
getCurrentImageData() {
|
|
1016
|
+
if (!this.#t)
|
|
1017
|
+
throw new Error("Buffer is missing!");
|
|
1018
|
+
return new ImageData(this.#t, this.#s, this.#l);
|
|
1019
|
+
}
|
|
1020
|
+
/**
|
|
1021
|
+
* Extract image data using 2D canvas
|
|
1022
|
+
*/
|
|
1023
|
+
#m(e, t) {
|
|
1024
|
+
if (!this.#o)
|
|
1025
|
+
throw new Error("CanvasRenderingContext2D is missing!");
|
|
1026
|
+
const a = "videoWidth" in e ? e.videoWidth : e.width, n = "videoHeight" in e ? e.videoHeight : e.height, o = t?.x ?? 0, i = t?.y ?? 0, l = t?.width ?? a, c = t?.height ?? n;
|
|
1027
|
+
return this.#c(l, c), this.#o.drawImage(e, o, i, l, c), this.#o.getImageData(0, 0, l, c);
|
|
1028
|
+
}
|
|
1029
|
+
/**
|
|
1030
|
+
* Extract image data using WebGL2
|
|
1031
|
+
*/
|
|
1032
|
+
#g(e, t) {
|
|
1033
|
+
if (!this.#a || !this.#r || !this.#n)
|
|
1034
|
+
throw new Error("WebGL2 context or resources are missing!");
|
|
1035
|
+
const a = "videoWidth" in e ? e.videoWidth : e.width, n = "videoHeight" in e ? e.videoHeight : e.height, o = t?.x ?? 0, i = t?.y ?? 0, l = t?.width ?? a, c = t?.height ?? n, f = l * c * 4;
|
|
1036
|
+
if (this.#c(l, c), this.isBufferDetached())
|
|
1037
|
+
throw new Error("Buffer is detached!");
|
|
1038
|
+
(!this.#t || this.#t.length !== f) && (this.#t = new Uint8ClampedArray(f));
|
|
1039
|
+
const g = this.#a;
|
|
1040
|
+
g.bindTexture(g.TEXTURE_2D, this.#r), g.texImage2D(g.TEXTURE_2D, 0, g.RGBA, g.RGBA, g.UNSIGNED_BYTE, e), g.bindFramebuffer(g.FRAMEBUFFER, this.#n);
|
|
1041
|
+
try {
|
|
1042
|
+
g.pixelStorei(g.PACK_ALIGNMENT, this.#u), g.readPixels(o, i, l, c, g.RGBA, g.UNSIGNED_BYTE, this.#t);
|
|
1043
|
+
} catch (y) {
|
|
1044
|
+
if (this.#u !== 1) {
|
|
1045
|
+
this.#u = 1, g.pixelStorei(g.PACK_ALIGNMENT, 1);
|
|
1046
|
+
const u = new Uint8ClampedArray(f);
|
|
1047
|
+
return g.readPixels(0, 0, l, c, g.RGBA, g.UNSIGNED_BYTE, u), this.#t = u, new ImageData(u, l, c);
|
|
1048
|
+
}
|
|
1049
|
+
throw y;
|
|
1050
|
+
}
|
|
1051
|
+
return new ImageData(this.#t, l, c);
|
|
1052
|
+
}
|
|
1053
|
+
/**
|
|
1054
|
+
* Update canvas dimensions if needed
|
|
1055
|
+
*
|
|
1056
|
+
* This canvas is the orientation-aware
|
|
1057
|
+
*/
|
|
1058
|
+
#c(e, t) {
|
|
1059
|
+
if (this.#s !== e || this.#l !== t) {
|
|
1060
|
+
this.#e.width = e, this.#e.height = t, this.#s = e, this.#l = t;
|
|
1061
|
+
const a = e * t * 4;
|
|
1062
|
+
this.#t = new Uint8ClampedArray(a);
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
/**
|
|
1066
|
+
* Clean up resources
|
|
1067
|
+
*/
|
|
1068
|
+
dispose() {
|
|
1069
|
+
this.#a && (this.#r && (this.#a.deleteTexture(this.#r), this.#r = null), this.#n && (this.#a.deleteFramebuffer(this.#n), this.#n = null)), this.#o = null, this.#a = null, this.#t = null;
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
const $e = (r) => ArrayBuffer.isView(r) ? r.buffer : r, $t = {
|
|
1073
|
+
mirrorFrontCameras: !0
|
|
609
1074
|
};
|
|
610
|
-
class
|
|
611
|
-
// TODO: should these be in zustand?
|
|
612
|
-
#r = "FHD";
|
|
1075
|
+
class Qr {
|
|
613
1076
|
#e;
|
|
1077
|
+
#o = "4k";
|
|
614
1078
|
#a;
|
|
1079
|
+
#r;
|
|
615
1080
|
#n;
|
|
1081
|
+
#t;
|
|
1082
|
+
#s;
|
|
1083
|
+
/**
|
|
1084
|
+
* If true, the user has initiated an abort. This will prevent the
|
|
1085
|
+
* CameraManager from throwing errors when the user interrupts the process.
|
|
1086
|
+
*/
|
|
1087
|
+
#l = !1;
|
|
1088
|
+
get userInitiatedAbort() {
|
|
1089
|
+
return this.#l;
|
|
1090
|
+
}
|
|
1091
|
+
set userInitiatedAbort(e) {
|
|
1092
|
+
this.#l = e;
|
|
1093
|
+
}
|
|
1094
|
+
/**
|
|
1095
|
+
* Sets the area of the video frame that will be extracted.
|
|
1096
|
+
* @param extractionArea The area of the video frame that will be extracted.
|
|
1097
|
+
*/
|
|
1098
|
+
setExtractionArea(e) {
|
|
1099
|
+
this.#a = e;
|
|
1100
|
+
}
|
|
616
1101
|
/**
|
|
617
1102
|
* Callbacks that will be triggered on each frame when the playback state is
|
|
618
1103
|
* "capturing".
|
|
619
1104
|
*/
|
|
620
|
-
#
|
|
1105
|
+
#i = /* @__PURE__ */ new Set();
|
|
1106
|
+
constructor(e = {}, t) {
|
|
1107
|
+
const { mirrorFrontCameras: a } = {
|
|
1108
|
+
...$t,
|
|
1109
|
+
...e
|
|
1110
|
+
};
|
|
1111
|
+
this.#n = new At(
|
|
1112
|
+
t
|
|
1113
|
+
), this.#t = a;
|
|
1114
|
+
}
|
|
621
1115
|
/**
|
|
622
1116
|
* Sets the resolution of the camera stream
|
|
623
1117
|
*/
|
|
624
1118
|
setResolution = async (e) => {
|
|
625
|
-
this.#
|
|
626
|
-
const
|
|
627
|
-
|
|
1119
|
+
this.#o = e;
|
|
1120
|
+
const t = this.getState().playbackState;
|
|
1121
|
+
t !== "idle" && (this.#e = t, this.stopStream(), await this.startCameraStream());
|
|
628
1122
|
};
|
|
629
1123
|
get resolution() {
|
|
630
|
-
return this.#
|
|
1124
|
+
return this.#o;
|
|
631
1125
|
}
|
|
632
1126
|
/**
|
|
633
1127
|
* True if there is a video playing or capturing
|
|
@@ -645,18 +1139,17 @@ class gr {
|
|
|
645
1139
|
* Returns the cameras that are available to the user, filtered by the facing mode.
|
|
646
1140
|
* If no facing mode is set, all cameras are returned.
|
|
647
1141
|
*/
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
(o) => r.includes(o.facingMode)
|
|
1142
|
+
async getCameraDevices() {
|
|
1143
|
+
let e = d.getState().cameras;
|
|
1144
|
+
const t = d.getState().facingFilter;
|
|
1145
|
+
return e.length || await this.refreshCameraDevices(), e = d.getState().cameras, t ? e.filter(
|
|
1146
|
+
(n) => t.includes(n.facingMode)
|
|
654
1147
|
) : e;
|
|
655
1148
|
}
|
|
656
1149
|
/**
|
|
657
1150
|
* Single-time setup for a video element
|
|
658
1151
|
*/
|
|
659
|
-
|
|
1152
|
+
#u(e) {
|
|
660
1153
|
if (!(e instanceof HTMLVideoElement))
|
|
661
1154
|
throw new Error(
|
|
662
1155
|
`Expected an HTMLVideoElement, got ${typeof e}`,
|
|
@@ -667,7 +1160,7 @@ class gr {
|
|
|
667
1160
|
d.setState({
|
|
668
1161
|
videoElement: e
|
|
669
1162
|
});
|
|
670
|
-
const
|
|
1163
|
+
const t = Rt(e, (i) => {
|
|
671
1164
|
[
|
|
672
1165
|
"abort"
|
|
673
1166
|
// "error",
|
|
@@ -688,25 +1181,50 @@ class gr {
|
|
|
688
1181
|
// "ratechange",
|
|
689
1182
|
// "durationchange",
|
|
690
1183
|
].forEach((c) => {
|
|
691
|
-
|
|
1184
|
+
i(c, () => {
|
|
692
1185
|
console.debug(`Video event: ${c}`);
|
|
693
1186
|
});
|
|
694
1187
|
});
|
|
695
1188
|
});
|
|
696
|
-
new
|
|
697
|
-
|
|
1189
|
+
new N((i) => {
|
|
1190
|
+
i[0].connected || this.releaseVideoElement();
|
|
698
1191
|
}).observe(e), e.setAttribute("playsInline", ""), e.setAttribute("muted", ""), e.controls = !1;
|
|
699
|
-
|
|
1192
|
+
let n = "idle";
|
|
1193
|
+
const o = Mt(
|
|
700
1194
|
document,
|
|
701
1195
|
"visibilitychange",
|
|
702
|
-
() => {
|
|
703
|
-
document.hidden
|
|
1196
|
+
async () => {
|
|
1197
|
+
if (document.hidden) {
|
|
1198
|
+
n = d.getState().playbackState, this.stopStream();
|
|
1199
|
+
return;
|
|
1200
|
+
}
|
|
1201
|
+
switch (n) {
|
|
1202
|
+
case "playback":
|
|
1203
|
+
await this.startCameraStream(), await this.startPlayback();
|
|
1204
|
+
break;
|
|
1205
|
+
case "capturing":
|
|
1206
|
+
await this.startCameraStream(), await this.startFrameCapture();
|
|
1207
|
+
break;
|
|
1208
|
+
}
|
|
704
1209
|
}
|
|
705
1210
|
);
|
|
706
|
-
this.#
|
|
707
|
-
o(),
|
|
1211
|
+
this.#s = () => {
|
|
1212
|
+
o(), t();
|
|
708
1213
|
};
|
|
709
1214
|
}
|
|
1215
|
+
/**
|
|
1216
|
+
* Initializes the CameraManager with a video element.
|
|
1217
|
+
*/
|
|
1218
|
+
initVideoElement(e) {
|
|
1219
|
+
try {
|
|
1220
|
+
this.#u(e);
|
|
1221
|
+
} catch (t) {
|
|
1222
|
+
if (this.userInitiatedAbort)
|
|
1223
|
+
this.reset();
|
|
1224
|
+
else
|
|
1225
|
+
throw t;
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
710
1228
|
/**
|
|
711
1229
|
* Adds a callback that will be triggered on each frame when the playback state
|
|
712
1230
|
* is "capturing".
|
|
@@ -715,19 +1233,21 @@ class gr {
|
|
|
715
1233
|
* @returns a cleanup function to remove the callback
|
|
716
1234
|
*/
|
|
717
1235
|
addFrameCaptureCallback(e) {
|
|
718
|
-
return this.#
|
|
1236
|
+
return this.#i.add(e), () => this.#i.delete(e);
|
|
719
1237
|
}
|
|
720
|
-
|
|
721
|
-
this.#
|
|
1238
|
+
releaseVideoElement() {
|
|
1239
|
+
this.#s?.(), d.setState({
|
|
722
1240
|
videoElement: void 0
|
|
723
1241
|
}), this.stopStream();
|
|
724
1242
|
}
|
|
725
1243
|
/**
|
|
726
1244
|
* Select a camera device from available ones.
|
|
1245
|
+
*
|
|
1246
|
+
* TODO: might become a private method in the future as an implementation detail of `startStream`
|
|
727
1247
|
*/
|
|
728
1248
|
async selectCamera(e) {
|
|
729
|
-
const
|
|
730
|
-
|
|
1249
|
+
const t = d.getState().playbackState;
|
|
1250
|
+
t !== "idle" && (this.#e = t);
|
|
731
1251
|
const a = d.getState();
|
|
732
1252
|
if (a.selectedCamera === e) {
|
|
733
1253
|
console.debug("Already selected");
|
|
@@ -755,9 +1275,14 @@ class gr {
|
|
|
755
1275
|
d.setState({
|
|
756
1276
|
isQueryingCameras: !0
|
|
757
1277
|
});
|
|
758
|
-
const e = await
|
|
759
|
-
|
|
760
|
-
|
|
1278
|
+
const e = await ct().catch((a) => {
|
|
1279
|
+
throw d.setState({
|
|
1280
|
+
errorState: X(a),
|
|
1281
|
+
isQueryingCameras: !1
|
|
1282
|
+
}), a;
|
|
1283
|
+
}), t = ht(e);
|
|
1284
|
+
t.forEach((a) => {
|
|
1285
|
+
a.notifyStateChange || (a.notifyStateChange = (n, o) => {
|
|
761
1286
|
window.queueMicrotask(() => {
|
|
762
1287
|
d.setState({
|
|
763
1288
|
cameras: [...d.getState().cameras]
|
|
@@ -765,15 +1290,15 @@ class gr {
|
|
|
765
1290
|
const i = d.getState().selectedCamera;
|
|
766
1291
|
if (!i)
|
|
767
1292
|
return;
|
|
768
|
-
let
|
|
769
|
-
typeof
|
|
1293
|
+
let l;
|
|
1294
|
+
typeof o == "object" && o !== null && "payload" in o && o.payload === "TRACK_END" && (l = new Error("Camera stream ended unexpectedly")), n === i && d.setState({
|
|
770
1295
|
selectedCamera: i,
|
|
771
|
-
errorState:
|
|
1296
|
+
errorState: l
|
|
772
1297
|
});
|
|
773
1298
|
});
|
|
774
1299
|
});
|
|
775
1300
|
}), d.setState({
|
|
776
|
-
cameras:
|
|
1301
|
+
cameras: t,
|
|
777
1302
|
isQueryingCameras: !1
|
|
778
1303
|
});
|
|
779
1304
|
}
|
|
@@ -794,28 +1319,30 @@ class gr {
|
|
|
794
1319
|
return;
|
|
795
1320
|
}
|
|
796
1321
|
if (!e.selectedCamera.activeStream) {
|
|
797
|
-
const
|
|
798
|
-
e.videoElement.srcObject =
|
|
1322
|
+
const t = await e.selectedCamera.startStream(this.resolution);
|
|
1323
|
+
e.videoElement.srcObject = t;
|
|
799
1324
|
}
|
|
800
1325
|
try {
|
|
801
|
-
await e.videoElement.play(), d.setState({
|
|
1326
|
+
this.#f(), await e.videoElement.play(), d.setState({
|
|
802
1327
|
playbackState: "playback"
|
|
803
1328
|
});
|
|
804
|
-
} catch (
|
|
805
|
-
throw console.error("Failed to start playback",
|
|
806
|
-
errorState:
|
|
807
|
-
}),
|
|
1329
|
+
} catch (t) {
|
|
1330
|
+
throw console.error("Failed to start playback", t), d.setState({
|
|
1331
|
+
errorState: X(t)
|
|
1332
|
+
}), t;
|
|
808
1333
|
}
|
|
809
1334
|
}
|
|
810
1335
|
}
|
|
811
1336
|
/**
|
|
812
1337
|
* Starts playback and frame capturing.
|
|
813
1338
|
*/
|
|
814
|
-
async
|
|
1339
|
+
async #d() {
|
|
815
1340
|
const e = d.getState();
|
|
816
|
-
if (!(e.playbackState === "capturing" && this.#e !== "capturing")) {
|
|
1341
|
+
if (!this.userInitiatedAbort && !(e.playbackState === "capturing" && this.#e !== "capturing")) {
|
|
817
1342
|
if (!e.videoElement) {
|
|
818
|
-
console.warn(
|
|
1343
|
+
console.warn(
|
|
1344
|
+
"Missing video element. Setup a video element first using `initVideoElement`"
|
|
1345
|
+
);
|
|
819
1346
|
return;
|
|
820
1347
|
}
|
|
821
1348
|
if (!e.selectedCamera) {
|
|
@@ -826,23 +1353,29 @@ class gr {
|
|
|
826
1353
|
}
|
|
827
1354
|
await this.startPlayback(), d.setState({
|
|
828
1355
|
playbackState: "capturing"
|
|
829
|
-
}), this.#
|
|
830
|
-
() => void this.#o()
|
|
831
|
-
), this.#e = void 0;
|
|
1356
|
+
}), this.#c(), this.#e = void 0;
|
|
832
1357
|
}
|
|
833
1358
|
}
|
|
834
1359
|
/**
|
|
835
|
-
* Starts
|
|
836
|
-
* none is selected.
|
|
837
|
-
* TODO: Rename method
|
|
1360
|
+
* Starts capturing frames from the video element.
|
|
838
1361
|
*/
|
|
839
|
-
async
|
|
1362
|
+
startFrameCapture = async () => {
|
|
1363
|
+
try {
|
|
1364
|
+
await this.#d();
|
|
1365
|
+
} catch (e) {
|
|
1366
|
+
if (this.userInitiatedAbort)
|
|
1367
|
+
this.reset();
|
|
1368
|
+
else
|
|
1369
|
+
throw e;
|
|
1370
|
+
}
|
|
1371
|
+
};
|
|
1372
|
+
async #h({
|
|
840
1373
|
autoplay: e = !0,
|
|
841
|
-
preferredCamera:
|
|
1374
|
+
preferredCamera: t,
|
|
842
1375
|
preferredFacing: a
|
|
843
1376
|
} = {}) {
|
|
844
|
-
const
|
|
845
|
-
if (!
|
|
1377
|
+
const n = d.getState().videoElement;
|
|
1378
|
+
if (!n) {
|
|
846
1379
|
console.warn("Can't start stream without a video element");
|
|
847
1380
|
return;
|
|
848
1381
|
}
|
|
@@ -850,584 +1383,445 @@ class gr {
|
|
|
850
1383
|
console.warn("Already streaming");
|
|
851
1384
|
return;
|
|
852
1385
|
}
|
|
853
|
-
|
|
854
|
-
const n = () => d.getState().cameras.length > 0;
|
|
855
|
-
if (!d.getState().selectedCamera) {
|
|
856
|
-
console.debug("Searching for a best camera");
|
|
1386
|
+
if (t instanceof Me && await this.selectCamera(t), !d.getState().selectedCamera)
|
|
857
1387
|
try {
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
1388
|
+
const l = await this.getCameraDevices();
|
|
1389
|
+
let c;
|
|
1390
|
+
if (!l.length)
|
|
1391
|
+
throw console.log("Camera list is empty"), new Error(
|
|
1392
|
+
`No cameras found matching the filter ${a}`
|
|
1393
|
+
);
|
|
1394
|
+
if (typeof t == "function" && (c = t(l), c || console.warn(
|
|
1395
|
+
"No camera found matching the preferred camera function, falling back to facing mode"
|
|
1396
|
+
)), c || (c = await dt(
|
|
1397
|
+
l,
|
|
862
1398
|
this.resolution,
|
|
863
1399
|
a
|
|
864
|
-
)
|
|
865
|
-
|
|
866
|
-
|
|
1400
|
+
)), !c)
|
|
1401
|
+
throw new Error(
|
|
1402
|
+
`No cameras found matching the filter ${a}`
|
|
1403
|
+
);
|
|
1404
|
+
await this.selectCamera(c), this.#m() && d.setState({
|
|
1405
|
+
errorState: void 0
|
|
1406
|
+
});
|
|
1407
|
+
} catch (l) {
|
|
867
1408
|
throw d.setState({
|
|
868
|
-
errorState:
|
|
869
|
-
}),
|
|
1409
|
+
errorState: X(l)
|
|
1410
|
+
}), l;
|
|
870
1411
|
}
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
if (!i)
|
|
1412
|
+
const o = d.getState().selectedCamera;
|
|
1413
|
+
if (!o)
|
|
874
1414
|
throw console.warn("No selected camera!"), new Error("No selected camera");
|
|
875
|
-
const
|
|
876
|
-
if (!
|
|
1415
|
+
const i = await o.startStream(this.#o);
|
|
1416
|
+
if (!n.isConnected)
|
|
877
1417
|
throw new Error("Video element needs to be in the document!");
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
// devices don't return a facing mode and that they are front-facing.
|
|
881
|
-
mirrorX: i.facingMode !== "back",
|
|
882
|
-
videoElement: o
|
|
1418
|
+
n.srcObject = i, d.setState({
|
|
1419
|
+
videoElement: n
|
|
883
1420
|
}), e && await this.startPlayback();
|
|
884
1421
|
}
|
|
885
1422
|
/**
|
|
886
|
-
*
|
|
887
|
-
|
|
888
|
-
stopFrameCapture() {
|
|
889
|
-
d.setState({
|
|
890
|
-
playbackState: "playback"
|
|
891
|
-
});
|
|
892
|
-
}
|
|
893
|
-
/**
|
|
894
|
-
* Stops the currently active stream. Also stops the video playback and capturing process.
|
|
895
|
-
*/
|
|
896
|
-
stopStream() {
|
|
897
|
-
console.debug("stopStream called");
|
|
898
|
-
const e = d.getState();
|
|
899
|
-
this.pausePlayback(), e.selectedCamera?.stopStream(), e.videoElement && (e.videoElement.srcObject = null);
|
|
900
|
-
}
|
|
901
|
-
/**
|
|
902
|
-
* Pauses the video playback. This will also stop the capturing process.
|
|
903
|
-
*/
|
|
904
|
-
pausePlayback() {
|
|
905
|
-
console.debug("pausePlayback called");
|
|
906
|
-
const e = d.getState().videoElement;
|
|
907
|
-
d.setState({
|
|
908
|
-
playbackState: "idle"
|
|
909
|
-
}), e && (this.#a && e.cancelVideoFrameCallback(this.#a), e.pause());
|
|
910
|
-
}
|
|
911
|
-
/**
|
|
912
|
-
* The main recognition loop
|
|
913
|
-
* @private
|
|
914
|
-
* @internal
|
|
1423
|
+
* Starts a best-effort camera stream. Will pick a camera automatically if
|
|
1424
|
+
* none is selected.
|
|
915
1425
|
*/
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
const r = dt(e.videoElement);
|
|
925
|
-
this.#t.forEach((a) => {
|
|
926
|
-
a(r);
|
|
927
|
-
});
|
|
928
|
-
}
|
|
929
|
-
this.#a = e.videoElement.requestVideoFrameCallback(
|
|
930
|
-
() => void this.#o()
|
|
931
|
-
);
|
|
1426
|
+
async startCameraStream(e = {}) {
|
|
1427
|
+
try {
|
|
1428
|
+
await this.#h(e);
|
|
1429
|
+
} catch (t) {
|
|
1430
|
+
if (this.userInitiatedAbort)
|
|
1431
|
+
this.reset();
|
|
1432
|
+
else
|
|
1433
|
+
throw t;
|
|
932
1434
|
}
|
|
933
1435
|
}
|
|
1436
|
+
#m = () => {
|
|
1437
|
+
const e = d.getState().errorState;
|
|
1438
|
+
return e instanceof Te && e.code === "PERMISSION_DENIED";
|
|
1439
|
+
};
|
|
934
1440
|
/**
|
|
935
|
-
*
|
|
936
|
-
* TODO: apply when needed
|
|
1441
|
+
* Pauses capturing frames without pausing playback.
|
|
937
1442
|
*/
|
|
938
|
-
|
|
1443
|
+
stopFrameCapture() {
|
|
939
1444
|
d.setState({
|
|
940
|
-
|
|
1445
|
+
playbackState: "playback"
|
|
941
1446
|
});
|
|
942
1447
|
}
|
|
943
|
-
// The "typeof" is necessary to avoid a circular dependency when resolving types
|
|
944
|
-
/**
|
|
945
|
-
* Allows the user to subscribe to state changes inside the Camera Manager.
|
|
946
|
-
* Implemented using Zustand. For usage information, see
|
|
947
|
-
* {@link https://github.com/pmndrs/zustand#using-subscribe-with-selector}
|
|
948
|
-
*/
|
|
949
|
-
subscribe = d.subscribe;
|
|
950
1448
|
/**
|
|
951
|
-
*
|
|
952
|
-
*/
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
destroy() {
|
|
958
|
-
console.debug("Destroying camera manager"), this.#t.clear(), je();
|
|
959
|
-
}
|
|
960
|
-
}
|
|
961
|
-
const mt = [
|
|
962
|
-
"Cameră dublă cu obiectiv superangular spate",
|
|
963
|
-
"מצלמה כפולה רחבה אחורית",
|
|
964
|
-
"Артқы қос кең бұрышты камера",
|
|
965
|
-
"Câmara grande angular dupla traseira",
|
|
966
|
-
"Πίσω διπλή ευρεία κάμερα",
|
|
967
|
-
"後置雙廣角鏡頭相機",
|
|
968
|
-
"Задна двойна широкоъгълна камера",
|
|
969
|
-
"Càmera dual posterior amb gran angular",
|
|
970
|
-
"Zadná duálna širokouhlá kamera",
|
|
971
|
-
"كاميرا خلفية مزدوجة عريضة",
|
|
972
|
-
"Задняя двойная широкоугольная камера",
|
|
973
|
-
"Задня здвоєна ширококутна камера",
|
|
974
|
-
"Cámara amplia posterior doble",
|
|
975
|
-
"Dwikamera Lebar Belakang",
|
|
976
|
-
"Tylny dwuobiektywowy aparat szerokokątny",
|
|
977
|
-
"Dubbel vidvinkelkamera på baksidan",
|
|
978
|
-
"Back Dual Wide Camera",
|
|
979
|
-
"Hátsó, kettős, széles látószögű kamera",
|
|
980
|
-
"후면 듀얼 와이드 카메라",
|
|
981
|
-
"Double caméra grand angle arrière",
|
|
982
|
-
"Fotocamera doppia con grandangolo (posteriore)",
|
|
983
|
-
"Double appareil photo grand angle arrière",
|
|
984
|
-
"Zadní duální širokoúhlý fotoaparát",
|
|
985
|
-
"Çift Geniş Kamera Arka Yüzü",
|
|
986
|
-
"Laajakulmainen kaksoistakakamera",
|
|
987
|
-
"Rückseitige Dual-Weitwinkelkamera",
|
|
988
|
-
"बैक ड्युअल वाइड कैमरा",
|
|
989
|
-
"后置双广角镜头",
|
|
990
|
-
"Câmera Dupla Grande-Angular Traseira",
|
|
991
|
-
"後置雙廣角相機",
|
|
992
|
-
"กล้องคู่ด้านหลังมุมกว้าง",
|
|
993
|
-
"Kamera Lebar Belakang Ganda",
|
|
994
|
-
"Dobbelt vidvinkelkamera bak",
|
|
995
|
-
"Camera kép rộng mặt sau",
|
|
996
|
-
"Cámara trasera dual con gran angular",
|
|
997
|
-
"背面デュアル広角カメラ",
|
|
998
|
-
"Stražnja dvostruka široka kamera"
|
|
999
|
-
], ft = async () => {
|
|
1000
|
-
try {
|
|
1001
|
-
const t = await navigator.mediaDevices.getUserMedia({
|
|
1002
|
-
video: !0
|
|
1003
|
-
});
|
|
1004
|
-
Ce(t);
|
|
1005
|
-
} catch (t) {
|
|
1006
|
-
throw console.error(t), new Error("Camera permission not given", {
|
|
1007
|
-
cause: t
|
|
1008
|
-
});
|
|
1009
|
-
}
|
|
1010
|
-
}, ht = async () => {
|
|
1011
|
-
if (!isSecureContext)
|
|
1012
|
-
throw new Error(Ze`
|
|
1013
|
-
Cameras can only be used in a secure context:
|
|
1014
|
-
https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts
|
|
1015
|
-
`);
|
|
1016
|
-
return await ft(), (await navigator.mediaDevices.enumerateDevices()).filter((r) => r.kind === "videoinput");
|
|
1017
|
-
}, Ce = (t) => {
|
|
1018
|
-
const e = t.getTracks();
|
|
1019
|
-
for (const r of e)
|
|
1020
|
-
r.stop();
|
|
1021
|
-
}, gt = (t, e, r) => ({
|
|
1022
|
-
video: {
|
|
1023
|
-
deviceId: r ? { exact: r } : void 0,
|
|
1024
|
-
frameRate: 30,
|
|
1025
|
-
width: ie[t].width,
|
|
1026
|
-
height: ie[t].height,
|
|
1027
|
-
facingMode: e
|
|
1028
|
-
},
|
|
1029
|
-
audio: !1
|
|
1030
|
-
}), pt = async (t, e = "FHD", r = "back") => {
|
|
1031
|
-
if (t.length === 0)
|
|
1032
|
-
throw new Error("No cameras found");
|
|
1033
|
-
if (r === "back") {
|
|
1034
|
-
const n = t.find(
|
|
1035
|
-
(i) => mt.includes(i.name)
|
|
1036
|
-
);
|
|
1037
|
-
if (n)
|
|
1038
|
-
return await n.startStream(e), n;
|
|
1039
|
-
}
|
|
1040
|
-
const a = t.filter((n) => r === "back" || r === void 0 ? be(n.name) : ve(n.name));
|
|
1041
|
-
if (a.length !== 0 && r === "front") {
|
|
1042
|
-
const n = a[a.length - 1];
|
|
1043
|
-
return await n.startStream(e), n;
|
|
1044
|
-
}
|
|
1045
|
-
console.debug(`Found ${a.length} cameras with requested facing`), a.length === 0 && (console.debug("No camera found with requested facing, using all cameras"), a.push(...t));
|
|
1046
|
-
const o = /* @__PURE__ */ new Map();
|
|
1047
|
-
t.forEach((n) => o.set(n, 0));
|
|
1048
|
-
for (let n = a.length - 1; n >= 0; n--) {
|
|
1049
|
-
const i = a[n];
|
|
1050
|
-
if (await i.startStream(e), !i.facingMode)
|
|
1051
|
-
return console.debug("No facing mode, returning last camera"), i;
|
|
1052
|
-
if (i.facingMode && i.facingMode !== r) {
|
|
1053
|
-
console.debug("Mismatched facing mode, moving on to the next camera"), i.stopStream();
|
|
1054
|
-
continue;
|
|
1055
|
-
}
|
|
1056
|
-
if (i.torchSupported && i.singleShotSupported)
|
|
1057
|
-
return console.debug("Camera supports torch and single shot, returning"), i;
|
|
1058
|
-
if (i.torchSupported && o.set(i, o.get(i) + 1), i.singleShotSupported && o.set(i, o.get(i) + 1), n === 0) {
|
|
1059
|
-
console.debug("Last camera in the pool, picking the best one");
|
|
1060
|
-
let c, f = -1 / 0;
|
|
1061
|
-
return o.forEach((g, m) => {
|
|
1062
|
-
g > f && (f = g, c = m);
|
|
1063
|
-
}), c;
|
|
1064
|
-
}
|
|
1065
|
-
i.stopStream();
|
|
1066
|
-
}
|
|
1067
|
-
throw new Error("No camera found, should not happen");
|
|
1068
|
-
};
|
|
1069
|
-
function bt(t) {
|
|
1070
|
-
const e = [];
|
|
1071
|
-
for (const r of t) {
|
|
1072
|
-
const a = new vt(r);
|
|
1073
|
-
a !== null && e.push(a);
|
|
1449
|
+
* Stops the currently active stream. Also stops the video playback and capturing process.
|
|
1450
|
+
*/
|
|
1451
|
+
stopStream() {
|
|
1452
|
+
console.debug("stopStream called");
|
|
1453
|
+
const e = d.getState();
|
|
1454
|
+
this.pausePlayback(), e.selectedCamera?.stopStream(), e.videoElement && (e.videoElement.srcObject = null);
|
|
1074
1455
|
}
|
|
1075
|
-
return e;
|
|
1076
|
-
}
|
|
1077
|
-
class vt {
|
|
1078
|
-
deviceInfo;
|
|
1079
1456
|
/**
|
|
1080
|
-
*
|
|
1081
|
-
*
|
|
1082
|
-
* On iOS it's the same as `deviceCapabilities`. Firefox is only reporting
|
|
1083
|
-
* rudimentary capabilities, so we can't rely on this for picking the right
|
|
1084
|
-
* camera.
|
|
1085
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack/getCapabilities
|
|
1457
|
+
* Pauses the video playback. This will also stop the capturing process.
|
|
1086
1458
|
*/
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
original = this;
|
|
1095
|
-
notify;
|
|
1096
|
-
notifyStateChange;
|
|
1459
|
+
pausePlayback() {
|
|
1460
|
+
console.debug("pausePlayback called");
|
|
1461
|
+
const e = d.getState().videoElement;
|
|
1462
|
+
d.setState({
|
|
1463
|
+
playbackState: "idle"
|
|
1464
|
+
}), e && (this.#r && e.cancelVideoFrameCallback(this.#r), e.pause());
|
|
1465
|
+
}
|
|
1097
1466
|
/**
|
|
1098
|
-
*
|
|
1099
|
-
*
|
|
1100
|
-
* Not available on Firefox.
|
|
1101
|
-
* Chrome doesn't report the torch capability, so we have to check for it on the stream.
|
|
1102
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/InputDeviceInfo/getCapabilities
|
|
1103
|
-
*
|
|
1104
|
-
* @deprecated Not used. Reconsider using once Firefox and Chrome align on this.
|
|
1467
|
+
* The main recognition loop. Do not call this method directly, use #queueFrame instead.
|
|
1105
1468
|
*/
|
|
1106
|
-
#
|
|
1107
|
-
|
|
1108
|
-
if (
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1469
|
+
async #g() {
|
|
1470
|
+
const e = d.getState();
|
|
1471
|
+
if (this.#r === void 0) {
|
|
1472
|
+
console.error("Missing request ID");
|
|
1473
|
+
return;
|
|
1474
|
+
}
|
|
1475
|
+
if (!e.videoElement) {
|
|
1476
|
+
console.warn("Missing video element, should not happen");
|
|
1477
|
+
return;
|
|
1478
|
+
}
|
|
1479
|
+
if (!(e.videoElement.videoHeight >= e.videoElement.videoWidth == this.#a.height >= this.#a.width))
|
|
1480
|
+
return this.#c();
|
|
1481
|
+
if (this.#i.size !== 0) {
|
|
1482
|
+
const a = this.#n.getImageData(
|
|
1483
|
+
e.videoElement,
|
|
1484
|
+
this.#a
|
|
1485
|
+
);
|
|
1486
|
+
for (const n of this.#i) {
|
|
1487
|
+
const o = ne(a.data) ? this.#n.getCurrentImageData() : a, i = await n(o);
|
|
1488
|
+
if (i) {
|
|
1489
|
+
if (!(i instanceof ArrayBuffer))
|
|
1490
|
+
throw new Error(
|
|
1491
|
+
_e`
|
|
1492
|
+
Frame capture callback did not return an ArrayBuffer.
|
|
1493
|
+
Make sure to return the underlying buffer, not the view.
|
|
1494
|
+
`
|
|
1495
|
+
);
|
|
1496
|
+
this.#n.reattachArrayBuffer(i);
|
|
1497
|
+
}
|
|
1119
1498
|
}
|
|
1120
|
-
}
|
|
1121
|
-
|
|
1122
|
-
this.notifyStateChange?.(a, o);
|
|
1123
|
-
}, a;
|
|
1124
|
-
}
|
|
1125
|
-
async startStream(e) {
|
|
1126
|
-
if (this.activeStream)
|
|
1127
|
-
return this.activeStream;
|
|
1128
|
-
const r = gt(
|
|
1129
|
-
e,
|
|
1130
|
-
this.facingMode,
|
|
1131
|
-
this.deviceInfo.deviceId
|
|
1132
|
-
), a = await navigator.mediaDevices.getUserMedia(r);
|
|
1133
|
-
this.streamCapabilities = a.getVideoTracks()[0].getCapabilities(), this.activeStream = a;
|
|
1134
|
-
const o = a.getVideoTracks()[0];
|
|
1135
|
-
return "torch" in this.streamCapabilities && (this.torchSupported = !0), "focusMode" in this.streamCapabilities && this.streamCapabilities.focusMode?.includes("single-shot") && (this.singleShotSupported = !0), this.facingMode === "front" && this.streamCapabilities.facingMode?.includes("environment") && (this.facingMode = "back", console.warn("Front camera selected, but facingMode is environment")), this.facingMode === "back" && this.streamCapabilities.facingMode?.includes("user") && (this.facingMode = "front", console.warn("Back camera selected, but facingMode is user")), this.facingMode || (this.streamCapabilities.facingMode?.includes("environment") && (this.facingMode = "back"), this.streamCapabilities.facingMode?.includes("user") && (this.facingMode = "front")), o.onended = (n) => {
|
|
1136
|
-
this.stopStream(), this.notify({
|
|
1137
|
-
event: n,
|
|
1138
|
-
payload: "TRACK_END"
|
|
1139
|
-
});
|
|
1140
|
-
}, a;
|
|
1499
|
+
}
|
|
1500
|
+
this.#c();
|
|
1141
1501
|
}
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
}), this.torchEnabled = !this.torchEnabled;
|
|
1156
|
-
} catch (r) {
|
|
1157
|
-
throw console.error("Failed to toggle torch", r), this.torchEnabled = !1, this.torchSupported = !1, new Error("Failed to toggle torch", { cause: r });
|
|
1502
|
+
/**
|
|
1503
|
+
* Queues the next frame to be processed
|
|
1504
|
+
*/
|
|
1505
|
+
#c() {
|
|
1506
|
+
const e = d.getState();
|
|
1507
|
+
if (e.playbackState === "capturing") {
|
|
1508
|
+
if (!e.videoElement) {
|
|
1509
|
+
console.warn("Missing video element, should not happen");
|
|
1510
|
+
return;
|
|
1511
|
+
}
|
|
1512
|
+
this.#r && e.videoElement.cancelVideoFrameCallback(this.#r), this.#r = e.videoElement.requestVideoFrameCallback(
|
|
1513
|
+
() => void this.#g()
|
|
1514
|
+
);
|
|
1158
1515
|
}
|
|
1159
|
-
return this.torchEnabled;
|
|
1160
1516
|
}
|
|
1161
|
-
|
|
1162
|
-
|
|
1517
|
+
/**
|
|
1518
|
+
* Applies a mirror effect to the video if the camera is front-facing.
|
|
1519
|
+
* Assumes that desktop devices don't return a facing mode and that they are front-facing.
|
|
1520
|
+
*/
|
|
1521
|
+
#f() {
|
|
1522
|
+
const e = d.getState().selectedCamera;
|
|
1523
|
+
if (!e) {
|
|
1524
|
+
console.warn("No camera selected");
|
|
1525
|
+
return;
|
|
1526
|
+
}
|
|
1527
|
+
this.#t && (e.facingMode !== "back" ? this.setCameraMirrorX(!0) : this.setCameraMirrorX(!1));
|
|
1163
1528
|
}
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1529
|
+
/**
|
|
1530
|
+
* If true, the video and captured frames will be mirrored horizontally.
|
|
1531
|
+
*/
|
|
1532
|
+
setCameraMirrorX(e) {
|
|
1533
|
+
const t = d.getState(), a = t.videoElement;
|
|
1534
|
+
if (!a) {
|
|
1535
|
+
console.warn("Mirror video - no video element present.");
|
|
1167
1536
|
return;
|
|
1168
1537
|
}
|
|
1169
|
-
|
|
1538
|
+
t.mirrorX !== e && (e ? a.style.scale = "-1 1" : a.style.removeProperty("scale"), d.setState({ mirrorX: e }));
|
|
1539
|
+
}
|
|
1540
|
+
// The "typeof" is necessary to avoid a circular dependency when resolving types
|
|
1541
|
+
/**
|
|
1542
|
+
* Allows the user to subscribe to state changes inside the Camera Manager.
|
|
1543
|
+
* Implemented using Zustand. For usage information, see
|
|
1544
|
+
* {@link https://github.com/pmndrs/zustand#using-subscribe-with-selector}
|
|
1545
|
+
*/
|
|
1546
|
+
subscribe = d.subscribe;
|
|
1547
|
+
/**
|
|
1548
|
+
* Gets the current internal state of the CameraManager.
|
|
1549
|
+
*/
|
|
1550
|
+
getState = d.getState;
|
|
1551
|
+
/**
|
|
1552
|
+
* Resets the CameraManager and stop all streams
|
|
1553
|
+
*/
|
|
1554
|
+
reset() {
|
|
1555
|
+
console.debug("Resetting camera manager"), this.#i.clear(), this.stopStream(), Ye();
|
|
1170
1556
|
}
|
|
1171
1557
|
}
|
|
1172
|
-
const
|
|
1558
|
+
const Fe = be();
|
|
1559
|
+
function Ft() {
|
|
1560
|
+
return we(d);
|
|
1561
|
+
}
|
|
1562
|
+
const Dt = (r) => {
|
|
1173
1563
|
const e = {
|
|
1174
|
-
cameraManagerSolidStore:
|
|
1564
|
+
cameraManagerSolidStore: Ft(),
|
|
1175
1565
|
// eslint-disable-next-line solid/reactivity
|
|
1176
|
-
cameraManager:
|
|
1566
|
+
cameraManager: r.cameraManager,
|
|
1177
1567
|
// eslint-disable-next-line solid/reactivity
|
|
1178
1568
|
dismountCameraUi: () => {
|
|
1179
|
-
|
|
1180
|
-
t.dismountCameraUi();
|
|
1181
|
-
}, 0);
|
|
1569
|
+
r.cameraManager.userInitiatedAbort = !0, r.dismountCameraUi();
|
|
1182
1570
|
},
|
|
1183
1571
|
// eslint-disable-next-line solid/reactivity
|
|
1184
|
-
|
|
1572
|
+
addOnDismountCallback: r.addOnDismountCallback,
|
|
1573
|
+
// eslint-disable-next-line solid/reactivity
|
|
1574
|
+
mountTarget: r.mountTarget,
|
|
1575
|
+
// eslint-disable-next-line solid/reactivity
|
|
1576
|
+
showMirrorCameraButton: r.showMirrorCameraButton
|
|
1185
1577
|
};
|
|
1186
|
-
return
|
|
1578
|
+
return ie(() => {
|
|
1187
1579
|
console.debug("CameraUiStoreProvider cleanup");
|
|
1188
|
-
}), s(
|
|
1580
|
+
}), s(Fe.Provider, {
|
|
1189
1581
|
value: e,
|
|
1190
1582
|
get children() {
|
|
1191
|
-
return
|
|
1583
|
+
return r.children;
|
|
1192
1584
|
}
|
|
1193
1585
|
});
|
|
1194
1586
|
};
|
|
1195
1587
|
function q() {
|
|
1196
|
-
const
|
|
1197
|
-
if (!
|
|
1588
|
+
const r = pe(Fe);
|
|
1589
|
+
if (!r)
|
|
1198
1590
|
throw new Error("StoreContext.Provider not in scope");
|
|
1199
|
-
return
|
|
1591
|
+
return r;
|
|
1200
1592
|
}
|
|
1201
|
-
const
|
|
1593
|
+
const It = {
|
|
1202
1594
|
selected_camera: "Selected camera",
|
|
1595
|
+
loading_cameras: "Loading cameras...",
|
|
1596
|
+
select_a_camera: "Select a camera",
|
|
1203
1597
|
select_camera: "Select camera",
|
|
1204
1598
|
close: "Close",
|
|
1205
1599
|
torch: "Torch",
|
|
1206
1600
|
mirror_camera: "Mirror camera",
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1601
|
+
scan_document: "Scan a document",
|
|
1602
|
+
camera_error_title: "Camera permission required",
|
|
1603
|
+
camera_error_details: "Please allow camera access in your browser and try again.",
|
|
1604
|
+
camera_error_cancel_btn: "Cancel",
|
|
1605
|
+
camera_error_primary_btn: "Retry"
|
|
1606
|
+
}, De = be(), zt = (r) => {
|
|
1607
|
+
const [e, t] = Xe(
|
|
1210
1608
|
// we structure clone to avoid proxying to the original object
|
|
1211
1609
|
structuredClone({
|
|
1212
|
-
...
|
|
1610
|
+
...It,
|
|
1213
1611
|
// we don't care on init
|
|
1214
1612
|
// eslint-disable-next-line solid/reactivity
|
|
1215
|
-
...
|
|
1613
|
+
...r.userStrings
|
|
1216
1614
|
})
|
|
1217
1615
|
);
|
|
1218
|
-
|
|
1219
|
-
|
|
1616
|
+
Q(() => {
|
|
1617
|
+
r.setLocalizationRef(t);
|
|
1220
1618
|
});
|
|
1221
1619
|
const a = {
|
|
1222
1620
|
t: e,
|
|
1223
|
-
updateLocalization:
|
|
1621
|
+
updateLocalization: t
|
|
1224
1622
|
};
|
|
1225
|
-
return s(
|
|
1623
|
+
return s(De.Provider, {
|
|
1226
1624
|
value: a,
|
|
1227
1625
|
get children() {
|
|
1228
|
-
return
|
|
1626
|
+
return r.children;
|
|
1229
1627
|
}
|
|
1230
1628
|
});
|
|
1231
1629
|
};
|
|
1232
|
-
function
|
|
1233
|
-
const
|
|
1234
|
-
if (!
|
|
1630
|
+
function Y() {
|
|
1631
|
+
const r = pe(De);
|
|
1632
|
+
if (!r)
|
|
1235
1633
|
throw new Error("LocalizationContext.Provider not in scope.");
|
|
1236
|
-
return
|
|
1634
|
+
return r;
|
|
1237
1635
|
}
|
|
1238
|
-
var
|
|
1239
|
-
const
|
|
1240
|
-
const [e,
|
|
1241
|
-
return
|
|
1242
|
-
const
|
|
1243
|
-
|
|
1244
|
-
}), s(
|
|
1636
|
+
var Lt = /* @__PURE__ */ S("<span>");
|
|
1637
|
+
const J = (r) => {
|
|
1638
|
+
const [e, t] = z(), [a, n] = z();
|
|
1639
|
+
return Q(() => {
|
|
1640
|
+
const o = a();
|
|
1641
|
+
o && t(o.getRootNode());
|
|
1642
|
+
}), s(E, {
|
|
1245
1643
|
get when() {
|
|
1246
1644
|
return e();
|
|
1247
1645
|
},
|
|
1248
1646
|
get fallback() {
|
|
1249
1647
|
return (() => {
|
|
1250
|
-
var
|
|
1251
|
-
return
|
|
1648
|
+
var o = Lt();
|
|
1649
|
+
return O(n, o), o;
|
|
1252
1650
|
})();
|
|
1253
1651
|
},
|
|
1254
|
-
children: (
|
|
1255
|
-
value: () =>
|
|
1652
|
+
children: (o) => s(Ke, {
|
|
1653
|
+
value: () => o(),
|
|
1256
1654
|
get children() {
|
|
1257
|
-
return
|
|
1655
|
+
return r.children(o());
|
|
1258
1656
|
}
|
|
1259
1657
|
})
|
|
1260
1658
|
});
|
|
1261
1659
|
};
|
|
1262
|
-
var
|
|
1263
|
-
const
|
|
1264
|
-
var e =
|
|
1265
|
-
return
|
|
1660
|
+
var Nt = /* @__PURE__ */ S('<svg viewBox="0 0 24 24"width=1.2em height=1.2em><path fill=currentColor d="M6.4 19L5 17.6l5.6-5.6L5 6.4L6.4 5l5.6 5.6L17.6 5L19 6.4L13.4 12l5.6 5.6l-1.4 1.4l-5.6-5.6z">');
|
|
1661
|
+
const Ot = (r = {}) => (() => {
|
|
1662
|
+
var e = Nt();
|
|
1663
|
+
return D(e, r, !0, !0), e;
|
|
1266
1664
|
})();
|
|
1267
|
-
var
|
|
1268
|
-
const
|
|
1269
|
-
var e =
|
|
1270
|
-
return
|
|
1665
|
+
var Pt = /* @__PURE__ */ S('<svg viewBox="0 0 24 24"width=1.2em height=1.2em><path fill=currentColor d="M7 2h10l-2 7h4l-2.925 4.225L7 4.15zm3 20v-8H7V9.85L1.375 4.225L2.8 2.8l18.4 18.4l-1.425 1.425L13.75 16.6z">');
|
|
1666
|
+
const Bt = (r = {}) => (() => {
|
|
1667
|
+
var e = Pt();
|
|
1668
|
+
return D(e, r, !0, !0), e;
|
|
1271
1669
|
})();
|
|
1272
|
-
var
|
|
1273
|
-
const
|
|
1274
|
-
var e =
|
|
1275
|
-
return
|
|
1670
|
+
var Vt = /* @__PURE__ */ S('<svg viewBox="0 0 24 24"width=1.2em height=1.2em><path fill=currentColor d="M10 22v-8H7V2h10l-2 7h4z">');
|
|
1671
|
+
const Ut = (r = {}) => (() => {
|
|
1672
|
+
var e = Vt();
|
|
1673
|
+
return D(e, r, !0, !0), e;
|
|
1276
1674
|
})();
|
|
1277
|
-
var
|
|
1278
|
-
const
|
|
1279
|
-
var e =
|
|
1280
|
-
return
|
|
1675
|
+
var jt = /* @__PURE__ */ S('<svg viewBox="0 0 24 24"width=1.2em height=1.2em><path fill=currentColor d="M9 21H5q-.825 0-1.412-.587T3 19V5q0-.825.588-1.412T5 3h4v2H5v14h4zm2 2V1h2v22zm4-2v-2h2v2zm0-16V3h2v2zm4 16v-2h2q0 .825-.587 1.413T19 21m0-4v-2h2v2zm0-4v-2h2v2zm0-4V7h2v2zm0-4V3q.825 0 1.413.588T21 5z">');
|
|
1676
|
+
const qt = (r = {}) => (() => {
|
|
1677
|
+
var e = jt();
|
|
1678
|
+
return D(e, r, !0, !0), e;
|
|
1281
1679
|
})();
|
|
1282
|
-
function
|
|
1680
|
+
function Ie(r) {
|
|
1283
1681
|
const e = {};
|
|
1284
|
-
return Object.entries(
|
|
1285
|
-
const
|
|
1286
|
-
let
|
|
1287
|
-
if (
|
|
1288
|
-
|
|
1289
|
-
const i = `on:${
|
|
1682
|
+
return Object.entries(r).forEach(([t, a]) => {
|
|
1683
|
+
const n = t.toLowerCase();
|
|
1684
|
+
let o = n;
|
|
1685
|
+
if (n.startsWith("on")) {
|
|
1686
|
+
o = n.slice(2);
|
|
1687
|
+
const i = `on:${o}`;
|
|
1290
1688
|
e[i] = a;
|
|
1291
1689
|
} else
|
|
1292
|
-
e[
|
|
1690
|
+
e[o] = a;
|
|
1293
1691
|
}), e;
|
|
1294
1692
|
}
|
|
1295
|
-
var
|
|
1296
|
-
const
|
|
1297
|
-
var e =
|
|
1298
|
-
return
|
|
1693
|
+
var Ht = /* @__PURE__ */ S('<svg xmlns=http://www.w3.org/2000/svg fill=none viewBox="0 0 20 20"><g fill=#fff fill-rule=evenodd clip-rule=evenodd><path d="M6.322 2.988A1.67 1.67 0 0 1 7.5 2.5h5a1.667 1.667 0 0 1 1.667 1.667A.833.833 0 0 0 15 5h.833a2.5 2.5 0 0 1 2.5 2.5V15a2.5 2.5 0 0 1-2.5 2.5H4.167a2.5 2.5 0 0 1-2.5-2.5V7.5a2.5 2.5 0 0 1 2.5-2.5H5a.833.833 0 0 0 .833-.833c0-.442.176-.866.489-1.179M4.167 6.667a.833.833 0 0 0-.834.833V15a.833.833 0 0 0 .834.833h11.666a.834.834 0 0 0 .834-.833V7.5a.833.833 0 0 0-.834-.833H15a2.5 2.5 0 0 1-2.5-2.5h-5a2.5 2.5 0 0 1-2.5 2.5z"></path><path d="M10 9.167a1.667 1.667 0 1 0 0 3.333 1.667 1.667 0 0 0 0-3.333m-3.333 1.666a3.333 3.333 0 1 1 6.666 0 3.333 3.333 0 0 1-6.666 0">');
|
|
1694
|
+
const Wt = (r = {}) => (() => {
|
|
1695
|
+
var e = Ht();
|
|
1696
|
+
return D(e, r, !0, !0), e;
|
|
1299
1697
|
})();
|
|
1300
|
-
var
|
|
1301
|
-
const
|
|
1302
|
-
var e =
|
|
1303
|
-
return
|
|
1698
|
+
var Gt = /* @__PURE__ */ S('<svg xmlns=http://www.w3.org/2000/svg fill=none viewBox="0 0 20 20"><path stroke=#fff stroke-linecap=round stroke-linejoin=round stroke-width=2 d="M4.167 10.833 7.5 14.167l8.333-8.334">');
|
|
1699
|
+
const Xt = (r = {}) => (() => {
|
|
1700
|
+
var e = Gt();
|
|
1701
|
+
return D(e, r, !0, !0), e;
|
|
1304
1702
|
})();
|
|
1305
|
-
var
|
|
1306
|
-
const
|
|
1307
|
-
var e =
|
|
1308
|
-
return
|
|
1703
|
+
var Kt = /* @__PURE__ */ S('<svg xmlns=http://www.w3.org/2000/svg fill=none viewBox="0 0 20 20"><path fill=#fff fill-rule=evenodd d="M4.41 6.91a.833.833 0 0 1 1.18 0L10 11.323l4.41-4.411a.833.833 0 1 1 1.18 1.178l-5 5a.833.833 0 0 1-1.18 0l-5-5a.833.833 0 0 1 0-1.178"clip-rule=evenodd>');
|
|
1704
|
+
const Qt = (r = {}) => (() => {
|
|
1705
|
+
var e = Kt();
|
|
1706
|
+
return D(e, r, !0, !0), e;
|
|
1309
1707
|
})();
|
|
1310
|
-
var
|
|
1311
|
-
const
|
|
1708
|
+
var Yt = /* @__PURE__ */ S("<button>"), Jt = /* @__PURE__ */ S('<div class="h-[1px] absolute left-0 right-0 top-[-1px] bg-white pointer-events-none">');
|
|
1709
|
+
const Zt = () => {
|
|
1312
1710
|
const {
|
|
1313
|
-
cameraManagerSolidStore:
|
|
1711
|
+
cameraManagerSolidStore: r,
|
|
1314
1712
|
cameraManager: e
|
|
1315
1713
|
} = q(), {
|
|
1316
|
-
t
|
|
1317
|
-
} =
|
|
1318
|
-
const
|
|
1319
|
-
return
|
|
1320
|
-
},
|
|
1321
|
-
value:
|
|
1322
|
-
label:
|
|
1323
|
-
}))],
|
|
1324
|
-
items: [...
|
|
1325
|
-
}),
|
|
1326
|
-
const
|
|
1327
|
-
if (!
|
|
1714
|
+
t
|
|
1715
|
+
} = Y(), a = r((m) => m.cameras), n = r((m) => m.selectedCamera), o = r((m) => m.isQueryingCameras), i = r((m) => m.facingFilter), [l, c] = z(!1), f = () => o() || l(), g = () => {
|
|
1716
|
+
const m = i();
|
|
1717
|
+
return m ? a().filter((b) => m.includes(b.facingMode)) : a();
|
|
1718
|
+
}, y = () => [...g().map((m) => ({
|
|
1719
|
+
value: m.deviceInfo.deviceId,
|
|
1720
|
+
label: m.name
|
|
1721
|
+
}))], u = () => Qe({
|
|
1722
|
+
items: [...y()]
|
|
1723
|
+
}), h = () => {
|
|
1724
|
+
const m = n();
|
|
1725
|
+
if (!m)
|
|
1328
1726
|
return;
|
|
1329
|
-
const
|
|
1330
|
-
if (
|
|
1331
|
-
return [
|
|
1332
|
-
},
|
|
1333
|
-
|
|
1334
|
-
const
|
|
1335
|
-
if (!
|
|
1727
|
+
const b = u().find(m.deviceInfo.deviceId);
|
|
1728
|
+
if (b)
|
|
1729
|
+
return [b.value];
|
|
1730
|
+
}, p = (m) => er.some((b) => b.value === m), C = async (m) => {
|
|
1731
|
+
c(!0);
|
|
1732
|
+
const b = a().find((v) => v.deviceInfo.deviceId === m);
|
|
1733
|
+
if (!b) {
|
|
1336
1734
|
console.warn("No camera");
|
|
1337
1735
|
return;
|
|
1338
1736
|
}
|
|
1339
|
-
await e.selectCamera(
|
|
1737
|
+
await e.selectCamera(b), c(!1);
|
|
1340
1738
|
};
|
|
1341
|
-
return s(
|
|
1342
|
-
children: () => s(
|
|
1739
|
+
return s(J, {
|
|
1740
|
+
children: () => s(A.Root, {
|
|
1343
1741
|
get collection() {
|
|
1344
|
-
return
|
|
1742
|
+
return u();
|
|
1345
1743
|
},
|
|
1346
1744
|
get value() {
|
|
1347
|
-
return
|
|
1745
|
+
return h();
|
|
1348
1746
|
},
|
|
1349
1747
|
positioning: {
|
|
1350
1748
|
placement: "top"
|
|
1351
1749
|
},
|
|
1352
1750
|
lazyMount: !0,
|
|
1353
1751
|
get disabled() {
|
|
1354
|
-
return
|
|
1752
|
+
return f();
|
|
1355
1753
|
},
|
|
1356
|
-
onValueChange: (
|
|
1357
|
-
if (
|
|
1754
|
+
onValueChange: (m) => {
|
|
1755
|
+
if (p(m.value[0])) {
|
|
1358
1756
|
console.warn("Fake camera, skipping");
|
|
1359
1757
|
return;
|
|
1360
1758
|
}
|
|
1361
|
-
|
|
1759
|
+
C(m.value[0]);
|
|
1362
1760
|
},
|
|
1363
1761
|
get children() {
|
|
1364
|
-
return [s(
|
|
1762
|
+
return [s(A.Label, {
|
|
1365
1763
|
class: "sr-only",
|
|
1366
1764
|
get children() {
|
|
1367
|
-
return
|
|
1765
|
+
return t.selected_camera;
|
|
1368
1766
|
}
|
|
1369
|
-
}), s(
|
|
1370
|
-
asChild: (
|
|
1371
|
-
var
|
|
1372
|
-
return
|
|
1373
|
-
class: `flex px-4 py-2 items-center gap-2 rounded-full bg-dark-100
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
}), !1, !0), w(p, s(Dt, {
|
|
1767
|
+
}), s(A.Trigger, {
|
|
1768
|
+
asChild: (m) => (() => {
|
|
1769
|
+
var b = Yt();
|
|
1770
|
+
return D(b, K(() => Ie(m()), {
|
|
1771
|
+
class: `flex px-4 py-2 items-center gap-2 rounded-full bg-dark-100/50 backdrop-blur-xl
|
|
1772
|
+
whitespace-nowrap text-base color-white font-500 cursor-pointer appearance-none
|
|
1773
|
+
border-none disabled:opacity-50 disabled:cursor-not-allowed max-w-[100%]`
|
|
1774
|
+
}), !1, !0), w(b, s(Wt, {
|
|
1378
1775
|
class: "size-6 shrink-0",
|
|
1379
1776
|
"aria-hidden": !0
|
|
1380
|
-
}), null), w(
|
|
1777
|
+
}), null), w(b, s(A.ValueText, {
|
|
1381
1778
|
class: "truncate",
|
|
1382
1779
|
get placeholder() {
|
|
1383
|
-
return
|
|
1384
|
-
// TODO: localize
|
|
1385
|
-
"Loading cameras..."
|
|
1386
|
-
) : "Select a camera";
|
|
1780
|
+
return o() ? t.loading_cameras : t.select_a_camera;
|
|
1387
1781
|
}
|
|
1388
|
-
}), null), w(
|
|
1782
|
+
}), null), w(b, s(A.Indicator, {
|
|
1389
1783
|
class: "shrink-0 data-[state=open]:scale-y-[-1]",
|
|
1390
1784
|
get children() {
|
|
1391
|
-
return s(
|
|
1785
|
+
return s(Qt, {
|
|
1392
1786
|
class: "size-6 shrink-0"
|
|
1393
1787
|
});
|
|
1394
1788
|
}
|
|
1395
|
-
}), null),
|
|
1789
|
+
}), null), b;
|
|
1396
1790
|
})()
|
|
1397
|
-
}), s(
|
|
1791
|
+
}), s(A.Positioner, {
|
|
1398
1792
|
get children() {
|
|
1399
|
-
return s(
|
|
1793
|
+
return s(A.Content, {
|
|
1400
1794
|
get children() {
|
|
1401
|
-
return s(
|
|
1795
|
+
return s(A.ItemGroup, {
|
|
1402
1796
|
class: "rounded-4 overflow-hidden text-base color-white",
|
|
1403
1797
|
get children() {
|
|
1404
|
-
return s(
|
|
1798
|
+
return s(qe, {
|
|
1405
1799
|
get each() {
|
|
1406
|
-
return
|
|
1800
|
+
return u().items;
|
|
1407
1801
|
},
|
|
1408
|
-
children: (
|
|
1802
|
+
children: (m, b) => s(A.Item, {
|
|
1409
1803
|
get item() {
|
|
1410
|
-
return
|
|
1804
|
+
return m();
|
|
1411
1805
|
},
|
|
1412
1806
|
class: `flex py-3 pl-4 pr-12 cursor-pointer select-none relative gap-[1px]
|
|
1413
1807
|
bg-dark-100/50 backdrop-blur-xl data-[highlighted]:bg-gray-500/50`,
|
|
1414
1808
|
get children() {
|
|
1415
|
-
return [s(
|
|
1809
|
+
return [s(A.ItemText, {
|
|
1416
1810
|
class: "truncate",
|
|
1417
1811
|
get children() {
|
|
1418
|
-
return
|
|
1812
|
+
return m().label;
|
|
1419
1813
|
}
|
|
1420
|
-
}), s(
|
|
1814
|
+
}), s(A.ItemIndicator, {
|
|
1421
1815
|
class: "absolute right-4",
|
|
1422
1816
|
get children() {
|
|
1423
|
-
return s(
|
|
1817
|
+
return s(Xt, {
|
|
1424
1818
|
class: "size-6 shrink-0"
|
|
1425
1819
|
});
|
|
1426
1820
|
}
|
|
1427
|
-
}), s(
|
|
1428
|
-
when:
|
|
1821
|
+
}), s(E, {
|
|
1822
|
+
when: b !== 0,
|
|
1429
1823
|
get children() {
|
|
1430
|
-
return
|
|
1824
|
+
return Jt();
|
|
1431
1825
|
}
|
|
1432
1826
|
})];
|
|
1433
1827
|
}
|
|
@@ -1442,7 +1836,7 @@ const Pt = () => {
|
|
|
1442
1836
|
}
|
|
1443
1837
|
})
|
|
1444
1838
|
});
|
|
1445
|
-
},
|
|
1839
|
+
}, er = [{
|
|
1446
1840
|
value: "5",
|
|
1447
1841
|
label: "Back Camera 2"
|
|
1448
1842
|
}, {
|
|
@@ -1458,80 +1852,78 @@ const Pt = () => {
|
|
|
1458
1852
|
value: "4",
|
|
1459
1853
|
label: "Some random desktop camera"
|
|
1460
1854
|
}];
|
|
1461
|
-
var
|
|
1462
|
-
const
|
|
1855
|
+
var Z = /* @__PURE__ */ S("<span class=sr-only>"), tr = /* @__PURE__ */ S('<div class="z-2 relative gap-2 grid justify-between items-center grid-cols-[1fr_auto_1fr] py-4 color-white lerp:px-3@xs,8@lg"><div class="justify-self-start flex flex-nowrap gap-4 auto-cols-auto"></div><div class="justify-self-center min-w-0 w-full"></div><div class=justify-self-end>'), rr = /* @__PURE__ */ S("<button>");
|
|
1856
|
+
const ar = () => {
|
|
1463
1857
|
const {
|
|
1464
|
-
dismountCameraUi:
|
|
1465
|
-
cameraManagerSolidStore: e
|
|
1858
|
+
dismountCameraUi: r,
|
|
1859
|
+
cameraManagerSolidStore: e,
|
|
1860
|
+
showMirrorCameraButton: t,
|
|
1861
|
+
cameraManager: a
|
|
1466
1862
|
} = q(), {
|
|
1467
|
-
t:
|
|
1468
|
-
} =
|
|
1469
|
-
const
|
|
1470
|
-
|
|
1471
|
-
},
|
|
1472
|
-
e.
|
|
1473
|
-
mirrorX: !e.getState().mirrorX
|
|
1474
|
-
});
|
|
1863
|
+
t: n
|
|
1864
|
+
} = Y(), o = e((h) => h.mirrorX), i = e((h) => h.selectedCamera), l = e((h) => h.cameras), c = e((h) => h.playbackState !== "idle"), f = e((h) => h.selectedCamera?.torchEnabled), g = () => i()?.torchSupported, y = () => {
|
|
1865
|
+
const h = i();
|
|
1866
|
+
h && h.toggleTorch();
|
|
1867
|
+
}, u = () => {
|
|
1868
|
+
a.setCameraMirrorX(!e.getState().mirrorX);
|
|
1475
1869
|
};
|
|
1476
|
-
return s(
|
|
1477
|
-
children: (
|
|
1478
|
-
var
|
|
1479
|
-
return w(
|
|
1870
|
+
return s(J, {
|
|
1871
|
+
children: () => (() => {
|
|
1872
|
+
var h = tr(), p = h.firstChild, C = p.nextSibling, m = C.nextSibling;
|
|
1873
|
+
return w(p, s(E, {
|
|
1480
1874
|
get when() {
|
|
1481
|
-
return
|
|
1875
|
+
return t && c();
|
|
1482
1876
|
},
|
|
1483
1877
|
get children() {
|
|
1484
|
-
return s(
|
|
1878
|
+
return s(ee, {
|
|
1485
1879
|
get tooltipLabel() {
|
|
1486
|
-
return
|
|
1880
|
+
return n.mirror_camera;
|
|
1487
1881
|
},
|
|
1488
|
-
|
|
1489
|
-
onClick: () => m(),
|
|
1882
|
+
onClick: () => u(),
|
|
1490
1883
|
get children() {
|
|
1491
1884
|
return [(() => {
|
|
1492
|
-
var
|
|
1493
|
-
return w(
|
|
1494
|
-
})(), s(
|
|
1885
|
+
var b = Z();
|
|
1886
|
+
return w(b, () => n.mirror_camera), b;
|
|
1887
|
+
})(), s(qt, {
|
|
1495
1888
|
class: "size-6 shrink-0 transition-transform duration-300 ease-in-out",
|
|
1496
1889
|
get style() {
|
|
1497
1890
|
return {
|
|
1498
|
-
transform:
|
|
1891
|
+
transform: o() ? "scaleX(-1)" : "scaleX(1)"
|
|
1499
1892
|
};
|
|
1500
1893
|
}
|
|
1501
1894
|
})];
|
|
1502
1895
|
}
|
|
1503
1896
|
});
|
|
1504
1897
|
}
|
|
1505
|
-
}), null), w(
|
|
1898
|
+
}), null), w(p, s(E, {
|
|
1506
1899
|
get when() {
|
|
1507
|
-
return
|
|
1900
|
+
return ge(() => !!g())() && c();
|
|
1508
1901
|
},
|
|
1509
1902
|
get children() {
|
|
1510
|
-
return s(
|
|
1511
|
-
onClick: () =>
|
|
1512
|
-
rootNode: l,
|
|
1903
|
+
return s(ee, {
|
|
1904
|
+
onClick: () => y(),
|
|
1513
1905
|
get tooltipLabel() {
|
|
1514
|
-
return
|
|
1906
|
+
return n.torch;
|
|
1515
1907
|
},
|
|
1516
1908
|
get children() {
|
|
1517
|
-
return [s(
|
|
1909
|
+
return [s(E, {
|
|
1518
1910
|
get when() {
|
|
1519
|
-
return !
|
|
1911
|
+
return !f();
|
|
1520
1912
|
},
|
|
1521
1913
|
get children() {
|
|
1522
1914
|
return [(() => {
|
|
1523
|
-
var
|
|
1524
|
-
return w(
|
|
1525
|
-
})(), s(
|
|
1915
|
+
var b = Z();
|
|
1916
|
+
return w(b, () => n.torch), b;
|
|
1917
|
+
})(), s(Ut, {
|
|
1526
1918
|
class: "size-6 shrink-0"
|
|
1527
1919
|
})];
|
|
1528
1920
|
}
|
|
1529
|
-
}), s(
|
|
1921
|
+
}), s(E, {
|
|
1530
1922
|
get when() {
|
|
1531
|
-
return
|
|
1923
|
+
return f();
|
|
1532
1924
|
},
|
|
1533
1925
|
get children() {
|
|
1534
|
-
return s(
|
|
1926
|
+
return s(Bt, {
|
|
1535
1927
|
class: "size-6 shrink-0"
|
|
1536
1928
|
});
|
|
1537
1929
|
}
|
|
@@ -1539,344 +1931,573 @@ const Ut = () => {
|
|
|
1539
1931
|
}
|
|
1540
1932
|
});
|
|
1541
1933
|
}
|
|
1542
|
-
}), null), w(
|
|
1934
|
+
}), null), w(C, s(E, {
|
|
1543
1935
|
get when() {
|
|
1544
|
-
return
|
|
1936
|
+
return l().length > 1;
|
|
1545
1937
|
},
|
|
1546
1938
|
get children() {
|
|
1547
|
-
return s(
|
|
1939
|
+
return s(Zt, {});
|
|
1548
1940
|
}
|
|
1549
|
-
})), w(
|
|
1550
|
-
onClick: () =>
|
|
1551
|
-
rootNode: l,
|
|
1941
|
+
})), w(m, s(ee, {
|
|
1942
|
+
onClick: () => r(),
|
|
1552
1943
|
get tooltipLabel() {
|
|
1553
|
-
return
|
|
1944
|
+
return n.close;
|
|
1554
1945
|
},
|
|
1555
1946
|
get children() {
|
|
1556
1947
|
return [(() => {
|
|
1557
|
-
var
|
|
1558
|
-
return w(
|
|
1559
|
-
})(), s(
|
|
1948
|
+
var b = Z();
|
|
1949
|
+
return w(b, () => n.close), b;
|
|
1950
|
+
})(), s(Ot, {
|
|
1560
1951
|
class: "size-6 shrink-0"
|
|
1561
1952
|
})];
|
|
1562
1953
|
}
|
|
1563
|
-
})),
|
|
1954
|
+
})), h;
|
|
1564
1955
|
})()
|
|
1565
1956
|
});
|
|
1566
|
-
},
|
|
1957
|
+
}, ee = (r) => s(G.Root, {
|
|
1567
1958
|
get children() {
|
|
1568
|
-
return [s(
|
|
1959
|
+
return [s(G.Trigger, K(r, {
|
|
1569
1960
|
asChild: (e) => (() => {
|
|
1570
|
-
var
|
|
1571
|
-
return
|
|
1961
|
+
var t = rr();
|
|
1962
|
+
return D(t, K(() => Ie(e()), {
|
|
1572
1963
|
class: `rounded-full bg-dark-500 bg-opacity-50 backdrop-blur grid place-items-center
|
|
1573
1964
|
size-12 appearance-none border-none cursor-pointer`
|
|
1574
|
-
}), !1, !0), w(
|
|
1965
|
+
}), !1, !0), w(t, () => r.children), t;
|
|
1575
1966
|
})()
|
|
1576
|
-
})), s(
|
|
1577
|
-
get mount() {
|
|
1578
|
-
return t.rootNode;
|
|
1579
|
-
},
|
|
1967
|
+
})), s(G.Positioner, {
|
|
1580
1968
|
get children() {
|
|
1581
|
-
return s(
|
|
1969
|
+
return s(G.Content, {
|
|
1970
|
+
class: `bg-dark-500 bg-opacity-50 backdrop-blur color-white text-align-center p-2
|
|
1971
|
+
rounded-md text-sm drop-shadow-md`,
|
|
1582
1972
|
get children() {
|
|
1583
|
-
return
|
|
1584
|
-
class: `bg-dark-500 bg-opacity-50 backdrop-blur color-white text-align-center p-2
|
|
1585
|
-
rounded-md text-sm drop-shadow-md`,
|
|
1586
|
-
get children() {
|
|
1587
|
-
return t.tooltipLabel;
|
|
1588
|
-
}
|
|
1589
|
-
});
|
|
1973
|
+
return r.tooltipLabel;
|
|
1590
1974
|
}
|
|
1591
1975
|
});
|
|
1592
1976
|
}
|
|
1593
1977
|
})];
|
|
1594
1978
|
}
|
|
1595
|
-
})
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1979
|
+
}), nr = (r, e, t) => He((a) => (w(e, r(), e.firstChild ? null : void 0), () => {
|
|
1980
|
+
a(), e.textContent = "";
|
|
1981
|
+
}), t);
|
|
1982
|
+
var or = /* @__PURE__ */ S("<div>");
|
|
1983
|
+
const ir = (r) => {
|
|
1984
|
+
const e = ve(), [t, a] = We(r, ["children", "disableShadowRoot", "getRef"]);
|
|
1599
1985
|
return (() => {
|
|
1600
|
-
var
|
|
1601
|
-
return
|
|
1986
|
+
var n = or();
|
|
1987
|
+
return O((o) => {
|
|
1602
1988
|
if (t.disableShadowRoot)
|
|
1603
1989
|
return;
|
|
1604
|
-
const
|
|
1990
|
+
const i = o.attachShadow({
|
|
1605
1991
|
mode: "open"
|
|
1606
1992
|
});
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
});
|
|
1610
|
-
}, r), w(r, s(x, {
|
|
1993
|
+
nr(() => ge(() => t.children), i, e);
|
|
1994
|
+
}, n), D(n, a, !1, !0), w(n, s(E, {
|
|
1611
1995
|
get when() {
|
|
1612
1996
|
return t.disableShadowRoot;
|
|
1613
1997
|
},
|
|
1614
1998
|
get children() {
|
|
1615
1999
|
return t.children;
|
|
1616
2000
|
}
|
|
1617
|
-
})),
|
|
1618
|
-
var o = t.class, n = t.style;
|
|
1619
|
-
return o !== a.e && ze(r, a.e = o), a.t = _e(r, n, a.t), a;
|
|
1620
|
-
}, {
|
|
1621
|
-
e: void 0,
|
|
1622
|
-
t: void 0
|
|
1623
|
-
}), r;
|
|
2001
|
+
})), n;
|
|
1624
2002
|
})();
|
|
1625
|
-
},
|
|
2003
|
+
}, sr = ":where(html){line-height:1.15;-webkit-text-size-adjust:100%;text-size-adjust:100%}:where(h1){font-size:2em;margin-block-end:.67em;margin-block-start:.67em}:where(dl,ol,ul) :where(dl,ol,ul){margin-block-end:0;margin-block-start:0}:where(hr){box-sizing:content-box;color:inherit;height:0}:where(abbr[title]){text-decoration:underline;text-decoration:underline dotted}:where(b,strong){font-weight:bolder}:where(code,kbd,pre,samp){font-family:monospace,monospace;font-size:1em}:where(small){font-size:80%}:where(table){border-color:currentColor;text-indent:0}:where(button,input,select){margin:0}:where(button){text-transform:none}:where(button,input:is([type=button i],[type=reset i],[type=submit i])){-webkit-appearance:button}:where(progress){vertical-align:baseline}:where(select){text-transform:none}:where(textarea){margin:0}:where(input[type=search i]){-webkit-appearance:textfield;outline-offset:-2px}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}::-webkit-input-placeholder{color:inherit;opacity:.54}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}:where(button,input:is([type=button i],[type=color i],[type=reset i],[type=submit i]))::-moz-focus-inner{border-style:none;padding:0}:where(button,input:is([type=button i],[type=color i],[type=reset i],[type=submit i]))::-moz-focusring{outline:1px dotted ButtonText}:where(:-moz-ui-invalid){box-shadow:none}:where(dialog){background-color:#fff;border:solid;color:#000;height:-moz-fit-content;height:fit-content;left:0;margin:auto;padding:1em;position:absolute;right:0;width:-moz-fit-content;width:fit-content}:where(dialog:not([open])){display:none}:where(summary){display:list-item}", lr = ":host{font-family:var(--mb-ui-font);line-height:1.15;isolation:isolate;box-sizing:border-box}*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}p,h1,h2,h3,h4,h5,h6{overflow-wrap:break-word}code,pre{font-family:var(--mb-monospace-font-stack)}svg path{pointer-events:none}img,picture,video,canvas,svg{display:block;max-width:100%}img{pointer-events:none;user-select:none}:where(input,button,textarea,select){font:inherit}:where(button,select){cursor:pointer;color:inherit;font:inherit}:where(p,h1,h2,h3,h4,h5,h6){overflow-wrap:break-word}", cr = ':host{--mb-system-font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;--mb-monospace-font-stack: Menlo, Consolas, "Ubuntu Mono", "Roboto Mono", "DejaVu Sans Mono", monospace;--mb-ui-font: var(--mb-system-font-stack);--mb-size: 1;--color-accent-25-rgb-value: 242 247 255;--color-accent-50-rgb-value: 231 240 255;--color-accent-100-rgb-value: 220 234 255;--color-accent-200-rgb-value: 198 221 255;--color-accent-300-rgb-value: 158 197 255;--color-accent-400-rgb-value: 111 169 255;--color-accent-500-rgb-value: 58 137 253;--color-accent-600-rgb-value: 0 98 242;--color-accent-700-rgb-value: 0 80 197;--color-accent-800-rgb-value: 0 64 157;--color-accent-900-rgb-value: 0 54 133;--color-error-25-rgb-value: 255 248 249;--color-error-50-rgb-value: 255 241 242;--color-error-100-rgb-value: 255 228 230;--color-error-200-rgb-value: 254 205 211;--color-error-300-rgb-value: 253 164 175;--color-error-400-rgb-value: 251 113 133;--color-error-500-rgb-value: 244 63 94;--color-error-600-rgb-value: 225 29 72;--color-error-700-rgb-value: 190 18 60;--color-error-800-rgb-value: 136 19 39;--color-error-900-rgb-value: 89 13 40;--color-success-25-rgb-value: 245 254 250;--color-success-50-rgb-value: 236 253 245;--color-success-100-rgb-value: 209 250 229;--color-success-200-rgb-value: 167 243 208;--color-success-300-rgb-value: 110 231 183;--color-success-400-rgb-value: 52 211 153;--color-success-500-rgb-value: 16 185 144;--color-success-600-rgb-value: 22 163 138;--color-success-700-rgb-value: 39 121 106;--color-success-800-rgb-value: 23 92 79;--color-success-900-rgb-value: 12 59 50;--color-warning-25-rgb-value: 255 253 243;--color-warning-50-rgb-value: 254 252 232;--color-warning-100-rgb-value: 254 249 195;--color-warning-200-rgb-value: 254 240 138;--color-warning-300-rgb-value: 253 229 99;--color-warning-400-rgb-value: 252 218 59;--color-warning-500-rgb-value: 250 204 21;--color-warning-600-rgb-value: 234 179 8;--color-warning-700-rgb-value: 190 142 48;--color-warning-800-rgb-value: 132 83 28;--color-warning-900-rgb-value: 80 29 10;--color-deep-blue-25-rgb-value: 249 252 255;--color-deep-blue-50-rgb-value: 243 249 254;--color-deep-blue-100-rgb-value: 231 242 251;--color-deep-blue-200-rgb-value: 201 218 241;--color-deep-blue-300-rgb-value: 162 185 216;--color-deep-blue-400-rgb-value: 93 128 182;--color-deep-blue-500-rgb-value: 60 100 161;--color-deep-blue-600-rgb-value: 28 68 129;--color-deep-blue-700-rgb-value: 24 53 97;--color-deep-blue-800-rgb-value: 20 38 65;--color-deep-blue-900-rgb-value: 6 23 49;--color-light-blue-25-rgb-value: 248 251 253;--color-light-blue-50-rgb-value: 240 247 251;--color-light-blue-100-rgb-value: 228 238 244;--color-light-blue-200-rgb-value: 215 229 238;--color-light-blue-300-rgb-value: 190 218 237;--color-light-blue-400-rgb-value: 159 202 232;--color-light-blue-500-rgb-value: 135 180 211;--color-light-blue-600-rgb-value: 104 157 193;--color-light-blue-700-rgb-value: 78 129 164;--color-light-blue-800-rgb-value: 67 109 138;--color-light-blue-900-rgb-value: 55 84 104;--color-gray-50-rgb-value: 249 250 251;--color-gray-100-rgb-value: 243 244 246;--color-gray-200-rgb-value: 229 231 235;--color-gray-300-rgb-value: 209 213 219;--color-gray-400-rgb-value: 156 163 175;--color-gray-500-rgb-value: 107 114 128;--color-gray-600-rgb-value: 75 85 99;--color-gray-700-rgb-value: 55 65 81;--color-gray-800-rgb-value: 31 41 55;--color-blue-gray-50-rgb-value: 74 74 74;--color-blue-gray-100-rgb-value: 60 60 60;--color-blue-gray-200-rgb-value: 50 50 50;--color-blue-gray-300-rgb-value: 45 45 45;--color-blue-gray-400-rgb-value: 34 34 34;--color-blue-gray-500-rgb-value: 31 31 31;--color-blue-gray-600-rgb-value: 28 28 30;--color-blue-gray-700-rgb-value: 27 27 27;--color-blue-gray-800-rgb-value: 24 24 24;--color-blue-gray-900-rgb-value: 15 15 15;--color-black-rgb-value: 0 0 0;--color-white-rgb-value: 255 255 255;--color-primary: var(--color-accent-600-rgb-value);--color-error: var(--color-error-500-rgb-value);--color-success: var(--color-success-500-rgb-value);--color-warning: var(--color-warning-500-rgb-value);--color-deep-blue: var(--color-deep-blue-800-rgb-value);--color-light-blue: var(--color-light-blue-200-rgb-value);accent-color:var(--color-primary);caret-color:red}', ur = {
|
|
1626
2004
|
feedbackLayer: null,
|
|
1627
|
-
overlayLayer: null
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
)
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
2005
|
+
overlayLayer: null,
|
|
2006
|
+
owner: null
|
|
2007
|
+
}, U = me()(
|
|
2008
|
+
// this is important! Otherwise, solid-zustand will start mutating the initial state
|
|
2009
|
+
he(() => structuredClone(ur))
|
|
2010
|
+
), oe = we(U), de = () => {
|
|
2011
|
+
};
|
|
2012
|
+
function dr(r, e) {
|
|
2013
|
+
if (Be)
|
|
2014
|
+
return { observe: de, unobserve: de };
|
|
2015
|
+
const t = new ResizeObserver(r);
|
|
2016
|
+
return ie(t.disconnect.bind(t)), {
|
|
2017
|
+
observe: (a) => t.observe(a, e),
|
|
2018
|
+
unobserve: t.unobserve.bind(t)
|
|
2019
|
+
};
|
|
2020
|
+
}
|
|
2021
|
+
const hr = (r, e, t, a) => {
|
|
2022
|
+
const n = Math.max(r / t, e / a);
|
|
2023
|
+
let o = 0;
|
|
2024
|
+
if (r / t > e / a) {
|
|
2025
|
+
const i = n * a;
|
|
2026
|
+
o = 1 - e / i;
|
|
2027
|
+
} else {
|
|
2028
|
+
const i = n * t;
|
|
2029
|
+
o = 1 - r / i;
|
|
2030
|
+
}
|
|
2031
|
+
return o < 0.1 ? "cover" : "contain";
|
|
2032
|
+
};
|
|
2033
|
+
function mr(r, e, t, a) {
|
|
2034
|
+
const n = r / t, o = e / a, i = Math.max(n, o);
|
|
2035
|
+
if (n >= o) {
|
|
2036
|
+
const l = Math.round(e / i);
|
|
2037
|
+
return { x: 0, y: Math.round((a - l) / 2), width: t, height: l };
|
|
2038
|
+
} else {
|
|
2039
|
+
const l = Math.round(r / i);
|
|
2040
|
+
return { x: Math.round((t - l) / 2), y: 0, width: l, height: a };
|
|
2041
|
+
}
|
|
2042
|
+
}
|
|
2043
|
+
const gr = "_dialogPositioner_worsp_1", fr = "_dialogBackdrop_worsp_5", br = "_dialogContent_worsp_9", pr = "_large_worsp_13", vr = "_compact_worsp_16", wr = "_dialogTitle_worsp_30", yr = "_contentOut_worsp_34", Sr = "_closeButton_worsp_38", Cr = "_closeButtonInner_worsp_44", kr = "_primaryActionButton_worsp_49", Er = "_secondaryActionButton_worsp_53", _r = "_actions_worsp_57", Tr = "_alertTitle_worsp_64", xr = "_alertText_worsp_68", k = {
|
|
2044
|
+
dialogPositioner: gr,
|
|
2045
|
+
dialogBackdrop: fr,
|
|
2046
|
+
dialogContent: br,
|
|
2047
|
+
large: pr,
|
|
2048
|
+
compact: vr,
|
|
2049
|
+
dialogTitle: wr,
|
|
2050
|
+
contentOut: yr,
|
|
2051
|
+
closeButton: Sr,
|
|
2052
|
+
closeButtonInner: Cr,
|
|
2053
|
+
primaryActionButton: kr,
|
|
2054
|
+
secondaryActionButton: Er,
|
|
2055
|
+
actions: _r,
|
|
2056
|
+
alertTitle: Tr,
|
|
2057
|
+
alertText: xr
|
|
2058
|
+
};
|
|
2059
|
+
var Mr = /* @__PURE__ */ S("<span>×"), Rr = /* @__PURE__ */ S("<div>"), Ar = /* @__PURE__ */ S("<p>"), $r = /* @__PURE__ */ S("<span>"), Fr = /* @__PURE__ */ S("<div><button></button><button>");
|
|
2060
|
+
const Dr = (r) => {
|
|
2061
|
+
const e = () => {
|
|
2062
|
+
switch (r.modalStyle) {
|
|
2063
|
+
case "compact":
|
|
2064
|
+
return k.compact;
|
|
2065
|
+
case "large":
|
|
2066
|
+
return k.compact;
|
|
2067
|
+
case "default":
|
|
2068
|
+
default:
|
|
2069
|
+
return;
|
|
2070
|
+
}
|
|
2071
|
+
};
|
|
2072
|
+
return s(J, {
|
|
2073
|
+
children: () => s($.Root, K({
|
|
2074
|
+
onFocusOutside: (t) => t.preventDefault(),
|
|
2075
|
+
onInteractOutside: (t) => t.preventDefault(),
|
|
2076
|
+
restoreFocus: !0,
|
|
2077
|
+
unmountOnExit: !0,
|
|
2078
|
+
lazyMount: !0
|
|
2079
|
+
}, r, {
|
|
1656
2080
|
get children() {
|
|
1657
|
-
return
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
2081
|
+
return s(E, {
|
|
2082
|
+
get when() {
|
|
2083
|
+
return r.open;
|
|
2084
|
+
},
|
|
2085
|
+
get children() {
|
|
2086
|
+
return s(fe, {
|
|
2087
|
+
get mount() {
|
|
2088
|
+
return r.mountTarget;
|
|
2089
|
+
},
|
|
2090
|
+
get children() {
|
|
2091
|
+
return s($.Positioner, {
|
|
2092
|
+
get class() {
|
|
2093
|
+
return k.dialogPositioner;
|
|
2094
|
+
},
|
|
2095
|
+
get children() {
|
|
2096
|
+
return [s($.Backdrop, {
|
|
2097
|
+
get class() {
|
|
2098
|
+
return k.dialogBackdrop;
|
|
2099
|
+
}
|
|
2100
|
+
}), s($.Content, {
|
|
2101
|
+
get class() {
|
|
2102
|
+
return `${k.dialogContent} ${e()}`;
|
|
2103
|
+
},
|
|
2104
|
+
get children() {
|
|
2105
|
+
return [s(E, {
|
|
2106
|
+
get when() {
|
|
2107
|
+
return r.showCloseButton;
|
|
2108
|
+
},
|
|
2109
|
+
get children() {
|
|
2110
|
+
return s($.CloseTrigger, {
|
|
2111
|
+
get class() {
|
|
2112
|
+
return k.closeButton;
|
|
2113
|
+
},
|
|
2114
|
+
get onClick() {
|
|
2115
|
+
return r.onCloseClicked;
|
|
2116
|
+
},
|
|
2117
|
+
get children() {
|
|
2118
|
+
var t = Mr();
|
|
2119
|
+
return H(() => V(t, k.closeButtonInner)), t;
|
|
2120
|
+
}
|
|
2121
|
+
});
|
|
2122
|
+
}
|
|
2123
|
+
}), s(E, {
|
|
2124
|
+
get when() {
|
|
2125
|
+
return r.headerImage;
|
|
2126
|
+
},
|
|
2127
|
+
get children() {
|
|
2128
|
+
return r.headerImage;
|
|
2129
|
+
}
|
|
2130
|
+
}), s(E, {
|
|
2131
|
+
get when() {
|
|
2132
|
+
return r.header;
|
|
2133
|
+
},
|
|
2134
|
+
children: (t) => s($.Title, {
|
|
2135
|
+
get class() {
|
|
2136
|
+
return k.dialogTitle;
|
|
2137
|
+
},
|
|
2138
|
+
get children() {
|
|
2139
|
+
return t();
|
|
2140
|
+
}
|
|
2141
|
+
})
|
|
2142
|
+
}), s($.Description, {
|
|
2143
|
+
get class() {
|
|
2144
|
+
return k.contentOut;
|
|
2145
|
+
},
|
|
2146
|
+
get children() {
|
|
2147
|
+
return r.children;
|
|
2148
|
+
}
|
|
2149
|
+
}), s(E, {
|
|
2150
|
+
get when() {
|
|
2151
|
+
return r.actions;
|
|
2152
|
+
},
|
|
2153
|
+
get children() {
|
|
2154
|
+
var t = Rr();
|
|
2155
|
+
return w(t, () => r.actions), t;
|
|
2156
|
+
}
|
|
2157
|
+
})];
|
|
2158
|
+
}
|
|
2159
|
+
})];
|
|
2160
|
+
}
|
|
2161
|
+
});
|
|
2162
|
+
}
|
|
2163
|
+
});
|
|
2164
|
+
}
|
|
2165
|
+
});
|
|
1675
2166
|
}
|
|
2167
|
+
}))
|
|
2168
|
+
});
|
|
2169
|
+
}, Ir = ({
|
|
2170
|
+
mountTarget: r,
|
|
2171
|
+
header: e,
|
|
2172
|
+
text: t,
|
|
2173
|
+
open: a,
|
|
2174
|
+
onPrimaryClick: n,
|
|
2175
|
+
onSecondaryClick: o,
|
|
2176
|
+
primaryButtonText: i = "Retry",
|
|
2177
|
+
secondaryButtonText: l = "Cancel"
|
|
2178
|
+
}) => {
|
|
2179
|
+
let c;
|
|
2180
|
+
return s(Dr, {
|
|
2181
|
+
mountTarget: r,
|
|
2182
|
+
get header() {
|
|
2183
|
+
return (() => {
|
|
2184
|
+
var f = $r();
|
|
2185
|
+
return w(f, e), H(() => V(f, k.alertTitle)), f;
|
|
2186
|
+
})();
|
|
2187
|
+
},
|
|
2188
|
+
initialFocusEl: () => c,
|
|
2189
|
+
open: a,
|
|
2190
|
+
get actions() {
|
|
2191
|
+
return (() => {
|
|
2192
|
+
var f = Fr(), g = f.firstChild, y = g.nextSibling;
|
|
2193
|
+
g.$$click = () => o(), w(g, l), y.$$click = () => n();
|
|
2194
|
+
var u = c;
|
|
2195
|
+
return typeof u == "function" ? O(u, y) : c = y, w(y, i), H((h) => {
|
|
2196
|
+
var p = k.actions, C = k.secondaryActionButton, m = k.primaryActionButton;
|
|
2197
|
+
return p !== h.e && V(f, h.e = p), C !== h.t && V(g, h.t = C), m !== h.a && V(y, h.a = m), h;
|
|
2198
|
+
}, {
|
|
2199
|
+
e: void 0,
|
|
2200
|
+
t: void 0,
|
|
2201
|
+
a: void 0
|
|
2202
|
+
}), f;
|
|
2203
|
+
})();
|
|
2204
|
+
},
|
|
2205
|
+
modalStyle: "compact",
|
|
2206
|
+
get children() {
|
|
2207
|
+
var f = Ar();
|
|
2208
|
+
return w(f, t), H(() => V(f, k.alertText)), f;
|
|
1676
2209
|
}
|
|
1677
|
-
);
|
|
1678
|
-
}
|
|
2210
|
+
});
|
|
2211
|
+
};
|
|
2212
|
+
Ve(["click"]);
|
|
2213
|
+
const zr = () => {
|
|
1679
2214
|
const {
|
|
1680
|
-
t
|
|
1681
|
-
} =
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
2215
|
+
t: r
|
|
2216
|
+
} = Y(), {
|
|
2217
|
+
cameraManagerSolidStore: e,
|
|
2218
|
+
cameraManager: t,
|
|
2219
|
+
dismountCameraUi: a
|
|
2220
|
+
} = q(), n = e((i) => i.errorState), o = oe((i) => i.overlayLayer);
|
|
2221
|
+
return s(E, {
|
|
2222
|
+
get when() {
|
|
2223
|
+
return n();
|
|
1686
2224
|
},
|
|
1687
|
-
ref: (e) => (e.style.zIndex = "1000", e.style.position = "fixed", e),
|
|
1688
2225
|
get children() {
|
|
1689
|
-
return s(
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
get children() {
|
|
1709
|
-
return [s($.Title, {
|
|
1710
|
-
class: "sr-only",
|
|
1711
|
-
id: "dialog-title",
|
|
1712
|
-
get children() {
|
|
1713
|
-
return t.modal_title;
|
|
1714
|
-
}
|
|
1715
|
-
}), s(Me, {})];
|
|
1716
|
-
}
|
|
1717
|
-
});
|
|
1718
|
-
}
|
|
1719
|
-
});
|
|
1720
|
-
}
|
|
1721
|
-
})
|
|
1722
|
-
)
|
|
2226
|
+
return s(Ir, {
|
|
2227
|
+
get mountTarget() {
|
|
2228
|
+
return o();
|
|
2229
|
+
},
|
|
2230
|
+
get header() {
|
|
2231
|
+
return r.camera_error_title;
|
|
2232
|
+
},
|
|
2233
|
+
open: !0,
|
|
2234
|
+
onPrimaryClick: () => void t.startCameraStream(),
|
|
2235
|
+
onSecondaryClick: () => a(),
|
|
2236
|
+
get primaryButtonText() {
|
|
2237
|
+
return r.camera_error_primary_btn;
|
|
2238
|
+
},
|
|
2239
|
+
get secondaryButtonText() {
|
|
2240
|
+
return r.camera_error_cancel_btn;
|
|
2241
|
+
},
|
|
2242
|
+
get text() {
|
|
2243
|
+
return r.camera_error_details;
|
|
2244
|
+
}
|
|
1723
2245
|
});
|
|
1724
2246
|
}
|
|
1725
2247
|
});
|
|
1726
2248
|
};
|
|
1727
|
-
var
|
|
1728
|
-
const
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
2249
|
+
var te = /* @__PURE__ */ S("<style>"), Lr = /* @__PURE__ */ S("<style id=camera-manager-style>"), Nr = /* @__PURE__ */ S('<div class="bg-dark-500 color-white size-full relative min-h-[300px]"part=capture-screen-part><video class="block absolute top-0 left-0 size-full"></video><div class="absolute top-0 left-0 w-full h-full z-1"id=feedback-layer></div><div class="absolute top-0 left-0 w-full h-full has-[[data-scope]]:z-2"id=overlay-layer>');
|
|
2250
|
+
const ze = "capture-screen-host", Le = () => {
|
|
2251
|
+
const {
|
|
2252
|
+
cameraManager: r,
|
|
2253
|
+
mountTarget: e
|
|
2254
|
+
} = q(), [t, a] = z(), [n, o] = z(), [i, l] = z(), c = () => e.parentNode === document.body, [f, g] = z("contain");
|
|
2255
|
+
function y() {
|
|
2256
|
+
const u = t();
|
|
2257
|
+
if (!u)
|
|
2258
|
+
return;
|
|
2259
|
+
const h = u.clientWidth, p = u.clientHeight, C = u.videoWidth, m = u.videoHeight, b = hr(h, p, C, m);
|
|
2260
|
+
if (g(b), b === "cover") {
|
|
2261
|
+
const v = mr(h, p, C, m);
|
|
2262
|
+
r.setExtractionArea(v);
|
|
2263
|
+
} else
|
|
2264
|
+
r.setExtractionArea({
|
|
2265
|
+
x: 0,
|
|
2266
|
+
y: 0,
|
|
2267
|
+
width: C,
|
|
2268
|
+
height: m
|
|
2269
|
+
});
|
|
2270
|
+
}
|
|
2271
|
+
return Q(() => {
|
|
2272
|
+
const u = t();
|
|
2273
|
+
if (!u)
|
|
2274
|
+
return;
|
|
2275
|
+
const {
|
|
2276
|
+
observe: h,
|
|
2277
|
+
unobserve: p
|
|
2278
|
+
} = dr(y);
|
|
2279
|
+
h(u), u.addEventListener("loadedmetadata", y), ie(() => {
|
|
2280
|
+
p(u), u.removeEventListener("loadedmetadata", y);
|
|
2281
|
+
});
|
|
2282
|
+
}), Q(() => {
|
|
2283
|
+
const u = ve();
|
|
2284
|
+
u && oe.setState({
|
|
2285
|
+
owner: u
|
|
2286
|
+
});
|
|
2287
|
+
}), Ge(() => {
|
|
2288
|
+
const u = t(), h = n(), p = i();
|
|
2289
|
+
!u || !h || !p || (oe.setState({
|
|
2290
|
+
feedbackLayer: h,
|
|
2291
|
+
overlayLayer: p
|
|
2292
|
+
}), r.initVideoElement(u));
|
|
2293
|
+
}), s(ir, {
|
|
2294
|
+
get id() {
|
|
2295
|
+
return c() ? void 0 : ze;
|
|
2296
|
+
},
|
|
2297
|
+
get disableShadowRoot() {
|
|
2298
|
+
return c();
|
|
2299
|
+
},
|
|
2300
|
+
get style() {
|
|
2301
|
+
return c() ? {
|
|
2302
|
+
height: "100%"
|
|
2303
|
+
} : void 0;
|
|
2304
|
+
},
|
|
2305
|
+
get children() {
|
|
2306
|
+
return [(() => {
|
|
2307
|
+
var u = te();
|
|
2308
|
+
return w(u, cr), u;
|
|
2309
|
+
})(), (() => {
|
|
2310
|
+
var u = te();
|
|
2311
|
+
return w(u, sr), u;
|
|
2312
|
+
})(), (() => {
|
|
2313
|
+
var u = te();
|
|
2314
|
+
return w(u, lr), u;
|
|
2315
|
+
})(), (() => {
|
|
2316
|
+
var u = Lr();
|
|
2317
|
+
return O((h) => {
|
|
2318
|
+
window.__mbCameraManagerCssCode && (h.innerHTML = window.__mbCameraManagerCssCode);
|
|
2319
|
+
}, u), u;
|
|
2320
|
+
})(), (() => {
|
|
2321
|
+
var u = Nr(), h = u.firstChild, p = h.nextSibling, C = p.nextSibling;
|
|
2322
|
+
return w(u, s(ar, {}), h), O(a, h), O(o, p), O(l, C), w(u, s(zr, {}), null), H((m) => (m = f()) != null ? h.style.setProperty("object-fit", m) : h.style.removeProperty("object-fit")), u;
|
|
2323
|
+
})()];
|
|
2324
|
+
}
|
|
2325
|
+
});
|
|
2326
|
+
}, Or = () => {
|
|
2327
|
+
const {
|
|
2328
|
+
t: r
|
|
2329
|
+
} = Y(), [e, t] = z(!0), {
|
|
2330
|
+
addOnDismountCallback: a
|
|
2331
|
+
} = q();
|
|
2332
|
+
return a(() => {
|
|
2333
|
+
t(!1);
|
|
2334
|
+
}), s(fe, {
|
|
2335
|
+
useShadow: !0,
|
|
2336
|
+
get mount() {
|
|
2337
|
+
return document.getElementById(Ne);
|
|
2338
|
+
},
|
|
2339
|
+
ref: (n) => (n.id = ze, n.style.zIndex = "1000", n.style.position = "fixed", n.id = "mb-camera-host", n),
|
|
2340
|
+
get children() {
|
|
2341
|
+
return s(J, {
|
|
2342
|
+
children: (n) => s($.Root, {
|
|
2343
|
+
get open() {
|
|
2344
|
+
return e();
|
|
2345
|
+
},
|
|
2346
|
+
lazyMount: !0,
|
|
2347
|
+
unmountOnExit: !0,
|
|
2348
|
+
initialFocusEl: () => {
|
|
2349
|
+
const o = document.createElement("div");
|
|
2350
|
+
return o.tabIndex = -1, n.appendChild(o), setTimeout(() => {
|
|
2351
|
+
o.remove();
|
|
2352
|
+
}, 0), o;
|
|
2353
|
+
},
|
|
1736
2354
|
get children() {
|
|
1737
|
-
return s($.
|
|
1738
|
-
"aria-labelledby": "dialog-title",
|
|
1739
|
-
class: "bg-white color-dark-9 p-4 rounded-lg shadow-lg place-self-center relative z-20",
|
|
2355
|
+
return s($.Positioner, {
|
|
1740
2356
|
get children() {
|
|
1741
|
-
return
|
|
1742
|
-
|
|
1743
|
-
|
|
2357
|
+
return s($.Content, {
|
|
2358
|
+
"aria-labelledby": "dialog-title",
|
|
2359
|
+
class: "h-vh supports-[(height:100dvh)]:h-dvh top-0 left-0 w-full fixed",
|
|
1744
2360
|
get children() {
|
|
1745
|
-
return [
|
|
2361
|
+
return [s($.Title, {
|
|
2362
|
+
class: "sr-only",
|
|
2363
|
+
id: "dialog-title",
|
|
2364
|
+
get children() {
|
|
2365
|
+
return r.scan_document;
|
|
2366
|
+
}
|
|
2367
|
+
}), s(Le, {})];
|
|
1746
2368
|
}
|
|
1747
|
-
})
|
|
1748
|
-
children: "Close"
|
|
1749
|
-
}), (() => {
|
|
1750
|
-
var e = tr();
|
|
1751
|
-
return w(e, () => t.error.message), e;
|
|
1752
|
-
})(), s(x, {
|
|
1753
|
-
get when() {
|
|
1754
|
-
return t.error.stack;
|
|
1755
|
-
},
|
|
1756
|
-
children: (e) => (() => {
|
|
1757
|
-
var r = rr();
|
|
1758
|
-
return w(r, e), r;
|
|
1759
|
-
})()
|
|
1760
|
-
})];
|
|
2369
|
+
});
|
|
1761
2370
|
}
|
|
1762
2371
|
});
|
|
1763
2372
|
}
|
|
1764
|
-
})
|
|
1765
|
-
}
|
|
1766
|
-
}
|
|
1767
|
-
}
|
|
1768
|
-
}
|
|
2373
|
+
})
|
|
2374
|
+
});
|
|
2375
|
+
}
|
|
2376
|
+
});
|
|
2377
|
+
}, Pr = () => {
|
|
1769
2378
|
const {
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
return [s(x, {
|
|
1774
|
-
get when() {
|
|
1775
|
-
return r();
|
|
1776
|
-
},
|
|
1777
|
-
children: (a) => s(ar, {
|
|
1778
|
-
get error() {
|
|
1779
|
-
return a();
|
|
1780
|
-
}
|
|
1781
|
-
})
|
|
1782
|
-
}), s(Le, {
|
|
2379
|
+
mountTarget: r
|
|
2380
|
+
} = q();
|
|
2381
|
+
return s(Ue, {
|
|
1783
2382
|
get component() {
|
|
1784
|
-
return
|
|
2383
|
+
return r.parentNode === document.body ? Or : Le;
|
|
1785
2384
|
}
|
|
1786
|
-
})
|
|
1787
|
-
},
|
|
1788
|
-
function
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
2385
|
+
});
|
|
2386
|
+
}, Ne = "camera-manager-mount-point";
|
|
2387
|
+
function Yr(r, e, {
|
|
2388
|
+
localizationStrings: t,
|
|
2389
|
+
showMirrorCameraButton: a = !1
|
|
2390
|
+
} = {}) {
|
|
2391
|
+
let n;
|
|
2392
|
+
const o = /* @__PURE__ */ new Set();
|
|
2393
|
+
let i;
|
|
2394
|
+
const l = (p) => {
|
|
2395
|
+
i = p;
|
|
1796
2396
|
}, c = () => {
|
|
2397
|
+
r.reset();
|
|
2398
|
+
};
|
|
2399
|
+
let f;
|
|
2400
|
+
const g = () => {
|
|
1797
2401
|
try {
|
|
1798
2402
|
console.debug("🧱 Dismounting camera manager UI");
|
|
1799
|
-
for (const
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
2403
|
+
for (const p of o)
|
|
2404
|
+
p();
|
|
2405
|
+
o.clear(), c(), requestAnimationFrame(() => {
|
|
2406
|
+
requestAnimationFrame(() => {
|
|
2407
|
+
f && f(), n.remove(), c();
|
|
2408
|
+
});
|
|
2409
|
+
});
|
|
2410
|
+
} catch (p) {
|
|
2411
|
+
console.warn("Error while dismounting camera manager UI", p);
|
|
1806
2412
|
}
|
|
1807
|
-
};
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
setLocalizationRef: n,
|
|
2413
|
+
}, y = document.createElement("div");
|
|
2414
|
+
y.id = Ne, n = y, e ? e.appendChild(y) : document.body.appendChild(y);
|
|
2415
|
+
const u = (p) => (o.add(p), () => {
|
|
2416
|
+
o.delete(p);
|
|
2417
|
+
});
|
|
2418
|
+
f = je(() => s(zt, {
|
|
2419
|
+
userStrings: t,
|
|
2420
|
+
setLocalizationRef: l,
|
|
1816
2421
|
get children() {
|
|
1817
|
-
return s(
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
2422
|
+
return s(Dt, {
|
|
2423
|
+
addOnDismountCallback: u,
|
|
2424
|
+
dismountCameraUi: g,
|
|
2425
|
+
cameraManager: r,
|
|
2426
|
+
showMirrorCameraButton: a,
|
|
2427
|
+
mountTarget: n,
|
|
1821
2428
|
get children() {
|
|
1822
|
-
return s(
|
|
2429
|
+
return s(Pr, {});
|
|
1823
2430
|
}
|
|
1824
2431
|
});
|
|
1825
2432
|
}
|
|
1826
|
-
}),
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
2433
|
+
}), n);
|
|
2434
|
+
const h = {
|
|
2435
|
+
updateLocalization: i,
|
|
2436
|
+
/**
|
|
2437
|
+
* Adds a callback to be called when the component is unmounted.
|
|
2438
|
+
* Returns a cleanup function that removes the callback when called.
|
|
2439
|
+
*
|
|
2440
|
+
* @param fn - The callback function to be called when the component is unmounted
|
|
2441
|
+
* @returns A cleanup function that removes the callback when called
|
|
2442
|
+
*/
|
|
2443
|
+
addOnDismountCallback: u,
|
|
2444
|
+
cameraManager: r,
|
|
1835
2445
|
// we know these are defined because `createCameraManagerUi` resolves when they are defined
|
|
1836
2446
|
// TODO: maybe don't use getters but make sure they are defined
|
|
1837
2447
|
get feedbackLayerNode() {
|
|
1838
|
-
return
|
|
2448
|
+
return U.getState().feedbackLayer;
|
|
1839
2449
|
},
|
|
1840
2450
|
get overlayLayerNode() {
|
|
1841
|
-
return
|
|
2451
|
+
return U.getState().overlayLayer;
|
|
2452
|
+
},
|
|
2453
|
+
get owner() {
|
|
2454
|
+
return U.getState().owner;
|
|
1842
2455
|
},
|
|
1843
|
-
dismount:
|
|
2456
|
+
dismount: g
|
|
1844
2457
|
};
|
|
1845
|
-
return new Promise((
|
|
1846
|
-
let
|
|
1847
|
-
},
|
|
1848
|
-
},
|
|
2458
|
+
return new Promise((p) => {
|
|
2459
|
+
let C = !1, m = !1, b = !1, v = () => {
|
|
2460
|
+
}, x = () => {
|
|
2461
|
+
}, R = () => {
|
|
1849
2462
|
};
|
|
1850
|
-
const
|
|
1851
|
-
|
|
2463
|
+
const F = () => {
|
|
2464
|
+
C && m && b && (v(), x(), R(), p(h));
|
|
1852
2465
|
};
|
|
1853
|
-
|
|
1854
|
-
|
|
2466
|
+
v = U.subscribe((M) => M.feedbackLayer, (M) => {
|
|
2467
|
+
M && (m = !0), F();
|
|
1855
2468
|
}, {
|
|
1856
2469
|
fireImmediately: !0
|
|
1857
|
-
}),
|
|
1858
|
-
|
|
2470
|
+
}), x = U.subscribe((M) => M.overlayLayer, (M) => {
|
|
2471
|
+
M && (b = !0), F();
|
|
1859
2472
|
}, {
|
|
1860
2473
|
fireImmediately: !0
|
|
1861
|
-
}),
|
|
1862
|
-
|
|
2474
|
+
}), R = r.subscribe((M) => M.videoElement, (M) => {
|
|
2475
|
+
M && (C = !0, F());
|
|
1863
2476
|
}, {
|
|
1864
2477
|
fireImmediately: !0
|
|
1865
2478
|
});
|
|
1866
2479
|
});
|
|
1867
2480
|
}
|
|
1868
|
-
const
|
|
1869
|
-
globalThis.__CAMERA_MANAGER__ ||=
|
|
1870
|
-
globalThis.__CAMERA_MANAGER__ !==
|
|
2481
|
+
const Oe = Symbol();
|
|
2482
|
+
globalThis.__CAMERA_MANAGER__ ||= Oe;
|
|
2483
|
+
globalThis.__CAMERA_MANAGER__ !== Oe && console.warn(
|
|
1871
2484
|
"Detected multiple instances of @microblink/camera-manager. This can lead to unexpected behavior."
|
|
1872
2485
|
);
|
|
1873
2486
|
export {
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
2487
|
+
Me as Camera,
|
|
2488
|
+
Qr as CameraManager,
|
|
2489
|
+
Ne as MOUNT_POINT_ID,
|
|
2490
|
+
At as VideoFrameProcessor,
|
|
1877
2491
|
d as cameraManagerStore,
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
2492
|
+
U as cameraUiRefStore,
|
|
2493
|
+
Yr as createCameraManagerUi,
|
|
2494
|
+
$t as defaultCameraManagerOptions,
|
|
2495
|
+
bt as findResolutionKey,
|
|
2496
|
+
$e as getBuffer,
|
|
2497
|
+
gt as getNormalizedResolution,
|
|
2498
|
+
ne as isBufferDetached,
|
|
2499
|
+
ft as matchClosestResolution,
|
|
2500
|
+
Ye as resetCameraManagerStore,
|
|
2501
|
+
mt as returnLongerSide,
|
|
2502
|
+
P as videoResolutions
|
|
1882
2503
|
};
|