@xwadex/fesd 0.0.14 → 0.0.15

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,3538 @@
1
+ var fs = (n, i, t) => {
2
+ if (!i.has(n))
3
+ throw TypeError("Cannot " + t);
4
+ };
5
+ var h = (n, i, t) => {
6
+ if (i.has(n))
7
+ throw TypeError("Cannot add the same private member more than once");
8
+ i instanceof WeakSet ? i.add(n) : i.set(n, t);
9
+ };
10
+ var d = (n, i, t) => (fs(n, i, "access private method"), t);
11
+ import { OverlayScrollbars as Me } from "overlayscrollbars";
12
+ import v from "jquery";
13
+ import "./vendor-bundle.js";
14
+ import "validator";
15
+ import "flatpickr";
16
+ import Fe from "vanilla-lazyload";
17
+ import { lock as vs, unlock as bs } from "tua-body-scroll-lock";
18
+ const Y = {
19
+ SETTINGS: {
20
+ videoId: null,
21
+ videoType: null,
22
+ videoAutoplay: "off",
23
+ videoMode: "onBox",
24
+ videoButton: ".playButton",
25
+ videoCover: "on",
26
+ videoLayoutNo: 0,
27
+ videoTarget: "video-template",
28
+ videoTargetRoute: "https://cdn.wdd.idv.tw/fesd/video4_lightbox.html",
29
+ videoVimeoHash: null,
30
+ videoHighQuality: "off",
31
+ videoStartTime: 0
32
+ },
33
+ ATTRS: {
34
+ id: "video-id",
35
+ type: "video-type",
36
+ autoplay: "video-autoplay",
37
+ hash: "vimeo-hash",
38
+ start: "video-starttime",
39
+ highquality: "video-highquality"
40
+ },
41
+ EVENTS: {
42
+ init: null,
43
+ afterInit: null,
44
+ beforeDestroy: null,
45
+ afterUpdate: null
46
+ },
47
+ // video4 target 內放置結構 index 對應 videoLayoutNo
48
+ LAYOUT: ['<div class="playButton"></div><div class="overlay"></div>'],
49
+ // videoPlayer customElements 內結構
50
+ TEMPLATE() {
51
+ return '<div class="player-container"><div class="player-wrapper"></div></div>';
52
+ }
53
+ }, ys = {
54
+ SETTINGS: {
55
+ success: null,
56
+ text: null,
57
+ className: null,
58
+ duration: 1500
59
+ }
60
+ }, I = {
61
+ SETTINGS: {
62
+ target: null,
63
+ route: null,
64
+ action: "toggle",
65
+ container: "body"
66
+ },
67
+ ATTRS: {
68
+ id: "data-modal-id",
69
+ close: "data-modal-close",
70
+ destroy: "data-modal-destroy"
71
+ },
72
+ EVENTS: {
73
+ init: null,
74
+ success: null,
75
+ error: null,
76
+ complete: null,
77
+ open: null,
78
+ close: null,
79
+ destroy: null,
80
+ update: null
81
+ },
82
+ TEMPLATE(n) {
83
+ return `
84
+ <div class="modal-scroller">
85
+ <div class="modal-wrapper" ${n === "destroy" ? "data-modal-destroy" : "data-modal-close"}>
86
+ <div class="modal-content" stop-propagation>
87
+ </div>
88
+ </div>
89
+ `;
90
+ }
91
+ }, $ = {
92
+ SETTINGS: {
93
+ direction: "left",
94
+ // 方向 - top || right || bottom || left
95
+ behavior: "normal",
96
+ // 模式 - normal || alternate || endStop
97
+ duration: 5e4,
98
+ // 持續時間(毫秒) - Number
99
+ durationBreakpoints: {},
100
+ // 持續時間斷點 - Object
101
+ autoplay: 300,
102
+ // 自動撥放延遲時間(毫秒) - Number || false
103
+ pauseOnMouseenter: !1,
104
+ // 滑鼠移入暫停 - Boolean
105
+ continual: !0,
106
+ // 連續不間斷 - Boolean
107
+ gap: 30
108
+ // 跑馬燈內容之間的距離 - Number
109
+ }
110
+ }, qe = {
111
+ SETTINGS: {
112
+ scrollbar: {
113
+ "scrollbar-track-color": "transparent",
114
+ "scrollbar-thumb-color": "rgba(0,0,0,.4)",
115
+ "scrollbar-thumb-hover-color": "rgba(0,0,0,.55)",
116
+ "scrollbar-radius": "10px"
117
+ }
118
+ },
119
+ TEMPLATE(n, i, t, e) {
120
+ const o = `
121
+ <i class="${e || "dropdown-icon"}"></i>
122
+ `, a = `
123
+ <div class="filter-bar">
124
+ <input class="filter-input" type="text" placeholder="${i}" disabled>
125
+ </div>
126
+ `, r = `<div class="select-wrapper">
127
+ <div class="select-display"></div>
128
+ ${o}
129
+ <div class="dropdown">
130
+ ${n ? a : ""}
131
+ <div class="dropdown-scroller">
132
+ <ul class="dropdown-list"></ul>
133
+ </div>
134
+ </div>
135
+ </div>`;
136
+ return t || r;
137
+ }
138
+ }, ws = {
139
+ SETTINGS: {
140
+ basic_rwd: 900
141
+ }
142
+ }, Ye = {
143
+ SETTINGS: {
144
+ scroller: window,
145
+ class: "aost-show",
146
+ delay: 0,
147
+ start: 80,
148
+ end: 0,
149
+ mirror: !1,
150
+ repeat: !1,
151
+ // false | true | 'up' | 'down'
152
+ direction: "vertical",
153
+ // 'vertical' | 'horizontal'
154
+ breakpoints: {
155
+ 1160: "data-aost-offset-1160",
156
+ 1024: "data-aost-offset-1024",
157
+ 600: "data-aost-offset-600"
158
+ }
159
+ },
160
+ EVENTS: {
161
+ init: null,
162
+ enter: null,
163
+ leave: null
164
+ }
165
+ }, lt = {
166
+ SETTINGS: {
167
+ target: null,
168
+ container: null,
169
+ spacer: null,
170
+ gap: 0,
171
+ speed: 800,
172
+ delay: 0,
173
+ direction: "vertical",
174
+ easing: "easeInOutCirc"
175
+ },
176
+ EVENTS: {
177
+ afterInit: null,
178
+ beforeDestroy: null,
179
+ afterUpdate: null,
180
+ beforeScroll: null,
181
+ afterScroll: null
182
+ }
183
+ }, C = {
184
+ SETTINGS: {
185
+ type: "drag",
186
+ drag: {
187
+ center: !0,
188
+ draggable: !0,
189
+ navigation: !0,
190
+ selected: !1
191
+ },
192
+ collapse: {
193
+ selected: !1,
194
+ placeholder: "類別"
195
+ },
196
+ dropdown: {
197
+ target: "dropdown-el",
198
+ placeholder: "",
199
+ value: ""
200
+ },
201
+ breakpoint: {}
202
+ },
203
+ TEMPLATE: {
204
+ drag() {
205
+ return `<div class="drag-container">
206
+ <ul class="wrapper">
207
+ </ul>
208
+ </div>`;
209
+ },
210
+ collapse(n) {
211
+ return `<div class="drag-container">
212
+ <ul class="wrapper">
213
+ </ul>
214
+ <div class="collapse-placeholder">${n.placeholder}</div>
215
+ </div>
216
+ <div class="collapse-container">
217
+ <ul class="wrapper">
218
+ </ul>
219
+ </div>`;
220
+ },
221
+ dropdown(n) {
222
+ return `<dropdown-el${n.placeholder ? ` d4-placeholder="${n.placeholder}"` : ""}${n.value ? ` d4-value="${n.value}"` : ""}></dropdown-el>`;
223
+ }
224
+ }
225
+ }, Ue = {
226
+ SETTINGS: {
227
+ // 樣式 normal / process
228
+ type: "normal",
229
+ // 進場方式 fade / slide
230
+ display: "fade",
231
+ // 預設頁面
232
+ defaultPage: "",
233
+ // 滑動扣除高度
234
+ anchorGap: 0,
235
+ tabGroup: "true",
236
+ // 動畫設定
237
+ transition: {
238
+ duration: 500,
239
+ timing: "ease",
240
+ delay: 0
241
+ },
242
+ // 步驟狀態綁定
243
+ stepOutput: ".step-show"
244
+ }
245
+ }, Je = {
246
+ SETTINGS: {
247
+ collapseClass: "collapse",
248
+ block: "[collapse-block]",
249
+ target: "[collapse-target]",
250
+ single: !0,
251
+ defaultOpen: !1,
252
+ targetStopPropagation: !1,
253
+ defaultActiveMark: "collapse-active",
254
+ transition: {
255
+ property: "height",
256
+ duration: "400ms",
257
+ function: "ease",
258
+ delay: "0s"
259
+ },
260
+ // expand
261
+ breakpoints: {
262
+ 320: {}
263
+ }
264
+ },
265
+ // ATTRS: {
266
+ // wrapper: 'collapse-wrapper',
267
+ // block: 'collapse-block',
268
+ // target: 'collapse-target',
269
+ // },
270
+ EVENTS: {
271
+ init: null,
272
+ afterInit: null,
273
+ destroy: null,
274
+ beforeDestroy: null,
275
+ update: null,
276
+ afterUpdate: null
277
+ }
278
+ }, Ze = {
279
+ SETTINGS: {
280
+ // 是否要加 hover 效果?
281
+ hover: !0,
282
+ // 使用 hover 時是否要啟用點擊 ripple 效果?
283
+ click: !1,
284
+ // ripple's 的顏色
285
+ color: "#fff",
286
+ // ripple's 透明度
287
+ opacity: "1",
288
+ // ripple 毫秒
289
+ duration: 600,
290
+ // hover 毫秒 ?
291
+ speed: 600
292
+ }
293
+ }, mn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
294
+ __proto__: null,
295
+ anchor4: lt,
296
+ aost4: Ye,
297
+ article4: ws,
298
+ collapse4: Je,
299
+ dropdown4: qe,
300
+ marquee4: $,
301
+ modal4: I,
302
+ multipurpose4: C,
303
+ ripple4: Ze,
304
+ share4: ys,
305
+ tab4: Ue,
306
+ video4: Y
307
+ }, Symbol.toStringTag, { value: "Module" })), E = {
308
+ before: "beforebegin",
309
+ after: "afterend",
310
+ append: "beforeend",
311
+ prepend: "afterbegin"
312
+ }, at = (n) => typeof n == "string" && n !== "", ye = (n) => n instanceof HTMLElement, rt = (n) => n instanceof NodeList, w = (n) => A(n) !== null, j = (n) => typeof n == "function", A = (n) => ye(n) ? n : document.querySelector(n), L = (n) => rt(n) ? n : document.querySelectorAll(n), Ts = () => Math.random().toString(36).substr(2, 9), Es = (n) => {
313
+ const i = document.createElement("div");
314
+ return i.innerHTML = n, i.childNodes;
315
+ }, As = (n) => {
316
+ try {
317
+ JSON.parse(n);
318
+ } catch {
319
+ return n;
320
+ }
321
+ return JSON.parse(n);
322
+ }, T = (n, i) => {
323
+ console.warn(`[${n} warn]: ${i}`);
324
+ }, je = (n, i) => {
325
+ console.error(`[${n} error]: ${i}`);
326
+ }, O = {
327
+ on(n, i) {
328
+ if (!j(i))
329
+ return this;
330
+ const { __events__: t } = this;
331
+ return n.split(" ").forEach((e) => {
332
+ t[e] || (t[e] = []), t[e].push(i);
333
+ }), this;
334
+ },
335
+ off(n, i) {
336
+ const { __events__: t } = this;
337
+ return n.split(" ").forEach((e) => {
338
+ typeof i > "u" ? t[e] = [] : t[e] && t[e].forEach((s, o) => {
339
+ s === i && t[e].splice(o, 1);
340
+ });
341
+ }), this;
342
+ },
343
+ once(n, i) {
344
+ if (!j(i))
345
+ return this;
346
+ const t = (...e) => {
347
+ this.off(n, t), i.apply(this, e);
348
+ };
349
+ return this.on(n, t);
350
+ },
351
+ emit(...n) {
352
+ const { __events__: i } = this, t = n[0], e = n.slice(1, n.length);
353
+ return i[t] ? (i[t].forEach((s) => {
354
+ j(s) && s.apply(this, e);
355
+ }), this) : this;
356
+ }
357
+ }, Ls = {
358
+ easeInOutCirc(n, i, t, e) {
359
+ return (n /= e / 2) < 1 ? -t / 2 * (Math.sqrt(1 - n * n) - 1) + i : t / 2 * (Math.sqrt(1 - (n -= 2) * n) + 1) + i;
360
+ },
361
+ easeInQuart(n, i, t, e) {
362
+ return t * (n /= e) * n * n * n + i;
363
+ },
364
+ easeOutQuart(n, i, t, e) {
365
+ return -t * ((n = n / e - 1) * n * n * n - 1) + i;
366
+ }
367
+ }, we = (n, i) => {
368
+ const { target: t, container: e, spacer: s, speed: o, gap: a, easing: r, direction: l } = n, c = l === "horizontal", u = c ? "scrollLeft" : "scrollTop", p = c ? "left" : "top", g = c ? "width" : "height", m = w(e) ? A(e) : document.scrollingElement, f = m[u], b = w(t) ? A(t).getBoundingClientRect()[p] : 0 - f, y = w(s) ? A(s).getBoundingClientRect()[g] : 0, H = b - a - y, G = 15;
369
+ let S = 0;
370
+ if (H === 0)
371
+ return;
372
+ const R = (X) => {
373
+ const Ne = A(t);
374
+ i && i.emit(X, Ne), !i && n.on && j(n.on[X]) && n.on[X](Ne);
375
+ };
376
+ R("beforeScroll");
377
+ const Pe = () => {
378
+ S += G;
379
+ const X = Ls[r](S, f, H, o);
380
+ m[u] = X, S < o && requestAnimationFrame(Pe), S >= o && R("afterScroll");
381
+ };
382
+ requestAnimationFrame(Pe);
383
+ };
384
+ var J, Ee, pt, Ve, mt, Ke;
385
+ class Qe {
386
+ constructor(i, t = {}) {
387
+ h(this, J);
388
+ h(this, pt);
389
+ h(this, mt);
390
+ this.__storage__ = {
391
+ el: i,
392
+ options: t
393
+ }, this.active = "data-anchor-active", d(this, J, Ee).call(this);
394
+ }
395
+ destroy() {
396
+ const { elements: i } = this;
397
+ return this.emit("beforeDestroy"), i.forEach((t) => {
398
+ t.anchor && (t.removeEventListener("click", t.anchor.eventHandler), delete t.anchor);
399
+ }), this;
400
+ }
401
+ update() {
402
+ var i;
403
+ return d(i = this.destroy(), J, Ee).call(i), this.emit("afterUpdate"), this;
404
+ }
405
+ static run(i) {
406
+ const { SETTINGS: t } = lt, e = Object.assign({}, t, i);
407
+ setTimeout(() => {
408
+ we(e);
409
+ }, e.delay);
410
+ }
411
+ static url(i) {
412
+ const { SETTINGS: t } = lt, { hashName: e } = i, s = window.location.search || window.location.hash, { searchParams: o } = new URL(window.location), a = document.querySelector(`[data-anchor-id="${e ? o.get(e) : s.split("?").pop()}"]`);
413
+ if (!a)
414
+ return;
415
+ const r = Object.assign({}, t, i, { target: a });
416
+ setTimeout(() => {
417
+ we(r);
418
+ }, r.delay);
419
+ }
420
+ }
421
+ J = new WeakSet(), Ee = function() {
422
+ const { el: i, options: t } = this.__storage__;
423
+ if (!at(i) || !w(i))
424
+ return;
425
+ const { SETTINGS: e, EVENTS: s } = lt;
426
+ if (this.elements = t.state == "not active" ? L(i + `:not([${this.active}])`) : L(i), this.elements = L(i), this.options = Object.assign({}, e, t), this.__events__ = Object.assign({}, s), this.options.on)
427
+ for (const [o, a] of Object.entries(this.options.on))
428
+ this.__events__[o] = [a];
429
+ d(this, pt, Ve).call(this);
430
+ }, pt = new WeakSet(), Ve = function() {
431
+ const { elements: i, options: t } = this;
432
+ i.forEach((e) => {
433
+ e.anchor = {}, e.anchor.instance = this, e.anchor.eventHandler = d(this, mt, Ke), e.anchor.defaultOptions = t, e.anchor.methods = {}, e.anchor.methods.destroy = this.destroy, e.anchor.methods.update = this.update, e.addEventListener("click", e.anchor.eventHandler), e.setAttribute(this.active, "");
434
+ }), this.emit("afterInit");
435
+ }, mt = new WeakSet(), Ke = function() {
436
+ const { defaultOptions: i, eventHandler: t, instance: e } = this.anchor, s = {
437
+ target: this.getAttribute("data-anchor-target") || i.target,
438
+ container: this.getAttribute("data-anchor-container") || i.container,
439
+ spacer: this.getAttribute("data-anchor-spacer") || i.spacer,
440
+ gap: parseInt(this.getAttribute("data-anchor-gap") || i.gap),
441
+ speed: parseInt(this.getAttribute("data-anchor-speed")) || i.speed,
442
+ delay: parseInt(this.getAttribute("data-anchor-delay")) || i.delay,
443
+ easing: this.getAttribute("data-anchor-easing") || i.easing,
444
+ direction: this.getAttribute("data-anchor-direction") || i.direction
445
+ };
446
+ this.removeEventListener("click", t), setTimeout(() => {
447
+ this.addEventListener("click", t);
448
+ }, s.speed), setTimeout(() => {
449
+ we(s, e);
450
+ }, s.delay);
451
+ };
452
+ Object.assign(Qe.prototype, O);
453
+ window.MODALS || (window.MODALS = {});
454
+ const { MODALS: M } = window, Ss = (n) => {
455
+ const { TEMPLATE: i } = I, { childDom: t } = n, e = document.createElement("div");
456
+ e.innerHTML = i(n.getAttribute("data-modal-template-setting"));
457
+ const s = e.querySelector(".modal-content");
458
+ return [...t].forEach((o) => {
459
+ s.append(o);
460
+ }), e.children[0];
461
+ };
462
+ var gt, ei, ft, ii, vt, si, bt, ni, yt, oi;
463
+ class ti extends HTMLElement {
464
+ constructor() {
465
+ super();
466
+ h(this, gt);
467
+ h(this, ft);
468
+ h(this, vt);
469
+ h(this, bt);
470
+ h(this, yt);
471
+ this.initialize = !1;
472
+ }
473
+ static get observedAttributes() {
474
+ return [":state"];
475
+ }
476
+ attributeChangedCallback(t, e, s) {
477
+ switch (t) {
478
+ case ":state":
479
+ d(this, yt, oi).call(this, s);
480
+ break;
481
+ }
482
+ }
483
+ connectedCallback() {
484
+ this.initialize || (this.initialize = !0, d(this, gt, ei).call(this));
485
+ }
486
+ open() {
487
+ return this.setAttribute(":state", "open"), this;
488
+ }
489
+ close() {
490
+ return this.setAttribute(":state", "close"), this;
491
+ }
492
+ destroy() {
493
+ return this.setAttribute(":state", "destroy"), this;
494
+ }
495
+ }
496
+ gt = new WeakSet(), ei = function() {
497
+ const { ATTRS: t } = I;
498
+ this.__events__ = {}, this.getAttribute(":state") || this.setAttribute(":state", "close");
499
+ const e = this.getAttribute(t.id) || Ts();
500
+ this.getAttribute(t.id) || (T(`modern-modal needs a ${t.id} attribute with a unique id.`), this.setAttribute(t.id, e)), M[e] && T(`the ${t.id} "${e}" is already be used.`), M[e] = this, d(this, ft, ii).call(this);
501
+ }, ft = new WeakSet(), ii = function() {
502
+ this.childDom = this.childNodes, this.template = Ss(this), this.innerHTML = "", this.append(this.template), d(this, vt, si).call(this);
503
+ }, vt = new WeakSet(), si = function() {
504
+ const t = this.querySelector(".modal-scroller");
505
+ this.__scroller__ = Me(t, {
506
+ overflowBehavior: {
507
+ x: "hidden"
508
+ },
509
+ autoUpdate: !0
510
+ }), window.modalScroll = this.__scroller__, d(this, bt, ni).call(this);
511
+ }, bt = new WeakSet(), ni = function() {
512
+ var a, r, l;
513
+ const t = this, { ATTRS: e } = I, { close: s, destroy: o } = e;
514
+ (a = t.querySelectorAll(`[${s}]`)) == null || a.forEach((c) => {
515
+ c.addEventListener("click", function() {
516
+ const u = this.getAttribute(s);
517
+ (u && M[u] ? M[u] : t).close();
518
+ });
519
+ }), (r = t.querySelectorAll(`[${o}]`)) == null || r.forEach((c) => {
520
+ c.addEventListener("click", function() {
521
+ const u = this.getAttribute(o);
522
+ (u && M[u] ? M[u] : t).destroy();
523
+ });
524
+ }), (l = t.querySelector("[stop-propagation]")) == null || l.addEventListener("click", function(c) {
525
+ c.stopPropagation();
526
+ });
527
+ }, yt = new WeakSet(), oi = function(t) {
528
+ const { __scroller__: e } = this;
529
+ if (t === "open") {
530
+ if (this.style.display = "block", e) {
531
+ const { viewport: s } = e.elements();
532
+ s.scrollTo({
533
+ top: 0
534
+ });
535
+ }
536
+ setTimeout(() => {
537
+ this.classList.add("show"), this.emit("open");
538
+ }, 100);
539
+ }
540
+ if (t === "close") {
541
+ if (!this.classList.contains("show"))
542
+ return;
543
+ this.classList.remove("show");
544
+ const s = () => {
545
+ this.style.removeProperty("display"), this.emit("close"), this.removeEventListener("transitionend", s);
546
+ };
547
+ this.addEventListener("transitionend", s);
548
+ }
549
+ if (t === "destroy") {
550
+ this.classList.remove("show");
551
+ const s = () => {
552
+ const { ATTRS: o } = I, a = this.getAttribute(o.id);
553
+ this.style.removeProperty("display"), this.emit("close"), this.remove(), this.emit("destroy"), M[a] && delete M[a];
554
+ };
555
+ this.addEventListener("transitionend", s);
556
+ }
557
+ };
558
+ Object.assign(ti.prototype, O);
559
+ const { MODALS: Ie } = window, ai = (n, i, ...t) => {
560
+ if (!i)
561
+ return;
562
+ const e = n[i];
563
+ e && j(e) && e.apply(n, t);
564
+ }, ri = (n, ...i) => {
565
+ n && j(n) && n.apply(U, i);
566
+ }, ze = (n, i) => {
567
+ const { target: t } = n, e = Ie[t] || A(n.target);
568
+ e && li(n, i), e || Ds(n, i);
569
+ }, li = (n, i) => {
570
+ const { target: t, action: e, on: s, e: o } = n, a = Ie[t] || A(n.target);
571
+ switch (["open", "close", "destroy"].forEach((l) => {
572
+ a.once(l, () => {
573
+ i && (i.emit(l, a, o), ai(i, s[l], a, o)), i || ri(s[l], a);
574
+ });
575
+ }), e) {
576
+ case "open":
577
+ a.open();
578
+ break;
579
+ case "close":
580
+ a.close();
581
+ break;
582
+ case "destroy":
583
+ a.destroy();
584
+ break;
585
+ default:
586
+ const l = a.getAttribute(":state");
587
+ l === "close" && a.open(), l === "open" && a.close();
588
+ break;
589
+ }
590
+ }, Ds = async (n, i) => {
591
+ const { target: t, route: e, container: s, on: o, e: a } = n;
592
+ if (!e)
593
+ return T("modal4", "cannot find target or data-modal-route is not defined");
594
+ const r = (l, ...c) => {
595
+ i && (i.emit(l, ...c), ai(i, o[l], ...c)), i || ri(o[l], ...c);
596
+ };
597
+ fetch(e).then((l) => (r("success", a), l.text())).then((l) => {
598
+ const c = Es(l), u = A(s) || A(I.SETTINGS.container);
599
+ [...c].forEach((g) => {
600
+ u.append(g);
601
+ });
602
+ const p = Ie[t] || A(n.target);
603
+ r("complete", p), li(n, i);
604
+ }).catch((l) => {
605
+ r("error", l);
606
+ });
607
+ };
608
+ var Z, Ae, wt, ci, Tt, di;
609
+ const P = class P {
610
+ constructor(i, t = {}) {
611
+ h(this, Z);
612
+ h(this, wt);
613
+ h(this, Tt);
614
+ this.__storage__ = {
615
+ el: i,
616
+ options: t
617
+ }, this.active = "data-modal-active", d(this, Z, Ae).call(this);
618
+ }
619
+ destroy() {
620
+ const { elements: i } = this;
621
+ return i.forEach((t) => {
622
+ t.modal && (t.removeEventListener("click", t.modal.eventHandler), delete t.modal);
623
+ }), this;
624
+ }
625
+ update() {
626
+ var i;
627
+ return d(i = this.destroy(), Z, Ae).call(i), this.emit("update"), this;
628
+ }
629
+ /** static method 'open' */
630
+ static open(i) {
631
+ const { SETTINGS: t } = I, e = Object.assign({}, t, { on: {} }, i);
632
+ ze(e);
633
+ }
634
+ /** static method 'defineMethods' */
635
+ static defineMethods(i) {
636
+ P.prototype.__methods__ || (P.prototype.__methods__ = {});
637
+ const t = P.prototype.__methods__;
638
+ for (const [e, s] of Object.entries(i))
639
+ j(s) && (t[e] = s);
640
+ Object.assign(P.prototype, P.prototype.__methods__);
641
+ }
642
+ };
643
+ Z = new WeakSet(), Ae = function() {
644
+ const { el: i, options: t } = this.__storage__;
645
+ if (!at(i) || !w(i))
646
+ return;
647
+ const { SETTINGS: e, EVENTS: s } = I;
648
+ if (this.elements = t.state == "not active" ? L(i + `:not([${this.active}])`) : L(i), this.options = Object.assign({}, e, t), this.__events__ = Object.assign({}, s), this.options.on)
649
+ for (const [o, a] of Object.entries(this.options.on))
650
+ this.__events__[o] = [a];
651
+ d(this, wt, ci).call(this);
652
+ }, wt = new WeakSet(), ci = function() {
653
+ const { elements: i, options: t } = this;
654
+ i.forEach((e) => {
655
+ e.modal = {}, e.modal.instance = this, e.modal.eventHandler = d(this, Tt, di), e.modal.defaultOptions = t, e.modal.methods = {}, e.modal.methods.destroy = this.destroy, e.modal.methods.update = this.update, e.addEventListener("click", e.modal.eventHandler), e.setAttribute(this.active, "");
656
+ }), this.emit("init");
657
+ }, Tt = new WeakSet(), di = function(i) {
658
+ const { defaultOptions: t, eventHandler: e, instance: s } = this.modal, o = As(this.getAttribute("data-modal-on"));
659
+ o && typeof o != "object" && T("modal4", "data-modal-on must be a json string.");
660
+ const a = {
661
+ target: this.getAttribute("data-modal-target") || t.target,
662
+ action: this.getAttribute("data-modal-action") || t.action,
663
+ route: this.getAttribute("data-modal-route") || t.route,
664
+ container: this.getAttribute("data-modal-container") || t.container,
665
+ on: o && typeof o == "object" ? o : {},
666
+ e: i
667
+ };
668
+ this.removeEventListener("click", e), setTimeout(() => {
669
+ this.addEventListener("click", e);
670
+ }, 200), ze(a, s);
671
+ };
672
+ let U = P;
673
+ Object.assign(U.prototype, O);
674
+ customElements.define("modern-modal", ti);
675
+ const _s = (n, i) => {
676
+ const t = n === window ? n.innerHeight : n.getBoundingClientRect().height, e = n === window ? 0 : n.getBoundingClientRect().top;
677
+ i.forEach((s) => {
678
+ const { class: o, delay: a, start: r, end: l, repeat: c, instance: u } = s.aost, { top: p, bottom: g } = s.getBoundingClientRect(), m = t * (r / 100), f = t * (l / 100);
679
+ if (p - e <= m && g - e >= f && s.offsetParent)
680
+ setTimeout(() => {
681
+ s.classList.add(o);
682
+ }, a);
683
+ else {
684
+ const y = s.classList.contains(o) && c === "down" && p - e >= m || c === "up" && g - e <= f || c === !0;
685
+ setTimeout(() => {
686
+ y && s.classList.remove(o);
687
+ }, a);
688
+ }
689
+ });
690
+ }, ks = (n, i) => n === "up" || n === "down" ? n : n !== null ? n === "true" ? !0 : n === "false" ? !1 : i.repeat : i.repeat;
691
+ var Q, Le, Et, hi;
692
+ class ui {
693
+ constructor(i, t = {}) {
694
+ h(this, Q);
695
+ h(this, Et);
696
+ this.__storage__ = {
697
+ el: i,
698
+ options: t
699
+ }, this.active = "data-aost-active", d(this, Q, Le).call(this);
700
+ }
701
+ destroy(i) {
702
+ const { elements: t, options: e } = this;
703
+ if (!t)
704
+ return this;
705
+ const { scroller: s } = e, o = s === window || !w(s) ? window : A(s);
706
+ return o.aost && (o.removeEventListener("scroll", o.aost.eventHandler), delete o.aost), t.forEach((a) => {
707
+ if (!a.aost)
708
+ return;
709
+ const { class: r } = a.aost;
710
+ i && a.classList.remove(r), delete a.aost;
711
+ }), this;
712
+ }
713
+ update(i) {
714
+ var t;
715
+ d(t = this.destroy(i), Q, Le).call(t);
716
+ }
717
+ }
718
+ Q = new WeakSet(), Le = function() {
719
+ const { el: i, options: t } = this.__storage__;
720
+ if (!at(i) || !w(i))
721
+ return;
722
+ const { SETTINGS: e, EVENTS: s } = Ye;
723
+ if (this.elements = t.state == "not active" ? L(i + `:not([${this.active}])`) : L(i), this.options = Object.assign({}, e, t), this.__events__ = Object.assign({}, s), this.options.on)
724
+ for (const [o, a] of Object.entries(this.options.on))
725
+ this.__events__[o] = [a];
726
+ d(this, Et, hi).call(this);
727
+ }, Et = new WeakSet(), hi = function() {
728
+ const { elements: i, options: t } = this, { scroller: e } = t, s = e === window || !w(e) ? window : A(e);
729
+ this.eventHandler = () => {
730
+ _s(s, i);
731
+ }, i.forEach((a) => {
732
+ a.aost = {}, a.aost.class = a.getAttribute("data-aost-class") || t.class, a.aost.delay = parseInt(a.getAttribute("data-aost-delay")) || t.delay, a.aost.start = parseInt(a.getAttribute("data-aost-start")) || t.start, a.aost.end = parseInt(a.getAttribute("data-aost-end")) || t.end, a.aost.repeat = ks(a.getAttribute("data-aost-repeat"), t), a.aost.methods = {}, a.aost.methods.destroy = this.destroy, a.aost.methods.update = this.update, a.aost.instance = this, a.setAttribute(this.active, "");
733
+ });
734
+ const { eventHandler: o } = this;
735
+ o(), s.aost = {}, s.aost.eventHandler = o, s.addEventListener("scroll", s.aost.eventHandler, !1);
736
+ };
737
+ Object.assign(ui.prototype, O);
738
+ const $s = (n) => {
739
+ const { TEMPLATE: i } = Y, { childDom: t } = n, e = document.createElement("div");
740
+ e.innerHTML = i();
741
+ const s = e.querySelector(".player-wrapper");
742
+ return [...t].forEach((o) => {
743
+ s.append(o);
744
+ }), e.children[0];
745
+ };
746
+ var At, pi, Lt, mi, St, gi, Dt, fi, _t, vi, kt, bi, $t, yi, xt, wi, Ct, Ti;
747
+ class xs extends HTMLElement {
748
+ constructor() {
749
+ super();
750
+ h(this, At);
751
+ h(this, Lt);
752
+ h(this, St);
753
+ // youtube iframe
754
+ h(this, Dt);
755
+ // vimeo iframe
756
+ h(this, _t);
757
+ // youku iframe
758
+ h(this, kt);
759
+ h(this, $t);
760
+ // 2025.02.11 新增 ig
761
+ h(this, xt);
762
+ // 2025.02.11 新增 tiktok
763
+ h(this, Ct);
764
+ d(this, At, pi).call(this);
765
+ }
766
+ play() {
767
+ const { videoType: t } = this;
768
+ switch (t) {
769
+ case "youtubeAPI":
770
+ break;
771
+ case "youtube":
772
+ this.querySelector("iframe").contentWindow.postMessage(JSON.stringify({ event: "command", func: "playVideo" }), "*");
773
+ break;
774
+ case "youkuAPI":
775
+ break;
776
+ case "youku":
777
+ break;
778
+ case "vimeo":
779
+ this.querySelector("iframe").contentWindow.postMessage(JSON.stringify({ value: "true", method: "play" }), "*");
780
+ break;
781
+ }
782
+ }
783
+ pause() {
784
+ const { videoType: t } = this;
785
+ switch (t) {
786
+ case "youtubeAPI":
787
+ break;
788
+ case "youtube":
789
+ this.querySelector("iframe").contentWindow.postMessage(JSON.stringify({ event: "command", func: "pauseVideo" }), "*");
790
+ break;
791
+ case "youkuAPI":
792
+ break;
793
+ case "youku":
794
+ break;
795
+ case "vimeo":
796
+ this.querySelector("iframe").contentWindow.postMessage(JSON.stringify({ value: "true", method: "pause" }), "*");
797
+ break;
798
+ }
799
+ }
800
+ }
801
+ At = new WeakSet(), pi = function() {
802
+ if (!this.getAttribute("video-id")) {
803
+ T("videoPlayer", "video-render needs a ['video-id'] attribute to creat player.");
804
+ return;
805
+ }
806
+ this.videoId = this.getAttribute("video-id"), this.videoType = this.getAttribute("video-type"), this.autoplay = this.getAttribute("video-autoplay"), this.startTime = this.getAttribute("video-starttime"), d(this, Lt, mi).call(this);
807
+ }, Lt = new WeakSet(), mi = function() {
808
+ this.childDom = this.childNodes, this.template = $s(this), this.innerHTML = "", this.append(this.template), d(this, St, gi).call(this);
809
+ }, St = new WeakSet(), gi = function() {
810
+ const { videoType: t } = this;
811
+ let e = "";
812
+ switch (t) {
813
+ case "youtubeAPI":
814
+ break;
815
+ case "youtube":
816
+ e = d(this, Dt, fi).call(this);
817
+ break;
818
+ case "youkuAPI":
819
+ break;
820
+ case "youku":
821
+ e = d(this, kt, bi).call(this);
822
+ break;
823
+ case "vimeo":
824
+ e = d(this, _t, vi).call(this);
825
+ break;
826
+ case "bilibili":
827
+ e = d(this, $t, yi).call(this);
828
+ break;
829
+ case "instagram":
830
+ e = d(this, xt, wi).call(this);
831
+ break;
832
+ case "tiktok":
833
+ e = d(this, Ct, Ti).call(this);
834
+ break;
835
+ }
836
+ this.querySelector(".player-wrapper").insertAdjacentHTML(E.prepend, e);
837
+ }, Dt = new WeakSet(), fi = function() {
838
+ const { videoId: t, autoplay: e, startTime: s } = this;
839
+ return `<iframe src="https://www.youtube.com/embed/${t}?rel=0&${e === "on" ? "autoplay=1" : ""}&start=${s}&mute=1&loop=1&enablejsapi=1" frameborder="0" allowfullscreen="0" volumn="0" allow="${e === "on" ? "autoplay;" : ""} encrypted-media; gyroscope; picture-in-picture;"></iframe>`;
840
+ }, _t = new WeakSet(), vi = function() {
841
+ const { videoId: t, autoplay: e, hash: s } = this;
842
+ return `<iframe src="https://player.vimeo.com/video/${t}?h=${s}&${e === "on" ? "autoplay=1" : ""}&loop=1&color=ffffff&title=0&byline=0&portrait=0" frameborder="0" allow="${e === "on" ? "autoplay;" : ""} fullscreen; picture-in-picture" allowfullscreen></iframe><script src="https://player.vimeo.com/api/player.js"><\/script>`;
843
+ }, kt = new WeakSet(), bi = function() {
844
+ const { videoId: t, autoplay: e } = this;
845
+ return `<iframe src="https://player.youku.com/embed/${t}?rel=0&${e === "on" ? "autoplay=1" : ""}" frameborder=0 "allowfullscreen"></iframe>`;
846
+ }, $t = new WeakSet(), yi = function() {
847
+ const { videoId: t, autoplay: e } = this;
848
+ return `<iframe src="//player.bilibili.com/player.html?bvid=${t}&page=1&as_wide=1&high_quality=1&danmaku=0" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe>`;
849
+ }, xt = new WeakSet(), wi = function() {
850
+ const { videoId: t, autoplay: e } = this;
851
+ return `<iframe class="instagram-media instagram-media-rendered" id="instagram-embed-0" src="https://www.instagram.com/p/${t}/embed/" width="num-w" height=" num-h" scrolling="auto" frameborder="0" data-instgrm-payload-id="instagram-media-payload-0"></iframe>`;
852
+ }, Ct = new WeakSet(), Ti = function() {
853
+ const { videoId: t, autoplay: e } = this;
854
+ return `<iframe name="__tt_embed__v79271677875424740" sandbox="allow-popups allow-popups-to-escape-sandbox allow-scripts allow-top-navigation allow-same-origin" src="https://www.tiktok.com/player/v1/${t}?&${e === "on" ? "autoplay=1" : ""}"></iframe>`;
855
+ };
856
+ const gn = (n) => new Promise((i) => {
857
+ let t = setTimeout(() => (clearTimeout(t), i()), n);
858
+ });
859
+ function Ei(n) {
860
+ const i = [];
861
+ n && n.forEach((t) => {
862
+ t instanceof HTMLElement ? i.push(t) : typeof t == "string" && i.push(...document.querySelectorAll(`${t}`));
863
+ }), v("html").addClass("scrollLock"), vs(i);
864
+ }
865
+ function Ai(n) {
866
+ const i = [];
867
+ n && n.forEach((t) => {
868
+ t instanceof HTMLElement ? i.push(t) : typeof t == "string" && i.push(...document.querySelectorAll(`${t}`));
869
+ }), v("html").removeClass("scrollLock"), bs(i);
870
+ }
871
+ async function fn(n = 0) {
872
+ if (v(".loading-wrapper").length)
873
+ return;
874
+ v("body").append(`
875
+ <div class="loading-wrapper">
876
+ <div class="icon-box">
877
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid"><path d="M10 50A40 40 0 0 0 90 50A40 42 0 0 1 10 50" fill="#ffffff" stroke="none">
878
+ <animateTransform attributeName="transform" type="rotate" dur="1s" repeatCount="indefinite" keyTimes="0;1" values="0 50 51;360 50 51">
879
+ </animateTransform>
880
+ </path>
881
+ </svg>
882
+ </div>
883
+ </div>
884
+ `), v(".loading-wrapper").delay(n).fadeIn(300).promise().done(function() {
885
+ Ei();
886
+ });
887
+ }
888
+ function vn() {
889
+ v(".loading-wrapper").fadeOut(300).promise().done(function() {
890
+ v(".loading-wrapper").remove(), Ai();
891
+ });
892
+ }
893
+ function bn(n, i) {
894
+ new on(n, i);
895
+ }
896
+ function Cs() {
897
+ const n = new ui("[data-aost]"), i = new Fe({ callback_loaded: (s) => {
898
+ } }), t = new Qs(), e = new Qe("[data-anchor-target]");
899
+ n.update(), i.update(), t.reValidate(), e.update();
900
+ }
901
+ function yn(n, i = () => {
902
+ }) {
903
+ v(`[data-tab-content=${n}]`).fadeIn(function() {
904
+ typeof i == "function" && i();
905
+ }).siblings("[data-tab-content]").hide(), Cs();
906
+ }
907
+ function wn() {
908
+ Me(
909
+ {
910
+ target: document.body,
911
+ cancel: {
912
+ nativeScrollbarsOverlaid: !0,
913
+ body: null
914
+ }
915
+ },
916
+ {
917
+ overflow: {
918
+ x: "hidden"
919
+ },
920
+ scrollbars: {
921
+ autoHide: "scroll",
922
+ autoHideSuspend: !0
923
+ }
924
+ },
925
+ {
926
+ initialized() {
927
+ console.log("body scrollbar initialized");
928
+ }
929
+ }
930
+ );
931
+ }
932
+ function Tn() {
933
+ window.onpageshow = function(n) {
934
+ n.persisted && window.location.reload();
935
+ };
936
+ }
937
+ function En() {
938
+ const n = navigator.userAgent;
939
+ return {
940
+ BigSurUP: /Mac OS X 10.15/.test(n) || /Mac OS X 10_15_7/.test(n) || /Mac OS X 10_15_8/.test(n) || /Mac OS X 10_15_9/.test(n) || /Mac OS X 11_/.test(n) || /Mac OS X 12_/.test(n)
941
+ };
942
+ }
943
+ function An(n, i) {
944
+ v(n).on("click", function() {
945
+ v(this).toggleClass(i);
946
+ });
947
+ }
948
+ function Ln(n, i) {
949
+ v(n).on("click", function() {
950
+ v(n).not(this).removeClass(i), v(this).addClass(i);
951
+ });
952
+ }
953
+ function Hs(n, i = 250) {
954
+ let t = null;
955
+ return function(...e) {
956
+ let s = this;
957
+ clearTimeout(t), t = setTimeout(() => {
958
+ n.apply(s, e);
959
+ }, i);
960
+ };
961
+ }
962
+ function Sn(n, i = 250) {
963
+ let t, e;
964
+ return function() {
965
+ const s = this, o = arguments, a = +/* @__PURE__ */ new Date();
966
+ t && a < t + i ? (clearTimeout(e), e = setTimeout(function() {
967
+ t = a, n.apply(s, o);
968
+ }, i)) : (t = a, n.apply(s, o));
969
+ };
970
+ }
971
+ function Dn() {
972
+ window._g.interval = [], v(".countdown").each((i, t) => {
973
+ const e = Number(v(t).attr("data-seconds")) + 1;
974
+ let s = Math.floor(e / 60) + ":" + e % 60;
975
+ window._g.interval[i] = setInterval(function() {
976
+ var o = s.split(":"), a = parseInt(o[0], 10), r = parseInt(o[1], 10);
977
+ --r, a = r < 0 ? --a : a, a = a < 10 ? a = "0" + a : a, a == 0 && r == 0 && clearInterval(window._g.interval[i]), r = r < 0 ? 59 : r, r = r < 10 ? "0" + r : r, v(t).html(a + ":" + r), s = a + ":" + r;
978
+ }, 1e3);
979
+ });
980
+ }
981
+ function _n(n = 500) {
982
+ return new Promise((i, t) => {
983
+ let e = setTimeout(() => {
984
+ clearTimeout(e), i();
985
+ }, n);
986
+ });
987
+ }
988
+ function kn() {
989
+ const n = function() {
990
+ let i = window.innerHeight * 0.01;
991
+ document.documentElement.style.setProperty("--vh", i + "px");
992
+ };
993
+ n(), window.addEventListener("resize", Hs(n));
994
+ }
995
+ function $n(n, i, t, e, s) {
996
+ const o = this, r = v(n).html().split("<br>");
997
+ let l = "", c = 0;
998
+ r.forEach((u, p) => {
999
+ p !== 0 && (l += "<br>"), u.split("").forEach((m, f) => {
1000
+ i ? (f === 0 && (l += '<span class="letter-wrap" style="display: inline-block">'), m === " " ? l += '</span> <span class="letter-wrap" style="display: inline-block">' : (l += `<span class="letter"${s || t ? ` style="${s ? `transition: ${o.formatFloat(Math.random(), 2) * s}s;` : ""}${t ? t === "random" ? `transition-delay: ${o.formatFloat(Math.random(), 2)}s;` : `transition-delay: ${t + c * e}s;` : ""}"` : ""}>${m}</span>`, c++), f === u.length - 1 && (l += "</span>")) : m === " " ? l += " " : (l += `<span class="letter"${s || t ? ` style="${s ? `transition: ${o.formatFloat(Math.random(), 2) * s}s;` : ""}${t ? t === "random" ? `transition-delay: ${o.formatFloat(Math.random(), 2)}s;` : `transition-delay: ${t + c * e}s;` : ""}"` : ""}>${m}</span>`, c++);
1001
+ });
1002
+ }), v(n).html(l);
1003
+ }
1004
+ function xn(n, i) {
1005
+ const t = Math.pow(10, i);
1006
+ return Math.round(n * t) / t;
1007
+ }
1008
+ function Cn(n) {
1009
+ let i = n.activeIndex, t = n.slides.length;
1010
+ if (n.params.loop)
1011
+ switch (n.activeIndex) {
1012
+ case 0:
1013
+ i = t - 3;
1014
+ break;
1015
+ case t - 1:
1016
+ i = 0;
1017
+ break;
1018
+ default:
1019
+ --i;
1020
+ }
1021
+ return i;
1022
+ }
1023
+ function Hn(n, i) {
1024
+ const t = n.$el, e = n.params.grid.rows, s = i || n.params.slidesPerView * e;
1025
+ (n.loopedSlides ? n.slides.length - n.loopedSlides * 2 : n.slides.length) <= s ? (t.addClass("swiper-no-swiping"), v(n.params.navigation.nextEl).hide(), v(n.params.navigation.prevEl).hide(), v(n.params.pagination.el).hide(), n.params.autoplay.enabled = !1, n.autoplay.stop()) : (t.removeClass("swiper-no-swiping"), v(n.params.navigation.nextEl).show(), v(n.params.navigation.prevEl).show(), v(n.params.pagination.el).show(), n.params.autoplay.enabled && n.autoplay.start());
1026
+ }
1027
+ function Mn(n) {
1028
+ n.el.querySelectorAll("img.detect-shade").forEach((i) => {
1029
+ i.addEventListener("load", function() {
1030
+ detectShade(i);
1031
+ });
1032
+ });
1033
+ }
1034
+ function qn(n) {
1035
+ const i = n.el, t = v(i).find(".swiper-slide-active"), e = v(t).find("video").get(0), s = v(i).find(".swiper-slide video");
1036
+ n.autoplay.stop(), v(e).off("ended"), e ? (s.each((o, a) => {
1037
+ a.currentTime = 0;
1038
+ }), v(e).on("ended", function() {
1039
+ n.slideNext();
1040
+ }), e.play()) : n.params.autoplay.enabled && n.autoplay.start();
1041
+ }
1042
+ function In() {
1043
+ v(".number-grow").each(function(n, i) {
1044
+ const t = v(i), o = t.attr("data-num").replace(/(\d)(?=(?:\d{3})+$)/g, "$1,").split(""), a = () => {
1045
+ let r = "";
1046
+ for (var l = 0; l <= 9; l++)
1047
+ r += String(l) + "<br>";
1048
+ return r;
1049
+ };
1050
+ v(o).each(function(r, l) {
1051
+ const c = () => l !== "," ? `<div class="num" data-final-num="${l}"><div><br>${a()}<br>${a()}</div></div>` : `<div class="comma">${l}</div>`;
1052
+ t.append(c);
1053
+ });
1054
+ });
1055
+ }
1056
+ function On() {
1057
+ v(".letter-grow").each(function(n, i) {
1058
+ const t = v(i), s = t.attr("data-letter").split(""), o = () => {
1059
+ let a = "";
1060
+ for (let r = 65; r <= 90; r++)
1061
+ a += String.fromCharCode(r) + "<br>";
1062
+ return a;
1063
+ };
1064
+ v(s).each(function(a, r) {
1065
+ const l = `<div class="letter" data-final-letter="${r}"><div><br>${o()}<br>${o()}</div></div>`;
1066
+ t.append(l);
1067
+ });
1068
+ });
1069
+ }
1070
+ function Pn(n) {
1071
+ const i = getComputedStyle(n).transform;
1072
+ let t = i.match(/^matrix3d\((.+)\)$/);
1073
+ return t ? parseFloat(t[1].split(", ")[12]) : (t = i.match(/^matrix\((.+)\)$/), t ? parseFloat(t[1].split(", ")[4]) : 0);
1074
+ }
1075
+ function Nn(n) {
1076
+ const i = getComputedStyle(n).transform;
1077
+ let t = i.match(/^matrix3d\((.+)\)$/);
1078
+ return t ? parseFloat(t[1].split(", ")[13]) : (t = i.match(/^matrix\((.+)\)$/), t ? parseFloat(t[1].split(", ")[5]) : 0);
1079
+ }
1080
+ function jn(n) {
1081
+ const i = document.createElement("div");
1082
+ return i.innerHTML = n, i.childNodes[0];
1083
+ }
1084
+ const We = (n) => n.videoId !== "" || typeof n.videoId < "u", Ms = (n) => n.$selector.getAttribute("video4-active") === "on", Te = (n) => `<video-player video-id="${n.videoId}" video-type="${n.videoType}" video-startTime="${n.videoStartTime}" video-autoplay="${n.videoAutoplay}"></video-player>`;
1085
+ var V, Se, Ht, Li, Mt, Si, K, De, qt, Di;
1086
+ class qs {
1087
+ constructor(i, t = {}) {
1088
+ h(this, V);
1089
+ h(this, Ht);
1090
+ h(this, Mt);
1091
+ h(this, K);
1092
+ h(this, qt);
1093
+ if (!at(i) && !ye(i) && !rt(i)) {
1094
+ je("video4", `找不到該物件 -> ${i}`);
1095
+ return;
1096
+ }
1097
+ this.__storage__ = {
1098
+ el: i,
1099
+ options: t
1100
+ }, this.active = "data-video-active", d(this, V, Se).call(this);
1101
+ }
1102
+ update() {
1103
+ d(this, V, Se).call(this);
1104
+ }
1105
+ }
1106
+ V = new WeakSet(), Se = function() {
1107
+ const { el: i, options: t } = this.__storage__, { SETTINGS: e, EVENTS: s } = Y;
1108
+ if (this.elements = t.state == "not active" ? L(i + `:not([${this.active}])`) : L(i), this.options = Object.assign({}, e, t), this.__events__ = Object.assign({}, s), this.options.on)
1109
+ for (const [o, a] of Object.entries(this.options.on))
1110
+ this.__events__[o] = [a];
1111
+ d(this, Ht, Li).call(this);
1112
+ }, Ht = new WeakSet(), Li = function() {
1113
+ const { elements: i, options: t } = this;
1114
+ i.forEach((e) => {
1115
+ e.video = {}, e.video.instance = this, e.video.defaultOptions = t, e.video.params = d(this, qt, Di).call(this, e), e.video.methods = {}, e.video.methods.update = this.update, e.setAttribute(this.active, ""), We(e.video.params) && !Ms(e.video.params) && (e.setAttribute("video4-active", "on"), d(this, Mt, Si).call(this, e)), We(e.video.params) || je("video4", "無法取得影片 ID");
1116
+ }), this.emit("init");
1117
+ }, Mt = new WeakSet(), Si = function(i) {
1118
+ const { LAYOUT: t } = Y, e = i.video.params, { $selector: s, videoLayoutNo: o, videoId: a, videoType: r, videoMode: l, videoButton: c, videoCover: u, videoHighQualityPic: p } = e;
1119
+ if (l === "onBox") {
1120
+ let g = null;
1121
+ if (u === "on") {
1122
+ i.classList.add("video4-cover"), s.querySelector("img") || (s.insertAdjacentHTML(E.prepend, '<picture><source srcset="" type="image/webp"><source srcset="" type="image/jpeg"><img src="" alt></picture>'), T("video4", "若啟用 [videoCover] 且選擇 onBox 模式必須於 video-target 內放置 img 結構,若無結構則自動加入圖片結構"));
1123
+ const m = s.querySelector("img");
1124
+ m.insertAdjacentHTML(E.after, t[o]);
1125
+ const f = (m == null ? void 0 : m.getAttribute("src")) || (m == null ? void 0 : m.getAttribute("data-src"));
1126
+ !f && r == "youtube" ? p == "on" ? m.setAttribute("src", `http://img.youtube.com/vi/${a}/maxresdefault.jpg `) : m.setAttribute("src", `https://img.youtube.com/vi/${a}/0.jpg`) : !f && r == "vimeo" ? m.setAttribute("src", `https://vumbnail.com/${a}_large.jpg`) : !f && r == "tiktok" ? fetch(`https://www.tiktok.com/oembed?url=https://www.tiktok.com/@/video/${a}`, { method: "GET", redirect: "follow" }).then((b) => b.json()).then((b) => {
1127
+ const y = b.thumbnail_url;
1128
+ m.setAttribute("src", `${y}`);
1129
+ }).catch(function(b) {
1130
+ console.log("error");
1131
+ }) : T("video4", "僅 youtube & vimeo 提供,無圖片時放置預設封面畫面,其他影片平台請自行上傳封面照片");
1132
+ }
1133
+ c == "off" ? g = s : (g = s.querySelector(c) ?? s, s.querySelector(c) || T("video4", `找不到 videoButton 設定的 element -> '${c}' , 點擊物件轉移至 '${this.__storage__.el}'`)), g.video || (g.video = {}, g.video.params = e), g.video.eventHandler = d(this, K, De), g.addEventListener("click", g.video.eventHandler);
1134
+ } else if (l === "onPage") {
1135
+ let g = null;
1136
+ if (u == "on") {
1137
+ i.classList.add("video4-cover"), s.querySelector("img") || (s.insertAdjacentHTML(E.prepend, '<picture><source srcset="" type="image/webp"><source srcset="" type="image/jpeg"><img src="" alt></picture>'), T("video", "若啟用 [videoCover] 且選擇 onBox 模式必須於 video-target 內放置 img 結構"));
1138
+ const m = s.querySelector("img");
1139
+ m.insertAdjacentHTML(E.after, t[o]);
1140
+ const f = (m == null ? void 0 : m.getAttribute("src")) || (m == null ? void 0 : m.getAttribute("data-src"));
1141
+ !f && r == "youtube" ? p == "on" ? m.setAttribute("src", `http://img.youtube.com/vi/${a}/maxresdefault.jpg `) : m.setAttribute("src", `https://img.youtube.com/vi/${a}/0.jpg`) : !f && r == "vimeo" ? m.setAttribute("src", `https://vumbnail.com/${a}_large.jpg`) : !f && r == "tiktok" ? fetch(`https://www.tiktok.com/oembed?url=https://www.tiktok.com/@/video/${a}`, { method: "GET", redirect: "follow" }).then((b) => b.json()).then((b) => {
1142
+ const y = b.thumbnail_url;
1143
+ m.setAttribute("src", `${y}`);
1144
+ }).catch(function(b) {
1145
+ console.log("error");
1146
+ }) : f || T("video4", "僅 youtube & vimeo 提供,無圖片時放置預設封面畫面,其他影片平台請自行上傳封面照片"), c == "off" ? g = s : (g = s.querySelector(c) ?? s, s.querySelector(c) || T("video4", `找不到 videoButton 設定的 element -> '${c}', 點擊物件轉移至 '${this.__storage__.el}'`));
1147
+ } else {
1148
+ s.innerHTML = Te(e);
1149
+ return;
1150
+ }
1151
+ g.video || (g.video = {}, g.video.params = e), g.video.eventHandler = d(this, K, De), g.addEventListener("click", g.video.eventHandler);
1152
+ }
1153
+ }, K = new WeakSet(), De = function(i) {
1154
+ const { video: t, emit: e } = this, { $selector: s, videoMode: o, videoTarget: a, videoTargetRoute: r, videoType: l, videoIgHtml: c } = t.params, u = new Fe({ callback_loaded: (p) => {
1155
+ } });
1156
+ if (o == "onBox") {
1157
+ const p = {
1158
+ target: a,
1159
+ route: r,
1160
+ on: {
1161
+ complete(g) {
1162
+ if (l == "instagram")
1163
+ if (g.setAttribute("video-typeStyle", `${l}`), window.instgrm)
1164
+ window.instgrm.Embeds.process();
1165
+ else {
1166
+ const m = document.createElement("script");
1167
+ m.src = "https://www.instagram.com/embed.js", m.async = !0, document.body.appendChild(m);
1168
+ }
1169
+ else
1170
+ g.querySelector(".modal-content").insertAdjacentHTML("beforeend", Te(t.params)), g.setAttribute("video-typeStyle", `${l}`);
1171
+ },
1172
+ open(g) {
1173
+ const m = g.querySelectorAll("[data-overlayscrollbars-viewport]");
1174
+ if (u.update(), Ei([...m]), l == "instagram") {
1175
+ const f = document.querySelector("[video-template] .modal-content");
1176
+ new ResizeObserver((y) => {
1177
+ y[0].contentRect.height > 50 && f.classList.add("active");
1178
+ }).observe(f);
1179
+ }
1180
+ },
1181
+ close(g) {
1182
+ const m = g.querySelectorAll("[data-overlayscrollbars-viewport]");
1183
+ Ai([...m]);
1184
+ },
1185
+ destroy(g) {
1186
+ }
1187
+ }
1188
+ };
1189
+ U.open(p);
1190
+ } else
1191
+ o == "onPage" && (t.params.videoAutoplay = "on", s.innerHTML = Te(t.params));
1192
+ }, qt = new WeakSet(), Di = function(i) {
1193
+ const { SETTINGS: t } = Y;
1194
+ return {
1195
+ $selector: i,
1196
+ videoId: i.getAttribute("video-id"),
1197
+ videoType: i.getAttribute("video-type"),
1198
+ videoAutoplay: i.getAttribute("video-autoplay") || t.videoAutoplay,
1199
+ videoMode: i.getAttribute("video-mode") || t.videoMode,
1200
+ videoButton: i.getAttribute("video-button") || t.videoButton,
1201
+ videoCover: i.getAttribute("video-cover") || t.videoCover,
1202
+ videoLayoutNo: i.getAttribute("video-layout-no") || t.videoLayoutNo,
1203
+ videoTarget: i.getAttribute("video-target") || t.videoTarget,
1204
+ videoTargetRoute: i.getAttribute("video-target-route") || t.videoTargetRoute,
1205
+ videoStartTime: i.getAttribute("video-starttime") || t.videoStartTime,
1206
+ videoHighQualityPic: i.getAttribute("video-highquality") || t.videoHighQuality,
1207
+ videoIgHtml: i.getAttribute("video-ig") || t.videoIgHtml
1208
+ };
1209
+ };
1210
+ Object.assign(qs.prototype, O);
1211
+ customElements.define("video-player", xs);
1212
+ const Oe = {
1213
+ "zh-tw": {
1214
+ 臺北市: [
1215
+ ["中正區", "100"],
1216
+ ["大同區", "103"],
1217
+ ["中山區", "104"],
1218
+ ["松山區", "105"],
1219
+ ["大安區", "106"],
1220
+ ["萬華區", "108"],
1221
+ ["信義區", "110"],
1222
+ ["士林區", "111"],
1223
+ ["北投區", "112"],
1224
+ ["內湖區", "114"],
1225
+ ["南港區", "115"],
1226
+ ["文山區", "116"]
1227
+ ],
1228
+ 新北市: [
1229
+ ["萬里區", "207"],
1230
+ ["金山區", "208"],
1231
+ ["板橋區", "220"],
1232
+ ["汐止區", "221"],
1233
+ ["深坑區", "222"],
1234
+ ["石碇區", "223"],
1235
+ ["瑞芳區", "224"],
1236
+ ["平溪區", "226"],
1237
+ ["雙溪區", "227"],
1238
+ ["貢寮區", "228"],
1239
+ ["新店區", "231"],
1240
+ ["坪林區", "232"],
1241
+ ["烏來區", "233"],
1242
+ ["永和區", "234"],
1243
+ ["中和區", "235"],
1244
+ ["土城區", "236"],
1245
+ ["三峽區", "237"],
1246
+ ["樹林區", "238"],
1247
+ ["鶯歌區", "239"],
1248
+ ["三重區", "241"],
1249
+ ["新莊區", "242"],
1250
+ ["泰山區", "243"],
1251
+ ["林口區", "244"],
1252
+ ["蘆洲區", "247"],
1253
+ ["五股區", "248"],
1254
+ ["八里區", "249"],
1255
+ ["淡水區", "251"],
1256
+ ["三芝區", "252"],
1257
+ ["石門區", "253"]
1258
+ ],
1259
+ 基隆市: [
1260
+ ["仁愛區", "200"],
1261
+ ["信義區", "201"],
1262
+ ["中正區", "202"],
1263
+ ["中山區", "203"],
1264
+ ["安樂區", "204"],
1265
+ ["暖暖區", "205"],
1266
+ ["七堵區", "206"]
1267
+ ],
1268
+ 宜蘭縣: [
1269
+ ["宜蘭市", "260"],
1270
+ ["頭城鎮", "261"],
1271
+ ["礁溪鄉", "262"],
1272
+ ["壯圍鄉", "263"],
1273
+ ["員山鄉", "264"],
1274
+ ["羅東鎮", "265"],
1275
+ ["三星鄉", "266"],
1276
+ ["大同鄉", "267"],
1277
+ ["五結鄉", "268"],
1278
+ ["冬山鄉", "269"],
1279
+ ["蘇澳鎮", "270"],
1280
+ ["南澳鄉", "272"]
1281
+ ],
1282
+ 桃園市: [
1283
+ ["中壢區", "320"],
1284
+ ["平鎮區", "324"],
1285
+ ["龍潭區", "325"],
1286
+ ["楊梅區", "326"],
1287
+ ["新屋區", "327"],
1288
+ ["觀音區", "328"],
1289
+ ["桃園區", "330"],
1290
+ ["龜山區", "333"],
1291
+ ["八德區", "334"],
1292
+ ["大溪區", "335"],
1293
+ ["復興區", "336"],
1294
+ ["大園區", "337"],
1295
+ ["蘆竹區", "338"]
1296
+ ],
1297
+ 新竹市: [
1298
+ ["東區", "300"],
1299
+ ["北區", "301"],
1300
+ ["香山區", "309"]
1301
+ ],
1302
+ 新竹縣: [
1303
+ ["竹北市", "302"],
1304
+ ["湖口鄉", "303"],
1305
+ ["新豐鄉", "304"],
1306
+ ["新埔鎮", "305"],
1307
+ ["關西鎮", "306"],
1308
+ ["芎林鄉", "307"],
1309
+ ["寶山鄉", "308"],
1310
+ ["竹東鎮", "310"],
1311
+ ["五峰鄉", "311"],
1312
+ ["橫山鄉", "312"],
1313
+ ["尖石鄉", "313"],
1314
+ ["北埔鄉", "314"],
1315
+ ["峨嵋鄉", "315"]
1316
+ ],
1317
+ 苗栗縣: [
1318
+ ["竹南鎮", "350"],
1319
+ ["頭份鎮", "351"],
1320
+ ["三灣鄉", "352"],
1321
+ ["南庄鄉", "353"],
1322
+ ["獅潭鄉", "354"],
1323
+ ["後龍鎮", "356"],
1324
+ ["通霄鎮", "357"],
1325
+ ["苑裡鎮", "358"],
1326
+ ["苗栗市", "360"],
1327
+ ["造橋鄉", "361"],
1328
+ ["頭屋鄉", "362"],
1329
+ ["公館鄉", "363"],
1330
+ ["大湖鄉", "364"],
1331
+ ["泰安鄉", "365"],
1332
+ ["銅鑼鄉", "366"],
1333
+ ["三義鄉", "367"],
1334
+ ["西湖鄉", "368"],
1335
+ ["卓蘭鎮", "369"]
1336
+ ],
1337
+ 臺中市: [
1338
+ ["中區", "400"],
1339
+ ["東區", "401"],
1340
+ ["南區", "402"],
1341
+ ["西區", "403"],
1342
+ ["北區", "404"],
1343
+ ["北屯區", "406"],
1344
+ ["西屯區", "407"],
1345
+ ["南屯區", "408"],
1346
+ ["太平區", "411"],
1347
+ ["大里區", "412"],
1348
+ ["霧峰區", "413"],
1349
+ ["烏日區", "414"],
1350
+ ["豐原區", "420"],
1351
+ ["后里區", "421"],
1352
+ ["石岡區", "422"],
1353
+ ["東勢區", "423"],
1354
+ ["和平區", "424"],
1355
+ ["新社區", "426"],
1356
+ ["潭子區", "427"],
1357
+ ["大雅區", "428"],
1358
+ ["神岡區", "429"],
1359
+ ["大肚區", "432"],
1360
+ ["沙鹿區", "433"],
1361
+ ["龍井區", "434"],
1362
+ ["梧棲區", "435"],
1363
+ ["清水區", "436"],
1364
+ ["大甲區", "437"],
1365
+ ["外埔區", "438"],
1366
+ ["大安區", "439"]
1367
+ ],
1368
+ 彰化縣: [
1369
+ ["彰化市", "500"],
1370
+ ["芬園鄉", "502"],
1371
+ ["花壇鄉", "503"],
1372
+ ["秀水鄉", "504"],
1373
+ ["鹿港鎮", "505"],
1374
+ ["福興鄉", "506"],
1375
+ ["線西鄉", "507"],
1376
+ ["和美鎮", "508"],
1377
+ ["伸港鄉", "509"],
1378
+ ["員林鎮", "510"],
1379
+ ["社頭鄉", "511"],
1380
+ ["永靖鄉", "512"],
1381
+ ["埔心鄉", "513"],
1382
+ ["溪湖鎮", "514"],
1383
+ ["大村鄉", "515"],
1384
+ ["埔鹽鄉", "516"],
1385
+ ["田中鎮", "520"],
1386
+ ["北斗鎮", "521"],
1387
+ ["田尾鄉", "522"],
1388
+ ["埤頭鄉", "523"],
1389
+ ["溪州鄉", "524"],
1390
+ ["竹塘鄉", "525"],
1391
+ ["二林鎮", "526"],
1392
+ ["大城鄉", "527"],
1393
+ ["芳苑鄉", "528"],
1394
+ ["二水鄉", "530"]
1395
+ ],
1396
+ 南投縣: [
1397
+ ["南投市", "540"],
1398
+ ["中寮鄉", "541"],
1399
+ ["草屯鎮", "542"],
1400
+ ["國姓鄉", "544"],
1401
+ ["埔里鎮", "545"],
1402
+ ["仁愛鄉", "546"],
1403
+ ["名間鄉", "551"],
1404
+ ["集集鎮", "552"],
1405
+ ["水里鎮", "553"],
1406
+ ["魚池鄉", "555"],
1407
+ ["信義鄉", "556"],
1408
+ ["竹山鎮", "557"],
1409
+ ["鹿谷鄉", "558"]
1410
+ ],
1411
+ 雲林縣: [
1412
+ ["斗南鎮", "630"],
1413
+ ["大埤鄉", "631"],
1414
+ ["虎尾鎮", "632"],
1415
+ ["土庫鎮", "633"],
1416
+ ["褒忠鄉", "634"],
1417
+ ["東勢鄉", "635"],
1418
+ ["臺西鄉", "636"],
1419
+ ["崙背鄉", "637"],
1420
+ ["麥寮鄉", "638"],
1421
+ ["斗六市", "640"],
1422
+ ["林內鄉", "643"],
1423
+ ["古坑鄉", "646"],
1424
+ ["莿桐鄉", "647"],
1425
+ ["西螺鎮", "648"],
1426
+ ["二崙鄉", "649"],
1427
+ ["北港鎮", "651"],
1428
+ ["水林鄉", "652"],
1429
+ ["口湖鄉", "653"],
1430
+ ["四湖鄉", "654"],
1431
+ ["元長鄉", "655"]
1432
+ ],
1433
+ 嘉義市: [
1434
+ ["西區", "600"],
1435
+ ["東區", "601"]
1436
+ ],
1437
+ 嘉義縣: [
1438
+ ["番路鄉", "602"],
1439
+ ["梅山鄉", "603"],
1440
+ ["竹崎鄉", "604"],
1441
+ ["阿里山鄉", "605"],
1442
+ ["中埔鄉", "606"],
1443
+ ["大埔鄉", "607"],
1444
+ ["水上鄉", "608"],
1445
+ ["鹿草鄉", "611"],
1446
+ ["太保市", "612"],
1447
+ ["朴子市", "613"],
1448
+ ["東石鄉", "614"],
1449
+ ["六腳鄉", "615"],
1450
+ ["新港鄉", "616"],
1451
+ ["民雄鄉", "621"],
1452
+ ["大林鎮", "622"],
1453
+ ["溪口鄉", "623"],
1454
+ ["義竹鄉", "624"],
1455
+ ["布袋鎮", "625"]
1456
+ ],
1457
+ 臺南市: [
1458
+ ["中西區", "700"],
1459
+ ["東區", "701"],
1460
+ ["南區", "702"],
1461
+ ["北區", "704"],
1462
+ ["安平區", "708"],
1463
+ ["安南區", "709"],
1464
+ ["永康區", "710"],
1465
+ ["歸仁區", "711"],
1466
+ ["新化區", "712"],
1467
+ ["左鎮區", "713"],
1468
+ ["玉井區", "714"],
1469
+ ["楠西區", "715"],
1470
+ ["南化區", "716"],
1471
+ ["仁德區", "717"],
1472
+ ["關廟區", "718"],
1473
+ ["龍崎區", "719"],
1474
+ ["官田區", "720"],
1475
+ ["麻豆區", "721"],
1476
+ ["佳里區", "722"],
1477
+ ["西港區", "723"],
1478
+ ["七股區", "724"],
1479
+ ["將軍區", "725"],
1480
+ ["學甲區", "726"],
1481
+ ["北門區", "727"],
1482
+ ["新營區", "730"],
1483
+ ["後壁區", "731"],
1484
+ ["白河區", "732"],
1485
+ ["東山區", "733"],
1486
+ ["六甲區", "734"],
1487
+ ["下營區", "735"],
1488
+ ["柳營區", "736"],
1489
+ ["鹽水區", "737"],
1490
+ ["善化區", "741"],
1491
+ ["大內區", "742"],
1492
+ ["山上區", "743"],
1493
+ ["新市區", "744"],
1494
+ ["安定區", "745"]
1495
+ ],
1496
+ 高雄市: [
1497
+ ["新興區", "800"],
1498
+ ["前金區", "801"],
1499
+ ["苓雅區", "802"],
1500
+ ["鹽埕區", "803"],
1501
+ ["鼓山區", "804"],
1502
+ ["旗津區", "805"],
1503
+ ["前鎮區", "806"],
1504
+ ["三民區", "807"],
1505
+ ["楠梓區", "811"],
1506
+ ["小港區", "812"],
1507
+ ["左營區", "813"],
1508
+ ["仁武區", "814"],
1509
+ ["大社區", "815"],
1510
+ ["岡山區", "820"],
1511
+ ["路竹區", "821"],
1512
+ ["阿蓮區", "822"],
1513
+ ["田寮區", "823"],
1514
+ ["燕巢區", "824"],
1515
+ ["橋頭區", "825"],
1516
+ ["梓官區", "826"],
1517
+ ["彌陀區", "827"],
1518
+ ["永安區", "828"],
1519
+ ["湖內區", "829"],
1520
+ ["鳳山區", "830"],
1521
+ ["大寮區", "831"],
1522
+ ["林園區", "832"],
1523
+ ["鳥松區", "833"],
1524
+ ["大樹區", "840"],
1525
+ ["旗山區", "842"],
1526
+ ["美濃區", "843"],
1527
+ ["六龜區", "844"],
1528
+ ["內門區", "845"],
1529
+ ["杉林區", "846"],
1530
+ ["甲仙區", "847"],
1531
+ ["桃源區", "848"],
1532
+ ["那瑪夏區", "849"],
1533
+ ["茂林區", "851"],
1534
+ ["茄萣區", "852"]
1535
+ ],
1536
+ 屏東縣: [
1537
+ ["屏東市", "900"],
1538
+ ["三地鄉", "901"],
1539
+ ["霧臺鄉", "902"],
1540
+ ["瑪家鄉", "903"],
1541
+ ["九如鄉", "904"],
1542
+ ["里港鄉", "905"],
1543
+ ["高樹鄉", "906"],
1544
+ ["鹽埔鄉", "907"],
1545
+ ["長治鄉", "908"],
1546
+ ["麟洛鄉", "909"],
1547
+ ["竹田鄉", "911"],
1548
+ ["內埔鄉", "912"],
1549
+ ["萬丹鄉", "913"],
1550
+ ["潮州鎮", "920"],
1551
+ ["泰武鄉", "921"],
1552
+ ["來義鄉", "922"],
1553
+ ["萬巒鄉", "923"],
1554
+ ["崁頂鄉", "924"],
1555
+ ["新埤鄉", "925"],
1556
+ ["南州鄉", "926"],
1557
+ ["林邊鄉", "927"],
1558
+ ["東港鎮", "928"],
1559
+ ["琉球鄉", "929"],
1560
+ ["佳冬鄉", "931"],
1561
+ ["新園鄉", "932"],
1562
+ ["枋寮鄉", "940"],
1563
+ ["枋山鄉", "941"],
1564
+ ["春日鄉", "942"],
1565
+ ["獅子鄉", "943"],
1566
+ ["車城鄉", "944"],
1567
+ ["牡丹鄉", "945"],
1568
+ ["恒春鎮", "946"],
1569
+ ["滿州鄉", "947"]
1570
+ ],
1571
+ 花蓮縣: [
1572
+ ["花蓮市", "970"],
1573
+ ["新城鄉", "971"],
1574
+ ["秀林鄉", "972"],
1575
+ ["吉安鄉", "973"],
1576
+ ["壽豐鄉", "974"],
1577
+ ["鳳林鎮", "975"],
1578
+ ["光復鄉", "976"],
1579
+ ["豐濱鄉", "977"],
1580
+ ["瑞穗鄉", "978"],
1581
+ ["萬榮鄉", "979"],
1582
+ ["玉里鎮", "981"],
1583
+ ["卓溪鄉", "982"],
1584
+ ["富里鄉", "983"]
1585
+ ],
1586
+ 臺東縣: [
1587
+ ["臺東市", "950"],
1588
+ ["綠島鄉", "951"],
1589
+ ["蘭嶼鄉", "952"],
1590
+ ["延平鄉", "953"],
1591
+ ["卑南鄉", "954"],
1592
+ ["鹿野鄉", "955"],
1593
+ ["關山鎮", "956"],
1594
+ ["海端鄉", "957"],
1595
+ ["池上鄉", "958"],
1596
+ ["東河鄉", "959"],
1597
+ ["成功鄉", "961"],
1598
+ ["長濱鄉", "962"],
1599
+ ["太麻里鄉", "963"],
1600
+ ["金峰鄉", "964"],
1601
+ ["大武鄉", "965"],
1602
+ ["達仁鄉", "966"]
1603
+ ],
1604
+ 澎湖縣: [
1605
+ ["馬公市", "880"],
1606
+ ["西嶼鄉", "881"],
1607
+ ["望安鄉", "882"],
1608
+ ["七美鄉", "883"],
1609
+ ["白沙鄉", "884"],
1610
+ ["湖西鄉", "885"]
1611
+ ],
1612
+ 金門縣: [
1613
+ ["金沙鎮", "890"],
1614
+ ["金湖鎮", "891"],
1615
+ ["金寧鄉", "892"],
1616
+ ["金城鎮", "893"],
1617
+ ["烈嶼鄉", "894"],
1618
+ ["烏坵鄉", "896"]
1619
+ ],
1620
+ 連江縣: [
1621
+ ["南竿鄉", "209"],
1622
+ ["北竿鄉", "210"],
1623
+ ["莒光鄉", "211"],
1624
+ ["東引鄉", "212"]
1625
+ ]
1626
+ },
1627
+ en: {
1628
+ "Taipei City": [
1629
+ ["Zhongzheng Dist", "100"],
1630
+ ["Datong Dist", "103"],
1631
+ ["Zhongshan Dist", "104"],
1632
+ ["Songshan Dist", "105"],
1633
+ ["Da'an Dist", "106"],
1634
+ ["Wanhua Dist", "108"],
1635
+ ["Xinyi Dist", "110"],
1636
+ ["Shilin Dist", "111"],
1637
+ ["Beitou Dist", "112"],
1638
+ ["Neihu Dist", "114"],
1639
+ ["Nangang Dist", "115"],
1640
+ ["Wenshan Dist", "116"]
1641
+ ],
1642
+ "New Taipei City": [
1643
+ ["Wanli Dist", "207"],
1644
+ ["Jinshan Dist", "208"],
1645
+ ["Banqiao Dist", "220"],
1646
+ ["Xizhi Dist", "221"],
1647
+ ["Shenkeng Dist", "222"],
1648
+ ["Shiding Dist", "223"],
1649
+ ["Ruifang Dist", "224"],
1650
+ ["Pingxi Dist", "226"],
1651
+ ["Shuangxi Dist", "227"],
1652
+ ["Gongliao Dist", "228"],
1653
+ ["Xindian Dist", "231"],
1654
+ ["Pinglin Dist", "232"],
1655
+ ["Wulai Dist", "233"],
1656
+ ["Yonghe Dist", "234"],
1657
+ ["Zhonghe Dist", "235"],
1658
+ ["Tucheng Dist", "236"],
1659
+ ["Sanxia Dist", "237"],
1660
+ ["Shulin Dist", "238"],
1661
+ ["Yingge Dist", "239"],
1662
+ ["Sanchong Dist", "241"],
1663
+ ["Xinzhuang Dist", "242"],
1664
+ ["Taishan Dist", "243"],
1665
+ ["Linkou Dist", "244"],
1666
+ ["Luzhou Dist", "247"],
1667
+ ["Wugu Dist", "248"],
1668
+ ["Bali Dist", "249"],
1669
+ ["Tamsui Dist", "251"],
1670
+ ["Sanzhi Dist", "252"],
1671
+ ["Shimen Dist", "253"]
1672
+ ],
1673
+ "Keelung City": [
1674
+ ["Ren'ai Dist", "200"],
1675
+ ["Xinyi Dist", "201"],
1676
+ ["Zhongzheng Dist", "202"],
1677
+ ["Zhongshan Dist", "203"],
1678
+ ["Anle Dist", "204"],
1679
+ ["Nuannuan Dist", "205"],
1680
+ ["Qidu Dist", "206"]
1681
+ ],
1682
+ "Yilan County": [
1683
+ ["Yilan City", "260"],
1684
+ ["Toucheng Township", "261"],
1685
+ ["Jiaoxi Township", "262"],
1686
+ ["Zhuangwei Township", "263"],
1687
+ ["Yuanshan Township", "264"],
1688
+ ["Luodong Township", "265"],
1689
+ ["Sanxing Township", "266"],
1690
+ ["Datong Township", "267"],
1691
+ ["Wujie Township", "268"],
1692
+ ["Dongshan Township", "269"],
1693
+ ["Su'ao Township", "270"],
1694
+ ["Nan’ao Township", "272"]
1695
+ ],
1696
+ "Taoyuan City": [
1697
+ ["Zhongli Dist", "320"],
1698
+ ["Pingzhen Dist", "324"],
1699
+ ["Longtan Dist", "325"],
1700
+ ["Yangmei Dist", "326"],
1701
+ ["Xinwu Dist", "327"],
1702
+ ["Guanyin Dist", "328"],
1703
+ ["Taoyuan Dist", "330"],
1704
+ ["Guishan Dist", "333"],
1705
+ ["Bade Dist", "334"],
1706
+ ["Daxi Dist", "335"],
1707
+ ["Fuxing Dist", "336"],
1708
+ ["Dayuan Dist", "337"],
1709
+ ["Luzhu Dist", "338"]
1710
+ ],
1711
+ "Hsinchu City": [
1712
+ ["East Dist", "300"],
1713
+ ["North Dist", "301"],
1714
+ ["Xiangshan Dist", "309"]
1715
+ ],
1716
+ "Hsinchu County": [
1717
+ ["Zhubei City", "302"],
1718
+ ["Hukou Township", "303"],
1719
+ ["Xinfeng Township", "304"],
1720
+ ["Xinpu Township", "305"],
1721
+ ["Guanxi Township", "306"],
1722
+ ["Qionglin Township", "307"],
1723
+ ["Baoshan Township", "308"],
1724
+ ["Zhudong Township", "310"],
1725
+ ["Wufeng Township", "311"],
1726
+ ["Hengshan Township", "312"],
1727
+ ["Jianshi Township", "313"],
1728
+ ["Beipu Township", "314"],
1729
+ ["Emei Township", "315"]
1730
+ ],
1731
+ "Miaoli County": [
1732
+ ["Zhunan Township", "350"],
1733
+ ["Toufen City", "351"],
1734
+ ["Sanwan Township", "352"],
1735
+ ["Nanzhuang Township", "353"],
1736
+ ["Shitan Township", "354"],
1737
+ ["Houlong Township", "356"],
1738
+ ["Tongxiao Township", "357"],
1739
+ ["Yuanli Township", "358"],
1740
+ ["Miaoli City", "360"],
1741
+ ["Zaoqiao Township", "361"],
1742
+ ["Touwu Township", "362"],
1743
+ ["Gongguan Township", "363"],
1744
+ ["Dahu Township", "364"],
1745
+ ["Tai'an Township", "365"],
1746
+ ["Tongluo Township", "366"],
1747
+ ["Sanyi Township", "367"],
1748
+ ["Xihu Township", "368"],
1749
+ ["Zhuolan Township", "369"]
1750
+ ],
1751
+ "Taichung City": [
1752
+ ["Central Dist", "400"],
1753
+ ["East Dist", "401"],
1754
+ ["South Dist", "402"],
1755
+ ["West Dist", "403"],
1756
+ ["North Dist", "404"],
1757
+ ["Beitun Dist", "406"],
1758
+ ["Xitun Dist", "407"],
1759
+ ["Nantun Dist", "408"],
1760
+ ["Taiping Dist", "411"],
1761
+ ["Dali Dist", "412"],
1762
+ ["Wufeng Dist", "413"],
1763
+ ["Wuri Dist", "414"],
1764
+ ["Fengyuan Dist", "420"],
1765
+ ["Houli Dist", "421"],
1766
+ ["Shigang Dist", "422"],
1767
+ ["Dongshi Dist", "423"],
1768
+ ["Heping Dist", "424"],
1769
+ ["Xinshe Dist", "426"],
1770
+ ["Tanzi Dist", "427"],
1771
+ ["Daya Dist", "428"],
1772
+ ["Shengang Dist", "429"],
1773
+ ["Dadu Dist", "432"],
1774
+ ["Shalu Dist", "433"],
1775
+ ["Longjing Dist", "434"],
1776
+ ["Wuqi Dist", "435"],
1777
+ ["Qingshui Dist", "436"],
1778
+ ["Dajia Dist", "437"],
1779
+ ["Waipu Dist", "438"],
1780
+ ["Da'an Dist", "439"]
1781
+ ],
1782
+ "Changhua County": [
1783
+ ["Changhua City", "500"],
1784
+ ["Fenyuan Township", "502"],
1785
+ ["Huatan Township", "503"],
1786
+ ["Xiushui Township", "504"],
1787
+ ["Lukang Township", "505"],
1788
+ ["Fuxing Township", "506"],
1789
+ ["Xianxi Township", "507"],
1790
+ ["Hemei Township", "508"],
1791
+ ["Shengang Township", "509"],
1792
+ ["Yuanlin City", "510"],
1793
+ ["Shetou Township", "511"],
1794
+ ["Yongjing Township", "512"],
1795
+ ["Puxin Township", "513"],
1796
+ ["Xihu Township", "514"],
1797
+ ["Dacun Township", "515"],
1798
+ ["Puyan Township", "516"],
1799
+ ["Tianzhong Township", "520"],
1800
+ ["Beidou Township", "521"],
1801
+ ["Tianwei Township", "522"],
1802
+ ["Pitou Township", "523"],
1803
+ ["Xizhou Township", "524"],
1804
+ ["Zhutang Township", "525"],
1805
+ ["Erlin Township", "526"],
1806
+ ["Dacheng Township", "527"],
1807
+ ["Fangyuan Township", "528"],
1808
+ ["Ershui Township", "530"]
1809
+ ],
1810
+ "Nantou County": [
1811
+ ["Nantou City", "540"],
1812
+ ["Zhongliao Township", "541"],
1813
+ ["Caotun Township", "542"],
1814
+ ["Guoxing Township", "544"],
1815
+ ["Puli Township", "545"],
1816
+ ["Ren'ai Township", "546"],
1817
+ ["Mingjian Township", "551"],
1818
+ ["Jiji Township", "552"],
1819
+ ["Shuili Township", "553"],
1820
+ ["Yuchi Township", "555"],
1821
+ ["Xinyi Township", "556"],
1822
+ ["Zhushan Township", "557"],
1823
+ ["Lugu Township", "558"]
1824
+ ],
1825
+ "Yunlin County": [
1826
+ ["Dounan Township", "630"],
1827
+ ["Dapi Township", "631"],
1828
+ ["Huwei Township", "632"],
1829
+ ["Tuku Township", "633"],
1830
+ ["Baozhong Township", "634"],
1831
+ ["Dongshi Township", "635"],
1832
+ ["Taixi Township", "636"],
1833
+ ["Lunbei Township", "637"],
1834
+ ["Mailiao Township", "638"],
1835
+ ["Douliu City", "640"],
1836
+ ["Linnei Township", "643"],
1837
+ ["Gukeng Township", "646"],
1838
+ ["Citong Township", "647"],
1839
+ ["Xiluo Township", "648"],
1840
+ ["Erlun Township", "649"],
1841
+ ["Beigang Township", "651"],
1842
+ ["Shuilin Township", "652"],
1843
+ ["Kouhu Township", "653"],
1844
+ ["Sihu Township", "654"],
1845
+ ["Yuanzhang Township", "655"]
1846
+ ],
1847
+ "Chiayi City": [
1848
+ ["West Dist", "600"],
1849
+ ["0", "601"]
1850
+ ],
1851
+ "Chiayi County": [
1852
+ ["Fanlu Township", "602"],
1853
+ ["Meishan Township", "603"],
1854
+ ["Zhuqi Township", "604"],
1855
+ ["Alishan Township", "605"],
1856
+ ["Zhongpu Township", "606"],
1857
+ ["Dapu Township", "607"],
1858
+ ["Shuishang Township", "608"],
1859
+ ["Lucao Township", "611"],
1860
+ ["Taibao City", "612"],
1861
+ ["Puzi City", "613"],
1862
+ ["Dongshi Township", "614"],
1863
+ ["Liujiao Township", "615"],
1864
+ ["Xingang Township", "616"],
1865
+ ["Minxiong Township", "621"],
1866
+ ["Dalin Township", "622"],
1867
+ ["Xikou Township", "623"],
1868
+ ["Yizhu Township", "624"],
1869
+ ["Budai Township", "625"]
1870
+ ],
1871
+ "Tainan City": [
1872
+ ["West Central Dist", "700"],
1873
+ ["East Dist", "701"],
1874
+ ["South Dist", "702"],
1875
+ ["North Dist", "704"],
1876
+ ["Anping Dist", "708"],
1877
+ ["Annan Dist", "709"],
1878
+ ["Yongkang Dist", "710"],
1879
+ ["Guiren Dist", "711"],
1880
+ ["Xinhua Dist", "712"],
1881
+ ["Zuozhen Dist", "713"],
1882
+ ["Yujing Dist", "714"],
1883
+ ["Nanxi Dist", "715"],
1884
+ ["Nanhua Dist", "716"],
1885
+ ["Rende Dist", "717"],
1886
+ ["Guanmiao Dist", "718"],
1887
+ ["Longqi Dist", "719"],
1888
+ ["Guantian Dist", "720"],
1889
+ ["Madou Dist", "721"],
1890
+ ["Jiali Dist", "722"],
1891
+ ["Xigang Dist", "723"],
1892
+ ["Qigu Dist", "724"],
1893
+ ["Jiangjun Dist", "725"],
1894
+ ["Xuejia Dist", "726"],
1895
+ ["Beimen Dist", "727"],
1896
+ ["Xinying Dist", "730"],
1897
+ ["Houbi Dist", "731"],
1898
+ ["Baihe Dist", "732"],
1899
+ ["Dongshan Dist", "733"],
1900
+ ["Liujia Dist", "734"],
1901
+ ["Xiaying Dist", "735"],
1902
+ ["Liuying Dist", "736"],
1903
+ ["Yanshui Dist", "737"],
1904
+ ["Shanhua Dist", "741"],
1905
+ ["Danei Dist", "742"],
1906
+ ["Shanshang Dist", "743"],
1907
+ ["Xinshi Dist", "744"],
1908
+ ["Anding Dist", "745"]
1909
+ ],
1910
+ "Kaohsiung City": [
1911
+ ["Xinxing Dist", "800"],
1912
+ ["Qianjin Dist", "801"],
1913
+ ["Lingya Dist", "802"],
1914
+ ["Yancheng Dist", "803"],
1915
+ ["Gushan Dist", "804"],
1916
+ ["Qijin Dist", "805"],
1917
+ ["Qianzhen Dist", "806"],
1918
+ ["Sanmin Dist", "807"],
1919
+ ["Nanzi Dist", "811"],
1920
+ ["Xiaogang Dist", "812"],
1921
+ ["Zuoying Dist", "813"],
1922
+ ["Renwu Dist", "814"],
1923
+ ["Dashe Dist", "815"],
1924
+ ["Gangshan Dist", "820"],
1925
+ ["Luzhu Dist", "821"],
1926
+ ["Alian Dist", "822"],
1927
+ ["Tianliao Dist", "823"],
1928
+ ["Yanchao Dist", "824"],
1929
+ ["Qiaotou Dist", "825"],
1930
+ ["Ziguan Dist", "826"],
1931
+ ["Mituo Dist", "827"],
1932
+ ["Yong'an Dist", "828"],
1933
+ ["Hunei Dist", "829"],
1934
+ ["Fengshan Dist", "830"],
1935
+ ["Daliao Dist", "831"],
1936
+ ["Linyuan Dist", "832"],
1937
+ ["Niaosong Dist", "833"],
1938
+ ["Dashu Dist", "840"],
1939
+ ["Qishan Dist", "842"],
1940
+ ["Meinong Dist", "843"],
1941
+ ["Liugui Dist", "844"],
1942
+ ["Neimen Dist", "845"],
1943
+ ["Shanlin Dist", "846"],
1944
+ ["Jiaxian Dist", "847"],
1945
+ ["Taoyuan Dist", "848"],
1946
+ ["Namaxia Dist", "849"],
1947
+ ["Maolin Dist", "851"],
1948
+ ["Qieding Dist", "852"]
1949
+ ],
1950
+ "Pingtung County": [
1951
+ ["Pingtung City", "900"],
1952
+ ["Sandimen Township", "901"],
1953
+ ["Wutai Township", "902"],
1954
+ ["Majia Township", "903"],
1955
+ ["Jiuru Township", "904"],
1956
+ ["Ligang Township", "905"],
1957
+ ["Gaoshu Township", "906"],
1958
+ ["Yanpu Township", "907"],
1959
+ ["Changzhi Township", "908"],
1960
+ ["Linluo Township", "909"],
1961
+ ["Zhutian Township", "911"],
1962
+ ["Neipu Township", "912"],
1963
+ ["Wandan Township", "913"],
1964
+ ["Chaozhou Township", "920"],
1965
+ ["Taiwu Township", "921"],
1966
+ ["Laiyi Township", "922"],
1967
+ ["Wanluan Township", "923"],
1968
+ ["Kanding Township", "924"],
1969
+ ["Xinpi Township", "925"],
1970
+ ["Nanzhou Township", "926"],
1971
+ ["Linbian Township", "927"],
1972
+ ["Donggang Township", "928"],
1973
+ ["Liuqiu Township", "929"],
1974
+ ["Jiadong Township", "931"],
1975
+ ["Xinyuan Township", "932"],
1976
+ ["Fangliao Township", "940"],
1977
+ ["Fangshan Township", "941"],
1978
+ ["Chunri Township", "942"],
1979
+ ["Shizi Township", "943"],
1980
+ ["Checheng Township", "944"],
1981
+ ["Mudan Township", "945"],
1982
+ ["Hengchun Township", "946"],
1983
+ ["Manzhou Township", "947"]
1984
+ ],
1985
+ "Hualien County": [
1986
+ ["Hualien City", "970"],
1987
+ ["Xincheng Township", "971"],
1988
+ ["Xiulin Township", "972"],
1989
+ ["Ji'an Township", "973"],
1990
+ ["Shoufeng Township", "974"],
1991
+ ["Fenglin Township", "975"],
1992
+ ["Guangfu Township", "976"],
1993
+ ["Fengbin Township", "977"],
1994
+ ["Ruisui Township", "978"],
1995
+ ["Wanrong Township", "979"],
1996
+ ["Yuli Township", "981"],
1997
+ ["Zhuoxi Township", "982"],
1998
+ ["Fuli Township", "983"]
1999
+ ],
2000
+ "Taitung County": [
2001
+ ["Taitung City", "950"],
2002
+ ["Ludao Township", "951"],
2003
+ ["Lanyu Township", "952"],
2004
+ ["Yanping Township", "953"],
2005
+ ["Beinan Township", "954"],
2006
+ ["Luye Township", "955"],
2007
+ ["Guanshan Township", "956"],
2008
+ ["Haiduan Township", "957"],
2009
+ ["Chishang Township", "958"],
2010
+ ["Donghe Township", "959"],
2011
+ ["Chenggong Township", "961"],
2012
+ ["Changbin Township", "962"],
2013
+ ["Taimali Township", "963"],
2014
+ ["Jinfeng Township", "964"],
2015
+ ["Dawu Township", "965"],
2016
+ ["Daren Township", "966"]
2017
+ ],
2018
+ "Penghu County": [
2019
+ ["Magong City", "880"],
2020
+ ["Xiyu Township", "881"],
2021
+ ["Wang'an Township", "882"],
2022
+ ["Qimei Township", "883"],
2023
+ ["Baisha Township", "884"],
2024
+ ["Huxi Township", "885"]
2025
+ ],
2026
+ "Kinmen County": [
2027
+ ["Jinsha Township", "890"],
2028
+ ["Jinhu Township", "891"],
2029
+ ["Jinning Township", "892"],
2030
+ ["Jincheng Township", "893"],
2031
+ ["Lieyu Township", "894"],
2032
+ ["Wuqiu Township", "896"]
2033
+ ],
2034
+ "Lienchiang County": [
2035
+ ["Nangan Township", "209"],
2036
+ ["Beigan Township", "210"],
2037
+ ["Juguang Township", "211"],
2038
+ ["Dongyin Township", "212"]
2039
+ ]
2040
+ }
2041
+ }, Is = (n) => {
2042
+ const { TEMPLATE: i } = qe, { childDom: t } = n.s, e = document.createElement("div"), s = n.classList.contains("filter"), o = n.getAttribute("filter-placeholder"), a = n.getAttribute("d4-icon"), r = n.getAttribute("custom-template");
2043
+ e.innerHTML = i(
2044
+ s,
2045
+ o,
2046
+ r,
2047
+ a
2048
+ );
2049
+ const l = e.querySelector(".dropdown-list");
2050
+ return [...t].forEach((c) => {
2051
+ c.tagName === "LI" && (c.classList.contains("has-sublayer") ? [...c.querySelectorAll("li")].forEach((p) => {
2052
+ (!p.hasAttribute("data-option") || p.getAttribute("data-option").trim() === "") && p.setAttribute("data-option", p.textContent.trim());
2053
+ }) : (!c.hasAttribute("data-option") || c.getAttribute("data-option").trim() === "") && c.setAttribute("data-option", c.textContent.trim())), l.append(c);
2054
+ }), e.children[0];
2055
+ }, Os = (n) => {
2056
+ var t;
2057
+ const i = (t = n.getAttribute("control-elements")) == null ? void 0 : t.split(",");
2058
+ i && i.forEach((e) => {
2059
+ const s = document.querySelector(e);
2060
+ s || T("dropdown", `Can't not find control element(${e})`), s && s.classList.contains("disabled") && (s.classList.remove("disabled"), s.tagName === "DROPDOWN-EL" && s.s.activeLi && x(s, [...s.s.allLi].indexOf(s.s.activeLi)));
2061
+ });
2062
+ }, x = (n, i) => {
2063
+ const t = n.getAttribute("d4-placeholder"), e = n.querySelectorAll(".dropdown-list li");
2064
+ if (i < 0 || i.length === 0) {
2065
+ switch (e.forEach((s) => {
2066
+ s.classList.remove("active");
2067
+ }), n.s.activeLi = void 0, n.s.selectType) {
2068
+ case "single":
2069
+ n.s.value = {
2070
+ index: -1,
2071
+ id: void 0,
2072
+ el: void 0
2073
+ };
2074
+ break;
2075
+ case "multiple":
2076
+ n.s.value = [];
2077
+ break;
2078
+ }
2079
+ n.s.selectDisplayEl.textContent = t.trim(), n.setAttribute("d4-value", "");
2080
+ } else {
2081
+ if (n.classList.contains("disabled")) {
2082
+ n.s.selectDisplayEl.textContent = t.trim();
2083
+ return;
2084
+ }
2085
+ switch (n.s.selectType) {
2086
+ case "single":
2087
+ const s = e[i].textContent.trim();
2088
+ n.s.allLi.forEach((r) => {
2089
+ r.classList.remove("active");
2090
+ }), e[i].classList.add("active"), n.s.selectDisplayEl.textContent = s, n.s.activeLi = e[i], n.s.value = {
2091
+ index: i,
2092
+ id: e[i].getAttribute("data-option"),
2093
+ el: e[i]
2094
+ };
2095
+ break;
2096
+ case "multiple":
2097
+ Array.isArray(i) && n.s.allLi.forEach((r) => {
2098
+ i.indexOf([...n.s.allLi].indexOf(r)) >= 0 ? r.classList.add("active") : r.classList.remove("active");
2099
+ });
2100
+ const o = n.querySelectorAll(".dropdown-list li.active");
2101
+ o.length <= 0 ? n.s.selectDisplayEl.textContent = t.trim() : (n.s.selectDisplayEl.textContent = "", o.forEach((r) => {
2102
+ const l = r.getAttribute("data-option"), c = r.textContent.trim(), u = `<div class="option-btn" data-option="${l}"><div class="text">${c}</div><div class="remove-icon"></div></div>`;
2103
+ n.s.selectDisplayEl.insertAdjacentHTML(E.append, u);
2104
+ })), n.s.activeLi = o, n.s.value = [...o].map((r) => ({
2105
+ index: [...e].indexOf(r),
2106
+ id: r.getAttribute("data-option"),
2107
+ el: r
2108
+ }));
2109
+ const a = [...o].map((r) => r.getAttribute("data-option"));
2110
+ n.setAttribute("d4-value", a.join());
2111
+ break;
2112
+ }
2113
+ }
2114
+ }, Ps = (n) => {
2115
+ const i = n.s.cityLang;
2116
+ n.classList.contains("city") && (n.s.dropdownEl.querySelector(".dropdown-list").innerHTML = "", Object.keys(Oe[i]).forEach((t) => {
2117
+ const e = document.createElement("li");
2118
+ e.textContent = t, e.setAttribute("data-option", t), n.s.dropdownEl.querySelector(".dropdown-list").append(e);
2119
+ }), n.s.allLi = n.querySelectorAll(".dropdown-list li"));
2120
+ }, Ns = (n, i) => {
2121
+ const t = n.s.cityLang;
2122
+ Oe[t][i].forEach((e, s) => {
2123
+ const o = document.createElement("li");
2124
+ o.textContent = e[0], o.setAttribute("data-option", e[0]), n.querySelector(".dropdown-list").append(o);
2125
+ });
2126
+ }, _i = () => {
2127
+ L('dropdown-el[d4-status="open"]').forEach((i) => {
2128
+ i.close();
2129
+ });
2130
+ }, js = () => {
2131
+ const { SETTINGS: n } = qe;
2132
+ ((t, e) => {
2133
+ Object.keys(e).forEach((s) => {
2134
+ t.style.setProperty(`--${s}`, e[s]);
2135
+ });
2136
+ })(document.documentElement, n.scrollbar);
2137
+ };
2138
+ js();
2139
+ document.addEventListener("click", function() {
2140
+ _i();
2141
+ });
2142
+ var It, $i, Ot, xi, Pt, Ci, Nt, Hi;
2143
+ class ki extends HTMLElement {
2144
+ constructor() {
2145
+ super();
2146
+ h(this, It);
2147
+ h(this, Ot);
2148
+ h(this, Pt);
2149
+ h(this, Nt);
2150
+ this.initialize = !1;
2151
+ }
2152
+ static get observedAttributes() {
2153
+ return ["d4-status", "d4-placeholder", "d4-value"];
2154
+ }
2155
+ attributeChangedCallback(t, e, s) {
2156
+ const o = this;
2157
+ switch (t) {
2158
+ case "d4-status":
2159
+ if (e === null || e === s)
2160
+ return;
2161
+ (s === "open" || s === "close") && o.emit(s);
2162
+ break;
2163
+ case "d4-value":
2164
+ if (e === null || e === s)
2165
+ return;
2166
+ if (s !== "")
2167
+ switch (o.hasAttribute("multiple") ? "multiple" : "single") {
2168
+ case "single":
2169
+ const r = o.querySelector(`.dropdown-list li[data-option="${s}"]`);
2170
+ w(r) ? x(o, [...o.s.allLi].indexOf(r)) : x(o, -1);
2171
+ break;
2172
+ case "multiple":
2173
+ const l = [];
2174
+ o.querySelector(".dropdown-list li").classList.remove("active"), s.split(",").forEach((u) => {
2175
+ const p = o.querySelector(`.dropdown-list li[data-option="${u}"]`);
2176
+ w(p) && (p.classList.add("active"), l.push(p));
2177
+ });
2178
+ const c = l.map((u) => [...o.s.allLi].indexOf(u));
2179
+ x(o, c);
2180
+ break;
2181
+ }
2182
+ else
2183
+ x(o, -1);
2184
+ o.emit("change");
2185
+ break;
2186
+ case "d4-placeholder":
2187
+ if (e === null)
2188
+ return;
2189
+ e !== s && o.s.value.index < 0 && x(o, o.s.value.index);
2190
+ break;
2191
+ }
2192
+ }
2193
+ connectedCallback() {
2194
+ const t = this;
2195
+ t.initialize || t.classList.contains("d4-initialize") || (t.initialize = !0, d(this, It, $i).call(this));
2196
+ }
2197
+ open() {
2198
+ const t = this, e = t.querySelector(".dropdown-scroller").clientHeight, s = t.classList.contains("filter"), o = () => s ? t.querySelector(".dropdown-scroller .filter-bar") ? e : t.querySelector(".filter-bar").clientHeight + e : e;
2199
+ return _i(), t.setAttribute("d4-status", "open"), t.setAttribute("d4-default-height", o()), t.style.cssText = `--maxHeight: ${o()}px;`, t.s.dropdownEl.style.cssText = `
2200
+ height: ${o()}px;
2201
+ z-index: 2;
2202
+ `, this;
2203
+ }
2204
+ close() {
2205
+ const t = this, e = t.s.dropdownEl.querySelectorAll(".has-sublayer"), s = parseInt(t.getAttribute("d4-default-height"));
2206
+ return t.setAttribute("d4-status", "close"), t.s.dropdownEl.style.height = "0px", e.forEach((o) => {
2207
+ o.classList.remove("open");
2208
+ }), t.style.cssText = `--maxHeight: ${s}px;`, t.s.subDropdownTotalH = 0, this;
2209
+ }
2210
+ scrollTo(t) {
2211
+ const e = this, { viewport: s } = e.__scroller__.elements();
2212
+ s.scrollTo({
2213
+ top: t,
2214
+ behavior: "smooth"
2215
+ });
2216
+ }
2217
+ update() {
2218
+ this.__events__.selectOption();
2219
+ }
2220
+ }
2221
+ It = new WeakSet(), $i = function() {
2222
+ this.s = {}, this.__events__ = {}, this.hasAttribute("d4-status") || this.setAttribute("d4-status", "close"), this.hasAttribute("d4-value") || this.setAttribute("d4-value", ""), d(this, Ot, xi).call(this);
2223
+ }, Ot = new WeakSet(), xi = function() {
2224
+ this.s.childDom = this.childNodes, this.s.template = Is(this), this.innerHTML = "", this.append(this.s.template), d(this, Pt, Ci).call(this);
2225
+ }, Pt = new WeakSet(), Ci = function() {
2226
+ var s;
2227
+ const t = this;
2228
+ t.s.allLi = t.querySelectorAll(".dropdown-list li"), t.s.selectDisplayEl = t.querySelector(".select-display"), t.s.dropdownEl = t.querySelector(".dropdown"), t.s.selectType = t.hasAttribute("multiple") ? "multiple" : "single", t.s.cityLang = t.hasAttribute("city-lang") ? t.getAttribute("city-lang") : "zh-tw", Ps(t), t.s.subDropdownTotalH = 0;
2229
+ const e = t.getAttribute("d4-value");
2230
+ switch (t.s.selectType) {
2231
+ case "single":
2232
+ let o;
2233
+ if (t.classList.contains("dist")) {
2234
+ const r = document.querySelector(`dropdown-el[dist-select="${t.id}"]`), l = r ? r.getAttribute("d4-value") !== "" : !1;
2235
+ if (r && l) {
2236
+ const c = r.getAttribute("d4-value");
2237
+ if (Ns(t, c), t.s.allLi = t.querySelectorAll(".dropdown-list li"), t.classList.remove("disabled"), t.getAttribute("d4-value") !== "") {
2238
+ const u = e.split(",")[1];
2239
+ o = t.querySelector(`.dropdown-list li[data-option="${u}"]`), t.setAttribute("d4-value", u);
2240
+ }
2241
+ }
2242
+ } else
2243
+ o = t.querySelector(`.dropdown-list li[data-option="${e}"]`);
2244
+ w(o) ? (o.classList.add("active"), t.s.activeLi = o, t.s.value = {
2245
+ index: [...t.s.allLi].indexOf(o),
2246
+ id: e,
2247
+ el: o
2248
+ }) : (t.s.activeLi = void 0, t.s.value = {
2249
+ index: -1,
2250
+ id: void 0,
2251
+ el: void 0
2252
+ });
2253
+ break;
2254
+ case "multiple":
2255
+ const a = [];
2256
+ e.split(",").forEach((r) => {
2257
+ const l = t.querySelector(`.dropdown-list li[data-option="${r}"]`);
2258
+ w(l) && a.push(l);
2259
+ }), a.length > 0 ? t.s.value = {
2260
+ index: a.map((r) => [...t.s.allLi].indexOf(r)),
2261
+ id: a.map((r) => r.getAttribute("data-option")),
2262
+ el: a.map((r) => r)
2263
+ } : t.s.value = {
2264
+ index: [],
2265
+ id: void 0,
2266
+ el: void 0
2267
+ };
2268
+ break;
2269
+ }
2270
+ x(t, t.s.value.index), d(s = t, Nt, Hi).call(s), t.classList.add("d4-initialize");
2271
+ }, Nt = new WeakSet(), Hi = function() {
2272
+ const t = this;
2273
+ t.__events__.dropdownToggle = () => {
2274
+ t.addEventListener("click", function(e) {
2275
+ switch (e.stopPropagation(), t.getAttribute("d4-status")) {
2276
+ case "open":
2277
+ t.close();
2278
+ break;
2279
+ case "close":
2280
+ t.open();
2281
+ break;
2282
+ }
2283
+ });
2284
+ }, t.__events__.transitionend = () => {
2285
+ function e(s) {
2286
+ if (s.target === this) {
2287
+ const o = t.getAttribute("d4-status"), a = t.classList.contains("filter");
2288
+ switch (o) {
2289
+ case "open":
2290
+ const r = t.querySelector(".dropdown-scroller"), l = () => {
2291
+ if (t.__scroller__) {
2292
+ const { viewport: c } = t.__scroller__.elements();
2293
+ if (w(t.s.activeLi)) {
2294
+ const u = t.s.activeLi.clientHeight / 2, p = t.s.activeLi.offsetTop, g = p - r.clientHeight / 2 + u > 0 ? p - r.clientHeight / 2 + u : 0;
2295
+ c.scrollTo({
2296
+ top: g,
2297
+ behavior: "smooth"
2298
+ });
2299
+ } else
2300
+ c.scrollTo({
2301
+ top: 0,
2302
+ behavior: "smooth"
2303
+ });
2304
+ }
2305
+ };
2306
+ a && (t.querySelector(".filter-bar input").disabled = !1, t.querySelector(".filter-bar input").focus()), t.s.selectType === "single" && l();
2307
+ break;
2308
+ case "close":
2309
+ t.__scroller__.update(!0), t.s.dropdownEl.removeAttribute("style"), a && (t.querySelector(".filter-bar input").disabled = !0);
2310
+ break;
2311
+ }
2312
+ }
2313
+ }
2314
+ t.s.dropdownEl.addEventListener("transitionend", e);
2315
+ }, t.__events__.bindScrollbar = (e = this) => {
2316
+ const s = e.querySelector(".dropdown-scroller");
2317
+ e.__scroller__ = Me(s, {
2318
+ overflowBehavior: {
2319
+ x: "hidden"
2320
+ }
2321
+ });
2322
+ }, t.__events__.selectOption = (e = this) => {
2323
+ let s, o;
2324
+ const a = e.querySelector(".dropdown-scroller"), r = e.classList.contains("city");
2325
+ e.s.allLi = e.querySelectorAll(".dropdown-list li"), e.s.allLi.forEach((l) => {
2326
+ l.addEventListener("click", function(c) {
2327
+ var m;
2328
+ const u = this, p = [...e.s.allLi].indexOf(u), g = parseInt(e.getAttribute("d4-default-height"));
2329
+ if (u.classList.contains("has-sublayer")) {
2330
+ c.stopPropagation();
2331
+ const f = u.querySelector(".sub-dropdown"), b = f.querySelector(".sub-dropdown-list"), y = parseInt(getComputedStyle(b).marginTop) + parseInt(getComputedStyle(b).marginBottom);
2332
+ f.style.cssText = `--height: ${b.offsetHeight + y}px`;
2333
+ const H = parseInt(f.style.cssText.replace("--height:", "").trim()), G = parseInt(getComputedStyle(a).maxHeight), S = () => {
2334
+ s = g + e.s.subDropdownTotalH, o = s > G ? G : s, e.style.cssText = `--maxHeight: ${o}px;`, e.s.dropdownEl.style.height = `${o}px`;
2335
+ };
2336
+ u.classList.contains("open") ? (u.classList.remove("open"), e.s.subDropdownTotalH -= H, S()) : (u.classList.add("open"), e.s.subDropdownTotalH += H, S());
2337
+ const R = () => {
2338
+ e.__scroller__.update(!0), f.removeEventListener("transitionend", R);
2339
+ };
2340
+ f.addEventListener("transitionend", R);
2341
+ } else
2342
+ switch (Os(e), e.s.selectType) {
2343
+ case "single":
2344
+ if (e.setAttribute("d4-value", u.getAttribute("data-option")), r) {
2345
+ const f = e.s.cityLang, b = l.textContent.trim(), y = document.getElementById(e.getAttribute("dist-select"));
2346
+ y && (y.querySelector(".dropdown-list").textContent = "", x(y, -1), Oe[f][b].forEach((H, G) => {
2347
+ const S = document.createElement("li");
2348
+ S.textContent = H[0], S.setAttribute("data-option", H[0]), y.querySelector(".dropdown-list").append(S);
2349
+ }), e.__events__.selectOption(y));
2350
+ }
2351
+ (m = u.parentNode.closest("li")) != null && m.classList.contains("has-sublayer") && (c.stopPropagation(), e.close());
2352
+ break;
2353
+ case "multiple":
2354
+ c.stopPropagation(), u.classList.toggle("active"), x(e, p);
2355
+ break;
2356
+ }
2357
+ });
2358
+ });
2359
+ }, t.__events__.filterHandler = () => {
2360
+ t.classList.contains("filter") && (t.querySelector(".filter-bar").addEventListener("click", function(e) {
2361
+ e.stopPropagation();
2362
+ }), t.querySelector(".filter-input").addEventListener("input", function() {
2363
+ const e = this.value.toUpperCase();
2364
+ t.s.allLi.forEach((s) => {
2365
+ s.textContent.toUpperCase().includes(e) ? s.removeAttribute("style") : s.style.display = "none";
2366
+ });
2367
+ }));
2368
+ }, t.__events__.removeTag = () => {
2369
+ t.s.selectType !== "single" && t.s.selectDisplayEl.addEventListener("click", function(e) {
2370
+ if (e.target.classList.contains("select-display"))
2371
+ return;
2372
+ if ((e.target.classList.contains("option-btn") ? e.target : e.target.parentElement).contains(e.target) && (e.stopPropagation(), e.target.classList.contains("remove-icon"))) {
2373
+ const a = e.target.parentElement.getAttribute("data-option");
2374
+ t.s.dropdownEl.querySelector(`.dropdown-list li[data-option="${a}"]`).classList.remove("active"), t.s.activeLi = t.querySelectorAll(".dropdown-list li.active"), e.target.parentElement.remove();
2375
+ const r = [...t.s.activeLi];
2376
+ t.s.value = r.map((c) => ({
2377
+ index: [...t.s.allLi].indexOf(c),
2378
+ id: c.getAttribute("data-option"),
2379
+ el: c
2380
+ })), t.s.activeLi = r;
2381
+ const l = r.map((c) => c.getAttribute("data-option"));
2382
+ t.setAttribute("d4-value", l.join()), r.length <= 0 && (t.s.selectDisplayEl.textContent = t.getAttribute("d4-placeholder").trim());
2383
+ }
2384
+ });
2385
+ }, t.__events__.dropdownToggle(), t.__events__.bindScrollbar(), t.__events__.selectOption(), t.__events__.filterHandler(), t.__events__.removeTag(), t.__events__.transitionend();
2386
+ };
2387
+ Object.assign(ki.prototype, O);
2388
+ customElements.define("dropdown-el", ki);
2389
+ function ct(n) {
2390
+ const i = {};
2391
+ return [...n.attributes].forEach((t) => {
2392
+ if (t.name.includes("duration-")) {
2393
+ const e = t.name.replace("duration-", ""), s = t.nodeValue;
2394
+ i[e] = Number(s);
2395
+ }
2396
+ }), Object.keys(i).length === 0 ? null : i;
2397
+ }
2398
+ function Be(n) {
2399
+ if (ct(n)) {
2400
+ let i;
2401
+ const t = Object.keys(ct(n)).map((e) => ({
2402
+ value: e,
2403
+ point: e
2404
+ }));
2405
+ t.sort((e, s) => parseInt(s.value, 10) - parseInt(e.value, 10));
2406
+ for (let e = 0; e < t.length; e += 1) {
2407
+ const { point: s, value: o } = t[e];
2408
+ window.matchMedia(`(max-width: ${o}px)`).matches && (i = s);
2409
+ }
2410
+ return i ? Number(ct(n)[i]) : n.s.options.duration;
2411
+ } else
2412
+ return n.s.options.duration;
2413
+ }
2414
+ function zs(n) {
2415
+ const { behavior: i, continual: t, gap: e } = n.s.options, s = n.childNodes, o = document.createElement("div"), a = document.createElement("div");
2416
+ o.className = "animate-container", a.className = "animate-item", [...s].forEach((l) => {
2417
+ a.append(l);
2418
+ });
2419
+ function r() {
2420
+ const l = a.cloneNode(!0);
2421
+ return l.classList.add("clone"), n.s.cloneAnimation = null, n.s.cloneAnimateEl = l, l;
2422
+ }
2423
+ n.s.animation = null, n.s.animateEl = a, n.textContent = "", o.append(a), n.append(o), a.clientWidth * 2 + e >= n.clientWidth ? i === "normal" && t && o.append(r()) : n.s.options.continual = !1;
2424
+ }
2425
+ function _(n) {
2426
+ const { behavior: i, direction: t, continual: e } = n.s.options;
2427
+ let s = {};
2428
+ switch (i) {
2429
+ case "normal":
2430
+ let o, a;
2431
+ switch (t) {
2432
+ case "top":
2433
+ o = e ? "translate3d(0,100%,0)" : `translate3d(0,${n.clientHeight}px,0)`, a = "translate3d(0,-100%,0)", s.animate1 = [{ transform: o }, { transform: a }], e && (s.animate2 = [{ transform: "translate3d(0,0,0)" }, { transform: "translate3d(0,-200%,0)" }]);
2434
+ break;
2435
+ case "right":
2436
+ o = e ? "translate3d(0,0,0)" : "translate3d(-100%,0,0)", a = e ? "translate3d(200%,0,0)" : `translate3d(${n.clientWidth}px,0,0)`, s.animate1 = [{ transform: o }, { transform: a }], e && (s.animate2 = [{ transform: "translate3d(-100%,0,0)" }, { transform: "translate3d(100%,0,0)" }]);
2437
+ break;
2438
+ case "bottom":
2439
+ o = "translate3d(0,-100%,0)", a = e ? "translate3d(0,100%,0)" : `translate3d(0,${n.clientHeight}px,0)`, s.animate1 = [{ transform: o }, { transform: a }], e && (s.animate2 = [{ transform: "translate3d(0,-200%,0)" }, { transform: "translate3d(0,0,0)" }]);
2440
+ break;
2441
+ case "left":
2442
+ o = e ? "translate3d(100%,0,0)" : `translate3d(${n.clientWidth}px,0,0)`, a = "translate3d(-100%,0,0)", s.animate1 = [{ transform: o }, { transform: a }], e && (s.animate2 = [{ transform: "translate3d(0,0,0)" }, { transform: "translate3d(-200%,0,0)" }]);
2443
+ break;
2444
+ }
2445
+ break;
2446
+ case "alternate":
2447
+ switch (t) {
2448
+ case "top":
2449
+ s.animate1 = [{ transform: `translate3d(0,calc(${n.clientHeight}px - 100%),0)` }, { transform: "translate3d(0,0,0)" }, { transform: `translate3d(0,calc(${n.clientHeight}px - 100%),0)` }];
2450
+ break;
2451
+ case "right":
2452
+ s.animate1 = [{ transform: "translate3d(0,0,0)" }, { transform: `translate3d(calc(-100% + ${n.clientWidth}px),0,0)` }, { transform: "translate3d(0,0,0)" }];
2453
+ break;
2454
+ case "bottom":
2455
+ s.animate1 = [{ transform: "translate3d(0,0,0)" }, { transform: `translate3d(0,calc(${n.clientHeight}px - 100%),0)` }, { transform: "translate3d(0,0,0)" }];
2456
+ break;
2457
+ case "left":
2458
+ s.animate1 = [{ transform: `translate3d(calc(-100% + ${n.clientWidth}px),0,0)` }, { transform: "translate3d(0,0,0)" }, { transform: `translate3d(calc(-100% + ${n.clientWidth}px),0,0)` }];
2459
+ break;
2460
+ }
2461
+ break;
2462
+ case "endStop":
2463
+ switch (t) {
2464
+ case "top":
2465
+ s.animate1 = [{ transform: `translate3d(0,${n.clientHeight}px,0)` }, { transform: "translate3d(0,0,0)" }];
2466
+ break;
2467
+ case "right":
2468
+ s.animate1 = [{ transform: "translate3d(-100%,0,0)" }, { transform: "translate3d(0,0,0)" }];
2469
+ break;
2470
+ case "bottom":
2471
+ s.animate1 = [{ transform: "translate3d(0,-100%,0)" }, { transform: `translate3d(0,calc(${n.clientHeight}px - 100%),0)` }];
2472
+ break;
2473
+ case "left":
2474
+ s.animate1 = [{ transform: `translate3d(${n.clientWidth}px,0,0)` }, { transform: `translate3d(calc(${n.clientWidth}px - 100%),0,0)` }];
2475
+ break;
2476
+ }
2477
+ break;
2478
+ }
2479
+ return s;
2480
+ }
2481
+ function Ws(n) {
2482
+ let i;
2483
+ return function(t) {
2484
+ i && clearTimeout(i), i = setTimeout(n, 200, t);
2485
+ };
2486
+ }
2487
+ var jt, Mi, zt, qi, Wt, Ii, Bt, Oi;
2488
+ class Bs extends HTMLElement {
2489
+ constructor() {
2490
+ super();
2491
+ h(this, jt);
2492
+ h(this, zt);
2493
+ h(this, Wt);
2494
+ h(this, Bt);
2495
+ this.initialize = !1;
2496
+ }
2497
+ static get observedAttributes() {
2498
+ return [];
2499
+ }
2500
+ attributeChangedCallback(t, e, s) {
2501
+ }
2502
+ connectedCallback() {
2503
+ this.initialize || (this.initialize = !0, d(this, jt, Mi).call(this));
2504
+ }
2505
+ play() {
2506
+ this.s.animation.play(), this.s.animateEl.classList.add("start"), this.s.options.continual && (this.s.cloneAnimation.play(), this.s.cloneAnimateEl.classList.add("start"));
2507
+ }
2508
+ pause() {
2509
+ this.s.animation.pause(), this.s.options.continual && this.s.cloneAnimation.pause();
2510
+ }
2511
+ }
2512
+ jt = new WeakSet(), Mi = function() {
2513
+ const t = {
2514
+ direction: this.getAttribute("direction") || $.SETTINGS.direction,
2515
+ // up / down / left / right
2516
+ behavior: this.getAttribute("behavior") || $.SETTINGS.behavior,
2517
+ // normal / alternate / endStop
2518
+ duration: Number(this.getAttribute("duration")) || $.SETTINGS.duration,
2519
+ // ms
2520
+ durationBreakpoints: ct(this) || $.SETTINGS.durationBreakpoints,
2521
+ autoplay: this.getAttribute("autoplay") || $.SETTINGS.autoplay,
2522
+ // normal / alternate / endStop
2523
+ pauseOnMouseenter: this.getAttribute("pauseOnMouseEnter") ? this.getAttribute("pauseOnMouseEnter") === "true" : $.SETTINGS.pauseOnMouseenter,
2524
+ // true / false
2525
+ continual: this.getAttribute("continual") ? this.getAttribute("continual") === "true" : $.SETTINGS.continual,
2526
+ // true / false
2527
+ gap: Number(this.getAttribute("gap")) || $.SETTINGS.gap
2528
+ };
2529
+ this.s = {}, this.s.options = t, this.s.nowDuration = Be(this), zs(this), d(this, zt, qi).call(this);
2530
+ }, zt = new WeakSet(), qi = function() {
2531
+ const { direction: t, continual: e, gap: s } = this.s.options;
2532
+ switch (t) {
2533
+ case "left":
2534
+ case "right":
2535
+ this.style.cssText = `--continual-gap: ${s}px;`;
2536
+ break;
2537
+ case "top":
2538
+ case "bottom":
2539
+ e ? this.style.cssText = `height: ${this.s.animateEl.clientHeight}px;--continual-gap: ${s}px;` : this.style.cssText = `min-height: ${this.s.animateEl.clientHeight}px;--continual-gap: ${s}px;`;
2540
+ break;
2541
+ }
2542
+ d(this, Wt, Ii).call(this), d(this, Bt, Oi).call(this), e && this.classList.add("continual"), this.classList.add("m4-initialize");
2543
+ }, Wt = new WeakSet(), Ii = function() {
2544
+ const t = this, { direction: e, behavior: s, duration: o, autoplay: a, pauseOnMouseenter: r, continual: l } = t.s.options;
2545
+ let c;
2546
+ function u() {
2547
+ switch (s) {
2548
+ case "normal":
2549
+ t.s.animateEl.style.transform = `${_(t).animate1[0].transform}`, t.s.animation = t.s.animateEl.animate(_(t).animate1, {
2550
+ duration: t.s.nowDuration,
2551
+ iterations: 1 / 0
2552
+ }), l && (t.s.cloneAnimateEl.style.transform = `${_(t).animate2[0].transform}`, t.s.cloneAnimation = t.s.cloneAnimateEl.animate(_(t).animate2, {
2553
+ duration: t.s.nowDuration,
2554
+ delay: -t.s.nowDuration / 2,
2555
+ iterations: 1 / 0
2556
+ }));
2557
+ break;
2558
+ case "alternate":
2559
+ let m = function() {
2560
+ let f = [];
2561
+ switch (e) {
2562
+ case "top":
2563
+ p = Math.abs(t.s.animateEl.scrollHeight - t.clientHeight), g = parseInt(t.s.nowDuration / (p * 2)) * t.s.animateEl.scrollHeight, f = [{ transform: `translate3d(0,${t.clientHeight}px,0)` }, { transform: `translate3d(0,calc(${t.clientHeight}px - 100%),0)` }];
2564
+ break;
2565
+ case "right":
2566
+ p = Math.abs(t.s.animateEl.scrollWidth - t.clientWidth), g = parseInt(t.s.nowDuration / (p * 2)) * t.s.animateEl.scrollWidth, f = [{ transform: "translate3d(-100%,0,0)" }, { transform: "translate3d(0,0,0)" }];
2567
+ break;
2568
+ case "bottom":
2569
+ p = Math.abs(t.s.animateEl.scrollHeight - t.clientHeight), g = parseInt(o / (p * 2)) * t.s.animateEl.scrollHeight, f = [{ transform: "translate3d(0,-100%,0)" }, { transform: "translate3d(0,0,0)" }];
2570
+ break;
2571
+ case "left":
2572
+ p = Math.abs(t.s.animateEl.scrollWidth - t.clientWidth), g = parseInt(o / (p * 2)) * t.s.animateEl.scrollWidth, f = [{ transform: `translate3d(${t.clientWidth}px,0,0)` }, { transform: `translate3d(calc(-100% + ${t.clientWidth}px),0,0)` }];
2573
+ break;
2574
+ }
2575
+ return f;
2576
+ }, p, g;
2577
+ (t.clientHeight > t.s.animateEl.scrollHeight || e === "left" || e === "right") && (t.s.animateEl.style.transform = `${m()[0].transform}`, t.s.animateEl.animate(m(), {
2578
+ duration: g,
2579
+ fill: "forwards"
2580
+ }).finished.then(() => {
2581
+ t.s.animation = t.s.animateEl.animate(_(t).animate1, {
2582
+ duration: t.s.nowDuration,
2583
+ iterations: 1 / 0
2584
+ });
2585
+ })), t.s.animation && t.s.animation.ready.then(() => {
2586
+ t.s.animateEl.classList.add("ready");
2587
+ });
2588
+ break;
2589
+ case "endStop":
2590
+ t.s.animateEl.style.transform = `${_(t).animate1[0].transform}`, t.s.animation = t.s.animateEl.animate(_(t).animate1, {
2591
+ duration: t.s.nowDuration,
2592
+ fill: "forwards"
2593
+ });
2594
+ break;
2595
+ }
2596
+ t.s.animateEl.classList.add("start"), a === !1 && (t.s.animateEl.classList.remove("start"), t.s.animation.cancel());
2597
+ }
2598
+ clearTimeout(c), c = setTimeout(
2599
+ () => {
2600
+ u();
2601
+ },
2602
+ a || 0
2603
+ ), t.addEventListener("mouseenter", function() {
2604
+ t.s.animation && r && t.s.animation.playState === "running" && t.pause();
2605
+ }), t.addEventListener("mouseleave", function() {
2606
+ t.s.animation && r && t.s.animation.playState === "paused" && t.play();
2607
+ });
2608
+ }, Bt = new WeakSet(), Oi = function() {
2609
+ const t = this;
2610
+ function e() {
2611
+ const s = t.s.animation.startTime, o = t.s.cloneAnimation ? t.s.cloneAnimation.startTime : null;
2612
+ t.s.nowDuration = Be(t), t.s.animation.cancel(), t.s.cloneAnimation && t.s.cloneAnimation.cancel(), t.s.animation = t.s.animateEl.animate(_(t).animate1, {
2613
+ duration: t.s.nowDuration,
2614
+ iterations: 1 / 0
2615
+ }), t.s.animation.startTime = s, t.s.cloneAnimation && (t.s.cloneAnimation = t.s.cloneAnimateEl.animate(_(t).animate2, {
2616
+ duration: t.s.nowDuration,
2617
+ delay: -t.s.nowDuration / 2,
2618
+ iterations: 1 / 0
2619
+ }), t.s.cloneAnimation.startTime = o);
2620
+ }
2621
+ window.addEventListener("resize", Ws(e));
2622
+ };
2623
+ customElements.define("marquee-el", Bs);
2624
+ const ht = function(n, i) {
2625
+ let t;
2626
+ return function(e) {
2627
+ t && clearTimeout(t), t = setTimeout(n, 200, e);
2628
+ };
2629
+ }, k = (n, i) => {
2630
+ if (rt(n)) {
2631
+ n.forEach((t) => {
2632
+ t.classList.add(i);
2633
+ });
2634
+ return;
2635
+ }
2636
+ n.classList.add(i);
2637
+ }, D = (n, i) => {
2638
+ if (rt(n)) {
2639
+ n.forEach((t) => {
2640
+ t.classList.remove(i);
2641
+ });
2642
+ return;
2643
+ }
2644
+ n.classList.remove(i);
2645
+ };
2646
+ var Gt, Pi, Rt, Ni, Xt, ji, tt, _e, W, dt, Ft, zi;
2647
+ class Ge {
2648
+ constructor(i) {
2649
+ // 初始化
2650
+ h(this, Gt);
2651
+ // 左右箭頭事件綁定
2652
+ h(this, Rt);
2653
+ // 左右拖拉事件綁定
2654
+ h(this, Xt);
2655
+ // 卷軸位置判斷
2656
+ h(this, tt);
2657
+ // 隱藏按鈕判斷
2658
+ h(this, W);
2659
+ // 選項事件綁定
2660
+ h(this, Ft);
2661
+ this.$element = i, this.option = i.s.option.drag, d(this, Gt, Pi).call(this);
2662
+ }
2663
+ // 更新 active 位置
2664
+ update(i) {
2665
+ const t = this.$element.querySelector(".wrapper"), e = t == null ? void 0 : t.querySelector(".active");
2666
+ if (e) {
2667
+ const s = e.offsetLeft + e.getBoundingClientRect().width / 2 - t.getBoundingClientRect().width / 2;
2668
+ t.scrollTo({
2669
+ left: s,
2670
+ behavior: "smooth"
2671
+ });
2672
+ }
2673
+ }
2674
+ }
2675
+ Gt = new WeakSet(), Pi = function() {
2676
+ var e, s, o, a, r, l;
2677
+ const i = this;
2678
+ if (!i.$element)
2679
+ return;
2680
+ i.$container = i.$element.querySelector(".drag-container"), i.$wrapper = i.$container.querySelector(".wrapper");
2681
+ const t = () => {
2682
+ var c, u;
2683
+ d(c = i, tt, _e).call(c), d(u = i, W, dt).call(u);
2684
+ };
2685
+ i.$wrapper.removeEventListener("scroll", t), i.$wrapper.addEventListener("scroll", t), window.removeEventListener("resize", ht(t)), window.addEventListener("resize", ht(t)), (i.option.draggable || i.$element.s.type == "collapse") && d(e = i, Xt, ji).call(e), i.option.navigation && i.$element.s.type !== "collapse" && (i.$container.insertAdjacentHTML(
2686
+ E.prepend,
2687
+ `<div class="navigation">
2688
+ <div class="button prev">
2689
+ <div></div>
2690
+ </div>
2691
+ <div class="button next">
2692
+ <div></div>
2693
+ </div>
2694
+ </div>`
2695
+ ), i.$button = (s = i.$container) == null ? void 0 : s.querySelectorAll(".button"), d(o = i, Rt, Ni).call(o)), d(a = i, tt, _e).call(a), d(r = i, W, dt).call(r), d(l = i, Ft, zi).call(l), i.update();
2696
+ }, Rt = new WeakSet(), Ni = function() {
2697
+ const i = this, { $wrapper: t, $button: e } = i, s = function() {
2698
+ const o = this.classList.contains("next"), a = parseInt(t.getBoundingClientRect().width * 0.7);
2699
+ t.scrollTo({
2700
+ left: o ? t.scrollLeft + a : t.scrollLeft - a,
2701
+ behavior: "smooth"
2702
+ }), setTimeout(() => {
2703
+ var r;
2704
+ d(r = i, W, dt).call(r);
2705
+ }, 100);
2706
+ };
2707
+ e.forEach((o) => {
2708
+ o.removeEventListener("click", s), o.addEventListener("click", s);
2709
+ });
2710
+ }, Xt = new WeakSet(), ji = function() {
2711
+ const { $wrapper: i } = this;
2712
+ let t = !1, e = !1, s = 0, o = 0;
2713
+ const a = function(p) {
2714
+ p.preventDefault(), e = !1, t = !0, s = p.pageX - i.offsetLeft, o = i.scrollLeft;
2715
+ };
2716
+ i.removeEventListener("mousedown", a), i.addEventListener("mousedown", a);
2717
+ const r = function() {
2718
+ e = !1, t = !1;
2719
+ };
2720
+ i.removeEventListener("mouseleave", r), i.addEventListener("mouseleave", r);
2721
+ const l = function(p) {
2722
+ p.preventDefault(), t = !1;
2723
+ };
2724
+ i.removeEventListener("mouseup", l), i.addEventListener("mouseup", l);
2725
+ const c = function(p) {
2726
+ if (p.preventDefault(), e = !0, !t)
2727
+ return;
2728
+ const m = p.pageX - i.offsetLeft - s;
2729
+ i.scrollTo({
2730
+ left: o - m
2731
+ });
2732
+ };
2733
+ i.removeEventListener("mousemove", c), i.addEventListener("mousemove", c);
2734
+ const u = function(p) {
2735
+ e && (p.preventDefault(), p.stopPropagation());
2736
+ };
2737
+ i.querySelectorAll("a").forEach((p) => {
2738
+ p.removeEventListener("click", u), p.addEventListener("click", u);
2739
+ });
2740
+ }, tt = new WeakSet(), _e = function() {
2741
+ const { $container: i, $wrapper: t } = this, e = t.scrollWidth - t.clientWidth, s = t.scrollLeft;
2742
+ e <= 0 || (k(i, "scrollable"), s == 0 ? (D(i, "scrollable"), k(t, "start"), D(t, "end")) : s >= e ? (D(i, "scrollable"), D(t, "start"), k(t, "end")) : (k(t, "center"), D(t, "start"), D(t, "end")));
2743
+ }, W = new WeakSet(), dt = function() {
2744
+ const { $wrapper: i, $button: t, $element: e } = this;
2745
+ if (!t)
2746
+ return;
2747
+ const s = i.scrollWidth - i.clientWidth, o = i.scrollLeft;
2748
+ if (s <= 0) {
2749
+ k(t, "hide"), D(t, "active"), k(e, "noScrollable");
2750
+ return;
2751
+ }
2752
+ s > 0 && (k(t, "active"), D(e, "noScrollable")), o == 0 ? t.forEach((a) => {
2753
+ if (a.classList.contains("next")) {
2754
+ D(a, "hide");
2755
+ return;
2756
+ }
2757
+ k(a, "hide");
2758
+ }) : o >= s ? t.forEach((a) => {
2759
+ if (a.classList.contains("next")) {
2760
+ k(a, "hide");
2761
+ return;
2762
+ }
2763
+ D(a, "hide");
2764
+ }) : D(t, "hide");
2765
+ }, Ft = new WeakSet(), zi = function() {
2766
+ const { $element: i } = this, t = (s) => {
2767
+ if (this.option.selected) {
2768
+ const o = s.getAttribute("data-option").trim();
2769
+ i.setAttribute("m4-status", o);
2770
+ }
2771
+ };
2772
+ function e() {
2773
+ t(this);
2774
+ }
2775
+ this.$container.querySelectorAll(".item").forEach((s) => {
2776
+ s.removeEventListener("click", e), s.addEventListener("click", e);
2777
+ });
2778
+ };
2779
+ var Yt, Wi, Ut, Bi, Jt, Gi, Zt, Ri;
2780
+ class Gs {
2781
+ constructor(i) {
2782
+ // 初始化
2783
+ h(this, Yt);
2784
+ // 隱藏按鈕判斷
2785
+ h(this, Ut);
2786
+ // 展開箭頭事件綁定
2787
+ h(this, Jt);
2788
+ // 選項事件綁定
2789
+ h(this, Zt);
2790
+ this.$element = i, this.option = i.s.option.collapse, d(this, Yt, Wi).call(this);
2791
+ }
2792
+ }
2793
+ Yt = new WeakSet(), Wi = function() {
2794
+ this.$element && (this.$container = this.$element.querySelector(".collapse-container"), this.$wrapper = this.$container.querySelector(".wrapper"), d(this, Ut, Bi).call(this) && d(this, Jt, Gi).call(this), d(this, Zt, Ri).call(this));
2795
+ }, Ut = new WeakSet(), Bi = function() {
2796
+ const i = this.$element.querySelector(".drag-container"), t = i.querySelector(".wrapper");
2797
+ return t.scrollWidth - t.clientWidth > 0 ? (i.insertAdjacentHTML(E.append, '<div class="open-collapse"></div>'), this.$button = i.querySelector(".open-collapse"), !0) : !1;
2798
+ }, Jt = new WeakSet(), Gi = function() {
2799
+ const { $element: i, $button: t } = this, e = function() {
2800
+ i.classList.contains("expand") ? i.classList.remove("expand") : i.classList.add("expand");
2801
+ };
2802
+ t.removeEventListener("click", e), t.addEventListener("click", e);
2803
+ }, Zt = new WeakSet(), Ri = function() {
2804
+ const { $element: i } = this, t = (s, o) => {
2805
+ if (i != null && i.classList.contains("expand") ? i == null || i.classList.remove("expand") : i == null || i.classList.add("expand"), this.option.selected) {
2806
+ const a = s.getAttribute("data-option").trim();
2807
+ i.setAttribute("m4-status", a);
2808
+ }
2809
+ };
2810
+ function e() {
2811
+ t(this);
2812
+ }
2813
+ this.$container.querySelectorAll(".item").forEach((s) => {
2814
+ s.removeEventListener("click", e), s.addEventListener("click", e);
2815
+ });
2816
+ };
2817
+ const Rs = (n) => {
2818
+ const { type: i, option: t, originalDomString: e } = n.s, s = document.createElement("div");
2819
+ return i == "drag" && (s.innerHTML = C.TEMPLATE[i]().trim(), s.querySelector(".drag-container .wrapper").insertAdjacentHTML(E.append, e)), i == "collapse" && (s.innerHTML = C.TEMPLATE[i](t == null ? void 0 : t.collapse).trim(), s.querySelector(".drag-container .wrapper").insertAdjacentHTML(E.append, e), s.querySelector(".collapse-container .wrapper").insertAdjacentHTML(E.append, e)), i == "dropdown" && (s.innerHTML = C.TEMPLATE[i](t == null ? void 0 : t.dropdown).trim(), s.querySelector("dropdown-el").insertAdjacentHTML(E.append, e)), s.children;
2820
+ };
2821
+ var Qt, Xi, Vt, Fi, et, ke, B, ut;
2822
+ class Xs extends HTMLElement {
2823
+ constructor() {
2824
+ super();
2825
+ h(this, Qt);
2826
+ h(this, Vt);
2827
+ // 斷點設定
2828
+ h(this, et);
2829
+ // check type
2830
+ h(this, B);
2831
+ this.initialize = !1, this.__events__ = {}, this.s = {}, this.s.originalDomString = this.innerHTML.trim().replace(/\n/g, ""), this.previousWidth = window.innerWidth;
2832
+ }
2833
+ static get observedAttributes() {
2834
+ return ["m4-type", "m4-status"];
2835
+ }
2836
+ attributeChangedCallback(t, e, s) {
2837
+ var o, a, r;
2838
+ switch (t) {
2839
+ case "m4-type":
2840
+ if (e === null || e === s)
2841
+ return;
2842
+ this.s.type = s, d(this, B, ut).call(this);
2843
+ break;
2844
+ case "m4-status":
2845
+ if (e === s)
2846
+ return;
2847
+ const l = this.getAttribute("m4-type");
2848
+ if (l !== "drag" && l !== "collapse")
2849
+ return;
2850
+ this.querySelectorAll(".drag-container .item").forEach((c) => {
2851
+ c.classList.remove("active");
2852
+ }), (o = this.querySelector(`.drag-container .item[data-option="${s}"]`)) == null || o.classList.add("active"), l === "collapse" && (this.querySelectorAll(".collapse-container .item").forEach((c) => {
2853
+ c.classList.remove("active");
2854
+ }), (a = this.querySelector(`.collapse-container .item[data-option="${s}"]`)) == null || a.classList.add("active")), (r = this.constructor.drag) == null || r.update(this);
2855
+ break;
2856
+ }
2857
+ }
2858
+ connectedCallback() {
2859
+ this.initialize || this.classList.contains("m4-init") || (this.initialize = !0, d(this, Qt, Xi).call(this));
2860
+ }
2861
+ update() {
2862
+ d(this, et, ke).call(this);
2863
+ }
2864
+ }
2865
+ Qt = new WeakSet(), Xi = function() {
2866
+ let t = {};
2867
+ this.hasAttribute("m4-value") || this.setAttribute("m4-value", ""), this.s.type = this.getAttribute("m4-type") ?? C.SETTINGS.type, this.hasAttribute("m4-option") && (t = this.getAttribute("m4-option") ? JSON.parse(this.getAttribute("m4-option")) : {}, this.removeAttribute("m4-option"));
2868
+ const e = (s) => {
2869
+ if (s.type === "resize") {
2870
+ if (window.innerWidth === this.previousWidth)
2871
+ return;
2872
+ this.previousWidth = window.innerWidth;
2873
+ }
2874
+ this.update();
2875
+ };
2876
+ window.removeEventListener("resize", ht(e)), window.addEventListener("resize", ht(e)), this.s.option = {}, this.s.option.drag = Object.assign({}, C.SETTINGS.drag, t == null ? void 0 : t.drag), this.s.option.collapse = Object.assign({}, C.SETTINGS.collapse, t == null ? void 0 : t.collapse), this.s.option.dropdown = Object.assign({}, C.SETTINGS.dropdown, t == null ? void 0 : t.dropdown), this.s.option.breakpoint = Object.assign({}, C.SETTINGS.breakpoint, t == null ? void 0 : t.breakpoint), d(this, Vt, Fi).call(this);
2877
+ }, Vt = new WeakSet(), Fi = function() {
2878
+ this.classList.add("m4-init"), d(this, et, ke).call(this);
2879
+ }, et = new WeakSet(), ke = function() {
2880
+ const t = Object.keys(this.s.option.breakpoint);
2881
+ if (!t.length) {
2882
+ d(this, B, ut).call(this);
2883
+ return;
2884
+ }
2885
+ t.map((e) => Number(e)).sort((e, s) => s - e).some((e) => {
2886
+ var s, o, a, r;
2887
+ return window.innerWidth >= e && (this.s.type = (s = this.s.option.breakpoint[e]) == null ? void 0 : s.type, this.setAttribute("m4-type", this.s.type), this.s.option.drag = Object.assign({}, this.s.option.drag, (o = this.s.option.breakpoint[e]) == null ? void 0 : o.drag), this.s.option.collapse = Object.assign({}, this.s.option.collapse, (a = this.s.option.breakpoint[e]) == null ? void 0 : a.collapse), this.s.option.dropdown = Object.assign({}, this.s.option.dropdown, (r = this.s.option.breakpoint[e]) == null ? void 0 : r.dropdown)), d(this, B, ut).call(this), window.innerWidth >= e;
2888
+ });
2889
+ }, B = new WeakSet(), ut = function() {
2890
+ var o;
2891
+ const { type: t } = this.s;
2892
+ this.innerHTML = "", [...Rs(this)].forEach((a) => {
2893
+ this.append(a);
2894
+ });
2895
+ const e = this.querySelector(`.drag-container .item[data-option="${this.getAttribute("m4-status")}"]`), s = this.querySelector(`.collapse-container .item[data-option="${this.getAttribute("m4-status")}"]`);
2896
+ switch (e == null || e.classList.add("active"), s == null || s.classList.add("active"), t) {
2897
+ case "drag":
2898
+ setTimeout(() => {
2899
+ this.constructor.drag = new Ge(this);
2900
+ }, 10);
2901
+ break;
2902
+ case "collapse":
2903
+ setTimeout(() => {
2904
+ this.constructor.drag = new Ge(this), this.constructor.collapse = new Gs(this);
2905
+ }, 10);
2906
+ break;
2907
+ }
2908
+ (o = this.constructor.drag) == null || o.update(this);
2909
+ };
2910
+ customElements.define("multipurpose-nav", Xs);
2911
+ var Kt, Ui, te, Ji, it, $e, N, F, ee, Zi, ie, Qi, se, Vi, ne, Ki, oe, ts, ae, es, re, is, le, ss, ce, ns, q, z, de, os, ue, as, he, rs, pe, ls;
2912
+ class Yi extends HTMLElement {
2913
+ // 定義組件的初始狀態
2914
+ constructor(t, e) {
2915
+ super();
2916
+ h(this, Kt);
2917
+ h(this, te);
2918
+ // 第一關 判斷數量以及id設定
2919
+ h(this, it);
2920
+ // 第二關 id命名提醒
2921
+ h(this, N);
2922
+ h(this, ee);
2923
+ h(this, ie);
2924
+ h(this, se);
2925
+ // 執行函式
2926
+ // 移動至指定位置
2927
+ h(this, ne);
2928
+ // 移動
2929
+ h(this, oe);
2930
+ // 步驟狀態
2931
+ h(this, ae);
2932
+ // next 按鈕狀態
2933
+ h(this, re);
2934
+ // prev 按鈕狀態
2935
+ h(this, le);
2936
+ // 頁籤狀態
2937
+ h(this, ce);
2938
+ // 第三關各種元件判斷 及 執行
2939
+ h(this, q);
2940
+ // 消失動畫
2941
+ h(this, de);
2942
+ // 出現動畫
2943
+ h(this, ue);
2944
+ // 狀態
2945
+ h(this, he);
2946
+ // resize
2947
+ h(this, pe);
2948
+ }
2949
+ // 當組件的屬性被更改時會被呼叫
2950
+ static get observedAttributes() {
2951
+ return ["t4-active"];
2952
+ }
2953
+ attributeChangedCallback(t, e, s) {
2954
+ t === "t4-active" && e !== s && d(this, he, rs).call(this, s);
2955
+ }
2956
+ connectedCallback() {
2957
+ this.classList.contains("t4-initialize") || d(this, Kt, Ui).call(this);
2958
+ }
2959
+ // ------------- 我是分隔線呦 -------------
2960
+ // 頁籤切換
2961
+ tabClick(t) {
2962
+ const { t: e } = this, s = e.tabs.indexOf(t) % e.tabPanels.length, o = e.tabGroup === "true" ? String(s) : t.getAttribute("t4-id");
2963
+ this.setActiveTab(o), setTimeout(() => {
2964
+ d(this, q, z).call(this, "eventAnchor");
2965
+ }, e.transition.duration);
2966
+ }
2967
+ // 外部呼叫方法 $0.setActiveTab(0)
2968
+ setActiveTab(t) {
2969
+ const { t: e } = this, s = t === "" ? e.tabPanels[0].getAttribute("t4-id") : t;
2970
+ e.activeTab = s, this.setAttribute("t4-active", s);
2971
+ const o = d(this, N, F).call(this, s);
2972
+ e.tabPanels.forEach((a, r) => {
2973
+ r === o ? d(this, ue, as).call(this, r) : d(this, de, os).call(this, r);
2974
+ });
2975
+ }
2976
+ // 外部呼叫方法 $0.goNext()
2977
+ goNext() {
2978
+ const t = d(this, N, F).call(this, this.t.activeTab), e = Math.min(this.t.tabPanels.length - 1, t + 1), s = this.t.tabPanels[e].getAttribute("t4-id");
2979
+ this.setActiveTab(s);
2980
+ }
2981
+ // 外部呼叫方法 $0.goPrev()
2982
+ goPrev() {
2983
+ const t = d(this, N, F).call(this, this.t.activeTab), e = Math.max(0, t - 1), s = this.t.tabPanels[e].getAttribute("t4-id");
2984
+ this.setActiveTab(s);
2985
+ }
2986
+ // 外部呼叫方法 $0.update()
2987
+ update() {
2988
+ this.t.tabs = d(this, it, $e).call(this), cs(), console.log("tab update!!!!");
2989
+ }
2990
+ }
2991
+ Kt = new WeakSet(), Ui = function() {
2992
+ const t = this.getAttribute("t4-name"), { SETTINGS: e } = Ue;
2993
+ document.querySelectorAll(`tab-el[t4-name=${t}]`).length > 1 && console.warn(t, "名字有重複喔!!!"), this.t = {
2994
+ tabs: [],
2995
+ name: t,
2996
+ tabPanels: [...this.children],
2997
+ activeTab: "",
2998
+ stepOutput: e.stepOutput,
2999
+ recordUrl: this.getAttribute("t4-url") || e.recordUrl,
3000
+ type: this.getAttribute("t4-type") || e.type,
3001
+ display: this.getAttribute("t4-display") || e.display,
3002
+ defaultPage: this.getAttribute("t4-defaultPage") || e.defaultPage,
3003
+ anchor: this.getAttribute("t4-anchor"),
3004
+ gap: this.getAttribute("t4-gap") || e.anchorGap,
3005
+ transition: {
3006
+ duration: this.getAttribute("t4-duration") || e.transition.duration,
3007
+ timing: this.getAttribute("t4-timing") || e.transition.timing,
3008
+ delay: this.getAttribute("t4-delay") || e.transition.delay
3009
+ },
3010
+ tabGroup: this.getAttribute("t4-group") || e.tabGroup
3011
+ }, this.__events__ = {}, this.t.tabs = d(this, it, $e).call(this), this.t.step = document.querySelector(`[t4-control="${this.t.name}"]${this.t.stepOutput}`), d(this, te, Ji).call(this);
3012
+ }, te = new WeakSet(), Ji = function() {
3013
+ if (this.t.activeTab = this.t.defaultPage, this.t.display === "swiper" && d(this, ee, Zi).call(this), this.t.recordUrl) {
3014
+ const e = new URLSearchParams(document.location.search).get(this.t.name), s = document.querySelectorAll(`[t4-name="${this.t.name}"] .tab-panel[t4-id="${e}"]`);
3015
+ e && s.length === 1 ? this.t.activeTab = e : console.warn(`沒有${e}這頁喔!!`);
3016
+ }
3017
+ this.setActiveTab(this.t.activeTab), this.classList.add("t4-initialize"), d(this, pe, ls).call(this);
3018
+ }, it = new WeakSet(), $e = function() {
3019
+ const { t } = this, e = Array.from(document.querySelectorAll(`[t4-control="${t.name}"][t4-role="tab"]`));
3020
+ return t.type === "normal" && t.tabGroup === "true" && t.tabPanels.length !== e.length && console.warn("按鈕與內容數量不同喔", t.tabPanels.length, e.length), t.tabGroup === "true" ? t.tabPanels.forEach((s, o) => s.setAttribute("t4-id", o)) : t.tabPanels.forEach((s) => {
3021
+ s.getAttribute("t4-id") || console.warn(s, "請幫我設定id!!");
3022
+ }), e;
3023
+ }, N = new WeakSet(), F = function(t) {
3024
+ const { t: e } = this, s = e.tabPanels.filter((a) => a.getAttribute("t4-id") === t);
3025
+ s.length > 1 && console.warn("有兩個相同id設定", s);
3026
+ const o = s[0];
3027
+ return o ? e.tabPanels.indexOf(o) : (console.warn(`找不到t4-id為${t}的頁籤`), 0);
3028
+ }, ee = new WeakSet(), Zi = function() {
3029
+ const t = document.createElement("div");
3030
+ t.classList.add("swiper-container");
3031
+ const e = document.createElement("div");
3032
+ e.classList.add("swiper-wrapper"), this.t.tabPanels.forEach((s) => {
3033
+ e.appendChild(s.cloneNode(!0));
3034
+ }), this.t.tabPanels = [...e.children], t.appendChild(e), this.innerHTML = "", this.appendChild(t), d(this, ie, Qi).call(this);
3035
+ }, ie = new WeakSet(), Qi = function() {
3036
+ const t = this.querySelector(".swiper-container"), e = this.querySelector(".swiper-wrapper"), s = this.t.tabPanels;
3037
+ t.style.overflow = "hidden", e.style.display = "flex";
3038
+ const o = s.length * 100 + "%";
3039
+ e.style.width = o;
3040
+ }, se = new WeakSet(), Vi = function(t) {
3041
+ const { t: e } = this;
3042
+ if (e.recordUrl === "true") {
3043
+ const s = new URLSearchParams(document.location.search);
3044
+ s.set(e.name, t);
3045
+ const o = `${window.location.pathname}?${s.toString()}`;
3046
+ history.replaceState({ t4Id: t }, "", o);
3047
+ }
3048
+ }, ne = new WeakSet(), Ki = function() {
3049
+ const t = parseInt(this.t.gap, 10), e = window.pageYOffset, o = this.getBoundingClientRect().top + e - t;
3050
+ d(this, oe, ts).call(this, o);
3051
+ }, oe = new WeakSet(), ts = function(t) {
3052
+ window.scrollTo({
3053
+ top: t,
3054
+ behavior: "smooth"
3055
+ });
3056
+ }, ae = new WeakSet(), es = function(t) {
3057
+ let e = parseInt(t, 10) + 1;
3058
+ this.t.step.textContent = `${e}`, this.t.step.setAttribute("now-page", e);
3059
+ }, re = new WeakSet(), is = function(t) {
3060
+ const e = document.querySelectorAll(`[t4-role="next"][t4-control="${this.t.name}"]`), s = this.t.tabPanels.length === 1, o = t === this.t.tabPanels.length - 1;
3061
+ e.forEach((a) => {
3062
+ s || o ? a.setAttribute("disabled", "") : a.removeAttribute("disabled");
3063
+ });
3064
+ }, le = new WeakSet(), ss = function(t) {
3065
+ const e = document.querySelectorAll(`[t4-role="prev"][t4-control="${this.t.name}"]`), s = this.t.tabPanels.length === 1, o = t === 0;
3066
+ e.forEach((a) => {
3067
+ s || o ? a.setAttribute("disabled", "") : a.removeAttribute("disabled");
3068
+ });
3069
+ }, ce = new WeakSet(), ns = function(t, e) {
3070
+ this.t.tabGroup === "true" ? this.t.tabs.forEach((s, o) => {
3071
+ o == t ? s.setAttribute("aria-selected", !0) : s.setAttribute("aria-selected", !1);
3072
+ }) : this.t.tabs.forEach((s, o) => {
3073
+ s.getAttribute("t4-id") === e ? s.setAttribute("aria-selected", !0) : s.setAttribute("aria-selected", !1);
3074
+ });
3075
+ }, q = new WeakSet(), z = function(t, e, s) {
3076
+ switch (t) {
3077
+ case "step":
3078
+ ye(this.t.step) && d(this, ae, es).call(this, e);
3079
+ break;
3080
+ case "eventAnchor":
3081
+ this.t.anchor && d(this, ne, Ki).call(this);
3082
+ break;
3083
+ case "tabState":
3084
+ this.t.type == "normal" && d(this, ce, ns).call(this, e, s);
3085
+ break;
3086
+ case "btnState":
3087
+ d(this, re, is).call(this, e), d(this, le, ss).call(this, e);
3088
+ break;
3089
+ case "tabUrl":
3090
+ this.t.recordUrl === "true" && d(this, se, Vi).call(this, e);
3091
+ break;
3092
+ default:
3093
+ console.warn("請增加判斷,謝謝");
3094
+ break;
3095
+ }
3096
+ }, de = new WeakSet(), os = function(t) {
3097
+ const { t: e } = this;
3098
+ this.t.transition;
3099
+ const s = e.tabPanels[t];
3100
+ switch (s.classList.remove("show"), s.classList.add("hide"), e.display) {
3101
+ case "fade":
3102
+ s.style.cssText = "display: none; opacity: 0;";
3103
+ break;
3104
+ case "slide":
3105
+ s.style.cssText = "display: none; opacity: 0; max-height: unset;";
3106
+ break;
3107
+ case "swiper":
3108
+ break;
3109
+ default:
3110
+ s.style.display = "none";
3111
+ break;
3112
+ }
3113
+ }, ue = new WeakSet(), as = function(t) {
3114
+ const { duration: e, timing: s, delay: o } = this.t.transition, a = this.t.tabPanels[t];
3115
+ let r;
3116
+ switch (a.classList.add("show"), a.classList.remove("hide"), a.style.transition = `opacity ${e}ms ${s} ${o}ms`, a.style.display = "block", this.t.display) {
3117
+ case "fade":
3118
+ a.style.opacity = "0", r = setTimeout(() => {
3119
+ clearTimeout(r), a.style.opacity = "1";
3120
+ }, 100);
3121
+ break;
3122
+ case "slide":
3123
+ console.warn(this.t.display, "抱歉,好像壞掉了...");
3124
+ const l = a.offsetHeight;
3125
+ a.style.opacity = "1", a.style.maxHeight = "0", r = setTimeout(() => {
3126
+ clearTimeout(r), a.style.maxHeight = l + "px";
3127
+ }, 100);
3128
+ break;
3129
+ case "swiper":
3130
+ a.style.opacity = "1";
3131
+ const c = this.querySelector(".swiper-wrapper"), u = this.t.tabPanels[0].offsetWidth, p = -t * u;
3132
+ c.style.transition = `transform ${e}ms ${s} ${o}ms`, c.style.transform = `translateX(${p}px)`;
3133
+ break;
3134
+ default:
3135
+ console.warn(this.t.display, "沒有這個效果請自己想辦法!!!!");
3136
+ break;
3137
+ }
3138
+ }, he = new WeakSet(), rs = function(t) {
3139
+ const e = d(this, N, F).call(this, t);
3140
+ d(this, q, z).call(this, "step", e), d(this, q, z).call(this, "btnState", e), d(this, q, z).call(this, "tabState", e, t), d(this, q, z).call(this, "tabUrl", t), this.emit("change");
3141
+ }, pe = new WeakSet(), ls = function() {
3142
+ const t = this;
3143
+ window.addEventListener(
3144
+ "resize",
3145
+ Fs(() => {
3146
+ t.update();
3147
+ }, 1e3)
3148
+ );
3149
+ };
3150
+ function Fs(n, i = 1e3) {
3151
+ let t;
3152
+ return function(e) {
3153
+ t && clearTimeout(t), t = setTimeout(n, i, e);
3154
+ };
3155
+ }
3156
+ function cs() {
3157
+ const n = document.querySelectorAll("[t4-control]");
3158
+ document.addEventListener("click", function(i) {
3159
+ let t = !1;
3160
+ for (const e of n)
3161
+ if (e.contains(i.target) || i.target.closest("[t4-control]") === e) {
3162
+ t = !0;
3163
+ break;
3164
+ }
3165
+ if (t) {
3166
+ const e = i.target.closest("[t4-control]"), s = e.getAttribute("t4-control"), o = document.querySelectorAll(`tab-el[t4-name="${s}"]`), a = e.getAttribute("t4-role");
3167
+ o.forEach((r) => {
3168
+ switch (a) {
3169
+ case "tab":
3170
+ r.tabClick(e);
3171
+ break;
3172
+ case "next":
3173
+ r.goNext(e);
3174
+ break;
3175
+ case "prev":
3176
+ r.goPrev(e);
3177
+ break;
3178
+ default:
3179
+ console.warn("你是誰??", e);
3180
+ break;
3181
+ }
3182
+ });
3183
+ }
3184
+ });
3185
+ }
3186
+ cs();
3187
+ Object.assign(Yi.prototype, O);
3188
+ customElements.define("tab-el", Yi);
3189
+ const Re = (n) => {
3190
+ const { defaultOptions: i } = n.collapse, { collapseClass: t, target: e, transition: s } = i, o = n.querySelector(e);
3191
+ n.classList.add(t), o.style.height = 0, o.style["transition-property"] = s.property, o.style["transition-duration"] = s.duration, o.style["transition-timing-function"] = s.function, o.style["transition-delay"] = s.delay, o.style.overflow = "hidden";
3192
+ }, Ys = (n) => {
3193
+ const { defaultOptions: i } = n.collapse, { collapseClass: t, target: e, transition: s } = i, o = n.querySelector(e), a = o.children[0].offsetHeight;
3194
+ n.collapse.height = a, n.classList.remove(t), o.style.display = "block", o.style.height = `${a}px`, o.style["transition-property"] = s.property, o.style["transition-duration"] = s.duration, o.style["transition-timing-function"] = s.function, o.style["transition-delay"] = s.delay, o.style.overflow = "hidden";
3195
+ };
3196
+ var st, xe, me, ds, ge, us, nt, Ce;
3197
+ class Us {
3198
+ constructor(i, t = {}) {
3199
+ h(this, st);
3200
+ h(this, me);
3201
+ h(this, ge);
3202
+ h(this, nt);
3203
+ !at(i) && !ye(i) && !rt(i) && !w(i) || (this.__storage__ = {
3204
+ el: i,
3205
+ options: t
3206
+ }, this.active = "data-collapse-active", d(this, st, xe).call(this));
3207
+ }
3208
+ update() {
3209
+ d(this, st, xe).call(this);
3210
+ }
3211
+ }
3212
+ st = new WeakSet(), xe = function() {
3213
+ const { el: i, options: t } = this.__storage__, { SETTINGS: e, EVENTS: s } = Je;
3214
+ if (this.elements = t.state == "not active" ? L(i + `:not([${this.active}])`) : L(i), this.options = Object.assign({}, e, t), this.__events__ = Object.assign({}, s), this.options.on)
3215
+ for (const [o, a] of Object.entries(this.options.on))
3216
+ this.__events__[o] = [a];
3217
+ d(this, me, ds).call(this);
3218
+ }, me = new WeakSet(), ds = function() {
3219
+ const { elements: i, options: t } = this;
3220
+ i.forEach((e) => {
3221
+ e.collapse = {}, e.collapse.instance = this, e.collapse.defaultOptions = t, e.collapse.methods = {}, e.collapse.methods.update = this.update, e.setAttribute(this.active, ""), d(this, ge, us).call(this, e);
3222
+ }), this.emit("init");
3223
+ }, ge = new WeakSet(), us = function(i) {
3224
+ const { options: t } = this, { collapseClass: e, block: s, target: o, defaultOpen: a, targetStopPropagation: r, defaultActiveMark: l } = t, c = i, u = c.querySelector(o);
3225
+ if (c.collapse.height = u.children[0].offsetHeight, a ? (u.style.height = `${u.children[0].offsetHeight}px`, c.classList.remove(e)) : !c.classList.contains(l) && !c.hasAttribute(l) ? (c.classList.add(e), u.style.height = "0px", u.style.overflow = "hidden") : (u.style.height = `${u.children[0].offsetHeight}px`, c.classList.remove(e)), c.removeEventListener("click", d(this, nt, Ce)), c.addEventListener("click", d(this, nt, Ce)), r) {
3226
+ const p = (g) => {
3227
+ g.stopPropagation();
3228
+ };
3229
+ u.removeEventListener("click", p), u.addEventListener("click", p);
3230
+ }
3231
+ }, nt = new WeakSet(), Ce = function() {
3232
+ const { instance: i, defaultOptions: t } = this.collapse, { collapseClass: e, block: s, target: o, single: a } = t, r = this;
3233
+ r.classList.contains(e) ? (a && r.parentNode.querySelectorAll(`.${r.classList[0]}`).forEach((l) => {
3234
+ Re(l);
3235
+ }), Ys(r)) : Re(r), i.emit("afterCollapse");
3236
+ };
3237
+ Object.assign(Us.prototype, O);
3238
+ function Js(n, i) {
3239
+ const t = i, { color: e, opacity: s, duration: o } = i.s.options;
3240
+ let a = document.createElement("span"), r = n.clientX - t.getBoundingClientRect().left, l = n.clientY - t.getBoundingClientRect().top;
3241
+ a.style.cssText = `background: ${e};left: ${r}px;top: ${l}px;opacity: ${s};animation-duration: ${o}ms`, a.classList.add("circle"), t.appendChild(a), setTimeout(function() {
3242
+ a.remove();
3243
+ }, `${o}`);
3244
+ }
3245
+ function hs() {
3246
+ document.querySelectorAll("ripple-btn").forEach((n) => {
3247
+ n.querySelector(".hover-ball"), n.style.setProperty("--r", ""), n.classList.remove("entered");
3248
+ });
3249
+ }
3250
+ document.addEventListener("click", hs);
3251
+ var ot, He, fe, ps, ve, ms, be, gs;
3252
+ class Zs extends HTMLElement {
3253
+ constructor() {
3254
+ super();
3255
+ h(this, ot);
3256
+ h(this, fe);
3257
+ h(this, ve);
3258
+ h(this, be);
3259
+ this.initialize = !1;
3260
+ }
3261
+ connectedCallback() {
3262
+ const t = this;
3263
+ t.initialize || t.classList.contains("r4-initialize") || (t.initialize = !0, d(this, ot, He).call(this));
3264
+ }
3265
+ update() {
3266
+ this.classList.remove("r4-initialize"), this.querySelector("i.hover-ball").remove(), d(this, ot, He).call(this);
3267
+ }
3268
+ }
3269
+ ot = new WeakSet(), He = function() {
3270
+ const { SETTINGS: t } = Ze;
3271
+ this.s = {};
3272
+ function e(o) {
3273
+ let a = !!o;
3274
+ return a = o === "true", a;
3275
+ }
3276
+ const s = {
3277
+ color: this.getAttribute("r4-color") || t.color,
3278
+ opacity: this.getAttribute("r4-opacity") || t.opacity,
3279
+ duration: Number(this.getAttribute("r4-duration")) || t.duration,
3280
+ speed: Number(this.getAttribute("r4-speed")) || t.speed,
3281
+ hover: this.getAttribute("r4-hover") ? e(this.getAttribute("r4-hover")) : t.hover,
3282
+ click: this.getAttribute("r4-hover-click") ? e(this.getAttribute("r4-hover-click")) : t.click
3283
+ };
3284
+ this.s.options = s, this.s.options.hover && this.classList.add("hover-btn"), d(this, fe, ps).call(this);
3285
+ }, fe = new WeakSet(), ps = function() {
3286
+ d(this, ve, ms).call(this), d(this, be, gs).call(this), this.classList.add("r4-initialize");
3287
+ }, ve = new WeakSet(), ms = function() {
3288
+ const t = this, e = document.createElement("i");
3289
+ e.classList.add("hover-ball"), e.style.transitionDuration = `${t.s.options.speed}ms`, t.appendChild(e);
3290
+ }, be = new WeakSet(), gs = function() {
3291
+ const t = this.querySelector("i.hover-ball"), e = this;
3292
+ e.addEventListener("click", function(a) {
3293
+ a.stopPropagation(), e.s.options.click && Js(a, e);
3294
+ });
3295
+ let s = "ontouchstart" in document.documentElement ? "touchstart" : "mouseenter", o = "ontouchend" in document.documentElement ? "touchend" : "mouseleave";
3296
+ e.addEventListener(s, function(a) {
3297
+ if (s === "touchstart" && hs(), e.s.options.hover) {
3298
+ const r = Math.round(s === "mouseenter" ? a.clientX - e.getBoundingClientRect().left : a.changedTouches[0].clientX - e.getBoundingClientRect().x), l = Math.round(s === "mouseenter" ? a.clientY - e.getBoundingClientRect().top : a.changedTouches[0].clientY - e.getBoundingClientRect().y), { offsetWidth: c, offsetHeight: u } = e, p = Math.ceil(Math.sqrt(c ** 2 + u ** 2) * 2);
3299
+ e.style.setProperty("--r", p), t.style.left = r + "px", t.style.top = l + "px", e.classList.add("entered");
3300
+ }
3301
+ }), e.addEventListener(o, function(a) {
3302
+ if (o !== "touchend" && e.s.options.hover) {
3303
+ const r = Math.round(o === "mouseleave" ? a.clientX - e.getBoundingClientRect().left : a.changedTouches[0].clientX - e.getBoundingClientRect().x), l = Math.round(o === "mouseleave" ? a.clientY - e.getBoundingClientRect().top : a.changedTouches[0].clientY - e.getBoundingClientRect().y);
3304
+ e.style.setProperty("--r", ""), t.style.left = r + "px", t.style.top = l + "px", e.classList.remove("entered");
3305
+ }
3306
+ });
3307
+ };
3308
+ customElements.define("ripple-btn", Zs);
3309
+ class Qs {
3310
+ constructor() {
3311
+ this.init();
3312
+ }
3313
+ init() {
3314
+ const i = document.querySelectorAll("*:not([video-id]) > img"), t = (o, a) => {
3315
+ const r = document.createElement("div"), l = document.createElement("span"), c = document.createElement("span"), u = Math.sqrt(o ** 2 + a ** 2), p = Math.asin(a / u) * 180 / Math.PI;
3316
+ return r.className = "no-image", l.className = "slash1", l.style.cssText = `
3317
+ width: ${u}px;
3318
+ transform: rotate(${p}deg);
3319
+ `, c.className = "slash2", c.style.cssText = `
3320
+ width: ${u}px;
3321
+ transform: rotate(${-p}deg);
3322
+ `, r.appendChild(l), r.appendChild(c), r;
3323
+ }, e = document.querySelectorAll(".error-image");
3324
+ for (let o = 0; o < e.length; o++)
3325
+ e[o].remove();
3326
+ i.forEach((o) => {
3327
+ let a;
3328
+ const r = o.parentElement.clientWidth, l = o.parentElement.clientHeight;
3329
+ if (o.classList.contains("lazy") || o.classList.contains("swiper-lazy") ? a = o.getAttribute("data-src") : a = o.getAttribute("src"), a === "") {
3330
+ const c = document.createElement("div"), u = getComputedStyle(o.parentElement).position;
3331
+ c.className = "error-image", u === "static" && (o.parentElement.style.position = "relative"), o.parentElement.appendChild(c), c.style.cssText = `
3332
+ position: absolute;
3333
+ top: 50%;
3334
+ left: 50%;
3335
+ width: 100%;
3336
+ height: 100%;
3337
+ transform: translate(-50%,-50%);
3338
+ z-index: 1;
3339
+ `, c.appendChild(t(r, l));
3340
+ }
3341
+ });
3342
+ function s() {
3343
+ const o = document.querySelectorAll(".no-image");
3344
+ o.length <= 0 || o.forEach((a) => {
3345
+ const r = a.parentElement.clientWidth, l = a.parentElement.clientHeight, c = Math.sqrt(r ** 2 + l ** 2), u = Math.asin(l / c) * 180 / Math.PI;
3346
+ a.querySelector(".slash1").style.cssText = `
3347
+ width: ${c}px;
3348
+ transform: rotate(${u}deg);
3349
+ `, a.querySelector(".slash2").style.cssText = `
3350
+ width: ${c}px;
3351
+ transform: rotate(${-u}deg);
3352
+ `;
3353
+ });
3354
+ }
3355
+ window.addEventListener("resize", s);
3356
+ }
3357
+ reValidate() {
3358
+ this.init();
3359
+ }
3360
+ }
3361
+ function Xe(n, i) {
3362
+ return n ? function(t, e) {
3363
+ Function(n)(t, e);
3364
+ } : i;
3365
+ }
3366
+ function Vs(n, i, t, e) {
3367
+ const s = i.params, o = n.closest("[data-upload-item]").querySelector("[data-preview]");
3368
+ o.querySelector("img") && o.querySelector("img").remove(), o.appendChild(e.imgElement);
3369
+ const a = n.dataset.group, r = document.querySelector(i.el).dataset.index;
3370
+ if (s.compress) {
3371
+ const l = t.name.substring(t.name.lastIndexOf(".")).replace("."), c = t.name.replace(`.${l}`, "");
3372
+ e.originalCanvas.toBlob(
3373
+ function(u) {
3374
+ const p = new File([u], `${c}`, { type: t.type });
3375
+ uploadImage[`${a}`][r] = {
3376
+ file: p,
3377
+ info: e
3378
+ }, s.on.changeAfter && typeof s.on.changeAfter == "function" && s.on.changeAfter(n, e);
3379
+ },
3380
+ t.type,
3381
+ s.compress
3382
+ );
3383
+ } else
3384
+ uploadImage[`${a}`][r] = {
3385
+ file: t,
3386
+ info: e
3387
+ }, s.on.changeAfter && typeof s.on.changeAfter == "function" && s.on.changeAfter(n, e);
3388
+ }
3389
+ function Ks(n, i, t, e) {
3390
+ const s = document.createElement("canvas"), o = s.getContext("2d"), a = i.width, l = i.height / a * 100, c = e / t * 100;
3391
+ let u = 0, p = 0;
3392
+ switch (s.width = t, s.height = e, n.previewSize) {
3393
+ case "contain":
3394
+ l < c ? (u = s.width, p = t * l / 100) : l > c ? (u = e / l * 100, p = s.height) : (u = s.width, p = s.height);
3395
+ break;
3396
+ case "cover":
3397
+ l < c ? (u = e / l * 100, p = s.height) : l > c ? (u = s.width, p = t * l / 100) : l === c && (u = s.width, p = s.height);
3398
+ break;
3399
+ }
3400
+ const g = (s.width - u) * 0.5, m = (s.height - p) * 0.5;
3401
+ return o.drawImage(i, g, m, u, p), s;
3402
+ }
3403
+ function tn(n, i) {
3404
+ return new Promise((t, e) => {
3405
+ if (i) {
3406
+ const s = new Image();
3407
+ s.src = i, s.classList.add(n.previewSize), s.onload = () => {
3408
+ let o = {
3409
+ imgElement: s,
3410
+ originalCanvas: Ks(n, s, s.width, s.height),
3411
+ info: {
3412
+ originalWidth: s.width,
3413
+ originalHeight: s.height,
3414
+ ratio: s.height / s.width * 100 + "%"
3415
+ }
3416
+ };
3417
+ t(o);
3418
+ };
3419
+ } else
3420
+ t();
3421
+ });
3422
+ }
3423
+ function en(n, i) {
3424
+ const t = Math.pow(10, i);
3425
+ return Math.round(n * t) / t;
3426
+ }
3427
+ function sn(n, i) {
3428
+ let t = n.size / 1024 / 1024;
3429
+ return `${en(t, 2)}` <= i;
3430
+ }
3431
+ function nn(n, i, t) {
3432
+ if (n.target.files.length <= 0)
3433
+ return;
3434
+ const e = n.target.files[0], s = i.closest("[data-upload-item]");
3435
+ let o = new FileReader();
3436
+ o.onload = (a) => {
3437
+ const r = e.type.split("/")[0] === "image" ? a.target.result : null;
3438
+ if (t.params.sizeLimit && !sn(e, t.params.sizeLimit)) {
3439
+ i.value = "", s.classList.add("over-limit"), t.params.on.overLimit && typeof t.params.on.overLimit == "function" && t.params.on.overLimit(i, t.params.sizeLimit);
3440
+ return;
3441
+ } else
3442
+ s.classList.remove("over-limit"), s.classList.add("uploaded"), tn(t.params, r).then((l) => {
3443
+ Vs(i, t, e, l);
3444
+ });
3445
+ }, o.readAsDataURL(e);
3446
+ }
3447
+ class on {
3448
+ constructor(i, t) {
3449
+ const e = this;
3450
+ e.el = i, e.params = {
3451
+ on: {
3452
+ changeAfter: null,
3453
+ overLimit: null
3454
+ },
3455
+ group: "group",
3456
+ //群組名稱 (type: String)
3457
+ sizeLimit: 2,
3458
+ //大小限制 (type: Number 單位: MB)
3459
+ previewSize: "cover",
3460
+ //縮圖形式 (type: String 'contain' || 'cover')
3461
+ compress: 0.8
3462
+ //壓縮品質 (type: Number 0~1 || false)
3463
+ }, Object.assign(e.params, t), e.init();
3464
+ }
3465
+ init() {
3466
+ const i = this, t = document.querySelectorAll(`${i.el}:not(.preview-active)`);
3467
+ t.length <= 0 || (window.uploadImage = {}, t.forEach((e, s) => {
3468
+ e.classList.add("preview-active");
3469
+ const o = {
3470
+ group: e.dataset.group || i.params.group,
3471
+ sizeLimit: parseInt(e.dataset.limit) || i.params.sizeLimit,
3472
+ previewSize: e.dataset.previewSize || i.params.previewSize,
3473
+ compress: e.dataset.compress || i.params.compress,
3474
+ on: {
3475
+ changeAfter: Xe(e.dataset.changeAfter, i.params.on.changeAfter),
3476
+ overLimit: Xe(e.dataset.overLimit, i.params.on.overLimit)
3477
+ }
3478
+ };
3479
+ i.params = o, typeof uploadImage[`${o.group}`] > "u" && (uploadImage[`${o.group}`] = []), e.dataset.group || (e.dataset.group = o.group), e.dataset.index = document.querySelectorAll(`[data-group="${o.group}"]`).length - 1, e.addEventListener("change", function(a) {
3480
+ nn(a, e, i);
3481
+ });
3482
+ }));
3483
+ }
3484
+ }
3485
+ export {
3486
+ Qe as A,
3487
+ Tn as B,
3488
+ Us as C,
3489
+ ki as D,
3490
+ En as E,
3491
+ An as F,
3492
+ Ln as G,
3493
+ Sn as H,
3494
+ Qs as I,
3495
+ Dn as J,
3496
+ _n as K,
3497
+ kn as L,
3498
+ U as M,
3499
+ $n as N,
3500
+ xn as O,
3501
+ Cn as P,
3502
+ Hn as Q,
3503
+ Zs as R,
3504
+ Mn as S,
3505
+ Yi as T,
3506
+ qn as U,
3507
+ In as V,
3508
+ On as W,
3509
+ Pn as X,
3510
+ Nn as Y,
3511
+ w as a,
3512
+ rt as b,
3513
+ Ts as c,
3514
+ ws as d,
3515
+ Y as e,
3516
+ E as f,
3517
+ L as g,
3518
+ mn as h,
3519
+ at as i,
3520
+ ui as j,
3521
+ Bs as k,
3522
+ Xs as l,
3523
+ on as m,
3524
+ Hs as n,
3525
+ jn as o,
3526
+ gn as p,
3527
+ Ei as q,
3528
+ Ai as r,
3529
+ ys as s,
3530
+ fn as t,
3531
+ vn as u,
3532
+ qs as v,
3533
+ bn as w,
3534
+ Cs as x,
3535
+ yn as y,
3536
+ wn as z
3537
+ };
3538
+ //# sourceMappingURL=image-preview-bundle.js.map