ablok-components 0.3.86 → 0.3.87

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