@xwadex/fesd 0.0.31 → 0.0.32

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.
@@ -1,4 +1,4 @@
1
- var U = (r, e, t) => {
1
+ var M = (r, e, t) => {
2
2
  if (!e.has(r))
3
3
  throw TypeError("Cannot " + t);
4
4
  };
@@ -7,12 +7,12 @@ var D = (r, e, t) => {
7
7
  throw TypeError("Cannot add the same private member more than once");
8
8
  e instanceof WeakSet ? e.add(r) : e.set(r, t);
9
9
  };
10
- var V = (r, e, t) => (U(r, e, "access private method"), t);
10
+ var V = (r, e, t) => (M(r, e, "access private method"), t);
11
11
  import { n as z, o as q } from "./image-preview-bundle.js";
12
- import { x as ue, B as de, z as fe, G as pe, F as me, J as ye, K as he, E as ve, L as ge, O as be, P as ke, Q as xe, X as Se, Y as Ae, w as Ee, U as we, W as Ce, u as qe, t as Le, V as Oe, q as Te, r as Fe, p as Ge, S as $e, y as Ie, H as Ne, N as De } from "./image-preview-bundle.js";
12
+ import { x as ue, B as de, z as fe, G as pe, F as me, J as ye, K as he, E as ve, L as ge, O as be, P as ke, Q as xe, X as Se, Y as Ee, w as Ae, U as we, W as Ce, u as qe, t as Le, V as Oe, q as Te, r as Fe, p as Ge, S as $e, y as Ie, H as Ne, N as De } from "./image-preview-bundle.js";
13
13
  import { o as H, z as Q } from "./vendor-bundle.js";
14
- import h from "jquery";
15
- import w from "validator";
14
+ import v from "jquery";
15
+ import A from "validator";
16
16
  import _ from "flatpickr";
17
17
  function se() {
18
18
  if (!document.body.classList.contains("error") || document.querySelector(".back-home") == null)
@@ -25,55 +25,55 @@ function se() {
25
25
  }
26
26
  function W(r, e = r) {
27
27
  if (r.complete) {
28
- const o = new H().getColor(r), s = o[0] * 0.299 + o[1] * 0.587 + o[2] * 0.114;
29
- G(s, e), e.classList.add("detected");
28
+ const o = new H().getColor(r), i = o[0] * 0.299 + o[1] * 0.587 + o[2] * 0.114;
29
+ G(i, e), e.classList.add("detected");
30
30
  }
31
31
  }
32
32
  function G(r, e) {
33
33
  const t = e.getAttribute("addClassEl");
34
34
  r >= 192 ? t && t !== "" ? t.split(",").forEach((o) => {
35
- var s;
36
- e.closest(o) || console.error(`closest "${o}" not found`), (s = e.closest(o)) == null || s.classList.add("is-light");
35
+ var i;
36
+ e.closest(o) || console.error(`closest "${o}" not found`), (i = e.closest(o)) == null || i.classList.add("is-light");
37
37
  }) : e.classList.add("is-light") : t && t !== "" ? t.split(",").forEach((o) => {
38
- var s;
39
- e.closest(o) || console.error(`closest "${o}" not found`), (s = e.closest(o)) == null || s.classList.add("is-dark");
38
+ var i;
39
+ e.closest(o) || console.error(`closest "${o}" not found`), (i = e.closest(o)) == null || i.classList.add("is-dark");
40
40
  }) : e.classList.add("is-dark");
41
41
  }
42
42
  function R(r, e, t) {
43
- const o = document.createElement("canvas"), s = o.getContext("2d");
43
+ const o = document.createElement("canvas"), i = o.getContext("2d");
44
44
  if (o.width = 50, o.height = 50, r !== "" && e === "")
45
- s.fillStyle = r;
45
+ i.fillStyle = r;
46
46
  else if (r !== "" && e !== "") {
47
- const p = s.createLinearGradient(0, 0, o.width, o.height);
48
- p.addColorStop(0, r), p.addColorStop(1, e), s.fillStyle = p;
47
+ const p = i.createLinearGradient(0, 0, o.width, o.height);
48
+ p.addColorStop(0, r), p.addColorStop(1, e), i.fillStyle = p;
49
49
  }
50
- s.fillRect(0, 0, o.width, o.height);
51
- const d = new Image();
52
- return d.src = o.toDataURL(), d.crossOrigin = "Anonymous", d.addEventListener("load", function() {
50
+ i.fillRect(0, 0, o.width, o.height);
51
+ const f = new Image();
52
+ return f.src = o.toDataURL(), f.crossOrigin = "Anonymous", f.addEventListener("load", function() {
53
53
  W(this, t);
54
- }), d;
54
+ }), f;
55
55
  }
56
56
  function ie() {
57
57
  [...document.querySelectorAll(".detect-shade:not(.detected)")].forEach((e) => {
58
58
  if (e.tagName === "IMG")
59
59
  return;
60
- const t = ["#FFF", "#FFFFFF", "#fff", "#ffffff"], o = ["#000", "#000000"], s = getComputedStyle(e).getPropertyValue("--start-color"), d = getComputedStyle(e).getPropertyValue("--end-color");
61
- if (s === "" && d === "") {
60
+ const t = ["#FFF", "#FFFFFF", "#fff", "#ffffff"], o = ["#000", "#000000"], i = getComputedStyle(e).getPropertyValue("--start-color"), f = getComputedStyle(e).getPropertyValue("--end-color");
61
+ if (i === "" && f === "") {
62
62
  console.error(e, "=> No color set!");
63
63
  return;
64
- } else if (t.indexOf(s) > 0) {
64
+ } else if (t.indexOf(i) > 0) {
65
65
  console.warn(e, "=> TypeError!! ( #FFF ) "), G(255, e);
66
66
  return;
67
- } else if (o.indexOf(s) > 0) {
67
+ } else if (o.indexOf(i) > 0) {
68
68
  console.warn(e, "=> TypeError!! ( #000 ) "), G(0, e);
69
69
  return;
70
70
  }
71
- R(s, d, e);
71
+ R(i, f, e);
72
72
  });
73
73
  }
74
74
  const O = {
75
75
  CG_A: function(r) {
76
- h("html,body").delay(100).animate(
76
+ v("html,body").delay(100).animate(
77
77
  { opacity: "0" },
78
78
  {
79
79
  queue: !0,
@@ -86,7 +86,7 @@ const O = {
86
86
  );
87
87
  },
88
88
  CG_B: function(r) {
89
- h("main").append("<div id='CG_Abg'><div class='CG_Abg1'></div><div class='CG_Abg2'></div></div>"), h("body").delay(1200).animate(
89
+ v("main").append("<div id='CG_Abg'><div class='CG_Abg1'></div><div class='CG_Abg2'></div></div>"), v("body").delay(1200).animate(
90
90
  { opacity: "0" },
91
91
  {
92
92
  queue: !0,
@@ -101,7 +101,7 @@ const O = {
101
101
  );
102
102
  },
103
103
  CG_C: function(r) {
104
- h("main").append("<div id='CG_Bbg'></div>"), h("body").delay(1200).animate(
104
+ v("main").append("<div id='CG_Bbg'></div>"), v("body").delay(1200).animate(
105
105
  { opacity: "0" },
106
106
  {
107
107
  queue: !0,
@@ -116,7 +116,7 @@ const O = {
116
116
  );
117
117
  },
118
118
  CG_D: function(r) {
119
- h("main").append("<div id='CG_Cbg'><div class='CG_Cbg1'></div><div class='CG_Cbg2'></div></div>"), h("body").delay(1200).animate(
119
+ v("main").append("<div id='CG_Cbg'><div class='CG_Cbg1'></div><div class='CG_Cbg2'></div></div>"), v("body").delay(1200).animate(
120
120
  { opacity: "0" },
121
121
  {
122
122
  queue: !0,
@@ -147,52 +147,52 @@ const O = {
147
147
  }
148
148
  }, j = (r, e) => {
149
149
  r.preventDefault();
150
- const t = h(r.currentTarget), o = t.attr("target"), s = t.attr("href");
151
- let d;
150
+ const t = v(r.currentTarget), o = t.attr("target"), i = t.attr("href");
151
+ let f;
152
152
  if (e) {
153
153
  if (t.is("[data-nolink]")) {
154
154
  r.stopPropagation(), r.preventDefault();
155
155
  return;
156
156
  }
157
- t.hasClass("href-link") ? d = t.closest("[data-href]").attr("data-href") : d = s;
157
+ t.hasClass("href-link") ? f = t.closest("[data-href]").attr("data-href") : f = i;
158
158
  } else {
159
159
  if (t.is("[data-nolink]")) {
160
160
  r.stopPropagation(), r.preventDefault();
161
161
  return;
162
162
  }
163
- t.hasClass("click-block") ? d = t.closest("[data-href]").attr("data-href") : d = s;
163
+ t.hasClass("click-block") ? f = t.closest("[data-href]").attr("data-href") : f = i;
164
164
  }
165
- let f = window.location.pathname.replace("http://", "").split("/");
166
- f = i(f);
167
- const c = d.replace("http://", "");
168
- let a = c.split("/");
169
- a = i(a);
170
- function i(u) {
171
- const l = u.pop();
172
- return l.indexOf("#") > -1 || l.indexOf("html") > 0 ? u.push(l) : (l == "" || u.push(l), u.push("index.html")), u;
165
+ let d = window.location.pathname.replace("http://", "").split("/");
166
+ d = s(d);
167
+ const u = f.replace("http://", "");
168
+ let l = u.split("/");
169
+ l = s(l);
170
+ function s(n) {
171
+ const a = n.pop();
172
+ return a.indexOf("#") > -1 || a.indexOf("html") > 0 ? n.push(a) : (a == "" || n.push(a), n.push("index.html")), n;
173
173
  }
174
- o == "_blank" || r.ctrlKey || r.metaKey ? window.open(d) : c.indexOf("jpg") > -1 || c.indexOf("javascript") > -1 || K(d);
174
+ o == "_blank" || r.ctrlKey || r.metaKey ? window.open(f) : u.indexOf("jpg") > -1 || u.indexOf("javascript") > -1 || K(f);
175
175
  }, X = (r) => {
176
- const t = h(r.currentTarget).closest("[data-href]");
176
+ const t = v(r.currentTarget).closest("[data-href]");
177
177
  t.hasClass("isHover") || t.addClass("isHover");
178
178
  }, Y = (r) => {
179
- const t = h(r.currentTarget).closest("[data-href]");
179
+ const t = v(r.currentTarget).closest("[data-href]");
180
180
  t.hasClass("isHover") && t.removeClass("isHover");
181
181
  }, ae = (r = !0) => {
182
- h.easing.jswing = h.easing.swing, h.extend(h.easing, {
182
+ v.easing.jswing = v.easing.swing, v.extend(v.easing, {
183
183
  def: "easeOutQuad",
184
- easeOutQuad: function(e, t, o, s, d) {
185
- return -s * (t /= d) * (t - 2) + o;
184
+ easeOutQuad: function(e, t, o, i, f) {
185
+ return -i * (t /= f) * (t - 2) + o;
186
186
  },
187
- easeInOutCirc: function(e, t, o, s, d) {
188
- return (t /= d / 2) < 1 ? -s / 2 * (Math.sqrt(1 - t * t) - 1) + o : s / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + o;
187
+ easeInOutCirc: function(e, t, o, i, f) {
188
+ return (t /= f / 2) < 1 ? -i / 2 * (Math.sqrt(1 - t * t) - 1) + o : i / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + o;
189
189
  }
190
- }), r ? (h("body").on("click", "a:not(.nocg), .href-link, [data-nolink]", (e) => j(e, r)), h("body").on("click", "a:not(.nocg)", function(e) {
190
+ }), r ? (v("body").on("click", "a:not(.nocg), .href-link, [data-nolink]", (e) => j(e, r)), v("body").on("click", "a:not(.nocg)", function(e) {
191
191
  e.stopPropagation();
192
- })) : (h("body").on("click", "a:not(.nocg), .click-block, [data-nolink]", (e) => j(e, r)), h("body").on("click", "a:not(.nocg)", function(e) {
192
+ })) : (v("body").on("click", "a:not(.nocg), .click-block, [data-nolink]", (e) => j(e, r)), v("body").on("click", "a:not(.nocg)", function(e) {
193
193
  e.stopPropagation();
194
- })), h("body").on("mouseenter", "[data-href] a", (e) => X(e)), h("body").on("mouseleave", "[data-href] a", (e) => Y(e));
195
- }, C = {
194
+ })), v("body").on("mouseenter", "[data-href] a", (e) => X(e)), v("body").on("mouseleave", "[data-href] a", (e) => Y(e));
195
+ }, w = {
196
196
  "zh-TW": {
197
197
  format: "格式錯誤",
198
198
  input: "尚未填寫",
@@ -231,7 +231,7 @@ class le {
231
231
  * 綁事件
232
232
  */
233
233
  D(this, T);
234
- this.element = document.querySelector(e), this.allField = this.element.querySelectorAll(`${e} [form-field]`), this.allInput = this.element.querySelectorAll(`${e} input`), this.allTextarea = this.element.querySelectorAll(`${e} textarea`), this.allCheckbox = this.element.querySelectorAll(`${e} input[type="checkbox"]`), this.allRadio = this.element.querySelectorAll(`${e} input[type="radio"]`), this.allFileUpload = this.element.querySelectorAll(`${e} fake-file-upload`), this.allDropdown = this.element.querySelectorAll(`${e} dropdown-el`), this.submitEvent = new Event("submit");
234
+ this.element = document.querySelector(e), this.allField = this.element.querySelectorAll(`${e} [form-field]`), this.allInput = this.element.querySelectorAll(`${e} input`), this.allTextarea = this.element.querySelectorAll(`${e} textarea`), this.allCheckbox = this.element.querySelectorAll(`${e} input[type="checkbox"]`), this.allRadio = this.element.querySelectorAll(`${e} input[type="radio"]`), this.allFileUpload = this.element.querySelectorAll(`${e} .fake-file-upload`), this.allDropdown = this.element.querySelectorAll(`${e} dropdown-el`), this.submitEvent = new Event("submit");
235
235
  const o = {
236
236
  locale: "zh-TW",
237
237
  datepicker: [
@@ -260,13 +260,13 @@ class le {
260
260
  underField: !1,
261
261
  detailOutput: !1
262
262
  }
263
- }, s = (d, p) => {
264
- const f = { ...d };
265
- for (let c of Object.keys(p))
266
- typeof p[c] == "object" && c in d ? f[c] = Array.isArray(f[c]) ? [...p[c]] : s(d[c], p[c]) : f[c] = p[c];
267
- return f;
263
+ }, i = (f, p) => {
264
+ const d = { ...f };
265
+ for (let u of Object.keys(p))
266
+ typeof p[u] == "object" && u in f ? d[u] = Array.isArray(d[u]) ? [...p[u]] : i(f[u], p[u]) : d[u] = p[u];
267
+ return d;
268
268
  };
269
- this.options = t ? s(o, t) : o, this.init();
269
+ this.options = t ? i(o, t) : o, this.init();
270
270
  }
271
271
  init() {
272
272
  var t;
@@ -281,50 +281,50 @@ class le {
281
281
  const e = this;
282
282
  let t = {};
283
283
  return [...e.allField].forEach((o) => {
284
- const s = o.getAttribute("form-field");
284
+ const i = o.getAttribute("form-field");
285
285
  switch (o.getAttribute("field-type")) {
286
286
  case "isRadio":
287
287
  const p = o.querySelector("input:checked");
288
288
  if (!p)
289
289
  return;
290
- const f = p.querySelector('input[type="text"]');
291
- t[s] = {
290
+ const d = p.querySelector('input[type="text"]');
291
+ t[i] = {
292
292
  id: parseInt(p.closest(".option-item").querySelector(".text").getAttribute("data-id")),
293
- value: f ? f.value : p.closest(".option-item").querySelector(".text").textContent
293
+ value: d ? d.value : p.closest(".option-item").querySelector(".text").textContent
294
294
  };
295
295
  break;
296
296
  case "isCheckBox":
297
- const c = o.querySelectorAll("input:checked");
298
- t[s] = [...c].map((u) => {
299
- const l = u.querySelector('input[type="text"]');
297
+ const u = o.querySelectorAll("input:checked");
298
+ t[i] = [...u].map((n) => {
299
+ const a = n.querySelector('input[type="text"]');
300
300
  return {
301
- id: parseInt(u.closest(".option-item").querySelector(".text").getAttribute("data-id")),
302
- value: l ? l.value : u.closest(".option-item").querySelector(".text").textContent
301
+ id: parseInt(n.closest(".option-item").querySelector(".text").getAttribute("data-id")),
302
+ value: a ? a.value : n.closest(".option-item").querySelector(".text").textContent
303
303
  };
304
304
  });
305
305
  break;
306
306
  case "isSelect":
307
307
  switch (o.hasAttribute("multiple") ? "multiple" : "single") {
308
308
  case "single":
309
- t[s] = {
309
+ t[i] = {
310
310
  value: o.s.value.id ? o.s.value.id : "",
311
311
  display: o.s.value.el ? o.s.value.el.textContent : ""
312
312
  };
313
313
  break;
314
314
  case "multiple":
315
- t[s] = {
316
- value: o.s.value.map((u) => u.id),
317
- display: o.s.value.map((u) => u.el.textContent)
315
+ t[i] = {
316
+ value: o.s.value.map((n) => n.id),
317
+ display: o.s.value.map((n) => n.el.textContent)
318
318
  };
319
319
  break;
320
320
  }
321
321
  break;
322
322
  case "isFile":
323
- const i = o.closest(".file-wrap").querySelector(".fake-file-upload input");
324
- t[s] = i ? i.files : void 0;
323
+ const s = o.closest(".file-wrap").querySelector(".fake-file-upload input");
324
+ t[i] = s ? s.files : void 0;
325
325
  break;
326
326
  default:
327
- t[s] = o.value;
327
+ t[i] = o.value;
328
328
  break;
329
329
  }
330
330
  }), t;
@@ -335,115 +335,115 @@ class le {
335
335
  * @returns
336
336
  */
337
337
  verify(e) {
338
- var f;
339
- const t = this, { options: o } = t, s = t.element.value, d = e || s;
340
- function p(c) {
341
- var i, u, l, n;
342
- const a = '<div class="validation-icon"></div>';
343
- for (const g in c) {
344
- const x = t.element.querySelector(`[form-field="${g}"]`), L = x.getAttribute("data-verify"), m = x.closest(".form-group");
338
+ var d;
339
+ const t = this, { options: o } = t, i = t.element.value, f = e || i;
340
+ function p(u) {
341
+ var s, n, a, c;
342
+ const l = '<div class="validation-icon"></div>';
343
+ for (const b in u) {
344
+ const x = t.element.querySelector(`[form-field="${b}"]`), L = x.getAttribute("data-verify"), y = x.closest(".form-group");
345
345
  switch (L) {
346
346
  case "select":
347
- const E = x.querySelector(".select-wrapper"), y = E.querySelector(".dropdown-icon");
348
- (i = E.querySelector(".validation-icon")) == null || i.remove(), E.insertBefore(q(a), y);
347
+ const C = x.querySelector(".select-wrapper"), m = C.querySelector(".dropdown-icon");
348
+ (s = C.querySelector(".validation-icon")) == null || s.remove(), C.insertBefore(q(l), m);
349
349
  break;
350
350
  case "radio":
351
351
  case "checkbox":
352
- (u = m.querySelector(".validation-icon")) == null || u.remove(), m.append(q(a));
352
+ (n = y.querySelector(".validation-icon")) == null || n.remove(), y.append(q(l));
353
353
  break;
354
354
  case "file":
355
- const v = x.closest(".file-wrap").querySelector(".fake-file-upload"), k = x.closest(".file-wrap").querySelector(".upload-icon");
356
- (l = v.querySelector(".validation-icon")) == null || l.remove(), k ? v.insertBefore(q(a), k) : v.append(q(a));
355
+ const h = x.closest(".file-wrap").querySelector(".fake-file-upload"), g = x.closest(".file-wrap").querySelector(".upload-icon");
356
+ (a = h.querySelector(".validation-icon")) == null || a.remove(), g ? h.insertBefore(q(l), g) : h.append(q(l));
357
357
  break;
358
358
  case "date":
359
359
  case "textarea":
360
360
  default:
361
- (n = x.closest(".input-wrap").querySelector(".validation-icon")) == null || n.remove(), x.closest(".input-wrap").append(q(a));
361
+ (c = x.closest(".input-wrap").querySelector(".validation-icon")) == null || c.remove(), x.closest(".input-wrap").append(q(l));
362
362
  break;
363
363
  }
364
364
  }
365
365
  }
366
- if (p(d), e) {
367
- const c = Object.keys(d)[0];
368
- t.element.querySelectorAll(`.error-text[name="${c}"]`).forEach((a) => a.remove());
366
+ if (p(f), e) {
367
+ const u = Object.keys(f)[0];
368
+ t.element.querySelectorAll(`.error-text[name="${u}"]`).forEach((l) => l.remove());
369
369
  } else
370
- t.element.querySelectorAll(".error-text").forEach((c) => c.remove());
371
- for (const c in d) {
372
- let m = function(v, k, S) {
373
- const b = t.element.querySelector(`[form-field="${c}"]`), $ = [...t.element.querySelectorAll("[form-field]")].indexOf(b), A = (F) => `<p class="error-text" name="${c}" index="${$}">${u} - ${C[o.locale][F]}</p>`;
374
- switch (k) {
370
+ t.element.querySelectorAll(".error-text").forEach((u) => u.remove());
371
+ for (const u in f) {
372
+ let y = function(h, g, S) {
373
+ const k = t.element.querySelector(`[form-field="${u}"]`), $ = [...t.element.querySelectorAll("[form-field]")].indexOf(k), E = (F) => `<p class="error-text" name="${u}" index="${$}">${n} - ${w[o.locale][F]}</p>`;
374
+ switch (g) {
375
375
  case "underField":
376
376
  if (!o.errorText.underField)
377
377
  return;
378
- S.append(q(A(v)));
378
+ S.append(q(E(h)));
379
379
  break;
380
380
  case "detail":
381
381
  if (!S)
382
382
  return;
383
- S.append(q(A(v)));
383
+ S.append(q(E(h)));
384
384
  break;
385
385
  }
386
- }, E = function() {
387
- const v = t.detailOutputEl.querySelectorAll(".error-text");
388
- [...v].length > 0 ? t.element.classList.add("something-wrong") : t.element.classList.remove("something-wrong");
389
- const k = [...v].sort((S, b) => S.getAttribute("index") - b.getAttribute("index"));
390
- t.detailOutputEl && (t.detailOutputEl.textContent = ""), k.forEach((S) => {
391
- var b;
392
- return (b = t.detailOutputEl) == null ? void 0 : b.appendChild(S);
386
+ }, C = function() {
387
+ const h = t.detailOutputEl.querySelectorAll(".error-text");
388
+ [...h].length > 0 ? t.element.classList.add("something-wrong") : t.element.classList.remove("something-wrong");
389
+ const g = [...h].sort((S, k) => S.getAttribute("index") - k.getAttribute("index"));
390
+ t.detailOutputEl && (t.detailOutputEl.textContent = ""), g.forEach((S) => {
391
+ var k;
392
+ return (k = t.detailOutputEl) == null ? void 0 : k.appendChild(S);
393
393
  });
394
394
  };
395
- const a = t.element.querySelector(`[form-field="${c}"]`), i = a.closest(".form-group"), u = (f = i.querySelector(".subject")) == null ? void 0 : f.textContent, l = a.getAttribute("data-verify"), n = () => typeof s[c] == "object" && !Array.isArray(s[c]) ? l === "file" ? s[c] : s[c].value : s[c], g = () => l === "file" ? n() === void 0 ? !0 : n() && n().length === 0 : Array.isArray(n()) && n().length === 0 || !Array.isArray(n()) && w.isEmpty(n()), x = () => l === "file" ? n() === void 0 ? !1 : n() && n().length > 0 : Array.isArray(n()) && n().length > 0 || !Array.isArray(n()) && !w.isEmpty(n()), L = i.classList.contains("required");
396
- let y;
397
- if (L && g())
398
- switch (a.classList.remove("success"), a.classList.add("error"), i.classList.add("error"), l) {
395
+ const l = t.element.querySelector(`[form-field="${u}"]`), s = l.closest(".form-group"), n = (d = s.querySelector(".subject")) == null ? void 0 : d.textContent, a = l.getAttribute("data-verify"), c = () => typeof i[u] == "object" && !Array.isArray(i[u]) ? a === "file" ? i[u] : i[u].value : i[u], b = () => a === "file" ? c() === void 0 ? !0 : c() && c().length === 0 : Array.isArray(c()) && c().length === 0 || !Array.isArray(c()) && A.isEmpty(c()), x = () => a === "file" ? c() === void 0 ? !1 : c() && c().length > 0 : Array.isArray(c()) && c().length > 0 || !Array.isArray(c()) && !A.isEmpty(c()), L = s.classList.contains("required");
396
+ let m;
397
+ if (L && b())
398
+ switch (l.classList.remove("success"), l.classList.add("error"), s.classList.add("error"), a) {
399
399
  case "select":
400
- y = a.querySelector(".validation-icon"), y.setAttribute("error-text", C[o.locale].select), m("select", "underField", i.parentNode), m("select", "detail", t.detailOutputEl);
400
+ m = l.querySelector(".validation-icon"), m.setAttribute("error-text", w[o.locale].select), y("select", "underField", s.parentNode), y("select", "detail", t.detailOutputEl);
401
401
  break;
402
402
  case "radio":
403
403
  case "checkbox":
404
- y = i.querySelector(".validation-icon"), y.setAttribute("error-text", C[o.locale].select), m("select", "underField", i.parentNode), m("select", "detail", t.detailOutputEl);
404
+ m = s.querySelector(".validation-icon"), m.setAttribute("error-text", w[o.locale].select), y("select", "underField", s.parentNode), y("select", "detail", t.detailOutputEl);
405
405
  break;
406
406
  case "file":
407
- y = a.closest(".file-wrap").querySelector(".validation-icon"), y.setAttribute("error-text", C[o.locale].file), m("file", "underField", i.parentNode), m("file", "detail", t.detailOutputEl);
407
+ m = l.closest(".file-wrap").querySelector(".validation-icon"), m.setAttribute("error-text", w[o.locale].file), y("file", "underField", s.parentNode), y("file", "detail", t.detailOutputEl);
408
408
  break;
409
409
  default:
410
- y = a.closest(".input-wrap").querySelector(".validation-icon"), y.setAttribute("error-text", C[o.locale].input), m("input", "underField", i.parentNode), m("input", "detail", t.detailOutputEl);
410
+ m = l.closest(".input-wrap").querySelector(".validation-icon"), m.setAttribute("error-text", w[o.locale].input), y("input", "underField", s.parentNode), y("input", "detail", t.detailOutputEl);
411
411
  break;
412
412
  }
413
413
  if (x()) {
414
- let v = function(k, S) {
415
- const b = k.closest(".form-group");
416
- k.classList.toggle("error", !S), k.classList.toggle("success", S);
417
- const A = k.getAttribute("data-verify") === "phone" ? b.querySelector("*:not(input)[form-field]") : b.querySelector("*:not(dropdown-el)[form-field]"), F = !!A, I = k.classList.contains("success"), B = k.classList.contains("error"), M = A == null ? void 0 : A.classList.contains("success"), N = A == null ? void 0 : A.classList.contains("error");
418
- F ? M && !N && I ? (b.classList.remove("error"), b.classList.add("success")) : (N || B) && (b.classList.remove("success"), b.classList.add("error")) : I ? (b.classList.remove("error"), b.classList.add("success")) : (b.classList.add("error"), b.classList.remove("success"));
414
+ let h = function(g, S) {
415
+ const k = g.closest(".form-group");
416
+ g.classList.toggle("error", !S), g.classList.toggle("success", S);
417
+ const E = g.getAttribute("data-verify") === "phone" ? k.querySelector("*:not(input)[form-field]") : k.querySelector("*:not(dropdown-el)[form-field]"), F = !!E, I = g.classList.contains("success"), U = g.classList.contains("error"), B = E == null ? void 0 : E.classList.contains("success"), N = E == null ? void 0 : E.classList.contains("error");
418
+ F ? B && !N && I ? (k.classList.remove("error"), k.classList.add("success")) : (N || U) && (k.classList.remove("success"), k.classList.add("error")) : I ? (k.classList.remove("error"), k.classList.add("success")) : (k.classList.add("error"), k.classList.remove("success"));
419
419
  };
420
- switch (l) {
420
+ switch (a) {
421
421
  case "phone":
422
- const k = i.querySelector("dropdown-el");
423
- w.isMobilePhone(n()) ? (v(a, !0), k && k.classList.contains("success") && (i.classList.remove("error"), i.classList.add("success"))) : (v(a, !1), y = a.closest(".input-wrap").querySelector(".validation-icon"), y.setAttribute("error-text", C[o.locale].format), m("format", "underField", i.parentNode), m("format", "detail", t.detailOutputEl));
422
+ const g = s.querySelector("dropdown-el");
423
+ A.isMobilePhone(c()) ? (h(l, !0), g && g.classList.contains("success") && (s.classList.remove("error"), s.classList.add("success"))) : (h(l, !1), m = l.closest(".input-wrap").querySelector(".validation-icon"), m.setAttribute("error-text", w[o.locale].format), y("format", "underField", s.parentNode), y("format", "detail", t.detailOutputEl));
424
424
  break;
425
425
  case "password":
426
- w.isStrongPassword(n(), {
426
+ A.isStrongPassword(c(), {
427
427
  minLength: 8,
428
428
  minLowercase: 1,
429
429
  minUppercase: 0,
430
430
  minNumbers: 1,
431
431
  minSymbols: 0
432
- }) ? v(a, !0) : (v(a, !1), y = a.closest(".input-wrap").querySelector(".validation-icon"), y.setAttribute("error-text", C[o.locale].format), m("format", "underField", i.parentNode), m("format", "detail", t.detailOutputEl));
432
+ }) ? h(l, !0) : (h(l, !1), m = l.closest(".input-wrap").querySelector(".validation-icon"), m.setAttribute("error-text", w[o.locale].format), y("format", "underField", s.parentNode), y("format", "detail", t.detailOutputEl));
433
433
  break;
434
434
  case "email":
435
- w.isEmail(n()) ? v(a, !0) : (v(a, !1), y = a.closest(".input-wrap").querySelector(".validation-icon"), y.setAttribute("error-text", C[o.locale].format), m("format", "underField", i.parentNode), m("format", "detail", t.detailOutputEl));
435
+ A.isEmail(c()) ? h(l, !0) : (h(l, !1), m = l.closest(".input-wrap").querySelector(".validation-icon"), m.setAttribute("error-text", w[o.locale].format), y("format", "underField", s.parentNode), y("format", "detail", t.detailOutputEl));
436
436
  break;
437
437
  case "verifyCode":
438
- w.isNumeric(n(), { no_symbols: !0 }) && w.isLength(n(), { min: 4, max: 4 }) ? v(a, !0) : (v(a, !1), y = a.closest(".input-wrap").querySelector(".validation-icon"), y.setAttribute("error-text", C[o.locale].format), m("format", "underField", i.parentNode), m("format", "detail", t.detailOutputEl));
438
+ A.isNumeric(c(), { no_symbols: !0 }) && A.isLength(c(), { min: 4, max: 4 }) ? h(l, !0) : (h(l, !1), m = l.closest(".input-wrap").querySelector(".validation-icon"), m.setAttribute("error-text", w[o.locale].format), y("format", "underField", s.parentNode), y("format", "detail", t.detailOutputEl));
439
439
  break;
440
440
  case "select":
441
441
  default:
442
- v(a, !0);
442
+ h(l, !0);
443
443
  break;
444
444
  }
445
445
  }
446
- t.detailOutputEl && E();
446
+ t.detailOutputEl && C();
447
447
  }
448
448
  }
449
449
  /**
@@ -457,96 +457,99 @@ class le {
457
457
  * 清除表單所有欄位
458
458
  */
459
459
  clear() {
460
- const e = this, { allInput: t, allTextarea: o, allCheckbox: s, allFileUpload: d, allDropdown: p } = e;
461
- [...e.allField].forEach((f) => {
462
- var a;
463
- const c = f.closest(".form-group");
464
- c.classList.remove("success"), c.classList.remove("error"), f.classList.remove("success"), f.classList.remove("error"), (a = f.closest(".form-grid").querySelector(".error-text")) == null || a.remove(), e.detailOutputEl && (e.detailOutputEl.textContent = "");
465
- }), [...t].forEach((f) => {
466
- f.value = "";
467
- }), [...o].forEach((f) => {
468
- f.value = "";
469
- }), [...s].forEach((f) => {
470
- f.checked = !1;
471
- }), [...d].forEach((f) => {
472
- let c = f.getAttribute("data-default");
473
- const a = c.querySelector(".file-name");
474
- a.classList.remove("is-upload"), a.textContent = c;
475
- }), [...p].forEach((f) => {
476
- f.setAttribute("d4-value", ""), f.hasAttribute("control-elements") && [...f.getAttribute("control-elements").split(",")].forEach((a) => {
477
- document.querySelector(a).classList.remove("disabled");
460
+ const e = this, { allInput: t, allTextarea: o, allCheckbox: i, allFileUpload: f, allDropdown: p } = e;
461
+ [...e.allField].forEach((d) => {
462
+ var l;
463
+ const u = d.closest(".form-group");
464
+ u.classList.remove("success"), u.classList.remove("error"), d.classList.remove("success"), d.classList.remove("error"), (l = d.closest(".form-grid").querySelector(".error-text")) == null || l.remove(), e.detailOutputEl && (e.detailOutputEl.textContent = "");
465
+ }), [...t].forEach((d) => {
466
+ d.value = "";
467
+ }), [...o].forEach((d) => {
468
+ d.value = "";
469
+ }), [...i].forEach((d) => {
470
+ d.checked = !1;
471
+ }), [...f].forEach((d) => {
472
+ let u = d.getAttribute("data-default");
473
+ const l = d.querySelector(".file-name"), s = d.querySelector('input[type="file"]');
474
+ l.classList.remove("is-upload"), l.textContent = u, s && (s.value = "");
475
+ }), [...p].forEach((d) => {
476
+ d.setAttribute("d4-value", ""), d.hasAttribute("control-elements") && [...d.getAttribute("control-elements").split(",")].forEach((l) => {
477
+ document.querySelector(l).classList.remove("disabled");
478
478
  });
479
479
  }), e.element.value = e.getValue();
480
480
  }
481
481
  }
482
482
  T = new WeakSet(), P = function() {
483
- const e = this, { datepicker: t, timepicker: o, clearEl: s, submitEl: d } = e.options;
483
+ const e = this, { datepicker: t, timepicker: o, clearEl: i, submitEl: f } = e.options;
484
484
  function p() {
485
- t.forEach((i) => {
486
- _(i.el, i.options);
487
- }), o.forEach((i) => {
488
- _(i.el, i.options);
485
+ t.forEach((s) => {
486
+ _(s.el, s.options);
487
+ }), o.forEach((s) => {
488
+ _(s.el, s.options);
489
489
  });
490
490
  }
491
- function f() {
492
- const i = document.querySelector(s), u = document.querySelector(d);
493
- i == null || i.addEventListener("click", function() {
491
+ function d() {
492
+ const s = document.querySelector(i), n = document.querySelector(f);
493
+ s == null || s.addEventListener("click", function() {
494
494
  e.clear();
495
- }), u == null || u.addEventListener("click", function() {
495
+ }), n == null || n.addEventListener("click", function() {
496
496
  e.submit();
497
497
  });
498
498
  }
499
- function c(i) {
500
- var y;
501
- const u = i.closest(".form-group");
502
- if (i.files.length <= 0)
499
+ function u(s) {
500
+ var g;
501
+ const n = s.closest(".form-group");
502
+ if (s.files.length <= 0)
503
503
  return;
504
- const l = i.closest(".file-wrap").querySelector(".fake-file-upload");
505
- l.getAttribute("data-default");
506
- const n = l.querySelector(".file-name"), g = Number(i.getAttribute("data-limit")), x = i.files[0], L = x.size / 1024 / 1024, m = x.name, E = i.cloneNode(!0);
507
- L > g ? (u.classList.add("error"), u.classList.remove("success"), E.value = "") : (u.classList.remove("error"), u.classList.add("success")), n.textContent = m, E.removeAttribute("form-field field-type data-limit"), (y = l.querySelector('input[type="file"]')) == null || y.remove(), l.append(E);
504
+ const a = s.closest(".file-wrap").querySelector(".fake-file-upload"), c = a.getAttribute("data-default"), b = a.querySelector(".file-name"), x = Number(s.getAttribute("data-limit")), L = s.files[0], y = L.size / 1024 / 1024, C = L.name, m = s.cloneNode(!0);
505
+ y > x ? (n.classList.add("error"), n.classList.remove("success"), m.value = "", b.textContent = c) : (n.classList.remove("error"), n.classList.add("success"), b.textContent = C), ["form-field", "field-type", "data-limit"].forEach((S) => {
506
+ m.removeAttribute(S);
507
+ }), (g = a.querySelector('input[type="file"]')) == null || g.remove(), a.append(m);
508
508
  }
509
- function a() {
510
- function i(u) {
511
- const { target: l } = u;
512
- let n, g;
513
- l.matches('[type="radio"], [type="checkbox"]') && (e.element.value = e.getValue(), n = l.closest(".form-check").getAttribute("form-field"), g = {
514
- [n]: e.element.value[n]
515
- }, e.options.verify && e.verify(g)), l.matches('[type="file"]') && (c(l), e.element.value = e.getValue(), n = l.getAttribute("form-field"), g = {
516
- [n]: e.element.value[n]
517
- }, e.options.verify && e.verify(g));
509
+ function l() {
510
+ function s(n) {
511
+ const { target: a } = n;
512
+ let c, b;
513
+ a.matches('[type="radio"], [type="checkbox"]') && (e.element.value = e.getValue(), c = a.closest(".form-check").getAttribute("form-field"), b = {
514
+ [c]: e.element.value[c]
515
+ }, e.options.verify && e.verify(b)), a.matches('[type="file"]') && (u(a), e.element.value = e.getValue(), c = a.getAttribute("form-field"), b = {
516
+ [c]: e.element.value[c]
517
+ }, e.options.verify && e.verify(b));
518
518
  }
519
519
  e.element.addEventListener(
520
520
  "input",
521
- z(function(u) {
522
- const { target: l } = u;
523
- if (l.matches('[type="text"],[type="number"],[type="email"],[type="password"], textarea')) {
524
- if (e.element.value = e.getValue(), !l.closest(".form-group").classList.contains("required") && l.hasAttribute("data-verify")) {
525
- w.isEmpty(l.value) && (l.classList.remove("error"), l.classList.remove("success"), l.closest(".form-group").classList.remove("error"));
521
+ z(function(n) {
522
+ const { target: a } = n;
523
+ if (a.matches('[type="text"],[type="number"],[type="email"],[type="password"], textarea')) {
524
+ if (e.element.value = e.getValue(), !a.closest(".form-group").classList.contains("required") && a.hasAttribute("data-verify")) {
525
+ A.isEmpty(a.value) && (a.classList.remove("error"), a.classList.remove("success"), a.closest(".form-group").classList.remove("error"));
526
526
  return;
527
527
  }
528
- const n = l.getAttribute("form-field"), g = {
529
- [n]: e.element.value[n]
528
+ const c = a.getAttribute("form-field"), b = {
529
+ [c]: e.element.value[c]
530
530
  };
531
- e.options.verify && e.verify(g);
531
+ e.options.verify && e.verify(b);
532
532
  }
533
533
  })
534
- ), e.allCheckbox.forEach((u) => {
535
- u.addEventListener("change", i);
536
- }), e.allRadio.forEach((u) => {
537
- u.addEventListener("change", i);
538
- }), e.allDropdown.forEach((u) => {
539
- u.on("change", function() {
540
- const l = this.getAttribute("form-field");
534
+ ), e.allCheckbox.forEach((n) => {
535
+ n.addEventListener("change", s);
536
+ }), e.allRadio.forEach((n) => {
537
+ n.addEventListener("change", s);
538
+ }), e.allFileUpload.forEach((n) => {
539
+ const a = n.previousElementSibling;
540
+ a && a.matches('input[type="file"]') && a.addEventListener("change", s);
541
+ }), e.allDropdown.forEach((n) => {
542
+ n.on("change", function() {
543
+ const a = this.getAttribute("form-field");
541
544
  e.element.value = e.getValue();
542
- const n = e.element.value[l], g = typeof n == "object" && !Array.isArray(n) ? n.value : n, x = {
543
- [l]: n
545
+ const c = e.element.value[a], b = typeof c == "object" && !Array.isArray(c) ? c.value : c, x = {
546
+ [a]: c
544
547
  };
545
- (Array.isArray(g) && g.length > 0 || !Array.isArray(g) && !w.isEmpty(g)) && e.options.verify && e.verify(x);
548
+ (Array.isArray(b) && b.length > 0 || !Array.isArray(b) && !A.isEmpty(b)) && e.options.verify && e.verify(x);
546
549
  });
547
550
  });
548
551
  }
549
- p(), f(), a();
552
+ p(), d(), l();
550
553
  };
551
554
  export {
552
555
  le as CustomForm,
@@ -564,15 +567,15 @@ export {
564
567
  ve as detectMacOSVersion,
565
568
  W as detectShade,
566
569
  se as errorPage,
567
- C as errorText,
570
+ w as errorText,
568
571
  ge as fixMobile100vh,
569
572
  be as formatFloat,
570
573
  ke as getSlideDataIndex,
571
574
  xe as getSlidesCount,
572
575
  Se as getTransformX,
573
- Ae as getTransformY,
576
+ Ee as getTransformY,
574
577
  q as htmlStringToDOM,
575
- Ee as imagePreview,
578
+ Ae as imagePreview,
576
579
  ie as init,
577
580
  we as isVideo,
578
581
  Ce as letterGrow,