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