@primestyleai/tryon 5.10.130 → 5.10.131
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/react/index.js +145 -145
- package/dist/react/index.js.map +1 -1
- package/dist/storefront/primestyle-tryon.js +1 -1
- package/package.json +1 -1
package/dist/react/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { P as
|
|
2
|
+
import { P as Rg, L as Yg, b as Ut, d as eg, a as Do, c as Jt, A as Kt, S as St, i as jt } from "../index-RlA_0mKn.js";
|
|
3
3
|
import { jsxs as e, jsx as A, Fragment as eA } from "react/jsx-runtime";
|
|
4
4
|
import { useState as Q, useRef as QA, useCallback as IA, useEffect as HA, useMemo as xe } from "react";
|
|
5
5
|
import { createPortal as hg } from "react-dom";
|
|
6
|
-
const Rt = "primestyle-photos",
|
|
6
|
+
const Rt = "primestyle-photos", go = "photos", Tt = 1;
|
|
7
7
|
let Ro = null;
|
|
8
8
|
function vg() {
|
|
9
9
|
return Ro || (Ro = new Promise((o) => {
|
|
@@ -12,7 +12,7 @@ function vg() {
|
|
|
12
12
|
const g = indexedDB.open(Rt, Tt);
|
|
13
13
|
g.onupgradeneeded = () => {
|
|
14
14
|
const t = g.result;
|
|
15
|
-
t.objectStoreNames.contains(
|
|
15
|
+
t.objectStoreNames.contains(go) || t.createObjectStore(go);
|
|
16
16
|
}, g.onsuccess = () => o(g.result), g.onerror = () => o(null), g.onblocked = () => o(null);
|
|
17
17
|
} catch {
|
|
18
18
|
o(null);
|
|
@@ -20,22 +20,22 @@ function vg() {
|
|
|
20
20
|
}), Ro);
|
|
21
21
|
}
|
|
22
22
|
const Eg = "result-";
|
|
23
|
-
async function
|
|
23
|
+
async function Tg(o, g) {
|
|
24
24
|
const t = await vg();
|
|
25
25
|
return t ? new Promise((r) => {
|
|
26
26
|
try {
|
|
27
|
-
const a = t.transaction(
|
|
28
|
-
a.objectStore(
|
|
27
|
+
const a = t.transaction(go, "readwrite");
|
|
28
|
+
a.objectStore(go).put(g, o), a.oncomplete = () => r(!0), a.onerror = () => r(!1), a.onabort = () => r(!1);
|
|
29
29
|
} catch {
|
|
30
30
|
r(!1);
|
|
31
31
|
}
|
|
32
32
|
}) : !1;
|
|
33
33
|
}
|
|
34
|
-
async function
|
|
34
|
+
async function Xg(o) {
|
|
35
35
|
const g = await vg();
|
|
36
36
|
return g ? new Promise((t) => {
|
|
37
37
|
try {
|
|
38
|
-
const a = g.transaction(
|
|
38
|
+
const a = g.transaction(go, "readonly").objectStore(go).get(o);
|
|
39
39
|
a.onsuccess = () => t(a.result instanceof Blob ? a.result : null), a.onerror = () => t(null);
|
|
40
40
|
} catch {
|
|
41
41
|
t(null);
|
|
@@ -43,10 +43,10 @@ async function Tg(o) {
|
|
|
43
43
|
}) : null;
|
|
44
44
|
}
|
|
45
45
|
async function Xt(o, g) {
|
|
46
|
-
return
|
|
46
|
+
return Tg(Eg + o, g);
|
|
47
47
|
}
|
|
48
48
|
async function Wt(o) {
|
|
49
|
-
return
|
|
49
|
+
return Xg(Eg + o);
|
|
50
50
|
}
|
|
51
51
|
async function Vt(o) {
|
|
52
52
|
const g = await vg();
|
|
@@ -56,7 +56,7 @@ async function Vt(o) {
|
|
|
56
56
|
t.add(r), t.add(Eg + r);
|
|
57
57
|
return new Promise((r) => {
|
|
58
58
|
try {
|
|
59
|
-
const a = g.transaction(
|
|
59
|
+
const a = g.transaction(go, "readwrite"), n = a.objectStore(go).openCursor();
|
|
60
60
|
n.onsuccess = () => {
|
|
61
61
|
const w = n.result;
|
|
62
62
|
if (!w) return;
|
|
@@ -68,9 +68,9 @@ async function Vt(o) {
|
|
|
68
68
|
}
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
|
-
const
|
|
71
|
+
const Wg = 11, Vg = 12, qt = 13, Zt = 14, $t = 15, _t = 16, qg = 23, Zg = 24, An = 25, en = 26, on = 27, gn = 28, tn = 0;
|
|
72
72
|
let Ag = null, To = null;
|
|
73
|
-
async function
|
|
73
|
+
async function $g() {
|
|
74
74
|
if (!Ag)
|
|
75
75
|
return To || (To = (async () => {
|
|
76
76
|
const o = await import(
|
|
@@ -92,11 +92,11 @@ async function Zg() {
|
|
|
92
92
|
}
|
|
93
93
|
async function _o(o) {
|
|
94
94
|
try {
|
|
95
|
-
await
|
|
96
|
-
const g = await
|
|
95
|
+
await $g();
|
|
96
|
+
const g = await _g(o), t = Ag.detect(g);
|
|
97
97
|
if (!t?.landmarks?.length || t.landmarks[0].length < 25)
|
|
98
98
|
return null;
|
|
99
|
-
const r = t.landmarks[0], a = r[
|
|
99
|
+
const r = t.landmarks[0], a = r[Wg], c = r[Vg], n = r[qg], w = r[Zg], s = (a.y + c.y) / 2, l = (n.y + w.y) / 2, D = l - s, d = s + D * 0.28, u = Math.abs(c.x - a.x), m = Math.min(a.x, c.x) - u * 0.05, M = Math.max(a.x, c.x) + u * 0.05, L = Math.abs(w.x - n.x), Y = Math.min(n.x, w.x) - L * 0.15, h = Math.max(n.x, w.x) + L * 0.15, C = d + (l - d) * 0.55, W = u * 0.85, Z = (a.x + c.x + n.x + w.x) / 4, i = Z - W / 2, b = Z + W / 2;
|
|
100
100
|
return {
|
|
101
101
|
chest: { y: d, x1: m, x2: M },
|
|
102
102
|
waist: { y: C, x1: i, x2: b },
|
|
@@ -106,7 +106,7 @@ async function _o(o) {
|
|
|
106
106
|
return console.error("[PS-SDK] Pose detection failed:", g), null;
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
|
-
function
|
|
109
|
+
function _g(o) {
|
|
110
110
|
return new Promise((g, t) => {
|
|
111
111
|
const r = new Image();
|
|
112
112
|
r.crossOrigin = "anonymous", r.onload = () => g(r), r.onerror = () => {
|
|
@@ -125,9 +125,9 @@ async function nn(o, g = 1024) {
|
|
|
125
125
|
}
|
|
126
126
|
async function Bo(o) {
|
|
127
127
|
try {
|
|
128
|
-
await
|
|
128
|
+
await $g();
|
|
129
129
|
let g;
|
|
130
|
-
typeof o == "string" ? g = await
|
|
130
|
+
typeof o == "string" ? g = await _g(o) : g = o;
|
|
131
131
|
const t = await nn(g, 1024), r = t.width || g.naturalWidth || g.width, a = t.height || g.naturalHeight || g.height, c = Ag.detect(t);
|
|
132
132
|
if (!c?.landmarks?.length || c.landmarks[0].length < 29)
|
|
133
133
|
return console.warn("[PS-SDK:MediaPipe] detection returned no usable landmarks", {
|
|
@@ -138,10 +138,10 @@ async function Bo(o) {
|
|
|
138
138
|
const Y = L && w ? w[M] : n[M], h = { x: Y.x, y: Y.y };
|
|
139
139
|
return typeof Y.z == "number" && (h.z = Y.z), typeof Y.visibility == "number" && (h.visibility = Y.visibility), h;
|
|
140
140
|
}, l = {
|
|
141
|
-
leftShoulder: s(
|
|
142
|
-
rightShoulder: s(
|
|
143
|
-
leftHip: s(
|
|
144
|
-
rightHip: s(
|
|
141
|
+
leftShoulder: s(Wg),
|
|
142
|
+
rightShoulder: s(Vg),
|
|
143
|
+
leftHip: s(qg),
|
|
144
|
+
rightHip: s(Zg),
|
|
145
145
|
leftElbow: s(qt),
|
|
146
146
|
rightElbow: s(Zt),
|
|
147
147
|
leftWrist: s($t),
|
|
@@ -184,7 +184,7 @@ const ke = {
|
|
|
184
184
|
chin: 152,
|
|
185
185
|
leftMouth: 61,
|
|
186
186
|
rightMouth: 291
|
|
187
|
-
},
|
|
187
|
+
}, Gg = 11.7;
|
|
188
188
|
let Dg = null, Mo = null;
|
|
189
189
|
async function rn() {
|
|
190
190
|
if (Dg) {
|
|
@@ -240,7 +240,7 @@ function sn(o) {
|
|
|
240
240
|
}, r.src = o;
|
|
241
241
|
});
|
|
242
242
|
}
|
|
243
|
-
function
|
|
243
|
+
function Lg(o, g, t) {
|
|
244
244
|
if (o.length < 4) return 0;
|
|
245
245
|
const r = (D) => ({ x: D.x * g, y: D.y * t }), [a, c, n, w] = o.map(r), s = Math.hypot(a.x - n.x, a.y - n.y), l = Math.hypot(c.x - w.x, c.y - w.y);
|
|
246
246
|
return (s + l) / 2;
|
|
@@ -269,16 +269,16 @@ function an(o) {
|
|
|
269
269
|
};
|
|
270
270
|
}
|
|
271
271
|
function Bn(o, g, t) {
|
|
272
|
-
const r =
|
|
272
|
+
const r = Lg(o.leftIrisRing, g, t), a = Lg(o.rightIrisRing, g, t), c = (r + a) / 2;
|
|
273
273
|
let n = 1;
|
|
274
274
|
c < 8 ? n = 0.3 : Math.abs(r - a) / c > 0.3 ? n = 0.5 : Math.abs(r - a) / c > 0.15 && (n = 0.8);
|
|
275
|
-
const w = c > 0 ?
|
|
275
|
+
const w = c > 0 ? Gg / c : 0, s = (v, F) => Math.hypot(
|
|
276
276
|
(v.x - F.x) * g,
|
|
277
277
|
(v.y - F.y) * t
|
|
278
278
|
) * w, l = s(o.leftIrisCenter, o.rightIrisCenter), d = s(o.leftInnerEye, o.rightInnerEye) / 1.6, u = s(o.leftTragus, o.rightTragus), m = s(o.leftTragus, o.leftOuterEye), M = s(o.rightTragus, o.rightOuterEye), L = (m + M) / 2, Y = u * 1.07, C = Math.abs((o.forehead.z ?? 0) - (o.chin.z ?? 0)) * g * w, W = Math.max(170, Math.min(210, C || 190)), Z = Y / 2, i = W / 2, b = Math.PI * Math.sqrt(2 * (Z * Z + i * i));
|
|
279
279
|
return {
|
|
280
280
|
measurements: {
|
|
281
|
-
irisDiameter:
|
|
281
|
+
irisDiameter: Gg,
|
|
282
282
|
pd: Ve(l),
|
|
283
283
|
bridgeWidth: Ve(d),
|
|
284
284
|
faceWidth: Ve(u),
|
|
@@ -405,8 +405,8 @@ const fn = [
|
|
|
405
405
|
{ key: "sleeveLength", label: "Sleeve", required: !1, unit: "cm", placeholder: "e.g. 64", category: "body" },
|
|
406
406
|
{ key: "inseam", label: "Inseam", required: !1, unit: "cm", placeholder: "e.g. 81", category: "body" },
|
|
407
407
|
{ key: "footLengthCm", label: "Foot length", required: !1, unit: "cm", placeholder: "e.g. 27", category: "shoe" }
|
|
408
|
-
], vn = 3,
|
|
409
|
-
function
|
|
408
|
+
], vn = 3, At = "primestyle_", et = "profiles", ot = "active_profile_id", Go = "ps:storage-change";
|
|
409
|
+
function gt(o) {
|
|
410
410
|
if (!(typeof window > "u"))
|
|
411
411
|
try {
|
|
412
412
|
window.dispatchEvent(new CustomEvent(Go, { detail: { reason: o } }));
|
|
@@ -416,29 +416,29 @@ function ot(o) {
|
|
|
416
416
|
function Je(o, g) {
|
|
417
417
|
if (typeof window > "u") return g;
|
|
418
418
|
try {
|
|
419
|
-
const t = localStorage.getItem(
|
|
419
|
+
const t = localStorage.getItem(At + o);
|
|
420
420
|
return t ? JSON.parse(t) : g;
|
|
421
421
|
} catch {
|
|
422
422
|
return g;
|
|
423
423
|
}
|
|
424
424
|
}
|
|
425
|
-
function
|
|
425
|
+
function ao(o, g) {
|
|
426
426
|
try {
|
|
427
|
-
localStorage.setItem(
|
|
427
|
+
localStorage.setItem(At + o, JSON.stringify(g));
|
|
428
428
|
} catch {
|
|
429
429
|
}
|
|
430
430
|
}
|
|
431
431
|
function Ig() {
|
|
432
|
-
return Je(
|
|
432
|
+
return Je(et, []);
|
|
433
433
|
}
|
|
434
|
-
function
|
|
435
|
-
|
|
434
|
+
function ug(o) {
|
|
435
|
+
ao(et, o), gt("profiles");
|
|
436
436
|
}
|
|
437
437
|
function tt() {
|
|
438
|
-
return Je(
|
|
438
|
+
return Je(ot, null);
|
|
439
439
|
}
|
|
440
440
|
function En(o) {
|
|
441
|
-
|
|
441
|
+
ao(ot, o), gt("active-profile");
|
|
442
442
|
}
|
|
443
443
|
function In() {
|
|
444
444
|
const o = Ig();
|
|
@@ -456,7 +456,7 @@ function nt(o, g) {
|
|
|
456
456
|
const t = Ig(), r = t.findIndex((c) => c.id === o);
|
|
457
457
|
if (r < 0) return null;
|
|
458
458
|
const a = { ...t[r], ...g, lastEditedAt: Date.now() };
|
|
459
|
-
return t[r] = a,
|
|
459
|
+
return t[r] = a, ug(t), a;
|
|
460
460
|
}
|
|
461
461
|
function Bg(o, g, t = "cm") {
|
|
462
462
|
return nt(o, { measurements: g, measurementsUnit: t });
|
|
@@ -473,7 +473,7 @@ function rt(o, g) {
|
|
|
473
473
|
...a,
|
|
474
474
|
sizeHistory: n,
|
|
475
475
|
lastUsedAt: Date.now()
|
|
476
|
-
},
|
|
476
|
+
}, ug(t), t[r];
|
|
477
477
|
}
|
|
478
478
|
function un(o, g) {
|
|
479
479
|
if (!o.sizeHistory || o.sizeHistory.length === 0) return null;
|
|
@@ -501,7 +501,7 @@ function Re() {
|
|
|
501
501
|
o = process.env.NEXT_PUBLIC_PRIMESTYLE_API_KEY ?? "";
|
|
502
502
|
} catch {
|
|
503
503
|
}
|
|
504
|
-
if (!o) throw new
|
|
504
|
+
if (!o) throw new Rg("Missing NEXT_PUBLIC_PRIMESTYLE_API_KEY", "MISSING_API_KEY");
|
|
505
505
|
return o;
|
|
506
506
|
}
|
|
507
507
|
function je(o) {
|
|
@@ -667,7 +667,7 @@ async function it(o) {
|
|
|
667
667
|
found: s.found
|
|
668
668
|
};
|
|
669
669
|
}
|
|
670
|
-
async function
|
|
670
|
+
async function Og(o) {
|
|
671
671
|
let g;
|
|
672
672
|
try {
|
|
673
673
|
g = o.apiKey ?? Re();
|
|
@@ -758,7 +758,7 @@ function st(o) {
|
|
|
758
758
|
function Xe(o) {
|
|
759
759
|
return o === "in" || o === "inches" || o === "lbs" ? "Imperial" : o === "cm" || o === "kg" ? "Metric" : o === "mm" ? "mm" : "";
|
|
760
760
|
}
|
|
761
|
-
const
|
|
761
|
+
const zg = /* @__PURE__ */ new Map();
|
|
762
762
|
function qe(o, g) {
|
|
763
763
|
const t = o[g];
|
|
764
764
|
return t && typeof t == "object" && typeof t.x == "number" && typeof t.y == "number" ? t : null;
|
|
@@ -786,7 +786,7 @@ async function Mn(o) {
|
|
|
786
786
|
async function yn(o) {
|
|
787
787
|
if (!o || !o.length) return null;
|
|
788
788
|
if (o.length === 1) return o[0];
|
|
789
|
-
const g = o.join("|"), t =
|
|
789
|
+
const g = o.join("|"), t = zg.get(g);
|
|
790
790
|
if (t) return t;
|
|
791
791
|
const r = Date.now(), a = await Promise.all(o.map(async (n) => ({
|
|
792
792
|
url: n,
|
|
@@ -794,7 +794,7 @@ async function yn(o) {
|
|
|
794
794
|
})));
|
|
795
795
|
a.sort((n, w) => w.score - n.score);
|
|
796
796
|
const c = (a[0]?.score ?? 0) > 0 ? a[0].url : o[0];
|
|
797
|
-
|
|
797
|
+
zg.set(g, c), console.log(`[ps-sdk:garment-pick] ${Date.now() - r}ms — chose ${o.indexOf(c)}/${o.length}`);
|
|
798
798
|
for (const n of a) console.log(`[ps-sdk:garment-pick] ${n.score.toString().padStart(4, " ")} ${n.url}`);
|
|
799
799
|
return c;
|
|
800
800
|
}
|
|
@@ -8448,7 +8448,7 @@ const Fn = `
|
|
|
8448
8448
|
.ps-photo-zone-error { font-size: 11px; padding: 8px 10px; border-radius: 8px; }
|
|
8449
8449
|
}
|
|
8450
8450
|
`;
|
|
8451
|
-
function
|
|
8451
|
+
function oo({ size: o = 18 }) {
|
|
8452
8452
|
return /* @__PURE__ */ e("svg", { width: o, height: o, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
8453
8453
|
/* @__PURE__ */ A("path", { d: "M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z" }),
|
|
8454
8454
|
/* @__PURE__ */ A("circle", { cx: "12", cy: "13", r: "4" })
|
|
@@ -8480,7 +8480,7 @@ function Yn() {
|
|
|
8480
8480
|
function Yo() {
|
|
8481
8481
|
return /* @__PURE__ */ A("svg", { width: 16, height: 16, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ A("path", { d: "M5 12h14M12 5l7 7-7 7" }) });
|
|
8482
8482
|
}
|
|
8483
|
-
function
|
|
8483
|
+
function mg({ size: o = 16 }) {
|
|
8484
8484
|
return /* @__PURE__ */ e("svg", { width: o, height: o, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
8485
8485
|
/* @__PURE__ */ A("path", { d: "M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2" }),
|
|
8486
8486
|
/* @__PURE__ */ A("circle", { cx: "12", cy: "7", r: "4" })
|
|
@@ -8501,7 +8501,7 @@ function Ln({ size: o = 18 }) {
|
|
|
8501
8501
|
/* @__PURE__ */ A("path", { d: "m17.5 15.5 2-2" })
|
|
8502
8502
|
] });
|
|
8503
8503
|
}
|
|
8504
|
-
function
|
|
8504
|
+
function Pg({ size: o = 18 }) {
|
|
8505
8505
|
return /* @__PURE__ */ A("svg", { width: o, height: o, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ A("path", { d: "m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z" }) });
|
|
8506
8506
|
}
|
|
8507
8507
|
function On({ size: o = 14 }) {
|
|
@@ -8527,7 +8527,7 @@ function Jn({ view: o, stepIndex: g }) {
|
|
|
8527
8527
|
return o === "error" || o === "idle" ? null : /* @__PURE__ */ A("div", { className: "ps-tryon-dots", children: Array.from({ length: vn }, (t, r) => r + 1).map((t) => /* @__PURE__ */ A("div", { className: `ps-tryon-dot${t < g ? " ps-done" : t === g ? " ps-active" : ""}` }, t)) });
|
|
8528
8528
|
}
|
|
8529
8529
|
function Kn({ activeLocale: o, onSelect: g }) {
|
|
8530
|
-
const [t, r] = Q(!1), a = QA(null), c = QA(null), [n, w] = Q({ top: 0, right: 0 }), s =
|
|
8530
|
+
const [t, r] = Q(!1), a = QA(null), c = QA(null), [n, w] = Q({ top: 0, right: 0 }), s = Yg[o] || "English", l = IA(() => {
|
|
8531
8531
|
if (!a.current) return;
|
|
8532
8532
|
const D = a.current.getBoundingClientRect();
|
|
8533
8533
|
w({ top: D.bottom + 4, right: window.innerWidth - D.right });
|
|
@@ -8578,7 +8578,7 @@ function Kn({ activeLocale: o, onSelect: g }) {
|
|
|
8578
8578
|
g(D), r(!1);
|
|
8579
8579
|
},
|
|
8580
8580
|
children: [
|
|
8581
|
-
/* @__PURE__ */ A("span", { className: "ps-tryon-lang-name", children:
|
|
8581
|
+
/* @__PURE__ */ A("span", { className: "ps-tryon-lang-name", children: Yg[D] || D }),
|
|
8582
8582
|
/* @__PURE__ */ A("span", { className: "ps-tryon-lang-code", children: D.toUpperCase() }),
|
|
8583
8583
|
D === o && /* @__PURE__ */ A("span", { className: "ps-tryon-lang-check", children: /* @__PURE__ */ A(Nn, { size: 12 }) })
|
|
8584
8584
|
]
|
|
@@ -8751,7 +8751,7 @@ function Rn({
|
|
|
8751
8751
|
t.length === 0 ? /* @__PURE__ */ A("div", { className: "ps-tryon-drawer-empty", children: s("No saved profiles yet.") }) : t.map((m) => /* @__PURE__ */ e("div", { className: "ps-tryon-profile-item", onClick: () => {
|
|
8752
8752
|
n(m), g(null);
|
|
8753
8753
|
}, children: [
|
|
8754
|
-
/* @__PURE__ */ A("div", { className: "ps-tryon-profile-avatar", children: /* @__PURE__ */ A(
|
|
8754
|
+
/* @__PURE__ */ A("div", { className: "ps-tryon-profile-avatar", children: /* @__PURE__ */ A(mg, { size: 20 }) }),
|
|
8755
8755
|
/* @__PURE__ */ e("div", { className: "ps-tryon-profile-info", children: [
|
|
8756
8756
|
/* @__PURE__ */ A("div", { className: "ps-tryon-profile-name", children: m.name }),
|
|
8757
8757
|
/* @__PURE__ */ e("div", { className: "ps-tryon-profile-detail", children: [
|
|
@@ -8934,14 +8934,14 @@ function Wn({
|
|
|
8934
8934
|
/* @__PURE__ */ e("div", { className: "ps-tryon-welcome-hero", children: [
|
|
8935
8935
|
o && /* @__PURE__ */ e("div", { className: "ps-tryon-welcome-img-wrap", children: [
|
|
8936
8936
|
/* @__PURE__ */ A("img", { src: o, alt: t("Product"), className: "ps-tryon-welcome-product" }),
|
|
8937
|
-
/* @__PURE__ */ A("div", { className: "ps-tryon-welcome-sparkle", children: /* @__PURE__ */ A(
|
|
8937
|
+
/* @__PURE__ */ A("div", { className: "ps-tryon-welcome-sparkle", children: /* @__PURE__ */ A(Pg, { size: 20 }) })
|
|
8938
8938
|
] }),
|
|
8939
8939
|
/* @__PURE__ */ A("h2", { className: "ps-tryon-welcome-title", children: t("Find Your Size & See It On You") }),
|
|
8940
8940
|
/* @__PURE__ */ A("p", { className: "ps-tryon-welcome-sub", children: t("Get the perfect fit, then try it on virtually") })
|
|
8941
8941
|
] }),
|
|
8942
8942
|
/* @__PURE__ */ A("div", { className: "ps-tryon-features", children: [
|
|
8943
8943
|
{ icon: /* @__PURE__ */ A(Ln, { size: 22 }), title: t("Get Your Size"), desc: t("Instant fit recommendation") },
|
|
8944
|
-
{ icon: /* @__PURE__ */ A(
|
|
8944
|
+
{ icon: /* @__PURE__ */ A(oo, { size: 22 }), title: t("Try It On"), desc: t("See how it looks on you") }
|
|
8945
8945
|
].map((r, a) => /* @__PURE__ */ e("div", { className: "ps-tryon-feature", children: [
|
|
8946
8946
|
/* @__PURE__ */ A("div", { className: "ps-tryon-feature-icon", children: r.icon }),
|
|
8947
8947
|
/* @__PURE__ */ A("div", { className: "ps-tryon-feature-title", children: r.title }),
|
|
@@ -9157,7 +9157,7 @@ function er({ landmarks: o, w: g, h: t }) {
|
|
|
9157
9157
|
}
|
|
9158
9158
|
);
|
|
9159
9159
|
}
|
|
9160
|
-
function
|
|
9160
|
+
function Ng({
|
|
9161
9161
|
previewUrl: o,
|
|
9162
9162
|
productImage: g,
|
|
9163
9163
|
bodyLandmarks: t,
|
|
@@ -9818,7 +9818,7 @@ const Qg = (o) => {
|
|
|
9818
9818
|
if (c.toLowerCase() === a) return r[c].toString().trim();
|
|
9819
9819
|
}
|
|
9820
9820
|
return "";
|
|
9821
|
-
}, lr = (o, g) => g(o === "good" ? "perfect fit" : o === "too-tight" ? "too tight" : o === "tight" ? "tight" : o === "a-bit-tight" ? "a bit tight" : o === "too-loose" ? "too loose" : o === "loose" ? "loose" : "a bit loose"),
|
|
9821
|
+
}, lr = (o, g) => g(o === "good" ? "perfect fit" : o === "too-tight" ? "too tight" : o === "tight" ? "tight" : o === "a-bit-tight" ? "a bit tight" : o === "too-loose" ? "too loose" : o === "loose" ? "loose" : "a bit loose"), Ug = (o, g) => g(o === "good" ? "perfect fit" : o === "too-short" || o === "too-tight" ? "too short" : o === "short" || o === "tight" ? "short" : o === "a-bit-short" || o === "a-bit-tight" ? "a bit short" : o === "too-long" || o === "too-loose" ? "too long" : o === "long" || o === "loose" ? "long" : "a bit long");
|
|
9822
9822
|
function Ct(o, g, t) {
|
|
9823
9823
|
return g === t || !o || isNaN(o) || g === "mm" || t === "mm" ? o : g === "cm" ? Math.round(o / 2.54 * 10) / 10 : Math.round(o * 2.54 * 10) / 10;
|
|
9824
9824
|
}
|
|
@@ -9827,7 +9827,7 @@ function pr(o, g, t) {
|
|
|
9827
9827
|
const r = (c) => Ct(c, g, t), a = o.match(/^(\d+\.?\d*)\s*[-–]\s*(\d+\.?\d*)$/);
|
|
9828
9828
|
return a ? `${r(parseFloat(a[1]))}-${r(parseFloat(a[2]))}` : /^\d+\.?\d*$/.test(o.trim()) ? String(r(parseFloat(o))) : o;
|
|
9829
9829
|
}
|
|
9830
|
-
const
|
|
9830
|
+
const Jg = (o) => /length|lunghezza|longueur|länge|largo/i.test(o);
|
|
9831
9831
|
function cg(o, g) {
|
|
9832
9832
|
const t = o.toLowerCase().replace(/\s*(size|sizing|—.*|–.*|\(.*?\))\s*/gi, "").trim();
|
|
9833
9833
|
return g.find((r) => {
|
|
@@ -10202,7 +10202,7 @@ function qo({
|
|
|
10202
10202
|
] })
|
|
10203
10203
|
] }),
|
|
10204
10204
|
/* @__PURE__ */ e("div", { className: `ps-msd-row-badge ${Be}`, children: [
|
|
10205
|
-
S.isLength ?
|
|
10205
|
+
S.isLength ? Ug(S.fit, s).toUpperCase() : XA(S.fit, S.isLength),
|
|
10206
10206
|
/* @__PURE__ */ A("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", width: "11", height: "11", children: /* @__PURE__ */ A("path", { d: "M3 8l3.5 3.5L13 5" }) })
|
|
10207
10207
|
] })
|
|
10208
10208
|
] }, pA);
|
|
@@ -10289,7 +10289,7 @@ function qo({
|
|
|
10289
10289
|
gap: 6
|
|
10290
10290
|
},
|
|
10291
10291
|
children: [
|
|
10292
|
-
/* @__PURE__ */ A(
|
|
10292
|
+
/* @__PURE__ */ A(oo, { size: 14 }),
|
|
10293
10293
|
C ? `${s("Generating try-on…")}${zA > 0 ? ` ${zA}s` : ""}` : s("Try It On")
|
|
10294
10294
|
]
|
|
10295
10295
|
}
|
|
@@ -10428,7 +10428,7 @@ function qo({
|
|
|
10428
10428
|
/* @__PURE__ */ A("td", { style: { padding: "0.55vw 0.6vw", fontSize: "0.75vw", fontWeight: 500, color: "var(--ps-text-primary)" }, children: x.area }),
|
|
10429
10429
|
/* @__PURE__ */ A("td", { style: { padding: "0.55vw 0.6vw", fontSize: "0.75vw", color: "var(--ps-text-secondary)" }, children: v ? x.rawUserValue || "" : isNaN(x.userNum) || x.userNum === 0 ? "" : `${O(x.userNum)} ${a}` }),
|
|
10430
10430
|
/* @__PURE__ */ A("td", { style: { padding: "0.55vw 0.6vw", fontSize: "0.75vw", color: "var(--ps-text-secondary)" }, children: v ? x.rawChartRange || "" : X(x.chartLabel) }),
|
|
10431
|
-
/* @__PURE__ */ A("td", { style: { padding: "0.55vw 0.6vw", textAlign: "right" }, children: /* @__PURE__ */ A("span", { style: { fontSize: "0.6vw", fontWeight: 600, color: XA, background: S, borderRadius: "1vw", padding: "0.15vw 0.5vw", whiteSpace: "nowrap" }, children: x.isLength ?
|
|
10431
|
+
/* @__PURE__ */ A("td", { style: { padding: "0.55vw 0.6vw", textAlign: "right" }, children: /* @__PURE__ */ A("span", { style: { fontSize: "0.6vw", fontWeight: 600, color: XA, background: S, borderRadius: "1vw", padding: "0.15vw 0.5vw", whiteSpace: "nowrap" }, children: x.isLength ? Ug(x.fit, s) : lr(x.fit, s) }) })
|
|
10432
10432
|
] }, q);
|
|
10433
10433
|
}) })
|
|
10434
10434
|
] }) }),
|
|
@@ -10535,7 +10535,7 @@ function qo({
|
|
|
10535
10535
|
C || (x.currentTarget.style.opacity = "1");
|
|
10536
10536
|
},
|
|
10537
10537
|
children: [
|
|
10538
|
-
/* @__PURE__ */ A(
|
|
10538
|
+
/* @__PURE__ */ A(oo, { size: 12 }),
|
|
10539
10539
|
C ? `${s("Generating try-on…")}${zA > 0 ? ` ${zA}s` : ""}` : s("Try It On")
|
|
10540
10540
|
]
|
|
10541
10541
|
}
|
|
@@ -10780,7 +10780,7 @@ function Cr({
|
|
|
10780
10780
|
}
|
|
10781
10781
|
return { name: N, section: J, secResult: _, userMeasurements: tA };
|
|
10782
10782
|
});
|
|
10783
|
-
}, [Ce, t, g, wA]), lA = xe(() => FA.filter((P) => !
|
|
10783
|
+
}, [Ce, t, g, wA]), lA = xe(() => FA.filter((P) => !Jg(P.name)), [FA]), I = xe(() => FA.filter((P) => Jg(P.name)), [FA]), kA = IA((P, H) => {
|
|
10784
10784
|
if (!H) return H;
|
|
10785
10785
|
let J = cg(P, I)?.secResult?.recommendedSize?.trim() || "";
|
|
10786
10786
|
if (J || (J = FA.find((ce) => ce.name === P)?.secResult?.length?.trim() || ""), !J) return H;
|
|
@@ -10827,7 +10827,7 @@ function Cr({
|
|
|
10827
10827
|
] }) : null;
|
|
10828
10828
|
return /* @__PURE__ */ e("div", { className: "ps-tryon-sr", children: [
|
|
10829
10829
|
De && me && /* @__PURE__ */ A(
|
|
10830
|
-
|
|
10830
|
+
Ng,
|
|
10831
10831
|
{
|
|
10832
10832
|
productImage: a,
|
|
10833
10833
|
bodyLandmarks: null,
|
|
@@ -10844,7 +10844,7 @@ function Cr({
|
|
|
10844
10844
|
] })
|
|
10845
10845
|
] }),
|
|
10846
10846
|
De && KA && !de && m && /* @__PURE__ */ A(
|
|
10847
|
-
|
|
10847
|
+
Ng,
|
|
10848
10848
|
{
|
|
10849
10849
|
previewUrl: m,
|
|
10850
10850
|
bodyLandmarks: W ?? null,
|
|
@@ -11144,7 +11144,7 @@ function Cr({
|
|
|
11144
11144
|
q(u || null), ae(!0);
|
|
11145
11145
|
},
|
|
11146
11146
|
children: [
|
|
11147
|
-
/* @__PURE__ */ A(
|
|
11147
|
+
/* @__PURE__ */ A(oo, { size: 14 }),
|
|
11148
11148
|
" ",
|
|
11149
11149
|
E(h ? "Processing..." : "Try It On")
|
|
11150
11150
|
]
|
|
@@ -11354,7 +11354,7 @@ function Cr({
|
|
|
11354
11354
|
onClick: _,
|
|
11355
11355
|
type: "button",
|
|
11356
11356
|
children: [
|
|
11357
|
-
/* @__PURE__ */ A(
|
|
11357
|
+
/* @__PURE__ */ A(oo, { size: 14 }),
|
|
11358
11358
|
" ",
|
|
11359
11359
|
E(h ? "Processing..." : "Try It On")
|
|
11360
11360
|
]
|
|
@@ -11595,7 +11595,7 @@ function Cr({
|
|
|
11595
11595
|
] }),
|
|
11596
11596
|
/* @__PURE__ */ e("div", { style: { background: "rgba(59,130,246,0.08)", border: "1px solid rgba(59,130,246,0.2)", borderRadius: "0.5vw", padding: "0.5vw 0.8vw" }, children: [
|
|
11597
11597
|
/* @__PURE__ */ e("div", { style: { display: "flex", alignItems: "center", gap: "0.3vw", marginBottom: "0.2vw" }, children: [
|
|
11598
|
-
/* @__PURE__ */ A(
|
|
11598
|
+
/* @__PURE__ */ A(Pg, { size: 12 }),
|
|
11599
11599
|
/* @__PURE__ */ A("span", { style: { color: "var(--ps-accent)", fontSize: "0.65vw", fontWeight: 700 }, children: E("Pro Tip") })
|
|
11600
11600
|
] }),
|
|
11601
11601
|
/* @__PURE__ */ A("div", { style: { fontSize: "0.55vw", color: "var(--ps-text-secondary)", lineHeight: 1.7 }, children: E(i === "face" ? "A clear, well-lit face photo gives the most accurate eyewear try-on." : i === "head" ? "A clear head-and-shoulders photo with space above your head gives the most accurate headwear try-on." : "Our AI works best with front-facing, full-body photos in fitted clothing. Better photos = more accurate virtual try-on!") })
|
|
@@ -11611,7 +11611,7 @@ function Cr({
|
|
|
11611
11611
|
/* @__PURE__ */ e("button", { className: "ps-tryon-v2-cta", style: { marginTop: 0 }, disabled: !x, onClick: () => {
|
|
11612
11612
|
x && (M(x), Y(x), ae(!1));
|
|
11613
11613
|
}, children: [
|
|
11614
|
-
/* @__PURE__ */ A(
|
|
11614
|
+
/* @__PURE__ */ A(oo, { size: 14 }),
|
|
11615
11615
|
" ",
|
|
11616
11616
|
E("Start Try-On")
|
|
11617
11617
|
] })
|
|
@@ -11713,7 +11713,7 @@ function dr({
|
|
|
11713
11713
|
}
|
|
11714
11714
|
) });
|
|
11715
11715
|
}
|
|
11716
|
-
function
|
|
11716
|
+
function Kg({
|
|
11717
11717
|
apiUrl: o,
|
|
11718
11718
|
apiKey: g,
|
|
11719
11719
|
previewUrl: t,
|
|
@@ -11879,7 +11879,7 @@ function Dr({
|
|
|
11879
11879
|
/* @__PURE__ */ A("p", { className: "ps-pm-subtitle", children: c(o === "face" ? "A clear, front-facing face photo — no glasses on — gives us the most accurate try-on." : o === "head" ? "Face the camera with your head and shoulders in frame, leaving space above your head." : "Ensure your full body is visible for the most accurate virtual try-on.") })
|
|
11880
11880
|
] }),
|
|
11881
11881
|
/* @__PURE__ */ A("div", { className: "ps-pm-preview", children: /* @__PURE__ */ A(
|
|
11882
|
-
|
|
11882
|
+
Kg,
|
|
11883
11883
|
{
|
|
11884
11884
|
apiUrl: g,
|
|
11885
11885
|
apiKey: t,
|
|
@@ -11943,7 +11943,7 @@ function Dr({
|
|
|
11943
11943
|
] }) }) : /* @__PURE__ */ e("div", { style: { display: "flex", flexDirection: "column", padding: "1.5vw", width: "100%", height: "100%", background: "var(--ps-bg-primary)", borderRadius: "0.8vw", overflow: "hidden" }, children: [
|
|
11944
11944
|
/* @__PURE__ */ e("div", { style: { display: "flex", gap: "1.2vw", flex: 1, alignItems: "stretch", minHeight: 0, overflow: "hidden" }, children: [
|
|
11945
11945
|
/* @__PURE__ */ A("div", { style: { flex: 1, display: "flex", minHeight: 0 }, children: /* @__PURE__ */ A(
|
|
11946
|
-
|
|
11946
|
+
Kg,
|
|
11947
11947
|
{
|
|
11948
11948
|
apiUrl: g,
|
|
11949
11949
|
apiKey: t,
|
|
@@ -12022,7 +12022,7 @@ function Dr({
|
|
|
12022
12022
|
] }),
|
|
12023
12023
|
/* @__PURE__ */ e("div", { style: { background: "rgba(59,130,246,0.08)", border: "1px solid rgba(59,130,246,0.2)", borderRadius: "0.5vw", padding: "0.5vw 0.8vw" }, children: [
|
|
12024
12024
|
/* @__PURE__ */ e("div", { style: { display: "flex", alignItems: "center", gap: "0.3vw", marginBottom: "0.2vw" }, children: [
|
|
12025
|
-
/* @__PURE__ */ A(
|
|
12025
|
+
/* @__PURE__ */ A(Pg, { size: 12 }),
|
|
12026
12026
|
/* @__PURE__ */ A("span", { style: { color: "var(--ps-accent)", fontSize: "0.65vw", fontWeight: 700 }, children: c("Pro Tip") })
|
|
12027
12027
|
] }),
|
|
12028
12028
|
/* @__PURE__ */ A("div", { style: { fontSize: "0.55vw", color: "var(--ps-text-secondary)", lineHeight: 1.7 }, children: c(o === "face" ? "A clear, well-lit face photo gives the most accurate eyewear try-on." : o === "head" ? "A clear head-and-shoulders photo with space above your head gives the most accurate headwear try-on." : "Our AI works best with front-facing, full-body photos in fitted clothing. Better photos = more accurate virtual try-on!") })
|
|
@@ -12036,7 +12036,7 @@ function Dr({
|
|
|
12036
12036
|
c("Back")
|
|
12037
12037
|
] }),
|
|
12038
12038
|
/* @__PURE__ */ e("button", { className: "ps-tryon-v2-cta", style: { marginTop: 0 }, disabled: !w, onClick: d, children: [
|
|
12039
|
-
/* @__PURE__ */ A(
|
|
12039
|
+
/* @__PURE__ */ A(oo, { size: 14 }),
|
|
12040
12040
|
" ",
|
|
12041
12041
|
c("Start Try-On")
|
|
12042
12042
|
] })
|
|
@@ -12250,7 +12250,7 @@ const vr = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABAAAAAQACAMAAABIw9uxAA
|
|
|
12250
12250
|
FR: ["80", "85", "90", "95", "100", "105", "110", "115", "120"],
|
|
12251
12251
|
IT: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"],
|
|
12252
12252
|
JP: ["60", "65", "70", "75", "80", "85", "90", "95", "100"]
|
|
12253
|
-
},
|
|
12253
|
+
}, Sg = {
|
|
12254
12254
|
US: ["AA", "A", "B", "C", "D", "DD/E", "DDD/F", "G", "H", "I", "J"],
|
|
12255
12255
|
UK: ["AA", "A", "B", "C", "D", "DD", "E", "F", "FF", "G", "GG", "H"],
|
|
12256
12256
|
EU: ["AA", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J"],
|
|
@@ -13274,7 +13274,7 @@ function Jr({ onSave: o, onCancel: g, apiUrl: t, apiKey: r, onPhotoPreview: a, o
|
|
|
13274
13274
|
pg,
|
|
13275
13275
|
{
|
|
13276
13276
|
value: UA,
|
|
13277
|
-
options:
|
|
13277
|
+
options: Sg[Ae] || Sg.US,
|
|
13278
13278
|
placeholder: "—",
|
|
13279
13279
|
direction: "up",
|
|
13280
13280
|
isOpen: LA === "cup",
|
|
@@ -13810,7 +13810,7 @@ function qr({
|
|
|
13810
13810
|
tabIndex: 0,
|
|
13811
13811
|
children: [
|
|
13812
13812
|
/* @__PURE__ */ A("div", { className: "ps-msp-card-header", children: /* @__PURE__ */ A("span", { className: "ps-msp-card-tag", children: g ? n("DEFAULT PROFILE") : o.gender === "female" ? n("WOMEN'S FIT") : n("MEN'S FIT") }) }),
|
|
13813
|
-
/* @__PURE__ */ A("div", { className: "ps-msp-card-circle", children: o.photoBase64 ? /* @__PURE__ */ A("img", { src: o.photoBase64, alt: o.name }) : /* @__PURE__ */ A(
|
|
13813
|
+
/* @__PURE__ */ A("div", { className: "ps-msp-card-circle", children: o.photoBase64 ? /* @__PURE__ */ A("img", { src: o.photoBase64, alt: o.name }) : /* @__PURE__ */ A(mg, { size: 32 }) }),
|
|
13814
13814
|
/* @__PURE__ */ A("div", { className: "ps-msp-card-name", children: o.name }),
|
|
13815
13815
|
/* @__PURE__ */ e("div", { className: "ps-msp-card-meta", children: [
|
|
13816
13816
|
w && /* @__PURE__ */ e("div", { className: "ps-msp-meta-row", children: [
|
|
@@ -15931,13 +15931,13 @@ function li({
|
|
|
15931
15931
|
] })
|
|
15932
15932
|
] }) });
|
|
15933
15933
|
}
|
|
15934
|
-
function
|
|
15934
|
+
function jg() {
|
|
15935
15935
|
return /* @__PURE__ */ e("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", width: "14", height: "14", children: [
|
|
15936
15936
|
/* @__PURE__ */ A("path", { d: "M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z" }),
|
|
15937
15937
|
/* @__PURE__ */ A("circle", { cx: "12", cy: "13", r: "4" })
|
|
15938
15938
|
] });
|
|
15939
15939
|
}
|
|
15940
|
-
function
|
|
15940
|
+
function bg({
|
|
15941
15941
|
title: o,
|
|
15942
15942
|
fields: g,
|
|
15943
15943
|
unitOptions: t,
|
|
@@ -16076,7 +16076,7 @@ function Pg({
|
|
|
16076
16076
|
!a && /* @__PURE__ */ e(eA, { children: [
|
|
16077
16077
|
/* @__PURE__ */ A("div", { className: "ps-bpm-or", children: /* @__PURE__ */ A("span", { children: C("or") }) }),
|
|
16078
16078
|
/* @__PURE__ */ e("button", { type: "button", className: "ps-bpm-upload-link", onClick: () => b("photo"), children: [
|
|
16079
|
-
/* @__PURE__ */ A(
|
|
16079
|
+
/* @__PURE__ */ A(jg, {}),
|
|
16080
16080
|
/* @__PURE__ */ A("span", { children: C(W ? "Upload a close-up face photo or selfie" : "Upload a photo for AI sizing") }),
|
|
16081
16081
|
/* @__PURE__ */ A("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", width: "14", height: "14", children: /* @__PURE__ */ A("polyline", { points: "9 18 15 12 9 6" }) })
|
|
16082
16082
|
] })
|
|
@@ -16136,7 +16136,7 @@ function Pg({
|
|
|
16136
16136
|
] }, y.key)) }),
|
|
16137
16137
|
K && /* @__PURE__ */ A("p", { className: "ps-bp-error", children: K }),
|
|
16138
16138
|
!a && /* @__PURE__ */ e("button", { className: "ps-bp-photo-cta", onClick: () => b("photo"), type: "button", children: [
|
|
16139
|
-
/* @__PURE__ */ A(
|
|
16139
|
+
/* @__PURE__ */ A(jg, {}),
|
|
16140
16140
|
/* @__PURE__ */ A("span", { children: C(W ? "Or upload a close-up face photo or selfie" : "Or upload a photo for AI sizing") }),
|
|
16141
16141
|
/* @__PURE__ */ A("span", { className: "ps-bp-photo-cta-arrow", children: "→" })
|
|
16142
16142
|
] }),
|
|
@@ -16673,7 +16673,7 @@ function Ci(o, g) {
|
|
|
16673
16673
|
function di(o) {
|
|
16674
16674
|
const { sizeGuide: g, t, ...r } = o, a = Ci(g, t);
|
|
16675
16675
|
return /* @__PURE__ */ A(
|
|
16676
|
-
|
|
16676
|
+
bg,
|
|
16677
16677
|
{
|
|
16678
16678
|
title: t("Shoe Size"),
|
|
16679
16679
|
fields: a,
|
|
@@ -16711,7 +16711,7 @@ function Qi(o, g) {
|
|
|
16711
16711
|
function fi(o) {
|
|
16712
16712
|
const { sizeGuide: g, t, ...r } = o, a = Qi(g, t);
|
|
16713
16713
|
return /* @__PURE__ */ A(
|
|
16714
|
-
|
|
16714
|
+
bg,
|
|
16715
16715
|
{
|
|
16716
16716
|
title: t("Headwear Measurements"),
|
|
16717
16717
|
fields: a,
|
|
@@ -16774,7 +16774,7 @@ function Ei(o, g) {
|
|
|
16774
16774
|
function Ii(o) {
|
|
16775
16775
|
const { sizeGuide: g, t, ...r } = o, a = Ei(g, t);
|
|
16776
16776
|
return /* @__PURE__ */ A(
|
|
16777
|
-
|
|
16777
|
+
bg,
|
|
16778
16778
|
{
|
|
16779
16779
|
title: t("Frame Measurements"),
|
|
16780
16780
|
fields: a,
|
|
@@ -16792,7 +16792,7 @@ if (typeof document < "u") {
|
|
|
16792
16792
|
g.id = o, g.textContent = Fn, document.head.appendChild(g);
|
|
16793
16793
|
}
|
|
16794
16794
|
}
|
|
16795
|
-
function
|
|
16795
|
+
function so(o) {
|
|
16796
16796
|
const g = o.toLowerCase();
|
|
16797
16797
|
return /\b(shoe|shoes|sneaker|sneakers|boot|boots|heel|heels|loafer|loafers|mule|mules|sandal|sandals|trainer|trainers|slipper|slippers|stiletto|stilettos|pump|pumps|oxford|derby|derbies|wedge|espadrille|clog)\b/.test(g) ? "foot" : /\b(hat|hats|cap|caps|beanie|beanies|bucket hat|fedora|snapback|baseball cap|trucker hat|beret|panama|headband|visor|bonnet)\b/.test(g) ? "head" : /\b(sunglass|sunglasses|eyewear|eyeglasses|glasses|spectacles|optical|goggles|frames|aviator|wayfarer|lens)\b/.test(g) ? "face" : "body";
|
|
16798
16798
|
}
|
|
@@ -16872,7 +16872,7 @@ function Pi({
|
|
|
16872
16872
|
}, [iA]);
|
|
16873
16873
|
const [q, XA] = Q(!1), S = QA(!1), [pA, UA] = Q(mn), Be = st(pA), [Ae, pe] = Q(Be ? "in" : "cm"), [LA, Ce] = Q(Be ? "in" : "cm"), [FA, lA] = Q(Be ? "lbs" : "kg");
|
|
16874
16874
|
HA(() => {
|
|
16875
|
-
const B =
|
|
16875
|
+
const B = so(r);
|
|
16876
16876
|
B === "foot" || B === "head" ? pe("cm") : B === "face" && pe("mm");
|
|
16877
16877
|
}, [r]);
|
|
16878
16878
|
const I = QA({}), [kA, oA] = Q("male"), [KA, me] = Q(0), [ZA, Me] = Q(null), [de, De] = Q(!1), [JA, Qe] = Q(() => Je("profiles", [])), [SA, P] = Q(() => Je("history", [])), [H, N] = Q(() => tt()), [J, _] = Q(() => /* @__PURE__ */ new Set()), [tA, ee] = Q(null), EA = IA((B) => {
|
|
@@ -16907,10 +16907,10 @@ function Pi({
|
|
|
16907
16907
|
}).catch(() => {
|
|
16908
16908
|
}), () => p.abort();
|
|
16909
16909
|
}, [g, t, s, r]);
|
|
16910
|
-
const og = 22, Ko = QA(0), ho = QA(null), vo = QA(null), Eo = QA(null), Io = QA(null), uo = QA(null), gg = QA(null), tg = QA(""),
|
|
16910
|
+
const og = 22, Ko = QA(0), ho = QA(null), vo = QA(null), Eo = QA(null), Io = QA(null), uo = QA(null), gg = QA(null), tg = QA(""), to = QA(null);
|
|
16911
16911
|
HA(() => {
|
|
16912
16912
|
if (gA === "processing") {
|
|
16913
|
-
if (
|
|
16913
|
+
if (to.current) return;
|
|
16914
16914
|
Ko.current = 0, gg.current = Date.now(), tg.current = "";
|
|
16915
16915
|
const B = [
|
|
16916
16916
|
{ at: 0, text: T("Preparing your image...") },
|
|
@@ -16920,7 +16920,7 @@ function Pi({
|
|
|
16920
16920
|
{ at: 75, text: T("Refining details...") },
|
|
16921
16921
|
{ at: 90, text: T("Almost there...") }
|
|
16922
16922
|
], p = 2 * Math.PI * 38;
|
|
16923
|
-
return
|
|
16923
|
+
return to.current = setInterval(() => {
|
|
16924
16924
|
if (Ie.current) return;
|
|
16925
16925
|
const G = gg.current || Date.now(), sA = (Date.now() - G) / 1e3, nA = Math.min(95, sA / og * 100);
|
|
16926
16926
|
Ko.current = nA;
|
|
@@ -16943,10 +16943,10 @@ function Pi({
|
|
|
16943
16943
|
}
|
|
16944
16944
|
}
|
|
16945
16945
|
}, 200), () => {
|
|
16946
|
-
clearInterval(
|
|
16946
|
+
clearInterval(to.current), to.current = null;
|
|
16947
16947
|
};
|
|
16948
16948
|
} else
|
|
16949
|
-
|
|
16949
|
+
to.current && (clearInterval(to.current), to.current = null), gg.current = null;
|
|
16950
16950
|
}, [gA, T]), HA(() => () => {
|
|
16951
16951
|
rA && URL.revokeObjectURL(rA);
|
|
16952
16952
|
}, [rA]), HA(() => {
|
|
@@ -16957,9 +16957,9 @@ function Pi({
|
|
|
16957
16957
|
};
|
|
16958
16958
|
}
|
|
16959
16959
|
}, [gA]), HA(() => {
|
|
16960
|
-
|
|
16960
|
+
ao("profiles", JA);
|
|
16961
16961
|
}, [JA]), HA(() => {
|
|
16962
|
-
|
|
16962
|
+
ao("history", SA);
|
|
16963
16963
|
}, [SA]), HA(() => {
|
|
16964
16964
|
const B = () => Qe(Je("profiles", []));
|
|
16965
16965
|
return window.addEventListener(Go, B), () => window.removeEventListener(Go, B);
|
|
@@ -17045,7 +17045,7 @@ function Pi({
|
|
|
17045
17045
|
}
|
|
17046
17046
|
},
|
|
17047
17047
|
[H, JA, s, o, r, z, EA]
|
|
17048
|
-
), ng = QA(null), [Po, rg] = Q(null),
|
|
17048
|
+
), ng = QA(null), [Po, rg] = Q(null), xg = IA(async (B) => {
|
|
17049
17049
|
const p = B.height ?? B.heightCm ?? 0, G = B.weight ?? B.weightKg ?? 0, sA = !!B.measurements && Object.keys(B.measurements).length > 0, nA = B.photoBase64;
|
|
17050
17050
|
if (!sA && nA && p > 0 && ng.current) {
|
|
17051
17051
|
try {
|
|
@@ -17096,14 +17096,14 @@ function Pi({
|
|
|
17096
17096
|
}, [JA, H]), Pt = IA(() => {
|
|
17097
17097
|
if (!Po) return;
|
|
17098
17098
|
const B = Po;
|
|
17099
|
-
rg(null),
|
|
17100
|
-
}, [Po,
|
|
17099
|
+
rg(null), xg(B);
|
|
17100
|
+
}, [Po, xg]), bt = IA(() => {
|
|
17101
17101
|
rg(null), me((B) => B + 1), O("body-profile");
|
|
17102
17102
|
}, []), xt = QA(() => {
|
|
17103
17103
|
}), Ht = IA(() => {
|
|
17104
17104
|
console.log("[ps-sdk] handleOpen fired — opening modal"), O("body-profile"), C?.();
|
|
17105
|
-
}, [C]),
|
|
17106
|
-
O("idle"), X(null), f(null), dA(null), rA && URL.revokeObjectURL(rA), uA(null), yA(null), mA(null), le(null), _A(null), y(!1), Me(null), De(!1), Ee(!1), he(!1), I.current = {}, oA("male"),
|
|
17105
|
+
}, [C]), no = IA(() => {
|
|
17106
|
+
O("idle"), X(null), f(null), dA(null), rA && URL.revokeObjectURL(rA), uA(null), yA(null), mA(null), le(null), _A(null), y(!1), Me(null), De(!1), Ee(!1), he(!1), I.current = {}, oA("male"), ro.current = !1, hA.current?.(), hA.current = null, xA.current && (clearInterval(xA.current), xA.current = null), W?.();
|
|
17107
17107
|
}, [W, rA]), Mt = IA(() => {
|
|
17108
17108
|
if (YA) {
|
|
17109
17109
|
f(null), bA.current && (O(bA.current), bA.current = null);
|
|
@@ -17111,7 +17111,7 @@ function Pi({
|
|
|
17111
17111
|
}
|
|
17112
17112
|
switch (gA) {
|
|
17113
17113
|
case "body-profile":
|
|
17114
|
-
|
|
17114
|
+
no();
|
|
17115
17115
|
break;
|
|
17116
17116
|
case "estimation-review":
|
|
17117
17117
|
O("body-profile");
|
|
@@ -17140,10 +17140,10 @@ function Pi({
|
|
|
17140
17140
|
O(bA.current || "body-profile"), bA.current = null;
|
|
17141
17141
|
break;
|
|
17142
17142
|
default:
|
|
17143
|
-
|
|
17143
|
+
no();
|
|
17144
17144
|
break;
|
|
17145
17145
|
}
|
|
17146
|
-
}, [gA, YA, qA,
|
|
17146
|
+
}, [gA, YA, qA, no]), yt = gA !== "idle" && gA !== "processing" && gA !== "result" && gA !== "welcome" && gA !== "body-profile" && gA !== "size-result", ig = IA((B) => {
|
|
17147
17147
|
if (!jt(B)) {
|
|
17148
17148
|
mA(T("Please upload a JPEG, PNG, or WebP image.")), O("error"), v?.({ message: "Invalid file type", code: "INVALID_FILE" });
|
|
17149
17149
|
return;
|
|
@@ -17158,7 +17158,7 @@ function Pi({
|
|
|
17158
17158
|
Ue.current = G;
|
|
17159
17159
|
}).catch(() => {
|
|
17160
17160
|
});
|
|
17161
|
-
}, [Z, v]),
|
|
17161
|
+
}, [Z, v]), Hg = IA(() => {
|
|
17162
17162
|
X(null), rA && URL.revokeObjectURL(rA), uA(null);
|
|
17163
17163
|
}, [rA]), co = IA(() => {
|
|
17164
17164
|
xA.current && (clearInterval(xA.current), xA.current = null), hA.current?.(), hA.current = null;
|
|
@@ -17184,7 +17184,7 @@ function Pi({
|
|
|
17184
17184
|
}
|
|
17185
17185
|
}, [b, v, co]), Ao = xe(() => V?.found && V.requiredFields && V.requiredFields.length > 0 ? V.requiredFields : kA === "female" ? fn : hn, [V, kA]), bo = IA(async (B) => {
|
|
17186
17186
|
if (!Oe.current) return;
|
|
17187
|
-
const p = B || ne, G = je(s), sA = Re(), nA =
|
|
17187
|
+
const p = B || ne, G = je(s), sA = Re(), nA = so(r);
|
|
17188
17188
|
if (nA === "face" || nA === "head") {
|
|
17189
17189
|
const k = I.current, R = (cA) => {
|
|
17190
17190
|
if (!cA) return;
|
|
@@ -17342,7 +17342,7 @@ function Pi({
|
|
|
17342
17342
|
console.log("[ps-sdk] handleSnapSubmit calling backend", { baseUrl: p }), X(B.photoFile), We.current = B.photoFile;
|
|
17343
17343
|
const sA = B.photoFile ? URL.createObjectURL(B.photoFile) : B.photoBase64.startsWith("data:") ? B.photoBase64 : `data:image/jpeg;base64,${B.photoBase64}`;
|
|
17344
17344
|
uA(sA), Ie.current = !1, Uo.current = null, x.current = !1, re(!1), te(null), _A(null), yA(null), y(!0), NA(!1), O("size-result");
|
|
17345
|
-
const nA =
|
|
17345
|
+
const nA = so(r);
|
|
17346
17346
|
if (nA === "face" || nA === "head") {
|
|
17347
17347
|
No(null);
|
|
17348
17348
|
const DA = new Promise((ge) => setTimeout(ge, 4500));
|
|
@@ -17487,7 +17487,7 @@ function Pi({
|
|
|
17487
17487
|
return;
|
|
17488
17488
|
}
|
|
17489
17489
|
B && B !== fA && (X(B), We.current = B), Ie.current = !1, re(!0), te(Date.now());
|
|
17490
|
-
const G = mi(
|
|
17490
|
+
const G = mi(so(r)), sA = G === "apparel", nA = (B ? null : rA) || URL.createObjectURL(p);
|
|
17491
17491
|
(B || !rA) && uA(nA), sA && (!Ue.current || !BA) && (Ue.current = null, Ke(null), _o(nA).then((AA) => {
|
|
17492
17492
|
Ue.current = AA;
|
|
17493
17493
|
}).catch(() => {
|
|
@@ -17498,8 +17498,8 @@ function Pi({
|
|
|
17498
17498
|
try {
|
|
17499
17499
|
const AA = await Do(p, sA ? { maxDimension: 1024, quality: 0.85 } : {}), k = $.current, R = Object.keys(k), aA = R.length > 0, WA = aA ? (() => {
|
|
17500
17500
|
const OA = /* @__PURE__ */ new Set(), ze = [];
|
|
17501
|
-
for (const
|
|
17502
|
-
const Ne = k[
|
|
17501
|
+
for (const io of R) {
|
|
17502
|
+
const Ne = k[io]?.matchDetails || [];
|
|
17503
17503
|
for (const lo of Ne) {
|
|
17504
17504
|
const So = lo.measurement.toLowerCase().trim();
|
|
17505
17505
|
OA.has(So) || (OA.add(So), ze.push(lo));
|
|
@@ -17521,18 +17521,18 @@ function Pi({
|
|
|
17521
17521
|
const VA = () => {
|
|
17522
17522
|
const OA = /* @__PURE__ */ new Set(), ze = [];
|
|
17523
17523
|
console.log("[ps-sdk:flatten] sizingResult keys:", Object.keys(CA || {})), console.log("[ps-sdk:flatten] root matchDetails:", (CA?.matchDetails || []).map((Ne) => Ne.measurement)), console.log("[ps-sdk:flatten] sections:", CA?.sections ? Object.keys(CA.sections) : "none");
|
|
17524
|
-
const
|
|
17524
|
+
const io = (Ne, lo, So) => {
|
|
17525
17525
|
if (Ne) {
|
|
17526
17526
|
console.log(`[ps-sdk:flatten] ${lo} →`, Ne.map((jo) => jo.measurement));
|
|
17527
17527
|
for (const jo of Ne) {
|
|
17528
|
-
const
|
|
17529
|
-
OA.has(
|
|
17528
|
+
const kg = jo.measurement.toLowerCase().replace(/\s*\(.*?\)\s*/g, "").trim();
|
|
17529
|
+
OA.has(kg) || (OA.add(kg), ze.push({ ...jo, section: So }));
|
|
17530
17530
|
}
|
|
17531
17531
|
}
|
|
17532
17532
|
};
|
|
17533
|
-
if (
|
|
17533
|
+
if (io(CA?.matchDetails, "root", void 0), CA?.sections)
|
|
17534
17534
|
for (const [Ne, lo] of Object.entries(CA.sections))
|
|
17535
|
-
|
|
17535
|
+
io(lo?.matchDetails, `section:${Ne}`, Ne);
|
|
17536
17536
|
return console.log("[ps-sdk:flatten] final unique:", ze.map((Ne) => Ne.measurement)), ze;
|
|
17537
17537
|
}, ie = ge?.matchDetails && ge.matchDetails.length ? ge.matchDetails : VA();
|
|
17538
17538
|
let cA;
|
|
@@ -17569,8 +17569,8 @@ function Pi({
|
|
|
17569
17569
|
if (!OA || OA <= 0) return;
|
|
17570
17570
|
const ze = I.current.heightUnit || LA || "cm";
|
|
17571
17571
|
if (ze === "ft") {
|
|
17572
|
-
const
|
|
17573
|
-
return `${
|
|
17572
|
+
const io = Math.floor(OA), Ne = Math.round((OA - io) * 12);
|
|
17573
|
+
return `${io}'${Ne}"`;
|
|
17574
17574
|
}
|
|
17575
17575
|
return ze === "in" ? `${OA}"` : `${OA} cm`;
|
|
17576
17576
|
})(),
|
|
@@ -17585,13 +17585,13 @@ function Pi({
|
|
|
17585
17585
|
}
|
|
17586
17586
|
);
|
|
17587
17587
|
wo.modelImageId && (Uo.current = wo.modelImageId), i?.(wo.jobId), hA.current = U.current.onJob(wo.jobId, sg);
|
|
17588
|
-
let
|
|
17588
|
+
let Fg = 0;
|
|
17589
17589
|
xA.current = setInterval(async () => {
|
|
17590
17590
|
if (Ie.current) {
|
|
17591
17591
|
xA.current && clearInterval(xA.current), xA.current = null;
|
|
17592
17592
|
return;
|
|
17593
17593
|
}
|
|
17594
|
-
if (
|
|
17594
|
+
if (Fg++, Fg > 60) {
|
|
17595
17595
|
xA.current && clearInterval(xA.current), xA.current = null;
|
|
17596
17596
|
return;
|
|
17597
17597
|
}
|
|
@@ -17602,7 +17602,7 @@ function Pi({
|
|
|
17602
17602
|
}
|
|
17603
17603
|
}, 3e3);
|
|
17604
17604
|
} catch (AA) {
|
|
17605
|
-
const k = AA instanceof Error ? AA.message : T("Failed to start try-on"), R = AA instanceof
|
|
17605
|
+
const k = AA instanceof Error ? AA.message : T("Failed to start try-on"), R = AA instanceof Rg ? AA.code : void 0;
|
|
17606
17606
|
mA(k), O("error"), v?.({ message: k, code: R });
|
|
17607
17607
|
}
|
|
17608
17608
|
}, [fA, o, r, CA, i, v, sg]);
|
|
@@ -17691,14 +17691,14 @@ function Pi({
|
|
|
17691
17691
|
return [...k, sA].slice(-50);
|
|
17692
17692
|
}), EA(G), he(!0);
|
|
17693
17693
|
}, [H, pA, Ae, LA, FA]);
|
|
17694
|
-
const
|
|
17694
|
+
const Mg = IA(async () => {
|
|
17695
17695
|
const B = `h_${Date.now()}`;
|
|
17696
17696
|
let p = !1;
|
|
17697
17697
|
const G = fA || We.current;
|
|
17698
17698
|
if (G)
|
|
17699
17699
|
try {
|
|
17700
17700
|
const R = await Do(G, { maxDimension: 768, quality: 0.7 }), aA = await (await fetch(R)).blob();
|
|
17701
|
-
p = await
|
|
17701
|
+
p = await Tg(B, aA);
|
|
17702
17702
|
} catch {
|
|
17703
17703
|
}
|
|
17704
17704
|
const sA = $.current, nA = CA?.recommendedSize ?? "", AA = Object.values(sA).map((R) => ({
|
|
@@ -17738,10 +17738,10 @@ function Pi({
|
|
|
17738
17738
|
const aA = [k, ...R].slice(0, 50), WA = new Set(aA.map((DA) => DA.id));
|
|
17739
17739
|
return Vt(WA), aA;
|
|
17740
17740
|
});
|
|
17741
|
-
}, [r, o, iA, CA, V, H, JA, fA]),
|
|
17741
|
+
}, [r, o, iA, CA, V, H, JA, fA]), ro = QA(!1), Ho = QA(!1);
|
|
17742
17742
|
HA(() => {
|
|
17743
|
-
if (gA === "size-result" && CA && !
|
|
17744
|
-
|
|
17743
|
+
if (gA === "size-result" && CA && !ro.current)
|
|
17744
|
+
ro.current = !0, Ho.current = !1, Mg().catch(() => {
|
|
17745
17745
|
});
|
|
17746
17746
|
else if (gA === "size-result" && CA && iA && !Ho.current) {
|
|
17747
17747
|
Ho.current = !0;
|
|
@@ -17770,11 +17770,11 @@ function Pi({
|
|
|
17770
17770
|
}
|
|
17771
17771
|
})();
|
|
17772
17772
|
}
|
|
17773
|
-
} else gA === "result" && iA && !
|
|
17774
|
-
})) : (gA === "welcome" || gA === "body-profile") && (
|
|
17773
|
+
} else gA === "result" && iA && !ro.current ? (ro.current = !0, Mg().catch(() => {
|
|
17774
|
+
})) : (gA === "welcome" || gA === "body-profile") && (ro.current = !1, Ho.current = !1);
|
|
17775
17775
|
}, [gA, CA, iA]);
|
|
17776
17776
|
const Lt = IA((B) => {
|
|
17777
|
-
if (
|
|
17777
|
+
if (ro.current = !0, Ho.current = !!B.resultImageUrl, Jo.current = !0, B.sizingResult ? _A(B.sizingResult) : B.recommendedSize && _A({
|
|
17778
17778
|
recommendedSize: B.recommendedSize,
|
|
17779
17779
|
confidence: B.confidence || "high",
|
|
17780
17780
|
reasoning: B.reasoning || "",
|
|
@@ -17784,7 +17784,7 @@ function Pi({
|
|
|
17784
17784
|
if (!p) return;
|
|
17785
17785
|
const G = URL.createObjectURL(p);
|
|
17786
17786
|
yA(G);
|
|
17787
|
-
}), B.hasPhoto &&
|
|
17787
|
+
}), B.hasPhoto && Xg(B.id).then((p) => {
|
|
17788
17788
|
if (!p) return;
|
|
17789
17789
|
const G = new File([p], `history-photo-${B.id}.jpg`, { type: p.type || "image/jpeg" });
|
|
17790
17790
|
X(G), We.current = G;
|
|
@@ -17861,13 +17861,13 @@ function Pi({
|
|
|
17861
17861
|
"--ps-error-color": M.errorColor,
|
|
17862
17862
|
"--ps-success-color": M.successColor,
|
|
17863
17863
|
"--ps-logo-height": M.logoHeight
|
|
17864
|
-
},
|
|
17864
|
+
}, yg = Object.fromEntries(Object.entries(zt).filter(([, B]) => B !== void 0));
|
|
17865
17865
|
function Nt() {
|
|
17866
17866
|
switch (gA) {
|
|
17867
17867
|
case "welcome":
|
|
17868
17868
|
return /* @__PURE__ */ A("div", { className: "ps-tryon-view-enter", children: /* @__PURE__ */ A(Wn, { productImage: o, setView: O, t: T }) }, "v-welcome");
|
|
17869
17869
|
case "body-profile": {
|
|
17870
|
-
const B =
|
|
17870
|
+
const B = so(r), p = { productImage: o, productTitle: r, formRef: I, sizingUnit: Ae, setSizingUnit: pe, setSizingMethod: le, setSizingLoading: y, setView: O, submitSizing: bo, onSnapSubmit: ag, onBack: no, apiUrl: je(s), apiKey: Re(), sizeGuide: V, t: T };
|
|
17871
17871
|
if (B === "foot") return /* @__PURE__ */ A("div", { className: "ps-tryon-view-enter", children: /* @__PURE__ */ A(di, { ...p }) }, "v-foot");
|
|
17872
17872
|
if (B === "head") return /* @__PURE__ */ A("div", { className: "ps-tryon-view-enter", children: /* @__PURE__ */ A(fi, { ...p }) }, "v-head");
|
|
17873
17873
|
if (B === "face") return /* @__PURE__ */ A("div", { className: "ps-tryon-view-enter", children: /* @__PURE__ */ A(Ii, { ...p }) }, "v-face");
|
|
@@ -17918,7 +17918,7 @@ function Pi({
|
|
|
17918
17918
|
onSnapSubmit: (k) => {
|
|
17919
17919
|
Ee(!0), ag(k);
|
|
17920
17920
|
},
|
|
17921
|
-
onBack:
|
|
17921
|
+
onBack: no,
|
|
17922
17922
|
t: T
|
|
17923
17923
|
},
|
|
17924
17924
|
`bp-${H || "anon"}`
|
|
@@ -17967,20 +17967,20 @@ function Pi({
|
|
|
17967
17967
|
selectedFile: fA,
|
|
17968
17968
|
previewUrl: rA,
|
|
17969
17969
|
handleFileSelect: ig,
|
|
17970
|
-
handleRemovePreview:
|
|
17970
|
+
handleRemovePreview: Hg,
|
|
17971
17971
|
handleTryOnSubmit: xo,
|
|
17972
17972
|
tryOnProcessing: He,
|
|
17973
17973
|
tryOnStartedAt: PA,
|
|
17974
17974
|
tryOnAvailable: GA,
|
|
17975
17975
|
bodyLandmarks: BA,
|
|
17976
17976
|
faceLandmarks: zo,
|
|
17977
|
-
measurementType:
|
|
17977
|
+
measurementType: so(r),
|
|
17978
17978
|
activeSection: qA,
|
|
17979
17979
|
setActiveSection: fe,
|
|
17980
17980
|
onResetTryOn: () => {
|
|
17981
17981
|
X(null), rA && URL.revokeObjectURL(rA), uA(null), yA(null);
|
|
17982
17982
|
},
|
|
17983
|
-
onClose:
|
|
17983
|
+
onClose: no,
|
|
17984
17984
|
userHeightCm: (() => {
|
|
17985
17985
|
const B = JA.find((nA) => nA.id === H);
|
|
17986
17986
|
if (!B) return;
|
|
@@ -18002,7 +18002,7 @@ function Pi({
|
|
|
18002
18002
|
setDragOver: $A,
|
|
18003
18003
|
fileInputRef: $e,
|
|
18004
18004
|
handleFileSelect: ig,
|
|
18005
|
-
handleRemovePreview:
|
|
18005
|
+
handleRemovePreview: Hg,
|
|
18006
18006
|
handleTryOnSubmit: xo,
|
|
18007
18007
|
cn: L,
|
|
18008
18008
|
t: T
|
|
@@ -18061,7 +18061,7 @@ function Pi({
|
|
|
18061
18061
|
},
|
|
18062
18062
|
onEstimateFromPhoto: async (B) => {
|
|
18063
18063
|
try {
|
|
18064
|
-
const p = await Bo(B.photoBase64).catch(() => null), G = await
|
|
18064
|
+
const p = await Bo(B.photoBase64).catch(() => null), G = await Og({
|
|
18065
18065
|
apiUrl: s,
|
|
18066
18066
|
height: B.height > 0 ? B.height : void 0,
|
|
18067
18067
|
weight: B.weight > 0 ? B.weight : void 0,
|
|
@@ -18084,9 +18084,9 @@ function Pi({
|
|
|
18084
18084
|
createdAt: Date.now(),
|
|
18085
18085
|
lastUsedAt: Date.now()
|
|
18086
18086
|
}, G = [p, ...JA];
|
|
18087
|
-
|
|
18087
|
+
ug(G), Qe(G), EA(p.id);
|
|
18088
18088
|
const sA = p.heightCm || p.height || 0, nA = p.weightKg || p.weight || 0, AA = p.sizingUnit === "in" ? "in" : "cm", k = p.sizingUnit === "in" ? "lbs" : "kg", R = p.photoBase64;
|
|
18089
|
-
!(!!p.measurements && Object.keys(p.measurements).length > 0) && (R || sA > 0 && nA > 0) && (_((DA) => new Set(DA).add(p.id)), (R ? Bo(R).catch(() => null) : Promise.resolve(null)).then((DA) =>
|
|
18089
|
+
!(!!p.measurements && Object.keys(p.measurements).length > 0) && (R || sA > 0 && nA > 0) && (_((DA) => new Set(DA).add(p.id)), (R ? Bo(R).catch(() => null) : Promise.resolve(null)).then((DA) => Og({
|
|
18090
18090
|
apiUrl: s,
|
|
18091
18091
|
height: sA > 0 ? sA : void 0,
|
|
18092
18092
|
weight: nA > 0 ? nA : void 0,
|
|
@@ -18105,7 +18105,7 @@ function Pi({
|
|
|
18105
18105
|
const ge = Je("profiles", []), VA = ge.findIndex((ie) => ie.id === p.id);
|
|
18106
18106
|
if (VA >= 0) {
|
|
18107
18107
|
const ie = ge[VA], cA = DA.userEstimates, se = { ...ie };
|
|
18108
|
-
cA.height && !(ie.height || ie.heightCm) && (se.height = cA.height, se.heightCm = cA.height, se.heightUnit = "cm"), cA.weight && !(ie.weight || ie.weightKg) && (se.weight = cA.weight, se.weightKg = cA.weight, se.weightUnit = "kg"), cA.age && !ie.age && (se.age = cA.age), ge[VA] = se,
|
|
18108
|
+
cA.height && !(ie.height || ie.heightCm) && (se.height = cA.height, se.heightCm = cA.height, se.heightUnit = "cm"), cA.weight && !(ie.weight || ie.weightKg) && (se.weight = cA.weight, se.weightKg = cA.weight, se.weightUnit = "kg"), cA.age && !ie.age && (se.age = cA.age), ge[VA] = se, ao("profiles", ge);
|
|
18109
18109
|
}
|
|
18110
18110
|
}
|
|
18111
18111
|
Qe(Je("profiles", []));
|
|
@@ -18119,7 +18119,7 @@ function Pi({
|
|
|
18119
18119
|
}));
|
|
18120
18120
|
},
|
|
18121
18121
|
onDeleteProfile: (B) => {
|
|
18122
|
-
Qe((p) => p.filter((G) => G.id !== B)), H === B && EA(null),
|
|
18122
|
+
Qe((p) => p.filter((G) => G.id !== B)), H === B && EA(null), ao("profiles", Je("profiles", []).filter((p) => p.id !== B));
|
|
18123
18123
|
},
|
|
18124
18124
|
onRequestDelete: (B) => ee(B),
|
|
18125
18125
|
onClose: () => O("body-profile"),
|
|
@@ -18153,7 +18153,7 @@ function Pi({
|
|
|
18153
18153
|
return /* @__PURE__ */ A("div", { className: "ps-tryon-view-enter", children: /* @__PURE__ */ A(
|
|
18154
18154
|
Dr,
|
|
18155
18155
|
{
|
|
18156
|
-
measurementType:
|
|
18156
|
+
measurementType: so(r),
|
|
18157
18157
|
apiUrl: je(s),
|
|
18158
18158
|
apiKey: Re(),
|
|
18159
18159
|
onBack: () => O("no-chart"),
|
|
@@ -18167,7 +18167,7 @@ function Pi({
|
|
|
18167
18167
|
return null;
|
|
18168
18168
|
}
|
|
18169
18169
|
}
|
|
18170
|
-
return /* @__PURE__ */ e("div", { className: Ye("ps-tryon-root", L.root || Y), style: { visibility: MA ? "visible" : "hidden", ...
|
|
18170
|
+
return /* @__PURE__ */ e("div", { className: Ye("ps-tryon-root", L.root || Y), style: { visibility: MA ? "visible" : "hidden", ...yg, ...h }, suppressHydrationWarning: !0, "data-ps-tryon": !0, children: [
|
|
18171
18171
|
/* @__PURE__ */ e(
|
|
18172
18172
|
"button",
|
|
18173
18173
|
{
|
|
@@ -18177,22 +18177,22 @@ function Pi({
|
|
|
18177
18177
|
className: Ye("ps-tryon-btn", L.button),
|
|
18178
18178
|
type: "button",
|
|
18179
18179
|
children: [
|
|
18180
|
-
D !== !1 && (d || /* @__PURE__ */ A(
|
|
18180
|
+
D !== !1 && (d || /* @__PURE__ */ A(oo, {})),
|
|
18181
18181
|
/* @__PURE__ */ A("span", { children: zA })
|
|
18182
18182
|
]
|
|
18183
18183
|
}
|
|
18184
18184
|
),
|
|
18185
18185
|
gA !== "idle" && typeof document < "u" && hg(
|
|
18186
|
-
/* @__PURE__ */ A("div", { className: Ye("ps-tryon-overlay", L.overlay), style:
|
|
18186
|
+
/* @__PURE__ */ A("div", { className: Ye("ps-tryon-overlay", L.overlay), style: yg, "data-ps-tryon-portal": !0, children: /* @__PURE__ */ e("div", { className: Ye(`ps-tryon-modal${gA === "result" && iA && CA || gA === "size-result" || gA === "estimation-review" || gA === "body-profile" || gA === "profiles" || gA === "no-chart" || gA === "photo-guide" ? " ps-tryon-modal-wide" : ""}`, L.modal), onClick: (B) => B.stopPropagation(), children: [
|
|
18187
18187
|
/* @__PURE__ */ e("div", { className: Ye("ps-tryon-header ps-tryon-header-minimal", L.header), children: [
|
|
18188
18188
|
/* @__PURE__ */ A(Kn, { activeLocale: K, onSelect: wA }),
|
|
18189
18189
|
/* @__PURE__ */ A("button", { className: "ps-tryon-header-icon", title: T("Profiles"), onClick: () => {
|
|
18190
18190
|
YA && f(null), gA === "profiles" ? (O(bA.current || "body-profile"), bA.current = null) : (bA.current = gA, O("profiles"));
|
|
18191
|
-
}, children: /* @__PURE__ */ A(
|
|
18191
|
+
}, children: /* @__PURE__ */ A(mg, {}) }),
|
|
18192
18192
|
/* @__PURE__ */ A("button", { className: "ps-tryon-header-icon", title: T("History"), onClick: () => {
|
|
18193
18193
|
gA === "profiles" && (O(bA.current || "body-profile"), bA.current = null), YA === "history" ? f(null) : (bA.current = bA.current || gA, f("history"));
|
|
18194
18194
|
}, children: /* @__PURE__ */ A(Gn, {}) }),
|
|
18195
|
-
/* @__PURE__ */ A("button", { onClick:
|
|
18195
|
+
/* @__PURE__ */ A("button", { onClick: no, className: Ye("ps-tryon-close", L.closeButton), children: /* @__PURE__ */ A(at, {}) })
|
|
18196
18196
|
] }),
|
|
18197
18197
|
gA !== "body-profile" && gA !== "processing" && !(gA === "size-result" && V?.sections && Object.keys(V.sections).length > 1) && /* @__PURE__ */ A(Jn, { view: gA, stepIndex: ut }),
|
|
18198
18198
|
/* @__PURE__ */ e("div", { ref: _e, className: Ye("ps-tryon-body", L.body), style: { position: "relative", overflow: YA ? "hidden" : void 0 }, children: [
|
|
@@ -18224,7 +18224,7 @@ function Pi({
|
|
|
18224
18224
|
{
|
|
18225
18225
|
onConfirm: () => {
|
|
18226
18226
|
const B = tA, p = Je("profiles", []).filter((G) => G.id !== B);
|
|
18227
|
-
|
|
18227
|
+
ao("profiles", p), Qe(p), H === B && EA(null), ee(null);
|
|
18228
18228
|
},
|
|
18229
18229
|
onCancel: () => ee(null),
|
|
18230
18230
|
t: T
|
|
@@ -18289,13 +18289,13 @@ function Fi(o) {
|
|
|
18289
18289
|
export {
|
|
18290
18290
|
yi as PrimeStyleTryon,
|
|
18291
18291
|
rt as addSizeToHistory,
|
|
18292
|
-
|
|
18292
|
+
Og as estimateFullMeasurements,
|
|
18293
18293
|
In as getActiveProfile,
|
|
18294
18294
|
tt as getActiveProfileId,
|
|
18295
18295
|
un as getCachedSize,
|
|
18296
18296
|
Ig as getProfiles,
|
|
18297
18297
|
it as recommendForProduct,
|
|
18298
|
-
|
|
18298
|
+
ug as saveProfiles,
|
|
18299
18299
|
En as setActiveProfileId,
|
|
18300
18300
|
nt as updateProfile,
|
|
18301
18301
|
Bg as updateProfileMeasurements,
|