1/******/ (() => { // webpackBootstrap 2/******/ var __webpack_modules__ = ({ 3 4/***/ 9766: 5/***/ (function(module) { 6 7!function(n,t){ true?module.exports=t():0}(this,(function(){"use strict";function n(){return n=Object.assign||function(n){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i])}return n},n.apply(this,arguments)}var t="undefined"!=typeof window,e=t&&!("onscroll"in window)||"undefined"!=typeof navigator&&/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),i=t&&"IntersectionObserver"in window,o=t&&"classList"in document.createElement("p"),a=t&&window.devicePixelRatio>1,r={elements_selector:".lazy",container:e||t?document:null,threshold:300,thresholds:null,data_src:"src",data_srcset:"srcset",data_sizes:"sizes",data_bg:"bg",data_bg_hidpi:"bg-hidpi",data_bg_multi:"bg-multi",data_bg_multi_hidpi:"bg-multi-hidpi",data_bg_set:"bg-set",data_poster:"poster",class_applied:"applied",class_loading:"loading",class_loaded:"loaded",class_error:"error",class_entered:"entered",class_exited:"exited",unobserve_completed:!0,unobserve_entered:!1,cancel_on_exit:!0,callback_enter:null,callback_exit:null,callback_applied:null,callback_loading:null,callback_loaded:null,callback_error:null,callback_finish:null,callback_cancel:null,use_native:!1,restore_on_error:!1},c=function(t){return n({},r,t)},l=function(n,t){var e,i="LazyLoad::Initialized",o=new n(t);try{e=new CustomEvent(i,{detail:{instance:o}})}catch(n){(e=document.createEvent("CustomEvent")).initCustomEvent(i,!1,!1,{instance:o})}window.dispatchEvent(e)},u="src",s="srcset",d="sizes",f="poster",_="llOriginalAttrs",g="data",v="loading",b="loaded",m="applied",p="error",h="native",E="data-",I="ll-status",y=function(n,t){return n.getAttribute(E+t)},k=function(n){return y(n,I)},w=function(n,t){return function(n,t,e){var i="data-ll-status";null!==e?n.setAttribute(i,e):n.removeAttribute(i)}(n,0,t)},A=function(n){return w(n,null)},L=function(n){return null===k(n)},O=function(n){return k(n)===h},x=[v,b,m,p],C=function(n,t,e,i){n&&(void 0===i?void 0===e?n(t):n(t,e):n(t,e,i))},N=function(n,t){o?n.classList.add(t):n.className+=(n.className?" ":"")+t},M=function(n,t){o?n.classList.remove(t):n.className=n.className.replace(new RegExp("(^|\\s+)"+t+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},z=function(n){return n.llTempImage},T=function(n,t){if(t){var e=t._observer;e&&e.unobserve(n)}},R=function(n,t){n&&(n.loadingCount+=t)},G=function(n,t){n&&(n.toLoadCount=t)},j=function(n){for(var t,e=[],i=0;t=n.children[i];i+=1)"SOURCE"===t.tagName&&e.push(t);return e},D=function(n,t){var e=n.parentNode;e&&"PICTURE"===e.tagName&&j(e).forEach(t)},H=function(n,t){j(n).forEach(t)},V=[u],F=[u,f],B=[u,s,d],J=[g],P=function(n){return!!n[_]},S=function(n){return n[_]},U=function(n){return delete n[_]},$=function(n,t){if(!P(n)){var e={};t.forEach((function(t){e[t]=n.getAttribute(t)})),n[_]=e}},q=function(n,t){if(P(n)){var e=S(n);t.forEach((function(t){!function(n,t,e){e?n.setAttribute(t,e):n.removeAttribute(t)}(n,t,e[t])}))}},K=function(n,t,e){N(n,t.class_applied),w(n,m),e&&(t.unobserve_completed&&T(n,t),C(t.callback_applied,n,e))},Q=function(n,t,e){N(n,t.class_loading),w(n,v),e&&(R(e,1),C(t.callback_loading,n,e))},W=function(n,t,e){e&&n.setAttribute(t,e)},X=function(n,t){W(n,d,y(n,t.data_sizes)),W(n,s,y(n,t.data_srcset)),W(n,u,y(n,t.data_src))},Y={IMG:function(n,t){D(n,(function(n){$(n,B),X(n,t)})),$(n,B),X(n,t)},IFRAME:function(n,t){$(n,V),W(n,u,y(n,t.data_src))},VIDEO:function(n,t){H(n,(function(n){$(n,V),W(n,u,y(n,t.data_src))})),$(n,F),W(n,f,y(n,t.data_poster)),W(n,u,y(n,t.data_src)),n.load()},OBJECT:function(n,t){$(n,J),W(n,g,y(n,t.data_src))}},Z=["IMG","IFRAME","VIDEO","OBJECT"],nn=function(n,t){!t||function(n){return n.loadingCount>0}(t)||function(n){return n.toLoadCount>0}(t)||C(n.callback_finish,t)},tn=function(n,t,e){n.addEventListener(t,e),n.llEvLisnrs[t]=e},en=function(n,t,e){n.removeEventListener(t,e)},on=function(n){return!!n.llEvLisnrs},an=function(n){if(on(n)){var t=n.llEvLisnrs;for(var e in t){var i=t[e];en(n,e,i)}delete n.llEvLisnrs}},rn=function(n,t,e){!function(n){delete n.llTempImage}(n),R(e,-1),function(n){n&&(n.toLoadCount-=1)}(e),M(n,t.class_loading),t.unobserve_completed&&T(n,e)},cn=function(n,t,e){var i=z(n)||n;on(i)||function(n,t,e){on(n)||(n.llEvLisnrs={});var i="VIDEO"===n.tagName?"loadeddata":"load";tn(n,i,t),tn(n,"error",e)}(i,(function(o){!function(n,t,e,i){var o=O(t);rn(t,e,i),N(t,e.class_loaded),w(t,b),C(e.callback_loaded,t,i),o||nn(e,i)}(0,n,t,e),an(i)}),(function(o){!function(n,t,e,i){var o=O(t);rn(t,e,i),N(t,e.class_error),w(t,p),C(e.callback_error,t,i),e.restore_on_error&&q(t,B),o||nn(e,i)}(0,n,t,e),an(i)}))},ln=function(n,t,e){!function(n){return Z.indexOf(n.tagName)>-1}(n)?function(n,t,e){!function(n){n.llTempImage=document.createElement("IMG")}(n),cn(n,t,e),function(n){P(n)||(n[_]={backgroundImage:n.style.backgroundImage})}(n),function(n,t,e){var i=y(n,t.data_bg),o=y(n,t.data_bg_hidpi),r=a&&o?o:i;r&&(n.style.backgroundImage='url("'.concat(r,'")'),z(n).setAttribute(u,r),Q(n,t,e))}(n,t,e),function(n,t,e){var i=y(n,t.data_bg_multi),o=y(n,t.data_bg_multi_hidpi),r=a&&o?o:i;r&&(n.style.backgroundImage=r,K(n,t,e))}(n,t,e),function(n,t,e){var i=y(n,t.data_bg_set);if(i){var o=i.split("|"),a=o.map((function(n){return"image-set(".concat(n,")")}));n.style.backgroundImage=a.join(),""===n.style.backgroundImage&&(a=o.map((function(n){return"-webkit-image-set(".concat(n,")")})),n.style.backgroundImage=a.join()),K(n,t,e)}}(n,t,e)}(n,t,e):function(n,t,e){cn(n,t,e),function(n,t,e){var i=Y[n.tagName];i&&(i(n,t),Q(n,t,e))}(n,t,e)}(n,t,e)},un=function(n){n.removeAttribute(u),n.removeAttribute(s),n.removeAttribute(d)},sn=function(n){D(n,(function(n){q(n,B)})),q(n,B)},dn={IMG:sn,IFRAME:function(n){q(n,V)},VIDEO:function(n){H(n,(function(n){q(n,V)}
7)),q(n,F),n.load()},OBJECT:function(n){q(n,J)}},fn=function(n,t){(function(n){var t=dn[n.tagName];t?t(n):function(n){if(P(n)){var t=S(n);n.style.backgroundImage=t.backgroundImage}}(n)})(n),function(n,t){L(n)||O(n)||(M(n,t.class_entered),M(n,t.class_exited),M(n,t.class_applied),M(n,t.class_loading),M(n,t.class_loaded),M(n,t.class_error))}(n,t),A(n),U(n)},_n=["IMG","IFRAME","VIDEO"],gn=function(n){return n.use_native&&"loading"in HTMLImageElement.prototype},vn=function(n,t,e){n.forEach((function(n){return function(n){return n.isIntersecting||n.intersectionRatio>0}(n)?function(n,t,e,i){var o=function(n){return x.indexOf(k(n))>=0}(n);w(n,"entered"),N(n,e.class_entered),M(n,e.class_exited),function(n,t,e){t.unobserve_entered&&T(n,e)}(n,e,i),C(e.callback_enter,n,t,i),o||ln(n,e,i)}(n.target,n,t,e):function(n,t,e,i){L(n)||(N(n,e.class_exited),function(n,t,e,i){e.cancel_on_exit&&function(n){return k(n)===v}(n)&&"IMG"===n.tagName&&(an(n),function(n){D(n,(function(n){un(n)})),un(n)}(n),sn(n),M(n,e.class_loading),R(i,-1),A(n),C(e.callback_cancel,n,t,i))}(n,t,e,i),C(e.callback_exit,n,t,i))}(n.target,n,t,e)}))},bn=function(n){return Array.prototype.slice.call(n)},mn=function(n){return n.container.querySelectorAll(n.elements_selector)},pn=function(n){return function(n){return k(n)===p}(n)},hn=function(n,t){return function(n){return bn(n).filter(L)}(n||mn(t))},En=function(n,e){var o=c(n);this._settings=o,this.loadingCount=0,function(n,t){i&&!gn(n)&&(t._observer=new IntersectionObserver((function(e){vn(e,n,t)}),function(n){return{root:n.container===document?null:n.container,rootMargin:n.thresholds||n.threshold+"px"}}(n)))}(o,this),function(n,e){t&&(e._onlineHandler=function(){!function(n,t){var e;(e=mn(n),bn(e).filter(pn)).forEach((function(t){M(t,n.class_error),A(t)})),t.update()}(n,e)},window.addEventListener("online",e._onlineHandler))}(o,this),this.update(e)};return En.prototype={update:function(n){var t,o,a=this._settings,r=hn(n,a);G(this,r.length),!e&&i?gn(a)?function(n,t,e){n.forEach((function(n){-1!==_n.indexOf(n.tagName)&&function(n,t,e){n.setAttribute("loading","lazy"),cn(n,t,e),function(n,t){var e=Y[n.tagName];e&&e(n,t)}(n,t),w(n,h)}(n,t,e)})),G(e,0)}(r,a,this):(o=r,function(n){n.disconnect()}(t=this._observer),function(n,t){t.forEach((function(t){n.observe(t)}))}(t,o)):this.loadAll(r)},destroy:function(){this._observer&&this._observer.disconnect(),t&&window.removeEventListener("online",this._onlineHandler),mn(this._settings).forEach((function(n){U(n)})),delete this._observer,delete this._settings,delete this._onlineHandler,delete this.loadingCount,delete this.toLoadCount},loadAll:function(n){var t=this,e=this._settings;hn(n,e).forEach((function(n){T(n,t),ln(n,e,t)}))},restoreAll:function(){var n=this._settings;mn(n).forEach((function(t){fn(t,n)}))}},En.load=function(n,t){var e=c(t);ln(n,e)},En.resetStatus=function(n){A(n)},t&&function(n,t){if(t)if(t.length)for(var e,i=0;e=t[i];i+=1)l(n,e);else l(n,t)}(En,window.lazyLoadOptions),En})); 8 9 10/***/ }) 11 12/******/ }); 13/************************************************************************/ 14/******/ // The module cache 15/******/ var __webpack_module_cache__ = {}; 16/******/ 17/******/ // The require function 18/******/ function __webpack_require__(moduleId) { 19/******/ // Check if module is in cache 20/******/ var cachedModule = __webpack_module_cache__[moduleId]; 21/******/ if (cachedModule !== undefined) { 22/******/ return cachedModule.exports; 23/******/ } 24/******/ // Create a new module (and put it into the cache) 25/******/ var module = __webpack_module_cache__[moduleId] = { 26/******/ // no module.id needed 27/******/ // no module.loaded needed 28/******/ exports: {} 29/******/ }; 30/******/ 31/******/ // Execute the module function 32/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); 33/******/ 34/******/ // Return the exports of the module 35/******/ return module.exports; 36/******/ } 37/******/ 38/************************************************************************/ 39/******/ /* webpack/runtime/compat get default export */ 40/******/ (() => { 41/******/ // getDefaultExport function for compatibility with non-harmony modules 42/******/ __webpack_require__.n = (module) => {
vendor: 4,125 bytes, lines 43-170
43/******/ var getter = module && module.__esModule ? 44/******/ () => (module['default']) : 45/******/ () => (module); 46/******/ __webpack_require__.d(getter, { a: getter }); 47/******/ return getter; 48/******/ }; 49/******/ })(); 50/******/ 51/******/ /* webpack/runtime/define property getters */ 52/******/ (() => { 53/******/ // define getter functions for harmony exports 54/******/ __webpack_require__.d = (exports, definition) => { 55/******/ for(var key in definition) { 56/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 57/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 58/******/ } 59/******/ } 60/******/ }; 61/******/ })(); 62/******/ 63/******/ /* webpack/runtime/hasOwnProperty shorthand */ 64/******/ (() => { 65/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) 66/******/ })(); 67/******/ 68/************************************************************************/ 69var __webpack_exports__ = {}; 70// This entry need to be wrapped in an IIFE because it need to be in strict mode. 71(() => { 72"use strict"; 73 74// EXTERNAL MODULE: ../../node_modules/vanilla-lazyload/dist/lazyload.min.js 75var lazyload_min = __webpack_require__(9766); 76var lazyload_min_default = /*#__PURE__*/__webpack_require__.n(lazyload_min); 77;// CONCATENATED MODULE: ./assets/js/_pages/home/components/lazyload.js 78 79/* harmony default export */ const lazyload = (function () { 80 // eslint-disable-next-line no-new 81 new (lazyload_min_default())({ 82 threshold: 0 83 }); 84}); 85;// CONCATENATED MODULE: ../../node_modules/@glidejs/glide/dist/glide.esm.js 86/*! 87 * Glide.js v3.5.2 88 * (c) 2013-2021 JÄdrzej ChaÅubek (https://github.com/jedrzejchalubek/) 89 * Released under the MIT License. 90 */ 91 92function _typeof(obj) { 93 "@babel/helpers - typeof"; 94 95 if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { 96 _typeof = function (obj) { 97 return typeof obj; 98 }; 99 } else { 100 _typeof = function (obj) { 101 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; 102 }; 103 } 104 105 return _typeof(obj); 106} 107 108function _classCallCheck(instance, Constructor) { 109 if (!(instance instanceof Constructor)) { 110 throw new TypeError("Cannot call a class as a function"); 111 } 112} 113 114function _defineProperties(target, props) { 115 for (var i = 0; i < props.length; i++) { 116 var descriptor = props[i]; 117 descriptor.enumerable = descriptor.enumerable || false; 118 descriptor.configurable = true; 119 if ("value" in descriptor) descriptor.writable = true; 120 Object.defineProperty(target, descriptor.key, descriptor); 121 } 122} 123 124function _createClass(Constructor, protoProps, staticProps) { 125 if (protoProps) _defineProperties(Constructor.prototype, protoProps); 126 if (staticProps) _defineProperties(Constructor, staticProps); 127 return Constructor; 128} 129 130function _inherits(subClass, superClass) { 131 if (typeof superClass !== "function" && superClass !== null) { 132 throw new TypeError("Super expression must either be null or a function"); 133 } 134 135 subClass.prototype = Object.create(superClass && superClass.prototype, { 136 constructor: { 137 value: subClass, 138 writable: true, 139 configurable: true 140 } 141 }); 142 if (superClass) _setPrototypeOf(subClass, superClass); 143} 144 145function _getPrototypeOf(o) { 146 _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { 147 return o.__proto__ || Object.getPrototypeOf(o); 148 }; 149 return _getPrototypeOf(o); 150} 151 152function _setPrototypeOf(o, p) { 153 _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { 154 o.__proto__ = p; 155 return o; 156 }; 157 158 return _setPrototypeOf(o, p); 159} 160 161function _isNativeReflectConstruct() { 162 if (typeof Reflect === "undefined" || !Reflect.construct) return false; 163 if (Reflect.construct.sham) return false; 164 if (typeof Proxy === "function") return true; 165 166 try { 167 Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); 168 return true; 169 } catch (e) { 170 return false;
vendor: 58,443 bytes, lines 171-2714
171 } 172} 173 174function _assertThisInitialized(self) { 175 if (self === void 0) { 176 throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 177 } 178 179 return self; 180} 181 182function _possibleConstructorReturn(self, call) { 183 if (call && (typeof call === "object" || typeof call === "function")) { 184 return call; 185 } else if (call !== void 0) { 186 throw new TypeError("Derived constructors may only return object or undefined"); 187 } 188 189 return _assertThisInitialized(self); 190} 191 192function _createSuper(Derived) { 193 var hasNativeReflectConstruct = _isNativeReflectConstruct(); 194 195 return function _createSuperInternal() { 196 var Super = _getPrototypeOf(Derived), 197 result; 198 199 if (hasNativeReflectConstruct) { 200 var NewTarget = _getPrototypeOf(this).constructor; 201 202 result = Reflect.construct(Super, arguments, NewTarget); 203 } else { 204 result = Super.apply(this, arguments); 205 } 206 207 return _possibleConstructorReturn(this, result); 208 }; 209} 210 211function _superPropBase(object, property) { 212 while (!Object.prototype.hasOwnProperty.call(object, property)) { 213 object = _getPrototypeOf(object); 214 if (object === null) break; 215 } 216 217 return object; 218} 219 220function _get() { 221 if (typeof Reflect !== "undefined" && Reflect.get) { 222 _get = Reflect.get; 223 } else { 224 _get = function _get(target, property, receiver) { 225 var base = _superPropBase(target, property); 226 227 if (!base) return; 228 var desc = Object.getOwnPropertyDescriptor(base, property); 229 230 if (desc.get) { 231 return desc.get.call(arguments.length < 3 ? target : receiver); 232 } 233 234 return desc.value; 235 }; 236 } 237 238 return _get.apply(this, arguments); 239} 240 241var defaults = { 242 /** 243 * Type of the movement. 244 * 245 * Available types: 246 * `slider` - Rewinds slider to the start/end when it reaches the first or last slide. 247 * `carousel` - Changes slides without starting over when it reaches the first or last slide. 248 * 249 * @type {String} 250 */ 251 type: 'slider', 252 253 /** 254 * Start at specific slide number defined with zero-based index. 255 * 256 * @type {Number} 257 */ 258 startAt: 0, 259 260 /** 261 * A number of slides visible on the single viewport. 262 * 263 * @type {Number} 264 */ 265 perView: 1, 266 267 /** 268 * Focus currently active slide at a specified position in the track. 269 * 270 * Available inputs: 271 * `center` - Current slide will be always focused at the center of a track. 272 * `0,1,2,3...` - Current slide will be focused on the specified zero-based index. 273 * 274 * @type {String|Number} 275 */ 276 focusAt: 0, 277 278 /** 279 * A size of the gap added between slides. 280 * 281 * @type {Number} 282 */ 283 gap: 10, 284 285 /** 286 * Change slides after a specified interval. Use `false` for turning off autoplay. 287 * 288 * @type {Number|Boolean} 289 */ 290 autoplay: false, 291 292 /** 293 * Stop autoplay on mouseover event. 294 * 295 * @type {Boolean} 296 */ 297 hoverpause: true, 298 299 /** 300 * Allow for changing slides with left and right keyboard arrows. 301 * 302 * @type {Boolean} 303 */ 304 keyboard: true, 305 306 /** 307 * Stop running `perView` number of slides from the end. Use this 308 * option if you don't want to have an empty space after 309 * a slider. Works only with `slider` type and a 310 * non-centered `focusAt` setting. 311 * 312 * @type {Boolean} 313 */ 314 bound: false, 315 316 /** 317 * Minimal swipe distance needed to change the slide. Use `false` for turning off a swiping. 318 * 319 * @type {Number|Boolean} 320 */ 321 swipeThreshold: 80, 322 323 /** 324 * Minimal mouse drag distance needed to change the slide. Use `false` for turning off a dragging. 325 * 326 * @type {Number|Boolean} 327 */ 328 dragThreshold: 120, 329 330 /** 331 * A number of slides moved on single swipe. 332 * 333 * Available types: 334 * `` - Moves slider by one slide per swipe 335 * `|` - Moves slider between views per swipe (number of slides defined in `perView` options) 336 * 337 * @type {String} 338 */ 339 perSwipe: '', 340 341 /** 342 * Moving distance ratio of the slides on a swiping and dragging. 343 * 344 * @type {Number} 345 */ 346 touchRatio: 0.5, 347 348 /** 349 * Angle required to activate slides moving on swiping or dragging. 350 * 351 * @type {Number} 352 */ 353 touchAngle: 45, 354 355 /** 356 * Duration of the animation in milliseconds. 357 * 358 * @type {Number} 359 */ 360 animationDuration: 400, 361 362 /** 363 * Allows looping the `slider` type. Slider will rewind to the first/last slide when it's at the start/end. 364 * 365 * @type {Boolean} 366 */ 367 rewind: true, 368 369 /** 370 * Duration of the rewinding animation of the `slider` type in milliseconds. 371 * 372 * @type {Number} 373 */ 374 rewindDuration: 800, 375 376 /** 377 * Easing function for the animation. 378 * 379 * @type {String} 380 */ 381 animationTimingFunc: 'cubic-bezier(.165, .840, .440, 1)', 382 383 /** 384 * Wait for the animation to finish until the next user input can be processed 385 * 386 * @type {boolean} 387 */ 388 waitForTransition: true, 389 390 /** 391 * Throttle costly events at most once per every wait milliseconds. 392 * 393 * @type {Number} 394 */ 395 throttle: 10, 396 397 /** 398 * Moving direction mode. 399 * 400 * Available inputs: 401 * - 'ltr' - left to right movement, 402 * - 'rtl' - right to left movement. 403 * 404 * @type {String} 405 */ 406 direction: 'ltr', 407 408 /** 409 * The distance value of the next and previous viewports which 410 * have to peek in the current view. Accepts number and 411 * pixels as a string. Left and right peeking can be 412 * set up separately with a directions object. 413 * 414 * For example: 415 * `100` - Peek 100px on the both sides. 416 * { before: 100, after: 50 }` - Peek 100px on the left side and 50px on the right side. 417 * 418 * @type {Number|String|Object} 419 */ 420 peek: 0, 421 422 /** 423 * Defines how many clones of current viewport will be generated. 424 * 425 * @type {Number} 426 */ 427 cloningRatio: 1, 428 429 /** 430 * Collection of options applied at specified media breakpoints. 431 * For example: display two slides per view under 800px. 432 * `{ 433 * '800px': { 434 * perView: 2 435 * } 436 * }` 437 */ 438 breakpoints: {}, 439 440 /** 441 * Collection of internally used HTML classes. 442 * 443 * @todo Refactor `slider` and `carousel` properties to single `type: { slider: '', carousel: '' }` object 444 * @type {Object} 445 */ 446 classes: { 447 swipeable: 'glide--swipeable', 448 dragging: 'glide--dragging', 449 direction: { 450 ltr: 'glide--ltr', 451 rtl: 'glide--rtl' 452 }, 453 type: { 454 slider: 'glide--slider', 455 carousel: 'glide--carousel' 456 }, 457 slide: { 458 clone: 'glide__slide--clone', 459 active: 'glide__slide--active' 460 }, 461 arrow: { 462 disabled: 'glide__arrow--disabled' 463 }, 464 nav: { 465 active: 'glide__bullet--active' 466 } 467 } 468}; 469 470/** 471 * Outputs warning message to the bowser console. 472 * 473 * @param {String} msg 474 * @return {Void} 475 */ 476function warn(msg) { 477 console.error("[Glide warn]: ".concat(msg)); 478} 479 480/** 481 * Converts value entered as number 482 * or string to integer value. 483 * 484 * @param {String} value 485 * @returns {Number} 486 */ 487function toInt(value) { 488 return parseInt(value); 489} 490/** 491 * Converts value entered as number 492 * or string to flat value. 493 * 494 * @param {String} value 495 * @returns {Number} 496 */ 497 498function toFloat(value) { 499 return parseFloat(value); 500} 501/** 502 * Indicates whether the specified value is a string. 503 * 504 * @param {*} value 505 * @return {Boolean} 506 */ 507 508function isString(value) { 509 return typeof value === 'string'; 510} 511/** 512 * Indicates whether the specified value is an object. 513 * 514 * @param {*} value 515 * @return {Boolean} 516 * 517 * @see https://github.com/jashkenas/underscore 518 */ 519 520function isObject(value) { 521 var type = _typeof(value); 522 523 return type === 'function' || type === 'object' && !!value; // eslint-disable-line no-mixed-operators 524} 525/** 526 * Indicates whether the specified value is a function. 527 * 528 * @param {*} value 529 * @return {Boolean} 530 */ 531 532function isFunction(value) { 533 return typeof value === 'function'; 534} 535/** 536 * Indicates whether the specified value is undefined. 537 * 538 * @param {*} value 539 * @return {Boolean} 540 */ 541 542function isUndefined(value) { 543 return typeof value === 'undefined'; 544} 545/** 546 * Indicates whether the specified value is an array. 547 * 548 * @param {*} value 549 * @return {Boolean} 550 */ 551 552function isArray(value) { 553 return value.constructor === Array; 554} 555 556/** 557 * Creates and initializes specified collection of extensions. 558 * Each extension receives access to instance of glide and rest of components. 559 * 560 * @param {Object} glide 561 * @param {Object} extensions 562 * 563 * @returns {Object} 564 */ 565 566function mount(glide, extensions, events) { 567 var components = {}; 568 569 for (var name in extensions) { 570 if (isFunction(extensions[name])) { 571 components[name] = extensions[name](glide, components, events); 572 } else { 573 warn('Extension must be a function'); 574 } 575 } 576 577 for (var _name in components) { 578 if (isFunction(components[_name].mount)) { 579 components[_name].mount(); 580 } 581 } 582 583 return components; 584} 585 586/** 587 * Defines getter and setter property on the specified object. 588 * 589 * @param {Object} obj Object where property has to be defined. 590 * @param {String} prop Name of the defined property. 591 * @param {Object} definition Get and set definitions for the property. 592 * @return {Void} 593 */ 594function glide_esm_define(obj, prop, definition) { 595 Object.defineProperty(obj, prop, definition); 596} 597/** 598 * Sorts aphabetically object keys. 599 * 600 * @param {Object} obj 601 * @return {Object} 602 */ 603 604function sortKeys(obj) { 605 return Object.keys(obj).sort().reduce(function (r, k) { 606 r[k] = obj[k]; 607 return r[k], r; 608 }, {}); 609} 610/** 611 * Merges passed settings object with default options. 612 * 613 * @param {Object} defaults 614 * @param {Object} settings 615 * @return {Object} 616 */ 617 618function mergeOptions(defaults, settings) { 619 var options = Object.assign({}, defaults, settings); // `Object.assign` do not deeply merge objects, so we 620 // have to do it manually for every nested object 621 // in options. Although it does not look smart, 622 // it's smaller and faster than some fancy 623 // merging deep-merge algorithm script. 624 625 if (settings.hasOwnProperty('classes')) { 626 options.classes = Object.assign({}, defaults.classes, settings.classes); 627 628 if (settings.classes.hasOwnProperty('direction')) { 629 options.classes.direction = Object.assign({}, defaults.classes.direction, settings.classes.direction); 630 } 631 632 if (settings.classes.hasOwnProperty('type')) { 633 options.classes.type = Object.assign({}, defaults.classes.type, settings.classes.type); 634 } 635 636 if (settings.classes.hasOwnProperty('slide')) { 637 options.classes.slide = Object.assign({}, defaults.classes.slide, settings.classes.slide); 638 } 639 640 if (settings.classes.hasOwnProperty('arrow')) { 641 options.classes.arrow = Object.assign({}, defaults.classes.arrow, settings.classes.arrow); 642 } 643 644 if (settings.classes.hasOwnProperty('nav')) { 645 options.classes.nav = Object.assign({}, defaults.classes.nav, settings.classes.nav); 646 } 647 } 648 649 if (settings.hasOwnProperty('breakpoints')) { 650 options.breakpoints = Object.assign({}, defaults.breakpoints, settings.breakpoints); 651 } 652 653 return options; 654} 655 656var EventsBus = /*#__PURE__*/function () { 657 /** 658 * Construct a EventBus instance. 659 * 660 * @param {Object} events 661 */ 662 function EventsBus() { 663 var events = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 664 665 _classCallCheck(this, EventsBus); 666 667 this.events = events; 668 this.hop = events.hasOwnProperty; 669 } 670 /** 671 * Adds listener to the specifed event. 672 * 673 * @param {String|Array} event 674 * @param {Function} handler 675 */ 676 677 678 _createClass(EventsBus, [{ 679 key: "on", 680 value: function on(event, handler) { 681 if (isArray(event)) { 682 for (var i = 0; i < event.length; i++) { 683 this.on(event[i], handler); 684 } 685 686 return; 687 } // Create the event's object if not yet created 688 689 690 if (!this.hop.call(this.events, event)) { 691 this.events[event] = []; 692 } // Add the handler to queue 693 694 695 var index = this.events[event].push(handler) - 1; // Provide handle back for removal of event 696 697 return { 698 remove: function remove() { 699 delete this.events[event][index]; 700 } 701 }; 702 } 703 /** 704 * Runs registered handlers for specified event. 705 * 706 * @param {String|Array} event 707 * @param {Object=} context 708 */ 709 710 }, { 711 key: "emit", 712 value: function emit(event, context) { 713 if (isArray(event)) { 714 for (var i = 0; i < event.length; i++) { 715 this.emit(event[i], context); 716 } 717 718 return; 719 } // If the event doesn't exist, or there's no handlers in queue, just leave 720 721 722 if (!this.hop.call(this.events, event)) { 723 return; 724 } // Cycle through events queue, fire! 725 726 727 this.events[event].forEach(function (item) { 728 item(context || {}); 729 }); 730 } 731 }]); 732 733 return EventsBus; 734}(); 735 736var Glide$1 = /*#__PURE__*/function () { 737 /** 738 * Construct glide. 739 * 740 * @param {String} selector 741 * @param {Object} options 742 */ 743 function Glide(selector) { 744 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 745 746 _classCallCheck(this, Glide); 747 748 this._c = {}; 749 this._t = []; 750 this._e = new EventsBus(); 751 this.disabled = false; 752 this.selector = selector; 753 this.settings = mergeOptions(defaults, options); 754 this.index = this.settings.startAt; 755 } 756 /** 757 * Initializes glide. 758 * 759 * @param {Object} extensions Collection of extensions to initialize. 760 * @return {Glide} 761 */ 762 763 764 _createClass(Glide, [{ 765 key: "mount", 766 value: function mount$1() { 767 var extensions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 768 769 this._e.emit('mount.before'); 770 771 if (isObject(extensions)) { 772 this._c = mount(this, extensions, this._e); 773 } else { 774 warn('You need to provide a object on `mount()`'); 775 } 776 777 this._e.emit('mount.after'); 778 779 return this; 780 } 781 /** 782 * Collects an instance `translate` transformers. 783 * 784 * @param {Array} transformers Collection of transformers. 785 * @return {Void} 786 */ 787 788 }, { 789 key: "mutate", 790 value: function mutate() { 791 var transformers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; 792 793 if (isArray(transformers)) { 794 this._t = transformers; 795 } else { 796 warn('You need to provide a array on `mutate()`'); 797 } 798 799 return this; 800 } 801 /** 802 * Updates glide with specified settings. 803 * 804 * @param {Object} settings 805 * @return {Glide} 806 */ 807 808 }, { 809 key: "update", 810 value: function update() { 811 var settings = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 812 this.settings = mergeOptions(this.settings, settings); 813 814 if (settings.hasOwnProperty('startAt')) { 815 this.index = settings.startAt; 816 } 817 818 this._e.emit('update'); 819 820 return this; 821 } 822 /** 823 * Change slide with specified pattern. A pattern must be in the special format: 824 * `>` - Move one forward 825 * `<` - Move one backward 826 * `={i}` - Go to {i} zero-based slide (eq. '=1', will go to second slide) 827 * `>>` - Rewinds to end (last slide) 828 * `<<` - Rewinds to start (first slide) 829 * `|>` - Move one viewport forward 830 * `|<` - Move one viewport backward 831 * 832 * @param {String} pattern 833 * @return {Glide} 834 */ 835 836 }, { 837 key: "go", 838 value: function go(pattern) { 839 this._c.Run.make(pattern); 840 841 return this; 842 } 843 /** 844 * Move track by specified distance. 845 * 846 * @param {String} distance 847 * @return {Glide} 848 */ 849 850 }, { 851 key: "move", 852 value: function move(distance) { 853 this._c.Transition.disable(); 854 855 this._c.Move.make(distance); 856 857 return this; 858 } 859 /** 860 * Destroy instance and revert all changes done by this._c. 861 * 862 * @return {Glide} 863 */ 864 865 }, { 866 key: "destroy", 867 value: function destroy() { 868 this._e.emit('destroy'); 869 870 return this; 871 } 872 /** 873 * Start instance autoplaying. 874 * 875 * @param {Boolean|Number} interval Run autoplaying with passed interval regardless of `autoplay` settings 876 * @return {Glide} 877 */ 878 879 }, { 880 key: "play", 881 value: function play() { 882 var interval = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; 883 884 if (interval) { 885 this.settings.autoplay = interval; 886 } 887 888 this._e.emit('play'); 889 890 return this; 891 } 892 /** 893 * Stop instance autoplaying. 894 * 895 * @return {Glide} 896 */ 897 898 }, { 899 key: "pause", 900 value: function pause() { 901 this._e.emit('pause'); 902 903 return this; 904 } 905 /** 906 * Sets glide into a idle status. 907 * 908 * @return {Glide} 909 */ 910 911 }, { 912 key: "disable", 913 value: function disable() { 914 this.disabled = true; 915 return this; 916 } 917 /** 918 * Sets glide into a active status. 919 * 920 * @return {Glide} 921 */ 922 923 }, { 924 key: "enable", 925 value: function enable() { 926 this.disabled = false; 927 return this; 928 } 929 /** 930 * Adds cuutom event listener with handler. 931 * 932 * @param {String|Array} event 933 * @param {Function} handler 934 * @return {Glide} 935 */ 936 937 }, { 938 key: "on", 939 value: function on(event, handler) { 940 this._e.on(event, handler); 941 942 return this; 943 } 944 /** 945 * Checks if glide is a precised type. 946 * 947 * @param {String} name 948 * @return {Boolean} 949 */ 950 951 }, { 952 key: "isType", 953 value: function isType(name) { 954 return this.settings.type === name; 955 } 956 /** 957 * Gets value of the core options. 958 * 959 * @return {Object} 960 */ 961 962 }, { 963 key: "settings", 964 get: function get() { 965 return this._o; 966 } 967 /** 968 * Sets value of the core options. 969 * 970 * @param {Object} o 971 * @return {Void} 972 */ 973 , 974 set: function set(o) { 975 if (isObject(o)) { 976 this._o = o; 977 } else { 978 warn('Options must be an `object` instance.'); 979 } 980 } 981 /** 982 * Gets current index of the slider. 983 * 984 * @return {Object} 985 */ 986 987 }, { 988 key: "index", 989 get: function get() { 990 return this._i; 991 } 992 /** 993 * Sets current index a slider. 994 * 995 * @return {Object} 996 */ 997 , 998 set: function set(i) { 999 this._i = toInt(i); 1000 } 1001 /** 1002 * Gets type name of the slider. 1003 * 1004 * @return {String} 1005 */ 1006 1007 }, { 1008 key: "type", 1009 get: function get() { 1010 return this.settings.type; 1011 } 1012 /** 1013 * Gets value of the idle status. 1014 * 1015 * @return {Boolean} 1016 */ 1017 1018 }, { 1019 key: "disabled", 1020 get: function get() { 1021 return this._d; 1022 } 1023 /** 1024 * Sets value of the idle status. 1025 * 1026 * @return {Boolean} 1027 */ 1028 , 1029 set: function set(status) { 1030 this._d = !!status; 1031 } 1032 }]); 1033 1034 return Glide; 1035}(); 1036 1037function Run (Glide, Components, Events) { 1038 var Run = { 1039 /** 1040 * Initializes autorunning of the glide. 1041 * 1042 * @return {Void} 1043 */ 1044 mount: function mount() { 1045 this._o = false; 1046 }, 1047 1048 /** 1049 * Makes glides running based on the passed moving schema. 1050 * 1051 * @param {String} move 1052 */ 1053 make: function make(move) { 1054 var _this = this; 1055 1056 if (!Glide.disabled) { 1057 !Glide.settings.waitForTransition || Glide.disable(); 1058 this.move = move; 1059 Events.emit('run.before', this.move); 1060 this.calculate(); 1061 Events.emit('run', this.move); 1062 Components.Transition.after(function () { 1063 if (_this.isStart()) { 1064 Events.emit('run.start', _this.move); 1065 } 1066 1067 if (_this.isEnd()) { 1068 Events.emit('run.end', _this.move); 1069 } 1070 1071 if (_this.isOffset()) { 1072 _this._o = false; 1073 Events.emit('run.offset', _this.move); 1074 } 1075 1076 Events.emit('run.after', _this.move); 1077 Glide.enable(); 1078 }); 1079 } 1080 }, 1081 1082 /** 1083 * Calculates current index based on defined move. 1084 * 1085 * @return {Number|Undefined} 1086 */ 1087 calculate: function calculate() { 1088 var move = this.move, 1089 length = this.length; 1090 var steps = move.steps, 1091 direction = move.direction; // By default assume that size of view is equal to one slide 1092 1093 var viewSize = 1; // While direction is `=` we want jump to 1094 // a specified index described in steps. 1095 1096 if (direction === '=') { 1097 // Check if bound is true, 1098 // as we want to avoid whitespaces. 1099 if (Glide.settings.bound && toInt(steps) > length) { 1100 Glide.index = length; 1101 return; 1102 } 1103 1104 Glide.index = steps; 1105 return; 1106 } // When pattern is equal to `>>` we want 1107 // fast forward to the last slide. 1108 1109 1110 if (direction === '>' && steps === '>') { 1111 Glide.index = length; 1112 return; 1113 } // When pattern is equal to `<<` we want 1114 // fast forward to the first slide. 1115 1116 1117 if (direction === '<' && steps === '<') { 1118 Glide.index = 0; 1119 return; 1120 } // pagination movement 1121 1122 1123 if (direction === '|') { 1124 viewSize = Glide.settings.perView || 1; 1125 } // we are moving forward 1126 1127 1128 if (direction === '>' || direction === '|' && steps === '>') { 1129 var index = calculateForwardIndex(viewSize); 1130 1131 if (index > length) { 1132 this._o = true; 1133 } 1134 1135 Glide.index = normalizeForwardIndex(index, viewSize); 1136 return; 1137 } // we are moving backward 1138 1139 1140 if (direction === '<' || direction === '|' && steps === '<') { 1141 var _index = calculateBackwardIndex(viewSize); 1142 1143 if (_index < 0) { 1144 this._o = true; 1145 } 1146 1147 Glide.index = normalizeBackwardIndex(_index, viewSize); 1148 return; 1149 } 1150 1151 warn("Invalid direction pattern [".concat(direction).concat(steps, "] has been used")); 1152 }, 1153 1154 /** 1155 * Checks if we are on the first slide. 1156 * 1157 * @return {Boolean} 1158 */ 1159 isStart: function isStart() { 1160 return Glide.index <= 0; 1161 }, 1162 1163 /** 1164 * Checks if we are on the last slide. 1165 * 1166 * @return {Boolean} 1167 */ 1168 isEnd: function isEnd() { 1169 return Glide.index >= this.length; 1170 }, 1171 1172 /** 1173 * Checks if we are making a offset run. 1174 * 1175 * @param {String} direction 1176 * @return {Boolean} 1177 */ 1178 isOffset: function isOffset() { 1179 var direction = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined; 1180 1181 if (!direction) { 1182 return this._o; 1183 } 1184 1185 if (!this._o) { 1186 return false; 1187 } // did we view to the right? 1188 1189 1190 if (direction === '|>') { 1191 return this.move.direction === '|' && this.move.steps === '>'; 1192 } // did we view to the left? 1193 1194 1195 if (direction === '|<') { 1196 return this.move.direction === '|' && this.move.steps === '<'; 1197 } 1198 1199 return this.move.direction === direction; 1200 }, 1201 1202 /** 1203 * Checks if bound mode is active 1204 * 1205 * @return {Boolean} 1206 */ 1207 isBound: function isBound() { 1208 return Glide.isType('slider') && Glide.settings.focusAt !== 'center' && Glide.settings.bound; 1209 } 1210 }; 1211 /** 1212 * Returns index value to move forward/to the right 1213 * 1214 * @param viewSize 1215 * @returns {Number} 1216 */ 1217 1218 function calculateForwardIndex(viewSize) { 1219 var index = Glide.index; 1220 1221 if (Glide.isType('carousel')) { 1222 return index + viewSize; 1223 } 1224 1225 return index + (viewSize - index % viewSize); 1226 } 1227 /** 1228 * Normalizes the given forward index based on glide settings, preventing it to exceed certain boundaries 1229 * 1230 * @param index 1231 * @param length 1232 * @param viewSize 1233 * @returns {Number} 1234 */ 1235 1236 1237 function normalizeForwardIndex(index, viewSize) { 1238 var length = Run.length; 1239 1240 if (index <= length) { 1241 return index; 1242 } 1243 1244 if (Glide.isType('carousel')) { 1245 return index - (length + 1); 1246 } 1247 1248 if (Glide.settings.rewind) { 1249 // bound does funny things with the length, therefor we have to be certain 1250 // that we are on the last possible index value given by bound 1251 if (Run.isBound() && !Run.isEnd()) { 1252 return length; 1253 } 1254 1255 return 0; 1256 } 1257 1258 if (Run.isBound()) { 1259 return length; 1260 } 1261 1262 return Math.floor(length / viewSize) * viewSize; 1263 } 1264 /** 1265 * Calculates index value to move backward/to the left 1266 * 1267 * @param viewSize 1268 * @returns {Number} 1269 */ 1270 1271 1272 function calculateBackwardIndex(viewSize) { 1273 var index = Glide.index; 1274 1275 if (Glide.isType('carousel')) { 1276 return index - viewSize; 1277 } // ensure our back navigation results in the same index as a forward navigation 1278 // to experience a homogeneous paging 1279 1280 1281 var view = Math.ceil(index / viewSize); 1282 return (view - 1) * viewSize; 1283 } 1284 /** 1285 * Normalizes the given backward index based on glide settings, preventing it to exceed certain boundaries 1286 * 1287 * @param index 1288 * @param length 1289 * @param viewSize 1290 * @returns {*} 1291 */ 1292 1293 1294 function normalizeBackwardIndex(index, viewSize) { 1295 var length = Run.length; 1296 1297 if (index >= 0) { 1298 return index; 1299 } 1300 1301 if (Glide.isType('carousel')) { 1302 return index + (length + 1); 1303 } 1304 1305 if (Glide.settings.rewind) { 1306 // bound does funny things with the length, therefor we have to be certain 1307 // that we are on first possible index value before we to rewind to the length given by bound 1308 if (Run.isBound() && Run.isStart()) { 1309 return length; 1310 } 1311 1312 return Math.floor(length / viewSize) * viewSize; 1313 } 1314 1315 return 0; 1316 } 1317 1318 glide_esm_define(Run, 'move', { 1319 /** 1320 * Gets value of the move schema. 1321 * 1322 * @returns {Object} 1323 */ 1324 get: function get() { 1325 return this._m; 1326 }, 1327 1328 /** 1329 * Sets value of the move schema. 1330 * 1331 * @returns {Object} 1332 */ 1333 set: function set(value) { 1334 var step = value.substr(1); 1335 this._m = { 1336 direction: value.substr(0, 1), 1337 steps: step ? toInt(step) ? toInt(step) : step : 0 1338 }; 1339 } 1340 }); 1341 glide_esm_define(Run, 'length', { 1342 /** 1343 * Gets value of the running distance based 1344 * on zero-indexing number of slides. 1345 * 1346 * @return {Number} 1347 */ 1348 get: function get() { 1349 var settings = Glide.settings; 1350 var length = Components.Html.slides.length; // If the `bound` option is active, a maximum running distance should be 1351 // reduced by `perView` and `focusAt` settings. Running distance 1352 // should end before creating an empty space after instance. 1353 1354 if (this.isBound()) { 1355 return length - 1 - (toInt(settings.perView) - 1) + toInt(settings.focusAt); 1356 } 1357 1358 return length - 1; 1359 } 1360 }); 1361 glide_esm_define(Run, 'offset', { 1362 /** 1363 * Gets status of the offsetting flag. 1364 * 1365 * @return {Boolean} 1366 */ 1367 get: function get() { 1368 return this._o; 1369 } 1370 }); 1371 return Run; 1372} 1373 1374/** 1375 * Returns a current time. 1376 * 1377 * @return {Number} 1378 */ 1379function now() { 1380 return new Date().getTime(); 1381} 1382 1383/** 1384 * Returns a function, that, when invoked, will only be triggered 1385 * at most once during a given window of time. 1386 * 1387 * @param {Function} func 1388 * @param {Number} wait 1389 * @param {Object=} options 1390 * @return {Function} 1391 * 1392 * @see https://github.com/jashkenas/underscore 1393 */ 1394 1395function throttle(func, wait, options) { 1396 var timeout, context, args, result; 1397 var previous = 0; 1398 if (!options) options = {}; 1399 1400 var later = function later() { 1401 previous = options.leading === false ? 0 : now(); 1402 timeout = null; 1403 result = func.apply(context, args); 1404 if (!timeout) context = args = null; 1405 }; 1406 1407 var throttled = function throttled() { 1408 var at = now(); 1409 if (!previous && options.leading === false) previous = at; 1410 var remaining = wait - (at - previous); 1411 context = this; 1412 args = arguments; 1413 1414 if (remaining <= 0 || remaining > wait) { 1415 if (timeout) { 1416 clearTimeout(timeout); 1417 timeout = null; 1418 } 1419 1420 previous = at; 1421 result = func.apply(context, args); 1422 if (!timeout) context = args = null; 1423 } else if (!timeout && options.trailing !== false) { 1424 timeout = setTimeout(later, remaining); 1425 } 1426 1427 return result; 1428 }; 1429 1430 throttled.cancel = function () { 1431 clearTimeout(timeout); 1432 previous = 0; 1433 timeout = context = args = null; 1434 }; 1435 1436 return throttled; 1437} 1438 1439var MARGIN_TYPE = { 1440 ltr: ['marginLeft', 'marginRight'], 1441 rtl: ['marginRight', 'marginLeft'] 1442}; 1443function Gaps (Glide, Components, Events) { 1444 var Gaps = { 1445 /** 1446 * Applies gaps between slides. First and last 1447 * slides do not receive it's edge margins. 1448 * 1449 * @param {HTMLCollection} slides 1450 * @return {Void} 1451 */ 1452 apply: function apply(slides) { 1453 for (var i = 0, len = slides.length; i < len; i++) { 1454 var style = slides[i].style; 1455 var direction = Components.Direction.value; 1456 1457 if (i !== 0) { 1458 style[MARGIN_TYPE[direction][0]] = "".concat(this.value / 2, "px"); 1459 } else { 1460 style[MARGIN_TYPE[direction][0]] = ''; 1461 } 1462 1463 if (i !== slides.length - 1) { 1464 style[MARGIN_TYPE[direction][1]] = "".concat(this.value / 2, "px"); 1465 } else { 1466 style[MARGIN_TYPE[direction][1]] = ''; 1467 } 1468 } 1469 }, 1470 1471 /** 1472 * Removes gaps from the slides. 1473 * 1474 * @param {HTMLCollection} slides 1475 * @returns {Void} 1476 */ 1477 remove: function remove(slides) { 1478 for (var i = 0, len = slides.length; i < len; i++) { 1479 var style = slides[i].style; 1480 style.marginLeft = ''; 1481 style.marginRight = ''; 1482 } 1483 } 1484 }; 1485 glide_esm_define(Gaps, 'value', { 1486 /** 1487 * Gets value of the gap. 1488 * 1489 * @returns {Number} 1490 */ 1491 get: function get() { 1492 return toInt(Glide.settings.gap); 1493 } 1494 }); 1495 glide_esm_define(Gaps, 'grow', { 1496 /** 1497 * Gets additional dimensions value caused by gaps. 1498 * Used to increase width of the slides wrapper. 1499 * 1500 * @returns {Number} 1501 */ 1502 get: function get() { 1503 return Gaps.value * Components.Sizes.length; 1504 } 1505 }); 1506 glide_esm_define(Gaps, 'reductor', { 1507 /** 1508 * Gets reduction value caused by gaps. 1509 * Used to subtract width of the slides. 1510 * 1511 * @returns {Number} 1512 */ 1513 get: function get() { 1514 var perView = Glide.settings.perView; 1515 return Gaps.value * (perView - 1) / perView; 1516 } 1517 }); 1518 /** 1519 * Apply calculated gaps: 1520 * - after building, so slides (including clones) will receive proper margins 1521 * - on updating via API, to recalculate gaps with new options 1522 */ 1523 1524 Events.on(['build.after', 'update'], throttle(function () { 1525 Gaps.apply(Components.Html.wrapper.children); 1526 }, 30)); 1527 /** 1528 * Remove gaps: 1529 * - on destroying to bring markup to its inital state 1530 */ 1531 1532 Events.on('destroy', function () { 1533 Gaps.remove(Components.Html.wrapper.children); 1534 }); 1535 return Gaps; 1536} 1537 1538/** 1539 * Finds siblings nodes of the passed node. 1540 * 1541 * @param {Element} node 1542 * @return {Array} 1543 */ 1544function siblings(node) { 1545 if (node && node.parentNode) { 1546 var n = node.parentNode.firstChild; 1547 var matched = []; 1548 1549 for (; n; n = n.nextSibling) { 1550 if (n.nodeType === 1 && n !== node) { 1551 matched.push(n); 1552 } 1553 } 1554 1555 return matched; 1556 } 1557 1558 return []; 1559} 1560/** 1561 * Checks if passed node exist and is a valid element. 1562 * 1563 * @param {Element} node 1564 * @return {Boolean} 1565 */ 1566 1567function exist(node) { 1568 if (node && node instanceof window.HTMLElement) { 1569 return true; 1570 } 1571 1572 return false; 1573} 1574 1575var TRACK_SELECTOR = '[data-glide-el="track"]'; 1576function Html (Glide, Components, Events) { 1577 var Html = { 1578 /** 1579 * Setup slider HTML nodes. 1580 * 1581 * @param {Glide} glide 1582 */ 1583 mount: function mount() { 1584 this.root = Glide.selector; 1585 this.track = this.root.querySelector(TRACK_SELECTOR); 1586 this.collectSlides(); 1587 }, 1588 1589 /** 1590 * Collect slides 1591 */ 1592 collectSlides: function collectSlides() { 1593 this.slides = Array.prototype.slice.call(this.wrapper.children).filter(function (slide) { 1594 return !slide.classList.contains(Glide.settings.classes.slide.clone); 1595 }); 1596 } 1597 }; 1598 glide_esm_define(Html, 'root', { 1599 /** 1600 * Gets node of the glide main element. 1601 * 1602 * @return {Object} 1603 */ 1604 get: function get() { 1605 return Html._r; 1606 }, 1607 1608 /** 1609 * Sets node of the glide main element. 1610 * 1611 * @return {Object} 1612 */ 1613 set: function set(r) { 1614 if (isString(r)) { 1615 r = document.querySelector(r); 1616 } 1617 1618 if (exist(r)) { 1619 Html._r = r; 1620 } else { 1621 warn('Root element must be a existing Html node'); 1622 } 1623 } 1624 }); 1625 glide_esm_define(Html, 'track', { 1626 /** 1627 * Gets node of the glide track with slides. 1628 * 1629 * @return {Object} 1630 */ 1631 get: function get() { 1632 return Html._t; 1633 }, 1634 1635 /** 1636 * Sets node of the glide track with slides. 1637 * 1638 * @return {Object} 1639 */ 1640 set: function set(t) { 1641 if (exist(t)) { 1642 Html._t = t; 1643 } else { 1644 warn("Could not find track element. Please use ".concat(TRACK_SELECTOR, " attribute.")); 1645 } 1646 } 1647 }); 1648 glide_esm_define(Html, 'wrapper', { 1649 /** 1650 * Gets node of the slides wrapper. 1651 * 1652 * @return {Object} 1653 */ 1654 get: function get() { 1655 return Html.track.children[0]; 1656 } 1657 }); 1658 /** 1659 * Add/remove/reorder dynamic slides 1660 */ 1661 1662 Events.on('update', function () { 1663 Html.collectSlides(); 1664 }); 1665 return Html; 1666} 1667 1668function Peek (Glide, Components, Events) { 1669 var Peek = { 1670 /** 1671 * Setups how much to peek based on settings. 1672 * 1673 * @return {Void} 1674 */ 1675 mount: function mount() { 1676 this.value = Glide.settings.peek; 1677 } 1678 }; 1679 glide_esm_define(Peek, 'value', { 1680 /** 1681 * Gets value of the peek. 1682 * 1683 * @returns {Number|Object} 1684 */ 1685 get: function get() { 1686 return Peek._v; 1687 }, 1688 1689 /** 1690 * Sets value of the peek. 1691 * 1692 * @param {Number|Object} value 1693 * @return {Void} 1694 */ 1695 set: function set(value) { 1696 if (isObject(value)) { 1697 value.before = toInt(value.before); 1698 value.after = toInt(value.after); 1699 } else { 1700 value = toInt(value); 1701 } 1702 1703 Peek._v = value; 1704 } 1705 }); 1706 glide_esm_define(Peek, 'reductor', { 1707 /** 1708 * Gets reduction value caused by peek. 1709 * 1710 * @returns {Number} 1711 */ 1712 get: function get() { 1713 var value = Peek.value; 1714 var perView = Glide.settings.perView; 1715 1716 if (isObject(value)) { 1717 return value.before / perView + value.after / perView; 1718 } 1719 1720 return value * 2 / perView; 1721 } 1722 }); 1723 /** 1724 * Recalculate peeking sizes on: 1725 * - when resizing window to update to proper percents 1726 */ 1727 1728 Events.on(['resize', 'update'], function () { 1729 Peek.mount(); 1730 }); 1731 return Peek; 1732} 1733 1734function Move (Glide, Components, Events) { 1735 var Move = { 1736 /** 1737 * Constructs move component. 1738 * 1739 * @returns {Void} 1740 */ 1741 mount: function mount() { 1742 this._o = 0; 1743 }, 1744 1745 /** 1746 * Calculates a movement value based on passed offset and currently active index. 1747 * 1748 * @param {Number} offset 1749 * @return {Void} 1750 */ 1751 make: function make() { 1752 var _this = this; 1753 1754 var offset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; 1755 this.offset = offset; 1756 Events.emit('move', { 1757 movement: this.value 1758 }); 1759 Components.Transition.after(function () { 1760 Events.emit('move.after', { 1761 movement: _this.value 1762 }); 1763 }); 1764 } 1765 }; 1766 glide_esm_define(Move, 'offset', { 1767 /** 1768 * Gets an offset value used to modify current translate. 1769 * 1770 * @return {Object} 1771 */ 1772 get: function get() { 1773 return Move._o; 1774 }, 1775 1776 /** 1777 * Sets an offset value used to modify current translate. 1778 * 1779 * @return {Object} 1780 */ 1781 set: function set(value) { 1782 Move._o = !isUndefined(value) ? toInt(value) : 0; 1783 } 1784 }); 1785 glide_esm_define(Move, 'translate', { 1786 /** 1787 * Gets a raw movement value. 1788 * 1789 * @return {Number} 1790 */ 1791 get: function get() { 1792 return Components.Sizes.slideWidth * Glide.index; 1793 } 1794 }); 1795 glide_esm_define(Move, 'value', { 1796 /** 1797 * Gets an actual movement value corrected by offset. 1798 * 1799 * @return {Number} 1800 */ 1801 get: function get() { 1802 var offset = this.offset; 1803 var translate = this.translate; 1804 1805 if (Components.Direction.is('rtl')) { 1806 return translate + offset; 1807 } 1808 1809 return translate - offset; 1810 } 1811 }); 1812 /** 1813 * Make movement to proper slide on: 1814 * - before build, so glide will start at `startAt` index 1815 * - on each standard run to move to newly calculated index 1816 */ 1817 1818 Events.on(['build.before', 'run'], function () { 1819 Move.make(); 1820 }); 1821 return Move; 1822} 1823 1824function Sizes (Glide, Components, Events) { 1825 var Sizes = { 1826 /** 1827 * Setups dimensions of slides. 1828 * 1829 * @return {Void} 1830 */ 1831 setupSlides: function setupSlides() { 1832 var width = "".concat(this.slideWidth, "px"); 1833 var slides = Components.Html.slides; 1834 1835 for (var i = 0; i < slides.length; i++) { 1836 slides[i].style.width = width; 1837 } 1838 }, 1839 1840 /** 1841 * Setups dimensions of slides wrapper. 1842 * 1843 * @return {Void} 1844 */ 1845 setupWrapper: function setupWrapper() { 1846 Components.Html.wrapper.style.width = "".concat(this.wrapperSize, "px"); 1847 }, 1848 1849 /** 1850 * Removes applied styles from HTML elements. 1851 * 1852 * @returns {Void} 1853 */ 1854 remove: function remove() { 1855 var slides = Components.Html.slides; 1856 1857 for (var i = 0; i < slides.length; i++) { 1858 slides[i].style.width = ''; 1859 } 1860 1861 Components.Html.wrapper.style.width = ''; 1862 } 1863 }; 1864 glide_esm_define(Sizes, 'length', { 1865 /** 1866 * Gets count number of the slides. 1867 * 1868 * @return {Number} 1869 */ 1870 get: function get() { 1871 return Components.Html.slides.length; 1872 } 1873 }); 1874 glide_esm_define(Sizes, 'width', { 1875 /** 1876 * Gets width value of the slider (visible area). 1877 * 1878 * @return {Number} 1879 */ 1880 get: function get() { 1881 return Components.Html.track.offsetWidth; 1882 } 1883 }); 1884 glide_esm_define(Sizes, 'wrapperSize', { 1885 /** 1886 * Gets size of the slides wrapper. 1887 * 1888 * @return {Number} 1889 */ 1890 get: function get() { 1891 return Sizes.slideWidth * Sizes.length + Components.Gaps.grow + Components.Clones.grow; 1892 } 1893 }); 1894 glide_esm_define(Sizes, 'slideWidth', { 1895 /** 1896 * Gets width value of a single slide. 1897 * 1898 * @return {Number} 1899 */ 1900 get: function get() { 1901 return Sizes.width / Glide.settings.perView - Components.Peek.reductor - Components.Gaps.reductor; 1902 } 1903 }); 1904 /** 1905 * Apply calculated glide's dimensions: 1906 * - before building, so other dimensions (e.g. translate) will be calculated propertly 1907 * - when resizing window to recalculate sildes dimensions 1908 * - on updating via API, to calculate dimensions based on new options 1909 */ 1910 1911 Events.on(['build.before', 'resize', 'update'], function () { 1912 Sizes.setupSlides(); 1913 Sizes.setupWrapper(); 1914 }); 1915 /** 1916 * Remove calculated glide's dimensions: 1917 * - on destoting to bring markup to its inital state 1918 */ 1919 1920 Events.on('destroy', function () { 1921 Sizes.remove(); 1922 }); 1923 return Sizes; 1924} 1925 1926function Build (Glide, Components, Events) { 1927 var Build = { 1928 /** 1929 * Init glide building. Adds classes, sets 1930 * dimensions and setups initial state. 1931 * 1932 * @return {Void} 1933 */ 1934 mount: function mount() { 1935 Events.emit('build.before'); 1936 this.typeClass(); 1937 this.activeClass(); 1938 Events.emit('build.after'); 1939 }, 1940 1941 /** 1942 * Adds `type` class to the glide element. 1943 * 1944 * @return {Void} 1945 */ 1946 typeClass: function typeClass() { 1947 Components.Html.root.classList.add(Glide.settings.classes.type[Glide.settings.type]); 1948 }, 1949 1950 /** 1951 * Sets active class to current slide. 1952 * 1953 * @return {Void} 1954 */ 1955 activeClass: function activeClass() { 1956 var classes = Glide.settings.classes; 1957 var slide = Components.Html.slides[Glide.index]; 1958 1959 if (slide) { 1960 slide.classList.add(classes.slide.active); 1961 siblings(slide).forEach(function (sibling) { 1962 sibling.classList.remove(classes.slide.active); 1963 }); 1964 } 1965 }, 1966 1967 /** 1968 * Removes HTML classes applied at building. 1969 * 1970 * @return {Void} 1971 */ 1972 removeClasses: function removeClasses() { 1973 var _Glide$settings$class = Glide.settings.classes, 1974 type = _Glide$settings$class.type, 1975 slide = _Glide$settings$class.slide; 1976 Components.Html.root.classList.remove(type[Glide.settings.type]); 1977 Components.Html.slides.forEach(function (sibling) { 1978 sibling.classList.remove(slide.active); 1979 }); 1980 } 1981 }; 1982 /** 1983 * Clear building classes: 1984 * - on destroying to bring HTML to its initial state 1985 * - on updating to remove classes before remounting component 1986 */ 1987 1988 Events.on(['destroy', 'update'], function () { 1989 Build.removeClasses(); 1990 }); 1991 /** 1992 * Remount component: 1993 * - on resizing of the window to calculate new dimensions 1994 * - on updating settings via API 1995 */ 1996 1997 Events.on(['resize', 'update'], function () { 1998 Build.mount(); 1999 }); 2000 /** 2001 * Swap active class of current slide: 2002 * - after each move to the new index 2003 */ 2004 2005 Events.on('move.after', function () { 2006 Build.activeClass(); 2007 }); 2008 return Build; 2009} 2010 2011function Clones (Glide, Components, Events) { 2012 var Clones = { 2013 /** 2014 * Create pattern map and collect slides to be cloned. 2015 */ 2016 mount: function mount() { 2017 this.items = []; 2018 2019 if (Glide.isType('carousel')) { 2020 this.items = this.collect(); 2021 } 2022 }, 2023 2024 /** 2025 * Collect clones with pattern. 2026 * 2027 * @return {[]} 2028 */ 2029 collect: function collect() { 2030 var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; 2031 var slides = Components.Html.slides; 2032 var _Glide$settings = Glide.settings, 2033 perView = _Glide$settings.perView, 2034 classes = _Glide$settings.classes, 2035 cloningRatio = _Glide$settings.cloningRatio; 2036 2037 if (slides.length !== 0) { 2038 var peekIncrementer = +!!Glide.settings.peek; 2039 var cloneCount = perView + peekIncrementer + Math.round(perView / 2); 2040 var append = slides.slice(0, cloneCount).reverse(); 2041 var prepend = slides.slice(cloneCount * -1); 2042 2043 for (var r = 0; r < Math.max(cloningRatio, Math.floor(perView / slides.length)); r++) { 2044 for (var i = 0; i < append.length; i++) { 2045 var clone = append[i].cloneNode(true); 2046 clone.classList.add(classes.slide.clone); 2047 items.push(clone); 2048 } 2049 2050 for (var _i = 0; _i < prepend.length; _i++) { 2051 var _clone = prepend[_i].cloneNode(true); 2052 2053 _clone.classList.add(classes.slide.clone); 2054 2055 items.unshift(_clone); 2056 } 2057 } 2058 } 2059 2060 return items; 2061 }, 2062 2063 /** 2064 * Append cloned slides with generated pattern. 2065 * 2066 * @return {Void} 2067 */ 2068 append: function append() { 2069 var items = this.items; 2070 var _Components$Html = Components.Html, 2071 wrapper = _Components$Html.wrapper, 2072 slides = _Components$Html.slides; 2073 var half = Math.floor(items.length / 2); 2074 var prepend = items.slice(0, half).reverse(); 2075 var append = items.slice(half * -1).reverse(); 2076 var width = "".concat(Components.Sizes.slideWidth, "px"); 2077 2078 for (var i = 0; i < append.length; i++) { 2079 wrapper.appendChild(append[i]); 2080 } 2081 2082 for (var _i2 = 0; _i2 < prepend.length; _i2++) { 2083 wrapper.insertBefore(prepend[_i2], slides[0]); 2084 } 2085 2086 for (var _i3 = 0; _i3 < items.length; _i3++) { 2087 items[_i3].style.width = width; 2088 } 2089 }, 2090 2091 /** 2092 * Remove all cloned slides. 2093 * 2094 * @return {Void} 2095 */ 2096 remove: function remove() { 2097 var items = this.items; 2098 2099 for (var i = 0; i < items.length; i++) { 2100 Components.Html.wrapper.removeChild(items[i]); 2101 } 2102 } 2103 }; 2104 glide_esm_define(Clones, 'grow', { 2105 /** 2106 * Gets additional dimensions value caused by clones. 2107 * 2108 * @return {Number} 2109 */ 2110 get: function get() { 2111 return (Components.Sizes.slideWidth + Components.Gaps.value) * Clones.items.length; 2112 } 2113 }); 2114 /** 2115 * Append additional slide's clones: 2116 * - while glide's type is `carousel` 2117 */ 2118 2119 Events.on('update', function () { 2120 Clones.remove(); 2121 Clones.mount(); 2122 Clones.append(); 2123 }); 2124 /** 2125 * Append additional slide's clones: 2126 * - while glide's type is `carousel` 2127 */ 2128 2129 Events.on('build.before', function () { 2130 if (Glide.isType('carousel')) { 2131 Clones.append(); 2132 } 2133 }); 2134 /** 2135 * Remove clones HTMLElements: 2136 * - on destroying, to bring HTML to its initial state 2137 */ 2138 2139 Events.on('destroy', function () { 2140 Clones.remove(); 2141 }); 2142 return Clones; 2143} 2144 2145var EventsBinder = /*#__PURE__*/function () { 2146 /** 2147 * Construct a EventsBinder instance. 2148 */ 2149 function EventsBinder() { 2150 var listeners = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 2151 2152 _classCallCheck(this, EventsBinder); 2153 2154 this.listeners = listeners; 2155 } 2156 /** 2157 * Adds events listeners to arrows HTML elements. 2158 * 2159 * @param {String|Array} events 2160 * @param {Element|Window|Document} el 2161 * @param {Function} closure 2162 * @param {Boolean|Object} capture 2163 * @return {Void} 2164 */ 2165 2166 2167 _createClass(EventsBinder, [{ 2168 key: "on", 2169 value: function on(events, el, closure) { 2170 var capture = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; 2171 2172 if (isString(events)) { 2173 events = [events]; 2174 } 2175 2176 for (var i = 0; i < events.length; i++) { 2177 this.listeners[events[i]] = closure; 2178 el.addEventListener(events[i], this.listeners[events[i]], capture); 2179 } 2180 } 2181 /** 2182 * Removes event listeners from arrows HTML elements. 2183 * 2184 * @param {String|Array} events 2185 * @param {Element|Window|Document} el 2186 * @param {Boolean|Object} capture 2187 * @return {Void} 2188 */ 2189 2190 }, { 2191 key: "off", 2192 value: function off(events, el) { 2193 var capture = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; 2194 2195 if (isString(events)) { 2196 events = [events]; 2197 } 2198 2199 for (var i = 0; i < events.length; i++) { 2200 el.removeEventListener(events[i], this.listeners[events[i]], capture); 2201 } 2202 } 2203 /** 2204 * Destroy collected listeners. 2205 * 2206 * @returns {Void} 2207 */ 2208 2209 }, { 2210 key: "destroy", 2211 value: function destroy() { 2212 delete this.listeners; 2213 } 2214 }]); 2215 2216 return EventsBinder; 2217}(); 2218 2219function Resize (Glide, Components, Events) { 2220 /** 2221 * Instance of the binder for DOM Events. 2222 * 2223 * @type {EventsBinder} 2224 */ 2225 var Binder = new EventsBinder(); 2226 var Resize = { 2227 /** 2228 * Initializes window bindings. 2229 */ 2230 mount: function mount() { 2231 this.bind(); 2232 }, 2233 2234 /** 2235 * Binds `rezsize` listener to the window. 2236 * It's a costly event, so we are debouncing it. 2237 * 2238 * @return {Void} 2239 */ 2240 bind: function bind() { 2241 Binder.on('resize', window, throttle(function () { 2242 Events.emit('resize'); 2243 }, Glide.settings.throttle)); 2244 }, 2245 2246 /** 2247 * Unbinds listeners from the window. 2248 * 2249 * @return {Void} 2250 */ 2251 unbind: function unbind() { 2252 Binder.off('resize', window); 2253 } 2254 }; 2255 /** 2256 * Remove bindings from window: 2257 * - on destroying, to remove added EventListener 2258 */ 2259 2260 Events.on('destroy', function () { 2261 Resize.unbind(); 2262 Binder.destroy(); 2263 }); 2264 return Resize; 2265} 2266 2267var VALID_DIRECTIONS = ['ltr', 'rtl']; 2268var FLIPED_MOVEMENTS = { 2269 '>': '<', 2270 '<': '>', 2271 '=': '=' 2272}; 2273function Direction (Glide, Components, Events) { 2274 var Direction = { 2275 /** 2276 * Setups gap value based on settings. 2277 * 2278 * @return {Void} 2279 */ 2280 mount: function mount() { 2281 this.value = Glide.settings.direction; 2282 }, 2283 2284 /** 2285 * Resolves pattern based on direction value 2286 * 2287 * @param {String} pattern 2288 * @returns {String} 2289 */ 2290 resolve: function resolve(pattern) { 2291 var token = pattern.slice(0, 1); 2292 2293 if (this.is('rtl')) { 2294 return pattern.split(token).join(FLIPED_MOVEMENTS[token]); 2295 } 2296 2297 return pattern; 2298 }, 2299 2300 /** 2301 * Checks value of direction mode. 2302 * 2303 * @param {String} direction 2304 * @returns {Boolean} 2305 */ 2306 is: function is(direction) { 2307 return this.value === direction; 2308 }, 2309 2310 /** 2311 * Applies direction class to the root HTML element. 2312 * 2313 * @return {Void} 2314 */ 2315 addClass: function addClass() { 2316 Components.Html.root.classList.add(Glide.settings.classes.direction[this.value]); 2317 }, 2318 2319 /** 2320 * Removes direction class from the root HTML element. 2321 * 2322 * @return {Void} 2323 */ 2324 removeClass: function removeClass() { 2325 Components.Html.root.classList.remove(Glide.settings.classes.direction[this.value]); 2326 } 2327 }; 2328 glide_esm_define(Direction, 'value', { 2329 /** 2330 * Gets value of the direction. 2331 * 2332 * @returns {Number} 2333 */ 2334 get: function get() { 2335 return Direction._v; 2336 }, 2337 2338 /** 2339 * Sets value of the direction. 2340 * 2341 * @param {String} value 2342 * @return {Void} 2343 */ 2344 set: function set(value) { 2345 if (VALID_DIRECTIONS.indexOf(value) > -1) { 2346 Direction._v = value; 2347 } else { 2348 warn('Direction value must be `ltr` or `rtl`'); 2349 } 2350 } 2351 }); 2352 /** 2353 * Clear direction class: 2354 * - on destroy to bring HTML to its initial state 2355 * - on update to remove class before reappling bellow 2356 */ 2357 2358 Events.on(['destroy', 'update'], function () { 2359 Direction.removeClass(); 2360 }); 2361 /** 2362 * Remount component: 2363 * - on update to reflect changes in direction value 2364 */ 2365 2366 Events.on('update', function () { 2367 Direction.mount(); 2368 }); 2369 /** 2370 * Apply direction class: 2371 * - before building to apply class for the first time 2372 * - on updating to reapply direction class that may changed 2373 */ 2374 2375 Events.on(['build.before', 'update'], function () { 2376 Direction.addClass(); 2377 }); 2378 return Direction; 2379} 2380 2381/** 2382 * Reflects value of glide movement. 2383 * 2384 * @param {Object} Glide 2385 * @param {Object} Components 2386 * @return {Object} 2387 */ 2388function Rtl (Glide, Components) { 2389 return { 2390 /** 2391 * Negates the passed translate if glide is in RTL option. 2392 * 2393 * @param {Number} translate 2394 * @return {Number} 2395 */ 2396 modify: function modify(translate) { 2397 if (Components.Direction.is('rtl')) { 2398 return -translate; 2399 } 2400 2401 return translate; 2402 } 2403 }; 2404} 2405 2406/** 2407 * Updates glide movement with a `gap` settings. 2408 * 2409 * @param {Object} Glide 2410 * @param {Object} Components 2411 * @return {Object} 2412 */ 2413function Gap (Glide, Components) { 2414 return { 2415 /** 2416 * Modifies passed translate value with number in the `gap` settings. 2417 * 2418 * @param {Number} translate 2419 * @return {Number} 2420 */ 2421 modify: function modify(translate) { 2422 var multiplier = Math.floor(translate / Components.Sizes.slideWidth); 2423 return translate + Components.Gaps.value * multiplier; 2424 } 2425 }; 2426} 2427 2428/** 2429 * Updates glide movement with width of additional clones width. 2430 * 2431 * @param {Object} Glide 2432 * @param {Object} Components 2433 * @return {Object} 2434 */ 2435function Grow (Glide, Components) { 2436 return { 2437 /** 2438 * Adds to the passed translate width of the half of clones. 2439 * 2440 * @param {Number} translate 2441 * @return {Number} 2442 */ 2443 modify: function modify(translate) { 2444 return translate + Components.Clones.grow / 2; 2445 } 2446 }; 2447} 2448 2449/** 2450 * Updates glide movement with a `peek` settings. 2451 * 2452 * @param {Object} Glide 2453 * @param {Object} Components 2454 * @return {Object} 2455 */ 2456 2457function Peeking (Glide, Components) { 2458 return { 2459 /** 2460 * Modifies passed translate value with a `peek` setting. 2461 * 2462 * @param {Number} translate 2463 * @return {Number} 2464 */ 2465 modify: function modify(translate) { 2466 if (Glide.settings.focusAt >= 0) { 2467 var peek = Components.Peek.value; 2468 2469 if (isObject(peek)) { 2470 return translate - peek.before; 2471 } 2472 2473 return translate - peek; 2474 } 2475 2476 return translate; 2477 } 2478 }; 2479} 2480 2481/** 2482 * Updates glide movement with a `focusAt` settings. 2483 * 2484 * @param {Object} Glide 2485 * @param {Object} Components 2486 * @return {Object} 2487 */ 2488function Focusing (Glide, Components) { 2489 return { 2490 /** 2491 * Modifies passed translate value with index in the `focusAt` setting. 2492 * 2493 * @param {Number} translate 2494 * @return {Number} 2495 */ 2496 modify: function modify(translate) { 2497 var gap = Components.Gaps.value; 2498 var width = Components.Sizes.width; 2499 var focusAt = Glide.settings.focusAt; 2500 var slideWidth = Components.Sizes.slideWidth; 2501 2502 if (focusAt === 'center') { 2503 return translate - (width / 2 - slideWidth / 2); 2504 } 2505 2506 return translate - slideWidth * focusAt - gap * focusAt; 2507 } 2508 }; 2509} 2510 2511/** 2512 * Applies diffrent transformers on translate value. 2513 * 2514 * @param {Object} Glide 2515 * @param {Object} Components 2516 * @return {Object} 2517 */ 2518 2519function mutator (Glide, Components, Events) { 2520 /** 2521 * Merge instance transformers with collection of default transformers. 2522 * It's important that the Rtl component be last on the list, 2523 * so it reflects all previous transformations. 2524 * 2525 * @type {Array} 2526 */ 2527 var TRANSFORMERS = [Gap, Grow, Peeking, Focusing].concat(Glide._t, [Rtl]); 2528 return { 2529 /** 2530 * Piplines translate value with registered transformers. 2531 * 2532 * @param {Number} translate 2533 * @return {Number} 2534 */ 2535 mutate: function mutate(translate) { 2536 for (var i = 0; i < TRANSFORMERS.length; i++) { 2537 var transformer = TRANSFORMERS[i]; 2538 2539 if (isFunction(transformer) && isFunction(transformer().modify)) { 2540 translate = transformer(Glide, Components, Events).modify(translate); 2541 } else { 2542 warn('Transformer should be a function that returns an object with `modify()` method'); 2543 } 2544 } 2545 2546 return translate; 2547 } 2548 }; 2549} 2550 2551function Translate (Glide, Components, Events) { 2552 var Translate = { 2553 /** 2554 * Sets value of translate on HTML element. 2555 * 2556 * @param {Number} value 2557 * @return {Void} 2558 */ 2559 set: function set(value) { 2560 var transform = mutator(Glide, Components).mutate(value); 2561 var translate3d = "translate3d(".concat(-1 * transform, "px, 0px, 0px)"); 2562 Components.Html.wrapper.style.mozTransform = translate3d; // needed for supported Firefox 10-15 2563 2564 Components.Html.wrapper.style.webkitTransform = translate3d; // needed for supported Chrome 10-35, Safari 5.1-8, and Opera 15-22 2565 2566 Components.Html.wrapper.style.transform = translate3d; 2567 }, 2568 2569 /** 2570 * Removes value of translate from HTML element. 2571 * 2572 * @return {Void} 2573 */ 2574 remove: function remove() { 2575 Components.Html.wrapper.style.transform = ''; 2576 }, 2577 2578 /** 2579 * @return {number} 2580 */ 2581 getStartIndex: function getStartIndex() { 2582 var length = Components.Sizes.length; 2583 var index = Glide.index; 2584 var perView = Glide.settings.perView; 2585 2586 if (Components.Run.isOffset('>') || Components.Run.isOffset('|>')) { 2587 return length + (index - perView); 2588 } // "modulo length" converts an index that equals length to zero 2589 2590 2591 return (index + perView) % length; 2592 }, 2593 2594 /** 2595 * @return {number} 2596 */ 2597 getTravelDistance: function getTravelDistance() { 2598 var travelDistance = Components.Sizes.slideWidth * Glide.settings.perView; 2599 2600 if (Components.Run.isOffset('>') || Components.Run.isOffset('|>')) { 2601 // reverse travel distance so that we don't have to change subtract operations 2602 return travelDistance * -1; 2603 } 2604 2605 return travelDistance; 2606 } 2607 }; 2608 /** 2609 * Set new translate value: 2610 * - on move to reflect index change 2611 * - on updating via API to reflect possible changes in options 2612 */ 2613 2614 Events.on('move', function (context) { 2615 if (!Glide.isType('carousel') || !Components.Run.isOffset()) { 2616 return Translate.set(context.movement); 2617 } 2618 2619 Components.Transition.after(function () { 2620 Events.emit('translate.jump'); 2621 Translate.set(Components.Sizes.slideWidth * Glide.index); 2622 }); 2623 var startWidth = Components.Sizes.slideWidth * Components.Translate.getStartIndex(); 2624 return Translate.set(startWidth - Components.Translate.getTravelDistance()); 2625 }); 2626 /** 2627 * Remove translate: 2628 * - on destroying to bring markup to its inital state 2629 */ 2630 2631 Events.on('destroy', function () { 2632 Translate.remove(); 2633 }); 2634 return Translate; 2635} 2636 2637function Transition (Glide, Components, Events) { 2638 /** 2639 * Holds inactivity status of transition. 2640 * When true transition is not applied. 2641 * 2642 * @type {Boolean} 2643 */ 2644 var disabled = false; 2645 var Transition = { 2646 /** 2647 * Composes string of the CSS transition. 2648 * 2649 * @param {String} property 2650 * @return {String} 2651 */ 2652 compose: function compose(property) { 2653 var settings = Glide.settings; 2654 2655 if (!disabled) { 2656 return "".concat(property, " ").concat(this.duration, "ms ").concat(settings.animationTimingFunc); 2657 } 2658 2659 return "".concat(property, " 0ms ").concat(settings.animationTimingFunc); 2660 }, 2661 2662 /** 2663 * Sets value of transition on HTML element. 2664 * 2665 * @param {String=} property 2666 * @return {Void} 2667 */ 2668 set: function set() { 2669 var property = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'transform'; 2670 Components.Html.wrapper.style.transition = this.compose(property); 2671 }, 2672 2673 /** 2674 * Removes value of transition from HTML element. 2675 * 2676 * @return {Void} 2677 */ 2678 remove: function remove() { 2679 Components.Html.wrapper.style.transition = ''; 2680 }, 2681 2682 /** 2683 * Runs callback after animation. 2684 * 2685 * @param {Function} callback 2686 * @return {Void} 2687 */ 2688 after: function after(callback) { 2689 setTimeout(function () { 2690 callback(); 2691 }, this.duration); 2692 }, 2693 2694 /** 2695 * Enable transition. 2696 * 2697 * @return {Void} 2698 */ 2699 enable: function enable() { 2700 disabled = false; 2701 this.set(); 2702 }, 2703 2704 /** 2705 * Disable transition. 2706 * 2707 * @return {Void} 2708 */ 2709 disable: function disable() { 2710 disabled = true; 2711 this.set(); 2712 } 2713 }; 2714 glide_esm_
vendor: 12,230 bytes, lines 2714-3218
2714define(Transition, 'duration', { 2715 /** 2716 * Gets duration of the transition based 2717 * on currently running animation type. 2718 * 2719 * @return {Number} 2720 */ 2721 get: function get() { 2722 var settings = Glide.settings; 2723 2724 if (Glide.isType('slider') && Components.Run.offset) { 2725 return settings.rewindDuration; 2726 } 2727 2728 return settings.animationDuration; 2729 } 2730 }); 2731 /** 2732 * Set transition `style` value: 2733 * - on each moving, because it may be cleared by offset move 2734 */ 2735 2736 Events.on('move', function () { 2737 Transition.set(); 2738 }); 2739 /** 2740 * Disable transition: 2741 * - before initial build to avoid transitioning from `0` to `startAt` index 2742 * - while resizing window and recalculating dimensions 2743 * - on jumping from offset transition at start and end edges in `carousel` type 2744 */ 2745 2746 Events.on(['build.before', 'resize', 'translate.jump'], function () { 2747 Transition.disable(); 2748 }); 2749 /** 2750 * Enable transition: 2751 * - on each running, because it may be disabled by offset move 2752 */ 2753 2754 Events.on('run', function () { 2755 Transition.enable(); 2756 }); 2757 /** 2758 * Remove transition: 2759 * - on destroying to bring markup to its inital state 2760 */ 2761 2762 Events.on('destroy', function () { 2763 Transition.remove(); 2764 }); 2765 return Transition; 2766} 2767 2768/** 2769 * Test via a getter in the options object to see 2770 * if the passive property is accessed. 2771 * 2772 * @see https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md#feature-detection 2773 */ 2774var supportsPassive = false; 2775 2776try { 2777 var opts = Object.defineProperty({}, 'passive', { 2778 get: function get() { 2779 supportsPassive = true; 2780 } 2781 }); 2782 window.addEventListener('testPassive', null, opts); 2783 window.removeEventListener('testPassive', null, opts); 2784} catch (e) {} 2785 2786var supportsPassive$1 = supportsPassive; 2787 2788var START_EVENTS = ['touchstart', 'mousedown']; 2789var MOVE_EVENTS = ['touchmove', 'mousemove']; 2790var END_EVENTS = ['touchend', 'touchcancel', 'mouseup', 'mouseleave']; 2791var MOUSE_EVENTS = ['mousedown', 'mousemove', 'mouseup', 'mouseleave']; 2792function Swipe (Glide, Components, Events) { 2793 /** 2794 * Instance of the binder for DOM Events. 2795 * 2796 * @type {EventsBinder} 2797 */ 2798 var Binder = new EventsBinder(); 2799 var swipeSin = 0; 2800 var swipeStartX = 0; 2801 var swipeStartY = 0; 2802 var disabled = false; 2803 var capture = supportsPassive$1 ? { 2804 passive: true 2805 } : false; 2806 var Swipe = { 2807 /** 2808 * Initializes swipe bindings. 2809 * 2810 * @return {Void} 2811 */ 2812 mount: function mount() { 2813 this.bindSwipeStart(); 2814 }, 2815 2816 /** 2817 * Handler for `swipestart` event. Calculates entry points of the user's tap. 2818 * 2819 * @param {Object} event 2820 * @return {Void} 2821 */ 2822 start: function start(event) { 2823 if (!disabled && !Glide.disabled) { 2824 this.disable(); 2825 var swipe = this.touches(event); 2826 swipeSin = null; 2827 swipeStartX = toInt(swipe.pageX); 2828 swipeStartY = toInt(swipe.pageY); 2829 this.bindSwipeMove(); 2830 this.bindSwipeEnd(); 2831 Events.emit('swipe.start'); 2832 } 2833 }, 2834 2835 /** 2836 * Handler for `swipemove` event. Calculates user's tap angle and distance. 2837 * 2838 * @param {Object} event 2839 */ 2840 move: function move(event) { 2841 if (!Glide.disabled) { 2842 var _Glide$settings = Glide.settings, 2843 touchAngle = _Glide$settings.touchAngle, 2844 touchRatio = _Glide$settings.touchRatio, 2845 classes = _Glide$settings.classes; 2846 var swipe = this.touches(event); 2847 var subExSx = toInt(swipe.pageX) - swipeStartX; 2848 var subEySy = toInt(swipe.pageY) - swipeStartY; 2849 var powEX = Math.abs(subExSx << 2); 2850 var powEY = Math.abs(subEySy << 2); 2851 var swipeHypotenuse = Math.sqrt(powEX + powEY); 2852 var swipeCathetus = Math.sqrt(powEY); 2853 swipeSin = Math.asin(swipeCathetus / swipeHypotenuse); 2854 2855 if (swipeSin * 180 / Math.PI < touchAngle) { 2856 event.stopPropagation(); 2857 Components.Move.make(subExSx * toFloat(touchRatio)); 2858 Components.Html.root.classList.add(classes.dragging); 2859 Events.emit('swipe.move'); 2860 } else { 2861 return false; 2862 } 2863 } 2864 }, 2865 2866 /** 2867 * Handler for `swipeend` event. Finitializes user's tap and decides about glide move. 2868 * 2869 * @param {Object} event 2870 * @return {Void} 2871 */ 2872 end: function end(event) { 2873 if (!Glide.disabled) { 2874 var _Glide$settings2 = Glide.settings, 2875 perSwipe = _Glide$settings2.perSwipe, 2876 touchAngle = _Glide$settings2.touchAngle, 2877 classes = _Glide$settings2.classes; 2878 var swipe = this.touches(event); 2879 var threshold = this.threshold(event); 2880 var swipeDistance = swipe.pageX - swipeStartX; 2881 var swipeDeg = swipeSin * 180 / Math.PI; 2882 this.enable(); 2883 2884 if (swipeDistance > threshold && swipeDeg < touchAngle) { 2885 Components.Run.make(Components.Direction.resolve("".concat(perSwipe, "<"))); 2886 } else if (swipeDistance < -threshold && swipeDeg < touchAngle) { 2887 Components.Run.make(Components.Direction.resolve("".concat(perSwipe, ">"))); 2888 } else { 2889 // While swipe don't reach distance apply previous transform. 2890 Components.Move.make(); 2891 } 2892 2893 Components.Html.root.classList.remove(classes.dragging); 2894 this.unbindSwipeMove(); 2895 this.unbindSwipeEnd(); 2896 Events.emit('swipe.end'); 2897 } 2898 }, 2899 2900 /** 2901 * Binds swipe's starting event. 2902 * 2903 * @return {Void} 2904 */ 2905 bindSwipeStart: function bindSwipeStart() { 2906 var _this = this; 2907 2908 var _Glide$settings3 = Glide.settings, 2909 swipeThreshold = _Glide$settings3.swipeThreshold, 2910 dragThreshold = _Glide$settings3.dragThreshold; 2911 2912 if (swipeThreshold) { 2913 Binder.on(START_EVENTS[0], Components.Html.wrapper, function (event) { 2914 _this.start(event); 2915 }, capture); 2916 } 2917 2918 if (dragThreshold) { 2919 Binder.on(START_EVENTS[1], Components.Html.wrapper, function (event) { 2920 _this.start(event); 2921 }, capture); 2922 } 2923 }, 2924 2925 /** 2926 * Unbinds swipe's starting event. 2927 * 2928 * @return {Void} 2929 */ 2930 unbindSwipeStart: function unbindSwipeStart() { 2931 Binder.off(START_EVENTS[0], Components.Html.wrapper, capture); 2932 Binder.off(START_EVENTS[1], Components.Html.wrapper, capture); 2933 }, 2934 2935 /** 2936 * Binds swipe's moving event. 2937 * 2938 * @return {Void} 2939 */ 2940 bindSwipeMove: function bindSwipeMove() { 2941 var _this2 = this; 2942 2943 Binder.on(MOVE_EVENTS, Components.Html.wrapper, throttle(function (event) { 2944 _this2.move(event); 2945 }, Glide.settings.throttle), capture); 2946 }, 2947 2948 /** 2949 * Unbinds swipe's moving event. 2950 * 2951 * @return {Void} 2952 */ 2953 unbindSwipeMove: function unbindSwipeMove() { 2954 Binder.off(MOVE_EVENTS, Components.Html.wrapper, capture); 2955 }, 2956 2957 /** 2958 * Binds swipe's ending event. 2959 * 2960 * @return {Void} 2961 */ 2962 bindSwipeEnd: function bindSwipeEnd() { 2963 var _this3 = this; 2964 2965 Binder.on(END_EVENTS, Components.Html.wrapper, function (event) { 2966 _this3.end(event); 2967 }); 2968 }, 2969 2970 /** 2971 * Unbinds swipe's ending event. 2972 * 2973 * @return {Void} 2974 */ 2975 unbindSwipeEnd: function unbindSwipeEnd() { 2976 Binder.off(END_EVENTS, Components.Html.wrapper); 2977 }, 2978 2979 /** 2980 * Normalizes event touches points accorting to different types. 2981 * 2982 * @param {Object} event 2983 */ 2984 touches: function touches(event) { 2985 if (MOUSE_EVENTS.indexOf(event.type) > -1) { 2986 return event; 2987 } 2988 2989 return event.touches[0] || event.changedTouches[0]; 2990 }, 2991 2992 /** 2993 * Gets value of minimum swipe distance settings based on event type. 2994 * 2995 * @return {Number} 2996 */ 2997 threshold: function threshold(event) { 2998 var settings = Glide.settings; 2999 3000 if (MOUSE_EVENTS.indexOf(event.type) > -1) { 3001 return settings.dragThreshold; 3002 } 3003 3004 return settings.swipeThreshold; 3005 }, 3006 3007 /** 3008 * Enables swipe event. 3009 * 3010 * @return {self} 3011 */ 3012 enable: function enable() { 3013 disabled = false; 3014 Components.Transition.enable(); 3015 return this; 3016 }, 3017 3018 /** 3019 * Disables swipe event. 3020 * 3021 * @return {self} 3022 */ 3023 disable: function disable() { 3024 disabled = true; 3025 Components.Transition.disable(); 3026 return this; 3027 } 3028 }; 3029 /** 3030 * Add component class: 3031 * - after initial building 3032 */ 3033 3034 Events.on('build.after', function () { 3035 Components.Html.root.classList.add(Glide.settings.classes.swipeable); 3036 }); 3037 /** 3038 * Remove swiping bindings: 3039 * - on destroying, to remove added EventListeners 3040 */ 3041 3042 Events.on('destroy', function () { 3043 Swipe.unbindSwipeStart(); 3044 Swipe.unbindSwipeMove(); 3045 Swipe.unbindSwipeEnd(); 3046 Binder.destroy(); 3047 }); 3048 return Swipe; 3049} 3050 3051function Images (Glide, Components, Events) { 3052 /** 3053 * Instance of the binder for DOM Events. 3054 * 3055 * @type {EventsBinder} 3056 */ 3057 var Binder = new EventsBinder(); 3058 var Images = { 3059 /** 3060 * Binds listener to glide wrapper. 3061 * 3062 * @return {Void} 3063 */ 3064 mount: function mount() { 3065 this.bind(); 3066 }, 3067 3068 /** 3069 * Binds `dragstart` event on wrapper to prevent dragging images. 3070 * 3071 * @return {Void} 3072 */ 3073 bind: function bind() { 3074 Binder.on('dragstart', Components.Html.wrapper, this.dragstart); 3075 }, 3076 3077 /** 3078 * Unbinds `dragstart` event on wrapper. 3079 * 3080 * @return {Void} 3081 */ 3082 unbind: function unbind() { 3083 Binder.off('dragstart', Components.Html.wrapper); 3084 }, 3085 3086 /** 3087 * Event handler. Prevents dragging. 3088 * 3089 * @return {Void} 3090 */ 3091 dragstart: function dragstart(event) { 3092 event.preventDefault(); 3093 } 3094 }; 3095 /** 3096 * Remove bindings from images: 3097 * - on destroying, to remove added EventListeners 3098 */ 3099 3100 Events.on('destroy', function () { 3101 Images.unbind(); 3102 Binder.destroy(); 3103 }); 3104 return Images; 3105} 3106 3107function Anchors (Glide, Components, Events) { 3108 /** 3109 * Instance of the binder for DOM Events. 3110 * 3111 * @type {EventsBinder} 3112 */ 3113 var Binder = new EventsBinder(); 3114 /** 3115 * Holds detaching status of anchors. 3116 * Prevents detaching of already detached anchors. 3117 * 3118 * @private 3119 * @type {Boolean} 3120 */ 3121 3122 var detached = false; 3123 /** 3124 * Holds preventing status of anchors. 3125 * If `true` redirection after click will be disabled. 3126 * 3127 * @private 3128 * @type {Boolean} 3129 */ 3130 3131 var prevented = false; 3132 var Anchors = { 3133 /** 3134 * Setups a initial state of anchors component. 3135 * 3136 * @returns {Void} 3137 */ 3138 mount: function mount() { 3139 /** 3140 * Holds collection of anchors elements. 3141 * 3142 * @private 3143 * @type {HTMLCollection} 3144 */ 3145 this._a = Components.Html.wrapper.querySelectorAll('a'); 3146 this.bind(); 3147 }, 3148 3149 /** 3150 * Binds events to anchors inside a track. 3151 * 3152 * @return {Void} 3153 */ 3154 bind: function bind() { 3155 Binder.on('click', Components.Html.wrapper, this.click); 3156 }, 3157 3158 /** 3159 * Unbinds events attached to anchors inside a track. 3160 * 3161 * @return {Void} 3162 */ 3163 unbind: function unbind() { 3164 Binder.off('click', Components.Html.wrapper); 3165 }, 3166 3167 /** 3168 * Handler for click event. Prevents clicks when glide is in `prevent` status. 3169 * 3170 * @param {Object} event 3171 * @return {Void} 3172 */ 3173 click: function click(event) { 3174 if (prevented) { 3175 event.stopPropagation(); 3176 event.preventDefault(); 3177 } 3178 }, 3179 3180 /** 3181 * Detaches anchors click event inside glide. 3182 * 3183 * @return {self} 3184 */ 3185 detach: function detach() { 3186 prevented = true; 3187 3188 if (!detached) { 3189 for (var i = 0; i < this.items.length; i++) { 3190 this.items[i].draggable = false; 3191 } 3192 3193 detached = true; 3194 } 3195 3196 return this; 3197 }, 3198 3199 /** 3200 * Attaches anchors click events inside glide. 3201 * 3202 * @return {self} 3203 */ 3204 attach: function attach() { 3205 prevented = false; 3206 3207 if (detached) { 3208 for (var i = 0; i < this.items.length; i++) { 3209 this.items[i].draggable = true; 3210 } 3211 3212 detached = false; 3213 } 3214 3215 return this; 3216 } 3217 }; 3218
3218glide_esm_define(Anchors, 'items', { 3219 /** 3220 * Gets collection of the arrows HTML elements. 3221 * 3222 * @return {HTMLElement[]} 3223 */ 3224 get: function get() { 3225 return Anchors._a; 3226 } 3227 }); 3228 /** 3229 * Detach anchors inside slides: 3230 * - on swiping, so they won't redirect to its `href` attributes 3231 */ 3232 3233 Events.on('swipe.move', function () { 3234 Anchors.detach(); 3235 }); 3236 /** 3237 * Attach anchors inside slides: 3238 * - after swiping and transitions ends, so they can redirect after click again 3239 */ 3240 3241 Events.on('swipe.end', function () { 3242 Components.Transition.after(function () { 3243 Anchors.attach(); 3244 }); 3245 }); 3246 /** 3247 * Unbind anchors inside slides: 3248 * - on destroying, to bring anchors to its initial state 3249 */ 3250 3251 Events.on('destroy', function () { 3252 Anchors.attach(); 3253 Anchors.unbind(); 3254 Binder.destroy(); 3255 }); 3256 return Anchors; 3257} 3258
vendor: 13,577 bytes, lines 3259-3841
3259var NAV_SELECTOR = '[data-glide-el="controls[nav]"]'; 3260var CONTROLS_SELECTOR = '[data-glide-el^="controls"]'; 3261var PREVIOUS_CONTROLS_SELECTOR = "".concat(CONTROLS_SELECTOR, " [data-glide-dir*=\"<\"]"); 3262var NEXT_CONTROLS_SELECTOR = "".concat(CONTROLS_SELECTOR, " [data-glide-dir*=\">\"]"); 3263function Controls (Glide, Components, Events) { 3264 /** 3265 * Instance of the binder for DOM Events. 3266 * 3267 * @type {EventsBinder} 3268 */ 3269 var Binder = new EventsBinder(); 3270 var capture = supportsPassive$1 ? { 3271 passive: true 3272 } : false; 3273 var Controls = { 3274 /** 3275 * Inits arrows. Binds events listeners 3276 * to the arrows HTML elements. 3277 * 3278 * @return {Void} 3279 */ 3280 mount: function mount() { 3281 /** 3282 * Collection of navigation HTML elements. 3283 * 3284 * @private 3285 * @type {HTMLCollection} 3286 */ 3287 this._n = Components.Html.root.querySelectorAll(NAV_SELECTOR); 3288 /** 3289 * Collection of controls HTML elements. 3290 * 3291 * @private 3292 * @type {HTMLCollection} 3293 */ 3294 3295 this._c = Components.Html.root.querySelectorAll(CONTROLS_SELECTOR); 3296 /** 3297 * Collection of arrow control HTML elements. 3298 * 3299 * @private 3300 * @type {Object} 3301 */ 3302 3303 this._arrowControls = { 3304 previous: Components.Html.root.querySelectorAll(PREVIOUS_CONTROLS_SELECTOR), 3305 next: Components.Html.root.querySelectorAll(NEXT_CONTROLS_SELECTOR) 3306 }; 3307 this.addBindings(); 3308 }, 3309 3310 /** 3311 * Sets active class to current slide. 3312 * 3313 * @return {Void} 3314 */ 3315 setActive: function setActive() { 3316 for (var i = 0; i < this._n.length; i++) { 3317 this.addClass(this._n[i].children); 3318 } 3319 }, 3320 3321 /** 3322 * Removes active class to current slide. 3323 * 3324 * @return {Void} 3325 */ 3326 removeActive: function removeActive() { 3327 for (var i = 0; i < this._n.length; i++) { 3328 this.removeClass(this._n[i].children); 3329 } 3330 }, 3331 3332 /** 3333 * Toggles active class on items inside navigation. 3334 * 3335 * @param {HTMLElement} controls 3336 * @return {Void} 3337 */ 3338 addClass: function addClass(controls) { 3339 var settings = Glide.settings; 3340 var item = controls[Glide.index]; 3341 3342 if (!item) { 3343 return; 3344 } 3345 3346 if (item) { 3347 item.classList.add(settings.classes.nav.active); 3348 siblings(item).forEach(function (sibling) { 3349 sibling.classList.remove(settings.classes.nav.active); 3350 }); 3351 } 3352 }, 3353 3354 /** 3355 * Removes active class from active control. 3356 * 3357 * @param {HTMLElement} controls 3358 * @return {Void} 3359 */ 3360 removeClass: function removeClass(controls) { 3361 var item = controls[Glide.index]; 3362 3363 if (item) { 3364 item.classList.remove(Glide.settings.classes.nav.active); 3365 } 3366 }, 3367 3368 /** 3369 * Calculates, removes or adds `Glide.settings.classes.disabledArrow` class on the control arrows 3370 */ 3371 setArrowState: function setArrowState() { 3372 if (Glide.settings.rewind) { 3373 return; 3374 } 3375 3376 var next = Controls._arrowControls.next; 3377 var previous = Controls._arrowControls.previous; 3378 this.resetArrowState(next, previous); 3379 3380 if (Glide.index === 0) { 3381 this.disableArrow(previous); 3382 } 3383 3384 if (Glide.index === Components.Run.length) { 3385 this.disableArrow(next); 3386 } 3387 }, 3388 3389 /** 3390 * Removes `Glide.settings.classes.disabledArrow` from given NodeList elements 3391 * 3392 * @param {NodeList[]} lists 3393 */ 3394 resetArrowState: function resetArrowState() { 3395 var settings = Glide.settings; 3396 3397 for (var _len = arguments.length, lists = new Array(_len), _key = 0; _key < _len; _key++) { 3398 lists[_key] = arguments[_key]; 3399 } 3400 3401 lists.forEach(function (list) { 3402 list.forEach(function (element) { 3403 element.classList.remove(settings.classes.arrow.disabled); 3404 }); 3405 }); 3406 }, 3407 3408 /** 3409 * Adds `Glide.settings.classes.disabledArrow` to given NodeList elements 3410 * 3411 * @param {NodeList[]} lists 3412 */ 3413 disableArrow: function disableArrow() { 3414 var settings = Glide.settings; 3415 3416 for (var _len2 = arguments.length, lists = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { 3417 lists[_key2] = arguments[_key2]; 3418 } 3419 3420 lists.forEach(function (list) { 3421 list.forEach(function (element) { 3422 element.classList.add(settings.classes.arrow.disabled); 3423 }); 3424 }); 3425 }, 3426 3427 /** 3428 * Adds handles to the each group of controls. 3429 * 3430 * @return {Void} 3431 */ 3432 addBindings: function addBindings() { 3433 for (var i = 0; i < this._c.length; i++) { 3434 this.bind(this._c[i].children); 3435 } 3436 }, 3437 3438 /** 3439 * Removes handles from the each group of controls. 3440 * 3441 * @return {Void} 3442 */ 3443 removeBindings: function removeBindings() { 3444 for (var i = 0; i < this._c.length; i++) { 3445 this.unbind(this._c[i].children); 3446 } 3447 }, 3448 3449 /** 3450 * Binds events to arrows HTML elements. 3451 * 3452 * @param {HTMLCollection} elements 3453 * @return {Void} 3454 */ 3455 bind: function bind(elements) { 3456 for (var i = 0; i < elements.length; i++) { 3457 Binder.on('click', elements[i], this.click); 3458 Binder.on('touchstart', elements[i], this.click, capture); 3459 } 3460 }, 3461 3462 /** 3463 * Unbinds events binded to the arrows HTML elements. 3464 * 3465 * @param {HTMLCollection} elements 3466 * @return {Void} 3467 */ 3468 unbind: function unbind(elements) { 3469 for (var i = 0; i < elements.length; i++) { 3470 Binder.off(['click', 'touchstart'], elements[i]); 3471 } 3472 }, 3473 3474 /** 3475 * Handles `click` event on the arrows HTML elements. 3476 * Moves slider in direction given via the 3477 * `data-glide-dir` attribute. 3478 * 3479 * @param {Object} event 3480 * @return {void} 3481 */ 3482 click: function click(event) { 3483 if (!supportsPassive$1 && event.type === 'touchstart') { 3484 event.preventDefault(); 3485 } 3486 3487 var direction = event.currentTarget.getAttribute('data-glide-dir'); 3488 Components.Run.make(Components.Direction.resolve(direction)); 3489 } 3490 }; 3491 glide_esm_define(Controls, 'items', { 3492 /** 3493 * Gets collection of the controls HTML elements. 3494 * 3495 * @return {HTMLElement[]} 3496 */ 3497 get: function get() { 3498 return Controls._c; 3499 } 3500 }); 3501 /** 3502 * Swap active class of current navigation item: 3503 * - after mounting to set it to initial index 3504 * - after each move to the new index 3505 */ 3506 3507 Events.on(['mount.after', 'move.after'], function () { 3508 Controls.setActive(); 3509 }); 3510 /** 3511 * Add or remove disabled class of arrow elements 3512 */ 3513 3514 Events.on(['mount.after', 'run'], function () { 3515 Controls.setArrowState(); 3516 }); 3517 /** 3518 * Remove bindings and HTML Classes: 3519 * - on destroying, to bring markup to its initial state 3520 */ 3521 3522 Events.on('destroy', function () { 3523 Controls.removeBindings(); 3524 Controls.removeActive(); 3525 Binder.destroy(); 3526 }); 3527 return Controls; 3528} 3529 3530function Keyboard (Glide, Components, Events) { 3531 /** 3532 * Instance of the binder for DOM Events. 3533 * 3534 * @type {EventsBinder} 3535 */ 3536 var Binder = new EventsBinder(); 3537 var Keyboard = { 3538 /** 3539 * Binds keyboard events on component mount. 3540 * 3541 * @return {Void} 3542 */ 3543 mount: function mount() { 3544 if (Glide.settings.keyboard) { 3545 this.bind(); 3546 } 3547 }, 3548 3549 /** 3550 * Adds keyboard press events. 3551 * 3552 * @return {Void} 3553 */ 3554 bind: function bind() { 3555 Binder.on('keyup', document, this.press); 3556 }, 3557 3558 /** 3559 * Removes keyboard press events. 3560 * 3561 * @return {Void} 3562 */ 3563 unbind: function unbind() { 3564 Binder.off('keyup', document); 3565 }, 3566 3567 /** 3568 * Handles keyboard's arrows press and moving glide foward and backward. 3569 * 3570 * @param {Object} event 3571 * @return {Void} 3572 */ 3573 press: function press(event) { 3574 var perSwipe = Glide.settings.perSwipe; 3575 3576 if (event.keyCode === 39) { 3577 Components.Run.make(Components.Direction.resolve("".concat(perSwipe, ">"))); 3578 } 3579 3580 if (event.keyCode === 37) { 3581 Components.Run.make(Components.Direction.resolve("".concat(perSwipe, "<"))); 3582 } 3583 } 3584 }; 3585 /** 3586 * Remove bindings from keyboard: 3587 * - on destroying to remove added events 3588 * - on updating to remove events before remounting 3589 */ 3590 3591 Events.on(['destroy', 'update'], function () { 3592 Keyboard.unbind(); 3593 }); 3594 /** 3595 * Remount component 3596 * - on updating to reflect potential changes in settings 3597 */ 3598 3599 Events.on('update', function () { 3600 Keyboard.mount(); 3601 }); 3602 /** 3603 * Destroy binder: 3604 * - on destroying to remove listeners 3605 */ 3606 3607 Events.on('destroy', function () { 3608 Binder.destroy(); 3609 }); 3610 return Keyboard; 3611} 3612 3613function Autoplay (Glide, Components, Events) { 3614 /** 3615 * Instance of the binder for DOM Events. 3616 * 3617 * @type {EventsBinder} 3618 */ 3619 var Binder = new EventsBinder(); 3620 var Autoplay = { 3621 /** 3622 * Initializes autoplaying and events. 3623 * 3624 * @return {Void} 3625 */ 3626 mount: function mount() { 3627 this.enable(); 3628 this.start(); 3629 3630 if (Glide.settings.hoverpause) { 3631 this.bind(); 3632 } 3633 }, 3634 3635 /** 3636 * Enables autoplaying 3637 * 3638 * @returns {Void} 3639 */ 3640 enable: function enable() { 3641 this._e = true; 3642 }, 3643 3644 /** 3645 * Disables autoplaying. 3646 * 3647 * @returns {Void} 3648 */ 3649 disable: function disable() { 3650 this._e = false; 3651 }, 3652 3653 /** 3654 * Starts autoplaying in configured interval. 3655 * 3656 * @param {Boolean|Number} force Run autoplaying with passed interval regardless of `autoplay` settings 3657 * @return {Void} 3658 */ 3659 start: function start() { 3660 var _this = this; 3661 3662 if (!this._e) { 3663 return; 3664 } 3665 3666 this.enable(); 3667 3668 if (Glide.settings.autoplay) { 3669 if (isUndefined(this._i)) { 3670 this._i = setInterval(function () { 3671 _this.stop(); 3672 3673 Components.Run.make('>'); 3674 3675 _this.start(); 3676 3677 Events.emit('autoplay'); 3678 }, this.time); 3679 } 3680 } 3681 }, 3682 3683 /** 3684 * Stops autorunning of the glide. 3685 * 3686 * @return {Void} 3687 */ 3688 stop: function stop() { 3689 this._i = clearInterval(this._i); 3690 }, 3691 3692 /** 3693 * Stops autoplaying while mouse is over glide's area. 3694 * 3695 * @return {Void} 3696 */ 3697 bind: function bind() { 3698 var _this2 = this; 3699 3700 Binder.on('mouseover', Components.Html.root, function () { 3701 if (_this2._e) { 3702 _this2.stop(); 3703 } 3704 }); 3705 Binder.on('mouseout', Components.Html.root, function () { 3706 if (_this2._e) { 3707 _this2.start(); 3708 } 3709 }); 3710 }, 3711 3712 /** 3713 * Unbind mouseover events. 3714 * 3715 * @returns {Void} 3716 */ 3717 unbind: function unbind() { 3718 Binder.off(['mouseover', 'mouseout'], Components.Html.root); 3719 } 3720 }; 3721 glide_esm_define(Autoplay, 'time', { 3722 /** 3723 * Gets time period value for the autoplay interval. Prioritizes 3724 * times in `data-glide-autoplay` attrubutes over options. 3725 * 3726 * @return {Number} 3727 */ 3728 get: function get() { 3729 var autoplay = Components.Html.slides[Glide.index].getAttribute('data-glide-autoplay'); 3730 3731 if (autoplay) { 3732 return toInt(autoplay); 3733 } 3734 3735 return toInt(Glide.settings.autoplay); 3736 } 3737 }); 3738 /** 3739 * Stop autoplaying and unbind events: 3740 * - on destroying, to clear defined interval 3741 * - on updating via API to reset interval that may changed 3742 */ 3743 3744 Events.on(['destroy', 'update'], function () { 3745 Autoplay.unbind(); 3746 }); 3747 /** 3748 * Stop autoplaying: 3749 * - before each run, to restart autoplaying 3750 * - on pausing via API 3751 * - on destroying, to clear defined interval 3752 * - while starting a swipe 3753 * - on updating via API to reset interval that may changed 3754 */ 3755 3756 Events.on(['run.before', 'swipe.start', 'update'], function () { 3757 Autoplay.stop(); 3758 }); 3759 Events.on(['pause', 'destroy'], function () { 3760 Autoplay.disable(); 3761 Autoplay.stop(); 3762 }); 3763 /** 3764 * Start autoplaying: 3765 * - after each run, to restart autoplaying 3766 * - on playing via API 3767 * - while ending a swipe 3768 */ 3769 3770 Events.on(['run.after', 'swipe.end'], function () { 3771 Autoplay.start(); 3772 }); 3773 /** 3774 * Start autoplaying: 3775 * - after each run, to restart autoplaying 3776 * - on playing via API 3777 * - while ending a swipe 3778 */ 3779 3780 Events.on(['play'], function () { 3781 Autoplay.enable(); 3782 Autoplay.start(); 3783 }); 3784 /** 3785 * Remount autoplaying: 3786 * - on updating via API to reset interval that may changed 3787 */ 3788 3789 Events.on('update', function () { 3790 Autoplay.mount(); 3791 }); 3792 /** 3793 * Destroy a binder: 3794 * - on destroying glide instance to clearup listeners 3795 */ 3796 3797 Events.on('destroy', function () { 3798 Binder.destroy(); 3799 }); 3800 return Autoplay; 3801} 3802 3803/** 3804 * Sorts keys of breakpoint object so they will be ordered from lower to bigger. 3805 * 3806 * @param {Object} points 3807 * @returns {Object} 3808 */ 3809 3810function sortBreakpoints(points) { 3811 if (isObject(points)) { 3812 return sortKeys(points); 3813 } else { 3814 warn("Breakpoints option must be an object"); 3815 } 3816 3817 return {}; 3818} 3819 3820function Breakpoints (Glide, Components, Events) { 3821 /** 3822 * Instance of the binder for DOM Events. 3823 * 3824 * @type {EventsBinder} 3825 */ 3826 var Binder = new EventsBinder(); 3827 /** 3828 * Holds reference to settings. 3829 * 3830 * @type {Object} 3831 */ 3832 3833 var settings = Glide.settings; 3834 /** 3835 * Holds reference to breakpoints object in settings. Sorts breakpoints 3836 * from smaller to larger. It is required in order to proper 3837 * matching currently active breakpoint settings. 3838 * 3839 * @type {Object} 3840 */ 3841
3842 var points = sortBreakpoints(settings.breakpoints); 3843 /** 3844 * Cache initial settings before overwritting. 3845 * 3846 * @type {Object} 3847 */ 3848 3849 var defaults = Object.assign({}, settings); 3850 var Breakpoints = { 3851 /** 3852 * Matches settings for currectly matching media breakpoint. 3853 * 3854 * @param {Object} points 3855 * @returns {Object} 3856 */ 3857 match: function match(points) { 3858 if (typeof window.matchMedia !== 'undefined') { 3859 for (var point in points) { 3860 if (points.hasOwnProperty(point)) { 3861 if (window.matchMedia("(max-width: ".concat(point, "px)")).matches) { 3862 return points[point]; 3863 } 3864 } 3865 } 3866 } 3867 3868 return defaults; 3869 } 3870 }; 3871 /** 3872 * Overwrite instance settings with currently matching breakpoint settings. 3873 * This happens right after component initialization. 3874 */ 3875 3876 Object.assign(settings, Breakpoints.match(points)); 3877 /** 3878 * Update glide with settings of matched brekpoint: 3879 * - window resize to update slider 3880 */ 3881 3882 Binder.on('resize', window, throttle(function () { 3883 Glide.settings = mergeOptions(settings, Breakpoints.match(points)); 3884 }, Glide.settings.throttle)); 3885 /** 3886 * Resort and update default settings: 3887 * - on reinit via API, so breakpoint matching will be performed with options 3888 */ 3889 3890 Events.on('update', function () { 3891 points = sortBreakpoints(points); 3892 defaults = Object.assign({}, settings); 3893 }); 3894 /** 3895 * Unbind resize listener: 3896 * - on destroying, to bring markup to its initial state 3897 */ 3898 3899 Events.on('destroy', function () { 3900 Binder.off('resize', window); 3901 }); 3902 return Breakpoints; 3903} 3904 3905var COMPONENTS = { 3906 // Required 3907 Html: Html, 3908 Translate: Translate, 3909 Transition: Transition, 3910 Direction: Direction, 3911 Peek: Peek, 3912 Sizes: Sizes, 3913 Gaps: Gaps, 3914 Move: Move, 3915 Clones: Clones, 3916 Resize: Resize, 3917 Build: Build, 3918 Run: Run, 3919 // Optional 3920 Swipe: Swipe, 3921 Images: Images, 3922 Anchors: Anchors, 3923 Controls: Controls, 3924 Keyboard: Keyboard, 3925 Autoplay: Autoplay, 3926 Breakpoints: Breakpoints 3927}; 3928 3929var Glide = /*#__PURE__*/function (_Core) { 3930 _inherits(Glide, _Core); 3931 3932 var _super = _createSuper(Glide); 3933 3934 function Glide() { 3935 _classCallCheck(this, Glide); 3936 3937 return _super.apply(this, arguments); 3938 } 3939 3940 _createClass(Glide, [{ 3941 key: "mount", 3942 value: function mount() { 3943 var extensions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 3944 return _get(_getPrototypeOf(Glide.prototype), "mount", this).call(this, Object.assign({}, COMPONENTS, extensions)); 3945 } 3946 }]); 3947 3948 return Glide; 3949}(Glide$1); 3950 3951 3952 3953;// CONCATENATED MODULE: ./assets/js/_pages/home/components/homePage.js 3954function homePage_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 3955 3956function homePage_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 3957 3958function homePage_createClass(Constructor, protoProps, staticProps) { if (protoProps) homePage_defineProperties(Constructor.prototype, protoProps); if (staticProps) homePage_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 3959 3960 3961 3962var HomePage = /*#__PURE__*/function () { 3963 function HomePage() { 3964 homePage_classCallCheck(this, HomePage); 3965 } 3966 3967 homePage_createClass(HomePage, [{ 3968 key: "init", 3969 value: // eslint-disable-next-line class-methods-use-this 3970 function init() { 3971 var glide = new Glide('.glide', { 3972 startAt: 0, 3973 perView: 6, 3974 rewind: false, 3975 touchRatio: 0.3, 3976 move: { 3977 value: 3 3978 }, 3979 peek: { 3980 before: 0, 3981 after: 20 3982 }, 3983 breakpoints: { 3984 1024: { 3985 perView: 3, 3986 animationDuration: 600 3987 }, 3988 640: { 3989 perView: 2, 3990 animationDuration: 600 3991 } 3992 } 3993 }); 3994 glide.on('run', function (arg) { 3995 var _document$querySelect = document.querySelectorAll('.glide__slide'), 3996 length = _document$querySelect.length; 3997 3998 var newIndex = arg.direction === '>' ? glide.index + (glide.settings.perView - 1) : glide.index - (glide.settings.perView - 1); 3999 4000 if (newIndex > length - 2) { 4001 glide.index = length - 1; 4002 } else if (newIndex < 0) { 4003 glide.index = 0; 4004 } else { 4005 glide.index = newIndex; 4006 } 4007 }); 4008 glide.mount(); 4009 } 4010 }]); 4011 4012 return HomePage; 4013}(); 4014 4015 4016;// CONCATENATED MODULE: ./assets/js/_pages/home/home.js 4017 4018 4019var homePage = new HomePage();
4020homePage.init(); 4021lazyload(); 4022})(); 4023 4024// This entry need to be wrapped in an IIFE because it need to be in strict mode. 4025(() => { 4026"use strict"; 4027// extracted by mini-css-extract-plugin 4028 4029})(); 4030 4031/******/ })() 4032;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.