@antontranelis/money-printer 1.0.4 → 1.0.6
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/index.cjs +1 -1
- package/dist/index.js +479 -488
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { create as
|
|
3
|
-
import { persist as
|
|
4
|
-
import { useState as N, useCallback as
|
|
5
|
-
import
|
|
6
|
-
const
|
|
1
|
+
import { jsxs as m, jsx as l, Fragment as M } from "react/jsx-runtime";
|
|
2
|
+
import { create as fe } from "zustand";
|
|
3
|
+
import { persist as be } from "zustand/middleware";
|
|
4
|
+
import { useState as N, useCallback as C, useRef as $, useEffect as G } from "react";
|
|
5
|
+
import ye from "jspdf";
|
|
6
|
+
const V = {
|
|
7
7
|
personalInfo: {
|
|
8
8
|
name: "",
|
|
9
9
|
email: "",
|
|
@@ -23,10 +23,10 @@ const G = {
|
|
|
23
23
|
currentSide: "front",
|
|
24
24
|
isEnhancing: !1,
|
|
25
25
|
isExporting: !1
|
|
26
|
-
}, w =
|
|
27
|
-
|
|
26
|
+
}, w = fe()(
|
|
27
|
+
be(
|
|
28
28
|
(e) => ({
|
|
29
|
-
...
|
|
29
|
+
...V,
|
|
30
30
|
setPersonalInfo: (t) => e((a) => ({
|
|
31
31
|
personalInfo: { ...a.personalInfo, ...t }
|
|
32
32
|
})),
|
|
@@ -72,7 +72,7 @@ const G = {
|
|
|
72
72
|
setHours: (t) => e((a) => ({
|
|
73
73
|
voucherConfig: { ...a.voucherConfig, hours: t }
|
|
74
74
|
})),
|
|
75
|
-
reset: () => e(
|
|
75
|
+
reset: () => e(V)
|
|
76
76
|
}),
|
|
77
77
|
{
|
|
78
78
|
name: "money-generator-storage",
|
|
@@ -82,7 +82,7 @@ const G = {
|
|
|
82
82
|
})
|
|
83
83
|
}
|
|
84
84
|
)
|
|
85
|
-
),
|
|
85
|
+
), we = {
|
|
86
86
|
header: {
|
|
87
87
|
title: "Money Generator",
|
|
88
88
|
subtitle: "Erstelle deinen persönlichen Zeitgutschein"
|
|
@@ -129,7 +129,7 @@ const G = {
|
|
|
129
129
|
bill: {
|
|
130
130
|
descriptionText: "Für diesen Schein erhältst du {hours} {hourLabel} meiner Zeit oder ein gleichwertiges Dankeschön"
|
|
131
131
|
}
|
|
132
|
-
},
|
|
132
|
+
}, ve = {
|
|
133
133
|
header: {
|
|
134
134
|
title: "Money Generator",
|
|
135
135
|
subtitle: "Create your personal time voucher"
|
|
@@ -176,22 +176,22 @@ const G = {
|
|
|
176
176
|
bill: {
|
|
177
177
|
descriptionText: "This voucher entitles you to {hours} {hourLabel} of my time or an equivalent thank you"
|
|
178
178
|
}
|
|
179
|
-
},
|
|
180
|
-
function
|
|
181
|
-
return
|
|
179
|
+
}, xe = { de: we, en: ve };
|
|
180
|
+
function z(e) {
|
|
181
|
+
return xe[e];
|
|
182
182
|
}
|
|
183
|
-
function
|
|
183
|
+
function J(e, t, a) {
|
|
184
184
|
if (a && a.trim())
|
|
185
185
|
return a;
|
|
186
|
-
const n =
|
|
186
|
+
const n = z(e), r = t === 1 ? n.form.voucher.hourLabel : n.form.voucher.hoursLabel;
|
|
187
187
|
return n.bill.descriptionText.replace("{hours}", t.toString()).replace("{hourLabel}", r);
|
|
188
188
|
}
|
|
189
|
-
function
|
|
190
|
-
const e = w((r) => r.voucherConfig.language), t = w((r) => r.personalInfo), a = w((r) => r.setPersonalInfo), n =
|
|
191
|
-
return /* @__PURE__ */
|
|
192
|
-
/* @__PURE__ */
|
|
193
|
-
/* @__PURE__ */
|
|
194
|
-
/* @__PURE__ */
|
|
189
|
+
function Ve() {
|
|
190
|
+
const e = w((r) => r.voucherConfig.language), t = w((r) => r.personalInfo), a = w((r) => r.setPersonalInfo), n = z(e);
|
|
191
|
+
return /* @__PURE__ */ m("div", { className: "space-y-4", children: [
|
|
192
|
+
/* @__PURE__ */ m("div", { className: "form-control", children: [
|
|
193
|
+
/* @__PURE__ */ l("label", { className: "label", children: /* @__PURE__ */ l("span", { className: "label-text font-medium", children: n.form.personalInfo.name }) }),
|
|
194
|
+
/* @__PURE__ */ l(
|
|
195
195
|
"input",
|
|
196
196
|
{
|
|
197
197
|
type: "text",
|
|
@@ -202,9 +202,9 @@ function je() {
|
|
|
202
202
|
}
|
|
203
203
|
)
|
|
204
204
|
] }),
|
|
205
|
-
/* @__PURE__ */
|
|
206
|
-
/* @__PURE__ */
|
|
207
|
-
/* @__PURE__ */
|
|
205
|
+
/* @__PURE__ */ m("div", { className: "form-control", children: [
|
|
206
|
+
/* @__PURE__ */ l("label", { className: "label", children: /* @__PURE__ */ l("span", { className: "label-text font-medium", children: n.form.personalInfo.email }) }),
|
|
207
|
+
/* @__PURE__ */ l(
|
|
208
208
|
"input",
|
|
209
209
|
{
|
|
210
210
|
type: "email",
|
|
@@ -215,9 +215,9 @@ function je() {
|
|
|
215
215
|
}
|
|
216
216
|
)
|
|
217
217
|
] }),
|
|
218
|
-
/* @__PURE__ */
|
|
219
|
-
/* @__PURE__ */
|
|
220
|
-
/* @__PURE__ */
|
|
218
|
+
/* @__PURE__ */ m("div", { className: "form-control", children: [
|
|
219
|
+
/* @__PURE__ */ l("label", { className: "label", children: /* @__PURE__ */ l("span", { className: "label-text font-medium", children: n.form.personalInfo.phone }) }),
|
|
220
|
+
/* @__PURE__ */ l(
|
|
221
221
|
"input",
|
|
222
222
|
{
|
|
223
223
|
type: "tel",
|
|
@@ -230,7 +230,7 @@ function je() {
|
|
|
230
230
|
] })
|
|
231
231
|
] });
|
|
232
232
|
}
|
|
233
|
-
const
|
|
233
|
+
const j = {}, Ie = "https://api.stability.ai/v1/generation", ke = "https://api.stability.ai/v2beta/stable-image/edit/remove-background", Q = "stability_api_key", Ne = {
|
|
234
234
|
vintage: "portrait in the style of vintage currency engraving, fine line work, crosshatching, sepia tones, detailed stippling, classic bank note portrait style",
|
|
235
235
|
engraved: "portrait as detailed intaglio engraving, currency bill style, fine parallel lines, high contrast, official government portrait",
|
|
236
236
|
currency: "portrait rendered as US dollar bill engraving, official currency portrait style, green tint, fine line engraving technique"
|
|
@@ -245,80 +245,80 @@ const K = {}, ye = "https://api.stability.ai/v1/generation", ve = "https://api.s
|
|
|
245
245
|
{ width: 832, height: 1216 },
|
|
246
246
|
{ width: 896, height: 1152 }
|
|
247
247
|
];
|
|
248
|
-
function
|
|
248
|
+
function Ee(e, t) {
|
|
249
249
|
const a = e / t;
|
|
250
250
|
let n = Z[0], r = 1 / 0;
|
|
251
|
-
for (const
|
|
252
|
-
const d =
|
|
253
|
-
|
|
251
|
+
for (const s of Z) {
|
|
252
|
+
const d = s.width / s.height, o = Math.abs(a - d);
|
|
253
|
+
o < r && (r = o, n = s);
|
|
254
254
|
}
|
|
255
255
|
return n;
|
|
256
256
|
}
|
|
257
|
-
function
|
|
257
|
+
function Pe(e) {
|
|
258
258
|
return new Promise((t, a) => {
|
|
259
259
|
const n = new Image();
|
|
260
260
|
n.onload = () => {
|
|
261
|
-
const r =
|
|
262
|
-
|
|
263
|
-
const d =
|
|
261
|
+
const r = Ee(n.width, n.height), s = document.createElement("canvas");
|
|
262
|
+
s.width = r.width, s.height = r.height;
|
|
263
|
+
const d = s.getContext("2d");
|
|
264
264
|
if (!d) {
|
|
265
265
|
a(new Error("Failed to get canvas context"));
|
|
266
266
|
return;
|
|
267
267
|
}
|
|
268
|
-
const
|
|
269
|
-
let c = 0,
|
|
270
|
-
|
|
268
|
+
const o = n.width / n.height, i = r.width / r.height;
|
|
269
|
+
let c = 0, u = 0, g = n.width, f = n.height;
|
|
270
|
+
o > i ? (g = n.height * i, c = (n.width - g) / 2) : (f = n.width / i, u = (n.height - f) / 2), d.drawImage(n, c, u, g, f, 0, 0, r.width, r.height), t(s.toDataURL("image/png"));
|
|
271
271
|
}, n.onerror = () => a(new Error("Failed to load image")), n.src = e;
|
|
272
272
|
});
|
|
273
273
|
}
|
|
274
|
-
function
|
|
274
|
+
function ee(e) {
|
|
275
275
|
var d;
|
|
276
|
-
const t = e.split(","), a = ((d = t[0].match(/:(.*?);/)) == null ? void 0 : d[1]) || "image/png", n = atob(t[1]), r = n.length,
|
|
277
|
-
for (let
|
|
278
|
-
o
|
|
279
|
-
return new Blob([
|
|
276
|
+
const t = e.split(","), a = ((d = t[0].match(/:(.*?);/)) == null ? void 0 : d[1]) || "image/png", n = atob(t[1]), r = n.length, s = new Uint8Array(r);
|
|
277
|
+
for (let o = 0; o < r; o++)
|
|
278
|
+
s[o] = n.charCodeAt(o);
|
|
279
|
+
return new Blob([s], { type: a });
|
|
280
280
|
}
|
|
281
|
-
function
|
|
281
|
+
function q() {
|
|
282
282
|
var t;
|
|
283
|
-
const e = typeof import.meta < "u" && (
|
|
284
|
-
return e && e !== "your-api-key-here" ? e : typeof localStorage < "u" ? localStorage.getItem(
|
|
283
|
+
const e = typeof import.meta < "u" && (j == null ? void 0 : j.VITE_STABILITY_API_KEY) || typeof process < "u" && ((t = process.env) == null ? void 0 : t.NEXT_PUBLIC_STABILITY_API_KEY);
|
|
284
|
+
return e && e !== "your-api-key-here" ? e : typeof localStorage < "u" ? localStorage.getItem(Q) : null;
|
|
285
285
|
}
|
|
286
|
-
function
|
|
287
|
-
localStorage.setItem(
|
|
286
|
+
function Se(e) {
|
|
287
|
+
localStorage.setItem(Q, e);
|
|
288
288
|
}
|
|
289
|
-
function
|
|
290
|
-
return
|
|
289
|
+
function Ce() {
|
|
290
|
+
return q() !== null;
|
|
291
291
|
}
|
|
292
|
-
async function
|
|
293
|
-
const t =
|
|
292
|
+
async function Ze(e) {
|
|
293
|
+
const t = q();
|
|
294
294
|
if (!t)
|
|
295
295
|
throw new Error("No Stability AI API key configured");
|
|
296
|
-
const { imageDataUrl: a, style: n, strength: r = 0.35 } = e,
|
|
297
|
-
|
|
298
|
-
const c = await fetch(`${
|
|
296
|
+
const { imageDataUrl: a, style: n, strength: r = 0.35 } = e, s = await Pe(a), d = ee(s), o = new FormData();
|
|
297
|
+
o.append("init_image", d, "portrait.png"), o.append("init_image_mode", "IMAGE_STRENGTH"), o.append("image_strength", String(1 - r)), o.append("text_prompts[0][text]", Ne[n]), o.append("text_prompts[0][weight]", "1"), o.append("cfg_scale", "7"), o.append("samples", "1"), o.append("steps", "30");
|
|
298
|
+
const c = await fetch(`${Ie}/stable-diffusion-xl-1024-v1-0/image-to-image`, {
|
|
299
299
|
method: "POST",
|
|
300
300
|
headers: {
|
|
301
301
|
Authorization: `Bearer ${t}`,
|
|
302
302
|
Accept: "application/json"
|
|
303
303
|
},
|
|
304
|
-
body:
|
|
304
|
+
body: o
|
|
305
305
|
});
|
|
306
306
|
if (!c.ok) {
|
|
307
|
-
const
|
|
308
|
-
throw console.error("Stability AI error:",
|
|
307
|
+
const g = await c.text();
|
|
308
|
+
throw console.error("Stability AI error:", g), c.status === 401 ? new Error("Invalid API key") : c.status === 402 ? new Error("Insufficient credits") : c.status === 429 ? new Error("Rate limit exceeded. Please try again later.") : new Error(`API error: ${c.status}`);
|
|
309
309
|
}
|
|
310
|
-
const
|
|
311
|
-
if (!
|
|
310
|
+
const u = await c.json();
|
|
311
|
+
if (!u.artifacts || u.artifacts.length === 0)
|
|
312
312
|
throw new Error("No image generated");
|
|
313
|
-
return `data:image/png;base64,${
|
|
313
|
+
return `data:image/png;base64,${u.artifacts[0].base64}`;
|
|
314
314
|
}
|
|
315
|
-
async function
|
|
316
|
-
const t =
|
|
315
|
+
async function Ae(e) {
|
|
316
|
+
const t = q();
|
|
317
317
|
if (!t)
|
|
318
318
|
throw new Error("No Stability AI API key configured");
|
|
319
|
-
const a =
|
|
319
|
+
const a = ee(e), n = new FormData();
|
|
320
320
|
n.append("image", a, "image.png"), n.append("output_format", "png");
|
|
321
|
-
const r = await fetch(
|
|
321
|
+
const r = await fetch(ke, {
|
|
322
322
|
method: "POST",
|
|
323
323
|
headers: {
|
|
324
324
|
Authorization: `Bearer ${t}`,
|
|
@@ -330,59 +330,60 @@ async function Ne(e) {
|
|
|
330
330
|
const d = await r.text();
|
|
331
331
|
throw console.error("Stability AI remove background error:", d), r.status === 401 ? new Error("Invalid API key") : r.status === 402 ? new Error("Insufficient credits") : r.status === 429 ? new Error("Rate limit exceeded. Please try again later.") : new Error(`API error: ${r.status}`);
|
|
332
332
|
}
|
|
333
|
-
const
|
|
334
|
-
return new Promise((d,
|
|
335
|
-
const
|
|
336
|
-
|
|
333
|
+
const s = await r.blob();
|
|
334
|
+
return new Promise((d, o) => {
|
|
335
|
+
const i = new FileReader();
|
|
336
|
+
i.onload = () => d(i.result), i.onerror = () => o(new Error("Failed to read result")), i.readAsDataURL(s);
|
|
337
337
|
});
|
|
338
338
|
}
|
|
339
|
-
async function
|
|
339
|
+
async function Te(e) {
|
|
340
340
|
return new Promise((t, a) => {
|
|
341
341
|
const n = new Image();
|
|
342
342
|
n.onload = () => {
|
|
343
|
-
const r = document.createElement("canvas"),
|
|
344
|
-
if (!
|
|
343
|
+
const r = document.createElement("canvas"), s = r.getContext("2d");
|
|
344
|
+
if (!s) {
|
|
345
345
|
a(new Error("Failed to get canvas context"));
|
|
346
346
|
return;
|
|
347
347
|
}
|
|
348
|
-
r.width = n.width, r.height = n.height,
|
|
348
|
+
r.width = n.width, r.height = n.height, s.drawImage(n, 0, 0);
|
|
349
|
+
const d = s.getImageData(0, 0, r.width, r.height), o = d.data;
|
|
350
|
+
for (let i = 0; i < o.length; i += 4) {
|
|
351
|
+
const c = o[i], u = o[i + 1], g = o[i + 2];
|
|
352
|
+
if (o[i + 3] === 0) continue;
|
|
353
|
+
const b = 0.299 * c + 0.587 * u + 0.114 * g, h = 1.4;
|
|
354
|
+
let x = 259 * (h * 255 + 255) / (255 * (259 - h * 255)) * (b - 128) + 128;
|
|
355
|
+
x = Math.max(0, Math.min(255, x));
|
|
356
|
+
const v = Math.min(255, x * 1.1 + 20), S = Math.min(255, x * 0.95 + 10), y = Math.min(255, x * 0.8);
|
|
357
|
+
o[i] = v, o[i + 1] = S, o[i + 2] = y;
|
|
358
|
+
}
|
|
359
|
+
s.putImageData(d, 0, 0), t(r.toDataURL("image/png"));
|
|
349
360
|
}, n.onerror = () => a(new Error("Failed to load image")), n.src = e;
|
|
350
361
|
});
|
|
351
362
|
}
|
|
352
|
-
function
|
|
353
|
-
const [e, t] = N(!1), [a, n] = N(!1), [r,
|
|
354
|
-
|
|
355
|
-
}, []),
|
|
356
|
-
async (
|
|
357
|
-
t(!0),
|
|
363
|
+
function Le() {
|
|
364
|
+
const [e, t] = N(!1), [a, n] = N(!1), [r, s] = N(null), [d, o] = N(Ce()), i = C(() => s(null), []), c = C((f) => {
|
|
365
|
+
Se(f), o(!0), s(null);
|
|
366
|
+
}, []), u = C(
|
|
367
|
+
async (f, b = "vintage") => {
|
|
368
|
+
t(!0), s(null);
|
|
358
369
|
try {
|
|
359
|
-
return
|
|
360
|
-
imageDataUrl: b,
|
|
361
|
-
style: u,
|
|
362
|
-
strength: 0.35
|
|
363
|
-
}) : await J(b);
|
|
370
|
+
return await Te(f);
|
|
364
371
|
} catch (h) {
|
|
365
|
-
const
|
|
366
|
-
|
|
367
|
-
try {
|
|
368
|
-
return await J(b);
|
|
369
|
-
} catch {
|
|
370
|
-
throw h;
|
|
371
|
-
}
|
|
372
|
-
throw h;
|
|
372
|
+
const E = h instanceof Error ? h.message : "Enhancement failed";
|
|
373
|
+
throw s(E), h;
|
|
373
374
|
} finally {
|
|
374
375
|
t(!1);
|
|
375
376
|
}
|
|
376
377
|
},
|
|
377
378
|
[]
|
|
378
|
-
),
|
|
379
|
-
async (
|
|
380
|
-
n(!0),
|
|
379
|
+
), g = C(
|
|
380
|
+
async (f) => {
|
|
381
|
+
n(!0), s(null);
|
|
381
382
|
try {
|
|
382
|
-
return await
|
|
383
|
-
} catch (
|
|
384
|
-
const h =
|
|
385
|
-
throw
|
|
383
|
+
return await Ae(f);
|
|
384
|
+
} catch (b) {
|
|
385
|
+
const h = b instanceof Error ? b.message : "Background removal failed";
|
|
386
|
+
throw s(h), b;
|
|
386
387
|
} finally {
|
|
387
388
|
n(!1);
|
|
388
389
|
}
|
|
@@ -390,22 +391,22 @@ function Se() {
|
|
|
390
391
|
[]
|
|
391
392
|
);
|
|
392
393
|
return {
|
|
393
|
-
enhance:
|
|
394
|
-
removeBg:
|
|
394
|
+
enhance: u,
|
|
395
|
+
removeBg: g,
|
|
395
396
|
isEnhancing: e,
|
|
396
397
|
isRemovingBg: a,
|
|
397
398
|
error: r,
|
|
398
399
|
hasKey: d,
|
|
399
400
|
setApiKey: c,
|
|
400
|
-
clearError:
|
|
401
|
+
clearError: i
|
|
401
402
|
};
|
|
402
403
|
}
|
|
403
|
-
function
|
|
404
|
-
const n = w((c) => c.voucherConfig.language), [r,
|
|
404
|
+
function De({ isOpen: e, onClose: t, onSubmit: a }) {
|
|
405
|
+
const n = w((c) => c.voucherConfig.language), [r, s] = N("");
|
|
405
406
|
if (!e) return null;
|
|
406
407
|
const d = (c) => {
|
|
407
|
-
c.preventDefault(), r.trim() && (a(r.trim()),
|
|
408
|
-
},
|
|
408
|
+
c.preventDefault(), r.trim() && (a(r.trim()), s(""), t());
|
|
409
|
+
}, i = {
|
|
409
410
|
de: {
|
|
410
411
|
title: "Stability AI API Key",
|
|
411
412
|
description: "Um die AI-Bildverbesserung zu nutzen, benötigst du einen Stability AI API Key. Du kannst ihn auf platform.stability.ai erhalten.",
|
|
@@ -423,115 +424,115 @@ function Ce({ isOpen: e, onClose: t, onSubmit: a }) {
|
|
|
423
424
|
hint: "The key is stored locally in your browser."
|
|
424
425
|
}
|
|
425
426
|
}[n];
|
|
426
|
-
return /* @__PURE__ */
|
|
427
|
-
/* @__PURE__ */
|
|
428
|
-
/* @__PURE__ */
|
|
429
|
-
/* @__PURE__ */
|
|
430
|
-
/* @__PURE__ */
|
|
431
|
-
/* @__PURE__ */
|
|
432
|
-
/* @__PURE__ */
|
|
427
|
+
return /* @__PURE__ */ m("dialog", { className: "modal modal-open", children: [
|
|
428
|
+
/* @__PURE__ */ m("div", { className: "modal-box", children: [
|
|
429
|
+
/* @__PURE__ */ l("h3", { className: "font-bold text-lg", children: i.title }),
|
|
430
|
+
/* @__PURE__ */ l("p", { className: "py-4 text-sm opacity-80", children: i.description }),
|
|
431
|
+
/* @__PURE__ */ m("form", { onSubmit: d, children: [
|
|
432
|
+
/* @__PURE__ */ m("div", { className: "form-control", children: [
|
|
433
|
+
/* @__PURE__ */ l(
|
|
433
434
|
"input",
|
|
434
435
|
{
|
|
435
436
|
type: "password",
|
|
436
|
-
placeholder:
|
|
437
|
+
placeholder: i.placeholder,
|
|
437
438
|
className: "input input-bordered w-full",
|
|
438
439
|
value: r,
|
|
439
|
-
onChange: (c) =>
|
|
440
|
+
onChange: (c) => s(c.target.value),
|
|
440
441
|
autoFocus: !0
|
|
441
442
|
}
|
|
442
443
|
),
|
|
443
|
-
/* @__PURE__ */
|
|
444
|
+
/* @__PURE__ */ l("label", { className: "label", children: /* @__PURE__ */ l("span", { className: "label-text-alt", children: i.hint }) })
|
|
444
445
|
] }),
|
|
445
|
-
/* @__PURE__ */
|
|
446
|
-
/* @__PURE__ */
|
|
447
|
-
/* @__PURE__ */
|
|
446
|
+
/* @__PURE__ */ m("div", { className: "modal-action", children: [
|
|
447
|
+
/* @__PURE__ */ l("button", { type: "button", className: "btn btn-ghost", onClick: t, children: i.cancel }),
|
|
448
|
+
/* @__PURE__ */ l("button", { type: "submit", className: "btn btn-primary", disabled: !r.trim(), children: i.submit })
|
|
448
449
|
] })
|
|
449
450
|
] })
|
|
450
451
|
] }),
|
|
451
|
-
/* @__PURE__ */
|
|
452
|
+
/* @__PURE__ */ l("form", { method: "dialog", className: "modal-backdrop", children: /* @__PURE__ */ l("button", { onClick: t, children: "close" }) })
|
|
452
453
|
] });
|
|
453
454
|
}
|
|
454
|
-
function
|
|
455
|
-
const e = w((p) => p.voucherConfig.language), t = w((p) => p.portrait), a = w((p) => p.setPortrait), n = w((p) => p.
|
|
455
|
+
function Xe() {
|
|
456
|
+
const e = w((p) => p.voucherConfig.language), t = w((p) => p.portrait), a = w((p) => p.setPortrait), n = w((p) => p.setPortraitZoom), { enhance: r, removeBg: s, isEnhancing: d, isRemovingBg: o, error: i, hasKey: c, setApiKey: u } = Le(), g = z(e), f = $(null), [b, h] = N(!1), [E, x] = N(!1), [v, S] = N(null), [y, k] = N(!1), [T, L] = N(!1), H = C(
|
|
456
457
|
async (p) => {
|
|
457
458
|
if (!p.type.startsWith("image/"))
|
|
458
459
|
return;
|
|
459
|
-
const
|
|
460
|
-
|
|
461
|
-
var
|
|
462
|
-
const
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
const W = await l(F);
|
|
466
|
-
a(W);
|
|
467
|
-
} catch (W) {
|
|
468
|
-
console.error("Background removal failed, using original:", W), a(F);
|
|
469
|
-
}
|
|
470
|
-
else
|
|
471
|
-
a(F);
|
|
472
|
-
}, v.readAsDataURL(p);
|
|
460
|
+
const P = new FileReader();
|
|
461
|
+
P.onload = async (D) => {
|
|
462
|
+
var _;
|
|
463
|
+
const A = (_ = D.target) == null ? void 0 : _.result;
|
|
464
|
+
S(A), a(A), k(!1), L(!1);
|
|
465
|
+
}, P.readAsDataURL(p);
|
|
473
466
|
},
|
|
474
|
-
[a
|
|
475
|
-
),
|
|
467
|
+
[a]
|
|
468
|
+
), W = C(
|
|
476
469
|
(p) => {
|
|
477
|
-
p.preventDefault(),
|
|
478
|
-
const
|
|
479
|
-
|
|
470
|
+
p.preventDefault(), h(!1);
|
|
471
|
+
const P = p.dataTransfer.files[0];
|
|
472
|
+
P && H(P);
|
|
480
473
|
},
|
|
481
|
-
[
|
|
482
|
-
),
|
|
483
|
-
p.preventDefault(),
|
|
484
|
-
}, []),
|
|
485
|
-
p.preventDefault(),
|
|
486
|
-
}, []),
|
|
474
|
+
[H]
|
|
475
|
+
), se = C((p) => {
|
|
476
|
+
p.preventDefault(), h(!0);
|
|
477
|
+
}, []), le = C((p) => {
|
|
478
|
+
p.preventDefault(), h(!1);
|
|
479
|
+
}, []), ce = () => {
|
|
487
480
|
var p;
|
|
488
|
-
(p =
|
|
489
|
-
},
|
|
490
|
-
var
|
|
491
|
-
const
|
|
492
|
-
|
|
493
|
-
},
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
C(!0);
|
|
497
|
-
return;
|
|
498
|
-
}
|
|
481
|
+
(p = f.current) == null || p.click();
|
|
482
|
+
}, de = (p) => {
|
|
483
|
+
var D;
|
|
484
|
+
const P = (D = p.target.files) == null ? void 0 : D[0];
|
|
485
|
+
P && H(P);
|
|
486
|
+
}, K = C(async (p, P, D) => {
|
|
487
|
+
let A = p;
|
|
488
|
+
if (P && c)
|
|
499
489
|
try {
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
console.error("Enhancement failed:", p);
|
|
490
|
+
A = await s(A);
|
|
491
|
+
} catch (_) {
|
|
492
|
+
console.error("Background removal failed:", _);
|
|
504
493
|
}
|
|
505
|
-
|
|
506
|
-
}, de = async (p) => {
|
|
507
|
-
if (b(p), t.original)
|
|
494
|
+
if (D)
|
|
508
495
|
try {
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
console.error("Enhancement failed:", v);
|
|
496
|
+
A = await r(A, "vintage");
|
|
497
|
+
} catch (_) {
|
|
498
|
+
console.error("Enhancement failed:", _);
|
|
513
499
|
}
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
500
|
+
a(A);
|
|
501
|
+
}, [c, s, r, a]), he = async () => {
|
|
502
|
+
if (!v) return;
|
|
503
|
+
if (!y && !c) {
|
|
504
|
+
x(!0);
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
507
|
+
const p = !y;
|
|
508
|
+
k(p), await K(v, p, T);
|
|
509
|
+
}, pe = async () => {
|
|
510
|
+
if (!v) return;
|
|
511
|
+
const p = !T;
|
|
512
|
+
L(p), await K(v, y, p);
|
|
513
|
+
}, me = async (p) => {
|
|
514
|
+
u(p), v && (k(!0), await K(v, !0, T));
|
|
515
|
+
}, ue = () => {
|
|
516
|
+
a(null), S(null), k(!1), L(!1);
|
|
517
|
+
}, ge = t.original;
|
|
518
|
+
return /* @__PURE__ */ m("div", { className: "space-y-4", children: [
|
|
519
|
+
t.original ? /* @__PURE__ */ m("div", { className: "space-y-4", children: [
|
|
520
|
+
/* @__PURE__ */ l("div", { className: "flex justify-center", children: /* @__PURE__ */ m("div", { className: "relative", children: [
|
|
521
|
+
/* @__PURE__ */ l("div", { className: "w-32 h-32 rounded-full overflow-hidden border-4 border-currency-gold shadow-lg", children: /* @__PURE__ */ l(
|
|
521
522
|
"img",
|
|
522
523
|
{
|
|
523
|
-
src:
|
|
524
|
+
src: ge || "",
|
|
524
525
|
alt: "Portrait",
|
|
525
526
|
className: "w-full h-full object-cover",
|
|
526
527
|
style: { transform: `scale(${t.zoom})` }
|
|
527
528
|
}
|
|
528
529
|
) }),
|
|
529
|
-
/* @__PURE__ */
|
|
530
|
+
/* @__PURE__ */ l(
|
|
530
531
|
"button",
|
|
531
532
|
{
|
|
532
533
|
className: "btn btn-circle btn-xs btn-error absolute -top-1 -right-1",
|
|
533
|
-
onClick:
|
|
534
|
-
children: /* @__PURE__ */
|
|
534
|
+
onClick: ue,
|
|
535
|
+
children: /* @__PURE__ */ l(
|
|
535
536
|
"svg",
|
|
536
537
|
{
|
|
537
538
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -539,7 +540,7 @@ function Ye() {
|
|
|
539
540
|
fill: "none",
|
|
540
541
|
viewBox: "0 0 24 24",
|
|
541
542
|
stroke: "currentColor",
|
|
542
|
-
children: /* @__PURE__ */
|
|
543
|
+
children: /* @__PURE__ */ l(
|
|
543
544
|
"path",
|
|
544
545
|
{
|
|
545
546
|
strokeLinecap: "round",
|
|
@@ -553,15 +554,15 @@ function Ye() {
|
|
|
553
554
|
}
|
|
554
555
|
)
|
|
555
556
|
] }) }),
|
|
556
|
-
/* @__PURE__ */
|
|
557
|
-
/* @__PURE__ */
|
|
558
|
-
/* @__PURE__ */
|
|
559
|
-
/* @__PURE__ */
|
|
557
|
+
/* @__PURE__ */ m("div", { className: "form-control", children: [
|
|
558
|
+
/* @__PURE__ */ m("label", { className: "label", children: [
|
|
559
|
+
/* @__PURE__ */ l("span", { className: "label-text", children: g.form.portrait.zoom }),
|
|
560
|
+
/* @__PURE__ */ m("span", { className: "label-text-alt", children: [
|
|
560
561
|
Math.round(t.zoom * 100),
|
|
561
562
|
"%"
|
|
562
563
|
] })
|
|
563
564
|
] }),
|
|
564
|
-
/* @__PURE__ */
|
|
565
|
+
/* @__PURE__ */ l(
|
|
565
566
|
"input",
|
|
566
567
|
{
|
|
567
568
|
type: "range",
|
|
@@ -569,86 +570,76 @@ function Ye() {
|
|
|
569
570
|
max: "2",
|
|
570
571
|
step: "0.05",
|
|
571
572
|
value: t.zoom,
|
|
572
|
-
onChange: (p) =>
|
|
573
|
+
onChange: (p) => n(parseFloat(p.target.value)),
|
|
573
574
|
className: "range range-primary range-sm"
|
|
574
575
|
}
|
|
575
576
|
)
|
|
576
577
|
] }),
|
|
577
|
-
|
|
578
|
-
/* @__PURE__ */
|
|
579
|
-
|
|
580
|
-
{
|
|
581
|
-
className: `btn btn-secondary ${s ? "loading" : ""}`,
|
|
582
|
-
onClick: ce,
|
|
583
|
-
disabled: s,
|
|
584
|
-
children: s ? /* @__PURE__ */ g($, { children: [
|
|
585
|
-
/* @__PURE__ */ i("span", { className: "loading loading-spinner loading-sm" }),
|
|
586
|
-
u.form.portrait.enhancing
|
|
587
|
-
] }) : /* @__PURE__ */ g($, { children: [
|
|
588
|
-
/* @__PURE__ */ i(
|
|
589
|
-
"svg",
|
|
590
|
-
{
|
|
591
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
592
|
-
className: "h-5 w-5 mr-1",
|
|
593
|
-
fill: "none",
|
|
594
|
-
viewBox: "0 0 24 24",
|
|
595
|
-
stroke: "currentColor",
|
|
596
|
-
children: /* @__PURE__ */ i(
|
|
597
|
-
"path",
|
|
598
|
-
{
|
|
599
|
-
strokeLinecap: "round",
|
|
600
|
-
strokeLinejoin: "round",
|
|
601
|
-
strokeWidth: 2,
|
|
602
|
-
d: "M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"
|
|
603
|
-
}
|
|
604
|
-
)
|
|
605
|
-
}
|
|
606
|
-
),
|
|
607
|
-
u.form.portrait.enhance
|
|
608
|
-
] })
|
|
609
|
-
}
|
|
610
|
-
),
|
|
611
|
-
m && /* @__PURE__ */ g("div", { className: "alert alert-warning text-sm py-2", children: [
|
|
612
|
-
/* @__PURE__ */ i("svg", { xmlns: "http://www.w3.org/2000/svg", className: "stroke-current shrink-0 h-5 w-5", fill: "none", viewBox: "0 0 24 24", children: /* @__PURE__ */ i("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" }) }),
|
|
613
|
-
/* @__PURE__ */ i("span", { children: m })
|
|
614
|
-
] }),
|
|
615
|
-
t.enhanced && /* @__PURE__ */ i("div", { className: "form-control", children: /* @__PURE__ */ g("label", { className: "label cursor-pointer justify-start gap-3", children: [
|
|
616
|
-
/* @__PURE__ */ i(
|
|
578
|
+
/* @__PURE__ */ m("div", { className: "flex flex-col gap-3", children: [
|
|
579
|
+
/* @__PURE__ */ l("div", { className: "form-control", children: /* @__PURE__ */ m("label", { className: "label cursor-pointer justify-start gap-3", children: [
|
|
580
|
+
/* @__PURE__ */ l(
|
|
617
581
|
"input",
|
|
618
582
|
{
|
|
619
583
|
type: "checkbox",
|
|
620
|
-
className:
|
|
621
|
-
checked:
|
|
622
|
-
onChange:
|
|
584
|
+
className: `toggle toggle-primary ${o ? "opacity-50" : ""}`,
|
|
585
|
+
checked: y,
|
|
586
|
+
onChange: he,
|
|
587
|
+
disabled: o
|
|
623
588
|
}
|
|
624
589
|
),
|
|
625
|
-
/* @__PURE__ */
|
|
626
|
-
|
|
590
|
+
/* @__PURE__ */ m("span", { className: "label-text flex items-center gap-2", children: [
|
|
591
|
+
o ? /* @__PURE__ */ m(M, { children: [
|
|
592
|
+
/* @__PURE__ */ l("span", { className: "loading loading-spinner loading-xs" }),
|
|
593
|
+
e === "de" ? "Hintergrund wird entfernt..." : "Removing background..."
|
|
594
|
+
] }) : e === "de" ? "Hintergrund entfernen" : "Remove background",
|
|
595
|
+
!c && /* @__PURE__ */ l("span", { className: "badge badge-sm badge-outline", children: "API" })
|
|
596
|
+
] })
|
|
597
|
+
] }) }),
|
|
598
|
+
/* @__PURE__ */ l("div", { className: "form-control", children: /* @__PURE__ */ m("label", { className: "label cursor-pointer justify-start gap-3", children: [
|
|
599
|
+
/* @__PURE__ */ l(
|
|
600
|
+
"input",
|
|
601
|
+
{
|
|
602
|
+
type: "checkbox",
|
|
603
|
+
className: `toggle toggle-secondary ${d ? "opacity-50" : ""}`,
|
|
604
|
+
checked: T,
|
|
605
|
+
onChange: pe,
|
|
606
|
+
disabled: d
|
|
607
|
+
}
|
|
608
|
+
),
|
|
609
|
+
/* @__PURE__ */ l("span", { className: "label-text flex items-center gap-2", children: d ? /* @__PURE__ */ m(M, { children: [
|
|
610
|
+
/* @__PURE__ */ l("span", { className: "loading loading-spinner loading-xs" }),
|
|
611
|
+
e === "de" ? "Gravur-Effekt wird angewendet..." : "Applying engraving effect..."
|
|
612
|
+
] }) : e === "de" ? "Gravur-Effekt" : "Engraving effect" })
|
|
613
|
+
] }) }),
|
|
614
|
+
i && /* @__PURE__ */ m("div", { className: "alert alert-warning text-sm py-2", children: [
|
|
615
|
+
/* @__PURE__ */ l("svg", { xmlns: "http://www.w3.org/2000/svg", className: "stroke-current shrink-0 h-5 w-5", fill: "none", viewBox: "0 0 24 24", children: /* @__PURE__ */ l("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" }) }),
|
|
616
|
+
/* @__PURE__ */ l("span", { children: i })
|
|
617
|
+
] })
|
|
627
618
|
] })
|
|
628
|
-
] }) : /* @__PURE__ */
|
|
619
|
+
] }) : /* @__PURE__ */ m(
|
|
629
620
|
"div",
|
|
630
621
|
{
|
|
631
|
-
className: `border-2 border-dashed rounded-lg p-8 text-center cursor-pointer transition-colors ${
|
|
632
|
-
onDrop:
|
|
633
|
-
onDragOver:
|
|
634
|
-
onDragLeave:
|
|
635
|
-
onClick:
|
|
622
|
+
className: `border-2 border-dashed rounded-lg p-8 text-center cursor-pointer transition-colors ${o ? "border-primary bg-primary/10 pointer-events-none" : b ? "border-primary bg-primary/10" : "border-base-300 hover:border-primary hover:bg-base-200"}`,
|
|
623
|
+
onDrop: W,
|
|
624
|
+
onDragOver: se,
|
|
625
|
+
onDragLeave: le,
|
|
626
|
+
onClick: ce,
|
|
636
627
|
children: [
|
|
637
|
-
/* @__PURE__ */
|
|
628
|
+
/* @__PURE__ */ l(
|
|
638
629
|
"input",
|
|
639
630
|
{
|
|
640
|
-
ref:
|
|
631
|
+
ref: f,
|
|
641
632
|
type: "file",
|
|
642
633
|
accept: "image/*",
|
|
643
634
|
className: "hidden",
|
|
644
|
-
onChange:
|
|
635
|
+
onChange: de
|
|
645
636
|
}
|
|
646
637
|
),
|
|
647
|
-
|
|
648
|
-
/* @__PURE__ */
|
|
649
|
-
/* @__PURE__ */
|
|
650
|
-
] }) : /* @__PURE__ */
|
|
651
|
-
/* @__PURE__ */
|
|
638
|
+
o ? /* @__PURE__ */ m("div", { className: "flex flex-col items-center gap-2", children: [
|
|
639
|
+
/* @__PURE__ */ l("span", { className: "loading loading-spinner loading-lg text-primary" }),
|
|
640
|
+
/* @__PURE__ */ l("p", { className: "font-medium", children: e === "de" ? "Hintergrund wird entfernt..." : "Removing background..." })
|
|
641
|
+
] }) : /* @__PURE__ */ m("div", { className: "flex flex-col items-center gap-2", children: [
|
|
642
|
+
/* @__PURE__ */ l(
|
|
652
643
|
"svg",
|
|
653
644
|
{
|
|
654
645
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -656,7 +647,7 @@ function Ye() {
|
|
|
656
647
|
fill: "none",
|
|
657
648
|
viewBox: "0 0 24 24",
|
|
658
649
|
stroke: "currentColor",
|
|
659
|
-
children: /* @__PURE__ */
|
|
650
|
+
children: /* @__PURE__ */ l(
|
|
660
651
|
"path",
|
|
661
652
|
{
|
|
662
653
|
strokeLinecap: "round",
|
|
@@ -667,67 +658,67 @@ function Ye() {
|
|
|
667
658
|
)
|
|
668
659
|
}
|
|
669
660
|
),
|
|
670
|
-
/* @__PURE__ */
|
|
671
|
-
/* @__PURE__ */
|
|
661
|
+
/* @__PURE__ */ l("p", { className: "font-medium", children: g.form.portrait.upload }),
|
|
662
|
+
/* @__PURE__ */ l("p", { className: "text-sm text-base-content/60", children: g.form.portrait.dragDrop })
|
|
672
663
|
] })
|
|
673
664
|
]
|
|
674
665
|
}
|
|
675
666
|
),
|
|
676
|
-
/* @__PURE__ */
|
|
677
|
-
|
|
667
|
+
/* @__PURE__ */ l(
|
|
668
|
+
De,
|
|
678
669
|
{
|
|
679
670
|
isOpen: E,
|
|
680
|
-
onClose: () =>
|
|
681
|
-
onSubmit:
|
|
671
|
+
onClose: () => x(!1),
|
|
672
|
+
onSubmit: me
|
|
682
673
|
}
|
|
683
674
|
)
|
|
684
675
|
] });
|
|
685
676
|
}
|
|
686
|
-
function
|
|
677
|
+
function Je() {
|
|
687
678
|
return null;
|
|
688
679
|
}
|
|
689
|
-
const
|
|
680
|
+
const I = typeof import.meta < "u" && "/" || "/", _e = {
|
|
690
681
|
en: {
|
|
691
682
|
1: {
|
|
692
|
-
front: `${
|
|
693
|
-
back: `${
|
|
683
|
+
front: `${I}templates/front_ldpi_en.png`,
|
|
684
|
+
back: `${I}templates/back_ldpi_en.png`,
|
|
694
685
|
width: 1536,
|
|
695
686
|
height: 1024
|
|
696
687
|
},
|
|
697
688
|
5: {
|
|
698
|
-
front: `${
|
|
699
|
-
back: `${
|
|
689
|
+
front: `${I}templates/front_ldpi_en.png`,
|
|
690
|
+
back: `${I}templates/back_ldpi_en.png`,
|
|
700
691
|
width: 1536,
|
|
701
692
|
height: 1024
|
|
702
693
|
},
|
|
703
694
|
10: {
|
|
704
|
-
front: `${
|
|
705
|
-
back: `${
|
|
695
|
+
front: `${I}templates/front_ldpi_en.png`,
|
|
696
|
+
back: `${I}templates/back_ldpi_en.png`,
|
|
706
697
|
width: 1536,
|
|
707
698
|
height: 1024
|
|
708
699
|
}
|
|
709
700
|
},
|
|
710
701
|
de: {
|
|
711
702
|
1: {
|
|
712
|
-
front: `${
|
|
713
|
-
back: `${
|
|
703
|
+
front: `${I}templates/front_hdpi_de.webp`,
|
|
704
|
+
back: `${I}templates/back_hdpi_de.webp`,
|
|
714
705
|
width: 6144,
|
|
715
706
|
height: 3200
|
|
716
707
|
},
|
|
717
708
|
5: {
|
|
718
|
-
front: `${
|
|
719
|
-
back: `${
|
|
709
|
+
front: `${I}templates/front_hdpi_de.webp`,
|
|
710
|
+
back: `${I}templates/back_hdpi_de.webp`,
|
|
720
711
|
width: 6144,
|
|
721
712
|
height: 3200
|
|
722
713
|
},
|
|
723
714
|
10: {
|
|
724
|
-
front: `${
|
|
725
|
-
back: `${
|
|
715
|
+
front: `${I}templates/front_hdpi_de.webp`,
|
|
716
|
+
back: `${I}templates/back_hdpi_de.webp`,
|
|
726
717
|
width: 6144,
|
|
727
718
|
height: 3200
|
|
728
719
|
}
|
|
729
720
|
}
|
|
730
|
-
},
|
|
721
|
+
}, B = {
|
|
731
722
|
front: {
|
|
732
723
|
portrait: {
|
|
733
724
|
x: 768,
|
|
@@ -773,7 +764,7 @@ const x = typeof import.meta < "u" && "/" || "/", Ae = {
|
|
|
773
764
|
align: "center"
|
|
774
765
|
}
|
|
775
766
|
}
|
|
776
|
-
},
|
|
767
|
+
}, R = {
|
|
777
768
|
front: {
|
|
778
769
|
portrait: {
|
|
779
770
|
x: 3074,
|
|
@@ -820,14 +811,14 @@ const x = typeof import.meta < "u" && "/" || "/", Ae = {
|
|
|
820
811
|
}
|
|
821
812
|
}
|
|
822
813
|
};
|
|
823
|
-
function
|
|
824
|
-
return e === "de" ?
|
|
814
|
+
function te(e) {
|
|
815
|
+
return e === "de" ? R : B;
|
|
825
816
|
}
|
|
826
|
-
function
|
|
827
|
-
return
|
|
817
|
+
function ne(e, t) {
|
|
818
|
+
return _e[e][t];
|
|
828
819
|
}
|
|
829
820
|
const O = /* @__PURE__ */ new Map();
|
|
830
|
-
async function
|
|
821
|
+
async function Y(e) {
|
|
831
822
|
return O.has(e) ? O.get(e) : new Promise((t, a) => {
|
|
832
823
|
const n = new Image();
|
|
833
824
|
n.crossOrigin = "anonymous", n.onload = () => {
|
|
@@ -835,125 +826,125 @@ async function j(e) {
|
|
|
835
826
|
}, n.onerror = a, n.src = e;
|
|
836
827
|
});
|
|
837
828
|
}
|
|
838
|
-
function
|
|
829
|
+
function ae(e, t, a, n) {
|
|
839
830
|
e.drawImage(t, 0, 0, a, n);
|
|
840
831
|
}
|
|
841
|
-
function
|
|
842
|
-
e.save(), e.beginPath(), e.ellipse(a, n, r,
|
|
843
|
-
const
|
|
844
|
-
let
|
|
845
|
-
|
|
846
|
-
const
|
|
847
|
-
e.drawImage(t,
|
|
832
|
+
function Be(e, t, a, n, r, s, d = 1) {
|
|
833
|
+
e.save(), e.beginPath(), e.ellipse(a, n, r, s, 0, 0, Math.PI * 2), e.closePath(), e.clip();
|
|
834
|
+
const o = t.width / t.height, i = r / s, c = r * 2, u = s * 2;
|
|
835
|
+
let g, f;
|
|
836
|
+
o > i ? (f = u, g = u * o) : (g = c, f = c / o), g *= d, f *= d;
|
|
837
|
+
const b = a - g / 2, h = n - f / 2;
|
|
838
|
+
e.drawImage(t, b, h, g, f), e.restore();
|
|
848
839
|
}
|
|
849
|
-
function
|
|
840
|
+
function re(e, t, a, n = "#2a3a2a") {
|
|
850
841
|
e.save(), e.font = `${a.fontSize}px "Times New Roman", serif`, e.textAlign = a.align || "center", e.textBaseline = "middle", e.fillStyle = n, a.maxWidth ? e.fillText(t, a.x, a.y, a.maxWidth) : e.fillText(t, a.x, a.y), e.restore();
|
|
851
842
|
}
|
|
852
|
-
function
|
|
843
|
+
function Re(e, t, a, n = "#2a3a2a") {
|
|
853
844
|
e.save(), e.font = `${a.fontSize}px "Times New Roman", serif`, e.textAlign = a.align || "center", e.textBaseline = "top", e.fillStyle = n;
|
|
854
|
-
const r = a.maxWidth || 400,
|
|
855
|
-
let
|
|
856
|
-
for (const
|
|
857
|
-
const
|
|
858
|
-
e.measureText(
|
|
845
|
+
const r = a.maxWidth || 400, s = a.lineHeight || a.fontSize * 1.4, d = t.split(" "), o = [];
|
|
846
|
+
let i = "";
|
|
847
|
+
for (const g of d) {
|
|
848
|
+
const f = i ? `${i} ${g}` : g;
|
|
849
|
+
e.measureText(f).width > r && i ? (o.push(i), i = g) : i = f;
|
|
859
850
|
}
|
|
860
|
-
|
|
861
|
-
const c =
|
|
862
|
-
let
|
|
863
|
-
for (const
|
|
864
|
-
e.fillText(
|
|
851
|
+
i && o.push(i);
|
|
852
|
+
const c = o.length * s;
|
|
853
|
+
let u = a.y - c / 2;
|
|
854
|
+
for (const g of o)
|
|
855
|
+
e.fillText(g, a.x, u), u += s;
|
|
865
856
|
e.restore();
|
|
866
857
|
}
|
|
867
|
-
function
|
|
868
|
-
e.save(), e.font = `${r.fontSize}px "Times New Roman", serif`, e.textAlign = r.align || "center", e.textBaseline = "middle", e.fillStyle =
|
|
869
|
-
const d = r.lineHeight || r.fontSize * 1.8,
|
|
870
|
-
let c = r.y -
|
|
871
|
-
for (const
|
|
872
|
-
|
|
858
|
+
function $e(e, t, a, n, r, s = "#2a3a2a") {
|
|
859
|
+
e.save(), e.font = `${r.fontSize}px "Times New Roman", serif`, e.textAlign = r.align || "center", e.textBaseline = "middle", e.fillStyle = s;
|
|
860
|
+
const d = r.lineHeight || r.fontSize * 1.8, o = [t, a, n].filter(Boolean), i = (o.length - 1) * d;
|
|
861
|
+
let c = r.y - i / 2;
|
|
862
|
+
for (const u of o)
|
|
863
|
+
u && (e.fillText(u, r.x, c), c += d);
|
|
873
864
|
e.restore();
|
|
874
865
|
}
|
|
875
|
-
async function
|
|
876
|
-
const
|
|
877
|
-
if (!
|
|
878
|
-
e.width =
|
|
879
|
-
const c = await
|
|
880
|
-
if (
|
|
866
|
+
async function oe(e, t, a, n, r, s, d, o = 1) {
|
|
867
|
+
const i = e.getContext("2d");
|
|
868
|
+
if (!i) return;
|
|
869
|
+
e.width = s, e.height = d, i.clearRect(0, 0, s, d);
|
|
870
|
+
const c = await Y(t);
|
|
871
|
+
if (ae(i, c, s, d), a)
|
|
881
872
|
try {
|
|
882
|
-
const
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
873
|
+
const u = await Y(a);
|
|
874
|
+
Be(
|
|
875
|
+
i,
|
|
876
|
+
u,
|
|
886
877
|
r.portrait.x,
|
|
887
878
|
r.portrait.y,
|
|
888
879
|
r.portrait.radiusX,
|
|
889
880
|
r.portrait.radiusY,
|
|
890
|
-
|
|
881
|
+
o
|
|
891
882
|
);
|
|
892
|
-
} catch (
|
|
893
|
-
console.error("Failed to load portrait:",
|
|
883
|
+
} catch (u) {
|
|
884
|
+
console.error("Failed to load portrait:", u);
|
|
894
885
|
}
|
|
895
|
-
n &&
|
|
886
|
+
n && re(i, n, r.namePlate);
|
|
896
887
|
}
|
|
897
|
-
async function
|
|
888
|
+
async function ie(e, t, a, n, r, s, d, o, i) {
|
|
898
889
|
const c = e.getContext("2d");
|
|
899
890
|
if (!c) return;
|
|
900
|
-
e.width =
|
|
901
|
-
const
|
|
902
|
-
|
|
891
|
+
e.width = o, e.height = i, c.clearRect(0, 0, o, i);
|
|
892
|
+
const u = await Y(t);
|
|
893
|
+
ae(c, u, o, i), d.contactInfo && (a || n || r) && $e(c, a, n, r, d.contactInfo), d.description && s && Re(c, s, d.description), a && re(c, a, d.namePlate);
|
|
903
894
|
}
|
|
904
|
-
function
|
|
905
|
-
const e = w((y) => y.voucherConfig.language), t = w((y) => y.voucherConfig.hours), a = w((y) => y.voucherConfig.description), n = w((y) => y.personalInfo), r = w((y) => y.portrait),
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
895
|
+
function Qe() {
|
|
896
|
+
const e = w((y) => y.voucherConfig.language), t = w((y) => y.voucherConfig.hours), a = w((y) => y.voucherConfig.description), n = w((y) => y.personalInfo), r = w((y) => y.portrait), s = w((y) => y.currentSide), d = w((y) => y.flipSide), o = z(e), i = $(null), c = $(null), u = $(null), [g, f] = N(!1), b = ne(e, t), h = te(e), E = r.useEnhanced && r.enhanced ? r.enhanced : r.original, x = J(e, t, a);
|
|
897
|
+
G(() => {
|
|
898
|
+
i.current && oe(
|
|
899
|
+
i.current,
|
|
900
|
+
b.front,
|
|
901
|
+
E,
|
|
911
902
|
n.name,
|
|
912
903
|
h.front,
|
|
913
|
-
|
|
914
|
-
|
|
904
|
+
b.width,
|
|
905
|
+
b.height,
|
|
915
906
|
r.zoom
|
|
916
907
|
);
|
|
917
|
-
}, [
|
|
918
|
-
c.current &&
|
|
908
|
+
}, [b, E, n.name, h, r.zoom]), G(() => {
|
|
909
|
+
c.current && ie(
|
|
919
910
|
c.current,
|
|
920
|
-
|
|
911
|
+
b.back,
|
|
921
912
|
n.name,
|
|
922
913
|
n.email,
|
|
923
914
|
n.phone,
|
|
924
|
-
|
|
915
|
+
x,
|
|
925
916
|
h.back,
|
|
926
|
-
|
|
927
|
-
|
|
917
|
+
b.width,
|
|
918
|
+
b.height
|
|
928
919
|
);
|
|
929
|
-
}, [
|
|
930
|
-
const
|
|
931
|
-
|
|
932
|
-
d(),
|
|
920
|
+
}, [b, n, x, h]);
|
|
921
|
+
const v = () => {
|
|
922
|
+
f(!0), setTimeout(() => {
|
|
923
|
+
d(), f(!1);
|
|
933
924
|
}, 150);
|
|
934
|
-
},
|
|
935
|
-
return /* @__PURE__ */
|
|
936
|
-
/* @__PURE__ */
|
|
937
|
-
/* @__PURE__ */
|
|
938
|
-
/* @__PURE__ */
|
|
925
|
+
}, S = b.width / b.height;
|
|
926
|
+
return /* @__PURE__ */ m("div", { className: "space-y-4", children: [
|
|
927
|
+
/* @__PURE__ */ m("div", { className: "flex justify-between items-center", children: [
|
|
928
|
+
/* @__PURE__ */ m("div", { className: "tabs tabs-boxed bg-base-200", children: [
|
|
929
|
+
/* @__PURE__ */ l(
|
|
939
930
|
"button",
|
|
940
931
|
{
|
|
941
|
-
className: `tab ${
|
|
942
|
-
onClick: () =>
|
|
943
|
-
children:
|
|
932
|
+
className: `tab ${s === "front" ? "tab-active bg-primary text-primary-content font-semibold" : ""}`,
|
|
933
|
+
onClick: () => s !== "front" && v(),
|
|
934
|
+
children: o.preview.front
|
|
944
935
|
}
|
|
945
936
|
),
|
|
946
|
-
/* @__PURE__ */
|
|
937
|
+
/* @__PURE__ */ l(
|
|
947
938
|
"button",
|
|
948
939
|
{
|
|
949
|
-
className: `tab ${
|
|
950
|
-
onClick: () =>
|
|
951
|
-
children:
|
|
940
|
+
className: `tab ${s === "back" ? "tab-active bg-primary text-primary-content font-semibold" : ""}`,
|
|
941
|
+
onClick: () => s !== "back" && v(),
|
|
942
|
+
children: o.preview.back
|
|
952
943
|
}
|
|
953
944
|
)
|
|
954
945
|
] }),
|
|
955
|
-
/* @__PURE__ */
|
|
956
|
-
/* @__PURE__ */
|
|
946
|
+
/* @__PURE__ */ m("button", { className: "btn btn-ghost btn-sm", onClick: v, children: [
|
|
947
|
+
/* @__PURE__ */ l(
|
|
957
948
|
"svg",
|
|
958
949
|
{
|
|
959
950
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -961,7 +952,7 @@ function Ve() {
|
|
|
961
952
|
fill: "none",
|
|
962
953
|
viewBox: "0 0 24 24",
|
|
963
954
|
stroke: "currentColor",
|
|
964
|
-
children: /* @__PURE__ */
|
|
955
|
+
children: /* @__PURE__ */ l(
|
|
965
956
|
"path",
|
|
966
957
|
{
|
|
967
958
|
strokeLinecap: "round",
|
|
@@ -972,28 +963,28 @@ function Ve() {
|
|
|
972
963
|
)
|
|
973
964
|
}
|
|
974
965
|
),
|
|
975
|
-
|
|
966
|
+
o.preview.flip
|
|
976
967
|
] })
|
|
977
968
|
] }),
|
|
978
|
-
/* @__PURE__ */
|
|
969
|
+
/* @__PURE__ */ m(
|
|
979
970
|
"div",
|
|
980
971
|
{
|
|
981
|
-
ref:
|
|
972
|
+
ref: u,
|
|
982
973
|
className: "relative w-full overflow-hidden shadow-lg",
|
|
983
|
-
style: { aspectRatio:
|
|
974
|
+
style: { aspectRatio: S },
|
|
984
975
|
children: [
|
|
985
|
-
/* @__PURE__ */
|
|
976
|
+
/* @__PURE__ */ l(
|
|
986
977
|
"canvas",
|
|
987
978
|
{
|
|
988
|
-
ref:
|
|
989
|
-
className: `absolute inset-0 w-full h-full transition-all duration-300 ${
|
|
979
|
+
ref: i,
|
|
980
|
+
className: `absolute inset-0 w-full h-full transition-all duration-300 ${s === "front" ? g ? "opacity-0 scale-95" : "opacity-100 scale-100" : "opacity-0 scale-95 pointer-events-none"}`
|
|
990
981
|
}
|
|
991
982
|
),
|
|
992
|
-
/* @__PURE__ */
|
|
983
|
+
/* @__PURE__ */ l(
|
|
993
984
|
"canvas",
|
|
994
985
|
{
|
|
995
986
|
ref: c,
|
|
996
|
-
className: `absolute inset-0 w-full h-full transition-all duration-300 ${
|
|
987
|
+
className: `absolute inset-0 w-full h-full transition-all duration-300 ${s === "back" ? g ? "opacity-0 scale-95" : "opacity-100 scale-100" : "opacity-0 scale-95 pointer-events-none"}`
|
|
997
988
|
}
|
|
998
989
|
)
|
|
999
990
|
]
|
|
@@ -1001,71 +992,71 @@ function Ve() {
|
|
|
1001
992
|
)
|
|
1002
993
|
] });
|
|
1003
994
|
}
|
|
1004
|
-
function
|
|
1005
|
-
const e =
|
|
995
|
+
function et() {
|
|
996
|
+
const e = $(null), t = $(null);
|
|
1006
997
|
return { frontCanvasRef: e, backCanvasRef: t };
|
|
1007
998
|
}
|
|
1008
|
-
async function
|
|
999
|
+
async function ze(e) {
|
|
1009
1000
|
const {
|
|
1010
1001
|
frontTemplateSrc: t,
|
|
1011
1002
|
backTemplateSrc: a,
|
|
1012
1003
|
templateWidth: n,
|
|
1013
1004
|
templateHeight: r,
|
|
1014
|
-
layout:
|
|
1005
|
+
layout: s,
|
|
1015
1006
|
portrait: d,
|
|
1016
|
-
portraitZoom:
|
|
1017
|
-
name:
|
|
1007
|
+
portraitZoom: o = 1,
|
|
1008
|
+
name: i,
|
|
1018
1009
|
email: c,
|
|
1019
|
-
phone:
|
|
1020
|
-
description:
|
|
1021
|
-
} = e,
|
|
1010
|
+
phone: u,
|
|
1011
|
+
description: g
|
|
1012
|
+
} = e, f = document.createElement("canvas"), b = document.createElement("canvas");
|
|
1022
1013
|
await Promise.all([
|
|
1023
|
-
|
|
1024
|
-
|
|
1014
|
+
oe(f, t, d, i, s.front, n, r, o),
|
|
1015
|
+
ie(b, a, i, c, u, g, s.back, n, r)
|
|
1025
1016
|
]);
|
|
1026
|
-
const h = new
|
|
1017
|
+
const h = new ye({
|
|
1027
1018
|
orientation: "landscape",
|
|
1028
1019
|
unit: "mm",
|
|
1029
1020
|
format: "a4"
|
|
1030
|
-
}),
|
|
1031
|
-
let y =
|
|
1032
|
-
|
|
1033
|
-
const
|
|
1034
|
-
h.addImage(
|
|
1035
|
-
const
|
|
1036
|
-
return h.addImage(
|
|
1021
|
+
}), E = 297, x = 210, v = 10, S = n / r;
|
|
1022
|
+
let y = E - v * 2, k = y / S;
|
|
1023
|
+
k > x - v * 2 && (k = x - v * 2, y = k * S);
|
|
1024
|
+
const T = (E - y) / 2, L = (x - k) / 2, H = f.toDataURL("image/jpeg", 0.95);
|
|
1025
|
+
h.addImage(H, "JPEG", T, L, y, k), h.addPage();
|
|
1026
|
+
const W = b.toDataURL("image/jpeg", 0.95);
|
|
1027
|
+
return h.addImage(W, "JPEG", T, L, y, k), h.output("blob");
|
|
1037
1028
|
}
|
|
1038
|
-
function
|
|
1029
|
+
function He(e, t) {
|
|
1039
1030
|
const a = URL.createObjectURL(e), n = document.createElement("a");
|
|
1040
1031
|
n.href = a, n.download = t, document.body.appendChild(n), n.click(), document.body.removeChild(n), URL.revokeObjectURL(a);
|
|
1041
1032
|
}
|
|
1042
|
-
async function
|
|
1043
|
-
const t = await
|
|
1044
|
-
|
|
1033
|
+
async function Me(e) {
|
|
1034
|
+
const t = await ze(e);
|
|
1035
|
+
He(t, e.filename);
|
|
1045
1036
|
}
|
|
1046
|
-
function
|
|
1047
|
-
const e = w((h) => h.voucherConfig.language), t = w((h) => h.voucherConfig.hours), a = w((h) => h.voucherConfig.description), n = w((h) => h.personalInfo), r = w((h) => h.portrait),
|
|
1048
|
-
return /* @__PURE__ */
|
|
1037
|
+
function tt() {
|
|
1038
|
+
const e = w((h) => h.voucherConfig.language), t = w((h) => h.voucherConfig.hours), a = w((h) => h.voucherConfig.description), n = w((h) => h.personalInfo), r = w((h) => h.portrait), s = w((h) => h.isExporting), d = w((h) => h.setIsExporting), o = z(e), i = ne(e, t), c = te(e), u = r.useEnhanced && r.enhanced ? r.enhanced : r.original, g = J(e, t, a), f = n.name.trim().length > 0 && n.email.trim().length > 0 && n.phone.trim().length > 0 && r.original !== null;
|
|
1039
|
+
return /* @__PURE__ */ l(
|
|
1049
1040
|
"button",
|
|
1050
1041
|
{
|
|
1051
|
-
className: `btn btn-primary flex-1 ${
|
|
1042
|
+
className: `btn btn-primary flex-1 ${s ? "loading" : ""}`,
|
|
1052
1043
|
onClick: async () => {
|
|
1053
|
-
if (!(!
|
|
1044
|
+
if (!(!f || s)) {
|
|
1054
1045
|
d(!0);
|
|
1055
1046
|
try {
|
|
1056
1047
|
const h = `zeitgutschein-${t}h-${n.name.replace(/\s+/g, "-").toLowerCase()}.pdf`;
|
|
1057
|
-
await
|
|
1058
|
-
frontTemplateSrc:
|
|
1059
|
-
backTemplateSrc:
|
|
1060
|
-
templateWidth:
|
|
1061
|
-
templateHeight:
|
|
1048
|
+
await Me({
|
|
1049
|
+
frontTemplateSrc: i.front,
|
|
1050
|
+
backTemplateSrc: i.back,
|
|
1051
|
+
templateWidth: i.width,
|
|
1052
|
+
templateHeight: i.height,
|
|
1062
1053
|
layout: c,
|
|
1063
|
-
portrait:
|
|
1054
|
+
portrait: u,
|
|
1064
1055
|
portraitZoom: r.zoom,
|
|
1065
1056
|
name: n.name,
|
|
1066
1057
|
email: n.email,
|
|
1067
1058
|
phone: n.phone,
|
|
1068
|
-
description:
|
|
1059
|
+
description: g,
|
|
1069
1060
|
filename: h
|
|
1070
1061
|
});
|
|
1071
1062
|
} catch (h) {
|
|
@@ -1075,12 +1066,12 @@ function Ze() {
|
|
|
1075
1066
|
}
|
|
1076
1067
|
}
|
|
1077
1068
|
},
|
|
1078
|
-
disabled: !
|
|
1079
|
-
children:
|
|
1080
|
-
/* @__PURE__ */
|
|
1081
|
-
|
|
1082
|
-
] }) : /* @__PURE__ */
|
|
1083
|
-
/* @__PURE__ */
|
|
1069
|
+
disabled: !f || s,
|
|
1070
|
+
children: s ? /* @__PURE__ */ m(M, { children: [
|
|
1071
|
+
/* @__PURE__ */ l("span", { className: "loading loading-spinner loading-sm" }),
|
|
1072
|
+
o.export.exporting
|
|
1073
|
+
] }) : /* @__PURE__ */ m(M, { children: [
|
|
1074
|
+
/* @__PURE__ */ l(
|
|
1084
1075
|
"svg",
|
|
1085
1076
|
{
|
|
1086
1077
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1088,7 +1079,7 @@ function Ze() {
|
|
|
1088
1079
|
fill: "none",
|
|
1089
1080
|
viewBox: "0 0 24 24",
|
|
1090
1081
|
stroke: "currentColor",
|
|
1091
|
-
children: /* @__PURE__ */
|
|
1082
|
+
children: /* @__PURE__ */ l(
|
|
1092
1083
|
"path",
|
|
1093
1084
|
{
|
|
1094
1085
|
strokeLinecap: "round",
|
|
@@ -1099,17 +1090,17 @@ function Ze() {
|
|
|
1099
1090
|
)
|
|
1100
1091
|
}
|
|
1101
1092
|
),
|
|
1102
|
-
|
|
1093
|
+
o.export.button
|
|
1103
1094
|
] })
|
|
1104
1095
|
}
|
|
1105
1096
|
);
|
|
1106
1097
|
}
|
|
1107
|
-
function
|
|
1098
|
+
function Ue() {
|
|
1108
1099
|
const e = w((n) => n.voucherConfig.language), t = w((n) => n.setLanguage), a = (n) => {
|
|
1109
1100
|
t(n);
|
|
1110
1101
|
};
|
|
1111
|
-
return /* @__PURE__ */
|
|
1112
|
-
/* @__PURE__ */
|
|
1102
|
+
return /* @__PURE__ */ m("div", { className: "join", children: [
|
|
1103
|
+
/* @__PURE__ */ l(
|
|
1113
1104
|
"button",
|
|
1114
1105
|
{
|
|
1115
1106
|
className: `join-item btn btn-sm ${e === "de" ? "btn-active btn-primary" : "btn-ghost"}`,
|
|
@@ -1117,7 +1108,7 @@ function $e() {
|
|
|
1117
1108
|
children: "DE"
|
|
1118
1109
|
}
|
|
1119
1110
|
),
|
|
1120
|
-
/* @__PURE__ */
|
|
1111
|
+
/* @__PURE__ */ l(
|
|
1121
1112
|
"button",
|
|
1122
1113
|
{
|
|
1123
1114
|
className: `join-item btn btn-sm ${e === "en" ? "btn-active btn-primary" : "btn-ghost"}`,
|
|
@@ -1127,22 +1118,22 @@ function $e() {
|
|
|
1127
1118
|
)
|
|
1128
1119
|
] });
|
|
1129
1120
|
}
|
|
1130
|
-
function
|
|
1131
|
-
const e = w((a) => a.voucherConfig.language), t =
|
|
1132
|
-
return /* @__PURE__ */
|
|
1133
|
-
/* @__PURE__ */
|
|
1134
|
-
/* @__PURE__ */
|
|
1135
|
-
/* @__PURE__ */
|
|
1121
|
+
function nt() {
|
|
1122
|
+
const e = w((a) => a.voucherConfig.language), t = z(e);
|
|
1123
|
+
return /* @__PURE__ */ m("div", { className: "navbar bg-currency-green text-currency-cream shadow-lg", children: [
|
|
1124
|
+
/* @__PURE__ */ l("div", { className: "navbar-start", children: /* @__PURE__ */ l("a", { className: "btn btn-ghost text-xl font-currency font-bold", children: t.header.title }) }),
|
|
1125
|
+
/* @__PURE__ */ l("div", { className: "navbar-center hidden sm:flex", children: /* @__PURE__ */ l("span", { className: "text-sm opacity-80", children: t.header.subtitle }) }),
|
|
1126
|
+
/* @__PURE__ */ l("div", { className: "navbar-end", children: /* @__PURE__ */ l(Ue, {}) })
|
|
1136
1127
|
] });
|
|
1137
1128
|
}
|
|
1138
|
-
const
|
|
1129
|
+
const U = "/", Fe = {
|
|
1139
1130
|
id: "time-voucher-classic-de",
|
|
1140
1131
|
name: "Zeitgutschein Classic",
|
|
1141
1132
|
type: "time-voucher",
|
|
1142
1133
|
category: "classic",
|
|
1143
1134
|
images: {
|
|
1144
|
-
front: `${
|
|
1145
|
-
back: `${
|
|
1135
|
+
front: `${U}templates/front_hdpi_de.jpg`,
|
|
1136
|
+
back: `${U}templates/back_hdpi_de.jpg`,
|
|
1146
1137
|
width: 6144,
|
|
1147
1138
|
height: 4096
|
|
1148
1139
|
},
|
|
@@ -1189,24 +1180,24 @@ const z = "/", ze = {
|
|
|
1189
1180
|
],
|
|
1190
1181
|
layout: {
|
|
1191
1182
|
front: {
|
|
1192
|
-
portrait:
|
|
1193
|
-
name:
|
|
1183
|
+
portrait: R.front.portrait,
|
|
1184
|
+
name: R.front.namePlate
|
|
1194
1185
|
},
|
|
1195
1186
|
back: {
|
|
1196
|
-
name:
|
|
1197
|
-
contactInfo:
|
|
1198
|
-
description:
|
|
1187
|
+
name: R.back.namePlate,
|
|
1188
|
+
contactInfo: R.back.contactInfo,
|
|
1189
|
+
description: R.back.description
|
|
1199
1190
|
}
|
|
1200
1191
|
},
|
|
1201
1192
|
languages: ["de"]
|
|
1202
|
-
},
|
|
1193
|
+
}, We = {
|
|
1203
1194
|
id: "time-voucher-classic-en",
|
|
1204
1195
|
name: "Time Voucher Classic",
|
|
1205
1196
|
type: "time-voucher",
|
|
1206
1197
|
category: "classic",
|
|
1207
1198
|
images: {
|
|
1208
|
-
front: `${
|
|
1209
|
-
back: `${
|
|
1199
|
+
front: `${U}templates/front_ldpi_en.png`,
|
|
1200
|
+
back: `${U}templates/back_ldpi_en.png`,
|
|
1210
1201
|
width: 1536,
|
|
1211
1202
|
height: 1024
|
|
1212
1203
|
},
|
|
@@ -1253,86 +1244,86 @@ const z = "/", ze = {
|
|
|
1253
1244
|
],
|
|
1254
1245
|
layout: {
|
|
1255
1246
|
front: {
|
|
1256
|
-
portrait:
|
|
1257
|
-
name:
|
|
1247
|
+
portrait: B.front.portrait,
|
|
1248
|
+
name: B.front.namePlate
|
|
1258
1249
|
},
|
|
1259
1250
|
back: {
|
|
1260
|
-
name:
|
|
1261
|
-
contactInfo:
|
|
1262
|
-
description:
|
|
1251
|
+
name: B.back.namePlate,
|
|
1252
|
+
contactInfo: B.back.contactInfo,
|
|
1253
|
+
description: B.back.description
|
|
1263
1254
|
}
|
|
1264
1255
|
},
|
|
1265
1256
|
languages: ["en"]
|
|
1266
|
-
},
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
],
|
|
1257
|
+
}, X = [
|
|
1258
|
+
Fe,
|
|
1259
|
+
We
|
|
1260
|
+
], Ke = {
|
|
1270
1261
|
async listTemplates(e) {
|
|
1271
|
-
let t = [...
|
|
1262
|
+
let t = [...X];
|
|
1272
1263
|
return e != null && e.type && (t = t.filter((a) => a.type === e.type)), e != null && e.category && (t = t.filter((a) => a.category === e.category)), e != null && e.language && (t = t.filter((a) => a.languages.includes(e.language))), t;
|
|
1273
1264
|
},
|
|
1274
1265
|
async getTemplate(e) {
|
|
1275
|
-
const t =
|
|
1266
|
+
const t = X.find((a) => a.id === e);
|
|
1276
1267
|
if (!t)
|
|
1277
1268
|
throw new Error(`Template not found: ${e}`);
|
|
1278
1269
|
return t;
|
|
1279
1270
|
}
|
|
1280
1271
|
};
|
|
1281
|
-
function
|
|
1272
|
+
function at(e) {
|
|
1282
1273
|
return e === "de" ? "time-voucher-classic-de" : "time-voucher-classic-en";
|
|
1283
1274
|
}
|
|
1284
|
-
let
|
|
1285
|
-
function
|
|
1286
|
-
|
|
1275
|
+
let F = Ke;
|
|
1276
|
+
function rt(e) {
|
|
1277
|
+
F = e;
|
|
1287
1278
|
}
|
|
1288
|
-
function
|
|
1289
|
-
return
|
|
1279
|
+
function ot() {
|
|
1280
|
+
return F;
|
|
1290
1281
|
}
|
|
1291
|
-
async function
|
|
1292
|
-
return
|
|
1282
|
+
async function it(e) {
|
|
1283
|
+
return F.listTemplates(e);
|
|
1293
1284
|
}
|
|
1294
|
-
async function
|
|
1295
|
-
return
|
|
1285
|
+
async function st(e) {
|
|
1286
|
+
return F.getTemplate(e);
|
|
1296
1287
|
}
|
|
1297
1288
|
export {
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1289
|
+
De as ApiKeyModal,
|
|
1290
|
+
Qe as BillPreview,
|
|
1291
|
+
tt as ExportButton,
|
|
1292
|
+
nt as Header,
|
|
1293
|
+
R as LAYOUT_HDPI,
|
|
1294
|
+
B as LAYOUT_LDPI,
|
|
1295
|
+
Ue as LanguageToggle,
|
|
1296
|
+
Ve as PersonalInfoForm,
|
|
1297
|
+
Xe as PortraitUpload,
|
|
1298
|
+
_e as TEMPLATES,
|
|
1299
|
+
Je as VoucherConfig,
|
|
1300
|
+
He as downloadBlob,
|
|
1301
|
+
$e as drawContactInfo,
|
|
1302
|
+
Re as drawMultilineText,
|
|
1303
|
+
Be as drawOvalPortrait,
|
|
1304
|
+
ae as drawTemplate,
|
|
1305
|
+
re as drawText,
|
|
1306
|
+
Ze as enhancePortrait,
|
|
1307
|
+
Te as enhancePortraitFallback,
|
|
1308
|
+
Me as exportBillAsPDF,
|
|
1309
|
+
J as formatDescription,
|
|
1310
|
+
ze as generateBillPDF,
|
|
1311
|
+
q as getApiKey,
|
|
1312
|
+
at as getDefaultTemplateId,
|
|
1313
|
+
te as getLayout,
|
|
1314
|
+
ne as getTemplate,
|
|
1315
|
+
st as getTemplateById,
|
|
1316
|
+
ot as getTemplateProvider,
|
|
1317
|
+
Ce as hasApiKey,
|
|
1318
|
+
it as listTemplates,
|
|
1319
|
+
Y as loadImage,
|
|
1320
|
+
Ae as removeBackground,
|
|
1321
|
+
ie as renderBackSide,
|
|
1322
|
+
oe as renderFrontSide,
|
|
1323
|
+
Se as setApiKey,
|
|
1324
|
+
rt as setTemplateProvider,
|
|
1325
|
+
Ke as staticTemplateProvider,
|
|
1326
|
+
z as t,
|
|
1327
|
+
et as useBillCanvasRefs,
|
|
1337
1328
|
w as useBillStore
|
|
1338
1329
|
};
|