@primestyleai/tryon 5.10.140 → 5.10.141
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
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { P as Tg, L as Gg, b as Jt, d as
|
|
2
|
+
import { P as Tg, L as Gg, b as Jt, d as tg, a as uo, c as Kt, A as St, S as jt, i as Rt } from "../index-GW10cktY.js";
|
|
3
3
|
import { jsxs as e, jsx as A, Fragment as _ } from "react/jsx-runtime";
|
|
4
4
|
import { useState as f, useRef as QA, useCallback as bA, useEffect as xA, useMemo as He } from "react";
|
|
5
5
|
import { createPortal as vg } from "react-dom";
|
|
6
6
|
const Tt = "primestyle-photos", no = "photos", Xt = 1;
|
|
7
|
-
let
|
|
7
|
+
let Vo = null;
|
|
8
8
|
function Eg() {
|
|
9
|
-
return
|
|
9
|
+
return Vo || (Vo = new Promise((o) => {
|
|
10
10
|
try {
|
|
11
11
|
if (typeof indexedDB > "u") return o(null);
|
|
12
12
|
const g = indexedDB.open(Tt, Xt);
|
|
@@ -17,7 +17,7 @@ function Eg() {
|
|
|
17
17
|
} catch {
|
|
18
18
|
o(null);
|
|
19
19
|
}
|
|
20
|
-
}),
|
|
20
|
+
}), Vo);
|
|
21
21
|
}
|
|
22
22
|
const Ig = "result-";
|
|
23
23
|
async function Xg(o, g) {
|
|
@@ -69,10 +69,10 @@ async function qt(o) {
|
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
const Vg = 11, qg = 12, Zt = 13, $t = 14, _t = 15, An = 16, Zg = 23, $g = 24, en = 25, on = 26, gn = 27, tn = 28, nn = 0;
|
|
72
|
-
let
|
|
72
|
+
let gg = null, qo = null;
|
|
73
73
|
async function _g() {
|
|
74
|
-
if (!
|
|
75
|
-
return
|
|
74
|
+
if (!gg)
|
|
75
|
+
return qo || (qo = (async () => {
|
|
76
76
|
const o = await import(
|
|
77
77
|
/* webpackIgnore: true */
|
|
78
78
|
// @ts-ignore dynamic CDN import
|
|
@@ -80,7 +80,7 @@ async function _g() {
|
|
|
80
80
|
), { FilesetResolver: g, PoseLandmarker: t } = o, i = await g.forVisionTasks(
|
|
81
81
|
"https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.33/wasm"
|
|
82
82
|
);
|
|
83
|
-
|
|
83
|
+
gg = await t.createFromOptions(i, {
|
|
84
84
|
baseOptions: {
|
|
85
85
|
modelAssetPath: "https://storage.googleapis.com/mediapipe-models/pose_landmarker/pose_landmarker_lite/float16/1/pose_landmarker_lite.task",
|
|
86
86
|
delegate: "GPU"
|
|
@@ -88,12 +88,12 @@ async function _g() {
|
|
|
88
88
|
runningMode: "IMAGE",
|
|
89
89
|
numPoses: 1
|
|
90
90
|
});
|
|
91
|
-
})(),
|
|
91
|
+
})(), qo);
|
|
92
92
|
}
|
|
93
|
-
async function
|
|
93
|
+
async function og(o) {
|
|
94
94
|
try {
|
|
95
95
|
await _g();
|
|
96
|
-
const g = await At(o), t =
|
|
96
|
+
const g = await At(o), t = gg.detect(g);
|
|
97
97
|
if (!t?.landmarks?.length || t.landmarks[0].length < 25)
|
|
98
98
|
return null;
|
|
99
99
|
const i = t.landmarks[0], a = i[Vg], c = i[qg], n = i[Zg], w = i[$g], r = (a.y + c.y) / 2, p = (n.y + w.y) / 2, Q = p - r, C = r + Q * 0.28, I = Math.abs(c.x - a.x), u = Math.min(a.x, c.x) - I * 0.05, M = Math.max(a.x, c.x) + I * 0.05, L = Math.abs(w.x - n.x), G = Math.min(n.x, w.x) - L * 0.15, v = Math.max(n.x, w.x) + L * 0.15, l = C + (p - C) * 0.55, R = I * 0.85, V = (a.x + c.x + n.x + w.x) / 4, s = V - R / 2, m = V + R / 2;
|
|
@@ -128,7 +128,7 @@ async function po(o) {
|
|
|
128
128
|
await _g();
|
|
129
129
|
let g;
|
|
130
130
|
typeof o == "string" ? g = await At(o) : g = o;
|
|
131
|
-
const t = await rn(g, 1024), i = t.width || g.naturalWidth || g.width, a = t.height || g.naturalHeight || g.height, c =
|
|
131
|
+
const t = await rn(g, 1024), i = t.width || g.naturalWidth || g.width, a = t.height || g.naturalHeight || g.height, c = gg.detect(t);
|
|
132
132
|
if (!c?.landmarks?.length || c.landmarks[0].length < 29)
|
|
133
133
|
return console.warn("[PS-SDK:MediaPipe] detection returned no usable landmarks", {
|
|
134
134
|
gotLandmarks: !!c?.landmarks?.length,
|
|
@@ -9354,7 +9354,7 @@ function Ug({
|
|
|
9354
9354
|
/* @__PURE__ */ A("div", { className: "ps-bpm-spacer" })
|
|
9355
9355
|
] });
|
|
9356
9356
|
}
|
|
9357
|
-
const
|
|
9357
|
+
const Zo = 22;
|
|
9358
9358
|
function Io({
|
|
9359
9359
|
tryOnStartedAt: o,
|
|
9360
9360
|
t: g
|
|
@@ -9365,7 +9365,7 @@ function Io({
|
|
|
9365
9365
|
const C = setInterval(() => t((I) => I + 1), 200);
|
|
9366
9366
|
return () => clearInterval(C);
|
|
9367
9367
|
}, [o]), o == null) return null;
|
|
9368
|
-
const i = (Date.now() - o) / 1e3, a = Math.min(95, i /
|
|
9368
|
+
const i = (Date.now() - o) / 1e3, a = Math.min(95, i / Zo * 100), c = Math.round(a), n = Math.max(0, Zo - Math.floor(i)), w = i >= Zo ? g("almost done") : `~${n}s ${g("left")}`, r = [
|
|
9369
9369
|
g("Preparing your image"),
|
|
9370
9370
|
g("Analyzing body proportions"),
|
|
9371
9371
|
g("Mapping garment to body"),
|
|
@@ -9373,7 +9373,7 @@ function Io({
|
|
|
9373
9373
|
g("Almost done")
|
|
9374
9374
|
], p = Math.min(
|
|
9375
9375
|
r.length - 1,
|
|
9376
|
-
Math.floor(i /
|
|
9376
|
+
Math.floor(i / Zo * r.length)
|
|
9377
9377
|
), Q = r[p];
|
|
9378
9378
|
return /* @__PURE__ */ e("div", { className: "ps-tryon-badge", role: "status", "aria-live": "polite", children: [
|
|
9379
9379
|
/* @__PURE__ */ e("div", { className: "ps-tryon-badge-row", children: [
|
|
@@ -9840,7 +9840,7 @@ function ci({ landmarks: o, imgWidth: g, imgHeight: t }) {
|
|
|
9840
9840
|
] }, C))
|
|
9841
9841
|
] });
|
|
9842
9842
|
}
|
|
9843
|
-
function
|
|
9843
|
+
function $o({ active: o }) {
|
|
9844
9844
|
return o ? /* @__PURE__ */ e(_, { children: [
|
|
9845
9845
|
/* @__PURE__ */ A("div", { className: "ps-tryon-scan-overlay" }),
|
|
9846
9846
|
/* @__PURE__ */ A("div", { className: "ps-tryon-scan-line" })
|
|
@@ -9967,7 +9967,7 @@ function pg(o, g) {
|
|
|
9967
9967
|
return a === t || t.includes(a) || a.includes(t);
|
|
9968
9968
|
}) || null;
|
|
9969
9969
|
}
|
|
9970
|
-
function
|
|
9970
|
+
function _o({
|
|
9971
9971
|
sectionName: o,
|
|
9972
9972
|
section: g,
|
|
9973
9973
|
sectionResult: t,
|
|
@@ -10820,7 +10820,7 @@ function pi({
|
|
|
10820
10820
|
de(null), ge(!1);
|
|
10821
10821
|
return;
|
|
10822
10822
|
}
|
|
10823
|
-
ge(!1),
|
|
10823
|
+
ge(!1), og(i).then((x) => {
|
|
10824
10824
|
de(x), ge(!0);
|
|
10825
10825
|
}).catch(() => {
|
|
10826
10826
|
ge(!0);
|
|
@@ -11025,7 +11025,7 @@ function pi({
|
|
|
11025
11025
|
return x ? Ae ? /* @__PURE__ */ e(_, { children: [
|
|
11026
11026
|
Pe && /* @__PURE__ */ A("div", { style: { padding: "0 16px" }, children: Pe }),
|
|
11027
11027
|
/* @__PURE__ */ A(
|
|
11028
|
-
|
|
11028
|
+
_o,
|
|
11029
11029
|
{
|
|
11030
11030
|
sectionName: x.name,
|
|
11031
11031
|
section: x.section,
|
|
@@ -11051,7 +11051,7 @@ function pi({
|
|
|
11051
11051
|
onImageLoad: he,
|
|
11052
11052
|
overlayNode: v ? /* @__PURE__ */ e(_, { children: [
|
|
11053
11053
|
/* @__PURE__ */ A(Io, { tryOnStartedAt: l ?? null, t: h }),
|
|
11054
|
-
/* @__PURE__ */ A(
|
|
11054
|
+
/* @__PURE__ */ A($o, { active: !0 })
|
|
11055
11055
|
] }) : i && pA && ne ? /* @__PURE__ */ A(
|
|
11056
11056
|
zo,
|
|
11057
11057
|
{
|
|
@@ -11088,12 +11088,12 @@ function pi({
|
|
|
11088
11088
|
}
|
|
11089
11089
|
),
|
|
11090
11090
|
v && /* @__PURE__ */ A(Io, { tryOnStartedAt: l ?? null, t: h }),
|
|
11091
|
-
/* @__PURE__ */ A(
|
|
11091
|
+
/* @__PURE__ */ A($o, { active: !!v })
|
|
11092
11092
|
] }),
|
|
11093
11093
|
/* @__PURE__ */ e("div", { className: "ps-tryon-v2-panel", children: [
|
|
11094
11094
|
Pe,
|
|
11095
11095
|
/* @__PURE__ */ A(
|
|
11096
|
-
|
|
11096
|
+
_o,
|
|
11097
11097
|
{
|
|
11098
11098
|
sectionName: x.name,
|
|
11099
11099
|
section: x.section,
|
|
@@ -11175,7 +11175,7 @@ function pi({
|
|
|
11175
11175
|
/* @__PURE__ */ e("div", { className: "ps-tryon-v2-bg", style: { position: "relative" }, children: [
|
|
11176
11176
|
/* @__PURE__ */ A("img", { src: v && u ? u : i || a, alt: n, className: "ps-tryon-v2-bg-img", onLoad: he }),
|
|
11177
11177
|
v && /* @__PURE__ */ A(Io, { tryOnStartedAt: l ?? null, t: h }),
|
|
11178
|
-
/* @__PURE__ */ A(
|
|
11178
|
+
/* @__PURE__ */ A($o, { active: !!v }),
|
|
11179
11179
|
i && !v && pA && ne && /* @__PURE__ */ A(zo, { lines: ne, fitRows: (() => {
|
|
11180
11180
|
const x = [...g?.matchDetails || []];
|
|
11181
11181
|
if (g?.sections)
|
|
@@ -11302,7 +11302,7 @@ function pi({
|
|
|
11302
11302
|
return Ae ? /* @__PURE__ */ e(_, { children: [
|
|
11303
11303
|
Pe && /* @__PURE__ */ A("div", { style: { padding: "0 16px" }, children: Pe }),
|
|
11304
11304
|
/* @__PURE__ */ A(
|
|
11305
|
-
|
|
11305
|
+
_o,
|
|
11306
11306
|
{
|
|
11307
11307
|
sectionName: K,
|
|
11308
11308
|
section: x,
|
|
@@ -11355,7 +11355,7 @@ function pi({
|
|
|
11355
11355
|
}
|
|
11356
11356
|
),
|
|
11357
11357
|
v && /* @__PURE__ */ A(Io, { tryOnStartedAt: l ?? null, t: h }),
|
|
11358
|
-
/* @__PURE__ */ A(
|
|
11358
|
+
/* @__PURE__ */ A($o, { active: !!v }),
|
|
11359
11359
|
i && !v && pA && ne && /* @__PURE__ */ A(zo, { lines: ne, fitRows: (g?.matchDetails || []).map(($) => ({ area: $.measurement, userNum: parseFloat($.userValue) || 0, chartLabel: $.chartRange || "", fit: $.fit })), show: Z, imgWidth: jA.w, imgHeight: jA.h }),
|
|
11360
11360
|
i && !v && /* @__PURE__ */ e("div", { style: { position: "absolute", bottom: "0.5vw", left: "0.5vw", zIndex: 3, display: "flex", flexDirection: "column", gap: "0.3vw" }, children: [
|
|
11361
11361
|
!PA && /* @__PURE__ */ A("button", { className: "ps-tryon-sr-glass-btn", onClick: () => me(!Z), children: h(Z ? "Hide Fit" : "Show Fit") }),
|
|
@@ -11367,7 +11367,7 @@ function pi({
|
|
|
11367
11367
|
E === K ? (
|
|
11368
11368
|
/* DETAIL VIEW — full size table, same as multi-garment */
|
|
11369
11369
|
/* @__PURE__ */ A(
|
|
11370
|
-
|
|
11370
|
+
_o,
|
|
11371
11371
|
{
|
|
11372
11372
|
sectionName: K,
|
|
11373
11373
|
section: x,
|
|
@@ -11885,7 +11885,7 @@ function Sg({
|
|
|
11885
11885
|
if (o && g) {
|
|
11886
11886
|
v(!0), R(C("Analyzing photo…"));
|
|
11887
11887
|
try {
|
|
11888
|
-
const vA = await
|
|
11888
|
+
const vA = await tg(N, o, g);
|
|
11889
11889
|
if (!vA.isAdult) {
|
|
11890
11890
|
const S = vA.reasoning?.trim() || C("This photo appears to be of a minor. Please upload a photo of someone 18 or older.");
|
|
11891
11891
|
s(S), v(!1), R("");
|
|
@@ -12450,7 +12450,7 @@ function Se({
|
|
|
12450
12450
|
}
|
|
12451
12451
|
);
|
|
12452
12452
|
}
|
|
12453
|
-
function
|
|
12453
|
+
function Ag({
|
|
12454
12454
|
stepKey: o,
|
|
12455
12455
|
title: g,
|
|
12456
12456
|
subtitle: t,
|
|
@@ -12503,7 +12503,7 @@ function Ui({ onSave: o, onCancel: g, apiUrl: t, apiKey: i, onPhotoPreview: a, o
|
|
|
12503
12503
|
}
|
|
12504
12504
|
S(""), YA(!0), HA(n("Analyzing photo…"));
|
|
12505
12505
|
try {
|
|
12506
|
-
const hA = t && i ?
|
|
12506
|
+
const hA = t && i ? tg(W, t, i) : Promise.resolve({ isAdult: !0, confidence: "low" }), uA = uo(W), ee = await hA;
|
|
12507
12507
|
if (!ee.isAdult) {
|
|
12508
12508
|
const Me = ee.reasoning?.trim() || n("This photo appears to be of a minor. Please upload a photo of someone 18 or older.");
|
|
12509
12509
|
_A(Me);
|
|
@@ -12943,7 +12943,7 @@ function Ui({ onSave: o, onCancel: g, apiUrl: t, apiKey: i, onPhotoPreview: a, o
|
|
|
12943
12943
|
vA && /* @__PURE__ */ A("div", { className: "ps-cpw-error", children: vA })
|
|
12944
12944
|
] }, "manual-identity"),
|
|
12945
12945
|
w === "manual" && p === "chest" && !q && /* @__PURE__ */ e(
|
|
12946
|
-
|
|
12946
|
+
Ag,
|
|
12947
12947
|
{
|
|
12948
12948
|
stepKey: "chest",
|
|
12949
12949
|
title: n("CHEST PROFILE"),
|
|
@@ -12956,7 +12956,7 @@ function Ui({ onSave: o, onCancel: g, apiUrl: t, apiKey: i, onPhotoPreview: a, o
|
|
|
12956
12956
|
}
|
|
12957
12957
|
),
|
|
12958
12958
|
w === "manual" && p === "stomach" && /* @__PURE__ */ e(
|
|
12959
|
-
|
|
12959
|
+
Ag,
|
|
12960
12960
|
{
|
|
12961
12961
|
stepKey: "stomach",
|
|
12962
12962
|
title: n("STOMACH PROFILE"),
|
|
@@ -12969,7 +12969,7 @@ function Ui({ onSave: o, onCancel: g, apiUrl: t, apiKey: i, onPhotoPreview: a, o
|
|
|
12969
12969
|
}
|
|
12970
12970
|
),
|
|
12971
12971
|
w === "manual" && p === "seat" && /* @__PURE__ */ e(
|
|
12972
|
-
|
|
12972
|
+
Ag,
|
|
12973
12973
|
{
|
|
12974
12974
|
stepKey: "seat",
|
|
12975
12975
|
title: n("BACK & SEAT"),
|
|
@@ -12982,7 +12982,7 @@ function Ui({ onSave: o, onCancel: g, apiUrl: t, apiKey: i, onPhotoPreview: a, o
|
|
|
12982
12982
|
}
|
|
12983
12983
|
),
|
|
12984
12984
|
w === "manual" && p === "hips" && q && kA.hips && /* @__PURE__ */ e(
|
|
12985
|
-
|
|
12985
|
+
Ag,
|
|
12986
12986
|
{
|
|
12987
12987
|
stepKey: "hips",
|
|
12988
12988
|
title: n("HIP PROFILE"),
|
|
@@ -14676,7 +14676,7 @@ function ut({
|
|
|
14676
14676
|
] })
|
|
14677
14677
|
] });
|
|
14678
14678
|
}
|
|
14679
|
-
function
|
|
14679
|
+
function eg({
|
|
14680
14680
|
stepNumber: o,
|
|
14681
14681
|
totalSteps: g,
|
|
14682
14682
|
title: t,
|
|
@@ -14892,7 +14892,7 @@ function pr({
|
|
|
14892
14892
|
const le = URL.createObjectURL(dA);
|
|
14893
14893
|
pA(le);
|
|
14894
14894
|
try {
|
|
14895
|
-
const be = C && I ?
|
|
14895
|
+
const be = C && I ? tg(dA, C, I) : Promise.resolve({ isAdult: !0, confidence: "low" }), eo = uo(dA, { maxDimension: 1024, quality: 0.85 }), Ve = await be;
|
|
14896
14896
|
if (!Ve.isAdult) {
|
|
14897
14897
|
const qe = Ve.reasoning?.trim() || s("This photo appears to be of a minor. Please upload a photo of someone 18 or older.");
|
|
14898
14898
|
ke(qe), pA(null), ne(null);
|
|
@@ -15972,7 +15972,7 @@ function pr({
|
|
|
15972
15972
|
] }, "step-basics");
|
|
15973
15973
|
})(),
|
|
15974
15974
|
E === "chest" && !t && (O ? /* @__PURE__ */ A(
|
|
15975
|
-
|
|
15975
|
+
eg,
|
|
15976
15976
|
{
|
|
15977
15977
|
stepNumber: m.indexOf("chest") + 1,
|
|
15978
15978
|
totalSteps: m.length,
|
|
@@ -15997,7 +15997,7 @@ function pr({
|
|
|
15997
15997
|
/* @__PURE__ */ A("p", { className: "ps-bp-hover-hint", children: Qe || " " })
|
|
15998
15998
|
] }, "step-chest")),
|
|
15999
15999
|
E === "midsection" && (O ? /* @__PURE__ */ A(
|
|
16000
|
-
|
|
16000
|
+
eg,
|
|
16001
16001
|
{
|
|
16002
16002
|
stepNumber: m.indexOf("midsection") + 1,
|
|
16003
16003
|
totalSteps: m.length,
|
|
@@ -16030,7 +16030,7 @@ function pr({
|
|
|
16030
16030
|
/* @__PURE__ */ A("p", { className: "ps-bp-hover-hint", children: Qe || " " })
|
|
16031
16031
|
] }, "step-midsection")),
|
|
16032
16032
|
E === "seat" && (O ? /* @__PURE__ */ A(
|
|
16033
|
-
|
|
16033
|
+
eg,
|
|
16034
16034
|
{
|
|
16035
16035
|
stepNumber: m.indexOf("seat") + 1,
|
|
16036
16036
|
totalSteps: m.length,
|
|
@@ -16063,7 +16063,7 @@ function pr({
|
|
|
16063
16063
|
/* @__PURE__ */ A("p", { className: "ps-bp-hover-hint", children: Qe || " " })
|
|
16064
16064
|
] }, "step-seat")),
|
|
16065
16065
|
E === "hips" && t && (O ? /* @__PURE__ */ A(
|
|
16066
|
-
|
|
16066
|
+
eg,
|
|
16067
16067
|
{
|
|
16068
16068
|
stepNumber: m.indexOf("hips") + 1,
|
|
16069
16069
|
totalSteps: m.length,
|
|
@@ -16224,7 +16224,7 @@ function xg({
|
|
|
16224
16224
|
const he = URL.createObjectURL(zA);
|
|
16225
16225
|
gA(zA), LA(he), iA(!0), VA("Analyzing photo…");
|
|
16226
16226
|
try {
|
|
16227
|
-
const Oe = G && v ?
|
|
16227
|
+
const Oe = G && v ? tg(zA, G, v) : Promise.resolve({ isAdult: !0, confidence: "low" }), JA = uo(zA, R ? { maxDimension: 1536, quality: 0.85 } : {}), ke = await Oe;
|
|
16228
16228
|
if (!ke.isAdult) {
|
|
16229
16229
|
const BA = ke.reasoning?.trim() || l("This photo appears to be of a minor. Please upload a photo of someone 18 or older.");
|
|
16230
16230
|
pe(BA), gA(null), LA(null);
|
|
@@ -17159,11 +17159,11 @@ function br({
|
|
|
17159
17159
|
}).catch(() => {
|
|
17160
17160
|
}), () => d.abort();
|
|
17161
17161
|
}, [g, t, r, i]);
|
|
17162
|
-
const
|
|
17162
|
+
const ng = 22, Ro = QA(0), Po = QA(null), bo = QA(null), xo = QA(null), Ho = QA(null), Mo = QA(null), ig = QA(null), rg = QA(""), so = QA(null);
|
|
17163
17163
|
xA(() => {
|
|
17164
17164
|
if (gA === "processing") {
|
|
17165
17165
|
if (so.current) return;
|
|
17166
|
-
Ro.current = 0,
|
|
17166
|
+
Ro.current = 0, ig.current = Date.now(), rg.current = "";
|
|
17167
17167
|
const B = [
|
|
17168
17168
|
{ at: 0, text: X("Preparing your image...") },
|
|
17169
17169
|
{ at: 15, text: X("Analyzing body proportions...") },
|
|
@@ -17174,7 +17174,7 @@ function br({
|
|
|
17174
17174
|
], d = 2 * Math.PI * 38;
|
|
17175
17175
|
return so.current = setInterval(() => {
|
|
17176
17176
|
if (Je.current) return;
|
|
17177
|
-
const z =
|
|
17177
|
+
const z = ig.current || Date.now(), rA = (Date.now() - z) / 1e3, tA = Math.min(95, rA / ng * 100);
|
|
17178
17178
|
Ro.current = tA;
|
|
17179
17179
|
const AA = Math.round(tA);
|
|
17180
17180
|
if (Po.current && (Po.current.style.width = `${AA}%`), bo.current && (bo.current.textContent = `${AA}%`), Mo.current) {
|
|
@@ -17182,23 +17182,23 @@ function br({
|
|
|
17182
17182
|
Mo.current.style.strokeDashoffset = String(Y);
|
|
17183
17183
|
}
|
|
17184
17184
|
if (Ho.current) {
|
|
17185
|
-
const Y = Math.max(0,
|
|
17186
|
-
Ho.current.textContent = rA >=
|
|
17185
|
+
const Y = Math.max(0, ng - Math.floor(rA));
|
|
17186
|
+
Ho.current.textContent = rA >= ng ? "•••" : `~${Y}s`;
|
|
17187
17187
|
}
|
|
17188
17188
|
if (xo.current) {
|
|
17189
17189
|
const Y = [...B].reverse().find((j) => AA >= j.at);
|
|
17190
|
-
if (Y && Y.text !==
|
|
17190
|
+
if (Y && Y.text !== rg.current) {
|
|
17191
17191
|
const j = xo.current;
|
|
17192
17192
|
j.style.opacity = "0", setTimeout(() => {
|
|
17193
17193
|
j.textContent = Y.text, j.style.opacity = "1";
|
|
17194
|
-
}, 180),
|
|
17194
|
+
}, 180), rg.current = Y.text;
|
|
17195
17195
|
}
|
|
17196
17196
|
}
|
|
17197
17197
|
}, 200), () => {
|
|
17198
17198
|
clearInterval(so.current), so.current = null;
|
|
17199
17199
|
};
|
|
17200
17200
|
} else
|
|
17201
|
-
so.current && (clearInterval(so.current), so.current = null),
|
|
17201
|
+
so.current && (clearInterval(so.current), so.current = null), ig.current = null;
|
|
17202
17202
|
}, [gA, X]), xA(() => () => {
|
|
17203
17203
|
nA && URL.revokeObjectURL(nA);
|
|
17204
17204
|
}, [nA]), xA(() => {
|
|
@@ -17297,12 +17297,12 @@ function br({
|
|
|
17297
17297
|
}
|
|
17298
17298
|
},
|
|
17299
17299
|
[b, PA, r, o, i, O, IA]
|
|
17300
|
-
),
|
|
17300
|
+
), sg = QA(null), [Fo, Hg] = f(null), To = bA(async (B) => {
|
|
17301
17301
|
const d = B.height ?? B.heightCm ?? 0, z = B.weight ?? B.weightKg ?? 0, rA = !!B.measurements && Object.keys(B.measurements).length > 0, tA = B.photoBase64;
|
|
17302
|
-
if (!rA && tA && d > 0 &&
|
|
17302
|
+
if (!rA && tA && d > 0 && sg.current) {
|
|
17303
17303
|
try {
|
|
17304
17304
|
const Y = tA.startsWith("data:") ? tA : `data:image/jpeg;base64,${tA}`, j = await fetch(Y).then((ZA) => ZA.blob()), sA = new File([j], "profile-photo.jpg", { type: j.type || "image/jpeg" });
|
|
17305
|
-
await
|
|
17305
|
+
await sg.current({
|
|
17306
17306
|
photoFile: sA,
|
|
17307
17307
|
photoBase64: tA,
|
|
17308
17308
|
height: d,
|
|
@@ -17344,13 +17344,13 @@ function br({
|
|
|
17344
17344
|
const B = PA.find((tA) => tA.id === b);
|
|
17345
17345
|
if (!B) return;
|
|
17346
17346
|
const d = B.height ?? B.heightCm ?? 0, z = B.weight ?? B.weightKg ?? 0;
|
|
17347
|
-
d > 0 && z > 0 &&
|
|
17348
|
-
}, [PA, b]), bt = bA(() => {
|
|
17347
|
+
d > 0 && z > 0 && To(B);
|
|
17348
|
+
}, [PA, b, To]), bt = bA(() => {
|
|
17349
17349
|
if (!Fo) return;
|
|
17350
17350
|
const B = Fo;
|
|
17351
|
-
|
|
17352
|
-
}, [Fo,
|
|
17353
|
-
|
|
17351
|
+
Hg(null), To(B);
|
|
17352
|
+
}, [Fo, To]), xt = bA(() => {
|
|
17353
|
+
Hg(null), cA((B) => B + 1), N("body-profile");
|
|
17354
17354
|
}, []), Ht = QA(() => {
|
|
17355
17355
|
}), Mt = bA(() => {
|
|
17356
17356
|
console.log("[ps-sdk] handleOpen fired — opening modal"), N("body-profile"), l?.();
|
|
@@ -17406,7 +17406,7 @@ function br({
|
|
|
17406
17406
|
}
|
|
17407
17407
|
S(B), eA.current = B, qe.current = null;
|
|
17408
17408
|
const d = URL.createObjectURL(B);
|
|
17409
|
-
MA(d), V?.(B), dA.current = null,
|
|
17409
|
+
MA(d), V?.(B), dA.current = null, og(d).then((z) => {
|
|
17410
17410
|
dA.current = z;
|
|
17411
17411
|
}).catch(() => {
|
|
17412
17412
|
});
|
|
@@ -17643,7 +17643,7 @@ function br({
|
|
|
17643
17643
|
H(!1);
|
|
17644
17644
|
return;
|
|
17645
17645
|
}
|
|
17646
|
-
dA.current = null, be(null),
|
|
17646
|
+
dA.current = null, be(null), og(rA).then((DA) => (dA.current = DA, DA)).catch(() => null);
|
|
17647
17647
|
const AA = po(rA).then((DA) => (be(DA), DA)).catch(() => null), Y = 8e3, j = await Promise.race([
|
|
17648
17648
|
AA,
|
|
17649
17649
|
new Promise((DA) => setTimeout(() => DA(null), Y))
|
|
@@ -17730,7 +17730,7 @@ function br({
|
|
|
17730
17730
|
}
|
|
17731
17731
|
await ZA, H(!1);
|
|
17732
17732
|
}, [r, o, i, TA, ie, J, BA, oo, yo]);
|
|
17733
|
-
|
|
17733
|
+
sg.current = cg;
|
|
17734
17734
|
const Yo = bA(async (B) => {
|
|
17735
17735
|
const d = B || vA || eA.current;
|
|
17736
17736
|
if (!d || !ze.current || !We.current) {
|
|
@@ -17740,7 +17740,7 @@ function br({
|
|
|
17740
17740
|
}
|
|
17741
17741
|
B && B !== vA && (S(B), eA.current = B), Je.current = !1, De(!0), oe(Date.now());
|
|
17742
17742
|
const z = Pr(wo(i)), rA = z === "apparel", tA = (B ? null : nA) || URL.createObjectURL(d);
|
|
17743
|
-
(B || !nA) && MA(tA), rA && (!dA.current || !le) && (dA.current = null, be(null),
|
|
17743
|
+
(B || !nA) && MA(tA), rA && (!dA.current || !le) && (dA.current = null, be(null), og(tA).then((AA) => {
|
|
17744
17744
|
dA.current = AA;
|
|
17745
17745
|
}).catch(() => {
|
|
17746
17746
|
}), po(tA).then((AA) => {
|
|
@@ -17753,8 +17753,8 @@ function br({
|
|
|
17753
17753
|
for (const co of j) {
|
|
17754
17754
|
const Ue = Y[co]?.matchDetails || [];
|
|
17755
17755
|
for (const Qo of Ue) {
|
|
17756
|
-
const
|
|
17757
|
-
NA.has(
|
|
17756
|
+
const Xo = Qo.measurement.toLowerCase().trim();
|
|
17757
|
+
NA.has(Xo) || (NA.add(Xo), Ne.push(Qo));
|
|
17758
17758
|
}
|
|
17759
17759
|
}
|
|
17760
17760
|
return Ne;
|
|
@@ -17773,12 +17773,12 @@ function br({
|
|
|
17773
17773
|
const $A = () => {
|
|
17774
17774
|
const NA = /* @__PURE__ */ new Set(), Ne = [];
|
|
17775
17775
|
console.log("[ps-sdk:flatten] sizingResult keys:", Object.keys(pA || {})), console.log("[ps-sdk:flatten] root matchDetails:", (pA?.matchDetails || []).map((Ue) => Ue.measurement)), console.log("[ps-sdk:flatten] sections:", pA?.sections ? Object.keys(pA.sections) : "none");
|
|
17776
|
-
const co = (Ue, Qo,
|
|
17776
|
+
const co = (Ue, Qo, Xo) => {
|
|
17777
17777
|
if (Ue) {
|
|
17778
|
-
console.log(`[ps-sdk:flatten] ${Qo} →`, Ue.map((
|
|
17779
|
-
for (const
|
|
17780
|
-
const Yg =
|
|
17781
|
-
NA.has(Yg) || (NA.add(Yg), Ne.push({ ...
|
|
17778
|
+
console.log(`[ps-sdk:flatten] ${Qo} →`, Ue.map((Wo) => Wo.measurement));
|
|
17779
|
+
for (const Wo of Ue) {
|
|
17780
|
+
const Yg = Wo.measurement.toLowerCase().replace(/\s*\(.*?\)\s*/g, "").trim();
|
|
17781
|
+
NA.has(Yg) || (NA.add(Yg), Ne.push({ ...Wo, section: Xo }));
|
|
17782
17782
|
}
|
|
17783
17783
|
}
|
|
17784
17784
|
};
|