vendor: 3,717 bytes, lines 1-91
1/* flatpickr v4.6.9,, @license MIT */ 2!function (e, t) { 3 "object" == typeof exports && "undefined" != typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define(t) : (e = "undefined" != typeof globalThis ? globalThis : e || self).flatpickr = t(); 4}(this, function () { 5 "use strict"; 6 7 var e = function () { 8 return (e = Object.assign || function (e) { 9 for (var t, n = 1, a = arguments.length; n < a; n++) for (var i in t = arguments[n]) Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]); 10 return e; 11 }).apply(this, arguments); 12 }; 13 function t() { 14 for (var e = 0, t = 0, n = arguments.length; t < n; t++) e += arguments[t].length; 15 var a = Array(e), 16 i = 0; 17 for (t = 0; t < n; t++) for (var o = arguments[t], r = 0, l = o.length; r < l; r++, i++) a[i] = o[r]; 18 return a; 19 } 20 var n = ["onChange", "onClose", "onDayCreate", "onDestroy", "onKeyDown", "onMonthChange", "onOpen", "onParseConfig", "onReady", "onValueUpdate", "onYearChange", "onPreCalendarPosition"], 21 a = { 22 _disable: [], 23 allowInput: !1, 24 allowInvalidPreload: !1, 25 altFormat: "F j, Y", 26 altInput: !1, 27 altInputClass: "form-control input", 28 animate: "object" == typeof window && -1 === window.navigator.userAgent.indexOf("MSIE"), 29 ariaDateFormat: "F j, Y", 30 autoFillDefaultTime: !0, 31 clickOpens: !0, 32 closeOnSelect: !0, 33 conjunction: ", ", 34 dateFormat: "Y-m-d", 35 defaultHour: 12, 36 defaultMinute: 0, 37 defaultSeconds: 0, 38 disable: [], 39 disableMobile: !1, 40 enableSeconds: !1, 41 enableTime: !1, 42 errorHandler: function (e) { 43 return "undefined" != typeof console && console.warn(e); 44 }, 45 getWeek: function (e) { 46 var t = new Date(e.getTime()); 47 t.setHours(0, 0, 0, 0), t.setDate(t.getDate() + 3 - (t.getDay() + 6) % 7); 48 var n = new Date(t.getFullYear(), 0, 4); 49 return 1 + Math.round(((t.getTime() - n.getTime()) / 864e5 - 3 + (n.getDay() + 6) % 7) / 7); 50 }, 51 hourIncrement: 1, 52 ignoredFocusElements: [], 53 inline: !1, 54 locale: "default", 55 minuteIncrement: 5, 56 mode: "single", 57 monthSelectorType: "dropdown", 58 nextArrow: "<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M13.207 8.472l-7.854 7.854-0.707-0.707 7.146-7.146-7.146-7.148 0.707-0.707 7.854 7.854z' /></svg>", 59 noCalendar: !1, 60 now: new Date(), 61 onChange: [], 62 onClose: [], 63 onDayCreate: [], 64 onDestroy: [], 65 onKeyDown: [], 66 onMonthChange: [], 67 onOpen: [], 68 onParseConfig: [], 69 onReady: [], 70 onValueUpdate: [], 71 onYearChange: [], 72 onPreCalendarPosition: [], 73 plugins: [], 74 position: "auto", 75 positionElement: void 0, 76 prevArrow: "<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M5.207 8.471l7.146 7.147-0.707 0.707-7.853-7.854 7.854-7.853 0.707 0.707-7.147 7.146z' /></svg>", 77 shorthandCurrentMonth: !1, 78 showMonths: 1, 79 static: !1, 80 time_24hr: !1, 81 weekNumbers: !1, 82 wrap: !1 83 }, 84 i = { 85 weekdays: { 86 shorthand: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], 87 longhand: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"] 88 }, 89 months: { 90 shorthand: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], 91 longhand: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "
91November", "December"] 92 }, 93 daysInMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], 94 firstDayOfWeek: 0, 95 ordinal: function (e) { 96 var t = e % 100; 97 if (t > 3 && t < 21) return "th"; 98 switch (t % 10) { 99 case 1: 100 return "st"; 101 case 2: 102 return "nd"; 103 case 3: 104 return "rd"; 105 default: 106 return "th"; 107 } 108 }, 109 rangeSeparator: " to ", 110 weekAbbreviation: "Wk", 111 scrollTitle: "Scroll to increment", 112 toggleTitle: "Click to toggle", 113 amPM: ["AM", "PM"], 114 yearAriaLabel: "Year", 115 monthAriaLabel: "Month", 116 hourAriaLabel: "Hour", 117 minuteAriaLabel: "Minute", 118 time_24hr: !1 119 }, 120 o = function (e, t) { 121 return void 0 === t && (t = 2), ("000" + e).slice(-1 * t); 122 }, 123 r = function (e) { 124 return !0 === e ? 1 : 0; 125 }; 126 function l(e, t) { 127 var n; 128 return function () { 129 var a = this; 130 clearTimeout(n), n = setTimeout(function () { 131 return e.apply(a, arguments); 132 }, t); 133 }; 134 } 135 var c = function (e) { 136 return e instanceof Array ? e : [e]; 137 }; 138 function d(e, t, n) { 139 if (!0 === n) return e.classList.add(t); 140 e.classList.remove(t); 141 } 142 function s(e, t, n) { 143 var a = window.document.createElement(e); 144 return t = t || "", n = n || "", a.className = t, void 0 !== n && (a.textContent = n), a; 145 } 146 function u(e) { 147 for (; e.firstChild;) e.removeChild(e.firstChild); 148 } 149 function f(e, t) { 150 return t(e) ? e : e.parentNode ? f(e.parentNode, t) : void 0; 151 } 152 function m(e, t) { 153 var n = s("div", "numInputWrapper"), 154 a = s("input", "numInput " + e), 155 i = s("span", "arrowUp"), 156 o = s("span", "arrowDown"); 157 if (-1 === navigator.userAgent.indexOf("MSIE 9.0") ? a.type = "number" : (a.type = "text", a.pattern = "\\d*"), void 0 !== t) for (var r in t) a.setAttribute(r, t[r]); 158 return n.appendChild(a), n.appendChild(i), n.appendChild(o), n; 159 } 160 function g(e) { 161 try { 162 return "function" == typeof e.composedPath ? e.composedPath()[0] : e.target; 163 } catch (t) { 164 return e.target; 165 } 166 } 167 var p = function () {}, 168 h = function (e, t, n) { 169 return n.months[t ? "shorthand" : "longhand"][e]; 170 }, 171 v = { 172 D: p, 173 F: function (e, t, n) { 174 e.setMonth(n.months.longhand.indexOf(t)); 175 }, 176 G: function (e, t) { 177 e.setHours(parseFloat(t)); 178 }, 179 H: function (e, t) { 180 e.setHours(parseFloat(t)); 181 }, 182 J: function (e, t) { 183 e.setDate(parseFloat(t)); 184 }, 185 K: function (e, t, n) { 186 e.setHours(e.getHours() % 12 + 12 * r(new RegExp(n.amPM[1], "i").test(t))); 187 }, 188 M: function (e, t, n) { 189 e.setMonth(n.months.shorthand.indexOf(t)); 190 }, 191 S: function (e, t) { 192 e.setSeconds(parseFloat(t)); 193 }, 194 U: function (e, t) { 195 return new Date(1e3 * parseFloat(t)); 196 }, 197 W: function (e, t, n) { 198 var a = parseInt(t), 199 i = new Date(e.getFullYear(), 0, 2 + 7 * (a - 1), 0, 0, 0, 0); 200 return i.setDate(i.getDate() - i.getDay() + n.firstDayOfWeek), i; 201 }, 202 Y: function (e, t) { 203 e.setFullYear(parseFloat(t)); 204 }, 205 Z: function (e, t) { 206 return new Date(t); 207 }, 208 d: function (e, t) { 209 e.setDate(parseFloat(t)); 210 }, 211 h: function (e, t) { 212 e.setHours(parseFloat(t)); 213 }, 214 i: function (e, t) { 215 e.setMinutes(parseFloat(t)); 216 }, 217 j: function (e, t) { 218 e.setDate(parseFloat(t)); 219 }, 220 l: p, 221 m: function (e, t) { 222 e.setMonth(parseFloat(t) - 1); 223 }, 224 n: function (e, t) { 225 e.setMonth(parseFloat(t) - 1); 226 }, 227 s: function (e, t) { 228 e.setSeconds(parseFloat(t)); 229 }, 230 u: function (e, t) { 231 return new Date(parseFloat(t)); 232 }, 233 w: p, 234 y: function (e, t) { 235 e.setFullYear(2e3 + parseFloat(t)); 236 } 237 }, 238 D = { 239 D: "(\\w+)", 240 F: "(\\w+)", 241 G: "(\\d\\d|\\d)", 242 H: "(\\d\\d|\\d)", 243 J: "(\\d\\d|\\d)\\w+", 244 K: "", 245 M: "(\\w+)", 246 S: "(\\d\\d|\\d)", 247 U: "(.+)", 248 W: "(\\d\\d|\\d)", 249 Y: "(\\d{4})", 250 Z: "(.+)", 251 d: "(\\d\\d|\\d)", 252 h: "(\\d\\d|\\d)", 253 i: "(\\d\\d|\\d)", 254 j: "(\\d\\d|\\d)", 255 l: "(\\w+)", 256 m: "(\\d\\d|\\d)", 257 n: "(\\d\\d|\\d)", 258 s: "(\\d\\d|\\d)", 259 u: "(.+)", 260 w: "(\\d\\d|\\d)", 261 y: "(\\d{2})" 262 }, 263 w = { 264 Z: function (e) { 265 return e.toISOString(); 266 }, 267 D: function (e, t, n) { 268 return t.weekdays.shorthand[w.w(e, t, n)]; 269 }, 270 F: function (e, t, n) { 271 return h(w.n(e, t, n) - 1, !1, t); 272 }, 273 G: function (e, t, n) { 274 return o(w.h(e, t, n)); 275 }, 276 H: function (e) { 277 return o(e.getHours()); 278 }, 279 J: function (e, t) { 280 return void 0 !== t.ordinal ? e.getDate() + t.ordinal(e.getDate()) : e.getDate(); 281 }, 282 K: function (e, t) { 283 return t.amPM[r(e.getHours() > 11)]; 284 }, 285 M: function (e, t) { 286 return h(e.getMonth(), !0, t); 287 }, 288 S: function (e) { 289 return o(e.getSeconds()); 290 }, 291 U: function (e) { 292 return e.getTime() / 1e3; 293 }, 294 W: function (e, t, n) { 295 return n.getWeek(e); 296 }, 297 Y: function (e) { 298 return o(e.getFullYear(), 4); 299 }, 300 d: function (e) { 301 return o(e.getDate()); 302 }, 303 h: function (e) { 304 return e.getHours() % 12 ? e.getHours() % 12 : 12; 305 }, 306 i: function (e) { 307 return o(e.getMinutes()); 308 }, 309 j: function (e) { 310 return e.getDate(); 311 }, 312 l: function (e, t) { 313 return t.weekdays.longhand[e.getDay()]; 314 }, 315 m: function (e) { 316 return o(e.getMonth() + 1); 317 }, 318 n: function (e) { 319 return e.getMonth() + 1; 320 }, 321 s: function (e) { 322 return e.getSeconds(); 323 }, 324 u: function (e) { 325 return e.getTime(); 326 }, 327 w: function (e) { 328 return e.getDay(); 329 }, 330 y: function (e) { 331 return String(e.getFullYear()).substring(2); 332 } 333 }, 334 b = function (e) { 335 var t = e.config, 336 n = void 0 === t ? a : t, 337 o = e.l10n, 338 r = void 0 === o ? i : o, 339 l = e.isMobile, 340 c = void 0 !== l && l; 341 return function (e, t, a) { 342 var i = a || r; 343 return void 0 === n.formatDate || c ? t.split("").map(function (t, a, o) { 344 return w[t] && "\\" !== o[a - 1] ? w[t](e, i, n) : "\\" !== t ? t : ""; 345 }).join("") : n.formatDate(e, t, i); 346 }; 347 }, 348 C = function (e) { 349 var t = e.config, 350 n = void 0 === t ? a : t, 351 o = e.l10n, 352 r = void 0 === o ? i : o; 353 return function (e, t, i, o) { 354 if (0 === e || e) { 355 var l, 356 c = o || r, 357 d = e; 358 if (e instanceof Date) l = new Date(e.getTime());else if ("string" != typeof e && void 0 !== e.toFixed) l = new Date(e);else if ("string" == typeof e) { 359 var s = t || (n || a).dateFormat, 360 u = String(e).trim(); 361 if ("today" === u) l = new Date(), i = !0;else if (/Z$/.test(u) || /GMT$/.test(u)) l = new Date(e);else if (n && n.parseDate) l = n.parseDate(e, s);else { 362 l = n && n.noCalendar ? new Date(new Date().setHours(0, 0, 0, 0)) : new Date(new Date().getFullYear(), 0, 1, 0, 0, 0, 0); 363 for (var f = void 0, m = [], g = 0, p = 0, h = ""; g < s.length; g++) { 364 var w = s[g], 365 b = "\\" === w, 366 C = "\\" === s[g - 1] || b; 367 if (D[w] && !C) { 368 h += D[w]; 369 var M = new RegExp(h).exec(e); 370 M && (f = !0) && m["Y" !== w ? "push" : "unshift"]({ 371 fn: v[w], 372 val: M[++p] 373 }); 374 } else b || (h += "."); 375 m.forEach(function (e) { 376 var t = e.fn, 377 n = e.val; 378 return l = t(l, n, c) || l; 379 }); 380 } 381 l = f ? l : void 0; 382 } 383 } 384 if (l instanceof Date && !isNaN(l.getTime())) return !0 === i && l.setHours(0, 0, 0, 0), l; 385 n.errorHandler(new Error("Invalid date provided: " + d)); 386 } 387 }; 388 }; 389 function M(e, t, n) { 390 return void 0 === n && (n = !0), !1 !== n ? new Date(e.getTime()).setHours(0, 0, 0, 0) - new Date(t.getTime()).setHours(0, 0, 0, 0) : e.getTime() - t.getTime(); 391 } 392 var y = 864e5; 393 function x(e) { 394 var t = e.defaultHour, 395 n = e.defaultMinute, 396 a = e.defaultSeconds; 397 if (void 0 !== e.minDate) { 398 var i = e.minDate.getHours(), 399 o = e.minDate.getMinutes(), 400 r = e.minDate.getSeconds(); 401 t < i && (t = i), t === i && n < o && (n = o), t === i && n === o && a < r && (a = e.minDate.getSeconds()); 402 } 403 if (void 0 !== e.maxDate) { 404 var l = e.maxDate.getHours(), 405 c = e.maxDate.getMinutes(); 406 (t = Math.min(t, l)) === l && (n = Math.min(c, n)), t === l && n === c && (a = e.maxDate.getSeconds()); 407 } 408 return { 409 hours: t, 410 minutes: n, 411 seconds: a 412 }; 413 } 414 "function" != typeof Object.assign && (Object.assign = function (e) { 415 for (var t = [], n = 1; n < arguments.length; n++) t[n - 1] = arguments[n]; 416 if (!e) throw TypeError("Cannot convert undefined or null to object"); 417 for (var a = function (t) { 418 t && Object.keys(t).forEach(function (n) { 419 return e[n] = t[n]; 420 }); 421 }, i = 0, o = t; i < o.length; i++) { 422 var r = o[i]; 423 a(r); 424 } 425 return e; 426 }); 427 function E(p, v) { 428 var w = { 429 config: e(e({}, a), T.defaultConfig), 430 l10n: i 431 }; 432 function E(e) { 433 return e.bind(w); 434 } 435 function k() { 436 var e = w.config;
vendor: 4,962 bytes, lines 437-520
437 !1 === e.weekNumbers && 1 === e.showMonths || !0 !== e.noCalendar && window.requestAnimationFrame(function () { 438 if (void 0 !== w.calendarContainer && (w.calendarContainer.style.visibility = "hidden", w.calendarContainer.style.display = "block"), void 0 !== w.daysContainer) { 439 var t = (w.days.offsetWidth + 1) * e.showMonths; 440 w.daysContainer.style.width = t + "px", w.calendarContainer.style.width = t + (void 0 !== w.weekWrapper ? w.weekWrapper.offsetWidth : 0) + "px", w.calendarContainer.style.removeProperty("visibility"), w.calendarContainer.style.removeProperty("display"); 441 } 442 }); 443 } 444 function I(e) { 445 if (0 === w.selectedDates.length) { 446 var t = void 0 === w.config.minDate || M(new Date(), w.config.minDate) >= 0 ? new Date() : new Date(w.config.minDate.getTime()), 447 n = x(w.config); 448 t.setHours(n.hours, n.minutes, n.seconds, t.getMilliseconds()), w.selectedDates = [t], w.latestSelectedDateObj = t; 449 } 450 void 0 !== e && "blur" !== e.type && function (e) { 451 e.preventDefault(); 452 var t = "keydown" === e.type, 453 n = g(e), 454 a = n; 455 void 0 !== w.amPM && n === w.amPM && (w.amPM.textContent = w.l10n.amPM[r(w.amPM.textContent === w.l10n.amPM[0])]); 456 var i = parseFloat(a.getAttribute("min")), 457 l = parseFloat(a.getAttribute("max")), 458 c = parseFloat(a.getAttribute("step")), 459 d = parseInt(a.value, 10), 460 s = e.delta || (t ? 38 === e.which ? 1 : -1 : 0), 461 u = d + c * s; 462 if (void 0 !== a.value && 2 === a.value.length) { 463 var f = a === w.hourElement, 464 m = a === w.minuteElement; 465 u < i ? (u = l + u + r(!f) + (r(f) && r(!w.amPM)), m && j(void 0, -1, w.hourElement)) : u > l && (u = a === w.hourElement ? u - l - r(!w.amPM) : i, m && j(void 0, 1, w.hourElement)), w.amPM && f && (1 === c ? u + d === 23 : Math.abs(u - d) > c) && (w.amPM.textContent = w.l10n.amPM[r(w.amPM.textContent === w.l10n.amPM[0])]), a.value = o(u); 466 } 467 }(e); 468 var a = w._input.value; 469 S(), be(), w._input.value !== a && w._debouncedChange(); 470 } 471 function S() { 472 if (void 0 !== w.hourElement && void 0 !== w.minuteElement) { 473 var e, 474 t, 475 n = (parseInt(w.hourElement.value.slice(-2), 10) || 0) % 24, 476 a = (parseInt(w.minuteElement.value, 10) || 0) % 60, 477 i = void 0 !== w.secondElement ? (parseInt(w.secondElement.value, 10) || 0) % 60 : 0; 478 void 0 !== w.amPM && (e = n, t = w.amPM.textContent, n = e % 12 + 12 * r(t === w.l10n.amPM[1])); 479 var o = void 0 !== w.config.minTime || w.config.minDate && w.minDateHasTime && w.latestSelectedDateObj && 0 === M(w.latestSelectedDateObj, w.config.minDate, !0); 480 if (void 0 !== w.config.maxTime || w.config.maxDate && w.maxDateHasTime && w.latestSelectedDateObj && 0 === M(w.latestSelectedDateObj, w.config.maxDate, !0)) { 481 var l = void 0 !== w.config.maxTime ? w.config.maxTime : w.config.maxDate; 482 (n = Math.min(n, l.getHours())) === l.getHours() && (a = Math.min(a, l.getMinutes())), a === l.getMinutes() && (i = Math.min(i, l.getSeconds())); 483 } 484 if (o) { 485 var c = void 0 !== w.config.minTime ? w.config.minTime : w.config.minDate; 486 (n = Math.max(n, c.getHours())) === c.getHours() && a < c.getMinutes() && (a = c.getMinutes()), a === c.getMinutes() && (i = Math.max(i, c.getSeconds())); 487 } 488 O(n, a, i); 489 } 490 } 491 function _(e) { 492 var t = e || w.latestSelectedDateObj; 493 t && O(t.getHours(), t.getMinutes(), t.getSeconds()); 494 } 495 function O(e, t, n) { 496 void 0 !== w.latestSelectedDateObj && w.latestSelectedDateObj.setHours(e % 24, t, n || 0, 0), w.hourElement && w.minuteElement && !w.isMobile && (w.hourElement.value = o(w.config.time_24hr ? e : (12 + e) % 12 + 12 * r(e % 12 == 0)), w.minuteElement.value = o(t), void 0 !== w.amPM && (w.amPM.textContent = w.l10n.amPM[r(e >= 12)]), void 0 !== w.secondElement && (w.secondElement.value = o(n))); 497 } 498 function F(e) { 499 var t = g(e), 500 n = parseInt(t.value) + (e.delta || 0); 501 (n / 1e3 > 1 || "Enter" === e.key && !/[^\d]/.test(n.toString())) && Q(n); 502 } 503 function A(e, t, n, a) { 504 return t instanceof Array ? t.forEach(function (t) { 505 return A(e, t, n, a); 506 }) : e instanceof Array ? e.forEach(function (e) { 507 return A(e, t, n, a); 508 }) : (e.addEventListener(t, n, a), void w._handlers.push({ 509 remove: function () { 510 return e.removeEventListener(t, n); 511 } 512 })); 513 } 514 function N() { 515 pe("onChange"); 516 } 517 function P(e, t) { 518 var n = void 0 !== e ? w.parseDate(e) : w.latestSelectedDateObj || (w.config.minDate && w.config.minDate > w.now ? w.config.minDate : w.config.maxDate && w.config.maxDate < w.now ? w.config.maxDate : w.now), 519 a = w.currentYear, 520 i = w.currentMonth;
vendor: 5,361 bytes, lines 521-590
521 try { 522 void 0 !== n && (w.currentYear = n.getFullYear(), w.currentMonth = n.getMonth()); 523 } catch (e) { 524 e.message = "Invalid date supplied: " + n, w.config.errorHandler(e); 525 } 526 t && w.currentYear !== a && (pe("onYearChange"), K()), !t || w.currentYear === a && w.currentMonth === i || pe("onMonthChange"), w.redraw(); 527 } 528 function Y(e) { 529 var t = g(e); 530 ~t.className.indexOf("arrow") && j(e, t.classList.contains("arrowUp") ? 1 : -1); 531 } 532 function j(e, t, n) { 533 var a = e && g(e), 534 i = n || a && a.parentNode && a.parentNode.firstChild, 535 o = he("increment"); 536 o.delta = t, i && i.dispatchEvent(o); 537 } 538 function H(e, t, n, a) { 539 var i = X(t, !0), 540 o = s("span", "flatpickr-day " + e, t.getDate().toString()); 541 return o.dateObj = t, o.$i = a, o.setAttribute("aria-label", w.formatDate(t, w.config.ariaDateFormat)), -1 === e.indexOf("hidden") && 0 === M(t, w.now) && (w.todayDateElem = o, o.classList.add("today"), o.setAttribute("aria-current", "date")), i ? (o.tabIndex = -1, ve(t) && (o.classList.add("selected"), w.selectedDateElem = o, "range" === w.config.mode && (d(o, "startRange", w.selectedDates[0] && 0 === M(t, w.selectedDates[0], !0)), d(o, "endRange", w.selectedDates[1] && 0 === M(t, w.selectedDates[1], !0)), "nextMonthDay" === e && o.classList.add("inRange")))) : o.classList.add("flatpickr-disabled"), "range" === w.config.mode && function (e) { 542 return !("range" !== w.config.mode || w.selectedDates.length < 2) && M(e, w.selectedDates[0]) >= 0 && M(e, w.selectedDates[1]) <= 0; 543 }(t) && !ve(t) && o.classList.add("inRange"), w.weekNumbers && 1 === w.config.showMonths && "prevMonthDay" !== e && n % 7 == 1 && w.weekNumbers.insertAdjacentHTML("beforeend", "<span class='flatpickr-day'>" + w.config.getWeek(t) + "</span>"), pe("onDayCreate", o), o; 544 } 545 function L(e) { 546 e.focus(), "range" === w.config.mode && ae(e); 547 } 548 function W(e) { 549 for (var t = e > 0 ? 0 : w.config.showMonths - 1, n = e > 0 ? w.config.showMonths : -1, a = t; a != n; a += e) for (var i = w.daysContainer.children[a], o = e > 0 ? 0 : i.children.length - 1, r = e > 0 ? i.children.length : -1, l = o; l != r; l += e) { 550 var c = i.children[l]; 551 if (-1 === c.className.indexOf("hidden") && X(c.dateObj)) return c; 552 } 553 } 554 function R(e, t) { 555 var n = ee(document.activeElement || document.body), 556 a = void 0 !== e ? e : n ? document.activeElement : void 0 !== w.selectedDateElem && ee(w.selectedDateElem) ? w.selectedDateElem : void 0 !== w.todayDateElem && ee(w.todayDateElem) ? w.todayDateElem : W(t > 0 ? 1 : -1); 557 void 0 === a ? w._input.focus() : n ? function (e, t) { 558 for (var n = -1 === e.className.indexOf("Month") ? e.dateObj.getMonth() : w.currentMonth, a = t > 0 ? w.config.showMonths : -1, i = t > 0 ? 1 : -1, o = n - w.currentMonth; o != a; o += i) for (var r = w.daysContainer.children[o], l = n - w.currentMonth === o ? e.$i + t : t < 0 ? r.children.length - 1 : 0, c = r.children.length, d = l; d >= 0 && d < c && d != (t > 0 ? c : -1); d += i) { 559 var s = r.children[d]; 560 if (-1 === s.className.indexOf("hidden") && X(s.dateObj) && Math.abs(e.$i - d) >= Math.abs(t)) return L(s); 561 } 562 w.changeMonth(i), R(W(i), 0); 563 }(a, t) : L(a); 564 } 565 function B(e, t) { 566 for (var n = (new Date(e, t, 1).getDay() - w.l10n.firstDayOfWeek + 7) % 7, a = w.utils.getDaysInMonth((t - 1 + 12) % 12, e), i = w.utils.getDaysInMonth(t, e), o = window.document.createDocumentFragment(), r = w.config.showMonths > 1, l = r ? "prevMonthDay hidden" : "prevMonthDay", c = r ? "nextMonthDay hidden" : "nextMonthDay", d = a + 1 - n, u = 0; d <= a; d++, u++) o.appendChild(H(l, new Date(e, t - 1, d), d, u)); 567 for (d = 1; d <= i; d++, u++) o.appendChild(H("", new Date(e, t, d), d, u)); 568 for (var f = i + 1; f <= 42 - n && (1 === w.config.showMonths || u % 7 != 0); f++, u++) o.appendChild(H(c, new Date(e, t + 1, f % i), f, u)); 569 var m = s("div", "dayContainer"); 570 return m.appendChild(o), m; 571 } 572 function J() { 573 if (void 0 !== w.daysContainer) { 574 u(w.daysContainer), w.weekNumbers && u(w.weekNumbers); 575 for (var e = document.createDocumentFragment(), t = 0; t < w.config.showMonths; t++) { 576 var n = new Date(w.currentYear, w.currentMonth, 1); 577 n.setMonth(w.currentMonth + t), e.appendChild(B(n.getFullYear(), n.getMonth())); 578 } 579 w.daysContainer.appendChild(e), w.days = w.daysContainer.firstChild, "range" === w.config.mode && 1 === w.selectedDates.length && ae(); 580 } 581 } 582 function K() { 583 if (!(w.config.showMonths > 1 || "dropdown" !== w.config.monthSelectorType)) { 584 var e = function (e) { 585 return !(void 0 !== w.config.minDate && w.currentYear === w.config.minDate.getFullYear() && e < w.config.minDate.getMonth()) && !(void 0 !== w.config.maxDate && w.currentYear === w.config.maxDate.getFullYear() && e > w.config.maxDate.getMonth()); 586 }; 587 w.monthsDropdownContainer.tabIndex = -1, w.monthsDropdownContainer.innerHTML = ""; 588 for (var t = 0; t < 12; t++) if (e(t)) { 589 var n = s("option", "flatpickr-monthDropdown-month"); 590 n.value = new Date(w.currentYear, t).getMonth().toString(), n.textContent = h(t, w.c
vendor: 11,560 bytes, lines 590-783
590onfig.shorthandCurrentMonth, w.l10n), n.tabIndex = -1, w.currentMonth === t && (n.selected = !0), w.monthsDropdownContainer.appendChild(n); 591 } 592 } 593 } 594 function U() { 595 var e, 596 t = s("div", "flatpickr-month"), 597 n = window.document.createDocumentFragment(); 598 w.config.showMonths > 1 || "static" === w.config.monthSelectorType ? e = s("span", "cur-month") : (w.monthsDropdownContainer = s("select", "flatpickr-monthDropdown-months"), w.monthsDropdownContainer.setAttribute("aria-label", w.l10n.monthAriaLabel), A(w.monthsDropdownContainer, "change", function (e) { 599 var t = g(e), 600 n = parseInt(t.value, 10); 601 w.changeMonth(n - w.currentMonth), pe("onMonthChange"); 602 }), K(), e = w.monthsDropdownContainer); 603 var a = m("cur-year", { 604 tabindex: "-1" 605 }), 606 i = a.getElementsByTagName("input")[0]; 607 i.setAttribute("aria-label", w.l10n.yearAriaLabel), w.config.minDate && i.setAttribute("min", w.config.minDate.getFullYear().toString()), w.config.maxDate && (i.setAttribute("max", w.config.maxDate.getFullYear().toString()), i.disabled = !!w.config.minDate && w.config.minDate.getFullYear() === w.config.maxDate.getFullYear()); 608 var o = s("div", "flatpickr-current-month"); 609 return o.appendChild(e), o.appendChild(a), n.appendChild(o), t.appendChild(n), { 610 container: t, 611 yearElement: i, 612 monthElement: e 613 }; 614 } 615 function q() { 616 u(w.monthNav), w.monthNav.appendChild(w.prevMonthNav), w.config.showMonths && (w.yearElements = [], w.monthElements = []); 617 for (var e = w.config.showMonths; e--;) { 618 var t = U(); 619 w.yearElements.push(t.yearElement), w.monthElements.push(t.monthElement), w.monthNav.appendChild(t.container); 620 } 621 w.monthNav.appendChild(w.nextMonthNav); 622 } 623 function $() { 624 w.weekdayContainer ? u(w.weekdayContainer) : w.weekdayContainer = s("div", "flatpickr-weekdays"); 625 for (var e = w.config.showMonths; e--;) { 626 var t = s("div", "flatpickr-weekdaycontainer"); 627 w.weekdayContainer.appendChild(t); 628 } 629 return z(), w.weekdayContainer; 630 } 631 function z() { 632 if (w.weekdayContainer) { 633 var e = w.l10n.firstDayOfWeek, 634 n = t(w.l10n.weekdays.shorthand); 635 e > 0 && e < n.length && (n = t(n.splice(e, n.length), n.splice(0, e))); 636 for (var a = w.config.showMonths; a--;) w.weekdayContainer.children[a].innerHTML = "\n <span class='flatpickr-weekday'>\n " + n.join("</span><span class='flatpickr-weekday'>") + "\n </span>\n "; 637 } 638 } 639 function G(e, t) { 640 void 0 === t && (t = !0); 641 var n = t ? e : e - w.currentMonth; 642 n < 0 && !0 === w._hidePrevMonthArrow || n > 0 && !0 === w._hideNextMonthArrow || (w.currentMonth += n, (w.currentMonth < 0 || w.currentMonth > 11) && (w.currentYear += w.currentMonth > 11 ? 1 : -1, w.currentMonth = (w.currentMonth + 12) % 12, pe("onYearChange"), K()), J(), pe("onMonthChange"), De()); 643 } 644 function V(e) { 645 return !(!w.config.appendTo || !w.config.appendTo.contains(e)) || w.calendarContainer.contains(e); 646 } 647 function Z(e) { 648 if (w.isOpen && !w.config.inline) { 649 var t = g(e), 650 n = V(t), 651 a = t === w.input || t === w.altInput || w.element.contains(t) || e.path && e.path.indexOf && (~e.path.indexOf(w.input) || ~e.path.indexOf(w.altInput)), 652 i = "blur" === e.type ? a && e.relatedTarget && !V(e.relatedTarget) : !a && !n && !V(e.relatedTarget), 653 o = !w.config.ignoredFocusElements.some(function (e) { 654 return e.contains(t); 655 }); 656 i && o && (void 0 !== w.timeContainer && void 0 !== w.minuteElement && void 0 !== w.hourElement && "" !== w.input.value && void 0 !== w.input.value && I(), w.close(), w.config && "range" === w.config.mode && 1 === w.selectedDates.length && (w.clear(!1), w.redraw())); 657 } 658 } 659 function Q(e) { 660 if (!(!e || w.config.minDate && e < w.config.minDate.getFullYear() || w.config.maxDate && e > w.config.maxDate.getFullYear())) { 661 var t = e, 662 n = w.currentYear !== t; 663 w.currentYear = t || w.currentYear, w.config.maxDate && w.currentYear === w.config.maxDate.getFullYear() ? w.currentMonth = Math.min(w.config.maxDate.getMonth(), w.currentMonth) : w.config.minDate && w.currentYear === w.config.minDate.getFullYear() && (w.currentMonth = Math.max(w.config.minDate.getMonth(), w.currentMonth)), n && (w.redraw(), pe("onYearChange"), K()); 664 } 665 } 666 function X(e, t) { 667 var n; 668 void 0 === t && (t = !0); 669 var a = w.parseDate(e, void 0, t); 670 if (w.config.minDate && a && M(a, w.config.minDate, void 0 !== t ? t : !w.minDateHasTime) < 0 || w.config.maxDate && a && M(a, w.config.maxDate, void 0 !== t ? t : !w.maxDateHasTime) > 0) return !1; 671 if (!w.config.enable && 0 === w.config.disable.length) return !0; 672 if (void 0 === a) return !1; 673 for (var i = !!w.config.enable, o = null !== (n = w.config.enable) && void 0 !== n ? n : w.config.disable, r = 0, l = void 0; r < o.length; r++) { 674 if ("function" == typeof (l = o[r]) && l(a)) return i; 675 if (l instanceof Date && void 0 !== a && l.getTime() === a.getTime()) return i; 676 if ("string" == typeof l) { 677 var c = w.parseDate(l, void 0, !0); 678 return c && c.getTime() === a.getTime() ? i : !i; 679 } 680 if ("object" == typeof l && void 0 !== a && l.from && l.to && a.getTime() >= l.from.getTime() && a.getTime() <= l.to.getTime()) return i; 681 } 682 return !i; 683 } 684 function ee(e) { 685 return void 0 !== w.daysContainer && -1 === e.className.indexOf("hidden") && -1 === e.className.indexOf("flatpickr-disabled") && w.daysContainer.contains(e); 686 } 687 function te(e) { 688 !(e.target === w._input) || !(w.selectedDates.length > 0 || w._input.value.length > 0) || e.relatedTarget && V(e.relatedTarget) || w.setDate(w._input.value, !0, e.target === w.altInput ? w.config.altFormat : w.config.dateFormat); 689 } 690 function ne(e) { 691 var t = g(e), 692 n = w.config.wrap ? p.contains(t) : t === w._input, 693 a = w.config.allowInput, 694 i = w.isOpen && (!a || !n), 695 o = w.config.inline && n && !a; 696 if (13 === e.keyCode && n) { 697 if (a) return w.setDate(w._input.value, !0, t === w.altInput ? w.config.altFormat : w.config.dateFormat), t.blur(); 698 w.open(); 699 } else if (V(t) || i || o) { 700 var r = !!w.timeContainer && w.timeContainer.contains(t); 701 switch (e.keyCode) { 702 case 13: 703 r ? (e.preventDefault(), I(), se()) : ue(e); 704 break; 705 case 27: 706 e.preventDefault(), se(); 707 break; 708 case 8: 709 case 46: 710 n && !w.config.allowInput && (e.preventDefault(), w.clear()); 711 break; 712 case 37: 713 case 39: 714 if (r || n) w.hourElement && w.hourElement.focus();else if (e.preventDefault(), void 0 !== w.daysContainer && (!1 === a || document.activeElement && ee(document.activeElement))) { 715 var l = 39 === e.keyCode ? 1 : -1; 716 e.ctrlKey ? (e.stopPropagation(), G(l), R(W(1), 0)) : R(void 0, l); 717 } 718 break; 719 case 38: 720 case 40: 721 e.preventDefault(); 722 var c = 40 === e.keyCode ? 1 : -1; 723 w.daysContainer && void 0 !== t.$i || t === w.input || t === w.altInput ? e.ctrlKey ? (e.stopPropagation(), Q(w.currentYear - c), R(W(1), 0)) : r || R(void 0, 7 * c) : t === w.currentYearElement ? Q(w.currentYear - c) : w.config.enableTime && (!r && w.hourElement && w.hourElement.focus(), I(e), w._debouncedChange()); 724 break; 725 case 9: 726 if (r) { 727 var d = [w.hourElement, w.minuteElement, w.secondElement, w.amPM].concat(w.pluginElements).filter(function (e) { 728 return e; 729 }), 730 s = d.indexOf(t); 731 if (-1 !== s) { 732 var u = d[s + (e.shiftKey ? -1 : 1)]; 733 e.preventDefault(), (u || w._input).focus(); 734 } 735 } else !w.config.noCalendar && w.daysContainer && w.daysContainer.contains(t) && e.shiftKey && (e.preventDefault(), w._input.focus()); 736 } 737 } 738 if (void 0 !== w.amPM && t === w.amPM) switch (e.key) { 739 case w.l10n.amPM[0].charAt(0): 740 case w.l10n.amPM[0].charAt(0).toLowerCase(): 741 w.amPM.textContent = w.l10n.amPM[0], S(), be(); 742 break; 743 case w.l10n.amPM[1].charAt(0): 744 case w.l10n.amPM[1].charAt(0).toLowerCase(): 745 w.amPM.textContent = w.l10n.amPM[1], S(), be(); 746 } 747 (n || V(t)) && pe("onKeyDown", e); 748 } 749 function ae(e) { 750 if (1 === w.selectedDates.length && (!e || e.classList.contains("flatpickr-day") && !e.classList.contains("flatpickr-disabled"))) { 751 for (var t = e ? e.dateObj.getTime() : w.days.firstElementChild.dateObj.getTime(), n = w.parseDate(w.selectedDates[0], void 0, !0).getTime(), a = Math.min(t, w.selectedDates[0].getTime()), i = Math.max(t, w.selectedDates[0].getTime()), o = !1, r = 0, l = 0, c = a; c < i; c += y) X(new Date(c), !0) || (o = o || c > a && c < i, c < n && (!r || c > r) ? r = c : c > n && (!l || c < l) && (l = c)); 752 for (var d = 0; d < w.config.showMonths; d++) for (var s = w.daysContainer.children[d], u = function (a, i) { 753 var c, 754 d, 755 u, 756 f = s.children[a], 757 m = f.dateObj.getTime(), 758 g = r > 0 && m < r || l > 0 && m > l; 759 return g ? (f.classList.add("notAllowed"), ["inRange", "startRange", "endRange"].forEach(function (e) { 760 f.classList.remove(e); 761 }), "continue") : o && !g ? "continue" : (["startRange", "inRange", "endRange", "notAllowed"].forEach(function (e) { 762 f.classList.remove(e); 763 }), void (void 0 !== e && (e.classList.add(t <= w.selectedDates[0].getTime() ? "startRange" : "endRange"), n < t && m === n ? f.classList.add("startRange") : n > t && m === n && f.classList.add("endRange"), m >= r && (0 === l || m <= l) && (d = n, u = t, (c = m) > Math.min(d, u) && c < Math.max(d, u)) && f.classList.add("inRange")))); 764 }, f = 0, m = s.children.length; f < m; f++) u(f); 765 } 766 } 767 function ie() { 768 !w.isOpen || w.config.static || w.config.inline || ce(); 769 } 770 function oe(e) { 771 return function (t) { 772 var n = w.config["_" + e + "Date"] = w.parseDate(t, w.config.dateFormat), 773 a = w.config["_" + ("min" === e ? "max" : "min") + "Date"]; 774 void 0 !== n && (w["min" === e ? "minDateHasTime" : "maxDateHasTime"] = n.getHours() > 0 || n.getMinutes() > 0 || n.getSeconds() > 0), w.selectedDates && (w.selectedDates = w.selectedDates.filter(function (e) { 775 return X(e); 776 }), w.selectedDates.length || "min" !== e || _(n), be()), w.daysContainer && (de(), void 0 !== n ? w.currentYearElement[e] = n.getFullYear().toString() : w.currentYearElement.removeAttribute(e), w.currentYearElement.disabled = !!a && void 0 !== n && a.getFullYear() === n.getFullYear()); 777 }; 778 } 779 function re() { 780 return w.config.wrap ? p.querySelector("[data-input]") : p; 781 } 782 function le() { 783 "object" != typeof w.config.locale && void 0 === T.l10ns[w.config.locale] && w.config.errorHandler(new Error("flatpickr: invalid locale " + w.config.locale)), w.l10n = e(e({}, T.l10ns.default), "object" == typeof w.config.locale ? w.config.locale : "default"
vendor: 9,161 bytes, lines 783-927
783!== w.config.locale ? T.l10ns[w.config.locale] : void 0), D.K = "(" + w.l10n.amPM[0] + "|" + w.l10n.amPM[1] + "|" + w.l10n.amPM[0].toLowerCase() + "|" + w.l10n.amPM[1].toLowerCase() + ")", void 0 === e(e({}, v), JSON.parse(JSON.stringify(p.dataset || {}))).time_24hr && void 0 === T.defaultConfig.time_24hr && (w.config.time_24hr = w.l10n.time_24hr), w.formatDate = b(w), w.parseDate = C({ 784 config: w.config, 785 l10n: w.l10n 786 }); 787 } 788 function ce(e) { 789 if ("function" != typeof w.config.position) { 790 if (void 0 !== w.calendarContainer) { 791 pe("onPreCalendarPosition"); 792 var t = e || w._positionElement, 793 n = Array.prototype.reduce.call(w.calendarContainer.children, function (e, t) { 794 return e + t.offsetHeight; 795 }, 0), 796 a = w.calendarContainer.offsetWidth, 797 i = w.config.position.split(" "), 798 o = i[0], 799 r = i.length > 1 ? i[1] : null, 800 l = t.getBoundingClientRect(), 801 c = window.innerHeight - l.bottom, 802 s = "above" === o || "below" !== o && c < n && l.top > n, 803 u = window.pageYOffset + l.top + (s ? -n - 2 : t.offsetHeight + 2); 804 if (d(w.calendarContainer, "arrowTop", !s), d(w.calendarContainer, "arrowBottom", s), !w.config.inline) { 805 var f = window.pageXOffset + l.left, 806 m = !1, 807 g = !1; 808 "center" === r ? (f -= (a - l.width) / 2, m = !0) : "right" === r && (f -= a - l.width, g = !0), d(w.calendarContainer, "arrowLeft", !m && !g), d(w.calendarContainer, "arrowCenter", m), d(w.calendarContainer, "arrowRight", g); 809 var p = window.document.body.offsetWidth - (window.pageXOffset + l.right), 810 h = f + a > window.document.body.offsetWidth, 811 v = p + a > window.document.body.offsetWidth; 812 if (d(w.calendarContainer, "rightMost", h), !w.config.static) if (w.calendarContainer.style.top = u + "px", h) { 813 if (v) { 814 var D = function () { 815 for (var e = null, t = 0; t < document.styleSheets.length; t++) { 816 var n = document.styleSheets[t]; 817 try { 818 n.cssRules; 819 } catch (e) { 820 continue; 821 } 822 e = n; 823 break; 824 } 825 return null != e ? e : (a = document.createElement("style"), document.head.appendChild(a), a.sheet); 826 var a; 827 }(); 828 if (void 0 === D) return; 829 var b = window.document.body.offsetWidth, 830 C = Math.max(0, b / 2 - a / 2), 831 M = D.cssRules.length, 832 y = "{left:" + l.left + "px;right:auto;}"; 833 d(w.calendarContainer, "rightMost", !1), d(w.calendarContainer, "centerMost", !0), D.insertRule(".flatpickr-calendar.centerMost:before,.flatpickr-calendar.centerMost:after" + y, M), w.calendarContainer.style.left = C + "px", w.calendarContainer.style.right = "auto"; 834 } else w.calendarContainer.style.left = "auto", w.calendarContainer.style.right = p + "px"; 835 } else w.calendarContainer.style.left = f + "px", w.calendarContainer.style.right = "auto"; 836 } 837 } 838 } else w.config.position(w, e); 839 } 840 function de() { 841 w.config.noCalendar || w.isMobile || (K(), De(), J()); 842 } 843 function se() { 844 w._input.focus(), -1 !== window.navigator.userAgent.indexOf("MSIE") || void 0 !== navigator.msMaxTouchPoints ? setTimeout(w.close, 0) : w.close(); 845 } 846 function ue(e) { 847 e.preventDefault(), e.stopPropagation(); 848 var t = f(g(e), function (e) { 849 return e.classList && e.classList.contains("flatpickr-day") && !e.classList.contains("flatpickr-disabled") && !e.classList.contains("notAllowed"); 850 }); 851 if (void 0 !== t) { 852 var n = t, 853 a = w.latestSelectedDateObj = new Date(n.dateObj.getTime()), 854 i = (a.getMonth() < w.currentMonth || a.getMonth() > w.currentMonth + w.config.showMonths - 1) && "range" !== w.config.mode; 855 if (w.selectedDateElem = n, "single" === w.config.mode) w.selectedDates = [a];else if ("multiple" === w.config.mode) { 856 var o = ve(a); 857 o ? w.selectedDates.splice(parseInt(o), 1) : w.selectedDates.push(a); 858 } else "range" === w.config.mode && (2 === w.selectedDates.length && w.clear(!1, !1), w.latestSelectedDateObj = a, w.selectedDates.push(a), 0 !== M(a, w.selectedDates[0], !0) && w.selectedDates.sort(function (e, t) { 859 return e.getTime() - t.getTime(); 860 })); 861 if (S(), i) { 862 var r = w.currentYear !== a.getFullYear(); 863 w.currentYear = a.getFullYear(), w.currentMonth = a.getMonth(), r && (pe("onYearChange"), K()), pe("onMonthChange"); 864 } 865 if (De(), J(), be(), i || "range" === w.config.mode || 1 !== w.config.showMonths ? void 0 !== w.selectedDateElem && void 0 === w.hourElement && w.selectedDateElem && w.selectedDateElem.focus() : L(n), void 0 !== w.hourElement && void 0 !== w.hourElement && w.hourElement.focus(), w.config.closeOnSelect) { 866 var l = "single" === w.config.mode && !w.config.enableTime, 867 c = "range" === w.config.mode && 2 === w.selectedDates.length && !w.config.enableTime; 868 (l || c) && se(); 869 } 870 N(); 871 } 872 } 873 w.parseDate = C({ 874 config: w.config, 875 l10n: w.l10n 876 }), w._handlers = [], w.pluginElements = [], w.loadedPlugins = [], w._bind = A, w._setHoursFromDate = _, w._positionCalendar = ce, w.changeMonth = G, w.changeYear = Q, w.clear = function (e, t) { 877 void 0 === e && (e = !0); 878 void 0 === t && (t = !0); 879 w.input.value = "", void 0 !== w.altInput && (w.altInput.value = ""); 880 void 0 !== w.mobileInput && (w.mobileInput.value = ""); 881 w.selectedDates = [], w.latestSelectedDateObj = void 0, !0 === t && (w.currentYear = w._initialDate.getFullYear(), w.currentMonth = w._initialDate.getMonth()); 882 if (!0 === w.config.enableTime) { 883 var n = x(w.config), 884 a = n.hours, 885 i = n.minutes, 886 o = n.seconds; 887 O(a, i, o); 888 } 889 w.redraw(), e && pe("onChange"); 890 }, w.close = function () { 891 w.isOpen = !1, w.isMobile || (void 0 !== w.calendarContainer && w.calendarContainer.classList.remove("open"), void 0 !== w._input && w._input.classList.remove("active")); 892 pe("onClose"); 893 }, w._createElement = s, w.destroy = function () { 894 void 0 !== w.config && pe("onDestroy"); 895 for (var e = w._handlers.length; e--;) w._handlers[e].remove(); 896 if (w._handlers = [], w.mobileInput) w.mobileInput.parentNode && w.mobileInput.parentNode.removeChild(w.mobileInput), w.mobileInput = void 0;else if (w.calendarContainer && w.calendarContainer.parentNode) if (w.config.static && w.calendarContainer.parentNode) { 897 var t = w.calendarContainer.parentNode; 898 if (t.lastChild && t.removeChild(t.lastChild), t.parentNode) { 899 for (; t.firstChild;) t.parentNode.insertBefore(t.firstChild, t); 900 t.parentNode.removeChild(t); 901 } 902 } else w.calendarContainer.parentNode.removeChild(w.calendarContainer); 903 w.altInput && (w.input.type = "text", w.altInput.parentNode && w.altInput.parentNode.removeChild(w.altInput), delete w.altInput); 904 w.input && (w.input.type = w.input._type, w.input.classList.remove("flatpickr-input"), w.input.removeAttribute("readonly")); 905 ["_showTimeInput", "latestSelectedDateObj", "_hideNextMonthArrow", "_hidePrevMonthArrow", "__hideNextMonthArrow", "__hidePrevMonthArrow", "isMobile", "isOpen", "selectedDateElem", "minDateHasTime", "maxDateHasTime", "days", "daysContainer", "_input", "_positionElement", "innerContainer", "rContainer", "monthNav", "todayDateElem", "calendarContainer", "weekdayContainer", "prevMonthNav", "nextMonthNav", "monthsDropdownContainer", "currentMonthElement", "currentYearElement", "navigationCurrentMonth", "selectedDateElem", "config"].forEach(function (e) { 906 try { 907 delete w[e]; 908 } catch (e) {} 909 }); 910 }, w.isEnabled = X, w.jumpToDate = P, w.open = function (e, t) { 911 void 0 === t && (t = w._positionElement); 912 if (!0 === w.isMobile) { 913 if (e) { 914 e.preventDefault(); 915 var n = g(e); 916 n && n.blur(); 917 } 918 return void 0 !== w.mobileInput && (w.mobileInput.focus(), w.mobileInput.click()), void pe("onOpen"); 919 } 920 if (w._input.disabled || w.config.inline) return; 921 var a = w.isOpen; 922 w.isOpen = !0, a || (w.calendarContainer.classList.add("open"), w._input.classList.add("active"), pe("onOpen"), ce(t)); 923 !0 === w.config.enableTime && !0 === w.config.noCalendar && (!1 !== w.config.allowInput || void 0 !== e && w.timeContainer.contains(e.relatedTarget) || setTimeout(function () { 924 return w.hourElement.select(); 925 }, 50)); 926 }, w.redraw = de, w.set = function (e, t) { 927 if (null !== e && "object" == typeof e) for (var a in Object.assign(w.config, e), e) void 0 !== fe[a] && fe[a].forEac
927h(function (e) { 928 return e(); 929 });else w.config[e] = t, void 0 !== fe[e] ? fe[e].forEach(function (e) { 930 return e(); 931 }) : n.indexOf(e) > -1 && (w.config[e] = c(t)); 932 w.redraw(), be(!0); 933 }, w.setDate = function (e, t, n) { 934 void 0 === t && (t = !1); 935 void 0 === n && (n = w.config.dateFormat); 936 if (0 !== e && !e || e instanceof Array && 0 === e.length) return w.clear(t); 937 me(e, n), w.latestSelectedDateObj = w.selectedDates[w.selectedDates.length - 1], w.redraw(), P(void 0, t), _(), 0 === w.selectedDates.length && w.clear(!1); 938 be(t), t && pe("onChange"); 939 }, w.toggle = function (e) { 940 if (!0 === w.isOpen) return w.close(); 941 w.open(e); 942 }; 943 var fe = { 944 locale: [le, z], 945 showMonths: [q, k, $], 946 minDate: [P], 947 maxDate: [P], 948 clickOpens: [function () { 949 !0 === w.config.clickOpens ? (A(w._input, "focus", w.open), A(w._input, "click", w.open)) : (w._input.removeEventListener("focus", w.open), w._input.removeEventListener("click", w.open)); 950 }] 951 }; 952 function me(e, t) { 953 var n = []; 954 if (e instanceof Array) n = e.map(function (e) { 955 return w.parseDate(e, t); 956 });else if (e instanceof Date || "number" == typeof e) n = [w.parseDate(e, t)];else if ("string" == typeof e) switch (w.config.mode) { 957 case "single": 958 case "time": 959 n = [w.parseDate(e, t)]; 960 break; 961 case "multiple": 962 n = e.split(w.config.conjunction).map(function (e) { 963 return w.parseDate(e, t); 964 }); 965 break; 966 case "range": 967 n = e.split(w.l10n.rangeSeparator).map(function (e) { 968 return w.parseDate(e, t); 969 }); 970 } else w.config.errorHandler(new Error("Invalid date supplied: " + JSON.stringify(e))); 971 w.selectedDates = w.config.allowInvalidPreload ? n : n.filter(function (e) { 972 return e instanceof Date && X(e, !1); 973 }), "range" === w.config.mode && w.selectedDates.sort(function (e, t) { 974 return e.getTime() - t.getTime(); 975 }); 976 } 977 function ge(e) { 978 return e.slice().map(function (e) { 979 return "string" == typeof e || "number" == typeof e || e instanceof Date ? w.parseDate(e, void 0, !0) : e && "object" == typeof e && e.from && e.to ? { 980 from: w.parseDate(e.from, void 0), 981 to: w.parseDate(e.to, void 0) 982 } : e; 983 }).filter(function (e) { 984 return e; 985 }); 986 } 987 function pe(e, t) { 988 if (void 0 !== w.config) { 989 var n = w.config[e]; 990 if (void 0 !== n && n.length > 0) for (var a = 0; n[a] && a < n.length; a++) n[a](w.selectedDates, w.input.value, w, t); 991 "onChange" === e && (w.input.dispatchEvent(he("change")), w.input.dispatchEvent(he("input"))); 992 } 993 } 994 function he(e) { 995 var t = document.createEvent("Event"); 996 return t.initEvent(e, !0, !0), t; 997 } 998 function ve(e) { 999 for (var t = 0; t < w.selectedDates.length; t++) if (0 === M(w.selectedDates[t], e)) return "" + t; 1000 return !1; 1001 } 1002 function De() { 1003 w.config.noCalendar || w.isMobile || !w.monthNav || (w.yearElements.forEach(function (e, t) { 1004 var n = new Date(w.currentYear, w.currentMonth, 1); 1005 n.setMonth(w.currentMonth + t), w.config.showMonths > 1 || "static" === w.config.monthSelectorType ? w.monthElements[t].textContent = h(n.getMonth(), w.config.shorthandCurrentMonth, w.l10n) + " " : w.monthsDropdownContainer.value = n.getMonth().toString(), e.value = n.getFullYear().toString(); 1006 }), w._hidePrevMonthArrow = void 0 !== w.config.minDate && (w.currentYear === w.config.minDate.getFullYear() ? w.currentMonth <= w.config.minDate.getMonth() : w.currentYear < w.config.minDate.getFullYear()), w._hideNextMonthArrow = void 0 !== w.config.maxDate && (w.currentYear === w.config.maxDate.getFullYear() ? w.currentMonth + 1 > w.config.maxDate.getMonth() : w.currentYear > w.config.maxDate.getFullYear())); 1007 } 1008 function we(e) { 1009 return w.selectedDates.map(function (t) { 1010 return w.formatDate(t, e); 1011 }).filter(function (e, t, n) { 1012 return "range" !== w.config.mode || w.config.enableTime || n.indexOf(e) === t; 1013 }).join("range" !== w.config.mode ? w.config.conjunction : w.l10n.rangeSeparator); 1014 } 1015 function be(e) { 1016 void 0 === e && (e = !0), void 0 !== w.mobileInput && w.mobileFormatStr && (w.mobileInput.value = void 0 !== w.latestSelectedDateObj ? w.formatDate(w.latestSelectedDateObj, w.mobileFormatStr) : ""), w.input.value = we(w.config.dateFormat), void 0 !== w.altInput && (w.altInput.value = we(w.config.altFormat)), !1 !== e && pe("onValueUpdate"); 1017 } 1018 function Ce(e) { 1019 var t = g(e), 1020 n = w.prevMonthNav.contains(t), 1021 a = w.nextMonthNav.contains(t); 1022 n || a ? G(n ? -1 : 1) : w.yearElements.indexOf(t) >= 0 ? t.select() : t.classList.contains("arrowUp") ? w.changeYear(w.currentYear + 1) : t.classList.contains("arrowDown") && w.changeYear(w.currentYear - 1); 1023 } 1024 return function () { 1025 w.element = w.input = p, w.isOpen = !1, function () { 1026 var t = ["wrap", "weekNumbers", "allowInput", "allowInvalidPreload", "clickOpens", "time_24hr", "enableTime", "noCalendar", "altInput", "shorthandCurrentMonth", "inline", "static", "enableSeconds", "disableMobile"], 1027 i = e(e({}, JSON.parse(JSON.stringify(p.dataset || {}))), v), 1028 o = {}; 1029 w.config.parseDate = i.parseDate, w.config.formatDate = i.formatDate, Object.defineProperty(w.config, "enable", { 1030 get: function () { 1031 return w.config._enable; 1032 }, 1033 set: function (e) { 1034 w.config._enable = ge(e); 1035 } 1036 }), Object.defineProperty(w.config, "disable", { 1037 get: function () { 1038 return w.config._disable; 1039 }, 1040 set: function (e) { 1041 w.config._disable = ge(e); 1042 } 1043 }); 1044 var r = "time" === i.mode; 1045 if (!i.dateFormat && (i.enableTime || r)) { 1046 var l = T.defaultConfig.dateFormat || a.dateFormat; 1047 o.dateFormat = i.noCalendar || r ? "H:i" + (i.enableSeconds ? ":S" : "") : l + " H:i" + (i.enableSeconds ? ":S" : ""); 1048 } 1049 if (i.altInput && (i.enableTime || r) && !i.altFormat) { 1050 var d = T.defaultConfig.altFormat || a.altFormat; 1051 o.altFormat = i.noCalendar || r ? "h:i" + (i.enableSeconds ? ":S K" : " K") : d + " h:i" + (i.enableSeconds ? ":S" : "") + " K"; 1052 } 1053 Object.defineProperty(w.config, "minDate", { 1054 get: function () { 1055 return w.config._minDate; 1056 }, 1057 set: oe("min") 1058 }), Object.defineProperty(w.config, "maxDate", { 1059 get: function () { 1060 return w.config._maxDate; 1061 }, 1062 set: oe("max") 1063 }); 1064 var s = function (e) { 1065 return function (t) { 1066 w.config["min" === e ? "_minTime" : "_maxTime"] = w.parseDate(t, "H:i:S"); 1067 }; 1068 }; 1069 Object.defineProperty(w.config, "minTime", { 1070 get: function () { 1071 return w.config._minTime; 1072 }, 1073 set: s("min") 1074 }), Object.defineProperty(w.config, "maxTime", { 1075 get: function () { 1076 return w.config._maxTime; 1077 }, 1078 set: s("max") 1079 }), "time" === i.mode && (w.config.noCalendar = !0, w.config.enableTime = !0); 1080 Object.assign(w.config, o, i); 1081 for (var u = 0; u < t.length; u++) w.config[t[u]] = !0 === w.config[t[u]] || "true" === w.config[t[u]]; 1082 n.filter(function (e) { 1083 return void 0 !== w.config[e]; 1084 }
vendor: 11,346 bytes, lines 1084-1208
1084).forEach(function (e) { 1085 w.config[e] = c(w.config[e] || []).map(E); 1086 }), w.isMobile = !w.config.disableMobile && !w.config.inline && "single" === w.config.mode && !w.config.disable.length && !w.config.enable && !w.config.weekNumbers && /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); 1087 for (u = 0; u < w.config.plugins.length; u++) { 1088 var f = w.config.plugins[u](w) || {}; 1089 for (var m in f) n.indexOf(m) > -1 ? w.config[m] = c(f[m]).map(E).concat(w.config[m]) : void 0 === i[m] && (w.config[m] = f[m]); 1090 } 1091 i.altInputClass || (w.config.altInputClass = re().className + " " + w.config.altInputClass); 1092 pe("onParseConfig"); 1093 }(), le(), function () { 1094 if (w.input = re(), !w.input) return void w.config.errorHandler(new Error("Invalid input element specified")); 1095 w.input._type = w.input.type, w.input.type = "text", w.input.classList.add("flatpickr-input"), w._input = w.input, w.config.altInput && (w.altInput = s(w.input.nodeName, w.config.altInputClass), w._input = w.altInput, w.altInput.placeholder = w.input.placeholder, w.altInput.disabled = w.input.disabled, w.altInput.required = w.input.required, w.altInput.tabIndex = w.input.tabIndex, w.altInput.type = "text", w.input.setAttribute("type", "hidden"), !w.config.static && w.input.parentNode && w.input.parentNode.insertBefore(w.altInput, w.input.nextSibling)); 1096 w.config.allowInput || w._input.setAttribute("readonly", "readonly"); 1097 w._positionElement = w.config.positionElement || w._input; 1098 }(), function () { 1099 w.selectedDates = [], w.now = w.parseDate(w.config.now) || new Date(); 1100 var e = w.config.defaultDate || ("INPUT" !== w.input.nodeName && "TEXTAREA" !== w.input.nodeName || !w.input.placeholder || w.input.value !== w.input.placeholder ? w.input.value : null); 1101 e && me(e, w.config.dateFormat); 1102 w._initialDate = w.selectedDates.length > 0 ? w.selectedDates[0] : w.config.minDate && w.config.minDate.getTime() > w.now.getTime() ? w.config.minDate : w.config.maxDate && w.config.maxDate.getTime() < w.now.getTime() ? w.config.maxDate : w.now, w.currentYear = w._initialDate.getFullYear(), w.currentMonth = w._initialDate.getMonth(), w.selectedDates.length > 0 && (w.latestSelectedDateObj = w.selectedDates[0]); 1103 void 0 !== w.config.minTime && (w.config.minTime = w.parseDate(w.config.minTime, "H:i")); 1104 void 0 !== w.config.maxTime && (w.config.maxTime = w.parseDate(w.config.maxTime, "H:i")); 1105 w.minDateHasTime = !!w.config.minDate && (w.config.minDate.getHours() > 0 || w.config.minDate.getMinutes() > 0 || w.config.minDate.getSeconds() > 0), w.maxDateHasTime = !!w.config.maxDate && (w.config.maxDate.getHours() > 0 || w.config.maxDate.getMinutes() > 0 || w.config.maxDate.getSeconds() > 0); 1106 }(), w.utils = { 1107 getDaysInMonth: function (e, t) { 1108 return void 0 === e && (e = w.currentMonth), void 0 === t && (t = w.currentYear), 1 === e && (t % 4 == 0 && t % 100 != 0 || t % 400 == 0) ? 29 : w.l10n.daysInMonth[e]; 1109 } 1110 }, w.isMobile || function () { 1111 var e = window.document.createDocumentFragment(); 1112 if (w.calendarContainer = s("div", "flatpickr-calendar"), w.calendarContainer.tabIndex = -1, !w.config.noCalendar) { 1113 if (e.appendChild((w.monthNav = s("div", "flatpickr-months"), w.yearElements = [], w.monthElements = [], w.prevMonthNav = s("span", "flatpickr-prev-month"), w.prevMonthNav.innerHTML = w.config.prevArrow, w.nextMonthNav = s("span", "flatpickr-next-month"), w.nextMonthNav.innerHTML = w.config.nextArrow, q(), Object.defineProperty(w, "_hidePrevMonthArrow", { 1114 get: function () { 1115 return w.__hidePrevMonthArrow; 1116 }, 1117 set: function (e) { 1118 w.__hidePrevMonthArrow !== e && (d(w.prevMonthNav, "flatpickr-disabled", e), w.__hidePrevMonthArrow = e); 1119 } 1120 }), Object.defineProperty(w, "_hideNextMonthArrow", { 1121 get: function () { 1122 return w.__hideNextMonthArrow; 1123 }, 1124 set: function (e) { 1125 w.__hideNextMonthArrow !== e && (d(w.nextMonthNav, "flatpickr-disabled", e), w.__hideNextMonthArrow = e); 1126 } 1127 }), w.currentYearElement = w.yearElements[0], De(), w.monthNav)), w.innerContainer = s("div", "flatpickr-innerContainer"), w.config.weekNumbers) { 1128 var t = function () { 1129 w.calendarContainer.classList.add("hasWeeks"); 1130 var e = s("div", "flatpickr-weekwrapper"); 1131 e.appendChild(s("span", "flatpickr-weekday", w.l10n.weekAbbreviation)); 1132 var t = s("div", "flatpickr-weeks"); 1133 return e.appendChild(t), { 1134 weekWrapper: e, 1135 weekNumbers: t 1136 }; 1137 }(), 1138 n = t.weekWrapper, 1139 a = t.weekNumbers; 1140 w.innerContainer.appendChild(n), w.weekNumbers = a, w.weekWrapper = n; 1141 } 1142 w.rContainer = s("div", "flatpickr-rContainer"), w.rContainer.appendChild($()), w.daysContainer || (w.daysContainer = s("div", "flatpickr-days"), w.daysContainer.tabIndex = -1), J(), w.rContainer.appendChild(w.daysContainer), w.innerContainer.appendChild(w.rContainer), e.appendChild(w.innerContainer); 1143 } 1144 w.config.enableTime && e.appendChild(function () { 1145 w.calendarContainer.classList.add("hasTime"), w.config.noCalendar && w.calendarContainer.classList.add("noCalendar"); 1146 var e = x(w.config); 1147 w.timeContainer = s("div", "flatpickr-time"), w.timeContainer.tabIndex = -1; 1148 var t = s("span", "flatpickr-time-separator", ":"), 1149 n = m("flatpickr-hour", { 1150 "aria-label": w.l10n.hourAriaLabel 1151 }); 1152 w.hourElement = n.getElementsByTagName("input")[0]; 1153 var a = m("flatpickr-minute", { 1154 "aria-label": w.l10n.minuteAriaLabel 1155 }); 1156 w.minuteElement = a.getElementsByTagName("input")[0], w.hourElement.tabIndex = w.minuteElement.tabIndex = -1, w.hourElement.value = o(w.latestSelectedDateObj ? w.latestSelectedDateObj.getHours() : w.config.time_24hr ? e.hours : function (e) { 1157 switch (e % 24) { 1158 case 0: 1159 case 12: 1160 return 12; 1161 default: 1162 return e % 12; 1163 } 1164 }(e.hours)), w.minuteElement.value = o(w.latestSelectedDateObj ? w.latestSelectedDateObj.getMinutes() : e.minutes), w.hourElement.setAttribute("step", w.config.hourIncrement.toString()), w.minuteElement.setAttribute("step", w.config.minuteIncrement.toString()), w.hourElement.setAttribute("min", w.config.time_24hr ? "0" : "1"), w.hourElement.setAttribute("max", w.config.time_24hr ? "23" : "12"), w.hourElement.setAttribute("maxlength", "2"), w.minuteElement.setAttribute("min", "0"), w.minuteElement.setAttribute("max", "59"), w.minuteElement.setAttribute("maxlength", "2"), w.timeContainer.appendChild(n), w.timeContainer.appendChild(t), w.timeContainer.appendChild(a), w.config.time_24hr && w.timeContainer.classList.add("time24hr"); 1165 if (w.config.enableSeconds) { 1166 w.timeContainer.classList.add("hasSeconds"); 1167 var i = m("flatpickr-second"); 1168 w.secondElement = i.getElementsByTagName("input")[0], w.secondElement.value = o(w.latestSelectedDateObj ? w.latestSelectedDateObj.getSeconds() : e.seconds), w.secondElement.setAttribute("step", w.minuteElement.getAttribute("step")), w.secondElement.setAttribute("min", "0"), w.secondElement.setAttribute("max", "59"), w.secondElement.setAttribute("maxlength", "2"), w.timeContainer.appendChild(s("span", "flatpickr-time-separator", ":")), w.timeContainer.appendChild(i); 1169 } 1170 w.config.time_24hr || (w.amPM = s("span", "flatpickr-am-pm", w.l10n.amPM[r((w.latestSelectedDateObj ? w.hourElement.value : w.config.defaultHour) > 11)]), w.amPM.title = w.l10n.toggleTitle, w.amPM.tabIndex = -1, w.timeContainer.appendChild(w.amPM)); 1171 return w.timeContainer; 1172 }()); 1173 d(w.calendarContainer, "rangeMode", "range" === w.config.mode), d(w.calendarContainer, "animate", !0 === w.config.animate), d(w.calendarContainer, "multiMonth", w.config.showMonths > 1), w.calendarContainer.appendChild(e); 1174 var i = void 0 !== w.config.appendTo && void 0 !== w.config.appendTo.nodeType; 1175 if ((w.config.inline || w.config.static) && (w.calendarContainer.classList.add(w.config.inline ? "inline" : "static"), w.config.inline && (!i && w.element.parentNode ? w.element.parentNode.insertBefore(w.calendarContainer, w._input.nextSibling) : void 0 !== w.config.appendTo && w.config.appendTo.appendChild(w.calendarContainer)), w.config.static)) { 1176 var l = s("div", "flatpickr-wrapper"); 1177 w.element.parentNode && w.element.parentNode.insertBefore(l, w.element), l.appendChild(w.element), w.altInput && l.appendChild(w.altInput), l.appendChild(w.calendarContainer); 1178 } 1179 w.config.static || w.config.inline || (void 0 !== w.config.appendTo ? w.config.appendTo : window.document.body).appendChild(w.calendarContainer); 1180 }(), function () { 1181 w.config.wrap && ["open", "close", "toggle", "clear"].forEach(function (e) { 1182 Array.prototype.forEach.call(w.element.querySelectorAll("[data-" + e + "]"), function (t) { 1183 return A(t, "click", w[e]); 1184 }); 1185 }); 1186 if (w.isMobile) return void function () { 1187 var e = w.config.enableTime ? w.config.noCalendar ? "time" : "datetime-local" : "date"; 1188 w.mobileInput = s("input", w.input.className + " flatpickr-mobile"), w.mobileInput.tabIndex = 1, w.mobileInput.type = e, w.mobileInput.disabled = w.input.disabled, w.mobileInput.required = w.input.required, w.mobileInput.placeholder = w.input.placeholder, w.mobileFormatStr = "datetime-local" === e ? "Y-m-d\\TH:i:S" : "date" === e ? "Y-m-d" : "H:i:S", w.selectedDates.length > 0 && (w.mobileInput.defaultValue = w.mobileInput.value = w.formatDate(w.selectedDates[0], w.mobileFormatStr)); 1189 w.config.minDate && (w.mobileInput.min = w.formatDate(w.config.minDate, "Y-m-d")); 1190 w.config.maxDate && (w.mobileInput.max = w.formatDate(w.config.maxDate, "Y-m-d")); 1191 w.input.getAttribute("step") && (w.mobileInput.step = String(w.input.getAttribute("step"))); 1192 w.input.type = "hidden", void 0 !== w.altInput && (w.altInput.type = "hidden"); 1193 try { 1194 w.input.parentNode && w.input.parentNode.insertBefore(w.mobileInput, w.input.nextSibling); 1195 } catch (e) {} 1196 A(w.mobileInput, "change", function (e) { 1197 w.setDate(g(e).value, !1, w.mobileFormatStr), pe("onChange"), pe("onClose"); 1198 }); 1199 }(); 1200 var e = l(ie, 50); 1201 w._debouncedChange = l(N, 300), w.daysContainer && !/iPhone|iPad|iPod/i.test(navigator.userAgent) && A(w.daysContainer, "mouseover", function (e) { 1202 "range" === w.config.mode && ae(g(e)); 1203 }); 1204 A(window.document.body, "keydown", ne), w.config.inline || w.config.static || A(window, "resize", e); 1205 void 0 !== window.ontouchstart ? A(window.document, "touchstart", Z) : A(window.document, "mousedown", Z); 1206 A(window.document, "focus", Z, { 1207 capture: !0 1208 }
1208), !0 === w.config.clickOpens && (A(w._input, "focus", w.open), A(w._input, "click", w.open)); 1209 void 0 !== w.daysContainer && (A(w.monthNav, "click", Ce), A(w.monthNav, ["keyup", "increment"], F), A(w.daysContainer, "click", ue)); 1210 if (void 0 !== w.timeContainer && void 0 !== w.minuteElement && void 0 !== w.hourElement) { 1211 var t = function (e) { 1212 return g(e).select(); 1213 }; 1214 A(w.timeContainer, ["increment"], I), A(w.timeContainer, "blur", I, { 1215 capture: !0 1216 }), A(w.timeContainer, "click", Y), A([w.hourElement, w.minuteElement], ["focus", "click"], t), void 0 !== w.secondElement && A(w.secondElement, "focus", function () { 1217 return w.secondElement && w.secondElement.select(); 1218 }), void 0 !== w.amPM && A(w.amPM, "click", function (e) { 1219 I(e), N(); 1220 }); 1221 } 1222 w.config.allowInput && A(w._input, "blur", te); 1223 }(), (w.selectedDates.length || w.config.noCalendar) && (w.config.enableTime && _(w.config.noCalendar ? w.latestSelectedDateObj : void 0), be(!1)), k(); 1224 var t = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); 1225 !w.isMobile && t && ce(), pe("onReady"); 1226 }(), w; 1227 } 1228 function k(e, t) { 1229 for (var n = Array.prototype.slice.call(e).filter(function (e) { 1230 return e instanceof HTMLElement; 1231 }), a = [], i = 0; i < n.length; i++) { 1232 var o = n[i]; 1233 try { 1234 if (null !== o.getAttribute("data-fp-omit")) continue; 1235 void 0 !== o._flatpickr && (o._flatpickr.destroy(), o._flatpickr = void 0), o._flatpickr = E(o, t || {}), a.push(o._flatpickr); 1236 } catch (e) { 1237 console.error(e); 1238 } 1239 } 1240 return 1 === a.length ? a[0] : a; 1241 } 1242 "undefined" != typeof HTMLElement && "undefined" != typeof HTMLCollection && "undefined" != typeof NodeList && (HTMLCollection.prototype.flatpickr = NodeList.prototype.flatpickr = function (e) { 1243 return k(this, e); 1244 }, HTMLElement.prototype.flatpickr = function (e) { 1245 return k([this], e); 1246 }); 1247 var T = function (e, t) { 1248 return "string" == typeof e ? k(window.document.querySelectorAll(e), t) : e instanceof Node ? k([e], t) : k(e, t); 1249 }; 1250 return T.defaultConfig = {}, T.l10ns = { 1251 en: e({}, i), 1252 default: e({}, i) 1253 }, T.localize = function (t) { 1254 T.l10ns.default = e(e({}, T.l10ns.default), t); 1255 }, T.setDefaults = function (t) { 1256 T.defaultConfig = e(e({}, T.defaultConfig), t); 1257 }, T.parseDate = C({}), T.formatDate = b({}), T.compareDates = M, "undefined" != typeof jQuery && void 0 !== jQuery.fn && (jQuery.fn.flatpickr = function (e) { 1258 return k(this, e); 1259 }), Date.prototype.fp_incr = function (e) { 1260 return new Date(this.getFullYear(), this.getMonth(), this.getDate() + ("string" == typeof e ? parseInt(e, 10) : e)); 1261 }, "undefined" != typeof window && (window.flatpickr = T), T; 1262}); 1263"use strict"; 1264 1265var slopeBlockPreviewManager = function () { 1266 var DEFAULT_MAIN_COLOR = '#ffffff'; 1267 var DEFAULT_FONT_COLOR = '#404040'; 1268 var FORCE_MOBILE_LAYOUT = slpWidgetOptions.force_mobile_layout; 1269 function createSlopeBlock(el, children) { 1270 var className = FORCE_MOBILE_LAYOUT ? 'slope-block' : 'slp-responsive-layout slope-block'; 1271 return el('div', { 1272 className: className, 1273 style: { 1274 background: DEFAULT_MAIN_COLOR, 1275 color: DEFAULT_FONT_COLOR 1276 } 1277 }, children); 1278 } 1279 function createSlopeReservationSection(el, children) { 1280 return el('div', { 1281 className: ['slope-reservation-section-container'] 1282 }, children); 1283 } 1284 function createSlopeReservationDates(el) { 1285 return el('div', { 1286 className: ['slope-reservation-dates'] 1287 }, [createSlopeReservationSection(el, createSlopeArrival(el)), createSlopeReservationSection(el, createSlopeDeparture(el))]); 1288 } 1289 function createSlopeArrival(el) { 1290 var today = new Date(); 1291 return el('div', { 1292 className: 'slope-check-in-wrapper' 1293 }, [el('span', { 1294 className: 'slope-check-in-label' 1295 }, 'Check-in'), el('span', { 1296 className: 'slope-check-in-date' 1297 }, today.getDate() + ' Ago, ' + today.getFullYear())]); 1298 } 1299 function createSlopeDeparture(el) { 1300 var today = new Date(); 1301 return el('div', { 1302 className: 'slope-check-out-wrapper' 1303 }, [el('span', { 1304 className: 'slope-check-out-label' 1305 }, 'Check-out'), el('span', { 1306 className: 'slope-check-out-date' 1307 }, today.getDate() + 1 + ' Ago, ' + today.getFullYear())]); 1308 } 1309 function createSlopeVerticalDivider(el) { 1310 return el('div', { 1311 className: 'slope-vertical-divider' 1312 }); 1313 } 1314 function createSlopeGuestsAndButtonContainer(el) { 1315 return el('div', { 1316 className: 'slope-guests-and-button-container' 1317 }, [createSlopeReservationSection(el, [createSlopeGuests(el)]), createSlopeSubmitButton(el)]); 1318 } 1319 function createSlopeRooms(el) { 1320 return el('div', { 1321 className: 'slope-rooms-count-container' 1322 }, [el('span', { 1323 className: 'slope-rooms-label' 1324 }, 'Alloggi'), el('span', { 1325 className: 'slope-rooms-count' 1326 }, '1')]); 1327 } 1328 function createSlopeGuests(el) { 1329 return el('div', { 1330 className: 'slope-guests-wrapper' 1331 }, [createSlopeRooms(el), el('div', { 1332 className: 'slope-guests-count-container' 1333 }, [el('span', { 1334 className: 'slope-guests-label' 1335 }, 'Ospiti'), el('span', { 1336 className: 'slope-adults-count' 1337 }, '2'), el('span', { 1338 className: 'slope-guests-adults' 1339 }, ' Adulti'), el('span', { 1340 className: 'slope-children-count' 1341 }, ' 0'), el('span', { 1342 className: 'slope-guests-children' 1343 }, ' Bambini')])]); 1344 } 1345 function createSlopeSubmitButton(el) { 1346 return el('div', { 1347 className: 'slope-reservation-section-container slope-submit-section' 1348 }, [el('input', { 1349 className: 'slope-reservation-submit', 1350 type: 'submit', 1351 value: 'Prenota ora', 1352 style: { 1353 background: DEFAULT_FONT_COLOR, 1354 color: DEFAULT_MAIN_COLOR 1355 } 1356 })]); 1357 } 1358 function createSlopeLanguageSelect(el, languages, props) { 1359 return el('select', { 1360 className: 'slope-block-language-select', 1361 selectedIndex: languages.indexOf(props.attributes.lang), 1362 style: { 1363 fontSize: '10px !important', 1364 height: '30px !important', 1365 width: '30px !important', 1366 minWidth: 'none !important' 1367 }, 1368 onChange: function onChange() { 1369 // Find a cleaner way to not use document.activeElement 1370 props.setAttributes({ 1371 lang: document.activeElement.options[document.activeElement.selectedIndex].value 1372 }); 1373 } 1374 }, languages.map(function (lang) { 1375 return el('option', { 1376 value: lang, 1377 selected: lang === props.attributes.lang 1378 }, lang.toUpperCase()); 1379 })); 1380 } 1381 return { 1382 createSlopeBlock: createSlopeBlock, 1383 createSlopeReservationDates: createSlopeReservationDates, 1384 createSlopeVerticalDivider: createSlopeVerticalDivider, 1385 createSlopeGuestsAndButtonContainer: createSlopeGuestsAndButtonContainer, 1386 createSlopeLanguageSelect: createSlopeLanguageSelect 1387 }; 1388}(); 1389"use strict"; 1390 1391var slopeDateRangePicker = function () { 1392 var DEFAULT_PLUGIN_LANG = 'it'; 1393 function init($) { 1394 updateDates(this, this.currentLocale, this.scope); 1395 var $this = this; 1396 1397 // This is the most ugly thing i did in my life: 1398 // - in order to make the calendar change top property and showing correctly on top or bottom of the slope-block 1399 // we hide the calender first, then check if the calendar has the class 'arrowBottom' then set we close the calendar 1400 // and finally reopen it. 1401 $(this.scope + '.slope-check-in-wrapper').parent().on('click', function () { 1402 $this.calendarContainer.style.visibility = 'hidden'; 1403 $this.open(); 1404 setTimeout(function () { 1405 var input = document.querySelector($this.scope + ' .slope-block .slope-check-in-in
1405put'); 1406 var isBottomCalendar = $this.calendarContainer.getAttribute('class').split(' ').indexOf('arrowBottom') > 0; 1407 if (isBottomCalendar) { 1408 input.style.top = '-8px'; 1409 } else { 1410 input.style.top = '88px'; 1411 } 1412 $this.close(); 1413 $this.calendarContainer.style.visibility = 'visible'; 1414 $this.open(); 1415 }, 0); 1416 }); 1417 $(this.scope + '.slope-check-out-wrapper').parent().on('click', function () { 1418 $this.calendarContainer.style.visibility = 'hidden'; 1419 $this.open(); 1420 setTimeout(function () { 1421 // This is still check-in because the calendar refers only to the check-in input 1422 var input = document.querySelector($this.scope + ' .slope-block .slope-check-in-input'); 1423 var isBottomCalendar = $this.calendarContainer.getAttribute('class').split(' ').indexOf('arrowBottom') > 0; 1424 if (isBottomCalendar) { 1425 input.style.top = '-8px'; 1426 } else { 1427 input.style.top = '88px'; 1428 } 1429 $this.close(); 1430 $this.calendarContainer.style.visibility = 'visible'; 1431 $this.open(); 1432 }, 0); 1433 }); 1434 } 1435 function updateDates(self, locale, scope) { 1436 var start = new Date(); 1437 var end = new Date(); 1438 if (!!self.selectedDates && self.selectedDates.length < 2) { 1439 end.setDate(start.getDate() + self.minDays); 1440 self.selectedDates = [start, end]; 1441 } 1442 // if (!self.selectedDates[0]) { 1443 // var checkInDate = document.querySelector(self.scope + '.slope-check-in-input').value.split('/'); 1444 // var checkInDay = checkInDate[0]; 1445 // var checkInMonth = checkInDate[1] - 1; 1446 // var checkInYear = checkInDate[2]; 1447 // self.selectedDates[0] = new Date(checkInYear, checkInMonth, checkInDay); 1448 // } 1449 // if (!self.selectedDates[1]) { 1450 // var checkOutDate = document.querySelector(self.scope + '.slope-check-out-input').value.split('/'); 1451 // var checkOutDay = checkOutDate[0]; 1452 // var checkOutMonth = checkOutDate[1] - 1; 1453 // var checkOutYear = checkOutDate[2]; 1454 // self.selectedDates[1] = new Date(checkOutYear, checkOutMonth, checkOutDay); 1455 // } 1456 var arrival = self.selectedDates[0]; 1457 var departure = self.selectedDates[1]; 1458 document.querySelector(scope + '.slope-check-in-date').textContent = arrival.getDate() + ' ' + locale.months.shorthand[arrival.getMonth()] + ', ' + arrival.getFullYear(); 1459 document.querySelector(scope + '.slope-check-out-date').textContent = departure.getDate() + ' ' + locale.months.shorthand[departure.getMonth()] + ', ' + departure.getFullYear(); 1460 document.querySelector(scope + '.slope-check-in-input').value = arrival.getDate() + '/' + (arrival.getMonth() + 1) + '/' + arrival.getFullYear(); 1461 document.querySelector(scope + '.slope-check-out-input').value = departure.getDate() + '/' + (departure.getMonth() + 1) + '/' + departure.getFullYear(); 1462 } 1463 function create(firstInput, secondInput, appendTo, index, $, options) { 1464 var indexedScope = '[data-widget-count=\"' + index + '\"] '; 1465 var reservationDate = document.querySelector(indexedScope + '.slope-reservation-section-container'); 1466 if (!!reservationDate) { 1467 var pluginLang = reservationDate.getAttribute('data-lang'); 1468 } 1469 var currentLocale = slopeFlatpickrLocaleManager.locale(pluginLang || DEFAULT_PLUGIN_LANG); 1470 var isMobile = function isMobile() { 1471 var check = false; 1472 (function (a) { 1473 if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|
1473sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) check = true; 1474 })(navigator.userAgent || navigator.vendor || window.opera); 1475 return check; 1476 }; 1477 1478 // The dateFormat option is necessary for the form submission to work 1479 options = { 1480 mode: "range", 1481 // plugins: [new rangePlugin({ input: indexedScope + secondInput})], 1482 locale: currentLocale, 1483 dateFormat: 'd/m/Y', 1484 showMonths: isMobile() ? 1 : 2, 1485 minDate: new Date(), 1486 onClose: function onClose(selectedDates, dateStr, instance) { 1487 // Here we need to pass the scope because the instance is the flatpickr instance not our custom object 1488 updateDates(instance, currentLocale, indexedScope); 1489 }, 1490 onReady: function onReady(_, __, fp) { 1491 fp.calendarContainer.classList.add("slope-flatpickr-calendar"); 1492 } 1493 }; 1494 var minDays = parseInt(document.querySelector(indexedScope + '.slope-reservation-dates').getAttribute('data-min-days')); 1495 var calendar = flatpickr(indexedScope + firstInput, options); 1496 calendar.scope = indexedScope; 1497 calendar.init = init; 1498 calendar.currentLocale = currentLocale; 1499 calendar.minDays = minDays > 1 ? minDays : 1; 1500 calendar.selectingRange = false; 1501 return calendar; 1502 } 1503 return { 1504 create: create 1505 }; 1506}(); 1507"use strict"; 1508 1509var slopeFlatpickrLocaleManager = function () { 1510 /** 1511 * These locales are taken from the code of flatpickr itself. 1512 */ 1513 function locale(langCode) { 1514 var English = { 1515 weekdays: { 1516 shorthand: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], 1517 longhand: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"] 1518 }, 1519 months: { 1520 shorthand: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], 1521 longhand: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "
1521November", "December"] 1522 }, 1523 daysInMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], 1524 firstDayOfWeek: 0, 1525 ordinal: function ordinal(nth) { 1526 var s = nth % 100; 1527 if (s > 3 && s < 21) return "th"; 1528 switch (s % 10) { 1529 case 1: 1530 return "st"; 1531 case 2: 1532 return "nd"; 1533 case 3: 1534 return "rd"; 1535 default: 1536 return "th"; 1537 } 1538 }, 1539 rangeSeparator: " to ", 1540 weekAbbreviation: "Wk", 1541 scrollTitle: "Scroll to increment", 1542 toggleTitle: "Click to toggle", 1543 amPM: ["AM", "PM"], 1544 yearAriaLabel: "Year", 1545 hourAriaLabel: "Hour", 1546 minuteAriaLabel: "Minute", 1547 time_24hr: false 1548 }; 1549 var Italian = { 1550 weekdays: { 1551 shorthand: ["Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab"], 1552 longhand: ["Domenica", "Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato"] 1553 }, 1554 months: { 1555 shorthand: ["Gen", "Feb", "Mar", "Apr", "Mag", "Giu", "Lug", "Ago", "Set", "Ott", "Nov", "Dic"], 1556 longhand: ["Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"] 1557 }, 1558 firstDayOfWeek: 1, 1559 ordinal: function ordinal() { 1560 return "°"; 1561 }, 1562 rangeSeparator: " al ", 1563 weekAbbreviation: "Se", 1564 scrollTitle: "Scrolla per aumentare", 1565 toggleTitle: "Clicca per cambiare", 1566 time_24hr: true 1567 }; 1568 var German = { 1569 weekdays: { 1570 shorthand: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"], 1571 longhand: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"] 1572 }, 1573 months: { 1574 shorthand: ["Jan", "Feb", "Mär", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"], 1575 longhand: ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"] 1576 }, 1577 firstDayOfWeek: 1, 1578 weekAbbreviation: "KW", 1579 rangeSeparator: " bis ", 1580 scrollTitle: "Zum Ãndern scrollen", 1581 toggleTitle: "Zum Umschalten klicken", 1582 time_24hr: true 1583 }; 1584 var French = { 1585 weekdays: { 1586 shorthand: ["dim", "lun", "mar", "mer", "jeu", "ven", "sam"], 1587 longhand: ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"] 1588 }, 1589 months: { 1590 shorthand: ["janv", "févr", "mars", "avr", "mai", "juin", "juil", "août", "sept", "oct", "nov", "déc"], 1591 longhand: ["janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre"] 1592 }, 1593 ordinal: function ordinal(nth) { 1594 if (nth > 1) return ""; 1595 return "er"; 1596 }, 1597 firstDayOfWeek: 1, 1598 rangeSeparator: " au ", 1599 weekAbbreviation: "Sem", 1600 scrollTitle: "Défiler pour augmenter la valeur", 1601 toggleTitle: "Cliquer pour basculer", 1602 time_24hr: true 1603 }; 1604 switch (langCode) { 1605 case 'it': 1606 return Italian; 1607 case 'fr': 1608 return French; 1609 case 'de': 1610 return German; 1611 default: 1612 return English; 1613 } 1614 } 1615 return { 1616 locale: locale 1617 }; 1618}(); 1619"use strict"; 1620 1621function SlopeForm($form, requiredFields) { 1622 this.data = _toJSON($form); 1623 this.requiredFields = requiredFields; 1624 this.isValid = function () { 1625 var self = this; 1626 return this.requiredFields.map(function (field) { 1627 return self.data.hasOwnProperty(field) && !!self.data[field]; 1628 }).reduce(function (prev, current) { 1629 return prev && current; 1630 }); 1631 }; 1632 function _toJSON($form) { 1633 var asArray = $form.serializeArray(); 1634 var json = {}; 1635 asArray.forEach(function (el) { 1636 json[el.name] = el.value; 1637 }); 1638 return json; 1639 } 1640 this.send = function (url, successCallback) { 1641 jQuery.ajax(url, { 1642 type: "POST", 1643 data: JSON.stringify(this.data), 1644 success: successCallback 1645 }); 1646 }; 1647} 1648"use strict"; 1649 1650var SLOPE_ROOM_FORM_SELECTORS = { 1651 ADULTS: '[data-input="adults"]', 1652 CHILDREN: '[data-input="children"]' 1653}; 1654function SlopeGuestsWrapper($element) { 1655 this.childrenNextIndex = 0; 1656 this.$element = $element;
1657 this.stepperContainer = $element.siblings('.slope-stepper-container'); 1658 this.rooms = [new SlopeRoom(0, this.stepperContainer.find('[data-container="guests"]'), this.$element.find(SLOPE_ROOM_FORM_SELECTORS.ADULTS), $element)]; 1659 this.updateGuests = function () { 1660 var self = this; 1661 Array.from(this.$element.find('[data-sync-value]')).forEach(function (el) { 1662 var result = 0; 1663 Array.from(self.stepperContainer.find('[data-sync-trigger=\"' + el.getAttribute('data-sync-value') + '\"]')).forEach(function (e) { 1664 result += parseInt(e.value); 1665 }); 1666 el.textContent = result; 1667 }); 1668 Array.from(this.$element.find(SLOPE_ROOM_FORM_SELECTORS.ADULTS)).forEach(function (el) { 1669 el.value = self.stepperContainer.find('[data-sync-trigger="adults"]').val(); 1670 }); 1671 this.rooms.forEach(function (room) { 1672 return room.update(); 1673 }); 1674 }; 1675 this.reset = function () { 1676 this.rooms.forEach(function (room, index) { 1677 if (index > 0) { 1678 room.destroy(); 1679 } 1680 }); 1681 this.rooms[0].reset(); 1682 this.rooms = [this.rooms[0]]; 1683 this.stepperContainer.find('[data-sync-trigger="rooms"]').val(1); 1684 this.stepperContainer.find('[data-sync-trigger="adults"]').val(2); 1685 this.childrenNextIndex = 0; 1686 var stepperInput = this.stepperContainer.find('[data-sync-trigger="children"]'); 1687 stepperInput.val(this.childrenNextIndex); 1688 jQuery('[data-input="children"][name]').remove(); 1689 this.updateGuests(); 1690 }; 1691 this.calculateStepperTop = function () { 1692 var isMobile = function isMobile() { 1693 var check = false; 1694 (function (a) { 1695 if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) check = true; 1696 })(navigator.userAgent || navigator.vendor || window.opera); 1697 return check; 1698 }; 1699 1700 // We append the stepper container to the body of the page to avoid z-index to depend on the container 1701 document.querySelector('body').appendChild(this.stepperContainer[0]); 1702 var slopeBlockBounds = this.$element.parentsUntil('.slope-block').parent()[0].getBoundingClientRect(); 1703 var top = window.pageYOffset + slopeBlockBounds.top + slopeBlockBounds.height - (isMobile() ? this.$element.parentsUntil('slope-guests-and-button-container').find('.slope-submit-section')[0].getBoundingClientRect().height : 0); 1704 var left = isMobile() ? slopeBlockBounds.left : window.pageXOffset + slopeBlockBounds.left + slopeBlockBounds.width / 100 * 35; 1705 this.stepperContainer.css('top', top + 'px'); 1706 this.stepperContainer.css('left', left + 'px'); 1707 }; 1708 this.openGuestsSelection = function () { 1709 this.stepperContainer.show(); 1710 }; 1711 this.closeGuestsSelection = function () { 1712 this.stepperContainer.hide(); 1713 }; 1714 this.handleClickOutsideGuestsSelection = function (event) { 1715 var containers = Array.from(document.querySelectorAll('.slope-step
1715per-container')); 1716 var isStepperContainerVisible = this.stepperContainer.css('display') !== 'none'; 1717 if (containers.length > 0 && this.$element.parent().find(event.target).length === 0 && !this.$element.parent().is(event.target) && this.stepperContainer.find(event.target).length === 0 && isStepperContainerVisible) { 1718 this.updateGuests(); 1719 this.closeGuestsSelection(); 1720 } 1721 }; 1722 this.init = function ($) { 1723 this.updateGuests(); 1724 var self = this; 1725 this.$element.parent().on('click', function (event) { 1726 if (!self.stepperContainer[0].contains(event.target)) { 1727 self.openGuestsSelection(); 1728 self.calculateStepperTop(); 1729 } 1730 }); 1731 window.addEventListener('resize', function (event) { 1732 self.closeGuestsSelection(); 1733 }); 1734 $(document).on('click', function (event) { 1735 self.handleClickOutsideGuestsSelection(event); 1736 }); 1737 self.stepperContainer.find('.slope-cancel-guests').on('click', function () { 1738 self.reset(); 1739 self.closeGuestsSelection(); 1740 }); 1741 self.stepperContainer.find('.slope-save-guests').on('click', function () { 1742 self.updateGuests(); 1743 self.closeGuestsSelection(); 1744 }); 1745 self.stepperContainer.find('[data-increment="rooms"]').on('click', function () { 1746 if (self.rooms.length > 98) { 1747 return; 1748 } 1749 var adultsInputClone = self.$element.find(SLOPE_ROOM_FORM_SELECTORS.ADULTS).first().clone(); 1750 adultsInputClone.appendTo(self.$element); 1751 self.rooms.push(new SlopeRoom(self.rooms.length, self.stepperContainer.find('[data-container="guests"]'), adultsInputClone, $element)); 1752 self.stepperContainer.find('[data-sync-trigger="rooms"]').val(self.rooms.length); 1753 }); 1754 self.stepperContainer.find('[data-decrement="rooms"]').on('click', function () { 1755 if (self.rooms.length === 1) { 1756 return; 1757 } 1758 self.$element.find(SLOPE_ROOM_FORM_SELECTORS.ADULTS).last().remove(); 1759 var lastRoom = self.rooms.pop(); 1760 self.$element.find('[name^="reservation[guestCounts][' + lastRoom.index + '][childrenAges]"]').remove(); 1761 lastRoom.destroy(); 1762 self.stepperContainer.find('[data-sync-trigger="rooms"]').val(self.rooms.length); 1763 }); 1764 }; 1765} 1766"use strict"; 1767 1768var SLOPE_NAME_PROTOTYPES = { 1769 ADULTS: "reservation[guestCounts][__name__][adults]", 1770 CHILDREN: "reservation[guestCounts][__name__][childrenAges][__childrenAgesName__]" 1771}; 1772function SlopeRoom(index, $element, adultsInput, guestsWrapper) { 1773 this.index = index; 1774 this.adultsCount = 2; 1775 this.childrenCount = 0; 1776 this.adultsInput = adultsInput; 1777 this.guestsWrapper = guestsWrapper; 1778 this.$element = null; 1779 this.update = function () { 1780 var adultsInput = this.$element.find('[data-sync-trigger="adults"]'); 1781 adultsInput.val(this.adultsCount); 1782 var childrenInput = this.$element.find('[data-sync-trigger="children"]'); 1783 childrenInput.val(this.childrenCount); 1784 this.adultsInput.val(this.adultsCount); 1785 }; 1786 this.reset = function () { 1787 this.adultsCount = 2; 1788 this.childrenCount = 0; 1789 this.update(); 1790 }; 1791 if (index > 0) { 1792 // The element is not the first so we have to clone the first one is not passed this means we have to clone one 1793 var clone = $element.last().clone(); 1794 clone.insertBefore($element.parent().find('[data-separator="buttons"]')); 1795 this.$element = clone; 1796 } else { 1797 this.$element = $element; 1798 } 1799 this.adultsInput.attr('name', SLOPE_NAME_PROTOTYPES.ADULTS.replace(new RegExp('__name__', 'g'), this.index)); 1800 var roomLabel = this.$element.find('[data-label="room"]'); 1801 roomLabel.text(roomLabel.text().replace(this.index, this.index + 1)); 1802 this.reset(); 1803 var self = this; 1804 this.$element.find('[data-increment="adults"]').on('click', function () { 1805 self.incrementAdults(); 1806 }); 1807 this.$element.find('[data-decrement="adults"]').on('click', function () { 1808 self.decrementAdults(); 1809 }); 1810 this.$element.find('[data-increment="children"]').on('click', function () { 1811 self.incrementChildren(); 1812 }); 1813 this.$element.find('[data-decrement="children"]').on('click', function () { 1814 self.decrementChildren(); 1815 }); 1816 this.incrementAdults = function () { 1817 this.adultsCount += this.adultsCount < 99 ? 1 : 0; 1818 var input = this.$element.find('[data-sync-trigger="adults"]'); 1819 input.val(this.adultsCount); 1820 }; 1821 this.decrementAdults = function () { 1822 this.adultsCount -= this.adultsCount > 1 ? 1 : 0; 1823 var input = this.$element.find('[data-sync-trigger="adults"]'); 1824 input.val(this.adultsCount); 1825 }; 1826 this.incrementChildren = function () { 1827 this.childrenCount += this.childrenCount < 99 ? 1 : 0; 1828 var input = this.guestsWrapper.find('[data-input="children"]').first(); 1829 var clone = input.clone(); 1830 var name = SLOPE_NAME_PROTOTYPES.CHILDREN; 1831 name = name.replace(new RegExp('__name__', 'g'), this.index); 1832 name = name.replace(new RegExp('__childrenAgesName__', 'g'), this.childrenCount); 1833 clone.attr('name', name); 1834 clone.appendTo(this.guestsWrapper); 1835 var stepperInput = this.$element.find('[data-sync-trigger="children"]'); 1836 stepperInput.val(this.childrenCount); 1837 }; 1838 this.decrementChildren = function () { 1839 this.childrenCount -= this.childrenCount > 0 ? 1 : 0; 1840 this.guestsWrapper.find('[data-input="children"][name]').first().remove(); 1841 var stepperInput = this.$element.find('[data-sync-trigger="children"]'); 1842 stepperInput.val(this.childrenCount); 1843 }; 1844 this.destroy = function () { 1845 this.$element.remove(); 1846 }; 1847} 1848"use strict"; 1849 1850if (!Array.from) { 1851 Array.from = function () { 1852 var toStr = Object.prototype.toString; 1853 var isCallable = function isCallable(fn) { 1854 return typeof fn === 'function' || toStr.call(fn) === '[object Function]'; 1855 }; 1856 var toInteger = function toInteger(value) { 1857 var number = Number(value); 1858 if (isNaN(number)) { 1859 return 0; 1860 } 1861 if (number === 0 || !isFinite(number)) { 1862 return number; 1863 } 1864 return (number > 0 ? 1 : -1) * Math.floor(Math.abs(number)); 1865 }; 1866 var maxSafeInteger = Math.pow(2, 53) - 1; 1867 var toLength = function toLength(value) { 1868 var len = toInteger(value); 1869 return Math.min(Math.max(len, 0), maxSafeInteger); 1870 }; 1871 1872 // The length property of the from method is 1. 1873 return function from(arrayLike /*, mapFn, thisArg */) { 1874 // 1. Let C be the this value. 1875 var C = this; 1876 1877 // 2. Let items be ToObject(arrayLike). 1878 var items = Object(arrayLike); 1879 1880 // 3. ReturnIfAbrupt(items). 1881 if (arrayLike == null) { 1882 throw new TypeError('Array.from requires an array-like object - not null or undefined'); 1883 } 1884 1885 // 4. If mapfn is undefined, then let mapping be false. 1886 var mapFn = arguments.length > 1 ? arguments[1] : void undefined; 1887 var T; 1888 if (typeof mapFn !== 'undefined') { 1889 // 5. else 1890 // 5. a If IsCallable(mapfn) is false, throw a TypeError exception. 1891 if (!isCallable(mapFn)) { 1892 throw new TypeError('Array.from: when provided, the second argument must be a function'); 1893 } 1894 1895 // 5. b. If thisArg was supplied, let T be thisArg; else let T be undefined. 1896 if (arguments.length > 2) { 1897 T = arguments[2]; 1898 } 1899 } 1900 1901 // 10. Let lenValue be Get(items, "length"). 1902 // 11. Let len be ToLength(lenValue). 1903 var len = toLength(items.length); 1904 1905 // 13. If IsConstructor(C) is true, then 1906 // 13. a. Let A be the result of calling the [[Construct]] internal method 1907 // of C with an argument list containing the single item len. 1908 // 14. a. Else, Let A be ArrayCreate(len). 1909 var A = isCallable(C) ? Object(new C(len)) : new Array(len); 1910 1911 // 16. Let k be 0. 1912 var k = 0; 1913 // 17. Repeat, while k < len⦠(also steps a - h) 1914 var kValue; 1915 while (k < len) { 1916 kValue = items[k]; 1917 if (mapFn) { 1918 A[k] = typeof T === 'undefined' ? mapFn(kValue, k) : mapFn.call(T, kValue, k); 1919 } else { 1920 A[k] = kValue; 1921 } 1922 k += 1; 1923 } 1924 // 18. Let putStatus be Put(A, "length", len, true). 1925 A.length = len; 1926 // 20. Return A. 1927 return A; 1928 }; 1929 }(); 1930}
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.