@primestyleai/tryon 5.10.128 → 5.10.130
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 +379 -357
- package/dist/react/index.js.map +1 -1
- package/dist/storefront/primestyle-tryon.js +23 -2
- package/package.json +1 -1
package/dist/react/index.js
CHANGED
|
@@ -9333,7 +9333,7 @@ function nr({
|
|
|
9333
9333
|
/* @__PURE__ */ A("span", { className: "ps-msr-match-label", children: h("FIT MATCH") })
|
|
9334
9334
|
] }) }),
|
|
9335
9335
|
/* @__PURE__ */ A("div", { className: "ps-msr-sections", children: a.map(({ name: i, secResult: b }) => {
|
|
9336
|
-
const v = i.replace(/\s*[—–-]\s*.*/g, ""), F = b, z = c?.[i], K = !!z, wA = F.found === !1 ? h("No fit") : K ? z.displayLabel : F.size || b.recommendedSize,
|
|
9336
|
+
const v = i.replace(/\s*[—–-]\s*.*/g, ""), F = b, z = c?.[i], K = !!z, wA = F.found === !1 ? h("No fit") : K ? z.displayLabel : F.size || b.recommendedSize, T = r?.sectionImages?.[i], zA = or(i), MA = T || zA || null;
|
|
9337
9337
|
return /* @__PURE__ */ e(
|
|
9338
9338
|
"button",
|
|
9339
9339
|
{
|
|
@@ -9728,7 +9728,7 @@ function Fo({ lines: o, fitRows: g, show: t, imgWidth: r, imgHeight: a }) {
|
|
|
9728
9728
|
const Z = Y.x1 * w, i = Y.x2 * w, b = Y.y * s, v = i - Z, F = v * 0.06, z = (Z + i) / 2, K = g.find((RA) => {
|
|
9729
9729
|
const mA = RA.area.toLowerCase().trim();
|
|
9730
9730
|
return !!(mA === L || L === "chest" && (mA.includes("bust") || mA.includes("chest")) || L === "waist" && mA.includes("waist") || L === "hips" && (mA.includes("hip") || mA === "hips"));
|
|
9731
|
-
}), wA = K ? c(K.fit) : "#2154EF",
|
|
9731
|
+
}), wA = K ? c(K.fit) : "#2154EF", T = C * 0.35, zA = `M ${Z} ${b} Q ${z} ${b + F} ${i} ${b}`, MA = v * 1.05, E = K ? K.fit === "good" ? "✓ Fit" : K.isLength ? K.fit.includes("short") || K.fit.includes("tight") ? "Short" : "Long" : K.fit.includes("tight") ? "Tight" : "Loose" : h, gA = Math.round(14 * M), O = E.length * gA * 0.62, X = w - i - 12 * M < O, rA = X ? Z - 10 * M : i + 10 * M, uA = X ? "end" : "start", iA = X ? Z : i, yA = X ? Z - 6 * M : i + 6 * M;
|
|
9732
9732
|
return /* @__PURE__ */ e("g", { children: [
|
|
9733
9733
|
/* @__PURE__ */ A(
|
|
9734
9734
|
"path",
|
|
@@ -9740,7 +9740,7 @@ function Fo({ lines: o, fitRows: g, show: t, imgWidth: r, imgHeight: a }) {
|
|
|
9740
9740
|
strokeLinecap: "round",
|
|
9741
9741
|
strokeDasharray: MA,
|
|
9742
9742
|
strokeDashoffset: MA,
|
|
9743
|
-
style: { animation: `ps-pose-draw 0.7s ease-out ${
|
|
9743
|
+
style: { animation: `ps-pose-draw 0.7s ease-out ${T}s forwards` }
|
|
9744
9744
|
}
|
|
9745
9745
|
),
|
|
9746
9746
|
/* @__PURE__ */ A(
|
|
@@ -9751,7 +9751,7 @@ function Fo({ lines: o, fitRows: g, show: t, imgWidth: r, imgHeight: a }) {
|
|
|
9751
9751
|
r: m,
|
|
9752
9752
|
fill: wA,
|
|
9753
9753
|
opacity: "0",
|
|
9754
|
-
style: { animation: `ps-pose-fade 0.3s ease ${
|
|
9754
|
+
style: { animation: `ps-pose-fade 0.3s ease ${T + 0.5}s forwards` }
|
|
9755
9755
|
}
|
|
9756
9756
|
),
|
|
9757
9757
|
/* @__PURE__ */ A(
|
|
@@ -9762,10 +9762,10 @@ function Fo({ lines: o, fitRows: g, show: t, imgWidth: r, imgHeight: a }) {
|
|
|
9762
9762
|
r: m,
|
|
9763
9763
|
fill: wA,
|
|
9764
9764
|
opacity: "0",
|
|
9765
|
-
style: { animation: `ps-pose-fade 0.3s ease ${
|
|
9765
|
+
style: { animation: `ps-pose-fade 0.3s ease ${T + 0.5}s forwards` }
|
|
9766
9766
|
}
|
|
9767
9767
|
),
|
|
9768
|
-
/* @__PURE__ */ e("g", { opacity: "0", style: { animation: `ps-pose-fade 0.4s ease ${
|
|
9768
|
+
/* @__PURE__ */ e("g", { opacity: "0", style: { animation: `ps-pose-fade 0.4s ease ${T + 0.6}s forwards` }, children: [
|
|
9769
9769
|
/* @__PURE__ */ A(
|
|
9770
9770
|
"line",
|
|
9771
9771
|
{
|
|
@@ -9783,7 +9783,7 @@ function Fo({ lines: o, fitRows: g, show: t, imgWidth: r, imgHeight: a }) {
|
|
|
9783
9783
|
x: rA,
|
|
9784
9784
|
y: b + 1 * M,
|
|
9785
9785
|
fill: wA,
|
|
9786
|
-
fontSize:
|
|
9786
|
+
fontSize: gA,
|
|
9787
9787
|
fontWeight: "700",
|
|
9788
9788
|
fontFamily: "system-ui, -apple-system, sans-serif",
|
|
9789
9789
|
dominantBaseline: "middle",
|
|
@@ -9863,7 +9863,7 @@ function qo({
|
|
|
9863
9863
|
sectionFound: F,
|
|
9864
9864
|
allSizes: z
|
|
9865
9865
|
}) {
|
|
9866
|
-
const K = t?.recommendedSize || "", [wA,
|
|
9866
|
+
const K = t?.recommendedSize || "", [wA, T] = Q(null), zA = qn(W ?? null), MA = a.toLowerCase(), E = MA.includes("mm") ? "mm" : MA.includes("cm") ? "cm" : "in", gA = c || E, O = (x) => Ct(x, gA, E), fA = (x) => pr(x, gA, E), X = (x) => {
|
|
9867
9867
|
const q = fA(x);
|
|
9868
9868
|
return /^\d+(?:\.\d+)?(?:\s*[-–]\s*\d+(?:\.\d+)?)?$/.test(q.trim()) ? `${q} ${a}` : q;
|
|
9869
9869
|
}, rA = i ? Object.keys(i) : [], [uA, iA] = Q(null), yA = n?.secResult?.recommendedSize || "", [RA, mA] = Q(null), we = xe(() => {
|
|
@@ -10198,7 +10198,7 @@ function qo({
|
|
|
10198
10198
|
" ",
|
|
10199
10199
|
fe
|
|
10200
10200
|
] }),
|
|
10201
|
-
/* @__PURE__ */ A("span", { className: "ps-msd-cell-value", children: v ? S.rawChartRange || "" :
|
|
10201
|
+
/* @__PURE__ */ A("span", { className: "ps-msd-cell-value", children: v ? S.rawChartRange || "" : X(S.chartLabel) })
|
|
10202
10202
|
] })
|
|
10203
10203
|
] }),
|
|
10204
10204
|
/* @__PURE__ */ e("div", { className: `ps-msd-row-badge ${Be}`, children: [
|
|
@@ -10215,7 +10215,7 @@ function qo({
|
|
|
10215
10215
|
{
|
|
10216
10216
|
type: "button",
|
|
10217
10217
|
className: `ps-msd-size-pill${S === fe ? " ps-active" : ""}`,
|
|
10218
|
-
onClick: () =>
|
|
10218
|
+
onClick: () => T(S === K ? null : S),
|
|
10219
10219
|
children: S
|
|
10220
10220
|
},
|
|
10221
10221
|
S
|
|
@@ -10427,7 +10427,7 @@ function qo({
|
|
|
10427
10427
|
return /* @__PURE__ */ e("tr", { style: { borderBottom: q < ve.length - 1 ? "1px solid rgba(0,0,0,0.04)" : "none" }, children: [
|
|
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
|
-
/* @__PURE__ */ A("td", { style: { padding: "0.55vw 0.6vw", fontSize: "0.75vw", color: "var(--ps-text-secondary)" }, children: v ? x.rawChartRange || "" :
|
|
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
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 ? Ng(x.fit, s) : lr(x.fit, s) }) })
|
|
10432
10432
|
] }, q);
|
|
10433
10433
|
}) })
|
|
@@ -10445,7 +10445,7 @@ function qo({
|
|
|
10445
10445
|
return /* @__PURE__ */ A(
|
|
10446
10446
|
"button",
|
|
10447
10447
|
{
|
|
10448
|
-
onClick: () =>
|
|
10448
|
+
onClick: () => T(x === K ? null : x),
|
|
10449
10449
|
style: {
|
|
10450
10450
|
padding: "0.35vw 0.7vw",
|
|
10451
10451
|
borderRadius: "0.35vw",
|
|
@@ -10598,12 +10598,12 @@ function Cr({
|
|
|
10598
10598
|
onResetTryOn: z,
|
|
10599
10599
|
onClose: K,
|
|
10600
10600
|
userHeightCm: wA,
|
|
10601
|
-
pendingCustomSizes:
|
|
10601
|
+
pendingCustomSizes: T,
|
|
10602
10602
|
onPendingCustomSizeChange: zA,
|
|
10603
10603
|
tryOnAvailable: MA = !0,
|
|
10604
10604
|
t: E
|
|
10605
10605
|
}) {
|
|
10606
|
-
const
|
|
10606
|
+
const gA = (g?.unit || l || "").toString().toLowerCase(), O = gA === "mm" ? "mm" : gA === "cm" ? "cm" : "in", fA = E(O === "mm" ? "mm" : l === "cm" ? "cm" : "in"), [X, rA] = Q({}), uA = pt, iA = IA((P, H, N) => Te(P, H, N), []), yA = xe(() => {
|
|
10607
10607
|
if (!t?.headers || !t?.rows) return -1;
|
|
10608
10608
|
const P = t.headers.findIndex((H) => /size|taglia|größe|taille/i.test(H.trim()));
|
|
10609
10609
|
if (P >= 0) return P;
|
|
@@ -10629,13 +10629,13 @@ function Cr({
|
|
|
10629
10629
|
}
|
|
10630
10630
|
let J = null;
|
|
10631
10631
|
for (const _ of t.rows) {
|
|
10632
|
-
const
|
|
10633
|
-
if (
|
|
10634
|
-
if (/cm\b|centimeter/i.test(
|
|
10632
|
+
const tA = String(iA(_, H, t.headers[H]) || "").trim();
|
|
10633
|
+
if (tA) {
|
|
10634
|
+
if (/cm\b|centimeter/i.test(tA)) {
|
|
10635
10635
|
J = "cm";
|
|
10636
10636
|
break;
|
|
10637
10637
|
}
|
|
10638
|
-
if (/in\b|inch|"$/i.test(
|
|
10638
|
+
if (/in\b|inch|"$/i.test(tA)) {
|
|
10639
10639
|
J = "in";
|
|
10640
10640
|
break;
|
|
10641
10641
|
}
|
|
@@ -10646,36 +10646,36 @@ function Cr({
|
|
|
10646
10646
|
return P;
|
|
10647
10647
|
}, [t, iA]), we = IA((P, H) => {
|
|
10648
10648
|
if (!t?.headers || !t?.rows || yA < 0) return null;
|
|
10649
|
-
const N = P.toLowerCase().trim(), J = fA === "cm" || fA === "", _ = J ? "cm" : "in",
|
|
10650
|
-
for (let
|
|
10651
|
-
const dA = (t.headers[
|
|
10649
|
+
const N = P.toLowerCase().trim(), J = fA === "cm" || fA === "", _ = J ? "cm" : "in", tA = [];
|
|
10650
|
+
for (let j = 0; j < t.headers.length; j++) {
|
|
10651
|
+
const dA = (t.headers[j] || "").toLowerCase().trim();
|
|
10652
10652
|
if (dA === N) {
|
|
10653
|
-
|
|
10653
|
+
tA.push(j);
|
|
10654
10654
|
continue;
|
|
10655
10655
|
}
|
|
10656
10656
|
const bA = dA.replace(/\s*\(.*?\)\s*/g, "").trim();
|
|
10657
|
-
(bA === N || dA.includes(N) || N.includes(bA)) &&
|
|
10657
|
+
(bA === N || dA.includes(N) || N.includes(bA)) && tA.push(j);
|
|
10658
10658
|
}
|
|
10659
|
-
if (
|
|
10660
|
-
let ee =
|
|
10661
|
-
ee == null && (ee =
|
|
10662
|
-
const EA = t.headers[ee], ce = t.rows.find((
|
|
10659
|
+
if (tA.length === 0) return null;
|
|
10660
|
+
let ee = tA.find((j) => mA[j] === _);
|
|
10661
|
+
ee == null && (ee = tA[0]);
|
|
10662
|
+
const EA = t.headers[ee], ce = t.rows.find((j) => iA(j, yA, RA) === H);
|
|
10663
10663
|
if (!ce) return null;
|
|
10664
10664
|
const he = iA(ce, ee, EA);
|
|
10665
10665
|
if (!he) return null;
|
|
10666
10666
|
const YA = uA(he), f = mA[ee];
|
|
10667
10667
|
if (f === "in" && J) {
|
|
10668
|
-
const
|
|
10669
|
-
return { range: String(
|
|
10668
|
+
const j = (dA) => +(dA * 2.54).toFixed(1);
|
|
10669
|
+
return { range: String(j(YA.min)) + (YA.min !== YA.max ? "–" + String(j(YA.max)) : ""), min: j(YA.min), max: j(YA.max) };
|
|
10670
10670
|
}
|
|
10671
10671
|
if (f === "cm" && !J) {
|
|
10672
|
-
const
|
|
10673
|
-
return { range: String(
|
|
10672
|
+
const j = (dA) => +(dA / 2.54).toFixed(1);
|
|
10673
|
+
return { range: String(j(YA.min)) + (YA.min !== YA.max ? "–" + String(j(YA.max)) : ""), min: j(YA.min), max: j(YA.max) };
|
|
10674
10674
|
}
|
|
10675
10675
|
return { range: he, ...YA };
|
|
10676
10676
|
}, [t, yA, RA, fA, iA, uA, mA]), $A = g?.recommendedSize || "";
|
|
10677
10677
|
xe(() => g?.internationalSizes || {}, [g]);
|
|
10678
|
-
const [PA, te] = Q("fit"), [qA, fe] = Q(null), [vA, ue] = Q(!1), [$, Pe] = Q(!1), [ve, Fe] = Q(!1), [ne, le] = Q(null), [CA, _A] = Q(!1), [TA, y] = Q({ w: 800, h: 1200 }), GA =
|
|
10678
|
+
const [PA, te] = Q("fit"), [qA, fe] = Q(null), [vA, ue] = Q(!1), [$, Pe] = Q(!1), [ve, Fe] = Q(!1), [ne, le] = Q(null), [CA, _A] = Q(!1), [TA, y] = Q({ w: 800, h: 1200 }), GA = T ?? {}, Ee = IA((P) => {
|
|
10679
10679
|
const H = P.currentTarget;
|
|
10680
10680
|
H.naturalWidth && H.naturalHeight && y({ w: H.naturalWidth, h: H.naturalHeight });
|
|
10681
10681
|
}, []);
|
|
@@ -10709,23 +10709,23 @@ function Cr({
|
|
|
10709
10709
|
return P.has(J) ? !1 : (P.add(J), !0);
|
|
10710
10710
|
}).map((N) => {
|
|
10711
10711
|
const J = Ze(N.userValue);
|
|
10712
|
-
let _ = N.chartRange,
|
|
10712
|
+
let _ = N.chartRange, tA = N.fit;
|
|
10713
10713
|
if (LA !== $A) {
|
|
10714
10714
|
const ee = we(N.measurement, LA);
|
|
10715
10715
|
if (ee && ee.min > 0) {
|
|
10716
10716
|
_ = Qg(ee.range);
|
|
10717
10717
|
const EA = ee.min, ce = ee.max, he = ce - EA, YA = he > 0 ? he * 0.5 : EA * 0.05 || 3, f = Math.max((ce || EA) * 5e-3, 0.25);
|
|
10718
|
-
if (J >= EA - f && J <= ce + f)
|
|
10718
|
+
if (J >= EA - f && J <= ce + f) tA = "good";
|
|
10719
10719
|
else if (J < EA) {
|
|
10720
|
-
const
|
|
10721
|
-
|
|
10720
|
+
const j = EA - J;
|
|
10721
|
+
tA = j > YA * 2 ? "too-loose" : j > YA ? "loose" : "a-bit-loose";
|
|
10722
10722
|
} else {
|
|
10723
|
-
const
|
|
10724
|
-
|
|
10723
|
+
const j = J - ce;
|
|
10724
|
+
tA = j > YA * 2 ? "too-tight" : j > YA ? "tight" : "a-bit-tight";
|
|
10725
10725
|
}
|
|
10726
10726
|
}
|
|
10727
10727
|
}
|
|
10728
|
-
return { area: N.measurement, userNum: Ze(N.userValue), chartLabel: _, fit:
|
|
10728
|
+
return { area: N.measurement, userNum: Ze(N.userValue), chartLabel: _, fit: tA };
|
|
10729
10729
|
});
|
|
10730
10730
|
}, [g, LA, $A, we]), xe(() => {
|
|
10731
10731
|
if (!t?.headers || !t?.rows || yA < 0) return null;
|
|
@@ -10746,8 +10746,8 @@ function Cr({
|
|
|
10746
10746
|
for (const J of N) {
|
|
10747
10747
|
const _ = J.measurement.toLowerCase();
|
|
10748
10748
|
if (P[_] == null) {
|
|
10749
|
-
const
|
|
10750
|
-
|
|
10749
|
+
const tA = Ze(J.userValue);
|
|
10750
|
+
tA > 0 && (P[_] = tA);
|
|
10751
10751
|
}
|
|
10752
10752
|
}
|
|
10753
10753
|
};
|
|
@@ -10755,30 +10755,30 @@ function Cr({
|
|
|
10755
10755
|
for (const N of Object.values(g.sections)) H(N.matchDetails);
|
|
10756
10756
|
return wA && wA > 0 && P.height == null && (P.height = wA), g?.sections && Object.keys(g.sections).length > 0 ? Object.entries(g.sections).map(([N, J]) => {
|
|
10757
10757
|
const _ = N.toLowerCase();
|
|
10758
|
-
let
|
|
10759
|
-
if (!
|
|
10758
|
+
let tA = t?.sections?.[N];
|
|
10759
|
+
if (!tA && t?.sections) {
|
|
10760
10760
|
const EA = Object.entries(t.sections).find(([ce]) => {
|
|
10761
10761
|
const he = ce.toLowerCase(), YA = he.replace(/\s*(size|sizing)\s*/gi, "").trim();
|
|
10762
10762
|
return YA ? _ === he || _.includes(YA) || YA.includes(_) : !1;
|
|
10763
10763
|
});
|
|
10764
|
-
EA && (
|
|
10764
|
+
EA && (tA = EA[1]);
|
|
10765
10765
|
}
|
|
10766
|
-
|
|
10766
|
+
tA || (tA = { headers: [], rows: [], requiredFields: [] });
|
|
10767
10767
|
const ee = { ...P };
|
|
10768
10768
|
if (J.matchDetails)
|
|
10769
10769
|
for (const EA of J.matchDetails) {
|
|
10770
10770
|
const ce = Ze(EA.userValue);
|
|
10771
10771
|
ce > 0 && (ee[EA.measurement.toLowerCase()] = ce);
|
|
10772
10772
|
}
|
|
10773
|
-
return { name: N, section:
|
|
10773
|
+
return { name: N, section: tA, secResult: J, userMeasurements: ee };
|
|
10774
10774
|
}) : !Ce || !t?.sections ? [] : Object.entries(t.sections).map(([N, J]) => {
|
|
10775
|
-
const _ = g?.sections?.[N] || { recommendedSize: g?.recommendedSize || "", matchDetails: [] },
|
|
10775
|
+
const _ = g?.sections?.[N] || { recommendedSize: g?.recommendedSize || "", matchDetails: [] }, tA = { ...P };
|
|
10776
10776
|
if (_.matchDetails)
|
|
10777
10777
|
for (const ee of _.matchDetails) {
|
|
10778
10778
|
const EA = Ze(ee.userValue);
|
|
10779
|
-
EA > 0 && (
|
|
10779
|
+
EA > 0 && (tA[ee.measurement.toLowerCase()] = EA);
|
|
10780
10780
|
}
|
|
10781
|
-
return { name: N, section: J, secResult: _, userMeasurements:
|
|
10781
|
+
return { name: N, section: J, secResult: _, userMeasurements: tA };
|
|
10782
10782
|
});
|
|
10783
10783
|
}, [Ce, t, g, wA]), lA = xe(() => FA.filter((P) => !Ug(P.name)), [FA]), I = xe(() => FA.filter((P) => Ug(P.name)), [FA]), kA = IA((P, H) => {
|
|
10784
10784
|
if (!H) return H;
|
|
@@ -11076,8 +11076,8 @@ function Cr({
|
|
|
11076
11076
|
SA,
|
|
11077
11077
|
/* @__PURE__ */ A("div", { className: "ps-tryon-v2-sep" }),
|
|
11078
11078
|
/* @__PURE__ */ A("div", { className: "ps-tryon-sr-cards-v2", children: lA.map(({ name: P, secResult: H }, N) => {
|
|
11079
|
-
const J = t?.sectionImages?.[P], _ = sr(P),
|
|
11080
|
-
return /* @__PURE__ */ e("button", { className: `ps-tryon-sr-card-v2${
|
|
11079
|
+
const J = t?.sectionImages?.[P], _ = sr(P), tA = N === lA.length - 1 && lA.length % 2 !== 0, ee = H, EA = GA[P], ce = !!EA, he = ce ? EA.displayLabel : kA(P, ee.size || H.recommendedSize || "");
|
|
11080
|
+
return /* @__PURE__ */ e("button", { className: `ps-tryon-sr-card-v2${tA ? " ps-full" : ""}${ce ? " ps-overridden" : ""}`, onClick: () => F(P), style: { animationDelay: `${N * 0.07}s` }, children: [
|
|
11081
11081
|
/* @__PURE__ */ e("div", { className: "ps-tryon-sr-card-v2-text", children: [
|
|
11082
11082
|
/* @__PURE__ */ e("span", { className: "ps-tryon-sr-card-v2-label", children: [
|
|
11083
11083
|
_ && /* @__PURE__ */ A("img", { src: _, alt: "", className: "ps-tryon-sr-card-v2-label-icon" }),
|
|
@@ -11158,7 +11158,7 @@ function Cr({
|
|
|
11158
11158
|
(() => {
|
|
11159
11159
|
const P = t?.found ? { headers: t.headers || [], rows: t.rows || [], requiredFields: t.requiredFields || [] } : { headers: [], rows: [], requiredFields: [] }, H = { recommendedSize: g?.recommendedSize || "", matchDetails: g?.matchDetails || [] }, N = {};
|
|
11160
11160
|
if (g?.matchDetails)
|
|
11161
|
-
for (const
|
|
11161
|
+
for (const tA of g.matchDetails) N[tA.measurement.toLowerCase()] = Ze(tA.userValue);
|
|
11162
11162
|
const J = E("Your Fit"), _ = () => {
|
|
11163
11163
|
r || (q(u || null), ae(!0));
|
|
11164
11164
|
};
|
|
@@ -11197,7 +11197,7 @@ function Cr({
|
|
|
11197
11197
|
Fo,
|
|
11198
11198
|
{
|
|
11199
11199
|
lines: ne,
|
|
11200
|
-
fitRows: (g?.matchDetails || []).map((
|
|
11200
|
+
fitRows: (g?.matchDetails || []).map((tA) => ({ area: tA.measurement, userNum: parseFloat(tA.userValue) || 0, chartLabel: tA.chartRange || "", fit: tA.fit })),
|
|
11201
11201
|
show: $,
|
|
11202
11202
|
imgWidth: TA.w,
|
|
11203
11203
|
imgHeight: TA.h
|
|
@@ -11219,7 +11219,7 @@ function Cr({
|
|
|
11219
11219
|
),
|
|
11220
11220
|
h && /* @__PURE__ */ A(Wo, { tryOnStartedAt: C ?? null, t: E }),
|
|
11221
11221
|
/* @__PURE__ */ A(Vo, { active: !!h }),
|
|
11222
|
-
r && !h && CA && ne && /* @__PURE__ */ A(Fo, { lines: ne, fitRows: (g?.matchDetails || []).map((
|
|
11222
|
+
r && !h && CA && ne && /* @__PURE__ */ A(Fo, { lines: ne, fitRows: (g?.matchDetails || []).map((tA) => ({ area: tA.measurement, userNum: parseFloat(tA.userValue) || 0, chartLabel: tA.chartRange || "", fit: tA.fit })), show: $, imgWidth: TA.w, imgHeight: TA.h }),
|
|
11223
11223
|
r && !h && /* @__PURE__ */ e("div", { style: { position: "absolute", bottom: "0.5vw", left: "0.5vw", zIndex: 3, display: "flex", flexDirection: "column", gap: "0.3vw" }, children: [
|
|
11224
11224
|
!JA && /* @__PURE__ */ A("button", { className: "ps-tryon-sr-glass-btn", onClick: () => Pe(!$), children: E($ ? "Hide Fit" : "Show Fit") }),
|
|
11225
11225
|
/* @__PURE__ */ A("button", { className: "ps-tryon-sr-glass-btn", onClick: d, children: E("Download") })
|
|
@@ -11304,8 +11304,8 @@ function Cr({
|
|
|
11304
11304
|
children: /* @__PURE__ */ e("div", { className: "ps-tryon-sr-card-v2-text", children: [
|
|
11305
11305
|
/* @__PURE__ */ A("span", { className: "ps-tryon-sr-card-v2-label", children: J }),
|
|
11306
11306
|
(() => {
|
|
11307
|
-
const
|
|
11308
|
-
return /* @__PURE__ */ A("span", { className: `ps-tryon-sr-card-v2-value${ee ? " ps-long" : ""}`, children:
|
|
11307
|
+
const tA = GA[J]?.displayLabel || H.recommendedSize || "—", ee = tA.length > 12;
|
|
11308
|
+
return /* @__PURE__ */ A("span", { className: `ps-tryon-sr-card-v2-value${ee ? " ps-long" : ""}`, children: tA });
|
|
11309
11309
|
})(),
|
|
11310
11310
|
/* @__PURE__ */ A(
|
|
11311
11311
|
"span",
|
|
@@ -11623,7 +11623,7 @@ function Cr({
|
|
|
11623
11623
|
/* @__PURE__ */ A("button", { className: "ps-tryon-sr-chart-close", onClick: () => ue(!1), children: "✕" })
|
|
11624
11624
|
] }),
|
|
11625
11625
|
/* @__PURE__ */ A("div", { className: "ps-tryon-sr-chart-scroll", children: t.sections && Object.keys(t.sections).length > 1 ? Object.entries(t.sections).map(([P, H]) => {
|
|
11626
|
-
const J = g?.sections?.[P]?.recommendedSize || "", _ = H.headers.findIndex((EA) => /size|taglia|größe|taille|fit|length/i.test(EA.trim())),
|
|
11626
|
+
const J = g?.sections?.[P]?.recommendedSize || "", _ = H.headers.findIndex((EA) => /size|taglia|größe|taille|fit|length/i.test(EA.trim())), tA = _ >= 0 ? _ : 0, ee = H.headers[tA] || "Size";
|
|
11627
11627
|
return /* @__PURE__ */ e("div", { className: "ps-tryon-chart-section", children: [
|
|
11628
11628
|
/* @__PURE__ */ e("div", { className: "ps-tryon-chart-section-title", children: [
|
|
11629
11629
|
/* @__PURE__ */ A("span", { children: P }),
|
|
@@ -11634,10 +11634,10 @@ function Cr({
|
|
|
11634
11634
|
] })
|
|
11635
11635
|
] }),
|
|
11636
11636
|
/* @__PURE__ */ A("div", { className: "ps-tryon-sr-chart-table-wrap", children: /* @__PURE__ */ e("table", { className: "ps-tryon-sr-chart-table", children: [
|
|
11637
|
-
/* @__PURE__ */ A("thead", { children: /* @__PURE__ */ A("tr", { children: H.headers.map((EA, ce) => /* @__PURE__ */ A("th", { className: ce ===
|
|
11637
|
+
/* @__PURE__ */ A("thead", { children: /* @__PURE__ */ A("tr", { children: H.headers.map((EA, ce) => /* @__PURE__ */ A("th", { className: ce === tA ? "ps-size-col" : "", children: EA }, ce)) }) }),
|
|
11638
11638
|
/* @__PURE__ */ A("tbody", { children: H.rows.map((EA, ce) => {
|
|
11639
|
-
const YA = Te(EA,
|
|
11640
|
-
return /* @__PURE__ */ A("tr", { className: YA ? "ps-active-row" : "", children: H.headers.map((f,
|
|
11639
|
+
const YA = Te(EA, tA, ee) === J;
|
|
11640
|
+
return /* @__PURE__ */ A("tr", { className: YA ? "ps-active-row" : "", children: H.headers.map((f, j) => /* @__PURE__ */ A("td", { className: j === tA ? "ps-size-col" : "", children: Te(EA, j, f) }, j)) }, ce);
|
|
11641
11641
|
}) })
|
|
11642
11642
|
] }) })
|
|
11643
11643
|
] }, P);
|
|
@@ -11647,7 +11647,7 @@ function Cr({
|
|
|
11647
11647
|
/* @__PURE__ */ A("thead", { children: /* @__PURE__ */ A("tr", { children: t.headers.map((P, H) => /* @__PURE__ */ A("th", { className: H === yA ? "ps-size-col" : "", children: P }, H)) }) }),
|
|
11648
11648
|
/* @__PURE__ */ A("tbody", { children: t.rows.map((P, H) => {
|
|
11649
11649
|
const J = iA(P, yA, RA) === LA;
|
|
11650
|
-
return /* @__PURE__ */ A("tr", { className: J ? "ps-active-row" : "", children: t.headers.map((_,
|
|
11650
|
+
return /* @__PURE__ */ A("tr", { className: J ? "ps-active-row" : "", children: t.headers.map((_, tA) => /* @__PURE__ */ A("td", { className: tA === yA ? "ps-size-col" : "", children: iA(P, tA, _) }, tA)) }, H);
|
|
11651
11651
|
}) })
|
|
11652
11652
|
] }) })
|
|
11653
11653
|
) : null })
|
|
@@ -11750,8 +11750,8 @@ function Jg({
|
|
|
11750
11750
|
try {
|
|
11751
11751
|
const fA = await eg(O, o, g);
|
|
11752
11752
|
if (!fA.isAdult) {
|
|
11753
|
-
const
|
|
11754
|
-
i(
|
|
11753
|
+
const X = fA.reasoning?.trim() || d("This photo appears to be of a minor. Please upload a photo of someone 18 or older.");
|
|
11754
|
+
i(X), h(!1), W("");
|
|
11755
11755
|
return;
|
|
11756
11756
|
}
|
|
11757
11757
|
try {
|
|
@@ -11771,7 +11771,7 @@ function Jg({
|
|
|
11771
11771
|
O.preventDefault(), O.stopPropagation(), !(c || Y) && (m.current += 1, L(!0));
|
|
11772
11772
|
}, wA = (O) => {
|
|
11773
11773
|
O.preventDefault(), O.stopPropagation(), O.dataTransfer && (O.dataTransfer.dropEffect = "copy");
|
|
11774
|
-
},
|
|
11774
|
+
}, T = (O) => {
|
|
11775
11775
|
O.preventDefault(), O.stopPropagation(), m.current = Math.max(0, m.current - 1), m.current === 0 && L(!1);
|
|
11776
11776
|
}, zA = (O) => {
|
|
11777
11777
|
if (O.preventDefault(), O.stopPropagation(), m.current = 0, L(!1), c || Y) return;
|
|
@@ -11790,7 +11790,7 @@ function Jg({
|
|
|
11790
11790
|
onClick: t ? void 0 : z,
|
|
11791
11791
|
onDragEnter: K,
|
|
11792
11792
|
onDragOver: wA,
|
|
11793
|
-
onDragLeave:
|
|
11793
|
+
onDragLeave: T,
|
|
11794
11794
|
onDrop: zA,
|
|
11795
11795
|
children: [
|
|
11796
11796
|
/* @__PURE__ */ A(
|
|
@@ -12332,41 +12332,41 @@ function Jr({ onSave: o, onCancel: g, apiUrl: t, apiKey: r, onPhotoPreview: a, o
|
|
|
12332
12332
|
HA(() => {
|
|
12333
12333
|
h.current && (h.current.scrollTop = 0);
|
|
12334
12334
|
}, [w, l]);
|
|
12335
|
-
const [C, W] = Q(""), [Z, i] = Q("male"), [b, v] = Q("cm"), [F, z] = Q(""), [K, wA] = Q(""), [
|
|
12335
|
+
const [C, W] = Q(""), [Z, i] = Q("male"), [b, v] = Q("cm"), [F, z] = Q(""), [K, wA] = Q(""), [T, zA] = Q(""), [MA, E] = Q(""), [gA, O] = Q(""), [fA, X] = Q(""), [rA, uA] = Q(null), [iA, yA] = Q(!1), [RA, mA] = Q(""), [we, $A] = Q(null), [PA, te] = Q(null), [qA, fe] = Q({ w: 800, h: 1200 }), [vA, ue] = Q(0), [$, Pe] = Q(!1), [ve, Fe] = Q(!1);
|
|
12336
12336
|
HA(() => {
|
|
12337
12337
|
if (d !== "calculating" || !rA) return;
|
|
12338
12338
|
let f = !1;
|
|
12339
|
-
return Bo(rA).then((
|
|
12340
|
-
!f &&
|
|
12339
|
+
return Bo(rA).then((j) => {
|
|
12340
|
+
!f && j && te(j);
|
|
12341
12341
|
}).catch(() => {
|
|
12342
12342
|
}), () => {
|
|
12343
12343
|
f = !0;
|
|
12344
12344
|
};
|
|
12345
12345
|
}, [d, rA]), HA(() => {
|
|
12346
12346
|
if (d !== "calculating" || !m) return;
|
|
12347
|
-
const f = setInterval(() => ue((
|
|
12347
|
+
const f = setInterval(() => ue((j) => j + 1), 1500);
|
|
12348
12348
|
return () => clearInterval(f);
|
|
12349
12349
|
}, [d, m]);
|
|
12350
12350
|
const ne = QA(null), le = QA(null), [CA, _A] = Q(!1), [TA, y] = Q(null), GA = () => {
|
|
12351
12351
|
TA === !0 && ne.current?.click();
|
|
12352
12352
|
}, Ee = async (f) => {
|
|
12353
|
-
const
|
|
12354
|
-
if (
|
|
12353
|
+
const j = f.target.files?.[0];
|
|
12354
|
+
if (j) {
|
|
12355
12355
|
if (TA !== !0) {
|
|
12356
|
-
|
|
12356
|
+
X(n("Please confirm that the person in the photo is 18 or older before uploading."));
|
|
12357
12357
|
return;
|
|
12358
12358
|
}
|
|
12359
|
-
if (!
|
|
12360
|
-
|
|
12359
|
+
if (!j.type.startsWith("image/")) {
|
|
12360
|
+
X(n("Please upload an image file"));
|
|
12361
12361
|
return;
|
|
12362
12362
|
}
|
|
12363
|
-
if (
|
|
12364
|
-
|
|
12363
|
+
if (j.size > 10 * 1024 * 1024) {
|
|
12364
|
+
X(n("Image must be under 10MB"));
|
|
12365
12365
|
return;
|
|
12366
12366
|
}
|
|
12367
|
-
|
|
12367
|
+
X(""), yA(!0), mA(n("Analyzing photo…"));
|
|
12368
12368
|
try {
|
|
12369
|
-
const dA = t && r ? eg(
|
|
12369
|
+
const dA = t && r ? eg(j, t, r) : Promise.resolve({ isAdult: !0, confidence: "low" }), bA = Do(j), oe = await dA;
|
|
12370
12370
|
if (!oe.isAdult) {
|
|
12371
12371
|
const Le = oe.reasoning?.trim() || n("This photo appears to be of a minor. Please upload a photo of someone 18 or older.");
|
|
12372
12372
|
$A(Le);
|
|
@@ -12375,7 +12375,7 @@ function Jr({ onSave: o, onCancel: g, apiUrl: t, apiKey: r, onPhotoPreview: a, o
|
|
|
12375
12375
|
const be = await bA;
|
|
12376
12376
|
uA(be), $A(null), a?.(be);
|
|
12377
12377
|
} catch {
|
|
12378
|
-
|
|
12378
|
+
X(n("Failed to process image"));
|
|
12379
12379
|
} finally {
|
|
12380
12380
|
yA(!1), mA("");
|
|
12381
12381
|
}
|
|
@@ -12385,16 +12385,16 @@ function Jr({ onSave: o, onCancel: g, apiUrl: t, apiKey: r, onPhotoPreview: a, o
|
|
|
12385
12385
|
}, [NA, He] = Q(null), [re, V] = Q(null), [ae, x] = Q(null), [q, XA] = Q(null), [S, pA] = Q(null), [UA, Be] = Q(null), [Ae, pe] = Q("US"), [LA, Ce] = Q(null), FA = QA(null);
|
|
12386
12386
|
HA(() => {
|
|
12387
12387
|
if (!LA) return;
|
|
12388
|
-
const f = (
|
|
12388
|
+
const f = (j) => {
|
|
12389
12389
|
const dA = FA.current;
|
|
12390
|
-
dA && !dA.contains(
|
|
12390
|
+
dA && !dA.contains(j.target) && Ce(null);
|
|
12391
12391
|
};
|
|
12392
12392
|
return document.addEventListener("mousedown", f), () => document.removeEventListener("mousedown", f);
|
|
12393
12393
|
}, [LA]);
|
|
12394
12394
|
const lA = ["28", "30", "32", "34", "36", "38", "40", "42", "44", "46", "48", "50", "52", "54", "56"], I = ["AA", "A", "B", "C", "D", "DD/E", "DDD/F", "G", "H", "I", "J"], kA = Z === "female", oA = kA ? jA.female : jA.male, KA = kA ? ["identity", "stomach", "seat", "hips", "bra"] : ["identity", "chest", "stomach", "seat"], me = KA.indexOf(l), ZA = KA.length, Me = me === ZA - 1, de = () => {
|
|
12395
12395
|
if (b === "in") {
|
|
12396
|
-
const f = parseInt(K, 10),
|
|
12397
|
-
!isNaN(f) && f >= 0 && !isNaN(
|
|
12396
|
+
const f = parseInt(K, 10), j = parseInt(T, 10);
|
|
12397
|
+
!isNaN(f) && f >= 0 && !isNaN(j) && j >= 0 && z(String(Math.round((f * 12 + j) * 2.54)));
|
|
12398
12398
|
}
|
|
12399
12399
|
v("cm");
|
|
12400
12400
|
}, De = () => {
|
|
@@ -12405,21 +12405,24 @@ function Jr({ onSave: o, onCancel: g, apiUrl: t, apiKey: r, onPhotoPreview: a, o
|
|
|
12405
12405
|
v("in");
|
|
12406
12406
|
}, JA = () => {
|
|
12407
12407
|
if (!C.trim())
|
|
12408
|
-
return
|
|
12408
|
+
return X(n("Please enter a profile name")), !1;
|
|
12409
12409
|
let f;
|
|
12410
12410
|
if (b === "in") {
|
|
12411
|
-
const bA = parseInt(K, 10), oe = parseInt(
|
|
12411
|
+
const bA = parseInt(K, 10), oe = parseInt(T, 10);
|
|
12412
12412
|
f = !isNaN(bA) && bA > 0 && !isNaN(oe) && oe >= 0 && oe <= 11;
|
|
12413
12413
|
} else {
|
|
12414
12414
|
const bA = parseFloat(F);
|
|
12415
12415
|
f = !isNaN(bA) && bA > 0;
|
|
12416
12416
|
}
|
|
12417
12417
|
if (!f)
|
|
12418
|
-
return
|
|
12419
|
-
const
|
|
12420
|
-
|
|
12421
|
-
|
|
12422
|
-
const
|
|
12418
|
+
return X(n("Please enter a valid height")), !1;
|
|
12419
|
+
const j = parseFloat(MA);
|
|
12420
|
+
if (!j || j <= 0)
|
|
12421
|
+
return X(n("Please enter a valid weight")), !1;
|
|
12422
|
+
const dA = parseFloat(gA);
|
|
12423
|
+
return !dA || dA <= 0 ? (X(n("Please enter a valid age")), !1) : (X(""), !0);
|
|
12424
|
+
}, Qe = () => C.trim() ? (X(""), !0) : (X(n("Please enter a profile name")), !1), SA = () => {
|
|
12425
|
+
const f = b === "in" ? (parseInt(K, 10) || 0) * 12 + (parseInt(T, 10) || 0) : parseFloat(F), j = parseFloat(gA);
|
|
12423
12426
|
return {
|
|
12424
12427
|
name: C.trim(),
|
|
12425
12428
|
gender: Z,
|
|
@@ -12430,7 +12433,7 @@ function Jr({ onSave: o, onCancel: g, apiUrl: t, apiKey: r, onPhotoPreview: a, o
|
|
|
12430
12433
|
weightKg: parseFloat(MA),
|
|
12431
12434
|
height: f,
|
|
12432
12435
|
weight: parseFloat(MA),
|
|
12433
|
-
age:
|
|
12436
|
+
...j > 0 ? { age: j } : {},
|
|
12434
12437
|
chestProfile: NA || void 0,
|
|
12435
12438
|
midsectionProfile: re || void 0,
|
|
12436
12439
|
hipProfile: kA ? q || void 0 : ae || void 0,
|
|
@@ -12438,7 +12441,7 @@ function Jr({ onSave: o, onCancel: g, apiUrl: t, apiKey: r, onPhotoPreview: a, o
|
|
|
12438
12441
|
cupSize: kA && UA || void 0
|
|
12439
12442
|
};
|
|
12440
12443
|
}, P = () => {
|
|
12441
|
-
const f = b === "in" ? (parseInt(K, 10) || 0) * 12 + (parseInt(
|
|
12444
|
+
const f = b === "in" ? (parseInt(K, 10) || 0) * 12 + (parseInt(T, 10) || 0) : parseFloat(F), j = parseFloat(MA), dA = parseFloat(gA);
|
|
12442
12445
|
return {
|
|
12443
12446
|
name: C.trim(),
|
|
12444
12447
|
gender: Z,
|
|
@@ -12446,7 +12449,7 @@ function Jr({ onSave: o, onCancel: g, apiUrl: t, apiKey: r, onPhotoPreview: a, o
|
|
|
12446
12449
|
heightUnit: b,
|
|
12447
12450
|
weightUnit: b === "in" ? "lbs" : "kg",
|
|
12448
12451
|
...f > 0 ? { heightCm: f, height: f } : {},
|
|
12449
|
-
...
|
|
12452
|
+
...j > 0 ? { weightKg: j, weight: j } : {},
|
|
12450
12453
|
...dA > 0 ? { age: dA } : {},
|
|
12451
12454
|
...kA && S ? { bandSize: S } : {},
|
|
12452
12455
|
...kA && UA ? { cupSize: UA } : {},
|
|
@@ -12456,83 +12459,83 @@ function Jr({ onSave: o, onCancel: g, apiUrl: t, apiKey: r, onPhotoPreview: a, o
|
|
|
12456
12459
|
}, H = () => {
|
|
12457
12460
|
if (!(l === "identity" && !JA())) {
|
|
12458
12461
|
if (l === "chest" && !NA) {
|
|
12459
|
-
|
|
12462
|
+
X(n("Please pick an option"));
|
|
12460
12463
|
return;
|
|
12461
12464
|
}
|
|
12462
12465
|
if (l === "stomach" && !re) {
|
|
12463
|
-
|
|
12466
|
+
X(n("Please pick an option"));
|
|
12464
12467
|
return;
|
|
12465
12468
|
}
|
|
12466
12469
|
if (l === "seat" && !ae) {
|
|
12467
|
-
|
|
12470
|
+
X(n("Please pick an option"));
|
|
12468
12471
|
return;
|
|
12469
12472
|
}
|
|
12470
12473
|
if (l === "hips" && !q) {
|
|
12471
|
-
|
|
12474
|
+
X(n("Please pick an option"));
|
|
12472
12475
|
return;
|
|
12473
12476
|
}
|
|
12474
12477
|
if (l === "bra" && (!S || !UA)) {
|
|
12475
|
-
|
|
12478
|
+
X(n("Please pick band and cup size"));
|
|
12476
12479
|
return;
|
|
12477
12480
|
}
|
|
12478
|
-
if (
|
|
12481
|
+
if (X(""), Me) {
|
|
12479
12482
|
o(SA());
|
|
12480
12483
|
return;
|
|
12481
12484
|
}
|
|
12482
12485
|
D(KA[me + 1]);
|
|
12483
12486
|
}
|
|
12484
|
-
}, N = (f,
|
|
12485
|
-
|
|
12487
|
+
}, N = (f, j) => {
|
|
12488
|
+
X(""), f === "chest" ? He(j) : f === "stomach" ? V(j) : f === "seat" ? x(j) : f === "hips" && XA(j);
|
|
12486
12489
|
const dA = KA.indexOf(f), bA = dA === ZA - 1;
|
|
12487
12490
|
setTimeout(() => {
|
|
12488
12491
|
if (bA) {
|
|
12489
12492
|
const oe = SA();
|
|
12490
|
-
f === "chest" ? oe.chestProfile =
|
|
12493
|
+
f === "chest" ? oe.chestProfile = j : f === "stomach" ? oe.midsectionProfile = j : (f === "seat" || f === "hips") && (oe.hipProfile = j), o(oe);
|
|
12491
12494
|
} else
|
|
12492
12495
|
D(KA[dA + 1]);
|
|
12493
12496
|
}, 220);
|
|
12494
12497
|
}, J = () => {
|
|
12495
|
-
if (
|
|
12498
|
+
if (X(""), l === "identity") {
|
|
12496
12499
|
s(null);
|
|
12497
12500
|
return;
|
|
12498
12501
|
}
|
|
12499
12502
|
D(KA[Math.max(0, me - 1)]);
|
|
12500
|
-
}, _ = w === "manual" && (l === "chest" || l === "stomach" || l === "seat" || l === "hips"),
|
|
12503
|
+
}, _ = w === "manual" && (l === "chest" || l === "stomach" || l === "seat" || l === "hips"), tA = async () => {
|
|
12501
12504
|
if (d === "name-photo") {
|
|
12502
12505
|
if (!Qe()) return;
|
|
12503
12506
|
if (!rA) {
|
|
12504
|
-
|
|
12507
|
+
X(n("Please upload a photo"));
|
|
12505
12508
|
return;
|
|
12506
12509
|
}
|
|
12507
12510
|
if (b === "in") {
|
|
12508
12511
|
const dA = parseFloat(K);
|
|
12509
12512
|
if (!dA || dA < 3 || dA > 8) {
|
|
12510
|
-
|
|
12513
|
+
X(n("Please enter a valid height"));
|
|
12511
12514
|
return;
|
|
12512
12515
|
}
|
|
12513
12516
|
} else {
|
|
12514
12517
|
const dA = parseFloat(F);
|
|
12515
12518
|
if (!dA || dA < 100 || dA > 250) {
|
|
12516
|
-
|
|
12519
|
+
X(n("Please enter a valid height"));
|
|
12517
12520
|
return;
|
|
12518
12521
|
}
|
|
12519
12522
|
}
|
|
12520
|
-
const
|
|
12521
|
-
if (!
|
|
12522
|
-
|
|
12523
|
+
const j = parseFloat(MA);
|
|
12524
|
+
if (!j || j <= 0) {
|
|
12525
|
+
X(n("Please enter a valid weight"));
|
|
12523
12526
|
return;
|
|
12524
12527
|
}
|
|
12525
12528
|
if (kA && (!S || !UA)) {
|
|
12526
|
-
|
|
12529
|
+
X(n("Please select your bra band and cup size"));
|
|
12527
12530
|
return;
|
|
12528
12531
|
}
|
|
12529
|
-
if (
|
|
12530
|
-
const dA = b === "in" ? (parseInt(K, 10) || 0) * 12 + (parseInt(
|
|
12532
|
+
if (X(""), u("calculating"), M(!0), c && rA) {
|
|
12533
|
+
const dA = b === "in" ? (parseInt(K, 10) || 0) * 12 + (parseInt(T, 10) || 0) : parseFloat(F), bA = parseFloat(gA);
|
|
12531
12534
|
try {
|
|
12532
12535
|
const oe = await c({
|
|
12533
12536
|
photoBase64: rA,
|
|
12534
12537
|
height: dA || 0,
|
|
12535
|
-
weight:
|
|
12538
|
+
weight: j || 0,
|
|
12536
12539
|
heightUnit: b,
|
|
12537
12540
|
weightUnit: b === "in" ? "lbs" : "kg",
|
|
12538
12541
|
gender: Z,
|
|
@@ -12552,7 +12555,7 @@ function Jr({ onSave: o, onCancel: g, apiUrl: t, apiKey: r, onPhotoPreview: a, o
|
|
|
12552
12555
|
const f = P();
|
|
12553
12556
|
L && (f.measurements = L, f.measurementsUnit = "cm"), o(f);
|
|
12554
12557
|
}, ee = () => {
|
|
12555
|
-
if (
|
|
12558
|
+
if (X(""), d === "details") {
|
|
12556
12559
|
u("name-photo");
|
|
12557
12560
|
return;
|
|
12558
12561
|
}
|
|
@@ -12657,7 +12660,7 @@ function Jr({ onSave: o, onCancel: g, apiUrl: t, apiKey: r, onPhotoPreview: a, o
|
|
|
12657
12660
|
value: C,
|
|
12658
12661
|
placeholder: n("e.g. My Measurements"),
|
|
12659
12662
|
onChange: (f) => {
|
|
12660
|
-
W(f.target.value),
|
|
12663
|
+
W(f.target.value), X("");
|
|
12661
12664
|
}
|
|
12662
12665
|
}
|
|
12663
12666
|
) })
|
|
@@ -12674,7 +12677,7 @@ function Jr({ onSave: o, onCancel: g, apiUrl: t, apiKey: r, onPhotoPreview: a, o
|
|
|
12674
12677
|
value: F,
|
|
12675
12678
|
placeholder: n("e.g. 173"),
|
|
12676
12679
|
onChange: (f) => {
|
|
12677
|
-
z(f.target.value),
|
|
12680
|
+
z(f.target.value), X("");
|
|
12678
12681
|
}
|
|
12679
12682
|
}
|
|
12680
12683
|
),
|
|
@@ -12690,7 +12693,7 @@ function Jr({ onSave: o, onCancel: g, apiUrl: t, apiKey: r, onPhotoPreview: a, o
|
|
|
12690
12693
|
value: K,
|
|
12691
12694
|
placeholder: "5",
|
|
12692
12695
|
onChange: (f) => {
|
|
12693
|
-
wA(f.target.value),
|
|
12696
|
+
wA(f.target.value), X("");
|
|
12694
12697
|
}
|
|
12695
12698
|
}
|
|
12696
12699
|
),
|
|
@@ -12702,10 +12705,10 @@ function Jr({ onSave: o, onCancel: g, apiUrl: t, apiKey: r, onPhotoPreview: a, o
|
|
|
12702
12705
|
inputMode: "numeric",
|
|
12703
12706
|
className: "ps-bp-inline-input",
|
|
12704
12707
|
style: { width: "3em" },
|
|
12705
|
-
value:
|
|
12708
|
+
value: T,
|
|
12706
12709
|
placeholder: "8",
|
|
12707
12710
|
onChange: (f) => {
|
|
12708
|
-
zA(f.target.value),
|
|
12711
|
+
zA(f.target.value), X("");
|
|
12709
12712
|
}
|
|
12710
12713
|
}
|
|
12711
12714
|
),
|
|
@@ -12724,12 +12727,31 @@ function Jr({ onSave: o, onCancel: g, apiUrl: t, apiKey: r, onPhotoPreview: a, o
|
|
|
12724
12727
|
value: MA,
|
|
12725
12728
|
placeholder: n(b === "in" ? "e.g. 154" : "e.g. 70"),
|
|
12726
12729
|
onChange: (f) => {
|
|
12727
|
-
E(f.target.value),
|
|
12730
|
+
E(f.target.value), X("");
|
|
12728
12731
|
}
|
|
12729
12732
|
}
|
|
12730
12733
|
),
|
|
12731
12734
|
/* @__PURE__ */ A("span", { className: "ps-bp-inline-unit", children: b === "in" ? "lbs" : "kg" })
|
|
12732
12735
|
] })
|
|
12736
|
+
] }),
|
|
12737
|
+
/* @__PURE__ */ e("div", { className: "ps-bp-inline-row", children: [
|
|
12738
|
+
/* @__PURE__ */ A("span", { className: "ps-bp-inline-label", children: n("AGE") }),
|
|
12739
|
+
/* @__PURE__ */ e("div", { className: "ps-bp-inline-input-group", children: [
|
|
12740
|
+
/* @__PURE__ */ A(
|
|
12741
|
+
"input",
|
|
12742
|
+
{
|
|
12743
|
+
type: "number",
|
|
12744
|
+
inputMode: "numeric",
|
|
12745
|
+
className: "ps-bp-inline-input",
|
|
12746
|
+
value: gA,
|
|
12747
|
+
placeholder: n("e.g. 30"),
|
|
12748
|
+
onChange: (f) => {
|
|
12749
|
+
O(f.target.value), X("");
|
|
12750
|
+
}
|
|
12751
|
+
}
|
|
12752
|
+
),
|
|
12753
|
+
/* @__PURE__ */ A("span", { className: "ps-bp-inline-unit", children: n("years") })
|
|
12754
|
+
] })
|
|
12733
12755
|
] })
|
|
12734
12756
|
] }),
|
|
12735
12757
|
fA && /* @__PURE__ */ A("div", { className: "ps-cpw-error", children: fA })
|
|
@@ -12800,7 +12822,7 @@ function Jr({ onSave: o, onCancel: g, apiUrl: t, apiKey: r, onPhotoPreview: a, o
|
|
|
12800
12822
|
className: "ps-cpw-input",
|
|
12801
12823
|
value: S ?? "",
|
|
12802
12824
|
onChange: (f) => {
|
|
12803
|
-
pA(f.target.value || null),
|
|
12825
|
+
pA(f.target.value || null), X("");
|
|
12804
12826
|
},
|
|
12805
12827
|
children: [
|
|
12806
12828
|
/* @__PURE__ */ A("option", { value: "", children: n("Select") }),
|
|
@@ -12817,7 +12839,7 @@ function Jr({ onSave: o, onCancel: g, apiUrl: t, apiKey: r, onPhotoPreview: a, o
|
|
|
12817
12839
|
className: "ps-cpw-input",
|
|
12818
12840
|
value: UA ?? "",
|
|
12819
12841
|
onChange: (f) => {
|
|
12820
|
-
Be(f.target.value || null),
|
|
12842
|
+
Be(f.target.value || null), X("");
|
|
12821
12843
|
},
|
|
12822
12844
|
children: [
|
|
12823
12845
|
/* @__PURE__ */ A("option", { value: "", children: n("Select") }),
|
|
@@ -12861,10 +12883,10 @@ function Jr({ onSave: o, onCancel: g, apiUrl: t, apiKey: r, onPhotoPreview: a, o
|
|
|
12861
12883
|
},
|
|
12862
12884
|
onDrop: (f) => {
|
|
12863
12885
|
if (f.preventDefault(), f.stopPropagation(), rA || TA !== !0) return;
|
|
12864
|
-
const
|
|
12865
|
-
if (!
|
|
12886
|
+
const j = f.dataTransfer?.files?.[0];
|
|
12887
|
+
if (!j || !ne.current) return;
|
|
12866
12888
|
const dA = new DataTransfer();
|
|
12867
|
-
dA.items.add(
|
|
12889
|
+
dA.items.add(j), ne.current.files = dA.files, ne.current.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
12868
12890
|
},
|
|
12869
12891
|
style: {
|
|
12870
12892
|
flex: 1,
|
|
@@ -12977,7 +12999,7 @@ function Jr({ onSave: o, onCancel: g, apiUrl: t, apiKey: r, onPhotoPreview: a, o
|
|
|
12977
12999
|
{
|
|
12978
13000
|
type: "button",
|
|
12979
13001
|
onClick: (f) => {
|
|
12980
|
-
f.stopPropagation(), y(!0),
|
|
13002
|
+
f.stopPropagation(), y(!0), X("");
|
|
12981
13003
|
},
|
|
12982
13004
|
style: {
|
|
12983
13005
|
padding: "0.4vw 1vw",
|
|
@@ -13155,7 +13177,7 @@ function Jr({ onSave: o, onCancel: g, apiUrl: t, apiKey: r, onPhotoPreview: a, o
|
|
|
13155
13177
|
/* @__PURE__ */ e("div", { className: "ps-bp-inline-row", children: [
|
|
13156
13178
|
/* @__PURE__ */ A("span", { className: "ps-bp-inline-label", children: n("NAME") }),
|
|
13157
13179
|
/* @__PURE__ */ A("div", { className: "ps-bp-inline-input-group", children: /* @__PURE__ */ A("input", { ref: le, type: "text", className: `ps-bp-inline-input${CA ? " ps-cpw-shake" : ""}`, value: C, placeholder: n("e.g. My Photo Profile"), onChange: (f) => {
|
|
13158
|
-
W(f.target.value),
|
|
13180
|
+
W(f.target.value), X("");
|
|
13159
13181
|
}, onAnimationEnd: () => _A(!1) }) })
|
|
13160
13182
|
] }),
|
|
13161
13183
|
/* @__PURE__ */ e("div", { className: "ps-bp-inline-row", children: [
|
|
@@ -13166,7 +13188,7 @@ function Jr({ onSave: o, onCancel: g, apiUrl: t, apiKey: r, onPhotoPreview: a, o
|
|
|
13166
13188
|
{
|
|
13167
13189
|
type: "button",
|
|
13168
13190
|
onClick: () => {
|
|
13169
|
-
i("male"), pA(null), Be(null),
|
|
13191
|
+
i("male"), pA(null), Be(null), X("");
|
|
13170
13192
|
},
|
|
13171
13193
|
className: "ps-cpw-gender-pill",
|
|
13172
13194
|
"data-active": Z === "male" ? "true" : "false",
|
|
@@ -13178,7 +13200,7 @@ function Jr({ onSave: o, onCancel: g, apiUrl: t, apiKey: r, onPhotoPreview: a, o
|
|
|
13178
13200
|
{
|
|
13179
13201
|
type: "button",
|
|
13180
13202
|
onClick: () => {
|
|
13181
|
-
i("female"),
|
|
13203
|
+
i("female"), X("");
|
|
13182
13204
|
},
|
|
13183
13205
|
className: "ps-cpw-gender-pill",
|
|
13184
13206
|
"data-active": Z === "female" ? "true" : "false",
|
|
@@ -13191,16 +13213,16 @@ function Jr({ onSave: o, onCancel: g, apiUrl: t, apiKey: r, onPhotoPreview: a, o
|
|
|
13191
13213
|
/* @__PURE__ */ A("span", { className: "ps-bp-inline-label", children: n("HEIGHT") }),
|
|
13192
13214
|
b === "cm" ? /* @__PURE__ */ e("div", { className: "ps-bp-inline-input-group", children: [
|
|
13193
13215
|
/* @__PURE__ */ A("input", { type: "number", inputMode: "numeric", className: "ps-bp-inline-input", value: F, placeholder: n("e.g. 173"), onChange: (f) => {
|
|
13194
|
-
z(f.target.value),
|
|
13216
|
+
z(f.target.value), X("");
|
|
13195
13217
|
} }),
|
|
13196
13218
|
/* @__PURE__ */ A("span", { className: "ps-bp-inline-unit", children: "cm" })
|
|
13197
13219
|
] }) : /* @__PURE__ */ e("div", { className: "ps-bp-inline-input-group", style: { gap: "6px" }, children: [
|
|
13198
13220
|
/* @__PURE__ */ A("input", { type: "number", inputMode: "numeric", className: "ps-bp-inline-input", style: { width: "3em" }, value: K, placeholder: "5", onChange: (f) => {
|
|
13199
|
-
wA(f.target.value),
|
|
13221
|
+
wA(f.target.value), X("");
|
|
13200
13222
|
} }),
|
|
13201
13223
|
/* @__PURE__ */ A("span", { className: "ps-bp-inline-unit", children: "ft" }),
|
|
13202
|
-
/* @__PURE__ */ A("input", { type: "number", inputMode: "numeric", className: "ps-bp-inline-input", style: { width: "3em" }, value:
|
|
13203
|
-
zA(f.target.value),
|
|
13224
|
+
/* @__PURE__ */ A("input", { type: "number", inputMode: "numeric", className: "ps-bp-inline-input", style: { width: "3em" }, value: T, placeholder: "8", onChange: (f) => {
|
|
13225
|
+
zA(f.target.value), X("");
|
|
13204
13226
|
} }),
|
|
13205
13227
|
/* @__PURE__ */ A("span", { className: "ps-bp-inline-unit", children: "in" })
|
|
13206
13228
|
] })
|
|
@@ -13209,7 +13231,7 @@ function Jr({ onSave: o, onCancel: g, apiUrl: t, apiKey: r, onPhotoPreview: a, o
|
|
|
13209
13231
|
/* @__PURE__ */ A("span", { className: "ps-bp-inline-label", children: n("WEIGHT") }),
|
|
13210
13232
|
/* @__PURE__ */ e("div", { className: "ps-bp-inline-input-group", children: [
|
|
13211
13233
|
/* @__PURE__ */ A("input", { type: "number", inputMode: "numeric", className: "ps-bp-inline-input", value: MA, placeholder: n(b === "in" ? "e.g. 154" : "e.g. 70"), onChange: (f) => {
|
|
13212
|
-
E(f.target.value),
|
|
13234
|
+
E(f.target.value), X("");
|
|
13213
13235
|
} }),
|
|
13214
13236
|
/* @__PURE__ */ A("span", { className: "ps-bp-inline-unit", children: b === "in" ? "lbs" : "kg" })
|
|
13215
13237
|
] })
|
|
@@ -13362,16 +13384,16 @@ function Jr({ onSave: o, onCancel: g, apiUrl: t, apiKey: r, onPhotoPreview: a, o
|
|
|
13362
13384
|
/* @__PURE__ */ A("span", { className: "ps-bp-inline-label", children: n("HEIGHT") }),
|
|
13363
13385
|
b === "cm" ? /* @__PURE__ */ e("div", { className: "ps-bp-inline-input-group", children: [
|
|
13364
13386
|
/* @__PURE__ */ A("input", { type: "number", inputMode: "numeric", className: "ps-bp-inline-input", value: F, placeholder: n("e.g. 173"), onChange: (f) => {
|
|
13365
|
-
z(f.target.value),
|
|
13387
|
+
z(f.target.value), X("");
|
|
13366
13388
|
} }),
|
|
13367
13389
|
/* @__PURE__ */ A("span", { className: "ps-bp-inline-unit", children: "cm" })
|
|
13368
13390
|
] }) : /* @__PURE__ */ e("div", { className: "ps-bp-inline-input-group", style: { gap: "6px" }, children: [
|
|
13369
13391
|
/* @__PURE__ */ A("input", { type: "number", inputMode: "numeric", className: "ps-bp-inline-input", style: { width: "3em" }, value: K, placeholder: "5", onChange: (f) => {
|
|
13370
|
-
wA(f.target.value),
|
|
13392
|
+
wA(f.target.value), X("");
|
|
13371
13393
|
} }),
|
|
13372
13394
|
/* @__PURE__ */ A("span", { className: "ps-bp-inline-unit", children: "ft" }),
|
|
13373
|
-
/* @__PURE__ */ A("input", { type: "number", inputMode: "numeric", className: "ps-bp-inline-input", style: { width: "3em" }, value:
|
|
13374
|
-
zA(f.target.value),
|
|
13395
|
+
/* @__PURE__ */ A("input", { type: "number", inputMode: "numeric", className: "ps-bp-inline-input", style: { width: "3em" }, value: T, placeholder: "8", onChange: (f) => {
|
|
13396
|
+
zA(f.target.value), X("");
|
|
13375
13397
|
} }),
|
|
13376
13398
|
/* @__PURE__ */ A("span", { className: "ps-bp-inline-unit", children: "in" })
|
|
13377
13399
|
] })
|
|
@@ -13380,7 +13402,7 @@ function Jr({ onSave: o, onCancel: g, apiUrl: t, apiKey: r, onPhotoPreview: a, o
|
|
|
13380
13402
|
/* @__PURE__ */ A("span", { className: "ps-bp-inline-label", children: n("WEIGHT") }),
|
|
13381
13403
|
/* @__PURE__ */ e("div", { className: "ps-bp-inline-input-group", children: [
|
|
13382
13404
|
/* @__PURE__ */ A("input", { type: "number", inputMode: "numeric", className: "ps-bp-inline-input", value: MA, placeholder: n(b === "in" ? "e.g. 154" : "e.g. 70"), onChange: (f) => {
|
|
13383
|
-
E(f.target.value),
|
|
13405
|
+
E(f.target.value), X("");
|
|
13384
13406
|
} }),
|
|
13385
13407
|
/* @__PURE__ */ A("span", { className: "ps-bp-inline-unit", children: b === "in" ? "lbs" : "kg" })
|
|
13386
13408
|
] })
|
|
@@ -13388,8 +13410,8 @@ function Jr({ onSave: o, onCancel: g, apiUrl: t, apiKey: r, onPhotoPreview: a, o
|
|
|
13388
13410
|
/* @__PURE__ */ e("div", { className: "ps-bp-inline-row", children: [
|
|
13389
13411
|
/* @__PURE__ */ A("span", { className: "ps-bp-inline-label", children: n("AGE") }),
|
|
13390
13412
|
/* @__PURE__ */ e("div", { className: "ps-bp-inline-input-group", children: [
|
|
13391
|
-
/* @__PURE__ */ A("input", { type: "number", inputMode: "numeric", className: "ps-bp-inline-input", value:
|
|
13392
|
-
O(f.target.value),
|
|
13413
|
+
/* @__PURE__ */ A("input", { type: "number", inputMode: "numeric", className: "ps-bp-inline-input", value: gA, placeholder: n("e.g. 30"), onChange: (f) => {
|
|
13414
|
+
O(f.target.value), X("");
|
|
13393
13415
|
} }),
|
|
13394
13416
|
/* @__PURE__ */ A("span", { className: "ps-bp-inline-unit", children: n("years") })
|
|
13395
13417
|
] })
|
|
@@ -13404,7 +13426,7 @@ function Jr({ onSave: o, onCancel: g, apiUrl: t, apiKey: r, onPhotoPreview: a, o
|
|
|
13404
13426
|
{ title: n("ANALYZING BODY"), desc: n("Measuring shoulders, chest, waist and hips.") },
|
|
13405
13427
|
{ title: n("COMPUTING DEPTH"), desc: n("Using your height and weight to compute true circumferences.") },
|
|
13406
13428
|
{ title: n("FINALIZING"), desc: n("Almost done — preparing your body profile.") }
|
|
13407
|
-
],
|
|
13429
|
+
], j = f[vA % f.length] ?? f[0], dA = [
|
|
13408
13430
|
["leftShoulder", "rightShoulder"],
|
|
13409
13431
|
["leftShoulder", "leftElbow"],
|
|
13410
13432
|
["leftElbow", "leftWrist"],
|
|
@@ -13484,8 +13506,8 @@ function Jr({ onSave: o, onCancel: g, apiUrl: t, apiKey: r, onPhotoPreview: a, o
|
|
|
13484
13506
|
/* @__PURE__ */ e("div", { style: { flex: 1, display: "flex", flexDirection: "column", justifyContent: "center", gap: "1vw", paddingLeft: "0.5vw" }, children: [
|
|
13485
13507
|
/* @__PURE__ */ A("div", { className: "ps-tryon-size-loading-spinner" }),
|
|
13486
13508
|
/* @__PURE__ */ e("div", { style: { animation: "ps-cpw-age-gate-in 0.38s ease-out both" }, children: [
|
|
13487
|
-
/* @__PURE__ */ A("div", { style: { fontSize: "0.7vw", fontWeight: 700, color: "var(--ps-accent)", letterSpacing: "0.18em", textTransform: "uppercase", marginBottom: "0.4vw" }, children:
|
|
13488
|
-
/* @__PURE__ */ A("div", { style: { fontSize: "1.05vw", fontWeight: 600, color: "var(--ps-text-primary)", lineHeight: 1.35 }, children:
|
|
13509
|
+
/* @__PURE__ */ A("div", { style: { fontSize: "0.7vw", fontWeight: 700, color: "var(--ps-accent)", letterSpacing: "0.18em", textTransform: "uppercase", marginBottom: "0.4vw" }, children: j.title }),
|
|
13510
|
+
/* @__PURE__ */ A("div", { style: { fontSize: "1.05vw", fontWeight: 600, color: "var(--ps-text-primary)", lineHeight: 1.35 }, children: j.desc })
|
|
13489
13511
|
] }, vA % f.length),
|
|
13490
13512
|
/* @__PURE__ */ A("div", { style: { fontSize: "0.65vw", color: "var(--ps-text-muted)", marginTop: "0.4vw" }, children: n(PA ? "✓ Pose detected — running body analysis" : "Detecting pose landmarks…") })
|
|
13491
13513
|
] })
|
|
@@ -13530,7 +13552,7 @@ function Jr({ onSave: o, onCancel: g, apiUrl: t, apiKey: r, onPhotoPreview: a, o
|
|
|
13530
13552
|
/* @__PURE__ */ A("button", { type: "button", className: "ps-cpw-back-btn", onClick: EA, children: w == null ? n("Cancel") : `← ${n("Back")}` }),
|
|
13531
13553
|
w === "manual" && !_ && /* @__PURE__ */ A("button", { type: "button", className: "ps-cpw-next-btn", onClick: H, children: n(Me ? "CALCULATE MY FIT" : "Continue") }),
|
|
13532
13554
|
w === "image" && d === "name-photo" && (() => {
|
|
13533
|
-
const f = b === "in" ? parseFloat(K) > 0 || parseFloat(
|
|
13555
|
+
const f = b === "in" ? parseFloat(K) > 0 || parseFloat(T) > 0 : parseFloat(F) > 0, j = parseFloat(MA) > 0, dA = !!C.trim(), bA = !!rA, oe = iA, be = n(oe ? "Analyzing photo…" : bA ? dA ? f ? j ? "Calculate My Body Parts" : "Enter your weight" : "Enter your height" : "Add a name for this profile" : "Upload a photo"), Le = oe || !bA || !dA || !f || !j;
|
|
13534
13556
|
return /* @__PURE__ */ A(
|
|
13535
13557
|
"button",
|
|
13536
13558
|
{
|
|
@@ -13541,7 +13563,7 @@ function Jr({ onSave: o, onCancel: g, apiUrl: t, apiKey: r, onPhotoPreview: a, o
|
|
|
13541
13563
|
_A(!0), le.current?.focus();
|
|
13542
13564
|
return;
|
|
13543
13565
|
}
|
|
13544
|
-
|
|
13566
|
+
tA();
|
|
13545
13567
|
},
|
|
13546
13568
|
disabled: Le,
|
|
13547
13569
|
title: Le ? be : void 0,
|
|
@@ -13549,10 +13571,10 @@ function Jr({ onSave: o, onCancel: g, apiUrl: t, apiKey: r, onPhotoPreview: a, o
|
|
|
13549
13571
|
}
|
|
13550
13572
|
);
|
|
13551
13573
|
})(),
|
|
13552
|
-
w === "image" && d === "details" && /* @__PURE__ */ A("button", { type: "button", className: "ps-cpw-next-btn", onClick:
|
|
13553
|
-
w === "image" && d === "calculating" && !m && L && /* @__PURE__ */ A("button", { type: "button", className: "ps-cpw-next-btn", onClick:
|
|
13574
|
+
w === "image" && d === "details" && /* @__PURE__ */ A("button", { type: "button", className: "ps-cpw-next-btn", onClick: tA, children: n("Calculate My Body Parts") }),
|
|
13575
|
+
w === "image" && d === "calculating" && !m && L && /* @__PURE__ */ A("button", { type: "button", className: "ps-cpw-next-btn", onClick: tA, children: n("Save Profile") }),
|
|
13554
13576
|
w === "image" && d === "calculating" && !m && !L && /* @__PURE__ */ A("button", { type: "button", className: "ps-cpw-next-btn", onClick: () => {
|
|
13555
|
-
u("details"),
|
|
13577
|
+
u("details"), X("");
|
|
13556
13578
|
}, children: n("Try Again") })
|
|
13557
13579
|
] })
|
|
13558
13580
|
] });
|
|
@@ -13609,8 +13631,8 @@ function Wr({
|
|
|
13609
13631
|
v !== m && (Y((F) => {
|
|
13610
13632
|
const z = {};
|
|
13611
13633
|
for (const [K, wA] of Object.entries(F)) {
|
|
13612
|
-
const
|
|
13613
|
-
!isNaN(
|
|
13634
|
+
const T = parseFloat(wA);
|
|
13635
|
+
!isNaN(T) && T > 0 ? z[K] = String(v === "in" ? Math.round(T / 2.54 * 10) / 10 : Math.round(T * 2.54 * 10) / 10) : z[K] = wA;
|
|
13614
13636
|
}
|
|
13615
13637
|
return z;
|
|
13616
13638
|
}), M(v));
|
|
@@ -13994,14 +14016,14 @@ function oi({
|
|
|
13994
14016
|
error: v,
|
|
13995
14017
|
t: F
|
|
13996
14018
|
}) {
|
|
13997
|
-
const z = parseFloat(r) || 173, K = (parseFloat(c) || 5) * 12 + (parseFloat(w) || 8), wA = Math.floor(K / 12),
|
|
13998
|
-
const Pe = Math.max(
|
|
14019
|
+
const z = parseFloat(r) || 173, K = (parseFloat(c) || 5) * 12 + (parseFloat(w) || 8), wA = Math.floor(K / 12), T = K % 12, zA = parseFloat(l) || (g === "kg" ? 70 : 154), MA = parseFloat(d) || 30, E = g === "kg" ? 30 : 66, gA = g === "kg" ? 200 : 440, O = 120, fA = 220, X = 48, rA = 84, uA = 13, iA = 100, yA = (z - O) / (fA - O) * 100, RA = (K - X) / (rA - X) * 100, mA = (zA - E) / (gA - E) * 100, we = (MA - uA) / (iA - uA) * 100, $A = ($) => {
|
|
14020
|
+
const Pe = Math.max(X, Math.min(rA, $));
|
|
13999
14021
|
n(String(Math.floor(Pe / 12))), s(String(Pe % 12));
|
|
14000
14022
|
}, PA = () => {
|
|
14001
14023
|
o === "in" ? $A(K + 1) : a(String(Math.min(fA, z + 1)));
|
|
14002
14024
|
}, te = () => {
|
|
14003
14025
|
o === "in" ? $A(K - 1) : a(String(Math.max(O, z - 1)));
|
|
14004
|
-
}, qA = () => D(String(Math.min(
|
|
14026
|
+
}, qA = () => D(String(Math.min(gA, zA + 1))), fe = () => D(String(Math.max(E, zA - 1))), vA = () => u(String(Math.min(iA, MA + 1))), ue = () => u(String(Math.max(uA, MA - 1)));
|
|
14005
14027
|
return /* @__PURE__ */ e("div", { className: "ps-bpm-root", children: [
|
|
14006
14028
|
/* @__PURE__ */ e("div", { className: "ps-bpm-header", children: [
|
|
14007
14029
|
/* @__PURE__ */ A("h2", { className: "ps-bpm-title", children: F("Body Measurements") }),
|
|
@@ -14040,7 +14062,7 @@ function oi({
|
|
|
14040
14062
|
/* @__PURE__ */ e("div", { className: "ps-bpm-row", children: [
|
|
14041
14063
|
/* @__PURE__ */ e("div", { className: "ps-bpm-row-top", children: [
|
|
14042
14064
|
/* @__PURE__ */ A("span", { className: "ps-bpm-label", children: F("HEIGHT") }),
|
|
14043
|
-
/* @__PURE__ */ A("span", { className: "ps-bpm-value-display", children: o === "in" ? `${wA}ft ${
|
|
14065
|
+
/* @__PURE__ */ A("span", { className: "ps-bpm-value-display", children: o === "in" ? `${wA}ft ${T}in` : `${Math.round(z)} cm` })
|
|
14044
14066
|
] }),
|
|
14045
14067
|
/* @__PURE__ */ e("div", { className: "ps-bpm-slider-row", children: [
|
|
14046
14068
|
/* @__PURE__ */ A("button", { type: "button", className: "ps-bpm-step-btn", onClick: te, "aria-label": F("Decrease"), children: /* @__PURE__ */ A(Cg, {}) }),
|
|
@@ -14049,7 +14071,7 @@ function oi({
|
|
|
14049
14071
|
{
|
|
14050
14072
|
type: "range",
|
|
14051
14073
|
className: "ps-bpm-slider",
|
|
14052
|
-
min:
|
|
14074
|
+
min: X,
|
|
14053
14075
|
max: rA,
|
|
14054
14076
|
step: 1,
|
|
14055
14077
|
value: K,
|
|
@@ -14089,7 +14111,7 @@ function oi({
|
|
|
14089
14111
|
type: "range",
|
|
14090
14112
|
className: "ps-bpm-slider",
|
|
14091
14113
|
min: E,
|
|
14092
|
-
max:
|
|
14114
|
+
max: gA,
|
|
14093
14115
|
step: 1,
|
|
14094
14116
|
value: zA,
|
|
14095
14117
|
onChange: ($) => D($.target.value),
|
|
@@ -14612,11 +14634,11 @@ function li({
|
|
|
14612
14634
|
}) {
|
|
14613
14635
|
const b = t ? Bi : ai, [v, F] = Q("photo");
|
|
14614
14636
|
v === "photo" || b.indexOf(v);
|
|
14615
|
-
const z = Oo(), K = st(a), wA = W?.height,
|
|
14637
|
+
const z = Oo(), K = st(a), wA = W?.height, T = W?.weight, zA = W?.age, MA = W?.heightUnit === "ft" ? "in" : W?.heightUnit, E = W?.weightUnit, gA = wA != null && MA === "cm" ? String(Math.round(wA)) : wA != null && (MA === "in" || MA === "ft") ? String(Math.round(wA * 2.54)) : r.current.height || "", O = wA != null && (MA === "in" || MA === "ft") ? Math.round(wA) : wA != null && MA === "cm" ? Math.round(wA / 2.54) : null, fA = O != null ? String(Math.floor(O / 12)) : r.current.heightFeet || "", X = O != null ? String(O % 12) : r.current.heightInches || "", rA = T != null ? String(Math.round(T)) : r.current.weight || "", uA = zA != null ? String(zA) : r.current.age || "", [iA, yA] = Q(gA), [RA, mA] = Q(fA), [we, $A] = Q(X), [PA, te] = Q(rA), [qA, fe] = Q(uA), [vA, ue] = Q(
|
|
14616
14638
|
MA || (c === "ft" ? "in" : c || (K ? "in" : "cm"))
|
|
14617
14639
|
), [$, Pe] = Q(
|
|
14618
14640
|
E || w || (K ? "lbs" : "kg")
|
|
14619
|
-
), ve = vA === "in" || $ === "lbs", [Fe, ne] = Q(null), [le, CA] = Q(null), [_A, TA] = Q(null), [y, GA] = Q(!1), [Ee, Ge] = Q(""), [NA, He] = Q(null), re = QA(null), [V, ae] = Q(null), [x, q] = Q(!1), [XA, S] = Q(!1), [pA, UA] = Q(() => O != null ? String(Math.round(O * 2.54)) :
|
|
14641
|
+
), ve = vA === "in" || $ === "lbs", [Fe, ne] = Q(null), [le, CA] = Q(null), [_A, TA] = Q(null), [y, GA] = Q(!1), [Ee, Ge] = Q(""), [NA, He] = Q(null), re = QA(null), [V, ae] = Q(null), [x, q] = Q(!1), [XA, S] = Q(!1), [pA, UA] = Q(() => O != null ? String(Math.round(O * 2.54)) : gA), [Be, Ae] = Q(null), [pe, LA] = Q(null), [Ce, FA] = Q(null), [lA, I] = Q(null), [kA, oA] = Q(""), [KA, me] = Q(null), [ZA, Me] = Q(null), [de, De] = Q(() => ["US", "UK", "AU"].includes(a) ? a === "AU" ? "UK" : a : ["FR", "ES"].includes(a) ? "FR" : ["IT"].includes(a) ? "IT" : ["JP", "CN", "KR"].includes(a) ? "JP" : "EU"), [JA, Qe] = Q(!1), [SA, P] = Q(null), H = QA(null);
|
|
14620
14642
|
HA(() => {
|
|
14621
14643
|
if (!SA) return;
|
|
14622
14644
|
const U = (hA) => {
|
|
@@ -14625,7 +14647,7 @@ function li({
|
|
|
14625
14647
|
};
|
|
14626
14648
|
return document.addEventListener("mousedown", U), () => document.removeEventListener("mousedown", U);
|
|
14627
14649
|
}, [SA]);
|
|
14628
|
-
const N = eo[de] || eo.US, [J, _] = Q(""),
|
|
14650
|
+
const N = eo[de] || eo.US, [J, _] = Q(""), tA = IA(async (U) => {
|
|
14629
14651
|
const hA = U.target.files?.[0];
|
|
14630
14652
|
if (!hA) return;
|
|
14631
14653
|
if (V !== !0) {
|
|
@@ -14703,7 +14725,7 @@ function li({
|
|
|
14703
14725
|
bandSize: KA || void 0,
|
|
14704
14726
|
cupSize: ZA || void 0
|
|
14705
14727
|
});
|
|
14706
|
-
},
|
|
14728
|
+
}, j = IA(() => {
|
|
14707
14729
|
if (!_A || !Fe) return;
|
|
14708
14730
|
const U = vA === "in" ? (parseFloat(RA) || 0) * 12 + (parseFloat(we) || 0) : parseFloat(iA) || 0, hA = parseFloat(PA) || 0, xA = parseFloat(qA) || void 0;
|
|
14709
14731
|
M({
|
|
@@ -14764,7 +14786,7 @@ function li({
|
|
|
14764
14786
|
F("scan-details");
|
|
14765
14787
|
return;
|
|
14766
14788
|
}
|
|
14767
|
-
|
|
14789
|
+
j();
|
|
14768
14790
|
} else if (v === "scan-details") {
|
|
14769
14791
|
const U = vA === "in" ? parseFloat(RA) > 0 || parseFloat(we) > 0 : parseFloat(iA) > 0, hA = parseFloat(PA) > 0;
|
|
14770
14792
|
if (!U) {
|
|
@@ -14783,9 +14805,9 @@ function li({
|
|
|
14783
14805
|
_(i("Please upload a photo"));
|
|
14784
14806
|
return;
|
|
14785
14807
|
}
|
|
14786
|
-
_(""),
|
|
14808
|
+
_(""), j();
|
|
14787
14809
|
}
|
|
14788
|
-
}, [v, b, EA, Be, pe, Ce, lA, KA, ZA, vA, $, iA, RA, we, PA, qA, _A, Fe, V, z, t, he, L, Y,
|
|
14810
|
+
}, [v, b, EA, Be, pe, Ce, lA, KA, ZA, vA, $, iA, RA, we, PA, qA, _A, Fe, V, z, t, he, L, Y, j]), bA = (U) => {
|
|
14789
14811
|
const hA = b.indexOf(U);
|
|
14790
14812
|
return hA > 0 ? b[hA - 1] : null;
|
|
14791
14813
|
}, oe = IA(() => {
|
|
@@ -14972,7 +14994,7 @@ function li({
|
|
|
14972
14994
|
It,
|
|
14973
14995
|
{
|
|
14974
14996
|
photoPreview: le,
|
|
14975
|
-
handlePhotoSelect:
|
|
14997
|
+
handlePhotoSelect: tA,
|
|
14976
14998
|
handleRemovePhoto: ee,
|
|
14977
14999
|
onAnalyze: dA,
|
|
14978
15000
|
onSwitchToManual: () => F("basics"),
|
|
@@ -15521,7 +15543,7 @@ function li({
|
|
|
15521
15543
|
] })
|
|
15522
15544
|
] })
|
|
15523
15545
|
] }),
|
|
15524
|
-
/* @__PURE__ */ A("input", { ref: re, type: "file", accept: "image/*", onChange:
|
|
15546
|
+
/* @__PURE__ */ A("input", { ref: re, type: "file", accept: "image/*", onChange: tA, style: { display: "none" } }),
|
|
15525
15547
|
z ? /* @__PURE__ */ e(eA, { children: [
|
|
15526
15548
|
/* @__PURE__ */ A("div", { className: "ps-bpm-spacer" }),
|
|
15527
15549
|
/* @__PURE__ */ e("div", { className: "ps-bpm-bottom", children: [
|
|
@@ -15589,7 +15611,7 @@ function li({
|
|
|
15589
15611
|
ref: re,
|
|
15590
15612
|
type: "file",
|
|
15591
15613
|
accept: "image/*",
|
|
15592
|
-
onChange:
|
|
15614
|
+
onChange: tA,
|
|
15593
15615
|
style: { display: "none" }
|
|
15594
15616
|
}
|
|
15595
15617
|
),
|
|
@@ -15944,16 +15966,16 @@ function Pg({
|
|
|
15944
15966
|
}), z = t ?? [
|
|
15945
15967
|
{ label: C("Centimeters"), value: "cm" },
|
|
15946
15968
|
{ label: C("Inches"), value: "in" }
|
|
15947
|
-
], [K, wA] = Q(""),
|
|
15969
|
+
], [K, wA] = Q(""), T = QA(null), [zA, MA] = Q(null), [E, gA] = Q(null), [O, fA] = Q(null), [X, rA] = Q(!1), [uA, iA] = Q(!1), [yA, RA] = Q(""), [mA, we] = Q(null), [$A, PA] = Q(null), [te, qA] = Q(!1), fe = IA(async (y) => {
|
|
15948
15970
|
const GA = y.target.files?.[0];
|
|
15949
15971
|
if (!GA) return;
|
|
15950
15972
|
const Ee = URL.createObjectURL(GA);
|
|
15951
|
-
|
|
15973
|
+
gA(GA), MA(Ee), iA(!0), RA("Analyzing photo…");
|
|
15952
15974
|
try {
|
|
15953
15975
|
const Ge = Y && h ? eg(GA, Y, h) : Promise.resolve({ isAdult: !0, confidence: "low" }), NA = Do(GA, W ? { maxDimension: 1536, quality: 0.85 } : {}), He = await Ge;
|
|
15954
15976
|
if (!He.isAdult) {
|
|
15955
15977
|
const V = He.reasoning?.trim() || C("This photo appears to be of a minor. Please upload a photo of someone 18 or older.");
|
|
15956
|
-
we(V),
|
|
15978
|
+
we(V), gA(null), MA(null);
|
|
15957
15979
|
return;
|
|
15958
15980
|
}
|
|
15959
15981
|
const re = await NA;
|
|
@@ -15963,7 +15985,7 @@ function Pg({
|
|
|
15963
15985
|
iA(!1), RA("");
|
|
15964
15986
|
}
|
|
15965
15987
|
}, [W, Y, h, C]), vA = IA(() => {
|
|
15966
|
-
zA && URL.revokeObjectURL(zA),
|
|
15988
|
+
zA && URL.revokeObjectURL(zA), gA(null), MA(null), fA(null);
|
|
15967
15989
|
}, [zA]), ue = (y, GA) => {
|
|
15968
15990
|
F((Ee) => ({ ...Ee, [y]: GA })), wA("");
|
|
15969
15991
|
}, $ = () => {
|
|
@@ -16139,7 +16161,7 @@ function Pg({
|
|
|
16139
16161
|
"div",
|
|
16140
16162
|
{
|
|
16141
16163
|
onClick: () => {
|
|
16142
|
-
!zA && $A === !0 &&
|
|
16164
|
+
!zA && $A === !0 && T.current?.click();
|
|
16143
16165
|
},
|
|
16144
16166
|
onMouseEnter: () => {
|
|
16145
16167
|
!zA && $A === !0 && rA(!0);
|
|
@@ -16151,11 +16173,11 @@ function Pg({
|
|
|
16151
16173
|
flexDirection: "column",
|
|
16152
16174
|
alignItems: "center",
|
|
16153
16175
|
justifyContent: "center",
|
|
16154
|
-
border: zA ? "2px solid var(--ps-accent)" : $A === !0 &&
|
|
16176
|
+
border: zA ? "2px solid var(--ps-accent)" : $A === !0 && X ? "2px dashed var(--ps-accent)" : "2px dashed var(--ps-border-color)",
|
|
16155
16177
|
borderRadius: "0.5vw",
|
|
16156
16178
|
cursor: zA ? "default" : $A === !0 ? "pointer" : "default",
|
|
16157
16179
|
position: "relative",
|
|
16158
|
-
background: zA ? "var(--ps-bg-secondary)" : $A === !0 &&
|
|
16180
|
+
background: zA ? "var(--ps-bg-secondary)" : $A === !0 && X ? "rgba(33,84,239,0.04)" : $A === null ? "rgba(0,0,0,0.025)" : "var(--ps-bg-secondary)",
|
|
16159
16181
|
transition: "border-color 0.18s, background 0.18s",
|
|
16160
16182
|
overflow: "hidden"
|
|
16161
16183
|
},
|
|
@@ -16208,7 +16230,7 @@ function Pg({
|
|
|
16208
16230
|
{
|
|
16209
16231
|
type: "button",
|
|
16210
16232
|
onClick: (y) => {
|
|
16211
|
-
y.stopPropagation(), we(null),
|
|
16233
|
+
y.stopPropagation(), we(null), T.current?.click();
|
|
16212
16234
|
},
|
|
16213
16235
|
style: {
|
|
16214
16236
|
padding: "0.35vw 0.8vw",
|
|
@@ -16589,7 +16611,7 @@ function Pg({
|
|
|
16589
16611
|
)
|
|
16590
16612
|
] })
|
|
16591
16613
|
] }),
|
|
16592
|
-
/* @__PURE__ */ A("input", { ref:
|
|
16614
|
+
/* @__PURE__ */ A("input", { ref: T, type: "file", accept: "image/*", style: { display: "none" }, onChange: fe }),
|
|
16593
16615
|
K && /* @__PURE__ */ A("p", { className: "ps-bp-error", style: { padding: "0 1.5vw" }, children: K }),
|
|
16594
16616
|
/* @__PURE__ */ e("div", { className: "ps-bp-nav", children: [
|
|
16595
16617
|
/* @__PURE__ */ e("button", { className: "ps-bp-back-btn", onClick: () => b("manual"), type: "button", children: [
|
|
@@ -16819,11 +16841,11 @@ function Pi({
|
|
|
16819
16841
|
HA(() => {
|
|
16820
16842
|
u !== void 0 && wA(u);
|
|
16821
16843
|
}, [u]);
|
|
16822
|
-
const
|
|
16844
|
+
const T = xe(() => Jt(K || void 0), [K]), zA = w ?? T("Virtual Try-On"), [MA, E] = Q(!1);
|
|
16823
16845
|
HA(() => {
|
|
16824
16846
|
E(!0);
|
|
16825
16847
|
}, []);
|
|
16826
|
-
const [
|
|
16848
|
+
const [gA, O] = Q("idle"), [fA, X] = Q(null), [rA, uA] = Q(null), [iA, yA] = Q(null), [RA, mA] = Q(null), [we, $A] = Q(!1), [PA, te] = Q(null), [qA, fe] = Q(null), [vA, ue] = Q({}), $ = QA({});
|
|
16827
16849
|
HA(() => {
|
|
16828
16850
|
$.current = vA;
|
|
16829
16851
|
}, [vA]);
|
|
@@ -16853,9 +16875,9 @@ function Pi({
|
|
|
16853
16875
|
const B = ao(r);
|
|
16854
16876
|
B === "foot" || B === "head" ? pe("cm") : B === "face" && pe("mm");
|
|
16855
16877
|
}, [r]);
|
|
16856
|
-
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()), [
|
|
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) => {
|
|
16857
16879
|
N(B), En(B);
|
|
16858
|
-
}, []), [ce, he] = Q(!1), [YA, f] = Q(null), [
|
|
16880
|
+
}, []), [ce, he] = Q(!1), [YA, f] = Q(null), [j, dA] = Q(null), bA = QA(null), oe = QA(() => !1), be = QA(() => {
|
|
16859
16881
|
}), Le = IA((B, p) => {
|
|
16860
16882
|
oe.current = B, be.current = p;
|
|
16861
16883
|
}, []), $e = QA(null), Oe = QA(null), U = QA(null), hA = QA(null), xA = QA(null), Ie = QA(!1), _e = QA(null), Ue = QA(null), [BA, Ke] = Q(null), [zo, No] = Q(null), We = QA(null), Uo = QA(null), Jo = QA(!1), fo = QA(null);
|
|
@@ -16887,24 +16909,24 @@ function Pi({
|
|
|
16887
16909
|
}, [g, t, s, r]);
|
|
16888
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(""), no = QA(null);
|
|
16889
16911
|
HA(() => {
|
|
16890
|
-
if (
|
|
16912
|
+
if (gA === "processing") {
|
|
16891
16913
|
if (no.current) return;
|
|
16892
16914
|
Ko.current = 0, gg.current = Date.now(), tg.current = "";
|
|
16893
16915
|
const B = [
|
|
16894
|
-
{ at: 0, text:
|
|
16895
|
-
{ at: 15, text:
|
|
16896
|
-
{ at: 30, text:
|
|
16897
|
-
{ at: 50, text:
|
|
16898
|
-
{ at: 75, text:
|
|
16899
|
-
{ at: 90, text:
|
|
16916
|
+
{ at: 0, text: T("Preparing your image...") },
|
|
16917
|
+
{ at: 15, text: T("Analyzing body proportions...") },
|
|
16918
|
+
{ at: 30, text: T("Matching garment to your photo...") },
|
|
16919
|
+
{ at: 50, text: T("Generating virtual try-on...") },
|
|
16920
|
+
{ at: 75, text: T("Refining details...") },
|
|
16921
|
+
{ at: 90, text: T("Almost there...") }
|
|
16900
16922
|
], p = 2 * Math.PI * 38;
|
|
16901
16923
|
return no.current = setInterval(() => {
|
|
16902
16924
|
if (Ie.current) return;
|
|
16903
|
-
const G = gg.current || Date.now(), sA = (Date.now() - G) / 1e3,
|
|
16904
|
-
Ko.current =
|
|
16905
|
-
const AA = Math.round(
|
|
16925
|
+
const G = gg.current || Date.now(), sA = (Date.now() - G) / 1e3, nA = Math.min(95, sA / og * 100);
|
|
16926
|
+
Ko.current = nA;
|
|
16927
|
+
const AA = Math.round(nA);
|
|
16906
16928
|
if (ho.current && (ho.current.style.width = `${AA}%`), vo.current && (vo.current.textContent = `${AA}%`), uo.current) {
|
|
16907
|
-
const k = p * (1 -
|
|
16929
|
+
const k = p * (1 - nA / 100);
|
|
16908
16930
|
uo.current.style.strokeDashoffset = String(k);
|
|
16909
16931
|
}
|
|
16910
16932
|
if (Io.current) {
|
|
@@ -16912,11 +16934,11 @@ function Pi({
|
|
|
16912
16934
|
Io.current.textContent = sA >= og ? "•••" : `~${k}s`;
|
|
16913
16935
|
}
|
|
16914
16936
|
if (Eo.current) {
|
|
16915
|
-
const k = [...B].reverse().find((
|
|
16937
|
+
const k = [...B].reverse().find((R) => AA >= R.at);
|
|
16916
16938
|
if (k && k.text !== tg.current) {
|
|
16917
|
-
const
|
|
16918
|
-
|
|
16919
|
-
|
|
16939
|
+
const R = Eo.current;
|
|
16940
|
+
R.style.opacity = "0", setTimeout(() => {
|
|
16941
|
+
R.textContent = k.text, R.style.opacity = "1";
|
|
16920
16942
|
}, 180), tg.current = k.text;
|
|
16921
16943
|
}
|
|
16922
16944
|
}
|
|
@@ -16925,16 +16947,16 @@ function Pi({
|
|
|
16925
16947
|
};
|
|
16926
16948
|
} else
|
|
16927
16949
|
no.current && (clearInterval(no.current), no.current = null), gg.current = null;
|
|
16928
|
-
}, [
|
|
16950
|
+
}, [gA, T]), HA(() => () => {
|
|
16929
16951
|
rA && URL.revokeObjectURL(rA);
|
|
16930
16952
|
}, [rA]), HA(() => {
|
|
16931
|
-
if (
|
|
16953
|
+
if (gA !== "idle") {
|
|
16932
16954
|
const B = window.scrollY, p = document.body.style.overflow, G = document.body.style.overscrollBehavior;
|
|
16933
16955
|
return document.body.style.overflow = "hidden", document.body.style.overscrollBehavior = "none", () => {
|
|
16934
16956
|
document.body.style.overflow = p, document.body.style.overscrollBehavior = G, window.scrollTo(0, B);
|
|
16935
16957
|
};
|
|
16936
16958
|
}
|
|
16937
|
-
}, [
|
|
16959
|
+
}, [gA]), HA(() => {
|
|
16938
16960
|
oo("profiles", JA);
|
|
16939
16961
|
}, [JA]), HA(() => {
|
|
16940
16962
|
oo("history", SA);
|
|
@@ -16964,7 +16986,7 @@ function Pi({
|
|
|
16964
16986
|
}).finally(() => XA(!1));
|
|
16965
16987
|
}, [s, r, F]);
|
|
16966
16988
|
const ut = xe(() => {
|
|
16967
|
-
switch (
|
|
16989
|
+
switch (gA) {
|
|
16968
16990
|
case "welcome":
|
|
16969
16991
|
case "body-profile":
|
|
16970
16992
|
return 1;
|
|
@@ -16978,10 +17000,10 @@ function Pi({
|
|
|
16978
17000
|
default:
|
|
16979
17001
|
return 1;
|
|
16980
17002
|
}
|
|
16981
|
-
}, [
|
|
17003
|
+
}, [gA]), mo = IA(
|
|
16982
17004
|
(B, p, G) => {
|
|
16983
|
-
let sA = H,
|
|
16984
|
-
if (!
|
|
17005
|
+
let sA = H, nA = JA.find((AA) => AA.id === sA);
|
|
17006
|
+
if (!nA) {
|
|
16985
17007
|
const AA = {
|
|
16986
17008
|
id: Date.now().toString(36) + Math.random().toString(36).slice(2, 6),
|
|
16987
17009
|
name: (B.gender === "female", "My Profile"),
|
|
@@ -16999,7 +17021,7 @@ function Pi({
|
|
|
16999
17021
|
createdAt: Date.now(),
|
|
17000
17022
|
lastUsedAt: Date.now()
|
|
17001
17023
|
};
|
|
17002
|
-
Qe((k) => [AA, ...k]), EA(AA.id), sA = AA.id,
|
|
17024
|
+
Qe((k) => [AA, ...k]), EA(AA.id), sA = AA.id, nA = AA;
|
|
17003
17025
|
}
|
|
17004
17026
|
if (G?.skipBodyEstimate)
|
|
17005
17027
|
console.log("[ps-sdk:persist] skipping body estimates — face/head flow (no body context)");
|
|
@@ -17009,7 +17031,7 @@ function Pi({
|
|
|
17009
17031
|
}
|
|
17010
17032
|
if (NA(!0), p?.recommendedSize && sA) {
|
|
17011
17033
|
const AA = p.sections ? Object.fromEntries(
|
|
17012
|
-
Object.entries(p.sections).map(([k,
|
|
17034
|
+
Object.entries(p.sections).map(([k, R]) => [k, R.recommendedSize])
|
|
17013
17035
|
) : void 0;
|
|
17014
17036
|
rt(sA, {
|
|
17015
17037
|
productId: z,
|
|
@@ -17024,13 +17046,13 @@ function Pi({
|
|
|
17024
17046
|
},
|
|
17025
17047
|
[H, JA, s, o, r, z, EA]
|
|
17026
17048
|
), ng = QA(null), [Po, rg] = Q(null), bg = IA(async (B) => {
|
|
17027
|
-
const p = B.height ?? B.heightCm ?? 0, G = B.weight ?? B.weightKg ?? 0, sA = !!B.measurements && Object.keys(B.measurements).length > 0,
|
|
17028
|
-
if (!sA &&
|
|
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
|
+
if (!sA && nA && p > 0 && ng.current) {
|
|
17029
17051
|
try {
|
|
17030
|
-
const k =
|
|
17052
|
+
const k = nA.startsWith("data:") ? nA : `data:image/jpeg;base64,${nA}`, R = await fetch(k).then((WA) => WA.blob()), aA = new File([R], "profile-photo.jpg", { type: R.type || "image/jpeg" });
|
|
17031
17053
|
await ng.current({
|
|
17032
17054
|
photoFile: aA,
|
|
17033
|
-
photoBase64:
|
|
17055
|
+
photoBase64: nA,
|
|
17034
17056
|
height: p,
|
|
17035
17057
|
weight: G,
|
|
17036
17058
|
heightUnit: B.heightUnit || "cm",
|
|
@@ -17047,9 +17069,9 @@ function Pi({
|
|
|
17047
17069
|
if (AA)
|
|
17048
17070
|
try {
|
|
17049
17071
|
const k = AA.startsWith("data:") ? AA : `data:image/jpeg;base64,${AA}`;
|
|
17050
|
-
fetch(k).then((
|
|
17051
|
-
const aA = new File([
|
|
17052
|
-
|
|
17072
|
+
fetch(k).then((R) => R.blob()).then((R) => {
|
|
17073
|
+
const aA = new File([R], "profile-photo.jpg", { type: R.type || "image/jpeg" });
|
|
17074
|
+
X(aA), We.current = aA, rA && URL.revokeObjectURL(rA), uA(URL.createObjectURL(aA));
|
|
17053
17075
|
}).catch(() => {
|
|
17054
17076
|
});
|
|
17055
17077
|
} catch {
|
|
@@ -17067,7 +17089,7 @@ function Pi({
|
|
|
17067
17089
|
}).catch(() => {
|
|
17068
17090
|
}).finally(() => y(!1));
|
|
17069
17091
|
}, [z, r, o, F, s, rA]), mt = IA(async () => {
|
|
17070
|
-
const B = JA.find((
|
|
17092
|
+
const B = JA.find((nA) => nA.id === H);
|
|
17071
17093
|
if (!B) return;
|
|
17072
17094
|
const p = B.height ?? B.heightCm ?? 0, G = B.weight ?? B.weightKg ?? 0;
|
|
17073
17095
|
p > 0 && G > 0 && rg(B);
|
|
@@ -17081,13 +17103,13 @@ function Pi({
|
|
|
17081
17103
|
}), Ht = IA(() => {
|
|
17082
17104
|
console.log("[ps-sdk] handleOpen fired — opening modal"), O("body-profile"), C?.();
|
|
17083
17105
|
}, [C]), ro = IA(() => {
|
|
17084
|
-
O("idle"),
|
|
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"), io.current = !1, hA.current?.(), hA.current = null, xA.current && (clearInterval(xA.current), xA.current = null), W?.();
|
|
17085
17107
|
}, [W, rA]), Mt = IA(() => {
|
|
17086
17108
|
if (YA) {
|
|
17087
17109
|
f(null), bA.current && (O(bA.current), bA.current = null);
|
|
17088
17110
|
return;
|
|
17089
17111
|
}
|
|
17090
|
-
switch (
|
|
17112
|
+
switch (gA) {
|
|
17091
17113
|
case "body-profile":
|
|
17092
17114
|
ro();
|
|
17093
17115
|
break;
|
|
@@ -17121,23 +17143,23 @@ function Pi({
|
|
|
17121
17143
|
ro();
|
|
17122
17144
|
break;
|
|
17123
17145
|
}
|
|
17124
|
-
}, [
|
|
17146
|
+
}, [gA, YA, qA, ro]), yt = gA !== "idle" && gA !== "processing" && gA !== "result" && gA !== "welcome" && gA !== "body-profile" && gA !== "size-result", ig = IA((B) => {
|
|
17125
17147
|
if (!jt(B)) {
|
|
17126
|
-
mA(
|
|
17148
|
+
mA(T("Please upload a JPEG, PNG, or WebP image.")), O("error"), v?.({ message: "Invalid file type", code: "INVALID_FILE" });
|
|
17127
17149
|
return;
|
|
17128
17150
|
}
|
|
17129
17151
|
if (B.size > 10 * 1024 * 1024) {
|
|
17130
|
-
mA(
|
|
17152
|
+
mA(T("Image must be under 10MB.")), O("error"), v?.({ message: "File too large", code: "FILE_TOO_LARGE" });
|
|
17131
17153
|
return;
|
|
17132
17154
|
}
|
|
17133
|
-
|
|
17155
|
+
X(B), We.current = B, Uo.current = null;
|
|
17134
17156
|
const p = URL.createObjectURL(B);
|
|
17135
17157
|
uA(p), Z?.(B), Ue.current = null, _o(p).then((G) => {
|
|
17136
17158
|
Ue.current = G;
|
|
17137
17159
|
}).catch(() => {
|
|
17138
17160
|
});
|
|
17139
17161
|
}, [Z, v]), xg = IA(() => {
|
|
17140
|
-
|
|
17162
|
+
X(null), rA && URL.revokeObjectURL(rA), uA(null);
|
|
17141
17163
|
}, [rA]), co = IA(() => {
|
|
17142
17164
|
xA.current && (clearInterval(xA.current), xA.current = null), hA.current?.(), hA.current = null;
|
|
17143
17165
|
}, []), sg = IA((B) => {
|
|
@@ -17147,47 +17169,47 @@ function Pi({
|
|
|
17147
17169
|
}
|
|
17148
17170
|
if (B.status === "completed" && B.imageUrl) {
|
|
17149
17171
|
if (yA((p) => !p || p.startsWith("data:") || !B.imageUrl.startsWith("data:") ? B.imageUrl : p), !Ie.current) {
|
|
17150
|
-
if (Ie.current = !0, Ko.current = 100, ho.current && (ho.current.style.width = "100%"), vo.current && (vo.current.textContent = "100%"), uo.current && (uo.current.style.strokeDashoffset = "0"), Io.current && (Io.current.textContent =
|
|
17172
|
+
if (Ie.current = !0, Ko.current = 100, ho.current && (ho.current.style.width = "100%"), vo.current && (vo.current.textContent = "100%"), uo.current && (uo.current.style.strokeDashoffset = "0"), Io.current && (Io.current.textContent = T("Done")), Eo.current) {
|
|
17151
17173
|
const p = Eo.current;
|
|
17152
17174
|
p.style.opacity = "0", setTimeout(() => {
|
|
17153
|
-
p.textContent =
|
|
17175
|
+
p.textContent = T("Complete!"), p.style.opacity = "1";
|
|
17154
17176
|
}, 180);
|
|
17155
17177
|
}
|
|
17156
17178
|
co(), re(!1), te(null), b?.({ jobId: B.galleryId, imageUrl: B.imageUrl });
|
|
17157
17179
|
}
|
|
17158
17180
|
} else if (B.status === "failed" && !Ie.current) {
|
|
17159
17181
|
Ie.current = !0, co(), re(!1), te(null);
|
|
17160
|
-
const p = B.error ||
|
|
17182
|
+
const p = B.error || T("Try-on generation failed");
|
|
17161
17183
|
mA(p), O("error"), v?.({ message: p });
|
|
17162
17184
|
}
|
|
17163
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) => {
|
|
17164
17186
|
if (!Oe.current) return;
|
|
17165
|
-
const p = B || ne, G = je(s), sA = Re(),
|
|
17166
|
-
if (
|
|
17167
|
-
const k = I.current,
|
|
17187
|
+
const p = B || ne, G = je(s), sA = Re(), nA = ao(r);
|
|
17188
|
+
if (nA === "face" || nA === "head") {
|
|
17189
|
+
const k = I.current, R = (cA) => {
|
|
17168
17190
|
if (!cA) return;
|
|
17169
17191
|
const se = parseFloat(cA);
|
|
17170
17192
|
return Number.isFinite(se) && se > 0 ? se : void 0;
|
|
17171
|
-
}, aA = k.sizingUnit || Ae || (
|
|
17193
|
+
}, aA = k.sizingUnit || Ae || (nA === "head" ? "cm" : "mm"), WA = (cA) => {
|
|
17172
17194
|
if (cA != null)
|
|
17173
17195
|
return aA === "mm" ? cA : aA === "cm" ? cA * 10 : aA === "in" ? cA * 25.4 : cA;
|
|
17174
17196
|
}, DA = {}, ge = {
|
|
17175
|
-
bridgeWidth: WA(
|
|
17176
|
-
templeLength: WA(
|
|
17177
|
-
lensWidth: WA(
|
|
17178
|
-
lensHeight: WA(
|
|
17179
|
-
faceWidth: WA(
|
|
17180
|
-
pd: WA(
|
|
17197
|
+
bridgeWidth: WA(R(k.bridgeWidth)),
|
|
17198
|
+
templeLength: WA(R(k.templeLength) ?? R(k.armLength)),
|
|
17199
|
+
lensWidth: WA(R(k.lensWidth)),
|
|
17200
|
+
lensHeight: WA(R(k.lensHeight)),
|
|
17201
|
+
faceWidth: WA(R(k.faceWidth) ?? R(k.frameWidth)),
|
|
17202
|
+
pd: WA(R(k.pd)),
|
|
17181
17203
|
// Headwear — circumference usually typed in cm; keep as mm internally.
|
|
17182
|
-
headCircumference: WA(
|
|
17183
|
-
headWidth: WA(
|
|
17204
|
+
headCircumference: WA(R(k.headCircumference)),
|
|
17205
|
+
headWidth: WA(R(k.headWidth))
|
|
17184
17206
|
};
|
|
17185
17207
|
for (const [cA, se] of Object.entries(ge)) typeof se == "number" && (DA[cA] = se);
|
|
17186
17208
|
const VA = {
|
|
17187
17209
|
product: { title: r, productId: a },
|
|
17188
17210
|
sizeGuide: V?.found ? V : { found: !1 },
|
|
17189
|
-
sizingUnit:
|
|
17190
|
-
category:
|
|
17211
|
+
sizingUnit: nA === "head" ? "cm" : "mm",
|
|
17212
|
+
category: nA,
|
|
17191
17213
|
...Object.keys(DA).length > 0 && { faceMeasurementsMm: DA, irisConfidence: 1 }
|
|
17192
17214
|
}, ie = new Promise((cA) => setTimeout(cA, 4500));
|
|
17193
17215
|
try {
|
|
@@ -17201,10 +17223,10 @@ function Pi({
|
|
|
17201
17223
|
await ie, _A(se), b?.(se);
|
|
17202
17224
|
} else {
|
|
17203
17225
|
const se = await cA.text().catch(() => "");
|
|
17204
|
-
console.error("[PS-SDK] face-recommend failed:", cA.status, se), await ie, mA(
|
|
17226
|
+
console.error("[PS-SDK] face-recommend failed:", cA.status, se), await ie, mA(T("Unable to get size recommendation. Please try again.")), O("error"), NA(!0);
|
|
17205
17227
|
}
|
|
17206
17228
|
} catch (cA) {
|
|
17207
|
-
console.error("[PS-SDK] face-recommend network error:", cA), await ie, mA(
|
|
17229
|
+
console.error("[PS-SDK] face-recommend network error:", cA), await ie, mA(T("Unable to connect to sizing service. Please try again.")), O("error"), NA(!0);
|
|
17208
17230
|
} finally {
|
|
17209
17231
|
y(!1);
|
|
17210
17232
|
}
|
|
@@ -17216,13 +17238,13 @@ function Pi({
|
|
|
17216
17238
|
product: { title: r, productId: z, description: "", variants: [] }
|
|
17217
17239
|
};
|
|
17218
17240
|
if (V?.found && (AA.sizeGuide = V, V.sections && (AA.sizeGuide = { ...V, sections: V.sections })), AA.sizingUnit = Ae, console.log("[PS-SDK] sizeGuide state:", JSON.stringify({ found: V?.found, hasHeaders: !!V?.headers, hasRows: !!V?.rows, headers: V?.headers, rowCount: V?.rows?.length, hasSections: !!V?.sections, sectionNames: V?.sections ? Object.keys(V.sections) : [] })), console.log("[PS-SDK] payload.sizeGuide:", AA.sizeGuide ? "present" : "MISSING"), console.log("[PS-SDK] payload.sizeGuide row0 type:", AA.sizeGuide && AA.sizeGuide.rows?.[0] ? Array.isArray(AA.sizeGuide.rows[0]) ? "array" : typeof AA.sizeGuide.rows[0] : "none"), console.log("[PS-SDK] payload:", JSON.stringify(AA).substring(0, 1e3)), console.log("[PS-SDK] ── submitSizing START ──"), console.log("[PS-SDK] method:", p, "| sizingUnit:", Ae, "| heightUnit:", LA), console.log("[PS-SDK] formRef.current (all keys):", JSON.stringify(I.current)), console.log("[PS-SDK] dynamicFields:", Ao.map((k) => `${k.key}(unit=${k.unit},req=${k.required})`).join(", ")), p === "exact") {
|
|
17219
|
-
const k = { gender: I.current.gender || "male", sizingUnit: Ae },
|
|
17241
|
+
const k = { gender: I.current.gender || "male", sizingUnit: Ae }, R = /* @__PURE__ */ new Set();
|
|
17220
17242
|
for (const aA of Ao)
|
|
17221
|
-
aA.unit !== "size" && !["shoeEU", "shoeUS", "shoeUK"].includes(aA.key) &&
|
|
17243
|
+
aA.unit !== "size" && !["shoeEU", "shoeUS", "shoeUK"].includes(aA.key) && R.add(aA.key);
|
|
17222
17244
|
for (const aA of ["chest", "bust", "waist", "hips", "shoulderWidth", "sleeveLength", "inseam", "neckCircumference", "footLengthCm", "height", "length", "thighCircumference", "headCircumferenceCm", "faceWidthMm", "bridgeWidthMm", "templeLengthMm"])
|
|
17223
|
-
I.current[aA] &&
|
|
17224
|
-
console.log("[PS-SDK] numericKeys:", [...
|
|
17225
|
-
for (const aA of
|
|
17245
|
+
I.current[aA] && R.add(aA);
|
|
17246
|
+
console.log("[PS-SDK] numericKeys:", [...R].join(", "));
|
|
17247
|
+
for (const aA of R) {
|
|
17226
17248
|
const WA = I.current[aA];
|
|
17227
17249
|
if (!WA) continue;
|
|
17228
17250
|
const DA = parseFloat(WA);
|
|
@@ -17230,14 +17252,14 @@ function Pi({
|
|
|
17230
17252
|
}
|
|
17231
17253
|
I.current.shoeEU && (k.shoeEU = I.current.shoeEU), I.current.shoeUS && (k.shoeUS = I.current.shoeUS), I.current.shoeUK && (k.shoeUK = I.current.shoeUK), I.current.fitPreference && (k.fitPreference = I.current.fitPreference), AA.measurements = k, console.log("[PS-SDK] FINAL measurements:", JSON.stringify(k));
|
|
17232
17254
|
} else {
|
|
17233
|
-
const k = parseFloat(I.current.height || "0"),
|
|
17234
|
-
if (!k || !
|
|
17235
|
-
console.error("[PS-SDK] submitSizing ABORT — qHeight:", k, "qWeight:",
|
|
17255
|
+
const k = parseFloat(I.current.height || "0"), R = parseFloat(I.current.weight || "0");
|
|
17256
|
+
if (!k || !R) {
|
|
17257
|
+
console.error("[PS-SDK] submitSizing ABORT — qHeight:", k, "qWeight:", R, "formRef:", JSON.stringify(I.current)), y(!1);
|
|
17236
17258
|
return;
|
|
17237
17259
|
}
|
|
17238
17260
|
const aA = {
|
|
17239
17261
|
height: k,
|
|
17240
|
-
weight:
|
|
17262
|
+
weight: R,
|
|
17241
17263
|
heightUnit: I.current.heightUnit || LA || "cm",
|
|
17242
17264
|
weightUnit: I.current.weightUnit || FA || "kg",
|
|
17243
17265
|
gender: I.current.gender || "male"
|
|
@@ -17246,8 +17268,8 @@ function Pi({
|
|
|
17246
17268
|
}
|
|
17247
17269
|
NA(!1);
|
|
17248
17270
|
try {
|
|
17249
|
-
const k = Date.now(),
|
|
17250
|
-
console.log(`[ps-sdk:T] ▶ POST /sizing/recommend (quick) payload=${Math.round(
|
|
17271
|
+
const k = Date.now(), R = JSON.stringify(AA).length;
|
|
17272
|
+
console.log(`[ps-sdk:T] ▶ POST /sizing/recommend (quick) payload=${Math.round(R / 1024)}KB bodyImage=${!!AA.bodyImage}`);
|
|
17251
17273
|
const aA = await fetch(`${G}/api/v1/sizing/recommend`, {
|
|
17252
17274
|
method: "POST",
|
|
17253
17275
|
headers: { "Content-Type": "application/json", Authorization: `Bearer ${sA}` },
|
|
@@ -17277,16 +17299,16 @@ function Pi({
|
|
|
17277
17299
|
);
|
|
17278
17300
|
} else {
|
|
17279
17301
|
const WA = await aA.text().catch(() => "");
|
|
17280
|
-
console.error("[PS-SDK] Sizing recommend failed:", aA.status, WA), mA(
|
|
17302
|
+
console.error("[PS-SDK] Sizing recommend failed:", aA.status, WA), mA(T("Unable to get size recommendation. Please try again.")), O("error"), NA(!0);
|
|
17281
17303
|
}
|
|
17282
17304
|
} catch (k) {
|
|
17283
|
-
console.error("[PS-SDK] Sizing recommend network error:", k), mA(
|
|
17305
|
+
console.error("[PS-SDK] Sizing recommend network error:", k), mA(T("Unable to connect to sizing service. Please try again.")), O("error"), NA(!0);
|
|
17284
17306
|
} finally {
|
|
17285
17307
|
y(!1);
|
|
17286
17308
|
}
|
|
17287
|
-
}, [s, ne, pA, LA, FA, Ae, V, r, Ao, mo]), Ft = IA(async (B, p, G, sA,
|
|
17309
|
+
}, [s, ne, pA, LA, FA, Ae, V, r, Ao, mo]), Ft = IA(async (B, p, G, sA, nA, AA, k, R, aA, WA, DA) => {
|
|
17288
17310
|
if (!Oe.current) {
|
|
17289
|
-
const cA =
|
|
17311
|
+
const cA = T("SDK not configured. Please refresh and try again.");
|
|
17290
17312
|
console.warn("[ps-sdk] handleQuickEstimate BAILED — apiRef is null. API key not loaded."), mA(cA), O("error"), v?.({ message: cA, code: "SDK_NOT_CONFIGURED" });
|
|
17291
17313
|
return;
|
|
17292
17314
|
}
|
|
@@ -17301,34 +17323,34 @@ function Pi({
|
|
|
17301
17323
|
for (const cA of Ao)
|
|
17302
17324
|
cA.required && cA.unit === "cm" && !ge.has(cA.key) && VA.add(cA.key);
|
|
17303
17325
|
const ie = Array.from(VA);
|
|
17304
|
-
if (console.log("[PS-SDK] Quick estimate — dynamicFields:", Ao.map((cA) => `${cA.key}(${cA.unit},req=${cA.required})`)), console.log("[PS-SDK] Quick estimate — requiredFieldKeys:", ie), console.log("[PS-SDK] Quick estimate — profiles:", { chestProfile:
|
|
17305
|
-
console.warn("[PS-SDK] No body measurement fields found — skipping estimation review"), rA && URL.revokeObjectURL(rA),
|
|
17326
|
+
if (console.log("[PS-SDK] Quick estimate — dynamicFields:", Ao.map((cA) => `${cA.key}(${cA.unit},req=${cA.required})`)), console.log("[PS-SDK] Quick estimate — requiredFieldKeys:", ie), console.log("[PS-SDK] Quick estimate — profiles:", { chestProfile: R, midsectionProfile: aA, hipProfile: WA }), ie.length === 0) {
|
|
17327
|
+
console.warn("[PS-SDK] No body measurement fields found — skipping estimation review"), rA && URL.revokeObjectURL(rA), X(null), We.current = null, uA(null), Ke(null), No(null), le("quick"), y(!0), O("size-result"), bo("quick");
|
|
17306
17328
|
return;
|
|
17307
17329
|
}
|
|
17308
|
-
I.current.height = String(B), I.current.weight = String(p), I.current.heightUnit = G, I.current.weightUnit = sA, I.current.gender =
|
|
17330
|
+
I.current.height = String(B), I.current.weight = String(p), I.current.heightUnit = G, I.current.weightUnit = sA, I.current.gender = nA, AA && (I.current.age = String(AA)), k && (I.current.bodyType = k), R && (I.current.chestProfile = R), aA && (I.current.midsectionProfile = aA), WA && (I.current.hipProfile = WA), _A(null), yA(null), rA && URL.revokeObjectURL(rA), X(null), We.current = null, uA(null), Ke(null), No(null), le("quick"), y(!0), O("size-result"), bo("quick");
|
|
17309
17331
|
}, [s, Ao, V, bo, Ae, FA, rA]), ag = IA(async (B) => {
|
|
17310
17332
|
if (console.log("[ps-sdk] handleSnapSubmit fired", {
|
|
17311
17333
|
hasApiRef: !!Oe.current,
|
|
17312
17334
|
hasSseRef: !!U.current,
|
|
17313
17335
|
apiUrl: s
|
|
17314
17336
|
}), !Oe.current || !U.current) {
|
|
17315
|
-
const DA =
|
|
17337
|
+
const DA = T("SDK not configured. Please refresh and try again.");
|
|
17316
17338
|
console.warn("[ps-sdk] handleSnapSubmit BAILED — apiRef or sseRef is null. Check api init."), mA(DA), O("error"), v?.({ message: DA, code: "SDK_NOT_CONFIGURED" });
|
|
17317
17339
|
return;
|
|
17318
17340
|
}
|
|
17319
17341
|
const p = je(s), G = Re();
|
|
17320
|
-
console.log("[ps-sdk] handleSnapSubmit calling backend", { baseUrl: p }),
|
|
17342
|
+
console.log("[ps-sdk] handleSnapSubmit calling backend", { baseUrl: p }), X(B.photoFile), We.current = B.photoFile;
|
|
17321
17343
|
const sA = B.photoFile ? URL.createObjectURL(B.photoFile) : B.photoBase64.startsWith("data:") ? B.photoBase64 : `data:image/jpeg;base64,${B.photoBase64}`;
|
|
17322
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");
|
|
17323
|
-
const
|
|
17324
|
-
if (
|
|
17345
|
+
const nA = ao(r);
|
|
17346
|
+
if (nA === "face" || nA === "head") {
|
|
17325
17347
|
No(null);
|
|
17326
17348
|
const DA = new Promise((ge) => setTimeout(ge, 4500));
|
|
17327
17349
|
try {
|
|
17328
17350
|
const ge = await cn(sA);
|
|
17329
17351
|
if (!ge) {
|
|
17330
17352
|
console.warn("[ps-sdk] face detection returned no result — likely a full-body photo for a face/head product"), await DA;
|
|
17331
|
-
const cA =
|
|
17353
|
+
const cA = T(nA === "head" ? "We couldn't detect your head clearly. Please upload a close-up photo that shows your full head and ears." : "We couldn't detect your face clearly. Please upload a close-up selfie that shows both eyes.");
|
|
17332
17354
|
mA(cA), O("error"), v?.({ message: cA, code: "FACE_DETECTION_FAILED" }), y(!1);
|
|
17333
17355
|
return;
|
|
17334
17356
|
}
|
|
@@ -17336,8 +17358,8 @@ function Pi({
|
|
|
17336
17358
|
const VA = {
|
|
17337
17359
|
product: { title: r, productId: z },
|
|
17338
17360
|
sizeGuide: V ?? { found: !1 },
|
|
17339
|
-
sizingUnit:
|
|
17340
|
-
category:
|
|
17361
|
+
sizingUnit: nA === "head" ? "cm" : "mm",
|
|
17362
|
+
category: nA,
|
|
17341
17363
|
bodyImage: B.photoBase64
|
|
17342
17364
|
};
|
|
17343
17365
|
ge && (VA.faceMeasurementsMm = ge.measurementsMm, VA.faceLandmarks = ge.landmarks, VA.irisConfidence = ge.irisConfidence);
|
|
@@ -17370,11 +17392,11 @@ function Pi({
|
|
|
17370
17392
|
return;
|
|
17371
17393
|
}
|
|
17372
17394
|
Ue.current = null, Ke(null), _o(sA).then((DA) => (Ue.current = DA, DA)).catch(() => null);
|
|
17373
|
-
const AA = Bo(sA).then((DA) => (Ke(DA), DA)).catch(() => null), k = 8e3,
|
|
17395
|
+
const AA = Bo(sA).then((DA) => (Ke(DA), DA)).catch(() => null), k = 8e3, R = await Promise.race([
|
|
17374
17396
|
AA,
|
|
17375
17397
|
new Promise((DA) => setTimeout(() => DA(null), k))
|
|
17376
17398
|
]);
|
|
17377
|
-
|
|
17399
|
+
R || console.log("[ps-sdk] landmarks not ready in", k, "ms — proceeding without them"), bn(R);
|
|
17378
17400
|
const aA = {
|
|
17379
17401
|
method: "photo",
|
|
17380
17402
|
locale: pA,
|
|
@@ -17384,7 +17406,7 @@ function Pi({
|
|
|
17384
17406
|
// BlazePose landmarks (normalized 0–1 coordinates). The backend uses
|
|
17385
17407
|
// these to compute exact pixel distances and feed them to Gemini as
|
|
17386
17408
|
// anchors instead of asking it to estimate visually.
|
|
17387
|
-
bodyLandmarks:
|
|
17409
|
+
bodyLandmarks: R || void 0,
|
|
17388
17410
|
measurements: {
|
|
17389
17411
|
gender: B.gender,
|
|
17390
17412
|
height: B.height,
|
|
@@ -17460,23 +17482,23 @@ function Pi({
|
|
|
17460
17482
|
const xo = IA(async (B) => {
|
|
17461
17483
|
const p = B || fA || We.current;
|
|
17462
17484
|
if (!p || !Oe.current || !U.current) {
|
|
17463
|
-
const AA = Oe.current ?
|
|
17485
|
+
const AA = Oe.current ? T("Please upload a photo first.") : T("SDK not configured. Please provide an API key.");
|
|
17464
17486
|
mA(AA), O("error"), v?.({ message: AA, code: "SDK_NOT_CONFIGURED" });
|
|
17465
17487
|
return;
|
|
17466
17488
|
}
|
|
17467
|
-
B && B !== fA && (
|
|
17468
|
-
const G = mi(ao(r)), sA = G === "apparel",
|
|
17469
|
-
(B || !rA) && uA(
|
|
17489
|
+
B && B !== fA && (X(B), We.current = B), Ie.current = !1, re(!0), te(Date.now());
|
|
17490
|
+
const G = mi(ao(r)), sA = G === "apparel", nA = (B ? null : rA) || URL.createObjectURL(p);
|
|
17491
|
+
(B || !rA) && uA(nA), sA && (!Ue.current || !BA) && (Ue.current = null, Ke(null), _o(nA).then((AA) => {
|
|
17470
17492
|
Ue.current = AA;
|
|
17471
17493
|
}).catch(() => {
|
|
17472
|
-
}), Bo(
|
|
17494
|
+
}), Bo(nA).then((AA) => {
|
|
17473
17495
|
Ke(AA);
|
|
17474
17496
|
}).catch(() => {
|
|
17475
17497
|
}));
|
|
17476
17498
|
try {
|
|
17477
|
-
const AA = await Do(p, sA ? { maxDimension: 1024, quality: 0.85 } : {}), k = $.current,
|
|
17499
|
+
const AA = await Do(p, sA ? { maxDimension: 1024, quality: 0.85 } : {}), k = $.current, R = Object.keys(k), aA = R.length > 0, WA = aA ? (() => {
|
|
17478
17500
|
const OA = /* @__PURE__ */ new Set(), ze = [];
|
|
17479
|
-
for (const so of
|
|
17501
|
+
for (const so of R) {
|
|
17480
17502
|
const Ne = k[so]?.matchDetails || [];
|
|
17481
17503
|
for (const lo of Ne) {
|
|
17482
17504
|
const So = lo.measurement.toLowerCase().trim();
|
|
@@ -17484,14 +17506,14 @@ function Pi({
|
|
|
17484
17506
|
}
|
|
17485
17507
|
}
|
|
17486
17508
|
return ze;
|
|
17487
|
-
})() : null, DA = aA ?
|
|
17509
|
+
})() : null, DA = aA ? R.map((OA) => `${OA.replace(/\s*[—–-]\s*.*/g, "").trim()} ${k[OA].displayLabel}`).join(", ") : void 0, ge = aA ? {
|
|
17488
17510
|
selectedSize: DA ?? "",
|
|
17489
17511
|
displayLabel: DA ?? "",
|
|
17490
17512
|
matchDetails: WA ?? void 0
|
|
17491
17513
|
} : null;
|
|
17492
17514
|
console.log("[ps-sdk:tryon] reading pendingCustomSizesRef at submit", {
|
|
17493
|
-
sectionCount:
|
|
17494
|
-
sections:
|
|
17515
|
+
sectionCount: R.length,
|
|
17516
|
+
sections: R,
|
|
17495
17517
|
compositeDisplayLabel: DA,
|
|
17496
17518
|
mergedOverrideMdCount: WA?.length ?? 0,
|
|
17497
17519
|
mergedOverrideMdPreview: WA?.map((OA) => ({ area: OA.measurement, chartRange: OA.chartRange }))
|
|
@@ -17580,8 +17602,8 @@ function Pi({
|
|
|
17580
17602
|
}
|
|
17581
17603
|
}, 3e3);
|
|
17582
17604
|
} catch (AA) {
|
|
17583
|
-
const k = AA instanceof Error ? AA.message :
|
|
17584
|
-
mA(k), O("error"), v?.({ message: k, code:
|
|
17605
|
+
const k = AA instanceof Error ? AA.message : T("Failed to start try-on"), R = AA instanceof jg ? AA.code : void 0;
|
|
17606
|
+
mA(k), O("error"), v?.({ message: k, code: R });
|
|
17585
17607
|
}
|
|
17586
17608
|
}, [fA, o, r, CA, i, v, sg]);
|
|
17587
17609
|
HA(() => {
|
|
@@ -17602,15 +17624,15 @@ function Pi({
|
|
|
17602
17624
|
G.href = p, G.download = `primestyle-tryon-${Date.now()}.png`, G.click(), setTimeout(() => URL.revokeObjectURL(p), 100);
|
|
17603
17625
|
}).catch(() => window.open(iA, "_blank"));
|
|
17604
17626
|
}, [iA]), Yt = IA(() => {
|
|
17605
|
-
Ie.current = !1, co(),
|
|
17627
|
+
Ie.current = !1, co(), X(null), rA && URL.revokeObjectURL(rA), uA(null), yA(null), mA(null), le(null), _A(null), y(!1), he(!1), O("body-profile");
|
|
17606
17628
|
}, [rA, co]), Gt = IA((B) => {
|
|
17607
17629
|
const p = JA.find((sA) => sA.id === B);
|
|
17608
17630
|
if (!p) return;
|
|
17609
|
-
EA(B), Qe((sA) => sA.map((
|
|
17631
|
+
EA(B), Qe((sA) => sA.map((nA) => nA.id === B ? { ...nA, lastUsedAt: Date.now() } : nA));
|
|
17610
17632
|
const G = { gender: p.gender || "male" };
|
|
17611
17633
|
if ((p.height ?? p.heightCm) && (G.height = String(p.height ?? p.heightCm)), (p.weight ?? p.weightKg) && (G.weight = String(p.weight ?? p.weightKg)), p.chest && (G.chest = String(p.chest)), p.bust && (G.bust = String(p.bust)), p.waist && (G.waist = String(p.waist)), p.hips && (G.hips = String(p.hips)), p.shoulderWidth && (G.shoulderWidth = String(p.shoulderWidth)), p.sleeveLength && (G.sleeveLength = String(p.sleeveLength)), p.inseam && (G.inseam = String(p.inseam)), p.neckCircumference && (G.neckCircumference = String(p.neckCircumference)), p.footLengthCm && (G.footLengthCm = String(p.footLengthCm)), p.shoeEU && (G.shoeEU = p.shoeEU), p.shoeUS && (G.shoeUS = p.shoeUS), p.shoeUK && (G.shoeUK = p.shoeUK), p.fitPreference && (G.fitPreference = p.fitPreference), p.customMeasurements)
|
|
17612
|
-
for (const [sA,
|
|
17613
|
-
G[sA] = String(
|
|
17634
|
+
for (const [sA, nA] of Object.entries(p.customMeasurements))
|
|
17635
|
+
G[sA] = String(nA);
|
|
17614
17636
|
I.current = G, oA(G.gender || "male"), p.country && UA(p.country), p.sizingUnit && pe(p.sizingUnit), p.heightUnit && Ce(p.heightUnit), p.weightUnit && lA(p.weightUnit), me((sA) => sA + 1);
|
|
17615
17637
|
}, [JA]);
|
|
17616
17638
|
xt.current = Gt, IA((B, p) => {
|
|
@@ -17638,7 +17660,7 @@ function Pi({
|
|
|
17638
17660
|
heightUnit: LA,
|
|
17639
17661
|
weightUnit: FA,
|
|
17640
17662
|
createdAt: Date.now()
|
|
17641
|
-
},
|
|
17663
|
+
}, nA = /* @__PURE__ */ new Set([
|
|
17642
17664
|
"chest",
|
|
17643
17665
|
"bust",
|
|
17644
17666
|
"waist",
|
|
@@ -17658,13 +17680,13 @@ function Pi({
|
|
|
17658
17680
|
"heightFeet",
|
|
17659
17681
|
"heightInches"
|
|
17660
17682
|
]), AA = {};
|
|
17661
|
-
for (const [k,
|
|
17662
|
-
!
|
|
17683
|
+
for (const [k, R] of Object.entries(I.current))
|
|
17684
|
+
!nA.has(k) && R && !isNaN(Number(R)) && (AA[k] = parseFloat(R));
|
|
17663
17685
|
Object.keys(AA).length > 0 && (sA.customMeasurements = AA), Qe((k) => {
|
|
17664
|
-
const
|
|
17665
|
-
if (
|
|
17686
|
+
const R = k.findIndex((aA) => aA.id === G);
|
|
17687
|
+
if (R >= 0) {
|
|
17666
17688
|
const aA = [...k];
|
|
17667
|
-
return aA[
|
|
17689
|
+
return aA[R] = sA, aA;
|
|
17668
17690
|
}
|
|
17669
17691
|
return [...k, sA].slice(-50);
|
|
17670
17692
|
}), EA(G), he(!0);
|
|
@@ -17675,16 +17697,16 @@ function Pi({
|
|
|
17675
17697
|
const G = fA || We.current;
|
|
17676
17698
|
if (G)
|
|
17677
17699
|
try {
|
|
17678
|
-
const
|
|
17700
|
+
const R = await Do(G, { maxDimension: 768, quality: 0.7 }), aA = await (await fetch(R)).blob();
|
|
17679
17701
|
p = await Rg(B, aA);
|
|
17680
17702
|
} catch {
|
|
17681
17703
|
}
|
|
17682
|
-
const sA = $.current,
|
|
17683
|
-
sectionName:
|
|
17684
|
-
selectedSize:
|
|
17685
|
-
selectedLength:
|
|
17686
|
-
displayLabel:
|
|
17687
|
-
isOverride: !!
|
|
17704
|
+
const sA = $.current, nA = CA?.recommendedSize ?? "", AA = Object.values(sA).map((R) => ({
|
|
17705
|
+
sectionName: R.sectionName,
|
|
17706
|
+
selectedSize: R.selectedSize,
|
|
17707
|
+
selectedLength: R.selectedLength,
|
|
17708
|
+
displayLabel: R.displayLabel,
|
|
17709
|
+
isOverride: !!nA && R.selectedSize !== nA
|
|
17688
17710
|
})), k = {
|
|
17689
17711
|
id: B,
|
|
17690
17712
|
productTitle: r,
|
|
@@ -17709,48 +17731,48 @@ function Pi({
|
|
|
17709
17731
|
selectedSizes: AA.length ? AA : void 0
|
|
17710
17732
|
};
|
|
17711
17733
|
if (H) {
|
|
17712
|
-
const
|
|
17713
|
-
|
|
17734
|
+
const R = JA.find((aA) => aA.id === H);
|
|
17735
|
+
R && (k.profileName = R.name);
|
|
17714
17736
|
}
|
|
17715
|
-
P((
|
|
17716
|
-
const aA = [k, ...
|
|
17737
|
+
P((R) => {
|
|
17738
|
+
const aA = [k, ...R].slice(0, 50), WA = new Set(aA.map((DA) => DA.id));
|
|
17717
17739
|
return Vt(WA), aA;
|
|
17718
17740
|
});
|
|
17719
17741
|
}, [r, o, iA, CA, V, H, JA, fA]), io = QA(!1), Ho = QA(!1);
|
|
17720
17742
|
HA(() => {
|
|
17721
|
-
if (
|
|
17743
|
+
if (gA === "size-result" && CA && !io.current)
|
|
17722
17744
|
io.current = !0, Ho.current = !1, Hg().catch(() => {
|
|
17723
17745
|
});
|
|
17724
|
-
else if (
|
|
17746
|
+
else if (gA === "size-result" && CA && iA && !Ho.current) {
|
|
17725
17747
|
Ho.current = !0;
|
|
17726
|
-
const B = $.current, p = CA?.recommendedSize ?? "", G = Object.values(B).map((
|
|
17727
|
-
sectionName:
|
|
17728
|
-
selectedSize:
|
|
17729
|
-
selectedLength:
|
|
17730
|
-
displayLabel:
|
|
17731
|
-
isOverride: !!p &&
|
|
17748
|
+
const B = $.current, p = CA?.recommendedSize ?? "", G = Object.values(B).map((nA) => ({
|
|
17749
|
+
sectionName: nA.sectionName,
|
|
17750
|
+
selectedSize: nA.selectedSize,
|
|
17751
|
+
selectedLength: nA.selectedLength,
|
|
17752
|
+
displayLabel: nA.displayLabel,
|
|
17753
|
+
isOverride: !!p && nA.selectedSize !== p
|
|
17732
17754
|
}));
|
|
17733
17755
|
let sA = null;
|
|
17734
|
-
if (P((
|
|
17735
|
-
...
|
|
17756
|
+
if (P((nA) => nA.length === 0 ? nA : (sA = nA[0].id, [{
|
|
17757
|
+
...nA[0],
|
|
17736
17758
|
resultImageUrl: iA,
|
|
17737
17759
|
hasResult: !0,
|
|
17738
17760
|
...G.length ? { selectedSizes: G } : {}
|
|
17739
|
-
}, ...
|
|
17740
|
-
const
|
|
17761
|
+
}, ...nA.slice(1)])), sA) {
|
|
17762
|
+
const nA = sA;
|
|
17741
17763
|
(async () => {
|
|
17742
17764
|
try {
|
|
17743
17765
|
const AA = await fetch(iA);
|
|
17744
17766
|
if (!AA.ok) return;
|
|
17745
17767
|
const k = await AA.blob();
|
|
17746
|
-
await Xt(
|
|
17768
|
+
await Xt(nA, k);
|
|
17747
17769
|
} catch {
|
|
17748
17770
|
}
|
|
17749
17771
|
})();
|
|
17750
17772
|
}
|
|
17751
|
-
} else
|
|
17752
|
-
})) : (
|
|
17753
|
-
}, [
|
|
17773
|
+
} else gA === "result" && iA && !io.current ? (io.current = !0, Hg().catch(() => {
|
|
17774
|
+
})) : (gA === "welcome" || gA === "body-profile") && (io.current = !1, Ho.current = !1);
|
|
17775
|
+
}, [gA, CA, iA]);
|
|
17754
17776
|
const Lt = IA((B) => {
|
|
17755
17777
|
if (io.current = !0, Ho.current = !!B.resultImageUrl, Jo.current = !0, B.sizingResult ? _A(B.sizingResult) : B.recommendedSize && _A({
|
|
17756
17778
|
recommendedSize: B.recommendedSize,
|
|
@@ -17765,7 +17787,7 @@ function Pi({
|
|
|
17765
17787
|
}), B.hasPhoto && Tg(B.id).then((p) => {
|
|
17766
17788
|
if (!p) return;
|
|
17767
17789
|
const G = new File([p], `history-photo-${B.id}.jpg`, { type: p.type || "image/jpeg" });
|
|
17768
|
-
|
|
17790
|
+
X(G), We.current = G;
|
|
17769
17791
|
}), B.selectedSizes && B.selectedSizes.length) {
|
|
17770
17792
|
const p = {};
|
|
17771
17793
|
for (const G of B.selectedSizes)
|
|
@@ -17787,8 +17809,8 @@ function Pi({
|
|
|
17787
17809
|
UK: { key: "shoeUK", labelKey: "Shoe size (UK)", ph: "e.g. 9" },
|
|
17788
17810
|
AU: { key: "shoeUK", labelKey: "Shoe size (UK)", ph: "e.g. 9" }
|
|
17789
17811
|
}[pA] || { key: "shoeEU", labelKey: "Shoe size (EU)", ph: "e.g. 43" };
|
|
17790
|
-
return { key: p.key, label:
|
|
17791
|
-
}, [pA,
|
|
17812
|
+
return { key: p.key, label: T(p.labelKey), ph: p.ph };
|
|
17813
|
+
}, [pA, T]);
|
|
17792
17814
|
const zt = {
|
|
17793
17815
|
"--ps-btn-bg": m.backgroundColor,
|
|
17794
17816
|
"--ps-btn-color": m.textColor,
|
|
@@ -17841,21 +17863,21 @@ function Pi({
|
|
|
17841
17863
|
"--ps-logo-height": M.logoHeight
|
|
17842
17864
|
}, Mg = Object.fromEntries(Object.entries(zt).filter(([, B]) => B !== void 0));
|
|
17843
17865
|
function Nt() {
|
|
17844
|
-
switch (
|
|
17866
|
+
switch (gA) {
|
|
17845
17867
|
case "welcome":
|
|
17846
|
-
return /* @__PURE__ */ A("div", { className: "ps-tryon-view-enter", children: /* @__PURE__ */ A(Wn, { productImage: o, setView: O, t:
|
|
17868
|
+
return /* @__PURE__ */ A("div", { className: "ps-tryon-view-enter", children: /* @__PURE__ */ A(Wn, { productImage: o, setView: O, t: T }) }, "v-welcome");
|
|
17847
17869
|
case "body-profile": {
|
|
17848
|
-
const B = ao(r), p = { productImage: o, productTitle: r, formRef: I, sizingUnit: Ae, setSizingUnit: pe, setSizingMethod: le, setSizingLoading: y, setView: O, submitSizing: bo, onSnapSubmit: ag, onBack: ro, apiUrl: je(s), apiKey: Re(), sizeGuide: V, t:
|
|
17870
|
+
const B = ao(r), p = { productImage: o, productTitle: r, formRef: I, sizingUnit: Ae, setSizingUnit: pe, setSizingMethod: le, setSizingLoading: y, setView: O, submitSizing: bo, onSnapSubmit: ag, onBack: ro, apiUrl: je(s), apiKey: Re(), sizeGuide: V, t: T };
|
|
17849
17871
|
if (B === "foot") return /* @__PURE__ */ A("div", { className: "ps-tryon-view-enter", children: /* @__PURE__ */ A(di, { ...p }) }, "v-foot");
|
|
17850
17872
|
if (B === "head") return /* @__PURE__ */ A("div", { className: "ps-tryon-view-enter", children: /* @__PURE__ */ A(fi, { ...p }) }, "v-head");
|
|
17851
17873
|
if (B === "face") return /* @__PURE__ */ A("div", { className: "ps-tryon-view-enter", children: /* @__PURE__ */ A(Ii, { ...p }) }, "v-face");
|
|
17852
|
-
const G = !!(V?.requiredFields?.some((k) => k.key === "bust") || V?.sections && Object.values(V.sections).some((k) => k.requiredFields?.some((
|
|
17874
|
+
const G = !!(V?.requiredFields?.some((k) => k.key === "bust") || V?.sections && Object.values(V.sections).some((k) => k.requiredFields?.some((R) => R.key === "bust"))), sA = r.toLowerCase(), nA = /\b(women|woman|ladies|female|dress|skirt|blouse|bra)\b/i.test(sA);
|
|
17853
17875
|
return /* @__PURE__ */ A("div", { className: "ps-tryon-view-enter", children: /* @__PURE__ */ A(
|
|
17854
17876
|
li,
|
|
17855
17877
|
{
|
|
17856
17878
|
productImage: o,
|
|
17857
17879
|
productTitle: r,
|
|
17858
|
-
isWomen: G ||
|
|
17880
|
+
isWomen: G || nA,
|
|
17859
17881
|
formRef: I,
|
|
17860
17882
|
sizingCountry: pA,
|
|
17861
17883
|
heightUnit: LA,
|
|
@@ -17869,11 +17891,11 @@ function Pi({
|
|
|
17869
17891
|
hasActiveProfileWithMeasurements: (() => {
|
|
17870
17892
|
const k = JA.find((WA) => WA.id === H);
|
|
17871
17893
|
if (!k) return !1;
|
|
17872
|
-
const
|
|
17873
|
-
return
|
|
17894
|
+
const R = k.height ?? k.heightCm ?? 0, aA = k.weight ?? k.weightKg ?? 0;
|
|
17895
|
+
return R > 0 && aA > 0;
|
|
17874
17896
|
})(),
|
|
17875
17897
|
onUseActiveProfile: mt,
|
|
17876
|
-
activeProfileName: JA.find((
|
|
17898
|
+
activeProfileName: JA.find((R) => R.id === H)?.name || null,
|
|
17877
17899
|
activeProfile: JA.find((k) => k.id === H) || null,
|
|
17878
17900
|
onStartFresh: () => {
|
|
17879
17901
|
EA(null), I.current = {};
|
|
@@ -17897,7 +17919,7 @@ function Pi({
|
|
|
17897
17919
|
Ee(!0), ag(k);
|
|
17898
17920
|
},
|
|
17899
17921
|
onBack: ro,
|
|
17900
|
-
t:
|
|
17922
|
+
t: T
|
|
17901
17923
|
},
|
|
17902
17924
|
`bp-${H || "anon"}`
|
|
17903
17925
|
) }, "v-bodyprofile");
|
|
@@ -17922,7 +17944,7 @@ function Pi({
|
|
|
17922
17944
|
setSizingLoading: y,
|
|
17923
17945
|
setView: O,
|
|
17924
17946
|
submitSizing: bo,
|
|
17925
|
-
t:
|
|
17947
|
+
t: T
|
|
17926
17948
|
}
|
|
17927
17949
|
) }, "v-est-review");
|
|
17928
17950
|
case "size-result":
|
|
@@ -17956,18 +17978,18 @@ function Pi({
|
|
|
17956
17978
|
activeSection: qA,
|
|
17957
17979
|
setActiveSection: fe,
|
|
17958
17980
|
onResetTryOn: () => {
|
|
17959
|
-
|
|
17981
|
+
X(null), rA && URL.revokeObjectURL(rA), uA(null), yA(null);
|
|
17960
17982
|
},
|
|
17961
17983
|
onClose: ro,
|
|
17962
17984
|
userHeightCm: (() => {
|
|
17963
|
-
const B = JA.find((
|
|
17985
|
+
const B = JA.find((nA) => nA.id === H);
|
|
17964
17986
|
if (!B) return;
|
|
17965
17987
|
const p = B.height ?? B.heightCm;
|
|
17966
17988
|
if (!p || p <= 0) return;
|
|
17967
17989
|
const G = B.heightUnit, sA = CA?.unit || Ae;
|
|
17968
17990
|
return (G === "in" || G === "ft") && sA !== "in" ? Math.round(p * 2.54) : (!G || G === "cm") && sA === "in" ? Math.round(p / 2.54 * 10) / 10 : p;
|
|
17969
17991
|
})(),
|
|
17970
|
-
t:
|
|
17992
|
+
t: T
|
|
17971
17993
|
}
|
|
17972
17994
|
) }, "v-sizeresult");
|
|
17973
17995
|
case "upload":
|
|
@@ -17983,7 +18005,7 @@ function Pi({
|
|
|
17983
18005
|
handleRemovePreview: xg,
|
|
17984
18006
|
handleTryOnSubmit: xo,
|
|
17985
18007
|
cn: L,
|
|
17986
|
-
t:
|
|
18008
|
+
t: T
|
|
17987
18009
|
}
|
|
17988
18010
|
) }, "v-upload");
|
|
17989
18011
|
case "processing":
|
|
@@ -18004,7 +18026,7 @@ function Pi({
|
|
|
18004
18026
|
O("size-result"), re(!1);
|
|
18005
18027
|
},
|
|
18006
18028
|
cn: L,
|
|
18007
|
-
t:
|
|
18029
|
+
t: T
|
|
18008
18030
|
}
|
|
18009
18031
|
) }, "v-proc");
|
|
18010
18032
|
case "result":
|
|
@@ -18063,11 +18085,11 @@ function Pi({
|
|
|
18063
18085
|
lastUsedAt: Date.now()
|
|
18064
18086
|
}, G = [p, ...JA];
|
|
18065
18087
|
oo("profiles", G), Qe(G), EA(p.id);
|
|
18066
|
-
const sA = p.heightCm || p.height || 0,
|
|
18067
|
-
!(!!p.measurements && Object.keys(p.measurements).length > 0) && (
|
|
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) => Lg({
|
|
18068
18090
|
apiUrl: s,
|
|
18069
18091
|
height: sA > 0 ? sA : void 0,
|
|
18070
|
-
weight:
|
|
18092
|
+
weight: nA > 0 ? nA : void 0,
|
|
18071
18093
|
heightUnit: AA,
|
|
18072
18094
|
weightUnit: k,
|
|
18073
18095
|
gender: p.gender,
|
|
@@ -18075,7 +18097,7 @@ function Pi({
|
|
|
18075
18097
|
chestProfile: p.chestProfile,
|
|
18076
18098
|
midsectionProfile: p.midsectionProfile,
|
|
18077
18099
|
hipProfile: p.hipProfile,
|
|
18078
|
-
bodyImage:
|
|
18100
|
+
bodyImage: R,
|
|
18079
18101
|
bodyLandmarks: DA ?? void 0
|
|
18080
18102
|
})).then((DA) => {
|
|
18081
18103
|
if (DA) {
|
|
@@ -18102,7 +18124,7 @@ function Pi({
|
|
|
18102
18124
|
onRequestDelete: (B) => ee(B),
|
|
18103
18125
|
onClose: () => O("body-profile"),
|
|
18104
18126
|
onRegisterBackInterceptor: Le,
|
|
18105
|
-
t:
|
|
18127
|
+
t: T
|
|
18106
18128
|
}
|
|
18107
18129
|
) }, "v-profiles");
|
|
18108
18130
|
case "error":
|
|
@@ -18112,7 +18134,7 @@ function Pi({
|
|
|
18112
18134
|
errorMessage: RA,
|
|
18113
18135
|
handleRetry: Yt,
|
|
18114
18136
|
cn: L,
|
|
18115
|
-
t:
|
|
18137
|
+
t: T
|
|
18116
18138
|
}
|
|
18117
18139
|
) }, "v-error");
|
|
18118
18140
|
case "no-chart":
|
|
@@ -18124,7 +18146,7 @@ function Pi({
|
|
|
18124
18146
|
onTryOn: () => O("photo-guide"),
|
|
18125
18147
|
onClose: W ?? (() => {
|
|
18126
18148
|
}),
|
|
18127
|
-
t:
|
|
18149
|
+
t: T
|
|
18128
18150
|
}
|
|
18129
18151
|
) }, "v-nochart");
|
|
18130
18152
|
case "photo-guide":
|
|
@@ -18138,7 +18160,7 @@ function Pi({
|
|
|
18138
18160
|
onSubmit: (B) => {
|
|
18139
18161
|
ig(B), xo(B);
|
|
18140
18162
|
},
|
|
18141
|
-
t:
|
|
18163
|
+
t: T
|
|
18142
18164
|
}
|
|
18143
18165
|
) }, "v-photoguide");
|
|
18144
18166
|
default:
|
|
@@ -18160,26 +18182,26 @@ function Pi({
|
|
|
18160
18182
|
]
|
|
18161
18183
|
}
|
|
18162
18184
|
),
|
|
18163
|
-
|
|
18164
|
-
/* @__PURE__ */ A("div", { className: Ye("ps-tryon-overlay", L.overlay), style: Mg, "data-ps-tryon-portal": !0, children: /* @__PURE__ */ e("div", { className: Ye(`ps-tryon-modal${
|
|
18185
|
+
gA !== "idle" && typeof document < "u" && hg(
|
|
18186
|
+
/* @__PURE__ */ A("div", { className: Ye("ps-tryon-overlay", L.overlay), style: Mg, "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: [
|
|
18165
18187
|
/* @__PURE__ */ e("div", { className: Ye("ps-tryon-header ps-tryon-header-minimal", L.header), children: [
|
|
18166
18188
|
/* @__PURE__ */ A(Kn, { activeLocale: K, onSelect: wA }),
|
|
18167
|
-
/* @__PURE__ */ A("button", { className: "ps-tryon-header-icon", title:
|
|
18168
|
-
YA && f(null),
|
|
18189
|
+
/* @__PURE__ */ A("button", { className: "ps-tryon-header-icon", title: T("Profiles"), onClick: () => {
|
|
18190
|
+
YA && f(null), gA === "profiles" ? (O(bA.current || "body-profile"), bA.current = null) : (bA.current = gA, O("profiles"));
|
|
18169
18191
|
}, children: /* @__PURE__ */ A(ug, {}) }),
|
|
18170
|
-
/* @__PURE__ */ A("button", { className: "ps-tryon-header-icon", title:
|
|
18171
|
-
|
|
18192
|
+
/* @__PURE__ */ A("button", { className: "ps-tryon-header-icon", title: T("History"), onClick: () => {
|
|
18193
|
+
gA === "profiles" && (O(bA.current || "body-profile"), bA.current = null), YA === "history" ? f(null) : (bA.current = bA.current || gA, f("history"));
|
|
18172
18194
|
}, children: /* @__PURE__ */ A(Gn, {}) }),
|
|
18173
18195
|
/* @__PURE__ */ A("button", { onClick: ro, className: Ye("ps-tryon-close", L.closeButton), children: /* @__PURE__ */ A(at, {}) })
|
|
18174
18196
|
] }),
|
|
18175
|
-
|
|
18197
|
+
gA !== "body-profile" && gA !== "processing" && !(gA === "size-result" && V?.sections && Object.keys(V.sections).length > 1) && /* @__PURE__ */ A(Jn, { view: gA, stepIndex: ut }),
|
|
18176
18198
|
/* @__PURE__ */ e("div", { ref: _e, className: Ye("ps-tryon-body", L.body), style: { position: "relative", overflow: YA ? "hidden" : void 0 }, children: [
|
|
18177
18199
|
yt && /* @__PURE__ */ e("button", { className: "ps-tryon-back-btn", onClick: Mt, children: [
|
|
18178
18200
|
/* @__PURE__ */ e("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
18179
18201
|
/* @__PURE__ */ A("line", { x1: "17", y1: "6", x2: "1", y2: "6" }),
|
|
18180
18202
|
/* @__PURE__ */ A("polyline", { points: "5 1 1 6 5 11" })
|
|
18181
18203
|
] }),
|
|
18182
|
-
|
|
18204
|
+
T("Back")
|
|
18183
18205
|
] }),
|
|
18184
18206
|
Nt(),
|
|
18185
18207
|
/* @__PURE__ */ A(
|
|
@@ -18193,19 +18215,19 @@ function Pi({
|
|
|
18193
18215
|
setHistory: P,
|
|
18194
18216
|
setProfileDetail: dA,
|
|
18195
18217
|
restoreHistory: Lt,
|
|
18196
|
-
t:
|
|
18218
|
+
t: T
|
|
18197
18219
|
}
|
|
18198
18220
|
)
|
|
18199
18221
|
] }),
|
|
18200
|
-
|
|
18222
|
+
tA && /* @__PURE__ */ A(
|
|
18201
18223
|
Vr,
|
|
18202
18224
|
{
|
|
18203
18225
|
onConfirm: () => {
|
|
18204
|
-
const B =
|
|
18226
|
+
const B = tA, p = Je("profiles", []).filter((G) => G.id !== B);
|
|
18205
18227
|
oo("profiles", p), Qe(p), H === B && EA(null), ee(null);
|
|
18206
18228
|
},
|
|
18207
18229
|
onCancel: () => ee(null),
|
|
18208
|
-
t:
|
|
18230
|
+
t: T
|
|
18209
18231
|
}
|
|
18210
18232
|
),
|
|
18211
18233
|
Po && /* @__PURE__ */ A(
|
|
@@ -18214,7 +18236,7 @@ function Pi({
|
|
|
18214
18236
|
profile: Po,
|
|
18215
18237
|
onProceed: Pt,
|
|
18216
18238
|
onEdit: bt,
|
|
18217
|
-
t:
|
|
18239
|
+
t: T
|
|
18218
18240
|
}
|
|
18219
18241
|
)
|
|
18220
18242
|
] }) }),
|
|
@@ -18223,12 +18245,12 @@ function Pi({
|
|
|
18223
18245
|
/* @__PURE__ */ A(
|
|
18224
18246
|
Tn,
|
|
18225
18247
|
{
|
|
18226
|
-
profileDetail:
|
|
18248
|
+
profileDetail: j,
|
|
18227
18249
|
setProfileDetail: dA,
|
|
18228
18250
|
setProfiles: Qe,
|
|
18229
18251
|
activeProfileId: H,
|
|
18230
18252
|
setActiveProfileId: EA,
|
|
18231
|
-
t:
|
|
18253
|
+
t: T
|
|
18232
18254
|
}
|
|
18233
18255
|
)
|
|
18234
18256
|
] });
|