md-face-engine 1.0.0 → 1.1.1
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/README.md +16 -6
- package/dist/MartidermEngine-O4mYSfhg.cjs +4 -0
- package/dist/MartidermEngine-OvpT3v9z.js +202 -0
- package/dist/client.cjs +1 -5
- package/dist/client.js +4 -3
- package/dist/face_mesh-CA6iJyns.cjs +18 -0
- package/dist/face_mesh-Ctt6fZlf.js +4207 -0
- package/dist/index-Bdxo13gP.js +420 -0
- package/dist/index-DA_YlCTl.cjs +1 -0
- package/dist/index.cjs +1 -8661
- package/dist/index.js +3 -8641
- package/package.json +8 -1
- package/dist/client-BGSZMMvf.js +0 -620
- package/dist/client-BGSZMMvf.js.map +0 -1
- package/dist/client-DimGdJ4Y.cjs +0 -619
- package/dist/client-DimGdJ4Y.cjs.map +0 -1
- package/dist/client.cjs.map +0 -1
- package/dist/client.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
const c = {
|
|
2
|
+
// 1) Arrugas → Suavizado de piel
|
|
3
|
+
smooth: {
|
|
4
|
+
enabled: !0,
|
|
5
|
+
intensity: 36,
|
|
6
|
+
// referencia visual
|
|
7
|
+
radius: 4,
|
|
8
|
+
passes: 2,
|
|
9
|
+
opacity: 0.4
|
|
10
|
+
},
|
|
11
|
+
// 2) Piel apagada → Brillo
|
|
12
|
+
brightness: {
|
|
13
|
+
enabled: !0,
|
|
14
|
+
intensity: 91,
|
|
15
|
+
// referencia visual
|
|
16
|
+
value: 8
|
|
17
|
+
},
|
|
18
|
+
// Ajuste de contraste general
|
|
19
|
+
contrast: {
|
|
20
|
+
enabled: !0,
|
|
21
|
+
intensity: 10,
|
|
22
|
+
value: 1.05
|
|
23
|
+
},
|
|
24
|
+
// Tono cálido / glow
|
|
25
|
+
warmth: {
|
|
26
|
+
enabled: !0,
|
|
27
|
+
intensity: 20,
|
|
28
|
+
rPlus: 6,
|
|
29
|
+
bMinus: 4,
|
|
30
|
+
alpha: 0.25
|
|
31
|
+
},
|
|
32
|
+
// 2) Manchas → Unificar tono
|
|
33
|
+
toneUnify: {
|
|
34
|
+
enabled: !0,
|
|
35
|
+
intensity: 65,
|
|
36
|
+
// referencia visual
|
|
37
|
+
threshold: 15,
|
|
38
|
+
mix: 0.25
|
|
39
|
+
},
|
|
40
|
+
// 5) Acné → Reducir imperfecciones
|
|
41
|
+
blemish: {
|
|
42
|
+
enabled: !0,
|
|
43
|
+
intensity: 35,
|
|
44
|
+
// referencia visual
|
|
45
|
+
microBlur: 2,
|
|
46
|
+
alpha: 0.25
|
|
47
|
+
},
|
|
48
|
+
// 3) Firmeza → Lifting y contouring
|
|
49
|
+
contourLift: {
|
|
50
|
+
enabled: !0,
|
|
51
|
+
intensity: 24,
|
|
52
|
+
// referencia visual
|
|
53
|
+
lift: 0.08,
|
|
54
|
+
shade: 0.06,
|
|
55
|
+
feather: 15
|
|
56
|
+
},
|
|
57
|
+
// Extras
|
|
58
|
+
highlights: {
|
|
59
|
+
enabled: !1,
|
|
60
|
+
intensity: 10
|
|
61
|
+
},
|
|
62
|
+
shadows: {
|
|
63
|
+
enabled: !1,
|
|
64
|
+
intensity: 5
|
|
65
|
+
}
|
|
66
|
+
}, g = {
|
|
67
|
+
arrugas: {
|
|
68
|
+
smooth: { enabled: !0, intensity: 36, radius: 6, passes: 3, opacity: 0.6 },
|
|
69
|
+
contourLift: { enabled: !0, intensity: 20, lift: 0.06, shade: 0.05, feather: 18 }
|
|
70
|
+
},
|
|
71
|
+
manchas: {
|
|
72
|
+
toneUnify: { enabled: !0, intensity: 65, threshold: 14, mix: 0.35 },
|
|
73
|
+
brightness: { enabled: !0, intensity: 20, value: 10 }
|
|
74
|
+
},
|
|
75
|
+
firmeza: {
|
|
76
|
+
contourLift: { enabled: !0, intensity: 24, lift: 0.08, shade: 0.06, feather: 20 },
|
|
77
|
+
contrast: { enabled: !0, intensity: 12, value: 1.07 }
|
|
78
|
+
},
|
|
79
|
+
luminosidad: {
|
|
80
|
+
brightness: { enabled: !0, intensity: 91, value: 12 },
|
|
81
|
+
warmth: { enabled: !0, intensity: 25, rPlus: 8, bMinus: 5, alpha: 0.3 }
|
|
82
|
+
},
|
|
83
|
+
acne: {
|
|
84
|
+
blemish: { enabled: !0, intensity: 35, microBlur: 3, alpha: 0.35 },
|
|
85
|
+
toneUnify: { enabled: !0, intensity: 40, threshold: 16, mix: 0.3 }
|
|
86
|
+
}
|
|
87
|
+
}, f = {
|
|
88
|
+
// Antiaging: foco en arrugas y firmeza
|
|
89
|
+
antiaging: {
|
|
90
|
+
smooth: { enabled: !0, intensity: 36, radius: 6, passes: 3, opacity: 0.6 },
|
|
91
|
+
contourLift: { enabled: !0, intensity: 24, lift: 0.07, shade: 0.05, feather: 18 },
|
|
92
|
+
brightness: { enabled: !0, intensity: 20, value: 10 },
|
|
93
|
+
warmth: { enabled: !0, intensity: 22, rPlus: 7, bMinus: 5, alpha: 0.28 }
|
|
94
|
+
},
|
|
95
|
+
// Manchas / pigmentación: foco en unificar tono y luminosidad
|
|
96
|
+
manchas: {
|
|
97
|
+
toneUnify: { enabled: !0, intensity: 65, threshold: 14, mix: 0.35 },
|
|
98
|
+
brightness: { enabled: !0, intensity: 25, value: 10 },
|
|
99
|
+
warmth: { enabled: !1 }
|
|
100
|
+
},
|
|
101
|
+
// Hidratación: suavizado ligero y glow moderado
|
|
102
|
+
hidratacion: {
|
|
103
|
+
smooth: { enabled: !0, intensity: 25, radius: 3, passes: 2, opacity: 0.35 },
|
|
104
|
+
brightness: { enabled: !0, intensity: 18, value: 8 },
|
|
105
|
+
warmth: { enabled: !0, intensity: 15, rPlus: 5, bMinus: 3, alpha: 0.2 }
|
|
106
|
+
},
|
|
107
|
+
// Acné: foco en reducción de imperfecciones y tono uniforme
|
|
108
|
+
acne: {
|
|
109
|
+
blemish: { enabled: !0, intensity: 35, microBlur: 3, alpha: 0.35 },
|
|
110
|
+
toneUnify: { enabled: !0, intensity: 40, threshold: 16, mix: 0.3 },
|
|
111
|
+
brightness: { enabled: !1 }
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
class d {
|
|
115
|
+
constructor(e = {}) {
|
|
116
|
+
this.storageKey = "martiderm_filter_configs", this.authKey = "martiderm_admin_auth", this.backupKey = "martiderm_config_backup", this.products = Array.isArray(e.products) ? e.products : [], this.init();
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Inicializa el gestor de configuraciones
|
|
120
|
+
*/
|
|
121
|
+
init() {
|
|
122
|
+
const e = this.loadConfigurations();
|
|
123
|
+
(!e || Object.keys(e).length === 0) && this.products.length > 0 && this.initializeDefaultConfigurations();
|
|
124
|
+
}
|
|
125
|
+
setProducts(e = []) {
|
|
126
|
+
this.products = Array.isArray(e) ? e : [];
|
|
127
|
+
const t = this.loadConfigurations();
|
|
128
|
+
(!t || Object.keys(t).length === 0) && this.products.length > 0 && this.initializeDefaultConfigurations();
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Inicializa configuraciones predeterminadas para todos los productos
|
|
132
|
+
*/
|
|
133
|
+
initializeDefaultConfigurations() {
|
|
134
|
+
try {
|
|
135
|
+
const e = {};
|
|
136
|
+
this.products.forEach((t) => {
|
|
137
|
+
e[t.id] = this.generateProductConfig(t);
|
|
138
|
+
}), this.saveConfigurations(e);
|
|
139
|
+
} catch (e) {
|
|
140
|
+
console.error("Error inicializando configuraciones:", e);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Genera configuración específica para un producto
|
|
145
|
+
*/
|
|
146
|
+
generateProductConfig(e) {
|
|
147
|
+
const t = { ...c }, n = f[e.category];
|
|
148
|
+
return n && Object.keys(n).forEach((i) => {
|
|
149
|
+
t[i] && (t[i] = {
|
|
150
|
+
...t[i],
|
|
151
|
+
...n[i]
|
|
152
|
+
});
|
|
153
|
+
}), e.targetConcerns && Array.isArray(e.targetConcerns) && e.targetConcerns.forEach((i) => {
|
|
154
|
+
const s = g[i];
|
|
155
|
+
s && Object.keys(s).forEach((a) => {
|
|
156
|
+
t[a] && (t[a] = {
|
|
157
|
+
...t[a],
|
|
158
|
+
...s[a]
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
}), {
|
|
162
|
+
productId: e.id,
|
|
163
|
+
productName: e.name,
|
|
164
|
+
category: e.category,
|
|
165
|
+
filters: t,
|
|
166
|
+
lastModified: (/* @__PURE__ */ new Date()).toISOString(),
|
|
167
|
+
version: "1.0"
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Obtiene la configuración de filtros para un producto específico
|
|
172
|
+
*/
|
|
173
|
+
getProductConfig(e) {
|
|
174
|
+
return this.loadConfigurations()[e] || null;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Guarda la configuración de filtros para un producto
|
|
178
|
+
*/
|
|
179
|
+
saveProductConfig(e, t) {
|
|
180
|
+
const n = this.loadConfigurations();
|
|
181
|
+
return n[e] = {
|
|
182
|
+
...t,
|
|
183
|
+
lastModified: (/* @__PURE__ */ new Date()).toISOString()
|
|
184
|
+
}, this.saveConfigurations(n), !0;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Obtiene todas las configuraciones
|
|
188
|
+
*/
|
|
189
|
+
getAllConfigurations() {
|
|
190
|
+
return this.loadConfigurations();
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Carga configuraciones desde localStorage
|
|
194
|
+
*/
|
|
195
|
+
loadConfigurations() {
|
|
196
|
+
try {
|
|
197
|
+
const e = localStorage.getItem(this.storageKey);
|
|
198
|
+
return e ? JSON.parse(e) : {};
|
|
199
|
+
} catch (e) {
|
|
200
|
+
return console.error("Error cargando configuraciones:", e), {};
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Guarda configuraciones en localStorage
|
|
205
|
+
*/
|
|
206
|
+
saveConfigurations(e) {
|
|
207
|
+
try {
|
|
208
|
+
return localStorage.setItem(this.storageKey, JSON.stringify(e)), this.createBackup(e), !0;
|
|
209
|
+
} catch (t) {
|
|
210
|
+
return console.error("Error guardando configuraciones:", t), !1;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Crea un backup de las configuraciones
|
|
215
|
+
*/
|
|
216
|
+
createBackup(e = null) {
|
|
217
|
+
try {
|
|
218
|
+
const t = e || this.loadConfigurations(), n = {
|
|
219
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
220
|
+
configurations: t,
|
|
221
|
+
version: "1.0"
|
|
222
|
+
};
|
|
223
|
+
return localStorage.setItem(this.backupKey, JSON.stringify(n)), !0;
|
|
224
|
+
} catch (t) {
|
|
225
|
+
return console.error("Error creando backup:", t), !1;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Restaura configuraciones desde backup
|
|
230
|
+
*/
|
|
231
|
+
restoreFromBackup() {
|
|
232
|
+
try {
|
|
233
|
+
const e = localStorage.getItem(this.backupKey);
|
|
234
|
+
if (e) {
|
|
235
|
+
const t = JSON.parse(e);
|
|
236
|
+
return this.saveConfigurations(t.configurations), !0;
|
|
237
|
+
}
|
|
238
|
+
return !1;
|
|
239
|
+
} catch (e) {
|
|
240
|
+
return console.error("Error restaurando backup:", e), !1;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Exporta configuraciones para descarga
|
|
245
|
+
*/
|
|
246
|
+
exportConfigurations() {
|
|
247
|
+
const e = this.loadConfigurations(), t = {
|
|
248
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
249
|
+
configurations: e,
|
|
250
|
+
version: "1.0"
|
|
251
|
+
};
|
|
252
|
+
return JSON.stringify(t, null, 2);
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Importa configuraciones desde archivo
|
|
256
|
+
*/
|
|
257
|
+
importConfigurations(e) {
|
|
258
|
+
try {
|
|
259
|
+
const t = JSON.parse(e);
|
|
260
|
+
return t.configurations ? (this.saveConfigurations(t.configurations), !0) : !1;
|
|
261
|
+
} catch (t) {
|
|
262
|
+
return console.error("Error importando configuraciones:", t), !1;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Resetea configuraciones a valores predeterminados
|
|
267
|
+
*/
|
|
268
|
+
resetToDefaults() {
|
|
269
|
+
try {
|
|
270
|
+
return localStorage.removeItem(this.storageKey), this.initializeDefaultConfigurations(), !0;
|
|
271
|
+
} catch (e) {
|
|
272
|
+
return console.error("Error reseteando configuraciones:", e), !1;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Estado de autenticación del administrador
|
|
277
|
+
*/
|
|
278
|
+
isAuthenticated() {
|
|
279
|
+
try {
|
|
280
|
+
const e = localStorage.getItem(this.authKey);
|
|
281
|
+
if (!e) return !1;
|
|
282
|
+
const t = JSON.parse(e);
|
|
283
|
+
return !!(t != null && t.authenticated);
|
|
284
|
+
} catch {
|
|
285
|
+
return !1;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Autentica al administrador con credenciales simples de demo
|
|
290
|
+
*/
|
|
291
|
+
authenticateAdmin(e, t) {
|
|
292
|
+
if (e === "admin" && t === "martiderm2024") {
|
|
293
|
+
const s = {
|
|
294
|
+
authenticated: !0,
|
|
295
|
+
username: e,
|
|
296
|
+
token: `adm-${Date.now()}`,
|
|
297
|
+
lastLogin: (/* @__PURE__ */ new Date()).toISOString()
|
|
298
|
+
};
|
|
299
|
+
return localStorage.setItem(this.authKey, JSON.stringify(s)), { success: !0, username: e };
|
|
300
|
+
}
|
|
301
|
+
return { success: !1, error: "Credenciales inválidas" };
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Obtiene información del usuario autenticado
|
|
305
|
+
*/
|
|
306
|
+
getAuthenticatedUser() {
|
|
307
|
+
try {
|
|
308
|
+
const e = localStorage.getItem(this.authKey);
|
|
309
|
+
if (!e) return null;
|
|
310
|
+
const t = JSON.parse(e);
|
|
311
|
+
return t != null && t.authenticated ? { username: t.username } : null;
|
|
312
|
+
} catch {
|
|
313
|
+
return null;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Cierra sesión del administrador
|
|
318
|
+
*/
|
|
319
|
+
logout() {
|
|
320
|
+
try {
|
|
321
|
+
return localStorage.removeItem(this.authKey), !0;
|
|
322
|
+
} catch {
|
|
323
|
+
return !1;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Compatibilidad: método singular usado por AdminPanel
|
|
328
|
+
*/
|
|
329
|
+
exportConfiguration() {
|
|
330
|
+
return this.exportConfigurations();
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
const o = new d(), u = {
|
|
334
|
+
wrinkles: { key: "wrinkles", label: "Arrugas", defaults: { intensity: 0.5, sigma: 4, brightness: 0 }, deep: {} },
|
|
335
|
+
brightness: { key: "brightness", label: "Luminosidad", defaults: { intensity: 0, sigma: 0, brightness: 0.07 }, deep: {} },
|
|
336
|
+
spots: { key: "spots", label: "Manchas/Tono", defaults: { intensity: 0.65, sigma: 5, brightness: 0.05 }, deep: {} },
|
|
337
|
+
acne: { key: "acne", label: "Acne", defaults: { intensity: 0.55, sigma: 3.4, brightness: 0.1 }, deep: {} },
|
|
338
|
+
firmness: { key: "firmness", label: "Firmeza", defaults: { intensity: 0.7, sigma: 2, brightness: 0 }, deep: {} }
|
|
339
|
+
}, h = ["wrinkles", "brightness", "spots", "acne", "firmness"];
|
|
340
|
+
function y(r) {
|
|
341
|
+
return u[r] || null;
|
|
342
|
+
}
|
|
343
|
+
function m(r = {}) {
|
|
344
|
+
var s, a;
|
|
345
|
+
const e = o.getProductConfig(r.id) || {}, t = r.filterType || ((s = e.webglConfig) == null ? void 0 : s.filterType) || "wrinkles", n = ((a = u[t]) == null ? void 0 : a.defaults) || { intensity: 0.5, sigma: 4, brightness: 0 }, i = e.webglConfig || {};
|
|
346
|
+
return {
|
|
347
|
+
filterType: t,
|
|
348
|
+
intensity: r.defaultIntensity !== void 0 ? r.defaultIntensity : n.intensity,
|
|
349
|
+
sigma: r.defaultSigma !== void 0 ? r.defaultSigma : n.sigma,
|
|
350
|
+
brightness: r.defaultBrightness !== void 0 ? r.defaultBrightness : n.brightness,
|
|
351
|
+
contrast: 1,
|
|
352
|
+
warmthR: 0,
|
|
353
|
+
warmthB: 0,
|
|
354
|
+
warmthA: 0,
|
|
355
|
+
...i,
|
|
356
|
+
filterType: t
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
async function b({ token: r, products: e = [] } = {}) {
|
|
360
|
+
if (!r)
|
|
361
|
+
throw new Error("Falta token de licencia para activar md-face-engine.");
|
|
362
|
+
const { default: t } = await import("./MartidermEngine-OvpT3v9z.js"), n = new t();
|
|
363
|
+
await n.activate(r), n.assertActivated();
|
|
364
|
+
const i = n.getFilterConfigManager();
|
|
365
|
+
return Array.isArray(e) && i.setProducts(e), {
|
|
366
|
+
engine: n,
|
|
367
|
+
FILTERS: n.getFilterRegistry(),
|
|
368
|
+
FILTER_ORDER: n.getFilterOrder(),
|
|
369
|
+
getFilter: (s) => n.getFilter(s),
|
|
370
|
+
filterConfigManager: i,
|
|
371
|
+
buildWebglConfigForProduct: (s) => n.buildWebglConfigForProduct(s)
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
async function C({ token: r, products: e = [] } = {}) {
|
|
375
|
+
let t = null, n = null, i = !1;
|
|
376
|
+
if (r)
|
|
377
|
+
try {
|
|
378
|
+
t = await b({ token: r, products: e }), i = !0;
|
|
379
|
+
} catch (s) {
|
|
380
|
+
n = s, i = !1;
|
|
381
|
+
}
|
|
382
|
+
return !t && Array.isArray(e) && typeof (o == null ? void 0 : o.setProducts) == "function" && o.setProducts(e), {
|
|
383
|
+
engine: (t == null ? void 0 : t.engine) || null,
|
|
384
|
+
FILTERS: (t == null ? void 0 : t.FILTERS) || u,
|
|
385
|
+
FILTER_ORDER: (t == null ? void 0 : t.FILTER_ORDER) || h,
|
|
386
|
+
getFilter: (t == null ? void 0 : t.getFilter) || y,
|
|
387
|
+
filterConfigManager: (t == null ? void 0 : t.filterConfigManager) || o,
|
|
388
|
+
buildWebglConfigForProduct: (t == null ? void 0 : t.buildWebglConfigForProduct) || m,
|
|
389
|
+
license: {
|
|
390
|
+
active: i,
|
|
391
|
+
error: n,
|
|
392
|
+
mode: i ? "licensed" : "unlicensed"
|
|
393
|
+
}
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
async function p(r = {}) {
|
|
397
|
+
var s;
|
|
398
|
+
const e = r.locateFile || ((a) => `https://cdn.jsdelivr.net/npm/@mediapipe/face_mesh@0.4.1633559619/${a}`), t = {
|
|
399
|
+
maxNumFaces: 1,
|
|
400
|
+
refineLandmarks: !0,
|
|
401
|
+
minDetectionConfidence: 0.5,
|
|
402
|
+
minTrackingConfidence: 0.5,
|
|
403
|
+
...r.detectorOptions || {}
|
|
404
|
+
};
|
|
405
|
+
let n = typeof window < "u" ? window.FaceMesh : void 0;
|
|
406
|
+
if (!n) {
|
|
407
|
+
const a = await import("./face_mesh-Ctt6fZlf.js").then((l) => l.f);
|
|
408
|
+
n = a.FaceMesh || ((s = a.default) == null ? void 0 : s.FaceMesh);
|
|
409
|
+
}
|
|
410
|
+
if (!n)
|
|
411
|
+
throw new Error("No se pudo inicializar el detector de landmarks");
|
|
412
|
+
const i = new n({ locateFile: e });
|
|
413
|
+
return i.setOptions(t), i;
|
|
414
|
+
}
|
|
415
|
+
export {
|
|
416
|
+
C as a,
|
|
417
|
+
p as b,
|
|
418
|
+
b as c,
|
|
419
|
+
o as f
|
|
420
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const g={smooth:{enabled:!0,intensity:36,radius:4,passes:2,opacity:.4},brightness:{enabled:!0,intensity:91,value:8},contrast:{enabled:!0,intensity:10,value:1.05},warmth:{enabled:!0,intensity:20,rPlus:6,bMinus:4,alpha:.25},toneUnify:{enabled:!0,intensity:65,threshold:15,mix:.25},blemish:{enabled:!0,intensity:35,microBlur:2,alpha:.25},contourLift:{enabled:!0,intensity:24,lift:.08,shade:.06,feather:15},highlights:{enabled:!1,intensity:10},shadows:{enabled:!1,intensity:5}},f={arrugas:{smooth:{enabled:!0,intensity:36,radius:6,passes:3,opacity:.6},contourLift:{enabled:!0,intensity:20,lift:.06,shade:.05,feather:18}},manchas:{toneUnify:{enabled:!0,intensity:65,threshold:14,mix:.35},brightness:{enabled:!0,intensity:20,value:10}},firmeza:{contourLift:{enabled:!0,intensity:24,lift:.08,shade:.06,feather:20},contrast:{enabled:!0,intensity:12,value:1.07}},luminosidad:{brightness:{enabled:!0,intensity:91,value:12},warmth:{enabled:!0,intensity:25,rPlus:8,bMinus:5,alpha:.3}},acne:{blemish:{enabled:!0,intensity:35,microBlur:3,alpha:.35},toneUnify:{enabled:!0,intensity:40,threshold:16,mix:.3}}},d={antiaging:{smooth:{enabled:!0,intensity:36,radius:6,passes:3,opacity:.6},contourLift:{enabled:!0,intensity:24,lift:.07,shade:.05,feather:18},brightness:{enabled:!0,intensity:20,value:10},warmth:{enabled:!0,intensity:22,rPlus:7,bMinus:5,alpha:.28}},manchas:{toneUnify:{enabled:!0,intensity:65,threshold:14,mix:.35},brightness:{enabled:!0,intensity:25,value:10},warmth:{enabled:!1}},hidratacion:{smooth:{enabled:!0,intensity:25,radius:3,passes:2,opacity:.35},brightness:{enabled:!0,intensity:18,value:8},warmth:{enabled:!0,intensity:15,rPlus:5,bMinus:3,alpha:.2}},acne:{blemish:{enabled:!0,intensity:35,microBlur:3,alpha:.35},toneUnify:{enabled:!0,intensity:40,threshold:16,mix:.3},brightness:{enabled:!1}}};class h{constructor(e={}){this.storageKey="martiderm_filter_configs",this.authKey="martiderm_admin_auth",this.backupKey="martiderm_config_backup",this.products=Array.isArray(e.products)?e.products:[],this.init()}init(){const e=this.loadConfigurations();(!e||Object.keys(e).length===0)&&this.products.length>0&&this.initializeDefaultConfigurations()}setProducts(e=[]){this.products=Array.isArray(e)?e:[];const t=this.loadConfigurations();(!t||Object.keys(t).length===0)&&this.products.length>0&&this.initializeDefaultConfigurations()}initializeDefaultConfigurations(){try{const e={};this.products.forEach(t=>{e[t.id]=this.generateProductConfig(t)}),this.saveConfigurations(e)}catch(e){console.error("Error inicializando configuraciones:",e)}}generateProductConfig(e){const t={...g},n=d[e.category];return n&&Object.keys(n).forEach(i=>{t[i]&&(t[i]={...t[i],...n[i]})}),e.targetConcerns&&Array.isArray(e.targetConcerns)&&e.targetConcerns.forEach(i=>{const s=f[i];s&&Object.keys(s).forEach(a=>{t[a]&&(t[a]={...t[a],...s[a]})})}),{productId:e.id,productName:e.name,category:e.category,filters:t,lastModified:new Date().toISOString(),version:"1.0"}}getProductConfig(e){return this.loadConfigurations()[e]||null}saveProductConfig(e,t){const n=this.loadConfigurations();return n[e]={...t,lastModified:new Date().toISOString()},this.saveConfigurations(n),!0}getAllConfigurations(){return this.loadConfigurations()}loadConfigurations(){try{const e=localStorage.getItem(this.storageKey);return e?JSON.parse(e):{}}catch(e){return console.error("Error cargando configuraciones:",e),{}}}saveConfigurations(e){try{return localStorage.setItem(this.storageKey,JSON.stringify(e)),this.createBackup(e),!0}catch(t){return console.error("Error guardando configuraciones:",t),!1}}createBackup(e=null){try{const t=e||this.loadConfigurations(),n={timestamp:new Date().toISOString(),configurations:t,version:"1.0"};return localStorage.setItem(this.backupKey,JSON.stringify(n)),!0}catch(t){return console.error("Error creando backup:",t),!1}}restoreFromBackup(){try{const e=localStorage.getItem(this.backupKey);if(e){const t=JSON.parse(e);return this.saveConfigurations(t.configurations),!0}return!1}catch(e){return console.error("Error restaurando backup:",e),!1}}exportConfigurations(){const e=this.loadConfigurations(),t={timestamp:new Date().toISOString(),configurations:e,version:"1.0"};return JSON.stringify(t,null,2)}importConfigurations(e){try{const t=JSON.parse(e);return t.configurations?(this.saveConfigurations(t.configurations),!0):!1}catch(t){return console.error("Error importando configuraciones:",t),!1}}resetToDefaults(){try{return localStorage.removeItem(this.storageKey),this.initializeDefaultConfigurations(),!0}catch(e){return console.error("Error reseteando configuraciones:",e),!1}}isAuthenticated(){try{const e=localStorage.getItem(this.authKey);if(!e)return!1;const t=JSON.parse(e);return!!(t!=null&&t.authenticated)}catch{return!1}}authenticateAdmin(e,t){if(e==="admin"&&t==="martiderm2024"){const s={authenticated:!0,username:e,token:`adm-${Date.now()}`,lastLogin:new Date().toISOString()};return localStorage.setItem(this.authKey,JSON.stringify(s)),{success:!0,username:e}}return{success:!1,error:"Credenciales inválidas"}}getAuthenticatedUser(){try{const e=localStorage.getItem(this.authKey);if(!e)return null;const t=JSON.parse(e);return t!=null&&t.authenticated?{username:t.username}:null}catch{return null}}logout(){try{return localStorage.removeItem(this.authKey),!0}catch{return!1}}exportConfiguration(){return this.exportConfigurations()}}const o=new h,u={wrinkles:{key:"wrinkles",label:"Arrugas",defaults:{intensity:.5,sigma:4,brightness:0},deep:{}},brightness:{key:"brightness",label:"Luminosidad",defaults:{intensity:0,sigma:0,brightness:.07},deep:{}},spots:{key:"spots",label:"Manchas/Tono",defaults:{intensity:.65,sigma:5,brightness:.05},deep:{}},acne:{key:"acne",label:"Acne",defaults:{intensity:.55,sigma:3.4,brightness:.1},deep:{}},firmness:{key:"firmness",label:"Firmeza",defaults:{intensity:.7,sigma:2,brightness:0},deep:{}}},y=["wrinkles","brightness","spots","acne","firmness"];function m(r){return u[r]||null}function b(r={}){var s,a;const e=o.getProductConfig(r.id)||{},t=r.filterType||((s=e.webglConfig)==null?void 0:s.filterType)||"wrinkles",n=((a=u[t])==null?void 0:a.defaults)||{intensity:.5,sigma:4,brightness:0},i=e.webglConfig||{};return{filterType:t,intensity:r.defaultIntensity!==void 0?r.defaultIntensity:n.intensity,sigma:r.defaultSigma!==void 0?r.defaultSigma:n.sigma,brightness:r.defaultBrightness!==void 0?r.defaultBrightness:n.brightness,contrast:1,warmthR:0,warmthB:0,warmthA:0,...i,filterType:t}}async function l({token:r,products:e=[]}={}){if(!r)throw new Error("Falta token de licencia para activar md-face-engine.");const{default:t}=await Promise.resolve().then(()=>require("./MartidermEngine-O4mYSfhg.cjs")),n=new t;await n.activate(r),n.assertActivated();const i=n.getFilterConfigManager();return Array.isArray(e)&&i.setProducts(e),{engine:n,FILTERS:n.getFilterRegistry(),FILTER_ORDER:n.getFilterOrder(),getFilter:s=>n.getFilter(s),filterConfigManager:i,buildWebglConfigForProduct:s=>n.buildWebglConfigForProduct(s)}}async function C({token:r,products:e=[]}={}){let t=null,n=null,i=!1;if(r)try{t=await l({token:r,products:e}),i=!0}catch(s){n=s,i=!1}return!t&&Array.isArray(e)&&typeof(o==null?void 0:o.setProducts)=="function"&&o.setProducts(e),{engine:(t==null?void 0:t.engine)||null,FILTERS:(t==null?void 0:t.FILTERS)||u,FILTER_ORDER:(t==null?void 0:t.FILTER_ORDER)||y,getFilter:(t==null?void 0:t.getFilter)||m,filterConfigManager:(t==null?void 0:t.filterConfigManager)||o,buildWebglConfigForProduct:(t==null?void 0:t.buildWebglConfigForProduct)||b,license:{active:i,error:n,mode:i?"licensed":"unlicensed"}}}async function p(r={}){var s;const e=r.locateFile||(a=>`https://cdn.jsdelivr.net/npm/@mediapipe/face_mesh@0.4.1633559619/${a}`),t={maxNumFaces:1,refineLandmarks:!0,minDetectionConfidence:.5,minTrackingConfidence:.5,...r.detectorOptions||{}};let n=typeof window<"u"?window.FaceMesh:void 0;if(!n){const a=await Promise.resolve().then(()=>require("./face_mesh-CA6iJyns.cjs")).then(c=>c.face_mesh);n=a.FaceMesh||((s=a.default)==null?void 0:s.FaceMesh)}if(!n)throw new Error("No se pudo inicializar el detector de landmarks");const i=new n({locateFile:e});return i.setOptions(t),i}exports.createLandmarkDetector=p;exports.createMdFaceEngineClient=l;exports.createMdFaceEngineRuntime=C;exports.filterConfigManager=o;
|