@genai-fi/base 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +7 -0
- package/README.md +18 -0
- package/dist/Button-DQwRVw4a.js +1918 -0
- package/dist/DefaultPropsProvider-C0Ib4Mye.js +520 -0
- package/dist/DialogQR-BU45QB3i.js +1625 -0
- package/dist/FileSaver.min-DhePf63e.js +2397 -0
- package/dist/FlashWifi-CaAOKd3g.js +33 -0
- package/dist/_commonjsHelpers-DaMA6jEr.js +8 -0
- package/dist/assets/AlertPara.css +1 -0
- package/dist/assets/ConnectionStatus.css +1 -0
- package/dist/assets/DialogQR.css +1 -0
- package/dist/assets/Motd.css +1 -0
- package/dist/assets/Privacy.css +1 -0
- package/dist/assets/Spinner.css +1 -0
- package/dist/assets/Webcam.css +1 -0
- package/dist/assets/style.css +1 -0
- package/dist/assets/theme.css +1 -0
- package/dist/colours.module.css +19 -0
- package/dist/components/AlertPara/AlertPara.d.ts +8 -0
- package/dist/components/AlertPara/AlertPara.js +19 -0
- package/dist/components/BusyButton/BusyButton.d.ts +7 -0
- package/dist/components/BusyButton/BusyButton.js +25 -0
- package/dist/components/Button/Button.d.ts +6 -0
- package/dist/components/Button/Button.js +6 -0
- package/dist/components/ConnectionStatus/ConnectionStatus.d.ts +12 -0
- package/dist/components/ConnectionStatus/ConnectionStatus.js +82 -0
- package/dist/components/ConnectionStatus/FlashWifi.d.ts +1 -0
- package/dist/components/ConnectionStatus/FlashWifi.js +6 -0
- package/dist/components/ConnectionStatus/check.d.ts +1 -0
- package/dist/components/ConnectionStatus/check.js +10 -0
- package/dist/components/ConnectionStatus/ice.d.ts +13 -0
- package/dist/components/ConnectionStatus/ice.js +12 -0
- package/dist/components/ContentLoader/ContentError.d.ts +5 -0
- package/dist/components/ContentLoader/ContentError.js +21 -0
- package/dist/components/ContentLoader/ContentLoader.d.ts +8 -0
- package/dist/components/ContentLoader/ContentLoader.js +51 -0
- package/dist/components/ContentLoader/ContentProgress.d.ts +6 -0
- package/dist/components/ContentLoader/ContentProgress.js +31 -0
- package/dist/components/Motd/Motd.d.ts +5 -0
- package/dist/components/Motd/Motd.js +48 -0
- package/dist/components/Privacy/Privacy.d.ts +7 -0
- package/dist/components/Privacy/Privacy.js +57 -0
- package/dist/components/QRCode/DialogQR.d.ts +7 -0
- package/dist/components/QRCode/DialogQR.js +14 -0
- package/dist/components/QRCode/QRCode.d.ts +9 -0
- package/dist/components/QRCode/QRCode.js +61 -0
- package/dist/components/Spinner/Spinner.d.ts +6 -0
- package/dist/components/Spinner/Spinner.js +33 -0
- package/dist/components/Webcam/Webcam.d.ts +15 -0
- package/dist/components/Webcam/Webcam.js +397 -0
- package/dist/components/Webcam/webcamClass.d.ts +32 -0
- package/dist/components/Webcam/webcamClass.js +76 -0
- package/dist/createSvgIcon-BfF8yuCp.js +249 -0
- package/dist/createTheme-BIcG8YPQ.js +2895 -0
- package/dist/hooks/id.d.ts +1 -0
- package/dist/hooks/id.js +16 -0
- package/dist/hooks/onlyOnce.d.ts +1 -0
- package/dist/hooks/onlyOnce.js +7 -0
- package/dist/hooks/peer.d.ts +25 -0
- package/dist/hooks/peer.js +70 -0
- package/dist/hooks/random.d.ts +1 -0
- package/dist/hooks/random.js +9 -0
- package/dist/hooks/useTabActive.d.ts +1 -0
- package/dist/hooks/useTabActive.js +17 -0
- package/dist/index-SOhdqzHq.js +113 -0
- package/dist/main.d.ts +21 -0
- package/dist/main.js +49 -0
- package/dist/react-D-b-Xrzv.js +98 -0
- package/dist/services/peer2peer/Incoming.d.ts +13 -0
- package/dist/services/peer2peer/Incoming.js +39 -0
- package/dist/services/peer2peer/Outgoing.d.ts +25 -0
- package/dist/services/peer2peer/Outgoing.js +65 -0
- package/dist/services/peer2peer/Peer2Peer.d.ts +80 -0
- package/dist/services/peer2peer/Peer2Peer.js +3367 -0
- package/dist/services/peer2peer/PeerConnection.d.ts +40 -0
- package/dist/services/peer2peer/PeerConnection.js +155 -0
- package/dist/services/peer2peer/error.d.ts +2 -0
- package/dist/services/peer2peer/error.js +5 -0
- package/dist/services/peer2peer/types.d.ts +38 -0
- package/dist/services/peer2peer/types.js +1 -0
- package/dist/state/webrtcState.d.ts +12 -0
- package/dist/state/webrtcState.js +6 -0
- package/dist/style/theme.d.ts +1 -0
- package/dist/style/theme.js +33 -0
- package/dist/style.module-DSFm2eLD.js +9 -0
- package/dist/util/backoff.d.ts +1 -0
- package/dist/util/backoff.js +6 -0
- package/dist/util/base64.d.ts +2 -0
- package/dist/util/base64.js +19 -0
- package/dist/util/canvas.d.ts +7 -0
- package/dist/util/canvas.js +92 -0
- package/dist/util/crypto.d.ts +7 -0
- package/dist/util/crypto.js +50 -0
- package/dist/util/randomId.d.ts +1 -0
- package/dist/util/randomId.js +8 -0
- package/dist/util/zip.d.ts +13 -0
- package/dist/util/zip.js +94 -0
- package/dist/webrtcState-D0nJpE9Z.js +406 -0
- package/package.json +88 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsxs as i, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as h, useState as m, useEffect as u, Suspense as v } from "react";
|
|
3
|
+
import { q as p, s as o, D as b } from "../../DialogQR-BU45QB3i.js";
|
|
4
|
+
function q({ url: a, size: r, code: c, label: l, dialog: d }) {
|
|
5
|
+
const t = h(null), [f, n] = m(!1);
|
|
6
|
+
return u(() => {
|
|
7
|
+
t.current && p.toCanvas(t.current, a, { width: r === "large" ? 350 : r === "normal" ? 250 : 164 }).catch(
|
|
8
|
+
(s) => console.error(s)
|
|
9
|
+
);
|
|
10
|
+
}, [a, r]), d ? /* @__PURE__ */ i("div", { className: o.container, children: [
|
|
11
|
+
/* @__PURE__ */ e(
|
|
12
|
+
"canvas",
|
|
13
|
+
{
|
|
14
|
+
"aria-label": "QR code, click to expand it",
|
|
15
|
+
role: "button",
|
|
16
|
+
width: 164,
|
|
17
|
+
height: 164,
|
|
18
|
+
ref: t,
|
|
19
|
+
onClick: () => n(!0),
|
|
20
|
+
tabIndex: 0,
|
|
21
|
+
className: o.canvas,
|
|
22
|
+
"data-testid": "qr-code-canvas",
|
|
23
|
+
onKeyDown: (s) => {
|
|
24
|
+
s.key === "Enter" && n(!0);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
),
|
|
28
|
+
/* @__PURE__ */ e(v, { children: /* @__PURE__ */ e(
|
|
29
|
+
b,
|
|
30
|
+
{
|
|
31
|
+
url: a,
|
|
32
|
+
open: f,
|
|
33
|
+
onClose: () => n(!1)
|
|
34
|
+
}
|
|
35
|
+
) })
|
|
36
|
+
] }) : /* @__PURE__ */ i(
|
|
37
|
+
"a",
|
|
38
|
+
{
|
|
39
|
+
href: a,
|
|
40
|
+
target: "_blank",
|
|
41
|
+
rel: "noreferrer",
|
|
42
|
+
className: o.link,
|
|
43
|
+
"aria-label": l,
|
|
44
|
+
children: [
|
|
45
|
+
/* @__PURE__ */ e(
|
|
46
|
+
"canvas",
|
|
47
|
+
{
|
|
48
|
+
"data-testid": "qr-code-canvas",
|
|
49
|
+
width: 164,
|
|
50
|
+
height: 164,
|
|
51
|
+
ref: t
|
|
52
|
+
}
|
|
53
|
+
),
|
|
54
|
+
c && /* @__PURE__ */ e("div", { children: c })
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
export {
|
|
60
|
+
q as default
|
|
61
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsxs as a, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import '../../assets/Spinner.css';const s = "_spinner_18gtf_3", t = "_largeSpinner_18gtf_10 _spinner_18gtf_3", r = "_animated_18gtf_19", _ = "_disabled_18gtf_35", n = {
|
|
3
|
+
spinner: s,
|
|
4
|
+
largeSpinner: t,
|
|
5
|
+
animated: r,
|
|
6
|
+
disabled: _
|
|
7
|
+
};
|
|
8
|
+
function p({ size: e, disabled: d }) {
|
|
9
|
+
return /* @__PURE__ */ a(
|
|
10
|
+
"div",
|
|
11
|
+
{
|
|
12
|
+
className: `${e === "large" ? n.largeSpinner : n.spinner} ${d ? n.disabled : n.animated}`,
|
|
13
|
+
"data-testid": "spinner",
|
|
14
|
+
children: [
|
|
15
|
+
/* @__PURE__ */ i("div", {}),
|
|
16
|
+
/* @__PURE__ */ i("div", {}),
|
|
17
|
+
/* @__PURE__ */ i("div", {}),
|
|
18
|
+
/* @__PURE__ */ i("div", {}),
|
|
19
|
+
/* @__PURE__ */ i("div", {}),
|
|
20
|
+
/* @__PURE__ */ i("div", {}),
|
|
21
|
+
/* @__PURE__ */ i("div", {}),
|
|
22
|
+
/* @__PURE__ */ i("div", {}),
|
|
23
|
+
/* @__PURE__ */ i("div", {}),
|
|
24
|
+
/* @__PURE__ */ i("div", {}),
|
|
25
|
+
/* @__PURE__ */ i("div", {}),
|
|
26
|
+
/* @__PURE__ */ i("div", {})
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
p as default
|
|
33
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
interval?: number;
|
|
3
|
+
capture?: boolean;
|
|
4
|
+
disable?: boolean;
|
|
5
|
+
onCapture?: (image: HTMLCanvasElement) => void | Promise<void>;
|
|
6
|
+
onPreprocess?: (image: HTMLCanvasElement) => void | Promise<void>;
|
|
7
|
+
onPostprocess?: (image: HTMLCanvasElement) => void | Promise<void>;
|
|
8
|
+
onActivated?: (available: boolean) => void;
|
|
9
|
+
onFatal?: () => void;
|
|
10
|
+
direct?: boolean;
|
|
11
|
+
hidden?: boolean;
|
|
12
|
+
size: number;
|
|
13
|
+
}
|
|
14
|
+
export default function Webcam({ interval, capture, onCapture, disable, direct, hidden, onPreprocess, onPostprocess, onActivated, onFatal, size, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
import { jsx as s, jsxs as F, Fragment as q } from "react/jsx-runtime";
|
|
2
|
+
import * as G from "react";
|
|
3
|
+
import { useState as M, useRef as O, useEffect as y, useCallback as E } from "react";
|
|
4
|
+
import { useTranslation as J } from "react-i18next";
|
|
5
|
+
import { IconButton as V } from "@mui/material";
|
|
6
|
+
import { c as Q } from "../../createSvgIcon-BfF8yuCp.js";
|
|
7
|
+
import { WebcamClass as Y } from "./webcamClass.js";
|
|
8
|
+
import { g as Z, u as z, s as P, c as W, a as ee, m as te } from "../../DefaultPropsProvider-C0Ib4Mye.js";
|
|
9
|
+
import { g as ae, b as ne, P as a } from "../../createTheme-BIcG8YPQ.js";
|
|
10
|
+
import { css as A, keyframes as H } from "@emotion/react";
|
|
11
|
+
import '../../assets/Webcam.css';function re(e) {
|
|
12
|
+
return String(e).match(/[\d.\-+]*\s*(.*)/)[1] || "";
|
|
13
|
+
}
|
|
14
|
+
function ie(e) {
|
|
15
|
+
return parseFloat(e);
|
|
16
|
+
}
|
|
17
|
+
const oe = "_container_u6uf5_1", se = "_wrapContainer_u6uf5_5", ce = "_flipButton_u6uf5_10", N = {
|
|
18
|
+
container: oe,
|
|
19
|
+
wrapContainer: se,
|
|
20
|
+
flipButton: ce
|
|
21
|
+
};
|
|
22
|
+
function le(e) {
|
|
23
|
+
return ae("MuiSkeleton", e);
|
|
24
|
+
}
|
|
25
|
+
Z("MuiSkeleton", ["root", "text", "rectangular", "rounded", "circular", "pulse", "wave", "withChildren", "fitContent", "heightAuto"]);
|
|
26
|
+
const ue = (e) => {
|
|
27
|
+
const {
|
|
28
|
+
classes: i,
|
|
29
|
+
variant: r,
|
|
30
|
+
animation: o,
|
|
31
|
+
hasChildren: u,
|
|
32
|
+
width: v,
|
|
33
|
+
height: f
|
|
34
|
+
} = e;
|
|
35
|
+
return ee({
|
|
36
|
+
root: ["root", r, o, u && "withChildren", u && !v && "fitContent", u && !f && "heightAuto"]
|
|
37
|
+
}, le, i);
|
|
38
|
+
}, $ = H`
|
|
39
|
+
0% {
|
|
40
|
+
opacity: 1;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
50% {
|
|
44
|
+
opacity: 0.4;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
100% {
|
|
48
|
+
opacity: 1;
|
|
49
|
+
}
|
|
50
|
+
`, j = H`
|
|
51
|
+
0% {
|
|
52
|
+
transform: translateX(-100%);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
50% {
|
|
56
|
+
/* +0.5s of delay between each loop */
|
|
57
|
+
transform: translateX(100%);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
100% {
|
|
61
|
+
transform: translateX(100%);
|
|
62
|
+
}
|
|
63
|
+
`, fe = typeof $ != "string" ? A`
|
|
64
|
+
animation: ${$} 2s ease-in-out 0.5s infinite;
|
|
65
|
+
` : null, pe = typeof j != "string" ? A`
|
|
66
|
+
&::after {
|
|
67
|
+
animation: ${j} 2s linear 0.5s infinite;
|
|
68
|
+
}
|
|
69
|
+
` : null, de = P("span", {
|
|
70
|
+
name: "MuiSkeleton",
|
|
71
|
+
slot: "Root",
|
|
72
|
+
overridesResolver: (e, i) => {
|
|
73
|
+
const {
|
|
74
|
+
ownerState: r
|
|
75
|
+
} = e;
|
|
76
|
+
return [i.root, i[r.variant], r.animation !== !1 && i[r.animation], r.hasChildren && i.withChildren, r.hasChildren && !r.width && i.fitContent, r.hasChildren && !r.height && i.heightAuto];
|
|
77
|
+
}
|
|
78
|
+
})(te(({
|
|
79
|
+
theme: e
|
|
80
|
+
}) => {
|
|
81
|
+
const i = re(e.shape.borderRadius) || "px", r = ie(e.shape.borderRadius);
|
|
82
|
+
return {
|
|
83
|
+
display: "block",
|
|
84
|
+
// Create a "on paper" color with sufficient contrast retaining the color
|
|
85
|
+
backgroundColor: e.vars ? e.vars.palette.Skeleton.bg : ne(e.palette.text.primary, e.palette.mode === "light" ? 0.11 : 0.13),
|
|
86
|
+
height: "1.2em",
|
|
87
|
+
variants: [{
|
|
88
|
+
props: {
|
|
89
|
+
variant: "text"
|
|
90
|
+
},
|
|
91
|
+
style: {
|
|
92
|
+
marginTop: 0,
|
|
93
|
+
marginBottom: 0,
|
|
94
|
+
height: "auto",
|
|
95
|
+
transformOrigin: "0 55%",
|
|
96
|
+
transform: "scale(1, 0.60)",
|
|
97
|
+
borderRadius: `${r}${i}/${Math.round(r / 0.6 * 10) / 10}${i}`,
|
|
98
|
+
"&:empty:before": {
|
|
99
|
+
content: '"\\00a0"'
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}, {
|
|
103
|
+
props: {
|
|
104
|
+
variant: "circular"
|
|
105
|
+
},
|
|
106
|
+
style: {
|
|
107
|
+
borderRadius: "50%"
|
|
108
|
+
}
|
|
109
|
+
}, {
|
|
110
|
+
props: {
|
|
111
|
+
variant: "rounded"
|
|
112
|
+
},
|
|
113
|
+
style: {
|
|
114
|
+
borderRadius: (e.vars || e).shape.borderRadius
|
|
115
|
+
}
|
|
116
|
+
}, {
|
|
117
|
+
props: ({
|
|
118
|
+
ownerState: o
|
|
119
|
+
}) => o.hasChildren,
|
|
120
|
+
style: {
|
|
121
|
+
"& > *": {
|
|
122
|
+
visibility: "hidden"
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}, {
|
|
126
|
+
props: ({
|
|
127
|
+
ownerState: o
|
|
128
|
+
}) => o.hasChildren && !o.width,
|
|
129
|
+
style: {
|
|
130
|
+
maxWidth: "fit-content"
|
|
131
|
+
}
|
|
132
|
+
}, {
|
|
133
|
+
props: ({
|
|
134
|
+
ownerState: o
|
|
135
|
+
}) => o.hasChildren && !o.height,
|
|
136
|
+
style: {
|
|
137
|
+
height: "auto"
|
|
138
|
+
}
|
|
139
|
+
}, {
|
|
140
|
+
props: {
|
|
141
|
+
animation: "pulse"
|
|
142
|
+
},
|
|
143
|
+
style: fe || {
|
|
144
|
+
animation: `${$} 2s ease-in-out 0.5s infinite`
|
|
145
|
+
}
|
|
146
|
+
}, {
|
|
147
|
+
props: {
|
|
148
|
+
animation: "wave"
|
|
149
|
+
},
|
|
150
|
+
style: {
|
|
151
|
+
position: "relative",
|
|
152
|
+
overflow: "hidden",
|
|
153
|
+
/* Fix bug in Safari https://bugs.webkit.org/show_bug.cgi?id=68196 */
|
|
154
|
+
WebkitMaskImage: "-webkit-radial-gradient(white, black)",
|
|
155
|
+
"&::after": {
|
|
156
|
+
background: `linear-gradient(
|
|
157
|
+
90deg,
|
|
158
|
+
transparent,
|
|
159
|
+
${(e.vars || e).palette.action.hover},
|
|
160
|
+
transparent
|
|
161
|
+
)`,
|
|
162
|
+
content: '""',
|
|
163
|
+
position: "absolute",
|
|
164
|
+
transform: "translateX(-100%)",
|
|
165
|
+
bottom: 0,
|
|
166
|
+
left: 0,
|
|
167
|
+
right: 0,
|
|
168
|
+
top: 0
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}, {
|
|
172
|
+
props: {
|
|
173
|
+
animation: "wave"
|
|
174
|
+
},
|
|
175
|
+
style: pe || {
|
|
176
|
+
"&::after": {
|
|
177
|
+
animation: `${j} 2s linear 0.5s infinite`
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}]
|
|
181
|
+
};
|
|
182
|
+
})), K = /* @__PURE__ */ G.forwardRef(function(i, r) {
|
|
183
|
+
const o = z({
|
|
184
|
+
props: i,
|
|
185
|
+
name: "MuiSkeleton"
|
|
186
|
+
}), {
|
|
187
|
+
animation: u = "pulse",
|
|
188
|
+
className: v,
|
|
189
|
+
component: f = "span",
|
|
190
|
+
height: m,
|
|
191
|
+
style: p,
|
|
192
|
+
variant: w = "text",
|
|
193
|
+
width: l,
|
|
194
|
+
...h
|
|
195
|
+
} = o, t = {
|
|
196
|
+
...o,
|
|
197
|
+
animation: u,
|
|
198
|
+
component: f,
|
|
199
|
+
variant: w,
|
|
200
|
+
hasChildren: !!h.children
|
|
201
|
+
}, T = ue(t);
|
|
202
|
+
return /* @__PURE__ */ s(de, {
|
|
203
|
+
as: f,
|
|
204
|
+
ref: r,
|
|
205
|
+
className: W(T.root, v),
|
|
206
|
+
ownerState: t,
|
|
207
|
+
...h,
|
|
208
|
+
style: {
|
|
209
|
+
width: l,
|
|
210
|
+
height: m,
|
|
211
|
+
...p
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
process.env.NODE_ENV !== "production" && (K.propTypes = {
|
|
216
|
+
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
217
|
+
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
218
|
+
// │ To update them, edit the d.ts file and run `pnpm proptypes`. │
|
|
219
|
+
// └─────────────────────────────────────────────────────────────────────┘
|
|
220
|
+
/**
|
|
221
|
+
* The animation.
|
|
222
|
+
* If `false` the animation effect is disabled.
|
|
223
|
+
* @default 'pulse'
|
|
224
|
+
*/
|
|
225
|
+
animation: a.oneOf(["pulse", "wave", !1]),
|
|
226
|
+
/**
|
|
227
|
+
* Optional children to infer width and height from.
|
|
228
|
+
*/
|
|
229
|
+
children: a.node,
|
|
230
|
+
/**
|
|
231
|
+
* Override or extend the styles applied to the component.
|
|
232
|
+
*/
|
|
233
|
+
classes: a.object,
|
|
234
|
+
/**
|
|
235
|
+
* @ignore
|
|
236
|
+
*/
|
|
237
|
+
className: a.string,
|
|
238
|
+
/**
|
|
239
|
+
* The component used for the root node.
|
|
240
|
+
* Either a string to use a HTML element or a component.
|
|
241
|
+
*/
|
|
242
|
+
component: a.elementType,
|
|
243
|
+
/**
|
|
244
|
+
* Height of the skeleton.
|
|
245
|
+
* Useful when you don't want to adapt the skeleton to a text element but for instance a card.
|
|
246
|
+
*/
|
|
247
|
+
height: a.oneOfType([a.number, a.string]),
|
|
248
|
+
/**
|
|
249
|
+
* @ignore
|
|
250
|
+
*/
|
|
251
|
+
style: a.object,
|
|
252
|
+
/**
|
|
253
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
254
|
+
*/
|
|
255
|
+
sx: a.oneOfType([a.arrayOf(a.oneOfType([a.func, a.object, a.bool])), a.func, a.object]),
|
|
256
|
+
/**
|
|
257
|
+
* The type of content that will be rendered.
|
|
258
|
+
* @default 'text'
|
|
259
|
+
*/
|
|
260
|
+
variant: a.oneOfType([a.oneOf(["circular", "rectangular", "rounded", "text"]), a.string]),
|
|
261
|
+
/**
|
|
262
|
+
* Width of the skeleton.
|
|
263
|
+
* Useful when the skeleton is inside an inline element with no width of its own.
|
|
264
|
+
*/
|
|
265
|
+
width: a.oneOfType([a.number, a.string])
|
|
266
|
+
});
|
|
267
|
+
const X = Q([/* @__PURE__ */ s("path", {
|
|
268
|
+
d: "M16 7h-1l-1-1h-4L9 7H8c-1.1 0-2 .9-2 2v6c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V9c0-1.1-.9-2-2-2m-4 7c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2"
|
|
269
|
+
}, "0"), /* @__PURE__ */ s("path", {
|
|
270
|
+
d: "m8.57.51 4.48 4.48V2.04c4.72.47 8.48 4.23 8.95 8.95h2C23.34 3.02 15.49-1.59 8.57.51m2.38 21.45c-4.72-.47-8.48-4.23-8.95-8.95H0c.66 7.97 8.51 12.58 15.43 10.48l-4.48-4.48z"
|
|
271
|
+
}, "1")], "Cameraswitch");
|
|
272
|
+
function Re({
|
|
273
|
+
interval: e,
|
|
274
|
+
capture: i,
|
|
275
|
+
onCapture: r,
|
|
276
|
+
disable: o,
|
|
277
|
+
direct: u,
|
|
278
|
+
hidden: v,
|
|
279
|
+
onPreprocess: f,
|
|
280
|
+
onPostprocess: m,
|
|
281
|
+
onActivated: p,
|
|
282
|
+
onFatal: w,
|
|
283
|
+
size: l
|
|
284
|
+
}) {
|
|
285
|
+
const { t: h } = J(), [t, T] = M(null), b = O(null), C = O(-1), _ = O(0), d = O(), [k, L] = M(!1), [R, D] = M(!1);
|
|
286
|
+
y(() => {
|
|
287
|
+
d.current = async (n) => {
|
|
288
|
+
var c;
|
|
289
|
+
if (o) {
|
|
290
|
+
d.current && (C.current = window.requestAnimationFrame(d.current));
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
if (t && t.canvas) {
|
|
294
|
+
t.update();
|
|
295
|
+
const x = e !== void 0 ? e : 1e3;
|
|
296
|
+
if (f && await f(t.canvas), i && r && n - _.current >= x) {
|
|
297
|
+
if (u && t.canvas)
|
|
298
|
+
await r(t.canvas);
|
|
299
|
+
else {
|
|
300
|
+
const g = document.createElement("canvas");
|
|
301
|
+
g.width = t.canvas.width, g.height = t.canvas.height;
|
|
302
|
+
const S = g.getContext("2d");
|
|
303
|
+
S || console.error("Failed to get context"), S == null || S.drawImage(t.canvas, 0, 0), await r(g);
|
|
304
|
+
}
|
|
305
|
+
_.current = n;
|
|
306
|
+
}
|
|
307
|
+
const I = (c = b.current) == null ? void 0 : c.getContext("2d");
|
|
308
|
+
I && (I.drawImage(t.canvas, 0, 0), m && b.current && await m(b.current));
|
|
309
|
+
}
|
|
310
|
+
d.current && (C.current = window.requestAnimationFrame(d.current));
|
|
311
|
+
}, C.current === -1 && (C.current = window.requestAnimationFrame(d.current));
|
|
312
|
+
}, [t, e, i, r, u, o, m, f]);
|
|
313
|
+
const B = E(
|
|
314
|
+
async (n) => {
|
|
315
|
+
var c;
|
|
316
|
+
if (await n.setup({ facingMode: R ? "user" : "environment" }), n.webcam && (n.webcam.playsInline = !0, n.webcam.muted = !0, n.webcam.onsuspend = () => n.play(), T(n)), (c = navigator.mediaDevices) != null && c.enumerateDevices)
|
|
317
|
+
try {
|
|
318
|
+
(await navigator.mediaDevices.enumerateDevices()).filter((g) => g.kind === "videoinput").length > 1 && (k || L(!0), n.flip = R);
|
|
319
|
+
} catch (x) {
|
|
320
|
+
console.error(x);
|
|
321
|
+
}
|
|
322
|
+
return p && p(!0), n;
|
|
323
|
+
},
|
|
324
|
+
[p, R, k]
|
|
325
|
+
);
|
|
326
|
+
y(() => {
|
|
327
|
+
i && (_.current = 0);
|
|
328
|
+
}, [i]), y(() => {
|
|
329
|
+
const n = new Y(l, l, !0);
|
|
330
|
+
return B(n).catch((c) => {
|
|
331
|
+
p && p(!1), console.error("No webcam", c), w && w();
|
|
332
|
+
}), () => {
|
|
333
|
+
var c;
|
|
334
|
+
(c = n.webcam) != null && c.srcObject && n.stop();
|
|
335
|
+
};
|
|
336
|
+
}, [R, p, B, w, l]), y(() => () => {
|
|
337
|
+
var n;
|
|
338
|
+
d.current = void 0, (n = t == null ? void 0 : t.webcam) != null && n.srcObject && t.stop();
|
|
339
|
+
}, [t]), y(() => {
|
|
340
|
+
t && (o ? t.pause() : t.play());
|
|
341
|
+
}, [t, o]);
|
|
342
|
+
const U = E(() => {
|
|
343
|
+
D((n) => !n);
|
|
344
|
+
}, [D]);
|
|
345
|
+
return v ? /* @__PURE__ */ s(q, { children: k && /* @__PURE__ */ s(
|
|
346
|
+
V,
|
|
347
|
+
{
|
|
348
|
+
size: "large",
|
|
349
|
+
color: "inherit",
|
|
350
|
+
onClick: U,
|
|
351
|
+
"aria-label": h("webcam.aria.flip"),
|
|
352
|
+
children: /* @__PURE__ */ s(X, { fontSize: "large" })
|
|
353
|
+
}
|
|
354
|
+
) }) : /* @__PURE__ */ F(q, { children: [
|
|
355
|
+
!t && /* @__PURE__ */ s(
|
|
356
|
+
K,
|
|
357
|
+
{
|
|
358
|
+
variant: "rounded",
|
|
359
|
+
width: l,
|
|
360
|
+
height: l
|
|
361
|
+
}
|
|
362
|
+
),
|
|
363
|
+
t && /* @__PURE__ */ F("div", { className: N.wrapContainer, children: [
|
|
364
|
+
k && /* @__PURE__ */ s(
|
|
365
|
+
V,
|
|
366
|
+
{
|
|
367
|
+
className: N.flipButton,
|
|
368
|
+
size: "large",
|
|
369
|
+
color: "inherit",
|
|
370
|
+
onClick: U,
|
|
371
|
+
"aria-label": h("webcam.aria.flip"),
|
|
372
|
+
children: /* @__PURE__ */ s(X, { fontSize: "large" })
|
|
373
|
+
}
|
|
374
|
+
),
|
|
375
|
+
/* @__PURE__ */ s(
|
|
376
|
+
"div",
|
|
377
|
+
{
|
|
378
|
+
"data-testid": "webcam",
|
|
379
|
+
className: N.container,
|
|
380
|
+
role: "img",
|
|
381
|
+
"aria-label": h("webcam.aria.video"),
|
|
382
|
+
children: /* @__PURE__ */ s(
|
|
383
|
+
"canvas",
|
|
384
|
+
{
|
|
385
|
+
width: l,
|
|
386
|
+
height: l,
|
|
387
|
+
ref: b
|
|
388
|
+
}
|
|
389
|
+
)
|
|
390
|
+
}
|
|
391
|
+
)
|
|
392
|
+
] })
|
|
393
|
+
] });
|
|
394
|
+
}
|
|
395
|
+
export {
|
|
396
|
+
Re as default
|
|
397
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
* =============================================================================
|
|
16
|
+
*/
|
|
17
|
+
export declare class WebcamClass {
|
|
18
|
+
flip: boolean;
|
|
19
|
+
width: number;
|
|
20
|
+
height: number;
|
|
21
|
+
webcam?: HTMLVideoElement;
|
|
22
|
+
canvas?: HTMLCanvasElement;
|
|
23
|
+
constructor(width?: number, height?: number, flip?: boolean);
|
|
24
|
+
getWebcam(options?: MediaTrackConstraints): Promise<HTMLVideoElement>;
|
|
25
|
+
setup(options?: MediaTrackConstraints): Promise<void>;
|
|
26
|
+
play(): Promise<void> | undefined;
|
|
27
|
+
pause(): void;
|
|
28
|
+
stop(): void;
|
|
29
|
+
update(): void;
|
|
30
|
+
stopStreamedVideo(videoEl: HTMLVideoElement): void;
|
|
31
|
+
renderCameraToCanvas(): void;
|
|
32
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
var h = Object.defineProperty;
|
|
2
|
+
var d = (t, e, a) => e in t ? h(t, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[e] = a;
|
|
3
|
+
var s = (t, e, a) => d(t, typeof e != "symbol" ? e + "" : e, a);
|
|
4
|
+
import { cropTo as m } from "../../util/canvas.js";
|
|
5
|
+
/**
|
|
6
|
+
* @license
|
|
7
|
+
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
* you may not use this file except in compliance with the License.
|
|
10
|
+
* You may obtain a copy of the License at
|
|
11
|
+
*
|
|
12
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
*
|
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
* See the License for the specific language governing permissions and
|
|
18
|
+
* limitations under the License.
|
|
19
|
+
* =============================================================================
|
|
20
|
+
*/
|
|
21
|
+
const r = {
|
|
22
|
+
facingMode: "user",
|
|
23
|
+
frameRate: 24
|
|
24
|
+
}, v = (t) => (t.facingMode = t.facingMode || r.facingMode, t.frameRate = t.frameRate || r.frameRate, t.aspectRatio = t.aspectRatio || r.aspectRatio, t);
|
|
25
|
+
class u {
|
|
26
|
+
constructor(e = 400, a = 400, i = !1) {
|
|
27
|
+
s(this, "flip");
|
|
28
|
+
s(this, "width");
|
|
29
|
+
s(this, "height");
|
|
30
|
+
s(this, "webcam");
|
|
31
|
+
s(this, "canvas");
|
|
32
|
+
this.width = e, this.height = a, this.flip = i;
|
|
33
|
+
}
|
|
34
|
+
getWebcam(e = {}) {
|
|
35
|
+
if (!window.navigator.mediaDevices || !window.navigator.mediaDevices.getUserMedia)
|
|
36
|
+
return Promise.reject("Your browser does not support WebRTC. Please try another one.");
|
|
37
|
+
e.width = 640;
|
|
38
|
+
const a = v(e), i = document.createElement("video");
|
|
39
|
+
return window.navigator.mediaDevices.getUserMedia({ video: a }).then(
|
|
40
|
+
(c) => (i.srcObject = c, i.addEventListener("loadedmetadata", () => {
|
|
41
|
+
const { videoWidth: o, videoHeight: n } = i;
|
|
42
|
+
i.width = o, i.height = n;
|
|
43
|
+
}), i),
|
|
44
|
+
() => Promise.reject("Could not open your camera. You may have denied access.")
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
// setup or setupWebcam
|
|
48
|
+
async setup(e = {}) {
|
|
49
|
+
this.webcam || (this.webcam = await this.getWebcam(e), this.canvas || (this.canvas = document.createElement("canvas"), this.canvas.width = this.width, this.canvas.height = this.height));
|
|
50
|
+
}
|
|
51
|
+
play() {
|
|
52
|
+
var a;
|
|
53
|
+
return (a = this.webcam) == null ? void 0 : a.play();
|
|
54
|
+
}
|
|
55
|
+
pause() {
|
|
56
|
+
var e;
|
|
57
|
+
(e = this.webcam) == null || e.pause();
|
|
58
|
+
}
|
|
59
|
+
stop() {
|
|
60
|
+
this.webcam && this.stopStreamedVideo(this.webcam);
|
|
61
|
+
}
|
|
62
|
+
update() {
|
|
63
|
+
this.renderCameraToCanvas();
|
|
64
|
+
}
|
|
65
|
+
stopStreamedVideo(e) {
|
|
66
|
+
e.srcObject.getTracks().forEach((c) => {
|
|
67
|
+
c.stop();
|
|
68
|
+
}), e.srcObject = null;
|
|
69
|
+
}
|
|
70
|
+
renderCameraToCanvas() {
|
|
71
|
+
this.canvas && this.webcam && this.canvas.getContext("2d") && this.webcam.videoWidth !== 0 && m(this.webcam, this.width, this.flip, this.canvas);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
export {
|
|
75
|
+
u as WebcamClass
|
|
76
|
+
};
|