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