@antontranelis/money-printer 1.0.7 → 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 +532 -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 E, useCallback 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
|
-
},
|
|
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 =
|
|
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,166 +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
|
-
let x = (((0.299 * c + 0.587 * u + 0.114 * g) / 255 - 0.5) * 1.15 + 0.5) * 255;
|
|
354
|
-
x = Math.max(0, Math.min(255, x));
|
|
355
|
-
const k = Math.min(255, x * 0.95 + 30), v = Math.min(255, x * 0.85 + 20), S = Math.min(255, x * 0.65 + 10);
|
|
356
|
-
o[i] = k, o[i + 1] = v, o[i + 2] = S;
|
|
357
|
-
}
|
|
358
|
-
s.putImageData(d, 0, 0), t(r.toDataURL("image/png"));
|
|
359
|
-
}, 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);
|
|
360
362
|
});
|
|
361
363
|
}
|
|
362
|
-
function
|
|
363
|
-
const [e, t] = E(!1), [
|
|
364
|
-
|
|
365
|
-
}, []),
|
|
366
|
-
async (f, b =
|
|
367
|
-
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);
|
|
368
370
|
try {
|
|
369
|
-
return await
|
|
370
|
-
} catch (
|
|
371
|
-
const
|
|
372
|
-
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;
|
|
373
375
|
} finally {
|
|
374
376
|
t(!1);
|
|
375
377
|
}
|
|
376
378
|
},
|
|
377
379
|
[]
|
|
378
|
-
), g =
|
|
380
|
+
), g = T(
|
|
379
381
|
async (f) => {
|
|
380
|
-
|
|
382
|
+
a(!0), o(null);
|
|
381
383
|
try {
|
|
382
|
-
return await
|
|
384
|
+
return await _e(f);
|
|
383
385
|
} catch (b) {
|
|
384
|
-
const
|
|
385
|
-
throw
|
|
386
|
+
const m = b instanceof Error ? b.message : "Background removal failed";
|
|
387
|
+
throw o(m), b;
|
|
386
388
|
} finally {
|
|
387
|
-
|
|
389
|
+
a(!1);
|
|
388
390
|
}
|
|
389
391
|
},
|
|
390
392
|
[]
|
|
391
393
|
);
|
|
392
394
|
return {
|
|
393
|
-
enhance:
|
|
395
|
+
enhance: h,
|
|
394
396
|
removeBg: g,
|
|
395
397
|
isEnhancing: e,
|
|
396
|
-
isRemovingBg:
|
|
398
|
+
isRemovingBg: n,
|
|
397
399
|
error: r,
|
|
398
|
-
hasKey:
|
|
399
|
-
setApiKey:
|
|
400
|
+
hasKey: c,
|
|
401
|
+
setApiKey: d,
|
|
400
402
|
clearError: i
|
|
401
403
|
};
|
|
402
404
|
}
|
|
403
|
-
function
|
|
404
|
-
const
|
|
405
|
+
function Re({ isOpen: e, onClose: t, onSubmit: n }) {
|
|
406
|
+
const a = w((d) => d.voucherConfig.language), [r, o] = E("");
|
|
405
407
|
if (!e) return null;
|
|
406
|
-
const
|
|
407
|
-
|
|
408
|
+
const c = (d) => {
|
|
409
|
+
d.preventDefault(), r.trim() && (n(r.trim()), o(""), t());
|
|
408
410
|
}, i = {
|
|
409
411
|
de: {
|
|
410
412
|
title: "Stability AI API Key",
|
|
@@ -422,13 +424,13 @@ function De({ isOpen: e, onClose: t, onSubmit: a }) {
|
|
|
422
424
|
cancel: "Cancel",
|
|
423
425
|
hint: "The key is stored locally in your browser."
|
|
424
426
|
}
|
|
425
|
-
}[
|
|
426
|
-
return /* @__PURE__ */
|
|
427
|
-
/* @__PURE__ */
|
|
427
|
+
}[a];
|
|
428
|
+
return /* @__PURE__ */ u("dialog", { className: "modal modal-open", children: [
|
|
429
|
+
/* @__PURE__ */ u("div", { className: "modal-box", children: [
|
|
428
430
|
/* @__PURE__ */ l("h3", { className: "font-bold text-lg", children: i.title }),
|
|
429
431
|
/* @__PURE__ */ l("p", { className: "py-4 text-sm opacity-80", children: i.description }),
|
|
430
|
-
/* @__PURE__ */
|
|
431
|
-
/* @__PURE__ */
|
|
432
|
+
/* @__PURE__ */ u("form", { onSubmit: c, children: [
|
|
433
|
+
/* @__PURE__ */ u("div", { className: "form-control", children: [
|
|
432
434
|
/* @__PURE__ */ l(
|
|
433
435
|
"input",
|
|
434
436
|
{
|
|
@@ -436,13 +438,13 @@ function De({ isOpen: e, onClose: t, onSubmit: a }) {
|
|
|
436
438
|
placeholder: i.placeholder,
|
|
437
439
|
className: "input input-bordered w-full",
|
|
438
440
|
value: r,
|
|
439
|
-
onChange: (
|
|
441
|
+
onChange: (d) => o(d.target.value),
|
|
440
442
|
autoFocus: !0
|
|
441
443
|
}
|
|
442
444
|
),
|
|
443
445
|
/* @__PURE__ */ l("label", { className: "label", children: /* @__PURE__ */ l("span", { className: "label-text-alt", children: i.hint }) })
|
|
444
446
|
] }),
|
|
445
|
-
/* @__PURE__ */
|
|
447
|
+
/* @__PURE__ */ u("div", { className: "modal-action", children: [
|
|
446
448
|
/* @__PURE__ */ l("button", { type: "button", className: "btn btn-ghost", onClick: t, children: i.cancel }),
|
|
447
449
|
/* @__PURE__ */ l("button", { type: "submit", className: "btn btn-primary", disabled: !r.trim(), children: i.submit })
|
|
448
450
|
] })
|
|
@@ -451,76 +453,102 @@ function De({ isOpen: e, onClose: t, onSubmit: a }) {
|
|
|
451
453
|
/* @__PURE__ */ l("form", { method: "dialog", className: "modal-backdrop", children: /* @__PURE__ */ l("button", { onClick: t, children: "close" }) })
|
|
452
454
|
] });
|
|
453
455
|
}
|
|
454
|
-
function
|
|
455
|
-
const e =
|
|
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(
|
|
456
462
|
async (p) => {
|
|
457
463
|
if (!p.type.startsWith("image/"))
|
|
458
464
|
return;
|
|
459
|
-
const
|
|
460
|
-
|
|
461
|
-
var
|
|
462
|
-
const
|
|
463
|
-
|
|
464
|
-
},
|
|
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);
|
|
465
471
|
},
|
|
466
|
-
[
|
|
467
|
-
),
|
|
472
|
+
[n]
|
|
473
|
+
), ce = T(
|
|
468
474
|
(p) => {
|
|
469
|
-
p.preventDefault(),
|
|
470
|
-
const
|
|
471
|
-
|
|
475
|
+
p.preventDefault(), m(!1);
|
|
476
|
+
const v = p.dataTransfer.files[0];
|
|
477
|
+
v && W(v);
|
|
472
478
|
},
|
|
473
|
-
[
|
|
474
|
-
),
|
|
475
|
-
p.preventDefault(),
|
|
476
|
-
}, []),
|
|
477
|
-
p.preventDefault(),
|
|
478
|
-
}, []),
|
|
479
|
+
[W]
|
|
480
|
+
), de = T((p) => {
|
|
481
|
+
p.preventDefault(), m(!0);
|
|
482
|
+
}, []), he = T((p) => {
|
|
483
|
+
p.preventDefault(), m(!1);
|
|
484
|
+
}, []), me = () => {
|
|
479
485
|
var p;
|
|
480
486
|
(p = f.current) == null || p.click();
|
|
481
|
-
},
|
|
482
|
-
var
|
|
483
|
-
const
|
|
484
|
-
|
|
485
|
-
},
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
if (!w && !c) {
|
|
503
|
-
k(!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);
|
|
504
508
|
return;
|
|
505
509
|
}
|
|
506
|
-
const p = !
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
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: [
|
|
520
548
|
/* @__PURE__ */ l("div", { className: "w-32 h-32 rounded-full overflow-hidden border-4 border-currency-gold shadow-lg", children: /* @__PURE__ */ l(
|
|
521
549
|
"img",
|
|
522
550
|
{
|
|
523
|
-
src:
|
|
551
|
+
src: t.original || "",
|
|
524
552
|
alt: "Portrait",
|
|
525
553
|
className: "w-full h-full object-cover",
|
|
526
554
|
style: { transform: `scale(${t.zoom})` }
|
|
@@ -530,7 +558,7 @@ function Xe() {
|
|
|
530
558
|
"button",
|
|
531
559
|
{
|
|
532
560
|
className: "btn btn-circle btn-xs btn-error absolute -top-1 -right-1",
|
|
533
|
-
onClick:
|
|
561
|
+
onClick: be,
|
|
534
562
|
children: /* @__PURE__ */ l(
|
|
535
563
|
"svg",
|
|
536
564
|
{
|
|
@@ -552,11 +580,11 @@ function Xe() {
|
|
|
552
580
|
)
|
|
553
581
|
}
|
|
554
582
|
)
|
|
555
|
-
] })
|
|
556
|
-
/* @__PURE__ */
|
|
557
|
-
/* @__PURE__ */
|
|
583
|
+
] }),
|
|
584
|
+
/* @__PURE__ */ u("div", { className: "form-control w-full max-w-xs", children: [
|
|
585
|
+
/* @__PURE__ */ u("label", { className: "label", children: [
|
|
558
586
|
/* @__PURE__ */ l("span", { className: "label-text", children: g.form.portrait.zoom }),
|
|
559
|
-
/* @__PURE__ */
|
|
587
|
+
/* @__PURE__ */ u("span", { className: "label-text-alt", children: [
|
|
560
588
|
Math.round(t.zoom * 100),
|
|
561
589
|
"%"
|
|
562
590
|
] })
|
|
@@ -569,60 +597,67 @@ function Xe() {
|
|
|
569
597
|
max: "2",
|
|
570
598
|
step: "0.05",
|
|
571
599
|
value: t.zoom,
|
|
572
|
-
onChange: (p) =>
|
|
600
|
+
onChange: (p) => a(parseFloat(p.target.value)),
|
|
573
601
|
className: "range range-primary range-sm"
|
|
574
602
|
}
|
|
575
603
|
)
|
|
576
604
|
] }),
|
|
577
|
-
/* @__PURE__ */
|
|
578
|
-
/* @__PURE__ */
|
|
579
|
-
/* @__PURE__ */
|
|
580
|
-
"
|
|
581
|
-
{
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
disabled: o
|
|
587
|
-
}
|
|
588
|
-
),
|
|
589
|
-
/* @__PURE__ */ m("span", { className: "label-text flex items-center gap-2", children: [
|
|
590
|
-
o ? /* @__PURE__ */ m(M, { children: [
|
|
591
|
-
/* @__PURE__ */ l("span", { className: "loading loading-spinner loading-xs" }),
|
|
592
|
-
e === "de" ? "Hintergrund wird entfernt..." : "Removing background..."
|
|
593
|
-
] }) : e === "de" ? "Hintergrund entfernen" : "Remove background",
|
|
594
|
-
!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
|
+
"%"
|
|
595
614
|
] })
|
|
596
|
-
] })
|
|
597
|
-
/* @__PURE__ */ l(
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
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: [
|
|
609
643
|
/* @__PURE__ */ l("span", { className: "loading loading-spinner loading-xs" }),
|
|
610
|
-
e === "de" ? "
|
|
611
|
-
] }) : e === "de" ? "
|
|
612
|
-
|
|
613
|
-
i && /* @__PURE__ */ m("div", { className: "alert alert-warning text-sm py-2", children: [
|
|
614
|
-
/* @__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" }) }),
|
|
615
|
-
/* @__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" })
|
|
616
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 })
|
|
617
652
|
] })
|
|
618
|
-
] }) : /* @__PURE__ */
|
|
653
|
+
] }) : /* @__PURE__ */ u(
|
|
619
654
|
"div",
|
|
620
655
|
{
|
|
621
|
-
className: `border-2 border-dashed rounded-lg p-8 text-center cursor-pointer transition-colors ${
|
|
622
|
-
onDrop:
|
|
623
|
-
onDragOver:
|
|
624
|
-
onDragLeave:
|
|
625
|
-
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,
|
|
626
661
|
children: [
|
|
627
662
|
/* @__PURE__ */ l(
|
|
628
663
|
"input",
|
|
@@ -631,13 +666,13 @@ function Xe() {
|
|
|
631
666
|
type: "file",
|
|
632
667
|
accept: "image/*",
|
|
633
668
|
className: "hidden",
|
|
634
|
-
onChange:
|
|
669
|
+
onChange: pe
|
|
635
670
|
}
|
|
636
671
|
),
|
|
637
|
-
|
|
672
|
+
s ? /* @__PURE__ */ u("div", { className: "flex flex-col items-center gap-2", children: [
|
|
638
673
|
/* @__PURE__ */ l("span", { className: "loading loading-spinner loading-lg text-primary" }),
|
|
639
674
|
/* @__PURE__ */ l("p", { className: "font-medium", children: e === "de" ? "Hintergrund wird entfernt..." : "Removing background..." })
|
|
640
|
-
] }) : /* @__PURE__ */
|
|
675
|
+
] }) : /* @__PURE__ */ u("div", { className: "flex flex-col items-center gap-2", children: [
|
|
641
676
|
/* @__PURE__ */ l(
|
|
642
677
|
"svg",
|
|
643
678
|
{
|
|
@@ -664,60 +699,60 @@ function Xe() {
|
|
|
664
699
|
}
|
|
665
700
|
),
|
|
666
701
|
/* @__PURE__ */ l(
|
|
667
|
-
|
|
702
|
+
Re,
|
|
668
703
|
{
|
|
669
|
-
isOpen:
|
|
670
|
-
onClose: () =>
|
|
671
|
-
onSubmit:
|
|
704
|
+
isOpen: S,
|
|
705
|
+
onClose: () => I(!1),
|
|
706
|
+
onSubmit: fe
|
|
672
707
|
}
|
|
673
708
|
)
|
|
674
709
|
] });
|
|
675
710
|
}
|
|
676
|
-
function
|
|
711
|
+
function et() {
|
|
677
712
|
return null;
|
|
678
713
|
}
|
|
679
|
-
const
|
|
714
|
+
const N = typeof import.meta < "u" && "/" || "/", Be = {
|
|
680
715
|
en: {
|
|
681
716
|
1: {
|
|
682
|
-
front: `${
|
|
683
|
-
back: `${
|
|
717
|
+
front: `${N}templates/front_ldpi_en.png`,
|
|
718
|
+
back: `${N}templates/back_ldpi_en.png`,
|
|
684
719
|
width: 1536,
|
|
685
720
|
height: 1024
|
|
686
721
|
},
|
|
687
722
|
5: {
|
|
688
|
-
front: `${
|
|
689
|
-
back: `${
|
|
723
|
+
front: `${N}templates/front_ldpi_en.png`,
|
|
724
|
+
back: `${N}templates/back_ldpi_en.png`,
|
|
690
725
|
width: 1536,
|
|
691
726
|
height: 1024
|
|
692
727
|
},
|
|
693
728
|
10: {
|
|
694
|
-
front: `${
|
|
695
|
-
back: `${
|
|
729
|
+
front: `${N}templates/front_ldpi_en.png`,
|
|
730
|
+
back: `${N}templates/back_ldpi_en.png`,
|
|
696
731
|
width: 1536,
|
|
697
732
|
height: 1024
|
|
698
733
|
}
|
|
699
734
|
},
|
|
700
735
|
de: {
|
|
701
736
|
1: {
|
|
702
|
-
front: `${
|
|
703
|
-
back: `${
|
|
737
|
+
front: `${N}templates/front_hdpi_de.webp`,
|
|
738
|
+
back: `${N}templates/back_hdpi_de.webp`,
|
|
704
739
|
width: 6144,
|
|
705
740
|
height: 3200
|
|
706
741
|
},
|
|
707
742
|
5: {
|
|
708
|
-
front: `${
|
|
709
|
-
back: `${
|
|
743
|
+
front: `${N}templates/front_hdpi_de.webp`,
|
|
744
|
+
back: `${N}templates/back_hdpi_de.webp`,
|
|
710
745
|
width: 6144,
|
|
711
746
|
height: 3200
|
|
712
747
|
},
|
|
713
748
|
10: {
|
|
714
|
-
front: `${
|
|
715
|
-
back: `${
|
|
749
|
+
front: `${N}templates/front_hdpi_de.webp`,
|
|
750
|
+
back: `${N}templates/back_hdpi_de.webp`,
|
|
716
751
|
width: 6144,
|
|
717
752
|
height: 3200
|
|
718
753
|
}
|
|
719
754
|
}
|
|
720
|
-
},
|
|
755
|
+
}, R = {
|
|
721
756
|
front: {
|
|
722
757
|
portrait: {
|
|
723
758
|
x: 768,
|
|
@@ -763,7 +798,7 @@ const I = typeof import.meta < "u" && "/" || "/", _e = {
|
|
|
763
798
|
align: "center"
|
|
764
799
|
}
|
|
765
800
|
}
|
|
766
|
-
},
|
|
801
|
+
}, B = {
|
|
767
802
|
front: {
|
|
768
803
|
portrait: {
|
|
769
804
|
x: 3074,
|
|
@@ -810,139 +845,139 @@ const I = typeof import.meta < "u" && "/" || "/", _e = {
|
|
|
810
845
|
}
|
|
811
846
|
}
|
|
812
847
|
};
|
|
813
|
-
function
|
|
814
|
-
return e === "de" ?
|
|
848
|
+
function ae(e) {
|
|
849
|
+
return e === "de" ? B : R;
|
|
815
850
|
}
|
|
816
|
-
function
|
|
817
|
-
return
|
|
851
|
+
function re(e, t) {
|
|
852
|
+
return Be[e][t];
|
|
818
853
|
}
|
|
819
|
-
const
|
|
854
|
+
const K = /* @__PURE__ */ new Map();
|
|
820
855
|
async function Y(e) {
|
|
821
|
-
return
|
|
822
|
-
const
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
},
|
|
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;
|
|
826
861
|
});
|
|
827
862
|
}
|
|
828
|
-
function
|
|
829
|
-
e.drawImage(t, 0, 0,
|
|
863
|
+
function oe(e, t, n, a) {
|
|
864
|
+
e.drawImage(t, 0, 0, n, a);
|
|
830
865
|
}
|
|
831
|
-
function
|
|
832
|
-
e.save(), e.beginPath(), e.ellipse(
|
|
833
|
-
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;
|
|
834
869
|
let g, f;
|
|
835
|
-
|
|
836
|
-
const b =
|
|
837
|
-
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();
|
|
838
873
|
}
|
|
839
|
-
function
|
|
840
|
-
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();
|
|
841
876
|
}
|
|
842
|
-
function
|
|
843
|
-
e.save(), e.font = `${
|
|
844
|
-
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 = [];
|
|
845
880
|
let i = "";
|
|
846
|
-
for (const g of
|
|
881
|
+
for (const g of c) {
|
|
847
882
|
const f = i ? `${i} ${g}` : g;
|
|
848
|
-
e.measureText(f).width > r && i ? (
|
|
883
|
+
e.measureText(f).width > r && i ? (s.push(i), i = g) : i = f;
|
|
849
884
|
}
|
|
850
|
-
i &&
|
|
851
|
-
const
|
|
852
|
-
let
|
|
853
|
-
for (const g of
|
|
854
|
-
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;
|
|
855
890
|
e.restore();
|
|
856
891
|
}
|
|
857
|
-
function
|
|
858
|
-
e.save(), e.font = `${r.fontSize}px "Times New Roman", serif`, e.textAlign = r.align || "center", e.textBaseline = "middle", e.fillStyle =
|
|
859
|
-
const
|
|
860
|
-
let
|
|
861
|
-
for (const
|
|
862
|
-
|
|
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);
|
|
863
898
|
e.restore();
|
|
864
899
|
}
|
|
865
|
-
async function
|
|
900
|
+
async function se(e, t, n, a, r, o, c, s = 1) {
|
|
866
901
|
const i = e.getContext("2d");
|
|
867
902
|
if (!i) return;
|
|
868
|
-
e.width =
|
|
869
|
-
const
|
|
870
|
-
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)
|
|
871
906
|
try {
|
|
872
|
-
const
|
|
873
|
-
|
|
907
|
+
const h = await Y(n);
|
|
908
|
+
$e(
|
|
874
909
|
i,
|
|
875
|
-
|
|
910
|
+
h,
|
|
876
911
|
r.portrait.x,
|
|
877
912
|
r.portrait.y,
|
|
878
913
|
r.portrait.radiusX,
|
|
879
914
|
r.portrait.radiusY,
|
|
880
|
-
|
|
915
|
+
s
|
|
881
916
|
);
|
|
882
|
-
} catch (
|
|
883
|
-
console.error("Failed to load portrait:",
|
|
917
|
+
} catch (h) {
|
|
918
|
+
console.error("Failed to load portrait:", h);
|
|
884
919
|
}
|
|
885
|
-
|
|
920
|
+
a && ie(i, a, r.namePlate);
|
|
886
921
|
}
|
|
887
|
-
async function
|
|
888
|
-
const
|
|
889
|
-
if (!
|
|
890
|
-
e.width =
|
|
891
|
-
const
|
|
892
|
-
|
|
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);
|
|
893
928
|
}
|
|
894
|
-
function
|
|
895
|
-
const e =
|
|
896
|
-
|
|
897
|
-
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(
|
|
898
933
|
i.current,
|
|
899
934
|
b.front,
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
935
|
+
S,
|
|
936
|
+
a.name,
|
|
937
|
+
m.front,
|
|
903
938
|
b.width,
|
|
904
939
|
b.height,
|
|
905
940
|
r.zoom
|
|
906
941
|
);
|
|
907
|
-
}, [b,
|
|
908
|
-
|
|
909
|
-
|
|
942
|
+
}, [b, S, a.name, m, r.zoom]), O(() => {
|
|
943
|
+
d.current && le(
|
|
944
|
+
d.current,
|
|
910
945
|
b.back,
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
946
|
+
a.name,
|
|
947
|
+
a.email,
|
|
948
|
+
a.phone,
|
|
949
|
+
I,
|
|
950
|
+
m.back,
|
|
916
951
|
b.width,
|
|
917
952
|
b.height
|
|
918
953
|
);
|
|
919
|
-
}, [b,
|
|
920
|
-
const
|
|
954
|
+
}, [b, a, I, m]);
|
|
955
|
+
const x = () => {
|
|
921
956
|
f(!0), setTimeout(() => {
|
|
922
|
-
|
|
957
|
+
c(), f(!1);
|
|
923
958
|
}, 150);
|
|
924
|
-
},
|
|
925
|
-
return /* @__PURE__ */
|
|
926
|
-
/* @__PURE__ */
|
|
927
|
-
/* @__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: [
|
|
928
963
|
/* @__PURE__ */ l(
|
|
929
964
|
"button",
|
|
930
965
|
{
|
|
931
|
-
className: `tab ${
|
|
932
|
-
onClick: () =>
|
|
933
|
-
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
|
|
934
969
|
}
|
|
935
970
|
),
|
|
936
971
|
/* @__PURE__ */ l(
|
|
937
972
|
"button",
|
|
938
973
|
{
|
|
939
|
-
className: `tab ${
|
|
940
|
-
onClick: () =>
|
|
941
|
-
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
|
|
942
977
|
}
|
|
943
978
|
)
|
|
944
979
|
] }),
|
|
945
|
-
/* @__PURE__ */
|
|
980
|
+
/* @__PURE__ */ u("button", { className: "btn btn-ghost btn-sm", onClick: x, children: [
|
|
946
981
|
/* @__PURE__ */ l(
|
|
947
982
|
"svg",
|
|
948
983
|
{
|
|
@@ -962,28 +997,28 @@ function Qe() {
|
|
|
962
997
|
)
|
|
963
998
|
}
|
|
964
999
|
),
|
|
965
|
-
|
|
1000
|
+
s.preview.flip
|
|
966
1001
|
] })
|
|
967
1002
|
] }),
|
|
968
|
-
/* @__PURE__ */
|
|
1003
|
+
/* @__PURE__ */ u(
|
|
969
1004
|
"div",
|
|
970
1005
|
{
|
|
971
|
-
ref:
|
|
1006
|
+
ref: h,
|
|
972
1007
|
className: "relative w-full overflow-hidden shadow-lg",
|
|
973
|
-
style: { aspectRatio:
|
|
1008
|
+
style: { aspectRatio: A },
|
|
974
1009
|
children: [
|
|
975
1010
|
/* @__PURE__ */ l(
|
|
976
1011
|
"canvas",
|
|
977
1012
|
{
|
|
978
1013
|
ref: i,
|
|
979
|
-
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"}`
|
|
980
1015
|
}
|
|
981
1016
|
),
|
|
982
1017
|
/* @__PURE__ */ l(
|
|
983
1018
|
"canvas",
|
|
984
1019
|
{
|
|
985
|
-
ref:
|
|
986
|
-
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"}`
|
|
987
1022
|
}
|
|
988
1023
|
)
|
|
989
1024
|
]
|
|
@@ -991,85 +1026,85 @@ function Qe() {
|
|
|
991
1026
|
)
|
|
992
1027
|
] });
|
|
993
1028
|
}
|
|
994
|
-
function
|
|
995
|
-
const e =
|
|
1029
|
+
function nt() {
|
|
1030
|
+
const e = D(null), t = D(null);
|
|
996
1031
|
return { frontCanvasRef: e, backCanvasRef: t };
|
|
997
1032
|
}
|
|
998
|
-
async function
|
|
1033
|
+
async function He(e) {
|
|
999
1034
|
const {
|
|
1000
1035
|
frontTemplateSrc: t,
|
|
1001
|
-
backTemplateSrc:
|
|
1002
|
-
templateWidth:
|
|
1036
|
+
backTemplateSrc: n,
|
|
1037
|
+
templateWidth: a,
|
|
1003
1038
|
templateHeight: r,
|
|
1004
|
-
layout:
|
|
1005
|
-
portrait:
|
|
1006
|
-
portraitZoom:
|
|
1039
|
+
layout: o,
|
|
1040
|
+
portrait: c,
|
|
1041
|
+
portraitZoom: s = 1,
|
|
1007
1042
|
name: i,
|
|
1008
|
-
email:
|
|
1009
|
-
phone:
|
|
1043
|
+
email: d,
|
|
1044
|
+
phone: h,
|
|
1010
1045
|
description: g
|
|
1011
1046
|
} = e, f = document.createElement("canvas"), b = document.createElement("canvas");
|
|
1012
1047
|
await Promise.all([
|
|
1013
|
-
|
|
1014
|
-
|
|
1048
|
+
se(f, t, c, i, o.front, a, r, s),
|
|
1049
|
+
le(b, n, i, d, h, g, o.back, a, r)
|
|
1015
1050
|
]);
|
|
1016
|
-
const
|
|
1051
|
+
const m = new ye({
|
|
1017
1052
|
orientation: "landscape",
|
|
1018
1053
|
unit: "mm",
|
|
1019
1054
|
format: "a4"
|
|
1020
|
-
}),
|
|
1021
|
-
let
|
|
1022
|
-
|
|
1023
|
-
const
|
|
1024
|
-
|
|
1025
|
-
const
|
|
1026
|
-
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");
|
|
1027
1062
|
}
|
|
1028
|
-
function
|
|
1029
|
-
const
|
|
1030
|
-
|
|
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);
|
|
1031
1066
|
}
|
|
1032
|
-
async function
|
|
1033
|
-
const t = await
|
|
1034
|
-
|
|
1067
|
+
async function Fe(e) {
|
|
1068
|
+
const t = await He(e);
|
|
1069
|
+
Ue(t, e.filename);
|
|
1035
1070
|
}
|
|
1036
|
-
function
|
|
1037
|
-
const e =
|
|
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;
|
|
1038
1073
|
return /* @__PURE__ */ l(
|
|
1039
1074
|
"button",
|
|
1040
1075
|
{
|
|
1041
|
-
className: `btn btn-primary flex-1 ${
|
|
1076
|
+
className: `btn btn-primary flex-1 ${o ? "loading" : ""}`,
|
|
1042
1077
|
onClick: async () => {
|
|
1043
|
-
if (!(!f ||
|
|
1044
|
-
|
|
1078
|
+
if (!(!f || o)) {
|
|
1079
|
+
c(!0);
|
|
1045
1080
|
try {
|
|
1046
|
-
const
|
|
1047
|
-
await
|
|
1081
|
+
const m = `zeitgutschein-${t}h-${a.name.replace(/\s+/g, "-").toLowerCase()}.pdf`;
|
|
1082
|
+
await Fe({
|
|
1048
1083
|
frontTemplateSrc: i.front,
|
|
1049
1084
|
backTemplateSrc: i.back,
|
|
1050
1085
|
templateWidth: i.width,
|
|
1051
1086
|
templateHeight: i.height,
|
|
1052
|
-
layout:
|
|
1053
|
-
portrait:
|
|
1087
|
+
layout: d,
|
|
1088
|
+
portrait: h,
|
|
1054
1089
|
portraitZoom: r.zoom,
|
|
1055
|
-
name:
|
|
1056
|
-
email:
|
|
1057
|
-
phone:
|
|
1090
|
+
name: a.name,
|
|
1091
|
+
email: a.email,
|
|
1092
|
+
phone: a.phone,
|
|
1058
1093
|
description: g,
|
|
1059
|
-
filename:
|
|
1094
|
+
filename: m
|
|
1060
1095
|
});
|
|
1061
|
-
} catch (
|
|
1062
|
-
console.error("PDF export failed:",
|
|
1096
|
+
} catch (m) {
|
|
1097
|
+
console.error("PDF export failed:", m);
|
|
1063
1098
|
} finally {
|
|
1064
|
-
|
|
1099
|
+
c(!1);
|
|
1065
1100
|
}
|
|
1066
1101
|
}
|
|
1067
1102
|
},
|
|
1068
|
-
disabled: !f ||
|
|
1069
|
-
children:
|
|
1103
|
+
disabled: !f || o,
|
|
1104
|
+
children: o ? /* @__PURE__ */ u(j, { children: [
|
|
1070
1105
|
/* @__PURE__ */ l("span", { className: "loading loading-spinner loading-sm" }),
|
|
1071
|
-
|
|
1072
|
-
] }) : /* @__PURE__ */
|
|
1106
|
+
s.export.exporting
|
|
1107
|
+
] }) : /* @__PURE__ */ u(j, { children: [
|
|
1073
1108
|
/* @__PURE__ */ l(
|
|
1074
1109
|
"svg",
|
|
1075
1110
|
{
|
|
@@ -1089,21 +1124,21 @@ function tt() {
|
|
|
1089
1124
|
)
|
|
1090
1125
|
}
|
|
1091
1126
|
),
|
|
1092
|
-
|
|
1127
|
+
s.export.button
|
|
1093
1128
|
] })
|
|
1094
1129
|
}
|
|
1095
1130
|
);
|
|
1096
1131
|
}
|
|
1097
|
-
function
|
|
1098
|
-
const e =
|
|
1099
|
-
t(
|
|
1132
|
+
function We() {
|
|
1133
|
+
const e = w((a) => a.voucherConfig.language), t = w((a) => a.setLanguage), n = (a) => {
|
|
1134
|
+
t(a);
|
|
1100
1135
|
};
|
|
1101
|
-
return /* @__PURE__ */
|
|
1136
|
+
return /* @__PURE__ */ u("div", { className: "join", children: [
|
|
1102
1137
|
/* @__PURE__ */ l(
|
|
1103
1138
|
"button",
|
|
1104
1139
|
{
|
|
1105
1140
|
className: `join-item btn btn-sm ${e === "de" ? "btn-active btn-primary" : "btn-ghost"}`,
|
|
1106
|
-
onClick: () =>
|
|
1141
|
+
onClick: () => n("de"),
|
|
1107
1142
|
children: "DE"
|
|
1108
1143
|
}
|
|
1109
1144
|
),
|
|
@@ -1111,21 +1146,21 @@ function Ue() {
|
|
|
1111
1146
|
"button",
|
|
1112
1147
|
{
|
|
1113
1148
|
className: `join-item btn btn-sm ${e === "en" ? "btn-active btn-primary" : "btn-ghost"}`,
|
|
1114
|
-
onClick: () =>
|
|
1149
|
+
onClick: () => n("en"),
|
|
1115
1150
|
children: "EN"
|
|
1116
1151
|
}
|
|
1117
1152
|
)
|
|
1118
1153
|
] });
|
|
1119
1154
|
}
|
|
1120
|
-
function
|
|
1121
|
-
const e =
|
|
1122
|
-
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: [
|
|
1123
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 }) }),
|
|
1124
1159
|
/* @__PURE__ */ l("div", { className: "navbar-center hidden sm:flex", children: /* @__PURE__ */ l("span", { className: "text-sm opacity-80", children: t.header.subtitle }) }),
|
|
1125
|
-
/* @__PURE__ */ l("div", { className: "navbar-end", children: /* @__PURE__ */ l(
|
|
1160
|
+
/* @__PURE__ */ l("div", { className: "navbar-end", children: /* @__PURE__ */ l(We, {}) })
|
|
1126
1161
|
] });
|
|
1127
1162
|
}
|
|
1128
|
-
const U = "/",
|
|
1163
|
+
const U = "/", Ke = {
|
|
1129
1164
|
id: "time-voucher-classic-de",
|
|
1130
1165
|
name: "Zeitgutschein Classic",
|
|
1131
1166
|
type: "time-voucher",
|
|
@@ -1179,17 +1214,17 @@ const U = "/", Fe = {
|
|
|
1179
1214
|
],
|
|
1180
1215
|
layout: {
|
|
1181
1216
|
front: {
|
|
1182
|
-
portrait:
|
|
1183
|
-
name:
|
|
1217
|
+
portrait: B.front.portrait,
|
|
1218
|
+
name: B.front.namePlate
|
|
1184
1219
|
},
|
|
1185
1220
|
back: {
|
|
1186
|
-
name:
|
|
1187
|
-
contactInfo:
|
|
1188
|
-
description:
|
|
1221
|
+
name: B.back.namePlate,
|
|
1222
|
+
contactInfo: B.back.contactInfo,
|
|
1223
|
+
description: B.back.description
|
|
1189
1224
|
}
|
|
1190
1225
|
},
|
|
1191
1226
|
languages: ["de"]
|
|
1192
|
-
},
|
|
1227
|
+
}, je = {
|
|
1193
1228
|
id: "time-voucher-classic-en",
|
|
1194
1229
|
name: "Time Voucher Classic",
|
|
1195
1230
|
type: "time-voucher",
|
|
@@ -1243,86 +1278,86 @@ const U = "/", Fe = {
|
|
|
1243
1278
|
],
|
|
1244
1279
|
layout: {
|
|
1245
1280
|
front: {
|
|
1246
|
-
portrait:
|
|
1247
|
-
name:
|
|
1281
|
+
portrait: R.front.portrait,
|
|
1282
|
+
name: R.front.namePlate
|
|
1248
1283
|
},
|
|
1249
1284
|
back: {
|
|
1250
|
-
name:
|
|
1251
|
-
contactInfo:
|
|
1252
|
-
description:
|
|
1285
|
+
name: R.back.namePlate,
|
|
1286
|
+
contactInfo: R.back.contactInfo,
|
|
1287
|
+
description: R.back.description
|
|
1253
1288
|
}
|
|
1254
1289
|
},
|
|
1255
1290
|
languages: ["en"]
|
|
1256
|
-
},
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
],
|
|
1291
|
+
}, Q = [
|
|
1292
|
+
Ke,
|
|
1293
|
+
je
|
|
1294
|
+
], Oe = {
|
|
1260
1295
|
async listTemplates(e) {
|
|
1261
|
-
let t = [...
|
|
1262
|
-
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;
|
|
1263
1298
|
},
|
|
1264
1299
|
async getTemplate(e) {
|
|
1265
|
-
const t =
|
|
1300
|
+
const t = Q.find((n) => n.id === e);
|
|
1266
1301
|
if (!t)
|
|
1267
1302
|
throw new Error(`Template not found: ${e}`);
|
|
1268
1303
|
return t;
|
|
1269
1304
|
}
|
|
1270
1305
|
};
|
|
1271
|
-
function
|
|
1306
|
+
function ot(e) {
|
|
1272
1307
|
return e === "de" ? "time-voucher-classic-de" : "time-voucher-classic-en";
|
|
1273
1308
|
}
|
|
1274
|
-
let F =
|
|
1275
|
-
function
|
|
1309
|
+
let F = Oe;
|
|
1310
|
+
function it(e) {
|
|
1276
1311
|
F = e;
|
|
1277
1312
|
}
|
|
1278
|
-
function
|
|
1313
|
+
function st() {
|
|
1279
1314
|
return F;
|
|
1280
1315
|
}
|
|
1281
|
-
async function
|
|
1316
|
+
async function lt(e) {
|
|
1282
1317
|
return F.listTemplates(e);
|
|
1283
1318
|
}
|
|
1284
|
-
async function
|
|
1319
|
+
async function ct(e) {
|
|
1285
1320
|
return F.getTemplate(e);
|
|
1286
1321
|
}
|
|
1287
1322
|
export {
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
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,
|
|
1310
1345
|
q as getApiKey,
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
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,
|
|
1318
1353
|
Y as loadImage,
|
|
1319
|
-
|
|
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,
|
|
1362
|
+
w as useBillStore
|
|
1328
1363
|
};
|