@microblink/camera-manager 7.2.2 → 7.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,76 +1,36 @@
1
- (function() {
2
- "use strict";
3
- ((cssCode) => {
4
- window.__mbCameraManagerCssCode = cssCode;
5
- })("._dialogPositioner_worsp_1 {\n 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);\n}@supports (height:100dvh){._dialogPositioner_worsp_1{height:100dvh;}}\n\n._dialogBackdrop_worsp_5 {\n 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)) /* rgb(var(--color-black-rgb-value) / <alpha-value>) */;--un-bg-opacity:0.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);\n}\n\n._dialogContent_worsp_9 {\n position:relative;max-height:calc(100dvh - 4rem);max-width:28rem;display:flex;flex-direction:column;place-self:center;border-radius:0.5rem;--un-bg-opacity:1;background-color:rgb(var(--color-white-rgb-value) / var(--un-bg-opacity)) /* rgb(var(--color-white-rgb-value) / <alpha-value>) */;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)) /* #0f0f0f */;--un-shadow:var(--un-shadow-inset) 0 10px 15px -3px var(--un-shadow-color, rgb(0 0 0 / 0.1)),var(--un-shadow-inset) 0 4px 6px -4px var(--un-shadow-color, rgb(0 0 0 / 0.1));box-shadow:var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow);\n}\n._dialogContent_worsp_9._large_worsp_13 {\n padding-left:min(8%,4rem);padding-right:min(8%,4rem);padding-top:min(8%,3rem);padding-bottom:min(8%,3rem);\n}\n._dialogContent_worsp_9._compact_worsp_16 {\n padding:min(8%,1.5rem);\n}\n@media (min-width: 640px){\n ._dialogContent_worsp_9 {\n max-width:36rem;\n }\n}\n@media (min-width: 1024px){\n ._dialogContent_worsp_9 {\n max-width:28rem;\n }\n}\n\n._dialogTitle_worsp_30 {\n text-align:center;font-size:calc(var(--mb-size)*1.5rem);line-height:calc(var(--mb-size)*2rem);font-weight:700;\n}\n\n._contentOut_worsp_34 {\n overflow-y:auto;\n}\n\n._closeButton_worsp_38 {\n position:absolute;top:0.625rem;right:0.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 /* transparent */;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;transition-duration:100ms;\n}._closeButton_worsp_38:hover{--un-bg-opacity:1;background-color:rgb(var(--color-gray-100-rgb-value) / var(--un-bg-opacity)) /* rgb(var(--color-gray-100-rgb-value) / <alpha-value>) */;}._closeButton_worsp_38:active{--un-bg-opacity:1;background-color:rgb(var(--color-gray-200-rgb-value) / var(--un-bg-opacity)) /* rgb(var(--color-gray-200-rgb-value) / <alpha-value>) */;}\n\n._closeButtonInner_worsp_44 {\n display:flex;--un-translate-y:-2px;transform:translateX(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)) rotateZ(var(--un-rotate-z)) skewX(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)) /* rgb(var(--color-black-rgb-value) / <alpha-value>) */;font-weight:200;line-height:1;\n}\n\n._primaryActionButton_worsp_49 {\n 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)) /* rgb(var(--color-primary) / <alpha-value>) */;padding-left:calc(var(--mb-size)*1.25rem);padding-right:calc(var(--mb-size)*1.25rem);padding-top:calc(var(--mb-size)*0.25rem);padding-bottom:calc(var(--mb-size)*0.25rem);text-wrap:nowrap;font-size:calc(var(--mb-size)*0.875rem);line-height:calc(var(--mb-size)*1.25rem);--un-text-opacity:1;color:rgb(var(--color-white-rgb-value) / var(--un-text-opacity)) /* rgb(var(--color-white-rgb-value) / <alpha-value>) */;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;transition-duration:100ms;\n}._primaryActionButton_worsp_49[disabled]{cursor:not-allowed;--un-bg-opacity:1;background-color:rgb(var(--color-gray-200-rgb-value) / var(--un-bg-opacity)) /* rgb(var(--color-gray-200-rgb-value) / <alpha-value>) */;--un-text-opacity:1;color:rgb(var(--color-gray-500-rgb-value) / var(--un-text-opacity)) /* rgb(var(--color-gray-500-rgb-value) / <alpha-value>) */;--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)) /* rgb(var(--color-gray-200-rgb-value) / <alpha-value>) */;--un-text-opacity:1;color:rgb(var(--color-gray-500-rgb-value) / var(--un-text-opacity)) /* rgb(var(--color-gray-500-rgb-value) / <alpha-value>) */;}._primaryActionButton_worsp_49:hover{--un-bg-opacity:1;background-color:rgb(var(--color-accent-700-rgb-value) / var(--un-bg-opacity)) /* rgb(var(--color-accent-700-rgb-value) / <alpha-value>) */;}._primaryActionButton_worsp_49:active{--un-bg-opacity:1;background-color:rgb(var(--color-accent-800-rgb-value) / var(--un-bg-opacity)) /* rgb(var(--color-accent-800-rgb-value) / <alpha-value>) */;}._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)) /* rgb(var(--color-accent-400-rgb-value) / <alpha-value>) */;outline-offset:4px;outline-style:solid;}\n\n._secondaryActionButton_worsp_53 {\n height:2.5rem;-webkit-appearance:none;appearance:none;border-radius:calc(var(--mb-size)*2.5rem);border-style:none;background-color:transparent /* transparent */;padding-left:calc(var(--mb-size)*1.25rem);padding-right:calc(var(--mb-size)*1.25rem);padding-top:calc(var(--mb-size)*0.25rem);padding-bottom:calc(var(--mb-size)*0.25rem);text-wrap:nowrap;font-size:calc(var(--mb-size)*0.875rem);line-height:calc(var(--mb-size)*1.25rem);--un-text-opacity:1;color:rgb(var(--color-primary) / var(--un-text-opacity)) /* rgb(var(--color-primary) / <alpha-value>) */;--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)) /* rgb(var(--color-primary) / <alpha-value>) */;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;transition-duration:100ms;\n}._secondaryActionButton_worsp_53[disabled]{cursor:not-allowed;--un-bg-opacity:1;background-color:rgb(var(--color-gray-200-rgb-value) / var(--un-bg-opacity)) /* rgb(var(--color-gray-200-rgb-value) / <alpha-value>) */;--un-text-opacity:1;color:rgb(var(--color-gray-500-rgb-value) / var(--un-text-opacity)) /* rgb(var(--color-gray-500-rgb-value) / <alpha-value>) */;--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)) /* rgb(var(--color-gray-200-rgb-value) / <alpha-value>) */;--un-text-opacity:1;color:rgb(var(--color-gray-500-rgb-value) / var(--un-text-opacity)) /* rgb(var(--color-gray-500-rgb-value) / <alpha-value>) */;}._secondaryActionButton_worsp_53:hover{--un-bg-opacity:1;background-color:rgb(var(--color-accent-25-rgb-value) / var(--un-bg-opacity)) /* rgb(var(--color-accent-25-rgb-value) / <alpha-value>) */;--un-text-opacity:1;color:rgb(var(--color-accent-700-rgb-value) / var(--un-text-opacity)) /* rgb(var(--color-accent-700-rgb-value) / <alpha-value>) */;--un-ring-opacity:1;--un-ring-color:rgb(var(--color-accent-700-rgb-value) / var(--un-ring-opacity)) /* rgb(var(--color-accent-700-rgb-value) / <alpha-value>) */;}._secondaryActionButton_worsp_53:active{--un-bg-opacity:1;background-color:rgb(var(--color-accent-50-rgb-value) / var(--un-bg-opacity)) /* rgb(var(--color-accent-50-rgb-value) / <alpha-value>) */;--un-text-opacity:1;color:rgb(var(--color-accent-800-rgb-value) / var(--un-text-opacity)) /* rgb(var(--color-accent-800-rgb-value) / <alpha-value>) */;--un-ring-opacity:1;--un-ring-color:rgb(var(--color-accent-800-rgb-value) / var(--un-ring-opacity)) /* rgb(var(--color-accent-800-rgb-value) / <alpha-value>) */;}._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)) /* rgb(var(--color-accent-400-rgb-value) / <alpha-value>) */;outline-offset:4px;outline-style:solid;}\n\n._actions_worsp_57 {\n display:flex;gap:calc(var(--mb-size)*1rem);\n}\n._actions_worsp_57 ._primaryActionButton_worsp_49, ._actions_worsp_57 ._secondaryActionButton_worsp_53 {\n width:50%;\n}\n\n._alertTitle_worsp_64 {\n 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)) /* rgb(var(--color-gray-700-rgb-value) / <alpha-value>) */;font-weight:400;\n}\n\n._alertText_worsp_68 {\n margin-top:calc(var(--mb-size)*1rem);margin-bottom:calc(var(--mb-size)*2rem);padding-left:calc(var(--mb-size)*0.5rem);padding-right:calc(var(--mb-size)*0.5rem);text-align:center;text-wrap:pretty;--un-text-opacity:1;color:rgb(var(--color-gray-500-rgb-value) / var(--un-text-opacity)) /* rgb(var(--color-gray-500-rgb-value) / <alpha-value>) */;font-weight:300;line-height:1.5;\n} *,::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 / 0.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 / 0.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);}.z-1{z-index:1;}.has-\\[\\[data-scope\\]\\]\\:z-2:has([data-scope]),.z-2{z-index:2;}.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:translateX(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)) rotateZ(var(--un-rotate-z)) skewX(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:translateX(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)) rotateZ(var(--un-rotate-z)) skewX(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)*0.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:0.375rem;}.border-none{border-style:none;}.bg-dark-100\\/50{background-color:rgb(60 60 60 / 0.5) /* #3c3c3c */;}.bg-dark-500{--un-bg-opacity:1;background-color:rgb(31 31 31 / var(--un-bg-opacity)) /* #1f1f1f */;}.data-\\[highlighted\\]\\:bg-gray-500\\/50[data-highlighted]{background-color:rgb(var(--color-gray-500-rgb-value) / 0.5) /* rgb(var(--color-gray-500-rgb-value) / <alpha-value>) */;}.bg-white{--un-bg-opacity:1;background-color:rgb(var(--color-white-rgb-value) / var(--un-bg-opacity)) /* rgb(var(--color-white-rgb-value) / <alpha-value>) */;}.bg-opacity-50{--un-bg-opacity:0.5;}.p-2{padding:calc(var(--mb-size)*0.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)*0.5rem);padding-bottom:calc(var(--mb-size)*0.5rem);}.py-3{padding-top:calc(var(--mb-size)*0.75rem);padding-bottom:calc(var(--mb-size)*0.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)*0.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)) /* rgb(var(--color-white-rgb-value) / <alpha-value>) */;}.font-500{font-weight:500;}.disabled\\:opacity-50:disabled{opacity:0.5;}.shadow{--un-shadow:var(--un-shadow-inset) 0 1px 3px 0 var(--un-shadow-color, rgb(0 0 0 / 0.1)),var(--un-shadow-inset) 0 1px 2px -1px var(--un-shadow-color, rgb(0 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 / 0.07))) drop-shadow(0 2px 2px var(--un-drop-shadow-color, rgb(0 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(0.4, 0, 0.2, 1);transition-duration:150ms;}.duration-300{transition-duration:300ms;}.ease-in-out{transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);}@keyframes __un_qm{0%{box-shadow:inset 4px 4px #ff1e90, inset -4px -4px #ff1e90}100%{box-shadow:inset 8px 8px #3399ff, inset -8px -8px #3399ff}} .\\?{animation:__un_qm 0.5s ease-in-out alternate infinite;}.lerp\\:px-3\\@xs\\,8\\@lg{padding-inline:clamp(calc(var(--mb-size)*0.75rem), calc(var(--mb-size)*0.75rem) + (100vw - 380px) * 0.031055900621118012, calc(var(--mb-size)*2rem));}@supports (height:100dvh){.supports-\\[\\(height\\:100dvh\\)\\]\\:h-dvh{height:100dvh;}}");
6
- })();
7
- import { subscribeWithSelector } from "zustand/middleware";
8
- import { createStore } from "zustand/vanilla";
9
- import { createComponent, use, template, spread, mergeProps, insert, memo, isServer, delegateEvents, effect, className, Portal, Dynamic, render } from "solid-js/web";
10
- import { createContext, onCleanup, useContext, onMount, createSignal, Show, Index, createRoot, getOwner, splitProps, createEffect } from "solid-js";
11
- import { createWithSignal } from "solid-zustand";
12
- import { createStore as createStore$1 } from "solid-js/store";
13
- import { EnvironmentProvider } from "@ark-ui/solid/environment";
14
- import { Dialog } from "@ark-ui/solid/dialog";
15
- import { Select, createListCollection } from "@ark-ui/solid/select";
16
- import { Tooltip } from "@ark-ui/solid/tooltip";
17
- if (typeof HTMLVideoElement !== "undefined" && !("requestVideoFrameCallback" in HTMLVideoElement.prototype) && "getVideoPlaybackQuality" in HTMLVideoElement.prototype) {
18
- HTMLVideoElement.prototype._rvfcpolyfillmap = {};
19
- HTMLVideoElement.prototype.requestVideoFrameCallback = function(callback) {
20
- const handle = performance.now();
21
- const quality = this.getVideoPlaybackQuality();
22
- const baseline = this.mozPresentedFrames || this.mozPaintedFrames || quality.totalVideoFrames - quality.droppedVideoFrames;
23
- const check = (old, now) => {
24
- const newquality = this.getVideoPlaybackQuality();
25
- const presentedFrames = this.mozPresentedFrames || this.mozPaintedFrames || newquality.totalVideoFrames - newquality.droppedVideoFrames;
26
- if (presentedFrames > baseline) {
27
- const processingDuration = this.mozFrameDelay || newquality.totalFrameDelay - quality.totalFrameDelay || 0;
28
- const timediff = now - old;
29
- callback(now, {
30
- presentationTime: now + processingDuration * 1e3,
31
- expectedDisplayTime: now + timediff,
32
- width: this.videoWidth,
33
- height: this.videoHeight,
34
- mediaTime: Math.max(0, this.currentTime || 0) + timediff / 1e3,
35
- presentedFrames,
36
- processingDuration
37
- });
38
- delete this._rvfcpolyfillmap[handle];
39
- } else {
40
- this._rvfcpolyfillmap[handle] = requestAnimationFrame((newer) => check(now, newer));
41
- }
42
- };
43
- this._rvfcpolyfillmap[handle] = requestAnimationFrame((newer) => check(handle, newer));
44
- return handle;
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 ge } from "zustand/middleware";
3
+ import { createStore as be } from "zustand/vanilla";
4
+ import { createComponent as s, use as B, template as S, spread as F, mergeProps as Y, insert as y, memo as pe, isServer as Ue, delegateEvents as qe, effect as H, className as V, Portal as ve, Dynamic as je, render as He } from "solid-js/web";
5
+ import { createContext as we, onCleanup as ce, useContext as ye, onMount as J, createSignal as z, Show as E, Index as We, createRoot as Ge, getOwner as Se, splitProps as Xe, createEffect as Qe } from "solid-js";
6
+ import { createWithSignal as Ce } from "solid-zustand";
7
+ import { createStore as Ke } from "solid-js/store";
8
+ import { EnvironmentProvider as Ye } from "@ark-ui/solid/environment";
9
+ import { Dialog as $ } from "@ark-ui/solid/dialog";
10
+ import { Select as A, createListCollection as Je } from "@ark-ui/solid/select";
11
+ import { Tooltip as Q } from "@ark-ui/solid/tooltip";
12
+ typeof HTMLVideoElement < "u" && !("requestVideoFrameCallback" in HTMLVideoElement.prototype) && "getVideoPlaybackQuality" in HTMLVideoElement.prototype && (HTMLVideoElement.prototype._rvfcpolyfillmap = {}, HTMLVideoElement.prototype.requestVideoFrameCallback = function(t) {
13
+ const e = performance.now(), r = this.getVideoPlaybackQuality(), a = this.mozPresentedFrames || this.mozPaintedFrames || r.totalVideoFrames - r.droppedVideoFrames, n = (o, i) => {
14
+ const l = this.getVideoPlaybackQuality(), c = this.mozPresentedFrames || this.mozPaintedFrames || l.totalVideoFrames - l.droppedVideoFrames;
15
+ if (c > a) {
16
+ const d = this.mozFrameDelay || l.totalFrameDelay - r.totalFrameDelay || 0, h = i - o;
17
+ t(i, {
18
+ presentationTime: i + d * 1e3,
19
+ expectedDisplayTime: i + h,
20
+ width: this.videoWidth,
21
+ height: this.videoHeight,
22
+ mediaTime: Math.max(0, this.currentTime || 0) + h / 1e3,
23
+ presentedFrames: c,
24
+ processingDuration: d
25
+ }), delete this._rvfcpolyfillmap[e];
26
+ } else
27
+ this._rvfcpolyfillmap[e] = requestAnimationFrame((d) => n(i, d));
45
28
  };
46
- HTMLVideoElement.prototype.cancelVideoFrameCallback = function(handle) {
47
- cancelAnimationFrame(this._rvfcpolyfillmap[handle]);
48
- delete this._rvfcpolyfillmap[handle];
49
- };
50
- }
51
- const initialState$1 = {
52
- cameras: [],
53
- facingFilter: void 0,
54
- videoElement: void 0,
55
- playbackState: "idle",
56
- selectedCamera: void 0,
57
- isSwappingCamera: false,
58
- isQueryingCameras: false,
59
- mirrorX: false,
60
- errorState: void 0
61
- };
62
- const cameraManagerStore = createStore()(
63
- // this is important! Otherwise solid-zustand will start mutating the initial state
64
- subscribeWithSelector(() => structuredClone(initialState$1))
65
- );
66
- const resetCameraManagerStore = () => {
67
- console.debug("Stopping all cameras and resetting the `cameraManagerStore`.");
68
- cameraManagerStore.getState().cameras.forEach((camera) => {
69
- camera.stopStream();
70
- });
71
- cameraManagerStore.setState(structuredClone(initialState$1));
72
- };
73
- const backCameraKeywords = [
29
+ return this._rvfcpolyfillmap[e] = requestAnimationFrame((o) => n(e, o)), e;
30
+ }, HTMLVideoElement.prototype.cancelVideoFrameCallback = function(t) {
31
+ cancelAnimationFrame(this._rvfcpolyfillmap[t]), delete this._rvfcpolyfillmap[t];
32
+ });
33
+ const Ze = [
74
34
  // English
75
35
  "back",
76
36
  "rear",
@@ -141,8 +101,7 @@ const backCameraKeywords = [
141
101
  "बैक",
142
102
  // Latin American Spanish
143
103
  "posterior"
144
- ];
145
- const frontCameraKeywords = [
104
+ ], et = [
146
105
  // English
147
106
  "front",
148
107
  // German
@@ -209,66 +168,38 @@ const frontCameraKeywords = [
209
168
  "फ्रंट",
210
169
  // Latin American Spanish
211
170
  "frontal"
212
- ];
213
- const containsKeyword = (string, keywords) => {
214
- return keywords.some((keyword) => string.toLowerCase().includes(keyword));
215
- };
216
- const isBackCameraName = (string) => containsKeyword(string, backCameraKeywords);
217
- const isFrontCameraName = (string) => containsKeyword(string, frontCameraKeywords);
218
- var _createClass = /* @__PURE__ */ function() {
219
- function defineProperties(target, props) {
220
- for (var i = 0; i < props.length; i++) {
221
- var descriptor = props[i];
222
- descriptor.enumerable = descriptor.enumerable || false;
223
- descriptor.configurable = true;
224
- if ("value" in descriptor) descriptor.writable = true;
225
- Object.defineProperty(target, descriptor.key, descriptor);
171
+ ], ke = (t, e) => e.some((r) => t.toLowerCase().includes(r)), Ee = (t) => ke(t, Ze), _e = (t) => ke(t, et);
172
+ var tt = /* @__PURE__ */ function() {
173
+ function t(e, r) {
174
+ for (var a = 0; a < r.length; a++) {
175
+ var n = r[a];
176
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n);
226
177
  }
227
178
  }
228
- return function(Constructor, protoProps, staticProps) {
229
- if (protoProps) defineProperties(Constructor.prototype, protoProps);
230
- if (staticProps) defineProperties(Constructor, staticProps);
231
- return Constructor;
179
+ return function(e, r, a) {
180
+ return r && t(e.prototype, r), a && t(e, a), e;
232
181
  };
233
- }();
234
- var _templateObject = _taggedTemplateLiteral(["", ""], ["", ""]);
235
- function _taggedTemplateLiteral(strings, raw) {
236
- return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } }));
182
+ }(), rt = at(["", ""], ["", ""]);
183
+ function at(t, e) {
184
+ return Object.freeze(Object.defineProperties(t, { raw: { value: Object.freeze(e) } }));
237
185
  }
238
- function _classCallCheck(instance, Constructor) {
239
- if (!(instance instanceof Constructor)) {
186
+ function nt(t, e) {
187
+ if (!(t instanceof e))
240
188
  throw new TypeError("Cannot call a class as a function");
241
- }
242
189
  }
243
- var TemplateTag = function() {
244
- function TemplateTag2() {
245
- var _this = this;
246
- for (var _len = arguments.length, transformers = Array(_len), _key = 0; _key < _len; _key++) {
247
- transformers[_key] = arguments[_key];
248
- }
249
- _classCallCheck(this, TemplateTag2);
250
- this.tag = function(strings) {
251
- for (var _len2 = arguments.length, expressions = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
252
- expressions[_key2 - 1] = arguments[_key2];
253
- }
254
- if (typeof strings === "function") {
255
- return _this.interimTag.bind(_this, strings);
256
- }
257
- if (typeof strings === "string") {
258
- return _this.transformEndResult(strings);
259
- }
260
- strings = strings.map(_this.transformString.bind(_this));
261
- return _this.transformEndResult(strings.reduce(_this.processSubstitutions.bind(_this, expressions)));
262
- };
263
- if (transformers.length > 0 && Array.isArray(transformers[0])) {
264
- transformers = transformers[0];
265
- }
266
- this.transformers = transformers.map(function(transformer) {
267
- return typeof transformer === "function" ? transformer() : transformer;
268
- });
269
- return this.tag;
270
- }
271
- _createClass(TemplateTag2, [{
190
+ var T = function() {
191
+ function t() {
192
+ for (var e = this, r = arguments.length, a = Array(r), n = 0; n < r; n++)
193
+ a[n] = arguments[n];
194
+ return nt(this, t), this.tag = function(o) {
195
+ for (var i = arguments.length, l = Array(i > 1 ? i - 1 : 0), c = 1; c < i; c++)
196
+ l[c - 1] = arguments[c];
197
+ 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))));
198
+ }, a.length > 0 && Array.isArray(a[0]) && (a = a[0]), this.transformers = a.map(function(o) {
199
+ return typeof o == "function" ? o() : o;
200
+ }), this.tag;
201
+ }
202
+ return tt(t, [{
272
203
  key: "interimTag",
273
204
  /**
274
205
  * An intermediary template tag that receives a template tag and passes the result of calling the template with the received
@@ -278,11 +209,10 @@ var TemplateTag = function() {
278
209
  * @param {...*} ...substitutions - `substitutions` is an array of all substitutions in the template
279
210
  * @return {*} - the final processed value
280
211
  */
281
- value: function interimTag(previousTag, template2) {
282
- for (var _len3 = arguments.length, substitutions = Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
283
- substitutions[_key3 - 2] = arguments[_key3];
284
- }
285
- return this.tag(_templateObject, previousTag.apply(void 0, [template2].concat(substitutions)));
212
+ value: function(r, a) {
213
+ for (var n = arguments.length, o = Array(n > 2 ? n - 2 : 0), i = 2; i < n; i++)
214
+ o[i - 2] = arguments[i];
215
+ return this.tag(rt, r.apply(void 0, [a].concat(o)));
286
216
  }
287
217
  /**
288
218
  * Performs bulk processing on the tagged template, transforming each substitution and then
@@ -294,9 +224,9 @@ var TemplateTag = function() {
294
224
  */
295
225
  }, {
296
226
  key: "processSubstitutions",
297
- value: function processSubstitutions(substitutions, resultSoFar, remainingPart) {
298
- var substitution = this.transformSubstitution(substitutions.shift(), resultSoFar);
299
- return "".concat(resultSoFar, substitution, remainingPart);
227
+ value: function(r, a, n) {
228
+ var o = this.transformSubstitution(r.shift(), a);
229
+ return "".concat(a, o, n);
300
230
  }
301
231
  /**
302
232
  * Iterate through each transformer, applying the transformer's `onString` method to the template
@@ -306,11 +236,11 @@ var TemplateTag = function() {
306
236
  */
307
237
  }, {
308
238
  key: "transformString",
309
- value: function transformString(str) {
310
- var cb = function cb2(res, transform) {
311
- return transform.onString ? transform.onString(res) : res;
239
+ value: function(r) {
240
+ var a = function(o, i) {
241
+ return i.onString ? i.onString(o) : o;
312
242
  };
313
- return this.transformers.reduce(cb, str);
243
+ return this.transformers.reduce(a, r);
314
244
  }
315
245
  /**
316
246
  * When a substitution is encountered, iterates through each transformer and applies the transformer's
@@ -321,11 +251,11 @@ var TemplateTag = function() {
321
251
  */
322
252
  }, {
323
253
  key: "transformSubstitution",
324
- value: function transformSubstitution(substitution, resultSoFar) {
325
- var cb = function cb2(res, transform) {
326
- return transform.onSubstitution ? transform.onSubstitution(res, resultSoFar) : res;
254
+ value: function(r, a) {
255
+ var n = function(i, l) {
256
+ return l.onSubstitution ? l.onSubstitution(i, a) : i;
327
257
  };
328
- return this.transformers.reduce(cb, substitution);
258
+ return this.transformers.reduce(n, r);
329
259
  }
330
260
  /**
331
261
  * Iterates through each transformer, applying the transformer's `onEndResult` method to the
@@ -335,161 +265,120 @@ var TemplateTag = function() {
335
265
  */
336
266
  }, {
337
267
  key: "transformEndResult",
338
- value: function transformEndResult(endResult) {
339
- var cb = function cb2(res, transform) {
340
- return transform.onEndResult ? transform.onEndResult(res) : res;
268
+ value: function(r) {
269
+ var a = function(o, i) {
270
+ return i.onEndResult ? i.onEndResult(o) : o;
341
271
  };
342
- return this.transformers.reduce(cb, endResult);
272
+ return this.transformers.reduce(a, r);
343
273
  }
344
- }]);
345
- return TemplateTag2;
346
- }();
347
- var trimResultTransformer = function trimResultTransformer2() {
348
- var side = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
274
+ }]), t;
275
+ }(), M = function() {
276
+ var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "";
349
277
  return {
350
- onEndResult: function onEndResult(endResult) {
351
- if (side === "") {
352
- return endResult.trim();
353
- }
354
- side = side.toLowerCase();
355
- if (side === "start" || side === "left") {
356
- return endResult.replace(/^\s*/, "");
357
- }
358
- if (side === "end" || side === "right") {
359
- return endResult.replace(/\s*$/, "");
360
- }
361
- throw new Error("Side not supported: " + side);
278
+ onEndResult: function(a) {
279
+ if (e === "")
280
+ return a.trim();
281
+ if (e = e.toLowerCase(), e === "start" || e === "left")
282
+ return a.replace(/^\s*/, "");
283
+ if (e === "end" || e === "right")
284
+ return a.replace(/\s*$/, "");
285
+ throw new Error("Side not supported: " + e);
362
286
  }
363
287
  };
364
288
  };
365
- function _toConsumableArray(arr) {
366
- if (Array.isArray(arr)) {
367
- for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) {
368
- arr2[i] = arr[i];
369
- }
370
- return arr2;
371
- } else {
372
- return Array.from(arr);
373
- }
289
+ function ot(t) {
290
+ if (Array.isArray(t)) {
291
+ for (var e = 0, r = Array(t.length); e < t.length; e++)
292
+ r[e] = t[e];
293
+ return r;
294
+ } else
295
+ return Array.from(t);
374
296
  }
375
- var stripIndentTransformer = function stripIndentTransformer2() {
376
- var type = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "initial";
297
+ var L = function() {
298
+ var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "initial";
377
299
  return {
378
- onEndResult: function onEndResult(endResult) {
379
- if (type === "initial") {
380
- var match = endResult.match(/^[^\S\n]*(?=\S)/gm);
381
- var indent = match && Math.min.apply(Math, _toConsumableArray(match.map(function(el) {
382
- return el.length;
300
+ onEndResult: function(a) {
301
+ if (e === "initial") {
302
+ var n = a.match(/^[^\S\n]*(?=\S)/gm), o = n && Math.min.apply(Math, ot(n.map(function(l) {
303
+ return l.length;
383
304
  })));
384
- if (indent) {
385
- var regexp = new RegExp("^.{" + indent + "}", "gm");
386
- return endResult.replace(regexp, "");
305
+ if (o) {
306
+ var i = new RegExp("^.{" + o + "}", "gm");
307
+ return a.replace(i, "");
387
308
  }
388
- return endResult;
389
- }
390
- if (type === "all") {
391
- return endResult.replace(/^[^\S\n]+/gm, "");
309
+ return a;
392
310
  }
393
- throw new Error("Unknown type: " + type);
311
+ if (e === "all")
312
+ return a.replace(/^[^\S\n]+/gm, "");
313
+ throw new Error("Unknown type: " + e);
394
314
  }
395
315
  };
396
- };
397
- var replaceResultTransformer = function replaceResultTransformer2(replaceWhat, replaceWith) {
316
+ }, q = function(e, r) {
398
317
  return {
399
- onEndResult: function onEndResult(endResult) {
400
- if (replaceWhat == null || replaceWith == null) {
318
+ onEndResult: function(n) {
319
+ if (e == null || r == null)
401
320
  throw new Error("replaceResultTransformer requires at least 2 arguments.");
402
- }
403
- return endResult.replace(replaceWhat, replaceWith);
321
+ return n.replace(e, r);
404
322
  }
405
323
  };
406
- };
407
- var replaceSubstitutionTransformer = function replaceSubstitutionTransformer2(replaceWhat, replaceWith) {
324
+ }, P = function(e, r) {
408
325
  return {
409
- onSubstitution: function onSubstitution(substitution, resultSoFar) {
410
- if (replaceWhat == null || replaceWith == null) {
326
+ onSubstitution: function(n, o) {
327
+ if (e == null || r == null)
411
328
  throw new Error("replaceSubstitutionTransformer requires at least 2 arguments.");
412
- }
413
- if (substitution == null) {
414
- return substitution;
415
- } else {
416
- return substitution.toString().replace(replaceWhat, replaceWith);
417
- }
329
+ return n == null ? n : n.toString().replace(e, r);
418
330
  }
419
331
  };
420
- };
421
- var defaults = {
332
+ }, it = {
422
333
  separator: "",
423
334
  conjunction: "",
424
- serial: false
425
- };
426
- var inlineArrayTransformer = function inlineArrayTransformer2() {
427
- var opts = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : defaults;
335
+ serial: !1
336
+ }, D = function() {
337
+ var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : it;
428
338
  return {
429
- onSubstitution: function onSubstitution(substitution, resultSoFar) {
430
- if (Array.isArray(substitution)) {
431
- var arrayLength = substitution.length;
432
- var separator = opts.separator;
433
- var conjunction = opts.conjunction;
434
- var serial = opts.serial;
435
- var indent = resultSoFar.match(/(\n?[^\S\n]+)$/);
436
- if (indent) {
437
- substitution = substitution.join(separator + indent[1]);
438
- } else {
439
- substitution = substitution.join(separator + " ");
440
- }
441
- if (conjunction && arrayLength > 1) {
442
- var separatorIndex = substitution.lastIndexOf(separator);
443
- substitution = substitution.slice(0, separatorIndex) + (serial ? separator : "") + " " + conjunction + substitution.slice(separatorIndex + 1);
339
+ onSubstitution: function(a, n) {
340
+ if (Array.isArray(a)) {
341
+ var o = a.length, i = e.separator, l = e.conjunction, c = e.serial, d = n.match(/(\n?[^\S\n]+)$/);
342
+ if (d ? a = a.join(i + d[1]) : a = a.join(i + " "), l && o > 1) {
343
+ var h = a.lastIndexOf(i);
344
+ a = a.slice(0, h) + (c ? i : "") + " " + l + a.slice(h + 1);
444
345
  }
445
346
  }
446
- return substitution;
347
+ return a;
447
348
  }
448
349
  };
449
- };
450
- var splitStringTransformer = function splitStringTransformer2(splitBy) {
350
+ }, Te = function(e) {
451
351
  return {
452
- onSubstitution: function onSubstitution(substitution, resultSoFar) {
453
- {
454
- if (typeof substitution === "string" && substitution.includes(splitBy)) {
455
- substitution = substitution.split(splitBy);
456
- }
457
- }
458
- return substitution;
352
+ onSubstitution: function(a, n) {
353
+ return typeof a == "string" && a.includes(e) && (a = a.split(e)), a;
459
354
  }
460
355
  };
461
- };
462
- var isValidValue = function isValidValue2(x) {
463
- return x != null && !Number.isNaN(x) && typeof x !== "boolean";
464
- };
465
- var removeNonPrintingValuesTransformer = function removeNonPrintingValuesTransformer2() {
356
+ }, de = function(e) {
357
+ return e != null && !Number.isNaN(e) && typeof e != "boolean";
358
+ }, st = function() {
466
359
  return {
467
- onSubstitution: function onSubstitution(substitution) {
468
- if (Array.isArray(substitution)) {
469
- return substitution.filter(isValidValue);
470
- }
471
- if (isValidValue(substitution)) {
472
- return substitution;
473
- }
474
- return "";
360
+ onSubstitution: function(r) {
361
+ return Array.isArray(r) ? r.filter(de) : de(r) ? r : "";
475
362
  }
476
363
  };
477
364
  };
478
- new TemplateTag(inlineArrayTransformer({ separator: "," }), stripIndentTransformer, trimResultTransformer);
479
- new TemplateTag(inlineArrayTransformer({ separator: ",", conjunction: "and" }), stripIndentTransformer, trimResultTransformer);
480
- new TemplateTag(inlineArrayTransformer({ separator: ",", conjunction: "or" }), stripIndentTransformer, trimResultTransformer);
481
- new TemplateTag(splitStringTransformer("\n"), removeNonPrintingValuesTransformer, inlineArrayTransformer, stripIndentTransformer, trimResultTransformer);
482
- new TemplateTag(splitStringTransformer("\n"), inlineArrayTransformer, stripIndentTransformer, trimResultTransformer, replaceSubstitutionTransformer(/&/g, "&amp;"), replaceSubstitutionTransformer(/</g, "&lt;"), replaceSubstitutionTransformer(/>/g, "&gt;"), replaceSubstitutionTransformer(/"/g, "&quot;"), replaceSubstitutionTransformer(/'/g, "&#x27;"), replaceSubstitutionTransformer(/`/g, "&#x60;"));
483
- new TemplateTag(replaceResultTransformer(/(?:\n(?:\s*))+/g, " "), trimResultTransformer);
484
- new TemplateTag(replaceResultTransformer(/(?:\n\s*)/g, ""), trimResultTransformer);
485
- new TemplateTag(inlineArrayTransformer({ separator: "," }), replaceResultTransformer(/(?:\s+)/g, " "), trimResultTransformer);
486
- new TemplateTag(inlineArrayTransformer({ separator: ",", conjunction: "or" }), replaceResultTransformer(/(?:\s+)/g, " "), trimResultTransformer);
487
- new TemplateTag(inlineArrayTransformer({ separator: ",", conjunction: "and" }), replaceResultTransformer(/(?:\s+)/g, " "), trimResultTransformer);
488
- new TemplateTag(inlineArrayTransformer, stripIndentTransformer, trimResultTransformer);
489
- new TemplateTag(inlineArrayTransformer, replaceResultTransformer(/(?:\s+)/g, " "), trimResultTransformer);
490
- new TemplateTag(stripIndentTransformer, trimResultTransformer);
491
- var stripIndents = new TemplateTag(stripIndentTransformer("all"), trimResultTransformer);
492
- const backDualWideCameraLocalizations = [
365
+ new T(D({ separator: "," }), L, M);
366
+ new T(D({ separator: ",", conjunction: "and" }), L, M);
367
+ new T(D({ separator: ",", conjunction: "or" }), L, M);
368
+ new T(Te(`
369
+ `), st, D, L, M);
370
+ new T(Te(`
371
+ `), D, L, M, P(/&/g, "&amp;"), P(/</g, "&lt;"), P(/>/g, "&gt;"), P(/"/g, "&quot;"), P(/'/g, "&#x27;"), P(/`/g, "&#x60;"));
372
+ new T(q(/(?:\n(?:\s*))+/g, " "), M);
373
+ new T(q(/(?:\n\s*)/g, ""), M);
374
+ new T(D({ separator: "," }), q(/(?:\s+)/g, " "), M);
375
+ new T(D({ separator: ",", conjunction: "or" }), q(/(?:\s+)/g, " "), M);
376
+ new T(D({ separator: ",", conjunction: "and" }), q(/(?:\s+)/g, " "), M);
377
+ new T(D, L, M);
378
+ new T(D, q(/(?:\s+)/g, " "), M);
379
+ new T(L, M);
380
+ var Me = new T(L("all"), M);
381
+ const lt = [
493
382
  "Cameră dublă cu obiectiv superangular spate",
494
383
  "מצלמה כפולה רחבה אחורית",
495
384
  "Артқы қос кең бұрышты камера",
@@ -527,16 +416,15 @@ const backDualWideCameraLocalizations = [
527
416
  "Cámara trasera dual con gran angular",
528
417
  "背面デュアル広角カメラ",
529
418
  "Stražnja dvostruka široka kamera"
530
- ];
531
- const asError = (thrown) => {
532
- if (thrown instanceof Error) return thrown;
419
+ ], K = (t) => {
420
+ if (t instanceof Error) return t;
533
421
  try {
534
- return new Error(JSON.stringify(thrown));
422
+ return new Error(JSON.stringify(t));
535
423
  } catch {
536
- return new Error(String(thrown));
424
+ return new Error(String(t));
537
425
  }
538
426
  };
539
- class CameraError extends Error {
427
+ class xe extends Error {
540
428
  code;
541
429
  /**
542
430
  * Creates a new camera error.
@@ -545,209 +433,139 @@ class CameraError extends Error {
545
433
  * @param code - The error code.
546
434
  * @param cause - The cause of the error.
547
435
  */
548
- constructor(message, code, cause) {
549
- super(message);
550
- this.code = code;
551
- this.cause = cause;
436
+ constructor(e, r, a) {
437
+ super(e), this.code = r, this.cause = a;
552
438
  }
553
439
  }
554
- const askForCameraPermission = async () => {
440
+ const ct = async () => {
555
441
  try {
556
- const mediaStream = await navigator.mediaDevices.getUserMedia({
557
- video: true
442
+ const t = await navigator.mediaDevices.getUserMedia({
443
+ video: !0
558
444
  });
559
- closeStreamTracks(mediaStream);
560
- } catch (error) {
561
- console.log(error);
562
- const newError = new CameraError(
445
+ Re(t);
446
+ } catch (t) {
447
+ throw console.log(t), new xe(
563
448
  "Camera permission not given",
564
449
  "PERMISSION_DENIED",
565
- asError(error)
450
+ K(t)
566
451
  );
567
- throw newError;
568
452
  }
569
- };
570
- const obtainVideoInputDevices = async () => {
571
- if (!isSecureContext) {
572
- throw new Error(stripIndents`
453
+ }, ut = async () => {
454
+ if (!isSecureContext)
455
+ throw new Error(Me`
573
456
  Cameras can only be used in a secure context:
574
457
  https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts
575
458
  `);
576
- }
577
- await askForCameraPermission();
578
- const allDevices = await navigator.mediaDevices.enumerateDevices();
579
- const cameraDevices = allDevices.filter((device) => {
580
- return device.kind === "videoinput";
581
- });
582
- return cameraDevices;
583
- };
584
- const closeStreamTracks = (stream) => {
585
- const tracks = stream.getTracks();
586
- for (const track of tracks) {
587
- track.stop();
588
- }
589
- };
590
- const createConstraints = (resolution, facing, id) => {
591
- const constraints = {
592
- video: {
593
- deviceId: id ? { exact: id } : void 0,
594
- frameRate: 30,
595
- aspectRatio: {
596
- exact: videoResolutions[resolution].width / videoResolutions[resolution].height
597
- },
598
- width: {
599
- ideal: videoResolutions[resolution].width
600
- },
601
- height: {
602
- ideal: videoResolutions[resolution].height
603
- },
604
- facingMode: facing
459
+ return await ct(), (await navigator.mediaDevices.enumerateDevices()).filter((r) => r.kind === "videoinput");
460
+ }, Re = (t) => {
461
+ const e = t.getTracks();
462
+ for (const r of e)
463
+ r.stop();
464
+ }, dt = (t, e, r) => ({
465
+ video: {
466
+ deviceId: r ? { exact: r } : void 0,
467
+ frameRate: 30,
468
+ aspectRatio: {
469
+ exact: O[t].width / O[t].height
605
470
  },
606
- audio: false
607
- };
608
- return constraints;
609
- };
610
- function scoreCameraCapabilities(camera) {
611
- let score = 0;
612
- if (camera.torchSupported) score += 1;
613
- if (camera.singleShotSupported) score += 1;
614
- return score;
471
+ width: {
472
+ ideal: O[t].width
473
+ },
474
+ height: {
475
+ ideal: O[t].height
476
+ },
477
+ facingMode: e
478
+ },
479
+ audio: !1
480
+ });
481
+ function ht(t) {
482
+ let e = 0;
483
+ return t.torchSupported && (e += 1), t.singleShotSupported && (e += 1), e;
615
484
  }
616
- function filterCamerasByFacing(cameras, requestedFacing) {
617
- return cameras.filter((camera) => {
618
- if (requestedFacing === "back" || requestedFacing === void 0) {
619
- return isBackCameraName(camera.name);
620
- } else {
621
- return isFrontCameraName(camera.name);
622
- }
623
- });
485
+ function mt(t, e) {
486
+ return t.filter((r) => e === "back" || e === void 0 ? Ee(r.name) : _e(r.name));
624
487
  }
625
- const findIdealCamera = async (cameras, resolution = "4k", requestedFacing = "back") => {
626
- if (cameras.length === 0) {
488
+ const ft = async (t, e = "4k", r = "back") => {
489
+ if (t.length === 0)
627
490
  throw new Error("No cameras found");
628
- }
629
- if (cameras.length === 1) {
630
- await cameras[0].startStream(resolution);
631
- return cameras[0];
632
- }
633
- let cameraPool = filterCamerasByFacing(cameras, requestedFacing);
634
- if (cameraPool.length === 1) {
635
- await cameraPool[0].startStream(resolution);
636
- return cameraPool[0];
637
- }
638
- if (cameraPool.length === 0) {
639
- console.debug("No camera found with requested facing, using all cameras");
640
- cameraPool = cameras;
641
- }
642
- if (requestedFacing === "back") {
643
- const dualWideCamera = cameraPool.find(
644
- (camera) => backDualWideCameraLocalizations.includes(camera.name)
491
+ if (t.length === 1)
492
+ return await t[0].startStream(e), t[0];
493
+ let a = mt(t, r);
494
+ if (a.length === 1)
495
+ return await a[0].startStream(e), a[0];
496
+ if (a.length === 0 && (console.debug("No camera found with requested facing, using all cameras"), a = t), r === "back") {
497
+ const c = a.find(
498
+ (d) => lt.includes(d.name)
645
499
  );
646
- if (dualWideCamera) {
647
- await dualWideCamera.startStream(resolution);
648
- return dualWideCamera;
649
- }
500
+ if (c)
501
+ return await c.startStream(e), c;
650
502
  }
651
- if (requestedFacing === "front") {
652
- const lastCamera = cameraPool[cameraPool.length - 1];
653
- await lastCamera.startStream(resolution);
654
- return lastCamera;
503
+ if (r === "front") {
504
+ const c = a[a.length - 1];
505
+ return await c.startStream(e), c;
655
506
  }
656
- const cameraScores = /* @__PURE__ */ new Map();
657
- let bestCamera;
658
- let maxScore = -Infinity;
659
- for (let i = cameraPool.length - 1; i >= 0; i--) {
660
- const camera = cameraPool[i];
507
+ const n = /* @__PURE__ */ new Map();
508
+ let o, i = -1 / 0;
509
+ for (let c = a.length - 1; c >= 0; c--) {
510
+ const d = a[c];
661
511
  try {
662
- await camera.startStream(resolution);
663
- const score = scoreCameraCapabilities(camera);
664
- cameraScores.set(camera, score);
665
- if (score > maxScore) {
666
- if (bestCamera && bestCamera !== camera) {
667
- bestCamera.stopStream();
668
- }
669
- maxScore = score;
670
- bestCamera = camera;
671
- } else {
672
- camera.stopStream();
673
- }
674
- if (score === 2) {
675
- console.debug("Found camera with all capabilities, returning early");
676
- return camera;
677
- }
678
- } catch (error) {
679
- console.warn(`Failed to test camera ${camera.name}:`, error);
680
- camera.stopStream();
681
- }
682
- }
683
- if (bestCamera) {
684
- return bestCamera;
685
- }
686
- const firstCamera = cameraPool[0];
687
- await firstCamera.startStream(resolution);
688
- return firstCamera;
512
+ await d.startStream(e);
513
+ const h = ht(d);
514
+ if (n.set(d, h), h > i ? (o && o !== d && o.stopStream(), i = h, o = d) : d.stopStream(), h === 2)
515
+ return console.debug("Found camera with all capabilities, returning early"), d;
516
+ } catch (h) {
517
+ console.warn(`Failed to test camera ${d.name}:`, h), d.stopStream();
518
+ }
519
+ }
520
+ if (o)
521
+ return o;
522
+ const l = a[0];
523
+ return await l.startStream(e), l;
689
524
  };
690
- function createCameras(cameras) {
691
- const camerasWithStream = [];
692
- for (const device of cameras) {
693
- const camera = new Camera(device);
694
- if (camera !== null) {
695
- camerasWithStream.push(camera);
696
- }
525
+ function gt(t) {
526
+ const e = [];
527
+ for (const r of t) {
528
+ const a = new Ae(r);
529
+ a !== null && e.push(a);
697
530
  }
698
- return camerasWithStream;
531
+ return e;
699
532
  }
700
- const videoResolutions = {
533
+ const O = {
701
534
  "720p": { width: 1280, height: 720 },
702
535
  "1080p": { width: 1920, height: 1080 },
703
536
  "4k": { width: 3840, height: 2160 }
704
537
  };
705
- function returnLongerSide(resolution) {
706
- return Math.max(resolution.width, resolution.height);
538
+ function bt(t) {
539
+ return Math.max(t.width, t.height);
707
540
  }
708
- function getNormalizedResolution(resolution) {
709
- const normalized = {
710
- width: Math.max(resolution.width, resolution.height),
711
- height: Math.min(resolution.width, resolution.height)
541
+ function pt(t) {
542
+ const e = {
543
+ width: Math.max(t.width, t.height),
544
+ height: Math.min(t.width, t.height)
712
545
  };
713
- const epsilon = 1e-4;
714
- if (Math.abs(normalized.width / normalized.height - 16 / 9) > epsilon) {
715
- console.warn(
716
- `Resolution ${JSON.stringify(
717
- resolution
718
- )} is not 16:9, may cause issues with some video players.`
719
- );
720
- }
721
- return normalized;
546
+ return Math.abs(e.width / e.height - 16 / 9) > 1e-4 && console.warn(
547
+ `Resolution ${JSON.stringify(
548
+ t
549
+ )} is not 16:9, may cause issues with some video players.`
550
+ ), e;
722
551
  }
723
- function matchClosestResolution(resolution) {
724
- const actualWidth = returnLongerSide(resolution);
725
- if (actualWidth > 1920) {
726
- return "4k";
727
- } else if (actualWidth > 1280) {
728
- return "1080p";
729
- } else {
730
- return "720p";
731
- }
552
+ function vt(t) {
553
+ const e = bt(t);
554
+ return e > 1920 ? "4k" : e > 1280 ? "1080p" : "720p";
732
555
  }
733
- function findResolutionKey(videoTrackResolution) {
734
- const normalizedResolution = getNormalizedResolution(videoTrackResolution);
735
- const resolutionMatch = Object.entries(videoResolutions).find(
736
- ([key, value]) => {
737
- return value.width === normalizedResolution.width && value.height === normalizedResolution.height;
738
- }
556
+ function wt(t) {
557
+ const e = pt(t), r = Object.entries(O).find(
558
+ ([n, o]) => o.width === e.width && o.height === e.height
739
559
  );
740
- if (!resolutionMatch) {
741
- const closestMatch = matchClosestResolution(videoTrackResolution);
742
- console.warn(
743
- `No exact resolution match found for ${JSON.stringify(videoTrackResolution)}, categorizing as ${closestMatch}`
744
- );
745
- return closestMatch;
560
+ if (!r) {
561
+ const n = vt(t);
562
+ return console.warn(
563
+ `No exact resolution match found for ${JSON.stringify(t)}, categorizing as ${n}`
564
+ ), n;
746
565
  }
747
- const resolutionKey = resolutionMatch[0];
748
- return resolutionKey;
566
+ return r[0];
749
567
  }
750
- class Camera {
568
+ class Ae {
751
569
  /**
752
570
  * The device info.
753
571
  */
@@ -764,9 +582,9 @@ class Camera {
764
582
  activeStream;
765
583
  name;
766
584
  facingMode;
767
- torchSupported = false;
768
- torchEnabled = false;
769
- singleShotSupported = false;
585
+ torchSupported = !1;
586
+ torchEnabled = !1;
587
+ singleShotSupported = !1;
770
588
  maxSupportedResolution;
771
589
  /**
772
590
  * Reference to the original instance before it was proxied.
@@ -783,41 +601,29 @@ class Camera {
783
601
  *
784
602
  * @deprecated Not used. Reconsider using once Firefox and Chrome align on this.
785
603
  */
786
- #deviceCapabilities;
604
+ #e;
787
605
  /**
788
606
  * Creates a new Camera instance.
789
607
  *
790
608
  * @param deviceInfo - The device info.
791
609
  */
792
- constructor(deviceInfo) {
793
- if (deviceInfo.kind !== "videoinput") {
610
+ constructor(e) {
611
+ if (e.kind !== "videoinput")
794
612
  throw new Error("Device is not a video input device");
795
- }
796
- this.deviceInfo = deviceInfo;
797
- this.name = deviceInfo.label;
798
- if (isFrontCameraName(deviceInfo.label)) {
799
- this.facingMode = "front";
800
- }
801
- if (isBackCameraName(deviceInfo.label)) {
802
- this.facingMode = "back";
803
- }
804
- const originalRef = this;
805
- const proxy = new Proxy(this, {
806
- set(target, property, value, receiver) {
807
- const oldValue = Reflect.get(target, property, receiver);
808
- const change = {
809
- property,
810
- oldValue,
811
- value
613
+ this.deviceInfo = e, this.name = e.label, _e(e.label) && (this.facingMode = "front"), Ee(e.label) && (this.facingMode = "back");
614
+ const r = this, a = new Proxy(this, {
615
+ set(n, o, i, l) {
616
+ const c = Reflect.get(n, o, l), d = {
617
+ property: o,
618
+ oldValue: c,
619
+ value: i
812
620
  };
813
- originalRef.notify(change);
814
- return Reflect.set(target, property, value, receiver);
621
+ return r.notify(d), Reflect.set(n, o, i, l);
815
622
  }
816
623
  });
817
- this.notify = (reason) => {
818
- this.notifyStateChange?.(proxy, reason);
819
- };
820
- return proxy;
624
+ return this.notify = (n) => {
625
+ this.notifyStateChange?.(a, n);
626
+ }, a;
821
627
  }
822
628
  /**
823
629
  * Starts a stream with the specified resolution.
@@ -825,25 +631,19 @@ class Camera {
825
631
  * @param resolution - The resolution to start the stream with.
826
632
  * @returns The stream.
827
633
  */
828
- async startStream(resolution) {
829
- if (this.activeStream) {
634
+ async startStream(e) {
635
+ if (this.activeStream)
830
636
  return this.activeStream;
831
- }
832
- if (this.maxSupportedResolution) {
833
- resolution = this.maxSupportedResolution;
834
- }
835
- const stream = await this.acquireStreamWithFallback(resolution);
836
- this.populateCapabilities(stream);
837
- this.activeStream = stream;
838
- const videoTrack = stream.getVideoTracks()[0];
839
- videoTrack.onended = (e) => {
840
- this.stopStream();
841
- this.notify({
842
- event: e,
637
+ this.maxSupportedResolution && (e = this.maxSupportedResolution);
638
+ const r = await this.acquireStreamWithFallback(e);
639
+ this.populateCapabilities(r), this.activeStream = r;
640
+ const a = r.getVideoTracks()[0];
641
+ return a.onended = (n) => {
642
+ this.stopStream(), this.notify({
643
+ event: n,
843
644
  payload: "TRACK_END"
844
645
  });
845
- };
846
- return stream;
646
+ }, r;
847
647
  }
848
648
  /**
849
649
  * Acquires a camera stream with the specified resolution.
@@ -852,25 +652,24 @@ class Camera {
852
652
  * @param resolution - The resolution to acquire the stream with.
853
653
  * @returns The stream.
854
654
  */
855
- async acquireStreamWithFallback(resolution) {
655
+ async acquireStreamWithFallback(e) {
856
656
  try {
857
- const constraints = createConstraints(
858
- resolution,
657
+ const r = dt(
658
+ e,
859
659
  this.facingMode,
860
660
  this.deviceInfo.deviceId
861
661
  );
862
- return await navigator.mediaDevices.getUserMedia(constraints);
863
- } catch (error) {
662
+ return await navigator.mediaDevices.getUserMedia(r);
663
+ } catch (r) {
864
664
  console.warn(
865
- `Can't get camera stream for ${this.name} at ${resolution}`,
866
- error
665
+ `Can't get camera stream for ${this.name} at ${e}`,
666
+ r
867
667
  );
868
- let currentResolutionIndex = Object.keys(videoResolutions).indexOf(resolution);
869
- if (currentResolutionIndex === 0) {
668
+ let a = Object.keys(O).indexOf(e);
669
+ if (a === 0)
870
670
  throw new Error("Failed to get camera stream");
871
- }
872
- const fallbackResolution = Object.keys(videoResolutions)[currentResolutionIndex - 1];
873
- return await this.acquireStreamWithFallback(fallbackResolution);
671
+ const n = Object.keys(O)[a - 1];
672
+ return await this.acquireStreamWithFallback(n);
874
673
  }
875
674
  }
876
675
  /**
@@ -878,45 +677,18 @@ class Camera {
878
677
  *
879
678
  * @param stream - The stream to populate the capabilities from.
880
679
  */
881
- populateCapabilities(stream) {
882
- this.streamCapabilities = stream.getVideoTracks()[0].getCapabilities();
883
- const videoTrack = stream.getVideoTracks()[0];
884
- const trackSettings = videoTrack.getSettings();
885
- if (!trackSettings.width || !trackSettings.height) {
680
+ populateCapabilities(e) {
681
+ this.streamCapabilities = e.getVideoTracks()[0].getCapabilities();
682
+ const a = e.getVideoTracks()[0].getSettings();
683
+ if (!a.width || !a.height)
886
684
  throw new Error(
887
685
  "Video track resolution not available. Should not happen."
888
686
  );
889
- }
890
- const videoTrackResolution = {
891
- width: trackSettings.width,
892
- height: trackSettings.height
893
- };
894
- const resolutionKey = findResolutionKey(videoTrackResolution);
895
- if (!this.maxSupportedResolution && resolutionKey) {
896
- this.maxSupportedResolution = resolutionKey;
897
- }
898
- if ("torch" in this.streamCapabilities) {
899
- this.torchSupported = true;
900
- }
901
- if ("focusMode" in this.streamCapabilities && this.streamCapabilities.focusMode?.includes("single-shot")) {
902
- this.singleShotSupported = true;
903
- }
904
- if (this.facingMode === "front" && this.streamCapabilities.facingMode?.includes("environment")) {
905
- this.facingMode = "back";
906
- console.warn("Front camera selected, but facingMode is environment");
907
- }
908
- if (this.facingMode === "back" && this.streamCapabilities.facingMode?.includes("user")) {
909
- this.facingMode = "front";
910
- console.warn("Back camera selected, but facingMode is user");
911
- }
912
- if (!this.facingMode) {
913
- if (this.streamCapabilities.facingMode?.includes("environment")) {
914
- this.facingMode = "back";
915
- }
916
- if (this.streamCapabilities.facingMode?.includes("user")) {
917
- this.facingMode = "front";
918
- }
919
- }
687
+ const n = {
688
+ width: a.width,
689
+ height: a.height
690
+ }, o = wt(n);
691
+ !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"));
920
692
  }
921
693
  /**
922
694
  * Toggles the torch on the camera.
@@ -924,27 +696,21 @@ class Camera {
924
696
  * @returns The torch status.
925
697
  */
926
698
  async toggleTorch() {
927
- const videoTrack = this.getVideoTrack();
928
- if (!videoTrack) {
699
+ const e = this.getVideoTrack();
700
+ if (!e)
929
701
  throw new Error("No active stream on Camera instance.");
930
- }
931
- if (!this.torchSupported) {
702
+ if (!this.torchSupported)
932
703
  throw new Error("Torch not supported on this device.");
933
- }
934
704
  try {
935
- await videoTrack.applyConstraints({
705
+ await e.applyConstraints({
936
706
  advanced: [
937
707
  {
938
708
  torch: !this.torchEnabled
939
709
  }
940
710
  ]
941
- });
942
- this.torchEnabled = !this.torchEnabled;
943
- } catch (error) {
944
- console.error("Failed to toggle torch", error);
945
- this.torchEnabled = false;
946
- this.torchSupported = false;
947
- throw new Error("Failed to toggle torch", { cause: error });
711
+ }), this.torchEnabled = !this.torchEnabled;
712
+ } catch (r) {
713
+ throw console.error("Failed to toggle torch", r), this.torchEnabled = !1, this.torchSupported = !1, new Error("Failed to toggle torch", { cause: r });
948
714
  }
949
715
  return this.torchEnabled;
950
716
  }
@@ -952,13 +718,7 @@ class Camera {
952
718
  * Stops the stream on the camera.
953
719
  */
954
720
  stopStream() {
955
- if (this.activeStream) {
956
- console.debug(`Stopping active stream on ${this.name}`);
957
- closeStreamTracks(this.activeStream);
958
- this.activeStream = void 0;
959
- this.streamCapabilities = void 0;
960
- this.torchEnabled = false;
961
- }
721
+ this.activeStream && (console.debug(`Stopping active stream on ${this.name}`), Re(this.activeStream), this.activeStream = void 0, this.streamCapabilities = void 0, this.torchEnabled = !1);
962
722
  }
963
723
  /**
964
724
  * Gets the video track on the camera.
@@ -973,241 +733,166 @@ class Camera {
973
733
  return this.activeStream.getVideoTracks()[0];
974
734
  }
975
735
  }
976
- const ORIGINAL_ATTACH_SHADOW = Element.prototype.attachShadow;
977
- function isShady() {
978
- return typeof window.ShadyDOM !== "undefined" && typeof ShadowRoot !== "undefined";
736
+ const $e = {
737
+ cameras: [],
738
+ facingFilter: void 0,
739
+ videoElement: void 0,
740
+ playbackState: "idle",
741
+ selectedCamera: void 0,
742
+ isSwappingCamera: !1,
743
+ isQueryingCameras: !1,
744
+ mirrorX: !1,
745
+ errorState: void 0
746
+ }, m = be()(
747
+ // this is important! Otherwise solid-zustand will start mutating the initial state
748
+ ge(() => structuredClone($e))
749
+ ), yt = () => {
750
+ console.debug("Stopping all cameras and resetting the `cameraManagerStore`."), m.getState().cameras.forEach((t) => {
751
+ t.stopStream();
752
+ }), m.setState(structuredClone($e));
753
+ }, he = Element.prototype.attachShadow;
754
+ function ue() {
755
+ return typeof window.ShadyDOM < "u" && typeof ShadowRoot < "u";
979
756
  }
980
- function supportsShadowRoots() {
981
- return typeof ShadowRoot !== "undefined";
757
+ function St() {
758
+ return typeof ShadowRoot < "u";
982
759
  }
983
- function patchElementPrototypeAttachShadow(callback) {
984
- if (ORIGINAL_ATTACH_SHADOW == null || isShady())
985
- return;
986
- Element.prototype.attachShadow = function(shadowRootInitDict) {
987
- const shadowRoot = ORIGINAL_ATTACH_SHADOW.call(this, shadowRootInitDict);
988
- callback(shadowRoot);
989
- return shadowRoot;
990
- };
760
+ function Ct(t) {
761
+ he == null || ue() || (Element.prototype.attachShadow = function(e) {
762
+ const r = he.call(this, e);
763
+ return t(r), r;
764
+ });
991
765
  }
992
- function createPausableQueue(job, ...queueItems) {
993
- const queue = new Set(queueItems);
994
- let running = false;
995
- const flush = () => {
996
- for (const queuedNode of queue) {
997
- job(queuedNode);
998
- }
999
- queue.clear();
766
+ function kt(t, ...e) {
767
+ const r = new Set(e);
768
+ let a = !1;
769
+ const n = () => {
770
+ for (const o of r)
771
+ t(o);
772
+ r.clear();
1000
773
  };
1001
774
  return {
1002
775
  isRunning() {
1003
- return running;
776
+ return a;
1004
777
  },
1005
- schedule(node) {
1006
- queue.add(node);
1007
- if (running) {
1008
- flush();
1009
- }
778
+ schedule(o) {
779
+ r.add(o), a && n();
1010
780
  },
1011
781
  stop() {
1012
- running = false;
782
+ a = !1;
1013
783
  },
1014
784
  run() {
1015
- if (running)
1016
- return;
1017
- running = true;
1018
- flush();
785
+ a || (a = !0, n());
1019
786
  }
1020
787
  };
1021
788
  }
1022
- const MUTATION_OBSERVER_INIT = {
1023
- childList: true,
1024
- subtree: true
789
+ const Et = {
790
+ childList: !0,
791
+ subtree: !0
792
+ }, _t = (t) => {
793
+ typeof queueMicrotask < "u" ? queueMicrotask(t) : typeof Promise < "u" ? Promise.resolve().then(() => t()) : setTimeout(() => t(), 0);
1025
794
  };
1026
- const nextMicrotask = (func) => {
1027
- if (typeof queueMicrotask !== "undefined")
1028
- queueMicrotask(func);
1029
- else if (typeof Promise !== "undefined")
1030
- Promise.resolve().then(() => func());
1031
- else
1032
- setTimeout(() => func(), 0);
1033
- };
1034
- function nodeListToArray(nodeList) {
1035
- if (typeof Symbol !== "undefined" && nodeList[Symbol.iterator] != null) {
1036
- return [...nodeList];
1037
- } else {
1038
- const arr = [];
1039
- for (let i = 0; i < nodeList.length; i++) {
1040
- arr[i] = nodeList[i];
1041
- }
1042
- return arr;
795
+ function me(t) {
796
+ if (typeof Symbol < "u" && t[Symbol.iterator] != null)
797
+ return [...t];
798
+ {
799
+ const e = [];
800
+ for (let r = 0; r < t.length; r++)
801
+ e[r] = t[r];
802
+ return e;
1043
803
  }
1044
804
  }
1045
- function queryRoot(root, query) {
1046
- if (isShady()) {
1047
- return new Set(nodeListToArray(window.ShadyDOM.nativeMethods.querySelectorAll.call(document.documentElement, query)));
1048
- }
1049
- return new Set(!("querySelectorAll" in root) ? [] : nodeListToArray(root.querySelectorAll(query)));
805
+ function Tt(t, e) {
806
+ return ue() ? new Set(me(window.ShadyDOM.nativeMethods.querySelectorAll.call(document.documentElement, e))) : new Set("querySelectorAll" in t ? me(t.querySelectorAll(e)) : []);
1050
807
  }
1051
- function mergeNodes(a, b) {
1052
- return /* @__PURE__ */ new Set([...a == null ? [] : a, ...b == null ? [] : b]);
808
+ function Mt(t, e) {
809
+ return /* @__PURE__ */ new Set([...t ?? [], ...e ?? []]);
1053
810
  }
1054
- function isDocumentOrShadowRoot(root) {
1055
- return "activeElement" in root;
811
+ function xt(t) {
812
+ return "activeElement" in t;
1056
813
  }
1057
- function observeMissingRoots(root = document.documentElement) {
1058
- if (isDocumentOrShadowRoot(root)) {
1059
- observeRoot(root);
1060
- }
1061
- if (isShady() && root instanceof ShadowRoot)
814
+ function Fe(t = document.documentElement) {
815
+ if (xt(t) && De(t), ue() && t instanceof ShadowRoot || !St())
1062
816
  return;
1063
- if (!supportsShadowRoots())
1064
- return;
1065
- const childNodes = root.childNodes;
1066
- const shadowRoot = "shadowRoot" in root && root.shadowRoot != null ? [root.shadowRoot] : [];
1067
- for (const node of [...childNodes, ...shadowRoot]) {
1068
- observeMissingRoots(node);
1069
- }
817
+ const e = t.childNodes, r = "shadowRoot" in t && t.shadowRoot != null ? [t.shadowRoot] : [];
818
+ for (const a of [...e, ...r])
819
+ Fe(a);
1070
820
  }
1071
- function isConnected(node) {
1072
- if ("isConnected" in Node.prototype)
1073
- return node.isConnected;
1074
- return node.ownerDocument == null || !(node.ownerDocument.compareDocumentPosition(node) & node.DOCUMENT_POSITION_DISCONNECTED);
821
+ function Rt(t) {
822
+ return "isConnected" in Node.prototype ? t.isConnected : t.ownerDocument == null || !(t.ownerDocument.compareDocumentPosition(t) & t.DOCUMENT_POSITION_DISCONNECTED);
1075
823
  }
1076
- const CONNECTION_OBSERVER_INTERNALS_MAP = /* @__PURE__ */ new Map();
1077
- function initializeConnectionObserver(observer, callback) {
1078
- const queue = /* @__PURE__ */ new Set();
1079
- const observedTargets = /* @__PURE__ */ new Set();
1080
- const rootToQuerySelectorToMatchedNodesMap = /* @__PURE__ */ new Map();
1081
- const nodeToLastConnectionValueMap = /* @__PURE__ */ new WeakMap();
1082
- let scheduled = false;
1083
- let flushing = false;
1084
- let hasFoundMissingRoots = false;
1085
- const flush = () => {
1086
- flushing = true;
1087
- const arr = [...queue];
1088
- if (arr.length > 0) {
1089
- callback(arr, observer);
1090
- }
1091
- queue.clear();
1092
- scheduled = false;
1093
- flushing = false;
1094
- };
1095
- const scheduleFlush = () => {
1096
- if (!scheduled) {
1097
- scheduled = true;
1098
- nextMicrotask(flush);
1099
- }
1100
- };
1101
- const addToQueue = (entry) => {
1102
- queue.add(entry);
1103
- if (!flushing) {
1104
- scheduleFlush();
1105
- }
1106
- };
1107
- const clearQueue = () => {
1108
- const items = [...queue];
1109
- queue.clear();
1110
- return items;
1111
- };
1112
- const clearObservedTargets = () => {
1113
- observedTargets.clear();
1114
- };
1115
- const queryRootAndHandleMutationChanges = (root, query) => {
1116
- let oldQuerySelectorMap = rootToQuerySelectorToMatchedNodesMap.get(root);
1117
- const currentNodes = queryRoot(root, query);
1118
- const oldNodes = oldQuerySelectorMap == null ? void 0 : oldQuerySelectorMap.get(query);
1119
- const mergedNodes = mergeNodes(currentNodes, oldNodes);
1120
- handleMutationChange(mergedNodes);
1121
- if (oldQuerySelectorMap == null) {
1122
- oldQuerySelectorMap = /* @__PURE__ */ new Map();
1123
- rootToQuerySelectorToMatchedNodesMap.set(root, oldQuerySelectorMap);
1124
- }
1125
- oldQuerySelectorMap.set(query, currentNodes);
1126
- };
1127
- const handleMutationChange = (targetNodes) => {
1128
- for (const targetNode of targetNodes) {
1129
- const lastValue = nodeToLastConnectionValueMap.get(targetNode);
1130
- const isTargetNodeConnected = isConnected(targetNode);
1131
- if (lastValue !== isTargetNodeConnected) {
1132
- nodeToLastConnectionValueMap.set(targetNode, isTargetNodeConnected);
1133
- addToQueue({
1134
- connected: isTargetNodeConnected,
1135
- target: targetNode
1136
- });
1137
- }
1138
- }
1139
- };
1140
- const addObservedTarget = (target) => {
1141
- rootObserverQueue.run();
1142
- if (!hasFoundMissingRoots) {
1143
- hasFoundMissingRoots = true;
1144
- observeMissingRoots();
1145
- }
1146
- observedTargets.add(target);
1147
- if (typeof target !== "string") {
1148
- handleMutationChange([target]);
1149
- } else {
1150
- for (const root of OBSERVED_ROOTS) {
1151
- queryRootAndHandleMutationChanges(root, target);
1152
- }
824
+ const W = /* @__PURE__ */ new Map();
825
+ function At(t, e) {
826
+ const r = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new WeakMap();
827
+ let i = !1, l = !1, c = !1;
828
+ const d = () => {
829
+ l = !0;
830
+ const p = [...r];
831
+ p.length > 0 && e(p, t), r.clear(), i = !1, l = !1;
832
+ }, h = () => {
833
+ i || (i = !0, _t(d));
834
+ }, C = (p) => {
835
+ r.add(p), l || h();
836
+ }, w = () => {
837
+ const p = [...r];
838
+ return r.clear(), p;
839
+ }, u = () => {
840
+ a.clear();
841
+ }, v = (p, k) => {
842
+ let x = n.get(p);
843
+ const I = Tt(p, k), G = x?.get(k), X = Mt(I, G);
844
+ b(X), x == null && (x = /* @__PURE__ */ new Map(), n.set(p, x)), x.set(k, I);
845
+ }, b = (p) => {
846
+ for (const k of p) {
847
+ const x = o.get(k), I = Rt(k);
848
+ x !== I && (o.set(k, I), C({
849
+ connected: I,
850
+ target: k
851
+ }));
1153
852
  }
853
+ }, g = {
854
+ observedTargets: a,
855
+ queryRootAndHandleMutationChanges: v,
856
+ handleMutationChange: b,
857
+ addObservedTarget: (p) => {
858
+ if (ie.run(), c || (c = !0, Fe()), a.add(p), typeof p != "string")
859
+ b([p]);
860
+ else
861
+ for (const k of oe)
862
+ v(k, p);
863
+ },
864
+ clearObservedTargets: u,
865
+ clearQueue: w
1154
866
  };
1155
- const internals = {
1156
- observedTargets,
1157
- queryRootAndHandleMutationChanges,
1158
- handleMutationChange,
1159
- addObservedTarget,
1160
- clearObservedTargets,
1161
- clearQueue
1162
- };
1163
- CONNECTION_OBSERVER_INTERNALS_MAP.set(observer, internals);
867
+ W.set(t, g);
1164
868
  }
1165
- const mutationCallback = (mutations) => {
1166
- for (const mutation of mutations) {
1167
- if (mutation.type !== "childList")
1168
- continue;
1169
- for (const observer of CONNECTION_OBSERVER_INTERNALS_MAP.values()) {
1170
- for (const target of observer.observedTargets) {
1171
- if (typeof target === "string") {
1172
- observer.queryRootAndHandleMutationChanges(mutation.target, target);
1173
- } else {
1174
- observer.handleMutationChange([target]);
1175
- }
1176
- }
1177
- }
1178
- }
1179
- };
1180
- const OBSERVED_ROOTS = /* @__PURE__ */ new Set();
1181
- const observeRoot = /* @__PURE__ */ (() => {
1182
- let instance;
1183
- return function(root) {
1184
- if (OBSERVED_ROOTS.has(root))
1185
- return;
1186
- OBSERVED_ROOTS.add(root);
1187
- if (instance == null) {
1188
- instance = new MutationObserver(mutationCallback);
1189
- }
1190
- instance.observe(root, MUTATION_OBSERVER_INIT);
869
+ const $t = (t) => {
870
+ for (const e of t)
871
+ if (e.type === "childList")
872
+ for (const r of W.values())
873
+ for (const a of r.observedTargets)
874
+ typeof a == "string" ? r.queryRootAndHandleMutationChanges(e.target, a) : r.handleMutationChange([a]);
875
+ }, oe = /* @__PURE__ */ new Set(), De = /* @__PURE__ */ (() => {
876
+ let t;
877
+ return function(e) {
878
+ oe.has(e) || (oe.add(e), t == null && (t = new MutationObserver($t)), t.observe(e, Et));
1191
879
  };
1192
- })();
1193
- const rootObserverQueue = createPausableQueue(observeRoot, document.documentElement);
1194
- class ConnectionObserver {
1195
- constructor(callback) {
1196
- if (new.target === void 0) {
1197
- throw new TypeError(`Constructor ${ConnectionObserver.name} requires 'new'`);
1198
- }
1199
- if (callback === void 0) {
1200
- throw new ReferenceError(`Failed to construct '${ConnectionObserver.name}': 1 argument required, but only 0 present.`);
1201
- } else if (typeof callback !== "function") {
1202
- throw new TypeError(`Failed to construct '${ConnectionObserver.name}': The callback provided as parameter 1 is not a function.`);
1203
- }
1204
- initializeConnectionObserver(this, callback);
880
+ })(), ie = kt(De, document.documentElement);
881
+ class N {
882
+ constructor(e) {
883
+ if (new.target === void 0)
884
+ throw new TypeError(`Constructor ${N.name} requires 'new'`);
885
+ if (e === void 0)
886
+ throw new ReferenceError(`Failed to construct '${N.name}': 1 argument required, but only 0 present.`);
887
+ if (typeof e != "function")
888
+ throw new TypeError(`Failed to construct '${N.name}': The callback provided as parameter 1 is not a function.`);
889
+ At(this, e);
1205
890
  }
1206
891
  /**
1207
892
  * The Symbol.@@toStringTag value
1208
893
  */
1209
894
  get [Symbol.toStringTag]() {
1210
- return `ConnectionObserver`;
895
+ return "ConnectionObserver";
1211
896
  }
1212
897
  /**
1213
898
  * Observe the given node or query selector for connections/disconnections.
@@ -1215,153 +900,126 @@ class ConnectionObserver {
1215
900
  * as for example "img[data-some-attr]", for each new MutationRecord, the query selector
1216
901
  * will be executed and the matched nodes will be observed for connections/disconnections
1217
902
  */
1218
- observe(target) {
1219
- if (target === void 0) {
1220
- throw new ReferenceError(`Failed to execute '${this.observe.name}' on '${ConnectionObserver.name}': 1 argument required, but only 0 present.`);
1221
- } else if (typeof target !== "string" && !(target instanceof Node)) {
1222
- throw new TypeError(`Failed to execute '${this.observe.name}' on '${ConnectionObserver.name}': parameter 1 is not of type 'Node' or a DOMString.`);
1223
- }
1224
- const internals = CONNECTION_OBSERVER_INTERNALS_MAP.get(this);
1225
- if (internals == null)
1226
- return;
1227
- internals.addObservedTarget(target);
903
+ observe(e) {
904
+ if (e === void 0)
905
+ throw new ReferenceError(`Failed to execute '${this.observe.name}' on '${N.name}': 1 argument required, but only 0 present.`);
906
+ if (typeof e != "string" && !(e instanceof Node))
907
+ throw new TypeError(`Failed to execute '${this.observe.name}' on '${N.name}': parameter 1 is not of type 'Node' or a DOMString.`);
908
+ const r = W.get(this);
909
+ r?.addObservedTarget(e);
1228
910
  }
1229
911
  /**
1230
912
  * Takes the records immediately (instead of waiting for the next flush)
1231
913
  */
1232
914
  takeRecords() {
1233
- const internals = CONNECTION_OBSERVER_INTERNALS_MAP.get(this);
1234
- if (internals == null)
1235
- return [];
1236
- return internals.clearQueue();
915
+ const e = W.get(this);
916
+ return e == null ? [] : e.clearQueue();
1237
917
  }
1238
918
  /**
1239
919
  * Disconnects the ConnectionObserver such that none of its callbacks will be invoked any longer
1240
920
  */
1241
921
  disconnect() {
1242
- const internals = CONNECTION_OBSERVER_INTERNALS_MAP.get(this);
1243
- if (internals == null)
1244
- return;
1245
- internals.clearObservedTargets();
922
+ const e = W.get(this);
923
+ e?.clearObservedTargets();
1246
924
  }
1247
925
  }
1248
- patchElementPrototypeAttachShadow(rootObserverQueue.schedule.bind(rootObserverQueue));
1249
- function radEventListener(element, ...args) {
1250
- element.addEventListener(...args);
1251
- return () => {
1252
- element.removeEventListener(...args);
926
+ Ct(ie.schedule.bind(ie));
927
+ function Ft(t, ...e) {
928
+ return t.addEventListener(...e), () => {
929
+ t.removeEventListener(...e);
1253
930
  };
1254
931
  }
1255
- function rad(element, gen) {
1256
- let cleanup;
1257
- gen((listener, options) => {
1258
- element.addEventListener(listener, options);
1259
- cleanup = () => element.removeEventListener(listener, options);
1260
- });
1261
- if (!cleanup) {
932
+ function Dt(t, e) {
933
+ let r;
934
+ if (e((a, n) => {
935
+ t.addEventListener(a, n), r = () => t.removeEventListener(a, n);
936
+ }), !r)
1262
937
  throw new Error("you forgot to add event listener");
1263
- }
1264
- return cleanup;
938
+ return r;
1265
939
  }
1266
- function isBufferDetached(buffer) {
1267
- const actualBuffer = getBuffer(buffer);
1268
- if ("detached" in actualBuffer) {
1269
- const detached = actualBuffer.detached;
1270
- return detached;
1271
- }
940
+ function se(t) {
941
+ const e = Ie(t);
942
+ if ("detached" in e)
943
+ return e.detached;
1272
944
  try {
1273
- new Uint8Array(actualBuffer);
1274
- return false;
1275
- } catch (e) {
1276
- return true;
945
+ return new Uint8Array(e), !1;
946
+ } catch {
947
+ return !0;
1277
948
  }
1278
949
  }
1279
- class VideoFrameProcessor {
1280
- #canvas;
1281
- #context2d = null;
1282
- #contextWebGl2 = null;
1283
- #webGl2Texture = null;
1284
- #webGl2Framebuffer = null;
1285
- #buffer = null;
1286
- #cachedWidth = 0;
1287
- #cachedHeight = 0;
1288
- #canvasRenderingMode;
1289
- #requiredPackAlignment = 4;
950
+ class It {
951
+ #e;
952
+ #o = null;
953
+ #a = null;
954
+ #r = null;
955
+ #n = null;
956
+ #t = null;
957
+ #s = 0;
958
+ #l = 0;
959
+ #i;
960
+ #u = 4;
1290
961
  /**
1291
962
  * Creates a new VideoFrameProcessor.
1292
963
  *
1293
964
  * @param options - The options for the VideoFrameProcessor.
1294
965
  */
1295
- constructor(options = {}) {
1296
- const { canvasRenderingMode = "webgl2", fallbackWebGlTo2d = true } = options;
1297
- this.#canvasRenderingMode = canvasRenderingMode;
1298
- this.#canvas = document.createElement("canvas");
1299
- if (canvasRenderingMode === "2d") {
1300
- this.#initialize2dContext();
1301
- } else if (canvasRenderingMode === "webgl2") {
966
+ constructor(e = {}) {
967
+ const { canvasRenderingMode: r = "webgl2", fallbackWebGlTo2d: a = !0 } = e;
968
+ if (this.#i = r, this.#e = document.createElement("canvas"), r === "2d")
969
+ this.#d();
970
+ else if (r === "webgl2")
1302
971
  try {
1303
- this.#initializeWebGl2Context();
1304
- } catch (error) {
1305
- if (fallbackWebGlTo2d) {
972
+ this.#h();
973
+ } catch (n) {
974
+ if (a)
1306
975
  console.warn(
1307
976
  "Failed to create WebGL2 context, falling back to 2D canvas"
1308
- );
1309
- this.#canvasRenderingMode = "2d";
1310
- this.#initialize2dContext();
1311
- } else {
1312
- throw error;
1313
- }
977
+ ), this.#i = "2d", this.#d();
978
+ else
979
+ throw n;
1314
980
  }
1315
- } else {
981
+ else
1316
982
  throw new Error(
1317
- `Unsupported rendering context: ${canvasRenderingMode}`
983
+ `Unsupported rendering context: ${r}`
1318
984
  );
1319
- }
1320
985
  }
1321
986
  /**
1322
987
  * Initializes the 2D canvas context.
1323
988
  */
1324
- #initialize2dContext() {
1325
- const ctx = this.#canvas.getContext("2d", {
1326
- alpha: false,
1327
- willReadFrequently: true
989
+ #d() {
990
+ const e = this.#e.getContext("2d", {
991
+ alpha: !1,
992
+ willReadFrequently: !0
1328
993
  });
1329
- if (!ctx) throw new Error("CanvasRenderingContext2D is missing!");
1330
- this.#context2d = ctx;
994
+ if (!e) throw new Error("CanvasRenderingContext2D is missing!");
995
+ this.#o = e;
1331
996
  }
1332
997
  /**
1333
998
  * Initializes the WebGL2 context and resources.
1334
999
  */
1335
- #initializeWebGl2Context() {
1336
- const ctx = this.#canvas.getContext("webgl2", {
1337
- alpha: false,
1338
- depth: false,
1339
- stencil: false,
1340
- antialias: false,
1341
- premultipliedAlpha: false,
1342
- preserveDrawingBuffer: false,
1343
- desynchronized: false,
1000
+ #h() {
1001
+ const e = this.#e.getContext("webgl2", {
1002
+ alpha: !1,
1003
+ depth: !1,
1004
+ stencil: !1,
1005
+ antialias: !1,
1006
+ premultipliedAlpha: !1,
1007
+ preserveDrawingBuffer: !1,
1008
+ desynchronized: !1,
1344
1009
  powerPreference: "high-performance"
1345
1010
  });
1346
- if (!ctx) throw new Error("WebGL2RenderingContext is missing!");
1347
- this.#contextWebGl2 = ctx;
1348
- const texture = ctx.createTexture();
1349
- if (!texture) throw new Error("Failed to create WebGL texture");
1350
- this.#webGl2Texture = texture;
1351
- ctx.bindTexture(ctx.TEXTURE_2D, texture);
1352
- ctx.texParameteri(ctx.TEXTURE_2D, ctx.TEXTURE_WRAP_S, ctx.CLAMP_TO_EDGE);
1353
- ctx.texParameteri(ctx.TEXTURE_2D, ctx.TEXTURE_WRAP_T, ctx.CLAMP_TO_EDGE);
1354
- ctx.texParameteri(ctx.TEXTURE_2D, ctx.TEXTURE_MIN_FILTER, ctx.NEAREST);
1355
- ctx.texParameteri(ctx.TEXTURE_2D, ctx.TEXTURE_MAG_FILTER, ctx.NEAREST);
1356
- const framebuffer = ctx.createFramebuffer();
1357
- if (!framebuffer) throw new Error("Failed to create framebuffer");
1358
- this.#webGl2Framebuffer = framebuffer;
1359
- ctx.bindFramebuffer(ctx.FRAMEBUFFER, framebuffer);
1360
- ctx.framebufferTexture2D(
1361
- ctx.FRAMEBUFFER,
1362
- ctx.COLOR_ATTACHMENT0,
1363
- ctx.TEXTURE_2D,
1364
- texture,
1011
+ if (!e) throw new Error("WebGL2RenderingContext is missing!");
1012
+ this.#a = e;
1013
+ const r = e.createTexture();
1014
+ if (!r) throw new Error("Failed to create WebGL texture");
1015
+ this.#r = r, e.bindTexture(e.TEXTURE_2D, r), 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);
1016
+ const a = e.createFramebuffer();
1017
+ if (!a) throw new Error("Failed to create framebuffer");
1018
+ this.#n = a, e.bindFramebuffer(e.FRAMEBUFFER, a), e.framebufferTexture2D(
1019
+ e.FRAMEBUFFER,
1020
+ e.COLOR_ATTACHMENT0,
1021
+ e.TEXTURE_2D,
1022
+ r,
1365
1023
  0
1366
1024
  );
1367
1025
  }
@@ -1373,19 +1031,17 @@ class VideoFrameProcessor {
1373
1031
  *
1374
1032
  * @param arrayBuffer - The array buffer to reattach.
1375
1033
  */
1376
- reattachArrayBuffer(arrayBuffer) {
1377
- const actualBuffer = getBuffer(arrayBuffer);
1378
- if (isBufferDetached(actualBuffer)) {
1034
+ reattachArrayBuffer(e) {
1035
+ const r = Ie(e);
1036
+ if (se(r))
1379
1037
  throw new Error("Can't use a detached array buffer!");
1380
- }
1381
- const requiredSize = this.#cachedWidth * this.#cachedHeight * 4;
1382
- if (actualBuffer.byteLength === requiredSize) {
1383
- this.#buffer = new Uint8ClampedArray(actualBuffer);
1384
- } else {
1038
+ const a = this.#s * this.#l * 4;
1039
+ if (r.byteLength === a)
1040
+ this.#t = new Uint8ClampedArray(r);
1041
+ else
1385
1042
  throw new Error(
1386
- `ArrayBuffer size mismatch: expected ${requiredSize}, got ${actualBuffer.byteLength}`
1043
+ `ArrayBuffer size mismatch: expected ${a}, got ${r.byteLength}`
1387
1044
  );
1388
- }
1389
1045
  }
1390
1046
  /**
1391
1047
  * Used to check if the processor owns the buffer.
@@ -1393,10 +1049,9 @@ class VideoFrameProcessor {
1393
1049
  * @returns true if the processor owns the buffer, false otherwise.
1394
1050
  */
1395
1051
  isBufferDetached() {
1396
- if (!this.#buffer) {
1052
+ if (!this.#t)
1397
1053
  throw new Error("Buffer is missing!");
1398
- }
1399
- return isBufferDetached(this.#buffer.buffer);
1054
+ return se(this.#t.buffer);
1400
1055
  }
1401
1056
  /**
1402
1057
  * Extracts image data from a source element.
@@ -1405,8 +1060,8 @@ class VideoFrameProcessor {
1405
1060
  * @param area - The extraction area.
1406
1061
  * @returns The image data.
1407
1062
  */
1408
- getImageData(source, area) {
1409
- return this.#canvasRenderingMode === "2d" ? this.#getImageData2d(source, area) : this.#getImageDataWebGl2(source, area);
1063
+ getImageData(e, r) {
1064
+ return this.#i === "2d" ? this.#m(e, r) : this.#f(e, r);
1410
1065
  }
1411
1066
  /**
1412
1067
  * Used to get the current ImageData object with the current buffer. Useful
@@ -1416,10 +1071,9 @@ class VideoFrameProcessor {
1416
1071
  * @returns ImageData object with the current buffer
1417
1072
  */
1418
1073
  getCurrentImageData() {
1419
- if (!this.#buffer) {
1074
+ if (!this.#t)
1420
1075
  throw new Error("Buffer is missing!");
1421
- }
1422
- return new ImageData(this.#buffer, this.#cachedWidth, this.#cachedHeight);
1076
+ return new ImageData(this.#t, this.#s, this.#l);
1423
1077
  }
1424
1078
  /**
1425
1079
  * Extract image data using 2D canvas.
@@ -1428,18 +1082,11 @@ class VideoFrameProcessor {
1428
1082
  * @param area - The extraction area.
1429
1083
  * @returns The image data.
1430
1084
  */
1431
- #getImageData2d(source, area) {
1432
- if (!this.#context2d)
1085
+ #m(e, r) {
1086
+ if (!this.#o)
1433
1087
  throw new Error("CanvasRenderingContext2D is missing!");
1434
- const fullWidth = "videoWidth" in source ? source.videoWidth : source.width;
1435
- const fullHeight = "videoHeight" in source ? source.videoHeight : source.height;
1436
- const x = area?.x ?? 0;
1437
- const y = area?.y ?? 0;
1438
- const w = area?.width ?? fullWidth;
1439
- const h = area?.height ?? fullHeight;
1440
- this.#updateCanvasSize(w, h);
1441
- this.#context2d.drawImage(source, x, y, w, h);
1442
- return this.#context2d.getImageData(0, 0, w, h);
1088
+ const a = "videoWidth" in e ? e.videoWidth : e.width, n = "videoHeight" in e ? e.videoHeight : e.height, o = r?.x ?? 0, i = r?.y ?? 0, l = r?.width ?? a, c = r?.height ?? n;
1089
+ return this.#c(l, c), this.#o.drawImage(e, o, i, l, c), this.#o.getImageData(0, 0, l, c);
1443
1090
  }
1444
1091
  /**
1445
1092
  * Extract image data using WebGL2.
@@ -1448,43 +1095,26 @@ class VideoFrameProcessor {
1448
1095
  * @param area - The extraction area.
1449
1096
  * @returns The image data.
1450
1097
  */
1451
- #getImageDataWebGl2(source, area) {
1452
- if (!this.#contextWebGl2 || !this.#webGl2Texture || !this.#webGl2Framebuffer) {
1098
+ #f(e, r) {
1099
+ if (!this.#a || !this.#r || !this.#n)
1453
1100
  throw new Error("WebGL2 context or resources are missing!");
1454
- }
1455
- const fullWidth = "videoWidth" in source ? source.videoWidth : source.width;
1456
- const fullHeight = "videoHeight" in source ? source.videoHeight : source.height;
1457
- const x = area?.x ?? 0;
1458
- const y = area?.y ?? 0;
1459
- const w = area?.width ?? fullWidth;
1460
- const h = area?.height ?? fullHeight;
1461
- const requiredSize = w * h * 4;
1462
- this.#updateCanvasSize(w, h);
1463
- if (this.isBufferDetached()) {
1101
+ const a = "videoWidth" in e ? e.videoWidth : e.width, n = "videoHeight" in e ? e.videoHeight : e.height, o = r?.x ?? 0, i = r?.y ?? 0, l = r?.width ?? a, c = r?.height ?? n, d = l * c * 4;
1102
+ if (this.#c(l, c), this.isBufferDetached())
1464
1103
  throw new Error("Buffer is detached!");
1465
- }
1466
- if (!this.#buffer || this.#buffer.length !== requiredSize) {
1467
- this.#buffer = new Uint8ClampedArray(requiredSize);
1468
- }
1469
- const gl = this.#contextWebGl2;
1470
- gl.bindTexture(gl.TEXTURE_2D, this.#webGl2Texture);
1471
- gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, source);
1472
- gl.bindFramebuffer(gl.FRAMEBUFFER, this.#webGl2Framebuffer);
1104
+ (!this.#t || this.#t.length !== d) && (this.#t = new Uint8ClampedArray(d));
1105
+ const h = this.#a;
1106
+ h.bindTexture(h.TEXTURE_2D, this.#r), h.texImage2D(h.TEXTURE_2D, 0, h.RGBA, h.RGBA, h.UNSIGNED_BYTE, e), h.bindFramebuffer(h.FRAMEBUFFER, this.#n);
1473
1107
  try {
1474
- gl.pixelStorei(gl.PACK_ALIGNMENT, this.#requiredPackAlignment);
1475
- gl.readPixels(x, y, w, h, gl.RGBA, gl.UNSIGNED_BYTE, this.#buffer);
1476
- } catch (error) {
1477
- if (this.#requiredPackAlignment !== 1) {
1478
- this.#requiredPackAlignment = 1;
1479
- gl.pixelStorei(gl.PACK_ALIGNMENT, 1);
1480
- const newBuffer = new Uint8ClampedArray(requiredSize);
1481
- gl.readPixels(0, 0, w, h, gl.RGBA, gl.UNSIGNED_BYTE, newBuffer);
1482
- this.#buffer = newBuffer;
1483
- return new ImageData(newBuffer, w, h);
1108
+ h.pixelStorei(h.PACK_ALIGNMENT, this.#u), h.readPixels(o, i, l, c, h.RGBA, h.UNSIGNED_BYTE, this.#t);
1109
+ } catch (C) {
1110
+ if (this.#u !== 1) {
1111
+ this.#u = 1, h.pixelStorei(h.PACK_ALIGNMENT, 1);
1112
+ const w = new Uint8ClampedArray(d);
1113
+ return h.readPixels(0, 0, l, c, h.RGBA, h.UNSIGNED_BYTE, w), this.#t = w, new ImageData(w, l, c);
1484
1114
  }
1485
- throw error;
1115
+ throw C;
1486
1116
  }
1487
- return new ImageData(this.#buffer, w, h);
1117
+ return new ImageData(this.#t, l, c);
1488
1118
  }
1489
1119
  /**
1490
1120
  * Update canvas dimensions if needed.
@@ -1494,116 +1124,104 @@ class VideoFrameProcessor {
1494
1124
  * @param width - The width of the canvas.
1495
1125
  * @param height - The height of the canvas.
1496
1126
  */
1497
- #updateCanvasSize(width, height) {
1498
- if (this.#cachedWidth !== width || this.#cachedHeight !== height) {
1499
- this.#canvas.width = width;
1500
- this.#canvas.height = height;
1501
- this.#cachedWidth = width;
1502
- this.#cachedHeight = height;
1503
- const requiredSize = width * height * 4;
1504
- this.#buffer = new Uint8ClampedArray(requiredSize);
1127
+ #c(e, r) {
1128
+ if (this.#s !== e || this.#l !== r) {
1129
+ this.#e.width = e, this.#e.height = r, this.#s = e, this.#l = r;
1130
+ const a = e * r * 4;
1131
+ this.#t = new Uint8ClampedArray(a);
1505
1132
  }
1506
1133
  }
1507
1134
  /**
1508
1135
  * Clean up resources.
1509
1136
  */
1510
1137
  dispose() {
1511
- if (this.#contextWebGl2) {
1512
- if (this.#webGl2Texture) {
1513
- this.#contextWebGl2.deleteTexture(this.#webGl2Texture);
1514
- this.#webGl2Texture = null;
1515
- }
1516
- if (this.#webGl2Framebuffer) {
1517
- this.#contextWebGl2.deleteFramebuffer(this.#webGl2Framebuffer);
1518
- this.#webGl2Framebuffer = null;
1519
- }
1520
- }
1521
- this.#context2d = null;
1522
- this.#contextWebGl2 = null;
1523
- this.#buffer = null;
1138
+ 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;
1524
1139
  }
1525
1140
  }
1526
- const getBuffer = (buffer) => {
1527
- if (ArrayBuffer.isView(buffer)) {
1528
- return buffer.buffer;
1529
- } else {
1530
- return buffer;
1531
- }
1532
- };
1533
- const defaultCameraManagerOptions = {
1534
- mirrorFrontCameras: true
1141
+ const Ie = (t) => ArrayBuffer.isView(t) ? t.buffer : t, zt = {
1142
+ mirrorFrontCameras: !0,
1143
+ preferredResolution: "1080p"
1535
1144
  };
1536
- class CameraManager {
1537
- #resumeRequest;
1538
- #resolution = "4k";
1539
- #extractionArea;
1540
- #videoFrameRequestId;
1541
- #videoFrameProcessor;
1542
- #mirrorFrontCameras;
1543
- #eventListenerCleanup;
1145
+ class ta {
1146
+ #e;
1147
+ /**
1148
+ * The desired video resolution for camera streams. This is used as the ideal resolution
1149
+ * when starting camera streams. If a camera doesn't support the specified resolution,
1150
+ * the camera will automatically fall back to the next lower supported resolution in this order:
1151
+ * 4k → 1080p → 720p. The actual resolution used may differ from this setting based on
1152
+ * camera capabilities and system constraints.
1153
+ */
1154
+ #o;
1155
+ #a;
1156
+ #r;
1157
+ #n;
1158
+ #t;
1159
+ #s;
1544
1160
  /**
1545
1161
  * If true, the user has initiated an abort. This will prevent the
1546
1162
  * CameraManager from throwing errors when the user interrupts the process.
1547
1163
  */
1548
- #userInitiatedAbort = false;
1164
+ #l = !1;
1549
1165
  /**
1550
1166
  * If true, the user has initiated an abort. This will prevent the
1551
1167
  * CameraManager from throwing errors when the user interrupts the process.
1552
1168
  */
1553
1169
  get userInitiatedAbort() {
1554
- return this.#userInitiatedAbort;
1170
+ return this.#l;
1555
1171
  }
1556
- set userInitiatedAbort(value) {
1557
- this.#userInitiatedAbort = value;
1172
+ set userInitiatedAbort(e) {
1173
+ this.#l = e;
1558
1174
  }
1559
1175
  /**
1560
1176
  * Sets the area of the video frame that will be extracted.
1561
1177
  *
1562
1178
  * @param extractionArea The area of the video frame that will be extracted.
1563
1179
  */
1564
- setExtractionArea(extractionArea) {
1565
- this.#extractionArea = extractionArea;
1180
+ setExtractionArea(e) {
1181
+ this.#a = e;
1566
1182
  }
1567
1183
  /**
1568
1184
  * Callbacks that will be triggered on each frame when the playback state is
1569
1185
  * "capturing".
1570
1186
  */
1571
- #frameCaptureCallbacks = /* @__PURE__ */ new Set();
1187
+ #i = /* @__PURE__ */ new Set();
1572
1188
  /**
1573
1189
  * Creates a new CameraManager instance.
1574
1190
  *
1575
1191
  * @param options - The options for the CameraManager.
1576
1192
  * @param videoFrameProcessorOptions - The options for the VideoFrameProcessor.
1577
1193
  */
1578
- constructor(options = {}, videoFrameProcessorOptions) {
1579
- const { mirrorFrontCameras } = {
1580
- ...defaultCameraManagerOptions,
1581
- ...options
1194
+ constructor(e = {}, r) {
1195
+ const { mirrorFrontCameras: a, preferredResolution: n } = {
1196
+ ...zt,
1197
+ ...e
1582
1198
  };
1583
- this.#videoFrameProcessor = new VideoFrameProcessor(
1584
- videoFrameProcessorOptions
1585
- );
1586
- this.#mirrorFrontCameras = mirrorFrontCameras;
1199
+ this.#o = n, this.#n = new It(
1200
+ r
1201
+ ), this.#t = a;
1587
1202
  }
1588
1203
  /**
1589
- * Sets the resolution of the camera stream.
1204
+ * Sets the desired video resolution for camera streams. This is used as the ideal resolution
1205
+ * when starting camera streams. If a camera doesn't support the specified resolution,
1206
+ * the camera will automatically fall back to the next lower supported resolution in this order:
1207
+ * 4k → 1080p → 720p. If there's an active stream, it will be restarted with the new resolution.
1590
1208
  *
1591
- * @param resolution - The resolution to set.
1209
+ * @param resolution - The ideal resolution to set for camera streams.
1592
1210
  */
1593
- setResolution = async (resolution) => {
1594
- this.#resolution = resolution;
1595
- const playbackState = this.getState().playbackState;
1596
- if (playbackState !== "idle") {
1597
- this.#resumeRequest = playbackState;
1598
- this.stopStream();
1599
- await this.startCameraStream();
1600
- }
1211
+ setResolution = async (e) => {
1212
+ this.#o = e;
1213
+ const r = this.getState().playbackState;
1214
+ r !== "idle" && (this.#e = r, this.stopStream(), await this.startCameraStream());
1601
1215
  };
1602
1216
  /**
1603
- * The resolution of the camera stream.
1217
+ * The desired video resolution for camera streams. This is used as the ideal resolution
1218
+ * when starting camera streams. If a camera doesn't support the specified resolution,
1219
+ * the camera will automatically fall back to the next lower supported resolution in this order:
1220
+ * 4k → 1080p → 720p. The actual resolution used may differ from this setting based on
1221
+ * camera capabilities and system constraints.
1604
1222
  */
1605
1223
  get resolution() {
1606
- return this.#resolution;
1224
+ return this.#o;
1607
1225
  }
1608
1226
  /**
1609
1227
  * True if there is a video playing or capturing
@@ -1611,16 +1229,16 @@ class CameraManager {
1611
1229
  * @see https://developer.mozilla.org/en-US/docs/Web/API/MediaSession/playbackState for more details.
1612
1230
  */
1613
1231
  get isActive() {
1614
- return cameraManagerStore.getState().playbackState !== "idle";
1232
+ return m.getState().playbackState !== "idle";
1615
1233
  }
1616
1234
  /**
1617
1235
  * Sets the facing filter.
1618
1236
  *
1619
1237
  * @param facingFilter - The facing filter.
1620
1238
  */
1621
- setFacingFilter(facingFilter) {
1622
- cameraManagerStore.setState({
1623
- facingFilter
1239
+ setFacingFilter(e) {
1240
+ m.setState({
1241
+ facingFilter: e
1624
1242
  });
1625
1243
  }
1626
1244
  /**
@@ -1630,39 +1248,30 @@ class CameraManager {
1630
1248
  * @returns The cameras that are available to the user, filtered by the facing mode.
1631
1249
  */
1632
1250
  async getCameraDevices() {
1633
- let allCameras = cameraManagerStore.getState().cameras;
1634
- const facingFilter = cameraManagerStore.getState().facingFilter;
1635
- if (!allCameras.length) {
1636
- await this.refreshCameraDevices();
1637
- }
1638
- allCameras = cameraManagerStore.getState().cameras;
1639
- if (!facingFilter) {
1640
- return allCameras;
1641
- }
1642
- const filteredCameras = allCameras.filter(
1643
- (camera) => facingFilter.includes(camera.facingMode)
1644
- );
1645
- return filteredCameras;
1251
+ let e = m.getState().cameras;
1252
+ const r = m.getState().facingFilter;
1253
+ return e.length || await this.refreshCameraDevices(), e = m.getState().cameras, r ? e.filter(
1254
+ (n) => r.includes(n.facingMode)
1255
+ ) : e;
1646
1256
  }
1647
1257
  /**
1648
1258
  * Single-time setup for a video element.
1649
1259
  *
1650
1260
  * @param videoElement - The video element to initialize.
1651
1261
  */
1652
- #initVideoElement(videoElement) {
1653
- if (!(videoElement instanceof HTMLVideoElement)) {
1262
+ #u(e) {
1263
+ if (!(e instanceof HTMLVideoElement))
1654
1264
  throw new Error(
1655
- `Expected an HTMLVideoElement, got ${typeof videoElement}`,
1265
+ `Expected an HTMLVideoElement, got ${typeof e}`,
1656
1266
  {
1657
- cause: videoElement
1267
+ cause: e
1658
1268
  }
1659
1269
  );
1660
- }
1661
- cameraManagerStore.setState({
1662
- videoElement
1270
+ m.setState({
1271
+ videoElement: e
1663
1272
  });
1664
- const videoEventCleanup = rad(videoElement, (add) => {
1665
- const events = [
1273
+ const r = Dt(e, (i) => {
1274
+ [
1666
1275
  "abort"
1667
1276
  // "error",
1668
1277
  // "canplay",
@@ -1681,48 +1290,36 @@ class CameraManager {
1681
1290
  // "timeupdate",
1682
1291
  // "ratechange",
1683
1292
  // "durationchange",
1684
- ];
1685
- events.forEach((event) => {
1686
- add(event, () => {
1687
- console.debug(`Video event: ${event}`);
1293
+ ].forEach((c) => {
1294
+ i(c, () => {
1295
+ console.debug(`Video event: ${c}`);
1688
1296
  });
1689
1297
  });
1690
1298
  });
1691
- const connectionObserver = new ConnectionObserver((entries) => {
1692
- if (!entries[0].connected) {
1693
- this.releaseVideoElement();
1694
- }
1695
- });
1696
- connectionObserver.observe(videoElement);
1697
- videoElement.setAttribute("playsInline", "");
1698
- videoElement.setAttribute("muted", "");
1699
- videoElement.controls = false;
1700
- let previousPlaybackState = "idle";
1701
- const cleanupVisibilityListener = radEventListener(
1299
+ new N((i) => {
1300
+ i[0].connected || this.releaseVideoElement();
1301
+ }).observe(e), e.setAttribute("playsInline", ""), e.setAttribute("muted", ""), e.controls = !1;
1302
+ let n = "idle";
1303
+ const o = Ft(
1702
1304
  document,
1703
1305
  "visibilitychange",
1704
1306
  async () => {
1705
- const isHidden = document.hidden;
1706
- if (isHidden) {
1707
- previousPlaybackState = cameraManagerStore.getState().playbackState;
1708
- this.stopStream();
1307
+ if (document.hidden) {
1308
+ n = m.getState().playbackState, this.stopStream();
1709
1309
  return;
1710
1310
  }
1711
- switch (previousPlaybackState) {
1311
+ switch (n) {
1712
1312
  case "playback":
1713
- await this.startCameraStream();
1714
- await this.startPlayback();
1313
+ await this.startCameraStream(), await this.startPlayback();
1715
1314
  break;
1716
1315
  case "capturing":
1717
- await this.startCameraStream();
1718
- await this.startFrameCapture();
1316
+ await this.startCameraStream(), await this.startFrameCapture();
1719
1317
  break;
1720
1318
  }
1721
1319
  }
1722
1320
  );
1723
- this.#eventListenerCleanup = () => {
1724
- cleanupVisibilityListener();
1725
- videoEventCleanup();
1321
+ this.#s = () => {
1322
+ o(), r();
1726
1323
  };
1727
1324
  }
1728
1325
  /**
@@ -1730,15 +1327,14 @@ class CameraManager {
1730
1327
  *
1731
1328
  * @param videoElement - The video element to initialize.
1732
1329
  */
1733
- initVideoElement(videoElement) {
1330
+ initVideoElement(e) {
1734
1331
  try {
1735
- this.#initVideoElement(videoElement);
1736
- } catch (error) {
1737
- if (this.userInitiatedAbort) {
1332
+ this.#u(e);
1333
+ } catch (r) {
1334
+ if (this.userInitiatedAbort)
1738
1335
  this.reset();
1739
- } else {
1740
- throw error;
1741
- }
1336
+ else
1337
+ throw r;
1742
1338
  }
1743
1339
  }
1744
1340
  /**
@@ -1748,19 +1344,16 @@ class CameraManager {
1748
1344
  * @param frameCaptureCallback - The callback to add.
1749
1345
  * @returns a cleanup function to remove the callback
1750
1346
  */
1751
- addFrameCaptureCallback(frameCaptureCallback) {
1752
- this.#frameCaptureCallbacks.add(frameCaptureCallback);
1753
- return () => this.#frameCaptureCallbacks.delete(frameCaptureCallback);
1347
+ addFrameCaptureCallback(e) {
1348
+ return this.#i.add(e), () => this.#i.delete(e);
1754
1349
  }
1755
1350
  /**
1756
1351
  * Cleans up the video element, and stops the stream.
1757
1352
  */
1758
1353
  releaseVideoElement() {
1759
- this.#eventListenerCleanup?.();
1760
- cameraManagerStore.setState({
1354
+ this.#s?.(), m.setState({
1761
1355
  videoElement: void 0
1762
- });
1763
- this.stopStream();
1356
+ }), this.stopStream();
1764
1357
  }
1765
1358
  // TODO: might become a private method in the future as an implementation detail of `startStream`
1766
1359
  /**
@@ -1768,43 +1361,24 @@ class CameraManager {
1768
1361
  *
1769
1362
  * @param camera - The camera to select.
1770
1363
  */
1771
- async selectCamera(camera) {
1772
- const playbackState = cameraManagerStore.getState().playbackState;
1773
- if (playbackState !== "idle") {
1774
- this.#resumeRequest = playbackState;
1775
- }
1776
- const state = cameraManagerStore.getState();
1777
- if (state.selectedCamera === camera) {
1364
+ async selectCamera(e) {
1365
+ const r = m.getState().playbackState;
1366
+ r !== "idle" && (this.#e = r);
1367
+ const a = m.getState();
1368
+ if (a.selectedCamera === e) {
1778
1369
  console.debug("Already selected");
1779
1370
  return;
1780
1371
  }
1781
- if (state.isSwappingCamera) {
1372
+ if (a.isSwappingCamera) {
1782
1373
  console.debug("Already swapping");
1783
1374
  return;
1784
1375
  }
1785
- cameraManagerStore.setState({
1786
- isSwappingCamera: true
1787
- });
1788
- if (state.selectedCamera?.activeStream) {
1789
- console.debug("Stopping previous stream");
1790
- state.selectedCamera.stopStream();
1791
- }
1792
- if (state.videoElement) {
1793
- state.videoElement.srcObject = null;
1794
- }
1795
- cameraManagerStore.setState({
1796
- selectedCamera: camera,
1797
- isSwappingCamera: false
1798
- });
1799
- if (this.#resumeRequest === "playback") {
1800
- console.debug("Starting new stream");
1801
- await this.startPlayback();
1802
- }
1803
- if (this.#resumeRequest === "capturing") {
1804
- console.debug("Resuming frame capture");
1805
- await this.startFrameCapture();
1806
- }
1807
- this.#resumeRequest = void 0;
1376
+ m.setState({
1377
+ isSwappingCamera: !0
1378
+ }), a.selectedCamera?.activeStream && (console.debug("Stopping previous stream"), a.selectedCamera.stopStream()), a.videoElement && (a.videoElement.srcObject = null), m.setState({
1379
+ selectedCamera: e,
1380
+ isSwappingCamera: !1
1381
+ }), this.#e === "playback" && (console.debug("Starting new stream"), await this.startPlayback()), this.#e === "capturing" && (console.debug("Resuming frame capture"), await this.startFrameCapture()), this.#e = void 0;
1808
1382
  }
1809
1383
  /**
1810
1384
  * Refreshes available devices on the system and updates the state.
@@ -1812,50 +1386,38 @@ class CameraManager {
1812
1386
  * @returns resolves when the camera devices are refreshed
1813
1387
  */
1814
1388
  async refreshCameraDevices() {
1815
- if (cameraManagerStore.getState().isQueryingCameras || cameraManagerStore.getState().isSwappingCamera) {
1389
+ if (m.getState().isQueryingCameras || m.getState().isSwappingCamera) {
1816
1390
  console.debug("Already querying cameras");
1817
1391
  return;
1818
1392
  }
1819
- cameraManagerStore.setState({
1820
- isQueryingCameras: true
1393
+ m.setState({
1394
+ isQueryingCameras: !0
1821
1395
  });
1822
- const availableCameras = await obtainVideoInputDevices().catch((err) => {
1823
- cameraManagerStore.setState({
1824
- errorState: asError(err),
1825
- isQueryingCameras: false
1826
- });
1827
- throw err;
1828
- });
1829
- const cameras = createCameras(availableCameras);
1830
- cameras.forEach((camera) => {
1831
- if (camera.notifyStateChange) {
1832
- return;
1833
- }
1834
- camera.notifyStateChange = (camInstance, reason) => {
1396
+ const e = await ut().catch((a) => {
1397
+ throw m.setState({
1398
+ errorState: K(a),
1399
+ isQueryingCameras: !1
1400
+ }), a;
1401
+ }), r = gt(e);
1402
+ r.forEach((a) => {
1403
+ a.notifyStateChange || (a.notifyStateChange = (n, o) => {
1835
1404
  window.queueMicrotask(() => {
1836
- cameraManagerStore.setState({
1837
- cameras: [...cameraManagerStore.getState().cameras]
1405
+ m.setState({
1406
+ cameras: [...m.getState().cameras]
1838
1407
  });
1839
- const selectedCamera = cameraManagerStore.getState().selectedCamera;
1840
- if (!selectedCamera) {
1408
+ const i = m.getState().selectedCamera;
1409
+ if (!i)
1841
1410
  return;
1842
- }
1843
- let streamError;
1844
- if (typeof reason === "object" && reason !== null && "payload" in reason && reason.payload === "TRACK_END") {
1845
- streamError = new Error("Camera stream ended unexpectedly");
1846
- }
1847
- if (camInstance === selectedCamera) {
1848
- cameraManagerStore.setState({
1849
- selectedCamera,
1850
- errorState: streamError
1851
- });
1852
- }
1411
+ let l;
1412
+ typeof o == "object" && o !== null && "payload" in o && o.payload === "TRACK_END" && (l = new Error("Camera stream ended unexpectedly")), n === i && m.setState({
1413
+ selectedCamera: i,
1414
+ errorState: l
1415
+ });
1853
1416
  });
1854
- };
1855
- });
1856
- cameraManagerStore.setState({
1857
- cameras,
1858
- isQueryingCameras: false
1417
+ });
1418
+ }), m.setState({
1419
+ cameras: r,
1420
+ isQueryingCameras: !1
1859
1421
  });
1860
1422
  }
1861
1423
  /**
@@ -1864,34 +1426,29 @@ class CameraManager {
1864
1426
  * @returns resolves when playback starts
1865
1427
  */
1866
1428
  async startPlayback() {
1867
- const state = cameraManagerStore.getState();
1868
- if (this.isActive && !this.#resumeRequest) {
1869
- return;
1870
- }
1871
- if (!state.videoElement) {
1872
- console.warn("Starting playback - no video element present.");
1873
- return;
1874
- }
1875
- if (!state.selectedCamera) {
1876
- console.warn("Select a camera first.");
1877
- return;
1878
- }
1879
- if (!state.selectedCamera.activeStream) {
1880
- const stream = await state.selectedCamera.startStream(this.resolution);
1881
- state.videoElement.srcObject = stream;
1882
- }
1883
- try {
1884
- this.#applyMirrorIfNeeded();
1885
- await state.videoElement.play();
1886
- cameraManagerStore.setState({
1887
- playbackState: "playback"
1888
- });
1889
- } catch (error) {
1890
- console.error("Failed to start playback", error);
1891
- cameraManagerStore.setState({
1892
- errorState: asError(error)
1893
- });
1894
- throw error;
1429
+ const e = m.getState();
1430
+ if (!(this.isActive && !this.#e)) {
1431
+ if (!e.videoElement) {
1432
+ console.warn("Starting playback - no video element present.");
1433
+ return;
1434
+ }
1435
+ if (!e.selectedCamera) {
1436
+ console.warn("Select a camera first.");
1437
+ return;
1438
+ }
1439
+ if (!e.selectedCamera.activeStream) {
1440
+ const r = await e.selectedCamera.startStream(this.resolution);
1441
+ e.videoElement.srcObject = r;
1442
+ }
1443
+ try {
1444
+ this.#g(), await e.videoElement.play(), m.setState({
1445
+ playbackState: "playback"
1446
+ });
1447
+ } catch (r) {
1448
+ throw console.error("Failed to start playback", r), m.setState({
1449
+ errorState: K(r)
1450
+ }), r;
1451
+ }
1895
1452
  }
1896
1453
  }
1897
1454
  /**
@@ -1899,32 +1456,25 @@ class CameraManager {
1899
1456
  *
1900
1457
  * @returns resolves when frame capture starts
1901
1458
  */
1902
- async #startFrameCapture() {
1903
- const state = cameraManagerStore.getState();
1904
- if (this.userInitiatedAbort) {
1905
- return;
1906
- }
1907
- if (state.playbackState === "capturing" && this.#resumeRequest !== "capturing") {
1908
- return;
1909
- }
1910
- if (!state.videoElement) {
1911
- console.warn(
1912
- "Missing video element. Setup a video element first using `initVideoElement`"
1913
- );
1914
- return;
1915
- }
1916
- if (!state.selectedCamera) {
1917
- console.warn(
1918
- "No active camera! Select a camera first, or use `startCameraStream`"
1919
- );
1920
- return;
1459
+ async #d() {
1460
+ const e = m.getState();
1461
+ if (!this.userInitiatedAbort && !(e.playbackState === "capturing" && this.#e !== "capturing")) {
1462
+ if (!e.videoElement) {
1463
+ console.warn(
1464
+ "Missing video element. Setup a video element first using `initVideoElement`"
1465
+ );
1466
+ return;
1467
+ }
1468
+ if (!e.selectedCamera) {
1469
+ console.warn(
1470
+ "No active camera! Select a camera first, or use `startCameraStream`"
1471
+ );
1472
+ return;
1473
+ }
1474
+ await this.startPlayback(), m.setState({
1475
+ playbackState: "capturing"
1476
+ }), this.#c(), this.#e = void 0;
1921
1477
  }
1922
- await this.startPlayback();
1923
- cameraManagerStore.setState({
1924
- playbackState: "capturing"
1925
- });
1926
- this.#queueFrame();
1927
- this.#resumeRequest = void 0;
1928
1478
  }
1929
1479
  /**
1930
1480
  * Starts capturing frames from the video element.
@@ -1933,13 +1483,12 @@ class CameraManager {
1933
1483
  */
1934
1484
  startFrameCapture = async () => {
1935
1485
  try {
1936
- await this.#startFrameCapture();
1937
- } catch (error) {
1938
- if (this.userInitiatedAbort) {
1486
+ await this.#d();
1487
+ } catch (e) {
1488
+ if (this.userInitiatedAbort)
1939
1489
  this.reset();
1940
- } else {
1941
- throw error;
1942
- }
1490
+ else
1491
+ throw e;
1943
1492
  }
1944
1493
  };
1945
1494
  /**
@@ -1948,82 +1497,55 @@ class CameraManager {
1948
1497
  * @param params - The parameters for the camera stream.
1949
1498
  * @returns resolves when the camera stream starts
1950
1499
  */
1951
- async #startCameraStream({
1952
- autoplay = true,
1953
- preferredCamera,
1954
- preferredFacing
1500
+ async #h({
1501
+ autoplay: e = !0,
1502
+ preferredCamera: r,
1503
+ preferredFacing: a
1955
1504
  } = {}) {
1956
- const videoElement = cameraManagerStore.getState().videoElement;
1957
- if (!videoElement) {
1505
+ const n = m.getState().videoElement;
1506
+ if (!n) {
1958
1507
  console.warn("Can't start stream without a video element");
1959
1508
  return;
1960
1509
  }
1961
- if (this.isActive && !this.#resumeRequest) {
1510
+ if (this.isActive && !this.#e) {
1962
1511
  console.warn("Already streaming");
1963
1512
  return;
1964
1513
  }
1965
- if (preferredCamera instanceof Camera) {
1966
- await this.selectCamera(preferredCamera);
1967
- }
1968
- if (!cameraManagerStore.getState().selectedCamera) {
1514
+ if (r instanceof Ae && await this.selectCamera(r), !m.getState().selectedCamera)
1969
1515
  try {
1970
- const cameras = await this.getCameraDevices();
1971
- let selectedCamera2;
1972
- if (!cameras.length) {
1973
- console.log("Camera list is empty");
1974
- throw new Error(
1975
- `No cameras found matching the filter ${preferredFacing}`
1976
- );
1977
- }
1978
- if (typeof preferredCamera === "function") {
1979
- selectedCamera2 = preferredCamera(cameras);
1980
- if (!selectedCamera2) {
1981
- console.warn(
1982
- `No camera found matching the preferred camera function, falling back to facing mode`
1983
- );
1984
- }
1985
- }
1986
- if (!selectedCamera2) {
1987
- selectedCamera2 = await findIdealCamera(
1988
- cameras,
1989
- this.resolution,
1990
- preferredFacing
1516
+ const l = await this.getCameraDevices();
1517
+ let c;
1518
+ if (!l.length)
1519
+ throw console.log("Camera list is empty"), new Error(
1520
+ `No cameras found matching the filter ${a}`
1991
1521
  );
1992
- }
1993
- if (!selectedCamera2) {
1522
+ if (typeof r == "function" && (c = r(l), c || console.warn(
1523
+ "No camera found matching the preferred camera function, falling back to facing mode"
1524
+ )), c || (c = await ft(
1525
+ l,
1526
+ this.resolution,
1527
+ a
1528
+ )), !c)
1994
1529
  throw new Error(
1995
- `No cameras found matching the filter ${preferredFacing}`
1530
+ `No cameras found matching the filter ${a}`
1996
1531
  );
1997
- }
1998
- await this.selectCamera(selectedCamera2);
1999
- if (this.#hasPermissionError()) {
2000
- cameraManagerStore.setState({
2001
- errorState: void 0
2002
- });
2003
- }
2004
- } catch (error) {
2005
- cameraManagerStore.setState({
2006
- errorState: asError(error)
1532
+ await this.selectCamera(c), this.#m() && m.setState({
1533
+ errorState: void 0
2007
1534
  });
2008
- throw error;
1535
+ } catch (l) {
1536
+ throw m.setState({
1537
+ errorState: K(l)
1538
+ }), l;
2009
1539
  }
2010
- }
2011
- const selectedCamera = cameraManagerStore.getState().selectedCamera;
2012
- if (!selectedCamera) {
2013
- console.warn("No selected camera!");
2014
- throw new Error("No selected camera");
2015
- }
2016
- const stream = await selectedCamera.startStream(this.#resolution);
2017
- if (!videoElement.isConnected) {
1540
+ const o = m.getState().selectedCamera;
1541
+ if (!o)
1542
+ throw console.warn("No selected camera!"), new Error("No selected camera");
1543
+ const i = await o.startStream(this.#o);
1544
+ if (!n.isConnected)
2018
1545
  throw new Error("Video element needs to be in the document!");
2019
- }
2020
- videoElement.srcObject = stream;
2021
- cameraManagerStore.setState({
2022
- videoElement
2023
- });
2024
- if (autoplay) {
2025
- await this.startPlayback();
2026
- }
1546
+ n.srcObject = i, m.setState({
1547
+ videoElement: n
1548
+ }), e && await this.startPlayback();
2027
1549
  }
2028
1550
  /**
2029
1551
  * Starts a best-effort camera stream. Will pick a camera automatically if
@@ -2032,15 +1554,14 @@ class CameraManager {
2032
1554
  * @param params - The parameters for the camera stream.
2033
1555
  * @returns resolves when the camera stream starts
2034
1556
  */
2035
- async startCameraStream(params = {}) {
1557
+ async startCameraStream(e = {}) {
2036
1558
  try {
2037
- await this.#startCameraStream(params);
2038
- } catch (error) {
2039
- if (this.userInitiatedAbort) {
1559
+ await this.#h(e);
1560
+ } catch (r) {
1561
+ if (this.userInitiatedAbort)
2040
1562
  this.reset();
2041
- } else {
2042
- throw error;
2043
- }
1563
+ else
1564
+ throw r;
2044
1565
  }
2045
1566
  }
2046
1567
  /**
@@ -2048,15 +1569,15 @@ class CameraManager {
2048
1569
  *
2049
1570
  * @returns true if the error state is a permission error
2050
1571
  */
2051
- #hasPermissionError = () => {
2052
- const errorState = cameraManagerStore.getState().errorState;
2053
- return errorState instanceof CameraError && errorState.code === "PERMISSION_DENIED";
1572
+ #m = () => {
1573
+ const e = m.getState().errorState;
1574
+ return e instanceof xe && e.code === "PERMISSION_DENIED";
2054
1575
  };
2055
1576
  /**
2056
1577
  * Pauses capturing frames, without stopping playback.
2057
1578
  */
2058
1579
  stopFrameCapture() {
2059
- cameraManagerStore.setState({
1580
+ m.setState({
2060
1581
  playbackState: "playback"
2061
1582
  });
2062
1583
  }
@@ -2065,130 +1586,94 @@ class CameraManager {
2065
1586
  */
2066
1587
  stopStream() {
2067
1588
  console.debug("stopStream called");
2068
- const state = cameraManagerStore.getState();
2069
- this.pausePlayback();
2070
- state.selectedCamera?.stopStream();
2071
- if (state.videoElement) {
2072
- state.videoElement.srcObject = null;
2073
- }
1589
+ const e = m.getState();
1590
+ this.pausePlayback(), e.selectedCamera?.stopStream(), e.videoElement && (e.videoElement.srcObject = null);
2074
1591
  }
2075
1592
  /**
2076
1593
  * Pauses the video playback. This will also stop the capturing process.
2077
1594
  */
2078
1595
  pausePlayback() {
2079
1596
  console.debug("pausePlayback called");
2080
- const video = cameraManagerStore.getState().videoElement;
2081
- cameraManagerStore.setState({
1597
+ const e = m.getState().videoElement;
1598
+ m.setState({
2082
1599
  playbackState: "idle"
2083
- });
2084
- if (!video) {
2085
- return;
2086
- }
2087
- if (this.#videoFrameRequestId) {
2088
- video.cancelVideoFrameCallback(this.#videoFrameRequestId);
2089
- }
2090
- video.pause();
1600
+ }), e && (this.#r && e.cancelVideoFrameCallback(this.#r), e.pause());
2091
1601
  }
2092
1602
  /**
2093
1603
  * The main recognition loop. Do not call this method directly, use `#queueFrame` instead.
2094
1604
  */
2095
- async #loop() {
2096
- const state = cameraManagerStore.getState();
2097
- if (this.#videoFrameRequestId === void 0) {
1605
+ async #f() {
1606
+ const e = m.getState();
1607
+ if (this.#r === void 0) {
2098
1608
  console.error("Missing request ID");
2099
1609
  return;
2100
1610
  }
2101
- if (!state.videoElement) {
1611
+ if (!e.videoElement) {
2102
1612
  console.warn("Missing video element, should not happen");
2103
1613
  return;
2104
1614
  }
2105
- const isSameOrientation = state.videoElement.videoHeight >= state.videoElement.videoWidth === this.#extractionArea.height >= this.#extractionArea.width;
2106
- if (!isSameOrientation) {
2107
- return this.#queueFrame();
2108
- }
2109
- if (this.#frameCaptureCallbacks.size !== 0) {
2110
- const capturedFrame = this.#videoFrameProcessor.getImageData(
2111
- state.videoElement,
2112
- this.#extractionArea
1615
+ if (!(e.videoElement.videoHeight >= e.videoElement.videoWidth == this.#a.height >= this.#a.width))
1616
+ return this.#c();
1617
+ if (this.#i.size !== 0) {
1618
+ const a = this.#n.getImageData(
1619
+ e.videoElement,
1620
+ this.#a
2113
1621
  );
2114
- for (const callback of this.#frameCaptureCallbacks) {
2115
- const workingFrame = isBufferDetached(capturedFrame.data) ? this.#videoFrameProcessor.getCurrentImageData() : capturedFrame;
2116
- const returnedBuffer = await callback(workingFrame);
2117
- if (!returnedBuffer) {
2118
- continue;
2119
- }
2120
- if (!(returnedBuffer instanceof ArrayBuffer)) {
2121
- throw new Error(
2122
- stripIndents`
1622
+ for (const n of this.#i) {
1623
+ const o = se(a.data) ? this.#n.getCurrentImageData() : a, i = await n(o);
1624
+ if (i) {
1625
+ if (!(i instanceof ArrayBuffer))
1626
+ throw new Error(
1627
+ Me`
2123
1628
  Frame capture callback did not return an ArrayBuffer.
2124
1629
  Make sure to return the underlying buffer, not the view.
2125
1630
  `
2126
- );
1631
+ );
1632
+ this.#n.reattachArrayBuffer(i);
2127
1633
  }
2128
- this.#videoFrameProcessor.reattachArrayBuffer(returnedBuffer);
2129
1634
  }
2130
1635
  }
2131
- this.#queueFrame();
1636
+ this.#c();
2132
1637
  }
2133
1638
  /**
2134
1639
  * Queues the next frame to be processed.
2135
1640
  */
2136
- #queueFrame() {
2137
- const state = cameraManagerStore.getState();
2138
- if (state.playbackState !== "capturing") {
2139
- return;
2140
- }
2141
- if (!state.videoElement) {
2142
- console.warn("Missing video element, should not happen");
2143
- return;
2144
- }
2145
- if (this.#videoFrameRequestId) {
2146
- state.videoElement.cancelVideoFrameCallback(this.#videoFrameRequestId);
1641
+ #c() {
1642
+ const e = m.getState();
1643
+ if (e.playbackState === "capturing") {
1644
+ if (!e.videoElement) {
1645
+ console.warn("Missing video element, should not happen");
1646
+ return;
1647
+ }
1648
+ this.#r && e.videoElement.cancelVideoFrameCallback(this.#r), this.#r = e.videoElement.requestVideoFrameCallback(
1649
+ () => void this.#f()
1650
+ );
2147
1651
  }
2148
- this.#videoFrameRequestId = state.videoElement.requestVideoFrameCallback(
2149
- () => void this.#loop()
2150
- );
2151
1652
  }
2152
1653
  /**
2153
1654
  * Applies a mirror effect to the video if the camera is front-facing.
2154
1655
  * Assumes that desktop devices don't return a facing mode and that they are front-facing.
2155
1656
  */
2156
- #applyMirrorIfNeeded() {
2157
- const camera = cameraManagerStore.getState().selectedCamera;
2158
- if (!camera) {
1657
+ #g() {
1658
+ const e = m.getState().selectedCamera;
1659
+ if (!e) {
2159
1660
  console.warn("No camera selected");
2160
1661
  return;
2161
1662
  }
2162
- if (!this.#mirrorFrontCameras) {
2163
- return;
2164
- }
2165
- if (camera.facingMode !== "back") {
2166
- this.setCameraMirrorX(true);
2167
- } else {
2168
- this.setCameraMirrorX(false);
2169
- }
1663
+ this.#t && (e.facingMode !== "back" ? this.setCameraMirrorX(!0) : this.setCameraMirrorX(!1));
2170
1664
  }
2171
1665
  /**
2172
1666
  * If true, the video and captured frames will be mirrored horizontally.
2173
1667
  *
2174
1668
  * @param mirrorX - If true, the video and captured frames will be mirrored horizontally.
2175
1669
  */
2176
- setCameraMirrorX(mirrorX) {
2177
- const currentState = cameraManagerStore.getState();
2178
- const videoElement = currentState.videoElement;
2179
- if (!videoElement) {
1670
+ setCameraMirrorX(e) {
1671
+ const r = m.getState(), a = r.videoElement;
1672
+ if (!a) {
2180
1673
  console.warn("Mirror video - no video element present.");
2181
1674
  return;
2182
1675
  }
2183
- if (currentState.mirrorX === mirrorX) {
2184
- return;
2185
- }
2186
- if (mirrorX) {
2187
- videoElement.style.scale = "-1 1";
2188
- } else {
2189
- videoElement.style.removeProperty("scale");
2190
- }
2191
- cameraManagerStore.setState({ mirrorX });
1676
+ r.mirrorX !== e && (e ? a.style.scale = "-1 1" : a.style.removeProperty("scale"), m.setState({ mirrorX: e }));
2192
1677
  }
2193
1678
  // The "typeof" is necessary to avoid a circular dependency when resolving types
2194
1679
  /**
@@ -2198,66 +1683,62 @@ class CameraManager {
2198
1683
  *
2199
1684
  * @returns a cleanup function to remove the subscription
2200
1685
  */
2201
- subscribe = cameraManagerStore.subscribe;
1686
+ subscribe = m.subscribe;
2202
1687
  /**
2203
1688
  * Gets the current internal state of the CameraManager.
2204
1689
  *
2205
1690
  * @returns the current state of the CameraManager
2206
1691
  */
2207
- getState = cameraManagerStore.getState;
1692
+ getState = m.getState;
2208
1693
  /**
2209
1694
  * Resets the CameraManager and stops all streams.
2210
1695
  */
2211
1696
  reset() {
2212
- console.debug("Resetting camera manager");
2213
- this.#frameCaptureCallbacks.clear();
2214
- this.stopStream();
2215
- resetCameraManagerStore();
1697
+ console.debug("Resetting camera manager"), this.#i.clear(), this.stopStream(), yt();
2216
1698
  }
2217
1699
  }
2218
- const CameraUiStoreContext = createContext();
2219
- function createCameraManagerSolidStore() {
2220
- return createWithSignal(cameraManagerStore);
1700
+ const ze = we();
1701
+ function Lt() {
1702
+ return Ce(m);
2221
1703
  }
2222
- const CameraUiStoreProvider = (props) => {
2223
- const contextValue = {
2224
- cameraManagerSolidStore: createCameraManagerSolidStore(),
1704
+ const Nt = (t) => {
1705
+ const e = {
1706
+ cameraManagerSolidStore: Lt(),
2225
1707
  // eslint-disable-next-line solid/reactivity
2226
- cameraManager: props.cameraManager,
1708
+ cameraManager: t.cameraManager,
2227
1709
  // eslint-disable-next-line solid/reactivity
2228
1710
  dismountCameraUi: () => {
2229
- props.cameraManager.userInitiatedAbort = true;
2230
- props.dismountCameraUi();
1711
+ t.cameraManager.userInitiatedAbort = !0, t.dismountCameraUi();
2231
1712
  },
2232
1713
  // eslint-disable-next-line solid/reactivity
2233
- addOnDismountCallback: props.addOnDismountCallback,
1714
+ addOnDismountCallback: t.addOnDismountCallback,
1715
+ // eslint-disable-next-line solid/reactivity
1716
+ mountTarget: t.mountTarget,
2234
1717
  // eslint-disable-next-line solid/reactivity
2235
- mountTarget: props.mountTarget,
1718
+ showMirrorCameraButton: t.showMirrorCameraButton,
2236
1719
  // eslint-disable-next-line solid/reactivity
2237
- showMirrorCameraButton: props.showMirrorCameraButton,
1720
+ showTorchButton: t.showTorchButton,
2238
1721
  // eslint-disable-next-line solid/reactivity
2239
- showTorchButton: props.showTorchButton,
1722
+ showCloseButton: t.showCloseButton,
2240
1723
  // eslint-disable-next-line solid/reactivity
2241
- showCloseButton: props.showCloseButton
1724
+ showCameraErrorModal: t.showCameraErrorModal
2242
1725
  };
2243
- onCleanup(() => {
1726
+ return ce(() => {
2244
1727
  console.debug("CameraUiStoreProvider cleanup");
2245
- });
2246
- return createComponent(CameraUiStoreContext.Provider, {
2247
- value: contextValue,
1728
+ }), s(ze.Provider, {
1729
+ value: e,
2248
1730
  get children() {
2249
- return props.children;
1731
+ return t.children;
2250
1732
  }
2251
1733
  });
2252
1734
  };
2253
- function useCameraUiStore() {
2254
- const ctx = useContext(CameraUiStoreContext);
2255
- if (!ctx) {
1735
+ function j() {
1736
+ const t = ye(ze);
1737
+ if (!t)
2256
1738
  throw new Error("StoreContext.Provider not in scope");
2257
- }
2258
- return ctx;
1739
+ return t;
2259
1740
  }
2260
- const enLocaleStrings = {
1741
+ const Bt = {
2261
1742
  selected_camera: "Selected camera",
2262
1743
  loading_cameras: "Loading cameras...",
2263
1744
  select_a_camera: "Select a camera",
@@ -2270,277 +1751,230 @@ const enLocaleStrings = {
2270
1751
  camera_error_details: "Please allow camera access in your browser and try again.",
2271
1752
  camera_error_cancel_btn: "Cancel",
2272
1753
  camera_error_primary_btn: "Retry"
2273
- };
2274
- const LocalizationContext = createContext();
2275
- const LocalizationProvider = (props) => {
2276
- const [localizationStore, updateLocalizationStore] = createStore$1(
1754
+ }, Le = we(), Ot = (t) => {
1755
+ const [e, r] = Ke(
2277
1756
  // we structure clone to avoid proxying to the original object
2278
1757
  structuredClone({
2279
- ...enLocaleStrings,
1758
+ ...Bt,
2280
1759
  // we don't care on init
2281
1760
  // eslint-disable-next-line solid/reactivity
2282
- ...props.userStrings
1761
+ ...t.userStrings
2283
1762
  })
2284
1763
  );
2285
- onMount(() => {
2286
- props.setLocalizationRef(updateLocalizationStore);
1764
+ J(() => {
1765
+ t.setLocalizationRef(r);
2287
1766
  });
2288
- const contextValue = {
2289
- t: localizationStore,
2290
- updateLocalization: updateLocalizationStore
1767
+ const a = {
1768
+ t: e,
1769
+ updateLocalization: r
2291
1770
  };
2292
- return createComponent(LocalizationContext.Provider, {
2293
- value: contextValue,
1771
+ return s(Le.Provider, {
1772
+ value: a,
2294
1773
  get children() {
2295
- return props.children;
1774
+ return t.children;
2296
1775
  }
2297
1776
  });
2298
1777
  };
2299
- function useLocalization() {
2300
- const ctx = useContext(LocalizationContext);
2301
- if (!ctx) {
1778
+ function Z() {
1779
+ const t = ye(Le);
1780
+ if (!t)
2302
1781
  throw new Error("LocalizationContext.Provider not in scope.");
2303
- }
2304
- return ctx;
1782
+ return t;
2305
1783
  }
2306
- var _tmpl$$c = /* @__PURE__ */ template(`<span>`);
2307
- const SmartEnvironmentProvider = (props) => {
2308
- const [rootNode, setRootNode] = createSignal();
2309
- const [ref, setRef] = createSignal();
2310
- onMount(() => {
2311
- const spanRef = ref();
2312
- if (!spanRef) {
2313
- return;
2314
- }
2315
- setRootNode(spanRef.getRootNode());
2316
- });
2317
- return createComponent(Show, {
1784
+ var Pt = /* @__PURE__ */ S("<span>");
1785
+ const ee = (t) => {
1786
+ const [e, r] = z(), [a, n] = z();
1787
+ return J(() => {
1788
+ const o = a();
1789
+ o && r(o.getRootNode());
1790
+ }), s(E, {
2318
1791
  get when() {
2319
- return rootNode();
1792
+ return e();
2320
1793
  },
2321
1794
  get fallback() {
2322
1795
  return (() => {
2323
- var _el$ = _tmpl$$c();
2324
- use(setRef, _el$);
2325
- return _el$;
1796
+ var o = Pt();
1797
+ return B(n, o), o;
2326
1798
  })();
2327
1799
  },
2328
- children: (rootNode2) => createComponent(EnvironmentProvider, {
2329
- value: () => rootNode2(),
1800
+ children: (o) => s(Ye, {
1801
+ value: () => o(),
2330
1802
  get children() {
2331
- return props.children(rootNode2());
1803
+ return t.children(o());
2332
1804
  }
2333
1805
  })
2334
1806
  });
2335
1807
  };
2336
- var _tmpl$$b = /* @__PURE__ */ template(`<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">`);
2337
- const CloseIcon = (props = {}) => (() => {
2338
- var _el$ = _tmpl$$b();
2339
- spread(_el$, props, true, true);
2340
- return _el$;
1808
+ var Vt = /* @__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">');
1809
+ const Ut = (t = {}) => (() => {
1810
+ var e = Vt();
1811
+ return F(e, t, !0, !0), e;
2341
1812
  })();
2342
- var _tmpl$$a = /* @__PURE__ */ template(`<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">`);
2343
- const FlashOff = (props = {}) => (() => {
2344
- var _el$ = _tmpl$$a();
2345
- spread(_el$, props, true, true);
2346
- return _el$;
1813
+ var qt = /* @__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">');
1814
+ const jt = (t = {}) => (() => {
1815
+ var e = qt();
1816
+ return F(e, t, !0, !0), e;
2347
1817
  })();
2348
- var _tmpl$$9 = /* @__PURE__ */ template(`<svg viewBox="0 0 24 24"width=1.2em height=1.2em><path fill=currentColor d="M10 22v-8H7V2h10l-2 7h4z">`);
2349
- const FlashOn = (props = {}) => (() => {
2350
- var _el$ = _tmpl$$9();
2351
- spread(_el$, props, true, true);
2352
- return _el$;
1818
+ var Ht = /* @__PURE__ */ S('<svg viewBox="0 0 24 24"width=1.2em height=1.2em><path fill=currentColor d="M10 22v-8H7V2h10l-2 7h4z">');
1819
+ const Wt = (t = {}) => (() => {
1820
+ var e = Ht();
1821
+ return F(e, t, !0, !0), e;
2353
1822
  })();
2354
- var _tmpl$$8 = /* @__PURE__ */ template(`<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">`);
2355
- const MirrorIcon = (props = {}) => (() => {
2356
- var _el$ = _tmpl$$8();
2357
- spread(_el$, props, true, true);
2358
- return _el$;
1823
+ var Gt = /* @__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">');
1824
+ const Xt = (t = {}) => (() => {
1825
+ var e = Gt();
1826
+ return F(e, t, !0, !0), e;
2359
1827
  })();
2360
- function eventFixer(props) {
2361
- const newObj = {};
2362
- Object.entries(props).forEach(([key, value]) => {
2363
- const lowerCaseKey = key.toLowerCase();
2364
- let trimmedKey = lowerCaseKey;
2365
- if (lowerCaseKey.startsWith("on")) {
2366
- trimmedKey = lowerCaseKey.slice(2);
2367
- const newKey = `on:${trimmedKey}`;
2368
- newObj[newKey] = value;
2369
- } else {
2370
- newObj[trimmedKey] = value;
2371
- }
2372
- });
2373
- return newObj;
1828
+ function Ne(t) {
1829
+ const e = {};
1830
+ return Object.entries(t).forEach(([r, a]) => {
1831
+ const n = r.toLowerCase();
1832
+ let o = n;
1833
+ if (n.startsWith("on")) {
1834
+ o = n.slice(2);
1835
+ const i = `on:${o}`;
1836
+ e[i] = a;
1837
+ } else
1838
+ e[o] = a;
1839
+ }), e;
2374
1840
  }
2375
- var _tmpl$$7 = /* @__PURE__ */ template(`<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">`);
2376
- const IconCamera = (props = {}) => (() => {
2377
- var _el$ = _tmpl$$7();
2378
- spread(_el$, props, true, true);
2379
- return _el$;
1841
+ var Qt = /* @__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">');
1842
+ const Kt = (t = {}) => (() => {
1843
+ var e = Qt();
1844
+ return F(e, t, !0, !0), e;
2380
1845
  })();
2381
- var _tmpl$$6 = /* @__PURE__ */ template(`<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">`);
2382
- const IconCheck = (props = {}) => (() => {
2383
- var _el$ = _tmpl$$6();
2384
- spread(_el$, props, true, true);
2385
- return _el$;
1846
+ var Yt = /* @__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">');
1847
+ const Jt = (t = {}) => (() => {
1848
+ var e = Yt();
1849
+ return F(e, t, !0, !0), e;
2386
1850
  })();
2387
- var _tmpl$$5 = /* @__PURE__ */ template(`<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>`);
2388
- const IconChevronDown = (props = {}) => (() => {
2389
- var _el$ = _tmpl$$5();
2390
- spread(_el$, props, true, true);
2391
- return _el$;
1851
+ var Zt = /* @__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>');
1852
+ const er = (t = {}) => (() => {
1853
+ var e = Zt();
1854
+ return F(e, t, !0, !0), e;
2392
1855
  })();
2393
- var _tmpl$$4 = /* @__PURE__ */ template(`<button>`), _tmpl$2$3 = /* @__PURE__ */ template(`<div class="h-[1px] absolute left-0 right-0 top-[-1px] bg-white pointer-events-none">`);
2394
- const CameraSelector = () => {
1856
+ var tr = /* @__PURE__ */ S("<button>"), rr = /* @__PURE__ */ S('<div class="h-[1px] absolute left-0 right-0 top-[-1px] bg-white pointer-events-none">');
1857
+ const ar = () => {
2395
1858
  const {
2396
- cameraManagerSolidStore,
2397
- cameraManager
2398
- } = useCameraUiStore();
2399
- const {
2400
- t
2401
- } = useLocalization();
2402
- const cameras = cameraManagerSolidStore((x) => x.cameras);
2403
- const selectedCamera = cameraManagerSolidStore((x) => x.selectedCamera);
2404
- const isQueryingCameras = cameraManagerSolidStore((x) => x.isQueryingCameras);
2405
- const facingFilter = cameraManagerSolidStore((x) => x.facingFilter);
2406
- const [isSwapping, setIsSwapping] = createSignal(false);
2407
- const isDisabled = () => isQueryingCameras() || isSwapping();
2408
- const camerasWithFacingFilter = () => {
2409
- const $facingFilter = facingFilter();
2410
- if (!$facingFilter) {
2411
- return cameras();
2412
- }
2413
- return cameras().filter((camera) => $facingFilter.includes(camera.facingMode));
2414
- };
2415
- const createCameraOptions = () => [...camerasWithFacingFilter().map((camera) => ({
2416
- value: camera.deviceInfo.deviceId,
2417
- label: camera.name
2418
- }))];
2419
- const cameraCollection = () => createListCollection({
2420
- items: [...createCameraOptions()]
2421
- });
2422
- const selectedCameraInCollection = () => {
2423
- const $selectedCamera = selectedCamera();
2424
- if (!$selectedCamera) {
2425
- return;
2426
- }
2427
- const foundCamera = cameraCollection().find($selectedCamera.deviceInfo.deviceId);
2428
- if (!foundCamera) {
1859
+ cameraManagerSolidStore: t,
1860
+ cameraManager: e
1861
+ } = j(), {
1862
+ t: r
1863
+ } = Z(), a = t((f) => f.cameras), n = t((f) => f.selectedCamera), o = t((f) => f.isQueryingCameras), i = t((f) => f.facingFilter), [l, c] = z(!1), d = () => o() || l(), h = () => {
1864
+ const f = i();
1865
+ return f ? a().filter((g) => f.includes(g.facingMode)) : a();
1866
+ }, C = () => [...h().map((f) => ({
1867
+ value: f.deviceInfo.deviceId,
1868
+ label: f.name
1869
+ }))], w = () => Je({
1870
+ items: [...C()]
1871
+ }), u = () => {
1872
+ const f = n();
1873
+ if (!f)
2429
1874
  return;
2430
- }
2431
- return [foundCamera.value];
2432
- };
2433
- const isFakeCamera = (value) => {
2434
- return fakeCameras.some((fakeCamera) => fakeCamera.value === value);
2435
- };
2436
- const selectCameraById = async (id) => {
2437
- setIsSwapping(true);
2438
- const camera = cameras().find((camera2) => camera2.deviceInfo.deviceId === id);
2439
- if (!camera) {
1875
+ const g = w().find(f.deviceInfo.deviceId);
1876
+ if (g)
1877
+ return [g.value];
1878
+ }, v = (f) => nr.some((g) => g.value === f), b = async (f) => {
1879
+ c(!0);
1880
+ const g = a().find((p) => p.deviceInfo.deviceId === f);
1881
+ if (!g) {
2440
1882
  console.warn("No camera");
2441
1883
  return;
2442
1884
  }
2443
- await cameraManager.selectCamera(camera);
2444
- setIsSwapping(false);
1885
+ await e.selectCamera(g), c(!1);
2445
1886
  };
2446
- return createComponent(SmartEnvironmentProvider, {
2447
- children: () => createComponent(Select.Root, {
1887
+ return s(ee, {
1888
+ children: () => s(A.Root, {
2448
1889
  part: "camera-select-part",
2449
1890
  get collection() {
2450
- return cameraCollection();
1891
+ return w();
2451
1892
  },
2452
1893
  get value() {
2453
- return selectedCameraInCollection();
1894
+ return u();
2454
1895
  },
2455
1896
  positioning: {
2456
1897
  placement: "top"
2457
1898
  },
2458
- lazyMount: true,
1899
+ lazyMount: !0,
2459
1900
  get disabled() {
2460
- return isDisabled();
1901
+ return d();
2461
1902
  },
2462
- onValueChange: (details) => {
2463
- if (isFakeCamera(details.value[0])) {
1903
+ onValueChange: (f) => {
1904
+ if (v(f.value[0])) {
2464
1905
  console.warn("Fake camera, skipping");
2465
1906
  return;
2466
1907
  }
2467
- void selectCameraById(details.value[0]);
1908
+ b(f.value[0]);
2468
1909
  },
2469
1910
  get children() {
2470
- return [createComponent(Select.Label, {
2471
- "class": "sr-only",
1911
+ return [s(A.Label, {
1912
+ class: "sr-only",
2472
1913
  get children() {
2473
- return t.selected_camera;
1914
+ return r.selected_camera;
2474
1915
  }
2475
- }), createComponent(Select.Trigger, {
2476
- asChild: (selectProps) => {
2477
- return (() => {
2478
- var _el$ = _tmpl$$4();
2479
- spread(_el$, mergeProps(() => eventFixer(selectProps()), {
2480
- "class": `flex px-4 py-2 items-center gap-2 rounded-full bg-dark-100/50 backdrop-blur-xl
1916
+ }), s(A.Trigger, {
1917
+ asChild: (f) => (() => {
1918
+ var g = tr();
1919
+ return F(g, Y(() => Ne(f()), {
1920
+ class: `flex px-4 py-2 items-center gap-2 rounded-full bg-dark-100/50 backdrop-blur-xl
2481
1921
  whitespace-nowrap text-base color-white font-500 cursor-pointer appearance-none
2482
1922
  border-none disabled:opacity-50 disabled:cursor-not-allowed max-w-[100%]`
2483
- }), false, true);
2484
- insert(_el$, createComponent(IconCamera, {
2485
- "class": "size-6 shrink-0",
2486
- "aria-hidden": true
2487
- }), null);
2488
- insert(_el$, createComponent(Select.ValueText, {
2489
- "class": "truncate",
2490
- get placeholder() {
2491
- return isQueryingCameras() ? t.loading_cameras : t.select_a_camera;
2492
- }
2493
- }), null);
2494
- insert(_el$, createComponent(Select.Indicator, {
2495
- "class": "shrink-0 data-[state=open]:scale-y-[-1]",
2496
- get children() {
2497
- return createComponent(IconChevronDown, {
2498
- "class": "size-6 shrink-0"
2499
- });
2500
- }
2501
- }), null);
2502
- return _el$;
2503
- })();
2504
- }
2505
- }), createComponent(Select.Positioner, {
1923
+ }), !1, !0), y(g, s(Kt, {
1924
+ class: "size-6 shrink-0",
1925
+ "aria-hidden": !0
1926
+ }), null), y(g, s(A.ValueText, {
1927
+ class: "truncate",
1928
+ get placeholder() {
1929
+ return o() ? r.loading_cameras : r.select_a_camera;
1930
+ }
1931
+ }), null), y(g, s(A.Indicator, {
1932
+ class: "shrink-0 data-[state=open]:scale-y-[-1]",
1933
+ get children() {
1934
+ return s(er, {
1935
+ class: "size-6 shrink-0"
1936
+ });
1937
+ }
1938
+ }), null), g;
1939
+ })()
1940
+ }), s(A.Positioner, {
2506
1941
  get children() {
2507
- return createComponent(Select.Content, {
1942
+ return s(A.Content, {
2508
1943
  get children() {
2509
- return createComponent(Select.ItemGroup, {
2510
- "class": "rounded-4 overflow-hidden text-base color-white",
1944
+ return s(A.ItemGroup, {
1945
+ class: "rounded-4 overflow-hidden text-base color-white",
2511
1946
  get children() {
2512
- return createComponent(Index, {
1947
+ return s(We, {
2513
1948
  get each() {
2514
- return cameraCollection().items;
1949
+ return w().items;
2515
1950
  },
2516
- children: (camera, index) => {
2517
- return createComponent(Select.Item, {
2518
- get item() {
2519
- return camera();
2520
- },
2521
- "class": "flex py-3 pl-4 pr-12 cursor-pointer select-none relative gap-[1px]\n bg-dark-100/50 backdrop-blur-xl data-[highlighted]:bg-gray-500/50",
2522
- get children() {
2523
- return [createComponent(Select.ItemText, {
2524
- "class": "truncate",
2525
- get children() {
2526
- return camera().label;
2527
- }
2528
- }), createComponent(Select.ItemIndicator, {
2529
- "class": "absolute right-4",
2530
- get children() {
2531
- return createComponent(IconCheck, {
2532
- "class": "size-6 shrink-0"
2533
- });
2534
- }
2535
- }), createComponent(Show, {
2536
- when: index !== 0,
2537
- get children() {
2538
- return _tmpl$2$3();
2539
- }
2540
- })];
2541
- }
2542
- });
2543
- }
1951
+ children: (f, g) => s(A.Item, {
1952
+ get item() {
1953
+ return f();
1954
+ },
1955
+ class: `flex py-3 pl-4 pr-12 cursor-pointer select-none relative gap-[1px]
1956
+ bg-dark-100/50 backdrop-blur-xl data-[highlighted]:bg-gray-500/50`,
1957
+ get children() {
1958
+ return [s(A.ItemText, {
1959
+ class: "truncate",
1960
+ get children() {
1961
+ return f().label;
1962
+ }
1963
+ }), s(A.ItemIndicator, {
1964
+ class: "absolute right-4",
1965
+ get children() {
1966
+ return s(Jt, {
1967
+ class: "size-6 shrink-0"
1968
+ });
1969
+ }
1970
+ }), s(E, {
1971
+ when: g !== 0,
1972
+ get children() {
1973
+ return rr();
1974
+ }
1975
+ })];
1976
+ }
1977
+ })
2544
1978
  });
2545
1979
  }
2546
1980
  });
@@ -2551,8 +1985,7 @@ const CameraSelector = () => {
2551
1985
  }
2552
1986
  })
2553
1987
  });
2554
- };
2555
- const fakeCameras = [{
1988
+ }, nr = [{
2556
1989
  value: "5",
2557
1990
  label: "Back Camera 2"
2558
1991
  }, {
@@ -2568,389 +2001,318 @@ const fakeCameras = [{
2568
2001
  value: "4",
2569
2002
  label: "Some random desktop camera"
2570
2003
  }];
2571
- var _tmpl$$3 = /* @__PURE__ */ template(`<span class=sr-only>`), _tmpl$2$2 = /* @__PURE__ */ template(`<div class=justify-self-end>`), _tmpl$3$2 = /* @__PURE__ */ template(`<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">`), _tmpl$4$1 = /* @__PURE__ */ template(`<button>`);
2572
- const Header = () => {
2573
- const {
2574
- dismountCameraUi,
2575
- cameraManagerSolidStore,
2576
- cameraManager,
2577
- showMirrorCameraButton,
2578
- showTorchButton,
2579
- showCloseButton
2580
- } = useCameraUiStore();
2004
+ var re = /* @__PURE__ */ S("<span class=sr-only>"), or = /* @__PURE__ */ S("<div class=justify-self-end>"), ir = /* @__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">'), sr = /* @__PURE__ */ S("<button>");
2005
+ const lr = () => {
2581
2006
  const {
2582
- t
2583
- } = useLocalization();
2584
- const isMirrored = cameraManagerSolidStore((s) => s.mirrorX);
2585
- const selectedCamera = cameraManagerSolidStore((s) => s.selectedCamera);
2586
- const cameras = cameraManagerSolidStore((s) => s.cameras);
2587
- const isActive = cameraManagerSolidStore((s) => s.playbackState !== "idle");
2588
- const torchEnabled = cameraManagerSolidStore((s) => s.selectedCamera?.torchEnabled);
2589
- const hasTorch = () => selectedCamera()?.torchSupported;
2590
- const toggleTorch = () => {
2591
- const camera = selectedCamera();
2592
- if (!camera) {
2593
- return;
2594
- }
2595
- void camera.toggleTorch();
2007
+ dismountCameraUi: t,
2008
+ cameraManagerSolidStore: e,
2009
+ cameraManager: r,
2010
+ showMirrorCameraButton: a,
2011
+ showTorchButton: n,
2012
+ showCloseButton: o
2013
+ } = j(), {
2014
+ t: i
2015
+ } = Z(), l = e((b) => b.mirrorX), c = e((b) => b.selectedCamera), d = e((b) => b.cameras), h = e((b) => b.playbackState !== "idle"), C = e((b) => b.selectedCamera?.torchEnabled), w = () => c()?.torchSupported, u = () => {
2016
+ const b = c();
2017
+ b && b.toggleTorch();
2018
+ }, v = () => {
2019
+ r.setCameraMirrorX(!e.getState().mirrorX);
2596
2020
  };
2597
- const toggleMirrorX = () => {
2598
- cameraManager.setCameraMirrorX(!cameraManagerSolidStore.getState().mirrorX);
2599
- };
2600
- return createComponent(SmartEnvironmentProvider, {
2021
+ return s(ee, {
2601
2022
  children: () => (() => {
2602
- var _el$ = _tmpl$3$2(), _el$2 = _el$.firstChild, _el$5 = _el$2.nextSibling;
2603
- insert(_el$2, createComponent(Show, {
2023
+ var b = ir(), f = b.firstChild, g = f.nextSibling;
2024
+ return y(f, s(E, {
2604
2025
  get when() {
2605
- return showMirrorCameraButton && isActive();
2026
+ return a && h();
2606
2027
  },
2607
2028
  get children() {
2608
- return createComponent(ToolbarButton, {
2029
+ return s(ae, {
2609
2030
  part: "mirror-camera-button-part",
2610
2031
  get tooltipLabel() {
2611
- return t.mirror_camera;
2032
+ return i.mirror_camera;
2612
2033
  },
2613
- onClick: () => toggleMirrorX(),
2034
+ onClick: () => v(),
2614
2035
  get children() {
2615
2036
  return [(() => {
2616
- var _el$3 = _tmpl$$3();
2617
- insert(_el$3, () => t.mirror_camera);
2618
- return _el$3;
2619
- })(), createComponent(MirrorIcon, {
2620
- "class": "size-6 shrink-0 transition-transform duration-300 ease-in-out",
2037
+ var p = re();
2038
+ return y(p, () => i.mirror_camera), p;
2039
+ })(), s(Xt, {
2040
+ class: "size-6 shrink-0 transition-transform duration-300 ease-in-out",
2621
2041
  get style() {
2622
2042
  return {
2623
- transform: isMirrored() ? "scaleX(-1)" : "scaleX(1)"
2043
+ transform: l() ? "scaleX(-1)" : "scaleX(1)"
2624
2044
  };
2625
2045
  }
2626
2046
  })];
2627
2047
  }
2628
2048
  });
2629
2049
  }
2630
- }), null);
2631
- insert(_el$2, createComponent(Show, {
2050
+ }), null), y(f, s(E, {
2632
2051
  get when() {
2633
- return memo(() => !!(showTorchButton && hasTorch()))() && isActive();
2052
+ return pe(() => !!(n && w()))() && h();
2634
2053
  },
2635
2054
  get children() {
2636
- return createComponent(ToolbarButton, {
2055
+ return s(ae, {
2637
2056
  part: "torch-button-part",
2638
- onClick: () => toggleTorch(),
2057
+ onClick: () => u(),
2639
2058
  get tooltipLabel() {
2640
- return t.torch;
2059
+ return i.torch;
2641
2060
  },
2642
2061
  get children() {
2643
- return [createComponent(Show, {
2062
+ return [s(E, {
2644
2063
  get when() {
2645
- return !torchEnabled();
2064
+ return !C();
2646
2065
  },
2647
2066
  get children() {
2648
2067
  return [(() => {
2649
- var _el$4 = _tmpl$$3();
2650
- insert(_el$4, () => t.torch);
2651
- return _el$4;
2652
- })(), createComponent(FlashOn, {
2653
- "class": "size-6 shrink-0"
2068
+ var p = re();
2069
+ return y(p, () => i.torch), p;
2070
+ })(), s(Wt, {
2071
+ class: "size-6 shrink-0"
2654
2072
  })];
2655
2073
  }
2656
- }), createComponent(Show, {
2074
+ }), s(E, {
2657
2075
  get when() {
2658
- return torchEnabled();
2076
+ return C();
2659
2077
  },
2660
2078
  get children() {
2661
- return createComponent(FlashOff, {
2662
- "class": "size-6 shrink-0"
2079
+ return s(jt, {
2080
+ class: "size-6 shrink-0"
2663
2081
  });
2664
2082
  }
2665
2083
  })];
2666
2084
  }
2667
2085
  });
2668
2086
  }
2669
- }), null);
2670
- insert(_el$5, createComponent(Show, {
2087
+ }), null), y(g, s(E, {
2671
2088
  get when() {
2672
- return cameras().length > 1;
2089
+ return d().length > 1;
2673
2090
  },
2674
2091
  get children() {
2675
- return createComponent(CameraSelector, {});
2092
+ return s(ar, {});
2676
2093
  }
2677
- }));
2678
- insert(_el$, createComponent(Show, {
2679
- when: showCloseButton,
2094
+ })), y(b, s(E, {
2095
+ when: o,
2680
2096
  get children() {
2681
- var _el$6 = _tmpl$2$2();
2682
- insert(_el$6, createComponent(ToolbarButton, {
2097
+ var p = or();
2098
+ return y(p, s(ae, {
2683
2099
  part: "close-button-part",
2684
- onClick: () => dismountCameraUi(),
2100
+ onClick: () => t(),
2685
2101
  get tooltipLabel() {
2686
- return t.close;
2102
+ return i.close;
2687
2103
  },
2688
2104
  get children() {
2689
2105
  return [(() => {
2690
- var _el$7 = _tmpl$$3();
2691
- insert(_el$7, () => t.close);
2692
- return _el$7;
2693
- })(), createComponent(CloseIcon, {
2694
- "class": "size-6 shrink-0"
2106
+ var k = re();
2107
+ return y(k, () => i.close), k;
2108
+ })(), s(Ut, {
2109
+ class: "size-6 shrink-0"
2695
2110
  })];
2696
2111
  }
2697
- }));
2698
- return _el$6;
2112
+ })), p;
2699
2113
  }
2700
- }), null);
2701
- return _el$;
2114
+ }), null), b;
2702
2115
  })()
2703
2116
  });
2704
- };
2705
- const ToolbarButton = (props) => {
2706
- return createComponent(Tooltip.Root, {
2707
- get children() {
2708
- return [createComponent(Tooltip.Trigger, mergeProps(props, {
2709
- asChild: (tooltipProps) => {
2710
- return (() => {
2711
- var _el$8 = _tmpl$4$1();
2712
- spread(_el$8, mergeProps(() => eventFixer(tooltipProps()), {
2713
- "class": `rounded-full bg-dark-500 bg-opacity-50 backdrop-blur grid place-items-center
2117
+ }, ae = (t) => s(Q.Root, {
2118
+ get children() {
2119
+ return [s(Q.Trigger, Y(t, {
2120
+ asChild: (e) => (() => {
2121
+ var r = sr();
2122
+ return F(r, Y(() => Ne(e()), {
2123
+ class: `rounded-full bg-dark-500 bg-opacity-50 backdrop-blur grid place-items-center
2714
2124
  size-12 appearance-none border-none cursor-pointer`
2715
- }), false, true);
2716
- insert(_el$8, () => props.children);
2717
- return _el$8;
2718
- })();
2719
- }
2720
- })), createComponent(Tooltip.Positioner, {
2721
- get children() {
2722
- return createComponent(Tooltip.Content, {
2723
- "class": `bg-dark-500 bg-opacity-50 backdrop-blur color-white text-align-center p-2
2125
+ }), !1, !0), y(r, () => t.children), r;
2126
+ })()
2127
+ })), s(Q.Positioner, {
2128
+ get children() {
2129
+ return s(Q.Content, {
2130
+ class: `bg-dark-500 bg-opacity-50 backdrop-blur color-white text-align-center p-2
2724
2131
  rounded-md text-sm drop-shadow-md`,
2725
- get children() {
2726
- return props.tooltipLabel;
2727
- }
2728
- });
2729
- }
2730
- })];
2731
- }
2732
- });
2733
- };
2734
- const renderWithOwner = (code, element, owner) => {
2735
- return createRoot((dispose) => {
2736
- insert(element, code(), element.firstChild ? null : void 0);
2737
- return () => {
2738
- dispose();
2739
- element.textContent = "";
2740
- };
2741
- }, owner);
2742
- };
2743
- var _tmpl$$2 = /* @__PURE__ */ template(`<div>`);
2744
- const SolidShadowRoot = (props) => {
2745
- const owner = getOwner();
2746
- const [local, others] = splitProps(props, ["children", "disableShadowRoot", "getRef"]);
2132
+ get children() {
2133
+ return t.tooltipLabel;
2134
+ }
2135
+ });
2136
+ }
2137
+ })];
2138
+ }
2139
+ }), cr = (t, e, r) => Ge((a) => (y(e, t(), e.firstChild ? null : void 0), () => {
2140
+ a(), e.textContent = "";
2141
+ }), r);
2142
+ var ur = /* @__PURE__ */ S("<div>");
2143
+ const dr = (t) => {
2144
+ const e = Se(), [r, a] = Xe(t, ["children", "disableShadowRoot", "getRef"]);
2747
2145
  return (() => {
2748
- var _el$ = _tmpl$$2();
2749
- use((ref) => {
2750
- if (local.disableShadowRoot) {
2146
+ var n = ur();
2147
+ return B((o) => {
2148
+ if (r.disableShadowRoot)
2751
2149
  return;
2752
- }
2753
- const shadowRoot = ref.attachShadow({
2150
+ const i = o.attachShadow({
2754
2151
  mode: "open"
2755
2152
  });
2756
- renderWithOwner(() => memo(() => local.children), shadowRoot, owner);
2757
- }, _el$);
2758
- spread(_el$, others, false, true);
2759
- insert(_el$, createComponent(Show, {
2153
+ cr(() => pe(() => r.children), i, e);
2154
+ }, n), F(n, a, !1, !0), y(n, s(E, {
2760
2155
  get when() {
2761
- return local.disableShadowRoot;
2156
+ return r.disableShadowRoot;
2762
2157
  },
2763
2158
  get children() {
2764
- return local.children;
2159
+ return r.children;
2765
2160
  }
2766
- }));
2767
- return _el$;
2161
+ })), n;
2768
2162
  })();
2769
- };
2770
- const normalize = '/* Document\n * ========================================================================== */\n\n/**\n * 1. Correct the line height in all browsers.\n * 2. Prevent adjustments of font size after orientation changes in iOS.\n */\n\n:where(html) {\n line-height: 1.15; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */\n text-size-adjust: 100%; /* 2 */\n}\n\n/* Sections\n * ========================================================================== */\n\n/**\n * Correct the font size and margin on `h1` elements within `section` and\n * `article` contexts in Chrome, Edge, Firefox, and Safari.\n */\n\n:where(h1) {\n font-size: 2em;\n margin-block-end: 0.67em;\n margin-block-start: 0.67em;\n}\n\n/* Grouping content\n * ========================================================================== */\n\n/**\n * Remove the margin on nested lists in Chrome, Edge, and Safari.\n */\n\n:where(dl, ol, ul) :where(dl, ol, ul) {\n margin-block-end: 0;\n margin-block-start: 0;\n}\n\n/**\n * 1. Add the correct box sizing in Firefox.\n * 2. Correct the inheritance of border color in Firefox.\n */\n\n:where(hr) {\n box-sizing: content-box; /* 1 */\n color: inherit; /* 2 */\n height: 0; /* 1 */\n}\n\n/* Text-level semantics\n * ========================================================================== */\n\n/**\n * Add the correct text decoration in Safari.\n */\n\n:where(abbr[title]) {\n text-decoration: underline;\n text-decoration: underline dotted;\n}\n\n/**\n * Add the correct font weight in Chrome, Edge, and Safari.\n */\n\n:where(b, strong) {\n font-weight: bolder;\n}\n\n/**\n * 1. Correct the inheritance and scaling of font size in all browsers.\n * 2. Correct the odd `em` font sizing in all browsers.\n */\n\n:where(code, kbd, pre, samp) {\n font-family: monospace, monospace; /* 1 */\n font-size: 1em; /* 2 */\n}\n\n/**\n * Add the correct font size in all browsers.\n */\n\n:where(small) {\n font-size: 80%;\n}\n\n/* Tabular data\n * ========================================================================== */\n\n/**\n * 1. Correct table border color in Chrome, Edge, and Safari.\n * 2. Remove text indentation from table contents in Chrome, Edge, and Safari.\n */\n\n:where(table) {\n border-color: currentColor; /* 1 */\n text-indent: 0; /* 2 */\n}\n\n/* Forms\n * ========================================================================== */\n\n/**\n * Remove the margin on controls in Safari.\n */\n\n:where(button, input, select) {\n margin: 0;\n}\n\n/**\n * Remove the inheritance of text transform in Firefox.\n */\n\n:where(button) {\n text-transform: none;\n}\n\n/**\n * Correct the inability to style buttons in iOS and Safari.\n */\n\n:where(button, input:is([type="button" i], [type="reset" i], [type="submit" i])) {\n -webkit-appearance: button;\n}\n\n/**\n * Add the correct vertical alignment in Chrome, Edge, and Firefox.\n */\n\n:where(progress) {\n vertical-align: baseline;\n}\n\n/**\n * Remove the inheritance of text transform in Firefox.\n */\n\n:where(select) {\n text-transform: none;\n}\n\n/**\n * Remove the margin in Firefox and Safari.\n */\n\n:where(textarea) {\n margin: 0;\n}\n\n/**\n * 1. Correct the odd appearance in Chrome, Edge, and Safari.\n * 2. Correct the outline style in Safari.\n */\n\n:where(input[type="search" i]) {\n -webkit-appearance: textfield; /* 1 */\n outline-offset: -2px; /* 2 */\n}\n\n/**\n * Correct the cursor style of increment and decrement buttons in Safari.\n */\n\n::-webkit-inner-spin-button,\n::-webkit-outer-spin-button {\n height: auto;\n}\n\n/**\n * Correct the text style of placeholders in Chrome, Edge, and Safari.\n */\n\n::-webkit-input-placeholder {\n color: inherit;\n opacity: 0.54;\n}\n\n/**\n * Remove the inner padding in Chrome, Edge, and Safari on macOS.\n */\n\n::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/**\n * 1. Correct the inability to style upload buttons in iOS and Safari.\n * 2. Change font properties to `inherit` in Safari.\n */\n\n::-webkit-file-upload-button {\n -webkit-appearance: button; /* 1 */\n font: inherit; /* 2 */\n}\n\n/**\n * Remove the inner border and padding of focus outlines in Firefox.\n */\n\n:where(button, input:is([type="button" i], [type="color" i], [type="reset" i], [type="submit" i]))::-moz-focus-inner {\n border-style: none;\n padding: 0;\n}\n\n/**\n * Restore the focus outline styles unset by the previous rule in Firefox.\n */\n\n:where(button, input:is([type="button" i], [type="color" i], [type="reset" i], [type="submit" i]))::-moz-focusring {\n outline: 1px dotted ButtonText;\n}\n\n/**\n * Remove the additional :invalid styles in Firefox.\n */\n\n:where(:-moz-ui-invalid) {\n box-shadow: none;\n}\n\n/* Interactive\n * ========================================================================== */\n\n/*\n * Add the correct styles in Safari.\n */\n\n:where(dialog) {\n background-color: white;\n border: solid;\n color: black;\n height: -moz-fit-content;\n height: fit-content;\n left: 0;\n margin: auto;\n padding: 1em;\n position: absolute;\n right: 0;\n width: -moz-fit-content;\n width: fit-content;\n}\n\n:where(dialog:not([open])) {\n display: none;\n}\n\n/*\n * Add the correct display in all browsers.\n */\n\n:where(summary) {\n display: list-item;\n}\n';
2771
- const rootStyles = ":host {\n font-family: var(--mb-ui-font);\n line-height: 1.15;\n isolation: isolate;\n box-sizing: border-box;\n}\n\n*,\n*::before,\n*::after {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n}\n\np,\nh1,\nh2,\nh3,\nh4,\nh5,\nh6 {\n overflow-wrap: break-word;\n}\n\ncode {\n font-family: var(--mb-monospace-font-stack);\n}\n\npre {\n font-family: var(--mb-monospace-font-stack);\n}\n\nsvg path {\n pointer-events: none;\n}\n\nimg,\npicture,\nvideo,\ncanvas,\nsvg {\n display: block;\n max-width: 100%;\n}\n\nimg {\n pointer-events: none;\n user-select: none;\n}\n\n:where(input, button, textarea, select) {\n font: inherit;\n}\n\n:where(button, select) {\n cursor: pointer;\n color: inherit;\n font: inherit;\n}\n\n:where(p, h1, h2, h3, h4, h5, h6) {\n overflow-wrap: break-word;\n}";
2772
- const variables = ':host {\n --mb-system-font-stack:\n -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu",\n "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;\n --mb-monospace-font-stack:\n Menlo, Consolas, "Ubuntu Mono", "Roboto Mono", "DejaVu Sans Mono", monospace;\n --mb-ui-font: var(--mb-system-font-stack);\n --mb-size: 1;\n /***************************************/\n /* MB COLORS */\n /***************************************/\n --color-accent-25-rgb-value: 242 247 255; /* #F2F7FF */\n --color-accent-50-rgb-value: 231 240 255; /* #E7F0FF */\n --color-accent-100-rgb-value: 220 234 255; /* #DCEAFF */\n --color-accent-200-rgb-value: 198 221 255; /* #C6DDFF */\n --color-accent-300-rgb-value: 158 197 255; /* #9EC5FF */\n --color-accent-400-rgb-value: 111 169 255; /* #6FA9FF */\n --color-accent-500-rgb-value: 58 137 253; /* #3A89FD */\n --color-accent-600-rgb-value: 0 98 242; /* #0062F2 */\n --color-accent-700-rgb-value: 0 80 197; /* #0050C5 */\n --color-accent-800-rgb-value: 0 64 157; /* #00409D */\n --color-accent-900-rgb-value: 0 54 133; /* #003685 */\n --color-error-25-rgb-value: 255 248 249; /* #FFF8F9 */\n --color-error-50-rgb-value: 255 241 242; /* #FFF1F2 */\n --color-error-100-rgb-value: 255 228 230; /* #FFE4E6 */\n --color-error-200-rgb-value: 254 205 211; /* #FECDD3 */\n --color-error-300-rgb-value: 253 164 175; /* #FDA4AF */\n --color-error-400-rgb-value: 251 113 133; /* #FB7185 */\n --color-error-500-rgb-value: 244 63 94; /* #F43F5E */\n --color-error-600-rgb-value: 225 29 72; /* #E11D48 */\n --color-error-700-rgb-value: 190 18 60; /* #BE123C */\n --color-error-800-rgb-value: 136 19 39; /* #881337 */\n --color-error-900-rgb-value: 89 13 40; /* #590D28 */\n --color-success-25-rgb-value: 245 254 250; /* #F5FEFA */\n --color-success-50-rgb-value: 236 253 245; /* #ECFDF5 */\n --color-success-100-rgb-value: 209 250 229; /* #D1FAE5 */\n --color-success-200-rgb-value: 167 243 208; /* #A7F3D0 */\n --color-success-300-rgb-value: 110 231 183; /* #6EE7B7 */\n --color-success-400-rgb-value: 52 211 153; /* #34D399 */\n --color-success-500-rgb-value: 16 185 144; /* #10B990 */\n --color-success-600-rgb-value: 22 163 138; /* #16A38A */\n --color-success-700-rgb-value: 39 121 106; /* #27796A */\n --color-success-800-rgb-value: 23 92 79; /* #175C4F */\n --color-success-900-rgb-value: 12 59 50; /* #0C3B32 */\n --color-warning-25-rgb-value: 255 253 243; /* #FFFDF3 */\n --color-warning-50-rgb-value: 254 252 232; /* #FEFCE8 */\n --color-warning-100-rgb-value: 254 249 195; /* #FEF9C3 */\n --color-warning-200-rgb-value: 254 240 138; /* #FEF08A */\n --color-warning-300-rgb-value: 253 229 99; /* #FDE563 */\n --color-warning-400-rgb-value: 252 218 59; /* #FCDA3B */\n --color-warning-500-rgb-value: 250 204 21; /* #FACC15 */\n --color-warning-600-rgb-value: 234 179 8; /* #EAB308 */\n --color-warning-700-rgb-value: 190 142 48; /* #BE8E30 */\n --color-warning-800-rgb-value: 132 83 28; /* #84531C */\n --color-warning-900-rgb-value: 80 29 10; /* #501D0A */\n --color-deep-blue-25-rgb-value: 249 252 255; /* #F9FCFF */\n --color-deep-blue-50-rgb-value: 243 249 254; /* #F3F9FE */\n --color-deep-blue-100-rgb-value: 231 242 251; /* #E7F2FB */\n --color-deep-blue-200-rgb-value: 201 218 241; /* #C9DAF1 */\n --color-deep-blue-300-rgb-value: 162 185 216; /* #A2B9D8 */\n --color-deep-blue-400-rgb-value: 93 128 182; /* #5D80B6 */\n --color-deep-blue-500-rgb-value: 60 100 161; /* #3C64A1 */\n --color-deep-blue-600-rgb-value: 28 68 129; /* #1C4481 */\n --color-deep-blue-700-rgb-value: 24 53 97; /* #183561 */\n --color-deep-blue-800-rgb-value: 20 38 65; /* #142641 */\n --color-deep-blue-900-rgb-value: 6 23 49; /* #061731 */\n --color-light-blue-25-rgb-value: 248 251 253; /* #F8FBFD */\n --color-light-blue-50-rgb-value: 240 247 251; /* #F0F7FB */\n --color-light-blue-100-rgb-value: 228 238 244; /* #E4EEF4 */\n --color-light-blue-200-rgb-value: 215 229 238; /* #D7E5EE */\n --color-light-blue-300-rgb-value: 190 218 237; /* #BEDAED */\n --color-light-blue-400-rgb-value: 159 202 232; /* #9FCAE8 */\n --color-light-blue-500-rgb-value: 135 180 211; /* #87B4D3 */\n --color-light-blue-600-rgb-value: 104 157 193; /* #689DC1 */\n --color-light-blue-700-rgb-value: 78 129 164; /* #4E81A4 */\n --color-light-blue-800-rgb-value: 67 109 138; /* #436D8A */\n --color-light-blue-900-rgb-value: 55 84 104; /* #375468 */\n --color-gray-50-rgb-value: 249 250 251; /* #FAFAFA */\n --color-gray-100-rgb-value: 243 244 246; /* #F5F5F5 */\n --color-gray-200-rgb-value: 229 231 235; /* #F0F0F0 */\n --color-gray-300-rgb-value: 209 213 219; /* #D9D9D9 */\n --color-gray-400-rgb-value: 156 163 175; /* #BFBFBF */\n --color-gray-500-rgb-value: 107 114 128; /* #8C8C8C */\n --color-gray-600-rgb-value: 75 85 99; /* #595959 */\n --color-gray-700-rgb-value: 55 65 81; /* #434343 */\n --color-gray-800-rgb-value: 31 41 55; /* #262626 */\n --color-blue-gray-50-rgb-value: 74 74 74; /* #F9FAFB */\n --color-blue-gray-100-rgb-value: 60 60 60; /* #F3F4F6 */\n --color-blue-gray-200-rgb-value: 50 50 50; /* #E5E7EB */\n --color-blue-gray-300-rgb-value: 45 45 45; /* #D1D5DB */\n --color-blue-gray-400-rgb-value: 34 34 34; /* #9CA3AF */\n --color-blue-gray-500-rgb-value: 31 31 31; /* #6B7280 */\n --color-blue-gray-600-rgb-value: 28 28 30; /* #4B5563 */\n --color-blue-gray-700-rgb-value: 27 27 27; /* #374151 */\n --color-blue-gray-800-rgb-value: 24 24 24; /* #1F2937 */\n --color-blue-gray-900-rgb-value: 15 15 15; /* #111827 */\n --color-black-rgb-value: 0 0 0; /* #000000 */\n --color-white-rgb-value: 255 255 255; /* #FFFFFF */\n --color-primary: var(--color-accent-600-rgb-value);\n --color-error: var(--color-error-500-rgb-value);\n --color-success: var(--color-success-500-rgb-value);\n --color-warning: var(--color-warning-500-rgb-value);\n --color-deep-blue: var(--color-deep-blue-800-rgb-value);\n --color-light-blue: var(--color-light-blue-200-rgb-value);\n accent-color: var(--color-primary);\n caret-color: red;\n}';
2773
- const initialState = {
2163
+ }, hr = ":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}", mr = ":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}", fr = ':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}', gr = {
2774
2164
  feedbackLayer: null,
2775
2165
  overlayLayer: null,
2776
2166
  owner: null
2777
- };
2778
- const cameraUiRefStore = createStore()(
2167
+ }, U = be()(
2779
2168
  // this is important! Otherwise, solid-zustand will start mutating the initial state
2780
- subscribeWithSelector(() => structuredClone(initialState))
2781
- );
2782
- const cameraUiRefSignalStore = createWithSignal(cameraUiRefStore);
2783
- const noop = () => void 0;
2784
- function makeResizeObserver(callback, options) {
2785
- if (isServer) {
2786
- return { observe: noop, unobserve: noop };
2787
- }
2788
- const observer = new ResizeObserver(callback);
2789
- onCleanup(observer.disconnect.bind(observer));
2790
- return {
2791
- observe: (ref) => observer.observe(ref, options),
2792
- unobserve: observer.unobserve.bind(observer)
2169
+ ge(() => structuredClone(gr))
2170
+ ), le = Ce(U), fe = () => {
2171
+ };
2172
+ function br(t, e) {
2173
+ if (Ue)
2174
+ return { observe: fe, unobserve: fe };
2175
+ const r = new ResizeObserver(t);
2176
+ return ce(r.disconnect.bind(r)), {
2177
+ observe: (a) => r.observe(a, e),
2178
+ unobserve: r.unobserve.bind(r)
2793
2179
  };
2794
2180
  }
2795
- const determineFitMode = (Cw, Ch, Vw, Vh) => {
2796
- const scaleCover = Math.max(Cw / Vw, Ch / Vh);
2797
- let croppedFraction = 0;
2798
- if (Cw / Vw > Ch / Vh) {
2799
- const visible = scaleCover * Vh;
2800
- croppedFraction = 1 - Ch / visible;
2181
+ const pr = (t, e, r, a) => {
2182
+ const n = Math.max(t / r, e / a);
2183
+ let o = 0;
2184
+ if (t / r > e / a) {
2185
+ const i = n * a;
2186
+ o = 1 - e / i;
2801
2187
  } else {
2802
- const visible = scaleCover * Vw;
2803
- croppedFraction = 1 - Cw / visible;
2804
- }
2805
- if (croppedFraction < 0.1) {
2806
- return "cover";
2807
- } else {
2808
- return "contain";
2188
+ const i = n * r;
2189
+ o = 1 - t / i;
2809
2190
  }
2191
+ return o < 0.1 ? "cover" : "contain";
2810
2192
  };
2811
- function getVisibleVideoArea(containerWidth, containerHeight, videoWidth, videoHeight) {
2812
- const scaleX = containerWidth / videoWidth;
2813
- const scaleY = containerHeight / videoHeight;
2814
- const s = Math.max(scaleX, scaleY);
2815
- if (scaleX >= scaleY) {
2816
- const visibleNaturalHeight = Math.round(containerHeight / s);
2817
- const y = Math.round((videoHeight - visibleNaturalHeight) / 2);
2818
- return { x: 0, y, width: videoWidth, height: visibleNaturalHeight };
2193
+ function vr(t, e, r, a) {
2194
+ const n = t / r, o = e / a, i = Math.max(n, o);
2195
+ if (n >= o) {
2196
+ const l = Math.round(e / i);
2197
+ return { x: 0, y: Math.round((a - l) / 2), width: r, height: l };
2819
2198
  } else {
2820
- const visibleNaturalWidth = Math.round(containerWidth / s);
2821
- const x = Math.round((videoWidth - visibleNaturalWidth) / 2);
2822
- return { x, y: 0, width: visibleNaturalWidth, height: videoHeight };
2199
+ const l = Math.round(t / i);
2200
+ return { x: Math.round((r - l) / 2), y: 0, width: l, height: a };
2823
2201
  }
2824
2202
  }
2825
- const dialogPositioner = "_dialogPositioner_worsp_1";
2826
- const dialogBackdrop = "_dialogBackdrop_worsp_5";
2827
- const dialogContent = "_dialogContent_worsp_9";
2828
- const large = "_large_worsp_13";
2829
- const compact = "_compact_worsp_16";
2830
- const dialogTitle = "_dialogTitle_worsp_30";
2831
- const contentOut = "_contentOut_worsp_34";
2832
- const closeButton = "_closeButton_worsp_38";
2833
- const closeButtonInner = "_closeButtonInner_worsp_44";
2834
- const primaryActionButton = "_primaryActionButton_worsp_49";
2835
- const secondaryActionButton = "_secondaryActionButton_worsp_53";
2836
- const actions = "_actions_worsp_57";
2837
- const alertTitle = "_alertTitle_worsp_64";
2838
- const alertText = "_alertText_worsp_68";
2839
- const styles = {
2840
- dialogPositioner,
2841
- dialogBackdrop,
2842
- dialogContent,
2843
- large,
2844
- compact,
2845
- dialogTitle,
2846
- contentOut,
2847
- closeButton,
2848
- closeButtonInner,
2849
- primaryActionButton,
2850
- secondaryActionButton,
2851
- actions,
2852
- alertTitle,
2853
- alertText
2203
+ const wr = "_dialogPositioner_worsp_1", yr = "_dialogBackdrop_worsp_5", Sr = "_dialogContent_worsp_9", Cr = "_large_worsp_13", kr = "_compact_worsp_16", Er = "_dialogTitle_worsp_30", _r = "_contentOut_worsp_34", Tr = "_closeButton_worsp_38", Mr = "_closeButtonInner_worsp_44", xr = "_primaryActionButton_worsp_49", Rr = "_secondaryActionButton_worsp_53", Ar = "_actions_worsp_57", $r = "_alertTitle_worsp_64", Fr = "_alertText_worsp_68", _ = {
2204
+ dialogPositioner: wr,
2205
+ dialogBackdrop: yr,
2206
+ dialogContent: Sr,
2207
+ large: Cr,
2208
+ compact: kr,
2209
+ dialogTitle: Er,
2210
+ contentOut: _r,
2211
+ closeButton: Tr,
2212
+ closeButtonInner: Mr,
2213
+ primaryActionButton: xr,
2214
+ secondaryActionButton: Rr,
2215
+ actions: Ar,
2216
+ alertTitle: $r,
2217
+ alertText: Fr
2854
2218
  };
2855
- var _tmpl$$1 = /* @__PURE__ */ template(`<span>&times;`), _tmpl$2$1 = /* @__PURE__ */ template(`<div>`), _tmpl$3$1 = /* @__PURE__ */ template(`<p>`), _tmpl$4 = /* @__PURE__ */ template(`<span>`), _tmpl$5 = /* @__PURE__ */ template(`<div><button></button><button>`);
2856
- const Modal = (props) => {
2857
- const getPaddingClass = () => {
2858
- switch (props.modalStyle) {
2219
+ var Dr = /* @__PURE__ */ S("<span>&times;"), Ir = /* @__PURE__ */ S("<div>"), zr = /* @__PURE__ */ S("<p>"), Lr = /* @__PURE__ */ S("<span>"), Nr = /* @__PURE__ */ S("<div><button></button><button>");
2220
+ const Br = (t) => {
2221
+ const e = () => {
2222
+ switch (t.modalStyle) {
2859
2223
  case "compact":
2860
- return styles.compact;
2224
+ return _.compact;
2861
2225
  case "large":
2862
- return styles.compact;
2226
+ return _.compact;
2863
2227
  case "default":
2864
2228
  default:
2865
- return void 0;
2229
+ return;
2866
2230
  }
2867
2231
  };
2868
- return createComponent(SmartEnvironmentProvider, {
2869
- children: () => createComponent(Dialog.Root, mergeProps({
2870
- onFocusOutside: (e) => e.preventDefault(),
2871
- onInteractOutside: (e) => e.preventDefault(),
2872
- restoreFocus: true,
2873
- unmountOnExit: true,
2874
- lazyMount: true
2875
- }, props, {
2232
+ return s(ee, {
2233
+ children: () => s($.Root, Y({
2234
+ onFocusOutside: (r) => r.preventDefault(),
2235
+ onInteractOutside: (r) => r.preventDefault(),
2236
+ restoreFocus: !0,
2237
+ unmountOnExit: !0,
2238
+ lazyMount: !0
2239
+ }, t, {
2876
2240
  get children() {
2877
- return createComponent(Show, {
2241
+ return s(E, {
2878
2242
  get when() {
2879
- return props.open;
2243
+ return t.open;
2880
2244
  },
2881
2245
  get children() {
2882
- return createComponent(Portal, {
2246
+ return s(ve, {
2883
2247
  get mount() {
2884
- return props.mountTarget;
2248
+ return t.mountTarget;
2885
2249
  },
2886
2250
  get children() {
2887
- return createComponent(Dialog.Positioner, {
2888
- get ["class"]() {
2889
- return styles.dialogPositioner;
2251
+ return s($.Positioner, {
2252
+ get class() {
2253
+ return _.dialogPositioner;
2890
2254
  },
2891
2255
  get children() {
2892
- return [createComponent(Dialog.Backdrop, {
2893
- get ["class"]() {
2894
- return styles.dialogBackdrop;
2256
+ return [s($.Backdrop, {
2257
+ get class() {
2258
+ return _.dialogBackdrop;
2895
2259
  }
2896
- }), createComponent(Dialog.Content, {
2897
- get ["class"]() {
2898
- return `${styles.dialogContent} ${getPaddingClass()}`;
2260
+ }), s($.Content, {
2261
+ get class() {
2262
+ return `${_.dialogContent} ${e()}`;
2899
2263
  },
2900
2264
  get children() {
2901
- return [createComponent(Show, {
2265
+ return [s(E, {
2902
2266
  get when() {
2903
- return props.showCloseButton;
2267
+ return t.showCloseButton;
2904
2268
  },
2905
2269
  get children() {
2906
- return createComponent(Dialog.CloseTrigger, {
2907
- get ["class"]() {
2908
- return styles.closeButton;
2270
+ return s($.CloseTrigger, {
2271
+ get class() {
2272
+ return _.closeButton;
2909
2273
  },
2910
2274
  get onClick() {
2911
- return props.onCloseClicked;
2275
+ return t.onCloseClicked;
2912
2276
  },
2913
2277
  get children() {
2914
- var _el$ = _tmpl$$1();
2915
- effect(() => className(_el$, styles.closeButtonInner));
2916
- return _el$;
2278
+ var r = Dr();
2279
+ return H(() => V(r, _.closeButtonInner)), r;
2917
2280
  }
2918
2281
  });
2919
2282
  }
2920
- }), createComponent(Show, {
2283
+ }), s(E, {
2921
2284
  get when() {
2922
- return props.headerImage;
2285
+ return t.headerImage;
2923
2286
  },
2924
2287
  get children() {
2925
- return props.headerImage;
2288
+ return t.headerImage;
2926
2289
  }
2927
- }), createComponent(Show, {
2290
+ }), s(E, {
2928
2291
  get when() {
2929
- return props.header;
2292
+ return t.header;
2930
2293
  },
2931
- children: (header) => createComponent(Dialog.Title, {
2932
- get ["class"]() {
2933
- return styles.dialogTitle;
2294
+ children: (r) => s($.Title, {
2295
+ get class() {
2296
+ return _.dialogTitle;
2934
2297
  },
2935
2298
  get children() {
2936
- return header();
2299
+ return r();
2937
2300
  }
2938
2301
  })
2939
- }), createComponent(Dialog.Description, {
2940
- get ["class"]() {
2941
- return styles.contentOut;
2302
+ }), s($.Description, {
2303
+ get class() {
2304
+ return _.contentOut;
2942
2305
  },
2943
2306
  get children() {
2944
- return props.children;
2307
+ return t.children;
2945
2308
  }
2946
- }), createComponent(Show, {
2309
+ }), s(E, {
2947
2310
  get when() {
2948
- return props.actions;
2311
+ return t.actions;
2949
2312
  },
2950
2313
  get children() {
2951
- var _el$2 = _tmpl$2$1();
2952
- insert(_el$2, () => props.actions);
2953
- return _el$2;
2314
+ var r = Ir();
2315
+ return y(r, () => t.actions), r;
2954
2316
  }
2955
2317
  })];
2956
2318
  }
@@ -2964,89 +2326,73 @@ const Modal = (props) => {
2964
2326
  }
2965
2327
  }))
2966
2328
  });
2967
- };
2968
- const AlertModal = ({
2969
- mountTarget,
2970
- header,
2971
- text,
2972
- open,
2973
- onPrimaryClick,
2974
- onSecondaryClick,
2975
- primaryButtonText = "Retry",
2976
- secondaryButtonText = "Cancel"
2329
+ }, Or = ({
2330
+ mountTarget: t,
2331
+ header: e,
2332
+ text: r,
2333
+ open: a,
2334
+ onPrimaryClick: n,
2335
+ onSecondaryClick: o,
2336
+ primaryButtonText: i = "Retry",
2337
+ secondaryButtonText: l = "Cancel"
2977
2338
  }) => {
2978
- let primaryButtonEl;
2979
- return createComponent(Modal, {
2980
- mountTarget,
2339
+ let c;
2340
+ return s(Br, {
2341
+ mountTarget: t,
2981
2342
  get header() {
2982
2343
  return (() => {
2983
- var _el$4 = _tmpl$4();
2984
- insert(_el$4, header);
2985
- effect(() => className(_el$4, styles.alertTitle));
2986
- return _el$4;
2344
+ var d = Lr();
2345
+ return y(d, e), H(() => V(d, _.alertTitle)), d;
2987
2346
  })();
2988
2347
  },
2989
- initialFocusEl: () => primaryButtonEl,
2990
- open,
2348
+ initialFocusEl: () => c,
2349
+ open: a,
2991
2350
  get actions() {
2992
2351
  return (() => {
2993
- var _el$5 = _tmpl$5(), _el$6 = _el$5.firstChild, _el$7 = _el$6.nextSibling;
2994
- _el$6.$$click = () => onSecondaryClick();
2995
- insert(_el$6, secondaryButtonText);
2996
- _el$7.$$click = () => onPrimaryClick();
2997
- var _ref$ = primaryButtonEl;
2998
- typeof _ref$ === "function" ? use(_ref$, _el$7) : primaryButtonEl = _el$7;
2999
- insert(_el$7, primaryButtonText);
3000
- effect((_p$) => {
3001
- var _v$ = styles.actions, _v$2 = styles.secondaryActionButton, _v$3 = styles.primaryActionButton;
3002
- _v$ !== _p$.e && className(_el$5, _p$.e = _v$);
3003
- _v$2 !== _p$.t && className(_el$6, _p$.t = _v$2);
3004
- _v$3 !== _p$.a && className(_el$7, _p$.a = _v$3);
3005
- return _p$;
2352
+ var d = Nr(), h = d.firstChild, C = h.nextSibling;
2353
+ h.$$click = () => o(), y(h, l), C.$$click = () => n();
2354
+ var w = c;
2355
+ return typeof w == "function" ? B(w, C) : c = C, y(C, i), H((u) => {
2356
+ var v = _.actions, b = _.secondaryActionButton, f = _.primaryActionButton;
2357
+ return v !== u.e && V(d, u.e = v), b !== u.t && V(h, u.t = b), f !== u.a && V(C, u.a = f), u;
3006
2358
  }, {
3007
2359
  e: void 0,
3008
2360
  t: void 0,
3009
2361
  a: void 0
3010
- });
3011
- return _el$5;
2362
+ }), d;
3012
2363
  })();
3013
2364
  },
3014
2365
  modalStyle: "compact",
3015
2366
  get children() {
3016
- var _el$3 = _tmpl$3$1();
3017
- insert(_el$3, text);
3018
- effect(() => className(_el$3, styles.alertText));
3019
- return _el$3;
2367
+ var d = zr();
2368
+ return y(d, r), H(() => V(d, _.alertText)), d;
3020
2369
  }
3021
2370
  });
3022
2371
  };
3023
- delegateEvents(["click"]);
3024
- const CameraErrorModal = () => {
2372
+ qe(["click"]);
2373
+ const Pr = () => {
3025
2374
  const {
3026
2375
  t
3027
- } = useLocalization();
3028
- const {
3029
- cameraManagerSolidStore,
3030
- cameraManager,
3031
- dismountCameraUi
3032
- } = useCameraUiStore();
3033
- const errorState = cameraManagerSolidStore((x) => x.errorState);
3034
- const overlayLayer = cameraUiRefSignalStore((x) => x.overlayLayer);
3035
- return createComponent(Show, {
2376
+ } = Z(), {
2377
+ cameraManagerSolidStore: e,
2378
+ cameraManager: r,
2379
+ dismountCameraUi: a
2380
+ } = j(), n = e((i) => i.errorState), o = le((i) => i.overlayLayer);
2381
+ return s(E, {
3036
2382
  get when() {
3037
- return errorState();
2383
+ return n();
3038
2384
  },
3039
2385
  get children() {
3040
- return createComponent(AlertModal, {
2386
+ return s(Or, {
3041
2387
  get mountTarget() {
3042
- return overlayLayer();
2388
+ return o();
3043
2389
  },
3044
2390
  get header() {
3045
2391
  return t.camera_error_title;
3046
2392
  },
3047
- open: true,
3048
- onPrimaryClick: () => void cameraManager.startCameraStream(),
3049
- onSecondaryClick: () => dismountCameraUi(),
2393
+ open: !0,
2394
+ onPrimaryClick: () => void r.startCameraStream(),
2395
+ onSecondaryClick: () => a(),
3050
2396
  get primaryButtonText() {
3051
2397
  return t.camera_error_primary_btn;
3052
2398
  },
@@ -3060,179 +2406,134 @@ const CameraErrorModal = () => {
3060
2406
  }
3061
2407
  });
3062
2408
  };
3063
- var _tmpl$ = /* @__PURE__ */ template(`<style>`), _tmpl$2 = /* @__PURE__ */ template(`<style id=camera-manager-style>`), _tmpl$3 = /* @__PURE__ */ template(`<div class="bg-dark-500 color-white size-full relative min-h-[300px]"part=capture-screen-part><video part=video-element-part 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>`);
3064
- const CAPTURE_SCREEN_SHADOW_ROOT_HOST_ID = "capture-screen-host";
3065
- const CaptureScreen = () => {
2409
+ var ne = /* @__PURE__ */ S("<style>"), Vr = /* @__PURE__ */ S("<style id=camera-manager-style>"), Ur = /* @__PURE__ */ S('<div class="bg-dark-500 color-white size-full relative min-h-[300px]"part=capture-screen-part><video part=video-element-part 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>');
2410
+ const Be = "capture-screen-host", Oe = () => {
3066
2411
  const {
3067
- cameraManager,
3068
- mountTarget
3069
- } = useCameraUiStore();
3070
- const [videoRef, setVideoRef] = createSignal();
3071
- const [feedbackRef, setFeedbackRef] = createSignal();
3072
- const [overlayLayerRef, setOverlayLayerRef] = createSignal();
3073
- const isPortalled = () => mountTarget.parentNode === document.body;
3074
- const [fitMode, setFitMode] = createSignal("contain");
3075
- function adjustVideoFit() {
3076
- const video = videoRef();
3077
- if (!video) {
2412
+ cameraManager: t,
2413
+ mountTarget: e,
2414
+ showCameraErrorModal: r
2415
+ } = j(), [a, n] = z(), [o, i] = z(), [l, c] = z(), d = () => e.parentNode === document.body, [h, C] = z("contain");
2416
+ function w() {
2417
+ const u = a();
2418
+ if (!u)
3078
2419
  return;
3079
- }
3080
- const Cw = video.clientWidth;
3081
- const Ch = video.clientHeight;
3082
- const Vw = video.videoWidth;
3083
- const Vh = video.videoHeight;
3084
- const newFitMode = determineFitMode(Cw, Ch, Vw, Vh);
3085
- setFitMode(newFitMode);
3086
- if (newFitMode === "cover") {
3087
- const visibleArea = getVisibleVideoArea(Cw, Ch, Vw, Vh);
3088
- cameraManager.setExtractionArea(visibleArea);
3089
- } else {
3090
- cameraManager.setExtractionArea({
2420
+ const v = u.clientWidth, b = u.clientHeight, f = u.videoWidth, g = u.videoHeight;
2421
+ if (f === 0 || g === 0)
2422
+ return;
2423
+ const p = pr(v, b, f, g);
2424
+ if (C(p), p === "cover") {
2425
+ const k = vr(v, b, f, g);
2426
+ t.setExtractionArea(k);
2427
+ } else
2428
+ t.setExtractionArea({
3091
2429
  x: 0,
3092
2430
  y: 0,
3093
- width: Vw,
3094
- height: Vh
2431
+ width: f,
2432
+ height: g
3095
2433
  });
3096
- }
3097
2434
  }
3098
- onMount(() => {
3099
- const video = videoRef();
3100
- if (!video) {
2435
+ return J(() => {
2436
+ const u = a();
2437
+ if (!u)
3101
2438
  return;
3102
- }
3103
2439
  const {
3104
- observe,
3105
- unobserve
3106
- } = makeResizeObserver(adjustVideoFit);
3107
- observe(video);
3108
- video.addEventListener("loadedmetadata", adjustVideoFit);
3109
- onCleanup(() => {
3110
- unobserve(video);
3111
- video.removeEventListener("loadedmetadata", adjustVideoFit);
2440
+ observe: v,
2441
+ unobserve: b
2442
+ } = br(w);
2443
+ v(u), u.addEventListener("resize", w), u.addEventListener("loadedmetadata", w), ce(() => {
2444
+ b(u), u.removeEventListener("resize", w), u.removeEventListener("loadedmetadata", w);
3112
2445
  });
3113
- });
3114
- onMount(() => {
3115
- const owner = getOwner();
3116
- if (!owner) {
3117
- return;
3118
- }
3119
- cameraUiRefSignalStore.setState({
3120
- owner
3121
- });
3122
- });
3123
- createEffect(() => {
3124
- const $videoRef = videoRef();
3125
- const $feedbackRef = feedbackRef();
3126
- const $overlayLayerRef = overlayLayerRef();
3127
- if (!$videoRef || !$feedbackRef || !$overlayLayerRef) {
3128
- return;
3129
- }
3130
- cameraUiRefSignalStore.setState({
3131
- feedbackLayer: $feedbackRef,
3132
- overlayLayer: $overlayLayerRef
2446
+ }), J(() => {
2447
+ const u = Se();
2448
+ u && le.setState({
2449
+ owner: u
3133
2450
  });
3134
- cameraManager.initVideoElement($videoRef);
3135
- });
3136
- return createComponent(SolidShadowRoot, {
2451
+ }), Qe(() => {
2452
+ const u = a(), v = o(), b = l();
2453
+ !u || !v || !b || (le.setState({
2454
+ feedbackLayer: v,
2455
+ overlayLayer: b
2456
+ }), t.initVideoElement(u));
2457
+ }), s(dr, {
3137
2458
  get id() {
3138
- return !isPortalled() ? CAPTURE_SCREEN_SHADOW_ROOT_HOST_ID : void 0;
2459
+ return d() ? void 0 : Be;
3139
2460
  },
3140
2461
  get disableShadowRoot() {
3141
- return isPortalled();
2462
+ return d();
3142
2463
  },
3143
2464
  get style() {
3144
- return isPortalled() ? {
2465
+ return d() ? {
3145
2466
  height: "100%"
3146
2467
  } : void 0;
3147
2468
  },
3148
2469
  get children() {
3149
2470
  return [(() => {
3150
- var _el$ = _tmpl$();
3151
- insert(_el$, variables);
3152
- return _el$;
2471
+ var u = ne();
2472
+ return y(u, fr), u;
3153
2473
  })(), (() => {
3154
- var _el$2 = _tmpl$();
3155
- insert(_el$2, normalize);
3156
- return _el$2;
2474
+ var u = ne();
2475
+ return y(u, hr), u;
3157
2476
  })(), (() => {
3158
- var _el$3 = _tmpl$();
3159
- insert(_el$3, rootStyles);
3160
- return _el$3;
2477
+ var u = ne();
2478
+ return y(u, mr), u;
3161
2479
  })(), (() => {
3162
- var _el$4 = _tmpl$2();
3163
- use((ref) => {
3164
- if (window.__mbCameraManagerCssCode) {
3165
- ref.innerHTML = window.__mbCameraManagerCssCode;
3166
- }
3167
- }, _el$4);
3168
- return _el$4;
2480
+ var u = Vr();
2481
+ return B((v) => {
2482
+ window.__mbCameraManagerCssCode && (v.innerHTML = window.__mbCameraManagerCssCode);
2483
+ }, u), u;
3169
2484
  })(), (() => {
3170
- var _el$5 = _tmpl$3(), _el$6 = _el$5.firstChild, _el$7 = _el$6.nextSibling, _el$8 = _el$7.nextSibling;
3171
- insert(_el$5, createComponent(Header, {}), _el$6);
3172
- use(setVideoRef, _el$6);
3173
- use(setFeedbackRef, _el$7);
3174
- use(setOverlayLayerRef, _el$8);
3175
- insert(_el$5, createComponent(CameraErrorModal, {}), null);
3176
- effect((_$p) => (_$p = fitMode()) != null ? _el$6.style.setProperty("object-fit", _$p) : _el$6.style.removeProperty("object-fit"));
3177
- return _el$5;
2485
+ var u = Ur(), v = u.firstChild, b = v.nextSibling, f = b.nextSibling;
2486
+ return y(u, s(lr, {}), v), B(n, v), B(i, b), B(c, f), y(u, s(E, {
2487
+ when: r,
2488
+ get children() {
2489
+ return s(Pr, {});
2490
+ }
2491
+ }), null), H((g) => (g = h()) != null ? v.style.setProperty("object-fit", g) : v.style.removeProperty("object-fit")), u;
3178
2492
  })()];
3179
2493
  }
3180
2494
  });
3181
- };
3182
- const CaptureScreenPortalled = () => {
2495
+ }, qr = () => {
3183
2496
  const {
3184
2497
  t
3185
- } = useLocalization();
3186
- const [isOpen, setIsOpen] = createSignal(true);
3187
- const {
3188
- addOnDismountCallback
3189
- } = useCameraUiStore();
3190
- addOnDismountCallback(() => {
3191
- setIsOpen(false);
3192
- });
3193
- return createComponent(Portal, {
3194
- useShadow: true,
2498
+ } = Z(), [e, r] = z(!0), {
2499
+ addOnDismountCallback: a
2500
+ } = j();
2501
+ return a(() => {
2502
+ r(!1);
2503
+ }), s(ve, {
2504
+ useShadow: !0,
3195
2505
  get mount() {
3196
- return document.getElementById(MOUNT_POINT_ID);
3197
- },
3198
- ref: (ref) => {
3199
- ref.id = CAPTURE_SCREEN_SHADOW_ROOT_HOST_ID;
3200
- ref.style.zIndex = "1000";
3201
- ref.style.position = "fixed";
3202
- ref.id = "mb-camera-host";
3203
- return ref;
2506
+ return document.getElementById(Pe);
3204
2507
  },
2508
+ ref: (n) => (n.id = Be, n.style.zIndex = "1000", n.style.position = "fixed", n.id = "mb-camera-host", n),
3205
2509
  get children() {
3206
- return createComponent(SmartEnvironmentProvider, {
3207
- children: (rootNode) => createComponent(Dialog.Root, {
2510
+ return s(ee, {
2511
+ children: (n) => s($.Root, {
3208
2512
  get open() {
3209
- return isOpen();
2513
+ return e();
3210
2514
  },
3211
- lazyMount: true,
3212
- unmountOnExit: true,
2515
+ lazyMount: !0,
2516
+ unmountOnExit: !0,
3213
2517
  initialFocusEl: () => {
3214
- const dummyNode = document.createElement("div");
3215
- dummyNode.tabIndex = -1;
3216
- rootNode.appendChild(dummyNode);
3217
- setTimeout(() => {
3218
- dummyNode.remove();
3219
- }, 0);
3220
- return dummyNode;
2518
+ const o = document.createElement("div");
2519
+ return o.tabIndex = -1, n.appendChild(o), setTimeout(() => {
2520
+ o.remove();
2521
+ }, 0), o;
3221
2522
  },
3222
2523
  get children() {
3223
- return createComponent(Dialog.Positioner, {
2524
+ return s($.Positioner, {
3224
2525
  get children() {
3225
- return createComponent(Dialog.Content, {
2526
+ return s($.Content, {
3226
2527
  "aria-labelledby": "dialog-title",
3227
- "class": "h-vh supports-[(height:100dvh)]:h-dvh top-0 left-0 w-full fixed",
2528
+ class: "h-vh supports-[(height:100dvh)]:h-dvh top-0 left-0 w-full fixed",
3228
2529
  get children() {
3229
- return [createComponent(Dialog.Title, {
3230
- "class": "sr-only",
2530
+ return [s($.Title, {
2531
+ class: "sr-only",
3231
2532
  id: "dialog-title",
3232
2533
  get children() {
3233
2534
  return t.scan_document;
3234
2535
  }
3235
- }), createComponent(CaptureScreen, {})];
2536
+ }), s(Oe, {})];
3236
2537
  }
3237
2538
  });
3238
2539
  }
@@ -3242,89 +2543,71 @@ const CaptureScreenPortalled = () => {
3242
2543
  });
3243
2544
  }
3244
2545
  });
3245
- };
3246
- const RootComponent = () => {
2546
+ }, jr = () => {
3247
2547
  const {
3248
- mountTarget
3249
- } = useCameraUiStore();
3250
- return createComponent(Dynamic, {
2548
+ mountTarget: t
2549
+ } = j();
2550
+ return s(je, {
3251
2551
  get component() {
3252
- return mountTarget.parentNode === document.body ? CaptureScreenPortalled : CaptureScreen;
2552
+ return t.parentNode === document.body ? qr : Oe;
3253
2553
  }
3254
2554
  });
3255
- };
3256
- const MOUNT_POINT_ID = "camera-manager-mount-point";
3257
- function createCameraManagerUi(cameraManager, target, {
3258
- localizationStrings,
3259
- showMirrorCameraButton = false,
3260
- showTorchButton = true,
3261
- showCloseButton = true
2555
+ }, Pe = "camera-manager-mount-point";
2556
+ function ra(t, e, {
2557
+ localizationStrings: r,
2558
+ showMirrorCameraButton: a = !1,
2559
+ showTorchButton: n = !0,
2560
+ showCloseButton: o = !0,
2561
+ showCameraErrorModal: i = !0
3262
2562
  } = {}) {
3263
- let mountTarget;
3264
- const dismountCallbacks = /* @__PURE__ */ new Set();
3265
- let updateLocalizationRef;
3266
- const setLocalizationRef = (setter) => {
3267
- updateLocalizationRef = setter;
2563
+ let l;
2564
+ const c = /* @__PURE__ */ new Set();
2565
+ let d;
2566
+ const h = (g) => {
2567
+ d = g;
2568
+ }, C = () => {
2569
+ t.reset();
3268
2570
  };
3269
- const cleanupCameraManager = () => {
3270
- cameraManager.reset();
3271
- };
3272
- let dismountRef;
3273
- const dismountCameraManagerUi = () => {
2571
+ let w;
2572
+ const u = () => {
3274
2573
  try {
3275
2574
  console.debug("🧱 Dismounting camera manager UI");
3276
- for (const callback of dismountCallbacks) {
3277
- callback();
3278
- }
3279
- dismountCallbacks.clear();
3280
- cleanupCameraManager();
3281
- requestAnimationFrame(() => {
2575
+ for (const g of c)
2576
+ g();
2577
+ c.clear(), C(), requestAnimationFrame(() => {
3282
2578
  requestAnimationFrame(() => {
3283
- if (dismountRef) {
3284
- dismountRef();
3285
- }
3286
- mountTarget.remove();
3287
- cleanupCameraManager();
2579
+ w && w(), l.remove(), C();
3288
2580
  });
3289
2581
  });
3290
- } catch (e) {
3291
- console.warn("Error while dismounting camera manager UI", e);
2582
+ } catch (g) {
2583
+ console.warn("Error while dismounting camera manager UI", g);
3292
2584
  }
3293
- };
3294
- const newMountTarget = document.createElement("div");
3295
- newMountTarget.id = MOUNT_POINT_ID;
3296
- mountTarget = newMountTarget;
3297
- if (target) {
3298
- target.appendChild(newMountTarget);
3299
- } else {
3300
- document.body.appendChild(newMountTarget);
3301
- }
3302
- const addOnDismountCallback = (fn) => {
3303
- dismountCallbacks.add(fn);
3304
- return () => {
3305
- dismountCallbacks.delete(fn);
3306
- };
3307
- };
3308
- dismountRef = render(() => createComponent(LocalizationProvider, {
3309
- userStrings: localizationStrings,
3310
- setLocalizationRef,
2585
+ }, v = document.createElement("div");
2586
+ v.id = Pe, l = v, e ? e.appendChild(v) : document.body.appendChild(v);
2587
+ const b = (g) => (c.add(g), () => {
2588
+ c.delete(g);
2589
+ });
2590
+ w = He(() => s(Ot, {
2591
+ userStrings: r,
2592
+ setLocalizationRef: h,
3311
2593
  get children() {
3312
- return createComponent(CameraUiStoreProvider, {
3313
- addOnDismountCallback,
3314
- dismountCameraUi: dismountCameraManagerUi,
3315
- cameraManager,
3316
- showMirrorCameraButton,
3317
- showTorchButton,
3318
- showCloseButton,
3319
- mountTarget,
2594
+ return s(Nt, {
2595
+ addOnDismountCallback: b,
2596
+ dismountCameraUi: u,
2597
+ cameraManager: t,
2598
+ showMirrorCameraButton: a,
2599
+ showTorchButton: n,
2600
+ showCloseButton: o,
2601
+ showCameraErrorModal: i,
2602
+ mountTarget: l,
3320
2603
  get children() {
3321
- return createComponent(RootComponent, {});
2604
+ return s(jr, {});
3322
2605
  }
3323
2606
  });
3324
2607
  }
3325
- }), mountTarget);
3326
- const exposedComponentApi = {
3327
- updateLocalization: updateLocalizationRef,
2608
+ }), l);
2609
+ const f = {
2610
+ updateLocalization: d,
3328
2611
  /**
3329
2612
  * Adds a callback to be called when the component is unmounted.
3330
2613
  * Returns a cleanup function that removes the callback when called.
@@ -3332,88 +2615,65 @@ function createCameraManagerUi(cameraManager, target, {
3332
2615
  * @param fn - The callback function to be called when the component is unmounted
3333
2616
  * @returns A cleanup function that removes the callback when called
3334
2617
  */
3335
- addOnDismountCallback,
3336
- cameraManager,
2618
+ addOnDismountCallback: b,
2619
+ cameraManager: t,
3337
2620
  // we know these are defined because `createCameraManagerUi` resolves when they are defined
3338
2621
  // TODO: maybe don't use getters but make sure they are defined
3339
2622
  get feedbackLayerNode() {
3340
- return cameraUiRefStore.getState().feedbackLayer;
2623
+ return U.getState().feedbackLayer;
3341
2624
  },
3342
2625
  get overlayLayerNode() {
3343
- return cameraUiRefStore.getState().overlayLayer;
2626
+ return U.getState().overlayLayer;
3344
2627
  },
3345
2628
  get owner() {
3346
- return cameraUiRefStore.getState().owner;
2629
+ return U.getState().owner;
3347
2630
  },
3348
- dismount: dismountCameraManagerUi
2631
+ dismount: u
3349
2632
  };
3350
- return new Promise((resolve) => {
3351
- let videoExists = false;
3352
- let feedbackExists = false;
3353
- let overlayExists = false;
3354
- let unsubscribeFeedbackLayer = () => {
3355
- };
3356
- let unsubscribeOverlayLayer = () => {
3357
- };
3358
- let unsubscribeVideo = () => {
2633
+ return new Promise((g) => {
2634
+ let p = !1, k = !1, x = !1, I = () => {
2635
+ }, G = () => {
2636
+ }, X = () => {
3359
2637
  };
3360
- const checkReady = () => {
3361
- if (videoExists && feedbackExists && overlayExists) {
3362
- unsubscribeFeedbackLayer();
3363
- unsubscribeOverlayLayer();
3364
- unsubscribeVideo();
3365
- resolve(exposedComponentApi);
3366
- }
2638
+ const te = () => {
2639
+ p && k && x && (I(), G(), X(), g(f));
3367
2640
  };
3368
- unsubscribeFeedbackLayer = cameraUiRefStore.subscribe((x) => x.feedbackLayer, (feedbackLayer) => {
3369
- if (feedbackLayer) {
3370
- feedbackExists = true;
3371
- }
3372
- checkReady();
2641
+ I = U.subscribe((R) => R.feedbackLayer, (R) => {
2642
+ R && (k = !0), te();
3373
2643
  }, {
3374
- fireImmediately: true
3375
- });
3376
- unsubscribeOverlayLayer = cameraUiRefStore.subscribe((x) => x.overlayLayer, (overlayLayer) => {
3377
- if (overlayLayer) {
3378
- overlayExists = true;
3379
- }
3380
- checkReady();
2644
+ fireImmediately: !0
2645
+ }), G = U.subscribe((R) => R.overlayLayer, (R) => {
2646
+ R && (x = !0), te();
3381
2647
  }, {
3382
- fireImmediately: true
3383
- });
3384
- unsubscribeVideo = cameraManager.subscribe((state) => state.videoElement, (videoElement) => {
3385
- if (videoElement) {
3386
- videoExists = true;
3387
- checkReady();
3388
- }
2648
+ fireImmediately: !0
2649
+ }), X = t.subscribe((R) => R.videoElement, (R) => {
2650
+ R && (p = !0, te());
3389
2651
  }, {
3390
- fireImmediately: true
2652
+ fireImmediately: !0
3391
2653
  });
3392
2654
  });
3393
2655
  }
3394
- const testSymbol = Symbol();
3395
- globalThis.__CAMERA_MANAGER__ ||= testSymbol;
3396
- if (globalThis.__CAMERA_MANAGER__ !== testSymbol) {
3397
- console.warn(
3398
- "Detected multiple instances of @microblink/camera-manager. This can lead to unexpected behavior."
3399
- );
3400
- }
2656
+ const Ve = Symbol();
2657
+ globalThis.__CAMERA_MANAGER__ ||= Ve;
2658
+ globalThis.__CAMERA_MANAGER__ !== Ve && console.warn(
2659
+ "Detected multiple instances of @microblink/camera-manager. This can lead to unexpected behavior."
2660
+ );
3401
2661
  export {
3402
- Camera,
3403
- CameraManager,
3404
- MOUNT_POINT_ID,
3405
- VideoFrameProcessor,
3406
- cameraManagerStore,
3407
- cameraUiRefStore,
3408
- createCameraManagerUi,
3409
- defaultCameraManagerOptions,
3410
- findResolutionKey,
3411
- getBuffer,
3412
- getNormalizedResolution,
3413
- isBufferDetached,
3414
- matchClosestResolution,
3415
- resetCameraManagerStore,
3416
- returnLongerSide,
3417
- videoResolutions
2662
+ Ae as Camera,
2663
+ xe as CameraError,
2664
+ ta as CameraManager,
2665
+ Pe as MOUNT_POINT_ID,
2666
+ It as VideoFrameProcessor,
2667
+ m as cameraManagerStore,
2668
+ U as cameraUiRefStore,
2669
+ ra as createCameraManagerUi,
2670
+ zt as defaultCameraManagerOptions,
2671
+ wt as findResolutionKey,
2672
+ Ie as getBuffer,
2673
+ pt as getNormalizedResolution,
2674
+ se as isBufferDetached,
2675
+ vt as matchClosestResolution,
2676
+ yt as resetCameraManagerStore,
2677
+ bt as returnLongerSide,
2678
+ O as videoResolutions
3418
2679
  };
3419
- //# sourceMappingURL=camera-manager.js.map