ablok-components 0.3.73 → 0.3.75
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,32 +1,32 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { debounce as
|
|
3
|
-
import
|
|
1
|
+
import { defineComponent as Pe, ref as r, computed as v, watch as ye, onMounted as We, nextTick as je, onBeforeUnmount as Ae, openBlock as g, createElementBlock as w, normalizeClass as ae, createElementVNode as h, createVNode as ie, withCtx as Fe, createCommentVNode as O, withDirectives as be, normalizeStyle as oe, vShow as _e, toDisplayString as ne, createBlock as Ne, withModifiers as qe } from "vue";
|
|
2
|
+
import { debounce as Ze } from "lodash";
|
|
3
|
+
import Ke from "../../atoms/loading-spinner/loading-spinner.vue.js";
|
|
4
4
|
/* empty css */
|
|
5
|
-
import
|
|
5
|
+
import Je from "../../atoms/svg-icon/svg-icon.vue.js";
|
|
6
6
|
/* empty css */
|
|
7
|
-
import
|
|
7
|
+
import Qe from "../input-dropdown/input-dropdown.vue.js";
|
|
8
8
|
/* empty css */
|
|
9
|
-
import { dataURItoBlob as
|
|
10
|
-
import { useCameraFilter as
|
|
11
|
-
import
|
|
9
|
+
import { dataURItoBlob as Xe } from "../../../utilities/helpers.js";
|
|
10
|
+
import { useCameraFilter as Ye } from "../../../composables/useCameraFilter.js";
|
|
11
|
+
import et from "../../atoms/zoom-slider/zoom-slider.vue.js";
|
|
12
12
|
/* empty css */
|
|
13
|
-
import
|
|
14
|
-
const
|
|
13
|
+
import tt from "../../../assets/img/guide.png.js";
|
|
14
|
+
const at = { class: "camera__preview" }, it = {
|
|
15
15
|
key: 0,
|
|
16
16
|
class: "camera__bg-notification"
|
|
17
|
-
},
|
|
17
|
+
}, ot = ["innerHTML"], nt = ["width", "height"], lt = {
|
|
18
18
|
key: 1,
|
|
19
19
|
class: "camera__countdown-overlay"
|
|
20
|
-
},
|
|
20
|
+
}, rt = ["innerHTML", "data-countdown"], st = ["src"], ct = {
|
|
21
21
|
key: 3,
|
|
22
22
|
class: "camera__zoom-slider"
|
|
23
|
-
},
|
|
23
|
+
}, ut = { class: "camera__controls" }, dt = { class: "container" }, vt = { class: "row" }, ht = { class: "col" }, mt = { class: "btn-group" }, ft = { key: 0 }, gt = { key: 1 }, wt = {
|
|
24
24
|
key: 0,
|
|
25
25
|
class: "camera__select-device"
|
|
26
|
-
},
|
|
26
|
+
}, pt = { class: "col" }, yt = { class: "" }, bt = {
|
|
27
27
|
name: "BaseCamera",
|
|
28
28
|
inheritAttrs: !1
|
|
29
|
-
},
|
|
29
|
+
}, Ce = {
|
|
30
30
|
"1x1": { width: 720, height: 720 },
|
|
31
31
|
"2x3": { width: 720, height: 1080 },
|
|
32
32
|
"3x2": { width: 1080, height: 720 },
|
|
@@ -36,8 +36,8 @@ const Le = { class: "camera__preview" }, Ue = {
|
|
|
36
36
|
"5x4": { width: 1200, height: 960 },
|
|
37
37
|
"16x9": { width: 1280, height: 720 },
|
|
38
38
|
"9x16": { width: 720, height: 1280 }
|
|
39
|
-
},
|
|
40
|
-
...
|
|
39
|
+
}, $t = /* @__PURE__ */ Pe({
|
|
40
|
+
...bt,
|
|
41
41
|
props: {
|
|
42
42
|
modelValue: {
|
|
43
43
|
type: null
|
|
@@ -60,7 +60,7 @@ const Le = { class: "camera__preview" }, Ue = {
|
|
|
60
60
|
},
|
|
61
61
|
guideSrc: {
|
|
62
62
|
type: String,
|
|
63
|
-
default: () =>
|
|
63
|
+
default: () => tt
|
|
64
64
|
},
|
|
65
65
|
countdown: {
|
|
66
66
|
type: Number,
|
|
@@ -73,7 +73,7 @@ const Le = { class: "camera__preview" }, Ue = {
|
|
|
73
73
|
filter: {
|
|
74
74
|
type: String,
|
|
75
75
|
default: "none",
|
|
76
|
-
validator: (
|
|
76
|
+
validator: (c) => ["none", "grayscale", "sepia"].includes(c)
|
|
77
77
|
},
|
|
78
78
|
tintColor: {
|
|
79
79
|
type: String,
|
|
@@ -97,7 +97,7 @@ const Le = { class: "camera__preview" }, Ue = {
|
|
|
97
97
|
},
|
|
98
98
|
resolutions: {
|
|
99
99
|
type: Object,
|
|
100
|
-
default: () =>
|
|
100
|
+
default: () => Ce
|
|
101
101
|
},
|
|
102
102
|
zoom: {
|
|
103
103
|
type: Number,
|
|
@@ -106,287 +106,368 @@ const Le = { class: "camera__preview" }, Ue = {
|
|
|
106
106
|
enableZoomSlider: {
|
|
107
107
|
type: Boolean,
|
|
108
108
|
default: !1
|
|
109
|
+
},
|
|
110
|
+
correctOrientation: {
|
|
111
|
+
type: Boolean,
|
|
112
|
+
default: !1
|
|
109
113
|
}
|
|
110
114
|
},
|
|
111
115
|
emits: ["update:modelValue"],
|
|
112
|
-
setup(
|
|
113
|
-
const i =
|
|
114
|
-
|
|
116
|
+
setup(c, { expose: ke, emit: Se }) {
|
|
117
|
+
const i = c, De = Se, s = r(), a = r(), le = r(!1), V = r([]), m = r(), x = r(), R = r(!1), W = r(!1), j = r(0), A = r(0), C = r(), l = r(i.zoom || 1), re = r(!1), z = r(!1), Z = r(null), K = r(!1);
|
|
118
|
+
let L, k;
|
|
119
|
+
const Ie = typeof window < "u" && "DeviceMotionEvent" in window && (window.matchMedia?.("(pointer: coarse)")?.matches || "ontouchstart" in window), se = v(() => i.correctOrientation && Ie), J = v(() => le.value && (!se.value || K.value));
|
|
120
|
+
function Q() {
|
|
121
|
+
k && (window.removeEventListener("pointerdown", k, !0), window.removeEventListener("touchend", k, !0), k = void 0);
|
|
122
|
+
}
|
|
123
|
+
function F() {
|
|
124
|
+
K.value = !0, L && (clearTimeout(L), L = void 0), Q();
|
|
125
|
+
}
|
|
126
|
+
function Ee() {
|
|
127
|
+
k || (k = () => {
|
|
128
|
+
X();
|
|
129
|
+
}, window.addEventListener("pointerdown", k, !0), window.addEventListener("touchend", k, !0));
|
|
130
|
+
}
|
|
131
|
+
function ce(e) {
|
|
132
|
+
const t = e.accelerationIncludingGravity;
|
|
133
|
+
if (!t || t.x == null || t.y == null) return;
|
|
134
|
+
const o = Math.round(Math.atan2(t.x, t.y) * 180 / Math.PI);
|
|
135
|
+
if (Z.value = o, !(typeof screen < "u" && screen.orientation && screen.orientation.type || "portrait-primary").startsWith("portrait"))
|
|
136
|
+
z.value = !1;
|
|
137
|
+
else {
|
|
138
|
+
const E = Math.abs(Math.abs(o) - 90);
|
|
139
|
+
!z.value && E < 40 ? z.value = !0 : z.value && E > 50 && (z.value = !1);
|
|
140
|
+
}
|
|
141
|
+
K.value || F();
|
|
142
|
+
}
|
|
143
|
+
async function X() {
|
|
144
|
+
if (!(!i.correctOrientation || re.value))
|
|
145
|
+
try {
|
|
146
|
+
const e = window.DeviceOrientationEvent, t = window.DeviceMotionEvent;
|
|
147
|
+
if (e && typeof e.requestPermission == "function" && await e.requestPermission() !== "granted") {
|
|
148
|
+
F();
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
t && typeof t.requestPermission == "function" && await t.requestPermission().catch(() => {
|
|
152
|
+
}), window.addEventListener("devicemotion", ce, !0), re.value = !0, Q();
|
|
153
|
+
} catch (e) {
|
|
154
|
+
console.error(e, "enableMotion: failed"), F();
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
const H = v(() => ({ ...Ce, ...i.resolutions })), Me = v(() => Object.values(H.value)[0]);
|
|
158
|
+
function Oe(e) {
|
|
115
159
|
return String(e || "").trim().toLowerCase().replace(/\s+/g, "").replace(/[:/]/g, "x");
|
|
116
160
|
}
|
|
117
|
-
const
|
|
118
|
-
if (
|
|
161
|
+
const S = v(() => {
|
|
162
|
+
if (H.value[i.ratio])
|
|
119
163
|
return i.ratio;
|
|
120
|
-
const e =
|
|
121
|
-
if (
|
|
164
|
+
const e = Oe(i.ratio);
|
|
165
|
+
if (H.value[e])
|
|
122
166
|
return e;
|
|
123
|
-
}),
|
|
124
|
-
const e =
|
|
167
|
+
}), T = v(() => S.value ? H.value[S.value] : Me.value), xe = v(() => {
|
|
168
|
+
const e = S.value ? H.value[S.value] : void 0;
|
|
125
169
|
return e ? `${e.width} / ${e.height}` : void 0;
|
|
126
|
-
}),
|
|
170
|
+
}), f = v(() => V.value.filter((e) => e.kind === "videoinput")), ue = v(() => V.value.filter((e) => e.kind === "audioinput")), Re = v(() => f.value.map((e, t) => ({
|
|
127
171
|
text: e.label.slice(0, e.label.indexOf("(")) || `Camera ${t + 1}`,
|
|
128
172
|
value: e.deviceId
|
|
129
|
-
}))),
|
|
173
|
+
}))), de = v({
|
|
130
174
|
get() {
|
|
131
|
-
return
|
|
175
|
+
return m.value && m.value.deviceId;
|
|
132
176
|
},
|
|
133
177
|
set(e) {
|
|
134
|
-
|
|
178
|
+
m.value = f.value.find((t) => t.deviceId === e);
|
|
135
179
|
}
|
|
136
180
|
});
|
|
137
|
-
|
|
181
|
+
v({
|
|
138
182
|
get() {
|
|
139
|
-
return
|
|
183
|
+
return x.value && x.value.deviceId;
|
|
140
184
|
},
|
|
141
185
|
set(e) {
|
|
142
|
-
|
|
186
|
+
x.value = ue.value.find((t) => t.deviceId === e);
|
|
143
187
|
}
|
|
144
188
|
});
|
|
145
|
-
const
|
|
146
|
-
const e =
|
|
189
|
+
const $ = v(() => {
|
|
190
|
+
const e = m.value && f.value.findIndex((t) => t.deviceId === m.value.deviceId);
|
|
147
191
|
return i.enableMirrorCamera && e === 0 ? "mirror-cam" : "";
|
|
148
|
-
}),
|
|
149
|
-
const e =
|
|
150
|
-
return
|
|
151
|
-
}), { tintRgb:
|
|
152
|
-
function
|
|
153
|
-
if (
|
|
154
|
-
|
|
192
|
+
}), Te = v(() => {
|
|
193
|
+
const e = m.value && V.value.findIndex((t) => t.deviceId === m.value.deviceId);
|
|
194
|
+
return $.value ? `${$.value} mirror-device-${e}` : "";
|
|
195
|
+
}), { tintRgb: _t, applyFilterToCanvas: ve } = Ye(i);
|
|
196
|
+
function he() {
|
|
197
|
+
if (S.value && T.value) {
|
|
198
|
+
j.value = T.value.width, A.value = T.value.height;
|
|
155
199
|
return;
|
|
156
200
|
}
|
|
157
|
-
|
|
201
|
+
j.value = s.value.parentElement && s.value.parentElement.clientWidth, A.value = s.value.parentElement && s.value.parentElement.clientHeight;
|
|
158
202
|
}
|
|
159
|
-
const
|
|
160
|
-
|
|
203
|
+
const me = Ze(() => {
|
|
204
|
+
he();
|
|
161
205
|
}, 300, { trailing: !0, leading: !1 });
|
|
162
|
-
async function
|
|
163
|
-
const e =
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
168
|
-
// audio: false,
|
|
169
|
-
video: {
|
|
170
|
-
...s.value ? { deviceId: s.value.deviceId } : {},
|
|
171
|
-
width: { ideal: e?.width },
|
|
172
|
-
...g.value && e?.height ? { height: { ideal: e.height } } : {},
|
|
173
|
-
...g.value && t ? {
|
|
174
|
-
aspectRatio: { ideal: t }
|
|
175
|
-
} : {}
|
|
176
|
-
}
|
|
206
|
+
async function ze() {
|
|
207
|
+
const e = T.value ? { width: T.value.width, height: T.value.height } : void 0, t = e ? Math.max(e.width, e.height) : void 0, o = e ? Math.min(e.width, e.height) : void 0, D = i.enableAudio && {
|
|
208
|
+
...x.value ? { deviceId: x.value.deviceId } : {}
|
|
209
|
+
// deviceId: activeAudioDevice.value ? { exact: activeAudioDevice.value } : undefined
|
|
210
|
+
}, I = {
|
|
211
|
+
...m.value ? { deviceId: { exact: m.value.deviceId } } : {}
|
|
177
212
|
};
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
213
|
+
try {
|
|
214
|
+
return await navigator.mediaDevices.getUserMedia({
|
|
215
|
+
audio: D,
|
|
216
|
+
video: {
|
|
217
|
+
...I,
|
|
218
|
+
...t ? { width: { ideal: t } } : {},
|
|
219
|
+
...o ? { height: { ideal: o } } : {}
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
} catch {
|
|
223
|
+
try {
|
|
224
|
+
return await navigator.mediaDevices.getUserMedia({ audio: D, video: I });
|
|
225
|
+
} catch (n) {
|
|
226
|
+
console.error(n, "navigator.mediaDevices.getUserMedia: failed");
|
|
227
|
+
}
|
|
228
|
+
}
|
|
181
229
|
}
|
|
182
|
-
function
|
|
183
|
-
|
|
230
|
+
function Y() {
|
|
231
|
+
s.value && s.value.srcObject && (s.value.srcObject.getTracks().forEach((t) => {
|
|
184
232
|
t.stop();
|
|
185
|
-
});
|
|
233
|
+
}), s.value.srcObject = null);
|
|
186
234
|
}
|
|
187
|
-
|
|
188
|
-
|
|
235
|
+
let fe = 0;
|
|
236
|
+
async function N() {
|
|
237
|
+
const e = ++fe;
|
|
238
|
+
Y();
|
|
239
|
+
const t = await ze();
|
|
240
|
+
if (e !== fe) {
|
|
241
|
+
t?.getTracks?.().forEach((o) => o.stop());
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
return t && s.value && (s.value.srcObject = t), V.value = await navigator.mediaDevices.enumerateDevices(), { stream: s.value && s.value.srcObject, devices: V.value };
|
|
189
245
|
}
|
|
190
|
-
function
|
|
191
|
-
|
|
246
|
+
function Le() {
|
|
247
|
+
R.value ? (R.value = !1, W.value = !1, Y()) : (R.value = !0, N());
|
|
192
248
|
}
|
|
193
|
-
function
|
|
194
|
-
if (
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
s.value = y.value[e === y.value.length - 1 ? 0 : e + 1], E();
|
|
249
|
+
function $e() {
|
|
250
|
+
if (f.value.length > 1) {
|
|
251
|
+
const e = f.value.findIndex((t) => t.deviceId === m.value?.deviceId);
|
|
252
|
+
m.value = f.value[e === f.value.length - 1 ? 0 : e + 1];
|
|
198
253
|
}
|
|
199
254
|
}
|
|
200
|
-
async function
|
|
201
|
-
|
|
202
|
-
}
|
|
203
|
-
ie(() => s.value, Y), ie(() => I.value, Y);
|
|
204
|
-
function N() {
|
|
205
|
-
i.countdown ? (_.value = _.value ? _.value - 1 : i.countdown, _.value ? setTimeout(N, 1e3) : ee()) : ee();
|
|
255
|
+
async function ge(e, t) {
|
|
256
|
+
e && (!t || e.deviceId !== t.deviceId) && await N();
|
|
206
257
|
}
|
|
207
|
-
|
|
258
|
+
ye(() => m.value, ge), ye(() => x.value, ge);
|
|
208
259
|
function ee() {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
260
|
+
i.countdown ? (C.value = C.value ? C.value - 1 : i.countdown, C.value ? setTimeout(ee, 1e3) : we()) : we();
|
|
261
|
+
}
|
|
262
|
+
ke({ onCapture: ee, enableMotion: X, camera: s.value, zoom: l });
|
|
263
|
+
function Be() {
|
|
264
|
+
if (!i.correctOrientation || Z.value == null) return 0;
|
|
265
|
+
const e = ((Z.value - 180) % 360 + 360) % 360;
|
|
266
|
+
return (-1 * (Math.round(e / 90) * 90 % 360) % 360 + 360) % 360;
|
|
267
|
+
}
|
|
268
|
+
function Ve(e, t, o, D, I) {
|
|
269
|
+
const E = a.value.width, n = a.value.height;
|
|
270
|
+
e.translate(E / 2, n / 2), $.value && e.scale(-1, 1), e.rotate(o * Math.PI / 180);
|
|
271
|
+
const u = n, p = E, B = Math.max(u / D, p / I) * (l.value && l.value > 0 ? l.value : 1), U = D * B, _ = I * B;
|
|
272
|
+
e.drawImage(t, -U / 2, -_ / 2, U, _);
|
|
273
|
+
}
|
|
274
|
+
function we() {
|
|
275
|
+
W.value = !0;
|
|
276
|
+
const e = a.value.getContext("2d"), t = s.value, o = t && t.srcObject && t.srcObject.getTracks(), { aspectRatio: D, width: I, height: E } = o.length && o[0].getSettings(), n = t?.videoWidth || I || j.value, u = t?.videoHeight || E || A.value, p = n && u ? n / u : D, te = T.value || { width: n, height: u }, B = te?.width || n, U = S.value ? te?.height || u : Math.round(B / p), _ = B / U;
|
|
277
|
+
if (a.value.width = B, a.value.height = U, !n || !u || !p)
|
|
212
278
|
return;
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
279
|
+
const q = Be();
|
|
280
|
+
if (e.save(), q === 90 || q === 270) {
|
|
281
|
+
Ve(e, t, q, n, u), e.restore(), ve(e, a.value.width, a.value.height), pe(a.value.toDataURL("image/png"));
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
if (q === 180 && (e.translate(a.value.width, a.value.height), e.scale(-1, -1)), $.value && (e.translate(a.value.width, 0), e.scale(-1, 1)), i.enableCropImage) {
|
|
285
|
+
let y = 0, M = 0, d = n, b = u;
|
|
286
|
+
if (p > _ ? (d = u * _, y = (n - d) / 2) : p < _ && (b = n / _, M = (u - b) / 2), l.value && l.value !== 1) {
|
|
287
|
+
const G = d / l.value, P = b / l.value;
|
|
288
|
+
y += (d - G) / 2, M += (b - P) / 2, d = G, b = P;
|
|
218
289
|
}
|
|
219
290
|
e.drawImage(
|
|
220
291
|
t,
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
292
|
+
y,
|
|
293
|
+
M,
|
|
294
|
+
d,
|
|
295
|
+
b,
|
|
225
296
|
0,
|
|
226
297
|
0,
|
|
227
298
|
a.value.width,
|
|
228
299
|
a.value.height
|
|
229
300
|
);
|
|
230
301
|
} else {
|
|
231
|
-
let
|
|
232
|
-
if (
|
|
233
|
-
const
|
|
234
|
-
|
|
302
|
+
let y = a.value.width, M = a.value.height, d = 0, b = 0;
|
|
303
|
+
if (p > _ ? (M = a.value.width / p, b = (a.value.height - M) / 2) : p < _ && (y = a.value.height * p, d = (a.value.width - y) / 2), l.value && l.value !== 1) {
|
|
304
|
+
const G = n / l.value, P = u / l.value, Ue = (n - G) / 2, Ge = (u - P) / 2;
|
|
305
|
+
$.value && (d = a.value.width - d - y), e.drawImage(
|
|
235
306
|
t,
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
307
|
+
Ue,
|
|
308
|
+
Ge,
|
|
309
|
+
G,
|
|
310
|
+
P,
|
|
311
|
+
d,
|
|
312
|
+
b,
|
|
313
|
+
y,
|
|
314
|
+
M
|
|
244
315
|
);
|
|
245
316
|
} else
|
|
246
|
-
|
|
317
|
+
$.value && (d = a.value.width - d - y), e.drawImage(
|
|
247
318
|
t,
|
|
248
319
|
0,
|
|
249
320
|
0,
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
321
|
+
n,
|
|
322
|
+
u,
|
|
323
|
+
d,
|
|
324
|
+
b,
|
|
325
|
+
y,
|
|
326
|
+
M
|
|
256
327
|
);
|
|
257
328
|
}
|
|
258
|
-
e.restore(),
|
|
259
|
-
const
|
|
260
|
-
pe(
|
|
329
|
+
e.restore(), ve(e, a.value.width, a.value.height);
|
|
330
|
+
const He = a.value.toDataURL("image/png");
|
|
331
|
+
pe(He);
|
|
261
332
|
}
|
|
262
333
|
function pe(e) {
|
|
263
|
-
const t =
|
|
264
|
-
|
|
334
|
+
const t = Xe(e);
|
|
335
|
+
De("update:modelValue", {
|
|
265
336
|
name: `cam-pic-${(/* @__PURE__ */ new Date()).toISOString()}`,
|
|
266
337
|
id: `cam-pic-${(/* @__PURE__ */ new Date()).toISOString()}`,
|
|
267
338
|
blob: t,
|
|
268
339
|
size: t.size
|
|
269
340
|
});
|
|
270
341
|
}
|
|
271
|
-
return
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
342
|
+
return We(async () => {
|
|
343
|
+
await N(), R.value = !0;
|
|
344
|
+
const e = i.defaultRearCamera && f.value.length > 1 ? f.value[f.value.length - 1] : f.value[0];
|
|
345
|
+
if (m.value = e, i.enableAudio && (x.value = ue.value[0]), navigator.mediaDevices.addEventListener("devicechange", async (t) => {
|
|
346
|
+
await N();
|
|
347
|
+
}), window.addEventListener("resize", me), he(), se.value) {
|
|
348
|
+
L = setTimeout(F, 3e3);
|
|
349
|
+
const t = window.DeviceOrientationEvent;
|
|
350
|
+
t && typeof t.requestPermission == "function" ? Ee() : X();
|
|
351
|
+
}
|
|
352
|
+
await je(), le.value = !0;
|
|
353
|
+
}), Ae(() => {
|
|
354
|
+
R.value = !1, W.value = !1, Y(), window.removeEventListener("resize", me), window.removeEventListener("devicemotion", ce, !0), L && clearTimeout(L), Q();
|
|
355
|
+
}), (e, t) => (g(), w("div", {
|
|
356
|
+
class: ae(["camera", Te.value])
|
|
279
357
|
}, [
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
default:
|
|
284
|
-
|
|
285
|
-
class:
|
|
358
|
+
h("div", at, [
|
|
359
|
+
J.value ? O("", !0) : (g(), w("div", it, [
|
|
360
|
+
ie(Ke, { color: "#000" }, {
|
|
361
|
+
default: Fe(() => [
|
|
362
|
+
h("span", {
|
|
363
|
+
class: ae("d-block text-center"),
|
|
286
364
|
innerHTML: e.$t("camera.waitForCameraNotification")
|
|
287
|
-
}, null, 8,
|
|
365
|
+
}, null, 8, ot)
|
|
288
366
|
]),
|
|
289
367
|
_: 1
|
|
290
368
|
})
|
|
291
369
|
])),
|
|
292
|
-
|
|
293
|
-
class:
|
|
294
|
-
style:
|
|
370
|
+
be(h("div", {
|
|
371
|
+
class: ae(["camera__video-wrapper", S.value ? `aspect-ratio--${S.value}` : ""]),
|
|
372
|
+
style: oe({ aspectRatio: xe.value || void 0, transform: l.value !== 1 ? `scale(${l.value})` : void 0 })
|
|
295
373
|
}, [
|
|
296
|
-
|
|
374
|
+
h("video", {
|
|
297
375
|
ref_key: "camera",
|
|
298
|
-
ref:
|
|
376
|
+
ref: s,
|
|
299
377
|
class: "camera__video",
|
|
300
|
-
style:
|
|
378
|
+
style: oe({
|
|
379
|
+
filter: i.filter === "grayscale" ? "grayscale(100%)" : i.filter === "sepia" ? "sepia(100%)" : "none",
|
|
380
|
+
transform: c.correctOrientation && z.value ? "rotate(180deg)" : void 0
|
|
381
|
+
}),
|
|
301
382
|
autoplay: "",
|
|
302
383
|
playsinline: ""
|
|
303
384
|
}, null, 4),
|
|
304
|
-
|
|
385
|
+
c.tintColor ? (g(), w("div", {
|
|
305
386
|
key: 0,
|
|
306
387
|
class: "camera__tint-overlay",
|
|
307
|
-
style:
|
|
308
|
-
backgroundColor:
|
|
309
|
-
opacity:
|
|
388
|
+
style: oe({
|
|
389
|
+
backgroundColor: c.tintColor,
|
|
390
|
+
opacity: c.tintIntensity,
|
|
310
391
|
mixBlendMode: "multiply"
|
|
311
392
|
})
|
|
312
|
-
}, null, 4)) :
|
|
393
|
+
}, null, 4)) : O("", !0)
|
|
313
394
|
], 6), [
|
|
314
|
-
[
|
|
395
|
+
[_e, J.value]
|
|
315
396
|
]),
|
|
316
|
-
|
|
397
|
+
be(h("canvas", {
|
|
317
398
|
ref_key: "canvas",
|
|
318
399
|
ref: a,
|
|
319
400
|
class: "camera__canvas",
|
|
320
|
-
width:
|
|
321
|
-
height:
|
|
322
|
-
}, null, 8,
|
|
323
|
-
[
|
|
401
|
+
width: j.value,
|
|
402
|
+
height: A.value
|
|
403
|
+
}, null, 8, nt), [
|
|
404
|
+
[_e, W.value]
|
|
324
405
|
]),
|
|
325
|
-
|
|
326
|
-
(
|
|
406
|
+
C.value ? (g(), w("div", lt, [
|
|
407
|
+
(g(), w("p", {
|
|
327
408
|
class: "countdown",
|
|
328
|
-
key:
|
|
329
|
-
innerHTML:
|
|
330
|
-
"data-countdown":
|
|
331
|
-
}, null, 8,
|
|
332
|
-
])) :
|
|
333
|
-
|
|
409
|
+
key: C.value,
|
|
410
|
+
innerHTML: C.value,
|
|
411
|
+
"data-countdown": C.value
|
|
412
|
+
}, null, 8, rt))
|
|
413
|
+
])) : O("", !0),
|
|
414
|
+
c.enableGuide && R.value && J.value ? (g(), w("img", {
|
|
334
415
|
key: 2,
|
|
335
416
|
class: "camera__guide",
|
|
336
|
-
src:
|
|
337
|
-
}, null, 8,
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
modelValue:
|
|
341
|
-
"onUpdate:modelValue": t[0] || (t[0] = (
|
|
417
|
+
src: c.guideSrc
|
|
418
|
+
}, null, 8, st)) : O("", !0),
|
|
419
|
+
c.enableZoomSlider ? (g(), w("div", ct, [
|
|
420
|
+
ie(et, {
|
|
421
|
+
modelValue: l.value,
|
|
422
|
+
"onUpdate:modelValue": t[0] || (t[0] = (o) => l.value = o)
|
|
342
423
|
}, null, 8, ["modelValue"])
|
|
343
|
-
])) :
|
|
424
|
+
])) : O("", !0)
|
|
344
425
|
]),
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
426
|
+
h("div", ut, [
|
|
427
|
+
h("div", dt, [
|
|
428
|
+
h("div", vt, [
|
|
429
|
+
h("div", ht, [
|
|
430
|
+
h("div", mt, [
|
|
431
|
+
h("button", {
|
|
351
432
|
type: "button",
|
|
352
433
|
class: "camera__toggle btn btn-primary",
|
|
353
|
-
onClick:
|
|
434
|
+
onClick: Le
|
|
354
435
|
}, [
|
|
355
|
-
|
|
436
|
+
R.value ? (g(), w("span", gt, ne(e.$t("common.pause")), 1)) : (g(), w("span", ft, ne(e.$t("common.play")), 1))
|
|
356
437
|
]),
|
|
357
|
-
|
|
438
|
+
h("button", {
|
|
358
439
|
type: "button",
|
|
359
440
|
class: "camera__capture btn btn-primary",
|
|
360
|
-
onClick:
|
|
361
|
-
},
|
|
441
|
+
onClick: ee
|
|
442
|
+
}, ne(e.$t("camera.capture")), 1)
|
|
362
443
|
])
|
|
363
444
|
])
|
|
364
445
|
])
|
|
365
446
|
])
|
|
366
447
|
]),
|
|
367
|
-
(
|
|
368
|
-
|
|
369
|
-
|
|
448
|
+
(c.enableSwitchCamera || c.enableSelectDevice) && f.value && f.value.length > 1 ? (g(), w("div", wt, [
|
|
449
|
+
h("div", pt, [
|
|
450
|
+
c.enableSelectDevice ? (g(), Ne(Qe, {
|
|
370
451
|
key: 0,
|
|
371
|
-
modelValue:
|
|
372
|
-
"onUpdate:modelValue": t[1] || (t[1] = (
|
|
373
|
-
options:
|
|
452
|
+
modelValue: de.value,
|
|
453
|
+
"onUpdate:modelValue": t[1] || (t[1] = (o) => de.value = o),
|
|
454
|
+
options: Re.value,
|
|
374
455
|
class: "w-100"
|
|
375
|
-
}, null, 8, ["modelValue", "options"])) :
|
|
456
|
+
}, null, 8, ["modelValue", "options"])) : O("", !0)
|
|
376
457
|
]),
|
|
377
|
-
|
|
378
|
-
|
|
458
|
+
h("div", yt, [
|
|
459
|
+
c.enableSwitchCamera ? (g(), w("button", {
|
|
379
460
|
key: 0,
|
|
380
461
|
class: "btn",
|
|
381
|
-
onClick:
|
|
462
|
+
onClick: qe($e, ["prevent"])
|
|
382
463
|
}, [
|
|
383
|
-
|
|
384
|
-
])) :
|
|
464
|
+
ie(Je, { symbol: "switch-camera" })
|
|
465
|
+
])) : O("", !0)
|
|
385
466
|
])
|
|
386
|
-
])) :
|
|
467
|
+
])) : O("", !0)
|
|
387
468
|
], 2));
|
|
388
469
|
}
|
|
389
470
|
});
|
|
390
471
|
export {
|
|
391
|
-
|
|
472
|
+
$t as default
|
|
392
473
|
};
|