1import { 2 CF2Component, 3 init_runtime, 4 registerComponent 5} from "./chunk-NQUHJ6NR.js"; 6import { 7 __publicField, 8 init_define_process 9} from "./chunk-RFSPGZ3L.js"; 10
11// projects/lib/packages/yggdrasil-blueprints/__generated__/packs/countdown-v1.ts 12init_define_process(); 13
14// projects/lib/packages/yggdrasil-blueprints/__generated__/blueprints/countdown-v1.ts 15init_define_process(); 16init_runtime(); 17var CountdownV1 = class extends CF2Component { 18 constructor(el, runtimeSel) { 19 super(el, runtimeSel); 20 } 21 fixedDigits(num, digits = 2) { 22 const numStr = num?.toString() ?? ""; 23 if (numStr.length < digits) { 24 return `${"0".repeat(digits - numStr.length)}${numStr}`; 25 } else { 26 return numStr; 27 } 28 } 29 mount() { 30 const countdown_opts = this.countdown_opts; 31 let countdownSpans = 0; 32 if (countdown_opts.show_years) countdownSpans |= countdown.YEARS; 33 if (countdown_opts.show_months) countdownSpans |= countdown.MONTHS; 34 if (countdown_opts.show_weeks) countdownSpans |= countdown.WEEKS; 35 if (countdown_opts.show_days) countdownSpans |= countdown.DAYS; 36 if (countdown_opts.show_hours) countdownSpans |= countdown.HOURS; 37 if (countdown_opts.show_minutes) countdownSpans |= countdown.MINUTES; 38 if (countdown_opts.show_seconds) countdownSpans |= countdown.SECONDS; 39 const now = /* @__PURE__ */ new Date(); 40 let countToDate = now; 41 try { 42 countToDate = new Date(this.end_date_time); 43 if (isNaN(countToDate)) { 44 countToDate = now; 45 } 46 if (countToDate < now) { 47 countToDate = now; 48 } 49 } catch (e) { 50 console.warn(`liiquid filter 'countdown': Invalid date '${this.end_date_time}'`); 51 } 52 const { YEARS, MONTHS, WEEKS, DAYS, HOURS, MINUTES, SECONDS } = this.constructor.TIME_TYPES; 53 var timerId = countdown( 54 countToDate, 55 (ts) => { 56 if (ts.value < 0) { 57 $(`[data-time-type="${YEARS}"`, this.element).find("span").text(ts.years); 58 $(`[data-time-type="${MONTHS}"`, this.element).find("span").text(ts.months); 59 $(`[data-time-type="${WEEKS}"`, this.element).find("span").text(ts.weeks); 60 $(`[data-time-type="${DAYS}"`, this.element).find("span").text(ts.days); 61 $(`[data-time-type="${HOURS}"`, this.element).find("span").text(this.fixedDigits(ts.hours, 2)); 62 $(`[data-time-type="${MINUTES}"`, this.element).find("span").text(this.fixedDigits(ts.minutes, 2)); 63 $(`[data-time-type="${SECONDS}"`, this.element).find("span").text(this.fixedDigits(ts.seconds, 2)); 64 } else { 65 $(`[data-time-type="${YEARS}"`, this.element).find("span").text("0"); 66 $(`[data-time-type="${MONTHS}"`, this.element).find("span").text("0"); 67 $(`[data-time-type="${WEEKS}"`, this.element).find("span").text("0"); 68 $(`[data-time-type="${DAYS}"`, this.element).find("span").text("0"); 69 $(`[data-time-type="${HOURS}"`, this.element).find("span").text("00"); 70 $(`[data-time-type="${MINUTES}"`, this.element).find("span").text("00"); 71 $(`[data-time-type="${SECONDS}"`, this.element).find("span").text("00"); 72 clearInterval(timerId); 73 if (this.timer_action === "showhide") { 74 $(this.hide_ids.map((id) => `.${id}`).join(",")).hide(); 75 $(this.show_ids.map((id) => `.${id}`).join(",")).show(); 76 } else if (this.timer_action === "redirect_to") { 77 if (this.redirect_to) { 78 window.location.href = this.redirect_to; 79 } 80 } 81 } 82 }, 83 countdownSpans 84 ); 85 } 86}; 87// Time type keys used for data-time-type attribute selectors 88__publicField(CountdownV1, "TIME_TYPES", { 89 YEARS: "years", 90 MONTHS: "months", 91 WEEKS: "weeks", 92 DAYS: "days", 93 HOURS: "hours", 94 MINUTES: "minutes", 95 SECONDS: "seconds" 96}); 97registerComponent("Countdown/V1", CountdownV1); 98window["CountdownV1"] = CountdownV1; 99//# sourceMappingURL=countdown-v1-TUNRS7TE.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.