vendor: 78 bytes, lines 1-3
1/******/ (() => { // webpackBootstrap 2/******/ var __webpack_modules__ = ({ 3
vendor: 14,757 bytes, lines 4-13
4/***/ "./node_modules/aos/dist/aos.js": 5/*!**************************************!*\ 6 !*** ./node_modules/aos/dist/aos.js ***! 7 \**************************************/ 8/***/ (function(module) { 9 10!function(e,t){ true?module.exports=t():0}(this,function(){return function(e){function t(o){if(n[o])return n[o].exports;var i=n[o]={exports:{},id:o,loaded:!1};return e[o].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="dist/",t(0)}([function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},r=n(1),a=(o(r),n(6)),u=o(a),c=n(7),s=o(c),f=n(8),d=o(f),l=n(9),p=o(l),m=n(10),b=o(m),v=n(11),y=o(v),g=n(14),h=o(g),w=[],k=!1,x={offset:120,delay:0,easing:"ease",duration:400,disable:!1,once:!1,startEvent:"DOMContentLoaded",throttleDelay:99,debounceDelay:50,disableMutationObserver:!1},j=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(e&&(k=!0),k)return w=(0,y.default)(w,x),(0,b.default)(w,x.once),w},O=function(){w=(0,h.default)(),j()},M=function(){w.forEach(function(e,t){e.node.removeAttribute("data-aos"),e.node.removeAttribute("data-aos-easing"),e.node.removeAttribute("data-aos-duration"),e.node.removeAttribute("data-aos-delay")})},S=function(e){return e===!0||"mobile"===e&&p.default.mobile()||"phone"===e&&p.default.phone()||"tablet"===e&&p.default.tablet()||"function"==typeof e&&e()===!0},_=function(e){x=i(x,e),w=(0,h.default)();var t=document.all&&!window.atob;return S(x.disable)||t?M():(x.disableMutationObserver||d.default.isSupported()||(console.info('\n aos: MutationObserver is not supported on this browser,\n code mutations observing has been disabled.\n You may have to call "refreshHard()" by yourself.\n '),x.disableMutationObserver=!0),document.querySelector("body").setAttribute("data-aos-easing",x.easing),document.querySelector("body").setAttribute("data-aos-duration",x.duration),document.querySelector("body").setAttribute("data-aos-delay",x.delay),"DOMContentLoaded"===x.startEvent&&["complete","interactive"].indexOf(document.readyState)>-1?j(!0):"load"===x.startEvent?window.addEventListener(x.startEvent,function(){j(!0)}):document.addEventListener(x.startEvent,function(){j(!0)}),window.addEventListener("resize",(0,s.default)(j,x.debounceDelay,!0)),window.addEventListener("orientationchange",(0,s.default)(j,x.debounceDelay,!0)),window.addEventListener("scroll",(0,u.default)(function(){(0,b.default)(w,x.once)},x.throttleDelay)),x.disableMutationObserver||d.default.ready("[data-aos]",O),w)};e.exports={init:_,refresh:j,refreshHard:O}},function(e,t){},,,,,function(e,t){(function(t){"use strict";function n(e,t,n){function o(t){var n=b,o=v;return b=v=void 0,k=t,g=e.apply(o,n)}function r(e){return k=e,h=setTimeout(f,t),M?o(e):g}function a(e){var n=e-w,o=e-k,i=t-n;return S?j(i,y-o):i}function c(e){var n=e-w,o=e-k;return void 0===w||n>=t||n<0||S&&o>=y}function f(){var e=O();return c(e)?d(e):void(h=setTimeout(f,a(e)))}function d(e){return h=void 0,_&&b?o(e):(b=v=void 0,g)}function l(){void 0!==h&&clearTimeout(h),k=0,b=w=v=h=void 0}function p(){return void 0===h?g:d(O())}function m(){var e=O(),n=c(e);if(b=arguments,v=this,w=e,n){if(void 0===h)return r(w);if(S)return h=setTimeout(f,t),o(w)}return void 0===h&&(h=setTimeout(f,t)),g}var b,v,y,g,h,w,k=0,M=!1,S=!1,_=!0;if("function"!=typeof e)throw new TypeError(s);return t=u(t)||0,i(n)&&(M=!!n.leading,S="maxWait"in n,y=S?x(u(n.maxWait)||0,t):y,_="trailing"in n?!!n.trailing:_),m.cancel=l,m.flush=p,m}function o(e,t,o){var r=!0,a=!0;if("function"!=typeof e)throw new TypeError(s);return i(o)&&(r="leading"in o?!!o.leading:r,a="trailing"in o?!!o.trailing:a),n(e,t,{leading:r,maxWait:t,trailing:a})}function i(e){var t="undefined"==typeof e?"undefined":c(e);return!!e&&("object"==t||"function"==t)}function r(e){return!!e&&"object"==("undefined"==typeof e?"undefined":c(e))}function a(e){return"symbol"==("undefined"==typeof e?"undefined":c(e))||r(e)&&k.call(e)==d}function u(e){if("number"==typeof e)return e;if(a(e))return f;if(i(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=i(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(l,"");var n=m.test(e);return n||b.test(e)?v(e.slice(2),n?2:8):p.test(e)?f:+e}var c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s="Expected a function",f=NaN,d="[object Symbol]",l=/^\s+|\s+$/g,p=/^[-+]0x[0-9a-f]+$/i,m=/^0b[01]+$/i,b=/^0o[0-7]+$/i,v=parseInt,y="object"==("undefined"==typeof t?"undefined":c(t))&&t&&t.Object===Object&&t,g="object"==("undefined"==typeof self?"undefined":c(self))&&self&&self.Object===Object&&self,h=y||g||Function("return this")(),w=Object.prototype,k=w.toString,x=Math.max,j=Math.min,O=function(){return h.Date.now()};e.exports=o}).call(t,function(){return this}())},function(e,t){(function(t){"use strict";function n(e,t,n){function i(t){var n=b,o=v;return b=v=void 0,O=t,g=e.apply(o,n)}function r(e){return O=e,h=setTimeout(f,t),M?i(e):g}function u(e){var n=e-w,o=e-O,i=t-n;return S?x(i,y-o):i}function s(e){var n=e-w,o=e-O;return void 0===w||n>=t||n<0||S&&o>=y}function f(){var e=j();return s(e)?d(e):void(h=setTimeout(f,u(e)))}function d(e){return h=void 0,_&&b?i(e):(b=v=void 0,g)}function l(){void 0!==h&&clearTimeout(h),O=0,b=w=v=h=void 0}function p(){return void 0===h?g:d(j())}function m(){var e=j(),n=s(e);if(b=arguments,v=this,w=e,n){if(void 0===h)return r(w);if(S)return h=setTimeout(f,t),i(w)}return void 0===h&&(h=setTimeout(f,t)),g}var b,v,y,g,h,w,O=0,M=!1,S=!1,_=!0;if("function"!=typeof e)throw new TypeError(c);return t=a(t)||0,o(n)&&(M=!!n.leading,S="maxWait"in n,y=S?k(a(n.maxWait)||0,t):y,_="trailing"in n?!!n.trailing:_),m.cancel=l,m.flush=p,m}function o(e){var t="undefined"==typeof e?"undefined":u(e);return!!e&&("object"==t||"function"==t)}function i(e){return!!e&&"object"==("undefined"==typeof e?"undefined":u(e))}function r(e){return"symbol"==("undefined"==typeof e?"undefined":u(e))||i(e)&&w.call(e)==f}function a(e){if("number"==typeof e)return e;if(r(e))return s;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(d,"");var n=p.test(e);return n||m.test(e)?b(e.slice(2),n?2:8):l.test(e)?s:+e}var u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c="Expected a function",s=NaN,f="[object Symbol]",d=/^\s+|\s+$/g,l=/^[-+]0x[0-9a-f]+$/i,p=/^0b[01]+$/i,m=/^0o[0-7]+$/i,b=parseInt,v="object"==("undefined"==typeof t?"undefined":u(t))&&t&&t.Object===Object&&t,y="object"==("undefined"==typeof self?"undefined":u(self))&&self&&self.Object===Object&&self,g=v||y||Function("return this")(),h=Object.prototype,w=h.toString,k=Math.max,x=Math.min,j=function(){return g.Date.now()};e.exports=n}).call(t,function(){return this}())},function(e,t){"use strict";function n(e){var t=void 0,o=void 0,i=void 0;for(t=0;t<e.length;t+=1){if(o=e[t],o.dataset&&o.dataset.aos)return!0;if(i=o.children&&n(o.children))return!0}return!1}function o(){return window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver}function i(){return!!o()}function r(e,t){var n=window.document,i=o(),r=new i(a);u=t,r.observe(n.documentElement,{childList:!0,subtree:!0,removedNodes:!0})}function a(e){e&&e.forEach(function(e){var t=Array.prototype.slice.call(e.addedNodes),o=Array.prototype.slice.call(e.removedNodes),i=t.concat(o);if(n(i))return u()})}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){};t.default={isSupported:i,ready:r}},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(){return navigator.userAgent||navigator.vendor||window.opera||""}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i,a=/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i,u=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i,c=/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i,s=function(){function e(){n(this,e)}return i(e,[{key:"phone",value:function(){var e=o();return!(!r.test(e)&&!a.test(e.substr(0,4)))}},{key:"mobile",value:function(){var e=o();return!(!u.test(e)&&!c.test(e.substr(0,4)))}},{key:"tablet",value:function(){return this.mobile()&&!this.phone()}}]),e}();t.default=new s},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t,n){var o=e.node.getAttribute("data-aos-once");t>e.position?e.node.classList.add("aos-animate"):"undefined"!=typeof o&&("false"===o||!n&&"true"!==o)&&e.node.classList.remove("aos-animate")},o=function(e,t){var o=window.pageYOffset,i=window.innerHeight;e.forEach(function(e,r){n(e,i+o,t)})};t.default=o},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(12),r=o(i),a=function(e,t){return e.forEach(function(e,n){e.node.classList.add("aos-init"),e.position=(0,r.default)(e.node,t.offset)}),e};t.default=a},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(13),r=o(i),a=function(e,t){var n=0,o=0,i=window.innerHeight,a={offset:e.getAttribute("data-aos-offset"),anchor:e.getAttribute("data-aos-anchor"),anchorPlacement:e.getAttribute("data-aos-anchor-placement")};switch(a.offset&&!isNaN(a.offset)&&(o=parseInt(a.offset)),a.anchor&&document.querySelectorAll(a.anchor)&&(e=document.querySelectorAll(a.anchor)[0]),n=(0,r.default)(e).top,a.anchorPlacement){case"top-bottom":break;case"center-bottom":n+=e.offsetHeight/2;break;case"bottom-bottom":n+=e.offsetHeight;break;case"top-center":n+=i/2;break;case"bottom-center":n+=i/2+e.offsetHeight;break;case"center-center":n+=i/2+e.offsetHeight/2;break;case"top-top":n+=i;break;case"bottom-top":n+=e.offsetHeight+i;break;case"center-top":n+=e.offsetHeight/2+i}return a.anchorPlacement||a.offset||isNaN(t)||(o=t),n+o};t.default=a},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){for(var t=0,n=0;e&&!isNaN(e.offsetLeft)&&!isNaN(e.offsetTop);)t+=e.offsetLeft-("BODY"!=e.tagName?e.scrollLeft:0),n+=e.offsetTop-("BODY"!=e.tagName?e.scrollTop:0),e=e.offsetParent;return{top:n,left:t}};t.default=n},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){return e=e||document.querySelectorAll("[data-aos]"),Array.prototype.map.call(e,function(e){return{node:e}})};t.default=n}])}); 11 12/***/ }), 13
14/***/ "./resources/themes/thesaas/js/src/config.js": 15/*!***************************************************!*\ 16 !*** ./resources/themes/thesaas/js/src/config.js ***! 17 \***************************************************/ 18/***/ (() => { 19 20$(function () { 21 /* 22 |-------------------------------------------------------------------------- 23 | Configure your website 24 |-------------------------------------------------------------------------- 25 | 26 | We provided several configuration variables for your ease of development. 27 | Read their complete description and modify them based on your need. 28 | 29 */ 30 page.config({ 31 /* 32 |-------------------------------------------------------------------------- 33 | Google API Key 34 |-------------------------------------------------------------------------- 35 | 36 | Here you may specify your Google API key if you need to use Google Maps 37 | in your application 38 | 39 | https://developers.google.com/maps/documentation/javascript/get-api-key 40 | 41 */ 42 googleApiKey: 'AIzaSyDRBLFOTTh2NFM93HpUA4ZrA99yKnCAsto', 43 44 /* 45 |-------------------------------------------------------------------------- 46 | Google Analytics Tracking 47 |-------------------------------------------------------------------------- 48 | 49 | If you want to use Google Analytics, you can specify your Tracking ID in 50 | this option. Your key would be a value like: UA-12345678-9 51 | 52 */ 53 googleAnalyticsId: '', 54 55 /* 56 |-------------------------------------------------------------------------- 57 | Google reCAPTCHA 58 |-------------------------------------------------------------------------- 59 | 60 | reCAPTCHA protects you against spam and other types of automated abuse. 61 | Please signup for an API key pair and insert your `Site key` value to the 62 | following variable. 63 | 64 | http://www.google.com/recaptcha/admin 65 | 66 */ 67 reCaptchaSiteKey: '6Ldaf0MUAAAAAHdsMv_7dND7BSTvdrE6VcQKpM-n', 68 // See available languages: https://developers.google.com/recaptcha/docs/language 69 reCaptchaLanguage: '', 70 71 /* 72 |-------------------------------------------------------------------------- 73 | Disable AOS on mobile 74 |-------------------------------------------------------------------------- 75 | 76 | If true, the Animate On Scroll animations don't run on mobile devices. 77 | 78 */ 79 disableAOSonMobile: true, 80 81 /* 82 |-------------------------------------------------------------------------- 83 | Smooth Scroll 84 |-------------------------------------------------------------------------- 85 | 86 | If true, the browser's scrollbar moves smoothly on scroll and gives your 87 | visitor a better experience for scrolling. 88 | 89 */ 90 smoothScroll: true 91 }); 92}); 93 94/***/ }), 95
96/***/ "./resources/themes/thesaas/js/src/script.js": 97/*!***************************************************!*\ 98 !*** ./resources/themes/thesaas/js/src/script.js ***! 99 \***************************************************/ 100/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 101 102"use strict"; 103__webpack_require__.r(__webpack_exports__); 104/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"); 105/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__); 106/* 107|-------------------------------------------------------------------------- 108| Custom Javascript code 109|-------------------------------------------------------------------------- 110| 111| Now that you configured your website, you can write additional Javascript 112| code inside the following function. You might want to add more plugins and 113| initialize them in this file. 114| 115*/ 116jquery__WEBPACK_IMPORTED_MODULE_0___default()(function () {}); 117 118 119/***/ }), 120
121/***/ "./resources/themes/thesaas/plugin/thesaas/js/loaders/core.js": 122/*!********************************************************************!*\ 123 !*** ./resources/themes/thesaas/plugin/thesaas/js/loaders/core.js ***! 124 \********************************************************************/ 125/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { 126 127/* 128|-------------------------------------------------------------------------- 129| Main 130|-------------------------------------------------------------------------- 131| 132| The start point of the project. Include jQuery, Bootstrap and required 133| plugins and define page object. These files are mandatory. 134| 135*/ 136__webpack_require__(/*! ../partials/main.js */ "./resources/themes/thesaas/plugin/thesaas/js/partials/main.js"); 137 138__webpack_require__(/*! ../vendors/jquery.js */ "./resources/themes/thesaas/plugin/thesaas/js/vendors/jquery.js"); 139 140__webpack_require__(/*! ../vendors/bootstrap.js */ "./resources/themes/thesaas/plugin/thesaas/js/vendors/bootstrap.js"); 141 142/***/ }), 143
144/***/ "./resources/themes/thesaas/plugin/thesaas/js/loaders/partials.js": 145/*!************************************************************************!*\ 146 !*** ./resources/themes/thesaas/plugin/thesaas/js/loaders/partials.js ***! 147 \************************************************************************/ 148/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { 149 150/* 151|-------------------------------------------------------------------------- 152| Partials 153|-------------------------------------------------------------------------- 154| 155| Split the application code to several files. Almost all of the following 156| files are required for the application to work properly. 157| 158*/ 159__webpack_require__(/*! ../partials/config.js */ "./resources/themes/thesaas/plugin/thesaas/js/partials/config.js"); 160 161__webpack_require__(/*! ../partials/bind.js */ "./resources/themes/thesaas/plugin/thesaas/js/partials/bind.js"); 162 163__webpack_require__(/*! ../partials/drawer.js */ "./resources/themes/thesaas/plugin/thesaas/js/partials/drawer.js"); 164 165__webpack_require__(/*! ../partials/font.js */ "./resources/themes/thesaas/plugin/thesaas/js/partials/font.js"); 166 167__webpack_require__(/*! ../partials/form.js */ "./resources/themes/thesaas/plugin/thesaas/js/partials/form.js"); 168 169__webpack_require__(/*! ../partials/mailer.js */ "./resources/themes/thesaas/plugin/thesaas/js/partials/mailer.js"); 170 171__webpack_require__(/*! ../partials/map.js */ "./resources/themes/thesaas/plugin/thesaas/js/partials/map.js"); 172 173__webpack_require__(/*! ../partials/modal.js */ "./resources/themes/thesaas/plugin/thesaas/js/partials/modal.js"); 174 175__webpack_require__(/*! ../partials/navbar.js */ "./resources/themes/thesaas/plugin/thesaas/js/partials/navbar.js"); 176 177__webpack_require__(/*! ../partials/offcanvas.js */ "./resources/themes/thesaas/plugin/thesaas/js/partials/offcanvas.js"); 178 179__webpack_require__(/*! ../partials/popup.js */ "./resources/themes/thesaas/plugin/thesaas/js/partials/popup.js"); 180 181__webpack_require__(/*! ../partials/recaptcha.js */ "./resources/themes/thesaas/plugin/thesaas/js/partials/recaptcha.js"); 182 183__webpack_require__(/*! ../partials/scroll.js */ "./resources/themes/thesaas/plugin/thesaas/js/partials/scroll.js"); 184 185__webpack_require__(/*! ../partials/section.js */ "./resources/themes/thesaas/plugin/thesaas/js/partials/section.js"); 186 187__webpack_require__(/*! ../partials/sidebar.js */ "./resources/themes/thesaas/plugin/thesaas/js/partials/sidebar.js"); 188 189__webpack_require__(/*! ../partials/video.js */ "./resources/themes/thesaas/plugin/thesaas/js/partials/video.js"); 190 191__webpack_require__(/*! ../partials/util.js */ "./resources/themes/thesaas/plugin/thesaas/js/partials/util.js"); 192 193/***/ }), 194
195/***/ "./resources/themes/thesaas/plugin/thesaas/js/partials/bind.js": 196/*!*********************************************************************!*\ 197 !*** ./resources/themes/thesaas/plugin/thesaas/js/partials/bind.js ***! 198 \*********************************************************************/ 199/***/ (() => { 200 201/** 202 * Bind input changes to data attributes 203 */ 204+function ($) { 205 page.initBind = function () { 206 // Set the inner text 207 // 208 $('[data-bind-radio]').each(function () { 209 var e = $(this), 210 radio = e.data('bind-radio'), 211 value = $('input[name="' + radio + '"]:checked').val(); 212 e.text(e.dataAttr(value, e.text())); 213 $('input[name="' + radio + '"]').on('change', function () { 214 var value = $('input[name="' + radio + '"]:checked').val(); 215 $('[data-bind-radio="' + radio + '"]').each(function () { 216 var e = $(this); 217 e.text(e.dataAttr(value, e.text())); 218 }); 219 }); 220 }); // Set href attribute 221 // 222 223 $('[data-bind-href]').each(function () { 224 var e = $(this), 225 radio = e.data('bind-href'), 226 value = $('input[name="' + radio + '"]:checked').val(); 227 e.attr('href', e.dataAttr(value)); 228 $('input[name="' + radio + '"]').on('change', function () { 229 var value = $('input[name="' + radio + '"]:checked').val(); 230 $('[data-bind-href="' + radio + '"]').each(function () { 231 var e = $(this); 232 e.attr('href', e.dataAttr(value)); 233 }); 234 }); 235 }); 236 }; 237}(jQuery); 238 239/***/ }), 240
241/***/ "./resources/themes/thesaas/plugin/thesaas/js/partials/config.js": 242/*!***********************************************************************!*\ 243 !*** ./resources/themes/thesaas/plugin/thesaas/js/partials/config.js ***! 244 \***********************************************************************/ 245/***/ (() => { 246 247/** 248 * Config the application behaviour. 249 */ 250+function ($) { 251 page.config = function (options) { 252 // Return config value 253 if (typeof options === 'string') { 254 return page.defaults[options]; 255 } // Save configs 256 257 258 $.extend(true, page.defaults, options); // Make necessary changes 259 // 260 261 if (!page.defaults.smoothScroll) { 262 SmoothScroll.destroy(); 263 } // Google map 264 // 265 266 267 if ($('[data-provide~="map"]').length && window["google.maps.Map"] === undefined) { 268 $.getScript("https://maps.googleapis.com/maps/api/js?key=" + page.defaults.googleApiKey + "&callback=page.initMap"); 269 } // Google Analytics 270 // 271 272 273 if (page.defaults.googleAnalyticsId) { 274 (function (i, s, o, g, r, a, m) { 275 i['GoogleAnalyticsObject'] = r; 276 i[r] = i[r] || function () { 277 (i[r].q = i[r].q || []).push(arguments); 278 }, i[r].l = 1 * new Date(); 279 a = s.createElement(o), m = s.getElementsByTagName(o)[0]; 280 a.async = 1; 281 a.src = g; 282 m.parentNode.insertBefore(a, m); 283 })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga'); 284 285 ga('create', page.defaults.googleAnalyticsId, 'auto'); 286 ga('send', 'pageview'); 287 } // Google reCAPTCHA 288 // 289 290 291 if ($('[data-provide~="recaptcha"]').length && window["grecaptcha"] === undefined) { 292 var url = "https://www.google.com/recaptcha/api.js?onload=recaptchaLoadCallback"; 293 294 if (page.defaults.reCaptchaLanguage != '') { 295 url += '&hl=' + page.defaults.reCaptchaLanguage; 296 } 297 298 $.getScript(url); 299 } // DOM is loaded, let's init the page. 300 // 301 302 303 page.init(); 304 }; 305}(jQuery); 306 307/***/ }), 308
309/***/ "./resources/themes/thesaas/plugin/thesaas/js/partials/drawer.js": 310/*!***********************************************************************!*\ 311 !*** ./resources/themes/thesaas/plugin/thesaas/js/partials/drawer.js ***! 312 \***********************************************************************/ 313/***/ (() => { 314 315/** 316 * 317 */ 318+function ($) { 319 page.initDrawer = function () { 320 $(document).on('click', '.drawer-toggler, .drawer-close, .backdrop-drawer', function () { 321 $('body').toggleClass('drawer-open'); 322 }); 323 }; 324}(jQuery); 325 326/***/ }), 327
328/***/ "./resources/themes/thesaas/plugin/thesaas/js/partials/font.js": 329/*!*********************************************************************!*\ 330 !*** ./resources/themes/thesaas/plugin/thesaas/js/partials/font.js ***! 331 \*********************************************************************/ 332/***/ (() => { 333 334/** 335 * 336 */ 337+function ($) { 338 page.initFont = function () { 339 var fonts = []; 340 $('[data-font]').each(function () { 341 var tag = $(this), 342 font = tag.data('font'); 343 part = font.split(':'); 344 fonts.push(font); 345 tag.css({ 346 'font-family': part[0], 347 'font-weight': part[1] 348 }); 349 }); 350 351 if (fonts.length > 0) { 352 $("head").append("<link href='https://fonts.googleapis.com/css?family=" + fonts.join('|') + "' rel='stylesheet'>"); 353 } 354 }; 355}(jQuery); 356 357/***/ }), 358
359/***/ "./resources/themes/thesaas/plugin/thesaas/js/partials/form.js": 360/*!*********************************************************************!*\ 361 !*** ./resources/themes/thesaas/plugin/thesaas/js/partials/form.js ***! 362 \*********************************************************************/ 363/***/ (() => { 364 365/** 366 * All the form related methods. 367 */ 368+function ($) { 369 page.initForm = function () { 370 /** 371 * Add/remove .focus to .input-group 372 */ 373 $(document).on('focusin', '.input-group', function () { 374 $(this).addClass('focus'); 375 }); 376 $(document).on('focusout', '.input-group', function () { 377 $(this).removeClass('focus'); 378 }); // Switch 379 // 380 381 $(document).on('click', '.switch', function () { 382 var input = $(this).children('.switch-input').not(':disabled'); 383 input.prop('checked', !input.prop('checked')).trigger("change"); 384 }); // Upload 385 // 386 387 $(document).on('click', '.file-browser', function () { 388 var browser = $(this); 389 var file = browser.closest('.file-group').find('[type="file"]'); 390 391 if (browser.hasClass('form-control')) { 392 setTimeout(function () { 393 file.trigger('click'); 394 }, 300); 395 } else { 396 file.trigger('click'); 397 } 398 }); // Event to change file name after file selection 399 400 $(document).on('change', '.file-group [type="file"]', function () { 401 var input = $(this); 402 var filename = input.val().split('\\').pop(); 403 input.closest('.file-group').find('.file-value').val(filename).text(filename).focus(); 404 }); 405 }; 406}(jQuery); 407 408/***/ }), 409
410/***/ "./resources/themes/thesaas/plugin/thesaas/js/partials/mailer.js": 411/*!***********************************************************************!*\ 412 !*** ./resources/themes/thesaas/plugin/thesaas/js/partials/mailer.js ***! 413 \***********************************************************************/ 414/***/ (() => { 415 416/** 417 * Send a form details to the sendmail.php file. 418 */ 419+function ($) { 420 page.initMailer = function () { 421 var validEmail = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; 422 $('[data-form="mailer"]').each(function () { 423 var form = $(this), 424 email = form.find('[name="email"]'), 425 message = form.find('[name="message"]'), 426 onSuccess = form.dataAttr('on-success', null), 427 onError = form.dataAttr('on-error', null); 428 form.on('submit', function (e) { 429 e.preventDefault(); 430 e.stopPropagation(); 431 form.children('.alert-danger').remove(); 432 form.find('[required]').each(function () { 433 if ($(this).val().length < 1) { 434 $(this).addClass('is-invalid'); 435 } else { 436 $(this).removeClass('is-invalid'); 437 } 438 }); 439 form.find('[type="email"]').each(function () { 440 if (!validEmail.test($(this).val())) { 441 $(this).addClass('is-invalid'); 442 } else { 443 $(this).removeClass('is-invalid'); 444 } 445 }); 446 447 if (email.length) { 448 if (email.val().length < 1 || !validEmail.test(email.val())) { 449 email.addClass('is-invalid'); //return false; 450 } 451 } 452 453 if (message.length) { 454 if (message.val().length < 1) { 455 message.addClass('is-invalid'); //return false; 456 } 457 } 458 459 if (form.find('.is-invalid').length) { 460 return false; 461 } 462 463 $.ajax({ 464 type: "POST", 465 url: form.attr('action'), 466 data: form.serializeArray() 467 }).done(function (data) { 468 var response = $.parseJSON(data); 469 470 if ('success' == response.status) { 471 form.find('.alert-success').fadeIn(1000); 472 form.find(':input').val(''); 473 474 if (onSuccess !== null) { 475 window[onSuccess](); 476 } 477 } else { 478 form.prepend('<div class="alert alert-danger">' + response.message + '</div>'); 479 console.log(response.reason); 480 481 if (onError !== null) { 482 window[onError](response.reason); 483 } 484 } 485 }); 486 return false; 487 }); 488 form.find('[required], [type="email"]').each(function () { 489 $(this).on('focus', function () { 490 $(this).removeClass('is-invalid'); 491 }); 492 }); 493 email.on('focus', function () { 494 $(this).removeClass('is-invalid'); 495 }); 496 message.on('focus', function () { 497 $(this).removeClass('is-invalid'); 498 }); 499 }); 500 }; 501}(jQuery); 502 503/***/ }), 504
505/***/ "./resources/themes/thesaas/plugin/thesaas/js/partials/main.js": 506/*!*********************************************************************!*\ 507 !*** ./resources/themes/thesaas/plugin/thesaas/js/partials/main.js ***! 508 \*********************************************************************/ 509/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { 510 511/** 512 * Load required plugins. 513 */ 514window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"); 515window.Popper = __webpack_require__(/*! popper.js/dist/umd/popper */ "./node_modules/popper.js/dist/umd/popper.js"); 516 517__webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js"); 518 519window.SmoothScroll = __webpack_require__(/*! smoothscroll-for-websites */ "./node_modules/smoothscroll-for-websites/SmoothScroll.js"); 520 521__webpack_require__(/*! objectFitPolyfill */ "./node_modules/objectFitPolyfill/dist/objectFitPolyfill.min.js"); 522/** 523 * Create window.page and init the application. 524 */ 525 526 527+function ($, window) { 528 var page = { 529 name: 'TheSaaS', 530 version: '2.2.3', 531 vendors: [], 532 // Cache popular elements 533 body: $('body'), 534 navbar: $('.navbar'), 535 header: $('.header'), 536 footer: $('.footer') 537 }; 538 page.defaults = { 539 googleApiKey: null, 540 googleAnalyticsKey: null, 541 reCaptchaSiteKey: null, 542 reCaptchaLanguage: null, 543 disableAOSonMobile: true, 544 smoothScroll: false 545 }; 546 /** 547 * Call all the required initializers. 548 */ 549 550 page.init = function () { 551 // Vendors 552 // 553 page.initVendors(); // Partials 554 // 555 556 page.initBind(); 557 page.initDrawer(); 558 page.initFont(); 559 page.initForm(); 560 page.initMailer(); 561 page.initModal(); 562 page.initNavbar(); 563 page.initOffcanvas(); 564 page.initPopup(); 565 page.initScroll(); 566 page.initSection(); 567 page.initSidebar(); 568 page.initVideo(); // Anchor for headings 569 // 570
571 $('[data-provide="anchor"]').each(function () { 572 var heading = $(this); 573 heading.append('<a class="anchor" href="#' + heading.attr('id') + '"></a>'); 574 }); 575 }; 576 /** 577 * Initialize all of the loaded vendors. 578 */ 579 580 581 page.initVendors = function () { 582 page.vendors.forEach(function (vendor) { 583 var fn = window.page['init' + vendor]; 584 585 if (typeof fn === 'function') { 586 fn(); 587 } 588 }); 589 }; 590 /** 591 * Register loaded vendor to be initialized after DOM load. 592 * It's case sensitive, since it calls "initVendorName" method. 593 */ 594 595 596 page.registerVendor = function ($name) { 597 page.vendors.push($name); 598 }; 599 600 window.page = page; 601}(jQuery, window); 602/** 603 * Once the DOM is loaded, start the magic. 604 */ 605 606$(function () {//page.init(); 607}); 608 609/***/ }), 610
611/***/ "./resources/themes/thesaas/plugin/thesaas/js/partials/map.js": 612/*!********************************************************************!*\ 613 !*** ./resources/themes/thesaas/plugin/thesaas/js/partials/map.js ***! 614 \********************************************************************/ 615/***/ (() => { 616 617/** 618 * Display google map. 619 */ 620+function ($) { 621 page.initMap = function () { 622 $('[data-provide~="map"]').each(function () { 623 var tag = $(this), 624 setting = { 625 lat: '', 626 lng: '', 627 zoom: 13, 628 markerLat: '', 629 markerLng: '', 630 markerIcon: '', 631 markers: '', 632 style: '', 633 removeControls: false 634 }; 635 setting = $.extend(setting, page.getDataOptions(tag)); 636 var map = new google.maps.Map(tag[0], { 637 center: { 638 lat: Number(setting.lat), 639 lng: Number(setting.lng) 640 }, 641 zoom: Number(setting.zoom), 642 disableDefaultUI: setting.removeControls 643 }); // Multiple locations 644 // 645 646 if (setting.markers != '') { 647 var locations = JSON.parse("[" + setting.markers.replace(/'/g, '"') + "]"), 648 infowindow = new google.maps.InfoWindow(), 649 marker, 650 i; 651 652 for (i = 0; i < locations.length; i++) { 653 var markerIcon = setting.markerIcon; 654 655 if (locations[i].length > 3 && locations[i][3] != '') { 656 markerIcon = locations[i][3]; 657 } 658 659 marker = new google.maps.Marker({ 660 position: { 661 lat: Number(locations[i][0]), 662 lng: Number(locations[i][1]) 663 }, 664 map: map, 665 animation: google.maps.Animation.DROP, 666 icon: markerIcon 667 }); 668 669 if (locations[i].length > 2 && locations[i][2] != '') { 670 google.maps.event.addListener(marker, 'click', function (marker, i) { 671 return function () { 672 infowindow.setContent(locations[i][2]); 673 infowindow.open(map, marker); 674 }; 675 }(marker, i)); 676 } 677 } 678 } // Single location 679 // 680 else { 681 var marker = new google.maps.Marker({ 682 position: { 683 lat: Number(setting.markerLat), 684 lng: Number(setting.markerLng) 685 }, 686 map: map, 687 animation: google.maps.Animation.DROP, 688 icon: setting.markerIcon 689 }); 690 691 if (tag.is('[data-info]')) { 692 var infowindow = new google.maps.InfoWindow({ 693 content: tag.dataAttr('info', '') 694 }); 695 marker.addListener('click', function () { 696 infowindow.open(map, marker); 697 }); 698 } 699 } 700 701 switch (setting.style) { 702 case 'light': 703 map.set('styles', [{ 704 "featureType": "water", 705 "elementType": "geometry", 706 "stylers": [{ 707 "color": "#e9e9e9" 708 }, { 709 "lightness": 17 710 }] 711 }, { 712 "featureType": "landscape", 713 "elementType": "geometry", 714 "stylers": [{ 715 "color": "#f5f5f5" 716 }, { 717 "lightness": 20 718 }] 719 }, { 720 "featureType": "road.highway", 721 "elementType": "geometry.fill", 722 "stylers": [{ 723 "color": "#ffffff" 724 }, { 725 "lightness": 17 726 }] 727 }, { 728 "featureType": "road.highway", 729 "elementType": "geometry.stroke", 730 "stylers": [{ 731 "color": "#ffffff" 732 }, { 733 "lightness": 29 734 }, { 735 "weight": 0.2 736 }] 737 }, { 738 "featureType": "road.arterial", 739 "elementType": "geometry", 740 "stylers": [{ 741 "color": "#ffffff" 742 }, { 743 "lightness": 18 744 }] 745 }, { 746 "featureType": "road.local", 747 "elementType": "geometry", 748 "stylers": [{ 749 "color": "#ffffff" 750 }, { 751 "lightness": 16 752 }] 753 }, { 754 "featureType": "poi", 755 "elementType": "geometry", 756 "stylers": [{ 757 "color": "#f5f5f5" 758 }, { 759 "lightness": 21 760 }] 761 }, { 762 "featureType": "poi.park", 763 "elementType": "geometry", 764 "stylers": [{ 765 "color": "#dedede" 766 }, { 767 "lightness": 21 768 }] 769 }, { 770 "elementType": "labels.text.stroke", 771 "stylers": [{ 772 "visibility": "on" 773 }, { 774 "color": "#ffffff" 775 }, { 776 "lightness": 16 777 }] 778 }, { 779 "elementType": "labels.text.fill", 780 "stylers": [{ 781 "saturation": 36 782 }, { 783 "color": "#333333" 784 }, { 785 "lightness": 40 786 }] 787 }, { 788 "elementType": "labels.icon", 789 "stylers": [{ 790 "visibility": "off" 791 }] 792 }, { 793 "featureType": "transit", 794 "elementType": "geometry", 795 "stylers": [{ 796 "color": "#f2f2f2" 797 }, { 798 "lightness": 19 799 }] 800 }, { 801 "featureType": "administrative", 802 "elementType": "geometry.fill", 803 "stylers": [{ 804 "color": "#fefefe" 805 }, { 806 "lightness": 20 807 }] 808 }, { 809 "featureType": "administrative", 810 "elementType": "geometry.stroke", 811 "stylers": [{ 812 "color": "#fefefe" 813 }, { 814 "lightness": 17 815 }, { 816 "weight": 1.2 817 }] 818 }]); 819 break; 820 821 case 'dark': 822 map.set('styles', [{ 823 "featureType": "all", 824 "elementType": "labels.text.fill", 825 "stylers": [{ 826 "saturation": 36 827 }, { 828 "color": "#000000" 829 }, { 830 "lightness": 40 831 }] 832 }, { 833 "featureType": "all", 834 "elementType": "labels.text.stroke", 835 "stylers": [{ 836 "visibility": "on" 837 }, { 838 "color": "#000000" 839 }, { 840 "lightness": 16 841 }] 842 }, { 843 "featureType": "all", 844 "elementType": "labels.icon", 845 "stylers": [{ 846 "visibility": "off" 847 }] 848 }, { 849 "featureType": "administrative", 850 "elementType": "geometry.fill", 851 "stylers": [{ 852 "color": "#000000" 853 }, { 854 "lightness": 20 855 }] 856 }, { 857 "featureType": "administrative", 858 "elementType": "geometry.stroke", 859 "stylers": [{ 860 "color": "#000000" 861 }, { 862 "lightness": 17 863 }, { 864 "weight": 1.2 865 }] 866 }, { 867 "featureType": "landscape", 868 "elementType": "geometry", 869 "stylers": [{ 870 "color": "#000000" 871 }, { 872 "lightness": 20 873 }] 874 }, { 875 "featureType": "poi", 876 "elementType": "geometry", 877 "stylers": [{ 878 "color": "#000000" 879 }, { 880 "lightness": 21 881 }] 882 }, { 883 "featureType": "road.highway", 884 "elementType": "geometry.fill", 885 "stylers": [{ 886 "color": "#000000" 887 }, { 888 "lightness": 17 889 }] 890 }, { 891 "featureType": "road.highway", 892 "elementType": "geometry.stroke", 893 "stylers": [{ 894 "color": "#000000" 895 }, { 896 "lightness": 29 897 }, { 898 "weight": 0.2 899 }] 900 }, { 901 "featureType": "road.arterial", 902 "elementType": "geometry", 903 "stylers": [{ 904 "color": "#000000" 905 }, { 906 "lightness": 18 907 }] 908 }, { 909 "featureType": "road.local", 910 "elementType": "geometry", 911 "stylers": [{ 912 "color": "#000000" 913 }, { 914 "lightness": 16 915 }] 916 }, { 917 "featureType": "transit", 918 "elementType": "geometry", 919 "stylers": [{ 920 "color": "#000000" 921 }, { 922 "lightness": 19 923 }] 924 }, { 925 "featureType": "water", 926 "elementType": "geometry", 927 "stylers": [{ 928 "color": "#000000" 929 }, { 930 "lightness": 17 931 }] 932 }]); 933 break; 934 935 default: 936 if (Array.isArray(setting.style)) { 937 map.set('styles', setting.style); 938 } 939 940 } 941 }); 942 }; 943}(jQuery); 944 945/***/ }), 946
947/***/ "./resources/themes/thesaas/plugin/thesaas/js/partials/modal.js": 948/*!**********************************************************************!*\ 949 !*** ./resources/themes/thesaas/plugin/thesaas/js/partials/modal.js ***! 950 \**********************************************************************/ 951/***/ (() => { 952 953/** 954 * All the modal related methods. 955 */ 956+function ($) { 957 page.initModal = function () { 958 var body = page.body; 959 /** 960 * Autoshow 961 */ 962 963 $('.modal[data-autoshow]').each(function () { 964 var modal = $(this), 965 delay = parseInt(modal.dataAttr('autoshow')); 966 setTimeout(function () { 967 modal.modal('show'); 968 }, delay); 969 }); 970 /** 971 * Exit 972 */ 973 974 $('.modal[data-exitshow]').each(function () { 975 var modal = $(this), 976 delay = parseInt(modal.dataAttr('delay', 0)), 977 target = modal.dataAttr('exitshow'); 978 979 if ($(target).length) { 980 $(document).one('mouseleave', target, function () { 981 setTimeout(function () { 982 modal.modal('show'); 983 }, delay); 984 }); 985 } 986 }); 987 }; 988}(jQuery); 989 990/***/ }), 991
992/***/ "./resources/themes/thesaas/plugin/thesaas/js/partials/navbar.js": 993/*!***********************************************************************!*\ 994 !*** ./resources/themes/thesaas/plugin/thesaas/js/partials/navbar.js ***! 995 \***********************************************************************/ 996/***/ (() => { 997 998/** 999 * All the navbar related methods. 1000 */ 1001+function ($) { 1002 page.initNavbar = function () { 1003 /** 1004 * Toggle navbar 1005 */ 1006 $(document).on('click', '.navbar-toggler', function () { 1007 page.navbarToggle(); 1008 }); 1009 /** 1010 * Tapping on the backdrop will close the navbar 1011 */ 1012 1013 $(document).on('click', '.backdrop-navbar', function () { 1014 page.navbarClose(); 1015 }); 1016 /** 1017 * Toggle menu open on small screen devices 1018 */ 1019 1020 $(document).on('click', '.navbar-open .nav-navbar > .nav-item > .nav-link', function () { 1021 $(this).closest('.nav-item').siblings('.nav-item').find('> .nav:visible').slideUp(333, 'linear'); 1022 $(this).next('.nav').slideToggle(333, 'linear'); 1023 }); 1024 }; 1025 1026 page.navbarToggle = function () { 1027 var body = page.body, 1028 navbar = page.navbar; 1029 body.toggleClass('navbar-open'); 1030 1031 if (body.hasClass('navbar-open')) { 1032 navbar.prepend('<div class="backdrop backdrop-navbar"></div>'); 1033 } 1034 }; 1035 1036 page.navbarClose = function () { 1037 page.body.removeClass('navbar-open'); 1038 $('.backdrop-navbar').remove(); 1039 }; 1040}(jQuery); 1041 1042/***/ }), 1043
1044/***/ "./resources/themes/thesaas/plugin/thesaas/js/partials/offcanvas.js": 1045/*!**************************************************************************!*\ 1046 !*** ./resources/themes/thesaas/plugin/thesaas/js/partials/offcanvas.js ***! 1047 \**************************************************************************/ 1048/***/ (() => { 1049 1050/** 1051 * All the popup related methods. 1052 */ 1053+function ($) { 1054 page.initOffcanvas = function () { 1055 /** 1056 * Toggle 1057 */ 1058 $(document).on('click', '[data-toggle="offcanvas"]', function () { 1059 var target = $(this).data('target'), 1060 offcanvas = $(target); 1061 1062 if (target !== undefined && offcanvas.length) { 1063 if (offcanvas.hasClass('show')) { 1064 $('.backdrop-offcanvas').remove(); 1065 offcanvas.removeClass('show'); 1066 } else { 1067 offcanvas.before('<div class="backdrop backdrop-offcanvas"></div>'); 1068 offcanvas.addClass('show'); 1069 setTimeout(function () { 1070 offcanvas.find('input:text:visible:first').focus(); 1071 }, 300); 1072 } 1073 } 1074 }); 1075 /** 1076 * Dismiss 1077 */ 1078 1079 $(document).on('click', '.offcanvas [data-dismiss], .backdrop-offcanvas', function () { 1080 $('.offcanvas.show').removeClass('show'); 1081 $('.backdrop-offcanvas').remove(); 1082 }); 1083 /** 1084 * Esc key 1085 */ 1086 1087 $(document).on('keyup', function (e) { 1088 if ($('.offcanvas.show').length && e.keyCode == 27) { 1089 // esc keycode 1090 $('.offcanvas.show').removeClass('show'); 1091 $('.backdrop-offcanvas').remove(); 1092 } 1093 }); 1094 }; 1095}(jQuery); 1096 1097/***/ }), 1098
1099/***/ "./resources/themes/thesaas/plugin/thesaas/js/partials/popup.js": 1100/*!**********************************************************************!*\ 1101 !*** ./resources/themes/thesaas/plugin/thesaas/js/partials/popup.js ***! 1102 \**********************************************************************/ 1103/***/ (() => { 1104 1105/** 1106 * All the popup related methods. 1107 */ 1108+function ($) { 1109 page.initPopup = function () { 1110 var body = page.body; 1111 /** 1112 * Toggle 1113 */ 1114 1115 $(document).on('click', '[data-toggle="popup"]', function () { 1116 var target = $(this).data('target'), 1117 popup = $(target); 1118 1119 if (target !== undefined && popup.length) { 1120 if (popup.hasClass('show')) { 1121 popup.removeClass('show'); 1122 } else { 1123 popupShow(popup); 1124 } 1125 } 1126 }); 1127 /** 1128 * Dismiss 1129 */ 1130 1131 $(document).on('click', '.popup [data-dismiss]', function () { 1132 $(this).closest('.popup').removeClass('show'); 1133 }); 1134 /** 1135 * Autoshow 1136 */ 1137 1138 $('.popup[data-autoshow]').each(function () { 1139 var popup = $(this), 1140 delay = parseInt(popup.dataAttr('autoshow')); 1141 setTimeout(function () { 1142 popupShow(popup); 1143 }, delay); 1144 }); 1145 /** 1146 * Exit 1147 */ 1148 1149 $('.popup[data-exitshow]').each(function () { 1150 var popup = $(this), 1151 delay = parseInt(popup.dataAttr('delay', 0)), 1152 target = popup.dataAttr('exitshow'); 1153 1154 if ($(target).length) { 1155 $(document).one('mouseleave', target, function () { 1156 setTimeout(function () { 1157 popupShow(popup); 1158 }, delay); 1159 }); 1160 } 1161 }); 1162 /** 1163 * Show 1164 */ 1165 1166 var popupShow = function popupShow(popup) { 1167 var autohide = parseInt(popup.dataAttr('autohide', 0)), 1168 once_key = popup.dataAttr('once', ''); // Check if it was a once popup 1169 1170 if (once_key != '') { 1171 if (localStorage.getItem(once_key) == 'displayed') { 1172 return; 1173 } 1174 1175 var once_btn = popup.find('[data-once-button="true"]'); 1176 1177 if (once_btn.length) { 1178 once_btn.on('click', function () { 1179 localStorage.setItem(once_key, 'displayed'); 1180 }); 1181 } else { 1182 localStorage.setItem(once_key, 'displayed'); 1183 } 1184 } 1185 1186 popup.addClass('show'); 1187 setTimeout(function () { 1188 popup.find('input:text:visible:first').focus(); 1189 }, 300); 1190 1191 if (autohide > 0) { 1192 setTimeout(function () { 1193 popup.removeClass('show'); 1194 }, autohide); 1195 } 1196 }; 1197 }; 1198}(jQuery); 1199 1200/***/ }), 1201
1202/***/ "./resources/themes/thesaas/plugin/thesaas/js/partials/recaptcha.js": 1203/*!**************************************************************************!*\ 1204 !*** ./resources/themes/thesaas/plugin/thesaas/js/partials/recaptcha.js ***! 1205 \**************************************************************************/ 1206/***/ (() => { 1207 1208/** 1209 * 1210 */ 1211+function ($) { 1212 page.initRecaptcha = function () { 1213 $('[data-provide~="recaptcha"]').each(function () { 1214 var options = { 1215 sitekey: page.defaults.reCaptchaSiteKey 1216 }; 1217 options = $.extend(options, page.getDataOptions($(this))); 1218 1219 if (options.enable) { 1220 options.callback = function () { 1221 $(options.enable).removeAttr('disabled'); 1222 }; 1223 1224 options['expired-callback'] = function () { 1225 $(options.enable).attr('disabled', 'true'); 1226 }; 1227 1228 $(this).closest('form').on('submit', function (e) { 1229 if ($(this).find(options.enable).attr('disabled') === 'true') { 1230 e.preventDefault(); 1231 e.stopPropagation(); 1232 } 1233 }); 1234 } 1235 1236 grecaptcha.render($(this)[0], options); 1237 }); 1238 }; 1239 1240 window.recaptchaLoadCallback = function () { 1241 page.initRecaptcha(); 1242 }; 1243}(jQuery); 1244 1245/***/ }), 1246
1247/***/ "./resources/themes/thesaas/plugin/thesaas/js/partials/scroll.js": 1248/*!***********************************************************************!*\ 1249 !*** ./resources/themes/thesaas/plugin/thesaas/js/partials/scroll.js ***! 1250 \***********************************************************************/ 1251/***/ (() => { 1252 1253/** 1254 * All methods related to the page scroll and link click. 1255 */ 1256+function ($) { 1257 var body = page.body, 1258 footer = page.footer, 1259 hasHeader = page.header.length, 1260 navbarHeight = page.navbar.outerHeight(), 1261 headerHeight = page.header.innerHeight(), 1262 scrollOffsetTop = 0, 1263 prevOffsetTop = 0; 1264 1265 page.initScroll = function () { 1266 if ($('[data-navbar="fixed"], [data-navbar="sticky"], [data-navbar="smart"]').length) { 1267 scrollOffsetTop = navbarHeight; 1268 } 1269 1270 $(document).on('click', "a[href='#']", function () { 1271 return false; 1272 }); // Back to top 1273 // 1274 1275 $(document).on('click', '.scroll-top', function () { 1276 smoothlyScrollTo(0); 1277 return false; 1278 }); // Smooth scroll for anchors 1279 // 1280 1281 $(document).on('click', "a[href^='#']", function () { 1282 if ($(this).attr('href').length < 2) { 1283 return; 1284 } 1285 1286 if ($(this)[0].hasAttribute('data-toggle')) { 1287 return; 1288 } 1289 1290 var target = $($(this).attr('href')); 1291 1292 if (target.length) { 1293 var targetTop = target.offset().top, 1294 windowTop = $(window).scrollTop(); // We don't need offsetTop for scroll down with smart navbar 1295 // 1296 1297 if (targetTop > windowTop && $('.navbar[data-navbar="smart"]').length) { 1298 smoothlyScrollTo(targetTop); 1299 } else { 1300 smoothlyScrollTo(targetTop - scrollOffsetTop); 1301 } 1302 1303 if (body.hasClass('navbar-open')) { 1304 page.navbarClose(); 1305 } 1306 1307 return false; 1308 } 1309 }); // Smoothscroll to anchor in page load 1310 // 1311 1312 var hash = location.hash.replace('#', ''); 1313 1314 if (hash != '') { 1315 var el = $("#" + hash); 1316 1317 if (el.length > 0) { 1318 smoothlyScrollTo(el.offset().top - scrollOffsetTop); 1319 } 1320 } // Actions which are related to the page scroll position 1321 1322 1323 windowScrollActions(); 1324 $(window).on('scroll', function () { 1325 windowScrollActions(); 1326 }); // In page navigation 1327 // 1328 1329 if ($('.nav-page').length) { 1330 var tooltip_pos = 'left', 1331 tooltip_offset = '0, 12'; 1332 1333 if ($('.nav-page.nav-page-left').length) { 1334 tooltip_pos = 'right'; 1335 tooltip_offset = '0, 12'; 1336 } 1337 1338 var spy_offset = parseInt($('.nav-page').dataAttr('spy-offset', 200)); // Enable tooltip 1339 1340 $('.nav-page .nav-link').tooltip({ 1341 container: 'body', 1342 placement: tooltip_pos, 1343 offset: tooltip_offset, 1344 trigger: 'hover' 1345 }); // Enable Scroll Spy 1346 1347 $('body').scrollspy({ 1348 target: '.nav-page', 1349 offset: spy_offset 1350 }); 1351 } // Sticky sidebar width 1352 // 1353 1354 1355 $('.sidebar-sticky').each(function () { 1356 var tag = $(this), 1357 width = tag.closest('div').width(); 1358 tag.css('width', width); 1359 1360 if (body.width() / width < 1.8) { 1361 tag.addClass('is-mobile-wide'); 1362 } 1363 }); 1364 }; 1365 1366 var windowScrollActions = function windowScrollActions() { 1367 var window_top = $(window).scrollTop(); // .body-scrolled 1368 // 1369 1370 if (window_top > 1) { 1371 body.addClass('body-scrolled'); 1372 } else { 1373 body.removeClass('body-scrolled'); 1374 } // .navbar-scrolled 1375 // 1376 1377 1378 if (window_top > navbarHeight) { 1379 body.addClass('navbar-scrolled'); 1380 } else { 1381 body.removeClass('navbar-scrolled'); 1382 } // .header-scrolled 1383 // 1384 1385 1386 if (window_top > headerHeight - navbarHeight - 1) { 1387 body.addClass('header-scrolled'); 1388 } else { 1389 body.removeClass('header-scrolled'); 1390 } // Sticky elements 1391 // 1392 1393 1394 $('[data-sticky="true"]').each(function () { 1395 var tag = $(this), 1396 top = tag.offset().top; 1397 1398 if (!tag.hasDataAttr('original-top')) { 1399 tag.attr('data-original-top', top); 1400 } 1401 1402 var stick_start = tag.dataAttr('original-top'), 1403 stick_end = footer.offset().top - tag.outerHeight(); 1404 1405 if (window_top > stick_start) { 1406 // && window_top <= stick_end) { 1407 tag.addClass('stick'); 1408 } else { 1409 tag.removeClass('stick'); 1410 } 1411 }); // Smart navbar 1412 // 1413 1414 $('[data-navbar="smart"]').each(function () { 1415 var tag = $(this); //toggleFixClass(tag); 1416 1417 if (window_top < prevOffsetTop) { 1418 toggleStickClass(tag); 1419 } else { 1420 tag.removeClass('stick'); 1421 } 1422 }); // Sticky navbar 1423 // 1424 1425 $('[data-navbar="sticky"]').each(function () { 1426 var tag = $(this); 1427 toggleStickClass(tag); 1428 }); // Fixed navbar 1429 // 1430 1431 $('[data-navbar="fixed"]').each(function () { 1432 var tag = $(this); 1433 1434 if (body.hasClass('body-scrolled')) { 1435 tag.addClass('stick'); 1436 } else { 1437 tag.removeClass('stick'); 1438 } 1439 }); // Sticky sidebar 1440 // 1441 1442 $('.sidebar-sticky').each(function () { 1443 var tag = $(this); 1444 toggleStickClass(tag); 1445 }); // Fadeout effect
1446 // 1447 1448 $('.header.fadeout').css('opacity', 1 - window_top - 200 / window.innerHeight); 1449 prevOffsetTop = window_top; 1450 }; 1451 1452 var smoothlyScrollTo = function smoothlyScrollTo(pos) { 1453 $('html, body').animate({ 1454 scrollTop: pos 1455 }, 600); 1456 }; 1457 1458 var toggleFixClass = function toggleFixClass(tag) { 1459 if (body.hasClass('navbar-scrolled')) { 1460 tag.addClass('fix'); 1461 } else { 1462 tag.removeClass('fix'); 1463 } 1464 }; 1465 1466 var toggleStickClass = function toggleStickClass(tag) { 1467 var requiredClass = 'navbar-scrolled'; 1468 1469 if (hasHeader) { 1470 requiredClass = 'header-scrolled'; 1471 } 1472 1473 if (body.hasClass(requiredClass)) { 1474 tag.addClass('stick'); 1475 } else { 1476 tag.removeClass('stick'); 1477 } 1478 }; 1479}(jQuery); 1480 1481/***/ }), 1482
1483/***/ "./resources/themes/thesaas/plugin/thesaas/js/partials/section.js": 1484/*!************************************************************************!*\ 1485 !*** ./resources/themes/thesaas/plugin/thesaas/js/partials/section.js ***! 1486 \************************************************************************/ 1487/***/ (() => { 1488 1489/** 1490 * 1491 */ 1492+function ($) { 1493 page.initSection = function () {}; 1494}(jQuery); 1495 1496/***/ }), 1497
1498/***/ "./resources/themes/thesaas/plugin/thesaas/js/partials/sidebar.js": 1499/*!************************************************************************!*\ 1500 !*** ./resources/themes/thesaas/plugin/thesaas/js/partials/sidebar.js ***! 1501 \************************************************************************/ 1502/***/ (() => { 1503 1504/** 1505 * 1506 */ 1507+function ($) { 1508 page.initSidebar = function () { 1509 var body = page.body; 1510 $(document).on('click', '.sidebar-toggler, .sidebar-close, .backdrop-sidebar', function () { 1511 body.toggleClass('sidebar-open'); 1512 1513 if (body.hasClass('sidebar-open')) { 1514 body.prepend('<div class="backdrop backdrop-sidebar"></div>'); 1515 } else { 1516 $('.backdrop-sidebar').remove(); 1517 } 1518 }); // Sidebar nav 1519 // 1520 1521 var navItemShow = $('.nav-sidebar .nav-item.show'); 1522 navItemShow.find('> .nav-link .nav-angle').addClass('rotate'); 1523 navItemShow.find('> .nav').css('display', 'block'); 1524 navItemShow.removeClass('show'); 1525 var navSidebarIsAccordion = false; 1526 1527 if ('true' == $('.nav-sidebar').dataAttr('accordion', 'false')) { 1528 navSidebarIsAccordion = true; 1529 } 1530 1531 $(document).on('click', '.nav-sidebar > .nav-item > .nav-link', function () { 1532 var link = $(this); 1533 link.next('.nav').slideToggle(); 1534 1535 if (navSidebarIsAccordion) { 1536 link.closest('.nav-item').siblings('.nav-item').children('.nav:visible').slideUp().prev('.nav-link').children('.nav-angle').removeClass('rotate'); 1537 } 1538 1539 link.children('.nav-angle').toggleClass('rotate'); 1540 }); // Perfect scrollbar 1541 // 1542 1543 $('.sidebar-body').each(function (e) { 1544 var ps = new PerfectScrollbar($(this)[0], { 1545 wheelSpeed: 0.4, 1546 minScrollbarLength: 20 1547 }); 1548 }); 1549 }; 1550}(jQuery); 1551 1552/***/ }), 1553
1554/***/ "./resources/themes/thesaas/plugin/thesaas/js/partials/util.js": 1555/*!*********************************************************************!*\ 1556 !*** ./resources/themes/thesaas/plugin/thesaas/js/partials/util.js ***! 1557 \*********************************************************************/ 1558/***/ (() => { 1559 1560/** 1561 * Utility functions to be used in the whole application. 1562 */ 1563+function ($) { 1564 // Convert data-attributes options to Javascript object 1565 // 1566 page.getDataOptions = function (el, castList) { 1567 var options = {}; 1568 $.each($(el).data(), function (key, value) { 1569 key = page.dataToOption(key); // Escape data-provide 1570 1571 if (key == 'provide') { 1572 return; 1573 } 1574 1575 if (castList != undefined) { 1576 var type = castList[key]; 1577 1578 switch (type) { 1579 case 'bool': 1580 value = Boolean(value); 1581 break; 1582 1583 case 'num': 1584 value = Number(value); 1585 break; 1586 1587 case 'array': 1588 value = value.split(','); 1589 break; 1590 1591 default: 1592 } 1593 } 1594 1595 options[key] = value; 1596 }); 1597 return options; 1598 }; // Get target of an action from element. 1599 // 1600 // It can be 'data-target' or 'href' attribute. 1601 // We support 'next' and 'prev' values to target next or previous element. In this case, we return jQuery element. 1602 // 1603 1604 1605 page.getTarget = function (e) { 1606 var target; 1607 1608 if (e.hasDataAttr('target')) { 1609 target = e.data('target'); 1610 } else { 1611 target = e.attr('href'); 1612 } 1613 1614 if (target == 'next') { 1615 target = $(e).next(); 1616 } else if (target == 'prev') { 1617 target = $(e).prev(); 1618 } 1619 1620 if (target == undefined) { 1621 return false; 1622 } 1623 1624 return target; 1625 }; // Get URL of an action from element. 1626 // 1627 // It can be 'data-url' or 'href' attribute. 1628 // 1629 1630 1631 page.getURL = function (e) { 1632 var url; 1633 1634 if (e.hasDataAttr('url')) { 1635 url = e.data('url'); 1636 } else { 1637 url = e.attr('href'); 1638 } 1639 1640 return url; 1641 }; // Convert fooBarBaz to foo-bar-baz 1642 // 1643 1644 1645 page.optionToData = function (name) { 1646 return name.replace(/([A-Z])/g, "-$1").toLowerCase(); 1647 }; // Convert foo-bar-baz to fooBarBaz 1648 // 1649 1650 1651 page.dataToOption = function (name) { 1652 return name.replace(/-([a-z])/g, function (x) { 1653 return x[1].toUpperCase(); 1654 }); 1655 }; 1656}(jQuery); 1657 1658/***/ }), 1659
1660/***/ "./resources/themes/thesaas/plugin/thesaas/js/partials/video.js": 1661/*!**********************************************************************!*\ 1662 !*** ./resources/themes/thesaas/plugin/thesaas/js/partials/video.js ***! 1663 \**********************************************************************/ 1664/***/ (() => { 1665 1666/** 1667 * All the video related methods. 1668 */ 1669+function ($) { 1670 page.initVideo = function () { 1671 // Video-wrapper 1672 // 1673 $(document).on('click', '.video-wrapper .btn', function () { 1674 var wrapper = $(this).closest('.video-wrapper'); 1675 wrapper.addClass('reveal'); 1676 if (wrapper.find('video').length) wrapper.find('video').get(0).play(); 1677 1678 if (wrapper.find('iframe').length) { 1679 var iframe = wrapper.find('iframe'); 1680 var src = iframe.attr('src'); 1681 if (src.indexOf('?') > 0) iframe.get(0).src += "&autoplay=1";else iframe.get(0).src += "?autoplay=1"; 1682 } 1683 }); // Object-fit polyfill 1684 // 1685 1686 objectFitPolyfill($('.bg-video')); 1687 }; 1688}(jQuery); 1689 1690/***/ }), 1691
1692/***/ "./resources/themes/thesaas/plugin/thesaas/js/vendors/aos.js": 1693/*!*******************************************************************!*\ 1694 !*** ./resources/themes/thesaas/plugin/thesaas/js/vendors/aos.js ***! 1695 \*******************************************************************/ 1696/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { 1697 1698/** 1699 * Load required plugin. 1700 */ 1701window.AOS = __webpack_require__(/*! aos */ "./node_modules/aos/dist/aos.js"); 1702/** 1703 * Configure the plugin. 1704 */ 1705 1706+function ($) { 1707 page.registerVendor('AOS'); 1708 1709 page.initAOS = function () { 1710 var options = { 1711 offset: 220, 1712 duration: 1500 1713 }; 1714 1715 if (page.defaults.disableAOSonMobile) { 1716 options.disable = 'mobile'; 1717 } 1718 1719 AOS.init(options); 1720 }; 1721}(jQuery); 1722 1723/***/ }), 1724
1725/***/ "./resources/themes/thesaas/plugin/thesaas/js/vendors/bootstrap.js": 1726/*!*************************************************************************!*\ 1727 !*** ./resources/themes/thesaas/plugin/thesaas/js/vendors/bootstrap.js ***! 1728 \*************************************************************************/ 1729/***/ (() => { 1730 1731/** 1732 * Initialize some of the core Bootstrap components. 1733 */ 1734+function ($) { 1735 page.registerVendor('Bootstrap'); 1736 1737 page.initBootstrap = function () { 1738 $('[data-toggle="tooltip"]').tooltip(); 1739 $('[data-toggle="popover"]').popover(); // Custom control check 1740 // 1741 // Since BS4-beta-3, custom-controls needs id and for attributes. 1742 // We bypass this requirement. 1743 // 1744 1745 $(document).on('click', '.custom-checkbox', function () { 1746 var input = $(this).children('.custom-control-input').not(':disabled'); 1747 input.prop('checked', !input.prop('checked')).trigger("change"); 1748 }); 1749 $(document).on('click', '.custom-radio', function () { 1750 var input = $(this).children('.custom-control-input').not(':disabled'); 1751 input.prop('checked', true).trigger("change"); 1752 }); 1753 }; 1754}(jQuery); 1755 1756/***/ }), 1757
1758/***/ "./resources/themes/thesaas/plugin/thesaas/js/vendors/constellation.js": 1759/*!*****************************************************************************!*\ 1760 !*** ./resources/themes/thesaas/plugin/thesaas/js/vendors/constellation.js ***! 1761 \*****************************************************************************/ 1762/***/ (() => { 1763 1764/** 1765 * 1766 */ 1767+function ($) { 1768 page.registerVendor('Constellation'); 1769 1770 page.initConstellation = function () { 1771 var distance = 120; 1772 1773 if ($(window).width() < 700) { 1774 distance = 25; 1775 } 1776 1777 $('.constellation').each(function () { 1778 var canvas = $(this), 1779 color = canvas.dataAttr('color', 'rgba(255, 255, 255, .8)'), 1780 length = canvas.dataAttr('length', 150), 1781 radius = canvas.dataAttr('radius', 150), 1782 starW = canvas.dataAttr('starWidth', 1), 1783 lineW = canvas.dataAttr('lineWidth', 0.2); 1784 1785 if (color == 'dark') { 1786 color = 'rgba(0, 0, 0, .6)'; 1787 } 1788 1789 canvas.constellation({ 1790 distance: distance, 1791 length: length, 1792 radius: radius, 1793 star: { 1794 color: color, 1795 width: starW 1796 }, 1797 line: { 1798 color: color, 1799 width: lineW 1800 } 1801 }); 1802 }); 1803 }; 1804}(jQuery); // https://codepen.io/acauamontiel/pen/mJdnw 1805 1806/*! 1807 * Mantis.js / jQuery / Zepto.js plugin for Constellation 1808 * @version 1.2.2 1809 * @author Acauã Montiel <[email protected]> 1810 * @license http://acaua.mit-license.org/ 1811 */ 1812 1813(function ($, window) { 1814 /** 1815 * Makes a nice constellation on canvas 1816 * @constructor Constellation 1817 */ 1818 function Constellation(canvas, options) { 1819 var $canvas = $(canvas), 1820 context = canvas.getContext('2d'), 1821 defaults = { 1822 star: { 1823 color: 'rgba(255, 255, 255, .5)', 1824 width: 1 1825 }, 1826 line: { 1827 color: 'rgba(255, 255, 255, .5)', 1828 width: 0.2 1829 }, 1830 position: { 1831 x: 0, 1832 // This value will be overwritten at startup 1833 y: 0 // This value will be overwritten at startup 1834 1835 }, 1836 width: window.innerWidth, 1837 height: window.innerHeight, 1838 velocity: 0.1, 1839 length: 100, 1840 distance: 120, 1841 radius: 150, 1842 stars: [] 1843 }, 1844 config = $.extend(true, {}, defaults, options); 1845 1846 function Star() { 1847 this.x = Math.random() * canvas.width; 1848 this.y = Math.random() * canvas.height; 1849 this.vx = config.velocity - Math.random() * 0.5; 1850 this.vy = config.velocity - Math.random() * 0.5; 1851 this.radius = Math.random() * config.star.width; 1852 } 1853 1854 Star.prototype = { 1855 create: function create() { 1856 context.beginPath(); 1857 context.arc(this.x, this.y, this.radius, 0, Math.PI * 2, false); 1858 context.fill(); 1859 }, 1860 animate: function animate() { 1861 var i; 1862 1863 for (i = 0; i < config.length; i++) { 1864 var star = config.stars[i]; 1865 1866 if (star.y < 0 || star.y > canvas.height) { 1867 star.vx = star.vx; 1868 star.vy = -star.vy; 1869 } else if (star.x < 0 || star.x > canvas.width) { 1870 star.vx = -star.vx; 1871 star.vy = star.vy; 1872 } 1873 1874 star.x += star.vx; 1875 star.y += star.vy; 1876 } 1877 }, 1878 line: function line() { 1879 var length = config.length, 1880 iStar, 1881 jStar, 1882 i, 1883 j; 1884 1885 for (i = 0; i < length; i++) { 1886 for (j = 0; j < length; j++) { 1887 iStar = config.stars[i]; 1888 jStar = config.stars[j]; 1889 1890 if (iStar.x - jStar.x < config.distance && iStar.y - jStar.y < config.distance && iStar.x - jStar.x > -config.distance && iStar.y - jStar.y > -config.distance) { 1891 if (iStar.x - config.position.x < config.radius && iStar.y - config.position.y < config.radius && iStar.x - config.position.x > -config.radius && iStar.y - config.position.y > -config.radius) { 1892 context.beginPath(); 1893 context.moveTo(iStar.x, iStar.y); 1894 context.lineTo(jStar.x, jStar.y); 1895 context.stroke(); 1896 context.closePath(); 1897 } 1898 } 1899 } 1900 } 1901 } 1902 }; 1903 1904 this.createStars = function () { 1905 var length = config.length, 1906 star, 1907 i; 1908 context.clearRect(0, 0, canvas.width, canvas.height); 1909 1910 for (i = 0; i < length; i++) { 1911 config.stars.push(new Star()); 1912 star = config.stars[i]; 1913 star.create(); 1914 } 1915 1916 star.line(); 1917 star.animate(); 1918 }; 1919 1920 this.setCanvas = function () { 1921 canvas.width = config.width; 1922 canvas.height = config.height; 1923 }; 1924 1925 this.setContext = function () { 1926 context.fillStyle = config.star.color; 1927 context.strokeStyle = config.line.color; 1928 context.lineWidth = config.line.width; 1929 }; 1930 1931 this.setInitialPosition = function () { 1932 if (!options || !options.hasOwnProperty('position')) { 1933 config.position = { 1934 x: canvas.width * 0.5, 1935 y: canvas.height * 0.5 1936 }; 1937 } 1938 }; 1939 1940 this.loop = function (callback) { 1941 callback(); 1942 window.requestAnimationFrame(function () { 1943 //stats.begin(); // Only for Stats 1944 this.loop(callback); //stats.end(); // Only for Stats 1945 }.bind(this)); 1946 }; 1947 1948 this.bind = function () { 1949 $canvas.on('mousemove', function (e) { 1950 config.position.x = e.pageX - $canvas.offset().left; 1951 config.position.y = e.pageY - $canvas.offset().top; 1952 }); 1953 }; 1954 1955 this.init = function () { 1956 this.setCanvas(); 1957 this.setContext(); 1958 this.setInitialPosition(); 1959 this.loop(this.createStars); 1960 this.bind(); 1961 }; 1962 } 1963 1964 $.fn.constellation = function (options) { 1965 return this.each(function () { 1966 var c = new Constellation(this, options); 1967 c.init(); 1968 }); 1969 }; 1970})($, window); 1971 1972/***/ }), 1973
1974/***/ "./resources/themes/thesaas/plugin/thesaas/js/vendors/countdown.js": 1975/*!*************************************************************************!*\ 1976 !*** ./resources/themes/thesaas/plugin/thesaas/js/vendors/countdown.js ***! 1977 \*************************************************************************/ 1978/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { 1979 1980/** 1981 * Load required plugin. 1982 */ 1983__webpack_require__(/*! jquery-countdown */ "./node_modules/jquery-countdown/dist/jquery.countdown.js"); 1984/** 1985 * Configure the plugin. 1986 */ 1987 1988 1989+function ($) { 1990 page.registerVendor('Countdown'); 1991 1992 page.initCountdown = function () { 1993 $('[data-countdown]').each(function () { 1994 var tag = $(this), 1995 format = '', 1996 options = { 1997 textDay: 'Day', 1998 textHour: 'Hour', 1999 textMinute: 'Minute', 2000 textSecond: 'Second' 2001 }; 2002 options = $.extend(options, page.getDataOptions(tag)); 2003 format += '<div class="row gap-x-4">'; 2004 format += '<div class="col"><h5>%D</h5><small>' + options.textDay + '%!D</small></div>'; 2005 format += '<div class="col"><h5>%H</h5><small>' + options.textHour + '%!H</small></div>'; 2006 format += '<div class="col"><h5>%M</h5><small>' + options.textMinute + '%!M</small></div>'; 2007 format += '<div class="col"><h5>%S</h5><small>' + options.textSecond + '%!S</small></div>'; 2008 format += '</div>'; 2009 2010 if (tag.hasDataAttr('format')) { 2011 format = tag.data('format'); 2012 } 2013 2014 tag.countdown(tag.data('countdown'), function (event) { 2015 $(this).html(event.strftime(format)); 2016 }); 2017 }); 2018 }; 2019}(jQuery); 2020 2021/***/ }), 2022
2023/***/ "./resources/themes/thesaas/plugin/thesaas/js/vendors/countup.js": 2024/*!***********************************************************************!*\ 2025 !*** ./resources/themes/thesaas/plugin/thesaas/js/vendors/countup.js ***! 2026 \***********************************************************************/ 2027/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 2028 2029"use strict"; 2030__webpack_require__.r(__webpack_exports__); 2031/* harmony import */ var countup_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! countup.js */ "./node_modules/countup.js/dist/countUp.min.js"); 2032function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } 2033 2034/** 2035 * Load required plugins. 2036 */ 2037__webpack_require__(/*! waypoints/lib/jquery.waypoints */ "./node_modules/waypoints/lib/jquery.waypoints.js"); 2038 2039 2040/** 2041 * Configure the plugin. 2042 */ 2043 2044+function ($) { 2045 page.registerVendor('Countup'); 2046 2047 page.initCountup = function () { 2048 $('[data-provide~="countup"]:not(.counted)').each(function () { 2049 var tag = $(this); 2050 var extraOptions = {}; 2051 extraOptions = $.extend(extraOptions, page.getDataOptions(tag)); 2052 var options = { 2053 startVal: tag.dataAttr('from', 0), 2054 endVal: tag.dataAttr('to', 0), 2055 options: extraOptions 2056 }; 2057 options = $.extend(options, page.getDataOptions(tag)); 2058 tag.waypoint({ 2059 handler: function handler($direction) { 2060 tag.countup(options).addClass('counted'); 2061 }, 2062 offset: '100%' 2063 }); 2064 }); 2065 }; 2066}(jQuery); 2067 2068(function ($) { 2069 $.fn.countup = function (params) { 2070 // make sure dependency is present 2071 if (typeof countup_js__WEBPACK_IMPORTED_MODULE_0__.CountUp !== 'function') { 2072 console.error('countUp.js is a required dependency of countUp-jquery.js.'); 2073 return; 2074 } 2075 2076 var defaults = { 2077 startVal: 0, 2078 decimalPlaces: 0, 2079 duration: 4 2080 }; 2081 2082 if (typeof params === 'number') { 2083 defaults.endVal = params; 2084 } else if (_typeof(params) === 'object') { 2085 $.extend(defaults, params); 2086 } else { 2087 console.error('countUp-jquery requires its argument to be either an object or number'); 2088 return; 2089 } 2090 2091 this.each(function (i, elem) { 2092 var countUp = new countup_js__WEBPACK_IMPORTED_MODULE_0__.CountUp(elem, defaults.endVal, defaults.options); 2093 countUp.start(); 2094 }); 2095 return this; 2096 }; 2097})(jQuery); 2098 2099/***/ }), 2100
2101/***/ "./resources/themes/thesaas/plugin/thesaas/js/vendors/granim.js": 2102/*!**********************************************************************!*\ 2103 !*** ./resources/themes/thesaas/plugin/thesaas/js/vendors/granim.js ***! 2104 \**********************************************************************/ 2105/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { 2106 2107/** 2108 * Load required plugin. 2109 */ 2110window.Granim = __webpack_require__(/*! granim */ "./node_modules/granim/index.js"); 2111/** 2112 * Configure the plugin. 2113 */ 2114 2115+function ($) { 2116 page.registerVendor('Granim'); 2117 2118 page.initGranim = function () { 2119 $('[data-granim]').each(function () { 2120 var tag = $(this), 2121 granim = tag.data('granim').split(','), 2122 gradients = [], 2123 opacity = [1, 1]; 2124 var len = granim.length; 2125 2126 if (len > 0) { 2127 if (granim[0].indexOf('-') > -1) { 2128 for (var i = 0; i < len; i++) { 2129 gradients[i] = granim[i].split('-'); 2130 } 2131 2132 for (var i = 0; i < gradients[0].length; i++) { 2133 opacity[i] = 1; 2134 } 2135 } else { 2136 for (var i = 0; i < len / 2; i++) { 2137 gradients[i] = [granim[i * 2], granim[i * 2 + 1]]; 2138 } 2139 } 2140 } 2141 2142 var options = { 2143 element: tag[0], 2144 name: 'granim', 2145 direction: tag.dataAttr('direction', 'left-right'), 2146 isPausedWhenNotInView: true, 2147 opacity: opacity, 2148 states: { 2149 "default-state": { 2150 gradients: gradients, 2151 transitionSpeed: 5000, 2152 loop: true 2153 } 2154 } 2155 }; 2156 2157 if (tag.hasDataAttr('opacity')) { 2158 options.opacity = tag.data('opacity').split(','); 2159 } 2160 2161 if (tag.hasDataAttr('image')) { 2162 options.image = { 2163 source: tag.dataAttr('image', ''), 2164 position: ['center', 'center'], 2165 stretchMode: ['stretch-if-bigger', 'stretch-if-bigger'], 2166 blendingMode: 'multiply' 2167 }; 2168 } 2169 2170 var granimInstance = new Granim(options); 2171 }); 2172 }; 2173}(jQuery); 2174 2175/***/ }), 2176
2177/***/ "./resources/themes/thesaas/plugin/thesaas/js/vendors/jarallax.js": 2178/*!************************************************************************!*\ 2179 !*** ./resources/themes/thesaas/plugin/thesaas/js/vendors/jarallax.js ***! 2180 \************************************************************************/ 2181/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { 2182 2183/** 2184 * Load required plugin. 2185 */ 2186__webpack_require__(/*! jarallax/dist/jarallax.min */ "./node_modules/jarallax/dist/jarallax.min.js"); 2187 2188__webpack_require__(/*! jarallax/dist/jarallax-video.min */ "./node_modules/jarallax/dist/jarallax-video.min.js"); 2189/** 2190 * Configure the plugin. 2191 */ 2192 2193 2194+function ($) { 2195 page.registerVendor('Jarallax'); 2196 2197 page.initJarallax = function () { 2198 // Parallax image 2199 // 2200 $('[data-parallax]').each(function () { 2201 var tag = $(this); 2202 var options = { 2203 imgSrc: tag.data('parallax'), 2204 speed: 0.3 2205 }; 2206 2207 if (tag.hasClass('header')) { 2208 options.speed = 0.6; 2209 } 2210 2211 options = $.extend(options, page.getDataOptions(tag)); 2212 tag.jarallax(options); 2213 }); // Video backgrounds 2214 // 2215 2216 $('[data-video]').each(function () { 2217 var tag = $(this); 2218 var options = { 2219 videoSrc: tag.data('video'), 2220 speed: 1 2221 }; 2222 2223 if (options.videoSrc.indexOf('mp4:') > -1) { 2224 options.speed = 0.5; 2225 } 2226 2227 options = $.extend(options, page.getDataOptions(tag)); 2228 tag.jarallax(options); 2229 }); 2230 }; 2231}(jQuery); 2232 2233/***/ }), 2234
2235/***/ "./resources/themes/thesaas/plugin/thesaas/js/vendors/jquery.js": 2236/*!**********************************************************************!*\ 2237 !*** ./resources/themes/thesaas/plugin/thesaas/js/vendors/jquery.js ***! 2238 \**********************************************************************/ 2239/***/ (() => { 2240 2241/** 2242 * Configure the plugin. 2243 */ 2244+function ($) { 2245 page.registerVendor('Jquery'); 2246 2247 page.initJquery = function () { 2248 /** 2249 * We will register the CSRF Token as a common header with jQuery so that 2250 * all outgoing HTTP requests automatically have it attached. This is just 2251 * a simple convenience so we don't have to attach every token manually. 2252 */ 2253 var token = document.head.querySelector('meta[name="csrf-token"]'); 2254 2255 if (token) { 2256 $.ajaxSetup({ 2257 headers: { 2258 'X-CSRF-TOKEN': token.content 2259 } 2260 }); 2261 } 2262 }; 2263}(jQuery); // Check if an element has a specific data attribute 2264// 2265 2266jQuery.fn.hasDataAttr = function (name) { 2267 return $(this)[0].hasAttribute('data-' + name); 2268}; // Get data attribute. If element doesn't have the attribute, return default value 2269// 2270 2271 2272jQuery.fn.dataAttr = function (name, def) { 2273 if ($(this)[0] == undefined) { 2274 return def; 2275 } 2276 2277 return $(this)[0].getAttribute('data-' + name) || def; 2278}; // Instance search 2279// 2280//$.expr[':'] -> $.expr.pseudos 2281 2282 2283jQuery.expr[':'].search = function (a, i, m) { 2284 return $(a).html().toUpperCase().indexOf(m[3].toUpperCase()) >= 0; 2285}; // Return outerHTML (inclusing the element) code 2286// 2287 2288 2289jQuery.fn.outerHTML = function () { 2290 var html = ''; 2291 this.each(function () { 2292 html += $(this).prop("outerHTML"); 2293 }); 2294 return html; 2295}; // Return HTML code of all the selected elements 2296// 2297 2298 2299jQuery.fn.fullHTML = function () { 2300 var html = ''; 2301 $(this).each(function () { 2302 html += $(this).outerHTML(); 2303 }); 2304 return html; 2305}; // Scroll to end 2306// 2307 2308 2309jQuery.fn.scrollToEnd = function () { 2310 $(this).scrollTop($(this).prop("scrollHeight")); 2311 return this; 2312}; 2313 2314/***/ }), 2315
2316/***/ "./resources/themes/thesaas/plugin/thesaas/js/vendors/lity.js": 2317/*!********************************************************************!*\ 2318 !*** ./resources/themes/thesaas/plugin/thesaas/js/vendors/lity.js ***! 2319 \********************************************************************/ 2320/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { 2321 2322/** 2323 * Load required plugin. 2324 */ 2325window.Lity = __webpack_require__(/*! lity */ "./node_modules/lity/dist/lity.js"); 2326/** 2327 * Configure the plugin. 2328 */ 2329 2330+function ($) { 2331 page.registerVendor('Lity'); 2332 2333 page.initLity = function () { 2334 $(document).on('click', '[data-provide~="lightbox"]', Lity); 2335 }; 2336}(jQuery); 2337 2338/***/ }), 2339
2340/***/ "./resources/themes/thesaas/plugin/thesaas/js/vendors/photoswipe.js": 2341/*!**************************************************************************!*\ 2342 !*** ./resources/themes/thesaas/plugin/thesaas/js/vendors/photoswipe.js ***! 2343 \**************************************************************************/ 2344/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { 2345 2346/** 2347 * Load required plugin. 2348 */ 2349__webpack_require__(/*! jquery.photoswipe/dist/jquery.photoswipe-global.js */ "./node_modules/jquery.photoswipe/dist/jquery.photoswipe-global.js"); 2350/** 2351 * Configure the plugin. 2352 */ 2353 2354 2355+function ($) { 2356 page.registerVendor('PhotoSwipe'); 2357 2358 page.initPhotoSwipe = function () { 2359 $('[data-provide="photoswipe"]').each(function () { 2360 var tag = $(this), 2361 selector = tag.dataAttr('photoswipe-selector', '.gallery-item'); 2362 var options = { 2363 closeEl: true 2364 }; 2365 options = $.extend(options, page.getDataOptions(tag)); 2366 $(tag).photoSwipe(selector, options); 2367 }); 2368 }; 2369}(jQuery); 2370 2371/***/ }), 2372
2373/***/ "./resources/themes/thesaas/plugin/thesaas/js/vendors/shuffle.js": 2374/*!***********************************************************************!*\ 2375 !*** ./resources/themes/thesaas/plugin/thesaas/js/vendors/shuffle.js ***! 2376 \***********************************************************************/ 2377/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { 2378 2379/** 2380 * Load required plugins. 2381 */ 2382window.imagesLoaded = __webpack_require__(/*! imagesloaded/imagesloaded.pkgd */ "./node_modules/imagesloaded/imagesloaded.pkgd.js"); 2383window.Shuffle = __webpack_require__(/*! shufflejs/dist/shuffle.min.js */ "./node_modules/shufflejs/dist/shuffle.min.js"); 2384/** 2385 * Configure the plugin. 2386 */ 2387 2388+function ($) { 2389 page.registerVendor('Shuffle'); 2390 2391 page.initShuffle = function () { 2392 if (undefined === window['Shuffle'] || 0 === $('[data-provide="shuffle"]').length) { 2393 return; 2394 } 2395 2396 var Shuffle = window.Shuffle; 2397 $('[data-provide="shuffle"]').each(function () { 2398 var list = $(this).find('[data-shuffle="list"]'); 2399 var filter = $(this).find('[data-shuffle="filter"]'); 2400 var search = $(this).find('[data-shuffle="search"]'); 2401 var options = { 2402 itemSelector: '[data-shuffle="item"]', 2403 sizer: '[data-shuffle="sizer"]', 2404 delimeter: ',', 2405 speed: 500 2406 }; 2407 var shuffleInstance = new Shuffle(list, options); 2408 2409 if (filter.length) { 2410 $(filter).find('[data-shuffle="button"]').each(function () { 2411 $(this).on('click', function () { 2412 var btn = $(this); 2413 var isActive = btn.hasClass('active'); 2414 var btnGroup = btn.data('group'); 2415 2416 if (isActive) { 2417 return; 2418 } 2419 2420 $(this).closest('[data-shuffle="filter"]').find('[data-shuffle="button"].active').removeClass('active'); 2421 var filterGroup; 2422 2423 if (isActive) { 2424 btn.removeClass('active'); 2425 filterGroup = Shuffle.ALL_ITEMS; 2426 } else { 2427 btn.addClass('active'); 2428 filterGroup = btnGroup; 2429 } 2430 2431 shuffleInstance.filter(filterGroup); 2432 }); 2433 }); 2434 } //End if 2435 2436 2437 if (search.length) { 2438 search.on('input mouseup change', function () { 2439 var searchText = $(this).val().toLowerCase(); 2440 shuffleInstance.filter(function (element, shuffle) { 2441 var itemText = element.textContent.toLowerCase().trim(); 2442 return itemText.indexOf(searchText) !== -1; 2443 }); 2444 }); 2445 } 2446 2447 $(this).imagesLoaded(function () { 2448 shuffleInstance.layout(); 2449 }); 2450 }); 2451 }; 2452}(jQuery); 2453 2454/***/ }), 2455
2456/***/ "./resources/themes/thesaas/plugin/thesaas/js/vendors/typed.js": 2457/*!*********************************************************************!*\ 2458 !*** ./resources/themes/thesaas/plugin/thesaas/js/vendors/typed.js ***! 2459 \*********************************************************************/ 2460/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { 2461 2462/** 2463 * Load required plugin. 2464 */ 2465window.Typed = __webpack_require__(/*! typed.js */ "./node_modules/typed.js/lib/typed.js"); 2466/** 2467 * Configure the plugin. 2468 */ 2469 2470+function ($) { 2471 page.registerVendor('Typed'); 2472 2473 page.initTyped = function () { 2474 $('[data-typing]').each(function () { 2475 var strings = $(this).data('typing').split(','); 2476 var options = { 2477 strings: strings, 2478 typeSpeed: 50, 2479 backSpeed: 30, 2480 backDelay: 800, 2481 loop: true 2482 }; 2483 options = $.extend(options, page.getDataOptions($(this))); 2484 var typed = new Typed($(this)[0], options); 2485 }); 2486 }; 2487}(jQuery); 2488 2489/***/ }), 2490
vendor: 137,723 bytes, lines 2491-6856
2491/***/ "./node_modules/bootstrap/dist/js/bootstrap.js": 2492/*!*****************************************************!*\ 2493 !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***! 2494 \*****************************************************/ 2495/***/ (function(__unused_webpack_module, exports, __webpack_require__) { 2496 2497/*! 2498 * Bootstrap v4.6.1 (https://getbootstrap.com/) 2499 * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) 2500 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 2501 */ 2502(function (global, factory) { 2503 true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) : 2504 0; 2505})(this, (function (exports, $, Popper) { 'use strict'; 2506 2507 function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } 2508 2509 var $__default = /*#__PURE__*/_interopDefaultLegacy($); 2510 var Popper__default = /*#__PURE__*/_interopDefaultLegacy(Popper); 2511 2512 function _defineProperties(target, props) { 2513 for (var i = 0; i < props.length; i++) { 2514 var descriptor = props[i]; 2515 descriptor.enumerable = descriptor.enumerable || false; 2516 descriptor.configurable = true; 2517 if ("value" in descriptor) descriptor.writable = true; 2518 Object.defineProperty(target, descriptor.key, descriptor); 2519 } 2520 } 2521 2522 function _createClass(Constructor, protoProps, staticProps) { 2523 if (protoProps) _defineProperties(Constructor.prototype, protoProps); 2524 if (staticProps) _defineProperties(Constructor, staticProps); 2525 return Constructor; 2526 } 2527 2528 function _extends() { 2529 _extends = Object.assign || function (target) { 2530 for (var i = 1; i < arguments.length; i++) { 2531 var source = arguments[i]; 2532 2533 for (var key in source) { 2534 if (Object.prototype.hasOwnProperty.call(source, key)) { 2535 target[key] = source[key]; 2536 } 2537 } 2538 } 2539 2540 return target; 2541 }; 2542 2543 return _extends.apply(this, arguments); 2544 } 2545 2546 function _inheritsLoose(subClass, superClass) { 2547 subClass.prototype = Object.create(superClass.prototype); 2548 subClass.prototype.constructor = subClass; 2549 2550 _setPrototypeOf(subClass, superClass); 2551 } 2552 2553 function _setPrototypeOf(o, p) { 2554 _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { 2555 o.__proto__ = p; 2556 return o; 2557 }; 2558 2559 return _setPrototypeOf(o, p); 2560 } 2561 2562 /** 2563 * -------------------------------------------------------------------------- 2564 * Bootstrap (v4.6.1): util.js 2565 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 2566 * -------------------------------------------------------------------------- 2567 */ 2568 /** 2569 * Private TransitionEnd Helpers 2570 */ 2571 2572 var TRANSITION_END = 'transitionend'; 2573 var MAX_UID = 1000000; 2574 var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp) 2575 2576 function toType(obj) { 2577 if (obj === null || typeof obj === 'undefined') { 2578 return "" + obj; 2579 } 2580 2581 return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase(); 2582 } 2583 2584 function getSpecialTransitionEndEvent() { 2585 return { 2586 bindType: TRANSITION_END, 2587 delegateType: TRANSITION_END, 2588 handle: function handle(event) { 2589 if ($__default["default"](event.target).is(this)) { 2590 return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params 2591 } 2592 2593 return undefined; 2594 } 2595 }; 2596 } 2597 2598 function transitionEndEmulator(duration) { 2599 var _this = this; 2600 2601 var called = false; 2602 $__default["default"](this).one(Util.TRANSITION_END, function () { 2603 called = true; 2604 }); 2605 setTimeout(function () { 2606 if (!called) { 2607 Util.triggerTransitionEnd(_this); 2608 } 2609 }, duration); 2610 return this; 2611 } 2612 2613 function setTransitionEndSupport() { 2614 $__default["default"].fn.emulateTransitionEnd = transitionEndEmulator; 2615 $__default["default"].event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent(); 2616 } 2617 /** 2618 * Public Util API 2619 */ 2620 2621 2622 var Util = { 2623 TRANSITION_END: 'bsTransitionEnd', 2624 getUID: function getUID(prefix) { 2625 do { 2626 // eslint-disable-next-line no-bitwise 2627 prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here 2628 } while (document.getElementById(prefix)); 2629 2630 return prefix; 2631 }, 2632 getSelectorFromElement: function getSelectorFromElement(element) { 2633 var selector = element.getAttribute('data-target'); 2634 2635 if (!selector || selector === '#') { 2636 var hrefAttr = element.getAttribute('href'); 2637 selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : ''; 2638 } 2639 2640 try { 2641 return document.querySelector(selector) ? selector : null; 2642 } catch (_) { 2643 return null; 2644 } 2645 }, 2646 getTransitionDurationFromElement: function getTransitionDurationFromElement(element) { 2647 if (!element) { 2648 return 0; 2649 } // Get transition-duration of the element 2650 2651 2652 var transitionDuration = $__default["default"](element).css('transition-duration'); 2653 var transitionDelay = $__default["default"](element).css('transition-delay'); 2654 var floatTransitionDuration = parseFloat(transitionDuration); 2655 var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found 2656 2657 if (!floatTransitionDuration && !floatTransitionDelay) { 2658 return 0; 2659 } // If multiple durations are defined, take the first 2660 2661 2662 transitionDuration = transitionDuration.split(',')[0]; 2663 transitionDelay = transitionDelay.split(',')[0]; 2664 return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER; 2665 }, 2666 reflow: function reflow(element) { 2667 return element.offsetHeight; 2668 }, 2669 triggerTransitionEnd: function triggerTransitionEnd(element) { 2670 $__default["default"](element).trigger(TRANSITION_END); 2671 }, 2672 supportsTransitionEnd: function supportsTransitionEnd() { 2673 return Boolean(TRANSITION_END); 2674 }, 2675 isElement: function isElement(obj) { 2676 return (obj[0] || obj).nodeType; 2677 }, 2678 typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) { 2679 for (var property in configTypes) { 2680 if (Object.prototype.hasOwnProperty.call(configTypes, property)) { 2681 var expectedTypes = configTypes[property]; 2682 var value = config[property]; 2683 var valueType = value && Util.isElement(value) ? 'element' : toType(value); 2684 2685 if (!new RegExp(expectedTypes).test(valueType)) { 2686 throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\".")); 2687 } 2688 } 2689 } 2690 }, 2691 findShadowRoot: function findShadowRoot(element) { 2692 if (!document.documentElement.attachShadow) { 2693 return null; 2694 } // Can find the shadow root otherwise it'll return the document 2695 2696 2697 if (typeof element.getRootNode === 'function') { 2698 var root = element.getRootNode(); 2699 return root instanceof ShadowRoot ? root : null; 2700 } 2701 2702 if (element instanceof ShadowRoot) { 2703 return element; 2704 } // when we don't find a shadow root 2705 2706 2707 if (!element.parentNode) { 2708 return null; 2709 } 2710 2711 return Util.findShadowRoot(element.parentNode); 2712 }, 2713 jQueryDetection: function jQueryDetection() { 2714 if (typeof $__default["default"] === 'undefined') { 2715 throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.'); 2716 } 2717 2718 var version = $__default["default"].fn.jquery.split(' ')[0].split('.'); 2719 var minMajor = 1; 2720 var ltMajor = 2; 2721 var minMinor = 9; 2722 var minPatch = 1; 2723 var maxMajor = 4; 2724 2725 if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) { 2726 throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0'); 2727 } 2728 } 2729 }; 2730 Util.jQueryDetection(); 2731 setTransitionEndSupport(); 2732 2733 /** 2734 * Constants 2735 */ 2736 2737 var NAME$a = 'alert'; 2738 var VERSION$a = '4.6.1'; 2739 var DATA_KEY$a = 'bs.alert'; 2740 var EVENT_KEY$a = "." + DATA_KEY$a; 2741 var DATA_API_KEY$7 = '.data-api'; 2742 var JQUERY_NO_CONFLICT$a = $__default["default"].fn[NAME$a]; 2743 var CLASS_NAME_ALERT = 'alert'; 2744 var CLASS_NAME_FADE$5 = 'fade'; 2745 var CLASS_NAME_SHOW$7 = 'show'; 2746 var EVENT_CLOSE = "close" + EVENT_KEY$a; 2747 var EVENT_CLOSED = "closed" + EVENT_KEY$a; 2748 var EVENT_CLICK_DATA_API$6 = "click" + EVENT_KEY$a + DATA_API_KEY$7; 2749 var SELECTOR_DISMISS = '[data-dismiss="alert"]'; 2750 /** 2751 * Class definition 2752 */ 2753 2754 var Alert = /*#__PURE__*/function () { 2755 function Alert(element) { 2756 this._element = element; 2757 } // Getters 2758 2759 2760 var _proto = Alert.prototype; 2761 2762 // Public 2763 _proto.close = function close(element) { 2764 var rootElement = this._element; 2765 2766 if (element) { 2767 rootElement = this._getRootElement(element); 2768 } 2769 2770 var customEvent = this._triggerCloseEvent(rootElement); 2771 2772 if (customEvent.isDefaultPrevented()) { 2773 return; 2774 } 2775 2776 this._removeElement(rootElement); 2777 }; 2778 2779 _proto.dispose = function dispose() { 2780 $__default["default"].removeData(this._element, DATA_KEY$a); 2781 this._element = null; 2782 } // Private 2783 ; 2784 2785 _proto._getRootElement = function _getRootElement(element) { 2786 var selector = Util.getSelectorFromElement(element); 2787 var parent = false; 2788 2789 if (selector) { 2790 parent = document.querySelector(selector); 2791 } 2792 2793 if (!parent) { 2794 parent = $__default["default"](element).closest("." + CLASS_NAME_ALERT)[0]; 2795 } 2796 2797 return parent; 2798 }; 2799 2800 _proto._triggerCloseEvent = function _triggerCloseEvent(element) { 2801 var closeEvent = $__default["default"].Event(EVENT_CLOSE); 2802 $__default["default"](element).trigger(closeEvent); 2803 return closeEvent; 2804 }; 2805 2806 _proto._removeElement = function _removeElement(element) { 2807 var _this = this; 2808 2809 $__default["default"](element).removeClass(CLASS_NAME_SHOW$7); 2810 2811 if (!$__default["default"](element).hasClass(CLASS_NAME_FADE$5)) { 2812 this._destroyElement(element); 2813 2814 return; 2815 } 2816 2817 var transitionDuration = Util.getTransitionDurationFromElement(element); 2818 $__default["default"](element).one(Util.TRANSITION_END, function (event) { 2819 return _this._destroyElement(element, event); 2820 }).emulateTransitionEnd(transitionDuration); 2821 }; 2822 2823 _proto._destroyElement = function _destroyElement(element) { 2824 $__default["default"](element).detach().trigger(EVENT_CLOSED).remove(); 2825 } // Static 2826 ; 2827 2828 Alert._jQueryInterface = function _jQueryInterface(config) { 2829 return this.each(function () { 2830 var $element = $__default["default"](this); 2831 var data = $element.data(DATA_KEY$a); 2832 2833 if (!data) { 2834 data = new Alert(this); 2835 $element.data(DATA_KEY$a, data); 2836 } 2837 2838 if (config === 'close') { 2839 data[config](this); 2840 } 2841 }); 2842 }; 2843 2844 Alert._handleDismiss = function _handleDismiss(alertInstance) { 2845 return function (event) { 2846 if (event) { 2847 event.preventDefault(); 2848 } 2849 2850 alertInstance.close(this); 2851 }; 2852 }; 2853 2854 _createClass(Alert, null, [{ 2855 key: "VERSION", 2856 get: function get() { 2857 return VERSION$a; 2858 } 2859 }]); 2860 2861 return Alert; 2862 }(); 2863 /** 2864 * Data API implementation 2865 */ 2866 2867 2868 $__default["default"](document).on(EVENT_CLICK_DATA_API$6, SELECTOR_DISMISS, Alert._handleDismiss(new Alert())); 2869 /** 2870 * jQuery 2871 */ 2872 2873 $__default["default"].fn[NAME$a] = Alert._jQueryInterface; 2874 $__default["default"].fn[NAME$a].Constructor = Alert; 2875 2876 $__default["default"].fn[NAME$a].noConflict = function () { 2877 $__default["default"].fn[NAME$a] = JQUERY_NO_CONFLICT$a; 2878 return Alert._jQueryInterface; 2879 }; 2880 2881 /** 2882 * Constants 2883 */ 2884 2885 var NAME$9 = 'button'; 2886 var VERSION$9 = '4.6.1'; 2887 var DATA_KEY$9 = 'bs.button'; 2888 var EVENT_KEY$9 = "." + DATA_KEY$9; 2889 var DATA_API_KEY$6 = '.data-api'; 2890 var JQUERY_NO_CONFLICT$9 = $__default["default"].fn[NAME$9]; 2891 var CLASS_NAME_ACTIVE$3 = 'active'; 2892 var CLASS_NAME_BUTTON = 'btn'; 2893 var CLASS_NAME_FOCUS = 'focus'; 2894 var EVENT_CLICK_DATA_API$5 = "click" + EVENT_KEY$9 + DATA_API_KEY$6; 2895 var EVENT_FOCUS_BLUR_DATA_API = "focus" + EVENT_KEY$9 + DATA_API_KEY$6 + " " + ("blur" + EVENT_KEY$9 + DATA_API_KEY$6); 2896 var EVENT_LOAD_DATA_API$2 = "load" + EVENT_KEY$9 + DATA_API_KEY$6; 2897 var SELECTOR_DATA_TOGGLE_CARROT = '[data-toggle^="button"]'; 2898 var SELECTOR_DATA_TOGGLES = '[data-toggle="buttons"]'; 2899 var SELECTOR_DATA_TOGGLE$4 = '[data-toggle="button"]'; 2900 var SELECTOR_DATA_TOGGLES_BUTTONS = '[data-toggle="buttons"] .btn'; 2901 var SELECTOR_INPUT = 'input:not([type="hidden"])'; 2902 var SELECTOR_ACTIVE$2 = '.active'; 2903 var SELECTOR_BUTTON = '.btn'; 2904 /** 2905 * Class definition 2906 */ 2907 2908 var Button = /*#__PURE__*/function () { 2909 function Button(element) { 2910 this._element = element; 2911 this.shouldAvoidTriggerChange = false; 2912 } // Getters 2913 2914 2915 var _proto = Button.prototype; 2916 2917 // Public 2918 _proto.toggle = function toggle() { 2919 var triggerChangeEvent = true; 2920 var addAriaPressed = true; 2921 var rootElement = $__default["default"](this._element).closest(SELECTOR_DATA_TOGGLES)[0]; 2922 2923 if (rootElement) { 2924 var input = this._element.querySelector(SELECTOR_INPUT); 2925 2926 if (input) { 2927 if (input.type === 'radio') { 2928 if (input.checked && this._element.classList.contains(CLASS_NAME_ACTIVE$3)) { 2929 triggerChangeEvent = false; 2930 } else { 2931 var activeElement = rootElement.querySelector(SELECTOR_ACTIVE$2); 2932 2933 if (activeElement) { 2934 $__default["default"](activeElement).removeClass(CLASS_NAME_ACTIVE$3); 2935 } 2936 } 2937 } 2938 2939 if (triggerChangeEvent) { 2940 // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input 2941 if (input.type === 'checkbox' || input.type === 'radio') { 2942 input.checked = !this._element.classList.contains(CLASS_NAME_ACTIVE$3); 2943 } 2944 2945 if (!this.shouldAvoidTriggerChange) { 2946 $__default["default"](input).trigger('change'); 2947 } 2948 } 2949 2950 input.focus(); 2951 addAriaPressed = false; 2952 } 2953 } 2954 2955 if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) { 2956 if (addAriaPressed) { 2957 this._element.setAttribute('aria-pressed', !this._element.classList.contains(CLASS_NAME_ACTIVE$3)); 2958 } 2959 2960 if (triggerChangeEvent) { 2961 $__default["default"](this._element).toggleClass(CLASS_NAME_ACTIVE$3); 2962 } 2963 } 2964 }; 2965 2966 _proto.dispose = function dispose() { 2967 $__default["default"].removeData(this._element, DATA_KEY$9); 2968 this._element = null; 2969 } // Static 2970 ; 2971 2972 Button._jQueryInterface = function _jQueryInterface(config, avoidTriggerChange) { 2973 return this.each(function () { 2974 var $element = $__default["default"](this); 2975 var data = $element.data(DATA_KEY$9); 2976 2977 if (!data) { 2978 data = new Button(this); 2979 $element.data(DATA_KEY$9, data); 2980 } 2981 2982 data.shouldAvoidTriggerChange = avoidTriggerChange; 2983 2984 if (config === 'toggle') { 2985 data[config](); 2986 } 2987 }); 2988 }; 2989 2990 _createClass(Button, null, [{ 2991 key: "VERSION", 2992 get: function get() { 2993 return VERSION$9; 2994 } 2995 }]); 2996 2997 return Button; 2998 }(); 2999 /** 3000 * Data API implementation 3001 */ 3002 3003 3004 $__default["default"](document).on(EVENT_CLICK_DATA_API$5, SELECTOR_DATA_TOGGLE_CARROT, function (event) { 3005 var button = event.target; 3006 var initialButton = button; 3007 3008 if (!$__default["default"](button).hasClass(CLASS_NAME_BUTTON)) { 3009 button = $__default["default"](button).closest(SELECTOR_BUTTON)[0]; 3010 } 3011 3012 if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) { 3013 event.preventDefault(); // work around Firefox bug #1540995 3014 } else { 3015 var inputBtn = button.querySelector(SELECTOR_INPUT); 3016 3017 if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) { 3018 event.preventDefault(); // work around Firefox bug #1540995 3019 3020 return; 3021 } 3022 3023 if (initialButton.tagName === 'INPUT' || button.tagName !== 'LABEL') { 3024 Button._jQueryInterface.call($__default["default"](button), 'toggle', initialButton.tagName === 'INPUT'); 3025 } 3026 } 3027 }).on(EVENT_FOCUS_BLUR_DATA_API, SELECTOR_DATA_TOGGLE_CARROT, function (event) { 3028 var button = $__default["default"](event.target).closest(SELECTOR_BUTTON)[0]; 3029 $__default["default"](button).toggleClass(CLASS_NAME_FOCUS, /^focus(in)?$/.test(event.type)); 3030 }); 3031 $__default["default"](window).on(EVENT_LOAD_DATA_API$2, function () { 3032 // ensure correct active class is set to match the controls' actual values/states 3033 // find all checkboxes/readio buttons inside data-toggle groups 3034 var buttons = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLES_BUTTONS)); 3035 3036 for (var i = 0, len = buttons.length; i < len; i++) { 3037 var button = buttons[i]; 3038 var input = button.querySelector(SELECTOR_INPUT); 3039 3040 if (input.checked || input.hasAttribute('checked')) { 3041 button.classList.add(CLASS_NAME_ACTIVE$3); 3042 } else { 3043 button.classList.remove(CLASS_NAME_ACTIVE$3); 3044 } 3045 } // find all button toggles 3046 3047 3048 buttons = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE$4)); 3049 3050 for (var _i = 0, _len = buttons.length; _i < _len; _i++) { 3051 var _button = buttons[_i]; 3052 3053 if (_button.getAttribute('aria-pressed') === 'true') { 3054 _button.classList.add(CLASS_NAME_ACTIVE$3); 3055 } else { 3056 _button.classList.remove(CLASS_NAME_ACTIVE$3); 3057 } 3058 } 3059 }); 3060 /** 3061 * jQuery 3062 */ 3063 3064 $__default["default"].fn[NAME$9] = Button._jQueryInterface; 3065 $__default["default"].fn[NAME$9].Constructor = Button; 3066 3067 $__default["default"].fn[NAME$9].noConflict = function () { 3068 $__default["default"].fn[NAME$9] = JQUERY_NO_CONFLICT$9; 3069 return Button._jQueryInterface; 3070 }; 3071 3072 /** 3073 * Constants 3074 */ 3075 3076 var NAME$8 = 'carousel'; 3077 var VERSION$8 = '4.6.1'; 3078 var DATA_KEY$8 = 'bs.carousel'; 3079 var EVENT_KEY$8 = "." + DATA_KEY$8; 3080 var DATA_API_KEY$5 = '.data-api'; 3081 var JQUERY_NO_CONFLICT$8 = $__default["default"].fn[NAME$8]; 3082 var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key 3083 3084 var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key 3085 3086 var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch 3087 3088 var SWIPE_THRESHOLD = 40; 3089 var CLASS_NAME_CAROUSEL = 'carousel'; 3090 var CLASS_NAME_ACTIVE$2 = 'active'; 3091 var CLASS_NAME_SLIDE = 'slide'; 3092 var CLASS_NAME_RIGHT = 'carousel-item-right'; 3093 var CLASS_NAME_LEFT = 'carousel-item-left'; 3094 var CLASS_NAME_NEXT = 'carousel-item-next'; 3095 var CLASS_NAME_PREV = 'carousel-item-prev'; 3096 var CLASS_NAME_POINTER_EVENT = 'pointer-event'; 3097 var DIRECTION_NEXT = 'next'; 3098 var DIRECTION_PREV = 'prev'; 3099 var DIRECTION_LEFT = 'left'; 3100 var DIRECTION_RIGHT = 'right'; 3101 var EVENT_SLIDE = "slide" + EVENT_KEY$8; 3102 var EVENT_SLID = "slid" + EVENT_KEY$8; 3103 var EVENT_KEYDOWN = "keydown" + EVENT_KEY$8; 3104 var EVENT_MOUSEENTER = "mouseenter" + EVENT_KEY$8; 3105 var EVENT_MOUSELEAVE = "mouseleave" + EVENT_KEY$8; 3106 var EVENT_TOUCHSTART = "touchstart" + EVENT_KEY$8; 3107 var EVENT_TOUCHMOVE = "touchmove" + EVENT_KEY$8; 3108 var EVENT_TOUCHEND = "touchend" + EVENT_KEY$8; 3109 var EVENT_POINTERDOWN = "pointerdown" + EVENT_KEY$8; 3110 var EVENT_POINTERUP = "pointerup" + EVENT_KEY$8; 3111 var EVENT_DRAG_START = "dragstart" + EVENT_KEY$8; 3112 var EVENT_LOAD_DATA_API$1 = "load" + EVENT_KEY$8 + DATA_API_KEY$5; 3113 var EVENT_CLICK_DATA_API$4 = "click" + EVENT_KEY$8 + DATA_API_KEY$5; 3114 var SELECTOR_ACTIVE$1 = '.active'; 3115 var SELECTOR_ACTIVE_ITEM = '.active.carousel-item'; 3116 var SELECTOR_ITEM = '.carousel-item'; 3117 var SELECTOR_ITEM_IMG = '.carousel-item img'; 3118 var SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev'; 3119 var SELECTOR_INDICATORS = '.carousel-indicators'; 3120 var SELECTOR_DATA_SLIDE = '[data-slide], [data-slide-to]'; 3121 var SELECTOR_DATA_RIDE = '[data-ride="carousel"]'; 3122 var Default$7 = { 3123 interval: 5000, 3124 keyboard: true, 3125 slide: false, 3126 pause: 'hover', 3127 wrap: true, 3128 touch: true 3129 }; 3130 var DefaultType$7 = { 3131 interval: '(number|boolean)', 3132 keyboard: 'boolean', 3133 slide: '(boolean|string)', 3134 pause: '(string|boolean)', 3135 wrap: 'boolean', 3136 touch: 'boolean' 3137 }; 3138 var PointerType = { 3139 TOUCH: 'touch', 3140 PEN: 'pen' 3141 }; 3142 /** 3143 * Class definition 3144 */ 3145 3146 var Carousel = /*#__PURE__*/function () { 3147 function Carousel(element, config) { 3148 this._items = null; 3149 this._interval = null; 3150 this._activeElement = null; 3151 this._isPaused = false; 3152 this._isSliding = false; 3153 this.touchTimeout = null; 3154 this.touchStartX = 0; 3155 this.touchDeltaX = 0; 3156 this._config = this._getConfig(config); 3157 this._element = element; 3158 this._indicatorsElement = this._element.querySelector(SELECTOR_INDICATORS); 3159 this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0; 3160 this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent); 3161 3162 this._addEventListeners(); 3163 } // Getters 3164 3165 3166 var _proto = Carousel.prototype; 3167 3168 // Public 3169 _proto.next = function next() { 3170 if (!this._isSliding) { 3171 this._slide(DIRECTION_NEXT); 3172 } 3173 }; 3174 3175 _proto.nextWhenVisible = function nextWhenVisible() { 3176 var $element = $__default["default"](this._element); // Don't call next when the page isn't visible 3177 // or the carousel or its parent isn't visible 3178 3179 if (!document.hidden && $element.is(':visible') && $element.css('visibility') !== 'hidden') { 3180 this.next(); 3181 } 3182 }; 3183 3184 _proto.prev = function prev() { 3185 if (!this._isSliding) { 3186 this._slide(DIRECTION_PREV); 3187 } 3188 }; 3189 3190 _proto.pause = function pause(event) { 3191 if (!event) { 3192 this._isPaused = true; 3193 } 3194 3195 if (this._element.querySelector(SELECTOR_NEXT_PREV)) { 3196 Util.triggerTransitionEnd(this._element); 3197 this.cycle(true); 3198 } 3199 3200 clearInterval(this._interval); 3201 this._interval = null; 3202 }; 3203 3204 _proto.cycle = function cycle(event) { 3205 if (!event) { 3206 this._isPaused = false; 3207 } 3208 3209 if (this._interval) { 3210 clearInterval(this._interval); 3211 this._interval = null; 3212 } 3213 3214 if (this._config.interval && !this._isPaused) { 3215 this._updateInterval(); 3216 3217 this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval); 3218 } 3219 }; 3220 3221 _proto.to = function to(index) { 3222 var _this = this; 3223 3224 this._activeElement = this._element.querySelector(SELECTOR_ACTIVE_ITEM); 3225 3226 var activeIndex = this._getItemIndex(this._activeElement); 3227 3228 if (index > this._items.length - 1 || index < 0) { 3229 return; 3230 } 3231 3232 if (this._isSliding) { 3233 $__default["default"](this._element).one(EVENT_SLID, function () { 3234 return _this.to(index); 3235 }); 3236 return; 3237 } 3238 3239 if (activeIndex === index) { 3240 this.pause(); 3241 this.cycle(); 3242 return; 3243 } 3244 3245 var direction = index > activeIndex ? DIRECTION_NEXT : DIRECTION_PREV; 3246 3247 this._slide(direction, this._items[index]); 3248 }; 3249 3250 _proto.dispose = function dispose() { 3251 $__default["default"](this._element).off(EVENT_KEY$8); 3252 $__default["default"].removeData(this._element, DATA_KEY$8); 3253 this._items = null; 3254 this._config = null; 3255 this._element = null; 3256 this._interval = null; 3257 this._isPaused = null; 3258 this._isSliding = null; 3259 this._activeElement = null; 3260 this._indicatorsElement = null; 3261 } // Private 3262 ; 3263 3264 _proto._getConfig = function _getConfig(config) { 3265 config = _extends({}, Default$7, config); 3266 Util.typeCheckConfig(NAME$8, config, DefaultType$7); 3267 return config; 3268 }; 3269 3270 _proto._handleSwipe = function _handleSwipe() { 3271 var absDeltax = Math.abs(this.touchDeltaX); 3272 3273 if (absDeltax <= SWIPE_THRESHOLD) { 3274 return; 3275 } 3276 3277 var direction = absDeltax / this.touchDeltaX; 3278 this.touchDeltaX = 0; // swipe left 3279 3280 if (direction > 0) { 3281 this.prev(); 3282 } // swipe right 3283 3284 3285 if (direction < 0) { 3286 this.next(); 3287 } 3288 }; 3289 3290 _proto._addEventListeners = function _addEventListeners() { 3291 var _this2 = this; 3292 3293 if (this._config.keyboard) { 3294 $__default["default"](this._element).on(EVENT_KEYDOWN, function (event) { 3295 return _this2._keydown(event); 3296 }); 3297 } 3298 3299 if (this._config.pause === 'hover') { 3300 $__default["default"](this._element).on(EVENT_MOUSEENTER, function (event) { 3301 return _this2.pause(event); 3302 }).on(EVENT_MOUSELEAVE, function (event) { 3303 return _this2.cycle(event); 3304 }); 3305 } 3306 3307 if (this._config.touch) { 3308 this._addTouchEventListeners(); 3309 } 3310 }; 3311 3312 _proto._addTouchEventListeners = function _addTouchEventListeners() { 3313 var _this3 = this; 3314 3315 if (!this._touchSupported) { 3316 return; 3317 } 3318 3319 var start = function start(event) { 3320 if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) { 3321 _this3.touchStartX = event.originalEvent.clientX; 3322 } else if (!_this3._pointerEvent) { 3323 _this3.touchStartX = event.originalEvent.touches[0].clientX; 3324 } 3325 }; 3326 3327 var move = function move(event) { 3328 // ensure swiping with one touch and not pinching 3329 _this3.touchDeltaX = event.originalEvent.touches && event.originalEvent.touches.length > 1 ? 0 : event.originalEvent.touches[0].clientX - _this3.touchStartX; 3330 }; 3331 3332 var end = function end(event) { 3333 if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) { 3334 _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX; 3335 } 3336 3337 _this3._handleSwipe(); 3338 3339 if (_this3._config.pause === 'hover') { 3340 // If it's a touch-enabled device, mouseenter/leave are fired as 3341 // part of the mouse compatibility events on first tap - the carousel 3342 // would stop cycling until user tapped out of it; 3343 // here, we listen for touchend, explicitly pause the carousel 3344 // (as if it's the second time we tap on it, mouseenter compat event 3345 // is NOT fired) and after a timeout (to allow for mouse compatibility 3346 // events to fire) we explicitly restart cycling 3347 _this3.pause(); 3348 3349 if (_this3.touchTimeout) { 3350 clearTimeout(_this3.touchTimeout); 3351 } 3352 3353 _this3.touchTimeout = setTimeout(function (event) { 3354 return _this3.cycle(event); 3355 }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval); 3356 } 3357 }; 3358 3359 $__default["default"](this._element.querySelectorAll(SELECTOR_ITEM_IMG)).on(EVENT_DRAG_START, function (e) { 3360 return e.preventDefault(); 3361 }); 3362 3363 if (this._pointerEvent) { 3364 $__default["default"](this._element).on(EVENT_POINTERDOWN, function (event) { 3365 return start(event); 3366 }); 3367 $__default["default"](this._element).on(EVENT_POINTERUP, function (event) { 3368 return end(event); 3369 }); 3370 3371 this._element.classList.add(CLASS_NAME_POINTER_EVENT); 3372 } else { 3373 $__default["default"](this._element).on(EVENT_TOUCHSTART, function (event) { 3374 return start(event); 3375 }); 3376 $__default["default"](this._element).on(EVENT_TOUCHMOVE, function (event) { 3377 return move(event); 3378 }); 3379 $__default["default"](this._element).on(EVENT_TOUCHEND, function (event) { 3380 return end(event); 3381 }); 3382 } 3383 }; 3384 3385 _proto._keydown = function _keydown(event) { 3386 if (/input|textarea/i.test(event.target.tagName)) { 3387 return; 3388 } 3389 3390 switch (event.which) { 3391 case ARROW_LEFT_KEYCODE: 3392 event.preventDefault(); 3393 this.prev(); 3394 break; 3395 3396 case ARROW_RIGHT_KEYCODE: 3397 event.preventDefault(); 3398 this.next(); 3399 break; 3400 } 3401 }; 3402 3403 _proto._getItemIndex = function _getItemIndex(element) { 3404 this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(SELECTOR_ITEM)) : []; 3405 return this._items.indexOf(element); 3406 }; 3407 3408 _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) { 3409 var isNextDirection = direction === DIRECTION_NEXT; 3410 var isPrevDirection = direction === DIRECTION_PREV; 3411 3412 var activeIndex = this._getItemIndex(activeElement); 3413 3414 var lastItemIndex = this._items.length - 1; 3415 var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex; 3416 3417 if (isGoingToWrap && !this._config.wrap) { 3418 return activeElement; 3419 } 3420 3421 var delta = direction === DIRECTION_PREV ? -1 : 1; 3422 var itemIndex = (activeIndex + delta) % this._items.length; 3423 return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex]; 3424 }; 3425 3426 _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) { 3427 var targetIndex = this._getItemIndex(relatedTarget); 3428 3429 var fromIndex = this._getItemIndex(this._element.querySelector(SELECTOR_ACTIVE_ITEM)); 3430 3431 var slideEvent = $__default["default"].Event(EVENT_SLIDE, { 3432 relatedTarget: relatedTarget, 3433 direction: eventDirectionName, 3434 from: fromIndex, 3435 to: targetIndex 3436 }); 3437 $__default["default"](this._element).trigger(slideEvent); 3438 return slideEvent; 3439 }; 3440 3441 _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) { 3442 if (this._indicatorsElement) { 3443 var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(SELECTOR_ACTIVE$1)); 3444 $__default["default"](indicators).removeClass(CLASS_NAME_ACTIVE$2); 3445 3446 var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)]; 3447 3448 if (nextIndicator) { 3449 $__default["default"](nextIndicator).addClass(CLASS_NAME_ACTIVE$2); 3450 } 3451 } 3452 }; 3453 3454 _proto._updateInterval = function _updateInterval() { 3455 var element = this._activeElement || this._element.querySelector(SELECTOR_ACTIVE_ITEM); 3456 3457 if (!element) { 3458 return; 3459 } 3460 3461 var elementInterval = parseInt(element.getAttribute('data-interval'), 10); 3462 3463 if (elementInterval) { 3464 this._config.defaultInterval = this._config.defaultInterval || this._config.interval; 3465 this._config.interval = elementInterval; 3466 } else { 3467 this._config.interval = this._config.defaultInterval || this._config.interval; 3468 } 3469 }; 3470 3471 _proto._slide = function _slide(direction, element) { 3472 var _this4 = this; 3473 3474 var activeElement = this._element.querySelector(SELECTOR_ACTIVE_ITEM); 3475 3476 var activeElementIndex = this._getItemIndex(activeElement); 3477 3478 var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement); 3479 3480 var nextElementIndex = this._getItemIndex(nextElement); 3481 3482 var isCycling = Boolean(this._interval); 3483 var directionalClassName; 3484 var orderClassName; 3485 var eventDirectionName; 3486 3487 if (direction === DIRECTION_NEXT) { 3488 directionalClassName = CLASS_NAME_LEFT; 3489 orderClassName = CLASS_NAME_NEXT; 3490 eventDirectionName = DIRECTION_LEFT; 3491 } else { 3492 directionalClassName = CLASS_NAME_RIGHT; 3493 orderClassName = CLASS_NAME_PREV; 3494 eventDirectionName = DIRECTION_RIGHT; 3495 } 3496 3497 if (nextElement && $__default["default"](nextElement).hasClass(CLASS_NAME_ACTIVE$2)) { 3498 this._isSliding = false; 3499 return; 3500 } 3501 3502 var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName); 3503 3504 if (slideEvent.isDefaultPrevented()) { 3505 return; 3506 } 3507 3508 if (!activeElement || !nextElement) { 3509 // Some weirdness is happening, so we bail 3510 return; 3511 } 3512 3513 this._isSliding = true; 3514 3515 if (isCycling) { 3516 this.pause(); 3517 } 3518 3519 this._setActiveIndicatorElement(nextElement); 3520 3521 this._activeElement = nextElement; 3522 var slidEvent = $__default["default"].Event(EVENT_SLID, { 3523 relatedTarget: nextElement, 3524 direction: eventDirectionName, 3525 from: activeElementIndex, 3526 to: nextElementIndex 3527 }); 3528 3529 if ($__default["default"](this._element).hasClass(CLASS_NAME_SLIDE)) { 3530 $__default["default"](nextElement).addClass(orderClassName); 3531 Util.reflow(nextElement); 3532 $__default["default"](activeElement).addClass(directionalClassName); 3533 $__default["default"](nextElement).addClass(directionalClassName); 3534 var transitionDuration = Util.getTransitionDurationFromElement(activeElement); 3535 $__default["default"](activeElement).one(Util.TRANSITION_END, function () { 3536 $__default["default"](nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(CLASS_NAME_ACTIVE$2); 3537 $__default["default"](activeElement).removeClass(CLASS_NAME_ACTIVE$2 + " " + orderClassName + " " + directionalClassName); 3538 _this4._isSliding = false; 3539 setTimeout(function () { 3540 return $__default["default"](_this4._element).trigger(slidEvent); 3541 }, 0); 3542 }).emulateTransitionEnd(transitionDuration); 3543 } else { 3544 $__default["default"](activeElement).removeClass(CLASS_NAME_ACTIVE$2); 3545 $__default["default"](nextElement).addClass(CLASS_NAME_ACTIVE$2); 3546 this._isSliding = false; 3547 $__default["default"](this._element).trigger(slidEvent); 3548 } 3549 3550 if (isCycling) { 3551 this.cycle(); 3552 } 3553 } // Static 3554 ; 3555 3556 Carousel._jQueryInterface = function _jQueryInterface(config) { 3557 return this.each(function () { 3558 var data = $__default["default"](this).data(DATA_KEY$8); 3559 3560 var _config = _extends({}, Default$7, $__default["default"](this).data()); 3561 3562 if (typeof config === 'object') { 3563 _config = _extends({}, _config, config); 3564 } 3565 3566 var action = typeof config === 'string' ? config : _config.slide; 3567 3568 if (!data) { 3569 data = new Carousel(this, _config); 3570 $__default["default"](this).data(DATA_KEY$8, data); 3571 } 3572 3573 if (typeof config === 'number') { 3574 data.to(config); 3575 } else if (typeof action === 'string') { 3576 if (typeof data[action] === 'undefined') { 3577 throw new TypeError("No method named \"" + action + "\""); 3578 } 3579 3580 data[action](); 3581 } else if (_config.interval && _config.ride) { 3582 data.pause(); 3583 data.cycle(); 3584 } 3585 }); 3586 }; 3587 3588 Carousel._dataApiClickHandler = function _dataApiClickHandler(event) { 3589 var selector = Util.getSelectorFromElement(this); 3590 3591 if (!selector) { 3592 return; 3593 } 3594 3595 var target = $__default["default"](selector)[0]; 3596 3597 if (!target || !$__default["default"](target).hasClass(CLASS_NAME_CAROUSEL)) { 3598 return; 3599 } 3600 3601 var config = _extends({}, $__default["default"](target).data(), $__default["default"](this).data()); 3602 3603 var slideIndex = this.getAttribute('data-slide-to'); 3604 3605 if (slideIndex) { 3606 config.interval = false; 3607 } 3608 3609 Carousel._jQueryInterface.call($__default["default"](target), config); 3610 3611 if (slideIndex) { 3612 $__default["default"](target).data(DATA_KEY$8).to(slideIndex); 3613 } 3614 3615 event.preventDefault(); 3616 }; 3617 3618 _createClass(Carousel, null, [{ 3619 key: "VERSION", 3620 get: function get() { 3621 return VERSION$8; 3622 } 3623 }, { 3624 key: "Default", 3625 get: function get() { 3626 return Default$7; 3627 } 3628 }]); 3629 3630 return Carousel; 3631 }(); 3632 /** 3633 * Data API implementation 3634 */ 3635 3636 3637 $__default["default"](document).on(EVENT_CLICK_DATA_API$4, SELECTOR_DATA_SLIDE, Carousel._dataApiClickHandler); 3638 $__default["default"](window).on(EVENT_LOAD_DATA_API$1, function () { 3639 var carousels = [].slice.call(document.querySelectorAll(SELECTOR_DATA_RIDE)); 3640 3641 for (var i = 0, len = carousels.length; i < len; i++) { 3642 var $carousel = $__default["default"](carousels[i]); 3643 3644 Carousel._jQueryInterface.call($carousel, $carousel.data()); 3645 } 3646 }); 3647 /** 3648 * jQuery 3649 */ 3650 3651 $__default["default"].fn[NAME$8] = Carousel._jQueryInterface; 3652 $__default["default"].fn[NAME$8].Constructor = Carousel; 3653 3654 $__default["default"].fn[NAME$8].noConflict = function () { 3655 $__default["default"].fn[NAME$8] = JQUERY_NO_CONFLICT$8; 3656 return Carousel._jQueryInterface; 3657 }; 3658 3659 /** 3660 * Constants 3661 */ 3662 3663 var NAME$7 = 'collapse'; 3664 var VERSION$7 = '4.6.1'; 3665 var DATA_KEY$7 = 'bs.collapse'; 3666 var EVENT_KEY$7 = "." + DATA_KEY$7; 3667 var DATA_API_KEY$4 = '.data-api'; 3668 var JQUERY_NO_CONFLICT$7 = $__default["default"].fn[NAME$7]; 3669 var CLASS_NAME_SHOW$6 = 'show'; 3670 var CLASS_NAME_COLLAPSE = 'collapse'; 3671 var CLASS_NAME_COLLAPSING = 'collapsing'; 3672 var CLASS_NAME_COLLAPSED = 'collapsed'; 3673 var DIMENSION_WIDTH = 'width'; 3674 var DIMENSION_HEIGHT = 'height'; 3675 var EVENT_SHOW$4 = "show" + EVENT_KEY$7; 3676 var EVENT_SHOWN$4 = "shown" + EVENT_KEY$7; 3677 var EVENT_HIDE$4 = "hide" + EVENT_KEY$7; 3678 var EVENT_HIDDEN$4 = "hidden" + EVENT_KEY$7; 3679 var EVENT_CLICK_DATA_API$3 = "click" + EVENT_KEY$7 + DATA_API_KEY$4; 3680 var SELECTOR_ACTIVES = '.show, .collapsing'; 3681 var SELECTOR_DATA_TOGGLE$3 = '[data-toggle="collapse"]'; 3682 var Default$6 = { 3683 toggle: true, 3684 parent: '' 3685 }; 3686 var DefaultType$6 = { 3687 toggle: 'boolean', 3688 parent: '(string|element)' 3689 }; 3690 /** 3691 * Class definition 3692 */ 3693 3694 var Collapse = /*#__PURE__*/function () { 3695 function Collapse(element, config) { 3696 this._isTransitioning = false; 3697 this._element = element; 3698 this._config = this._getConfig(config); 3699 this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]"))); 3700 var toggleList = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE$3)); 3701 3702 for (var i = 0, len = toggleList.length; i < len; i++) { 3703 var elem = toggleList[i]; 3704 var selector = Util.getSelectorFromElement(elem); 3705 var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) { 3706 return foundElem === element; 3707 }); 3708 3709 if (selector !== null && filterElement.length > 0) { 3710 this._selector = selector; 3711 3712 this._triggerArray.push(elem); 3713 } 3714 } 3715 3716 this._parent = this._config.parent ? this._getParent() : null; 3717 3718 if (!this._config.parent) { 3719 this._addAriaAndCollapsedClass(this._element, this._triggerArray); 3720 } 3721 3722 if (this._config.toggle) { 3723 this.toggle(); 3724 } 3725 } // Getters 3726 3727 3728 var _proto = Collapse.prototype; 3729 3730 // Public 3731 _proto.toggle = function toggle() { 3732 if ($__default["default"](this._element).hasClass(CLASS_NAME_SHOW$6)) { 3733 this.hide(); 3734 } else { 3735 this.show(); 3736 } 3737 }; 3738 3739 _proto.show = function show() { 3740 var _this = this; 3741 3742 if (this._isTransitioning || $__default["default"](this._element).hasClass(CLASS_NAME_SHOW$6)) { 3743 return; 3744 } 3745 3746 var actives; 3747 var activesData; 3748 3749 if (this._parent) { 3750 actives = [].slice.call(this._parent.querySelectorAll(SELECTOR_ACTIVES)).filter(function (elem) { 3751 if (typeof _this._config.parent === 'string') { 3752 return elem.getAttribute('data-parent') === _this._config.parent; 3753 } 3754 3755 return elem.classList.contains(CLASS_NAME_COLLAPSE); 3756 }); 3757 3758 if (actives.length === 0) { 3759 actives = null; 3760 } 3761 } 3762 3763 if (actives) { 3764 activesData = $__default["default"](actives).not(this._selector).data(DATA_KEY$7); 3765 3766 if (activesData && activesData._isTransitioning) { 3767 return; 3768 } 3769 } 3770 3771 var startEvent = $__default["default"].Event(EVENT_SHOW$4); 3772 $__default["default"](this._element).trigger(startEvent); 3773 3774 if (startEvent.isDefaultPrevented()) { 3775 return; 3776 } 3777 3778 if (actives) { 3779 Collapse._jQueryInterface.call($__default["default"](actives).not(this._selector), 'hide'); 3780 3781 if (!activesData) { 3782 $__default["default"](actives).data(DATA_KEY$7, null); 3783 } 3784 } 3785 3786 var dimension = this._getDimension(); 3787 3788 $__default["default"](this._element).removeClass(CLASS_NAME_COLLAPSE).addClass(CLASS_NAME_COLLAPSING); 3789 this._element.style[dimension] = 0; 3790 3791 if (this._triggerArray.length) { 3792 $__default["default"](this._triggerArray).removeClass(CLASS_NAME_COLLAPSED).attr('aria-expanded', true); 3793 } 3794 3795 this.setTransitioning(true); 3796 3797 var complete = function complete() { 3798 $__default["default"](_this._element).removeClass(CLASS_NAME_COLLAPSING).addClass(CLASS_NAME_COLLAPSE + " " + CLASS_NAME_SHOW$6); 3799 _this._element.style[dimension] = ''; 3800 3801 _this.setTransitioning(false); 3802 3803 $__default["default"](_this._element).trigger(EVENT_SHOWN$4); 3804 }; 3805 3806 var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1); 3807 var scrollSize = "scroll" + capitalizedDimension; 3808 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 3809 $__default["default"](this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 3810 this._element.style[dimension] = this._element[scrollSize] + "px"; 3811 }; 3812 3813 _proto.hide = function hide() { 3814 var _this2 = this; 3815 3816 if (this._isTransitioning || !$__default["default"](this._element).hasClass(CLASS_NAME_SHOW$6)) { 3817 return; 3818 } 3819 3820 var startEvent = $__default["default"].Event(EVENT_HIDE$4); 3821 $__default["default"](this._element).trigger(startEvent); 3822 3823 if (startEvent.isDefaultPrevented()) { 3824 return; 3825 } 3826 3827 var dimension = this._getDimension(); 3828 3829 this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px"; 3830 Util.reflow(this._element); 3831 $__default["default"](this._element).addClass(CLASS_NAME_COLLAPSING).removeClass(CLASS_NAME_COLLAPSE + " " + CLASS_NAME_SHOW$6); 3832 var triggerArrayLength = this._triggerArray.length; 3833 3834 if (triggerArrayLength > 0) { 3835 for (var i = 0; i < triggerArrayLength; i++) { 3836 var trigger = this._triggerArray[i]; 3837 var selector = Util.getSelectorFromElement(trigger); 3838 3839 if (selector !== null) { 3840 var $elem = $__default["default"]([].slice.call(document.querySelectorAll(selector))); 3841 3842 if (!$elem.hasClass(CLASS_NAME_SHOW$6)) { 3843 $__default["default"](trigger).addClass(CLASS_NAME_COLLAPSED).attr('aria-expanded', false); 3844 } 3845 } 3846 } 3847 } 3848 3849 this.setTransitioning(true); 3850 3851 var complete = function complete() { 3852 _this2.setTransitioning(false); 3853 3854 $__default["default"](_this2._element).removeClass(CLASS_NAME_COLLAPSING).addClass(CLASS_NAME_COLLAPSE).trigger(EVENT_HIDDEN$4); 3855 }; 3856 3857 this._element.style[dimension] = ''; 3858 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 3859 $__default["default"](this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 3860 }; 3861 3862 _proto.setTransitioning = function setTransitioning(isTransitioning) { 3863 this._isTransitioning = isTransitioning; 3864 }; 3865 3866 _proto.dispose = function dispose() { 3867 $__default["default"].removeData(this._element, DATA_KEY$7); 3868 this._config = null; 3869 this._parent = null; 3870 this._element = null; 3871 this._triggerArray = null; 3872 this._isTransitioning = null; 3873 } // Private 3874 ; 3875 3876 _proto._getConfig = function _getConfig(config) { 3877 config = _extends({}, Default$6, config); 3878 config.toggle = Boolean(config.toggle); // Coerce string values 3879 3880 Util.typeCheckConfig(NAME$7, config, DefaultType$6); 3881 return config; 3882 }; 3883 3884 _proto._getDimension = function _getDimension() { 3885 var hasWidth = $__default["default"](this._element).hasClass(DIMENSION_WIDTH); 3886 return hasWidth ? DIMENSION_WIDTH : DIMENSION_HEIGHT; 3887 }; 3888 3889 _proto._getParent = function _getParent() { 3890 var _this3 = this; 3891 3892 var parent; 3893 3894 if (Util.isElement(this._config.parent)) { 3895 parent = this._config.parent; // It's a jQuery object 3896 3897 if (typeof this._config.parent.jquery !== 'undefined') { 3898 parent = this._config.parent[0]; 3899 } 3900 } else { 3901 parent = document.querySelector(this._config.parent); 3902 } 3903 3904 var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]"; 3905 var children = [].slice.call(parent.querySelectorAll(selector)); 3906 $__default["default"](children).each(function (i, element) { 3907 _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]); 3908 }); 3909 return parent; 3910 }; 3911 3912 _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) { 3913 var isOpen = $__default["default"](element).hasClass(CLASS_NAME_SHOW$6); 3914 3915 if (triggerArray.length) { 3916 $__default["default"](triggerArray).toggleClass(CLASS_NAME_COLLAPSED, !isOpen).attr('aria-expanded', isOpen); 3917 } 3918 } // Static 3919 ; 3920 3921 Collapse._getTargetFromElement = function _getTargetFromElement(element) { 3922 var selector = Util.getSelectorFromElement(element); 3923 return selector ? document.querySelector(selector) : null; 3924 }; 3925 3926 Collapse._jQueryInterface = function _jQueryInterface(config) { 3927 return this.each(function () { 3928 var $element = $__default["default"](this); 3929 var data = $element.data(DATA_KEY$7); 3930 3931 var _config = _extends({}, Default$6, $element.data(), typeof config === 'object' && config ? config : {}); 3932 3933 if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) { 3934 _config.toggle = false; 3935 } 3936 3937 if (!data) { 3938 data = new Collapse(this, _config); 3939 $element.data(DATA_KEY$7, data); 3940 } 3941 3942 if (typeof config === 'string') { 3943 if (typeof data[config] === 'undefined') { 3944 throw new TypeError("No method named \"" + config + "\""); 3945 } 3946 3947 data[config](); 3948 } 3949 }); 3950 }; 3951 3952 _createClass(Collapse, null, [{ 3953 key: "VERSION", 3954 get: function get() { 3955 return VERSION$7; 3956 } 3957 }, { 3958 key: "Default", 3959 get: function get() { 3960 return Default$6; 3961 } 3962 }]); 3963 3964 return Collapse; 3965 }(); 3966 /** 3967 * Data API implementation 3968 */ 3969 3970 3971 $__default["default"](document).on(EVENT_CLICK_DATA_API$3, SELECTOR_DATA_TOGGLE$3, function (event) { 3972 // preventDefault only for <a> elements (which change the URL) not inside the collapsible element 3973 if (event.currentTarget.tagName === 'A') { 3974 event.preventDefault(); 3975 } 3976 3977 var $trigger = $__default["default"](this); 3978 var selector = Util.getSelectorFromElement(this); 3979 var selectors = [].slice.call(document.querySelectorAll(selector)); 3980 $__default["default"](selectors).each(function () { 3981 var $target = $__default["default"](this); 3982 var data = $target.data(DATA_KEY$7); 3983 var config = data ? 'toggle' : $trigger.data(); 3984 3985 Collapse._jQueryInterface.call($target, config); 3986 }); 3987 }); 3988 /** 3989 * jQuery 3990 */ 3991 3992 $__default["default"].fn[NAME$7] = Collapse._jQueryInterface; 3993 $__default["default"].fn[NAME$7].Constructor = Collapse; 3994 3995 $__default["default"].fn[NAME$7].noConflict = function () { 3996 $__default["default"].fn[NAME$7] = JQUERY_NO_CONFLICT$7; 3997 return Collapse._jQueryInterface; 3998 }; 3999 4000 /** 4001 * Constants 4002 */ 4003 4004 var NAME$6 = 'dropdown'; 4005 var VERSION$6 = '4.6.1'; 4006 var DATA_KEY$6 = 'bs.dropdown'; 4007 var EVENT_KEY$6 = "." + DATA_KEY$6; 4008 var DATA_API_KEY$3 = '.data-api'; 4009 var JQUERY_NO_CONFLICT$6 = $__default["default"].fn[NAME$6]; 4010 var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key 4011 4012 var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key 4013 4014 var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key 4015 4016 var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key 4017 4018 var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key 4019 4020 var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse) 4021 4022 var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE$1); 4023 var CLASS_NAME_DISABLED$1 = 'disabled'; 4024 var CLASS_NAME_SHOW$5 = 'show'; 4025 var CLASS_NAME_DROPUP = 'dropup'; 4026 var CLASS_NAME_DROPRIGHT = 'dropright'; 4027 var CLASS_NAME_DROPLEFT = 'dropleft'; 4028 var CLASS_NAME_MENURIGHT = 'dropdown-menu-right'; 4029 var CLASS_NAME_POSITION_STATIC = 'position-static'; 4030 var EVENT_HIDE$3 = "hide" + EVENT_KEY$6; 4031 var EVENT_HIDDEN$3 = "hidden" + EVENT_KEY$6; 4032 var EVENT_SHOW$3 = "show" + EVENT_KEY$6; 4033 var EVENT_SHOWN$3 = "shown" + EVENT_KEY$6; 4034 var EVENT_CLICK = "click" + EVENT_KEY$6; 4035 var EVENT_CLICK_DATA_API$2 = "click" + EVENT_KEY$6 + DATA_API_KEY$3; 4036 var EVENT_KEYDOWN_DATA_API = "keydown" + EVENT_KEY$6 + DATA_API_KEY$3; 4037 var EVENT_KEYUP_DATA_API = "keyup" + EVENT_KEY$6 + DATA_API_KEY$3; 4038 var SELECTOR_DATA_TOGGLE$2 = '[data-toggle="dropdown"]'; 4039 var SELECTOR_FORM_CHILD = '.dropdown form'; 4040 var SELECTOR_MENU = '.dropdown-menu'; 4041 var SELECTOR_NAVBAR_NAV = '.navbar-nav'; 4042 var SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'; 4043 var PLACEMENT_TOP = 'top-start'; 4044 var PLACEMENT_TOPEND = 'top-end'; 4045 var PLACEMENT_BOTTOM = 'bottom-start'; 4046 var PLACEMENT_BOTTOMEND = 'bottom-end'; 4047 var PLACEMENT_RIGHT = 'right-start'; 4048 var PLACEMENT_LEFT = 'left-start'; 4049 var Default$5 = { 4050 offset: 0, 4051 flip: true, 4052 boundary: 'scrollParent', 4053 reference: 'toggle', 4054 display: 'dynamic', 4055 popperConfig: null 4056 }; 4057 var DefaultType$5 = { 4058 offset: '(number|string|function)', 4059 flip: 'boolean', 4060 boundary: '(string|element)', 4061 reference: '(string|element)', 4062 display: 'string', 4063 popperConfig: '(null|object)' 4064 }; 4065 /** 4066 * Class definition 4067 */ 4068 4069 var Dropdown = /*#__PURE__*/function () { 4070 function Dropdown(element, config) { 4071 this._element = element; 4072 this._popper = null; 4073 this._config = this._getConfig(config); 4074 this._menu = this._getMenuElement(); 4075 this._inNavbar = this._detectNavbar(); 4076 4077 this._addEventListeners(); 4078 } // Getters 4079 4080 4081 var _proto = Dropdown.prototype; 4082 4083 // Public 4084 _proto.toggle = function toggle() { 4085 if (this._element.disabled || $__default["default"](this._element).hasClass(CLASS_NAME_DISABLED$1)) { 4086 return; 4087 } 4088 4089 var isActive = $__default["default"](this._menu).hasClass(CLASS_NAME_SHOW$5); 4090 4091 Dropdown._clearMenus(); 4092 4093 if (isActive) { 4094 return; 4095 } 4096 4097 this.show(true); 4098 }; 4099 4100 _proto.show = function show(usePopper) { 4101 if (usePopper === void 0) { 4102 usePopper = false; 4103 } 4104 4105 if (this._element.disabled || $__default["default"](this._element).hasClass(CLASS_NAME_DISABLED$1) || $__default["default"](this._menu).hasClass(CLASS_NAME_SHOW$5)) { 4106 return; 4107 } 4108 4109 var relatedTarget = { 4110 relatedTarget: this._element 4111 }; 4112 var showEvent = $__default["default"].Event(EVENT_SHOW$3, relatedTarget); 4113 4114 var parent = Dropdown._getParentFromElement(this._element); 4115 4116 $__default["default"](parent).trigger(showEvent); 4117 4118 if (showEvent.isDefaultPrevented()) { 4119 return; 4120 } // Totally disable Popper for Dropdowns in Navbar 4121 4122 4123 if (!this._inNavbar && usePopper) { 4124 // Check for Popper dependency 4125 if (typeof Popper__default["default"] === 'undefined') { 4126 throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)'); 4127 } 4128 4129 var referenceElement = this._element; 4130 4131 if (this._config.reference === 'parent') { 4132 referenceElement = parent; 4133 } else if (Util.isElement(this._config.reference)) { 4134 referenceElement = this._config.reference; // Check if it's jQuery element 4135 4136 if (typeof this._config.reference.jquery !== 'undefined') { 4137 referenceElement = this._config.reference[0]; 4138 } 4139 } // If boundary is not `scrollParent`, then set position to `static` 4140 // to allow the menu to "escape" the scroll parent's boundaries 4141 // https://github.com/twbs/bootstrap/issues/24251 4142 4143 4144 if (this._config.boundary !== 'scrollParent') { 4145 $__default["default"](parent).addClass(CLASS_NAME_POSITION_STATIC); 4146 } 4147 4148 this._popper = new Popper__default["default"](referenceElement, this._menu, this._getPopperConfig()); 4149 } // If this is a touch-enabled device we add extra 4150 // empty mouseover listeners to the body's immediate children; 4151 // only needed because of broken event delegation on iOS 4152 // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html 4153 4154 4155 if ('ontouchstart' in document.documentElement && $__default["default"](parent).closest(SELECTOR_NAVBAR_NAV).length === 0) { 4156 $__default["default"](document.body).children().on('mouseover', null, $__default["default"].noop); 4157 } 4158 4159 this._element.focus(); 4160 4161 this._element.setAttribute('aria-expanded', true); 4162 4163 $__default["default"](this._menu).toggleClass(CLASS_NAME_SHOW$5); 4164 $__default["default"](parent).toggleClass(CLASS_NAME_SHOW$5).trigger($__default["default"].Event(EVENT_SHOWN$3, relatedTarget)); 4165 }; 4166 4167 _proto.hide = function hide() { 4168 if (this._element.disabled || $__default["default"](this._element).hasClass(CLASS_NAME_DISABLED$1) || !$__default["default"](this._menu).hasClass(CLASS_NAME_SHOW$5)) { 4169 return; 4170 } 4171 4172 var relatedTarget = { 4173 relatedTarget: this._element 4174 }; 4175 var hideEvent = $__default["default"].Event(EVENT_HIDE$3, relatedTarget); 4176 4177 var parent = Dropdown._getParentFromElement(this._element); 4178 4179 $__default["default"](parent).trigger(hideEvent); 4180 4181 if (hideEvent.isDefaultPrevented()) { 4182 return; 4183 } 4184 4185 if (this._popper) { 4186 this._popper.destroy(); 4187 } 4188 4189 $__default["default"](this._menu).toggleClass(CLASS_NAME_SHOW$5); 4190 $__default["default"](parent).toggleClass(CLASS_NAME_SHOW$5).trigger($__default["default"].Event(EVENT_HIDDEN$3, relatedTarget)); 4191 }; 4192 4193 _proto.dispose = function dispose() { 4194 $__default["default"].removeData(this._element, DATA_KEY$6); 4195 $__default["default"](this._element).off(EVENT_KEY$6); 4196 this._element = null; 4197 this._menu = null; 4198 4199 if (this._popper !== null) { 4200 this._popper.destroy(); 4201 4202 this._popper = null; 4203 } 4204 }; 4205 4206 _proto.update = function update() { 4207 this._inNavbar = this._detectNavbar(); 4208 4209 if (this._popper !== null) { 4210 this._popper.scheduleUpdate(); 4211 } 4212 } // Private 4213 ; 4214 4215 _proto._addEventListeners = function _addEventListeners() { 4216 var _this = this; 4217 4218 $__default["default"](this._element).on(EVENT_CLICK, function (event) { 4219 event.preventDefault(); 4220 event.stopPropagation(); 4221 4222 _this.toggle(); 4223 }); 4224 }; 4225 4226 _proto._getConfig = function _getConfig(config) { 4227 config = _extends({}, this.constructor.Default, $__default["default"](this._element).data(), config); 4228 Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType); 4229 return config; 4230 }; 4231 4232 _proto._getMenuElement = function _getMenuElement() { 4233 if (!this._menu) { 4234 var parent = Dropdown._getParentFromElement(this._element); 4235 4236 if (parent) { 4237 this._menu = parent.querySelector(SELECTOR_MENU); 4238 } 4239 } 4240 4241 return this._menu; 4242 }; 4243 4244 _proto._getPlacement = function _getPlacement() { 4245 var $parentDropdown = $__default["default"](this._element.parentNode); 4246 var placement = PLACEMENT_BOTTOM; // Handle dropup 4247 4248 if ($parentDropdown.hasClass(CLASS_NAME_DROPUP)) { 4249 placement = $__default["default"](this._menu).hasClass(CLASS_NAME_MENURIGHT) ? PLACEMENT_TOPEND : PLACEMENT_TOP; 4250 } else if ($parentDropdown.hasClass(CLASS_NAME_DROPRIGHT)) { 4251 placement = PLACEMENT_RIGHT; 4252 } else if ($parentDropdown.hasClass(CLASS_NAME_DROPLEFT)) { 4253 placement = PLACEMENT_LEFT; 4254 } else if ($__default["default"](this._menu).hasClass(CLASS_NAME_MENURIGHT)) { 4255 placement = PLACEMENT_BOTTOMEND; 4256 } 4257 4258 return placement; 4259 }; 4260 4261 _proto._detectNavbar = function _detectNavbar() { 4262 return $__default["default"](this._element).closest('.navbar').length > 0; 4263 }; 4264 4265 _proto._getOffset = function _getOffset() { 4266 var _this2 = this; 4267 4268 var offset = {}; 4269 4270 if (typeof this._config.offset === 'function') { 4271 offset.fn = function (data) { 4272 data.offsets = _extends({}, data.offsets, _this2._config.offset(data.offsets, _this2._element)); 4273 return data; 4274 }; 4275 } else { 4276 offset.offset = this._config.offset; 4277 } 4278 4279 return offset; 4280 }; 4281 4282 _proto._getPopperConfig = function _getPopperConfig() { 4283 var popperConfig = { 4284 placement: this._getPlacement(), 4285 modifiers: { 4286 offset: this._getOffset(), 4287 flip: { 4288 enabled: this._config.flip 4289 }, 4290 preventOverflow: { 4291 boundariesElement: this._config.boundary 4292 } 4293 } 4294 }; // Disable Popper if we have a static display 4295 4296 if (this._config.display === 'static') { 4297 popperConfig.modifiers.applyStyle = { 4298 enabled: false 4299 }; 4300 } 4301 4302 return _extends({}, popperConfig, this._config.popperConfig); 4303 } // Static 4304 ; 4305 4306 Dropdown._jQueryInterface = function _jQueryInterface(config) { 4307 return this.each(function () { 4308 var data = $__default["default"](this).data(DATA_KEY$6); 4309 4310 var _config = typeof config === 'object' ? config : null; 4311 4312 if (!data) { 4313 data = new Dropdown(this, _config); 4314 $__default["default"](this).data(DATA_KEY$6, data); 4315 } 4316 4317 if (typeof config === 'string') { 4318 if (typeof data[config] === 'undefined') { 4319 throw new TypeError("No method named \"" + config + "\""); 4320 } 4321 4322 data[config](); 4323 } 4324 }); 4325 }; 4326 4327 Dropdown._clearMenus = function _clearMenus(event) { 4328 if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) { 4329 return; 4330 } 4331 4332 var toggles = [].slice.call(document.querySelectorAll(SELECTOR_DATA_TOGGLE$2)); 4333 4334 for (var i = 0, len = toggles.length; i < len; i++) { 4335 var parent = Dropdown._getParentFromElement(toggles[i]); 4336 4337 var context = $__default["default"](toggles[i]).data(DATA_KEY$6); 4338 var relatedTarget = { 4339 relatedTarget: toggles[i] 4340 }; 4341 4342 if (event && event.type === 'click') { 4343 relatedTarget.clickEvent = event; 4344 } 4345 4346 if (!context) { 4347 continue; 4348 } 4349 4350 var dropdownMenu = context._menu; 4351 4352 if (!$__default["default"](parent).hasClass(CLASS_NAME_SHOW$5)) { 4353 continue; 4354 } 4355 4356 if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $__default["default"].contains(parent, event.target)) { 4357 continue; 4358 } 4359 4360 var hideEvent = $__default["default"].Event(EVENT_HIDE$3, relatedTarget); 4361 $__default["default"](parent).trigger(hideEvent); 4362 4363 if (hideEvent.isDefaultPrevented()) { 4364 continue; 4365 } // If this is a touch-enabled device we remove the extra 4366 // empty mouseover listeners we added for iOS support 4367 4368 4369 if ('ontouchstart' in document.documentElement) { 4370 $__default["default"](document.body).children().off('mouseover', null, $__default["default"].noop); 4371 } 4372 4373 toggles[i].setAttribute('aria-expanded', 'false'); 4374 4375 if (context._popper) { 4376 context._popper.destroy(); 4377 } 4378 4379 $__default["default"](dropdownMenu).removeClass(CLASS_NAME_SHOW$5); 4380 $__default["default"](parent).removeClass(CLASS_NAME_SHOW$5).trigger($__default["default"].Event(EVENT_HIDDEN$3, relatedTarget)); 4381 } 4382 }; 4383 4384 Dropdown._getParentFromElement = function _getParentFromElement(element) { 4385 var parent; 4386 var selector = Util.getSelectorFromElement(element); 4387 4388 if (selector) { 4389 parent = document.querySelector(selector); 4390 } 4391 4392 return parent || element.parentNode; 4393 } // eslint-disable-next-line complexity 4394 ; 4395 4396 Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) { 4397 // If not input/textarea: 4398 // - And not a key in REGEXP_KEYDOWN => not a dropdown command 4399 // If input/textarea: 4400 // - If space key => not a dropdown command 4401 // - If key is other than escape 4402 // - If key is not up or down => not a dropdown command 4403 // - If trigger inside the menu => not a dropdown command 4404 if (/input|textarea/i.test(event.target.tagName) ? event.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE$1 && (event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE || $__default["default"](event.target).closest(SELECTOR_MENU).length) : !REGEXP_KEYDOWN.test(event.which)) { 4405 return; 4406 } 4407 4408 if (this.disabled || $__default["default"](this).hasClass(CLASS_NAME_DISABLED$1)) { 4409 return; 4410 } 4411 4412 var parent = Dropdown._getParentFromElement(this); 4413 4414 var isActive = $__default["default"](parent).hasClass(CLASS_NAME_SHOW$5); 4415 4416 if (!isActive && event.which === ESCAPE_KEYCODE$1) { 4417 return; 4418 } 4419 4420 event.preventDefault(); 4421 event.stopPropagation(); 4422 4423 if (!isActive || event.which === ESCAPE_KEYCODE$1 || event.which === SPACE_KEYCODE) { 4424 if (event.which === ESCAPE_KEYCODE$1) { 4425 $__default["default"](parent.querySelector(SELECTOR_DATA_TOGGLE$2)).trigger('focus'); 4426 } 4427 4428 $__default["default"](this).trigger('click'); 4429 return; 4430 } 4431 4432 var items = [].slice.call(parent.querySelectorAll(SELECTOR_VISIBLE_ITEMS)).filter(function (item) { 4433 return $__default["default"](item).is(':visible'); 4434 }); 4435 4436 if (items.length === 0) { 4437 return; 4438 } 4439 4440 var index = items.indexOf(event.target); 4441 4442 if (event.which === ARROW_UP_KEYCODE && index > 0) { 4443 // Up 4444 index--; 4445 } 4446 4447 if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) { 4448 // Down 4449 index++; 4450 } 4451 4452 if (index < 0) { 4453 index = 0; 4454 } 4455 4456 items[index].focus(); 4457 }; 4458 4459 _createClass(Dropdown, null, [{ 4460 key: "VERSION", 4461 get: function get() { 4462 return VERSION$6; 4463 } 4464 }, { 4465 key: "Default", 4466 get: function get() { 4467 return Default$5; 4468 } 4469 }, { 4470 key: "DefaultType", 4471 get: function get() { 4472 return DefaultType$5; 4473 } 4474 }]); 4475 4476 return Dropdown; 4477 }(); 4478 /** 4479 * Data API implementation 4480 */ 4481 4482 4483 $__default["default"](document).on(EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE$2, Dropdown._dataApiKeydownHandler).on(EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown._dataApiKeydownHandler).on(EVENT_CLICK_DATA_API$2 + " " + EVENT_KEYUP_DATA_API, Dropdown._clearMenus).on(EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$2, function (event) { 4484 event.preventDefault(); 4485 event.stopPropagation(); 4486 4487 Dropdown._jQueryInterface.call($__default["default"](this), 'toggle'); 4488 }).on(EVENT_CLICK_DATA_API$2, SELECTOR_FORM_CHILD, function (e) { 4489 e.stopPropagation(); 4490 }); 4491 /** 4492 * jQuery 4493 */ 4494 4495 $__default["default"].fn[NAME$6] = Dropdown._jQueryInterface; 4496 $__default["default"].fn[NAME$6].Constructor = Dropdown; 4497 4498 $__default["default"].fn[NAME$6].noConflict = function () { 4499 $__default["default"].fn[NAME$6] = JQUERY_NO_CONFLICT$6; 4500 return Dropdown._jQueryInterface; 4501 }; 4502 4503 /** 4504 * Constants 4505 */ 4506 4507 var NAME$5 = 'modal'; 4508 var VERSION$5 = '4.6.1'; 4509 var DATA_KEY$5 = 'bs.modal'; 4510 var EVENT_KEY$5 = "." + DATA_KEY$5; 4511 var DATA_API_KEY$2 = '.data-api'; 4512 var JQUERY_NO_CONFLICT$5 = $__default["default"].fn[NAME$5]; 4513 var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key 4514 4515 var CLASS_NAME_SCROLLABLE = 'modal-dialog-scrollable'; 4516 var CLASS_NAME_SCROLLBAR_MEASURER = 'modal-scrollbar-measure'; 4517 var CLASS_NAME_BACKDROP = 'modal-backdrop'; 4518 var CLASS_NAME_OPEN = 'modal-open'; 4519 var CLASS_NAME_FADE$4 = 'fade'; 4520 var CLASS_NAME_SHOW$4 = 'show'; 4521 var CLASS_NAME_STATIC = 'modal-static'; 4522 var EVENT_HIDE$2 = "hide" + EVENT_KEY$5; 4523 var EVENT_HIDE_PREVENTED = "hidePrevented" + EVENT_KEY$5; 4524 var EVENT_HIDDEN$2 = "hidden" + EVENT_KEY$5; 4525 var EVENT_SHOW$2 = "show" + EVENT_KEY$5; 4526 var EVENT_SHOWN$2 = "shown" + EVENT_KEY$5; 4527 var EVENT_FOCUSIN = "focusin" + EVENT_KEY$5; 4528 var EVENT_RESIZE = "resize" + EVENT_KEY$5; 4529 var EVENT_CLICK_DISMISS$1 = "click.dismiss" + EVENT_KEY$5; 4530 var EVENT_KEYDOWN_DISMISS = "keydown.dismiss" + EVENT_KEY$5; 4531 var EVENT_MOUSEUP_DISMISS = "mouseup.dismiss" + EVENT_KEY$5; 4532 var EVENT_MOUSEDOWN_DISMISS = "mousedown.dismiss" + EVENT_KEY$5; 4533 var EVENT_CLICK_DATA_API$1 = "click" + EVENT_KEY$5 + DATA_API_KEY$2; 4534 var SELECTOR_DIALOG = '.modal-dialog'; 4535 var SELECTOR_MODAL_BODY = '.modal-body'; 4536 var SELECTOR_DATA_TOGGLE$1 = '[data-toggle="modal"]'; 4537 var SELECTOR_DATA_DISMISS$1 = '[data-dismiss="modal"]'; 4538 var SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top'; 4539 var SELECTOR_STICKY_CONTENT = '.sticky-top'; 4540 var Default$4 = { 4541 backdrop: true, 4542 keyboard: true, 4543 focus: true, 4544 show: true 4545 }; 4546 var DefaultType$4 = { 4547 backdrop: '(boolean|string)', 4548 keyboard: 'boolean', 4549 focus: 'boolean', 4550 show: 'boolean' 4551 }; 4552 /** 4553 * Class definition 4554 */ 4555 4556 var Modal = /*#__PURE__*/function () { 4557 function Modal(element, config) { 4558 this._config = this._getConfig(config); 4559 this._element = element; 4560 this._dialog = element.querySelector(SELECTOR_DIALOG); 4561 this._backdrop = null; 4562 this._isShown = false; 4563 this._isBodyOverflowing = false; 4564 this._ignoreBackdropClick = false; 4565 this._isTransitioning = false; 4566 this._scrollbarWidth = 0; 4567 } // Getters 4568 4569 4570 var _proto = Modal.prototype; 4571 4572 // Public 4573 _proto.toggle = function toggle(relatedTarget) { 4574 return this._isShown ? this.hide() : this.show(relatedTarget); 4575 }; 4576 4577 _proto.show = function show(relatedTarget) { 4578 var _this = this; 4579 4580 if (this._isShown || this._isTransitioning) { 4581 return; 4582 } 4583 4584 var showEvent = $__default["default"].Event(EVENT_SHOW$2, { 4585 relatedTarget: relatedTarget 4586 }); 4587 $__default["default"](this._element).trigger(showEvent); 4588 4589 if (showEvent.isDefaultPrevented()) { 4590 return; 4591 } 4592 4593 this._isShown = true; 4594 4595 if ($__default["default"](this._element).hasClass(CLASS_NAME_FADE$4)) { 4596 this._isTransitioning = true; 4597 } 4598 4599 this._checkScrollbar(); 4600 4601 this._setScrollbar(); 4602 4603 this._adjustDialog(); 4604 4605 this._setEscapeEvent(); 4606 4607 this._setResizeEvent(); 4608 4609 $__default["default"](this._element).on(EVENT_CLICK_DISMISS$1, SELECTOR_DATA_DISMISS$1, function (event) { 4610 return _this.hide(event); 4611 }); 4612 $__default["default"](this._dialog).on(EVENT_MOUSEDOWN_DISMISS, function () { 4613 $__default["default"](_this._element).one(EVENT_MOUSEUP_DISMISS, function (event) { 4614 if ($__default["default"](event.target).is(_this._element)) { 4615 _this._ignoreBackdropClick = true; 4616 } 4617 }); 4618 }); 4619 4620 this._showBackdrop(function () { 4621 return _this._showElement(relatedTarget); 4622 }); 4623 }; 4624 4625 _proto.hide = function hide(event) { 4626 var _this2 = this; 4627 4628 if (event) { 4629 event.preventDefault(); 4630 } 4631 4632 if (!this._isShown || this._isTransitioning) { 4633 return; 4634 } 4635 4636 var hideEvent = $__default["default"].Event(EVENT_HIDE$2); 4637 $__default["default"](this._element).trigger(hideEvent); 4638 4639 if (!this._isShown || hideEvent.isDefaultPrevented()) { 4640 return; 4641 } 4642 4643 this._isShown = false; 4644 var transition = $__default["default"](this._element).hasClass(CLASS_NAME_FADE$4); 4645 4646 if (transition) { 4647 this._isTransitioning = true; 4648 } 4649 4650 this._setEscapeEvent(); 4651 4652 this._setResizeEvent(); 4653 4654 $__default["default"](document).off(EVENT_FOCUSIN); 4655 $__default["default"](this._element).removeClass(CLASS_NAME_SHOW$4); 4656 $__default["default"](this._element).off(EVENT_CLICK_DISMISS$1); 4657 $__default["default"](this._dialog).off(EVENT_MOUSEDOWN_DISMISS); 4658 4659 if (transition) { 4660 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 4661 $__default["default"](this._element).one(Util.TRANSITION_END, function (event) { 4662 return _this2._hideModal(event); 4663 }).emulateTransitionEnd(transitionDuration); 4664 } else { 4665 this._hideModal(); 4666 } 4667 }; 4668 4669 _proto.dispose = function dispose() { 4670 [window, this._element, this._dialog].forEach(function (htmlElement) { 4671 return $__default["default"](htmlElement).off(EVENT_KEY$5); 4672 }); 4673 /** 4674 * `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API` 4675 * Do not move `document` in `htmlElements` array 4676 * It will remove `EVENT_CLICK_DATA_API` event that should remain 4677 */ 4678 4679 $__default["default"](document).off(EVENT_FOCUSIN); 4680 $__default["default"].removeData(this._element, DATA_KEY$5); 4681 this._config = null; 4682 this._element = null; 4683 this._dialog = null; 4684 this._backdrop = null; 4685 this._isShown = null; 4686 this._isBodyOverflowing = null; 4687 this._ignoreBackdropClick = null; 4688 this._isTransitioning = null; 4689 this._scrollbarWidth = null; 4690 }; 4691 4692 _proto.handleUpdate = function handleUpdate() { 4693 this._adjustDialog(); 4694 } // Private 4695 ; 4696 4697 _proto._getConfig = function _getConfig(config) { 4698 config = _extends({}, Default$4, config); 4699 Util.typeCheckConfig(NAME$5, config, DefaultType$4); 4700 return config; 4701 }; 4702 4703 _proto._triggerBackdropTransition = function _triggerBackdropTransition() { 4704 var _this3 = this; 4705 4706 var hideEventPrevented = $__default["default"].Event(EVENT_HIDE_PREVENTED); 4707 $__default["default"](this._element).trigger(hideEventPrevented); 4708 4709 if (hideEventPrevented.isDefaultPrevented()) { 4710 return; 4711 } 4712 4713 var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; 4714 4715 if (!isModalOverflowing) { 4716 this._element.style.overflowY = 'hidden'; 4717 } 4718 4719 this._element.classList.add(CLASS_NAME_STATIC); 4720 4721 var modalTransitionDuration = Util.getTransitionDurationFromElement(this._dialog); 4722 $__default["default"](this._element).off(Util.TRANSITION_END); 4723 $__default["default"](this._element).one(Util.TRANSITION_END, function () { 4724 _this3._element.classList.remove(CLASS_NAME_STATIC); 4725 4726 if (!isModalOverflowing) { 4727 $__default["default"](_this3._element).one(Util.TRANSITION_END, function () { 4728 _this3._element.style.overflowY = ''; 4729 }).emulateTransitionEnd(_this3._element, modalTransitionDuration); 4730 } 4731 }).emulateTransitionEnd(modalTransitionDuration); 4732 4733 this._element.focus(); 4734 }; 4735 4736 _proto._showElement = function _showElement(relatedTarget) { 4737 var _this4 = this; 4738 4739 var transition = $__default["default"](this._element).hasClass(CLASS_NAME_FADE$4); 4740 var modalBody = this._dialog ? this._dialog.querySelector(SELECTOR_MODAL_BODY) : null; 4741 4742 if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) { 4743 // Don't move modal's DOM position 4744 document.body.appendChild(this._element); 4745 } 4746 4747 this._element.style.display = 'block'; 4748 4749 this._element.removeAttribute('aria-hidden'); 4750 4751 this._element.setAttribute('aria-modal', true); 4752 4753 this._element.setAttribute('role', 'dialog'); 4754 4755 if ($__default["default"](this._dialog).hasClass(CLASS_NAME_SCROLLABLE) && modalBody) { 4756 modalBody.scrollTop = 0; 4757 } else { 4758 this._element.scrollTop = 0; 4759 } 4760 4761 if (transition) { 4762 Util.reflow(this._element); 4763 } 4764 4765 $__default["default"](this._element).addClass(CLASS_NAME_SHOW$4); 4766 4767 if (this._config.focus) { 4768 this._enforceFocus(); 4769 } 4770 4771 var shownEvent = $__default["default"].Event(EVENT_SHOWN$2, { 4772 relatedTarget: relatedTarget 4773 }); 4774 4775 var transitionComplete = function transitionComplete() { 4776 if (_this4._config.focus) { 4777 _this4._element.focus(); 4778 } 4779 4780 _this4._isTransitioning = false; 4781 $__default["default"](_this4._element).trigger(shownEvent); 4782 }; 4783 4784 if (transition) { 4785 var transitionDuration = Util.getTransitionDurationFromElement(this._dialog); 4786 $__default["default"](this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration); 4787 } else { 4788 transitionComplete(); 4789 } 4790 }; 4791 4792 _proto._enforceFocus = function _enforceFocus() { 4793 var _this5 = this; 4794 4795 $__default["default"](document).off(EVENT_FOCUSIN) // Guard against infinite focus loop 4796 .on(EVENT_FOCUSIN, function (event) { 4797 if (document !== event.target && _this5._element !== event.target && $__default["default"](_this5._element).has(event.target).length === 0) { 4798 _this5._element.focus(); 4799 } 4800 }); 4801 }; 4802 4803 _proto._setEscapeEvent = function _setEscapeEvent() { 4804 var _this6 = this; 4805 4806 if (this._isShown) { 4807 $__default["default"](this._element).on(EVENT_KEYDOWN_DISMISS, function (event) { 4808 if (_this6._config.keyboard && event.which === ESCAPE_KEYCODE) { 4809 event.preventDefault(); 4810 4811 _this6.hide(); 4812 } else if (!_this6._config.keyboard && event.which === ESCAPE_KEYCODE) { 4813 _this6._triggerBackdropTransition(); 4814 } 4815 }); 4816 } else if (!this._isShown) { 4817 $__default["default"](this._element).off(EVENT_KEYDOWN_DISMISS); 4818 } 4819 }; 4820 4821 _proto._setResizeEvent = function _setResizeEvent() { 4822 var _this7 = this; 4823 4824 if (this._isShown) { 4825 $__default["default"](window).on(EVENT_RESIZE, function (event) { 4826 return _this7.handleUpdate(event); 4827 }); 4828 } else { 4829 $__default["default"](window).off(EVENT_RESIZE); 4830 } 4831 }; 4832 4833 _proto._hideModal = function _hideModal() { 4834 var _this8 = this; 4835 4836 this._element.style.display = 'none'; 4837 4838 this._element.setAttribute('aria-hidden', true); 4839 4840 this._element.removeAttribute('aria-modal'); 4841 4842 this._element.removeAttribute('role'); 4843 4844 this._isTransitioning = false; 4845 4846 this._showBackdrop(function () { 4847 $__default["default"](document.body).removeClass(CLASS_NAME_OPEN); 4848 4849 _this8._resetAdjustments(); 4850 4851 _this8._resetScrollbar(); 4852 4853 $__default["default"](_this8._element).trigger(EVENT_HIDDEN$2); 4854 }); 4855 }; 4856 4857 _proto._removeBackdrop = function _removeBackdrop() { 4858 if (this._backdrop) { 4859 $__default["default"](this._backdrop).remove(); 4860 this._backdrop = null; 4861 } 4862 }; 4863 4864 _proto._showBackdrop = function _showBackdrop(callback) { 4865 var _this9 = this; 4866 4867 var animate = $__default["default"](this._element).hasClass(CLASS_NAME_FADE$4) ? CLASS_NAME_FADE$4 : ''; 4868 4869 if (this._isShown && this._config.backdrop) { 4870 this._backdrop = document.createElement('div'); 4871 this._backdrop.className = CLASS_NAME_BACKDROP; 4872 4873 if (animate) { 4874 this._backdrop.classList.add(animate); 4875 } 4876 4877 $__default["default"](this._backdrop).appendTo(document.body); 4878 $__default["default"](this._element).on(EVENT_CLICK_DISMISS$1, function (event) { 4879 if (_this9._ignoreBackdropClick) { 4880 _this9._ignoreBackdropClick = false; 4881 return; 4882 } 4883 4884 if (event.target !== event.currentTarget) { 4885 return; 4886 } 4887 4888 if (_this9._config.backdrop === 'static') { 4889 _this9._triggerBackdropTransition(); 4890 } else { 4891 _this9.hide(); 4892 } 4893 }); 4894 4895 if (animate) { 4896 Util.reflow(this._backdrop); 4897 } 4898 4899 $__default["default"](this._backdrop).addClass(CLASS_NAME_SHOW$4); 4900 4901 if (!callback) { 4902 return; 4903 } 4904 4905 if (!animate) { 4906 callback(); 4907 return; 4908 } 4909 4910 var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop); 4911 $__default["default"](this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration); 4912 } else if (!this._isShown && this._backdrop) { 4913 $__default["default"](this._backdrop).removeClass(CLASS_NAME_SHOW$4); 4914 4915 var callbackRemove = function callbackRemove() { 4916 _this9._removeBackdrop(); 4917 4918 if (callback) { 4919 callback(); 4920 } 4921 }; 4922 4923 if ($__default["default"](this._element).hasClass(CLASS_NAME_FADE$4)) { 4924 var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop); 4925 4926 $__default["default"](this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration); 4927 } else { 4928 callbackRemove(); 4929 } 4930 } else if (callback) { 4931 callback(); 4932 } 4933 } // ---------------------------------------------------------------------- 4934 // the following methods are used to handle overflowing modals 4935 // todo (fat): these should probably be refactored out of modal.js 4936 // ---------------------------------------------------------------------- 4937 ; 4938 4939 _proto._adjustDialog = function _adjustDialog() { 4940 var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; 4941 4942 if (!this._isBodyOverflowing && isModalOverflowing) { 4943 this._element.style.paddingLeft = this._scrollbarWidth + "px"; 4944 } 4945 4946 if (this._isBodyOverflowing && !isModalOverflowing) { 4947 this._element.style.paddingRight = this._scrollbarWidth + "px"; 4948 } 4949 }; 4950 4951 _proto._resetAdjustments = function _resetAdjustments() { 4952 this._element.style.paddingLeft = ''; 4953 this._element.style.paddingRight = ''; 4954 }; 4955 4956 _proto._checkScrollbar = function _checkScrollbar() { 4957 var rect = document.body.getBoundingClientRect(); 4958 this._isBodyOverflowing = Math.round(rect.left + rect.right) < window.innerWidth; 4959 this._scrollbarWidth = this._getScrollbarWidth(); 4960 }; 4961 4962 _proto._setScrollbar = function _setScrollbar() { 4963 var _this10 = this; 4964 4965 if (this._isBodyOverflowing) { 4966 // Note: DOMNode.style.paddingRight returns the actual value or '' if not set 4967 // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set 4968 var fixedContent = [].slice.call(document.querySelectorAll(SELECTOR_FIXED_CONTENT)); 4969 var stickyContent = [].slice.call(document.querySelectorAll(SELECTOR_STICKY_CONTENT)); // Adjust fixed content padding 4970 4971 $__default["default"](fixedContent).each(function (index, element) { 4972 var actualPadding = element.style.paddingRight; 4973 var calculatedPadding = $__default["default"](element).css('padding-right'); 4974 $__default["default"](element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px"); 4975 }); // Adjust sticky content margin 4976 4977 $__default["default"](stickyContent).each(function (index, element) { 4978 var actualMargin = element.style.marginRight; 4979 var calculatedMargin = $__default["default"](element).css('margin-right'); 4980 $__default["default"](element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px"); 4981 }); // Adjust body padding 4982 4983 var actualPadding = document.body.style.paddingRight; 4984 var calculatedPadding = $__default["default"](document.body).css('padding-right'); 4985 $__default["default"](document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px"); 4986 } 4987 4988 $__default["default"](document.body).addClass(CLASS_NAME_OPEN); 4989 }; 4990 4991 _proto._resetScrollbar = function _resetScrollbar() { 4992 // Restore fixed content padding 4993 var fixedContent = [].slice.call(document.querySelectorAll(SELECTOR_FIXED_CONTENT)); 4994 $__default["default"](fixedContent).each(function (index, element) { 4995 var padding = $__default["default"](element).data('padding-right'); 4996 $__default["default"](element).removeData('padding-right'); 4997 element.style.paddingRight = padding ? padding : ''; 4998 }); // Restore sticky content 4999 5000 var elements = [].slice.call(document.querySelectorAll("" + SELECTOR_STICKY_CONTENT)); 5001 $__default["default"](elements).each(function (index, element) { 5002 var margin = $__default["default"](element).data('margin-right'); 5003 5004 if (typeof margin !== 'undefined') { 5005 $__default["default"](element).css('margin-right', margin).removeData('margin-right'); 5006 } 5007 }); // Restore body padding 5008 5009 var padding = $__default["default"](document.body).data('padding-right'); 5010 $__default["default"](document.body).removeData('padding-right'); 5011 document.body.style.paddingRight = padding ? padding : ''; 5012 }; 5013 5014 _proto._getScrollbarWidth = function _getScrollbarWidth() { 5015 // thx d.walsh 5016 var scrollDiv = document.createElement('div'); 5017 scrollDiv.className = CLASS_NAME_SCROLLBAR_MEASURER; 5018 document.body.appendChild(scrollDiv); 5019 var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth; 5020 document.body.removeChild(scrollDiv); 5021 return scrollbarWidth; 5022 } // Static 5023 ; 5024 5025 Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) { 5026 return this.each(function () { 5027 var data = $__default["default"](this).data(DATA_KEY$5); 5028 5029 var _config = _extends({}, Default$4, $__default["default"](this).data(), typeof config === 'object' && config ? config : {}); 5030 5031 if (!data) { 5032 data = new Modal(this, _config); 5033 $__default["default"](this).data(DATA_KEY$5, data); 5034 } 5035 5036 if (typeof config === 'string') { 5037 if (typeof data[config] === 'undefined') { 5038 throw new TypeError("No method named \"" + config + "\""); 5039 } 5040 5041 data[config](relatedTarget); 5042 } else if (_config.show) { 5043 data.show(relatedTarget); 5044 } 5045 }); 5046 }; 5047 5048 _createClass(Modal, null, [{ 5049 key: "VERSION", 5050 get: function get() { 5051 return VERSION$5; 5052 } 5053 }, { 5054 key: "Default", 5055 get: function get() { 5056 return Default$4; 5057 } 5058 }]); 5059 5060 return Modal; 5061 }(); 5062 /** 5063 * Data API implementation 5064 */ 5065 5066 5067 $__default["default"](document).on(EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE$1, function (event) { 5068 var _this11 = this; 5069 5070 var target; 5071 var selector = Util.getSelectorFromElement(this); 5072 5073 if (selector) { 5074 target = document.querySelector(selector); 5075 } 5076 5077 var config = $__default["default"](target).data(DATA_KEY$5) ? 'toggle' : _extends({}, $__default["default"](target).data(), $__default["default"](this).data()); 5078 5079 if (this.tagName === 'A' || this.tagName === 'AREA') { 5080 event.preventDefault(); 5081 } 5082 5083 var $target = $__default["default"](target).one(EVENT_SHOW$2, function (showEvent) { 5084 if (showEvent.isDefaultPrevented()) { 5085 // Only register focus restorer if modal will actually get shown 5086 return; 5087 } 5088 5089 $target.one(EVENT_HIDDEN$2, function () { 5090 if ($__default["default"](_this11).is(':visible')) { 5091 _this11.focus(); 5092 } 5093 }); 5094 }); 5095 5096 Modal._jQueryInterface.call($__default["default"](target), config, this); 5097 }); 5098 /** 5099 * jQuery 5100 */ 5101 5102 $__default["default"].fn[NAME$5] = Modal._jQueryInterface; 5103 $__default["default"].fn[NAME$5].Constructor = Modal; 5104 5105 $__default["default"].fn[NAME$5].noConflict = function () { 5106 $__default["default"].fn[NAME$5] = JQUERY_NO_CONFLICT$5; 5107 return Modal._jQueryInterface; 5108 }; 5109 5110 /** 5111 * -------------------------------------------------------------------------- 5112 * Bootstrap (v4.6.1): tools/sanitizer.js 5113 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) 5114 * -------------------------------------------------------------------------- 5115 */ 5116 var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']; 5117 var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i; 5118 var DefaultWhitelist = { 5119 // Global attributes allowed on any supplied element below. 5120 '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN], 5121 a: ['target', 'href', 'title', 'rel'], 5122 area: [], 5123 b: [], 5124 br: [], 5125 col: [], 5126 code: [], 5127 div: [], 5128 em: [], 5129 hr: [], 5130 h1: [], 5131 h2: [], 5132 h3: [], 5133 h4: [], 5134 h5: [], 5135 h6: [], 5136 i: [], 5137 img: ['src', 'srcset', 'alt', 'title', 'width', 'height'], 5138 li: [], 5139 ol: [], 5140 p: [], 5141 pre: [], 5142 s: [], 5143 small: [], 5144 span: [], 5145 sub: [], 5146 sup: [], 5147 strong: [], 5148 u: [], 5149 ul: [] 5150 }; 5151 /** 5152 * A pattern that recognizes a commonly useful subset of URLs that are safe. 5153 * 5154 * Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts 5155 */ 5156 5157 var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^#&/:?]*(?:[#/?]|$))/i; 5158 /** 5159 * A pattern that matches safe data URLs. Only matches image, video and audio types. 5160 * 5161 * Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts 5162 */ 5163 5164 var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i; 5165 5166 function allowedAttribute(attr, allowedAttributeList) { 5167 var attrName = attr.nodeName.toLowerCase(); 5168 5169 if (allowedAttributeList.indexOf(attrName) !== -1) { 5170 if (uriAttrs.indexOf(attrName) !== -1) { 5171 return Boolean(SAFE_URL_PATTERN.test(attr.nodeValue) || DATA_URL_PATTERN.test(attr.nodeValue)); 5172 } 5173 5174 return true; 5175 } 5176 5177 var regExp = allowedAttributeList.filter(function (attrRegex) { 5178 return attrRegex instanceof RegExp; 5179 }); // Check if a regular expression validates the attribute. 5180 5181 for (var i = 0, len = regExp.length; i < len; i++) { 5182 if (regExp[i].test(attrName)) { 5183 return true; 5184 } 5185 } 5186 5187 return false; 5188 } 5189 5190 function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) { 5191 if (unsafeHtml.length === 0) { 5192 return unsafeHtml; 5193 } 5194 5195 if (sanitizeFn && typeof sanitizeFn === 'function') { 5196 return sanitizeFn(unsafeHtml); 5197 } 5198 5199 var domParser = new window.DOMParser(); 5200 var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html'); 5201 var whitelistKeys = Object.keys(whiteList); 5202 var elements = [].slice.call(createdDocument.body.querySelectorAll('*')); 5203 5204 var _loop = function _loop(i, len) { 5205 var el = elements[i]; 5206 var elName = el.nodeName.toLowerCase(); 5207 5208 if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) { 5209 el.parentNode.removeChild(el); 5210 return "continue"; 5211 } 5212 5213 var attributeList = [].slice.call(el.attributes); // eslint-disable-next-line unicorn/prefer-spread 5214 5215 var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []); 5216 attributeList.forEach(function (attr) { 5217 if (!allowedAttribute(attr, whitelistedAttributes)) { 5218 el.removeAttribute(attr.nodeName); 5219 } 5220 }); 5221 }; 5222 5223 for (var i = 0, len = elements.length; i < len; i++) { 5224 var _ret = _loop(i); 5225 5226 if (_ret === "continue") continue; 5227 } 5228 5229 return createdDocument.body.innerHTML; 5230 } 5231 5232 /** 5233 * Constants 5234 */ 5235 5236 var NAME$4 = 'tooltip'; 5237 var VERSION$4 = '4.6.1'; 5238 var DATA_KEY$4 = 'bs.tooltip'; 5239 var EVENT_KEY$4 = "." + DATA_KEY$4; 5240 var JQUERY_NO_CONFLICT$4 = $__default["default"].fn[NAME$4]; 5241 var CLASS_PREFIX$1 = 'bs-tooltip'; 5242 var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g'); 5243 var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn']; 5244 var CLASS_NAME_FADE$3 = 'fade'; 5245 var CLASS_NAME_SHOW$3 = 'show'; 5246 var HOVER_STATE_SHOW = 'show'; 5247 var HOVER_STATE_OUT = 'out'; 5248 var SELECTOR_TOOLTIP_INNER = '.tooltip-inner'; 5249 var SELECTOR_ARROW = '.arrow'; 5250 var TRIGGER_HOVER = 'hover'; 5251 var TRIGGER_FOCUS = 'focus'; 5252 var TRIGGER_CLICK = 'click'; 5253 var TRIGGER_MANUAL = 'manual'; 5254 var AttachmentMap = { 5255 AUTO: 'auto', 5256 TOP: 'top', 5257 RIGHT: 'right', 5258 BOTTOM: 'bottom', 5259 LEFT: 'left' 5260 }; 5261 var Default$3 = { 5262 animation: true, 5263 template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>', 5264 trigger: 'hover focus', 5265 title: '', 5266 delay: 0, 5267 html: false, 5268 selector: false, 5269 placement: 'top', 5270 offset: 0, 5271 container: false, 5272 fallbackPlacement: 'flip', 5273 boundary: 'scrollParent', 5274 customClass: '', 5275 sanitize: true, 5276 sanitizeFn: null, 5277 whiteList: DefaultWhitelist, 5278 popperConfig: null 5279 }; 5280 var DefaultType$3 = { 5281 animation: 'boolean', 5282 template: 'string', 5283 title: '(string|element|function)', 5284 trigger: 'string', 5285 delay: '(number|object)', 5286 html: 'boolean', 5287 selector: '(string|boolean)', 5288 placement: '(string|function)', 5289 offset: '(number|string|function)', 5290 container: '(string|element|boolean)', 5291 fallbackPlacement: '(string|array)', 5292 boundary: '(string|element)', 5293 customClass: '(string|function)', 5294 sanitize: 'boolean', 5295 sanitizeFn: '(null|function)', 5296 whiteList: 'object', 5297 popperConfig: '(null|object)' 5298 }; 5299 var Event$1 = { 5300 HIDE: "hide" + EVENT_KEY$4, 5301 HIDDEN: "hidden" + EVENT_KEY$4, 5302 SHOW: "show" + EVENT_KEY$4, 5303 SHOWN: "shown" + EVENT_KEY$4, 5304 INSERTED: "inserted" + EVENT_KEY$4, 5305 CLICK: "click" + EVENT_KEY$4, 5306 FOCUSIN: "focusin" + EVENT_KEY$4, 5307 FOCUSOUT: "focusout" + EVENT_KEY$4, 5308 MOUSEENTER: "mouseenter" + EVENT_KEY$4, 5309 MOUSELEAVE: "mouseleave" + EVENT_KEY$4 5310 }; 5311 /** 5312 * Class definition 5313 */ 5314 5315 var Tooltip = /*#__PURE__*/function () { 5316 function Tooltip(element, config) { 5317 if (typeof Popper__default["default"] === 'undefined') { 5318 throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)'); 5319 } // Private 5320 5321 5322 this._isEnabled = true; 5323 this._timeout = 0; 5324 this._hoverState = ''; 5325 this._activeTrigger = {}; 5326 this._popper = null; // Protected 5327 5328 this.element = element; 5329 this.config = this._getConfig(config); 5330 this.tip = null; 5331 5332 this._setListeners(); 5333 } // Getters 5334 5335 5336 var _proto = Tooltip.prototype; 5337 5338 // Public 5339 _proto.enable = function enable() { 5340 this._isEnabled = true; 5341 }; 5342 5343 _proto.disable = function disable() { 5344 this._isEnabled = false; 5345 }; 5346 5347 _proto.toggleEnabled = function toggleEnabled() { 5348 this._isEnabled = !this._isEnabled; 5349 }; 5350 5351 _proto.toggle = function toggle(event) { 5352 if (!this._isEnabled) { 5353 return; 5354 } 5355 5356 if (event) { 5357 var dataKey = this.constructor.DATA_KEY; 5358 var context = $__default["default"](event.currentTarget).data(dataKey); 5359 5360 if (!context) { 5361 context = new this.constructor(event.currentTarget, this._getDelegateConfig()); 5362 $__default["default"](event.currentTarget).data(dataKey, context); 5363 } 5364 5365 context._activeTrigger.click = !context._activeTrigger.click; 5366 5367 if (context._isWithActiveTrigger()) { 5368 context._enter(null, context); 5369 } else { 5370 context._leave(null, context); 5371 } 5372 } else { 5373 if ($__default["default"](this.getTipElement()).hasClass(CLASS_NAME_SHOW$3)) { 5374 this._leave(null, this); 5375 5376 return; 5377 } 5378 5379 this._enter(null, this); 5380 } 5381 }; 5382 5383 _proto.dispose = function dispose() { 5384 clearTimeout(this._timeout); 5385 $__default["default"].removeData(this.element, this.constructor.DATA_KEY); 5386 $__default["default"](this.element).off(this.constructor.EVENT_KEY); 5387 $__default["default"](this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler); 5388 5389 if (this.tip) { 5390 $__default["default"](this.tip).remove(); 5391 } 5392 5393 this._isEnabled = null; 5394 this._timeout = null; 5395 this._hoverState = null; 5396 this._activeTrigger = null; 5397 5398 if (this._popper) { 5399 this._popper.destroy(); 5400 } 5401 5402 this._popper = null; 5403 this.element = null; 5404 this.config = null; 5405 this.tip = null; 5406 }; 5407 5408 _proto.show = function show() { 5409 var _this = this; 5410 5411 if ($__default["default"](this.element).css('display') === 'none') { 5412 throw new Error('Please use show on visible elements'); 5413 } 5414 5415 var showEvent = $__default["default"].Event(this.constructor.Event.SHOW); 5416 5417 if (this.isWithContent() && this._isEnabled) { 5418 $__default["default"](this.element).trigger(showEvent); 5419 var shadowRoot = Util.findShadowRoot(this.element); 5420 var isInTheDom = $__default["default"].contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element); 5421 5422 if (showEvent.isDefaultPrevented() || !isInTheDom) { 5423 return; 5424 } 5425 5426 var tip = this.getTipElement(); 5427 var tipId = Util.getUID(this.constructor.NAME); 5428 tip.setAttribute('id', tipId); 5429 this.element.setAttribute('aria-describedby', tipId); 5430 this.setContent(); 5431 5432 if (this.config.animation) { 5433 $__default["default"](tip).addClass(CLASS_NAME_FADE$3); 5434 } 5435 5436 var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement; 5437 5438 var attachment = this._getAttachment(placement); 5439 5440 this.addAttachmentClass(attachment); 5441 5442 var container = this._getContainer(); 5443 5444 $__default["default"](tip).data(this.constructor.DATA_KEY, this); 5445 5446 if (!$__default["default"].contains(this.element.ownerDocument.documentElement, this.tip)) { 5447 $__default["default"](tip).appendTo(container); 5448 } 5449 5450 $__default["default"](this.element).trigger(this.constructor.Event.INSERTED); 5451 this._popper = new Popper__default["default"](this.element, tip, this._getPopperConfig(attachment)); 5452 $__default["default"](tip).addClass(CLASS_NAME_SHOW$3); 5453 $__default["default"](tip).addClass(this.config.customClass); // If this is a touch-enabled device we add extra 5454 // empty mouseover listeners to the body's immediate children; 5455 // only needed because of broken event delegation on iOS 5456 // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html 5457 5458 if ('ontouchstart' in document.documentElement) { 5459 $__default["default"](document.body).children().on('mouseover', null, $__default["default"].noop); 5460 } 5461 5462 var complete = function complete() { 5463 if (_this.config.animation) { 5464 _this._fixTransition(); 5465 } 5466 5467 var prevHoverState = _this._hoverState; 5468 _this._hoverState = null; 5469 $__default["default"](_this.element).trigger(_this.constructor.Event.SHOWN); 5470 5471 if (prevHoverState === HOVER_STATE_OUT) { 5472 _this._leave(null, _this); 5473 } 5474 }; 5475 5476 if ($__default["default"](this.tip).hasClass(CLASS_NAME_FADE$3)) { 5477 var transitionDuration = Util.getTransitionDurationFromElement(this.tip); 5478 $__default["default"](this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 5479 } else { 5480 complete(); 5481 } 5482 } 5483 }; 5484 5485 _proto.hide = function hide(callback) { 5486 var _this2 = this; 5487 5488 var tip = this.getTipElement(); 5489 var hideEvent = $__default["default"].Event(this.constructor.Event.HIDE); 5490 5491 var complete = function complete() { 5492 if (_this2._hoverState !== HOVER_STATE_SHOW && tip.parentNode) { 5493 tip.parentNode.removeChild(tip); 5494 } 5495 5496 _this2._cleanTipClass(); 5497 5498 _this2.element.removeAttribute('aria-describedby'); 5499 5500 $__default["default"](_this2.element).trigger(_this2.constructor.Event.HIDDEN); 5501 5502 if (_this2._popper !== null) { 5503 _this2._popper.destroy(); 5504 } 5505 5506 if (callback) { 5507 callback(); 5508 } 5509 }; 5510 5511 $__default["default"](this.element).trigger(hideEvent); 5512 5513 if (hideEvent.isDefaultPrevented()) { 5514 return; 5515 } 5516 5517 $__default["default"](tip).removeClass(CLASS_NAME_SHOW$3); // If this is a touch-enabled device we remove the extra 5518 // empty mouseover listeners we added for iOS support 5519 5520 if ('ontouchstart' in document.documentElement) { 5521 $__default["default"](document.body).children().off('mouseover', null, $__default["default"].noop); 5522 } 5523 5524 this._activeTrigger[TRIGGER_CLICK] = false; 5525 this._activeTrigger[TRIGGER_FOCUS] = false; 5526 this._activeTrigger[TRIGGER_HOVER] = false; 5527 5528 if ($__default["default"](this.tip).hasClass(CLASS_NAME_FADE$3)) { 5529 var transitionDuration = Util.getTransitionDurationFromElement(tip); 5530 $__default["default"](tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 5531 } else { 5532 complete(); 5533 } 5534 5535 this._hoverState = ''; 5536 }; 5537 5538 _proto.update = function update() { 5539 if (this._popper !== null) { 5540 this._popper.scheduleUpdate(); 5541 } 5542 } // Protected 5543 ; 5544 5545 _proto.isWithContent = function isWithContent() { 5546 return Boolean(this.getTitle()); 5547 }; 5548 5549 _proto.addAttachmentClass = function addAttachmentClass(attachment) { 5550 $__default["default"](this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment); 5551 }; 5552 5553 _proto.getTipElement = function getTipElement() { 5554 this.tip = this.tip || $__default["default"](this.config.template)[0]; 5555 return this.tip; 5556 }; 5557 5558 _proto.setContent = function setContent() { 5559 var tip = this.getTipElement(); 5560 this.setElementContent($__default["default"](tip.querySelectorAll(SELECTOR_TOOLTIP_INNER)), this.getTitle()); 5561 $__default["default"](tip).removeClass(CLASS_NAME_FADE$3 + " " + CLASS_NAME_SHOW$3); 5562 }; 5563 5564 _proto.setElementContent = function setElementContent($element, content) { 5565 if (typeof content === 'object' && (content.nodeType || content.jquery)) { 5566 // Content is a DOM node or a jQuery 5567 if (this.config.html) { 5568 if (!$__default["default"](content).parent().is($element)) { 5569 $element.empty().append(content); 5570 } 5571 } else { 5572 $element.text($__default["default"](content).text()); 5573 } 5574 5575 return; 5576 } 5577 5578 if (this.config.html) { 5579 if (this.config.sanitize) { 5580 content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn); 5581 } 5582 5583 $element.html(content); 5584 } else { 5585 $element.text(content); 5586 } 5587 }; 5588 5589 _proto.getTitle = function getTitle() { 5590 var title = this.element.getAttribute('data-original-title'); 5591 5592 if (!title) { 5593 title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title; 5594 } 5595 5596 return title; 5597 } // Private 5598 ; 5599 5600 _proto._getPopperConfig = function _getPopperConfig(attachment) { 5601 var _this3 = this; 5602 5603 var defaultBsConfig = { 5604 placement: attachment, 5605 modifiers: { 5606 offset: this._getOffset(), 5607 flip: { 5608 behavior: this.config.fallbackPlacement 5609 }, 5610 arrow: { 5611 element: SELECTOR_ARROW 5612 }, 5613 preventOverflow: { 5614 boundariesElement: this.config.boundary 5615 } 5616 }, 5617 onCreate: function onCreate(data) { 5618 if (data.originalPlacement !== data.placement) { 5619 _this3._handlePopperPlacementChange(data); 5620 } 5621 }, 5622 onUpdate: function onUpdate(data) { 5623 return _this3._handlePopperPlacementChange(data); 5624 } 5625 }; 5626 return _extends({}, defaultBsConfig, this.config.popperConfig); 5627 }; 5628 5629 _proto._getOffset = function _getOffset() { 5630 var _this4 = this; 5631 5632 var offset = {}; 5633 5634 if (typeof this.config.offset === 'function') { 5635 offset.fn = function (data) { 5636 data.offsets = _extends({}, data.offsets, _this4.config.offset(data.offsets, _this4.element)); 5637 return data; 5638 }; 5639 } else { 5640 offset.offset = this.config.offset; 5641 } 5642 5643 return offset; 5644 }; 5645 5646 _proto._getContainer = function _getContainer() { 5647 if (this.config.container === false) { 5648 return document.body; 5649 } 5650 5651 if (Util.isElement(this.config.container)) { 5652 return $__default["default"](this.config.container); 5653 } 5654 5655 return $__default["default"](document).find(this.config.container); 5656 }; 5657 5658 _proto._getAttachment = function _getAttachment(placement) { 5659 return AttachmentMap[placement.toUpperCase()]; 5660 }; 5661 5662 _proto._setListeners = function _setListeners() { 5663 var _this5 = this; 5664 5665 var triggers = this.config.trigger.split(' '); 5666 triggers.forEach(function (trigger) { 5667 if (trigger === 'click') { 5668 $__default["default"](_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) { 5669 return _this5.toggle(event); 5670 }); 5671 } else if (trigger !== TRIGGER_MANUAL) { 5672 var eventIn = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN; 5673 var eventOut = trigger === TRIGGER_HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT; 5674 $__default["default"](_this5.element).on(eventIn, _this5.config.selector, function (event) { 5675 return _this5._enter(event); 5676 }).on(eventOut, _this5.config.selector, function (event) { 5677 return _this5._leave(event); 5678 }); 5679 } 5680 }); 5681 5682 this._hideModalHandler = function () { 5683 if (_this5.element) { 5684 _this5.hide(); 5685 } 5686 }; 5687 5688 $__default["default"](this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler); 5689 5690 if (this.config.selector) { 5691 this.config = _extends({}, this.config, { 5692 trigger: 'manual', 5693 selector: '' 5694 }); 5695 } else { 5696 this._fixTitle(); 5697 } 5698 }; 5699 5700 _proto._fixTitle = function _fixTitle() { 5701 var titleType = typeof this.element.getAttribute('data-original-title'); 5702 5703 if (this.element.getAttribute('title') || titleType !== 'string') { 5704 this.element.setAttribute('data-original-title', this.element.getAttribute('title') || ''); 5705 this.element.setAttribute('title', ''); 5706 } 5707 }; 5708 5709 _proto._enter = function _enter(event, context) { 5710 var dataKey = this.constructor.DATA_KEY; 5711 context = context || $__default["default"](event.currentTarget).data(dataKey); 5712 5713 if (!context) { 5714 context = new this.constructor(event.currentTarget, this._getDelegateConfig()); 5715 $__default["default"](event.currentTarget).data(dataKey, context); 5716 } 5717 5718 if (event) { 5719 context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true; 5720 } 5721 5722 if ($__default["default"](context.getTipElement()).hasClass(CLASS_NAME_SHOW$3) || context._hoverState === HOVER_STATE_SHOW) { 5723 context._hoverState = HOVER_STATE_SHOW; 5724 return; 5725 } 5726 5727 clearTimeout(context._timeout); 5728 context._hoverState = HOVER_STATE_SHOW; 5729 5730 if (!context.config.delay || !context.config.delay.show) { 5731 context.show(); 5732 return; 5733 } 5734 5735 context._timeout = setTimeout(function () { 5736 if (context._hoverState === HOVER_STATE_SHOW) { 5737 context.show(); 5738 } 5739 }, context.config.delay.show); 5740 }; 5741 5742 _proto._leave = function _leave(event, context) { 5743 var dataKey = this.constructor.DATA_KEY; 5744 context = context || $__default["default"](event.currentTarget).data(dataKey); 5745 5746 if (!context) { 5747 context = new this.constructor(event.currentTarget, this._getDelegateConfig()); 5748 $__default["default"](event.currentTarget).data(dataKey, context); 5749 } 5750 5751 if (event) { 5752 context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = false; 5753 } 5754 5755 if (context._isWithActiveTrigger()) { 5756 return; 5757 } 5758 5759 clearTimeout(context._timeout); 5760 context._hoverState = HOVER_STATE_OUT; 5761 5762 if (!context.config.delay || !context.config.delay.hide) { 5763 context.hide(); 5764 return; 5765 } 5766 5767 context._timeout = setTimeout(function () { 5768 if (context._hoverState === HOVER_STATE_OUT) { 5769 context.hide(); 5770 } 5771 }, context.config.delay.hide); 5772 }; 5773 5774 _proto._isWithActiveTrigger = function _isWithActiveTrigger() { 5775 for (var trigger in this._activeTrigger) { 5776 if (this._activeTrigger[trigger]) { 5777 return true; 5778 } 5779 } 5780 5781 return false; 5782 }; 5783 5784 _proto._getConfig = function _getConfig(config) { 5785 var dataAttributes = $__default["default"](this.element).data(); 5786 Object.keys(dataAttributes).forEach(function (dataAttr) { 5787 if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) { 5788 delete dataAttributes[dataAttr]; 5789 } 5790 }); 5791 config = _extends({}, this.constructor.Default, dataAttributes, typeof config === 'object' && config ? config : {}); 5792 5793 if (typeof config.delay === 'number') { 5794 config.delay = { 5795 show: config.delay, 5796 hide: config.delay 5797 }; 5798 } 5799 5800 if (typeof config.title === 'number') { 5801 config.title = config.title.toString(); 5802 } 5803 5804 if (typeof config.content === 'number') { 5805 config.content = config.content.toString(); 5806 } 5807 5808 Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType); 5809 5810 if (config.sanitize) { 5811 config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn); 5812 } 5813 5814 return config; 5815 }; 5816 5817 _proto._getDelegateConfig = function _getDelegateConfig() { 5818 var config = {}; 5819 5820 if (this.config) { 5821 for (var key in this.config) { 5822 if (this.constructor.Default[key] !== this.config[key]) { 5823 config[key] = this.config[key]; 5824 } 5825 } 5826 } 5827 5828 return config; 5829 }; 5830 5831 _proto._cleanTipClass = function _cleanTipClass() { 5832 var $tip = $__default["default"](this.getTipElement()); 5833 var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1); 5834 5835 if (tabClass !== null && tabClass.length) { 5836 $tip.removeClass(tabClass.join('')); 5837 } 5838 }; 5839 5840 _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) { 5841 this.tip = popperData.instance.popper; 5842 5843 this._cleanTipClass(); 5844 5845 this.addAttachmentClass(this._getAttachment(popperData.placement)); 5846 }; 5847 5848 _proto._fixTransition = function _fixTransition() { 5849 var tip = this.getTipElement(); 5850 var initConfigAnimation = this.config.animation; 5851 5852 if (tip.getAttribute('x-placement') !== null) { 5853 return; 5854 } 5855 5856 $__default["default"](tip).removeClass(CLASS_NAME_FADE$3); 5857 this.config.animation = false; 5858 this.hide(); 5859 this.show(); 5860 this.config.animation = initConfigAnimation; 5861 } // Static 5862 ; 5863 5864 Tooltip._jQueryInterface = function _jQueryInterface(config) { 5865 return this.each(function () { 5866 var $element = $__default["default"](this); 5867 var data = $element.data(DATA_KEY$4); 5868 5869 var _config = typeof config === 'object' && config; 5870 5871 if (!data && /dispose|hide/.test(config)) { 5872 return; 5873 } 5874 5875 if (!data) { 5876 data = new Tooltip(this, _config); 5877 $element.data(DATA_KEY$4, data); 5878 } 5879 5880 if (typeof config === 'string') { 5881 if (typeof data[config] === 'undefined') { 5882 throw new TypeError("No method named \"" + config + "\""); 5883 } 5884 5885 data[config](); 5886 } 5887 }); 5888 }; 5889 5890 _createClass(Tooltip, null, [{ 5891 key: "VERSION", 5892 get: function get() { 5893 return VERSION$4; 5894 } 5895 }, { 5896 key: "Default", 5897 get: function get() { 5898 return Default$3; 5899 } 5900 }, { 5901 key: "NAME", 5902 get: function get() { 5903 return NAME$4; 5904 } 5905 }, { 5906 key: "DATA_KEY", 5907 get: function get() { 5908 return DATA_KEY$4; 5909 } 5910 }, { 5911 key: "Event", 5912 get: function get() { 5913 return Event$1; 5914 } 5915 }, { 5916 key: "EVENT_KEY", 5917 get: function get() { 5918 return EVENT_KEY$4; 5919 } 5920 }, { 5921 key: "DefaultType", 5922 get: function get() { 5923 return DefaultType$3; 5924 } 5925 }]); 5926 5927 return Tooltip; 5928 }(); 5929 /** 5930 * jQuery 5931 */ 5932 5933 5934 $__default["default"].fn[NAME$4] = Tooltip._jQueryInterface; 5935 $__default["default"].fn[NAME$4].Constructor = Tooltip; 5936 5937 $__default["default"].fn[NAME$4].noConflict = function () { 5938 $__default["default"].fn[NAME$4] = JQUERY_NO_CONFLICT$4; 5939 return Tooltip._jQueryInterface; 5940 }; 5941 5942 /** 5943 * Constants 5944 */ 5945 5946 var NAME$3 = 'popover'; 5947 var VERSION$3 = '4.6.1'; 5948 var DATA_KEY$3 = 'bs.popover'; 5949 var EVENT_KEY$3 = "." + DATA_KEY$3; 5950 var JQUERY_NO_CONFLICT$3 = $__default["default"].fn[NAME$3]; 5951 var CLASS_PREFIX = 'bs-popover'; 5952 var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g'); 5953 var CLASS_NAME_FADE$2 = 'fade'; 5954 var CLASS_NAME_SHOW$2 = 'show'; 5955 var SELECTOR_TITLE = '.popover-header'; 5956 var SELECTOR_CONTENT = '.popover-body'; 5957 5958 var Default$2 = _extends({}, Tooltip.Default, { 5959 placement: 'right', 5960 trigger: 'click', 5961 content: '', 5962 template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>' 5963 }); 5964 5965 var DefaultType$2 = _extends({}, Tooltip.DefaultType, { 5966 content: '(string|element|function)' 5967 }); 5968 5969 var Event = { 5970 HIDE: "hide" + EVENT_KEY$3, 5971 HIDDEN: "hidden" + EVENT_KEY$3, 5972 SHOW: "show" + EVENT_KEY$3, 5973 SHOWN: "shown" + EVENT_KEY$3, 5974 INSERTED: "inserted" + EVENT_KEY$3, 5975 CLICK: "click" + EVENT_KEY$3, 5976 FOCUSIN: "focusin" + EVENT_KEY$3, 5977 FOCUSOUT: "focusout" + EVENT_KEY$3, 5978 MOUSEENTER: "mouseenter" + EVENT_KEY$3, 5979 MOUSELEAVE: "mouseleave" + EVENT_KEY$3 5980 }; 5981 /** 5982 * Class definition 5983 */ 5984 5985 var Popover = /*#__PURE__*/function (_Tooltip) { 5986 _inheritsLoose(Popover, _Tooltip); 5987 5988 function Popover() { 5989 return _Tooltip.apply(this, arguments) || this; 5990 } 5991 5992 var _proto = Popover.prototype; 5993 5994 // Overrides 5995 _proto.isWithContent = function isWithContent() { 5996 return this.getTitle() || this._getContent(); 5997 }; 5998 5999 _proto.addAttachmentClass = function addAttachmentClass(attachment) { 6000 $__default["default"](this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment); 6001 }; 6002 6003 _proto.getTipElement = function getTipElement() { 6004 this.tip = this.tip || $__default["default"](this.config.template)[0]; 6005 return this.tip; 6006 }; 6007 6008 _proto.setContent = function setContent() { 6009 var $tip = $__default["default"](this.getTipElement()); // We use append for html objects to maintain js events 6010 6011 this.setElementContent($tip.find(SELECTOR_TITLE), this.getTitle()); 6012 6013 var content = this._getContent(); 6014 6015 if (typeof content === 'function') { 6016 content = content.call(this.element); 6017 } 6018 6019 this.setElementContent($tip.find(SELECTOR_CONTENT), content); 6020 $tip.removeClass(CLASS_NAME_FADE$2 + " " + CLASS_NAME_SHOW$2); 6021 } // Private 6022 ; 6023 6024 _proto._getContent = function _getContent() { 6025 return this.element.getAttribute('data-content') || this.config.content; 6026 }; 6027 6028 _proto._cleanTipClass = function _cleanTipClass() { 6029 var $tip = $__default["default"](this.getTipElement()); 6030 var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX); 6031 6032 if (tabClass !== null && tabClass.length > 0) { 6033 $tip.removeClass(tabClass.join('')); 6034 } 6035 } // Static 6036 ; 6037 6038 Popover._jQueryInterface = function _jQueryInterface(config) { 6039 return this.each(function () { 6040 var data = $__default["default"](this).data(DATA_KEY$3); 6041 6042 var _config = typeof config === 'object' ? config : null; 6043 6044 if (!data && /dispose|hide/.test(config)) { 6045 return; 6046 } 6047 6048 if (!data) { 6049 data = new Popover(this, _config); 6050 $__default["default"](this).data(DATA_KEY$3, data); 6051 } 6052 6053 if (typeof config === 'string') { 6054 if (typeof data[config] === 'undefined') { 6055 throw new TypeError("No method named \"" + config + "\""); 6056 } 6057 6058 data[config](); 6059 } 6060 }); 6061 }; 6062 6063 _createClass(Popover, null, [{ 6064 key: "VERSION", 6065 get: // Getters 6066 function get() { 6067 return VERSION$3; 6068 } 6069 }, { 6070 key: "Default", 6071 get: function get() { 6072 return Default$2; 6073 } 6074 }, { 6075 key: "NAME", 6076 get: function get() { 6077 return NAME$3; 6078 } 6079 }, { 6080 key: "DATA_KEY", 6081 get: function get() { 6082 return DATA_KEY$3; 6083 } 6084 }, { 6085 key: "Event", 6086 get: function get() { 6087 return Event; 6088 } 6089 }, { 6090 key: "EVENT_KEY", 6091 get: function get() { 6092 return EVENT_KEY$3; 6093 } 6094 }, { 6095 key: "DefaultType", 6096 get: function get() { 6097 return DefaultType$2; 6098 } 6099 }]); 6100 6101 return Popover; 6102 }(Tooltip); 6103 /** 6104 * jQuery 6105 */ 6106 6107 6108 $__default["default"].fn[NAME$3] = Popover._jQueryInterface; 6109 $__default["default"].fn[NAME$3].Constructor = Popover; 6110 6111 $__default["default"].fn[NAME$3].noConflict = function () { 6112 $__default["default"].fn[NAME$3] = JQUERY_NO_CONFLICT$3; 6113 return Popover._jQueryInterface; 6114 }; 6115 6116 /** 6117 * Constants 6118 */ 6119 6120 var NAME$2 = 'scrollspy'; 6121 var VERSION$2 = '4.6.1'; 6122 var DATA_KEY$2 = 'bs.scrollspy'; 6123 var EVENT_KEY$2 = "." + DATA_KEY$2; 6124 var DATA_API_KEY$1 = '.data-api'; 6125 var JQUERY_NO_CONFLICT$2 = $__default["default"].fn[NAME$2]; 6126 var CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item'; 6127 var CLASS_NAME_ACTIVE$1 = 'active'; 6128 var EVENT_ACTIVATE = "activate" + EVENT_KEY$2; 6129 var EVENT_SCROLL = "scroll" + EVENT_KEY$2; 6130 var EVENT_LOAD_DATA_API = "load" + EVENT_KEY$2 + DATA_API_KEY$1; 6131 var METHOD_OFFSET = 'offset'; 6132 var METHOD_POSITION = 'position'; 6133 var SELECTOR_DATA_SPY = '[data-spy="scroll"]'; 6134 var SELECTOR_NAV_LIST_GROUP$1 = '.nav, .list-group'; 6135 var SELECTOR_NAV_LINKS = '.nav-link'; 6136 var SELECTOR_NAV_ITEMS = '.nav-item'; 6137 var SELECTOR_LIST_ITEMS = '.list-group-item'; 6138 var SELECTOR_DROPDOWN$1 = '.dropdown'; 6139 var SELECTOR_DROPDOWN_ITEMS = '.dropdown-item'; 6140 var SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle'; 6141 var Default$1 = { 6142 offset: 10, 6143 method: 'auto', 6144 target: '' 6145 }; 6146 var DefaultType$1 = { 6147 offset: 'number', 6148 method: 'string', 6149 target: '(string|element)' 6150 }; 6151 /** 6152 * Class definition 6153 */ 6154 6155 var ScrollSpy = /*#__PURE__*/function () { 6156 function ScrollSpy(element, config) { 6157 var _this = this; 6158 6159 this._element = element; 6160 this._scrollElement = element.tagName === 'BODY' ? window : element; 6161 this._config = this._getConfig(config); 6162 this._selector = this._config.target + " " + SELECTOR_NAV_LINKS + "," + (this._config.target + " " + SELECTOR_LIST_ITEMS + ",") + (this._config.target + " " + SELECTOR_DROPDOWN_ITEMS); 6163 this._offsets = []; 6164 this._targets = []; 6165 this._activeTarget = null; 6166 this._scrollHeight = 0; 6167 $__default["default"](this._scrollElement).on(EVENT_SCROLL, function (event) { 6168 return _this._process(event); 6169 }); 6170 this.refresh(); 6171 6172 this._process(); 6173 } // Getters 6174 6175 6176 var _proto = ScrollSpy.prototype; 6177 6178 // Public 6179 _proto.refresh = function refresh() { 6180 var _this2 = this; 6181 6182 var autoMethod = this._scrollElement === this._scrollElement.window ? METHOD_OFFSET : METHOD_POSITION; 6183 var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method; 6184 var offsetBase = offsetMethod === METHOD_POSITION ? this._getScrollTop() : 0; 6185 this._offsets = []; 6186 this._targets = []; 6187 this._scrollHeight = this._getScrollHeight(); 6188 var targets = [].slice.call(document.querySelectorAll(this._selector)); 6189 targets.map(function (element) { 6190 var target; 6191 var targetSelector = Util.getSelectorFromElement(element); 6192 6193 if (targetSelector) { 6194 target = document.querySelector(targetSelector); 6195 } 6196 6197 if (target) { 6198 var targetBCR = target.getBoundingClientRect(); 6199 6200 if (targetBCR.width || targetBCR.height) { 6201 // TODO (fat): remove sketch reliance on jQuery position/offset 6202 return [$__default["default"](target)[offsetMethod]().top + offsetBase, targetSelector]; 6203 } 6204 } 6205 6206 return null; 6207 }).filter(function (item) { 6208 return item; 6209 }).sort(function (a, b) { 6210 return a[0] - b[0]; 6211 }).forEach(function (item) { 6212 _this2._offsets.push(item[0]); 6213 6214 _this2._targets.push(item[1]); 6215 }); 6216 }; 6217 6218 _proto.dispose = function dispose() { 6219 $__default["default"].removeData(this._element, DATA_KEY$2); 6220 $__default["default"](this._scrollElement).off(EVENT_KEY$2); 6221 this._element = null; 6222 this._scrollElement = null; 6223 this._config = null; 6224 this._selector = null; 6225 this._offsets = null; 6226 this._targets = null; 6227 this._activeTarget = null; 6228 this._scrollHeight = null; 6229 } // Private 6230 ; 6231 6232 _proto._getConfig = function _getConfig(config) { 6233 config = _extends({}, Default$1, typeof config === 'object' && config ? config : {}); 6234 6235 if (typeof config.target !== 'string' && Util.isElement(config.target)) { 6236 var id = $__default["default"](config.target).attr('id'); 6237 6238 if (!id) { 6239 id = Util.getUID(NAME$2); 6240 $__default["default"](config.target).attr('id', id); 6241 } 6242 6243 config.target = "#" + id; 6244 } 6245 6246 Util.typeCheckConfig(NAME$2, config, DefaultType$1); 6247 return config; 6248 }; 6249 6250 _proto._getScrollTop = function _getScrollTop() { 6251 return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop; 6252 }; 6253 6254 _proto._getScrollHeight = function _getScrollHeight() { 6255 return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight); 6256 }; 6257 6258 _proto._getOffsetHeight = function _getOffsetHeight() { 6259 return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height; 6260 }; 6261 6262 _proto._process = function _process() { 6263 var scrollTop = this._getScrollTop() + this._config.offset; 6264 6265 var scrollHeight = this._getScrollHeight(); 6266 6267 var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight(); 6268 6269 if (this._scrollHeight !== scrollHeight) { 6270 this.refresh(); 6271 } 6272 6273 if (scrollTop >= maxScroll) { 6274 var target = this._targets[this._targets.length - 1]; 6275 6276 if (this._activeTarget !== target) { 6277 this._activate(target); 6278 } 6279 6280 return; 6281 } 6282 6283 if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) { 6284 this._activeTarget = null; 6285 6286 this._clear(); 6287 6288 return; 6289 } 6290 6291 for (var i = this._offsets.length; i--;) { 6292 var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]); 6293 6294 if (isActiveTarget) { 6295 this._activate(this._targets[i]); 6296 } 6297 } 6298 }; 6299 6300 _proto._activate = function _activate(target) { 6301 this._activeTarget = target; 6302 6303 this._clear(); 6304 6305 var queries = this._selector.split(',').map(function (selector) { 6306 return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]"; 6307 }); 6308 6309 var $link = $__default["default"]([].slice.call(document.querySelectorAll(queries.join(',')))); 6310 6311 if ($link.hasClass(CLASS_NAME_DROPDOWN_ITEM)) { 6312 $link.closest(SELECTOR_DROPDOWN$1).find(SELECTOR_DROPDOWN_TOGGLE$1).addClass(CLASS_NAME_ACTIVE$1); 6313 $link.addClass(CLASS_NAME_ACTIVE$1); 6314 } else { 6315 // Set triggered link as active 6316 $link.addClass(CLASS_NAME_ACTIVE$1); // Set triggered links parents as active 6317 // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor 6318 6319 $link.parents(SELECTOR_NAV_LIST_GROUP$1).prev(SELECTOR_NAV_LINKS + ", " + SELECTOR_LIST_ITEMS).addClass(CLASS_NAME_ACTIVE$1); // Handle special case when .nav-link is inside .nav-item 6320 6321 $link.parents(SELECTOR_NAV_LIST_GROUP$1).prev(SELECTOR_NAV_ITEMS).children(SELECTOR_NAV_LINKS).addClass(CLASS_NAME_ACTIVE$1); 6322 } 6323 6324 $__default["default"](this._scrollElement).trigger(EVENT_ACTIVATE, { 6325 relatedTarget: target 6326 }); 6327 }; 6328 6329 _proto._clear = function _clear() { 6330 [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) { 6331 return node.classList.contains(CLASS_NAME_ACTIVE$1); 6332 }).forEach(function (node) { 6333 return node.classList.remove(CLASS_NAME_ACTIVE$1); 6334 }); 6335 } // Static 6336 ; 6337 6338 ScrollSpy._jQueryInterface = function _jQueryInterface(config) { 6339 return this.each(function () { 6340 var data = $__default["default"](this).data(DATA_KEY$2); 6341 6342 var _config = typeof config === 'object' && config; 6343 6344 if (!data) { 6345 data = new ScrollSpy(this, _config); 6346 $__default["default"](this).data(DATA_KEY$2, data); 6347 } 6348 6349 if (typeof config === 'string') { 6350 if (typeof data[config] === 'undefined') { 6351 throw new TypeError("No method named \"" + config + "\""); 6352 } 6353 6354 data[config](); 6355 } 6356 }); 6357 }; 6358 6359 _createClass(ScrollSpy, null, [{ 6360 key: "VERSION", 6361 get: function get() { 6362 return VERSION$2; 6363 } 6364 }, { 6365 key: "Default", 6366 get: function get() { 6367 return Default$1; 6368 } 6369 }]); 6370 6371 return ScrollSpy; 6372 }(); 6373 /** 6374 * Data API implementation 6375 */ 6376 6377 6378 $__default["default"](window).on(EVENT_LOAD_DATA_API, function () { 6379 var scrollSpys = [].slice.call(document.querySelectorAll(SELECTOR_DATA_SPY)); 6380 var scrollSpysLength = scrollSpys.length; 6381 6382 for (var i = scrollSpysLength; i--;) { 6383 var $spy = $__default["default"](scrollSpys[i]); 6384 6385 ScrollSpy._jQueryInterface.call($spy, $spy.data()); 6386 } 6387 }); 6388 /** 6389 * jQuery 6390 */ 6391 6392 $__default["default"].fn[NAME$2] = ScrollSpy._jQueryInterface; 6393 $__default["default"].fn[NAME$2].Constructor = ScrollSpy; 6394 6395 $__default["default"].fn[NAME$2].noConflict = function () { 6396 $__default["default"].fn[NAME$2] = JQUERY_NO_CONFLICT$2; 6397 return ScrollSpy._jQueryInterface; 6398 }; 6399 6400 /** 6401 * Constants 6402 */ 6403 6404 var NAME$1 = 'tab'; 6405 var VERSION$1 = '4.6.1'; 6406 var DATA_KEY$1 = 'bs.tab'; 6407 var EVENT_KEY$1 = "." + DATA_KEY$1; 6408 var DATA_API_KEY = '.data-api'; 6409 var JQUERY_NO_CONFLICT$1 = $__default["default"].fn[NAME$1]; 6410 var CLASS_NAME_DROPDOWN_MENU = 'dropdown-menu'; 6411 var CLASS_NAME_ACTIVE = 'active'; 6412 var CLASS_NAME_DISABLED = 'disabled'; 6413 var CLASS_NAME_FADE$1 = 'fade'; 6414 var CLASS_NAME_SHOW$1 = 'show'; 6415 var EVENT_HIDE$1 = "hide" + EVENT_KEY$1; 6416 var EVENT_HIDDEN$1 = "hidden" + EVENT_KEY$1; 6417 var EVENT_SHOW$1 = "show" + EVENT_KEY$1; 6418 var EVENT_SHOWN$1 = "shown" + EVENT_KEY$1; 6419 var EVENT_CLICK_DATA_API = "click" + EVENT_KEY$1 + DATA_API_KEY; 6420 var SELECTOR_DROPDOWN = '.dropdown'; 6421 var SELECTOR_NAV_LIST_GROUP = '.nav, .list-group'; 6422 var SELECTOR_ACTIVE = '.active'; 6423 var SELECTOR_ACTIVE_UL = '> li > .active'; 6424 var SELECTOR_DATA_TOGGLE = '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]'; 6425 var SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle'; 6426 var SELECTOR_DROPDOWN_ACTIVE_CHILD = '> .dropdown-menu .active'; 6427 /** 6428 * Class definition 6429 */ 6430 6431 var Tab = /*#__PURE__*/function () { 6432 function Tab(element) { 6433 this._element = element; 6434 } // Getters 6435 6436 6437 var _proto = Tab.prototype; 6438 6439 // Public 6440 _proto.show = function show() { 6441 var _this = this; 6442 6443 if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $__default["default"](this._element).hasClass(CLASS_NAME_ACTIVE) || $__default["default"](this._element).hasClass(CLASS_NAME_DISABLED)) { 6444 return; 6445 } 6446 6447 var target; 6448 var previous; 6449 var listElement = $__default["default"](this._element).closest(SELECTOR_NAV_LIST_GROUP)[0]; 6450 var selector = Util.getSelectorFromElement(this._element); 6451 6452 if (listElement) { 6453 var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? SELECTOR_ACTIVE_UL : SELECTOR_ACTIVE; 6454 previous = $__default["default"].makeArray($__default["default"](listElement).find(itemSelector)); 6455 previous = previous[previous.length - 1]; 6456 } 6457 6458 var hideEvent = $__default["default"].Event(EVENT_HIDE$1, { 6459 relatedTarget: this._element 6460 }); 6461 var showEvent = $__default["default"].Event(EVENT_SHOW$1, { 6462 relatedTarget: previous 6463 }); 6464 6465 if (previous) { 6466 $__default["default"](previous).trigger(hideEvent); 6467 } 6468 6469 $__default["default"](this._element).trigger(showEvent); 6470 6471 if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) { 6472 return; 6473 } 6474 6475 if (selector) { 6476 target = document.querySelector(selector); 6477 } 6478 6479 this._activate(this._element, listElement); 6480 6481 var complete = function complete() { 6482 var hiddenEvent = $__default["default"].Event(EVENT_HIDDEN$1, { 6483 relatedTarget: _this._element 6484 }); 6485 var shownEvent = $__default["default"].Event(EVENT_SHOWN$1, { 6486 relatedTarget: previous 6487 }); 6488 $__default["default"](previous).trigger(hiddenEvent); 6489 $__default["default"](_this._element).trigger(shownEvent); 6490 }; 6491 6492 if (target) { 6493 this._activate(target, target.parentNode, complete); 6494 } else { 6495 complete(); 6496 } 6497 }; 6498 6499 _proto.dispose = function dispose() { 6500 $__default["default"].removeData(this._element, DATA_KEY$1); 6501 this._element = null; 6502 } // Private 6503 ; 6504 6505 _proto._activate = function _activate(element, container, callback) { 6506 var _this2 = this; 6507 6508 var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $__default["default"](container).find(SELECTOR_ACTIVE_UL) : $__default["default"](container).children(SELECTOR_ACTIVE); 6509 var active = activeElements[0]; 6510 var isTransitioning = callback && active && $__default["default"](active).hasClass(CLASS_NAME_FADE$1); 6511 6512 var complete = function complete() { 6513 return _this2._transitionComplete(element, active, callback); 6514 }; 6515 6516 if (active && isTransitioning) { 6517 var transitionDuration = Util.getTransitionDurationFromElement(active); 6518 $__default["default"](active).removeClass(CLASS_NAME_SHOW$1).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 6519 } else { 6520 complete(); 6521 } 6522 }; 6523 6524 _proto._transitionComplete = function _transitionComplete(element, active, callback) { 6525 if (active) { 6526 $__default["default"](active).removeClass(CLASS_NAME_ACTIVE); 6527 var dropdownChild = $__default["default"](active.parentNode).find(SELECTOR_DROPDOWN_ACTIVE_CHILD)[0]; 6528 6529 if (dropdownChild) { 6530 $__default["default"](dropdownChild).removeClass(CLASS_NAME_ACTIVE); 6531 } 6532 6533 if (active.getAttribute('role') === 'tab') { 6534 active.setAttribute('aria-selected', false); 6535 } 6536 } 6537 6538 $__default["default"](element).addClass(CLASS_NAME_ACTIVE); 6539 6540 if (element.getAttribute('role') === 'tab') { 6541 element.setAttribute('aria-selected', true); 6542 } 6543 6544 Util.reflow(element); 6545 6546 if (element.classList.contains(CLASS_NAME_FADE$1)) { 6547 element.classList.add(CLASS_NAME_SHOW$1); 6548 } 6549 6550 var parent = element.parentNode; 6551 6552 if (parent && parent.nodeName === 'LI') { 6553 parent = parent.parentNode; 6554 } 6555 6556 if (parent && $__default["default"](parent).hasClass(CLASS_NAME_DROPDOWN_MENU)) { 6557 var dropdownElement = $__default["default"](element).closest(SELECTOR_DROPDOWN)[0]; 6558 6559 if (dropdownElement) { 6560 var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(SELECTOR_DROPDOWN_TOGGLE)); 6561 $__default["default"](dropdownToggleList).addClass(CLASS_NAME_ACTIVE); 6562 } 6563 6564 element.setAttribute('aria-expanded', true); 6565 } 6566 6567 if (callback) { 6568 callback(); 6569 } 6570 } // Static 6571 ; 6572 6573 Tab._jQueryInterface = function _jQueryInterface(config) { 6574 return this.each(function () { 6575 var $this = $__default["default"](this); 6576 var data = $this.data(DATA_KEY$1); 6577 6578 if (!data) { 6579 data = new Tab(this); 6580 $this.data(DATA_KEY$1, data); 6581 } 6582 6583 if (typeof config === 'string') { 6584 if (typeof data[config] === 'undefined') { 6585 throw new TypeError("No method named \"" + config + "\""); 6586 } 6587 6588 data[config](); 6589 } 6590 }); 6591 }; 6592 6593 _createClass(Tab, null, [{ 6594 key: "VERSION", 6595 get: function get() { 6596 return VERSION$1; 6597 } 6598 }]); 6599 6600 return Tab; 6601 }(); 6602 /** 6603 * Data API implementation 6604 */ 6605 6606 6607 $__default["default"](document).on(EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) { 6608 event.preventDefault(); 6609 6610 Tab._jQueryInterface.call($__default["default"](this), 'show'); 6611 }); 6612 /** 6613 * jQuery 6614 */ 6615 6616 $__default["default"].fn[NAME$1] = Tab._jQueryInterface; 6617 $__default["default"].fn[NAME$1].Constructor = Tab; 6618 6619 $__default["default"].fn[NAME$1].noConflict = function () { 6620 $__default["default"].fn[NAME$1] = JQUERY_NO_CONFLICT$1; 6621 return Tab._jQueryInterface; 6622 }; 6623 6624 /** 6625 * Constants 6626 */ 6627 6628 var NAME = 'toast'; 6629 var VERSION = '4.6.1'; 6630 var DATA_KEY = 'bs.toast'; 6631 var EVENT_KEY = "." + DATA_KEY; 6632 var JQUERY_NO_CONFLICT = $__default["default"].fn[NAME]; 6633 var CLASS_NAME_FADE = 'fade'; 6634 var CLASS_NAME_HIDE = 'hide'; 6635 var CLASS_NAME_SHOW = 'show'; 6636 var CLASS_NAME_SHOWING = 'showing'; 6637 var EVENT_CLICK_DISMISS = "click.dismiss" + EVENT_KEY; 6638 var EVENT_HIDE = "hide" + EVENT_KEY; 6639 var EVENT_HIDDEN = "hidden" + EVENT_KEY; 6640 var EVENT_SHOW = "show" + EVENT_KEY; 6641 var EVENT_SHOWN = "shown" + EVENT_KEY; 6642 var SELECTOR_DATA_DISMISS = '[data-dismiss="toast"]'; 6643 var Default = { 6644 animation: true, 6645 autohide: true, 6646 delay: 500 6647 }; 6648 var DefaultType = { 6649 animation: 'boolean', 6650 autohide: 'boolean', 6651 delay: 'number' 6652 }; 6653 /** 6654 * Class definition 6655 */ 6656 6657 var Toast = /*#__PURE__*/function () { 6658 function Toast(element, config) { 6659 this._element = element; 6660 this._config = this._getConfig(config); 6661 this._timeout = null; 6662 6663 this._setListeners(); 6664 } // Getters 6665 6666 6667 var _proto = Toast.prototype; 6668 6669 // Public 6670 _proto.show = function show() { 6671 var _this = this; 6672 6673 var showEvent = $__default["default"].Event(EVENT_SHOW); 6674 $__default["default"](this._element).trigger(showEvent); 6675 6676 if (showEvent.isDefaultPrevented()) { 6677 return; 6678 } 6679 6680 this._clearTimeout(); 6681 6682 if (this._config.animation) { 6683 this._element.classList.add(CLASS_NAME_FADE); 6684 } 6685 6686 var complete = function complete() { 6687 _this._element.classList.remove(CLASS_NAME_SHOWING); 6688 6689 _this._element.classList.add(CLASS_NAME_SHOW); 6690 6691 $__default["default"](_this._element).trigger(EVENT_SHOWN); 6692 6693 if (_this._config.autohide) { 6694 _this._timeout = setTimeout(function () { 6695 _this.hide(); 6696 }, _this._config.delay); 6697 } 6698 }; 6699 6700 this._element.classList.remove(CLASS_NAME_HIDE); 6701 6702 Util.reflow(this._element); 6703 6704 this._element.classList.add(CLASS_NAME_SHOWING); 6705 6706 if (this._config.animation) { 6707 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 6708 $__default["default"](this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 6709 } else { 6710 complete(); 6711 } 6712 }; 6713 6714 _proto.hide = function hide() { 6715 if (!this._element.classList.contains(CLASS_NAME_SHOW)) { 6716 return; 6717 } 6718 6719 var hideEvent = $__default["default"].Event(EVENT_HIDE); 6720 $__default["default"](this._element).trigger(hideEvent); 6721 6722 if (hideEvent.isDefaultPrevented()) { 6723 return; 6724 } 6725 6726 this._close(); 6727 }; 6728 6729 _proto.dispose = function dispose() { 6730 this._clearTimeout(); 6731 6732 if (this._element.classList.contains(CLASS_NAME_SHOW)) { 6733 this._element.classList.remove(CLASS_NAME_SHOW); 6734 } 6735 6736 $__default["default"](this._element).off(EVENT_CLICK_DISMISS); 6737 $__default["default"].removeData(this._element, DATA_KEY); 6738 this._element = null; 6739 this._config = null; 6740 } // Private 6741 ; 6742 6743 _proto._getConfig = function _getConfig(config) { 6744 config = _extends({}, Default, $__default["default"](this._element).data(), typeof config === 'object' && config ? config : {}); 6745 Util.typeCheckConfig(NAME, config, this.constructor.DefaultType); 6746 return config; 6747 }; 6748 6749 _proto._setListeners = function _setListeners() { 6750 var _this2 = this; 6751 6752 $__default["default"](this._element).on(EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, function () { 6753 return _this2.hide(); 6754 }); 6755 }; 6756 6757 _proto._close = function _close() { 6758 var _this3 = this; 6759 6760 var complete = function complete() { 6761 _this3._element.classList.add(CLASS_NAME_HIDE); 6762 6763 $__default["default"](_this3._element).trigger(EVENT_HIDDEN); 6764 }; 6765 6766 this._element.classList.remove(CLASS_NAME_SHOW); 6767 6768 if (this._config.animation) { 6769 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 6770 $__default["default"](this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 6771 } else { 6772 complete(); 6773 } 6774 }; 6775 6776 _proto._clearTimeout = function _clearTimeout() { 6777 clearTimeout(this._timeout); 6778 this._timeout = null; 6779 } // Static 6780 ; 6781 6782 Toast._jQueryInterface = function _jQueryInterface(config) { 6783 return this.each(function () { 6784 var $element = $__default["default"](this); 6785 var data = $element.data(DATA_KEY); 6786 6787 var _config = typeof config === 'object' && config; 6788 6789 if (!data) { 6790 data = new Toast(this, _config); 6791 $element.data(DATA_KEY, data); 6792 } 6793 6794 if (typeof config === 'string') { 6795 if (typeof data[config] === 'undefined') { 6796 throw new TypeError("No method named \"" + config + "\""); 6797 } 6798 6799 data[config](this); 6800 } 6801 }); 6802 }; 6803 6804 _createClass(Toast, null, [{ 6805 key: "VERSION", 6806 get: function get() { 6807 return VERSION; 6808 } 6809 }, { 6810 key: "DefaultType", 6811 get: function get() { 6812 return DefaultType; 6813 } 6814 }, { 6815 key: "Default", 6816 get: function get() { 6817 return Default; 6818 } 6819 }]); 6820 6821 return Toast; 6822 }(); 6823 /** 6824 * jQuery 6825 */ 6826 6827 6828 $__default["default"].fn[NAME] = Toast._jQueryInterface; 6829 $__default["default"].fn[NAME].Constructor = Toast; 6830 6831 $__default["default"].fn[NAME].noConflict = function () { 6832 $__default["default"].fn[NAME] = JQUERY_NO_CONFLICT; 6833 return Toast._jQueryInterface; 6834 }; 6835 6836 exports.Alert = Alert; 6837 exports.Button = Button; 6838 exports.Carousel = Carousel; 6839 exports.Collapse = Collapse; 6840 exports.Dropdown = Dropdown; 6841 exports.Modal = Modal; 6842 exports.Popover = Popover; 6843 exports.Scrollspy = ScrollSpy; 6844 exports.Tab = Tab; 6845 exports.Toast = Toast; 6846 exports.Tooltip = Tooltip; 6847 exports.Util = Util; 6848 6849 Object.defineProperty(exports, '__esModule', { value: true }); 6850 6851})); 6852//# sourceMappingURL=bootstrap.js.map 6853 6854 6855/***/ }), 6856
vendor: 5,913 bytes, lines 6857-6871
6857/***/ "./node_modules/countup.js/dist/countUp.min.js": 6858/*!*****************************************************!*\ 6859 !*** ./node_modules/countup.js/dist/countUp.min.js ***! 6860 \*****************************************************/ 6861/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 6862 6863"use strict"; 6864__webpack_require__.r(__webpack_exports__); 6865/* harmony export */ __webpack_require__.d(__webpack_exports__, { 6866/* harmony export */ "CountUp": () => (/* binding */ CountUp) 6867/* harmony export */ }); 6868var __assign=undefined&&undefined.__assign||function(){return(__assign=Object.assign||function(t){for(var i,n=1,a=arguments.length;n<a;n++)for(var s in i=arguments[n])Object.prototype.hasOwnProperty.call(i,s)&&(t[s]=i[s]);return t}).apply(this,arguments)},CountUp=function(){function t(t,i,n){var a=this;this.endVal=i,this.options=n,this.version="2.2.0",this.defaults={startVal:0,decimalPlaces:0,duration:2,useEasing:!0,useGrouping:!0,smartEasingThreshold:999,smartEasingAmount:333,separator:",",decimal:".",prefix:"",suffix:"",enableScrollSpy:!1,scrollSpyDelay:200,scrollSpyOnce:!1},this.finalEndVal=null,this.useEasing=!0,this.countDown=!1,this.error="",this.startVal=0,this.paused=!0,this.once=!1,this.count=function(t){a.startTime||(a.startTime=t);var i=t-a.startTime;a.remaining=a.duration-i,a.useEasing?a.countDown?a.frameVal=a.startVal-a.easingFn(i,0,a.startVal-a.endVal,a.duration):a.frameVal=a.easingFn(i,a.startVal,a.endVal-a.startVal,a.duration):a.countDown?a.frameVal=a.startVal-(a.startVal-a.endVal)*(i/a.duration):a.frameVal=a.startVal+(a.endVal-a.startVal)*(i/a.duration),a.countDown?a.frameVal=a.frameVal<a.endVal?a.endVal:a.frameVal:a.frameVal=a.frameVal>a.endVal?a.endVal:a.frameVal,a.frameVal=Number(a.frameVal.toFixed(a.options.decimalPlaces)),a.printValue(a.frameVal),i<a.duration?a.rAF=requestAnimationFrame(a.count):null!==a.finalEndVal?a.update(a.finalEndVal):a.callback&&a.callback()},this.formatNumber=function(t){var i,n,s,e,r=t<0?"-":"";i=Math.abs(t).toFixed(a.options.decimalPlaces);var o=(i+="").split(".");if(n=o[0],s=o.length>1?a.options.decimal+o[1]:"",a.options.useGrouping){e="";for(var l=0,h=n.length;l<h;++l)0!==l&&l%3==0&&(e=a.options.separator+e),e=n[h-l-1]+e;n=e}return a.options.numerals&&a.options.numerals.length&&(n=n.replace(/[0-9]/g,function(t){return a.options.numerals[+t]}),s=s.replace(/[0-9]/g,function(t){return a.options.numerals[+t]})),r+a.options.prefix+n+s+a.options.suffix},this.easeOutExpo=function(t,i,n,a){return n*(1-Math.pow(2,-10*t/a))*1024/1023+i},this.options=__assign(__assign({},this.defaults),n),this.formattingFn=this.options.formattingFn?this.options.formattingFn:this.formatNumber,this.easingFn=this.options.easingFn?this.options.easingFn:this.easeOutExpo,this.startVal=this.validateValue(this.options.startVal),this.frameVal=this.startVal,this.endVal=this.validateValue(i),this.options.decimalPlaces=Math.max(this.options.decimalPlaces),this.resetDuration(),this.options.separator=String(this.options.separator),this.useEasing=this.options.useEasing,""===this.options.separator&&(this.options.useGrouping=!1),this.el="string"==typeof t?document.getElementById(t):t,this.el?this.printValue(this.startVal):this.error="[CountUp] target is null or undefined",void 0!==window&&this.options.enableScrollSpy&&(this.error?console.error(this.error,t):(window.onScrollFns=window.onScrollFns||[],window.onScrollFns.push(function(){return a.handleScroll(a)}),window.onscroll=function(){window.onScrollFns.forEach(function(t){return t()})},this.handleScroll(this)))}return t.prototype.handleScroll=function(t){if(t&&window&&!t.once){var i=window.innerHeight+window.scrollY,n=t.el.offsetTop+t.el.offsetHeight;n<i&&n>window.scrollY&&t.paused?(t.paused=!1,setTimeout(function(){return t.start()},t.options.scrollSpyDelay),t.options.scrollSpyOnce&&(t.once=!0)):window.scrollY>n&&!t.paused&&t.reset()}},t.prototype.determineDirectionAndSmartEasing=function(){var t=this.finalEndVal?this.finalEndVal:this.endVal;this.countDown=this.startVal>t;var i=t-this.startVal;if(Math.abs(i)>this.options.smartEasingThreshold){this.finalEndVal=t;var n=this.countDown?1:-1;this.endVal=t+n*this.options.smartEasingAmount,this.duration=this.duration/2}else this.endVal=t,this.finalEndVal=null;this.finalEndVal?this.useEasing=!1:this.useEasing=this.options.useEasing},t.prototype.start=function(t){this.error||(this.callback=t,this.duration>0?(this.determineDirectionAndSmartEasing(),this.paused=!1,this.rAF=requestAnimationFrame(this.count)):this.printValue(this.endVal))},t.prototype.pauseResume=function(){this.paused?(this.startTime=null,this.duration=this.remaining,this.startVal=this.frameVal,this.determineDirectionAndSmartEasing(),this.rAF=requestAnimationFrame(this.count)):cancelAnimationFrame(this.rAF),this.paused=!this.paused},t.prototype.reset=function(){cancelAnimationFrame(this.rAF),this.paused=!0,this.resetDuration(),this.startVal=this.validateValue(this.options.startVal),this.frameVal=this.startVal,this.printValue(this.startVal)},t.prototype.update=function(t){cancelAnimationFrame(this.rAF),this.startTime=null,this.endVal=this.validateValue(t),this.endVal!==this.frameVal&&(this.startVal=this.frameVal,this.finalEndVal||this.resetDuration(),this.finalEndVal=null,this.determineDirectionAndSmartEasing(),this.rAF=requestAnimationFrame(this.count))},t.prototype.printValue=function(t){var i=this.formattingFn(t);"INPUT"===this.el.tagName?this.el.value=i:"text"===this.el.tagName||"tspan"===this.el.tagName?this.el.textContent=i:this.el.innerHTML=i},t.prototype.ensureNumber=function(t){return"number"==typeof t&&!isNaN(t)},t.prototype.validateValue=function(t){var i=Number(t);return this.ensureNumber(i)?i:(this.error="[CountUp] invalid start or end value: ".concat(t),null)},t.prototype.resetDuration=function(){this.startTime=null,this.duration=1e3*Number(this.options.duration),this.remaining=this.duration},t}(); 6869 6870/***/ }), 6871
vendor: 353 bytes, lines 6872-6882
6872/***/ "./node_modules/granim/index.js": 6873/*!**************************************!*\ 6874 !*** ./node_modules/granim/index.js ***! 6875 \**************************************/ 6876/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 6877 6878module.exports = __webpack_require__(/*! ./lib/Granim.js */ "./node_modules/granim/lib/Granim.js"); 6879 6880 6881/***/ }), 6882
vendor: 6,938 bytes, lines 6883-7021
6883/***/ "./node_modules/granim/lib/Granim.js": 6884/*!*******************************************!*\ 6885 !*** ./node_modules/granim/lib/Granim.js ***! 6886 \*******************************************/ 6887/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 6888 6889"use strict"; 6890 6891 6892function Granim(options) { 6893 this.getElement(options.element); 6894 this.x1 = 0; 6895 this.y1 = 0; 6896 this.name = options.name || false; 6897 this.elToSetClassOn = options.elToSetClassOn || 'body'; 6898 this.direction = options.direction || 'diagonal'; 6899 this.customDirection = options.customDirection || {}; 6900 this.validateInput('direction'); 6901 this.isPausedWhenNotInView = options.isPausedWhenNotInView || false; 6902 this.states = options.states; 6903 this.stateTransitionSpeed = options.stateTransitionSpeed || 1000; 6904 this.previousTimeStamp = null; 6905 this.progress = 0; 6906 this.isPaused = false; 6907 this.isCleared = false; 6908 this.isPausedBecauseNotInView = false; 6909 this.context = this.canvas.getContext('2d'); 6910 this.channels = {}; 6911 this.channelsIndex = 0; 6912 this.activeState = options.defaultStateName || 'default-state'; 6913 this.isChangingState = false; 6914 this.currentColors = []; 6915 this.currentColorsPos = []; 6916 this.activetransitionSpeed = null; 6917 this.eventPolyfill(); 6918 this.scrollDebounceThreshold = options.scrollDebounceThreshold || 300; 6919 this.scrollDebounceTimeout = null; 6920 this.isImgLoaded = false; 6921 this.isCanvasInWindowView = false; 6922 this.firstScrollInit = true; 6923 this.animating = false; 6924 this.gradientLength = this.states[this.activeState].gradients[0].length; 6925 if (options.image && options.image.source) { 6926 this.image = { 6927 source: options.image.source, 6928 position: options.image.position || ['center', 'center'], 6929 stretchMode: options.image.stretchMode || false, 6930 blendingMode: options.image.blendingMode || false 6931 }; 6932 } 6933 this.events = { 6934 start: new CustomEvent('granim:start'), 6935 end: new CustomEvent('granim:end'), 6936 gradientChange: function(details) { 6937 return new CustomEvent('granim:gradientChange', { 6938 detail: { 6939 isLooping: details.isLooping, 6940 colorsFrom: details.colorsFrom, 6941 colorsTo: details.colorsTo, 6942 activeState: details.activeState 6943 }, 6944 bubbles: false, 6945 cancelable: false 6946 }); 6947 } 6948 }; 6949 this.callbacks = { 6950 onStart: typeof options.onStart === 'function' ? options.onStart : false, 6951 onGradientChange: typeof options.onGradientChange === 'function' ? 6952 options.onGradientChange : 6953 false, 6954 onEnd: typeof options.onEnd === 'function' ? options.onEnd : false 6955 }; 6956 this.getDimensions(); 6957 this.canvas.setAttribute('width', this.x1); 6958 this.canvas.setAttribute('height', this.y1); 6959 this.setColors(); 6960 6961 if (this.image) { 6962 this.validateInput('image'); 6963 this.prepareImage(); 6964 } 6965 6966 this.pauseWhenNotInViewNameSpace = this.pauseWhenNotInView.bind(this); 6967 this.setSizeAttributesNameSpace = this.setSizeAttributes.bind(this); 6968 this.onResize(); 6969 6970 if (this.isPausedWhenNotInView) { 6971 this.onScroll(); 6972 6973 } else { 6974 if (!this.image) { 6975 this.refreshColorsAndPos(); 6976 this.animation = requestAnimationFrame(this.animateColors.bind(this)); 6977 this.animating = true; 6978 } 6979 } 6980 6981 // Callback and Event 6982 if (this.callbacks.onStart) this.callbacks.onStart(); 6983 this.canvas.dispatchEvent(this.events.start); 6984} 6985 6986Granim.prototype.animateColors = __webpack_require__(/*! ./animateColors.js */ "./node_modules/granim/lib/animateColors.js"); 6987Granim.prototype.changeBlendingMode = __webpack_require__(/*! ./changeBlendingMode.js */ "./node_modules/granim/lib/changeBlendingMode.js"); 6988Granim.prototype.changeDirection = __webpack_require__(/*! ./changeDirection.js */ "./node_modules/granim/lib/changeDirection.js"); 6989Granim.prototype.changeState = __webpack_require__(/*! ./changeState.js */ "./node_modules/granim/lib/changeState.js"); 6990Granim.prototype.clear = __webpack_require__(/*! ./clear.js */ "./node_modules/granim/lib/clear.js"); 6991Granim.prototype.convertColorToRgba = __webpack_require__(/*! ./convertColorToRgba.js */ "./node_modules/granim/lib/convertColorToRgba.js"); 6992Granim.prototype.destroy = __webpack_require__(/*! ./destroy.js */ "./node_modules/granim/lib/destroy.js"); 6993Granim.prototype.eventPolyfill = __webpack_require__(/*! ./eventPolyfill.js */ "./node_modules/granim/lib/eventPolyfill.js"); 6994Granim.prototype.getColor = __webpack_require__(/*! ./getColor.js */ "./node_modules/granim/lib/getColor.js"); 6995Granim.prototype.getColorDiff = __webpack_require__(/*! ./getColorDiff.js */ "./node_modules/granim/lib/getColorDiff.js"); 6996Granim.prototype.getColorPos = __webpack_require__(/*! ./getColorPos.js */ "./node_modules/granim/lib/getColorPos.js"); 6997Granim.prototype.getColorPosDiff = __webpack_require__(/*! ./getColorPosDiff.js */ "./node_modules/granim/lib/getColorPosDiff.js"); 6998Granim.prototype.getCurrentColors = __webpack_require__(/*! ./getCurrentColors.js */ "./node_modules/granim/lib/getCurrentColors.js"); 6999Granim.prototype.getCurrentColorsPos = __webpack_require__(/*! ./getCurrentColorsPos.js */ "./node_modules/granim/lib/getCurrentColorsPos.js"); 7000Granim.prototype.getDimensions = __webpack_require__(/*! ./getDimensions.js */ "./node_modules/granim/lib/getDimensions.js"); 7001Granim.prototype.getElement = __webpack_require__(/*! ./getElement.js */ "./node_modules/granim/lib/getElement.js"); 7002Granim.prototype.getLightness = __webpack_require__(/*! ./getLightness.js */ "./node_modules/granim/lib/getLightness.js"); 7003Granim.prototype.makeGradient = __webpack_require__(/*! ./makeGradient.js */ "./node_modules/granim/lib/makeGradient.js"); 7004Granim.prototype.onResize = __webpack_require__(/*! ./onResize.js */ "./node_modules/granim/lib/onResize.js"); 7005Granim.prototype.onScroll = __webpack_require__(/*! ./onScroll.js */ "./node_modules/granim/lib/onScroll.js"); 7006Granim.prototype.pause = __webpack_require__(/*! ./pause.js */ "./node_modules/granim/lib/pause.js"); 7007Granim.prototype.pauseWhenNotInView = __webpack_require__(/*! ./pauseWhenNotInView.js */ "./node_modules/granim/lib/pauseWhenNotInView.js"); 7008Granim.prototype.play = __webpack_require__(/*! ./play.js */ "./node_modules/granim/lib/play.js"); 7009Granim.prototype.prepareImage = __webpack_require__(/*! ./prepareImage.js */ "./node_modules/granim/lib/prepareImage.js"); 7010Granim.prototype.refreshColorsAndPos = __webpack_require__(/*! ./refreshColorsAndPos.js */ "./node_modules/granim/lib/refreshColorsAndPos.js"); 7011Granim.prototype.setColors = __webpack_require__(/*! ./setColors.js */ "./node_modules/granim/lib/setColors.js"); 7012Granim.prototype.setDirection = __webpack_require__(/*! ./setDirection.js */ "./node_modules/granim/lib/setDirection.js"); 7013Granim.prototype.setSizeAttributes = __webpack_require__(/*! ./setSizeAttributes.js */ "./node_modules/granim/lib/setSizeAttributes.js"); 7014Granim.prototype.triggerError = __webpack_require__(/*! ./triggerError.js */ "./node_modules/granim/lib/triggerError.js"); 7015Granim.prototype.validateInput = __webpack_require__(/*! ./validateInput.js */ "./node_modules/granim/lib/validateInput.js"); 7016 7017module.exports = Granim; 7018 7019 7020/***/ }), 7021
vendor: 3,347 bytes, lines 7022-7117
7022/***/ "./node_modules/granim/lib/animateColors.js": 7023/*!**************************************************!*\ 7024 !*** ./node_modules/granim/lib/animateColors.js ***! 7025 \**************************************************/ 7026/***/ ((module) => { 7027 7028"use strict"; 7029 7030 7031module.exports = function(timestamp) { 7032 var wasWindowIdled = timestamp - this.previousTimeStamp > 100; 7033 var isLoop = this.states[this.activeState].loop !== undefined ? this.states[this.activeState].loop : true; 7034 var progressPercent, isLooping, nextGradient; 7035 7036 // If tab was inactive then resumed, reset the previous timestamp 7037 if (this.previousTimeStamp === null || wasWindowIdled) { 7038 this.previousTimeStamp = timestamp; 7039 } 7040 7041 // Compute progress and save the timestamp 7042 this.progress = this.progress + (timestamp - this.previousTimeStamp); 7043 progressPercent = (this.progress / this.activetransitionSpeed * 100).toFixed(2); 7044 this.previousTimeStamp = timestamp; 7045 7046 // Set the new gradient colors in a property 7047 this.refreshColorsAndPos(progressPercent); 7048 7049 // Continue the animation or prepare for the next one 7050 if (progressPercent < 100) { 7051 this.animation = requestAnimationFrame(this.animateColors.bind(this)); 7052 7053 } else { 7054 // if the current animation index is inferior to the penultimate gradient 7055 // or to the last gradient with the loop mode activated 7056 if (this.channelsIndex < this.states[this.activeState].gradients.length - 2 || isLoop) { 7057 7058 // Set the active transition speed to the active state one after changing state 7059 if (this.isChangingState) { 7060 this.activetransitionSpeed = this.states[this.activeState].transitionSpeed || 5000; 7061 this.isChangingState = false; 7062 } 7063 7064 // Resetting properties 7065 this.previousTimeStamp = null; 7066 this.progress = 0; 7067 this.channelsIndex++; 7068 isLooping = false; 7069 7070 // If it's going to loop or if it's the transition after the loop 7071 if (this.channelsIndex === this.states[this.activeState].gradients.length - 1) { 7072 isLooping = true; 7073 7074 } else if (this.channelsIndex === this.states[this.activeState].gradients.length) { 7075 this.channelsIndex = 0; 7076 } 7077 7078 // Checking the next gradient to send in args of an event and a callback 7079 nextGradient = this.states[this.activeState].gradients[this.channelsIndex + 1] === undefined ? 7080 this.states[this.activeState].gradients[0] : 7081 this.states[this.activeState].gradients[this.channelsIndex + 1]; 7082 7083 // Compute the colors for the transition and render a new frame 7084 this.setColors(); 7085 this.animation = requestAnimationFrame(this.animateColors.bind(this)); 7086 7087 // Callback and Event 7088 if (this.callbacks.onGradientChange) { 7089 this.callbacks.onGradientChange({ 7090 isLooping: isLooping, 7091 colorsFrom: this.states[this.activeState].gradients[this.channelsIndex], 7092 colorsTo: nextGradient, 7093 activeState: this.activeState 7094 }); 7095 } 7096 7097 this.canvas.dispatchEvent(this.events.gradientChange({ 7098 isLooping: isLooping, 7099 colorsFrom: this.states[this.activeState].gradients[this.channelsIndex], 7100 colorsTo: nextGradient, 7101 activeState: this.activeState 7102 })); 7103 7104 // Else if it was the last gradient on the list and the loop mode is off 7105 } else { 7106 cancelAnimationFrame(this.animation); 7107 7108 // Callback and Event 7109 if (this.callbacks.onEnd) this.callbacks.onEnd(); 7110 this.canvas.dispatchEvent(new CustomEvent('granim:end')); 7111 } 7112 } 7113}; 7114 7115 7116/***/ }), 7117
vendor: 558 bytes, lines 7118-7137
7118/***/ "./node_modules/granim/lib/changeBlendingMode.js": 7119/*!*******************************************************!*\ 7120 !*** ./node_modules/granim/lib/changeBlendingMode.js ***! 7121 \*******************************************************/ 7122/***/ ((module) => { 7123 7124"use strict"; 7125 7126 7127module.exports = function(newBlendingMode) { 7128 this.context.clearRect(0, 0, this.x1, this.y1); 7129 this.context.globalCompositeOperation = 7130 this.image.blendingMode = newBlendingMode; 7131 this.validateInput('blendingMode'); 7132 if (this.isPaused) this.refreshColorsAndPos(); 7133}; 7134 7135 7136/***/ }), 7137
vendor: 486 bytes, lines 7138-7156
7138/***/ "./node_modules/granim/lib/changeDirection.js": 7139/*!****************************************************!*\ 7140 !*** ./node_modules/granim/lib/changeDirection.js ***! 7141 \****************************************************/ 7142/***/ ((module) => { 7143 7144"use strict"; 7145 7146 7147module.exports = function(newDirection) { 7148 this.context.clearRect(0, 0, this.x1, this.y1); 7149 this.direction = newDirection; 7150 this.validateInput('direction'); 7151 if (this.isPaused) this.refreshColorsAndPos(); 7152}; 7153 7154 7155/***/ }), 7156
vendor: 1,512 bytes, lines 7157-7208
7157/***/ "./node_modules/granim/lib/changeState.js": 7158/*!************************************************!*\ 7159 !*** ./node_modules/granim/lib/changeState.js ***! 7160 \************************************************/ 7161/***/ ((module) => { 7162 7163"use strict"; 7164 7165 7166module.exports = function(newState) { 7167 var _this = this; 7168 7169 // Prevent transitioning to the same state 7170 if (this.activeState === newState) { 7171 return; 7172 } 7173 7174 // Setting the good properties for the transition 7175 if (!this.isPaused) { 7176 this.isPaused = true; 7177 this.pause(); 7178 } 7179 7180 this.channelsIndex = -1; 7181 this.activetransitionSpeed = this.stateTransitionSpeed; 7182 this.activeColorsDiff = []; 7183 this.activeColorsPosDiff = []; 7184 this.activeColors = this.getCurrentColors(); 7185 this.activeColorsPos = this.getCurrentColorsPos(); 7186 this.progress = 0; 7187 this.previousTimeStamp = null; 7188 this.isChangingState = true; 7189 7190 // Compute the gradient color and pos diff between the last frame gradient 7191 // and the first one of the new state 7192 this.states[newState].gradients[0].forEach(function(gradientColor, i, arr) { 7193 var nextColors = _this.convertColorToRgba(_this.getColor(gradientColor)); 7194 var nextColorsPos = _this.getColorPos(gradientColor, i); 7195 var colorDiff = _this.getColorDiff(_this.activeColors[i], nextColors); 7196 var colorPosDiff = _this.getColorPosDiff(_this.activeColorsPos[i], nextColorsPos); 7197 _this.activeColorsDiff.push(colorDiff); 7198 _this.activeColorsPosDiff.push(colorPosDiff); 7199 }); 7200 7201 // Start the animation 7202 this.activeState = newState; 7203 this.play(); 7204}; 7205 7206 7207/***/ }), 7208
vendor: 446 bytes, lines 7209-7231
7209/***/ "./node_modules/granim/lib/clear.js": 7210/*!******************************************!*\ 7211 !*** ./node_modules/granim/lib/clear.js ***! 7212 \******************************************/ 7213/***/ ((module) => { 7214 7215"use strict"; 7216 7217 7218module.exports = function() { 7219 if (!this.isPaused) { 7220 cancelAnimationFrame(this.animation); 7221 7222 } else { 7223 this.isPaused = false; 7224 } 7225 this.isCleared = true; 7226 this.context.clearRect(0, 0, this.x1, this.y1); 7227}; 7228 7229 7230/***/ }), 7231
vendor: 2,551 bytes, lines 7232-7341
7232/***/ "./node_modules/granim/lib/convertColorToRgba.js": 7233/*!*******************************************************!*\ 7234 !*** ./node_modules/granim/lib/convertColorToRgba.js ***! 7235 \*******************************************************/ 7236/***/ ((module) => { 7237 7238"use strict"; 7239 7240 7241var regex = { 7242 hexa: /^#(?:[0-9a-fA-F]{3}){1,2}$/, 7243 rgba: /^rgba\((\d{1,3}), ?(\d{1,3}), ?(\d{1,3}), ?(.?\d{1,3})\)$/, 7244 rgb: /^rgb\((\d{1,3}), ?(\d{1,3}), ?(\d{1,3})\)$/, 7245 hsla: /^hsla\((\d{1,3}), ?(\d{1,3})%, ?(\d{1,3})%, ?(.?\d{1,3})\)$/, 7246 hsl: /^hsl\((\d{1,3}), ?(\d{1,3})%, ?(\d{1,3})%\)$/ 7247}, match; 7248 7249module.exports = function(color) { 7250 switch(identifyColorType(color)) { 7251 default: 7252 this.triggerError('colorType'); 7253 7254 case 'hexa': 7255 return hexToRgba(color); 7256 7257 case 'rgba': 7258 return [ 7259 parseInt(match[1], 10), 7260 parseInt(match[2], 10), 7261 parseInt(match[3], 10), 7262 parseFloat(match[4]) 7263 ]; 7264 7265 case 'rgb': 7266 return [ 7267 parseInt(match[1], 10), 7268 parseInt(match[2], 10), 7269 parseInt(match[3], 10), 7270 1 7271 ]; 7272 7273 case 'hsla': 7274 return hslaToRgb( 7275 parseInt(match[1], 10) / 360, 7276 parseInt(match[2], 10) / 100, 7277 parseInt(match[3], 10) / 100, 7278 parseFloat(match[4]) 7279 ); 7280 7281 case 'hsl': 7282 return hslaToRgb( 7283 parseInt(match[1], 10) / 360, 7284 parseInt(match[2], 10) / 100, 7285 parseInt(match[3], 10) / 100, 7286 1 7287 ); 7288 } 7289}; 7290 7291function identifyColorType(color) { 7292 var colorTypes = Object.keys(regex); 7293 var i = 0; 7294 for (i; i < colorTypes.length; i++) { 7295 match = regex[colorTypes[i]].exec(color); 7296 if (match) return colorTypes[i]; 7297 } 7298 return false; 7299} 7300 7301function hexToRgba(hex) { 7302 // Expand shorthand form (e.g. '03F') to full form (e.g. '0033FF') 7303 var shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i; 7304 hex = hex.replace(shorthandRegex, function(m, r, g, b) { 7305 return r + r + g + g + b + b; 7306 }); 7307 var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); 7308 return result ? [ 7309 parseInt(result[1], 16), 7310 parseInt(result[2], 16), 7311 parseInt(result[3], 16), 7312 1 7313 ] : null; 7314} 7315 7316function hue2rgb(p, q, t) { 7317 if (t < 0) t += 1; 7318 if (t > 1) t -= 1; 7319 if (t < 1 / 6) return p + (q - p) * 6 * t; 7320 if (t < 1 / 2) return q; 7321 if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6; 7322 return p; 7323} 7324 7325function hslaToRgb(h, s, l, a) { 7326 var r, g, b, q, p; 7327 if (s === 0) { 7328 r = g = b = l; // achromatic 7329 } else { 7330 q = l < 0.5 ? l * (1 + s) : l + s - l * s; 7331 p = 2 * l - q; 7332 r = hue2rgb(p, q, h + 1/3); 7333 g = hue2rgb(p, q, h); 7334 b = hue2rgb(p, q, h - 1/3); 7335 } 7336 return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255), a]; 7337} 7338 7339 7340/***/ }), 7341
vendor: 364 bytes, lines 7342-7359
7342/***/ "./node_modules/granim/lib/destroy.js": 7343/*!********************************************!*\ 7344 !*** ./node_modules/granim/lib/destroy.js ***! 7345 \********************************************/ 7346/***/ ((module) => { 7347 7348"use strict"; 7349 7350 7351module.exports = function() { 7352 this.onResize('removeListeners'); 7353 this.onScroll('removeListeners'); 7354 this.clear(); 7355}; 7356 7357 7358/***/ }), 7359
vendor: 711 bytes, lines 7360-7386
7360/***/ "./node_modules/granim/lib/eventPolyfill.js": 7361/*!**************************************************!*\ 7362 !*** ./node_modules/granim/lib/eventPolyfill.js ***! 7363 \**************************************************/ 7364/***/ ((module) => { 7365 7366"use strict"; 7367 7368 7369module.exports = function() { 7370 if ( typeof window.CustomEvent === 'function' ) return; 7371 7372 function CustomEvent(event, params) { 7373 params = params || { bubbles: false, cancelable: false, detail: undefined }; 7374 var evt = document.createEvent('CustomEvent'); 7375 evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail); 7376 return evt; 7377 } 7378 7379 CustomEvent.prototype = window.Event.prototype; 7380 7381 window.CustomEvent = CustomEvent; 7382}; 7383 7384 7385/***/ }), 7386
vendor: 518 bytes, lines 7387-7410
7387/***/ "./node_modules/granim/lib/getColor.js": 7388/*!*********************************************!*\ 7389 !*** ./node_modules/granim/lib/getColor.js ***! 7390 \*********************************************/ 7391/***/ ((module) => { 7392 7393"use strict"; 7394 7395 7396module.exports = function(gradientColor) { 7397 if (typeof gradientColor === 'string') { 7398 return gradientColor; 7399 7400 } else if (typeof gradientColor === 'object' && gradientColor.color) { 7401 return gradientColor.color; 7402 7403 } else { 7404 this.triggerError('gradient.color'); 7405 } 7406}; 7407 7408 7409/***/ }), 7410
vendor: 434 bytes, lines 7411-7433
7411/***/ "./node_modules/granim/lib/getColorDiff.js": 7412/*!*************************************************!*\ 7413 !*** ./node_modules/granim/lib/getColorDiff.js ***! 7414 \*************************************************/ 7415/***/ ((module) => { 7416 7417"use strict"; 7418 7419 7420module.exports = function(colorA, colorB) { 7421 var i = 0; 7422 var colorDiff = []; 7423 7424 for (i; i < 4; i++) { 7425 colorDiff.push(colorB[i] - colorA[i]); 7426 } 7427 7428 return colorDiff; 7429}; 7430 7431 7432/***/ }), 7433
vendor: 548 bytes, lines 7434-7455
7434/***/ "./node_modules/granim/lib/getColorPos.js": 7435/*!************************************************!*\ 7436 !*** ./node_modules/granim/lib/getColorPos.js ***! 7437 \************************************************/ 7438/***/ ((module) => { 7439 7440"use strict"; 7441 7442 7443module.exports = function(gradientColor, i) { 7444 if (typeof gradientColor === 'object' && gradientColor.pos) { 7445 return gradientColor.pos; 7446 7447 } else { 7448 // Ensure first and last position to be 0 and 100 7449 return parseFloat(!i ? 0 : ((1 / (this.gradientLength - 1)) * i).toFixed(2)); 7450 } 7451}; 7452 7453 7454/***/ }), 7455
vendor: 342 bytes, lines 7456-7471
7456/***/ "./node_modules/granim/lib/getColorPosDiff.js": 7457/*!****************************************************!*\ 7458 !*** ./node_modules/granim/lib/getColorPosDiff.js ***! 7459 \****************************************************/ 7460/***/ ((module) => { 7461 7462"use strict"; 7463 7464 7465module.exports = function(posA, posB) { 7466 return posB - posA; 7467}; 7468 7469 7470/***/ }), 7471
vendor: 586 bytes, lines 7472-7499
7472/***/ "./node_modules/granim/lib/getCurrentColors.js": 7473/*!*****************************************************!*\ 7474 !*** ./node_modules/granim/lib/getCurrentColors.js ***! 7475 \*****************************************************/ 7476/***/ ((module) => { 7477 7478"use strict"; 7479 7480 7481module.exports = function() { 7482 var i, j; 7483 var currentColors = []; 7484 7485 for (i = 0; i < this.currentColors.length; i++) { 7486 currentColors.push([]); 7487 7488 for (j = 0; j < 4; j++) { 7489 currentColors[i].push(this.currentColors[i][j]); 7490 } 7491 } 7492 7493 // Return a deep copy of the current colors 7494 return currentColors; 7495}; 7496 7497 7498/***/ }), 7499
vendor: 539 bytes, lines 7500-7522
7500/***/ "./node_modules/granim/lib/getCurrentColorsPos.js": 7501/*!********************************************************!*\ 7502 !*** ./node_modules/granim/lib/getCurrentColorsPos.js ***! 7503 \********************************************************/ 7504/***/ ((module) => { 7505 7506"use strict"; 7507 7508 7509module.exports = function() { 7510 var currentColorsPos = [], i; 7511 7512 for (i = 0; i < this.currentColorsPos.length; i++) { 7513 currentColorsPos.push(this.currentColorsPos[i]); 7514 } 7515 7516 // Return a deep copy of the current colors 7517 return currentColorsPos; 7518}; 7519 7520 7521/***/ }), 7522
vendor: 376 bytes, lines 7523-7539
7523/***/ "./node_modules/granim/lib/getDimensions.js": 7524/*!**************************************************!*\ 7525 !*** ./node_modules/granim/lib/getDimensions.js ***! 7526 \**************************************************/ 7527/***/ ((module) => { 7528 7529"use strict"; 7530 7531 7532module.exports = function() { 7533 this.x1 = this.canvas.offsetWidth; 7534 this.y1 = this.canvas.offsetHeight; 7535}; 7536 7537 7538/***/ }), 7539
vendor: 658 bytes, lines 7540-7567
7540/***/ "./node_modules/granim/lib/getElement.js": 7541/*!***********************************************!*\ 7542 !*** ./node_modules/granim/lib/getElement.js ***! 7543 \***********************************************/ 7544/***/ ((module) => { 7545 7546"use strict"; 7547 7548 7549module.exports = function(element) { 7550 if (element instanceof HTMLCanvasElement) { 7551 this.canvas = element; 7552 7553 } else if (typeof element === 'string') { 7554 this.canvas = document.querySelector(element); 7555 7556 } else { 7557 throw new Error('The element you used is neither a String, nor a HTMLCanvasElement'); 7558 } 7559 7560 if (!this.canvas) { 7561 throw new Error('`' + element + '` could not be found in the DOM'); 7562 } 7563}; 7564 7565 7566/***/ }), 7567
vendor: 1,060 bytes, lines 7568-7605
7568/***/ "./node_modules/granim/lib/getLightness.js": 7569/*!*************************************************!*\ 7570 !*** ./node_modules/granim/lib/getLightness.js ***! 7571 \*************************************************/ 7572/***/ ((module) => { 7573 7574"use strict"; 7575 7576 7577module.exports = function() { 7578 var currentColors = this.getCurrentColors(); 7579 var gradientAverage = null; 7580 var lightnessAverage, i; 7581 var colorsAverage = currentColors.map(function(el) { 7582 // Compute the average lightness of each color 7583 // in the current gradient 7584 return Math.max(el[0], el[1], el[2]); 7585 }); 7586 7587 for (i = 0; i < colorsAverage.length; i++) { 7588 // Add all the average lightness of each color 7589 gradientAverage = gradientAverage === null ? 7590 colorsAverage[i] : gradientAverage + colorsAverage[i]; 7591 7592 if (i === colorsAverage.length - 1) { 7593 // if it's the last lightness average 7594 // divide it by the total length to 7595 // have the global average lightness 7596 lightnessAverage = Math.round(gradientAverage / (i + 1)); 7597 } 7598 } 7599 7600 return lightnessAverage >= 128 ? 'light' : 'dark'; 7601}; 7602 7603 7604/***/ }), 7605
vendor: 1,289 bytes, lines 7606-7657
7606/***/ "./node_modules/granim/lib/makeGradient.js": 7607/*!*************************************************!*\ 7608 !*** ./node_modules/granim/lib/makeGradient.js ***! 7609 \*************************************************/ 7610/***/ ((module) => { 7611 7612"use strict"; 7613 7614 7615module.exports = function() { 7616 var gradient = this.setDirection(); 7617 var elToSetClassOnClass = document.querySelector(this.elToSetClassOn).classList; 7618 var i = 0; 7619 this.context.clearRect(0, 0, this.x1, this.y1); 7620 7621 if (this.image) { 7622 this.context.drawImage( 7623 this.imageNode, 7624 this.imagePosition.x, 7625 this.imagePosition.y, 7626 this.imagePosition.width, 7627 this.imagePosition.height 7628 ); 7629 } 7630 7631 for (i; i < this.currentColors.length; i++) { 7632 gradient.addColorStop(this.currentColorsPos[i], 'rgba(' + 7633 this.currentColors[i][0] + ', ' + 7634 this.currentColors[i][1] + ', ' + 7635 this.currentColors[i][2] + ', ' + 7636 this.currentColors[i][3] + ')' 7637 ); 7638 } 7639 7640 if (this.name) { 7641 if (this.getLightness() === 'light') { 7642 elToSetClassOnClass.remove(this.name + '-dark'); 7643 elToSetClassOnClass.add(this.name + '-light'); 7644 7645 } else { 7646 elToSetClassOnClass.remove(this.name + '-light'); 7647 elToSetClassOnClass.add(this.name + '-dark'); 7648 } 7649 } 7650 7651 this.context.fillStyle = gradient; 7652 this.context.fillRect(0, 0, this.x1, this.y1); 7653}; 7654 7655 7656/***/ }), 7657
vendor: 478 bytes, lines 7658-7678
7658/***/ "./node_modules/granim/lib/onResize.js": 7659/*!*********************************************!*\ 7660 !*** ./node_modules/granim/lib/onResize.js ***! 7661 \*********************************************/ 7662/***/ ((module) => { 7663 7664"use strict"; 7665 7666 7667module.exports = function(type) { 7668 if (type === 'removeListeners') { 7669 window.removeEventListener('resize', this.setSizeAttributesNameSpace); 7670 return; 7671 } 7672 7673 window.addEventListener('resize', this.setSizeAttributesNameSpace); 7674}; 7675 7676 7677/***/ }), 7678
vendor: 517 bytes, lines 7679-7700
7679/***/ "./node_modules/granim/lib/onScroll.js": 7680/*!*********************************************!*\ 7681 !*** ./node_modules/granim/lib/onScroll.js ***! 7682 \*********************************************/ 7683/***/ ((module) => { 7684 7685"use strict"; 7686 7687 7688module.exports = function(type) { 7689 if (type === 'removeListeners') { 7690 window.removeEventListener('scroll', this.pauseWhenNotInViewNameSpace); 7691 return; 7692 } 7693 7694 window.addEventListener('scroll', this.pauseWhenNotInViewNameSpace); 7695 this.pauseWhenNotInViewNameSpace(); 7696}; 7697 7698 7699/***/ }), 7700
vendor: 493 bytes, lines 7701-7720
7701/***/ "./node_modules/granim/lib/pause.js": 7702/*!******************************************!*\ 7703 !*** ./node_modules/granim/lib/pause.js ***! 7704 \******************************************/ 7705/***/ ((module) => { 7706 7707"use strict"; 7708 7709 7710module.exports = function(state) { 7711 var isPausedBecauseNotInView = state === 'isPausedBecauseNotInView'; 7712 if (this.isCleared) return; 7713 if (!isPausedBecauseNotInView) this.isPaused = true; 7714 cancelAnimationFrame(this.animation); 7715 this.animating = false; 7716}; 7717 7718 7719/***/ }), 7720
vendor: 1,259 bytes, lines 7721-7763
7721/***/ "./node_modules/granim/lib/pauseWhenNotInView.js": 7722/*!*******************************************************!*\ 7723 !*** ./node_modules/granim/lib/pauseWhenNotInView.js ***! 7724 \*******************************************************/ 7725/***/ ((module) => { 7726 7727"use strict"; 7728 7729 7730module.exports = function() { 7731 var _this = this; 7732 if (this.scrollDebounceTimeout) clearTimeout(this.scrollDebounceTimeout); 7733 7734 this.scrollDebounceTimeout = setTimeout(function() { 7735 var elPos = _this.canvas.getBoundingClientRect(); 7736 _this.isCanvasInWindowView = !(elPos.bottom < 0 || elPos.right < 0 || 7737 elPos.left > window.innerWidth || elPos.top > window.innerHeight); 7738 7739 if (_this.isCanvasInWindowView) { 7740 if (!_this.isPaused || _this.firstScrollInit) { 7741 if (_this.image && !_this.isImgLoaded) {return;} 7742 _this.isPausedBecauseNotInView = false; 7743 _this.play('isPlayedBecauseInView'); 7744 _this.firstScrollInit = false; 7745 } 7746 7747 } else { 7748 if (!_this.image && _this.firstScrollInit) { 7749 _this.refreshColorsAndPos(); 7750 _this.firstScrollInit = false; 7751 } 7752 7753 if (!_this.isPaused && !_this.isPausedBecauseNotInView) { 7754 _this.isPausedBecauseNotInView = true; 7755 _this.pause('isPausedBecauseNotInView'); 7756 } 7757 } 7758 }, this.scrollDebounceThreshold); 7759}; 7760 7761 7762/***/ }), 7763
vendor: 538 bytes, lines 7764-7785
7764/***/ "./node_modules/granim/lib/play.js": 7765/*!*****************************************!*\ 7766 !*** ./node_modules/granim/lib/play.js ***! 7767 \*****************************************/ 7768/***/ ((module) => { 7769 7770"use strict"; 7771 7772 7773module.exports = function(state) { 7774 var isPlayedBecauseInView = state === 'isPlayedBecauseInView'; 7775 if (!isPlayedBecauseInView) this.isPaused = false; 7776 this.isCleared = false; 7777 if (!this.animating) { 7778 this.animation = requestAnimationFrame(this.animateColors.bind(this)); 7779 this.animating = true; 7780 } 7781}; 7782 7783 7784/***/ }), 7785
vendor: 3,412 bytes, lines 7786-7899
7786/***/ "./node_modules/granim/lib/prepareImage.js": 7787/*!*************************************************!*\ 7788 !*** ./node_modules/granim/lib/prepareImage.js ***! 7789 \*************************************************/ 7790/***/ ((module) => { 7791 7792"use strict"; 7793 7794 7795module.exports = function() { 7796 var _this = this; 7797 7798 if (!this.imagePosition) { 7799 this.imagePosition = { x: 0, y: 0, width: 0, height: 0 }; 7800 } 7801 7802 if (this.image.blendingMode) { 7803 this.context.globalCompositeOperation = this.image.blendingMode; 7804 } 7805 7806 if (this.imageNode) { 7807 setImagePosition(); 7808 return; 7809 } 7810 7811 this.imageNode = new Image(); 7812 this.imageNode.onerror = function() { 7813 throw new Error('Granim: The image source is invalid.'); 7814 }; 7815 this.imageNode.onload = function() { 7816 _this.imgOriginalWidth = _this.imageNode.width; 7817 _this.imgOriginalHeight = _this.imageNode.height; 7818 setImagePosition(); 7819 _this.refreshColorsAndPos(); 7820 if (!_this.isPausedWhenNotInView || _this.isCanvasInWindowView) { 7821 _this.animation = requestAnimationFrame(_this.animateColors.bind(_this)); 7822 } 7823 _this.isImgLoaded = true; 7824 }; 7825 this.imageNode.src = this.image.source; 7826 7827 function setImagePosition() { 7828 var i, currentAxis; 7829 7830 for (i = 0; i < 2; i++) { 7831 currentAxis = !i ? 'x' : 'y'; 7832 setImageAxisPosition(currentAxis); 7833 } 7834 7835 function setImageAxisPosition(axis) { 7836 var canvasWidthOrHeight = _this[axis + '1']; 7837 var imgOriginalWidthOrHeight = _this[axis === 'x' ? 'imgOriginalWidth' : 'imgOriginalHeight']; 7838 var imageAlignIndex = axis === 'x' ? _this.image.position[0] : _this.image.position[1]; 7839 var imageAxisPosition; 7840 switch(imageAlignIndex) { 7841 case 'center': 7842 imageAxisPosition = imgOriginalWidthOrHeight > canvasWidthOrHeight 7843 ? -(imgOriginalWidthOrHeight - canvasWidthOrHeight) / 2 7844 : (canvasWidthOrHeight - imgOriginalWidthOrHeight) / 2; 7845 _this.imagePosition[axis] = imageAxisPosition; 7846 _this.imagePosition[axis === 'x' ? 'width' : 'height'] = imgOriginalWidthOrHeight; 7847 break; 7848 7849 case 'top': 7850 _this.imagePosition['y'] = 0; 7851 _this.imagePosition['height'] = imgOriginalWidthOrHeight; 7852 break; 7853 7854 case 'bottom': 7855 _this.imagePosition['y'] = canvasWidthOrHeight - imgOriginalWidthOrHeight; 7856 _this.imagePosition['height'] = imgOriginalWidthOrHeight; 7857 break; 7858 7859 case 'right': 7860 _this.imagePosition['x'] = canvasWidthOrHeight - imgOriginalWidthOrHeight; 7861 _this.imagePosition['width'] = imgOriginalWidthOrHeight; 7862 break; 7863 7864 case 'left': 7865 _this.imagePosition['x'] = 0; 7866 _this.imagePosition['width'] = imgOriginalWidthOrHeight; 7867 break; 7868 } 7869 7870 if (_this.image.stretchMode) { 7871 imageAlignIndex = axis === 'x' ? _this.image.stretchMode[0] : _this.image.stretchMode[1]; 7872 switch(imageAlignIndex) { 7873 case 'none': 7874 break; 7875 case 'stretch': 7876 _this.imagePosition[axis] = 0; 7877 _this.imagePosition[axis === 'x' ? 'width' : 'height'] = canvasWidthOrHeight; 7878 break; 7879 7880 case 'stretch-if-bigger': 7881 if (imgOriginalWidthOrHeight < canvasWidthOrHeight) break; 7882 _this.imagePosition[axis] = 0; 7883 _this.imagePosition[axis === 'x' ? 'width' : 'height'] = canvasWidthOrHeight; 7884 break; 7885 7886 case 'stretch-if-smaller': 7887 if (imgOriginalWidthOrHeight > canvasWidthOrHeight) break; 7888 _this.imagePosition[axis] = 0; 7889 _this.imagePosition[axis === 'x' ? 'width' : 'height'] = canvasWidthOrHeight; 7890 break; 7891 } 7892 } 7893 } 7894 } 7895}; 7896 7897 7898/***/ }), 7899
vendor: 1,351 bytes, lines 7900-7946
7900/***/ "./node_modules/granim/lib/refreshColorsAndPos.js": 7901/*!********************************************************!*\ 7902 !*** ./node_modules/granim/lib/refreshColorsAndPos.js ***! 7903 \********************************************************/ 7904/***/ ((module) => { 7905 7906"use strict"; 7907 7908 7909module.exports = function(progressPercent) { 7910 var _this = this, activeChannel, activeChannelPos, i, j; 7911 7912 // Loop through each colors of the active gradient 7913 for (i = 0; i < this.activeColors.length; i++) { 7914 7915 // Generate RGBA colors 7916 for (j = 0; j < 4; j++) { 7917 // If color value [0-255] round to the integer, 7918 // Else if opacity [0-1] round to 2 decimals 7919 activeChannel = _this.activeColors[i][j] + 7920 (j !== 3 7921 ? Math.ceil(_this.activeColorsDiff[i][j] / 100 * progressPercent) 7922 : Math.round((_this.activeColorsDiff[i][j] / 100 * progressPercent) * 100) / 100 7923 ); 7924 7925 // Prevent colors values from going < 0 & > 255 7926 if (activeChannel <= 255 && activeChannel >= 0) { 7927 _this.currentColors[i][j] = activeChannel; 7928 } 7929 } 7930 7931 // Generate gradient color position 7932 activeChannelPos = parseFloat((_this.activeColorsPos[i] + 7933 (_this.activeColorsPosDiff[i] / 100 * progressPercent) 7934 ).toFixed(4)); 7935 7936 if (activeChannelPos <= 1 && activeChannelPos >= 0) { 7937 _this.currentColorsPos[i] = activeChannelPos; 7938 } 7939 } 7940 7941 this.makeGradient(); 7942}; 7943 7944 7945/***/ }), 7946
vendor: 3,600 bytes, lines 7947-8032
7947/***/ "./node_modules/granim/lib/setColors.js": 7948/*!**********************************************!*\ 7949 !*** ./node_modules/granim/lib/setColors.js ***! 7950 \**********************************************/ 7951/***/ ((module) => { 7952 7953"use strict"; 7954 7955 7956module.exports = function() { 7957 var _this = this, colorDiff, colorPosDiff, nextColors, nextColorsPos; 7958 7959 if (!this.channels[this.activeState]) this.channels[this.activeState] = []; 7960 7961 // If the actual channel exist, reassign properties and exit 7962 // (each channel is saved to prevent recomputing it each time) 7963 if (this.channels[this.activeState][this.channelsIndex] !== undefined) { 7964 this.activeColors = this.channels[this.activeState][this.channelsIndex].colors; 7965 this.activeColorsDiff = this.channels[this.activeState][this.channelsIndex].colorsDiff; 7966 this.activeColorsPos = this.channels[this.activeState][this.channelsIndex].colorsPos; 7967 this.activeColorsPosDiff = this.channels[this.activeState][this.channelsIndex].colorsPosDiff; 7968 return; 7969 } 7970 7971 // Set blank properties 7972 this.channels[this.activeState].push([{}]); 7973 this.channels[this.activeState][this.channelsIndex].colors = []; 7974 this.channels[this.activeState][this.channelsIndex].colorsDiff = []; 7975 this.channels[this.activeState][this.channelsIndex].colorsPos = []; 7976 this.channels[this.activeState][this.channelsIndex].colorsPosDiff = []; 7977 this.activeColors = []; 7978 this.activeColorsDiff = []; 7979 this.activeColorsPos = []; 7980 this.activeColorsPosDiff = []; 7981 7982 // Go on each gradient of the current state 7983 this.states[this.activeState].gradients[this.channelsIndex].forEach(function(color, i) { 7984 // Push the hex color converted to rgba on the channel and the active color properties 7985 var colorPos = _this.getColorPos(color, i); 7986 var color = _this.getColor(color); 7987 var rgbaColor = _this.convertColorToRgba(color); 7988 var activeChannel = _this.channels[_this.activeState]; 7989 7990 activeChannel[_this.channelsIndex].colors.push(rgbaColor); 7991 _this.activeColors.push(rgbaColor); 7992 activeChannel[_this.channelsIndex].colorsPos.push(colorPos); 7993 _this.activeColorsPos.push(colorPos); 7994 7995 // If it's the first channel to be set, set the currentColors 7996 if (!_this.isCurrentColorsSet) { 7997 _this.currentColors.push(_this.convertColorToRgba(color)); 7998 _this.currentColorsPos.push(colorPos); 7999 } 8000 8001 // If it's the last gradient, compute the color diff between the last gradient and the first one, 8002 // else between the penultimate one and the last one 8003 if (_this.channelsIndex === _this.states[_this.activeState].gradients.length - 1) { 8004 colorDiff = _this.getColorDiff( 8005 activeChannel[_this.channelsIndex].colors[i], 8006 activeChannel[0].colors[i] 8007 ); 8008 colorPosDiff = _this.getColorPosDiff( 8009 activeChannel[_this.channelsIndex].colorsPos[i], 8010 activeChannel[0].colorsPos[i] 8011 ); 8012 8013 } else { 8014 nextColors = _this.convertColorToRgba(_this.getColor(_this.states[_this.activeState].gradients[_this.channelsIndex + 1][i])); 8015 nextColorsPos = _this.getColorPos(_this.states[_this.activeState].gradients[_this.channelsIndex + 1][i], i); 8016 colorDiff = _this.getColorDiff(activeChannel[_this.channelsIndex].colors[i], nextColors); 8017 colorPosDiff = _this.getColorPosDiff(activeChannel[_this.channelsIndex].colorsPos[i], nextColorsPos); 8018 } 8019 8020 activeChannel[_this.channelsIndex].colorsDiff.push(colorDiff); 8021 _this.activeColorsDiff.push(colorDiff); 8022 activeChannel[_this.channelsIndex].colorsPosDiff.push(colorPosDiff); 8023 _this.activeColorsPosDiff.push(colorPosDiff); 8024 }); 8025 8026 this.activetransitionSpeed = this.states[this.activeState].transitionSpeed || 5000; 8027 this.isCurrentColorsSet = true; 8028}; 8029 8030 8031/***/ }), 8032
vendor: 1,252 bytes, lines 8033-8076
8033/***/ "./node_modules/granim/lib/setDirection.js": 8034/*!*************************************************!*\ 8035 !*** ./node_modules/granim/lib/setDirection.js ***! 8036 \*************************************************/ 8037/***/ ((module) => { 8038 8039"use strict"; 8040 8041 8042module.exports = function() { 8043 var ctx = this.context; 8044 8045 switch(this.direction) { 8046 case 'diagonal': 8047 return ctx.createLinearGradient(0, 0, this.x1, this.y1); 8048 8049 case 'left-right': 8050 return ctx.createLinearGradient(0, 0, this.x1, 0); 8051 8052 case 'top-bottom': 8053 return ctx.createLinearGradient(this.x1 / 2, 0, this.x1 / 2, this.y1); 8054 8055 case 'radial': 8056 return ctx.createRadialGradient(this.x1 / 2, this.y1 / 2, this.x1 / 2, this.x1 / 2, this.y1 / 2, 0); 8057 8058 case 'custom': 8059 return ctx.createLinearGradient( 8060 getCustomCoordinateInPixels(this.customDirection.x0, this.x1), 8061 getCustomCoordinateInPixels(this.customDirection.y0, this.y1), 8062 getCustomCoordinateInPixels(this.customDirection.x1, this.x1), 8063 getCustomCoordinateInPixels(this.customDirection.y1, this.y1) 8064 ); 8065 } 8066}; 8067 8068function getCustomCoordinateInPixels(coordinate, size) { 8069 return coordinate.indexOf('%') > -1 8070 ? size / 100 * parseInt(coordinate.split('%')[0], 10) 8071 : parseInt(coordinate.split('px')[0], 10); 8072} 8073 8074 8075/***/ }), 8076
vendor: 500 bytes, lines 8077-8096
8077/***/ "./node_modules/granim/lib/setSizeAttributes.js": 8078/*!******************************************************!*\ 8079 !*** ./node_modules/granim/lib/setSizeAttributes.js ***! 8080 \******************************************************/ 8081/***/ ((module) => { 8082 8083"use strict"; 8084 8085 8086module.exports = function() { 8087 this.getDimensions(); 8088 this.canvas.setAttribute('width', this.x1); 8089 this.canvas.setAttribute('height', this.y1); 8090 if (this.image) this.prepareImage(); 8091 this.refreshColorsAndPos(); 8092}; 8093 8094 8095/***/ }), 8096
vendor: 473 bytes, lines 8097-8113
8097/***/ "./node_modules/granim/lib/triggerError.js": 8098/*!*************************************************!*\ 8099 !*** ./node_modules/granim/lib/triggerError.js ***! 8100 \*************************************************/ 8101/***/ ((module) => { 8102 8103"use strict"; 8104 8105 8106module.exports = function(element) { 8107 var siteURL = 'https://sarcadass.github.io/granim.js/api.html'; 8108 throw new Error('Granim: Input error on "' + element + '" option.\nCheck the API ' + siteURL + '.'); 8109}; 8110 8111 8112/***/ }), 8113
vendor: 3,011 bytes, lines 8114-8209
8114/***/ "./node_modules/granim/lib/validateInput.js": 8115/*!**************************************************!*\ 8116 !*** ./node_modules/granim/lib/validateInput.js ***! 8117 \**************************************************/ 8118/***/ ((module) => { 8119 8120"use strict"; 8121 8122 8123module.exports = function(inputType) { 8124 var xPositionValues = ['left', 'center', 'right']; 8125 var yPositionValues = ['top', 'center', 'bottom']; 8126 var stretchModeValues = ['none', 'stretch', 'stretch-if-smaller', 'stretch-if-bigger']; 8127 var blendingModeValues = ['multiply', 'screen', 'normal', 'overlay', 'darken', 8128 'lighten', 'lighter', 'color-dodge', 'color-burn', 'hard-light', 'soft-light', 8129 'difference', 'exclusion', 'hue', 'saturation', 'color', 'luminosity']; 8130 var directionValues = ['diagonal', 'left-right', 'top-bottom', 'radial', 'custom']; 8131 8132 switch(inputType) { 8133 case 'image': 8134 // Validate image.position 8135 if ((!Array.isArray(this.image.position) || this.image.position.length !== 2) || 8136 xPositionValues.indexOf(this.image.position[0]) === -1 || 8137 yPositionValues.indexOf(this.image.position[1]) === -1 8138 ) { this.triggerError('image.position'); } 8139 // Validate image.stretchMode 8140 if (this.image.stretchMode) { 8141 if ((!Array.isArray(this.image.stretchMode) || this.image.stretchMode.length !== 2) || 8142 stretchModeValues.indexOf(this.image.stretchMode[0]) === -1 || 8143 stretchModeValues.indexOf(this.image.stretchMode[1]) === -1 8144 ) { this.triggerError('image.stretchMode'); } 8145 } 8146 break; 8147 8148 case 'blendingMode': 8149 if (blendingModeValues.indexOf(this.image.blendingMode) === -1) { 8150 this.clear(); 8151 this.triggerError('blendingMode'); 8152 } 8153 break; 8154 8155 case 'direction': 8156 if (directionValues.indexOf(this.direction) === -1) { 8157 this.triggerError('direction'); 8158 } else { 8159 if (this.direction === 'custom') { 8160 if (!areDefinedInPixelsOrPercentage([ 8161 this.customDirection.x0, 8162 this.customDirection.x1, 8163 this.customDirection.y0, 8164 this.customDirection.y1 8165 ])) { 8166 this.triggerError('customDirection'); 8167 } 8168 } 8169 } 8170 break; 8171 } 8172}; 8173 8174function areDefinedInPixelsOrPercentage(array) { 8175 var definedInPixelsOrPercentage = true, i = 0, value; 8176 while (definedInPixelsOrPercentage && i < array.length) { 8177 value = array[i]; 8178 if (typeof value !== 'string') { 8179 definedInPixelsOrPercentage = false; 8180 } else { 8181 var splittedValue = null; 8182 var unit = null; 8183 if (value.indexOf('px') !== -1) unit = 'px'; 8184 if (value.indexOf('%') !== -1) unit = '%'; 8185 splittedValue = value.split(unit).filter(function(value) { 8186 return value.length > 0; 8187 }); 8188 // Check if there is a unit ('px' or '%'), 8189 // a char before the unit, 8190 // no char after the unit, 8191 // the string without the unit is only composed of digits 8192 if ( 8193 !unit 8194 || splittedValue.length > 2 8195 || !splittedValue[0] 8196 || splittedValue[1] 8197 || !/^-?\d+\.?\d*$/.test(splittedValue[0]) 8198 ) { 8199 definedInPixelsOrPercentage = false; 8200 } 8201 } 8202 i++; 8203 } 8204 return definedInPixelsOrPercentage; 8205} 8206 8207 8208/***/ }), 8209
vendor: 13,551 bytes, lines 8210-8699
8210/***/ "./node_modules/imagesloaded/imagesloaded.pkgd.js": 8211/*!********************************************************!*\ 8212 !*** ./node_modules/imagesloaded/imagesloaded.pkgd.js ***! 8213 \********************************************************/ 8214/***/ (function(module, exports, __webpack_require__) { 8215 8216var __WEBPACK_LOCAL_MODULE_0__, __WEBPACK_LOCAL_MODULE_0__factory, __WEBPACK_LOCAL_MODULE_0__module;var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! 8217 * imagesLoaded PACKAGED v4.1.4 8218 * JavaScript is all like "You images are done yet or what?" 8219 * MIT License 8220 */ 8221 8222/** 8223 * EvEmitter v1.1.0 8224 * Lil' event emitter 8225 * MIT License 8226 */ 8227 8228/* jshint unused: true, undef: true, strict: true */ 8229 8230( function( global, factory ) { 8231 // universal module definition 8232 /* jshint strict: false */ /* globals define, module, window */ 8233 if ( true ) { 8234 // AMD - RequireJS 8235 !(__WEBPACK_LOCAL_MODULE_0__factory = (factory), (typeof __WEBPACK_LOCAL_MODULE_0__factory === 'function' ? ((__WEBPACK_LOCAL_MODULE_0__module = { id: "ev-emitter/ev-emitter", exports: {}, loaded: false }), (__WEBPACK_LOCAL_MODULE_0__ = __WEBPACK_LOCAL_MODULE_0__factory.call(__WEBPACK_LOCAL_MODULE_0__module.exports, __webpack_require__, __WEBPACK_LOCAL_MODULE_0__module.exports, __WEBPACK_LOCAL_MODULE_0__module)), (__WEBPACK_LOCAL_MODULE_0__module.loaded = true), __WEBPACK_LOCAL_MODULE_0__ === undefined && (__WEBPACK_LOCAL_MODULE_0__ = __WEBPACK_LOCAL_MODULE_0__module.exports)) : __WEBPACK_LOCAL_MODULE_0__ = __WEBPACK_LOCAL_MODULE_0__factory)); 8236 } else {} 8237 8238}( typeof window != 'undefined' ? window : this, function() { 8239 8240 8241 8242function EvEmitter() {} 8243 8244var proto = EvEmitter.prototype; 8245 8246proto.on = function( eventName, listener ) { 8247 if ( !eventName || !listener ) { 8248 return; 8249 } 8250 // set events hash 8251 var events = this._events = this._events || {}; 8252 // set listeners array 8253 var listeners = events[ eventName ] = events[ eventName ] || []; 8254 // only add once 8255 if ( listeners.indexOf( listener ) == -1 ) { 8256 listeners.push( listener ); 8257 } 8258 8259 return this; 8260}; 8261 8262proto.once = function( eventName, listener ) { 8263 if ( !eventName || !listener ) { 8264 return; 8265 } 8266 // add event 8267 this.on( eventName, listener ); 8268 // set once flag 8269 // set onceEvents hash 8270 var onceEvents = this._onceEvents = this._onceEvents || {}; 8271 // set onceListeners object 8272 var onceListeners = onceEvents[ eventName ] = onceEvents[ eventName ] || {}; 8273 // set flag 8274 onceListeners[ listener ] = true; 8275 8276 return this; 8277}; 8278 8279proto.off = function( eventName, listener ) { 8280 var listeners = this._events && this._events[ eventName ]; 8281 if ( !listeners || !listeners.length ) { 8282 return; 8283 } 8284 var index = listeners.indexOf( listener ); 8285 if ( index != -1 ) { 8286 listeners.splice( index, 1 ); 8287 } 8288 8289 return this; 8290}; 8291 8292proto.emitEvent = function( eventName, args ) { 8293 var listeners = this._events && this._events[ eventName ]; 8294 if ( !listeners || !listeners.length ) { 8295 return; 8296 } 8297 // copy over to avoid interference if .off() in listener 8298 listeners = listeners.slice(0); 8299 args = args || []; 8300 // once stuff 8301 var onceListeners = this._onceEvents && this._onceEvents[ eventName ]; 8302 8303 for ( var i=0; i < listeners.length; i++ ) { 8304 var listener = listeners[i] 8305 var isOnce = onceListeners && onceListeners[ listener ]; 8306 if ( isOnce ) { 8307 // remove listener 8308 // remove before trigger to prevent recursion 8309 this.off( eventName, listener ); 8310 // unset once flag 8311 delete onceListeners[ listener ]; 8312 } 8313 // trigger listener 8314 listener.apply( this, args ); 8315 } 8316 8317 return this; 8318}; 8319 8320proto.allOff = function() { 8321 delete this._events; 8322 delete this._onceEvents; 8323}; 8324 8325return EvEmitter; 8326 8327})); 8328 8329/*! 8330 * imagesLoaded v4.1.4 8331 * JavaScript is all like "You images are done yet or what?" 8332 * MIT License 8333 */ 8334 8335( function( window, factory ) { 'use strict'; 8336 // universal module definition 8337 8338 /*global define: false, module: false, require: false */ 8339 8340 if ( true ) { 8341 // AMD 8342 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [ 8343 __WEBPACK_LOCAL_MODULE_0__ 8344 ], __WEBPACK_AMD_DEFINE_RESULT__ = (function( EvEmitter ) { 8345 return factory( window, EvEmitter ); 8346 }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), 8347 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 8348 } else {} 8349 8350})( typeof window !== 'undefined' ? window : this, 8351 8352// -------------------------- factory -------------------------- // 8353 8354function factory( window, EvEmitter ) { 8355 8356 8357 8358var $ = window.jQuery; 8359var console = window.console; 8360 8361// -------------------------- helpers -------------------------- // 8362 8363// extend objects 8364function extend( a, b ) { 8365 for ( var prop in b ) { 8366 a[ prop ] = b[ prop ]; 8367 } 8368 return a; 8369} 8370 8371var arraySlice = Array.prototype.slice; 8372 8373// turn element or nodeList into an array 8374function makeArray( obj ) { 8375 if ( Array.isArray( obj ) ) { 8376 // use object if already an array 8377 return obj; 8378 } 8379 8380 var isArrayLike = typeof obj == 'object' && typeof obj.length == 'number'; 8381 if ( isArrayLike ) { 8382 // convert nodeList to array 8383 return arraySlice.call( obj ); 8384 } 8385 8386 // array of single index 8387 return [ obj ]; 8388} 8389 8390// -------------------------- imagesLoaded -------------------------- // 8391 8392/** 8393 * @param {Array, Element, NodeList, String} elem 8394 * @param {Object or Function} options - if function, use as callback 8395 * @param {Function} onAlways - callback function 8396 */ 8397function ImagesLoaded( elem, options, onAlways ) { 8398 // coerce ImagesLoaded() without new, to be new ImagesLoaded() 8399 if ( !( this instanceof ImagesLoaded ) ) { 8400 return new ImagesLoaded( elem, options, onAlways ); 8401 } 8402 // use elem as selector string 8403 var queryElem = elem; 8404 if ( typeof elem == 'string' ) { 8405 queryElem = document.querySelectorAll( elem ); 8406 } 8407 // bail if bad element 8408 if ( !queryElem ) { 8409 console.error( 'Bad element for imagesLoaded ' + ( queryElem || elem ) ); 8410 return; 8411 } 8412 8413 this.elements = makeArray( queryElem ); 8414 this.options = extend( {}, this.options ); 8415 // shift arguments if no options set 8416 if ( typeof options == 'function' ) { 8417 onAlways = options; 8418 } else { 8419 extend( this.options, options ); 8420 } 8421 8422 if ( onAlways ) { 8423 this.on( 'always', onAlways ); 8424 } 8425 8426 this.getImages(); 8427 8428 if ( $ ) { 8429 // add jQuery Deferred object 8430 this.jqDeferred = new $.Deferred(); 8431 } 8432 8433 // HACK check async to allow time to bind listeners 8434 setTimeout( this.check.bind( this ) ); 8435} 8436 8437ImagesLoaded.prototype = Object.create( EvEmitter.prototype ); 8438 8439ImagesLoaded.prototype.options = {}; 8440 8441ImagesLoaded.prototype.getImages = function() { 8442 this.images = []; 8443 8444 // filter & find items if we have an item selector 8445 this.elements.forEach( this.addElementImages, this ); 8446}; 8447 8448/** 8449 * @param {Node} element 8450 */ 8451ImagesLoaded.prototype.addElementImages = function( elem ) { 8452 // filter siblings 8453 if ( elem.nodeName == 'IMG' ) { 8454 this.addImage( elem ); 8455 } 8456 // get background image on element 8457 if ( this.options.background === true ) { 8458 this.addElementBackgroundImages( elem ); 8459 } 8460 8461 // find children 8462 // no non-element nodes, #143 8463 var nodeType = elem.nodeType; 8464 if ( !nodeType || !elementNodeTypes[ nodeType ] ) { 8465 return; 8466 } 8467 var childImgs = elem.querySelectorAll('img'); 8468 // concat childElems to filterFound array 8469 for ( var i=0; i < childImgs.length; i++ ) { 8470 var img = childImgs[i]; 8471 this.addImage( img ); 8472 } 8473 8474 // get child background images 8475 if ( typeof this.options.background == 'string' ) { 8476 var children = elem.querySelectorAll( this.options.background ); 8477 for ( i=0; i < children.length; i++ ) { 8478 var child = children[i]; 8479 this.addElementBackgroundImages( child ); 8480 } 8481 } 8482}; 8483 8484var elementNodeTypes = { 8485 1: true, 8486 9: true, 8487 11: true 8488}; 8489 8490ImagesLoaded.prototype.addElementBackgroundImages = function( elem ) { 8491 var style = getComputedStyle( elem ); 8492 if ( !style ) { 8493 // Firefox returns null if in a hidden iframe https://bugzil.la/548397 8494 return; 8495 } 8496 // get url inside url("...") 8497 var reURL = /url\((['"])?(.*?)\1\)/gi; 8498 var matches = reURL.exec( style.backgroundImage ); 8499 while ( matches !== null ) { 8500 var url = matches && matches[2]; 8501 if ( url ) { 8502 this.addBackground( url, elem ); 8503 } 8504 matches = reURL.exec( style.backgroundImage ); 8505 } 8506}; 8507 8508/** 8509 * @param {Image} img 8510 */ 8511ImagesLoaded.prototype.addImage = function( img ) { 8512 var loadingImage = new LoadingImage( img ); 8513 this.images.push( loadingImage ); 8514}; 8515 8516ImagesLoaded.prototype.addBackground = function( url, elem ) { 8517 var background = new Background( url, elem ); 8518 this.images.push( background ); 8519}; 8520 8521ImagesLoaded.prototype.check = function() { 8522 var _this = this; 8523 this.progressedCount = 0; 8524 this.hasAnyBroken = false; 8525 // complete if no images 8526 if ( !this.images.length ) { 8527 this.complete(); 8528 return; 8529 } 8530 8531 function onProgress( image, elem, message ) { 8532 // HACK - Chrome triggers event before object properties have changed. #83 8533 setTimeout( function() { 8534 _this.progress( image, elem, message ); 8535 }); 8536 } 8537 8538 this.images.forEach( function( loadingImage ) { 8539 loadingImage.once( 'progress', onProgress ); 8540 loadingImage.check(); 8541 }); 8542}; 8543 8544ImagesLoaded.prototype.progress = function( image, elem, message ) { 8545 this.progressedCount++; 8546 this.hasAnyBroken = this.hasAnyBroken || !image.isLoaded; 8547 // progress event 8548 this.emitEvent( 'progress', [ this, image, elem ] ); 8549 if ( this.jqDeferred && this.jqDeferred.notify ) { 8550 this.jqDeferred.notify( this, image ); 8551 } 8552 // check if completed 8553 if ( this.progressedCount == this.images.length ) { 8554 this.complete(); 8555 } 8556 8557 if ( this.options.debug && console ) { 8558 console.log( 'progress: ' + message, image, elem ); 8559 } 8560}; 8561 8562ImagesLoaded.prototype.complete = function() { 8563 var eventName = this.hasAnyBroken ? 'fail' : 'done'; 8564 this.isComplete = true; 8565 this.emitEvent( eventName, [ this ] ); 8566 this.emitEvent( 'always', [ this ] ); 8567 if ( this.jqDeferred ) { 8568 var jqMethod = this.hasAnyBroken ? 'reject' : 'resolve'; 8569 this.jqDeferred[ jqMethod ]( this ); 8570 } 8571}; 8572 8573// -------------------------- -------------------------- // 8574 8575function LoadingImage( img ) { 8576 this.img = img; 8577} 8578 8579LoadingImage.prototype = Object.create( EvEmitter.prototype ); 8580 8581LoadingImage.prototype.check = function() { 8582 // If complete is true and browser supports natural sizes, 8583 // try to check for image status manually. 8584 var isComplete = this.getIsImageComplete(); 8585 if ( isComplete ) { 8586 // report based on naturalWidth 8587 this.confirm( this.img.naturalWidth !== 0, 'naturalWidth' ); 8588 return; 8589 } 8590 8591 // If none of the checks above matched, simulate loading on detached element. 8592 this.proxyImage = new Image(); 8593 this.proxyImage.addEventListener( 'load', this ); 8594 this.proxyImage.addEventListener( 'error', this ); 8595 // bind to image as well for Firefox. #191 8596 this.img.addEventListener( 'load', this ); 8597 this.img.addEventListener( 'error', this ); 8598 this.proxyImage.src = this.img.src; 8599}; 8600 8601LoadingImage.prototype.getIsImageComplete = function() { 8602 // check for non-zero, non-undefined naturalWidth 8603 // fixes Safari+InfiniteScroll+Masonry bug infinite-scroll#671 8604 return this.img.complete && this.img.naturalWidth; 8605}; 8606 8607LoadingImage.prototype.confirm = function( isLoaded, message ) { 8608 this.isLoaded = isLoaded; 8609 this.emitEvent( 'progress', [ this, this.img, message ] ); 8610}; 8611 8612// ----- events ----- // 8613 8614// trigger specified handler for event type 8615LoadingImage.prototype.handleEvent = function( event ) { 8616 var method = 'on' + event.type; 8617 if ( this[ method ] ) { 8618 this[ method ]( event ); 8619 } 8620}; 8621 8622LoadingImage.prototype.onload = function() { 8623 this.confirm( true, 'onload' ); 8624 this.unbindEvents(); 8625}; 8626 8627LoadingImage.prototype.onerror = function() { 8628 this.confirm( false, 'onerror' ); 8629 this.unbindEvents(); 8630}; 8631 8632LoadingImage.prototype.unbindEvents = function() { 8633 this.proxyImage.removeEventListener( 'load', this ); 8634 this.proxyImage.removeEventListener( 'error', this ); 8635 this.img.removeEventListener( 'load', this ); 8636 this.img.removeEventListener( 'error', this ); 8637}; 8638 8639// -------------------------- Background -------------------------- // 8640 8641function Background( url, element ) { 8642 this.url = url; 8643 this.element = element; 8644 this.img = new Image(); 8645} 8646 8647// inherit LoadingImage prototype 8648Background.prototype = Object.create( LoadingImage.prototype ); 8649 8650Background.prototype.check = function() { 8651 this.img.addEventListener( 'load', this ); 8652 this.img.addEventListener( 'error', this ); 8653 this.img.src = this.url; 8654 // check if image is already complete 8655 var isComplete = this.getIsImageComplete(); 8656 if ( isComplete ) { 8657 this.confirm( this.img.naturalWidth !== 0, 'naturalWidth' ); 8658 this.unbindEvents(); 8659 } 8660}; 8661 8662Background.prototype.unbindEvents = function() { 8663 this.img.removeEventListener( 'load', this ); 8664 this.img.removeEventListener( 'error', this ); 8665}; 8666 8667Background.prototype.confirm = function( isLoaded, message ) { 8668 this.isLoaded = isLoaded; 8669 this.emitEvent( 'progress', [ this, this.element, message ] ); 8670}; 8671 8672// -------------------------- jQuery -------------------------- // 8673 8674ImagesLoaded.makeJQueryPlugin = function( jQuery ) { 8675 jQuery = jQuery || window.jQuery; 8676 if ( !jQuery ) { 8677 return; 8678 } 8679 // set local variable 8680 $ = jQuery; 8681 // $().imagesLoaded() 8682 $.fn.imagesLoaded = function( options, callback ) { 8683 var instance = new ImagesLoaded( this, options, callback ); 8684 return instance.jqDeferred.promise( $(this) ); 8685 }; 8686}; 8687// try making plugin 8688ImagesLoaded.makeJQueryPlugin(); 8689 8690// -------------------------- -------------------------- // 8691 8692return ImagesLoaded; 8693 8694}); 8695 8696 8697 8698/***/ }), 8699
vendor: 18,104 bytes, lines 8700-8716
8700/***/ "./node_modules/jarallax/dist/jarallax-video.min.js": 8701/*!**********************************************************!*\ 8702 !*** ./node_modules/jarallax/dist/jarallax-video.min.js ***! 8703 \**********************************************************/ 8704/***/ (() => { 8705 8706/*! 8707 * Name : Video Background Extension for Jarallax 8708 * Version : 1.0.1 8709 * Author : nK <https://nkdev.info> 8710 * GitHub : https://github.com/nk-o/jarallax 8711 */!function(){var o=[,function(e){e.exports=function(e){"complete"===document.readyState||"interactive"===document.readyState?e.call():document.attachEvent?document.attachEvent("onreadystatechange",function(){"interactive"===document.readyState&&e.call()}):document.addEventListener&&document.addEventListener("DOMContentLoaded",e)}},function(e,t,o){o="undefined"!=typeof window?window:void 0!==o.g?o.g:"undefined"!=typeof self?self:{};e.exports=o},,,function(e,t,o){"use strict";o.r(t),o.d(t,{default:function(){return v}});var t=o(2),d=o.n(t);function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){for(var o=0;o<t.length;o++){var i=t[o];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function i(){this.doneCallbacks=[],this.failCallbacks=[]}i.prototype={execute:function(e,t){var o=e.length;for(t=Array.prototype.slice.call(t);o;)e[--o].apply(null,t)},resolve:function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];this.execute(this.doneCallbacks,t)},reject:function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];this.execute(this.failCallbacks,t)},done:function(e){this.doneCallbacks.push(e)},fail:function(e){this.failCallbacks.push(e)}};var r=0,l=0,s=0,p=0,u=0,c=new i,y=new i,v=function(){function i(e,t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i);var o=this;o.url=e,o.options_default={autoplay:!1,loop:!1,mute:!1,volume:100,showControls:!0,accessibilityHidden:!1,startTime:0,endTime:0},o.options=o.extend({},o.options_default,t),void 0!==o.options.showContols&&(o.options.showControls=o.options.showContols,delete o.options.showContols),o.videoID=o.parseURL(e),o.videoID&&(o.ID=r,r+=1,o.loadAPI(),o.init())}var e,t,o;return e=i,(t=[{key:"extend",value:function(){for(var e=arguments.length,o=new Array(e),t=0;t<e;t++)o[t]=arguments[t];var i=o[0]||{};return Object.keys(o).forEach(function(t){o[t]&&Object.keys(o[t]).forEach(function(e){i[e]=o[t][e]})}),i}},{key:"parseURL",value:function(e){var t,o,i,n,a,r=!(!(t=(t=e).match(/.*(?:youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=)([^#\&\?]*).*/))||11!==t[1].length)&&t[1],l=!(!(o=(o=e).match(/https?:\/\/(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^\/]*)\/videos\/|album\/(\d+)\/video\/|video\/|)(\d+)(?:$|\/|\?)/))||!o[3])&&o[3],s=(i=(i=e).split(/,(?=mp4\:|webm\:|ogv\:|ogg\:)/),n={},a=0,i.forEach(function(e){e=e.match(/^(mp4|webm|ogv|ogg)\:(.*)/);e&&e[1]&&e[2]&&(n["ogv"===e[1]?"ogg":e[1]]=e[2],a=1)}),!!a&&n);return r?(this.type="youtube",r):l?(this.type="vimeo",l):!!s&&(this.type="local",s)}},{key:"isValid",value:function(){return!!this.videoID}},{key:"on",value:function(e,t){this.userEventsList=this.userEventsList||[],(this.userEventsList[e]||(this.userEventsList[e]=[])).push(t)}},{key:"off",value:function(o,i){var n=this;this.userEventsList&&this.userEventsList[o]&&(i?this.userEventsList[o].forEach(function(e,t){e===i&&(n.userEventsList[o][t]=!1)}):delete this.userEventsList[o])}},{key:"fire",value:function(e){for(var t=this,o=arguments.length,i=new Array(1<o?o-1:0),n=1;n<o;n++)i[n-1]=arguments[n];this.userEventsList&&void 0!==this.userEventsList[e]&&this.userEventsList[e].forEach(function(e){e&&e.apply(t,i)})}},{key:"play",value:function(e){var t=this;t.player&&("youtube"===t.type&&t.player.playVideo&&(void 0!==e&&t.player.seekTo(e||0),d().YT.PlayerState.PLAYING!==t.player.getPlayerState()&&t.player.playVideo()),"vimeo"===t.type&&(void 0!==e&&t.player.setCurrentTime(e),t.player.getPaused().then(function(e){e&&t.player.play()})),"local"===t.type&&(void 0!==e&&(t.player.currentTime=e),t.player.paused&&t.player.play()))}},{key:"pause",value:function(){var t=this;t.player&&("youtube"===t.type&&t.player.pauseVideo&&d().YT.PlayerState.PLAYING===t.player.getPlayerState()&&t.player.pauseVideo(),"vimeo"===t.type&&t.player.getPaused().then(function(e){e||t.player.pause()}),"local"===t.type&&(t.player.paused||t.player.pause()))}},{key:"mute",value:function(){var e=this;e.player&&("youtube"===e.type&&e.player.mute&&e.player.mute(),"vimeo"===e.type&&e.player.setVolume&&e.player.setVolume(0),"local"===e.type&&(e.$video.muted=!0))}},{key:"unmute",value:function(){var e=this;e.player&&("youtube"===e.type&&e.player.mute&&e.player.unMute(),"vimeo"===e.type&&e.player.setVolume&&e.player.setVolume(e.options.volume),"local"===e.type&&(e.$video.muted=!1))}},{key:"setVolume",value:function(){var e=0<arguments.length&&void 0!==arguments[0]&&arguments[0],t=this;t.player&&e&&("youtube"===t.type&&t.player.setVolume&&t.player.setVolume(e),"vimeo"===t.type&&t.player.setVolume&&t.player.setVolume(e),"local"===t.type&&(t.$video.volume=e/100))}},{key:"getVolume",value:function(t){var e=this;e.player?("youtube"===e.type&&e.player.getVolume&&t(e.player.getVolume()),"vimeo"===e.type&&e.player.getVolume&&e.player.getVolume().then(function(e){t(e)}),"local"===e.type&&t(100*e.$video.volume)):t(!1)}},{key:"getMuted",value:function(t){var e=this;e.player?("youtube"===e.type&&e.player.isMuted&&t(e.player.isMuted()),"vimeo"===e.type&&e.player.getVolume&&e.player.getVolume().then(function(e){t(!!e)}),"local"===e.type&&t(e.$video.muted)):t(null)}},{key:"getImageURL",value:function(t){var e,o,i,n=this;n.videoImage?t(n.videoImage):("youtube"===n.type&&(e=["maxresdefault","sddefault","hqdefault","0"],o=0,(i=new Image).onload=function(){120!==(this.naturalWidth||this.width)||o===e.length-1?(n.videoImage="https://img.youtube.com/vi/".concat(n.videoID,"/").concat(e[o],".jpg"),t(n.videoImage)):(o+=1,this.src="https://img.youtube.com/vi/".concat(n.videoID,"/").concat(e[o],".jpg"))},i.src="https://img.youtube.com/vi/".concat(n.videoID,"/").concat(e[o],".jpg")),"vimeo"===n.type&&((i=new XMLHttpRequest).open("GET","https://vimeo.com/api/v2/video/".concat(n.videoID,".json"),!0),i.onreadystatechange=function(){var e;4===this.readyState&&200<=this.status&&this.status<400&&(e=JSON.parse(this.responseText),n.videoImage=e[0].thumbnail_large,t(n.videoImage))},i.send()))}},{key:"getIframe",value:function(e){this.getVideo(e)}},{key:"getVideo",value:function(s){var p=this;p.$video?s(p.$video):p.onAPIready(function(){var e,t,o,i,n,a,r,l;p.$video||((e=document.createElement("div")).style.display="none"),"youtube"===p.type&&(p.playerOptions={host:"https://www.youtube-nocookie.com",videoId:p.videoID,playerVars:{autohide:1,rel:0,autoplay:0,playsinline:1}},p.options.showControls||(p.playerOptions.playerVars.iv_load_policy=3,p.playerOptions.playerVars.modestbranding=1,p.playerOptions.playerVars.controls=0,p.playerOptions.playerVars.showinfo=0,p.playerOptions.playerVars.disablekb=1),p.playerOptions.events={onReady:function(t){p.options.mute?t.target.mute():p.options.volume&&t.target.setVolume(p.options.volume),p.options.autoplay&&p.play(p.options.startTime),p.fire("ready",t),p.options.loop&&!p.options.endTime&&(p.options.endTime=p.player.getDuration()-.1),setInterval(function(){p.getVolume(function(e){p.options.volume!==e&&(p.options.volume=e,p.fire("volumechange",t))})},150)},onStateChange:function(e){p.options.loop&&e.data===d().YT.PlayerState.ENDED&&p.play(p.options.startTime),t||e.data!==d().YT.PlayerState.PLAYING||(t=1,p.fire("started",e)),e.data===d().YT.PlayerState.PLAYING&&p.fire("play",e),e.data===d().YT.PlayerState.PAUSED&&p.fire("pause",e),e.data===d().YT.PlayerState.ENDED&&p.fire("ended",e),e.data===d().YT.PlayerState.PLAYING?o=setInterval(function(){p.fire("timeupdate",e),p.options.endTime&&p.player.getCurrentTime()>=p.options.endTime&&(p.options.loop?p.play(p.options.startTime):p.pause())},150):clearInterval(o)},onError:function(e){p.fire("error",e)}},(i=!p.$video)&&((n=document.createElement("div")).setAttribute("id",p.playerID),e.appendChild(n),document.body.appendChild(e)),p.player=p.player||new(d().YT.Player)(p.playerID,p.playerOptions),i&&(p.$video=document.getElementById(p.playerID),p.options.accessibilityHidden&&(p.$video.setAttribute("tabindex","-1"),p.$video.setAttribute("aria-hidden","true")),p.videoWidth=parseInt(p.$video.getAttribute("width"),10)||1280,p.videoHeight=parseInt(p.$video.getAttribute("height"),10)||720)),"vimeo"===p.type&&(p.playerOptions={dnt:1,id:p.videoID,autopause:0,transparent:0,autoplay:p.options.autoplay?1:0,loop:p.options.loop?1:0,muted:p.options.mute?1:0},p.options.volume&&(p.playerOptions.volume=p.options.volume),p.options.showControls||(p.playerOptions.badge=0,p.playerOptions.byline=0,p.playerOptions.portrait=0,p.playerOptions.title=0,p.playerOptions.background=1),p.$video||(a="",Object.keys(p.playerOptions).forEach(function(e){""!==a&&(a+="&"),a+="".concat(e,"=").concat(encodeURIComponent(p.playerOptions[e]))}),p.$video=document.createElement("iframe"),p.$video.setAttribute("id",p.playerID),p.$video.setAttribute("src","https://player.vimeo.com/video/".concat(p.videoID,"?").concat(a)),p.$video.setAttribute("frameborder","0"),p.$video.setAttribute("mozallowfullscreen",""),p.$video.setAttribute("allowfullscreen",""),p.$video.setAttribute("title","Vimeo video player"),p.options.accessibilityHidden&&(p.$video.setAttribute("tabindex","-1"),p.$video.setAttribute("aria-hidden","true")),e.appendChild(p.$video),document.body.appendChild(e)),p.player=p.player||new(d().Vimeo.Player)(p.$video,p.playerOptions),p.options.startTime&&p.options.autoplay&&p.player.setCurrentTime(p.options.startTime),p.player.getVideoWidth().then(function(e){p.videoWidth=e||1280}),p.player.getVideoHeight().then(function(e){p.videoHeight=e||720}),p.player.on("timeupdate",function(e){r||(p.fire("started",e),r=1),p.fire("timeupdate",e),p.options.endTime&&p.options.endTime&&e.seconds>=p.options.endTime&&(p.options.loop?p.play(p.options.startTime):p.pause())}),p.player.on("play",function(e){p.fire("play",e),p.options.startTime&&0===e.seconds&&p.play(p.options.startTime)}),p.player.on("pause",function(e){p.fire("pause",e)}),p.player.on("ended",function(e){p.fire("ended",e)}),p.player.on("loaded",function(e){p.fire("ready",e)}),p.player.on("volumechange",function(e){p.fire("volumechange",e)}),p.player.on("error",function(e){p.fire("error",e)})),"local"===p.type&&(p.$video||(p.$video=document.createElement("video"),p.options.showControls&&(p.$video.controls=!0),p.options.mute?p.$video.muted=!0:p.$video.volume&&(p.$video.volume=p.options.volume/100),p.options.loop&&(p.$video.loop=!0),p.$video.setAttribute("playsinline",""),p.$video.setAttribute("webkit-playsinline",""),p.options.accessibilityHidden&&(p.$video.setAttribute("tabindex","-1"),p.$video.setAttribute("aria-hidden","true")),p.$video.setAttribute("id",p.playerID),e.appendChild(p.$video),document.body.appendChild(e),Object.keys(p.videoID).forEach(function(e){var t,o,i;t=p.$video,o=p.videoID[e],i="video/".concat(e),(e=document.createElement("source")).src=o,e.type=i,t.appendChild(e)})),p.player=p.player||p.$video,p.player.addEventListener("playing",function(e){l||p.fire("started",e),l=1}),p.player.addEventListener("timeupdate",function(e){p.fire("timeupdate",e),p.options.endTime&&p.options.endTime&&this.currentTime>=p.options.endTime&&(p.options.loop?p.play(p.options.startTime):p.pause())}),p.player.addEventListener("play",function(e){p.fire("play",e)}),p.player.addEventListener("pause",function(e){p.fire("pause",e)}),p.player.addEventListener("ended",function(e){p.fire("ended",e)}),p.player.addEventListener("loadedmetadata",function(){p.videoWidth=this.videoWidth||1280,p.videoHeight=this.videoHeight||720,p.fire("ready"),p.options.autoplay&&p.play(p.options.startTime)}),p.player.addEventListener("volumechange",function(e){p.getVolume(function(e){p.options.volume=e}),p.fire("volumechange",e)}),p.player.addEventListener("error",function(e){p.fire("error",e)})),s(p.$video)})}},{key:"init",value:function(){this.playerID="VideoWorker-".concat(this.ID)}},{key:"loadAPI",value:function(){if(!l||!s){var e,t,o="";if("youtube"!==this.type||l||(l=1,o="https://www.youtube.com/iframe_api"),"vimeo"===this.type&&!s){if(s=1,void 0!==d().Vimeo)return;o="https://player.vimeo.com/api/player.js"}o&&(e=document.createElement("script"),t=document.getElementsByTagName("head")[0],e.src=o,t.appendChild(e),t=null)}}},{key:"onAPIready",value:function(e){var t;"youtube"===this.type&&(void 0!==d().YT&&0!==d().YT.loaded||p?"object"===n(d().YT)&&1===d().YT.loaded?e():c.done(function(){e()}):(p=1,window.onYouTubeIframeAPIReady=function(){window.onYouTubeIframeAPIReady=null,c.resolve("done"),e()})),"vimeo"===this.type&&(void 0!==d().Vimeo||u?void 0!==d().Vimeo?e():y.done(function(){e()}):(u=1,t=setInterval(function(){void 0!==d().Vimeo&&(clearInterval(t),y.resolve("done"),e())},20))),"local"===this.type&&e()}}])&&a(e.prototype,t),o&&a(e,o),i}()},function(e,t,o){"use strict";o.r(t),o.d(t,{default:function(){return i}});var a=o(5),t=o(2),r=o.n(t);function i(){var e,l,o,n,t,i=0<arguments.length&&void 0!==arguments[0]?arguments[0]:r().jarallax;void 0!==i&&(i=i.constructor,e=i.prototype.onScroll,i.prototype.onScroll=function(){var o=this;e.apply(o),o.isVideoInserted||!o.video||o.options.videoLazyLoading&&!o.isElementInViewport||o.options.disableVideo()||(o.isVideoInserted=!0,o.video.getVideo(function(e){var t=e.parentNode;o.css(e,{position:o.image.position,top:"0px",left:"0px",right:"0px",bottom:"0px",width:"100%",height:"100%",maxWidth:"none",maxHeight:"none",pointerEvents:"none",transformStyle:"preserve-3d",backfaceVisibility:"hidden",willChange:"transform,opacity",margin:0,zIndex:-1}),o.$video=e,"local"===o.video.type&&(o.image.src?o.$video.setAttribute("poster",o.image.src):o.image.$item&&"IMG"===o.image.$item.tagName&&o.image.$item.src&&o.$video.setAttribute("poster",o.image.$item.src)),o.image.$container.appendChild(e),t.parentNode.removeChild(t)}))},l=i.prototype.coverImage,i.prototype.coverImage=function(){var e,t,o,i,n=this,a=l.apply(n),r=!!n.image.$item&&n.image.$item.nodeName;return a&&n.video&&r&&("IFRAME"===r||"VIDEO"===r)&&(t=(e=a.image.height)*n.image.width/n.image.height,o=(a.container.width-t)/2,i=a.image.marginTop,a.container.width>t&&(e=(t=a.container.width)*n.image.height/n.image.width,o=0,i+=(a.image.height-e)/2),"IFRAME"===r&&(e+=400,i-=200),n.css(n.$video,{width:"".concat(t,"px"),marginLeft:"".concat(o,"px"),height:"".concat(e,"px"),marginTop:"".concat(i,"px")})),a},o=i.prototype.initImg,i.prototype.initImg=function(){var e=this,t=o.apply(e);return e.options.videoSrc||(e.options.videoSrc=e.$item.getAttribute("data-jarallax-video")||null),e.options.videoSrc?(e.defaultInitImgResult=t,!0):t},n=i.prototype.canInitParallax,i.prototype.canInitParallax=function(){var o=this,e=n.apply(o);if(!o.options.videoSrc)return e;var t=new a.default(o.options.videoSrc,{autoplay:!0,loop:o.options.videoLoop,showControls:!1,accessibilityHidden:!0,startTime:o.options.videoStartTime||0,endTime:o.options.videoEndTime||0,mute:o.options.videoVolume?0:1,volume:o.options.videoVolume||0});function i(){o.image.$default_item&&(o.image.$item=o.image.$default_item,o.image.$item.style.display="block",o.coverImage(),o.clipContainer(),o.onScroll())}if(t.isValid())if(this.options.disableParallax()&&(e=!0,o.image.position="absolute",o.options.type="scroll",o.options.speed=1),e){if(t.on("ready",function(){var e;o.options.videoPlayOnlyVisible?(e=o.onScroll,o.onScroll=function(){e.apply(o),o.videoError||!o.options.videoLoop&&(o.options.videoLoop||o.videoEnded)||(o.isVisible()?t.play():t.pause())}):t.play()}),t.on("started",function(){o.image.$default_item=o.image.$item,o.image.$item=o.$video,o.image.width=o.video.videoWidth||1280,o.image.height=o.video.videoHeight||720,o.coverImage(),o.clipContainer(),o.onScroll(),o.image.$default_item&&(o.image.$default_item.style.display="none")}),t.on("ended",function(){o.videoEnded=!0,o.options.videoLoop||i()}),t.on("error",function(){o.videoError=!0,i()}),o.video=t,!o.defaultInitImgResult&&(o.image.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7","local"!==t.type))return t.getImageURL(function(e){o.image.bgImage='url("'.concat(e,'")'),o.init()}),!1}else o.defaultInitImgResult||t.getImageURL(function(e){var t=o.$item.getAttribute("style");t&&o.$item.setAttribute("data-jarallax-original-styles",t),o.css(o.$item,{"background-image":'url("'.concat(e,'")'),"background-position":"center","background-size":"cover"})});return e},t=i.prototype.destroy,i.prototype.destroy=function(){var e=this;e.image.$default_item&&(e.image.$item=e.image.$default_item,delete e.image.$default_item),t.apply(e)})}}],i={};function n(e){var t=i[e];if(void 0!==t)return t.exports;t=i[e]={exports:{}};return o[e](t,t.exports,n),t.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};!function(){"use strict";n.r(a);var e=n(5),t=n(2),o=n.n(t),i=n(1),t=n.n(i),i=n(6);o().VideoWorker=o().VideoWorker||e.default,(0,i.default)(),t()(function(){void 0!==o().jarallax&&o().jarallax(document.querySelectorAll("[data-jarallax-video]"))})}()}(); 8712//# sourceMappingURL=jarallax-video.min.js.map 8713 8714 8715/***/ }), 8716
vendor: 15,040 bytes, lines 8717-8733
8717/***/ "./node_modules/jarallax/dist/jarallax.min.js": 8718/*!****************************************************!*\ 8719 !*** ./node_modules/jarallax/dist/jarallax.min.js ***! 8720 \****************************************************/ 8721/***/ (() => { 8722 8723/*! 8724 * Name : Just Another Parallax [Jarallax] 8725 * Version : 1.12.8 8726 * Author : nK <https://nkdev.info> 8727 * GitHub : https://github.com/nk-o/jarallax 8728 */!function(){var n={2:function(e,t,n){n="undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{};e.exports=n},1:function(e){e.exports=function(e){"complete"===document.readyState||"interactive"===document.readyState?e.call():document.attachEvent?document.attachEvent("onreadystatechange",function(){"interactive"===document.readyState&&e.call()}):document.addEventListener&&document.addEventListener("DOMContentLoaded",e)}},8:function(e,t,n){"use strict";n.r(t);var o=n(1),o=n.n(o),f=n(2);function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,i,a=[],r=!0,l=!1;try{for(n=n.call(e);!(r=(o=n.next()).done)&&(a.push(o.value),!t||a.length!==t);r=!0);}catch(e){l=!0,i=e}finally{try{r||null==n.return||n.return()}finally{if(l)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(n="Object"===n&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}var r,g,u=f.window.navigator,p=-1<u.userAgent.indexOf("MSIE ")||-1<u.userAgent.indexOf("Trident/")||-1<u.userAgent.indexOf("Edge/"),l=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(u.userAgent),m=function(){for(var e="transform WebkitTransform MozTransform".split(" "),t=document.createElement("div"),n=0;n<e.length;n+=1)if(t&&void 0!==t.style[e[n]])return e[n];return!1}();function d(){g=l?(!r&&document.body&&((r=document.createElement("div")).style.cssText="position: fixed; top: -9999px; left: 0; height: 100vh; width: 0;",document.body.appendChild(r)),(r?r.clientHeight:0)||f.window.innerHeight||document.documentElement.clientHeight):f.window.innerHeight||document.documentElement.clientHeight}d(),f.window.addEventListener("resize",d),f.window.addEventListener("orientationchange",d),f.window.addEventListener("load",d),o()(function(){d()});var y=[];function h(){y.length&&(y.forEach(function(e,t){var n=e.instance,o=e.oldData,i=n.$item.getBoundingClientRect(),e={width:i.width,height:i.height,top:i.top,bottom:i.bottom,wndW:f.window.innerWidth,wndH:g},i=!o||o.wndW!==e.wndW||o.wndH!==e.wndH||o.width!==e.width||o.height!==e.height,o=i||!o||o.top!==e.top||o.bottom!==e.bottom;y[t].oldData=e,i&&n.onResize(),o&&n.onScroll()}),f.window.requestAnimationFrame(h))}var b=0,v=function(){function l(e,t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,l);var n=this;n.instanceID=b,b+=1,n.$item=e,n.defaults={type:"scroll",speed:.5,imgSrc:null,imgElement:".jarallax-img",imgSize:"cover",imgPosition:"50% 50%",imgRepeat:"no-repeat",keepImg:!1,elementInViewport:null,zIndex:-100,disableParallax:!1,disableVideo:!1,videoSrc:null,videoStartTime:0,videoEndTime:0,videoVolume:0,videoLoop:!0,videoPlayOnlyVisible:!0,videoLazyLoading:!0,onScroll:null,onInit:null,onDestroy:null,onCoverImage:null};var o,i,a=n.$item.dataset||{},r={};Object.keys(a).forEach(function(e){var t=e.substr(0,1).toLowerCase()+e.substr(1);t&&void 0!==n.defaults[t]&&(r[t]=a[e])}),n.options=n.extend({},n.defaults,r,t),n.pureOptions=n.extend({},n.options),Object.keys(n.options).forEach(function(e){"true"===n.options[e]?n.options[e]=!0:"false"===n.options[e]&&(n.options[e]=!1)}),n.options.speed=Math.min(2,Math.max(-1,parseFloat(n.options.speed))),"string"==typeof n.options.disableParallax&&(n.options.disableParallax=new RegExp(n.options.disableParallax)),n.options.disableParallax instanceof RegExp&&(o=n.options.disableParallax,n.options.disableParallax=function(){return o.test(u.userAgent)}),"function"!=typeof n.options.disableParallax&&(n.options.disableParallax=function(){return!1}),"string"==typeof n.options.disableVideo&&(n.options.disableVideo=new RegExp(n.options.disableVideo)),n.options.disableVideo instanceof RegExp&&(i=n.options.disableVideo,n.options.disableVideo=function(){return i.test(u.userAgent)}),"function"!=typeof n.options.disableVideo&&(n.options.disableVideo=function(){return!1});t=n.options.elementInViewport;(t=t&&"object"===c(t)&&void 0!==t.length?s(t,1)[0]:t)instanceof Element||(t=null),n.options.elementInViewport=t,n.image={src:n.options.imgSrc||null,$container:null,useImgTag:!1,position:"fixed"},n.initImg()&&n.canInitParallax()&&n.init()}var e,t,n;return e=l,(t=[{key:"css",value:function(t,n){return"string"==typeof n?f.window.getComputedStyle(t).getPropertyValue(n):(n.transform&&m&&(n[m]=n.transform),Object.keys(n).forEach(function(e){t.style[e]=n[e]}),t)}},{key:"extend",value:function(n){for(var e=arguments.length,o=new Array(1<e?e-1:0),t=1;t<e;t++)o[t-1]=arguments[t];return n=n||{},Object.keys(o).forEach(function(t){o[t]&&Object.keys(o[t]).forEach(function(e){n[e]=o[t][e]})}),n}},{key:"getWindowData",value:function(){return{width:f.window.innerWidth||document.documentElement.clientWidth,height:g,y:document.documentElement.scrollTop}}},{key:"initImg",value:function(){var e=this,t=e.options.imgElement;return(t=t&&"string"==typeof t?e.$item.querySelector(t):t)instanceof Element||(e.options.imgSrc?(t=new Image).src=e.options.imgSrc:t=null),t&&(e.options.keepImg?e.image.$item=t.cloneNode(!0):(e.image.$item=t,e.image.$itemParent=t.parentNode),e.image.useImgTag=!0),!!e.image.$item||(null===e.image.src&&(e.image.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",e.image.bgImage=e.css(e.$item,"background-image")),!(!e.image.bgImage||"none"===e.image.bgImage))}},{key:"canInitParallax",value:function(){return m&&!this.options.disableParallax()}},{key:"init",value:function(){var e,t=this,n={position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"hidden"},o={pointerEvents:"none",transformStyle:"preserve-3d",backfaceVisibility:"hidden",willChange:"transform,opacity"};t.options.keepImg||((e=t.$item.getAttribute("style"))&&t.$item.setAttribute("data-jarallax-original-styles",e),!t.image.useImgTag||(e=t.image.$item.getAttribute("style"))&&t.image.$item.setAttribute("data-jarallax-original-styles",e)),"static"===t.css(t.$item,"position")&&t.css(t.$item,{position:"relative"}),"auto"===t.css(t.$item,"z-index")&&t.css(t.$item,{zIndex:0}),t.image.$container=document.createElement("div"),t.css(t.image.$container,n),t.css(t.image.$container,{"z-index":t.options.zIndex}),p&&t.css(t.image.$container,{opacity:.9999}),t.image.$container.setAttribute("id","jarallax-container-".concat(t.instanceID)),t.$item.appendChild(t.image.$container),t.image.useImgTag?o=t.extend({"object-fit":t.options.imgSize,"object-position":t.options.imgPosition,"font-family":"object-fit: ".concat(t.options.imgSize,"; object-position: ").concat(t.options.imgPosition,";"),"max-width":"none"},n,o):(t.image.$item=document.createElement("div"),t.image.src&&(o=t.extend({"background-position":t.options.imgPosition,"background-size":t.options.imgSize,"background-repeat":t.options.imgRepeat,"background-image":t.image.bgImage||'url("'.concat(t.image.src,'")')},n,o))),"opacity"!==t.options.type&&"scale"!==t.options.type&&"scale-opacity"!==t.options.type&&1!==t.options.speed||(t.image.position="absolute"),"fixed"===t.image.position&&(n=function(e){for(var t=[];null!==e.parentElement;)1===(e=e.parentElement).nodeType&&t.push(e);return t}(t.$item).filter(function(e){var t=f.window.getComputedStyle(e),e=t["-webkit-transform"]||t["-moz-transform"]||t.transform;return e&&"none"!==e||/(auto|scroll)/.test(t.overflow+t["overflow-y"]+t["overflow-x"])}),t.image.position=n.length?"absolute":"fixed"),o.position=t.image.position,t.css(t.image.$item,o),t.image.$container.appendChild(t.image.$item),t.onResize(),t.onScroll(!0),t.options.onInit&&t.options.onInit.call(t),"none"!==t.css(t.$item,"background-image")&&t.css(t.$item,{"background-image":"none"}),t.addToParallaxList()}},{key:"addToParallaxList",value:function(){y.push({instance:this}),1===y.length&&f.window.requestAnimationFrame(h)}},{key:"removeFromParallaxList",value:function(){var n=this;y.forEach(function(e,t){e.instance.instanceID===n.instanceID&&y.splice(t,1)})}},{key:"destroy",value:function(){var e=this;e.removeFromParallaxList();var t,n=e.$item.getAttribute("data-jarallax-original-styles");e.$item.removeAttribute("data-jarallax-original-styles"),n?e.$item.setAttribute("style",n):e.$item.removeAttribute("style"),e.image.useImgTag&&(t=e.image.$item.getAttribute("data-jarallax-original-styles"),e.image.$item.removeAttribute("data-jarallax-original-styles"),t?e.image.$item.setAttribute("style",n):e.image.$item.removeAttribute("style"),e.image.$itemParent&&e.image.$itemParent.appendChild(e.image.$item)),e.$clipStyles&&e.$clipStyles.parentNode.removeChild(e.$clipStyles),e.image.$container&&e.image.$container.parentNode.removeChild(e.image.$container),e.options.onDestroy&&e.options.onDestroy.call(e),delete e.$item.jarallax}},{key:"clipContainer",value:function(){var e,t,n;"fixed"===this.image.position&&(t=(n=(e=this).image.$container.getBoundingClientRect()).width,n=n.height,e.$clipStyles||(e.$clipStyles=document.createElement("style"),e.$clipStyles.setAttribute("type","text/css"),e.$clipStyles.setAttribute("id","jarallax-clip-".concat(e.instanceID)),(document.head||document.getElementsByTagName("head")[0]).appendChild(e.$clipStyles)),n="#jarallax-container-".concat(e.instanceID," {\n clip: rect(0 ").concat(t,"px ").concat(n,"px 0);\n clip: rect(0, ").concat(t,"px, ").concat(n,"px, 0);\n -webkit-clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);\n clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);\n }"),e.$clipStyles.styleSheet?e.$clipStyles.styleSheet.cssText=n:e.$clipStyles.innerHTML=n)}},{key:"coverImage",value:function(){var e=this,t=e.image.$container.getBoundingClientRect(),n=t.height,o=e.options.speed,i="scroll"===e.options.type||"scroll-opacity"===e.options.type,a=0,r=n,l=0;return i&&(o<0?(a=o*Math.max(n,g),g<n&&(a-=o*(n-g))):a=o*(n+g),1<o?r=Math.abs(a-g):o<0?r=a/o+Math.abs(a):r+=(g-n)*(1-o),a/=2),e.parallaxScrollDistance=a,l=i?(g-r)/2:(n-r)/2,e.css(e.image.$item,{height:"".concat(r,"px"),marginTop:"".concat(l,"px"),left:"fixed"===e.image.position?"".concat(t.left,"px"):"0",width:"".concat(t.width,"px")}),e.options.onCoverImage&&e.options.onCoverImage.call(e),{image:{height:r,marginTop:l},container:t}}},{key:"isVisible",value:function(){return this.isElementInViewport||!1}},{key:"onScroll",value:function(e){var t,n,o,i,a,r,l,s=this,c=s.$item.getBoundingClientRect(),u=c.top,p=c.height,m={},d=c;s.options.elementInViewport&&(d=s.options.elementInViewport.getBoundingClientRect()),s.isElementInViewport=0<=d.bottom&&0<=d.right&&d.top<=g&&d.left<=f.window.innerWidth,(e||s.isElementInViewport)&&(t=Math.max(0,u),n=Math.max(0,p+u),o=Math.max(0,-u),i=Math.max(0,u+p-g),a=Math.max(0,p-(u+p-g)),r=Math.max(0,-u+g-p),d=1-(g-u)/(g+p)*2,e=1,p<g?e=1-(o||i)/p:n<=g?e=n/g:a<=g&&(e=a/g),"opacity"!==s.options.type&&"scale-opacity"!==s.options.type&&"scroll-opacity"!==s.options.type||(m.transform="translate3d(0,0,0)",m.opacity=e),"scale"!==s.options.type&&"scale-opacity"!==s.options.type||(l=1,s.options.speed<0?l-=s.options.speed*e:l+=s.options.speed*(1-e),m.transform="scale(".concat(l,") translate3d(0,0,0)")),"scroll"!==s.options.type&&"scroll-opacity"!==s.options.type||(l=s.parallaxScrollDistance*d,"absolute"===s.image.position&&(l-=u),m.transform="translate3d(0,".concat(l,"px,0)")),s.css(s.image.$item,m),s.options.onScroll&&s.options.onScroll.call(s,{section:c,beforeTop:t,beforeTopEnd:n,afterTop:o,beforeBottom:i,beforeBottomEnd:a,afterBottom:r,visiblePercent:e,fromViewportCenter:d}))}},{key:"onResize",value:function(){this.coverImage(),this.clipContainer()}}])&&a(e.prototype,t),n&&a(e,n),l}(),o=function(e,t){for(var n,o=(e=("object"===("undefined"==typeof HTMLElement?"undefined":c(HTMLElement))?e instanceof HTMLElement:e&&"object"===c(e)&&null!==e&&1===e.nodeType&&"string"==typeof e.nodeName)?[e]:e).length,i=0,a=arguments.length,r=new Array(2<a?a-2:0),l=2;l<a;l++)r[l-2]=arguments[l];for(;i<o;i+=1)if("object"===c(t)||void 0===t?e[i].jarallax||(e[i].jarallax=new v(e[i],t)):e[i].jarallax&&(n=e[i].jarallax[t].apply(e[i].jarallax,r)),void 0!==n)return n;return e};o.constructor=v,t.default=o}},o={};function l(e){var t=o[e];if(void 0!==t)return t.exports;t=o[e]={exports:{}};return n[e](t,t.exports,l),t.exports}l.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(t,{a:t}),t},l.d=function(e,t){for(var n in t)l.o(t,n)&&!l.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},l.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),l.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var s={};!function(){"use strict";l.r(s);var e=l(1),t=l.n(e),i=l(2),a=l(8);function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var n,o=i.window.jarallax;i.window.jarallax=a.default,i.window.jarallax.noConflict=function(){return i.window.jarallax=o,this},void 0!==i.jQuery&&((e=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];Array.prototype.unshift.call(t,this);var o=a.default.apply(i.window,t);return"object"!==r(o)?o:this}).constructor=a.default.constructor,n=i.jQuery.fn.jarallax,i.jQuery.fn.jarallax=e,i.jQuery.fn.jarallax.noConflict=function(){return i.jQuery.fn.jarallax=n,this}),t()(function(){(0,a.default)(document.querySelectorAll("[data-jarallax]"))})}()}(); 8729//# sourceMappingURL=jarallax.min.js.map 8730 8731 8732/***/ }), 8733
vendor: 10,804 bytes, lines 8734-8989
8734/***/ "./node_modules/jquery-countdown/dist/jquery.countdown.js": 8735/*!****************************************************************!*\ 8736 !*** ./node_modules/jquery-countdown/dist/jquery.countdown.js ***! 8737 \****************************************************************/ 8738/***/ ((module, exports, __webpack_require__) => { 8739 8740var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! 8741 * The Final Countdown for jQuery v2.2.0 (http://hilios.github.io/jQuery.countdown/) 8742 * Copyright (c) 2016 Edson Hilios 8743 * 8744 * Permission is hereby granted, free of charge, to any person obtaining a copy of 8745 * this software and associated documentation files (the "Software"), to deal in 8746 * the Software without restriction, including without limitation the rights to 8747 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 8748 * the Software, and to permit persons to whom the Software is furnished to do so, 8749 * subject to the following conditions: 8750 * 8751 * The above copyright notice and this permission notice shall be included in all 8752 * copies or substantial portions of the Software. 8753 * 8754 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 8755 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 8756 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 8757 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 8758 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 8759 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8760 */ 8761(function(factory) { 8762 "use strict"; 8763 if (true) { 8764 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js") ], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), 8765 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? 8766 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), 8767 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 8768 } else {} 8769})(function($) { 8770 "use strict"; 8771 var instances = [], matchers = [], defaultOptions = { 8772 precision: 100, 8773 elapse: false, 8774 defer: false 8775 }; 8776 matchers.push(/^[0-9]*$/.source); 8777 matchers.push(/([0-9]{1,2}\/){2}[0-9]{4}( [0-9]{1,2}(:[0-9]{2}){2})?/.source); 8778 matchers.push(/[0-9]{4}([\/\-][0-9]{1,2}){2}( [0-9]{1,2}(:[0-9]{2}){2})?/.source); 8779 matchers = new RegExp(matchers.join("|")); 8780 function parseDateString(dateString) { 8781 if (dateString instanceof Date) { 8782 return dateString; 8783 } 8784 if (String(dateString).match(matchers)) { 8785 if (String(dateString).match(/^[0-9]*$/)) { 8786 dateString = Number(dateString); 8787 } 8788 if (String(dateString).match(/\-/)) { 8789 dateString = String(dateString).replace(/\-/g, "/"); 8790 } 8791 return new Date(dateString); 8792 } else { 8793 throw new Error("Couldn't cast `" + dateString + "` to a date object."); 8794 } 8795 } 8796 var DIRECTIVE_KEY_MAP = { 8797 Y: "years", 8798 m: "months", 8799 n: "daysToMonth", 8800 d: "daysToWeek", 8801 w: "weeks", 8802 W: "weeksToMonth", 8803 H: "hours", 8804 M: "minutes", 8805 S: "seconds", 8806 D: "totalDays", 8807 I: "totalHours", 8808 N: "totalMinutes", 8809 T: "totalSeconds" 8810 }; 8811 function escapedRegExp(str) { 8812 var sanitize = str.toString().replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1"); 8813 return new RegExp(sanitize); 8814 } 8815 function strftime(offsetObject) { 8816 return function(format) { 8817 var directives = format.match(/%(-|!)?[A-Z]{1}(:[^;]+;)?/gi); 8818 if (directives) { 8819 for (var i = 0, len = directives.length; i < len; ++i) { 8820 var directive = directives[i].match(/%(-|!)?([a-zA-Z]{1})(:[^;]+;)?/), regexp = escapedRegExp(directive[0]), modifier = directive[1] || "", plural = directive[3] || "", value = null; 8821 directive = directive[2]; 8822 if (DIRECTIVE_KEY_MAP.hasOwnProperty(directive)) { 8823 value = DIRECTIVE_KEY_MAP[directive]; 8824 value = Number(offsetObject[value]); 8825 } 8826 if (value !== null) { 8827 if (modifier === "!") { 8828 value = pluralize(plural, value); 8829 } 8830 if (modifier === "") { 8831 if (value < 10) { 8832 value = "0" + value.toString(); 8833 } 8834 } 8835 format = format.replace(regexp, value.toString()); 8836 } 8837 } 8838 } 8839 format = format.replace(/%%/, "%"); 8840 return format; 8841 }; 8842 } 8843 function pluralize(format, count) { 8844 var plural = "s", singular = ""; 8845 if (format) { 8846 format = format.replace(/(:|;|\s)/gi, "").split(/\,/); 8847 if (format.length === 1) { 8848 plural = format[0]; 8849 } else { 8850 singular = format[0]; 8851 plural = format[1]; 8852 } 8853 } 8854 if (Math.abs(count) > 1) { 8855 return plural; 8856 } else { 8857 return singular; 8858 } 8859 } 8860 var Countdown = function(el, finalDate, options) { 8861 this.el = el; 8862 this.$el = $(el); 8863 this.interval = null; 8864 this.offset = {}; 8865 this.options = $.extend({}, defaultOptions); 8866 this.instanceNumber = instances.length; 8867 instances.push(this); 8868 this.$el.data("countdown-instance", this.instanceNumber); 8869 if (options) { 8870 if (typeof options === "function") { 8871 this.$el.on("update.countdown", options); 8872 this.$el.on("stoped.countdown", options); 8873 this.$el.on("finish.countdown", options); 8874 } else { 8875 this.options = $.extend({}, defaultOptions, options); 8876 } 8877 } 8878 this.setFinalDate(finalDate); 8879 if (this.options.defer === false) { 8880 this.start(); 8881 } 8882 }; 8883 $.extend(Countdown.prototype, { 8884 start: function() { 8885 if (this.interval !== null) { 8886 clearInterval(this.interval); 8887 } 8888 var self = this; 8889 this.update(); 8890 this.interval = setInterval(function() { 8891 self.update.call(self); 8892 }, this.options.precision); 8893 }, 8894 stop: function() { 8895 clearInterval(this.interval); 8896 this.interval = null; 8897 this.dispatchEvent("stoped"); 8898 }, 8899 toggle: function() { 8900 if (this.interval) { 8901 this.stop(); 8902 } else { 8903 this.start(); 8904 } 8905 }, 8906 pause: function() { 8907 this.stop(); 8908 }, 8909 resume: function() { 8910 this.start(); 8911 }, 8912 remove: function() { 8913 this.stop.call(this); 8914 instances[this.instanceNumber] = null; 8915 delete this.$el.data().countdownInstance; 8916 }, 8917 setFinalDate: function(value) { 8918 this.finalDate = parseDateString(value); 8919 }, 8920 update: function() { 8921 if (this.$el.closest("html").length === 0) { 8922 this.remove(); 8923 return; 8924 } 8925 var hasEventsAttached = $._data(this.el, "events") !== undefined, now = new Date(), newTotalSecsLeft; 8926 newTotalSecsLeft = this.finalDate.getTime() - now.getTime(); 8927 newTotalSecsLeft = Math.ceil(newTotalSecsLeft / 1e3); 8928 newTotalSecsLeft = !this.options.elapse && newTotalSecsLeft < 0 ? 0 : Math.abs(newTotalSecsLeft); 8929 if (this.totalSecsLeft === newTotalSecsLeft || !hasEventsAttached) { 8930 return; 8931 } else { 8932 this.totalSecsLeft = newTotalSecsLeft; 8933 } 8934 this.elapsed = now >= this.finalDate; 8935 this.offset = { 8936 seconds: this.totalSecsLeft % 60, 8937 minutes: Math.floor(this.totalSecsLeft / 60) % 60, 8938 hours: Math.floor(this.totalSecsLeft / 60 / 60) % 24, 8939 days: Math.floor(this.totalSecsLeft / 60 / 60 / 24) % 7, 8940 daysToWeek: Math.floor(this.totalSecsLeft / 60 / 60 / 24) % 7, 8941 daysToMonth: Math.floor(this.totalSecsLeft / 60 / 60 / 24 % 30.4368), 8942 weeks: Math.floor(this.totalSecsLeft / 60 / 60 / 24 / 7), 8943 weeksToMonth: Math.floor(this.totalSecsLeft / 60 / 60 / 24 / 7) % 4, 8944 months: Math.floor(this.totalSecsLeft / 60 / 60 / 24 / 30.4368), 8945 years: Math.abs(this.finalDate.getFullYear() - now.getFullYear()), 8946 totalDays: Math.floor(this.totalSecsLeft / 60 / 60 / 24), 8947 totalHours: Math.floor(this.totalSecsLeft / 60 / 60), 8948 totalMinutes: Math.floor(this.totalSecsLeft / 60), 8949 totalSeconds: this.totalSecsLeft 8950 }; 8951 if (!this.options.elapse && this.totalSecsLeft === 0) { 8952 this.stop(); 8953 this.dispatchEvent("finish"); 8954 } else { 8955 this.dispatchEvent("update"); 8956 } 8957 }, 8958 dispatchEvent: function(eventName) { 8959 var event = $.Event(eventName + ".countdown"); 8960 event.finalDate = this.finalDate; 8961 event.elapsed = this.elapsed; 8962 event.offset = $.extend({}, this.offset); 8963 event.strftime = strftime(this.offset); 8964 this.$el.trigger(event); 8965 } 8966 }); 8967 $.fn.countdown = function() { 8968 var argumentsArray = Array.prototype.slice.call(arguments, 0); 8969 return this.each(function() { 8970 var instanceNumber = $(this).data("countdown-instance"); 8971 if (instanceNumber !== undefined) { 8972 var instance = instances[instanceNumber], method = argumentsArray[0]; 8973 if (Countdown.prototype.hasOwnProperty(method)) { 8974 instance[method].apply(instance, argumentsArray.slice(1)); 8975 } else if (String(method).match(/^[$A-Z_][0-9A-Z_$]*$/i) === null) { 8976 instance.setFinalDate.call(instance, method); 8977 instance.start(); 8978 } else { 8979 $.error("Method %s does not exist on jQuery.countdown".replace(/\%s/gi, method)); 8980 } 8981 } else { 8982 new Countdown(this, argumentsArray[0], argumentsArray[1]); 8983 } 8984 }); 8985 }; 8986}); 8987 8988/***/ }), 8989
vendor: 127,891 bytes, lines 8990-13806
8990/***/ "./node_modules/jquery.photoswipe/dist/jquery.photoswipe-global.js": 8991/*!*************************************************************************!*\ 8992 !*** ./node_modules/jquery.photoswipe/dist/jquery.photoswipe-global.js ***! 8993 \*************************************************************************/ 8994/***/ ((module, exports, __webpack_require__) => { 8995 8996var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=undefined;if(!u&&a)return require(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=undefined;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ 8997/*! PhotoSwipe - v4.1.1 - 2015-12-24 8998* http://photoswipe.com 8999* Copyright (c) 2015 Dmitry Semenov; */ 9000(function (root, factory) { 9001 if (true) { 9002 !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory), 9003 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? 9004 (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : 9005 __WEBPACK_AMD_DEFINE_FACTORY__), 9006 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 9007 } else {} 9008})(this, function () { 9009 9010 'use strict'; 9011 var PhotoSwipe = function(template, UiClass, items, options){ 9012 9013/*>>framework-bridge*/ 9014/** 9015 * 9016 * Set of generic functions used by gallery. 9017 * 9018 * You're free to modify anything here as long as functionality is kept. 9019 * 9020 */ 9021var framework = { 9022 features: null, 9023 bind: function(target, type, listener, unbind) { 9024 var methodName = (unbind ? 'remove' : 'add') + 'EventListener'; 9025 type = type.split(' '); 9026 for(var i = 0; i < type.length; i++) { 9027 if(type[i]) { 9028 target[methodName]( type[i], listener, false); 9029 } 9030 } 9031 }, 9032 isArray: function(obj) { 9033 return (obj instanceof Array); 9034 }, 9035 createEl: function(classes, tag) { 9036 var el = document.createElement(tag || 'div'); 9037 if(classes) { 9038 el.className = classes; 9039 } 9040 return el; 9041 }, 9042 getScrollY: function() { 9043 var yOffset = window.pageYOffset; 9044 return yOffset !== undefined ? yOffset : document.documentElement.scrollTop; 9045 }, 9046 unbind: function(target, type, listener) { 9047 framework.bind(target,type,listener,true); 9048 }, 9049 removeClass: function(el, className) { 9050 var reg = new RegExp('(\\s|^)' + className + '(\\s|$)'); 9051 el.className = el.className.replace(reg, ' ').replace(/^\s\s*/, '').replace(/\s\s*$/, ''); 9052 }, 9053 addClass: function(el, className) { 9054 if( !framework.hasClass(el,className) ) { 9055 el.className += (el.className ? ' ' : '') + className; 9056 } 9057 }, 9058 hasClass: function(el, className) { 9059 return el.className && new RegExp('(^|\\s)' + className + '(\\s|$)').test(el.className); 9060 }, 9061 getChildByClass: function(parentEl, childClassName) { 9062 var node = parentEl.firstChild; 9063 while(node) { 9064 if( framework.hasClass(node, childClassName) ) { 9065 return node; 9066 } 9067 node = node.nextSibling; 9068 } 9069 }, 9070 arraySearch: function(array, value, key) { 9071 var i = array.length; 9072 while(i--) { 9073 if(array[i][key] === value) { 9074 return i; 9075 } 9076 } 9077 return -1; 9078 }, 9079 extend: function(o1, o2, preventOverwrite) { 9080 for (var prop in o2) { 9081 if (o2.hasOwnProperty(prop)) { 9082 if(preventOverwrite && o1.hasOwnProperty(prop)) { 9083 continue; 9084 } 9085 o1[prop] = o2[prop]; 9086 } 9087 } 9088 }, 9089 easing: { 9090 sine: { 9091 out: function(k) { 9092 return Math.sin(k * (Math.PI / 2)); 9093 }, 9094 inOut: function(k) { 9095 return - (Math.cos(Math.PI * k) - 1) / 2; 9096 } 9097 }, 9098 cubic: { 9099 out: function(k) { 9100 return --k * k * k + 1; 9101 } 9102 } 9103 /* 9104 elastic: { 9105 out: function ( k ) { 9106 9107 var s, a = 0.1, p = 0.4; 9108 if ( k === 0 ) return 0; 9109 if ( k === 1 ) return 1; 9110 if ( !a || a < 1 ) { a = 1; s = p / 4; } 9111 else s = p * Math.asin( 1 / a ) / ( 2 * Math.PI ); 9112 return ( a * Math.pow( 2, - 10 * k) * Math.sin( ( k - s ) * ( 2 * Math.PI ) / p ) + 1 ); 9113 9114 }, 9115 }, 9116 back: { 9117 out: function ( k ) { 9118 var s = 1.70158; 9119 return --k * k * ( ( s + 1 ) * k + s ) + 1; 9120 } 9121 } 9122 */ 9123 }, 9124 9125 /** 9126 * 9127 * @return {object} 9128 * 9129 * { 9130 * raf : request animation frame function 9131 * caf : cancel animation frame function 9132 * transfrom : transform property key (with vendor), or null if not supported 9133 * oldIE : IE8 or below 9134 * } 9135 * 9136 */ 9137 detectFeatures: function() { 9138 if(framework.features) { 9139 return framework.features; 9140 } 9141 var helperEl = framework.createEl(), 9142 helperStyle = helperEl.style, 9143 vendor = '', 9144 features = {}; 9145 9146 // IE8 and below 9147 features.oldIE = document.all && !document.addEventListener; 9148 9149 features.touch = 'ontouchstart' in window; 9150 9151 if(window.requestAnimationFrame) { 9152 features.raf = window.requestAnimationFrame; 9153 features.caf = window.cancelAnimationFrame; 9154 } 9155 9156 features.pointerEvent = navigator.pointerEnabled || navigator.msPointerEnabled; 9157 9158 // fix false-positive detection of old Android in new IE 9159 // (IE11 ua string contains "Android 4.0") 9160 9161 if(!features.pointerEvent) { 9162 9163 var ua = navigator.userAgent; 9164 9165 // Detect if device is iPhone or iPod and if it's older than iOS 8 9166 // http://stackoverflow.com/a/14223920 9167 // 9168 // This detection is made because of buggy top/bottom toolbars 9169 // that don't trigger window.resize event. 9170 // For more info refer to _isFixedPosition variable in core.js 9171 9172 if (/iP(hone|od)/.test(navigator.platform)) { 9173 var v = (navigator.appVersion).match(/OS (\d+)_(\d+)_?(\d+)?/); 9174 if(v && v.length > 0) { 9175 v = parseInt(v[1], 10); 9176 if(v >= 1 && v < 8 ) { 9177 features.isOldIOSPhone = true; 9178 } 9179 } 9180 } 9181 9182 // Detect old Android (before KitKat) 9183 // due to bugs related to position:fixed 9184 // http://stackoverflow.com/questions/7184573/pick-up-the-android-version-in-the-browser-by-javascript 9185 9186 var match = ua.match(/Android\s([0-9\.]*)/); 9187 var androidversion = match ? match[1] : 0; 9188 androidversion = parseFloat(androidversion); 9189 if(androidversion >= 1 ) { 9190 if(androidversion < 4.4) { 9191 features.isOldAndroid = true; // for fixed position bug & performance 9192 } 9193 features.androidVersion = androidversion; // for touchend bug 9194 } 9195 features.isMobileOpera = /opera mini|opera mobi/i.test(ua); 9196 9197 // p.s. yes, yes, UA sniffing is bad, propose your solution for above bugs. 9198 } 9199 9200 var styleChecks = ['transform', 'perspective', 'animationName'], 9201 vendors = ['', 'webkit','Moz','ms','O'], 9202 styleCheckItem, 9203 styleName; 9204 9205 for(var i = 0; i < 4; i++) { 9206 vendor = vendors[i]; 9207 9208 for(var a = 0; a < 3; a++) { 9209 styleCheckItem = styleChecks[a]; 9210 9211 // uppercase first letter of property name, if vendor is present 9212 styleName = vendor + (vendor ? 9213 styleCheckItem.charAt(0).toUpperCase() + styleCheckItem.slice(1) : 9214 styleCheckItem); 9215 9216 if(!features[styleCheckItem] && styleName in helperStyle ) { 9217 features[styleCheckItem] = styleName; 9218 } 9219 } 9220 9221 if(vendor && !features.raf) { 9222 vendor = vendor.toLowerCase(); 9223 features.raf = window[vendor+'RequestAnimationFrame']; 9224 if(features.raf) { 9225 features.caf = window[vendor+'CancelAnimationFrame'] || 9226 window[vendor+'CancelRequestAnimationFrame']; 9227 } 9228 } 9229 } 9230 9231 if(!features.raf) { 9232 var lastTime = 0; 9233 features.raf = function(fn) { 9234 var currTime = new Date().getTime(); 9235 var timeToCall = Math.max(0, 16 - (currTime - lastTime)); 9236 var id = window.setTimeout(function() { fn(currTime + timeToCall); }, timeToCall); 9237 lastTime = currTime + timeToCall; 9238 return id; 9239 }; 9240 features.caf = function(id) { clearTimeout(id); }; 9241 } 9242 9243 // Detect SVG support 9244 features.svg = !!document.createElementNS && 9245 !!document.createElementNS('http://www.w3.org/2000/svg', 'svg').createSVGRect; 9246 9247 framework.features = features; 9248 9249 return features; 9250 } 9251}; 9252 9253framework.detectFeatures(); 9254 9255// Override addEventListener for old versions of IE 9256if(framework.features.oldIE) { 9257 9258 framework.bind = function(target, type, listener, unbind) { 9259 9260 type = type.split(' '); 9261 9262 var methodName = (unbind ? 'detach' : 'attach') + 'Event', 9263 evName, 9264 _handleEv = function() { 9265 listener.handleEvent.call(listener); 9266 }; 9267 9268 for(var i = 0; i < type.length; i++) { 9269 evName = type[i]; 9270 if(evName) { 9271 9272 if(typeof listener === 'object' && listener.handleEvent) { 9273 if(!unbind) { 9274 listener['oldIE' + evName] = _handleEv; 9275 } else { 9276 if(!listener['oldIE' + evName]) { 9277 return false; 9278 } 9279 } 9280 9281 target[methodName]( 'on' + evName, listener['oldIE' + evName]); 9282 } else { 9283 target[methodName]( 'on' + evName, listener); 9284 } 9285 9286 } 9287 } 9288 }; 9289 9290} 9291 9292/*>>framework-bridge*/ 9293 9294/*>>core*/ 9295//function(template, UiClass, items, options) 9296 9297var self = this; 9298 9299/** 9300 * Static vars, don't change unless you know what you're doing. 9301 */ 9302var DOUBLE_TAP_RADIUS = 25, 9303 NUM_HOLDERS = 3; 9304 9305/** 9306 * Options 9307 */ 9308var _options = { 9309 allowPanToNext:true, 9310 spacing: 0.12, 9311 bgOpacity: 1, 9312 mouseUsed: false, 9313 loop: true, 9314 pinchToClose: true, 9315 closeOnScroll: true, 9316 closeOnVerticalDrag: true, 9317 verticalDragRange: 0.75, 9318 hideAnimationDuration: 333, 9319 showAnimationDuration: 333, 9320 showHideOpacity: false, 9321 focus: true, 9322 escKey: true, 9323 arrowKeys: true, 9324 mainScrollEndFriction: 0.35, 9325 panEndFriction: 0.35, 9326 isClickableElement: function(el) { 9327 return el.tagName === 'A'; 9328 }, 9329 getDoubleTapZoom: function(isMouseClick, item) { 9330 if(isMouseClick) { 9331 return 1; 9332 } else { 9333 return item.initialZoomLevel < 0.7 ? 1 : 1.33; 9334 } 9335 }, 9336 maxSpreadZoom: 1.33, 9337 modal: true, 9338 9339 // not fully implemented yet 9340 scaleMode: 'fit' // TODO 9341}; 9342framework.extend(_options, options); 9343 9344 9345/** 9346 * Private helper variables & functions 9347 */ 9348 9349var _getEmptyPoint = function() { 9350 return {x:0,y:0}; 9351 }; 9352 9353var _isOpen, 9354 _isDestroying, 9355 _closedByScroll, 9356 _currentItemIndex, 9357 _containerStyle, 9358 _containerShiftIndex, 9359 _currPanDist = _getEmptyPoint(), 9360 _startPanOffset = _getEmptyPoint(), 9361 _panOffset = _getEmptyPoint(), 9362 _upMoveEvents, // drag move, drag end & drag cancel events array 9363 _downEvents, // drag start events array 9364 _globalEventHandlers, 9365 _viewportSize = {}, 9366 _currZoomLevel, 9367 _startZoomLevel, 9368 _translatePrefix, 9369 _translateSufix, 9370 _updateSizeInterval, 9371 _itemsNeedUpdate, 9372 _currPositionIndex = 0, 9373 _offset = {}, 9374 _slideSize = _getEmptyPoint(), // size of slide area, including spacing 9375 _itemHolders, 9376 _prevItemIndex, 9377 _indexDiff = 0, // difference of indexes since last content update 9378 _dragStartEvent, 9379 _dragMoveEvent, 9380 _dragEndEvent, 9381 _dragCancelEvent, 9382 _transformKey, 9383 _pointerEventEnabled, 9384 _isFixedPosition = true, 9385 _likelyTouchDevice, 9386 _modules = [], 9387 _requestAF, 9388 _cancelAF, 9389 _initalClassName, 9390 _initalWindowScrollY, 9391 _oldIE, 9392 _currentWindowScrollY, 9393 _features, 9394 _windowVisibleSize = {}, 9395 _renderMaxResolution = false, 9396 9397 // Registers PhotoSWipe module (History, Controller ...) 9398 _registerModule = function(name, module) { 9399 framework.extend(self, module.publicMethods); 9400 _modules.push(name); 9401 }, 9402 9403 _getLoopedId = function(index) { 9404 var numSlides = _getNumItems(); 9405 if(index > numSlides - 1) { 9406 return index - numSlides; 9407 } else if(index < 0) { 9408 return numSlides + index; 9409 } 9410 return index; 9411 }, 9412 9413 // Micro bind/trigger 9414 _listeners = {}, 9415 _listen = function(name, fn) { 9416 if(!_listeners[name]) { 9417 _listeners[name] = []; 9418 } 9419 return _listeners[name].push(fn); 9420 }, 9421 _shout = function(name) { 9422 var listeners = _listeners[name]; 9423 9424 if(listeners) { 9425 var args = Array.prototype.slice.call(arguments); 9426 args.shift(); 9427 9428 for(var i = 0; i < listeners.length; i++) { 9429 listeners[i].apply(self, args); 9430 } 9431 } 9432 }, 9433 9434 _getCurrentTime = function() { 9435 return new Date().getTime(); 9436 }, 9437 _applyBgOpacity = function(opacity) { 9438 _bgOpacity = opacity; 9439 self.bg.style.opacity = opacity * _options.bgOpacity; 9440 }, 9441 9442 _applyZoomTransform = function(styleObj,x,y,zoom,item) { 9443 if(!_renderMaxResolution || (item && item !== self.currItem) ) { 9444 zoom = zoom / (item ? item.fitRatio : self.currItem.fitRatio); 9445 } 9446 9447 styleObj[_transformKey] = _translatePrefix + x + 'px, ' + y + 'px' + _translateSufix + ' scale(' + zoom + ')'; 9448 }, 9449 _applyCurrentZoomPan = function( allowRenderResolution ) { 9450 if(_currZoomElementStyle) { 9451 9452 if(allowRenderResolution) { 9453 if(_currZoomLevel > self.currItem.fitRatio) { 9454 if(!_renderMaxResolution) { 9455 _setImageSize(self.currItem, false, true); 9456 _renderMaxResolution = true; 9457 } 9458 } else { 9459 if(_renderMaxResolution) { 9460 _setImageSize(self.currItem); 9461 _renderMaxResolution = false; 9462 } 9463 } 9464 } 9465 9466 9467 _applyZoomTransform(_currZoomElementStyle, _panOffset.x, _panOffset.y, _currZoomLevel); 9468 } 9469 }, 9470 _applyZoomPanToItem = function(item) { 9471 if(item.container) { 9472 9473 _applyZoomTransform(item.container.style, 9474 item.initialPosition.x, 9475 item.initialPosition.y, 9476 item.initialZoomLevel, 9477 item); 9478 } 9479 }, 9480 _setTranslateX = function(x, elStyle) { 9481 elStyle[_transformKey] = _translatePrefix + x + 'px, 0px' + _translateSufix; 9482 }, 9483 _moveMainScroll = function(x, dragging) { 9484 9485 if(!_options.loop && dragging) { 9486 var newSlideIndexOffset = _currentItemIndex + (_slideSize.x * _currPositionIndex - x) / _slideSize.x, 9487 delta = Math.round(x - _mainScrollPos.x); 9488 9489 if( (newSlideIndexOffset < 0 && delta > 0) || 9490 (newSlideIndexOffset >= _getNumItems() - 1 && delta < 0) ) { 9491 x = _mainScrollPos.x + delta * _options.mainScrollEndFriction; 9492 } 9493 } 9494 9495 _mainScrollPos.x = x; 9496 _setTranslateX(x, _containerStyle); 9497 }, 9498 _calculatePanOffset = function(axis, zoomLevel) { 9499 var m = _midZoomPoint[axis] - _offset[axis]; 9500 return _startPanOffset[axis] + _currPanDist[axis] + m - m * ( zoomLevel / _startZoomLevel ); 9501 }, 9502 9503 _equalizePoints = function(p1, p2) { 9504 p1.x = p2.x; 9505 p1.y = p2.y; 9506 if(p2.id) { 9507 p1.id = p2.id; 9508 } 9509 }, 9510 _roundPoint = function(p) { 9511 p.x = Math.round(p.x); 9512 p.y = Math.round(p.y); 9513 }, 9514 9515 _mouseMoveTimeout = null, 9516 _onFirstMouseMove = function() { 9517 // Wait until mouse move event is fired at least twice during 100ms 9518 // We do this, because some mobile browsers trigger it on touchstart 9519 if(_mouseMoveTimeout ) { 9520 framework.unbind(document, 'mousemove', _onFirstMouseMove); 9521 framework.addClass(template, 'pswp--has_mouse'); 9522 _options.mouseUsed = true; 9523 _shout('mouseUsed'); 9524 } 9525 _mouseMoveTimeout = setTimeout(function() { 9526 _mouseMoveTimeout = null; 9527 }, 100); 9528 }, 9529 9530 _bindEvents = function() { 9531 framework.bind(document, 'keydown', self); 9532 9533 if(_features.transform) { 9534 // don't bind click event in browsers that don't support transform (mostly IE8) 9535 framework.bind(self.scrollWrap, 'click', self); 9536 } 9537 9538 9539 if(!_options.mouseUsed) { 9540 framework.bind(document, 'mousemove', _onFirstMouseMove); 9541 } 9542 9543 framework.bind(window, 'resize scroll', self); 9544 9545 _shout('bindEvents'); 9546 }, 9547 9548 _unbindEvents = function() { 9549 framework.unbind(window, 'resize', self); 9550 framework.unbind(window, 'scroll', _globalEventHandlers.scroll); 9551 framework.unbind(document, 'keydown', self); 9552 framework.unbind(document, 'mousemove', _onFirstMouseMove); 9553 9554 if(_features.transform) { 9555 framework.unbind(self.scrollWrap, 'click', self); 9556 } 9557 9558 if(_isDragging) { 9559 framework.unbind(window, _upMoveEvents, self); 9560 } 9561 9562 _shout('unbindEvents'); 9563 }, 9564 9565 _calculatePanBounds = function(zoomLevel, update) { 9566 var bounds = _calculateItemSize( self.currItem, _viewportSize, zoomLevel ); 9567 if(update) { 9568 _currPanBounds = bounds; 9569 } 9570 return bounds; 9571 }, 9572 9573 _getMinZoomLevel = function(item) { 9574 if(!item) { 9575 item = self.currItem; 9576 } 9577 return item.initialZoomLevel; 9578 }, 9579 _getMaxZoomLevel = function(item) { 9580 if(!item) { 9581 item = self.currItem; 9582 } 9583 return item.w > 0 ? _options.maxSpreadZoom : 1; 9584 }, 9585 9586 // Return true if offset is out of the bounds 9587 _modifyDestPanOffset = function(axis, destPanBounds, destPanOffset, destZoomLevel) { 9588 if(destZoomLevel === self.currItem.initialZoomLevel) { 9589 destPanOffset[axis] = self.currItem.initialPosition[axis]; 9590 return true; 9591 } else { 9592 destPanOffset[axis] = _calculatePanOffset(axis, destZoomLevel); 9593 9594 if(destPanOffset[axis] > destPanBounds.min[axis]) { 9595 destPanOffset[axis] = destPanBounds.min[axis]; 9596 return true; 9597 } else if(destPanOffset[axis] < destPanBounds.max[axis] ) { 9598 destPanOffset[axis] = destPanBounds.max[axis]; 9599 return true; 9600 } 9601 } 9602 return false; 9603 }, 9604 9605 _setupTransforms = function() { 9606 9607 if(_transformKey) { 9608 // setup 3d transforms 9609 var allow3dTransform = _features.perspective && !_likelyTouchDevice; 9610 _translatePrefix = 'translate' + (allow3dTransform ? '3d(' : '('); 9611 _translateSufix = _features.perspective ? ', 0px)' : ')'; 9612 return; 9613 } 9614 9615 // Override zoom/pan/move functions in case old browser is used (most likely IE) 9616 // (so they use left/top/width/height, instead of CSS transform) 9617 9618 _transformKey = 'left'; 9619 framework.addClass(template, 'pswp--ie'); 9620 9621 _setTranslateX = function(x, elStyle) { 9622 elStyle.left = x + 'px'; 9623 }; 9624 _applyZoomPanToItem = function(item) { 9625 9626 var zoomRatio = item.fitRatio > 1 ? 1 : item.fitRatio, 9627 s = item.container.style, 9628 w = zoomRatio * item.w, 9629 h = zoomRatio * item.h; 9630 9631 s.width = w + 'px'; 9632 s.height = h + 'px'; 9633 s.left = item.initialPosition.x + 'px'; 9634 s.top = item.initialPosition.y + 'px'; 9635 9636 }; 9637 _applyCurrentZoomPan = function() { 9638 if(_currZoomElementStyle) { 9639 9640 var s = _currZoomElementStyle, 9641 item = self.currItem, 9642 zoomRatio = item.fitRatio > 1 ? 1 : item.fitRatio, 9643 w = zoomRatio * item.w, 9644 h = zoomRatio * item.h; 9645 9646 s.width = w + 'px'; 9647 s.height = h + 'px'; 9648 9649 9650 s.left = _panOffset.x + 'px'; 9651 s.top = _panOffset.y + 'px'; 9652 } 9653 9654 }; 9655 }, 9656 9657 _onKeyDown = function(e) { 9658 var keydownAction = ''; 9659 if(_options.escKey && e.keyCode === 27) { 9660 keydownAction = 'close'; 9661 } else if(_options.arrowKeys) { 9662 if(e.keyCode === 37) { 9663 keydownAction = 'prev'; 9664 } else if(e.keyCode === 39) { 9665 keydownAction = 'next'; 9666 } 9667 } 9668 9669 if(keydownAction) { 9670 // don't do anything if special key pressed to prevent from overriding default browser actions 9671 // e.g. in Chrome on Mac cmd+arrow-left returns to previous page 9672 if( !e.ctrlKey && !e.altKey && !e.shiftKey && !e.metaKey ) { 9673 if(e.preventDefault) { 9674 e.preventDefault(); 9675 } else { 9676 e.returnValue = false; 9677 } 9678 self[keydownAction](); 9679 } 9680 } 9681 }, 9682 9683 _onGlobalClick = function(e) { 9684 if(!e) { 9685 return; 9686 } 9687 9688 // don't allow click event to pass through when triggering after drag or some other gesture 9689 if(_moved || _zoomStarted || _mainScrollAnimating || _verticalDragInitiated) { 9690 e.preventDefault(); 9691 e.stopPropagation(); 9692 } 9693 }, 9694 9695 _updatePageScrollOffset = function() { 9696 self.setScrollOffset(0, framework.getScrollY()); 9697 }; 9698 9699 9700 9701 9702 9703 9704 9705// Micro animation engine 9706var _animations = {}, 9707 _numAnimations = 0, 9708 _stopAnimation = function(name) { 9709 if(_animations[name]) { 9710 if(_animations[name].raf) { 9711 _cancelAF( _animations[name].raf ); 9712 } 9713 _numAnimations--; 9714 delete _animations[name]; 9715 } 9716 }, 9717 _registerStartAnimation = function(name) { 9718 if(_animations[name]) { 9719 _stopAnimation(name); 9720 } 9721 if(!_animations[name]) { 9722 _numAnimations++; 9723 _animations[name] = {}; 9724 } 9725 }, 9726 _stopAllAnimations = function() { 9727 for (var prop in _animations) { 9728 9729 if( _animations.hasOwnProperty( prop ) ) { 9730 _stopAnimation(prop); 9731 } 9732 9733 } 9734 }, 9735 _animateProp = function(name, b, endProp, d, easingFn, onUpdate, onComplete) { 9736 var startAnimTime = _getCurrentTime(), t; 9737 _registerStartAnimation(name); 9738 9739 var animloop = function(){ 9740 if ( _animations[name] ) { 9741 9742 t = _getCurrentTime() - startAnimTime; // time diff 9743 //b - beginning (start prop) 9744 //d - anim duration 9745 9746 if ( t >= d ) { 9747 _stopAnimation(name); 9748 onUpdate(endProp); 9749 if(onComplete) { 9750 onComplete(); 9751 } 9752 return; 9753 } 9754 onUpdate( (endProp - b) * easingFn(t/d) + b ); 9755 9756 _animations[name].raf = _requestAF(animloop); 9757 } 9758 }; 9759 animloop(); 9760 }; 9761 9762 9763 9764var publicMethods = { 9765 9766 // make a few local variables and functions public 9767 shout: _shout, 9768 listen: _listen, 9769 viewportSize: _viewportSize, 9770 options: _options, 9771 9772 isMainScrollAnimating: function() { 9773 return _mainScrollAnimating; 9774 }, 9775 getZoomLevel: function() { 9776 return _currZoomLevel; 9777 }, 9778 getCurrentIndex: function() { 9779 return _currentItemIndex; 9780 }, 9781 isDragging: function() { 9782 return _isDragging; 9783 }, 9784 isZooming: function() { 9785 return _isZooming; 9786 }, 9787 setScrollOffset: function(x,y) { 9788 _offset.x = x; 9789 _currentWindowScrollY = _offset.y = y; 9790 _shout('updateScrollOffset', _offset); 9791 }, 9792 applyZoomPan: function(zoomLevel,panX,panY,allowRenderResolution) { 9793 _panOffset.x = panX; 9794 _panOffset.y = panY; 9795 _currZoomLevel = zoomLevel; 9796 _applyCurrentZoomPan( allowRenderResolution ); 9797 }, 9798 9799 init: function() { 9800 9801 if(_isOpen || _isDestroying) { 9802 return; 9803 } 9804 9805 var i; 9806 9807 self.framework = framework; // basic functionality 9808 self.template = template; // root DOM element of PhotoSwipe 9809 self.bg = framework.getChildByClass(template, 'pswp__bg'); 9810 9811 _initalClassName = template.className; 9812 _isOpen = true; 9813 9814 _features = framework.detectFeatures(); 9815 _requestAF = _features.raf; 9816 _cancelAF = _features.caf; 9817 _transformKey = _features.transform; 9818 _oldIE = _features.oldIE; 9819 9820 self.scrollWrap = framework.getChildByClass(template, 'pswp__scroll-wrap'); 9821 self.container = framework.getChildByClass(self.scrollWrap, 'pswp__container'); 9822 9823 _containerStyle = self.container.style; // for fast access 9824 9825 // Objects that hold slides (there are only 3 in DOM) 9826 self.itemHolders = _itemHolders = [ 9827 {el:self.container.children[0] , wrap:0, index: -1}, 9828 {el:self.container.children[1] , wrap:0, index: -1}, 9829 {el:self.container.children[2] , wrap:0, index: -1} 9830 ]; 9831 9832 // hide nearby item holders until initial zoom animation finishes (to avoid extra Paints) 9833 _itemHolders[0].el.style.display = _itemHolders[2].el.style.display = 'none'; 9834 9835 _setupTransforms(); 9836 9837 // Setup global events 9838 _globalEventHandlers = { 9839 resize: self.updateSize, 9840 scroll: _updatePageScrollOffset, 9841 keydown: _onKeyDown, 9842 click: _onGlobalClick 9843 }; 9844 9845 // disable show/hide effects on old browsers that don't support CSS animations or transforms, 9846 // old IOS, Android and Opera mobile. Blackberry seems to work fine, even older models. 9847 var oldPhone = _features.isOldIOSPhone || _features.isOldAndroid || _features.isMobileOpera; 9848 if(!_features.animationName || !_features.transform || oldPhone) { 9849 _options.showAnimationDuration = _options.hideAnimationDuration = 0; 9850 } 9851 9852 // init modules 9853 for(i = 0; i < _modules.length; i++) { 9854 self['init' + _modules[i]](); 9855 } 9856 9857 // init 9858 if(UiClass) { 9859 var ui = self.ui = new UiClass(self, framework); 9860 ui.init(); 9861 } 9862 9863 _shout('firstUpdate'); 9864 _currentItemIndex = _currentItemIndex || _options.index || 0; 9865 // validate index 9866 if( isNaN(_currentItemIndex) || _currentItemIndex < 0 || _currentItemIndex >= _getNumItems() ) { 9867 _currentItemIndex = 0; 9868 } 9869 self.currItem = _getItemAt( _currentItemIndex ); 9870 9871 9872 if(_features.isOldIOSPhone || _features.isOldAndroid) { 9873 _isFixedPosition = false; 9874 } 9875 9876 template.setAttribute('aria-hidden', 'false'); 9877 if(_options.modal) { 9878 if(!_isFixedPosition) { 9879 template.style.position = 'absolute'; 9880 template.style.top = framework.getScrollY() + 'px'; 9881 } else { 9882 template.style.position = 'fixed'; 9883 } 9884 } 9885 9886 if(_currentWindowScrollY === undefined) { 9887 _shout('initialLayout'); 9888 _currentWindowScrollY = _initalWindowScrollY = framework.getScrollY(); 9889 } 9890 9891 // add classes to root element of PhotoSwipe 9892 var rootClasses = 'pswp--open '; 9893 if(_options.mainClass) { 9894 rootClasses += _options.mainClass + ' '; 9895 } 9896 if(_options.showHideOpacity) { 9897 rootClasses += 'pswp--animate_opacity '; 9898 } 9899 rootClasses += _likelyTouchDevice ? 'pswp--touch' : 'pswp--notouch'; 9900 rootClasses += _features.animationName ? ' pswp--css_animation' : ''; 9901 rootClasses += _features.svg ? ' pswp--svg' : ''; 9902 framework.addClass(template, rootClasses); 9903 9904 self.updateSize(); 9905 9906 // initial update 9907 _containerShiftIndex = -1; 9908 _indexDiff = null; 9909 for(i = 0; i < NUM_HOLDERS; i++) { 9910 _setTranslateX( (i+_containerShiftIndex) * _slideSize.x, _itemHolders[i].el.style); 9911 } 9912 9913 if(!_oldIE) { 9914 framework.bind(self.scrollWrap, _downEvents, self); // no dragging for old IE 9915 } 9916 9917 _listen('initialZoomInEnd', function() { 9918 self.setContent(_itemHolders[0], _currentItemIndex-1); 9919 self.setContent(_itemHolders[2], _currentItemIndex+1); 9920 9921 _itemHolders[0].el.style.display = _itemHolders[2].el.style.display = 'block'; 9922 9923 if(_options.focus) { 9924 // focus causes layout, 9925 // which causes lag during the animation, 9926 // that's why we delay it untill the initial zoom transition ends 9927 template.focus(); 9928 } 9929 9930 9931 _bindEvents(); 9932 }); 9933 9934 // set content for center slide (first time) 9935 self.setContent(_itemHolders[1], _currentItemIndex); 9936 9937 self.updateCurrItem(); 9938 9939 _shout('afterInit'); 9940 9941 if(!_isFixedPosition) { 9942 9943 // On all versions of iOS lower than 8.0, we check size of viewport every second. 9944 // 9945 // This is done to detect when Safari top & bottom bars appear, 9946 // as this action doesn't trigger any events (like resize). 9947 // 9948 // On iOS8 they fixed this. 9949 // 9950 // 10 Nov 2014: iOS 7 usage ~40%. iOS 8 usage 56%. 9951 9952 _updateSizeInterval = setInterval(function() { 9953 if(!_numAnimations && !_isDragging && !_isZooming && (_currZoomLevel === self.currItem.initialZoomLevel) ) { 9954 self.updateSize(); 9955 } 9956 }, 1000); 9957 } 9958 9959 framework.addClass(template, 'pswp--visible'); 9960 }, 9961 9962 // Close the gallery, then destroy it 9963 close: function() { 9964 if(!_isOpen) { 9965 return; 9966 } 9967 9968 _isOpen = false; 9969 _isDestroying = true; 9970 _shout('close'); 9971 _unbindEvents(); 9972 9973 _showOrHide(self.currItem, null, true, self.destroy); 9974 }, 9975 9976 // destroys the gallery (unbinds events, cleans up intervals and timeouts to avoid memory leaks) 9977 destroy: function() { 9978 _shout('destroy'); 9979 9980 if(_showOrHideTimeout) { 9981 clearTimeout(_showOrHideTimeout); 9982 } 9983 9984 template.setAttribute('aria-hidden', 'true'); 9985 template.className = _initalClassName; 9986 9987 if(_updateSizeInterval) { 9988 clearInterval(_updateSizeInterval); 9989 } 9990 9991 framework.unbind(self.scrollWrap, _downEvents, self); 9992 9993 // we unbind scroll event at the end, as closing animation may depend on it 9994 framework.unbind(window, 'scroll', self); 9995 9996 _stopDragUpdateLoop(); 9997 9998 _stopAllAnimations(); 9999 10000 _listeners = null; 10001 }, 10002 10003 /** 10004 * Pan image to position 10005 * @param {Number} x 10006 * @param {Number} y 10007 * @param {Boolean} force Will ignore bounds if set to true. 10008 */ 10009 panTo: function(x,y,force) { 10010 if(!force) { 10011 if(x > _currPanBounds.min.x) { 10012 x = _currPanBounds.min.x; 10013 } else if(x < _currPanBounds.max.x) { 10014 x = _currPanBounds.max.x; 10015 } 10016 10017 if(y > _currPanBounds.min.y) { 10018 y = _currPanBounds.min.y; 10019 } else if(y < _currPanBounds.max.y) { 10020 y = _currPanBounds.max.y; 10021 } 10022 } 10023 10024 _panOffset.x = x; 10025 _panOffset.y = y; 10026 _applyCurrentZoomPan(); 10027 }, 10028 10029 handleEvent: function (e) { 10030 e = e || window.event; 10031 if(_globalEventHandlers[e.type]) { 10032 _globalEventHandlers[e.type](e); 10033 } 10034 }, 10035 10036 10037 goTo: function(index) { 10038 10039 index = _getLoopedId(index); 10040 10041 var diff = index - _currentItemIndex; 10042 _indexDiff = diff; 10043 10044 _currentItemIndex = index; 10045 self.currItem = _getItemAt( _currentItemIndex ); 10046 _currPositionIndex -= diff; 10047 10048 _moveMainScroll(_slideSize.x * _currPositionIndex); 10049 10050 10051 _stopAllAnimations(); 10052 _mainScrollAnimating = false; 10053 10054 self.updateCurrItem(); 10055 }, 10056 next: function() { 10057 self.goTo( _currentItemIndex + 1); 10058 }, 10059 prev: function() { 10060 self.goTo( _currentItemIndex - 1); 10061 }, 10062 10063 // update current zoom/pan objects 10064 updateCurrZoomItem: function(emulateSetContent) { 10065 if(emulateSetContent) { 10066 _shout('beforeChange', 0); 10067 } 10068 10069 // itemHolder[1] is middle (current) item 10070 if(_itemHolders[1].el.children.length) { 10071 var zoomElement = _itemHolders[1].el.children[0]; 10072 if( framework.hasClass(zoomElement, 'pswp__zoom-wrap') ) { 10073 _currZoomElementStyle = zoomElement.style; 10074 } else { 10075 _currZoomElementStyle = null; 10076 } 10077 } else { 10078 _currZoomElementStyle = null; 10079 } 10080 10081 _currPanBounds = self.currItem.bounds; 10082 _startZoomLevel = _currZoomLevel = self.currItem.initialZoomLevel; 10083 10084 _panOffset.x = _currPanBounds.center.x; 10085 _panOffset.y = _currPanBounds.center.y; 10086 10087 if(emulateSetContent) { 10088 _shout('afterChange'); 10089 } 10090 }, 10091 10092 10093 invalidateCurrItems: function() { 10094 _itemsNeedUpdate = true; 10095 for(var i = 0; i < NUM_HOLDERS; i++) { 10096 if( _itemHolders[i].item ) { 10097 _itemHolders[i].item.needsUpdate = true; 10098 } 10099 } 10100 }, 10101 10102 updateCurrItem: function(beforeAnimation) { 10103 10104 if(_indexDiff === 0) { 10105 return; 10106 } 10107 10108 var diffAbs = Math.abs(_indexDiff), 10109 tempHolder; 10110 10111 if(beforeAnimation && diffAbs < 2) { 10112 return; 10113 } 10114 10115 10116 self.currItem = _getItemAt( _currentItemIndex ); 10117 _renderMaxResolution = false; 10118 10119 _shout('beforeChange', _indexDiff); 10120 10121 if(diffAbs >= NUM_HOLDERS) { 10122 _containerShiftIndex += _indexDiff + (_indexDiff > 0 ? -NUM_HOLDERS : NUM_HOLDERS); 10123 diffAbs = NUM_HOLDERS; 10124 } 10125 for(var i = 0; i < diffAbs; i++) { 10126 if(_indexDiff > 0) { 10127 tempHolder = _itemHolders.shift(); 10128 _itemHolders[NUM_HOLDERS-1] = tempHolder; // move first to last 10129 10130 _containerShiftIndex++; 10131 _setTranslateX( (_containerShiftIndex+2) * _slideSize.x, tempHolder.el.style); 10132 self.setContent(tempHolder, _currentItemIndex - diffAbs + i + 1 + 1); 10133 } else { 10134 tempHolder = _itemHolders.pop(); 10135 _itemHolders.unshift( tempHolder ); // move last to first 10136 10137 _containerShiftIndex--; 10138 _setTranslateX( _containerShiftIndex * _slideSize.x, tempHolder.el.style); 10139 self.setContent(tempHolder, _currentItemIndex + diffAbs - i - 1 - 1); 10140 } 10141 10142 } 10143 10144 // reset zoom/pan on previous item 10145 if(_currZoomElementStyle && Math.abs(_indexDiff) === 1) { 10146 10147 var prevItem = _getItemAt(_prevItemIndex); 10148 if(prevItem.initialZoomLevel !== _currZoomLevel) { 10149 _calculateItemSize(prevItem , _viewportSize ); 10150 _setImageSize(prevItem); 10151 _applyZoomPanToItem( prevItem ); 10152 } 10153 10154 } 10155 10156 // reset diff after update 10157 _indexDiff = 0; 10158 10159 self.updateCurrZoomItem(); 10160 10161 _prevItemIndex = _currentItemIndex; 10162 10163 _shout('afterChange'); 10164 10165 }, 10166 10167 10168 10169 updateSize: function(force) { 10170 10171 if(!_isFixedPosition && _options.modal) { 10172 var windowScrollY = framework.getScrollY(); 10173 if(_currentWindowScrollY !== windowScrollY) { 10174 template.style.top = windowScrollY + 'px'; 10175 _currentWindowScrollY = windowScrollY; 10176 } 10177 if(!force && _windowVisibleSize.x === window.innerWidth && _windowVisibleSize.y === window.innerHeight) { 10178 return; 10179 } 10180 _windowVisibleSize.x = window.innerWidth; 10181 _windowVisibleSize.y = window.innerHeight; 10182 10183 //template.style.width = _windowVisibleSize.x + 'px'; 10184 template.style.height = _windowVisibleSize.y + 'px'; 10185 } 10186 10187 10188 10189 _viewportSize.x = self.scrollWrap.clientWidth; 10190 _viewportSize.y = self.scrollWrap.clientHeight; 10191 10192 _updatePageScrollOffset(); 10193 10194 _slideSize.x = _viewportSize.x + Math.round(_viewportSize.x * _options.spacing); 10195 _slideSize.y = _viewportSize.y; 10196 10197 _moveMainScroll(_slideSize.x * _currPositionIndex); 10198 10199 _shout('beforeResize'); // even may be used for example to switch image sources 10200 10201 10202 // don't re-calculate size on inital size update 10203 if(_containerShiftIndex !== undefined) { 10204 10205 var holder, 10206 item, 10207 hIndex; 10208 10209 for(var i = 0; i < NUM_HOLDERS; i++) { 10210 holder = _itemHolders[i]; 10211 _setTranslateX( (i+_containerShiftIndex) * _slideSize.x, holder.el.style); 10212 10213 hIndex = _currentItemIndex+i-1; 10214 10215 if(_options.loop && _getNumItems() > 2) { 10216 hIndex = _getLoopedId(hIndex); 10217 } 10218 10219 // update zoom level on items and refresh source (if needsUpdate) 10220 item = _getItemAt( hIndex ); 10221 10222 // re-render gallery item if `needsUpdate`, 10223 // or doesn't have `bounds` (entirely new slide object) 10224 if( item && (_itemsNeedUpdate || item.needsUpdate || !item.bounds) ) { 10225 10226 self.cleanSlide( item ); 10227 10228 self.setContent( holder, hIndex ); 10229 10230 // if "center" slide 10231 if(i === 1) { 10232 self.currItem = item; 10233 self.updateCurrZoomItem(true); 10234 } 10235 10236 item.needsUpdate = false; 10237 10238 } else if(holder.index === -1 && hIndex >= 0) { 10239 // add content first time 10240 self.setContent( holder, hIndex ); 10241 } 10242 if(item && item.container) { 10243 _calculateItemSize(item, _viewportSize); 10244 _setImageSize(item); 10245 _applyZoomPanToItem( item ); 10246 } 10247 10248 } 10249 _itemsNeedUpdate = false; 10250 } 10251 10252 _startZoomLevel = _currZoomLevel = self.currItem.initialZoomLevel; 10253 _currPanBounds = self.currItem.bounds; 10254 10255 if(_currPanBounds) { 10256 _panOffset.x = _currPanBounds.center.x; 10257 _panOffset.y = _currPanBounds.center.y; 10258 _applyCurrentZoomPan( true ); 10259 } 10260 10261 _shout('resize'); 10262 }, 10263 10264 // Zoom current item to 10265 zoomTo: function(destZoomLevel, centerPoint, speed, easingFn, updateFn) { 10266 /* 10267 if(destZoomLevel === 'fit') { 10268 destZoomLevel = self.currItem.fitRatio; 10269 } else if(destZoomLevel === 'fill') { 10270 destZoomLevel = self.currItem.fillRatio; 10271 } 10272 */ 10273 10274 if(centerPoint) { 10275 _startZoomLevel = _currZoomLevel; 10276 _midZoomPoint.x = Math.abs(centerPoint.x) - _panOffset.x ; 10277 _midZoomPoint.y = Math.abs(centerPoint.y) - _panOffset.y ; 10278 _equalizePoints(_startPanOffset, _panOffset); 10279 } 10280 10281 var destPanBounds = _calculatePanBounds(destZoomLevel, false), 10282 destPanOffset = {}; 10283 10284 _modifyDestPanOffset('x', destPanBounds, destPanOffset, destZoomLevel); 10285 _modifyDestPanOffset('y', destPanBounds, destPanOffset, destZoomLevel); 10286 10287 var initialZoomLevel = _currZoomLevel; 10288 var initialPanOffset = { 10289 x: _panOffset.x, 10290 y: _panOffset.y 10291 }; 10292 10293 _roundPoint(destPanOffset); 10294 10295 var onUpdate = function(now) { 10296 if(now === 1) { 10297 _currZoomLevel = destZoomLevel; 10298 _panOffset.x = destPanOffset.x; 10299 _panOffset.y = destPanOffset.y; 10300 } else { 10301 _currZoomLevel = (destZoomLevel - initialZoomLevel) * now + initialZoomLevel; 10302 _panOffset.x = (destPanOffset.x - initialPanOffset.x) * now + initialPanOffset.x; 10303 _panOffset.y = (destPanOffset.y - initialPanOffset.y) * now + initialPanOffset.y; 10304 } 10305 10306 if(updateFn) { 10307 updateFn(now); 10308 } 10309 10310 _applyCurrentZoomPan( now === 1 ); 10311 }; 10312 10313 if(speed) { 10314 _animateProp('customZoomTo', 0, 1, speed, easingFn || framework.easing.sine.inOut, onUpdate); 10315 } else { 10316 onUpdate(1); 10317 } 10318 } 10319 10320 10321}; 10322 10323 10324/*>>core*/ 10325 10326/*>>gestures*/ 10327/** 10328 * Mouse/touch/pointer event handlers. 10329 * 10330 * separated from @core.js for readability 10331 */ 10332 10333var MIN_SWIPE_DISTANCE = 30, 10334 DIRECTION_CHECK_OFFSET = 10; // amount of pixels to drag to determine direction of swipe 10335 10336var _gestureStartTime, 10337 _gestureCheckSpeedTime, 10338 10339 // pool of objects that are used during dragging of zooming 10340 p = {}, // first point 10341 p2 = {}, // second point (for zoom gesture) 10342 delta = {}, 10343 _currPoint = {}, 10344 _startPoint = {}, 10345 _currPointers = [], 10346 _startMainScrollPos = {}, 10347 _releaseAnimData, 10348 _posPoints = [], // array of points during dragging, used to determine type of gesture 10349 _tempPoint = {}, 10350 10351 _isZoomingIn, 10352 _verticalDragInitiated, 10353 _oldAndroidTouchEndTimeout, 10354 _currZoomedItemIndex = 0, 10355 _centerPoint = _getEmptyPoint(), 10356 _lastReleaseTime = 0, 10357 _isDragging, // at least one pointer is down 10358 _isMultitouch, // at least two _pointers are down 10359 _zoomStarted, // zoom level changed during zoom gesture 10360 _moved, 10361 _dragAnimFrame, 10362 _mainScrollShifted, 10363 _currentPoints, // array of current touch points 10364 _isZooming, 10365 _currPointsDistance, 10366 _startPointsDistance, 10367 _currPanBounds, 10368 _mainScrollPos = _getEmptyPoint(), 10369 _currZoomElementStyle, 10370 _mainScrollAnimating, // true, if animation after swipe gesture is running 10371 _midZoomPoint = _getEmptyPoint(), 10372 _currCenterPoint = _getEmptyPoint(), 10373 _direction, 10374 _isFirstMove, 10375 _opacityChanged, 10376 _bgOpacity, 10377 _wasOverInitialZoom, 10378 10379 _isEqualPoints = function(p1, p2) { 10380 return p1.x === p2.x && p1.y === p2.y; 10381 }, 10382 _isNearbyPoints = function(touch0, touch1) { 10383 return Math.abs(touch0.x - touch1.x) < DOUBLE_TAP_RADIUS && Math.abs(touch0.y - touch1.y) < DOUBLE_TAP_RADIUS; 10384 }, 10385 _calculatePointsDistance = function(p1, p2) { 10386 _tempPoint.x = Math.abs( p1.x - p2.x ); 10387 _tempPoint.y = Math.abs( p1.y - p2.y ); 10388 return Math.sqrt(_tempPoint.x * _tempPoint.x + _tempPoint.y * _tempPoint.y); 10389 }, 10390 _stopDragUpdateLoop = function() { 10391 if(_dragAnimFrame) { 10392 _cancelAF(_dragAnimFrame); 10393 _dragAnimFrame = null; 10394 } 10395 }, 10396 _dragUpdateLoop = function() { 10397 if(_isDragging) { 10398 _dragAnimFrame = _requestAF(_dragUpdateLoop); 10399 _renderMovement(); 10400 } 10401 }, 10402 _canPan = function() { 10403 return !(_options.scaleMode === 'fit' && _currZoomLevel === self.currItem.initialZoomLevel); 10404 }, 10405 10406 // find the closest parent DOM element 10407 _closestElement = function(el, fn) { 10408 if(!el || el === document) { 10409 return false; 10410 } 10411 10412 // don't search elements above pswp__scroll-wrap 10413 if(el.getAttribute('class') && el.getAttribute('class').indexOf('pswp__scroll-wrap') > -1 ) { 10414 return false; 10415 } 10416 10417 if( fn(el) ) { 10418 return el; 10419 } 10420 10421 return _closestElement(el.parentNode, fn); 10422 }, 10423 10424 _preventObj = {}, 10425 _preventDefaultEventBehaviour = function(e, isDown) { 10426 _preventObj.prevent = !_closestElement(e.target, _options.isClickableElement); 10427 10428 _shout('preventDragEvent', e, isDown, _preventObj); 10429 return _preventObj.prevent; 10430 10431 }, 10432 _convertTouchToPoint = function(touch, p) { 10433 p.x = touch.pageX; 10434 p.y = touch.pageY; 10435 p.id = touch.identifier; 10436 return p; 10437 }, 10438 _findCenterOfPoints = function(p1, p2, pCenter) { 10439 pCenter.x = (p1.x + p2.x) * 0.5; 10440 pCenter.y = (p1.y + p2.y) * 0.5; 10441 }, 10442 _pushPosPoint = function(time, x, y) { 10443 if(time - _gestureCheckSpeedTime > 50) { 10444 var o = _posPoints.length > 2 ? _posPoints.shift() : {}; 10445 o.x = x; 10446 o.y = y; 10447 _posPoints.push(o); 10448 _gestureCheckSpeedTime = time; 10449 } 10450 }, 10451 10452 _calculateVerticalDragOpacityRatio = function() { 10453 var yOffset = _panOffset.y - self.currItem.initialPosition.y; // difference between initial and current position 10454 return 1 - Math.abs( yOffset / (_viewportSize.y / 2) ); 10455 }, 10456 10457 10458 // points pool, reused during touch events 10459 _ePoint1 = {}, 10460 _ePoint2 = {}, 10461 _tempPointsArr = [], 10462 _tempCounter, 10463 _getTouchPoints = function(e) { 10464 // clean up previous points, without recreating array 10465 while(_tempPointsArr.length > 0) { 10466 _tempPointsArr.pop(); 10467 } 10468 10469 if(!_pointerEventEnabled) { 10470 if(e.type.indexOf('touch') > -1) { 10471 10472 if(e.touches && e.touches.length > 0) { 10473 _tempPointsArr[0] = _convertTouchToPoint(e.touches[0], _ePoint1); 10474 if(e.touches.length > 1) { 10475 _tempPointsArr[1] = _convertTouchToPoint(e.touches[1], _ePoint2); 10476 } 10477 } 10478 10479 } else { 10480 _ePoint1.x = e.pageX; 10481 _ePoint1.y = e.pageY; 10482 _ePoint1.id = ''; 10483 _tempPointsArr[0] = _ePoint1;//_ePoint1; 10484 } 10485 } else { 10486 _tempCounter = 0; 10487 // we can use forEach, as pointer events are supported only in modern browsers 10488 _currPointers.forEach(function(p) { 10489 if(_tempCounter === 0) { 10490 _tempPointsArr[0] = p; 10491 } else if(_tempCounter === 1) { 10492 _tempPointsArr[1] = p; 10493 } 10494 _tempCounter++; 10495 10496 }); 10497 } 10498 return _tempPointsArr; 10499 }, 10500 10501 _panOrMoveMainScroll = function(axis, delta) { 10502 10503 var panFriction, 10504 overDiff = 0, 10505 newOffset = _panOffset[axis] + delta[axis], 10506 startOverDiff, 10507 dir = delta[axis] > 0, 10508 newMainScrollPosition = _mainScrollPos.x + delta.x, 10509 mainScrollDiff = _mainScrollPos.x - _startMainScrollPos.x, 10510 newPanPos, 10511 newMainScrollPos; 10512 10513 // calculate fdistance over the bounds and friction 10514 if(newOffset > _currPanBounds.min[axis] || newOffset < _currPanBounds.max[axis]) { 10515 panFriction = _options.panEndFriction; 10516 // Linear increasing of friction, so at 1/4 of viewport it's at max value. 10517 // Looks not as nice as was expected. Left for history. 10518 // panFriction = (1 - (_panOffset[axis] + delta[axis] + panBounds.min[axis]) / (_viewportSize[axis] / 4) ); 10519 } else { 10520 panFriction = 1; 10521 } 10522 10523 newOffset = _panOffset[axis] + delta[axis] * panFriction; 10524 10525 // move main scroll or start panning 10526 if(_options.allowPanToNext || _currZoomLevel === self.currItem.initialZoomLevel) { 10527 10528 10529 if(!_currZoomElementStyle) { 10530 10531 newMainScrollPos = newMainScrollPosition; 10532 10533 } else if(_direction === 'h' && axis === 'x' && !_zoomStarted ) { 10534 10535 if(dir) { 10536 if(newOffset > _currPanBounds.min[axis]) { 10537 panFriction = _options.panEndFriction; 10538 overDiff = _currPanBounds.min[axis] - newOffset; 10539 startOverDiff = _currPanBounds.min[axis] - _startPanOffset[axis]; 10540 } 10541 10542 // drag right 10543 if( (startOverDiff <= 0 || mainScrollDiff < 0) && _getNumItems() > 1 ) { 10544 newMainScrollPos = newMainScrollPosition; 10545 if(mainScrollDiff < 0 && newMainScrollPosition > _startMainScrollPos.x) { 10546 newMainScrollPos = _startMainScrollPos.x; 10547 } 10548 } else { 10549 if(_currPanBounds.min.x !== _currPanBounds.max.x) { 10550 newPanPos = newOffset; 10551 } 10552 10553 } 10554 10555 } else { 10556 10557 if(newOffset < _currPanBounds.max[axis] ) { 10558 panFriction =_options.panEndFriction; 10559 overDiff = newOffset - _currPanBounds.max[axis]; 10560 startOverDiff = _startPanOffset[axis] - _currPanBounds.max[axis]; 10561 } 10562 10563 if( (startOverDiff <= 0 || mainScrollDiff > 0) && _getNumItems() > 1 ) { 10564 newMainScrollPos = newMainScrollPosition; 10565 10566 if(mainScrollDiff > 0 && newMainScrollPosition < _startMainScrollPos.x) { 10567 newMainScrollPos = _startMainScrollPos.x; 10568 } 10569 10570 } else { 10571 if(_currPanBounds.min.x !== _currPanBounds.max.x) { 10572 newPanPos = newOffset; 10573 } 10574 } 10575 10576 } 10577 10578 10579 // 10580 } 10581 10582 if(axis === 'x') { 10583 10584 if(newMainScrollPos !== undefined) { 10585 _moveMainScroll(newMainScrollPos, true); 10586 if(newMainScrollPos === _startMainScrollPos.x) { 10587 _mainScrollShifted = false; 10588 } else { 10589 _mainScrollShifted = true; 10590 } 10591 } 10592 10593 if(_currPanBounds.min.x !== _currPanBounds.max.x) { 10594 if(newPanPos !== undefined) { 10595 _panOffset.x = newPanPos; 10596 } else if(!_mainScrollShifted) { 10597 _panOffset.x += delta.x * panFriction; 10598 } 10599 } 10600 10601 return newMainScrollPos !== undefined; 10602 } 10603 10604 } 10605 10606 if(!_mainScrollAnimating) { 10607 10608 if(!_mainScrollShifted) { 10609 if(_currZoomLevel > self.currItem.fitRatio) { 10610 _panOffset[axis] += delta[axis] * panFriction; 10611 10612 } 10613 } 10614 10615 10616 } 10617 10618 }, 10619 10620 // Pointerdown/touchstart/mousedown handler 10621 _onDragStart = function(e) { 10622 10623 // Allow dragging only via left mouse button. 10624 // As this handler is not added in IE8 - we ignore e.which 10625 // 10626 // http://www.quirksmode.org/js/events_properties.html 10627 // https://developer.mozilla.org/en-US/docs/Web/API/event.button 10628 if(e.type === 'mousedown' && e.button > 0 ) { 10629 return; 10630 } 10631 10632 if(_initialZoomRunning) { 10633 e.preventDefault(); 10634 return; 10635 } 10636 10637 if(_oldAndroidTouchEndTimeout && e.type === 'mousedown') { 10638 return; 10639 } 10640 10641 if(_preventDefaultEventBehaviour(e, true)) { 10642 e.preventDefault(); 10643 } 10644 10645 10646 10647 _shout('pointerDown'); 10648 10649 if(_pointerEventEnabled) { 10650 var pointerIndex = framework.arraySearch(_currPointers, e.pointerId, 'id'); 10651 if(pointerIndex < 0) { 10652 pointerIndex = _currPointers.length; 10653 } 10654 _currPointers[pointerIndex] = {x:e.pageX, y:e.pageY, id: e.pointerId}; 10655 } 10656 10657 10658 10659 var startPointsList = _getTouchPoints(e), 10660 numPoints = startPointsList.length; 10661 10662 _currentPoints = null; 10663 10664 _stopAllAnimations(); 10665 10666 // init drag 10667 if(!_isDragging || numPoints === 1) { 10668 10669 10670 10671 _isDragging = _isFirstMove = true; 10672 framework.bind(window, _upMoveEvents, self); 10673 10674 _isZoomingIn = 10675 _wasOverInitialZoom = 10676 _opacityChanged = 10677 _verticalDragInitiated = 10678 _mainScrollShifted = 10679 _moved = 10680 _isMultitouch = 10681 _zoomStarted = false; 10682 10683 _direction = null; 10684 10685 _shout('firstTouchStart', startPointsList); 10686 10687 _equalizePoints(_startPanOffset, _panOffset); 10688 10689 _currPanDist.x = _currPanDist.y = 0; 10690 _equalizePoints(_currPoint, startPointsList[0]); 10691 _equalizePoints(_startPoint, _currPoint); 10692 10693 //_equalizePoints(_startMainScrollPos, _mainScrollPos); 10694 _startMainScrollPos.x = _slideSize.x * _currPositionIndex; 10695 10696 _posPoints = [{ 10697 x: _currPoint.x, 10698 y: _currPoint.y 10699 }]; 10700 10701 _gestureCheckSpeedTime = _gestureStartTime = _getCurrentTime(); 10702 10703 //_mainScrollAnimationEnd(true); 10704 _calculatePanBounds( _currZoomLevel, true ); 10705 10706 // Start rendering 10707 _stopDragUpdateLoop(); 10708 _dragUpdateLoop(); 10709 10710 } 10711 10712 // init zoom 10713 if(!_isZooming && numPoints > 1 && !_mainScrollAnimating && !_mainScrollShifted) { 10714 _startZoomLevel = _currZoomLevel; 10715 _zoomStarted = false; // true if zoom changed at least once 10716 10717 _isZooming = _isMultitouch = true; 10718 _currPanDist.y = _currPanDist.x = 0; 10719 10720 _equalizePoints(_startPanOffset, _panOffset); 10721 10722 _equalizePoints(p, startPointsList[0]); 10723 _equalizePoints(p2, startPointsList[1]); 10724 10725 _findCenterOfPoints(p, p2, _currCenterPoint); 10726 10727 _midZoomPoint.x = Math.abs(_currCenterPoint.x) - _panOffset.x; 10728 _midZoomPoint.y = Math.abs(_currCenterPoint.y) - _panOffset.y; 10729 _currPointsDistance = _startPointsDistance = _calculatePointsDistance(p, p2); 10730 } 10731 10732 10733 }, 10734 10735 // Pointermove/touchmove/mousemove handler 10736 _onDragMove = function(e) { 10737 10738 e.preventDefault(); 10739 10740 if(_pointerEventEnabled) { 10741 var pointerIndex = framework.arraySearch(_currPointers, e.pointerId, 'id'); 10742 if(pointerIndex > -1) { 10743 var p = _currPointers[pointerIndex]; 10744 p.x = e.pageX; 10745 p.y = e.pageY; 10746 } 10747 } 10748 10749 if(_isDragging) { 10750 var touchesList = _getTouchPoints(e); 10751 if(!_direction && !_moved && !_isZooming) { 10752 10753 if(_mainScrollPos.x !== _slideSize.x * _currPositionIndex) { 10754 // if main scroll position is shifted – direction is always horizontal 10755 _direction = 'h'; 10756 } else { 10757 var diff = Math.abs(touchesList[0].x - _currPoint.x) - Math.abs(touchesList[0].y - _currPoint.y); 10758 // check the direction of movement 10759 if(Math.abs(diff) >= DIRECTION_CHECK_OFFSET) { 10760 _direction = diff > 0 ? 'h' : 'v'; 10761 _currentPoints = touchesList; 10762 } 10763 } 10764 10765 } else { 10766 _currentPoints = touchesList; 10767 } 10768 } 10769 }, 10770 // 10771 _renderMovement = function() { 10772 10773 if(!_currentPoints) { 10774 return; 10775 } 10776 10777 var numPoints = _currentPoints.length; 10778 10779 if(numPoints === 0) { 10780 return; 10781 } 10782 10783 _equalizePoints(p, _currentPoints[0]); 10784 10785 delta.x = p.x - _currPoint.x; 10786 delta.y = p.y - _currPoint.y; 10787 10788 if(_isZooming && numPoints > 1) { 10789 // Handle behaviour for more than 1 point 10790 10791 _currPoint.x = p.x; 10792 _currPoint.y = p.y; 10793 10794 // check if one of two points changed 10795 if( !delta.x && !delta.y && _isEqualPoints(_currentPoints[1], p2) ) { 10796 return; 10797 } 10798 10799 _equalizePoints(p2, _currentPoints[1]); 10800 10801 10802 if(!_zoomStarted) { 10803 _zoomStarted = true; 10804 _shout('zoomGestureStarted'); 10805 } 10806 10807 // Distance between two points 10808 var pointsDistance = _calculatePointsDistance(p,p2); 10809 10810 var zoomLevel = _calculateZoomLevel(pointsDistance); 10811 10812 // slightly over the of initial zoom level 10813 if(zoomLevel > self.currItem.initialZoomLevel + self.currItem.initialZoomLevel / 15) { 10814 _wasOverInitialZoom = true; 10815 } 10816 10817 // Apply the friction if zoom level is out of the bounds 10818 var zoomFriction = 1, 10819 minZoomLevel = _getMinZoomLevel(), 10820 maxZoomLevel = _getMaxZoomLevel(); 10821 10822 if ( zoomLevel < minZoomLevel ) { 10823 10824 if(_options.pinchToClose && !_wasOverInitialZoom && _startZoomLevel <= self.currItem.initialZoomLevel) { 10825 // fade out background if zooming out 10826 var minusDiff = minZoomLevel - zoomLevel; 10827 var percent = 1 - minusDiff / (minZoomLevel / 1.2); 10828 10829 _applyBgOpacity(percent); 10830 _shout('onPinchClose', percent); 10831 _opacityChanged = true; 10832 } else { 10833 zoomFriction = (minZoomLevel - zoomLevel) / minZoomLevel; 10834 if(zoomFriction > 1) { 10835 zoomFriction = 1; 10836 } 10837 zoomLevel = minZoomLevel - zoomFriction * (minZoomLevel / 3); 10838 } 10839 10840 } else if ( zoomLevel > maxZoomLevel ) { 10841 // 1.5 - extra zoom level above the max. E.g. if max is x6, real max 6 + 1.5 = 7.5 10842 zoomFriction = (zoomLevel - maxZoomLevel) / ( minZoomLevel * 6 ); 10843 if(zoomFriction > 1) { 10844 zoomFriction = 1; 10845 } 10846 zoomLevel = maxZoomLevel + zoomFriction * minZoomLevel; 10847 } 10848 10849 if(zoomFriction < 0) { 10850 zoomFriction = 0; 10851 } 10852 10853 // distance between touch points after friction is applied 10854 _currPointsDistance = pointsDistance; 10855 10856 // _centerPoint - The point in the middle of two pointers 10857 _findCenterOfPoints(p, p2, _centerPoint); 10858 10859 // paning with two pointers pressed 10860 _currPanDist.x += _centerPoint.x - _currCenterPoint.x; 10861 _currPanDist.y += _centerPoint.y - _currCenterPoint.y; 10862 _equalizePoints(_currCenterPoint, _centerPoint); 10863 10864 _panOffset.x = _calculatePanOffset('x', zoomLevel); 10865 _panOffset.y = _calculatePanOffset('y', zoomLevel); 10866 10867 _isZoomingIn = zoomLevel > _currZoomLevel; 10868 _currZoomLevel = zoomLevel; 10869 _applyCurrentZoomPan(); 10870 10871 } else { 10872 10873 // handle behaviour for one point (dragging or panning) 10874 10875 if(!_direction) { 10876 return; 10877 } 10878 10879 if(_isFirstMove) { 10880 _isFirstMove = false; 10881 10882 // subtract drag distance that was used during the detection direction 10883 10884 if( Math.abs(delta.x) >= DIRECTION_CHECK_OFFSET) { 10885 delta.x -= _currentPoints[0].x - _startPoint.x; 10886 } 10887 10888 if( Math.abs(delta.y) >= DIRECTION_CHECK_OFFSET) { 10889 delta.y -= _currentPoints[0].y - _startPoint.y; 10890 } 10891 } 10892 10893 _currPoint.x = p.x; 10894 _currPoint.y = p.y; 10895 10896 // do nothing if pointers position hasn't changed 10897 if(delta.x === 0 && delta.y === 0) { 10898 return; 10899 } 10900 10901 if(_direction === 'v' && _options.closeOnVerticalDrag) { 10902 if(!_canPan()) { 10903 _currPanDist.y += delta.y; 10904 _panOffset.y += delta.y; 10905 10906 var opacityRatio = _calculateVerticalDragOpacityRatio(); 10907 10908 _verticalDragInitiated = true; 10909 _shout('onVerticalDrag', opacityRatio); 10910 10911 _applyBgOpacity(opacityRatio); 10912 _applyCurrentZoomPan(); 10913 return ; 10914 } 10915 } 10916 10917 _pushPosPoint(_getCurrentTime(), p.x, p.y); 10918 10919 _moved = true; 10920 _currPanBounds = self.currItem.bounds; 10921 10922 var mainScrollChanged = _panOrMoveMainScroll('x', delta); 10923 if(!mainScrollChanged) { 10924 _panOrMoveMainScroll('y', delta); 10925 10926 _roundPoint(_panOffset); 10927 _applyCurrentZoomPan(); 10928 } 10929 10930 } 10931 10932 }, 10933 10934 // Pointerup/pointercancel/touchend/touchcancel/mouseup event handler 10935 _onDragRelease = function(e) { 10936 10937 if(_features.isOldAndroid ) { 10938 10939 if(_oldAndroidTouchEndTimeout && e.type === 'mouseup') { 10940 return; 10941 } 10942 10943 // on Android (v4.1, 4.2, 4.3 & possibly older) 10944 // ghost mousedown/up event isn't preventable via e.preventDefault, 10945 // which causes fake mousedown event 10946 // so we block mousedown/up for 600ms 10947 if( e.type.indexOf('touch') > -1 ) { 10948 clearTimeout(_oldAndroidTouchEndTimeout); 10949 _oldAndroidTouchEndTimeout = setTimeout(function() { 10950 _oldAndroidTouchEndTimeout = 0; 10951 }, 600); 10952 } 10953 10954 } 10955 10956 _shout('pointerUp'); 10957 10958 if(_preventDefaultEventBehaviour(e, false)) { 10959 e.preventDefault(); 10960 } 10961 10962 var releasePoint; 10963 10964 if(_pointerEventEnabled) { 10965 var pointerIndex = framework.arraySearch(_currPointers, e.pointerId, 'id'); 10966 10967 if(pointerIndex > -1) { 10968 releasePoint = _currPointers.splice(pointerIndex, 1)[0]; 10969 10970 if(navigator.pointerEnabled) { 10971 releasePoint.type = e.pointerType || 'mouse'; 10972 } else { 10973 var MSPOINTER_TYPES = { 10974 4: 'mouse', // event.MSPOINTER_TYPE_MOUSE 10975 2: 'touch', // event.MSPOINTER_TYPE_TOUCH 10976 3: 'pen' // event.MSPOINTER_TYPE_PEN 10977 }; 10978 releasePoint.type = MSPOINTER_TYPES[e.pointerType]; 10979 10980 if(!releasePoint.type) { 10981 releasePoint.type = e.pointerType || 'mouse'; 10982 } 10983 } 10984 10985 } 10986 } 10987 10988 var touchList = _getTouchPoints(e), 10989 gestureType, 10990 numPoints = touchList.length; 10991 10992 if(e.type === 'mouseup') { 10993 numPoints = 0; 10994 } 10995 10996 // Do nothing if there were 3 touch points or more 10997 if(numPoints === 2) { 10998 _currentPoints = null; 10999 return true; 11000 } 11001 11002 // if second pointer released 11003 if(numPoints === 1) { 11004 _equalizePoints(_startPoint, touchList[0]); 11005 } 11006 11007 11008 // pointer hasn't moved, send "tap release" point 11009 if(numPoints === 0 && !_direction && !_mainScrollAnimating) { 11010 if(!releasePoint) { 11011 if(e.type === 'mouseup') { 11012 releasePoint = {x: e.pageX, y: e.pageY, type:'mouse'}; 11013 } else if(e.changedTouches && e.changedTouches[0]) { 11014 releasePoint = {x: e.changedTouches[0].pageX, y: e.changedTouches[0].pageY, type:'touch'}; 11015 } 11016 } 11017 11018 _shout('touchRelease', e, releasePoint); 11019 } 11020 11021 // Difference in time between releasing of two last touch points (zoom gesture) 11022 var releaseTimeDiff = -1; 11023 11024 // Gesture completed, no pointers left 11025 if(numPoints === 0) { 11026 _isDragging = false; 11027 framework.unbind(window, _upMoveEvents, self); 11028 11029 _stopDragUpdateLoop(); 11030 11031 if(_isZooming) { 11032 // Two points released at the same time 11033 releaseTimeDiff = 0; 11034 } else if(_lastReleaseTime !== -1) { 11035 releaseTimeDiff = _getCurrentTime() - _lastReleaseTime; 11036 } 11037 } 11038 _lastReleaseTime = numPoints === 1 ? _getCurrentTime() : -1; 11039 11040 if(releaseTimeDiff !== -1 && releaseTimeDiff < 150) { 11041 gestureType = 'zoom'; 11042 } else { 11043 gestureType = 'swipe'; 11044 } 11045 11046 if(_isZooming && numPoints < 2) { 11047 _isZooming = false; 11048 11049 // Only second point released 11050 if(numPoints === 1) { 11051 gestureType = 'zoomPointerUp'; 11052 } 11053 _shout('zoomGestureEnded'); 11054 } 11055 11056 _currentPoints = null; 11057 if(!_moved && !_zoomStarted && !_mainScrollAnimating && !_verticalDragInitiated) { 11058 // nothing to animate 11059 return; 11060 } 11061 11062 _stopAllAnimations(); 11063 11064 11065 if(!_releaseAnimData) { 11066 _releaseAnimData = _initDragReleaseAnimationData(); 11067 } 11068 11069 _releaseAnimData.calculateSwipeSpeed('x'); 11070 11071 11072 if(_verticalDragInitiated) { 11073 11074 var opacityRatio = _calculateVerticalDragOpacityRatio(); 11075 11076 if(opacityRatio < _options.verticalDragRange) { 11077 self.close(); 11078 } else { 11079 var initalPanY = _panOffset.y, 11080 initialBgOpacity = _bgOpacity; 11081 11082 _animateProp('verticalDrag', 0, 1, 300, framework.easing.cubic.out, function(now) { 11083 11084 _panOffset.y = (self.currItem.initialPosition.y - initalPanY) * now + initalPanY; 11085 11086 _applyBgOpacity( (1 - initialBgOpacity) * now + initialBgOpacity ); 11087 _applyCurrentZoomPan(); 11088 }); 11089 11090 _shout('onVerticalDrag', 1); 11091 } 11092 11093 return; 11094 } 11095 11096 11097 // main scroll 11098 if( (_mainScrollShifted || _mainScrollAnimating) && numPoints === 0) { 11099 var itemChanged = _finishSwipeMainScrollGesture(gestureType, _releaseAnimData); 11100 if(itemChanged) { 11101 return; 11102 } 11103 gestureType = 'zoomPointerUp'; 11104 } 11105 11106 // prevent zoom/pan animation when main scroll animation runs 11107 if(_mainScrollAnimating) { 11108 return; 11109 } 11110 11111 // Complete simple zoom gesture (reset zoom level if it's out of the bounds) 11112 if(gestureType !== 'swipe') { 11113 _completeZoomGesture(); 11114 return; 11115 } 11116 11117 // Complete pan gesture if main scroll is not shifted, and it's possible to pan current image 11118 if(!_mainScrollShifted && _currZoomLevel > self.currItem.fitRatio) { 11119 _completePanGesture(_releaseAnimData); 11120 } 11121 }, 11122 11123 11124 // Returns object with data about gesture 11125 // It's created only once and then reused 11126 _initDragReleaseAnimationData = function() { 11127 // temp local vars 11128 var lastFlickDuration, 11129 tempReleasePos; 11130 11131 // s = this 11132 var s = { 11133 lastFlickOffset: {}, 11134 lastFlickDist: {}, 11135 lastFlickSpeed: {}, 11136 slowDownRatio: {}, 11137 slowDownRatioReverse: {}, 11138 speedDecelerationRatio: {}, 11139 speedDecelerationRatioAbs: {}, 11140 distanceOffset: {}, 11141 backAnimDestination: {}, 11142 backAnimStarted: {}, 11143 calculateSwipeSpeed: function(axis) { 11144 11145 11146 if( _posPoints.length > 1) { 11147 lastFlickDuration = _getCurrentTime() - _gestureCheckSpeedTime + 50; 11148 tempReleasePos = _posPoints[_posPoints.length-2][axis]; 11149 } else { 11150 lastFlickDuration = _getCurrentTime() - _gestureStartTime; // total gesture duration 11151 tempReleasePos = _startPoint[axis]; 11152 } 11153 s.lastFlickOffset[axis] = _currPoint[axis] - tempReleasePos; 11154 s.lastFlickDist[axis] = Math.abs(s.lastFlickOffset[axis]); 11155 if(s.lastFlickDist[axis] > 20) { 11156 s.lastFlickSpeed[axis] = s.lastFlickOffset[axis] / lastFlickDuration; 11157 } else { 11158 s.lastFlickSpeed[axis] = 0; 11159 } 11160 if( Math.abs(s.lastFlickSpeed[axis]) < 0.1 ) { 11161 s.lastFlickSpeed[axis] = 0; 11162 } 11163 11164 s.slowDownRatio[axis] = 0.95; 11165 s.slowDownRatioReverse[axis] = 1 - s.slowDownRatio[axis]; 11166 s.speedDecelerationRatio[axis] = 1; 11167 }, 11168 11169 calculateOverBoundsAnimOffset: function(axis, speed) { 11170 if(!s.backAnimStarted[axis]) { 11171 11172 if(_panOffset[axis] > _currPanBounds.min[axis]) { 11173 s.backAnimDestination[axis] = _currPanBounds.min[axis]; 11174 11175 } else if(_panOffset[axis] < _currPanBounds.max[axis]) { 11176 s.backAnimDestination[axis] = _currPanBounds.max[axis]; 11177 } 11178 11179 if(s.backAnimDestination[axis] !== undefined) { 11180 s.slowDownRatio[axis] = 0.7; 11181 s.slowDownRatioReverse[axis] = 1 - s.slowDownRatio[axis]; 11182 if(s.speedDecelerationRatioAbs[axis] < 0.05) { 11183 11184 s.lastFlickSpeed[axis] = 0; 11185 s.backAnimStarted[axis] = true; 11186 11187 _animateProp('bounceZoomPan'+axis,_panOffset[axis], 11188 s.backAnimDestination[axis], 11189 speed || 300, 11190 framework.easing.sine.out, 11191 function(pos) { 11192 _panOffset[axis] = pos; 11193 _applyCurrentZoomPan(); 11194 } 11195 ); 11196 11197 } 11198 } 11199 } 11200 }, 11201 11202 // Reduces the speed by slowDownRatio (per 10ms) 11203 calculateAnimOffset: function(axis) { 11204 if(!s.backAnimStarted[axis]) { 11205 s.speedDecelerationRatio[axis] = s.speedDecelerationRatio[axis] * (s.slowDownRatio[axis] + 11206 s.slowDownRatioReverse[axis] - 11207 s.slowDownRatioReverse[axis] * s.timeDiff / 10); 11208 11209 s.speedDecelerationRatioAbs[axis] = Math.abs(s.lastFlickSpeed[axis] * s.speedDecelerationRatio[axis]); 11210 s.distanceOffset[axis] = s.lastFlickSpeed[axis] * s.speedDecelerationRatio[axis] * s.timeDiff; 11211 _panOffset[axis] += s.distanceOffset[axis]; 11212 11213 } 11214 }, 11215 11216 panAnimLoop: function() { 11217 if ( _animations.zoomPan ) { 11218 _animations.zoomPan.raf = _requestAF(s.panAnimLoop); 11219 11220 s.now = _getCurrentTime(); 11221 s.timeDiff = s.now - s.lastNow; 11222 s.lastNow = s.now; 11223 11224 s.calculateAnimOffset('x'); 11225 s.calculateAnimOffset('y'); 11226 11227 _applyCurrentZoomPan(); 11228 11229 s.calculateOverBoundsAnimOffset('x'); 11230 s.calculateOverBoundsAnimOffset('y'); 11231 11232 11233 if (s.speedDecelerationRatioAbs.x < 0.05 && s.speedDecelerationRatioAbs.y < 0.05) { 11234 11235 // round pan position 11236 _panOffset.x = Math.round(_panOffset.x); 11237 _panOffset.y = Math.round(_panOffset.y); 11238 _applyCurrentZoomPan(); 11239 11240 _stopAnimation('zoomPan'); 11241 return; 11242 } 11243 } 11244 11245 } 11246 }; 11247 return s; 11248 }, 11249 11250 _completePanGesture = function(animData) { 11251 // calculate swipe speed for Y axis (paanning) 11252 animData.calculateSwipeSpeed('y'); 11253 11254 _currPanBounds = self.currItem.bounds; 11255 11256 animData.backAnimDestination = {}; 11257 animData.backAnimStarted = {}; 11258 11259 // Avoid acceleration animation if speed is too low 11260 if(Math.abs(animData.lastFlickSpeed.x) <= 0.05 && Math.abs(animData.lastFlickSpeed.y) <= 0.05 ) { 11261 animData.speedDecelerationRatioAbs.x = animData.speedDecelerationRatioAbs.y = 0; 11262 11263 // Run pan drag release animation. E.g. if you drag image and release finger without momentum. 11264 animData.calculateOverBoundsAnimOffset('x'); 11265 animData.calculateOverBoundsAnimOffset('y'); 11266 return true; 11267 } 11268 11269 // Animation loop that controls the acceleration after pan gesture ends 11270 _registerStartAnimation('zoomPan'); 11271 animData.lastNow = _getCurrentTime(); 11272 animData.panAnimLoop(); 11273 }, 11274 11275 11276 _finishSwipeMainScrollGesture = function(gestureType, _releaseAnimData) { 11277 var itemChanged; 11278 if(!_mainScrollAnimating) { 11279 _currZoomedItemIndex = _currentItemIndex; 11280 } 11281 11282 11283 11284 var itemsDiff; 11285 11286 if(gestureType === 'swipe') { 11287 var totalShiftDist = _currPoint.x - _startPoint.x, 11288 isFastLastFlick = _releaseAnimData.lastFlickDist.x < 10; 11289 11290 // if container is shifted for more than MIN_SWIPE_DISTANCE, 11291 // and last flick gesture was in right direction 11292 if(totalShiftDist > MIN_SWIPE_DISTANCE && 11293 (isFastLastFlick || _releaseAnimData.lastFlickOffset.x > 20) ) { 11294 // go to prev item 11295 itemsDiff = -1; 11296 } else if(totalShiftDist < -MIN_SWIPE_DISTANCE && 11297 (isFastLastFlick || _releaseAnimData.lastFlickOffset.x < -20) ) { 11298 // go to next item 11299 itemsDiff = 1; 11300 } 11301 } 11302 11303 var nextCircle; 11304 11305 if(itemsDiff) { 11306 11307 _currentItemIndex += itemsDiff; 11308 11309 if(_currentItemIndex < 0) { 11310 _currentItemIndex = _options.loop ? _getNumItems()-1 : 0; 11311 nextCircle = true; 11312 } else if(_currentItemIndex >= _getNumItems()) { 11313 _currentItemIndex = _options.loop ? 0 : _getNumItems()-1; 11314 nextCircle = true; 11315 } 11316 11317 if(!nextCircle || _options.loop) { 11318 _indexDiff += itemsDiff; 11319 _currPositionIndex -= itemsDiff; 11320 itemChanged = true; 11321 } 11322 11323 11324 11325 } 11326 11327 var animateToX = _slideSize.x * _currPositionIndex; 11328 var animateToDist = Math.abs( animateToX - _mainScrollPos.x ); 11329 var finishAnimDuration; 11330 11331 11332 if(!itemChanged && animateToX > _mainScrollPos.x !== _releaseAnimData.lastFlickSpeed.x > 0) { 11333 // "return to current" duration, e.g. when dragging from slide 0 to -1 11334 finishAnimDuration = 333; 11335 } else { 11336 finishAnimDuration = Math.abs(_releaseAnimData.lastFlickSpeed.x) > 0 ? 11337 animateToDist / Math.abs(_releaseAnimData.lastFlickSpeed.x) : 11338 333; 11339 11340 finishAnimDuration = Math.min(finishAnimDuration, 400); 11341 finishAnimDuration = Math.max(finishAnimDuration, 250); 11342 } 11343 11344 if(_currZoomedItemIndex === _currentItemIndex) { 11345 itemChanged = false; 11346 } 11347 11348 _mainScrollAnimating = true; 11349 11350 _shout('mainScrollAnimStart'); 11351 11352 _animateProp('mainScroll', _mainScrollPos.x, animateToX, finishAnimDuration, framework.easing.cubic.out, 11353 _moveMainScroll, 11354 function() { 11355 _stopAllAnimations(); 11356 _mainScrollAnimating = false; 11357 _currZoomedItemIndex = -1; 11358 11359 if(itemChanged || _currZoomedItemIndex !== _currentItemIndex) { 11360 self.updateCurrItem(); 11361 } 11362 11363 _shout('mainScrollAnimComplete'); 11364 } 11365 ); 11366 11367 if(itemChanged) { 11368 self.updateCurrItem(true); 11369 } 11370 11371 return itemChanged; 11372 }, 11373 11374 _calculateZoomLevel = function(touchesDistance) { 11375 return 1 / _startPointsDistance * touchesDistance * _startZoomLevel; 11376 }, 11377 11378 // Resets zoom if it's out of bounds 11379 _completeZoomGesture = function() { 11380 var destZoomLevel = _currZoomLevel, 11381 minZoomLevel = _getMinZoomLevel(), 11382 maxZoomLevel = _getMaxZoomLevel(); 11383 11384 if ( _currZoomLevel < minZoomLevel ) { 11385 destZoomLevel = minZoomLevel; 11386 } else if ( _currZoomLevel > maxZoomLevel ) { 11387 destZoomLevel = maxZoomLevel; 11388 } 11389 11390 var destOpacity = 1, 11391 onUpdate, 11392 initialOpacity = _bgOpacity; 11393 11394 if(_opacityChanged && !_isZoomingIn && !_wasOverInitialZoom && _currZoomLevel < minZoomLevel) { 11395 //_closedByScroll = true; 11396 self.close(); 11397 return true; 11398 } 11399 11400 if(_opacityChanged) { 11401 onUpdate = function(now) { 11402 _applyBgOpacity( (destOpacity - initialOpacity) * now + initialOpacity ); 11403 }; 11404 } 11405 11406 self.zoomTo(destZoomLevel, 0, 200, framework.easing.cubic.out, onUpdate); 11407 return true; 11408 }; 11409 11410 11411_registerModule('Gestures', { 11412 publicMethods: { 11413 11414 initGestures: function() { 11415 11416 // helper function that builds touch/pointer/mouse events 11417 var addEventNames = function(pref, down, move, up, cancel) { 11418 _dragStartEvent = pref + down; 11419 _dragMoveEvent = pref + move; 11420 _dragEndEvent = pref + up; 11421 if(cancel) { 11422 _dragCancelEvent = pref + cancel; 11423 } else { 11424 _dragCancelEvent = ''; 11425 } 11426 }; 11427 11428 _pointerEventEnabled = _features.pointerEvent; 11429 if(_pointerEventEnabled && _features.touch) { 11430 // we don't need touch events, if browser supports pointer events 11431 _features.touch = false; 11432 } 11433 11434 if(_pointerEventEnabled) { 11435 if(navigator.pointerEnabled) { 11436 addEventNames('pointer', 'down', 'move', 'up', 'cancel'); 11437 } else { 11438 // IE10 pointer events are case-sensitive 11439 addEventNames('MSPointer', 'Down', 'Move', 'Up', 'Cancel'); 11440 } 11441 } else if(_features.touch) { 11442 addEventNames('touch', 'start', 'move', 'end', 'cancel'); 11443 _likelyTouchDevice = true; 11444 } else { 11445 addEventNames('mouse', 'down', 'move', 'up'); 11446 } 11447 11448 _upMoveEvents = _dragMoveEvent + ' ' + _dragEndEvent + ' ' + _dragCancelEvent; 11449 _downEvents = _dragStartEvent; 11450 11451 if(_pointerEventEnabled && !_likelyTouchDevice) { 11452 _likelyTouchDevice = (navigator.maxTouchPoints > 1) || (navigator.msMaxTouchPoints > 1); 11453 } 11454 // make variable public 11455 self.likelyTouchDevice = _likelyTouchDevice; 11456 11457 _globalEventHandlers[_dragStartEvent] = _onDragStart; 11458 _globalEventHandlers[_dragMoveEvent] = _onDragMove; 11459 _globalEventHandlers[_dragEndEvent] = _onDragRelease; // the Kraken 11460 11461 if(_dragCancelEvent) { 11462 _globalEventHandlers[_dragCancelEvent] = _globalEventHandlers[_dragEndEvent]; 11463 } 11464 11465 // Bind mouse events on device with detected hardware touch support, in case it supports multiple types of input. 11466 if(_features.touch) { 11467 _downEvents += ' mousedown'; 11468 _upMoveEvents += ' mousemove mouseup'; 11469 _globalEventHandlers.mousedown = _globalEventHandlers[_dragStartEvent]; 11470 _globalEventHandlers.mousemove = _globalEventHandlers[_dragMoveEvent]; 11471 _globalEventHandlers.mouseup = _globalEventHandlers[_dragEndEvent]; 11472 } 11473 11474 if(!_likelyTouchDevice) { 11475 // don't allow pan to next slide from zoomed state on Desktop 11476 _options.allowPanToNext = false; 11477 } 11478 } 11479 11480 } 11481}); 11482 11483 11484/*>>gestures*/ 11485 11486/*>>show-hide-transition*/ 11487/** 11488 * show-hide-transition.js: 11489 * 11490 * Manages initial opening or closing transition. 11491 * 11492 * If you're not planning to use transition for gallery at all, 11493 * you may set options hideAnimationDuration and showAnimationDuration to 0, 11494 * and just delete startAnimation function. 11495 * 11496 */ 11497 11498 11499var _showOrHideTimeout, 11500 _showOrHide = function(item, img, out, completeFn) { 11501 11502 if(_showOrHideTimeout) { 11503 clearTimeout(_showOrHideTimeout); 11504 } 11505 11506 _initialZoomRunning = true; 11507 _initialContentSet = true; 11508 11509 // dimensions of small thumbnail {x:,y:,w:}. 11510 // Height is optional, as calculated based on large image. 11511 var thumbBounds; 11512 if(item.initialLayout) { 11513 thumbBounds = item.initialLayout; 11514 item.initialLayout = null; 11515 } else { 11516 thumbBounds = _options.getThumbBoundsFn && _options.getThumbBoundsFn(_currentItemIndex); 11517 } 11518 11519 var duration = out ? _options.hideAnimationDuration : _options.showAnimationDuration; 11520 11521 var onComplete = function() { 11522 _stopAnimation('initialZoom'); 11523 if(!out) { 11524 _applyBgOpacity(1); 11525 if(img) { 11526 img.style.display = 'block'; 11527 } 11528 framework.addClass(template, 'pswp--animated-in'); 11529 _shout('initialZoom' + (out ? 'OutEnd' : 'InEnd')); 11530 } else { 11531 self.template.removeAttribute('style'); 11532 self.bg.removeAttribute('style'); 11533 } 11534 11535 if(completeFn) { 11536 completeFn(); 11537 } 11538 _initialZoomRunning = false; 11539 }; 11540 11541 // if bounds aren't provided, just open gallery without animation 11542 if(!duration || !thumbBounds || thumbBounds.x === undefined) { 11543 11544 _shout('initialZoom' + (out ? 'Out' : 'In') ); 11545 11546 _currZoomLevel = item.initialZoomLevel; 11547 _equalizePoints(_panOffset, item.initialPosition ); 11548 _applyCurrentZoomPan(); 11549 11550 template.style.opacity = out ? 0 : 1; 11551 _applyBgOpacity(1); 11552 11553 if(duration) { 11554 setTimeout(function() { 11555 onComplete(); 11556 }, duration); 11557 } else { 11558 onComplete(); 11559 } 11560 11561 return; 11562 } 11563 11564 var startAnimation = function() { 11565 var closeWithRaf = _closedByScroll, 11566 fadeEverything = !self.currItem.src || self.currItem.loadError || _options.showHideOpacity; 11567 11568 // apply hw-acceleration to image 11569 if(item.miniImg) { 11570 item.miniImg.style.webkitBackfaceVisibility = 'hidden'; 11571 } 11572 11573 if(!out) { 11574 _currZoomLevel = thumbBounds.w / item.w; 11575 _panOffset.x = thumbBounds.x; 11576 _panOffset.y = thumbBounds.y - _initalWindowScrollY; 11577 11578 self[fadeEverything ? 'template' : 'bg'].style.opacity = 0.001; 11579 _applyCurrentZoomPan(); 11580 } 11581 11582 _registerStartAnimation('initialZoom'); 11583 11584 if(out && !closeWithRaf) { 11585 framework.removeClass(template, 'pswp--animated-in'); 11586 } 11587 11588 if(fadeEverything) { 11589 if(out) { 11590 framework[ (closeWithRaf ? 'remove' : 'add') + 'Class' ](template, 'pswp--animate_opacity'); 11591 } else { 11592 setTimeout(function() { 11593 framework.addClass(template, 'pswp--animate_opacity'); 11594 }, 30); 11595 } 11596 } 11597 11598 _showOrHideTimeout = setTimeout(function() { 11599 11600 _shout('initialZoom' + (out ? 'Out' : 'In') ); 11601 11602 11603 if(!out) { 11604 11605 // "in" animation always uses CSS transitions (instead of rAF). 11606 // CSS transition work faster here, 11607 // as developer may also want to animate other things, 11608 // like ui on top of sliding area, which can be animated just via CSS 11609 11610 _currZoomLevel = item.initialZoomLevel; 11611 _equalizePoints(_panOffset, item.initialPosition ); 11612 _applyCurrentZoomPan(); 11613 _applyBgOpacity(1); 11614 11615 if(fadeEverything) { 11616 template.style.opacity = 1; 11617 } else { 11618 _applyBgOpacity(1); 11619 } 11620 11621 _showOrHideTimeout = setTimeout(onComplete, duration + 20); 11622 } else { 11623 11624 // "out" animation uses rAF only when PhotoSwipe is closed by browser scroll, to recalculate position 11625 var destZoomLevel = thumbBounds.w / item.w, 11626 initialPanOffset = { 11627 x: _panOffset.x, 11628 y: _panOffset.y 11629 }, 11630 initialZoomLevel = _currZoomLevel, 11631 initalBgOpacity = _bgOpacity, 11632 onUpdate = function(now) { 11633 11634 if(now === 1) { 11635 _currZoomLevel = destZoomLevel; 11636 _panOffset.x = thumbBounds.x; 11637 _panOffset.y = thumbBounds.y - _currentWindowScrollY; 11638 } else { 11639 _currZoomLevel = (destZoomLevel - initialZoomLevel) * now + initialZoomLevel; 11640 _panOffset.x = (thumbBounds.x - initialPanOffset.x) * now + initialPanOffset.x; 11641 _panOffset.y = (thumbBounds.y - _currentWindowScrollY - initialPanOffset.y) * now + initialPanOffset.y; 11642 } 11643 11644 _applyCurrentZoomPan(); 11645 if(fadeEverything) { 11646 template.style.opacity = 1 - now; 11647 } else { 11648 _applyBgOpacity( initalBgOpacity - now * initalBgOpacity ); 11649 } 11650 }; 11651 11652 if(closeWithRaf) { 11653 _animateProp('initialZoom', 0, 1, duration, framework.easing.cubic.out, onUpdate, onComplete); 11654 } else { 11655 onUpdate(1); 11656 _showOrHideTimeout = setTimeout(onComplete, duration + 20); 11657 } 11658 } 11659 11660 }, out ? 25 : 90); // Main purpose of this delay is to give browser time to paint and 11661 // create composite layers of PhotoSwipe UI parts (background, controls, caption, arrows). 11662 // Which avoids lag at the beginning of scale transition. 11663 }; 11664 startAnimation(); 11665 11666 11667 }; 11668 11669/*>>show-hide-transition*/ 11670 11671/*>>items-controller*/ 11672/** 11673* 11674* Controller manages gallery items, their dimensions, and their content. 11675* 11676*/ 11677 11678var _items, 11679 _tempPanAreaSize = {}, 11680 _imagesToAppendPool = [], 11681 _initialContentSet, 11682 _initialZoomRunning, 11683 _controllerDefaultOptions = { 11684 index: 0, 11685 errorMsg: '<div class="pswp__error-msg"><a href="%url%" target="_blank">The image</a> could not be loaded.</div>', 11686 forceProgressiveLoading: false, // TODO 11687 preload: [1,1], 11688 getNumItemsFn: function() { 11689 return _items.length; 11690 } 11691 }; 11692 11693 11694var _getItemAt, 11695 _getNumItems, 11696 _initialIsLoop, 11697 _getZeroBounds = function() { 11698 return { 11699 center:{x:0,y:0}, 11700 max:{x:0,y:0}, 11701 min:{x:0,y:0} 11702 }; 11703 }, 11704 _calculateSingleItemPanBounds = function(item, realPanElementW, realPanElementH ) { 11705 var bounds = item.bounds; 11706 11707 // position of element when it's centered 11708 bounds.center.x = Math.round((_tempPanAreaSize.x - realPanElementW) / 2); 11709 bounds.center.y = Math.round((_tempPanAreaSize.y - realPanElementH) / 2) + item.vGap.top; 11710 11711 // maximum pan position 11712 bounds.max.x = (realPanElementW > _tempPanAreaSize.x) ? 11713 Math.round(_tempPanAreaSize.x - realPanElementW) : 11714 bounds.center.x; 11715 11716 bounds.max.y = (realPanElementH > _tempPanAreaSize.y) ? 11717 Math.round(_tempPanAreaSize.y - realPanElementH) + item.vGap.top : 11718 bounds.center.y; 11719 11720 // minimum pan position 11721 bounds.min.x = (realPanElementW > _tempPanAreaSize.x) ? 0 : bounds.center.x; 11722 bounds.min.y = (realPanElementH > _tempPanAreaSize.y) ? item.vGap.top : bounds.center.y; 11723 }, 11724 _calculateItemSize = function(item, viewportSize, zoomLevel) { 11725 11726 if (item.src && !item.loadError) { 11727 var isInitial = !zoomLevel; 11728 11729 if(isInitial) { 11730 if(!item.vGap) { 11731 item.vGap = {top:0,bottom:0}; 11732 } 11733 // allows overriding vertical margin for individual items 11734 _shout('parseVerticalMargin', item); 11735 } 11736 11737 11738 _tempPanAreaSize.x = viewportSize.x; 11739 _tempPanAreaSize.y = viewportSize.y - item.vGap.top - item.vGap.bottom; 11740 11741 if (isInitial) { 11742 var hRatio = _tempPanAreaSize.x / item.w; 11743 var vRatio = _tempPanAreaSize.y / item.h; 11744 11745 item.fitRatio = hRatio < vRatio ? hRatio : vRatio; 11746 //item.fillRatio = hRatio > vRatio ? hRatio : vRatio; 11747 11748 var scaleMode = _options.scaleMode; 11749 11750 if (scaleMode === 'orig') { 11751 zoomLevel = 1; 11752 } else if (scaleMode === 'fit') { 11753 zoomLevel = item.fitRatio; 11754 } 11755 11756 if (zoomLevel > 1) { 11757 zoomLevel = 1; 11758 } 11759 11760 item.initialZoomLevel = zoomLevel; 11761 11762 if(!item.bounds) { 11763 // reuse bounds object 11764 item.bounds = _getZeroBounds(); 11765 } 11766 } 11767 11768 if(!zoomLevel) { 11769 return; 11770 } 11771 11772 _calculateSingleItemPanBounds(item, item.w * zoomLevel, item.h * zoomLevel); 11773 11774 if (isInitial && zoomLevel === item.initialZoomLevel) { 11775 item.initialPosition = item.bounds.center; 11776 } 11777 11778 return item.bounds; 11779 } else { 11780 item.w = item.h = 0; 11781 item.initialZoomLevel = item.fitRatio = 1; 11782 item.bounds = _getZeroBounds(); 11783 item.initialPosition = item.bounds.center; 11784 11785 // if it's not image, we return zero bounds (content is not zoomable) 11786 return item.bounds; 11787 } 11788 11789 }, 11790 11791 11792 11793 11794 _appendImage = function(index, item, baseDiv, img, preventAnimation, keepPlaceholder) { 11795 11796 11797 if(item.loadError) { 11798 return; 11799 } 11800 11801 if(img) { 11802 11803 item.imageAppended = true; 11804 _setImageSize(item, img, (item === self.currItem && _renderMaxResolution) ); 11805 11806 baseDiv.appendChild(img); 11807 11808 if(keepPlaceholder) { 11809 setTimeout(function() { 11810 if(item && item.loaded && item.placeholder) { 11811 item.placeholder.style.display = 'none'; 11812 item.placeholder = null; 11813 } 11814 }, 500); 11815 } 11816 } 11817 }, 11818 11819 11820 11821 _preloadImage = function(item) { 11822 item.loading = true; 11823 item.loaded = false; 11824 var img = item.img = framework.createEl('pswp__img', 'img'); 11825 var onComplete = function() { 11826 item.loading = false; 11827 item.loaded = true; 11828 11829 if(item.loadComplete) { 11830 item.loadComplete(item); 11831 } else { 11832 item.img = null; // no need to store image object 11833 } 11834 img.onload = img.onerror = null; 11835 img = null; 11836 }; 11837 img.onload = onComplete; 11838 img.onerror = function() { 11839 item.loadError = true; 11840 onComplete(); 11841 }; 11842 11843 img.src = item.src;// + '?a=' + Math.random(); 11844 11845 return img; 11846 }, 11847 _checkForError = function(item, cleanUp) { 11848 if(item.src && item.loadError && item.container) { 11849 11850 if(cleanUp) { 11851 item.container.innerHTML = ''; 11852 } 11853 11854 item.container.innerHTML = _options.errorMsg.replace('%url%', item.src ); 11855 return true; 11856 11857 } 11858 }, 11859 _setImageSize = function(item, img, maxRes) { 11860 if(!item.src) { 11861 return; 11862 } 11863 11864 if(!img) { 11865 img = item.container.lastChild; 11866 } 11867 11868 var w = maxRes ? item.w : Math.round(item.w * item.fitRatio), 11869 h = maxRes ? item.h : Math.round(item.h * item.fitRatio); 11870 11871 if(item.placeholder && !item.loaded) { 11872 item.placeholder.style.width = w + 'px'; 11873 item.placeholder.style.height = h + 'px'; 11874 } 11875 11876 img.style.width = w + 'px'; 11877 img.style.height = h + 'px'; 11878 }, 11879 _appendImagesPool = function() { 11880 11881 if(_imagesToAppendPool.length) { 11882 var poolItem; 11883 11884 for(var i = 0; i < _imagesToAppendPool.length; i++) { 11885 poolItem = _imagesToAppendPool[i]; 11886 if( poolItem.holder.index === poolItem.index ) { 11887 _appendImage(poolItem.index, poolItem.item, poolItem.baseDiv, poolItem.img, false, poolItem.clearPlaceholder); 11888 } 11889 } 11890 _imagesToAppendPool = []; 11891 } 11892 }; 11893 11894 11895 11896_registerModule('Controller', { 11897 11898 publicMethods: { 11899 11900 lazyLoadItem: function(index) { 11901 index = _getLoopedId(index); 11902 var item = _getItemAt(index); 11903 11904 if(!item || ((item.loaded || item.loading) && !_itemsNeedUpdate)) { 11905 return; 11906 } 11907 11908 _shout('gettingData', index, item); 11909 11910 if (!item.src) { 11911 return; 11912 } 11913 11914 _preloadImage(item); 11915 }, 11916 initController: function() { 11917 framework.extend(_options, _controllerDefaultOptions, true); 11918 self.items = _items = items; 11919 _getItemAt = self.getItemAt; 11920 _getNumItems = _options.getNumItemsFn; //self.getNumItems; 11921 11922 11923 11924 _initialIsLoop = _options.loop; 11925 if(_getNumItems() < 3) { 11926 _options.loop = false; // disable loop if less then 3 items 11927 } 11928 11929 _listen('beforeChange', function(diff) { 11930 11931 var p = _options.preload, 11932 isNext = diff === null ? true : (diff >= 0), 11933 preloadBefore = Math.min(p[0], _getNumItems() ), 11934 preloadAfter = Math.min(p[1], _getNumItems() ), 11935 i; 11936 11937 11938 for(i = 1; i <= (isNext ? preloadAfter : preloadBefore); i++) { 11939 self.lazyLoadItem(_currentItemIndex+i); 11940 } 11941 for(i = 1; i <= (isNext ? preloadBefore : preloadAfter); i++) { 11942 self.lazyLoadItem(_currentItemIndex-i); 11943 } 11944 }); 11945 11946 _listen('initialLayout', function() { 11947 self.currItem.initialLayout = _options.getThumbBoundsFn && _options.getThumbBoundsFn(_currentItemIndex); 11948 }); 11949 11950 _listen('mainScrollAnimComplete', _appendImagesPool); 11951 _listen('initialZoomInEnd', _appendImagesPool); 11952 11953 11954 11955 _listen('destroy', function() { 11956 var item; 11957 for(var i = 0; i < _items.length; i++) { 11958 item = _items[i]; 11959 // remove reference to DOM elements, for GC 11960 if(item.container) { 11961 item.container = null; 11962 } 11963 if(item.placeholder) { 11964 item.placeholder = null; 11965 } 11966 if(item.img) { 11967 item.img = null; 11968 } 11969 if(item.preloader) { 11970 item.preloader = null; 11971 } 11972 if(item.loadError) { 11973 item.loaded = item.loadError = false; 11974 } 11975 } 11976 _imagesToAppendPool = null; 11977 }); 11978 }, 11979 11980 11981 getItemAt: function(index) { 11982 if (index >= 0) { 11983 return _items[index] !== undefined ? _items[index] : false; 11984 } 11985 return false; 11986 }, 11987 11988 allowProgressiveImg: function() { 11989 // 1. Progressive image loading isn't working on webkit/blink 11990 // when hw-acceleration (e.g. translateZ) is applied to IMG element. 11991 // That's why in PhotoSwipe parent element gets zoom transform, not image itself. 11992 // 11993 // 2. Progressive image loading sometimes blinks in webkit/blink when applying animation to parent element. 11994 // That's why it's disabled on touch devices (mainly because of swipe transition) 11995 // 11996 // 3. Progressive image loading sometimes doesn't work in IE (up to 11). 11997 11998 // Don't allow progressive loading on non-large touch devices 11999 return _options.forceProgressiveLoading || !_likelyTouchDevice || _options.mouseUsed || screen.width > 1200; 12000 // 1200 - to eliminate touch devices with large screen (like Chromebook Pixel) 12001 }, 12002 12003 setContent: function(holder, index) { 12004 12005 if(_options.loop) { 12006 index = _getLoopedId(index); 12007 } 12008 12009 var prevItem = self.getItemAt(holder.index); 12010 if(prevItem) { 12011 prevItem.container = null; 12012 } 12013 12014 var item = self.getItemAt(index), 12015 img; 12016 12017 if(!item) { 12018 holder.el.innerHTML = ''; 12019 return; 12020 } 12021 12022 // allow to override data 12023 _shout('gettingData', index, item); 12024 12025 holder.index = index; 12026 holder.item = item; 12027 12028 // base container DIV is created only once for each of 3 holders 12029 var baseDiv = item.container = framework.createEl('pswp__zoom-wrap'); 12030 12031 12032 12033 if(!item.src && item.html) { 12034 if(item.html.tagName) { 12035 baseDiv.appendChild(item.html); 12036 } else { 12037 baseDiv.innerHTML = item.html; 12038 } 12039 } 12040 12041 _checkForError(item); 12042 12043 _calculateItemSize(item, _viewportSize); 12044 12045 if(item.src && !item.loadError && !item.loaded) { 12046 12047 item.loadComplete = function(item) { 12048 12049 // gallery closed before image finished loading 12050 if(!_isOpen) { 12051 return; 12052 } 12053 12054 // check if holder hasn't changed while image was loading 12055 if(holder && holder.index === index ) { 12056 if( _checkForError(item, true) ) { 12057 item.loadComplete = item.img = null; 12058 _calculateItemSize(item, _viewportSize); 12059 _applyZoomPanToItem(item); 12060 12061 if(holder.index === _currentItemIndex) { 12062 // recalculate dimensions 12063 self.updateCurrZoomItem(); 12064 } 12065 return; 12066 } 12067 if( !item.imageAppended ) { 12068 if(_features.transform && (_mainScrollAnimating || _initialZoomRunning) ) { 12069 _imagesToAppendPool.push({ 12070 item:item, 12071 baseDiv:baseDiv, 12072 img:item.img, 12073 index:index, 12074 holder:holder, 12075 clearPlaceholder:true 12076 }); 12077 } else { 12078 _appendImage(index, item, baseDiv, item.img, _mainScrollAnimating || _initialZoomRunning, true); 12079 } 12080 } else { 12081 // remove preloader & mini-img 12082 if(!_initialZoomRunning && item.placeholder) { 12083 item.placeholder.style.display = 'none'; 12084 item.placeholder = null; 12085 } 12086 } 12087 } 12088 12089 item.loadComplete = null; 12090 item.img = null; // no need to store image element after it's added 12091 12092 _shout('imageLoadComplete', index, item); 12093 }; 12094 12095 if(framework.features.transform) { 12096 12097 var placeholderClassName = 'pswp__img pswp__img--placeholder'; 12098 placeholderClassName += (item.msrc ? '' : ' pswp__img--placeholder--blank'); 12099 12100 var placeholder = framework.createEl(placeholderClassName, item.msrc ? 'img' : ''); 12101 if(item.msrc) { 12102 placeholder.src = item.msrc; 12103 } 12104 12105 _setImageSize(item, placeholder); 12106 12107 baseDiv.appendChild(placeholder); 12108 item.placeholder = placeholder; 12109 12110 } 12111 12112 12113 12114 12115 if(!item.loading) { 12116 _preloadImage(item); 12117 } 12118 12119 12120 if( self.allowProgressiveImg() ) { 12121 // just append image 12122 if(!_initialContentSet && _features.transform) { 12123 _imagesToAppendPool.push({ 12124 item:item, 12125 baseDiv:baseDiv, 12126 img:item.img, 12127 index:index, 12128 holder:holder 12129 }); 12130 } else { 12131 _appendImage(index, item, baseDiv, item.img, true, true); 12132 } 12133 } 12134 12135 } else if(item.src && !item.loadError) { 12136 // image object is created every time, due to bugs of image loading & delay when switching images 12137 img = framework.createEl('pswp__img', 'img'); 12138 img.style.opacity = 1; 12139 img.src = item.src; 12140 _setImageSize(item, img); 12141 _appendImage(index, item, baseDiv, img, true); 12142 } 12143 12144 12145 if(!_initialContentSet && index === _currentItemIndex) { 12146 _currZoomElementStyle = baseDiv.style; 12147 _showOrHide(item, (img ||item.img) ); 12148 } else { 12149 _applyZoomPanToItem(item); 12150 } 12151 12152 holder.el.innerHTML = ''; 12153 holder.el.appendChild(baseDiv); 12154 }, 12155 12156 cleanSlide: function( item ) { 12157 if(item.img ) { 12158 item.img.onload = item.img.onerror = null; 12159 } 12160 item.loaded = item.loading = item.img = item.imageAppended = false; 12161 } 12162 12163 } 12164}); 12165 12166/*>>items-controller*/ 12167 12168/*>>tap*/ 12169/** 12170 * tap.js: 12171 * 12172 * Displatches tap and double-tap events. 12173 * 12174 */ 12175 12176var tapTimer, 12177 tapReleasePoint = {}, 12178 _dispatchTapEvent = function(origEvent, releasePoint, pointerType) { 12179 var e = document.createEvent( 'CustomEvent' ), 12180 eDetail = { 12181 origEvent:origEvent, 12182 target:origEvent.target, 12183 releasePoint: releasePoint, 12184 pointerType:pointerType || 'touch' 12185 }; 12186 12187 e.initCustomEvent( 'pswpTap', true, true, eDetail ); 12188 origEvent.target.dispatchEvent(e); 12189 }; 12190 12191_registerModule('Tap', { 12192 publicMethods: { 12193 initTap: function() { 12194 _listen('firstTouchStart', self.onTapStart); 12195 _listen('touchRelease', self.onTapRelease); 12196 _listen('destroy', function() { 12197 tapReleasePoint = {}; 12198 tapTimer = null; 12199 }); 12200 }, 12201 onTapStart: function(touchList) { 12202 if(touchList.length > 1) { 12203 clearTimeout(tapTimer); 12204 tapTimer = null; 12205 } 12206 }, 12207 onTapRelease: function(e, releasePoint) { 12208 if(!releasePoint) { 12209 return; 12210 } 12211 12212 if(!_moved && !_isMultitouch && !_numAnimations) { 12213 var p0 = releasePoint; 12214 if(tapTimer) { 12215 clearTimeout(tapTimer); 12216 tapTimer = null; 12217 12218 // Check if taped on the same place 12219 if ( _isNearbyPoints(p0, tapReleasePoint) ) { 12220 _shout('doubleTap', p0); 12221 return; 12222 } 12223 } 12224 12225 if(releasePoint.type === 'mouse') { 12226 _dispatchTapEvent(e, releasePoint, 'mouse'); 12227 return; 12228 } 12229 12230 var clickedTagName = e.target.tagName.toUpperCase(); 12231 // avoid double tap delay on buttons and elements that have class pswp__single-tap 12232 if(clickedTagName === 'BUTTON' || framework.hasClass(e.target, 'pswp__single-tap') ) { 12233 _dispatchTapEvent(e, releasePoint); 12234 return; 12235 } 12236 12237 _equalizePoints(tapReleasePoint, p0); 12238 12239 tapTimer = setTimeout(function() { 12240 _dispatchTapEvent(e, releasePoint); 12241 tapTimer = null; 12242 }, 300); 12243 } 12244 } 12245 } 12246}); 12247 12248/*>>tap*/ 12249 12250/*>>desktop-zoom*/ 12251/** 12252 * 12253 * desktop-zoom.js: 12254 * 12255 * - Binds mousewheel event for paning zoomed image. 12256 * - Manages "dragging", "zoomed-in", "zoom-out" classes. 12257 * (which are used for cursors and zoom icon) 12258 * - Adds toggleDesktopZoom function. 12259 * 12260 */ 12261 12262var _wheelDelta; 12263 12264_registerModule('DesktopZoom', { 12265 12266 publicMethods: { 12267 12268 initDesktopZoom: function() { 12269 12270 if(_oldIE) { 12271 // no zoom for old IE (<=8) 12272 return; 12273 } 12274 12275 if(_likelyTouchDevice) { 12276 // if detected hardware touch support, we wait until mouse is used, 12277 // and only then apply desktop-zoom features 12278 _listen('mouseUsed', function() { 12279 self.setupDesktopZoom(); 12280 }); 12281 } else { 12282 self.setupDesktopZoom(true); 12283 } 12284 12285 }, 12286 12287 setupDesktopZoom: function(onInit) { 12288 12289 _wheelDelta = {}; 12290 12291 var events = 'wheel mousewheel DOMMouseScroll'; 12292 12293 _listen('bindEvents', function() { 12294 framework.bind(template, events, self.handleMouseWheel); 12295 }); 12296 12297 _listen('unbindEvents', function() { 12298 if(_wheelDelta) { 12299 framework.unbind(template, events, self.handleMouseWheel); 12300 } 12301 }); 12302 12303 self.mouseZoomedIn = false; 12304 12305 var hasDraggingClass, 12306 updateZoomable = function() { 12307 if(self.mouseZoomedIn) { 12308 framework.removeClass(template, 'pswp--zoomed-in'); 12309 self.mouseZoomedIn = false; 12310 } 12311 if(_currZoomLevel < 1) { 12312 framework.addClass(template, 'pswp--zoom-allowed'); 12313 } else { 12314 framework.removeClass(template, 'pswp--zoom-allowed'); 12315 } 12316 removeDraggingClass(); 12317 }, 12318 removeDraggingClass = function() { 12319 if(hasDraggingClass) { 12320 framework.removeClass(template, 'pswp--dragging'); 12321 hasDraggingClass = false; 12322 } 12323 }; 12324 12325 _listen('resize' , updateZoomable); 12326 _listen('afterChange' , updateZoomable); 12327 _listen('pointerDown', function() { 12328 if(self.mouseZoomedIn) { 12329 hasDraggingClass = true; 12330 framework.addClass(template, 'pswp--dragging'); 12331 } 12332 }); 12333 _listen('pointerUp', removeDraggingClass); 12334 12335 if(!onInit) { 12336 updateZoomable(); 12337 } 12338 12339 }, 12340 12341 handleMouseWheel: function(e) { 12342 12343 if(_currZoomLevel <= self.currItem.fitRatio) { 12344 if( _options.modal ) { 12345 12346 if (!_options.closeOnScroll || _numAnimations || _isDragging) { 12347 e.preventDefault(); 12348 } else if(_transformKey && Math.abs(e.deltaY) > 2) { 12349 // close PhotoSwipe 12350 // if browser supports transforms & scroll changed enough 12351 _closedByScroll = true; 12352 self.close(); 12353 } 12354 12355 } 12356 return true; 12357 } 12358 12359 // allow just one event to fire 12360 e.stopPropagation(); 12361 12362 // https://developer.mozilla.org/en-US/docs/Web/Events/wheel 12363 _wheelDelta.x = 0; 12364 12365 if('deltaX' in e) { 12366 if(e.deltaMode === 1 /* DOM_DELTA_LINE */) { 12367 // 18 - average line height 12368 _wheelDelta.x = e.deltaX * 18; 12369 _wheelDelta.y = e.deltaY * 18; 12370 } else { 12371 _wheelDelta.x = e.deltaX; 12372 _wheelDelta.y = e.deltaY; 12373 } 12374 } else if('wheelDelta' in e) { 12375 if(e.wheelDeltaX) { 12376 _wheelDelta.x = -0.16 * e.wheelDeltaX; 12377 } 12378 if(e.wheelDeltaY) { 12379 _wheelDelta.y = -0.16 * e.wheelDeltaY; 12380 } else { 12381 _wheelDelta.y = -0.16 * e.wheelDelta; 12382 } 12383 } else if('detail' in e) { 12384 _wheelDelta.y = e.detail; 12385 } else { 12386 return; 12387 } 12388 12389 _calculatePanBounds(_currZoomLevel, true); 12390 12391 var newPanX = _panOffset.x - _wheelDelta.x, 12392 newPanY = _panOffset.y - _wheelDelta.y; 12393 12394 // only prevent scrolling in nonmodal mode when not at edges 12395 if (_options.modal || 12396 ( 12397 newPanX <= _currPanBounds.min.x && newPanX >= _currPanBounds.max.x && 12398 newPanY <= _currPanBounds.min.y && newPanY >= _currPanBounds.max.y 12399 ) ) { 12400 e.preventDefault(); 12401 } 12402 12403 // TODO: use rAF instead of mousewheel? 12404 self.panTo(newPanX, newPanY); 12405 }, 12406 12407 toggleDesktopZoom: function(centerPoint) { 12408 centerPoint = centerPoint || {x:_viewportSize.x/2 + _offset.x, y:_viewportSize.y/2 + _offset.y }; 12409 12410 var doubleTapZoomLevel = _options.getDoubleTapZoom(true, self.currItem); 12411 var zoomOut = _currZoomLevel === doubleTapZoomLevel; 12412 12413 self.mouseZoomedIn = !zoomOut; 12414 12415 self.zoomTo(zoomOut ? self.currItem.initialZoomLevel : doubleTapZoomLevel, centerPoint, 333); 12416 framework[ (!zoomOut ? 'add' : 'remove') + 'Class'](template, 'pswp--zoomed-in'); 12417 } 12418 12419 } 12420}); 12421 12422 12423/*>>desktop-zoom*/ 12424 12425/*>>history*/ 12426/** 12427 * 12428 * history.js: 12429 * 12430 * - Back button to close gallery. 12431 * 12432 * - Unique URL for each slide: example.com/&pid=1&gid=3 12433 * (where PID is picture index, and GID and gallery index) 12434 * 12435 * - Switch URL when slides change. 12436 * 12437 */ 12438 12439 12440var _historyDefaultOptions = { 12441 history: true, 12442 galleryUID: 1 12443}; 12444 12445var _historyUpdateTimeout, 12446 _hashChangeTimeout, 12447 _hashAnimCheckTimeout, 12448 _hashChangedByScript, 12449 _hashChangedByHistory, 12450 _hashReseted, 12451 _initialHash, 12452 _historyChanged, 12453 _closedFromURL, 12454 _urlChangedOnce, 12455 _windowLoc, 12456 12457 _supportsPushState, 12458 12459 _getHash = function() { 12460 return _windowLoc.hash.substring(1); 12461 }, 12462 _cleanHistoryTimeouts = function() { 12463 12464 if(_historyUpdateTimeout) { 12465 clearTimeout(_historyUpdateTimeout); 12466 } 12467 12468 if(_hashAnimCheckTimeout) { 12469 clearTimeout(_hashAnimCheckTimeout); 12470 } 12471 }, 12472 12473 // pid - Picture index 12474 // gid - Gallery index 12475 _parseItemIndexFromURL = function() { 12476 var hash = _getHash(), 12477 params = {}; 12478 12479 if(hash.length < 5) { // pid=1 12480 return params; 12481 } 12482 12483 var i, vars = hash.split('&'); 12484 for (i = 0; i < vars.length; i++) { 12485 if(!vars[i]) { 12486 continue; 12487 } 12488 var pair = vars[i].split('='); 12489 if(pair.length < 2) { 12490 continue; 12491 } 12492 params[pair[0]] = pair[1]; 12493 } 12494 if(_options.galleryPIDs) { 12495 // detect custom pid in hash and search for it among the items collection 12496 var searchfor = params.pid; 12497 params.pid = 0; // if custom pid cannot be found, fallback to the first item 12498 for(i = 0; i < _items.length; i++) { 12499 if(_items[i].pid === searchfor) { 12500 params.pid = i; 12501 break; 12502 } 12503 } 12504 } else { 12505 params.pid = parseInt(params.pid,10)-1; 12506 } 12507 if( params.pid < 0 ) { 12508 params.pid = 0; 12509 } 12510 return params; 12511 }, 12512 _updateHash = function() { 12513 12514 if(_hashAnimCheckTimeout) { 12515 clearTimeout(_hashAnimCheckTimeout); 12516 } 12517 12518 12519 if(_numAnimations || _isDragging) { 12520 // changing browser URL forces layout/paint in some browsers, which causes noticable lag during animation 12521 // that's why we update hash only when no animations running 12522 _hashAnimCheckTimeout = setTimeout(_updateHash, 500); 12523 return; 12524 } 12525 12526 if(_hashChangedByScript) { 12527 clearTimeout(_hashChangeTimeout); 12528 } else { 12529 _hashChangedByScript = true; 12530 } 12531 12532 12533 var pid = (_currentItemIndex + 1); 12534 var item = _getItemAt( _currentItemIndex ); 12535 if(item.hasOwnProperty('pid')) { 12536 // carry forward any custom pid assigned to the item 12537 pid = item.pid; 12538 } 12539 var newHash = _initialHash + '&' + 'gid=' + _options.galleryUID + '&' + 'pid=' + pid; 12540 12541 if(!_historyChanged) { 12542 if(_windowLoc.hash.indexOf(newHash) === -1) { 12543 _urlChangedOnce = true; 12544 } 12545 // first time - add new hisory record, then just replace 12546 } 12547 12548 var newURL = _windowLoc.href.split('#')[0] + '#' + newHash; 12549 12550 if( _supportsPushState ) { 12551 12552 if('#' + newHash !== window.location.hash) { 12553 history[_historyChanged ? 'replaceState' : 'pushState']('', document.title, newURL); 12554 } 12555 12556 } else { 12557 if(_historyChanged) { 12558 _windowLoc.replace( newURL ); 12559 } else { 12560 _windowLoc.hash = newHash; 12561 } 12562 } 12563 12564 12565 12566 _historyChanged = true; 12567 _hashChangeTimeout = setTimeout(function() { 12568 _hashChangedByScript = false; 12569 }, 60); 12570 }; 12571 12572 12573 12574 12575 12576_registerModule('History', { 12577 12578 12579 12580 publicMethods: { 12581 initHistory: function() { 12582 12583 framework.extend(_options, _historyDefaultOptions, true); 12584 12585 if( !_options.history ) { 12586 return; 12587 } 12588 12589 12590 _windowLoc = window.location; 12591 _urlChangedOnce = false; 12592 _closedFromURL = false; 12593 _historyChanged = false; 12594 _initialHash = _getHash(); 12595 _supportsPushState = ('pushState' in history); 12596 12597 12598 if(_initialHash.indexOf('gid=') > -1) { 12599 _initialHash = _initialHash.split('&gid=')[0]; 12600 _initialHash = _initialHash.split('?gid=')[0]; 12601 } 12602 12603 12604 _listen('afterChange', self.updateURL); 12605 _listen('unbindEvents', function() { 12606 framework.unbind(window, 'hashchange', self.onHashChange); 12607 }); 12608 12609 12610 var returnToOriginal = function() { 12611 _hashReseted = true; 12612 if(!_closedFromURL) { 12613 12614 if(_urlChangedOnce) { 12615 history.back(); 12616 } else { 12617 12618 if(_initialHash) { 12619 _windowLoc.hash = _initialHash; 12620 } else { 12621 if (_supportsPushState) { 12622 12623 // remove hash from url without refreshing it or scrolling to top 12624 history.pushState('', document.title, _windowLoc.pathname + _windowLoc.search ); 12625 } else { 12626 _windowLoc.hash = ''; 12627 } 12628 } 12629 } 12630 12631 } 12632 12633 _cleanHistoryTimeouts(); 12634 }; 12635 12636 12637 _listen('unbindEvents', function() { 12638 if(_closedByScroll) { 12639 // if PhotoSwipe is closed by scroll, we go "back" before the closing animation starts 12640 // this is done to keep the scroll position 12641 returnToOriginal(); 12642 } 12643 }); 12644 _listen('destroy', function() { 12645 if(!_hashReseted) { 12646 returnToOriginal(); 12647 } 12648 }); 12649 _listen('firstUpdate', function() { 12650 _currentItemIndex = _parseItemIndexFromURL().pid; 12651 }); 12652 12653 12654 12655 12656 var index = _initialHash.indexOf('pid='); 12657 if(index > -1) { 12658 _initialHash = _initialHash.substring(0, index); 12659 if(_initialHash.slice(-1) === '&') { 12660 _initialHash = _initialHash.slice(0, -1); 12661 } 12662 } 12663 12664 12665 setTimeout(function() { 12666 if(_isOpen) { // hasn't destroyed yet 12667 framework.bind(window, 'hashchange', self.onHashChange); 12668 } 12669 }, 40); 12670 12671 }, 12672 onHashChange: function() { 12673 12674 if(_getHash() === _initialHash) { 12675 12676 _closedFromURL = true; 12677 self.close(); 12678 return; 12679 } 12680 if(!_hashChangedByScript) { 12681 12682 _hashChangedByHistory = true; 12683 self.goTo( _parseItemIndexFromURL().pid ); 12684 _hashChangedByHistory = false; 12685 } 12686 12687 }, 12688 updateURL: function() { 12689 12690 // Delay the update of URL, to avoid lag during transition, 12691 // and to not to trigger actions like "refresh page sound" or "blinking favicon" to often 12692 12693 _cleanHistoryTimeouts(); 12694 12695 12696 if(_hashChangedByHistory) { 12697 return; 12698 } 12699 12700 if(!_historyChanged) { 12701 _updateHash(); // first time 12702 } else { 12703 _historyUpdateTimeout = setTimeout(_updateHash, 800); 12704 } 12705 } 12706 12707 } 12708}); 12709 12710 12711/*>>history*/ 12712 framework.extend(self, publicMethods); }; 12713 return PhotoSwipe; 12714}); 12715},{}],2:[function(require,module,exports){ 12716'use strict'; 12717 12718Object.defineProperty(exports, "__esModule", { 12719 value: true 12720}); 12721exports.PhotoSwipe = exports.default = undefined; 12722 12723var _photoswipe = require('photoswipe'); 12724 12725var _photoswipe2 = _interopRequireDefault(_photoswipe); 12726 12727var _photoswipeUiDefault = require('./libs/photoswipe-ui-default'); 12728 12729var _photoswipeUiDefault2 = _interopRequireDefault(_photoswipeUiDefault); 12730 12731function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 12732 12733function PhotoSwipeMounter($) { 12734 var $defaultGallery = $('<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true"><div class="pswp__bg"></div><div class="pswp__scroll-wrap"><div class="pswp__container"><div class="pswp__item"></div><div class="pswp__item"></div><div class="pswp__item"></div></div><div class="pswp__ui pswp__ui--hidden"><div class="pswp__top-bar"><div class="pswp__counter"></div><button class="pswp__button pswp__button--close" title="Close (Esc)"></button> <button class="pswp__button pswp__button--share" title="Share"></button> <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button> <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button><div class="pswp__preloader"><div class="pswp__preloader__icn"><div class="pswp__preloader__cut"><div class="pswp__preloader__donut"></div></div></div></div></div><div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap"><div class="pswp__share-tooltip"></div></div><button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)"></button> <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)"></button><div class="pswp__caption"><div class="pswp__caption__center"></div></div></div></div></div>').appendTo('body'), 12735 uid = 1; 12736 12737 function getImgs($gallery) { 12738 var slideSelector = getOptions($gallery).slideSelector; 12739 12740 return $gallery.find(slideSelector).map(function (index) { 12741 var $img = $(this).data('index', index), 12742 tagName = this.tagName.toUpperCase(); 12743 12744 if (tagName === 'A') { 12745 if (this.hash) { 12746 $img = $(this.hash); 12747 } else { 12748 $img = $img.find('img').eq(0); 12749 $img.data('original-src', this.href); 12750 } 12751 } else if (tagName !== 'IMG') { 12752 $img = $img.find('img'); 12753 } 12754 12755 return $img[0]; 12756 }); 12757 } 12758 12759 function getThumbBoundsFn($imgs) { 12760 return function _getThumbBoundsFn(index) { 12761 var $img = $imgs.eq(index), 12762 imgOffset = $img.offset(), 12763 imgWidth = $img[0].width; 12764 12765 return { x: imgOffset.left, y: imgOffset.top, w: imgWidth }; 12766 }; 12767 } 12768 12769 function getWH(wh, $img) { 12770 var d = $.Deferred(), 12771 wh_value = $img.data('original-src-' + wh), 12772 original_src = decodeURI($img.data('original-src') || $img.attr('src')), 12773 matches = original_src.match(/(\d+)[*×x](\d+)/); 12774 12775 if (wh_value) { 12776 d.resolve(wh_value); 12777 } else if (matches !== null) { 12778 d.resolve(matches[wh === 'width' ? 1 : 2]); 12779 } else { 12780 $('<img>').on('load', function () { 12781 d.resolve(this[wh]); 12782 }).attr('src', $img.attr('src')); 12783 } 12784 12785 return d.promise(); 12786 } 12787 12788 function getHeight($img) { 12789 return getWH('height', $img); 12790 } 12791 12792 function getWidth($img) { 12793 return getWH('width', $img); 12794 } 12795 12796 function getImgSize($img) { 12797 return $.when(getWidth($img), getHeight($img)); 12798 } 12799 12800 function getImgInfo() { 12801 var $img = $(this), 12802 original_src = $img.data('original-src') || $img.attr('src'), 12803 d = $.Deferred(); 12804 12805 if (this.tagName !== 'IMG') { 12806 d.resolve({ 12807 html: this.innerHTML 12808 }); 12809 } else { 12810 getImgSize($img).done(function (w, h) { 12811 var src = $img.attr('src'), 12812 title, 12813 caption_classname, 12814 $figcaption; 12815 12816 function get_caption($elem, selector) { 12817 var $parent = $elem.parent(), 12818 $caption_element; 12819 12820 if (!$parent.length) { 12821 return undefined; 12822 } 12823 12824 $caption_element = $parent.find(selector); 12825 if ($caption_element.length) { 12826 return $caption_element.html(); 12827 } 12828 12829 return get_caption($parent, selector); 12830 } 12831 12832 // try to find the slide title from : 12833 // (in order) 12834 // 12835 // 1. `data-caption-class` (a class-name that indicates the element containing the caption) 12836 // 2. `figcaption` element (the `figcaption` that resides inside a `figure` which contains the slide `img` element) 12837 // 3. `alt` attribute (the `alt` attribute of the slide `img` element) 12838 12839 if (caption_classname = $img.data('caption-class')) { 12840 title = get_caption($img, '.' + caption_classname); 12841 } else if (($figcaption = $img.closest('figure').find('figcaption')) && $figcaption.length) { 12842 title = $figcaption.html(); 12843 } else { 12844 title = $img.attr('alt'); 12845 } 12846 12847 d.resolve({ 12848 w: w, 12849 h: h, 12850 src: original_src, 12851 msrc: src, 12852 title: title 12853 }); 12854 }); 12855 } 12856 12857 return d.promise(); 12858 } 12859 12860 function getImgInfoArray($imgs) { 12861 var imgInfoArray = $imgs.map(getImgInfo).get(), 12862 d = $.Deferred(); 12863 12864 $.when.apply($, imgInfoArray).done(function () { 12865 var imgInfoArray = Array.prototype.slice.call(arguments); 12866 d.resolve(imgInfoArray); 12867 }); 12868 12869 return d.promise(); 12870 } 12871 12872 function getOptions($gallery) { 12873 return $gallery.data('photoswipeOptions'); 12874 } 12875 12876 function addUID($gallery) { 12877 if (!$gallery.data('pswp-uid')) { 12878 $gallery.data('pswp-uid', uid++); 12879 } 12880 } 12881 12882 function openPhotoSwipe(index, $gallery, $imgs, imgInfoArray) { 12883 var options = $.extend(getOptions($gallery).globalOptions, { index: index, getThumbBoundsFn: getThumbBoundsFn($imgs), galleryUID: $gallery.data('pswp-uid') }), 12884 photoSwipe = new _photoswipe2.default($defaultGallery[0], _photoswipeUiDefault2.default, imgInfoArray, options); 12885 12886 $.each(getOptions($gallery).events, function (eventName, eventHandler) { 12887 photoSwipe.listen(eventName, eventHandler); 12888 }); 12889 12890 photoSwipe.init(); 12891 } 12892 12893 // parse picture index and gallery index from URL (#&pid=1&gid=2) 12894 function photoswipeParseHash() { 12895 var hash = window.location.hash.substring(1), 12896 params = {}; 12897 12898 if (hash.length < 5) { 12899 return params; 12900 } 12901 12902 var vars = hash.split('&'); 12903 for (var i = 0; i < vars.length; i++) { 12904 if (!vars[i]) { 12905 continue; 12906 } 12907 var pair = vars[i].split('='); 12908 if (pair.length < 2) { 12909 continue; 12910 } 12911 params[pair[0]] = parseInt(pair[1], 10); 12912 } 12913 12914 return params; 12915 } 12916 12917 function openFromURL($galleries) { 12918 // Parse URL and open gallery if it contains #&pid=3&gid=1 12919 var hashData = photoswipeParseHash(); 12920 if (hashData.pid && hashData.gid) { 12921 (function () { 12922 var $gallery = $galleries[hashData.gid - 1], 12923 pid = hashData.pid - 1, 12924 $imgs = getImgs($gallery), 12925 imgInfoArrayPromise = getImgInfoArray($imgs); 12926 12927 imgInfoArrayPromise.done(function (imgInfoArray) { 12928 openPhotoSwipe(pid, $gallery, $imgs, imgInfoArray); 12929 }); 12930 })(); 12931 } 12932 } 12933 12934 function addClickHandler($gallery, $imgs, imgInfoArray) { 12935 $gallery.on('click.photoswipe', getOptions($gallery).slideSelector, function (e) { 12936 e.preventDefault(); 12937 openPhotoSwipe($(this).data('index'), $gallery, $imgs, imgInfoArray); 12938 }); 12939 } 12940 12941 function removeClickHandler($gallery) { 12942 $gallery.off('click.photoswipe'); 12943 } 12944 12945 function update($gallery) { 12946 var $imgs = getImgs($gallery), 12947 imgInfoArrayPromise = getImgInfoArray($imgs); 12948 12949 imgInfoArrayPromise.done(function (imgInfoArray) { 12950 removeClickHandler($gallery); 12951 addClickHandler($gallery, $imgs, imgInfoArray); 12952 }); 12953 } 12954 12955 $.fn.photoSwipe = function () { 12956 var slideSelector = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'img'; 12957 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 12958 var events = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; 12959 12960 var defaultOptions = { 12961 bgOpacity: 0.973, 12962 showHideOpacity: true 12963 }, 12964 globalOptions = $.extend(defaultOptions, options); 12965 12966 // Initialize each gallery 12967 var $galleries = [], 12968 isUpdate = slideSelector === 'update'; 12969 12970 this.each(function () { 12971 if (isUpdate) { 12972 update($(this)); 12973 return; 12974 } 12975 12976 var $gallery = $(this).data('photoswipeOptions', { slideSelector: slideSelector, globalOptions: globalOptions, events: events }), 12977 // save options 12978 $imgs = getImgs($gallery), 12979 imgInfoArrayPromise = getImgInfoArray($imgs); 12980 12981 addUID($gallery); 12982 $galleries.push($gallery); 12983 12984 imgInfoArrayPromise.done(function (imgInfoArray) { 12985 addClickHandler($gallery, $imgs, imgInfoArray); 12986 }); 12987 }); 12988 12989 if (!isUpdate) { 12990 openFromURL($galleries); 12991 } 12992 12993 return this; 12994 }; 12995 12996 // Attach original PhotoSwipe to $.fn.photoSwipe 12997 $.fn.photoSwipe.PhotoSwipe = _photoswipe2.default; 12998} 12999 13000 13001 PhotoSwipeMounter(jQuery); 13002 13003 13004exports.default = PhotoSwipeMounter; 13005exports.PhotoSwipe = _photoswipe2.default; 13006 13007},{"./libs/photoswipe-ui-default":3,"photoswipe":1}],3:[function(require,module,exports){ 13008'use strict'; 13009 13010var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; 13011 13012/*! PhotoSwipe Default UI - 4.1.1 - 2015-12-24 13013* http://photoswipe.com 13014* Copyright (c) 2015 Dmitry Semenov; */ 13015/** 13016* 13017* UI on top of main sliding area (caption, arrows, close button, etc.). 13018* Built just using public methods/properties of PhotoSwipe. 13019* 13020*/ 13021(function (root, factory) { 13022 if (true) { 13023 !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory), 13024 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? 13025 (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : 13026 __WEBPACK_AMD_DEFINE_FACTORY__), 13027 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 13028 } else {} 13029})(undefined, function () { 13030 13031 'use strict'; 13032 13033 var PhotoSwipeUI_Default = function PhotoSwipeUI_Default(pswp, framework) { 13034 13035 var ui = this; 13036 var _overlayUIUpdated = false, 13037 _controlsVisible = true, 13038 _fullscrenAPI, 13039 _controls, 13040 _captionContainer, 13041 _fakeCaptionContainer, 13042 _indexIndicator, 13043 _shareButton, 13044 _shareModal, 13045 _shareModalHidden = true, 13046 _initalCloseOnScrollValue, 13047 _isIdle, 13048 _listen, 13049 _loadingIndicator, 13050 _loadingIndicatorHidden, 13051 _loadingIndicatorTimeout, 13052 _galleryHasOneSlide, 13053 _options, 13054 _defaultUIOptions = { 13055 barsSize: { top: 44, bottom: 'auto' }, 13056 closeElClasses: ['item', 'caption', 'zoom-wrap', 'ui', 'top-bar'], 13057 timeToIdle: 4000, 13058 timeToIdleOutside: 1000, 13059 loadingIndicatorDelay: 1000, // 2s 13060 13061 addCaptionHTMLFn: function addCaptionHTMLFn(item, captionEl /*, isFake */) { 13062 if (!item.title) { 13063 captionEl.children[0].innerHTML = ''; 13064 return false; 13065 } 13066 captionEl.children[0].innerHTML = item.title; 13067 return true; 13068 }, 13069 13070 closeEl: true, 13071 captionEl: true, 13072 fullscreenEl: true, 13073 zoomEl: true, 13074 shareEl: true, 13075 counterEl: true, 13076 arrowEl: true, 13077 preloaderEl: true, 13078 13079 tapToClose: false, 13080 tapToToggleControls: true, 13081 13082 clickToCloseNonZoomable: true, 13083 13084 shareButtons: [{ id: 'facebook', label: 'Share on Facebook', url: 'https://www.facebook.com/sharer/sharer.php?u={{url}}' }, { id: 'twitter', label: 'Tweet', url: 'https://twitter.com/intent/tweet?text={{text}}&url={{url}}' }, { id: 'pinterest', label: 'Pin it', url: 'http://www.pinterest.com/pin/create/button/' + '?url={{url}}&media={{image_url}}&description={{text}}' }, { id: 'download', label: 'Download image', url: '{{raw_image_url}}', download: true }], 13085 getImageURLForShare: function getImageURLForShare() /* shareButtonData */{ 13086 return pswp.currItem.src || ''; 13087 }, 13088 getPageURLForShare: function getPageURLForShare() /* shareButtonData */{ 13089 return window.location.href; 13090 }, 13091 getTextForShare: function getTextForShare() /* shareButtonData */{ 13092 return pswp.currItem.title || ''; 13093 }, 13094 13095 indexIndicatorSep: ' / ', 13096 fitControlsWidth: 1200 13097 13098 }, 13099 _blockControlsTap, 13100 _blockControlsTapTimeout; 13101 13102 var _onControlsTap = function _onControlsTap(e) { 13103 if (_blockControlsTap) { 13104 return true; 13105 } 13106 13107 e = e || window.event; 13108 13109 if (_options.timeToIdle && _options.mouseUsed && !_isIdle) { 13110 // reset idle timer 13111 _onIdleMouseMove(); 13112 } 13113 13114 var target = e.target || e.srcElement, 13115 uiElement, 13116 clickedClass = target.getAttribute('class') || '', 13117 found; 13118 13119 for (var i = 0; i < _uiElements.length; i++) { 13120 uiElement = _uiElements[i]; 13121 if (uiElement.onTap && clickedClass.indexOf('pswp__' + uiElement.name) > -1) { 13122 uiElement.onTap(); 13123 found = true; 13124 } 13125 } 13126 13127 if (found) { 13128 if (e.stopPropagation) { 13129 e.stopPropagation(); 13130 } 13131 _blockControlsTap = true; 13132 13133 // Some versions of Android don't prevent ghost click event 13134 // when preventDefault() was called on touchstart and/or touchend. 13135 // 13136 // This happens on v4.3, 4.2, 4.1, 13137 // older versions strangely work correctly, 13138 // but just in case we add delay on all of them) 13139 var tapDelay = framework.features.isOldAndroid ? 600 : 30; 13140 _blockControlsTapTimeout = setTimeout(function () { 13141 _blockControlsTap = false; 13142 }, tapDelay); 13143 } 13144 }, 13145 _fitControlsInViewport = function _fitControlsInViewport() { 13146 return !pswp.likelyTouchDevice || _options.mouseUsed || screen.width > _options.fitControlsWidth; 13147 }, 13148 _togglePswpClass = function _togglePswpClass(el, cName, add) { 13149 framework[(add ? 'add' : 'remove') + 'Class'](el, 'pswp__' + cName); 13150 }, 13151 13152 13153 // add class when there is just one item in the gallery 13154 // (by default it hides left/right arrows and 1ofX counter) 13155 _countNumItems = function _countNumItems() { 13156 var hasOneSlide = _options.getNumItemsFn() === 1; 13157 13158 if (hasOneSlide !== _galleryHasOneSlide) { 13159 _togglePswpClass(_controls, 'ui--one-slide', hasOneSlide); 13160 _galleryHasOneSlide = hasOneSlide; 13161 } 13162 }, 13163 _toggleShareModalClass = function _toggleShareModalClass() { 13164 _togglePswpClass(_shareModal, 'share-modal--hidden', _shareModalHidden); 13165 }, 13166 _toggleShareModal = function _toggleShareModal() { 13167 13168 _shareModalHidden = !_shareModalHidden; 13169 13170 if (!_shareModalHidden) { 13171 _toggleShareModalClass(); 13172 setTimeout(function () { 13173 if (!_shareModalHidden) { 13174 framework.addClass(_shareModal, 'pswp__share-modal--fade-in'); 13175 } 13176 }, 30); 13177 } else { 13178 framework.removeClass(_shareModal, 'pswp__share-modal--fade-in'); 13179 setTimeout(function () { 13180 if (_shareModalHidden) { 13181 _toggleShareModalClass(); 13182 } 13183 }, 300); 13184 } 13185 13186 if (!_shareModalHidden) { 13187 _updateShareURLs(); 13188 } 13189 return false; 13190 }, 13191 _openWindowPopup = function _openWindowPopup(e) { 13192 e = e || window.event; 13193 var target = e.target || e.srcElement; 13194 13195 pswp.shout('shareLinkClick', e, target); 13196 13197 if (!target.href) { 13198 return false; 13199 } 13200 13201 if (target.hasAttribute('download')) { 13202 return true; 13203 } 13204 13205 window.open(target.href, 'pswp_share', 'scrollbars=yes,resizable=yes,toolbar=no,' + 'location=yes,width=550,height=420,top=100,left=' + (window.screen ? Math.round(screen.width / 2 - 275) : 100)); 13206 13207 if (!_shareModalHidden) { 13208 _toggleShareModal(); 13209 } 13210 13211 return false; 13212 }, 13213 _updateShareURLs = function _updateShareURLs() { 13214 var shareButtonOut = '', 13215 shareButtonData, 13216 shareURL, 13217 image_url, 13218 page_url, 13219 share_text; 13220 13221 for (var i = 0; i < _options.shareButtons.length; i++) { 13222 shareButtonData = _options.shareButtons[i]; 13223 13224 image_url = _options.getImageURLForShare(shareButtonData); 13225 page_url = _options.getPageURLForShare(shareButtonData); 13226 share_text = _options.getTextForShare(shareButtonData); 13227 13228 shareURL = shareButtonData.url.replace('{{url}}', encodeURIComponent(page_url)).replace('{{image_url}}', encodeURIComponent(image_url)).replace('{{raw_image_url}}', image_url).replace('{{text}}', encodeURIComponent(share_text)); 13229 13230 shareButtonOut += '<a href="' + shareURL + '" target="_blank" ' + 'class="pswp__share--' + shareButtonData.id + '"' + (shareButtonData.download ? 'download' : '') + '>' + shareButtonData.label + '</a>'; 13231 13232 if (_options.parseShareButtonOut) { 13233 shareButtonOut = _options.parseShareButtonOut(shareButtonData, shareButtonOut); 13234 } 13235 } 13236 _shareModal.children[0].innerHTML = shareButtonOut; 13237 _shareModal.children[0].onclick = _openWindowPopup; 13238 }, 13239 _hasCloseClass = function _hasCloseClass(target) { 13240 for (var i = 0; i < _options.closeElClasses.length; i++) { 13241 if (framework.hasClass(target, 'pswp__' + _options.closeElClasses[i])) { 13242 return true; 13243 } 13244 } 13245 }, 13246 _idleInterval, 13247 _idleTimer, 13248 _idleIncrement = 0, 13249 _onIdleMouseMove = function _onIdleMouseMove() { 13250 clearTimeout(_idleTimer); 13251 _idleIncrement = 0; 13252 if (_isIdle) { 13253 ui.setIdle(false); 13254 } 13255 }, 13256 _onMouseLeaveWindow = function _onMouseLeaveWindow(e) { 13257 e = e ? e : window.event; 13258 var from = e.relatedTarget || e.toElement; 13259 if (!from || from.nodeName === 'HTML') { 13260 clearTimeout(_idleTimer); 13261 _idleTimer = setTimeout(function () { 13262 ui.setIdle(true); 13263 }, _options.timeToIdleOutside); 13264 } 13265 }, 13266 _setupFullscreenAPI = function _setupFullscreenAPI() { 13267 if (_options.fullscreenEl && !framework.features.isOldAndroid) { 13268 if (!_fullscrenAPI) { 13269 _fullscrenAPI = ui.getFullscreenAPI(); 13270 } 13271 if (_fullscrenAPI) { 13272 framework.bind(document, _fullscrenAPI.eventK, ui.updateFullscreen); 13273 ui.updateFullscreen(); 13274 framework.addClass(pswp.template, 'pswp--supports-fs'); 13275 } else { 13276 framework.removeClass(pswp.template, 'pswp--supports-fs'); 13277 } 13278 } 13279 }, 13280 _setupLoadingIndicator = function _setupLoadingIndicator() { 13281 // Setup loading indicator 13282 if (_options.preloaderEl) { 13283 13284 _toggleLoadingIndicator(true); 13285 13286 _listen('beforeChange', function () { 13287 13288 clearTimeout(_loadingIndicatorTimeout); 13289 13290 // display loading indicator with delay 13291 _loadingIndicatorTimeout = setTimeout(function () { 13292 13293 if (pswp.currItem && pswp.currItem.loading) { 13294 13295 if (!pswp.allowProgressiveImg() || pswp.currItem.img && !pswp.currItem.img.naturalWidth) { 13296 // show preloader if progressive loading is not enabled, 13297 // or image width is not defined yet (because of slow connection) 13298 _toggleLoadingIndicator(false); 13299 // items-controller.js function allowProgressiveImg 13300 } 13301 } else { 13302 _toggleLoadingIndicator(true); // hide preloader 13303 } 13304 }, _options.loadingIndicatorDelay); 13305 }); 13306 _listen('imageLoadComplete', function (index, item) { 13307 if (pswp.currItem === item) { 13308 _toggleLoadingIndicator(true); 13309 } 13310 }); 13311 } 13312 }, 13313 _toggleLoadingIndicator = function _toggleLoadingIndicator(hide) { 13314 if (_loadingIndicatorHidden !== hide) { 13315 _togglePswpClass(_loadingIndicator, 'preloader--active', !hide); 13316 _loadingIndicatorHidden = hide; 13317 } 13318 }, 13319 _applyNavBarGaps = function _applyNavBarGaps(item) { 13320 var gap = item.vGap; 13321 13322 if (_fitControlsInViewport()) { 13323 13324 var bars = _options.barsSize; 13325 if (_options.captionEl && bars.bottom === 'auto') { 13326 if (!_fakeCaptionContainer) { 13327 _fakeCaptionContainer = framework.createEl('pswp__caption pswp__caption--fake'); 13328 _fakeCaptionContainer.appendChild(framework.createEl('pswp__caption__center')); 13329 _controls.insertBefore(_fakeCaptionContainer, _captionContainer); 13330 framework.addClass(_controls, 'pswp__ui--fit'); 13331 } 13332 if (_options.addCaptionHTMLFn(item, _fakeCaptionContainer, true)) { 13333 13334 var captionSize = _fakeCaptionContainer.clientHeight; 13335 gap.bottom = parseInt(captionSize, 10) || 44; 13336 } else { 13337 gap.bottom = bars.top; // if no caption, set size of bottom gap to size of top 13338 } 13339 } else { 13340 gap.bottom = bars.bottom === 'auto' ? 0 : bars.bottom; 13341 } 13342 13343 // height of top bar is static, no need to calculate it 13344 gap.top = bars.top; 13345 } else { 13346 gap.top = gap.bottom = 0; 13347 } 13348 }, 13349 _setupIdle = function _setupIdle() { 13350 // Hide controls when mouse is used 13351 if (_options.timeToIdle) { 13352 _listen('mouseUsed', function () { 13353 13354 framework.bind(document, 'mousemove', _onIdleMouseMove); 13355 framework.bind(document, 'mouseout', _onMouseLeaveWindow); 13356 13357 _idleInterval = setInterval(function () { 13358 _idleIncrement++; 13359 if (_idleIncrement === 2) { 13360 ui.setIdle(true); 13361 } 13362 }, _options.timeToIdle / 2); 13363 }); 13364 } 13365 }, 13366 _setupHidingControlsDuringGestures = function _setupHidingControlsDuringGestures() { 13367 13368 // Hide controls on vertical drag 13369 _listen('onVerticalDrag', function (now) { 13370 if (_controlsVisible && now < 0.95) { 13371 ui.hideControls(); 13372 } else if (!_controlsVisible && now >= 0.95) { 13373 ui.showControls(); 13374 } 13375 }); 13376 13377 // Hide controls when pinching to close 13378 var pinchControlsHidden; 13379 _listen('onPinchClose', function (now) { 13380 if (_controlsVisible && now < 0.9) { 13381 ui.hideControls(); 13382 pinchControlsHidden = true; 13383 } else if (pinchControlsHidden && !_controlsVisible && now > 0.9) { 13384 ui.showControls(); 13385 } 13386 }); 13387 13388 _listen('zoomGestureEnded', function () { 13389 pinchControlsHidden = false; 13390 if (pinchControlsHidden && !_controlsVisible) { 13391 ui.showControls(); 13392 } 13393 }); 13394 }; 13395 13396 var _uiElements = [{ 13397 name: 'caption', 13398 option: 'captionEl', 13399 onInit: function onInit(el) { 13400 _captionContainer = el; 13401 } 13402 }, { 13403 name: 'share-modal', 13404 option: 'shareEl', 13405 onInit: function onInit(el) { 13406 _shareModal = el; 13407 }, 13408 onTap: function onTap() { 13409 _toggleShareModal(); 13410 } 13411 }, { 13412 name: 'button--share', 13413 option: 'shareEl', 13414 onInit: function onInit(el) { 13415 _shareButton = el; 13416 }, 13417 onTap: function onTap() { 13418 _toggleShareModal(); 13419 } 13420 }, { 13421 name: 'button--zoom', 13422 option: 'zoomEl', 13423 onTap: pswp.toggleDesktopZoom 13424 }, { 13425 name: 'counter', 13426 option: 'counterEl', 13427 onInit: function onInit(el) { 13428 _indexIndicator = el; 13429 } 13430 }, { 13431 name: 'button--close', 13432 option: 'closeEl', 13433 onTap: pswp.close 13434 }, { 13435 name: 'button--arrow--left', 13436 option: 'arrowEl', 13437 onTap: pswp.prev 13438 }, { 13439 name: 'button--arrow--right', 13440 option: 'arrowEl', 13441 onTap: pswp.next 13442 }, { 13443 name: 'button--fs', 13444 option: 'fullscreenEl', 13445 onTap: function onTap() { 13446 if (_fullscrenAPI.isFullscreen()) { 13447 _fullscrenAPI.exit(); 13448 } else { 13449 _fullscrenAPI.enter(); 13450 } 13451 } 13452 }, { 13453 name: 'preloader', 13454 option: 'preloaderEl', 13455 onInit: function onInit(el) { 13456 _loadingIndicator = el; 13457 } 13458 }]; 13459 13460 var _setupUIElements = function _setupUIElements() { 13461 var item, classAttr, uiElement; 13462 13463 var loopThroughChildElements = function loopThroughChildElements(sChildren) { 13464 if (!sChildren) { 13465 return; 13466 } 13467 13468 var l = sChildren.length; 13469 for (var i = 0; i < l; i++) { 13470 item = sChildren[i]; 13471 classAttr = item.className; 13472 13473 for (var a = 0; a < _uiElements.length; a++) { 13474 uiElement = _uiElements[a]; 13475 13476 if (classAttr.indexOf('pswp__' + uiElement.name) > -1) { 13477 13478 if (_options[uiElement.option]) { 13479 // if element is not disabled from options 13480 13481 framework.removeClass(item, 'pswp__element--disabled'); 13482 if (uiElement.onInit) { 13483 uiElement.onInit(item); 13484 } 13485 13486 //item.style.display = 'block'; 13487 } else { 13488 framework.addClass(item, 'pswp__element--disabled'); 13489 //item.style.display = 'none'; 13490 } 13491 } 13492 } 13493 } 13494 }; 13495 loopThroughChildElements(_controls.children); 13496 13497 var topBar = framework.getChildByClass(_controls, 'pswp__top-bar'); 13498 if (topBar) { 13499 loopThroughChildElements(topBar.children); 13500 } 13501 }; 13502 13503 ui.init = function () { 13504 13505 // extend options 13506 framework.extend(pswp.options, _defaultUIOptions, true); 13507 13508 // create local link for fast access 13509 _options = pswp.options; 13510 13511 // find pswp__ui element 13512 _controls = framework.getChildByClass(pswp.scrollWrap, 'pswp__ui'); 13513 13514 // create local link 13515 _listen = pswp.listen; 13516 13517 _setupHidingControlsDuringGestures(); 13518 13519 // update controls when slides change 13520 _listen('beforeChange', ui.update); 13521 13522 // toggle zoom on double-tap 13523 _listen('doubleTap', function (point) { 13524 var initialZoomLevel = pswp.currItem.initialZoomLevel; 13525 if (pswp.getZoomLevel() !== initialZoomLevel) { 13526 pswp.zoomTo(initialZoomLevel, point, 333); 13527 } else { 13528 pswp.zoomTo(_options.getDoubleTapZoom(false, pswp.currItem), point, 333); 13529 } 13530 }); 13531 13532 // Allow text selection in caption 13533 _listen('preventDragEvent', function (e, isDown, preventObj) { 13534 var t = e.target || e.srcElement; 13535 if (t && t.getAttribute('class') && e.type.indexOf('mouse') > -1 && (t.getAttribute('class').indexOf('__caption') > 0 || /(SMALL|STRONG|EM)/i.test(t.tagName))) { 13536 preventObj.prevent = false; 13537 } 13538 }); 13539 13540 // bind events for UI 13541 _listen('bindEvents', function () { 13542 framework.bind(_controls, 'pswpTap click', _onControlsTap); 13543 framework.bind(pswp.scrollWrap, 'pswpTap', ui.onGlobalTap); 13544 13545 if (!pswp.likelyTouchDevice) { 13546 framework.bind(pswp.scrollWrap, 'mouseover', ui.onMouseOver); 13547 } 13548 }); 13549 13550 // unbind events for UI 13551 _listen('unbindEvents', function () { 13552 if (!_shareModalHidden) { 13553 _toggleShareModal(); 13554 } 13555 13556 if (_idleInterval) { 13557 clearInterval(_idleInterval); 13558 } 13559 framework.unbind(document, 'mouseout', _onMouseLeaveWindow); 13560 framework.unbind(document, 'mousemove', _onIdleMouseMove); 13561 framework.unbind(_controls, 'pswpTap click', _onControlsTap); 13562 framework.unbind(pswp.scrollWrap, 'pswpTap', ui.onGlobalTap); 13563 framework.unbind(pswp.scrollWrap, 'mouseover', ui.onMouseOver); 13564 13565 if (_fullscrenAPI) { 13566 framework.unbind(document, _fullscrenAPI.eventK, ui.updateFullscreen); 13567 if (_fullscrenAPI.isFullscreen()) { 13568 _options.hideAnimationDuration = 0; 13569 _fullscrenAPI.exit(); 13570 } 13571 _fullscrenAPI = null; 13572 } 13573 }); 13574 13575 // clean up things when gallery is destroyed 13576 _listen('destroy', function () { 13577 if (_options.captionEl) { 13578 if (_fakeCaptionContainer) { 13579 _controls.removeChild(_fakeCaptionContainer); 13580 } 13581 framework.removeClass(_captionContainer, 'pswp__caption--empty'); 13582 } 13583 13584 if (_shareModal) { 13585 _shareModal.children[0].onclick = null; 13586 } 13587 framework.removeClass(_controls, 'pswp__ui--over-close'); 13588 framework.addClass(_controls, 'pswp__ui--hidden'); 13589 ui.setIdle(false); 13590 }); 13591 13592 if (!_options.showAnimationDuration) { 13593 framework.removeClass(_controls, 'pswp__ui--hidden'); 13594 } 13595 _listen('initialZoomIn', function () { 13596 if (_options.showAnimationDuration) { 13597 framework.removeClass(_controls, 'pswp__ui--hidden'); 13598 } 13599 }); 13600 _listen('initialZoomOut', function () { 13601 framework.addClass(_controls, 'pswp__ui--hidden'); 13602 }); 13603 13604 _listen('parseVerticalMargin', _applyNavBarGaps); 13605 13606 _setupUIElements(); 13607 13608 if (_options.shareEl && _shareButton && _shareModal) { 13609 _shareModalHidden = true; 13610 } 13611 13612 _countNumItems(); 13613 13614 _setupIdle(); 13615 13616 _setupFullscreenAPI(); 13617 13618 _setupLoadingIndicator(); 13619 }; 13620 13621 ui.setIdle = function (isIdle) { 13622 _isIdle = isIdle; 13623 _togglePswpClass(_controls, 'ui--idle', isIdle); 13624 }; 13625 13626 ui.update = function () { 13627 // Don't update UI if it's hidden 13628 if (_controlsVisible && pswp.currItem) { 13629 13630 ui.updateIndexIndicator(); 13631 13632 if (_options.captionEl) { 13633 _options.addCaptionHTMLFn(pswp.currItem, _captionContainer); 13634 13635 _togglePswpClass(_captionContainer, 'caption--empty', !pswp.currItem.title); 13636 } 13637 13638 _overlayUIUpdated = true; 13639 } else { 13640 _overlayUIUpdated = false; 13641 } 13642 13643 if (!_shareModalHidden) { 13644 _toggleShareModal(); 13645 } 13646 13647 _countNumItems(); 13648 }; 13649 13650 ui.updateFullscreen = function (e) { 13651 13652 if (e) { 13653 // some browsers change window scroll position during the fullscreen 13654 // so PhotoSwipe updates it just in case 13655 setTimeout(function () { 13656 pswp.setScrollOffset(0, framework.getScrollY()); 13657 }, 50); 13658 } 13659 13660 // toogle pswp--fs class on root element 13661 framework[(_fullscrenAPI.isFullscreen() ? 'add' : 'remove') + 'Class'](pswp.template, 'pswp--fs'); 13662 }; 13663 13664 ui.updateIndexIndicator = function () { 13665 if (_options.counterEl) { 13666 _indexIndicator.innerHTML = pswp.getCurrentIndex() + 1 + _options.indexIndicatorSep + _options.getNumItemsFn(); 13667 } 13668 }; 13669 13670 ui.onGlobalTap = function (e) { 13671 e = e || window.event; 13672 var target = e.target || e.srcElement; 13673 13674 if (_blockControlsTap) { 13675 return; 13676 } 13677 13678 if (e.detail && e.detail.pointerType === 'mouse') { 13679 13680 // close gallery if clicked outside of the image 13681 if (_hasCloseClass(target)) { 13682 pswp.close(); 13683 return; 13684 } 13685 13686 if (framework.hasClass(target, 'pswp__img')) { 13687 if (pswp.getZoomLevel() === 1 && pswp.getZoomLevel() <= pswp.currItem.fitRatio) { 13688 if (_options.clickToCloseNonZoomable) { 13689 pswp.close(); 13690 } 13691 } else { 13692 pswp.toggleDesktopZoom(e.detail.releasePoint); 13693 } 13694 } 13695 } else { 13696 13697 // tap anywhere (except buttons) to toggle visibility of controls 13698 if (_options.tapToToggleControls) { 13699 if (_controlsVisible) { 13700 ui.hideControls(); 13701 } else { 13702 ui.showControls(); 13703 } 13704 } 13705 13706 // tap to close gallery 13707 if (_options.tapToClose && (framework.hasClass(target, 'pswp__img') || _hasCloseClass(target))) { 13708 pswp.close(); 13709 return; 13710 } 13711 } 13712 }; 13713 ui.onMouseOver = function (e) { 13714 e = e || window.event; 13715 var target = e.target || e.srcElement; 13716 13717 // add class when mouse is over an element that should close the gallery 13718 _togglePswpClass(_controls, 'ui--over-close', _hasCloseClass(target)); 13719 }; 13720 13721 ui.hideControls = function () { 13722 framework.addClass(_controls, 'pswp__ui--hidden'); 13723 _controlsVisible = false; 13724 }; 13725 13726 ui.showControls = function () { 13727 _controlsVisible = true; 13728 if (!_overlayUIUpdated) { 13729 ui.update(); 13730 } 13731 framework.removeClass(_controls, 'pswp__ui--hidden'); 13732 }; 13733 13734 ui.supportsFullscreen = function () { 13735 var d = document; 13736 return !!(d.exitFullscreen || d.mozCancelFullScreen || d.webkitExitFullscreen || d.msExitFullscreen); 13737 }; 13738 13739 ui.getFullscreenAPI = function () { 13740 var dE = document.documentElement, 13741 api, 13742 tF = 'fullscreenchange'; 13743 13744 if (dE.requestFullscreen) { 13745 api = { 13746 enterK: 'requestFullscreen', 13747 exitK: 'exitFullscreen', 13748 elementK: 'fullscreenElement', 13749 eventK: tF 13750 }; 13751 } else if (dE.mozRequestFullScreen) { 13752 api = { 13753 enterK: 'mozRequestFullScreen', 13754 exitK: 'mozCancelFullScreen', 13755 elementK: 'mozFullScreenElement', 13756 eventK: 'moz' + tF 13757 }; 13758 } else if (dE.webkitRequestFullscreen) { 13759 api = { 13760 enterK: 'webkitRequestFullscreen', 13761 exitK: 'webkitExitFullscreen', 13762 elementK: 'webkitFullscreenElement', 13763 eventK: 'webkit' + tF 13764 }; 13765 } else if (dE.msRequestFullscreen) { 13766 api = { 13767 enterK: 'msRequestFullscreen', 13768 exitK: 'msExitFullscreen', 13769 elementK: 'msFullscreenElement', 13770 eventK: 'MSFullscreenChange' 13771 }; 13772 } 13773 13774 if (api) { 13775 api.enter = function () { 13776 // disable close-on-scroll in fullscreen 13777 _initalCloseOnScrollValue = _options.closeOnScroll; 13778 _options.closeOnScroll = false; 13779 13780 if (this.enterK === 'webkitRequestFullscreen') { 13781 pswp.template[this.enterK](Element.ALLOW_KEYBOARD_INPUT); 13782 } else { 13783 return pswp.template[this.enterK](); 13784 } 13785 }; 13786 api.exit = function () { 13787 _options.closeOnScroll = _initalCloseOnScrollValue; 13788 13789 return document[this.exitK](); 13790 }; 13791 api.isFullscreen = function () { 13792 return document[this.elementK]; 13793 }; 13794 } 13795 13796 return api; 13797 }; 13798 }; 13799 return PhotoSwipeUI_Default; 13800}); 13801 13802},{}]},{},[2]); 13803 13804 13805/***/ }), 13806
vendor: 289,021 bytes, lines 13807-24698
13807/***/ "./node_modules/jquery/dist/jquery.js": 13808/*!********************************************!*\ 13809 !*** ./node_modules/jquery/dist/jquery.js ***! 13810 \********************************************/ 13811/***/ (function(module, exports) { 13812 13813var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! 13814 * jQuery JavaScript Library v3.6.0 13815 * https://jquery.com/ 13816 * 13817 * Includes Sizzle.js 13818 * https://sizzlejs.com/ 13819 * 13820 * Copyright OpenJS Foundation and other contributors 13821 * Released under the MIT license 13822 * https://jquery.org/license 13823 * 13824 * Date: 2021-03-02T17:08Z 13825 */ 13826( function( global, factory ) { 13827 13828 "use strict"; 13829 13830 if ( true && typeof module.exports === "object" ) { 13831 13832 // For CommonJS and CommonJS-like environments where a proper `window` 13833 // is present, execute the factory and get jQuery. 13834 // For environments that do not have a `window` with a `document` 13835 // (such as Node.js), expose a factory as module.exports. 13836 // This accentuates the need for the creation of a real `window`. 13837 // e.g. var jQuery = require("jquery")(window); 13838 // See ticket #14549 for more info. 13839 module.exports = global.document ? 13840 factory( global, true ) : 13841 function( w ) { 13842 if ( !w.document ) { 13843 throw new Error( "jQuery requires a window with a document" ); 13844 } 13845 return factory( w ); 13846 }; 13847 } else { 13848 factory( global ); 13849 } 13850 13851// Pass this if window is not defined yet 13852} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { 13853 13854// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 13855// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode 13856// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common 13857// enough that all such attempts are guarded in a try block. 13858"use strict"; 13859 13860var arr = []; 13861 13862var getProto = Object.getPrototypeOf; 13863 13864var slice = arr.slice; 13865 13866var flat = arr.flat ? function( array ) { 13867 return arr.flat.call( array ); 13868} : function( array ) { 13869 return arr.concat.apply( [], array ); 13870}; 13871 13872 13873var push = arr.push; 13874 13875var indexOf = arr.indexOf; 13876 13877var class2type = {}; 13878 13879var toString = class2type.toString; 13880 13881var hasOwn = class2type.hasOwnProperty; 13882 13883var fnToString = hasOwn.toString; 13884 13885var ObjectFunctionString = fnToString.call( Object ); 13886 13887var support = {}; 13888 13889var isFunction = function isFunction( obj ) { 13890 13891 // Support: Chrome <=57, Firefox <=52 13892 // In some browsers, typeof returns "function" for HTML <object> elements 13893 // (i.e., `typeof document.createElement( "object" ) === "function"`). 13894 // We don't want to classify *any* DOM node as a function. 13895 // Support: QtWeb <=3.8.5, WebKit <=534.34, wkhtmltopdf tool <=0.12.5 13896 // Plus for old WebKit, typeof returns "function" for HTML collections 13897 // (e.g., `typeof document.getElementsByTagName("div") === "function"`). (gh-4756) 13898 return typeof obj === "function" && typeof obj.nodeType !== "number" && 13899 typeof obj.item !== "function"; 13900 }; 13901 13902 13903var isWindow = function isWindow( obj ) { 13904 return obj != null && obj === obj.window; 13905 }; 13906 13907 13908var document = window.document; 13909 13910 13911 13912 var preservedScriptAttributes = { 13913 type: true, 13914 src: true, 13915 nonce: true, 13916 noModule: true 13917 }; 13918 13919 function DOMEval( code, node, doc ) { 13920 doc = doc || document; 13921 13922 var i, val, 13923 script = doc.createElement( "script" ); 13924 13925 script.text = code; 13926 if ( node ) { 13927 for ( i in preservedScriptAttributes ) { 13928 13929 // Support: Firefox 64+, Edge 18+ 13930 // Some browsers don't support the "nonce" property on scripts. 13931 // On the other hand, just using `getAttribute` is not enough as 13932 // the `nonce` attribute is reset to an empty string whenever it 13933 // becomes browsing-context connected. 13934 // See https://github.com/whatwg/html/issues/2369 13935 // See https://html.spec.whatwg.org/#nonce-attributes 13936 // The `node.getAttribute` check was added for the sake of 13937 // `jQuery.globalEval` so that it can fake a nonce-containing node 13938 // via an object. 13939 val = node[ i ] || node.getAttribute && node.getAttribute( i ); 13940 if ( val ) { 13941 script.setAttribute( i, val ); 13942 } 13943 } 13944 } 13945 doc.head.appendChild( script ).parentNode.removeChild( script ); 13946 } 13947 13948 13949function toType( obj ) { 13950 if ( obj == null ) { 13951 return obj + ""; 13952 } 13953 13954 // Support: Android <=2.3 only (functionish RegExp) 13955 return typeof obj === "object" || typeof obj === "function" ? 13956 class2type[ toString.call( obj ) ] || "object" : 13957 typeof obj; 13958} 13959/* global Symbol */ 13960// Defining this global in .eslintrc.json would create a danger of using the global 13961// unguarded in another place, it seems safer to define global only for this module 13962 13963 13964 13965var 13966 version = "3.6.0", 13967 13968 // Define a local copy of jQuery 13969 jQuery = function( selector, context ) { 13970 13971 // The jQuery object is actually just the init constructor 'enhanced' 13972 // Need init if jQuery is called (just allow error to be thrown if not included) 13973 return new jQuery.fn.init( selector, context ); 13974 }; 13975 13976jQuery.fn = jQuery.prototype = { 13977 13978 // The current version of jQuery being used 13979 jquery: version, 13980 13981 constructor: jQuery, 13982 13983 // The default length of a jQuery object is 0 13984 length: 0, 13985 13986 toArray: function() { 13987 return slice.call( this ); 13988 }, 13989 13990 // Get the Nth element in the matched element set OR 13991 // Get the whole matched element set as a clean array 13992 get: function( num ) { 13993 13994 // Return all the elements in a clean array 13995 if ( num == null ) { 13996 return slice.call( this ); 13997 } 13998 13999 // Return just the one element from the set 14000 return num < 0 ? this[ num + this.length ] : this[ num ]; 14001 }, 14002 14003 // Take an array of elements and push it onto the stack 14004 // (returning the new matched element set) 14005 pushStack: function( elems ) { 14006 14007 // Build a new jQuery matched element set 14008 var ret = jQuery.merge( this.constructor(), elems ); 14009 14010 // Add the old object onto the stack (as a reference) 14011 ret.prevObject = this; 14012 14013 // Return the newly-formed element set 14014 return ret; 14015 }, 14016 14017 // Execute a callback for every element in the matched set. 14018 each: function( callback ) { 14019 return jQuery.each( this, callback ); 14020 }, 14021 14022 map: function( callback ) { 14023 return this.pushStack( jQuery.map( this, function( elem, i ) { 14024 return callback.call( elem, i, elem ); 14025 } ) ); 14026 }, 14027 14028 slice: function() { 14029 return this.pushStack( slice.apply( this, arguments ) ); 14030 }, 14031 14032 first: function() { 14033 return this.eq( 0 ); 14034 }, 14035 14036 last: function() { 14037 return this.eq( -1 ); 14038 }, 14039 14040 even: function() { 14041 return this.pushStack( jQuery.grep( this, function( _elem, i ) { 14042 return ( i + 1 ) % 2; 14043 } ) ); 14044 }, 14045 14046 odd: function() { 14047 return this.pushStack( jQuery.grep( this, function( _elem, i ) { 14048 return i % 2; 14049 } ) ); 14050 }, 14051 14052 eq: function( i ) { 14053 var len = this.length, 14054 j = +i + ( i < 0 ? len : 0 ); 14055 return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); 14056 }, 14057 14058 end: function() { 14059 return this.prevObject || this.constructor(); 14060 }, 14061 14062 // For internal use only. 14063 // Behaves like an Array's method, not like a jQuery method. 14064 push: push, 14065 sort: arr.sort, 14066 splice: arr.splice 14067}; 14068 14069jQuery.extend = jQuery.fn.extend = function() { 14070 var options, name, src, copy, copyIsArray, clone, 14071 target = arguments[ 0 ] || {}, 14072 i = 1, 14073 length = arguments.length, 14074 deep = false; 14075 14076 // Handle a deep copy situation 14077 if ( typeof target === "boolean" ) { 14078 deep = target; 14079 14080 // Skip the boolean and the target 14081 target = arguments[ i ] || {}; 14082 i++; 14083 } 14084 14085 // Handle case when target is a string or something (possible in deep copy) 14086 if ( typeof target !== "object" && !isFunction( target ) ) { 14087 target = {}; 14088 } 14089 14090 // Extend jQuery itself if only one argument is passed 14091 if ( i === length ) { 14092 target = this; 14093 i--; 14094 } 14095 14096 for ( ; i < length; i++ ) { 14097 14098 // Only deal with non-null/undefined values 14099 if ( ( options = arguments[ i ] ) != null ) { 14100 14101 // Extend the base object 14102 for ( name in options ) { 14103 copy = options[ name ]; 14104 14105 // Prevent Object.prototype pollution 14106 // Prevent never-ending loop 14107 if ( name === "__proto__" || target === copy ) { 14108 continue; 14109 } 14110 14111 // Recurse if we're merging plain objects or arrays 14112 if ( deep && copy && ( jQuery.isPlainObject( copy ) || 14113 ( copyIsArray = Array.isArray( copy ) ) ) ) { 14114 src = target[ name ]; 14115 14116 // Ensure proper type for the source value 14117 if ( copyIsArray && !Array.isArray( src ) ) { 14118 clone = []; 14119 } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) { 14120 clone = {}; 14121 } else { 14122 clone = src; 14123 } 14124 copyIsArray = false; 14125 14126 // Never move original objects, clone them 14127 target[ name ] = jQuery.extend( deep, clone, copy ); 14128 14129 // Don't bring in undefined values 14130 } else if ( copy !== undefined ) { 14131 target[ name ] = copy; 14132 } 14133 } 14134 } 14135 } 14136 14137 // Return the modified object 14138 return target; 14139}; 14140 14141jQuery.extend( { 14142 14143 // Unique for each copy of jQuery on the page 14144 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), 14145 14146 // Assume jQuery is ready without the ready module 14147 isReady: true, 14148 14149 error: function( msg ) { 14150 throw new Error( msg ); 14151 }, 14152 14153 noop: function() {}, 14154 14155 isPlainObject: function( obj ) { 14156 var proto, Ctor; 14157 14158 // Detect obvious negatives 14159 // Use toString instead of jQuery.type to catch host objects 14160 if ( !obj || toString.call( obj ) !== "[object Object]" ) { 14161 return false; 14162 } 14163 14164 proto = getProto( obj ); 14165 14166 // Objects with no prototype (e.g., `Object.create( null )`) are plain 14167 if ( !proto ) { 14168 return true; 14169 } 14170 14171 // Objects with prototype are plain iff they were constructed by a global Object function 14172 Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; 14173 return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; 14174 }, 14175 14176 isEmptyObject: function( obj ) { 14177 var name; 14178 14179 for ( name in obj ) { 14180 return false; 14181 } 14182 return true; 14183 }, 14184 14185 // Evaluates a script in a provided context; falls back to the global one 14186 // if not specified. 14187 globalEval: function( code, options, doc ) { 14188 DOMEval( code, { nonce: options && options.nonce }, doc ); 14189 }, 14190 14191 each: function( obj, callback ) { 14192 var length, i = 0; 14193 14194 if ( isArrayLike( obj ) ) { 14195 length = obj.length; 14196 for ( ; i < length; i++ ) { 14197 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 14198 break; 14199 } 14200 } 14201 } else { 14202 for ( i in obj ) { 14203 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 14204 break; 14205 } 14206 } 14207 } 14208 14209 return obj; 14210 }, 14211 14212 // results is for internal usage only 14213 makeArray: function( arr, results ) { 14214 var ret = results || []; 14215 14216 if ( arr != null ) { 14217 if ( isArrayLike( Object( arr ) ) ) { 14218 jQuery.merge( ret, 14219 typeof arr === "string" ? 14220 [ arr ] : arr 14221 ); 14222 } else { 14223 push.call( ret, arr ); 14224 } 14225 } 14226 14227 return ret; 14228 }, 14229 14230 inArray: function( elem, arr, i ) { 14231 return arr == null ? -1 : indexOf.call( arr, elem, i ); 14232 }, 14233 14234 // Support: Android <=4.0 only, PhantomJS 1 only 14235 // push.apply(_, arraylike) throws on ancient WebKit 14236 merge: function( first, second ) { 14237 var len = +second.length, 14238 j = 0, 14239 i = first.length; 14240 14241 for ( ; j < len; j++ ) { 14242 first[ i++ ] = second[ j ]; 14243 } 14244 14245 first.length = i; 14246 14247 return first; 14248 }, 14249 14250 grep: function( elems, callback, invert ) { 14251 var callbackInverse, 14252 matches = [], 14253 i = 0, 14254 length = elems.length, 14255 callbackExpect = !invert; 14256 14257 // Go through the array, only saving the items 14258 // that pass the validator function 14259 for ( ; i < length; i++ ) { 14260 callbackInverse = !callback( elems[ i ], i ); 14261 if ( callbackInverse !== callbackExpect ) { 14262 matches.push( elems[ i ] ); 14263 } 14264 } 14265 14266 return matches; 14267 }, 14268 14269 // arg is for internal usage only 14270 map: function( elems, callback, arg ) { 14271 var length, value, 14272 i = 0, 14273 ret = []; 14274 14275 // Go through the array, translating each of the items to their new values 14276 if ( isArrayLike( elems ) ) { 14277 length = elems.length; 14278 for ( ; i < length; i++ ) { 14279 value = callback( elems[ i ], i, arg ); 14280 14281 if ( value != null ) { 14282 ret.push( value ); 14283 } 14284 } 14285 14286 // Go through every key on the object, 14287 } else { 14288 for ( i in elems ) { 14289 value = callback( elems[ i ], i, arg ); 14290 14291 if ( value != null ) { 14292 ret.push( value ); 14293 } 14294 } 14295 } 14296 14297 // Flatten any nested arrays 14298 return flat( ret ); 14299 }, 14300 14301 // A global GUID counter for objects 14302 guid: 1, 14303 14304 // jQuery.support is not used in Core but other projects attach their 14305 // properties to it so it needs to exist. 14306 support: support 14307} ); 14308 14309if ( typeof Symbol === "function" ) { 14310 jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; 14311} 14312 14313// Populate the class2type map 14314jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), 14315 function( _i, name ) { 14316 class2type[ "[object " + name + "]" ] = name.toLowerCase(); 14317 } ); 14318 14319function isArrayLike( obj ) { 14320 14321 // Support: real iOS 8.2 only (not reproducible in simulator) 14322 // `in` check used to prevent JIT error (gh-2145) 14323 // hasOwn isn't used here due to false negatives 14324 // regarding Nodelist length in IE 14325 var length = !!obj && "length" in obj && obj.length, 14326 type = toType( obj ); 14327 14328 if ( isFunction( obj ) || isWindow( obj ) ) { 14329 return false; 14330 } 14331 14332 return type === "array" || length === 0 || 14333 typeof length === "number" && length > 0 && ( length - 1 ) in obj; 14334} 14335var Sizzle = 14336/*! 14337 * Sizzle CSS Selector Engine v2.3.6 14338 * https://sizzlejs.com/ 14339 * 14340 * Copyright JS Foundation and other contributors 14341 * Released under the MIT license 14342 * https://js.foundation/ 14343 * 14344 * Date: 2021-02-16 14345 */ 14346( function( window ) { 14347var i, 14348 support, 14349 Expr, 14350 getText, 14351 isXML, 14352 tokenize, 14353 compile, 14354 select, 14355 outermostContext, 14356 sortInput, 14357 hasDuplicate, 14358 14359 // Local document vars 14360 setDocument, 14361 document, 14362 docElem, 14363 documentIsHTML, 14364 rbuggyQSA, 14365 rbuggyMatches, 14366 matches, 14367 contains, 14368 14369 // Instance-specific data 14370 expando = "sizzle" + 1 * new Date(), 14371 preferredDoc = window.document, 14372 dirruns = 0, 14373 done = 0, 14374 classCache = createCache(), 14375 tokenCache = createCache(), 14376 compilerCache = createCache(), 14377 nonnativeSelectorCache = createCache(), 14378 sortOrder = function( a, b ) { 14379 if ( a === b ) { 14380 hasDuplicate = true; 14381 } 14382 return 0; 14383 }, 14384 14385 // Instance methods 14386 hasOwn = ( {} ).hasOwnProperty, 14387 arr = [], 14388 pop = arr.pop, 14389 pushNative = arr.push, 14390 push = arr.push, 14391 slice = arr.slice, 14392 14393 // Use a stripped-down indexOf as it's faster than native 14394 // https://jsperf.com/thor-indexof-vs-for/5 14395 indexOf = function( list, elem ) { 14396 var i = 0, 14397 len = list.length; 14398 for ( ; i < len; i++ ) { 14399 if ( list[ i ] === elem ) { 14400 return i; 14401 } 14402 } 14403 return -1; 14404 }, 14405 14406 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|" + 14407 "ismap|loop|multiple|open|readonly|required|scoped", 14408 14409 // Regular expressions 14410 14411 // http://www.w3.org/TR/css3-selectors/#whitespace 14412 whitespace = "[\\x20\\t\\r\\n\\f]", 14413 14414 // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram 14415 identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + 14416 "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", 14417 14418 // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors 14419 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + 14420 14421 // Operator (capture 2) 14422 "*([*^$|!~]?=)" + whitespace + 14423 14424 // "Attribute values must be CSS identifiers [capture 5] 14425 // or strings [capture 3 or capture 4]" 14426 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + 14427 whitespace + "*\\]", 14428 14429 pseudos = ":(" + identifier + ")(?:\\((" + 14430 14431 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: 14432 // 1. quoted (capture 3; capture 4 or capture 5) 14433 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + 14434 14435 // 2. simple (capture 6) 14436 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + 14437 14438 // 3. anything else (capture 2) 14439 ".*" + 14440 ")\\)|)", 14441 14442 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter 14443 rwhitespace = new RegExp( whitespace + "+", "g" ), 14444 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + 14445 whitespace + "+$", "g" ), 14446 14447 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), 14448 rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + 14449 "*" ), 14450 rdescend = new RegExp( whitespace + "|>" ), 14451 14452 rpseudo = new RegExp( pseudos ), 14453 ridentifier = new RegExp( "^" + identifier + "$" ), 14454 14455 matchExpr = { 14456 "ID": new RegExp( "^#(" + identifier + ")" ), 14457 "CLASS": new RegExp( "^\\.(" + identifier + ")" ), 14458 "TAG": new RegExp( "^(" + identifier + "|[*])" ), 14459 "ATTR": new RegExp( "^" + attributes ), 14460 "PSEUDO": new RegExp( "^" + pseudos ), 14461 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + 14462 whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + 14463 whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), 14464 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), 14465 14466 // For use in libraries implementing .is() 14467 // We use this for POS matching in `select` 14468 "needsContext": new RegExp( "^" + whitespace + 14469 "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + 14470 "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) 14471 }, 14472 14473 rhtml = /HTML$/i, 14474 rinputs = /^(?:input|select|textarea|button)$/i, 14475 rheader = /^h\d$/i, 14476 14477 rnative = /^[^{]+\{\s*\[native \w/, 14478 14479 // Easily-parseable/retrievable ID or TAG or CLASS selectors 14480 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, 14481 14482 rsibling = /[+~]/, 14483 14484 // CSS escapes 14485 // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters 14486 runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g" ), 14487 funescape = function( escape, nonHex ) { 14488 var high = "0x" + escape.slice( 1 ) - 0x10000; 14489 14490 return nonHex ? 14491 14492 // Strip the backslash prefix from a non-hex escape sequence 14493 nonHex : 14494 14495 // Replace a hexadecimal escape sequence with the encoded Unicode code point 14496 // Support: IE <=11+ 14497 // For values outside the Basic Multilingual Plane (BMP), manually construct a 14498 // surrogate pair 14499 high < 0 ? 14500 String.fromCharCode( high + 0x10000 ) : 14501 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); 14502 }, 14503 14504 // CSS string/identifier serialization 14505 // https://drafts.csswg.org/cssom/#common-serializing-idioms 14506 rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, 14507 fcssescape = function( ch, asCodePoint ) { 14508 if ( asCodePoint ) { 14509 14510 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER 14511 if ( ch === "\0" ) { 14512 return "\uFFFD"; 14513 } 14514 14515 // Control characters and (dependent upon position) numbers get escaped as code points 14516 return ch.slice( 0, -1 ) + "\\" + 14517 ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; 14518 } 14519 14520 // Other potentially-special ASCII characters get backslash-escaped 14521 return "\\" + ch; 14522 }, 14523 14524 // Used for iframes 14525 // See setDocument() 14526 // Removing the function wrapper causes a "Permission Denied" 14527 // error in IE 14528 unloadHandler = function() { 14529 setDocument(); 14530 }, 14531 14532 inDisabledFieldset = addCombinator( 14533 function( elem ) { 14534 return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset"; 14535 }, 14536 { dir: "parentNode", next: "legend" } 14537 ); 14538 14539// Optimize for push.apply( _, NodeList ) 14540try { 14541 push.apply( 14542 ( arr = slice.call( preferredDoc.childNodes ) ), 14543 preferredDoc.childNodes 14544 ); 14545 14546 // Support: Android<4.0 14547 // Detect silently failing push.apply 14548 // eslint-disable-next-line no-unused-expressions 14549 arr[ preferredDoc.childNodes.length ].nodeType; 14550} catch ( e ) { 14551 push = { apply: arr.length ? 14552 14553 // Leverage slice if possible 14554 function( target, els ) { 14555 pushNative.apply( target, slice.call( els ) ); 14556 } : 14557 14558 // Support: IE<9 14559 // Otherwise append directly 14560 function( target, els ) { 14561 var j = target.length, 14562 i = 0; 14563 14564 // Can't trust NodeList.length 14565 while ( ( target[ j++ ] = els[ i++ ] ) ) {} 14566 target.length = j - 1; 14567 } 14568 }; 14569} 14570 14571function Sizzle( selector, context, results, seed ) { 14572 var m, i, elem, nid, match, groups, newSelector, 14573 newContext = context && context.ownerDocument, 14574 14575 // nodeType defaults to 9, since context defaults to document 14576 nodeType = context ? context.nodeType : 9; 14577 14578 results = results || []; 14579 14580 // Return early from calls with invalid selector or context 14581 if ( typeof selector !== "string" || !selector || 14582 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { 14583 14584 return results; 14585 } 14586 14587 // Try to shortcut find operations (as opposed to filters) in HTML documents 14588 if ( !seed ) { 14589 setDocument( context ); 14590 context = context || document; 14591 14592 if ( documentIsHTML ) { 14593 14594 // If the selector is sufficiently simple, try using a "get*By*" DOM method 14595 // (excepting DocumentFragment context, where the methods don't exist) 14596 if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) { 14597 14598 // ID selector 14599 if ( ( m = match[ 1 ] ) ) { 14600 14601 // Document context 14602 if ( nodeType === 9 ) { 14603 if ( ( elem = context.getElementById( m ) ) ) { 14604 14605 // Support: IE, Opera, Webkit 14606 // TODO: identify versions 14607 // getElementById can match elements by name instead of ID 14608 if ( elem.id === m ) { 14609 results.push( elem ); 14610 return results; 14611 } 14612 } else { 14613 return results; 14614 } 14615 14616 // Element context 14617 } else { 14618 14619 // Support: IE, Opera, Webkit 14620 // TODO: identify versions 14621 // getElementById can match elements by name instead of ID 14622 if ( newContext && ( elem = newContext.getElementById( m ) ) && 14623 contains( context, elem ) && 14624 elem.id === m ) { 14625 14626 results.push( elem ); 14627 return results; 14628 } 14629 } 14630 14631 // Type selector 14632 } else if ( match[ 2 ] ) { 14633 push.apply( results, context.getElementsByTagName( selector ) ); 14634 return results; 14635 14636 // Class selector 14637 } else if ( ( m = match[ 3 ] ) && support.getElementsByClassName && 14638 context.getElementsByClassName ) { 14639 14640 push.apply( results, context.getElementsByClassName( m ) ); 14641 return results; 14642 } 14643 } 14644 14645 // Take advantage of querySelectorAll 14646 if ( support.qsa && 14647 !nonnativeSelectorCache[ selector + " " ] && 14648 ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) && 14649 14650 // Support: IE 8 only 14651 // Exclude object elements 14652 ( nodeType !== 1 || context.nodeName.toLowerCase() !== "object" ) ) { 14653 14654 newSelector = selector; 14655 newContext = context; 14656 14657 // qSA considers elements outside a scoping root when evaluating child or 14658 // descendant combinators, which is not what we want. 14659 // In such cases, we work around the behavior by prefixing every selector in the 14660 // list with an ID selector referencing the scope context. 14661 // The technique has to be used as well when a leading combinator is used 14662 // as such selectors are not recognized by querySelectorAll. 14663 // Thanks to Andrew Dupont for this technique. 14664 if ( nodeType === 1 && 14665 ( rdescend.test( selector ) || rcombinators.test( selector ) ) ) { 14666 14667 // Expand context for sibling selectors 14668 newContext = rsibling.test( selector ) && testContext( context.parentNode ) || 14669 context; 14670 14671 // We can use :scope instead of the ID hack if the browser 14672 // supports it & if we're not changing the context. 14673 if ( newContext !== context || !support.scope ) { 14674 14675 // Capture the context ID, setting it first if necessary 14676 if ( ( nid = context.getAttribute( "id" ) ) ) { 14677 nid = nid.replace( rcssescape, fcssescape ); 14678 } else { 14679 context.setAttribute( "id", ( nid = expando ) ); 14680 } 14681 } 14682 14683 // Prefix every selector in the list 14684 groups = tokenize( selector ); 14685 i = groups.length; 14686 while ( i-- ) { 14687 groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " + 14688 toSelector( groups[ i ] ); 14689 } 14690 newSelector = groups.join( "," ); 14691 } 14692 14693 try { 14694 push.apply( results, 14695 newContext.querySelectorAll( newSelector ) 14696 ); 14697 return results; 14698 } catch ( qsaError ) { 14699 nonnativeSelectorCache( selector, true ); 14700 } finally { 14701 if ( nid === expando ) { 14702 context.removeAttribute( "id" ); 14703 } 14704 } 14705 } 14706 } 14707 } 14708 14709 // All others 14710 return select( selector.replace( rtrim, "$1" ), context, results, seed ); 14711} 14712 14713/** 14714 * Create key-value caches of limited size 14715 * @returns {function(string, object)} Returns the Object data after storing it on itself with 14716 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) 14717 * deleting the oldest entry 14718 */ 14719function createCache() { 14720 var keys = []; 14721 14722 function cache( key, value ) { 14723 14724 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) 14725 if ( keys.push( key + " " ) > Expr.cacheLength ) { 14726 14727 // Only keep the most recent entries 14728 delete cache[ keys.shift() ]; 14729 } 14730 return ( cache[ key + " " ] = value ); 14731 } 14732 return cache; 14733} 14734 14735/** 14736 * Mark a function for special use by Sizzle 14737 * @param {Function} fn The function to mark 14738 */ 14739function markFunction( fn ) { 14740 fn[ expando ] = true; 14741 return fn; 14742} 14743 14744/** 14745 * Support testing using an element 14746 * @param {Function} fn Passed the created element and returns a boolean result 14747 */ 14748function assert( fn ) { 14749 var el = document.createElement( "fieldset" ); 14750 14751 try { 14752 return !!fn( el ); 14753 } catch ( e ) { 14754 return false; 14755 } finally { 14756 14757 // Remove from its parent by default 14758 if ( el.parentNode ) { 14759 el.parentNode.removeChild( el ); 14760 } 14761 14762 // release memory in IE 14763 el = null; 14764 } 14765} 14766 14767/** 14768 * Adds the same handler for all of the specified attrs 14769 * @param {String} attrs Pipe-separated list of attributes 14770 * @param {Function} handler The method that will be applied 14771 */ 14772function addHandle( attrs, handler ) { 14773 var arr = attrs.split( "|" ), 14774 i = arr.length; 14775 14776 while ( i-- ) { 14777 Expr.attrHandle[ arr[ i ] ] = handler; 14778 } 14779} 14780 14781/** 14782 * Checks document order of two siblings 14783 * @param {Element} a 14784 * @param {Element} b 14785 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b 14786 */ 14787function siblingCheck( a, b ) { 14788 var cur = b && a, 14789 diff = cur && a.nodeType === 1 && b.nodeType === 1 && 14790 a.sourceIndex - b.sourceIndex; 14791 14792 // Use IE sourceIndex if available on both nodes 14793 if ( diff ) { 14794 return diff; 14795 } 14796 14797 // Check if b follows a 14798 if ( cur ) { 14799 while ( ( cur = cur.nextSibling ) ) { 14800 if ( cur === b ) { 14801 return -1; 14802 } 14803 } 14804 } 14805 14806 return a ? 1 : -1; 14807} 14808 14809/** 14810 * Returns a function to use in pseudos for input types 14811 * @param {String} type 14812 */ 14813function createInputPseudo( type ) { 14814 return function( elem ) { 14815 var name = elem.nodeName.toLowerCase(); 14816 return name === "input" && elem.type === type; 14817 }; 14818} 14819 14820/** 14821 * Returns a function to use in pseudos for buttons 14822 * @param {String} type 14823 */ 14824function createButtonPseudo( type ) { 14825 return function( elem ) { 14826 var name = elem.nodeName.toLowerCase(); 14827 return ( name === "input" || name === "button" ) && elem.type === type; 14828 }; 14829} 14830 14831/** 14832 * Returns a function to use in pseudos for :enabled/:disabled 14833 * @param {Boolean} disabled true for :disabled; false for :enabled 14834 */ 14835function createDisabledPseudo( disabled ) { 14836 14837 // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable 14838 return function( elem ) { 14839 14840 // Only certain elements can match :enabled or :disabled 14841 // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled 14842 // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled 14843 if ( "form" in elem ) { 14844 14845 // Check for inherited disabledness on relevant non-disabled elements: 14846 // * listed form-associated elements in a disabled fieldset 14847 // https://html.spec.whatwg.org/multipage/forms.html#category-listed 14848 // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled 14849 // * option elements in a disabled optgroup 14850 // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled 14851 // All such elements have a "form" property. 14852 if ( elem.parentNode && elem.disabled === false ) { 14853 14854 // Option elements defer to a parent optgroup if present 14855 if ( "label" in elem ) { 14856 if ( "label" in elem.parentNode ) { 14857 return elem.parentNode.disabled === disabled; 14858 } else { 14859 return elem.disabled === disabled; 14860 } 14861 } 14862 14863 // Support: IE 6 - 11 14864 // Use the isDisabled shortcut property to check for disabled fieldset ancestors 14865 return elem.isDisabled === disabled || 14866 14867 // Where there is no isDisabled, check manually 14868 /* jshint -W018 */ 14869 elem.isDisabled !== !disabled && 14870 inDisabledFieldset( elem ) === disabled; 14871 } 14872 14873 return elem.disabled === disabled; 14874 14875 // Try to winnow out elements that can't be disabled before trusting the disabled property. 14876 // Some victims get caught in our net (label, legend, menu, track), but it shouldn't 14877 // even exist on them, let alone have a boolean value. 14878 } else if ( "label" in elem ) { 14879 return elem.disabled === disabled; 14880 } 14881 14882 // Remaining elements are neither :enabled nor :disabled 14883 return false; 14884 }; 14885} 14886 14887/** 14888 * Returns a function to use in pseudos for positionals 14889 * @param {Function} fn 14890 */ 14891function createPositionalPseudo( fn ) { 14892 return markFunction( function( argument ) { 14893 argument = +argument; 14894 return markFunction( function( seed, matches ) { 14895 var j, 14896 matchIndexes = fn( [], seed.length, argument ), 14897 i = matchIndexes.length; 14898 14899 // Match elements found at the specified indexes 14900 while ( i-- ) { 14901 if ( seed[ ( j = matchIndexes[ i ] ) ] ) { 14902 seed[ j ] = !( matches[ j ] = seed[ j ] ); 14903 } 14904 } 14905 } ); 14906 } ); 14907} 14908 14909/** 14910 * Checks a node for validity as a Sizzle context 14911 * @param {Element|Object=} context 14912 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value 14913 */ 14914function testContext( context ) { 14915 return context && typeof context.getElementsByTagName !== "undefined" && context; 14916} 14917 14918// Expose support vars for convenience 14919support = Sizzle.support = {}; 14920 14921/** 14922 * Detects XML nodes 14923 * @param {Element|Object} elem An element or a document 14924 * @returns {Boolean} True iff elem is a non-HTML XML node 14925 */ 14926isXML = Sizzle.isXML = function( elem ) { 14927 var namespace = elem && elem.namespaceURI, 14928 docElem = elem && ( elem.ownerDocument || elem ).documentElement; 14929 14930 // Support: IE <=8 14931 // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes 14932 // https://bugs.jquery.com/ticket/4833 14933 return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" ); 14934}; 14935 14936/** 14937 * Sets document-related variables once based on the current document 14938 * @param {Element|Object} [doc] An element or document object to use to set the document 14939 * @returns {Object} Returns the current document 14940 */ 14941setDocument = Sizzle.setDocument = function( node ) { 14942 var hasCompare, subWindow, 14943 doc = node ? node.ownerDocument || node : preferredDoc; 14944 14945 // Return early if doc is invalid or already selected 14946 // Support: IE 11+, Edge 17 - 18+ 14947 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 14948 // two documents; shallow comparisons work. 14949 // eslint-disable-next-line eqeqeq 14950 if ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) { 14951 return document; 14952 } 14953 14954 // Update global variables 14955 document = doc; 14956 docElem = document.documentElement; 14957 documentIsHTML = !isXML( document ); 14958 14959 // Support: IE 9 - 11+, Edge 12 - 18+ 14960 // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) 14961 // Support: IE 11+, Edge 17 - 18+ 14962 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 14963 // two documents; shallow comparisons work. 14964 // eslint-disable-next-line eqeqeq 14965 if ( preferredDoc != document && 14966 ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) { 14967 14968 // Support: IE 11, Edge 14969 if ( subWindow.addEventListener ) { 14970 subWindow.addEventListener( "unload", unloadHandler, false ); 14971 14972 // Support: IE 9 - 10 only 14973 } else if ( subWindow.attachEvent ) { 14974 subWindow.attachEvent( "onunload", unloadHandler ); 14975 } 14976 } 14977 14978 // Support: IE 8 - 11+, Edge 12 - 18+, Chrome <=16 - 25 only, Firefox <=3.6 - 31 only, 14979 // Safari 4 - 5 only, Opera <=11.6 - 12.x only 14980 // IE/Edge & older browsers don't support the :scope pseudo-class. 14981 // Support: Safari 6.0 only 14982 // Safari 6.0 supports :scope but it's an alias of :root there. 14983 support.scope = assert( function( el ) { 14984 docElem.appendChild( el ).appendChild( document.createElement( "div" ) ); 14985 return typeof el.querySelectorAll !== "undefined" && 14986 !el.querySelectorAll( ":scope fieldset div" ).length; 14987 } ); 14988 14989 /* Attributes 14990 ---------------------------------------------------------------------- */ 14991 14992 // Support: IE<8 14993 // Verify that getAttribute really returns attributes and not properties 14994 // (excepting IE8 booleans) 14995 support.attributes = assert( function( el ) { 14996 el.className = "i"; 14997 return !el.getAttribute( "className" ); 14998 } ); 14999 15000 /* getElement(s)By* 15001 ---------------------------------------------------------------------- */ 15002 15003 // Check if getElementsByTagName("*") returns only elements 15004 support.getElementsByTagName = assert( function( el ) { 15005 el.appendChild( document.createComment( "" ) ); 15006 return !el.getElementsByTagName( "*" ).length; 15007 } ); 15008 15009 // Support: IE<9 15010 support.getElementsByClassName = rnative.test( document.getElementsByClassName ); 15011 15012 // Support: IE<10 15013 // Check if getElementById returns elements by name 15014 // The broken getElementById methods don't pick up programmatically-set names, 15015 // so use a roundabout getElementsByName test 15016 support.getById = assert( function( el ) { 15017 docElem.appendChild( el ).id = expando; 15018 return !document.getElementsByName || !document.getElementsByName( expando ).length; 15019 } ); 15020 15021 // ID filter and find 15022 if ( support.getById ) { 15023 Expr.filter[ "ID" ] = function( id ) { 15024 var attrId = id.replace( runescape, funescape ); 15025 return function( elem ) { 15026 return elem.getAttribute( "id" ) === attrId; 15027 }; 15028 }; 15029 Expr.find[ "ID" ] = function( id, context ) { 15030 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 15031 var elem = context.getElementById( id ); 15032 return elem ? [ elem ] : []; 15033 } 15034 }; 15035 } else { 15036 Expr.filter[ "ID" ] = function( id ) { 15037 var attrId = id.replace( runescape, funescape ); 15038 return function( elem ) { 15039 var node = typeof elem.getAttributeNode !== "undefined" && 15040 elem.getAttributeNode( "id" ); 15041 return node && node.value === attrId; 15042 }; 15043 }; 15044 15045 // Support: IE 6 - 7 only 15046 // getElementById is not reliable as a find shortcut 15047 Expr.find[ "ID" ] = function( id, context ) { 15048 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 15049 var node, i, elems, 15050 elem = context.getElementById( id ); 15051 15052 if ( elem ) { 15053 15054 // Verify the id attribute 15055 node = elem.getAttributeNode( "id" ); 15056 if ( node && node.value === id ) { 15057 return [ elem ]; 15058 } 15059 15060 // Fall back on getElementsByName 15061 elems = context.getElementsByName( id ); 15062 i = 0; 15063 while ( ( elem = elems[ i++ ] ) ) { 15064 node = elem.getAttributeNode( "id" ); 15065 if ( node && node.value === id ) { 15066 return [ elem ]; 15067 } 15068 } 15069 } 15070 15071 return []; 15072 } 15073 }; 15074 } 15075 15076 // Tag 15077 Expr.find[ "TAG" ] = support.getElementsByTagName ? 15078 function( tag, context ) { 15079 if ( typeof context.getElementsByTagName !== "undefined" ) { 15080 return context.getElementsByTagName( tag ); 15081 15082 // DocumentFragment nodes don't have gEBTN 15083 } else if ( support.qsa ) { 15084 return context.querySelectorAll( tag ); 15085 } 15086 } : 15087 15088 function( tag, context ) { 15089 var elem, 15090 tmp = [], 15091 i = 0, 15092 15093 // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too 15094 results = context.getElementsByTagName( tag ); 15095 15096 // Filter out possible comments 15097 if ( tag === "*" ) { 15098 while ( ( elem = results[ i++ ] ) ) { 15099 if ( elem.nodeType === 1 ) { 15100 tmp.push( elem ); 15101 } 15102 } 15103 15104 return tmp; 15105 } 15106 return results; 15107 }; 15108 15109 // Class 15110 Expr.find[ "CLASS" ] = support.getElementsByClassName && function( className, context ) { 15111 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { 15112 return context.getElementsByClassName( className ); 15113 } 15114 }; 15115 15116 /* QSA/matchesSelector 15117 ---------------------------------------------------------------------- */ 15118 15119 // QSA and matchesSelector support 15120 15121 // matchesSelector(:active) reports false when true (IE9/Opera 11.5) 15122 rbuggyMatches = []; 15123 15124 // qSa(:focus) reports false when true (Chrome 21) 15125 // We allow this because of a bug in IE8/9 that throws an error 15126 // whenever `document.activeElement` is accessed on an iframe 15127 // So, we allow :focus to pass through QSA all the time to avoid the IE error 15128 // See https://bugs.jquery.com/ticket/13378 15129 rbuggyQSA = []; 15130 15131 if ( ( support.qsa = rnative.test( document.querySelectorAll ) ) ) { 15132 15133 // Build QSA regex 15134 // Regex strategy adopted from Diego Perini 15135 assert( function( el ) { 15136 15137 var input; 15138 15139 // Select is set to empty string on purpose 15140 // This is to test IE's treatment of not explicitly 15141 // setting a boolean content attribute, 15142 // since its presence should be enough 15143 // https://bugs.jquery.com/ticket/12359 15144 docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" + 15145 "<select id='" + expando + "-\r\\' msallowcapture=''>" + 15146 "<option selected=''></option></select>"; 15147 15148 // Support: IE8, Opera 11-12.16 15149 // Nothing should be selected when empty strings follow ^= or $= or *= 15150 // The test attribute must be unknown in Opera but "safe" for WinRT 15151 // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section 15152 if ( el.querySelectorAll( "[msallowcapture^='']" ).length ) { 15153 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); 15154 } 15155 15156 // Support: IE8 15157 // Boolean attributes and "value" are not treated correctly 15158 if ( !el.querySelectorAll( "[selected]" ).length ) { 15159 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); 15160 } 15161 15162 // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ 15163 if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { 15164 rbuggyQSA.push( "~=" ); 15165 } 15166 15167 // Support: IE 11+, Edge 15 - 18+ 15168 // IE 11/Edge don't find elements on a `[name='']` query in some cases. 15169 // Adding a temporary attribute to the document before the selection works 15170 // around the issue. 15171 // Interestingly, IE 10 & older don't seem to have the issue. 15172 input = document.createElement( "input" ); 15173 input.setAttribute( "name", "" ); 15174 el.appendChild( input ); 15175 if ( !el.querySelectorAll( "[name='']" ).length ) { 15176 rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" + 15177 whitespace + "*(?:''|\"\")" ); 15178 } 15179 15180 // Webkit/Opera - :checked should return selected option elements 15181 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 15182 // IE8 throws error here and will not see later tests 15183 if ( !el.querySelectorAll( ":checked" ).length ) { 15184 rbuggyQSA.push( ":checked" ); 15185 } 15186 15187 // Support: Safari 8+, iOS 8+ 15188 // https://bugs.webkit.org/show_bug.cgi?id=136851 15189 // In-page `selector#id sibling-combinator selector` fails 15190 if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { 15191 rbuggyQSA.push( ".#.+[+~]" ); 15192 } 15193 15194 // Support: Firefox <=3.6 - 5 only 15195 // Old Firefox doesn't throw on a badly-escaped identifier. 15196 el.querySelectorAll( "\\\f" ); 15197 rbuggyQSA.push( "[\\r\\n\\f]" ); 15198 } ); 15199 15200 assert( function( el ) { 15201 el.innerHTML = "<a href='' disabled='disabled'></a>" + 15202 "<select disabled='disabled'><option/></select>"; 15203 15204 // Support: Windows 8 Native Apps 15205 // The type and name attributes are restricted during .innerHTML assignment 15206 var input = document.createElement( "input" ); 15207 input.setAttribute( "type", "hidden" ); 15208 el.appendChild( input ).setAttribute( "name", "D" ); 15209 15210 // Support: IE8 15211 // Enforce case-sensitivity of name attribute 15212 if ( el.querySelectorAll( "[name=d]" ).length ) { 15213 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); 15214 } 15215 15216 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) 15217 // IE8 throws error here and will not see later tests 15218 if ( el.querySelectorAll( ":enabled" ).length !== 2 ) { 15219 rbuggyQSA.push( ":enabled", ":disabled" ); 15220 } 15221 15222 // Support: IE9-11+ 15223 // IE's :disabled selector does not pick up the children of disabled fieldsets 15224 docElem.appendChild( el ).disabled = true; 15225 if ( el.querySelectorAll( ":disabled" ).length !== 2 ) { 15226 rbuggyQSA.push( ":enabled", ":disabled" ); 15227 } 15228 15229 // Support: Opera 10 - 11 only 15230 // Opera 10-11 does not throw on post-comma invalid pseudos 15231 el.querySelectorAll( "*,:x" ); 15232 rbuggyQSA.push( ",.*:" ); 15233 } ); 15234 } 15235 15236 if ( ( support.matchesSelector = rnative.test( ( matches = docElem.matches || 15237 docElem.webkitMatchesSelector || 15238 docElem.mozMatchesSelector || 15239 docElem.oMatchesSelector || 15240 docElem.msMatchesSelector ) ) ) ) { 15241 15242 assert( function( el ) { 15243 15244 // Check to see if it's possible to do matchesSelector 15245 // on a disconnected node (IE 9) 15246 support.disconnectedMatch = matches.call( el, "*" ); 15247 15248 // This should fail with an exception 15249 // Gecko does not error, returns false instead 15250 matches.call( el, "[s!='']:x" ); 15251 rbuggyMatches.push( "!=", pseudos ); 15252 } ); 15253 } 15254 15255 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) ); 15256 rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join( "|" ) ); 15257 15258 /* Contains 15259 ---------------------------------------------------------------------- */ 15260 hasCompare = rnative.test( docElem.compareDocumentPosition ); 15261 15262 // Element contains another 15263 // Purposefully self-exclusive 15264 // As in, an element does not contain itself 15265 contains = hasCompare || rnative.test( docElem.contains ) ? 15266 function( a, b ) { 15267 var adown = a.nodeType === 9 ? a.documentElement : a, 15268 bup = b && b.parentNode; 15269 return a === bup || !!( bup && bup.nodeType === 1 && ( 15270 adown.contains ? 15271 adown.contains( bup ) : 15272 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 15273 ) ); 15274 } : 15275 function( a, b ) { 15276 if ( b ) { 15277 while ( ( b = b.parentNode ) ) { 15278 if ( b === a ) { 15279 return true; 15280 } 15281 } 15282 } 15283 return false; 15284 }; 15285 15286 /* Sorting 15287 ---------------------------------------------------------------------- */ 15288 15289 // Document order sorting 15290 sortOrder = hasCompare ? 15291 function( a, b ) { 15292 15293 // Flag for duplicate removal 15294 if ( a === b ) { 15295 hasDuplicate = true; 15296 return 0; 15297 } 15298 15299 // Sort on method existence if only one input has compareDocumentPosition 15300 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; 15301 if ( compare ) { 15302 return compare; 15303 } 15304 15305 // Calculate position if both inputs belong to the same document 15306 // Support: IE 11+, Edge 17 - 18+ 15307 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 15308 // two documents; shallow comparisons work. 15309 // eslint-disable-next-line eqeqeq 15310 compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ? 15311 a.compareDocumentPosition( b ) : 15312 15313 // Otherwise we know they are disconnected 15314 1; 15315 15316 // Disconnected nodes 15317 if ( compare & 1 || 15318 ( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) { 15319 15320 // Choose the first element that is related to our preferred document 15321 // Support: IE 11+, Edge 17 - 18+ 15322 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 15323 // two documents; shallow comparisons work. 15324 // eslint-disable-next-line eqeqeq 15325 if ( a == document || a.ownerDocument == preferredDoc && 15326 contains( preferredDoc, a ) ) { 15327 return -1; 15328 } 15329 15330 // Support: IE 11+, Edge 17 - 18+ 15331 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 15332 // two documents; shallow comparisons work. 15333 // eslint-disable-next-line eqeqeq 15334 if ( b == document || b.ownerDocument == preferredDoc && 15335 contains( preferredDoc, b ) ) { 15336 return 1; 15337 } 15338 15339 // Maintain original order 15340 return sortInput ? 15341 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 15342 0; 15343 } 15344 15345 return compare & 4 ? -1 : 1; 15346 } : 15347 function( a, b ) { 15348 15349 // Exit early if the nodes are identical 15350 if ( a === b ) { 15351 hasDuplicate = true; 15352 return 0; 15353 } 15354 15355 var cur, 15356 i = 0, 15357 aup = a.parentNode, 15358 bup = b.parentNode, 15359 ap = [ a ], 15360 bp = [ b ]; 15361 15362 // Parentless nodes are either documents or disconnected 15363 if ( !aup || !bup ) { 15364 15365 // Support: IE 11+, Edge 17 - 18+ 15366 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 15367 // two documents; shallow comparisons work. 15368 /* eslint-disable eqeqeq */ 15369 return a == document ? -1 : 15370 b == document ? 1 : 15371 /* eslint-enable eqeqeq */ 15372 aup ? -1 : 15373 bup ? 1 : 15374 sortInput ? 15375 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 15376 0; 15377 15378 // If the nodes are siblings, we can do a quick check 15379 } else if ( aup === bup ) { 15380 return siblingCheck( a, b ); 15381 } 15382 15383 // Otherwise we need full lists of their ancestors for comparison 15384 cur = a; 15385 while ( ( cur = cur.parentNode ) ) { 15386 ap.unshift( cur ); 15387 } 15388 cur = b; 15389 while ( ( cur = cur.parentNode ) ) { 15390 bp.unshift( cur ); 15391 } 15392 15393 // Walk down the tree looking for a discrepancy 15394 while ( ap[ i ] === bp[ i ] ) { 15395 i++; 15396 } 15397 15398 return i ? 15399 15400 // Do a sibling check if the nodes have a common ancestor 15401 siblingCheck( ap[ i ], bp[ i ] ) : 15402 15403 // Otherwise nodes in our document sort first 15404 // Support: IE 11+, Edge 17 - 18+ 15405 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 15406 // two documents; shallow comparisons work. 15407 /* eslint-disable eqeqeq */ 15408 ap[ i ] == preferredDoc ? -1 : 15409 bp[ i ] == preferredDoc ? 1 : 15410 /* eslint-enable eqeqeq */ 15411 0; 15412 }; 15413 15414 return document; 15415}; 15416 15417Sizzle.matches = function( expr, elements ) { 15418 return Sizzle( expr, null, null, elements ); 15419}; 15420 15421Sizzle.matchesSelector = function( elem, expr ) { 15422 setDocument( elem ); 15423 15424 if ( support.matchesSelector && documentIsHTML && 15425 !nonnativeSelectorCache[ expr + " " ] && 15426 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && 15427 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { 15428 15429 try { 15430 var ret = matches.call( elem, expr ); 15431 15432 // IE 9's matchesSelector returns false on disconnected nodes 15433 if ( ret || support.disconnectedMatch || 15434 15435 // As well, disconnected nodes are said to be in a document 15436 // fragment in IE 9 15437 elem.document && elem.document.nodeType !== 11 ) { 15438 return ret; 15439 } 15440 } catch ( e ) { 15441 nonnativeSelectorCache( expr, true ); 15442 } 15443 } 15444 15445 return Sizzle( expr, document, null, [ elem ] ).length > 0; 15446}; 15447 15448Sizzle.contains = function( context, elem ) { 15449 15450 // Set document vars if needed 15451 // Support: IE 11+, Edge 17 - 18+ 15452 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 15453 // two documents; shallow comparisons work. 15454 // eslint-disable-next-line eqeqeq 15455 if ( ( context.ownerDocument || context ) != document ) { 15456 setDocument( context ); 15457 } 15458 return contains( context, elem ); 15459}; 15460 15461Sizzle.attr = function( elem, name ) { 15462 15463 // Set document vars if needed 15464 // Support: IE 11+, Edge 17 - 18+ 15465 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 15466 // two documents; shallow comparisons work. 15467 // eslint-disable-next-line eqeqeq 15468 if ( ( elem.ownerDocument || elem ) != document ) { 15469 setDocument( elem ); 15470 } 15471 15472 var fn = Expr.attrHandle[ name.toLowerCase() ], 15473 15474 // Don't get fooled by Object.prototype properties (jQuery #13807) 15475 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? 15476 fn( elem, name, !documentIsHTML ) : 15477 undefined; 15478 15479 return val !== undefined ? 15480 val : 15481 support.attributes || !documentIsHTML ? 15482 elem.getAttribute( name ) : 15483 ( val = elem.getAttributeNode( name ) ) && val.specified ? 15484 val.value : 15485 null; 15486}; 15487 15488Sizzle.escape = function( sel ) { 15489 return ( sel + "" ).replace( rcssescape, fcssescape ); 15490}; 15491 15492Sizzle.error = function( msg ) { 15493 throw new Error( "Syntax error, unrecognized expression: " + msg ); 15494}; 15495 15496/** 15497 * Document sorting and removing duplicates 15498 * @param {ArrayLike} results 15499 */ 15500Sizzle.uniqueSort = function( results ) { 15501 var elem, 15502 duplicates = [], 15503 j = 0, 15504 i = 0; 15505 15506 // Unless we *know* we can detect duplicates, assume their presence 15507 hasDuplicate = !support.detectDuplicates; 15508 sortInput = !support.sortStable && results.slice( 0 ); 15509 results.sort( sortOrder ); 15510 15511 if ( hasDuplicate ) { 15512 while ( ( elem = results[ i++ ] ) ) { 15513 if ( elem === results[ i ] ) { 15514 j = duplicates.push( i ); 15515 } 15516 } 15517 while ( j-- ) { 15518 results.splice( duplicates[ j ], 1 ); 15519 } 15520 } 15521 15522 // Clear input after sorting to release objects 15523 // See https://github.com/jquery/sizzle/pull/225 15524 sortInput = null; 15525 15526 return results; 15527}; 15528 15529/** 15530 * Utility function for retrieving the text value of an array of DOM nodes 15531 * @param {Array|Element} elem 15532 */ 15533getText = Sizzle.getText = function( elem ) { 15534 var node, 15535 ret = "", 15536 i = 0, 15537 nodeType = elem.nodeType; 15538 15539 if ( !nodeType ) { 15540 15541 // If no nodeType, this is expected to be an array 15542 while ( ( node = elem[ i++ ] ) ) { 15543 15544 // Do not traverse comment nodes 15545 ret += getText( node ); 15546 } 15547 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { 15548 15549 // Use textContent for elements 15550 // innerText usage removed for consistency of new lines (jQuery #11153) 15551 if ( typeof elem.textContent === "string" ) { 15552 return elem.textContent; 15553 } else { 15554 15555 // Traverse its children 15556 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 15557 ret += getText( elem ); 15558 } 15559 } 15560 } else if ( nodeType === 3 || nodeType === 4 ) { 15561 return elem.nodeValue; 15562 } 15563 15564 // Do not include comment or processing instruction nodes 15565 15566 return ret; 15567}; 15568 15569Expr = Sizzle.selectors = { 15570 15571 // Can be adjusted by the user 15572 cacheLength: 50, 15573 15574 createPseudo: markFunction, 15575 15576 match: matchExpr, 15577 15578 attrHandle: {}, 15579 15580 find: {}, 15581 15582 relative: { 15583 ">": { dir: "parentNode", first: true }, 15584 " ": { dir: "parentNode" }, 15585 "+": { dir: "previousSibling", first: true }, 15586 "~": { dir: "previousSibling" } 15587 }, 15588 15589 preFilter: { 15590 "ATTR": function( match ) { 15591 match[ 1 ] = match[ 1 ].replace( runescape, funescape ); 15592 15593 // Move the given value to match[3] whether quoted or unquoted 15594 match[ 3 ] = ( match[ 3 ] || match[ 4 ] || 15595 match[ 5 ] || "" ).replace( runescape, funescape ); 15596 15597 if ( match[ 2 ] === "~=" ) { 15598 match[ 3 ] = " " + match[ 3 ] + " "; 15599 } 15600 15601 return match.slice( 0, 4 ); 15602 }, 15603 15604 "CHILD": function( match ) { 15605 15606 /* matches from matchExpr["CHILD"] 15607 1 type (only|nth|...) 15608 2 what (child|of-type) 15609 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 15610 4 xn-component of xn+y argument ([+-]?\d*n|) 15611 5 sign of xn-component 15612 6 x of xn-component 15613 7 sign of y-component 15614 8 y of y-component 15615 */ 15616 match[ 1 ] = match[ 1 ].toLowerCase(); 15617 15618 if ( match[ 1 ].slice( 0, 3 ) === "nth" ) { 15619 15620 // nth-* requires argument 15621 if ( !match[ 3 ] ) { 15622 Sizzle.error( match[ 0 ] ); 15623 } 15624 15625 // numeric x and y parameters for Expr.filter.CHILD 15626 // remember that false/true cast respectively to 0/1 15627 match[ 4 ] = +( match[ 4 ] ? 15628 match[ 5 ] + ( match[ 6 ] || 1 ) : 15629 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) ); 15630 match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" ); 15631 15632 // other types prohibit arguments 15633 } else if ( match[ 3 ] ) { 15634 Sizzle.error( match[ 0 ] ); 15635 } 15636 15637 return match; 15638 }, 15639 15640 "PSEUDO": function( match ) { 15641 var excess, 15642 unquoted = !match[ 6 ] && match[ 2 ]; 15643 15644 if ( matchExpr[ "CHILD" ].test( match[ 0 ] ) ) { 15645 return null; 15646 } 15647 15648 // Accept quoted arguments as-is 15649 if ( match[ 3 ] ) { 15650 match[ 2 ] = match[ 4 ] || match[ 5 ] || ""; 15651 15652 // Strip excess characters from unquoted arguments 15653 } else if ( unquoted && rpseudo.test( unquoted ) && 15654 15655 // Get excess from tokenize (recursively) 15656 ( excess = tokenize( unquoted, true ) ) && 15657 15658 // advance to the next closing parenthesis 15659 ( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) { 15660 15661 // excess is a negative index 15662 match[ 0 ] = match[ 0 ].slice( 0, excess ); 15663 match[ 2 ] = unquoted.slice( 0, excess ); 15664 } 15665 15666 // Return only captures needed by the pseudo filter method (type and argument) 15667 return match.slice( 0, 3 ); 15668 } 15669 }, 15670 15671 filter: { 15672 15673 "TAG": function( nodeNameSelector ) { 15674 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); 15675 return nodeNameSelector === "*" ? 15676 function() { 15677 return true; 15678 } : 15679 function( elem ) { 15680 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; 15681 }; 15682 }, 15683 15684 "CLASS": function( className ) { 15685 var pattern = classCache[ className + " " ]; 15686 15687 return pattern || 15688 ( pattern = new RegExp( "(^|" + whitespace + 15689 ")" + className + "(" + whitespace + "|$)" ) ) && classCache( 15690 className, function( elem ) { 15691 return pattern.test( 15692 typeof elem.className === "string" && elem.className || 15693 typeof elem.getAttribute !== "undefined" && 15694 elem.getAttribute( "class" ) || 15695 "" 15696 ); 15697 } ); 15698 }, 15699 15700 "ATTR": function( name, operator, check ) { 15701 return function( elem ) { 15702 var result = Sizzle.attr( elem, name ); 15703 15704 if ( result == null ) { 15705 return operator === "!="; 15706 } 15707 if ( !operator ) { 15708 return true; 15709 } 15710 15711 result += ""; 15712 15713 /* eslint-disable max-len */ 15714 15715 return operator === "=" ? result === check : 15716 operator === "!=" ? result !== check : 15717 operator === "^=" ? check && result.indexOf( check ) === 0 : 15718 operator === "*=" ? check && result.indexOf( check ) > -1 : 15719 operator === "$=" ? check && result.slice( -check.length ) === check : 15720 operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : 15721 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : 15722 false; 15723 /* eslint-enable max-len */ 15724 15725 }; 15726 }, 15727 15728 "CHILD": function( type, what, _argument, first, last ) { 15729 var simple = type.slice( 0, 3 ) !== "nth", 15730 forward = type.slice( -4 ) !== "last", 15731 ofType = what === "of-type"; 15732 15733 return first === 1 && last === 0 ? 15734 15735 // Shortcut for :nth-*(n) 15736 function( elem ) { 15737 return !!elem.parentNode; 15738 } : 15739 15740 function( elem, _context, xml ) { 15741 var cache, uniqueCache, outerCache, node, nodeIndex, start, 15742 dir = simple !== forward ? "nextSibling" : "previousSibling", 15743 parent = elem.parentNode, 15744 name = ofType && elem.nodeName.toLowerCase(), 15745 useCache = !xml && !ofType, 15746 diff = false; 15747 15748 if ( parent ) { 15749 15750 // :(first|last|only)-(child|of-type) 15751 if ( simple ) { 15752 while ( dir ) { 15753 node = elem; 15754 while ( ( node = node[ dir ] ) ) { 15755 if ( ofType ? 15756 node.nodeName.toLowerCase() === name : 15757 node.nodeType === 1 ) { 15758 15759 return false; 15760 } 15761 } 15762 15763 // Reverse direction for :only-* (if we haven't yet done so) 15764 start = dir = type === "only" && !start && "nextSibling"; 15765 } 15766 return true; 15767 } 15768 15769 start = [ forward ? parent.firstChild : parent.lastChild ]; 15770 15771 // non-xml :nth-child(...) stores cache data on `parent` 15772 if ( forward && useCache ) { 15773 15774 // Seek `elem` from a previously-cached index 15775 15776 // ...in a gzip-friendly way 15777 node = parent; 15778 outerCache = node[ expando ] || ( node[ expando ] = {} ); 15779 15780 // Support: IE <9 only 15781 // Defend against cloned attroperties (jQuery gh-1709) 15782 uniqueCache = outerCache[ node.uniqueID ] || 15783 ( outerCache[ node.uniqueID ] = {} ); 15784 15785 cache = uniqueCache[ type ] || []; 15786 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 15787 diff = nodeIndex && cache[ 2 ]; 15788 node = nodeIndex && parent.childNodes[ nodeIndex ]; 15789 15790 while ( ( node = ++nodeIndex && node && node[ dir ] || 15791 15792 // Fallback to seeking `elem` from the start 15793 ( diff = nodeIndex = 0 ) || start.pop() ) ) { 15794 15795 // When found, cache indexes on `parent` and break 15796 if ( node.nodeType === 1 && ++diff && node === elem ) { 15797 uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; 15798 break; 15799 } 15800 } 15801 15802 } else { 15803 15804 // Use previously-cached element index if available 15805 if ( useCache ) { 15806 15807 // ...in a gzip-friendly way 15808 node = elem; 15809 outerCache = node[ expando ] || ( node[ expando ] = {} ); 15810 15811 // Support: IE <9 only 15812 // Defend against cloned attroperties (jQuery gh-1709) 15813 uniqueCache = outerCache[ node.uniqueID ] || 15814 ( outerCache[ node.uniqueID ] = {} ); 15815 15816 cache = uniqueCache[ type ] || []; 15817 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 15818 diff = nodeIndex; 15819 } 15820 15821 // xml :nth-child(...) 15822 // or :nth-last-child(...) or :nth(-last)?-of-type(...) 15823 if ( diff === false ) { 15824 15825 // Use the same loop as above to seek `elem` from the start 15826 while ( ( node = ++nodeIndex && node && node[ dir ] || 15827 ( diff = nodeIndex = 0 ) || start.pop() ) ) { 15828 15829 if ( ( ofType ? 15830 node.nodeName.toLowerCase() === name : 15831 node.nodeType === 1 ) && 15832 ++diff ) { 15833 15834 // Cache the index of each encountered element 15835 if ( useCache ) { 15836 outerCache = node[ expando ] || 15837 ( node[ expando ] = {} ); 15838 15839 // Support: IE <9 only 15840 // Defend against cloned attroperties (jQuery gh-1709) 15841 uniqueCache = outerCache[ node.uniqueID ] || 15842 ( outerCache[ node.uniqueID ] = {} ); 15843 15844 uniqueCache[ type ] = [ dirruns, diff ]; 15845 } 15846 15847 if ( node === elem ) { 15848 break; 15849 } 15850 } 15851 } 15852 } 15853 } 15854 15855 // Incorporate the offset, then check against cycle size 15856 diff -= last; 15857 return diff === first || ( diff % first === 0 && diff / first >= 0 ); 15858 } 15859 }; 15860 }, 15861 15862 "PSEUDO": function( pseudo, argument ) { 15863 15864 // pseudo-class names are case-insensitive 15865 // http://www.w3.org/TR/selectors/#pseudo-classes 15866 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters 15867 // Remember that setFilters inherits from pseudos 15868 var args, 15869 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || 15870 Sizzle.error( "unsupported pseudo: " + pseudo ); 15871 15872 // The user may use createPseudo to indicate that 15873 // arguments are needed to create the filter function 15874 // just as Sizzle does 15875 if ( fn[ expando ] ) { 15876 return fn( argument ); 15877 } 15878 15879 // But maintain support for old signatures 15880 if ( fn.length > 1 ) { 15881 args = [ pseudo, pseudo, "", argument ]; 15882 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? 15883 markFunction( function( seed, matches ) { 15884 var idx, 15885 matched = fn( seed, argument ), 15886 i = matched.length; 15887 while ( i-- ) { 15888 idx = indexOf( seed, matched[ i ] ); 15889 seed[ idx ] = !( matches[ idx ] = matched[ i ] ); 15890 } 15891 } ) : 15892 function( elem ) { 15893 return fn( elem, 0, args ); 15894 }; 15895 } 15896 15897 return fn; 15898 } 15899 }, 15900 15901 pseudos: { 15902 15903 // Potentially complex pseudos 15904 "not": markFunction( function( selector ) { 15905 15906 // Trim the selector passed to compile 15907 // to avoid treating leading and trailing 15908 // spaces as combinators 15909 var input = [], 15910 results = [], 15911 matcher = compile( selector.replace( rtrim, "$1" ) ); 15912 15913 return matcher[ expando ] ? 15914 markFunction( function( seed, matches, _context, xml ) { 15915 var elem, 15916 unmatched = matcher( seed, null, xml, [] ), 15917 i = seed.length; 15918 15919 // Match elements unmatched by `matcher` 15920 while ( i-- ) { 15921 if ( ( elem = unmatched[ i ] ) ) { 15922 seed[ i ] = !( matches[ i ] = elem ); 15923 } 15924 } 15925 } ) : 15926 function( elem, _context, xml ) { 15927 input[ 0 ] = elem; 15928 matcher( input, null, xml, results ); 15929 15930 // Don't keep the element (issue #299) 15931 input[ 0 ] = null; 15932 return !results.pop(); 15933 }; 15934 } ), 15935 15936 "has": markFunction( function( selector ) { 15937 return function( elem ) { 15938 return Sizzle( selector, elem ).length > 0; 15939 }; 15940 } ), 15941 15942 "contains": markFunction( function( text ) { 15943 text = text.replace( runescape, funescape ); 15944 return function( elem ) { 15945 return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1; 15946 }; 15947 } ), 15948 15949 // "Whether an element is represented by a :lang() selector 15950 // is based solely on the element's language value 15951 // being equal to the identifier C, 15952 // or beginning with the identifier C immediately followed by "-". 15953 // The matching of C against the element's language value is performed case-insensitively. 15954 // The identifier C does not have to be a valid language name." 15955 // http://www.w3.org/TR/selectors/#lang-pseudo 15956 "lang": markFunction( function( lang ) { 15957 15958 // lang value must be a valid identifier 15959 if ( !ridentifier.test( lang || "" ) ) { 15960 Sizzle.error( "unsupported lang: " + lang ); 15961 } 15962 lang = lang.replace( runescape, funescape ).toLowerCase(); 15963 return function( elem ) { 15964 var elemLang; 15965 do { 15966 if ( ( elemLang = documentIsHTML ? 15967 elem.lang : 15968 elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) { 15969 15970 elemLang = elemLang.toLowerCase(); 15971 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; 15972 } 15973 } while ( ( elem = elem.parentNode ) && elem.nodeType === 1 ); 15974 return false; 15975 }; 15976 } ), 15977 15978 // Miscellaneous 15979 "target": function( elem ) { 15980 var hash = window.location && window.location.hash; 15981 return hash && hash.slice( 1 ) === elem.id; 15982 }, 15983 15984 "root": function( elem ) { 15985 return elem === docElem; 15986 }, 15987 15988 "focus": function( elem ) { 15989 return elem === document.activeElement && 15990 ( !document.hasFocus || document.hasFocus() ) && 15991 !!( elem.type || elem.href || ~elem.tabIndex ); 15992 }, 15993 15994 // Boolean properties 15995 "enabled": createDisabledPseudo( false ), 15996 "disabled": createDisabledPseudo( true ), 15997 15998 "checked": function( elem ) { 15999 16000 // In CSS3, :checked should return both checked and selected elements 16001 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 16002 var nodeName = elem.nodeName.toLowerCase(); 16003 return ( nodeName === "input" && !!elem.checked ) || 16004 ( nodeName === "option" && !!elem.selected ); 16005 }, 16006 16007 "selected": function( elem ) { 16008 16009 // Accessing this property makes selected-by-default 16010 // options in Safari work properly 16011 if ( elem.parentNode ) { 16012 // eslint-disable-next-line no-unused-expressions 16013 elem.parentNode.selectedIndex; 16014 } 16015 16016 return elem.selected === true; 16017 }, 16018 16019 // Contents 16020 "empty": function( elem ) { 16021 16022 // http://www.w3.org/TR/selectors/#empty-pseudo 16023 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), 16024 // but not by others (comment: 8; processing instruction: 7; etc.) 16025 // nodeType < 6 works because attributes (2) do not appear as children 16026 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 16027 if ( elem.nodeType < 6 ) { 16028 return false; 16029 } 16030 } 16031 return true; 16032 }, 16033 16034 "parent": function( elem ) { 16035 return !Expr.pseudos[ "empty" ]( elem ); 16036 }, 16037 16038 // Element/input types 16039 "header": function( elem ) { 16040 return rheader.test( elem.nodeName ); 16041 }, 16042 16043 "input": function( elem ) { 16044 return rinputs.test( elem.nodeName ); 16045 }, 16046 16047 "button": function( elem ) { 16048 var name = elem.nodeName.toLowerCase(); 16049 return name === "input" && elem.type === "button" || name === "button"; 16050 }, 16051 16052 "text": function( elem ) { 16053 var attr; 16054 return elem.nodeName.toLowerCase() === "input" && 16055 elem.type === "text" && 16056 16057 // Support: IE<8 16058 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" 16059 ( ( attr = elem.getAttribute( "type" ) ) == null || 16060 attr.toLowerCase() === "text" ); 16061 }, 16062 16063 // Position-in-collection 16064 "first": createPositionalPseudo( function() { 16065 return [ 0 ]; 16066 } ), 16067 16068 "last": createPositionalPseudo( function( _matchIndexes, length ) { 16069 return [ length - 1 ]; 16070 } ), 16071 16072 "eq": createPositionalPseudo( function( _matchIndexes, length, argument ) { 16073 return [ argument < 0 ? argument + length : argument ]; 16074 } ), 16075 16076 "even": createPositionalPseudo( function( matchIndexes, length ) { 16077 var i = 0; 16078 for ( ; i < length; i += 2 ) { 16079 matchIndexes.push( i ); 16080 } 16081 return matchIndexes; 16082 } ), 16083 16084 "odd": createPositionalPseudo( function( matchIndexes, length ) { 16085 var i = 1; 16086 for ( ; i < length; i += 2 ) { 16087 matchIndexes.push( i ); 16088 } 16089 return matchIndexes; 16090 } ), 16091 16092 "lt": createPositionalPseudo( function( matchIndexes, length, argument ) { 16093 var i = argument < 0 ? 16094 argument + length : 16095 argument > length ? 16096 length : 16097 argument; 16098 for ( ; --i >= 0; ) { 16099 matchIndexes.push( i ); 16100 } 16101 return matchIndexes; 16102 } ), 16103 16104 "gt": createPositionalPseudo( function( matchIndexes, length, argument ) { 16105 var i = argument < 0 ? argument + length : argument; 16106 for ( ; ++i < length; ) { 16107 matchIndexes.push( i ); 16108 } 16109 return matchIndexes; 16110 } ) 16111 } 16112}; 16113 16114Expr.pseudos[ "nth" ] = Expr.pseudos[ "eq" ]; 16115 16116// Add button/input type pseudos 16117for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { 16118 Expr.pseudos[ i ] = createInputPseudo( i ); 16119} 16120for ( i in { submit: true, reset: true } ) { 16121 Expr.pseudos[ i ] = createButtonPseudo( i ); 16122} 16123 16124// Easy API for creating new setFilters 16125function setFilters() {} 16126setFilters.prototype = Expr.filters = Expr.pseudos; 16127Expr.setFilters = new setFilters(); 16128 16129tokenize = Sizzle.tokenize = function( selector, parseOnly ) { 16130 var matched, match, tokens, type, 16131 soFar, groups, preFilters, 16132 cached = tokenCache[ selector + " " ]; 16133 16134 if ( cached ) { 16135 return parseOnly ? 0 : cached.slice( 0 ); 16136 } 16137 16138 soFar = selector; 16139 groups = []; 16140 preFilters = Expr.preFilter; 16141 16142 while ( soFar ) { 16143 16144 // Comma and first run 16145 if ( !matched || ( match = rcomma.exec( soFar ) ) ) { 16146 if ( match ) { 16147 16148 // Don't consume trailing commas as valid 16149 soFar = soFar.slice( match[ 0 ].length ) || soFar; 16150 } 16151 groups.push( ( tokens = [] ) ); 16152 } 16153 16154 matched = false; 16155 16156 // Combinators 16157 if ( ( match = rcombinators.exec( soFar ) ) ) { 16158 matched = match.shift(); 16159 tokens.push( { 16160 value: matched, 16161 16162 // Cast descendant combinators to space 16163 type: match[ 0 ].replace( rtrim, " " ) 16164 } ); 16165 soFar = soFar.slice( matched.length ); 16166 } 16167 16168 // Filters 16169 for ( type in Expr.filter ) { 16170 if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] || 16171 ( match = preFilters[ type ]( match ) ) ) ) { 16172 matched = match.shift(); 16173 tokens.push( { 16174 value: matched, 16175 type: type, 16176 matches: match 16177 } ); 16178 soFar = soFar.slice( matched.length ); 16179 } 16180 } 16181 16182 if ( !matched ) { 16183 break; 16184 } 16185 } 16186 16187 // Return the length of the invalid excess 16188 // if we're just parsing 16189 // Otherwise, throw an error or return tokens 16190 return parseOnly ? 16191 soFar.length : 16192 soFar ? 16193 Sizzle.error( selector ) : 16194 16195 // Cache the tokens 16196 tokenCache( selector, groups ).slice( 0 ); 16197}; 16198 16199function toSelector( tokens ) { 16200 var i = 0, 16201 len = tokens.length, 16202 selector = ""; 16203 for ( ; i < len; i++ ) { 16204 selector += tokens[ i ].value; 16205 } 16206 return selector; 16207} 16208 16209function addCombinator( matcher, combinator, base ) { 16210 var dir = combinator.dir, 16211 skip = combinator.next, 16212 key = skip || dir, 16213 checkNonElements = base && key === "parentNode", 16214 doneName = done++; 16215 16216 return combinator.first ? 16217 16218 // Check against closest ancestor/preceding element 16219 function( elem, context, xml ) { 16220 while ( ( elem = elem[ dir ] ) ) { 16221 if ( elem.nodeType === 1 || checkNonElements ) { 16222 return matcher( elem, context, xml ); 16223 } 16224 } 16225 return false; 16226 } : 16227 16228 // Check against all ancestor/preceding elements 16229 function( elem, context, xml ) { 16230 var oldCache, uniqueCache, outerCache, 16231 newCache = [ dirruns, doneName ]; 16232 16233 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching 16234 if ( xml ) { 16235 while ( ( elem = elem[ dir ] ) ) { 16236 if ( elem.nodeType === 1 || checkNonElements ) { 16237 if ( matcher( elem, context, xml ) ) { 16238 return true; 16239 } 16240 } 16241 } 16242 } else { 16243 while ( ( elem = elem[ dir ] ) ) { 16244 if ( elem.nodeType === 1 || checkNonElements ) { 16245 outerCache = elem[ expando ] || ( elem[ expando ] = {} ); 16246 16247 // Support: IE <9 only 16248 // Defend against cloned attroperties (jQuery gh-1709) 16249 uniqueCache = outerCache[ elem.uniqueID ] || 16250 ( outerCache[ elem.uniqueID ] = {} ); 16251 16252 if ( skip && skip === elem.nodeName.toLowerCase() ) { 16253 elem = elem[ dir ] || elem; 16254 } else if ( ( oldCache = uniqueCache[ key ] ) && 16255 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { 16256 16257 // Assign to newCache so results back-propagate to previous elements 16258 return ( newCache[ 2 ] = oldCache[ 2 ] ); 16259 } else { 16260 16261 // Reuse newcache so results back-propagate to previous elements 16262 uniqueCache[ key ] = newCache; 16263 16264 // A match means we're done; a fail means we have to keep checking 16265 if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) { 16266 return true; 16267 } 16268 } 16269 } 16270 } 16271 } 16272 return false; 16273 }; 16274} 16275 16276function elementMatcher( matchers ) { 16277 return matchers.length > 1 ? 16278 function( elem, context, xml ) { 16279 var i = matchers.length; 16280 while ( i-- ) { 16281 if ( !matchers[ i ]( elem, context, xml ) ) { 16282 return false; 16283 } 16284 } 16285 return true; 16286 } : 16287 matchers[ 0 ]; 16288} 16289 16290function multipleContexts( selector, contexts, results ) { 16291 var i = 0, 16292 len = contexts.length; 16293 for ( ; i < len; i++ ) { 16294 Sizzle( selector, contexts[ i ], results ); 16295 } 16296 return results; 16297} 16298 16299function condense( unmatched, map, filter, context, xml ) { 16300 var elem, 16301 newUnmatched = [], 16302 i = 0, 16303 len = unmatched.length, 16304 mapped = map != null; 16305 16306 for ( ; i < len; i++ ) { 16307 if ( ( elem = unmatched[ i ] ) ) { 16308 if ( !filter || filter( elem, context, xml ) ) { 16309 newUnmatched.push( elem ); 16310 if ( mapped ) { 16311 map.push( i ); 16312 } 16313 } 16314 } 16315 } 16316 16317 return newUnmatched; 16318} 16319 16320function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { 16321 if ( postFilter && !postFilter[ expando ] ) { 16322 postFilter = setMatcher( postFilter ); 16323 } 16324 if ( postFinder && !postFinder[ expando ] ) { 16325 postFinder = setMatcher( postFinder, postSelector ); 16326 } 16327 return markFunction( function( seed, results, context, xml ) { 16328 var temp, i, elem, 16329 preMap = [], 16330 postMap = [], 16331 preexisting = results.length, 16332 16333 // Get initial elements from seed or context 16334 elems = seed || multipleContexts( 16335 selector || "*", 16336 context.nodeType ? [ context ] : context, 16337 [] 16338 ), 16339 16340 // Prefilter to get matcher input, preserving a map for seed-results synchronization 16341 matcherIn = preFilter && ( seed || !selector ) ? 16342 condense( elems, preMap, preFilter, context, xml ) : 16343 elems, 16344 16345 matcherOut = matcher ? 16346 16347 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, 16348 postFinder || ( seed ? preFilter : preexisting || postFilter ) ? 16349 16350 // ...intermediate processing is necessary 16351 [] : 16352 16353 // ...otherwise use results directly 16354 results : 16355 matcherIn; 16356 16357 // Find primary matches 16358 if ( matcher ) { 16359 matcher( matcherIn, matcherOut, context, xml ); 16360 } 16361 16362 // Apply postFilter 16363 if ( postFilter ) { 16364 temp = condense( matcherOut, postMap ); 16365 postFilter( temp, [], context, xml ); 16366 16367 // Un-match failing elements by moving them back to matcherIn 16368 i = temp.length; 16369 while ( i-- ) { 16370 if ( ( elem = temp[ i ] ) ) { 16371 matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem ); 16372 } 16373 } 16374 } 16375 16376 if ( seed ) { 16377 if ( postFinder || preFilter ) { 16378 if ( postFinder ) { 16379 16380 // Get the final matcherOut by condensing this intermediate into postFinder contexts 16381 temp = []; 16382 i = matcherOut.length; 16383 while ( i-- ) { 16384 if ( ( elem = matcherOut[ i ] ) ) { 16385 16386 // Restore matcherIn since elem is not yet a final match 16387 temp.push( ( matcherIn[ i ] = elem ) ); 16388 } 16389 } 16390 postFinder( null, ( matcherOut = [] ), temp, xml ); 16391 } 16392 16393 // Move matched elements from seed to results to keep them synchronized 16394 i = matcherOut.length; 16395 while ( i-- ) { 16396 if ( ( elem = matcherOut[ i ] ) && 16397 ( temp = postFinder ? indexOf( seed, elem ) : preMap[ i ] ) > -1 ) { 16398 16399 seed[ temp ] = !( results[ temp ] = elem ); 16400 } 16401 } 16402 } 16403 16404 // Add elements to results, through postFinder if defined 16405 } else { 16406 matcherOut = condense( 16407 matcherOut === results ? 16408 matcherOut.splice( preexisting, matcherOut.length ) : 16409 matcherOut 16410 ); 16411 if ( postFinder ) { 16412 postFinder( null, results, matcherOut, xml ); 16413 } else { 16414 push.apply( results, matcherOut ); 16415 } 16416 } 16417 } ); 16418} 16419 16420function matcherFromTokens( tokens ) { 16421 var checkContext, matcher, j, 16422 len = tokens.length, 16423 leadingRelative = Expr.relative[ tokens[ 0 ].type ], 16424 implicitRelative = leadingRelative || Expr.relative[ " " ], 16425 i = leadingRelative ? 1 : 0, 16426 16427 // The foundational matcher ensures that elements are reachable from top-level context(s) 16428 matchContext = addCombinator( function( elem ) { 16429 return elem === checkContext; 16430 }, implicitRelative, true ), 16431 matchAnyContext = addCombinator( function( elem ) { 16432 return indexOf( checkContext, elem ) > -1; 16433 }, implicitRelative, true ), 16434 matchers = [ function( elem, context, xml ) { 16435 var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( 16436 ( checkContext = context ).nodeType ? 16437 matchContext( elem, context, xml ) : 16438 matchAnyContext( elem, context, xml ) ); 16439 16440 // Avoid hanging onto element (issue #299) 16441 checkContext = null; 16442 return ret; 16443 } ]; 16444 16445 for ( ; i < len; i++ ) { 16446 if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) { 16447 matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ]; 16448 } else { 16449 matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches ); 16450 16451 // Return special upon seeing a positional matcher 16452 if ( matcher[ expando ] ) { 16453 16454 // Find the next relative operator (if any) for proper handling 16455 j = ++i; 16456 for ( ; j < len; j++ ) { 16457 if ( Expr.relative[ tokens[ j ].type ] ) { 16458 break; 16459 } 16460 } 16461 return setMatcher( 16462 i > 1 && elementMatcher( matchers ), 16463 i > 1 && toSelector( 16464 16465 // If the preceding token was a descendant combinator, insert an implicit any-element `*` 16466 tokens 16467 .slice( 0, i - 1 ) 16468 .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } ) 16469 ).replace( rtrim, "$1" ), 16470 matcher, 16471 i < j && matcherFromTokens( tokens.slice( i, j ) ), 16472 j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ), 16473 j < len && toSelector( tokens ) 16474 ); 16475 } 16476 matchers.push( matcher ); 16477 } 16478 } 16479 16480 return elementMatcher( matchers ); 16481} 16482 16483function matcherFromGroupMatchers( elementMatchers, setMatchers ) { 16484 var bySet = setMatchers.length > 0, 16485 byElement = elementMatchers.length > 0, 16486 superMatcher = function( seed, context, xml, results, outermost ) { 16487 var elem, j, matcher, 16488 matchedCount = 0, 16489 i = "0", 16490 unmatched = seed && [], 16491 setMatched = [], 16492 contextBackup = outermostContext, 16493 16494 // We must always have either seed elements or outermost context 16495 elems = seed || byElement && Expr.find[ "TAG" ]( "*", outermost ), 16496 16497 // Use integer dirruns iff this is the outermost matcher 16498 dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ), 16499 len = elems.length; 16500 16501 if ( outermost ) { 16502 16503 // Support: IE 11+, Edge 17 - 18+ 16504 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 16505 // two documents; shallow comparisons work. 16506 // eslint-disable-next-line eqeqeq 16507 outermostContext = context == document || context || outermost; 16508 } 16509 16510 // Add elements passing elementMatchers directly to results 16511 // Support: IE<9, Safari 16512 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id 16513 for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) { 16514 if ( byElement && elem ) { 16515 j = 0; 16516 16517 // Support: IE 11+, Edge 17 - 18+ 16518 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 16519 // two documents; shallow comparisons work. 16520 // eslint-disable-next-line eqeqeq 16521 if ( !context && elem.ownerDocument != document ) { 16522 setDocument( elem ); 16523 xml = !documentIsHTML; 16524 } 16525 while ( ( matcher = elementMatchers[ j++ ] ) ) { 16526 if ( matcher( elem, context || document, xml ) ) { 16527 results.push( elem ); 16528 break; 16529 } 16530 } 16531 if ( outermost ) { 16532 dirruns = dirrunsUnique; 16533 } 16534 } 16535 16536 // Track unmatched elements for set filters 16537 if ( bySet ) { 16538 16539 // They will have gone through all possible matchers 16540 if ( ( elem = !matcher && elem ) ) { 16541 matchedCount--; 16542 } 16543 16544 // Lengthen the array for every element, matched or not 16545 if ( seed ) { 16546 unmatched.push( elem ); 16547 } 16548 } 16549 } 16550 16551 // `i` is now the count of elements visited above, and adding it to `matchedCount` 16552 // makes the latter nonnegative. 16553 matchedCount += i; 16554 16555 // Apply set filters to unmatched elements 16556 // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` 16557 // equals `i`), unless we didn't visit _any_ elements in the above loop because we have 16558 // no element matchers and no seed. 16559 // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that 16560 // case, which will result in a "00" `matchedCount` that differs from `i` but is also 16561 // numerically zero. 16562 if ( bySet && i !== matchedCount ) { 16563 j = 0; 16564 while ( ( matcher = setMatchers[ j++ ] ) ) { 16565 matcher( unmatched, setMatched, context, xml ); 16566 } 16567 16568 if ( seed ) { 16569 16570 // Reintegrate element matches to eliminate the need for sorting 16571 if ( matchedCount > 0 ) { 16572 while ( i-- ) { 16573 if ( !( unmatched[ i ] || setMatched[ i ] ) ) { 16574 setMatched[ i ] = pop.call( results ); 16575 } 16576 } 16577 } 16578 16579 // Discard index placeholder values to get only actual matches 16580 setMatched = condense( setMatched ); 16581 } 16582 16583 // Add matches to results 16584 push.apply( results, setMatched ); 16585 16586 // Seedless set matches succeeding multiple successful matchers stipulate sorting 16587 if ( outermost && !seed && setMatched.length > 0 && 16588 ( matchedCount + setMatchers.length ) > 1 ) { 16589 16590 Sizzle.uniqueSort( results ); 16591 } 16592 } 16593 16594 // Override manipulation of globals by nested matchers 16595 if ( outermost ) { 16596 dirruns = dirrunsUnique; 16597 outermostContext = contextBackup; 16598 } 16599 16600 return unmatched; 16601 }; 16602 16603 return bySet ? 16604 markFunction( superMatcher ) : 16605 superMatcher; 16606} 16607 16608compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { 16609 var i, 16610 setMatchers = [], 16611 elementMatchers = [], 16612 cached = compilerCache[ selector + " " ]; 16613 16614 if ( !cached ) { 16615 16616 // Generate a function of recursive functions that can be used to check each element 16617 if ( !match ) { 16618 match = tokenize( selector ); 16619 } 16620 i = match.length; 16621 while ( i-- ) { 16622 cached = matcherFromTokens( match[ i ] ); 16623 if ( cached[ expando ] ) { 16624 setMatchers.push( cached ); 16625 } else { 16626 elementMatchers.push( cached ); 16627 } 16628 } 16629 16630 // Cache the compiled function 16631 cached = compilerCache( 16632 selector, 16633 matcherFromGroupMatchers( elementMatchers, setMatchers ) 16634 ); 16635 16636 // Save selector and tokenization 16637 cached.selector = selector; 16638 } 16639 return cached; 16640}; 16641 16642/** 16643 * A low-level selection function that works with Sizzle's compiled 16644 * selector functions 16645 * @param {String|Function} selector A selector or a pre-compiled 16646 * selector function built with Sizzle.compile 16647 * @param {Element} context 16648 * @param {Array} [results] 16649 * @param {Array} [seed] A set of elements to match against 16650 */ 16651select = Sizzle.select = function( selector, context, results, seed ) { 16652 var i, tokens, token, type, find, 16653 compiled = typeof selector === "function" && selector, 16654 match = !seed && tokenize( ( selector = compiled.selector || selector ) ); 16655 16656 results = results || []; 16657 16658 // Try to minimize operations if there is only one selector in the list and no seed 16659 // (the latter of which guarantees us context) 16660 if ( match.length === 1 ) { 16661 16662 // Reduce context if the leading compound selector is an ID 16663 tokens = match[ 0 ] = match[ 0 ].slice( 0 ); 16664 if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" && 16665 context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) { 16666 16667 context = ( Expr.find[ "ID" ]( token.matches[ 0 ] 16668 .replace( runescape, funescape ), context ) || [] )[ 0 ]; 16669 if ( !context ) { 16670 return results; 16671 16672 // Precompiled matchers will still verify ancestry, so step up a level 16673 } else if ( compiled ) { 16674 context = context.parentNode; 16675 } 16676 16677 selector = selector.slice( tokens.shift().value.length ); 16678 } 16679 16680 // Fetch a seed set for right-to-left matching 16681 i = matchExpr[ "needsContext" ].test( selector ) ? 0 : tokens.length; 16682 while ( i-- ) { 16683 token = tokens[ i ]; 16684 16685 // Abort if we hit a combinator 16686 if ( Expr.relative[ ( type = token.type ) ] ) { 16687 break; 16688 } 16689 if ( ( find = Expr.find[ type ] ) ) { 16690 16691 // Search, expanding context for leading sibling combinators 16692 if ( ( seed = find( 16693 token.matches[ 0 ].replace( runescape, funescape ), 16694 rsibling.test( tokens[ 0 ].type ) && testContext( context.parentNode ) || 16695 context 16696 ) ) ) { 16697 16698 // If seed is empty or no tokens remain, we can return early 16699 tokens.splice( i, 1 ); 16700 selector = seed.length && toSelector( tokens ); 16701 if ( !selector ) { 16702 push.apply( results, seed ); 16703 return results; 16704 } 16705 16706 break; 16707 } 16708 } 16709 } 16710 } 16711 16712 // Compile and execute a filtering function if one is not provided 16713 // Provide `match` to avoid retokenization if we modified the selector above 16714 ( compiled || compile( selector, match ) )( 16715 seed, 16716 context, 16717 !documentIsHTML, 16718 results, 16719 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context 16720 ); 16721 return results; 16722}; 16723 16724// One-time assignments 16725 16726// Sort stability 16727support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando; 16728 16729// Support: Chrome 14-35+ 16730// Always assume duplicates if they aren't passed to the comparison function 16731support.detectDuplicates = !!hasDuplicate; 16732 16733// Initialize against the default document 16734setDocument(); 16735 16736// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) 16737// Detached nodes confoundingly follow *each other* 16738support.sortDetached = assert( function( el ) { 16739 16740 // Should return 1, but returns 4 (following) 16741 return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1; 16742} ); 16743 16744// Support: IE<8 16745// Prevent attribute/property "interpolation" 16746// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx 16747if ( !assert( function( el ) { 16748 el.innerHTML = "<a href='#'></a>"; 16749 return el.firstChild.getAttribute( "href" ) === "#"; 16750} ) ) { 16751 addHandle( "type|href|height|width", function( elem, name, isXML ) { 16752 if ( !isXML ) { 16753 return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); 16754 } 16755 } ); 16756} 16757 16758// Support: IE<9 16759// Use defaultValue in place of getAttribute("value") 16760if ( !support.attributes || !assert( function( el ) { 16761 el.innerHTML = "<input/>"; 16762 el.firstChild.setAttribute( "value", "" ); 16763 return el.firstChild.getAttribute( "value" ) === ""; 16764} ) ) { 16765 addHandle( "value", function( elem, _name, isXML ) { 16766 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { 16767 return elem.defaultValue; 16768 } 16769 } ); 16770} 16771 16772// Support: IE<9 16773// Use getAttributeNode to fetch booleans when getAttribute lies 16774if ( !assert( function( el ) { 16775 return el.getAttribute( "disabled" ) == null; 16776} ) ) { 16777 addHandle( booleans, function( elem, name, isXML ) { 16778 var val; 16779 if ( !isXML ) { 16780 return elem[ name ] === true ? name.toLowerCase() : 16781 ( val = elem.getAttributeNode( name ) ) && val.specified ? 16782 val.value : 16783 null; 16784 } 16785 } ); 16786} 16787 16788return Sizzle; 16789 16790} )( window ); 16791 16792 16793 16794jQuery.find = Sizzle; 16795jQuery.expr = Sizzle.selectors; 16796 16797// Deprecated 16798jQuery.expr[ ":" ] = jQuery.expr.pseudos; 16799jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; 16800jQuery.text = Sizzle.getText; 16801jQuery.isXMLDoc = Sizzle.isXML; 16802jQuery.contains = Sizzle.contains; 16803jQuery.escapeSelector = Sizzle.escape; 16804 16805 16806 16807 16808var dir = function( elem, dir, until ) { 16809 var matched = [], 16810 truncate = until !== undefined; 16811 16812 while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { 16813 if ( elem.nodeType === 1 ) { 16814 if ( truncate && jQuery( elem ).is( until ) ) { 16815 break; 16816 } 16817 matched.push( elem ); 16818 } 16819 } 16820 return matched; 16821}; 16822 16823 16824var siblings = function( n, elem ) { 16825 var matched = []; 16826 16827 for ( ; n; n = n.nextSibling ) { 16828 if ( n.nodeType === 1 && n !== elem ) { 16829 matched.push( n ); 16830 } 16831 } 16832 16833 return matched; 16834}; 16835 16836 16837var rneedsContext = jQuery.expr.match.needsContext; 16838 16839 16840 16841function nodeName( elem, name ) { 16842 16843 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); 16844 16845} 16846var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); 16847 16848 16849 16850// Implement the identical functionality for filter and not 16851function winnow( elements, qualifier, not ) { 16852 if ( isFunction( qualifier ) ) { 16853 return jQuery.grep( elements, function( elem, i ) { 16854 return !!qualifier.call( elem, i, elem ) !== not; 16855 } ); 16856 } 16857 16858 // Single element 16859 if ( qualifier.nodeType ) { 16860 return jQuery.grep( elements, function( elem ) { 16861 return ( elem === qualifier ) !== not; 16862 } ); 16863 } 16864 16865 // Arraylike of elements (jQuery, arguments, Array) 16866 if ( typeof qualifier !== "string" ) { 16867 return jQuery.grep( elements, function( elem ) { 16868 return ( indexOf.call( qualifier, elem ) > -1 ) !== not; 16869 } ); 16870 } 16871 16872 // Filtered directly for both simple and complex selectors 16873 return jQuery.filter( qualifier, elements, not ); 16874} 16875 16876jQuery.filter = function( expr, elems, not ) { 16877 var elem = elems[ 0 ]; 16878 16879 if ( not ) { 16880 expr = ":not(" + expr + ")"; 16881 } 16882 16883 if ( elems.length === 1 && elem.nodeType === 1 ) { 16884 return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; 16885 } 16886 16887 return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { 16888 return elem.nodeType === 1; 16889 } ) ); 16890}; 16891 16892jQuery.fn.extend( { 16893 find: function( selector ) { 16894 var i, ret, 16895 len = this.length, 16896 self = this; 16897 16898 if ( typeof selector !== "string" ) { 16899 return this.pushStack( jQuery( selector ).filter( function() { 16900 for ( i = 0; i < len; i++ ) { 16901 if ( jQuery.contains( self[ i ], this ) ) { 16902 return true; 16903 } 16904 } 16905 } ) ); 16906 } 16907 16908 ret = this.pushStack( [] ); 16909 16910 for ( i = 0; i < len; i++ ) { 16911 jQuery.find( selector, self[ i ], ret ); 16912 } 16913 16914 return len > 1 ? jQuery.uniqueSort( ret ) : ret; 16915 }, 16916 filter: function( selector ) { 16917 return this.pushStack( winnow( this, selector || [], false ) ); 16918 }, 16919 not: function( selector ) { 16920 return this.pushStack( winnow( this, selector || [], true ) ); 16921 }, 16922 is: function( selector ) { 16923 return !!winnow( 16924 this, 16925 16926 // If this is a positional/relative selector, check membership in the returned set 16927 // so $("p:first").is("p:last") won't return true for a doc with two "p". 16928 typeof selector === "string" && rneedsContext.test( selector ) ? 16929 jQuery( selector ) : 16930 selector || [], 16931 false 16932 ).length; 16933 } 16934} ); 16935 16936 16937// Initialize a jQuery object 16938 16939 16940// A central reference to the root jQuery(document) 16941var rootjQuery, 16942 16943 // A simple way to check for HTML strings 16944 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) 16945 // Strict HTML recognition (#11290: must start with <) 16946 // Shortcut simple #id case for speed 16947 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, 16948 16949 init = jQuery.fn.init = function( selector, context, root ) { 16950 var match, elem; 16951 16952 // HANDLE: $(""), $(null), $(undefined), $(false) 16953 if ( !selector ) { 16954 return this; 16955 } 16956 16957 // Method init() accepts an alternate rootjQuery 16958 // so migrate can support jQuery.sub (gh-2101) 16959 root = root || rootjQuery; 16960 16961 // Handle HTML strings 16962 if ( typeof selector === "string" ) { 16963 if ( selector[ 0 ] === "<" && 16964 selector[ selector.length - 1 ] === ">" && 16965 selector.length >= 3 ) { 16966 16967 // Assume that strings that start and end with <> are HTML and skip the regex check 16968 match = [ null, selector, null ]; 16969 16970 } else { 16971 match = rquickExpr.exec( selector ); 16972 } 16973 16974 // Match html or make sure no context is specified for #id 16975 if ( match && ( match[ 1 ] || !context ) ) { 16976 16977 // HANDLE: $(html) -> $(array) 16978 if ( match[ 1 ] ) { 16979 context = context instanceof jQuery ? context[ 0 ] : context; 16980 16981 // Option to run scripts is true for back-compat 16982 // Intentionally let the error be thrown if parseHTML is not present 16983 jQuery.merge( this, jQuery.parseHTML( 16984 match[ 1 ], 16985 context && context.nodeType ? context.ownerDocument || context : document, 16986 true 16987 ) ); 16988 16989 // HANDLE: $(html, props) 16990 if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { 16991 for ( match in context ) { 16992 16993 // Properties of context are called as methods if possible 16994 if ( isFunction( this[ match ] ) ) { 16995 this[ match ]( context[ match ] ); 16996 16997 // ...and otherwise set as attributes 16998 } else { 16999 this.attr( match, context[ match ] ); 17000 } 17001 } 17002 } 17003 17004 return this; 17005 17006 // HANDLE: $(#id) 17007 } else { 17008 elem = document.getElementById( match[ 2 ] ); 17009 17010 if ( elem ) { 17011 17012 // Inject the element directly into the jQuery object 17013 this[ 0 ] = elem; 17014 this.length = 1; 17015 } 17016 return this; 17017 } 17018 17019 // HANDLE: $(expr, $(...)) 17020 } else if ( !context || context.jquery ) { 17021 return ( context || root ).find( selector ); 17022 17023 // HANDLE: $(expr, context) 17024 // (which is just equivalent to: $(context).find(expr) 17025 } else { 17026 return this.constructor( context ).find( selector ); 17027 } 17028 17029 // HANDLE: $(DOMElement) 17030 } else if ( selector.nodeType ) { 17031 this[ 0 ] = selector; 17032 this.length = 1; 17033 return this; 17034 17035 // HANDLE: $(function) 17036 // Shortcut for document ready 17037 } else if ( isFunction( selector ) ) { 17038 return root.ready !== undefined ? 17039 root.ready( selector ) : 17040 17041 // Execute immediately if ready is not present 17042 selector( jQuery ); 17043 } 17044 17045 return jQuery.makeArray( selector, this ); 17046 }; 17047 17048// Give the init function the jQuery prototype for later instantiation 17049init.prototype = jQuery.fn; 17050 17051// Initialize central reference 17052rootjQuery = jQuery( document ); 17053 17054 17055var rparentsprev = /^(?:parents|prev(?:Until|All))/, 17056 17057 // Methods guaranteed to produce a unique set when starting from a unique set 17058 guaranteedUnique = { 17059 children: true, 17060 contents: true, 17061 next: true, 17062 prev: true 17063 }; 17064 17065jQuery.fn.extend( { 17066 has: function( target ) { 17067 var targets = jQuery( target, this ), 17068 l = targets.length; 17069 17070 return this.filter( function() { 17071 var i = 0; 17072 for ( ; i < l; i++ ) { 17073 if ( jQuery.contains( this, targets[ i ] ) ) { 17074 return true; 17075 } 17076 } 17077 } ); 17078 }, 17079 17080 closest: function( selectors, context ) { 17081 var cur, 17082 i = 0, 17083 l = this.length, 17084 matched = [], 17085 targets = typeof selectors !== "string" && jQuery( selectors ); 17086 17087 // Positional selectors never match, since there's no _selection_ context 17088 if ( !rneedsContext.test( selectors ) ) { 17089 for ( ; i < l; i++ ) { 17090 for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { 17091 17092 // Always skip document fragments 17093 if ( cur.nodeType < 11 && ( targets ? 17094 targets.index( cur ) > -1 : 17095 17096 // Don't pass non-elements to Sizzle 17097 cur.nodeType === 1 && 17098 jQuery.find.matchesSelector( cur, selectors ) ) ) { 17099 17100 matched.push( cur ); 17101 break; 17102 } 17103 } 17104 } 17105 } 17106 17107 return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); 17108 }, 17109 17110 // Determine the position of an element within the set 17111 index: function( elem ) { 17112 17113 // No argument, return index in parent 17114 if ( !elem ) { 17115 return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; 17116 } 17117 17118 // Index in selector 17119 if ( typeof elem === "string" ) { 17120 return indexOf.call( jQuery( elem ), this[ 0 ] ); 17121 } 17122 17123 // Locate the position of the desired element 17124 return indexOf.call( this, 17125 17126 // If it receives a jQuery object, the first element is used 17127 elem.jquery ? elem[ 0 ] : elem 17128 ); 17129 }, 17130 17131 add: function( selector, context ) { 17132 return this.pushStack( 17133 jQuery.uniqueSort( 17134 jQuery.merge( this.get(), jQuery( selector, context ) ) 17135 ) 17136 ); 17137 }, 17138 17139 addBack: function( selector ) { 17140 return this.add( selector == null ? 17141 this.prevObject : this.prevObject.filter( selector ) 17142 ); 17143 } 17144} ); 17145 17146function sibling( cur, dir ) { 17147 while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} 17148 return cur; 17149} 17150 17151jQuery.each( { 17152 parent: function( elem ) { 17153 var parent = elem.parentNode; 17154 return parent && parent.nodeType !== 11 ? parent : null; 17155 }, 17156 parents: function( elem ) { 17157 return dir( elem, "parentNode" ); 17158 }, 17159 parentsUntil: function( elem, _i, until ) { 17160 return dir( elem, "parentNode", until ); 17161 }, 17162 next: function( elem ) { 17163 return sibling( elem, "nextSibling" ); 17164 }, 17165 prev: function( elem ) { 17166 return sibling( elem, "previousSibling" ); 17167 }, 17168 nextAll: function( elem ) { 17169 return dir( elem, "nextSibling" ); 17170 }, 17171 prevAll: function( elem ) { 17172 return dir( elem, "previousSibling" ); 17173 }, 17174 nextUntil: function( elem, _i, until ) { 17175 return dir( elem, "nextSibling", until ); 17176 }, 17177 prevUntil: function( elem, _i, until ) { 17178 return dir( elem, "previousSibling", until ); 17179 }, 17180 siblings: function( elem ) { 17181 return siblings( ( elem.parentNode || {} ).firstChild, elem ); 17182 }, 17183 children: function( elem ) { 17184 return siblings( elem.firstChild ); 17185 }, 17186 contents: function( elem ) { 17187 if ( elem.contentDocument != null && 17188 17189 // Support: IE 11+ 17190 // <object> elements with no `data` attribute has an object 17191 // `contentDocument` with a `null` prototype. 17192 getProto( elem.contentDocument ) ) { 17193 17194 return elem.contentDocument; 17195 } 17196 17197 // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only 17198 // Treat the template element as a regular one in browsers that 17199 // don't support it. 17200 if ( nodeName( elem, "template" ) ) { 17201 elem = elem.content || elem; 17202 } 17203 17204 return jQuery.merge( [], elem.childNodes ); 17205 } 17206}, function( name, fn ) { 17207 jQuery.fn[ name ] = function( until, selector ) { 17208 var matched = jQuery.map( this, fn, until ); 17209 17210 if ( name.slice( -5 ) !== "Until" ) { 17211 selector = until; 17212 } 17213 17214 if ( selector && typeof selector === "string" ) { 17215 matched = jQuery.filter( selector, matched ); 17216 } 17217 17218 if ( this.length > 1 ) { 17219 17220 // Remove duplicates 17221 if ( !guaranteedUnique[ name ] ) { 17222 jQuery.uniqueSort( matched ); 17223 } 17224 17225 // Reverse order for parents* and prev-derivatives 17226 if ( rparentsprev.test( name ) ) { 17227 matched.reverse(); 17228 } 17229 } 17230 17231 return this.pushStack( matched ); 17232 }; 17233} ); 17234var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g ); 17235 17236 17237 17238// Convert String-formatted options into Object-formatted ones 17239function createOptions( options ) { 17240 var object = {}; 17241 jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { 17242 object[ flag ] = true; 17243 } ); 17244 return object; 17245} 17246 17247/* 17248 * Create a callback list using the following parameters: 17249 * 17250 * options: an optional list of space-separated options that will change how 17251 * the callback list behaves or a more traditional option object 17252 * 17253 * By default a callback list will act like an event callback list and can be 17254 * "fired" multiple times. 17255 * 17256 * Possible options: 17257 * 17258 * once: will ensure the callback list can only be fired once (like a Deferred) 17259 * 17260 * memory: will keep track of previous values and will call any callback added 17261 * after the list has been fired right away with the latest "memorized" 17262 * values (like a Deferred) 17263 * 17264 * unique: will ensure a callback can only be added once (no duplicate in the list) 17265 * 17266 * stopOnFalse: interrupt callings when a callback returns false 17267 * 17268 */ 17269jQuery.Callbacks = function( options ) { 17270 17271 // Convert options from String-formatted to Object-formatted if needed 17272 // (we check in cache first) 17273 options = typeof options === "string" ? 17274 createOptions( options ) : 17275 jQuery.extend( {}, options ); 17276 17277 var // Flag to know if list is currently firing 17278 firing, 17279 17280 // Last fire value for non-forgettable lists 17281 memory, 17282 17283 // Flag to know if list was already fired 17284 fired, 17285 17286 // Flag to prevent firing 17287 locked, 17288 17289 // Actual callback list 17290 list = [], 17291 17292 // Queue of execution data for repeatable lists 17293 queue = [], 17294 17295 // Index of currently firing callback (modified by add/remove as needed) 17296 firingIndex = -1, 17297 17298 // Fire callbacks 17299 fire = function() { 17300 17301 // Enforce single-firing 17302 locked = locked || options.once; 17303 17304 // Execute callbacks for all pending executions, 17305 // respecting firingIndex overrides and runtime changes 17306 fired = firing = true; 17307 for ( ; queue.length; firingIndex = -1 ) { 17308 memory = queue.shift(); 17309 while ( ++firingIndex < list.length ) { 17310 17311 // Run callback and check for early termination 17312 if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && 17313 options.stopOnFalse ) { 17314 17315 // Jump to end and forget the data so .add doesn't re-fire 17316 firingIndex = list.length; 17317 memory = false; 17318 } 17319 } 17320 } 17321 17322 // Forget the data if we're done with it 17323 if ( !options.memory ) { 17324 memory = false; 17325 } 17326 17327 firing = false; 17328 17329 // Clean up if we're done firing for good 17330 if ( locked ) { 17331 17332 // Keep an empty list if we have data for future add calls 17333 if ( memory ) { 17334 list = []; 17335 17336 // Otherwise, this object is spent 17337 } else { 17338 list = ""; 17339 } 17340 } 17341 }, 17342 17343 // Actual Callbacks object 17344 self = { 17345 17346 // Add a callback or a collection of callbacks to the list 17347 add: function() { 17348 if ( list ) { 17349 17350 // If we have memory from a past run, we should fire after adding 17351 if ( memory && !firing ) { 17352 firingIndex = list.length - 1; 17353 queue.push( memory ); 17354 } 17355 17356 ( function add( args ) { 17357 jQuery.each( args, function( _, arg ) { 17358 if ( isFunction( arg ) ) { 17359 if ( !options.unique || !self.has( arg ) ) { 17360 list.push( arg ); 17361 } 17362 } else if ( arg && arg.length && toType( arg ) !== "string" ) { 17363 17364 // Inspect recursively 17365 add( arg ); 17366 } 17367 } ); 17368 } )( arguments ); 17369 17370 if ( memory && !firing ) { 17371 fire(); 17372 } 17373 } 17374 return this; 17375 }, 17376 17377 // Remove a callback from the list 17378 remove: function() { 17379 jQuery.each( arguments, function( _, arg ) { 17380 var index; 17381 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { 17382 list.splice( index, 1 ); 17383 17384 // Handle firing indexes 17385 if ( index <= firingIndex ) { 17386 firingIndex--; 17387 } 17388 } 17389 } ); 17390 return this; 17391 }, 17392 17393 // Check if a given callback is in the list. 17394 // If no argument is given, return whether or not list has callbacks attached. 17395 has: function( fn ) { 17396 return fn ? 17397 jQuery.inArray( fn, list ) > -1 : 17398 list.length > 0; 17399 }, 17400 17401 // Remove all callbacks from the list 17402 empty: function() { 17403 if ( list ) { 17404 list = []; 17405 } 17406 return this; 17407 }, 17408 17409 // Disable .fire and .add 17410 // Abort any current/pending executions 17411 // Clear all callbacks and values 17412 disable: function() { 17413 locked = queue = []; 17414 list = memory = ""; 17415 return this; 17416 }, 17417 disabled: function() { 17418 return !list; 17419 }, 17420 17421 // Disable .fire 17422 // Also disable .add unless we have memory (since it would have no effect) 17423 // Abort any pending executions 17424 lock: function() { 17425 locked = queue = []; 17426 if ( !memory && !firing ) { 17427 list = memory = ""; 17428 } 17429 return this; 17430 }, 17431 locked: function() { 17432 return !!locked; 17433 }, 17434 17435 // Call all callbacks with the given context and arguments 17436 fireWith: function( context, args ) { 17437 if ( !locked ) { 17438 args = args || []; 17439 args = [ context, args.slice ? args.slice() : args ]; 17440 queue.push( args ); 17441 if ( !firing ) { 17442 fire(); 17443 } 17444 } 17445 return this; 17446 }, 17447 17448 // Call all the callbacks with the given arguments 17449 fire: function() { 17450 self.fireWith( this, arguments ); 17451 return this; 17452 }, 17453 17454 // To know if the callbacks have already been called at least once 17455 fired: function() { 17456 return !!fired; 17457 } 17458 }; 17459 17460 return self; 17461}; 17462 17463 17464function Identity( v ) { 17465 return v; 17466} 17467function Thrower( ex ) { 17468 throw ex; 17469} 17470 17471function adoptValue( value, resolve, reject, noValue ) { 17472 var method; 17473 17474 try { 17475 17476 // Check for promise aspect first to privilege synchronous behavior 17477 if ( value && isFunction( ( method = value.promise ) ) ) { 17478 method.call( value ).done( resolve ).fail( reject ); 17479 17480 // Other thenables 17481 } else if ( value && isFunction( ( method = value.then ) ) ) { 17482 method.call( value, resolve, reject ); 17483 17484 // Other non-thenables 17485 } else { 17486 17487 // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: 17488 // * false: [ value ].slice( 0 ) => resolve( value ) 17489 // * true: [ value ].slice( 1 ) => resolve() 17490 resolve.apply( undefined, [ value ].slice( noValue ) ); 17491 } 17492 17493 // For Promises/A+, convert exceptions into rejections 17494 // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in 17495 // Deferred#then to conditionally suppress rejection. 17496 } catch ( value ) { 17497 17498 // Support: Android 4.0 only 17499 // Strict mode functions invoked without .call/.apply get global-object context 17500 reject.apply( undefined, [ value ] ); 17501 } 17502} 17503 17504jQuery.extend( { 17505 17506 Deferred: function( func ) { 17507 var tuples = [ 17508 17509 // action, add listener, callbacks, 17510 // ... .then handlers, argument index, [final state] 17511 [ "notify", "progress", jQuery.Callbacks( "memory" ), 17512 jQuery.Callbacks( "memory" ), 2 ], 17513 [ "resolve", "done", jQuery.Callbacks( "once memory" ), 17514 jQuery.Callbacks( "once memory" ), 0, "resolved" ], 17515 [ "reject", "fail", jQuery.Callbacks( "once memory" ), 17516 jQuery.Callbacks( "once memory" ), 1, "rejected" ] 17517 ], 17518 state = "pending", 17519 promise = { 17520 state: function() { 17521 return state; 17522 }, 17523 always: function() { 17524 deferred.done( arguments ).fail( arguments ); 17525 return this; 17526 }, 17527 "catch": function( fn ) { 17528 return promise.then( null, fn ); 17529 }, 17530 17531 // Keep pipe for back-compat 17532 pipe: function( /* fnDone, fnFail, fnProgress */ ) { 17533 var fns = arguments; 17534 17535 return jQuery.Deferred( function( newDefer ) { 17536 jQuery.each( tuples, function( _i, tuple ) { 17537 17538 // Map tuples (progress, done, fail) to arguments (done, fail, progress) 17539 var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; 17540 17541 // deferred.progress(function() { bind to newDefer or newDefer.notify }) 17542 // deferred.done(function() { bind to newDefer or newDefer.resolve }) 17543 // deferred.fail(function() { bind to newDefer or newDefer.reject }) 17544 deferred[ tuple[ 1 ] ]( function() { 17545 var returned = fn && fn.apply( this, arguments ); 17546 if ( returned && isFunction( returned.promise ) ) { 17547 returned.promise() 17548 .progress( newDefer.notify ) 17549 .done( newDefer.resolve ) 17550 .fail( newDefer.reject ); 17551 } else { 17552 newDefer[ tuple[ 0 ] + "With" ]( 17553 this, 17554 fn ? [ returned ] : arguments 17555 ); 17556 } 17557 } ); 17558 } ); 17559 fns = null; 17560 } ).promise(); 17561 }, 17562 then: function( onFulfilled, onRejected, onProgress ) { 17563 var maxDepth = 0; 17564 function resolve( depth, deferred, handler, special ) { 17565 return function() { 17566 var that = this, 17567 args = arguments, 17568 mightThrow = function() { 17569 var returned, then; 17570 17571 // Support: Promises/A+ section 2.3.3.3.3 17572 // https://promisesaplus.com/#point-59 17573 // Ignore double-resolution attempts 17574 if ( depth < maxDepth ) { 17575 return; 17576 } 17577 17578 returned = handler.apply( that, args ); 17579 17580 // Support: Promises/A+ section 2.3.1 17581 // https://promisesaplus.com/#point-48 17582 if ( returned === deferred.promise() ) { 17583 throw new TypeError( "Thenable self-resolution" ); 17584 } 17585 17586 // Support: Promises/A+ sections 2.3.3.1, 3.5 17587 // https://promisesaplus.com/#point-54 17588 // https://promisesaplus.com/#point-75 17589 // Retrieve `then` only once 17590 then = returned && 17591 17592 // Support: Promises/A+ section 2.3.4 17593 // https://promisesaplus.com/#point-64 17594 // Only check objects and functions for thenability 17595 ( typeof returned === "object" || 17596 typeof returned === "function" ) && 17597 returned.then; 17598 17599 // Handle a returned thenable 17600 if ( isFunction( then ) ) { 17601 17602 // Special processors (notify) just wait for resolution 17603 if ( special ) { 17604 then.call( 17605 returned, 17606 resolve( maxDepth, deferred, Identity, special ), 17607 resolve( maxDepth, deferred, Thrower, special ) 17608 ); 17609 17610 // Normal processors (resolve) also hook into progress 17611 } else { 17612 17613 // ...and disregard older resolution values 17614 maxDepth++; 17615 17616 then.call( 17617 returned, 17618 resolve( maxDepth, deferred, Identity, special ), 17619 resolve( maxDepth, deferred, Thrower, special ), 17620 resolve( maxDepth, deferred, Identity, 17621 deferred.notifyWith ) 17622 ); 17623 } 17624 17625 // Handle all other returned values 17626 } else { 17627 17628 // Only substitute handlers pass on context 17629 // and multiple values (non-spec behavior) 17630 if ( handler !== Identity ) { 17631 that = undefined; 17632 args = [ returned ]; 17633 } 17634 17635 // Process the value(s) 17636 // Default process is resolve 17637 ( special || deferred.resolveWith )( that, args ); 17638 } 17639 }, 17640 17641 // Only normal processors (resolve) catch and reject exceptions 17642 process = special ? 17643 mightThrow : 17644 function() { 17645 try { 17646 mightThrow(); 17647 } catch ( e ) { 17648 17649 if ( jQuery.Deferred.exceptionHook ) { 17650 jQuery.Deferred.exceptionHook( e, 17651 process.stackTrace ); 17652 } 17653 17654 // Support: Promises/A+ section 2.3.3.3.4.1 17655 // https://promisesaplus.com/#point-61 17656 // Ignore post-resolution exceptions 17657 if ( depth + 1 >= maxDepth ) { 17658 17659 // Only substitute handlers pass on context 17660 // and multiple values (non-spec behavior) 17661 if ( handler !== Thrower ) { 17662 that = undefined; 17663 args = [ e ]; 17664 } 17665 17666 deferred.rejectWith( that, args ); 17667 } 17668 } 17669 }; 17670 17671 // Support: Promises/A+ section 2.3.3.3.1 17672 // https://promisesaplus.com/#point-57 17673 // Re-resolve promises immediately to dodge false rejection from 17674 // subsequent errors 17675 if ( depth ) { 17676 process(); 17677 } else { 17678 17679 // Call an optional hook to record the stack, in case of exception 17680 // since it's otherwise lost when execution goes async 17681 if ( jQuery.Deferred.getStackHook ) { 17682 process.stackTrace = jQuery.Deferred.getStackHook(); 17683 } 17684 window.setTimeout( process ); 17685 } 17686 }; 17687 } 17688 17689 return jQuery.Deferred( function( newDefer ) { 17690 17691 // progress_handlers.add( ... ) 17692 tuples[ 0 ][ 3 ].add( 17693 resolve( 17694 0, 17695 newDefer, 17696 isFunction( onProgress ) ? 17697 onProgress : 17698 Identity, 17699 newDefer.notifyWith 17700 ) 17701 ); 17702 17703 // fulfilled_handlers.add( ... ) 17704 tuples[ 1 ][ 3 ].add( 17705 resolve( 17706 0, 17707 newDefer, 17708 isFunction( onFulfilled ) ? 17709 onFulfilled : 17710 Identity 17711 ) 17712 ); 17713 17714 // rejected_handlers.add( ... ) 17715 tuples[ 2 ][ 3 ].add( 17716 resolve( 17717 0, 17718 newDefer, 17719 isFunction( onRejected ) ? 17720 onRejected : 17721 Thrower 17722 ) 17723 ); 17724 } ).promise(); 17725 }, 17726 17727 // Get a promise for this deferred 17728 // If obj is provided, the promise aspect is added to the object 17729 promise: function( obj ) { 17730 return obj != null ? jQuery.extend( obj, promise ) : promise; 17731 } 17732 }, 17733 deferred = {}; 17734 17735 // Add list-specific methods 17736 jQuery.each( tuples, function( i, tuple ) { 17737 var list = tuple[ 2 ], 17738 stateString = tuple[ 5 ]; 17739 17740 // promise.progress = list.add 17741 // promise.done = list.add 17742 // promise.fail = list.add 17743 promise[ tuple[ 1 ] ] = list.add; 17744 17745 // Handle state 17746 if ( stateString ) { 17747 list.add( 17748 function() { 17749 17750 // state = "resolved" (i.e., fulfilled) 17751 // state = "rejected" 17752 state = stateString; 17753 }, 17754 17755 // rejected_callbacks.disable 17756 // fulfilled_callbacks.disable 17757 tuples[ 3 - i ][ 2 ].disable, 17758 17759 // rejected_handlers.disable 17760 // fulfilled_handlers.disable 17761 tuples[ 3 - i ][ 3 ].disable, 17762 17763 // progress_callbacks.lock 17764 tuples[ 0 ][ 2 ].lock, 17765 17766 // progress_handlers.lock 17767 tuples[ 0 ][ 3 ].lock 17768 ); 17769 } 17770 17771 // progress_handlers.fire 17772 // fulfilled_handlers.fire 17773 // rejected_handlers.fire 17774 list.add( tuple[ 3 ].fire ); 17775 17776 // deferred.notify = function() { deferred.notifyWith(...) } 17777 // deferred.resolve = function() { deferred.resolveWith(...) } 17778 // deferred.reject = function() { deferred.rejectWith(...) } 17779 deferred[ tuple[ 0 ] ] = function() { 17780 deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); 17781 return this; 17782 }; 17783 17784 // deferred.notifyWith = list.fireWith 17785 // deferred.resolveWith = list.fireWith 17786 // deferred.rejectWith = list.fireWith 17787 deferred[ tuple[ 0 ] + "With" ] = list.fireWith; 17788 } ); 17789 17790 // Make the deferred a promise 17791 promise.promise( deferred ); 17792 17793 // Call given func if any 17794 if ( func ) { 17795 func.call( deferred, deferred ); 17796 } 17797 17798 // All done! 17799 return deferred; 17800 }, 17801 17802 // Deferred helper 17803 when: function( singleValue ) { 17804 var 17805 17806 // count of uncompleted subordinates 17807 remaining = arguments.length, 17808 17809 // count of unprocessed arguments 17810 i = remaining, 17811 17812 // subordinate fulfillment data 17813 resolveContexts = Array( i ), 17814 resolveValues = slice.call( arguments ), 17815 17816 // the primary Deferred 17817 primary = jQuery.Deferred(), 17818 17819 // subordinate callback factory 17820 updateFunc = function( i ) { 17821 return function( value ) { 17822 resolveContexts[ i ] = this; 17823 resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; 17824 if ( !( --remaining ) ) { 17825 primary.resolveWith( resolveContexts, resolveValues ); 17826 } 17827 }; 17828 }; 17829 17830 // Single- and empty arguments are adopted like Promise.resolve 17831 if ( remaining <= 1 ) { 17832 adoptValue( singleValue, primary.done( updateFunc( i ) ).resolve, primary.reject, 17833 !remaining ); 17834 17835 // Use .then() to unwrap secondary thenables (cf. gh-3000) 17836 if ( primary.state() === "pending" || 17837 isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { 17838 17839 return primary.then(); 17840 } 17841 } 17842 17843 // Multiple arguments are aggregated like Promise.all array elements 17844 while ( i-- ) { 17845 adoptValue( resolveValues[ i ], updateFunc( i ), primary.reject ); 17846 } 17847 17848 return primary.promise(); 17849 } 17850} ); 17851 17852 17853// These usually indicate a programmer mistake during development, 17854// warn about them ASAP rather than swallowing them by default. 17855var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; 17856 17857jQuery.Deferred.exceptionHook = function( error, stack ) { 17858 17859 // Support: IE 8 - 9 only 17860 // Console exists when dev tools are open, which can happen at any time 17861 if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { 17862 window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack ); 17863 } 17864}; 17865 17866 17867 17868 17869jQuery.readyException = function( error ) { 17870 window.setTimeout( function() { 17871 throw error; 17872 } ); 17873}; 17874 17875 17876 17877 17878// The deferred used on DOM ready 17879var readyList = jQuery.Deferred(); 17880 17881jQuery.fn.ready = function( fn ) { 17882 17883 readyList 17884 .then( fn ) 17885 17886 // Wrap jQuery.readyException in a function so that the lookup 17887 // happens at the time of error handling instead of callback 17888 // registration. 17889 .catch( function( error ) { 17890 jQuery.readyException( error ); 17891 } ); 17892 17893 return this; 17894}; 17895 17896jQuery.extend( { 17897 17898 // Is the DOM ready to be used? Set to true once it occurs. 17899 isReady: false, 17900 17901 // A counter to track how many items to wait for before 17902 // the ready event fires. See #6781 17903 readyWait: 1, 17904 17905 // Handle when the DOM is ready 17906 ready: function( wait ) { 17907 17908 // Abort if there are pending holds or we're already ready 17909 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { 17910 return; 17911 } 17912 17913 // Remember that the DOM is ready 17914 jQuery.isReady = true; 17915 17916 // If a normal DOM Ready event fired, decrement, and wait if need be 17917 if ( wait !== true && --jQuery.readyWait > 0 ) { 17918 return; 17919 } 17920 17921 // If there are functions bound, to execute 17922 readyList.resolveWith( document, [ jQuery ] ); 17923 } 17924} ); 17925 17926jQuery.ready.then = readyList.then; 17927 17928// The ready event handler and self cleanup method 17929function completed() { 17930 document.removeEventListener( "DOMContentLoaded", completed ); 17931 window.removeEventListener( "load", completed ); 17932 jQuery.ready(); 17933} 17934 17935// Catch cases where $(document).ready() is called 17936// after the browser event has already occurred. 17937// Support: IE <=9 - 10 only 17938// Older IE sometimes signals "interactive" too soon 17939if ( document.readyState === "complete" || 17940 ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { 17941 17942 // Handle it asynchronously to allow scripts the opportunity to delay ready 17943 window.setTimeout( jQuery.ready ); 17944 17945} else { 17946 17947 // Use the handy event callback 17948 document.addEventListener( "DOMContentLoaded", completed ); 17949 17950 // A fallback to window.onload, that will always work 17951 window.addEventListener( "load", completed ); 17952} 17953 17954 17955 17956 17957// Multifunctional method to get and set values of a collection 17958// The value/s can optionally be executed if it's a function 17959var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { 17960 var i = 0, 17961 len = elems.length, 17962 bulk = key == null; 17963 17964 // Sets many values 17965 if ( toType( key ) === "object" ) { 17966 chainable = true; 17967 for ( i in key ) { 17968 access( elems, fn, i, key[ i ], true, emptyGet, raw ); 17969 } 17970 17971 // Sets one value 17972 } else if ( value !== undefined ) { 17973 chainable = true; 17974 17975 if ( !isFunction( value ) ) { 17976 raw = true; 17977 } 17978 17979 if ( bulk ) { 17980 17981 // Bulk operations run against the entire set 17982 if ( raw ) { 17983 fn.call( elems, value ); 17984 fn = null; 17985 17986 // ...except when executing function values 17987 } else { 17988 bulk = fn; 17989 fn = function( elem, _key, value ) { 17990 return bulk.call( jQuery( elem ), value ); 17991 }; 17992 } 17993 } 17994 17995 if ( fn ) { 17996 for ( ; i < len; i++ ) { 17997 fn( 17998 elems[ i ], key, raw ? 17999 value : 18000 value.call( elems[ i ], i, fn( elems[ i ], key ) ) 18001 ); 18002 } 18003 } 18004 } 18005 18006 if ( chainable ) { 18007 return elems; 18008 } 18009 18010 // Gets 18011 if ( bulk ) { 18012 return fn.call( elems ); 18013 } 18014 18015 return len ? fn( elems[ 0 ], key ) : emptyGet; 18016}; 18017 18018 18019// Matches dashed string for camelizing 18020var rmsPrefix = /^-ms-/, 18021 rdashAlpha = /-([a-z])/g; 18022 18023// Used by camelCase as callback to replace() 18024function fcamelCase( _all, letter ) { 18025 return letter.toUpperCase(); 18026} 18027 18028// Convert dashed to camelCase; used by the css and data modules 18029// Support: IE <=9 - 11, Edge 12 - 15 18030// Microsoft forgot to hump their vendor prefix (#9572) 18031function camelCase( string ) { 18032 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); 18033} 18034var acceptData = function( owner ) { 18035 18036 // Accepts only: 18037 // - Node 18038 // - Node.ELEMENT_NODE 18039 // - Node.DOCUMENT_NODE 18040 // - Object 18041 // - Any 18042 return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); 18043}; 18044 18045 18046 18047 18048function Data() { 18049 this.expando = jQuery.expando + Data.uid++; 18050} 18051 18052Data.uid = 1; 18053 18054Data.prototype = { 18055 18056 cache: function( owner ) { 18057 18058 // Check if the owner object already has a cache 18059 var value = owner[ this.expando ]; 18060 18061 // If not, create one 18062 if ( !value ) { 18063 value = {}; 18064 18065 // We can accept data for non-element nodes in modern browsers, 18066 // but we should not, see #8335. 18067 // Always return an empty object. 18068 if ( acceptData( owner ) ) { 18069 18070 // If it is a node unlikely to be stringify-ed or looped over 18071 // use plain assignment 18072 if ( owner.nodeType ) { 18073 owner[ this.expando ] = value; 18074 18075 // Otherwise secure it in a non-enumerable property 18076 // configurable must be true to allow the property to be 18077 // deleted when data is removed 18078 } else { 18079 Object.defineProperty( owner, this.expando, { 18080 value: value, 18081 configurable: true 18082 } ); 18083 } 18084 } 18085 } 18086 18087 return value; 18088 }, 18089 set: function( owner, data, value ) { 18090 var prop, 18091 cache = this.cache( owner ); 18092 18093 // Handle: [ owner, key, value ] args 18094 // Always use camelCase key (gh-2257) 18095 if ( typeof data === "string" ) { 18096 cache[ camelCase( data ) ] = value; 18097 18098 // Handle: [ owner, { properties } ] args 18099 } else { 18100 18101 // Copy the properties one-by-one to the cache object 18102 for ( prop in data ) { 18103 cache[ camelCase( prop ) ] = data[ prop ]; 18104 } 18105 } 18106 return cache; 18107 }, 18108 get: function( owner, key ) { 18109 return key === undefined ? 18110 this.cache( owner ) : 18111 18112 // Always use camelCase key (gh-2257) 18113 owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ]; 18114 }, 18115 access: function( owner, key, value ) { 18116 18117 // In cases where either: 18118 // 18119 // 1. No key was specified 18120 // 2. A string key was specified, but no value provided 18121 // 18122 // Take the "read" path and allow the get method to determine 18123 // which value to return, respectively either: 18124 // 18125 // 1. The entire cache object 18126 // 2. The data stored at the key 18127 // 18128 if ( key === undefined || 18129 ( ( key && typeof key === "string" ) && value === undefined ) ) { 18130 18131 return this.get( owner, key ); 18132 } 18133 18134 // When the key is not a string, or both a key and value 18135 // are specified, set or extend (existing objects) with either: 18136 // 18137 // 1. An object of properties 18138 // 2. A key and value 18139 // 18140 this.set( owner, key, value ); 18141 18142 // Since the "set" path can have two possible entry points 18143 // return the expected data based on which path was taken[*] 18144 return value !== undefined ? value : key; 18145 }, 18146 remove: function( owner, key ) { 18147 var i, 18148 cache = owner[ this.expando ]; 18149 18150 if ( cache === undefined ) { 18151 return; 18152 } 18153 18154 if ( key !== undefined ) { 18155 18156 // Support array or space separated string of keys 18157 if ( Array.isArray( key ) ) { 18158 18159 // If key is an array of keys... 18160 // We always set camelCase keys, so remove that. 18161 key = key.map( camelCase ); 18162 } else { 18163 key = camelCase( key ); 18164 18165 // If a key with the spaces exists, use it. 18166 // Otherwise, create an array by matching non-whitespace 18167 key = key in cache ? 18168 [ key ] : 18169 ( key.match( rnothtmlwhite ) || [] ); 18170 } 18171 18172 i = key.length; 18173 18174 while ( i-- ) { 18175 delete cache[ key[ i ] ]; 18176 } 18177 } 18178 18179 // Remove the expando if there's no more data 18180 if ( key === undefined || jQuery.isEmptyObject( cache ) ) { 18181 18182 // Support: Chrome <=35 - 45 18183 // Webkit & Blink performance suffers when deleting properties 18184 // from DOM nodes, so set to undefined instead 18185 // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) 18186 if ( owner.nodeType ) { 18187 owner[ this.expando ] = undefined; 18188 } else { 18189 delete owner[ this.expando ]; 18190 } 18191 } 18192 }, 18193 hasData: function( owner ) { 18194 var cache = owner[ this.expando ]; 18195 return cache !== undefined && !jQuery.isEmptyObject( cache ); 18196 } 18197}; 18198var dataPriv = new Data(); 18199 18200var dataUser = new Data(); 18201 18202 18203 18204// Implementation Summary 18205// 18206// 1. Enforce API surface and semantic compatibility with 1.9.x branch 18207// 2. Improve the module's maintainability by reducing the storage 18208// paths to a single mechanism. 18209// 3. Use the same single mechanism to support "private" and "user" data. 18210// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) 18211// 5. Avoid exposing implementation details on user objects (eg. expando properties) 18212// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 18213 18214var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, 18215 rmultiDash = /[A-Z]/g; 18216 18217function getData( data ) { 18218 if ( data === "true" ) { 18219 return true; 18220 } 18221 18222 if ( data === "false" ) { 18223 return false; 18224 } 18225 18226 if ( data === "null" ) { 18227 return null; 18228 } 18229 18230 // Only convert to a number if it doesn't change the string 18231 if ( data === +data + "" ) { 18232 return +data; 18233 } 18234 18235 if ( rbrace.test( data ) ) { 18236 return JSON.parse( data ); 18237 } 18238 18239 return data; 18240} 18241 18242function dataAttr( elem, key, data ) { 18243 var name; 18244 18245 // If nothing was found internally, try to fetch any 18246 // data from the HTML5 data-* attribute 18247 if ( data === undefined && elem.nodeType === 1 ) { 18248 name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); 18249 data = elem.getAttribute( name ); 18250 18251 if ( typeof data === "string" ) { 18252 try { 18253 data = getData( data ); 18254 } catch ( e ) {} 18255 18256 // Make sure we set the data so it isn't changed later 18257 dataUser.set( elem, key, data ); 18258 } else { 18259 data = undefined; 18260 } 18261 } 18262 return data; 18263} 18264 18265jQuery.extend( { 18266 hasData: function( elem ) { 18267 return dataUser.hasData( elem ) || dataPriv.hasData( elem ); 18268 }, 18269 18270 data: function( elem, name, data ) { 18271 return dataUser.access( elem, name, data ); 18272 }, 18273 18274 removeData: function( elem, name ) { 18275 dataUser.remove( elem, name ); 18276 }, 18277 18278 // TODO: Now that all calls to _data and _removeData have been replaced 18279 // with direct calls to dataPriv methods, these can be deprecated. 18280 _data: function( elem, name, data ) { 18281 return dataPriv.access( elem, name, data ); 18282 }, 18283 18284 _removeData: function( elem, name ) { 18285 dataPriv.remove( elem, name ); 18286 } 18287} ); 18288 18289jQuery.fn.extend( { 18290 data: function( key, value ) { 18291 var i, name, data, 18292 elem = this[ 0 ], 18293 attrs = elem && elem.attributes; 18294 18295 // Gets all values 18296 if ( key === undefined ) { 18297 if ( this.length ) { 18298 data = dataUser.get( elem ); 18299 18300 if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { 18301 i = attrs.length; 18302 while ( i-- ) { 18303 18304 // Support: IE 11 only 18305 // The attrs elements can be null (#14894) 18306 if ( attrs[ i ] ) { 18307 name = attrs[ i ].name; 18308 if ( name.indexOf( "data-" ) === 0 ) { 18309 name = camelCase( name.slice( 5 ) ); 18310 dataAttr( elem, name, data[ name ] ); 18311 } 18312 } 18313 } 18314 dataPriv.set( elem, "hasDataAttrs", true ); 18315 } 18316 } 18317 18318 return data; 18319 } 18320 18321 // Sets multiple values 18322 if ( typeof key === "object" ) { 18323 return this.each( function() { 18324 dataUser.set( this, key ); 18325 } ); 18326 } 18327 18328 return access( this, function( value ) { 18329 var data; 18330 18331 // The calling jQuery object (element matches) is not empty 18332 // (and therefore has an element appears at this[ 0 ]) and the 18333 // `value` parameter was not undefined. An empty jQuery object 18334 // will result in `undefined` for elem = this[ 0 ] which will 18335 // throw an exception if an attempt to read a data cache is made. 18336 if ( elem && value === undefined ) { 18337 18338 // Attempt to get data from the cache 18339 // The key will always be camelCased in Data 18340 data = dataUser.get( elem, key ); 18341 if ( data !== undefined ) { 18342 return data; 18343 } 18344 18345 // Attempt to "discover" the data in 18346 // HTML5 custom data-* attrs 18347 data = dataAttr( elem, key ); 18348 if ( data !== undefined ) { 18349 return data; 18350 } 18351 18352 // We tried really hard, but the data doesn't exist. 18353 return; 18354 } 18355 18356 // Set the data... 18357 this.each( function() { 18358 18359 // We always store the camelCased key 18360 dataUser.set( this, key, value ); 18361 } ); 18362 }, null, value, arguments.length > 1, null, true ); 18363 }, 18364 18365 removeData: function( key ) { 18366 return this.each( function() { 18367 dataUser.remove( this, key ); 18368 } ); 18369 } 18370} ); 18371 18372 18373jQuery.extend( { 18374 queue: function( elem, type, data ) { 18375 var queue; 18376 18377 if ( elem ) { 18378 type = ( type || "fx" ) + "queue"; 18379 queue = dataPriv.get( elem, type ); 18380 18381 // Speed up dequeue by getting out quickly if this is just a lookup 18382 if ( data ) { 18383 if ( !queue || Array.isArray( data ) ) { 18384 queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); 18385 } else { 18386 queue.push( data ); 18387 } 18388 } 18389 return queue || []; 18390 } 18391 }, 18392 18393 dequeue: function( elem, type ) { 18394 type = type || "fx"; 18395 18396 var queue = jQuery.queue( elem, type ), 18397 startLength = queue.length, 18398 fn = queue.shift(), 18399 hooks = jQuery._queueHooks( elem, type ), 18400 next = function() { 18401 jQuery.dequeue( elem, type ); 18402 }; 18403 18404 // If the fx queue is dequeued, always remove the progress sentinel 18405 if ( fn === "inprogress" ) { 18406 fn = queue.shift(); 18407 startLength--; 18408 } 18409 18410 if ( fn ) { 18411 18412 // Add a progress sentinel to prevent the fx queue from being 18413 // automatically dequeued 18414 if ( type === "fx" ) { 18415 queue.unshift( "inprogress" ); 18416 } 18417 18418 // Clear up the last queue stop function 18419 delete hooks.stop; 18420 fn.call( elem, next, hooks ); 18421 } 18422 18423 if ( !startLength && hooks ) { 18424 hooks.empty.fire(); 18425 } 18426 }, 18427 18428 // Not public - generate a queueHooks object, or return the current one 18429 _queueHooks: function( elem, type ) { 18430 var key = type + "queueHooks"; 18431 return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { 18432 empty: jQuery.Callbacks( "once memory" ).add( function() { 18433 dataPriv.remove( elem, [ type + "queue", key ] ); 18434 } ) 18435 } ); 18436 } 18437} ); 18438 18439jQuery.fn.extend( { 18440 queue: function( type, data ) { 18441 var setter = 2; 18442 18443 if ( typeof type !== "string" ) { 18444 data = type; 18445 type = "fx"; 18446 setter--; 18447 } 18448 18449 if ( arguments.length < setter ) { 18450 return jQuery.queue( this[ 0 ], type ); 18451 } 18452 18453 return data === undefined ? 18454 this : 18455 this.each( function() { 18456 var queue = jQuery.queue( this, type, data ); 18457 18458 // Ensure a hooks for this queue 18459 jQuery._queueHooks( this, type ); 18460 18461 if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { 18462 jQuery.dequeue( this, type ); 18463 } 18464 } ); 18465 }, 18466 dequeue: function( type ) { 18467 return this.each( function() { 18468 jQuery.dequeue( this, type ); 18469 } ); 18470 }, 18471 clearQueue: function( type ) { 18472 return this.queue( type || "fx", [] ); 18473 }, 18474 18475 // Get a promise resolved when queues of a certain type 18476 // are emptied (fx is the type by default) 18477 promise: function( type, obj ) { 18478 var tmp, 18479 count = 1, 18480 defer = jQuery.Deferred(), 18481 elements = this, 18482 i = this.length, 18483 resolve = function() { 18484 if ( !( --count ) ) { 18485 defer.resolveWith( elements, [ elements ] ); 18486 } 18487 }; 18488 18489 if ( typeof type !== "string" ) { 18490 obj = type; 18491 type = undefined; 18492 } 18493 type = type || "fx"; 18494 18495 while ( i-- ) { 18496 tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); 18497 if ( tmp && tmp.empty ) { 18498 count++; 18499 tmp.empty.add( resolve ); 18500 } 18501 } 18502 resolve(); 18503 return defer.promise( obj ); 18504 } 18505} ); 18506var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; 18507 18508var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); 18509 18510 18511var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; 18512 18513var documentElement = document.documentElement; 18514 18515 18516 18517 var isAttached = function( elem ) { 18518 return jQuery.contains( elem.ownerDocument, elem ); 18519 }, 18520 composed = { composed: true }; 18521 18522 // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only 18523 // Check attachment across shadow DOM boundaries when possible (gh-3504) 18524 // Support: iOS 10.0-10.2 only 18525 // Early iOS 10 versions support `attachShadow` but not `getRootNode`, 18526 // leading to errors. We need to check for `getRootNode`. 18527 if ( documentElement.getRootNode ) { 18528 isAttached = function( elem ) { 18529 return jQuery.contains( elem.ownerDocument, elem ) || 18530 elem.getRootNode( composed ) === elem.ownerDocument; 18531 }; 18532 } 18533var isHiddenWithinTree = function( elem, el ) { 18534 18535 // isHiddenWithinTree might be called from jQuery#filter function; 18536 // in that case, element will be second argument 18537 elem = el || elem; 18538 18539 // Inline style trumps all 18540 return elem.style.display === "none" || 18541 elem.style.display === "" && 18542 18543 // Otherwise, check computed style 18544 // Support: Firefox <=43 - 45 18545 // Disconnected elements can have computed display: none, so first confirm that elem is 18546 // in the document. 18547 isAttached( elem ) && 18548 18549 jQuery.css( elem, "display" ) === "none"; 18550 }; 18551 18552 18553 18554function adjustCSS( elem, prop, valueParts, tween ) { 18555 var adjusted, scale, 18556 maxIterations = 20, 18557 currentValue = tween ? 18558 function() { 18559 return tween.cur(); 18560 } : 18561 function() { 18562 return jQuery.css( elem, prop, "" ); 18563 }, 18564 initial = currentValue(), 18565 unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), 18566 18567 // Starting value computation is required for potential unit mismatches 18568 initialInUnit = elem.nodeType && 18569 ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && 18570 rcssNum.exec( jQuery.css( elem, prop ) ); 18571 18572 if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { 18573 18574 // Support: Firefox <=54 18575 // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144) 18576 initial = initial / 2; 18577 18578 // Trust units reported by jQuery.css 18579 unit = unit || initialInUnit[ 3 ]; 18580 18581 // Iteratively approximate from a nonzero starting point 18582 initialInUnit = +initial || 1; 18583 18584 while ( maxIterations-- ) { 18585 18586 // Evaluate and update our best guess (doubling guesses that zero out). 18587 // Finish if the scale equals or crosses 1 (making the old*new product non-positive). 18588 jQuery.style( elem, prop, initialInUnit + unit ); 18589 if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) { 18590 maxIterations = 0; 18591 } 18592 initialInUnit = initialInUnit / scale; 18593 18594 } 18595 18596 initialInUnit = initialInUnit * 2; 18597 jQuery.style( elem, prop, initialInUnit + unit ); 18598 18599 // Make sure we update the tween properties later on 18600 valueParts = valueParts || []; 18601 } 18602 18603 if ( valueParts ) { 18604 initialInUnit = +initialInUnit || +initial || 0; 18605 18606 // Apply relative offset (+=/-=) if specified 18607 adjusted = valueParts[ 1 ] ? 18608 initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : 18609 +valueParts[ 2 ]; 18610 if ( tween ) { 18611 tween.unit = unit; 18612 tween.start = initialInUnit; 18613 tween.end = adjusted; 18614 } 18615 } 18616 return adjusted; 18617} 18618 18619 18620var defaultDisplayMap = {}; 18621 18622function getDefaultDisplay( elem ) { 18623 var temp, 18624 doc = elem.ownerDocument, 18625 nodeName = elem.nodeName, 18626 display = defaultDisplayMap[ nodeName ]; 18627 18628 if ( display ) { 18629 return display; 18630 } 18631 18632 temp = doc.body.appendChild( doc.createElement( nodeName ) ); 18633 display = jQuery.css( temp, "display" ); 18634 18635 temp.parentNode.removeChild( temp ); 18636 18637 if ( display === "none" ) { 18638 display = "block"; 18639 } 18640 defaultDisplayMap[ nodeName ] = display; 18641 18642 return display; 18643} 18644 18645function showHide( elements, show ) { 18646 var display, elem, 18647 values = [], 18648 index = 0, 18649 length = elements.length; 18650 18651 // Determine new display value for elements that need to change 18652 for ( ; index < length; index++ ) { 18653 elem = elements[ index ]; 18654 if ( !elem.style ) { 18655 continue; 18656 } 18657 18658 display = elem.style.display; 18659 if ( show ) { 18660 18661 // Since we force visibility upon cascade-hidden elements, an immediate (and slow) 18662 // check is required in this first loop unless we have a nonempty display value (either 18663 // inline or about-to-be-restored) 18664 if ( display === "none" ) { 18665 values[ index ] = dataPriv.get( elem, "display" ) || null; 18666 if ( !values[ index ] ) { 18667 elem.style.display = ""; 18668 } 18669 } 18670 if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { 18671 values[ index ] = getDefaultDisplay( elem ); 18672 } 18673 } else { 18674 if ( display !== "none" ) { 18675 values[ index ] = "none"; 18676 18677 // Remember what we're overwriting 18678 dataPriv.set( elem, "display", display ); 18679 } 18680 } 18681 } 18682 18683 // Set the display of the elements in a second loop to avoid constant reflow 18684 for ( index = 0; index < length; index++ ) { 18685 if ( values[ index ] != null ) { 18686 elements[ index ].style.display = values[ index ]; 18687 } 18688 } 18689 18690 return elements; 18691} 18692 18693jQuery.fn.extend( { 18694 show: function() { 18695 return showHide( this, true ); 18696 }, 18697 hide: function() { 18698 return showHide( this ); 18699 }, 18700 toggle: function( state ) { 18701 if ( typeof state === "boolean" ) { 18702 return state ? this.show() : this.hide(); 18703 } 18704 18705 return this.each( function() { 18706 if ( isHiddenWithinTree( this ) ) { 18707 jQuery( this ).show(); 18708 } else { 18709 jQuery( this ).hide(); 18710 } 18711 } ); 18712 } 18713} ); 18714var rcheckableType = ( /^(?:checkbox|radio)$/i ); 18715 18716var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i ); 18717 18718var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i ); 18719 18720 18721 18722( function() { 18723 var fragment = document.createDocumentFragment(), 18724 div = fragment.appendChild( document.createElement( "div" ) ), 18725 input = document.createElement( "input" ); 18726 18727 // Support: Android 4.0 - 4.3 only 18728 // Check state lost if the name is set (#11217) 18729 // Support: Windows Web Apps (WWA) 18730 // `name` and `type` must use .setAttribute for WWA (#14901) 18731 input.setAttribute( "type", "radio" ); 18732 input.setAttribute( "checked", "checked" ); 18733 input.setAttribute( "name", "t" ); 18734 18735 div.appendChild( input ); 18736 18737 // Support: Android <=4.1 only 18738 // Older WebKit doesn't clone checked state correctly in fragments 18739 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; 18740 18741 // Support: IE <=11 only 18742 // Make sure textarea (and checkbox) defaultValue is properly cloned 18743 div.innerHTML = "<textarea>x</textarea>"; 18744 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; 18745 18746 // Support: IE <=9 only 18747 // IE <=9 replaces <option> tags with their contents when inserted outside of 18748 // the select element. 18749 div.innerHTML = "<option></option>"; 18750 support.option = !!div.lastChild; 18751} )(); 18752 18753 18754// We have to close these tags to support XHTML (#13200) 18755var wrapMap = { 18756 18757 // XHTML parsers do not magically insert elements in the 18758 // same way that tag soup parsers do. So we cannot shorten 18759 // this by omitting <tbody> or other required elements. 18760 thead: [ 1, "<table>", "</table>" ], 18761 col: [ 2, "<table><colgroup>", "</colgroup></table>" ], 18762 tr: [ 2, "<table><tbody>", "</tbody></table>" ], 18763 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], 18764 18765 _default: [ 0, "", "" ] 18766}; 18767 18768wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; 18769wrapMap.th = wrapMap.td; 18770 18771// Support: IE <=9 only 18772if ( !support.option ) { 18773 wrapMap.optgroup = wrapMap.option = [ 1, "<select multiple='multiple'>", "</select>" ]; 18774} 18775 18776 18777function getAll( context, tag ) { 18778 18779 // Support: IE <=9 - 11 only 18780 // Use typeof to avoid zero-argument method invocation on host objects (#15151) 18781 var ret; 18782 18783 if ( typeof context.getElementsByTagName !== "undefined" ) { 18784 ret = context.getElementsByTagName( tag || "*" ); 18785 18786 } else if ( typeof context.querySelectorAll !== "undefined" ) { 18787 ret = context.querySelectorAll( tag || "*" ); 18788 18789 } else { 18790 ret = []; 18791 } 18792 18793 if ( tag === undefined || tag && nodeName( context, tag ) ) { 18794 return jQuery.merge( [ context ], ret ); 18795 } 18796 18797 return ret; 18798} 18799 18800 18801// Mark scripts as having already been evaluated 18802function setGlobalEval( elems, refElements ) { 18803 var i = 0, 18804 l = elems.length; 18805 18806 for ( ; i < l; i++ ) { 18807 dataPriv.set( 18808 elems[ i ], 18809 "globalEval", 18810 !refElements || dataPriv.get( refElements[ i ], "globalEval" ) 18811 ); 18812 } 18813} 18814 18815 18816var rhtml = /<|&#?\w+;/; 18817 18818function buildFragment( elems, context, scripts, selection, ignored ) { 18819 var elem, tmp, tag, wrap, attached, j, 18820 fragment = context.createDocumentFragment(), 18821 nodes = [], 18822 i = 0, 18823 l = elems.length; 18824 18825 for ( ; i < l; i++ ) { 18826 elem = elems[ i ]; 18827 18828 if ( elem || elem === 0 ) { 18829 18830 // Add nodes directly 18831 if ( toType( elem ) === "object" ) { 18832 18833 // Support: Android <=4.0 only, PhantomJS 1 only 18834 // push.apply(_, arraylike) throws on ancient WebKit 18835 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); 18836 18837 // Convert non-html into a text node 18838 } else if ( !rhtml.test( elem ) ) { 18839 nodes.push( context.createTextNode( elem ) ); 18840 18841 // Convert html into DOM nodes 18842 } else { 18843 tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); 18844 18845 // Deserialize a standard representation 18846 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); 18847 wrap = wrapMap[ tag ] || wrapMap._default; 18848 tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; 18849 18850 // Descend through wrappers to the right content 18851 j = wrap[ 0 ]; 18852 while ( j-- ) { 18853 tmp = tmp.lastChild; 18854 } 18855 18856 // Support: Android <=4.0 only, PhantomJS 1 only 18857 // push.apply(_, arraylike) throws on ancient WebKit 18858 jQuery.merge( nodes, tmp.childNodes ); 18859 18860 // Remember the top-level container 18861 tmp = fragment.firstChild; 18862 18863 // Ensure the created nodes are orphaned (#12392) 18864 tmp.textContent = ""; 18865 } 18866 } 18867 } 18868 18869 // Remove wrapper from fragment 18870 fragment.textContent = ""; 18871 18872 i = 0; 18873 while ( ( elem = nodes[ i++ ] ) ) { 18874 18875 // Skip elements already in the context collection (trac-4087) 18876 if ( selection && jQuery.inArray( elem, selection ) > -1 ) { 18877 if ( ignored ) { 18878 ignored.push( elem ); 18879 } 18880 continue; 18881 } 18882 18883 attached = isAttached( elem ); 18884 18885 // Append to fragment 18886 tmp = getAll( fragment.appendChild( elem ), "script" ); 18887 18888 // Preserve script evaluation history 18889 if ( attached ) { 18890 setGlobalEval( tmp ); 18891 } 18892 18893 // Capture executables 18894 if ( scripts ) { 18895 j = 0; 18896 while ( ( elem = tmp[ j++ ] ) ) { 18897 if ( rscriptType.test( elem.type || "" ) ) { 18898 scripts.push( elem ); 18899 } 18900 } 18901 } 18902 } 18903 18904 return fragment; 18905} 18906 18907 18908var rtypenamespace = /^([^.]*)(?:\.(.+)|)/; 18909 18910function returnTrue() { 18911 return true; 18912} 18913 18914function returnFalse() { 18915 return false; 18916} 18917 18918// Support: IE <=9 - 11+ 18919// focus() and blur() are asynchronous, except when they are no-op. 18920// So expect focus to be synchronous when the element is already active, 18921// and blur to be synchronous when the element is not already active. 18922// (focus and blur are always synchronous in other supported browsers, 18923// this just defines when we can count on it). 18924function expectSync( elem, type ) { 18925 return ( elem === safeActiveElement() ) === ( type === "focus" ); 18926} 18927 18928// Support: IE <=9 only 18929// Accessing document.activeElement can throw unexpectedly 18930// https://bugs.jquery.com/ticket/13393 18931function safeActiveElement() { 18932 try { 18933 return document.activeElement; 18934 } catch ( err ) { } 18935} 18936 18937function on( elem, types, selector, data, fn, one ) { 18938 var origFn, type; 18939 18940 // Types can be a map of types/handlers 18941 if ( typeof types === "object" ) { 18942 18943 // ( types-Object, selector, data ) 18944 if ( typeof selector !== "string" ) { 18945 18946 // ( types-Object, data ) 18947 data = data || selector; 18948 selector = undefined; 18949 } 18950 for ( type in types ) { 18951 on( elem, type, selector, data, types[ type ], one ); 18952 } 18953 return elem; 18954 } 18955 18956 if ( data == null && fn == null ) { 18957 18958 // ( types, fn ) 18959 fn = selector; 18960 data = selector = undefined; 18961 } else if ( fn == null ) { 18962 if ( typeof selector === "string" ) { 18963 18964 // ( types, selector, fn ) 18965 fn = data; 18966 data = undefined; 18967 } else { 18968 18969 // ( types, data, fn ) 18970 fn = data; 18971 data = selector; 18972 selector = undefined; 18973 } 18974 } 18975 if ( fn === false ) { 18976 fn = returnFalse; 18977 } else if ( !fn ) { 18978 return elem; 18979 } 18980 18981 if ( one === 1 ) { 18982 origFn = fn; 18983 fn = function( event ) { 18984 18985 // Can use an empty set, since event contains the info 18986 jQuery().off( event ); 18987 return origFn.apply( this, arguments ); 18988 }; 18989 18990 // Use same guid so caller can remove using origFn 18991 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); 18992 } 18993 return elem.each( function() { 18994 jQuery.event.add( this, types, fn, data, selector ); 18995 } ); 18996} 18997 18998/* 18999 * Helper functions for managing events -- not part of the public interface. 19000 * Props to Dean Edwards' addEvent library for many of the ideas. 19001 */ 19002jQuery.event = { 19003 19004 global: {}, 19005 19006 add: function( elem, types, handler, data, selector ) { 19007 19008 var handleObjIn, eventHandle, tmp, 19009 events, t, handleObj, 19010 special, handlers, type, namespaces, origType, 19011 elemData = dataPriv.get( elem ); 19012 19013 // Only attach events to objects that accept data 19014 if ( !acceptData( elem ) ) { 19015 return; 19016 } 19017 19018 // Caller can pass in an object of custom data in lieu of the handler 19019 if ( handler.handler ) { 19020 handleObjIn = handler; 19021 handler = handleObjIn.handler; 19022 selector = handleObjIn.selector; 19023 } 19024 19025 // Ensure that invalid selectors throw exceptions at attach time 19026 // Evaluate against documentElement in case elem is a non-element node (e.g., document) 19027 if ( selector ) { 19028 jQuery.find.matchesSelector( documentElement, selector ); 19029 } 19030 19031 // Make sure that the handler has a unique ID, used to find/remove it later 19032 if ( !handler.guid ) { 19033 handler.guid = jQuery.guid++; 19034 } 19035 19036 // Init the element's event structure and main handler, if this is the first 19037 if ( !( events = elemData.events ) ) { 19038 events = elemData.events = Object.create( null ); 19039 } 19040 if ( !( eventHandle = elemData.handle ) ) { 19041 eventHandle = elemData.handle = function( e ) { 19042 19043 // Discard the second event of a jQuery.event.trigger() and 19044 // when an event is called after a page has unloaded 19045 return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? 19046 jQuery.event.dispatch.apply( elem, arguments ) : undefined; 19047 }; 19048 } 19049 19050 // Handle multiple events separated by a space 19051 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; 19052 t = types.length; 19053 while ( t-- ) { 19054 tmp = rtypenamespace.exec( types[ t ] ) || []; 19055 type = origType = tmp[ 1 ]; 19056 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 19057 19058 // There *must* be a type, no attaching namespace-only handlers 19059 if ( !type ) { 19060 continue; 19061 } 19062 19063 // If event changes its type, use the special event handlers for the changed type 19064 special = jQuery.event.special[ type ] || {}; 19065 19066 // If selector defined, determine special event api type, otherwise given type 19067 type = ( selector ? special.delegateType : special.bindType ) || type; 19068 19069 // Update special based on newly reset type 19070 special = jQuery.event.special[ type ] || {}; 19071 19072 // handleObj is passed to all event handlers 19073 handleObj = jQuery.extend( { 19074 type: type, 19075 origType: origType, 19076 data: data, 19077 handler: handler, 19078 guid: handler.guid, 19079 selector: selector, 19080 needsContext: selector && jQuery.expr.match.needsContext.test( selector ), 19081 namespace: namespaces.join( "." ) 19082 }, handleObjIn ); 19083 19084 // Init the event handler queue if we're the first 19085 if ( !( handlers = events[ type ] ) ) { 19086 handlers = events[ type ] = []; 19087 handlers.delegateCount = 0; 19088 19089 // Only use addEventListener if the special events handler returns false 19090 if ( !special.setup || 19091 special.setup.call( elem, data, namespaces, eventHandle ) === false ) { 19092 19093 if ( elem.addEventListener ) { 19094 elem.addEventListener( type, eventHandle ); 19095 } 19096 } 19097 } 19098 19099 if ( special.add ) { 19100 special.add.call( elem, handleObj ); 19101 19102 if ( !handleObj.handler.guid ) { 19103 handleObj.handler.guid = handler.guid; 19104 } 19105 } 19106 19107 // Add to the element's handler list, delegates in front 19108 if ( selector ) { 19109 handlers.splice( handlers.delegateCount++, 0, handleObj ); 19110 } else { 19111 handlers.push( handleObj ); 19112 } 19113 19114 // Keep track of which events have ever been used, for event optimization 19115 jQuery.event.global[ type ] = true; 19116 } 19117 19118 }, 19119 19120 // Detach an event or set of events from an element 19121 remove: function( elem, types, handler, selector, mappedTypes ) { 19122 19123 var j, origCount, tmp, 19124 events, t, handleObj, 19125 special, handlers, type, namespaces, origType, 19126 elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); 19127 19128 if ( !elemData || !( events = elemData.events ) ) { 19129 return; 19130 } 19131 19132 // Once for each type.namespace in types; type may be omitted 19133 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; 19134 t = types.length; 19135 while ( t-- ) { 19136 tmp = rtypenamespace.exec( types[ t ] ) || []; 19137 type = origType = tmp[ 1 ]; 19138 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 19139 19140 // Unbind all events (on this namespace, if provided) for the element 19141 if ( !type ) { 19142 for ( type in events ) { 19143 jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); 19144 } 19145 continue; 19146 } 19147 19148 special = jQuery.event.special[ type ] || {}; 19149 type = ( selector ? special.delegateType : special.bindType ) || type; 19150 handlers = events[ type ] || []; 19151 tmp = tmp[ 2 ] && 19152 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); 19153 19154 // Remove matching events 19155 origCount = j = handlers.length; 19156 while ( j-- ) { 19157 handleObj = handlers[ j ]; 19158 19159 if ( ( mappedTypes || origType === handleObj.origType ) && 19160 ( !handler || handler.guid === handleObj.guid ) && 19161 ( !tmp || tmp.test( handleObj.namespace ) ) && 19162 ( !selector || selector === handleObj.selector || 19163 selector === "**" && handleObj.selector ) ) { 19164 handlers.splice( j, 1 ); 19165 19166 if ( handleObj.selector ) { 19167 handlers.delegateCount--; 19168 } 19169 if ( special.remove ) { 19170 special.remove.call( elem, handleObj ); 19171 } 19172 } 19173 } 19174 19175 // Remove generic event handler if we removed something and no more handlers exist 19176 // (avoids potential for endless recursion during removal of special event handlers) 19177 if ( origCount && !handlers.length ) { 19178 if ( !special.teardown || 19179 special.teardown.call( elem, namespaces, elemData.handle ) === false ) { 19180 19181 jQuery.removeEvent( elem, type, elemData.handle ); 19182 } 19183 19184 delete events[ type ]; 19185 } 19186 } 19187 19188 // Remove data and the expando if it's no longer used 19189 if ( jQuery.isEmptyObject( events ) ) { 19190 dataPriv.remove( elem, "handle events" ); 19191 } 19192 }, 19193 19194 dispatch: function( nativeEvent ) { 19195 19196 var i, j, ret, matched, handleObj, handlerQueue, 19197 args = new Array( arguments.length ), 19198 19199 // Make a writable jQuery.Event from the native event object 19200 event = jQuery.event.fix( nativeEvent ), 19201 19202 handlers = ( 19203 dataPriv.get( this, "events" ) || Object.create( null ) 19204 )[ event.type ] || [], 19205 special = jQuery.event.special[ event.type ] || {}; 19206 19207 // Use the fix-ed jQuery.Event rather than the (read-only) native event 19208 args[ 0 ] = event; 19209 19210 for ( i = 1; i < arguments.length; i++ ) { 19211 args[ i ] = arguments[ i ]; 19212 } 19213 19214 event.delegateTarget = this; 19215 19216 // Call the preDispatch hook for the mapped type, and let it bail if desired 19217 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { 19218 return; 19219 } 19220 19221 // Determine handlers 19222 handlerQueue = jQuery.event.handlers.call( this, event, handlers ); 19223 19224 // Run delegates first; they may want to stop propagation beneath us 19225 i = 0; 19226 while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { 19227 event.currentTarget = matched.elem; 19228 19229 j = 0; 19230 while ( ( handleObj = matched.handlers[ j++ ] ) && 19231 !event.isImmediatePropagationStopped() ) { 19232 19233 // If the event is namespaced, then each handler is only invoked if it is 19234 // specially universal or its namespaces are a superset of the event's. 19235 if ( !event.rnamespace || handleObj.namespace === false || 19236 event.rnamespace.test( handleObj.namespace ) ) { 19237 19238 event.handleObj = handleObj; 19239 event.data = handleObj.data; 19240 19241 ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || 19242 handleObj.handler ).apply( matched.elem, args ); 19243 19244 if ( ret !== undefined ) { 19245 if ( ( event.result = ret ) === false ) { 19246 event.preventDefault(); 19247 event.stopPropagation(); 19248 } 19249 } 19250 } 19251 } 19252 } 19253 19254 // Call the postDispatch hook for the mapped type 19255 if ( special.postDispatch ) { 19256 special.postDispatch.call( this, event ); 19257 } 19258 19259 return event.result; 19260 }, 19261 19262 handlers: function( event, handlers ) { 19263 var i, handleObj, sel, matchedHandlers, matchedSelectors, 19264 handlerQueue = [], 19265 delegateCount = handlers.delegateCount, 19266 cur = event.target; 19267 19268 // Find delegate handlers 19269 if ( delegateCount && 19270 19271 // Support: IE <=9 19272 // Black-hole SVG <use> instance trees (trac-13180) 19273 cur.nodeType && 19274 19275 // Support: Firefox <=42 19276 // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) 19277 // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click 19278 // Support: IE 11 only 19279 // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) 19280 !( event.type === "click" && event.button >= 1 ) ) { 19281 19282 for ( ; cur !== this; cur = cur.parentNode || this ) { 19283 19284 // Don't check non-elements (#13208) 19285 // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) 19286 if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { 19287 matchedHandlers = []; 19288 matchedSelectors = {}; 19289 for ( i = 0; i < delegateCount; i++ ) { 19290 handleObj = handlers[ i ]; 19291 19292 // Don't conflict with Object.prototype properties (#13203) 19293 sel = handleObj.selector + " "; 19294 19295 if ( matchedSelectors[ sel ] === undefined ) { 19296 matchedSelectors[ sel ] = handleObj.needsContext ? 19297 jQuery( sel, this ).index( cur ) > -1 : 19298 jQuery.find( sel, this, null, [ cur ] ).length; 19299 } 19300 if ( matchedSelectors[ sel ] ) { 19301 matchedHandlers.push( handleObj ); 19302 } 19303 } 19304 if ( matchedHandlers.length ) { 19305 handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); 19306 } 19307 } 19308 } 19309 } 19310 19311 // Add the remaining (directly-bound) handlers 19312 cur = this; 19313 if ( delegateCount < handlers.length ) { 19314 handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); 19315 } 19316 19317 return handlerQueue; 19318 }, 19319 19320 addProp: function( name, hook ) { 19321 Object.defineProperty( jQuery.Event.prototype, name, { 19322 enumerable: true, 19323 configurable: true, 19324 19325 get: isFunction( hook ) ? 19326 function() { 19327 if ( this.originalEvent ) { 19328 return hook( this.originalEvent ); 19329 } 19330 } : 19331 function() { 19332 if ( this.originalEvent ) { 19333 return this.originalEvent[ name ]; 19334 } 19335 }, 19336 19337 set: function( value ) { 19338 Object.defineProperty( this, name, { 19339 enumerable: true, 19340 configurable: true, 19341 writable: true, 19342 value: value 19343 } ); 19344 } 19345 } ); 19346 }, 19347 19348 fix: function( originalEvent ) { 19349 return originalEvent[ jQuery.expando ] ? 19350 originalEvent : 19351 new jQuery.Event( originalEvent ); 19352 }, 19353 19354 special: { 19355 load: { 19356 19357 // Prevent triggered image.load events from bubbling to window.load 19358 noBubble: true 19359 }, 19360 click: { 19361 19362 // Utilize native event to ensure correct state for checkable inputs 19363 setup: function( data ) { 19364 19365 // For mutual compressibility with _default, replace `this` access with a local var. 19366 // `|| data` is dead code meant only to preserve the variable through minification. 19367 var el = this || data; 19368 19369 // Claim the first handler 19370 if ( rcheckableType.test( el.type ) && 19371 el.click && nodeName( el, "input" ) ) { 19372 19373 // dataPriv.set( el, "click", ... ) 19374 leverageNative( el, "click", returnTrue ); 19375 } 19376 19377 // Return false to allow normal processing in the caller 19378 return false; 19379 }, 19380 trigger: function( data ) { 19381 19382 // For mutual compressibility with _default, replace `this` access with a local var. 19383 // `|| data` is dead code meant only to preserve the variable through minification. 19384 var el = this || data; 19385 19386 // Force setup before triggering a click 19387 if ( rcheckableType.test( el.type ) && 19388 el.click && nodeName( el, "input" ) ) { 19389 19390 leverageNative( el, "click" ); 19391 } 19392 19393 // Return non-false to allow normal event-path propagation 19394 return true; 19395 }, 19396 19397 // For cross-browser consistency, suppress native .click() on links 19398 // Also prevent it if we're currently inside a leveraged native-event stack 19399 _default: function( event ) { 19400 var target = event.target; 19401 return rcheckableType.test( target.type ) && 19402 target.click && nodeName( target, "input" ) && 19403 dataPriv.get( target, "click" ) || 19404 nodeName( target, "a" ); 19405 } 19406 }, 19407 19408 beforeunload: { 19409 postDispatch: function( event ) { 19410 19411 // Support: Firefox 20+ 19412 // Firefox doesn't alert if the returnValue field is not set. 19413 if ( event.result !== undefined && event.originalEvent ) { 19414 event.originalEvent.returnValue = event.result; 19415 } 19416 } 19417 } 19418 } 19419}; 19420 19421// Ensure the presence of an event listener that handles manually-triggered 19422// synthetic events by interrupting progress until reinvoked in response to 19423// *native* events that it fires directly, ensuring that state changes have 19424// already occurred before other listeners are invoked. 19425function leverageNative( el, type, expectSync ) { 19426 19427 // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add 19428 if ( !expectSync ) { 19429 if ( dataPriv.get( el, type ) === undefined ) { 19430 jQuery.event.add( el, type, returnTrue ); 19431 } 19432 return; 19433 } 19434 19435 // Register the controller as a special universal handler for all event namespaces 19436 dataPriv.set( el, type, false ); 19437 jQuery.event.add( el, type, { 19438 namespace: false, 19439 handler: function( event ) { 19440 var notAsync, result, 19441 saved = dataPriv.get( this, type ); 19442 19443 if ( ( event.isTrigger & 1 ) && this[ type ] ) { 19444 19445 // Interrupt processing of the outer synthetic .trigger()ed event 19446 // Saved data should be false in such cases, but might be a leftover capture object 19447 // from an async native handler (gh-4350) 19448 if ( !saved.length ) { 19449 19450 // Store arguments for use when handling the inner native event 19451 // There will always be at least one argument (an event object), so this array 19452 // will not be confused with a leftover capture object. 19453 saved = slice.call( arguments ); 19454 dataPriv.set( this, type, saved ); 19455 19456 // Trigger the native event and capture its result 19457 // Support: IE <=9 - 11+ 19458 // focus() and blur() are asynchronous 19459 notAsync = expectSync( this, type ); 19460 this[ type ](); 19461 result = dataPriv.get( this, type ); 19462 if ( saved !== result || notAsync ) { 19463 dataPriv.set( this, type, false ); 19464 } else { 19465 result = {}; 19466 } 19467 if ( saved !== result ) { 19468 19469 // Cancel the outer synthetic event 19470 event.stopImmediatePropagation(); 19471 event.preventDefault(); 19472 19473 // Support: Chrome 86+ 19474 // In Chrome, if an element having a focusout handler is blurred by 19475 // clicking outside of it, it invokes the handler synchronously. If 19476 // that handler calls `.remove()` on the element, the data is cleared, 19477 // leaving `result` undefined. We need to guard against this. 19478 return result && result.value; 19479 } 19480 19481 // If this is an inner synthetic event for an event with a bubbling surrogate 19482 // (focus or blur), assume that the surrogate already propagated from triggering the 19483 // native event and prevent that from happening again here. 19484 // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the 19485 // bubbling surrogate propagates *after* the non-bubbling base), but that seems 19486 // less bad than duplication. 19487 } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) { 19488 event.stopPropagation(); 19489 } 19490 19491 // If this is a native event triggered above, everything is now in order 19492 // Fire an inner synthetic event with the original arguments 19493 } else if ( saved.length ) { 19494 19495 // ...and capture the result 19496 dataPriv.set( this, type, { 19497 value: jQuery.event.trigger( 19498 19499 // Support: IE <=9 - 11+ 19500 // Extend with the prototype to reset the above stopImmediatePropagation() 19501 jQuery.extend( saved[ 0 ], jQuery.Event.prototype ), 19502 saved.slice( 1 ), 19503 this 19504 ) 19505 } ); 19506 19507 // Abort handling of the native event 19508 event.stopImmediatePropagation(); 19509 } 19510 } 19511 } ); 19512} 19513 19514jQuery.removeEvent = function( elem, type, handle ) { 19515 19516 // This "if" is needed for plain objects 19517 if ( elem.removeEventListener ) { 19518 elem.removeEventListener( type, handle ); 19519 } 19520}; 19521 19522jQuery.Event = function( src, props ) { 19523 19524 // Allow instantiation without the 'new' keyword 19525 if ( !( this instanceof jQuery.Event ) ) { 19526 return new jQuery.Event( src, props ); 19527 } 19528 19529 // Event object 19530 if ( src && src.type ) { 19531 this.originalEvent = src; 19532 this.type = src.type; 19533 19534 // Events bubbling up the document may have been marked as prevented 19535 // by a handler lower down the tree; reflect the correct value. 19536 this.isDefaultPrevented = src.defaultPrevented || 19537 src.defaultPrevented === undefined && 19538 19539 // Support: Android <=2.3 only 19540 src.returnValue === false ? 19541 returnTrue : 19542 returnFalse; 19543 19544 // Create target properties 19545 // Support: Safari <=6 - 7 only 19546 // Target should not be a text node (#504, #13143) 19547 this.target = ( src.target && src.target.nodeType === 3 ) ? 19548 src.target.parentNode : 19549 src.target; 19550 19551 this.currentTarget = src.currentTarget; 19552 this.relatedTarget = src.relatedTarget; 19553 19554 // Event type 19555 } else { 19556 this.type = src; 19557 } 19558 19559 // Put explicitly provided properties onto the event object 19560 if ( props ) { 19561 jQuery.extend( this, props ); 19562 } 19563 19564 // Create a timestamp if incoming event doesn't have one 19565 this.timeStamp = src && src.timeStamp || Date.now(); 19566 19567 // Mark it as fixed 19568 this[ jQuery.expando ] = true; 19569}; 19570 19571// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding 19572// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html 19573jQuery.Event.prototype = { 19574 constructor: jQuery.Event, 19575 isDefaultPrevented: returnFalse, 19576 isPropagationStopped: returnFalse, 19577 isImmediatePropagationStopped: returnFalse, 19578 isSimulated: false, 19579 19580 preventDefault: function() { 19581 var e = this.originalEvent; 19582 19583 this.isDefaultPrevented = returnTrue; 19584 19585 if ( e && !this.isSimulated ) { 19586 e.preventDefault(); 19587 } 19588 }, 19589 stopPropagation: function() { 19590 var e = this.originalEvent; 19591 19592 this.isPropagationStopped = returnTrue; 19593 19594 if ( e && !this.isSimulated ) { 19595 e.stopPropagation(); 19596 } 19597 }, 19598 stopImmediatePropagation: function() { 19599 var e = this.originalEvent; 19600 19601 this.isImmediatePropagationStopped = returnTrue; 19602 19603 if ( e && !this.isSimulated ) { 19604 e.stopImmediatePropagation(); 19605 } 19606 19607 this.stopPropagation(); 19608 } 19609}; 19610 19611// Includes all common event props including KeyEvent and MouseEvent specific props 19612jQuery.each( { 19613 altKey: true, 19614 bubbles: true, 19615 cancelable: true, 19616 changedTouches: true, 19617 ctrlKey: true, 19618 detail: true, 19619 eventPhase: true, 19620 metaKey: true, 19621 pageX: true, 19622 pageY: true, 19623 shiftKey: true, 19624 view: true, 19625 "char": true, 19626 code: true, 19627 charCode: true, 19628 key: true, 19629 keyCode: true, 19630 button: true, 19631 buttons: true, 19632 clientX: true, 19633 clientY: true, 19634 offsetX: true, 19635 offsetY: true, 19636 pointerId: true, 19637 pointerType: true, 19638 screenX: true, 19639 screenY: true, 19640 targetTouches: true, 19641 toElement: true, 19642 touches: true, 19643 which: true 19644}, jQuery.event.addProp ); 19645 19646jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) { 19647 jQuery.event.special[ type ] = { 19648 19649 // Utilize native event if possible so blur/focus sequence is correct 19650 setup: function() { 19651 19652 // Claim the first handler 19653 // dataPriv.set( this, "focus", ... ) 19654 // dataPriv.set( this, "blur", ... ) 19655 leverageNative( this, type, expectSync ); 19656 19657 // Return false to allow normal processing in the caller 19658 return false; 19659 }, 19660 trigger: function() { 19661 19662 // Force setup before trigger 19663 leverageNative( this, type ); 19664 19665 // Return non-false to allow normal event-path propagation 19666 return true; 19667 }, 19668 19669 // Suppress native focus or blur as it's already being fired 19670 // in leverageNative. 19671 _default: function() { 19672 return true; 19673 }, 19674 19675 delegateType: delegateType 19676 }; 19677} ); 19678 19679// Create mouseenter/leave events using mouseover/out and event-time checks 19680// so that event delegation works in jQuery. 19681// Do the same for pointerenter/pointerleave and pointerover/pointerout 19682// 19683// Support: Safari 7 only 19684// Safari sends mouseenter too often; see: 19685// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 19686// for the description of the bug (it existed in older Chrome versions as well). 19687jQuery.each( { 19688 mouseenter: "mouseover", 19689 mouseleave: "mouseout", 19690 pointerenter: "pointerover", 19691 pointerleave: "pointerout" 19692}, function( orig, fix ) { 19693 jQuery.event.special[ orig ] = { 19694 delegateType: fix, 19695 bindType: fix, 19696 19697 handle: function( event ) { 19698 var ret, 19699 target = this, 19700 related = event.relatedTarget, 19701 handleObj = event.handleObj; 19702 19703 // For mouseenter/leave call the handler if related is outside the target. 19704 // NB: No relatedTarget if the mouse left/entered the browser window 19705 if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { 19706 event.type = handleObj.origType; 19707 ret = handleObj.handler.apply( this, arguments ); 19708 event.type = fix; 19709 } 19710 return ret; 19711 } 19712 }; 19713} ); 19714 19715jQuery.fn.extend( { 19716 19717 on: function( types, selector, data, fn ) { 19718 return on( this, types, selector, data, fn ); 19719 }, 19720 one: function( types, selector, data, fn ) { 19721 return on( this, types, selector, data, fn, 1 ); 19722 }, 19723 off: function( types, selector, fn ) { 19724 var handleObj, type; 19725 if ( types && types.preventDefault && types.handleObj ) { 19726 19727 // ( event ) dispatched jQuery.Event 19728 handleObj = types.handleObj; 19729 jQuery( types.delegateTarget ).off( 19730 handleObj.namespace ? 19731 handleObj.origType + "." + handleObj.namespace : 19732 handleObj.origType, 19733 handleObj.selector, 19734 handleObj.handler 19735 ); 19736 return this; 19737 } 19738 if ( typeof types === "object" ) { 19739 19740 // ( types-object [, selector] ) 19741 for ( type in types ) { 19742 this.off( type, selector, types[ type ] ); 19743 } 19744 return this; 19745 } 19746 if ( selector === false || typeof selector === "function" ) { 19747 19748 // ( types [, fn] ) 19749 fn = selector; 19750 selector = undefined; 19751 } 19752 if ( fn === false ) { 19753 fn = returnFalse; 19754 } 19755 return this.each( function() { 19756 jQuery.event.remove( this, types, fn, selector ); 19757 } ); 19758 } 19759} ); 19760 19761 19762var 19763 19764 // Support: IE <=10 - 11, Edge 12 - 13 only 19765 // In IE/Edge using regex groups here causes severe slowdowns. 19766 // See https://connect.microsoft.com/IE/feedback/details/1736512/ 19767 rnoInnerhtml = /<script|<style|<link/i, 19768 19769 // checked="checked" or checked 19770 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, 19771 rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g; 19772 19773// Prefer a tbody over its parent table for containing new rows 19774function manipulationTarget( elem, content ) { 19775 if ( nodeName( elem, "table" ) && 19776 nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { 19777 19778 return jQuery( elem ).children( "tbody" )[ 0 ] || elem; 19779 } 19780 19781 return elem; 19782} 19783 19784// Replace/restore the type attribute of script elements for safe DOM manipulation 19785function disableScript( elem ) { 19786 elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; 19787 return elem; 19788} 19789function restoreScript( elem ) { 19790 if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) { 19791 elem.type = elem.type.slice( 5 ); 19792 } else { 19793 elem.removeAttribute( "type" ); 19794 } 19795 19796 return elem; 19797} 19798 19799function cloneCopyEvent( src, dest ) { 19800 var i, l, type, pdataOld, udataOld, udataCur, events; 19801 19802 if ( dest.nodeType !== 1 ) { 19803 return; 19804 } 19805 19806 // 1. Copy private data: events, handlers, etc. 19807 if ( dataPriv.hasData( src ) ) { 19808 pdataOld = dataPriv.get( src ); 19809 events = pdataOld.events; 19810 19811 if ( events ) { 19812 dataPriv.remove( dest, "handle events" ); 19813 19814 for ( type in events ) { 19815 for ( i = 0, l = events[ type ].length; i < l; i++ ) { 19816 jQuery.event.add( dest, type, events[ type ][ i ] ); 19817 } 19818 } 19819 } 19820 } 19821 19822 // 2. Copy user data 19823 if ( dataUser.hasData( src ) ) { 19824 udataOld = dataUser.access( src ); 19825 udataCur = jQuery.extend( {}, udataOld ); 19826 19827 dataUser.set( dest, udataCur ); 19828 } 19829} 19830 19831// Fix IE bugs, see support tests 19832function fixInput( src, dest ) { 19833 var nodeName = dest.nodeName.toLowerCase(); 19834 19835 // Fails to persist the checked state of a cloned checkbox or radio button. 19836 if ( nodeName === "input" && rcheckableType.test( src.type ) ) { 19837 dest.checked = src.checked; 19838 19839 // Fails to return the selected option to the default selected state when cloning options 19840 } else if ( nodeName === "input" || nodeName === "textarea" ) { 19841 dest.defaultValue = src.defaultValue; 19842 } 19843} 19844 19845function domManip( collection, args, callback, ignored ) { 19846 19847 // Flatten any nested arrays 19848 args = flat( args ); 19849 19850 var fragment, first, scripts, hasScripts, node, doc, 19851 i = 0, 19852 l = collection.length, 19853 iNoClone = l - 1, 19854 value = args[ 0 ], 19855 valueIsFunction = isFunction( value ); 19856 19857 // We can't cloneNode fragments that contain checked, in WebKit 19858 if ( valueIsFunction || 19859 ( l > 1 && typeof value === "string" && 19860 !support.checkClone && rchecked.test( value ) ) ) { 19861 return collection.each( function( index ) { 19862 var self = collection.eq( index ); 19863 if ( valueIsFunction ) { 19864 args[ 0 ] = value.call( this, index, self.html() ); 19865 } 19866 domManip( self, args, callback, ignored ); 19867 } ); 19868 } 19869 19870 if ( l ) { 19871 fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); 19872 first = fragment.firstChild; 19873 19874 if ( fragment.childNodes.length === 1 ) { 19875 fragment = first; 19876 } 19877 19878 // Require either new content or an interest in ignored elements to invoke the callback 19879 if ( first || ignored ) { 19880 scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); 19881 hasScripts = scripts.length; 19882 19883 // Use the original fragment for the last item 19884 // instead of the first because it can end up 19885 // being emptied incorrectly in certain situations (#8070). 19886 for ( ; i < l; i++ ) { 19887 node = fragment; 19888 19889 if ( i !== iNoClone ) { 19890 node = jQuery.clone( node, true, true ); 19891 19892 // Keep references to cloned scripts for later restoration 19893 if ( hasScripts ) { 19894 19895 // Support: Android <=4.0 only, PhantomJS 1 only 19896 // push.apply(_, arraylike) throws on ancient WebKit 19897 jQuery.merge( scripts, getAll( node, "script" ) ); 19898 } 19899 } 19900 19901 callback.call( collection[ i ], node, i ); 19902 } 19903 19904 if ( hasScripts ) { 19905 doc = scripts[ scripts.length - 1 ].ownerDocument; 19906 19907 // Reenable scripts 19908 jQuery.map( scripts, restoreScript ); 19909 19910 // Evaluate executable scripts on first document insertion 19911 for ( i = 0; i < hasScripts; i++ ) { 19912 node = scripts[ i ]; 19913 if ( rscriptType.test( node.type || "" ) && 19914 !dataPriv.access( node, "globalEval" ) && 19915 jQuery.contains( doc, node ) ) { 19916 19917 if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) { 19918 19919 // Optional AJAX dependency, but won't run scripts if not present 19920 if ( jQuery._evalUrl && !node.noModule ) { 19921 jQuery._evalUrl( node.src, { 19922 nonce: node.nonce || node.getAttribute( "nonce" ) 19923 }, doc ); 19924 } 19925 } else { 19926 DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc ); 19927 } 19928 } 19929 } 19930 } 19931 } 19932 } 19933 19934 return collection; 19935} 19936 19937function remove( elem, selector, keepData ) { 19938 var node, 19939 nodes = selector ? jQuery.filter( selector, elem ) : elem, 19940 i = 0; 19941 19942 for ( ; ( node = nodes[ i ] ) != null; i++ ) { 19943 if ( !keepData && node.nodeType === 1 ) { 19944 jQuery.cleanData( getAll( node ) ); 19945 } 19946 19947 if ( node.parentNode ) { 19948 if ( keepData && isAttached( node ) ) { 19949 setGlobalEval( getAll( node, "script" ) ); 19950 } 19951 node.parentNode.removeChild( node ); 19952 } 19953 } 19954 19955 return elem; 19956} 19957 19958jQuery.extend( { 19959 htmlPrefilter: function( html ) { 19960 return html; 19961 }, 19962 19963 clone: function( elem, dataAndEvents, deepDataAndEvents ) { 19964 var i, l, srcElements, destElements, 19965 clone = elem.cloneNode( true ), 19966 inPage = isAttached( elem ); 19967 19968 // Fix IE cloning issues 19969 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && 19970 !jQuery.isXMLDoc( elem ) ) { 19971 19972 // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2 19973 destElements = getAll( clone ); 19974 srcElements = getAll( elem ); 19975 19976 for ( i = 0, l = srcElements.length; i < l; i++ ) { 19977 fixInput( srcElements[ i ], destElements[ i ] ); 19978 } 19979 } 19980 19981 // Copy the events from the original to the clone 19982 if ( dataAndEvents ) { 19983 if ( deepDataAndEvents ) { 19984 srcElements = srcElements || getAll( elem ); 19985 destElements = destElements || getAll( clone ); 19986 19987 for ( i = 0, l = srcElements.length; i < l; i++ ) { 19988 cloneCopyEvent( srcElements[ i ], destElements[ i ] ); 19989 } 19990 } else { 19991 cloneCopyEvent( elem, clone ); 19992 } 19993 } 19994 19995 // Preserve script evaluation history 19996 destElements = getAll( clone, "script" ); 19997 if ( destElements.length > 0 ) { 19998 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); 19999 } 20000 20001 // Return the cloned set 20002 return clone; 20003 }, 20004 20005 cleanData: function( elems ) { 20006 var data, elem, type, 20007 special = jQuery.event.special, 20008 i = 0; 20009 20010 for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { 20011 if ( acceptData( elem ) ) { 20012 if ( ( data = elem[ dataPriv.expando ] ) ) { 20013 if ( data.events ) { 20014 for ( type in data.events ) { 20015 if ( special[ type ] ) { 20016 jQuery.event.remove( elem, type ); 20017 20018 // This is a shortcut to avoid jQuery.event.remove's overhead 20019 } else { 20020 jQuery.removeEvent( elem, type, data.handle ); 20021 } 20022 } 20023 } 20024 20025 // Support: Chrome <=35 - 45+ 20026 // Assign undefined instead of using delete, see Data#remove 20027 elem[ dataPriv.expando ] = undefined; 20028 } 20029 if ( elem[ dataUser.expando ] ) { 20030 20031 // Support: Chrome <=35 - 45+ 20032 // Assign undefined instead of using delete, see Data#remove 20033 elem[ dataUser.expando ] = undefined; 20034 } 20035 } 20036 } 20037 } 20038} ); 20039 20040jQuery.fn.extend( { 20041 detach: function( selector ) { 20042 return remove( this, selector, true ); 20043 }, 20044 20045 remove: function( selector ) { 20046 return remove( this, selector ); 20047 }, 20048 20049 text: function( value ) { 20050 return access( this, function( value ) { 20051 return value === undefined ? 20052 jQuery.text( this ) : 20053 this.empty().each( function() { 20054 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 20055 this.textContent = value; 20056 } 20057 } ); 20058 }, null, value, arguments.length ); 20059 }, 20060 20061 append: function() { 20062 return domManip( this, arguments, function( elem ) { 20063 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 20064 var target = manipulationTarget( this, elem ); 20065 target.appendChild( elem ); 20066 } 20067 } ); 20068 }, 20069 20070 prepend: function() { 20071 return domManip( this, arguments, function( elem ) { 20072 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 20073 var target = manipulationTarget( this, elem ); 20074 target.insertBefore( elem, target.firstChild ); 20075 } 20076 } ); 20077 }, 20078 20079 before: function() { 20080 return domManip( this, arguments, function( elem ) { 20081 if ( this.parentNode ) { 20082 this.parentNode.insertBefore( elem, this ); 20083 } 20084 } ); 20085 }, 20086 20087 after: function() { 20088 return domManip( this, arguments, function( elem ) { 20089 if ( this.parentNode ) { 20090 this.parentNode.insertBefore( elem, this.nextSibling ); 20091 } 20092 } ); 20093 }, 20094 20095 empty: function() { 20096 var elem, 20097 i = 0; 20098 20099 for ( ; ( elem = this[ i ] ) != null; i++ ) { 20100 if ( elem.nodeType === 1 ) { 20101 20102 // Prevent memory leaks 20103 jQuery.cleanData( getAll( elem, false ) ); 20104 20105 // Remove any remaining nodes 20106 elem.textContent = ""; 20107 } 20108 } 20109 20110 return this; 20111 }, 20112 20113 clone: function( dataAndEvents, deepDataAndEvents ) { 20114 dataAndEvents = dataAndEvents == null ? false : dataAndEvents; 20115 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; 20116 20117 return this.map( function() { 20118 return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); 20119 } ); 20120 }, 20121 20122 html: function( value ) { 20123 return access( this, function( value ) { 20124 var elem = this[ 0 ] || {}, 20125 i = 0, 20126 l = this.length; 20127 20128 if ( value === undefined && elem.nodeType === 1 ) { 20129 return elem.innerHTML; 20130 } 20131 20132 // See if we can take a shortcut and just use innerHTML 20133 if ( typeof value === "string" && !rnoInnerhtml.test( value ) && 20134 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { 20135 20136 value = jQuery.htmlPrefilter( value ); 20137 20138 try { 20139 for ( ; i < l; i++ ) { 20140 elem = this[ i ] || {}; 20141 20142 // Remove element nodes and prevent memory leaks 20143 if ( elem.nodeType === 1 ) { 20144 jQuery.cleanData( getAll( elem, false ) ); 20145 elem.innerHTML = value; 20146 } 20147 } 20148 20149 elem = 0; 20150 20151 // If using innerHTML throws an exception, use the fallback method 20152 } catch ( e ) {} 20153 } 20154 20155 if ( elem ) { 20156 this.empty().append( value ); 20157 } 20158 }, null, value, arguments.length ); 20159 }, 20160 20161 replaceWith: function() { 20162 var ignored = []; 20163 20164 // Make the changes, replacing each non-ignored context element with the new content 20165 return domManip( this, arguments, function( elem ) { 20166 var parent = this.parentNode; 20167 20168 if ( jQuery.inArray( this, ignored ) < 0 ) { 20169 jQuery.cleanData( getAll( this ) ); 20170 if ( parent ) { 20171 parent.replaceChild( elem, this ); 20172 } 20173 } 20174 20175 // Force callback invocation 20176 }, ignored ); 20177 } 20178} ); 20179 20180jQuery.each( { 20181 appendTo: "append", 20182 prependTo: "prepend", 20183 insertBefore: "before", 20184 insertAfter: "after", 20185 replaceAll: "replaceWith" 20186}, function( name, original ) { 20187 jQuery.fn[ name ] = function( selector ) { 20188 var elems, 20189 ret = [], 20190 insert = jQuery( selector ), 20191 last = insert.length - 1, 20192 i = 0; 20193 20194 for ( ; i <= last; i++ ) { 20195 elems = i === last ? this : this.clone( true ); 20196 jQuery( insert[ i ] )[ original ]( elems ); 20197 20198 // Support: Android <=4.0 only, PhantomJS 1 only 20199 // .get() because push.apply(_, arraylike) throws on ancient WebKit 20200 push.apply( ret, elems.get() ); 20201 } 20202 20203 return this.pushStack( ret ); 20204 }; 20205} ); 20206var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); 20207 20208var getStyles = function( elem ) { 20209 20210 // Support: IE <=11 only, Firefox <=30 (#15098, #14150) 20211 // IE throws on elements created in popups 20212 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" 20213 var view = elem.ownerDocument.defaultView; 20214 20215 if ( !view || !view.opener ) { 20216 view = window; 20217 } 20218 20219 return view.getComputedStyle( elem ); 20220 }; 20221 20222var swap = function( elem, options, callback ) { 20223 var ret, name, 20224 old = {}; 20225 20226 // Remember the old values, and insert the new ones 20227 for ( name in options ) { 20228 old[ name ] = elem.style[ name ]; 20229 elem.style[ name ] = options[ name ]; 20230 } 20231 20232 ret = callback.call( elem ); 20233 20234 // Revert the old values 20235 for ( name in options ) { 20236 elem.style[ name ] = old[ name ]; 20237 } 20238 20239 return ret; 20240}; 20241 20242 20243var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); 20244 20245 20246 20247( function() { 20248 20249 // Executing both pixelPosition & boxSizingReliable tests require only one layout 20250 // so they're executed at the same time to save the second computation. 20251 function computeStyleTests() { 20252 20253 // This is a singleton, we need to execute it only once 20254 if ( !div ) { 20255 return; 20256 } 20257 20258 container.style.cssText = "position:absolute;left:-11111px;width:60px;" + 20259 "margin-top:1px;padding:0;border:0"; 20260 div.style.cssText = 20261 "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + 20262 "margin:auto;border:1px;padding:1px;" + 20263 "width:60%;top:1%"; 20264 documentElement.appendChild( container ).appendChild( div ); 20265 20266 var divStyle = window.getComputedStyle( div ); 20267 pixelPositionVal = divStyle.top !== "1%"; 20268 20269 // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 20270 reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12; 20271 20272 // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3 20273 // Some styles come back with percentage values, even though they shouldn't 20274 div.style.right = "60%"; 20275 pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36; 20276 20277 // Support: IE 9 - 11 only 20278 // Detect misreporting of content dimensions for box-sizing:border-box elements 20279 boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36; 20280 20281 // Support: IE 9 only 20282 // Detect overflow:scroll screwiness (gh-3699) 20283 // Support: Chrome <=64 20284 // Don't get tricked when zoom affects offsetWidth (gh-4029) 20285 div.style.position = "absolute"; 20286 scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12; 20287 20288 documentElement.removeChild( container ); 20289 20290 // Nullify the div so it wouldn't be stored in the memory and 20291 // it will also be a sign that checks already performed 20292 div = null; 20293 } 20294 20295 function roundPixelMeasures( measure ) { 20296 return Math.round( parseFloat( measure ) ); 20297 } 20298 20299 var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, 20300 reliableTrDimensionsVal, reliableMarginLeftVal, 20301 container = document.createElement( "div" ), 20302 div = document.createElement( "div" ); 20303 20304 // Finish early in limited (non-browser) environments 20305 if ( !div.style ) { 20306 return; 20307 } 20308 20309 // Support: IE <=9 - 11 only 20310 // Style of cloned element affects source element cloned (#8908) 20311 div.style.backgroundClip = "content-box"; 20312 div.cloneNode( true ).style.backgroundClip = ""; 20313 support.clearCloneStyle = div.style.backgroundClip === "content-box"; 20314 20315 jQuery.extend( support, { 20316 boxSizingReliable: function() { 20317 computeStyleTests(); 20318 return boxSizingReliableVal; 20319 }, 20320 pixelBoxStyles: function() { 20321 computeStyleTests(); 20322 return pixelBoxStylesVal; 20323 }, 20324 pixelPosition: function() { 20325 computeStyleTests(); 20326 return pixelPositionVal; 20327 }, 20328 reliableMarginLeft: function() { 20329 computeStyleTests(); 20330 return reliableMarginLeftVal; 20331 }, 20332 scrollboxSize: function() { 20333 computeStyleTests(); 20334 return scrollboxSizeVal; 20335 }, 20336 20337 // Support: IE 9 - 11+, Edge 15 - 18+ 20338 // IE/Edge misreport `getComputedStyle` of table rows with width/height 20339 // set in CSS while `offset*` properties report correct values. 20340 // Behavior in IE 9 is more subtle than in newer versions & it passes 20341 // some versions of this test; make sure not to make it pass there! 20342 // 20343 // Support: Firefox 70+ 20344 // Only Firefox includes border widths 20345 // in computed dimensions. (gh-4529) 20346 reliableTrDimensions: function() { 20347 var table, tr, trChild, trStyle; 20348 if ( reliableTrDimensionsVal == null ) { 20349 table = document.createElement( "table" ); 20350 tr = document.createElement( "tr" ); 20351 trChild = document.createElement( "div" ); 20352 20353 table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate"; 20354 tr.style.cssText = "border:1px solid"; 20355 20356 // Support: Chrome 86+ 20357 // Height set through cssText does not get applied. 20358 // Computed height then comes back as 0. 20359 tr.style.height = "1px"; 20360 trChild.style.height = "9px"; 20361 20362 // Support: Android 8 Chrome 86+ 20363 // In our bodyBackground.html iframe, 20364 // display for all div elements is set to "inline", 20365 // which causes a problem only in Android 8 Chrome 86. 20366 // Ensuring the div is display: block 20367 // gets around this issue. 20368 trChild.style.display = "block"; 20369 20370 documentElement 20371 .appendChild( table ) 20372 .appendChild( tr ) 20373 .appendChild( trChild ); 20374 20375 trStyle = window.getComputedStyle( tr ); 20376 reliableTrDimensionsVal = ( parseInt( trStyle.height, 10 ) + 20377 parseInt( trStyle.borderTopWidth, 10 ) + 20378 parseInt( trStyle.borderBottomWidth, 10 ) ) === tr.offsetHeight; 20379 20380 documentElement.removeChild( table ); 20381 } 20382 return reliableTrDimensionsVal; 20383 } 20384 } ); 20385} )(); 20386 20387 20388function curCSS( elem, name, computed ) { 20389 var width, minWidth, maxWidth, ret, 20390 20391 // Support: Firefox 51+ 20392 // Retrieving style before computed somehow 20393 // fixes an issue with getting wrong values 20394 // on detached elements 20395 style = elem.style; 20396 20397 computed = computed || getStyles( elem ); 20398 20399 // getPropertyValue is needed for: 20400 // .css('filter') (IE 9 only, #12537) 20401 // .css('--customProperty) (#3144) 20402 if ( computed ) { 20403 ret = computed.getPropertyValue( name ) || computed[ name ]; 20404 20405 if ( ret === "" && !isAttached( elem ) ) { 20406 ret = jQuery.style( elem, name ); 20407 } 20408 20409 // A tribute to the "awesome hack by Dean Edwards" 20410 // Android Browser returns percentage for some values, 20411 // but width seems to be reliably pixels. 20412 // This is against the CSSOM draft spec: 20413 // https://drafts.csswg.org/cssom/#resolved-values 20414 if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) { 20415 20416 // Remember the original values 20417 width = style.width; 20418 minWidth = style.minWidth; 20419 maxWidth = style.maxWidth; 20420 20421 // Put in the new values to get a computed value out 20422 style.minWidth = style.maxWidth = style.width = ret; 20423 ret = computed.width; 20424 20425 // Revert the changed values 20426 style.width = width; 20427 style.minWidth = minWidth; 20428 style.maxWidth = maxWidth; 20429 } 20430 } 20431 20432 return ret !== undefined ? 20433 20434 // Support: IE <=9 - 11 only 20435 // IE returns zIndex value as an integer. 20436 ret + "" : 20437 ret; 20438} 20439 20440 20441function addGetHookIf( conditionFn, hookFn ) { 20442 20443 // Define the hook, we'll check on the first run if it's really needed. 20444 return { 20445 get: function() { 20446 if ( conditionFn() ) { 20447 20448 // Hook not needed (or it's not possible to use it due 20449 // to missing dependency), remove it. 20450 delete this.get; 20451 return; 20452 } 20453 20454 // Hook needed; redefine it so that the support test is not executed again. 20455 return ( this.get = hookFn ).apply( this, arguments ); 20456 } 20457 }; 20458} 20459 20460 20461var cssPrefixes = [ "Webkit", "Moz", "ms" ], 20462 emptyStyle = document.createElement( "div" ).style, 20463 vendorProps = {}; 20464 20465// Return a vendor-prefixed property or undefined 20466function vendorPropName( name ) { 20467 20468 // Check for vendor prefixed names 20469 var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), 20470 i = cssPrefixes.length; 20471 20472 while ( i-- ) { 20473 name = cssPrefixes[ i ] + capName; 20474 if ( name in emptyStyle ) { 20475 return name; 20476 } 20477 } 20478} 20479 20480// Return a potentially-mapped jQuery.cssProps or vendor prefixed property 20481function finalPropName( name ) { 20482 var final = jQuery.cssProps[ name ] || vendorProps[ name ]; 20483 20484 if ( final ) { 20485 return final; 20486 } 20487 if ( name in emptyStyle ) { 20488 return name; 20489 } 20490 return vendorProps[ name ] = vendorPropName( name ) || name; 20491} 20492 20493 20494var 20495 20496 // Swappable if display is none or starts with table 20497 // except "table", "table-cell", or "table-caption" 20498 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display 20499 rdisplayswap = /^(none|table(?!-c[ea]).+)/, 20500 rcustomProp = /^--/, 20501 cssShow = { position: "absolute", visibility: "hidden", display: "block" }, 20502 cssNormalTransform = { 20503 letterSpacing: "0", 20504 fontWeight: "400" 20505 }; 20506 20507function setPositiveNumber( _elem, value, subtract ) { 20508 20509 // Any relative (+/-) values have already been 20510 // normalized at this point 20511 var matches = rcssNum.exec( value ); 20512 return matches ? 20513 20514 // Guard against undefined "subtract", e.g., when used as in cssHooks 20515 Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : 20516 value; 20517} 20518 20519function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { 20520 var i = dimension === "width" ? 1 : 0, 20521 extra = 0, 20522 delta = 0; 20523 20524 // Adjustment may not be necessary 20525 if ( box === ( isBorderBox ? "border" : "content" ) ) { 20526 return 0; 20527 } 20528 20529 for ( ; i < 4; i += 2 ) { 20530 20531 // Both box models exclude margin 20532 if ( box === "margin" ) { 20533 delta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); 20534 } 20535 20536 // If we get here with a content-box, we're seeking "padding" or "border" or "margin" 20537 if ( !isBorderBox ) { 20538 20539 // Add padding 20540 delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 20541 20542 // For "border" or "margin", add border 20543 if ( box !== "padding" ) { 20544 delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 20545 20546 // But still keep track of it otherwise 20547 } else { 20548 extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 20549 } 20550 20551 // If we get here with a border-box (content + padding + border), we're seeking "content" or 20552 // "padding" or "margin" 20553 } else { 20554 20555 // For "content", subtract padding 20556 if ( box === "content" ) { 20557 delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 20558 } 20559 20560 // For "content" or "padding", subtract border 20561 if ( box !== "margin" ) { 20562 delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 20563 } 20564 } 20565 } 20566 20567 // Account for positive content-box scroll gutter when requested by providing computedVal 20568 if ( !isBorderBox && computedVal >= 0 ) { 20569 20570 // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border 20571 // Assuming integer scroll gutter, subtract the rest and round down 20572 delta += Math.max( 0, Math.ceil( 20573 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - 20574 computedVal - 20575 delta - 20576 extra - 20577 0.5 20578 20579 // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter 20580 // Use an explicit zero to avoid NaN (gh-3964) 20581 ) ) || 0; 20582 } 20583 20584 return delta; 20585} 20586 20587function getWidthOrHeight( elem, dimension, extra ) { 20588 20589 // Start with computed style 20590 var styles = getStyles( elem ), 20591 20592 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322). 20593 // Fake content-box until we know it's needed to know the true value. 20594 boxSizingNeeded = !support.boxSizingReliable() || extra, 20595 isBorderBox = boxSizingNeeded && 20596 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 20597 valueIsBorderBox = isBorderBox, 20598 20599 val = curCSS( elem, dimension, styles ), 20600 offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ); 20601 20602 // Support: Firefox <=54 20603 // Return a confounding non-pixel value or feign ignorance, as appropriate. 20604 if ( rnumnonpx.test( val ) ) { 20605 if ( !extra ) { 20606 return val; 20607 } 20608 val = "auto"; 20609 } 20610 20611 20612 // Support: IE 9 - 11 only 20613 // Use offsetWidth/offsetHeight for when box sizing is unreliable. 20614 // In those cases, the computed value can be trusted to be border-box. 20615 if ( ( !support.boxSizingReliable() && isBorderBox || 20616 20617 // Support: IE 10 - 11+, Edge 15 - 18+ 20618 // IE/Edge misreport `getComputedStyle` of table rows with width/height 20619 // set in CSS while `offset*` properties report correct values. 20620 // Interestingly, in some cases IE 9 doesn't suffer from this issue. 20621 !support.reliableTrDimensions() && nodeName( elem, "tr" ) || 20622 20623 // Fall back to offsetWidth/offsetHeight when value is "auto" 20624 // This happens for inline elements with no explicit setting (gh-3571) 20625 val === "auto" || 20626 20627 // Support: Android <=4.1 - 4.3 only 20628 // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) 20629 !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) && 20630 20631 // Make sure the element is visible & connected 20632 elem.getClientRects().length ) { 20633 20634 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; 20635 20636 // Where available, offsetWidth/offsetHeight approximate border box dimensions. 20637 // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the 20638 // retrieved value as a content box dimension. 20639 valueIsBorderBox = offsetProp in elem; 20640 if ( valueIsBorderBox ) { 20641 val = elem[ offsetProp ]; 20642 } 20643 } 20644 20645 // Normalize "" and auto 20646 val = parseFloat( val ) || 0; 20647 20648 // Adjust for the element's box model 20649 return ( val + 20650 boxModelAdjustment( 20651 elem, 20652 dimension, 20653 extra || ( isBorderBox ? "border" : "content" ), 20654 valueIsBorderBox, 20655 styles, 20656 20657 // Provide the current computed size to request scroll gutter calculation (gh-3589) 20658 val 20659 ) 20660 ) + "px"; 20661} 20662 20663jQuery.extend( { 20664 20665 // Add in style property hooks for overriding the default 20666 // behavior of getting and setting a style property 20667 cssHooks: { 20668 opacity: { 20669 get: function( elem, computed ) { 20670 if ( computed ) { 20671 20672 // We should always get a number back from opacity 20673 var ret = curCSS( elem, "opacity" ); 20674 return ret === "" ? "1" : ret; 20675 } 20676 } 20677 } 20678 }, 20679 20680 // Don't automatically add "px" to these possibly-unitless properties 20681 cssNumber: { 20682 "animationIterationCount": true, 20683 "columnCount": true, 20684 "fillOpacity": true, 20685 "flexGrow": true, 20686 "flexShrink": true, 20687 "fontWeight": true, 20688 "gridArea": true, 20689 "gridColumn": true, 20690 "gridColumnEnd": true, 20691 "gridColumnStart": true, 20692 "gridRow": true, 20693 "gridRowEnd": true, 20694 "gridRowStart": true, 20695 "lineHeight": true, 20696 "opacity": true, 20697 "order": true, 20698 "orphans": true, 20699 "widows": true, 20700 "zIndex": true, 20701 "zoom": true 20702 }, 20703 20704 // Add in properties whose names you wish to fix before 20705 // setting or getting the value 20706 cssProps: {}, 20707 20708 // Get and set the style property on a DOM Node 20709 style: function( elem, name, value, extra ) { 20710 20711 // Don't set styles on text and comment nodes 20712 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { 20713 return; 20714 } 20715 20716 // Make sure that we're working with the right name 20717 var ret, type, hooks, 20718 origName = camelCase( name ), 20719 isCustomProp = rcustomProp.test( name ), 20720 style = elem.style; 20721 20722 // Make sure that we're working with the right name. We don't 20723 // want to query the value if it is a CSS custom property 20724 // since they are user-defined. 20725 if ( !isCustomProp ) { 20726 name = finalPropName( origName ); 20727 } 20728 20729 // Gets hook for the prefixed version, then unprefixed version 20730 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 20731 20732 // Check if we're setting a value 20733 if ( value !== undefined ) { 20734 type = typeof value; 20735 20736 // Convert "+=" or "-=" to relative numbers (#7345) 20737 if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { 20738 value = adjustCSS( elem, name, ret ); 20739 20740 // Fixes bug #9237 20741 type = "number"; 20742 } 20743 20744 // Make sure that null and NaN values aren't set (#7116) 20745 if ( value == null || value !== value ) { 20746 return; 20747 } 20748 20749 // If a number was passed in, add the unit (except for certain CSS properties) 20750 // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append 20751 // "px" to a few hardcoded values. 20752 if ( type === "number" && !isCustomProp ) { 20753 value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); 20754 } 20755 20756 // background-* props affect original clone's values 20757 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { 20758 style[ name ] = "inherit"; 20759 } 20760 20761 // If a hook was provided, use that value, otherwise just set the specified value 20762 if ( !hooks || !( "set" in hooks ) || 20763 ( value = hooks.set( elem, value, extra ) ) !== undefined ) { 20764 20765 if ( isCustomProp ) { 20766 style.setProperty( name, value ); 20767 } else { 20768 style[ name ] = value; 20769 } 20770 } 20771 20772 } else { 20773 20774 // If a hook was provided get the non-computed value from there 20775 if ( hooks && "get" in hooks && 20776 ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { 20777 20778 return ret; 20779 } 20780 20781 // Otherwise just get the value from the style object 20782 return style[ name ]; 20783 } 20784 }, 20785 20786 css: function( elem, name, extra, styles ) { 20787 var val, num, hooks, 20788 origName = camelCase( name ), 20789 isCustomProp = rcustomProp.test( name ); 20790 20791 // Make sure that we're working with the right name. We don't 20792 // want to modify the value if it is a CSS custom property 20793 // since they are user-defined. 20794 if ( !isCustomProp ) { 20795 name = finalPropName( origName ); 20796 } 20797 20798 // Try prefixed name followed by the unprefixed name 20799 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 20800 20801 // If a hook was provided get the computed value from there 20802 if ( hooks && "get" in hooks ) { 20803 val = hooks.get( elem, true, extra ); 20804 } 20805 20806 // Otherwise, if a way to get the computed value exists, use that 20807 if ( val === undefined ) { 20808 val = curCSS( elem, name, styles ); 20809 } 20810 20811 // Convert "normal" to computed value 20812 if ( val === "normal" && name in cssNormalTransform ) { 20813 val = cssNormalTransform[ name ]; 20814 } 20815 20816 // Make numeric if forced or a qualifier was provided and val looks numeric 20817 if ( extra === "" || extra ) { 20818 num = parseFloat( val ); 20819 return extra === true || isFinite( num ) ? num || 0 : val; 20820 } 20821 20822 return val; 20823 } 20824} ); 20825 20826jQuery.each( [ "height", "width" ], function( _i, dimension ) { 20827 jQuery.cssHooks[ dimension ] = { 20828 get: function( elem, computed, extra ) { 20829 if ( computed ) { 20830 20831 // Certain elements can have dimension info if we invisibly show them 20832 // but it must have a current display style that would benefit 20833 return rdisplayswap.test( jQuery.css( elem, "display" ) ) && 20834 20835 // Support: Safari 8+ 20836 // Table columns in Safari have non-zero offsetWidth & zero 20837 // getBoundingClientRect().width unless display is changed. 20838 // Support: IE <=11 only 20839 // Running getBoundingClientRect on a disconnected node 20840 // in IE throws an error. 20841 ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? 20842 swap( elem, cssShow, function() { 20843 return getWidthOrHeight( elem, dimension, extra ); 20844 } ) : 20845 getWidthOrHeight( elem, dimension, extra ); 20846 } 20847 }, 20848 20849 set: function( elem, value, extra ) { 20850 var matches, 20851 styles = getStyles( elem ), 20852 20853 // Only read styles.position if the test has a chance to fail 20854 // to avoid forcing a reflow. 20855 scrollboxSizeBuggy = !support.scrollboxSize() && 20856 styles.position === "absolute", 20857 20858 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991) 20859 boxSizingNeeded = scrollboxSizeBuggy || extra, 20860 isBorderBox = boxSizingNeeded && 20861 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 20862 subtract = extra ? 20863 boxModelAdjustment( 20864 elem, 20865 dimension, 20866 extra, 20867 isBorderBox, 20868 styles 20869 ) : 20870 0; 20871 20872 // Account for unreliable border-box dimensions by comparing offset* to computed and 20873 // faking a content-box to get border and padding (gh-3699) 20874 if ( isBorderBox && scrollboxSizeBuggy ) { 20875 subtract -= Math.ceil( 20876 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - 20877 parseFloat( styles[ dimension ] ) - 20878 boxModelAdjustment( elem, dimension, "border", false, styles ) - 20879 0.5 20880 ); 20881 } 20882 20883 // Convert to pixels if value adjustment is needed 20884 if ( subtract && ( matches = rcssNum.exec( value ) ) && 20885 ( matches[ 3 ] || "px" ) !== "px" ) { 20886 20887 elem.style[ dimension ] = value; 20888 value = jQuery.css( elem, dimension ); 20889 } 20890 20891 return setPositiveNumber( elem, value, subtract ); 20892 } 20893 }; 20894} ); 20895 20896jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, 20897 function( elem, computed ) { 20898 if ( computed ) { 20899 return ( parseFloat( curCSS( elem, "marginLeft" ) ) || 20900 elem.getBoundingClientRect().left - 20901 swap( elem, { marginLeft: 0 }, function() { 20902 return elem.getBoundingClientRect().left; 20903 } ) 20904 ) + "px"; 20905 } 20906 } 20907); 20908 20909// These hooks are used by animate to expand properties 20910jQuery.each( { 20911 margin: "", 20912 padding: "", 20913 border: "Width" 20914}, function( prefix, suffix ) { 20915 jQuery.cssHooks[ prefix + suffix ] = { 20916 expand: function( value ) { 20917 var i = 0, 20918 expanded = {}, 20919 20920 // Assumes a single number if not a string 20921 parts = typeof value === "string" ? value.split( " " ) : [ value ]; 20922 20923 for ( ; i < 4; i++ ) { 20924 expanded[ prefix + cssExpand[ i ] + suffix ] = 20925 parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; 20926 } 20927 20928 return expanded; 20929 } 20930 }; 20931 20932 if ( prefix !== "margin" ) { 20933 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; 20934 } 20935} ); 20936 20937jQuery.fn.extend( { 20938 css: function( name, value ) { 20939 return access( this, function( elem, name, value ) { 20940 var styles, len, 20941 map = {}, 20942 i = 0; 20943 20944 if ( Array.isArray( name ) ) { 20945 styles = getStyles( elem ); 20946 len = name.length; 20947 20948 for ( ; i < len; i++ ) { 20949 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); 20950 } 20951 20952 return map; 20953 } 20954 20955 return value !== undefined ? 20956 jQuery.style( elem, name, value ) : 20957 jQuery.css( elem, name ); 20958 }, name, value, arguments.length > 1 ); 20959 } 20960} ); 20961 20962 20963function Tween( elem, options, prop, end, easing ) { 20964 return new Tween.prototype.init( elem, options, prop, end, easing ); 20965} 20966jQuery.Tween = Tween; 20967 20968Tween.prototype = { 20969 constructor: Tween, 20970 init: function( elem, options, prop, end, easing, unit ) { 20971 this.elem = elem; 20972 this.prop = prop; 20973 this.easing = easing || jQuery.easing._default; 20974 this.options = options; 20975 this.start = this.now = this.cur(); 20976 this.end = end; 20977 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); 20978 }, 20979 cur: function() { 20980 var hooks = Tween.propHooks[ this.prop ]; 20981 20982 return hooks && hooks.get ? 20983 hooks.get( this ) : 20984 Tween.propHooks._default.get( this ); 20985 }, 20986 run: function( percent ) { 20987 var eased, 20988 hooks = Tween.propHooks[ this.prop ]; 20989 20990 if ( this.options.duration ) { 20991 this.pos = eased = jQuery.easing[ this.easing ]( 20992 percent, this.options.duration * percent, 0, 1, this.options.duration 20993 ); 20994 } else { 20995 this.pos = eased = percent; 20996 } 20997 this.now = ( this.end - this.start ) * eased + this.start; 20998 20999 if ( this.options.step ) { 21000 this.options.step.call( this.elem, this.now, this ); 21001 } 21002 21003 if ( hooks && hooks.set ) { 21004 hooks.set( this ); 21005 } else { 21006 Tween.propHooks._default.set( this ); 21007 } 21008 return this; 21009 } 21010}; 21011 21012Tween.prototype.init.prototype = Tween.prototype; 21013 21014Tween.propHooks = { 21015 _default: { 21016 get: function( tween ) { 21017 var result; 21018 21019 // Use a property on the element directly when it is not a DOM element, 21020 // or when there is no matching style property that exists. 21021 if ( tween.elem.nodeType !== 1 || 21022 tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { 21023 return tween.elem[ tween.prop ]; 21024 } 21025 21026 // Passing an empty string as a 3rd parameter to .css will automatically 21027 // attempt a parseFloat and fallback to a string if the parse fails. 21028 // Simple values such as "10px" are parsed to Float; 21029 // complex values such as "rotate(1rad)" are returned as-is. 21030 result = jQuery.css( tween.elem, tween.prop, "" ); 21031 21032 // Empty strings, null, undefined and "auto" are converted to 0. 21033 return !result || result === "auto" ? 0 : result; 21034 }, 21035 set: function( tween ) { 21036 21037 // Use step hook for back compat. 21038 // Use cssHook if its there. 21039 // Use .style if available and use plain properties where available. 21040 if ( jQuery.fx.step[ tween.prop ] ) { 21041 jQuery.fx.step[ tween.prop ]( tween ); 21042 } else if ( tween.elem.nodeType === 1 && ( 21043 jQuery.cssHooks[ tween.prop ] || 21044 tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) { 21045 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); 21046 } else { 21047 tween.elem[ tween.prop ] = tween.now; 21048 } 21049 } 21050 } 21051}; 21052 21053// Support: IE <=9 only 21054// Panic based approach to setting things on disconnected nodes 21055Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { 21056 set: function( tween ) { 21057 if ( tween.elem.nodeType && tween.elem.parentNode ) { 21058 tween.elem[ tween.prop ] = tween.now; 21059 } 21060 } 21061}; 21062 21063jQuery.easing = { 21064 linear: function( p ) { 21065 return p; 21066 }, 21067 swing: function( p ) { 21068 return 0.5 - Math.cos( p * Math.PI ) / 2; 21069 }, 21070 _default: "swing" 21071}; 21072 21073jQuery.fx = Tween.prototype.init; 21074 21075// Back compat <1.8 extension point 21076jQuery.fx.step = {}; 21077 21078 21079 21080 21081var 21082 fxNow, inProgress, 21083 rfxtypes = /^(?:toggle|show|hide)$/, 21084 rrun = /queueHooks$/; 21085 21086function schedule() { 21087 if ( inProgress ) { 21088 if ( document.hidden === false && window.requestAnimationFrame ) { 21089 window.requestAnimationFrame( schedule ); 21090 } else { 21091 window.setTimeout( schedule, jQuery.fx.interval ); 21092 } 21093 21094 jQuery.fx.tick(); 21095 } 21096} 21097 21098// Animations created synchronously will run synchronously 21099function createFxNow() { 21100 window.setTimeout( function() { 21101 fxNow = undefined; 21102 } ); 21103 return ( fxNow = Date.now() ); 21104} 21105 21106// Generate parameters to create a standard animation 21107function genFx( type, includeWidth ) { 21108 var which, 21109 i = 0, 21110 attrs = { height: type }; 21111 21112 // If we include width, step value is 1 to do all cssExpand values, 21113 // otherwise step value is 2 to skip over Left and Right 21114 includeWidth = includeWidth ? 1 : 0; 21115 for ( ; i < 4; i += 2 - includeWidth ) { 21116 which = cssExpand[ i ]; 21117 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; 21118 } 21119 21120 if ( includeWidth ) { 21121 attrs.opacity = attrs.width = type; 21122 } 21123 21124 return attrs; 21125} 21126 21127function createTween( value, prop, animation ) { 21128 var tween, 21129 collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), 21130 index = 0, 21131 length = collection.length; 21132 for ( ; index < length; index++ ) { 21133 if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { 21134 21135 // We're done with this property 21136 return tween; 21137 } 21138 } 21139} 21140 21141function defaultPrefilter( elem, props, opts ) { 21142 var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, 21143 isBox = "width" in props || "height" in props, 21144 anim = this, 21145 orig = {}, 21146 style = elem.style, 21147 hidden = elem.nodeType && isHiddenWithinTree( elem ), 21148 dataShow = dataPriv.get( elem, "fxshow" ); 21149 21150 // Queue-skipping animations hijack the fx hooks 21151 if ( !opts.queue ) { 21152 hooks = jQuery._queueHooks( elem, "fx" ); 21153 if ( hooks.unqueued == null ) { 21154 hooks.unqueued = 0; 21155 oldfire = hooks.empty.fire; 21156 hooks.empty.fire = function() { 21157 if ( !hooks.unqueued ) { 21158 oldfire(); 21159 } 21160 }; 21161 } 21162 hooks.unqueued++; 21163 21164 anim.always( function() { 21165 21166 // Ensure the complete handler is called before this completes 21167 anim.always( function() { 21168 hooks.unqueued--; 21169 if ( !jQuery.queue( elem, "fx" ).length ) { 21170 hooks.empty.fire(); 21171 } 21172 } ); 21173 } ); 21174 } 21175 21176 // Detect show/hide animations 21177 for ( prop in props ) { 21178 value = props[ prop ]; 21179 if ( rfxtypes.test( value ) ) { 21180 delete props[ prop ]; 21181 toggle = toggle || value === "toggle"; 21182 if ( value === ( hidden ? "hide" : "show" ) ) { 21183 21184 // Pretend to be hidden if this is a "show" and 21185 // there is still data from a stopped show/hide 21186 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { 21187 hidden = true; 21188 21189 // Ignore all other no-op show/hide data 21190 } else { 21191 continue; 21192 } 21193 } 21194 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); 21195 } 21196 } 21197 21198 // Bail out if this is a no-op like .hide().hide() 21199 propTween = !jQuery.isEmptyObject( props ); 21200 if ( !propTween && jQuery.isEmptyObject( orig ) ) { 21201 return; 21202 } 21203 21204 // Restrict "overflow" and "display" styles during box animations 21205 if ( isBox && elem.nodeType === 1 ) { 21206 21207 // Support: IE <=9 - 11, Edge 12 - 15 21208 // Record all 3 overflow attributes because IE does not infer the shorthand 21209 // from identically-valued overflowX and overflowY and Edge just mirrors 21210 // the overflowX value there. 21211 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; 21212 21213 // Identify a display type, preferring old show/hide data over the CSS cascade 21214 restoreDisplay = dataShow && dataShow.display; 21215 if ( restoreDisplay == null ) { 21216 restoreDisplay = dataPriv.get( elem, "display" ); 21217 } 21218 display = jQuery.css( elem, "display" ); 21219 if ( display === "none" ) { 21220 if ( restoreDisplay ) { 21221 display = restoreDisplay; 21222 } else { 21223 21224 // Get nonempty value(s) by temporarily forcing visibility 21225 showHide( [ elem ], true ); 21226 restoreDisplay = elem.style.display || restoreDisplay; 21227 display = jQuery.css( elem, "display" ); 21228 showHide( [ elem ] ); 21229 } 21230 } 21231 21232 // Animate inline elements as inline-block 21233 if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { 21234 if ( jQuery.css( elem, "float" ) === "none" ) { 21235 21236 // Restore the original display value at the end of pure show/hide animations 21237 if ( !propTween ) { 21238 anim.done( function() { 21239 style.display = restoreDisplay; 21240 } ); 21241 if ( restoreDisplay == null ) { 21242 display = style.display; 21243 restoreDisplay = display === "none" ? "" : display; 21244 } 21245 } 21246 style.display = "inline-block"; 21247 } 21248 } 21249 } 21250 21251 if ( opts.overflow ) { 21252 style.overflow = "hidden"; 21253 anim.always( function() { 21254 style.overflow = opts.overflow[ 0 ]; 21255 style.overflowX = opts.overflow[ 1 ]; 21256 style.overflowY = opts.overflow[ 2 ]; 21257 } ); 21258 } 21259 21260 // Implement show/hide animations 21261 propTween = false; 21262 for ( prop in orig ) { 21263 21264 // General show/hide setup for this element animation 21265 if ( !propTween ) { 21266 if ( dataShow ) { 21267 if ( "hidden" in dataShow ) { 21268 hidden = dataShow.hidden; 21269 } 21270 } else { 21271 dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); 21272 } 21273 21274 // Store hidden/visible for toggle so `.stop().toggle()` "reverses" 21275 if ( toggle ) { 21276 dataShow.hidden = !hidden; 21277 } 21278 21279 // Show elements before animating them 21280 if ( hidden ) { 21281 showHide( [ elem ], true ); 21282 } 21283 21284 /* eslint-disable no-loop-func */ 21285 21286 anim.done( function() { 21287 21288 /* eslint-enable no-loop-func */ 21289 21290 // The final step of a "hide" animation is actually hiding the element 21291 if ( !hidden ) { 21292 showHide( [ elem ] ); 21293 } 21294 dataPriv.remove( elem, "fxshow" ); 21295 for ( prop in orig ) { 21296 jQuery.style( elem, prop, orig[ prop ] ); 21297 } 21298 } ); 21299 } 21300 21301 // Per-property setup 21302 propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); 21303 if ( !( prop in dataShow ) ) { 21304 dataShow[ prop ] = propTween.start; 21305 if ( hidden ) { 21306 propTween.end = propTween.start; 21307 propTween.start = 0; 21308 } 21309 } 21310 } 21311} 21312 21313function propFilter( props, specialEasing ) { 21314 var index, name, easing, value, hooks; 21315 21316 // camelCase, specialEasing and expand cssHook pass 21317 for ( index in props ) { 21318 name = camelCase( index ); 21319 easing = specialEasing[ name ]; 21320 value = props[ index ]; 21321 if ( Array.isArray( value ) ) { 21322 easing = value[ 1 ]; 21323 value = props[ index ] = value[ 0 ]; 21324 } 21325 21326 if ( index !== name ) { 21327 props[ name ] = value; 21328 delete props[ index ]; 21329 } 21330 21331 hooks = jQuery.cssHooks[ name ]; 21332 if ( hooks && "expand" in hooks ) { 21333 value = hooks.expand( value ); 21334 delete props[ name ]; 21335 21336 // Not quite $.extend, this won't overwrite existing keys. 21337 // Reusing 'index' because we have the correct "name" 21338 for ( index in value ) { 21339 if ( !( index in props ) ) { 21340 props[ index ] = value[ index ]; 21341 specialEasing[ index ] = easing; 21342 } 21343 } 21344 } else { 21345 specialEasing[ name ] = easing; 21346 } 21347 } 21348} 21349 21350function Animation( elem, properties, options ) { 21351 var result, 21352 stopped, 21353 index = 0, 21354 length = Animation.prefilters.length, 21355 deferred = jQuery.Deferred().always( function() { 21356 21357 // Don't match elem in the :animated selector 21358 delete tick.elem; 21359 } ), 21360 tick = function() { 21361 if ( stopped ) { 21362 return false; 21363 } 21364 var currentTime = fxNow || createFxNow(), 21365 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), 21366 21367 // Support: Android 2.3 only 21368 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) 21369 temp = remaining / animation.duration || 0, 21370 percent = 1 - temp, 21371 index = 0, 21372 length = animation.tweens.length; 21373 21374 for ( ; index < length; index++ ) { 21375 animation.tweens[ index ].run( percent ); 21376 } 21377 21378 deferred.notifyWith( elem, [ animation, percent, remaining ] ); 21379 21380 // If there's more to do, yield 21381 if ( percent < 1 && length ) { 21382 return remaining; 21383 } 21384 21385 // If this was an empty animation, synthesize a final progress notification 21386 if ( !length ) { 21387 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 21388 } 21389 21390 // Resolve the animation and report its conclusion 21391 deferred.resolveWith( elem, [ animation ] ); 21392 return false; 21393 }, 21394 animation = deferred.promise( { 21395 elem: elem, 21396 props: jQuery.extend( {}, properties ), 21397 opts: jQuery.extend( true, { 21398 specialEasing: {}, 21399 easing: jQuery.easing._default 21400 }, options ), 21401 originalProperties: properties, 21402 originalOptions: options, 21403 startTime: fxNow || createFxNow(), 21404 duration: options.duration, 21405 tweens: [], 21406 createTween: function( prop, end ) { 21407 var tween = jQuery.Tween( elem, animation.opts, prop, end, 21408 animation.opts.specialEasing[ prop ] || animation.opts.easing ); 21409 animation.tweens.push( tween ); 21410 return tween; 21411 }, 21412 stop: function( gotoEnd ) { 21413 var index = 0, 21414 21415 // If we are going to the end, we want to run all the tweens 21416 // otherwise we skip this part 21417 length = gotoEnd ? animation.tweens.length : 0; 21418 if ( stopped ) { 21419 return this; 21420 } 21421 stopped = true; 21422 for ( ; index < length; index++ ) { 21423 animation.tweens[ index ].run( 1 ); 21424 } 21425 21426 // Resolve when we played the last frame; otherwise, reject 21427 if ( gotoEnd ) { 21428 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 21429 deferred.resolveWith( elem, [ animation, gotoEnd ] ); 21430 } else { 21431 deferred.rejectWith( elem, [ animation, gotoEnd ] ); 21432 } 21433 return this; 21434 } 21435 } ), 21436 props = animation.props; 21437 21438 propFilter( props, animation.opts.specialEasing ); 21439 21440 for ( ; index < length; index++ ) { 21441 result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); 21442 if ( result ) { 21443 if ( isFunction( result.stop ) ) { 21444 jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = 21445 result.stop.bind( result ); 21446 } 21447 return result; 21448 } 21449 } 21450 21451 jQuery.map( props, createTween, animation ); 21452 21453 if ( isFunction( animation.opts.start ) ) { 21454 animation.opts.start.call( elem, animation ); 21455 } 21456 21457 // Attach callbacks from options 21458 animation 21459 .progress( animation.opts.progress ) 21460 .done( animation.opts.done, animation.opts.complete ) 21461 .fail( animation.opts.fail ) 21462 .always( animation.opts.always ); 21463 21464 jQuery.fx.timer( 21465 jQuery.extend( tick, { 21466 elem: elem, 21467 anim: animation, 21468 queue: animation.opts.queue 21469 } ) 21470 ); 21471 21472 return animation; 21473} 21474 21475jQuery.Animation = jQuery.extend( Animation, { 21476 21477 tweeners: { 21478 "*": [ function( prop, value ) { 21479 var tween = this.createTween( prop, value ); 21480 adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); 21481 return tween; 21482 } ] 21483 }, 21484 21485 tweener: function( props, callback ) { 21486 if ( isFunction( props ) ) { 21487 callback = props; 21488 props = [ "*" ]; 21489 } else { 21490 props = props.match( rnothtmlwhite ); 21491 } 21492 21493 var prop, 21494 index = 0, 21495 length = props.length; 21496 21497 for ( ; index < length; index++ ) { 21498 prop = props[ index ]; 21499 Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; 21500 Animation.tweeners[ prop ].unshift( callback ); 21501 } 21502 }, 21503 21504 prefilters: [ defaultPrefilter ], 21505 21506 prefilter: function( callback, prepend ) { 21507 if ( prepend ) { 21508 Animation.prefilters.unshift( callback ); 21509 } else { 21510 Animation.prefilters.push( callback ); 21511 } 21512 } 21513} ); 21514 21515jQuery.speed = function( speed, easing, fn ) { 21516 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { 21517 complete: fn || !fn && easing || 21518 isFunction( speed ) && speed, 21519 duration: speed, 21520 easing: fn && easing || easing && !isFunction( easing ) && easing 21521 }; 21522 21523 // Go to the end state if fx are off 21524 if ( jQuery.fx.off ) { 21525 opt.duration = 0; 21526 21527 } else { 21528 if ( typeof opt.duration !== "number" ) { 21529 if ( opt.duration in jQuery.fx.speeds ) { 21530 opt.duration = jQuery.fx.speeds[ opt.duration ]; 21531 21532 } else { 21533 opt.duration = jQuery.fx.speeds._default; 21534 } 21535 } 21536 } 21537 21538 // Normalize opt.queue - true/undefined/null -> "fx" 21539 if ( opt.queue == null || opt.queue === true ) { 21540 opt.queue = "fx"; 21541 } 21542 21543 // Queueing 21544 opt.old = opt.complete; 21545 21546 opt.complete = function() { 21547 if ( isFunction( opt.old ) ) { 21548 opt.old.call( this ); 21549 } 21550 21551 if ( opt.queue ) { 21552 jQuery.dequeue( this, opt.queue ); 21553 } 21554 }; 21555 21556 return opt; 21557}; 21558 21559jQuery.fn.extend( { 21560 fadeTo: function( speed, to, easing, callback ) { 21561 21562 // Show any hidden elements after setting opacity to 0 21563 return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() 21564 21565 // Animate to the value specified 21566 .end().animate( { opacity: to }, speed, easing, callback ); 21567 }, 21568 animate: function( prop, speed, easing, callback ) { 21569 var empty = jQuery.isEmptyObject( prop ), 21570 optall = jQuery.speed( speed, easing, callback ), 21571 doAnimation = function() { 21572 21573 // Operate on a copy of prop so per-property easing won't be lost 21574 var anim = Animation( this, jQuery.extend( {}, prop ), optall ); 21575 21576 // Empty animations, or finishing resolves immediately 21577 if ( empty || dataPriv.get( this, "finish" ) ) { 21578 anim.stop( true ); 21579 } 21580 }; 21581 21582 doAnimation.finish = doAnimation; 21583 21584 return empty || optall.queue === false ? 21585 this.each( doAnimation ) : 21586 this.queue( optall.queue, doAnimation ); 21587 }, 21588 stop: function( type, clearQueue, gotoEnd ) { 21589 var stopQueue = function( hooks ) { 21590 var stop = hooks.stop; 21591 delete hooks.stop; 21592 stop( gotoEnd ); 21593 }; 21594 21595 if ( typeof type !== "string" ) { 21596 gotoEnd = clearQueue; 21597 clearQueue = type; 21598 type = undefined; 21599 } 21600 if ( clearQueue ) { 21601 this.queue( type || "fx", [] ); 21602 } 21603 21604 return this.each( function() { 21605 var dequeue = true, 21606 index = type != null && type + "queueHooks", 21607 timers = jQuery.timers, 21608 data = dataPriv.get( this ); 21609 21610 if ( index ) { 21611 if ( data[ index ] && data[ index ].stop ) { 21612 stopQueue( data[ index ] ); 21613 } 21614 } else { 21615 for ( index in data ) { 21616 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { 21617 stopQueue( data[ index ] ); 21618 } 21619 } 21620 } 21621 21622 for ( index = timers.length; index--; ) { 21623 if ( timers[ index ].elem === this && 21624 ( type == null || timers[ index ].queue === type ) ) { 21625 21626 timers[ index ].anim.stop( gotoEnd ); 21627 dequeue = false; 21628 timers.splice( index, 1 ); 21629 } 21630 } 21631 21632 // Start the next in the queue if the last step wasn't forced. 21633 // Timers currently will call their complete callbacks, which 21634 // will dequeue but only if they were gotoEnd. 21635 if ( dequeue || !gotoEnd ) { 21636 jQuery.dequeue( this, type ); 21637 } 21638 } ); 21639 }, 21640 finish: function( type ) { 21641 if ( type !== false ) { 21642 type = type || "fx"; 21643 } 21644 return this.each( function() { 21645 var index, 21646 data = dataPriv.get( this ), 21647 queue = data[ type + "queue" ], 21648 hooks = data[ type + "queueHooks" ], 21649 timers = jQuery.timers, 21650 length = queue ? queue.length : 0; 21651 21652 // Enable finishing flag on private data 21653 data.finish = true; 21654 21655 // Empty the queue first 21656 jQuery.queue( this, type, [] ); 21657 21658 if ( hooks && hooks.stop ) { 21659 hooks.stop.call( this, true ); 21660 } 21661 21662 // Look for any active animations, and finish them 21663 for ( index = timers.length; index--; ) { 21664 if ( timers[ index ].elem === this && timers[ index ].queue === type ) { 21665 timers[ index ].anim.stop( true ); 21666 timers.splice( index, 1 ); 21667 } 21668 } 21669 21670 // Look for any animations in the old queue and finish them 21671 for ( index = 0; index < length; index++ ) { 21672 if ( queue[ index ] && queue[ index ].finish ) { 21673 queue[ index ].finish.call( this ); 21674 } 21675 } 21676 21677 // Turn off finishing flag 21678 delete data.finish; 21679 } ); 21680 } 21681} ); 21682 21683jQuery.each( [ "toggle", "show", "hide" ], function( _i, name ) { 21684 var cssFn = jQuery.fn[ name ]; 21685 jQuery.fn[ name ] = function( speed, easing, callback ) { 21686 return speed == null || typeof speed === "boolean" ? 21687 cssFn.apply( this, arguments ) : 21688 this.animate( genFx( name, true ), speed, easing, callback ); 21689 }; 21690} ); 21691 21692// Generate shortcuts for custom animations 21693jQuery.each( { 21694 slideDown: genFx( "show" ), 21695 slideUp: genFx( "hide" ), 21696 slideToggle: genFx( "toggle" ), 21697 fadeIn: { opacity: "show" }, 21698 fadeOut: { opacity: "hide" }, 21699 fadeToggle: { opacity: "toggle" } 21700}, function( name, props ) { 21701 jQuery.fn[ name ] = function( speed, easing, callback ) { 21702 return this.animate( props, speed, easing, callback ); 21703 }; 21704} ); 21705 21706jQuery.timers = []; 21707jQuery.fx.tick = function() { 21708 var timer, 21709 i = 0, 21710 timers = jQuery.timers; 21711 21712 fxNow = Date.now(); 21713 21714 for ( ; i < timers.length; i++ ) { 21715 timer = timers[ i ]; 21716 21717 // Run the timer and safely remove it when done (allowing for external removal) 21718 if ( !timer() && timers[ i ] === timer ) { 21719 timers.splice( i--, 1 ); 21720 } 21721 } 21722 21723 if ( !timers.length ) { 21724 jQuery.fx.stop(); 21725 } 21726 fxNow = undefined; 21727}; 21728 21729jQuery.fx.timer = function( timer ) { 21730 jQuery.timers.push( timer ); 21731 jQuery.fx.start(); 21732}; 21733 21734jQuery.fx.interval = 13; 21735jQuery.fx.start = function() { 21736 if ( inProgress ) { 21737 return; 21738 } 21739 21740 inProgress = true; 21741 schedule(); 21742}; 21743 21744jQuery.fx.stop = function() { 21745 inProgress = null; 21746}; 21747 21748jQuery.fx.speeds = { 21749 slow: 600, 21750 fast: 200, 21751 21752 // Default speed 21753 _default: 400 21754}; 21755 21756 21757// Based off of the plugin by Clint Helfers, with permission. 21758// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/ 21759jQuery.fn.delay = function( time, type ) { 21760 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; 21761 type = type || "fx"; 21762 21763 return this.queue( type, function( next, hooks ) { 21764 var timeout = window.setTimeout( next, time ); 21765 hooks.stop = function() { 21766 window.clearTimeout( timeout ); 21767 }; 21768 } ); 21769}; 21770 21771 21772( function() { 21773 var input = document.createElement( "input" ), 21774 select = document.createElement( "select" ), 21775 opt = select.appendChild( document.createElement( "option" ) ); 21776 21777 input.type = "checkbox"; 21778 21779 // Support: Android <=4.3 only 21780 // Default value for a checkbox should be "on" 21781 support.checkOn = input.value !== ""; 21782 21783 // Support: IE <=11 only 21784 // Must access selectedIndex to make default options select 21785 support.optSelected = opt.selected; 21786 21787 // Support: IE <=11 only 21788 // An input loses its value after becoming a radio 21789 input = document.createElement( "input" ); 21790 input.value = "t"; 21791 input.type = "radio"; 21792 support.radioValue = input.value === "t"; 21793} )(); 21794 21795 21796var boolHook, 21797 attrHandle = jQuery.expr.attrHandle; 21798 21799jQuery.fn.extend( { 21800 attr: function( name, value ) { 21801 return access( this, jQuery.attr, name, value, arguments.length > 1 ); 21802 }, 21803 21804 removeAttr: function( name ) { 21805 return this.each( function() { 21806 jQuery.removeAttr( this, name ); 21807 } ); 21808 } 21809} ); 21810 21811jQuery.extend( { 21812 attr: function( elem, name, value ) { 21813 var ret, hooks, 21814 nType = elem.nodeType; 21815 21816 // Don't get/set attributes on text, comment and attribute nodes 21817 if ( nType === 3 || nType === 8 || nType === 2 ) { 21818 return; 21819 } 21820 21821 // Fallback to prop when attributes are not supported 21822 if ( typeof elem.getAttribute === "undefined" ) { 21823 return jQuery.prop( elem, name, value ); 21824 } 21825 21826 // Attribute hooks are determined by the lowercase version 21827 // Grab necessary hook if one is defined 21828 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 21829 hooks = jQuery.attrHooks[ name.toLowerCase() ] || 21830 ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); 21831 } 21832 21833 if ( value !== undefined ) { 21834 if ( value === null ) { 21835 jQuery.removeAttr( elem, name ); 21836 return; 21837 } 21838 21839 if ( hooks && "set" in hooks && 21840 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 21841 return ret; 21842 } 21843 21844 elem.setAttribute( name, value + "" ); 21845 return value; 21846 } 21847 21848 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 21849 return ret; 21850 } 21851 21852 ret = jQuery.find.attr( elem, name ); 21853 21854 // Non-existent attributes return null, we normalize to undefined 21855 return ret == null ? undefined : ret; 21856 }, 21857 21858 attrHooks: { 21859 type: { 21860 set: function( elem, value ) { 21861 if ( !support.radioValue && value === "radio" && 21862 nodeName( elem, "input" ) ) { 21863 var val = elem.value; 21864 elem.setAttribute( "type", value ); 21865 if ( val ) { 21866 elem.value = val; 21867 } 21868 return value; 21869 } 21870 } 21871 } 21872 }, 21873 21874 removeAttr: function( elem, value ) { 21875 var name, 21876 i = 0, 21877 21878 // Attribute names can contain non-HTML whitespace characters 21879 // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 21880 attrNames = value && value.match( rnothtmlwhite ); 21881 21882 if ( attrNames && elem.nodeType === 1 ) { 21883 while ( ( name = attrNames[ i++ ] ) ) { 21884 elem.removeAttribute( name ); 21885 } 21886 } 21887 } 21888} ); 21889 21890// Hooks for boolean attributes 21891boolHook = { 21892 set: function( elem, value, name ) { 21893 if ( value === false ) { 21894 21895 // Remove boolean attributes when set to false 21896 jQuery.removeAttr( elem, name ); 21897 } else { 21898 elem.setAttribute( name, name ); 21899 } 21900 return name; 21901 } 21902}; 21903 21904jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) { 21905 var getter = attrHandle[ name ] || jQuery.find.attr; 21906 21907 attrHandle[ name ] = function( elem, name, isXML ) { 21908 var ret, handle, 21909 lowercaseName = name.toLowerCase(); 21910 21911 if ( !isXML ) { 21912 21913 // Avoid an infinite loop by temporarily removing this function from the getter 21914 handle = attrHandle[ lowercaseName ]; 21915 attrHandle[ lowercaseName ] = ret; 21916 ret = getter( elem, name, isXML ) != null ? 21917 lowercaseName : 21918 null; 21919 attrHandle[ lowercaseName ] = handle; 21920 } 21921 return ret; 21922 }; 21923} ); 21924 21925 21926 21927 21928var rfocusable = /^(?:input|select|textarea|button)$/i, 21929 rclickable = /^(?:a|area)$/i; 21930 21931jQuery.fn.extend( { 21932 prop: function( name, value ) { 21933 return access( this, jQuery.prop, name, value, arguments.length > 1 ); 21934 }, 21935 21936 removeProp: function( name ) { 21937 return this.each( function() { 21938 delete this[ jQuery.propFix[ name ] || name ]; 21939 } ); 21940 } 21941} ); 21942 21943jQuery.extend( { 21944 prop: function( elem, name, value ) { 21945 var ret, hooks, 21946 nType = elem.nodeType; 21947 21948 // Don't get/set properties on text, comment and attribute nodes 21949 if ( nType === 3 || nType === 8 || nType === 2 ) { 21950 return; 21951 } 21952 21953 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 21954 21955 // Fix name and attach hooks 21956 name = jQuery.propFix[ name ] || name; 21957 hooks = jQuery.propHooks[ name ]; 21958 } 21959 21960 if ( value !== undefined ) { 21961 if ( hooks && "set" in hooks && 21962 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 21963 return ret; 21964 } 21965 21966 return ( elem[ name ] = value ); 21967 } 21968 21969 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 21970 return ret; 21971 } 21972 21973 return elem[ name ]; 21974 }, 21975 21976 propHooks: { 21977 tabIndex: { 21978 get: function( elem ) { 21979 21980 // Support: IE <=9 - 11 only 21981 // elem.tabIndex doesn't always return the 21982 // correct value when it hasn't been explicitly set 21983 // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ 21984 // Use proper attribute retrieval(#12072) 21985 var tabindex = jQuery.find.attr( elem, "tabindex" ); 21986 21987 if ( tabindex ) { 21988 return parseInt( tabindex, 10 ); 21989 } 21990 21991 if ( 21992 rfocusable.test( elem.nodeName ) || 21993 rclickable.test( elem.nodeName ) && 21994 elem.href 21995 ) { 21996 return 0; 21997 } 21998 21999 return -1; 22000 } 22001 } 22002 }, 22003 22004 propFix: { 22005 "for": "htmlFor", 22006 "class": "className" 22007 } 22008} ); 22009 22010// Support: IE <=11 only 22011// Accessing the selectedIndex property 22012// forces the browser to respect setting selected 22013// on the option 22014// The getter ensures a default option is selected 22015// when in an optgroup 22016// eslint rule "no-unused-expressions" is disabled for this code 22017// since it considers such accessions noop 22018if ( !support.optSelected ) { 22019 jQuery.propHooks.selected = { 22020 get: function( elem ) { 22021 22022 /* eslint no-unused-expressions: "off" */ 22023 22024 var parent = elem.parentNode; 22025 if ( parent && parent.parentNode ) { 22026 parent.parentNode.selectedIndex; 22027 } 22028 return null; 22029 }, 22030 set: function( elem ) { 22031 22032 /* eslint no-unused-expressions: "off" */ 22033 22034 var parent = elem.parentNode; 22035 if ( parent ) { 22036 parent.selectedIndex; 22037 22038 if ( parent.parentNode ) { 22039 parent.parentNode.selectedIndex; 22040 } 22041 } 22042 } 22043 }; 22044} 22045 22046jQuery.each( [ 22047 "tabIndex", 22048 "readOnly", 22049 "maxLength", 22050 "cellSpacing", 22051 "cellPadding", 22052 "rowSpan", 22053 "colSpan", 22054 "useMap", 22055 "frameBorder", 22056 "contentEditable" 22057], function() { 22058 jQuery.propFix[ this.toLowerCase() ] = this; 22059} ); 22060 22061 22062 22063 22064 // Strip and collapse whitespace according to HTML spec 22065 // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace 22066 function stripAndCollapse( value ) { 22067 var tokens = value.match( rnothtmlwhite ) || []; 22068 return tokens.join( " " ); 22069 } 22070 22071 22072function getClass( elem ) { 22073 return elem.getAttribute && elem.getAttribute( "class" ) || ""; 22074} 22075 22076function classesToArray( value ) { 22077 if ( Array.isArray( value ) ) { 22078 return value; 22079 } 22080 if ( typeof value === "string" ) { 22081 return value.match( rnothtmlwhite ) || []; 22082 } 22083 return []; 22084} 22085 22086jQuery.fn.extend( { 22087 addClass: function( value ) { 22088 var classes, elem, cur, curValue, clazz, j, finalValue, 22089 i = 0; 22090 22091 if ( isFunction( value ) ) { 22092 return this.each( function( j ) { 22093 jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); 22094 } ); 22095 } 22096 22097 classes = classesToArray( value ); 22098 22099 if ( classes.length ) { 22100 while ( ( elem = this[ i++ ] ) ) { 22101 curValue = getClass( elem ); 22102 cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); 22103 22104 if ( cur ) { 22105 j = 0; 22106 while ( ( clazz = classes[ j++ ] ) ) { 22107 if ( cur.indexOf( " " + clazz + " " ) < 0 ) { 22108 cur += clazz + " "; 22109 } 22110 } 22111 22112 // Only assign if different to avoid unneeded rendering. 22113 finalValue = stripAndCollapse( cur ); 22114 if ( curValue !== finalValue ) { 22115 elem.setAttribute( "class", finalValue ); 22116 } 22117 } 22118 } 22119 } 22120 22121 return this; 22122 }, 22123 22124 removeClass: function( value ) { 22125 var classes, elem, cur, curValue, clazz, j, finalValue, 22126 i = 0; 22127 22128 if ( isFunction( value ) ) { 22129 return this.each( function( j ) { 22130 jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); 22131 } ); 22132 } 22133 22134 if ( !arguments.length ) { 22135 return this.attr( "class", "" ); 22136 } 22137 22138 classes = classesToArray( value ); 22139 22140 if ( classes.length ) { 22141 while ( ( elem = this[ i++ ] ) ) { 22142 curValue = getClass( elem ); 22143 22144 // This expression is here for better compressibility (see addClass) 22145 cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); 22146 22147 if ( cur ) { 22148 j = 0; 22149 while ( ( clazz = classes[ j++ ] ) ) { 22150 22151 // Remove *all* instances 22152 while ( cur.indexOf( " " + clazz + " " ) > -1 ) { 22153 cur = cur.replace( " " + clazz + " ", " " ); 22154 } 22155 } 22156 22157 // Only assign if different to avoid unneeded rendering. 22158 finalValue = stripAndCollapse( cur ); 22159 if ( curValue !== finalValue ) { 22160 elem.setAttribute( "class", finalValue ); 22161 } 22162 } 22163 } 22164 } 22165 22166 return this; 22167 }, 22168 22169 toggleClass: function( value, stateVal ) { 22170 var type = typeof value, 22171 isValidValue = type === "string" || Array.isArray( value ); 22172 22173 if ( typeof stateVal === "boolean" && isValidValue ) { 22174 return stateVal ? this.addClass( value ) : this.removeClass( value ); 22175 } 22176 22177 if ( isFunction( value ) ) { 22178 return this.each( function( i ) { 22179 jQuery( this ).toggleClass( 22180 value.call( this, i, getClass( this ), stateVal ), 22181 stateVal 22182 ); 22183 } ); 22184 } 22185 22186 return this.each( function() { 22187 var className, i, self, classNames; 22188 22189 if ( isValidValue ) { 22190 22191 // Toggle individual class names 22192 i = 0; 22193 self = jQuery( this ); 22194 classNames = classesToArray( value ); 22195 22196 while ( ( className = classNames[ i++ ] ) ) { 22197 22198 // Check each className given, space separated list 22199 if ( self.hasClass( className ) ) { 22200 self.removeClass( className ); 22201 } else { 22202 self.addClass( className ); 22203 } 22204 } 22205 22206 // Toggle whole class name 22207 } else if ( value === undefined || type === "boolean" ) { 22208 className = getClass( this ); 22209 if ( className ) { 22210 22211 // Store className if set 22212 dataPriv.set( this, "__className__", className ); 22213 } 22214 22215 // If the element has a class name or if we're passed `false`, 22216 // then remove the whole classname (if there was one, the above saved it). 22217 // Otherwise bring back whatever was previously saved (if anything), 22218 // falling back to the empty string if nothing was stored. 22219 if ( this.setAttribute ) { 22220 this.setAttribute( "class", 22221 className || value === false ? 22222 "" : 22223 dataPriv.get( this, "__className__" ) || "" 22224 ); 22225 } 22226 } 22227 } ); 22228 }, 22229 22230 hasClass: function( selector ) { 22231 var className, elem, 22232 i = 0; 22233 22234 className = " " + selector + " "; 22235 while ( ( elem = this[ i++ ] ) ) { 22236 if ( elem.nodeType === 1 && 22237 ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { 22238 return true; 22239 } 22240 } 22241 22242 return false; 22243 } 22244} ); 22245 22246 22247 22248 22249var rreturn = /\r/g; 22250 22251jQuery.fn.extend( { 22252 val: function( value ) { 22253 var hooks, ret, valueIsFunction, 22254 elem = this[ 0 ]; 22255 22256 if ( !arguments.length ) { 22257 if ( elem ) { 22258 hooks = jQuery.valHooks[ elem.type ] || 22259 jQuery.valHooks[ elem.nodeName.toLowerCase() ]; 22260 22261 if ( hooks && 22262 "get" in hooks && 22263 ( ret = hooks.get( elem, "value" ) ) !== undefined 22264 ) { 22265 return ret; 22266 } 22267 22268 ret = elem.value; 22269 22270 // Handle most common string cases 22271 if ( typeof ret === "string" ) { 22272 return ret.replace( rreturn, "" ); 22273 } 22274 22275 // Handle cases where value is null/undef or number 22276 return ret == null ? "" : ret; 22277 } 22278 22279 return; 22280 } 22281 22282 valueIsFunction = isFunction( value ); 22283 22284 return this.each( function( i ) { 22285 var val; 22286 22287 if ( this.nodeType !== 1 ) { 22288 return; 22289 } 22290 22291 if ( valueIsFunction ) { 22292 val = value.call( this, i, jQuery( this ).val() ); 22293 } else { 22294 val = value; 22295 } 22296 22297 // Treat null/undefined as ""; convert numbers to string 22298 if ( val == null ) { 22299 val = ""; 22300 22301 } else if ( typeof val === "number" ) { 22302 val += ""; 22303 22304 } else if ( Array.isArray( val ) ) { 22305 val = jQuery.map( val, function( value ) { 22306 return value == null ? "" : value + ""; 22307 } ); 22308 } 22309 22310 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; 22311 22312 // If set returns undefined, fall back to normal setting 22313 if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { 22314 this.value = val; 22315 } 22316 } ); 22317 } 22318} ); 22319 22320jQuery.extend( { 22321 valHooks: { 22322 option: { 22323 get: function( elem ) { 22324 22325 var val = jQuery.find.attr( elem, "value" ); 22326 return val != null ? 22327 val : 22328 22329 // Support: IE <=10 - 11 only 22330 // option.text throws exceptions (#14686, #14858) 22331 // Strip and collapse whitespace 22332 // https://html.spec.whatwg.org/#strip-and-collapse-whitespace 22333 stripAndCollapse( jQuery.text( elem ) ); 22334 } 22335 }, 22336 select: { 22337 get: function( elem ) { 22338 var value, option, i, 22339 options = elem.options, 22340 index = elem.selectedIndex, 22341 one = elem.type === "select-one", 22342 values = one ? null : [], 22343 max = one ? index + 1 : options.length; 22344 22345 if ( index < 0 ) { 22346 i = max; 22347 22348 } else { 22349 i = one ? index : 0; 22350 } 22351 22352 // Loop through all the selected options 22353 for ( ; i < max; i++ ) { 22354 option = options[ i ]; 22355 22356 // Support: IE <=9 only 22357 // IE8-9 doesn't update selected after form reset (#2551) 22358 if ( ( option.selected || i === index ) && 22359 22360 // Don't return options that are disabled or in a disabled optgroup 22361 !option.disabled && 22362 ( !option.parentNode.disabled || 22363 !nodeName( option.parentNode, "optgroup" ) ) ) { 22364 22365 // Get the specific value for the option 22366 value = jQuery( option ).val(); 22367 22368 // We don't need an array for one selects 22369 if ( one ) { 22370 return value; 22371 } 22372 22373 // Multi-Selects return an array 22374 values.push( value ); 22375 } 22376 } 22377 22378 return values; 22379 }, 22380 22381 set: function( elem, value ) { 22382 var optionSet, option, 22383 options = elem.options, 22384 values = jQuery.makeArray( value ), 22385 i = options.length; 22386 22387 while ( i-- ) { 22388 option = options[ i ]; 22389 22390 /* eslint-disable no-cond-assign */ 22391 22392 if ( option.selected = 22393 jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 22394 ) { 22395 optionSet = true; 22396 } 22397 22398 /* eslint-enable no-cond-assign */ 22399 } 22400 22401 // Force browsers to behave consistently when non-matching value is set 22402 if ( !optionSet ) { 22403 elem.selectedIndex = -1; 22404 } 22405 return values; 22406 } 22407 } 22408 } 22409} ); 22410 22411// Radios and checkboxes getter/setter 22412jQuery.each( [ "radio", "checkbox" ], function() { 22413 jQuery.valHooks[ this ] = { 22414 set: function( elem, value ) { 22415 if ( Array.isArray( value ) ) { 22416 return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); 22417 } 22418 } 22419 }; 22420 if ( !support.checkOn ) { 22421 jQuery.valHooks[ this ].get = function( elem ) { 22422 return elem.getAttribute( "value" ) === null ? "on" : elem.value; 22423 }; 22424 } 22425} ); 22426 22427 22428 22429 22430// Return jQuery for attributes-only inclusion 22431 22432 22433support.focusin = "onfocusin" in window; 22434 22435 22436var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, 22437 stopPropagationCallback = function( e ) { 22438 e.stopPropagation(); 22439 }; 22440 22441jQuery.extend( jQuery.event, { 22442 22443 trigger: function( event, data, elem, onlyHandlers ) { 22444 22445 var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, 22446 eventPath = [ elem || document ], 22447 type = hasOwn.call( event, "type" ) ? event.type : event, 22448 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; 22449 22450 cur = lastElement = tmp = elem = elem || document; 22451 22452 // Don't do events on text and comment nodes 22453 if ( elem.nodeType === 3 || elem.nodeType === 8 ) { 22454 return; 22455 } 22456 22457 // focus/blur morphs to focusin/out; ensure we're not firing them right now 22458 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { 22459 return; 22460 } 22461 22462 if ( type.indexOf( "." ) > -1 ) { 22463 22464 // Namespaced trigger; create a regexp to match event type in handle() 22465 namespaces = type.split( "." ); 22466 type = namespaces.shift(); 22467 namespaces.sort(); 22468 } 22469 ontype = type.indexOf( ":" ) < 0 && "on" + type; 22470 22471 // Caller can pass in a jQuery.Event object, Object, or just an event type string 22472 event = event[ jQuery.expando ] ? 22473 event : 22474 new jQuery.Event( type, typeof event === "object" && event ); 22475 22476 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) 22477 event.isTrigger = onlyHandlers ? 2 : 3; 22478 event.namespace = namespaces.join( "." ); 22479 event.rnamespace = event.namespace ? 22480 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : 22481 null; 22482 22483 // Clean up the event in case it is being reused 22484 event.result = undefined; 22485 if ( !event.target ) { 22486 event.target = elem; 22487 } 22488 22489 // Clone any incoming data and prepend the event, creating the handler arg list 22490 data = data == null ? 22491 [ event ] : 22492 jQuery.makeArray( data, [ event ] ); 22493 22494 // Allow special events to draw outside the lines 22495 special = jQuery.event.special[ type ] || {}; 22496 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { 22497 return; 22498 } 22499 22500 // Determine event propagation path in advance, per W3C events spec (#9951) 22501 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) 22502 if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) { 22503 22504 bubbleType = special.delegateType || type; 22505 if ( !rfocusMorph.test( bubbleType + type ) ) { 22506 cur = cur.parentNode; 22507 } 22508 for ( ; cur; cur = cur.parentNode ) { 22509 eventPath.push( cur ); 22510 tmp = cur; 22511 } 22512 22513 // Only add window if we got to document (e.g., not plain obj or detached DOM) 22514 if ( tmp === ( elem.ownerDocument || document ) ) { 22515 eventPath.push( tmp.defaultView || tmp.parentWindow || window ); 22516 } 22517 } 22518 22519 // Fire handlers on the event path 22520 i = 0; 22521 while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { 22522 lastElement = cur; 22523 event.type = i > 1 ? 22524 bubbleType : 22525 special.bindType || type; 22526 22527 // jQuery handler 22528 handle = ( dataPriv.get( cur, "events" ) || Object.create( null ) )[ event.type ] && 22529 dataPriv.get( cur, "handle" ); 22530 if ( handle ) { 22531 handle.apply( cur, data ); 22532 } 22533 22534 // Native handler 22535 handle = ontype && cur[ ontype ]; 22536 if ( handle && handle.apply && acceptData( cur ) ) { 22537 event.result = handle.apply( cur, data ); 22538 if ( event.result === false ) { 22539 event.preventDefault(); 22540 } 22541 } 22542 } 22543 event.type = type; 22544 22545 // If nobody prevented the default action, do it now 22546 if ( !onlyHandlers && !event.isDefaultPrevented() ) { 22547 22548 if ( ( !special._default || 22549 special._default.apply( eventPath.pop(), data ) === false ) && 22550 acceptData( elem ) ) { 22551 22552 // Call a native DOM method on the target with the same name as the event. 22553 // Don't do default actions on window, that's where global variables be (#6170) 22554 if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) { 22555 22556 // Don't re-trigger an onFOO event when we call its FOO() method 22557 tmp = elem[ ontype ]; 22558 22559 if ( tmp ) { 22560 elem[ ontype ] = null; 22561 } 22562 22563 // Prevent re-triggering of the same event, since we already bubbled it above 22564 jQuery.event.triggered = type; 22565 22566 if ( event.isPropagationStopped() ) { 22567 lastElement.addEventListener( type, stopPropagationCallback ); 22568 } 22569 22570 elem[ type ](); 22571 22572 if ( event.isPropagationStopped() ) { 22573 lastElement.removeEventListener( type, stopPropagationCallback ); 22574 } 22575 22576 jQuery.event.triggered = undefined; 22577 22578 if ( tmp ) { 22579 elem[ ontype ] = tmp; 22580 } 22581 } 22582 } 22583 } 22584 22585 return event.result; 22586 }, 22587 22588 // Piggyback on a donor event to simulate a different one 22589 // Used only for `focus(in | out)` events 22590 simulate: function( type, elem, event ) { 22591 var e = jQuery.extend( 22592 new jQuery.Event(), 22593 event, 22594 { 22595 type: type, 22596 isSimulated: true 22597 } 22598 ); 22599 22600 jQuery.event.trigger( e, null, elem ); 22601 } 22602 22603} ); 22604 22605jQuery.fn.extend( { 22606 22607 trigger: function( type, data ) { 22608 return this.each( function() { 22609 jQuery.event.trigger( type, data, this ); 22610 } ); 22611 }, 22612 triggerHandler: function( type, data ) { 22613 var elem = this[ 0 ]; 22614 if ( elem ) { 22615 return jQuery.event.trigger( type, data, elem, true ); 22616 } 22617 } 22618} ); 22619 22620 22621// Support: Firefox <=44 22622// Firefox doesn't have focus(in | out) events 22623// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 22624// 22625// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 22626// focus(in | out) events fire after focus & blur events, 22627// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order 22628// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 22629if ( !support.focusin ) { 22630 jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { 22631 22632 // Attach a single capturing handler on the document while someone wants focusin/focusout 22633 var handler = function( event ) { 22634 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); 22635 }; 22636 22637 jQuery.event.special[ fix ] = { 22638 setup: function() { 22639 22640 // Handle: regular nodes (via `this.ownerDocument`), window 22641 // (via `this.document`) & document (via `this`). 22642 var doc = this.ownerDocument || this.document || this, 22643 attaches = dataPriv.access( doc, fix ); 22644 22645 if ( !attaches ) { 22646 doc.addEventListener( orig, handler, true ); 22647 } 22648 dataPriv.access( doc, fix, ( attaches || 0 ) + 1 ); 22649 }, 22650 teardown: function() { 22651 var doc = this.ownerDocument || this.document || this, 22652 attaches = dataPriv.access( doc, fix ) - 1; 22653 22654 if ( !attaches ) { 22655 doc.removeEventListener( orig, handler, true ); 22656 dataPriv.remove( doc, fix ); 22657 22658 } else { 22659 dataPriv.access( doc, fix, attaches ); 22660 } 22661 } 22662 }; 22663 } ); 22664} 22665var location = window.location; 22666 22667var nonce = { guid: Date.now() }; 22668 22669var rquery = ( /\?/ ); 22670 22671 22672 22673// Cross-browser xml parsing 22674jQuery.parseXML = function( data ) { 22675 var xml, parserErrorElem; 22676 if ( !data || typeof data !== "string" ) { 22677 return null; 22678 } 22679 22680 // Support: IE 9 - 11 only 22681 // IE throws on parseFromString with invalid input. 22682 try { 22683 xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); 22684 } catch ( e ) {} 22685 22686 parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ]; 22687 if ( !xml || parserErrorElem ) { 22688 jQuery.error( "Invalid XML: " + ( 22689 parserErrorElem ? 22690 jQuery.map( parserErrorElem.childNodes, function( el ) { 22691 return el.textContent; 22692 } ).join( "\n" ) : 22693 data 22694 ) ); 22695 } 22696 return xml; 22697}; 22698 22699 22700var 22701 rbracket = /\[\]$/, 22702 rCRLF = /\r?\n/g, 22703 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, 22704 rsubmittable = /^(?:input|select|textarea|keygen)/i; 22705 22706function buildParams( prefix, obj, traditional, add ) { 22707 var name; 22708 22709 if ( Array.isArray( obj ) ) { 22710 22711 // Serialize array item. 22712 jQuery.each( obj, function( i, v ) { 22713 if ( traditional || rbracket.test( prefix ) ) { 22714 22715 // Treat each array item as a scalar. 22716 add( prefix, v ); 22717 22718 } else { 22719 22720 // Item is non-scalar (array or object), encode its numeric index. 22721 buildParams( 22722 prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", 22723 v, 22724 traditional, 22725 add 22726 ); 22727 } 22728 } ); 22729 22730 } else if ( !traditional && toType( obj ) === "object" ) { 22731 22732 // Serialize object item. 22733 for ( name in obj ) { 22734 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); 22735 } 22736 22737 } else { 22738 22739 // Serialize scalar item. 22740 add( prefix, obj ); 22741 } 22742} 22743 22744// Serialize an array of form elements or a set of 22745// key/values into a query string 22746jQuery.param = function( a, traditional ) { 22747 var prefix, 22748 s = [], 22749 add = function( key, valueOrFunction ) { 22750 22751 // If value is a function, invoke it and use its return value 22752 var value = isFunction( valueOrFunction ) ? 22753 valueOrFunction() : 22754 valueOrFunction; 22755 22756 s[ s.length ] = encodeURIComponent( key ) + "=" + 22757 encodeURIComponent( value == null ? "" : value ); 22758 }; 22759 22760 if ( a == null ) { 22761 return ""; 22762 } 22763 22764 // If an array was passed in, assume that it is an array of form elements. 22765 if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { 22766 22767 // Serialize the form elements 22768 jQuery.each( a, function() { 22769 add( this.name, this.value ); 22770 } ); 22771 22772 } else { 22773 22774 // If traditional, encode the "old" way (the way 1.3.2 or older 22775 // did it), otherwise encode params recursively. 22776 for ( prefix in a ) { 22777 buildParams( prefix, a[ prefix ], traditional, add ); 22778 } 22779 } 22780 22781 // Return the resulting serialization 22782 return s.join( "&" ); 22783}; 22784 22785jQuery.fn.extend( { 22786 serialize: function() { 22787 return jQuery.param( this.serializeArray() ); 22788 }, 22789 serializeArray: function() { 22790 return this.map( function() { 22791 22792 // Can add propHook for "elements" to filter or add form elements 22793 var elements = jQuery.prop( this, "elements" ); 22794 return elements ? jQuery.makeArray( elements ) : this; 22795 } ).filter( function() { 22796 var type = this.type; 22797 22798 // Use .is( ":disabled" ) so that fieldset[disabled] works 22799 return this.name && !jQuery( this ).is( ":disabled" ) && 22800 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && 22801 ( this.checked || !rcheckableType.test( type ) ); 22802 } ).map( function( _i, elem ) { 22803 var val = jQuery( this ).val(); 22804 22805 if ( val == null ) { 22806 return null; 22807 } 22808 22809 if ( Array.isArray( val ) ) { 22810 return jQuery.map( val, function( val ) { 22811 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 22812 } ); 22813 } 22814 22815 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 22816 } ).get(); 22817 } 22818} ); 22819 22820 22821var 22822 r20 = /%20/g, 22823 rhash = /#.*$/, 22824 rantiCache = /([?&])_=[^&]*/, 22825 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, 22826 22827 // #7653, #8125, #8152: local protocol detection 22828 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, 22829 rnoContent = /^(?:GET|HEAD)$/, 22830 rprotocol = /^\/\//, 22831 22832 /* Prefilters 22833 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) 22834 * 2) These are called: 22835 * - BEFORE asking for a transport 22836 * - AFTER param serialization (s.data is a string if s.processData is true) 22837 * 3) key is the dataType 22838 * 4) the catchall symbol "*" can be used 22839 * 5) execution will start with transport dataType and THEN continue down to "*" if needed 22840 */ 22841 prefilters = {}, 22842 22843 /* Transports bindings 22844 * 1) key is the dataType 22845 * 2) the catchall symbol "*" can be used 22846 * 3) selection will start with transport dataType and THEN go to "*" if needed 22847 */ 22848 transports = {}, 22849 22850 // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression 22851 allTypes = "*/".concat( "*" ), 22852 22853 // Anchor tag for parsing the document origin 22854 originAnchor = document.createElement( "a" ); 22855 22856originAnchor.href = location.href; 22857 22858// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport 22859function addToPrefiltersOrTransports( structure ) { 22860 22861 // dataTypeExpression is optional and defaults to "*" 22862 return function( dataTypeExpression, func ) { 22863 22864 if ( typeof dataTypeExpression !== "string" ) { 22865 func = dataTypeExpression; 22866 dataTypeExpression = "*"; 22867 } 22868 22869 var dataType, 22870 i = 0, 22871 dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; 22872 22873 if ( isFunction( func ) ) { 22874 22875 // For each dataType in the dataTypeExpression 22876 while ( ( dataType = dataTypes[ i++ ] ) ) { 22877 22878 // Prepend if requested 22879 if ( dataType[ 0 ] === "+" ) { 22880 dataType = dataType.slice( 1 ) || "*"; 22881 ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); 22882 22883 // Otherwise append 22884 } else { 22885 ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); 22886 } 22887 } 22888 } 22889 }; 22890} 22891 22892// Base inspection function for prefilters and transports 22893function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { 22894 22895 var inspected = {}, 22896 seekingTransport = ( structure === transports ); 22897 22898 function inspect( dataType ) { 22899 var selected; 22900 inspected[ dataType ] = true; 22901 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { 22902 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); 22903 if ( typeof dataTypeOrTransport === "string" && 22904 !seekingTransport && !inspected[ dataTypeOrTransport ] ) { 22905 22906 options.dataTypes.unshift( dataTypeOrTransport ); 22907 inspect( dataTypeOrTransport ); 22908 return false; 22909 } else if ( seekingTransport ) { 22910 return !( selected = dataTypeOrTransport ); 22911 } 22912 } ); 22913 return selected; 22914 } 22915 22916 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); 22917} 22918 22919// A special extend for ajax options 22920// that takes "flat" options (not to be deep extended) 22921// Fixes #9887 22922function ajaxExtend( target, src ) { 22923 var key, deep, 22924 flatOptions = jQuery.ajaxSettings.flatOptions || {}; 22925 22926 for ( key in src ) { 22927 if ( src[ key ] !== undefined ) { 22928 ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; 22929 } 22930 } 22931 if ( deep ) { 22932 jQuery.extend( true, target, deep ); 22933 } 22934 22935 return target; 22936} 22937 22938/* Handles responses to an ajax request: 22939 * - finds the right dataType (mediates between content-type and expected dataType) 22940 * - returns the corresponding response 22941 */ 22942function ajaxHandleResponses( s, jqXHR, responses ) { 22943 22944 var ct, type, finalDataType, firstDataType, 22945 contents = s.contents, 22946 dataTypes = s.dataTypes; 22947 22948 // Remove auto dataType and get content-type in the process 22949 while ( dataTypes[ 0 ] === "*" ) { 22950 dataTypes.shift(); 22951 if ( ct === undefined ) { 22952 ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); 22953 } 22954 } 22955 22956 // Check if we're dealing with a known content-type 22957 if ( ct ) { 22958 for ( type in contents ) { 22959 if ( contents[ type ] && contents[ type ].test( ct ) ) { 22960 dataTypes.unshift( type ); 22961 break; 22962 } 22963 } 22964 } 22965 22966 // Check to see if we have a response for the expected dataType 22967 if ( dataTypes[ 0 ] in responses ) { 22968 finalDataType = dataTypes[ 0 ]; 22969 } else { 22970 22971 // Try convertible dataTypes 22972 for ( type in responses ) { 22973 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { 22974 finalDataType = type; 22975 break; 22976 } 22977 if ( !firstDataType ) { 22978 firstDataType = type; 22979 } 22980 } 22981 22982 // Or just use first one 22983 finalDataType = finalDataType || firstDataType; 22984 } 22985 22986 // If we found a dataType 22987 // We add the dataType to the list if needed 22988 // and return the corresponding response 22989 if ( finalDataType ) { 22990 if ( finalDataType !== dataTypes[ 0 ] ) { 22991 dataTypes.unshift( finalDataType ); 22992 } 22993 return responses[ finalDataType ]; 22994 } 22995} 22996 22997/* Chain conversions given the request and the original response 22998 * Also sets the responseXXX fields on the jqXHR instance 22999 */ 23000function ajaxConvert( s, response, jqXHR, isSuccess ) { 23001 var conv2, current, conv, tmp, prev, 23002 converters = {}, 23003 23004 // Work with a copy of dataTypes in case we need to modify it for conversion 23005 dataTypes = s.dataTypes.slice(); 23006 23007 // Create converters map with lowercased keys 23008 if ( dataTypes[ 1 ] ) { 23009 for ( conv in s.converters ) { 23010 converters[ conv.toLowerCase() ] = s.converters[ conv ]; 23011 } 23012 } 23013 23014 current = dataTypes.shift(); 23015 23016 // Convert to each sequential dataType 23017 while ( current ) { 23018 23019 if ( s.responseFields[ current ] ) { 23020 jqXHR[ s.responseFields[ current ] ] = response; 23021 } 23022 23023 // Apply the dataFilter if provided 23024 if ( !prev && isSuccess && s.dataFilter ) { 23025 response = s.dataFilter( response, s.dataType ); 23026 } 23027 23028 prev = current; 23029 current = dataTypes.shift(); 23030 23031 if ( current ) { 23032 23033 // There's only work to do if current dataType is non-auto 23034 if ( current === "*" ) { 23035 23036 current = prev; 23037 23038 // Convert response if prev dataType is non-auto and differs from current 23039 } else if ( prev !== "*" && prev !== current ) { 23040 23041 // Seek a direct converter 23042 conv = converters[ prev + " " + current ] || converters[ "* " + current ]; 23043 23044 // If none found, seek a pair 23045 if ( !conv ) { 23046 for ( conv2 in converters ) { 23047 23048 // If conv2 outputs current 23049 tmp = conv2.split( " " ); 23050 if ( tmp[ 1 ] === current ) { 23051 23052 // If prev can be converted to accepted input 23053 conv = converters[ prev + " " + tmp[ 0 ] ] || 23054 converters[ "* " + tmp[ 0 ] ]; 23055 if ( conv ) { 23056 23057 // Condense equivalence converters 23058 if ( conv === true ) { 23059 conv = converters[ conv2 ]; 23060 23061 // Otherwise, insert the intermediate dataType 23062 } else if ( converters[ conv2 ] !== true ) { 23063 current = tmp[ 0 ]; 23064 dataTypes.unshift( tmp[ 1 ] ); 23065 } 23066 break; 23067 } 23068 } 23069 } 23070 } 23071 23072 // Apply converter (if not an equivalence) 23073 if ( conv !== true ) { 23074 23075 // Unless errors are allowed to bubble, catch and return them 23076 if ( conv && s.throws ) { 23077 response = conv( response ); 23078 } else { 23079 try { 23080 response = conv( response ); 23081 } catch ( e ) { 23082 return { 23083 state: "parsererror", 23084 error: conv ? e : "No conversion from " + prev + " to " + current 23085 }; 23086 } 23087 } 23088 } 23089 } 23090 } 23091 } 23092 23093 return { state: "success", data: response }; 23094} 23095 23096jQuery.extend( { 23097 23098 // Counter for holding the number of active queries 23099 active: 0, 23100 23101 // Last-Modified header cache for next request 23102 lastModified: {}, 23103 etag: {}, 23104 23105 ajaxSettings: { 23106 url: location.href, 23107 type: "GET", 23108 isLocal: rlocalProtocol.test( location.protocol ), 23109 global: true, 23110 processData: true, 23111 async: true, 23112 contentType: "application/x-www-form-urlencoded; charset=UTF-8", 23113 23114 /* 23115 timeout: 0, 23116 data: null, 23117 dataType: null, 23118 username: null, 23119 password: null, 23120 cache: null, 23121 throws: false, 23122 traditional: false, 23123 headers: {}, 23124 */ 23125 23126 accepts: { 23127 "*": allTypes, 23128 text: "text/plain", 23129 html: "text/html", 23130 xml: "application/xml, text/xml", 23131 json: "application/json, text/javascript" 23132 }, 23133 23134 contents: { 23135 xml: /\bxml\b/, 23136 html: /\bhtml/, 23137 json: /\bjson\b/ 23138 }, 23139 23140 responseFields: { 23141 xml: "responseXML", 23142 text: "responseText", 23143 json: "responseJSON" 23144 }, 23145 23146 // Data converters 23147 // Keys separate source (or catchall "*") and destination types with a single space 23148 converters: { 23149 23150 // Convert anything to text 23151 "* text": String, 23152 23153 // Text to html (true = no transformation) 23154 "text html": true, 23155 23156 // Evaluate text as a json expression 23157 "text json": JSON.parse, 23158 23159 // Parse text as xml 23160 "text xml": jQuery.parseXML 23161 }, 23162 23163 // For options that shouldn't be deep extended: 23164 // you can add your own custom options here if 23165 // and when you create one that shouldn't be 23166 // deep extended (see ajaxExtend) 23167 flatOptions: { 23168 url: true, 23169 context: true 23170 } 23171 }, 23172 23173 // Creates a full fledged settings object into target 23174 // with both ajaxSettings and settings fields. 23175 // If target is omitted, writes into ajaxSettings. 23176 ajaxSetup: function( target, settings ) { 23177 return settings ? 23178 23179 // Building a settings object 23180 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : 23181 23182 // Extending ajaxSettings 23183 ajaxExtend( jQuery.ajaxSettings, target ); 23184 }, 23185 23186 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), 23187 ajaxTransport: addToPrefiltersOrTransports( transports ), 23188 23189 // Main method 23190 ajax: function( url, options ) { 23191 23192 // If url is an object, simulate pre-1.5 signature 23193 if ( typeof url === "object" ) { 23194 options = url; 23195 url = undefined; 23196 } 23197 23198 // Force options to be an object 23199 options = options || {}; 23200 23201 var transport, 23202 23203 // URL without anti-cache param 23204 cacheURL, 23205 23206 // Response headers 23207 responseHeadersString, 23208 responseHeaders, 23209 23210 // timeout handle 23211 timeoutTimer, 23212 23213 // Url cleanup var 23214 urlAnchor, 23215 23216 // Request state (becomes false upon send and true upon completion) 23217 completed, 23218 23219 // To know if global events are to be dispatched 23220 fireGlobals, 23221 23222 // Loop variable 23223 i, 23224 23225 // uncached part of the url 23226 uncached, 23227 23228 // Create the final options object 23229 s = jQuery.ajaxSetup( {}, options ), 23230 23231 // Callbacks context 23232 callbackContext = s.context || s, 23233 23234 // Context for global events is callbackContext if it is a DOM node or jQuery collection 23235 globalEventContext = s.context && 23236 ( callbackContext.nodeType || callbackContext.jquery ) ? 23237 jQuery( callbackContext ) : 23238 jQuery.event, 23239 23240 // Deferreds 23241 deferred = jQuery.Deferred(), 23242 completeDeferred = jQuery.Callbacks( "once memory" ), 23243 23244 // Status-dependent callbacks 23245 statusCode = s.statusCode || {}, 23246 23247 // Headers (they are sent all at once) 23248 requestHeaders = {}, 23249 requestHeadersNames = {}, 23250 23251 // Default abort message 23252 strAbort = "canceled", 23253 23254 // Fake xhr 23255 jqXHR = { 23256 readyState: 0, 23257 23258 // Builds headers hashtable if needed 23259 getResponseHeader: function( key ) { 23260 var match; 23261 if ( completed ) { 23262 if ( !responseHeaders ) { 23263 responseHeaders = {}; 23264 while ( ( match = rheaders.exec( responseHeadersString ) ) ) { 23265 responseHeaders[ match[ 1 ].toLowerCase() + " " ] = 23266 ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] ) 23267 .concat( match[ 2 ] ); 23268 } 23269 } 23270 match = responseHeaders[ key.toLowerCase() + " " ]; 23271 } 23272 return match == null ? null : match.join( ", " ); 23273 }, 23274 23275 // Raw string 23276 getAllResponseHeaders: function() { 23277 return completed ? responseHeadersString : null; 23278 }, 23279 23280 // Caches the header 23281 setRequestHeader: function( name, value ) { 23282 if ( completed == null ) { 23283 name = requestHeadersNames[ name.toLowerCase() ] = 23284 requestHeadersNames[ name.toLowerCase() ] || name; 23285 requestHeaders[ name ] = value; 23286 } 23287 return this; 23288 }, 23289 23290 // Overrides response content-type header 23291 overrideMimeType: function( type ) { 23292 if ( completed == null ) { 23293 s.mimeType = type; 23294 } 23295 return this; 23296 }, 23297 23298 // Status-dependent callbacks 23299 statusCode: function( map ) { 23300 var code; 23301 if ( map ) { 23302 if ( completed ) { 23303 23304 // Execute the appropriate callbacks 23305 jqXHR.always( map[ jqXHR.status ] ); 23306 } else { 23307 23308 // Lazy-add the new callbacks in a way that preserves old ones 23309 for ( code in map ) { 23310 statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; 23311 } 23312 } 23313 } 23314 return this; 23315 }, 23316 23317 // Cancel the request 23318 abort: function( statusText ) { 23319 var finalText = statusText || strAbort; 23320 if ( transport ) { 23321 transport.abort( finalText ); 23322 } 23323 done( 0, finalText ); 23324 return this; 23325 } 23326 }; 23327 23328 // Attach deferreds 23329 deferred.promise( jqXHR ); 23330 23331 // Add protocol if not provided (prefilters might expect it) 23332 // Handle falsy url in the settings object (#10093: consistency with old signature) 23333 // We also use the url parameter if available 23334 s.url = ( ( url || s.url || location.href ) + "" ) 23335 .replace( rprotocol, location.protocol + "//" ); 23336 23337 // Alias method option to type as per ticket #12004 23338 s.type = options.method || options.type || s.method || s.type; 23339 23340 // Extract dataTypes list 23341 s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ]; 23342 23343 // A cross-domain request is in order when the origin doesn't match the current origin. 23344 if ( s.crossDomain == null ) { 23345 urlAnchor = document.createElement( "a" ); 23346 23347 // Support: IE <=8 - 11, Edge 12 - 15 23348 // IE throws exception on accessing the href property if url is malformed, 23349 // e.g. http://example.com:80x/ 23350 try { 23351 urlAnchor.href = s.url; 23352 23353 // Support: IE <=8 - 11 only 23354 // Anchor's host property isn't correctly set when s.url is relative 23355 urlAnchor.href = urlAnchor.href; 23356 s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== 23357 urlAnchor.protocol + "//" + urlAnchor.host; 23358 } catch ( e ) { 23359 23360 // If there is an error parsing the URL, assume it is crossDomain, 23361 // it can be rejected by the transport if it is invalid 23362 s.crossDomain = true; 23363 } 23364 } 23365 23366 // Convert data if not already a string 23367 if ( s.data && s.processData && typeof s.data !== "string" ) { 23368 s.data = jQuery.param( s.data, s.traditional ); 23369 } 23370 23371 // Apply prefilters 23372 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); 23373 23374 // If request was aborted inside a prefilter, stop there 23375 if ( completed ) { 23376 return jqXHR; 23377 } 23378 23379 // We can fire global events as of now if asked to 23380 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) 23381 fireGlobals = jQuery.event && s.global; 23382 23383 // Watch for a new set of requests 23384 if ( fireGlobals && jQuery.active++ === 0 ) { 23385 jQuery.event.trigger( "ajaxStart" ); 23386 } 23387 23388 // Uppercase the type 23389 s.type = s.type.toUpperCase(); 23390 23391 // Determine if request has content 23392 s.hasContent = !rnoContent.test( s.type ); 23393 23394 // Save the URL in case we're toying with the If-Modified-Since 23395 // and/or If-None-Match header later on 23396 // Remove hash to simplify url manipulation 23397 cacheURL = s.url.replace( rhash, "" ); 23398 23399 // More options handling for requests with no content 23400 if ( !s.hasContent ) { 23401 23402 // Remember the hash so we can put it back 23403 uncached = s.url.slice( cacheURL.length ); 23404 23405 // If data is available and should be processed, append data to url 23406 if ( s.data && ( s.processData || typeof s.data === "string" ) ) { 23407 cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; 23408 23409 // #9682: remove data so that it's not used in an eventual retry 23410 delete s.data; 23411 } 23412 23413 // Add or update anti-cache param if needed 23414 if ( s.cache === false ) { 23415 cacheURL = cacheURL.replace( rantiCache, "$1" ); 23416 uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) + 23417 uncached; 23418 } 23419 23420 // Put hash and anti-cache on the URL that will be requested (gh-1732) 23421 s.url = cacheURL + uncached; 23422 23423 // Change '%20' to '+' if this is encoded form body content (gh-2658) 23424 } else if ( s.data && s.processData && 23425 ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { 23426 s.data = s.data.replace( r20, "+" ); 23427 } 23428 23429 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 23430 if ( s.ifModified ) { 23431 if ( jQuery.lastModified[ cacheURL ] ) { 23432 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); 23433 } 23434 if ( jQuery.etag[ cacheURL ] ) { 23435 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); 23436 } 23437 } 23438 23439 // Set the correct header, if data is being sent 23440 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { 23441 jqXHR.setRequestHeader( "Content-Type", s.contentType ); 23442 } 23443 23444 // Set the Accepts header for the server, depending on the dataType 23445 jqXHR.setRequestHeader( 23446 "Accept", 23447 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? 23448 s.accepts[ s.dataTypes[ 0 ] ] + 23449 ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : 23450 s.accepts[ "*" ] 23451 ); 23452 23453 // Check for headers option 23454 for ( i in s.headers ) { 23455 jqXHR.setRequestHeader( i, s.headers[ i ] ); 23456 } 23457 23458 // Allow custom headers/mimetypes and early abort 23459 if ( s.beforeSend && 23460 ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { 23461 23462 // Abort if not done already and return 23463 return jqXHR.abort(); 23464 } 23465 23466 // Aborting is no longer a cancellation 23467 strAbort = "abort"; 23468 23469 // Install callbacks on deferreds 23470 completeDeferred.add( s.complete ); 23471 jqXHR.done( s.success ); 23472 jqXHR.fail( s.error ); 23473 23474 // Get transport 23475 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); 23476 23477 // If no transport, we auto-abort 23478 if ( !transport ) { 23479 done( -1, "No Transport" ); 23480 } else { 23481 jqXHR.readyState = 1; 23482 23483 // Send global event 23484 if ( fireGlobals ) { 23485 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); 23486 } 23487 23488 // If request was aborted inside ajaxSend, stop there 23489 if ( completed ) { 23490 return jqXHR; 23491 } 23492 23493 // Timeout 23494 if ( s.async && s.timeout > 0 ) { 23495 timeoutTimer = window.setTimeout( function() { 23496 jqXHR.abort( "timeout" ); 23497 }, s.timeout ); 23498 } 23499 23500 try { 23501 completed = false; 23502 transport.send( requestHeaders, done ); 23503 } catch ( e ) { 23504 23505 // Rethrow post-completion exceptions 23506 if ( completed ) { 23507 throw e; 23508 } 23509 23510 // Propagate others as results 23511 done( -1, e ); 23512 } 23513 } 23514 23515 // Callback for when everything is done 23516 function done( status, nativeStatusText, responses, headers ) { 23517 var isSuccess, success, error, response, modified, 23518 statusText = nativeStatusText; 23519 23520 // Ignore repeat invocations 23521 if ( completed ) { 23522 return; 23523 } 23524 23525 completed = true; 23526 23527 // Clear timeout if it exists 23528 if ( timeoutTimer ) { 23529 window.clearTimeout( timeoutTimer ); 23530 } 23531 23532 // Dereference transport for early garbage collection 23533 // (no matter how long the jqXHR object will be used) 23534 transport = undefined; 23535 23536 // Cache response headers 23537 responseHeadersString = headers || ""; 23538 23539 // Set readyState 23540 jqXHR.readyState = status > 0 ? 4 : 0; 23541 23542 // Determine if successful 23543 isSuccess = status >= 200 && status < 300 || status === 304; 23544 23545 // Get response data 23546 if ( responses ) { 23547 response = ajaxHandleResponses( s, jqXHR, responses ); 23548 } 23549 23550 // Use a noop converter for missing script but not if jsonp 23551 if ( !isSuccess && 23552 jQuery.inArray( "script", s.dataTypes ) > -1 && 23553 jQuery.inArray( "json", s.dataTypes ) < 0 ) { 23554 s.converters[ "text script" ] = function() {}; 23555 } 23556 23557 // Convert no matter what (that way responseXXX fields are always set) 23558 response = ajaxConvert( s, response, jqXHR, isSuccess ); 23559 23560 // If successful, handle type chaining 23561 if ( isSuccess ) { 23562 23563 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 23564 if ( s.ifModified ) { 23565 modified = jqXHR.getResponseHeader( "Last-Modified" ); 23566 if ( modified ) { 23567 jQuery.lastModified[ cacheURL ] = modified; 23568 } 23569 modified = jqXHR.getResponseHeader( "etag" ); 23570 if ( modified ) { 23571 jQuery.etag[ cacheURL ] = modified; 23572 } 23573 } 23574 23575 // if no content 23576 if ( status === 204 || s.type === "HEAD" ) { 23577 statusText = "nocontent"; 23578 23579 // if not modified 23580 } else if ( status === 304 ) { 23581 statusText = "notmodified"; 23582 23583 // If we have data, let's convert it 23584 } else { 23585 statusText = response.state; 23586 success = response.data; 23587 error = response.error; 23588 isSuccess = !error; 23589 } 23590 } else { 23591 23592 // Extract error from statusText and normalize for non-aborts 23593 error = statusText; 23594 if ( status || !statusText ) { 23595 statusText = "error"; 23596 if ( status < 0 ) { 23597 status = 0; 23598 } 23599 } 23600 } 23601 23602 // Set data for the fake xhr object 23603 jqXHR.status = status; 23604 jqXHR.statusText = ( nativeStatusText || statusText ) + ""; 23605 23606 // Success/Error 23607 if ( isSuccess ) { 23608 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); 23609 } else { 23610 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); 23611 } 23612 23613 // Status-dependent callbacks 23614 jqXHR.statusCode( statusCode ); 23615 statusCode = undefined; 23616 23617 if ( fireGlobals ) { 23618 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", 23619 [ jqXHR, s, isSuccess ? success : error ] ); 23620 } 23621 23622 // Complete 23623 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); 23624 23625 if ( fireGlobals ) { 23626 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); 23627 23628 // Handle the global AJAX counter 23629 if ( !( --jQuery.active ) ) { 23630 jQuery.event.trigger( "ajaxStop" ); 23631 } 23632 } 23633 } 23634 23635 return jqXHR; 23636 }, 23637 23638 getJSON: function( url, data, callback ) { 23639 return jQuery.get( url, data, callback, "json" ); 23640 }, 23641 23642 getScript: function( url, callback ) { 23643 return jQuery.get( url, undefined, callback, "script" ); 23644 } 23645} ); 23646 23647jQuery.each( [ "get", "post" ], function( _i, method ) { 23648 jQuery[ method ] = function( url, data, callback, type ) { 23649 23650 // Shift arguments if data argument was omitted 23651 if ( isFunction( data ) ) { 23652 type = type || callback; 23653 callback = data; 23654 data = undefined; 23655 } 23656 23657 // The url can be an options object (which then must have .url) 23658 return jQuery.ajax( jQuery.extend( { 23659 url: url, 23660 type: method, 23661 dataType: type, 23662 data: data, 23663 success: callback 23664 }, jQuery.isPlainObject( url ) && url ) ); 23665 }; 23666} ); 23667 23668jQuery.ajaxPrefilter( function( s ) { 23669 var i; 23670 for ( i in s.headers ) { 23671 if ( i.toLowerCase() === "content-type" ) { 23672 s.contentType = s.headers[ i ] || ""; 23673 } 23674 } 23675} ); 23676 23677 23678jQuery._evalUrl = function( url, options, doc ) { 23679 return jQuery.ajax( { 23680 url: url, 23681 23682 // Make this explicit, since user can override this through ajaxSetup (#11264) 23683 type: "GET", 23684 dataType: "script", 23685 cache: true, 23686 async: false, 23687 global: false, 23688 23689 // Only evaluate the response if it is successful (gh-4126) 23690 // dataFilter is not invoked for failure responses, so using it instead 23691 // of the default converter is kludgy but it works. 23692 converters: { 23693 "text script": function() {} 23694 }, 23695 dataFilter: function( response ) { 23696 jQuery.globalEval( response, options, doc ); 23697 } 23698 } ); 23699}; 23700 23701 23702jQuery.fn.extend( { 23703 wrapAll: function( html ) { 23704 var wrap; 23705 23706 if ( this[ 0 ] ) { 23707 if ( isFunction( html ) ) { 23708 html = html.call( this[ 0 ] ); 23709 } 23710 23711 // The elements to wrap the target around 23712 wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); 23713 23714 if ( this[ 0 ].parentNode ) { 23715 wrap.insertBefore( this[ 0 ] ); 23716 } 23717 23718 wrap.map( function() { 23719 var elem = this; 23720 23721 while ( elem.firstElementChild ) { 23722 elem = elem.firstElementChild; 23723 } 23724 23725 return elem; 23726 } ).append( this ); 23727 } 23728 23729 return this; 23730 }, 23731 23732 wrapInner: function( html ) { 23733 if ( isFunction( html ) ) { 23734 return this.each( function( i ) { 23735 jQuery( this ).wrapInner( html.call( this, i ) ); 23736 } ); 23737 } 23738 23739 return this.each( function() { 23740 var self = jQuery( this ), 23741 contents = self.contents(); 23742 23743 if ( contents.length ) { 23744 contents.wrapAll( html ); 23745 23746 } else { 23747 self.append( html ); 23748 } 23749 } ); 23750 }, 23751 23752 wrap: function( html ) { 23753 var htmlIsFunction = isFunction( html ); 23754 23755 return this.each( function( i ) { 23756 jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html ); 23757 } ); 23758 }, 23759 23760 unwrap: function( selector ) { 23761 this.parent( selector ).not( "body" ).each( function() { 23762 jQuery( this ).replaceWith( this.childNodes ); 23763 } ); 23764 return this; 23765 } 23766} ); 23767 23768 23769jQuery.expr.pseudos.hidden = function( elem ) { 23770 return !jQuery.expr.pseudos.visible( elem ); 23771}; 23772jQuery.expr.pseudos.visible = function( elem ) { 23773 return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); 23774}; 23775 23776 23777 23778 23779jQuery.ajaxSettings.xhr = function() { 23780 try { 23781 return new window.XMLHttpRequest(); 23782 } catch ( e ) {} 23783}; 23784 23785var xhrSuccessStatus = { 23786 23787 // File protocol always yields status code 0, assume 200 23788 0: 200, 23789 23790 // Support: IE <=9 only 23791 // #1450: sometimes IE returns 1223 when it should be 204 23792 1223: 204 23793 }, 23794 xhrSupported = jQuery.ajaxSettings.xhr(); 23795 23796support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); 23797support.ajax = xhrSupported = !!xhrSupported; 23798 23799jQuery.ajaxTransport( function( options ) { 23800 var callback, errorCallback; 23801 23802 // Cross domain only allowed if supported through XMLHttpRequest 23803 if ( support.cors || xhrSupported && !options.crossDomain ) { 23804 return { 23805 send: function( headers, complete ) { 23806 var i, 23807 xhr = options.xhr(); 23808 23809 xhr.open( 23810 options.type, 23811 options.url, 23812 options.async, 23813 options.username, 23814 options.password 23815 ); 23816 23817 // Apply custom fields if provided 23818 if ( options.xhrFields ) { 23819 for ( i in options.xhrFields ) { 23820 xhr[ i ] = options.xhrFields[ i ]; 23821 } 23822 } 23823 23824 // Override mime type if needed 23825 if ( options.mimeType && xhr.overrideMimeType ) { 23826 xhr.overrideMimeType( options.mimeType ); 23827 } 23828 23829 // X-Requested-With header 23830 // For cross-domain requests, seeing as conditions for a preflight are 23831 // akin to a jigsaw puzzle, we simply never set it to be sure. 23832 // (it can always be set on a per-request basis or even using ajaxSetup) 23833 // For same-domain requests, won't change header if already provided. 23834 if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { 23835 headers[ "X-Requested-With" ] = "XMLHttpRequest"; 23836 } 23837 23838 // Set headers 23839 for ( i in headers ) { 23840 xhr.setRequestHeader( i, headers[ i ] ); 23841 } 23842 23843 // Callback 23844 callback = function( type ) { 23845 return function() { 23846 if ( callback ) { 23847 callback = errorCallback = xhr.onload = 23848 xhr.onerror = xhr.onabort = xhr.ontimeout = 23849 xhr.onreadystatechange = null; 23850 23851 if ( type === "abort" ) { 23852 xhr.abort(); 23853 } else if ( type === "error" ) { 23854 23855 // Support: IE <=9 only 23856 // On a manual native abort, IE9 throws 23857 // errors on any property access that is not readyState 23858 if ( typeof xhr.status !== "number" ) { 23859 complete( 0, "error" ); 23860 } else { 23861 complete( 23862 23863 // File: protocol always yields status 0; see #8605, #14207 23864 xhr.status, 23865 xhr.statusText 23866 ); 23867 } 23868 } else { 23869 complete( 23870 xhrSuccessStatus[ xhr.status ] || xhr.status, 23871 xhr.statusText, 23872 23873 // Support: IE <=9 only 23874 // IE9 has no XHR2 but throws on binary (trac-11426) 23875 // For XHR2 non-text, let the caller handle it (gh-2498) 23876 ( xhr.responseType || "text" ) !== "text" || 23877 typeof xhr.responseText !== "string" ? 23878 { binary: xhr.response } : 23879 { text: xhr.responseText }, 23880 xhr.getAllResponseHeaders() 23881 ); 23882 } 23883 } 23884 }; 23885 }; 23886 23887 // Listen to events 23888 xhr.onload = callback(); 23889 errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" ); 23890 23891 // Support: IE 9 only 23892 // Use onreadystatechange to replace onabort 23893 // to handle uncaught aborts 23894 if ( xhr.onabort !== undefined ) { 23895 xhr.onabort = errorCallback; 23896 } else { 23897 xhr.onreadystatechange = function() { 23898 23899 // Check readyState before timeout as it changes 23900 if ( xhr.readyState === 4 ) { 23901 23902 // Allow onerror to be called first, 23903 // but that will not handle a native abort 23904 // Also, save errorCallback to a variable 23905 // as xhr.onerror cannot be accessed 23906 window.setTimeout( function() { 23907 if ( callback ) { 23908 errorCallback(); 23909 } 23910 } ); 23911 } 23912 }; 23913 } 23914 23915 // Create the abort callback 23916 callback = callback( "abort" ); 23917 23918 try { 23919 23920 // Do send the request (this may raise an exception) 23921 xhr.send( options.hasContent && options.data || null ); 23922 } catch ( e ) { 23923 23924 // #14683: Only rethrow if this hasn't been notified as an error yet 23925 if ( callback ) { 23926 throw e; 23927 } 23928 } 23929 }, 23930 23931 abort: function() { 23932 if ( callback ) { 23933 callback(); 23934 } 23935 } 23936 }; 23937 } 23938} ); 23939 23940 23941 23942 23943// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) 23944jQuery.ajaxPrefilter( function( s ) { 23945 if ( s.crossDomain ) { 23946 s.contents.script = false; 23947 } 23948} ); 23949 23950// Install script dataType 23951jQuery.ajaxSetup( { 23952 accepts: { 23953 script: "text/javascript, application/javascript, " + 23954 "application/ecmascript, application/x-ecmascript" 23955 }, 23956 contents: { 23957 script: /\b(?:java|ecma)script\b/ 23958 }, 23959 converters: { 23960 "text script": function( text ) { 23961 jQuery.globalEval( text ); 23962 return text; 23963 } 23964 } 23965} ); 23966 23967// Handle cache's special case and crossDomain 23968jQuery.ajaxPrefilter( "script", function( s ) { 23969 if ( s.cache === undefined ) { 23970 s.cache = false; 23971 } 23972 if ( s.crossDomain ) { 23973 s.type = "GET"; 23974 } 23975} ); 23976 23977// Bind script tag hack transport 23978jQuery.ajaxTransport( "script", function( s ) { 23979 23980 // This transport only deals with cross domain or forced-by-attrs requests 23981 if ( s.crossDomain || s.scriptAttrs ) { 23982 var script, callback; 23983 return { 23984 send: function( _, complete ) { 23985 script = jQuery( "<script>" ) 23986 .attr( s.scriptAttrs || {} ) 23987 .prop( { charset: s.scriptCharset, src: s.url } ) 23988 .on( "load error", callback = function( evt ) { 23989 script.remove(); 23990 callback = null; 23991 if ( evt ) { 23992 complete( evt.type === "error" ? 404 : 200, evt.type ); 23993 } 23994 } ); 23995 23996 // Use native DOM manipulation to avoid our domManip AJAX trickery 23997 document.head.appendChild( script[ 0 ] ); 23998 }, 23999 abort: function() { 24000 if ( callback ) { 24001 callback(); 24002 } 24003 } 24004 }; 24005 } 24006} ); 24007 24008 24009 24010 24011var oldCallbacks = [], 24012 rjsonp = /(=)\?(?=&|$)|\?\?/; 24013 24014// Default jsonp settings 24015jQuery.ajaxSetup( { 24016 jsonp: "callback", 24017 jsonpCallback: function() { 24018 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce.guid++ ) ); 24019 this[ callback ] = true; 24020 return callback; 24021 } 24022} ); 24023 24024// Detect, normalize options and install callbacks for jsonp requests 24025jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { 24026 24027 var callbackName, overwritten, responseContainer, 24028 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? 24029 "url" : 24030 typeof s.data === "string" && 24031 ( s.contentType || "" ) 24032 .indexOf( "application/x-www-form-urlencoded" ) === 0 && 24033 rjsonp.test( s.data ) && "data" 24034 ); 24035 24036 // Handle iff the expected data type is "jsonp" or we have a parameter to set 24037 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { 24038 24039 // Get callback name, remembering preexisting value associated with it 24040 callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ? 24041 s.jsonpCallback() : 24042 s.jsonpCallback; 24043 24044 // Insert callback into url or form data 24045 if ( jsonProp ) { 24046 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); 24047 } else if ( s.jsonp !== false ) { 24048 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; 24049 } 24050 24051 // Use data converter to retrieve json after script execution 24052 s.converters[ "script json" ] = function() { 24053 if ( !responseContainer ) { 24054 jQuery.error( callbackName + " was not called" ); 24055 } 24056 return responseContainer[ 0 ]; 24057 }; 24058 24059 // Force json dataType 24060 s.dataTypes[ 0 ] = "json"; 24061 24062 // Install callback 24063 overwritten = window[ callbackName ]; 24064 window[ callbackName ] = function() { 24065 responseContainer = arguments; 24066 }; 24067 24068 // Clean-up function (fires after converters) 24069 jqXHR.always( function() { 24070 24071 // If previous value didn't exist - remove it 24072 if ( overwritten === undefined ) { 24073 jQuery( window ).removeProp( callbackName ); 24074 24075 // Otherwise restore preexisting value 24076 } else { 24077 window[ callbackName ] = overwritten; 24078 } 24079 24080 // Save back as free 24081 if ( s[ callbackName ] ) { 24082 24083 // Make sure that re-using the options doesn't screw things around 24084 s.jsonpCallback = originalSettings.jsonpCallback; 24085 24086 // Save the callback name for future use 24087 oldCallbacks.push( callbackName ); 24088 } 24089 24090 // Call if it was a function and we have a response 24091 if ( responseContainer && isFunction( overwritten ) ) { 24092 overwritten( responseContainer[ 0 ] ); 24093 } 24094 24095 responseContainer = overwritten = undefined; 24096 } ); 24097 24098 // Delegate to script 24099 return "script"; 24100 } 24101} ); 24102 24103 24104 24105 24106// Support: Safari 8 only 24107// In Safari 8 documents created via document.implementation.createHTMLDocument 24108// collapse sibling forms: the second one becomes a child of the first one. 24109// Because of that, this security measure has to be disabled in Safari 8. 24110// https://bugs.webkit.org/show_bug.cgi?id=137337 24111support.createHTMLDocument = ( function() { 24112 var body = document.implementation.createHTMLDocument( "" ).body; 24113 body.innerHTML = "<form></form><form></form>"; 24114 return body.childNodes.length === 2; 24115} )(); 24116 24117 24118// Argument "data" should be string of html 24119// context (optional): If specified, the fragment will be created in this context, 24120// defaults to document 24121// keepScripts (optional): If true, will include scripts passed in the html string 24122jQuery.parseHTML = function( data, context, keepScripts ) { 24123 if ( typeof data !== "string" ) { 24124 return []; 24125 } 24126 if ( typeof context === "boolean" ) { 24127 keepScripts = context; 24128 context = false; 24129 } 24130 24131 var base, parsed, scripts; 24132 24133 if ( !context ) { 24134 24135 // Stop scripts or inline event handlers from being executed immediately 24136 // by using document.implementation 24137 if ( support.createHTMLDocument ) { 24138 context = document.implementation.createHTMLDocument( "" ); 24139 24140 // Set the base href for the created document 24141 // so any parsed elements with URLs 24142 // are based on the document's URL (gh-2965) 24143 base = context.createElement( "base" ); 24144 base.href = document.location.href; 24145 context.head.appendChild( base ); 24146 } else { 24147 context = document; 24148 } 24149 } 24150 24151 parsed = rsingleTag.exec( data ); 24152 scripts = !keepScripts && []; 24153 24154 // Single tag 24155 if ( parsed ) { 24156 return [ context.createElement( parsed[ 1 ] ) ]; 24157 } 24158 24159 parsed = buildFragment( [ data ], context, scripts ); 24160 24161 if ( scripts && scripts.length ) { 24162 jQuery( scripts ).remove(); 24163 } 24164 24165 return jQuery.merge( [], parsed.childNodes ); 24166}; 24167 24168 24169/** 24170 * Load a url into a page 24171 */ 24172jQuery.fn.load = function( url, params, callback ) { 24173 var selector, type, response, 24174 self = this, 24175 off = url.indexOf( " " ); 24176 24177 if ( off > -1 ) { 24178 selector = stripAndCollapse( url.slice( off ) ); 24179 url = url.slice( 0, off ); 24180 } 24181 24182 // If it's a function 24183 if ( isFunction( params ) ) { 24184 24185 // We assume that it's the callback 24186 callback = params; 24187 params = undefined; 24188 24189 // Otherwise, build a param string 24190 } else if ( params && typeof params === "object" ) { 24191 type = "POST"; 24192 } 24193 24194 // If we have elements to modify, make the request 24195 if ( self.length > 0 ) { 24196 jQuery.ajax( { 24197 url: url, 24198 24199 // If "type" variable is undefined, then "GET" method will be used. 24200 // Make value of this field explicit since 24201 // user can override it through ajaxSetup method 24202 type: type || "GET", 24203 dataType: "html", 24204 data: params 24205 } ).done( function( responseText ) { 24206 24207 // Save response for use in complete callback 24208 response = arguments; 24209 24210 self.html( selector ? 24211 24212 // If a selector was specified, locate the right elements in a dummy div 24213 // Exclude scripts to avoid IE 'Permission Denied' errors 24214 jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) : 24215 24216 // Otherwise use the full result 24217 responseText ); 24218 24219 // If the request succeeds, this function gets "data", "status", "jqXHR" 24220 // but they are ignored because response was set above. 24221 // If it fails, this function gets "jqXHR", "status", "error" 24222 } ).always( callback && function( jqXHR, status ) { 24223 self.each( function() { 24224 callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] ); 24225 } ); 24226 } ); 24227 } 24228 24229 return this; 24230}; 24231 24232 24233 24234 24235jQuery.expr.pseudos.animated = function( elem ) { 24236 return jQuery.grep( jQuery.timers, function( fn ) { 24237 return elem === fn.elem; 24238 } ).length; 24239}; 24240 24241 24242 24243 24244jQuery.offset = { 24245 setOffset: function( elem, options, i ) { 24246 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, 24247 position = jQuery.css( elem, "position" ), 24248 curElem = jQuery( elem ), 24249 props = {}; 24250 24251 // Set position first, in-case top/left are set even on static elem 24252 if ( position === "static" ) { 24253 elem.style.position = "relative"; 24254 } 24255 24256 curOffset = curElem.offset(); 24257 curCSSTop = jQuery.css( elem, "top" ); 24258 curCSSLeft = jQuery.css( elem, "left" ); 24259 calculatePosition = ( position === "absolute" || position === "fixed" ) && 24260 ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1; 24261 24262 // Need to be able to calculate position if either 24263 // top or left is auto and position is either absolute or fixed 24264 if ( calculatePosition ) { 24265 curPosition = curElem.position(); 24266 curTop = curPosition.top; 24267 curLeft = curPosition.left; 24268 24269 } else { 24270 curTop = parseFloat( curCSSTop ) || 0; 24271 curLeft = parseFloat( curCSSLeft ) || 0; 24272 } 24273 24274 if ( isFunction( options ) ) { 24275 24276 // Use jQuery.extend here to allow modification of coordinates argument (gh-1848) 24277 options = options.call( elem, i, jQuery.extend( {}, curOffset ) ); 24278 } 24279 24280 if ( options.top != null ) { 24281 props.top = ( options.top - curOffset.top ) + curTop; 24282 } 24283 if ( options.left != null ) { 24284 props.left = ( options.left - curOffset.left ) + curLeft; 24285 } 24286 24287 if ( "using" in options ) { 24288 options.using.call( elem, props ); 24289 24290 } else { 24291 curElem.css( props ); 24292 } 24293 } 24294}; 24295 24296jQuery.fn.extend( { 24297 24298 // offset() relates an element's border box to the document origin 24299 offset: function( options ) { 24300 24301 // Preserve chaining for setter 24302 if ( arguments.length ) { 24303 return options === undefined ? 24304 this : 24305 this.each( function( i ) { 24306 jQuery.offset.setOffset( this, options, i ); 24307 } ); 24308 } 24309 24310 var rect, win, 24311 elem = this[ 0 ]; 24312 24313 if ( !elem ) { 24314 return; 24315 } 24316 24317 // Return zeros for disconnected and hidden (display: none) elements (gh-2310) 24318 // Support: IE <=11 only 24319 // Running getBoundingClientRect on a 24320 // disconnected node in IE throws an error 24321 if ( !elem.getClientRects().length ) { 24322 return { top: 0, left: 0 }; 24323 } 24324 24325 // Get document-relative position by adding viewport scroll to viewport-relative gBCR 24326 rect = elem.getBoundingClientRect(); 24327 win = elem.ownerDocument.defaultView; 24328 return { 24329 top: rect.top + win.pageYOffset, 24330 left: rect.left + win.pageXOffset 24331 }; 24332 }, 24333 24334 // position() relates an element's margin box to its offset parent's padding box 24335 // This corresponds to the behavior of CSS absolute positioning 24336 position: function() { 24337 if ( !this[ 0 ] ) { 24338 return; 24339 } 24340 24341 var offsetParent, offset, doc, 24342 elem = this[ 0 ], 24343 parentOffset = { top: 0, left: 0 }; 24344 24345 // position:fixed elements are offset from the viewport, which itself always has zero offset 24346 if ( jQuery.css( elem, "position" ) === "fixed" ) { 24347 24348 // Assume position:fixed implies availability of getBoundingClientRect 24349 offset = elem.getBoundingClientRect(); 24350 24351 } else { 24352 offset = this.offset(); 24353 24354 // Account for the *real* offset parent, which can be the document or its root element 24355 // when a statically positioned element is identified 24356 doc = elem.ownerDocument; 24357 offsetParent = elem.offsetParent || doc.documentElement; 24358 while ( offsetParent && 24359 ( offsetParent === doc.body || offsetParent === doc.documentElement ) && 24360 jQuery.css( offsetParent, "position" ) === "static" ) { 24361 24362 offsetParent = offsetParent.parentNode; 24363 } 24364 if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) { 24365 24366 // Incorporate borders into its offset, since they are outside its content origin 24367 parentOffset = jQuery( offsetParent ).offset(); 24368 parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true ); 24369 parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true ); 24370 } 24371 } 24372 24373 // Subtract parent offsets and element margins 24374 return { 24375 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), 24376 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true ) 24377 }; 24378 }, 24379 24380 // This method will return documentElement in the following cases: 24381 // 1) For the element inside the iframe without offsetParent, this method will return 24382 // documentElement of the parent window 24383 // 2) For the hidden or detached element 24384 // 3) For body or html element, i.e. in case of the html node - it will return itself 24385 // 24386 // but those exceptions were never presented as a real life use-cases 24387 // and might be considered as more preferable results. 24388 // 24389 // This logic, however, is not guaranteed and can change at any point in the future 24390 offsetParent: function() { 24391 return this.map( function() { 24392 var offsetParent = this.offsetParent; 24393 24394 while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) { 24395 offsetParent = offsetParent.offsetParent; 24396 } 24397 24398 return offsetParent || documentElement; 24399 } ); 24400 } 24401} ); 24402 24403// Create scrollLeft and scrollTop methods 24404jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) { 24405 var top = "pageYOffset" === prop; 24406 24407 jQuery.fn[ method ] = function( val ) { 24408 return access( this, function( elem, method, val ) { 24409 24410 // Coalesce documents and windows 24411 var win; 24412 if ( isWindow( elem ) ) { 24413 win = elem; 24414 } else if ( elem.nodeType === 9 ) { 24415 win = elem.defaultView; 24416 } 24417 24418 if ( val === undefined ) { 24419 return win ? win[ prop ] : elem[ method ]; 24420 } 24421 24422 if ( win ) { 24423 win.scrollTo( 24424 !top ? val : win.pageXOffset, 24425 top ? val : win.pageYOffset 24426 ); 24427 24428 } else { 24429 elem[ method ] = val; 24430 } 24431 }, method, val, arguments.length ); 24432 }; 24433} ); 24434 24435// Support: Safari <=7 - 9.1, Chrome <=37 - 49 24436// Add the top/left cssHooks using jQuery.fn.position 24437// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 24438// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347 24439// getComputedStyle returns percent when specified for top/left/bottom/right; 24440// rather than make the css module depend on the offset module, just check for it here 24441jQuery.each( [ "top", "left" ], function( _i, prop ) { 24442 jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition, 24443 function( elem, computed ) { 24444 if ( computed ) { 24445 computed = curCSS( elem, prop ); 24446 24447 // If curCSS returns percentage, fallback to offset 24448 return rnumnonpx.test( computed ) ? 24449 jQuery( elem ).position()[ prop ] + "px" : 24450 computed; 24451 } 24452 } 24453 ); 24454} ); 24455 24456 24457// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods 24458jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { 24459 jQuery.each( { 24460 padding: "inner" + name, 24461 content: type, 24462 "": "outer" + name 24463 }, function( defaultExtra, funcName ) { 24464 24465 // Margin is only for outerHeight, outerWidth 24466 jQuery.fn[ funcName ] = function( margin, value ) { 24467 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), 24468 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); 24469 24470 return access( this, function( elem, type, value ) { 24471 var doc; 24472 24473 if ( isWindow( elem ) ) { 24474 24475 // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729) 24476 return funcName.indexOf( "outer" ) === 0 ? 24477 elem[ "inner" + name ] : 24478 elem.document.documentElement[ "client" + name ]; 24479 } 24480 24481 // Get document width or height 24482 if ( elem.nodeType === 9 ) { 24483 doc = elem.documentElement; 24484 24485 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], 24486 // whichever is greatest 24487 return Math.max( 24488 elem.body[ "scroll" + name ], doc[ "scroll" + name ], 24489 elem.body[ "offset" + name ], doc[ "offset" + name ], 24490 doc[ "client" + name ] 24491 ); 24492 } 24493 24494 return value === undefined ? 24495 24496 // Get width or height on the element, requesting but not forcing parseFloat 24497 jQuery.css( elem, type, extra ) : 24498 24499 // Set width or height on the element 24500 jQuery.style( elem, type, value, extra ); 24501 }, type, chainable ? margin : undefined, chainable ); 24502 }; 24503 } ); 24504} ); 24505 24506 24507jQuery.each( [ 24508 "ajaxStart", 24509 "ajaxStop", 24510 "ajaxComplete", 24511 "ajaxError", 24512 "ajaxSuccess", 24513 "ajaxSend" 24514], function( _i, type ) { 24515 jQuery.fn[ type ] = function( fn ) { 24516 return this.on( type, fn ); 24517 }; 24518} ); 24519 24520 24521 24522 24523jQuery.fn.extend( { 24524 24525 bind: function( types, data, fn ) { 24526 return this.on( types, null, data, fn ); 24527 }, 24528 unbind: function( types, fn ) { 24529 return this.off( types, null, fn ); 24530 }, 24531 24532 delegate: function( selector, types, data, fn ) { 24533 return this.on( types, selector, data, fn ); 24534 }, 24535 undelegate: function( selector, types, fn ) { 24536 24537 // ( namespace ) or ( selector, types [, fn] ) 24538 return arguments.length === 1 ? 24539 this.off( selector, "**" ) : 24540 this.off( types, selector || "**", fn ); 24541 }, 24542 24543 hover: function( fnOver, fnOut ) { 24544 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); 24545 } 24546} ); 24547 24548jQuery.each( 24549 ( "blur focus focusin focusout resize scroll click dblclick " + 24550 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + 24551 "change select submit keydown keypress keyup contextmenu" ).split( " " ), 24552 function( _i, name ) { 24553 24554 // Handle event binding 24555 jQuery.fn[ name ] = function( data, fn ) { 24556 return arguments.length > 0 ? 24557 this.on( name, null, data, fn ) : 24558 this.trigger( name ); 24559 }; 24560 } 24561); 24562 24563 24564 24565 24566// Support: Android <=4.0 only 24567// Make sure we trim BOM and NBSP 24568var rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g; 24569 24570// Bind a function to a context, optionally partially applying any 24571// arguments. 24572// jQuery.proxy is deprecated to promote standards (specifically Function#bind) 24573// However, it is not slated for removal any time soon 24574jQuery.proxy = function( fn, context ) { 24575 var tmp, args, proxy; 24576 24577 if ( typeof context === "string" ) { 24578 tmp = fn[ context ]; 24579 context = fn; 24580 fn = tmp; 24581 } 24582 24583 // Quick check to determine if target is callable, in the spec 24584 // this throws a TypeError, but we will just return undefined. 24585 if ( !isFunction( fn ) ) { 24586 return undefined; 24587 } 24588 24589 // Simulated bind 24590 args = slice.call( arguments, 2 ); 24591 proxy = function() { 24592 return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); 24593 }; 24594 24595 // Set the guid of unique handler to the same of original handler, so it can be removed 24596 proxy.guid = fn.guid = fn.guid || jQuery.guid++; 24597 24598 return proxy; 24599}; 24600 24601jQuery.holdReady = function( hold ) { 24602 if ( hold ) { 24603 jQuery.readyWait++; 24604 } else { 24605 jQuery.ready( true ); 24606 } 24607}; 24608jQuery.isArray = Array.isArray; 24609jQuery.parseJSON = JSON.parse; 24610jQuery.nodeName = nodeName; 24611jQuery.isFunction = isFunction; 24612jQuery.isWindow = isWindow; 24613jQuery.camelCase = camelCase; 24614jQuery.type = toType; 24615 24616jQuery.now = Date.now; 24617 24618jQuery.isNumeric = function( obj ) { 24619 24620 // As of jQuery 3.0, isNumeric is limited to 24621 // strings and numbers (primitives or objects) 24622 // that can be coerced to finite numbers (gh-2662) 24623 var type = jQuery.type( obj ); 24624 return ( type === "number" || type === "string" ) && 24625 24626 // parseFloat NaNs numeric-cast false positives ("") 24627 // ...but misinterprets leading-number strings, particularly hex literals ("0x...") 24628 // subtraction forces infinities to NaN 24629 !isNaN( obj - parseFloat( obj ) ); 24630}; 24631 24632jQuery.trim = function( text ) { 24633 return text == null ? 24634 "" : 24635 ( text + "" ).replace( rtrim, "" ); 24636}; 24637 24638 24639 24640// Register as a named AMD module, since jQuery can be concatenated with other 24641// files that may use define, but not via a proper concatenation script that 24642// understands anonymous AMD modules. A named AMD is safest and most robust 24643// way to register. Lowercase jquery is used because AMD module names are 24644// derived from file names, and jQuery is normally delivered in a lowercase 24645// file name. Do this after creating the global so that if an AMD module wants 24646// to call noConflict to hide this version of jQuery, it will work. 24647 24648// Note that for maximum portability, libraries that are not jQuery should 24649// declare themselves as anonymous modules, and avoid setting a global if an 24650// AMD loader is present. jQuery is a special case. For more information, see 24651// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon 24652 24653if ( true ) { 24654 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() { 24655 return jQuery; 24656 }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), 24657 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 24658} 24659 24660 24661 24662 24663var 24664 24665 // Map over jQuery in case of overwrite 24666 _jQuery = window.jQuery, 24667 24668 // Map over the $ in case of overwrite 24669 _$ = window.$; 24670 24671jQuery.noConflict = function( deep ) { 24672 if ( window.$ === jQuery ) { 24673 window.$ = _$; 24674 } 24675 24676 if ( deep && window.jQuery === jQuery ) { 24677 window.jQuery = _jQuery; 24678 } 24679 24680 return jQuery; 24681}; 24682 24683// Expose jQuery and $ identifiers, even in AMD 24684// (#7102#comment:10, https://github.com/jquery/jquery/pull/557) 24685// and CommonJS for browser emulators (#13566) 24686if ( typeof noGlobal === "undefined" ) { 24687 window.jQuery = window.$ = jQuery; 24688} 24689 24690 24691 24692 24693return jQuery; 24694} ); 24695 24696 24697/***/ }), 24698
vendor: 18,210 bytes, lines 24699-25343
24699/***/ "./node_modules/lity/dist/lity.js": 24700/*!****************************************!*\ 24701 !*** ./node_modules/lity/dist/lity.js ***! 24702 \****************************************/ 24703/***/ (function(module, exports, __webpack_require__) { 24704 24705var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! Lity - v2.4.1 - 2020-04-26 24706* http://sorgalla.com/lity/ 24707* Copyright (c) 2015-2020 Jan Sorgalla; Licensed MIT */ 24708(function(window, factory) { 24709 if (true) { 24710 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_RESULT__ = (function($) { 24711 return factory(window, $); 24712 }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), 24713 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 24714 } else {} 24715}(typeof window !== "undefined" ? window : this, function(window, $) { 24716 'use strict'; 24717 24718 var document = window.document; 24719 24720 var _win = $(window); 24721 var _deferred = $.Deferred; 24722 var _html = $('html'); 24723 var _instances = []; 24724 24725 var _attrAriaHidden = 'aria-hidden'; 24726 var _dataAriaHidden = 'lity-' + _attrAriaHidden; 24727 24728 var _focusableElementsSelector = 'a[href],area[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),iframe,object,embed,[contenteditable],[tabindex]:not([tabindex^="-"])'; 24729 24730 var _defaultOptions = { 24731 esc: true, 24732 handler: null, 24733 handlers: { 24734 image: imageHandler, 24735 inline: inlineHandler, 24736 youtube: youtubeHandler, 24737 vimeo: vimeoHandler, 24738 googlemaps: googlemapsHandler, 24739 facebookvideo: facebookvideoHandler, 24740 iframe: iframeHandler 24741 }, 24742 template: '<div class="lity" role="dialog" aria-label="Dialog Window (Press escape to close)" tabindex="-1"><div class="lity-wrap" data-lity-close role="document"><div class="lity-loader" aria-hidden="true">Loading...</div><div class="lity-container"><div class="lity-content"></div><button class="lity-close" type="button" aria-label="Close (Press escape to close)" data-lity-close>×</button></div></div></div>' 24743 }; 24744 24745 var _imageRegexp = /(^data:image\/)|(\.(png|jpe?g|gif|svg|webp|bmp|ico|tiff?)(\?\S*)?$)/i; 24746 var _youtubeRegex = /(youtube(-nocookie)?\.com|youtu\.be)\/(watch\?v=|v\/|u\/|embed\/?)?([\w-]{11})(.*)?/i; 24747 var _vimeoRegex = /(vimeo(pro)?.com)\/(?:[^\d]+)?(\d+)\??(.*)?$/; 24748 var _googlemapsRegex = /((maps|www)\.)?google\.([^\/\?]+)\/?((maps\/?)?\?)(.*)/i; 24749 var _facebookvideoRegex = /(facebook\.com)\/([a-z0-9_-]*)\/videos\/([0-9]*)(.*)?$/i; 24750 24751 var _transitionEndEvent = (function() { 24752 var el = document.createElement('div'); 24753 24754 var transEndEventNames = { 24755 WebkitTransition: 'webkitTransitionEnd', 24756 MozTransition: 'transitionend', 24757 OTransition: 'oTransitionEnd otransitionend', 24758 transition: 'transitionend' 24759 }; 24760 24761 for (var name in transEndEventNames) { 24762 if (el.style[name] !== undefined) { 24763 return transEndEventNames[name]; 24764 } 24765 } 24766 24767 return false; 24768 })(); 24769 24770 function transitionEnd(element) { 24771 var deferred = _deferred(); 24772 24773 if (!_transitionEndEvent || !element.length) { 24774 deferred.resolve(); 24775 } else { 24776 element.one(_transitionEndEvent, deferred.resolve); 24777 setTimeout(deferred.resolve, 500); 24778 } 24779 24780 return deferred.promise(); 24781 } 24782 24783 function settings(currSettings, key, value) { 24784 if (arguments.length === 1) { 24785 return $.extend({}, currSettings); 24786 } 24787 24788 if (typeof key === 'string') { 24789 if (typeof value === 'undefined') { 24790 return typeof currSettings[key] === 'undefined' 24791 ? null 24792 : currSettings[key]; 24793 } 24794 24795 currSettings[key] = value; 24796 } else { 24797 $.extend(currSettings, key); 24798 } 24799 24800 return this; 24801 } 24802 24803 function parseQueryParams(params) { 24804 var pairs = decodeURI(params.split('#')[0]).split('&'); 24805 var obj = {}, p; 24806 24807 for (var i = 0, n = pairs.length; i < n; i++) { 24808 if (!pairs[i]) { 24809 continue; 24810 } 24811 24812 p = pairs[i].split('='); 24813 obj[p[0]] = p[1]; 24814 } 24815 24816 return obj; 24817 } 24818 24819 function appendQueryParams(url, params) { 24820 return url + (url.indexOf('?') > -1 ? '&' : '?') + $.param(params); 24821 } 24822 24823 function transferHash(originalUrl, newUrl) { 24824 var pos = originalUrl.indexOf('#'); 24825 24826 if (-1 === pos) { 24827 return newUrl; 24828 } 24829 24830 if (pos > 0) { 24831 originalUrl = originalUrl.substr(pos); 24832 } 24833 24834 return newUrl + originalUrl; 24835 } 24836 24837 function error(msg) { 24838 return $('<span class="lity-error"></span>').append(msg); 24839 } 24840 24841 function imageHandler(target, instance) { 24842 var desc = (instance.opener() && instance.opener().data('lity-desc')) || 'Image with no description'; 24843 var img = $('<img src="' + target + '" alt="' + desc + '"/>'); 24844 var deferred = _deferred(); 24845 var failed = function() { 24846 deferred.reject(error('Failed loading image')); 24847 }; 24848 24849 img 24850 .on('load', function() { 24851 if (this.naturalWidth === 0) { 24852 return failed(); 24853 } 24854 24855 deferred.resolve(img); 24856 }) 24857 .on('error', failed) 24858 ; 24859 24860 return deferred.promise(); 24861 } 24862 24863 imageHandler.test = function(target) { 24864 return _imageRegexp.test(target); 24865 }; 24866 24867 function inlineHandler(target, instance) { 24868 var el, placeholder, hasHideClass; 24869 24870 try { 24871 el = $(target); 24872 } catch (e) { 24873 return false; 24874 } 24875 24876 if (!el.length) { 24877 return false; 24878 } 24879 24880 placeholder = $('<i style="display:none !important"></i>'); 24881 hasHideClass = el.hasClass('lity-hide'); 24882 24883 instance 24884 .element() 24885 .one('lity:remove', function() { 24886 placeholder 24887 .before(el) 24888 .remove() 24889 ; 24890 24891 if (hasHideClass && !el.closest('.lity-content').length) { 24892 el.addClass('lity-hide'); 24893 } 24894 }) 24895 ; 24896 24897 return el 24898 .removeClass('lity-hide') 24899 .after(placeholder) 24900 ; 24901 } 24902 24903 function youtubeHandler(target) { 24904 var matches = _youtubeRegex.exec(target); 24905 24906 if (!matches) { 24907 return false; 24908 } 24909 24910 return iframeHandler( 24911 transferHash( 24912 target, 24913 appendQueryParams( 24914 'https://www.youtube' + (matches[2] || '') + '.com/embed/' + matches[4], 24915 $.extend( 24916 { 24917 autoplay: 1 24918 }, 24919 parseQueryParams(matches[5] || '') 24920 ) 24921 ) 24922 ) 24923 ); 24924 } 24925 24926 function vimeoHandler(target) { 24927 var matches = _vimeoRegex.exec(target); 24928 24929 if (!matches) { 24930 return false; 24931 } 24932 24933 return iframeHandler( 24934 transferHash( 24935 target, 24936 appendQueryParams( 24937 'https://player.vimeo.com/video/' + matches[3], 24938 $.extend( 24939 { 24940 autoplay: 1 24941 }, 24942 parseQueryParams(matches[4] || '') 24943 ) 24944 ) 24945 ) 24946 ); 24947 } 24948 24949 function facebookvideoHandler(target) { 24950 var matches = _facebookvideoRegex.exec(target); 24951 24952 if (!matches) { 24953 return false; 24954 } 24955 24956 if (0 !== target.indexOf('http')) { 24957 target = 'https:' + target; 24958 } 24959 24960 return iframeHandler( 24961 transferHash( 24962 target, 24963 appendQueryParams( 24964 'https://www.facebook.com/plugins/video.php?href=' + target, 24965 $.extend( 24966 { 24967 autoplay: 1 24968 }, 24969 parseQueryParams(matches[4] || '') 24970 ) 24971 ) 24972 ) 24973 ); 24974 } 24975 24976 function googlemapsHandler(target) { 24977 var matches = _googlemapsRegex.exec(target); 24978 24979 if (!matches) { 24980 return false; 24981 } 24982 24983 return iframeHandler( 24984 transferHash( 24985 target, 24986 appendQueryParams( 24987 'https://www.google.' + matches[3] + '/maps?' + matches[6], 24988 { 24989 output: matches[6].indexOf('layer=c') > 0 ? 'svembed' : 'embed' 24990 } 24991 ) 24992 ) 24993 ); 24994 } 24995 24996 function iframeHandler(target) { 24997 return '<div class="lity-iframe-container"><iframe frameborder="0" allowfullscreen allow="autoplay; fullscreen" src="' + target + '"/></div>'; 24998 } 24999 25000 function winHeight() { 25001 return document.documentElement.clientHeight 25002 ? document.documentElement.clientHeight 25003 : Math.round(_win.height()); 25004 } 25005 25006 function keydown(e) { 25007 var current = currentInstance(); 25008 25009 if (!current) { 25010 return; 25011 } 25012 25013 // ESC key 25014 if (e.keyCode === 27 && !!current.options('esc')) { 25015 current.close(); 25016 } 25017 25018 // TAB key 25019 if (e.keyCode === 9) { 25020 handleTabKey(e, current); 25021 } 25022 } 25023 25024 function handleTabKey(e, instance) { 25025 var focusableElements = instance.element().find(_focusableElementsSelector); 25026 var focusedIndex = focusableElements.index(document.activeElement); 25027 25028 if (e.shiftKey && focusedIndex <= 0) { 25029 focusableElements.get(focusableElements.length - 1).focus(); 25030 e.preventDefault(); 25031 } else if (!e.shiftKey && focusedIndex === focusableElements.length - 1) { 25032 focusableElements.get(0).focus(); 25033 e.preventDefault(); 25034 } 25035 } 25036 25037 function resize() { 25038 $.each(_instances, function(i, instance) { 25039 instance.resize(); 25040 }); 25041 } 25042 25043 function registerInstance(instanceToRegister) { 25044 if (1 === _instances.unshift(instanceToRegister)) { 25045 _html.addClass('lity-active'); 25046 25047 _win 25048 .on({ 25049 resize: resize, 25050 keydown: keydown 25051 }) 25052 ; 25053 } 25054 25055 $('body > *').not(instanceToRegister.element()) 25056 .addClass('lity-hidden') 25057 .each(function() { 25058 var el = $(this); 25059 25060 if (undefined !== el.data(_dataAriaHidden)) { 25061 return; 25062 } 25063 25064 el.data(_dataAriaHidden, el.attr(_attrAriaHidden) || null); 25065 }) 25066 .attr(_attrAriaHidden, 'true') 25067 ; 25068 } 25069 25070 function removeInstance(instanceToRemove) { 25071 var show; 25072 25073 instanceToRemove 25074 .element() 25075 .attr(_attrAriaHidden, 'true') 25076 ; 25077 25078 if (1 === _instances.length) { 25079 _html.removeClass('lity-active'); 25080 25081 _win 25082 .off({ 25083 resize: resize, 25084 keydown: keydown 25085 }) 25086 ; 25087 } 25088 25089 _instances = $.grep(_instances, function(instance) { 25090 return instanceToRemove !== instance; 25091 }); 25092 25093 if (!!_instances.length) { 25094 show = _instances[0].element(); 25095 } else { 25096 show = $('.lity-hidden'); 25097 } 25098 25099 show 25100 .removeClass('lity-hidden') 25101 .each(function() { 25102 var el = $(this), oldAttr = el.data(_dataAriaHidden); 25103 25104 if (!oldAttr) { 25105 el.removeAttr(_attrAriaHidden); 25106 } else { 25107 el.attr(_attrAriaHidden, oldAttr); 25108 } 25109 25110 el.removeData(_dataAriaHidden); 25111 }) 25112 ; 25113 } 25114 25115 function currentInstance() { 25116 if (0 === _instances.length) { 25117 return null; 25118 } 25119 25120 return _instances[0]; 25121 } 25122 25123 function factory(target, instance, handlers, preferredHandler) { 25124 var handler = 'inline', content; 25125 25126 var currentHandlers = $.extend({}, handlers); 25127 25128 if (preferredHandler && currentHandlers[preferredHandler]) { 25129 content = currentHandlers[preferredHandler](target, instance); 25130 handler = preferredHandler; 25131 } else { 25132 // Run inline and iframe handlers after all other handlers 25133 $.each(['inline', 'iframe'], function(i, name) { 25134 delete currentHandlers[name]; 25135 25136 currentHandlers[name] = handlers[name]; 25137 }); 25138 25139 $.each(currentHandlers, function(name, currentHandler) { 25140 // Handler might be "removed" by setting callback to null 25141 if (!currentHandler) { 25142 return true; 25143 } 25144 25145 if ( 25146 currentHandler.test && 25147 !currentHandler.test(target, instance) 25148 ) { 25149 return true; 25150 } 25151 25152 content = currentHandler(target, instance); 25153 25154 if (false !== content) { 25155 handler = name; 25156 return false; 25157 } 25158 }); 25159 } 25160 25161 return {handler: handler, content: content || ''}; 25162 } 25163 25164 function Lity(target, options, opener, activeElement) { 25165 var self = this; 25166 var result; 25167 var isReady = false; 25168 var isClosed = false; 25169 var element; 25170 var content; 25171 25172 options = $.extend( 25173 {}, 25174 _defaultOptions, 25175 options 25176 ); 25177 25178 element = $(options.template); 25179 25180 // -- API -- 25181 25182 self.element = function() { 25183 return element; 25184 }; 25185 25186 self.opener = function() { 25187 return opener; 25188 }; 25189 25190 self.options = $.proxy(settings, self, options); 25191 self.handlers = $.proxy(settings, self, options.handlers); 25192 25193 self.resize = function() { 25194 if (!isReady || isClosed) { 25195 return; 25196 } 25197 25198 content 25199 .css('max-height', winHeight() + 'px') 25200 .trigger('lity:resize', [self]) 25201 ; 25202 }; 25203 25204 self.close = function() { 25205 if (!isReady || isClosed) { 25206 return; 25207 } 25208 25209 isClosed = true; 25210 25211 removeInstance(self); 25212 25213 var deferred = _deferred(); 25214 25215 // We return focus only if the current focus is inside this instance 25216 if ( 25217 activeElement && 25218 ( 25219 document.activeElement === element[0] || 25220 $.contains(element[0], document.activeElement) 25221 ) 25222 ) { 25223 try { 25224 activeElement.focus(); 25225 } catch (e) { 25226 // Ignore exceptions, eg. for SVG elements which can't be 25227 // focused in IE11 25228 } 25229 } 25230 25231 content.trigger('lity:close', [self]); 25232 25233 element 25234 .removeClass('lity-opened') 25235 .addClass('lity-closed') 25236 ; 25237 25238 transitionEnd(content.add(element)) 25239 .always(function() { 25240 content.trigger('lity:remove', [self]); 25241 element.remove(); 25242 element = undefined; 25243 deferred.resolve(); 25244 }) 25245 ; 25246 25247 return deferred.promise(); 25248 }; 25249 25250 // -- Initialization -- 25251 25252 result = factory(target, self, options.handlers, options.handler); 25253 25254 element 25255 .attr(_attrAriaHidden, 'false') 25256 .addClass('lity-loading lity-opened lity-' + result.handler) 25257 .appendTo('body') 25258 .focus() 25259 .on('click', '[data-lity-close]', function(e) { 25260 if ($(e.target).is('[data-lity-close]')) { 25261 self.close(); 25262 } 25263 }) 25264 .trigger('lity:open', [self]) 25265 ; 25266 25267 registerInstance(self); 25268 25269 $.when(result.content) 25270 .always(ready) 25271 ; 25272 25273 function ready(result) { 25274 content = $(result) 25275 .css('max-height', winHeight() + 'px') 25276 ; 25277 25278 element 25279 .find('.lity-loader') 25280 .each(function() { 25281 var loader = $(this); 25282 25283 transitionEnd(loader) 25284 .always(function() { 25285 loader.remove(); 25286 }) 25287 ; 25288 }) 25289 ; 25290 25291 element 25292 .removeClass('lity-loading') 25293 .find('.lity-content') 25294 .empty() 25295 .append(content) 25296 ; 25297 25298 isReady = true; 25299 25300 content 25301 .trigger('lity:ready', [self]) 25302 ; 25303 } 25304 } 25305 25306 function lity(target, options, opener) { 25307 if (!target.preventDefault) { 25308 opener = $(opener); 25309 } else { 25310 target.preventDefault(); 25311 opener = $(this); 25312 target = opener.data('lity-target') || opener.attr('href') || opener.attr('src'); 25313 } 25314 25315 var instance = new Lity( 25316 target, 25317 $.extend( 25318 {}, 25319 opener.data('lity-options') || opener.data('lity'), 25320 options 25321 ), 25322 opener, 25323 document.activeElement 25324 ); 25325 25326 if (!target.preventDefault) { 25327 return instance; 25328 } 25329 } 25330 25331 lity.version = '2.4.1'; 25332 lity.options = $.proxy(settings, lity, _defaultOptions); 25333 lity.handlers = $.proxy(settings, lity, _defaultOptions.handlers); 25334 lity.current = currentInstance; 25335 25336 $(document).on('click.lity', '[data-lity]', lity); 25337 25338 return lity; 25339})); 25340 25341 25342/***/ }), 25343
vendor: 3,309 bytes, lines 25344-25353
25344/***/ "./node_modules/objectFitPolyfill/dist/objectFitPolyfill.min.js": 25345/*!**********************************************************************!*\ 25346 !*** ./node_modules/objectFitPolyfill/dist/objectFitPolyfill.min.js ***! 25347 \**********************************************************************/ 25348/***/ (() => { 25349 25350!function(){"use strict";if("undefined"!=typeof window){var t=window.navigator.userAgent.match(/Edge\/(\d{2})\./),e=t?parseInt(t[1],10):null,n=!!e&&(16<=e&&e<=18);if(!("objectFit"in document.documentElement.style!=!1)||n){var o=function(t,e,i){var n,o,l,a,d;if((i=i.split(" ")).length<2&&(i[1]=i[0]),"x"===t)n=i[0],o=i[1],l="left",a="right",d=e.clientWidth;else{if("y"!==t)return;n=i[1],o=i[0],l="top",a="bottom",d=e.clientHeight}if(n!==l&&o!==l){if(n!==a&&o!==a)return"center"===n||"50%"===n?(e.style[l]="50%",void(e.style["margin-"+l]=d/-2+"px")):void(0<=n.indexOf("%")?(n=parseInt(n,10))<50?(e.style[l]=n+"%",e.style["margin-"+l]=d*(n/-100)+"px"):(n=100-n,e.style[a]=n+"%",e.style["margin-"+a]=d*(n/-100)+"px"):e.style[l]=n);e.style[a]="0"}else e.style[l]="0"},l=function(t){var e=t.dataset?t.dataset.objectFit:t.getAttribute("data-object-fit"),i=t.dataset?t.dataset.objectPosition:t.getAttribute("data-object-position");e=e||"cover",i=i||"50% 50%";var n=t.parentNode;return function(t){var e=window.getComputedStyle(t,null),i=e.getPropertyValue("position"),n=e.getPropertyValue("overflow"),o=e.getPropertyValue("display");i&&"static"!==i||(t.style.position="relative"),"hidden"!==n&&(t.style.overflow="hidden"),o&&"inline"!==o||(t.style.display="block"),0===t.clientHeight&&(t.style.height="100%"),-1===t.className.indexOf("object-fit-polyfill")&&(t.className=t.className+" object-fit-polyfill")}(n),function(t){var e=window.getComputedStyle(t,null),i={"max-width":"none","max-height":"none","min-width":"0px","min-height":"0px",top:"auto",right:"auto",bottom:"auto",left:"auto","margin-top":"0px","margin-right":"0px","margin-bottom":"0px","margin-left":"0px"};for(var n in i)e.getPropertyValue(n)!==i[n]&&(t.style[n]=i[n])}(t),t.style.position="absolute",t.style.width="auto",t.style.height="auto","scale-down"===e&&(e=t.clientWidth<n.clientWidth&&t.clientHeight<n.clientHeight?"none":"contain"),"none"===e?(o("x",t,i),void o("y",t,i)):"fill"===e?(t.style.width="100%",t.style.height="100%",o("x",t,i),void o("y",t,i)):(t.style.height="100%",void("cover"===e&&t.clientWidth>n.clientWidth||"contain"===e&&t.clientWidth<n.clientWidth?(t.style.top="0",t.style.marginTop="0",o("x",t,i)):(t.style.width="100%",t.style.height="auto",t.style.left="0",t.style.marginLeft="0",o("y",t,i))))},i=function(t){if(void 0===t||t instanceof Event)t=document.querySelectorAll("[data-object-fit]");else if(t&&t.nodeName)t=[t];else{if("object"!=typeof t||!t.length||!t[0].nodeName)return!1;t=t}for(var e=0;e<t.length;e++)if(t[e].nodeName){var i=t[e].nodeName.toLowerCase();if("img"===i){if(n)continue;t[e].complete?l(t[e]):t[e].addEventListener("load",function(){l(this)})}else"video"===i?0<t[e].readyState?l(t[e]):t[e].addEventListener("loadedmetadata",function(){l(this)}):l(t[e])}return!0};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",i):i(),window.addEventListener("resize",i),window.objectFitPolyfill=i}else window.objectFitPolyfill=function(){return!1}}}(); 25351 25352/***/ }), 25353
vendor: 89,083 bytes, lines 25354-27984
25354/***/ "./node_modules/popper.js/dist/esm/popper.js": 25355/*!***************************************************!*\ 25356 !*** ./node_modules/popper.js/dist/esm/popper.js ***! 25357 \***************************************************/ 25358/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 25359 25360"use strict"; 25361__webpack_require__.r(__webpack_exports__); 25362/* harmony export */ __webpack_require__.d(__webpack_exports__, { 25363/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) 25364/* harmony export */ }); 25365/**! 25366 * @fileOverview Kickass library to create and place poppers near their reference elements. 25367 * @version 1.16.1 25368 * @license 25369 * Copyright (c) 2016 Federico Zivolo and contributors 25370 * 25371 * Permission is hereby granted, free of charge, to any person obtaining a copy 25372 * of this software and associated documentation files (the "Software"), to deal 25373 * in the Software without restriction, including without limitation the rights 25374 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25375 * copies of the Software, and to permit persons to whom the Software is 25376 * furnished to do so, subject to the following conditions: 25377 * 25378 * The above copyright notice and this permission notice shall be included in all 25379 * copies or substantial portions of the Software. 25380 * 25381 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25382 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25383 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25384 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25385 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25386 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25387 * SOFTWARE. 25388 */ 25389var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined'; 25390 25391var timeoutDuration = function () { 25392 var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox']; 25393 for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) { 25394 if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) { 25395 return 1; 25396 } 25397 } 25398 return 0; 25399}(); 25400 25401function microtaskDebounce(fn) { 25402 var called = false; 25403 return function () { 25404 if (called) { 25405 return; 25406 } 25407 called = true; 25408 window.Promise.resolve().then(function () { 25409 called = false; 25410 fn(); 25411 }); 25412 }; 25413} 25414 25415function taskDebounce(fn) { 25416 var scheduled = false; 25417 return function () { 25418 if (!scheduled) { 25419 scheduled = true; 25420 setTimeout(function () { 25421 scheduled = false; 25422 fn(); 25423 }, timeoutDuration); 25424 } 25425 }; 25426} 25427 25428var supportsMicroTasks = isBrowser && window.Promise; 25429 25430/** 25431* Create a debounced version of a method, that's asynchronously deferred 25432* but called in the minimum time possible. 25433* 25434* @method 25435* @memberof Popper.Utils 25436* @argument {Function} fn 25437* @returns {Function} 25438*/ 25439var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce; 25440 25441/** 25442 * Check if the given variable is a function 25443 * @method 25444 * @memberof Popper.Utils 25445 * @argument {Any} functionToCheck - variable to check 25446 * @returns {Boolean} answer to: is a function? 25447 */ 25448function isFunction(functionToCheck) { 25449 var getType = {}; 25450 return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]'; 25451} 25452 25453/** 25454 * Get CSS computed property of the given element 25455 * @method 25456 * @memberof Popper.Utils 25457 * @argument {Eement} element 25458 * @argument {String} property 25459 */ 25460function getStyleComputedProperty(element, property) { 25461 if (element.nodeType !== 1) { 25462 return []; 25463 } 25464 // NOTE: 1 DOM access here 25465 var window = element.ownerDocument.defaultView; 25466 var css = window.getComputedStyle(element, null); 25467 return property ? css[property] : css; 25468} 25469 25470/** 25471 * Returns the parentNode or the host of the element 25472 * @method 25473 * @memberof Popper.Utils 25474 * @argument {Element} element 25475 * @returns {Element} parent 25476 */ 25477function getParentNode(element) { 25478 if (element.nodeName === 'HTML') { 25479 return element; 25480 } 25481 return element.parentNode || element.host; 25482} 25483 25484/** 25485 * Returns the scrolling parent of the given element 25486 * @method 25487 * @memberof Popper.Utils 25488 * @argument {Element} element 25489 * @returns {Element} scroll parent 25490 */ 25491function getScrollParent(element) { 25492 // Return body, `getScroll` will take care to get the correct `scrollTop` from it 25493 if (!element) { 25494 return document.body; 25495 } 25496 25497 switch (element.nodeName) { 25498 case 'HTML': 25499 case 'BODY': 25500 return element.ownerDocument.body; 25501 case '#document': 25502 return element.body; 25503 } 25504 25505 // Firefox want us to check `-x` and `-y` variations as well 25506 25507 var _getStyleComputedProp = getStyleComputedProperty(element), 25508 overflow = _getStyleComputedProp.overflow, 25509 overflowX = _getStyleComputedProp.overflowX, 25510 overflowY = _getStyleComputedProp.overflowY; 25511 25512 if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) { 25513 return element; 25514 } 25515 25516 return getScrollParent(getParentNode(element)); 25517} 25518 25519/** 25520 * Returns the reference node of the reference object, or the reference object itself. 25521 * @method 25522 * @memberof Popper.Utils 25523 * @param {Element|Object} reference - the reference element (the popper will be relative to this) 25524 * @returns {Element} parent 25525 */ 25526function getReferenceNode(reference) { 25527 return reference && reference.referenceNode ? reference.referenceNode : reference; 25528} 25529 25530var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode); 25531var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent); 25532 25533/** 25534 * Determines if the browser is Internet Explorer 25535 * @method 25536 * @memberof Popper.Utils 25537 * @param {Number} version to check 25538 * @returns {Boolean} isIE 25539 */ 25540function isIE(version) { 25541 if (version === 11) { 25542 return isIE11; 25543 } 25544 if (version === 10) { 25545 return isIE10; 25546 } 25547 return isIE11 || isIE10; 25548} 25549 25550/** 25551 * Returns the offset parent of the given element 25552 * @method 25553 * @memberof Popper.Utils 25554 * @argument {Element} element 25555 * @returns {Element} offset parent 25556 */ 25557function getOffsetParent(element) { 25558 if (!element) { 25559 return document.documentElement; 25560 } 25561 25562 var noOffsetParent = isIE(10) ? document.body : null; 25563 25564 // NOTE: 1 DOM access here 25565 var offsetParent = element.offsetParent || null; 25566 // Skip hidden elements which don't have an offsetParent 25567 while (offsetParent === noOffsetParent && element.nextElementSibling) { 25568 offsetParent = (element = element.nextElementSibling).offsetParent; 25569 } 25570 25571 var nodeName = offsetParent && offsetParent.nodeName; 25572 25573 if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') { 25574 return element ? element.ownerDocument.documentElement : document.documentElement; 25575 } 25576 25577 // .offsetParent will return the closest TH, TD or TABLE in case 25578 // no offsetParent is present, I hate this job... 25579 if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') { 25580 return getOffsetParent(offsetParent); 25581 } 25582 25583 return offsetParent; 25584} 25585 25586function isOffsetContainer(element) { 25587 var nodeName = element.nodeName; 25588 25589 if (nodeName === 'BODY') { 25590 return false; 25591 } 25592 return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element; 25593} 25594 25595/** 25596 * Finds the root node (document, shadowDOM root) of the given element 25597 * @method 25598 * @memberof Popper.Utils 25599 * @argument {Element} node 25600 * @returns {Element} root node 25601 */ 25602function getRoot(node) { 25603 if (node.parentNode !== null) { 25604 return getRoot(node.parentNode); 25605 } 25606 25607 return node; 25608} 25609 25610/** 25611 * Finds the offset parent common to the two provided nodes 25612 * @method 25613 * @memberof Popper.Utils 25614 * @argument {Element} element1 25615 * @argument {Element} element2 25616 * @returns {Element} common offset parent 25617 */ 25618function findCommonOffsetParent(element1, element2) { 25619 // This check is needed to avoid errors in case one of the elements isn't defined for any reason 25620 if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) { 25621 return document.documentElement; 25622 } 25623 25624 // Here we make sure to give as "start" the element that comes first in the DOM 25625 var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING; 25626 var start = order ? element1 : element2; 25627 var end = order ? element2 : element1; 25628 25629 // Get common ancestor container 25630 var range = document.createRange(); 25631 range.setStart(start, 0); 25632 range.setEnd(end, 0); 25633 var commonAncestorContainer = range.commonAncestorContainer; 25634 25635 // Both nodes are inside #document 25636 25637 if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) { 25638 if (isOffsetContainer(commonAncestorContainer)) { 25639 return commonAncestorContainer; 25640 } 25641 25642 return getOffsetParent(commonAncestorContainer); 25643 } 25644 25645 // one of the nodes is inside shadowDOM, find which one 25646 var element1root = getRoot(element1); 25647 if (element1root.host) { 25648 return findCommonOffsetParent(element1root.host, element2); 25649 } else { 25650 return findCommonOffsetParent(element1, getRoot(element2).host); 25651 } 25652} 25653 25654/** 25655 * Gets the scroll value of the given element in the given side (top and left) 25656 * @method 25657 * @memberof Popper.Utils 25658 * @argument {Element} element 25659 * @argument {String} side `top` or `left` 25660 * @returns {number} amount of scrolled pixels 25661 */ 25662function getScroll(element) { 25663 var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top'; 25664 25665 var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft'; 25666 var nodeName = element.nodeName; 25667 25668 if (nodeName === 'BODY' || nodeName === 'HTML') { 25669 var html = element.ownerDocument.documentElement; 25670 var scrollingElement = element.ownerDocument.scrollingElement || html; 25671 return scrollingElement[upperSide]; 25672 } 25673 25674 return element[upperSide]; 25675} 25676 25677/* 25678 * Sum or subtract the element scroll values (left and top) from a given rect object 25679 * @method 25680 * @memberof Popper.Utils 25681 * @param {Object} rect - Rect object you want to change 25682 * @param {HTMLElement} element - The element from the function reads the scroll values 25683 * @param {Boolean} subtract - set to true if you want to subtract the scroll values 25684 * @return {Object} rect - The modifier rect object 25685 */ 25686function includeScroll(rect, element) { 25687 var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; 25688 25689 var scrollTop = getScroll(element, 'top'); 25690 var scrollLeft = getScroll(element, 'left'); 25691 var modifier = subtract ? -1 : 1; 25692 rect.top += scrollTop * modifier; 25693 rect.bottom += scrollTop * modifier; 25694 rect.left += scrollLeft * modifier; 25695 rect.right += scrollLeft * modifier; 25696 return rect; 25697} 25698 25699/* 25700 * Helper to detect borders of a given element 25701 * @method 25702 * @memberof Popper.Utils 25703 * @param {CSSStyleDeclaration} styles 25704 * Result of `getStyleComputedProperty` on the given element 25705 * @param {String} axis - `x` or `y` 25706 * @return {number} borders - The borders size of the given axis 25707 */ 25708 25709function getBordersSize(styles, axis) { 25710 var sideA = axis === 'x' ? 'Left' : 'Top'; 25711 var sideB = sideA === 'Left' ? 'Right' : 'Bottom'; 25712 25713 return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']); 25714} 25715 25716function getSize(axis, body, html, computedStyle) { 25717 return Math.max(body['offset' + axis], body['scroll' + axis], html['client' + axis], html['offset' + axis], html['scroll' + axis], isIE(10) ? parseInt(html['offset' + axis]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Top' : 'Left')]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Bottom' : 'Right')]) : 0); 25718} 25719 25720function getWindowSizes(document) { 25721 var body = document.body; 25722 var html = document.documentElement; 25723 var computedStyle = isIE(10) && getComputedStyle(html); 25724 25725 return { 25726 height: getSize('Height', body, html, computedStyle), 25727 width: getSize('Width', body, html, computedStyle) 25728 }; 25729} 25730 25731var classCallCheck = function (instance, Constructor) { 25732 if (!(instance instanceof Constructor)) { 25733 throw new TypeError("Cannot call a class as a function"); 25734 } 25735}; 25736 25737var createClass = function () { 25738 function defineProperties(target, props) { 25739 for (var i = 0; i < props.length; i++) { 25740 var descriptor = props[i]; 25741 descriptor.enumerable = descriptor.enumerable || false; 25742 descriptor.configurable = true; 25743 if ("value" in descriptor) descriptor.writable = true; 25744 Object.defineProperty(target, descriptor.key, descriptor); 25745 } 25746 } 25747 25748 return function (Constructor, protoProps, staticProps) { 25749 if (protoProps) defineProperties(Constructor.prototype, protoProps); 25750 if (staticProps) defineProperties(Constructor, staticProps); 25751 return Constructor; 25752 }; 25753}(); 25754 25755 25756 25757 25758 25759var defineProperty = function (obj, key, value) { 25760 if (key in obj) { 25761 Object.defineProperty(obj, key, { 25762 value: value, 25763 enumerable: true, 25764 configurable: true, 25765 writable: true 25766 }); 25767 } else { 25768 obj[key] = value; 25769 } 25770 25771 return obj; 25772}; 25773 25774var _extends = Object.assign || function (target) { 25775 for (var i = 1; i < arguments.length; i++) { 25776 var source = arguments[i]; 25777 25778 for (var key in source) { 25779 if (Object.prototype.hasOwnProperty.call(source, key)) { 25780 target[key] = source[key]; 25781 } 25782 } 25783 } 25784 25785 return target; 25786}; 25787 25788/** 25789 * Given element offsets, generate an output similar to getBoundingClientRect 25790 * @method 25791 * @memberof Popper.Utils 25792 * @argument {Object} offsets 25793 * @returns {Object} ClientRect like output 25794 */ 25795function getClientRect(offsets) { 25796 return _extends({}, offsets, { 25797 right: offsets.left + offsets.width, 25798 bottom: offsets.top + offsets.height 25799 }); 25800} 25801 25802/** 25803 * Get bounding client rect of given element 25804 * @method 25805 * @memberof Popper.Utils 25806 * @param {HTMLElement} element 25807 * @return {Object} client rect 25808 */ 25809function getBoundingClientRect(element) { 25810 var rect = {}; 25811 25812 // IE10 10 FIX: Please, don't ask, the element isn't 25813 // considered in DOM in some circumstances... 25814 // This isn't reproducible in IE10 compatibility mode of IE11 25815 try { 25816 if (isIE(10)) { 25817 rect = element.getBoundingClientRect(); 25818 var scrollTop = getScroll(element, 'top'); 25819 var scrollLeft = getScroll(element, 'left'); 25820 rect.top += scrollTop; 25821 rect.left += scrollLeft; 25822 rect.bottom += scrollTop; 25823 rect.right += scrollLeft; 25824 } else { 25825 rect = element.getBoundingClientRect(); 25826 } 25827 } catch (e) {} 25828 25829 var result = { 25830 left: rect.left, 25831 top: rect.top, 25832 width: rect.right - rect.left, 25833 height: rect.bottom - rect.top 25834 }; 25835 25836 // subtract scrollbar size from sizes 25837 var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {}; 25838 var width = sizes.width || element.clientWidth || result.width; 25839 var height = sizes.height || element.clientHeight || result.height; 25840 25841 var horizScrollbar = element.offsetWidth - width; 25842 var vertScrollbar = element.offsetHeight - height; 25843 25844 // if an hypothetical scrollbar is detected, we must be sure it's not a `border` 25845 // we make this check conditional for performance reasons 25846 if (horizScrollbar || vertScrollbar) { 25847 var styles = getStyleComputedProperty(element); 25848 horizScrollbar -= getBordersSize(styles, 'x'); 25849 vertScrollbar -= getBordersSize(styles, 'y'); 25850 25851 result.width -= horizScrollbar; 25852 result.height -= vertScrollbar; 25853 } 25854 25855 return getClientRect(result); 25856} 25857 25858function getOffsetRectRelativeToArbitraryNode(children, parent) { 25859 var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; 25860 25861 var isIE10 = isIE(10); 25862 var isHTML = parent.nodeName === 'HTML'; 25863 var childrenRect = getBoundingClientRect(children); 25864 var parentRect = getBoundingClientRect(parent); 25865 var scrollParent = getScrollParent(children); 25866 25867 var styles = getStyleComputedProperty(parent); 25868 var borderTopWidth = parseFloat(styles.borderTopWidth); 25869 var borderLeftWidth = parseFloat(styles.borderLeftWidth); 25870 25871 // In cases where the parent is fixed, we must ignore negative scroll in offset calc 25872 if (fixedPosition && isHTML) { 25873 parentRect.top = Math.max(parentRect.top, 0); 25874 parentRect.left = Math.max(parentRect.left, 0); 25875 } 25876 var offsets = getClientRect({ 25877 top: childrenRect.top - parentRect.top - borderTopWidth, 25878 left: childrenRect.left - parentRect.left - borderLeftWidth, 25879 width: childrenRect.width, 25880 height: childrenRect.height 25881 }); 25882 offsets.marginTop = 0; 25883 offsets.marginLeft = 0; 25884 25885 // Subtract margins of documentElement in case it's being used as parent 25886 // we do this only on HTML because it's the only element that behaves 25887 // differently when margins are applied to it. The margins are included in 25888 // the box of the documentElement, in the other cases not. 25889 if (!isIE10 && isHTML) { 25890 var marginTop = parseFloat(styles.marginTop); 25891 var marginLeft = parseFloat(styles.marginLeft); 25892 25893 offsets.top -= borderTopWidth - marginTop; 25894 offsets.bottom -= borderTopWidth - marginTop; 25895 offsets.left -= borderLeftWidth - marginLeft; 25896 offsets.right -= borderLeftWidth - marginLeft; 25897 25898 // Attach marginTop and marginLeft because in some circumstances we may need them 25899 offsets.marginTop = marginTop; 25900 offsets.marginLeft = marginLeft; 25901 } 25902 25903 if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') { 25904 offsets = includeScroll(offsets, parent); 25905 } 25906 25907 return offsets; 25908} 25909 25910function getViewportOffsetRectRelativeToArtbitraryNode(element) { 25911 var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 25912 25913 var html = element.ownerDocument.documentElement; 25914 var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html); 25915 var width = Math.max(html.clientWidth, window.innerWidth || 0); 25916 var height = Math.max(html.clientHeight, window.innerHeight || 0); 25917 25918 var scrollTop = !excludeScroll ? getScroll(html) : 0; 25919 var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0; 25920 25921 var offset = { 25922 top: scrollTop - relativeOffset.top + relativeOffset.marginTop, 25923 left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft, 25924 width: width, 25925 height: height 25926 }; 25927 25928 return getClientRect(offset); 25929} 25930 25931/** 25932 * Check if the given element is fixed or is inside a fixed parent 25933 * @method 25934 * @memberof Popper.Utils 25935 * @argument {Element} element 25936 * @argument {Element} customContainer 25937 * @returns {Boolean} answer to "isFixed?" 25938 */ 25939function isFixed(element) { 25940 var nodeName = element.nodeName; 25941 if (nodeName === 'BODY' || nodeName === 'HTML') { 25942 return false; 25943 } 25944 if (getStyleComputedProperty(element, 'position') === 'fixed') { 25945 return true; 25946 } 25947 var parentNode = getParentNode(element); 25948 if (!parentNode) { 25949 return false; 25950 } 25951 return isFixed(parentNode); 25952} 25953 25954/** 25955 * Finds the first parent of an element that has a transformed property defined 25956 * @method 25957 * @memberof Popper.Utils 25958 * @argument {Element} element 25959 * @returns {Element} first transformed parent or documentElement 25960 */ 25961 25962function getFixedPositionOffsetParent(element) { 25963 // This check is needed to avoid errors in case one of the elements isn't defined for any reason 25964 if (!element || !element.parentElement || isIE()) { 25965 return document.documentElement; 25966 } 25967 var el = element.parentElement; 25968 while (el && getStyleComputedProperty(el, 'transform') === 'none') { 25969 el = el.parentElement; 25970 } 25971 return el || document.documentElement; 25972} 25973 25974/** 25975 * Computed the boundaries limits and return them 25976 * @method 25977 * @memberof Popper.Utils 25978 * @param {HTMLElement} popper 25979 * @param {HTMLElement} reference 25980 * @param {number} padding 25981 * @param {HTMLElement} boundariesElement - Element used to define the boundaries 25982 * @param {Boolean} fixedPosition - Is in fixed position mode 25983 * @returns {Object} Coordinates of the boundaries 25984 */ 25985function getBoundaries(popper, reference, padding, boundariesElement) { 25986 var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; 25987 25988 // NOTE: 1 DOM access here 25989 25990 var boundaries = { top: 0, left: 0 }; 25991 var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference)); 25992 25993 // Handle viewport case 25994 if (boundariesElement === 'viewport') { 25995 boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition); 25996 } else { 25997 // Handle other cases based on DOM element used as boundaries 25998 var boundariesNode = void 0; 25999 if (boundariesElement === 'scrollParent') { 26000 boundariesNode = getScrollParent(getParentNode(reference)); 26001 if (boundariesNode.nodeName === 'BODY') { 26002 boundariesNode = popper.ownerDocument.documentElement; 26003 } 26004 } else if (boundariesElement === 'window') { 26005 boundariesNode = popper.ownerDocument.documentElement; 26006 } else { 26007 boundariesNode = boundariesElement; 26008 } 26009 26010 var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition); 26011 26012 // In case of HTML, we need a different computation 26013 if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) { 26014 var _getWindowSizes = getWindowSizes(popper.ownerDocument), 26015 height = _getWindowSizes.height, 26016 width = _getWindowSizes.width; 26017 26018 boundaries.top += offsets.top - offsets.marginTop; 26019 boundaries.bottom = height + offsets.top; 26020 boundaries.left += offsets.left - offsets.marginLeft; 26021 boundaries.right = width + offsets.left; 26022 } else { 26023 // for all the other DOM elements, this one is good 26024 boundaries = offsets; 26025 } 26026 } 26027 26028 // Add paddings 26029 padding = padding || 0; 26030 var isPaddingNumber = typeof padding === 'number'; 26031 boundaries.left += isPaddingNumber ? padding : padding.left || 0; 26032 boundaries.top += isPaddingNumber ? padding : padding.top || 0; 26033 boundaries.right -= isPaddingNumber ? padding : padding.right || 0; 26034 boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0; 26035 26036 return boundaries; 26037} 26038 26039function getArea(_ref) { 26040 var width = _ref.width, 26041 height = _ref.height; 26042 26043 return width * height; 26044} 26045 26046/** 26047 * Utility used to transform the `auto` placement to the placement with more 26048 * available space. 26049 * @method 26050 * @memberof Popper.Utils 26051 * @argument {Object} data - The data object generated by update method 26052 * @argument {Object} options - Modifiers configuration and options 26053 * @returns {Object} The data object, properly modified 26054 */ 26055function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) { 26056 var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0; 26057 26058 if (placement.indexOf('auto') === -1) { 26059 return placement; 26060 } 26061 26062 var boundaries = getBoundaries(popper, reference, padding, boundariesElement); 26063 26064 var rects = { 26065 top: { 26066 width: boundaries.width, 26067 height: refRect.top - boundaries.top 26068 }, 26069 right: { 26070 width: boundaries.right - refRect.right, 26071 height: boundaries.height 26072 }, 26073 bottom: { 26074 width: boundaries.width, 26075 height: boundaries.bottom - refRect.bottom 26076 }, 26077 left: { 26078 width: refRect.left - boundaries.left, 26079 height: boundaries.height 26080 } 26081 }; 26082 26083 var sortedAreas = Object.keys(rects).map(function (key) { 26084 return _extends({ 26085 key: key 26086 }, rects[key], { 26087 area: getArea(rects[key]) 26088 }); 26089 }).sort(function (a, b) { 26090 return b.area - a.area; 26091 }); 26092 26093 var filteredAreas = sortedAreas.filter(function (_ref2) { 26094 var width = _ref2.width, 26095 height = _ref2.height; 26096 return width >= popper.clientWidth && height >= popper.clientHeight; 26097 }); 26098 26099 var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key; 26100 26101 var variation = placement.split('-')[1]; 26102 26103 return computedPlacement + (variation ? '-' + variation : ''); 26104} 26105 26106/** 26107 * Get offsets to the reference element 26108 * @method 26109 * @memberof Popper.Utils 26110 * @param {Object} state 26111 * @param {Element} popper - the popper element 26112 * @param {Element} reference - the reference element (the popper will be relative to this) 26113 * @param {Element} fixedPosition - is in fixed position mode 26114 * @returns {Object} An object containing the offsets which will be applied to the popper 26115 */ 26116function getReferenceOffsets(state, popper, reference) { 26117 var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; 26118 26119 var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference)); 26120 return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition); 26121} 26122 26123/** 26124 * Get the outer sizes of the given element (offset size + margins) 26125 * @method 26126 * @memberof Popper.Utils 26127 * @argument {Element} element 26128 * @returns {Object} object containing width and height properties 26129 */ 26130function getOuterSizes(element) { 26131 var window = element.ownerDocument.defaultView; 26132 var styles = window.getComputedStyle(element); 26133 var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0); 26134 var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0); 26135 var result = { 26136 width: element.offsetWidth + y, 26137 height: element.offsetHeight + x 26138 }; 26139 return result; 26140} 26141 26142/** 26143 * Get the opposite placement of the given one 26144 * @method 26145 * @memberof Popper.Utils 26146 * @argument {String} placement 26147 * @returns {String} flipped placement 26148 */ 26149function getOppositePlacement(placement) { 26150 var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' }; 26151 return placement.replace(/left|right|bottom|top/g, function (matched) { 26152 return hash[matched]; 26153 }); 26154} 26155 26156/** 26157 * Get offsets to the popper 26158 * @method 26159 * @memberof Popper.Utils 26160 * @param {Object} position - CSS position the Popper will get applied 26161 * @param {HTMLElement} popper - the popper element 26162 * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this) 26163 * @param {String} placement - one of the valid placement options 26164 * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper 26165 */ 26166function getPopperOffsets(popper, referenceOffsets, placement) { 26167 placement = placement.split('-')[0]; 26168 26169 // Get popper node sizes 26170 var popperRect = getOuterSizes(popper); 26171 26172 // Add position, width and height to our offsets object 26173 var popperOffsets = { 26174 width: popperRect.width, 26175 height: popperRect.height 26176 }; 26177 26178 // depending by the popper placement we have to compute its offsets slightly differently 26179 var isHoriz = ['right', 'left'].indexOf(placement) !== -1; 26180 var mainSide = isHoriz ? 'top' : 'left'; 26181 var secondarySide = isHoriz ? 'left' : 'top'; 26182 var measurement = isHoriz ? 'height' : 'width'; 26183 var secondaryMeasurement = !isHoriz ? 'height' : 'width'; 26184 26185 popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2; 26186 if (placement === secondarySide) { 26187 popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement]; 26188 } else { 26189 popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)]; 26190 } 26191 26192 return popperOffsets; 26193} 26194 26195/** 26196 * Mimics the `find` method of Array 26197 * @method 26198 * @memberof Popper.Utils 26199 * @argument {Array} arr 26200 * @argument prop 26201 * @argument value 26202 * @returns index or -1 26203 */ 26204function find(arr, check) { 26205 // use native find if supported 26206 if (Array.prototype.find) { 26207 return arr.find(check); 26208 } 26209 26210 // use `filter` to obtain the same behavior of `find` 26211 return arr.filter(check)[0]; 26212} 26213 26214/** 26215 * Return the index of the matching object 26216 * @method 26217 * @memberof Popper.Utils 26218 * @argument {Array} arr 26219 * @argument prop 26220 * @argument value 26221 * @returns index or -1 26222 */ 26223function findIndex(arr, prop, value) { 26224 // use native findIndex if supported 26225 if (Array.prototype.findIndex) { 26226 return arr.findIndex(function (cur) { 26227 return cur[prop] === value; 26228 }); 26229 } 26230 26231 // use `find` + `indexOf` if `findIndex` isn't supported 26232 var match = find(arr, function (obj) { 26233 return obj[prop] === value; 26234 }); 26235 return arr.indexOf(match); 26236} 26237 26238/** 26239 * Loop trough the list of modifiers and run them in order, 26240 * each of them will then edit the data object. 26241 * @method 26242 * @memberof Popper.Utils 26243 * @param {dataObject} data 26244 * @param {Array} modifiers 26245 * @param {String} ends - Optional modifier name used as stopper 26246 * @returns {dataObject} 26247 */ 26248function runModifiers(modifiers, data, ends) { 26249 var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends)); 26250 26251 modifiersToRun.forEach(function (modifier) { 26252 if (modifier['function']) { 26253 // eslint-disable-line dot-notation 26254 console.warn('`modifier.function` is deprecated, use `modifier.fn`!'); 26255 } 26256 var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation 26257 if (modifier.enabled && isFunction(fn)) { 26258 // Add properties to offsets to make them a complete clientRect object 26259 // we do this before each modifier to make sure the previous one doesn't 26260 // mess with these values 26261 data.offsets.popper = getClientRect(data.offsets.popper); 26262 data.offsets.reference = getClientRect(data.offsets.reference); 26263 26264 data = fn(data, modifier); 26265 } 26266 }); 26267 26268 return data; 26269} 26270 26271/** 26272 * Updates the position of the popper, computing the new offsets and applying 26273 * the new style.<br /> 26274 * Prefer `scheduleUpdate` over `update` because of performance reasons. 26275 * @method 26276 * @memberof Popper 26277 */ 26278function update() { 26279 // if popper is destroyed, don't perform any further update 26280 if (this.state.isDestroyed) { 26281 return; 26282 } 26283 26284 var data = { 26285 instance: this, 26286 styles: {}, 26287 arrowStyles: {}, 26288 attributes: {}, 26289 flipped: false, 26290 offsets: {} 26291 }; 26292 26293 // compute reference element offsets 26294 data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed); 26295 26296 // compute auto placement, store placement inside the data object, 26297 // modifiers will be able to edit `placement` if needed 26298 // and refer to originalPlacement to know the original value 26299 data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding); 26300 26301 // store the computed placement inside `originalPlacement` 26302 data.originalPlacement = data.placement; 26303 26304 data.positionFixed = this.options.positionFixed; 26305 26306 // compute the popper offsets 26307 data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement); 26308 26309 data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute'; 26310 26311 // run the modifiers 26312 data = runModifiers(this.modifiers, data); 26313 26314 // the first `update` will call `onCreate` callback 26315 // the other ones will call `onUpdate` callback 26316 if (!this.state.isCreated) { 26317 this.state.isCreated = true; 26318 this.options.onCreate(data); 26319 } else { 26320 this.options.onUpdate(data); 26321 } 26322} 26323 26324/** 26325 * Helper used to know if the given modifier is enabled. 26326 * @method 26327 * @memberof Popper.Utils 26328 * @returns {Boolean} 26329 */ 26330function isModifierEnabled(modifiers, modifierName) { 26331 return modifiers.some(function (_ref) { 26332 var name = _ref.name, 26333 enabled = _ref.enabled; 26334 return enabled && name === modifierName; 26335 }); 26336} 26337 26338/** 26339 * Get the prefixed supported property name 26340 * @method 26341 * @memberof Popper.Utils 26342 * @argument {String} property (camelCase) 26343 * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix) 26344 */ 26345function getSupportedPropertyName(property) { 26346 var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O']; 26347 var upperProp = property.charAt(0).toUpperCase() + property.slice(1); 26348 26349 for (var i = 0; i < prefixes.length; i++) { 26350 var prefix = prefixes[i]; 26351 var toCheck = prefix ? '' + prefix + upperProp : property; 26352 if (typeof document.body.style[toCheck] !== 'undefined') { 26353 return toCheck; 26354 } 26355 } 26356 return null; 26357} 26358 26359/** 26360 * Destroys the popper. 26361 * @method 26362 * @memberof Popper 26363 */ 26364function destroy() { 26365 this.state.isDestroyed = true; 26366 26367 // touch DOM only if `applyStyle` modifier is enabled 26368 if (isModifierEnabled(this.modifiers, 'applyStyle')) { 26369 this.popper.removeAttribute('x-placement'); 26370 this.popper.style.position = ''; 26371 this.popper.style.top = ''; 26372 this.popper.style.left = ''; 26373 this.popper.style.right = ''; 26374 this.popper.style.bottom = ''; 26375 this.popper.style.willChange = ''; 26376 this.popper.style[getSupportedPropertyName('transform')] = ''; 26377 } 26378 26379 this.disableEventListeners(); 26380 26381 // remove the popper if user explicitly asked for the deletion on destroy 26382 // do not use `remove` because IE11 doesn't support it 26383 if (this.options.removeOnDestroy) { 26384 this.popper.parentNode.removeChild(this.popper); 26385 } 26386 return this; 26387} 26388 26389/** 26390 * Get the window associated with the element 26391 * @argument {Element} element 26392 * @returns {Window} 26393 */ 26394function getWindow(element) { 26395 var ownerDocument = element.ownerDocument; 26396 return ownerDocument ? ownerDocument.defaultView : window; 26397} 26398 26399function attachToScrollParents(scrollParent, event, callback, scrollParents) { 26400 var isBody = scrollParent.nodeName === 'BODY'; 26401 var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent; 26402 target.addEventListener(event, callback, { passive: true }); 26403 26404 if (!isBody) { 26405 attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents); 26406 } 26407 scrollParents.push(target); 26408} 26409 26410/** 26411 * Setup needed event listeners used to update the popper position 26412 * @method 26413 * @memberof Popper.Utils 26414 * @private 26415 */ 26416function setupEventListeners(reference, options, state, updateBound) { 26417 // Resize event listener on window 26418 state.updateBound = updateBound; 26419 getWindow(reference).addEventListener('resize', state.updateBound, { passive: true }); 26420 26421 // Scroll event listener on scroll parents 26422 var scrollElement = getScrollParent(reference); 26423 attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents); 26424 state.scrollElement = scrollElement; 26425 state.eventsEnabled = true; 26426 26427 return state; 26428} 26429 26430/** 26431 * It will add resize/scroll events and start recalculating 26432 * position of the popper element when they are triggered. 26433 * @method 26434 * @memberof Popper 26435 */ 26436function enableEventListeners() { 26437 if (!this.state.eventsEnabled) { 26438 this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate); 26439 } 26440} 26441 26442/** 26443 * Remove event listeners used to update the popper position 26444 * @method 26445 * @memberof Popper.Utils 26446 * @private 26447 */ 26448function removeEventListeners(reference, state) { 26449 // Remove resize event listener on window 26450 getWindow(reference).removeEventListener('resize', state.updateBound); 26451 26452 // Remove scroll event listener on scroll parents 26453 state.scrollParents.forEach(function (target) { 26454 target.removeEventListener('scroll', state.updateBound); 26455 }); 26456 26457 // Reset state 26458 state.updateBound = null; 26459 state.scrollParents = []; 26460 state.scrollElement = null; 26461 state.eventsEnabled = false; 26462 return state; 26463} 26464 26465/** 26466 * It will remove resize/scroll events and won't recalculate popper position 26467 * when they are triggered. It also won't trigger `onUpdate` callback anymore, 26468 * unless you call `update` method manually. 26469 * @method 26470 * @memberof Popper 26471 */ 26472function disableEventListeners() { 26473 if (this.state.eventsEnabled) { 26474 cancelAnimationFrame(this.scheduleUpdate); 26475 this.state = removeEventListeners(this.reference, this.state); 26476 } 26477} 26478 26479/** 26480 * Tells if a given input is a number 26481 * @method 26482 * @memberof Popper.Utils 26483 * @param {*} input to check 26484 * @return {Boolean} 26485 */ 26486function isNumeric(n) { 26487 return n !== '' && !isNaN(parseFloat(n)) && isFinite(n); 26488} 26489 26490/** 26491 * Set the style to the given popper 26492 * @method 26493 * @memberof Popper.Utils 26494 * @argument {Element} element - Element to apply the style to 26495 * @argument {Object} styles 26496 * Object with a list of properties and values which will be applied to the element 26497 */ 26498function setStyles(element, styles) { 26499 Object.keys(styles).forEach(function (prop) { 26500 var unit = ''; 26501 // add unit if the value is numeric and is one of the following 26502 if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) { 26503 unit = 'px'; 26504 } 26505 element.style[prop] = styles[prop] + unit; 26506 }); 26507} 26508 26509/** 26510 * Set the attributes to the given popper 26511 * @method 26512 * @memberof Popper.Utils 26513 * @argument {Element} element - Element to apply the attributes to 26514 * @argument {Object} styles 26515 * Object with a list of properties and values which will be applied to the element 26516 */ 26517function setAttributes(element, attributes) { 26518 Object.keys(attributes).forEach(function (prop) { 26519 var value = attributes[prop]; 26520 if (value !== false) { 26521 element.setAttribute(prop, attributes[prop]); 26522 } else { 26523 element.removeAttribute(prop); 26524 } 26525 }); 26526} 26527 26528/** 26529 * @function 26530 * @memberof Modifiers 26531 * @argument {Object} data - The data object generated by `update` method 26532 * @argument {Object} data.styles - List of style properties - values to apply to popper element 26533 * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element 26534 * @argument {Object} options - Modifiers configuration and options 26535 * @returns {Object} The same data object 26536 */ 26537function applyStyle(data) { 26538 // any property present in `data.styles` will be applied to the popper, 26539 // in this way we can make the 3rd party modifiers add custom styles to it 26540 // Be aware, modifiers could override the properties defined in the previous 26541 // lines of this modifier! 26542 setStyles(data.instance.popper, data.styles); 26543 26544 // any property present in `data.attributes` will be applied to the popper, 26545 // they will be set as HTML attributes of the element 26546 setAttributes(data.instance.popper, data.attributes); 26547 26548 // if arrowElement is defined and arrowStyles has some properties 26549 if (data.arrowElement && Object.keys(data.arrowStyles).length) { 26550 setStyles(data.arrowElement, data.arrowStyles); 26551 } 26552 26553 return data; 26554} 26555 26556/** 26557 * Set the x-placement attribute before everything else because it could be used 26558 * to add margins to the popper margins needs to be calculated to get the 26559 * correct popper offsets. 26560 * @method 26561 * @memberof Popper.modifiers 26562 * @param {HTMLElement} reference - The reference element used to position the popper 26563 * @param {HTMLElement} popper - The HTML element used as popper 26564 * @param {Object} options - Popper.js options 26565 */ 26566function applyStyleOnLoad(reference, popper, options, modifierOptions, state) { 26567 // compute reference element offsets 26568 var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed); 26569 26570 // compute auto placement, store placement inside the data object, 26571 // modifiers will be able to edit `placement` if needed 26572 // and refer to originalPlacement to know the original value 26573 var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding); 26574 26575 popper.setAttribute('x-placement', placement); 26576 26577 // Apply `position` to popper before anything else because 26578 // without the position applied we can't guarantee correct computations 26579 setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' }); 26580 26581 return options; 26582} 26583 26584/** 26585 * @function 26586 * @memberof Popper.Utils 26587 * @argument {Object} data - The data object generated by `update` method 26588 * @argument {Boolean} shouldRound - If the offsets should be rounded at all 26589 * @returns {Object} The popper's position offsets rounded 26590 * 26591 * The tale of pixel-perfect positioning. It's still not 100% perfect, but as 26592 * good as it can be within reason. 26593 * Discussion here: https://github.com/FezVrasta/popper.js/pull/715 26594 * 26595 * Low DPI screens cause a popper to be blurry if not using full pixels (Safari 26596 * as well on High DPI screens). 26597 * 26598 * Firefox prefers no rounding for positioning and does not have blurriness on 26599 * high DPI screens. 26600 * 26601 * Only horizontal placement and left/right values need to be considered. 26602 */ 26603function getRoundedOffsets(data, shouldRound) { 26604 var _data$offsets = data.offsets, 26605 popper = _data$offsets.popper, 26606 reference = _data$offsets.reference; 26607 var round = Math.round, 26608 floor = Math.floor; 26609 26610 var noRound = function noRound(v) { 26611 return v; 26612 }; 26613 26614 var referenceWidth = round(reference.width); 26615 var popperWidth = round(popper.width); 26616 26617 var isVertical = ['left', 'right'].indexOf(data.placement) !== -1; 26618 var isVariation = data.placement.indexOf('-') !== -1; 26619 var sameWidthParity = referenceWidth % 2 === popperWidth % 2; 26620 var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1; 26621 26622 var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor; 26623 var verticalToInteger = !shouldRound ? noRound : round; 26624 26625 return { 26626 left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left), 26627 top: verticalToInteger(popper.top), 26628 bottom: verticalToInteger(popper.bottom), 26629 right: horizontalToInteger(popper.right) 26630 }; 26631} 26632 26633var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent); 26634 26635/** 26636 * @function 26637 * @memberof Modifiers 26638 * @argument {Object} data - The data object generated by `update` method 26639 * @argument {Object} options - Modifiers configuration and options 26640 * @returns {Object} The data object, properly modified 26641 */ 26642function computeStyle(data, options) { 26643 var x = options.x, 26644 y = options.y; 26645 var popper = data.offsets.popper; 26646 26647 // Remove this legacy support in Popper.js v2 26648 26649 var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) { 26650 return modifier.name === 'applyStyle'; 26651 }).gpuAcceleration; 26652 if (legacyGpuAccelerationOption !== undefined) { 26653 console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!'); 26654 } 26655 var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration; 26656 26657 var offsetParent = getOffsetParent(data.instance.popper); 26658 var offsetParentRect = getBoundingClientRect(offsetParent); 26659 26660 // Styles 26661 var styles = { 26662 position: popper.position 26663 }; 26664 26665 var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox); 26666 26667 var sideA = x === 'bottom' ? 'top' : 'bottom'; 26668 var sideB = y === 'right' ? 'left' : 'right'; 26669 26670 // if gpuAcceleration is set to `true` and transform is supported, 26671 // we use `translate3d` to apply the position to the popper we 26672 // automatically use the supported prefixed version if needed 26673 var prefixedProperty = getSupportedPropertyName('transform'); 26674 26675 // now, let's make a step back and look at this code closely (wtf?) 26676 // If the content of the popper grows once it's been positioned, it 26677 // may happen that the popper gets misplaced because of the new content 26678 // overflowing its reference element 26679 // To avoid this problem, we provide two options (x and y), which allow 26680 // the consumer to define the offset origin. 26681 // If we position a popper on top of a reference element, we can set 26682 // `x` to `top` to make the popper grow towards its top instead of 26683 // its bottom. 26684 var left = void 0, 26685 top = void 0; 26686 if (sideA === 'bottom') { 26687 // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar) 26688 // and not the bottom of the html element 26689 if (offsetParent.nodeName === 'HTML') { 26690 top = -offsetParent.clientHeight + offsets.bottom; 26691 } else { 26692 top = -offsetParentRect.height + offsets.bottom; 26693 } 26694 } else { 26695 top = offsets.top; 26696 } 26697 if (sideB === 'right') { 26698 if (offsetParent.nodeName === 'HTML') { 26699 left = -offsetParent.clientWidth + offsets.right; 26700 } else { 26701 left = -offsetParentRect.width + offsets.right; 26702 } 26703 } else { 26704 left = offsets.left; 26705 } 26706 if (gpuAcceleration && prefixedProperty) { 26707 styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)'; 26708 styles[sideA] = 0; 26709 styles[sideB] = 0; 26710 styles.willChange = 'transform'; 26711 } else { 26712 // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties 26713 var invertTop = sideA === 'bottom' ? -1 : 1; 26714 var invertLeft = sideB === 'right' ? -1 : 1; 26715 styles[sideA] = top * invertTop; 26716 styles[sideB] = left * invertLeft; 26717 styles.willChange = sideA + ', ' + sideB; 26718 } 26719 26720 // Attributes 26721 var attributes = { 26722 'x-placement': data.placement 26723 }; 26724 26725 // Update `data` attributes, styles and arrowStyles 26726 data.attributes = _extends({}, attributes, data.attributes); 26727 data.styles = _extends({}, styles, data.styles); 26728 data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles); 26729 26730 return data; 26731} 26732 26733/** 26734 * Helper used to know if the given modifier depends from another one.<br /> 26735 * It checks if the needed modifier is listed and enabled. 26736 * @method 26737 * @memberof Popper.Utils 26738 * @param {Array} modifiers - list of modifiers 26739 * @param {String} requestingName - name of requesting modifier 26740 * @param {String} requestedName - name of requested modifier 26741 * @returns {Boolean} 26742 */ 26743function isModifierRequired(modifiers, requestingName, requestedName) { 26744 var requesting = find(modifiers, function (_ref) { 26745 var name = _ref.name; 26746 return name === requestingName; 26747 }); 26748 26749 var isRequired = !!requesting && modifiers.some(function (modifier) { 26750 return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order; 26751 }); 26752 26753 if (!isRequired) { 26754 var _requesting = '`' + requestingName + '`'; 26755 var requested = '`' + requestedName + '`'; 26756 console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!'); 26757 } 26758 return isRequired; 26759} 26760 26761/** 26762 * @function 26763 * @memberof Modifiers 26764 * @argument {Object} data - The data object generated by update method 26765 * @argument {Object} options - Modifiers configuration and options 26766 * @returns {Object} The data object, properly modified 26767 */ 26768function arrow(data, options) { 26769 var _data$offsets$arrow; 26770 26771 // arrow depends on keepTogether in order to work 26772 if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) { 26773 return data; 26774 } 26775 26776 var arrowElement = options.element; 26777 26778 // if arrowElement is a string, suppose it's a CSS selector 26779 if (typeof arrowElement === 'string') { 26780 arrowElement = data.instance.popper.querySelector(arrowElement); 26781 26782 // if arrowElement is not found, don't run the modifier 26783 if (!arrowElement) { 26784 return data; 26785 } 26786 } else { 26787 // if the arrowElement isn't a query selector we must check that the 26788 // provided DOM node is child of its popper node 26789 if (!data.instance.popper.contains(arrowElement)) { 26790 console.warn('WARNING: `arrow.element` must be child of its popper element!'); 26791 return data; 26792 } 26793 } 26794 26795 var placement = data.placement.split('-')[0]; 26796 var _data$offsets = data.offsets, 26797 popper = _data$offsets.popper, 26798 reference = _data$offsets.reference; 26799 26800 var isVertical = ['left', 'right'].indexOf(placement) !== -1; 26801 26802 var len = isVertical ? 'height' : 'width'; 26803 var sideCapitalized = isVertical ? 'Top' : 'Left'; 26804 var side = sideCapitalized.toLowerCase(); 26805 var altSide = isVertical ? 'left' : 'top'; 26806 var opSide = isVertical ? 'bottom' : 'right'; 26807 var arrowElementSize = getOuterSizes(arrowElement)[len]; 26808 26809 // 26810 // extends keepTogether behavior making sure the popper and its 26811 // reference have enough pixels in conjunction 26812 // 26813 26814 // top/left side 26815 if (reference[opSide] - arrowElementSize < popper[side]) { 26816 data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize); 26817 } 26818 // bottom/right side 26819 if (reference[side] + arrowElementSize > popper[opSide]) { 26820 data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide]; 26821 } 26822 data.offsets.popper = getClientRect(data.offsets.popper); 26823 26824 // compute center of the popper 26825 var center = reference[side] + reference[len] / 2 - arrowElementSize / 2; 26826 26827 // Compute the sideValue using the updated popper offsets 26828 // take popper margin in account because we don't have this info available 26829 var css = getStyleComputedProperty(data.instance.popper); 26830 var popperMarginSide = parseFloat(css['margin' + sideCapitalized]); 26831 var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']); 26832 var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide; 26833 26834 // prevent arrowElement from being placed not contiguously to its popper 26835 sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0); 26836 26837 data.arrowElement = arrowElement; 26838 data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow); 26839 26840 return data; 26841} 26842 26843/** 26844 * Get the opposite placement variation of the given one 26845 * @method 26846 * @memberof Popper.Utils 26847 * @argument {String} placement variation 26848 * @returns {String} flipped placement variation 26849 */ 26850function getOppositeVariation(variation) { 26851 if (variation === 'end') { 26852 return 'start'; 26853 } else if (variation === 'start') { 26854 return 'end'; 26855 } 26856 return variation; 26857} 26858 26859/** 26860 * List of accepted placements to use as values of the `placement` option.<br /> 26861 * Valid placements are: 26862 * - `auto` 26863 * - `top` 26864 * - `right` 26865 * - `bottom` 26866 * - `left` 26867 * 26868 * Each placement can have a variation from this list: 26869 * - `-start` 26870 * - `-end` 26871 * 26872 * Variations are interpreted easily if you think of them as the left to right 26873 * written languages. Horizontally (`top` and `bottom`), `start` is left and `end` 26874 * is right.<br /> 26875 * Vertically (`left` and `right`), `start` is top and `end` is bottom. 26876 * 26877 * Some valid examples are: 26878 * - `top-end` (on top of reference, right aligned) 26879 * - `right-start` (on right of reference, top aligned) 26880 * - `bottom` (on bottom, centered) 26881 * - `auto-end` (on the side with more space available, alignment depends by placement) 26882 * 26883 * @static 26884 * @type {Array} 26885 * @enum {String} 26886 * @readonly 26887 * @method placements 26888 * @memberof Popper 26889 */ 26890var placements = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start']; 26891 26892// Get rid of `auto` `auto-start` and `auto-end` 26893var validPlacements = placements.slice(3); 26894 26895/** 26896 * Given an initial placement, returns all the subsequent placements 26897 * clockwise (or counter-clockwise). 26898 * 26899 * @method 26900 * @memberof Popper.Utils 26901 * @argument {String} placement - A valid placement (it accepts variations) 26902 * @argument {Boolean} counter - Set to true to walk the placements counterclockwise 26903 * @returns {Array} placements including their variations 26904 */ 26905function clockwise(placement) { 26906 var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 26907 26908 var index = validPlacements.indexOf(placement); 26909 var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index)); 26910 return counter ? arr.reverse() : arr; 26911} 26912 26913var BEHAVIORS = { 26914 FLIP: 'flip', 26915 CLOCKWISE: 'clockwise', 26916 COUNTERCLOCKWISE: 'counterclockwise' 26917}; 26918 26919/** 26920 * @function 26921 * @memberof Modifiers 26922 * @argument {Object} data - The data object generated by update method 26923 * @argument {Object} options - Modifiers configuration and options 26924 * @returns {Object} The data object, properly modified 26925 */ 26926function flip(data, options) { 26927 // if `inner` modifier is enabled, we can't use the `flip` modifier 26928 if (isModifierEnabled(data.instance.modifiers, 'inner')) { 26929 return data; 26930 } 26931 26932 if (data.flipped && data.placement === data.originalPlacement) { 26933 // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides 26934 return data; 26935 } 26936 26937 var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed); 26938 26939 var placement = data.placement.split('-')[0]; 26940 var placementOpposite = getOppositePlacement(placement); 26941 var variation = data.placement.split('-')[1] || ''; 26942 26943 var flipOrder = []; 26944 26945 switch (options.behavior) { 26946 case BEHAVIORS.FLIP: 26947 flipOrder = [placement, placementOpposite]; 26948 break; 26949 case BEHAVIORS.CLOCKWISE: 26950 flipOrder = clockwise(placement); 26951 break; 26952 case BEHAVIORS.COUNTERCLOCKWISE: 26953 flipOrder = clockwise(placement, true); 26954 break; 26955 default: 26956 flipOrder = options.behavior; 26957 } 26958 26959 flipOrder.forEach(function (step, index) { 26960 if (placement !== step || flipOrder.length === index + 1) { 26961 return data; 26962 } 26963 26964 placement = data.placement.split('-')[0]; 26965 placementOpposite = getOppositePlacement(placement); 26966 26967 var popperOffsets = data.offsets.popper; 26968 var refOffsets = data.offsets.reference; 26969 26970 // using floor because the reference offsets may contain decimals we are not going to consider here 26971 var floor = Math.floor; 26972 var overlapsRef = placement === 'left' && floor(popperOffsets.right) > floor(refOffsets.left) || placement === 'right' && floor(popperOffsets.left) < floor(refOffsets.right) || placement === 'top' && floor(popperOffsets.bottom) > floor(refOffsets.top) || placement === 'bottom' && floor(popperOffsets.top) < floor(refOffsets.bottom); 26973 26974 var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left); 26975 var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right); 26976 var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top); 26977 var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom); 26978 26979 var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom; 26980 26981 // flip the variation if required 26982 var isVertical = ['top', 'bottom'].indexOf(placement) !== -1; 26983 26984 // flips variation if reference element overflows boundaries 26985 var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom); 26986 26987 // flips variation if popper content overflows boundaries 26988 var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop); 26989 26990 var flippedVariation = flippedVariationByRef || flippedVariationByContent; 26991 26992 if (overlapsRef || overflowsBoundaries || flippedVariation) { 26993 // this boolean to detect any flip loop 26994 data.flipped = true; 26995 26996 if (overlapsRef || overflowsBoundaries) { 26997 placement = flipOrder[index + 1]; 26998 } 26999 27000 if (flippedVariation) { 27001 variation = getOppositeVariation(variation); 27002 } 27003 27004 data.placement = placement + (variation ? '-' + variation : ''); 27005 27006 // this object contains `position`, we want to preserve it along with 27007 // any additional property we may add in the future 27008 data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement)); 27009 27010 data = runModifiers(data.instance.modifiers, data, 'flip'); 27011 } 27012 }); 27013 return data; 27014} 27015 27016/** 27017 * @function 27018 * @memberof Modifiers 27019 * @argument {Object} data - The data object generated by update method 27020 * @argument {Object} options - Modifiers configuration and options 27021 * @returns {Object} The data object, properly modified 27022 */ 27023function keepTogether(data) { 27024 var _data$offsets = data.offsets, 27025 popper = _data$offsets.popper, 27026 reference = _data$offsets.reference; 27027 27028 var placement = data.placement.split('-')[0]; 27029 var floor = Math.floor; 27030 var isVertical = ['top', 'bottom'].indexOf(placement) !== -1; 27031 var side = isVertical ? 'right' : 'bottom'; 27032 var opSide = isVertical ? 'left' : 'top'; 27033 var measurement = isVertical ? 'width' : 'height'; 27034 27035 if (popper[side] < floor(reference[opSide])) { 27036 data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement]; 27037 } 27038 if (popper[opSide] > floor(reference[side])) { 27039 data.offsets.popper[opSide] = floor(reference[side]); 27040 } 27041 27042 return data; 27043} 27044 27045/** 27046 * Converts a string containing value + unit into a px value number 27047 * @function 27048 * @memberof {modifiers~offset} 27049 * @private 27050 * @argument {String} str - Value + unit string 27051 * @argument {String} measurement - `height` or `width` 27052 * @argument {Object} popperOffsets 27053 * @argument {Object} referenceOffsets 27054 * @returns {Number|String} 27055 * Value in pixels, or original string if no values were extracted 27056 */ 27057function toValue(str, measurement, popperOffsets, referenceOffsets) { 27058 // separate value from unit 27059 var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/); 27060 var value = +split[1]; 27061 var unit = split[2]; 27062 27063 // If it's not a number it's an operator, I guess 27064 if (!value) { 27065 return str; 27066 } 27067 27068 if (unit.indexOf('%') === 0) { 27069 var element = void 0; 27070 switch (unit) { 27071 case '%p': 27072 element = popperOffsets; 27073 break; 27074 case '%': 27075 case '%r': 27076 default: 27077 element = referenceOffsets; 27078 } 27079 27080 var rect = getClientRect(element); 27081 return rect[measurement] / 100 * value; 27082 } else if (unit === 'vh' || unit === 'vw') { 27083 // if is a vh or vw, we calculate the size based on the viewport 27084 var size = void 0; 27085 if (unit === 'vh') { 27086 size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); 27087 } else { 27088 size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); 27089 } 27090 return size / 100 * value; 27091 } else { 27092 // if is an explicit pixel unit, we get rid of the unit and keep the value 27093 // if is an implicit unit, it's px, and we return just the value 27094 return value; 27095 } 27096} 27097 27098/** 27099 * Parse an `offset` string to extrapolate `x` and `y` numeric offsets. 27100 * @function 27101 * @memberof {modifiers~offset} 27102 * @private 27103 * @argument {String} offset 27104 * @argument {Object} popperOffsets 27105 * @argument {Object} referenceOffsets 27106 * @argument {String} basePlacement 27107 * @returns {Array} a two cells array with x and y offsets in numbers 27108 */ 27109function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) { 27110 var offsets = [0, 0]; 27111 27112 // Use height if placement is left or right and index is 0 otherwise use width 27113 // in this way the first offset will use an axis and the second one 27114 // will use the other one 27115 var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1; 27116 27117 // Split the offset string to obtain a list of values and operands 27118 // The regex addresses values with the plus or minus sign in front (+10, -20, etc) 27119 var fragments = offset.split(/(\+|\-)/).map(function (frag) { 27120 return frag.trim(); 27121 }); 27122 27123 // Detect if the offset string contains a pair of values or a single one 27124 // they could be separated by comma or space 27125 var divider = fragments.indexOf(find(fragments, function (frag) { 27126 return frag.search(/,|\s/) !== -1; 27127 })); 27128 27129 if (fragments[divider] && fragments[divider].indexOf(',') === -1) { 27130 console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.'); 27131 } 27132 27133 // If divider is found, we divide the list of values and operands to divide 27134 // them by ofset X and Y. 27135 var splitRegex = /\s*,\s*|\s+/; 27136 var ops = divider !== -1 ? [fragments.slice(0, divider).concat([fragments[divider].split(splitRegex)[0]]), [fragments[divider].split(splitRegex)[1]].concat(fragments.slice(divider + 1))] : [fragments]; 27137 27138 // Convert the values with units to absolute pixels to allow our computations 27139 ops = ops.map(function (op, index) { 27140 // Most of the units rely on the orientation of the popper 27141 var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width'; 27142 var mergeWithPrevious = false; 27143 return op 27144 // This aggregates any `+` or `-` sign that aren't considered operators 27145 // e.g.: 10 + +5 => [10, +, +5] 27146 .reduce(function (a, b) { 27147 if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) { 27148 a[a.length - 1] = b; 27149 mergeWithPrevious = true; 27150 return a; 27151 } else if (mergeWithPrevious) { 27152 a[a.length - 1] += b; 27153 mergeWithPrevious = false; 27154 return a; 27155 } else { 27156 return a.concat(b); 27157 } 27158 }, []) 27159 // Here we convert the string values into number values (in px) 27160 .map(function (str) { 27161 return toValue(str, measurement, popperOffsets, referenceOffsets); 27162 }); 27163 }); 27164 27165 // Loop trough the offsets arrays and execute the operations 27166 ops.forEach(function (op, index) { 27167 op.forEach(function (frag, index2) { 27168 if (isNumeric(frag)) { 27169 offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1); 27170 } 27171 }); 27172 }); 27173 return offsets; 27174} 27175 27176/** 27177 * @function 27178 * @memberof Modifiers 27179 * @argument {Object} data - The data object generated by update method 27180 * @argument {Object} options - Modifiers configuration and options 27181 * @argument {Number|String} options.offset=0 27182 * The offset value as described in the modifier description 27183 * @returns {Object} The data object, properly modified 27184 */ 27185function offset(data, _ref) { 27186 var offset = _ref.offset; 27187 var placement = data.placement, 27188 _data$offsets = data.offsets, 27189 popper = _data$offsets.popper, 27190 reference = _data$offsets.reference; 27191 27192 var basePlacement = placement.split('-')[0]; 27193 27194 var offsets = void 0; 27195 if (isNumeric(+offset)) { 27196 offsets = [+offset, 0]; 27197 } else { 27198 offsets = parseOffset(offset, popper, reference, basePlacement); 27199 } 27200 27201 if (basePlacement === 'left') { 27202 popper.top += offsets[0]; 27203 popper.left -= offsets[1]; 27204 } else if (basePlacement === 'right') { 27205 popper.top += offsets[0]; 27206 popper.left += offsets[1]; 27207 } else if (basePlacement === 'top') { 27208 popper.left += offsets[0]; 27209 popper.top -= offsets[1]; 27210 } else if (basePlacement === 'bottom') { 27211 popper.left += offsets[0]; 27212 popper.top += offsets[1]; 27213 } 27214 27215 data.popper = popper; 27216 return data; 27217} 27218 27219/** 27220 * @function 27221 * @memberof Modifiers 27222 * @argument {Object} data - The data object generated by `update` method 27223 * @argument {Object} options - Modifiers configuration and options 27224 * @returns {Object} The data object, properly modified 27225 */ 27226function preventOverflow(data, options) { 27227 var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper); 27228 27229 // If offsetParent is the reference element, we really want to 27230 // go one step up and use the next offsetParent as reference to 27231 // avoid to make this modifier completely useless and look like broken 27232 if (data.instance.reference === boundariesElement) { 27233 boundariesElement = getOffsetParent(boundariesElement); 27234 } 27235 27236 // NOTE: DOM access here 27237 // resets the popper's position so that the document size can be calculated excluding 27238 // the size of the popper element itself 27239 var transformProp = getSupportedPropertyName('transform'); 27240 var popperStyles = data.instance.popper.style; // assignment to help minification 27241 var top = popperStyles.top, 27242 left = popperStyles.left, 27243 transform = popperStyles[transformProp]; 27244 27245 popperStyles.top = ''; 27246 popperStyles.left = ''; 27247 popperStyles[transformProp] = ''; 27248 27249 var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed); 27250 27251 // NOTE: DOM access here 27252 // restores the original style properties after the offsets have been computed 27253 popperStyles.top = top; 27254 popperStyles.left = left; 27255 popperStyles[transformProp] = transform; 27256 27257 options.boundaries = boundaries; 27258 27259 var order = options.priority; 27260 var popper = data.offsets.popper; 27261 27262 var check = { 27263 primary: function primary(placement) { 27264 var value = popper[placement]; 27265 if (popper[placement] < boundaries[placement] && !options.escapeWithReference) { 27266 value = Math.max(popper[placement], boundaries[placement]); 27267 } 27268 return defineProperty({}, placement, value); 27269 }, 27270 secondary: function secondary(placement) { 27271 var mainSide = placement === 'right' ? 'left' : 'top'; 27272 var value = popper[mainSide]; 27273 if (popper[placement] > boundaries[placement] && !options.escapeWithReference) { 27274 value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height)); 27275 } 27276 return defineProperty({}, mainSide, value); 27277 } 27278 }; 27279 27280 order.forEach(function (placement) { 27281 var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary'; 27282 popper = _extends({}, popper, check[side](placement)); 27283 }); 27284 27285 data.offsets.popper = popper; 27286 27287 return data; 27288} 27289 27290/** 27291 * @function 27292 * @memberof Modifiers 27293 * @argument {Object} data - The data object generated by `update` method 27294 * @argument {Object} options - Modifiers configuration and options 27295 * @returns {Object} The data object, properly modified 27296 */ 27297function shift(data) { 27298 var placement = data.placement; 27299 var basePlacement = placement.split('-')[0]; 27300 var shiftvariation = placement.split('-')[1]; 27301 27302 // if shift shiftvariation is specified, run the modifier 27303 if (shiftvariation) { 27304 var _data$offsets = data.offsets, 27305 reference = _data$offsets.reference, 27306 popper = _data$offsets.popper; 27307 27308 var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1; 27309 var side = isVertical ? 'left' : 'top'; 27310 var measurement = isVertical ? 'width' : 'height'; 27311 27312 var shiftOffsets = { 27313 start: defineProperty({}, side, reference[side]), 27314 end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement]) 27315 }; 27316 27317 data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]); 27318 } 27319 27320 return data; 27321} 27322 27323/** 27324 * @function 27325 * @memberof Modifiers 27326 * @argument {Object} data - The data object generated by update method 27327 * @argument {Object} options - Modifiers configuration and options 27328 * @returns {Object} The data object, properly modified 27329 */ 27330function hide(data) { 27331 if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) { 27332 return data; 27333 } 27334 27335 var refRect = data.offsets.reference; 27336 var bound = find(data.instance.modifiers, function (modifier) { 27337 return modifier.name === 'preventOverflow'; 27338 }).boundaries; 27339 27340 if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) { 27341 // Avoid unnecessary DOM access if visibility hasn't changed 27342 if (data.hide === true) { 27343 return data; 27344 } 27345 27346 data.hide = true; 27347 data.attributes['x-out-of-boundaries'] = ''; 27348 } else { 27349 // Avoid unnecessary DOM access if visibility hasn't changed 27350 if (data.hide === false) { 27351 return data; 27352 } 27353 27354 data.hide = false; 27355 data.attributes['x-out-of-boundaries'] = false; 27356 } 27357 27358 return data; 27359} 27360 27361/** 27362 * @function 27363 * @memberof Modifiers 27364 * @argument {Object} data - The data object generated by `update` method 27365 * @argument {Object} options - Modifiers configuration and options 27366 * @returns {Object} The data object, properly modified 27367 */ 27368function inner(data) { 27369 var placement = data.placement; 27370 var basePlacement = placement.split('-')[0]; 27371 var _data$offsets = data.offsets, 27372 popper = _data$offsets.popper, 27373 reference = _data$offsets.reference; 27374 27375 var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1; 27376 27377 var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1; 27378 27379 popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0); 27380 27381 data.placement = getOppositePlacement(placement); 27382 data.offsets.popper = getClientRect(popper); 27383 27384 return data; 27385} 27386 27387/** 27388 * Modifier function, each modifier can have a function of this type assigned 27389 * to its `fn` property.<br /> 27390 * These functions will be called on each update, this means that you must 27391 * make sure they are performant enough to avoid performance bottlenecks. 27392 * 27393 * @function ModifierFn 27394 * @argument {dataObject} data - The data object generated by `update` method 27395 * @argument {Object} options - Modifiers configuration and options 27396 * @returns {dataObject} The data object, properly modified 27397 */ 27398 27399/** 27400 * Modifiers are plugins used to alter the behavior of your poppers.<br /> 27401 * Popper.js uses a set of 9 modifiers to provide all the basic functionalities 27402 * needed by the library. 27403 * 27404 * Usually you don't want to override the `order`, `fn` and `onLoad` props. 27405 * All the other properties are configurations that could be tweaked. 27406 * @namespace modifiers 27407 */ 27408var modifiers = { 27409 /** 27410 * Modifier used to shift the popper on the start or end of its reference 27411 * element.<br /> 27412 * It will read the variation of the `placement` property.<br /> 27413 * It can be one either `-end` or `-start`. 27414 * @memberof modifiers 27415 * @inner 27416 */ 27417 shift: { 27418 /** @prop {number} order=100 - Index used to define the order of execution */ 27419 order: 100, 27420 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 27421 enabled: true, 27422 /** @prop {ModifierFn} */ 27423 fn: shift 27424 }, 27425 27426 /** 27427 * The `offset` modifier can shift your popper on both its axis. 27428 * 27429 * It accepts the following units: 27430 * - `px` or unit-less, interpreted as pixels 27431 * - `%` or `%r`, percentage relative to the length of the reference element 27432 * - `%p`, percentage relative to the length of the popper element 27433 * - `vw`, CSS viewport width unit 27434 * - `vh`, CSS viewport height unit 27435 * 27436 * For length is intended the main axis relative to the placement of the popper.<br /> 27437 * This means that if the placement is `top` or `bottom`, the length will be the 27438 * `width`. In case of `left` or `right`, it will be the `height`. 27439 * 27440 * You can provide a single value (as `Number` or `String`), or a pair of values 27441 * as `String` divided by a comma or one (or more) white spaces.<br /> 27442 * The latter is a deprecated method because it leads to confusion and will be 27443 * removed in v2.<br /> 27444 * Additionally, it accepts additions and subtractions between different units. 27445 * Note that multiplications and divisions aren't supported. 27446 * 27447 * Valid examples are: 27448 * ``` 27449 * 10 27450 * '10%' 27451 * '10, 10' 27452 * '10%, 10' 27453 * '10 + 10%' 27454 * '10 - 5vh + 3%' 27455 * '-10px + 5vh, 5px - 6%' 27456 * ``` 27457 * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap 27458 * > with their reference element, unfortunately, you will have to disable the `flip` modifier. 27459 * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373). 27460 * 27461 * @memberof modifiers 27462 * @inner 27463 */ 27464 offset: { 27465 /** @prop {number} order=200 - Index used to define the order of execution */ 27466 order: 200, 27467 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 27468 enabled: true, 27469 /** @prop {ModifierFn} */ 27470 fn: offset, 27471 /** @prop {Number|String} offset=0 27472 * The offset value as described in the modifier description 27473 */ 27474 offset: 0 27475 }, 27476 27477 /** 27478 * Modifier used to prevent the popper from being positioned outside the boundary. 27479 * 27480 * A scenario exists where the reference itself is not within the boundaries.<br /> 27481 * We can say it has "escaped the boundaries" — or just "escaped".<br /> 27482 * In this case we need to decide whether the popper should either: 27483 * 27484 * - detach from the reference and remain "trapped" in the boundaries, or 27485 * - if it should ignore the boundary and "escape with its reference" 27486 * 27487 * When `escapeWithReference` is set to`true` and reference is completely 27488 * outside its boundaries, the popper will overflow (or completely leave) 27489 * the boundaries in order to remain attached to the edge of the reference. 27490 * 27491 * @memberof modifiers 27492 * @inner 27493 */ 27494 preventOverflow: { 27495 /** @prop {number} order=300 - Index used to define the order of execution */ 27496 order: 300, 27497 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 27498 enabled: true, 27499 /** @prop {ModifierFn} */ 27500 fn: preventOverflow, 27501 /** 27502 * @prop {Array} [priority=['left','right','top','bottom']] 27503 * Popper will try to prevent overflow following these priorities by default, 27504 * then, it could overflow on the left and on top of the `boundariesElement` 27505 */ 27506 priority: ['left', 'right', 'top', 'bottom'], 27507 /** 27508 * @prop {number} padding=5 27509 * Amount of pixel used to define a minimum distance between the boundaries 27510 * and the popper. This makes sure the popper always has a little padding 27511 * between the edges of its container 27512 */ 27513 padding: 5, 27514 /** 27515 * @prop {String|HTMLElement} boundariesElement='scrollParent' 27516 * Boundaries used by the modifier. Can be `scrollParent`, `window`, 27517 * `viewport` or any DOM element. 27518 */ 27519 boundariesElement: 'scrollParent' 27520 }, 27521 27522 /** 27523 * Modifier used to make sure the reference and its popper stay near each other 27524 * without leaving any gap between the two. Especially useful when the arrow is 27525 * enabled and you want to ensure that it points to its reference element. 27526 * It cares only about the first axis. You can still have poppers with margin 27527 * between the popper and its reference element. 27528 * @memberof modifiers 27529 * @inner 27530 */ 27531 keepTogether: { 27532 /** @prop {number} order=400 - Index used to define the order of execution */ 27533 order: 400, 27534 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 27535 enabled: true, 27536 /** @prop {ModifierFn} */ 27537 fn: keepTogether 27538 }, 27539 27540 /** 27541 * This modifier is used to move the `arrowElement` of the popper to make 27542 * sure it is positioned between the reference element and its popper element. 27543 * It will read the outer size of the `arrowElement` node to detect how many 27544 * pixels of conjunction are needed. 27545 * 27546 * It has no effect if no `arrowElement` is provided. 27547 * @memberof modifiers 27548 * @inner 27549 */ 27550 arrow: { 27551 /** @prop {number} order=500 - Index used to define the order of execution */ 27552 order: 500, 27553 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 27554 enabled: true, 27555 /** @prop {ModifierFn} */ 27556 fn: arrow, 27557 /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */ 27558 element: '[x-arrow]' 27559 }, 27560 27561 /** 27562 * Modifier used to flip the popper's placement when it starts to overlap its 27563 * reference element. 27564 * 27565 * Requires the `preventOverflow` modifier before it in order to work. 27566 * 27567 * **NOTE:** this modifier will interrupt the current update cycle and will 27568 * restart it if it detects the need to flip the placement. 27569 * @memberof modifiers 27570 * @inner 27571 */ 27572 flip: { 27573 /** @prop {number} order=600 - Index used to define the order of execution */ 27574 order: 600, 27575 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 27576 enabled: true, 27577 /** @prop {ModifierFn} */ 27578 fn: flip, 27579 /** 27580 * @prop {String|Array} behavior='flip' 27581 * The behavior used to change the popper's placement. It can be one of 27582 * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid 27583 * placements (with optional variations) 27584 */ 27585 behavior: 'flip', 27586 /** 27587 * @prop {number} padding=5 27588 * The popper will flip if it hits the edges of the `boundariesElement` 27589 */ 27590 padding: 5, 27591 /** 27592 * @prop {String|HTMLElement} boundariesElement='viewport' 27593 * The element which will define the boundaries of the popper position. 27594 * The popper will never be placed outside of the defined boundaries 27595 * (except if `keepTogether` is enabled) 27596 */ 27597 boundariesElement: 'viewport', 27598 /** 27599 * @prop {Boolean} flipVariations=false 27600 * The popper will switch placement variation between `-start` and `-end` when 27601 * the reference element overlaps its boundaries. 27602 * 27603 * The original placement should have a set variation. 27604 */ 27605 flipVariations: false, 27606 /** 27607 * @prop {Boolean} flipVariationsByContent=false 27608 * The popper will switch placement variation between `-start` and `-end` when 27609 * the popper element overlaps its reference boundaries. 27610 * 27611 * The original placement should have a set variation. 27612 */ 27613 flipVariationsByContent: false 27614 }, 27615 27616 /** 27617 * Modifier used to make the popper flow toward the inner of the reference element. 27618 * By default, when this modifier is disabled, the popper will be placed outside 27619 * the reference element. 27620 * @memberof modifiers 27621 * @inner 27622 */ 27623 inner: { 27624 /** @prop {number} order=700 - Index used to define the order of execution */ 27625 order: 700, 27626 /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */ 27627 enabled: false, 27628 /** @prop {ModifierFn} */ 27629 fn: inner 27630 }, 27631 27632 /** 27633 * Modifier used to hide the popper when its reference element is outside of the 27634 * popper boundaries. It will set a `x-out-of-boundaries` attribute which can 27635 * be used to hide with a CSS selector the popper when its reference is 27636 * out of boundaries. 27637 * 27638 * Requires the `preventOverflow` modifier before it in order to work. 27639 * @memberof modifiers 27640 * @inner 27641 */ 27642 hide: { 27643 /** @prop {number} order=800 - Index used to define the order of execution */ 27644 order: 800, 27645 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 27646 enabled: true, 27647 /** @prop {ModifierFn} */ 27648 fn: hide 27649 }, 27650 27651 /** 27652 * Computes the style that will be applied to the popper element to gets 27653 * properly positioned. 27654 * 27655 * Note that this modifier will not touch the DOM, it just prepares the styles 27656 * so that `applyStyle` modifier can apply it. This separation is useful 27657 * in case you need to replace `applyStyle` with a custom implementation. 27658 * 27659 * This modifier has `850` as `order` value to maintain backward compatibility 27660 * with previous versions of Popper.js. Expect the modifiers ordering method 27661 * to change in future major versions of the library. 27662 * 27663 * @memberof modifiers 27664 * @inner 27665 */ 27666 computeStyle: { 27667 /** @prop {number} order=850 - Index used to define the order of execution */ 27668 order: 850, 27669 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 27670 enabled: true, 27671 /** @prop {ModifierFn} */ 27672 fn: computeStyle, 27673 /** 27674 * @prop {Boolean} gpuAcceleration=true 27675 * If true, it uses the CSS 3D transformation to position the popper. 27676 * Otherwise, it will use the `top` and `left` properties 27677 */ 27678 gpuAcceleration: true, 27679 /** 27680 * @prop {string} [x='bottom'] 27681 * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin. 27682 * Change this if your popper should grow in a direction different from `bottom` 27683 */ 27684 x: 'bottom', 27685 /** 27686 * @prop {string} [x='left'] 27687 * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin. 27688 * Change this if your popper should grow in a direction different from `right` 27689 */ 27690 y: 'right' 27691 }, 27692 27693 /** 27694 * Applies the computed styles to the popper element. 27695 * 27696 * All the DOM manipulations are limited to this modifier. This is useful in case 27697 * you want to integrate Popper.js inside a framework or view library and you 27698 * want to delegate all the DOM manipulations to it. 27699 * 27700 * Note that if you disable this modifier, you must make sure the popper element 27701 * has its position set to `absolute` before Popper.js can do its work! 27702 * 27703 * Just disable this modifier and define your own to achieve the desired effect. 27704 * 27705 * @memberof modifiers 27706 * @inner 27707 */ 27708 applyStyle: { 27709 /** @prop {number} order=900 - Index used to define the order of execution */ 27710 order: 900, 27711 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 27712 enabled: true, 27713 /** @prop {ModifierFn} */ 27714 fn: applyStyle, 27715 /** @prop {Function} */ 27716 onLoad: applyStyleOnLoad, 27717 /** 27718 * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier 27719 * @prop {Boolean} gpuAcceleration=true 27720 * If true, it uses the CSS 3D transformation to position the popper. 27721 * Otherwise, it will use the `top` and `left` properties 27722 */ 27723 gpuAcceleration: undefined 27724 } 27725}; 27726 27727/** 27728 * The `dataObject` is an object containing all the information used by Popper.js. 27729 * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks. 27730 * @name dataObject 27731 * @property {Object} data.instance The Popper.js instance 27732 * @property {String} data.placement Placement applied to popper 27733 * @property {String} data.originalPlacement Placement originally defined on init 27734 * @property {Boolean} data.flipped True if popper has been flipped by flip modifier 27735 * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper 27736 * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier 27737 * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`) 27738 * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`) 27739 * @property {Object} data.boundaries Offsets of the popper boundaries 27740 * @property {Object} data.offsets The measurements of popper, reference and arrow elements 27741 * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values 27742 * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values 27743 * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0 27744 */ 27745 27746/** 27747 * Default options provided to Popper.js constructor.<br /> 27748 * These can be overridden using the `options` argument of Popper.js.<br /> 27749 * To override an option, simply pass an object with the same 27750 * structure of the `options` object, as the 3rd argument. For example: 27751 * ``` 27752 * new Popper(ref, pop, { 27753 * modifiers: { 27754 * preventOverflow: { enabled: false } 27755 * } 27756 * }) 27757 * ``` 27758 * @type {Object} 27759 * @static 27760 * @memberof Popper 27761 */ 27762var Defaults = { 27763 /** 27764 * Popper's placement. 27765 * @prop {Popper.placements} placement='bottom' 27766 */ 27767 placement: 'bottom', 27768 27769 /** 27770 * Set this to true if you want popper to position it self in 'fixed' mode 27771 * @prop {Boolean} positionFixed=false 27772 */ 27773 positionFixed: false, 27774 27775 /** 27776 * Whether events (resize, scroll) are initially enabled. 27777 * @prop {Boolean} eventsEnabled=true 27778 */ 27779 eventsEnabled: true, 27780 27781 /** 27782 * Set to true if you want to automatically remove the popper when 27783 * you call the `destroy` method. 27784 * @prop {Boolean} removeOnDestroy=false 27785 */ 27786 removeOnDestroy: false, 27787 27788 /** 27789 * Callback called when the popper is created.<br /> 27790 * By default, it is set to no-op.<br /> 27791 * Access Popper.js instance with `data.instance`. 27792 * @prop {onCreate} 27793 */ 27794 onCreate: function onCreate() {}, 27795 27796 /** 27797 * Callback called when the popper is updated. This callback is not called 27798 * on the initialization/creation of the popper, but only on subsequent 27799 * updates.<br /> 27800 * By default, it is set to no-op.<br /> 27801 * Access Popper.js instance with `data.instance`. 27802 * @prop {onUpdate} 27803 */ 27804 onUpdate: function onUpdate() {}, 27805 27806 /** 27807 * List of modifiers used to modify the offsets before they are applied to the popper. 27808 * They provide most of the functionalities of Popper.js. 27809 * @prop {modifiers} 27810 */ 27811 modifiers: modifiers 27812}; 27813 27814/** 27815 * @callback onCreate 27816 * @param {dataObject} data 27817 */ 27818 27819/** 27820 * @callback onUpdate 27821 * @param {dataObject} data 27822 */ 27823 27824// Utils 27825// Methods 27826var Popper = function () { 27827 /** 27828 * Creates a new Popper.js instance. 27829 * @class Popper 27830 * @param {Element|referenceObject} reference - The reference element used to position the popper 27831 * @param {Element} popper - The HTML / XML element used as the popper 27832 * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults) 27833 * @return {Object} instance - The generated Popper.js instance 27834 */ 27835 function Popper(reference, popper) { 27836 var _this = this; 27837 27838 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; 27839 classCallCheck(this, Popper); 27840 27841 this.scheduleUpdate = function () { 27842 return requestAnimationFrame(_this.update); 27843 }; 27844 27845 // make update() debounced, so that it only runs at most once-per-tick 27846 this.update = debounce(this.update.bind(this)); 27847 27848 // with {} we create a new object with the options inside it 27849 this.options = _extends({}, Popper.Defaults, options); 27850 27851 // init state 27852 this.state = { 27853 isDestroyed: false, 27854 isCreated: false, 27855 scrollParents: [] 27856 }; 27857 27858 // get reference and popper elements (allow jQuery wrappers) 27859 this.reference = reference && reference.jquery ? reference[0] : reference; 27860 this.popper = popper && popper.jquery ? popper[0] : popper; 27861 27862 // Deep merge modifiers options 27863 this.options.modifiers = {}; 27864 Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) { 27865 _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {}); 27866 }); 27867 27868 // Refactoring modifiers' list (Object => Array) 27869 this.modifiers = Object.keys(this.options.modifiers).map(function (name) { 27870 return _extends({ 27871 name: name 27872 }, _this.options.modifiers[name]); 27873 }) 27874 // sort the modifiers by order 27875 .sort(function (a, b) { 27876 return a.order - b.order; 27877 }); 27878 27879 // modifiers have the ability to execute arbitrary code when Popper.js get inited 27880 // such code is executed in the same order of its modifier 27881 // they could add new properties to their options configuration 27882 // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`! 27883 this.modifiers.forEach(function (modifierOptions) { 27884 if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) { 27885 modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state); 27886 } 27887 }); 27888 27889 // fire the first update to position the popper in the right place 27890 this.update(); 27891 27892 var eventsEnabled = this.options.eventsEnabled; 27893 if (eventsEnabled) { 27894 // setup event listeners, they will take care of update the position in specific situations 27895 this.enableEventListeners(); 27896 } 27897 27898 this.state.eventsEnabled = eventsEnabled; 27899 } 27900 27901 // We can't use class properties because they don't get listed in the 27902 // class prototype and break stuff like Sinon stubs 27903 27904 27905 createClass(Popper, [{ 27906 key: 'update', 27907 value: function update$$1() { 27908 return update.call(this); 27909 } 27910 }, { 27911 key: 'destroy', 27912 value: function destroy$$1() { 27913 return destroy.call(this); 27914 } 27915 }, { 27916 key: 'enableEventListeners', 27917 value: function enableEventListeners$$1() { 27918 return enableEventListeners.call(this); 27919 } 27920 }, { 27921 key: 'disableEventListeners', 27922 value: function disableEventListeners$$1() { 27923 return disableEventListeners.call(this); 27924 } 27925 27926 /** 27927 * Schedules an update. It will run on the next UI update available. 27928 * @method scheduleUpdate 27929 * @memberof Popper 27930 */ 27931 27932 27933 /** 27934 * Collection of utilities useful when writing custom modifiers. 27935 * Starting from version 1.7, this method is available only if you 27936 * include `popper-utils.js` before `popper.js`. 27937 * 27938 * **DEPRECATION**: This way to access PopperUtils is deprecated 27939 * and will be removed in v2! Use the PopperUtils module directly instead. 27940 * Due to the high instability of the methods contained in Utils, we can't 27941 * guarantee them to follow semver. Use them at your own risk! 27942 * @static 27943 * @private 27944 * @type {Object} 27945 * @deprecated since version 1.8 27946 * @member Utils 27947 * @memberof Popper 27948 */ 27949 27950 }]); 27951 return Popper; 27952}(); 27953 27954/** 27955 * The `referenceObject` is an object that provides an interface compatible with Popper.js 27956 * and lets you use it as replacement of a real DOM node.<br /> 27957 * You can use this method to position a popper relatively to a set of coordinates 27958 * in case you don't have a DOM node to use as reference. 27959 * 27960 * ``` 27961 * new Popper(referenceObject, popperNode); 27962 * ``` 27963 * 27964 * NB: This feature isn't supported in Internet Explorer 10. 27965 * @name referenceObject 27966 * @property {Function} data.getBoundingClientRect 27967 * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method. 27968 * @property {number} data.clientWidth 27969 * An ES6 getter that will return the width of the virtual reference element. 27970 * @property {number} data.clientHeight 27971 * An ES6 getter that will return the height of the virtual reference element. 27972 */ 27973 27974 27975Popper.Utils = (typeof window !== 'undefined' ? window : __webpack_require__.g).PopperUtils; 27976Popper.placements = placements; 27977Popper.Defaults = Defaults; 27978 27979/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Popper); 27980//# sourceMappingURL=popper.js.map 27981 27982 27983/***/ }), 27984
vendor: 88,916 bytes, lines 27985-30617
27985/***/ "./node_modules/popper.js/dist/umd/popper.js": 27986/*!***************************************************!*\ 27987 !*** ./node_modules/popper.js/dist/umd/popper.js ***! 27988 \***************************************************/ 27989/***/ (function(module, __unused_webpack_exports, __webpack_require__) { 27990 27991/**! 27992 * @fileOverview Kickass library to create and place poppers near their reference elements. 27993 * @version 1.16.1 27994 * @license 27995 * Copyright (c) 2016 Federico Zivolo and contributors 27996 * 27997 * Permission is hereby granted, free of charge, to any person obtaining a copy 27998 * of this software and associated documentation files (the "Software"), to deal 27999 * in the Software without restriction, including without limitation the rights 28000 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 28001 * copies of the Software, and to permit persons to whom the Software is 28002 * furnished to do so, subject to the following conditions: 28003 * 28004 * The above copyright notice and this permission notice shall be included in all 28005 * copies or substantial portions of the Software. 28006 * 28007 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 28008 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28009 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28010 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 28011 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28012 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 28013 * SOFTWARE. 28014 */ 28015(function (global, factory) { 28016 true ? module.exports = factory() : 28017 0; 28018}(this, (function () { 'use strict'; 28019 28020var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined'; 28021 28022var timeoutDuration = function () { 28023 var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox']; 28024 for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) { 28025 if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) { 28026 return 1; 28027 } 28028 } 28029 return 0; 28030}(); 28031 28032function microtaskDebounce(fn) { 28033 var called = false; 28034 return function () { 28035 if (called) { 28036 return; 28037 } 28038 called = true; 28039 window.Promise.resolve().then(function () { 28040 called = false; 28041 fn(); 28042 }); 28043 }; 28044} 28045 28046function taskDebounce(fn) { 28047 var scheduled = false; 28048 return function () { 28049 if (!scheduled) { 28050 scheduled = true; 28051 setTimeout(function () { 28052 scheduled = false; 28053 fn(); 28054 }, timeoutDuration); 28055 } 28056 }; 28057} 28058 28059var supportsMicroTasks = isBrowser && window.Promise; 28060 28061/** 28062* Create a debounced version of a method, that's asynchronously deferred 28063* but called in the minimum time possible. 28064* 28065* @method 28066* @memberof Popper.Utils 28067* @argument {Function} fn 28068* @returns {Function} 28069*/ 28070var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce; 28071 28072/** 28073 * Check if the given variable is a function 28074 * @method 28075 * @memberof Popper.Utils 28076 * @argument {Any} functionToCheck - variable to check 28077 * @returns {Boolean} answer to: is a function? 28078 */ 28079function isFunction(functionToCheck) { 28080 var getType = {}; 28081 return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]'; 28082} 28083 28084/** 28085 * Get CSS computed property of the given element 28086 * @method 28087 * @memberof Popper.Utils 28088 * @argument {Eement} element 28089 * @argument {String} property 28090 */ 28091function getStyleComputedProperty(element, property) { 28092 if (element.nodeType !== 1) { 28093 return []; 28094 } 28095 // NOTE: 1 DOM access here 28096 var window = element.ownerDocument.defaultView; 28097 var css = window.getComputedStyle(element, null); 28098 return property ? css[property] : css; 28099} 28100 28101/** 28102 * Returns the parentNode or the host of the element 28103 * @method 28104 * @memberof Popper.Utils 28105 * @argument {Element} element 28106 * @returns {Element} parent 28107 */ 28108function getParentNode(element) { 28109 if (element.nodeName === 'HTML') { 28110 return element; 28111 } 28112 return element.parentNode || element.host; 28113} 28114 28115/** 28116 * Returns the scrolling parent of the given element 28117 * @method 28118 * @memberof Popper.Utils 28119 * @argument {Element} element 28120 * @returns {Element} scroll parent 28121 */ 28122function getScrollParent(element) { 28123 // Return body, `getScroll` will take care to get the correct `scrollTop` from it 28124 if (!element) { 28125 return document.body; 28126 } 28127 28128 switch (element.nodeName) { 28129 case 'HTML': 28130 case 'BODY': 28131 return element.ownerDocument.body; 28132 case '#document': 28133 return element.body; 28134 } 28135 28136 // Firefox want us to check `-x` and `-y` variations as well 28137 28138 var _getStyleComputedProp = getStyleComputedProperty(element), 28139 overflow = _getStyleComputedProp.overflow, 28140 overflowX = _getStyleComputedProp.overflowX, 28141 overflowY = _getStyleComputedProp.overflowY; 28142 28143 if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) { 28144 return element; 28145 } 28146 28147 return getScrollParent(getParentNode(element)); 28148} 28149 28150/** 28151 * Returns the reference node of the reference object, or the reference object itself. 28152 * @method 28153 * @memberof Popper.Utils 28154 * @param {Element|Object} reference - the reference element (the popper will be relative to this) 28155 * @returns {Element} parent 28156 */ 28157function getReferenceNode(reference) { 28158 return reference && reference.referenceNode ? reference.referenceNode : reference; 28159} 28160 28161var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode); 28162var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent); 28163 28164/** 28165 * Determines if the browser is Internet Explorer 28166 * @method 28167 * @memberof Popper.Utils 28168 * @param {Number} version to check 28169 * @returns {Boolean} isIE 28170 */ 28171function isIE(version) { 28172 if (version === 11) { 28173 return isIE11; 28174 } 28175 if (version === 10) { 28176 return isIE10; 28177 } 28178 return isIE11 || isIE10; 28179} 28180 28181/** 28182 * Returns the offset parent of the given element 28183 * @method 28184 * @memberof Popper.Utils 28185 * @argument {Element} element 28186 * @returns {Element} offset parent 28187 */ 28188function getOffsetParent(element) { 28189 if (!element) { 28190 return document.documentElement; 28191 } 28192 28193 var noOffsetParent = isIE(10) ? document.body : null; 28194 28195 // NOTE: 1 DOM access here 28196 var offsetParent = element.offsetParent || null; 28197 // Skip hidden elements which don't have an offsetParent 28198 while (offsetParent === noOffsetParent && element.nextElementSibling) { 28199 offsetParent = (element = element.nextElementSibling).offsetParent; 28200 } 28201 28202 var nodeName = offsetParent && offsetParent.nodeName; 28203 28204 if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') { 28205 return element ? element.ownerDocument.documentElement : document.documentElement; 28206 } 28207 28208 // .offsetParent will return the closest TH, TD or TABLE in case 28209 // no offsetParent is present, I hate this job... 28210 if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') { 28211 return getOffsetParent(offsetParent); 28212 } 28213 28214 return offsetParent; 28215} 28216 28217function isOffsetContainer(element) { 28218 var nodeName = element.nodeName; 28219 28220 if (nodeName === 'BODY') { 28221 return false; 28222 } 28223 return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element; 28224} 28225 28226/** 28227 * Finds the root node (document, shadowDOM root) of the given element 28228 * @method 28229 * @memberof Popper.Utils 28230 * @argument {Element} node 28231 * @returns {Element} root node 28232 */ 28233function getRoot(node) { 28234 if (node.parentNode !== null) { 28235 return getRoot(node.parentNode); 28236 } 28237 28238 return node; 28239} 28240 28241/** 28242 * Finds the offset parent common to the two provided nodes 28243 * @method 28244 * @memberof Popper.Utils 28245 * @argument {Element} element1 28246 * @argument {Element} element2 28247 * @returns {Element} common offset parent 28248 */ 28249function findCommonOffsetParent(element1, element2) { 28250 // This check is needed to avoid errors in case one of the elements isn't defined for any reason 28251 if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) { 28252 return document.documentElement; 28253 } 28254 28255 // Here we make sure to give as "start" the element that comes first in the DOM 28256 var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING; 28257 var start = order ? element1 : element2; 28258 var end = order ? element2 : element1; 28259 28260 // Get common ancestor container 28261 var range = document.createRange(); 28262 range.setStart(start, 0); 28263 range.setEnd(end, 0); 28264 var commonAncestorContainer = range.commonAncestorContainer; 28265 28266 // Both nodes are inside #document 28267 28268 if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) { 28269 if (isOffsetContainer(commonAncestorContainer)) { 28270 return commonAncestorContainer; 28271 } 28272 28273 return getOffsetParent(commonAncestorContainer); 28274 } 28275 28276 // one of the nodes is inside shadowDOM, find which one 28277 var element1root = getRoot(element1); 28278 if (element1root.host) { 28279 return findCommonOffsetParent(element1root.host, element2); 28280 } else { 28281 return findCommonOffsetParent(element1, getRoot(element2).host); 28282 } 28283} 28284 28285/** 28286 * Gets the scroll value of the given element in the given side (top and left) 28287 * @method 28288 * @memberof Popper.Utils 28289 * @argument {Element} element 28290 * @argument {String} side `top` or `left` 28291 * @returns {number} amount of scrolled pixels 28292 */ 28293function getScroll(element) { 28294 var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top'; 28295 28296 var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft'; 28297 var nodeName = element.nodeName; 28298 28299 if (nodeName === 'BODY' || nodeName === 'HTML') { 28300 var html = element.ownerDocument.documentElement; 28301 var scrollingElement = element.ownerDocument.scrollingElement || html; 28302 return scrollingElement[upperSide]; 28303 } 28304 28305 return element[upperSide]; 28306} 28307 28308/* 28309 * Sum or subtract the element scroll values (left and top) from a given rect object 28310 * @method 28311 * @memberof Popper.Utils 28312 * @param {Object} rect - Rect object you want to change 28313 * @param {HTMLElement} element - The element from the function reads the scroll values 28314 * @param {Boolean} subtract - set to true if you want to subtract the scroll values 28315 * @return {Object} rect - The modifier rect object 28316 */ 28317function includeScroll(rect, element) { 28318 var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; 28319 28320 var scrollTop = getScroll(element, 'top'); 28321 var scrollLeft = getScroll(element, 'left'); 28322 var modifier = subtract ? -1 : 1; 28323 rect.top += scrollTop * modifier; 28324 rect.bottom += scrollTop * modifier; 28325 rect.left += scrollLeft * modifier; 28326 rect.right += scrollLeft * modifier; 28327 return rect; 28328} 28329 28330/* 28331 * Helper to detect borders of a given element 28332 * @method 28333 * @memberof Popper.Utils 28334 * @param {CSSStyleDeclaration} styles 28335 * Result of `getStyleComputedProperty` on the given element 28336 * @param {String} axis - `x` or `y` 28337 * @return {number} borders - The borders size of the given axis 28338 */ 28339 28340function getBordersSize(styles, axis) { 28341 var sideA = axis === 'x' ? 'Left' : 'Top'; 28342 var sideB = sideA === 'Left' ? 'Right' : 'Bottom'; 28343 28344 return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']); 28345} 28346 28347function getSize(axis, body, html, computedStyle) { 28348 return Math.max(body['offset' + axis], body['scroll' + axis], html['client' + axis], html['offset' + axis], html['scroll' + axis], isIE(10) ? parseInt(html['offset' + axis]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Top' : 'Left')]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Bottom' : 'Right')]) : 0); 28349} 28350 28351function getWindowSizes(document) { 28352 var body = document.body; 28353 var html = document.documentElement; 28354 var computedStyle = isIE(10) && getComputedStyle(html); 28355 28356 return { 28357 height: getSize('Height', body, html, computedStyle), 28358 width: getSize('Width', body, html, computedStyle) 28359 }; 28360} 28361 28362var classCallCheck = function (instance, Constructor) { 28363 if (!(instance instanceof Constructor)) { 28364 throw new TypeError("Cannot call a class as a function"); 28365 } 28366}; 28367 28368var createClass = function () { 28369 function defineProperties(target, props) { 28370 for (var i = 0; i < props.length; i++) { 28371 var descriptor = props[i]; 28372 descriptor.enumerable = descriptor.enumerable || false; 28373 descriptor.configurable = true; 28374 if ("value" in descriptor) descriptor.writable = true; 28375 Object.defineProperty(target, descriptor.key, descriptor); 28376 } 28377 } 28378 28379 return function (Constructor, protoProps, staticProps) { 28380 if (protoProps) defineProperties(Constructor.prototype, protoProps); 28381 if (staticProps) defineProperties(Constructor, staticProps); 28382 return Constructor; 28383 }; 28384}(); 28385 28386 28387 28388 28389 28390var defineProperty = function (obj, key, value) { 28391 if (key in obj) { 28392 Object.defineProperty(obj, key, { 28393 value: value, 28394 enumerable: true, 28395 configurable: true, 28396 writable: true 28397 }); 28398 } else { 28399 obj[key] = value; 28400 } 28401 28402 return obj; 28403}; 28404 28405var _extends = Object.assign || function (target) { 28406 for (var i = 1; i < arguments.length; i++) { 28407 var source = arguments[i]; 28408 28409 for (var key in source) { 28410 if (Object.prototype.hasOwnProperty.call(source, key)) { 28411 target[key] = source[key]; 28412 } 28413 } 28414 } 28415 28416 return target; 28417}; 28418 28419/** 28420 * Given element offsets, generate an output similar to getBoundingClientRect 28421 * @method 28422 * @memberof Popper.Utils 28423 * @argument {Object} offsets 28424 * @returns {Object} ClientRect like output 28425 */ 28426function getClientRect(offsets) { 28427 return _extends({}, offsets, { 28428 right: offsets.left + offsets.width, 28429 bottom: offsets.top + offsets.height 28430 }); 28431} 28432 28433/** 28434 * Get bounding client rect of given element 28435 * @method 28436 * @memberof Popper.Utils 28437 * @param {HTMLElement} element 28438 * @return {Object} client rect 28439 */ 28440function getBoundingClientRect(element) { 28441 var rect = {}; 28442 28443 // IE10 10 FIX: Please, don't ask, the element isn't 28444 // considered in DOM in some circumstances... 28445 // This isn't reproducible in IE10 compatibility mode of IE11 28446 try { 28447 if (isIE(10)) { 28448 rect = element.getBoundingClientRect(); 28449 var scrollTop = getScroll(element, 'top'); 28450 var scrollLeft = getScroll(element, 'left'); 28451 rect.top += scrollTop; 28452 rect.left += scrollLeft; 28453 rect.bottom += scrollTop; 28454 rect.right += scrollLeft; 28455 } else { 28456 rect = element.getBoundingClientRect(); 28457 } 28458 } catch (e) {} 28459 28460 var result = { 28461 left: rect.left, 28462 top: rect.top, 28463 width: rect.right - rect.left, 28464 height: rect.bottom - rect.top 28465 }; 28466 28467 // subtract scrollbar size from sizes 28468 var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {}; 28469 var width = sizes.width || element.clientWidth || result.width; 28470 var height = sizes.height || element.clientHeight || result.height; 28471 28472 var horizScrollbar = element.offsetWidth - width; 28473 var vertScrollbar = element.offsetHeight - height; 28474 28475 // if an hypothetical scrollbar is detected, we must be sure it's not a `border` 28476 // we make this check conditional for performance reasons 28477 if (horizScrollbar || vertScrollbar) { 28478 var styles = getStyleComputedProperty(element); 28479 horizScrollbar -= getBordersSize(styles, 'x'); 28480 vertScrollbar -= getBordersSize(styles, 'y'); 28481 28482 result.width -= horizScrollbar; 28483 result.height -= vertScrollbar; 28484 } 28485 28486 return getClientRect(result); 28487} 28488 28489function getOffsetRectRelativeToArbitraryNode(children, parent) { 28490 var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; 28491 28492 var isIE10 = isIE(10); 28493 var isHTML = parent.nodeName === 'HTML'; 28494 var childrenRect = getBoundingClientRect(children); 28495 var parentRect = getBoundingClientRect(parent); 28496 var scrollParent = getScrollParent(children); 28497 28498 var styles = getStyleComputedProperty(parent); 28499 var borderTopWidth = parseFloat(styles.borderTopWidth); 28500 var borderLeftWidth = parseFloat(styles.borderLeftWidth); 28501 28502 // In cases where the parent is fixed, we must ignore negative scroll in offset calc 28503 if (fixedPosition && isHTML) { 28504 parentRect.top = Math.max(parentRect.top, 0); 28505 parentRect.left = Math.max(parentRect.left, 0); 28506 } 28507 var offsets = getClientRect({ 28508 top: childrenRect.top - parentRect.top - borderTopWidth, 28509 left: childrenRect.left - parentRect.left - borderLeftWidth, 28510 width: childrenRect.width, 28511 height: childrenRect.height 28512 }); 28513 offsets.marginTop = 0; 28514 offsets.marginLeft = 0; 28515 28516 // Subtract margins of documentElement in case it's being used as parent 28517 // we do this only on HTML because it's the only element that behaves 28518 // differently when margins are applied to it. The margins are included in 28519 // the box of the documentElement, in the other cases not. 28520 if (!isIE10 && isHTML) { 28521 var marginTop = parseFloat(styles.marginTop); 28522 var marginLeft = parseFloat(styles.marginLeft); 28523 28524 offsets.top -= borderTopWidth - marginTop; 28525 offsets.bottom -= borderTopWidth - marginTop; 28526 offsets.left -= borderLeftWidth - marginLeft; 28527 offsets.right -= borderLeftWidth - marginLeft; 28528 28529 // Attach marginTop and marginLeft because in some circumstances we may need them 28530 offsets.marginTop = marginTop; 28531 offsets.marginLeft = marginLeft; 28532 } 28533 28534 if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') { 28535 offsets = includeScroll(offsets, parent); 28536 } 28537 28538 return offsets; 28539} 28540 28541function getViewportOffsetRectRelativeToArtbitraryNode(element) { 28542 var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 28543 28544 var html = element.ownerDocument.documentElement; 28545 var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html); 28546 var width = Math.max(html.clientWidth, window.innerWidth || 0); 28547 var height = Math.max(html.clientHeight, window.innerHeight || 0); 28548 28549 var scrollTop = !excludeScroll ? getScroll(html) : 0; 28550 var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0; 28551 28552 var offset = { 28553 top: scrollTop - relativeOffset.top + relativeOffset.marginTop, 28554 left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft, 28555 width: width, 28556 height: height 28557 }; 28558 28559 return getClientRect(offset); 28560} 28561 28562/** 28563 * Check if the given element is fixed or is inside a fixed parent 28564 * @method 28565 * @memberof Popper.Utils 28566 * @argument {Element} element 28567 * @argument {Element} customContainer 28568 * @returns {Boolean} answer to "isFixed?" 28569 */ 28570function isFixed(element) { 28571 var nodeName = element.nodeName; 28572 if (nodeName === 'BODY' || nodeName === 'HTML') { 28573 return false; 28574 } 28575 if (getStyleComputedProperty(element, 'position') === 'fixed') { 28576 return true; 28577 } 28578 var parentNode = getParentNode(element); 28579 if (!parentNode) { 28580 return false; 28581 } 28582 return isFixed(parentNode); 28583} 28584 28585/** 28586 * Finds the first parent of an element that has a transformed property defined 28587 * @method 28588 * @memberof Popper.Utils 28589 * @argument {Element} element 28590 * @returns {Element} first transformed parent or documentElement 28591 */ 28592 28593function getFixedPositionOffsetParent(element) { 28594 // This check is needed to avoid errors in case one of the elements isn't defined for any reason 28595 if (!element || !element.parentElement || isIE()) { 28596 return document.documentElement; 28597 } 28598 var el = element.parentElement; 28599 while (el && getStyleComputedProperty(el, 'transform') === 'none') { 28600 el = el.parentElement; 28601 } 28602 return el || document.documentElement; 28603} 28604 28605/** 28606 * Computed the boundaries limits and return them 28607 * @method 28608 * @memberof Popper.Utils 28609 * @param {HTMLElement} popper 28610 * @param {HTMLElement} reference 28611 * @param {number} padding 28612 * @param {HTMLElement} boundariesElement - Element used to define the boundaries 28613 * @param {Boolean} fixedPosition - Is in fixed position mode 28614 * @returns {Object} Coordinates of the boundaries 28615 */ 28616function getBoundaries(popper, reference, padding, boundariesElement) { 28617 var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; 28618 28619 // NOTE: 1 DOM access here 28620 28621 var boundaries = { top: 0, left: 0 }; 28622 var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference)); 28623 28624 // Handle viewport case 28625 if (boundariesElement === 'viewport') { 28626 boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition); 28627 } else { 28628 // Handle other cases based on DOM element used as boundaries 28629 var boundariesNode = void 0; 28630 if (boundariesElement === 'scrollParent') { 28631 boundariesNode = getScrollParent(getParentNode(reference)); 28632 if (boundariesNode.nodeName === 'BODY') { 28633 boundariesNode = popper.ownerDocument.documentElement; 28634 } 28635 } else if (boundariesElement === 'window') { 28636 boundariesNode = popper.ownerDocument.documentElement; 28637 } else { 28638 boundariesNode = boundariesElement; 28639 } 28640 28641 var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition); 28642 28643 // In case of HTML, we need a different computation 28644 if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) { 28645 var _getWindowSizes = getWindowSizes(popper.ownerDocument), 28646 height = _getWindowSizes.height, 28647 width = _getWindowSizes.width; 28648 28649 boundaries.top += offsets.top - offsets.marginTop; 28650 boundaries.bottom = height + offsets.top; 28651 boundaries.left += offsets.left - offsets.marginLeft; 28652 boundaries.right = width + offsets.left; 28653 } else { 28654 // for all the other DOM elements, this one is good 28655 boundaries = offsets; 28656 } 28657 } 28658 28659 // Add paddings 28660 padding = padding || 0; 28661 var isPaddingNumber = typeof padding === 'number'; 28662 boundaries.left += isPaddingNumber ? padding : padding.left || 0; 28663 boundaries.top += isPaddingNumber ? padding : padding.top || 0; 28664 boundaries.right -= isPaddingNumber ? padding : padding.right || 0; 28665 boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0; 28666 28667 return boundaries; 28668} 28669 28670function getArea(_ref) { 28671 var width = _ref.width, 28672 height = _ref.height; 28673 28674 return width * height; 28675} 28676 28677/** 28678 * Utility used to transform the `auto` placement to the placement with more 28679 * available space. 28680 * @method 28681 * @memberof Popper.Utils 28682 * @argument {Object} data - The data object generated by update method 28683 * @argument {Object} options - Modifiers configuration and options 28684 * @returns {Object} The data object, properly modified 28685 */ 28686function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) { 28687 var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0; 28688 28689 if (placement.indexOf('auto') === -1) { 28690 return placement; 28691 } 28692 28693 var boundaries = getBoundaries(popper, reference, padding, boundariesElement); 28694 28695 var rects = { 28696 top: { 28697 width: boundaries.width, 28698 height: refRect.top - boundaries.top 28699 }, 28700 right: { 28701 width: boundaries.right - refRect.right, 28702 height: boundaries.height 28703 }, 28704 bottom: { 28705 width: boundaries.width, 28706 height: boundaries.bottom - refRect.bottom 28707 }, 28708 left: { 28709 width: refRect.left - boundaries.left, 28710 height: boundaries.height 28711 } 28712 }; 28713 28714 var sortedAreas = Object.keys(rects).map(function (key) { 28715 return _extends({ 28716 key: key 28717 }, rects[key], { 28718 area: getArea(rects[key]) 28719 }); 28720 }).sort(function (a, b) { 28721 return b.area - a.area; 28722 }); 28723 28724 var filteredAreas = sortedAreas.filter(function (_ref2) { 28725 var width = _ref2.width, 28726 height = _ref2.height; 28727 return width >= popper.clientWidth && height >= popper.clientHeight; 28728 }); 28729 28730 var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key; 28731 28732 var variation = placement.split('-')[1]; 28733 28734 return computedPlacement + (variation ? '-' + variation : ''); 28735} 28736 28737/** 28738 * Get offsets to the reference element 28739 * @method 28740 * @memberof Popper.Utils 28741 * @param {Object} state 28742 * @param {Element} popper - the popper element 28743 * @param {Element} reference - the reference element (the popper will be relative to this) 28744 * @param {Element} fixedPosition - is in fixed position mode 28745 * @returns {Object} An object containing the offsets which will be applied to the popper 28746 */ 28747function getReferenceOffsets(state, popper, reference) { 28748 var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; 28749 28750 var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference)); 28751 return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition); 28752} 28753 28754/** 28755 * Get the outer sizes of the given element (offset size + margins) 28756 * @method 28757 * @memberof Popper.Utils 28758 * @argument {Element} element 28759 * @returns {Object} object containing width and height properties 28760 */ 28761function getOuterSizes(element) { 28762 var window = element.ownerDocument.defaultView; 28763 var styles = window.getComputedStyle(element); 28764 var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0); 28765 var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0); 28766 var result = { 28767 width: element.offsetWidth + y, 28768 height: element.offsetHeight + x 28769 }; 28770 return result; 28771} 28772 28773/** 28774 * Get the opposite placement of the given one 28775 * @method 28776 * @memberof Popper.Utils 28777 * @argument {String} placement 28778 * @returns {String} flipped placement 28779 */ 28780function getOppositePlacement(placement) { 28781 var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' }; 28782 return placement.replace(/left|right|bottom|top/g, function (matched) { 28783 return hash[matched]; 28784 }); 28785} 28786 28787/** 28788 * Get offsets to the popper 28789 * @method 28790 * @memberof Popper.Utils 28791 * @param {Object} position - CSS position the Popper will get applied 28792 * @param {HTMLElement} popper - the popper element 28793 * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this) 28794 * @param {String} placement - one of the valid placement options 28795 * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper 28796 */ 28797function getPopperOffsets(popper, referenceOffsets, placement) { 28798 placement = placement.split('-')[0]; 28799 28800 // Get popper node sizes 28801 var popperRect = getOuterSizes(popper); 28802 28803 // Add position, width and height to our offsets object 28804 var popperOffsets = { 28805 width: popperRect.width, 28806 height: popperRect.height 28807 }; 28808 28809 // depending by the popper placement we have to compute its offsets slightly differently 28810 var isHoriz = ['right', 'left'].indexOf(placement) !== -1; 28811 var mainSide = isHoriz ? 'top' : 'left'; 28812 var secondarySide = isHoriz ? 'left' : 'top'; 28813 var measurement = isHoriz ? 'height' : 'width'; 28814 var secondaryMeasurement = !isHoriz ? 'height' : 'width'; 28815 28816 popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2; 28817 if (placement === secondarySide) { 28818 popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement]; 28819 } else { 28820 popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)]; 28821 } 28822 28823 return popperOffsets; 28824} 28825 28826/** 28827 * Mimics the `find` method of Array 28828 * @method 28829 * @memberof Popper.Utils 28830 * @argument {Array} arr 28831 * @argument prop 28832 * @argument value 28833 * @returns index or -1 28834 */ 28835function find(arr, check) { 28836 // use native find if supported 28837 if (Array.prototype.find) { 28838 return arr.find(check); 28839 } 28840 28841 // use `filter` to obtain the same behavior of `find` 28842 return arr.filter(check)[0]; 28843} 28844 28845/** 28846 * Return the index of the matching object 28847 * @method 28848 * @memberof Popper.Utils 28849 * @argument {Array} arr 28850 * @argument prop 28851 * @argument value 28852 * @returns index or -1 28853 */ 28854function findIndex(arr, prop, value) { 28855 // use native findIndex if supported 28856 if (Array.prototype.findIndex) { 28857 return arr.findIndex(function (cur) { 28858 return cur[prop] === value; 28859 }); 28860 } 28861 28862 // use `find` + `indexOf` if `findIndex` isn't supported 28863 var match = find(arr, function (obj) { 28864 return obj[prop] === value; 28865 }); 28866 return arr.indexOf(match); 28867} 28868 28869/** 28870 * Loop trough the list of modifiers and run them in order, 28871 * each of them will then edit the data object. 28872 * @method 28873 * @memberof Popper.Utils 28874 * @param {dataObject} data 28875 * @param {Array} modifiers 28876 * @param {String} ends - Optional modifier name used as stopper 28877 * @returns {dataObject} 28878 */ 28879function runModifiers(modifiers, data, ends) { 28880 var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends)); 28881 28882 modifiersToRun.forEach(function (modifier) { 28883 if (modifier['function']) { 28884 // eslint-disable-line dot-notation 28885 console.warn('`modifier.function` is deprecated, use `modifier.fn`!'); 28886 } 28887 var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation 28888 if (modifier.enabled && isFunction(fn)) { 28889 // Add properties to offsets to make them a complete clientRect object 28890 // we do this before each modifier to make sure the previous one doesn't 28891 // mess with these values 28892 data.offsets.popper = getClientRect(data.offsets.popper); 28893 data.offsets.reference = getClientRect(data.offsets.reference); 28894 28895 data = fn(data, modifier); 28896 } 28897 }); 28898 28899 return data; 28900} 28901 28902/** 28903 * Updates the position of the popper, computing the new offsets and applying 28904 * the new style.<br /> 28905 * Prefer `scheduleUpdate` over `update` because of performance reasons. 28906 * @method 28907 * @memberof Popper 28908 */ 28909function update() { 28910 // if popper is destroyed, don't perform any further update 28911 if (this.state.isDestroyed) { 28912 return; 28913 } 28914 28915 var data = { 28916 instance: this, 28917 styles: {}, 28918 arrowStyles: {}, 28919 attributes: {}, 28920 flipped: false, 28921 offsets: {} 28922 }; 28923 28924 // compute reference element offsets 28925 data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed); 28926 28927 // compute auto placement, store placement inside the data object, 28928 // modifiers will be able to edit `placement` if needed 28929 // and refer to originalPlacement to know the original value 28930 data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding); 28931 28932 // store the computed placement inside `originalPlacement` 28933 data.originalPlacement = data.placement; 28934 28935 data.positionFixed = this.options.positionFixed; 28936 28937 // compute the popper offsets 28938 data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement); 28939 28940 data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute'; 28941 28942 // run the modifiers 28943 data = runModifiers(this.modifiers, data); 28944 28945 // the first `update` will call `onCreate` callback 28946 // the other ones will call `onUpdate` callback 28947 if (!this.state.isCreated) { 28948 this.state.isCreated = true; 28949 this.options.onCreate(data); 28950 } else { 28951 this.options.onUpdate(data); 28952 } 28953} 28954 28955/** 28956 * Helper used to know if the given modifier is enabled. 28957 * @method 28958 * @memberof Popper.Utils 28959 * @returns {Boolean} 28960 */ 28961function isModifierEnabled(modifiers, modifierName) { 28962 return modifiers.some(function (_ref) { 28963 var name = _ref.name, 28964 enabled = _ref.enabled; 28965 return enabled && name === modifierName; 28966 }); 28967} 28968 28969/** 28970 * Get the prefixed supported property name 28971 * @method 28972 * @memberof Popper.Utils 28973 * @argument {String} property (camelCase) 28974 * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix) 28975 */ 28976function getSupportedPropertyName(property) { 28977 var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O']; 28978 var upperProp = property.charAt(0).toUpperCase() + property.slice(1); 28979 28980 for (var i = 0; i < prefixes.length; i++) { 28981 var prefix = prefixes[i]; 28982 var toCheck = prefix ? '' + prefix + upperProp : property; 28983 if (typeof document.body.style[toCheck] !== 'undefined') { 28984 return toCheck; 28985 } 28986 } 28987 return null; 28988} 28989 28990/** 28991 * Destroys the popper. 28992 * @method 28993 * @memberof Popper 28994 */ 28995function destroy() { 28996 this.state.isDestroyed = true; 28997 28998 // touch DOM only if `applyStyle` modifier is enabled 28999 if (isModifierEnabled(this.modifiers, 'applyStyle')) { 29000 this.popper.removeAttribute('x-placement'); 29001 this.popper.style.position = ''; 29002 this.popper.style.top = ''; 29003 this.popper.style.left = ''; 29004 this.popper.style.right = ''; 29005 this.popper.style.bottom = ''; 29006 this.popper.style.willChange = ''; 29007 this.popper.style[getSupportedPropertyName('transform')] = ''; 29008 } 29009 29010 this.disableEventListeners(); 29011 29012 // remove the popper if user explicitly asked for the deletion on destroy 29013 // do not use `remove` because IE11 doesn't support it 29014 if (this.options.removeOnDestroy) { 29015 this.popper.parentNode.removeChild(this.popper); 29016 } 29017 return this; 29018} 29019 29020/** 29021 * Get the window associated with the element 29022 * @argument {Element} element 29023 * @returns {Window} 29024 */ 29025function getWindow(element) { 29026 var ownerDocument = element.ownerDocument; 29027 return ownerDocument ? ownerDocument.defaultView : window; 29028} 29029 29030function attachToScrollParents(scrollParent, event, callback, scrollParents) { 29031 var isBody = scrollParent.nodeName === 'BODY'; 29032 var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent; 29033 target.addEventListener(event, callback, { passive: true }); 29034 29035 if (!isBody) { 29036 attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents); 29037 } 29038 scrollParents.push(target); 29039} 29040 29041/** 29042 * Setup needed event listeners used to update the popper position 29043 * @method 29044 * @memberof Popper.Utils 29045 * @private 29046 */ 29047function setupEventListeners(reference, options, state, updateBound) { 29048 // Resize event listener on window 29049 state.updateBound = updateBound; 29050 getWindow(reference).addEventListener('resize', state.updateBound, { passive: true }); 29051 29052 // Scroll event listener on scroll parents 29053 var scrollElement = getScrollParent(reference); 29054 attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents); 29055 state.scrollElement = scrollElement; 29056 state.eventsEnabled = true; 29057 29058 return state; 29059} 29060 29061/** 29062 * It will add resize/scroll events and start recalculating 29063 * position of the popper element when they are triggered. 29064 * @method 29065 * @memberof Popper 29066 */ 29067function enableEventListeners() { 29068 if (!this.state.eventsEnabled) { 29069 this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate); 29070 } 29071} 29072 29073/** 29074 * Remove event listeners used to update the popper position 29075 * @method 29076 * @memberof Popper.Utils 29077 * @private 29078 */ 29079function removeEventListeners(reference, state) { 29080 // Remove resize event listener on window 29081 getWindow(reference).removeEventListener('resize', state.updateBound); 29082 29083 // Remove scroll event listener on scroll parents 29084 state.scrollParents.forEach(function (target) { 29085 target.removeEventListener('scroll', state.updateBound); 29086 }); 29087 29088 // Reset state 29089 state.updateBound = null; 29090 state.scrollParents = []; 29091 state.scrollElement = null; 29092 state.eventsEnabled = false; 29093 return state; 29094} 29095 29096/** 29097 * It will remove resize/scroll events and won't recalculate popper position 29098 * when they are triggered. It also won't trigger `onUpdate` callback anymore, 29099 * unless you call `update` method manually. 29100 * @method 29101 * @memberof Popper 29102 */ 29103function disableEventListeners() { 29104 if (this.state.eventsEnabled) { 29105 cancelAnimationFrame(this.scheduleUpdate); 29106 this.state = removeEventListeners(this.reference, this.state); 29107 } 29108} 29109 29110/** 29111 * Tells if a given input is a number 29112 * @method 29113 * @memberof Popper.Utils 29114 * @param {*} input to check 29115 * @return {Boolean} 29116 */ 29117function isNumeric(n) { 29118 return n !== '' && !isNaN(parseFloat(n)) && isFinite(n); 29119} 29120 29121/** 29122 * Set the style to the given popper 29123 * @method 29124 * @memberof Popper.Utils 29125 * @argument {Element} element - Element to apply the style to 29126 * @argument {Object} styles 29127 * Object with a list of properties and values which will be applied to the element 29128 */ 29129function setStyles(element, styles) { 29130 Object.keys(styles).forEach(function (prop) { 29131 var unit = ''; 29132 // add unit if the value is numeric and is one of the following 29133 if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) { 29134 unit = 'px'; 29135 } 29136 element.style[prop] = styles[prop] + unit; 29137 }); 29138} 29139 29140/** 29141 * Set the attributes to the given popper 29142 * @method 29143 * @memberof Popper.Utils 29144 * @argument {Element} element - Element to apply the attributes to 29145 * @argument {Object} styles 29146 * Object with a list of properties and values which will be applied to the element 29147 */ 29148function setAttributes(element, attributes) { 29149 Object.keys(attributes).forEach(function (prop) { 29150 var value = attributes[prop]; 29151 if (value !== false) { 29152 element.setAttribute(prop, attributes[prop]); 29153 } else { 29154 element.removeAttribute(prop); 29155 } 29156 }); 29157} 29158 29159/** 29160 * @function 29161 * @memberof Modifiers 29162 * @argument {Object} data - The data object generated by `update` method 29163 * @argument {Object} data.styles - List of style properties - values to apply to popper element 29164 * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element 29165 * @argument {Object} options - Modifiers configuration and options 29166 * @returns {Object} The same data object 29167 */ 29168function applyStyle(data) { 29169 // any property present in `data.styles` will be applied to the popper, 29170 // in this way we can make the 3rd party modifiers add custom styles to it 29171 // Be aware, modifiers could override the properties defined in the previous 29172 // lines of this modifier! 29173 setStyles(data.instance.popper, data.styles); 29174 29175 // any property present in `data.attributes` will be applied to the popper, 29176 // they will be set as HTML attributes of the element 29177 setAttributes(data.instance.popper, data.attributes); 29178 29179 // if arrowElement is defined and arrowStyles has some properties 29180 if (data.arrowElement && Object.keys(data.arrowStyles).length) { 29181 setStyles(data.arrowElement, data.arrowStyles); 29182 } 29183 29184 return data; 29185} 29186 29187/** 29188 * Set the x-placement attribute before everything else because it could be used 29189 * to add margins to the popper margins needs to be calculated to get the 29190 * correct popper offsets. 29191 * @method 29192 * @memberof Popper.modifiers 29193 * @param {HTMLElement} reference - The reference element used to position the popper 29194 * @param {HTMLElement} popper - The HTML element used as popper 29195 * @param {Object} options - Popper.js options 29196 */ 29197function applyStyleOnLoad(reference, popper, options, modifierOptions, state) { 29198 // compute reference element offsets 29199 var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed); 29200 29201 // compute auto placement, store placement inside the data object, 29202 // modifiers will be able to edit `placement` if needed 29203 // and refer to originalPlacement to know the original value 29204 var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding); 29205 29206 popper.setAttribute('x-placement', placement); 29207 29208 // Apply `position` to popper before anything else because 29209 // without the position applied we can't guarantee correct computations 29210 setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' }); 29211 29212 return options; 29213} 29214 29215/** 29216 * @function 29217 * @memberof Popper.Utils 29218 * @argument {Object} data - The data object generated by `update` method 29219 * @argument {Boolean} shouldRound - If the offsets should be rounded at all 29220 * @returns {Object} The popper's position offsets rounded 29221 * 29222 * The tale of pixel-perfect positioning. It's still not 100% perfect, but as 29223 * good as it can be within reason. 29224 * Discussion here: https://github.com/FezVrasta/popper.js/pull/715 29225 * 29226 * Low DPI screens cause a popper to be blurry if not using full pixels (Safari 29227 * as well on High DPI screens). 29228 * 29229 * Firefox prefers no rounding for positioning and does not have blurriness on 29230 * high DPI screens. 29231 * 29232 * Only horizontal placement and left/right values need to be considered. 29233 */ 29234function getRoundedOffsets(data, shouldRound) { 29235 var _data$offsets = data.offsets, 29236 popper = _data$offsets.popper, 29237 reference = _data$offsets.reference; 29238 var round = Math.round, 29239 floor = Math.floor; 29240 29241 var noRound = function noRound(v) { 29242 return v; 29243 }; 29244 29245 var referenceWidth = round(reference.width); 29246 var popperWidth = round(popper.width); 29247 29248 var isVertical = ['left', 'right'].indexOf(data.placement) !== -1; 29249 var isVariation = data.placement.indexOf('-') !== -1; 29250 var sameWidthParity = referenceWidth % 2 === popperWidth % 2; 29251 var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1; 29252 29253 var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor; 29254 var verticalToInteger = !shouldRound ? noRound : round; 29255 29256 return { 29257 left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left), 29258 top: verticalToInteger(popper.top), 29259 bottom: verticalToInteger(popper.bottom), 29260 right: horizontalToInteger(popper.right) 29261 }; 29262} 29263 29264var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent); 29265 29266/** 29267 * @function 29268 * @memberof Modifiers 29269 * @argument {Object} data - The data object generated by `update` method 29270 * @argument {Object} options - Modifiers configuration and options 29271 * @returns {Object} The data object, properly modified 29272 */ 29273function computeStyle(data, options) { 29274 var x = options.x, 29275 y = options.y; 29276 var popper = data.offsets.popper; 29277 29278 // Remove this legacy support in Popper.js v2 29279 29280 var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) { 29281 return modifier.name === 'applyStyle'; 29282 }).gpuAcceleration; 29283 if (legacyGpuAccelerationOption !== undefined) { 29284 console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!'); 29285 } 29286 var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration; 29287 29288 var offsetParent = getOffsetParent(data.instance.popper); 29289 var offsetParentRect = getBoundingClientRect(offsetParent); 29290 29291 // Styles 29292 var styles = { 29293 position: popper.position 29294 }; 29295 29296 var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox); 29297 29298 var sideA = x === 'bottom' ? 'top' : 'bottom'; 29299 var sideB = y === 'right' ? 'left' : 'right'; 29300 29301 // if gpuAcceleration is set to `true` and transform is supported, 29302 // we use `translate3d` to apply the position to the popper we 29303 // automatically use the supported prefixed version if needed 29304 var prefixedProperty = getSupportedPropertyName('transform'); 29305 29306 // now, let's make a step back and look at this code closely (wtf?) 29307 // If the content of the popper grows once it's been positioned, it 29308 // may happen that the popper gets misplaced because of the new content 29309 // overflowing its reference element 29310 // To avoid this problem, we provide two options (x and y), which allow 29311 // the consumer to define the offset origin. 29312 // If we position a popper on top of a reference element, we can set 29313 // `x` to `top` to make the popper grow towards its top instead of 29314 // its bottom. 29315 var left = void 0, 29316 top = void 0; 29317 if (sideA === 'bottom') { 29318 // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar) 29319 // and not the bottom of the html element 29320 if (offsetParent.nodeName === 'HTML') { 29321 top = -offsetParent.clientHeight + offsets.bottom; 29322 } else { 29323 top = -offsetParentRect.height + offsets.bottom; 29324 } 29325 } else { 29326 top = offsets.top; 29327 } 29328 if (sideB === 'right') { 29329 if (offsetParent.nodeName === 'HTML') { 29330 left = -offsetParent.clientWidth + offsets.right; 29331 } else { 29332 left = -offsetParentRect.width + offsets.right; 29333 } 29334 } else { 29335 left = offsets.left; 29336 } 29337 if (gpuAcceleration && prefixedProperty) { 29338 styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)'; 29339 styles[sideA] = 0; 29340 styles[sideB] = 0; 29341 styles.willChange = 'transform'; 29342 } else { 29343 // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties 29344 var invertTop = sideA === 'bottom' ? -1 : 1; 29345 var invertLeft = sideB === 'right' ? -1 : 1; 29346 styles[sideA] = top * invertTop; 29347 styles[sideB] = left * invertLeft; 29348 styles.willChange = sideA + ', ' + sideB; 29349 } 29350 29351 // Attributes 29352 var attributes = { 29353 'x-placement': data.placement 29354 }; 29355 29356 // Update `data` attributes, styles and arrowStyles 29357 data.attributes = _extends({}, attributes, data.attributes); 29358 data.styles = _extends({}, styles, data.styles); 29359 data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles); 29360 29361 return data; 29362} 29363 29364/** 29365 * Helper used to know if the given modifier depends from another one.<br /> 29366 * It checks if the needed modifier is listed and enabled. 29367 * @method 29368 * @memberof Popper.Utils 29369 * @param {Array} modifiers - list of modifiers 29370 * @param {String} requestingName - name of requesting modifier 29371 * @param {String} requestedName - name of requested modifier 29372 * @returns {Boolean} 29373 */ 29374function isModifierRequired(modifiers, requestingName, requestedName) { 29375 var requesting = find(modifiers, function (_ref) { 29376 var name = _ref.name; 29377 return name === requestingName; 29378 }); 29379 29380 var isRequired = !!requesting && modifiers.some(function (modifier) { 29381 return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order; 29382 }); 29383 29384 if (!isRequired) { 29385 var _requesting = '`' + requestingName + '`'; 29386 var requested = '`' + requestedName + '`'; 29387 console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!'); 29388 } 29389 return isRequired; 29390} 29391 29392/** 29393 * @function 29394 * @memberof Modifiers 29395 * @argument {Object} data - The data object generated by update method 29396 * @argument {Object} options - Modifiers configuration and options 29397 * @returns {Object} The data object, properly modified 29398 */ 29399function arrow(data, options) { 29400 var _data$offsets$arrow; 29401 29402 // arrow depends on keepTogether in order to work 29403 if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) { 29404 return data; 29405 } 29406 29407 var arrowElement = options.element; 29408 29409 // if arrowElement is a string, suppose it's a CSS selector 29410 if (typeof arrowElement === 'string') { 29411 arrowElement = data.instance.popper.querySelector(arrowElement); 29412 29413 // if arrowElement is not found, don't run the modifier 29414 if (!arrowElement) { 29415 return data; 29416 } 29417 } else { 29418 // if the arrowElement isn't a query selector we must check that the 29419 // provided DOM node is child of its popper node 29420 if (!data.instance.popper.contains(arrowElement)) { 29421 console.warn('WARNING: `arrow.element` must be child of its popper element!'); 29422 return data; 29423 } 29424 } 29425 29426 var placement = data.placement.split('-')[0]; 29427 var _data$offsets = data.offsets, 29428 popper = _data$offsets.popper, 29429 reference = _data$offsets.reference; 29430 29431 var isVertical = ['left', 'right'].indexOf(placement) !== -1; 29432 29433 var len = isVertical ? 'height' : 'width'; 29434 var sideCapitalized = isVertical ? 'Top' : 'Left'; 29435 var side = sideCapitalized.toLowerCase(); 29436 var altSide = isVertical ? 'left' : 'top'; 29437 var opSide = isVertical ? 'bottom' : 'right'; 29438 var arrowElementSize = getOuterSizes(arrowElement)[len]; 29439 29440 // 29441 // extends keepTogether behavior making sure the popper and its 29442 // reference have enough pixels in conjunction 29443 // 29444 29445 // top/left side 29446 if (reference[opSide] - arrowElementSize < popper[side]) { 29447 data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize); 29448 } 29449 // bottom/right side 29450 if (reference[side] + arrowElementSize > popper[opSide]) { 29451 data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide]; 29452 } 29453 data.offsets.popper = getClientRect(data.offsets.popper); 29454 29455 // compute center of the popper 29456 var center = reference[side] + reference[len] / 2 - arrowElementSize / 2; 29457 29458 // Compute the sideValue using the updated popper offsets 29459 // take popper margin in account because we don't have this info available 29460 var css = getStyleComputedProperty(data.instance.popper); 29461 var popperMarginSide = parseFloat(css['margin' + sideCapitalized]); 29462 var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']); 29463 var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide; 29464 29465 // prevent arrowElement from being placed not contiguously to its popper 29466 sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0); 29467 29468 data.arrowElement = arrowElement; 29469 data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow); 29470 29471 return data; 29472} 29473 29474/** 29475 * Get the opposite placement variation of the given one 29476 * @method 29477 * @memberof Popper.Utils 29478 * @argument {String} placement variation 29479 * @returns {String} flipped placement variation 29480 */ 29481function getOppositeVariation(variation) { 29482 if (variation === 'end') { 29483 return 'start'; 29484 } else if (variation === 'start') { 29485 return 'end'; 29486 } 29487 return variation; 29488} 29489 29490/** 29491 * List of accepted placements to use as values of the `placement` option.<br /> 29492 * Valid placements are: 29493 * - `auto` 29494 * - `top` 29495 * - `right` 29496 * - `bottom` 29497 * - `left` 29498 * 29499 * Each placement can have a variation from this list: 29500 * - `-start` 29501 * - `-end` 29502 * 29503 * Variations are interpreted easily if you think of them as the left to right 29504 * written languages. Horizontally (`top` and `bottom`), `start` is left and `end` 29505 * is right.<br /> 29506 * Vertically (`left` and `right`), `start` is top and `end` is bottom. 29507 * 29508 * Some valid examples are: 29509 * - `top-end` (on top of reference, right aligned) 29510 * - `right-start` (on right of reference, top aligned) 29511 * - `bottom` (on bottom, centered) 29512 * - `auto-end` (on the side with more space available, alignment depends by placement) 29513 * 29514 * @static 29515 * @type {Array} 29516 * @enum {String} 29517 * @readonly 29518 * @method placements 29519 * @memberof Popper 29520 */ 29521var placements = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start']; 29522 29523// Get rid of `auto` `auto-start` and `auto-end` 29524var validPlacements = placements.slice(3); 29525 29526/** 29527 * Given an initial placement, returns all the subsequent placements 29528 * clockwise (or counter-clockwise). 29529 * 29530 * @method 29531 * @memberof Popper.Utils 29532 * @argument {String} placement - A valid placement (it accepts variations) 29533 * @argument {Boolean} counter - Set to true to walk the placements counterclockwise 29534 * @returns {Array} placements including their variations 29535 */ 29536function clockwise(placement) { 29537 var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 29538 29539 var index = validPlacements.indexOf(placement); 29540 var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index)); 29541 return counter ? arr.reverse() : arr; 29542} 29543 29544var BEHAVIORS = { 29545 FLIP: 'flip', 29546 CLOCKWISE: 'clockwise', 29547 COUNTERCLOCKWISE: 'counterclockwise' 29548}; 29549 29550/** 29551 * @function 29552 * @memberof Modifiers 29553 * @argument {Object} data - The data object generated by update method 29554 * @argument {Object} options - Modifiers configuration and options 29555 * @returns {Object} The data object, properly modified 29556 */ 29557function flip(data, options) { 29558 // if `inner` modifier is enabled, we can't use the `flip` modifier 29559 if (isModifierEnabled(data.instance.modifiers, 'inner')) { 29560 return data; 29561 } 29562 29563 if (data.flipped && data.placement === data.originalPlacement) { 29564 // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides 29565 return data; 29566 } 29567 29568 var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed); 29569 29570 var placement = data.placement.split('-')[0]; 29571 var placementOpposite = getOppositePlacement(placement); 29572 var variation = data.placement.split('-')[1] || ''; 29573 29574 var flipOrder = []; 29575 29576 switch (options.behavior) { 29577 case BEHAVIORS.FLIP: 29578 flipOrder = [placement, placementOpposite]; 29579 break; 29580 case BEHAVIORS.CLOCKWISE: 29581 flipOrder = clockwise(placement); 29582 break; 29583 case BEHAVIORS.COUNTERCLOCKWISE: 29584 flipOrder = clockwise(placement, true); 29585 break; 29586 default: 29587 flipOrder = options.behavior; 29588 } 29589 29590 flipOrder.forEach(function (step, index) { 29591 if (placement !== step || flipOrder.length === index + 1) { 29592 return data; 29593 } 29594 29595 placement = data.placement.split('-')[0]; 29596 placementOpposite = getOppositePlacement(placement); 29597 29598 var popperOffsets = data.offsets.popper; 29599 var refOffsets = data.offsets.reference; 29600 29601 // using floor because the reference offsets may contain decimals we are not going to consider here 29602 var floor = Math.floor; 29603 var overlapsRef = placement === 'left' && floor(popperOffsets.right) > floor(refOffsets.left) || placement === 'right' && floor(popperOffsets.left) < floor(refOffsets.right) || placement === 'top' && floor(popperOffsets.bottom) > floor(refOffsets.top) || placement === 'bottom' && floor(popperOffsets.top) < floor(refOffsets.bottom); 29604 29605 var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left); 29606 var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right); 29607 var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top); 29608 var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom); 29609 29610 var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom; 29611 29612 // flip the variation if required 29613 var isVertical = ['top', 'bottom'].indexOf(placement) !== -1; 29614 29615 // flips variation if reference element overflows boundaries 29616 var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom); 29617 29618 // flips variation if popper content overflows boundaries 29619 var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop); 29620 29621 var flippedVariation = flippedVariationByRef || flippedVariationByContent; 29622 29623 if (overlapsRef || overflowsBoundaries || flippedVariation) { 29624 // this boolean to detect any flip loop 29625 data.flipped = true; 29626 29627 if (overlapsRef || overflowsBoundaries) { 29628 placement = flipOrder[index + 1]; 29629 } 29630 29631 if (flippedVariation) { 29632 variation = getOppositeVariation(variation); 29633 } 29634 29635 data.placement = placement + (variation ? '-' + variation : ''); 29636 29637 // this object contains `position`, we want to preserve it along with 29638 // any additional property we may add in the future 29639 data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement)); 29640 29641 data = runModifiers(data.instance.modifiers, data, 'flip'); 29642 } 29643 }); 29644 return data; 29645} 29646 29647/** 29648 * @function 29649 * @memberof Modifiers 29650 * @argument {Object} data - The data object generated by update method 29651 * @argument {Object} options - Modifiers configuration and options 29652 * @returns {Object} The data object, properly modified 29653 */ 29654function keepTogether(data) { 29655 var _data$offsets = data.offsets, 29656 popper = _data$offsets.popper, 29657 reference = _data$offsets.reference; 29658 29659 var placement = data.placement.split('-')[0]; 29660 var floor = Math.floor; 29661 var isVertical = ['top', 'bottom'].indexOf(placement) !== -1; 29662 var side = isVertical ? 'right' : 'bottom'; 29663 var opSide = isVertical ? 'left' : 'top'; 29664 var measurement = isVertical ? 'width' : 'height'; 29665 29666 if (popper[side] < floor(reference[opSide])) { 29667 data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement]; 29668 } 29669 if (popper[opSide] > floor(reference[side])) { 29670 data.offsets.popper[opSide] = floor(reference[side]); 29671 } 29672 29673 return data; 29674} 29675 29676/** 29677 * Converts a string containing value + unit into a px value number 29678 * @function 29679 * @memberof {modifiers~offset} 29680 * @private 29681 * @argument {String} str - Value + unit string 29682 * @argument {String} measurement - `height` or `width` 29683 * @argument {Object} popperOffsets 29684 * @argument {Object} referenceOffsets 29685 * @returns {Number|String} 29686 * Value in pixels, or original string if no values were extracted 29687 */ 29688function toValue(str, measurement, popperOffsets, referenceOffsets) { 29689 // separate value from unit 29690 var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/); 29691 var value = +split[1]; 29692 var unit = split[2]; 29693 29694 // If it's not a number it's an operator, I guess 29695 if (!value) { 29696 return str; 29697 } 29698 29699 if (unit.indexOf('%') === 0) { 29700 var element = void 0; 29701 switch (unit) { 29702 case '%p': 29703 element = popperOffsets; 29704 break; 29705 case '%': 29706 case '%r': 29707 default: 29708 element = referenceOffsets; 29709 } 29710 29711 var rect = getClientRect(element); 29712 return rect[measurement] / 100 * value; 29713 } else if (unit === 'vh' || unit === 'vw') { 29714 // if is a vh or vw, we calculate the size based on the viewport 29715 var size = void 0; 29716 if (unit === 'vh') { 29717 size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); 29718 } else { 29719 size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); 29720 } 29721 return size / 100 * value; 29722 } else { 29723 // if is an explicit pixel unit, we get rid of the unit and keep the value 29724 // if is an implicit unit, it's px, and we return just the value 29725 return value; 29726 } 29727} 29728 29729/** 29730 * Parse an `offset` string to extrapolate `x` and `y` numeric offsets. 29731 * @function 29732 * @memberof {modifiers~offset} 29733 * @private 29734 * @argument {String} offset 29735 * @argument {Object} popperOffsets 29736 * @argument {Object} referenceOffsets 29737 * @argument {String} basePlacement 29738 * @returns {Array} a two cells array with x and y offsets in numbers 29739 */ 29740function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) { 29741 var offsets = [0, 0]; 29742 29743 // Use height if placement is left or right and index is 0 otherwise use width 29744 // in this way the first offset will use an axis and the second one 29745 // will use the other one 29746 var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1; 29747 29748 // Split the offset string to obtain a list of values and operands 29749 // The regex addresses values with the plus or minus sign in front (+10, -20, etc) 29750 var fragments = offset.split(/(\+|\-)/).map(function (frag) { 29751 return frag.trim(); 29752 }); 29753 29754 // Detect if the offset string contains a pair of values or a single one 29755 // they could be separated by comma or space 29756 var divider = fragments.indexOf(find(fragments, function (frag) { 29757 return frag.search(/,|\s/) !== -1; 29758 })); 29759 29760 if (fragments[divider] && fragments[divider].indexOf(',') === -1) { 29761 console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.'); 29762 } 29763 29764 // If divider is found, we divide the list of values and operands to divide 29765 // them by ofset X and Y. 29766 var splitRegex = /\s*,\s*|\s+/; 29767 var ops = divider !== -1 ? [fragments.slice(0, divider).concat([fragments[divider].split(splitRegex)[0]]), [fragments[divider].split(splitRegex)[1]].concat(fragments.slice(divider + 1))] : [fragments]; 29768 29769 // Convert the values with units to absolute pixels to allow our computations 29770 ops = ops.map(function (op, index) { 29771 // Most of the units rely on the orientation of the popper 29772 var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width'; 29773 var mergeWithPrevious = false; 29774 return op 29775 // This aggregates any `+` or `-` sign that aren't considered operators 29776 // e.g.: 10 + +5 => [10, +, +5] 29777 .reduce(function (a, b) { 29778 if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) { 29779 a[a.length - 1] = b; 29780 mergeWithPrevious = true; 29781 return a; 29782 } else if (mergeWithPrevious) { 29783 a[a.length - 1] += b; 29784 mergeWithPrevious = false; 29785 return a; 29786 } else { 29787 return a.concat(b); 29788 } 29789 }, []) 29790 // Here we convert the string values into number values (in px) 29791 .map(function (str) { 29792 return toValue(str, measurement, popperOffsets, referenceOffsets); 29793 }); 29794 }); 29795 29796 // Loop trough the offsets arrays and execute the operations 29797 ops.forEach(function (op, index) { 29798 op.forEach(function (frag, index2) { 29799 if (isNumeric(frag)) { 29800 offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1); 29801 } 29802 }); 29803 }); 29804 return offsets; 29805} 29806 29807/** 29808 * @function 29809 * @memberof Modifiers 29810 * @argument {Object} data - The data object generated by update method 29811 * @argument {Object} options - Modifiers configuration and options 29812 * @argument {Number|String} options.offset=0 29813 * The offset value as described in the modifier description 29814 * @returns {Object} The data object, properly modified 29815 */ 29816function offset(data, _ref) { 29817 var offset = _ref.offset; 29818 var placement = data.placement, 29819 _data$offsets = data.offsets, 29820 popper = _data$offsets.popper, 29821 reference = _data$offsets.reference; 29822 29823 var basePlacement = placement.split('-')[0]; 29824 29825 var offsets = void 0; 29826 if (isNumeric(+offset)) { 29827 offsets = [+offset, 0]; 29828 } else { 29829 offsets = parseOffset(offset, popper, reference, basePlacement); 29830 } 29831 29832 if (basePlacement === 'left') { 29833 popper.top += offsets[0]; 29834 popper.left -= offsets[1]; 29835 } else if (basePlacement === 'right') { 29836 popper.top += offsets[0]; 29837 popper.left += offsets[1]; 29838 } else if (basePlacement === 'top') { 29839 popper.left += offsets[0]; 29840 popper.top -= offsets[1]; 29841 } else if (basePlacement === 'bottom') { 29842 popper.left += offsets[0]; 29843 popper.top += offsets[1]; 29844 } 29845 29846 data.popper = popper; 29847 return data; 29848} 29849 29850/** 29851 * @function 29852 * @memberof Modifiers 29853 * @argument {Object} data - The data object generated by `update` method 29854 * @argument {Object} options - Modifiers configuration and options 29855 * @returns {Object} The data object, properly modified 29856 */ 29857function preventOverflow(data, options) { 29858 var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper); 29859 29860 // If offsetParent is the reference element, we really want to 29861 // go one step up and use the next offsetParent as reference to 29862 // avoid to make this modifier completely useless and look like broken 29863 if (data.instance.reference === boundariesElement) { 29864 boundariesElement = getOffsetParent(boundariesElement); 29865 } 29866 29867 // NOTE: DOM access here 29868 // resets the popper's position so that the document size can be calculated excluding 29869 // the size of the popper element itself 29870 var transformProp = getSupportedPropertyName('transform'); 29871 var popperStyles = data.instance.popper.style; // assignment to help minification 29872 var top = popperStyles.top, 29873 left = popperStyles.left, 29874 transform = popperStyles[transformProp]; 29875 29876 popperStyles.top = ''; 29877 popperStyles.left = ''; 29878 popperStyles[transformProp] = ''; 29879 29880 var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed); 29881 29882 // NOTE: DOM access here 29883 // restores the original style properties after the offsets have been computed 29884 popperStyles.top = top; 29885 popperStyles.left = left; 29886 popperStyles[transformProp] = transform; 29887 29888 options.boundaries = boundaries; 29889 29890 var order = options.priority; 29891 var popper = data.offsets.popper; 29892 29893 var check = { 29894 primary: function primary(placement) { 29895 var value = popper[placement]; 29896 if (popper[placement] < boundaries[placement] && !options.escapeWithReference) { 29897 value = Math.max(popper[placement], boundaries[placement]); 29898 } 29899 return defineProperty({}, placement, value); 29900 }, 29901 secondary: function secondary(placement) { 29902 var mainSide = placement === 'right' ? 'left' : 'top'; 29903 var value = popper[mainSide]; 29904 if (popper[placement] > boundaries[placement] && !options.escapeWithReference) { 29905 value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height)); 29906 } 29907 return defineProperty({}, mainSide, value); 29908 } 29909 }; 29910 29911 order.forEach(function (placement) { 29912 var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary'; 29913 popper = _extends({}, popper, check[side](placement)); 29914 }); 29915 29916 data.offsets.popper = popper; 29917 29918 return data; 29919} 29920 29921/** 29922 * @function 29923 * @memberof Modifiers 29924 * @argument {Object} data - The data object generated by `update` method 29925 * @argument {Object} options - Modifiers configuration and options 29926 * @returns {Object} The data object, properly modified 29927 */ 29928function shift(data) { 29929 var placement = data.placement; 29930 var basePlacement = placement.split('-')[0]; 29931 var shiftvariation = placement.split('-')[1]; 29932 29933 // if shift shiftvariation is specified, run the modifier 29934 if (shiftvariation) { 29935 var _data$offsets = data.offsets, 29936 reference = _data$offsets.reference, 29937 popper = _data$offsets.popper; 29938 29939 var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1; 29940 var side = isVertical ? 'left' : 'top'; 29941 var measurement = isVertical ? 'width' : 'height'; 29942 29943 var shiftOffsets = { 29944 start: defineProperty({}, side, reference[side]), 29945 end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement]) 29946 }; 29947 29948 data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]); 29949 } 29950 29951 return data; 29952} 29953 29954/** 29955 * @function 29956 * @memberof Modifiers 29957 * @argument {Object} data - The data object generated by update method 29958 * @argument {Object} options - Modifiers configuration and options 29959 * @returns {Object} The data object, properly modified 29960 */ 29961function hide(data) { 29962 if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) { 29963 return data; 29964 } 29965 29966 var refRect = data.offsets.reference; 29967 var bound = find(data.instance.modifiers, function (modifier) { 29968 return modifier.name === 'preventOverflow'; 29969 }).boundaries; 29970 29971 if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) { 29972 // Avoid unnecessary DOM access if visibility hasn't changed 29973 if (data.hide === true) { 29974 return data; 29975 } 29976 29977 data.hide = true; 29978 data.attributes['x-out-of-boundaries'] = ''; 29979 } else { 29980 // Avoid unnecessary DOM access if visibility hasn't changed 29981 if (data.hide === false) { 29982 return data; 29983 } 29984 29985 data.hide = false; 29986 data.attributes['x-out-of-boundaries'] = false; 29987 } 29988 29989 return data; 29990} 29991 29992/** 29993 * @function 29994 * @memberof Modifiers 29995 * @argument {Object} data - The data object generated by `update` method 29996 * @argument {Object} options - Modifiers configuration and options 29997 * @returns {Object} The data object, properly modified 29998 */ 29999function inner(data) { 30000 var placement = data.placement; 30001 var basePlacement = placement.split('-')[0]; 30002 var _data$offsets = data.offsets, 30003 popper = _data$offsets.popper, 30004 reference = _data$offsets.reference; 30005 30006 var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1; 30007 30008 var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1; 30009 30010 popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0); 30011 30012 data.placement = getOppositePlacement(placement); 30013 data.offsets.popper = getClientRect(popper); 30014 30015 return data; 30016} 30017 30018/** 30019 * Modifier function, each modifier can have a function of this type assigned 30020 * to its `fn` property.<br /> 30021 * These functions will be called on each update, this means that you must 30022 * make sure they are performant enough to avoid performance bottlenecks. 30023 * 30024 * @function ModifierFn 30025 * @argument {dataObject} data - The data object generated by `update` method 30026 * @argument {Object} options - Modifiers configuration and options 30027 * @returns {dataObject} The data object, properly modified 30028 */ 30029 30030/** 30031 * Modifiers are plugins used to alter the behavior of your poppers.<br /> 30032 * Popper.js uses a set of 9 modifiers to provide all the basic functionalities 30033 * needed by the library. 30034 * 30035 * Usually you don't want to override the `order`, `fn` and `onLoad` props. 30036 * All the other properties are configurations that could be tweaked. 30037 * @namespace modifiers 30038 */ 30039var modifiers = { 30040 /** 30041 * Modifier used to shift the popper on the start or end of its reference 30042 * element.<br /> 30043 * It will read the variation of the `placement` property.<br /> 30044 * It can be one either `-end` or `-start`. 30045 * @memberof modifiers 30046 * @inner 30047 */ 30048 shift: { 30049 /** @prop {number} order=100 - Index used to define the order of execution */ 30050 order: 100, 30051 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 30052 enabled: true, 30053 /** @prop {ModifierFn} */ 30054 fn: shift 30055 }, 30056 30057 /** 30058 * The `offset` modifier can shift your popper on both its axis. 30059 * 30060 * It accepts the following units: 30061 * - `px` or unit-less, interpreted as pixels 30062 * - `%` or `%r`, percentage relative to the length of the reference element 30063 * - `%p`, percentage relative to the length of the popper element 30064 * - `vw`, CSS viewport width unit 30065 * - `vh`, CSS viewport height unit 30066 * 30067 * For length is intended the main axis relative to the placement of the popper.<br /> 30068 * This means that if the placement is `top` or `bottom`, the length will be the 30069 * `width`. In case of `left` or `right`, it will be the `height`. 30070 * 30071 * You can provide a single value (as `Number` or `String`), or a pair of values 30072 * as `String` divided by a comma or one (or more) white spaces.<br /> 30073 * The latter is a deprecated method because it leads to confusion and will be 30074 * removed in v2.<br /> 30075 * Additionally, it accepts additions and subtractions between different units. 30076 * Note that multiplications and divisions aren't supported. 30077 * 30078 * Valid examples are: 30079 * ``` 30080 * 10 30081 * '10%' 30082 * '10, 10' 30083 * '10%, 10' 30084 * '10 + 10%' 30085 * '10 - 5vh + 3%' 30086 * '-10px + 5vh, 5px - 6%' 30087 * ``` 30088 * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap 30089 * > with their reference element, unfortunately, you will have to disable the `flip` modifier. 30090 * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373). 30091 * 30092 * @memberof modifiers 30093 * @inner 30094 */ 30095 offset: { 30096 /** @prop {number} order=200 - Index used to define the order of execution */ 30097 order: 200, 30098 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 30099 enabled: true, 30100 /** @prop {ModifierFn} */ 30101 fn: offset, 30102 /** @prop {Number|String} offset=0 30103 * The offset value as described in the modifier description 30104 */ 30105 offset: 0 30106 }, 30107 30108 /** 30109 * Modifier used to prevent the popper from being positioned outside the boundary. 30110 * 30111 * A scenario exists where the reference itself is not within the boundaries.<br /> 30112 * We can say it has "escaped the boundaries" — or just "escaped".<br /> 30113 * In this case we need to decide whether the popper should either: 30114 * 30115 * - detach from the reference and remain "trapped" in the boundaries, or 30116 * - if it should ignore the boundary and "escape with its reference" 30117 * 30118 * When `escapeWithReference` is set to`true` and reference is completely 30119 * outside its boundaries, the popper will overflow (or completely leave) 30120 * the boundaries in order to remain attached to the edge of the reference. 30121 * 30122 * @memberof modifiers 30123 * @inner 30124 */ 30125 preventOverflow: { 30126 /** @prop {number} order=300 - Index used to define the order of execution */ 30127 order: 300, 30128 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 30129 enabled: true, 30130 /** @prop {ModifierFn} */ 30131 fn: preventOverflow, 30132 /** 30133 * @prop {Array} [priority=['left','right','top','bottom']] 30134 * Popper will try to prevent overflow following these priorities by default, 30135 * then, it could overflow on the left and on top of the `boundariesElement` 30136 */ 30137 priority: ['left', 'right', 'top', 'bottom'], 30138 /** 30139 * @prop {number} padding=5 30140 * Amount of pixel used to define a minimum distance between the boundaries 30141 * and the popper. This makes sure the popper always has a little padding 30142 * between the edges of its container 30143 */ 30144 padding: 5, 30145 /** 30146 * @prop {String|HTMLElement} boundariesElement='scrollParent' 30147 * Boundaries used by the modifier. Can be `scrollParent`, `window`, 30148 * `viewport` or any DOM element. 30149 */ 30150 boundariesElement: 'scrollParent' 30151 }, 30152 30153 /** 30154 * Modifier used to make sure the reference and its popper stay near each other 30155 * without leaving any gap between the two. Especially useful when the arrow is 30156 * enabled and you want to ensure that it points to its reference element. 30157 * It cares only about the first axis. You can still have poppers with margin 30158 * between the popper and its reference element. 30159 * @memberof modifiers 30160 * @inner 30161 */ 30162 keepTogether: { 30163 /** @prop {number} order=400 - Index used to define the order of execution */ 30164 order: 400, 30165 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 30166 enabled: true, 30167 /** @prop {ModifierFn} */ 30168 fn: keepTogether 30169 }, 30170 30171 /** 30172 * This modifier is used to move the `arrowElement` of the popper to make 30173 * sure it is positioned between the reference element and its popper element. 30174 * It will read the outer size of the `arrowElement` node to detect how many 30175 * pixels of conjunction are needed. 30176 * 30177 * It has no effect if no `arrowElement` is provided. 30178 * @memberof modifiers 30179 * @inner 30180 */ 30181 arrow: { 30182 /** @prop {number} order=500 - Index used to define the order of execution */ 30183 order: 500, 30184 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 30185 enabled: true, 30186 /** @prop {ModifierFn} */ 30187 fn: arrow, 30188 /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */ 30189 element: '[x-arrow]' 30190 }, 30191 30192 /** 30193 * Modifier used to flip the popper's placement when it starts to overlap its 30194 * reference element. 30195 * 30196 * Requires the `preventOverflow` modifier before it in order to work. 30197 * 30198 * **NOTE:** this modifier will interrupt the current update cycle and will 30199 * restart it if it detects the need to flip the placement. 30200 * @memberof modifiers 30201 * @inner 30202 */ 30203 flip: { 30204 /** @prop {number} order=600 - Index used to define the order of execution */ 30205 order: 600, 30206 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 30207 enabled: true, 30208 /** @prop {ModifierFn} */ 30209 fn: flip, 30210 /** 30211 * @prop {String|Array} behavior='flip' 30212 * The behavior used to change the popper's placement. It can be one of 30213 * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid 30214 * placements (with optional variations) 30215 */ 30216 behavior: 'flip', 30217 /** 30218 * @prop {number} padding=5 30219 * The popper will flip if it hits the edges of the `boundariesElement` 30220 */ 30221 padding: 5, 30222 /** 30223 * @prop {String|HTMLElement} boundariesElement='viewport' 30224 * The element which will define the boundaries of the popper position. 30225 * The popper will never be placed outside of the defined boundaries 30226 * (except if `keepTogether` is enabled) 30227 */ 30228 boundariesElement: 'viewport', 30229 /** 30230 * @prop {Boolean} flipVariations=false 30231 * The popper will switch placement variation between `-start` and `-end` when 30232 * the reference element overlaps its boundaries. 30233 * 30234 * The original placement should have a set variation. 30235 */ 30236 flipVariations: false, 30237 /** 30238 * @prop {Boolean} flipVariationsByContent=false 30239 * The popper will switch placement variation between `-start` and `-end` when 30240 * the popper element overlaps its reference boundaries. 30241 * 30242 * The original placement should have a set variation. 30243 */ 30244 flipVariationsByContent: false 30245 }, 30246 30247 /** 30248 * Modifier used to make the popper flow toward the inner of the reference element. 30249 * By default, when this modifier is disabled, the popper will be placed outside 30250 * the reference element. 30251 * @memberof modifiers 30252 * @inner 30253 */ 30254 inner: { 30255 /** @prop {number} order=700 - Index used to define the order of execution */ 30256 order: 700, 30257 /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */ 30258 enabled: false, 30259 /** @prop {ModifierFn} */ 30260 fn: inner 30261 }, 30262 30263 /** 30264 * Modifier used to hide the popper when its reference element is outside of the 30265 * popper boundaries. It will set a `x-out-of-boundaries` attribute which can 30266 * be used to hide with a CSS selector the popper when its reference is 30267 * out of boundaries. 30268 * 30269 * Requires the `preventOverflow` modifier before it in order to work. 30270 * @memberof modifiers 30271 * @inner 30272 */ 30273 hide: { 30274 /** @prop {number} order=800 - Index used to define the order of execution */ 30275 order: 800, 30276 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 30277 enabled: true, 30278 /** @prop {ModifierFn} */ 30279 fn: hide 30280 }, 30281 30282 /** 30283 * Computes the style that will be applied to the popper element to gets 30284 * properly positioned. 30285 * 30286 * Note that this modifier will not touch the DOM, it just prepares the styles 30287 * so that `applyStyle` modifier can apply it. This separation is useful 30288 * in case you need to replace `applyStyle` with a custom implementation. 30289 * 30290 * This modifier has `850` as `order` value to maintain backward compatibility 30291 * with previous versions of Popper.js. Expect the modifiers ordering method 30292 * to change in future major versions of the library. 30293 * 30294 * @memberof modifiers 30295 * @inner 30296 */ 30297 computeStyle: { 30298 /** @prop {number} order=850 - Index used to define the order of execution */ 30299 order: 850, 30300 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 30301 enabled: true, 30302 /** @prop {ModifierFn} */ 30303 fn: computeStyle, 30304 /** 30305 * @prop {Boolean} gpuAcceleration=true 30306 * If true, it uses the CSS 3D transformation to position the popper. 30307 * Otherwise, it will use the `top` and `left` properties 30308 */ 30309 gpuAcceleration: true, 30310 /** 30311 * @prop {string} [x='bottom'] 30312 * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin. 30313 * Change this if your popper should grow in a direction different from `bottom` 30314 */ 30315 x: 'bottom', 30316 /** 30317 * @prop {string} [x='left'] 30318 * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin. 30319 * Change this if your popper should grow in a direction different from `right` 30320 */ 30321 y: 'right' 30322 }, 30323 30324 /** 30325 * Applies the computed styles to the popper element. 30326 * 30327 * All the DOM manipulations are limited to this modifier. This is useful in case 30328 * you want to integrate Popper.js inside a framework or view library and you 30329 * want to delegate all the DOM manipulations to it. 30330 * 30331 * Note that if you disable this modifier, you must make sure the popper element 30332 * has its position set to `absolute` before Popper.js can do its work! 30333 * 30334 * Just disable this modifier and define your own to achieve the desired effect. 30335 * 30336 * @memberof modifiers 30337 * @inner 30338 */ 30339 applyStyle: { 30340 /** @prop {number} order=900 - Index used to define the order of execution */ 30341 order: 900, 30342 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 30343 enabled: true, 30344 /** @prop {ModifierFn} */ 30345 fn: applyStyle, 30346 /** @prop {Function} */ 30347 onLoad: applyStyleOnLoad, 30348 /** 30349 * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier 30350 * @prop {Boolean} gpuAcceleration=true 30351 * If true, it uses the CSS 3D transformation to position the popper. 30352 * Otherwise, it will use the `top` and `left` properties 30353 */ 30354 gpuAcceleration: undefined 30355 } 30356}; 30357 30358/** 30359 * The `dataObject` is an object containing all the information used by Popper.js. 30360 * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks. 30361 * @name dataObject 30362 * @property {Object} data.instance The Popper.js instance 30363 * @property {String} data.placement Placement applied to popper 30364 * @property {String} data.originalPlacement Placement originally defined on init 30365 * @property {Boolean} data.flipped True if popper has been flipped by flip modifier 30366 * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper 30367 * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier 30368 * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`) 30369 * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`) 30370 * @property {Object} data.boundaries Offsets of the popper boundaries 30371 * @property {Object} data.offsets The measurements of popper, reference and arrow elements 30372 * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values 30373 * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values 30374 * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0 30375 */ 30376 30377/** 30378 * Default options provided to Popper.js constructor.<br /> 30379 * These can be overridden using the `options` argument of Popper.js.<br /> 30380 * To override an option, simply pass an object with the same 30381 * structure of the `options` object, as the 3rd argument. For example: 30382 * ``` 30383 * new Popper(ref, pop, { 30384 * modifiers: { 30385 * preventOverflow: { enabled: false } 30386 * } 30387 * }) 30388 * ``` 30389 * @type {Object} 30390 * @static 30391 * @memberof Popper 30392 */ 30393var Defaults = { 30394 /** 30395 * Popper's placement. 30396 * @prop {Popper.placements} placement='bottom' 30397 */ 30398 placement: 'bottom', 30399 30400 /** 30401 * Set this to true if you want popper to position it self in 'fixed' mode 30402 * @prop {Boolean} positionFixed=false 30403 */ 30404 positionFixed: false, 30405 30406 /** 30407 * Whether events (resize, scroll) are initially enabled. 30408 * @prop {Boolean} eventsEnabled=true 30409 */ 30410 eventsEnabled: true, 30411 30412 /** 30413 * Set to true if you want to automatically remove the popper when 30414 * you call the `destroy` method. 30415 * @prop {Boolean} removeOnDestroy=false 30416 */ 30417 removeOnDestroy: false, 30418 30419 /** 30420 * Callback called when the popper is created.<br /> 30421 * By default, it is set to no-op.<br /> 30422 * Access Popper.js instance with `data.instance`. 30423 * @prop {onCreate} 30424 */ 30425 onCreate: function onCreate() {}, 30426 30427 /** 30428 * Callback called when the popper is updated. This callback is not called 30429 * on the initialization/creation of the popper, but only on subsequent 30430 * updates.<br /> 30431 * By default, it is set to no-op.<br /> 30432 * Access Popper.js instance with `data.instance`. 30433 * @prop {onUpdate} 30434 */ 30435 onUpdate: function onUpdate() {}, 30436 30437 /** 30438 * List of modifiers used to modify the offsets before they are applied to the popper. 30439 * They provide most of the functionalities of Popper.js. 30440 * @prop {modifiers} 30441 */ 30442 modifiers: modifiers 30443}; 30444 30445/** 30446 * @callback onCreate 30447 * @param {dataObject} data 30448 */ 30449 30450/** 30451 * @callback onUpdate 30452 * @param {dataObject} data 30453 */ 30454 30455// Utils 30456// Methods 30457var Popper = function () { 30458 /** 30459 * Creates a new Popper.js instance. 30460 * @class Popper 30461 * @param {Element|referenceObject} reference - The reference element used to position the popper 30462 * @param {Element} popper - The HTML / XML element used as the popper 30463 * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults) 30464 * @return {Object} instance - The generated Popper.js instance 30465 */ 30466 function Popper(reference, popper) { 30467 var _this = this; 30468 30469 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; 30470 classCallCheck(this, Popper); 30471 30472 this.scheduleUpdate = function () { 30473 return requestAnimationFrame(_this.update); 30474 }; 30475 30476 // make update() debounced, so that it only runs at most once-per-tick 30477 this.update = debounce(this.update.bind(this)); 30478 30479 // with {} we create a new object with the options inside it 30480 this.options = _extends({}, Popper.Defaults, options); 30481 30482 // init state 30483 this.state = { 30484 isDestroyed: false, 30485 isCreated: false, 30486 scrollParents: [] 30487 }; 30488 30489 // get reference and popper elements (allow jQuery wrappers) 30490 this.reference = reference && reference.jquery ? reference[0] : reference; 30491 this.popper = popper && popper.jquery ? popper[0] : popper; 30492 30493 // Deep merge modifiers options 30494 this.options.modifiers = {}; 30495 Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) { 30496 _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {}); 30497 }); 30498 30499 // Refactoring modifiers' list (Object => Array) 30500 this.modifiers = Object.keys(this.options.modifiers).map(function (name) { 30501 return _extends({ 30502 name: name 30503 }, _this.options.modifiers[name]); 30504 }) 30505 // sort the modifiers by order 30506 .sort(function (a, b) { 30507 return a.order - b.order; 30508 }); 30509 30510 // modifiers have the ability to execute arbitrary code when Popper.js get inited 30511 // such code is executed in the same order of its modifier 30512 // they could add new properties to their options configuration 30513 // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`! 30514 this.modifiers.forEach(function (modifierOptions) { 30515 if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) { 30516 modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state); 30517 } 30518 }); 30519 30520 // fire the first update to position the popper in the right place 30521 this.update(); 30522 30523 var eventsEnabled = this.options.eventsEnabled; 30524 if (eventsEnabled) { 30525 // setup event listeners, they will take care of update the position in specific situations 30526 this.enableEventListeners(); 30527 } 30528 30529 this.state.eventsEnabled = eventsEnabled; 30530 } 30531 30532 // We can't use class properties because they don't get listed in the 30533 // class prototype and break stuff like Sinon stubs 30534 30535 30536 createClass(Popper, [{ 30537 key: 'update', 30538 value: function update$$1() { 30539 return update.call(this); 30540 } 30541 }, { 30542 key: 'destroy', 30543 value: function destroy$$1() { 30544 return destroy.call(this); 30545 } 30546 }, { 30547 key: 'enableEventListeners', 30548 value: function enableEventListeners$$1() { 30549 return enableEventListeners.call(this); 30550 } 30551 }, { 30552 key: 'disableEventListeners', 30553 value: function disableEventListeners$$1() { 30554 return disableEventListeners.call(this); 30555 } 30556 30557 /** 30558 * Schedules an update. It will run on the next UI update available. 30559 * @method scheduleUpdate 30560 * @memberof Popper 30561 */ 30562 30563 30564 /** 30565 * Collection of utilities useful when writing custom modifiers. 30566 * Starting from version 1.7, this method is available only if you 30567 * include `popper-utils.js` before `popper.js`. 30568 * 30569 * **DEPRECATION**: This way to access PopperUtils is deprecated 30570 * and will be removed in v2! Use the PopperUtils module directly instead. 30571 * Due to the high instability of the methods contained in Utils, we can't 30572 * guarantee them to follow semver. Use them at your own risk! 30573 * @static 30574 * @private 30575 * @type {Object} 30576 * @deprecated since version 1.8 30577 * @member Utils 30578 * @memberof Popper 30579 */ 30580 30581 }]); 30582 return Popper; 30583}(); 30584 30585/** 30586 * The `referenceObject` is an object that provides an interface compatible with Popper.js 30587 * and lets you use it as replacement of a real DOM node.<br /> 30588 * You can use this method to position a popper relatively to a set of coordinates 30589 * in case you don't have a DOM node to use as reference. 30590 * 30591 * ``` 30592 * new Popper(referenceObject, popperNode); 30593 * ``` 30594 * 30595 * NB: This feature isn't supported in Internet Explorer 10. 30596 * @name referenceObject 30597 * @property {Function} data.getBoundingClientRect 30598 * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method. 30599 * @property {number} data.clientWidth 30600 * An ES6 getter that will return the width of the virtual reference element. 30601 * @property {number} data.clientHeight 30602 * An ES6 getter that will return the height of the virtual reference element. 30603 */ 30604 30605 30606Popper.Utils = (typeof window !== 'undefined' ? window : __webpack_require__.g).PopperUtils; 30607Popper.placements = placements; 30608Popper.Defaults = Defaults; 30609 30610return Popper; 30611 30612}))); 30613//# sourceMappingURL=popper.js.map 30614 30615 30616/***/ }), 30617
vendor: 20,938 bytes, lines 30618-30629
30618/***/ "./node_modules/shufflejs/dist/shuffle.min.js": 30619/*!****************************************************!*\ 30620 !*** ./node_modules/shufflejs/dist/shuffle.min.js ***! 30621 \****************************************************/ 30622/***/ (function(module) { 30623 30624!function(t,e){ true?module.exports=e():0}(this,(function(){"use strict";function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function i(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}function n(t){return(n=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function o(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function r(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,s=n(t);if(e){var r=n(this).constructor;i=Reflect.construct(s,arguments,r)}else i=s.apply(this,arguments);return o(this,i)}}var l={exports:{}};function a(){}a.prototype={on:function(t,e,i){var n=this.e||(this.e={});return(n[t]||(n[t]=[])).push({fn:e,ctx:i}),this},once:function(t,e,i){var n=this;function s(){n.off(t,s),e.apply(i,arguments)}return s._=e,this.on(t,s,i)},emit:function(t){for(var e=[].slice.call(arguments,1),i=((this.e||(this.e={}))[t]||[]).slice(),n=0,s=i.length;n<s;n++)i[n].fn.apply(i[n].ctx,e);return this},off:function(t,e){var i=this.e||(this.e={}),n=i[t],s=[];if(n&&e)for(var o=0,r=n.length;o<r;o++)n[o].fn!==e&&n[o].fn._!==e&&s.push(n[o]);return s.length?i[t]=s:delete i[t],this}},l.exports=a,l.exports.TinyEmitter=a;var u=l.exports,h="undefined"!=typeof Element?Element.prototype:{},f=h.matches||h.matchesSelector||h.webkitMatchesSelector||h.mozMatchesSelector||h.msMatchesSelector||h.oMatchesSelector,c=function(t,e){if(!t||1!==t.nodeType)return!1;if(f)return f.call(t,e);for(var i=t.parentNode.querySelectorAll(e),n=0;n<i.length;n++)if(i[n]==t)return!0;return!1};var d=function(t,e){var i,n,s,o,r=0;return function(){i=this,n=arguments;var t=new Date-r;return o||(t>=e?l():o=setTimeout(l,e-t)),s};function l(){o=0,r=+new Date,s=t.apply(i,n),i=null,n=null}};function p(){}function m(t){return parseFloat(t)||0}var v=function(){function e(i,n){t(this,e),this.x=m(i),this.y=m(n)}return i(e,null,[{key:"equals",value:function(t,e){return t.x===e.x&&t.y===e.y}}]),e}(),y=function(){function e(i,n,s,o,r){t(this,e),this.id=r,this.left=i,this.top=n,this.width=s,this.height=o}return i(e,null,[{key:"intersects",value:function(t,e){return t.left<e.left+e.width&&e.left<t.left+t.width&&t.top<e.top+e.height&&e.top<t.top+t.height}}]),e}(),g={BASE:"shuffle",SHUFFLE_ITEM:"shuffle-item",VISIBLE:"shuffle-item--visible",HIDDEN:"shuffle-item--hidden"},_=0,E=function(){function e(i,n){t(this,e),_+=1,this.id=_,this.element=i,this.isRTL=n,this.isVisible=!0,this.isHidden=!1}return i(e,[{key:"show",value:function(){this.isVisible=!0,this.element.classList.remove(g.HIDDEN),this.element.classList.add(g.VISIBLE),this.element.removeAttribute("aria-hidden")}},{key:"hide",value:function(){this.isVisible=!1,this.element.classList.remove(g.VISIBLE),this.element.classList.add(g.HIDDEN),this.element.setAttribute("aria-hidden",!0)}},{key:"init",value:function(){this.addClasses([g.SHUFFLE_ITEM,g.VISIBLE]),this.applyCss(e.Css.INITIAL),this.applyCss(this.isRTL?e.Css.DIRECTION.rtl:e.Css.DIRECTION.ltr),this.scale=e.Scale.VISIBLE,this.point=new v}},{key:"addClasses",value:function(t){var e=this;t.forEach((function(t){e.element.classList.add(t)}))}},{key:"removeClasses",value:function(t){var e=this;t.forEach((function(t){e.element.classList.remove(t)}))}},{key:"applyCss",value:function(t){var e=this;Object.keys(t).forEach((function(i){e.element.style[i]=t[i]}))}},{key:"dispose",value:function(){this.removeClasses([g.HIDDEN,g.VISIBLE,g.SHUFFLE_ITEM]),this.element.removeAttribute("style"),this.element=null}}]),e}();E.Css={INITIAL:{position:"absolute",top:0,visibility:"visible",willChange:"transform"},DIRECTION:{ltr:{left:0},rtl:{right:0}},VISIBLE:{before:{opacity:1,visibility:"visible"},after:{transitionDelay:""}},HIDDEN:{before:{opacity:0},after:{visibility:"hidden",transitionDelay:""}}},E.Scale={VISIBLE:1,HIDDEN:.001};var I=null,b=function(){if(null!==I)return I;var t=document.body||document.documentElement,e=document.createElement("div");e.style.cssText="width:10px;padding:2px;box-sizing:border-box;",t.appendChild(e);var i=window.getComputedStyle(e,null).width;return I=10===Math.round(m(i)),t.removeChild(e),I};function T(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:window.getComputedStyle(t,null),n=m(i[e]);return b()||"width"!==e?b()||"height"!==e||(n+=m(i.paddingTop)+m(i.paddingBottom)+m(i.borderTopWidth)+m(i.borderBottomWidth)):n+=m(i.paddingLeft)+m(i.paddingRight)+m(i.borderLeftWidth)+m(i.borderRightWidth),n}var S={reverse:!1,by:null,compare:null,randomize:!1,key:"element"};function k(t,e){var i=Object.assign({},S,e),n=Array.from(t),s=!1;return t.length?i.randomize?function(t){for(var e=t.length;e;){e-=1;var i=Math.floor(Math.random()*(e+1)),n=t[i];t[i]=t[e],t[e]=n}return t}(t):("function"==typeof i.by?t.sort((function(t,e){if(s)return 0;var n=i.by(t[i.key]),o=i.by(e[i.key]);return void 0===n&&void 0===o?(s=!0,0):n<o||"sortFirst"===n||"sortLast"===o?-1:n>o||"sortLast"===n||"sortFirst"===o?1:0})):"function"==typeof i.compare&&t.sort(i.compare),s?n:(i.reverse&&t.reverse(),t)):[]}var C={},L="transitionend",w=0;function D(t){return!!C[t]&&(C[t].element.removeEventListener(L,C[t].listener),C[t]=null,!0)}function z(t,e){var i=L+(w+=1),n=function(t){t.currentTarget===t.target&&(D(i),e(t))};return t.addEventListener(L,n),C[i]={element:t,listener:n},i}function M(t){return Math.max.apply(Math,t)}function A(t,e,i,n){var s=t/e;return Math.abs(Math.round(s)-s)<n&&(s=Math.round(s)),Math.min(Math.ceil(s),i)}function F(t,e,i){if(1===e)return t;for(var n=[],s=0;s<=i-e;s++)n.push(M(t.slice(s,s+e)));return n}function x(t,e){for(var i,n=(i=t,Math.min.apply(Math,i)),s=0,o=t.length;s<o;s++)if(t[s]>=n-e&&t[s]<=n+e)return s;return 0}function O(t,e){var i={};t.forEach((function(t){i[t.top]?i[t.top].push(t):i[t.top]=[t]}));var n=[],s=[],o=[];return Object.keys(i).forEach((function(t){var r=i[t];s.push(r);var l,a=r[r.length-1],u=a.left+a.width,h=Math.round((e-u)/2),f=r,c=!1;if(h>0){var d=[];(c=r.every((function(t){var e=new y(t.left+h,t.top,t.width,t.height,t.id),i=!n.some((function(t){return y.intersects(e,t)}));return d.push(e),i})))&&(f=d)}if(!c&&r.some((function(t){return n.some((function(e){var i=y.intersects(t,e);return i&&(l=e),i}))}))){var p=o.findIndex((function(t){return t.includes(l)}));o.splice(p,1,s[p])}n=n.concat(f),o.push(f)})),[].concat.apply([],o).sort((function(t,e){return t.id-e.id})).map((function(t){return new v(t.left,t.top)}))}function R(t){return Array.from(new Set(t))}var N=0,B=function(e){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&s(t,e)}(o,e);var n=r(o);function o(e){var i,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t(this,o),(i=n.call(this)).options=Object.assign({},o.options,s),i.options.delimeter&&(i.options.delimiter=i.options.delimeter),i.lastSort={},i.group=o.ALL_ITEMS,i.lastFilter=o.ALL_ITEMS,i.isEnabled=!0,i.isDestroyed=!1,i.isInitialized=!1,i._transitions=[],i.isTransitioning=!1,i._queue=[];var r=i._getElementOption(e);if(!r)throw new TypeError("Shuffle needs to be initialized with an element.");return i.element=r,i.id="shuffle_"+N,N+=1,i._init(),i.isInitialized=!0,i}return i(o,[{key:"_init",value:function(){if(this.items=this._getItems(),this.sortedItems=this.items,this.options.sizer=this._getElementOption(this.options.sizer),this.element.classList.add(o.Classes.BASE),this._initItems(this.items),this._onResize=this._getResizeFunction(),window.addEventListener("resize",this._onResize),"complete"!==document.readyState){var t=this.layout.bind(this);window.addEventListener("load",(function e(){window.removeEventListener("load",e),t()}))}var e=window.getComputedStyle(this.element,null),i=o.getSize(this.element).width;this._validateStyles(e),this._setColumns(i),this.filter(this.options.group,this.options.initialSort),this.element.offsetWidth,this.setItemTransitions(this.items),this.element.style.transition="height ".concat(this.options.speed,"ms ").concat(this.options.easing)}},{key:"_getResizeFunction",value:function(){var t=this._handleResize.bind(this);return this.options.throttle?this.options.throttle(t,this.options.throttleTime):t}},{key:"_getElementOption",value:function(t){return"string"==typeof t?this.element.querySelector(t):t&&t.nodeType&&1===t.nodeType?t:t&&t.jquery?t[0]:null}},{key:"_validateStyles",value:function(t){"static"===t.position&&(this.element.style.position="relative"),"hidden"!==t.overflow&&(this.element.style.overflow="hidden")}},{key:"_filter",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.lastFilter,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.items,i=this._getFilteredSets(t,e);return this._toggleFilterClasses(i),this.lastFilter=t,"string"==typeof t&&(this.group=t),i}},{key:"_getFilteredSets",value:function(t,e){var i=this,n=[],s=[];return t===o.ALL_ITEMS?n=e:e.forEach((function(e){i._doesPassFilter(t,e.element)?n.push(e):s.push(e)})),{visible:n,hidden:s}}},{key:"_doesPassFilter",value:function(t,e){if("function"==typeof t)return t.call(e,e,this);var i=e.getAttribute("data-"+o.FILTER_ATTRIBUTE_KEY),n=this.options.delimiter?i.split(this.options.delimiter):JSON.parse(i);function s(t){return n.includes(t)}return Array.isArray(t)?this.options.filterMode===o.FilterMode.ANY?t.some(s):t.every(s):n.includes(t)}},{key:"_toggleFilterClasses",value:function(t){var e=t.visible,i=t.hidden;e.forEach((function(t){t.show()})),i.forEach((function(t){t.hide()}))}},{key:"_initItems",value:function(t){t.forEach((function(t){t.init()}))}},{key:"_disposeItems",value:function(t){t.forEach((function(t){t.dispose()}))}},{key:"_updateItemCount",value:function(){this.visibleItems=this._getFilteredItems().length}},{key:"setItemTransitions",value:function(t){var e=this.options,i=e.speed,n=e.easing,s=this.options.useTransforms?["transform"]:["top","left"],o=Object.keys(E.Css.HIDDEN.before).map((function(t){return t.replace(/([A-Z])/g,(function(t,e){return"-".concat(e.toLowerCase())}))})),r=s.concat(o).join();t.forEach((function(t){t.element.style.transitionDuration=i+"ms",t.element.style.transitionTimingFunction=n,t.element.style.transitionProperty=r}))}},{key:"_getItems",value:function(){var t=this;return Array.from(this.element.children).filter((function(e){return c(e,t.options.itemSelector)})).map((function(e){return new E(e,t.options.isRTL)}))}},{key:"_mergeNewItems",value:function(t){var e=Array.from(this.element.children);return k(this.items.concat(t),{by:function(t){return e.indexOf(t)}})}},{key:"_getFilteredItems",value:function(){return this.items.filter((function(t){return t.isVisible}))}},{key:"_getConcealedItems",value:function(){return this.items.filter((function(t){return!t.isVisible}))}},{key:"_getColumnSize",value:function(t,e){var i;return 0===(i="function"==typeof this.options.columnWidth?this.options.columnWidth(t):this.options.sizer?o.getSize(this.options.sizer).width:this.options.columnWidth?this.options.columnWidth:this.items.length>0?o.getSize(this.items[0].element,!0).width:t)&&(i=t),i+e}},{key:"_getGutterSize",value:function(t){return"function"==typeof this.options.gutterWidth?this.options.gutterWidth(t):this.options.sizer?T(this.options.sizer,"marginLeft"):this.options.gutterWidth}},{key:"_setColumns",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:o.getSize(this.element).width,e=this._getGutterSize(t),i=this._getColumnSize(t,e),n=(t+e)/i;Math.abs(Math.round(n)-n)<this.options.columnThreshold&&(n=Math.round(n)),this.cols=Math.max(Math.floor(n||0),1),this.containerWidth=t,this.colWidth=i}},{key:"_setContainerSize",value:function(){this.element.style.height=this._getContainerSize()+"px"}},{key:"_getContainerSize",value:function(){return M(this.positions)}},{key:"_getStaggerAmount",value:function(t){return Math.min(t*this.options.staggerAmount,this.options.staggerAmountMax)}},{key:"_dispatch",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.isDestroyed||(e.shuffle=this,this.emit(t,e))}},{key:"_resetCols",value:function(){var t=this.cols;for(this.positions=[];t;)t-=1,this.positions.push(0)}},{key:"_layout",value:function(t){var e=this,i=this._getNextPositions(t),n=0;t.forEach((function(t,s){function o(){t.applyCss(E.Css.VISIBLE.after)}if(v.equals(t.point,i[s])&&!t.isHidden)return t.applyCss(E.Css.VISIBLE.before),void o();t.point=i[s],t.scale=E.Scale.VISIBLE,t.isHidden=!1;var r=e.getStylesForTransition(t,E.Css.VISIBLE.before);r.transitionDelay=e._getStaggerAmount(n)+"ms",e._queue.push({item:t,styles:r,callback:o}),n+=1}))}},{key:"_getNextPositions",value:function(t){var e=this;if(this.options.isCentered){var i=t.map((function(t,i){var n=o.getSize(t.element,!0),s=e._getItemPosition(n);return new y(s.x,s.y,n.width,n.height,i)}));return this.getTransformedPositions(i,this.containerWidth)}return t.map((function(t){return e._getItemPosition(o.getSize(t.element,!0))}))}},{key:"_getItemPosition",value:function(t){return function(t){for(var e=t.itemSize,i=t.positions,n=t.gridSize,s=t.total,o=t.threshold,r=t.buffer,l=A(e.width,n,s,o),a=F(i,l,s),u=x(a,r),h=new v(n*u,a[u]),f=a[u]+e.height,c=0;c<l;c++)i[u+c]=f;return h}({itemSize:t,positions:this.positions,gridSize:this.colWidth,total:this.cols,threshold:this.options.columnThreshold,buffer:this.options.buffer})}},{key:"getTransformedPositions",value:function(t,e){return O(t,e)}},{key:"_shrink",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._getConcealedItems(),i=0;e.forEach((function(e){function n(){e.applyCss(E.Css.HIDDEN.after)}if(e.isHidden)return e.applyCss(E.Css.HIDDEN.before),void n();e.scale=E.Scale.HIDDEN,e.isHidden=!0;var s=t.getStylesForTransition(e,E.Css.HIDDEN.before);s.transitionDelay=t._getStaggerAmount(i)+"ms",t._queue.push({item:e,styles:s,callback:n}),i+=1}))}},{key:"_handleResize",value:function(){this.isEnabled&&!this.isDestroyed&&this.update()}},{key:"getStylesForTransition",value:function(t,e){var i=Object.assign({},e);if(this.options.useTransforms){var n=this.options.isRTL?"-":"",s=this.options.roundTransforms?Math.round(t.point.x):t.point.x,o=this.options.roundTransforms?Math.round(t.point.y):t.point.y;i.transform="translate(".concat(n).concat(s,"px, ").concat(o,"px) scale(").concat(t.scale,")")}else this.options.isRTL?i.right=t.point.x+"px":i.left=t.point.x+"px",i.top=t.point.y+"px";return i}},{key:"_whenTransitionDone",value:function(t,e,i){var n=z(t,(function(t){e(),i(null,t)}));this._transitions.push(n)}},{key:"_getTransitionFunction",value:function(t){var e=this;return function(i){t.item.applyCss(t.styles),e._whenTransitionDone(t.item.element,t.callback,i)}}},{key:"_processQueue",value:function(){this.isTransitioning&&this._cancelMovement();var t=this.options.speed>0,e=this._queue.length>0;e&&t&&this.isInitialized?this._startTransitions(this._queue):e?(this._styleImmediately(this._queue),this._dispatch(o.EventType.LAYOUT)):this._dispatch(o.EventType.LAYOUT),this._queue.length=0}},{key:"_startTransitions",value:function(t){var e=this;this.isTransitioning=!0,function(t,e,i){i||("function"==typeof e?(i=e,e=null):i=p);var n=t&&t.length;if(!n)return i(null,[]);var s=!1,o=new Array(n);function r(t){return function(e,r){if(!s){if(e)return i(e,o),void(s=!0);o[t]=r,--n||i(null,o)}}}t.forEach(e?function(t,i){t.call(e,r(i))}:function(t,e){t(r(e))})}(t.map((function(t){return e._getTransitionFunction(t)})),this._movementFinished.bind(this))}},{key:"_cancelMovement",value:function(){this._transitions.forEach(D),this._transitions.length=0,this.isTransitioning=!1}},{key:"_styleImmediately",value:function(t){if(t.length){var e=t.map((function(t){return t.item.element}));o._skipTransitions(e,(function(){t.forEach((function(t){t.item.applyCss(t.styles),t.callback()}))}))}}},{key:"_movementFinished",value:function(){this._transitions.length=0,this.isTransitioning=!1,this._dispatch(o.EventType.LAYOUT)}},{key:"filter",value:function(t,e){this.isEnabled&&((!t||t&&0===t.length)&&(t=o.ALL_ITEMS),this._filter(t),this._shrink(),this._updateItemCount(),this.sort(e))}},{key:"sort",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.lastSort;if(this.isEnabled){this._resetCols();var e=k(this._getFilteredItems(),t);this.sortedItems=e,this._layout(e),this._processQueue(),this._setContainerSize(),this.lastSort=t}}},{key:"update",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.isEnabled&&(t||this._setColumns(),this.sort())}},{key:"layout",value:function(){this.update(!0)}},{key:"add",value:function(t){var e=this,i=R(t).map((function(t){return new E(t,e.options.isRTL)}));this._initItems(i),this._resetCols();var n=k(this._mergeNewItems(i),this.lastSort),s=this._filter(this.lastFilter,n),o=function(t){return i.includes(t)},r=function(t){t.scale=E.Scale.HIDDEN,t.isHidden=!0,t.applyCss(E.Css.HIDDEN.before),t.applyCss(E.Css.HIDDEN.after)},l=this._getNextPositions(s.visible);s.visible.forEach((function(t,i){o(t)&&(t.point=l[i],r(t),t.applyCss(e.getStylesForTransition(t,{})))})),s.hidden.forEach((function(t){o(t)&&r(t)})),this.element.offsetWidth,this.setItemTransitions(i),this.items=this._mergeNewItems(i),this.filter(this.lastFilter)}},{key:"disable",value:function(){this.isEnabled=!1}},{key:"enable",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.isEnabled=!0,t&&this.update()}},{key:"remove",value:function(t){var e=this;if(t.length){var i=R(t),n=i.map((function(t){return e.getItemByElement(t)})).filter((function(t){return!!t}));this._toggleFilterClasses({visible:[],hidden:n}),this._shrink(n),this.sort(),this.items=this.items.filter((function(t){return!n.includes(t)})),this._updateItemCount(),this.once(o.EventType.LAYOUT,(function(){e._disposeItems(n),i.forEach((function(t){t.parentNode.removeChild(t)})),e._dispatch(o.EventType.REMOVED,{collection:i})}))}}},{key:"getItemByElement",value:function(t){return this.items.find((function(e){return e.element===t}))}},{key:"resetItems",value:function(){var t=this;this._disposeItems(this.items),this.isInitialized=!1,this.items=this._getItems(),this._initItems(this.items),this.once(o.EventType.LAYOUT,(function(){t.setItemTransitions(t.items),t.isInitialized=!0})),this.filter(this.lastFilter)}},{key:"destroy",value:function(){this._cancelMovement(),window.removeEventListener("resize",this._onResize),this.element.classList.remove("shuffle"),this.element.removeAttribute("style"),this._disposeItems(this.items),this.items.length=0,this._transitions.length=0,this.options.sizer=null,this.element=null,this.isDestroyed=!0,this.isEnabled=!1}}],[{key:"getSize",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=window.getComputedStyle(t,null),n=T(t,"width",i),s=T(t,"height",i);if(e){var o=T(t,"marginLeft",i),r=T(t,"marginRight",i),l=T(t,"marginTop",i),a=T(t,"marginBottom",i);n+=o+r,s+=l+a}return{width:n,height:s}}},{key:"_skipTransitions",value:function(t,e){var i=t.map((function(t){var e=t.style,i=e.transitionDuration,n=e.transitionDelay;return e.transitionDuration="0ms",e.transitionDelay="0ms",{duration:i,delay:n}}));e(),t[0].offsetWidth,t.forEach((function(t,e){t.style.transitionDuration=i[e].duration,t.style.transitionDelay=i[e].delay}))}}]),o}(u);return B.ShuffleItem=E,B.ALL_ITEMS="all",B.FILTER_ATTRIBUTE_KEY="groups",B.EventType={LAYOUT:"shuffle:layout",REMOVED:"shuffle:removed"},B.Classes=g,B.FilterMode={ANY:"any",ALL:"all"},B.options={group:B.ALL_ITEMS,speed:250,easing:"cubic-bezier(0.4, 0.0, 0.2, 1)",itemSelector:"*",sizer:null,gutterWidth:0,columnWidth:0,delimiter:null,buffer:0,columnThreshold:.01,initialSort:null,throttle:d,throttleTime:300,staggerAmount:15,staggerAmountMax:150,useTransforms:!0,filterMode:B.FilterMode.ANY,isCentered:!1,isRTL:!1,roundTransforms:!0},B.Point=v,B.Rect=y,B.__sorter=k,B.__getColumnSpan=A,B.__getAvailablePositions=F,B.__getShortColumn=x,B.__getCenteredPositions=O,B})); 30625//# sourceMappingURL=shuffle.min.js.map 30626 30627 30628/***/ }), 30629
vendor: 23,774 bytes, lines 30630-31427
30630/***/ "./node_modules/smoothscroll-for-websites/SmoothScroll.js": 30631/*!****************************************************************!*\ 30632 !*** ./node_modules/smoothscroll-for-websites/SmoothScroll.js ***! 30633 \****************************************************************/ 30634/***/ ((module, exports, __webpack_require__) => { 30635 30636var __WEBPACK_AMD_DEFINE_RESULT__;// 30637// SmoothScroll for websites v1.4.10 (Balazs Galambosi) 30638// http://www.smoothscroll.net/ 30639// 30640// Licensed under the terms of the MIT license. 30641// 30642// You may use it in your theme if you credit me. 30643// It is also free to use on any individual website. 30644// 30645// Exception: 30646// The only restriction is to not publish any 30647// extension for browsers or native application 30648// without getting a written permission first. 30649// 30650 30651(function () { 30652 30653// Scroll Variables (tweakable) 30654var defaultOptions = { 30655 30656 // Scrolling Core 30657 frameRate : 150, // [Hz] 30658 animationTime : 400, // [ms] 30659 stepSize : 100, // [px] 30660 30661 // Pulse (less tweakable) 30662 // ratio of "tail" to "acceleration" 30663 pulseAlgorithm : true, 30664 pulseScale : 4, 30665 pulseNormalize : 1, 30666 30667 // Acceleration 30668 accelerationDelta : 50, // 50 30669 accelerationMax : 3, // 3 30670 30671 // Keyboard Settings 30672 keyboardSupport : true, // option 30673 arrowScroll : 50, // [px] 30674 30675 // Other 30676 fixedBackground : true, 30677 excluded : '' 30678}; 30679 30680var options = defaultOptions; 30681 30682 30683// Other Variables 30684var isExcluded = false; 30685var isFrame = false; 30686var direction = { x: 0, y: 0 }; 30687var initDone = false; 30688var root = document.documentElement; 30689var activeElement; 30690var observer; 30691var refreshSize; 30692var deltaBuffer = []; 30693var deltaBufferTimer; 30694var isMac = /^Mac/.test(navigator.platform); 30695 30696var key = { left: 37, up: 38, right: 39, down: 40, spacebar: 32, 30697 pageup: 33, pagedown: 34, end: 35, home: 36 }; 30698var arrowKeys = { 37: 1, 38: 1, 39: 1, 40: 1 }; 30699 30700/*********************************************** 30701 * INITIALIZE 30702 ***********************************************/ 30703 30704/** 30705 * Tests if smooth scrolling is allowed. Shuts down everything if not. 30706 */ 30707function initTest() { 30708 if (options.keyboardSupport) { 30709 addEvent('keydown', keydown); 30710 } 30711} 30712 30713/** 30714 * Sets up scrolls array, determines if frames are involved. 30715 */ 30716function init() { 30717 30718 if (initDone || !document.body) return; 30719 30720 initDone = true; 30721 30722 var body = document.body; 30723 var html = document.documentElement; 30724 var windowHeight = window.innerHeight; 30725 var scrollHeight = body.scrollHeight; 30726 30727 // check compat mode for root element 30728 root = (document.compatMode.indexOf('CSS') >= 0) ? html : body; 30729 activeElement = body; 30730 30731 initTest(); 30732 30733 // Checks if this script is running in a frame 30734 if (top != self) { 30735 isFrame = true; 30736 } 30737 30738 /** 30739 * Safari 10 fixed it, Chrome fixed it in v45: 30740 * This fixes a bug where the areas left and right to 30741 * the content does not trigger the onmousewheel event 30742 * on some pages. e.g.: html, body { height: 100% } 30743 */ 30744 else if (isOldSafari && 30745 scrollHeight > windowHeight && 30746 (body.offsetHeight <= windowHeight || 30747 html.offsetHeight <= windowHeight)) { 30748 30749 var fullPageElem = document.createElement('div'); 30750 fullPageElem.style.cssText = 'position:absolute; z-index:-10000; ' + 30751 'top:0; left:0; right:0; height:' + 30752 root.scrollHeight + 'px'; 30753 document.body.appendChild(fullPageElem); 30754 30755 // DOM changed (throttled) to fix height 30756 var pendingRefresh; 30757 refreshSize = function () { 30758 if (pendingRefresh) return; // could also be: clearTimeout(pendingRefresh); 30759 pendingRefresh = setTimeout(function () { 30760 if (isExcluded) return; // could be running after cleanup 30761 fullPageElem.style.height = '0'; 30762 fullPageElem.style.height = root.scrollHeight + 'px'; 30763 pendingRefresh = null; 30764 }, 500); // act rarely to stay fast 30765 }; 30766 30767 setTimeout(refreshSize, 10); 30768 30769 addEvent('resize', refreshSize); 30770 30771 // TODO: attributeFilter? 30772 var config = { 30773 attributes: true, 30774 childList: true, 30775 characterData: false 30776 // subtree: true 30777 }; 30778 30779 observer = new MutationObserver(refreshSize); 30780 observer.observe(body, config); 30781 30782 if (root.offsetHeight <= windowHeight) { 30783 var clearfix = document.createElement('div'); 30784 clearfix.style.clear = 'both'; 30785 body.appendChild(clearfix); 30786 } 30787 } 30788 30789 // disable fixed background 30790 if (!options.fixedBackground && !isExcluded) { 30791 body.style.backgroundAttachment = 'scroll'; 30792 html.style.backgroundAttachment = 'scroll'; 30793 } 30794} 30795 30796/** 30797 * Removes event listeners and other traces left on the page. 30798 */ 30799function cleanup() { 30800 observer && observer.disconnect(); 30801 removeEvent(wheelEvent, wheel); 30802 removeEvent('mousedown', mousedown); 30803 removeEvent('keydown', keydown); 30804 removeEvent('resize', refreshSize); 30805 removeEvent('load', init); 30806} 30807 30808 30809/************************************************ 30810 * SCROLLING 30811 ************************************************/ 30812 30813var que = []; 30814var pending = false; 30815var lastScroll = Date.now(); 30816 30817/** 30818 * Pushes scroll actions to the scrolling queue. 30819 */ 30820function scrollArray(elem, left, top) { 30821 30822 directionCheck(left, top); 30823 30824 if (options.accelerationMax != 1) { 30825 var now = Date.now(); 30826 var elapsed = now - lastScroll; 30827 if (elapsed < options.accelerationDelta) { 30828 var factor = (1 + (50 / elapsed)) / 2; 30829 if (factor > 1) { 30830 factor = Math.min(factor, options.accelerationMax); 30831 left *= factor; 30832 top *= factor; 30833 } 30834 } 30835 lastScroll = Date.now(); 30836 } 30837 30838 // push a scroll command 30839 que.push({ 30840 x: left, 30841 y: top, 30842 lastX: (left < 0) ? 0.99 : -0.99, 30843 lastY: (top < 0) ? 0.99 : -0.99, 30844 start: Date.now() 30845 }); 30846 30847 // don't act if there's a pending queue 30848 if (pending) { 30849 return; 30850 } 30851 30852 var scrollRoot = getScrollRoot(); 30853 var isWindowScroll = (elem === scrollRoot || elem === document.body); 30854 30855 // if we haven't already fixed the behavior, 30856 // and it needs fixing for this sesh 30857 if (elem.$scrollBehavior == null && isScrollBehaviorSmooth(elem)) { 30858 elem.$scrollBehavior = elem.style.scrollBehavior; 30859 elem.style.scrollBehavior = 'auto'; 30860 } 30861 30862 var step = function (time) { 30863 30864 var now = Date.now(); 30865 var scrollX = 0; 30866 var scrollY = 0; 30867 30868 for (var i = 0; i < que.length; i++) { 30869 30870 var item = que[i]; 30871 var elapsed = now - item.start; 30872 var finished = (elapsed >= options.animationTime); 30873 30874 // scroll position: [0, 1] 30875 var position = (finished) ? 1 : elapsed / options.animationTime; 30876 30877 // easing [optional] 30878 if (options.pulseAlgorithm) { 30879 position = pulse(position); 30880 } 30881 30882 // only need the difference 30883 var x = (item.x * position - item.lastX) >> 0; 30884 var y = (item.y * position - item.lastY) >> 0; 30885 30886 // add this to the total scrolling 30887 scrollX += x; 30888 scrollY += y; 30889 30890 // update last values 30891 item.lastX += x; 30892 item.lastY += y; 30893 30894 // delete and step back if it's over 30895 if (finished) { 30896 que.splice(i, 1); i--; 30897 } 30898 } 30899 30900 // scroll left and top 30901 if (isWindowScroll) { 30902 window.scrollBy(scrollX, scrollY); 30903 } 30904 else { 30905 if (scrollX) elem.scrollLeft += scrollX; 30906 if (scrollY) elem.scrollTop += scrollY; 30907 } 30908 30909 // clean up if there's nothing left to do 30910 if (!left && !top) { 30911 que = []; 30912 } 30913 30914 if (que.length) { 30915 requestFrame(step, elem, (1000 / options.frameRate + 1)); 30916 } else { 30917 pending = false; 30918 // restore default behavior at the end of scrolling sesh 30919 if (elem.$scrollBehavior != null) { 30920 elem.style.scrollBehavior = elem.$scrollBehavior; 30921 elem.$scrollBehavior = null; 30922 } 30923 } 30924 }; 30925 30926 // start a new queue of actions 30927 requestFrame(step, elem, 0); 30928 pending = true; 30929} 30930 30931 30932/*********************************************** 30933 * EVENTS 30934 ***********************************************/ 30935 30936/** 30937 * Mouse wheel handler. 30938 * @param {Object} event 30939 */ 30940function wheel(event) { 30941 30942 if (!initDone) { 30943 init(); 30944 } 30945 30946 var target = event.target; 30947 30948 // leave early if default action is prevented 30949 // or it's a zooming event with CTRL 30950 if (event.defaultPrevented || event.ctrlKey) { 30951 return true; 30952 } 30953 30954 // leave embedded content alone (flash & pdf) 30955 if (isNodeName(activeElement, 'embed') || 30956 (isNodeName(target, 'embed') && /\.pdf/i.test(target.src)) || 30957 isNodeName(activeElement, 'object') || 30958 target.shadowRoot) { 30959 return true; 30960 } 30961 30962 var deltaX = -event.wheelDeltaX || event.deltaX || 0; 30963 var deltaY = -event.wheelDeltaY || event.deltaY || 0; 30964 30965 if (isMac) { 30966 if (event.wheelDeltaX && isDivisible(event.wheelDeltaX, 120)) { 30967 deltaX = -120 * (event.wheelDeltaX / Math.abs(event.wheelDeltaX)); 30968 } 30969 if (event.wheelDeltaY && isDivisible(event.wheelDeltaY, 120)) { 30970 deltaY = -120 * (event.wheelDeltaY / Math.abs(event.wheelDeltaY)); 30971 } 30972 } 30973 30974 // use wheelDelta if deltaX/Y is not available 30975 if (!deltaX && !deltaY) { 30976 deltaY = -event.wheelDelta || 0; 30977 } 30978 30979 // line based scrolling (Firefox mostly) 30980 if (event.deltaMode === 1) { 30981 deltaX *= 40; 30982 deltaY *= 40; 30983 } 30984 30985 var overflowing = overflowingAncestor(target); 30986 30987 // nothing to do if there's no element that's scrollable 30988 if (!overflowing) { 30989 // except Chrome iframes seem to eat wheel events, which we need to 30990 // propagate up, if the iframe has nothing overflowing to scroll 30991 if (isFrame && isChrome) { 30992 // change target to iframe element itself for the parent frame 30993 Object.defineProperty(event, "target", {value: window.frameElement}); 30994 return parent.wheel(event); 30995 } 30996 return true; 30997 } 30998 30999 // check if it's a touchpad scroll that should be ignored 31000 if (isTouchpad(deltaY)) { 31001 return true; 31002 } 31003 31004 // scale by step size 31005 // delta is 120 most of the time 31006 // synaptics seems to send 1 sometimes 31007 if (Math.abs(deltaX) > 1.2) { 31008 deltaX *= options.stepSize / 120; 31009 } 31010 if (Math.abs(deltaY) > 1.2) { 31011 deltaY *= options.stepSize / 120; 31012 } 31013 31014 scrollArray(overflowing, deltaX, deltaY); 31015 event.preventDefault(); 31016 scheduleClearCache(); 31017} 31018 31019/** 31020 * Keydown event handler. 31021 * @param {Object} event 31022 */ 31023function keydown(event) { 31024 31025 var target = event.target; 31026 var modifier = event.ctrlKey || event.altKey || event.metaKey || 31027 (event.shiftKey && event.keyCode !== key.spacebar); 31028 31029 // our own tracked active element could've been removed from the DOM 31030 if (!document.body.contains(activeElement)) { 31031 activeElement = document.activeElement; 31032 } 31033 31034 // do nothing if user is editing text 31035 // or using a modifier key (except shift) 31036 // or in a dropdown 31037 // or inside interactive elements 31038 var inputNodeNames = /^(textarea|select|embed|object)$/i; 31039 var buttonTypes = /^(button|submit|radio|checkbox|file|color|image)$/i; 31040 if ( event.defaultPrevented || 31041 inputNodeNames.test(target.nodeName) || 31042 isNodeName(target, 'input') && !buttonTypes.test(target.type) || 31043 isNodeName(activeElement, 'video') || 31044 isInsideYoutubeVideo(event) || 31045 target.isContentEditable || 31046 modifier ) { 31047 return true; 31048 } 31049 31050 // [spacebar] should trigger button press, leave it alone 31051 if ((isNodeName(target, 'button') || 31052 isNodeName(target, 'input') && buttonTypes.test(target.type)) && 31053 event.keyCode === key.spacebar) { 31054 return true; 31055 } 31056 31057 // [arrwow keys] on radio buttons should be left alone 31058 if (isNodeName(target, 'input') && target.type == 'radio' && 31059 arrowKeys[event.keyCode]) { 31060 return true; 31061 } 31062 31063 var shift, x = 0, y = 0; 31064 var overflowing = overflowingAncestor(activeElement); 31065 31066 if (!overflowing) { 31067 // Chrome iframes seem to eat key events, which we need to 31068 // propagate up, if the iframe has nothing overflowing to scroll 31069 return (isFrame && isChrome) ? parent.keydown(event) : true; 31070 } 31071 31072 var clientHeight = overflowing.clientHeight; 31073 31074 if (overflowing == document.body) { 31075 clientHeight = window.innerHeight; 31076 } 31077 31078 switch (event.keyCode) { 31079 case key.up: 31080 y = -options.arrowScroll; 31081 break; 31082 case key.down: 31083 y = options.arrowScroll; 31084 break; 31085 case key.spacebar: // (+ shift) 31086 shift = event.shiftKey ? 1 : -1; 31087 y = -shift * clientHeight * 0.9; 31088 break; 31089 case key.pageup: 31090 y = -clientHeight * 0.9; 31091 break; 31092 case key.pagedown: 31093 y = clientHeight * 0.9; 31094 break; 31095 case key.home: 31096 if (overflowing == document.body && document.scrollingElement) 31097 overflowing = document.scrollingElement; 31098 y = -overflowing.scrollTop; 31099 break; 31100 case key.end: 31101 var scroll = overflowing.scrollHeight - overflowing.scrollTop; 31102 var scrollRemaining = scroll - clientHeight; 31103 y = (scrollRemaining > 0) ? scrollRemaining + 10 : 0; 31104 break; 31105 case key.left: 31106 x = -options.arrowScroll; 31107 break; 31108 case key.right: 31109 x = options.arrowScroll; 31110 break; 31111 default: 31112 return true; // a key we don't care about 31113 } 31114 31115 scrollArray(overflowing, x, y); 31116 event.preventDefault(); 31117 scheduleClearCache(); 31118} 31119 31120/** 31121 * Mousedown event only for updating activeElement 31122 */ 31123function mousedown(event) { 31124 activeElement = event.target; 31125} 31126 31127 31128/*********************************************** 31129 * OVERFLOW 31130 ***********************************************/ 31131 31132var uniqueID = (function () { 31133 var i = 0; 31134 return function (el) { 31135 return el.uniqueID || (el.uniqueID = i++); 31136 }; 31137})(); 31138 31139var cacheX = {}; // cleared out after a scrolling session 31140var cacheY = {}; // cleared out after a scrolling session 31141var clearCacheTimer; 31142var smoothBehaviorForElement = {}; 31143 31144//setInterval(function () { cache = {}; }, 10 * 1000); 31145 31146function scheduleClearCache() { 31147 clearTimeout(clearCacheTimer); 31148 clearCacheTimer = setInterval(function () { 31149 cacheX = cacheY = smoothBehaviorForElement = {}; 31150 }, 1*1000); 31151} 31152 31153function setCache(elems, overflowing, x) { 31154 var cache = x ? cacheX : cacheY; 31155 for (var i = elems.length; i--;) 31156 cache[uniqueID(elems[i])] = overflowing; 31157 return overflowing; 31158} 31159 31160function getCache(el, x) { 31161 return (x ? cacheX : cacheY)[uniqueID(el)]; 31162} 31163 31164// (body) (root) 31165// | hidden | visible | scroll | auto | 31166// hidden | no | no | YES | YES | 31167// visible | no | YES | YES | YES | 31168// scroll | no | YES | YES | YES | 31169// auto | no | YES | YES | YES | 31170 31171function overflowingAncestor(el) { 31172 var elems = []; 31173 var body = document.body; 31174 var rootScrollHeight = root.scrollHeight; 31175 do { 31176 var cached = getCache(el, false); 31177 if (cached) { 31178 return setCache(elems, cached); 31179 } 31180 elems.push(el); 31181 if (rootScrollHeight === el.scrollHeight) { 31182 var topOverflowsNotHidden = overflowNotHidden(root) && overflowNotHidden(body); 31183 var isOverflowCSS = topOverflowsNotHidden || overflowAutoOrScroll(root); 31184 if (isFrame && isContentOverflowing(root) || 31185 !isFrame && isOverflowCSS) { 31186 return setCache(elems, getScrollRoot()); 31187 } 31188 } else if (isContentOverflowing(el) && overflowAutoOrScroll(el)) { 31189 return setCache(elems, el); 31190 } 31191 } while ((el = el.parentElement)); 31192} 31193 31194function isContentOverflowing(el) { 31195 return (el.clientHeight + 10 < el.scrollHeight); 31196} 31197 31198// typically for <body> and <html> 31199function overflowNotHidden(el) { 31200 var overflow = getComputedStyle(el, '').getPropertyValue('overflow-y'); 31201 return (overflow !== 'hidden'); 31202} 31203 31204// for all other elements 31205function overflowAutoOrScroll(el) { 31206 var overflow = getComputedStyle(el, '').getPropertyValue('overflow-y'); 31207 return (overflow === 'scroll' || overflow === 'auto'); 31208} 31209 31210// for all other elements 31211function isScrollBehaviorSmooth(el) { 31212 var id = uniqueID(el); 31213 if (smoothBehaviorForElement[id] == null) { 31214 var scrollBehavior = getComputedStyle(el, '')['scroll-behavior']; 31215 smoothBehaviorForElement[id] = ('smooth' == scrollBehavior); 31216 } 31217 return smoothBehaviorForElement[id]; 31218} 31219 31220 31221/*********************************************** 31222 * HELPERS 31223 ***********************************************/ 31224 31225function addEvent(type, fn, arg) { 31226 window.addEventListener(type, fn, arg || false); 31227} 31228 31229function removeEvent(type, fn, arg) { 31230 window.removeEventListener(type, fn, arg || false); 31231} 31232 31233function isNodeName(el, tag) { 31234 return el && (el.nodeName||'').toLowerCase() === tag.toLowerCase(); 31235} 31236 31237function directionCheck(x, y) { 31238 x = (x > 0) ? 1 : -1; 31239 y = (y > 0) ? 1 : -1; 31240 if (direction.x !== x || direction.y !== y) { 31241 direction.x = x; 31242 direction.y = y; 31243 que = []; 31244 lastScroll = 0; 31245 } 31246} 31247 31248if (window.localStorage && localStorage.SS_deltaBuffer) { 31249 try { // #46 Safari throws in private browsing for localStorage 31250 deltaBuffer = localStorage.SS_deltaBuffer.split(','); 31251 } catch (e) { } 31252} 31253 31254function isTouchpad(deltaY) { 31255 if (!deltaY) return; 31256 if (!deltaBuffer.length) { 31257 deltaBuffer = [deltaY, deltaY, deltaY]; 31258 } 31259 deltaY = Math.abs(deltaY); 31260 deltaBuffer.push(deltaY); 31261 deltaBuffer.shift(); 31262 clearTimeout(deltaBufferTimer); 31263 deltaBufferTimer = setTimeout(function () { 31264 try { // #46 Safari throws in private browsing for localStorage 31265 localStorage.SS_deltaBuffer = deltaBuffer.join(','); 31266 } catch (e) { } 31267 }, 1000); 31268 var dpiScaledWheelDelta = deltaY > 120 && allDeltasDivisableBy(deltaY); // win64 31269 var tp = !allDeltasDivisableBy(120) && !allDeltasDivisableBy(100) && !dpiScaledWheelDelta; 31270 if (deltaY < 50) return true; 31271 return tp; 31272} 31273 31274function isDivisible(n, divisor) { 31275 return (Math.floor(n / divisor) == n / divisor); 31276} 31277 31278function allDeltasDivisableBy(divisor) { 31279 return (isDivisible(deltaBuffer[0], divisor) && 31280 isDivisible(deltaBuffer[1], divisor) && 31281 isDivisible(deltaBuffer[2], divisor)); 31282} 31283 31284function isInsideYoutubeVideo(event) { 31285 var elem = event.target; 31286 var isControl = false; 31287 if (document.URL.indexOf ('www.youtube.com/watch') != -1) { 31288 do { 31289 isControl = (elem.classList && 31290 elem.classList.contains('html5-video-controls')); 31291 if (isControl) break; 31292 } while ((elem = elem.parentNode)); 31293 } 31294 return isControl; 31295} 31296 31297var requestFrame = (function () { 31298 return (window.requestAnimationFrame || 31299 window.webkitRequestAnimationFrame || 31300 window.mozRequestAnimationFrame || 31301 function (callback, element, delay) { 31302 window.setTimeout(callback, delay || (1000/60)); 31303 }); 31304})(); 31305 31306var MutationObserver = (window.MutationObserver || 31307 window.WebKitMutationObserver || 31308 window.MozMutationObserver); 31309 31310var getScrollRoot = (function() { 31311 var SCROLL_ROOT = document.scrollingElement; 31312 return function() { 31313 if (!SCROLL_ROOT) { 31314 var dummy = document.createElement('div'); 31315 dummy.style.cssText = 'height:10000px;width:1px;'; 31316 document.body.appendChild(dummy); 31317 var bodyScrollTop = document.body.scrollTop; 31318 var docElScrollTop = document.documentElement.scrollTop; 31319 window.scrollBy(0, 3); 31320 if (document.body.scrollTop != bodyScrollTop) 31321 (SCROLL_ROOT = document.body); 31322 else 31323 (SCROLL_ROOT = document.documentElement); 31324 window.scrollBy(0, -3); 31325 document.body.removeChild(dummy); 31326 } 31327 return SCROLL_ROOT; 31328 }; 31329})(); 31330 31331 31332/*********************************************** 31333 * PULSE (by Michael Herf) 31334 ***********************************************/ 31335 31336/** 31337 * Viscous fluid with a pulse for part and decay for the rest. 31338 * - Applies a fixed force over an interval (a damped acceleration), and 31339 * - Lets the exponential bleed away the velocity over a longer interval 31340 * - Michael Herf, http://stereopsis.com/stopping/ 31341 */ 31342function pulse_(x) { 31343 var val, start, expx; 31344 // test 31345 x = x * options.pulseScale; 31346 if (x < 1) { // acceleartion 31347 val = x - (1 - Math.exp(-x)); 31348 } else { // tail 31349 // the previous animation ended here: 31350 start = Math.exp(-1); 31351 // simple viscous drag 31352 x -= 1; 31353 expx = 1 - Math.exp(-x); 31354 val = start + (expx * (1 - start)); 31355 } 31356 return val * options.pulseNormalize; 31357} 31358 31359function pulse(x) { 31360 if (x >= 1) return 1; 31361 if (x <= 0) return 0; 31362 31363 if (options.pulseNormalize == 1) { 31364 options.pulseNormalize /= pulse_(1); 31365 } 31366 return pulse_(x); 31367} 31368 31369 31370/*********************************************** 31371 * FIRST RUN 31372 ***********************************************/ 31373 31374var userAgent = window.navigator.userAgent; 31375var isEdge = /Edge/.test(userAgent); // thank you MS 31376var isChrome = /chrome/i.test(userAgent) && !isEdge; 31377var isSafari = /safari/i.test(userAgent) && !isEdge; 31378var isMobile = /mobile/i.test(userAgent); 31379var isIEWin7 = /Windows NT 6.1/i.test(userAgent) && /rv:11/i.test(userAgent); 31380var isOldSafari = isSafari && (/Version\/8/i.test(userAgent) || /Version\/9/i.test(userAgent)); 31381var isEnabledForBrowser = (isChrome || isSafari || isIEWin7) && !isMobile; 31382 31383var supportsPassive = false; 31384try { 31385 window.addEventListener("test", null, Object.defineProperty({}, 'passive', { 31386 get: function () { 31387 supportsPassive = true; 31388 } 31389 })); 31390} catch(e) {} 31391 31392var wheelOpt = supportsPassive ? { passive: false } : false; 31393var wheelEvent = 'onwheel' in document.createElement('div') ? 'wheel' : 'mousewheel'; 31394 31395if (wheelEvent && isEnabledForBrowser) { 31396 addEvent(wheelEvent, wheel, wheelOpt); 31397 addEvent('mousedown', mousedown); 31398 addEvent('load', init); 31399} 31400 31401 31402/*********************************************** 31403 * PUBLIC INTERFACE 31404 ***********************************************/ 31405 31406function SmoothScroll(optionsToSet) { 31407 for (var key in optionsToSet) 31408 if (defaultOptions.hasOwnProperty(key)) 31409 options[key] = optionsToSet[key]; 31410} 31411SmoothScroll.destroy = cleanup; 31412 31413if (window.SmoothScrollOptions) // async API 31414 SmoothScroll(window.SmoothScrollOptions); 31415 31416if (true) 31417 !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() { 31418 return SmoothScroll; 31419 }).call(exports, __webpack_require__, exports, module), 31420 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 31421else {} 31422 31423})(); 31424 31425 31426/***/ }), 31427
vendor: 33,018 bytes, lines 31428-32483
31428/***/ "./node_modules/typed.js/lib/typed.js": 31429/*!********************************************!*\ 31430 !*** ./node_modules/typed.js/lib/typed.js ***! 31431 \********************************************/ 31432/***/ (function(module) { 31433 31434/*! 31435 * 31436 * typed.js - A JavaScript Typing Animation Library 31437 * Author: Matt Boldt <[email protected]> 31438 * Version: v2.0.12 31439 * Url: https://github.com/mattboldt/typed.js 31440 * License(s): MIT 31441 * 31442 */ 31443(function webpackUniversalModuleDefinition(root, factory) { 31444 if(true) 31445 module.exports = factory(); 31446 else {} 31447})(this, function() { 31448return /******/ (function(modules) { // webpackBootstrap 31449/******/ // The module cache 31450/******/ var installedModules = {}; 31451/******/ 31452/******/ // The require function 31453/******/ function __nested_webpack_require_737__(moduleId) { 31454/******/ 31455/******/ // Check if module is in cache 31456/******/ if(installedModules[moduleId]) 31457/******/ return installedModules[moduleId].exports; 31458/******/ 31459/******/ // Create a new module (and put it into the cache) 31460/******/ var module = installedModules[moduleId] = { 31461/******/ exports: {}, 31462/******/ id: moduleId, 31463/******/ loaded: false 31464/******/ }; 31465/******/ 31466/******/ // Execute the module function 31467/******/ modules[moduleId].call(module.exports, module, module.exports, __nested_webpack_require_737__); 31468/******/ 31469/******/ // Flag the module as loaded 31470/******/ module.loaded = true; 31471/******/ 31472/******/ // Return the exports of the module 31473/******/ return module.exports; 31474/******/ } 31475/******/ 31476/******/ 31477/******/ // expose the modules object (__webpack_modules__) 31478/******/ __nested_webpack_require_737__.m = modules; 31479/******/ 31480/******/ // expose the module cache 31481/******/ __nested_webpack_require_737__.c = installedModules; 31482/******/ 31483/******/ // __webpack_public_path__ 31484/******/ __nested_webpack_require_737__.p = ""; 31485/******/ 31486/******/ // Load entry module and return exports 31487/******/ return __nested_webpack_require_737__(0); 31488/******/ }) 31489/************************************************************************/ 31490/******/ ([ 31491/* 0 */ 31492/***/ (function(module, exports, __nested_webpack_require_2018__) { 31493 31494 'use strict'; 31495 31496 Object.defineProperty(exports, '__esModule', { 31497 value: true 31498 }); 31499 31500 var _createClass = (function () { function 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); 31501 31502 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 31503 31504 var _initializerJs = __nested_webpack_require_2018__(1); 31505 31506 var _htmlParserJs = __nested_webpack_require_2018__(3); 31507 31508 /** 31509 * Welcome to Typed.js! 31510 * @param {string} elementId HTML element ID _OR_ HTML element 31511 * @param {object} options options object 31512 * @returns {object} a new Typed object 31513 */ 31514 31515 var Typed = (function () { 31516 function Typed(elementId, options) { 31517 _classCallCheck(this, Typed); 31518 31519 // Initialize it up 31520 _initializerJs.initializer.load(this, options, elementId); 31521 // All systems go! 31522 this.begin(); 31523 } 31524 31525 /** 31526 * Toggle start() and stop() of the Typed instance 31527 * @public 31528 */ 31529 31530 _createClass(Typed, [{ 31531 key: 'toggle', 31532 value: function toggle() { 31533 this.pause.status ? this.start() : this.stop(); 31534 } 31535 31536 /** 31537 * Stop typing / backspacing and enable cursor blinking 31538 * @public 31539 */ 31540 }, { 31541 key: 'stop', 31542 value: function stop() { 31543 if (this.typingComplete) return; 31544 if (this.pause.status) return; 31545 this.toggleBlinking(true); 31546 this.pause.status = true; 31547 this.options.onStop(this.arrayPos, this); 31548 } 31549 31550 /** 31551 * Start typing / backspacing after being stopped 31552 * @public 31553 */ 31554 }, { 31555 key: 'start', 31556 value: function start() { 31557 if (this.typingComplete) return; 31558 if (!this.pause.status) return; 31559 this.pause.status = false; 31560 if (this.pause.typewrite) { 31561 this.typewrite(this.pause.curString, this.pause.curStrPos); 31562 } else { 31563 this.backspace(this.pause.curString, this.pause.curStrPos); 31564 } 31565 this.options.onStart(this.arrayPos, this); 31566 } 31567 31568 /** 31569 * Destroy this instance of Typed 31570 * @public 31571 */ 31572 }, { 31573 key: 'destroy', 31574 value: function destroy() { 31575 this.reset(false); 31576 this.options.onDestroy(this); 31577 } 31578 31579 /** 31580 * Reset Typed and optionally restarts 31581 * @param {boolean} restart 31582 * @public 31583 */ 31584 }, { 31585 key: 'reset', 31586 value: function reset() { 31587 var restart = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0]; 31588 31589 clearInterval(this.timeout); 31590 this.replaceText(''); 31591 if (this.cursor && this.cursor.parentNode) { 31592 this.cursor.parentNode.removeChild(this.cursor); 31593 this.cursor = null; 31594 } 31595 this.strPos = 0; 31596 this.arrayPos = 0; 31597 this.curLoop = 0; 31598 if (restart) { 31599 this.insertCursor(); 31600 this.options.onReset(this); 31601 this.begin(); 31602 } 31603 } 31604 31605 /** 31606 * Begins the typing animation 31607 * @private 31608 */ 31609 }, { 31610 key: 'begin', 31611 value: function begin() { 31612 var _this = this; 31613 31614 this.options.onBegin(this); 31615 this.typingComplete = false; 31616 this.shuffleStringsIfNeeded(this); 31617 this.insertCursor(); 31618 if (this.bindInputFocusEvents) this.bindFocusEvents(); 31619 this.timeout = setTimeout(function () { 31620 // Check if there is some text in the element, if yes start by backspacing the default message 31621 if (!_this.currentElContent || _this.currentElContent.length === 0) { 31622 _this.typewrite(_this.strings[_this.sequence[_this.arrayPos]], _this.strPos); 31623 } else { 31624 // Start typing 31625 _this.backspace(_this.currentElContent, _this.currentElContent.length); 31626 } 31627 }, this.startDelay); 31628 } 31629 31630 /** 31631 * Called for each character typed 31632 * @param {string} curString the current string in the strings array 31633 * @param {number} curStrPos the current position in the curString 31634 * @private 31635 */ 31636 }, { 31637 key: 'typewrite', 31638 value: function typewrite(curString, curStrPos) { 31639 var _this2 = this; 31640 31641 if (this.fadeOut && this.el.classList.contains(this.fadeOutClass)) { 31642 this.el.classList.remove(this.fadeOutClass); 31643 if (this.cursor) this.cursor.classList.remove(this.fadeOutClass); 31644 } 31645 31646 var humanize = this.humanizer(this.typeSpeed); 31647 var numChars = 1; 31648 31649 if (this.pause.status === true) { 31650 this.setPauseStatus(curString, curStrPos, true); 31651 return; 31652 } 31653 31654 // contain typing function in a timeout humanize'd delay 31655 this.timeout = setTimeout(function () { 31656 // skip over any HTML chars 31657 curStrPos = _htmlParserJs.htmlParser.typeHtmlChars(curString, curStrPos, _this2); 31658 31659 var pauseTime = 0; 31660 var substr = curString.substr(curStrPos); 31661 // check for an escape character before a pause value 31662 // format: \^\d+ .. eg: ^1000 .. should be able to print the ^ too using ^^ 31663 // single ^ are removed from string 31664 if (substr.charAt(0) === '^') { 31665 if (/^\^\d+/.test(substr)) { 31666 var skip = 1; // skip at least 1 31667 substr = /\d+/.exec(substr)[0]; 31668 skip += substr.length; 31669 pauseTime = parseInt(substr); 31670 _this2.temporaryPause = true; 31671 _this2.options.onTypingPaused(_this2.arrayPos, _this2); 31672 // strip out the escape character and pause value so they're not printed 31673 curString = curString.substring(0, curStrPos) + curString.substring(curStrPos + skip); 31674 _this2.toggleBlinking(true); 31675 } 31676 } 31677 31678 // check for skip characters formatted as 31679 // "this is a `string to print NOW` ..." 31680 if (substr.charAt(0) === '`') { 31681 while (curString.substr(curStrPos + numChars).charAt(0) !== '`') { 31682 numChars++; 31683 if (curStrPos + numChars > curString.length) break; 31684 } 31685 // strip out the escape characters and append all the string in between 31686 var stringBeforeSkip = curString.substring(0, curStrPos); 31687 var stringSkipped = curString.substring(stringBeforeSkip.length + 1, curStrPos + numChars); 31688 var stringAfterSkip = curString.substring(curStrPos + numChars + 1); 31689 curString = stringBeforeSkip + stringSkipped + stringAfterSkip; 31690 numChars--; 31691 } 31692 31693 // timeout for any pause after a character 31694 _this2.timeout = setTimeout(function () { 31695 // Accounts for blinking while paused 31696 _this2.toggleBlinking(false); 31697 31698 // We're done with this sentence! 31699 if (curStrPos >= curString.length) { 31700 _this2.doneTyping(curString, curStrPos); 31701 } else { 31702 _this2.keepTyping(curString, curStrPos, numChars); 31703 } 31704 // end of character pause 31705 if (_this2.temporaryPause) { 31706 _this2.temporaryPause = false; 31707 _this2.options.onTypingResumed(_this2.arrayPos, _this2); 31708 } 31709 }, pauseTime); 31710 31711 // humanized value for typing 31712 }, humanize); 31713 } 31714 31715 /** 31716 * Continue to the next string & begin typing 31717 * @param {string} curString the current string in the strings array 31718 * @param {number} curStrPos the current position in the curString 31719 * @private 31720 */ 31721 }, { 31722 key: 'keepTyping', 31723 value: function keepTyping(curString, curStrPos, numChars) { 31724 // call before functions if applicable 31725 if (curStrPos === 0) { 31726 this.toggleBlinking(false); 31727 this.options.preStringTyped(this.arrayPos, this); 31728 } 31729 // start typing each new char into existing string 31730 // curString: arg, this.el.html: original text inside element 31731 curStrPos += numChars; 31732 var nextString = curString.substr(0, curStrPos); 31733 this.replaceText(nextString); 31734 // loop the function 31735 this.typewrite(curString, curStrPos); 31736 } 31737 31738 /** 31739 * We're done typing the current string 31740 * @param {string} curString the current string in the strings array 31741 * @param {number} curStrPos the current position in the curString 31742 * @private 31743 */ 31744 }, { 31745 key: 'doneTyping', 31746 value: function doneTyping(curString, curStrPos) { 31747 var _this3 = this; 31748 31749 // fires callback function 31750 this.options.onStringTyped(this.arrayPos, this); 31751 this.toggleBlinking(true); 31752 // is this the final string 31753 if (this.arrayPos === this.strings.length - 1) { 31754 // callback that occurs on the last typed string 31755 this.complete(); 31756 // quit if we wont loop back 31757 if (this.loop === false || this.curLoop === this.loopCount) { 31758 return; 31759 } 31760 } 31761 this.timeout = setTimeout(function () { 31762 _this3.backspace(curString, curStrPos); 31763 }, this.backDelay); 31764 } 31765 31766 /** 31767 * Backspaces 1 character at a time 31768 * @param {string} curString the current string in the strings array 31769 * @param {number} curStrPos the current position in the curString 31770 * @private 31771 */ 31772 }, { 31773 key: 'backspace', 31774 value: function backspace(curString, curStrPos) { 31775 var _this4 = this; 31776 31777 if (this.pause.status === true) { 31778 this.setPauseStatus(curString, curStrPos, false); 31779 return; 31780 } 31781 if (this.fadeOut) return this.initFadeOut(); 31782 31783 this.toggleBlinking(false); 31784 var humanize = this.humanizer(this.backSpeed); 31785 31786 this.timeout = setTimeout(function () { 31787 curStrPos = _htmlParserJs.htmlParser.backSpaceHtmlChars(curString, curStrPos, _this4); 31788 // replace text with base text + typed characters 31789 var curStringAtPosition = curString.substr(0, curStrPos); 31790 _this4.replaceText(curStringAtPosition); 31791 31792 // if smartBack is enabled 31793 if (_this4.smartBackspace) { 31794 // the remaining part of the current string is equal of the same part of the new string 31795 var nextString = _this4.strings[_this4.arrayPos + 1]; 31796 if (nextString && curStringAtPosition === nextString.substr(0, curStrPos)) { 31797 _this4.stopNum = curStrPos; 31798 } else { 31799 _this4.stopNum = 0; 31800 } 31801 } 31802 31803 // if the number (id of character in current string) is 31804 // less than the stop number, keep going 31805 if (curStrPos > _this4.stopNum) { 31806 // subtract characters one by one 31807 curStrPos--; 31808 // loop the function 31809 _this4.backspace(curString, curStrPos); 31810 } else if (curStrPos <= _this4.stopNum) { 31811 // if the stop number has been reached, increase 31812 // array position to next string 31813 _this4.arrayPos++; 31814 // When looping, begin at the beginning after backspace complete 31815 if (_this4.arrayPos === _this4.strings.length) { 31816 _this4.arrayPos = 0; 31817 _this4.options.onLastStringBackspaced(); 31818 _this4.shuffleStringsIfNeeded(); 31819 _this4.begin(); 31820 } else { 31821 _this4.typewrite(_this4.strings[_this4.sequence[_this4.arrayPos]], curStrPos); 31822 } 31823 } 31824 // humanized value for typing 31825 }, humanize); 31826 } 31827 31828 /** 31829 * Full animation is complete 31830 * @private 31831 */ 31832 }, { 31833 key: 'complete', 31834 value: function complete() { 31835 this.options.onComplete(this); 31836 if (this.loop) { 31837 this.curLoop++; 31838 } else { 31839 this.typingComplete = true; 31840 } 31841 } 31842 31843 /** 31844 * Has the typing been stopped 31845 * @param {string} curString the current string in the strings array 31846 * @param {number} curStrPos the current position in the curString 31847 * @param {boolean} isTyping 31848 * @private 31849 */ 31850 }, { 31851 key: 'setPauseStatus', 31852 value: function setPauseStatus(curString, curStrPos, isTyping) { 31853 this.pause.typewrite = isTyping; 31854 this.pause.curString = curString; 31855 this.pause.curStrPos = curStrPos; 31856 } 31857 31858 /** 31859 * Toggle the blinking cursor 31860 * @param {boolean} isBlinking 31861 * @private 31862 */ 31863 }, { 31864 key: 'toggleBlinking', 31865 value: function toggleBlinking(isBlinking) { 31866 if (!this.cursor) return; 31867 // if in paused state, don't toggle blinking a 2nd time 31868 if (this.pause.status) return; 31869 if (this.cursorBlinking === isBlinking) return; 31870 this.cursorBlinking = isBlinking; 31871 if (isBlinking) { 31872 this.cursor.classList.add('typed-cursor--blink'); 31873 } else { 31874 this.cursor.classList.remove('typed-cursor--blink'); 31875 } 31876 } 31877 31878 /** 31879 * Speed in MS to type 31880 * @param {number} speed 31881 * @private 31882 */ 31883 }, { 31884 key: 'humanizer', 31885 value: function humanizer(speed) { 31886 return Math.round(Math.random() * speed / 2) + speed; 31887 } 31888 31889 /** 31890 * Shuffle the sequence of the strings array 31891 * @private 31892 */ 31893 }, { 31894 key: 'shuffleStringsIfNeeded', 31895 value: function shuffleStringsIfNeeded() { 31896 if (!this.shuffle) return; 31897 this.sequence = this.sequence.sort(function () { 31898 return Math.random() - 0.5; 31899 }); 31900 } 31901 31902 /** 31903 * Adds a CSS class to fade out current string 31904 * @private 31905 */ 31906 }, { 31907 key: 'initFadeOut', 31908 value: function initFadeOut() { 31909 var _this5 = this; 31910 31911 this.el.className += ' ' + this.fadeOutClass; 31912 if (this.cursor) this.cursor.className += ' ' + this.fadeOutClass; 31913 return setTimeout(function () { 31914 _this5.arrayPos++; 31915 _this5.replaceText(''); 31916 31917 // Resets current string if end of loop reached 31918 if (_this5.strings.length > _this5.arrayPos) { 31919 _this5.typewrite(_this5.strings[_this5.sequence[_this5.arrayPos]], 0); 31920 } else { 31921 _this5.typewrite(_this5.strings[0], 0); 31922 _this5.arrayPos = 0; 31923 } 31924 }, this.fadeOutDelay); 31925 } 31926 31927 /** 31928 * Replaces current text in the HTML element 31929 * depending on element type 31930 * @param {string} str 31931 * @private 31932 */ 31933 }, { 31934 key: 'replaceText', 31935 value: function replaceText(str) { 31936 if (this.attr) { 31937 this.el.setAttribute(this.attr, str); 31938 } else { 31939 if (this.isInput) { 31940 this.el.value = str; 31941 } else if (this.contentType === 'html') { 31942 this.el.innerHTML = str; 31943 } else { 31944 this.el.textContent = str; 31945 } 31946 } 31947 } 31948 31949 /** 31950 * If using input elements, bind focus in order to 31951 * start and stop the animation 31952 * @private 31953 */ 31954 }, { 31955 key: 'bindFocusEvents', 31956 value: function bindFocusEvents() { 31957 var _this6 = this; 31958 31959 if (!this.isInput) return; 31960 this.el.addEventListener('focus', function (e) { 31961 _this6.stop(); 31962 }); 31963 this.el.addEventListener('blur', function (e) { 31964 if (_this6.el.value && _this6.el.value.length !== 0) { 31965 return; 31966 } 31967 _this6.start(); 31968 }); 31969 } 31970 31971 /** 31972 * On init, insert the cursor element 31973 * @private 31974 */ 31975 }, { 31976 key: 'insertCursor', 31977 value: function insertCursor() { 31978 if (!this.showCursor) return; 31979 if (this.cursor) return; 31980 this.cursor = document.createElement('span'); 31981 this.cursor.className = 'typed-cursor'; 31982 this.cursor.setAttribute('aria-hidden', true); 31983 this.cursor.innerHTML = this.cursorChar; 31984 this.el.parentNode && this.el.parentNode.insertBefore(this.cursor, this.el.nextSibling); 31985 } 31986 }]); 31987 31988 return Typed; 31989 })(); 31990 31991 exports['default'] = Typed; 31992 module.exports = exports['default']; 31993 31994/***/ }), 31995/* 1 */ 31996/***/ (function(module, exports, __nested_webpack_require_18228__) { 31997 31998 'use strict'; 31999 32000 Object.defineProperty(exports, '__esModule', { 32001 value: true 32002 }); 32003 32004 var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; 32005 32006 var _createClass = (function () { function 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); 32007 32008 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } 32009 32010 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 32011 32012 var _defaultsJs = __nested_webpack_require_18228__(2); 32013 32014 var _defaultsJs2 = _interopRequireDefault(_defaultsJs); 32015 32016 /** 32017 * Initialize the Typed object 32018 */ 32019 32020 var Initializer = (function () { 32021 function Initializer() { 32022 _classCallCheck(this, Initializer); 32023 } 32024 32025 _createClass(Initializer, [{ 32026 key: 'load', 32027 32028 /** 32029 * Load up defaults & options on the Typed instance 32030 * @param {Typed} self instance of Typed 32031 * @param {object} options options object 32032 * @param {string} elementId HTML element ID _OR_ instance of HTML element 32033 * @private 32034 */ 32035 32036 value: function load(self, options, elementId) { 32037 // chosen element to manipulate text 32038 if (typeof elementId === 'string') { 32039 self.el = document.querySelector(elementId); 32040 } else { 32041 self.el = elementId; 32042 } 32043 32044 self.options = _extends({}, _defaultsJs2['default'], options); 32045 32046 // attribute to type into 32047 self.isInput = self.el.tagName.toLowerCase() === 'input'; 32048 self.attr = self.options.attr; 32049 self.bindInputFocusEvents = self.options.bindInputFocusEvents; 32050 32051 // show cursor 32052 self.showCursor = self.isInput ? false : self.options.showCursor; 32053 32054 // custom cursor 32055 self.cursorChar = self.options.cursorChar; 32056 32057 // Is the cursor blinking 32058 self.cursorBlinking = true; 32059 32060 // text content of element 32061 self.elContent = self.attr ? self.el.getAttribute(self.attr) : self.el.textContent; 32062 32063 // html or plain text 32064 self.contentType = self.options.contentType; 32065 32066 // typing speed 32067 self.typeSpeed = self.options.typeSpeed; 32068 32069 // add a delay before typing starts 32070 self.startDelay = self.options.startDelay; 32071 32072 // backspacing speed 32073 self.backSpeed = self.options.backSpeed; 32074 32075 // only backspace what doesn't match the previous string 32076 self.smartBackspace = self.options.smartBackspace; 32077 32078 // amount of time to wait before backspacing 32079 self.backDelay = self.options.backDelay; 32080 32081 // Fade out instead of backspace 32082 self.fadeOut = self.options.fadeOut; 32083 self.fadeOutClass = self.options.fadeOutClass; 32084 self.fadeOutDelay = self.options.fadeOutDelay; 32085 32086 // variable to check whether typing is currently paused 32087 self.isPaused = false; 32088 32089 // input strings of text 32090 self.strings = self.options.strings.map(function (s) { 32091 return s.trim(); 32092 }); 32093 32094 // div containing strings 32095 if (typeof self.options.stringsElement === 'string') { 32096 self.stringsElement = document.querySelector(self.options.stringsElement); 32097 } else { 32098 self.stringsElement = self.options.stringsElement; 32099 } 32100 32101 if (self.stringsElement) { 32102 self.strings = []; 32103 self.stringsElement.style.display = 'none'; 32104 var strings = Array.prototype.slice.apply(self.stringsElement.children); 32105 var stringsLength = strings.length; 32106 32107 if (stringsLength) { 32108 for (var i = 0; i < stringsLength; i += 1) { 32109 var stringEl = strings[i]; 32110 self.strings.push(stringEl.innerHTML.trim()); 32111 } 32112 } 32113 } 32114 32115 // character number position of current string 32116 self.strPos = 0; 32117 32118 // current array position 32119 self.arrayPos = 0; 32120 32121 // index of string to stop backspacing on 32122 self.stopNum = 0; 32123 32124 // Looping logic 32125 self.loop = self.options.loop; 32126 self.loopCount = self.options.loopCount; 32127 self.curLoop = 0; 32128 32129 // shuffle the strings 32130 self.shuffle = self.options.shuffle; 32131 // the order of strings 32132 self.sequence = []; 32133 32134 self.pause = { 32135 status: false, 32136 typewrite: true, 32137 curString: '', 32138 curStrPos: 0 32139 }; 32140 32141 // When the typing is complete (when not looped) 32142 self.typingComplete = false; 32143 32144 // Set the order in which the strings are typed 32145 for (var i in self.strings) { 32146 self.sequence[i] = i; 32147 } 32148 32149 // If there is some text in the element 32150 self.currentElContent = this.getCurrentElContent(self); 32151 32152 self.autoInsertCss = self.options.autoInsertCss; 32153 32154 this.appendAnimationCss(self); 32155 } 32156 }, { 32157 key: 'getCurrentElContent', 32158 value: function getCurrentElContent(self) { 32159 var elContent = ''; 32160 if (self.attr) { 32161 elContent = self.el.getAttribute(self.attr); 32162 } else if (self.isInput) { 32163 elContent = self.el.value; 32164 } else if (self.contentType === 'html') { 32165 elContent = self.el.innerHTML; 32166 } else { 32167 elContent = self.el.textContent; 32168 } 32169 return elContent; 32170 } 32171 }, { 32172 key: 'appendAnimationCss', 32173 value: function appendAnimationCss(self) { 32174 var cssDataName = 'data-typed-js-css'; 32175 if (!self.autoInsertCss) { 32176 return; 32177 } 32178 if (!self.showCursor && !self.fadeOut) { 32179 return; 32180 } 32181 if (document.querySelector('[' + cssDataName + ']')) { 32182 return; 32183 } 32184 32185 var css = document.createElement('style'); 32186 css.type = 'text/css'; 32187 css.setAttribute(cssDataName, true); 32188 32189 var innerCss = ''; 32190 if (self.showCursor) { 32191 innerCss += '\n .typed-cursor{\n opacity: 1;\n }\n .typed-cursor.typed-cursor--blink{\n animation: typedjsBlink 0.7s infinite;\n -webkit-animation: typedjsBlink 0.7s infinite;\n animation: typedjsBlink 0.7s infinite;\n }\n @keyframes typedjsBlink{\n 50% { opacity: 0.0; }\n }\n @-webkit-keyframes typedjsBlink{\n 0% { opacity: 1; }\n 50% { opacity: 0.0; }\n 100% { opacity: 1; }\n }\n '; 32192 } 32193 if (self.fadeOut) { 32194 innerCss += '\n .typed-fade-out{\n opacity: 0;\n transition: opacity .25s;\n }\n .typed-cursor.typed-cursor--blink.typed-fade-out{\n -webkit-animation: 0;\n animation: 0;\n }\n '; 32195 } 32196 if (css.length === 0) { 32197 return; 32198 } 32199 css.innerHTML = innerCss; 32200 document.body.appendChild(css); 32201 } 32202 }]); 32203 32204 return Initializer; 32205 })(); 32206 32207 exports['default'] = Initializer; 32208 var initializer = new Initializer(); 32209 exports.initializer = initializer; 32210 32211/***/ }), 32212/* 2 */ 32213/***/ (function(module, exports) { 32214 32215 /** 32216 * Defaults & options 32217 * @returns {object} Typed defaults & options 32218 * @public 32219 */ 32220 32221 'use strict'; 32222 32223 Object.defineProperty(exports, '__esModule', { 32224 value: true 32225 }); 32226 var defaults = { 32227 /** 32228 * @property {array} strings strings to be typed 32229 * @property {string} stringsElement ID of element containing string children 32230 */ 32231 strings: ['These are the default values...', 'You know what you should do?', 'Use your own!', 'Have a great day!'], 32232 stringsElement: null, 32233 32234 /** 32235 * @property {number} typeSpeed type speed in milliseconds 32236 */ 32237 typeSpeed: 0, 32238 32239 /** 32240 * @property {number} startDelay time before typing starts in milliseconds 32241 */ 32242 startDelay: 0, 32243 32244 /** 32245 * @property {number} backSpeed backspacing speed in milliseconds 32246 */ 32247 backSpeed: 0, 32248 32249 /** 32250 * @property {boolean} smartBackspace only backspace what doesn't match the previous string 32251 */ 32252 smartBackspace: true, 32253 32254 /** 32255 * @property {boolean} shuffle shuffle the strings 32256 */ 32257 shuffle: false, 32258 32259 /** 32260 * @property {number} backDelay time before backspacing in milliseconds 32261 */ 32262 backDelay: 700, 32263 32264 /** 32265 * @property {boolean} fadeOut Fade out instead of backspace 32266 * @property {string} fadeOutClass css class for fade animation 32267 * @property {boolean} fadeOutDelay Fade out delay in milliseconds 32268 */ 32269 fadeOut: false, 32270 fadeOutClass: 'typed-fade-out', 32271 fadeOutDelay: 500, 32272 32273 /** 32274 * @property {boolean} loop loop strings 32275 * @property {number} loopCount amount of loops 32276 */ 32277 loop: false, 32278 loopCount: Infinity, 32279 32280 /** 32281 * @property {boolean} showCursor show cursor 32282 * @property {string} cursorChar character for cursor 32283 * @property {boolean} autoInsertCss insert CSS for cursor and fadeOut into HTML <head> 32284 */ 32285 showCursor: true, 32286 cursorChar: '|', 32287 autoInsertCss: true, 32288 32289 /** 32290 * @property {string} attr attribute for typing 32291 * Ex: input placeholder, value, or just HTML text 32292 */ 32293 attr: null, 32294 32295 /** 32296 * @property {boolean} bindInputFocusEvents bind to focus and blur if el is text input 32297 */ 32298 bindInputFocusEvents: false, 32299 32300 /** 32301 * @property {string} contentType 'html' or 'null' for plaintext 32302 */ 32303 contentType: 'html', 32304 32305 /** 32306 * Before it begins typing 32307 * @param {Typed} self 32308 */ 32309 onBegin: function onBegin(self) {}, 32310 32311 /** 32312 * All typing is complete 32313 * @param {Typed} self 32314 */ 32315 onComplete: function onComplete(self) {}, 32316 32317 /** 32318 * Before each string is typed 32319 * @param {number} arrayPos 32320 * @param {Typed} self 32321 */ 32322 preStringTyped: function preStringTyped(arrayPos, self) {}, 32323 32324 /** 32325 * After each string is typed 32326 * @param {number} arrayPos 32327 * @param {Typed} self 32328 */ 32329 onStringTyped: function onStringTyped(arrayPos, self) {}, 32330 32331 /** 32332 * During looping, after last string is typed 32333 * @param {Typed} self 32334 */ 32335 onLastStringBackspaced: function onLastStringBackspaced(self) {}, 32336 32337 /** 32338 * Typing has been stopped 32339 * @param {number} arrayPos 32340 * @param {Typed} self 32341 */ 32342 onTypingPaused: function onTypingPaused(arrayPos, self) {}, 32343 32344 /** 32345 * Typing has been started after being stopped 32346 * @param {number} arrayPos 32347 * @param {Typed} self 32348 */ 32349 onTypingResumed: function onTypingResumed(arrayPos, self) {}, 32350 32351 /** 32352 * After reset 32353 * @param {Typed} self 32354 */ 32355 onReset: function onReset(self) {}, 32356 32357 /** 32358 * After stop 32359 * @param {number} arrayPos 32360 * @param {Typed} self 32361 */ 32362 onStop: function onStop(arrayPos, self) {}, 32363 32364 /** 32365 * After start 32366 * @param {number} arrayPos 32367 * @param {Typed} self 32368 */ 32369 onStart: function onStart(arrayPos, self) {}, 32370 32371 /** 32372 * After destroy 32373 * @param {Typed} self 32374 */ 32375 onDestroy: function onDestroy(self) {} 32376 }; 32377 32378 exports['default'] = defaults; 32379 module.exports = exports['default']; 32380 32381/***/ }), 32382/* 3 */ 32383/***/ (function(module, exports) { 32384 32385 /** 32386 * TODO: These methods can probably be combined somehow 32387 * Parse HTML tags & HTML Characters 32388 */ 32389 32390 'use strict'; 32391 32392 Object.defineProperty(exports, '__esModule', { 32393 value: true 32394 }); 32395 32396 var _createClass = (function () { function 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); 32397 32398 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 32399 32400 var HTMLParser = (function () { 32401 function HTMLParser() { 32402 _classCallCheck(this, HTMLParser); 32403 } 32404 32405 _createClass(HTMLParser, [{ 32406 key: 'typeHtmlChars', 32407 32408 /** 32409 * Type HTML tags & HTML Characters 32410 * @param {string} curString Current string 32411 * @param {number} curStrPos Position in current string 32412 * @param {Typed} self instance of Typed 32413 * @returns {number} a new string position 32414 * @private 32415 */ 32416 32417 value: function typeHtmlChars(curString, curStrPos, self) { 32418 if (self.contentType !== 'html') return curStrPos; 32419 var curChar = curString.substr(curStrPos).charAt(0); 32420 if (curChar === '<' || curChar === '&') { 32421 var endTag = ''; 32422 if (curChar === '<') { 32423 endTag = '>'; 32424 } else { 32425 endTag = ';'; 32426 } 32427 while (curString.substr(curStrPos + 1).charAt(0) !== endTag) { 32428 curStrPos++; 32429 if (curStrPos + 1 > curString.length) { 32430 break; 32431 } 32432 } 32433 curStrPos++; 32434 } 32435 return curStrPos; 32436 } 32437 32438 /** 32439 * Backspace HTML tags and HTML Characters 32440 * @param {string} curString Current string 32441 * @param {number} curStrPos Position in current string 32442 * @param {Typed} self instance of Typed 32443 * @returns {number} a new string position 32444 * @private 32445 */ 32446 }, { 32447 key: 'backSpaceHtmlChars', 32448 value: function backSpaceHtmlChars(curString, curStrPos, self) { 32449 if (self.contentType !== 'html') return curStrPos; 32450 var curChar = curString.substr(curStrPos).charAt(0); 32451 if (curChar === '>' || curChar === ';') { 32452 var endTag = ''; 32453 if (curChar === '>') { 32454 endTag = '<'; 32455 } else { 32456 endTag = '&'; 32457 } 32458 while (curString.substr(curStrPos - 1).charAt(0) !== endTag) { 32459 curStrPos--; 32460 if (curStrPos < 0) { 32461 break; 32462 } 32463 } 32464 curStrPos--; 32465 } 32466 return curStrPos; 32467 } 32468 }]); 32469 32470 return HTMLParser; 32471 })(); 32472 32473 exports['default'] = HTMLParser; 32474 var htmlParser = new HTMLParser(); 32475 exports.htmlParser = htmlParser; 32476 32477/***/ }) 32478/******/ ]) 32479}); 32480; 32481 32482/***/ }), 32483
vendor: 18,215 bytes, lines 32484-33153
32484/***/ "./node_modules/waypoints/lib/jquery.waypoints.js": 32485/*!********************************************************!*\ 32486 !*** ./node_modules/waypoints/lib/jquery.waypoints.js ***! 32487 \********************************************************/ 32488/***/ (() => { 32489 32490/*! 32491Waypoints - 4.0.1 32492Copyright © 2011-2016 Caleb Troughton 32493Licensed under the MIT license. 32494https://github.com/imakewebthings/waypoints/blob/master/licenses.txt 32495*/ 32496(function() { 32497 'use strict' 32498 32499 var keyCounter = 0 32500 var allWaypoints = {} 32501 32502 /* http://imakewebthings.com/waypoints/api/waypoint */ 32503 function Waypoint(options) { 32504 if (!options) { 32505 throw new Error('No options passed to Waypoint constructor') 32506 } 32507 if (!options.element) { 32508 throw new Error('No element option passed to Waypoint constructor') 32509 } 32510 if (!options.handler) { 32511 throw new Error('No handler option passed to Waypoint constructor') 32512 } 32513 32514 this.key = 'waypoint-' + keyCounter 32515 this.options = Waypoint.Adapter.extend({}, Waypoint.defaults, options) 32516 this.element = this.options.element 32517 this.adapter = new Waypoint.Adapter(this.element) 32518 this.callback = options.handler 32519 this.axis = this.options.horizontal ? 'horizontal' : 'vertical' 32520 this.enabled = this.options.enabled 32521 this.triggerPoint = null 32522 this.group = Waypoint.Group.findOrCreate({ 32523 name: this.options.group, 32524 axis: this.axis 32525 }) 32526 this.context = Waypoint.Context.findOrCreateByElement(this.options.context) 32527 32528 if (Waypoint.offsetAliases[this.options.offset]) { 32529 this.options.offset = Waypoint.offsetAliases[this.options.offset] 32530 } 32531 this.group.add(this) 32532 this.context.add(this) 32533 allWaypoints[this.key] = this 32534 keyCounter += 1 32535 } 32536 32537 /* Private */ 32538 Waypoint.prototype.queueTrigger = function(direction) { 32539 this.group.queueTrigger(this, direction) 32540 } 32541 32542 /* Private */ 32543 Waypoint.prototype.trigger = function(args) { 32544 if (!this.enabled) { 32545 return 32546 } 32547 if (this.callback) { 32548 this.callback.apply(this, args) 32549 } 32550 } 32551 32552 /* Public */ 32553 /* http://imakewebthings.com/waypoints/api/destroy */ 32554 Waypoint.prototype.destroy = function() { 32555 this.context.remove(this) 32556 this.group.remove(this) 32557 delete allWaypoints[this.key] 32558 } 32559 32560 /* Public */ 32561 /* http://imakewebthings.com/waypoints/api/disable */ 32562 Waypoint.prototype.disable = function() { 32563 this.enabled = false 32564 return this 32565 } 32566 32567 /* Public */ 32568 /* http://imakewebthings.com/waypoints/api/enable */ 32569 Waypoint.prototype.enable = function() { 32570 this.context.refresh() 32571 this.enabled = true 32572 return this 32573 } 32574 32575 /* Public */ 32576 /* http://imakewebthings.com/waypoints/api/next */ 32577 Waypoint.prototype.next = function() { 32578 return this.group.next(this) 32579 } 32580 32581 /* Public */ 32582 /* http://imakewebthings.com/waypoints/api/previous */ 32583 Waypoint.prototype.previous = function() { 32584 return this.group.previous(this) 32585 } 32586 32587 /* Private */ 32588 Waypoint.invokeAll = function(method) { 32589 var allWaypointsArray = [] 32590 for (var waypointKey in allWaypoints) { 32591 allWaypointsArray.push(allWaypoints[waypointKey]) 32592 } 32593 for (var i = 0, end = allWaypointsArray.length; i < end; i++) { 32594 allWaypointsArray[i][method]() 32595 } 32596 } 32597 32598 /* Public */ 32599 /* http://imakewebthings.com/waypoints/api/destroy-all */ 32600 Waypoint.destroyAll = function() { 32601 Waypoint.invokeAll('destroy') 32602 } 32603 32604 /* Public */ 32605 /* http://imakewebthings.com/waypoints/api/disable-all */ 32606 Waypoint.disableAll = function() { 32607 Waypoint.invokeAll('disable') 32608 } 32609 32610 /* Public */ 32611 /* http://imakewebthings.com/waypoints/api/enable-all */ 32612 Waypoint.enableAll = function() { 32613 Waypoint.Context.refreshAll() 32614 for (var waypointKey in allWaypoints) { 32615 allWaypoints[waypointKey].enabled = true 32616 } 32617 return this 32618 } 32619 32620 /* Public */ 32621 /* http://imakewebthings.com/waypoints/api/refresh-all */ 32622 Waypoint.refreshAll = function() { 32623 Waypoint.Context.refreshAll() 32624 } 32625 32626 /* Public */ 32627 /* http://imakewebthings.com/waypoints/api/viewport-height */ 32628 Waypoint.viewportHeight = function() { 32629 return window.innerHeight || document.documentElement.clientHeight 32630 } 32631 32632 /* Public */ 32633 /* http://imakewebthings.com/waypoints/api/viewport-width */ 32634 Waypoint.viewportWidth = function() { 32635 return document.documentElement.clientWidth 32636 } 32637 32638 Waypoint.adapters = [] 32639 32640 Waypoint.defaults = { 32641 context: window, 32642 continuous: true, 32643 enabled: true, 32644 group: 'default', 32645 horizontal: false, 32646 offset: 0 32647 } 32648 32649 Waypoint.offsetAliases = { 32650 'bottom-in-view': function() { 32651 return this.context.innerHeight() - this.adapter.outerHeight() 32652 }, 32653 'right-in-view': function() { 32654 return this.context.innerWidth() - this.adapter.outerWidth() 32655 } 32656 } 32657 32658 window.Waypoint = Waypoint 32659}()) 32660;(function() { 32661 'use strict' 32662 32663 function requestAnimationFrameShim(callback) { 32664 window.setTimeout(callback, 1000 / 60) 32665 } 32666 32667 var keyCounter = 0 32668 var contexts = {} 32669 var Waypoint = window.Waypoint 32670 var oldWindowLoad = window.onload 32671 32672 /* http://imakewebthings.com/waypoints/api/context */ 32673 function Context(element) { 32674 this.element = element 32675 this.Adapter = Waypoint.Adapter 32676 this.adapter = new this.Adapter(element) 32677 this.key = 'waypoint-context-' + keyCounter 32678 this.didScroll = false 32679 this.didResize = false 32680 this.oldScroll = { 32681 x: this.adapter.scrollLeft(), 32682 y: this.adapter.scrollTop() 32683 } 32684 this.waypoints = { 32685 vertical: {}, 32686 horizontal: {} 32687 } 32688 32689 element.waypointContextKey = this.key 32690 contexts[element.waypointContextKey] = this 32691 keyCounter += 1 32692 if (!Waypoint.windowContext) { 32693 Waypoint.windowContext = true 32694 Waypoint.windowContext = new Context(window) 32695 } 32696 32697 this.createThrottledScrollHandler() 32698 this.createThrottledResizeHandler() 32699 } 32700 32701 /* Private */ 32702 Context.prototype.add = function(waypoint) { 32703 var axis = waypoint.options.horizontal ? 'horizontal' : 'vertical' 32704 this.waypoints[axis][waypoint.key] = waypoint 32705 this.refresh() 32706 } 32707 32708 /* Private */ 32709 Context.prototype.checkEmpty = function() { 32710 var horizontalEmpty = this.Adapter.isEmptyObject(this.waypoints.horizontal) 32711 var verticalEmpty = this.Adapter.isEmptyObject(this.waypoints.vertical) 32712 var isWindow = this.element == this.element.window 32713 if (horizontalEmpty && verticalEmpty && !isWindow) { 32714 this.adapter.off('.waypoints') 32715 delete contexts[this.key] 32716 } 32717 } 32718 32719 /* Private */ 32720 Context.prototype.createThrottledResizeHandler = function() { 32721 var self = this 32722 32723 function resizeHandler() { 32724 self.handleResize() 32725 self.didResize = false 32726 } 32727 32728 this.adapter.on('resize.waypoints', function() { 32729 if (!self.didResize) { 32730 self.didResize = true 32731 Waypoint.requestAnimationFrame(resizeHandler) 32732 } 32733 }) 32734 } 32735 32736 /* Private */ 32737 Context.prototype.createThrottledScrollHandler = function() { 32738 var self = this 32739 function scrollHandler() { 32740 self.handleScroll() 32741 self.didScroll = false 32742 } 32743 32744 this.adapter.on('scroll.waypoints', function() { 32745 if (!self.didScroll || Waypoint.isTouch) { 32746 self.didScroll = true 32747 Waypoint.requestAnimationFrame(scrollHandler) 32748 } 32749 }) 32750 } 32751 32752 /* Private */ 32753 Context.prototype.handleResize = function() { 32754 Waypoint.Context.refreshAll() 32755 } 32756 32757 /* Private */ 32758 Context.prototype.handleScroll = function() { 32759 var triggeredGroups = {} 32760 var axes = { 32761 horizontal: { 32762 newScroll: this.adapter.scrollLeft(), 32763 oldScroll: this.oldScroll.x, 32764 forward: 'right', 32765 backward: 'left' 32766 }, 32767 vertical: { 32768 newScroll: this.adapter.scrollTop(), 32769 oldScroll: this.oldScroll.y, 32770 forward: 'down', 32771 backward: 'up' 32772 } 32773 } 32774 32775 for (var axisKey in axes) { 32776 var axis = axes[axisKey] 32777 var isForward = axis.newScroll > axis.oldScroll 32778 var direction = isForward ? axis.forward : axis.backward 32779 32780 for (var waypointKey in this.waypoints[axisKey]) { 32781 var waypoint = this.waypoints[axisKey][waypointKey] 32782 if (waypoint.triggerPoint === null) { 32783 continue 32784 } 32785 var wasBeforeTriggerPoint = axis.oldScroll < waypoint.triggerPoint 32786 var nowAfterTriggerPoint = axis.newScroll >= waypoint.triggerPoint 32787 var crossedForward = wasBeforeTriggerPoint && nowAfterTriggerPoint 32788 var crossedBackward = !wasBeforeTriggerPoint && !nowAfterTriggerPoint 32789 if (crossedForward || crossedBackward) { 32790 waypoint.queueTrigger(direction) 32791 triggeredGroups[waypoint.group.id] = waypoint.group 32792 } 32793 } 32794 } 32795 32796 for (var groupKey in triggeredGroups) { 32797 triggeredGroups[groupKey].flushTriggers() 32798 } 32799 32800 this.oldScroll = { 32801 x: axes.horizontal.newScroll, 32802 y: axes.vertical.newScroll 32803 } 32804 } 32805 32806 /* Private */ 32807 Context.prototype.innerHeight = function() { 32808 /*eslint-disable eqeqeq */ 32809 if (this.element == this.element.window) { 32810 return Waypoint.viewportHeight() 32811 } 32812 /*eslint-enable eqeqeq */ 32813 return this.adapter.innerHeight() 32814 } 32815 32816 /* Private */ 32817 Context.prototype.remove = function(waypoint) { 32818 delete this.waypoints[waypoint.axis][waypoint.key] 32819 this.checkEmpty() 32820 } 32821 32822 /* Private */ 32823 Context.prototype.innerWidth = function() { 32824 /*eslint-disable eqeqeq */ 32825 if (this.element == this.element.window) { 32826 return Waypoint.viewportWidth() 32827 } 32828 /*eslint-enable eqeqeq */ 32829 return this.adapter.innerWidth() 32830 } 32831 32832 /* Public */ 32833 /* http://imakewebthings.com/waypoints/api/context-destroy */ 32834 Context.prototype.destroy = function() { 32835 var allWaypoints = [] 32836 for (var axis in this.waypoints) { 32837 for (var waypointKey in this.waypoints[axis]) { 32838 allWaypoints.push(this.waypoints[axis][waypointKey]) 32839 } 32840 } 32841 for (var i = 0, end = allWaypoints.length; i < end; i++) { 32842 allWaypoints[i].destroy() 32843 } 32844 } 32845 32846 /* Public */ 32847 /* http://imakewebthings.com/waypoints/api/context-refresh */ 32848 Context.prototype.refresh = function() { 32849 /*eslint-disable eqeqeq */ 32850 var isWindow = this.element == this.element.window 32851 /*eslint-enable eqeqeq */ 32852 var contextOffset = isWindow ? undefined : this.adapter.offset() 32853 var triggeredGroups = {} 32854 var axes 32855 32856 this.handleScroll() 32857 axes = { 32858 horizontal: { 32859 contextOffset: isWindow ? 0 : contextOffset.left, 32860 contextScroll: isWindow ? 0 : this.oldScroll.x, 32861 contextDimension: this.innerWidth(), 32862 oldScroll: this.oldScroll.x, 32863 forward: 'right', 32864 backward: 'left', 32865 offsetProp: 'left' 32866 }, 32867 vertical: { 32868 contextOffset: isWindow ? 0 : contextOffset.top, 32869 contextScroll: isWindow ? 0 : this.oldScroll.y, 32870 contextDimension: this.innerHeight(), 32871 oldScroll: this.oldScroll.y, 32872 forward: 'down', 32873 backward: 'up', 32874 offsetProp: 'top' 32875 } 32876 } 32877 32878 for (var axisKey in axes) { 32879 var axis = axes[axisKey] 32880 for (var waypointKey in this.waypoints[axisKey]) { 32881 var waypoint = this.waypoints[axisKey][waypointKey] 32882 var adjustment = waypoint.options.offset 32883 var oldTriggerPoint = waypoint.triggerPoint 32884 var elementOffset = 0 32885 var freshWaypoint = oldTriggerPoint == null 32886 var contextModifier, wasBeforeScroll, nowAfterScroll 32887 var triggeredBackward, triggeredForward 32888 32889 if (waypoint.element !== waypoint.element.window) { 32890 elementOffset = waypoint.adapter.offset()[axis.offsetProp] 32891 } 32892 32893 if (typeof adjustment === 'function') { 32894 adjustment = adjustment.apply(waypoint) 32895 } 32896 else if (typeof adjustment === 'string') { 32897 adjustment = parseFloat(adjustment) 32898 if (waypoint.options.offset.indexOf('%') > - 1) { 32899 adjustment = Math.ceil(axis.contextDimension * adjustment / 100) 32900 } 32901 } 32902 32903 contextModifier = axis.contextScroll - axis.contextOffset 32904 waypoint.triggerPoint = Math.floor(elementOffset + contextModifier - adjustment) 32905 wasBeforeScroll = oldTriggerPoint < axis.oldScroll 32906 nowAfterScroll = waypoint.triggerPoint >= axis.oldScroll 32907 triggeredBackward = wasBeforeScroll && nowAfterScroll 32908 triggeredForward = !wasBeforeScroll && !nowAfterScroll 32909 32910 if (!freshWaypoint && triggeredBackward) { 32911 waypoint.queueTrigger(axis.backward) 32912 triggeredGroups[waypoint.group.id] = waypoint.group 32913 } 32914 else if (!freshWaypoint && triggeredForward) { 32915 waypoint.queueTrigger(axis.forward) 32916 triggeredGroups[waypoint.group.id] = waypoint.group 32917 } 32918 else if (freshWaypoint && axis.oldScroll >= waypoint.triggerPoint) { 32919 waypoint.queueTrigger(axis.forward) 32920 triggeredGroups[waypoint.group.id] = waypoint.group 32921 } 32922 } 32923 } 32924 32925 Waypoint.requestAnimationFrame(function() { 32926 for (var groupKey in triggeredGroups) { 32927 triggeredGroups[groupKey].flushTriggers() 32928 } 32929 }) 32930 32931 return this 32932 } 32933 32934 /* Private */ 32935 Context.findOrCreateByElement = function(element) { 32936 return Context.findByElement(element) || new Context(element) 32937 } 32938 32939 /* Private */ 32940 Context.refreshAll = function() { 32941 for (var contextId in contexts) { 32942 contexts[contextId].refresh() 32943 } 32944 } 32945 32946 /* Public */ 32947 /* http://imakewebthings.com/waypoints/api/context-find-by-element */ 32948 Context.findByElement = function(element) { 32949 return contexts[element.waypointContextKey] 32950 } 32951 32952 window.onload = function() { 32953 if (oldWindowLoad) { 32954 oldWindowLoad() 32955 } 32956 Context.refreshAll() 32957 } 32958 32959 32960 Waypoint.requestAnimationFrame = function(callback) { 32961 var requestFn = window.requestAnimationFrame || 32962 window.mozRequestAnimationFrame || 32963 window.webkitRequestAnimationFrame || 32964 requestAnimationFrameShim 32965 requestFn.call(window, callback) 32966 } 32967 Waypoint.Context = Context 32968}()) 32969;(function() { 32970 'use strict' 32971 32972 function byTriggerPoint(a, b) { 32973 return a.triggerPoint - b.triggerPoint 32974 } 32975 32976 function byReverseTriggerPoint(a, b) { 32977 return b.triggerPoint - a.triggerPoint 32978 } 32979 32980 var groups = { 32981 vertical: {}, 32982 horizontal: {} 32983 } 32984 var Waypoint = window.Waypoint 32985 32986 /* http://imakewebthings.com/waypoints/api/group */ 32987 function Group(options) { 32988 this.name = options.name 32989 this.axis = options.axis 32990 this.id = this.name + '-' + this.axis 32991 this.waypoints = [] 32992 this.clearTriggerQueues() 32993 groups[this.axis][this.name] = this 32994 } 32995 32996 /* Private */ 32997 Group.prototype.add = function(waypoint) { 32998 this.waypoints.push(waypoint) 32999 } 33000 33001 /* Private */ 33002 Group.prototype.clearTriggerQueues = function() { 33003 this.triggerQueues = { 33004 up: [], 33005 down: [], 33006 left: [], 33007 right: [] 33008 } 33009 } 33010 33011 /* Private */ 33012 Group.prototype.flushTriggers = function() { 33013 for (var direction in this.triggerQueues) { 33014 var waypoints = this.triggerQueues[direction] 33015 var reverse = direction === 'up' || direction === 'left' 33016 waypoints.sort(reverse ? byReverseTriggerPoint : byTriggerPoint) 33017 for (var i = 0, end = waypoints.length; i < end; i += 1) { 33018 var waypoint = waypoints[i] 33019 if (waypoint.options.continuous || i === waypoints.length - 1) { 33020 waypoint.trigger([direction]) 33021 } 33022 } 33023 } 33024 this.clearTriggerQueues() 33025 } 33026 33027 /* Private */ 33028 Group.prototype.next = function(waypoint) { 33029 this.waypoints.sort(byTriggerPoint) 33030 var index = Waypoint.Adapter.inArray(waypoint, this.waypoints) 33031 var isLast = index === this.waypoints.length - 1 33032 return isLast ? null : this.waypoints[index + 1] 33033 } 33034 33035 /* Private */ 33036 Group.prototype.previous = function(waypoint) { 33037 this.waypoints.sort(byTriggerPoint) 33038 var index = Waypoint.Adapter.inArray(waypoint, this.waypoints) 33039 return index ? this.waypoints[index - 1] : null 33040 } 33041 33042 /* Private */ 33043 Group.prototype.queueTrigger = function(waypoint, direction) { 33044 this.triggerQueues[direction].push(waypoint) 33045 } 33046 33047 /* Private */ 33048 Group.prototype.remove = function(waypoint) { 33049 var index = Waypoint.Adapter.inArray(waypoint, this.waypoints) 33050 if (index > -1) { 33051 this.waypoints.splice(index, 1) 33052 } 33053 } 33054 33055 /* Public */ 33056 /* http://imakewebthings.com/waypoints/api/first */ 33057 Group.prototype.first = function() { 33058 return this.waypoints[0] 33059 } 33060 33061 /* Public */ 33062 /* http://imakewebthings.com/waypoints/api/last */ 33063 Group.prototype.last = function() { 33064 return this.waypoints[this.waypoints.length - 1] 33065 } 33066 33067 /* Private */ 33068 Group.findOrCreate = function(options) { 33069 return groups[options.axis][options.name] || new Group(options) 33070 } 33071 33072 Waypoint.Group = Group 33073}()) 33074;(function() { 33075 'use strict' 33076 33077 var $ = window.jQuery 33078 var Waypoint = window.Waypoint 33079 33080 function JQueryAdapter(element) { 33081 this.$element = $(element) 33082 } 33083 33084 $.each([ 33085 'innerHeight', 33086 'innerWidth', 33087 'off', 33088 'offset', 33089 'on', 33090 'outerHeight', 33091 'outerWidth', 33092 'scrollLeft', 33093 'scrollTop' 33094 ], function(i, method) { 33095 JQueryAdapter.prototype[method] = function() { 33096 var args = Array.prototype.slice.call(arguments) 33097 return this.$element[method].apply(this.$element, args) 33098 } 33099 }) 33100 33101 $.each([ 33102 'extend', 33103 'inArray', 33104 'isEmptyObject' 33105 ], function(i, method) { 33106 JQueryAdapter[method] = $[method] 33107 }) 33108 33109 Waypoint.adapters.push({ 33110 name: 'jquery', 33111 Adapter: JQueryAdapter 33112 }) 33113 Waypoint.Adapter = JQueryAdapter 33114}()) 33115;(function() { 33116 'use strict' 33117 33118 var Waypoint = window.Waypoint 33119 33120 function createExtension(framework) { 33121 return function() { 33122 var waypoints = [] 33123 var overrides = arguments[0] 33124 33125 if (framework.isFunction(arguments[0])) { 33126 overrides = framework.extend({}, arguments[1]) 33127 overrides.handler = arguments[0] 33128 } 33129 33130 this.each(function() { 33131 var options = framework.extend({}, overrides, { 33132 element: this 33133 }) 33134 if (typeof options.context === 'string') { 33135 options.context = framework(this).closest(options.context)[0] 33136 } 33137 waypoints.push(new Waypoint(options)) 33138 }) 33139 33140 return waypoints 33141 } 33142 } 33143 33144 if (window.jQuery) { 33145 window.jQuery.fn.waypoint = createExtension(window.jQuery) 33146 } 33147 if (window.Zepto) { 33148 window.Zepto.fn.waypoint = createExtension(window.Zepto) 33149 } 33150}()) 33151; 33152 33153/***/ })
vendor: 5,884 bytes, lines 33153-33293
33153 33154 33155/******/ }); 33156/************************************************************************/ 33157/******/ // The module cache 33158/******/ var __webpack_module_cache__ = {}; 33159/******/ 33160/******/ // The require function 33161/******/ function __webpack_require__(moduleId) { 33162/******/ // Check if module is in cache 33163/******/ var cachedModule = __webpack_module_cache__[moduleId]; 33164/******/ if (cachedModule !== undefined) { 33165/******/ return cachedModule.exports; 33166/******/ } 33167/******/ // Create a new module (and put it into the cache) 33168/******/ var module = __webpack_module_cache__[moduleId] = { 33169/******/ // no module.id needed 33170/******/ // no module.loaded needed 33171/******/ exports: {} 33172/******/ }; 33173/******/ 33174/******/ // Execute the module function 33175/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); 33176/******/ 33177/******/ // Return the exports of the module 33178/******/ return module.exports; 33179/******/ } 33180/******/ 33181/************************************************************************/ 33182/******/ /* webpack/runtime/compat get default export */ 33183/******/ (() => { 33184/******/ // getDefaultExport function for compatibility with non-harmony modules 33185/******/ __webpack_require__.n = (module) => { 33186/******/ var getter = module && module.__esModule ? 33187/******/ () => (module['default']) : 33188/******/ () => (module); 33189/******/ __webpack_require__.d(getter, { a: getter }); 33190/******/ return getter; 33191/******/ }; 33192/******/ })(); 33193/******/ 33194/******/ /* webpack/runtime/define property getters */ 33195/******/ (() => { 33196/******/ // define getter functions for harmony exports 33197/******/ __webpack_require__.d = (exports, definition) => { 33198/******/ for(var key in definition) { 33199/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 33200/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 33201/******/ } 33202/******/ } 33203/******/ }; 33204/******/ })(); 33205/******/ 33206/******/ /* webpack/runtime/global */ 33207/******/ (() => { 33208/******/ __webpack_require__.g = (function() { 33209/******/ if (typeof globalThis === 'object') return globalThis; 33210/******/ try { 33211/******/ return this || new Function('return this')(); 33212/******/ } catch (e) { 33213/******/ if (typeof window === 'object') return window; 33214/******/ } 33215/******/ })(); 33216/******/ })(); 33217/******/ 33218/******/ /* webpack/runtime/hasOwnProperty shorthand */ 33219/******/ (() => { 33220/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) 33221/******/ })(); 33222/******/ 33223/******/ /* webpack/runtime/make namespace object */ 33224/******/ (() => { 33225/******/ // define __esModule on exports 33226/******/ __webpack_require__.r = (exports) => { 33227/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 33228/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 33229/******/ } 33230/******/ Object.defineProperty(exports, '__esModule', { value: true }); 33231/******/ }; 33232/******/ })(); 33233/******/ 33234/************************************************************************/ 33235var __webpack_exports__ = {}; 33236// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. 33237(() => { 33238/*!*************************************************!*\ 33239 !*** ./resources/themes/thesaas/js/src/page.js ***! 33240 \*************************************************/ 33241/* 33242|-------------------------------------------------------------------------- 33243| Core 33244|-------------------------------------------------------------------------- 33245| 33246| The start point of the project. Include jQuery, Bootstrap and required 33247| plugins and define page object. This file is required. 33248| 33249*/ 33250__webpack_require__(/*! ../../plugin/thesaas/js/loaders/core.js */ "./resources/themes/thesaas/plugin/thesaas/js/loaders/core.js"); 33251/* 33252|-------------------------------------------------------------------------- 33253| Vendors 33254|-------------------------------------------------------------------------- 33255| 33256| Load some plugins and define initializer methods. If you don't need any 33257| of the following plugins, simply comment the line. 33258| 33259| The minified size of each module has stated for your reference. So you'd 33260| know how much KB you can save by removing a vendor. 33261| 33262*/ 33263 33264 33265__webpack_require__(/*! ../../plugin/thesaas/js/vendors/aos.js */ "./resources/themes/thesaas/plugin/thesaas/js/vendors/aos.js"); // 14 kb 33266 33267 33268__webpack_require__(/*! ../../plugin/thesaas/js/vendors/constellation.js */ "./resources/themes/thesaas/plugin/thesaas/js/vendors/constellation.js"); // 03 kb 33269 33270 33271__webpack_require__(/*! ../../plugin/thesaas/js/vendors/countdown.js */ "./resources/themes/thesaas/plugin/thesaas/js/vendors/countdown.js"); // 05 kb 33272 33273 33274__webpack_require__(/*! ../../plugin/thesaas/js/vendors/countup.js */ "./resources/themes/thesaas/plugin/thesaas/js/vendors/countup.js"); // 13 kb 33275 33276 33277__webpack_require__(/*! ../../plugin/thesaas/js/vendors/granim.js */ "./resources/themes/thesaas/plugin/thesaas/js/vendors/granim.js"); // 15 kb 33278 33279 33280__webpack_require__(/*! ../../plugin/thesaas/js/vendors/jarallax.js */ "./resources/themes/thesaas/plugin/thesaas/js/vendors/jarallax.js"); // 23 kb 33281 33282 33283__webpack_require__(/*! ../../plugin/thesaas/js/vendors/lity.js */ "./resources/themes/thesaas/plugin/thesaas/js/vendors/lity.js"); // 07 kb 33284 33285 33286__webpack_require__(/*! ../../plugin/thesaas/js/vendors/photoswipe.js */ "./resources/themes/thesaas/plugin/thesaas/js/vendors/photoswipe.js"); // 45 kb 33287 33288 33289__webpack_require__(/*! ../../plugin/thesaas/js/vendors/shuffle.js */ "./resources/themes/thesaas/plugin/thesaas/js/vendors/shuffle.js"); // 25 kb 33290// require('../../plugin/thesaas/js/vendors/slick.js'); // 43 kb 33291 33292 33293__webpack_require__(/*! ../../plugin/thesaas/js/vendors/typed.js */ "./resources/themes/thesaas/plugin/thesaas/js/vendors/typed.js"); // 11 kb
33294 33295/* 33296|-------------------------------------------------------------------------- 33297| Partials 33298|-------------------------------------------------------------------------- 33299| 33300| Split the application code to several files. This file is required. 33301| 33302*/ 33303 33304 33305__webpack_require__(/*! ../../plugin/thesaas/js/loaders/partials.js */ "./resources/themes/thesaas/plugin/thesaas/js/loaders/partials.js"); 33306/* 33307|-------------------------------------------------------------------------- 33308| Configure 33309|-------------------------------------------------------------------------- 33310| 33311| Modify some variables to personalize your project. This file is required. 33312| 33313*/ 33314 33315 33316__webpack_require__(/*! ./config.js */ "./resources/themes/thesaas/js/src/config.js"); 33317/* 33318|-------------------------------------------------------------------------- 33319| Custom script 33320|-------------------------------------------------------------------------- 33321| 33322| Write your custom JavaScrip code. Feel free to split your code to several 33323| files and import the other files here or inside script.js. 33324| 33325*/ 33326 33327 33328__webpack_require__(/*! ./script.js */ "./resources/themes/thesaas/js/src/script.js"); 33329})(); 33330 33331/******/ })() 33332;
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.