My personal site (brandoncornejo.name) (binaryatrocity.name)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12212 lines
333 KiB

4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
10 years ago
4 years ago
  1. /*! UIkit 3.5.5 | https://www.getuikit.com | (c) 2014 - 2020 YOOtheme | MIT License */
  2. (function (global, factory) {
  3. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  4. typeof define === 'function' && define.amd ? define('uikit', factory) :
  5. (global = global || self, global.UIkit = factory());
  6. }(this, (function () { 'use strict';
  7. var objPrototype = Object.prototype;
  8. var hasOwnProperty = objPrototype.hasOwnProperty;
  9. function hasOwn(obj, key) {
  10. return hasOwnProperty.call(obj, key);
  11. }
  12. var hyphenateCache = {};
  13. var hyphenateRe = /([a-z\d])([A-Z])/g;
  14. function hyphenate(str) {
  15. if (!(str in hyphenateCache)) {
  16. hyphenateCache[str] = str
  17. .replace(hyphenateRe, '$1-$2')
  18. .toLowerCase();
  19. }
  20. return hyphenateCache[str];
  21. }
  22. var camelizeRe = /-(\w)/g;
  23. function camelize(str) {
  24. return str.replace(camelizeRe, toUpper);
  25. }
  26. function toUpper(_, c) {
  27. return c ? c.toUpperCase() : '';
  28. }
  29. function ucfirst(str) {
  30. return str.length ? toUpper(null, str.charAt(0)) + str.slice(1) : '';
  31. }
  32. var strPrototype = String.prototype;
  33. var startsWithFn = strPrototype.startsWith || function (search) { return this.lastIndexOf(search, 0) === 0; };
  34. function startsWith(str, search) {
  35. return startsWithFn.call(str, search);
  36. }
  37. var endsWithFn = strPrototype.endsWith || function (search) { return this.substr(-search.length) === search; };
  38. function endsWith(str, search) {
  39. return endsWithFn.call(str, search);
  40. }
  41. var arrPrototype = Array.prototype;
  42. var includesFn = function (search, i) { return !!~this.indexOf(search, i); };
  43. var includesStr = strPrototype.includes || includesFn;
  44. var includesArray = arrPrototype.includes || includesFn;
  45. function includes(obj, search) {
  46. return obj && (isString(obj) ? includesStr : includesArray).call(obj, search);
  47. }
  48. var findIndexFn = arrPrototype.findIndex || function (predicate) {
  49. var arguments$1 = arguments;
  50. for (var i = 0; i < this.length; i++) {
  51. if (predicate.call(arguments$1[1], this[i], i, this)) {
  52. return i;
  53. }
  54. }
  55. return -1;
  56. };
  57. function findIndex(array, predicate) {
  58. return findIndexFn.call(array, predicate);
  59. }
  60. var isArray = Array.isArray;
  61. function isFunction(obj) {
  62. return typeof obj === 'function';
  63. }
  64. function isObject(obj) {
  65. return obj !== null && typeof obj === 'object';
  66. }
  67. var toString = objPrototype.toString;
  68. function isPlainObject(obj) {
  69. return toString.call(obj) === '[object Object]';
  70. }
  71. function isWindow(obj) {
  72. return isObject(obj) && obj === obj.window;
  73. }
  74. function isDocument(obj) {
  75. return isObject(obj) && obj.nodeType === 9;
  76. }
  77. function isJQuery(obj) {
  78. return isObject(obj) && !!obj.jquery;
  79. }
  80. function isNode(obj) {
  81. return isObject(obj) && obj.nodeType >= 1;
  82. }
  83. function isElement(obj) {
  84. return isObject(obj) && obj.nodeType === 1;
  85. }
  86. function isNodeCollection(obj) {
  87. return toString.call(obj).match(/^\[object (NodeList|HTMLCollection)\]$/);
  88. }
  89. function isBoolean(value) {
  90. return typeof value === 'boolean';
  91. }
  92. function isString(value) {
  93. return typeof value === 'string';
  94. }
  95. function isNumber(value) {
  96. return typeof value === 'number';
  97. }
  98. function isNumeric(value) {
  99. return isNumber(value) || isString(value) && !isNaN(value - parseFloat(value));
  100. }
  101. function isEmpty(obj) {
  102. return !(isArray(obj)
  103. ? obj.length
  104. : isObject(obj)
  105. ? Object.keys(obj).length
  106. : false
  107. );
  108. }
  109. function isUndefined(value) {
  110. return value === void 0;
  111. }
  112. function toBoolean(value) {
  113. return isBoolean(value)
  114. ? value
  115. : value === 'true' || value === '1' || value === ''
  116. ? true
  117. : value === 'false' || value === '0'
  118. ? false
  119. : value;
  120. }
  121. function toNumber(value) {
  122. var number = Number(value);
  123. return !isNaN(number) ? number : false;
  124. }
  125. function toFloat(value) {
  126. return parseFloat(value) || 0;
  127. }
  128. function toNode(element) {
  129. return isNode(element)
  130. ? element
  131. : isNodeCollection(element) || isJQuery(element)
  132. ? element[0]
  133. : isArray(element)
  134. ? toNode(element[0])
  135. : null;
  136. }
  137. function toNodes(element) {
  138. return isNode(element)
  139. ? [element]
  140. : isNodeCollection(element)
  141. ? arrPrototype.slice.call(element)
  142. : isArray(element)
  143. ? element.map(toNode).filter(Boolean)
  144. : isJQuery(element)
  145. ? element.toArray()
  146. : [];
  147. }
  148. function toWindow(element) {
  149. if (isWindow(element)) {
  150. return element;
  151. }
  152. element = toNode(element);
  153. return element
  154. ? (isDocument(element)
  155. ? element
  156. : element.ownerDocument
  157. ).defaultView
  158. : window;
  159. }
  160. function toList(value) {
  161. return isArray(value)
  162. ? value
  163. : isString(value)
  164. ? value.split(/,(?![^(]*\))/).map(function (value) { return isNumeric(value)
  165. ? toNumber(value)
  166. : toBoolean(value.trim()); })
  167. : [value];
  168. }
  169. function toMs(time) {
  170. return !time
  171. ? 0
  172. : endsWith(time, 'ms')
  173. ? toFloat(time)
  174. : toFloat(time) * 1000;
  175. }
  176. function isEqual(value, other) {
  177. return value === other
  178. || isObject(value)
  179. && isObject(other)
  180. && Object.keys(value).length === Object.keys(other).length
  181. && each(value, function (val, key) { return val === other[key]; });
  182. }
  183. function swap(value, a, b) {
  184. return value.replace(
  185. new RegExp((a + "|" + b), 'g'),
  186. function (match) { return match === a ? b : a; }
  187. );
  188. }
  189. var assign = Object.assign || function (target) {
  190. var args = [], len = arguments.length - 1;
  191. while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
  192. target = Object(target);
  193. for (var i = 0; i < args.length; i++) {
  194. var source = args[i];
  195. if (source !== null) {
  196. for (var key in source) {
  197. if (hasOwn(source, key)) {
  198. target[key] = source[key];
  199. }
  200. }
  201. }
  202. }
  203. return target;
  204. };
  205. function last(array) {
  206. return array[array.length - 1];
  207. }
  208. function each(obj, cb) {
  209. for (var key in obj) {
  210. if (false === cb(obj[key], key)) {
  211. return false;
  212. }
  213. }
  214. return true;
  215. }
  216. function sortBy(array, prop) {
  217. return array.sort(function (ref, ref$1) {
  218. var propA = ref[prop]; if ( propA === void 0 ) propA = 0;
  219. var propB = ref$1[prop]; if ( propB === void 0 ) propB = 0;
  220. return propA > propB
  221. ? 1
  222. : propB > propA
  223. ? -1
  224. : 0;
  225. }
  226. );
  227. }
  228. function uniqueBy(array, prop) {
  229. var seen = new Set();
  230. return array.filter(function (ref) {
  231. var check = ref[prop];
  232. return seen.has(check)
  233. ? false
  234. : seen.add(check) || true;
  235. } // IE 11 does not return the Set object
  236. );
  237. }
  238. function clamp(number, min, max) {
  239. if ( min === void 0 ) min = 0;
  240. if ( max === void 0 ) max = 1;
  241. return Math.min(Math.max(toNumber(number) || 0, min), max);
  242. }
  243. function noop() {}
  244. function intersectRect(r1, r2) {
  245. return r1.left < r2.right &&
  246. r1.right > r2.left &&
  247. r1.top < r2.bottom &&
  248. r1.bottom > r2.top;
  249. }
  250. function pointInRect(point, rect) {
  251. return point.x <= rect.right &&
  252. point.x >= rect.left &&
  253. point.y <= rect.bottom &&
  254. point.y >= rect.top;
  255. }
  256. var Dimensions = {
  257. ratio: function(dimensions, prop, value) {
  258. var obj;
  259. var aProp = prop === 'width' ? 'height' : 'width';
  260. return ( obj = {}, obj[aProp] = dimensions[prop] ? Math.round(value * dimensions[aProp] / dimensions[prop]) : dimensions[aProp], obj[prop] = value, obj );
  261. },
  262. contain: function(dimensions, maxDimensions) {
  263. var this$1 = this;
  264. dimensions = assign({}, dimensions);
  265. each(dimensions, function (_, prop) { return dimensions = dimensions[prop] > maxDimensions[prop]
  266. ? this$1.ratio(dimensions, prop, maxDimensions[prop])
  267. : dimensions; }
  268. );
  269. return dimensions;
  270. },
  271. cover: function(dimensions, maxDimensions) {
  272. var this$1 = this;
  273. dimensions = this.contain(dimensions, maxDimensions);
  274. each(dimensions, function (_, prop) { return dimensions = dimensions[prop] < maxDimensions[prop]
  275. ? this$1.ratio(dimensions, prop, maxDimensions[prop])
  276. : dimensions; }
  277. );
  278. return dimensions;
  279. }
  280. };
  281. function attr(element, name, value) {
  282. if (isObject(name)) {
  283. for (var key in name) {
  284. attr(element, key, name[key]);
  285. }
  286. return;
  287. }
  288. if (isUndefined(value)) {
  289. element = toNode(element);
  290. return element && element.getAttribute(name);
  291. } else {
  292. toNodes(element).forEach(function (element) {
  293. if (isFunction(value)) {
  294. value = value.call(element, attr(element, name));
  295. }
  296. if (value === null) {
  297. removeAttr(element, name);
  298. } else {
  299. element.setAttribute(name, value);
  300. }
  301. });
  302. }
  303. }
  304. function hasAttr(element, name) {
  305. return toNodes(element).some(function (element) { return element.hasAttribute(name); });
  306. }
  307. function removeAttr(element, name) {
  308. element = toNodes(element);
  309. name.split(' ').forEach(function (name) { return element.forEach(function (element) { return element.hasAttribute(name) && element.removeAttribute(name); }
  310. ); }
  311. );
  312. }
  313. function data(element, attribute) {
  314. for (var i = 0, attrs = [attribute, ("data-" + attribute)]; i < attrs.length; i++) {
  315. if (hasAttr(element, attrs[i])) {
  316. return attr(element, attrs[i]);
  317. }
  318. }
  319. }
  320. /* global DocumentTouch */
  321. var inBrowser = typeof window !== 'undefined';
  322. var isIE = inBrowser && /msie|trident/i.test(window.navigator.userAgent);
  323. var isRtl = inBrowser && attr(document.documentElement, 'dir') === 'rtl';
  324. var hasTouchEvents = inBrowser && 'ontouchstart' in window;
  325. var hasPointerEvents = inBrowser && window.PointerEvent;
  326. var hasTouch = inBrowser && (hasTouchEvents
  327. || window.DocumentTouch && document instanceof DocumentTouch
  328. || navigator.maxTouchPoints); // IE >=11
  329. var pointerDown = hasPointerEvents ? 'pointerdown' : hasTouchEvents ? 'touchstart' : 'mousedown';
  330. var pointerMove = hasPointerEvents ? 'pointermove' : hasTouchEvents ? 'touchmove' : 'mousemove';
  331. var pointerUp = hasPointerEvents ? 'pointerup' : hasTouchEvents ? 'touchend' : 'mouseup';
  332. var pointerEnter = hasPointerEvents ? 'pointerenter' : hasTouchEvents ? '' : 'mouseenter';
  333. var pointerLeave = hasPointerEvents ? 'pointerleave' : hasTouchEvents ? '' : 'mouseleave';
  334. var pointerCancel = hasPointerEvents ? 'pointercancel' : 'touchcancel';
  335. function query(selector, context) {
  336. return toNode(selector) || find(selector, getContext(selector, context));
  337. }
  338. function queryAll(selector, context) {
  339. var nodes = toNodes(selector);
  340. return nodes.length && nodes || findAll(selector, getContext(selector, context));
  341. }
  342. function getContext(selector, context) {
  343. if ( context === void 0 ) context = document;
  344. return isContextSelector(selector) || isDocument(context)
  345. ? context
  346. : context.ownerDocument;
  347. }
  348. function find(selector, context) {
  349. return toNode(_query(selector, context, 'querySelector'));
  350. }
  351. function findAll(selector, context) {
  352. return toNodes(_query(selector, context, 'querySelectorAll'));
  353. }
  354. function _query(selector, context, queryFn) {
  355. if ( context === void 0 ) context = document;
  356. if (!selector || !isString(selector)) {
  357. return null;
  358. }
  359. selector = selector.replace(contextSanitizeRe, '$1 *');
  360. var removes;
  361. if (isContextSelector(selector)) {
  362. removes = [];
  363. selector = splitSelector(selector).map(function (selector, i) {
  364. var ctx = context;
  365. if (selector[0] === '!') {
  366. var selectors = selector.substr(1).trim().split(' ');
  367. ctx = closest(parent(context), selectors[0]);
  368. selector = selectors.slice(1).join(' ').trim();
  369. }
  370. if (selector[0] === '-') {
  371. var selectors$1 = selector.substr(1).trim().split(' ');
  372. var prev = (ctx || context).previousElementSibling;
  373. ctx = matches(prev, selector.substr(1)) ? prev : null;
  374. selector = selectors$1.slice(1).join(' ');
  375. }
  376. if (!ctx) {
  377. return null;
  378. }
  379. if (!ctx.id) {
  380. ctx.id = "uk-" + (Date.now()) + i;
  381. removes.push(function () { return removeAttr(ctx, 'id'); });
  382. }
  383. return ("#" + (escape(ctx.id)) + " " + selector);
  384. }).filter(Boolean).join(',');
  385. context = document;
  386. }
  387. try {
  388. return context[queryFn](selector);
  389. } catch (e) {
  390. return null;
  391. } finally {
  392. removes && removes.forEach(function (remove) { return remove(); });
  393. }
  394. }
  395. var contextSelectorRe = /(^|[^\\],)\s*[!>+~-]/;
  396. var contextSanitizeRe = /([!>+~-])(?=\s+[!>+~-]|\s*$)/g;
  397. function isContextSelector(selector) {
  398. return isString(selector) && selector.match(contextSelectorRe);
  399. }
  400. var selectorRe = /.*?[^\\](?:,|$)/g;
  401. function splitSelector(selector) {
  402. return selector.match(selectorRe).map(function (selector) { return selector.replace(/,$/, '').trim(); });
  403. }
  404. var elProto = inBrowser ? Element.prototype : {};
  405. var matchesFn = elProto.matches || elProto.webkitMatchesSelector || elProto.msMatchesSelector || noop;
  406. function matches(element, selector) {
  407. return toNodes(element).some(function (element) { return matchesFn.call(element, selector); });
  408. }
  409. var closestFn = elProto.closest || function (selector) {
  410. var ancestor = this;
  411. do {
  412. if (matches(ancestor, selector)) {
  413. return ancestor;
  414. }
  415. } while ((ancestor = parent(ancestor)));
  416. };
  417. function closest(element, selector) {
  418. if (startsWith(selector, '>')) {
  419. selector = selector.slice(1);
  420. }
  421. return isElement(element)
  422. ? closestFn.call(element, selector)
  423. : toNodes(element).map(function (element) { return closest(element, selector); }).filter(Boolean);
  424. }
  425. function parent(element) {
  426. element = toNode(element);
  427. return element && isElement(element.parentNode) && element.parentNode;
  428. }
  429. var escapeFn = inBrowser && window.CSS && CSS.escape || function (css) { return css.replace(/([^\x7f-\uFFFF\w-])/g, function (match) { return ("\\" + match); }); };
  430. function escape(css) {
  431. return isString(css) ? escapeFn.call(null, css) : '';
  432. }
  433. var voidElements = {
  434. area: true,
  435. base: true,
  436. br: true,
  437. col: true,
  438. embed: true,
  439. hr: true,
  440. img: true,
  441. input: true,
  442. keygen: true,
  443. link: true,
  444. menuitem: true,
  445. meta: true,
  446. param: true,
  447. source: true,
  448. track: true,
  449. wbr: true
  450. };
  451. function isVoidElement(element) {
  452. return toNodes(element).some(function (element) { return voidElements[element.tagName.toLowerCase()]; });
  453. }
  454. function isVisible(element) {
  455. return toNodes(element).some(function (element) { return element.offsetWidth || element.offsetHeight || element.getClientRects().length; });
  456. }
  457. var selInput = 'input,select,textarea,button';
  458. function isInput(element) {
  459. return toNodes(element).some(function (element) { return matches(element, selInput); });
  460. }
  461. function filter(element, selector) {
  462. return toNodes(element).filter(function (element) { return matches(element, selector); });
  463. }
  464. function within(element, selector) {
  465. return !isString(selector)
  466. ? element === selector || (isDocument(selector)
  467. ? selector.documentElement
  468. : toNode(selector)).contains(toNode(element)) // IE 11 document does not implement contains
  469. : matches(element, selector) || !!closest(element, selector);
  470. }
  471. function parents(element, selector) {
  472. var elements = [];
  473. while ((element = parent(element))) {
  474. if (!selector || matches(element, selector)) {
  475. elements.push(element);
  476. }
  477. }
  478. return elements;
  479. }
  480. function children(element, selector) {
  481. element = toNode(element);
  482. var children = element ? toNodes(element.children) : [];
  483. return selector ? filter(children, selector) : children;
  484. }
  485. function on() {
  486. var args = [], len = arguments.length;
  487. while ( len-- ) args[ len ] = arguments[ len ];
  488. var ref = getArgs(args);
  489. var targets = ref[0];
  490. var type = ref[1];
  491. var selector = ref[2];
  492. var listener = ref[3];
  493. var useCapture = ref[4];
  494. targets = toEventTargets(targets);
  495. if (listener.length > 1) {
  496. listener = detail(listener);
  497. }
  498. if (useCapture && useCapture.self) {
  499. listener = selfFilter(listener);
  500. }
  501. if (selector) {
  502. listener = delegate(targets, selector, listener);
  503. }
  504. useCapture = useCaptureFilter(useCapture);
  505. type.split(' ').forEach(function (type) { return targets.forEach(function (target) { return target.addEventListener(type, listener, useCapture); }
  506. ); }
  507. );
  508. return function () { return off(targets, type, listener, useCapture); };
  509. }
  510. function off(targets, type, listener, useCapture) {
  511. if ( useCapture === void 0 ) useCapture = false;
  512. useCapture = useCaptureFilter(useCapture);
  513. targets = toEventTargets(targets);
  514. type.split(' ').forEach(function (type) { return targets.forEach(function (target) { return target.removeEventListener(type, listener, useCapture); }
  515. ); }
  516. );
  517. }
  518. function once() {
  519. var args = [], len = arguments.length;
  520. while ( len-- ) args[ len ] = arguments[ len ];
  521. var ref = getArgs(args);
  522. var element = ref[0];
  523. var type = ref[1];
  524. var selector = ref[2];
  525. var listener = ref[3];
  526. var useCapture = ref[4];
  527. var condition = ref[5];
  528. var off = on(element, type, selector, function (e) {
  529. var result = !condition || condition(e);
  530. if (result) {
  531. off();
  532. listener(e, result);
  533. }
  534. }, useCapture);
  535. return off;
  536. }
  537. function trigger(targets, event, detail) {
  538. return toEventTargets(targets).reduce(function (notCanceled, target) { return notCanceled && target.dispatchEvent(createEvent(event, true, true, detail)); }
  539. , true);
  540. }
  541. function createEvent(e, bubbles, cancelable, detail) {
  542. if ( bubbles === void 0 ) bubbles = true;
  543. if ( cancelable === void 0 ) cancelable = false;
  544. if (isString(e)) {
  545. var event = document.createEvent('CustomEvent'); // IE 11
  546. event.initCustomEvent(e, bubbles, cancelable, detail);
  547. e = event;
  548. }
  549. return e;
  550. }
  551. function getArgs(args) {
  552. if (isFunction(args[2])) {
  553. args.splice(2, 0, false);
  554. }
  555. return args;
  556. }
  557. function delegate(delegates, selector, listener) {
  558. var this$1 = this;
  559. return function (e) {
  560. delegates.forEach(function (delegate) {
  561. var current = selector[0] === '>'
  562. ? findAll(selector, delegate).reverse().filter(function (element) { return within(e.target, element); })[0]
  563. : closest(e.target, selector);
  564. if (current) {
  565. e.delegate = delegate;
  566. e.current = current;
  567. listener.call(this$1, e);
  568. }
  569. });
  570. };
  571. }
  572. function detail(listener) {
  573. return function (e) { return isArray(e.detail) ? listener.apply(void 0, [ e ].concat( e.detail )) : listener(e); };
  574. }
  575. function selfFilter(listener) {
  576. return function (e) {
  577. if (e.target === e.currentTarget || e.target === e.current) {
  578. return listener.call(null, e);
  579. }
  580. };
  581. }
  582. function useCaptureFilter(options) {
  583. return options && isIE && !isBoolean(options)
  584. ? !!options.capture
  585. : options;
  586. }
  587. function isEventTarget(target) {
  588. return target && 'addEventListener' in target;
  589. }
  590. function toEventTarget(target) {
  591. return isEventTarget(target) ? target : toNode(target);
  592. }
  593. function toEventTargets(target) {
  594. return isArray(target)
  595. ? target.map(toEventTarget).filter(Boolean)
  596. : isString(target)
  597. ? findAll(target)
  598. : isEventTarget(target)
  599. ? [target]
  600. : toNodes(target);
  601. }
  602. function isTouch(e) {
  603. return e.pointerType === 'touch' || !!e.touches;
  604. }
  605. function getEventPos(e) {
  606. var touches = e.touches;
  607. var changedTouches = e.changedTouches;
  608. var ref = touches && touches[0] || changedTouches && changedTouches[0] || e;
  609. var x = ref.clientX;
  610. var y = ref.clientY;
  611. return {x: x, y: y};
  612. }
  613. /* global setImmediate */
  614. var Promise = inBrowser && window.Promise || PromiseFn;
  615. var Deferred = function() {
  616. var this$1 = this;
  617. this.promise = new Promise(function (resolve, reject) {
  618. this$1.reject = reject;
  619. this$1.resolve = resolve;
  620. });
  621. };
  622. /**
  623. * Promises/A+ polyfill v1.1.4 (https://github.com/bramstein/promis)
  624. */
  625. var RESOLVED = 0;
  626. var REJECTED = 1;
  627. var PENDING = 2;
  628. var async = inBrowser && window.setImmediate || setTimeout;
  629. function PromiseFn(executor) {
  630. this.state = PENDING;
  631. this.value = undefined;
  632. this.deferred = [];
  633. var promise = this;
  634. try {
  635. executor(
  636. function (x) {
  637. promise.resolve(x);
  638. },
  639. function (r) {
  640. promise.reject(r);
  641. }
  642. );
  643. } catch (e) {
  644. promise.reject(e);
  645. }
  646. }
  647. PromiseFn.reject = function (r) {
  648. return new PromiseFn(function (resolve, reject) {
  649. reject(r);
  650. });
  651. };
  652. PromiseFn.resolve = function (x) {
  653. return new PromiseFn(function (resolve, reject) {
  654. resolve(x);
  655. });
  656. };
  657. PromiseFn.all = function all(iterable) {
  658. return new PromiseFn(function (resolve, reject) {
  659. var result = [];
  660. var count = 0;
  661. if (iterable.length === 0) {
  662. resolve(result);
  663. }
  664. function resolver(i) {
  665. return function (x) {
  666. result[i] = x;
  667. count += 1;
  668. if (count === iterable.length) {
  669. resolve(result);
  670. }
  671. };
  672. }
  673. for (var i = 0; i < iterable.length; i += 1) {
  674. PromiseFn.resolve(iterable[i]).then(resolver(i), reject);
  675. }
  676. });
  677. };
  678. PromiseFn.race = function race(iterable) {
  679. return new PromiseFn(function (resolve, reject) {
  680. for (var i = 0; i < iterable.length; i += 1) {
  681. PromiseFn.resolve(iterable[i]).then(resolve, reject);
  682. }
  683. });
  684. };
  685. var p = PromiseFn.prototype;
  686. p.resolve = function resolve(x) {
  687. var promise = this;
  688. if (promise.state === PENDING) {
  689. if (x === promise) {
  690. throw new TypeError('Promise settled with itself.');
  691. }
  692. var called = false;
  693. try {
  694. var then = x && x.then;
  695. if (x !== null && isObject(x) && isFunction(then)) {
  696. then.call(
  697. x,
  698. function (x) {
  699. if (!called) {
  700. promise.resolve(x);
  701. }
  702. called = true;
  703. },
  704. function (r) {
  705. if (!called) {
  706. promise.reject(r);
  707. }
  708. called = true;
  709. }
  710. );
  711. return;
  712. }
  713. } catch (e) {
  714. if (!called) {
  715. promise.reject(e);
  716. }
  717. return;
  718. }
  719. promise.state = RESOLVED;
  720. promise.value = x;
  721. promise.notify();
  722. }
  723. };
  724. p.reject = function reject(reason) {
  725. var promise = this;
  726. if (promise.state === PENDING) {
  727. if (reason === promise) {
  728. throw new TypeError('Promise settled with itself.');
  729. }
  730. promise.state = REJECTED;
  731. promise.value = reason;
  732. promise.notify();
  733. }
  734. };
  735. p.notify = function notify() {
  736. var this$1 = this;
  737. async(function () {
  738. if (this$1.state !== PENDING) {
  739. while (this$1.deferred.length) {
  740. var ref = this$1.deferred.shift();
  741. var onResolved = ref[0];
  742. var onRejected = ref[1];
  743. var resolve = ref[2];
  744. var reject = ref[3];
  745. try {
  746. if (this$1.state === RESOLVED) {
  747. if (isFunction(onResolved)) {
  748. resolve(onResolved.call(undefined, this$1.value));
  749. } else {
  750. resolve(this$1.value);
  751. }
  752. } else if (this$1.state === REJECTED) {
  753. if (isFunction(onRejected)) {
  754. resolve(onRejected.call(undefined, this$1.value));
  755. } else {
  756. reject(this$1.value);
  757. }
  758. }
  759. } catch (e) {
  760. reject(e);
  761. }
  762. }
  763. }
  764. });
  765. };
  766. p.then = function then(onResolved, onRejected) {
  767. var this$1 = this;
  768. return new PromiseFn(function (resolve, reject) {
  769. this$1.deferred.push([onResolved, onRejected, resolve, reject]);
  770. this$1.notify();
  771. });
  772. };
  773. p.catch = function (onRejected) {
  774. return this.then(undefined, onRejected);
  775. };
  776. function ajax(url, options) {
  777. return new Promise(function (resolve, reject) {
  778. var env = assign({
  779. data: null,
  780. method: 'GET',
  781. headers: {},
  782. xhr: new XMLHttpRequest(),
  783. beforeSend: noop,
  784. responseType: ''
  785. }, options);
  786. env.beforeSend(env);
  787. var xhr = env.xhr;
  788. for (var prop in env) {
  789. if (prop in xhr) {
  790. try {
  791. xhr[prop] = env[prop];
  792. } catch (e) {}
  793. }
  794. }
  795. xhr.open(env.method.toUpperCase(), url);
  796. for (var header in env.headers) {
  797. xhr.setRequestHeader(header, env.headers[header]);
  798. }
  799. on(xhr, 'load', function () {
  800. if (xhr.status === 0 || xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) {
  801. // IE 11 does not support responseType 'json'
  802. if (env.responseType === 'json' && isString(xhr.response)) {
  803. xhr = assign(copyXhr(xhr), {response: JSON.parse(xhr.response)});
  804. }
  805. resolve(xhr);
  806. } else {
  807. reject(assign(Error(xhr.statusText), {
  808. xhr: xhr,
  809. status: xhr.status
  810. }));
  811. }
  812. });
  813. on(xhr, 'error', function () { return reject(assign(Error('Network Error'), {xhr: xhr})); });
  814. on(xhr, 'timeout', function () { return reject(assign(Error('Network Timeout'), {xhr: xhr})); });
  815. xhr.send(env.data);
  816. });
  817. }
  818. function getImage(src, srcset, sizes) {
  819. return new Promise(function (resolve, reject) {
  820. var img = new Image();
  821. img.onerror = function (e) { return reject(e); };
  822. img.onload = function () { return resolve(img); };
  823. sizes && (img.sizes = sizes);
  824. srcset && (img.srcset = srcset);
  825. img.src = src;
  826. });
  827. }
  828. function copyXhr(source) {
  829. var target = {};
  830. for (var key in source) {
  831. target[key] = source[key];
  832. }
  833. return target;
  834. }
  835. function ready(fn) {
  836. if (document.readyState !== 'loading') {
  837. fn();
  838. return;
  839. }
  840. var unbind = on(document, 'DOMContentLoaded', function () {
  841. unbind();
  842. fn();
  843. });
  844. }
  845. function index(element, ref) {
  846. return ref
  847. ? toNodes(element).indexOf(toNode(ref))
  848. : children(parent(element)).indexOf(element);
  849. }
  850. function getIndex(i, elements, current, finite) {
  851. if ( current === void 0 ) current = 0;
  852. if ( finite === void 0 ) finite = false;
  853. elements = toNodes(elements);
  854. var length = elements.length;
  855. i = isNumeric(i)
  856. ? toNumber(i)
  857. : i === 'next'
  858. ? current + 1
  859. : i === 'previous'
  860. ? current - 1
  861. : index(elements, i);
  862. if (finite) {
  863. return clamp(i, 0, length - 1);
  864. }
  865. i %= length;
  866. return i < 0 ? i + length : i;
  867. }
  868. function empty(element) {
  869. element = $(element);
  870. element.innerHTML = '';
  871. return element;
  872. }
  873. function html(parent, html) {
  874. parent = $(parent);
  875. return isUndefined(html)
  876. ? parent.innerHTML
  877. : append(parent.hasChildNodes() ? empty(parent) : parent, html);
  878. }
  879. function prepend(parent, element) {
  880. parent = $(parent);
  881. if (!parent.hasChildNodes()) {
  882. return append(parent, element);
  883. } else {
  884. return insertNodes(element, function (element) { return parent.insertBefore(element, parent.firstChild); });
  885. }
  886. }
  887. function append(parent, element) {
  888. parent = $(parent);
  889. return insertNodes(element, function (element) { return parent.appendChild(element); });
  890. }
  891. function before(ref, element) {
  892. ref = $(ref);
  893. return insertNodes(element, function (element) { return ref.parentNode.insertBefore(element, ref); });
  894. }
  895. function after(ref, element) {
  896. ref = $(ref);
  897. return insertNodes(element, function (element) { return ref.nextSibling
  898. ? before(ref.nextSibling, element)
  899. : append(ref.parentNode, element); }
  900. );
  901. }
  902. function insertNodes(element, fn) {
  903. element = isString(element) ? fragment(element) : element;
  904. return element
  905. ? 'length' in element
  906. ? toNodes(element).map(fn)
  907. : fn(element)
  908. : null;
  909. }
  910. function remove(element) {
  911. toNodes(element).map(function (element) { return element.parentNode && element.parentNode.removeChild(element); });
  912. }
  913. function wrapAll(element, structure) {
  914. structure = toNode(before(element, structure));
  915. while (structure.firstChild) {
  916. structure = structure.firstChild;
  917. }
  918. append(structure, element);
  919. return structure;
  920. }
  921. function wrapInner(element, structure) {
  922. return toNodes(toNodes(element).map(function (element) { return element.hasChildNodes ? wrapAll(toNodes(element.childNodes), structure) : append(element, structure); }
  923. ));
  924. }
  925. function unwrap(element) {
  926. toNodes(element)
  927. .map(parent)
  928. .filter(function (value, index, self) { return self.indexOf(value) === index; })
  929. .forEach(function (parent) {
  930. before(parent, parent.childNodes);
  931. remove(parent);
  932. });
  933. }
  934. var fragmentRe = /^\s*<(\w+|!)[^>]*>/;
  935. var singleTagRe = /^<(\w+)\s*\/?>(?:<\/\1>)?$/;
  936. function fragment(html) {
  937. var matches = singleTagRe.exec(html);
  938. if (matches) {
  939. return document.createElement(matches[1]);
  940. }
  941. var container = document.createElement('div');
  942. if (fragmentRe.test(html)) {
  943. container.insertAdjacentHTML('beforeend', html.trim());
  944. } else {
  945. container.textContent = html;
  946. }
  947. return container.childNodes.length > 1 ? toNodes(container.childNodes) : container.firstChild;
  948. }
  949. function apply(node, fn) {
  950. if (!isElement(node)) {
  951. return;
  952. }
  953. fn(node);
  954. node = node.firstElementChild;
  955. while (node) {
  956. var next = node.nextElementSibling;
  957. apply(node, fn);
  958. node = next;
  959. }
  960. }
  961. function $(selector, context) {
  962. return !isString(selector)
  963. ? toNode(selector)
  964. : isHtml(selector)
  965. ? toNode(fragment(selector))
  966. : find(selector, context);
  967. }
  968. function $$(selector, context) {
  969. return !isString(selector)
  970. ? toNodes(selector)
  971. : isHtml(selector)
  972. ? toNodes(fragment(selector))
  973. : findAll(selector, context);
  974. }
  975. function isHtml(str) {
  976. return str[0] === '<' || str.match(/^\s*</);
  977. }
  978. function addClass(element) {
  979. var args = [], len = arguments.length - 1;
  980. while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
  981. apply$1(element, args, 'add');
  982. }
  983. function removeClass(element) {
  984. var args = [], len = arguments.length - 1;
  985. while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
  986. apply$1(element, args, 'remove');
  987. }
  988. function removeClasses(element, cls) {
  989. attr(element, 'class', function (value) { return (value || '').replace(new RegExp(("\\b" + cls + "\\b"), 'g'), ''); });
  990. }
  991. function replaceClass(element) {
  992. var args = [], len = arguments.length - 1;
  993. while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
  994. args[0] && removeClass(element, args[0]);
  995. args[1] && addClass(element, args[1]);
  996. }
  997. function hasClass(element, cls) {
  998. return cls && toNodes(element).some(function (element) { return element.classList.contains(cls.split(' ')[0]); });
  999. }
  1000. function toggleClass(element) {
  1001. var args = [], len = arguments.length - 1;
  1002. while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
  1003. if (!args.length) {
  1004. return;
  1005. }
  1006. args = getArgs$1(args);
  1007. var force = !isString(last(args)) ? args.pop() : []; // in iOS 9.3 force === undefined evaluates to false
  1008. args = args.filter(Boolean);
  1009. toNodes(element).forEach(function (ref) {
  1010. var classList = ref.classList;
  1011. for (var i = 0; i < args.length; i++) {
  1012. supports.Force
  1013. ? classList.toggle.apply(classList, [args[i]].concat(force))
  1014. : (classList[(!isUndefined(force) ? force : !classList.contains(args[i])) ? 'add' : 'remove'](args[i]));
  1015. }
  1016. });
  1017. }
  1018. function apply$1(element, args, fn) {
  1019. args = getArgs$1(args).filter(Boolean);
  1020. args.length && toNodes(element).forEach(function (ref) {
  1021. var classList = ref.classList;
  1022. supports.Multiple
  1023. ? classList[fn].apply(classList, args)
  1024. : args.forEach(function (cls) { return classList[fn](cls); });
  1025. });
  1026. }
  1027. function getArgs$1(args) {
  1028. return args.reduce(function (args, arg) { return args.concat.call(args, isString(arg) && includes(arg, ' ') ? arg.trim().split(' ') : arg); }
  1029. , []);
  1030. }
  1031. // IE 11
  1032. var supports = {
  1033. get Multiple() {
  1034. return this.get('_multiple');
  1035. },
  1036. get Force() {
  1037. return this.get('_force');
  1038. },
  1039. get: function(key) {
  1040. if (!hasOwn(this, key)) {
  1041. var ref = document.createElement('_');
  1042. var classList = ref.classList;
  1043. classList.add('a', 'b');
  1044. classList.toggle('c', false);
  1045. this._multiple = classList.contains('b');
  1046. this._force = !classList.contains('c');
  1047. }
  1048. return this[key];
  1049. }
  1050. };
  1051. var cssNumber = {
  1052. 'animation-iteration-count': true,
  1053. 'column-count': true,
  1054. 'fill-opacity': true,
  1055. 'flex-grow': true,
  1056. 'flex-shrink': true,
  1057. 'font-weight': true,
  1058. 'line-height': true,
  1059. 'opacity': true,
  1060. 'order': true,
  1061. 'orphans': true,
  1062. 'stroke-dasharray': true,
  1063. 'stroke-dashoffset': true,
  1064. 'widows': true,
  1065. 'z-index': true,
  1066. 'zoom': true
  1067. };
  1068. function css(element, property, value) {
  1069. return toNodes(element).map(function (element) {
  1070. if (isString(property)) {
  1071. property = propName(property);
  1072. if (isUndefined(value)) {
  1073. return getStyle(element, property);
  1074. } else if (!value && !isNumber(value)) {
  1075. element.style.removeProperty(property);
  1076. } else {
  1077. element.style[property] = isNumeric(value) && !cssNumber[property] ? (value + "px") : value;
  1078. }
  1079. } else if (isArray(property)) {
  1080. var styles = getStyles(element);
  1081. return property.reduce(function (props, property) {
  1082. props[property] = styles[propName(property)];
  1083. return props;
  1084. }, {});
  1085. } else if (isObject(property)) {
  1086. each(property, function (value, property) { return css(element, property, value); });
  1087. }
  1088. return element;
  1089. })[0];
  1090. }
  1091. function getStyles(element, pseudoElt) {
  1092. element = toNode(element);
  1093. return element.ownerDocument.defaultView.getComputedStyle(element, pseudoElt);
  1094. }
  1095. function getStyle(element, property, pseudoElt) {
  1096. return getStyles(element, pseudoElt)[property];
  1097. }
  1098. var vars = {};
  1099. function getCssVar(name) {
  1100. var docEl = document.documentElement;
  1101. if (!isIE) {
  1102. return getStyles(docEl).getPropertyValue(("--uk-" + name));
  1103. }
  1104. if (!(name in vars)) {
  1105. /* usage in css: .uk-name:before { content:"xyz" } */
  1106. var element = append(docEl, document.createElement('div'));
  1107. addClass(element, ("uk-" + name));
  1108. vars[name] = getStyle(element, 'content', ':before').replace(/^["'](.*)["']$/, '$1');
  1109. remove(element);
  1110. }
  1111. return vars[name];
  1112. }
  1113. var cssProps = {};
  1114. function propName(name) {
  1115. var ret = cssProps[name];
  1116. if (!ret) {
  1117. ret = cssProps[name] = vendorPropName(name) || name;
  1118. }
  1119. return ret;
  1120. }
  1121. var cssPrefixes = ['webkit', 'moz', 'ms'];
  1122. function vendorPropName(name) {
  1123. name = hyphenate(name);
  1124. var ref = document.documentElement;
  1125. var style = ref.style;
  1126. if (name in style) {
  1127. return name;
  1128. }
  1129. var i = cssPrefixes.length, prefixedName;
  1130. while (i--) {
  1131. prefixedName = "-" + (cssPrefixes[i]) + "-" + name;
  1132. if (prefixedName in style) {
  1133. return prefixedName;
  1134. }
  1135. }
  1136. }
  1137. function transition(element, props, duration, timing) {
  1138. if ( duration === void 0 ) duration = 400;
  1139. if ( timing === void 0 ) timing = 'linear';
  1140. return Promise.all(toNodes(element).map(function (element) { return new Promise(function (resolve, reject) {
  1141. for (var name in props) {
  1142. var value = css(element, name);
  1143. if (value === '') {
  1144. css(element, name, value);
  1145. }
  1146. }
  1147. var timer = setTimeout(function () { return trigger(element, 'transitionend'); }, duration);
  1148. once(element, 'transitionend transitioncanceled', function (ref) {
  1149. var type = ref.type;
  1150. clearTimeout(timer);
  1151. removeClass(element, 'uk-transition');
  1152. css(element, {
  1153. transitionProperty: '',
  1154. transitionDuration: '',
  1155. transitionTimingFunction: ''
  1156. });
  1157. type === 'transitioncanceled' ? reject() : resolve();
  1158. }, {self: true});
  1159. addClass(element, 'uk-transition');
  1160. css(element, assign({
  1161. transitionProperty: Object.keys(props).map(propName).join(','),
  1162. transitionDuration: (duration + "ms"),
  1163. transitionTimingFunction: timing
  1164. }, props));
  1165. }); }
  1166. ));
  1167. }
  1168. var Transition = {
  1169. start: transition,
  1170. stop: function(element) {
  1171. trigger(element, 'transitionend');
  1172. return Promise.resolve();
  1173. },
  1174. cancel: function(element) {
  1175. trigger(element, 'transitioncanceled');
  1176. },
  1177. inProgress: function(element) {
  1178. return hasClass(element, 'uk-transition');
  1179. }
  1180. };
  1181. var animationPrefix = 'uk-animation-';
  1182. function animate(element, animation, duration, origin, out) {
  1183. if ( duration === void 0 ) duration = 200;
  1184. return Promise.all(toNodes(element).map(function (element) { return new Promise(function (resolve, reject) {
  1185. trigger(element, 'animationcancel');
  1186. var timer = setTimeout(function () { return trigger(element, 'animationend'); }, duration);
  1187. once(element, 'animationend animationcancel', function (ref) {
  1188. var type = ref.type;
  1189. clearTimeout(timer);
  1190. type === 'animationcancel' ? reject() : resolve();
  1191. css(element, 'animationDuration', '');
  1192. removeClasses(element, (animationPrefix + "\\S*"));
  1193. }, {self: true});
  1194. css(element, 'animationDuration', (duration + "ms"));
  1195. addClass(element, animation, animationPrefix + (out ? 'leave' : 'enter'));
  1196. if (startsWith(animation, animationPrefix)) {
  1197. addClass(element, origin && ("uk-transform-origin-" + origin), out && (animationPrefix + "reverse"));
  1198. }
  1199. }); }
  1200. ));
  1201. }
  1202. var inProgress = new RegExp((animationPrefix + "(enter|leave)"));
  1203. var Animation = {
  1204. in: animate,
  1205. out: function(element, animation, duration, origin) {
  1206. return animate(element, animation, duration, origin, true);
  1207. },
  1208. inProgress: function(element) {
  1209. return inProgress.test(attr(element, 'class'));
  1210. },
  1211. cancel: function(element) {
  1212. trigger(element, 'animationcancel');
  1213. }
  1214. };
  1215. var dirs = {
  1216. width: ['x', 'left', 'right'],
  1217. height: ['y', 'top', 'bottom']
  1218. };
  1219. function positionAt(element, target, elAttach, targetAttach, elOffset, targetOffset, flip, boundary) {
  1220. elAttach = getPos(elAttach);
  1221. targetAttach = getPos(targetAttach);
  1222. var flipped = {element: elAttach, target: targetAttach};
  1223. if (!element || !target) {
  1224. return flipped;
  1225. }
  1226. var dim = getDimensions(element);
  1227. var targetDim = getDimensions(target);
  1228. var position = targetDim;
  1229. moveTo(position, elAttach, dim, -1);
  1230. moveTo(position, targetAttach, targetDim, 1);
  1231. elOffset = getOffsets(elOffset, dim.width, dim.height);
  1232. targetOffset = getOffsets(targetOffset, targetDim.width, targetDim.height);
  1233. elOffset['x'] += targetOffset['x'];
  1234. elOffset['y'] += targetOffset['y'];
  1235. position.left += elOffset['x'];
  1236. position.top += elOffset['y'];
  1237. if (flip) {
  1238. var boundaries = [getDimensions(toWindow(element))];
  1239. if (boundary) {
  1240. boundaries.unshift(getDimensions(boundary));
  1241. }
  1242. each(dirs, function (ref, prop) {
  1243. var dir = ref[0];
  1244. var align = ref[1];
  1245. var alignFlip = ref[2];
  1246. if (!(flip === true || includes(flip, dir))) {
  1247. return;
  1248. }
  1249. boundaries.some(function (boundary) {
  1250. var elemOffset = elAttach[dir] === align
  1251. ? -dim[prop]
  1252. : elAttach[dir] === alignFlip
  1253. ? dim[prop]
  1254. : 0;
  1255. var targetOffset = targetAttach[dir] === align
  1256. ? targetDim[prop]
  1257. : targetAttach[dir] === alignFlip
  1258. ? -targetDim[prop]
  1259. : 0;
  1260. if (position[align] < boundary[align] || position[align] + dim[prop] > boundary[alignFlip]) {
  1261. var centerOffset = dim[prop] / 2;
  1262. var centerTargetOffset = targetAttach[dir] === 'center' ? -targetDim[prop] / 2 : 0;
  1263. return elAttach[dir] === 'center' && (
  1264. apply(centerOffset, centerTargetOffset)
  1265. || apply(-centerOffset, -centerTargetOffset)
  1266. ) || apply(elemOffset, targetOffset);
  1267. }
  1268. function apply(elemOffset, targetOffset) {
  1269. var newVal = (position[align] + elemOffset + targetOffset - elOffset[dir] * 2).toFixed(4);
  1270. if (newVal >= boundary[align] && newVal + dim[prop] <= boundary[alignFlip]) {
  1271. position[align] = newVal;
  1272. ['element', 'target'].forEach(function (el) {
  1273. flipped[el][dir] = !elemOffset
  1274. ? flipped[el][dir]
  1275. : flipped[el][dir] === dirs[prop][1]
  1276. ? dirs[prop][2]
  1277. : dirs[prop][1];
  1278. });
  1279. return true;
  1280. }
  1281. }
  1282. });
  1283. });
  1284. }
  1285. offset(element, position);
  1286. return flipped;
  1287. }
  1288. function offset(element, coordinates) {
  1289. if (!coordinates) {
  1290. return getDimensions(element);
  1291. }
  1292. var currentOffset = getDimensions(element);
  1293. var pos = css(element, 'position');
  1294. ['left', 'top'].forEach(function (prop) {
  1295. if (prop in coordinates) {
  1296. var value = css(element, prop);
  1297. css(element, prop, coordinates[prop] - currentOffset[prop]
  1298. + toFloat(pos === 'absolute' && value === 'auto'
  1299. ? position(element)[prop]
  1300. : value)
  1301. );
  1302. }
  1303. });
  1304. }
  1305. function getDimensions(element) {
  1306. if (!element) {
  1307. return {};
  1308. }
  1309. var ref = toWindow(element);
  1310. var top = ref.pageYOffset;
  1311. var left = ref.pageXOffset;
  1312. if (isWindow(element)) {
  1313. var height = element.innerHeight;
  1314. var width = element.innerWidth;
  1315. return {
  1316. top: top,
  1317. left: left,
  1318. height: height,
  1319. width: width,
  1320. bottom: top + height,
  1321. right: left + width
  1322. };
  1323. }
  1324. var style, hidden;
  1325. if (!isVisible(element) && css(element, 'display') === 'none') {
  1326. style = attr(element, 'style');
  1327. hidden = attr(element, 'hidden');
  1328. attr(element, {
  1329. style: ((style || '') + ";display:block !important;"),
  1330. hidden: null
  1331. });
  1332. }
  1333. element = toNode(element);
  1334. var rect = element.getBoundingClientRect();
  1335. if (!isUndefined(style)) {
  1336. attr(element, {style: style, hidden: hidden});
  1337. }
  1338. return {
  1339. height: rect.height,
  1340. width: rect.width,
  1341. top: rect.top + top,
  1342. left: rect.left + left,
  1343. bottom: rect.bottom + top,
  1344. right: rect.right + left
  1345. };
  1346. }
  1347. function position(element, parent) {
  1348. parent = parent || (toNode(element) || {}).offsetParent || toWindow(element).document.documentElement;
  1349. var elementOffset = offset(element);
  1350. var parentOffset = offset(parent);
  1351. return {
  1352. top: elementOffset.top - parentOffset.top - toFloat(css(parent, 'borderTopWidth')),
  1353. left: elementOffset.left - parentOffset.left - toFloat(css(parent, 'borderLeftWidth'))
  1354. };
  1355. }
  1356. function offsetPosition(element) {
  1357. var offset = [0, 0];
  1358. element = toNode(element);
  1359. do {
  1360. offset[0] += element.offsetTop;
  1361. offset[1] += element.offsetLeft;
  1362. if (css(element, 'position') === 'fixed') {
  1363. var win = toWindow(element);
  1364. offset[0] += win.pageYOffset;
  1365. offset[1] += win.pageXOffset;
  1366. return offset;
  1367. }
  1368. } while ((element = element.offsetParent));
  1369. return offset;
  1370. }
  1371. var height = dimension('height');
  1372. var width = dimension('width');
  1373. function dimension(prop) {
  1374. var propName = ucfirst(prop);
  1375. return function (element, value) {
  1376. if (isUndefined(value)) {
  1377. if (isWindow(element)) {
  1378. return element[("inner" + propName)];
  1379. }
  1380. if (isDocument(element)) {
  1381. var doc = element.documentElement;
  1382. return Math.max(doc[("offset" + propName)], doc[("scroll" + propName)]);
  1383. }
  1384. element = toNode(element);
  1385. value = css(element, prop);
  1386. value = value === 'auto' ? element[("offset" + propName)] : toFloat(value) || 0;
  1387. return value - boxModelAdjust(element, prop);
  1388. } else {
  1389. css(element, prop, !value && value !== 0
  1390. ? ''
  1391. : +value + boxModelAdjust(element, prop) + 'px'
  1392. );
  1393. }
  1394. };
  1395. }
  1396. function boxModelAdjust(element, prop, sizing) {
  1397. if ( sizing === void 0 ) sizing = 'border-box';
  1398. return css(element, 'boxSizing') === sizing
  1399. ? dirs[prop].slice(1).map(ucfirst).reduce(function (value, prop) { return value
  1400. + toFloat(css(element, ("padding" + prop)))
  1401. + toFloat(css(element, ("border" + prop + "Width"))); }
  1402. , 0)
  1403. : 0;
  1404. }
  1405. function moveTo(position, attach, dim, factor) {
  1406. each(dirs, function (ref, prop) {
  1407. var dir = ref[0];
  1408. var align = ref[1];
  1409. var alignFlip = ref[2];
  1410. if (attach[dir] === alignFlip) {
  1411. position[align] += dim[prop] * factor;
  1412. } else if (attach[dir] === 'center') {
  1413. position[align] += dim[prop] * factor / 2;
  1414. }
  1415. });
  1416. }
  1417. function getPos(pos) {
  1418. var x = /left|center|right/;
  1419. var y = /top|center|bottom/;
  1420. pos = (pos || '').split(' ');
  1421. if (pos.length === 1) {
  1422. pos = x.test(pos[0])
  1423. ? pos.concat('center')
  1424. : y.test(pos[0])
  1425. ? ['center'].concat(pos)
  1426. : ['center', 'center'];
  1427. }
  1428. return {
  1429. x: x.test(pos[0]) ? pos[0] : 'center',
  1430. y: y.test(pos[1]) ? pos[1] : 'center'
  1431. };
  1432. }
  1433. function getOffsets(offsets, width, height) {
  1434. var ref = (offsets || '').split(' ');
  1435. var x = ref[0];
  1436. var y = ref[1];
  1437. return {
  1438. x: x ? toFloat(x) * (endsWith(x, '%') ? width / 100 : 1) : 0,
  1439. y: y ? toFloat(y) * (endsWith(y, '%') ? height / 100 : 1) : 0
  1440. };
  1441. }
  1442. function flipPosition(pos) {
  1443. switch (pos) {
  1444. case 'left':
  1445. return 'right';
  1446. case 'right':
  1447. return 'left';
  1448. case 'top':
  1449. return 'bottom';
  1450. case 'bottom':
  1451. return 'top';
  1452. default:
  1453. return pos;
  1454. }
  1455. }
  1456. function toPx(value, property, element) {
  1457. if ( property === void 0 ) property = 'width';
  1458. if ( element === void 0 ) element = window;
  1459. return isNumeric(value)
  1460. ? +value
  1461. : endsWith(value, 'vh')
  1462. ? percent(height(toWindow(element)), value)
  1463. : endsWith(value, 'vw')
  1464. ? percent(width(toWindow(element)), value)
  1465. : endsWith(value, '%')
  1466. ? percent(getDimensions(element)[property], value)
  1467. : toFloat(value);
  1468. }
  1469. function percent(base, value) {
  1470. return base * toFloat(value) / 100;
  1471. }
  1472. /*
  1473. Based on:
  1474. Copyright (c) 2016 Wilson Page wilsonpage@me.com
  1475. https://github.com/wilsonpage/fastdom
  1476. */
  1477. var fastdom = {
  1478. reads: [],
  1479. writes: [],
  1480. read: function(task) {
  1481. this.reads.push(task);
  1482. scheduleFlush();
  1483. return task;
  1484. },
  1485. write: function(task) {
  1486. this.writes.push(task);
  1487. scheduleFlush();
  1488. return task;
  1489. },
  1490. clear: function(task) {
  1491. return remove$1(this.reads, task) || remove$1(this.writes, task);
  1492. },
  1493. flush: flush
  1494. };
  1495. function flush(recursion) {
  1496. if ( recursion === void 0 ) recursion = 1;
  1497. runTasks(fastdom.reads);
  1498. runTasks(fastdom.writes.splice(0, fastdom.writes.length));
  1499. fastdom.scheduled = false;
  1500. if (fastdom.reads.length || fastdom.writes.length) {
  1501. scheduleFlush(recursion + 1);
  1502. }
  1503. }
  1504. var RECURSION_LIMIT = 4;
  1505. function scheduleFlush(recursion) {
  1506. if (fastdom.scheduled) {
  1507. return;
  1508. }
  1509. fastdom.scheduled = true;
  1510. if (recursion && recursion < RECURSION_LIMIT) {
  1511. Promise.resolve().then(function () { return flush(recursion); });
  1512. } else {
  1513. requestAnimationFrame(function () { return flush(); });
  1514. }
  1515. }
  1516. function runTasks(tasks) {
  1517. var task;
  1518. while ((task = tasks.shift())) {
  1519. task();
  1520. }
  1521. }
  1522. function remove$1(array, item) {
  1523. var index = array.indexOf(item);
  1524. return !!~index && !!array.splice(index, 1);
  1525. }
  1526. function MouseTracker() {}
  1527. MouseTracker.prototype = {
  1528. positions: [],
  1529. init: function() {
  1530. var this$1 = this;
  1531. this.positions = [];
  1532. var position;
  1533. this.unbind = on(document, 'mousemove', function (e) { return position = getEventPos(e); });
  1534. this.interval = setInterval(function () {
  1535. if (!position) {
  1536. return;
  1537. }
  1538. this$1.positions.push(position);
  1539. if (this$1.positions.length > 5) {
  1540. this$1.positions.shift();
  1541. }
  1542. }, 50);
  1543. },
  1544. cancel: function() {
  1545. this.unbind && this.unbind();
  1546. this.interval && clearInterval(this.interval);
  1547. },
  1548. movesTo: function(target) {
  1549. if (this.positions.length < 2) {
  1550. return false;
  1551. }
  1552. var p = target.getBoundingClientRect();
  1553. var left = p.left;
  1554. var right = p.right;
  1555. var top = p.top;
  1556. var bottom = p.bottom;
  1557. var ref = this.positions;
  1558. var prevPosition = ref[0];
  1559. var position = last(this.positions);
  1560. var path = [prevPosition, position];
  1561. if (pointInRect(position, p)) {
  1562. return false;
  1563. }
  1564. var diagonals = [[{x: left, y: top}, {x: right, y: bottom}], [{x: left, y: bottom}, {x: right, y: top}]];
  1565. return diagonals.some(function (diagonal) {
  1566. var intersection = intersect(path, diagonal);
  1567. return intersection && pointInRect(intersection, p);
  1568. });
  1569. }
  1570. };
  1571. // Inspired by http://paulbourke.net/geometry/pointlineplane/
  1572. function intersect(ref, ref$1) {
  1573. var ref_0 = ref[0];
  1574. var x1 = ref_0.x;
  1575. var y1 = ref_0.y;
  1576. var ref_1 = ref[1];
  1577. var x2 = ref_1.x;
  1578. var y2 = ref_1.y;
  1579. var ref$1_0 = ref$1[0];
  1580. var x3 = ref$1_0.x;
  1581. var y3 = ref$1_0.y;
  1582. var ref$1_1 = ref$1[1];
  1583. var x4 = ref$1_1.x;
  1584. var y4 = ref$1_1.y;
  1585. var denominator = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);
  1586. // Lines are parallel
  1587. if (denominator === 0) {
  1588. return false;
  1589. }
  1590. var ua = ((x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3)) / denominator;
  1591. if (ua < 0) {
  1592. return false;
  1593. }
  1594. // Return an object with the x and y coordinates of the intersection
  1595. return {x: x1 + ua * (x2 - x1), y: y1 + ua * (y2 - y1)};
  1596. }
  1597. var strats = {};
  1598. strats.events =
  1599. strats.created =
  1600. strats.beforeConnect =
  1601. strats.connected =
  1602. strats.beforeDisconnect =
  1603. strats.disconnected =
  1604. strats.destroy = concatStrat;
  1605. // args strategy
  1606. strats.args = function (parentVal, childVal) {
  1607. return childVal !== false && concatStrat(childVal || parentVal);
  1608. };
  1609. // update strategy
  1610. strats.update = function (parentVal, childVal) {
  1611. return sortBy(concatStrat(parentVal, isFunction(childVal) ? {read: childVal} : childVal), 'order');
  1612. };
  1613. // property strategy
  1614. strats.props = function (parentVal, childVal) {
  1615. if (isArray(childVal)) {
  1616. childVal = childVal.reduce(function (value, key) {
  1617. value[key] = String;
  1618. return value;
  1619. }, {});
  1620. }
  1621. return strats.methods(parentVal, childVal);
  1622. };
  1623. // extend strategy
  1624. strats.computed =
  1625. strats.methods = function (parentVal, childVal) {
  1626. return childVal
  1627. ? parentVal
  1628. ? assign({}, parentVal, childVal)
  1629. : childVal
  1630. : parentVal;
  1631. };
  1632. // data strategy
  1633. strats.data = function (parentVal, childVal, vm) {
  1634. if (!vm) {
  1635. if (!childVal) {
  1636. return parentVal;
  1637. }
  1638. if (!parentVal) {
  1639. return childVal;
  1640. }
  1641. return function (vm) {
  1642. return mergeFnData(parentVal, childVal, vm);
  1643. };
  1644. }
  1645. return mergeFnData(parentVal, childVal, vm);
  1646. };
  1647. function mergeFnData(parentVal, childVal, vm) {
  1648. return strats.computed(
  1649. isFunction(parentVal)
  1650. ? parentVal.call(vm, vm)
  1651. : parentVal,
  1652. isFunction(childVal)
  1653. ? childVal.call(vm, vm)
  1654. : childVal
  1655. );
  1656. }
  1657. // concat strategy
  1658. function concatStrat(parentVal, childVal) {
  1659. parentVal = parentVal && !isArray(parentVal) ? [parentVal] : parentVal;
  1660. return childVal
  1661. ? parentVal
  1662. ? parentVal.concat(childVal)
  1663. : isArray(childVal)
  1664. ? childVal
  1665. : [childVal]
  1666. : parentVal;
  1667. }
  1668. // default strategy
  1669. function defaultStrat(parentVal, childVal) {
  1670. return isUndefined(childVal) ? parentVal : childVal;
  1671. }
  1672. function mergeOptions(parent, child, vm) {
  1673. var options = {};
  1674. if (isFunction(child)) {
  1675. child = child.options;
  1676. }
  1677. if (child.extends) {
  1678. parent = mergeOptions(parent, child.extends, vm);
  1679. }
  1680. if (child.mixins) {
  1681. for (var i = 0, l = child.mixins.length; i < l; i++) {
  1682. parent = mergeOptions(parent, child.mixins[i], vm);
  1683. }
  1684. }
  1685. for (var key in parent) {
  1686. mergeKey(key);
  1687. }
  1688. for (var key$1 in child) {
  1689. if (!hasOwn(parent, key$1)) {
  1690. mergeKey(key$1);
  1691. }
  1692. }
  1693. function mergeKey(key) {
  1694. options[key] = (strats[key] || defaultStrat)(parent[key], child[key], vm);
  1695. }
  1696. return options;
  1697. }
  1698. function parseOptions(options, args) {
  1699. var obj;
  1700. if ( args === void 0 ) args = [];
  1701. try {
  1702. return !options
  1703. ? {}
  1704. : startsWith(options, '{')
  1705. ? JSON.parse(options)
  1706. : args.length && !includes(options, ':')
  1707. ? (( obj = {}, obj[args[0]] = options, obj ))
  1708. : options.split(';').reduce(function (options, option) {
  1709. var ref = option.split(/:(.*)/);
  1710. var key = ref[0];
  1711. var value = ref[1];
  1712. if (key && !isUndefined(value)) {
  1713. options[key.trim()] = value.trim();
  1714. }
  1715. return options;
  1716. }, {});
  1717. } catch (e) {
  1718. return {};
  1719. }
  1720. }
  1721. var id = 0;
  1722. var Player = function(el) {
  1723. this.id = ++id;
  1724. this.el = toNode(el);
  1725. };
  1726. Player.prototype.isVideo = function () {
  1727. return this.isYoutube() || this.isVimeo() || this.isHTML5();
  1728. };
  1729. Player.prototype.isHTML5 = function () {
  1730. return this.el.tagName === 'VIDEO';
  1731. };
  1732. Player.prototype.isIFrame = function () {
  1733. return this.el.tagName === 'IFRAME';
  1734. };
  1735. Player.prototype.isYoutube = function () {
  1736. return this.isIFrame() && !!this.el.src.match(/\/\/.*?youtube(-nocookie)?\.[a-z]+\/(watch\?v=[^&\s]+|embed)|youtu\.be\/.*/);
  1737. };
  1738. Player.prototype.isVimeo = function () {
  1739. return this.isIFrame() && !!this.el.src.match(/vimeo\.com\/video\/.*/);
  1740. };
  1741. Player.prototype.enableApi = function () {
  1742. var this$1 = this;
  1743. if (this.ready) {
  1744. return this.ready;
  1745. }
  1746. var youtube = this.isYoutube();
  1747. var vimeo = this.isVimeo();
  1748. var poller;
  1749. if (youtube || vimeo) {
  1750. return this.ready = new Promise(function (resolve) {
  1751. once(this$1.el, 'load', function () {
  1752. if (youtube) {
  1753. var listener = function () { return post(this$1.el, {event: 'listening', id: this$1.id}); };
  1754. poller = setInterval(listener, 100);
  1755. listener();
  1756. }
  1757. });
  1758. listen(function (data) { return youtube && data.id === this$1.id && data.event === 'onReady' || vimeo && Number(data.player_id) === this$1.id; })
  1759. .then(function () {
  1760. resolve();
  1761. poller && clearInterval(poller);
  1762. });
  1763. attr(this$1.el, 'src', ("" + (this$1.el.src) + (includes(this$1.el.src, '?') ? '&' : '?') + (youtube ? 'enablejsapi=1' : ("api=1&player_id=" + (this$1.id)))));
  1764. });
  1765. }
  1766. return Promise.resolve();
  1767. };
  1768. Player.prototype.play = function () {
  1769. var this$1 = this;
  1770. if (!this.isVideo()) {
  1771. return;
  1772. }
  1773. if (this.isIFrame()) {
  1774. this.enableApi().then(function () { return post(this$1.el, {func: 'playVideo', method: 'play'}); });
  1775. } else if (this.isHTML5()) {
  1776. try {
  1777. var promise = this.el.play();
  1778. if (promise) {
  1779. promise.catch(noop);
  1780. }
  1781. } catch (e) {}
  1782. }
  1783. };
  1784. Player.prototype.pause = function () {
  1785. var this$1 = this;
  1786. if (!this.isVideo()) {
  1787. return;
  1788. }
  1789. if (this.isIFrame()) {
  1790. this.enableApi().then(function () { return post(this$1.el, {func: 'pauseVideo', method: 'pause'}); });
  1791. } else if (this.isHTML5()) {
  1792. this.el.pause();
  1793. }
  1794. };
  1795. Player.prototype.mute = function () {
  1796. var this$1 = this;
  1797. if (!this.isVideo()) {
  1798. return;
  1799. }
  1800. if (this.isIFrame()) {
  1801. this.enableApi().then(function () { return post(this$1.el, {func: 'mute', method: 'setVolume', value: 0}); });
  1802. } else if (this.isHTML5()) {
  1803. this.el.muted = true;
  1804. attr(this.el, 'muted', '');
  1805. }
  1806. };
  1807. function post(el, cmd) {
  1808. try {
  1809. el.contentWindow.postMessage(JSON.stringify(assign({event: 'command'}, cmd)), '*');
  1810. } catch (e) {}
  1811. }
  1812. function listen(cb) {
  1813. return new Promise(function (resolve) { return once(window, 'message', function (_, data) { return resolve(data); }, false, function (ref) {
  1814. var data = ref.data;
  1815. try {
  1816. data = JSON.parse(data);
  1817. return data && cb(data);
  1818. } catch (e) {}
  1819. }); }
  1820. );
  1821. }
  1822. function isInView(element, offsetTop, offsetLeft) {
  1823. if ( offsetTop === void 0 ) offsetTop = 0;
  1824. if ( offsetLeft === void 0 ) offsetLeft = 0;
  1825. if (!isVisible(element)) {
  1826. return false;
  1827. }
  1828. var parents = overflowParents(element);
  1829. return parents.every(function (parent, i) {
  1830. var client = offset(parents[i + 1] || element);
  1831. var ref = offset(getViewport(parent));
  1832. var top = ref.top;
  1833. var left = ref.left;
  1834. var bottom = ref.bottom;
  1835. var right = ref.right;
  1836. return intersectRect(client, {
  1837. top: top - offsetTop,
  1838. left: left - offsetLeft,
  1839. bottom: bottom + offsetTop,
  1840. right: right + offsetLeft
  1841. });
  1842. });
  1843. }
  1844. function scrollTop(element, top) {
  1845. if (isWindow(element) || isDocument(element)) {
  1846. element = getScrollingElement(element);
  1847. } else {
  1848. element = toNode(element);
  1849. }
  1850. element.scrollTop = top;
  1851. }
  1852. function scrollIntoView(element, ref) {
  1853. if ( ref === void 0 ) ref = {};
  1854. var offsetBy = ref.offset; if ( offsetBy === void 0 ) offsetBy = 0;
  1855. if (!isVisible(element)) {
  1856. return;
  1857. }
  1858. var parents = overflowParents(element).concat(element);
  1859. var promise = Promise.resolve();
  1860. var loop = function ( i ) {
  1861. promise = promise.then(function () { return new Promise(function (resolve) {
  1862. var scrollElement = parents[i];
  1863. var element = parents[i + 1];
  1864. var scroll = scrollElement.scrollTop;
  1865. var top = Math.ceil(position(element, getViewport(scrollElement)).top - offsetBy);
  1866. var duration = getDuration(Math.abs(top));
  1867. var start = Date.now();
  1868. var step = function () {
  1869. var percent = ease(clamp((Date.now() - start) / duration));
  1870. scrollTop(scrollElement, scroll + top * percent);
  1871. // scroll more if we have not reached our destination
  1872. if (percent !== 1) {
  1873. requestAnimationFrame(step);
  1874. } else {
  1875. resolve();
  1876. }
  1877. };
  1878. step();
  1879. }); }
  1880. );
  1881. };
  1882. for (var i = 0; i < parents.length - 1; i++) loop( i );
  1883. return promise;
  1884. function getDuration(dist) {
  1885. return 40 * Math.pow(dist, .375);
  1886. }
  1887. function ease(k) {
  1888. return 0.5 * (1 - Math.cos(Math.PI * k));
  1889. }
  1890. }
  1891. function scrolledOver(element, heightOffset) {
  1892. if ( heightOffset === void 0 ) heightOffset = 0;
  1893. if (!isVisible(element)) {
  1894. return 0;
  1895. }
  1896. var scrollElement = last(scrollParents(element));
  1897. var scrollHeight = scrollElement.scrollHeight;
  1898. var scrollTop = scrollElement.scrollTop;
  1899. var viewport = getViewport(scrollElement);
  1900. var viewportHeight = offset(viewport).height;
  1901. var viewportTop = offsetPosition(element)[0] - scrollTop - offsetPosition(scrollElement)[0];
  1902. var viewportDist = Math.min(viewportHeight, viewportTop + scrollTop);
  1903. var top = viewportTop - viewportDist;
  1904. var dist = Math.min(
  1905. offset(element).height + heightOffset + viewportDist,
  1906. scrollHeight - (viewportTop + scrollTop),
  1907. scrollHeight - viewportHeight
  1908. );
  1909. return clamp(-1 * top / dist);
  1910. }
  1911. function scrollParents(element, overflowRe) {
  1912. if ( overflowRe === void 0 ) overflowRe = /auto|scroll/;
  1913. var scrollEl = getScrollingElement(element);
  1914. var scrollParents = parents(element).filter(function (parent) { return parent === scrollEl
  1915. || overflowRe.test(css(parent, 'overflow'))
  1916. && parent.scrollHeight > Math.round(offset(parent).height); }
  1917. ).reverse();
  1918. return scrollParents.length ? scrollParents : [scrollEl];
  1919. }
  1920. function getViewport(scrollElement) {
  1921. return scrollElement === getScrollingElement(scrollElement) ? window : scrollElement;
  1922. }
  1923. function overflowParents(element) {
  1924. return scrollParents(element, /auto|scroll|hidden/);
  1925. }
  1926. function getScrollingElement(element) {
  1927. var ref = toWindow(element);
  1928. var document = ref.document;
  1929. return document.scrollingElement || document.documentElement;
  1930. }
  1931. var IntersectionObserver = inBrowser && window.IntersectionObserver
  1932. || /*@__PURE__*/(function () {
  1933. function IntersectionObserverClass(callback, ref) {
  1934. var this$1 = this;
  1935. if ( ref === void 0 ) ref = {};
  1936. var rootMargin = ref.rootMargin; if ( rootMargin === void 0 ) rootMargin = '0 0';
  1937. this.targets = [];
  1938. var ref$1 = (rootMargin || '0 0').split(' ').map(toFloat);
  1939. var offsetTop = ref$1[0];
  1940. var offsetLeft = ref$1[1];
  1941. this.offsetTop = offsetTop;
  1942. this.offsetLeft = offsetLeft;
  1943. var pending;
  1944. this.apply = function () {
  1945. if (pending) {
  1946. return;
  1947. }
  1948. pending = requestAnimationFrame(function () { return setTimeout(function () {
  1949. var records = this$1.takeRecords();
  1950. if (records.length) {
  1951. callback(records, this$1);
  1952. }
  1953. pending = false;
  1954. }); });
  1955. };
  1956. this.off = on(window, 'scroll resize load', this.apply, {passive: true, capture: true});
  1957. }
  1958. IntersectionObserverClass.prototype.takeRecords = function () {
  1959. var this$1 = this;
  1960. return this.targets.filter(function (entry) {
  1961. var inView = isInView(entry.target, this$1.offsetTop, this$1.offsetLeft);
  1962. if (entry.isIntersecting === null || inView ^ entry.isIntersecting) {
  1963. entry.isIntersecting = inView;
  1964. return true;
  1965. }
  1966. });
  1967. };
  1968. IntersectionObserverClass.prototype.observe = function (target) {
  1969. this.targets.push({
  1970. target: target,
  1971. isIntersecting: null
  1972. });
  1973. this.apply();
  1974. };
  1975. IntersectionObserverClass.prototype.disconnect = function () {
  1976. this.targets = [];
  1977. this.off();
  1978. };
  1979. return IntersectionObserverClass;
  1980. }());
  1981. var util = /*#__PURE__*/Object.freeze({
  1982. __proto__: null,
  1983. ajax: ajax,
  1984. getImage: getImage,
  1985. transition: transition,
  1986. Transition: Transition,
  1987. animate: animate,
  1988. Animation: Animation,
  1989. attr: attr,
  1990. hasAttr: hasAttr,
  1991. removeAttr: removeAttr,
  1992. data: data,
  1993. addClass: addClass,
  1994. removeClass: removeClass,
  1995. removeClasses: removeClasses,
  1996. replaceClass: replaceClass,
  1997. hasClass: hasClass,
  1998. toggleClass: toggleClass,
  1999. positionAt: positionAt,
  2000. offset: offset,
  2001. position: position,
  2002. offsetPosition: offsetPosition,
  2003. height: height,
  2004. width: width,
  2005. boxModelAdjust: boxModelAdjust,
  2006. flipPosition: flipPosition,
  2007. toPx: toPx,
  2008. ready: ready,
  2009. index: index,
  2010. getIndex: getIndex,
  2011. empty: empty,
  2012. html: html,
  2013. prepend: prepend,
  2014. append: append,
  2015. before: before,
  2016. after: after,
  2017. remove: remove,
  2018. wrapAll: wrapAll,
  2019. wrapInner: wrapInner,
  2020. unwrap: unwrap,
  2021. fragment: fragment,
  2022. apply: apply,
  2023. $: $,
  2024. $$: $$,
  2025. inBrowser: inBrowser,
  2026. isIE: isIE,
  2027. isRtl: isRtl,
  2028. hasTouch: hasTouch,
  2029. pointerDown: pointerDown,
  2030. pointerMove: pointerMove,
  2031. pointerUp: pointerUp,
  2032. pointerEnter: pointerEnter,
  2033. pointerLeave: pointerLeave,
  2034. pointerCancel: pointerCancel,
  2035. on: on,
  2036. off: off,
  2037. once: once,
  2038. trigger: trigger,
  2039. createEvent: createEvent,
  2040. toEventTargets: toEventTargets,
  2041. isTouch: isTouch,
  2042. getEventPos: getEventPos,
  2043. fastdom: fastdom,
  2044. isVoidElement: isVoidElement,
  2045. isVisible: isVisible,
  2046. selInput: selInput,
  2047. isInput: isInput,
  2048. filter: filter,
  2049. within: within,
  2050. parents: parents,
  2051. children: children,
  2052. hasOwn: hasOwn,
  2053. hyphenate: hyphenate,
  2054. camelize: camelize,
  2055. ucfirst: ucfirst,
  2056. startsWith: startsWith,
  2057. endsWith: endsWith,
  2058. includes: includes,
  2059. findIndex: findIndex,
  2060. isArray: isArray,
  2061. isFunction: isFunction,
  2062. isObject: isObject,
  2063. isPlainObject: isPlainObject,
  2064. isWindow: isWindow,
  2065. isDocument: isDocument,
  2066. isJQuery: isJQuery,
  2067. isNode: isNode,
  2068. isElement: isElement,
  2069. isNodeCollection: isNodeCollection,
  2070. isBoolean: isBoolean,
  2071. isString: isString,
  2072. isNumber: isNumber,
  2073. isNumeric: isNumeric,
  2074. isEmpty: isEmpty,
  2075. isUndefined: isUndefined,
  2076. toBoolean: toBoolean,
  2077. toNumber: toNumber,
  2078. toFloat: toFloat,
  2079. toNode: toNode,
  2080. toNodes: toNodes,
  2081. toWindow: toWindow,
  2082. toList: toList,
  2083. toMs: toMs,
  2084. isEqual: isEqual,
  2085. swap: swap,
  2086. assign: assign,
  2087. last: last,
  2088. each: each,
  2089. sortBy: sortBy,
  2090. uniqueBy: uniqueBy,
  2091. clamp: clamp,
  2092. noop: noop,
  2093. intersectRect: intersectRect,
  2094. pointInRect: pointInRect,
  2095. Dimensions: Dimensions,
  2096. MouseTracker: MouseTracker,
  2097. mergeOptions: mergeOptions,
  2098. parseOptions: parseOptions,
  2099. Player: Player,
  2100. Promise: Promise,
  2101. Deferred: Deferred,
  2102. IntersectionObserver: IntersectionObserver,
  2103. query: query,
  2104. queryAll: queryAll,
  2105. find: find,
  2106. findAll: findAll,
  2107. matches: matches,
  2108. closest: closest,
  2109. parent: parent,
  2110. escape: escape,
  2111. css: css,
  2112. getStyles: getStyles,
  2113. getStyle: getStyle,
  2114. getCssVar: getCssVar,
  2115. propName: propName,
  2116. isInView: isInView,
  2117. scrollTop: scrollTop,
  2118. scrollIntoView: scrollIntoView,
  2119. scrolledOver: scrolledOver,
  2120. scrollParents: scrollParents,
  2121. getViewport: getViewport
  2122. });
  2123. function globalAPI (UIkit) {
  2124. var DATA = UIkit.data;
  2125. UIkit.use = function (plugin) {
  2126. if (plugin.installed) {
  2127. return;
  2128. }
  2129. plugin.call(null, this);
  2130. plugin.installed = true;
  2131. return this;
  2132. };
  2133. UIkit.mixin = function (mixin, component) {
  2134. component = (isString(component) ? UIkit.component(component) : component) || this;
  2135. component.options = mergeOptions(component.options, mixin);
  2136. };
  2137. UIkit.extend = function (options) {
  2138. options = options || {};
  2139. var Super = this;
  2140. var Sub = function UIkitComponent(options) {
  2141. this._init(options);
  2142. };
  2143. Sub.prototype = Object.create(Super.prototype);
  2144. Sub.prototype.constructor = Sub;
  2145. Sub.options = mergeOptions(Super.options, options);
  2146. Sub.super = Super;
  2147. Sub.extend = Super.extend;
  2148. return Sub;
  2149. };
  2150. UIkit.update = function (element, e) {
  2151. element = element ? toNode(element) : document.body;
  2152. parents(element).reverse().forEach(function (element) { return update(element[DATA], e); });
  2153. apply(element, function (element) { return update(element[DATA], e); });
  2154. };
  2155. var container;
  2156. Object.defineProperty(UIkit, 'container', {
  2157. get: function() {
  2158. return container || document.body;
  2159. },
  2160. set: function(element) {
  2161. container = $(element);
  2162. }
  2163. });
  2164. function update(data, e) {
  2165. if (!data) {
  2166. return;
  2167. }
  2168. for (var name in data) {
  2169. if (data[name]._connected) {
  2170. data[name]._callUpdate(e);
  2171. }
  2172. }
  2173. }
  2174. }
  2175. function hooksAPI (UIkit) {
  2176. UIkit.prototype._callHook = function (hook) {
  2177. var this$1 = this;
  2178. var handlers = this.$options[hook];
  2179. if (handlers) {
  2180. handlers.forEach(function (handler) { return handler.call(this$1); });
  2181. }
  2182. };
  2183. UIkit.prototype._callConnected = function () {
  2184. if (this._connected) {
  2185. return;
  2186. }
  2187. this._data = {};
  2188. this._computeds = {};
  2189. this._frames = {reads: {}, writes: {}};
  2190. this._initProps();
  2191. this._callHook('beforeConnect');
  2192. this._connected = true;
  2193. this._initEvents();
  2194. this._initObserver();
  2195. this._callHook('connected');
  2196. this._callUpdate();
  2197. };
  2198. UIkit.prototype._callDisconnected = function () {
  2199. if (!this._connected) {
  2200. return;
  2201. }
  2202. this._callHook('beforeDisconnect');
  2203. if (this._observer) {
  2204. this._observer.disconnect();
  2205. this._observer = null;
  2206. }
  2207. this._unbindEvents();
  2208. this._callHook('disconnected');
  2209. this._connected = false;
  2210. };
  2211. UIkit.prototype._callUpdate = function (e) {
  2212. var this$1 = this;
  2213. if ( e === void 0 ) e = 'update';
  2214. var type = e.type || e;
  2215. if (includes(['update', 'resize'], type)) {
  2216. this._callWatches();
  2217. }
  2218. var updates = this.$options.update;
  2219. var ref = this._frames;
  2220. var reads = ref.reads;
  2221. var writes = ref.writes;
  2222. if (!updates) {
  2223. return;
  2224. }
  2225. updates.forEach(function (ref, i) {
  2226. var read = ref.read;
  2227. var write = ref.write;
  2228. var events = ref.events;
  2229. if (type !== 'update' && !includes(events, type)) {
  2230. return;
  2231. }
  2232. if (read && !includes(fastdom.reads, reads[i])) {
  2233. reads[i] = fastdom.read(function () {
  2234. var result = this$1._connected && read.call(this$1, this$1._data, type);
  2235. if (result === false && write) {
  2236. fastdom.clear(writes[i]);
  2237. } else if (isPlainObject(result)) {
  2238. assign(this$1._data, result);
  2239. }
  2240. });
  2241. }
  2242. if (write && !includes(fastdom.writes, writes[i])) {
  2243. writes[i] = fastdom.write(function () { return this$1._connected && write.call(this$1, this$1._data, type); });
  2244. }
  2245. });
  2246. };
  2247. UIkit.prototype._callWatches = function () {
  2248. var this$1 = this;
  2249. var ref = this;
  2250. var _frames = ref._frames;
  2251. if (_frames._watch) {
  2252. return;
  2253. }
  2254. var initital = !hasOwn(_frames, '_watch');
  2255. _frames._watch = fastdom.read(function () {
  2256. if (!this$1._connected) {
  2257. return;
  2258. }
  2259. var ref = this$1;
  2260. var computed = ref.$options.computed;
  2261. var _computeds = ref._computeds;
  2262. for (var key in computed) {
  2263. var hasPrev = hasOwn(_computeds, key);
  2264. var prev = _computeds[key];
  2265. delete _computeds[key];
  2266. var ref$1 = computed[key];
  2267. var watch = ref$1.watch;
  2268. var immediate = ref$1.immediate;
  2269. if (watch && (
  2270. initital && immediate
  2271. || hasPrev && !isEqual(prev, this$1[key])
  2272. )) {
  2273. watch.call(this$1, this$1[key], prev);
  2274. }
  2275. }
  2276. _frames._watch = null;
  2277. });
  2278. };
  2279. }
  2280. function stateAPI (UIkit) {
  2281. var uid = 0;
  2282. UIkit.prototype._init = function (options) {
  2283. options = options || {};
  2284. options.data = normalizeData(options, this.constructor.options);
  2285. this.$options = mergeOptions(this.constructor.options, options, this);
  2286. this.$el = null;
  2287. this.$props = {};
  2288. this._uid = uid++;
  2289. this._initData();
  2290. this._initMethods();
  2291. this._initComputeds();
  2292. this._callHook('created');
  2293. if (options.el) {
  2294. this.$mount(options.el);
  2295. }
  2296. };
  2297. UIkit.prototype._initData = function () {
  2298. var ref = this.$options;
  2299. var data = ref.data; if ( data === void 0 ) data = {};
  2300. for (var key in data) {
  2301. this.$props[key] = this[key] = data[key];
  2302. }
  2303. };
  2304. UIkit.prototype._initMethods = function () {
  2305. var ref = this.$options;
  2306. var methods = ref.methods;
  2307. if (methods) {
  2308. for (var key in methods) {
  2309. this[key] = methods[key].bind(this);
  2310. }
  2311. }
  2312. };
  2313. UIkit.prototype._initComputeds = function () {
  2314. var ref = this.$options;
  2315. var computed = ref.computed;
  2316. this._computeds = {};
  2317. if (computed) {
  2318. for (var key in computed) {
  2319. registerComputed(this, key, computed[key]);
  2320. }
  2321. }
  2322. };
  2323. UIkit.prototype._initProps = function (props) {
  2324. var key;
  2325. props = props || getProps(this.$options, this.$name);
  2326. for (key in props) {
  2327. if (!isUndefined(props[key])) {
  2328. this.$props[key] = props[key];
  2329. }
  2330. }
  2331. var exclude = [this.$options.computed, this.$options.methods];
  2332. for (key in this.$props) {
  2333. if (key in props && notIn(exclude, key)) {
  2334. this[key] = this.$props[key];
  2335. }
  2336. }
  2337. };
  2338. UIkit.prototype._initEvents = function () {
  2339. var this$1 = this;
  2340. this._events = [];
  2341. var ref = this.$options;
  2342. var events = ref.events;
  2343. if (events) {
  2344. events.forEach(function (event) {
  2345. if (!hasOwn(event, 'handler')) {
  2346. for (var key in event) {
  2347. registerEvent(this$1, event[key], key);
  2348. }
  2349. } else {
  2350. registerEvent(this$1, event);
  2351. }
  2352. });
  2353. }
  2354. };
  2355. UIkit.prototype._unbindEvents = function () {
  2356. this._events.forEach(function (unbind) { return unbind(); });
  2357. delete this._events;
  2358. };
  2359. UIkit.prototype._initObserver = function () {
  2360. var this$1 = this;
  2361. var ref = this.$options;
  2362. var attrs = ref.attrs;
  2363. var props = ref.props;
  2364. var el = ref.el;
  2365. if (this._observer || !props || attrs === false) {
  2366. return;
  2367. }
  2368. attrs = isArray(attrs) ? attrs : Object.keys(props);
  2369. this._observer = new MutationObserver(function (records) {
  2370. var data = getProps(this$1.$options, this$1.$name);
  2371. if (records.some(function (ref) {
  2372. var attributeName = ref.attributeName;
  2373. var prop = attributeName.replace('data-', '');
  2374. return (prop === this$1.$name ? attrs : [camelize(prop), camelize(attributeName)]).some(function (prop) { return !isUndefined(data[prop]) && data[prop] !== this$1.$props[prop]; }
  2375. );
  2376. })) {
  2377. this$1.$reset();
  2378. }
  2379. });
  2380. var filter = attrs.map(function (key) { return hyphenate(key); }).concat(this.$name);
  2381. this._observer.observe(el, {
  2382. attributes: true,
  2383. attributeFilter: filter.concat(filter.map(function (key) { return ("data-" + key); }))
  2384. });
  2385. };
  2386. function getProps(opts, name) {
  2387. var data$1 = {};
  2388. var args = opts.args; if ( args === void 0 ) args = [];
  2389. var props = opts.props; if ( props === void 0 ) props = {};
  2390. var el = opts.el;
  2391. if (!props) {
  2392. return data$1;
  2393. }
  2394. for (var key in props) {
  2395. var prop = hyphenate(key);
  2396. var value = data(el, prop);
  2397. if (isUndefined(value)) {
  2398. continue;
  2399. }
  2400. value = props[key] === Boolean && value === ''
  2401. ? true
  2402. : coerce(props[key], value);
  2403. if (prop === 'target' && (!value || startsWith(value, '_'))) {
  2404. continue;
  2405. }
  2406. data$1[key] = value;
  2407. }
  2408. var options = parseOptions(data(el, name), args);
  2409. for (var key$1 in options) {
  2410. var prop$1 = camelize(key$1);
  2411. if (props[prop$1] !== undefined) {
  2412. data$1[prop$1] = coerce(props[prop$1], options[key$1]);
  2413. }
  2414. }
  2415. return data$1;
  2416. }
  2417. function registerComputed(component, key, cb) {
  2418. Object.defineProperty(component, key, {
  2419. enumerable: true,
  2420. get: function() {
  2421. var _computeds = component._computeds;
  2422. var $props = component.$props;
  2423. var $el = component.$el;
  2424. if (!hasOwn(_computeds, key)) {
  2425. _computeds[key] = (cb.get || cb).call(component, $props, $el);
  2426. }
  2427. return _computeds[key];
  2428. },
  2429. set: function(value) {
  2430. var _computeds = component._computeds;
  2431. _computeds[key] = cb.set ? cb.set.call(component, value) : value;
  2432. if (isUndefined(_computeds[key])) {
  2433. delete _computeds[key];
  2434. }
  2435. }
  2436. });
  2437. }
  2438. function registerEvent(component, event, key) {
  2439. if (!isPlainObject(event)) {
  2440. event = ({name: key, handler: event});
  2441. }
  2442. var name = event.name;
  2443. var el = event.el;
  2444. var handler = event.handler;
  2445. var capture = event.capture;
  2446. var passive = event.passive;
  2447. var delegate = event.delegate;
  2448. var filter = event.filter;
  2449. var self = event.self;
  2450. el = isFunction(el)
  2451. ? el.call(component)
  2452. : el || component.$el;
  2453. if (isArray(el)) {
  2454. el.forEach(function (el) { return registerEvent(component, assign({}, event, {el: el}), key); });
  2455. return;
  2456. }
  2457. if (!el || filter && !filter.call(component)) {
  2458. return;
  2459. }
  2460. component._events.push(
  2461. on(
  2462. el,
  2463. name,
  2464. !delegate
  2465. ? null
  2466. : isString(delegate)
  2467. ? delegate
  2468. : delegate.call(component),
  2469. isString(handler) ? component[handler] : handler.bind(component),
  2470. {passive: passive, capture: capture, self: self}
  2471. )
  2472. );
  2473. }
  2474. function notIn(options, key) {
  2475. return options.every(function (arr) { return !arr || !hasOwn(arr, key); });
  2476. }
  2477. function coerce(type, value) {
  2478. if (type === Boolean) {
  2479. return toBoolean(value);
  2480. } else if (type === Number) {
  2481. return toNumber(value);
  2482. } else if (type === 'list') {
  2483. return toList(value);
  2484. }
  2485. return type ? type(value) : value;
  2486. }
  2487. function normalizeData(ref, ref$1) {
  2488. var data = ref.data;
  2489. var el = ref.el;
  2490. var args = ref$1.args;
  2491. var props = ref$1.props; if ( props === void 0 ) props = {};
  2492. data = isArray(data)
  2493. ? !isEmpty(args)
  2494. ? data.slice(0, args.length).reduce(function (data, value, index) {
  2495. if (isPlainObject(value)) {
  2496. assign(data, value);
  2497. } else {
  2498. data[args[index]] = value;
  2499. }
  2500. return data;
  2501. }, {})
  2502. : undefined
  2503. : data;
  2504. if (data) {
  2505. for (var key in data) {
  2506. if (isUndefined(data[key])) {
  2507. delete data[key];
  2508. } else {
  2509. data[key] = props[key] ? coerce(props[key], data[key]) : data[key];
  2510. }
  2511. }
  2512. }
  2513. return data;
  2514. }
  2515. }
  2516. function instanceAPI (UIkit) {
  2517. var DATA = UIkit.data;
  2518. UIkit.prototype.$create = function (component, element, data) {
  2519. return UIkit[component](element, data);
  2520. };
  2521. UIkit.prototype.$mount = function (el) {
  2522. var ref = this.$options;
  2523. var name = ref.name;
  2524. if (!el[DATA]) {
  2525. el[DATA] = {};
  2526. }
  2527. if (el[DATA][name]) {
  2528. return;
  2529. }
  2530. el[DATA][name] = this;
  2531. this.$el = this.$options.el = this.$options.el || el;
  2532. if (within(el, document)) {
  2533. this._callConnected();
  2534. }
  2535. };
  2536. UIkit.prototype.$reset = function () {
  2537. this._callDisconnected();
  2538. this._callConnected();
  2539. };
  2540. UIkit.prototype.$destroy = function (removeEl) {
  2541. if ( removeEl === void 0 ) removeEl = false;
  2542. var ref = this.$options;
  2543. var el = ref.el;
  2544. var name = ref.name;
  2545. if (el) {
  2546. this._callDisconnected();
  2547. }
  2548. this._callHook('destroy');
  2549. if (!el || !el[DATA]) {
  2550. return;
  2551. }
  2552. delete el[DATA][name];
  2553. if (!isEmpty(el[DATA])) {
  2554. delete el[DATA];
  2555. }
  2556. if (removeEl) {
  2557. remove(this.$el);
  2558. }
  2559. };
  2560. UIkit.prototype.$emit = function (e) {
  2561. this._callUpdate(e);
  2562. };
  2563. UIkit.prototype.$update = function (element, e) {
  2564. if ( element === void 0 ) element = this.$el;
  2565. UIkit.update(element, e);
  2566. };
  2567. UIkit.prototype.$getComponent = UIkit.getComponent;
  2568. var names = {};
  2569. Object.defineProperties(UIkit.prototype, {
  2570. $container: Object.getOwnPropertyDescriptor(UIkit, 'container'),
  2571. $name: {
  2572. get: function() {
  2573. var ref = this.$options;
  2574. var name = ref.name;
  2575. if (!names[name]) {
  2576. names[name] = UIkit.prefix + hyphenate(name);
  2577. }
  2578. return names[name];
  2579. }
  2580. }
  2581. });
  2582. }
  2583. function componentAPI (UIkit) {
  2584. var DATA = UIkit.data;
  2585. var components = {};
  2586. UIkit.component = function (name, options) {
  2587. var id = hyphenate(name);
  2588. name = camelize(id);
  2589. if (!options) {
  2590. if (isPlainObject(components[name])) {
  2591. components[name] = UIkit.extend(components[name]);
  2592. }
  2593. return components[name];
  2594. }
  2595. UIkit[name] = function (element, data) {
  2596. var i = arguments.length, argsArray = Array(i);
  2597. while ( i-- ) argsArray[i] = arguments[i];
  2598. var component = UIkit.component(name);
  2599. return component.options.functional
  2600. ? new component({data: isPlainObject(element) ? element : [].concat( argsArray )})
  2601. : !element ? init(element) : $$(element).map(init)[0];
  2602. function init(element) {
  2603. var instance = UIkit.getComponent(element, name);
  2604. if (instance) {
  2605. if (!data) {
  2606. return instance;
  2607. } else {
  2608. instance.$destroy();
  2609. }
  2610. }
  2611. return new component({el: element, data: data});
  2612. }
  2613. };
  2614. var opt = isPlainObject(options) ? assign({}, options) : options.options;
  2615. opt.name = name;
  2616. if (opt.install) {
  2617. opt.install(UIkit, opt, name);
  2618. }
  2619. if (UIkit._initialized && !opt.functional) {
  2620. fastdom.read(function () { return UIkit[name](("[uk-" + id + "],[data-uk-" + id + "]")); });
  2621. }
  2622. return components[name] = isPlainObject(options) ? opt : options;
  2623. };
  2624. UIkit.getComponents = function (element) { return element && element[DATA] || {}; };
  2625. UIkit.getComponent = function (element, name) { return UIkit.getComponents(element)[name]; };
  2626. UIkit.connect = function (node) {
  2627. if (node[DATA]) {
  2628. for (var name in node[DATA]) {
  2629. node[DATA][name]._callConnected();
  2630. }
  2631. }
  2632. for (var i = 0; i < node.attributes.length; i++) {
  2633. var name$1 = getComponentName(node.attributes[i].name);
  2634. if (name$1 && name$1 in components) {
  2635. UIkit[name$1](node);
  2636. }
  2637. }
  2638. };
  2639. UIkit.disconnect = function (node) {
  2640. for (var name in node[DATA]) {
  2641. node[DATA][name]._callDisconnected();
  2642. }
  2643. };
  2644. }
  2645. function getComponentName(attribute) {
  2646. return startsWith(attribute, 'uk-') || startsWith(attribute, 'data-uk-')
  2647. ? camelize(attribute.replace('data-uk-', '').replace('uk-', ''))
  2648. : false;
  2649. }
  2650. var UIkit = function (options) {
  2651. this._init(options);
  2652. };
  2653. UIkit.util = util;
  2654. UIkit.data = '__uikit__';
  2655. UIkit.prefix = 'uk-';
  2656. UIkit.options = {};
  2657. UIkit.version = '3.5.5';
  2658. globalAPI(UIkit);
  2659. hooksAPI(UIkit);
  2660. stateAPI(UIkit);
  2661. componentAPI(UIkit);
  2662. instanceAPI(UIkit);
  2663. function Core (UIkit) {
  2664. inBrowser && ready(function () {
  2665. UIkit.update();
  2666. on(window, 'load resize', function () { return UIkit.update(null, 'resize'); });
  2667. on(document, 'loadedmetadata load', function (ref) {
  2668. var target = ref.target;
  2669. return UIkit.update(target, 'resize');
  2670. }, true);
  2671. // throttle `scroll` event (Safari triggers multiple `scroll` events per frame)
  2672. var pending;
  2673. on(window, 'scroll', function (e) {
  2674. if (pending) {
  2675. return;
  2676. }
  2677. pending = true;
  2678. fastdom.write(function () { return pending = false; });
  2679. UIkit.update(null, e.type);
  2680. }, {passive: true, capture: true});
  2681. var started = 0;
  2682. on(document, 'animationstart', function (ref) {
  2683. var target = ref.target;
  2684. if ((css(target, 'animationName') || '').match(/^uk-.*(left|right)/)) {
  2685. started++;
  2686. css(document.body, 'overflowX', 'hidden');
  2687. setTimeout(function () {
  2688. if (!--started) {
  2689. css(document.body, 'overflowX', '');
  2690. }
  2691. }, toMs(css(target, 'animationDuration')) + 100);
  2692. }
  2693. }, true);
  2694. var off;
  2695. on(document, pointerDown, function (e) {
  2696. off && off();
  2697. if (!isTouch(e)) {
  2698. return;
  2699. }
  2700. // Handle Swipe Gesture
  2701. var pos = getEventPos(e);
  2702. var target = 'tagName' in e.target ? e.target : e.target.parentNode;
  2703. off = once(document, (pointerUp + " " + pointerCancel), function (e) {
  2704. var ref = getEventPos(e);
  2705. var x = ref.x;
  2706. var y = ref.y;
  2707. // swipe
  2708. if (target && x && Math.abs(pos.x - x) > 100 || y && Math.abs(pos.y - y) > 100) {
  2709. setTimeout(function () {
  2710. trigger(target, 'swipe');
  2711. trigger(target, ("swipe" + (swipeDirection(pos.x, pos.y, x, y))));
  2712. });
  2713. }
  2714. });
  2715. }, {passive: true});
  2716. });
  2717. }
  2718. function swipeDirection(x1, y1, x2, y2) {
  2719. return Math.abs(x1 - x2) >= Math.abs(y1 - y2)
  2720. ? x1 - x2 > 0
  2721. ? 'Left'
  2722. : 'Right'
  2723. : y1 - y2 > 0
  2724. ? 'Up'
  2725. : 'Down';
  2726. }
  2727. function boot (UIkit) {
  2728. var connect = UIkit.connect;
  2729. var disconnect = UIkit.disconnect;
  2730. if (!inBrowser || !window.MutationObserver) {
  2731. return;
  2732. }
  2733. fastdom.read(init);
  2734. function init() {
  2735. if (document.body) {
  2736. apply(document.body, connect);
  2737. }
  2738. (new MutationObserver(function (mutations) {
  2739. var updates = [];
  2740. mutations.forEach(function (mutation) { return applyMutation(mutation, updates); });
  2741. updates.forEach(function (el) { return UIkit.update(el); });
  2742. })).observe(document, {
  2743. childList: true,
  2744. subtree: true,
  2745. characterData: true,
  2746. attributes: true
  2747. });
  2748. UIkit._initialized = true;
  2749. }
  2750. function applyMutation(mutation, updates) {
  2751. var target = mutation.target;
  2752. var type = mutation.type;
  2753. var update = type !== 'attributes'
  2754. ? applyChildList(mutation)
  2755. : applyAttribute(mutation);
  2756. if (update && !updates.some(function (element) { return element.contains(target); })) {
  2757. updates.push(target.contains ? target : target.parentNode); // IE 11 text node does not implement contains
  2758. }
  2759. }
  2760. function applyAttribute(ref) {
  2761. var target = ref.target;
  2762. var attributeName = ref.attributeName;
  2763. if (attributeName === 'href') {
  2764. return true;
  2765. }
  2766. var name = getComponentName(attributeName);
  2767. if (!name || !(name in UIkit)) {
  2768. return;
  2769. }
  2770. if (hasAttr(target, attributeName)) {
  2771. UIkit[name](target);
  2772. return true;
  2773. }
  2774. var component = UIkit.getComponent(target, name);
  2775. if (component) {
  2776. component.$destroy();
  2777. return true;
  2778. }
  2779. }
  2780. function applyChildList(ref) {
  2781. var addedNodes = ref.addedNodes;
  2782. var removedNodes = ref.removedNodes;
  2783. for (var i = 0; i < addedNodes.length; i++) {
  2784. apply(addedNodes[i], connect);
  2785. }
  2786. for (var i$1 = 0; i$1 < removedNodes.length; i$1++) {
  2787. apply(removedNodes[i$1], disconnect);
  2788. }
  2789. return true;
  2790. }
  2791. }
  2792. var Class = {
  2793. connected: function() {
  2794. !hasClass(this.$el, this.$name) && addClass(this.$el, this.$name);
  2795. }
  2796. };
  2797. var Togglable = {
  2798. props: {
  2799. cls: Boolean,
  2800. animation: 'list',
  2801. duration: Number,
  2802. origin: String,
  2803. transition: String
  2804. },
  2805. data: {
  2806. cls: false,
  2807. animation: [false],
  2808. duration: 200,
  2809. origin: false,
  2810. transition: 'linear',
  2811. initProps: {
  2812. overflow: '',
  2813. height: '',
  2814. paddingTop: '',
  2815. paddingBottom: '',
  2816. marginTop: '',
  2817. marginBottom: ''
  2818. },
  2819. hideProps: {
  2820. overflow: 'hidden',
  2821. height: 0,
  2822. paddingTop: 0,
  2823. paddingBottom: 0,
  2824. marginTop: 0,
  2825. marginBottom: 0
  2826. }
  2827. },
  2828. computed: {
  2829. hasAnimation: function(ref) {
  2830. var animation = ref.animation;
  2831. return !!animation[0];
  2832. },
  2833. hasTransition: function(ref) {
  2834. var animation = ref.animation;
  2835. return this.hasAnimation && animation[0] === true;
  2836. }
  2837. },
  2838. methods: {
  2839. toggleElement: function(targets, show, animate) {
  2840. var this$1 = this;
  2841. return Promise.all(toNodes(targets).map(function (el) { return new Promise(function (resolve) { return this$1._toggleElement(el, show, animate).then(resolve, noop); }
  2842. ); }
  2843. ));
  2844. },
  2845. isToggled: function(el) {
  2846. var nodes = toNodes(el || this.$el);
  2847. return this.cls
  2848. ? hasClass(nodes, this.cls.split(' ')[0])
  2849. : !hasAttr(nodes, 'hidden');
  2850. },
  2851. updateAria: function(el) {
  2852. if (this.cls === false) {
  2853. attr(el, 'aria-hidden', !this.isToggled(el));
  2854. }
  2855. },
  2856. _toggleElement: function(el, show, animate) {
  2857. var this$1 = this;
  2858. show = isBoolean(show)
  2859. ? show
  2860. : Animation.inProgress(el)
  2861. ? hasClass(el, 'uk-animation-leave')
  2862. : Transition.inProgress(el)
  2863. ? el.style.height === '0px'
  2864. : !this.isToggled(el);
  2865. if (!trigger(el, ("before" + (show ? 'show' : 'hide')), [this])) {
  2866. return Promise.reject();
  2867. }
  2868. var promise = (
  2869. isFunction(animate)
  2870. ? animate
  2871. : animate === false || !this.hasAnimation
  2872. ? this._toggle
  2873. : this.hasTransition
  2874. ? toggleHeight(this)
  2875. : toggleAnimation(this)
  2876. )(el, show);
  2877. trigger(el, show ? 'show' : 'hide', [this]);
  2878. var final = function () {
  2879. trigger(el, show ? 'shown' : 'hidden', [this$1]);
  2880. this$1.$update(el);
  2881. };
  2882. return (promise || Promise.resolve()).then(final);
  2883. },
  2884. _toggle: function(el, toggled) {
  2885. if (!el) {
  2886. return;
  2887. }
  2888. toggled = Boolean(toggled);
  2889. var changed;
  2890. if (this.cls) {
  2891. changed = includes(this.cls, ' ') || toggled !== hasClass(el, this.cls);
  2892. changed && toggleClass(el, this.cls, includes(this.cls, ' ') ? undefined : toggled);
  2893. } else {
  2894. changed = toggled === hasAttr(el, 'hidden');
  2895. changed && attr(el, 'hidden', !toggled ? '' : null);
  2896. }
  2897. $$('[autofocus]', el).some(function (el) { return isVisible(el) ? el.focus() || true : el.blur(); });
  2898. this.updateAria(el);
  2899. if (changed) {
  2900. trigger(el, 'toggled', [this]);
  2901. this.$update(el);
  2902. }
  2903. }
  2904. }
  2905. };
  2906. function toggleHeight(ref) {
  2907. var isToggled = ref.isToggled;
  2908. var duration = ref.duration;
  2909. var initProps = ref.initProps;
  2910. var hideProps = ref.hideProps;
  2911. var transition = ref.transition;
  2912. var _toggle = ref._toggle;
  2913. return function (el, show) {
  2914. var inProgress = Transition.inProgress(el);
  2915. var inner = el.hasChildNodes ? toFloat(css(el.firstElementChild, 'marginTop')) + toFloat(css(el.lastElementChild, 'marginBottom')) : 0;
  2916. var currentHeight = isVisible(el) ? height(el) + (inProgress ? 0 : inner) : 0;
  2917. Transition.cancel(el);
  2918. if (!isToggled(el)) {
  2919. _toggle(el, true);
  2920. }
  2921. height(el, '');
  2922. // Update child components first
  2923. fastdom.flush();
  2924. var endHeight = height(el) + (inProgress ? 0 : inner);
  2925. height(el, currentHeight);
  2926. return (show
  2927. ? Transition.start(el, assign({}, initProps, {overflow: 'hidden', height: endHeight}), Math.round(duration * (1 - currentHeight / endHeight)), transition)
  2928. : Transition.start(el, hideProps, Math.round(duration * (currentHeight / endHeight)), transition).then(function () { return _toggle(el, false); })
  2929. ).then(function () { return css(el, initProps); });
  2930. };
  2931. }
  2932. function toggleAnimation(cmp) {
  2933. return function (el, show) {
  2934. Animation.cancel(el);
  2935. var animation = cmp.animation;
  2936. var duration = cmp.duration;
  2937. var _toggle = cmp._toggle;
  2938. if (show) {
  2939. _toggle(el, true);
  2940. return Animation.in(el, animation[0], duration, cmp.origin);
  2941. }
  2942. return Animation.out(el, animation[1] || animation[0], duration, cmp.origin).then(function () { return _toggle(el, false); });
  2943. };
  2944. }
  2945. var Accordion = {
  2946. mixins: [Class, Togglable],
  2947. props: {
  2948. targets: String,
  2949. active: null,
  2950. collapsible: Boolean,
  2951. multiple: Boolean,
  2952. toggle: String,
  2953. content: String,
  2954. transition: String,
  2955. offset: Number
  2956. },
  2957. data: {
  2958. targets: '> *',
  2959. active: false,
  2960. animation: [true],
  2961. collapsible: true,
  2962. multiple: false,
  2963. clsOpen: 'uk-open',
  2964. toggle: '> .uk-accordion-title',
  2965. content: '> .uk-accordion-content',
  2966. transition: 'ease',
  2967. offset: 0
  2968. },
  2969. computed: {
  2970. items: {
  2971. get: function(ref, $el) {
  2972. var targets = ref.targets;
  2973. return $$(targets, $el);
  2974. },
  2975. watch: function(items, prev) {
  2976. var this$1 = this;
  2977. items.forEach(function (el) { return hide($(this$1.content, el), !hasClass(el, this$1.clsOpen)); });
  2978. if (prev || hasClass(items, this.clsOpen)) {
  2979. return;
  2980. }
  2981. var active = this.active !== false && items[Number(this.active)]
  2982. || !this.collapsible && items[0];
  2983. if (active) {
  2984. this.toggle(active, false);
  2985. }
  2986. },
  2987. immediate: true
  2988. }
  2989. },
  2990. events: [
  2991. {
  2992. name: 'click',
  2993. delegate: function() {
  2994. return ((this.targets) + " " + (this.$props.toggle));
  2995. },
  2996. handler: function(e) {
  2997. e.preventDefault();
  2998. this.toggle(index($$(((this.targets) + " " + (this.$props.toggle)), this.$el), e.current));
  2999. }
  3000. }
  3001. ],
  3002. methods: {
  3003. toggle: function(item, animate) {
  3004. var this$1 = this;
  3005. var items = [this.items[getIndex(item, this.items)]];
  3006. var activeItems = filter(this.items, ("." + (this.clsOpen)));
  3007. if (!this.multiple && !includes(activeItems, items[0])) {
  3008. items = items.concat(activeItems);
  3009. }
  3010. if (!this.collapsible && activeItems.length < 2 && !filter(items, (":not(." + (this.clsOpen) + ")")).length) {
  3011. return;
  3012. }
  3013. items.forEach(function (el) { return this$1.toggleElement(el, !hasClass(el, this$1.clsOpen), function (el, show) {
  3014. toggleClass(el, this$1.clsOpen, show);
  3015. var content = $(("" + (el._wrapper ? '> * ' : '') + (this$1.content)), el);
  3016. if (animate === false || !this$1.hasTransition) {
  3017. hide(content, !show);
  3018. return;
  3019. }
  3020. if (!el._wrapper) {
  3021. el._wrapper = wrapAll(content, ("<div" + (show ? ' hidden' : '') + ">"));
  3022. }
  3023. hide(content, false);
  3024. return toggleHeight(this$1)(el._wrapper, show).then(function () {
  3025. hide(content, !show);
  3026. delete el._wrapper;
  3027. unwrap(content);
  3028. if (show) {
  3029. var toggle = $(this$1.$props.toggle, el);
  3030. if (!isInView(toggle)) {
  3031. scrollIntoView(toggle, {offset: this$1.offset});
  3032. }
  3033. }
  3034. });
  3035. }); });
  3036. }
  3037. }
  3038. };
  3039. function hide(el, hide) {
  3040. attr(el, 'hidden', hide ? '' : null);
  3041. }
  3042. var alert = {
  3043. mixins: [Class, Togglable],
  3044. args: 'animation',
  3045. props: {
  3046. close: String
  3047. },
  3048. data: {
  3049. animation: [true],
  3050. selClose: '.uk-alert-close',
  3051. duration: 150,
  3052. hideProps: assign({opacity: 0}, Togglable.data.hideProps)
  3053. },
  3054. events: [
  3055. {
  3056. name: 'click',
  3057. delegate: function() {
  3058. return this.selClose;
  3059. },
  3060. handler: function(e) {
  3061. e.preventDefault();
  3062. this.close();
  3063. }
  3064. }
  3065. ],
  3066. methods: {
  3067. close: function() {
  3068. var this$1 = this;
  3069. this.toggleElement(this.$el).then(function () { return this$1.$destroy(true); });
  3070. }
  3071. }
  3072. };
  3073. var Video = {
  3074. args: 'autoplay',
  3075. props: {
  3076. automute: Boolean,
  3077. autoplay: Boolean
  3078. },
  3079. data: {
  3080. automute: false,
  3081. autoplay: true
  3082. },
  3083. computed: {
  3084. inView: function(ref) {
  3085. var autoplay = ref.autoplay;
  3086. return autoplay === 'inview';
  3087. }
  3088. },
  3089. connected: function() {
  3090. if (this.inView && !hasAttr(this.$el, 'preload')) {
  3091. this.$el.preload = 'none';
  3092. }
  3093. this.player = new Player(this.$el);
  3094. if (this.automute) {
  3095. this.player.mute();
  3096. }
  3097. },
  3098. update: {
  3099. read: function() {
  3100. return !this.player
  3101. ? false
  3102. : {
  3103. visible: isVisible(this.$el) && css(this.$el, 'visibility') !== 'hidden',
  3104. inView: this.inView && isInView(this.$el)
  3105. };
  3106. },
  3107. write: function(ref) {
  3108. var visible = ref.visible;
  3109. var inView = ref.inView;
  3110. if (!visible || this.inView && !inView) {
  3111. this.player.pause();
  3112. } else if (this.autoplay === true || this.inView && inView) {
  3113. this.player.play();
  3114. }
  3115. },
  3116. events: ['resize', 'scroll']
  3117. }
  3118. };
  3119. var cover = {
  3120. mixins: [Class, Video],
  3121. props: {
  3122. width: Number,
  3123. height: Number
  3124. },
  3125. data: {
  3126. automute: true
  3127. },
  3128. update: {
  3129. read: function() {
  3130. var el = this.$el;
  3131. var ref = getPositionedParent(el) || el.parentNode;
  3132. var height = ref.offsetHeight;
  3133. var width = ref.offsetWidth;
  3134. var dim = Dimensions.cover(
  3135. {
  3136. width: this.width || el.naturalWidth || el.videoWidth || el.clientWidth,
  3137. height: this.height || el.naturalHeight || el.videoHeight || el.clientHeight
  3138. },
  3139. {
  3140. width: width + (width % 2 ? 1 : 0),
  3141. height: height + (height % 2 ? 1 : 0)
  3142. }
  3143. );
  3144. if (!dim.width || !dim.height) {
  3145. return false;
  3146. }
  3147. return dim;
  3148. },
  3149. write: function(ref) {
  3150. var height = ref.height;
  3151. var width = ref.width;
  3152. css(this.$el, {height: height, width: width});
  3153. },
  3154. events: ['resize']
  3155. }
  3156. };
  3157. function getPositionedParent(el) {
  3158. while ((el = parent(el))) {
  3159. if (css(el, 'position') !== 'static') {
  3160. return el;
  3161. }
  3162. }
  3163. }
  3164. var Position = {
  3165. props: {
  3166. pos: String,
  3167. offset: null,
  3168. flip: Boolean,
  3169. clsPos: String
  3170. },
  3171. data: {
  3172. pos: ("bottom-" + (!isRtl ? 'left' : 'right')),
  3173. flip: true,
  3174. offset: false,
  3175. clsPos: ''
  3176. },
  3177. computed: {
  3178. pos: function(ref) {
  3179. var pos = ref.pos;
  3180. return (pos + (!includes(pos, '-') ? '-center' : '')).split('-');
  3181. },
  3182. dir: function() {
  3183. return this.pos[0];
  3184. },
  3185. align: function() {
  3186. return this.pos[1];
  3187. }
  3188. },
  3189. methods: {
  3190. positionAt: function(element, target, boundary) {
  3191. removeClasses(element, ((this.clsPos) + "-(top|bottom|left|right)(-[a-z]+)?"));
  3192. var node;
  3193. var ref = this;
  3194. var offset$1 = ref.offset;
  3195. var axis = this.getAxis();
  3196. if (!isNumeric(offset$1)) {
  3197. node = $(offset$1);
  3198. offset$1 = node
  3199. ? offset(node)[axis === 'x' ? 'left' : 'top'] - offset(target)[axis === 'x' ? 'right' : 'bottom']
  3200. : 0;
  3201. }
  3202. var ref$1 = positionAt(
  3203. element,
  3204. target,
  3205. axis === 'x' ? ((flipPosition(this.dir)) + " " + (this.align)) : ((this.align) + " " + (flipPosition(this.dir))),
  3206. axis === 'x' ? ((this.dir) + " " + (this.align)) : ((this.align) + " " + (this.dir)),
  3207. axis === 'x' ? ("" + (this.dir === 'left' ? -offset$1 : offset$1)) : (" " + (this.dir === 'top' ? -offset$1 : offset$1)),
  3208. null,
  3209. this.flip,
  3210. boundary
  3211. ).target;
  3212. var x = ref$1.x;
  3213. var y = ref$1.y;
  3214. this.dir = axis === 'x' ? x : y;
  3215. this.align = axis === 'x' ? y : x;
  3216. toggleClass(element, ((this.clsPos) + "-" + (this.dir) + "-" + (this.align)), this.offset === false);
  3217. },
  3218. getAxis: function() {
  3219. return this.dir === 'top' || this.dir === 'bottom' ? 'y' : 'x';
  3220. }
  3221. }
  3222. };
  3223. var active;
  3224. var drop = {
  3225. mixins: [Position, Togglable],
  3226. args: 'pos',
  3227. props: {
  3228. mode: 'list',
  3229. toggle: Boolean,
  3230. boundary: Boolean,
  3231. boundaryAlign: Boolean,
  3232. delayShow: Number,
  3233. delayHide: Number,
  3234. clsDrop: String
  3235. },
  3236. data: {
  3237. mode: ['click', 'hover'],
  3238. toggle: '- *',
  3239. boundary: inBrowser && window,
  3240. boundaryAlign: false,
  3241. delayShow: 0,
  3242. delayHide: 800,
  3243. clsDrop: false,
  3244. animation: ['uk-animation-fade'],
  3245. cls: 'uk-open'
  3246. },
  3247. computed: {
  3248. boundary: function(ref, $el) {
  3249. var boundary = ref.boundary;
  3250. return query(boundary, $el);
  3251. },
  3252. clsDrop: function(ref) {
  3253. var clsDrop = ref.clsDrop;
  3254. return clsDrop || ("uk-" + (this.$options.name));
  3255. },
  3256. clsPos: function() {
  3257. return this.clsDrop;
  3258. }
  3259. },
  3260. created: function() {
  3261. this.tracker = new MouseTracker();
  3262. },
  3263. connected: function() {
  3264. addClass(this.$el, this.clsDrop);
  3265. var ref = this.$props;
  3266. var toggle = ref.toggle;
  3267. this.toggle = toggle && this.$create('toggle', query(toggle, this.$el), {
  3268. target: this.$el,
  3269. mode: this.mode
  3270. });
  3271. !this.toggle && trigger(this.$el, 'updatearia');
  3272. },
  3273. disconnected: function() {
  3274. if (this.isActive()) {
  3275. active = null;
  3276. }
  3277. },
  3278. events: [
  3279. {
  3280. name: 'click',
  3281. delegate: function() {
  3282. return ("." + (this.clsDrop) + "-close");
  3283. },
  3284. handler: function(e) {
  3285. e.preventDefault();
  3286. this.hide(false);
  3287. }
  3288. },
  3289. {
  3290. name: 'click',
  3291. delegate: function() {
  3292. return 'a[href^="#"]';
  3293. },
  3294. handler: function(ref) {
  3295. var defaultPrevented = ref.defaultPrevented;
  3296. var hash = ref.current.hash;
  3297. if (!defaultPrevented && hash && !within(hash, this.$el)) {
  3298. this.hide(false);
  3299. }
  3300. }
  3301. },
  3302. {
  3303. name: 'beforescroll',
  3304. handler: function() {
  3305. this.hide(false);
  3306. }
  3307. },
  3308. {
  3309. name: 'toggle',
  3310. self: true,
  3311. handler: function(e, toggle) {
  3312. e.preventDefault();
  3313. if (this.isToggled()) {
  3314. this.hide(false);
  3315. } else {
  3316. this.show(toggle, false);
  3317. }
  3318. }
  3319. },
  3320. {
  3321. name: 'toggleshow',
  3322. self: true,
  3323. handler: function(e, toggle) {
  3324. e.preventDefault();
  3325. this.show(toggle);
  3326. }
  3327. },
  3328. {
  3329. name: 'togglehide',
  3330. self: true,
  3331. handler: function(e) {
  3332. e.preventDefault();
  3333. this.hide();
  3334. }
  3335. },
  3336. {
  3337. name: pointerEnter,
  3338. filter: function() {
  3339. return includes(this.mode, 'hover');
  3340. },
  3341. handler: function(e) {
  3342. if (!isTouch(e)) {
  3343. this.clearTimers();
  3344. }
  3345. }
  3346. },
  3347. {
  3348. name: pointerLeave,
  3349. filter: function() {
  3350. return includes(this.mode, 'hover');
  3351. },
  3352. handler: function(e) {
  3353. if (!isTouch(e) && e.relatedTarget) {
  3354. this.hide();
  3355. }
  3356. }
  3357. },
  3358. {
  3359. name: 'toggled',
  3360. self: true,
  3361. handler: function() {
  3362. if (!this.isToggled()) {
  3363. return;
  3364. }
  3365. this.clearTimers();
  3366. this.position();
  3367. }
  3368. },
  3369. {
  3370. name: 'show',
  3371. self: true,
  3372. handler: function() {
  3373. var this$1 = this;
  3374. active = this;
  3375. this.tracker.init();
  3376. trigger(this.$el, 'updatearia');
  3377. once(this.$el, 'hide', on(document, pointerDown, function (ref) {
  3378. var target = ref.target;
  3379. return !within(target, this$1.$el) && once(document, (pointerUp + " " + pointerCancel + " scroll"), function (ref) {
  3380. var defaultPrevented = ref.defaultPrevented;
  3381. var type = ref.type;
  3382. var newTarget = ref.target;
  3383. if (!defaultPrevented && type === pointerUp && target === newTarget && !(this$1.toggle && within(target, this$1.toggle.$el))) {
  3384. this$1.hide(false);
  3385. }
  3386. }, true);
  3387. }
  3388. ), {self: true});
  3389. once(this.$el, 'hide', on(document, 'keydown', function (e) {
  3390. if (e.keyCode === 27) {
  3391. e.preventDefault();
  3392. this$1.hide(false);
  3393. }
  3394. }), {self: true});
  3395. }
  3396. },
  3397. {
  3398. name: 'beforehide',
  3399. self: true,
  3400. handler: function() {
  3401. this.clearTimers();
  3402. }
  3403. },
  3404. {
  3405. name: 'hide',
  3406. handler: function(ref) {
  3407. var target = ref.target;
  3408. if (this.$el !== target) {
  3409. active = active === null && within(target, this.$el) && this.isToggled() ? this : active;
  3410. return;
  3411. }
  3412. active = this.isActive() ? null : active;
  3413. trigger(this.$el, 'updatearia');
  3414. this.tracker.cancel();
  3415. }
  3416. },
  3417. {
  3418. name: 'updatearia',
  3419. self: true,
  3420. handler: function(e, toggle) {
  3421. e.preventDefault();
  3422. this.updateAria(this.$el);
  3423. if (toggle || this.toggle) {
  3424. attr((toggle || this.toggle).$el, 'aria-expanded', this.isToggled());
  3425. toggleClass(this.toggle.$el, this.cls, this.isToggled());
  3426. }
  3427. }
  3428. }
  3429. ],
  3430. update: {
  3431. write: function() {
  3432. if (this.isToggled() && !Animation.inProgress(this.$el)) {
  3433. this.position();
  3434. }
  3435. },
  3436. events: ['resize']
  3437. },
  3438. methods: {
  3439. show: function(toggle, delay) {
  3440. var this$1 = this;
  3441. if ( toggle === void 0 ) toggle = this.toggle;
  3442. if ( delay === void 0 ) delay = true;
  3443. if (this.isToggled() && toggle && this.toggle && toggle.$el !== this.toggle.$el) {
  3444. this.hide(false);
  3445. }
  3446. this.toggle = toggle;
  3447. this.clearTimers();
  3448. if (this.isActive()) {
  3449. return;
  3450. }
  3451. if (active) {
  3452. if (delay && active.isDelaying) {
  3453. this.showTimer = setTimeout(this.show, 10);
  3454. return;
  3455. }
  3456. var prev;
  3457. while (active && prev !== active && !within(this.$el, active.$el)) {
  3458. prev = active;
  3459. active.hide(false);
  3460. }
  3461. }
  3462. this.showTimer = setTimeout(function () { return !this$1.isToggled() && this$1.toggleElement(this$1.$el, true); }, delay && this.delayShow || 0);
  3463. },
  3464. hide: function(delay) {
  3465. var this$1 = this;
  3466. if ( delay === void 0 ) delay = true;
  3467. var hide = function () { return this$1.toggleElement(this$1.$el, false, false); };
  3468. this.clearTimers();
  3469. this.isDelaying = getPositionedElements(this.$el).some(function (el) { return this$1.tracker.movesTo(el); });
  3470. if (delay && this.isDelaying) {
  3471. this.hideTimer = setTimeout(this.hide, 50);
  3472. } else if (delay && this.delayHide) {
  3473. this.hideTimer = setTimeout(hide, this.delayHide);
  3474. } else {
  3475. hide();
  3476. }
  3477. },
  3478. clearTimers: function() {
  3479. clearTimeout(this.showTimer);
  3480. clearTimeout(this.hideTimer);
  3481. this.showTimer = null;
  3482. this.hideTimer = null;
  3483. this.isDelaying = false;
  3484. },
  3485. isActive: function() {
  3486. return active === this;
  3487. },
  3488. position: function() {
  3489. removeClass(this.$el, ((this.clsDrop) + "-stack"));
  3490. toggleClass(this.$el, ((this.clsDrop) + "-boundary"), this.boundaryAlign);
  3491. var boundary = offset(this.boundary);
  3492. var alignTo = this.boundaryAlign ? boundary : offset(this.toggle.$el);
  3493. if (this.align === 'justify') {
  3494. var prop = this.getAxis() === 'y' ? 'width' : 'height';
  3495. css(this.$el, prop, alignTo[prop]);
  3496. } else if (this.$el.offsetWidth > Math.max(boundary.right - alignTo.left, alignTo.right - boundary.left)) {
  3497. addClass(this.$el, ((this.clsDrop) + "-stack"));
  3498. }
  3499. this.positionAt(this.$el, this.boundaryAlign ? this.boundary : this.toggle.$el, this.boundary);
  3500. }
  3501. }
  3502. };
  3503. function getPositionedElements(el) {
  3504. var result = [];
  3505. apply(el, function (el) { return css(el, 'position') !== 'static' && result.push(el); });
  3506. return result;
  3507. }
  3508. var formCustom = {
  3509. mixins: [Class],
  3510. args: 'target',
  3511. props: {
  3512. target: Boolean
  3513. },
  3514. data: {
  3515. target: false
  3516. },
  3517. computed: {
  3518. input: function(_, $el) {
  3519. return $(selInput, $el);
  3520. },
  3521. state: function() {
  3522. return this.input.nextElementSibling;
  3523. },
  3524. target: function(ref, $el) {
  3525. var target = ref.target;
  3526. return target && (target === true
  3527. && this.input.parentNode === $el
  3528. && this.input.nextElementSibling
  3529. || query(target, $el));
  3530. }
  3531. },
  3532. update: function() {
  3533. var ref = this;
  3534. var target = ref.target;
  3535. var input = ref.input;
  3536. if (!target) {
  3537. return;
  3538. }
  3539. var option;
  3540. var prop = isInput(target) ? 'value' : 'textContent';
  3541. var prev = target[prop];
  3542. var value = input.files && input.files[0]
  3543. ? input.files[0].name
  3544. : matches(input, 'select') && (option = $$('option', input).filter(function (el) { return el.selected; })[0]) // eslint-disable-line prefer-destructuring
  3545. ? option.textContent
  3546. : input.value;
  3547. if (prev !== value) {
  3548. target[prop] = value;
  3549. }
  3550. },
  3551. events: [
  3552. {
  3553. name: 'change',
  3554. handler: function() {
  3555. this.$update();
  3556. }
  3557. },
  3558. {
  3559. name: 'reset',
  3560. el: function() {
  3561. return closest(this.$el, 'form');
  3562. },
  3563. handler: function() {
  3564. this.$update();
  3565. }
  3566. }
  3567. ]
  3568. };
  3569. // Deprecated
  3570. var gif = {
  3571. update: {
  3572. read: function(data) {
  3573. var inview = isInView(this.$el);
  3574. if (!inview || data.isInView === inview) {
  3575. return false;
  3576. }
  3577. data.isInView = inview;
  3578. },
  3579. write: function() {
  3580. this.$el.src = '' + this.$el.src; // force self-assign
  3581. },
  3582. events: ['scroll', 'resize']
  3583. }
  3584. };
  3585. var Margin = {
  3586. props: {
  3587. margin: String,
  3588. firstColumn: Boolean
  3589. },
  3590. data: {
  3591. margin: 'uk-margin-small-top',
  3592. firstColumn: 'uk-first-column'
  3593. },
  3594. update: {
  3595. read: function() {
  3596. var rows = getRows(this.$el.children);
  3597. return {
  3598. rows: rows,
  3599. columns: getColumns(rows)
  3600. };
  3601. },
  3602. write: function(ref) {
  3603. var this$1 = this;
  3604. var columns = ref.columns;
  3605. var rows = ref.rows;
  3606. rows.forEach(function (row, i) { return row.forEach(function (el) {
  3607. toggleClass(el, this$1.margin, i !== 0);
  3608. toggleClass(el, this$1.firstColumn, includes(columns[0], el));
  3609. }); }
  3610. );
  3611. },
  3612. events: ['resize']
  3613. }
  3614. };
  3615. function getRows(items) {
  3616. return sortBy$1(items, 'top', 'bottom');
  3617. }
  3618. function getColumns(rows) {
  3619. var columns = [[]];
  3620. rows.forEach(function (row) { return sortBy$1(row, 'left', 'right').forEach(function (column, i) { return columns[i] = !columns[i] ? column : columns[i].concat(column); }
  3621. ); }
  3622. );
  3623. return isRtl
  3624. ? columns.reverse()
  3625. : columns;
  3626. }
  3627. function sortBy$1(items, startProp, endProp) {
  3628. var sorted = [[]];
  3629. for (var i = 0; i < items.length; i++) {
  3630. var el = items[i];
  3631. if (!isVisible(el)) {
  3632. continue;
  3633. }
  3634. var dim = getOffset(el);
  3635. for (var j = sorted.length - 1; j >= 0; j--) {
  3636. var current = sorted[j];
  3637. if (!current[0]) {
  3638. current.push(el);
  3639. break;
  3640. }
  3641. var startDim = (void 0);
  3642. if (current[0].offsetParent === el.offsetParent) {
  3643. startDim = getOffset(current[0]);
  3644. } else {
  3645. dim = getOffset(el, true);
  3646. startDim = getOffset(current[0], true);
  3647. }
  3648. if (dim[startProp] >= startDim[endProp] - 1 && dim[startProp] !== startDim[startProp]) {
  3649. sorted.push([el]);
  3650. break;
  3651. }
  3652. if (dim[endProp] - 1 > startDim[startProp] || dim[startProp] === startDim[startProp]) {
  3653. current.push(el);
  3654. break;
  3655. }
  3656. if (j === 0) {
  3657. sorted.unshift([el]);
  3658. break;
  3659. }
  3660. }
  3661. }
  3662. return sorted;
  3663. }
  3664. function getOffset(element, offset) {
  3665. var assign;
  3666. if ( offset === void 0 ) offset = false;
  3667. var offsetTop = element.offsetTop;
  3668. var offsetLeft = element.offsetLeft;
  3669. var offsetHeight = element.offsetHeight;
  3670. var offsetWidth = element.offsetWidth;
  3671. if (offset) {
  3672. (assign = offsetPosition(element), offsetTop = assign[0], offsetLeft = assign[1]);
  3673. }
  3674. return {
  3675. top: offsetTop,
  3676. left: offsetLeft,
  3677. bottom: offsetTop + offsetHeight,
  3678. right: offsetLeft + offsetWidth
  3679. };
  3680. }
  3681. var grid = {
  3682. extends: Margin,
  3683. mixins: [Class],
  3684. name: 'grid',
  3685. props: {
  3686. masonry: Boolean,
  3687. parallax: Number
  3688. },
  3689. data: {
  3690. margin: 'uk-grid-margin',
  3691. clsStack: 'uk-grid-stack',
  3692. masonry: false,
  3693. parallax: 0
  3694. },
  3695. connected: function() {
  3696. this.masonry && addClass(this.$el, 'uk-flex-top uk-flex-wrap-top');
  3697. },
  3698. update: [
  3699. {
  3700. write: function(ref) {
  3701. var columns = ref.columns;
  3702. toggleClass(this.$el, this.clsStack, columns.length < 2);
  3703. },
  3704. events: ['resize']
  3705. },
  3706. {
  3707. read: function(ref) {
  3708. var columns = ref.columns;
  3709. var rows = ref.rows;
  3710. var nodes = children(this.$el);
  3711. if (!nodes.length || !this.masonry && !this.parallax) {
  3712. return false;
  3713. }
  3714. var transitionInProgress = nodes.some(Transition.inProgress);
  3715. var translates = false;
  3716. var columnHeights = getColumnHeights(columns);
  3717. var margin = getMarginTop(nodes, this.margin) * (rows.length - 1);
  3718. var elHeight = Math.max.apply(Math, columnHeights) + margin;
  3719. if (this.masonry) {
  3720. columns = columns.map(function (column) { return sortBy(column, 'offsetTop'); });
  3721. translates = getTranslates(rows, columns);
  3722. }
  3723. var padding = Math.abs(this.parallax);
  3724. if (padding) {
  3725. padding = columnHeights.reduce(function (newPadding, hgt, i) { return Math.max(newPadding, hgt + margin + (i % 2 ? padding : padding / 8) - elHeight); }
  3726. , 0);
  3727. }
  3728. return {padding: padding, columns: columns, translates: translates, height: transitionInProgress ? false : this.masonry ? elHeight : ''};
  3729. },
  3730. write: function(ref) {
  3731. var height = ref.height;
  3732. var padding = ref.padding;
  3733. css(this.$el, 'paddingBottom', padding || '');
  3734. height !== false && css(this.$el, 'height', height);
  3735. },
  3736. events: ['resize']
  3737. },
  3738. {
  3739. read: function(ref) {
  3740. var height$1 = ref.height;
  3741. return {
  3742. scrolled: this.parallax
  3743. ? scrolledOver(this.$el, height$1 ? height$1 - height(this.$el) : 0) * Math.abs(this.parallax)
  3744. : false
  3745. };
  3746. },
  3747. write: function(ref) {
  3748. var columns = ref.columns;
  3749. var scrolled = ref.scrolled;
  3750. var translates = ref.translates;
  3751. if (scrolled === false && !translates) {
  3752. return;
  3753. }
  3754. columns.forEach(function (column, i) { return column.forEach(function (el, j) { return css(el, 'transform', !scrolled && !translates ? '' : ("translateY(" + ((translates && -translates[i][j]) + (scrolled ? i % 2 ? scrolled : scrolled / 8 : 0)) + "px)")); }
  3755. ); }
  3756. );
  3757. },
  3758. events: ['scroll', 'resize']
  3759. }
  3760. ]
  3761. };
  3762. function getTranslates(rows, columns) {
  3763. var rowHeights = rows.map(function (row) { return Math.max.apply(Math, row.map(function (el) { return el.offsetHeight; })); }
  3764. );
  3765. return columns.map(function (elements) {
  3766. var prev = 0;
  3767. return elements.map(function (element, row) { return prev += row
  3768. ? rowHeights[row - 1] - elements[row - 1].offsetHeight
  3769. : 0; }
  3770. );
  3771. });
  3772. }
  3773. function getMarginTop(nodes, cls) {
  3774. var ref = nodes.filter(function (el) { return hasClass(el, cls); });
  3775. var node = ref[0];
  3776. return toFloat(node
  3777. ? css(node, 'marginTop')
  3778. : css(nodes[0], 'paddingLeft'));
  3779. }
  3780. function getColumnHeights(columns) {
  3781. return columns.map(function (column) { return column.reduce(function (sum, el) { return sum + el.offsetHeight; }, 0); }
  3782. );
  3783. }
  3784. // IE 11 fix (min-height on a flex container won't apply to its flex items)
  3785. var FlexBug = isIE ? {
  3786. props: {
  3787. selMinHeight: String
  3788. },
  3789. data: {
  3790. selMinHeight: false,
  3791. forceHeight: false
  3792. },
  3793. computed: {
  3794. elements: function(ref, $el) {
  3795. var selMinHeight = ref.selMinHeight;
  3796. return selMinHeight ? $$(selMinHeight, $el) : [$el];
  3797. }
  3798. },
  3799. update: [
  3800. {
  3801. read: function() {
  3802. css(this.elements, 'height', '');
  3803. },
  3804. order: -5,
  3805. events: ['resize']
  3806. },
  3807. {
  3808. write: function() {
  3809. var this$1 = this;
  3810. this.elements.forEach(function (el) {
  3811. var height = toFloat(css(el, 'minHeight'));
  3812. if (height && (this$1.forceHeight || Math.round(height + boxModelAdjust(el, 'height', 'content-box')) >= el.offsetHeight)) {
  3813. css(el, 'height', height);
  3814. }
  3815. });
  3816. },
  3817. order: 5,
  3818. events: ['resize']
  3819. }
  3820. ]
  3821. } : {};
  3822. var heightMatch = {
  3823. mixins: [FlexBug],
  3824. args: 'target',
  3825. props: {
  3826. target: String,
  3827. row: Boolean
  3828. },
  3829. data: {
  3830. target: '> *',
  3831. row: true,
  3832. forceHeight: true
  3833. },
  3834. computed: {
  3835. elements: function(ref, $el) {
  3836. var target = ref.target;
  3837. return $$(target, $el);
  3838. }
  3839. },
  3840. update: {
  3841. read: function() {
  3842. return {
  3843. rows: (this.row ? getRows(this.elements) : [this.elements]).map(match)
  3844. };
  3845. },
  3846. write: function(ref) {
  3847. var rows = ref.rows;
  3848. rows.forEach(function (ref) {
  3849. var heights = ref.heights;
  3850. var elements = ref.elements;
  3851. return elements.forEach(function (el, i) { return css(el, 'minHeight', heights[i]); }
  3852. );
  3853. }
  3854. );
  3855. },
  3856. events: ['resize']
  3857. }
  3858. };
  3859. function match(elements) {
  3860. var assign;
  3861. if (elements.length < 2) {
  3862. return {heights: [''], elements: elements};
  3863. }
  3864. var ref = getHeights(elements);
  3865. var heights = ref.heights;
  3866. var max = ref.max;
  3867. var hasMinHeight = elements.some(function (el) { return el.style.minHeight; });
  3868. var hasShrunk = elements.some(function (el, i) { return !el.style.minHeight && heights[i] < max; });
  3869. if (hasMinHeight && hasShrunk) {
  3870. css(elements, 'minHeight', '');
  3871. ((assign = getHeights(elements), heights = assign.heights, max = assign.max));
  3872. }
  3873. heights = elements.map(function (el, i) { return heights[i] === max && toFloat(el.style.minHeight).toFixed(2) !== max.toFixed(2) ? '' : max; }
  3874. );
  3875. return {heights: heights, elements: elements};
  3876. }
  3877. function getHeights(elements) {
  3878. var heights = elements.map(function (el) { return offset(el).height - boxModelAdjust(el, 'height', 'content-box'); });
  3879. var max = Math.max.apply(null, heights);
  3880. return {heights: heights, max: max};
  3881. }
  3882. var heightViewport = {
  3883. mixins: [FlexBug],
  3884. props: {
  3885. expand: Boolean,
  3886. offsetTop: Boolean,
  3887. offsetBottom: Boolean,
  3888. minHeight: Number
  3889. },
  3890. data: {
  3891. expand: false,
  3892. offsetTop: false,
  3893. offsetBottom: false,
  3894. minHeight: 0
  3895. },
  3896. update: {
  3897. read: function(ref) {
  3898. var prev = ref.minHeight;
  3899. if (!isVisible(this.$el)) {
  3900. return false;
  3901. }
  3902. var minHeight = '';
  3903. var box = boxModelAdjust(this.$el, 'height', 'content-box');
  3904. if (this.expand) {
  3905. this.$el.dataset.heightExpand = '';
  3906. if ($('[data-height-expand]') !== this.$el) {
  3907. return false;
  3908. }
  3909. minHeight = height(window) - (offsetHeight(document.documentElement) - offsetHeight(this.$el)) - box || '';
  3910. } else {
  3911. // on mobile devices (iOS and Android) window.innerHeight !== 100vh
  3912. minHeight = 'calc(100vh';
  3913. if (this.offsetTop) {
  3914. var ref$1 = offset(this.$el);
  3915. var top = ref$1.top;
  3916. minHeight += top > 0 && top < height(window) / 2 ? (" - " + top + "px") : '';
  3917. }
  3918. if (this.offsetBottom === true) {
  3919. minHeight += " - " + (offsetHeight(this.$el.nextElementSibling)) + "px";
  3920. } else if (isNumeric(this.offsetBottom)) {
  3921. minHeight += " - " + (this.offsetBottom) + "vh";
  3922. } else if (this.offsetBottom && endsWith(this.offsetBottom, 'px')) {
  3923. minHeight += " - " + (toFloat(this.offsetBottom)) + "px";
  3924. } else if (isString(this.offsetBottom)) {
  3925. minHeight += " - " + (offsetHeight(query(this.offsetBottom, this.$el))) + "px";
  3926. }
  3927. minHeight += (box ? (" - " + box + "px") : '') + ")";
  3928. }
  3929. return {minHeight: minHeight, prev: prev};
  3930. },
  3931. write: function(ref) {
  3932. var minHeight = ref.minHeight;
  3933. var prev = ref.prev;
  3934. css(this.$el, {minHeight: minHeight});
  3935. if (minHeight !== prev) {
  3936. this.$update(this.$el, 'resize');
  3937. }
  3938. if (this.minHeight && toFloat(css(this.$el, 'minHeight')) < this.minHeight) {
  3939. css(this.$el, 'minHeight', this.minHeight);
  3940. }
  3941. },
  3942. events: ['resize']
  3943. }
  3944. };
  3945. function offsetHeight(el) {
  3946. return el && offset(el).height || 0;
  3947. }
  3948. var SVG = {
  3949. args: 'src',
  3950. props: {
  3951. id: Boolean,
  3952. icon: String,
  3953. src: String,
  3954. style: String,
  3955. width: Number,
  3956. height: Number,
  3957. ratio: Number,
  3958. class: String,
  3959. strokeAnimation: Boolean,
  3960. focusable: Boolean, // IE 11
  3961. attributes: 'list'
  3962. },
  3963. data: {
  3964. ratio: 1,
  3965. include: ['style', 'class', 'focusable'],
  3966. class: '',
  3967. strokeAnimation: false
  3968. },
  3969. beforeConnect: function() {
  3970. this.class += ' uk-svg';
  3971. },
  3972. connected: function() {
  3973. var this$1 = this;
  3974. var assign;
  3975. if (!this.icon && includes(this.src, '#')) {
  3976. (assign = this.src.split('#'), this.src = assign[0], this.icon = assign[1]);
  3977. }
  3978. this.svg = this.getSvg().then(function (el) {
  3979. this$1.applyAttributes(el);
  3980. return this$1.svgEl = insertSVG(el, this$1.$el);
  3981. }, noop);
  3982. },
  3983. disconnected: function() {
  3984. var this$1 = this;
  3985. if (isVoidElement(this.$el)) {
  3986. attr(this.$el, 'hidden', null);
  3987. }
  3988. if (this.svg) {
  3989. this.svg.then(function (svg) { return (!this$1._connected || svg !== this$1.svgEl) && remove(svg); }, noop);
  3990. }
  3991. this.svg = this.svgEl = null;
  3992. },
  3993. update: {
  3994. read: function() {
  3995. return !!(this.strokeAnimation && this.svgEl && isVisible(this.svgEl));
  3996. },
  3997. write: function() {
  3998. applyAnimation(this.svgEl);
  3999. },
  4000. type: ['resize']
  4001. },
  4002. methods: {
  4003. getSvg: function() {
  4004. var this$1 = this;
  4005. return loadSVG(this.src).then(function (svg) { return parseSVG(svg, this$1.icon) || Promise.reject('SVG not found.'); }
  4006. );
  4007. },
  4008. applyAttributes: function(el) {
  4009. var this$1 = this;
  4010. for (var prop in this.$options.props) {
  4011. if (this[prop] && includes(this.include, prop)) {
  4012. attr(el, prop, this[prop]);
  4013. }
  4014. }
  4015. for (var attribute in this.attributes) {
  4016. var ref = this.attributes[attribute].split(':', 2);
  4017. var prop$1 = ref[0];
  4018. var value = ref[1];
  4019. attr(el, prop$1, value);
  4020. }
  4021. if (!this.id) {
  4022. removeAttr(el, 'id');
  4023. }
  4024. var props = ['width', 'height'];
  4025. var dimensions = [this.width, this.height];
  4026. if (!dimensions.some(function (val) { return val; })) {
  4027. dimensions = props.map(function (prop) { return attr(el, prop); });
  4028. }
  4029. var viewBox = attr(el, 'viewBox');
  4030. if (viewBox && !dimensions.some(function (val) { return val; })) {
  4031. dimensions = viewBox.split(' ').slice(2);
  4032. }
  4033. dimensions.forEach(function (val, i) {
  4034. val = (val | 0) * this$1.ratio;
  4035. val && attr(el, props[i], val);
  4036. if (val && !dimensions[i ^ 1]) {
  4037. removeAttr(el, props[i ^ 1]);
  4038. }
  4039. });
  4040. attr(el, 'data-svg', this.icon || this.src);
  4041. }
  4042. }
  4043. };
  4044. var svgs = {};
  4045. function loadSVG(src) {
  4046. if (svgs[src]) {
  4047. return svgs[src];
  4048. }
  4049. return svgs[src] = new Promise(function (resolve, reject) {
  4050. if (!src) {
  4051. reject();
  4052. return;
  4053. }
  4054. if (startsWith(src, 'data:')) {
  4055. resolve(decodeURIComponent(src.split(',')[1]));
  4056. } else {
  4057. ajax(src).then(
  4058. function (xhr) { return resolve(xhr.response); },
  4059. function () { return reject('SVG not found.'); }
  4060. );
  4061. }
  4062. });
  4063. }
  4064. function parseSVG(svg, icon) {
  4065. if (icon && includes(svg, '<symbol')) {
  4066. svg = parseSymbols(svg, icon) || svg;
  4067. }
  4068. svg = $(svg.substr(svg.indexOf('<svg')));
  4069. return svg && svg.hasChildNodes() && svg;
  4070. }
  4071. var symbolRe = /<symbol([^]*?id=(['"])(.+?)\2[^]*?<\/)symbol>/g;
  4072. var symbols = {};
  4073. function parseSymbols(svg, icon) {
  4074. if (!symbols[svg]) {
  4075. symbols[svg] = {};
  4076. symbolRe.lastIndex = 0;
  4077. var match;
  4078. while ((match = symbolRe.exec(svg))) {
  4079. symbols[svg][match[3]] = "<svg xmlns=\"http://www.w3.org/2000/svg\"" + (match[1]) + "svg>";
  4080. }
  4081. }
  4082. return symbols[svg][icon];
  4083. }
  4084. function applyAnimation(el) {
  4085. var length = getMaxPathLength(el);
  4086. if (length) {
  4087. el.style.setProperty('--uk-animation-stroke', length);
  4088. }
  4089. }
  4090. function getMaxPathLength(el) {
  4091. return Math.ceil(Math.max.apply(Math, [ 0 ].concat( $$('[stroke]', el).map(function (stroke) {
  4092. try {
  4093. return stroke.getTotalLength();
  4094. } catch (e) {
  4095. return 0;
  4096. }
  4097. }) )));
  4098. }
  4099. function insertSVG(el, root) {
  4100. if (isVoidElement(root) || root.tagName === 'CANVAS') {
  4101. attr(root, 'hidden', true);
  4102. var next = root.nextElementSibling;
  4103. return equals(el, next)
  4104. ? next
  4105. : after(root, el);
  4106. }
  4107. var last = root.lastElementChild;
  4108. return equals(el, last)
  4109. ? last
  4110. : append(root, el);
  4111. }
  4112. function equals(el, other) {
  4113. return attr(el, 'data-svg') === attr(other, 'data-svg');
  4114. }
  4115. 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>";
  4116. 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>";
  4117. 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>";
  4118. 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>";
  4119. 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>";
  4120. 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>";
  4121. 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>";
  4122. 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>";
  4123. 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>";
  4124. 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>";
  4125. var slidenavNext = "<svg width=\"14px\" height=\"24px\" 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>";
  4126. var slidenavNextLarge = "<svg width=\"25px\" height=\"40px\" 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>";
  4127. var slidenavPrevious = "<svg width=\"14px\" height=\"24px\" 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>";
  4128. var slidenavPreviousLarge = "<svg width=\"25px\" height=\"40px\" 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>";
  4129. 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>";
  4130. 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>";
  4131. var icons = {
  4132. spinner: spinner,
  4133. totop: totop,
  4134. marker: marker,
  4135. 'close-icon': closeIcon,
  4136. 'close-large': closeLarge,
  4137. 'navbar-toggle-icon': navbarToggleIcon,
  4138. 'overlay-icon': overlayIcon,
  4139. 'pagination-next': paginationNext,
  4140. 'pagination-previous': paginationPrevious,
  4141. 'search-icon': searchIcon,
  4142. 'search-large': searchLarge,
  4143. 'search-navbar': searchNavbar,
  4144. 'slidenav-next': slidenavNext,
  4145. 'slidenav-next-large': slidenavNextLarge,
  4146. 'slidenav-previous': slidenavPrevious,
  4147. 'slidenav-previous-large': slidenavPreviousLarge
  4148. };
  4149. var Icon = {
  4150. install: install,
  4151. extends: SVG,
  4152. args: 'icon',
  4153. props: ['icon'],
  4154. data: {
  4155. include: ['focusable']
  4156. },
  4157. isIcon: true,
  4158. beforeConnect: function() {
  4159. addClass(this.$el, 'uk-icon');
  4160. },
  4161. methods: {
  4162. getSvg: function() {
  4163. var icon = getIcon(this.icon);
  4164. if (!icon) {
  4165. return Promise.reject('Icon not found.');
  4166. }
  4167. return Promise.resolve(icon);
  4168. }
  4169. }
  4170. };
  4171. var IconComponent = {
  4172. args: false,
  4173. extends: Icon,
  4174. data: function (vm) { return ({
  4175. icon: hyphenate(vm.constructor.options.name)
  4176. }); },
  4177. beforeConnect: function() {
  4178. addClass(this.$el, this.$name);
  4179. }
  4180. };
  4181. var Slidenav = {
  4182. extends: IconComponent,
  4183. beforeConnect: function() {
  4184. addClass(this.$el, 'uk-slidenav');
  4185. },
  4186. computed: {
  4187. icon: function(ref, $el) {
  4188. var icon = ref.icon;
  4189. return hasClass($el, 'uk-slidenav-large')
  4190. ? (icon + "-large")
  4191. : icon;
  4192. }
  4193. }
  4194. };
  4195. var Search = {
  4196. extends: IconComponent,
  4197. computed: {
  4198. icon: function(ref, $el) {
  4199. var icon = ref.icon;
  4200. return hasClass($el, 'uk-search-icon') && parents($el, '.uk-search-large').length
  4201. ? 'search-large'
  4202. : parents($el, '.uk-search-navbar').length
  4203. ? 'search-navbar'
  4204. : icon;
  4205. }
  4206. }
  4207. };
  4208. var Close = {
  4209. extends: IconComponent,
  4210. computed: {
  4211. icon: function() {
  4212. return ("close-" + (hasClass(this.$el, 'uk-close-large') ? 'large' : 'icon'));
  4213. }
  4214. }
  4215. };
  4216. var Spinner = {
  4217. extends: IconComponent,
  4218. connected: function() {
  4219. var this$1 = this;
  4220. this.svg.then(function (svg) { return this$1.ratio !== 1 && css($('circle', svg), 'strokeWidth', 1 / this$1.ratio); }, noop);
  4221. }
  4222. };
  4223. var parsed = {};
  4224. function install(UIkit) {
  4225. UIkit.icon.add = function (name, svg) {
  4226. var obj;
  4227. var added = isString(name) ? (( obj = {}, obj[name] = svg, obj )) : name;
  4228. each(added, function (svg, name) {
  4229. icons[name] = svg;
  4230. delete parsed[name];
  4231. });
  4232. if (UIkit._initialized) {
  4233. apply(document.body, function (el) { return each(UIkit.getComponents(el), function (cmp) {
  4234. cmp.$options.isIcon && cmp.icon in added && cmp.$reset();
  4235. }); }
  4236. );
  4237. }
  4238. };
  4239. }
  4240. function getIcon(icon) {
  4241. if (!icons[icon]) {
  4242. return null;
  4243. }
  4244. if (!parsed[icon]) {
  4245. parsed[icon] = $((icons[applyRtl(icon)] || icons[icon]).trim());
  4246. }
  4247. return parsed[icon].cloneNode(true);
  4248. }
  4249. function applyRtl(icon) {
  4250. return isRtl ? swap(swap(icon, 'left', 'right'), 'previous', 'next') : icon;
  4251. }
  4252. var img = {
  4253. args: 'dataSrc',
  4254. props: {
  4255. dataSrc: String,
  4256. dataSrcset: Boolean,
  4257. sizes: String,
  4258. width: Number,
  4259. height: Number,
  4260. offsetTop: String,
  4261. offsetLeft: String,
  4262. target: String
  4263. },
  4264. data: {
  4265. dataSrc: '',
  4266. dataSrcset: false,
  4267. sizes: false,
  4268. width: false,
  4269. height: false,
  4270. offsetTop: '50vh',
  4271. offsetLeft: 0,
  4272. target: false
  4273. },
  4274. computed: {
  4275. cacheKey: function(ref) {
  4276. var dataSrc = ref.dataSrc;
  4277. return ((this.$name) + "." + dataSrc);
  4278. },
  4279. width: function(ref) {
  4280. var width = ref.width;
  4281. var dataWidth = ref.dataWidth;
  4282. return width || dataWidth;
  4283. },
  4284. height: function(ref) {
  4285. var height = ref.height;
  4286. var dataHeight = ref.dataHeight;
  4287. return height || dataHeight;
  4288. },
  4289. sizes: function(ref) {
  4290. var sizes = ref.sizes;
  4291. var dataSizes = ref.dataSizes;
  4292. return sizes || dataSizes;
  4293. },
  4294. isImg: function(_, $el) {
  4295. return isImg($el);
  4296. },
  4297. target: {
  4298. get: function(ref) {
  4299. var target = ref.target;
  4300. return [this.$el ].concat( queryAll(target, this.$el));
  4301. },
  4302. watch: function() {
  4303. this.observe();
  4304. }
  4305. },
  4306. offsetTop: function(ref) {
  4307. var offsetTop = ref.offsetTop;
  4308. return toPx(offsetTop, 'height');
  4309. },
  4310. offsetLeft: function(ref) {
  4311. var offsetLeft = ref.offsetLeft;
  4312. return toPx(offsetLeft, 'width');
  4313. }
  4314. },
  4315. connected: function() {
  4316. if (storage[this.cacheKey]) {
  4317. setSrcAttrs(this.$el, storage[this.cacheKey] || this.dataSrc, this.dataSrcset, this.sizes);
  4318. } else if (this.isImg && this.width && this.height) {
  4319. setSrcAttrs(this.$el, getPlaceholderImage(this.width, this.height, this.sizes));
  4320. }
  4321. this.observer = new IntersectionObserver(this.load, {
  4322. rootMargin: ((this.offsetTop) + "px " + (this.offsetLeft) + "px")
  4323. });
  4324. requestAnimationFrame(this.observe);
  4325. },
  4326. disconnected: function() {
  4327. this.observer.disconnect();
  4328. },
  4329. update: {
  4330. read: function(ref) {
  4331. var this$1 = this;
  4332. var image = ref.image;
  4333. if (!image && document.readyState === 'complete') {
  4334. this.load(this.observer.takeRecords());
  4335. }
  4336. if (this.isImg) {
  4337. return false;
  4338. }
  4339. image && image.then(function (img) { return img && img.currentSrc !== '' && setSrcAttrs(this$1.$el, currentSrc(img)); });
  4340. },
  4341. write: function(data) {
  4342. if (this.dataSrcset && window.devicePixelRatio !== 1) {
  4343. var bgSize = css(this.$el, 'backgroundSize');
  4344. if (bgSize.match(/^(auto\s?)+$/) || toFloat(bgSize) === data.bgSize) {
  4345. data.bgSize = getSourceSize(this.dataSrcset, this.sizes);
  4346. css(this.$el, 'backgroundSize', ((data.bgSize) + "px"));
  4347. }
  4348. }
  4349. },
  4350. events: ['resize']
  4351. },
  4352. methods: {
  4353. load: function(entries) {
  4354. var this$1 = this;
  4355. // Old chromium based browsers (UC Browser) did not implement `isIntersecting`
  4356. if (!entries.some(function (entry) { return isUndefined(entry.isIntersecting) || entry.isIntersecting; })) {
  4357. return;
  4358. }
  4359. this._data.image = getImage(this.dataSrc, this.dataSrcset, this.sizes).then(function (img) {
  4360. setSrcAttrs(this$1.$el, currentSrc(img), img.srcset, img.sizes);
  4361. storage[this$1.cacheKey] = currentSrc(img);
  4362. return img;
  4363. }, function (e) { return trigger(this$1.$el, new e.constructor(e.type, e)); });
  4364. this.observer.disconnect();
  4365. },
  4366. observe: function() {
  4367. var this$1 = this;
  4368. if (this._connected && !this._data.image) {
  4369. this.target.forEach(function (el) { return this$1.observer.observe(el); });
  4370. }
  4371. }
  4372. }
  4373. };
  4374. function setSrcAttrs(el, src, srcset, sizes) {
  4375. if (isImg(el)) {
  4376. sizes && (el.sizes = sizes);
  4377. srcset && (el.srcset = srcset);
  4378. src && (el.src = src);
  4379. } else if (src) {
  4380. var change = !includes(el.style.backgroundImage, src);
  4381. if (change) {
  4382. css(el, 'backgroundImage', ("url(" + (escape(src)) + ")"));
  4383. trigger(el, createEvent('load', false));
  4384. }
  4385. }
  4386. }
  4387. function getPlaceholderImage(width, height, sizes) {
  4388. var assign;
  4389. if (sizes) {
  4390. ((assign = Dimensions.ratio({width: width, height: height}, 'width', toPx(sizesToPixel(sizes))), width = assign.width, height = assign.height));
  4391. }
  4392. return ("data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"" + width + "\" height=\"" + height + "\"></svg>");
  4393. }
  4394. var sizesRe = /\s*(.*?)\s*(\w+|calc\(.*?\))\s*(?:,|$)/g;
  4395. function sizesToPixel(sizes) {
  4396. var matches;
  4397. sizesRe.lastIndex = 0;
  4398. while ((matches = sizesRe.exec(sizes))) {
  4399. if (!matches[1] || window.matchMedia(matches[1]).matches) {
  4400. matches = evaluateSize(matches[2]);
  4401. break;
  4402. }
  4403. }
  4404. return matches || '100vw';
  4405. }
  4406. var sizeRe = /\d+(?:\w+|%)/g;
  4407. var additionRe = /[+-]?(\d+)/g;
  4408. function evaluateSize(size) {
  4409. return startsWith(size, 'calc')
  4410. ? size
  4411. .substring(5, size.length - 1)
  4412. .replace(sizeRe, function (size) { return toPx(size); })
  4413. .replace(/ /g, '')
  4414. .match(additionRe)
  4415. .reduce(function (a, b) { return a + +b; }, 0)
  4416. : size;
  4417. }
  4418. var srcSetRe = /\s+\d+w\s*(?:,|$)/g;
  4419. function getSourceSize(srcset, sizes) {
  4420. var srcSize = toPx(sizesToPixel(sizes));
  4421. var descriptors = (srcset.match(srcSetRe) || []).map(toFloat).sort(function (a, b) { return a - b; });
  4422. return descriptors.filter(function (size) { return size >= srcSize; })[0] || descriptors.pop() || '';
  4423. }
  4424. function isImg(el) {
  4425. return el.tagName === 'IMG';
  4426. }
  4427. function currentSrc(el) {
  4428. return el.currentSrc || el.src;
  4429. }
  4430. var key = '__test__';
  4431. var storage;
  4432. // workaround for Safari's private browsing mode and accessing sessionStorage in Blink
  4433. try {
  4434. storage = window.sessionStorage || {};
  4435. storage[key] = 1;
  4436. delete storage[key];
  4437. } catch (e) {
  4438. storage = {};
  4439. }
  4440. var Media = {
  4441. props: {
  4442. media: Boolean
  4443. },
  4444. data: {
  4445. media: false
  4446. },
  4447. computed: {
  4448. matchMedia: function() {
  4449. var media = toMedia(this.media);
  4450. return !media || window.matchMedia(media).matches;
  4451. }
  4452. }
  4453. };
  4454. function toMedia(value) {
  4455. if (isString(value)) {
  4456. if (value[0] === '@') {
  4457. var name = "breakpoint-" + (value.substr(1));
  4458. value = toFloat(getCssVar(name));
  4459. } else if (isNaN(value)) {
  4460. return value;
  4461. }
  4462. }
  4463. return value && !isNaN(value) ? ("(min-width: " + value + "px)") : false;
  4464. }
  4465. var leader = {
  4466. mixins: [Class, Media],
  4467. props: {
  4468. fill: String
  4469. },
  4470. data: {
  4471. fill: '',
  4472. clsWrapper: 'uk-leader-fill',
  4473. clsHide: 'uk-leader-hide',
  4474. attrFill: 'data-fill'
  4475. },
  4476. computed: {
  4477. fill: function(ref) {
  4478. var fill = ref.fill;
  4479. return fill || getCssVar('leader-fill-content');
  4480. }
  4481. },
  4482. connected: function() {
  4483. var assign;
  4484. (assign = wrapInner(this.$el, ("<span class=\"" + (this.clsWrapper) + "\">")), this.wrapper = assign[0]);
  4485. },
  4486. disconnected: function() {
  4487. unwrap(this.wrapper.childNodes);
  4488. },
  4489. update: {
  4490. read: function(ref) {
  4491. var changed = ref.changed;
  4492. var width = ref.width;
  4493. var prev = width;
  4494. width = Math.floor(this.$el.offsetWidth / 2);
  4495. return {
  4496. width: width,
  4497. fill: this.fill,
  4498. changed: changed || prev !== width,
  4499. hide: !this.matchMedia
  4500. };
  4501. },
  4502. write: function(data) {
  4503. toggleClass(this.wrapper, this.clsHide, data.hide);
  4504. if (data.changed) {
  4505. data.changed = false;
  4506. attr(this.wrapper, this.attrFill, new Array(data.width).join(data.fill));
  4507. }
  4508. },
  4509. events: ['resize']
  4510. }
  4511. };
  4512. var Container = {
  4513. props: {
  4514. container: Boolean
  4515. },
  4516. data: {
  4517. container: true
  4518. },
  4519. computed: {
  4520. container: function(ref) {
  4521. var container = ref.container;
  4522. return container === true && this.$container || container && $(container);
  4523. }
  4524. }
  4525. };
  4526. var active$1 = [];
  4527. var Modal = {
  4528. mixins: [Class, Container, Togglable],
  4529. props: {
  4530. selPanel: String,
  4531. selClose: String,
  4532. escClose: Boolean,
  4533. bgClose: Boolean,
  4534. stack: Boolean
  4535. },
  4536. data: {
  4537. cls: 'uk-open',
  4538. escClose: true,
  4539. bgClose: true,
  4540. overlay: true,
  4541. stack: false
  4542. },
  4543. computed: {
  4544. panel: function(ref, $el) {
  4545. var selPanel = ref.selPanel;
  4546. return $(selPanel, $el);
  4547. },
  4548. transitionElement: function() {
  4549. return this.panel;
  4550. },
  4551. bgClose: function(ref) {
  4552. var bgClose = ref.bgClose;
  4553. return bgClose && this.panel;
  4554. }
  4555. },
  4556. beforeDisconnect: function() {
  4557. if (this.isToggled()) {
  4558. this.toggleElement(this.$el, false, false);
  4559. }
  4560. },
  4561. events: [
  4562. {
  4563. name: 'click',
  4564. delegate: function() {
  4565. return this.selClose;
  4566. },
  4567. handler: function(e) {
  4568. e.preventDefault();
  4569. this.hide();
  4570. }
  4571. },
  4572. {
  4573. name: 'toggle',
  4574. self: true,
  4575. handler: function(e) {
  4576. if (e.defaultPrevented) {
  4577. return;
  4578. }
  4579. e.preventDefault();
  4580. if (this.isToggled() === includes(active$1, this)) {
  4581. this.toggle();
  4582. }
  4583. }
  4584. },
  4585. {
  4586. name: 'beforeshow',
  4587. self: true,
  4588. handler: function(e) {
  4589. if (includes(active$1, this)) {
  4590. return false;
  4591. }
  4592. if (!this.stack && active$1.length) {
  4593. Promise.all(active$1.map(function (modal) { return modal.hide(); })).then(this.show);
  4594. e.preventDefault();
  4595. } else {
  4596. active$1.push(this);
  4597. }
  4598. }
  4599. },
  4600. {
  4601. name: 'show',
  4602. self: true,
  4603. handler: function() {
  4604. var this$1 = this;
  4605. if (width(window) - width(document) && this.overlay) {
  4606. css(document.body, 'overflowY', 'scroll');
  4607. }
  4608. this.stack && css(this.$el, 'zIndex', css(this.$el, 'zIndex') + active$1.length);
  4609. addClass(document.documentElement, this.clsPage);
  4610. if (this.bgClose) {
  4611. once(this.$el, 'hide', on(document, pointerDown, function (ref) {
  4612. var target = ref.target;
  4613. if (last(active$1) !== this$1 || this$1.overlay && !within(target, this$1.$el) || within(target, this$1.panel)) {
  4614. return;
  4615. }
  4616. once(document, (pointerUp + " " + pointerCancel + " scroll"), function (ref) {
  4617. var defaultPrevented = ref.defaultPrevented;
  4618. var type = ref.type;
  4619. var newTarget = ref.target;
  4620. if (!defaultPrevented && type === pointerUp && target === newTarget) {
  4621. this$1.hide();
  4622. }
  4623. }, true);
  4624. }), {self: true});
  4625. }
  4626. if (this.escClose) {
  4627. once(this.$el, 'hide', on(document, 'keydown', function (e) {
  4628. if (e.keyCode === 27 && last(active$1) === this$1) {
  4629. e.preventDefault();
  4630. this$1.hide();
  4631. }
  4632. }), {self: true});
  4633. }
  4634. }
  4635. },
  4636. {
  4637. name: 'hidden',
  4638. self: true,
  4639. handler: function() {
  4640. var this$1 = this;
  4641. active$1.splice(active$1.indexOf(this), 1);
  4642. if (!active$1.length) {
  4643. css(document.body, 'overflowY', '');
  4644. }
  4645. css(this.$el, 'zIndex', '');
  4646. if (!active$1.some(function (modal) { return modal.clsPage === this$1.clsPage; })) {
  4647. removeClass(document.documentElement, this.clsPage);
  4648. }
  4649. }
  4650. }
  4651. ],
  4652. methods: {
  4653. toggle: function() {
  4654. return this.isToggled() ? this.hide() : this.show();
  4655. },
  4656. show: function() {
  4657. var this$1 = this;
  4658. if (this.container && this.$el.parentNode !== this.container) {
  4659. append(this.container, this.$el);
  4660. return new Promise(function (resolve) { return requestAnimationFrame(function () { return this$1.show().then(resolve); }
  4661. ); }
  4662. );
  4663. }
  4664. return this.toggleElement(this.$el, true, animate$1(this));
  4665. },
  4666. hide: function() {
  4667. return this.toggleElement(this.$el, false, animate$1(this));
  4668. }
  4669. }
  4670. };
  4671. function animate$1(ref) {
  4672. var transitionElement = ref.transitionElement;
  4673. var _toggle = ref._toggle;
  4674. return function (el, show) { return new Promise(function (resolve, reject) { return once(el, 'show hide', function () {
  4675. el._reject && el._reject();
  4676. el._reject = reject;
  4677. _toggle(el, show);
  4678. var off = once(transitionElement, 'transitionstart', function () {
  4679. once(transitionElement, 'transitionend transitioncancel', resolve, {self: true});
  4680. clearTimeout(timer);
  4681. }, {self: true});
  4682. var timer = setTimeout(function () {
  4683. off();
  4684. resolve();
  4685. }, toMs(css(transitionElement, 'transitionDuration')));
  4686. }); }
  4687. ); };
  4688. }
  4689. var modal = {
  4690. install: install$1,
  4691. mixins: [Modal],
  4692. data: {
  4693. clsPage: 'uk-modal-page',
  4694. selPanel: '.uk-modal-dialog',
  4695. selClose: '.uk-modal-close, .uk-modal-close-default, .uk-modal-close-outside, .uk-modal-close-full'
  4696. },
  4697. events: [
  4698. {
  4699. name: 'show',
  4700. self: true,
  4701. handler: function() {
  4702. if (hasClass(this.panel, 'uk-margin-auto-vertical')) {
  4703. addClass(this.$el, 'uk-flex');
  4704. } else {
  4705. css(this.$el, 'display', 'block');
  4706. }
  4707. height(this.$el); // force reflow
  4708. }
  4709. },
  4710. {
  4711. name: 'hidden',
  4712. self: true,
  4713. handler: function() {
  4714. css(this.$el, 'display', '');
  4715. removeClass(this.$el, 'uk-flex');
  4716. }
  4717. }
  4718. ]
  4719. };
  4720. function install$1(ref) {
  4721. var modal = ref.modal;
  4722. modal.dialog = function (content, options) {
  4723. var dialog = modal(
  4724. ("<div class=\"uk-modal\"> <div class=\"uk-modal-dialog\">" + content + "</div> </div>"),
  4725. options
  4726. );
  4727. dialog.show();
  4728. on(dialog.$el, 'hidden', function () { return Promise.resolve().then(function () { return dialog.$destroy(true); }
  4729. ); }, {self: true}
  4730. );
  4731. return dialog;
  4732. };
  4733. modal.alert = function (message, options) {
  4734. return openDialog(
  4735. function (ref) {
  4736. var labels = ref.labels;
  4737. return ("<div class=\"uk-modal-body\">" + (isString(message) ? message : html(message)) + "</div> <div class=\"uk-modal-footer uk-text-right\"> <button class=\"uk-button uk-button-primary uk-modal-close\" autofocus>" + (labels.ok) + "</button> </div>");
  4738. },
  4739. options,
  4740. function (deferred) { return deferred.resolve(); }
  4741. );
  4742. };
  4743. modal.confirm = function (message, options) {
  4744. return openDialog(
  4745. function (ref) {
  4746. var labels = ref.labels;
  4747. return ("<form> <div class=\"uk-modal-body\">" + (isString(message) ? message : html(message)) + "</div> <div class=\"uk-modal-footer uk-text-right\"> <button class=\"uk-button uk-button-default uk-modal-close\" type=\"button\">" + (labels.cancel) + "</button> <button class=\"uk-button uk-button-primary\" autofocus>" + (labels.ok) + "</button> </div> </form>");
  4748. },
  4749. options,
  4750. function (deferred) { return deferred.reject(); }
  4751. );
  4752. };
  4753. modal.prompt = function (message, value, options) {
  4754. return openDialog(
  4755. function (ref) {
  4756. var labels = ref.labels;
  4757. return ("<form class=\"uk-form-stacked\"> <div class=\"uk-modal-body\"> <label>" + (isString(message) ? message : html(message)) + "</label> <input class=\"uk-input\" value=\"" + (value || '') + "\" autofocus> </div> <div class=\"uk-modal-footer uk-text-right\"> <button class=\"uk-button uk-button-default uk-modal-close\" type=\"button\">" + (labels.cancel) + "</button> <button class=\"uk-button uk-button-primary\">" + (labels.ok) + "</button> </div> </form>");
  4758. },
  4759. options,
  4760. function (deferred) { return deferred.resolve(null); },
  4761. function (dialog) { return $('input', dialog.$el).value; }
  4762. );
  4763. };
  4764. modal.labels = {
  4765. ok: 'Ok',
  4766. cancel: 'Cancel'
  4767. };
  4768. function openDialog(tmpl, options, hideFn, submitFn) {
  4769. options = assign({bgClose: false, escClose: true, labels: modal.labels}, options);
  4770. var dialog = modal.dialog(tmpl(options), options);
  4771. var deferred = new Deferred();
  4772. var resolved = false;
  4773. on(dialog.$el, 'submit', 'form', function (e) {
  4774. e.preventDefault();
  4775. deferred.resolve(submitFn && submitFn(dialog));
  4776. resolved = true;
  4777. dialog.hide();
  4778. });
  4779. on(dialog.$el, 'hide', function () { return !resolved && hideFn(deferred); });
  4780. deferred.promise.dialog = dialog;
  4781. return deferred.promise;
  4782. }
  4783. }
  4784. var nav = {
  4785. extends: Accordion,
  4786. data: {
  4787. targets: '> .uk-parent',
  4788. toggle: '> a',
  4789. content: '> ul'
  4790. }
  4791. };
  4792. var navbar = {
  4793. mixins: [Class, FlexBug],
  4794. props: {
  4795. dropdown: String,
  4796. mode: 'list',
  4797. align: String,
  4798. offset: Number,
  4799. boundary: Boolean,
  4800. boundaryAlign: Boolean,
  4801. clsDrop: String,
  4802. delayShow: Number,
  4803. delayHide: Number,
  4804. dropbar: Boolean,
  4805. dropbarMode: String,
  4806. dropbarAnchor: Boolean,
  4807. duration: Number
  4808. },
  4809. data: {
  4810. dropdown: '.uk-navbar-nav > li',
  4811. align: !isRtl ? 'left' : 'right',
  4812. clsDrop: 'uk-navbar-dropdown',
  4813. mode: undefined,
  4814. offset: undefined,
  4815. delayShow: undefined,
  4816. delayHide: undefined,
  4817. boundaryAlign: undefined,
  4818. flip: 'x',
  4819. boundary: true,
  4820. dropbar: false,
  4821. dropbarMode: 'slide',
  4822. dropbarAnchor: false,
  4823. duration: 200,
  4824. forceHeight: true,
  4825. selMinHeight: '.uk-navbar-nav > li > a, .uk-navbar-item, .uk-navbar-toggle'
  4826. },
  4827. computed: {
  4828. boundary: function(ref, $el) {
  4829. var boundary = ref.boundary;
  4830. var boundaryAlign = ref.boundaryAlign;
  4831. return (boundary === true || boundaryAlign) ? $el : boundary;
  4832. },
  4833. dropbarAnchor: function(ref, $el) {
  4834. var dropbarAnchor = ref.dropbarAnchor;
  4835. return query(dropbarAnchor, $el);
  4836. },
  4837. pos: function(ref) {
  4838. var align = ref.align;
  4839. return ("bottom-" + align);
  4840. },
  4841. dropbar: {
  4842. get: function(ref) {
  4843. var dropbar = ref.dropbar;
  4844. if (!dropbar) {
  4845. return null;
  4846. }
  4847. dropbar = this._dropbar || query(dropbar, this.$el) || $('+ .uk-navbar-dropbar', this.$el);
  4848. return dropbar ? dropbar : (this._dropbar = $('<div></div>'));
  4849. },
  4850. watch: function(dropbar) {
  4851. addClass(dropbar, 'uk-navbar-dropbar');
  4852. },
  4853. immediate: true
  4854. },
  4855. dropdowns: {
  4856. get: function(ref, $el) {
  4857. var dropdown = ref.dropdown;
  4858. var clsDrop = ref.clsDrop;
  4859. return $$((dropdown + " ." + clsDrop), $el);
  4860. },
  4861. watch: function(dropdowns) {
  4862. var this$1 = this;
  4863. this.$create(
  4864. 'drop',
  4865. dropdowns.filter(function (el) { return !this$1.getDropdown(el); }),
  4866. assign({}, this.$props, {boundary: this.boundary, pos: this.pos, offset: this.dropbar || this.offset})
  4867. );
  4868. },
  4869. immediate: true
  4870. }
  4871. },
  4872. disconnected: function() {
  4873. this.dropbar && remove(this.dropbar);
  4874. delete this._dropbar;
  4875. },
  4876. events: [
  4877. {
  4878. name: 'mouseover',
  4879. delegate: function() {
  4880. return this.dropdown;
  4881. },
  4882. handler: function(ref) {
  4883. var current = ref.current;
  4884. var active = this.getActive();
  4885. if (active && active.toggle && !within(active.toggle.$el, current) && !active.tracker.movesTo(active.$el)) {
  4886. active.hide(false);
  4887. }
  4888. }
  4889. },
  4890. {
  4891. name: 'mouseleave',
  4892. el: function() {
  4893. return this.dropbar;
  4894. },
  4895. handler: function() {
  4896. var active = this.getActive();
  4897. if (active && !this.dropdowns.some(function (el) { return matches(el, ':hover'); })) {
  4898. active.hide();
  4899. }
  4900. }
  4901. },
  4902. {
  4903. name: 'beforeshow',
  4904. capture: true,
  4905. filter: function() {
  4906. return this.dropbar;
  4907. },
  4908. handler: function() {
  4909. if (!this.dropbar.parentNode) {
  4910. after(this.dropbarAnchor || this.$el, this.dropbar);
  4911. }
  4912. }
  4913. },
  4914. {
  4915. name: 'show',
  4916. filter: function() {
  4917. return this.dropbar;
  4918. },
  4919. handler: function(_, ref) {
  4920. var $el = ref.$el;
  4921. var dir = ref.dir;
  4922. toggleClass(this.dropbar, 'uk-navbar-dropbar-slide', this.dropbarMode === 'slide' || parents(this.$el).some(function (el) { return css(el, 'position') !== 'static'; }));
  4923. this.clsDrop && addClass($el, ((this.clsDrop) + "-dropbar"));
  4924. if (dir === 'bottom') {
  4925. this.transitionTo($el.offsetHeight + toFloat(css($el, 'marginTop')) + toFloat(css($el, 'marginBottom')), $el);
  4926. }
  4927. }
  4928. },
  4929. {
  4930. name: 'beforehide',
  4931. filter: function() {
  4932. return this.dropbar;
  4933. },
  4934. handler: function(e, ref) {
  4935. var $el = ref.$el;
  4936. var active = this.getActive();
  4937. if (matches(this.dropbar, ':hover') && active && active.$el === $el) {
  4938. e.preventDefault();
  4939. }
  4940. }
  4941. },
  4942. {
  4943. name: 'hide',
  4944. filter: function() {
  4945. return this.dropbar;
  4946. },
  4947. handler: function(_, ref) {
  4948. var $el = ref.$el;
  4949. var active = this.getActive();
  4950. if (!active || active && active.$el === $el) {
  4951. this.transitionTo(0);
  4952. }
  4953. }
  4954. }
  4955. ],
  4956. methods: {
  4957. getActive: function() {
  4958. var ref = this.dropdowns.map(this.getDropdown).filter(function (drop) { return drop && drop.isActive(); });
  4959. var active = ref[0];
  4960. return active && includes(active.mode, 'hover') && within(active.toggle.$el, this.$el) && active;
  4961. },
  4962. transitionTo: function(newHeight, el) {
  4963. var this$1 = this;
  4964. var ref = this;
  4965. var dropbar = ref.dropbar;
  4966. var oldHeight = isVisible(dropbar) ? height(dropbar) : 0;
  4967. el = oldHeight < newHeight && el;
  4968. css(el, 'clip', ("rect(0," + (el.offsetWidth) + "px," + oldHeight + "px,0)"));
  4969. height(dropbar, oldHeight);
  4970. Transition.cancel([el, dropbar]);
  4971. return Promise.all([
  4972. Transition.start(dropbar, {height: newHeight}, this.duration),
  4973. Transition.start(el, {clip: ("rect(0," + (el.offsetWidth) + "px," + newHeight + "px,0)")}, this.duration)
  4974. ])
  4975. .catch(noop)
  4976. .then(function () {
  4977. css(el, {clip: ''});
  4978. this$1.$update(dropbar);
  4979. });
  4980. },
  4981. getDropdown: function(el) {
  4982. return this.$getComponent(el, 'drop') || this.$getComponent(el, 'dropdown');
  4983. }
  4984. }
  4985. };
  4986. var offcanvas = {
  4987. mixins: [Modal],
  4988. args: 'mode',
  4989. props: {
  4990. mode: String,
  4991. flip: Boolean,
  4992. overlay: Boolean
  4993. },
  4994. data: {
  4995. mode: 'slide',
  4996. flip: false,
  4997. overlay: false,
  4998. clsPage: 'uk-offcanvas-page',
  4999. clsContainer: 'uk-offcanvas-container',
  5000. selPanel: '.uk-offcanvas-bar',
  5001. clsFlip: 'uk-offcanvas-flip',
  5002. clsContainerAnimation: 'uk-offcanvas-container-animation',
  5003. clsSidebarAnimation: 'uk-offcanvas-bar-animation',
  5004. clsMode: 'uk-offcanvas',
  5005. clsOverlay: 'uk-offcanvas-overlay',
  5006. selClose: '.uk-offcanvas-close',
  5007. container: false
  5008. },
  5009. computed: {
  5010. clsFlip: function(ref) {
  5011. var flip = ref.flip;
  5012. var clsFlip = ref.clsFlip;
  5013. return flip ? clsFlip : '';
  5014. },
  5015. clsOverlay: function(ref) {
  5016. var overlay = ref.overlay;
  5017. var clsOverlay = ref.clsOverlay;
  5018. return overlay ? clsOverlay : '';
  5019. },
  5020. clsMode: function(ref) {
  5021. var mode = ref.mode;
  5022. var clsMode = ref.clsMode;
  5023. return (clsMode + "-" + mode);
  5024. },
  5025. clsSidebarAnimation: function(ref) {
  5026. var mode = ref.mode;
  5027. var clsSidebarAnimation = ref.clsSidebarAnimation;
  5028. return mode === 'none' || mode === 'reveal' ? '' : clsSidebarAnimation;
  5029. },
  5030. clsContainerAnimation: function(ref) {
  5031. var mode = ref.mode;
  5032. var clsContainerAnimation = ref.clsContainerAnimation;
  5033. return mode !== 'push' && mode !== 'reveal' ? '' : clsContainerAnimation;
  5034. },
  5035. transitionElement: function(ref) {
  5036. var mode = ref.mode;
  5037. return mode === 'reveal' ? this.panel.parentNode : this.panel;
  5038. }
  5039. },
  5040. events: [
  5041. {
  5042. name: 'click',
  5043. delegate: function() {
  5044. return 'a[href^="#"]';
  5045. },
  5046. handler: function(ref) {
  5047. var hash = ref.current.hash;
  5048. var defaultPrevented = ref.defaultPrevented;
  5049. if (!defaultPrevented && hash && $(hash, document.body)) {
  5050. this.hide();
  5051. }
  5052. }
  5053. },
  5054. {
  5055. name: 'touchstart',
  5056. passive: true,
  5057. el: function() {
  5058. return this.panel;
  5059. },
  5060. handler: function(ref) {
  5061. var targetTouches = ref.targetTouches;
  5062. if (targetTouches.length === 1) {
  5063. this.clientY = targetTouches[0].clientY;
  5064. }
  5065. }
  5066. },
  5067. {
  5068. name: 'touchmove',
  5069. self: true,
  5070. passive: false,
  5071. filter: function() {
  5072. return this.overlay;
  5073. },
  5074. handler: function(e) {
  5075. e.cancelable && e.preventDefault();
  5076. }
  5077. },
  5078. {
  5079. name: 'touchmove',
  5080. passive: false,
  5081. el: function() {
  5082. return this.panel;
  5083. },
  5084. handler: function(e) {
  5085. if (e.targetTouches.length !== 1) {
  5086. return;
  5087. }
  5088. var clientY = event.targetTouches[0].clientY - this.clientY;
  5089. var ref = this.panel;
  5090. var scrollTop = ref.scrollTop;
  5091. var scrollHeight = ref.scrollHeight;
  5092. var clientHeight = ref.clientHeight;
  5093. if (clientHeight >= scrollHeight
  5094. || scrollTop === 0 && clientY > 0
  5095. || scrollHeight - scrollTop <= clientHeight && clientY < 0
  5096. ) {
  5097. e.cancelable && e.preventDefault();
  5098. }
  5099. }
  5100. },
  5101. {
  5102. name: 'show',
  5103. self: true,
  5104. handler: function() {
  5105. if (this.mode === 'reveal' && !hasClass(this.panel.parentNode, this.clsMode)) {
  5106. wrapAll(this.panel, '<div>');
  5107. addClass(this.panel.parentNode, this.clsMode);
  5108. }
  5109. css(document.documentElement, 'overflowY', this.overlay ? 'hidden' : '');
  5110. addClass(document.body, this.clsContainer, this.clsFlip);
  5111. css(document.body, 'touch-action', 'pan-y pinch-zoom');
  5112. css(this.$el, 'display', 'block');
  5113. addClass(this.$el, this.clsOverlay);
  5114. addClass(this.panel, this.clsSidebarAnimation, this.mode !== 'reveal' ? this.clsMode : '');
  5115. height(document.body); // force reflow
  5116. addClass(document.body, this.clsContainerAnimation);
  5117. this.clsContainerAnimation && suppressUserScale();
  5118. }
  5119. },
  5120. {
  5121. name: 'hide',
  5122. self: true,
  5123. handler: function() {
  5124. removeClass(document.body, this.clsContainerAnimation);
  5125. css(document.body, 'touch-action', '');
  5126. }
  5127. },
  5128. {
  5129. name: 'hidden',
  5130. self: true,
  5131. handler: function() {
  5132. this.clsContainerAnimation && resumeUserScale();
  5133. if (this.mode === 'reveal') {
  5134. unwrap(this.panel);
  5135. }
  5136. removeClass(this.panel, this.clsSidebarAnimation, this.clsMode);
  5137. removeClass(this.$el, this.clsOverlay);
  5138. css(this.$el, 'display', '');
  5139. removeClass(document.body, this.clsContainer, this.clsFlip);
  5140. css(document.documentElement, 'overflowY', '');
  5141. }
  5142. },
  5143. {
  5144. name: 'swipeLeft swipeRight',
  5145. handler: function(e) {
  5146. if (this.isToggled() && endsWith(e.type, 'Left') ^ this.flip) {
  5147. this.hide();
  5148. }
  5149. }
  5150. }
  5151. ]
  5152. };
  5153. // Chrome in responsive mode zooms page upon opening offcanvas
  5154. function suppressUserScale() {
  5155. getViewport$1().content += ',user-scalable=0';
  5156. }
  5157. function resumeUserScale() {
  5158. var viewport = getViewport$1();
  5159. viewport.content = viewport.content.replace(/,user-scalable=0$/, '');
  5160. }
  5161. function getViewport$1() {
  5162. return $('meta[name="viewport"]', document.head) || append(document.head, '<meta name="viewport">');
  5163. }
  5164. var overflowAuto = {
  5165. mixins: [Class],
  5166. props: {
  5167. selContainer: String,
  5168. selContent: String
  5169. },
  5170. data: {
  5171. selContainer: '.uk-modal',
  5172. selContent: '.uk-modal-dialog'
  5173. },
  5174. computed: {
  5175. container: function(ref, $el) {
  5176. var selContainer = ref.selContainer;
  5177. return closest($el, selContainer);
  5178. },
  5179. content: function(ref, $el) {
  5180. var selContent = ref.selContent;
  5181. return closest($el, selContent);
  5182. }
  5183. },
  5184. connected: function() {
  5185. css(this.$el, 'minHeight', 150);
  5186. },
  5187. update: {
  5188. read: function() {
  5189. if (!this.content || !this.container) {
  5190. return false;
  5191. }
  5192. return {
  5193. current: toFloat(css(this.$el, 'maxHeight')),
  5194. max: Math.max(150, height(this.container) - (offset(this.content).height - height(this.$el)))
  5195. };
  5196. },
  5197. write: function(ref) {
  5198. var current = ref.current;
  5199. var max = ref.max;
  5200. css(this.$el, 'maxHeight', max);
  5201. if (Math.round(current) !== Math.round(max)) {
  5202. trigger(this.$el, 'resize');
  5203. }
  5204. },
  5205. events: ['resize']
  5206. }
  5207. };
  5208. var responsive = {
  5209. props: ['width', 'height'],
  5210. connected: function() {
  5211. addClass(this.$el, 'uk-responsive-width');
  5212. },
  5213. update: {
  5214. read: function() {
  5215. return isVisible(this.$el) && this.width && this.height
  5216. ? {width: width(this.$el.parentNode), height: this.height}
  5217. : false;
  5218. },
  5219. write: function(dim) {
  5220. height(this.$el, Dimensions.contain({
  5221. height: this.height,
  5222. width: this.width
  5223. }, dim).height);
  5224. },
  5225. events: ['resize']
  5226. }
  5227. };
  5228. var scroll = {
  5229. props: {
  5230. offset: Number
  5231. },
  5232. data: {
  5233. offset: 0
  5234. },
  5235. methods: {
  5236. scrollTo: function(el) {
  5237. var this$1 = this;
  5238. el = el && $(el) || document.body;
  5239. if (trigger(this.$el, 'beforescroll', [this, el])) {
  5240. scrollIntoView(el, {offset: this.offset}).then(function () { return trigger(this$1.$el, 'scrolled', [this$1, el]); }
  5241. );
  5242. }
  5243. }
  5244. },
  5245. events: {
  5246. click: function(e) {
  5247. if (e.defaultPrevented) {
  5248. return;
  5249. }
  5250. e.preventDefault();
  5251. this.scrollTo(escape(decodeURIComponent(this.$el.hash)).substr(1));
  5252. }
  5253. }
  5254. };
  5255. var scrollspy = {
  5256. args: 'cls',
  5257. props: {
  5258. cls: String,
  5259. target: String,
  5260. hidden: Boolean,
  5261. offsetTop: Number,
  5262. offsetLeft: Number,
  5263. repeat: Boolean,
  5264. delay: Number
  5265. },
  5266. data: function () { return ({
  5267. cls: false,
  5268. target: false,
  5269. hidden: true,
  5270. offsetTop: 0,
  5271. offsetLeft: 0,
  5272. repeat: false,
  5273. delay: 0,
  5274. inViewClass: 'uk-scrollspy-inview'
  5275. }); },
  5276. computed: {
  5277. elements: {
  5278. get: function(ref, $el) {
  5279. var target = ref.target;
  5280. return target ? $$(target, $el) : [$el];
  5281. },
  5282. watch: function(elements) {
  5283. if (this.hidden) {
  5284. css(filter(elements, (":not(." + (this.inViewClass) + ")")), 'visibility', 'hidden');
  5285. }
  5286. },
  5287. immediate: true
  5288. }
  5289. },
  5290. update: [
  5291. {
  5292. read: function(ref) {
  5293. var this$1 = this;
  5294. var update = ref.update;
  5295. if (!update) {
  5296. return;
  5297. }
  5298. this.elements.forEach(function (el) {
  5299. var state = el._ukScrollspyState;
  5300. if (!state) {
  5301. state = {cls: data(el, 'uk-scrollspy-class') || this$1.cls};
  5302. }
  5303. state.show = isInView(el, this$1.offsetTop, this$1.offsetLeft);
  5304. el._ukScrollspyState = state;
  5305. });
  5306. },
  5307. write: function(data) {
  5308. var this$1 = this;
  5309. // Let child components be applied at least once first
  5310. if (!data.update) {
  5311. this.$emit();
  5312. return data.update = true;
  5313. }
  5314. this.elements.forEach(function (el) {
  5315. var state = el._ukScrollspyState;
  5316. var toggle = function (inview) {
  5317. css(el, 'visibility', !inview && this$1.hidden ? 'hidden' : '');
  5318. toggleClass(el, this$1.inViewClass, inview);
  5319. toggleClass(el, state.cls);
  5320. trigger(el, inview ? 'inview' : 'outview');
  5321. state.inview = inview;
  5322. this$1.$update(el);
  5323. };
  5324. if (state.show && !state.inview && !state.queued) {
  5325. state.queued = true;
  5326. data.promise = (data.promise || Promise.resolve()).then(function () { return new Promise(function (resolve) { return setTimeout(resolve, this$1.delay); }
  5327. ); }
  5328. ).then(function () {
  5329. toggle(true);
  5330. setTimeout(function () {
  5331. state.queued = false;
  5332. this$1.$emit();
  5333. }, 300);
  5334. });
  5335. } else if (!state.show && state.inview && !state.queued && this$1.repeat) {
  5336. toggle(false);
  5337. }
  5338. });
  5339. },
  5340. events: ['scroll', 'resize']
  5341. }
  5342. ]
  5343. };
  5344. var scrollspyNav = {
  5345. props: {
  5346. cls: String,
  5347. closest: String,
  5348. scroll: Boolean,
  5349. overflow: Boolean,
  5350. offset: Number
  5351. },
  5352. data: {
  5353. cls: 'uk-active',
  5354. closest: false,
  5355. scroll: false,
  5356. overflow: true,
  5357. offset: 0
  5358. },
  5359. computed: {
  5360. links: {
  5361. get: function(_, $el) {
  5362. return $$('a[href^="#"]', $el).filter(function (el) { return el.hash; });
  5363. },
  5364. watch: function(links) {
  5365. if (this.scroll) {
  5366. this.$create('scroll', links, {offset: this.offset || 0});
  5367. }
  5368. },
  5369. immediate: true
  5370. },
  5371. targets: function() {
  5372. return $$(this.links.map(function (el) { return escape(el.hash).substr(1); }).join(','));
  5373. },
  5374. elements: function(ref) {
  5375. var selector = ref.closest;
  5376. return closest(this.links, selector || '*');
  5377. }
  5378. },
  5379. update: [
  5380. {
  5381. read: function() {
  5382. var this$1 = this;
  5383. var ref = this.targets;
  5384. var length = ref.length;
  5385. if (!length || !isVisible(this.$el)) {
  5386. return false;
  5387. }
  5388. var scrollElement = last(scrollParents(this.targets[0]));
  5389. var scrollTop = scrollElement.scrollTop;
  5390. var scrollHeight = scrollElement.scrollHeight;
  5391. var viewport = getViewport(scrollElement);
  5392. var max = scrollHeight - offset(viewport).height;
  5393. var active = false;
  5394. if (scrollTop === max) {
  5395. active = length - 1;
  5396. } else {
  5397. this.targets.every(function (el, i) {
  5398. if (position(el, viewport).top - this$1.offset <= 0) {
  5399. active = i;
  5400. return true;
  5401. }
  5402. });
  5403. if (active === false && this.overflow) {
  5404. active = 0;
  5405. }
  5406. }
  5407. return {active: active};
  5408. },
  5409. write: function(ref) {
  5410. var active = ref.active;
  5411. this.links.forEach(function (el) { return el.blur(); });
  5412. removeClass(this.elements, this.cls);
  5413. if (active !== false) {
  5414. trigger(this.$el, 'active', [active, addClass(this.elements[active], this.cls)]);
  5415. }
  5416. },
  5417. events: ['scroll', 'resize']
  5418. }
  5419. ]
  5420. };
  5421. var sticky = {
  5422. mixins: [Class, Media],
  5423. props: {
  5424. top: null,
  5425. bottom: Boolean,
  5426. offset: String,
  5427. animation: String,
  5428. clsActive: String,
  5429. clsInactive: String,
  5430. clsFixed: String,
  5431. clsBelow: String,
  5432. selTarget: String,
  5433. widthElement: Boolean,
  5434. showOnUp: Boolean,
  5435. targetOffset: Number
  5436. },
  5437. data: {
  5438. top: 0,
  5439. bottom: false,
  5440. offset: 0,
  5441. animation: '',
  5442. clsActive: 'uk-active',
  5443. clsInactive: '',
  5444. clsFixed: 'uk-sticky-fixed',
  5445. clsBelow: 'uk-sticky-below',
  5446. selTarget: '',
  5447. widthElement: false,
  5448. showOnUp: false,
  5449. targetOffset: false
  5450. },
  5451. computed: {
  5452. offset: function(ref) {
  5453. var offset = ref.offset;
  5454. return toPx(offset);
  5455. },
  5456. selTarget: function(ref, $el) {
  5457. var selTarget = ref.selTarget;
  5458. return selTarget && $(selTarget, $el) || $el;
  5459. },
  5460. widthElement: function(ref, $el) {
  5461. var widthElement = ref.widthElement;
  5462. return query(widthElement, $el) || this.placeholder;
  5463. },
  5464. isActive: {
  5465. get: function() {
  5466. return hasClass(this.selTarget, this.clsActive);
  5467. },
  5468. set: function(value) {
  5469. if (value && !this.isActive) {
  5470. replaceClass(this.selTarget, this.clsInactive, this.clsActive);
  5471. trigger(this.$el, 'active');
  5472. } else if (!value && !hasClass(this.selTarget, this.clsInactive)) {
  5473. replaceClass(this.selTarget, this.clsActive, this.clsInactive);
  5474. trigger(this.$el, 'inactive');
  5475. }
  5476. }
  5477. }
  5478. },
  5479. connected: function() {
  5480. this.placeholder = $('+ .uk-sticky-placeholder', this.$el) || $('<div class="uk-sticky-placeholder"></div>');
  5481. this.isFixed = false;
  5482. this.isActive = false;
  5483. },
  5484. disconnected: function() {
  5485. if (this.isFixed) {
  5486. this.hide();
  5487. removeClass(this.selTarget, this.clsInactive);
  5488. }
  5489. remove(this.placeholder);
  5490. this.placeholder = null;
  5491. this.widthElement = null;
  5492. },
  5493. events: [
  5494. {
  5495. name: 'load hashchange popstate',
  5496. el: inBrowser && window,
  5497. handler: function() {
  5498. var this$1 = this;
  5499. if (!(this.targetOffset !== false && location.hash && window.pageYOffset > 0)) {
  5500. return;
  5501. }
  5502. var target = $(location.hash);
  5503. if (target) {
  5504. fastdom.read(function () {
  5505. var ref = offset(target);
  5506. var top = ref.top;
  5507. var elTop = offset(this$1.$el).top;
  5508. var elHeight = this$1.$el.offsetHeight;
  5509. if (this$1.isFixed && elTop + elHeight >= top && elTop <= top + target.offsetHeight) {
  5510. scrollTop(window, top - elHeight - (isNumeric(this$1.targetOffset) ? this$1.targetOffset : 0) - this$1.offset);
  5511. }
  5512. });
  5513. }
  5514. }
  5515. }
  5516. ],
  5517. update: [
  5518. {
  5519. read: function(ref, type) {
  5520. var height = ref.height;
  5521. if (this.isActive && type !== 'update') {
  5522. this.hide();
  5523. height = this.$el.offsetHeight;
  5524. this.show();
  5525. }
  5526. height = !this.isActive ? this.$el.offsetHeight : height;
  5527. this.topOffset = offset(this.isFixed ? this.placeholder : this.$el).top;
  5528. this.bottomOffset = this.topOffset + height;
  5529. var bottom = parseProp('bottom', this);
  5530. this.top = Math.max(toFloat(parseProp('top', this)), this.topOffset) - this.offset;
  5531. this.bottom = bottom && bottom - this.$el.offsetHeight;
  5532. this.inactive = !this.matchMedia;
  5533. return {
  5534. lastScroll: false,
  5535. height: height,
  5536. margins: css(this.$el, ['marginTop', 'marginBottom', 'marginLeft', 'marginRight'])
  5537. };
  5538. },
  5539. write: function(ref) {
  5540. var height = ref.height;
  5541. var margins = ref.margins;
  5542. var ref$1 = this;
  5543. var placeholder = ref$1.placeholder;
  5544. css(placeholder, assign({height: height}, margins));
  5545. if (!within(placeholder, document)) {
  5546. after(this.$el, placeholder);
  5547. attr(placeholder, 'hidden', '');
  5548. }
  5549. this.isActive = !!this.isActive; // force self-assign
  5550. },
  5551. events: ['resize']
  5552. },
  5553. {
  5554. read: function(ref) {
  5555. var scroll = ref.scroll; if ( scroll === void 0 ) scroll = 0;
  5556. this.width = offset(isVisible(this.widthElement) ? this.widthElement : this.$el).width;
  5557. this.scroll = window.pageYOffset;
  5558. return {
  5559. dir: scroll <= this.scroll ? 'down' : 'up',
  5560. scroll: this.scroll,
  5561. visible: isVisible(this.$el),
  5562. top: offsetPosition(this.placeholder)[0]
  5563. };
  5564. },
  5565. write: function(data, type) {
  5566. var this$1 = this;
  5567. var initTimestamp = data.initTimestamp; if ( initTimestamp === void 0 ) initTimestamp = 0;
  5568. var dir = data.dir;
  5569. var lastDir = data.lastDir;
  5570. var lastScroll = data.lastScroll;
  5571. var scroll = data.scroll;
  5572. var top = data.top;
  5573. var visible = data.visible;
  5574. var now = performance.now();
  5575. data.lastScroll = scroll;
  5576. if (scroll < 0 || scroll === lastScroll || !visible || this.disabled || this.showOnUp && type !== 'scroll') {
  5577. return;
  5578. }
  5579. if (now - initTimestamp > 300 || dir !== lastDir) {
  5580. data.initScroll = scroll;
  5581. data.initTimestamp = now;
  5582. }
  5583. data.lastDir = dir;
  5584. if (this.showOnUp && !this.isFixed && Math.abs(data.initScroll - scroll) <= 30 && Math.abs(lastScroll - scroll) <= 10) {
  5585. return;
  5586. }
  5587. if (this.inactive
  5588. || scroll < this.top
  5589. || this.showOnUp && (scroll <= this.top || dir === 'down' || dir === 'up' && !this.isFixed && scroll <= this.bottomOffset)
  5590. ) {
  5591. if (!this.isFixed) {
  5592. if (Animation.inProgress(this.$el) && top > scroll) {
  5593. Animation.cancel(this.$el);
  5594. this.hide();
  5595. }
  5596. return;
  5597. }
  5598. this.isFixed = false;
  5599. if (this.animation && scroll > this.topOffset) {
  5600. Animation.cancel(this.$el);
  5601. Animation.out(this.$el, this.animation).then(function () { return this$1.hide(); }, noop);
  5602. } else {
  5603. this.hide();
  5604. }
  5605. } else if (this.isFixed) {
  5606. this.update();
  5607. } else if (this.animation) {
  5608. Animation.cancel(this.$el);
  5609. this.show();
  5610. Animation.in(this.$el, this.animation).catch(noop);
  5611. } else {
  5612. this.show();
  5613. }
  5614. },
  5615. events: ['resize', 'scroll']
  5616. }
  5617. ],
  5618. methods: {
  5619. show: function() {
  5620. this.isFixed = true;
  5621. this.update();
  5622. attr(this.placeholder, 'hidden', null);
  5623. },
  5624. hide: function() {
  5625. this.isActive = false;
  5626. removeClass(this.$el, this.clsFixed, this.clsBelow);
  5627. css(this.$el, {position: '', top: '', width: ''});
  5628. attr(this.placeholder, 'hidden', '');
  5629. },
  5630. update: function() {
  5631. var active = this.top !== 0 || this.scroll > this.top;
  5632. var top = Math.max(0, this.offset);
  5633. if (isNumeric(this.bottom) && this.scroll > this.bottom - this.offset) {
  5634. top = this.bottom - this.scroll;
  5635. }
  5636. css(this.$el, {
  5637. position: 'fixed',
  5638. top: (top + "px"),
  5639. width: this.width
  5640. });
  5641. this.isActive = active;
  5642. toggleClass(this.$el, this.clsBelow, this.scroll > this.bottomOffset);
  5643. addClass(this.$el, this.clsFixed);
  5644. }
  5645. }
  5646. };
  5647. function parseProp(prop, ref) {
  5648. var $props = ref.$props;
  5649. var $el = ref.$el;
  5650. var propOffset = ref[(prop + "Offset")];
  5651. var value = $props[prop];
  5652. if (!value) {
  5653. return;
  5654. }
  5655. if (isString(value) && value.match(/^-?\d/)) {
  5656. return propOffset + toPx(value);
  5657. } else {
  5658. return offset(value === true ? $el.parentNode : query(value, $el)).bottom;
  5659. }
  5660. }
  5661. var Switcher = {
  5662. mixins: [Togglable],
  5663. args: 'connect',
  5664. props: {
  5665. connect: String,
  5666. toggle: String,
  5667. active: Number,
  5668. swiping: Boolean
  5669. },
  5670. data: {
  5671. connect: '~.uk-switcher',
  5672. toggle: '> * > :first-child',
  5673. active: 0,
  5674. swiping: true,
  5675. cls: 'uk-active',
  5676. clsContainer: 'uk-switcher',
  5677. attrItem: 'uk-switcher-item'
  5678. },
  5679. computed: {
  5680. connects: {
  5681. get: function(ref, $el) {
  5682. var connect = ref.connect;
  5683. return queryAll(connect, $el);
  5684. },
  5685. watch: function(connects) {
  5686. var this$1 = this;
  5687. connects.forEach(function (list) { return this$1.updateAria(list.children); });
  5688. if (this.swiping) {
  5689. css(connects, 'touch-action', 'pan-y pinch-zoom');
  5690. }
  5691. },
  5692. immediate: true
  5693. },
  5694. toggles: {
  5695. get: function(ref, $el) {
  5696. var toggle = ref.toggle;
  5697. return $$(toggle, $el).filter(function (el) { return !matches(el, '.uk-disabled *, .uk-disabled, [disabled]'); });
  5698. },
  5699. watch: function(toggles) {
  5700. var active = this.index();
  5701. this.show(~active && active || toggles[this.active] || toggles[0]);
  5702. },
  5703. immediate: true
  5704. },
  5705. children: function() {
  5706. var this$1 = this;
  5707. return children(this.$el).filter(function (child) { return this$1.toggles.some(function (toggle) { return within(toggle, child); }); });
  5708. }
  5709. },
  5710. events: [
  5711. {
  5712. name: 'click',
  5713. delegate: function() {
  5714. return this.toggle;
  5715. },
  5716. handler: function(e) {
  5717. if (!includes(this.toggles, e.current)) {
  5718. return;
  5719. }
  5720. e.preventDefault();
  5721. this.show(e.current);
  5722. }
  5723. },
  5724. {
  5725. name: 'click',
  5726. el: function() {
  5727. return this.connects;
  5728. },
  5729. delegate: function() {
  5730. return ("[" + (this.attrItem) + "],[data-" + (this.attrItem) + "]");
  5731. },
  5732. handler: function(e) {
  5733. e.preventDefault();
  5734. this.show(data(e.current, this.attrItem));
  5735. }
  5736. },
  5737. {
  5738. name: 'swipeRight swipeLeft',
  5739. filter: function() {
  5740. return this.swiping;
  5741. },
  5742. el: function() {
  5743. return this.connects;
  5744. },
  5745. handler: function(ref) {
  5746. var type = ref.type;
  5747. this.show(endsWith(type, 'Left') ? 'next' : 'previous');
  5748. }
  5749. }
  5750. ],
  5751. methods: {
  5752. index: function() {
  5753. var this$1 = this;
  5754. return findIndex(this.children, function (el) { return hasClass(el, this$1.cls); });
  5755. },
  5756. show: function(item) {
  5757. var this$1 = this;
  5758. var prev = this.index();
  5759. var next = getIndex(item, this.toggles, prev);
  5760. this.children.forEach(function (child, i) {
  5761. toggleClass(child, this$1.cls, next === i);
  5762. attr(this$1.toggles[i], 'aria-expanded', next === i);
  5763. });
  5764. this.connects.forEach(function (ref) {
  5765. var children = ref.children;
  5766. return this$1.toggleElement(toNodes(children).filter(function (child, i) { return i !== next && this$1.isToggled(child); }
  5767. ), false, prev >= 0).then(function () { return this$1.toggleElement(children[next], true, prev >= 0); }
  5768. );
  5769. }
  5770. );
  5771. }
  5772. }
  5773. };
  5774. var tab = {
  5775. mixins: [Class],
  5776. extends: Switcher,
  5777. props: {
  5778. media: Boolean
  5779. },
  5780. data: {
  5781. media: 960,
  5782. attrItem: 'uk-tab-item'
  5783. },
  5784. connected: function() {
  5785. var cls = hasClass(this.$el, 'uk-tab-left')
  5786. ? 'uk-tab-left'
  5787. : hasClass(this.$el, 'uk-tab-right')
  5788. ? 'uk-tab-right'
  5789. : false;
  5790. if (cls) {
  5791. this.$create('toggle', this.$el, {cls: cls, mode: 'media', media: this.media});
  5792. }
  5793. }
  5794. };
  5795. var toggle = {
  5796. mixins: [Media, Togglable],
  5797. args: 'target',
  5798. props: {
  5799. href: String,
  5800. target: null,
  5801. mode: 'list',
  5802. queued: Boolean
  5803. },
  5804. data: {
  5805. href: false,
  5806. target: false,
  5807. mode: 'click',
  5808. queued: true
  5809. },
  5810. computed: {
  5811. target: {
  5812. get: function(ref, $el) {
  5813. var href = ref.href;
  5814. var target = ref.target;
  5815. target = queryAll(target || href, $el);
  5816. return target.length && target || [$el];
  5817. },
  5818. watch: function() {
  5819. trigger(this.target, 'updatearia', [this]);
  5820. },
  5821. immediate: true
  5822. }
  5823. },
  5824. events: [
  5825. {
  5826. name: (pointerEnter + " " + pointerLeave),
  5827. filter: function() {
  5828. return includes(this.mode, 'hover');
  5829. },
  5830. handler: function(e) {
  5831. if (!isTouch(e)) {
  5832. this.toggle(("toggle" + (e.type === pointerEnter ? 'show' : 'hide')));
  5833. }
  5834. }
  5835. },
  5836. {
  5837. name: 'click',
  5838. filter: function() {
  5839. return includes(this.mode, 'click') || hasTouch && includes(this.mode, 'hover');
  5840. },
  5841. handler: function(e) {
  5842. // TODO better isToggled handling
  5843. var link;
  5844. if (closest(e.target, 'a[href="#"], a[href=""]')
  5845. || (link = closest(e.target, 'a[href]')) && (
  5846. this.cls && !hasClass(this.target, this.cls.split(' ')[0])
  5847. || !isVisible(this.target)
  5848. || link.hash && matches(this.target, link.hash)
  5849. )
  5850. ) {
  5851. e.preventDefault();
  5852. }
  5853. this.toggle();
  5854. }
  5855. }
  5856. ],
  5857. update: {
  5858. read: function() {
  5859. return includes(this.mode, 'media') && this.media
  5860. ? {match: this.matchMedia}
  5861. : false;
  5862. },
  5863. write: function(ref) {
  5864. var match = ref.match;
  5865. var toggled = this.isToggled(this.target);
  5866. if (match ? !toggled : toggled) {
  5867. this.toggle();
  5868. }
  5869. },
  5870. events: ['resize']
  5871. },
  5872. methods: {
  5873. toggle: function(type) {
  5874. var this$1 = this;
  5875. if (!trigger(this.target, type || 'toggle', [this])) {
  5876. return;
  5877. }
  5878. if (this.queued) {
  5879. var toggled = this.target.filter(this.isToggled);
  5880. this.toggleElement(toggled, false).then(function () { return this$1.toggleElement(this$1.target.filter(function (el) { return !includes(toggled, el); }
  5881. ), true); }
  5882. );
  5883. } else {
  5884. this.toggleElement(this.target);
  5885. }
  5886. }
  5887. }
  5888. };
  5889. var components = /*#__PURE__*/Object.freeze({
  5890. __proto__: null,
  5891. Accordion: Accordion,
  5892. Alert: alert,
  5893. Cover: cover,
  5894. Drop: drop,
  5895. Dropdown: drop,
  5896. FormCustom: formCustom,
  5897. Gif: gif,
  5898. Grid: grid,
  5899. HeightMatch: heightMatch,
  5900. HeightViewport: heightViewport,
  5901. Icon: Icon,
  5902. Img: img,
  5903. Leader: leader,
  5904. Margin: Margin,
  5905. Modal: modal,
  5906. Nav: nav,
  5907. Navbar: navbar,
  5908. Offcanvas: offcanvas,
  5909. OverflowAuto: overflowAuto,
  5910. Responsive: responsive,
  5911. Scroll: scroll,
  5912. Scrollspy: scrollspy,
  5913. ScrollspyNav: scrollspyNav,
  5914. Sticky: sticky,
  5915. Svg: SVG,
  5916. Switcher: Switcher,
  5917. Tab: tab,
  5918. Toggle: toggle,
  5919. Video: Video,
  5920. Close: Close,
  5921. Spinner: Spinner,
  5922. SlidenavNext: Slidenav,
  5923. SlidenavPrevious: Slidenav,
  5924. SearchIcon: Search,
  5925. Marker: IconComponent,
  5926. NavbarToggleIcon: IconComponent,
  5927. OverlayIcon: IconComponent,
  5928. PaginationNext: IconComponent,
  5929. PaginationPrevious: IconComponent,
  5930. Totop: IconComponent
  5931. });
  5932. // register components
  5933. each(components, function (component, name) { return UIkit.component(name, component); }
  5934. );
  5935. // core functionality
  5936. UIkit.use(Core);
  5937. boot(UIkit);
  5938. var countdown = {
  5939. mixins: [Class],
  5940. props: {
  5941. date: String,
  5942. clsWrapper: String
  5943. },
  5944. data: {
  5945. date: '',
  5946. clsWrapper: '.uk-countdown-%unit%'
  5947. },
  5948. computed: {
  5949. date: function(ref) {
  5950. var date = ref.date;
  5951. return Date.parse(date);
  5952. },
  5953. days: function(ref, $el) {
  5954. var clsWrapper = ref.clsWrapper;
  5955. return $(clsWrapper.replace('%unit%', 'days'), $el);
  5956. },
  5957. hours: function(ref, $el) {
  5958. var clsWrapper = ref.clsWrapper;
  5959. return $(clsWrapper.replace('%unit%', 'hours'), $el);
  5960. },
  5961. minutes: function(ref, $el) {
  5962. var clsWrapper = ref.clsWrapper;
  5963. return $(clsWrapper.replace('%unit%', 'minutes'), $el);
  5964. },
  5965. seconds: function(ref, $el) {
  5966. var clsWrapper = ref.clsWrapper;
  5967. return $(clsWrapper.replace('%unit%', 'seconds'), $el);
  5968. },
  5969. units: function() {
  5970. var this$1 = this;
  5971. return ['days', 'hours', 'minutes', 'seconds'].filter(function (unit) { return this$1[unit]; });
  5972. }
  5973. },
  5974. connected: function() {
  5975. this.start();
  5976. },
  5977. disconnected: function() {
  5978. var this$1 = this;
  5979. this.stop();
  5980. this.units.forEach(function (unit) { return empty(this$1[unit]); });
  5981. },
  5982. events: [
  5983. {
  5984. name: 'visibilitychange',
  5985. el: inBrowser && document,
  5986. handler: function() {
  5987. if (document.hidden) {
  5988. this.stop();
  5989. } else {
  5990. this.start();
  5991. }
  5992. }
  5993. }
  5994. ],
  5995. update: {
  5996. write: function() {
  5997. var this$1 = this;
  5998. var timespan = getTimeSpan(this.date);
  5999. if (timespan.total <= 0) {
  6000. this.stop();
  6001. timespan.days
  6002. = timespan.hours
  6003. = timespan.minutes
  6004. = timespan.seconds
  6005. = 0;
  6006. }
  6007. this.units.forEach(function (unit) {
  6008. var digits = String(Math.floor(timespan[unit]));
  6009. digits = digits.length < 2 ? ("0" + digits) : digits;
  6010. var el = this$1[unit];
  6011. if (el.textContent !== digits) {
  6012. digits = digits.split('');
  6013. if (digits.length !== el.children.length) {
  6014. html(el, digits.map(function () { return '<span></span>'; }).join(''));
  6015. }
  6016. digits.forEach(function (digit, i) { return el.children[i].textContent = digit; });
  6017. }
  6018. });
  6019. }
  6020. },
  6021. methods: {
  6022. start: function() {
  6023. this.stop();
  6024. if (this.date && this.units.length) {
  6025. this.$update();
  6026. this.timer = setInterval(this.$update, 1000);
  6027. }
  6028. },
  6029. stop: function() {
  6030. if (this.timer) {
  6031. clearInterval(this.timer);
  6032. this.timer = null;
  6033. }
  6034. }
  6035. }
  6036. };
  6037. function getTimeSpan(date) {
  6038. var total = date - Date.now();
  6039. return {
  6040. total: total,
  6041. seconds: total / 1000 % 60,
  6042. minutes: total / 1000 / 60 % 60,
  6043. hours: total / 1000 / 60 / 60 % 24,
  6044. days: total / 1000 / 60 / 60 / 24
  6045. };
  6046. }
  6047. var targetClass = 'uk-animation-target';
  6048. var Animate = {
  6049. props: {
  6050. animation: Number
  6051. },
  6052. data: {
  6053. animation: 150
  6054. },
  6055. methods: {
  6056. animate: function(action, target) {
  6057. var this$1 = this;
  6058. if ( target === void 0 ) target = this.$el;
  6059. addStyle();
  6060. var children$1 = children(target);
  6061. var propsFrom = children$1.map(function (el) { return getProps(el, true); });
  6062. var oldHeight = height(target);
  6063. var oldScrollY = window.pageYOffset;
  6064. action();
  6065. Transition.cancel(target);
  6066. children$1.forEach(Transition.cancel);
  6067. reset(target);
  6068. this.$update(target, 'resize');
  6069. fastdom.flush();
  6070. var newHeight = height(target);
  6071. children$1 = children$1.concat(children(target).filter(function (el) { return !includes(children$1, el); }));
  6072. var propsTo = children$1.map(function (el, i) { return el.parentNode && i in propsFrom
  6073. ? propsFrom[i]
  6074. ? isVisible(el)
  6075. ? getPositionWithMargin(el)
  6076. : {opacity: 0}
  6077. : {opacity: isVisible(el) ? 1 : 0}
  6078. : false; }
  6079. );
  6080. propsFrom = propsTo.map(function (props, i) {
  6081. var from = children$1[i].parentNode === target
  6082. ? propsFrom[i] || getProps(children$1[i])
  6083. : false;
  6084. if (from) {
  6085. if (!props) {
  6086. delete from.opacity;
  6087. } else if (!('opacity' in props)) {
  6088. var opacity = from.opacity;
  6089. if (opacity % 1) {
  6090. props.opacity = 1;
  6091. } else {
  6092. delete from.opacity;
  6093. }
  6094. }
  6095. }
  6096. return from;
  6097. });
  6098. addClass(target, targetClass);
  6099. children$1.forEach(function (el, i) { return propsFrom[i] && css(el, propsFrom[i]); });
  6100. css(target, {height: oldHeight, display: 'block'});
  6101. scrollTop(window, oldScrollY);
  6102. return Promise.all(
  6103. children$1.map(function (el, i) { return ['top', 'left', 'height', 'width'].some(function (prop) { return propsFrom[i][prop] !== propsTo[i][prop]; }
  6104. ) && Transition.start(el, propsTo[i], this$1.animation, 'ease'); }
  6105. ).concat(oldHeight !== newHeight && Transition.start(target, {height: newHeight}, this.animation, 'ease'))
  6106. ).then(function () {
  6107. children$1.forEach(function (el, i) { return css(el, {display: propsTo[i].opacity === 0 ? 'none' : '', zIndex: ''}); });
  6108. reset(target);
  6109. this$1.$update(target, 'resize');
  6110. fastdom.flush(); // needed for IE11
  6111. }, noop);
  6112. }
  6113. }
  6114. };
  6115. function getProps(el, opacity) {
  6116. var zIndex = css(el, 'zIndex');
  6117. return isVisible(el)
  6118. ? assign({
  6119. display: '',
  6120. opacity: opacity ? css(el, 'opacity') : '0',
  6121. pointerEvents: 'none',
  6122. position: 'absolute',
  6123. zIndex: zIndex === 'auto' ? index(el) : zIndex
  6124. }, getPositionWithMargin(el))
  6125. : false;
  6126. }
  6127. function reset(el) {
  6128. css(el.children, {
  6129. height: '',
  6130. left: '',
  6131. opacity: '',
  6132. pointerEvents: '',
  6133. position: '',
  6134. top: '',
  6135. width: ''
  6136. });
  6137. removeClass(el, targetClass);
  6138. css(el, {height: '', display: ''});
  6139. }
  6140. function getPositionWithMargin(el) {
  6141. var ref = offset(el);
  6142. var height = ref.height;
  6143. var width = ref.width;
  6144. var ref$1 = position(el);
  6145. var top = ref$1.top;
  6146. var left = ref$1.left;
  6147. return {top: top, left: left, height: height, width: width};
  6148. }
  6149. var style;
  6150. function addStyle() {
  6151. if (style) {
  6152. return;
  6153. }
  6154. style = append(document.head, '<style>').sheet;
  6155. style.insertRule(
  6156. ("." + targetClass + " > * {\n margin-top: 0 !important;\n transform: none !important;\n }"), 0
  6157. );
  6158. }
  6159. var filter$1 = {
  6160. mixins: [Animate],
  6161. args: 'target',
  6162. props: {
  6163. target: Boolean,
  6164. selActive: Boolean
  6165. },
  6166. data: {
  6167. target: null,
  6168. selActive: false,
  6169. attrItem: 'uk-filter-control',
  6170. cls: 'uk-active',
  6171. animation: 250
  6172. },
  6173. computed: {
  6174. toggles: {
  6175. get: function(ref, $el) {
  6176. var attrItem = ref.attrItem;
  6177. return $$(("[" + (this.attrItem) + "],[data-" + (this.attrItem) + "]"), $el);
  6178. },
  6179. watch: function() {
  6180. var this$1 = this;
  6181. this.updateState();
  6182. if (this.selActive !== false) {
  6183. var actives = $$(this.selActive, this.$el);
  6184. this.toggles.forEach(function (el) { return toggleClass(el, this$1.cls, includes(actives, el)); });
  6185. }
  6186. },
  6187. immediate: true
  6188. },
  6189. children: {
  6190. get: function(ref, $el) {
  6191. var target = ref.target;
  6192. return $$((target + " > *"), $el);
  6193. },
  6194. watch: function(list, old) {
  6195. if (!isEqualList(list, old)) {
  6196. this.updateState();
  6197. }
  6198. }
  6199. }
  6200. },
  6201. events: [
  6202. {
  6203. name: 'click',
  6204. delegate: function() {
  6205. return ("[" + (this.attrItem) + "],[data-" + (this.attrItem) + "]");
  6206. },
  6207. handler: function(e) {
  6208. e.preventDefault();
  6209. this.apply(e.current);
  6210. }
  6211. }
  6212. ],
  6213. methods: {
  6214. apply: function(el) {
  6215. this.setState(mergeState(el, this.attrItem, this.getState()));
  6216. },
  6217. getState: function() {
  6218. var this$1 = this;
  6219. return this.toggles
  6220. .filter(function (item) { return hasClass(item, this$1.cls); })
  6221. .reduce(function (state, el) { return mergeState(el, this$1.attrItem, state); }, {filter: {'': ''}, sort: []});
  6222. },
  6223. setState: function(state, animate) {
  6224. var this$1 = this;
  6225. if ( animate === void 0 ) animate = true;
  6226. state = assign({filter: {'': ''}, sort: []}, state);
  6227. trigger(this.$el, 'beforeFilter', [this, state]);
  6228. this.toggles.forEach(function (el) { return toggleClass(el, this$1.cls, !!matchFilter(el, this$1.attrItem, state)); });
  6229. Promise.all($$(this.target, this.$el).map(function (target) {
  6230. var children$1 = children(target);
  6231. return animate
  6232. ? this$1.animate(function () { return applyState(state, target, children$1); }, target)
  6233. : applyState(state, target, children$1);
  6234. })).then(function () { return trigger(this$1.$el, 'afterFilter', [this$1]); });
  6235. },
  6236. updateState: function() {
  6237. var this$1 = this;
  6238. fastdom.write(function () { return this$1.setState(this$1.getState(), false); });
  6239. }
  6240. }
  6241. };
  6242. function getFilter(el, attr) {
  6243. return parseOptions(data(el, attr), ['filter']);
  6244. }
  6245. function applyState(state, target, children) {
  6246. var selector = getSelector(state);
  6247. children.forEach(function (el) { return css(el, 'display', selector && !matches(el, selector) ? 'none' : ''); });
  6248. var ref = state.sort;
  6249. var sort = ref[0];
  6250. var order = ref[1];
  6251. if (sort) {
  6252. var sorted = sortItems(children, sort, order);
  6253. if (!isEqual(sorted, children)) {
  6254. append(target, sorted);
  6255. }
  6256. }
  6257. }
  6258. function mergeState(el, attr, state) {
  6259. var filterBy = getFilter(el, attr);
  6260. var filter = filterBy.filter;
  6261. var group = filterBy.group;
  6262. var sort = filterBy.sort;
  6263. var order = filterBy.order; if ( order === void 0 ) order = 'asc';
  6264. if (filter || isUndefined(sort)) {
  6265. if (group) {
  6266. if (filter) {
  6267. delete state.filter[''];
  6268. state.filter[group] = filter;
  6269. } else {
  6270. delete state.filter[group];
  6271. if (isEmpty(state.filter) || '' in state.filter) {
  6272. state.filter = {'': filter || ''};
  6273. }
  6274. }
  6275. } else {
  6276. state.filter = {'': filter || ''};
  6277. }
  6278. }
  6279. if (!isUndefined(sort)) {
  6280. state.sort = [sort, order];
  6281. }
  6282. return state;
  6283. }
  6284. function matchFilter(el, attr, ref) {
  6285. var stateFilter = ref.filter; if ( stateFilter === void 0 ) stateFilter = {'': ''};
  6286. var ref_sort = ref.sort;
  6287. var stateSort = ref_sort[0];
  6288. var stateOrder = ref_sort[1];
  6289. var ref$1 = getFilter(el, attr);
  6290. var filter = ref$1.filter; if ( filter === void 0 ) filter = '';
  6291. var group = ref$1.group; if ( group === void 0 ) group = '';
  6292. var sort = ref$1.sort;
  6293. var order = ref$1.order; if ( order === void 0 ) order = 'asc';
  6294. return isUndefined(sort)
  6295. ? group in stateFilter && filter === stateFilter[group]
  6296. || !filter && group && !(group in stateFilter) && !stateFilter['']
  6297. : stateSort === sort && stateOrder === order;
  6298. }
  6299. function isEqualList(listA, listB) {
  6300. return listA.length === listB.length
  6301. && listA.every(function (el) { return ~listB.indexOf(el); });
  6302. }
  6303. function getSelector(ref) {
  6304. var filter = ref.filter;
  6305. var selector = '';
  6306. each(filter, function (value) { return selector += value || ''; });
  6307. return selector;
  6308. }
  6309. function sortItems(nodes, sort, order) {
  6310. return assign([], nodes).sort(function (a, b) { return data(a, sort).localeCompare(data(b, sort), undefined, {numeric: true}) * (order === 'asc' || -1); });
  6311. }
  6312. var Animations = {
  6313. slide: {
  6314. show: function(dir) {
  6315. return [
  6316. {transform: translate(dir * -100)},
  6317. {transform: translate()}
  6318. ];
  6319. },
  6320. percent: function(current) {
  6321. return translated(current);
  6322. },
  6323. translate: function(percent, dir) {
  6324. return [
  6325. {transform: translate(dir * -100 * percent)},
  6326. {transform: translate(dir * 100 * (1 - percent))}
  6327. ];
  6328. }
  6329. }
  6330. };
  6331. function translated(el) {
  6332. return Math.abs(css(el, 'transform').split(',')[4] / el.offsetWidth) || 0;
  6333. }
  6334. function translate(value, unit) {
  6335. if ( value === void 0 ) value = 0;
  6336. if ( unit === void 0 ) unit = '%';
  6337. value += value ? unit : '';
  6338. return isIE ? ("translateX(" + value + ")") : ("translate3d(" + value + ", 0, 0)"); // currently not translate3d in IE, translate3d within translate3d does not work while transitioning
  6339. }
  6340. function scale3d(value) {
  6341. return ("scale3d(" + value + ", " + value + ", 1)");
  6342. }
  6343. var Animations$1 = assign({}, Animations, {
  6344. fade: {
  6345. show: function() {
  6346. return [
  6347. {opacity: 0},
  6348. {opacity: 1}
  6349. ];
  6350. },
  6351. percent: function(current) {
  6352. return 1 - css(current, 'opacity');
  6353. },
  6354. translate: function(percent) {
  6355. return [
  6356. {opacity: 1 - percent},
  6357. {opacity: percent}
  6358. ];
  6359. }
  6360. },
  6361. scale: {
  6362. show: function() {
  6363. return [
  6364. {opacity: 0, transform: scale3d(1 - .2)},
  6365. {opacity: 1, transform: scale3d(1)}
  6366. ];
  6367. },
  6368. percent: function(current) {
  6369. return 1 - css(current, 'opacity');
  6370. },
  6371. translate: function(percent) {
  6372. return [
  6373. {opacity: 1 - percent, transform: scale3d(1 - .2 * percent)},
  6374. {opacity: percent, transform: scale3d(1 - .2 + .2 * percent)}
  6375. ];
  6376. }
  6377. }
  6378. });
  6379. function Transitioner(prev, next, dir, ref) {
  6380. var animation = ref.animation;
  6381. var easing = ref.easing;
  6382. var percent = animation.percent;
  6383. var translate = animation.translate;
  6384. var show = animation.show; if ( show === void 0 ) show = noop;
  6385. var props = show(dir);
  6386. var deferred = new Deferred();
  6387. return {
  6388. dir: dir,
  6389. show: function(duration, percent, linear) {
  6390. var this$1 = this;
  6391. if ( percent === void 0 ) percent = 0;
  6392. var timing = linear ? 'linear' : easing;
  6393. duration -= Math.round(duration * clamp(percent, -1, 1));
  6394. this.translate(percent);
  6395. triggerUpdate(next, 'itemin', {percent: percent, duration: duration, timing: timing, dir: dir});
  6396. triggerUpdate(prev, 'itemout', {percent: 1 - percent, duration: duration, timing: timing, dir: dir});
  6397. Promise.all([
  6398. Transition.start(next, props[1], duration, timing),
  6399. Transition.start(prev, props[0], duration, timing)
  6400. ]).then(function () {
  6401. this$1.reset();
  6402. deferred.resolve();
  6403. }, noop);
  6404. return deferred.promise;
  6405. },
  6406. stop: function() {
  6407. return Transition.stop([next, prev]);
  6408. },
  6409. cancel: function() {
  6410. Transition.cancel([next, prev]);
  6411. },
  6412. reset: function() {
  6413. for (var prop in props[0]) {
  6414. css([next, prev], prop, '');
  6415. }
  6416. },
  6417. forward: function(duration, percent) {
  6418. if ( percent === void 0 ) percent = this.percent();
  6419. Transition.cancel([next, prev]);
  6420. return this.show(duration, percent, true);
  6421. },
  6422. translate: function(percent) {
  6423. this.reset();
  6424. var props = translate(percent, dir);
  6425. css(next, props[1]);
  6426. css(prev, props[0]);
  6427. triggerUpdate(next, 'itemtranslatein', {percent: percent, dir: dir});
  6428. triggerUpdate(prev, 'itemtranslateout', {percent: 1 - percent, dir: dir});
  6429. },
  6430. percent: function() {
  6431. return percent(prev || next, next, dir);
  6432. },
  6433. getDistance: function() {
  6434. return prev && prev.offsetWidth;
  6435. }
  6436. };
  6437. }
  6438. function triggerUpdate(el, type, data) {
  6439. trigger(el, createEvent(type, false, false, data));
  6440. }
  6441. var SliderAutoplay = {
  6442. props: {
  6443. autoplay: Boolean,
  6444. autoplayInterval: Number,
  6445. pauseOnHover: Boolean
  6446. },
  6447. data: {
  6448. autoplay: false,
  6449. autoplayInterval: 7000,
  6450. pauseOnHover: true
  6451. },
  6452. connected: function() {
  6453. this.autoplay && this.startAutoplay();
  6454. },
  6455. disconnected: function() {
  6456. this.stopAutoplay();
  6457. },
  6458. update: function() {
  6459. attr(this.slides, 'tabindex', '-1');
  6460. },
  6461. events: [
  6462. {
  6463. name: 'visibilitychange',
  6464. el: inBrowser && document,
  6465. filter: function() {
  6466. return this.autoplay;
  6467. },
  6468. handler: function() {
  6469. if (document.hidden) {
  6470. this.stopAutoplay();
  6471. } else {
  6472. this.startAutoplay();
  6473. }
  6474. }
  6475. }
  6476. ],
  6477. methods: {
  6478. startAutoplay: function() {
  6479. var this$1 = this;
  6480. this.stopAutoplay();
  6481. this.interval = setInterval(
  6482. function () { return (!this$1.draggable || !$(':focus', this$1.$el))
  6483. && (!this$1.pauseOnHover || !matches(this$1.$el, ':hover'))
  6484. && !this$1.stack.length
  6485. && this$1.show('next'); },
  6486. this.autoplayInterval
  6487. );
  6488. },
  6489. stopAutoplay: function() {
  6490. this.interval && clearInterval(this.interval);
  6491. }
  6492. }
  6493. };
  6494. var SliderDrag = {
  6495. props: {
  6496. draggable: Boolean
  6497. },
  6498. data: {
  6499. draggable: true,
  6500. threshold: 10
  6501. },
  6502. created: function() {
  6503. var this$1 = this;
  6504. ['start', 'move', 'end'].forEach(function (key) {
  6505. var fn = this$1[key];
  6506. this$1[key] = function (e) {
  6507. var pos = getEventPos(e).x * (isRtl ? -1 : 1);
  6508. this$1.prevPos = pos !== this$1.pos ? this$1.pos : this$1.prevPos;
  6509. this$1.pos = pos;
  6510. fn(e);
  6511. };
  6512. });
  6513. },
  6514. events: [
  6515. {
  6516. name: pointerDown,
  6517. delegate: function() {
  6518. return this.selSlides;
  6519. },
  6520. handler: function(e) {
  6521. if (!this.draggable
  6522. || !isTouch(e) && hasTextNodesOnly(e.target)
  6523. || closest(e.target, selInput)
  6524. || e.button > 0
  6525. || this.length < 2
  6526. ) {
  6527. return;
  6528. }
  6529. this.start(e);
  6530. }
  6531. },
  6532. {
  6533. // Workaround for iOS 11 bug: https://bugs.webkit.org/show_bug.cgi?id=184250
  6534. name: 'touchmove',
  6535. passive: false,
  6536. handler: 'move',
  6537. filter: function() {
  6538. return pointerMove === 'touchmove';
  6539. },
  6540. delegate: function() {
  6541. return this.selSlides;
  6542. }
  6543. },
  6544. {
  6545. name: 'dragstart',
  6546. handler: function(e) {
  6547. e.preventDefault();
  6548. }
  6549. }
  6550. ],
  6551. methods: {
  6552. start: function() {
  6553. var this$1 = this;
  6554. this.drag = this.pos;
  6555. if (this._transitioner) {
  6556. this.percent = this._transitioner.percent();
  6557. this.drag += this._transitioner.getDistance() * this.percent * this.dir;
  6558. this._transitioner.cancel();
  6559. this._transitioner.translate(this.percent);
  6560. this.dragging = true;
  6561. this.stack = [];
  6562. } else {
  6563. this.prevIndex = this.index;
  6564. }
  6565. // See above workaround notice
  6566. var off = pointerMove !== 'touchmove'
  6567. ? on(document, pointerMove, this.move, {passive: false})
  6568. : noop;
  6569. this.unbindMove = function () {
  6570. off();
  6571. this$1.unbindMove = null;
  6572. };
  6573. on(window, 'scroll', this.unbindMove);
  6574. on(window.visualViewport, 'resize', this.unbindMove);
  6575. on(document, (pointerUp + " " + pointerCancel), this.end, true);
  6576. css(this.list, 'userSelect', 'none');
  6577. },
  6578. move: function(e) {
  6579. var this$1 = this;
  6580. // See above workaround notice
  6581. if (!this.unbindMove) {
  6582. return;
  6583. }
  6584. var distance = this.pos - this.drag;
  6585. if (distance === 0 || this.prevPos === this.pos || !this.dragging && Math.abs(distance) < this.threshold) {
  6586. return;
  6587. }
  6588. css(this.list, 'pointerEvents', 'none');
  6589. e.cancelable && e.preventDefault();
  6590. this.dragging = true;
  6591. this.dir = (distance < 0 ? 1 : -1);
  6592. var ref = this;
  6593. var slides = ref.slides;
  6594. var ref$1 = this;
  6595. var prevIndex = ref$1.prevIndex;
  6596. var dis = Math.abs(distance);
  6597. var nextIndex = this.getIndex(prevIndex + this.dir, prevIndex);
  6598. var width = this._getDistance(prevIndex, nextIndex) || slides[prevIndex].offsetWidth;
  6599. while (nextIndex !== prevIndex && dis > width) {
  6600. this.drag -= width * this.dir;
  6601. prevIndex = nextIndex;
  6602. dis -= width;
  6603. nextIndex = this.getIndex(prevIndex + this.dir, prevIndex);
  6604. width = this._getDistance(prevIndex, nextIndex) || slides[prevIndex].offsetWidth;
  6605. }
  6606. this.percent = dis / width;
  6607. var prev = slides[prevIndex];
  6608. var next = slides[nextIndex];
  6609. var changed = this.index !== nextIndex;
  6610. var edge = prevIndex === nextIndex;
  6611. var itemShown;
  6612. [this.index, this.prevIndex].filter(function (i) { return !includes([nextIndex, prevIndex], i); }).forEach(function (i) {
  6613. trigger(slides[i], 'itemhidden', [this$1]);
  6614. if (edge) {
  6615. itemShown = true;
  6616. this$1.prevIndex = prevIndex;
  6617. }
  6618. });
  6619. if (this.index === prevIndex && this.prevIndex !== prevIndex || itemShown) {
  6620. trigger(slides[this.index], 'itemshown', [this]);
  6621. }
  6622. if (changed) {
  6623. this.prevIndex = prevIndex;
  6624. this.index = nextIndex;
  6625. !edge && trigger(prev, 'beforeitemhide', [this]);
  6626. trigger(next, 'beforeitemshow', [this]);
  6627. }
  6628. this._transitioner = this._translate(Math.abs(this.percent), prev, !edge && next);
  6629. if (changed) {
  6630. !edge && trigger(prev, 'itemhide', [this]);
  6631. trigger(next, 'itemshow', [this]);
  6632. }
  6633. },
  6634. end: function() {
  6635. off(window, 'scroll', this.unbindMove);
  6636. off(window.visualViewport, 'resize', this.unbindMove);
  6637. this.unbindMove && this.unbindMove();
  6638. off(document, pointerUp, this.end, true);
  6639. if (this.dragging) {
  6640. this.dragging = null;
  6641. if (this.index === this.prevIndex) {
  6642. this.percent = 1 - this.percent;
  6643. this.dir *= -1;
  6644. this._show(false, this.index, true);
  6645. this._transitioner = null;
  6646. } else {
  6647. var dirChange = (isRtl ? this.dir * (isRtl ? 1 : -1) : this.dir) < 0 === this.prevPos > this.pos;
  6648. this.index = dirChange ? this.index : this.prevIndex;
  6649. if (dirChange) {
  6650. this.percent = 1 - this.percent;
  6651. }
  6652. this.show(this.dir > 0 && !dirChange || this.dir < 0 && dirChange ? 'next' : 'previous', true);
  6653. }
  6654. }
  6655. css(this.list, {userSelect: '', pointerEvents: ''});
  6656. this.drag
  6657. = this.percent
  6658. = null;
  6659. }
  6660. }
  6661. };
  6662. function hasTextNodesOnly(el) {
  6663. return !el.children.length && el.childNodes.length;
  6664. }
  6665. var SliderNav = {
  6666. data: {
  6667. selNav: false
  6668. },
  6669. computed: {
  6670. nav: function(ref, $el) {
  6671. var selNav = ref.selNav;
  6672. return $(selNav, $el);
  6673. },
  6674. selNavItem: function(ref) {
  6675. var attrItem = ref.attrItem;
  6676. return ("[" + attrItem + "],[data-" + attrItem + "]");
  6677. },
  6678. navItems: function(_, $el) {
  6679. return $$(this.selNavItem, $el);
  6680. }
  6681. },
  6682. update: {
  6683. write: function() {
  6684. var this$1 = this;
  6685. if (this.nav && this.length !== this.nav.children.length) {
  6686. html(this.nav, this.slides.map(function (_, i) { return ("<li " + (this$1.attrItem) + "=\"" + i + "\"><a href></a></li>"); }).join(''));
  6687. }
  6688. toggleClass($$(this.selNavItem, this.$el).concat(this.nav), 'uk-hidden', !this.maxIndex);
  6689. this.updateNav();
  6690. },
  6691. events: ['resize']
  6692. },
  6693. events: [
  6694. {
  6695. name: 'click',
  6696. delegate: function() {
  6697. return this.selNavItem;
  6698. },
  6699. handler: function(e) {
  6700. e.preventDefault();
  6701. this.show(data(e.current, this.attrItem));
  6702. }
  6703. },
  6704. {
  6705. name: 'itemshow',
  6706. handler: 'updateNav'
  6707. }
  6708. ],
  6709. methods: {
  6710. updateNav: function() {
  6711. var this$1 = this;
  6712. var i = this.getValidIndex();
  6713. this.navItems.forEach(function (el) {
  6714. var cmd = data(el, this$1.attrItem);
  6715. toggleClass(el, this$1.clsActive, toNumber(cmd) === i);
  6716. toggleClass(el, 'uk-invisible', this$1.finite && (cmd === 'previous' && i === 0 || cmd === 'next' && i >= this$1.maxIndex));
  6717. });
  6718. }
  6719. }
  6720. };
  6721. var Slider = {
  6722. mixins: [SliderAutoplay, SliderDrag, SliderNav],
  6723. props: {
  6724. clsActivated: Boolean,
  6725. easing: String,
  6726. index: Number,
  6727. finite: Boolean,
  6728. velocity: Number,
  6729. selSlides: String
  6730. },
  6731. data: function () { return ({
  6732. easing: 'ease',
  6733. finite: false,
  6734. velocity: 1,
  6735. index: 0,
  6736. prevIndex: -1,
  6737. stack: [],
  6738. percent: 0,
  6739. clsActive: 'uk-active',
  6740. clsActivated: false,
  6741. Transitioner: false,
  6742. transitionOptions: {}
  6743. }); },
  6744. connected: function() {
  6745. this.prevIndex = -1;
  6746. this.index = this.getValidIndex(this.index);
  6747. this.stack = [];
  6748. },
  6749. disconnected: function() {
  6750. removeClass(this.slides, this.clsActive);
  6751. },
  6752. computed: {
  6753. duration: function(ref, $el) {
  6754. var velocity = ref.velocity;
  6755. return speedUp($el.offsetWidth / velocity);
  6756. },
  6757. list: function(ref, $el) {
  6758. var selList = ref.selList;
  6759. return $(selList, $el);
  6760. },
  6761. maxIndex: function() {
  6762. return this.length - 1;
  6763. },
  6764. selSlides: function(ref) {
  6765. var selList = ref.selList;
  6766. var selSlides = ref.selSlides;
  6767. return (selList + " " + (selSlides || '> *'));
  6768. },
  6769. slides: {
  6770. get: function() {
  6771. return $$(this.selSlides, this.$el);
  6772. },
  6773. watch: function() {
  6774. this.$reset();
  6775. }
  6776. },
  6777. length: function() {
  6778. return this.slides.length;
  6779. }
  6780. },
  6781. events: {
  6782. itemshown: function() {
  6783. this.$update(this.list);
  6784. }
  6785. },
  6786. methods: {
  6787. show: function(index, force) {
  6788. var this$1 = this;
  6789. if ( force === void 0 ) force = false;
  6790. if (this.dragging || !this.length) {
  6791. return;
  6792. }
  6793. var ref = this;
  6794. var stack = ref.stack;
  6795. var queueIndex = force ? 0 : stack.length;
  6796. var reset = function () {
  6797. stack.splice(queueIndex, 1);
  6798. if (stack.length) {
  6799. this$1.show(stack.shift(), true);
  6800. }
  6801. };
  6802. stack[force ? 'unshift' : 'push'](index);
  6803. if (!force && stack.length > 1) {
  6804. if (stack.length === 2) {
  6805. this._transitioner.forward(Math.min(this.duration, 200));
  6806. }
  6807. return;
  6808. }
  6809. var prevIndex = this.getIndex(this.index);
  6810. var prev = hasClass(this.slides, this.clsActive) && this.slides[prevIndex];
  6811. var nextIndex = this.getIndex(index, this.index);
  6812. var next = this.slides[nextIndex];
  6813. if (prev === next) {
  6814. reset();
  6815. return;
  6816. }
  6817. this.dir = getDirection(index, prevIndex);
  6818. this.prevIndex = prevIndex;
  6819. this.index = nextIndex;
  6820. if (prev && !trigger(prev, 'beforeitemhide', [this])
  6821. || !trigger(next, 'beforeitemshow', [this, prev])
  6822. ) {
  6823. this.index = this.prevIndex;
  6824. reset();
  6825. return;
  6826. }
  6827. var promise = this._show(prev, next, force).then(function () {
  6828. prev && trigger(prev, 'itemhidden', [this$1]);
  6829. trigger(next, 'itemshown', [this$1]);
  6830. return new Promise(function (resolve) {
  6831. fastdom.write(function () {
  6832. stack.shift();
  6833. if (stack.length) {
  6834. this$1.show(stack.shift(), true);
  6835. } else {
  6836. this$1._transitioner = null;
  6837. }
  6838. resolve();
  6839. });
  6840. });
  6841. });
  6842. prev && trigger(prev, 'itemhide', [this]);
  6843. trigger(next, 'itemshow', [this]);
  6844. return promise;
  6845. },
  6846. getIndex: function(index, prev) {
  6847. if ( index === void 0 ) index = this.index;
  6848. if ( prev === void 0 ) prev = this.index;
  6849. return clamp(getIndex(index, this.slides, prev, this.finite), 0, this.maxIndex);
  6850. },
  6851. getValidIndex: function(index, prevIndex) {
  6852. if ( index === void 0 ) index = this.index;
  6853. if ( prevIndex === void 0 ) prevIndex = this.prevIndex;
  6854. return this.getIndex(index, prevIndex);
  6855. },
  6856. _show: function(prev, next, force) {
  6857. this._transitioner = this._getTransitioner(
  6858. prev,
  6859. next,
  6860. this.dir,
  6861. assign({
  6862. easing: force
  6863. ? next.offsetWidth < 600
  6864. ? 'cubic-bezier(0.25, 0.46, 0.45, 0.94)' /* easeOutQuad */
  6865. : 'cubic-bezier(0.165, 0.84, 0.44, 1)' /* easeOutQuart */
  6866. : this.easing
  6867. }, this.transitionOptions)
  6868. );
  6869. if (!force && !prev) {
  6870. this._translate(1);
  6871. return Promise.resolve();
  6872. }
  6873. var ref = this.stack;
  6874. var length = ref.length;
  6875. return this._transitioner[length > 1 ? 'forward' : 'show'](length > 1 ? Math.min(this.duration, 75 + 75 / (length - 1)) : this.duration, this.percent);
  6876. },
  6877. _getDistance: function(prev, next) {
  6878. return this._getTransitioner(prev, prev !== next && next).getDistance();
  6879. },
  6880. _translate: function(percent, prev, next) {
  6881. if ( prev === void 0 ) prev = this.prevIndex;
  6882. if ( next === void 0 ) next = this.index;
  6883. var transitioner = this._getTransitioner(prev !== next ? prev : false, next);
  6884. transitioner.translate(percent);
  6885. return transitioner;
  6886. },
  6887. _getTransitioner: function(prev, next, dir, options) {
  6888. if ( prev === void 0 ) prev = this.prevIndex;
  6889. if ( next === void 0 ) next = this.index;
  6890. if ( dir === void 0 ) dir = this.dir || 1;
  6891. if ( options === void 0 ) options = this.transitionOptions;
  6892. return new this.Transitioner(
  6893. isNumber(prev) ? this.slides[prev] : prev,
  6894. isNumber(next) ? this.slides[next] : next,
  6895. dir * (isRtl ? -1 : 1),
  6896. options
  6897. );
  6898. }
  6899. }
  6900. };
  6901. function getDirection(index, prevIndex) {
  6902. return index === 'next'
  6903. ? 1
  6904. : index === 'previous'
  6905. ? -1
  6906. : index < prevIndex
  6907. ? -1
  6908. : 1;
  6909. }
  6910. function speedUp(x) {
  6911. return .5 * x + 300; // parabola through (400,500; 600,600; 1800,1200)
  6912. }
  6913. var Slideshow = {
  6914. mixins: [Slider],
  6915. props: {
  6916. animation: String
  6917. },
  6918. data: {
  6919. animation: 'slide',
  6920. clsActivated: 'uk-transition-active',
  6921. Animations: Animations,
  6922. Transitioner: Transitioner
  6923. },
  6924. computed: {
  6925. animation: function(ref) {
  6926. var animation = ref.animation;
  6927. var Animations = ref.Animations;
  6928. return assign(Animations[animation] || Animations.slide, {name: animation});
  6929. },
  6930. transitionOptions: function() {
  6931. return {animation: this.animation};
  6932. }
  6933. },
  6934. events: {
  6935. 'itemshow itemhide itemshown itemhidden': function(ref) {
  6936. var target = ref.target;
  6937. this.$update(target);
  6938. },
  6939. beforeitemshow: function(ref) {
  6940. var target = ref.target;
  6941. addClass(target, this.clsActive);
  6942. },
  6943. itemshown: function(ref) {
  6944. var target = ref.target;
  6945. addClass(target, this.clsActivated);
  6946. },
  6947. itemhidden: function(ref) {
  6948. var target = ref.target;
  6949. removeClass(target, this.clsActive, this.clsActivated);
  6950. }
  6951. }
  6952. };
  6953. var LightboxPanel = {
  6954. mixins: [Container, Modal, Togglable, Slideshow],
  6955. functional: true,
  6956. props: {
  6957. delayControls: Number,
  6958. preload: Number,
  6959. videoAutoplay: Boolean,
  6960. template: String
  6961. },
  6962. data: function () { return ({
  6963. preload: 1,
  6964. videoAutoplay: false,
  6965. delayControls: 3000,
  6966. items: [],
  6967. cls: 'uk-open',
  6968. clsPage: 'uk-lightbox-page',
  6969. selList: '.uk-lightbox-items',
  6970. attrItem: 'uk-lightbox-item',
  6971. selClose: '.uk-close-large',
  6972. selCaption: '.uk-lightbox-caption',
  6973. pauseOnHover: false,
  6974. velocity: 2,
  6975. Animations: Animations$1,
  6976. template: "<div class=\"uk-lightbox uk-overflow-hidden\"> <ul class=\"uk-lightbox-items\"></ul> <div class=\"uk-lightbox-toolbar uk-position-top uk-text-right uk-transition-slide-top uk-transition-opaque\"> <button class=\"uk-lightbox-toolbar-icon uk-close-large\" type=\"button\" uk-close></button> </div> <a class=\"uk-lightbox-button uk-position-center-left uk-position-medium uk-transition-fade\" href uk-slidenav-previous uk-lightbox-item=\"previous\"></a> <a class=\"uk-lightbox-button uk-position-center-right uk-position-medium uk-transition-fade\" href uk-slidenav-next uk-lightbox-item=\"next\"></a> <div class=\"uk-lightbox-toolbar uk-lightbox-caption uk-position-bottom uk-text-center uk-transition-slide-bottom uk-transition-opaque\"></div> </div>"
  6977. }); },
  6978. created: function() {
  6979. var $el = $(this.template);
  6980. var list = $(this.selList, $el);
  6981. this.items.forEach(function () { return append(list, '<li>'); });
  6982. this.$mount(append(this.container, $el));
  6983. },
  6984. computed: {
  6985. caption: function(ref, $el) {
  6986. var selCaption = ref.selCaption;
  6987. return $('.uk-lightbox-caption', $el);
  6988. }
  6989. },
  6990. events: [
  6991. {
  6992. name: (pointerMove + " " + pointerDown + " keydown"),
  6993. handler: 'showControls'
  6994. },
  6995. {
  6996. name: 'click',
  6997. self: true,
  6998. delegate: function() {
  6999. return this.selSlides;
  7000. },
  7001. handler: function(e) {
  7002. if (e.defaultPrevented) {
  7003. return;
  7004. }
  7005. this.hide();
  7006. }
  7007. },
  7008. {
  7009. name: 'shown',
  7010. self: true,
  7011. handler: function() {
  7012. this.showControls();
  7013. }
  7014. },
  7015. {
  7016. name: 'hide',
  7017. self: true,
  7018. handler: function() {
  7019. this.hideControls();
  7020. removeClass(this.slides, this.clsActive);
  7021. Transition.stop(this.slides);
  7022. }
  7023. },
  7024. {
  7025. name: 'hidden',
  7026. self: true,
  7027. handler: function() {
  7028. this.$destroy(true);
  7029. }
  7030. },
  7031. {
  7032. name: 'keyup',
  7033. el: inBrowser && document,
  7034. handler: function(e) {
  7035. if (!this.isToggled(this.$el) || !this.draggable) {
  7036. return;
  7037. }
  7038. switch (e.keyCode) {
  7039. case 37:
  7040. this.show('previous');
  7041. break;
  7042. case 39:
  7043. this.show('next');
  7044. break;
  7045. }
  7046. }
  7047. },
  7048. {
  7049. name: 'beforeitemshow',
  7050. handler: function(e) {
  7051. if (this.isToggled()) {
  7052. return;
  7053. }
  7054. this.draggable = false;
  7055. e.preventDefault();
  7056. this.toggleElement(this.$el, true, false);
  7057. this.animation = Animations$1['scale'];
  7058. removeClass(e.target, this.clsActive);
  7059. this.stack.splice(1, 0, this.index);
  7060. }
  7061. },
  7062. {
  7063. name: 'itemshow',
  7064. handler: function() {
  7065. html(this.caption, this.getItem().caption || '');
  7066. for (var j = -this.preload; j <= this.preload; j++) {
  7067. this.loadItem(this.index + j);
  7068. }
  7069. }
  7070. },
  7071. {
  7072. name: 'itemshown',
  7073. handler: function() {
  7074. this.draggable = this.$props.draggable;
  7075. }
  7076. },
  7077. {
  7078. name: 'itemload',
  7079. handler: function(_, item) {
  7080. var this$1 = this;
  7081. var src = item.source;
  7082. var type = item.type;
  7083. var alt = item.alt; if ( alt === void 0 ) alt = '';
  7084. var poster = item.poster;
  7085. var attrs = item.attrs; if ( attrs === void 0 ) attrs = {};
  7086. this.setItem(item, '<span uk-spinner></span>');
  7087. if (!src) {
  7088. return;
  7089. }
  7090. var matches;
  7091. var iframeAttrs = {
  7092. frameborder: '0',
  7093. allow: 'autoplay',
  7094. allowfullscreen: '',
  7095. style: 'max-width: 100%; box-sizing: border-box;',
  7096. 'uk-responsive': '',
  7097. 'uk-video': ("" + (this.videoAutoplay))
  7098. };
  7099. // Image
  7100. if (type === 'image' || src.match(/\.(jpe?g|png|gif|svg|webp)($|\?)/i)) {
  7101. getImage(src, attrs.srcset, attrs.size).then(
  7102. function (ref) {
  7103. var width = ref.width;
  7104. var height = ref.height;
  7105. return this$1.setItem(item, createEl('img', assign({src: src, width: width, height: height, alt: alt}, attrs)));
  7106. },
  7107. function () { return this$1.setError(item); }
  7108. );
  7109. // Video
  7110. } else if (type === 'video' || src.match(/\.(mp4|webm|ogv)($|\?)/i)) {
  7111. var video = createEl('video', assign({
  7112. src: src,
  7113. poster: poster,
  7114. controls: '',
  7115. playsinline: '',
  7116. 'uk-video': ("" + (this.videoAutoplay))
  7117. }, attrs));
  7118. on(video, 'loadedmetadata', function () {
  7119. attr(video, {width: video.videoWidth, height: video.videoHeight});
  7120. this$1.setItem(item, video);
  7121. });
  7122. on(video, 'error', function () { return this$1.setError(item); });
  7123. // Iframe
  7124. } else if (type === 'iframe' || src.match(/\.(html|php)($|\?)/i)) {
  7125. this.setItem(item, createEl('iframe', assign({
  7126. src: src,
  7127. frameborder: '0',
  7128. allowfullscreen: '',
  7129. class: 'uk-lightbox-iframe'
  7130. }, attrs)));
  7131. // YouTube
  7132. } else if ((matches = src.match(/\/\/(?:.*?youtube(-nocookie)?\..*?[?&]v=|youtu\.be\/)([\w-]{11})[&?]?(.*)?/))) {
  7133. this.setItem(item, createEl('iframe', assign({
  7134. src: ("https://www.youtube" + (matches[1] || '') + ".com/embed/" + (matches[2]) + (matches[3] ? ("?" + (matches[3])) : '')),
  7135. width: 1920,
  7136. height: 1080
  7137. }, iframeAttrs, attrs)));
  7138. // Vimeo
  7139. } else if ((matches = src.match(/\/\/.*?vimeo\.[a-z]+\/(\d+)[&?]?(.*)?/))) {
  7140. ajax(("https://vimeo.com/api/oembed.json?maxwidth=1920&url=" + (encodeURI(src))), {
  7141. responseType: 'json',
  7142. withCredentials: false
  7143. }).then(
  7144. function (ref) {
  7145. var ref_response = ref.response;
  7146. var height = ref_response.height;
  7147. var width = ref_response.width;
  7148. return this$1.setItem(item, createEl('iframe', assign({
  7149. src: ("https://player.vimeo.com/video/" + (matches[1]) + (matches[2] ? ("?" + (matches[2])) : '')),
  7150. width: width,
  7151. height: height
  7152. }, iframeAttrs, attrs)));
  7153. },
  7154. function () { return this$1.setError(item); }
  7155. );
  7156. }
  7157. }
  7158. }
  7159. ],
  7160. methods: {
  7161. loadItem: function(index) {
  7162. if ( index === void 0 ) index = this.index;
  7163. var item = this.getItem(index);
  7164. if (!this.getSlide(item).childElementCount) {
  7165. trigger(this.$el, 'itemload', [item]);
  7166. }
  7167. },
  7168. getItem: function(index) {
  7169. if ( index === void 0 ) index = this.index;
  7170. return this.items[getIndex(index, this.slides)];
  7171. },
  7172. setItem: function(item, content) {
  7173. trigger(this.$el, 'itemloaded', [this, html(this.getSlide(item), content) ]);
  7174. },
  7175. getSlide: function(item) {
  7176. return this.slides[this.items.indexOf(item)];
  7177. },
  7178. setError: function(item) {
  7179. this.setItem(item, '<span uk-icon="icon: bolt; ratio: 2"></span>');
  7180. },
  7181. showControls: function() {
  7182. clearTimeout(this.controlsTimer);
  7183. this.controlsTimer = setTimeout(this.hideControls, this.delayControls);
  7184. addClass(this.$el, 'uk-active', 'uk-transition-active');
  7185. },
  7186. hideControls: function() {
  7187. removeClass(this.$el, 'uk-active', 'uk-transition-active');
  7188. }
  7189. }
  7190. };
  7191. function createEl(tag, attrs) {
  7192. var el = fragment(("<" + tag + ">"));
  7193. attr(el, attrs);
  7194. return el;
  7195. }
  7196. var lightbox = {
  7197. install: install$2,
  7198. props: {toggle: String},
  7199. data: {toggle: 'a'},
  7200. computed: {
  7201. toggles: {
  7202. get: function(ref, $el) {
  7203. var toggle = ref.toggle;
  7204. return $$(toggle, $el);
  7205. },
  7206. watch: function() {
  7207. this.hide();
  7208. }
  7209. }
  7210. },
  7211. disconnected: function() {
  7212. this.hide();
  7213. },
  7214. events: [
  7215. {
  7216. name: 'click',
  7217. delegate: function() {
  7218. return ((this.toggle) + ":not(.uk-disabled)");
  7219. },
  7220. handler: function(e) {
  7221. e.preventDefault();
  7222. this.show(e.current);
  7223. }
  7224. }
  7225. ],
  7226. methods: {
  7227. show: function(index) {
  7228. var this$1 = this;
  7229. var items = uniqueBy(this.toggles.map(toItem), 'source');
  7230. if (isElement(index)) {
  7231. var ref = toItem(index);
  7232. var source = ref.source;
  7233. index = findIndex(items, function (ref) {
  7234. var src = ref.source;
  7235. return source === src;
  7236. });
  7237. }
  7238. this.panel = this.panel || this.$create('lightboxPanel', assign({}, this.$props, {items: items}));
  7239. on(this.panel.$el, 'hidden', function () { return this$1.panel = false; });
  7240. return this.panel.show(index);
  7241. },
  7242. hide: function() {
  7243. return this.panel && this.panel.hide();
  7244. }
  7245. }
  7246. };
  7247. function install$2(UIkit, Lightbox) {
  7248. if (!UIkit.lightboxPanel) {
  7249. UIkit.component('lightboxPanel', LightboxPanel);
  7250. }
  7251. assign(
  7252. Lightbox.props,
  7253. UIkit.component('lightboxPanel').options.props
  7254. );
  7255. }
  7256. function toItem(el) {
  7257. var item = {};
  7258. ['href', 'caption', 'type', 'poster', 'alt', 'attrs'].forEach(function (attr) {
  7259. item[attr === 'href' ? 'source' : attr] = data(el, attr);
  7260. });
  7261. item.attrs = parseOptions(item.attrs);
  7262. return item;
  7263. }
  7264. var obj;
  7265. var notification = {
  7266. functional: true,
  7267. args: ['message', 'status'],
  7268. data: {
  7269. message: '',
  7270. status: '',
  7271. timeout: 5000,
  7272. group: null,
  7273. pos: 'top-center',
  7274. clsContainer: 'uk-notification',
  7275. clsClose: 'uk-notification-close',
  7276. clsMsg: 'uk-notification-message'
  7277. },
  7278. install: install$3,
  7279. computed: {
  7280. marginProp: function(ref) {
  7281. var pos = ref.pos;
  7282. return ("margin" + (startsWith(pos, 'top') ? 'Top' : 'Bottom'));
  7283. },
  7284. startProps: function() {
  7285. var obj;
  7286. return ( obj = {opacity: 0}, obj[this.marginProp] = -this.$el.offsetHeight, obj );
  7287. }
  7288. },
  7289. created: function() {
  7290. var container = $(("." + (this.clsContainer) + "-" + (this.pos)), this.$container)
  7291. || append(this.$container, ("<div class=\"" + (this.clsContainer) + " " + (this.clsContainer) + "-" + (this.pos) + "\" style=\"display: block\"></div>"));
  7292. this.$mount(append(container,
  7293. ("<div class=\"" + (this.clsMsg) + (this.status ? (" " + (this.clsMsg) + "-" + (this.status)) : '') + "\"> <a href class=\"" + (this.clsClose) + "\" data-uk-close></a> <div>" + (this.message) + "</div> </div>")
  7294. ));
  7295. },
  7296. connected: function() {
  7297. var this$1 = this;
  7298. var obj;
  7299. var margin = toFloat(css(this.$el, this.marginProp));
  7300. Transition.start(
  7301. css(this.$el, this.startProps),
  7302. ( obj = {opacity: 1}, obj[this.marginProp] = margin, obj )
  7303. ).then(function () {
  7304. if (this$1.timeout) {
  7305. this$1.timer = setTimeout(this$1.close, this$1.timeout);
  7306. }
  7307. });
  7308. },
  7309. events: ( obj = {
  7310. click: function(e) {
  7311. if (closest(e.target, 'a[href="#"],a[href=""]')) {
  7312. e.preventDefault();
  7313. }
  7314. this.close();
  7315. }
  7316. }, obj[pointerEnter] = function () {
  7317. if (this.timer) {
  7318. clearTimeout(this.timer);
  7319. }
  7320. }, obj[pointerLeave] = function () {
  7321. if (this.timeout) {
  7322. this.timer = setTimeout(this.close, this.timeout);
  7323. }
  7324. }, obj ),
  7325. methods: {
  7326. close: function(immediate) {
  7327. var this$1 = this;
  7328. var removeFn = function () {
  7329. var container = this$1.$el.parentNode;
  7330. trigger(this$1.$el, 'close', [this$1]);
  7331. remove(this$1.$el);
  7332. if (container && !container.hasChildNodes()) {
  7333. remove(container);
  7334. }
  7335. };
  7336. if (this.timer) {
  7337. clearTimeout(this.timer);
  7338. }
  7339. if (immediate) {
  7340. removeFn();
  7341. } else {
  7342. Transition.start(this.$el, this.startProps).then(removeFn);
  7343. }
  7344. }
  7345. }
  7346. };
  7347. function install$3(UIkit) {
  7348. UIkit.notification.closeAll = function (group, immediate) {
  7349. apply(document.body, function (el) {
  7350. var notification = UIkit.getComponent(el, 'notification');
  7351. if (notification && (!group || group === notification.group)) {
  7352. notification.close(immediate);
  7353. }
  7354. });
  7355. };
  7356. }
  7357. var props = ['x', 'y', 'bgx', 'bgy', 'rotate', 'scale', 'color', 'backgroundColor', 'borderColor', 'opacity', 'blur', 'hue', 'grayscale', 'invert', 'saturate', 'sepia', 'fopacity', 'stroke'];
  7358. var Parallax = {
  7359. mixins: [Media],
  7360. props: props.reduce(function (props, prop) {
  7361. props[prop] = 'list';
  7362. return props;
  7363. }, {}),
  7364. data: props.reduce(function (data, prop) {
  7365. data[prop] = undefined;
  7366. return data;
  7367. }, {}),
  7368. computed: {
  7369. props: function(properties, $el) {
  7370. var this$1 = this;
  7371. return props.reduce(function (props, prop) {
  7372. if (isUndefined(properties[prop])) {
  7373. return props;
  7374. }
  7375. var isColor = prop.match(/color/i);
  7376. var isCssProp = isColor || prop === 'opacity';
  7377. var pos, bgPos, diff;
  7378. var steps = properties[prop].slice(0);
  7379. if (isCssProp) {
  7380. css($el, prop, '');
  7381. }
  7382. if (steps.length < 2) {
  7383. steps.unshift((prop === 'scale'
  7384. ? 1
  7385. : isCssProp
  7386. ? css($el, prop)
  7387. : 0) || 0);
  7388. }
  7389. var unit = getUnit(steps);
  7390. if (isColor) {
  7391. var ref = $el.style;
  7392. var color = ref.color;
  7393. steps = steps.map(function (step) { return parseColor($el, step); });
  7394. $el.style.color = color;
  7395. } else if (startsWith(prop, 'bg')) {
  7396. var attr = prop === 'bgy' ? 'height' : 'width';
  7397. steps = steps.map(function (step) { return toPx(step, attr, this$1.$el); });
  7398. css($el, ("background-position-" + (prop[2])), '');
  7399. bgPos = css($el, 'backgroundPosition').split(' ')[prop[2] === 'x' ? 0 : 1]; // IE 11 can't read background-position-[x|y]
  7400. if (this$1.covers) {
  7401. var min = Math.min.apply(Math, steps);
  7402. var max = Math.max.apply(Math, steps);
  7403. var down = steps.indexOf(min) < steps.indexOf(max);
  7404. diff = max - min;
  7405. steps = steps.map(function (step) { return step - (down ? min : max); });
  7406. pos = (down ? -diff : 0) + "px";
  7407. } else {
  7408. pos = bgPos;
  7409. }
  7410. } else {
  7411. steps = steps.map(toFloat);
  7412. }
  7413. if (prop === 'stroke') {
  7414. if (!steps.some(function (step) { return step; })) {
  7415. return props;
  7416. }
  7417. var length = getMaxPathLength(this$1.$el);
  7418. css($el, 'strokeDasharray', length);
  7419. if (unit === '%') {
  7420. steps = steps.map(function (step) { return step * length / 100; });
  7421. }
  7422. steps = steps.reverse();
  7423. prop = 'strokeDashoffset';
  7424. }
  7425. props[prop] = {steps: steps, unit: unit, pos: pos, bgPos: bgPos, diff: diff};
  7426. return props;
  7427. }, {});
  7428. },
  7429. bgProps: function() {
  7430. var this$1 = this;
  7431. return ['bgx', 'bgy'].filter(function (bg) { return bg in this$1.props; });
  7432. },
  7433. covers: function(_, $el) {
  7434. return covers($el);
  7435. }
  7436. },
  7437. disconnected: function() {
  7438. delete this._image;
  7439. },
  7440. update: {
  7441. read: function(data) {
  7442. var this$1 = this;
  7443. data.active = this.matchMedia;
  7444. if (!data.active) {
  7445. return;
  7446. }
  7447. if (!data.image && this.covers && this.bgProps.length) {
  7448. var src = css(this.$el, 'backgroundImage').replace(/^none|url\(["']?(.+?)["']?\)$/, '$1');
  7449. if (src) {
  7450. var img = new Image();
  7451. img.src = src;
  7452. data.image = img;
  7453. if (!img.naturalWidth) {
  7454. img.onload = function () { return this$1.$update(); };
  7455. }
  7456. }
  7457. }
  7458. var image = data.image;
  7459. if (!image || !image.naturalWidth) {
  7460. return;
  7461. }
  7462. var dimEl = {
  7463. width: this.$el.offsetWidth,
  7464. height: this.$el.offsetHeight
  7465. };
  7466. var dimImage = {
  7467. width: image.naturalWidth,
  7468. height: image.naturalHeight
  7469. };
  7470. var dim = Dimensions.cover(dimImage, dimEl);
  7471. this.bgProps.forEach(function (prop) {
  7472. var ref = this$1.props[prop];
  7473. var diff = ref.diff;
  7474. var bgPos = ref.bgPos;
  7475. var steps = ref.steps;
  7476. var attr = prop === 'bgy' ? 'height' : 'width';
  7477. var span = dim[attr] - dimEl[attr];
  7478. if (span < diff) {
  7479. dimEl[attr] = dim[attr] + diff - span;
  7480. } else if (span > diff) {
  7481. var posPercentage = dimEl[attr] / toPx(bgPos, attr, this$1.$el);
  7482. if (posPercentage) {
  7483. this$1.props[prop].steps = steps.map(function (step) { return step - (span - diff) / posPercentage; });
  7484. }
  7485. }
  7486. dim = Dimensions.cover(dimImage, dimEl);
  7487. });
  7488. data.dim = dim;
  7489. },
  7490. write: function(ref) {
  7491. var dim = ref.dim;
  7492. var active = ref.active;
  7493. if (!active) {
  7494. css(this.$el, {backgroundSize: '', backgroundRepeat: ''});
  7495. return;
  7496. }
  7497. dim && css(this.$el, {
  7498. backgroundSize: ((dim.width) + "px " + (dim.height) + "px"),
  7499. backgroundRepeat: 'no-repeat'
  7500. });
  7501. },
  7502. events: ['resize']
  7503. },
  7504. methods: {
  7505. reset: function() {
  7506. var this$1 = this;
  7507. each(this.getCss(0), function (_, prop) { return css(this$1.$el, prop, ''); });
  7508. },
  7509. getCss: function(percent) {
  7510. var ref = this;
  7511. var props = ref.props;
  7512. return Object.keys(props).reduce(function (css, prop) {
  7513. var ref = props[prop];
  7514. var steps = ref.steps;
  7515. var unit = ref.unit;
  7516. var pos = ref.pos;
  7517. var value = getValue(steps, percent);
  7518. switch (prop) {
  7519. // transforms
  7520. case 'x':
  7521. case 'y': {
  7522. unit = unit || 'px';
  7523. css.transform += " translate" + (ucfirst(prop)) + "(" + (toFloat(value).toFixed(unit === 'px' ? 0 : 2)) + unit + ")";
  7524. break;
  7525. }
  7526. case 'rotate':
  7527. unit = unit || 'deg';
  7528. css.transform += " rotate(" + (value + unit) + ")";
  7529. break;
  7530. case 'scale':
  7531. css.transform += " scale(" + value + ")";
  7532. break;
  7533. // bg image
  7534. case 'bgy':
  7535. case 'bgx':
  7536. css[("background-position-" + (prop[2]))] = "calc(" + pos + " + " + value + "px)";
  7537. break;
  7538. // color
  7539. case 'color':
  7540. case 'backgroundColor':
  7541. case 'borderColor': {
  7542. var ref$1 = getStep(steps, percent);
  7543. var start = ref$1[0];
  7544. var end = ref$1[1];
  7545. var p = ref$1[2];
  7546. css[prop] = "rgba(" + (start.map(function (value, i) {
  7547. value = value + p * (end[i] - value);
  7548. return i === 3 ? toFloat(value) : parseInt(value, 10);
  7549. }).join(',')) + ")";
  7550. break;
  7551. }
  7552. // CSS Filter
  7553. case 'blur':
  7554. unit = unit || 'px';
  7555. css.filter += " blur(" + (value + unit) + ")";
  7556. break;
  7557. case 'hue':
  7558. unit = unit || 'deg';
  7559. css.filter += " hue-rotate(" + (value + unit) + ")";
  7560. break;
  7561. case 'fopacity':
  7562. unit = unit || '%';
  7563. css.filter += " opacity(" + (value + unit) + ")";
  7564. break;
  7565. case 'grayscale':
  7566. case 'invert':
  7567. case 'saturate':
  7568. case 'sepia':
  7569. unit = unit || '%';
  7570. css.filter += " " + prop + "(" + (value + unit) + ")";
  7571. break;
  7572. default:
  7573. css[prop] = value;
  7574. }
  7575. return css;
  7576. }, {transform: '', filter: ''});
  7577. }
  7578. }
  7579. };
  7580. function parseColor(el, color) {
  7581. return css(css(el, 'color', color), 'color')
  7582. .split(/[(),]/g)
  7583. .slice(1, -1)
  7584. .concat(1)
  7585. .slice(0, 4)
  7586. .map(toFloat);
  7587. }
  7588. function getStep(steps, percent) {
  7589. var count = steps.length - 1;
  7590. var index = Math.min(Math.floor(count * percent), count - 1);
  7591. var step = steps.slice(index, index + 2);
  7592. step.push(percent === 1 ? 1 : percent % (1 / count) * count);
  7593. return step;
  7594. }
  7595. function getValue(steps, percent, digits) {
  7596. if ( digits === void 0 ) digits = 2;
  7597. var ref = getStep(steps, percent);
  7598. var start = ref[0];
  7599. var end = ref[1];
  7600. var p = ref[2];
  7601. return (isNumber(start)
  7602. ? start + Math.abs(start - end) * p * (start < end ? 1 : -1)
  7603. : +end
  7604. ).toFixed(digits);
  7605. }
  7606. function getUnit(steps) {
  7607. return steps.reduce(function (unit, step) { return isString(step) && step.replace(/-|\d/g, '').trim() || unit; }, '');
  7608. }
  7609. function covers(el) {
  7610. var ref = el.style;
  7611. var backgroundSize = ref.backgroundSize;
  7612. var covers = css(css(el, 'backgroundSize', ''), 'backgroundSize') === 'cover';
  7613. el.style.backgroundSize = backgroundSize;
  7614. return covers;
  7615. }
  7616. var parallax = {
  7617. mixins: [Parallax],
  7618. props: {
  7619. target: String,
  7620. viewport: Number,
  7621. easing: Number
  7622. },
  7623. data: {
  7624. target: false,
  7625. viewport: 1,
  7626. easing: 1
  7627. },
  7628. computed: {
  7629. target: function(ref, $el) {
  7630. var target = ref.target;
  7631. return getOffsetElement(target && query(target, $el) || $el);
  7632. }
  7633. },
  7634. update: {
  7635. read: function(ref, type) {
  7636. var percent = ref.percent;
  7637. var active = ref.active;
  7638. if (type !== 'scroll') {
  7639. percent = false;
  7640. }
  7641. if (!active) {
  7642. return;
  7643. }
  7644. var prev = percent;
  7645. percent = ease(scrolledOver(this.target) / (this.viewport || 1), this.easing);
  7646. return {
  7647. percent: percent,
  7648. style: prev !== percent ? this.getCss(percent) : false
  7649. };
  7650. },
  7651. write: function(ref) {
  7652. var style = ref.style;
  7653. var active = ref.active;
  7654. if (!active) {
  7655. this.reset();
  7656. return;
  7657. }
  7658. style && css(this.$el, style);
  7659. },
  7660. events: ['scroll', 'resize']
  7661. }
  7662. };
  7663. function ease(percent, easing) {
  7664. return clamp(percent * (1 - (easing - easing * percent)));
  7665. }
  7666. // SVG elements do not inherit from HTMLElement
  7667. function getOffsetElement(el) {
  7668. return el
  7669. ? 'offsetTop' in el
  7670. ? el
  7671. : getOffsetElement(el.parentNode)
  7672. : document.body;
  7673. }
  7674. var SliderReactive = {
  7675. update: {
  7676. write: function() {
  7677. if (this.stack.length || this.dragging) {
  7678. return;
  7679. }
  7680. var index = this.getValidIndex(this.index);
  7681. if (!~this.prevIndex || this.index !== index) {
  7682. this.show(index);
  7683. }
  7684. },
  7685. events: ['resize']
  7686. }
  7687. };
  7688. function Transitioner$1 (prev, next, dir, ref) {
  7689. var center = ref.center;
  7690. var easing = ref.easing;
  7691. var list = ref.list;
  7692. var deferred = new Deferred();
  7693. var from = prev
  7694. ? getLeft(prev, list, center)
  7695. : getLeft(next, list, center) + offset(next).width * dir;
  7696. var to = next
  7697. ? getLeft(next, list, center)
  7698. : from + offset(prev).width * dir * (isRtl ? -1 : 1);
  7699. return {
  7700. dir: dir,
  7701. show: function(duration, percent, linear) {
  7702. if ( percent === void 0 ) percent = 0;
  7703. var timing = linear ? 'linear' : easing;
  7704. duration -= Math.round(duration * clamp(percent, -1, 1));
  7705. this.translate(percent);
  7706. prev && this.updateTranslates();
  7707. percent = prev ? percent : clamp(percent, 0, 1);
  7708. triggerUpdate$1(this.getItemIn(), 'itemin', {percent: percent, duration: duration, timing: timing, dir: dir});
  7709. prev && triggerUpdate$1(this.getItemIn(true), 'itemout', {percent: 1 - percent, duration: duration, timing: timing, dir: dir});
  7710. Transition
  7711. .start(list, {transform: translate(-to * (isRtl ? -1 : 1), 'px')}, duration, timing)
  7712. .then(deferred.resolve, noop);
  7713. return deferred.promise;
  7714. },
  7715. stop: function() {
  7716. return Transition.stop(list);
  7717. },
  7718. cancel: function() {
  7719. Transition.cancel(list);
  7720. },
  7721. reset: function() {
  7722. css(list, 'transform', '');
  7723. },
  7724. forward: function(duration, percent) {
  7725. if ( percent === void 0 ) percent = this.percent();
  7726. Transition.cancel(list);
  7727. return this.show(duration, percent, true);
  7728. },
  7729. translate: function(percent) {
  7730. var distance = this.getDistance() * dir * (isRtl ? -1 : 1);
  7731. css(list, 'transform', translate(clamp(
  7732. -to + (distance - distance * percent),
  7733. -getWidth(list),
  7734. offset(list).width
  7735. ) * (isRtl ? -1 : 1), 'px'));
  7736. this.updateTranslates();
  7737. if (prev) {
  7738. percent = clamp(percent, -1, 1);
  7739. triggerUpdate$1(this.getItemIn(), 'itemtranslatein', {percent: percent, dir: dir});
  7740. triggerUpdate$1(this.getItemIn(true), 'itemtranslateout', {percent: 1 - percent, dir: dir});
  7741. }
  7742. },
  7743. percent: function() {
  7744. return Math.abs((css(list, 'transform').split(',')[4] * (isRtl ? -1 : 1) + from) / (to - from));
  7745. },
  7746. getDistance: function() {
  7747. return Math.abs(to - from);
  7748. },
  7749. getItemIn: function(out) {
  7750. if ( out === void 0 ) out = false;
  7751. var actives = this.getActives();
  7752. var all = sortBy(slides(list), 'offsetLeft');
  7753. var i = index(all, actives[dir * (out ? -1 : 1) > 0 ? actives.length - 1 : 0]);
  7754. return ~i && all[i + (prev && !out ? dir : 0)];
  7755. },
  7756. getActives: function() {
  7757. var left = getLeft(prev || next, list, center);
  7758. return sortBy(slides(list).filter(function (slide) {
  7759. var slideLeft = getElLeft(slide, list);
  7760. return slideLeft >= left && slideLeft + offset(slide).width <= offset(list).width + left;
  7761. }), 'offsetLeft');
  7762. },
  7763. updateTranslates: function() {
  7764. var actives = this.getActives();
  7765. slides(list).forEach(function (slide) {
  7766. var isActive = includes(actives, slide);
  7767. triggerUpdate$1(slide, ("itemtranslate" + (isActive ? 'in' : 'out')), {
  7768. percent: isActive ? 1 : 0,
  7769. dir: slide.offsetLeft <= next.offsetLeft ? 1 : -1
  7770. });
  7771. });
  7772. }
  7773. };
  7774. }
  7775. function getLeft(el, list, center) {
  7776. var left = getElLeft(el, list);
  7777. return center
  7778. ? left - centerEl(el, list)
  7779. : Math.min(left, getMax(list));
  7780. }
  7781. function getMax(list) {
  7782. return Math.max(0, getWidth(list) - offset(list).width);
  7783. }
  7784. function getWidth(list) {
  7785. return slides(list).reduce(function (right, el) { return offset(el).width + right; }, 0);
  7786. }
  7787. function getMaxWidth(list) {
  7788. return slides(list).reduce(function (right, el) { return Math.max(right, offset(el).width); }, 0);
  7789. }
  7790. function centerEl(el, list) {
  7791. return offset(list).width / 2 - offset(el).width / 2;
  7792. }
  7793. function getElLeft(el, list) {
  7794. return (position(el).left + (isRtl ? offset(el).width - offset(list).width : 0)) * (isRtl ? -1 : 1);
  7795. }
  7796. function triggerUpdate$1(el, type, data) {
  7797. trigger(el, createEvent(type, false, false, data));
  7798. }
  7799. function slides(list) {
  7800. return children(list);
  7801. }
  7802. var slider = {
  7803. mixins: [Class, Slider, SliderReactive],
  7804. props: {
  7805. center: Boolean,
  7806. sets: Boolean
  7807. },
  7808. data: {
  7809. center: false,
  7810. sets: false,
  7811. attrItem: 'uk-slider-item',
  7812. selList: '.uk-slider-items',
  7813. selNav: '.uk-slider-nav',
  7814. clsContainer: 'uk-slider-container',
  7815. Transitioner: Transitioner$1
  7816. },
  7817. computed: {
  7818. avgWidth: function() {
  7819. return getWidth(this.list) / this.length;
  7820. },
  7821. finite: function(ref) {
  7822. var finite = ref.finite;
  7823. return finite || Math.ceil(getWidth(this.list)) < offset(this.list).width + getMaxWidth(this.list) + this.center;
  7824. },
  7825. maxIndex: function() {
  7826. if (!this.finite || this.center && !this.sets) {
  7827. return this.length - 1;
  7828. }
  7829. if (this.center) {
  7830. return last(this.sets);
  7831. }
  7832. css(this.slides, 'order', '');
  7833. var max = getMax(this.list);
  7834. var i = this.length;
  7835. while (i--) {
  7836. if (getElLeft(this.list.children[i], this.list) < max) {
  7837. return Math.min(i + 1, this.length - 1);
  7838. }
  7839. }
  7840. return 0;
  7841. },
  7842. sets: function(ref) {
  7843. var this$1 = this;
  7844. var sets = ref.sets;
  7845. var width = offset(this.list).width / (this.center ? 2 : 1);
  7846. var left = 0;
  7847. var leftCenter = width;
  7848. var slideLeft = 0;
  7849. sets = sets && this.slides.reduce(function (sets, slide, i) {
  7850. var ref = offset(slide);
  7851. var slideWidth = ref.width;
  7852. var slideRight = slideLeft + slideWidth;
  7853. if (slideRight > left) {
  7854. if (!this$1.center && i > this$1.maxIndex) {
  7855. i = this$1.maxIndex;
  7856. }
  7857. if (!includes(sets, i)) {
  7858. var cmp = this$1.slides[i + 1];
  7859. if (this$1.center && cmp && slideWidth < leftCenter - offset(cmp).width / 2) {
  7860. leftCenter -= slideWidth;
  7861. } else {
  7862. leftCenter = width;
  7863. sets.push(i);
  7864. left = slideLeft + width + (this$1.center ? slideWidth / 2 : 0);
  7865. }
  7866. }
  7867. }
  7868. slideLeft += slideWidth;
  7869. return sets;
  7870. }, []);
  7871. return !isEmpty(sets) && sets;
  7872. },
  7873. transitionOptions: function() {
  7874. return {
  7875. center: this.center,
  7876. list: this.list
  7877. };
  7878. }
  7879. },
  7880. connected: function() {
  7881. toggleClass(this.$el, this.clsContainer, !$(("." + (this.clsContainer)), this.$el));
  7882. },
  7883. update: {
  7884. write: function() {
  7885. var this$1 = this;
  7886. $$(("[" + (this.attrItem) + "],[data-" + (this.attrItem) + "]"), this.$el).forEach(function (el) {
  7887. var index = data(el, this$1.attrItem);
  7888. this$1.maxIndex && toggleClass(el, 'uk-hidden', isNumeric(index) && (this$1.sets && !includes(this$1.sets, toFloat(index)) || index > this$1.maxIndex));
  7889. });
  7890. if (this.length && !this.dragging && !this.stack.length) {
  7891. this.reorder();
  7892. this._translate(1);
  7893. }
  7894. var actives = this._getTransitioner(this.index).getActives();
  7895. this.slides.forEach(function (slide) { return toggleClass(slide, this$1.clsActive, includes(actives, slide)); });
  7896. (!this.sets || includes(this.sets, toFloat(this.index))) && this.slides.forEach(function (slide) { return toggleClass(slide, this$1.clsActivated, includes(actives, slide)); });
  7897. },
  7898. events: ['resize']
  7899. },
  7900. events: {
  7901. beforeitemshow: function(e) {
  7902. if (!this.dragging && this.sets && this.stack.length < 2 && !includes(this.sets, this.index)) {
  7903. this.index = this.getValidIndex();
  7904. }
  7905. var diff = Math.abs(
  7906. this.index
  7907. - this.prevIndex
  7908. + (this.dir > 0 && this.index < this.prevIndex || this.dir < 0 && this.index > this.prevIndex ? (this.maxIndex + 1) * this.dir : 0)
  7909. );
  7910. if (!this.dragging && diff > 1) {
  7911. for (var i = 0; i < diff; i++) {
  7912. this.stack.splice(1, 0, this.dir > 0 ? 'next' : 'previous');
  7913. }
  7914. e.preventDefault();
  7915. return;
  7916. }
  7917. this.duration = speedUp(this.avgWidth / this.velocity)
  7918. * (offset(
  7919. this.dir < 0 || !this.slides[this.prevIndex]
  7920. ? this.slides[this.index]
  7921. : this.slides[this.prevIndex]
  7922. ).width / this.avgWidth);
  7923. this.reorder();
  7924. },
  7925. itemshow: function() {
  7926. ~this.prevIndex && addClass(this._getTransitioner().getItemIn(), this.clsActive);
  7927. }
  7928. },
  7929. methods: {
  7930. reorder: function() {
  7931. var this$1 = this;
  7932. if (this.finite) {
  7933. css(this.slides, 'order', '');
  7934. return;
  7935. }
  7936. var index = this.dir > 0 && this.slides[this.prevIndex] ? this.prevIndex : this.index;
  7937. this.slides.forEach(function (slide, i) { return css(slide, 'order', this$1.dir > 0 && i < index
  7938. ? 1
  7939. : this$1.dir < 0 && i >= this$1.index
  7940. ? -1
  7941. : ''
  7942. ); }
  7943. );
  7944. if (!this.center) {
  7945. return;
  7946. }
  7947. var next = this.slides[index];
  7948. var width = offset(this.list).width / 2 - offset(next).width / 2;
  7949. var j = 0;
  7950. while (width > 0) {
  7951. var slideIndex = this.getIndex(--j + index, index);
  7952. var slide = this.slides[slideIndex];
  7953. css(slide, 'order', slideIndex > index ? -2 : -1);
  7954. width -= offset(slide).width;
  7955. }
  7956. },
  7957. getValidIndex: function(index, prevIndex) {
  7958. if ( index === void 0 ) index = this.index;
  7959. if ( prevIndex === void 0 ) prevIndex = this.prevIndex;
  7960. index = this.getIndex(index, prevIndex);
  7961. if (!this.sets) {
  7962. return index;
  7963. }
  7964. var prev;
  7965. do {
  7966. if (includes(this.sets, index)) {
  7967. return index;
  7968. }
  7969. prev = index;
  7970. index = this.getIndex(index + this.dir, prevIndex);
  7971. } while (index !== prev);
  7972. return index;
  7973. }
  7974. }
  7975. };
  7976. var sliderParallax = {
  7977. mixins: [Parallax],
  7978. data: {
  7979. selItem: '!li'
  7980. },
  7981. computed: {
  7982. item: function(ref, $el) {
  7983. var selItem = ref.selItem;
  7984. return query(selItem, $el);
  7985. }
  7986. },
  7987. events: [
  7988. {
  7989. name: 'itemshown',
  7990. self: true,
  7991. el: function() {
  7992. return this.item;
  7993. },
  7994. handler: function() {
  7995. css(this.$el, this.getCss(.5));
  7996. }
  7997. },
  7998. {
  7999. name: 'itemin itemout',
  8000. self: true,
  8001. el: function() {
  8002. return this.item;
  8003. },
  8004. handler: function(ref) {
  8005. var type = ref.type;
  8006. var ref_detail = ref.detail;
  8007. var percent = ref_detail.percent;
  8008. var duration = ref_detail.duration;
  8009. var timing = ref_detail.timing;
  8010. var dir = ref_detail.dir;
  8011. Transition.cancel(this.$el);
  8012. css(this.$el, this.getCss(getCurrent(type, dir, percent)));
  8013. Transition.start(this.$el, this.getCss(isIn(type)
  8014. ? .5
  8015. : dir > 0
  8016. ? 1
  8017. : 0
  8018. ), duration, timing).catch(noop);
  8019. }
  8020. },
  8021. {
  8022. name: 'transitioncanceled transitionend',
  8023. self: true,
  8024. el: function() {
  8025. return this.item;
  8026. },
  8027. handler: function() {
  8028. Transition.cancel(this.$el);
  8029. }
  8030. },
  8031. {
  8032. name: 'itemtranslatein itemtranslateout',
  8033. self: true,
  8034. el: function() {
  8035. return this.item;
  8036. },
  8037. handler: function(ref) {
  8038. var type = ref.type;
  8039. var ref_detail = ref.detail;
  8040. var percent = ref_detail.percent;
  8041. var dir = ref_detail.dir;
  8042. Transition.cancel(this.$el);
  8043. css(this.$el, this.getCss(getCurrent(type, dir, percent)));
  8044. }
  8045. }
  8046. ]
  8047. };
  8048. function isIn(type) {
  8049. return endsWith(type, 'in');
  8050. }
  8051. function getCurrent(type, dir, percent) {
  8052. percent /= 2;
  8053. return !isIn(type)
  8054. ? dir < 0
  8055. ? percent
  8056. : 1 - percent
  8057. : dir < 0
  8058. ? 1 - percent
  8059. : percent;
  8060. }
  8061. var Animations$2 = assign({}, Animations, {
  8062. fade: {
  8063. show: function() {
  8064. return [
  8065. {opacity: 0, zIndex: 0},
  8066. {zIndex: -1}
  8067. ];
  8068. },
  8069. percent: function(current) {
  8070. return 1 - css(current, 'opacity');
  8071. },
  8072. translate: function(percent) {
  8073. return [
  8074. {opacity: 1 - percent, zIndex: 0},
  8075. {zIndex: -1}
  8076. ];
  8077. }
  8078. },
  8079. scale: {
  8080. show: function() {
  8081. return [
  8082. {opacity: 0, transform: scale3d(1 + .5), zIndex: 0},
  8083. {zIndex: -1}
  8084. ];
  8085. },
  8086. percent: function(current) {
  8087. return 1 - css(current, 'opacity');
  8088. },
  8089. translate: function(percent) {
  8090. return [
  8091. {opacity: 1 - percent, transform: scale3d(1 + .5 * percent), zIndex: 0},
  8092. {zIndex: -1}
  8093. ];
  8094. }
  8095. },
  8096. pull: {
  8097. show: function(dir) {
  8098. return dir < 0
  8099. ? [
  8100. {transform: translate(30), zIndex: -1},
  8101. {transform: translate(), zIndex: 0}
  8102. ]
  8103. : [
  8104. {transform: translate(-100), zIndex: 0},
  8105. {transform: translate(), zIndex: -1}
  8106. ];
  8107. },
  8108. percent: function(current, next, dir) {
  8109. return dir < 0
  8110. ? 1 - translated(next)
  8111. : translated(current);
  8112. },
  8113. translate: function(percent, dir) {
  8114. return dir < 0
  8115. ? [
  8116. {transform: translate(30 * percent), zIndex: -1},
  8117. {transform: translate(-100 * (1 - percent)), zIndex: 0}
  8118. ]
  8119. : [
  8120. {transform: translate(-percent * 100), zIndex: 0},
  8121. {transform: translate(30 * (1 - percent)), zIndex: -1}
  8122. ];
  8123. }
  8124. },
  8125. push: {
  8126. show: function(dir) {
  8127. return dir < 0
  8128. ? [
  8129. {transform: translate(100), zIndex: 0},
  8130. {transform: translate(), zIndex: -1}
  8131. ]
  8132. : [
  8133. {transform: translate(-30), zIndex: -1},
  8134. {transform: translate(), zIndex: 0}
  8135. ];
  8136. },
  8137. percent: function(current, next, dir) {
  8138. return dir > 0
  8139. ? 1 - translated(next)
  8140. : translated(current);
  8141. },
  8142. translate: function(percent, dir) {
  8143. return dir < 0
  8144. ? [
  8145. {transform: translate(percent * 100), zIndex: 0},
  8146. {transform: translate(-30 * (1 - percent)), zIndex: -1}
  8147. ]
  8148. : [
  8149. {transform: translate(-30 * percent), zIndex: -1},
  8150. {transform: translate(100 * (1 - percent)), zIndex: 0}
  8151. ];
  8152. }
  8153. }
  8154. });
  8155. var slideshow = {
  8156. mixins: [Class, Slideshow, SliderReactive],
  8157. props: {
  8158. ratio: String,
  8159. minHeight: Number,
  8160. maxHeight: Number
  8161. },
  8162. data: {
  8163. ratio: '16:9',
  8164. minHeight: false,
  8165. maxHeight: false,
  8166. selList: '.uk-slideshow-items',
  8167. attrItem: 'uk-slideshow-item',
  8168. selNav: '.uk-slideshow-nav',
  8169. Animations: Animations$2
  8170. },
  8171. update: {
  8172. read: function() {
  8173. var ref = this.ratio.split(':').map(Number);
  8174. var width = ref[0];
  8175. var height = ref[1];
  8176. height = height * this.list.offsetWidth / width || 0;
  8177. if (this.minHeight) {
  8178. height = Math.max(this.minHeight, height);
  8179. }
  8180. if (this.maxHeight) {
  8181. height = Math.min(this.maxHeight, height);
  8182. }
  8183. return {height: height - boxModelAdjust(this.list, 'height', 'content-box')};
  8184. },
  8185. write: function(ref) {
  8186. var height = ref.height;
  8187. height > 0 && css(this.list, 'minHeight', height);
  8188. },
  8189. events: ['resize']
  8190. }
  8191. };
  8192. var sortable = {
  8193. mixins: [Class, Animate],
  8194. props: {
  8195. group: String,
  8196. threshold: Number,
  8197. clsItem: String,
  8198. clsPlaceholder: String,
  8199. clsDrag: String,
  8200. clsDragState: String,
  8201. clsBase: String,
  8202. clsNoDrag: String,
  8203. clsEmpty: String,
  8204. clsCustom: String,
  8205. handle: String
  8206. },
  8207. data: {
  8208. group: false,
  8209. threshold: 5,
  8210. clsItem: 'uk-sortable-item',
  8211. clsPlaceholder: 'uk-sortable-placeholder',
  8212. clsDrag: 'uk-sortable-drag',
  8213. clsDragState: 'uk-drag',
  8214. clsBase: 'uk-sortable',
  8215. clsNoDrag: 'uk-sortable-nodrag',
  8216. clsEmpty: 'uk-sortable-empty',
  8217. clsCustom: '',
  8218. handle: false,
  8219. pos: {}
  8220. },
  8221. created: function() {
  8222. var this$1 = this;
  8223. ['init', 'start', 'move', 'end'].forEach(function (key) {
  8224. var fn = this$1[key];
  8225. this$1[key] = function (e) {
  8226. assign(this$1.pos, getEventPos(e));
  8227. fn(e);
  8228. };
  8229. });
  8230. },
  8231. events: {
  8232. name: pointerDown,
  8233. passive: false,
  8234. handler: 'init'
  8235. },
  8236. computed: {
  8237. target: function() {
  8238. return (this.$el.tBodies || [this.$el])[0];
  8239. },
  8240. items: function() {
  8241. return children(this.target);
  8242. },
  8243. isEmpty: {
  8244. get: function() {
  8245. return isEmpty(this.items);
  8246. },
  8247. watch: function(empty) {
  8248. toggleClass(this.target, this.clsEmpty, empty);
  8249. },
  8250. immediate: true
  8251. },
  8252. handles: {
  8253. get: function(ref, el) {
  8254. var handle = ref.handle;
  8255. return handle ? $$(handle, el) : this.items;
  8256. },
  8257. watch: function(handles, prev) {
  8258. css(prev, {touchAction: '', userSelect: ''});
  8259. css(handles, {touchAction: hasTouch ? 'none' : '', userSelect: 'none'}); // touchAction set to 'none' causes a performance drop in Chrome 80
  8260. },
  8261. immediate: true
  8262. }
  8263. },
  8264. update: {
  8265. write: function() {
  8266. if (!this.drag || !parent(this.placeholder)) {
  8267. return;
  8268. }
  8269. // clamp to viewport
  8270. var ref = this.pos;
  8271. var x = ref.x;
  8272. var y = ref.y;
  8273. var ref$1 = this.origin;
  8274. var offsetTop = ref$1.offsetTop;
  8275. var offsetLeft = ref$1.offsetLeft;
  8276. var ref$2 = this.drag;
  8277. var offsetHeight = ref$2.offsetHeight;
  8278. var offsetWidth = ref$2.offsetWidth;
  8279. var ref$3 = offset(window);
  8280. var right = ref$3.right;
  8281. var bottom = ref$3.bottom;
  8282. var target = document.elementFromPoint(x, y);
  8283. css(this.drag, {
  8284. top: clamp(y - offsetTop, 0, bottom - offsetHeight),
  8285. left: clamp(x - offsetLeft, 0, right - offsetWidth)
  8286. });
  8287. var sortable = this.getSortable(target);
  8288. var previous = this.getSortable(this.placeholder);
  8289. var move = sortable !== previous;
  8290. if (!sortable || within(target, this.placeholder) || move && (!sortable.group || sortable.group !== previous.group)) {
  8291. return;
  8292. }
  8293. target = sortable.target === target.parentNode && target || sortable.items.filter(function (element) { return within(target, element); })[0];
  8294. if (move) {
  8295. previous.remove(this.placeholder);
  8296. } else if (!target) {
  8297. return;
  8298. }
  8299. sortable.insert(this.placeholder, target);
  8300. if (!includes(this.touched, sortable)) {
  8301. this.touched.push(sortable);
  8302. }
  8303. },
  8304. events: ['move']
  8305. },
  8306. methods: {
  8307. init: function(e) {
  8308. var target = e.target;
  8309. var button = e.button;
  8310. var defaultPrevented = e.defaultPrevented;
  8311. var ref = this.items.filter(function (el) { return within(target, el); });
  8312. var placeholder = ref[0];
  8313. if (!placeholder
  8314. || defaultPrevented
  8315. || button > 0
  8316. || isInput(target)
  8317. || within(target, ("." + (this.clsNoDrag)))
  8318. || this.handle && !within(target, this.handle)
  8319. ) {
  8320. return;
  8321. }
  8322. e.preventDefault();
  8323. this.touched = [this];
  8324. this.placeholder = placeholder;
  8325. this.origin = assign({target: target, index: index(placeholder)}, this.pos);
  8326. on(document, pointerMove, this.move);
  8327. on(document, pointerUp, this.end);
  8328. if (!this.threshold) {
  8329. this.start(e);
  8330. }
  8331. },
  8332. start: function(e) {
  8333. this.drag = appendDrag(this.$container, this.placeholder);
  8334. var ref = this.placeholder.getBoundingClientRect();
  8335. var left = ref.left;
  8336. var top = ref.top;
  8337. assign(this.origin, {offsetLeft: this.pos.x - left, offsetTop: this.pos.y - top});
  8338. addClass(this.drag, this.clsDrag, this.clsCustom);
  8339. addClass(this.placeholder, this.clsPlaceholder);
  8340. addClass(this.items, this.clsItem);
  8341. addClass(document.documentElement, this.clsDragState);
  8342. trigger(this.$el, 'start', [this, this.placeholder]);
  8343. trackScroll(this.pos);
  8344. this.move(e);
  8345. },
  8346. move: function(e) {
  8347. if (this.drag) {
  8348. this.$emit('move');
  8349. } else if (Math.abs(this.pos.x - this.origin.x) > this.threshold || Math.abs(this.pos.y - this.origin.y) > this.threshold) {
  8350. this.start(e);
  8351. }
  8352. },
  8353. end: function(e) {
  8354. off(document, pointerMove, this.move);
  8355. off(document, pointerUp, this.end);
  8356. off(window, 'scroll', this.scroll);
  8357. if (!this.drag) {
  8358. if (e.type === 'touchend') {
  8359. e.target.click();
  8360. }
  8361. return;
  8362. }
  8363. untrackScroll();
  8364. var sortable = this.getSortable(this.placeholder);
  8365. if (this === sortable) {
  8366. if (this.origin.index !== index(this.placeholder)) {
  8367. trigger(this.$el, 'moved', [this, this.placeholder]);
  8368. }
  8369. } else {
  8370. trigger(sortable.$el, 'added', [sortable, this.placeholder]);
  8371. trigger(this.$el, 'removed', [this, this.placeholder]);
  8372. }
  8373. trigger(this.$el, 'stop', [this, this.placeholder]);
  8374. remove(this.drag);
  8375. this.drag = null;
  8376. var classes = this.touched.map(function (sortable) { return ((sortable.clsPlaceholder) + " " + (sortable.clsItem)); }).join(' ');
  8377. this.touched.forEach(function (sortable) { return removeClass(sortable.items, classes); });
  8378. removeClass(document.documentElement, this.clsDragState);
  8379. },
  8380. insert: function(element, target) {
  8381. var this$1 = this;
  8382. addClass(this.items, this.clsItem);
  8383. var insert = function () {
  8384. if (target) {
  8385. if (!within(element, this$1.target) || isPredecessor(element, target)) {
  8386. before(target, element);
  8387. } else {
  8388. after(target, element);
  8389. }
  8390. } else {
  8391. append(this$1.target, element);
  8392. }
  8393. };
  8394. if (this.animation) {
  8395. this.animate(insert);
  8396. } else {
  8397. insert();
  8398. }
  8399. },
  8400. remove: function(element) {
  8401. if (!within(element, this.target)) {
  8402. return;
  8403. }
  8404. if (this.animation) {
  8405. this.animate(function () { return remove(element); });
  8406. } else {
  8407. remove(element);
  8408. }
  8409. },
  8410. getSortable: function(element) {
  8411. return element && (this.$getComponent(element, 'sortable') || this.getSortable(element.parentNode));
  8412. }
  8413. }
  8414. };
  8415. function isPredecessor(element, target) {
  8416. return element.parentNode === target.parentNode && index(element) > index(target);
  8417. }
  8418. var trackTimer;
  8419. function trackScroll(pos) {
  8420. var last = Date.now();
  8421. trackTimer = setInterval(function () {
  8422. var x = pos.x;
  8423. var y = pos.y;
  8424. y += window.pageYOffset;
  8425. var dist = (Date.now() - last) * .3;
  8426. last = Date.now();
  8427. scrollParents(document.elementFromPoint(x, pos.y)).some(function (scrollEl) {
  8428. var scroll = scrollEl.scrollTop;
  8429. var scrollHeight = scrollEl.scrollHeight;
  8430. var ref = offset(getViewport(scrollEl));
  8431. var top = ref.top;
  8432. var bottom = ref.bottom;
  8433. var height = ref.height;
  8434. if (top < y && top + 30 > y) {
  8435. scroll -= dist;
  8436. } else if (bottom > y && bottom - 30 < y) {
  8437. scroll += dist;
  8438. } else {
  8439. return;
  8440. }
  8441. if (scroll > 0 && scroll < scrollHeight - height) {
  8442. scrollTop(scrollEl, scroll);
  8443. return true;
  8444. }
  8445. });
  8446. }, 15);
  8447. }
  8448. function untrackScroll() {
  8449. clearInterval(trackTimer);
  8450. }
  8451. function appendDrag(container, element) {
  8452. var clone = append(container, element.outerHTML.replace(/(^<)(?:li|tr)|(?:li|tr)(\/>$)/g, '$1div$2'));
  8453. attr(clone, 'style', ((attr(clone, 'style')) + ";margin:0!important"));
  8454. css(clone, assign({
  8455. boxSizing: 'border-box',
  8456. width: element.offsetWidth,
  8457. height: element.offsetHeight,
  8458. overflow: 'hidden'
  8459. }, css(element, ['paddingLeft', 'paddingRight', 'paddingTop', 'paddingBottom'])));
  8460. height(clone.firstElementChild, height(element.firstElementChild));
  8461. return clone;
  8462. }
  8463. var obj$1;
  8464. var actives = [];
  8465. var tooltip = {
  8466. mixins: [Container, Togglable, Position],
  8467. args: 'title',
  8468. props: {
  8469. delay: Number,
  8470. title: String
  8471. },
  8472. data: {
  8473. pos: 'top',
  8474. title: '',
  8475. delay: 0,
  8476. animation: ['uk-animation-scale-up'],
  8477. duration: 100,
  8478. cls: 'uk-active',
  8479. clsPos: 'uk-tooltip'
  8480. },
  8481. beforeConnect: function() {
  8482. this._hasTitle = hasAttr(this.$el, 'title');
  8483. attr(this.$el, {title: '', 'aria-expanded': false});
  8484. },
  8485. disconnected: function() {
  8486. this.hide();
  8487. attr(this.$el, {title: this._hasTitle ? this.title : null, 'aria-expanded': null});
  8488. },
  8489. methods: {
  8490. show: function() {
  8491. var this$1 = this;
  8492. if (this.isActive() || !this.title) {
  8493. return;
  8494. }
  8495. actives.forEach(function (active) { return active.hide(); });
  8496. actives.push(this);
  8497. this._unbind = on(document, pointerUp, function (e) { return !within(e.target, this$1.$el) && this$1.hide(); });
  8498. clearTimeout(this.showTimer);
  8499. this.showTimer = setTimeout(this._show, this.delay);
  8500. },
  8501. hide: function() {
  8502. var this$1 = this;
  8503. if (!this.isActive() || matches(this.$el, 'input:focus')) {
  8504. return;
  8505. }
  8506. this.toggleElement(this.tooltip, false, false).then(function () {
  8507. actives.splice(actives.indexOf(this$1), 1);
  8508. clearTimeout(this$1.showTimer);
  8509. this$1.tooltip = remove(this$1.tooltip);
  8510. this$1._unbind();
  8511. });
  8512. },
  8513. _show: function() {
  8514. var this$1 = this;
  8515. this.tooltip = append(this.container,
  8516. ("<div class=\"" + (this.clsPos) + "\"> <div class=\"" + (this.clsPos) + "-inner\">" + (this.title) + "</div> </div>")
  8517. );
  8518. on(this.tooltip, 'toggled', function () {
  8519. var toggled = this$1.isToggled(this$1.tooltip);
  8520. attr(this$1.$el, 'aria-expanded', toggled);
  8521. if (!toggled) {
  8522. return;
  8523. }
  8524. this$1.positionAt(this$1.tooltip, this$1.$el);
  8525. this$1.origin = this$1.getAxis() === 'y'
  8526. ? ((flipPosition(this$1.dir)) + "-" + (this$1.align))
  8527. : ((this$1.align) + "-" + (flipPosition(this$1.dir)));
  8528. });
  8529. this.toggleElement(this.tooltip, true);
  8530. },
  8531. isActive: function() {
  8532. return includes(actives, this);
  8533. }
  8534. },
  8535. events: ( obj$1 = {
  8536. focus: 'show',
  8537. blur: 'hide'
  8538. }, obj$1[(pointerEnter + " " + pointerLeave)] = function (e) {
  8539. if (isTouch(e)) {
  8540. return;
  8541. }
  8542. e.type === pointerEnter
  8543. ? this.show()
  8544. : this.hide();
  8545. }, obj$1[pointerDown] = function (e) {
  8546. if (!isTouch(e)) {
  8547. return;
  8548. }
  8549. this.isActive()
  8550. ? this.hide()
  8551. : this.show();
  8552. }, obj$1 )
  8553. };
  8554. var upload = {
  8555. props: {
  8556. allow: String,
  8557. clsDragover: String,
  8558. concurrent: Number,
  8559. maxSize: Number,
  8560. method: String,
  8561. mime: String,
  8562. msgInvalidMime: String,
  8563. msgInvalidName: String,
  8564. msgInvalidSize: String,
  8565. multiple: Boolean,
  8566. name: String,
  8567. params: Object,
  8568. type: String,
  8569. url: String
  8570. },
  8571. data: {
  8572. allow: false,
  8573. clsDragover: 'uk-dragover',
  8574. concurrent: 1,
  8575. maxSize: 0,
  8576. method: 'POST',
  8577. mime: false,
  8578. msgInvalidMime: 'Invalid File Type: %s',
  8579. msgInvalidName: 'Invalid File Name: %s',
  8580. msgInvalidSize: 'Invalid File Size: %s Kilobytes Max',
  8581. multiple: false,
  8582. name: 'files[]',
  8583. params: {},
  8584. type: '',
  8585. url: '',
  8586. abort: noop,
  8587. beforeAll: noop,
  8588. beforeSend: noop,
  8589. complete: noop,
  8590. completeAll: noop,
  8591. error: noop,
  8592. fail: noop,
  8593. load: noop,
  8594. loadEnd: noop,
  8595. loadStart: noop,
  8596. progress: noop
  8597. },
  8598. events: {
  8599. change: function(e) {
  8600. if (!matches(e.target, 'input[type="file"]')) {
  8601. return;
  8602. }
  8603. e.preventDefault();
  8604. if (e.target.files) {
  8605. this.upload(e.target.files);
  8606. }
  8607. e.target.value = '';
  8608. },
  8609. drop: function(e) {
  8610. stop(e);
  8611. var transfer = e.dataTransfer;
  8612. if (!transfer || !transfer.files) {
  8613. return;
  8614. }
  8615. removeClass(this.$el, this.clsDragover);
  8616. this.upload(transfer.files);
  8617. },
  8618. dragenter: function(e) {
  8619. stop(e);
  8620. },
  8621. dragover: function(e) {
  8622. stop(e);
  8623. addClass(this.$el, this.clsDragover);
  8624. },
  8625. dragleave: function(e) {
  8626. stop(e);
  8627. removeClass(this.$el, this.clsDragover);
  8628. }
  8629. },
  8630. methods: {
  8631. upload: function(files) {
  8632. var this$1 = this;
  8633. if (!files.length) {
  8634. return;
  8635. }
  8636. trigger(this.$el, 'upload', [files]);
  8637. for (var i = 0; i < files.length; i++) {
  8638. if (this.maxSize && this.maxSize * 1000 < files[i].size) {
  8639. this.fail(this.msgInvalidSize.replace('%s', this.maxSize));
  8640. return;
  8641. }
  8642. if (this.allow && !match$1(this.allow, files[i].name)) {
  8643. this.fail(this.msgInvalidName.replace('%s', this.allow));
  8644. return;
  8645. }
  8646. if (this.mime && !match$1(this.mime, files[i].type)) {
  8647. this.fail(this.msgInvalidMime.replace('%s', this.mime));
  8648. return;
  8649. }
  8650. }
  8651. if (!this.multiple) {
  8652. files = [files[0]];
  8653. }
  8654. this.beforeAll(this, files);
  8655. var chunks = chunk(files, this.concurrent);
  8656. var upload = function (files) {
  8657. var data = new FormData();
  8658. files.forEach(function (file) { return data.append(this$1.name, file); });
  8659. for (var key in this$1.params) {
  8660. data.append(key, this$1.params[key]);
  8661. }
  8662. ajax(this$1.url, {
  8663. data: data,
  8664. method: this$1.method,
  8665. responseType: this$1.type,
  8666. beforeSend: function (env) {
  8667. var xhr = env.xhr;
  8668. xhr.upload && on(xhr.upload, 'progress', this$1.progress);
  8669. ['loadStart', 'load', 'loadEnd', 'abort'].forEach(function (type) { return on(xhr, type.toLowerCase(), this$1[type]); }
  8670. );
  8671. this$1.beforeSend(env);
  8672. }
  8673. }).then(
  8674. function (xhr) {
  8675. this$1.complete(xhr);
  8676. if (chunks.length) {
  8677. upload(chunks.shift());
  8678. } else {
  8679. this$1.completeAll(xhr);
  8680. }
  8681. },
  8682. function (e) { return this$1.error(e); }
  8683. );
  8684. };
  8685. upload(chunks.shift());
  8686. }
  8687. }
  8688. };
  8689. function match$1(pattern, path) {
  8690. return path.match(new RegExp(("^" + (pattern.replace(/\//g, '\\/').replace(/\*\*/g, '(\\/[^\\/]+)*').replace(/\*/g, '[^\\/]+').replace(/((?!\\))\?/g, '$1.')) + "$"), 'i'));
  8691. }
  8692. function chunk(files, size) {
  8693. var chunks = [];
  8694. for (var i = 0; i < files.length; i += size) {
  8695. var chunk = [];
  8696. for (var j = 0; j < size; j++) {
  8697. chunk.push(files[i + j]);
  8698. }
  8699. chunks.push(chunk);
  8700. }
  8701. return chunks;
  8702. }
  8703. function stop(e) {
  8704. e.preventDefault();
  8705. e.stopPropagation();
  8706. }
  8707. var components$1 = /*#__PURE__*/Object.freeze({
  8708. __proto__: null,
  8709. Countdown: countdown,
  8710. Filter: filter$1,
  8711. Lightbox: lightbox,
  8712. LightboxPanel: LightboxPanel,
  8713. Notification: notification,
  8714. Parallax: parallax,
  8715. Slider: slider,
  8716. SliderParallax: sliderParallax,
  8717. Slideshow: slideshow,
  8718. SlideshowParallax: sliderParallax,
  8719. Sortable: sortable,
  8720. Tooltip: tooltip,
  8721. Upload: upload
  8722. });
  8723. each(components$1, function (component, name) { return UIkit.component(name, component); }
  8724. );
  8725. return UIkit;
  8726. })));