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