@invoice-sdk/widget 1.117.6 → 1.118.1

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.
@@ -0,0 +1,855 @@
1
+ var ie = Object.defineProperty;
2
+ var D = Object.getOwnPropertySymbols;
3
+ var ae = Object.prototype.hasOwnProperty, se = Object.prototype.propertyIsEnumerable;
4
+ var ee = (i, t, e) => t in i ? ie(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e, $ = (i, t) => {
5
+ for (var e in t || (t = {}))
6
+ ae.call(t, e) && ee(i, e, t[e]);
7
+ if (D)
8
+ for (var e of D(t))
9
+ se.call(t, e) && ee(i, e, t[e]);
10
+ return i;
11
+ };
12
+ var j = (i, t, e) => new Promise((r, d) => {
13
+ var s = (p) => {
14
+ try {
15
+ g(e.next(p));
16
+ } catch (N) {
17
+ d(N);
18
+ }
19
+ }, a = (p) => {
20
+ try {
21
+ g(e.throw(p));
22
+ } catch (N) {
23
+ d(N);
24
+ }
25
+ }, g = (p) => p.done ? r(p.value) : Promise.resolve(p.value).then(s, a);
26
+ g((e = e.apply(i, t)).next());
27
+ });
28
+ import { c as G, f as te, e as oe, b as de, o as ne, s as le } from "./loading-C9dC-rXa.js";
29
+ import { t as n, c as J, j as ce } from "./index-B-xYoQuR.js";
30
+ function z(i) {
31
+ const t = i.trim();
32
+ return t ? t.length < 2 || t.length > 250 ? { valid: !1, error: n("length_2_250") } : /[<>:"\/\\|?*@#$%!^]/.test(t) ? { valid: !1, error: n("invalid_characters") } : { valid: !0 } : { valid: !1, error: n("equired_name") };
33
+ }
34
+ function X(i, t = !1) {
35
+ const e = i.trim();
36
+ return e ? e.length < 2 || e.length > 250 ? { valid: !1, error: n("length_2_250") } : /[<>:"\/\\|?*@#$%!^]/.test(e) ? { valid: !1, error: n("invalid_characters") } : { valid: !0 } : t ? { valid: !1, error: n("required_address") } : { valid: !0 };
37
+ }
38
+ function K(i) {
39
+ const t = i.trim();
40
+ return t ? t.length < 6 || t.length > 254 ? { valid: !1, error: n("email_length") } : /[<>:"\/\\|?*#$%!\s]/.test(t) ? { valid: !1, error: n("email_invalid_format") } : /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(t) ? t.includes("@@") ? { valid: !1, error: n("email_invalid_format") } : { valid: !0 } : { valid: !1, error: n("email_invalid_format") } : { valid: !1, error: n("required_email") };
41
+ }
42
+ function Y(i, t = !1) {
43
+ const e = i.trim();
44
+ if (!e)
45
+ return t ? { valid: !1, error: n("required_phone") } : { valid: !0 };
46
+ const r = e.replace(/\s/g, "");
47
+ if (/[<>:"\/\\|?*@#$%!A-Za-z]/.test(r))
48
+ return { valid: !1, error: n("phone_invalid") };
49
+ const s = /^0\d{9}$/, a = /^\+84\d{9}$/;
50
+ return !s.test(r) && !a.test(r) ? { valid: !1, error: n("phone_invalid_format") } : { valid: !0 };
51
+ }
52
+ function Q(i) {
53
+ const t = i.trim();
54
+ if (!t) return { valid: !1, error: n("required_tax_code") };
55
+ const e = t.replace(/\s/g, "");
56
+ if (/[<>:"\/\\|?*@#$%!A-Za-z\s]/.test(e))
57
+ return { valid: !1, error: n("tax_code_invalid") };
58
+ if ((e.match(/-/g) || []).length > 1)
59
+ return { valid: !1, error: n("tax_code_invalid_format") };
60
+ const s = /^\d{10}$/, a = /^\d{10}-\d{3}$/;
61
+ return !s.test(e) && !a.test(e) ? { valid: !1, error: n("tax_code_invalid_format") } : { valid: !0 };
62
+ }
63
+ function pe({ defaultValues: i = {}, onChange: t } = {}) {
64
+ const e = {
65
+ representativeName: i.representativeName || "",
66
+ buyerAddress: i.buyerAddress || "",
67
+ email: i.email || "",
68
+ phone: i.phone || ""
69
+ }, r = document.createElement("div");
70
+ r.className = "wgt:space-y-2";
71
+ function d() {
72
+ typeof t == "function" && t($({}, e));
73
+ }
74
+ function s({ label: v, required: y, name: H, type: Z = "text", placeholder: b }) {
75
+ const A = document.createElement("div");
76
+ A.className = "";
77
+ const _ = document.createElement("label");
78
+ _.className = "wgt:text-sm wgt:font-medium wgt:text-strong-950", _.htmlFor = H, _.innerHTML = y ? `${v} <span class="wgt:text-semantic-error wgt:text-[#ED1C24]">*</span>` : v;
79
+ const m = document.createElement("input");
80
+ m.id = H, m.name = H, m.type = Z, m.placeholder = b || "", m.className = "wgt:w-full wgt:rounded-lg wgt:border wgt:border-[#E4E7EC] wgt:mt-2 wgt:bg-white wgt:px-3 wgt:py-2.5 wgt:text-sm wgt:text-strong-950 focus:wgt:outline-none focus:wgt:border-primary focus:wgt:ring-1 focus:wgt:ring-primary", m.value = e[H] || "";
81
+ const T = document.createElement("div");
82
+ return T.className = "wgt:text-xs wgt:text-[#ED1C24] wgt:mt-1 wgt:hidden", T.setAttribute("data-error-for", H), m.addEventListener("input", () => {
83
+ e[H] = m.value, m.classList.remove(
84
+ "wgt:border-semantic-error",
85
+ "wgt:bg-semantic-error-50"
86
+ ), T.classList.add("wgt:hidden"), d();
87
+ }), m.addEventListener("blur", () => {
88
+ let u;
89
+ switch (H) {
90
+ case "representativeName":
91
+ u = z(m.value);
92
+ break;
93
+ case "buyerAddress":
94
+ u = X(m.value);
95
+ break;
96
+ case "email":
97
+ u = K(m.value);
98
+ break;
99
+ case "phone":
100
+ u = Y(m.value, !1);
101
+ break;
102
+ default:
103
+ return;
104
+ }
105
+ !u.valid && u.error && (m.classList.add(
106
+ "wgt:border-semantic-error",
107
+ "wgt:bg-semantic-error-50"
108
+ ), T.textContent = u.error, T.classList.remove("wgt:hidden"));
109
+ }), A.appendChild(_), A.appendChild(m), A.appendChild(T), { field: A, input: m, errorEl: T };
110
+ }
111
+ const {
112
+ field: a,
113
+ input: g,
114
+ errorEl: p
115
+ } = s({
116
+ label: n("representativeName"),
117
+ required: !0,
118
+ name: "representativeName",
119
+ placeholder: n("representativeName_input")
120
+ }), { field: N, errorEl: k } = s({
121
+ label: n("buyerAddress"),
122
+ required: !1,
123
+ name: "buyerAddress",
124
+ placeholder: n("buyerAddress_input")
125
+ }), {
126
+ field: F,
127
+ input: M,
128
+ errorEl: l
129
+ } = s({
130
+ label: n("email"),
131
+ required: !0,
132
+ name: "email",
133
+ type: "email",
134
+ placeholder: n("email_input")
135
+ }), {
136
+ field: x,
137
+ input: o,
138
+ errorEl: w
139
+ } = s({
140
+ label: n("phone"),
141
+ required: !1,
142
+ name: "phone",
143
+ type: "tel",
144
+ placeholder: n("phone_input")
145
+ });
146
+ r.appendChild(a), r.appendChild(N), r.appendChild(F), r.appendChild(x);
147
+ function f() {
148
+ let v = !0;
149
+ function y(b, A, _) {
150
+ b.classList.add(
151
+ "wgt:border-semantic-error",
152
+ "wgt:bg-semantic-error-50"
153
+ ), _ && A && (A.textContent = _, A.classList.remove("wgt:hidden")), v = !1;
154
+ }
155
+ const H = z(e.representativeName);
156
+ if (H.valid || y(g, p, H.error), e.buyerAddress.trim()) {
157
+ const b = X(e.buyerAddress);
158
+ b.valid || y(
159
+ document.querySelector('input[name="buyerAddress"]'),
160
+ k,
161
+ b.error
162
+ );
163
+ }
164
+ const Z = K(e.email);
165
+ if (Z.valid || y(M, l, Z.error), e.phone.trim()) {
166
+ const b = Y(e.phone, !1);
167
+ b.valid || y(o, w, b.error);
168
+ }
169
+ return v;
170
+ }
171
+ function c() {
172
+ return $({}, e);
173
+ }
174
+ return { container: r, getValues: c, validate: f };
175
+ }
176
+ function ge({
177
+ defaultValues: i = {},
178
+ onChange: t,
179
+ onFetchByTaxCode: e
180
+ } = {}) {
181
+ const r = {
182
+ noTaxCode: !!i.noTaxCode,
183
+ taxCode: i.taxCode || "",
184
+ representativeName: i.representativeName || "",
185
+ buyerAddress: i.buyerAddress || "",
186
+ performerName: i.performerName || "",
187
+ email: i.email || "",
188
+ phone: i.phone || ""
189
+ }, d = document.createElement("div");
190
+ d.className = "wgt:space-y-2";
191
+ function s() {
192
+ typeof t == "function" && t($({}, r));
193
+ }
194
+ function a({ label: C, required: L, name: h, type: W = "text", placeholder: I }) {
195
+ const O = document.createElement("div");
196
+ O.className = "";
197
+ const P = document.createElement("label");
198
+ P.className = "wgt:text-sm wgt:font-medium wgt:text-strong-950", P.htmlFor = h, P.innerHTML = L ? `${C} <span class="wgt:text-[#ED1C24]">*</span>` : C;
199
+ const E = document.createElement("input");
200
+ E.id = h, E.name = h, E.type = W, E.placeholder = I || "", E.className = "wgt:w-full wgt:rounded-lg wgt:border wgt:border-[#E4E7EC] wgt:mt-2 wgt:bg-white wgt:px-3 wgt:py-2.5 wgt:text-sm wgt:text-strong-950 focus:wgt:outline-none focus:wgt:border-primary focus:wgt:ring-1 focus:wgt:ring-primary", E.value = r[h] || "";
201
+ const R = document.createElement("div");
202
+ return R.className = "wgt:text-xs wgt:text-[#ED1C24] wgt:mt-1 wgt:hidden", R.setAttribute("data-error-for", h), E.addEventListener("input", () => {
203
+ r[h] = E.value, E.classList.remove(
204
+ "wgt:border-semantic-error",
205
+ "wgt:bg-semantic-error-50"
206
+ ), R.classList.add("wgt:hidden"), s();
207
+ }), E.addEventListener("blur", () => {
208
+ if (!E.value.trim() && !L) return;
209
+ let U;
210
+ switch (h) {
211
+ case "business_name":
212
+ case "representativeName":
213
+ U = z(E.value);
214
+ break;
215
+ case "buyerAddress":
216
+ U = X(E.value);
217
+ break;
218
+ case "email":
219
+ U = K(E.value);
220
+ break;
221
+ case "phone":
222
+ U = Y(E.value, !0);
223
+ break;
224
+ default:
225
+ return;
226
+ }
227
+ !U.valid && U.error && (E.classList.add(
228
+ "wgt:border-semantic-error",
229
+ "wgt:bg-semantic-error-50"
230
+ ), R.textContent = U.error, R.classList.remove("wgt:hidden"));
231
+ }), O.appendChild(P), O.appendChild(E), O.appendChild(R), { field: O, input: E, errorEl: R };
232
+ }
233
+ const g = document.createElement("label");
234
+ g.className = "wgt:flex wgt:items-center wgt:gap-2 wgt:font-medium wgt:text-strong-950 wgt:text-sm";
235
+ const p = document.createElement("input");
236
+ p.type = "checkbox", p.className = "wgt:h-4 wgt:w-4 wgt:rounded wgt:border-[#E4E7EC] focus:wgt:outline-none focus:wgt:ring-primary", p.checked = r.noTaxCode;
237
+ const N = document.createElement("span");
238
+ N.textContent = n("business_noTaxCode"), N.className = "wgt:italic wgt:font-normal wgt:text-[14px] wgt:leading-[20px] wgt:tracking-[0px] wgt:align-middle wgt:text-[#525866]", N.style.fontFamily = "Inter, sans-serif", p.addEventListener("change", () => {
239
+ r.noTaxCode = p.checked, l.disabled = r.noTaxCode, o.disabled = r.noTaxCode, l.classList.remove(
240
+ "wgt:border-semantic-error",
241
+ "wgt:bg-semantic-error-50"
242
+ ), x.classList.add("wgt:hidden"), s();
243
+ }), g.appendChild(p), g.appendChild(N);
244
+ const k = document.createElement("div");
245
+ k.className = "wgt:space-y-2";
246
+ const F = document.createElement("label");
247
+ F.className = "wgt:text-sm wgt:font-medium wgt:text-strong-950 ", F.innerHTML = n("confirmation_popup_taxCode") + '<span class="wgt:text-[#ED1C24]">*</span>';
248
+ const M = document.createElement("div");
249
+ M.className = "wgt:flex wgt:gap-2 wgt:mt-2";
250
+ const l = document.createElement("input");
251
+ l.type = "text", l.name = "taxCode", l.placeholder = n("taxCode_input"), l.value = r.taxCode, l.className = "wgt:flex-1 wgt:rounded-lg wgt:border wgt:border-[#E4E7EC] wgt:bg-white wgt:px-3 wgt:py-2.5 wgt:text-sm wgt:text-strong-950 focus:wgt:outline-none focus:wgt:border-primary focus:wgt:ring-1 focus:wgt:ring-primary";
252
+ const x = document.createElement("div");
253
+ x.className = "wgt:text-xs wgt:text-[#ED1C24] wgt:mt-1 wgt:hidden", l.addEventListener("input", () => {
254
+ r.taxCode = l.value, l.classList.remove(
255
+ "wgt:border-semantic-error",
256
+ "wgt:bg-semantic-error-50"
257
+ ), x.classList.add("wgt:hidden"), s();
258
+ }), l.addEventListener("blur", () => {
259
+ if (r.noTaxCode || !l.value.trim()) return;
260
+ const C = Q(l.value);
261
+ C.valid || (l.classList.add(
262
+ "wgt:border-semantic-error",
263
+ "wgt:bg-semantic-error-50"
264
+ ), x.textContent = C.error, x.classList.remove("wgt:hidden"));
265
+ });
266
+ const o = G({
267
+ type: "button",
268
+ title: n("fetch_info"),
269
+ className: "wgt:px-3 wgt:py-2.5 wgt:text-sm wgt:font-semibold wgt:rounded-lg wgt:flex-shrink-0 wgt:text-primary wgt:bg-white wgt:border wgt:border-primary",
270
+ handleClick: () => j(null, null, function* () {
271
+ if (r.noTaxCode || typeof e != "function")
272
+ return;
273
+ const C = String(r.taxCode || "").trim();
274
+ if (!C) {
275
+ l.classList.add(
276
+ "wgt:border-semantic-error",
277
+ "wgt:bg-semantic-error-50"
278
+ ), x.textContent = "Vui lòng nhập MST", x.classList.remove("wgt:hidden");
279
+ return;
280
+ }
281
+ const L = Q(C);
282
+ if (!L.valid) {
283
+ l.classList.add(
284
+ "wgt:border-semantic-error",
285
+ "wgt:bg-semantic-error-50"
286
+ ), x.textContent = L.error, x.classList.remove("wgt:hidden");
287
+ return;
288
+ }
289
+ try {
290
+ o.disabled = !0;
291
+ const h = yield e(C, $({}, r));
292
+ if (!h || typeof h != "object") return;
293
+ h.representativeName != null && (r.representativeName = String(h.representativeName || ""), f.value = r.representativeName), h.buyerAddress != null && (r.buyerAddress = String(h.buyerAddress || ""), b.value = r.buyerAddress), s();
294
+ } catch (h) {
295
+ l.classList.add(
296
+ "wgt:border-semantic-error",
297
+ "wgt:bg-semantic-error-50"
298
+ ), x.textContent = "Không tìm thấy thông tin MST", x.classList.remove("wgt:hidden");
299
+ } finally {
300
+ o.disabled = r.noTaxCode;
301
+ }
302
+ })
303
+ });
304
+ M.appendChild(l), M.appendChild(o), k.appendChild(F), k.appendChild(M), k.appendChild(x);
305
+ const {
306
+ field: w,
307
+ input: f,
308
+ errorEl: c
309
+ } = a({
310
+ label: n("business_name"),
311
+ required: !0,
312
+ name: "business_name",
313
+ placeholder: n("business_name_input")
314
+ }), {
315
+ field: v,
316
+ input: y,
317
+ errorEl: H
318
+ } = a({
319
+ label: n("representativeName"),
320
+ required: !0,
321
+ name: "representativeName",
322
+ placeholder: n("representativeName_input")
323
+ }), {
324
+ field: Z,
325
+ input: b,
326
+ errorEl: A
327
+ } = a({
328
+ label: n("buyerAddress"),
329
+ required: !1,
330
+ name: "buyerAddress",
331
+ placeholder: n("buyerAddress_input")
332
+ }), {
333
+ field: _,
334
+ input: m,
335
+ errorEl: T
336
+ } = a({
337
+ label: n("email"),
338
+ required: !0,
339
+ name: "email",
340
+ type: "email",
341
+ placeholder: n("email_input")
342
+ }), {
343
+ field: u,
344
+ input: V,
345
+ errorEl: S
346
+ } = a({
347
+ label: n("phone"),
348
+ required: !0,
349
+ name: "phone",
350
+ type: "tel",
351
+ placeholder: n("phone_input")
352
+ });
353
+ d.appendChild(g), d.appendChild(k), d.appendChild(w), d.appendChild(v), d.appendChild(Z), d.appendChild(_), d.appendChild(u), l.disabled = r.noTaxCode, o.disabled = r.noTaxCode;
354
+ function B() {
355
+ let C = !0;
356
+ function L(P, E, R) {
357
+ P.classList.add(
358
+ "wgt:border-semantic-error",
359
+ "wgt:bg-semantic-error-50 ",
360
+ "wgt:mt-2"
361
+ ), R && E && (E.textContent = R, E.classList.remove("wgt:hidden")), C = !1;
362
+ }
363
+ if (!r.noTaxCode) {
364
+ const P = Q(r.taxCode);
365
+ P.valid || L(l, x, P.error);
366
+ }
367
+ const h = z(r.representativeName);
368
+ h.valid || L(f, c, h.error);
369
+ const W = z(r.performerName);
370
+ if (W.valid || L(y, H, W.error), r.buyerAddress.trim()) {
371
+ const P = X(r.buyerAddress);
372
+ P.valid || L(b, A, P.error);
373
+ }
374
+ const I = K(r.email);
375
+ I.valid || L(m, T, I.error);
376
+ const O = Y(r.phone, !0);
377
+ return O.valid || L(V, S, O.error), C;
378
+ }
379
+ function q() {
380
+ return $({}, r);
381
+ }
382
+ return { container: d, getValues: q, validate: B };
383
+ }
384
+ function me({
385
+ type: i,
386
+ data: t,
387
+ orderInfo: e,
388
+ theme: r,
389
+ onClose: d,
390
+ onConfirm: s
391
+ }) {
392
+ const a = document.createElement("div");
393
+ a.className = "wgt:fixed wgt:inset-0 wgt:flex wgt:items-center wgt:justify-center wgt:z-50 wgt:p-4", a.style.cssText = `
394
+ background-color: rgba(0, 0, 0, 0.5);
395
+ backdrop-filter: blur(4px);
396
+ `, r && a.setAttribute("data-theme", r);
397
+ const g = document.createElement("div");
398
+ g.className = "wgt:w-full wgt:max-w-md wgt:bg-white wgt:rounded-2xl wgt:shadow-xl wgt:max-h-[90vh] wgt:overflow-y-auto";
399
+ const p = document.createElement("div");
400
+ p.className = "wgt:px-6 wgt:pt-6 wgt:pb-4 wgt:space-y-2";
401
+ const N = document.createElement("h3");
402
+ N.className = "wgt:text-xl wgt:font-semibold wgt:text-center wgt:text-strong-950", N.textContent = n("confirmation_popup_title");
403
+ const k = document.createElement("p");
404
+ k.className = "wgt:text-sm wgt:text-center wgt:text-[#525866]", k.textContent = n("confirmation_popup_subtitle"), p.appendChild(N), p.appendChild(k), g.appendChild(p);
405
+ const F = document.createElement("div");
406
+ F.className = "wgt:px-6 wgt:pb-4";
407
+ const M = document.createElement("div");
408
+ M.className = "wgt:space-y-3 wgt:rounded-xl wgt:bg-weak-50 wgt:px-4 wgt:py-3";
409
+ function l(b, A, _) {
410
+ const m = document.createElement("div");
411
+ m.className = "wgt:flex wgt:items-start wgt:gap-3";
412
+ const T = document.createElement("span");
413
+ T.className = "wgt:text-primary wgt:flex-shrink-0", T.innerHTML = b;
414
+ const u = document.createElement("div");
415
+ u.className = "wgt:flex wgt:items-start wgt:justify-between wgt:flex-1 wgt:gap-2";
416
+ const V = document.createElement("span");
417
+ V.className = "wgt:text-sm wgt:text-[#525866] wgt:w-1/3", V.textContent = A;
418
+ const S = document.createElement("span");
419
+ return S.className = "wgt:text-sm wgt:font-semibold wgt:text-strong-950 wgt:text-right wgt:w-2/3", S.textContent = _ || "-", u.appendChild(V), u.appendChild(S), m.appendChild(T), m.appendChild(u), m;
420
+ }
421
+ const x = '<svg class="wgt:w-4 wgt:h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /></svg>', o = '<svg class="wgt:w-4 wgt:h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z" /><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 11a3 3 0 11-6 0 3 3 0 016 0z" /></svg>', w = '<svg class="wgt:w-4 wgt:h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>';
422
+ M.appendChild(
423
+ l(
424
+ x,
425
+ n("confirmation_popup_orderCode"),
426
+ e == null ? void 0 : e.billNo
427
+ )
428
+ ), M.appendChild(
429
+ l(
430
+ o,
431
+ n("confirmation_popup_address"),
432
+ e == null ? void 0 : e.merchantAddress
433
+ )
434
+ ), M.appendChild(
435
+ l(
436
+ w,
437
+ n("confirmation_popup_totalAmount"),
438
+ te(e == null ? void 0 : e.amount) + " VND"
439
+ )
440
+ ), F.appendChild(M), g.appendChild(F);
441
+ const f = document.createElement("div");
442
+ f.className = "wgt:px-6 wgt:pb-6";
443
+ const c = document.createElement("div");
444
+ c.className = "wgt:space-y-3 wgt:rounded-xl wgt:border wgt:border-[#E1E4EA] wgt:px-4 wgt:py-4";
445
+ function v(b, A) {
446
+ const _ = document.createElement("div");
447
+ _.className = "wgt:flex wgt:items-start wgt:justify-between wgt:gap-4";
448
+ const m = document.createElement("span");
449
+ m.className = "wgt:text-sm wgt:text-[#0E121B] wgt:w-1/3", m.textContent = b;
450
+ const T = document.createElement("span");
451
+ return T.className = "wgt:text-sm wgt:font-semibold wgt:text-strong-950 wgt:text-right wgt:w-2/3", T.textContent = A || "-", _.appendChild(m), _.appendChild(T), _;
452
+ }
453
+ i === "business" ? (c.appendChild(
454
+ v(n("confirmation_popup_taxCode"), t.taxCode)
455
+ ), c.appendChild(
456
+ v(
457
+ n("confirmation_popup_representativeName"),
458
+ t.representativeName
459
+ )
460
+ ), c.appendChild(
461
+ v(n("confirmation_popup_buyerAddress"), t.buyerAddress)
462
+ ), c.appendChild(
463
+ v(n("confirmation_popup_performerName"), t.performerName)
464
+ ), c.appendChild(
465
+ v(n("confirmation_popup_email"), t.email)
466
+ ), c.appendChild(
467
+ v(n("confirmation_popup_phone"), t.phone)
468
+ )) : (c.appendChild(
469
+ v(
470
+ n("confirmation_popup_representativeName"),
471
+ t.representativeName
472
+ )
473
+ ), c.appendChild(
474
+ v(n("confirmation_popup_buyerAddress"), t.buyerAddress)
475
+ ), c.appendChild(
476
+ v(n("confirmation_popup_email"), t.email)
477
+ )), f.appendChild(c), g.appendChild(f);
478
+ const y = document.createElement("div");
479
+ y.className = "wgt:px-6 wgt:pb-6 wgt:flex wgt:gap-3";
480
+ const H = G({
481
+ type: "button",
482
+ title: "Đóng",
483
+ className: "wgt:flex-1 wgt:py-3 wgt:text-sm wgt:font-semibold wgt:rounded-[8px] wgt:bg-white wgt:text-primary wgt:border wgt:border-primary",
484
+ handleClick: () => {
485
+ typeof d == "function" && d(), a.remove();
486
+ }
487
+ }), Z = G({
488
+ type: "button",
489
+ title: "Xác nhận",
490
+ className: "wgt:flex-1 wgt:py-3 wgt:text-sm wgt:font-semibold wgt:rounded-[8px] wgt:bg-primary wgt:text-white",
491
+ handleClick: () => {
492
+ typeof s == "function" && s({ type: i, data: t }), a.remove();
493
+ }
494
+ });
495
+ return y.appendChild(H), y.appendChild(Z), g.appendChild(y), a.appendChild(g), a.addEventListener("click", (b) => {
496
+ b.target === a && (typeof d == "function" && d(), a.remove());
497
+ }), { overlay: a };
498
+ }
499
+ function we({
500
+ orderInfo: i,
501
+ onPreview: t,
502
+ theme: e,
503
+ onSubmit: r,
504
+ taxCode: d = ""
505
+ }) {
506
+ const s = document.createElement("div");
507
+ s.className = "wgt:flex wgt:flex-col wgt:items-center wgt:justify-between wgt:h-full wgt:shadow wgt:rounded-xl", e && s.setAttribute("data-theme", e);
508
+ const a = document.createElement("div");
509
+ a.className = "wgt:w-full wgt:max-w-md wgt:space-y-4 wgt:rounded-xl wgt:bg-white wgt:p-4", s.appendChild(a);
510
+ const {
511
+ container: g,
512
+ open: p,
513
+ close: N
514
+ } = oe();
515
+ s.style.position = s.style.position || "relative", s.appendChild(g);
516
+ const k = document.createElement("div");
517
+ k.className = "wgt:space-y-1";
518
+ const F = document.createElement("h3");
519
+ F.className = "wgt:text-2xl wgt:font-semibold wgt:text-text-black wgt:text-center wgt:justify-center", F.textContent = n("invoiceform_title");
520
+ const M = document.createElement("p");
521
+ M.className = "wgt:text-sm wgt:text-weak-700 wgt:text-center wgt:justify-center", M.textContent = n("invoiceform_subtitle"), k.appendChild(F), k.appendChild(M), a.appendChild(k);
522
+ const l = document.createElement("div");
523
+ l.className = "wgt:mt-2 wgt:space-y-3 wgt:rounded-xl wgt:bg-weak-50 wgt:px-6 wgt:py-6";
524
+ function x(u, V) {
525
+ const S = document.createElement("div");
526
+ S.className = "wgt:flex wgt:items-start";
527
+ const B = document.createElement("div");
528
+ B.className = "wgt:flex wgt:items-center wgt:gap-2 wgt:w-1/3";
529
+ const q = document.createElement("span");
530
+ q.className = "wgt:inline-flex wgt:items-center wgt:justify-center wgt:w-4 wgt:h-4 wgt:text-icon-primary";
531
+ let C = "";
532
+ u === n("orderCode") ? C = `
533
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
534
+ <path d="M12.7996 14H3.19961C3.04048 14 2.88787 13.9368 2.77535 13.8243C2.66282 13.7117 2.59961 13.5591 2.59961 13.4V2.6C2.59961 2.44087 2.66282 2.28826 2.77535 2.17574C2.88787 2.06321 3.04048 2 3.19961 2H12.7996C12.9587 2 13.1114 2.06321 13.2239 2.17574C13.3364 2.28826 13.3996 2.44087 13.3996 2.6V13.4C13.3996 13.5591 13.3364 13.7117 13.2239 13.8243C13.1114 13.9368 12.9587 14 12.7996 14ZM12.1996 12.8V3.2H3.79961V12.8H12.1996ZM5.59961 6.2H10.3996V7.4H5.59961V6.2ZM5.59961 8.6H10.3996V9.8H5.59961V8.6Z" fill="currentColor"/>
535
+ </svg>
536
+
537
+ ` : u === n("address_form") ? C = `
538
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
539
+ <path d="M7.99961 13.34L10.9696 10.37C11.557 9.78256 11.9569 9.03419 12.1189 8.21948C12.281 7.40477 12.1978 6.56031 11.8799 5.79289C11.562 5.02546 11.0236 4.36954 10.333 3.90805C9.64229 3.44657 8.83028 3.20026 7.99961 3.20026C7.16895 3.20026 6.35694 3.44657 5.66626 3.90805C4.97558 4.36954 4.43726 5.02546 4.11936 5.79289C3.80146 6.56031 3.71826 7.40477 3.88028 8.21948C4.04231 9.03419 4.44227 9.78256 5.02961 10.37L7.99961 13.34ZM7.99961 15.0368L4.18121 11.2184C3.42602 10.4631 2.91172 9.50096 2.70337 8.45346C2.49501 7.40597 2.60195 6.32021 3.01067 5.33349C3.41938 4.34678 4.11152 3.50342 4.99954 2.91006C5.88756 2.3167 6.9316 2 7.99961 2C9.06763 2 10.1117 2.3167 10.9997 2.91006C11.8877 3.50342 12.5798 4.34678 12.9886 5.33349C13.3973 6.32021 13.5042 7.40597 13.2959 8.45346C13.0875 9.50096 12.5732 10.4631 11.818 11.2184L7.99961 15.0368ZM7.99961 8.59995C8.31787 8.59995 8.6231 8.47353 8.84814 8.24848C9.07318 8.02344 9.19961 7.71821 9.19961 7.39995C9.19961 7.08169 9.07318 6.77647 8.84814 6.55143C8.6231 6.32638 8.31787 6.19995 7.99961 6.19995C7.68135 6.19995 7.37613 6.32638 7.15108 6.55143C6.92604 6.77647 6.79961 7.08169 6.79961 7.39995C6.79961 7.71821 6.92604 8.02344 7.15108 8.24848C7.37613 8.47353 7.68135 8.59995 7.99961 8.59995ZM7.99961 9.79995C7.36309 9.79995 6.75264 9.5471 6.30256 9.09701C5.85247 8.64692 5.59961 8.03647 5.59961 7.39995C5.59961 6.76343 5.85247 6.15298 6.30256 5.7029C6.75264 5.25281 7.36309 4.99995 7.99961 4.99995C8.63613 4.99995 9.24658 5.25281 9.69667 5.7029C10.1468 6.15298 10.3996 6.76343 10.3996 7.39995C10.3996 8.03647 10.1468 8.64692 9.69667 9.09701C9.24658 9.5471 8.63613 9.79995 7.99961 9.79995Z" fill="currentColor"/>
540
+ </svg>
541
+
542
+ ` : u === n("total_amount") && (C = `
543
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
544
+ <path d="M8 14C4.6862 14 2 11.3138 2 8C2 4.6862 4.6862 2 8 2C11.3138 2 14 4.6862 14 8C14 11.3138 11.3138 14 8 14ZM8 12.8C9.27304 12.8 10.4939 12.2943 11.3941 11.3941C12.2943 10.4939 12.8 9.27304 12.8 8C12.8 6.72696 12.2943 5.50606 11.3941 4.60589C10.4939 3.70571 9.27304 3.2 8 3.2C6.72696 3.2 5.50606 3.70571 4.60589 4.60589C3.70571 5.50606 3.2 6.72696 3.2 8C3.2 9.27304 3.70571 10.4939 4.60589 11.3941C5.50606 12.2943 6.72696 12.8 8 12.8V12.8ZM5.9 9.2H9.2C9.27957 9.2 9.35587 9.16839 9.41213 9.11213C9.46839 9.05587 9.5 8.97957 9.5 8.9C9.5 8.82044 9.46839 8.74413 9.41213 8.68787C9.35587 8.63161 9.27957 8.6 9.2 8.6H6.8C6.40218 8.6 6.02064 8.44197 5.73934 8.16066C5.45804 7.87936 5.3 7.49783 5.3 7.1C5.3 6.70218 5.45804 6.32065 5.73934 6.03934C6.02064 5.75804 6.40218 5.6 6.8 5.6H7.4V4.4H8.6V5.6H10.1V6.8H6.8C6.72044 6.8 6.64413 6.83161 6.58787 6.88787C6.53161 6.94413 6.5 7.02044 6.5 7.1C6.5 7.17957 6.53161 7.25587 6.58787 7.31213C6.64413 7.36839 6.72044 7.4 6.8 7.4H9.2C9.59783 7.4 9.97936 7.55804 10.2607 7.83934C10.542 8.12065 10.7 8.50218 10.7 8.9C10.7 9.29783 10.542 9.67936 10.2607 9.96066C9.97936 10.242 9.59783 10.4 9.2 10.4H8.6V11.6H7.4V10.4H5.9V9.2Z" fill="currentColor"/>
545
+ </svg>
546
+
547
+ `), q.innerHTML = C;
548
+ const L = document.createElement("span");
549
+ L.className = "wgt:text-sm wgt:text-weak-700", L.textContent = u, B.appendChild(q), B.appendChild(L);
550
+ const h = document.createElement("span");
551
+ return h.className = "wgt:text-sm wgt:font-semibold wgt:text-strong-950 wgt:w-2/3 wgt:text-right", h.textContent = V, S.appendChild(B), S.appendChild(h), S;
552
+ }
553
+ l.appendChild(x(n("orderCode"), i == null ? void 0 : i.billNo)), l.appendChild(
554
+ x(n("address_form"), i == null ? void 0 : i.merchantAddress)
555
+ ), l.appendChild(
556
+ x(
557
+ n("total_amount"),
558
+ te(i == null ? void 0 : i.amount) + " VND"
559
+ )
560
+ ), a.appendChild(l);
561
+ const o = document.createElement("div");
562
+ o.className = "wgt:mt-4 wgt:rounded-xl wgt:border wgt:border-[#E1E4EA] wgt:bg-white wgt:pb-6", a.appendChild(o);
563
+ const w = document.createElement("div");
564
+ w.className = "wgt:flex wgt:border-b wgt:border-[#E1E4EA]", o.appendChild(w);
565
+ const f = document.createElement("button");
566
+ f.type = "button", f.className = "wgt:relative wgt:flex-1 wgt:py-4 wgt:text-sm wgt:font-semibold ", f.innerHTML = `
567
+ <span class="wgt:flex wgt:items-center wgt:justify-center wgt:gap-2">
568
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
569
+ <path d="M10 12C11.4587 12 12.8572 12.5799 13.8887 13.6113C14.8016 14.5242 15.3592 15.7247 15.4756 17H14.9746C14.8598 15.8576 14.3542 14.7839 13.5352 13.9648C12.5975 13.0272 11.3261 12.5 10 12.5C8.67392 12.5 7.40253 13.0272 6.46484 13.9648C5.64577 14.7839 5.14018 15.8576 5.02539 17H4.52441C4.64082 15.7247 5.19843 14.5242 6.11133 13.6113C7.07838 12.6443 8.36805 12.0742 9.72754 12.0068L10 12ZM10 2.25C12.2101 2.25 14 4.03989 14 6.25C14 8.46011 12.2101 10.25 10 10.25C7.78989 10.25 6 8.46011 6 6.25C6 4.03989 7.78989 2.25 10 2.25ZM10 2.75C8.06636 2.75 6.5 4.31636 6.5 6.25C6.5 8.18364 8.06636 9.75 10 9.75C11.9336 9.75 13.5 8.18364 13.5 6.25C13.5 4.31636 11.9336 2.75 10 2.75Z" fill="currentColor" stroke="currentColor"/>
570
+ </svg>
571
+
572
+ ${n("individual")}
573
+ </span>
574
+ `;
575
+ const c = document.createElement("button");
576
+ c.type = "button", c.className = "wgt:relative wgt:flex-1 wgt:py-4 wgt:text-sm wgt:font-semibold", c.innerHTML = `
577
+ <span class="wgt:flex wgt:items-center wgt:justify-center wgt:gap-2">
578
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
579
+ <path d="M4 3.875H11.5C11.5332 3.875 11.5654 3.88769 11.5889 3.91113C11.6123 3.93457 11.625 3.96685 11.625 4V15.875H15.875V8.625H14.375V8.375H16C16.0332 8.375 16.0654 8.38769 16.0889 8.41113C16.1123 8.43457 16.125 8.46685 16.125 8.5V15.875H17.625V16.125H2.375V15.875H3.875V4C3.875 3.96685 3.88769 3.93457 3.91113 3.91113C3.93457 3.88769 3.96685 3.875 4 3.875ZM4.125 15.875H11.375V4.125H4.125V15.875ZM8.625 9.875V10.125H6.875V9.875H8.625ZM8.625 6.875V7.125H6.875V6.875H8.625Z" fill="currentColor" stroke="currentColor" stroke-width="1.25"/>
580
+ </svg>
581
+
582
+ ${n("business")}
583
+ </span>
584
+ `, w.appendChild(f), w.appendChild(c);
585
+ const v = document.createElement("div");
586
+ v.className = "wgt:mt-4 wgt:px-4", o.appendChild(v);
587
+ const y = pe(), H = ge({
588
+ defaultValues: { taxCode: d || "" },
589
+ onFetchByTaxCode: (u) => j(null, null, function* () {
590
+ var S, B;
591
+ const V = yield de(u);
592
+ return {
593
+ representativeName: (S = V.nguoi_dai_dien) != null ? S : "",
594
+ buyerAddress: (B = V.dia_chi) != null ? B : ""
595
+ };
596
+ })
597
+ });
598
+ let Z = "individual", b = y;
599
+ function A(u) {
600
+ Z = u, f.style.borderBottom = "none", c.style.borderBottom = "none";
601
+ const V = "wgt:relative wgt:flex-1 wgt:py-4 wgt:text-sm wgt:font-semibold";
602
+ u === "individual" ? (f.className = `${V} wgt:text-strong-950`, f.style.borderBottom = "2px solid var(--primary)", c.className = `${V} wgt:text-soft-400`, v.innerHTML = "", v.appendChild(y.container), b = y) : (c.className = `${V} wgt:text-strong-950`, c.style.borderBottom = "2px solid var(--primary)", f.className = `${V} wgt:text-soft-400`, v.innerHTML = "", v.appendChild(H.container), b = H);
603
+ }
604
+ f.addEventListener("click", () => A("individual")), c.addEventListener("click", () => A("business")), A("individual");
605
+ const _ = document.createElement("p");
606
+ _.className = "wgt:mt-2 wgt:text-xs wgt:text-[#FF8447] wgt:text-left wgt:justify-center", _.textContent = n("invoiceform_note"), a.appendChild(_);
607
+ const m = document.createElement("div");
608
+ m.className = "wgt:mt-6 wgt:w-full wgt:flex wgt:justify-center wgt:items-center";
609
+ const T = G({
610
+ type: "button",
611
+ title: n("btn_preview"),
612
+ className: "wgt:min-w-[163px] wgt:text-white",
613
+ handleClick: () => {
614
+ if (!b.validate())
615
+ return;
616
+ const u = {
617
+ type: Z,
618
+ data: b.getValues()
619
+ }, { overlay: V } = me({
620
+ type: u.type,
621
+ data: u.data,
622
+ orderInfo: i,
623
+ theme: e,
624
+ onClose: () => {
625
+ console.log("Popup closed");
626
+ },
627
+ onConfirm: () => j(null, null, function* () {
628
+ var S, B, q;
629
+ V.remove(), p();
630
+ try {
631
+ if (typeof r != "function") return;
632
+ const C = yield r({
633
+ type: u.type,
634
+ data: u.data
635
+ }), L = (q = (B = (S = C == null ? void 0 : C.finalData) != null ? S : C == null ? void 0 : C.data) != null ? B : C) != null ? q : {}, h = String((L == null ? void 0 : L.status) || "").trim().toLowerCase();
636
+ if (N(), h === "invoiced") {
637
+ J({
638
+ message: n("invoice_success"),
639
+ description: n("invoice_description"),
640
+ // okLabel: t('close'),
641
+ isSuccess: !0,
642
+ hideOkButton: !0,
643
+ theme: e,
644
+ closeOnClickOutside: !1
645
+ }).open();
646
+ return;
647
+ }
648
+ if (h === "failed") {
649
+ J({
650
+ message: n("invoice_failed"),
651
+ description: n("invoice_description_failed"),
652
+ // okLabel: t('close'),
653
+ isSuccess: !1,
654
+ hideOkButton: !0,
655
+ theme: e,
656
+ closeOnClickOutside: !1
657
+ }).open();
658
+ return;
659
+ }
660
+ } catch (C) {
661
+ N(), J({
662
+ message: n("invoice_failed"),
663
+ description: n("invoice_description_failed"),
664
+ // okLabel: t('close'),
665
+ isSuccess: !1,
666
+ hideOkButton: !0,
667
+ closeOnClickOutside: !1,
668
+ theme: e
669
+ }).open(), console.error(C);
670
+ }
671
+ })
672
+ });
673
+ document.body.appendChild(V);
674
+ }
675
+ });
676
+ return m.appendChild(T), a.appendChild(m), { container: s };
677
+ }
678
+ function ue({ theme: i, onClose: t } = {}) {
679
+ const e = document.createElement("div");
680
+ e.className = " wgt:flex wgt:h-screen wgt:bg-[#F3F4F6] wgt:p-4", i && e.setAttribute("data-theme", i);
681
+ const r = document.createElement("div");
682
+ r.className = "wgt:w-full wgt:max-w-md wgt:max-h-[208px] wgt:bg-white wgt:rounded-2xl wgt:shadow-sm wgt:p-8 wgt:text-center";
683
+ const d = document.createElement("div");
684
+ d.className = "wgt:flex wgt:justify-center wgt:mb-4";
685
+ const s = document.createElement("div");
686
+ s.className = "wgt:w-12 wgt:h-12 wgt:rounded-full wgt:flex wgt:items-center wgt:justify-center", s.style.backgroundColor = "#335CFF", s.innerHTML = `
687
+ <svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg">
688
+ <path d="M20.7996 22.75H5.19961C4.94102 22.75 4.69303 22.6473 4.51018 22.4644C4.32733 22.2816 4.22461 22.0336 4.22461 21.775V4.225C4.22461 3.96641 4.32733 3.71842 4.51018 3.53557C4.69303 3.35272 4.94102 3.25 5.19961 3.25H20.7996C21.0582 3.25 21.3062 3.35272 21.489 3.53557C21.6719 3.71842 21.7746 3.96641 21.7746 4.225V21.775C21.7746 22.0336 21.6719 22.2816 21.489 22.4644C21.3062 22.6473 21.0582 22.75 20.7996 22.75ZM9.09961 10.075V12.025H16.8996V10.075H9.09961ZM9.09961 13.975V15.925H16.8996V13.975H9.09961Z" fill="white"/>
689
+ </svg>
690
+
691
+ `, d.appendChild(s), r.appendChild(d);
692
+ const a = document.createElement("h2");
693
+ a.className = "wgt:text-base wgt:font-semibold wgt:text-[#0E121B] wgt:mb-2", a.textContent = n("invoiceCheckout_title"), r.appendChild(a);
694
+ const g = document.createElement("p");
695
+ return g.className = "wgt:text-sm wgt:text-[#525866] wgt:leading-relaxed", g.textContent = n("invoiceCheckout_description"), r.appendChild(g), e.appendChild(r), { container: e };
696
+ }
697
+ function Ce({ theme: i, onClose: t } = {}) {
698
+ const e = document.createElement("div");
699
+ e.className = "wgt:min-h-screen wgt:flex wgt:bg-[#F3F4F6] wgt:p-4", i && e.setAttribute("data-theme", i);
700
+ const r = document.createElement("div");
701
+ r.className = "wgt:w-full wgt:max-w-md wgt:max-h-[252px] wgt:bg-white wgt:rounded-2xl wgt:shadow-sm wgt:px-4 wgt:py-5 wgt:text-center";
702
+ const d = document.createElement("div");
703
+ d.className = "wgt:flex wgt:justify-center wgt:mb-2";
704
+ const s = document.createElement("div");
705
+ s.innerHTML = `
706
+ <svg width="60" height="60" viewBox="0 0 60 60" fill="none" xmlns="http://www.w3.org/2000/svg">
707
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M54.1342 21.7247L55.1467 20.5742C56.1143 19.4756 55.9467 17.7277 54.7361 16.6283C53.5262 15.5258 51.7494 15.5022 50.7825 16.6009L49.7715 17.7521L54.1342 21.7247Z" fill="#525866"/>
708
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M36.6582 10.4023H40.9028V14.1966H36.6582V10.4023Z" fill="#99A0AE"/>
709
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M35.076 6.51758H42.4863C43.3495 6.51758 44.0467 7.21472 44.0467 8.08329V9.87377C44.0467 10.7423 43.3495 11.4395 42.4863 11.4395H35.076C34.212 11.4395 33.5156 10.7423 33.5156 9.87377V8.08329C33.5156 7.21472 34.212 6.51758 35.076 6.51758Z" fill="#525866"/>
710
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M38.7787 13.9316C50.4526 13.9316 59.9162 23.4113 59.9162 35.1042C59.9162 46.7987 50.4526 56.2791 38.7787 56.2791C33.0141 56.2791 29.1962 54.3682 21.3722 51.7076L23.5505 49.5141C24.5288 48.5267 23.5695 46.7278 22.125 47.2855C15.5551 49.8128 11.7257 47.1141 9.85831 41.0181C12.6842 42.8139 16.5867 41.5758 17.8095 40.3499C19.7044 38.4535 18.9646 36.26 14.6995 37.6695C9.22974 39.473 3.46364 36.3164 0.693359 28.5092C9.06212 32.7134 9.6785 24.0612 18.5181 26.3667C17.7661 23.3335 15.7273 22.3332 11.0575 22.4528C15.6884 16.6166 22.4236 19.6383 29.5269 16.0673C32.3208 14.6996 35.4583 13.9316 38.7787 13.9316Z" fill="#FF8447"/>
711
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M53.9358 35.102C53.9358 43.4875 47.1518 50.2844 38.7784 50.2844C34.7579 50.2844 30.9026 48.6867 28.06 45.8372C25.218 42.9907 23.6211 39.1286 23.6211 35.102C23.6211 31.073 25.2173 27.2155 28.06 24.3644C30.9026 21.518 34.7579 19.918 38.7784 19.918C47.1518 19.918 53.9358 26.718 53.9358 35.102Z" fill="#F2F2F2"/>
712
+ <path d="M38.5516 22.0568C38.1143 22.0636 37.7631 22.427 37.7676 22.8651V24.0118C37.7676 25.0709 39.36 25.0709 39.36 24.0118V22.8651C39.3676 22.4149 39.0019 22.0491 38.5516 22.0568Z" fill="#808080"/>
713
+ <path d="M38.5516 45.3908C38.1143 45.3946 37.7631 45.7565 37.7676 46.1991V47.342C37.7676 48.4049 39.36 48.4049 39.36 47.342V46.1991C39.3676 45.7496 39.0019 45.3824 38.5516 45.3908Z" fill="#808080"/>
714
+ <path d="M49.64 34.3066C48.5809 34.3066 48.5809 35.8998 49.64 35.8998H50.7828C51.8411 35.8998 51.8411 34.3066 50.7828 34.3066H49.64Z" fill="#808080"/>
715
+ <path d="M26.3406 34.3066C25.2823 34.3066 25.2823 35.8998 26.3406 35.8998H27.4873C28.5463 35.8998 28.5463 34.3066 27.4873 34.3066H26.3406Z" fill="#808080"/>
716
+ <path d="M46.3873 42.1465C45.6711 42.1465 45.3206 43.0151 45.8333 43.5118L46.6379 44.321C46.945 44.6524 47.4653 44.6585 47.7846 44.3415C48.1023 44.0223 48.0916 43.505 47.7602 43.1987L46.9556 42.3903C46.8055 42.2349 46.6029 42.1465 46.3873 42.1465Z" fill="#808080"/>
717
+ <path d="M29.9141 25.6484C29.2002 25.6484 28.8513 26.517 29.361 27.0145L30.1694 27.8191C30.4749 28.149 30.9968 28.162 31.316 27.842C31.6337 27.5242 31.6216 27.0023 31.2917 26.6953L30.4871 25.8915C30.3362 25.7361 30.1297 25.6484 29.9141 25.6484Z" fill="#808080"/>
718
+ <path d="M47.1912 25.6489C46.9847 25.6535 46.7843 25.7411 46.6418 25.8919L45.8373 26.6958C45.5074 27.0028 45.4952 27.5247 45.8129 27.8424C46.1314 28.1617 46.654 28.1495 46.9596 27.8196L47.7641 27.015C48.286 26.5091 47.9157 25.6253 47.1912 25.6489Z" fill="#808080"/>
719
+ <path d="M30.7206 42.1468C30.5142 42.1552 30.3138 42.2382 30.1713 42.3906L29.3629 43.199C29.0323 43.5053 29.0246 44.0226 29.3423 44.3418C29.6608 44.6596 30.182 44.6527 30.489 44.3213L31.2936 43.5121C31.8155 43.0077 31.446 42.1277 30.7206 42.1468Z" fill="#808080"/>
720
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M38.7788 33.9142C39.4439 33.9142 39.9696 34.4369 39.9696 35.1051C39.9696 35.7748 39.4447 36.2959 38.7788 36.2959C38.1144 36.2959 37.5879 35.7748 37.5879 35.1051C37.5879 34.4361 38.1144 33.9142 38.7788 33.9142ZM44.1494 28.6799C43.9468 28.6837 43.7479 28.7675 43.6039 28.9146L39.9376 32.59C39.5826 32.4232 39.1925 32.3234 38.7788 32.3234C37.2542 32.3234 36.0039 33.5813 36.0039 35.1051C36.0039 36.6296 37.2542 37.8891 38.7788 37.8891C40.3033 37.8891 41.5544 36.6296 41.5544 35.1051C41.5544 34.5679 41.3944 34.0712 41.1285 33.6445L44.727 30.0376C45.2367 29.5317 44.8702 28.6632 44.1494 28.6799Z" fill="#808080"/>
721
+ </svg>
722
+
723
+ `, d.appendChild(s), r.appendChild(d);
724
+ const a = document.createElement("h2");
725
+ a.className = "wgt:text-base wgt:font-semibold wgt:text-[#0E121B] wgt:mb-2", a.textContent = n("invoiceExpired_title"), r.appendChild(a);
726
+ const g = document.createElement("p");
727
+ g.className = "wgt:text-sm wgt:text-[#525866] wgt:leading-relaxed wgt:px-2 wgt:mb-3", g.textContent = n("invoiceExpired_description"), r.appendChild(g);
728
+ const p = document.createElement("p");
729
+ return p.className = "wgt:text-sm wgt:text-[#99A0AE] wgt:italic wgt:leading-relaxed wgt:px-4", p.textContent = n("invoiceExpired_note"), r.appendChild(p), e.appendChild(r), { container: e };
730
+ }
731
+ function re(i) {
732
+ return String(i || "").trim().toLowerCase();
733
+ }
734
+ function Ne({ uuid: i, orderInfo: t, theme: e }) {
735
+ const r = document.createElement("div");
736
+ r.className = "wgt:w-full wgt:min-h-screen";
737
+ let d = !1;
738
+ function s(o) {
739
+ d || (r.innerHTML = "", o && r.appendChild(o));
740
+ }
741
+ function a(o) {
742
+ o && console.log("[DEBUG] renderFailedPage:", o);
743
+ const w = ce({
744
+ theme: e,
745
+ onClose: F
746
+ });
747
+ s(w.container);
748
+ }
749
+ function g() {
750
+ const o = Ce({
751
+ theme: e
752
+ });
753
+ s(o.container);
754
+ }
755
+ function p(o) {
756
+ const w = ue({
757
+ theme: e
758
+ });
759
+ s(w.container);
760
+ }
761
+ function N(o) {
762
+ const w = we({
763
+ orderInfo: o || {},
764
+ theme: e,
765
+ onSubmit: (v) => j(null, [v], function* ({ type: f, data: c }) {
766
+ const y = k();
767
+ if (!y)
768
+ return a({ reason: "MISSING_UUID_ON_SUBMIT" }), { ok: !1 };
769
+ const H = he(f, c);
770
+ return yield le(y, H), { ok: !0, finalData: yield ve(y, {
771
+ maxTries: 20,
772
+ intervalMs: 1500
773
+ }) };
774
+ }),
775
+ onBack: F
776
+ });
777
+ s(w.container);
778
+ }
779
+ function k() {
780
+ var f;
781
+ const o = new URLSearchParams(window.location.search || "");
782
+ return String((f = o.get("uuid")) != null ? f : "").trim() || String(i || "").trim() || String((t == null ? void 0 : t.uuid) || "").trim();
783
+ }
784
+ function F() {
785
+ return j(this, null, function* () {
786
+ yield M();
787
+ });
788
+ }
789
+ function M() {
790
+ return j(this, null, function* () {
791
+ try {
792
+ const o = k();
793
+ if (!o)
794
+ return a({ reason: "EMPTY_UUID_NO_API_CALL" });
795
+ const w = yield ne(o), f = String((w == null ? void 0 : w.message) || "").trim();
796
+ if (f)
797
+ return a({ reason: "API_MESSAGE", apiMsg: f, res: w });
798
+ const c = re(w == null ? void 0 : w.status);
799
+ return c === "expired" ? g() : c === "invoiced" ? p(w) : c === "pending" || c === "waiting" ? N(w || t || {}) : c === "" && w && Object.keys(w).length > 0 ? N(w) : a({ reason: "UNKNOWN_STATUS", status: c, res: w });
800
+ } catch (o) {
801
+ return console.log("[DEBUG] loadAndRender error:", o), a({ reason: "EXCEPTION", error: (o == null ? void 0 : o.message) || o });
802
+ }
803
+ });
804
+ }
805
+ function l() {
806
+ return j(this, null, function* () {
807
+ a({ reason: "INIT_DEFAULT_RENDER" });
808
+ try {
809
+ yield M();
810
+ } catch (o) {
811
+ return a({
812
+ reason: "INIT_EXCEPTION",
813
+ error: (o == null ? void 0 : o.message) || o
814
+ });
815
+ }
816
+ });
817
+ }
818
+ function x() {
819
+ d = !0, r.innerHTML = "";
820
+ }
821
+ return { container: r, init: l, destroy: x };
822
+ }
823
+ function fe(i) {
824
+ return String(i || "").trim().toLowerCase() === "business" ? "enterprise" : "individual";
825
+ }
826
+ function he(i, t) {
827
+ const e = fe(i), r = {
828
+ invoiceType: e,
829
+ buyerName: (t == null ? void 0 : t.representativeName) || "",
830
+ address: (t == null ? void 0 : t.buyerAddress) || "",
831
+ email: (t == null ? void 0 : t.email) || ""
832
+ };
833
+ return e === "enterprise" && (r.taxCode = t != null && t.noTaxCode ? "" : (t == null ? void 0 : t.taxCode) || "", r.performerName = (t == null ? void 0 : t.performerName) || ""), r;
834
+ }
835
+ function ve(r) {
836
+ return j(this, arguments, function* (i, { maxTries: t = 20, intervalMs: e = 1500 } = {}) {
837
+ for (let s = 0; s < t; s++) {
838
+ yield xe(e);
839
+ const a = yield ne(i), g = re(a == null ? void 0 : a.status);
840
+ if (g === "invoiced") return a;
841
+ if (g === "expired") {
842
+ const p = new Error("Invoice request expired while polling");
843
+ throw p.code = "EXPIRED", p.data = a, p;
844
+ }
845
+ }
846
+ const d = new Error("Polling timeout: status not invoiced");
847
+ throw d.code = "POLL_TIMEOUT", d;
848
+ });
849
+ }
850
+ function xe(i) {
851
+ return new Promise((t) => setTimeout(t, i));
852
+ }
853
+ export {
854
+ Ne as createInvoiceRequestFlow
855
+ };