PluginProbe
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder / 1.6.1
Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder v1.6.1
3.1.4 3.0.8 3.0.9 3.1.0 3.1.2 3.1.3 3.0.7 3.0.5 3.0.4 3.0.3 3.0.2 trunk 1.5.0 1.5.1 1.5.2 1.6.1 1.6.2 1.6.3 1.6.4 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 All 93 releases
ultimate-store-kit / admin / assets / js / bdt-uikit.js

bdt-uikit.js in Ultimate Store Kit – Store Builder Addons for Elementor, WooCommerce Store Builder, EDD Store Builder 1.6.1, at admin/assets/js/bdt-uikit.js

11,059 lines 276.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /*! bdtUIkit 3.13.1 | https://www.getuikit.com | (c) 2014 - 2022 YOOtheme | MIT License */
2
3 (function (global, factory) {
4 typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
5 typeof define === 'function' && define.amd ? define('uikit', factory) :
6 (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.bdtUIkit = factory());
7 })(this, (function () { 'use strict';
8
9 const { hasOwnProperty, toString } = Object.prototype;
10
11 function hasOwn(obj, key) {
12 return hasOwnProperty.call(obj, key);
13 }
14
15 const hyphenateRe = /\B([A-Z])/g;
16
17 const hyphenate = memoize((str) => str.replace(hyphenateRe, '-$1').toLowerCase());
18
19 const camelizeRe = /-(\w)/g;
20
21 const camelize = memoize((str) => str.replace(camelizeRe, toUpper));
22
23 const ucfirst = memoize((str) =>
24 str.length ? toUpper(null, str.charAt(0)) + str.slice(1) : '');
25
26
27 function toUpper(_, c) {
28 return c ? c.toUpperCase() : '';
29 }
30
31 function startsWith(str, search) {
32 return str == null ? void 0 : str.startsWith == null ? void 0 : str.startsWith(search);
33 }
34
35 function endsWith(str, search) {
36 return str == null ? void 0 : str.endsWith == null ? void 0 : str.endsWith(search);
37 }
38
39 function includes(obj, search) {
40 return obj == null ? void 0 : obj.includes == null ? void 0 : obj.includes(search);
41 }
42
43 function findIndex(array, predicate) {
44 return array == null ? void 0 : array.findIndex == null ? void 0 : array.findIndex(predicate);
45 }
46
47 const { isArray, from: toArray } = Array;
48 const { assign } = Object;
49
50 function isFunction(obj) {
51 return typeof obj === 'function';
52 }
53
54 function isObject(obj) {
55 return obj !== null && typeof obj === 'object';
56 }
57
58 function isPlainObject(obj) {
59 return toString.call(obj) === '[object Object]';
60 }
61
62 function isWindow(obj) {
63 return isObject(obj) && obj === obj.window;
64 }
65
66 function isDocument(obj) {
67 return nodeType(obj) === 9;
68 }
69
70 function isNode(obj) {
71 return nodeType(obj) >= 1;
72 }
73
74 function isElement(obj) {
75 return nodeType(obj) === 1;
76 }
77
78 function nodeType(obj) {
79 return !isWindow(obj) && isObject(obj) && obj.nodeType;
80 }
81
82 function isBoolean(value) {
83 return typeof value === 'boolean';
84 }
85
86 function isString(value) {
87 return typeof value === 'string';
88 }
89
90 function isNumber(value) {
91 return typeof value === 'number';
92 }
93
94 function isNumeric(value) {
95 return isNumber(value) || isString(value) && !isNaN(value - parseFloat(value));
96 }
97
98 function isEmpty(obj) {
99 return !(isArray(obj) ? obj.length : isObject(obj) ? Object.keys(obj).length : false);
100 }
101
102 function isUndefined(value) {
103 return value === void 0;
104 }
105
106 function toBoolean(value) {
107 return isBoolean(value) ?
108 value :
109 value === 'true' || value === '1' || value === '' ?
110 true :
111 value === 'false' || value === '0' ?
112 false :
113 value;
114 }
115
116 function toNumber(value) {
117 const number = Number(value);
118 return isNaN(number) ? false : number;
119 }
120
121 function toFloat(value) {
122 return parseFloat(value) || 0;
123 }
124
125 function toNode(element) {
126 return toNodes(element)[0];
127 }
128
129 function toNodes(element) {
130 return element && (isNode(element) ? [element] : Array.from(element).filter(isNode)) || [];
131 }
132
133 function toWindow(element) {var _element;
134 if (isWindow(element)) {
135 return element;
136 }
137
138 element = toNode(element);
139 const document = isDocument(element) ? element : (_element = element) == null ? void 0 : _element.ownerDocument;
140
141 return (document == null ? void 0 : document.defaultView) || window;
142 }
143
144 function toMs(time) {
145 return time ? endsWith(time, 'ms') ? toFloat(time) : toFloat(time) * 1000 : 0;
146 }
147
148 function isEqual(value, other) {
149 return (
150 value === other ||
151 isObject(value) &&
152 isObject(other) &&
153 Object.keys(value).length === Object.keys(other).length &&
154 each(value, (val, key) => val === other[key]));
155
156 }
157
158 function swap(value, a, b) {
159 return value.replace(new RegExp(a + "|" + b, 'g'), (match) => match === a ? b : a);
160 }
161
162 function last(array) {
163 return array[array.length - 1];
164 }
165
166 function each(obj, cb) {
167 for (const key in obj) {
168 if (false === cb(obj[key], key)) {
169 return false;
170 }
171 }
172 return true;
173 }
174
175 function sortBy$1(array, prop) {
176 return array.
177 slice().
178 sort((_ref, _ref2) => {let { [prop]: propA = 0 } = _ref;let { [prop]: propB = 0 } = _ref2;return (
179 propA > propB ? 1 : propB > propA ? -1 : 0);});
180
181 }
182
183 function uniqueBy(array, prop) {
184 const seen = new Set();
185 return array.filter((_ref3) => {let { [prop]: check } = _ref3;return seen.has(check) ? false : seen.add(check);});
186 }
187
188 function clamp(number, min, max) {if (min === void 0) {min = 0;}if (max === void 0) {max = 1;}
189 return Math.min(Math.max(toNumber(number) || 0, min), max);
190 }
191
192 function noop() {}
193
194 function intersectRect() {for (var _len = arguments.length, rects = new Array(_len), _key = 0; _key < _len; _key++) {rects[_key] = arguments[_key];}
195 return [
196 ['bottom', 'top'],
197 ['right', 'left']].
198 every(
199 (_ref4) => {let [minProp, maxProp] = _ref4;return (
200 Math.min(...rects.map((_ref5) => {let { [minProp]: min } = _ref5;return min;})) -
201 Math.max(...rects.map((_ref6) => {let { [maxProp]: max } = _ref6;return max;})) >
202 0);});
203
204 }
205
206 function pointInRect(point, rect) {
207 return (
208 point.x <= rect.right &&
209 point.x >= rect.left &&
210 point.y <= rect.bottom &&
211 point.y >= rect.top);
212
213 }
214
215 const Dimensions = {
216 ratio(dimensions, prop, value) {
217 const aProp = prop === 'width' ? 'height' : 'width';
218
219 return {
220 [aProp]: dimensions[prop] ?
221 Math.round(value * dimensions[aProp] / dimensions[prop]) :
222 dimensions[aProp],
223 [prop]: value };
224
225 },
226
227 contain(dimensions, maxDimensions) {
228 dimensions = { ...dimensions };
229
230 each(
231 dimensions,
232 (_, prop) =>
233 dimensions =
234 dimensions[prop] > maxDimensions[prop] ?
235 this.ratio(dimensions, prop, maxDimensions[prop]) :
236 dimensions);
237
238
239 return dimensions;
240 },
241
242 cover(dimensions, maxDimensions) {
243 dimensions = this.contain(dimensions, maxDimensions);
244
245 each(
246 dimensions,
247 (_, prop) =>
248 dimensions =
249 dimensions[prop] < maxDimensions[prop] ?
250 this.ratio(dimensions, prop, maxDimensions[prop]) :
251 dimensions);
252
253
254 return dimensions;
255 } };
256
257
258 function getIndex(i, elements, current, finite) {if (current === void 0) {current = 0;}if (finite === void 0) {finite = false;}
259 elements = toNodes(elements);
260
261 const { length } = elements;
262
263 if (!length) {
264 return -1;
265 }
266
267 i = isNumeric(i) ?
268 toNumber(i) :
269 i === 'next' ?
270 current + 1 :
271 i === 'previous' ?
272 current - 1 :
273 elements.indexOf(toNode(i));
274
275 if (finite) {
276 return clamp(i, 0, length - 1);
277 }
278
279 i %= length;
280
281 return i < 0 ? i + length : i;
282 }
283
284 function memoize(fn) {
285 const cache = Object.create(null);
286 return (key) => cache[key] || (cache[key] = fn(key));
287 }
288
289 class Deferred {
290 constructor() {
291 this.promise = new Promise((resolve, reject) => {
292 this.reject = reject;
293 this.resolve = resolve;
294 });
295 }}
296
297 function attr(element, name, value) {
298 if (isObject(name)) {
299 for (const key in name) {
300 attr(element, key, name[key]);
301 }
302 return;
303 }
304
305 if (isUndefined(value)) {var _toNode;
306 return (_toNode = toNode(element)) == null ? void 0 : _toNode.getAttribute(name);
307 } else {
308 for (const el of toNodes(element)) {
309 if (isFunction(value)) {
310 value = value.call(el, attr(el, name));
311 }
312
313 if (value === null) {
314 removeAttr(el, name);
315 } else {
316 el.setAttribute(name, value);
317 }
318 }
319 }
320 }
321
322 function hasAttr(element, name) {
323 return toNodes(element).some((element) => element.hasAttribute(name));
324 }
325
326 function removeAttr(element, name) {
327 const elements = toNodes(element);
328 for (const attribute of name.split(' ')) {
329 for (const element of elements) {
330 element.removeAttribute(attribute);
331 }
332 }
333 }
334
335 function data(element, attribute) {
336 for (const name of [attribute, "data-" + attribute]) {
337 if (hasAttr(element, name)) {
338 return attr(element, name);
339 }
340 }
341 }
342
343 const voidElements = {
344 area: true,
345 base: true,
346 br: true,
347 col: true,
348 embed: true,
349 hr: true,
350 img: true,
351 input: true,
352 keygen: true,
353 link: true,
354 menuitem: true,
355 meta: true,
356 param: true,
357 source: true,
358 track: true,
359 wbr: true };
360
361 function isVoidElement(element) {
362 return toNodes(element).some((element) => voidElements[element.tagName.toLowerCase()]);
363 }
364
365 function isVisible(element) {
366 return toNodes(element).some(
367 (element) => element.offsetWidth || element.offsetHeight || element.getClientRects().length);
368
369 }
370
371 const selInput = 'input,select,textarea,button';
372 function isInput(element) {
373 return toNodes(element).some((element) => matches(element, selInput));
374 }
375
376 const selFocusable = selInput + ",a[href],[tabindex]";
377 function isFocusable(element) {
378 return matches(element, selFocusable);
379 }
380
381 function parent(element) {var _toNode;
382 return (_toNode = toNode(element)) == null ? void 0 : _toNode.parentElement;
383 }
384
385 function filter$1(element, selector) {
386 return toNodes(element).filter((element) => matches(element, selector));
387 }
388
389 function matches(element, selector) {
390 return toNodes(element).some((element) => element.matches(selector));
391 }
392
393 function closest(element, selector) {
394 if (startsWith(selector, '>')) {
395 selector = selector.slice(1);
396 }
397
398 return isElement(element) ?
399 element.closest(selector) :
400 toNodes(element).
401 map((element) => closest(element, selector)).
402 filter(Boolean);
403 }
404
405 function within(element, selector) {
406 return isString(selector) ?
407 matches(element, selector) || !!closest(element, selector) :
408 element === selector || toNode(selector).contains(toNode(element));
409 }
410
411 function parents(element, selector) {
412 const elements = [];
413
414 while (element = parent(element)) {
415 if (!selector || matches(element, selector)) {
416 elements.push(element);
417 }
418 }
419
420 return elements;
421 }
422
423 function children(element, selector) {
424 element = toNode(element);
425 const children = element ? toNodes(element.children) : [];
426 return selector ? filter$1(children, selector) : children;
427 }
428
429 function index(element, ref) {
430 return ref ? toNodes(element).indexOf(toNode(ref)) : children(parent(element)).indexOf(element);
431 }
432
433 function query(selector, context) {
434 return find(selector, getContext(selector, context));
435 }
436
437 function queryAll(selector, context) {
438 return findAll(selector, getContext(selector, context));
439 }
440
441 function find(selector, context) {
442 return toNode(_query(selector, context, 'querySelector'));
443 }
444
445 function findAll(selector, context) {
446 return toNodes(_query(selector, context, 'querySelectorAll'));
447 }
448
449 const contextSelectorRe = /(^|[^\\],)\s*[!>+~-]/;
450 const isContextSelector = memoize((selector) => selector.match(contextSelectorRe));
451
452 function getContext(selector, context) {if (context === void 0) {context = document;}
453 return isString(selector) && isContextSelector(selector) || isDocument(context) ?
454 context :
455 context.ownerDocument;
456 }
457
458 const contextSanitizeRe = /([!>+~-])(?=\s+[!>+~-]|\s*$)/g;
459 const sanatize = memoize((selector) => selector.replace(contextSanitizeRe, '$1 *'));
460
461 function _query(selector, context, queryFn) {if (context === void 0) {context = document;}
462 if (!selector || !isString(selector)) {
463 return selector;
464 }
465
466 selector = sanatize(selector);
467
468 if (isContextSelector(selector)) {
469 const split = splitSelector(selector);
470 selector = '';
471 for (let sel of split) {
472 let ctx = context;
473
474 if (sel[0] === '!') {
475 const selectors = sel.substr(1).trim().split(' ');
476 ctx = closest(parent(context), selectors[0]);
477 sel = selectors.slice(1).join(' ').trim();
478 if (!sel.length && split.length === 1) {
479 return ctx;
480 }
481 }
482
483 if (sel[0] === '-') {
484 const selectors = sel.substr(1).trim().split(' ');
485 const prev = (ctx || context).previousElementSibling;
486 ctx = matches(prev, sel.substr(1)) ? prev : null;
487 sel = selectors.slice(1).join(' ');
488 }
489
490 if (ctx) {
491 selector += "" + (selector ? ',' : '') + domPath(ctx) + " " + sel;
492 }
493 }
494
495 context = document;
496 }
497
498 try {
499 return context[queryFn](selector);
500 } catch (e) {
501 return null;
502 }
503 }
504
505 const selectorRe = /.*?[^\\](?:,|$)/g;
506
507 const splitSelector = memoize((selector) =>
508 selector.match(selectorRe).map((selector) => selector.replace(/,$/, '').trim()));
509
510
511 function domPath(element) {
512 const names = [];
513 while (element.parentNode) {
514 const id = attr(element, 'id');
515 if (id) {
516 names.unshift("#" + escape(id));
517 break;
518 } else {
519 let { tagName } = element;
520 if (tagName !== 'HTML') {
521 tagName += ":nth-child(" + (index(element) + 1) + ")";
522 }
523 names.unshift(tagName);
524 element = element.parentNode;
525 }
526 }
527 return names.join(' > ');
528 }
529
530 function escape(css) {
531 return isString(css) ? CSS.escape(css) : '';
532 }
533
534 function on() {for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {args[_key] = arguments[_key];}
535 let [targets, types, selector, listener, useCapture = false] = getArgs(args);
536
537 if (listener.length > 1) {
538 listener = detail(listener);
539 }
540
541 if (useCapture != null && useCapture.self) {
542 listener = selfFilter(listener);
543 }
544
545 if (selector) {
546 listener = delegate(selector, listener);
547 }
548
549 for (const type of types) {
550 for (const target of targets) {
551 target.addEventListener(type, listener, useCapture);
552 }
553 }
554
555 return () => off(targets, types, listener, useCapture);
556 }
557
558 function off() {for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {args[_key2] = arguments[_key2];}
559 let [targets, types,, listener, useCapture = false] = getArgs(args);
560 for (const type of types) {
561 for (const target of targets) {
562 target.removeEventListener(type, listener, useCapture);
563 }
564 }
565 }
566
567 function once() {for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {args[_key3] = arguments[_key3];}
568 const [element, types, selector, listener, useCapture = false, condition] = getArgs(args);
569 const off = on(
570 element,
571 types,
572 selector,
573 (e) => {
574 const result = !condition || condition(e);
575 if (result) {
576 off();
577 listener(e, result);
578 }
579 },
580 useCapture);
581
582
583 return off;
584 }
585
586 function trigger(targets, event, detail) {
587 return toEventTargets(targets).every((target) =>
588 target.dispatchEvent(createEvent(event, true, true, detail)));
589
590 }
591
592 function createEvent(e, bubbles, cancelable, detail) {if (bubbles === void 0) {bubbles = true;}if (cancelable === void 0) {cancelable = false;}
593 if (isString(e)) {
594 e = new CustomEvent(e, { bubbles, cancelable, detail });
595 }
596
597 return e;
598 }
599
600 function getArgs(args) {
601 // Event targets
602 args[0] = toEventTargets(args[0]);
603
604 // Event types
605 if (isString(args[1])) {
606 args[1] = args[1].split(' ');
607 }
608
609 // Delegate?
610 if (isFunction(args[2])) {
611 args.splice(2, 0, false);
612 }
613
614 return args;
615 }
616
617 function delegate(selector, listener) {
618 return (e) => {
619 const current =
620 selector[0] === '>' ?
621 findAll(selector, e.currentTarget).
622 reverse().
623 filter((element) => within(e.target, element))[0] :
624 closest(e.target, selector);
625
626 if (current) {
627 e.current = current;
628 listener.call(this, e);
629 }
630 };
631 }
632
633 function detail(listener) {
634 return (e) => isArray(e.detail) ? listener(e, ...e.detail) : listener(e);
635 }
636
637 function selfFilter(listener) {
638 return function (e) {
639 if (e.target === e.currentTarget || e.target === e.current) {
640 return listener.call(null, e);
641 }
642 };
643 }
644
645 function isEventTarget(target) {
646 return target && 'addEventListener' in target;
647 }
648
649 function toEventTarget(target) {
650 return isEventTarget(target) ? target : toNode(target);
651 }
652
653 function toEventTargets(target) {
654 return isArray(target) ?
655 target.map(toEventTarget).filter(Boolean) :
656 isString(target) ?
657 findAll(target) :
658 isEventTarget(target) ?
659 [target] :
660 toNodes(target);
661 }
662
663 function isTouch(e) {
664 return e.pointerType === 'touch' || !!e.touches;
665 }
666
667 function getEventPos(e) {var _e$touches, _e$changedTouches;
668 const { clientX: x, clientY: y } = ((_e$touches = e.touches) == null ? void 0 : _e$touches[0]) || ((_e$changedTouches = e.changedTouches) == null ? void 0 : _e$changedTouches[0]) || e;
669
670 return { x, y };
671 }
672
673 function ajax(url, options) {
674 const env = {
675 data: null,
676 method: 'GET',
677 headers: {},
678 xhr: new XMLHttpRequest(),
679 beforeSend: noop,
680 responseType: '',
681 ...options };
682
683 return Promise.resolve().
684 then(() => env.beforeSend(env)).
685 then(() => send(url, env));
686 }
687
688 function send(url, env) {
689 return new Promise((resolve, reject) => {
690 const { xhr } = env;
691
692 for (const prop in env) {
693 if (prop in xhr) {
694 try {
695 xhr[prop] = env[prop];
696 } catch (e) {
697 // noop
698 }
699 }
700 }
701
702 xhr.open(env.method.toUpperCase(), url);
703
704 for (const header in env.headers) {
705 xhr.setRequestHeader(header, env.headers[header]);
706 }
707
708 on(xhr, 'load', () => {
709 if (xhr.status === 0 || xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) {
710 resolve(xhr);
711 } else {
712 reject(
713 assign(Error(xhr.statusText), {
714 xhr,
715 status: xhr.status }));
716
717
718 }
719 });
720
721 on(xhr, 'error', () => reject(assign(Error('Network Error'), { xhr })));
722 on(xhr, 'timeout', () => reject(assign(Error('Network Timeout'), { xhr })));
723
724 xhr.send(env.data);
725 });
726 }
727
728 function getImage(src, srcset, sizes) {
729 return new Promise((resolve, reject) => {
730 const img = new Image();
731
732 img.onerror = (e) => {
733 reject(e);
734 };
735 img.onload = () => {
736 resolve(img);
737 };
738
739 sizes && (img.sizes = sizes);
740 srcset && (img.srcset = srcset);
741 img.src = src;
742 });
743 }
744
745 const cssNumber = {
746 'animation-iteration-count': true,
747 'column-count': true,
748 'fill-opacity': true,
749 'flex-grow': true,
750 'flex-shrink': true,
751 'font-weight': true,
752 'line-height': true,
753 opacity: true,
754 order: true,
755 orphans: true,
756 'stroke-dasharray': true,
757 'stroke-dashoffset': true,
758 widows: true,
759 'z-index': true,
760 zoom: true };
761
762
763 function css(element, property, value, priority) {if (priority === void 0) {priority = '';}
764 const elements = toNodes(element);
765 for (const element of elements) {
766 if (isString(property)) {
767 property = propName(property);
768
769 if (isUndefined(value)) {
770 return getStyle(element, property);
771 } else if (!value && !isNumber(value)) {
772 element.style.removeProperty(property);
773 } else {
774 element.style.setProperty(
775 property,
776 isNumeric(value) && !cssNumber[property] ? value + "px" : value,
777 priority);
778
779 }
780 } else if (isArray(property)) {
781 const styles = getStyles(element);
782 const props = {};
783 for (const prop of property) {
784 props[prop] = styles[propName(prop)];
785 }
786 return props;
787 } else if (isObject(property)) {
788 priority = value;
789 each(property, (value, property) => css(element, property, value, priority));
790 }
791 }
792 return elements[0];
793 }
794
795 function getStyles(element, pseudoElt) {
796 return toWindow(element).getComputedStyle(element, pseudoElt);
797 }
798
799 function getStyle(element, property, pseudoElt) {
800 return getStyles(element, pseudoElt)[property];
801 }
802
803 const propertyRe = /^\s*(["'])?(.*?)\1\s*$/;
804 function getCssVar(name) {
805 return getStyles(document.documentElement).
806 getPropertyValue("--bdt-" + name).
807 replace(propertyRe, '$2');
808 }
809
810 // https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-setproperty
811 const propName = memoize((name) => vendorPropName(name));
812
813 const cssPrefixes = ['webkit', 'moz'];
814
815 function vendorPropName(name) {
816 name = hyphenate(name);
817
818 const { style } = document.documentElement;
819
820 if (name in style) {
821 return name;
822 }
823
824 let i = cssPrefixes.length,
825 prefixedName;
826
827 while (i--) {
828 prefixedName = "-" + cssPrefixes[i] + "-" + name;
829 if (prefixedName in style) {
830 return prefixedName;
831 }
832 }
833 }
834
835 function addClass(element) {for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {args[_key - 1] = arguments[_key];}
836 apply$1(element, args, 'add');
837 }
838
839 function removeClass(element) {for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {args[_key2 - 1] = arguments[_key2];}
840 apply$1(element, args, 'remove');
841 }
842
843 function removeClasses(element, cls) {
844 attr(element, 'class', (value) => (value || '').replace(new RegExp("\\b" + cls + "\\b", 'g'), ''));
845 }
846
847 function replaceClass(element) {
848 (arguments.length <= 1 ? undefined : arguments[1]) && removeClass(element, arguments.length <= 1 ? undefined : arguments[1]);
849 (arguments.length <= 2 ? undefined : arguments[2]) && addClass(element, arguments.length <= 2 ? undefined : arguments[2]);
850 }
851
852 function hasClass(element, cls) {
853 [cls] = getClasses(cls);
854 return !!cls && toNodes(element).some((node) => node.classList.contains(cls));
855 }
856
857 function toggleClass(element, cls, force) {
858 const classes = getClasses(cls);
859
860 if (!isUndefined(force)) {
861 force = !!force;
862 }
863
864 for (const node of toNodes(element)) {
865 for (const cls of classes) {
866 node.classList.toggle(cls, force);
867 }
868 }
869 }
870
871 function apply$1(element, args, fn) {
872 args = args.reduce((args, arg) => args.concat(getClasses(arg)), []);
873
874 for (const node of toNodes(element)) {
875 node.classList[fn](...args);
876 }
877 }
878
879 function getClasses(str) {
880 return String(str).split(/\s|,/).filter(Boolean);
881 }
882
883 function transition(element, props, duration, timing) {if (duration === void 0) {duration = 400;}if (timing === void 0) {timing = 'linear';}
884 return Promise.all(
885 toNodes(element).map(
886 (element) =>
887 new Promise((resolve, reject) => {
888 for (const name in props) {
889 const value = css(element, name);
890 if (value === '') {
891 css(element, name, value);
892 }
893 }
894
895 const timer = setTimeout(() => trigger(element, 'transitionend'), duration);
896
897 once(
898 element,
899 'transitionend transitioncanceled',
900 (_ref) => {let { type } = _ref;
901 clearTimeout(timer);
902 removeClass(element, 'bdt-transition');
903 css(element, {
904 transitionProperty: '',
905 transitionDuration: '',
906 transitionTimingFunction: '' });
907
908 type === 'transitioncanceled' ? reject() : resolve(element);
909 },
910 { self: true });
911
912
913 addClass(element, 'bdt-transition');
914 css(element, {
915 transitionProperty: Object.keys(props).map(propName).join(','),
916 transitionDuration: duration + "ms",
917 transitionTimingFunction: timing,
918 ...props });
919
920 })));
921
922
923 }
924
925 const Transition = {
926 start: transition,
927
928 stop(element) {
929 trigger(element, 'transitionend');
930 return Promise.resolve();
931 },
932
933 cancel(element) {
934 trigger(element, 'transitioncanceled');
935 },
936
937 inProgress(element) {
938 return hasClass(element, 'bdt-transition');
939 } };
940
941
942 const animationPrefix = 'bdt-animation-';
943
944 function animate$1(element, animation, duration, origin, out) {if (duration === void 0) {duration = 200;}
945 return Promise.all(
946 toNodes(element).map(
947 (element) =>
948 new Promise((resolve, reject) => {
949 trigger(element, 'animationcanceled');
950 const timer = setTimeout(() => trigger(element, 'animationend'), duration);
951
952 once(
953 element,
954 'animationend animationcanceled',
955 (_ref2) => {let { type } = _ref2;
956 clearTimeout(timer);
957
958 type === 'animationcanceled' ? reject() : resolve(element);
959
960 css(element, 'animationDuration', '');
961 removeClasses(element, animationPrefix + "\\S*");
962 },
963 { self: true });
964
965
966 css(element, 'animationDuration', duration + "ms");
967 addClass(element, animation, animationPrefix + (out ? 'leave' : 'enter'));
968
969 if (startsWith(animation, animationPrefix)) {
970 origin && addClass(element, "bdt-transform-origin-" + origin);
971 out && addClass(element, animationPrefix + "reverse");
972 }
973 })));
974
975
976 }
977
978 const inProgress = new RegExp(animationPrefix + "(enter|leave)");
979 const Animation = {
980 in: animate$1,
981
982 out(element, animation, duration, origin) {
983 return animate$1(element, animation, duration, origin, true);
984 },
985
986 inProgress(element) {
987 return inProgress.test(attr(element, 'class'));
988 },
989
990 cancel(element) {
991 trigger(element, 'animationcanceled');
992 } };
993
994 const dirs$1 = {
995 width: ['left', 'right'],
996 height: ['top', 'bottom'] };
997
998
999 function dimensions$1(element) {
1000 const rect = isElement(element) ?
1001 toNode(element).getBoundingClientRect() :
1002 { height: height(element), width: width(element), top: 0, left: 0 };
1003
1004 return {
1005 height: rect.height,
1006 width: rect.width,
1007 top: rect.top,
1008 left: rect.left,
1009 bottom: rect.top + rect.height,
1010 right: rect.left + rect.width };
1011
1012 }
1013
1014 function offset(element, coordinates) {
1015 const currentOffset = dimensions$1(element);
1016
1017 if (element) {
1018 const { scrollY, scrollX } = toWindow(element);
1019 const offsetBy = { height: scrollY, width: scrollX };
1020
1021 for (const dir in dirs$1) {
1022 for (const i in dirs$1[dir]) {
1023 currentOffset[dirs$1[dir][i]] += offsetBy[dir];
1024 }
1025 }
1026 }
1027
1028 if (!coordinates) {
1029 return currentOffset;
1030 }
1031
1032 const pos = css(element, 'position');
1033
1034 each(css(element, ['left', 'top']), (value, prop) =>
1035 css(
1036 element,
1037 prop,
1038 coordinates[prop] -
1039 currentOffset[prop] +
1040 toFloat(pos === 'absolute' && value === 'auto' ? position(element)[prop] : value)));
1041
1042
1043 }
1044
1045 function position(element) {
1046 let { top, left } = offset(element);
1047
1048 const {
1049 ownerDocument: { body, documentElement },
1050 offsetParent } =
1051 toNode(element);
1052 let parent = offsetParent || documentElement;
1053
1054 while (
1055 parent && (
1056 parent === body || parent === documentElement) &&
1057 css(parent, 'position') === 'static')
1058 {
1059 parent = parent.parentNode;
1060 }
1061
1062 if (isElement(parent)) {
1063 const parentOffset = offset(parent);
1064 top -= parentOffset.top + toFloat(css(parent, 'borderTopWidth'));
1065 left -= parentOffset.left + toFloat(css(parent, 'borderLeftWidth'));
1066 }
1067
1068 return {
1069 top: top - toFloat(css(element, 'marginTop')),
1070 left: left - toFloat(css(element, 'marginLeft')) };
1071
1072 }
1073
1074 function offsetPosition(element) {
1075 const offset = [0, 0];
1076
1077 element = toNode(element);
1078
1079 do {
1080 offset[0] += element.offsetTop;
1081 offset[1] += element.offsetLeft;
1082
1083 if (css(element, 'position') === 'fixed') {
1084 const win = toWindow(element);
1085 offset[0] += win.scrollY;
1086 offset[1] += win.scrollX;
1087 return offset;
1088 }
1089 } while (element = element.offsetParent);
1090
1091 return offset;
1092 }
1093
1094 const height = dimension('height');
1095 const width = dimension('width');
1096
1097 function dimension(prop) {
1098 const propName = ucfirst(prop);
1099 return (element, value) => {
1100 if (isUndefined(value)) {
1101 if (isWindow(element)) {
1102 return element["inner" + propName];
1103 }
1104
1105 if (isDocument(element)) {
1106 const doc = element.documentElement;
1107 return Math.max(doc["offset" + propName], doc["scroll" + propName]);
1108 }
1109
1110 element = toNode(element);
1111
1112 value = css(element, prop);
1113 value = value === 'auto' ? element["offset" + propName] : toFloat(value) || 0;
1114
1115 return value - boxModelAdjust(element, prop);
1116 } else {
1117 return css(
1118 element,
1119 prop,
1120 !value && value !== 0 ? '' : +value + boxModelAdjust(element, prop) + 'px');
1121
1122 }
1123 };
1124 }
1125
1126 function boxModelAdjust(element, prop, sizing) {if (sizing === void 0) {sizing = 'border-box';}
1127 return css(element, 'boxSizing') === sizing ?
1128 dirs$1[prop].
1129 map(ucfirst).
1130 reduce(
1131 (value, prop) =>
1132 value +
1133 toFloat(css(element, "padding" + prop)) +
1134 toFloat(css(element, "border" + prop + "Width")),
1135 0) :
1136
1137 0;
1138 }
1139
1140 function flipPosition(pos) {
1141 for (const dir in dirs$1) {
1142 for (const i in dirs$1[dir]) {
1143 if (dirs$1[dir][i] === pos) {
1144 return dirs$1[dir][1 - i];
1145 }
1146 }
1147 }
1148 return pos;
1149 }
1150
1151 function toPx(value, property, element, offsetDim) {if (property === void 0) {property = 'width';}if (element === void 0) {element = window;}if (offsetDim === void 0) {offsetDim = false;}
1152 if (!isString(value)) {
1153 return toFloat(value);
1154 }
1155
1156 return parseCalc(value).reduce((result, value) => {
1157 const unit = parseUnit(value);
1158 if (unit) {
1159 value = percent(
1160 unit === 'vh' ?
1161 height(toWindow(element)) :
1162 unit === 'vw' ?
1163 width(toWindow(element)) :
1164 offsetDim ?
1165 element["offset" + ucfirst(property)] :
1166 dimensions$1(element)[property],
1167 value);
1168
1169 }
1170
1171 return result + toFloat(value);
1172 }, 0);
1173 }
1174
1175 const calcRe = /-?\d+(?:\.\d+)?(?:v[wh]|%|px)?/g;
1176 const parseCalc = memoize((calc) => calc.toString().replace(/\s/g, '').match(calcRe) || []);
1177 const unitRe$1 = /(?:v[hw]|%)$/;
1178 const parseUnit = memoize((str) => (str.match(unitRe$1) || [])[0]);
1179
1180 function percent(base, value) {
1181 return base * toFloat(value) / 100;
1182 }
1183
1184 function ready(fn) {
1185 if (document.readyState !== 'loading') {
1186 fn();
1187 return;
1188 }
1189
1190 once(document, 'DOMContentLoaded', fn);
1191 }
1192
1193 function isTag(element, tagName) {var _element$tagName;
1194 return (element == null ? void 0 : (_element$tagName = element.tagName) == null ? void 0 : _element$tagName.toLowerCase()) === tagName.toLowerCase();
1195 }
1196
1197 function empty(element) {
1198 return replaceChildren(element, '');
1199 }
1200
1201 function html(parent, html) {
1202 return isUndefined(html) ? $(parent).innerHTML : replaceChildren(parent, html);
1203 }
1204
1205 const replaceChildren = applyFn('replaceChildren');
1206 const prepend = applyFn('prepend');
1207 const append = applyFn('append');
1208 const before = applyFn('before');
1209 const after = applyFn('after');
1210
1211 function applyFn(fn) {
1212 return function (ref, element) {var _$;
1213 const nodes = toNodes(isString(element) ? fragment(element) : element);
1214 (_$ = $(ref)) == null ? void 0 : _$[fn](...nodes);
1215 return unwrapSingle(nodes);
1216 };
1217 }
1218
1219 function remove$1(element) {
1220 toNodes(element).forEach((element) => element.remove());
1221 }
1222
1223 function wrapAll(element, structure) {
1224 structure = toNode(before(element, structure));
1225
1226 while (structure.firstChild) {
1227 structure = structure.firstChild;
1228 }
1229
1230 append(structure, element);
1231
1232 return structure;
1233 }
1234
1235 function wrapInner(element, structure) {
1236 return toNodes(
1237 toNodes(element).map((element) =>
1238 element.hasChildNodes() ?
1239 wrapAll(toNodes(element.childNodes), structure) :
1240 append(element, structure)));
1241
1242
1243 }
1244
1245 function unwrap(element) {
1246 toNodes(element).
1247 map(parent).
1248 filter((value, index, self) => self.indexOf(value) === index).
1249 forEach((parent) => parent.replaceWith(...parent.childNodes));
1250 }
1251
1252 const fragmentRe = /^\s*<(\w+|!)[^>]*>/;
1253 const singleTagRe = /^<(\w+)\s*\/?>(?:<\/\1>)?$/;
1254
1255 function fragment(html) {
1256 const matches = singleTagRe.exec(html);
1257 if (matches) {
1258 return document.createElement(matches[1]);
1259 }
1260
1261 const container = document.createElement('div');
1262 if (fragmentRe.test(html)) {
1263 container.insertAdjacentHTML('beforeend', html.trim());
1264 } else {
1265 container.textContent = html;
1266 }
1267
1268 return unwrapSingle(container.childNodes);
1269 }
1270
1271 function unwrapSingle(nodes) {
1272 return nodes.length > 1 ? nodes : nodes[0];
1273 }
1274
1275 function apply(node, fn) {
1276 if (!isElement(node)) {
1277 return;
1278 }
1279
1280 fn(node);
1281 node = node.firstElementChild;
1282 while (node) {
1283 const next = node.nextElementSibling;
1284 apply(node, fn);
1285 node = next;
1286 }
1287 }
1288
1289 function $(selector, context) {
1290 return isHtml(selector) ? toNode(fragment(selector)) : find(selector, context);
1291 }
1292
1293 function $$(selector, context) {
1294 return isHtml(selector) ? toNodes(fragment(selector)) : findAll(selector, context);
1295 }
1296
1297 function isHtml(str) {
1298 return isString(str) && startsWith(str.trim(), '<');
1299 }
1300
1301 const inBrowser = typeof window !== 'undefined';
1302 const isRtl = inBrowser && attr(document.documentElement, 'dir') === 'rtl';
1303
1304 const hasTouch = inBrowser && 'ontouchstart' in window;
1305 const hasPointerEvents = inBrowser && window.PointerEvent;
1306
1307 const pointerDown = hasPointerEvents ? 'pointerdown' : hasTouch ? 'touchstart' : 'mousedown';
1308 const pointerMove = hasPointerEvents ? 'pointermove' : hasTouch ? 'touchmove' : 'mousemove';
1309 const pointerUp = hasPointerEvents ? 'pointerup' : hasTouch ? 'touchend' : 'mouseup';
1310 const pointerEnter = hasPointerEvents ? 'pointerenter' : hasTouch ? '' : 'mouseenter';
1311 const pointerLeave = hasPointerEvents ? 'pointerleave' : hasTouch ? '' : 'mouseleave';
1312 const pointerCancel = hasPointerEvents ? 'pointercancel' : 'touchcancel';
1313
1314 /*
1315 Based on:
1316 Copyright (c) 2016 Wilson Page wilsonpage@me.com
1317 https://github.com/wilsonpage/fastdom
1318 */
1319
1320 const fastdom = {
1321 reads: [],
1322 writes: [],
1323
1324 read(task) {
1325 this.reads.push(task);
1326 scheduleFlush();
1327 return task;
1328 },
1329
1330 write(task) {
1331 this.writes.push(task);
1332 scheduleFlush();
1333 return task;
1334 },
1335
1336 clear(task) {
1337 remove(this.reads, task);
1338 remove(this.writes, task);
1339 },
1340
1341 flush };
1342
1343
1344 function flush(recursion) {
1345 runTasks(fastdom.reads);
1346 runTasks(fastdom.writes.splice(0));
1347
1348 fastdom.scheduled = false;
1349
1350 if (fastdom.reads.length || fastdom.writes.length) {
1351 scheduleFlush(recursion + 1);
1352 }
1353 }
1354
1355 const RECURSION_LIMIT = 4;
1356 function scheduleFlush(recursion) {
1357 if (fastdom.scheduled) {
1358 return;
1359 }
1360
1361 fastdom.scheduled = true;
1362 if (recursion && recursion < RECURSION_LIMIT) {
1363 Promise.resolve().then(() => flush(recursion));
1364 } else {
1365 requestAnimationFrame(() => flush(1));
1366 }
1367 }
1368
1369 function runTasks(tasks) {
1370 let task;
1371 while (task = tasks.shift()) {
1372 try {
1373 task();
1374 } catch (e) {
1375 console.error(e);
1376 }
1377 }
1378 }
1379
1380 function remove(array, item) {
1381 const index = array.indexOf(item);
1382 return ~index && array.splice(index, 1);
1383 }
1384
1385 function MouseTracker() {}
1386
1387 MouseTracker.prototype = {
1388 positions: [],
1389
1390 init() {
1391 this.positions = [];
1392
1393 let position;
1394 this.unbind = on(document, 'mousemove', (e) => position = getEventPos(e));
1395 this.interval = setInterval(() => {
1396 if (!position) {
1397 return;
1398 }
1399
1400 this.positions.push(position);
1401
1402 if (this.positions.length > 5) {
1403 this.positions.shift();
1404 }
1405 }, 50);
1406 },
1407
1408 cancel() {var _this$unbind;
1409 (_this$unbind = this.unbind) == null ? void 0 : _this$unbind.call(this);
1410 this.interval && clearInterval(this.interval);
1411 },
1412
1413 movesTo(target) {
1414 if (this.positions.length < 2) {
1415 return false;
1416 }
1417
1418 const p = target.getBoundingClientRect();
1419 const { left, right, top, bottom } = p;
1420
1421 const [prevPosition] = this.positions;
1422 const position = last(this.positions);
1423 const path = [prevPosition, position];
1424
1425 if (pointInRect(position, p)) {
1426 return false;
1427 }
1428
1429 const diagonals = [
1430 [
1431 { x: left, y: top },
1432 { x: right, y: bottom }],
1433
1434 [
1435 { x: left, y: bottom },
1436 { x: right, y: top }]];
1437
1438
1439
1440 return diagonals.some((diagonal) => {
1441 const intersection = intersect(path, diagonal);
1442 return intersection && pointInRect(intersection, p);
1443 });
1444 } };
1445
1446
1447 // Inspired by http://paulbourke.net/geometry/pointlineplane/
1448 function intersect(_ref, _ref2) {let [{ x: x1, y: y1 }, { x: x2, y: y2 }] = _ref;let [{ x: x3, y: y3 }, { x: x4, y: y4 }] = _ref2;
1449 const denominator = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);
1450
1451 // Lines are parallel
1452 if (denominator === 0) {
1453 return false;
1454 }
1455
1456 const ua = ((x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3)) / denominator;
1457
1458 if (ua < 0) {
1459 return false;
1460 }
1461
1462 // Return an object with the x and y coordinates of the intersection
1463 return { x: x1 + ua * (x2 - x1), y: y1 + ua * (y2 - y1) };
1464 }
1465
1466 function observeIntersection(targets, cb, options, intersecting) {if (intersecting === void 0) {intersecting = true;}
1467 return observe(
1468 IntersectionObserver,
1469 targets,
1470 intersecting ?
1471 (entries, observer) => {
1472 if (entries.some((entry) => entry.isIntersecting)) {
1473 cb(entries, observer);
1474 }
1475 } :
1476 cb,
1477 options);
1478
1479 }
1480
1481 const hasResizeObserver = window.ResizeObserver;
1482 function observeResize(targets, cb, options) {if (options === void 0) {options = { box: 'border-box' };}
1483 if (hasResizeObserver) {
1484 return observe(ResizeObserver, targets, cb, options);
1485 }
1486
1487 // Fallback Safari < 13.1
1488 initResizeListener();
1489 listeners.add(cb);
1490
1491 return {
1492 disconnect() {
1493 listeners.delete(cb);
1494 } };
1495
1496 }
1497
1498 let listeners;
1499 function initResizeListener() {
1500 if (listeners) {
1501 return;
1502 }
1503
1504 listeners = new Set();
1505
1506 // throttle 'resize'
1507 let pendingResize;
1508 const handleResize = () => {
1509 if (pendingResize) {
1510 return;
1511 }
1512 pendingResize = true;
1513 fastdom.read(() => pendingResize = false);
1514 for (const listener of listeners) {
1515 listener();
1516 }
1517 };
1518
1519 on(window, 'load resize', handleResize);
1520 on(document, 'loadedmetadata load', handleResize, true);
1521 }
1522
1523 function observeMutation(targets, cb, options) {
1524 return observe(MutationObserver, targets, cb, options);
1525 }
1526
1527 function observe(Observer, targets, cb, options) {
1528 const observer = new Observer(cb);
1529 for (const el of toNodes(targets)) {
1530 observer.observe(el, options);
1531 }
1532
1533 return observer;
1534 }
1535
1536 const strats = {};
1537
1538 strats.events =
1539 strats.created =
1540 strats.beforeConnect =
1541 strats.connected =
1542 strats.beforeDisconnect =
1543 strats.disconnected =
1544 strats.destroy =
1545 concatStrat;
1546
1547 // args strategy
1548 strats.args = function (parentVal, childVal) {
1549 return childVal !== false && concatStrat(childVal || parentVal);
1550 };
1551
1552 // update strategy
1553 strats.update = function (parentVal, childVal) {
1554 return sortBy$1(
1555 concatStrat(parentVal, isFunction(childVal) ? { read: childVal } : childVal),
1556 'order');
1557
1558 };
1559
1560 // property strategy
1561 strats.props = function (parentVal, childVal) {
1562 if (isArray(childVal)) {
1563 const value = {};
1564 for (const key of childVal) {
1565 value[key] = String;
1566 }
1567 childVal = value;
1568 }
1569
1570 return strats.methods(parentVal, childVal);
1571 };
1572
1573 // extend strategy
1574 strats.computed = strats.methods = function (parentVal, childVal) {
1575 return childVal ? parentVal ? { ...parentVal, ...childVal } : childVal : parentVal;
1576 };
1577
1578 // data strategy
1579 strats.data = function (parentVal, childVal, vm) {
1580 if (!vm) {
1581 if (!childVal) {
1582 return parentVal;
1583 }
1584
1585 if (!parentVal) {
1586 return childVal;
1587 }
1588
1589 return function (vm) {
1590 return mergeFnData(parentVal, childVal, vm);
1591 };
1592 }
1593
1594 return mergeFnData(parentVal, childVal, vm);
1595 };
1596
1597 function mergeFnData(parentVal, childVal, vm) {
1598 return strats.computed(
1599 isFunction(parentVal) ? parentVal.call(vm, vm) : parentVal,
1600 isFunction(childVal) ? childVal.call(vm, vm) : childVal);
1601
1602 }
1603
1604 // concat strategy
1605 function concatStrat(parentVal, childVal) {
1606 parentVal = parentVal && !isArray(parentVal) ? [parentVal] : parentVal;
1607
1608 return childVal ?
1609 parentVal ?
1610 parentVal.concat(childVal) :
1611 isArray(childVal) ?
1612 childVal :
1613 [childVal] :
1614 parentVal;
1615 }
1616
1617 // default strategy
1618 function defaultStrat(parentVal, childVal) {
1619 return isUndefined(childVal) ? parentVal : childVal;
1620 }
1621
1622 function mergeOptions(parent, child, vm) {
1623 const options = {};
1624
1625 if (isFunction(child)) {
1626 child = child.options;
1627 }
1628
1629 if (child.extends) {
1630 parent = mergeOptions(parent, child.extends, vm);
1631 }
1632
1633 if (child.mixins) {
1634 for (const mixin of child.mixins) {
1635 parent = mergeOptions(parent, mixin, vm);
1636 }
1637 }
1638
1639 for (const key in parent) {
1640 mergeKey(key);
1641 }
1642
1643 for (const key in child) {
1644 if (!hasOwn(parent, key)) {
1645 mergeKey(key);
1646 }
1647 }
1648
1649 function mergeKey(key) {
1650 options[key] = (strats[key] || defaultStrat)(parent[key], child[key], vm);
1651 }
1652
1653 return options;
1654 }
1655
1656 function parseOptions(options, args) {if (args === void 0) {args = [];}
1657 try {
1658 return options ?
1659 startsWith(options, '{') ?
1660 JSON.parse(options) :
1661 args.length && !includes(options, ':') ?
1662 { [args[0]]: options } :
1663 options.split(';').reduce((options, option) => {
1664 const [key, value] = option.split(/:(.*)/);
1665 if (key && !isUndefined(value)) {
1666 options[key.trim()] = value.trim();
1667 }
1668 return options;
1669 }, {}) :
1670 {};
1671 } catch (e) {
1672 return {};
1673 }
1674 }
1675
1676 function play(el) {
1677 if (isIFrame(el)) {
1678 call(el, { func: 'playVideo', method: 'play' });
1679 }
1680
1681 if (isHTML5(el)) {
1682 try {
1683 el.play().catch(noop);
1684 } catch (e) {
1685 // noop
1686 }
1687 }
1688 }
1689
1690 function pause(el) {
1691 if (isIFrame(el)) {
1692 call(el, { func: 'pauseVideo', method: 'pause' });
1693 }
1694
1695 if (isHTML5(el)) {
1696 el.pause();
1697 }
1698 }
1699
1700 function mute(el) {
1701 if (isIFrame(el)) {
1702 call(el, { func: 'mute', method: 'setVolume', value: 0 });
1703 }
1704
1705 if (isHTML5(el)) {
1706 el.muted = true;
1707 }
1708 }
1709
1710 function isVideo(el) {
1711 return isHTML5(el) || isIFrame(el);
1712 }
1713
1714 function isHTML5(el) {
1715 return isTag(el, 'video');
1716 }
1717
1718 function isIFrame(el) {
1719 return isTag(el, 'iframe') && (isYoutube(el) || isVimeo(el));
1720 }
1721
1722 function isYoutube(el) {
1723 return !!el.src.match(
1724 /\/\/.*?youtube(-nocookie)?\.[a-z]+\/(watch\?v=[^&\s]+|embed)|youtu\.be\/.*/);
1725
1726 }
1727
1728 function isVimeo(el) {
1729 return !!el.src.match(/vimeo\.com\/video\/.*/);
1730 }
1731
1732 async function call(el, cmd) {
1733 await enableApi(el);
1734 post(el, cmd);
1735 }
1736
1737 function post(el, cmd) {
1738 try {
1739 el.contentWindow.postMessage(JSON.stringify({ event: 'command', ...cmd }), '*');
1740 } catch (e) {
1741 // noop
1742 }
1743 }
1744
1745 const stateKey$1 = '_ukPlayer';
1746 let counter = 0;
1747 function enableApi(el) {
1748 if (el[stateKey$1]) {
1749 return el[stateKey$1];
1750 }
1751
1752 const youtube = isYoutube(el);
1753 const vimeo = isVimeo(el);
1754
1755 const id = ++counter;
1756 let poller;
1757
1758 return el[stateKey$1] = new Promise((resolve) => {
1759 youtube &&
1760 once(el, 'load', () => {
1761 const listener = () => post(el, { event: 'listening', id });
1762 poller = setInterval(listener, 100);
1763 listener();
1764 });
1765
1766 once(window, 'message', resolve, false, (_ref) => {let { data } = _ref;
1767 try {
1768 data = JSON.parse(data);
1769 return (
1770 data && (
1771 youtube && data.id === id && data.event === 'onReady' ||
1772 vimeo && Number(data.player_id) === id));
1773
1774 } catch (e) {
1775 // noop
1776 }
1777 });
1778
1779 el.src = "" + el.src + (includes(el.src, '?') ? '&' : '?') + (
1780 youtube ? 'enablejsapi=1' : "api=1&player_id=" + id);
1781
1782 }).then(() => clearInterval(poller));
1783 }
1784
1785 function isInView(element, offsetTop, offsetLeft) {if (offsetTop === void 0) {offsetTop = 0;}if (offsetLeft === void 0) {offsetLeft = 0;}
1786 if (!isVisible(element)) {
1787 return false;
1788 }
1789
1790 return intersectRect(
1791 ...scrollParents(element).
1792 map((parent) => {
1793 const { top, left, bottom, right } = offset(getViewport$1(parent));
1794
1795 return {
1796 top: top - offsetTop,
1797 left: left - offsetLeft,
1798 bottom: bottom + offsetTop,
1799 right: right + offsetLeft };
1800
1801 }).
1802 concat(offset(element)));
1803
1804 }
1805
1806 function scrollTop(element, top) {
1807 if (isWindow(element) || isDocument(element)) {
1808 element = getScrollingElement(element);
1809 } else {
1810 element = toNode(element);
1811 }
1812
1813 if (isUndefined(top)) {
1814 return element.scrollTop;
1815 } else {
1816 element.scrollTop = top;
1817 }
1818 }
1819
1820 function scrollIntoView(element, _temp) {let { offset: offsetBy = 0 } = _temp === void 0 ? {} : _temp;
1821 const parents = isVisible(element) ? scrollParents(element) : [];
1822 return parents.reduce(
1823 (fn, scrollElement, i) => {
1824 const { scrollTop, scrollHeight, offsetHeight } = scrollElement;
1825 const maxScroll = scrollHeight - getViewportClientHeight(scrollElement);
1826 const { height: elHeight, top: elTop } = offset(parents[i - 1] || element);
1827
1828 let top = Math.ceil(
1829 elTop - offset(getViewport$1(scrollElement)).top - offsetBy + scrollTop);
1830
1831
1832 if (offsetBy > 0 && offsetHeight < elHeight + offsetBy) {
1833 top += offsetBy;
1834 } else {
1835 offsetBy = 0;
1836 }
1837
1838 if (top > maxScroll) {
1839 offsetBy -= top - maxScroll;
1840 top = maxScroll;
1841 } else if (top < 0) {
1842 offsetBy -= top;
1843 top = 0;
1844 }
1845
1846 return () => scrollTo(scrollElement, top - scrollTop).then(fn);
1847 },
1848 () => Promise.resolve())();
1849
1850
1851 function scrollTo(element, top) {
1852 return new Promise((resolve) => {
1853 const scroll = element.scrollTop;
1854 const duration = getDuration(Math.abs(top));
1855 const start = Date.now();
1856
1857 (function step() {
1858 const percent = ease(clamp((Date.now() - start) / duration));
1859
1860 scrollTop(element, scroll + top * percent);
1861
1862 // scroll more if we have not reached our destination
1863 if (percent === 1) {
1864 resolve();
1865 } else {
1866 requestAnimationFrame(step);
1867 }
1868 })();
1869 });
1870 }
1871
1872 function getDuration(dist) {
1873 return 40 * Math.pow(dist, 0.375);
1874 }
1875
1876 function ease(k) {
1877 return 0.5 * (1 - Math.cos(Math.PI * k));
1878 }
1879 }
1880
1881 function scrolledOver(element, startOffset, endOffset) {if (startOffset === void 0) {startOffset = 0;}if (endOffset === void 0) {endOffset = 0;}
1882 if (!isVisible(element)) {
1883 return 0;
1884 }
1885
1886 const [scrollElement] = scrollParents(element, /auto|scroll/, true);
1887 const { scrollHeight, scrollTop } = scrollElement;
1888 const viewportHeight = getViewportClientHeight(scrollElement);
1889 const maxScroll = scrollHeight - viewportHeight;
1890 const elementOffsetTop = offsetPosition(element)[0] - offsetPosition(scrollElement)[0];
1891
1892 const start = Math.max(0, elementOffsetTop - viewportHeight + startOffset);
1893 const end = Math.min(maxScroll, elementOffsetTop + element.offsetHeight - endOffset);
1894
1895 return clamp((scrollTop - start) / (end - start));
1896 }
1897
1898 function scrollParents(element, overflowRe, scrollable) {if (overflowRe === void 0) {overflowRe = /auto|scroll|hidden/;}if (scrollable === void 0) {scrollable = false;}
1899 const scrollEl = getScrollingElement(element);
1900
1901 let ancestors = parents(element).reverse();
1902 ancestors = ancestors.slice(ancestors.indexOf(scrollEl) + 1);
1903
1904 const fixedIndex = findIndex(ancestors, (el) => css(el, 'position') === 'fixed');
1905 if (~fixedIndex) {
1906 ancestors = ancestors.slice(fixedIndex);
1907 }
1908
1909 return [scrollEl].
1910 concat(
1911 ancestors.filter(
1912 (parent) =>
1913 overflowRe.test(css(parent, 'overflow')) && (
1914 !scrollable || parent.scrollHeight > getViewportClientHeight(parent)))).
1915
1916
1917 reverse();
1918 }
1919
1920 function getViewport$1(scrollElement) {
1921 return scrollElement === getScrollingElement(scrollElement) ? window : scrollElement;
1922 }
1923
1924 // iOS 12 returns <body> as scrollingElement
1925 function getViewportClientHeight(scrollElement) {
1926 return (
1927 scrollElement === getScrollingElement(scrollElement) ?
1928 document.documentElement :
1929 scrollElement).
1930 clientHeight;
1931 }
1932
1933 function getScrollingElement(element) {
1934 const { document } = toWindow(element);
1935 return document.scrollingElement || document.documentElement;
1936 }
1937
1938 const dirs = {
1939 width: ['x', 'left', 'right'],
1940 height: ['y', 'top', 'bottom'] };
1941
1942
1943 function positionAt(
1944 element,
1945 target,
1946 elAttach,
1947 targetAttach,
1948 elOffset,
1949 targetOffset,
1950 flip,
1951 boundary)
1952 {
1953 elAttach = getPos(elAttach);
1954 targetAttach = getPos(targetAttach);
1955
1956 const flipped = { element: elAttach, target: targetAttach };
1957
1958 if (!element || !target) {
1959 return flipped;
1960 }
1961
1962 const dim = offset(element);
1963 const targetDim = offset(target);
1964 const position = targetDim;
1965
1966 moveTo(position, elAttach, dim, -1);
1967 moveTo(position, targetAttach, targetDim, 1);
1968
1969 elOffset = getOffsets(elOffset, dim.width, dim.height);
1970 targetOffset = getOffsets(targetOffset, targetDim.width, targetDim.height);
1971
1972 elOffset['x'] += targetOffset['x'];
1973 elOffset['y'] += targetOffset['y'];
1974
1975 position.left += elOffset['x'];
1976 position.top += elOffset['y'];
1977
1978 if (flip) {
1979 let boundaries = scrollParents(element).map(getViewport$1);
1980
1981 if (boundary && !includes(boundaries, boundary)) {
1982 boundaries.unshift(boundary);
1983 }
1984
1985 boundaries = boundaries.map((el) => offset(el));
1986
1987 each(dirs, (_ref, prop) => {let [dir, align, alignFlip] = _ref;
1988 if (!(flip === true || includes(flip, dir))) {
1989 return;
1990 }
1991
1992 boundaries.some((boundary) => {
1993 const elemOffset =
1994 elAttach[dir] === align ?
1995 -dim[prop] :
1996 elAttach[dir] === alignFlip ?
1997 dim[prop] :
1998 0;
1999
2000 const targetOffset =
2001 targetAttach[dir] === align ?
2002 targetDim[prop] :
2003 targetAttach[dir] === alignFlip ?
2004 -targetDim[prop] :
2005 0;
2006
2007 if (
2008 position[align] < boundary[align] ||
2009 position[align] + dim[prop] > boundary[alignFlip])
2010 {
2011 const centerOffset = dim[prop] / 2;
2012 const centerTargetOffset =
2013 targetAttach[dir] === 'center' ? -targetDim[prop] / 2 : 0;
2014
2015 return (
2016 elAttach[dir] === 'center' && (
2017 apply(centerOffset, centerTargetOffset) ||
2018 apply(-centerOffset, -centerTargetOffset)) ||
2019 apply(elemOffset, targetOffset));
2020
2021 }
2022
2023 function apply(elemOffset, targetOffset) {
2024 const newVal = toFloat(
2025 (position[align] + elemOffset + targetOffset - elOffset[dir] * 2).toFixed(4));
2026
2027
2028 if (newVal >= boundary[align] && newVal + dim[prop] <= boundary[alignFlip]) {
2029 position[align] = newVal;
2030
2031 for (const el of ['element', 'target']) {
2032 if (elemOffset) {
2033 flipped[el][dir] =
2034 flipped[el][dir] === dirs[prop][1] ?
2035 dirs[prop][2] :
2036 dirs[prop][1];
2037 }
2038 }
2039
2040 return true;
2041 }
2042 }
2043 });
2044 });
2045 }
2046
2047 offset(element, position);
2048
2049 return flipped;
2050 }
2051
2052 function moveTo(position, attach, dim, factor) {
2053 each(dirs, (_ref2, prop) => {let [dir, align, alignFlip] = _ref2;
2054 if (attach[dir] === alignFlip) {
2055 position[align] += dim[prop] * factor;
2056 } else if (attach[dir] === 'center') {
2057 position[align] += dim[prop] * factor / 2;
2058 }
2059 });
2060 }
2061
2062 function getPos(pos) {
2063 const x = /left|center|right/;
2064 const y = /top|center|bottom/;
2065
2066 pos = (pos || '').split(' ');
2067
2068 if (pos.length === 1) {
2069 pos = x.test(pos[0]) ?
2070 pos.concat('center') :
2071 y.test(pos[0]) ?
2072 ['center'].concat(pos) :
2073 ['center', 'center'];
2074 }
2075
2076 return {
2077 x: x.test(pos[0]) ? pos[0] : 'center',
2078 y: y.test(pos[1]) ? pos[1] : 'center' };
2079
2080 }
2081
2082 function getOffsets(offsets, width, height) {
2083 const [x, y] = (offsets || '').split(' ');
2084
2085 return {
2086 x: x ? toFloat(x) * (endsWith(x, '%') ? width / 100 : 1) : 0,
2087 y: y ? toFloat(y) * (endsWith(y, '%') ? height / 100 : 1) : 0 };
2088
2089 }
2090
2091 var util = /*#__PURE__*/Object.freeze({
2092 __proto__: null,
2093 ajax: ajax,
2094 getImage: getImage,
2095 transition: transition,
2096 Transition: Transition,
2097 animate: animate$1,
2098 Animation: Animation,
2099 attr: attr,
2100 hasAttr: hasAttr,
2101 removeAttr: removeAttr,
2102 data: data,
2103 addClass: addClass,
2104 removeClass: removeClass,
2105 removeClasses: removeClasses,
2106 replaceClass: replaceClass,
2107 hasClass: hasClass,
2108 toggleClass: toggleClass,
2109 dimensions: dimensions$1,
2110 offset: offset,
2111 position: position,
2112 offsetPosition: offsetPosition,
2113 height: height,
2114 width: width,
2115 boxModelAdjust: boxModelAdjust,
2116 flipPosition: flipPosition,
2117 toPx: toPx,
2118 ready: ready,
2119 isTag: isTag,
2120 empty: empty,
2121 html: html,
2122 replaceChildren: replaceChildren,
2123 prepend: prepend,
2124 append: append,
2125 before: before,
2126 after: after,
2127 remove: remove$1,
2128 wrapAll: wrapAll,
2129 wrapInner: wrapInner,
2130 unwrap: unwrap,
2131 fragment: fragment,
2132 apply: apply,
2133 $: $,
2134 $$: $$,
2135 inBrowser: inBrowser,
2136 isRtl: isRtl,
2137 hasTouch: hasTouch,
2138 pointerDown: pointerDown,
2139 pointerMove: pointerMove,
2140 pointerUp: pointerUp,
2141 pointerEnter: pointerEnter,
2142 pointerLeave: pointerLeave,
2143 pointerCancel: pointerCancel,
2144 on: on,
2145 off: off,
2146 once: once,
2147 trigger: trigger,
2148 createEvent: createEvent,
2149 toEventTargets: toEventTargets,
2150 isTouch: isTouch,
2151 getEventPos: getEventPos,
2152 fastdom: fastdom,
2153 isVoidElement: isVoidElement,
2154 isVisible: isVisible,
2155 selInput: selInput,
2156 isInput: isInput,
2157 selFocusable: selFocusable,
2158 isFocusable: isFocusable,
2159 parent: parent,
2160 filter: filter$1,
2161 matches: matches,
2162 closest: closest,
2163 within: within,
2164 parents: parents,
2165 children: children,
2166 index: index,
2167 hasOwn: hasOwn,
2168 hyphenate: hyphenate,
2169 camelize: camelize,
2170 ucfirst: ucfirst,
2171 startsWith: startsWith,
2172 endsWith: endsWith,
2173 includes: includes,
2174 findIndex: findIndex,
2175 isArray: isArray,
2176 toArray: toArray,
2177 assign: assign,
2178 isFunction: isFunction,
2179 isObject: isObject,
2180 isPlainObject: isPlainObject,
2181 isWindow: isWindow,
2182 isDocument: isDocument,
2183 isNode: isNode,
2184 isElement: isElement,
2185 isBoolean: isBoolean,
2186 isString: isString,
2187 isNumber: isNumber,
2188 isNumeric: isNumeric,
2189 isEmpty: isEmpty,
2190 isUndefined: isUndefined,
2191 toBoolean: toBoolean,
2192 toNumber: toNumber,
2193 toFloat: toFloat,
2194 toNode: toNode,
2195 toNodes: toNodes,
2196 toWindow: toWindow,
2197 toMs: toMs,
2198 isEqual: isEqual,
2199 swap: swap,
2200 last: last,
2201 each: each,
2202 sortBy: sortBy$1,
2203 uniqueBy: uniqueBy,
2204 clamp: clamp,
2205 noop: noop,
2206 intersectRect: intersectRect,
2207 pointInRect: pointInRect,
2208 Dimensions: Dimensions,
2209 getIndex: getIndex,
2210 memoize: memoize,
2211 Deferred: Deferred,
2212 MouseTracker: MouseTracker,
2213 observeIntersection: observeIntersection,
2214 observeResize: observeResize,
2215 observeMutation: observeMutation,
2216 mergeOptions: mergeOptions,
2217 parseOptions: parseOptions,
2218 play: play,
2219 pause: pause,
2220 mute: mute,
2221 isVideo: isVideo,
2222 positionAt: positionAt,
2223 query: query,
2224 queryAll: queryAll,
2225 find: find,
2226 findAll: findAll,
2227 escape: escape,
2228 css: css,
2229 getCssVar: getCssVar,
2230 propName: propName,
2231 isInView: isInView,
2232 scrollTop: scrollTop,
2233 scrollIntoView: scrollIntoView,
2234 scrolledOver: scrolledOver,
2235 scrollParents: scrollParents,
2236 getViewport: getViewport$1,
2237 getViewportClientHeight: getViewportClientHeight,
2238 getScrollingElement: getScrollingElement
2239 });
2240
2241 function globalAPI (bdtUIkit) {
2242 const DATA = bdtUIkit.data;
2243
2244 bdtUIkit.use = function (plugin) {
2245 if (plugin.installed) {
2246 return;
2247 }
2248
2249 plugin.call(null, this);
2250 plugin.installed = true;
2251
2252 return this;
2253 };
2254
2255 bdtUIkit.mixin = function (mixin, component) {
2256 component = (isString(component) ? bdtUIkit.component(component) : component) || this;
2257 component.options = mergeOptions(component.options, mixin);
2258 };
2259
2260 bdtUIkit.extend = function (options) {
2261 options = options || {};
2262
2263 const Super = this;
2264 const Sub = function bdtUIkitComponent(options) {
2265 this._init(options);
2266 };
2267
2268 Sub.prototype = Object.create(Super.prototype);
2269 Sub.prototype.constructor = Sub;
2270 Sub.options = mergeOptions(Super.options, options);
2271
2272 Sub.super = Super;
2273 Sub.extend = Super.extend;
2274
2275 return Sub;
2276 };
2277
2278 bdtUIkit.update = function (element, e) {
2279 element = element ? toNode(element) : document.body;
2280
2281 for (const parentEl of parents(element).reverse()) {
2282 update(parentEl[DATA], e);
2283 }
2284
2285 apply(element, (element) => update(element[DATA], e));
2286 };
2287
2288 let container;
2289 Object.defineProperty(bdtUIkit, 'container', {
2290 get() {
2291 return container || document.body;
2292 },
2293
2294 set(element) {
2295 container = $(element);
2296 } });
2297
2298
2299 function update(data, e) {
2300 if (!data) {
2301 return;
2302 }
2303
2304 for (const name in data) {
2305 if (data[name]._connected) {
2306 data[name]._callUpdate(e);
2307 }
2308 }
2309 }
2310 }
2311
2312 function hooksAPI (bdtUIkit) {
2313 bdtUIkit.prototype._callHook = function (hook) {var _this$$options$hook;
2314 (_this$$options$hook = this.$options[hook]) == null ? void 0 : _this$$options$hook.forEach((handler) => handler.call(this));
2315 };
2316
2317 bdtUIkit.prototype._callConnected = function () {
2318 if (this._connected) {
2319 return;
2320 }
2321
2322 this._data = {};
2323 this._computed = {};
2324
2325 this._initProps();
2326
2327 this._callHook('beforeConnect');
2328 this._connected = true;
2329
2330 this._initEvents();
2331 this._initObservers();
2332
2333 this._callHook('connected');
2334 this._callUpdate();
2335 };
2336
2337 bdtUIkit.prototype._callDisconnected = function () {
2338 if (!this._connected) {
2339 return;
2340 }
2341
2342 this._callHook('beforeDisconnect');
2343 this._disconnectObservers();
2344 this._unbindEvents();
2345 this._callHook('disconnected');
2346
2347 this._connected = false;
2348 delete this._watch;
2349 };
2350
2351 bdtUIkit.prototype._callUpdate = function (e) {if (e === void 0) {e = 'update';}
2352 if (!this._connected) {
2353 return;
2354 }
2355
2356 if (e === 'update' || e === 'resize') {
2357 this._callWatches();
2358 }
2359
2360 if (!this.$options.update) {
2361 return;
2362 }
2363
2364 if (!this._updates) {
2365 this._updates = new Set();
2366 fastdom.read(() => {
2367 if (this._connected) {
2368 runUpdates.call(this, this._updates);
2369 }
2370 delete this._updates;
2371 });
2372 }
2373
2374 this._updates.add(e.type || e);
2375 };
2376
2377 bdtUIkit.prototype._callWatches = function () {
2378 if (this._watch) {
2379 return;
2380 }
2381
2382 const initial = !hasOwn(this, '_watch');
2383
2384 this._watch = fastdom.read(() => {
2385 if (this._connected) {
2386 runWatches.call(this, initial);
2387 }
2388 this._watch = null;
2389 });
2390 };
2391
2392 function runUpdates(types) {
2393 for (const { read, write, events = [] } of this.$options.update) {
2394 if (!types.has('update') && !events.some((type) => types.has(type))) {
2395 continue;
2396 }
2397
2398 let result;
2399 if (read) {
2400 result = read.call(this, this._data, types);
2401
2402 if (result && isPlainObject(result)) {
2403 assign(this._data, result);
2404 }
2405 }
2406
2407 if (write && result !== false) {
2408 fastdom.write(() => write.call(this, this._data, types));
2409 }
2410 }
2411 }
2412
2413 function runWatches(initial) {
2414 const {
2415 $options: { computed } } =
2416 this;
2417 const values = { ...this._computed };
2418 this._computed = {};
2419
2420 for (const key in computed) {
2421 const { watch, immediate } = computed[key];
2422 if (
2423 watch && (
2424 initial && immediate ||
2425 hasOwn(values, key) && !isEqual(values[key], this[key])))
2426 {
2427 watch.call(this, this[key], values[key]);
2428 }
2429 }
2430 }
2431 }
2432
2433 function stateAPI (bdtUIkit) {
2434 let uid = 0;
2435
2436 bdtUIkit.prototype._init = function (options) {
2437 options = options || {};
2438 options.data = normalizeData(options, this.constructor.options);
2439
2440 this.$options = mergeOptions(this.constructor.options, options, this);
2441 this.$el = null;
2442 this.$props = {};
2443
2444 this._uid = uid++;
2445 this._initData();
2446 this._initMethods();
2447 this._initComputeds();
2448 this._callHook('created');
2449
2450 if (options.el) {
2451 this.$mount(options.el);
2452 }
2453 };
2454
2455 bdtUIkit.prototype._initData = function () {
2456 const { data = {} } = this.$options;
2457
2458 for (const key in data) {
2459 this.$props[key] = this[key] = data[key];
2460 }
2461 };
2462
2463 bdtUIkit.prototype._initMethods = function () {
2464 const { methods } = this.$options;
2465
2466 if (methods) {
2467 for (const key in methods) {
2468 this[key] = methods[key].bind(this);
2469 }
2470 }
2471 };
2472
2473 bdtUIkit.prototype._initComputeds = function () {
2474 const { computed } = this.$options;
2475
2476 this._computed = {};
2477
2478 if (computed) {
2479 for (const key in computed) {
2480 registerComputed(this, key, computed[key]);
2481 }
2482 }
2483 };
2484
2485 bdtUIkit.prototype._initProps = function (props) {
2486 let key;
2487
2488 props = props || getProps$1(this.$options, this.$name);
2489
2490 for (key in props) {
2491 if (!isUndefined(props[key])) {
2492 this.$props[key] = props[key];
2493 }
2494 }
2495
2496 const exclude = [this.$options.computed, this.$options.methods];
2497 for (key in this.$props) {
2498 if (key in props && notIn(exclude, key)) {
2499 this[key] = this.$props[key];
2500 }
2501 }
2502 };
2503
2504 bdtUIkit.prototype._initEvents = function () {
2505 this._events = [];
2506 for (const event of this.$options.events || []) {
2507 if (hasOwn(event, 'handler')) {
2508 registerEvent(this, event);
2509 } else {
2510 for (const key in event) {
2511 registerEvent(this, event[key], key);
2512 }
2513 }
2514 }
2515 };
2516
2517 bdtUIkit.prototype._unbindEvents = function () {
2518 this._events.forEach((unbind) => unbind());
2519 delete this._events;
2520 };
2521
2522 bdtUIkit.prototype._initObservers = function () {
2523 this._observers = [initPropsObserver(this)];
2524
2525 if (this.$options.computed) {
2526 this.registerObserver(initChildListObserver(this));
2527 }
2528 };
2529
2530 bdtUIkit.prototype.registerObserver = function (observer) {
2531 this._observers.push(observer);
2532 };
2533
2534 bdtUIkit.prototype._disconnectObservers = function () {
2535 this._observers.forEach((observer) => observer == null ? void 0 : observer.disconnect());
2536 };
2537 }
2538
2539 function getProps$1(opts, name) {
2540 const data$1 = {};
2541 const { args = [], props = {}, el } = opts;
2542
2543 if (!props) {
2544 return data$1;
2545 }
2546
2547 for (const key in props) {
2548 const prop = hyphenate(key);
2549 let value = data(el, prop);
2550
2551 if (isUndefined(value)) {
2552 continue;
2553 }
2554
2555 value = props[key] === Boolean && value === '' ? true : coerce(props[key], value);
2556
2557 if (prop === 'target' && (!value || startsWith(value, '_'))) {
2558 continue;
2559 }
2560
2561 data$1[key] = value;
2562 }
2563
2564 const options = parseOptions(data(el, name), args);
2565
2566 for (const key in options) {
2567 const prop = camelize(key);
2568 if (props[prop] !== undefined) {
2569 data$1[prop] = coerce(props[prop], options[key]);
2570 }
2571 }
2572
2573 return data$1;
2574 }
2575
2576 function registerComputed(component, key, cb) {
2577 Object.defineProperty(component, key, {
2578 enumerable: true,
2579
2580 get() {
2581 const { _computed, $props, $el } = component;
2582
2583 if (!hasOwn(_computed, key)) {
2584 _computed[key] = (cb.get || cb).call(component, $props, $el);
2585 }
2586
2587 return _computed[key];
2588 },
2589
2590 set(value) {
2591 const { _computed } = component;
2592
2593 _computed[key] = cb.set ? cb.set.call(component, value) : value;
2594
2595 if (isUndefined(_computed[key])) {
2596 delete _computed[key];
2597 }
2598 } });
2599
2600 }
2601
2602 function registerEvent(component, event, key) {
2603 if (!isPlainObject(event)) {
2604 event = { name: key, handler: event };
2605 }
2606
2607 let { name, el, handler, capture, passive, delegate, filter, self } = event;
2608 el = isFunction(el) ? el.call(component) : el || component.$el;
2609
2610 if (isArray(el)) {
2611 el.forEach((el) => registerEvent(component, { ...event, el }, key));
2612 return;
2613 }
2614
2615 if (!el || filter && !filter.call(component)) {
2616 return;
2617 }
2618
2619 component._events.push(
2620 on(
2621 el,
2622 name,
2623 delegate ? isString(delegate) ? delegate : delegate.call(component) : null,
2624 isString(handler) ? component[handler] : handler.bind(component),
2625 { passive, capture, self }));
2626
2627
2628 }
2629
2630 function notIn(options, key) {
2631 return options.every((arr) => !arr || !hasOwn(arr, key));
2632 }
2633
2634 function coerce(type, value) {
2635 if (type === Boolean) {
2636 return toBoolean(value);
2637 } else if (type === Number) {
2638 return toNumber(value);
2639 } else if (type === 'list') {
2640 return toList(value);
2641 }
2642
2643 return type ? type(value) : value;
2644 }
2645
2646 function toList(value) {
2647 return isArray(value) ?
2648 value :
2649 isString(value) ?
2650 value.
2651 split(/,(?![^(]*\))/).
2652 map((value) => isNumeric(value) ? toNumber(value) : toBoolean(value.trim())) :
2653 [value];
2654 }
2655
2656 function normalizeData(_ref, _ref2) {let { data = {} } = _ref;let { args = [], props = {} } = _ref2;
2657 if (isArray(data)) {
2658 data = data.slice(0, args.length).reduce((data, value, index) => {
2659 if (isPlainObject(value)) {
2660 assign(data, value);
2661 } else {
2662 data[args[index]] = value;
2663 }
2664 return data;
2665 }, {});
2666 }
2667
2668 for (const key in data) {
2669 if (isUndefined(data[key])) {
2670 delete data[key];
2671 } else if (props[key]) {
2672 data[key] = coerce(props[key], data[key]);
2673 }
2674 }
2675
2676 return data;
2677 }
2678
2679 function initChildListObserver(component) {
2680 const { el } = component.$options;
2681
2682 const observer = new MutationObserver(() => component.$emit());
2683 observer.observe(el, {
2684 childList: true,
2685 subtree: true });
2686
2687
2688 return observer;
2689 }
2690
2691 function initPropsObserver(component) {
2692 const { $name, $options, $props } = component;
2693 const { attrs, props, el } = $options;
2694
2695 if (!props || attrs === false) {
2696 return;
2697 }
2698
2699 const attributes = isArray(attrs) ? attrs : Object.keys(props);
2700 const filter = attributes.map((key) => hyphenate(key)).concat($name);
2701
2702 const observer = new MutationObserver((records) => {
2703 const data = getProps$1($options, $name);
2704 if (
2705 records.some((_ref3) => {let { attributeName } = _ref3;
2706 const prop = attributeName.replace('data-', '');
2707 return (
2708 prop === $name ? attributes : [camelize(prop), camelize(attributeName)]).
2709 some((prop) => !isUndefined(data[prop]) && data[prop] !== $props[prop]);
2710 }))
2711 {
2712 component.$reset();
2713 }
2714 });
2715
2716 observer.observe(el, {
2717 attributes: true,
2718 attributeFilter: filter.concat(filter.map((key) => "data-" + key)) });
2719
2720
2721 return observer;
2722 }
2723
2724 function instanceAPI (bdtUIkit) {
2725 const DATA = bdtUIkit.data;
2726
2727 bdtUIkit.prototype.$create = function (component, element, data) {
2728 return bdtUIkit[component](element, data);
2729 };
2730
2731 bdtUIkit.prototype.$mount = function (el) {
2732 const { name } = this.$options;
2733
2734 if (!el[DATA]) {
2735 el[DATA] = {};
2736 }
2737
2738 if (el[DATA][name]) {
2739 return;
2740 }
2741
2742 el[DATA][name] = this;
2743
2744 this.$el = this.$options.el = this.$options.el || el;
2745
2746 if (within(el, document)) {
2747 this._callConnected();
2748 }
2749 };
2750
2751 bdtUIkit.prototype.$reset = function () {
2752 this._callDisconnected();
2753 this._callConnected();
2754 };
2755
2756 bdtUIkit.prototype.$destroy = function (removeEl) {if (removeEl === void 0) {removeEl = false;}
2757 const { el, name } = this.$options;
2758
2759 if (el) {
2760 this._callDisconnected();
2761 }
2762
2763 this._callHook('destroy');
2764
2765 if (!(el != null && el[DATA])) {
2766 return;
2767 }
2768
2769 delete el[DATA][name];
2770
2771 if (!isEmpty(el[DATA])) {
2772 delete el[DATA];
2773 }
2774
2775 if (removeEl) {
2776 remove$1(this.$el);
2777 }
2778 };
2779
2780 bdtUIkit.prototype.$emit = function (e) {
2781 this._callUpdate(e);
2782 };
2783
2784 bdtUIkit.prototype.$update = function (element, e) {if (element === void 0) {element = this.$el;}
2785 bdtUIkit.update(element, e);
2786 };
2787
2788 bdtUIkit.prototype.$getComponent = bdtUIkit.getComponent;
2789
2790 const componentName = memoize((name) => bdtUIkit.prefix + hyphenate(name));
2791 Object.defineProperties(bdtUIkit.prototype, {
2792 $container: Object.getOwnPropertyDescriptor(bdtUIkit, 'container'),
2793
2794 $name: {
2795 get() {
2796 return componentName(this.$options.name);
2797 } } });
2798
2799
2800 }
2801
2802 function componentAPI (bdtUIkit) {
2803 const DATA = bdtUIkit.data;
2804
2805 const components = {};
2806
2807 bdtUIkit.component = function (name, options) {
2808 const id = hyphenate(name);
2809
2810 name = camelize(id);
2811
2812 if (!options) {
2813 if (isPlainObject(components[name])) {
2814 components[name] = bdtUIkit.extend(components[name]);
2815 }
2816
2817 return components[name];
2818 }
2819
2820 bdtUIkit[name] = function (element, data) {
2821 const component = bdtUIkit.component(name);
2822
2823 return component.options.functional ?
2824 new component({ data: isPlainObject(element) ? element : [...arguments] }) :
2825 element ?
2826 $$(element).map(init)[0] :
2827 init();
2828
2829 function init(element) {
2830 const instance = bdtUIkit.getComponent(element, name);
2831
2832 if (instance) {
2833 if (data) {
2834 instance.$destroy();
2835 } else {
2836 return instance;
2837 }
2838 }
2839
2840 return new component({ el: element, data });
2841 }
2842 };
2843
2844 const opt = isPlainObject(options) ? { ...options } : options.options;
2845
2846 opt.name = name;
2847
2848 opt.install == null ? void 0 : opt.install(bdtUIkit, opt, name);
2849
2850 if (bdtUIkit._initialized && !opt.functional) {
2851 fastdom.read(() => bdtUIkit[name]("[bdt-" + id + "],[data-bdt-" + id + "]"));
2852 }
2853
2854 return components[name] = isPlainObject(options) ? opt : options;
2855 };
2856
2857 bdtUIkit.getComponents = (element) => (element == null ? void 0 : element[DATA]) || {};
2858 bdtUIkit.getComponent = (element, name) => bdtUIkit.getComponents(element)[name];
2859
2860 bdtUIkit.connect = (node) => {
2861 if (node[DATA]) {
2862 for (const name in node[DATA]) {
2863 node[DATA][name]._callConnected();
2864 }
2865 }
2866
2867 for (const attribute of node.attributes) {
2868 const name = getComponentName(attribute.name);
2869
2870 if (name && name in components) {
2871 bdtUIkit[name](node);
2872 }
2873 }
2874 };
2875
2876 bdtUIkit.disconnect = (node) => {
2877 for (const name in node[DATA]) {
2878 node[DATA][name]._callDisconnected();
2879 }
2880 };
2881 }
2882
2883 const getComponentName = memoize((attribute) => {
2884 return startsWith(attribute, 'bdt-') || startsWith(attribute, 'data-bdt-') ?
2885 camelize(attribute.replace('data-bdt-', '').replace('bdt-', '')) :
2886 false;
2887 });
2888
2889 const bdtUIkit = function (options) {
2890 this._init(options);
2891 };
2892
2893 bdtUIkit.util = util;
2894 bdtUIkit.data = '__uikit__';
2895 bdtUIkit.prefix = 'bdt-';
2896 bdtUIkit.options = {};
2897 bdtUIkit.version = '3.13.1';
2898
2899 globalAPI(bdtUIkit);
2900 hooksAPI(bdtUIkit);
2901 stateAPI(bdtUIkit);
2902 componentAPI(bdtUIkit);
2903 instanceAPI(bdtUIkit);
2904
2905 function Core () {
2906 if (!inBrowser) {
2907 return;
2908 }
2909
2910 let started = 0;
2911 on(
2912 document,
2913 'animationstart',
2914 (_ref) => {let { target } = _ref;
2915 if ((css(target, 'animationName') || '').match(/^bdt-.*(left|right)/)) {
2916 started++;
2917 css(document.documentElement, 'overflowX', 'hidden');
2918 setTimeout(() => {
2919 if (! --started) {
2920 css(document.documentElement, 'overflowX', '');
2921 }
2922 }, toMs(css(target, 'animationDuration')) + 100);
2923 }
2924 },
2925 true);
2926
2927 }
2928
2929 function boot (bdtUIkit) {
2930 const { connect, disconnect } = bdtUIkit;
2931
2932 if (!inBrowser || !window.MutationObserver) {
2933 return;
2934 }
2935
2936 fastdom.read(function () {
2937 if (document.body) {
2938 apply(document.body, connect);
2939 }
2940
2941 new MutationObserver((records) => records.forEach(applyChildListMutation)).observe(
2942 document,
2943 {
2944 childList: true,
2945 subtree: true });
2946
2947
2948
2949 new MutationObserver((records) => records.forEach(applyAttributeMutation)).observe(
2950 document,
2951 {
2952 attributes: true,
2953 subtree: true });
2954
2955
2956
2957 bdtUIkit._initialized = true;
2958 });
2959
2960 function applyChildListMutation(_ref) {let { addedNodes, removedNodes } = _ref;
2961 for (const node of addedNodes) {
2962 apply(node, connect);
2963 }
2964
2965 for (const node of removedNodes) {
2966 apply(node, disconnect);
2967 }
2968 }
2969
2970 function applyAttributeMutation(_ref2) {var _bdtUIkit$getComponent;let { target, attributeName } = _ref2;
2971 const name = getComponentName(attributeName);
2972
2973 if (!name || !(name in bdtUIkit)) {
2974 return;
2975 }
2976
2977 if (hasAttr(target, attributeName)) {
2978 bdtUIkit[name](target);
2979 return;
2980 }
2981
2982 (_bdtUIkit$getComponent = bdtUIkit.getComponent(target, name)) == null ? void 0 : _bdtUIkit$getComponent.$destroy();
2983 }
2984 }
2985
2986 var Class = {
2987 connected() {
2988 !hasClass(this.$el, this.$name) && addClass(this.$el, this.$name);
2989 } };
2990
2991 var Lazyload = {
2992 methods: {
2993 lazyload(observeTargets, targets) {if (observeTargets === void 0) {observeTargets = this.$el;}if (targets === void 0) {targets = this.$el;}
2994 this.registerObserver(
2995 observeIntersection(observeTargets, (entries, observer) => {
2996 for (const el of toNodes(isFunction(targets) ? targets() : targets)) {
2997 $$('[loading="lazy"]', el).forEach((el) => removeAttr(el, 'loading'));
2998 }
2999 for (const el of entries.
3000 filter((_ref) => {let { isIntersecting } = _ref;return isIntersecting;}).
3001 map((_ref2) => {let { target } = _ref2;return target;})) {
3002 observer.unobserve(el);
3003 }
3004 }));
3005
3006 } } };
3007
3008 var Togglable = {
3009 props: {
3010 cls: Boolean,
3011 animation: 'list',
3012 duration: Number,
3013 origin: String,
3014 transition: String },
3015
3016
3017 data: {
3018 cls: false,
3019 animation: [false],
3020 duration: 200,
3021 origin: false,
3022 transition: 'linear',
3023 clsEnter: 'bdt-togglabe-enter',
3024 clsLeave: 'bdt-togglabe-leave',
3025
3026 initProps: {
3027 overflow: '',
3028 height: '',
3029 paddingTop: '',
3030 paddingBottom: '',
3031 marginTop: '',
3032 marginBottom: '' },
3033
3034
3035 hideProps: {
3036 overflow: 'hidden',
3037 height: 0,
3038 paddingTop: 0,
3039 paddingBottom: 0,
3040 marginTop: 0,
3041 marginBottom: 0 } },
3042
3043
3044
3045 computed: {
3046 hasAnimation(_ref) {let { animation } = _ref;
3047 return !!animation[0];
3048 },
3049
3050 hasTransition(_ref2) {let { animation } = _ref2;
3051 return this.hasAnimation && animation[0] === true;
3052 } },
3053
3054
3055 methods: {
3056 toggleElement(targets, toggle, animate) {
3057 return new Promise((resolve) =>
3058 Promise.all(
3059 toNodes(targets).map((el) => {
3060 const show = isBoolean(toggle) ? toggle : !this.isToggled(el);
3061
3062 if (!trigger(el, "before" + (show ? 'show' : 'hide'), [this])) {
3063 return Promise.reject();
3064 }
3065
3066 const promise = (
3067 isFunction(animate) ?
3068 animate :
3069 animate === false || !this.hasAnimation ?
3070 this._toggle :
3071 this.hasTransition ?
3072 toggleHeight(this) :
3073 toggleAnimation(this))(
3074 el, show);
3075
3076 const cls = show ? this.clsEnter : this.clsLeave;
3077
3078 addClass(el, cls);
3079
3080 trigger(el, show ? 'show' : 'hide', [this]);
3081
3082 const done = () => {
3083 removeClass(el, cls);
3084 trigger(el, show ? 'shown' : 'hidden', [this]);
3085 this.$update(el);
3086 };
3087
3088 return promise ?
3089 promise.then(done, () => {
3090 removeClass(el, cls);
3091 return Promise.reject();
3092 }) :
3093 done();
3094 })).
3095 then(resolve, noop));
3096
3097 },
3098
3099 isToggled(el) {if (el === void 0) {el = this.$el;}
3100 [el] = toNodes(el);
3101 return hasClass(el, this.clsEnter) ?
3102 true :
3103 hasClass(el, this.clsLeave) ?
3104 false :
3105 this.cls ?
3106 hasClass(el, this.cls.split(' ')[0]) :
3107 isVisible(el);
3108 },
3109
3110 _toggle(el, toggled) {
3111 if (!el) {
3112 return;
3113 }
3114
3115 toggled = Boolean(toggled);
3116
3117 let changed;
3118 if (this.cls) {
3119 changed = includes(this.cls, ' ') || toggled !== hasClass(el, this.cls);
3120 changed && toggleClass(el, this.cls, includes(this.cls, ' ') ? undefined : toggled);
3121 } else {
3122 changed = toggled === el.hidden;
3123 changed && (el.hidden = !toggled);
3124 }
3125
3126 $$('[autofocus]', el).some((el) => isVisible(el) ? el.focus() || true : el.blur());
3127
3128 if (changed) {
3129 trigger(el, 'toggled', [toggled, this]);
3130 this.$update(el);
3131 }
3132 } } };
3133
3134
3135
3136 function toggleHeight(_ref3) {let { isToggled, duration, initProps, hideProps, transition, _toggle } = _ref3;
3137 return (el, show) => {
3138 const inProgress = Transition.inProgress(el);
3139 const inner = el.hasChildNodes() ?
3140 toFloat(css(el.firstElementChild, 'marginTop')) +
3141 toFloat(css(el.lastElementChild, 'marginBottom')) :
3142 0;
3143 const currentHeight = isVisible(el) ? height(el) + (inProgress ? 0 : inner) : 0;
3144
3145 Transition.cancel(el);
3146
3147 if (!isToggled(el)) {
3148 _toggle(el, true);
3149 }
3150
3151 height(el, '');
3152
3153 // Update child components first
3154 fastdom.flush();
3155
3156 const endHeight = height(el) + (inProgress ? 0 : inner);
3157 height(el, currentHeight);
3158
3159 return (
3160 show ?
3161 Transition.start(
3162 el,
3163 { ...initProps, overflow: 'hidden', height: endHeight },
3164 Math.round(duration * (1 - currentHeight / endHeight)),
3165 transition) :
3166
3167 Transition.start(
3168 el,
3169 hideProps,
3170 Math.round(duration * (currentHeight / endHeight)),
3171 transition).
3172 then(() => _toggle(el, false))).
3173 then(() => css(el, initProps));
3174 };
3175 }
3176
3177 function toggleAnimation(cmp) {
3178 return (el, show) => {
3179 Animation.cancel(el);
3180
3181 const { animation, duration, _toggle } = cmp;
3182
3183 if (show) {
3184 _toggle(el, true);
3185 return Animation.in(el, animation[0], duration, cmp.origin);
3186 }
3187
3188 return Animation.out(el, animation[1] || animation[0], duration, cmp.origin).then(() =>
3189 _toggle(el, false));
3190
3191 };
3192 }
3193
3194 var Accordion = {
3195 mixins: [Class, Lazyload, Togglable],
3196
3197 props: {
3198 targets: String,
3199 active: null,
3200 collapsible: Boolean,
3201 multiple: Boolean,
3202 toggle: String,
3203 content: String,
3204 transition: String,
3205 offset: Number },
3206
3207
3208 data: {
3209 targets: '> *',
3210 active: false,
3211 animation: [true],
3212 collapsible: true,
3213 multiple: false,
3214 clsOpen: 'bdt-open',
3215 toggle: '> .bdt-accordion-title',
3216 content: '> .bdt-accordion-content',
3217 transition: 'ease',
3218 offset: 0 },
3219
3220
3221 computed: {
3222 items: {
3223 get(_ref, $el) {let { targets } = _ref;
3224 return $$(targets, $el);
3225 },
3226
3227 watch(items, prev) {
3228 items.forEach((el) => hide($(this.content, el), !hasClass(el, this.clsOpen)));
3229
3230 if (prev || hasClass(items, this.clsOpen)) {
3231 return;
3232 }
3233
3234 const active =
3235 this.active !== false && items[Number(this.active)] ||
3236 !this.collapsible && items[0];
3237
3238 if (active) {
3239 this.toggle(active, false);
3240 }
3241 },
3242
3243 immediate: true },
3244
3245
3246 toggles(_ref2) {let { toggle } = _ref2;
3247 return this.items.map((item) => $(toggle, item));
3248 } },
3249
3250
3251 connected() {
3252 this.lazyload();
3253 },
3254
3255 events: [
3256 {
3257 name: 'click',
3258
3259 delegate() {
3260 return this.targets + " " + this.$props.toggle;
3261 },
3262
3263 handler(e) {
3264 e.preventDefault();
3265 this.toggle(index(this.toggles, e.current));
3266 } }],
3267
3268
3269
3270 methods: {
3271 toggle(item, animate) {
3272 let items = [this.items[getIndex(item, this.items)]];
3273 const activeItems = filter$1(this.items, "." + this.clsOpen);
3274
3275 if (!this.multiple && !includes(activeItems, items[0])) {
3276 items = items.concat(activeItems);
3277 }
3278
3279 if (
3280 !this.collapsible &&
3281 activeItems.length < 2 &&
3282 !filter$1(items, ":not(." + this.clsOpen + ")").length)
3283 {
3284 return;
3285 }
3286
3287 for (const el of items) {
3288 this.toggleElement(el, !hasClass(el, this.clsOpen), async (el, show) => {
3289 toggleClass(el, this.clsOpen, show);
3290 attr($(this.$props.toggle, el), 'aria-expanded', show);
3291
3292 const content = $("" + (el._wrapper ? '> * ' : '') + this.content, el);
3293
3294 if (animate === false || !this.hasTransition) {
3295 hide(content, !show);
3296 return;
3297 }
3298
3299 if (!el._wrapper) {
3300 el._wrapper = wrapAll(content, "<div" + (show ? ' hidden' : '') + ">");
3301 }
3302
3303 hide(content, false);
3304 await toggleHeight(this)(el._wrapper, show);
3305 hide(content, !show);
3306
3307 delete el._wrapper;
3308 unwrap(content);
3309
3310 if (show) {
3311 const toggle = $(this.$props.toggle, el);
3312 fastdom.read(() => {
3313 if (!isInView(toggle)) {
3314 scrollIntoView(toggle, { offset: this.offset });
3315 }
3316 });
3317 }
3318 });
3319 }
3320 } } };
3321
3322
3323
3324 function hide(el, hide) {
3325 el && (el.hidden = hide);
3326 }
3327
3328 var alert = {
3329 mixins: [Class, Togglable],
3330
3331 args: 'animation',
3332
3333 props: {
3334 close: String },
3335
3336
3337 data: {
3338 animation: [true],
3339 selClose: '.bdt-alert-close',
3340 duration: 150,
3341 hideProps: { opacity: 0, ...Togglable.data.hideProps } },
3342
3343
3344 events: [
3345 {
3346 name: 'click',
3347
3348 delegate() {
3349 return this.selClose;
3350 },
3351
3352 handler(e) {
3353 e.preventDefault();
3354 this.close();
3355 } }],
3356
3357
3358
3359 methods: {
3360 async close() {
3361 await this.toggleElement(this.$el);
3362 this.$destroy(true);
3363 } } };
3364
3365 var Video = {
3366 args: 'autoplay',
3367
3368 props: {
3369 automute: Boolean,
3370 autoplay: Boolean },
3371
3372
3373 data: {
3374 automute: false,
3375 autoplay: true },
3376
3377
3378 connected() {
3379 this.inView = this.autoplay === 'inview';
3380
3381 if (this.inView && !hasAttr(this.$el, 'preload')) {
3382 this.$el.preload = 'none';
3383 }
3384
3385 if (this.automute) {
3386 mute(this.$el);
3387 }
3388
3389 this.registerObserver(observeIntersection(this.$el, () => this.$emit('scroll'), {}, false));
3390 },
3391
3392 update: {
3393 read() {
3394 if (!isVideo(this.$el)) {
3395 return false;
3396 }
3397
3398 return {
3399 visible: isVisible(this.$el) && css(this.$el, 'visibility') !== 'hidden',
3400 inView: this.inView && isInView(this.$el) };
3401
3402 },
3403
3404 write(_ref) {let { visible, inView } = _ref;
3405 if (!visible || this.inView && !inView) {
3406 pause(this.$el);
3407 } else if (this.autoplay === true || this.inView && inView) {
3408 play(this.$el);
3409 }
3410 } } };
3411
3412 var Resize = {
3413 connected() {var _this$$options$resize;
3414 this.registerObserver(
3415 observeResize(((_this$$options$resize = this.$options.resizeTargets) == null ? void 0 : _this$$options$resize.call(this)) || this.$el, () =>
3416 this.$emit('resize')));
3417
3418
3419 } };
3420
3421 var cover = {
3422 mixins: [Resize, Video],
3423
3424 props: {
3425 width: Number,
3426 height: Number },
3427
3428
3429 data: {
3430 automute: true },
3431
3432
3433 events: {
3434 load() {
3435 this.$emit('resize');
3436 } },
3437
3438
3439 resizeTargets() {
3440 return [this.$el, parent(this.$el)];
3441 },
3442
3443 update: {
3444 read() {
3445 const el = this.$el;
3446 const { offsetHeight: height, offsetWidth: width } =
3447 getPositionedParent(el) || parent(el);
3448 const dim = Dimensions.cover(
3449 {
3450 width: this.width || el.naturalWidth || el.videoWidth || el.clientWidth,
3451 height: this.height || el.naturalHeight || el.videoHeight || el.clientHeight },
3452
3453 {
3454 width: width + (width % 2 ? 1 : 0),
3455 height: height + (height % 2 ? 1 : 0) });
3456
3457
3458
3459 if (!dim.width || !dim.height) {
3460 return false;
3461 }
3462
3463 return dim;
3464 },
3465
3466 write(_ref) {let { height, width } = _ref;
3467 css(this.$el, { height, width });
3468 },
3469
3470 events: ['resize'] } };
3471
3472
3473
3474 function getPositionedParent(el) {
3475 while (el = parent(el)) {
3476 if (css(el, 'position') !== 'static') {
3477 return el;
3478 }
3479 }
3480 }
3481
3482 var Container = {
3483 props: {
3484 container: Boolean },
3485
3486
3487 data: {
3488 container: true },
3489
3490
3491 computed: {
3492 container(_ref) {let { container } = _ref;
3493 return container === true && this.$container || container && $(container);
3494 } } };
3495
3496 var Position = {
3497 props: {
3498 pos: String,
3499 offset: null,
3500 flip: Boolean,
3501 clsPos: String },
3502
3503
3504 data: {
3505 pos: "bottom-" + (isRtl ? 'right' : 'left'),
3506 flip: true,
3507 offset: false,
3508 clsPos: '' },
3509
3510
3511 connected() {
3512 this.pos = this.$props.pos.split('-').concat('center').slice(0, 2);
3513 this.dir = this.pos[0];
3514 this.align = this.pos[1];
3515 },
3516
3517 methods: {
3518 positionAt(element, target, boundary) {
3519 removeClasses(element, this.clsPos + "-(top|bottom|left|right)(-[a-z]+)?");
3520
3521 let { offset: offset$1 } = this;
3522 const axis = this.getAxis();
3523 const dir = this.pos[0];
3524 const align = this.pos[1];
3525
3526 if (!isNumeric(offset$1)) {
3527 const node = $(offset$1);
3528 offset$1 = node ?
3529 offset(node)[axis === 'x' ? 'left' : 'top'] -
3530 offset(target)[axis === 'x' ? 'right' : 'bottom'] :
3531 0;
3532 }
3533
3534 const { x, y } = positionAt(
3535 element,
3536 target,
3537 axis === 'x' ? flipPosition(dir) + " " + align : align + " " + flipPosition(dir),
3538 axis === 'x' ? dir + " " + align : align + " " + dir,
3539 axis === 'x' ? "" + (
3540 dir === 'left' ? -offset$1 : offset$1) : " " + (
3541 dir === 'top' ? -offset$1 : offset$1),
3542 null,
3543 this.flip,
3544 boundary).
3545 target;
3546
3547 this.dir = axis === 'x' ? x : y;
3548 this.align = axis === 'x' ? y : x;
3549
3550 toggleClass(element, this.clsPos + "-" + this.dir + "-" + this.align, this.offset === false);
3551 },
3552
3553 getAxis() {
3554 return this.dir === 'top' || this.dir === 'bottom' ? 'y' : 'x';
3555 } } };
3556
3557 let active$1;
3558
3559 var drop = {
3560 mixins: [Container, Lazyload, Position, Togglable],
3561
3562 args: 'pos',
3563
3564 props: {
3565 mode: 'list',
3566 toggle: Boolean,
3567 boundary: Boolean,
3568 boundaryAlign: Boolean,
3569 delayShow: Number,
3570 delayHide: Number,
3571 clsDrop: String },
3572
3573
3574 data: {
3575 mode: ['click', 'hover'],
3576 toggle: '- *',
3577 boundary: true,
3578 boundaryAlign: false,
3579 delayShow: 0,
3580 delayHide: 800,
3581 clsDrop: false,
3582 animation: ['bdt-animation-fade'],
3583 cls: 'bdt-open',
3584 container: false },
3585
3586
3587 created() {
3588 this.tracker = new MouseTracker();
3589 },
3590
3591 connected() {
3592 this.clsPos = this.clsDrop = this.$props.clsDrop || "bdt-" + this.$options.name;
3593 addClass(this.$el, this.clsDrop);
3594
3595 if (this.toggle && !this.target) {
3596 this.target = this.$create('toggle', query(this.toggle, this.$el), {
3597 target: this.$el,
3598 mode: this.mode }).
3599 $el;
3600 attr(this.target, 'aria-haspopup', true);
3601 this.lazyload(this.target);
3602 }
3603 },
3604
3605 disconnected() {
3606 if (this.isActive()) {
3607 active$1 = null;
3608 }
3609 },
3610
3611 events: [
3612 {
3613 name: 'click',
3614
3615 delegate() {
3616 return "." + this.clsDrop + "-close";
3617 },
3618
3619 handler(e) {
3620 e.preventDefault();
3621 this.hide(false);
3622 } },
3623
3624
3625 {
3626 name: 'click',
3627
3628 delegate() {
3629 return 'a[href^="#"]';
3630 },
3631
3632 handler(_ref) {let { defaultPrevented, current: { hash } } = _ref;
3633 if (!defaultPrevented && hash && !within(hash, this.$el)) {
3634 this.hide(false);
3635 }
3636 } },
3637
3638
3639 {
3640 name: 'beforescroll',
3641
3642 handler() {
3643 this.hide(false);
3644 } },
3645
3646
3647 {
3648 name: 'toggle',
3649
3650 self: true,
3651
3652 handler(e, toggle) {
3653 e.preventDefault();
3654
3655 if (this.isToggled()) {
3656 this.hide(false);
3657 } else {
3658 this.show(toggle.$el, false);
3659 }
3660 } },
3661
3662
3663 {
3664 name: 'toggleshow',
3665
3666 self: true,
3667
3668 handler(e, toggle) {
3669 e.preventDefault();
3670 this.show(toggle.$el);
3671 } },
3672
3673
3674 {
3675 name: 'togglehide',
3676
3677 self: true,
3678
3679 handler(e) {
3680 e.preventDefault();
3681 if (!matches(this.$el, ':focus,:hover')) {
3682 this.hide();
3683 }
3684 } },
3685
3686
3687 {
3688 name: pointerEnter + " focusin",
3689
3690 filter() {
3691 return includes(this.mode, 'hover');
3692 },
3693
3694 handler(e) {
3695 if (!isTouch(e)) {
3696 this.clearTimers();
3697 }
3698 } },
3699
3700
3701 {
3702 name: pointerLeave + " focusout",
3703
3704 filter() {
3705 return includes(this.mode, 'hover');
3706 },
3707
3708 handler(e) {
3709 if (!isTouch(e) && e.relatedTarget) {
3710 this.hide();
3711 }
3712 } },
3713
3714
3715 {
3716 name: 'toggled',
3717
3718 self: true,
3719
3720 handler(e, toggled) {
3721 if (!toggled) {
3722 return;
3723 }
3724
3725 this.clearTimers();
3726 this.position();
3727 } },
3728
3729
3730 {
3731 name: 'show',
3732
3733 self: true,
3734
3735 handler() {
3736 active$1 = this;
3737
3738 this.tracker.init();
3739
3740 for (const handler of [
3741 on(
3742 document,
3743 pointerDown,
3744 (_ref2) => {let { target } = _ref2;return (
3745 !within(target, this.$el) &&
3746 once(
3747 document,
3748 pointerUp + " " + pointerCancel + " scroll",
3749 (_ref3) => {let { defaultPrevented, type, target: newTarget } = _ref3;
3750 if (
3751 !defaultPrevented &&
3752 type === pointerUp &&
3753 target === newTarget &&
3754 !(this.target && within(target, this.target)))
3755 {
3756 this.hide(false);
3757 }
3758 },
3759 true));}),
3760
3761
3762
3763 on(document, 'keydown', (e) => {
3764 if (e.keyCode === 27) {
3765 this.hide(false);
3766 }
3767 }),
3768 on(window, 'resize', () => this.$emit('resize'))])
3769 {
3770 once(this.$el, 'hide', handler, { self: true });
3771 }
3772 } },
3773
3774
3775 {
3776 name: 'beforehide',
3777
3778 self: true,
3779
3780 handler() {
3781 this.clearTimers();
3782 } },
3783
3784
3785 {
3786 name: 'hide',
3787
3788 handler(_ref4) {let { target } = _ref4;
3789 if (this.$el !== target) {
3790 active$1 =
3791 active$1 === null && within(target, this.$el) && this.isToggled() ?
3792 this :
3793 active$1;
3794 return;
3795 }
3796
3797 active$1 = this.isActive() ? null : active$1;
3798 this.tracker.cancel();
3799 } }],
3800
3801
3802
3803 update: {
3804 write() {
3805 if (this.isToggled() && !hasClass(this.$el, this.clsEnter)) {
3806 this.position();
3807 }
3808 },
3809
3810 events: ['resize'] },
3811
3812
3813 methods: {
3814 show(target, delay) {if (target === void 0) {target = this.target;}if (delay === void 0) {delay = true;}
3815 if (this.isToggled() && target && this.target && target !== this.target) {
3816 this.hide(false);
3817 }
3818
3819 this.target = target;
3820
3821 this.clearTimers();
3822
3823 if (this.isActive()) {
3824 return;
3825 }
3826
3827 if (active$1) {
3828 if (delay && active$1.isDelaying) {
3829 this.showTimer = setTimeout(() => matches(target, ':hover') && this.show(), 10);
3830 return;
3831 }
3832
3833 let prev;
3834 while (active$1 && prev !== active$1 && !within(this.$el, active$1.$el)) {
3835 prev = active$1;
3836 active$1.hide(false);
3837 }
3838 }
3839
3840 if (this.container && parent(this.$el) !== this.container) {
3841 append(this.container, this.$el);
3842 }
3843
3844 this.showTimer = setTimeout(
3845 () => this.toggleElement(this.$el, true),
3846 delay && this.delayShow || 0);
3847
3848 },
3849
3850 hide(delay) {if (delay === void 0) {delay = true;}
3851 const hide = () => this.toggleElement(this.$el, false, false);
3852
3853 this.clearTimers();
3854
3855 this.isDelaying = getPositionedElements(this.$el).some((el) =>
3856 this.tracker.movesTo(el));
3857
3858
3859 if (delay && this.isDelaying) {
3860 this.hideTimer = setTimeout(this.hide, 50);
3861 } else if (delay && this.delayHide) {
3862 this.hideTimer = setTimeout(hide, this.delayHide);
3863 } else {
3864 hide();
3865 }
3866 },
3867
3868 clearTimers() {
3869 clearTimeout(this.showTimer);
3870 clearTimeout(this.hideTimer);
3871 this.showTimer = null;
3872 this.hideTimer = null;
3873 this.isDelaying = false;
3874 },
3875
3876 isActive() {
3877 return active$1 === this;
3878 },
3879
3880 position() {
3881 const boundary = this.boundary === true ? window : query(this.boundary, this.$el);
3882 removeClass(this.$el, this.clsDrop + "-stack");
3883 toggleClass(this.$el, this.clsDrop + "-boundary", this.boundaryAlign);
3884
3885 const boundaryOffset = offset(boundary);
3886 const alignTo = this.boundaryAlign ? boundaryOffset : offset(this.target);
3887
3888 if (this.align === 'justify') {
3889 const prop = this.getAxis() === 'y' ? 'width' : 'height';
3890 css(this.$el, prop, alignTo[prop]);
3891 } else if (
3892 boundary &&
3893 this.$el.offsetWidth >
3894 Math.max(
3895 boundaryOffset.right - alignTo.left,
3896 alignTo.right - boundaryOffset.left))
3897
3898 {
3899 addClass(this.$el, this.clsDrop + "-stack");
3900 }
3901
3902 this.positionAt(this.$el, this.boundaryAlign ? boundary : this.target, boundary);
3903 } } };
3904
3905
3906
3907 function getPositionedElements(el) {
3908 const result = [];
3909 apply(el, (el) => css(el, 'position') !== 'static' && result.push(el));
3910 return result;
3911 }
3912
3913 var formCustom = {
3914 mixins: [Class],
3915
3916 args: 'target',
3917
3918 props: {
3919 target: Boolean },
3920
3921
3922 data: {
3923 target: false },
3924
3925
3926 computed: {
3927 input(_, $el) {
3928 return $(selInput, $el);
3929 },
3930
3931 state() {
3932 return this.input.nextElementSibling;
3933 },
3934
3935 target(_ref, $el) {let { target } = _ref;
3936 return (
3937 target && (
3938 target === true && parent(this.input) === $el && this.input.nextElementSibling ||
3939 $(target, $el)));
3940
3941 } },
3942
3943
3944 update() {var _input$files;
3945 const { target, input } = this;
3946
3947 if (!target) {
3948 return;
3949 }
3950
3951 let option;
3952 const prop = isInput(target) ? 'value' : 'textContent';
3953 const prev = target[prop];
3954 const value = (_input$files = input.files) != null && _input$files[0] ?
3955 input.files[0].name :
3956 matches(input, 'select') && (
3957 option = $$('option', input).filter((el) => el.selected)[0]) // eslint-disable-line prefer-destructuring
3958 ? option.textContent :
3959 input.value;
3960
3961 if (prev !== value) {
3962 target[prop] = value;
3963 }
3964 },
3965
3966 events: [
3967 {
3968 name: 'change',
3969
3970 handler() {
3971 this.$emit();
3972 } },
3973
3974
3975 {
3976 name: 'reset',
3977
3978 el() {
3979 return closest(this.$el, 'form');
3980 },
3981
3982 handler() {
3983 this.$emit();
3984 } }] };
3985
3986 var Margin = {
3987 mixins: [Resize],
3988
3989 props: {
3990 margin: String,
3991 firstColumn: Boolean },
3992
3993
3994 data: {
3995 margin: 'bdt-margin-small-top',
3996 firstColumn: 'bdt-first-column' },
3997
3998
3999 resizeTargets() {
4000 return this.$el.children;
4001 },
4002
4003 connected() {
4004 this.registerObserver(
4005 observeMutation(this.$el, () => this.$reset(), {
4006 childList: true }));
4007
4008
4009 },
4010
4011 update: {
4012 read() {
4013 const rows = getRows(this.$el.children);
4014
4015 return {
4016 rows,
4017 columns: getColumns(rows) };
4018
4019 },
4020
4021 write(_ref) {let { columns, rows } = _ref;
4022 for (const row of rows) {
4023 for (const column of row) {
4024 toggleClass(column, this.margin, rows[0] !== row);
4025 toggleClass(column, this.firstColumn, !!~columns[0].indexOf(column));
4026 }
4027 }
4028 },
4029
4030 events: ['resize'] } };
4031
4032
4033
4034 function getRows(items) {
4035 return sortBy(items, 'top', 'bottom');
4036 }
4037
4038 function getColumns(rows) {
4039 const columns = [];
4040
4041 for (const row of rows) {
4042 const sorted = sortBy(row, 'left', 'right');
4043 for (let j = 0; j < sorted.length; j++) {
4044 columns[j] = columns[j] ? columns[j].concat(sorted[j]) : sorted[j];
4045 }
4046 }
4047
4048 return isRtl ? columns.reverse() : columns;
4049 }
4050
4051 function sortBy(items, startProp, endProp) {
4052 const sorted = [[]];
4053
4054 for (const el of items) {
4055 if (!isVisible(el)) {
4056 continue;
4057 }
4058
4059 let dim = getOffset(el);
4060
4061 for (let i = sorted.length - 1; i >= 0; i--) {
4062 const current = sorted[i];
4063
4064 if (!current[0]) {
4065 current.push(el);
4066 break;
4067 }
4068
4069 let startDim;
4070 if (current[0].offsetParent === el.offsetParent) {
4071 startDim = getOffset(current[0]);
4072 } else {
4073 dim = getOffset(el, true);
4074 startDim = getOffset(current[0], true);
4075 }
4076
4077 if (dim[startProp] >= startDim[endProp] - 1 && dim[startProp] !== startDim[startProp]) {
4078 sorted.push([el]);
4079 break;
4080 }
4081
4082 if (dim[endProp] - 1 > startDim[startProp] || dim[startProp] === startDim[startProp]) {
4083 current.push(el);
4084 break;
4085 }
4086
4087 if (i === 0) {
4088 sorted.unshift([el]);
4089 break;
4090 }
4091 }
4092 }
4093
4094 return sorted;
4095 }
4096
4097 function getOffset(element, offset) {if (offset === void 0) {offset = false;}
4098 let { offsetTop, offsetLeft, offsetHeight, offsetWidth } = element;
4099
4100 if (offset) {
4101 [offsetTop, offsetLeft] = offsetPosition(element);
4102 }
4103
4104 return {
4105 top: offsetTop,
4106 left: offsetLeft,
4107 bottom: offsetTop + offsetHeight,
4108 right: offsetLeft + offsetWidth };
4109
4110 }
4111
4112 var Scroll = {
4113 connected() {
4114 registerScrollListener(this._uid, () => this.$emit('scroll'));
4115 },
4116
4117 disconnected() {
4118 unregisterScrollListener(this._uid);
4119 } };
4120
4121
4122 const scrollListeners = new Map();
4123 let unbindScrollListener;
4124 function registerScrollListener(id, listener) {
4125 unbindScrollListener =
4126 unbindScrollListener ||
4127 on(window, 'scroll', () => scrollListeners.forEach((listener) => listener()), {
4128 passive: true,
4129 capture: true });
4130
4131
4132 scrollListeners.set(id, listener);
4133 }
4134
4135 function unregisterScrollListener(id) {
4136 scrollListeners.delete(id);
4137 if (unbindScrollListener && !scrollListeners.size) {
4138 unbindScrollListener();
4139 unbindScrollListener = null;
4140 }
4141 }
4142
4143 var grid = {
4144 extends: Margin,
4145
4146 mixins: [Class, Scroll],
4147
4148 name: 'grid',
4149
4150 props: {
4151 masonry: Boolean,
4152 parallax: Number },
4153
4154
4155 data: {
4156 margin: 'bdt-grid-margin',
4157 clsStack: 'bdt-grid-stack',
4158 masonry: false,
4159 parallax: 0 },
4160
4161
4162 connected() {
4163 this.masonry && addClass(this.$el, 'bdt-flex-top bdt-flex-wrap-top');
4164 },
4165
4166 update: [
4167 {
4168 write(_ref) {let { columns } = _ref;
4169 toggleClass(this.$el, this.clsStack, columns.length < 2);
4170 },
4171
4172 events: ['resize'] },
4173
4174
4175 {
4176 read(data) {
4177 let { columns, rows } = data;
4178
4179 // Filter component makes elements positioned absolute
4180 if (
4181 !columns.length ||
4182 !this.masonry && !this.parallax ||
4183 positionedAbsolute(this.$el))
4184 {
4185 data.translates = false;
4186 return false;
4187 }
4188
4189 let translates = false;
4190
4191 const nodes = children(this.$el);
4192 const columnHeights = getColumnHeights(columns);
4193 const margin = getMarginTop(nodes, this.margin) * (rows.length - 1);
4194 const elHeight = Math.max(...columnHeights) + margin;
4195
4196 if (this.masonry) {
4197 columns = columns.map((column) => sortBy$1(column, 'offsetTop'));
4198 translates = getTranslates(rows, columns);
4199 }
4200
4201 let padding = Math.abs(this.parallax);
4202 if (padding) {
4203 padding = columnHeights.reduce(
4204 (newPadding, hgt, i) =>
4205 Math.max(
4206 newPadding,
4207 hgt + margin + (i % 2 ? padding : padding / 8) - elHeight),
4208
4209 0);
4210
4211 }
4212
4213 return { padding, columns, translates, height: translates ? elHeight : '' };
4214 },
4215
4216 write(_ref2) {let { height, padding } = _ref2;
4217 css(this.$el, 'paddingBottom', padding || '');
4218 height !== false && css(this.$el, 'height', height);
4219 },
4220
4221 events: ['resize'] },
4222
4223
4224 {
4225 read() {
4226 if (this.parallax && positionedAbsolute(this.$el)) {
4227 return false;
4228 }
4229
4230 return {
4231 scrolled: this.parallax ?
4232 scrolledOver(this.$el) * Math.abs(this.parallax) :
4233 false };
4234
4235 },
4236
4237 write(_ref3) {let { columns, scrolled, translates } = _ref3;
4238 if (scrolled === false && !translates) {
4239 return;
4240 }
4241
4242 columns.forEach((column, i) =>
4243 column.forEach((el, j) =>
4244 css(
4245 el,
4246 'transform',
4247 !scrolled && !translates ?
4248 '' : "translateY(" + (
4249
4250 (translates && -translates[i][j]) + (
4251 scrolled ? i % 2 ? scrolled : scrolled / 8 : 0)) + "px)")));
4252
4253
4254
4255
4256 },
4257
4258 events: ['scroll', 'resize'] }] };
4259
4260
4261
4262
4263 function positionedAbsolute(el) {
4264 return children(el).some((el) => css(el, 'position') === 'absolute');
4265 }
4266
4267 function getTranslates(rows, columns) {
4268 const rowHeights = rows.map((row) => Math.max(...row.map((el) => el.offsetHeight)));
4269
4270 return columns.map((elements) => {
4271 let prev = 0;
4272 return elements.map(
4273 (element, row) =>
4274 prev += row ? rowHeights[row - 1] - elements[row - 1].offsetHeight : 0);
4275
4276 });
4277 }
4278
4279 function getMarginTop(nodes, cls) {
4280 const [node] = nodes.filter((el) => hasClass(el, cls));
4281
4282 return toFloat(node ? css(node, 'marginTop') : css(nodes[0], 'paddingLeft'));
4283 }
4284
4285 function getColumnHeights(columns) {
4286 return columns.map((column) => column.reduce((sum, el) => sum + el.offsetHeight, 0));
4287 }
4288
4289 var heightMatch = {
4290 args: 'target',
4291
4292 props: {
4293 target: String,
4294 row: Boolean },
4295
4296
4297 data: {
4298 target: '> *',
4299 row: true,
4300 forceHeight: true },
4301
4302
4303 computed: {
4304 elements: {
4305 get(_ref, $el) {let { target } = _ref;
4306 return $$(target, $el);
4307 },
4308
4309 watch() {
4310 this.$reset();
4311 } } },
4312
4313
4314
4315 resizeTargets() {
4316 return this.elements;
4317 },
4318
4319 update: {
4320 read() {
4321 return {
4322 rows: (this.row ? getRows(this.elements) : [this.elements]).map(match$1) };
4323
4324 },
4325
4326 write(_ref2) {let { rows } = _ref2;
4327 for (const { heights, elements } of rows) {
4328 elements.forEach((el, i) => css(el, 'minHeight', heights[i]));
4329 }
4330 },
4331
4332 events: ['resize'] } };
4333
4334
4335
4336 function match$1(elements) {
4337 if (elements.length < 2) {
4338 return { heights: [''], elements };
4339 }
4340
4341 let heights = elements.map(getHeight);
4342 let max = Math.max(...heights);
4343 const hasMinHeight = elements.some((el) => el.style.minHeight);
4344 const hasShrunk = elements.some((el, i) => !el.style.minHeight && heights[i] < max);
4345
4346 if (hasMinHeight && hasShrunk) {
4347 css(elements, 'minHeight', '');
4348 heights = elements.map(getHeight);
4349 max = Math.max(...heights);
4350 }
4351
4352 heights = elements.map((el, i) =>
4353 heights[i] === max && toFloat(el.style.minHeight).toFixed(2) !== max.toFixed(2) ? '' : max);
4354
4355
4356 return { heights, elements };
4357 }
4358
4359 function getHeight(element) {
4360 let style = false;
4361 if (!isVisible(element)) {
4362 style = element.style.display;
4363 css(element, 'display', 'block', 'important');
4364 }
4365
4366 const height = dimensions$1(element).height - boxModelAdjust(element, 'height', 'content-box');
4367
4368 if (style !== false) {
4369 css(element, 'display', style);
4370 }
4371
4372 return height;
4373 }
4374
4375 var heightViewport = {
4376 mixins: [Class, Resize],
4377
4378 props: {
4379 expand: Boolean,
4380 offsetTop: Boolean,
4381 offsetBottom: Boolean,
4382 minHeight: Number },
4383
4384
4385 data: {
4386 expand: false,
4387 offsetTop: false,
4388 offsetBottom: false,
4389 minHeight: 0 },
4390
4391
4392 resizeTargets() {
4393 // check for offsetTop change
4394 return [this.$el, document.documentElement];
4395 },
4396
4397 update: {
4398 read(_ref) {let { minHeight: prev } = _ref;
4399 if (!isVisible(this.$el)) {
4400 return false;
4401 }
4402
4403 let minHeight = '';
4404 const box = boxModelAdjust(this.$el, 'height', 'content-box');
4405
4406 if (this.expand) {
4407 minHeight =
4408 height(window) - (
4409 dimensions$1(document.documentElement).height -
4410 dimensions$1(this.$el).height) -
4411 box || '';
4412 } else {
4413 // on mobile devices (iOS and Android) window.innerHeight !== 100vh
4414 minHeight = 'calc(100vh';
4415
4416 if (this.offsetTop) {
4417 const { top } = offset(this.$el);
4418 minHeight += top > 0 && top < height(window) / 2 ? " - " + top + "px" : '';
4419 }
4420
4421 if (this.offsetBottom === true) {
4422 minHeight += " - " + dimensions$1(this.$el.nextElementSibling).height + "px";
4423 } else if (isNumeric(this.offsetBottom)) {
4424 minHeight += " - " + this.offsetBottom + "vh";
4425 } else if (this.offsetBottom && endsWith(this.offsetBottom, 'px')) {
4426 minHeight += " - " + toFloat(this.offsetBottom) + "px";
4427 } else if (isString(this.offsetBottom)) {
4428 minHeight += " - " + dimensions$1(query(this.offsetBottom, this.$el)).height + "px";
4429 }
4430
4431 minHeight += (box ? " - " + box + "px" : '') + ")";
4432 }
4433
4434 return { minHeight, prev };
4435 },
4436
4437 write(_ref2) {let { minHeight } = _ref2;
4438 css(this.$el, { minHeight });
4439
4440 if (this.minHeight && toFloat(css(this.$el, 'minHeight')) < this.minHeight) {
4441 css(this.$el, 'minHeight', this.minHeight);
4442 }
4443 },
4444
4445 events: ['resize'] } };
4446
4447 var SVG = {
4448 args: 'src',
4449
4450 props: {
4451 id: Boolean,
4452 icon: String,
4453 src: String,
4454 style: String,
4455 width: Number,
4456 height: Number,
4457 ratio: Number,
4458 class: String,
4459 strokeAnimation: Boolean,
4460 focusable: Boolean, // IE 11
4461 attributes: 'list' },
4462
4463
4464 data: {
4465 ratio: 1,
4466 include: ['style', 'class', 'focusable'],
4467 class: '',
4468 strokeAnimation: false },
4469
4470
4471 beforeConnect() {
4472 this.class += ' bdt-svg';
4473 },
4474
4475 connected() {
4476 if (!this.icon && includes(this.src, '#')) {
4477 [this.src, this.icon] = this.src.split('#');
4478 }
4479
4480 this.svg = this.getSvg().then((el) => {
4481 if (this._connected) {
4482 const svg = insertSVG(el, this.$el);
4483
4484 if (this.svgEl && svg !== this.svgEl) {
4485 remove$1(this.svgEl);
4486 }
4487
4488 this.applyAttributes(svg, el);
4489
4490 return this.svgEl = svg;
4491 }
4492 }, noop);
4493
4494 if (this.strokeAnimation) {
4495 this.svg.then((el) => {
4496 if (this._connected) {
4497 applyAnimation(el);
4498 this.registerObserver(
4499 observeIntersection(el, (records, observer) => {
4500 applyAnimation(el);
4501 observer.disconnect();
4502 }));
4503
4504 }
4505 });
4506 }
4507 },
4508
4509 disconnected() {
4510 this.svg.then((svg) => {
4511 if (this._connected) {
4512 return;
4513 }
4514
4515 if (isVoidElement(this.$el)) {
4516 this.$el.hidden = false;
4517 }
4518
4519 remove$1(svg);
4520 this.svgEl = null;
4521 });
4522
4523 this.svg = null;
4524 },
4525
4526 methods: {
4527 async getSvg() {
4528 if (isTag(this.$el, 'img') && !this.$el.complete && this.$el.loading === 'lazy') {
4529 return new Promise((resolve) =>
4530 once(this.$el, 'load', () => resolve(this.getSvg())));
4531
4532 }
4533
4534 return parseSVG(await loadSVG(this.src), this.icon) || Promise.reject('SVG not found.');
4535 },
4536
4537 applyAttributes(el, ref) {
4538 for (const prop in this.$options.props) {
4539 if (includes(this.include, prop) && prop in this) {
4540 attr(el, prop, this[prop]);
4541 }
4542 }
4543
4544 for (const attribute in this.attributes) {
4545 const [prop, value] = this.attributes[attribute].split(':', 2);
4546 attr(el, prop, value);
4547 }
4548
4549 if (!this.id) {
4550 removeAttr(el, 'id');
4551 }
4552
4553 const props = ['width', 'height'];
4554 let dimensions = props.map((prop) => this[prop]);
4555
4556 if (!dimensions.some((val) => val)) {
4557 dimensions = props.map((prop) => attr(ref, prop));
4558 }
4559
4560 const viewBox = attr(ref, 'viewBox');
4561 if (viewBox && !dimensions.some((val) => val)) {
4562 dimensions = viewBox.split(' ').slice(2);
4563 }
4564
4565 dimensions.forEach((val, i) => attr(el, props[i], toFloat(val) * this.ratio || null));
4566 } } };
4567
4568
4569
4570 const loadSVG = memoize(async (src) => {
4571 if (src) {
4572 if (startsWith(src, 'data:')) {
4573 return decodeURIComponent(src.split(',')[1]);
4574 } else {
4575 return (await fetch(src)).text();
4576 }
4577 } else {
4578 return Promise.reject();
4579 }
4580 });
4581
4582 function parseSVG(svg, icon) {var _svg;
4583 if (icon && includes(svg, '<symbol')) {
4584 svg = parseSymbols(svg, icon) || svg;
4585 }
4586
4587 svg = $(svg.substr(svg.indexOf('<svg')));
4588 return ((_svg = svg) == null ? void 0 : _svg.hasChildNodes()) && svg;
4589 }
4590
4591 const symbolRe = /<symbol([^]*?id=(['"])(.+?)\2[^]*?<\/)symbol>/g;
4592 const symbols = {};
4593
4594 function parseSymbols(svg, icon) {
4595 if (!symbols[svg]) {
4596 symbols[svg] = {};
4597
4598 symbolRe.lastIndex = 0;
4599
4600 let match;
4601 while (match = symbolRe.exec(svg)) {
4602 symbols[svg][match[3]] = "<svg xmlns=\"http://www.w3.org/2000/svg\"" + match[1] + "svg>";
4603 }
4604 }
4605
4606 return symbols[svg][icon];
4607 }
4608
4609 function applyAnimation(el) {
4610 const length = getMaxPathLength(el);
4611
4612 if (length) {
4613 el.style.setProperty('--bdt-animation-stroke', length);
4614 }
4615 }
4616
4617 function getMaxPathLength(el) {
4618 return Math.ceil(
4619 Math.max(
4620 0,
4621 ...$$('[stroke]', el).map((stroke) => {
4622 try {
4623 return stroke.getTotalLength();
4624 } catch (e) {
4625 return 0;
4626 }
4627 })));
4628
4629
4630 }
4631
4632 function insertSVG(el, root) {
4633 if (isVoidElement(root) || isTag(root, 'canvas')) {
4634 root.hidden = true;
4635
4636 const next = root.nextElementSibling;
4637 return equals(el, next) ? next : after(root, el);
4638 }
4639
4640 const last = root.lastElementChild;
4641 return equals(el, last) ? last : append(root, el);
4642 }
4643
4644 function equals(el, other) {
4645 return isTag(el, 'svg') && isTag(other, 'svg') && innerHTML(el) === innerHTML(other);
4646 }
4647
4648 function innerHTML(el) {
4649 return (
4650 el.innerHTML ||
4651 new XMLSerializer().serializeToString(el).replace(/<svg.*?>(.*?)<\/svg>/g, '$1')).
4652 replace(/\s/g, '');
4653 }
4654
4655 var closeIcon = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" xmlns=\"http://www.w3.org/2000/svg\"><line fill=\"none\" stroke=\"#000\" stroke-width=\"1.1\" x1=\"1\" y1=\"1\" x2=\"13\" y2=\"13\"/><line fill=\"none\" stroke=\"#000\" stroke-width=\"1.1\" x1=\"13\" y1=\"1\" x2=\"1\" y2=\"13\"/></svg>";
4656
4657 var closeLarge = "<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><line fill=\"none\" stroke=\"#000\" stroke-width=\"1.4\" x1=\"1\" y1=\"1\" x2=\"19\" y2=\"19\"/><line fill=\"none\" stroke=\"#000\" stroke-width=\"1.4\" x1=\"19\" y1=\"1\" x2=\"1\" y2=\"19\"/></svg>";
4658
4659 var marker = "<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><rect x=\"9\" y=\"4\" width=\"1\" height=\"11\"/><rect x=\"4\" y=\"9\" width=\"11\" height=\"1\"/></svg>";
4660
4661 var navbarToggleIcon = "<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><rect y=\"9\" width=\"20\" height=\"2\"/><rect y=\"3\" width=\"20\" height=\"2\"/><rect y=\"15\" width=\"20\" height=\"2\"/></svg>";
4662
4663 var overlayIcon = "<svg width=\"40\" height=\"40\" viewBox=\"0 0 40 40\" xmlns=\"http://www.w3.org/2000/svg\"><rect x=\"19\" y=\"0\" width=\"1\" height=\"40\"/><rect x=\"0\" y=\"19\" width=\"40\" height=\"1\"/></svg>";
4664
4665 var paginationNext = "<svg width=\"7\" height=\"12\" viewBox=\"0 0 7 12\" xmlns=\"http://www.w3.org/2000/svg\"><polyline fill=\"none\" stroke=\"#000\" stroke-width=\"1.2\" points=\"1 1 6 6 1 11\"/></svg>";
4666
4667 var paginationPrevious = "<svg width=\"7\" height=\"12\" viewBox=\"0 0 7 12\" xmlns=\"http://www.w3.org/2000/svg\"><polyline fill=\"none\" stroke=\"#000\" stroke-width=\"1.2\" points=\"6 1 1 6 6 11\"/></svg>";
4668
4669 var searchIcon = "<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" xmlns=\"http://www.w3.org/2000/svg\"><circle fill=\"none\" stroke=\"#000\" stroke-width=\"1.1\" cx=\"9\" cy=\"9\" r=\"7\"/><path fill=\"none\" stroke=\"#000\" stroke-width=\"1.1\" d=\"M14,14 L18,18 L14,14 Z\"/></svg>";
4670
4671 var searchLarge = "<svg width=\"40\" height=\"40\" viewBox=\"0 0 40 40\" xmlns=\"http://www.w3.org/2000/svg\"><circle fill=\"none\" stroke=\"#000\" stroke-width=\"1.8\" cx=\"17.5\" cy=\"17.5\" r=\"16.5\"/><line fill=\"none\" stroke=\"#000\" stroke-width=\"1.8\" x1=\"38\" y1=\"39\" x2=\"29\" y2=\"30\"/></svg>";
4672
4673 var searchNavbar = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><circle fill=\"none\" stroke=\"#000\" stroke-width=\"1.1\" cx=\"10.5\" cy=\"10.5\" r=\"9.5\"/><line fill=\"none\" stroke=\"#000\" stroke-width=\"1.1\" x1=\"23\" y1=\"23\" x2=\"17\" y2=\"17\"/></svg>";
4674
4675 var slidenavNext = "<svg width=\"14\" height=\"24\" viewBox=\"0 0 14 24\" xmlns=\"http://www.w3.org/2000/svg\"><polyline fill=\"none\" stroke=\"#000\" stroke-width=\"1.4\" points=\"1.225,23 12.775,12 1.225,1 \"/></svg>";
4676
4677 var slidenavNextLarge = "<svg width=\"25\" height=\"40\" viewBox=\"0 0 25 40\" xmlns=\"http://www.w3.org/2000/svg\"><polyline fill=\"none\" stroke=\"#000\" stroke-width=\"2\" points=\"4.002,38.547 22.527,20.024 4,1.5 \"/></svg>";
4678
4679 var slidenavPrevious = "<svg width=\"14\" height=\"24\" viewBox=\"0 0 14 24\" xmlns=\"http://www.w3.org/2000/svg\"><polyline fill=\"none\" stroke=\"#000\" stroke-width=\"1.4\" points=\"12.775,1 1.225,12 12.775,23 \"/></svg>";
4680
4681 var slidenavPreviousLarge = "<svg width=\"25\" height=\"40\" viewBox=\"0 0 25 40\" xmlns=\"http://www.w3.org/2000/svg\"><polyline fill=\"none\" stroke=\"#000\" stroke-width=\"2\" points=\"20.527,1.5 2,20.024 20.525,38.547 \"/></svg>";
4682
4683 var spinner = "<svg width=\"30\" height=\"30\" viewBox=\"0 0 30 30\" xmlns=\"http://www.w3.org/2000/svg\"><circle fill=\"none\" stroke=\"#000\" cx=\"15\" cy=\"15\" r=\"14\"/></svg>";
4684
4685 var totop = "<svg width=\"18\" height=\"10\" viewBox=\"0 0 18 10\" xmlns=\"http://www.w3.org/2000/svg\"><polyline fill=\"none\" stroke=\"#000\" stroke-width=\"1.2\" points=\"1 9 9 1 17 9 \"/></svg>";
4686
4687 const icons = {
4688 spinner,
4689 totop,
4690 marker,
4691 'close-icon': closeIcon,
4692 'close-large': closeLarge,
4693 'navbar-toggle-icon': navbarToggleIcon,
4694 'overlay-icon': overlayIcon,
4695 'pagination-next': paginationNext,
4696 'pagination-previous': paginationPrevious,
4697 'search-icon': searchIcon,
4698 'search-large': searchLarge,
4699 'search-navbar': searchNavbar,
4700 'slidenav-next': slidenavNext,
4701 'slidenav-next-large': slidenavNextLarge,
4702 'slidenav-previous': slidenavPrevious,
4703 'slidenav-previous-large': slidenavPreviousLarge };
4704
4705
4706 const Icon = {
4707 install: install$3,
4708
4709 extends: SVG,
4710
4711 args: 'icon',
4712
4713 props: ['icon'],
4714
4715 data: {
4716 include: ['focusable'] },
4717
4718
4719 isIcon: true,
4720
4721 beforeConnect() {
4722 addClass(this.$el, 'bdt-icon');
4723 },
4724
4725 methods: {
4726 async getSvg() {
4727 const icon = getIcon(this.icon);
4728
4729 if (!icon) {
4730 throw 'Icon not found.';
4731 }
4732
4733 return icon;
4734 } } };
4735
4736 const IconComponent = {
4737 args: false,
4738
4739 extends: Icon,
4740
4741 data: (vm) => ({
4742 icon: hyphenate(vm.constructor.options.name) }),
4743
4744
4745 beforeConnect() {
4746 addClass(this.$el, this.$name);
4747 } };
4748
4749
4750 const Slidenav = {
4751 extends: IconComponent,
4752
4753 beforeConnect() {
4754 addClass(this.$el, 'bdt-slidenav');
4755 const icon = this.$props.icon;
4756 this.icon = hasClass(this.$el, 'bdt-slidenav-large') ? icon + "-large" : icon;
4757 } };
4758
4759
4760 const Search = {
4761 extends: IconComponent,
4762
4763 beforeConnect() {
4764 this.icon =
4765 hasClass(this.$el, 'bdt-search-icon') && parents(this.$el, '.bdt-search-large').length ?
4766 'search-large' :
4767 parents(this.$el, '.bdt-search-navbar').length ?
4768 'search-navbar' :
4769 this.$props.icon;
4770 } };
4771
4772
4773 const Close = {
4774 extends: IconComponent,
4775
4776 beforeConnect() {
4777 this.icon = "close-" + (hasClass(this.$el, 'bdt-close-large') ? 'large' : 'icon');
4778 } };
4779
4780
4781 const Spinner = {
4782 extends: IconComponent,
4783
4784 methods: {
4785 async getSvg() {
4786 const icon = await Icon.methods.getSvg.call(this);
4787
4788 if (this.ratio !== 1) {
4789 css($('circle', icon), 'strokeWidth', 1 / this.ratio);
4790 }
4791
4792 return icon;
4793 } } };
4794
4795
4796
4797 const parsed = {};
4798 function install$3(bdtUIkit) {
4799 bdtUIkit.icon.add = (name, svg) => {
4800 const added = isString(name) ? { [name]: svg } : name;
4801 each(added, (svg, name) => {
4802 icons[name] = svg;
4803 delete parsed[name];
4804 });
4805
4806 if (bdtUIkit._initialized) {
4807 apply(document.body, (el) =>
4808 each(bdtUIkit.getComponents(el), (cmp) => {
4809 cmp.$options.isIcon && cmp.icon in added && cmp.$reset();
4810 }));
4811
4812 }
4813 };
4814 }
4815
4816 function getIcon(icon) {
4817 if (!icons[icon]) {
4818 return null;
4819 }
4820
4821 if (!parsed[icon]) {
4822 parsed[icon] = $((icons[applyRtl(icon)] || icons[icon]).trim());
4823 }
4824
4825 return parsed[icon].cloneNode(true);
4826 }
4827
4828 function applyRtl(icon) {
4829 return isRtl ? swap(swap(icon, 'left', 'right'), 'previous', 'next') : icon;
4830 }
4831
4832 const nativeLazyLoad = ('loading' in HTMLImageElement.prototype);
4833
4834 var img = {
4835 args: 'dataSrc',
4836
4837 props: {
4838 dataSrc: String,
4839 sources: String,
4840 offsetTop: String,
4841 offsetLeft: String,
4842 target: String,
4843 loading: String },
4844
4845
4846 data: {
4847 dataSrc: '',
4848 sources: false,
4849 offsetTop: '50vh',
4850 offsetLeft: '50vw',
4851 target: false,
4852 loading: 'lazy' },
4853
4854
4855 connected() {
4856 if (this.loading !== 'lazy') {
4857 this.load();
4858 return;
4859 }
4860
4861 const target = [this.$el, ...queryAll(this.$props.target, this.$el)];
4862
4863 if (nativeLazyLoad && isImg(this.$el)) {
4864 this.$el.loading = 'lazy';
4865 setSrcAttrs(this.$el);
4866
4867 if (target.length === 1) {
4868 return;
4869 }
4870 }
4871
4872 ensureSrcAttribute(this.$el);
4873
4874 this.registerObserver(
4875 observeIntersection(
4876 target,
4877 (entries, observer) => {
4878 this.load();
4879 observer.disconnect();
4880 },
4881 {
4882 rootMargin: toPx(this.offsetTop, 'height') + "px " + toPx(
4883 this.offsetLeft,
4884 'width') + "px" }));
4885
4886
4887
4888
4889 },
4890
4891 disconnected() {
4892 if (this._data.image) {
4893 this._data.image.onload = '';
4894 }
4895 },
4896
4897 update: {
4898 write(store) {
4899 if (!this.observer || isImg(this.$el)) {
4900 return false;
4901 }
4902
4903 const srcset = data(this.$el, 'data-srcset');
4904 if (srcset && window.devicePixelRatio !== 1) {
4905 const bgSize = css(this.$el, 'backgroundSize');
4906 if (bgSize.match(/^(auto\s?)+$/) || toFloat(bgSize) === store.bgSize) {
4907 store.bgSize = getSourceSize(srcset, data(this.$el, 'sizes'));
4908 css(this.$el, 'backgroundSize', store.bgSize + "px");
4909 }
4910 }
4911 },
4912
4913 events: ['resize'] },
4914
4915
4916 methods: {
4917 load() {
4918 if (this._data.image) {
4919 return this._data.image;
4920 }
4921
4922 const image = isImg(this.$el) ?
4923 this.$el :
4924 getImageFromElement(this.$el, this.dataSrc, this.sources);
4925
4926 removeAttr(image, 'loading');
4927 setSrcAttrs(this.$el, image.currentSrc);
4928 return this._data.image = image;
4929 } } };
4930
4931
4932
4933 function setSrcAttrs(el, src) {
4934 if (isImg(el)) {
4935 const parentNode = parent(el);
4936 const elements = isPicture(parentNode) ? children(parentNode) : [el];
4937 elements.forEach((el) => setSourceProps(el, el));
4938 } else if (src) {
4939 const change = !includes(el.style.backgroundImage, src);
4940 if (change) {
4941 css(el, 'backgroundImage', "url(" + escape(src) + ")");
4942 trigger(el, createEvent('load', false));
4943 }
4944 }
4945 }
4946
4947 const srcProps = ['data-src', 'data-srcset', 'sizes'];
4948 function setSourceProps(sourceEl, targetEl) {
4949 srcProps.forEach((prop) => {
4950 const value = data(sourceEl, prop);
4951 if (value) {
4952 attr(targetEl, prop.replace(/^(data-)+/, ''), value);
4953 }
4954 });
4955 }
4956
4957 function getImageFromElement(el, src, sources) {
4958 const img = new Image();
4959
4960 wrapInPicture(img, sources);
4961 setSourceProps(el, img);
4962 img.onload = () => {
4963 setSrcAttrs(el, img.currentSrc);
4964 };
4965 attr(img, 'src', src);
4966 return img;
4967 }
4968
4969 function wrapInPicture(img, sources) {
4970 sources = parseSources(sources);
4971
4972 if (sources.length) {
4973 const picture = fragment('<picture>');
4974 for (const attrs of sources) {
4975 const source = fragment('<source>');
4976 attr(source, attrs);
4977 append(picture, source);
4978 }
4979 append(picture, img);
4980 }
4981 }
4982
4983 function parseSources(sources) {
4984 if (!sources) {
4985 return [];
4986 }
4987
4988 if (startsWith(sources, '[')) {
4989 try {
4990 sources = JSON.parse(sources);
4991 } catch (e) {
4992 sources = [];
4993 }
4994 } else {
4995 sources = parseOptions(sources);
4996 }
4997
4998 if (!isArray(sources)) {
4999 sources = [sources];
5000 }
5001
5002 return sources.filter((source) => !isEmpty(source));
5003 }
5004
5005 const sizesRe = /\s*(.*?)\s*(\w+|calc\(.*?\))\s*(?:,|$)/g;
5006 function sizesToPixel(sizes) {
5007 let matches;
5008
5009 sizesRe.lastIndex = 0;
5010
5011 while (matches = sizesRe.exec(sizes)) {
5012 if (!matches[1] || window.matchMedia(matches[1]).matches) {
5013 matches = evaluateSize(matches[2]);
5014 break;
5015 }
5016 }
5017
5018 return matches || '100vw';
5019 }
5020
5021 const sizeRe = /\d+(?:\w+|%)/g;
5022 const additionRe = /[+-]?(\d+)/g;
5023 function evaluateSize(size) {
5024 return startsWith(size, 'calc') ?
5025 size.
5026 slice(5, -1).
5027 replace(sizeRe, (size) => toPx(size)).
5028 replace(/ /g, '').
5029 match(additionRe).
5030 reduce((a, b) => a + +b, 0) :
5031 size;
5032 }
5033
5034 const srcSetRe = /\s+\d+w\s*(?:,|$)/g;
5035 function getSourceSize(srcset, sizes) {
5036 const srcSize = toPx(sizesToPixel(sizes));
5037 const descriptors = (srcset.match(srcSetRe) || []).map(toFloat).sort((a, b) => a - b);
5038
5039 return descriptors.filter((size) => size >= srcSize)[0] || descriptors.pop() || '';
5040 }
5041
5042 function ensureSrcAttribute(el) {
5043 if (isImg(el) && !hasAttr(el, 'src')) {
5044 attr(el, 'src', 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg"></svg>');
5045 }
5046 }
5047
5048 function isPicture(el) {
5049 return isTag(el, 'picture');
5050 }
5051
5052 function isImg(el) {
5053 return isTag(el, 'img');
5054 }
5055
5056 var Media = {
5057 props: {
5058 media: Boolean },
5059
5060
5061 data: {
5062 media: false },
5063
5064
5065 connected() {
5066 const media = toMedia(this.media);
5067 this.mediaObj = window.matchMedia(media);
5068 const handler = () => {
5069 this.matchMedia = this.mediaObj.matches;
5070 trigger(this.$el, createEvent('mediachange', false, true, [this.mediaObj]));
5071 };
5072 this.offMediaObj = on(this.mediaObj, 'change', () => {
5073 handler();
5074 this.$emit('resize');
5075 });
5076 handler();
5077 },
5078
5079 disconnected() {var _this$offMediaObj;
5080 (_this$offMediaObj = this.offMediaObj) == null ? void 0 : _this$offMediaObj.call(this);
5081 } };
5082
5083
5084 function toMedia(value) {
5085 if (isString(value)) {
5086 if (startsWith(value, '@')) {
5087 const name = "breakpoint-" + value.substr(1);
5088 value = toFloat(getCssVar(name));
5089 } else if (isNaN(value)) {
5090 return value;
5091 }
5092 }
5093
5094 return value && isNumeric(value) ? "(min-width: " + value + "px)" : '';
5095 }
5096
5097 var leader = {
5098 mixins: [Class, Media, Resize],
5099
5100 props: {
5101 fill: String },
5102
5103
5104 data: {
5105 fill: '',
5106 clsWrapper: 'bdt-leader-fill',
5107 clsHide: 'bdt-leader-hide',
5108 attrFill: 'data-fill' },
5109
5110
5111 computed: {
5112 fill(_ref) {let { fill } = _ref;
5113 return fill || getCssVar('leader-fill-content');
5114 } },
5115
5116
5117 connected() {
5118 [this.wrapper] = wrapInner(this.$el, "<span class=\"" + this.clsWrapper + "\">");
5119 },
5120
5121 disconnected() {
5122 unwrap(this.wrapper.childNodes);
5123 },
5124
5125 update: {
5126 read() {
5127 const width = Math.trunc(this.$el.offsetWidth / 2);
5128
5129 return {
5130 width,
5131 fill: this.fill,
5132 hide: !this.matchMedia };
5133
5134 },
5135
5136 write(_ref2) {let { width, fill, hide } = _ref2;
5137 toggleClass(this.wrapper, this.clsHide, hide);
5138 attr(this.wrapper, this.attrFill, new Array(width).join(fill));
5139 },
5140
5141 events: ['resize'] } };
5142
5143 const active = [];
5144
5145 var Modal = {
5146 mixins: [Class, Container, Togglable],
5147
5148 props: {
5149 selPanel: String,
5150 selClose: String,
5151 escClose: Boolean,
5152 bgClose: Boolean,
5153 stack: Boolean },
5154
5155
5156 data: {
5157 cls: 'bdt-open',
5158 escClose: true,
5159 bgClose: true,
5160 overlay: true,
5161 stack: false },
5162
5163
5164 computed: {
5165 panel(_ref, $el) {let { selPanel } = _ref;
5166 return $(selPanel, $el);
5167 },
5168
5169 transitionElement() {
5170 return this.panel;
5171 },
5172
5173 bgClose(_ref2) {let { bgClose } = _ref2;
5174 return bgClose && this.panel;
5175 } },
5176
5177
5178 beforeDisconnect() {
5179 if (includes(active, this)) {
5180 this.toggleElement(this.$el, false, false);
5181 }
5182 },
5183
5184 events: [
5185 {
5186 name: 'click',
5187
5188 delegate() {
5189 return this.selClose;
5190 },
5191
5192 handler(e) {
5193 e.preventDefault();
5194 this.hide();
5195 } },
5196
5197
5198 {
5199 name: 'toggle',
5200
5201 self: true,
5202
5203 handler(e) {
5204 if (e.defaultPrevented) {
5205 return;
5206 }
5207
5208 e.preventDefault();
5209
5210 if (this.isToggled() === includes(active, this)) {
5211 this.toggle();
5212 }
5213 } },
5214
5215
5216 {
5217 name: 'beforeshow',
5218
5219 self: true,
5220
5221 handler(e) {
5222 if (includes(active, this)) {
5223 return false;
5224 }
5225
5226 if (!this.stack && active.length) {
5227 Promise.all(active.map((modal) => modal.hide())).then(this.show);
5228 e.preventDefault();
5229 } else {
5230 active.push(this);
5231 }
5232 } },
5233
5234
5235 {
5236 name: 'show',
5237
5238 self: true,
5239
5240 handler() {
5241 const docEl = document.documentElement;
5242
5243 if (width(window) > docEl.clientWidth && this.overlay) {
5244 css(document.body, 'overflowY', 'scroll');
5245 }
5246
5247 if (this.stack) {
5248 css(this.$el, 'zIndex', toFloat(css(this.$el, 'zIndex')) + active.length);
5249 }
5250
5251 addClass(docEl, this.clsPage);
5252
5253 if (this.bgClose) {
5254 once(
5255 this.$el,
5256 'hide',
5257 on(document, pointerDown, (_ref3) => {let { target } = _ref3;
5258 if (
5259 last(active) !== this ||
5260 this.overlay && !within(target, this.$el) ||
5261 within(target, this.panel))
5262 {
5263 return;
5264 }
5265
5266 once(
5267 document,
5268 pointerUp + " " + pointerCancel + " scroll",
5269 (_ref4) => {let { defaultPrevented, type, target: newTarget } = _ref4;
5270 if (
5271 !defaultPrevented &&
5272 type === pointerUp &&
5273 target === newTarget)
5274 {
5275 this.hide();
5276 }
5277 },
5278 true);
5279
5280 }),
5281 { self: true });
5282
5283 }
5284
5285 if (this.escClose) {
5286 once(
5287 this.$el,
5288 'hide',
5289 on(document, 'keydown', (e) => {
5290 if (e.keyCode === 27 && last(active) === this) {
5291 this.hide();
5292 }
5293 }),
5294 { self: true });
5295
5296 }
5297 } },
5298
5299
5300 {
5301 name: 'shown',
5302
5303 self: true,
5304
5305 handler() {
5306 if (!isFocusable(this.$el)) {
5307 attr(this.$el, 'tabindex', '-1');
5308 }
5309
5310 if (!$(':focus', this.$el)) {
5311 this.$el.focus();
5312 }
5313 } },
5314
5315
5316 {
5317 name: 'hidden',
5318
5319 self: true,
5320
5321 handler() {
5322 if (includes(active, this)) {
5323 active.splice(active.indexOf(this), 1);
5324 }
5325
5326 if (!active.length) {
5327 css(document.body, 'overflowY', '');
5328 }
5329
5330 css(this.$el, 'zIndex', '');
5331
5332 if (!active.some((modal) => modal.clsPage === this.clsPage)) {
5333 removeClass(document.documentElement, this.clsPage);
5334 }
5335 } }],
5336
5337
5338
5339 methods: {
5340 toggle() {
5341 return this.isToggled() ? this.hide() : this.show();
5342 },
5343
5344 show() {
5345 if (this.container && parent(this.$el) !== this.container) {
5346 append(this.container, this.$el);
5347 return new Promise((resolve) =>
5348 requestAnimationFrame(() => this.show().then(resolve)));
5349
5350 }
5351
5352 return this.toggleElement(this.$el, true, animate(this));
5353 },
5354
5355 hide() {
5356 return this.toggleElement(this.$el, false, animate(this));
5357 } } };
5358
5359
5360
5361 function animate(_ref5) {let { transitionElement, _toggle } = _ref5;
5362 return (el, show) =>
5363 new Promise((resolve, reject) =>
5364 once(el, 'show hide', () => {
5365 el._reject && el._reject();
5366 el._reject = reject;
5367
5368 _toggle(el, show);
5369
5370 const off = once(
5371 transitionElement,
5372 'transitionstart',
5373 () => {
5374 once(transitionElement, 'transitionend transitioncancel', resolve, {
5375 self: true });
5376
5377 clearTimeout(timer);
5378 },
5379 { self: true });
5380
5381
5382 const timer = setTimeout(() => {
5383 off();
5384 resolve();
5385 }, toMs(css(transitionElement, 'transitionDuration')));
5386 })).
5387 then(() => delete el._reject);
5388 }
5389
5390 var modal = {
5391 install: install$2,
5392
5393 mixins: [Modal],
5394
5395 data: {
5396 clsPage: 'bdt-modal-page',
5397 selPanel: '.bdt-modal-dialog',
5398 selClose:
5399 '.bdt-modal-close, .bdt-modal-close-default, .bdt-modal-close-outside, .bdt-modal-close-full' },
5400
5401
5402 events: [
5403 {
5404 name: 'show',
5405
5406 self: true,
5407
5408 handler() {
5409 if (hasClass(this.panel, 'bdt-margin-auto-vertical')) {
5410 addClass(this.$el, 'bdt-flex');
5411 } else {
5412 css(this.$el, 'display', 'block');
5413 }
5414
5415 height(this.$el); // force reflow
5416 } },
5417
5418
5419 {
5420 name: 'hidden',
5421
5422 self: true,
5423
5424 handler() {
5425 css(this.$el, 'display', '');
5426 removeClass(this.$el, 'bdt-flex');
5427 } }] };
5428
5429
5430
5431
5432 function install$2(_ref) {let { modal } = _ref;
5433 modal.dialog = function (content, options) {
5434 const dialog = modal("<div class=\"bdt-modal\"> <div class=\"bdt-modal-dialog\">" +
5435
5436 content + "</div> </div>",
5437
5438 options);
5439
5440
5441 dialog.show();
5442
5443 on(
5444 dialog.$el,
5445 'hidden',
5446 async () => {
5447 await Promise.resolve();
5448 dialog.$destroy(true);
5449 },
5450 { self: true });
5451
5452
5453 return dialog;
5454 };
5455
5456 modal.alert = function (message, options) {
5457 return openDialog(
5458 (_ref2) => {let { labels } = _ref2;return "<div class=\"bdt-modal-body\">" + (
5459 isString(message) ? message : html(message)) + "</div> <div class=\"bdt-modal-footer bdt-text-right\"> <button class=\"bdt-button bdt-button-primary bdt-modal-close\" autofocus>" +
5460
5461
5462
5463 labels.ok + "</button> </div>";},
5464
5465
5466 options,
5467 (deferred) => deferred.resolve());
5468
5469 };
5470
5471 modal.confirm = function (message, options) {
5472 return openDialog(
5473 (_ref3) => {let { labels } = _ref3;return "<form> <div class=\"bdt-modal-body\">" + (
5474 isString(message) ? message : html(message)) + "</div> <div class=\"bdt-modal-footer bdt-text-right\"> <button class=\"bdt-button bdt-button-default bdt-modal-close\" type=\"button\">" +
5475
5476
5477 labels.cancel + "</button> <button class=\"bdt-button bdt-button-primary\" autofocus>" +
5478
5479 labels.ok + "</button> </div> </form>";},
5480
5481
5482 options,
5483 (deferred) => deferred.reject());
5484
5485 };
5486
5487 modal.prompt = function (message, value, options) {
5488 return openDialog(
5489 (_ref4) => {let { labels } = _ref4;return "<form class=\"bdt-form-stacked\"> <div class=\"bdt-modal-body\"> <label>" + (
5490
5491 isString(message) ? message : html(message)) + "</label> <input class=\"bdt-input\" value=\"" + (
5492 value || '') + "\" autofocus> </div> <div class=\"bdt-modal-footer bdt-text-right\"> <button class=\"bdt-button bdt-button-default bdt-modal-close\" type=\"button\">" +
5493
5494
5495
5496 labels.cancel + "</button> <button class=\"bdt-button bdt-button-primary\">" +
5497
5498 labels.ok + "</button> </div> </form>";},
5499
5500
5501 options,
5502 (deferred) => deferred.resolve(null),
5503 (dialog) => $('input', dialog.$el).value);
5504
5505 };
5506
5507 modal.labels = {
5508 ok: 'Ok',
5509 cancel: 'Cancel' };
5510
5511
5512 function openDialog(tmpl, options, hideFn, submitFn) {
5513 options = { bgClose: false, escClose: true, labels: modal.labels, ...options };
5514
5515 const dialog = modal.dialog(tmpl(options), options);
5516 const deferred = new Deferred();
5517
5518 let resolved = false;
5519
5520 on(dialog.$el, 'submit', 'form', (e) => {
5521 e.preventDefault();
5522 deferred.resolve(submitFn == null ? void 0 : submitFn(dialog));
5523 resolved = true;
5524 dialog.hide();
5525 });
5526
5527 on(dialog.$el, 'hide', () => !resolved && hideFn(deferred));
5528
5529 deferred.promise.dialog = dialog;
5530
5531 return deferred.promise;
5532 }
5533 }
5534
5535 var nav = {
5536 extends: Accordion,
5537
5538 data: {
5539 targets: '> .bdt-parent',
5540 toggle: '> a',
5541 content: '> ul' } };
5542
5543 const navItem = '.bdt-navbar-nav > li > a, .bdt-navbar-item, .bdt-navbar-toggle';
5544
5545 var navbar = {
5546 mixins: [Class, Container],
5547
5548 props: {
5549 dropdown: String,
5550 mode: 'list',
5551 align: String,
5552 offset: Number,
5553 boundary: Boolean,
5554 boundaryAlign: Boolean,
5555 clsDrop: String,
5556 delayShow: Number,
5557 delayHide: Number,
5558 dropbar: Boolean,
5559 dropbarMode: String,
5560 dropbarAnchor: Boolean,
5561 duration: Number },
5562
5563
5564 data: {
5565 dropdown: navItem,
5566 align: isRtl ? 'right' : 'left',
5567 clsDrop: 'bdt-navbar-dropdown',
5568 mode: undefined,
5569 offset: undefined,
5570 delayShow: undefined,
5571 delayHide: undefined,
5572 boundaryAlign: undefined,
5573 flip: 'x',
5574 boundary: true,
5575 dropbar: false,
5576 dropbarMode: 'slide',
5577 dropbarAnchor: false,
5578 duration: 200,
5579 forceHeight: true,
5580 selMinHeight: navItem,
5581 container: false },
5582
5583
5584 computed: {
5585 boundary(_ref, $el) {let { boundary, boundaryAlign } = _ref;
5586 return boundary === true || boundaryAlign ? $el : boundary;
5587 },
5588
5589 dropbarAnchor(_ref2, $el) {let { dropbarAnchor } = _ref2;
5590 return query(dropbarAnchor, $el);
5591 },
5592
5593 pos(_ref3) {let { align } = _ref3;
5594 return "bottom-" + align;
5595 },
5596
5597 dropbar: {
5598 get(_ref4) {let { dropbar } = _ref4;
5599 if (!dropbar) {
5600 return null;
5601 }
5602
5603 dropbar =
5604 this._dropbar ||
5605 query(dropbar, this.$el) ||
5606 $('+ .bdt-navbar-dropbar', this.$el);
5607
5608 return dropbar ? dropbar : this._dropbar = $('<div></div>');
5609 },
5610
5611 watch(dropbar) {
5612 addClass(dropbar, 'bdt-navbar-dropbar');
5613 },
5614
5615 immediate: true },
5616
5617
5618 dropContainer(_, $el) {
5619 return this.container || $el;
5620 },
5621
5622 dropdowns: {
5623 get(_ref5, $el) {let { clsDrop } = _ref5;
5624 const dropdowns = $$("." + clsDrop, $el);
5625
5626 if (this.dropContainer !== $el) {
5627 for (const el of $$("." + clsDrop, this.dropContainer)) {var _this$getDropdown;
5628 const target = (_this$getDropdown = this.getDropdown(el)) == null ? void 0 : _this$getDropdown.target;
5629 if (!includes(dropdowns, el) && target && within(target, this.$el)) {
5630 dropdowns.push(el);
5631 }
5632 }
5633 }
5634
5635 return dropdowns;
5636 },
5637
5638 watch(dropdowns) {
5639 this.$create(
5640 'drop',
5641 dropdowns.filter((el) => !this.getDropdown(el)),
5642 {
5643 ...this.$props,
5644 boundary: this.boundary,
5645 pos: this.pos,
5646 offset: this.dropbar || this.offset });
5647
5648
5649 },
5650
5651 immediate: true },
5652
5653
5654 toggles(_ref6, $el) {let { dropdown } = _ref6;
5655 return $$(dropdown, $el);
5656 } },
5657
5658
5659 disconnected() {
5660 this.dropbar && remove$1(this.dropbar);
5661 delete this._dropbar;
5662 },
5663
5664 events: [
5665 {
5666 name: 'mouseover focusin',
5667
5668 delegate() {
5669 return this.dropdown;
5670 },
5671
5672 handler(_ref7) {let { current } = _ref7;
5673 const active = this.getActive();
5674 if (
5675 active &&
5676 includes(active.mode, 'hover') &&
5677 active.target &&
5678 !within(active.target, current) &&
5679 !active.isDelaying)
5680 {
5681 active.hide(false);
5682 }
5683 } },
5684
5685
5686 {
5687 name: 'keydown',
5688
5689 delegate() {
5690 return this.dropdown;
5691 },
5692
5693 handler(e) {
5694 const { current, keyCode } = e;
5695 const active = this.getActive();
5696
5697 if (keyCode === keyMap.DOWN && hasAttr(current, 'aria-expanded')) {
5698 e.preventDefault();
5699
5700 if (!active || active.target !== current) {
5701 current.click();
5702 once(this.dropContainer, 'show', (_ref8) => {let { target } = _ref8;return (
5703 focusFirstFocusableElement(target));});
5704
5705 } else {
5706 focusFirstFocusableElement(active.$el);
5707 }
5708 }
5709
5710 handleNavItemNavigation(e, this.toggles, active);
5711 } },
5712
5713
5714 {
5715 name: 'keydown',
5716
5717 el() {
5718 return this.dropContainer;
5719 },
5720
5721 delegate() {
5722 return "." + this.clsDrop;
5723 },
5724
5725 handler(e) {
5726 const { current, keyCode } = e;
5727
5728 if (!includes(this.dropdowns, current)) {
5729 return;
5730 }
5731
5732 const active = this.getActive();
5733 const elements = $$(selFocusable, current);
5734 const i = findIndex(elements, (el) => matches(el, ':focus'));
5735
5736 if (keyCode === keyMap.UP) {
5737 e.preventDefault();
5738 if (i > 0) {
5739 elements[i - 1].focus();
5740 }
5741 }
5742
5743 if (keyCode === keyMap.DOWN) {
5744 e.preventDefault();
5745 if (i < elements.length - 1) {
5746 elements[i + 1].focus();
5747 }
5748 }
5749
5750 if (keyCode === keyMap.ESC) {var _active$target;
5751 active == null ? void 0 : (_active$target = active.target) == null ? void 0 : _active$target.focus();
5752 }
5753
5754 handleNavItemNavigation(e, this.toggles, active);
5755 } },
5756
5757
5758 {
5759 name: 'mouseleave',
5760
5761 el() {
5762 return this.dropbar;
5763 },
5764
5765 filter() {
5766 return this.dropbar;
5767 },
5768
5769 handler() {
5770 const active = this.getActive();
5771
5772 if (
5773 active &&
5774 includes(active.mode, 'hover') &&
5775 !this.dropdowns.some((el) => matches(el, ':hover')))
5776 {
5777 active.hide();
5778 }
5779 } },
5780
5781
5782 {
5783 name: 'beforeshow',
5784
5785 el() {
5786 return this.dropContainer;
5787 },
5788
5789 filter() {
5790 return this.dropbar;
5791 },
5792
5793 handler() {
5794 if (!parent(this.dropbar)) {
5795 after(this.dropbarAnchor || this.$el, this.dropbar);
5796 }
5797 } },
5798
5799
5800 {
5801 name: 'show',
5802
5803 el() {
5804 return this.dropContainer;
5805 },
5806
5807 filter() {
5808 return this.dropbar;
5809 },
5810
5811 handler(_, _ref9) {let { $el, dir } = _ref9;
5812 if (!hasClass($el, this.clsDrop)) {
5813 return;
5814 }
5815
5816 if (this.dropbarMode === 'slide') {
5817 addClass(this.dropbar, 'bdt-navbar-dropbar-slide');
5818 }
5819
5820 this.clsDrop && addClass($el, this.clsDrop + "-dropbar");
5821
5822 if (dir === 'bottom') {
5823 this.transitionTo(
5824 $el.offsetHeight +
5825 toFloat(css($el, 'marginTop')) +
5826 toFloat(css($el, 'marginBottom')),
5827 $el);
5828
5829 }
5830 } },
5831
5832
5833 {
5834 name: 'beforehide',
5835
5836 el() {
5837 return this.dropContainer;
5838 },
5839
5840 filter() {
5841 return this.dropbar;
5842 },
5843
5844 handler(e, _ref10) {let { $el } = _ref10;
5845 const active = this.getActive();
5846
5847 if (
5848 matches(this.dropbar, ':hover') &&
5849 (active == null ? void 0 : active.$el) === $el &&
5850 !this.toggles.some((el) => active.target !== el && matches(el, ':focus')))
5851 {
5852 e.preventDefault();
5853 }
5854 } },
5855
5856
5857 {
5858 name: 'hide',
5859
5860 el() {
5861 return this.dropContainer;
5862 },
5863
5864 filter() {
5865 return this.dropbar;
5866 },
5867
5868 handler(_, _ref11) {let { $el } = _ref11;
5869 if (!hasClass($el, this.clsDrop)) {
5870 return;
5871 }
5872
5873 const active = this.getActive();
5874
5875 if (!active || (active == null ? void 0 : active.$el) === $el) {
5876 this.transitionTo(0);
5877 }
5878 } }],
5879
5880
5881
5882 methods: {
5883 getActive() {
5884 return active$1 && within(active$1.target, this.$el) && active$1;
5885 },
5886
5887 transitionTo(newHeight, el) {
5888 const { dropbar } = this;
5889 const oldHeight = isVisible(dropbar) ? height(dropbar) : 0;
5890
5891 el = oldHeight < newHeight && el;
5892
5893 css(el, 'clip', "rect(0," + el.offsetWidth + "px," + oldHeight + "px,0)");
5894
5895 height(dropbar, oldHeight);
5896
5897 Transition.cancel([el, dropbar]);
5898 return Promise.all([
5899 Transition.start(dropbar, { height: newHeight }, this.duration),
5900 Transition.start(
5901 el,
5902 { clip: "rect(0," + el.offsetWidth + "px," + newHeight + "px,0)" },
5903 this.duration)]).
5904
5905
5906 catch(noop).
5907 then(() => {
5908 css(el, { clip: '' });
5909 this.$update(dropbar);
5910 });
5911 },
5912
5913 getDropdown(el) {
5914 return this.$getComponent(el, 'drop') || this.$getComponent(el, 'dropdown');
5915 } } };
5916
5917
5918
5919 function handleNavItemNavigation(e, toggles, active) {
5920 const { current, keyCode } = e;
5921 const target = (active == null ? void 0 : active.target) || current;
5922 const i = toggles.indexOf(target);
5923
5924 // Left
5925 if (keyCode === keyMap.LEFT && i > 0) {
5926 active == null ? void 0 : active.hide(false);
5927 toggles[i - 1].focus();
5928 }
5929
5930 // Right
5931 if (keyCode === keyMap.RIGHT && i < toggles.length - 1) {
5932 active == null ? void 0 : active.hide(false);
5933 toggles[i + 1].focus();
5934 }
5935
5936 if (keyCode === keyMap.TAB) {
5937 target.focus();
5938 active == null ? void 0 : active.hide(false);
5939 }
5940 }
5941
5942 function focusFirstFocusableElement(el) {
5943 if (!$(':focus', el)) {var _$;
5944 (_$ = $(selFocusable, el)) == null ? void 0 : _$.focus();
5945 }
5946 }
5947
5948 const keyMap = {
5949 TAB: 9,
5950 ESC: 27,
5951 LEFT: 37,
5952 UP: 38,
5953 RIGHT: 39,
5954 DOWN: 40 };
5955
5956 var Swipe = {
5957 props: {
5958 swiping: Boolean },
5959
5960
5961 data: {
5962 swiping: true },
5963
5964
5965 computed: {
5966 swipeTarget(props, $el) {
5967 return $el;
5968 } },
5969
5970
5971 connected() {
5972 if (!this.swiping) {
5973 return;
5974 }
5975
5976 registerEvent(this, {
5977 el: this.swipeTarget,
5978 name: pointerDown,
5979 passive: true,
5980 handler(e) {
5981 if (!isTouch(e)) {
5982 return;
5983 }
5984
5985 // Handle Swipe Gesture
5986 const pos = getEventPos(e);
5987 const target = 'tagName' in e.target ? e.target : parent(e.target);
5988 once(document, pointerUp + " " + pointerCancel + " scroll", (e) => {
5989 const { x, y } = getEventPos(e);
5990
5991 // swipe
5992 if (
5993 e.type !== 'scroll' && target && x && Math.abs(pos.x - x) > 100 ||
5994 y && Math.abs(pos.y - y) > 100)
5995 {
5996 setTimeout(() => {
5997 trigger(target, 'swipe');
5998 trigger(target, "swipe" + swipeDirection(pos.x, pos.y, x, y));
5999 });
6000 }
6001 });
6002 } });
6003
6004 } };
6005
6006
6007 function swipeDirection(x1, y1, x2, y2) {
6008 return Math.abs(x1 - x2) >= Math.abs(y1 - y2) ?
6009 x1 - x2 > 0 ?
6010 'Left' :
6011 'Right' :
6012 y1 - y2 > 0 ?
6013 'Up' :
6014 'Down';
6015 }
6016
6017 var offcanvas = {
6018 mixins: [Modal, Swipe],
6019
6020 args: 'mode',
6021
6022 props: {
6023 mode: String,
6024 flip: Boolean,
6025 overlay: Boolean },
6026
6027
6028 data: {
6029 mode: 'slide',
6030 flip: false,
6031 overlay: false,
6032 clsPage: 'bdt-offcanvas-page',
6033 clsContainer: 'bdt-offcanvas-container',
6034 selPanel: '.bdt-offcanvas-bar',
6035 clsFlip: 'bdt-offcanvas-flip',
6036 clsContainerAnimation: 'bdt-offcanvas-container-animation',
6037 clsSidebarAnimation: 'bdt-offcanvas-bar-animation',
6038 clsMode: 'bdt-offcanvas',
6039 clsOverlay: 'bdt-offcanvas-overlay',
6040 selClose: '.bdt-offcanvas-close',
6041 container: false },
6042
6043
6044 computed: {
6045 clsFlip(_ref) {let { flip, clsFlip } = _ref;
6046 return flip ? clsFlip : '';
6047 },
6048
6049 clsOverlay(_ref2) {let { overlay, clsOverlay } = _ref2;
6050 return overlay ? clsOverlay : '';
6051 },
6052
6053 clsMode(_ref3) {let { mode, clsMode } = _ref3;
6054 return clsMode + "-" + mode;
6055 },
6056
6057 clsSidebarAnimation(_ref4) {let { mode, clsSidebarAnimation } = _ref4;
6058 return mode === 'none' || mode === 'reveal' ? '' : clsSidebarAnimation;
6059 },
6060
6061 clsContainerAnimation(_ref5) {let { mode, clsContainerAnimation } = _ref5;
6062 return mode !== 'push' && mode !== 'reveal' ? '' : clsContainerAnimation;
6063 },
6064
6065 transitionElement(_ref6) {let { mode } = _ref6;
6066 return mode === 'reveal' ? parent(this.panel) : this.panel;
6067 } },
6068
6069
6070 update: {
6071 read() {
6072 if (this.isToggled() && !isVisible(this.$el)) {
6073 this.hide();
6074 }
6075 },
6076
6077 events: ['resize'] },
6078
6079
6080 events: [
6081 {
6082 name: 'click',
6083
6084 delegate() {
6085 return 'a[href^="#"]';
6086 },
6087
6088 handler(_ref7) {let { current: { hash }, defaultPrevented } = _ref7;
6089 if (!defaultPrevented && hash && $(hash, document.body)) {
6090 this.hide();
6091 }
6092 } },
6093
6094
6095 {
6096 name: 'touchstart',
6097
6098 passive: true,
6099
6100 el() {
6101 return this.panel;
6102 },
6103
6104 handler(_ref8) {let { targetTouches } = _ref8;
6105 if (targetTouches.length === 1) {
6106 this.clientY = targetTouches[0].clientY;
6107 }
6108 } },
6109
6110
6111 {
6112 name: 'touchmove',
6113
6114 self: true,
6115 passive: false,
6116
6117 filter() {
6118 return this.overlay;
6119 },
6120
6121 handler(e) {
6122 e.cancelable && e.preventDefault();
6123 } },
6124
6125
6126 {
6127 name: 'touchmove',
6128
6129 passive: false,
6130
6131 el() {
6132 return this.panel;
6133 },
6134
6135 handler(e) {
6136 if (e.targetTouches.length !== 1) {
6137 return;
6138 }
6139
6140 const clientY = e.targetTouches[0].clientY - this.clientY;
6141 const { scrollTop, scrollHeight, clientHeight } = this.panel;
6142
6143 if (
6144 clientHeight >= scrollHeight ||
6145 scrollTop === 0 && clientY > 0 ||
6146 scrollHeight - scrollTop <= clientHeight && clientY < 0)
6147 {
6148 e.cancelable && e.preventDefault();
6149 }
6150 } },
6151
6152
6153 {
6154 name: 'show',
6155
6156 self: true,
6157
6158 handler() {
6159 if (this.mode === 'reveal' && !hasClass(parent(this.panel), this.clsMode)) {
6160 wrapAll(this.panel, '<div>');
6161 addClass(parent(this.panel), this.clsMode);
6162 }
6163
6164 css(document.documentElement, 'overflowY', this.overlay ? 'hidden' : '');
6165 addClass(document.body, this.clsContainer, this.clsFlip);
6166 css(document.body, 'touch-action', 'pan-y pinch-zoom');
6167 css(this.$el, 'display', 'block');
6168 addClass(this.$el, this.clsOverlay);
6169 addClass(
6170 this.panel,
6171 this.clsSidebarAnimation,
6172 this.mode !== 'reveal' ? this.clsMode : '');
6173
6174
6175 height(document.body); // force reflow
6176 addClass(document.body, this.clsContainerAnimation);
6177
6178 this.clsContainerAnimation && suppressUserScale();
6179 } },
6180
6181
6182 {
6183 name: 'hide',
6184
6185 self: true,
6186
6187 handler() {
6188 removeClass(document.body, this.clsContainerAnimation);
6189 css(document.body, 'touch-action', '');
6190 } },
6191
6192
6193 {
6194 name: 'hidden',
6195
6196 self: true,
6197
6198 handler() {
6199 this.clsContainerAnimation && resumeUserScale();
6200
6201 if (this.mode === 'reveal') {
6202 unwrap(this.panel);
6203 }
6204
6205 removeClass(this.panel, this.clsSidebarAnimation, this.clsMode);
6206 removeClass(this.$el, this.clsOverlay);
6207 css(this.$el, 'display', '');
6208 removeClass(document.body, this.clsContainer, this.clsFlip);
6209
6210 css(document.documentElement, 'overflowY', '');
6211 } },
6212
6213
6214 {
6215 name: 'swipeLeft swipeRight',
6216
6217 handler(e) {
6218 if (this.isToggled() && endsWith(e.type, 'Left') ^ this.flip) {
6219 this.hide();
6220 }
6221 } }] };
6222
6223
6224
6225
6226 // Chrome in responsive mode zooms page upon opening offcanvas
6227 function suppressUserScale() {
6228 getViewport().content += ',user-scalable=0';
6229 }
6230
6231 function resumeUserScale() {
6232 const viewport = getViewport();
6233 viewport.content = viewport.content.replace(/,user-scalable=0$/, '');
6234 }
6235
6236 function getViewport() {
6237 return (
6238 $('meta[name="viewport"]', document.head) || append(document.head, '<meta name="viewport">'));
6239
6240 }
6241
6242 var overflowAuto = {
6243 mixins: [Class, Resize],
6244
6245 props: {
6246 selContainer: String,
6247 selContent: String,
6248 minHeight: Number },
6249
6250
6251 data: {
6252 selContainer: '.bdt-modal',
6253 selContent: '.bdt-modal-dialog',
6254 minHeight: 150 },
6255
6256
6257 computed: {
6258 container(_ref, $el) {let { selContainer } = _ref;
6259 return closest($el, selContainer);
6260 },
6261
6262 content(_ref2, $el) {let { selContent } = _ref2;
6263 return closest($el, selContent);
6264 } },
6265
6266
6267 resizeTargets() {
6268 return [this.container, this.content];
6269 },
6270
6271 update: {
6272 read() {
6273 if (!this.content || !this.container || !isVisible(this.$el)) {
6274 return false;
6275 }
6276
6277 return {
6278 max: Math.max(
6279 this.minHeight,
6280 height(this.container) - (dimensions$1(this.content).height - height(this.$el))) };
6281
6282
6283 },
6284
6285 write(_ref3) {let { max } = _ref3;
6286 css(this.$el, { minHeight: this.minHeight, maxHeight: max });
6287 },
6288
6289 events: ['resize'] } };
6290
6291 var responsive = {
6292 mixin: [Resize],
6293
6294 props: ['width', 'height'],
6295
6296 resizeTargets() {
6297 return [this.$el, parent(this.$el)];
6298 },
6299
6300 connected() {
6301 addClass(this.$el, 'bdt-responsive-width');
6302 },
6303
6304 update: {
6305 read() {
6306 return isVisible(this.$el) && this.width && this.height ?
6307 { width: width(parent(this.$el)), height: this.height } :
6308 false;
6309 },
6310
6311 write(dim) {
6312 height(
6313 this.$el,
6314 Dimensions.contain(
6315 {
6316 height: this.height,
6317 width: this.width },
6318
6319 dim).
6320 height);
6321
6322 },
6323
6324 events: ['resize'] } };
6325
6326 var scroll = {
6327 props: {
6328 offset: Number },
6329
6330
6331 data: {
6332 offset: 0 },
6333
6334
6335 methods: {
6336 async scrollTo(el) {
6337 el = el && $(el) || document.body;
6338
6339 if (trigger(this.$el, 'beforescroll', [this, el])) {
6340 await scrollIntoView(el, { offset: this.offset });
6341 trigger(this.$el, 'scrolled', [this, el]);
6342 }
6343 } },
6344
6345
6346 events: {
6347 click(e) {
6348 if (e.defaultPrevented) {
6349 return;
6350 }
6351
6352 e.preventDefault();
6353 this.scrollTo(getTargetElement(this.$el));
6354 } } };
6355
6356
6357
6358 function getTargetElement(el) {
6359 return document.getElementById(decodeURIComponent(el.hash).substring(1));
6360 }
6361
6362 const stateKey = '_ukScrollspy';
6363 var scrollspy = {
6364 mixins: [Scroll],
6365
6366 args: 'cls',
6367
6368 props: {
6369 cls: String,
6370 target: String,
6371 hidden: Boolean,
6372 offsetTop: Number,
6373 offsetLeft: Number,
6374 repeat: Boolean,
6375 delay: Number },
6376
6377
6378 data: () => ({
6379 cls: '',
6380 target: false,
6381 hidden: true,
6382 offsetTop: 0,
6383 offsetLeft: 0,
6384 repeat: false,
6385 delay: 0,
6386 inViewClass: 'bdt-scrollspy-inview' }),
6387
6388
6389 computed: {
6390 elements: {
6391 get(_ref, $el) {let { target } = _ref;
6392 return target ? $$(target, $el) : [$el];
6393 },
6394
6395 watch(elements) {
6396 if (this.hidden) {
6397 css(filter$1(elements, ":not(." + this.inViewClass + ")"), 'visibility', 'hidden');
6398 }
6399 },
6400
6401 immediate: true } },
6402
6403
6404
6405 disconnected() {
6406 for (const el of this.elements) {var _el$stateKey;
6407 removeClass(el, this.inViewClass, ((_el$stateKey = el[stateKey]) == null ? void 0 : _el$stateKey.cls) || '');
6408 delete el[stateKey];
6409 }
6410 },
6411
6412 update: [
6413 {
6414 read() {
6415 for (const el of this.elements) {
6416 if (!el[stateKey]) {
6417 el[stateKey] = { cls: data(el, 'bdt-scrollspy-class') || this.cls };
6418 }
6419
6420 if (!this.repeat && el[stateKey].show) {
6421 continue;
6422 }
6423
6424 el[stateKey].show = isInView(el, this.offsetTop, this.offsetLeft);
6425 }
6426 },
6427
6428 write(data) {
6429 for (const el of this.elements) {
6430 const state = el[stateKey];
6431
6432 if (state.show && !state.inview && !state.queued) {
6433 state.queued = true;
6434
6435 data.promise = (data.promise || Promise.resolve()).
6436 then(() => new Promise((resolve) => setTimeout(resolve, this.delay))).
6437 then(() => {
6438 this.toggle(el, true);
6439 setTimeout(() => {
6440 state.queued = false;
6441 this.$emit();
6442 }, 300);
6443 });
6444 } else if (!state.show && state.inview && !state.queued && this.repeat) {
6445 this.toggle(el, false);
6446 }
6447 }
6448 },
6449
6450 events: ['scroll', 'resize'] }],
6451
6452
6453
6454 methods: {
6455 toggle(el, inview) {
6456 const state = el[stateKey];
6457
6458 state.off == null ? void 0 : state.off();
6459
6460 css(el, 'visibility', !inview && this.hidden ? 'hidden' : '');
6461
6462 toggleClass(el, this.inViewClass, inview);
6463 toggleClass(el, state.cls);
6464
6465 if (/\bbdt-animation-/.test(state.cls)) {
6466 const removeAnimationClasses = () => removeClasses(el, 'bdt-animation-[\\w-]+');
6467 if (inview) {
6468 state.off = once(el, 'animationcancel animationend', removeAnimationClasses);
6469 } else {
6470 removeAnimationClasses();
6471 }
6472 }
6473
6474 trigger(el, inview ? 'inview' : 'outview');
6475
6476 state.inview = inview;
6477
6478 this.$update(el);
6479 } } };
6480
6481 var scrollspyNav = {
6482 mixins: [Scroll],
6483
6484 props: {
6485 cls: String,
6486 closest: String,
6487 scroll: Boolean,
6488 overflow: Boolean,
6489 offset: Number },
6490
6491
6492 data: {
6493 cls: 'bdt-active',
6494 closest: false,
6495 scroll: false,
6496 overflow: true,
6497 offset: 0 },
6498
6499
6500 computed: {
6501 links: {
6502 get(_, $el) {
6503 return $$('a[href^="#"]', $el).filter((el) => el.hash);
6504 },
6505
6506 watch(links) {
6507 if (this.scroll) {
6508 this.$create('scroll', links, { offset: this.offset || 0 });
6509 }
6510 },
6511
6512 immediate: true },
6513
6514
6515 elements(_ref) {let { closest: selector } = _ref;
6516 return closest(this.links, selector || '*');
6517 } },
6518
6519
6520 update: [
6521 {
6522 read() {
6523 const targets = this.links.map(getTargetElement).filter(Boolean);
6524
6525 const { length } = targets;
6526
6527 if (!length || !isVisible(this.$el)) {
6528 return false;
6529 }
6530
6531 const [scrollElement] = scrollParents(targets, /auto|scroll/, true);
6532 const { scrollTop, scrollHeight } = scrollElement;
6533 const max = scrollHeight - getViewportClientHeight(scrollElement);
6534 let active = false;
6535
6536 if (scrollTop === max) {
6537 active = length - 1;
6538 } else {
6539 for (const i in targets) {
6540 if (
6541 offset(targets[i]).top -
6542 offset(getViewport$1(scrollElement)).top -
6543 this.offset >
6544 0)
6545 {
6546 break;
6547 }
6548 active = +i;
6549 }
6550
6551 if (active === false && this.overflow) {
6552 active = 0;
6553 }
6554 }
6555
6556 return { active };
6557 },
6558
6559 write(_ref2) {let { active } = _ref2;
6560 const changed = active !== false && !hasClass(this.elements[active], this.cls);
6561
6562 this.links.forEach((el) => el.blur());
6563 for (const i in this.elements) {
6564 toggleClass(this.elements[i], this.cls, +i === active);
6565 }
6566
6567 if (changed) {
6568 trigger(this.$el, 'active', [active, this.elements[active]]);
6569 }
6570 },
6571
6572 events: ['scroll', 'resize'] }] };
6573
6574 var sticky = {
6575 mixins: [Class, Media, Resize, Scroll],
6576
6577 props: {
6578 position: String,
6579 top: null,
6580 bottom: Boolean,
6581 offset: String,
6582 animation: String,
6583 clsActive: String,
6584 clsInactive: String,
6585 clsFixed: String,
6586 clsBelow: String,
6587 selTarget: String,
6588 showOnUp: Boolean,
6589 targetOffset: Number },
6590
6591
6592 data: {
6593 position: 'top',
6594 top: 0,
6595 bottom: false,
6596 offset: 0,
6597 animation: '',
6598 clsActive: 'bdt-active',
6599 clsInactive: '',
6600 clsFixed: 'bdt-sticky-fixed',
6601 clsBelow: 'bdt-sticky-below',
6602 selTarget: '',
6603 showOnUp: false,
6604 targetOffset: false },
6605
6606
6607 computed: {
6608 selTarget(_ref, $el) {let { selTarget } = _ref;
6609 return selTarget && $(selTarget, $el) || $el;
6610 } },
6611
6612
6613 resizeTargets() {
6614 return document.documentElement;
6615 },
6616
6617 connected() {
6618 this.placeholder =
6619 $('+ .bdt-sticky-placeholder', this.$el) ||
6620 $('<div class="bdt-sticky-placeholder"></div>');
6621 this.isFixed = false;
6622 this.setActive(false);
6623 },
6624
6625 disconnected() {
6626 if (this.isFixed) {
6627 this.hide();
6628 removeClass(this.selTarget, this.clsInactive);
6629 }
6630
6631 remove$1(this.placeholder);
6632 this.placeholder = null;
6633 },
6634
6635 events: [
6636 {
6637 name: 'load hashchange popstate',
6638
6639 el() {
6640 return window;
6641 },
6642
6643 filter() {
6644 return this.targetOffset !== false;
6645 },
6646
6647 handler() {
6648 if (!location.hash || scrollTop(window) === 0) {
6649 return;
6650 }
6651
6652 fastdom.read(() => {
6653 const targetOffset = offset($(location.hash));
6654 const elOffset = offset(this.$el);
6655
6656 if (this.isFixed && intersectRect(targetOffset, elOffset)) {
6657 scrollTop(
6658 window,
6659 targetOffset.top -
6660 elOffset.height -
6661 toPx(this.targetOffset, 'height') -
6662 toPx(this.offset, 'height'));
6663
6664 }
6665 });
6666 } }],
6667
6668
6669
6670 update: [
6671 {
6672 read(_ref2, types) {let { height: height$1, margin } = _ref2;
6673 this.inactive = !this.matchMedia || !isVisible(this.$el);
6674
6675 if (this.inactive) {
6676 return false;
6677 }
6678
6679 const hide = this.isActive && types.has('resize');
6680 if (hide) {
6681 css(this.selTarget, 'transition', '0s');
6682 this.hide();
6683 }
6684
6685 if (!this.isActive) {
6686 height$1 = offset(this.$el).height;
6687 margin = css(this.$el, 'margin');
6688 }
6689
6690 if (hide) {
6691 this.show();
6692 fastdom.write(() => css(this.selTarget, 'transition', ''));
6693 }
6694
6695 const referenceElement = this.isFixed ? this.placeholder : this.$el;
6696 const windowHeight = height(window);
6697
6698 let position = this.position;
6699 if (position === 'auto' && height$1 > windowHeight) {
6700 position = 'bottom';
6701 }
6702
6703 let offset$1 = toPx(this.offset, 'height', referenceElement);
6704 if (position === 'bottom') {
6705 offset$1 += windowHeight - height$1;
6706 }
6707
6708 const overflow = Math.max(0, height$1 + offset$1 - windowHeight);
6709 const topOffset = offset(referenceElement).top;
6710
6711 const top = parseProp(this.top, this.$el, topOffset);
6712 const bottom = parseProp(this.bottom, this.$el, topOffset + height$1, true);
6713
6714 const start = Math.max(top, topOffset) - offset$1;
6715 const end = bottom ?
6716 bottom - offset(this.$el).height + overflow - offset$1 :
6717 getScrollingElement(this.$el).scrollHeight - windowHeight;
6718
6719 return {
6720 start,
6721 end,
6722 offset: offset$1,
6723 overflow,
6724 topOffset,
6725 height: height$1,
6726 margin,
6727 width: dimensions$1(referenceElement).width,
6728 top: offsetPosition(referenceElement)[0] };
6729
6730 },
6731
6732 write(_ref3) {let { height, margin } = _ref3;
6733 const { placeholder } = this;
6734
6735 css(placeholder, { height, margin });
6736
6737 if (!within(placeholder, document)) {
6738 after(this.$el, placeholder);
6739 placeholder.hidden = true;
6740 }
6741 },
6742
6743 events: ['resize'] },
6744
6745
6746 {
6747 read(_ref4)
6748
6749
6750
6751
6752
6753
6754 {let { scroll: prevScroll = 0, dir: prevDir = 'down', overflow, overflowScroll = 0, start, end } = _ref4;
6755 const scroll = scrollTop(window);
6756 const dir = prevScroll <= scroll ? 'down' : 'up';
6757
6758 return {
6759 dir,
6760 prevDir,
6761 scroll,
6762 prevScroll,
6763 offsetParentTop: offset(this.$el.offsetParent).top,
6764 overflowScroll: clamp(
6765 overflowScroll + clamp(scroll, start, end) - clamp(prevScroll, start, end),
6766 0,
6767 overflow) };
6768
6769
6770 },
6771
6772 write(data, types) {
6773 const isScrollUpdate = types.has('scroll');
6774 const {
6775 initTimestamp = 0,
6776 dir,
6777 prevDir,
6778 scroll,
6779 prevScroll = 0,
6780 top,
6781 start,
6782 topOffset,
6783 height } =
6784 data;
6785
6786 if (
6787 scroll < 0 ||
6788 scroll === prevScroll && isScrollUpdate ||
6789 this.showOnUp && !isScrollUpdate && !this.isFixed)
6790 {
6791 return;
6792 }
6793
6794 const now = Date.now();
6795 if (now - initTimestamp > 300 || dir !== prevDir) {
6796 data.initScroll = scroll;
6797 data.initTimestamp = now;
6798 }
6799
6800 if (
6801 this.showOnUp &&
6802 !this.isFixed &&
6803 Math.abs(data.initScroll - scroll) <= 30 &&
6804 Math.abs(prevScroll - scroll) <= 10)
6805 {
6806 return;
6807 }
6808
6809 if (
6810 this.inactive ||
6811 scroll < start ||
6812 this.showOnUp && (
6813 scroll <= start ||
6814 dir === 'down' && isScrollUpdate ||
6815 dir === 'up' && !this.isFixed && scroll <= topOffset + height))
6816 {
6817 if (!this.isFixed) {
6818 if (Animation.inProgress(this.$el) && top > scroll) {
6819 Animation.cancel(this.$el);
6820 this.hide();
6821 }
6822
6823 return;
6824 }
6825
6826 this.isFixed = false;
6827
6828 if (this.animation && scroll > topOffset) {
6829 Animation.cancel(this.$el);
6830 Animation.out(this.$el, this.animation).then(() => this.hide(), noop);
6831 } else {
6832 this.hide();
6833 }
6834 } else if (this.isFixed) {
6835 this.update();
6836 } else if (this.animation && scroll > topOffset) {
6837 Animation.cancel(this.$el);
6838 this.show();
6839 Animation.in(this.$el, this.animation).catch(noop);
6840 } else {
6841 this.show();
6842 }
6843 },
6844
6845 events: ['resize', 'scroll'] }],
6846
6847
6848
6849 methods: {
6850 show() {
6851 this.isFixed = true;
6852 this.update();
6853 this.placeholder.hidden = false;
6854 },
6855
6856 hide() {
6857 this.setActive(false);
6858 removeClass(this.$el, this.clsFixed, this.clsBelow);
6859 css(this.$el, { position: '', top: '', width: '' });
6860 this.placeholder.hidden = true;
6861 },
6862
6863 update() {
6864 let {
6865 width,
6866 scroll = 0,
6867 overflow,
6868 overflowScroll = 0,
6869 start,
6870 end,
6871 offset,
6872 topOffset,
6873 height,
6874 offsetParentTop } =
6875 this._data;
6876 const active = start !== 0 || scroll > start;
6877 let position = 'fixed';
6878
6879 if (scroll > end) {
6880 offset += end - offsetParentTop;
6881 position = 'absolute';
6882 }
6883
6884 if (overflow) {
6885 offset -= overflowScroll;
6886 }
6887
6888 css(this.$el, {
6889 position,
6890 top: offset + "px",
6891 width });
6892
6893
6894 this.setActive(active);
6895 toggleClass(this.$el, this.clsBelow, scroll > topOffset + height);
6896 addClass(this.$el, this.clsFixed);
6897 },
6898
6899 setActive(active) {
6900 const prev = this.active;
6901 this.active = active;
6902 if (active) {
6903 replaceClass(this.selTarget, this.clsInactive, this.clsActive);
6904 prev !== active && trigger(this.$el, 'active');
6905 } else {
6906 replaceClass(this.selTarget, this.clsActive, this.clsInactive);
6907 prev !== active && trigger(this.$el, 'inactive');
6908 }
6909 } } };
6910
6911
6912
6913 function parseProp(value, el, propOffset, padding) {
6914 if (!value) {
6915 return 0;
6916 }
6917
6918 if (isString(value) && value.match(/^-?\d/)) {
6919 return propOffset + toPx(value);
6920 } else {
6921 const refElement = value === true ? parent(el) : query(value, el);
6922 return (
6923 offset(refElement).bottom - (
6924 padding && refElement && within(el, refElement) ?
6925 toFloat(css(refElement, 'paddingBottom')) :
6926 0));
6927
6928 }
6929 }
6930
6931 var Switcher = {
6932 mixins: [Lazyload, Swipe, Togglable],
6933
6934 args: 'connect',
6935
6936 props: {
6937 connect: String,
6938 toggle: String,
6939 itemNav: String,
6940 active: Number },
6941
6942
6943 data: {
6944 connect: '~.bdt-switcher',
6945 toggle: '> * > :first-child',
6946 itemNav: false,
6947 active: 0,
6948 cls: 'bdt-active',
6949 attrItem: 'bdt-switcher-item' },
6950
6951
6952 computed: {
6953 connects: {
6954 get(_ref, $el) {let { connect } = _ref;
6955 return queryAll(connect, $el);
6956 },
6957
6958 watch(connects) {
6959 if (this.swiping) {
6960 css(connects, 'touch-action', 'pan-y pinch-zoom');
6961 }
6962
6963 const index = this.index();
6964 this.connects.forEach((el) =>
6965 children(el).forEach((child, i) => toggleClass(child, this.cls, i === index)));
6966
6967 },
6968
6969 immediate: true },
6970
6971
6972 toggles: {
6973 get(_ref2, $el) {let { toggle } = _ref2;
6974 return $$(toggle, $el).filter(
6975 (el) => !matches(el, '.bdt-disabled *, .bdt-disabled, [disabled]'));
6976
6977 },
6978
6979 watch(toggles) {
6980 const active = this.index();
6981 this.show(~active ? active : toggles[this.active] || toggles[0]);
6982 },
6983
6984 immediate: true },
6985
6986
6987 children() {
6988 return children(this.$el).filter((child) =>
6989 this.toggles.some((toggle) => within(toggle, child)));
6990
6991 },
6992
6993 swipeTarget() {
6994 return this.connects;
6995 } },
6996
6997
6998 connected() {
6999 this.lazyload(this.$el, this.connects);
7000
7001 // check for connects
7002 ready(() => this.$emit());
7003 },
7004
7005 events: [
7006 {
7007 name: 'click',
7008
7009 delegate() {
7010 return this.toggle;
7011 },
7012
7013 handler(e) {
7014 e.preventDefault();
7015 this.show(e.current);
7016 } },
7017
7018
7019 {
7020 name: 'click',
7021
7022 el() {
7023 return this.connects.concat(this.itemNav ? queryAll(this.itemNav, this.$el) : []);
7024 },
7025
7026 delegate() {
7027 return "[" + this.attrItem + "],[data-" + this.attrItem + "]";
7028 },
7029
7030 handler(e) {
7031 e.preventDefault();
7032 this.show(data(e.current, this.attrItem));
7033 } },
7034
7035
7036 {
7037 name: 'swipeRight swipeLeft',
7038
7039 filter() {
7040 return this.swiping;
7041 },
7042
7043 el() {
7044 return this.connects;
7045 },
7046
7047 handler(_ref3) {let { type } = _ref3;
7048 this.show(endsWith(type, 'Left') ? 'next' : 'previous');
7049 } }],
7050
7051
7052
7053 methods: {
7054 index() {
7055 return findIndex(this.children, (el) => hasClass(el, this.cls));
7056 },
7057
7058 show(item) {
7059 const prev = this.index();
7060 const next = getIndex(
7061 this.children[getIndex(item, this.toggles, prev)],
7062 children(this.$el));
7063
7064
7065 if (prev === next) {
7066 return;
7067 }
7068
7069 children(this.$el).forEach((child, i) => {
7070 toggleClass(child, this.cls, next === i);
7071 attr(this.toggles[i], 'aria-expanded', next === i);
7072 });
7073
7074 this.connects.forEach(async (_ref4) => {let { children } = _ref4;
7075 await this.toggleElement(
7076 toNodes(children).filter((child) => hasClass(child, this.cls)),
7077 false,
7078 prev >= 0);
7079
7080 await this.toggleElement(children[next], true, prev >= 0);
7081 });
7082 } } };
7083
7084 var tab = {
7085 mixins: [Class],
7086
7087 extends: Switcher,
7088
7089 props: {
7090 media: Boolean },
7091
7092
7093 data: {
7094 media: 960,
7095 attrItem: 'bdt-tab-item' },
7096
7097
7098 connected() {
7099 const cls = hasClass(this.$el, 'bdt-tab-left') ?
7100 'bdt-tab-left' :
7101 hasClass(this.$el, 'bdt-tab-right') ?
7102 'bdt-tab-right' :
7103 false;
7104
7105 if (cls) {
7106 this.$create('toggle', this.$el, { cls, mode: 'media', media: this.media });
7107 }
7108 } };
7109
7110 const KEY_SPACE = 32;
7111
7112 var toggle = {
7113 mixins: [Lazyload, Media, Togglable],
7114
7115 args: 'target',
7116
7117 props: {
7118 href: String,
7119 target: null,
7120 mode: 'list',
7121 queued: Boolean },
7122
7123
7124 data: {
7125 href: false,
7126 target: false,
7127 mode: 'click',
7128 queued: true },
7129
7130
7131 computed: {
7132 target: {
7133 get(_ref, $el) {let { href, target } = _ref;
7134 target = queryAll(target || href, $el);
7135 return target.length && target || [$el];
7136 },
7137
7138 watch() {
7139 this.updateAria();
7140 },
7141
7142 immediate: true } },
7143
7144
7145
7146 connected() {
7147 if (!includes(this.mode, 'media') && !isFocusable(this.$el)) {
7148 attr(this.$el, 'tabindex', '0');
7149 }
7150
7151 this.lazyload(this.$el, this.target);
7152
7153 // check for target
7154 ready(() => this.$emit());
7155 },
7156
7157 events: [
7158 {
7159 name: pointerDown,
7160
7161 filter() {
7162 return includes(this.mode, 'hover');
7163 },
7164
7165 handler(e) {
7166 if (!isTouch(e) || this._showState) {
7167 return;
7168 }
7169
7170 // Clicking a button does not give it focus on all browsers and platforms
7171 // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#clicking_and_focus
7172 trigger(this.$el, 'focus');
7173 once(
7174 document,
7175 pointerDown,
7176 () => trigger(this.$el, 'blur'),
7177 true,
7178 (e) => !within(e.target, this.$el));
7179
7180
7181 // Prevent initial click to prevent double toggle through focus + click
7182 if (includes(this.mode, 'click')) {
7183 this._preventClick = true;
7184 }
7185 } },
7186
7187
7188 {
7189 name: pointerEnter + " " + pointerLeave + " focus blur",
7190
7191 filter() {
7192 return includes(this.mode, 'hover');
7193 },
7194
7195 handler(e) {
7196 if (isTouch(e)) {
7197 return;
7198 }
7199
7200 const show = includes([pointerEnter, 'focus'], e.type);
7201 const expanded = attr(this.$el, 'aria-expanded');
7202
7203 // Skip hide if still hovered or focused
7204 if (
7205 !show && (
7206 e.type === pointerLeave && matches(this.$el, ':focus') ||
7207 e.type === 'blur' && matches(this.$el, ':hover')))
7208 {
7209 return;
7210 }
7211
7212 // Skip if state does not change e.g. hover + focus received
7213 if (this._showState && show === (expanded !== this._showState)) {
7214 // Ensure reset if state has changed through click
7215 if (!show) {
7216 this._showState = null;
7217 }
7218 return;
7219 }
7220
7221 this._showState = show ? expanded : null;
7222
7223 this.toggle("toggle" + (show ? 'show' : 'hide'));
7224 } },
7225
7226
7227 {
7228 name: 'keydown',
7229
7230 filter() {
7231 return includes(this.mode, 'click') && !isTag(this.$el, 'input');
7232 },
7233
7234 handler(e) {
7235 if (e.keyCode === KEY_SPACE) {
7236 e.preventDefault();
7237 this.$el.click();
7238 }
7239 } },
7240
7241
7242 {
7243 name: 'click',
7244
7245 filter() {
7246 return includes(this.mode, 'click');
7247 },
7248
7249 handler(e) {
7250 if (this._preventClick) {
7251 return this._preventClick = null;
7252 }
7253
7254 let link;
7255 if (
7256 closest(e.target, 'a[href="#"], a[href=""]') ||
7257 (link = closest(e.target, 'a[href]')) && (
7258 attr(this.$el, 'aria-expanded') !== 'true' ||
7259 link.hash && matches(this.target, link.hash)))
7260 {
7261 e.preventDefault();
7262 }
7263
7264 this.toggle();
7265 } },
7266
7267
7268 {
7269 name: 'toggled',
7270
7271 self: true,
7272
7273 el() {
7274 return this.target;
7275 },
7276
7277 handler(e, toggled) {
7278 if (e.target === this.target[0]) {
7279 this.updateAria(toggled);
7280 }
7281 } },
7282
7283
7284 {
7285 name: 'mediachange',
7286
7287 filter() {
7288 return includes(this.mode, 'media');
7289 },
7290
7291 el() {
7292 return this.target;
7293 },
7294
7295 handler(e, mediaObj) {
7296 if (mediaObj.matches ^ this.isToggled(this.target)) {
7297 this.toggle();
7298 }
7299 } }],
7300
7301
7302
7303 methods: {
7304 async toggle(type) {
7305 if (!trigger(this.target, type || 'toggle', [this])) {
7306 return;
7307 }
7308
7309 if (!this.queued) {
7310 return this.toggleElement(this.target);
7311 }
7312
7313 const leaving = this.target.filter((el) => hasClass(el, this.clsLeave));
7314
7315 if (leaving.length) {
7316 for (const el of this.target) {
7317 const isLeaving = includes(leaving, el);
7318 this.toggleElement(el, isLeaving, isLeaving);
7319 }
7320 return;
7321 }
7322
7323 const toggled = this.target.filter(this.isToggled);
7324 await this.toggleElement(toggled, false);
7325 await this.toggleElement(
7326 this.target.filter((el) => !includes(toggled, el)),
7327 true);
7328
7329 },
7330
7331 updateAria(toggled) {
7332 if (includes(this.mode, 'media')) {
7333 return;
7334 }
7335
7336 attr(
7337 this.$el,
7338 'aria-expanded',
7339 isBoolean(toggled) ? toggled : this.isToggled(this.target));
7340
7341 } } };
7342
7343 var components$1 = /*#__PURE__*/Object.freeze({
7344 __proto__: null,
7345 Accordion: Accordion,
7346 Alert: alert,
7347 Cover: cover,
7348 Drop: drop,
7349 Dropdown: drop,
7350 FormCustom: formCustom,
7351 Grid: grid,
7352 HeightMatch: heightMatch,
7353 HeightViewport: heightViewport,
7354 Icon: Icon,
7355 Img: img,
7356 Leader: leader,
7357 Margin: Margin,
7358 Modal: modal,
7359 Nav: nav,
7360 Navbar: navbar,
7361 Offcanvas: offcanvas,
7362 OverflowAuto: overflowAuto,
7363 Responsive: responsive,
7364 Scroll: scroll,
7365 Scrollspy: scrollspy,
7366 ScrollspyNav: scrollspyNav,
7367 Sticky: sticky,
7368 Svg: SVG,
7369 Switcher: Switcher,
7370 Tab: tab,
7371 Toggle: toggle,
7372 Video: Video,
7373 Close: Close,
7374 Spinner: Spinner,
7375 SlidenavNext: Slidenav,
7376 SlidenavPrevious: Slidenav,
7377 SearchIcon: Search,
7378 Marker: IconComponent,
7379 NavbarToggleIcon: IconComponent,
7380 OverlayIcon: IconComponent,
7381 PaginationNext: IconComponent,
7382 PaginationPrevious: IconComponent,
7383 Totop: IconComponent
7384 });
7385
7386 // register components
7387 each(components$1, (component, name) => bdtUIkit.component(name, component));
7388
7389 // core functionality
7390 bdtUIkit.use(Core);
7391
7392 boot(bdtUIkit);
7393
7394 const units = ['days', 'hours', 'minutes', 'seconds'];
7395
7396 var countdown = {
7397 mixins: [Class],
7398
7399 props: {
7400 date: String,
7401 clsWrapper: String },
7402
7403
7404 data: {
7405 date: '',
7406 clsWrapper: '.bdt-countdown-%unit%' },
7407
7408
7409 connected() {
7410 this.date = Date.parse(this.$props.date);
7411 this.start();
7412 },
7413
7414 disconnected() {
7415 this.stop();
7416 },
7417
7418 events: [
7419 {
7420 name: 'visibilitychange',
7421
7422 el() {
7423 return document;
7424 },
7425
7426 handler() {
7427 if (document.hidden) {
7428 this.stop();
7429 } else {
7430 this.start();
7431 }
7432 } }],
7433
7434
7435
7436 methods: {
7437 start() {
7438 this.stop();
7439 this.update();
7440 this.timer = setInterval(this.update, 1000);
7441 },
7442
7443 stop() {
7444 clearInterval(this.timer);
7445 },
7446
7447 update() {
7448 const timespan = getTimeSpan(this.date);
7449
7450 if (!this.date || timespan.total <= 0) {
7451 this.stop();
7452
7453 timespan.days = timespan.hours = timespan.minutes = timespan.seconds = 0;
7454 }
7455
7456 for (const unit of units) {
7457 const el = $(this.clsWrapper.replace('%unit%', unit), this.$el);
7458
7459 if (!el) {
7460 continue;
7461 }
7462
7463 let digits = String(Math.trunc(timespan[unit]));
7464
7465 digits = digits.length < 2 ? "0" + digits : digits;
7466
7467 if (el.textContent !== digits) {
7468 digits = digits.split('');
7469
7470 if (digits.length !== el.children.length) {
7471 html(el, digits.map(() => '<span></span>').join(''));
7472 }
7473
7474 digits.forEach((digit, i) => el.children[i].textContent = digit);
7475 }
7476 }
7477 } } };
7478
7479
7480
7481 function getTimeSpan(date) {
7482 const total = date - Date.now();
7483
7484 return {
7485 total,
7486 seconds: total / 1000 % 60,
7487 minutes: total / 1000 / 60 % 60,
7488 hours: total / 1000 / 60 / 60 % 24,
7489 days: total / 1000 / 60 / 60 / 24 };
7490
7491 }
7492
7493 const clsLeave = 'bdt-transition-leave';
7494 const clsEnter = 'bdt-transition-enter';
7495
7496 function fade(action, target, duration, stagger) {if (stagger === void 0) {stagger = 0;}
7497 const index = transitionIndex(target, true);
7498 const propsIn = { opacity: 1 };
7499 const propsOut = { opacity: 0 };
7500
7501 const wrapIndexFn = (fn) => () => index === transitionIndex(target) ? fn() : Promise.reject();
7502
7503 const leaveFn = wrapIndexFn(() => {
7504 addClass(target, clsLeave);
7505
7506 return Promise.all(
7507 getTransitionNodes(target).map(
7508 (child, i) =>
7509 new Promise((resolve) =>
7510 setTimeout(
7511 () =>
7512 Transition.start(child, propsOut, duration / 2, 'ease').then(
7513 resolve),
7514
7515 i * stagger)))).
7516
7517
7518
7519 then(() => removeClass(target, clsLeave));
7520 });
7521
7522 const enterFn = wrapIndexFn(() => {
7523 const oldHeight = height(target);
7524
7525 addClass(target, clsEnter);
7526 action();
7527
7528 css(children(target), { opacity: 0 });
7529
7530 // Ensure bdtUIkit updates have propagated
7531 return new Promise((resolve) =>
7532 requestAnimationFrame(() => {
7533 const nodes = children(target);
7534 const newHeight = height(target);
7535
7536 // Ensure Grid cells do not stretch when height is applied
7537 css(target, 'alignContent', 'flex-start');
7538 height(target, oldHeight);
7539
7540 const transitionNodes = getTransitionNodes(target);
7541 css(nodes, propsOut);
7542
7543 const transitions = transitionNodes.map(
7544 (child, i) =>
7545 new Promise((resolve) =>
7546 setTimeout(
7547 () =>
7548 Transition.start(child, propsIn, duration / 2, 'ease').then(
7549 resolve),
7550
7551 i * stagger)));
7552
7553
7554
7555
7556 if (oldHeight !== newHeight) {
7557 transitions.push(
7558 Transition.start(
7559 target,
7560 { height: newHeight },
7561 duration / 2 + transitionNodes.length * stagger,
7562 'ease'));
7563
7564
7565 }
7566
7567 Promise.all(transitions).then(() => {
7568 removeClass(target, clsEnter);
7569 if (index === transitionIndex(target)) {
7570 css(target, { height: '', alignContent: '' });
7571 css(nodes, { opacity: '' });
7572 delete target.dataset.transition;
7573 }
7574 resolve();
7575 });
7576 }));
7577
7578 });
7579
7580 return hasClass(target, clsLeave) ?
7581 waitTransitionend(target).then(enterFn) :
7582 hasClass(target, clsEnter) ?
7583 waitTransitionend(target).then(leaveFn).then(enterFn) :
7584 leaveFn().then(enterFn);
7585 }
7586
7587 function transitionIndex(target, next) {
7588 if (next) {
7589 target.dataset.transition = 1 + transitionIndex(target);
7590 }
7591
7592 return toNumber(target.dataset.transition) || 0;
7593 }
7594
7595 function waitTransitionend(target) {
7596 return Promise.all(
7597 children(target).
7598 filter(Transition.inProgress).
7599 map(
7600 (el) =>
7601 new Promise((resolve) => once(el, 'transitionend transitioncanceled', resolve))));
7602
7603
7604 }
7605
7606 function getTransitionNodes(target) {
7607 return getRows(children(target)).reduce(
7608 (nodes, row) =>
7609 nodes.concat(
7610 sortBy$1(
7611 row.filter((el) => isInView(el)),
7612 'offsetLeft')),
7613
7614
7615 []);
7616
7617 }
7618
7619 function slide (action, target, duration) {
7620 return new Promise((resolve) =>
7621 requestAnimationFrame(() => {
7622 let nodes = children(target);
7623
7624 // Get current state
7625 const currentProps = nodes.map((el) => getProps(el, true));
7626 const targetProps = css(target, ['height', 'padding']);
7627
7628 // Cancel previous animations
7629 Transition.cancel(target);
7630 nodes.forEach(Transition.cancel);
7631 reset(target);
7632
7633 // Adding, sorting, removing nodes
7634 action();
7635
7636 // Find new nodes
7637 nodes = nodes.concat(children(target).filter((el) => !includes(nodes, el)));
7638
7639 // Wait for update to propagate
7640 Promise.resolve().then(() => {
7641 // Force update
7642 fastdom.flush();
7643
7644 // Get new state
7645 const targetPropsTo = css(target, ['height', 'padding']);
7646 const [propsTo, propsFrom] = getTransitionProps(target, nodes, currentProps);
7647
7648 // Reset to previous state
7649 nodes.forEach((el, i) => propsFrom[i] && css(el, propsFrom[i]));
7650 css(target, { display: 'block', ...targetProps });
7651
7652 // Start transitions on next frame
7653 requestAnimationFrame(() => {
7654 const transitions = nodes.
7655 map(
7656 (el, i) =>
7657 parent(el) === target &&
7658 Transition.start(el, propsTo[i], duration, 'ease')).
7659
7660 concat(Transition.start(target, targetPropsTo, duration, 'ease'));
7661
7662 Promise.all(transitions).
7663 then(() => {
7664 nodes.forEach(
7665 (el, i) =>
7666 parent(el) === target &&
7667 css(el, 'display', propsTo[i].opacity === 0 ? 'none' : ''));
7668
7669 reset(target);
7670 }, noop).
7671 then(resolve);
7672 });
7673 });
7674 }));
7675
7676 }
7677
7678 function getProps(el, opacity) {
7679 const zIndex = css(el, 'zIndex');
7680
7681 return isVisible(el) ?
7682 {
7683 display: '',
7684 opacity: opacity ? css(el, 'opacity') : '0',
7685 pointerEvents: 'none',
7686 position: 'absolute',
7687 zIndex: zIndex === 'auto' ? index(el) : zIndex,
7688 ...getPositionWithMargin(el) } :
7689
7690 false;
7691 }
7692
7693 function getTransitionProps(target, nodes, currentProps) {
7694 const propsTo = nodes.map((el, i) =>
7695 parent(el) && i in currentProps ?
7696 currentProps[i] ?
7697 isVisible(el) ?
7698 getPositionWithMargin(el) :
7699 { opacity: 0 } :
7700 { opacity: isVisible(el) ? 1 : 0 } :
7701 false);
7702
7703
7704 const propsFrom = propsTo.map((props, i) => {
7705 const from = parent(nodes[i]) === target && (currentProps[i] || getProps(nodes[i]));
7706
7707 if (!from) {
7708 return false;
7709 }
7710
7711 if (!props) {
7712 delete from.opacity;
7713 } else if (!('opacity' in props)) {
7714 const { opacity } = from;
7715
7716 if (opacity % 1) {
7717 props.opacity = 1;
7718 } else {
7719 delete from.opacity;
7720 }
7721 }
7722
7723 return from;
7724 });
7725
7726 return [propsTo, propsFrom];
7727 }
7728
7729 function reset(el) {
7730 css(el.children, {
7731 height: '',
7732 left: '',
7733 opacity: '',
7734 pointerEvents: '',
7735 position: '',
7736 top: '',
7737 marginTop: '',
7738 marginLeft: '',
7739 transform: '',
7740 width: '',
7741 zIndex: '' });
7742
7743 css(el, { height: '', display: '', padding: '' });
7744 }
7745
7746 function getPositionWithMargin(el) {
7747 const { height, width } = offset(el);
7748 const { top, left } = position(el);
7749 const { marginLeft, marginTop } = css(el, ['marginTop', 'marginLeft']);
7750
7751 return { top, left, height, width, marginLeft, marginTop, transform: '' };
7752 }
7753
7754 var Animate = {
7755 props: {
7756 duration: Number,
7757 animation: Boolean },
7758
7759
7760 data: {
7761 duration: 150,
7762 animation: 'slide' },
7763
7764
7765 methods: {
7766 animate(action, target) {if (target === void 0) {target = this.$el;}
7767 const name = this.animation;
7768 const animationFn =
7769 name === 'fade' ?
7770 fade :
7771 name === 'delayed-fade' ?
7772 function () {for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {args[_key] = arguments[_key];}return fade(...args, 40);} :
7773 name ?
7774 slide :
7775 () => {
7776 action();
7777 return Promise.resolve();
7778 };
7779
7780 return animationFn(action, target, this.duration).then(
7781 () => this.$update(target, 'resize'),
7782 noop);
7783
7784 } } };
7785
7786 var filter = {
7787 mixins: [Animate],
7788
7789 args: 'target',
7790
7791 props: {
7792 target: Boolean,
7793 selActive: Boolean },
7794
7795
7796 data: {
7797 target: null,
7798 selActive: false,
7799 attrItem: 'bdt-filter-control',
7800 cls: 'bdt-active',
7801 duration: 250 },
7802
7803
7804 computed: {
7805 toggles: {
7806 get(_ref, $el) {let { attrItem } = _ref;
7807 return $$("[" + attrItem + "],[data-" + attrItem + "]", $el);
7808 },
7809
7810 watch() {
7811 this.updateState();
7812
7813 if (this.selActive !== false) {
7814 const actives = $$(this.selActive, this.$el);
7815 this.toggles.forEach((el) => toggleClass(el, this.cls, includes(actives, el)));
7816 }
7817 },
7818
7819 immediate: true },
7820
7821
7822 children: {
7823 get(_ref2, $el) {let { target } = _ref2;
7824 return $$(target + " > *", $el);
7825 },
7826
7827 watch(list, old) {
7828 if (old && !isEqualList(list, old)) {
7829 this.updateState();
7830 }
7831 },
7832
7833 immediate: true } },
7834
7835
7836
7837 events: [
7838 {
7839 name: 'click',
7840
7841 delegate() {
7842 return "[" + this.attrItem + "],[data-" + this.attrItem + "]";
7843 },
7844
7845 handler(e) {
7846 e.preventDefault();
7847 this.apply(e.current);
7848 } }],
7849
7850
7851
7852 methods: {
7853 apply(el) {
7854 const prevState = this.getState();
7855 const newState = mergeState(el, this.attrItem, this.getState());
7856
7857 if (!isEqualState(prevState, newState)) {
7858 this.setState(newState);
7859 }
7860 },
7861
7862 getState() {
7863 return this.toggles.
7864 filter((item) => hasClass(item, this.cls)).
7865 reduce((state, el) => mergeState(el, this.attrItem, state), {
7866 filter: { '': '' },
7867 sort: [] });
7868
7869 },
7870
7871 setState(state, animate) {if (animate === void 0) {animate = true;}
7872 state = { filter: { '': '' }, sort: [], ...state };
7873
7874 trigger(this.$el, 'beforeFilter', [this, state]);
7875
7876 this.toggles.forEach((el) =>
7877 toggleClass(el, this.cls, !!matchFilter(el, this.attrItem, state)));
7878
7879
7880 Promise.all(
7881 $$(this.target, this.$el).map((target) => {
7882 const filterFn = () => {
7883 applyState(state, target, children(target));
7884 this.$update(this.$el);
7885 };
7886 return animate ? this.animate(filterFn, target) : filterFn();
7887 })).
7888 then(() => trigger(this.$el, 'afterFilter', [this]));
7889 },
7890
7891 updateState() {
7892 fastdom.write(() => this.setState(this.getState(), false));
7893 } } };
7894
7895
7896
7897 function getFilter(el, attr) {
7898 return parseOptions(data(el, attr), ['filter']);
7899 }
7900
7901 function isEqualState(stateA, stateB) {
7902 return ['filter', 'sort'].every((prop) => isEqual(stateA[prop], stateB[prop]));
7903 }
7904
7905 function applyState(state, target, children) {
7906 const selector = getSelector(state);
7907
7908 children.forEach((el) => css(el, 'display', selector && !matches(el, selector) ? 'none' : ''));
7909
7910 const [sort, order] = state.sort;
7911
7912 if (sort) {
7913 const sorted = sortItems(children, sort, order);
7914 if (!isEqual(sorted, children)) {
7915 append(target, sorted);
7916 }
7917 }
7918 }
7919
7920 function mergeState(el, attr, state) {
7921 const filterBy = getFilter(el, attr);
7922 const { filter, group, sort, order = 'asc' } = filterBy;
7923
7924 if (filter || isUndefined(sort)) {
7925 if (group) {
7926 if (filter) {
7927 delete state.filter[''];
7928 state.filter[group] = filter;
7929 } else {
7930 delete state.filter[group];
7931
7932 if (isEmpty(state.filter) || '' in state.filter) {
7933 state.filter = { '': filter || '' };
7934 }
7935 }
7936 } else {
7937 state.filter = { '': filter || '' };
7938 }
7939 }
7940
7941 if (!isUndefined(sort)) {
7942 state.sort = [sort, order];
7943 }
7944
7945 return state;
7946 }
7947
7948 function matchFilter(
7949 el,
7950 attr, _ref3)
7951
7952 {let { filter: stateFilter = { '': '' }, sort: [stateSort, stateOrder] } = _ref3;
7953 const { filter = '', group = '', sort, order = 'asc' } = getFilter(el, attr);
7954
7955 return isUndefined(sort) ?
7956 group in stateFilter && filter === stateFilter[group] ||
7957 !filter && group && !(group in stateFilter) && !stateFilter[''] :
7958 stateSort === sort && stateOrder === order;
7959 }
7960
7961 function isEqualList(listA, listB) {
7962 return listA.length === listB.length && listA.every((el) => ~listB.indexOf(el));
7963 }
7964
7965 function getSelector(_ref4) {let { filter } = _ref4;
7966 let selector = '';
7967 each(filter, (value) => selector += value || '');
7968 return selector;
7969 }
7970
7971 function sortItems(nodes, sort, order) {
7972 return [...nodes].sort(
7973 (a, b) =>
7974 data(a, sort).localeCompare(data(b, sort), undefined, { numeric: true }) * (
7975 order === 'asc' || -1));
7976
7977 }
7978
7979 var Animations$2 = {
7980 slide: {
7981 show(dir) {
7982 return [{ transform: translate(dir * -100) }, { transform: translate() }];
7983 },
7984
7985 percent(current) {
7986 return translated(current);
7987 },
7988
7989 translate(percent, dir) {
7990 return [
7991 { transform: translate(dir * -100 * percent) },
7992 { transform: translate(dir * 100 * (1 - percent)) }];
7993
7994 } } };
7995
7996
7997
7998 function translated(el) {
7999 return Math.abs(css(el, 'transform').split(',')[4] / el.offsetWidth) || 0;
8000 }
8001
8002 function translate(value, unit) {if (value === void 0) {value = 0;}if (unit === void 0) {unit = '%';}
8003 value += value ? unit : '';
8004 return "translate3d(" + value + ", 0, 0)";
8005 }
8006
8007 function scale3d(value) {
8008 return "scale3d(" + value + ", " + value + ", 1)";
8009 }
8010
8011 var Animations$1 = {
8012 ...Animations$2,
8013 fade: {
8014 show() {
8015 return [{ opacity: 0 }, { opacity: 1 }];
8016 },
8017
8018 percent(current) {
8019 return 1 - css(current, 'opacity');
8020 },
8021
8022 translate(percent) {
8023 return [{ opacity: 1 - percent }, { opacity: percent }];
8024 } },
8025
8026
8027 scale: {
8028 show() {
8029 return [
8030 { opacity: 0, transform: scale3d(1 - 0.2) },
8031 { opacity: 1, transform: scale3d(1) }];
8032
8033 },
8034
8035 percent(current) {
8036 return 1 - css(current, 'opacity');
8037 },
8038
8039 translate(percent) {
8040 return [
8041 { opacity: 1 - percent, transform: scale3d(1 - 0.2 * percent) },
8042 { opacity: percent, transform: scale3d(1 - 0.2 + 0.2 * percent) }];
8043
8044 } } };
8045
8046 function Transitioner$1(prev, next, dir, _ref) {let { animation, easing } = _ref;
8047 const { percent, translate, show = noop } = animation;
8048 const props = show(dir);
8049 const deferred = new Deferred();
8050
8051 return {
8052 dir,
8053
8054 show(duration, percent, linear) {if (percent === void 0) {percent = 0;}
8055 const timing = linear ? 'linear' : easing;
8056 duration -= Math.round(duration * clamp(percent, -1, 1));
8057
8058 this.translate(percent);
8059
8060 triggerUpdate$1(next, 'itemin', { percent, duration, timing, dir });
8061 triggerUpdate$1(prev, 'itemout', { percent: 1 - percent, duration, timing, dir });
8062
8063 Promise.all([
8064 Transition.start(next, props[1], duration, timing),
8065 Transition.start(prev, props[0], duration, timing)]).
8066 then(() => {
8067 this.reset();
8068 deferred.resolve();
8069 }, noop);
8070
8071 return deferred.promise;
8072 },
8073
8074 cancel() {
8075 Transition.cancel([next, prev]);
8076 },
8077
8078 reset() {
8079 for (const prop in props[0]) {
8080 css([next, prev], prop, '');
8081 }
8082 },
8083
8084 forward(duration, percent) {if (percent === void 0) {percent = this.percent();}
8085 Transition.cancel([next, prev]);
8086 return this.show(duration, percent, true);
8087 },
8088
8089 translate(percent) {
8090 this.reset();
8091
8092 const props = translate(percent, dir);
8093 css(next, props[1]);
8094 css(prev, props[0]);
8095 triggerUpdate$1(next, 'itemtranslatein', { percent, dir });
8096 triggerUpdate$1(prev, 'itemtranslateout', { percent: 1 - percent, dir });
8097 },
8098
8099 percent() {
8100 return percent(prev || next, next, dir);
8101 },
8102
8103 getDistance() {
8104 return prev == null ? void 0 : prev.offsetWidth;
8105 } };
8106
8107 }
8108
8109 function triggerUpdate$1(el, type, data) {
8110 trigger(el, createEvent(type, false, false, data));
8111 }
8112
8113 var SliderAutoplay = {
8114 props: {
8115 autoplay: Boolean,
8116 autoplayInterval: Number,
8117 pauseOnHover: Boolean },
8118
8119
8120 data: {
8121 autoplay: false,
8122 autoplayInterval: 7000,
8123 pauseOnHover: true },
8124
8125
8126 connected() {
8127 this.autoplay && this.startAutoplay();
8128 },
8129
8130 disconnected() {
8131 this.stopAutoplay();
8132 },
8133
8134 update() {
8135 attr(this.slides, 'tabindex', '-1');
8136 },
8137
8138 events: [
8139 {
8140 name: 'visibilitychange',
8141
8142 el() {
8143 return document;
8144 },
8145
8146 filter() {
8147 return this.autoplay;
8148 },
8149
8150 handler() {
8151 if (document.hidden) {
8152 this.stopAutoplay();
8153 } else {
8154 this.startAutoplay();
8155 }
8156 } }],
8157
8158
8159
8160 methods: {
8161 startAutoplay() {
8162 this.stopAutoplay();
8163
8164 this.interval = setInterval(
8165 () =>
8166 (!this.draggable || !$(':focus', this.$el)) && (
8167 !this.pauseOnHover || !matches(this.$el, ':hover')) &&
8168 !this.stack.length &&
8169 this.show('next'),
8170 this.autoplayInterval);
8171
8172 },
8173
8174 stopAutoplay() {
8175 this.interval && clearInterval(this.interval);
8176 } } };
8177
8178 var SliderDrag = {
8179 props: {
8180 draggable: Boolean },
8181
8182
8183 data: {
8184 draggable: true,
8185 threshold: 10 },
8186
8187
8188 created() {
8189 for (const key of ['start', 'move', 'end']) {
8190 const fn = this[key];
8191 this[key] = (e) => {
8192 const pos = getEventPos(e).x * (isRtl ? -1 : 1);
8193
8194 this.prevPos = pos === this.pos ? this.prevPos : this.pos;
8195 this.pos = pos;
8196
8197 fn(e);
8198 };
8199 }
8200 },
8201
8202 events: [
8203 {
8204 name: pointerDown,
8205
8206 delegate() {
8207 return this.selSlides;
8208 },
8209
8210 handler(e) {
8211 if (
8212 !this.draggable ||
8213 !isTouch(e) && hasTextNodesOnly(e.target) ||
8214 closest(e.target, selInput) ||
8215 e.button > 0 ||
8216 this.length < 2)
8217 {
8218 return;
8219 }
8220
8221 this.start(e);
8222 } },
8223
8224
8225 {
8226 name: 'dragstart',
8227
8228 handler(e) {
8229 e.preventDefault();
8230 } }],
8231
8232
8233
8234 methods: {
8235 start() {
8236 this.drag = this.pos;
8237
8238 if (this._transitioner) {
8239 this.percent = this._transitioner.percent();
8240 this.drag += this._transitioner.getDistance() * this.percent * this.dir;
8241
8242 this._transitioner.cancel();
8243 this._transitioner.translate(this.percent);
8244
8245 this.dragging = true;
8246
8247 this.stack = [];
8248 } else {
8249 this.prevIndex = this.index;
8250 }
8251
8252 on(document, pointerMove, this.move, { passive: false });
8253
8254 // 'input' event is triggered by video controls
8255 on(document, pointerUp + " " + pointerCancel + " input", this.end, true);
8256
8257 css(this.list, 'userSelect', 'none');
8258 },
8259
8260 move(e) {
8261 const distance = this.pos - this.drag;
8262
8263 if (
8264 distance === 0 ||
8265 this.prevPos === this.pos ||
8266 !this.dragging && Math.abs(distance) < this.threshold)
8267 {
8268 return;
8269 }
8270
8271 // prevent click event
8272 css(this.list, 'pointerEvents', 'none');
8273
8274 e.cancelable && e.preventDefault();
8275
8276 this.dragging = true;
8277 this.dir = distance < 0 ? 1 : -1;
8278
8279 const { slides } = this;
8280 let { prevIndex } = this;
8281 let dis = Math.abs(distance);
8282 let nextIndex = this.getIndex(prevIndex + this.dir, prevIndex);
8283 let width = this._getDistance(prevIndex, nextIndex) || slides[prevIndex].offsetWidth;
8284
8285 while (nextIndex !== prevIndex && dis > width) {
8286 this.drag -= width * this.dir;
8287
8288 prevIndex = nextIndex;
8289 dis -= width;
8290 nextIndex = this.getIndex(prevIndex + this.dir, prevIndex);
8291 width = this._getDistance(prevIndex, nextIndex) || slides[prevIndex].offsetWidth;
8292 }
8293
8294 this.percent = dis / width;
8295
8296 const prev = slides[prevIndex];
8297 const next = slides[nextIndex];
8298 const changed = this.index !== nextIndex;
8299 const edge = prevIndex === nextIndex;
8300
8301 let itemShown;
8302
8303 [this.index, this.prevIndex].
8304 filter((i) => !includes([nextIndex, prevIndex], i)).
8305 forEach((i) => {
8306 trigger(slides[i], 'itemhidden', [this]);
8307
8308 if (edge) {
8309 itemShown = true;
8310 this.prevIndex = prevIndex;
8311 }
8312 });
8313
8314 if (this.index === prevIndex && this.prevIndex !== prevIndex || itemShown) {
8315 trigger(slides[this.index], 'itemshown', [this]);
8316 }
8317
8318 if (changed) {
8319 this.prevIndex = prevIndex;
8320 this.index = nextIndex;
8321
8322 !edge && trigger(prev, 'beforeitemhide', [this]);
8323 trigger(next, 'beforeitemshow', [this]);
8324 }
8325
8326 this._transitioner = this._translate(Math.abs(this.percent), prev, !edge && next);
8327
8328 if (changed) {
8329 !edge && trigger(prev, 'itemhide', [this]);
8330 trigger(next, 'itemshow', [this]);
8331 }
8332 },
8333
8334 end() {
8335 off(document, pointerMove, this.move, { passive: false });
8336 off(document, pointerUp + " " + pointerCancel + " input", this.end, true);
8337
8338 if (this.dragging) {
8339 this.dragging = null;
8340
8341 if (this.index === this.prevIndex) {
8342 this.percent = 1 - this.percent;
8343 this.dir *= -1;
8344 this._show(false, this.index, true);
8345 this._transitioner = null;
8346 } else {
8347 const dirChange =
8348 (isRtl ? this.dir * (isRtl ? 1 : -1) : this.dir) < 0 ===
8349 this.prevPos > this.pos;
8350 this.index = dirChange ? this.index : this.prevIndex;
8351
8352 if (dirChange) {
8353 this.percent = 1 - this.percent;
8354 }
8355
8356 this.show(
8357 this.dir > 0 && !dirChange || this.dir < 0 && dirChange ?
8358 'next' :
8359 'previous',
8360 true);
8361
8362 }
8363 }
8364
8365 css(this.list, { userSelect: '', pointerEvents: '' });
8366
8367 this.drag = this.percent = null;
8368 } } };
8369
8370
8371
8372 function hasTextNodesOnly(el) {
8373 return !el.children.length && el.childNodes.length;
8374 }
8375
8376 var SliderNav = {
8377 data: {
8378 selNav: false },
8379
8380
8381 computed: {
8382 nav(_ref, $el) {let { selNav } = _ref;
8383 return $(selNav, $el);
8384 },
8385
8386 selNavItem(_ref2) {let { attrItem } = _ref2;
8387 return "[" + attrItem + "],[data-" + attrItem + "]";
8388 },
8389
8390 navItems(_, $el) {
8391 return $$(this.selNavItem, $el);
8392 } },
8393
8394
8395 update: {
8396 write() {
8397 if (this.nav && this.length !== this.nav.children.length) {
8398 html(
8399 this.nav,
8400 this.slides.
8401 map((_, i) => "<li " + this.attrItem + "=\"" + i + "\"><a href></a></li>").
8402 join(''));
8403
8404 }
8405
8406 this.navItems.concat(this.nav).forEach((el) => el && (el.hidden = !this.maxIndex));
8407
8408 this.updateNav();
8409 },
8410
8411 events: ['resize'] },
8412
8413
8414 events: [
8415 {
8416 name: 'click',
8417
8418 delegate() {
8419 return this.selNavItem;
8420 },
8421
8422 handler(e) {
8423 e.preventDefault();
8424 this.show(data(e.current, this.attrItem));
8425 } },
8426
8427
8428 {
8429 name: 'itemshow',
8430 handler: 'updateNav' }],
8431
8432
8433
8434 methods: {
8435 updateNav() {
8436 const i = this.getValidIndex();
8437 for (const el of this.navItems) {
8438 const cmd = data(el, this.attrItem);
8439
8440 toggleClass(el, this.clsActive, toNumber(cmd) === i);
8441 toggleClass(
8442 el,
8443 'bdt-invisible',
8444 this.finite && (
8445 cmd === 'previous' && i === 0 || cmd === 'next' && i >= this.maxIndex));
8446
8447 }
8448 } } };
8449
8450 var Slider = {
8451 mixins: [SliderAutoplay, SliderDrag, SliderNav, Resize],
8452
8453 props: {
8454 clsActivated: Boolean,
8455 easing: String,
8456 index: Number,
8457 finite: Boolean,
8458 velocity: Number,
8459 selSlides: String },
8460
8461
8462 data: () => ({
8463 easing: 'ease',
8464 finite: false,
8465 velocity: 1,
8466 index: 0,
8467 prevIndex: -1,
8468 stack: [],
8469 percent: 0,
8470 clsActive: 'bdt-active',
8471 clsActivated: false,
8472 Transitioner: false,
8473 transitionOptions: {} }),
8474
8475
8476 connected() {
8477 this.prevIndex = -1;
8478 this.index = this.getValidIndex(this.$props.index);
8479 this.stack = [];
8480 },
8481
8482 disconnected() {
8483 removeClass(this.slides, this.clsActive);
8484 },
8485
8486 computed: {
8487 duration(_ref, $el) {let { velocity } = _ref;
8488 return speedUp($el.offsetWidth / velocity);
8489 },
8490
8491 list(_ref2, $el) {let { selList } = _ref2;
8492 return $(selList, $el);
8493 },
8494
8495 maxIndex() {
8496 return this.length - 1;
8497 },
8498
8499 selSlides(_ref3) {let { selList, selSlides } = _ref3;
8500 return selList + " " + (selSlides || '> *');
8501 },
8502
8503 slides: {
8504 get() {
8505 return $$(this.selSlides, this.$el);
8506 },
8507
8508 watch() {
8509 this.$reset();
8510 } },
8511
8512
8513 length() {
8514 return this.slides.length;
8515 } },
8516
8517
8518 methods: {
8519 show(index, force) {if (force === void 0) {force = false;}
8520 if (this.dragging || !this.length) {
8521 return;
8522 }
8523
8524 const { stack } = this;
8525 const queueIndex = force ? 0 : stack.length;
8526 const reset = () => {
8527 stack.splice(queueIndex, 1);
8528
8529 if (stack.length) {
8530 this.show(stack.shift(), true);
8531 }
8532 };
8533
8534 stack[force ? 'unshift' : 'push'](index);
8535
8536 if (!force && stack.length > 1) {
8537 if (stack.length === 2) {
8538 this._transitioner.forward(Math.min(this.duration, 200));
8539 }
8540
8541 return;
8542 }
8543
8544 const prevIndex = this.getIndex(this.index);
8545 const prev = hasClass(this.slides, this.clsActive) && this.slides[prevIndex];
8546 const nextIndex = this.getIndex(index, this.index);
8547 const next = this.slides[nextIndex];
8548
8549 if (prev === next) {
8550 reset();
8551 return;
8552 }
8553
8554 this.dir = getDirection(index, prevIndex);
8555 this.prevIndex = prevIndex;
8556 this.index = nextIndex;
8557
8558 if (
8559 prev && !trigger(prev, 'beforeitemhide', [this]) ||
8560 !trigger(next, 'beforeitemshow', [this, prev]))
8561 {
8562 this.index = this.prevIndex;
8563 reset();
8564 return;
8565 }
8566
8567 const promise = this._show(prev, next, force).then(() => {
8568 prev && trigger(prev, 'itemhidden', [this]);
8569 trigger(next, 'itemshown', [this]);
8570
8571 return new Promise((resolve) => {
8572 fastdom.write(() => {
8573 stack.shift();
8574 if (stack.length) {
8575 this.show(stack.shift(), true);
8576 } else {
8577 this._transitioner = null;
8578 }
8579 resolve();
8580 });
8581 });
8582 });
8583
8584 prev && trigger(prev, 'itemhide', [this]);
8585 trigger(next, 'itemshow', [this]);
8586
8587 return promise;
8588 },
8589
8590 getIndex(index, prev) {if (index === void 0) {index = this.index;}if (prev === void 0) {prev = this.index;}
8591 return clamp(getIndex(index, this.slides, prev, this.finite), 0, this.maxIndex);
8592 },
8593
8594 getValidIndex(index, prevIndex) {if (index === void 0) {index = this.index;}if (prevIndex === void 0) {prevIndex = this.prevIndex;}
8595 return this.getIndex(index, prevIndex);
8596 },
8597
8598 _show(prev, next, force) {
8599 this._transitioner = this._getTransitioner(prev, next, this.dir, {
8600 easing: force ?
8601 next.offsetWidth < 600 ?
8602 'cubic-bezier(0.25, 0.46, 0.45, 0.94)' /* easeOutQuad */ :
8603 'cubic-bezier(0.165, 0.84, 0.44, 1)' /* easeOutQuart */ :
8604 this.easing,
8605 ...this.transitionOptions });
8606
8607
8608 if (!force && !prev) {
8609 this._translate(1);
8610 return Promise.resolve();
8611 }
8612
8613 const { length } = this.stack;
8614 return this._transitioner[length > 1 ? 'forward' : 'show'](
8615 length > 1 ? Math.min(this.duration, 75 + 75 / (length - 1)) : this.duration,
8616 this.percent);
8617
8618 },
8619
8620 _getDistance(prev, next) {
8621 return this._getTransitioner(prev, prev !== next && next).getDistance();
8622 },
8623
8624 _translate(percent, prev, next) {if (prev === void 0) {prev = this.prevIndex;}if (next === void 0) {next = this.index;}
8625 const transitioner = this._getTransitioner(prev !== next ? prev : false, next);
8626 transitioner.translate(percent);
8627 return transitioner;
8628 },
8629
8630 _getTransitioner(
8631 prev,
8632 next,
8633 dir,
8634 options)
8635 {if (prev === void 0) {prev = this.prevIndex;}if (next === void 0) {next = this.index;}if (dir === void 0) {dir = this.dir || 1;}if (options === void 0) {options = this.transitionOptions;}
8636 return new this.Transitioner(
8637 isNumber(prev) ? this.slides[prev] : prev,
8638 isNumber(next) ? this.slides[next] : next,
8639 dir * (isRtl ? -1 : 1),
8640 options);
8641
8642 } } };
8643
8644
8645
8646 function getDirection(index, prevIndex) {
8647 return index === 'next' ? 1 : index === 'previous' ? -1 : index < prevIndex ? -1 : 1;
8648 }
8649
8650 function speedUp(x) {
8651 return 0.5 * x + 300; // parabola through (400,500; 600,600; 1800,1200)
8652 }
8653
8654 var Slideshow = {
8655 mixins: [Slider],
8656
8657 props: {
8658 animation: String },
8659
8660
8661 data: {
8662 animation: 'slide',
8663 clsActivated: 'bdt-transition-active',
8664 Animations: Animations$2,
8665 Transitioner: Transitioner$1 },
8666
8667
8668 computed: {
8669 animation(_ref) {let { animation, Animations } = _ref;
8670 return { ...(Animations[animation] || Animations.slide), name: animation };
8671 },
8672
8673 transitionOptions() {
8674 return { animation: this.animation };
8675 } },
8676
8677
8678 events: {
8679 beforeitemshow(_ref2) {let { target } = _ref2;
8680 addClass(target, this.clsActive);
8681 },
8682
8683 itemshown(_ref3) {let { target } = _ref3;
8684 addClass(target, this.clsActivated);
8685 },
8686
8687 itemhidden(_ref4) {let { target } = _ref4;
8688 removeClass(target, this.clsActive, this.clsActivated);
8689 } } };
8690
8691 var LightboxPanel = {
8692 mixins: [Container, Modal, Togglable, Slideshow],
8693
8694 functional: true,
8695
8696 props: {
8697 delayControls: Number,
8698 preload: Number,
8699 videoAutoplay: Boolean,
8700 template: String },
8701
8702
8703 data: () => ({
8704 preload: 1,
8705 videoAutoplay: false,
8706 delayControls: 3000,
8707 items: [],
8708 cls: 'bdt-open',
8709 clsPage: 'bdt-lightbox-page',
8710 selList: '.bdt-lightbox-items',
8711 attrItem: 'bdt-lightbox-item',
8712 selClose: '.bdt-close-large',
8713 selCaption: '.bdt-lightbox-caption',
8714 pauseOnHover: false,
8715 velocity: 2,
8716 Animations: Animations$1,
8717 template: "<div class=\"bdt-lightbox bdt-overflow-hidden\"> <ul class=\"bdt-lightbox-items\"></ul> <div class=\"bdt-lightbox-toolbar bdt-position-top bdt-text-right bdt-transition-slide-top bdt-transition-opaque\"> <button class=\"bdt-lightbox-toolbar-icon bdt-close-large\" type=\"button\" bdt-close></button> </div> <a class=\"bdt-lightbox-button bdt-position-center-left bdt-position-medium bdt-transition-fade\" href bdt-slidenav-previous bdt-lightbox-item=\"previous\"></a> <a class=\"bdt-lightbox-button bdt-position-center-right bdt-position-medium bdt-transition-fade\" href bdt-slidenav-next bdt-lightbox-item=\"next\"></a> <div class=\"bdt-lightbox-toolbar bdt-lightbox-caption bdt-position-bottom bdt-text-center bdt-transition-slide-bottom bdt-transition-opaque\"></div> </div>" }),
8718
8719
8720
8721
8722
8723
8724
8725
8726
8727
8728 created() {
8729 const $el = $(this.template);
8730 const list = $(this.selList, $el);
8731 this.items.forEach(() => append(list, '<li>'));
8732
8733 this.$mount(append(this.container, $el));
8734 },
8735
8736 computed: {
8737 caption(_ref, $el) {let { selCaption } = _ref;
8738 return $(selCaption, $el);
8739 } },
8740
8741
8742 events: [
8743 {
8744 name: pointerMove + " " + pointerDown + " keydown",
8745
8746 handler: 'showControls' },
8747
8748
8749 {
8750 name: 'click',
8751
8752 self: true,
8753
8754 delegate() {
8755 return this.selSlides;
8756 },
8757
8758 handler(e) {
8759 if (e.defaultPrevented) {
8760 return;
8761 }
8762
8763 this.hide();
8764 } },
8765
8766
8767 {
8768 name: 'shown',
8769
8770 self: true,
8771
8772 handler() {
8773 this.showControls();
8774 } },
8775
8776
8777 {
8778 name: 'hide',
8779
8780 self: true,
8781
8782 handler() {
8783 this.hideControls();
8784
8785 removeClass(this.slides, this.clsActive);
8786 Transition.stop(this.slides);
8787 } },
8788
8789
8790 {
8791 name: 'hidden',
8792
8793 self: true,
8794
8795 handler() {
8796 this.$destroy(true);
8797 } },
8798
8799
8800 {
8801 name: 'keyup',
8802
8803 el() {
8804 return document;
8805 },
8806
8807 handler(e) {
8808 if (!this.isToggled(this.$el) || !this.draggable) {
8809 return;
8810 }
8811
8812 switch (e.keyCode) {
8813 case 37:
8814 this.show('previous');
8815 break;
8816 case 39:
8817 this.show('next');
8818 break;}
8819
8820 } },
8821
8822
8823 {
8824 name: 'beforeitemshow',
8825
8826 handler(e) {
8827 if (this.isToggled()) {
8828 return;
8829 }
8830
8831 this.draggable = false;
8832
8833 e.preventDefault();
8834
8835 this.toggleElement(this.$el, true, false);
8836
8837 this.animation = Animations$1['scale'];
8838 removeClass(e.target, this.clsActive);
8839 this.stack.splice(1, 0, this.index);
8840 } },
8841
8842
8843 {
8844 name: 'itemshow',
8845
8846 handler() {
8847 html(this.caption, this.getItem().caption || '');
8848
8849 for (let j = -this.preload; j <= this.preload; j++) {
8850 this.loadItem(this.index + j);
8851 }
8852 } },
8853
8854
8855 {
8856 name: 'itemshown',
8857
8858 handler() {
8859 this.draggable = this.$props.draggable;
8860 } },
8861
8862
8863 {
8864 name: 'itemload',
8865
8866 async handler(_, item) {
8867 const { source: src, type, alt = '', poster, attrs = {} } = item;
8868
8869 this.setItem(item, '<span bdt-spinner></span>');
8870
8871 if (!src) {
8872 return;
8873 }
8874
8875 let matches;
8876 const iframeAttrs = {
8877 frameborder: '0',
8878 allow: 'autoplay',
8879 allowfullscreen: '',
8880 style: 'max-width: 100%; box-sizing: border-box;',
8881 'bdt-responsive': '',
8882 'bdt-video': "" + this.videoAutoplay };
8883
8884
8885 // Image
8886 if (type === 'image' || src.match(/\.(avif|jpe?g|a?png|gif|svg|webp)($|\?)/i)) {
8887 try {
8888 const { width, height } = await getImage(src, attrs.srcset, attrs.size);
8889 this.setItem(item, createEl('img', { src, width, height, alt, ...attrs }));
8890 } catch (e) {
8891 this.setError(item);
8892 }
8893
8894 // Video
8895 } else if (type === 'video' || src.match(/\.(mp4|webm|ogv)($|\?)/i)) {
8896 const video = createEl('video', {
8897 src,
8898 poster,
8899 controls: '',
8900 playsinline: '',
8901 'bdt-video': "" + this.videoAutoplay,
8902 ...attrs });
8903
8904
8905 on(video, 'loadedmetadata', () => {
8906 attr(video, { width: video.videoWidth, height: video.videoHeight });
8907 this.setItem(item, video);
8908 });
8909 on(video, 'error', () => this.setError(item));
8910
8911 // Iframe
8912 } else if (type === 'iframe' || src.match(/\.(html|php)($|\?)/i)) {
8913 this.setItem(
8914 item,
8915 createEl('iframe', {
8916 src,
8917 frameborder: '0',
8918 allowfullscreen: '',
8919 class: 'bdt-lightbox-iframe',
8920 ...attrs }));
8921
8922
8923
8924 // YouTube
8925 } else if (
8926 matches = src.match(
8927 /\/\/(?:.*?youtube(-nocookie)?\..*?[?&]v=|youtu\.be\/)([\w-]{11})[&?]?(.*)?/))
8928
8929 {
8930 this.setItem(
8931 item,
8932 createEl('iframe', {
8933 src: "https://www.youtube" + (matches[1] || '') + ".com/embed/" + matches[2] + (
8934 matches[3] ? "?" + matches[3] : ''),
8935
8936 width: 1920,
8937 height: 1080,
8938 ...iframeAttrs,
8939 ...attrs }));
8940
8941
8942
8943 // Vimeo
8944 } else if (matches = src.match(/\/\/.*?vimeo\.[a-z]+\/(\d+)[&?]?(.*)?/)) {
8945 try {
8946 const { height, width } = await (
8947 await fetch("https://vimeo.com/api/oembed.json?maxwidth=1920&url=" +
8948 encodeURI(
8949 src),
8950
8951 {
8952 credentials: 'omit' })).
8953
8954
8955 json();
8956
8957 this.setItem(
8958 item,
8959 createEl('iframe', {
8960 src: "https://player.vimeo.com/video/" + matches[1] + (
8961 matches[2] ? "?" + matches[2] : ''),
8962
8963 width,
8964 height,
8965 ...iframeAttrs,
8966 ...attrs }));
8967
8968
8969 } catch (e) {
8970 this.setError(item);
8971 }
8972 }
8973 } }],
8974
8975
8976
8977 methods: {
8978 loadItem(index) {if (index === void 0) {index = this.index;}
8979 const item = this.getItem(index);
8980
8981 if (!this.getSlide(item).childElementCount) {
8982 trigger(this.$el, 'itemload', [item]);
8983 }
8984 },
8985
8986 getItem(index) {if (index === void 0) {index = this.index;}
8987 return this.items[getIndex(index, this.slides)];
8988 },
8989
8990 setItem(item, content) {
8991 trigger(this.$el, 'itemloaded', [this, html(this.getSlide(item), content)]);
8992 },
8993
8994 getSlide(item) {
8995 return this.slides[this.items.indexOf(item)];
8996 },
8997
8998 setError(item) {
8999 this.setItem(item, '<span bdt-icon="icon: bolt; ratio: 2"></span>');
9000 },
9001
9002 showControls() {
9003 clearTimeout(this.controlsTimer);
9004 this.controlsTimer = setTimeout(this.hideControls, this.delayControls);
9005
9006 addClass(this.$el, 'bdt-active', 'bdt-transition-active');
9007 },
9008
9009 hideControls() {
9010 removeClass(this.$el, 'bdt-active', 'bdt-transition-active');
9011 } } };
9012
9013
9014
9015 function createEl(tag, attrs) {
9016 const el = fragment("<" + tag + ">");
9017 attr(el, attrs);
9018 return el;
9019 }
9020
9021 var lightbox = {
9022 install: install$1,
9023
9024 props: { toggle: String },
9025
9026 data: { toggle: 'a' },
9027
9028 computed: {
9029 toggles: {
9030 get(_ref, $el) {let { toggle } = _ref;
9031 return $$(toggle, $el);
9032 },
9033
9034 watch() {
9035 this.hide();
9036 } } },
9037
9038
9039
9040 disconnected() {
9041 this.hide();
9042 },
9043
9044 events: [
9045 {
9046 name: 'click',
9047
9048 delegate() {
9049 return this.toggle + ":not(.bdt-disabled)";
9050 },
9051
9052 handler(e) {
9053 e.preventDefault();
9054 this.show(e.current);
9055 } }],
9056
9057
9058
9059 methods: {
9060 show(index) {
9061 const items = uniqueBy(this.toggles.map(toItem), 'source');
9062
9063 if (isElement(index)) {
9064 const { source } = toItem(index);
9065 index = findIndex(items, (_ref2) => {let { source: src } = _ref2;return source === src;});
9066 }
9067
9068 this.panel = this.panel || this.$create('lightboxPanel', { ...this.$props, items });
9069
9070 on(this.panel.$el, 'hidden', () => this.panel = false);
9071
9072 return this.panel.show(index);
9073 },
9074
9075 hide() {var _this$panel;
9076 return (_this$panel = this.panel) == null ? void 0 : _this$panel.hide();
9077 } } };
9078
9079
9080
9081 function install$1(bdtUIkit, Lightbox) {
9082 if (!bdtUIkit.lightboxPanel) {
9083 bdtUIkit.component('lightboxPanel', LightboxPanel);
9084 }
9085
9086 assign(Lightbox.props, bdtUIkit.component('lightboxPanel').options.props);
9087 }
9088
9089 function toItem(el) {
9090 const item = {};
9091
9092 for (const attr of ['href', 'caption', 'type', 'poster', 'alt', 'attrs']) {
9093 item[attr === 'href' ? 'source' : attr] = data(el, attr);
9094 }
9095
9096 item.attrs = parseOptions(item.attrs);
9097
9098 return item;
9099 }
9100
9101 var notification = {
9102 mixins: [Container],
9103
9104 functional: true,
9105
9106 args: ['message', 'status'],
9107
9108 data: {
9109 message: '',
9110 status: '',
9111 timeout: 5000,
9112 group: null,
9113 pos: 'top-center',
9114 clsContainer: 'bdt-notification',
9115 clsClose: 'bdt-notification-close',
9116 clsMsg: 'bdt-notification-message' },
9117
9118
9119 install,
9120
9121 computed: {
9122 marginProp(_ref) {let { pos } = _ref;
9123 return "margin" + (startsWith(pos, 'top') ? 'Top' : 'Bottom');
9124 },
9125
9126 startProps() {
9127 return { opacity: 0, [this.marginProp]: -this.$el.offsetHeight };
9128 } },
9129
9130
9131 created() {
9132 const container =
9133 $("." + this.clsContainer + "-" + this.pos, this.container) ||
9134 append(
9135 this.container, "<div class=\"" +
9136 this.clsContainer + " " + this.clsContainer + "-" + this.pos + "\" style=\"display: block\"></div>");
9137
9138
9139 this.$mount(
9140 append(
9141 container, "<div class=\"" +
9142 this.clsMsg + (this.status ? " " + this.clsMsg + "-" + this.status : '') + "\"> <a href class=\"" +
9143 this.clsClose + "\" data-bdt-close></a> <div>" +
9144 this.message + "</div> </div>"));
9145
9146
9147
9148 },
9149
9150 async connected() {
9151 const margin = toFloat(css(this.$el, this.marginProp));
9152 await Transition.start(css(this.$el, this.startProps), {
9153 opacity: 1,
9154 [this.marginProp]: margin });
9155
9156
9157 if (this.timeout) {
9158 this.timer = setTimeout(this.close, this.timeout);
9159 }
9160 },
9161
9162 events: {
9163 click(e) {
9164 if (closest(e.target, 'a[href="#"],a[href=""]')) {
9165 e.preventDefault();
9166 }
9167 this.close();
9168 },
9169
9170 [pointerEnter]() {
9171 if (this.timer) {
9172 clearTimeout(this.timer);
9173 }
9174 },
9175
9176 [pointerLeave]() {
9177 if (this.timeout) {
9178 this.timer = setTimeout(this.close, this.timeout);
9179 }
9180 } },
9181
9182
9183 methods: {
9184 async close(immediate) {
9185 const removeFn = (el) => {
9186 const container = parent(el);
9187
9188 trigger(el, 'close', [this]);
9189 remove$1(el);
9190
9191 if (!(container != null && container.hasChildNodes())) {
9192 remove$1(container);
9193 }
9194 };
9195
9196 if (this.timer) {
9197 clearTimeout(this.timer);
9198 }
9199
9200 if (!immediate) {
9201 await Transition.start(this.$el, this.startProps);
9202 }
9203
9204 removeFn(this.$el);
9205 } } };
9206
9207
9208
9209 function install(bdtUIkit) {
9210 bdtUIkit.notification.closeAll = function (group, immediate) {
9211 apply(document.body, (el) => {
9212 const notification = bdtUIkit.getComponent(el, 'notification');
9213 if (notification && (!group || group === notification.group)) {
9214 notification.close(immediate);
9215 }
9216 });
9217 };
9218 }
9219
9220 const props = {
9221 x: transformFn,
9222 y: transformFn,
9223 rotate: transformFn,
9224 scale: transformFn,
9225 color: colorFn,
9226 backgroundColor: colorFn,
9227 borderColor: colorFn,
9228 blur: filterFn,
9229 hue: filterFn,
9230 fopacity: filterFn,
9231 grayscale: filterFn,
9232 invert: filterFn,
9233 saturate: filterFn,
9234 sepia: filterFn,
9235 opacity: cssPropFn,
9236 stroke: strokeFn,
9237 bgx: backgroundFn,
9238 bgy: backgroundFn };
9239
9240
9241 const { keys } = Object;
9242
9243 var Parallax = {
9244 mixins: [Media],
9245
9246 props: fillObject(keys(props), 'list'),
9247
9248 data: fillObject(keys(props), undefined),
9249
9250 computed: {
9251 props(properties, $el) {
9252 return keys(props).reduce((result, prop) => {
9253 if (!isUndefined(properties[prop])) {
9254 result[prop] = props[prop](prop, $el, properties[prop].slice());
9255 }
9256 return result;
9257 }, {});
9258 } },
9259
9260
9261 events: {
9262 load() {
9263 this.$emit();
9264 } },
9265
9266
9267 methods: {
9268 reset() {
9269 each(this.getCss(0), (_, prop) => css(this.$el, prop, ''));
9270 },
9271
9272 getCss(percent) {
9273 const css = { transform: '', filter: '' };
9274 for (const prop in this.props) {
9275 this.props[prop](css, percent);
9276 }
9277 return css;
9278 } } };
9279
9280
9281
9282 function transformFn(prop, el, stops) {
9283 const unit = getUnit(stops) || { x: 'px', y: 'px', rotate: 'deg' }[prop] || '';
9284 let transformFn;
9285
9286 if (prop === 'x' || prop === 'y') {
9287 prop = "translate" + ucfirst(prop);
9288 transformFn = (stop) => toFloat(toFloat(stop).toFixed(unit === 'px' ? 0 : 6));
9289 }
9290
9291 if (stops.length === 1) {
9292 stops.unshift(prop === 'scale' ? 1 : 0);
9293 }
9294
9295 stops = parseStops(stops, transformFn);
9296
9297 return (css, percent) => {
9298 css.transform += " " + prop + "(" + getValue(stops, percent) + unit + ")";
9299 };
9300 }
9301
9302 function colorFn(prop, el, stops) {
9303 if (stops.length === 1) {
9304 stops.unshift(getCssValue(el, prop, ''));
9305 }
9306
9307 stops = parseStops(stops, (stop) => parseColor(el, stop));
9308
9309 return (css, percent) => {
9310 const [start, end, p] = getStop(stops, percent);
9311 const value = start.
9312 map((value, i) => {
9313 value += p * (end[i] - value);
9314 return i === 3 ? toFloat(value) : parseInt(value, 10);
9315 }).
9316 join(',');
9317 css[prop] = "rgba(" + value + ")";
9318 };
9319 }
9320
9321 function parseColor(el, color) {
9322 return getCssValue(el, 'color', color).
9323 split(/[(),]/g).
9324 slice(1, -1).
9325 concat(1).
9326 slice(0, 4).
9327 map(toFloat);
9328 }
9329
9330 function filterFn(prop, el, stops) {
9331 if (stops.length === 1) {
9332 stops.unshift(0);
9333 }
9334
9335 const unit = getUnit(stops) || { blur: 'px', hue: 'deg' }[prop] || '%';
9336 prop = { fopacity: 'opacity', hue: 'hue-rotate' }[prop] || prop;
9337 stops = parseStops(stops);
9338
9339 return (css, percent) => {
9340 const value = getValue(stops, percent);
9341 css.filter += " " + prop + "(" + (value + unit) + ")";
9342 };
9343 }
9344
9345 function cssPropFn(prop, el, stops) {
9346 if (stops.length === 1) {
9347 stops.unshift(getCssValue(el, prop, ''));
9348 }
9349
9350 stops = parseStops(stops);
9351
9352 return (css, percent) => {
9353 css[prop] = getValue(stops, percent);
9354 };
9355 }
9356
9357 function strokeFn(prop, el, stops) {
9358 if (stops.length === 1) {
9359 stops.unshift(0);
9360 }
9361
9362 const unit = getUnit(stops);
9363 const length = getMaxPathLength(el);
9364 stops = parseStops(stops.reverse(), (stop) => {
9365 stop = toFloat(stop);
9366 return unit === '%' ? stop * length / 100 : stop;
9367 });
9368
9369 if (!stops.some((_ref) => {let [value] = _ref;return value;})) {
9370 return noop;
9371 }
9372
9373 css(el, 'strokeDasharray', length);
9374
9375 return (css, percent) => {
9376 css.strokeDashoffset = getValue(stops, percent);
9377 };
9378 }
9379
9380 function backgroundFn(prop, el, stops) {
9381 if (stops.length === 1) {
9382 stops.unshift(0);
9383 }
9384
9385 prop = prop.substr(-1);
9386 const attr = prop === 'y' ? 'height' : 'width';
9387 stops = parseStops(stops, (stop) => toPx(stop, attr, el));
9388
9389 const bgPos = getCssValue(el, "background-position-" + prop, '');
9390
9391 return getCssValue(el, 'backgroundSize', '') === 'cover' ?
9392 backgroundCoverFn(prop, el, stops, bgPos, attr) :
9393 setBackgroundPosFn(prop, stops, bgPos);
9394 }
9395
9396 function backgroundCoverFn(prop, el, stops, bgPos, attr) {
9397 const dimImage = getBackgroundImageDimensions(el);
9398
9399 if (!dimImage.width) {
9400 return noop;
9401 }
9402
9403 const values = stops.map((_ref2) => {let [value] = _ref2;return value;});
9404 const min = Math.min(...values);
9405 const max = Math.max(...values);
9406 const down = values.indexOf(min) < values.indexOf(max);
9407
9408 const diff = max - min;
9409 let pos = (down ? -diff : 0) - (down ? min : max);
9410
9411 const dimEl = {
9412 width: el.offsetWidth,
9413 height: el.offsetHeight };
9414
9415
9416 const baseDim = Dimensions.cover(dimImage, dimEl);
9417 const span = baseDim[attr] - dimEl[attr];
9418
9419 if (span < diff) {
9420 dimEl[attr] = baseDim[attr] + diff - span;
9421 } else if (span > diff) {
9422 const posPercentage = dimEl[attr] / toPx(bgPos, attr, el, true);
9423
9424 if (posPercentage) {
9425 pos -= (span - diff) / posPercentage;
9426 }
9427 }
9428
9429 const dim = Dimensions.cover(dimImage, dimEl);
9430
9431 const fn = setBackgroundPosFn(prop, stops, pos + "px");
9432 return (css, percent) => {
9433 fn(css, percent);
9434 css.backgroundSize = dim.width + "px " + dim.height + "px";
9435 css.backgroundRepeat = 'no-repeat';
9436 };
9437 }
9438
9439 function setBackgroundPosFn(prop, stops, pos) {
9440 return function (css, percent) {
9441 css["background-position-" + prop] = "calc(" + pos + " + " + getValue(stops, percent) + "px)";
9442 };
9443 }
9444
9445 const dimensions = {};
9446 function getBackgroundImageDimensions(el) {
9447 const src = css(el, 'backgroundImage').replace(/^none|url\(["']?(.+?)["']?\)$/, '$1');
9448
9449 if (dimensions[src]) {
9450 return dimensions[src];
9451 }
9452
9453 const image = new Image();
9454 if (src) {
9455 image.src = src;
9456
9457 if (!image.naturalWidth) {
9458 image.onload = () => {
9459 dimensions[src] = toDimensions(image);
9460 trigger(el, createEvent('load', false));
9461 };
9462 return toDimensions(image);
9463 }
9464 }
9465
9466 return dimensions[src] = toDimensions(image);
9467 }
9468
9469 function toDimensions(image) {
9470 return {
9471 width: image.naturalWidth,
9472 height: image.naturalHeight };
9473
9474 }
9475
9476 function parseStops(stops, fn) {if (fn === void 0) {fn = toFloat;}
9477 const result = [];
9478 const { length } = stops;
9479 let nullIndex = 0;
9480 for (let i = 0; i < length; i++) {
9481 let [value, percent] = isString(stops[i]) ? stops[i].trim().split(' ') : [stops[i]];
9482 value = fn(value);
9483 percent = percent ? toFloat(percent) / 100 : null;
9484
9485 if (i === 0) {
9486 if (percent === null) {
9487 percent = 0;
9488 } else if (percent) {
9489 result.push([value, 0]);
9490 }
9491 } else if (i === length - 1) {
9492 if (percent === null) {
9493 percent = 1;
9494 } else if (percent !== 1) {
9495 result.push([value, percent]);
9496 percent = 1;
9497 }
9498 }
9499
9500 result.push([value, percent]);
9501
9502 if (percent === null) {
9503 nullIndex++;
9504 } else if (nullIndex) {
9505 const leftPercent = result[i - nullIndex - 1][1];
9506 const p = (percent - leftPercent) / (nullIndex + 1);
9507 for (let j = nullIndex; j > 0; j--) {
9508 result[i - j][1] = leftPercent + p * (nullIndex - j + 1);
9509 }
9510
9511 nullIndex = 0;
9512 }
9513 }
9514
9515 return result;
9516 }
9517
9518 function getStop(stops, percent) {
9519 const index = findIndex(stops.slice(1), (_ref3) => {let [, targetPercent] = _ref3;return percent <= targetPercent;}) + 1;
9520 return [
9521 stops[index - 1][0],
9522 stops[index][0],
9523 (percent - stops[index - 1][1]) / (stops[index][1] - stops[index - 1][1])];
9524
9525 }
9526
9527 function getValue(stops, percent) {
9528 const [start, end, p] = getStop(stops, percent);
9529 return isNumber(start) ? start + Math.abs(start - end) * p * (start < end ? 1 : -1) : +end;
9530 }
9531
9532 const unitRe = /^-?\d+([^\s]*)/;
9533 function getUnit(stops, defaultUnit) {
9534 for (const stop of stops) {
9535 const match = stop.match == null ? void 0 : stop.match(unitRe);
9536 if (match) {
9537 return match[1];
9538 }
9539 }
9540 return defaultUnit;
9541 }
9542
9543 function getCssValue(el, prop, value) {
9544 const prev = el.style[prop];
9545 const val = css(css(el, prop, value), prop);
9546 el.style[prop] = prev;
9547 return val;
9548 }
9549
9550 function fillObject(keys, value) {
9551 return keys.reduce((data, prop) => {
9552 data[prop] = value;
9553 return data;
9554 }, {});
9555 }
9556
9557 var parallax = {
9558 mixins: [Parallax, Resize, Scroll],
9559
9560 props: {
9561 target: String,
9562 viewport: Number, // Deprecated
9563 easing: Number,
9564 start: String,
9565 end: String },
9566
9567
9568 data: {
9569 target: false,
9570 viewport: 1,
9571 easing: 1,
9572 start: 0,
9573 end: 0 },
9574
9575
9576 computed: {
9577 target(_ref, $el) {let { target } = _ref;
9578 return getOffsetElement(target && query(target, $el) || $el);
9579 },
9580
9581 start(_ref2) {let { start } = _ref2;
9582 return toPx(start, 'height', this.target, true);
9583 },
9584
9585 end(_ref3) {let { end, viewport } = _ref3;
9586 return toPx(
9587 end || (viewport = (1 - viewport) * 100) && viewport + "vh+" + viewport + "%",
9588 'height',
9589 this.target,
9590 true);
9591
9592 } },
9593
9594
9595 update: {
9596 read(_ref4, types) {let { percent } = _ref4;
9597 if (!types.has('scroll')) {
9598 percent = false;
9599 }
9600
9601 if (!this.matchMedia) {
9602 return;
9603 }
9604
9605 const prev = percent;
9606 percent = ease(scrolledOver(this.target, this.start, this.end), this.easing);
9607
9608 return {
9609 percent,
9610 style: prev === percent ? false : this.getCss(percent) };
9611
9612 },
9613
9614 write(_ref5) {let { style } = _ref5;
9615 if (!this.matchMedia) {
9616 this.reset();
9617 return;
9618 }
9619
9620 style && css(this.$el, style);
9621 },
9622
9623 events: ['scroll', 'resize'] } };
9624
9625
9626
9627 function ease(percent, easing) {
9628 return easing >= 0 ? Math.pow(percent, easing + 1) : 1 - Math.pow(1 - percent, -easing + 1);
9629 }
9630
9631 // SVG elements do not inherit from HTMLElement
9632 function getOffsetElement(el) {
9633 return el ? 'offsetTop' in el ? el : getOffsetElement(parent(el)) : document.documentElement;
9634 }
9635
9636 var SliderReactive = {
9637 update: {
9638 write() {
9639 if (this.stack.length || this.dragging) {
9640 return;
9641 }
9642
9643 const index = this.getValidIndex(this.index);
9644
9645 if (!~this.prevIndex || this.index !== index) {
9646 this.show(index);
9647 }
9648 },
9649
9650 events: ['resize'] } };
9651
9652 var SliderPreload = {
9653 mixins: [Lazyload],
9654
9655 connected() {
9656 this.lazyload(this.slides, this.getAdjacentSlides);
9657 } };
9658
9659 function Transitioner (prev, next, dir, _ref) {let { center, easing, list } = _ref;
9660 const deferred = new Deferred();
9661
9662 const from = prev ?
9663 getLeft(prev, list, center) :
9664 getLeft(next, list, center) + dimensions$1(next).width * dir;
9665 const to = next ?
9666 getLeft(next, list, center) :
9667 from + dimensions$1(prev).width * dir * (isRtl ? -1 : 1);
9668
9669 return {
9670 dir,
9671
9672 show(duration, percent, linear) {if (percent === void 0) {percent = 0;}
9673 const timing = linear ? 'linear' : easing;
9674 duration -= Math.round(duration * clamp(percent, -1, 1));
9675
9676 this.translate(percent);
9677
9678 percent = prev ? percent : clamp(percent, 0, 1);
9679 triggerUpdate(this.getItemIn(), 'itemin', { percent, duration, timing, dir });
9680 prev &&
9681 triggerUpdate(this.getItemIn(true), 'itemout', {
9682 percent: 1 - percent,
9683 duration,
9684 timing,
9685 dir });
9686
9687
9688 Transition.start(
9689 list,
9690 { transform: translate(-to * (isRtl ? -1 : 1), 'px') },
9691 duration,
9692 timing).
9693 then(deferred.resolve, noop);
9694
9695 return deferred.promise;
9696 },
9697
9698 cancel() {
9699 Transition.cancel(list);
9700 },
9701
9702 reset() {
9703 css(list, 'transform', '');
9704 },
9705
9706 forward(duration, percent) {if (percent === void 0) {percent = this.percent();}
9707 Transition.cancel(list);
9708 return this.show(duration, percent, true);
9709 },
9710
9711 translate(percent) {
9712 const distance = this.getDistance() * dir * (isRtl ? -1 : 1);
9713
9714 css(
9715 list,
9716 'transform',
9717 translate(
9718 clamp(
9719 -to + (distance - distance * percent),
9720 -getWidth(list),
9721 dimensions$1(list).width) * (
9722 isRtl ? -1 : 1),
9723 'px'));
9724
9725
9726
9727 const actives = this.getActives();
9728 const itemIn = this.getItemIn();
9729 const itemOut = this.getItemIn(true);
9730
9731 percent = prev ? clamp(percent, -1, 1) : 0;
9732
9733 for (const slide of children(list)) {
9734 const isActive = includes(actives, slide);
9735 const isIn = slide === itemIn;
9736 const isOut = slide === itemOut;
9737 const translateIn =
9738 isIn ||
9739 !isOut && (
9740 isActive ||
9741 dir * (isRtl ? -1 : 1) === -1 ^
9742 getElLeft(slide, list) > getElLeft(prev || next));
9743
9744 triggerUpdate(slide, "itemtranslate" + (translateIn ? 'in' : 'out'), {
9745 dir,
9746 percent: isOut ? 1 - percent : isIn ? percent : isActive ? 1 : 0 });
9747
9748 }
9749 },
9750
9751 percent() {
9752 return Math.abs(
9753 (css(list, 'transform').split(',')[4] * (isRtl ? -1 : 1) + from) / (to - from));
9754
9755 },
9756
9757 getDistance() {
9758 return Math.abs(to - from);
9759 },
9760
9761 getItemIn(out) {if (out === void 0) {out = false;}
9762 let actives = this.getActives();
9763 let nextActives = inView(list, getLeft(next || prev, list, center));
9764
9765 if (out) {
9766 const temp = actives;
9767 actives = nextActives;
9768 nextActives = temp;
9769 }
9770
9771 return nextActives[findIndex(nextActives, (el) => !includes(actives, el))];
9772 },
9773
9774 getActives() {
9775 return inView(list, getLeft(prev || next, list, center));
9776 } };
9777
9778 }
9779
9780 function getLeft(el, list, center) {
9781 const left = getElLeft(el, list);
9782
9783 return center ? left - centerEl(el, list) : Math.min(left, getMax(list));
9784 }
9785
9786 function getMax(list) {
9787 return Math.max(0, getWidth(list) - dimensions$1(list).width);
9788 }
9789
9790 function getWidth(list) {
9791 return children(list).reduce((right, el) => dimensions$1(el).width + right, 0);
9792 }
9793
9794 function centerEl(el, list) {
9795 return dimensions$1(list).width / 2 - dimensions$1(el).width / 2;
9796 }
9797
9798 function getElLeft(el, list) {
9799 return (
9800 el &&
9801 (position(el).left + (isRtl ? dimensions$1(el).width - dimensions$1(list).width : 0)) * (
9802 isRtl ? -1 : 1) ||
9803 0);
9804
9805 }
9806
9807 function inView(list, listLeft) {
9808 listLeft -= 1;
9809 const listWidth = dimensions$1(list).width;
9810 const listRight = listLeft + listWidth + 2;
9811
9812 return children(list).filter((slide) => {
9813 const slideLeft = getElLeft(slide, list);
9814 const slideRight = slideLeft + Math.min(dimensions$1(slide).width, listWidth);
9815
9816 return slideLeft >= listLeft && slideRight <= listRight;
9817 });
9818 }
9819
9820 function triggerUpdate(el, type, data) {
9821 trigger(el, createEvent(type, false, false, data));
9822 }
9823
9824 var slider = {
9825 mixins: [Class, Slider, SliderReactive, SliderPreload],
9826
9827 props: {
9828 center: Boolean,
9829 sets: Boolean },
9830
9831
9832 data: {
9833 center: false,
9834 sets: false,
9835 attrItem: 'bdt-slider-item',
9836 selList: '.bdt-slider-items',
9837 selNav: '.bdt-slider-nav',
9838 clsContainer: 'bdt-slider-container',
9839 Transitioner },
9840
9841
9842 computed: {
9843 avgWidth() {
9844 return getWidth(this.list) / this.length;
9845 },
9846
9847 finite(_ref) {let { finite } = _ref;
9848 return (
9849 finite ||
9850 Math.ceil(getWidth(this.list)) <
9851 Math.trunc(dimensions$1(this.list).width + getMaxElWidth(this.list) + this.center));
9852
9853 },
9854
9855 maxIndex() {
9856 if (!this.finite || this.center && !this.sets) {
9857 return this.length - 1;
9858 }
9859
9860 if (this.center) {
9861 return last(this.sets);
9862 }
9863
9864 let lft = 0;
9865 const max = getMax(this.list);
9866 const index = findIndex(this.slides, (el) => {
9867 if (lft >= max) {
9868 return true;
9869 }
9870
9871 lft += dimensions$1(el).width;
9872 });
9873
9874 return ~index ? index : this.length - 1;
9875 },
9876
9877 sets(_ref2) {let { sets: enabled } = _ref2;
9878 if (!enabled) {
9879 return;
9880 }
9881
9882 let left = 0;
9883 const sets = [];
9884 const width = dimensions$1(this.list).width;
9885 for (let i in this.slides) {
9886 const slideWidth = dimensions$1(this.slides[i]).width;
9887
9888 if (left + slideWidth > width) {
9889 left = 0;
9890 }
9891
9892 if (this.center) {
9893 if (
9894 left < width / 2 &&
9895 left + slideWidth + dimensions$1(this.slides[+i + 1]).width / 2 > width / 2)
9896 {
9897 sets.push(+i);
9898 left = width / 2 - slideWidth / 2;
9899 }
9900 } else if (left === 0) {
9901 sets.push(Math.min(+i, this.maxIndex));
9902 }
9903
9904 left += slideWidth;
9905 }
9906
9907 if (sets.length) {
9908 return sets;
9909 }
9910 },
9911
9912 transitionOptions() {
9913 return {
9914 center: this.center,
9915 list: this.list };
9916
9917 } },
9918
9919
9920 connected() {
9921 toggleClass(this.$el, this.clsContainer, !$("." + this.clsContainer, this.$el));
9922 },
9923
9924 update: {
9925 write() {
9926 for (const el of this.navItems) {
9927 const index = toNumber(data(el, this.attrItem));
9928 if (index !== false) {
9929 el.hidden =
9930 !this.maxIndex ||
9931 index > this.maxIndex ||
9932 this.sets && !includes(this.sets, index);
9933 }
9934 }
9935
9936 if (this.length && !this.dragging && !this.stack.length) {
9937 this.reorder();
9938 this._translate(1);
9939 }
9940
9941 this.updateActiveClasses();
9942 },
9943
9944 events: ['resize'] },
9945
9946
9947 events: {
9948 beforeitemshow(e) {
9949 if (
9950 !this.dragging &&
9951 this.sets &&
9952 this.stack.length < 2 &&
9953 !includes(this.sets, this.index))
9954 {
9955 this.index = this.getValidIndex();
9956 }
9957
9958 const diff = Math.abs(
9959 this.index -
9960 this.prevIndex + (
9961 this.dir > 0 && this.index < this.prevIndex ||
9962 this.dir < 0 && this.index > this.prevIndex ?
9963 (this.maxIndex + 1) * this.dir :
9964 0));
9965
9966
9967 if (!this.dragging && diff > 1) {
9968 for (let i = 0; i < diff; i++) {
9969 this.stack.splice(1, 0, this.dir > 0 ? 'next' : 'previous');
9970 }
9971
9972 e.preventDefault();
9973 return;
9974 }
9975
9976 const index =
9977 this.dir < 0 || !this.slides[this.prevIndex] ? this.index : this.prevIndex;
9978 this.duration =
9979 speedUp(this.avgWidth / this.velocity) * (
9980 dimensions$1(this.slides[index]).width / this.avgWidth);
9981
9982 this.reorder();
9983 },
9984
9985 itemshow() {
9986 if (~this.prevIndex) {
9987 addClass(this._getTransitioner().getItemIn(), this.clsActive);
9988 }
9989 },
9990
9991 itemshown() {
9992 this.updateActiveClasses();
9993 } },
9994
9995
9996 methods: {
9997 reorder() {
9998 if (this.finite) {
9999 css(this.slides, 'order', '');
10000 return;
10001 }
10002
10003 const index = this.dir > 0 && this.slides[this.prevIndex] ? this.prevIndex : this.index;
10004
10005 this.slides.forEach((slide, i) =>
10006 css(
10007 slide,
10008 'order',
10009 this.dir > 0 && i < index ? 1 : this.dir < 0 && i >= this.index ? -1 : ''));
10010
10011
10012
10013 if (!this.center) {
10014 return;
10015 }
10016
10017 const next = this.slides[index];
10018 let width = dimensions$1(this.list).width / 2 - dimensions$1(next).width / 2;
10019 let j = 0;
10020
10021 while (width > 0) {
10022 const slideIndex = this.getIndex(--j + index, index);
10023 const slide = this.slides[slideIndex];
10024
10025 css(slide, 'order', slideIndex > index ? -2 : -1);
10026 width -= dimensions$1(slide).width;
10027 }
10028 },
10029
10030 updateActiveClasses() {
10031 const actives = this._getTransitioner(this.index).getActives();
10032 const activeClasses = [
10033 this.clsActive,
10034 (!this.sets || includes(this.sets, toFloat(this.index))) && this.clsActivated ||
10035 ''];
10036
10037 for (const slide of this.slides) {
10038 toggleClass(slide, activeClasses, includes(actives, slide));
10039 }
10040 },
10041
10042 getValidIndex(index, prevIndex) {if (index === void 0) {index = this.index;}if (prevIndex === void 0) {prevIndex = this.prevIndex;}
10043 index = this.getIndex(index, prevIndex);
10044
10045 if (!this.sets) {
10046 return index;
10047 }
10048
10049 let prev;
10050
10051 do {
10052 if (includes(this.sets, index)) {
10053 return index;
10054 }
10055
10056 prev = index;
10057 index = this.getIndex(index + this.dir, prevIndex);
10058 } while (index !== prev);
10059
10060 return index;
10061 },
10062
10063 getAdjacentSlides() {
10064 const { width } = dimensions$1(this.list);
10065 const left = -width;
10066 const right = width * 2;
10067 const slideWidth = dimensions$1(this.slides[this.index]).width;
10068 const slideLeft = this.center ? width / 2 - slideWidth / 2 : 0;
10069 const slides = new Set();
10070 for (const i of [-1, 1]) {
10071 let currentLeft = slideLeft + (i > 0 ? slideWidth : 0);
10072 let j = 0;
10073 do {
10074 const slide = this.slides[this.getIndex(this.index + i + j++ * i)];
10075 currentLeft += dimensions$1(slide).width * i;
10076 slides.add(slide);
10077 } while (this.slides.length > j && currentLeft > left && currentLeft < right);
10078 }
10079 return Array.from(slides);
10080 } } };
10081
10082
10083
10084 function getMaxElWidth(list) {
10085 return Math.max(0, ...children(list).map((el) => dimensions$1(el).width));
10086 }
10087
10088 var sliderParallax = {
10089 mixins: [Parallax],
10090
10091 data: {
10092 selItem: '!li' },
10093
10094
10095 connected() {
10096 this.item = query(this.selItem, this.$el);
10097 },
10098
10099 disconnected() {
10100 this.item = null;
10101 },
10102
10103 events: [
10104 {
10105 name: 'itemin itemout',
10106
10107 self: true,
10108
10109 el() {
10110 return this.item;
10111 },
10112
10113 handler(_ref) {let { type, detail: { percent, duration, timing, dir } } = _ref;
10114 fastdom.read(() => {
10115 const propsFrom = this.getCss(getCurrentPercent(type, dir, percent));
10116 const propsTo = this.getCss(isIn(type) ? 0.5 : dir > 0 ? 1 : 0);
10117 fastdom.write(() => {
10118 css(this.$el, propsFrom);
10119 Transition.start(this.$el, propsTo, duration, timing).catch(noop);
10120 });
10121 });
10122 } },
10123
10124
10125 {
10126 name: 'transitioncanceled transitionend',
10127
10128 self: true,
10129
10130 el() {
10131 return this.item;
10132 },
10133
10134 handler() {
10135 Transition.cancel(this.$el);
10136 } },
10137
10138
10139 {
10140 name: 'itemtranslatein itemtranslateout',
10141
10142 self: true,
10143
10144 el() {
10145 return this.item;
10146 },
10147
10148 handler(_ref2) {let { type, detail: { percent, dir } } = _ref2;
10149 fastdom.read(() => {
10150 const props = this.getCss(getCurrentPercent(type, dir, percent));
10151 fastdom.write(() => css(this.$el, props));
10152 });
10153 } }] };
10154
10155
10156
10157
10158 function isIn(type) {
10159 return endsWith(type, 'in');
10160 }
10161
10162 function getCurrentPercent(type, dir, percent) {
10163 percent /= 2;
10164
10165 return isIn(type) ^ dir < 0 ? percent : 1 - percent;
10166 }
10167
10168 var Animations = {
10169 ...Animations$2,
10170 fade: {
10171 show() {
10172 return [{ opacity: 0, zIndex: 0 }, { zIndex: -1 }];
10173 },
10174
10175 percent(current) {
10176 return 1 - css(current, 'opacity');
10177 },
10178
10179 translate(percent) {
10180 return [{ opacity: 1 - percent, zIndex: 0 }, { zIndex: -1 }];
10181 } },
10182
10183
10184 scale: {
10185 show() {
10186 return [{ opacity: 0, transform: scale3d(1 + 0.5), zIndex: 0 }, { zIndex: -1 }];
10187 },
10188
10189 percent(current) {
10190 return 1 - css(current, 'opacity');
10191 },
10192
10193 translate(percent) {
10194 return [
10195 { opacity: 1 - percent, transform: scale3d(1 + 0.5 * percent), zIndex: 0 },
10196 { zIndex: -1 }];
10197
10198 } },
10199
10200
10201 pull: {
10202 show(dir) {
10203 return dir < 0 ?
10204 [
10205 { transform: translate(30), zIndex: -1 },
10206 { transform: translate(), zIndex: 0 }] :
10207
10208 [
10209 { transform: translate(-100), zIndex: 0 },
10210 { transform: translate(), zIndex: -1 }];
10211
10212 },
10213
10214 percent(current, next, dir) {
10215 return dir < 0 ? 1 - translated(next) : translated(current);
10216 },
10217
10218 translate(percent, dir) {
10219 return dir < 0 ?
10220 [
10221 { transform: translate(30 * percent), zIndex: -1 },
10222 { transform: translate(-100 * (1 - percent)), zIndex: 0 }] :
10223
10224 [
10225 { transform: translate(-percent * 100), zIndex: 0 },
10226 { transform: translate(30 * (1 - percent)), zIndex: -1 }];
10227
10228 } },
10229
10230
10231 push: {
10232 show(dir) {
10233 return dir < 0 ?
10234 [
10235 { transform: translate(100), zIndex: 0 },
10236 { transform: translate(), zIndex: -1 }] :
10237
10238 [
10239 { transform: translate(-30), zIndex: -1 },
10240 { transform: translate(), zIndex: 0 }];
10241
10242 },
10243
10244 percent(current, next, dir) {
10245 return dir > 0 ? 1 - translated(next) : translated(current);
10246 },
10247
10248 translate(percent, dir) {
10249 return dir < 0 ?
10250 [
10251 { transform: translate(percent * 100), zIndex: 0 },
10252 { transform: translate(-30 * (1 - percent)), zIndex: -1 }] :
10253
10254 [
10255 { transform: translate(-30 * percent), zIndex: -1 },
10256 { transform: translate(100 * (1 - percent)), zIndex: 0 }];
10257
10258 } } };
10259
10260 var slideshow = {
10261 mixins: [Class, Slideshow, SliderReactive, SliderPreload],
10262
10263 props: {
10264 ratio: String,
10265 minHeight: Number,
10266 maxHeight: Number },
10267
10268
10269 data: {
10270 ratio: '16:9',
10271 minHeight: false,
10272 maxHeight: false,
10273 selList: '.bdt-slideshow-items',
10274 attrItem: 'bdt-slideshow-item',
10275 selNav: '.bdt-slideshow-nav',
10276 Animations },
10277
10278
10279 update: {
10280 read() {
10281 if (!this.list) {
10282 return false;
10283 }
10284
10285 let [width, height] = this.ratio.split(':').map(Number);
10286
10287 height = height * this.list.offsetWidth / width || 0;
10288
10289 if (this.minHeight) {
10290 height = Math.max(this.minHeight, height);
10291 }
10292
10293 if (this.maxHeight) {
10294 height = Math.min(this.maxHeight, height);
10295 }
10296
10297 return { height: height - boxModelAdjust(this.list, 'height', 'content-box') };
10298 },
10299
10300 write(_ref) {let { height } = _ref;
10301 height > 0 && css(this.list, 'minHeight', height);
10302 },
10303
10304 events: ['resize'] },
10305
10306
10307 methods: {
10308 getAdjacentSlides() {
10309 return [1, -1].map((i) => this.slides[this.getIndex(this.index + i)]);
10310 } } };
10311
10312 var sortable = {
10313 mixins: [Class, Animate],
10314
10315 props: {
10316 group: String,
10317 threshold: Number,
10318 clsItem: String,
10319 clsPlaceholder: String,
10320 clsDrag: String,
10321 clsDragState: String,
10322 clsBase: String,
10323 clsNoDrag: String,
10324 clsEmpty: String,
10325 clsCustom: String,
10326 handle: String },
10327
10328
10329 data: {
10330 group: false,
10331 threshold: 5,
10332 clsItem: 'bdt-sortable-item',
10333 clsPlaceholder: 'bdt-sortable-placeholder',
10334 clsDrag: 'bdt-sortable-drag',
10335 clsDragState: 'bdt-drag',
10336 clsBase: 'bdt-sortable',
10337 clsNoDrag: 'bdt-sortable-nodrag',
10338 clsEmpty: 'bdt-sortable-empty',
10339 clsCustom: '',
10340 handle: false,
10341 pos: {} },
10342
10343
10344 created() {
10345 for (const key of ['init', 'start', 'move', 'end']) {
10346 const fn = this[key];
10347 this[key] = (e) => {
10348 assign(this.pos, getEventPos(e));
10349 fn(e);
10350 };
10351 }
10352 },
10353
10354 events: {
10355 name: pointerDown,
10356 passive: false,
10357 handler: 'init' },
10358
10359
10360 computed: {
10361 target() {
10362 return (this.$el.tBodies || [this.$el])[0];
10363 },
10364
10365 items() {
10366 return children(this.target);
10367 },
10368
10369 isEmpty: {
10370 get() {
10371 return isEmpty(this.items);
10372 },
10373
10374 watch(empty) {
10375 toggleClass(this.target, this.clsEmpty, empty);
10376 },
10377
10378 immediate: true },
10379
10380
10381 handles: {
10382 get(_ref, el) {let { handle } = _ref;
10383 return handle ? $$(handle, el) : this.items;
10384 },
10385
10386 watch(handles, prev) {
10387 css(prev, { touchAction: '', userSelect: '' });
10388 css(handles, { touchAction: hasTouch ? 'none' : '', userSelect: 'none' }); // touchAction set to 'none' causes a performance drop in Chrome 80
10389 },
10390
10391 immediate: true } },
10392
10393
10394
10395 update: {
10396 write(data) {
10397 if (!this.drag || !parent(this.placeholder)) {
10398 return;
10399 }
10400
10401 const {
10402 pos: { x, y },
10403 origin: { offsetTop, offsetLeft },
10404 placeholder } =
10405 this;
10406
10407 css(this.drag, {
10408 top: y - offsetTop,
10409 left: x - offsetLeft });
10410
10411
10412 const sortable = this.getSortable(document.elementFromPoint(x, y));
10413
10414 if (!sortable) {
10415 return;
10416 }
10417
10418 const { items } = sortable;
10419
10420 if (items.some(Transition.inProgress)) {
10421 return;
10422 }
10423
10424 const target = findTarget(items, { x, y });
10425
10426 if (items.length && (!target || target === placeholder)) {
10427 return;
10428 }
10429
10430 const previous = this.getSortable(placeholder);
10431 const insertTarget = findInsertTarget(
10432 sortable.target,
10433 target,
10434 placeholder,
10435 x,
10436 y,
10437 sortable === previous && data.moved !== target);
10438
10439
10440 if (insertTarget === false) {
10441 return;
10442 }
10443
10444 if (insertTarget && placeholder === insertTarget) {
10445 return;
10446 }
10447
10448 if (sortable !== previous) {
10449 previous.remove(placeholder);
10450 data.moved = target;
10451 } else {
10452 delete data.moved;
10453 }
10454
10455 sortable.insert(placeholder, insertTarget);
10456
10457 this.touched.add(sortable);
10458 },
10459
10460 events: ['move'] },
10461
10462
10463 methods: {
10464 init(e) {
10465 const { target, button, defaultPrevented } = e;
10466 const [placeholder] = this.items.filter((el) => within(target, el));
10467
10468 if (
10469 !placeholder ||
10470 defaultPrevented ||
10471 button > 0 ||
10472 isInput(target) ||
10473 within(target, "." + this.clsNoDrag) ||
10474 this.handle && !within(target, this.handle))
10475 {
10476 return;
10477 }
10478
10479 e.preventDefault();
10480
10481 this.touched = new Set([this]);
10482 this.placeholder = placeholder;
10483 this.origin = { target, index: index(placeholder), ...this.pos };
10484
10485 on(document, pointerMove, this.move);
10486 on(document, pointerUp, this.end);
10487
10488 if (!this.threshold) {
10489 this.start(e);
10490 }
10491 },
10492
10493 start(e) {
10494 this.drag = appendDrag(this.$container, this.placeholder);
10495 const { left, top } = this.placeholder.getBoundingClientRect();
10496 assign(this.origin, { offsetLeft: this.pos.x - left, offsetTop: this.pos.y - top });
10497
10498 addClass(this.drag, this.clsDrag, this.clsCustom);
10499 addClass(this.placeholder, this.clsPlaceholder);
10500 addClass(this.items, this.clsItem);
10501 addClass(document.documentElement, this.clsDragState);
10502
10503 trigger(this.$el, 'start', [this, this.placeholder]);
10504
10505 trackScroll(this.pos);
10506
10507 this.move(e);
10508 },
10509
10510 move(e) {
10511 if (this.drag) {
10512 this.$emit('move');
10513 } else if (
10514 Math.abs(this.pos.x - this.origin.x) > this.threshold ||
10515 Math.abs(this.pos.y - this.origin.y) > this.threshold)
10516 {
10517 this.start(e);
10518 }
10519 },
10520
10521 end() {
10522 off(document, pointerMove, this.move);
10523 off(document, pointerUp, this.end);
10524
10525 if (!this.drag) {
10526 return;
10527 }
10528
10529 untrackScroll();
10530
10531 const sortable = this.getSortable(this.placeholder);
10532
10533 if (this === sortable) {
10534 if (this.origin.index !== index(this.placeholder)) {
10535 trigger(this.$el, 'moved', [this, this.placeholder]);
10536 }
10537 } else {
10538 trigger(sortable.$el, 'added', [sortable, this.placeholder]);
10539 trigger(this.$el, 'removed', [this, this.placeholder]);
10540 }
10541
10542 trigger(this.$el, 'stop', [this, this.placeholder]);
10543
10544 remove$1(this.drag);
10545 this.drag = null;
10546
10547 for (const { clsPlaceholder, clsItem } of this.touched) {
10548 for (const sortable of this.touched) {
10549 removeClass(sortable.items, clsPlaceholder, clsItem);
10550 }
10551 }
10552 this.touched = null;
10553 removeClass(document.documentElement, this.clsDragState);
10554 },
10555
10556 insert(element, target) {
10557 addClass(this.items, this.clsItem);
10558
10559 const insert = () => target ? before(target, element) : append(this.target, element);
10560
10561 this.animate(insert);
10562 },
10563
10564 remove(element) {
10565 if (!within(element, this.target)) {
10566 return;
10567 }
10568
10569 this.animate(() => remove$1(element));
10570 },
10571
10572 getSortable(element) {
10573 do {
10574 const sortable = this.$getComponent(element, 'sortable');
10575
10576 if (
10577 sortable && (
10578 sortable === this || this.group !== false && sortable.group === this.group))
10579 {
10580 return sortable;
10581 }
10582 } while (element = parent(element));
10583 } } };
10584
10585
10586
10587 let trackTimer;
10588 function trackScroll(pos) {
10589 let last = Date.now();
10590 trackTimer = setInterval(() => {
10591 let { x, y } = pos;
10592 y += scrollTop(window);
10593
10594 const dist = (Date.now() - last) * 0.3;
10595 last = Date.now();
10596
10597 scrollParents(document.elementFromPoint(x, pos.y), /auto|scroll/).
10598 reverse().
10599 some((scrollEl) => {
10600 let { scrollTop: scroll, scrollHeight } = scrollEl;
10601
10602 const { top, bottom, height } = offset(getViewport$1(scrollEl));
10603
10604 if (top < y && top + 35 > y) {
10605 scroll -= dist;
10606 } else if (bottom > y && bottom - 35 < y) {
10607 scroll += dist;
10608 } else {
10609 return;
10610 }
10611
10612 if (scroll > 0 && scroll < scrollHeight - height) {
10613 scrollTop(scrollEl, scroll);
10614 return true;
10615 }
10616 });
10617 }, 15);
10618 }
10619
10620 function untrackScroll() {
10621 clearInterval(trackTimer);
10622 }
10623
10624 function appendDrag(container, element) {
10625 const clone = append(
10626 container,
10627 element.outerHTML.replace(/(^<)(?:li|tr)|(?:li|tr)(\/>$)/g, '$1div$2'));
10628
10629
10630 css(clone, 'margin', '0', 'important');
10631 css(clone, {
10632 boxSizing: 'border-box',
10633 width: element.offsetWidth,
10634 height: element.offsetHeight,
10635 padding: css(element, 'padding') });
10636
10637
10638 height(clone.firstElementChild, height(element.firstElementChild));
10639
10640 return clone;
10641 }
10642
10643 function findTarget(items, point) {
10644 return items[findIndex(items, (item) => pointInRect(point, item.getBoundingClientRect()))];
10645 }
10646
10647 function findInsertTarget(list, target, placeholder, x, y, sameList) {
10648 if (!children(list).length) {
10649 return;
10650 }
10651
10652 const rect = target.getBoundingClientRect();
10653 if (!sameList) {
10654 if (!isHorizontal(list, placeholder)) {
10655 return y < rect.top + rect.height / 2 ? target : target.nextElementSibling;
10656 }
10657
10658 return target;
10659 }
10660
10661 const placeholderRect = placeholder.getBoundingClientRect();
10662 const sameRow = linesIntersect(
10663 [rect.top, rect.bottom],
10664 [placeholderRect.top, placeholderRect.bottom]);
10665
10666
10667 const pointerPos = sameRow ? x : y;
10668 const lengthProp = sameRow ? 'width' : 'height';
10669 const startProp = sameRow ? 'left' : 'top';
10670 const endProp = sameRow ? 'right' : 'bottom';
10671
10672 const diff =
10673 placeholderRect[lengthProp] < rect[lengthProp] ?
10674 rect[lengthProp] - placeholderRect[lengthProp] :
10675 0;
10676
10677 if (placeholderRect[startProp] < rect[startProp]) {
10678 if (diff && pointerPos < rect[startProp] + diff) {
10679 return false;
10680 }
10681
10682 return target.nextElementSibling;
10683 }
10684
10685 if (diff && pointerPos > rect[endProp] - diff) {
10686 return false;
10687 }
10688
10689 return target;
10690 }
10691
10692 function isHorizontal(list, placeholder) {
10693 const single = children(list).length === 1;
10694
10695 if (single) {
10696 append(list, placeholder);
10697 }
10698
10699 const items = children(list);
10700 const isHorizontal = items.some((el, i) => {
10701 const rectA = el.getBoundingClientRect();
10702 return items.slice(i + 1).some((el) => {
10703 const rectB = el.getBoundingClientRect();
10704 return !linesIntersect([rectA.left, rectA.right], [rectB.left, rectB.right]);
10705 });
10706 });
10707
10708 if (single) {
10709 remove$1(placeholder);
10710 }
10711
10712 return isHorizontal;
10713 }
10714
10715 function linesIntersect(lineA, lineB) {
10716 return lineA[1] > lineB[0] && lineB[1] > lineA[0];
10717 }
10718
10719 var tooltip = {
10720 mixins: [Container, Togglable, Position],
10721
10722 args: 'title',
10723
10724 props: {
10725 delay: Number,
10726 title: String },
10727
10728
10729 data: {
10730 pos: 'top',
10731 title: '',
10732 delay: 0,
10733 animation: ['bdt-animation-scale-up'],
10734 duration: 100,
10735 cls: 'bdt-active',
10736 clsPos: 'bdt-tooltip' },
10737
10738
10739 beforeConnect() {
10740 this._hasTitle = hasAttr(this.$el, 'title');
10741 attr(this.$el, 'title', '');
10742 this.updateAria(false);
10743 makeFocusable(this.$el);
10744 },
10745
10746 disconnected() {
10747 this.hide();
10748 attr(this.$el, 'title', this._hasTitle ? this.title : null);
10749 },
10750
10751 methods: {
10752 show() {
10753 if (this.isToggled(this.tooltip || null) || !this.title) {
10754 return;
10755 }
10756
10757 this._unbind = once(
10758 document, "show keydown " +
10759 pointerDown,
10760 this.hide,
10761 false,
10762 (e) =>
10763 e.type === pointerDown && !within(e.target, this.$el) ||
10764 e.type === 'keydown' && e.keyCode === 27 ||
10765 e.type === 'show' && e.detail[0] !== this && e.detail[0].$name === this.$name);
10766
10767
10768 clearTimeout(this.showTimer);
10769 this.showTimer = setTimeout(this._show, this.delay);
10770 },
10771
10772 async hide() {
10773 if (matches(this.$el, 'input:focus')) {
10774 return;
10775 }
10776
10777 clearTimeout(this.showTimer);
10778
10779 if (!this.isToggled(this.tooltip || null)) {
10780 return;
10781 }
10782
10783 await this.toggleElement(this.tooltip, false, false);
10784 remove$1(this.tooltip);
10785 this.tooltip = null;
10786 this._unbind();
10787 },
10788
10789 _show() {
10790 this.tooltip = append(
10791 this.container, "<div class=\"" +
10792 this.clsPos + "\"> <div class=\"" +
10793 this.clsPos + "-inner\">" + this.title + "</div> </div>");
10794
10795
10796
10797 on(this.tooltip, 'toggled', (e, toggled) => {
10798 this.updateAria(toggled);
10799
10800 if (!toggled) {
10801 return;
10802 }
10803
10804 this.positionAt(this.tooltip, this.$el);
10805
10806 this.origin =
10807 this.getAxis() === 'y' ?
10808 flipPosition(this.dir) + "-" + this.align :
10809 this.align + "-" + flipPosition(this.dir);
10810 });
10811
10812 this.toggleElement(this.tooltip, true);
10813 },
10814
10815 updateAria(toggled) {
10816 attr(this.$el, 'aria-expanded', toggled);
10817 } },
10818
10819
10820 events: {
10821 focus: 'show',
10822 blur: 'hide',
10823
10824 [pointerEnter + " " + pointerLeave](e) {
10825 if (!isTouch(e)) {
10826 this[e.type === pointerEnter ? 'show' : 'hide']();
10827 }
10828 },
10829
10830 // Clicking a button does not give it focus on all browsers and platforms
10831 // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#clicking_and_focus
10832 [pointerDown](e) {
10833 if (isTouch(e)) {
10834 this.show();
10835 }
10836 } } };
10837
10838
10839
10840 function makeFocusable(el) {
10841 if (!isFocusable(el)) {
10842 attr(el, 'tabindex', '0');
10843 }
10844 }
10845
10846 var upload = {
10847 props: {
10848 allow: String,
10849 clsDragover: String,
10850 concurrent: Number,
10851 maxSize: Number,
10852 method: String,
10853 mime: String,
10854 msgInvalidMime: String,
10855 msgInvalidName: String,
10856 msgInvalidSize: String,
10857 multiple: Boolean,
10858 name: String,
10859 params: Object,
10860 type: String,
10861 url: String },
10862
10863
10864 data: {
10865 allow: false,
10866 clsDragover: 'bdt-dragover',
10867 concurrent: 1,
10868 maxSize: 0,
10869 method: 'POST',
10870 mime: false,
10871 msgInvalidMime: 'Invalid File Type: %s',
10872 msgInvalidName: 'Invalid File Name: %s',
10873 msgInvalidSize: 'Invalid File Size: %s Kilobytes Max',
10874 multiple: false,
10875 name: 'files[]',
10876 params: {},
10877 type: '',
10878 url: '',
10879 abort: noop,
10880 beforeAll: noop,
10881 beforeSend: noop,
10882 complete: noop,
10883 completeAll: noop,
10884 error: noop,
10885 fail: noop,
10886 load: noop,
10887 loadEnd: noop,
10888 loadStart: noop,
10889 progress: noop },
10890
10891
10892 events: {
10893 change(e) {
10894 if (!matches(e.target, 'input[type="file"]')) {
10895 return;
10896 }
10897
10898 e.preventDefault();
10899
10900 if (e.target.files) {
10901 this.upload(e.target.files);
10902 }
10903
10904 e.target.value = '';
10905 },
10906
10907 drop(e) {
10908 stop(e);
10909
10910 const transfer = e.dataTransfer;
10911
10912 if (!(transfer != null && transfer.files)) {
10913 return;
10914 }
10915
10916 removeClass(this.$el, this.clsDragover);
10917
10918 this.upload(transfer.files);
10919 },
10920
10921 dragenter(e) {
10922 stop(e);
10923 },
10924
10925 dragover(e) {
10926 stop(e);
10927 addClass(this.$el, this.clsDragover);
10928 },
10929
10930 dragleave(e) {
10931 stop(e);
10932 removeClass(this.$el, this.clsDragover);
10933 } },
10934
10935
10936 methods: {
10937 async upload(files) {
10938 if (!files.length) {
10939 return;
10940 }
10941
10942 trigger(this.$el, 'upload', [files]);
10943
10944 for (const file of files) {
10945 if (this.maxSize && this.maxSize * 1000 < file.size) {
10946 this.fail(this.msgInvalidSize.replace('%s', this.maxSize));
10947 return;
10948 }
10949
10950 if (this.allow && !match(this.allow, file.name)) {
10951 this.fail(this.msgInvalidName.replace('%s', this.allow));
10952 return;
10953 }
10954
10955 if (this.mime && !match(this.mime, file.type)) {
10956 this.fail(this.msgInvalidMime.replace('%s', this.mime));
10957 return;
10958 }
10959 }
10960
10961 if (!this.multiple) {
10962 files = files.slice(0, 1);
10963 }
10964
10965 this.beforeAll(this, files);
10966
10967 const chunks = chunk(files, this.concurrent);
10968 const upload = async (files) => {
10969 const data = new FormData();
10970
10971 files.forEach((file) => data.append(this.name, file));
10972
10973 for (const key in this.params) {
10974 data.append(key, this.params[key]);
10975 }
10976
10977 try {
10978 const xhr = await ajax(this.url, {
10979 data,
10980 method: this.method,
10981 responseType: this.type,
10982 beforeSend: (env) => {
10983 const { xhr } = env;
10984 xhr.upload && on(xhr.upload, 'progress', this.progress);
10985 for (const type of ['loadStart', 'load', 'loadEnd', 'abort']) {
10986 on(xhr, type.toLowerCase(), this[type]);
10987 }
10988
10989 return this.beforeSend(env);
10990 } });
10991
10992
10993 this.complete(xhr);
10994
10995 if (chunks.length) {
10996 await upload(chunks.shift());
10997 } else {
10998 this.completeAll(xhr);
10999 }
11000 } catch (e) {
11001 this.error(e);
11002 }
11003 };
11004
11005 await upload(chunks.shift());
11006 } } };
11007
11008
11009
11010 function match(pattern, path) {
11011 return path.match(
11012 new RegExp("^" +
11013 pattern.
11014 replace(/\//g, '\\/').
11015 replace(/\*\*/g, '(\\/[^\\/]+)*').
11016 replace(/\*/g, '[^\\/]+').
11017 replace(/((?!\\))\?/g, '$1.') + "$",
11018 'i'));
11019
11020
11021 }
11022
11023 function chunk(files, size) {
11024 files = toArray(files);
11025 const chunks = [];
11026 for (let i = 0; i < files.length; i += size) {
11027 chunks.push(files.slice(i, i + size));
11028 }
11029 return chunks;
11030 }
11031
11032 function stop(e) {
11033 e.preventDefault();
11034 e.stopPropagation();
11035 }
11036
11037 var components = /*#__PURE__*/Object.freeze({
11038 __proto__: null,
11039 Countdown: countdown,
11040 Filter: filter,
11041 Lightbox: lightbox,
11042 LightboxPanel: LightboxPanel,
11043 Notification: notification,
11044 Parallax: parallax,
11045 Slider: slider,
11046 SliderParallax: sliderParallax,
11047 Slideshow: slideshow,
11048 SlideshowParallax: sliderParallax,
11049 Sortable: sortable,
11050 Tooltip: tooltip,
11051 Upload: upload
11052 });
11053
11054 each(components, (component, name) => bdtUIkit.component(name, component));
11055
11056 return bdtUIkit;
11057
11058 }));
11059