Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 

4662 строки
160 KiB

  1. (function webpackUniversalModuleDefinition(root, factory) {
  2. if(typeof exports === 'object' && typeof module === 'object')
  3. module.exports = factory(require("react"), require("react-dom"));
  4. else if(typeof define === 'function' && define.amd)
  5. define(["react", "react-dom"], factory);
  6. else if(typeof exports === 'object')
  7. exports["Slider"] = factory(require("react"), require("react-dom"));
  8. else
  9. root["Slider"] = factory(root["React"], root["ReactDOM"]);
  10. })(window, function(__WEBPACK_EXTERNAL_MODULE__2__, __WEBPACK_EXTERNAL_MODULE__4__) {
  11. return /******/ (function(modules) { // webpackBootstrap
  12. /******/ // The module cache
  13. /******/ var installedModules = {};
  14. /******/
  15. /******/ // The require function
  16. /******/ function __webpack_require__(moduleId) {
  17. /******/
  18. /******/ // Check if module is in cache
  19. /******/ if(installedModules[moduleId]) {
  20. /******/ return installedModules[moduleId].exports;
  21. /******/ }
  22. /******/ // Create a new module (and put it into the cache)
  23. /******/ var module = installedModules[moduleId] = {
  24. /******/ i: moduleId,
  25. /******/ l: false,
  26. /******/ exports: {}
  27. /******/ };
  28. /******/
  29. /******/ // Execute the module function
  30. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  31. /******/
  32. /******/ // Flag the module as loaded
  33. /******/ module.l = true;
  34. /******/
  35. /******/ // Return the exports of the module
  36. /******/ return module.exports;
  37. /******/ }
  38. /******/
  39. /******/
  40. /******/ // expose the modules object (__webpack_modules__)
  41. /******/ __webpack_require__.m = modules;
  42. /******/
  43. /******/ // expose the module cache
  44. /******/ __webpack_require__.c = installedModules;
  45. /******/
  46. /******/ // define getter function for harmony exports
  47. /******/ __webpack_require__.d = function(exports, name, getter) {
  48. /******/ if(!__webpack_require__.o(exports, name)) {
  49. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  50. /******/ }
  51. /******/ };
  52. /******/
  53. /******/ // define __esModule on exports
  54. /******/ __webpack_require__.r = function(exports) {
  55. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  56. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  57. /******/ }
  58. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  59. /******/ };
  60. /******/
  61. /******/ // create a fake namespace object
  62. /******/ // mode & 1: value is a module id, require it
  63. /******/ // mode & 2: merge all properties of value into the ns
  64. /******/ // mode & 4: return value when already ns object
  65. /******/ // mode & 8|1: behave like require
  66. /******/ __webpack_require__.t = function(value, mode) {
  67. /******/ if(mode & 1) value = __webpack_require__(value);
  68. /******/ if(mode & 8) return value;
  69. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  70. /******/ var ns = Object.create(null);
  71. /******/ __webpack_require__.r(ns);
  72. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  73. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  74. /******/ return ns;
  75. /******/ };
  76. /******/
  77. /******/ // getDefaultExport function for compatibility with non-harmony modules
  78. /******/ __webpack_require__.n = function(module) {
  79. /******/ var getter = module && module.__esModule ?
  80. /******/ function getDefault() { return module['default']; } :
  81. /******/ function getModuleExports() { return module; };
  82. /******/ __webpack_require__.d(getter, 'a', getter);
  83. /******/ return getter;
  84. /******/ };
  85. /******/
  86. /******/ // Object.prototype.hasOwnProperty.call
  87. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  88. /******/
  89. /******/ // __webpack_public_path__
  90. /******/ __webpack_require__.p = "";
  91. /******/
  92. /******/
  93. /******/ // Load entry module and return exports
  94. /******/ return __webpack_require__(__webpack_require__.s = 0);
  95. /******/ })
  96. /************************************************************************/
  97. /******/ ([
  98. /* 0 */
  99. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  100. "use strict";
  101. __webpack_require__.r(__webpack_exports__);
  102. /* harmony import */ var _slider__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
  103. /* harmony default export */ __webpack_exports__["default"] = (_slider__WEBPACK_IMPORTED_MODULE_0__["default"]);
  104. /***/ }),
  105. /* 1 */
  106. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  107. "use strict";
  108. __webpack_require__.r(__webpack_exports__);
  109. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return Slider; });
  110. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
  111. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
  112. /* harmony import */ var _inner_slider__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3);
  113. /* harmony import */ var json2mq__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(14);
  114. /* harmony import */ var json2mq__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(json2mq__WEBPACK_IMPORTED_MODULE_2__);
  115. /* harmony import */ var _default_props__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(16);
  116. /* harmony import */ var _utils_innerSliderUtils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(9);
  117. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  118. function _extends() { _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; }; return _extends.apply(this, arguments); }
  119. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
  120. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  121. 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); } }
  122. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  123. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  124. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  125. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  126. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  127. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  128. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  129. var enquire = Object(_utils_innerSliderUtils__WEBPACK_IMPORTED_MODULE_4__["canUseDOM"])() && __webpack_require__(17);
  130. var Slider =
  131. /*#__PURE__*/
  132. function (_React$Component) {
  133. _inherits(Slider, _React$Component);
  134. function Slider(props) {
  135. var _this;
  136. _classCallCheck(this, Slider);
  137. _this = _possibleConstructorReturn(this, _getPrototypeOf(Slider).call(this, props));
  138. _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "innerSliderRefHandler", function (ref) {
  139. return _this.innerSlider = ref;
  140. });
  141. _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "slickPrev", function () {
  142. return _this.innerSlider.slickPrev();
  143. });
  144. _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "slickNext", function () {
  145. return _this.innerSlider.slickNext();
  146. });
  147. _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "slickGoTo", function (slide) {
  148. var dontAnimate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  149. return _this.innerSlider.slickGoTo(slide, dontAnimate);
  150. });
  151. _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "slickPause", function () {
  152. return _this.innerSlider.pause("paused");
  153. });
  154. _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "slickPlay", function () {
  155. return _this.innerSlider.autoPlay("play");
  156. });
  157. _this.state = {
  158. breakpoint: null
  159. };
  160. _this._responsiveMediaHandlers = [];
  161. return _this;
  162. }
  163. _createClass(Slider, [{
  164. key: "media",
  165. value: function media(query, handler) {
  166. // javascript handler for css media query
  167. enquire.register(query, handler);
  168. this._responsiveMediaHandlers.push({
  169. query: query,
  170. handler: handler
  171. });
  172. } // handles responsive breakpoints
  173. }, {
  174. key: "componentWillMount",
  175. value: function componentWillMount() {
  176. var _this2 = this;
  177. // performance monitoring
  178. //if (process.env.NODE_ENV !== 'production') {
  179. //const { whyDidYouUpdate } = require('why-did-you-update')
  180. //whyDidYouUpdate(React)
  181. //}
  182. if (this.props.responsive) {
  183. var breakpoints = this.props.responsive.map(function (breakpt) {
  184. return breakpt.breakpoint;
  185. }); // sort them in increasing order of their numerical value
  186. breakpoints.sort(function (x, y) {
  187. return x - y;
  188. });
  189. breakpoints.forEach(function (breakpoint, index) {
  190. // media query for each breakpoint
  191. var bQuery;
  192. if (index === 0) {
  193. bQuery = json2mq__WEBPACK_IMPORTED_MODULE_2___default()({
  194. minWidth: 0,
  195. maxWidth: breakpoint
  196. });
  197. } else {
  198. bQuery = json2mq__WEBPACK_IMPORTED_MODULE_2___default()({
  199. minWidth: breakpoints[index - 1] + 1,
  200. maxWidth: breakpoint
  201. });
  202. } // when not using server side rendering
  203. Object(_utils_innerSliderUtils__WEBPACK_IMPORTED_MODULE_4__["canUseDOM"])() && _this2.media(bQuery, function () {
  204. _this2.setState({
  205. breakpoint: breakpoint
  206. });
  207. });
  208. }); // Register media query for full screen. Need to support resize from small to large
  209. // convert javascript object to media query string
  210. var query = json2mq__WEBPACK_IMPORTED_MODULE_2___default()({
  211. minWidth: breakpoints.slice(-1)[0]
  212. });
  213. Object(_utils_innerSliderUtils__WEBPACK_IMPORTED_MODULE_4__["canUseDOM"])() && this.media(query, function () {
  214. _this2.setState({
  215. breakpoint: null
  216. });
  217. });
  218. }
  219. }
  220. }, {
  221. key: "componentWillUnmount",
  222. value: function componentWillUnmount() {
  223. this._responsiveMediaHandlers.forEach(function (obj) {
  224. enquire.unregister(obj.query, obj.handler);
  225. });
  226. }
  227. }, {
  228. key: "render",
  229. value: function render() {
  230. var _this3 = this;
  231. var settings;
  232. var newProps;
  233. if (this.state.breakpoint) {
  234. newProps = this.props.responsive.filter(function (resp) {
  235. return resp.breakpoint === _this3.state.breakpoint;
  236. });
  237. settings = newProps[0].settings === "unslick" ? "unslick" : _objectSpread({}, _default_props__WEBPACK_IMPORTED_MODULE_3__["default"], this.props, newProps[0].settings);
  238. } else {
  239. settings = _objectSpread({}, _default_props__WEBPACK_IMPORTED_MODULE_3__["default"], this.props);
  240. } // force scrolling by one if centerMode is on
  241. if (settings.centerMode) {
  242. if (settings.slidesToScroll > 1 && "none" !== "production") {
  243. console.warn("slidesToScroll should be equal to 1 in centerMode, you are using ".concat(settings.slidesToScroll));
  244. }
  245. settings.slidesToScroll = 1;
  246. } // force showing one slide and scrolling by one if the fade mode is on
  247. if (settings.fade) {
  248. if (settings.slidesToShow > 1 && "none" !== "production") {
  249. console.warn("slidesToShow should be equal to 1 when fade is true, you're using ".concat(settings.slidesToShow));
  250. }
  251. if (settings.slidesToScroll > 1 && "none" !== "production") {
  252. console.warn("slidesToScroll should be equal to 1 when fade is true, you're using ".concat(settings.slidesToScroll));
  253. }
  254. settings.slidesToShow = 1;
  255. settings.slidesToScroll = 1;
  256. } // makes sure that children is an array, even when there is only 1 child
  257. var children = react__WEBPACK_IMPORTED_MODULE_0___default.a.Children.toArray(this.props.children); // Children may contain false or null, so we should filter them
  258. // children may also contain string filled with spaces (in certain cases where we use jsx strings)
  259. children = children.filter(function (child) {
  260. if (typeof child === "string") {
  261. return !!child.trim();
  262. }
  263. return !!child;
  264. }); // rows and slidesPerRow logic is handled here
  265. if (settings.variableWidth && (settings.rows > 1 || settings.slidesPerRow > 1)) {
  266. console.warn("variableWidth is not supported in case of rows > 1 or slidesPerRow > 1");
  267. settings.variableWidth = false;
  268. }
  269. var newChildren = [];
  270. var currentWidth = null;
  271. for (var i = 0; i < children.length; i += settings.rows * settings.slidesPerRow) {
  272. var newSlide = [];
  273. for (var j = i; j < i + settings.rows * settings.slidesPerRow; j += settings.slidesPerRow) {
  274. var row = [];
  275. for (var k = j; k < j + settings.slidesPerRow; k += 1) {
  276. if (settings.variableWidth && children[k].props.style) {
  277. currentWidth = children[k].props.style.width;
  278. }
  279. if (k >= children.length) break;
  280. row.push(react__WEBPACK_IMPORTED_MODULE_0___default.a.cloneElement(children[k], {
  281. key: 100 * i + 10 * j + k,
  282. tabIndex: -1,
  283. style: {
  284. width: "".concat(100 / settings.slidesPerRow, "%"),
  285. display: "inline-block"
  286. }
  287. }));
  288. }
  289. newSlide.push(react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", {
  290. key: 10 * i + j
  291. }, row));
  292. }
  293. if (settings.variableWidth) {
  294. newChildren.push(react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", {
  295. key: i,
  296. style: {
  297. width: currentWidth
  298. }
  299. }, newSlide));
  300. } else {
  301. newChildren.push(react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", {
  302. key: i
  303. }, newSlide));
  304. }
  305. }
  306. if (settings === "unslick") {
  307. var className = "regular slider " + (this.props.className || "");
  308. return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", {
  309. className: className
  310. }, newChildren);
  311. } else if (newChildren.length <= settings.slidesToShow) {
  312. settings.unslick = true;
  313. }
  314. return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_inner_slider__WEBPACK_IMPORTED_MODULE_1__["InnerSlider"], _extends({
  315. ref: this.innerSliderRefHandler
  316. }, settings), newChildren);
  317. }
  318. }]);
  319. return Slider;
  320. }(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component);
  321. /***/ }),
  322. /* 2 */
  323. /***/ (function(module, exports) {
  324. module.exports = __WEBPACK_EXTERNAL_MODULE__2__;
  325. /***/ }),
  326. /* 3 */
  327. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  328. "use strict";
  329. __webpack_require__.r(__webpack_exports__);
  330. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InnerSlider", function() { return InnerSlider; });
  331. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
  332. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
  333. /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4);
  334. /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__);
  335. /* harmony import */ var _initial_state__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5);
  336. /* harmony import */ var lodash_debounce__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(6);
  337. /* harmony import */ var lodash_debounce__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash_debounce__WEBPACK_IMPORTED_MODULE_3__);
  338. /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(8);
  339. /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_4__);
  340. /* harmony import */ var _utils_innerSliderUtils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(9);
  341. /* harmony import */ var _track__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(10);
  342. /* harmony import */ var _dots__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(11);
  343. /* harmony import */ var _arrows__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(12);
  344. /* harmony import */ var resize_observer_polyfill__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(13);
  345. function _extends() { _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; }; return _extends.apply(this, arguments); }
  346. function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
  347. function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
  348. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  349. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
  350. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  351. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  352. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  353. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  354. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  355. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  356. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  357. var InnerSlider =
  358. /*#__PURE__*/
  359. function (_React$Component) {
  360. _inherits(InnerSlider, _React$Component);
  361. function InnerSlider(props) {
  362. var _this;
  363. _classCallCheck(this, InnerSlider);
  364. _this = _possibleConstructorReturn(this, _getPrototypeOf(InnerSlider).call(this, props));
  365. _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "listRefHandler", function (ref) {
  366. return _this.list = ref;
  367. });
  368. _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "trackRefHandler", function (ref) {
  369. return _this.track = ref;
  370. });
  371. _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "adaptHeight", function () {
  372. if (_this.props.adaptiveHeight && _this.list) {
  373. var elem = _this.list.querySelector("[data-index=\"".concat(_this.state.currentSlide, "\"]"));
  374. _this.list.style.height = Object(_utils_innerSliderUtils__WEBPACK_IMPORTED_MODULE_5__["getHeight"])(elem) + "px";
  375. }
  376. });
  377. _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "componentWillMount", function () {
  378. _this.ssrInit();
  379. _this.props.onInit && _this.props.onInit();
  380. if (_this.props.lazyLoad) {
  381. var slidesToLoad = Object(_utils_innerSliderUtils__WEBPACK_IMPORTED_MODULE_5__["getOnDemandLazySlides"])(_objectSpread({}, _this.props, _this.state));
  382. if (slidesToLoad.length > 0) {
  383. _this.setState(function (prevState) {
  384. return {
  385. lazyLoadedList: prevState.lazyLoadedList.concat(slidesToLoad)
  386. };
  387. });
  388. if (_this.props.onLazyLoad) {
  389. _this.props.onLazyLoad(slidesToLoad);
  390. }
  391. }
  392. }
  393. });
  394. _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "componentDidMount", function () {
  395. var spec = _objectSpread({
  396. listRef: _this.list,
  397. trackRef: _this.track
  398. }, _this.props);
  399. _this.updateState(spec, true, function () {
  400. _this.adaptHeight();
  401. _this.props.autoplay && _this.autoPlay("update");
  402. });
  403. if (_this.props.lazyLoad === "progressive") {
  404. _this.lazyLoadTimer = setInterval(_this.progressiveLazyLoad, 1000);
  405. }
  406. _this.ro = new resize_observer_polyfill__WEBPACK_IMPORTED_MODULE_9__["default"](function () {
  407. if (_this.state.animating) {
  408. _this.onWindowResized(false); // don't set trackStyle hence don't break animation
  409. _this.callbackTimers.push(setTimeout(function () {
  410. return _this.onWindowResized();
  411. }, _this.props.speed));
  412. } else {
  413. _this.onWindowResized();
  414. }
  415. });
  416. _this.ro.observe(_this.list);
  417. Array.prototype.forEach.call(document.querySelectorAll(".slick-slide"), function (slide) {
  418. slide.onfocus = _this.props.pauseOnFocus ? _this.onSlideFocus : null;
  419. slide.onblur = _this.props.pauseOnFocus ? _this.onSlideBlur : null;
  420. }); // To support server-side rendering
  421. if (!window) {
  422. return;
  423. }
  424. if (window.addEventListener) {
  425. window.addEventListener("resize", _this.onWindowResized);
  426. } else {
  427. window.attachEvent("onresize", _this.onWindowResized);
  428. }
  429. });
  430. _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "componentWillUnmount", function () {
  431. if (_this.animationEndCallback) {
  432. clearTimeout(_this.animationEndCallback);
  433. }
  434. if (_this.lazyLoadTimer) {
  435. clearInterval(_this.lazyLoadTimer);
  436. }
  437. if (_this.callbackTimers.length) {
  438. _this.callbackTimers.forEach(function (timer) {
  439. return clearTimeout(timer);
  440. });
  441. _this.callbackTimers = [];
  442. }
  443. if (window.addEventListener) {
  444. window.removeEventListener("resize", _this.onWindowResized);
  445. } else {
  446. window.detachEvent("onresize", _this.onWindowResized);
  447. }
  448. if (_this.autoplayTimer) {
  449. clearInterval(_this.autoplayTimer);
  450. }
  451. });
  452. _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "componentWillReceiveProps", function (nextProps) {
  453. var spec = _objectSpread({
  454. listRef: _this.list,
  455. trackRef: _this.track
  456. }, nextProps, _this.state);
  457. var setTrackStyle = false;
  458. var _arr = Object.keys(_this.props);
  459. for (var _i = 0; _i < _arr.length; _i++) {
  460. var key = _arr[_i];
  461. if (!nextProps.hasOwnProperty(key)) {
  462. setTrackStyle = true;
  463. break;
  464. }
  465. if (_typeof(nextProps[key]) === "object" || typeof nextProps[key] === "function") {
  466. continue;
  467. }
  468. if (nextProps[key] !== _this.props[key]) {
  469. setTrackStyle = true;
  470. break;
  471. }
  472. }
  473. _this.updateState(spec, setTrackStyle, function () {
  474. if (_this.state.currentSlide >= react__WEBPACK_IMPORTED_MODULE_0___default.a.Children.count(nextProps.children)) {
  475. _this.changeSlide({
  476. message: "index",
  477. index: react__WEBPACK_IMPORTED_MODULE_0___default.a.Children.count(nextProps.children) - nextProps.slidesToShow,
  478. currentSlide: _this.state.currentSlide
  479. });
  480. }
  481. if (nextProps.autoplay) {
  482. _this.autoPlay("update");
  483. } else {
  484. _this.pause("paused");
  485. }
  486. });
  487. });
  488. _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "componentDidUpdate", function () {
  489. _this.checkImagesLoad();
  490. _this.props.onReInit && _this.props.onReInit();
  491. if (_this.props.lazyLoad) {
  492. var slidesToLoad = Object(_utils_innerSliderUtils__WEBPACK_IMPORTED_MODULE_5__["getOnDemandLazySlides"])(_objectSpread({}, _this.props, _this.state));
  493. if (slidesToLoad.length > 0) {
  494. _this.setState(function (prevState) {
  495. return {
  496. lazyLoadedList: prevState.lazyLoadedList.concat(slidesToLoad)
  497. };
  498. });
  499. if (_this.props.onLazyLoad) {
  500. _this.props.onLazyLoad(slidesToLoad);
  501. }
  502. }
  503. } // if (this.props.onLazyLoad) {
  504. // this.props.onLazyLoad([leftMostSlide])
  505. // }
  506. _this.adaptHeight();
  507. });
  508. _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "onWindowResized", function (setTrackStyle) {
  509. if (_this.debouncedResize) _this.debouncedResize.cancel();
  510. _this.debouncedResize = lodash_debounce__WEBPACK_IMPORTED_MODULE_3___default()(function () {
  511. return _this.resizeWindow(setTrackStyle);
  512. }, 50);
  513. _this.debouncedResize();
  514. });
  515. _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "resizeWindow", function () {
  516. var setTrackStyle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
  517. if (!react_dom__WEBPACK_IMPORTED_MODULE_1___default.a.findDOMNode(_this.track)) return;
  518. var spec = _objectSpread({
  519. listRef: _this.list,
  520. trackRef: _this.track
  521. }, _this.props, _this.state);
  522. _this.updateState(spec, setTrackStyle, function () {
  523. if (_this.props.autoplay) _this.autoPlay("update");else _this.pause("paused");
  524. }); // animating state should be cleared while resizing, otherwise autoplay stops working
  525. _this.setState({
  526. animating: false
  527. });
  528. clearTimeout(_this.animationEndCallback);
  529. delete _this.animationEndCallback;
  530. });
  531. _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "updateState", function (spec, setTrackStyle, callback) {
  532. var updatedState = Object(_utils_innerSliderUtils__WEBPACK_IMPORTED_MODULE_5__["initializedState"])(spec);
  533. spec = _objectSpread({}, spec, updatedState, {
  534. slideIndex: updatedState.currentSlide
  535. });
  536. var targetLeft = Object(_utils_innerSliderUtils__WEBPACK_IMPORTED_MODULE_5__["getTrackLeft"])(spec);
  537. spec = _objectSpread({}, spec, {
  538. left: targetLeft
  539. });
  540. var trackStyle = Object(_utils_innerSliderUtils__WEBPACK_IMPORTED_MODULE_5__["getTrackCSS"])(spec);
  541. if (setTrackStyle || react__WEBPACK_IMPORTED_MODULE_0___default.a.Children.count(_this.props.children) !== react__WEBPACK_IMPORTED_MODULE_0___default.a.Children.count(spec.children)) {
  542. updatedState["trackStyle"] = trackStyle;
  543. }
  544. _this.setState(updatedState, callback);
  545. });
  546. _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "ssrInit", function () {
  547. if (_this.props.variableWidth) {
  548. var _trackWidth = 0,
  549. _trackLeft = 0;
  550. var childrenWidths = [];
  551. var preClones = Object(_utils_innerSliderUtils__WEBPACK_IMPORTED_MODULE_5__["getPreClones"])(_objectSpread({}, _this.props, _this.state, {
  552. slideCount: _this.props.children.length
  553. }));
  554. var postClones = Object(_utils_innerSliderUtils__WEBPACK_IMPORTED_MODULE_5__["getPostClones"])(_objectSpread({}, _this.props, _this.state, {
  555. slideCount: _this.props.children.length
  556. }));
  557. _this.props.children.forEach(function (child) {
  558. childrenWidths.push(child.props.style.width);
  559. _trackWidth += child.props.style.width;
  560. });
  561. for (var i = 0; i < preClones; i++) {
  562. _trackLeft += childrenWidths[childrenWidths.length - 1 - i];
  563. _trackWidth += childrenWidths[childrenWidths.length - 1 - i];
  564. }
  565. for (var _i2 = 0; _i2 < postClones; _i2++) {
  566. _trackWidth += childrenWidths[_i2];
  567. }
  568. for (var _i3 = 0; _i3 < _this.state.currentSlide; _i3++) {
  569. _trackLeft += childrenWidths[_i3];
  570. }
  571. var _trackStyle = {
  572. width: _trackWidth + "px",
  573. left: -_trackLeft + "px"
  574. };
  575. if (_this.props.centerMode) {
  576. var currentWidth = "".concat(childrenWidths[_this.state.currentSlide], "px");
  577. _trackStyle.left = "calc(".concat(_trackStyle.left, " + (100% - ").concat(currentWidth, ") / 2 ) ");
  578. }
  579. _this.setState({
  580. trackStyle: _trackStyle
  581. });
  582. return;
  583. }
  584. var childrenCount = react__WEBPACK_IMPORTED_MODULE_0___default.a.Children.count(_this.props.children);
  585. var spec = _objectSpread({}, _this.props, _this.state, {
  586. slideCount: childrenCount
  587. });
  588. var slideCount = Object(_utils_innerSliderUtils__WEBPACK_IMPORTED_MODULE_5__["getPreClones"])(spec) + Object(_utils_innerSliderUtils__WEBPACK_IMPORTED_MODULE_5__["getPostClones"])(spec) + childrenCount;
  589. var trackWidth = 100 / _this.props.slidesToShow * slideCount;
  590. var slideWidth = 100 / slideCount;
  591. var trackLeft = -slideWidth * (Object(_utils_innerSliderUtils__WEBPACK_IMPORTED_MODULE_5__["getPreClones"])(spec) + _this.state.currentSlide) * trackWidth / 100;
  592. if (_this.props.centerMode) {
  593. trackLeft += (100 - slideWidth * trackWidth / 100) / 2;
  594. }
  595. var trackStyle = {
  596. width: trackWidth + "%",
  597. left: trackLeft + "%"
  598. };
  599. _this.setState({
  600. slideWidth: slideWidth + "%",
  601. trackStyle: trackStyle
  602. });
  603. });
  604. _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "checkImagesLoad", function () {
  605. var images = document.querySelectorAll(".slick-slide img");
  606. var imagesCount = images.length,
  607. loadedCount = 0;
  608. Array.prototype.forEach.call(images, function (image) {
  609. var handler = function handler() {
  610. return ++loadedCount && loadedCount >= imagesCount && _this.onWindowResized();
  611. };
  612. if (!image.onclick) {
  613. image.onclick = function () {
  614. return image.parentNode.focus();
  615. };
  616. } else {
  617. var prevClickHandler = image.onclick;
  618. image.onclick = function () {
  619. prevClickHandler();
  620. image.parentNode.focus();
  621. };
  622. }
  623. if (!image.onload) {
  624. if (_this.props.lazyLoad) {
  625. image.onload = function () {
  626. _this.adaptHeight();
  627. _this.callbackTimers.push(setTimeout(_this.onWindowResized, _this.props.speed));
  628. };
  629. } else {
  630. image.onload = handler;
  631. image.onerror = function () {
  632. handler();
  633. _this.props.onLazyLoadError && _this.props.onLazyLoadError();
  634. };
  635. }
  636. }
  637. });
  638. });
  639. _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "progressiveLazyLoad", function () {
  640. var slidesToLoad = [];
  641. var spec = _objectSpread({}, _this.props, _this.state);
  642. for (var index = _this.state.currentSlide; index < _this.state.slideCount + Object(_utils_innerSliderUtils__WEBPACK_IMPORTED_MODULE_5__["getPostClones"])(spec); index++) {
  643. if (_this.state.lazyLoadedList.indexOf(index) < 0) {
  644. slidesToLoad.push(index);
  645. break;
  646. }
  647. }
  648. for (var _index = _this.state.currentSlide - 1; _index >= -Object(_utils_innerSliderUtils__WEBPACK_IMPORTED_MODULE_5__["getPreClones"])(spec); _index--) {
  649. if (_this.state.lazyLoadedList.indexOf(_index) < 0) {
  650. slidesToLoad.push(_index);
  651. break;
  652. }
  653. }
  654. if (slidesToLoad.length > 0) {
  655. _this.setState(function (state) {
  656. return {
  657. lazyLoadedList: state.lazyLoadedList.concat(slidesToLoad)
  658. };
  659. });
  660. if (_this.props.onLazyLoad) {
  661. _this.props.onLazyLoad(slidesToLoad);
  662. }
  663. } else {
  664. if (_this.lazyLoadTimer) {
  665. clearInterval(_this.lazyLoadTimer);
  666. delete _this.lazyLoadTimer;
  667. }
  668. }
  669. });
  670. _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "slideHandler", function (index) {
  671. var dontAnimate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  672. var _this$props = _this.props,
  673. asNavFor = _this$props.asNavFor,
  674. beforeChange = _this$props.beforeChange,
  675. onLazyLoad = _this$props.onLazyLoad,
  676. speed = _this$props.speed,
  677. afterChange = _this$props.afterChange; // capture currentslide before state is updated
  678. var currentSlide = _this.state.currentSlide;
  679. var _slideHandler = Object(_utils_innerSliderUtils__WEBPACK_IMPORTED_MODULE_5__["slideHandler"])(_objectSpread({
  680. index: index
  681. }, _this.props, _this.state, {
  682. trackRef: _this.track,
  683. useCSS: _this.props.useCSS && !dontAnimate
  684. })),
  685. state = _slideHandler.state,
  686. nextState = _slideHandler.nextState;
  687. if (!state) return;
  688. beforeChange && beforeChange(currentSlide, state.currentSlide);
  689. var slidesToLoad = state.lazyLoadedList.filter(function (value) {
  690. return _this.state.lazyLoadedList.indexOf(value) < 0;
  691. });
  692. onLazyLoad && slidesToLoad.length > 0 && onLazyLoad(slidesToLoad);
  693. _this.setState(state, function () {
  694. asNavFor && asNavFor.innerSlider.state.currentSlide !== _this.state.currentSlide && asNavFor.innerSlider.slideHandler(index);
  695. if (!nextState) return;
  696. _this.animationEndCallback = setTimeout(function () {
  697. var animating = nextState.animating,
  698. firstBatch = _objectWithoutProperties(nextState, ["animating"]);
  699. _this.setState(firstBatch, function () {
  700. _this.callbackTimers.push(setTimeout(function () {
  701. return _this.setState({
  702. animating: animating
  703. });
  704. }, 10));
  705. afterChange && afterChange(state.currentSlide);
  706. delete _this.animationEndCallback;
  707. });
  708. }, speed);
  709. });
  710. });
  711. _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "changeSlide", function (options) {
  712. var dontAnimate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  713. var spec = _objectSpread({}, _this.props, _this.state);
  714. var targetSlide = Object(_utils_innerSliderUtils__WEBPACK_IMPORTED_MODULE_5__["changeSlide"])(spec, options);
  715. if (targetSlide !== 0 && !targetSlide) return;
  716. if (dontAnimate === true) {
  717. _this.slideHandler(targetSlide, dontAnimate);
  718. } else {
  719. _this.slideHandler(targetSlide);
  720. }
  721. });
  722. _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "clickHandler", function (e) {
  723. if (_this.clickable === false) {
  724. e.stopPropagation();
  725. e.preventDefault();
  726. }
  727. _this.clickable = true;
  728. });
  729. _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "keyHandler", function (e) {
  730. var dir = Object(_utils_innerSliderUtils__WEBPACK_IMPORTED_MODULE_5__["keyHandler"])(e, _this.props.accessibility, _this.props.rtl);
  731. dir !== "" && _this.changeSlide({
  732. message: dir
  733. });
  734. });
  735. _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "selectHandler", function (options) {
  736. _this.changeSlide(options);
  737. });
  738. _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "disableBodyScroll", function () {
  739. var preventDefault = function preventDefault(e) {
  740. e = e || window.event;
  741. if (e.preventDefault) e.preventDefault();
  742. e.returnValue = false;
  743. };
  744. window.ontouchmove = preventDefault;
  745. });
  746. _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "enableBodyScroll", function () {
  747. window.ontouchmove = null;
  748. });
  749. _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "swipeStart", function (e) {
  750. if (_this.props.verticalSwiping) {
  751. _this.disableBodyScroll();
  752. }
  753. var state = Object(_utils_innerSliderUtils__WEBPACK_IMPORTED_MODULE_5__["swipeStart"])(e, _this.props.swipe, _this.props.draggable);
  754. state !== "" && _this.setState(state);
  755. });
  756. _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "swipeMove", function (e) {
  757. var state = Object(_utils_innerSliderUtils__WEBPACK_IMPORTED_MODULE_5__["swipeMove"])(e, _objectSpread({}, _this.props, _this.state, {
  758. trackRef: _this.track,
  759. listRef: _this.list,
  760. slideIndex: _this.state.currentSlide
  761. }));
  762. if (!state) return;
  763. if (state["swiping"]) {
  764. _this.clickable = false;
  765. }
  766. _this.setState(state);
  767. });
  768. _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "swipeEnd", function (e) {
  769. var state = Object(_utils_innerSliderUtils__WEBPACK_IMPORTED_MODULE_5__["swipeEnd"])(e, _objectSpread({}, _this.props, _this.state, {
  770. trackRef: _this.track,
  771. listRef: _this.list,
  772. slideIndex: _this.state.currentSlide
  773. }));
  774. if (!state) return;
  775. var triggerSlideHandler = state["triggerSlideHandler"];
  776. delete state["triggerSlideHandler"];
  777. _this.setState(state);
  778. if (triggerSlideHandler === undefined) return;
  779. _this.slideHandler(triggerSlideHandler);
  780. if (_this.props.verticalSwiping) {
  781. _this.enableBodyScroll();
  782. }
  783. });
  784. _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "slickPrev", function () {
  785. // this and fellow methods are wrapped in setTimeout
  786. // to make sure initialize setState has happened before
  787. // any of such methods are called
  788. _this.callbackTimers.push(setTimeout(function () {
  789. return _this.changeSlide({
  790. message: "previous"
  791. });
  792. }, 0));
  793. });
  794. _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "slickNext", function () {
  795. _this.callbackTimers.push(setTimeout(function () {
  796. return _this.changeSlide({
  797. message: "next"
  798. });
  799. }, 0));
  800. });
  801. _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "slickGoTo", function (slide) {
  802. var dontAnimate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  803. slide = Number(slide);
  804. if (isNaN(slide)) return "";
  805. _this.callbackTimers.push(setTimeout(function () {
  806. return _this.changeSlide({
  807. message: "index",
  808. index: slide,
  809. currentSlide: _this.state.currentSlide
  810. }, dontAnimate);
  811. }, 0));
  812. });
  813. _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "play", function () {
  814. var nextIndex;
  815. if (_this.props.rtl) {
  816. nextIndex = _this.state.currentSlide - _this.props.slidesToScroll;
  817. } else {
  818. if (Object(_utils_innerSliderUtils__WEBPACK_IMPORTED_MODULE_5__["canGoNext"])(_objectSpread({}, _this.props, _this.state))) {
  819. nextIndex = _this.state.currentSlide + _this.props.slidesToScroll;
  820. } else {
  821. return false;
  822. }
  823. }
  824. _this.slideHandler(nextIndex);
  825. });
  826. _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "autoPlay", function (playType) {
  827. if (_this.autoplayTimer) {
  828. clearInterval(_this.autoplayTimer);
  829. }
  830. var autoplaying = _this.state.autoplaying;
  831. if (playType === "update") {
  832. if (autoplaying === "hovered" || autoplaying === "focused" || autoplaying === "paused") {
  833. return;
  834. }
  835. } else if (playType === "leave") {
  836. if (autoplaying === "paused" || autoplaying === "focused") {
  837. return;
  838. }
  839. } else if (playType === "blur") {
  840. if (autoplaying === "paused" || autoplaying === "hovered") {
  841. return;
  842. }
  843. }
  844. _this.autoplayTimer = setInterval(_this.play, _this.props.autoplaySpeed + 50);
  845. _this.setState({
  846. autoplaying: "playing"
  847. });
  848. });
  849. _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "pause", function (pauseType) {
  850. if (_this.autoplayTimer) {
  851. clearInterval(_this.autoplayTimer);
  852. _this.autoplayTimer = null;
  853. }
  854. var autoplaying = _this.state.autoplaying;
  855. if (pauseType === "paused") {
  856. _this.setState({
  857. autoplaying: "paused"
  858. });
  859. } else if (pauseType === "focused") {
  860. if (autoplaying === "hovered" || autoplaying === "playing") {
  861. _this.setState({
  862. autoplaying: "focused"
  863. });
  864. }
  865. } else {
  866. // pauseType is 'hovered'
  867. if (autoplaying === "playing") {
  868. _this.setState({
  869. autoplaying: "hovered"
  870. });
  871. }
  872. }
  873. });
  874. _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "onDotsOver", function () {
  875. return _this.props.autoplay && _this.pause("hovered");
  876. });
  877. _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "onDotsLeave", function () {
  878. return _this.props.autoplay && _this.state.autoplaying === "hovered" && _this.autoPlay("leave");
  879. });
  880. _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "onTrackOver", function () {
  881. return _this.props.autoplay && _this.pause("hovered");
  882. });
  883. _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "onTrackLeave", function () {
  884. return _this.props.autoplay && _this.state.autoplaying === "hovered" && _this.autoPlay("leave");
  885. });
  886. _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "onSlideFocus", function () {
  887. return _this.props.autoplay && _this.pause("focused");
  888. });
  889. _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "onSlideBlur", function () {
  890. return _this.props.autoplay && _this.state.autoplaying === "focused" && _this.autoPlay("blur");
  891. });
  892. _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "render", function () {
  893. var className = classnames__WEBPACK_IMPORTED_MODULE_4___default()("slick-slider", _this.props.className, {
  894. "slick-vertical": _this.props.vertical,
  895. "slick-initialized": true
  896. });
  897. var spec = _objectSpread({}, _this.props, _this.state);
  898. var trackProps = Object(_utils_innerSliderUtils__WEBPACK_IMPORTED_MODULE_5__["extractObject"])(spec, ["fade", "cssEase", "speed", "infinite", "centerMode", "focusOnSelect", "currentSlide", "lazyLoad", "lazyLoadedList", "rtl", "slideWidth", "slideHeight", "listHeight", "vertical", "slidesToShow", "slidesToScroll", "slideCount", "trackStyle", "variableWidth", "unslick", "centerPadding"]);
  899. var pauseOnHover = _this.props.pauseOnHover;
  900. trackProps = _objectSpread({}, trackProps, {
  901. onMouseEnter: pauseOnHover ? _this.onTrackOver : null,
  902. onMouseLeave: pauseOnHover ? _this.onTrackLeave : null,
  903. onMouseOver: pauseOnHover ? _this.onTrackOver : null,
  904. focusOnSelect: _this.props.focusOnSelect ? _this.selectHandler : null
  905. });
  906. var dots;
  907. if (_this.props.dots === true && _this.state.slideCount >= _this.props.slidesToShow) {
  908. var dotProps = Object(_utils_innerSliderUtils__WEBPACK_IMPORTED_MODULE_5__["extractObject"])(spec, ["dotsClass", "slideCount", "slidesToShow", "currentSlide", "slidesToScroll", "clickHandler", "children", "customPaging", "infinite", "appendDots"]);
  909. var pauseOnDotsHover = _this.props.pauseOnDotsHover;
  910. dotProps = _objectSpread({}, dotProps, {
  911. clickHandler: _this.changeSlide,
  912. onMouseEnter: pauseOnDotsHover ? _this.onDotsLeave : null,
  913. onMouseOver: pauseOnDotsHover ? _this.onDotsOver : null,
  914. onMouseLeave: pauseOnDotsHover ? _this.onDotsLeave : null
  915. });
  916. dots = react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_dots__WEBPACK_IMPORTED_MODULE_7__["Dots"], dotProps);
  917. }
  918. var prevArrow, nextArrow;
  919. var arrowProps = Object(_utils_innerSliderUtils__WEBPACK_IMPORTED_MODULE_5__["extractObject"])(spec, ["infinite", "centerMode", "currentSlide", "slideCount", "slidesToShow", "prevArrow", "nextArrow"]);
  920. arrowProps.clickHandler = _this.changeSlide;
  921. if (_this.props.arrows) {
  922. prevArrow = react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_arrows__WEBPACK_IMPORTED_MODULE_8__["PrevArrow"], arrowProps);
  923. nextArrow = react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_arrows__WEBPACK_IMPORTED_MODULE_8__["NextArrow"], arrowProps);
  924. }
  925. var verticalHeightStyle = null;
  926. if (_this.props.vertical) {
  927. verticalHeightStyle = {
  928. height: _this.state.listHeight
  929. };
  930. }
  931. var centerPaddingStyle = null;
  932. if (_this.props.vertical === false) {
  933. if (_this.props.centerMode === true) {
  934. centerPaddingStyle = {
  935. padding: "0px " + _this.props.centerPadding
  936. };
  937. }
  938. } else {
  939. if (_this.props.centerMode === true) {
  940. centerPaddingStyle = {
  941. padding: _this.props.centerPadding + " 0px"
  942. };
  943. }
  944. }
  945. var listStyle = _objectSpread({}, verticalHeightStyle, centerPaddingStyle);
  946. var touchMove = _this.props.touchMove;
  947. var listProps = {
  948. className: "slick-list",
  949. style: listStyle,
  950. onClick: _this.clickHandler,
  951. onMouseDown: touchMove ? _this.swipeStart : null,
  952. onMouseMove: _this.state.dragging && touchMove ? _this.swipeMove : null,
  953. onMouseUp: touchMove ? _this.swipeEnd : null,
  954. onMouseLeave: _this.state.dragging && touchMove ? _this.swipeEnd : null,
  955. onTouchStart: touchMove ? _this.swipeStart : null,
  956. onTouchMove: _this.state.dragging && touchMove ? _this.swipeMove : null,
  957. onTouchEnd: touchMove ? _this.swipeEnd : null,
  958. onTouchCancel: _this.state.dragging && touchMove ? _this.swipeEnd : null,
  959. onKeyDown: _this.props.accessibility ? _this.keyHandler : null
  960. };
  961. var innerSliderProps = {
  962. className: className,
  963. dir: "ltr"
  964. };
  965. if (_this.props.unslick) {
  966. listProps = {
  967. className: "slick-list"
  968. };
  969. innerSliderProps = {
  970. className: className
  971. };
  972. }
  973. return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", innerSliderProps, !_this.props.unslick ? prevArrow : "", react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", _extends({
  974. ref: _this.listRefHandler
  975. }, listProps), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_track__WEBPACK_IMPORTED_MODULE_6__["Track"], _extends({
  976. ref: _this.trackRefHandler
  977. }, trackProps), _this.props.children)), !_this.props.unslick ? nextArrow : "", !_this.props.unslick ? dots : "");
  978. });
  979. _this.list = null;
  980. _this.track = null;
  981. _this.state = _objectSpread({}, _initial_state__WEBPACK_IMPORTED_MODULE_2__["default"], {
  982. currentSlide: _this.props.initialSlide,
  983. slideCount: react__WEBPACK_IMPORTED_MODULE_0___default.a.Children.count(_this.props.children)
  984. });
  985. _this.callbackTimers = [];
  986. _this.clickable = true;
  987. _this.debouncedResize = null;
  988. return _this;
  989. }
  990. return InnerSlider;
  991. }(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component);
  992. /***/ }),
  993. /* 4 */
  994. /***/ (function(module, exports) {
  995. module.exports = __WEBPACK_EXTERNAL_MODULE__4__;
  996. /***/ }),
  997. /* 5 */
  998. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  999. "use strict";
  1000. __webpack_require__.r(__webpack_exports__);
  1001. var initialState = {
  1002. animating: false,
  1003. autoplaying: null,
  1004. currentDirection: 0,
  1005. currentLeft: null,
  1006. currentSlide: 0,
  1007. direction: 1,
  1008. dragging: false,
  1009. edgeDragged: false,
  1010. initialized: false,
  1011. lazyLoadedList: [],
  1012. listHeight: null,
  1013. listWidth: null,
  1014. scrolling: false,
  1015. slideCount: null,
  1016. slideHeight: null,
  1017. slideWidth: null,
  1018. swipeLeft: null,
  1019. swiped: false,
  1020. // used by swipeEvent. differentites between touch and swipe.
  1021. swiping: false,
  1022. touchObject: {
  1023. startX: 0,
  1024. startY: 0,
  1025. curX: 0,
  1026. curY: 0
  1027. },
  1028. trackStyle: {},
  1029. trackWidth: 0
  1030. };
  1031. /* harmony default export */ __webpack_exports__["default"] = (initialState);
  1032. /***/ }),
  1033. /* 6 */
  1034. /***/ (function(module, exports, __webpack_require__) {
  1035. /* WEBPACK VAR INJECTION */(function(global) {/**
  1036. * lodash (Custom Build) <https://lodash.com/>
  1037. * Build: `lodash modularize exports="npm" -o ./`
  1038. * Copyright jQuery Foundation and other contributors <https://jquery.org/>
  1039. * Released under MIT license <https://lodash.com/license>
  1040. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  1041. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  1042. */
  1043. /** Used as the `TypeError` message for "Functions" methods. */
  1044. var FUNC_ERROR_TEXT = 'Expected a function';
  1045. /** Used as references for various `Number` constants. */
  1046. var NAN = 0 / 0;
  1047. /** `Object#toString` result references. */
  1048. var symbolTag = '[object Symbol]';
  1049. /** Used to match leading and trailing whitespace. */
  1050. var reTrim = /^\s+|\s+$/g;
  1051. /** Used to detect bad signed hexadecimal string values. */
  1052. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  1053. /** Used to detect binary string values. */
  1054. var reIsBinary = /^0b[01]+$/i;
  1055. /** Used to detect octal string values. */
  1056. var reIsOctal = /^0o[0-7]+$/i;
  1057. /** Built-in method references without a dependency on `root`. */
  1058. var freeParseInt = parseInt;
  1059. /** Detect free variable `global` from Node.js. */
  1060. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  1061. /** Detect free variable `self`. */
  1062. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  1063. /** Used as a reference to the global object. */
  1064. var root = freeGlobal || freeSelf || Function('return this')();
  1065. /** Used for built-in method references. */
  1066. var objectProto = Object.prototype;
  1067. /**
  1068. * Used to resolve the
  1069. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  1070. * of values.
  1071. */
  1072. var objectToString = objectProto.toString;
  1073. /* Built-in method references for those with the same name as other `lodash` methods. */
  1074. var nativeMax = Math.max,
  1075. nativeMin = Math.min;
  1076. /**
  1077. * Gets the timestamp of the number of milliseconds that have elapsed since
  1078. * the Unix epoch (1 January 1970 00:00:00 UTC).
  1079. *
  1080. * @static
  1081. * @memberOf _
  1082. * @since 2.4.0
  1083. * @category Date
  1084. * @returns {number} Returns the timestamp.
  1085. * @example
  1086. *
  1087. * _.defer(function(stamp) {
  1088. * console.log(_.now() - stamp);
  1089. * }, _.now());
  1090. * // => Logs the number of milliseconds it took for the deferred invocation.
  1091. */
  1092. var now = function() {
  1093. return root.Date.now();
  1094. };
  1095. /**
  1096. * Creates a debounced function that delays invoking `func` until after `wait`
  1097. * milliseconds have elapsed since the last time the debounced function was
  1098. * invoked. The debounced function comes with a `cancel` method to cancel
  1099. * delayed `func` invocations and a `flush` method to immediately invoke them.
  1100. * Provide `options` to indicate whether `func` should be invoked on the
  1101. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  1102. * with the last arguments provided to the debounced function. Subsequent
  1103. * calls to the debounced function return the result of the last `func`
  1104. * invocation.
  1105. *
  1106. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  1107. * invoked on the trailing edge of the timeout only if the debounced function
  1108. * is invoked more than once during the `wait` timeout.
  1109. *
  1110. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  1111. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  1112. *
  1113. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  1114. * for details over the differences between `_.debounce` and `_.throttle`.
  1115. *
  1116. * @static
  1117. * @memberOf _
  1118. * @since 0.1.0
  1119. * @category Function
  1120. * @param {Function} func The function to debounce.
  1121. * @param {number} [wait=0] The number of milliseconds to delay.
  1122. * @param {Object} [options={}] The options object.
  1123. * @param {boolean} [options.leading=false]
  1124. * Specify invoking on the leading edge of the timeout.
  1125. * @param {number} [options.maxWait]
  1126. * The maximum time `func` is allowed to be delayed before it's invoked.
  1127. * @param {boolean} [options.trailing=true]
  1128. * Specify invoking on the trailing edge of the timeout.
  1129. * @returns {Function} Returns the new debounced function.
  1130. * @example
  1131. *
  1132. * // Avoid costly calculations while the window size is in flux.
  1133. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  1134. *
  1135. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  1136. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  1137. * 'leading': true,
  1138. * 'trailing': false
  1139. * }));
  1140. *
  1141. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  1142. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  1143. * var source = new EventSource('/stream');
  1144. * jQuery(source).on('message', debounced);
  1145. *
  1146. * // Cancel the trailing debounced invocation.
  1147. * jQuery(window).on('popstate', debounced.cancel);
  1148. */
  1149. function debounce(func, wait, options) {
  1150. var lastArgs,
  1151. lastThis,
  1152. maxWait,
  1153. result,
  1154. timerId,
  1155. lastCallTime,
  1156. lastInvokeTime = 0,
  1157. leading = false,
  1158. maxing = false,
  1159. trailing = true;
  1160. if (typeof func != 'function') {
  1161. throw new TypeError(FUNC_ERROR_TEXT);
  1162. }
  1163. wait = toNumber(wait) || 0;
  1164. if (isObject(options)) {
  1165. leading = !!options.leading;
  1166. maxing = 'maxWait' in options;
  1167. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  1168. trailing = 'trailing' in options ? !!options.trailing : trailing;
  1169. }
  1170. function invokeFunc(time) {
  1171. var args = lastArgs,
  1172. thisArg = lastThis;
  1173. lastArgs = lastThis = undefined;
  1174. lastInvokeTime = time;
  1175. result = func.apply(thisArg, args);
  1176. return result;
  1177. }
  1178. function leadingEdge(time) {
  1179. // Reset any `maxWait` timer.
  1180. lastInvokeTime = time;
  1181. // Start the timer for the trailing edge.
  1182. timerId = setTimeout(timerExpired, wait);
  1183. // Invoke the leading edge.
  1184. return leading ? invokeFunc(time) : result;
  1185. }
  1186. function remainingWait(time) {
  1187. var timeSinceLastCall = time - lastCallTime,
  1188. timeSinceLastInvoke = time - lastInvokeTime,
  1189. result = wait - timeSinceLastCall;
  1190. return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
  1191. }
  1192. function shouldInvoke(time) {
  1193. var timeSinceLastCall = time - lastCallTime,
  1194. timeSinceLastInvoke = time - lastInvokeTime;
  1195. // Either this is the first call, activity has stopped and we're at the
  1196. // trailing edge, the system time has gone backwards and we're treating
  1197. // it as the trailing edge, or we've hit the `maxWait` limit.
  1198. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  1199. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  1200. }
  1201. function timerExpired() {
  1202. var time = now();
  1203. if (shouldInvoke(time)) {
  1204. return trailingEdge(time);
  1205. }
  1206. // Restart the timer.
  1207. timerId = setTimeout(timerExpired, remainingWait(time));
  1208. }
  1209. function trailingEdge(time) {
  1210. timerId = undefined;
  1211. // Only invoke if we have `lastArgs` which means `func` has been
  1212. // debounced at least once.
  1213. if (trailing && lastArgs) {
  1214. return invokeFunc(time);
  1215. }
  1216. lastArgs = lastThis = undefined;
  1217. return result;
  1218. }
  1219. function cancel() {
  1220. if (timerId !== undefined) {
  1221. clearTimeout(timerId);
  1222. }
  1223. lastInvokeTime = 0;
  1224. lastArgs = lastCallTime = lastThis = timerId = undefined;
  1225. }
  1226. function flush() {
  1227. return timerId === undefined ? result : trailingEdge(now());
  1228. }
  1229. function debounced() {
  1230. var time = now(),
  1231. isInvoking = shouldInvoke(time);
  1232. lastArgs = arguments;
  1233. lastThis = this;
  1234. lastCallTime = time;
  1235. if (isInvoking) {
  1236. if (timerId === undefined) {
  1237. return leadingEdge(lastCallTime);
  1238. }
  1239. if (maxing) {
  1240. // Handle invocations in a tight loop.
  1241. timerId = setTimeout(timerExpired, wait);
  1242. return invokeFunc(lastCallTime);
  1243. }
  1244. }
  1245. if (timerId === undefined) {
  1246. timerId = setTimeout(timerExpired, wait);
  1247. }
  1248. return result;
  1249. }
  1250. debounced.cancel = cancel;
  1251. debounced.flush = flush;
  1252. return debounced;
  1253. }
  1254. /**
  1255. * Checks if `value` is the
  1256. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  1257. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  1258. *
  1259. * @static
  1260. * @memberOf _
  1261. * @since 0.1.0
  1262. * @category Lang
  1263. * @param {*} value The value to check.
  1264. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  1265. * @example
  1266. *
  1267. * _.isObject({});
  1268. * // => true
  1269. *
  1270. * _.isObject([1, 2, 3]);
  1271. * // => true
  1272. *
  1273. * _.isObject(_.noop);
  1274. * // => true
  1275. *
  1276. * _.isObject(null);
  1277. * // => false
  1278. */
  1279. function isObject(value) {
  1280. var type = typeof value;
  1281. return !!value && (type == 'object' || type == 'function');
  1282. }
  1283. /**
  1284. * Checks if `value` is object-like. A value is object-like if it's not `null`
  1285. * and has a `typeof` result of "object".
  1286. *
  1287. * @static
  1288. * @memberOf _
  1289. * @since 4.0.0
  1290. * @category Lang
  1291. * @param {*} value The value to check.
  1292. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  1293. * @example
  1294. *
  1295. * _.isObjectLike({});
  1296. * // => true
  1297. *
  1298. * _.isObjectLike([1, 2, 3]);
  1299. * // => true
  1300. *
  1301. * _.isObjectLike(_.noop);
  1302. * // => false
  1303. *
  1304. * _.isObjectLike(null);
  1305. * // => false
  1306. */
  1307. function isObjectLike(value) {
  1308. return !!value && typeof value == 'object';
  1309. }
  1310. /**
  1311. * Checks if `value` is classified as a `Symbol` primitive or object.
  1312. *
  1313. * @static
  1314. * @memberOf _
  1315. * @since 4.0.0
  1316. * @category Lang
  1317. * @param {*} value The value to check.
  1318. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  1319. * @example
  1320. *
  1321. * _.isSymbol(Symbol.iterator);
  1322. * // => true
  1323. *
  1324. * _.isSymbol('abc');
  1325. * // => false
  1326. */
  1327. function isSymbol(value) {
  1328. return typeof value == 'symbol' ||
  1329. (isObjectLike(value) && objectToString.call(value) == symbolTag);
  1330. }
  1331. /**
  1332. * Converts `value` to a number.
  1333. *
  1334. * @static
  1335. * @memberOf _
  1336. * @since 4.0.0
  1337. * @category Lang
  1338. * @param {*} value The value to process.
  1339. * @returns {number} Returns the number.
  1340. * @example
  1341. *
  1342. * _.toNumber(3.2);
  1343. * // => 3.2
  1344. *
  1345. * _.toNumber(Number.MIN_VALUE);
  1346. * // => 5e-324
  1347. *
  1348. * _.toNumber(Infinity);
  1349. * // => Infinity
  1350. *
  1351. * _.toNumber('3.2');
  1352. * // => 3.2
  1353. */
  1354. function toNumber(value) {
  1355. if (typeof value == 'number') {
  1356. return value;
  1357. }
  1358. if (isSymbol(value)) {
  1359. return NAN;
  1360. }
  1361. if (isObject(value)) {
  1362. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  1363. value = isObject(other) ? (other + '') : other;
  1364. }
  1365. if (typeof value != 'string') {
  1366. return value === 0 ? value : +value;
  1367. }
  1368. value = value.replace(reTrim, '');
  1369. var isBinary = reIsBinary.test(value);
  1370. return (isBinary || reIsOctal.test(value))
  1371. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  1372. : (reIsBadHex.test(value) ? NAN : +value);
  1373. }
  1374. module.exports = debounce;
  1375. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(7)))
  1376. /***/ }),
  1377. /* 7 */
  1378. /***/ (function(module, exports) {
  1379. var g;
  1380. // This works in non-strict mode
  1381. g = (function() {
  1382. return this;
  1383. })();
  1384. try {
  1385. // This works if eval is allowed (see CSP)
  1386. g = g || new Function("return this")();
  1387. } catch (e) {
  1388. // This works if the window reference is available
  1389. if (typeof window === "object") g = window;
  1390. }
  1391. // g can still be undefined, but nothing to do about it...
  1392. // We return undefined, instead of nothing here, so it's
  1393. // easier to handle this case. if(!global) { ...}
  1394. module.exports = g;
  1395. /***/ }),
  1396. /* 8 */
  1397. /***/ (function(module, exports, __webpack_require__) {
  1398. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  1399. Copyright (c) 2016 Jed Watson.
  1400. Licensed under the MIT License (MIT), see
  1401. http://jedwatson.github.io/classnames
  1402. */
  1403. /* global define */
  1404. (function () {
  1405. 'use strict';
  1406. var hasOwn = {}.hasOwnProperty;
  1407. function classNames () {
  1408. var classes = [];
  1409. for (var i = 0; i < arguments.length; i++) {
  1410. var arg = arguments[i];
  1411. if (!arg) continue;
  1412. var argType = typeof arg;
  1413. if (argType === 'string' || argType === 'number') {
  1414. classes.push(arg);
  1415. } else if (Array.isArray(arg)) {
  1416. classes.push(classNames.apply(null, arg));
  1417. } else if (argType === 'object') {
  1418. for (var key in arg) {
  1419. if (hasOwn.call(arg, key) && arg[key]) {
  1420. classes.push(key);
  1421. }
  1422. }
  1423. }
  1424. }
  1425. return classes.join(' ');
  1426. }
  1427. if ( true && module.exports) {
  1428. module.exports = classNames;
  1429. } else if (true) {
  1430. // register as 'classnames', consistent with npm package name
  1431. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  1432. return classNames;
  1433. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  1434. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  1435. } else {}
  1436. }());
  1437. /***/ }),
  1438. /* 9 */
  1439. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1440. "use strict";
  1441. __webpack_require__.r(__webpack_exports__);
  1442. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getOnDemandLazySlides", function() { return getOnDemandLazySlides; });
  1443. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getRequiredLazySlides", function() { return getRequiredLazySlides; });
  1444. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lazyStartIndex", function() { return lazyStartIndex; });
  1445. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lazyEndIndex", function() { return lazyEndIndex; });
  1446. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lazySlidesOnLeft", function() { return lazySlidesOnLeft; });
  1447. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lazySlidesOnRight", function() { return lazySlidesOnRight; });
  1448. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getWidth", function() { return getWidth; });
  1449. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getHeight", function() { return getHeight; });
  1450. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getSwipeDirection", function() { return getSwipeDirection; });
  1451. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "canGoNext", function() { return canGoNext; });
  1452. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "extractObject", function() { return extractObject; });
  1453. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "initializedState", function() { return initializedState; });
  1454. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "slideHandler", function() { return slideHandler; });
  1455. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "changeSlide", function() { return changeSlide; });
  1456. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "keyHandler", function() { return keyHandler; });
  1457. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "swipeStart", function() { return swipeStart; });
  1458. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "swipeMove", function() { return swipeMove; });
  1459. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "swipeEnd", function() { return swipeEnd; });
  1460. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getNavigableIndexes", function() { return getNavigableIndexes; });
  1461. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "checkNavigable", function() { return checkNavigable; });
  1462. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getSlideCount", function() { return getSlideCount; });
  1463. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "checkSpecKeys", function() { return checkSpecKeys; });
  1464. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTrackCSS", function() { return getTrackCSS; });
  1465. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTrackAnimateCSS", function() { return getTrackAnimateCSS; });
  1466. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTrackLeft", function() { return getTrackLeft; });
  1467. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getPreClones", function() { return getPreClones; });
  1468. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getPostClones", function() { return getPostClones; });
  1469. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTotalSlides", function() { return getTotalSlides; });
  1470. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "siblingDirection", function() { return siblingDirection; });
  1471. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "slidesOnRight", function() { return slidesOnRight; });
  1472. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "slidesOnLeft", function() { return slidesOnLeft; });
  1473. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "canUseDOM", function() { return canUseDOM; });
  1474. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
  1475. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
  1476. /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4);
  1477. /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__);
  1478. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
  1479. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  1480. var getOnDemandLazySlides = function getOnDemandLazySlides(spec) {
  1481. var onDemandSlides = [];
  1482. var startIndex = lazyStartIndex(spec);
  1483. var endIndex = lazyEndIndex(spec);
  1484. for (var slideIndex = startIndex; slideIndex < endIndex; slideIndex++) {
  1485. if (spec.lazyLoadedList.indexOf(slideIndex) < 0) {
  1486. onDemandSlides.push(slideIndex);
  1487. }
  1488. }
  1489. return onDemandSlides;
  1490. }; // return list of slides that need to be present
  1491. var getRequiredLazySlides = function getRequiredLazySlides(spec) {
  1492. var requiredSlides = [];
  1493. var startIndex = lazyStartIndex(spec);
  1494. var endIndex = lazyEndIndex(spec);
  1495. for (var slideIndex = startIndex; slideIndex < endIndex; slideIndex++) {
  1496. requiredSlides.push(slideIndex);
  1497. }
  1498. return requiredSlides;
  1499. }; // startIndex that needs to be present
  1500. var lazyStartIndex = function lazyStartIndex(spec) {
  1501. return spec.currentSlide - lazySlidesOnLeft(spec);
  1502. };
  1503. var lazyEndIndex = function lazyEndIndex(spec) {
  1504. return spec.currentSlide + lazySlidesOnRight(spec);
  1505. };
  1506. var lazySlidesOnLeft = function lazySlidesOnLeft(spec) {
  1507. return spec.centerMode ? Math.floor(spec.slidesToShow / 2) + (parseInt(spec.centerPadding) > 0 ? 1 : 0) : 0;
  1508. };
  1509. var lazySlidesOnRight = function lazySlidesOnRight(spec) {
  1510. return spec.centerMode ? Math.floor((spec.slidesToShow - 1) / 2) + 1 + (parseInt(spec.centerPadding) > 0 ? 1 : 0) : spec.slidesToShow;
  1511. }; // get width of an element
  1512. var getWidth = function getWidth(elem) {
  1513. return elem && elem.offsetWidth || 0;
  1514. };
  1515. var getHeight = function getHeight(elem) {
  1516. return elem && elem.offsetHeight || 0;
  1517. };
  1518. var getSwipeDirection = function getSwipeDirection(touchObject) {
  1519. var verticalSwiping = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  1520. var xDist, yDist, r, swipeAngle;
  1521. xDist = touchObject.startX - touchObject.curX;
  1522. yDist = touchObject.startY - touchObject.curY;
  1523. r = Math.atan2(yDist, xDist);
  1524. swipeAngle = Math.round(r * 180 / Math.PI);
  1525. if (swipeAngle < 0) {
  1526. swipeAngle = 360 - Math.abs(swipeAngle);
  1527. }
  1528. if (swipeAngle <= 45 && swipeAngle >= 0 || swipeAngle <= 360 && swipeAngle >= 315) {
  1529. return "left";
  1530. }
  1531. if (swipeAngle >= 135 && swipeAngle <= 225) {
  1532. return "right";
  1533. }
  1534. if (verticalSwiping === true) {
  1535. if (swipeAngle >= 35 && swipeAngle <= 135) {
  1536. return "up";
  1537. } else {
  1538. return "down";
  1539. }
  1540. }
  1541. return "vertical";
  1542. }; // whether or not we can go next
  1543. var canGoNext = function canGoNext(spec) {
  1544. var canGo = true;
  1545. if (!spec.infinite) {
  1546. if (spec.centerMode && spec.currentSlide >= spec.slideCount - 1) {
  1547. canGo = false;
  1548. } else if (spec.slideCount <= spec.slidesToShow || spec.currentSlide >= spec.slideCount - spec.slidesToShow) {
  1549. canGo = false;
  1550. }
  1551. }
  1552. return canGo;
  1553. }; // given an object and a list of keys, return new object with given keys
  1554. var extractObject = function extractObject(spec, keys) {
  1555. var newObject = {};
  1556. keys.forEach(function (key) {
  1557. return newObject[key] = spec[key];
  1558. });
  1559. return newObject;
  1560. }; // get initialized state
  1561. var initializedState = function initializedState(spec) {
  1562. // spec also contains listRef, trackRef
  1563. var slideCount = react__WEBPACK_IMPORTED_MODULE_0___default.a.Children.count(spec.children);
  1564. var listWidth = Math.ceil(getWidth(react_dom__WEBPACK_IMPORTED_MODULE_1___default.a.findDOMNode(spec.listRef)));
  1565. var trackWidth = Math.ceil(getWidth(react_dom__WEBPACK_IMPORTED_MODULE_1___default.a.findDOMNode(spec.trackRef)));
  1566. var slideWidth;
  1567. if (!spec.vertical) {
  1568. var centerPaddingAdj = spec.centerMode && parseInt(spec.centerPadding) * 2;
  1569. if (typeof spec.centerPadding === "string" && spec.centerPadding.slice(-1) === "%") {
  1570. centerPaddingAdj *= listWidth / 100;
  1571. }
  1572. slideWidth = Math.ceil((listWidth - centerPaddingAdj) / spec.slidesToShow);
  1573. } else {
  1574. slideWidth = listWidth;
  1575. }
  1576. var slideHeight = react_dom__WEBPACK_IMPORTED_MODULE_1___default.a.findDOMNode(spec.listRef) && getHeight(react_dom__WEBPACK_IMPORTED_MODULE_1___default.a.findDOMNode(spec.listRef).querySelector('[data-index="0"]'));
  1577. var listHeight = slideHeight * spec.slidesToShow;
  1578. var currentSlide = spec.currentSlide === undefined ? spec.initialSlide : spec.currentSlide;
  1579. if (spec.rtl && spec.currentSlide === undefined) {
  1580. currentSlide = slideCount - 1 - spec.initialSlide;
  1581. }
  1582. var lazyLoadedList = spec.lazyLoadedList || [];
  1583. var slidesToLoad = getOnDemandLazySlides({
  1584. currentSlide: currentSlide,
  1585. lazyLoadedList: lazyLoadedList
  1586. }, spec);
  1587. lazyLoadedList.concat(slidesToLoad);
  1588. var state = {
  1589. slideCount: slideCount,
  1590. slideWidth: slideWidth,
  1591. listWidth: listWidth,
  1592. trackWidth: trackWidth,
  1593. currentSlide: currentSlide,
  1594. slideHeight: slideHeight,
  1595. listHeight: listHeight,
  1596. lazyLoadedList: lazyLoadedList
  1597. };
  1598. if (spec.autoplaying === null && spec.autoplay) {
  1599. state["autoplaying"] = "playing";
  1600. }
  1601. return state;
  1602. };
  1603. var slideHandler = function slideHandler(spec) {
  1604. var waitForAnimate = spec.waitForAnimate,
  1605. animating = spec.animating,
  1606. fade = spec.fade,
  1607. infinite = spec.infinite,
  1608. index = spec.index,
  1609. slideCount = spec.slideCount,
  1610. lazyLoadedList = spec.lazyLoadedList,
  1611. lazyLoad = spec.lazyLoad,
  1612. currentSlide = spec.currentSlide,
  1613. centerMode = spec.centerMode,
  1614. slidesToScroll = spec.slidesToScroll,
  1615. slidesToShow = spec.slidesToShow,
  1616. useCSS = spec.useCSS;
  1617. if (waitForAnimate && animating) return {};
  1618. var animationSlide = index,
  1619. finalSlide,
  1620. animationLeft,
  1621. finalLeft;
  1622. var state = {},
  1623. nextState = {};
  1624. if (fade) {
  1625. if (!infinite && (index < 0 || index >= slideCount)) return {};
  1626. if (index < 0) {
  1627. animationSlide = index + slideCount;
  1628. } else if (index >= slideCount) {
  1629. animationSlide = index - slideCount;
  1630. }
  1631. if (lazyLoad && lazyLoadedList.indexOf(animationSlide) < 0) {
  1632. lazyLoadedList.push(animationSlide);
  1633. }
  1634. state = {
  1635. animating: true,
  1636. currentSlide: animationSlide,
  1637. lazyLoadedList: lazyLoadedList
  1638. };
  1639. nextState = {
  1640. animating: false
  1641. };
  1642. } else {
  1643. finalSlide = animationSlide;
  1644. if (animationSlide < 0) {
  1645. finalSlide = animationSlide + slideCount;
  1646. if (!infinite) finalSlide = 0;else if (slideCount % slidesToScroll !== 0) finalSlide = slideCount - slideCount % slidesToScroll;
  1647. } else if (!canGoNext(spec) && animationSlide > currentSlide) {
  1648. animationSlide = finalSlide = currentSlide;
  1649. } else if (centerMode && animationSlide >= slideCount) {
  1650. animationSlide = infinite ? slideCount : slideCount - 1;
  1651. finalSlide = infinite ? 0 : slideCount - 1;
  1652. } else if (animationSlide >= slideCount) {
  1653. finalSlide = animationSlide - slideCount;
  1654. if (!infinite) finalSlide = slideCount - slidesToShow;else if (slideCount % slidesToScroll !== 0) finalSlide = 0;
  1655. }
  1656. animationLeft = getTrackLeft(_objectSpread({}, spec, {
  1657. slideIndex: animationSlide
  1658. }));
  1659. finalLeft = getTrackLeft(_objectSpread({}, spec, {
  1660. slideIndex: finalSlide
  1661. }));
  1662. if (!infinite) {
  1663. if (animationLeft === finalLeft) animationSlide = finalSlide;
  1664. animationLeft = finalLeft;
  1665. }
  1666. lazyLoad && lazyLoadedList.concat(getOnDemandLazySlides(_objectSpread({}, spec, {
  1667. currentSlide: animationSlide
  1668. })));
  1669. if (!useCSS) {
  1670. state = {
  1671. currentSlide: finalSlide,
  1672. trackStyle: getTrackCSS(_objectSpread({}, spec, {
  1673. left: finalLeft
  1674. })),
  1675. lazyLoadedList: lazyLoadedList
  1676. };
  1677. } else {
  1678. state = {
  1679. animating: true,
  1680. currentSlide: finalSlide,
  1681. trackStyle: getTrackAnimateCSS(_objectSpread({}, spec, {
  1682. left: animationLeft
  1683. })),
  1684. lazyLoadedList: lazyLoadedList
  1685. };
  1686. nextState = {
  1687. animating: false,
  1688. currentSlide: finalSlide,
  1689. trackStyle: getTrackCSS(_objectSpread({}, spec, {
  1690. left: finalLeft
  1691. })),
  1692. swipeLeft: null
  1693. };
  1694. }
  1695. }
  1696. return {
  1697. state: state,
  1698. nextState: nextState
  1699. };
  1700. };
  1701. var changeSlide = function changeSlide(spec, options) {
  1702. var indexOffset, previousInt, slideOffset, unevenOffset, targetSlide;
  1703. var slidesToScroll = spec.slidesToScroll,
  1704. slidesToShow = spec.slidesToShow,
  1705. slideCount = spec.slideCount,
  1706. currentSlide = spec.currentSlide,
  1707. lazyLoad = spec.lazyLoad,
  1708. infinite = spec.infinite;
  1709. unevenOffset = slideCount % slidesToScroll !== 0;
  1710. indexOffset = unevenOffset ? 0 : (slideCount - currentSlide) % slidesToScroll;
  1711. if (options.message === "previous") {
  1712. slideOffset = indexOffset === 0 ? slidesToScroll : slidesToShow - indexOffset;
  1713. targetSlide = currentSlide - slideOffset;
  1714. if (lazyLoad && !infinite) {
  1715. previousInt = currentSlide - slideOffset;
  1716. targetSlide = previousInt === -1 ? slideCount - 1 : previousInt;
  1717. }
  1718. } else if (options.message === "next") {
  1719. slideOffset = indexOffset === 0 ? slidesToScroll : indexOffset;
  1720. targetSlide = currentSlide + slideOffset;
  1721. if (lazyLoad && !infinite) {
  1722. targetSlide = (currentSlide + slidesToScroll) % slideCount + indexOffset;
  1723. }
  1724. } else if (options.message === "dots") {
  1725. // Click on dots
  1726. targetSlide = options.index * options.slidesToScroll;
  1727. if (targetSlide === options.currentSlide) {
  1728. return null;
  1729. }
  1730. } else if (options.message === "children") {
  1731. // Click on the slides
  1732. targetSlide = options.index;
  1733. if (targetSlide === options.currentSlide) {
  1734. return null;
  1735. }
  1736. if (infinite) {
  1737. var direction = siblingDirection(_objectSpread({}, spec, {
  1738. targetSlide: targetSlide
  1739. }));
  1740. if (targetSlide > options.currentSlide && direction === "left") {
  1741. targetSlide = targetSlide - slideCount;
  1742. } else if (targetSlide < options.currentSlide && direction === "right") {
  1743. targetSlide = targetSlide + slideCount;
  1744. }
  1745. }
  1746. } else if (options.message === "index") {
  1747. targetSlide = Number(options.index);
  1748. if (targetSlide === options.currentSlide) {
  1749. return null;
  1750. }
  1751. }
  1752. return targetSlide;
  1753. };
  1754. var keyHandler = function keyHandler(e, accessibility, rtl) {
  1755. if (e.target.tagName.match("TEXTAREA|INPUT|SELECT") || !accessibility) return "";
  1756. if (e.keyCode === 37) return rtl ? "next" : "previous";
  1757. if (e.keyCode === 39) return rtl ? "previous" : "next";
  1758. return "";
  1759. };
  1760. var swipeStart = function swipeStart(e, swipe, draggable) {
  1761. e.target.tagName === "IMG" && e.preventDefault();
  1762. if (!swipe || !draggable && e.type.indexOf("mouse") !== -1) return "";
  1763. return {
  1764. dragging: true,
  1765. touchObject: {
  1766. startX: e.touches ? e.touches[0].pageX : e.clientX,
  1767. startY: e.touches ? e.touches[0].pageY : e.clientY,
  1768. curX: e.touches ? e.touches[0].pageX : e.clientX,
  1769. curY: e.touches ? e.touches[0].pageY : e.clientY
  1770. }
  1771. };
  1772. };
  1773. var swipeMove = function swipeMove(e, spec) {
  1774. // spec also contains, trackRef and slideIndex
  1775. var scrolling = spec.scrolling,
  1776. animating = spec.animating,
  1777. vertical = spec.vertical,
  1778. swipeToSlide = spec.swipeToSlide,
  1779. verticalSwiping = spec.verticalSwiping,
  1780. rtl = spec.rtl,
  1781. currentSlide = spec.currentSlide,
  1782. edgeFriction = spec.edgeFriction,
  1783. edgeDragged = spec.edgeDragged,
  1784. onEdge = spec.onEdge,
  1785. swiped = spec.swiped,
  1786. swiping = spec.swiping,
  1787. slideCount = spec.slideCount,
  1788. slidesToScroll = spec.slidesToScroll,
  1789. infinite = spec.infinite,
  1790. touchObject = spec.touchObject,
  1791. swipeEvent = spec.swipeEvent,
  1792. listHeight = spec.listHeight,
  1793. listWidth = spec.listWidth;
  1794. if (scrolling) return;
  1795. if (animating) return e.preventDefault();
  1796. if (vertical && swipeToSlide && verticalSwiping) e.preventDefault();
  1797. var swipeLeft,
  1798. state = {};
  1799. var curLeft = getTrackLeft(spec);
  1800. touchObject.curX = e.touches ? e.touches[0].pageX : e.clientX;
  1801. touchObject.curY = e.touches ? e.touches[0].pageY : e.clientY;
  1802. touchObject.swipeLength = Math.round(Math.sqrt(Math.pow(touchObject.curX - touchObject.startX, 2)));
  1803. var verticalSwipeLength = Math.round(Math.sqrt(Math.pow(touchObject.curY - touchObject.startY, 2)));
  1804. if (!verticalSwiping && !swiping && verticalSwipeLength > 10) {
  1805. return {
  1806. scrolling: true
  1807. };
  1808. }
  1809. if (verticalSwiping) touchObject.swipeLength = verticalSwipeLength;
  1810. var positionOffset = (!rtl ? 1 : -1) * (touchObject.curX > touchObject.startX ? 1 : -1);
  1811. if (verticalSwiping) positionOffset = touchObject.curY > touchObject.startY ? 1 : -1;
  1812. var dotCount = Math.ceil(slideCount / slidesToScroll);
  1813. var swipeDirection = getSwipeDirection(spec.touchObject, verticalSwiping);
  1814. var touchSwipeLength = touchObject.swipeLength;
  1815. if (!infinite) {
  1816. if (currentSlide === 0 && swipeDirection === "right" || currentSlide + 1 >= dotCount && swipeDirection === "left" || !canGoNext(spec) && swipeDirection === "left") {
  1817. touchSwipeLength = touchObject.swipeLength * edgeFriction;
  1818. if (edgeDragged === false && onEdge) {
  1819. onEdge(swipeDirection);
  1820. state["edgeDragged"] = true;
  1821. }
  1822. }
  1823. }
  1824. if (!swiped && swipeEvent) {
  1825. swipeEvent(swipeDirection);
  1826. state["swiped"] = true;
  1827. }
  1828. if (!vertical) {
  1829. if (!rtl) {
  1830. swipeLeft = curLeft + touchSwipeLength * positionOffset;
  1831. } else {
  1832. swipeLeft = curLeft - touchSwipeLength * positionOffset;
  1833. }
  1834. } else {
  1835. swipeLeft = curLeft + touchSwipeLength * (listHeight / listWidth) * positionOffset;
  1836. }
  1837. if (verticalSwiping) {
  1838. swipeLeft = curLeft + touchSwipeLength * positionOffset;
  1839. }
  1840. state = _objectSpread({}, state, {
  1841. touchObject: touchObject,
  1842. swipeLeft: swipeLeft,
  1843. trackStyle: getTrackCSS(_objectSpread({}, spec, {
  1844. left: swipeLeft
  1845. }))
  1846. });
  1847. if (Math.abs(touchObject.curX - touchObject.startX) < Math.abs(touchObject.curY - touchObject.startY) * 0.8) {
  1848. return state;
  1849. }
  1850. if (touchObject.swipeLength > 10) {
  1851. state["swiping"] = true;
  1852. e.preventDefault();
  1853. }
  1854. return state;
  1855. };
  1856. var swipeEnd = function swipeEnd(e, spec) {
  1857. var dragging = spec.dragging,
  1858. swipe = spec.swipe,
  1859. touchObject = spec.touchObject,
  1860. listWidth = spec.listWidth,
  1861. touchThreshold = spec.touchThreshold,
  1862. verticalSwiping = spec.verticalSwiping,
  1863. listHeight = spec.listHeight,
  1864. currentSlide = spec.currentSlide,
  1865. swipeToSlide = spec.swipeToSlide,
  1866. scrolling = spec.scrolling,
  1867. onSwipe = spec.onSwipe;
  1868. if (!dragging) {
  1869. if (swipe) e.preventDefault();
  1870. return {};
  1871. }
  1872. var minSwipe = verticalSwiping ? listHeight / touchThreshold : listWidth / touchThreshold;
  1873. var swipeDirection = getSwipeDirection(touchObject, verticalSwiping); // reset the state of touch related state variables.
  1874. var state = {
  1875. dragging: false,
  1876. edgeDragged: false,
  1877. scrolling: false,
  1878. swiping: false,
  1879. swiped: false,
  1880. swipeLeft: null,
  1881. touchObject: {}
  1882. };
  1883. if (scrolling) {
  1884. return state;
  1885. }
  1886. if (!touchObject.swipeLength) {
  1887. return state;
  1888. }
  1889. if (touchObject.swipeLength > minSwipe) {
  1890. e.preventDefault();
  1891. if (onSwipe) {
  1892. onSwipe(swipeDirection);
  1893. }
  1894. var slideCount, newSlide;
  1895. switch (swipeDirection) {
  1896. case "left":
  1897. case "up":
  1898. newSlide = currentSlide + getSlideCount(spec);
  1899. slideCount = swipeToSlide ? checkNavigable(spec, newSlide) : newSlide;
  1900. state["currentDirection"] = 0;
  1901. break;
  1902. case "right":
  1903. case "down":
  1904. newSlide = currentSlide - getSlideCount(spec);
  1905. slideCount = swipeToSlide ? checkNavigable(spec, newSlide) : newSlide;
  1906. state["currentDirection"] = 1;
  1907. break;
  1908. default:
  1909. slideCount = currentSlide;
  1910. }
  1911. state["triggerSlideHandler"] = slideCount;
  1912. } else {
  1913. // Adjust the track back to it's original position.
  1914. var currentLeft = getTrackLeft(spec);
  1915. state["trackStyle"] = getTrackAnimateCSS(_objectSpread({}, spec, {
  1916. left: currentLeft
  1917. }));
  1918. }
  1919. return state;
  1920. };
  1921. var getNavigableIndexes = function getNavigableIndexes(spec) {
  1922. var max = spec.infinite ? spec.slideCount * 2 : spec.slideCount;
  1923. var breakpoint = spec.infinite ? spec.slidesToShow * -1 : 0;
  1924. var counter = spec.infinite ? spec.slidesToShow * -1 : 0;
  1925. var indexes = [];
  1926. while (breakpoint < max) {
  1927. indexes.push(breakpoint);
  1928. breakpoint = counter + spec.slidesToScroll;
  1929. counter += Math.min(spec.slidesToScroll, spec.slidesToShow);
  1930. }
  1931. return indexes;
  1932. };
  1933. var checkNavigable = function checkNavigable(spec, index) {
  1934. var navigables = getNavigableIndexes(spec);
  1935. var prevNavigable = 0;
  1936. if (index > navigables[navigables.length - 1]) {
  1937. index = navigables[navigables.length - 1];
  1938. } else {
  1939. for (var n in navigables) {
  1940. if (index < navigables[n]) {
  1941. index = prevNavigable;
  1942. break;
  1943. }
  1944. prevNavigable = navigables[n];
  1945. }
  1946. }
  1947. return index;
  1948. };
  1949. var getSlideCount = function getSlideCount(spec) {
  1950. var centerOffset = spec.centerMode ? spec.slideWidth * Math.floor(spec.slidesToShow / 2) : 0;
  1951. if (spec.swipeToSlide) {
  1952. var swipedSlide;
  1953. var slickList = react_dom__WEBPACK_IMPORTED_MODULE_1___default.a.findDOMNode(spec.listRef);
  1954. var slides = slickList.querySelectorAll(".slick-slide");
  1955. Array.from(slides).every(function (slide) {
  1956. if (!spec.vertical) {
  1957. if (slide.offsetLeft - centerOffset + getWidth(slide) / 2 > spec.swipeLeft * -1) {
  1958. swipedSlide = slide;
  1959. return false;
  1960. }
  1961. } else {
  1962. if (slide.offsetTop + getHeight(slide) / 2 > spec.swipeLeft * -1) {
  1963. swipedSlide = slide;
  1964. return false;
  1965. }
  1966. }
  1967. return true;
  1968. });
  1969. if (!swipedSlide) {
  1970. return 0;
  1971. }
  1972. var currentIndex = spec.rtl === true ? spec.slideCount - spec.currentSlide : spec.currentSlide;
  1973. var slidesTraversed = Math.abs(swipedSlide.dataset.index - currentIndex) || 1;
  1974. return slidesTraversed;
  1975. } else {
  1976. return spec.slidesToScroll;
  1977. }
  1978. };
  1979. var checkSpecKeys = function checkSpecKeys(spec, keysArray) {
  1980. return keysArray.reduce(function (value, key) {
  1981. return value && spec.hasOwnProperty(key);
  1982. }, true) ? null : console.error("Keys Missing:", spec);
  1983. };
  1984. var getTrackCSS = function getTrackCSS(spec) {
  1985. checkSpecKeys(spec, ["left", "variableWidth", "slideCount", "slidesToShow", "slideWidth"]);
  1986. var trackWidth, trackHeight;
  1987. var trackChildren = spec.slideCount + 2 * spec.slidesToShow;
  1988. if (!spec.vertical) {
  1989. trackWidth = getTotalSlides(spec) * spec.slideWidth;
  1990. } else {
  1991. trackHeight = trackChildren * spec.slideHeight;
  1992. }
  1993. var style = {
  1994. opacity: 1,
  1995. transition: "",
  1996. WebkitTransition: ""
  1997. };
  1998. if (spec.useTransform) {
  1999. var WebkitTransform = !spec.vertical ? "translate3d(" + spec.left + "px, 0px, 0px)" : "translate3d(0px, " + spec.left + "px, 0px)";
  2000. var transform = !spec.vertical ? "translate3d(" + spec.left + "px, 0px, 0px)" : "translate3d(0px, " + spec.left + "px, 0px)";
  2001. var msTransform = !spec.vertical ? "translateX(" + spec.left + "px)" : "translateY(" + spec.left + "px)";
  2002. style = _objectSpread({}, style, {
  2003. WebkitTransform: WebkitTransform,
  2004. transform: transform,
  2005. msTransform: msTransform
  2006. });
  2007. } else {
  2008. if (spec.vertical) {
  2009. style["top"] = spec.left;
  2010. } else {
  2011. style["left"] = spec.left;
  2012. }
  2013. }
  2014. if (spec.fade) style = {
  2015. opacity: 1
  2016. };
  2017. if (trackWidth) style.width = trackWidth;
  2018. if (trackHeight) style.height = trackHeight; // Fallback for IE8
  2019. if (window && !window.addEventListener && window.attachEvent) {
  2020. if (!spec.vertical) {
  2021. style.marginLeft = spec.left + "px";
  2022. } else {
  2023. style.marginTop = spec.left + "px";
  2024. }
  2025. }
  2026. return style;
  2027. };
  2028. var getTrackAnimateCSS = function getTrackAnimateCSS(spec) {
  2029. checkSpecKeys(spec, ["left", "variableWidth", "slideCount", "slidesToShow", "slideWidth", "speed", "cssEase"]);
  2030. var style = getTrackCSS(spec); // useCSS is true by default so it can be undefined
  2031. if (spec.useTransform) {
  2032. style.WebkitTransition = "-webkit-transform " + spec.speed + "ms " + spec.cssEase;
  2033. style.transition = "transform " + spec.speed + "ms " + spec.cssEase;
  2034. } else {
  2035. if (spec.vertical) {
  2036. style.transition = "top " + spec.speed + "ms " + spec.cssEase;
  2037. } else {
  2038. style.transition = "left " + spec.speed + "ms " + spec.cssEase;
  2039. }
  2040. }
  2041. return style;
  2042. };
  2043. var getTrackLeft = function getTrackLeft(spec) {
  2044. if (spec.unslick) {
  2045. return 0;
  2046. }
  2047. checkSpecKeys(spec, ["slideIndex", "trackRef", "infinite", "centerMode", "slideCount", "slidesToShow", "slidesToScroll", "slideWidth", "listWidth", "variableWidth", "slideHeight"]);
  2048. var slideIndex = spec.slideIndex,
  2049. trackRef = spec.trackRef,
  2050. infinite = spec.infinite,
  2051. centerMode = spec.centerMode,
  2052. slideCount = spec.slideCount,
  2053. slidesToShow = spec.slidesToShow,
  2054. slidesToScroll = spec.slidesToScroll,
  2055. slideWidth = spec.slideWidth,
  2056. listWidth = spec.listWidth,
  2057. variableWidth = spec.variableWidth,
  2058. slideHeight = spec.slideHeight,
  2059. fade = spec.fade,
  2060. vertical = spec.vertical;
  2061. var slideOffset = 0;
  2062. var targetLeft;
  2063. var targetSlide;
  2064. var verticalOffset = 0;
  2065. if (fade || spec.slideCount === 1) {
  2066. return 0;
  2067. }
  2068. var slidesToOffset = 0;
  2069. if (infinite) {
  2070. slidesToOffset = -getPreClones(spec); // bring active slide to the beginning of visual area
  2071. // if next scroll doesn't have enough children, just reach till the end of original slides instead of shifting slidesToScroll children
  2072. if (slideCount % slidesToScroll !== 0 && slideIndex + slidesToScroll > slideCount) {
  2073. slidesToOffset = -(slideIndex > slideCount ? slidesToShow - (slideIndex - slideCount) : slideCount % slidesToScroll);
  2074. } // shift current slide to center of the frame
  2075. if (centerMode) {
  2076. slidesToOffset += parseInt(slidesToShow / 2);
  2077. }
  2078. } else {
  2079. if (slideCount % slidesToScroll !== 0 && slideIndex + slidesToScroll > slideCount) {
  2080. slidesToOffset = slidesToShow - slideCount % slidesToScroll;
  2081. }
  2082. if (centerMode) {
  2083. slidesToOffset = parseInt(slidesToShow / 2);
  2084. }
  2085. }
  2086. slideOffset = slidesToOffset * slideWidth;
  2087. verticalOffset = slidesToOffset * slideHeight;
  2088. if (!vertical) {
  2089. targetLeft = slideIndex * slideWidth * -1 + slideOffset;
  2090. } else {
  2091. targetLeft = slideIndex * slideHeight * -1 + verticalOffset;
  2092. }
  2093. if (variableWidth === true) {
  2094. var targetSlideIndex;
  2095. var trackElem = react_dom__WEBPACK_IMPORTED_MODULE_1___default.a.findDOMNode(trackRef);
  2096. targetSlideIndex = slideIndex + getPreClones(spec);
  2097. targetSlide = trackElem && trackElem.childNodes[targetSlideIndex];
  2098. targetLeft = targetSlide ? targetSlide.offsetLeft * -1 : 0;
  2099. if (centerMode === true) {
  2100. targetSlideIndex = infinite ? slideIndex + getPreClones(spec) : slideIndex;
  2101. targetSlide = trackElem && trackElem.children[targetSlideIndex];
  2102. targetLeft = 0;
  2103. for (var slide = 0; slide < targetSlideIndex; slide++) {
  2104. targetLeft -= trackElem && trackElem.children[slide] && trackElem.children[slide].offsetWidth;
  2105. }
  2106. targetLeft -= parseInt(spec.centerPadding);
  2107. targetLeft += targetSlide && (listWidth - targetSlide.offsetWidth) / 2;
  2108. }
  2109. }
  2110. return targetLeft;
  2111. };
  2112. var getPreClones = function getPreClones(spec) {
  2113. if (spec.unslick || !spec.infinite) {
  2114. return 0;
  2115. }
  2116. if (spec.variableWidth) {
  2117. return spec.slideCount;
  2118. }
  2119. return spec.slidesToShow + (spec.centerMode ? 1 : 0);
  2120. };
  2121. var getPostClones = function getPostClones(spec) {
  2122. if (spec.unslick || !spec.infinite) {
  2123. return 0;
  2124. }
  2125. return spec.slideCount;
  2126. };
  2127. var getTotalSlides = function getTotalSlides(spec) {
  2128. return spec.slideCount === 1 ? 1 : getPreClones(spec) + spec.slideCount + getPostClones(spec);
  2129. };
  2130. var siblingDirection = function siblingDirection(spec) {
  2131. if (spec.targetSlide > spec.currentSlide) {
  2132. if (spec.targetSlide > spec.currentSlide + slidesOnRight(spec)) {
  2133. return "left";
  2134. }
  2135. return "right";
  2136. } else {
  2137. if (spec.targetSlide < spec.currentSlide - slidesOnLeft(spec)) {
  2138. return "right";
  2139. }
  2140. return "left";
  2141. }
  2142. };
  2143. var slidesOnRight = function slidesOnRight(_ref) {
  2144. var slidesToShow = _ref.slidesToShow,
  2145. centerMode = _ref.centerMode,
  2146. rtl = _ref.rtl,
  2147. centerPadding = _ref.centerPadding;
  2148. // returns no of slides on the right of active slide
  2149. if (centerMode) {
  2150. var right = (slidesToShow - 1) / 2 + 1;
  2151. if (parseInt(centerPadding) > 0) right += 1;
  2152. if (rtl && slidesToShow % 2 === 0) right += 1;
  2153. return right;
  2154. }
  2155. if (rtl) {
  2156. return 0;
  2157. }
  2158. return slidesToShow - 1;
  2159. };
  2160. var slidesOnLeft = function slidesOnLeft(_ref2) {
  2161. var slidesToShow = _ref2.slidesToShow,
  2162. centerMode = _ref2.centerMode,
  2163. rtl = _ref2.rtl,
  2164. centerPadding = _ref2.centerPadding;
  2165. // returns no of slides on the left of active slide
  2166. if (centerMode) {
  2167. var left = (slidesToShow - 1) / 2 + 1;
  2168. if (parseInt(centerPadding) > 0) left += 1;
  2169. if (!rtl && slidesToShow % 2 === 0) left += 1;
  2170. return left;
  2171. }
  2172. if (rtl) {
  2173. return slidesToShow - 1;
  2174. }
  2175. return 0;
  2176. };
  2177. var canUseDOM = function canUseDOM() {
  2178. return !!(typeof window !== "undefined" && window.document && window.document.createElement);
  2179. };
  2180. /***/ }),
  2181. /* 10 */
  2182. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2183. "use strict";
  2184. __webpack_require__.r(__webpack_exports__);
  2185. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Track", function() { return Track; });
  2186. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
  2187. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
  2188. /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8);
  2189. /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__);
  2190. /* harmony import */ var _utils_innerSliderUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(9);
  2191. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  2192. function _extends() { _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; }; return _extends.apply(this, arguments); }
  2193. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2194. 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); } }
  2195. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  2196. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  2197. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  2198. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  2199. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  2200. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  2201. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
  2202. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  2203. // given specifications/props for a slide, fetch all the classes that need to be applied to the slide
  2204. var getSlideClasses = function getSlideClasses(spec) {
  2205. var slickActive, slickCenter, slickCloned;
  2206. var centerOffset, index;
  2207. if (spec.rtl) {
  2208. index = spec.slideCount - 1 - spec.index;
  2209. } else {
  2210. index = spec.index;
  2211. }
  2212. slickCloned = index < 0 || index >= spec.slideCount;
  2213. if (spec.centerMode) {
  2214. centerOffset = Math.floor(spec.slidesToShow / 2);
  2215. slickCenter = (index - spec.currentSlide) % spec.slideCount === 0;
  2216. if (index > spec.currentSlide - centerOffset - 1 && index <= spec.currentSlide + centerOffset) {
  2217. slickActive = true;
  2218. }
  2219. } else {
  2220. slickActive = spec.currentSlide <= index && index < spec.currentSlide + spec.slidesToShow;
  2221. }
  2222. var slickCurrent = index === spec.currentSlide;
  2223. return {
  2224. "slick-slide": true,
  2225. "slick-active": slickActive,
  2226. "slick-center": slickCenter,
  2227. "slick-cloned": slickCloned,
  2228. "slick-current": slickCurrent // dubious in case of RTL
  2229. };
  2230. };
  2231. var getSlideStyle = function getSlideStyle(spec) {
  2232. var style = {};
  2233. if (spec.variableWidth === undefined || spec.variableWidth === false) {
  2234. style.width = spec.slideWidth;
  2235. }
  2236. if (spec.fade) {
  2237. style.position = "relative";
  2238. if (spec.vertical) {
  2239. style.top = -spec.index * parseInt(spec.slideHeight);
  2240. } else {
  2241. style.left = -spec.index * parseInt(spec.slideWidth);
  2242. }
  2243. style.opacity = spec.currentSlide === spec.index ? 1 : 0;
  2244. style.transition = "opacity " + spec.speed + "ms " + spec.cssEase + ", " + "visibility " + spec.speed + "ms " + spec.cssEase;
  2245. style.WebkitTransition = "opacity " + spec.speed + "ms " + spec.cssEase + ", " + "visibility " + spec.speed + "ms " + spec.cssEase;
  2246. }
  2247. return style;
  2248. };
  2249. var getKey = function getKey(child, fallbackKey) {
  2250. return child.key || fallbackKey;
  2251. };
  2252. var renderSlides = function renderSlides(spec) {
  2253. var key;
  2254. var slides = [];
  2255. var preCloneSlides = [];
  2256. var postCloneSlides = [];
  2257. var childrenCount = react__WEBPACK_IMPORTED_MODULE_0___default.a.Children.count(spec.children);
  2258. var startIndex = Object(_utils_innerSliderUtils__WEBPACK_IMPORTED_MODULE_2__["lazyStartIndex"])(spec);
  2259. var endIndex = Object(_utils_innerSliderUtils__WEBPACK_IMPORTED_MODULE_2__["lazyEndIndex"])(spec);
  2260. react__WEBPACK_IMPORTED_MODULE_0___default.a.Children.forEach(spec.children, function (elem, index) {
  2261. var child;
  2262. var childOnClickOptions = {
  2263. message: "children",
  2264. index: index,
  2265. slidesToScroll: spec.slidesToScroll,
  2266. currentSlide: spec.currentSlide
  2267. }; // in case of lazyLoad, whether or not we want to fetch the slide
  2268. if (!spec.lazyLoad || spec.lazyLoad && spec.lazyLoadedList.indexOf(index) >= 0) {
  2269. child = elem;
  2270. } else {
  2271. child = react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", null);
  2272. }
  2273. var childStyle = getSlideStyle(_objectSpread({}, spec, {
  2274. index: index
  2275. }));
  2276. var slideClass = child.props.className || "";
  2277. var slideClasses = getSlideClasses(_objectSpread({}, spec, {
  2278. index: index
  2279. })); // push a cloned element of the desired slide
  2280. slides.push(react__WEBPACK_IMPORTED_MODULE_0___default.a.cloneElement(child, {
  2281. key: "original" + getKey(child, index),
  2282. "data-index": index,
  2283. className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(slideClasses, slideClass),
  2284. tabIndex: "-1",
  2285. "aria-hidden": !slideClasses["slick-active"],
  2286. style: _objectSpread({
  2287. outline: "none"
  2288. }, child.props.style || {}, childStyle),
  2289. onClick: function onClick(e) {
  2290. child.props && child.props.onClick && child.props.onClick(e);
  2291. if (spec.focusOnSelect) {
  2292. spec.focusOnSelect(childOnClickOptions);
  2293. }
  2294. }
  2295. })); // if slide needs to be precloned or postcloned
  2296. if (spec.infinite && spec.fade === false) {
  2297. var preCloneNo = childrenCount - index;
  2298. if (preCloneNo <= Object(_utils_innerSliderUtils__WEBPACK_IMPORTED_MODULE_2__["getPreClones"])(spec) && childrenCount !== spec.slidesToShow) {
  2299. key = -preCloneNo;
  2300. if (key >= startIndex) {
  2301. child = elem;
  2302. }
  2303. slideClasses = getSlideClasses(_objectSpread({}, spec, {
  2304. index: key
  2305. }));
  2306. preCloneSlides.push(react__WEBPACK_IMPORTED_MODULE_0___default.a.cloneElement(child, {
  2307. key: "precloned" + getKey(child, key),
  2308. "data-index": key,
  2309. tabIndex: "-1",
  2310. className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(slideClasses, slideClass),
  2311. "aria-hidden": !slideClasses["slick-active"],
  2312. style: _objectSpread({}, child.props.style || {}, childStyle),
  2313. onClick: function onClick(e) {
  2314. child.props && child.props.onClick && child.props.onClick(e);
  2315. if (spec.focusOnSelect) {
  2316. spec.focusOnSelect(childOnClickOptions);
  2317. }
  2318. }
  2319. }));
  2320. }
  2321. if (childrenCount !== spec.slidesToShow) {
  2322. key = childrenCount + index;
  2323. if (key < endIndex) {
  2324. child = elem;
  2325. }
  2326. slideClasses = getSlideClasses(_objectSpread({}, spec, {
  2327. index: key
  2328. }));
  2329. postCloneSlides.push(react__WEBPACK_IMPORTED_MODULE_0___default.a.cloneElement(child, {
  2330. key: "postcloned" + getKey(child, key),
  2331. "data-index": key,
  2332. tabIndex: "-1",
  2333. className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(slideClasses, slideClass),
  2334. "aria-hidden": !slideClasses["slick-active"],
  2335. style: _objectSpread({}, child.props.style || {}, childStyle),
  2336. onClick: function onClick(e) {
  2337. child.props && child.props.onClick && child.props.onClick(e);
  2338. if (spec.focusOnSelect) {
  2339. spec.focusOnSelect(childOnClickOptions);
  2340. }
  2341. }
  2342. }));
  2343. }
  2344. }
  2345. });
  2346. if (spec.rtl) {
  2347. return preCloneSlides.concat(slides, postCloneSlides).reverse();
  2348. } else {
  2349. return preCloneSlides.concat(slides, postCloneSlides);
  2350. }
  2351. };
  2352. var Track =
  2353. /*#__PURE__*/
  2354. function (_React$PureComponent) {
  2355. _inherits(Track, _React$PureComponent);
  2356. function Track() {
  2357. _classCallCheck(this, Track);
  2358. return _possibleConstructorReturn(this, _getPrototypeOf(Track).apply(this, arguments));
  2359. }
  2360. _createClass(Track, [{
  2361. key: "render",
  2362. value: function render() {
  2363. var slides = renderSlides(this.props);
  2364. var _this$props = this.props,
  2365. onMouseEnter = _this$props.onMouseEnter,
  2366. onMouseOver = _this$props.onMouseOver,
  2367. onMouseLeave = _this$props.onMouseLeave;
  2368. var mouseEvents = {
  2369. onMouseEnter: onMouseEnter,
  2370. onMouseOver: onMouseOver,
  2371. onMouseLeave: onMouseLeave
  2372. };
  2373. return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", _extends({
  2374. className: "slick-track",
  2375. style: this.props.trackStyle
  2376. }, mouseEvents), slides);
  2377. }
  2378. }]);
  2379. return Track;
  2380. }(react__WEBPACK_IMPORTED_MODULE_0___default.a.PureComponent);
  2381. /***/ }),
  2382. /* 11 */
  2383. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2384. "use strict";
  2385. __webpack_require__.r(__webpack_exports__);
  2386. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Dots", function() { return Dots; });
  2387. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
  2388. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
  2389. /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8);
  2390. /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__);
  2391. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  2392. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
  2393. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  2394. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2395. 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); } }
  2396. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  2397. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  2398. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  2399. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  2400. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  2401. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  2402. var getDotCount = function getDotCount(spec) {
  2403. var dots;
  2404. if (spec.infinite) {
  2405. dots = Math.ceil(spec.slideCount / spec.slidesToScroll);
  2406. } else {
  2407. dots = Math.ceil((spec.slideCount - spec.slidesToShow) / spec.slidesToScroll) + 1;
  2408. }
  2409. return dots;
  2410. };
  2411. var Dots =
  2412. /*#__PURE__*/
  2413. function (_React$PureComponent) {
  2414. _inherits(Dots, _React$PureComponent);
  2415. function Dots() {
  2416. _classCallCheck(this, Dots);
  2417. return _possibleConstructorReturn(this, _getPrototypeOf(Dots).apply(this, arguments));
  2418. }
  2419. _createClass(Dots, [{
  2420. key: "clickHandler",
  2421. value: function clickHandler(options, e) {
  2422. // In Autoplay the focus stays on clicked button even after transition
  2423. // to next slide. That only goes away by click somewhere outside
  2424. e.preventDefault();
  2425. this.props.clickHandler(options);
  2426. }
  2427. }, {
  2428. key: "render",
  2429. value: function render() {
  2430. var _this = this;
  2431. var dotCount = getDotCount({
  2432. slideCount: this.props.slideCount,
  2433. slidesToScroll: this.props.slidesToScroll,
  2434. slidesToShow: this.props.slidesToShow,
  2435. infinite: this.props.infinite
  2436. }); // Apply join & split to Array to pre-fill it for IE8
  2437. //
  2438. // Credit: http://stackoverflow.com/a/13735425/1849458
  2439. var _this$props = this.props,
  2440. onMouseEnter = _this$props.onMouseEnter,
  2441. onMouseOver = _this$props.onMouseOver,
  2442. onMouseLeave = _this$props.onMouseLeave;
  2443. var mouseEvents = {
  2444. onMouseEnter: onMouseEnter,
  2445. onMouseOver: onMouseOver,
  2446. onMouseLeave: onMouseLeave
  2447. };
  2448. var dots = Array.apply(null, Array(dotCount + 1).join("0").split("")).map(function (x, i) {
  2449. var leftBound = i * _this.props.slidesToScroll;
  2450. var rightBound = i * _this.props.slidesToScroll + (_this.props.slidesToScroll - 1);
  2451. var className = classnames__WEBPACK_IMPORTED_MODULE_1___default()({
  2452. "slick-active": _this.props.currentSlide >= leftBound && _this.props.currentSlide <= rightBound
  2453. });
  2454. var dotOptions = {
  2455. message: "dots",
  2456. index: i,
  2457. slidesToScroll: _this.props.slidesToScroll,
  2458. currentSlide: _this.props.currentSlide
  2459. };
  2460. var onClick = _this.clickHandler.bind(_this, dotOptions);
  2461. return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("li", {
  2462. key: i,
  2463. className: className
  2464. }, react__WEBPACK_IMPORTED_MODULE_0___default.a.cloneElement(_this.props.customPaging(i), {
  2465. onClick: onClick
  2466. }));
  2467. });
  2468. return react__WEBPACK_IMPORTED_MODULE_0___default.a.cloneElement(this.props.appendDots(dots), _objectSpread({
  2469. className: this.props.dotsClass
  2470. }, mouseEvents));
  2471. }
  2472. }]);
  2473. return Dots;
  2474. }(react__WEBPACK_IMPORTED_MODULE_0___default.a.PureComponent);
  2475. /***/ }),
  2476. /* 12 */
  2477. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2478. "use strict";
  2479. __webpack_require__.r(__webpack_exports__);
  2480. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PrevArrow", function() { return PrevArrow; });
  2481. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NextArrow", function() { return NextArrow; });
  2482. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
  2483. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
  2484. /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8);
  2485. /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__);
  2486. /* harmony import */ var _utils_innerSliderUtils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(9);
  2487. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  2488. function _extends() { _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; }; return _extends.apply(this, arguments); }
  2489. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
  2490. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  2491. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2492. 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); } }
  2493. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  2494. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  2495. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  2496. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  2497. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  2498. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  2499. var PrevArrow =
  2500. /*#__PURE__*/
  2501. function (_React$PureComponent) {
  2502. _inherits(PrevArrow, _React$PureComponent);
  2503. function PrevArrow() {
  2504. _classCallCheck(this, PrevArrow);
  2505. return _possibleConstructorReturn(this, _getPrototypeOf(PrevArrow).apply(this, arguments));
  2506. }
  2507. _createClass(PrevArrow, [{
  2508. key: "clickHandler",
  2509. value: function clickHandler(options, e) {
  2510. if (e) {
  2511. e.preventDefault();
  2512. }
  2513. this.props.clickHandler(options, e);
  2514. }
  2515. }, {
  2516. key: "render",
  2517. value: function render() {
  2518. var prevClasses = {
  2519. "slick-arrow": true,
  2520. "slick-prev": true
  2521. };
  2522. var prevHandler = this.clickHandler.bind(this, {
  2523. message: "previous"
  2524. });
  2525. if (!this.props.infinite && (this.props.currentSlide === 0 || this.props.slideCount <= this.props.slidesToShow)) {
  2526. prevClasses["slick-disabled"] = true;
  2527. prevHandler = null;
  2528. }
  2529. var prevArrowProps = {
  2530. key: "0",
  2531. "data-role": "none",
  2532. className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(prevClasses),
  2533. style: {
  2534. display: "block"
  2535. },
  2536. onClick: prevHandler
  2537. };
  2538. var customProps = {
  2539. currentSlide: this.props.currentSlide,
  2540. slideCount: this.props.slideCount
  2541. };
  2542. var prevArrow;
  2543. if (this.props.prevArrow) {
  2544. prevArrow = react__WEBPACK_IMPORTED_MODULE_0___default.a.cloneElement(this.props.prevArrow, _objectSpread({}, prevArrowProps, customProps));
  2545. } else {
  2546. prevArrow = react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button", _extends({
  2547. key: "0",
  2548. type: "button"
  2549. }, prevArrowProps), " ", "Previous");
  2550. }
  2551. return prevArrow;
  2552. }
  2553. }]);
  2554. return PrevArrow;
  2555. }(react__WEBPACK_IMPORTED_MODULE_0___default.a.PureComponent);
  2556. var NextArrow =
  2557. /*#__PURE__*/
  2558. function (_React$PureComponent2) {
  2559. _inherits(NextArrow, _React$PureComponent2);
  2560. function NextArrow() {
  2561. _classCallCheck(this, NextArrow);
  2562. return _possibleConstructorReturn(this, _getPrototypeOf(NextArrow).apply(this, arguments));
  2563. }
  2564. _createClass(NextArrow, [{
  2565. key: "clickHandler",
  2566. value: function clickHandler(options, e) {
  2567. if (e) {
  2568. e.preventDefault();
  2569. }
  2570. this.props.clickHandler(options, e);
  2571. }
  2572. }, {
  2573. key: "render",
  2574. value: function render() {
  2575. var nextClasses = {
  2576. "slick-arrow": true,
  2577. "slick-next": true
  2578. };
  2579. var nextHandler = this.clickHandler.bind(this, {
  2580. message: "next"
  2581. });
  2582. if (!Object(_utils_innerSliderUtils__WEBPACK_IMPORTED_MODULE_2__["canGoNext"])(this.props)) {
  2583. nextClasses["slick-disabled"] = true;
  2584. nextHandler = null;
  2585. }
  2586. var nextArrowProps = {
  2587. key: "1",
  2588. "data-role": "none",
  2589. className: classnames__WEBPACK_IMPORTED_MODULE_1___default()(nextClasses),
  2590. style: {
  2591. display: "block"
  2592. },
  2593. onClick: nextHandler
  2594. };
  2595. var customProps = {
  2596. currentSlide: this.props.currentSlide,
  2597. slideCount: this.props.slideCount
  2598. };
  2599. var nextArrow;
  2600. if (this.props.nextArrow) {
  2601. nextArrow = react__WEBPACK_IMPORTED_MODULE_0___default.a.cloneElement(this.props.nextArrow, _objectSpread({}, nextArrowProps, customProps));
  2602. } else {
  2603. nextArrow = react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button", _extends({
  2604. key: "1",
  2605. type: "button"
  2606. }, nextArrowProps), " ", "Next");
  2607. }
  2608. return nextArrow;
  2609. }
  2610. }]);
  2611. return NextArrow;
  2612. }(react__WEBPACK_IMPORTED_MODULE_0___default.a.PureComponent);
  2613. /***/ }),
  2614. /* 13 */
  2615. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2616. "use strict";
  2617. __webpack_require__.r(__webpack_exports__);
  2618. /* WEBPACK VAR INJECTION */(function(global) {/**
  2619. * A collection of shims that provide minimal functionality of the ES6 collections.
  2620. *
  2621. * These implementations are not meant to be used outside of the ResizeObserver
  2622. * modules as they cover only a limited range of use cases.
  2623. */
  2624. /* eslint-disable require-jsdoc, valid-jsdoc */
  2625. var MapShim = (function () {
  2626. if (typeof Map !== 'undefined') {
  2627. return Map;
  2628. }
  2629. /**
  2630. * Returns index in provided array that matches the specified key.
  2631. *
  2632. * @param {Array<Array>} arr
  2633. * @param {*} key
  2634. * @returns {number}
  2635. */
  2636. function getIndex(arr, key) {
  2637. var result = -1;
  2638. arr.some(function (entry, index) {
  2639. if (entry[0] === key) {
  2640. result = index;
  2641. return true;
  2642. }
  2643. return false;
  2644. });
  2645. return result;
  2646. }
  2647. return (function () {
  2648. function anonymous() {
  2649. this.__entries__ = [];
  2650. }
  2651. var prototypeAccessors = { size: { configurable: true } };
  2652. /**
  2653. * @returns {boolean}
  2654. */
  2655. prototypeAccessors.size.get = function () {
  2656. return this.__entries__.length;
  2657. };
  2658. /**
  2659. * @param {*} key
  2660. * @returns {*}
  2661. */
  2662. anonymous.prototype.get = function (key) {
  2663. var index = getIndex(this.__entries__, key);
  2664. var entry = this.__entries__[index];
  2665. return entry && entry[1];
  2666. };
  2667. /**
  2668. * @param {*} key
  2669. * @param {*} value
  2670. * @returns {void}
  2671. */
  2672. anonymous.prototype.set = function (key, value) {
  2673. var index = getIndex(this.__entries__, key);
  2674. if (~index) {
  2675. this.__entries__[index][1] = value;
  2676. } else {
  2677. this.__entries__.push([key, value]);
  2678. }
  2679. };
  2680. /**
  2681. * @param {*} key
  2682. * @returns {void}
  2683. */
  2684. anonymous.prototype.delete = function (key) {
  2685. var entries = this.__entries__;
  2686. var index = getIndex(entries, key);
  2687. if (~index) {
  2688. entries.splice(index, 1);
  2689. }
  2690. };
  2691. /**
  2692. * @param {*} key
  2693. * @returns {void}
  2694. */
  2695. anonymous.prototype.has = function (key) {
  2696. return !!~getIndex(this.__entries__, key);
  2697. };
  2698. /**
  2699. * @returns {void}
  2700. */
  2701. anonymous.prototype.clear = function () {
  2702. this.__entries__.splice(0);
  2703. };
  2704. /**
  2705. * @param {Function} callback
  2706. * @param {*} [ctx=null]
  2707. * @returns {void}
  2708. */
  2709. anonymous.prototype.forEach = function (callback, ctx) {
  2710. var this$1 = this;
  2711. if ( ctx === void 0 ) ctx = null;
  2712. for (var i = 0, list = this$1.__entries__; i < list.length; i += 1) {
  2713. var entry = list[i];
  2714. callback.call(ctx, entry[1], entry[0]);
  2715. }
  2716. };
  2717. Object.defineProperties( anonymous.prototype, prototypeAccessors );
  2718. return anonymous;
  2719. }());
  2720. })();
  2721. /**
  2722. * Detects whether window and document objects are available in current environment.
  2723. */
  2724. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && window.document === document;
  2725. // Returns global object of a current environment.
  2726. var global$1 = (function () {
  2727. if (typeof global !== 'undefined' && global.Math === Math) {
  2728. return global;
  2729. }
  2730. if (typeof self !== 'undefined' && self.Math === Math) {
  2731. return self;
  2732. }
  2733. if (typeof window !== 'undefined' && window.Math === Math) {
  2734. return window;
  2735. }
  2736. // eslint-disable-next-line no-new-func
  2737. return Function('return this')();
  2738. })();
  2739. /**
  2740. * A shim for the requestAnimationFrame which falls back to the setTimeout if
  2741. * first one is not supported.
  2742. *
  2743. * @returns {number} Requests' identifier.
  2744. */
  2745. var requestAnimationFrame$1 = (function () {
  2746. if (typeof requestAnimationFrame === 'function') {
  2747. // It's required to use a bounded function because IE sometimes throws
  2748. // an "Invalid calling object" error if rAF is invoked without the global
  2749. // object on the left hand side.
  2750. return requestAnimationFrame.bind(global$1);
  2751. }
  2752. return function (callback) { return setTimeout(function () { return callback(Date.now()); }, 1000 / 60); };
  2753. })();
  2754. // Defines minimum timeout before adding a trailing call.
  2755. var trailingTimeout = 2;
  2756. /**
  2757. * Creates a wrapper function which ensures that provided callback will be
  2758. * invoked only once during the specified delay period.
  2759. *
  2760. * @param {Function} callback - Function to be invoked after the delay period.
  2761. * @param {number} delay - Delay after which to invoke callback.
  2762. * @returns {Function}
  2763. */
  2764. var throttle = function (callback, delay) {
  2765. var leadingCall = false,
  2766. trailingCall = false,
  2767. lastCallTime = 0;
  2768. /**
  2769. * Invokes the original callback function and schedules new invocation if
  2770. * the "proxy" was called during current request.
  2771. *
  2772. * @returns {void}
  2773. */
  2774. function resolvePending() {
  2775. if (leadingCall) {
  2776. leadingCall = false;
  2777. callback();
  2778. }
  2779. if (trailingCall) {
  2780. proxy();
  2781. }
  2782. }
  2783. /**
  2784. * Callback invoked after the specified delay. It will further postpone
  2785. * invocation of the original function delegating it to the
  2786. * requestAnimationFrame.
  2787. *
  2788. * @returns {void}
  2789. */
  2790. function timeoutCallback() {
  2791. requestAnimationFrame$1(resolvePending);
  2792. }
  2793. /**
  2794. * Schedules invocation of the original function.
  2795. *
  2796. * @returns {void}
  2797. */
  2798. function proxy() {
  2799. var timeStamp = Date.now();
  2800. if (leadingCall) {
  2801. // Reject immediately following calls.
  2802. if (timeStamp - lastCallTime < trailingTimeout) {
  2803. return;
  2804. }
  2805. // Schedule new call to be in invoked when the pending one is resolved.
  2806. // This is important for "transitions" which never actually start
  2807. // immediately so there is a chance that we might miss one if change
  2808. // happens amids the pending invocation.
  2809. trailingCall = true;
  2810. } else {
  2811. leadingCall = true;
  2812. trailingCall = false;
  2813. setTimeout(timeoutCallback, delay);
  2814. }
  2815. lastCallTime = timeStamp;
  2816. }
  2817. return proxy;
  2818. };
  2819. // Minimum delay before invoking the update of observers.
  2820. var REFRESH_DELAY = 20;
  2821. // A list of substrings of CSS properties used to find transition events that
  2822. // might affect dimensions of observed elements.
  2823. var transitionKeys = ['top', 'right', 'bottom', 'left', 'width', 'height', 'size', 'weight'];
  2824. // Check if MutationObserver is available.
  2825. var mutationObserverSupported = typeof MutationObserver !== 'undefined';
  2826. /**
  2827. * Singleton controller class which handles updates of ResizeObserver instances.
  2828. */
  2829. var ResizeObserverController = function() {
  2830. this.connected_ = false;
  2831. this.mutationEventsAdded_ = false;
  2832. this.mutationsObserver_ = null;
  2833. this.observers_ = [];
  2834. this.onTransitionEnd_ = this.onTransitionEnd_.bind(this);
  2835. this.refresh = throttle(this.refresh.bind(this), REFRESH_DELAY);
  2836. };
  2837. /**
  2838. * Adds observer to observers list.
  2839. *
  2840. * @param {ResizeObserverSPI} observer - Observer to be added.
  2841. * @returns {void}
  2842. */
  2843. /**
  2844. * Holds reference to the controller's instance.
  2845. *
  2846. * @private {ResizeObserverController}
  2847. */
  2848. /**
  2849. * Keeps reference to the instance of MutationObserver.
  2850. *
  2851. * @private {MutationObserver}
  2852. */
  2853. /**
  2854. * Indicates whether DOM listeners have been added.
  2855. *
  2856. * @private {boolean}
  2857. */
  2858. ResizeObserverController.prototype.addObserver = function (observer) {
  2859. if (!~this.observers_.indexOf(observer)) {
  2860. this.observers_.push(observer);
  2861. }
  2862. // Add listeners if they haven't been added yet.
  2863. if (!this.connected_) {
  2864. this.connect_();
  2865. }
  2866. };
  2867. /**
  2868. * Removes observer from observers list.
  2869. *
  2870. * @param {ResizeObserverSPI} observer - Observer to be removed.
  2871. * @returns {void}
  2872. */
  2873. ResizeObserverController.prototype.removeObserver = function (observer) {
  2874. var observers = this.observers_;
  2875. var index = observers.indexOf(observer);
  2876. // Remove observer if it's present in registry.
  2877. if (~index) {
  2878. observers.splice(index, 1);
  2879. }
  2880. // Remove listeners if controller has no connected observers.
  2881. if (!observers.length && this.connected_) {
  2882. this.disconnect_();
  2883. }
  2884. };
  2885. /**
  2886. * Invokes the update of observers. It will continue running updates insofar
  2887. * it detects changes.
  2888. *
  2889. * @returns {void}
  2890. */
  2891. ResizeObserverController.prototype.refresh = function () {
  2892. var changesDetected = this.updateObservers_();
  2893. // Continue running updates if changes have been detected as there might
  2894. // be future ones caused by CSS transitions.
  2895. if (changesDetected) {
  2896. this.refresh();
  2897. }
  2898. };
  2899. /**
  2900. * Updates every observer from observers list and notifies them of queued
  2901. * entries.
  2902. *
  2903. * @private
  2904. * @returns {boolean} Returns "true" if any observer has detected changes in
  2905. * dimensions of it's elements.
  2906. */
  2907. ResizeObserverController.prototype.updateObservers_ = function () {
  2908. // Collect observers that have active observations.
  2909. var activeObservers = this.observers_.filter(function (observer) {
  2910. return observer.gatherActive(), observer.hasActive();
  2911. });
  2912. // Deliver notifications in a separate cycle in order to avoid any
  2913. // collisions between observers, e.g. when multiple instances of
  2914. // ResizeObserver are tracking the same element and the callback of one
  2915. // of them changes content dimensions of the observed target. Sometimes
  2916. // this may result in notifications being blocked for the rest of observers.
  2917. activeObservers.forEach(function (observer) { return observer.broadcastActive(); });
  2918. return activeObservers.length > 0;
  2919. };
  2920. /**
  2921. * Initializes DOM listeners.
  2922. *
  2923. * @private
  2924. * @returns {void}
  2925. */
  2926. ResizeObserverController.prototype.connect_ = function () {
  2927. // Do nothing if running in a non-browser environment or if listeners
  2928. // have been already added.
  2929. if (!isBrowser || this.connected_) {
  2930. return;
  2931. }
  2932. // Subscription to the "Transitionend" event is used as a workaround for
  2933. // delayed transitions. This way it's possible to capture at least the
  2934. // final state of an element.
  2935. document.addEventListener('transitionend', this.onTransitionEnd_);
  2936. window.addEventListener('resize', this.refresh);
  2937. if (mutationObserverSupported) {
  2938. this.mutationsObserver_ = new MutationObserver(this.refresh);
  2939. this.mutationsObserver_.observe(document, {
  2940. attributes: true,
  2941. childList: true,
  2942. characterData: true,
  2943. subtree: true
  2944. });
  2945. } else {
  2946. document.addEventListener('DOMSubtreeModified', this.refresh);
  2947. this.mutationEventsAdded_ = true;
  2948. }
  2949. this.connected_ = true;
  2950. };
  2951. /**
  2952. * Removes DOM listeners.
  2953. *
  2954. * @private
  2955. * @returns {void}
  2956. */
  2957. ResizeObserverController.prototype.disconnect_ = function () {
  2958. // Do nothing if running in a non-browser environment or if listeners
  2959. // have been already removed.
  2960. if (!isBrowser || !this.connected_) {
  2961. return;
  2962. }
  2963. document.removeEventListener('transitionend', this.onTransitionEnd_);
  2964. window.removeEventListener('resize', this.refresh);
  2965. if (this.mutationsObserver_) {
  2966. this.mutationsObserver_.disconnect();
  2967. }
  2968. if (this.mutationEventsAdded_) {
  2969. document.removeEventListener('DOMSubtreeModified', this.refresh);
  2970. }
  2971. this.mutationsObserver_ = null;
  2972. this.mutationEventsAdded_ = false;
  2973. this.connected_ = false;
  2974. };
  2975. /**
  2976. * "Transitionend" event handler.
  2977. *
  2978. * @private
  2979. * @param {TransitionEvent} event
  2980. * @returns {void}
  2981. */
  2982. ResizeObserverController.prototype.onTransitionEnd_ = function (ref) {
  2983. var propertyName = ref.propertyName; if ( propertyName === void 0 ) propertyName = '';
  2984. // Detect whether transition may affect dimensions of an element.
  2985. var isReflowProperty = transitionKeys.some(function (key) {
  2986. return !!~propertyName.indexOf(key);
  2987. });
  2988. if (isReflowProperty) {
  2989. this.refresh();
  2990. }
  2991. };
  2992. /**
  2993. * Returns instance of the ResizeObserverController.
  2994. *
  2995. * @returns {ResizeObserverController}
  2996. */
  2997. ResizeObserverController.getInstance = function () {
  2998. if (!this.instance_) {
  2999. this.instance_ = new ResizeObserverController();
  3000. }
  3001. return this.instance_;
  3002. };
  3003. ResizeObserverController.instance_ = null;
  3004. /**
  3005. * Defines non-writable/enumerable properties of the provided target object.
  3006. *
  3007. * @param {Object} target - Object for which to define properties.
  3008. * @param {Object} props - Properties to be defined.
  3009. * @returns {Object} Target object.
  3010. */
  3011. var defineConfigurable = (function (target, props) {
  3012. for (var i = 0, list = Object.keys(props); i < list.length; i += 1) {
  3013. var key = list[i];
  3014. Object.defineProperty(target, key, {
  3015. value: props[key],
  3016. enumerable: false,
  3017. writable: false,
  3018. configurable: true
  3019. });
  3020. }
  3021. return target;
  3022. });
  3023. /**
  3024. * Returns the global object associated with provided element.
  3025. *
  3026. * @param {Object} target
  3027. * @returns {Object}
  3028. */
  3029. var getWindowOf = (function (target) {
  3030. // Assume that the element is an instance of Node, which means that it
  3031. // has the "ownerDocument" property from which we can retrieve a
  3032. // corresponding global object.
  3033. var ownerGlobal = target && target.ownerDocument && target.ownerDocument.defaultView;
  3034. // Return the local global object if it's not possible extract one from
  3035. // provided element.
  3036. return ownerGlobal || global$1;
  3037. });
  3038. // Placeholder of an empty content rectangle.
  3039. var emptyRect = createRectInit(0, 0, 0, 0);
  3040. /**
  3041. * Converts provided string to a number.
  3042. *
  3043. * @param {number|string} value
  3044. * @returns {number}
  3045. */
  3046. function toFloat(value) {
  3047. return parseFloat(value) || 0;
  3048. }
  3049. /**
  3050. * Extracts borders size from provided styles.
  3051. *
  3052. * @param {CSSStyleDeclaration} styles
  3053. * @param {...string} positions - Borders positions (top, right, ...)
  3054. * @returns {number}
  3055. */
  3056. function getBordersSize(styles) {
  3057. var positions = [], len = arguments.length - 1;
  3058. while ( len-- > 0 ) positions[ len ] = arguments[ len + 1 ];
  3059. return positions.reduce(function (size, position) {
  3060. var value = styles['border-' + position + '-width'];
  3061. return size + toFloat(value);
  3062. }, 0);
  3063. }
  3064. /**
  3065. * Extracts paddings sizes from provided styles.
  3066. *
  3067. * @param {CSSStyleDeclaration} styles
  3068. * @returns {Object} Paddings box.
  3069. */
  3070. function getPaddings(styles) {
  3071. var positions = ['top', 'right', 'bottom', 'left'];
  3072. var paddings = {};
  3073. for (var i = 0, list = positions; i < list.length; i += 1) {
  3074. var position = list[i];
  3075. var value = styles['padding-' + position];
  3076. paddings[position] = toFloat(value);
  3077. }
  3078. return paddings;
  3079. }
  3080. /**
  3081. * Calculates content rectangle of provided SVG element.
  3082. *
  3083. * @param {SVGGraphicsElement} target - Element content rectangle of which needs
  3084. * to be calculated.
  3085. * @returns {DOMRectInit}
  3086. */
  3087. function getSVGContentRect(target) {
  3088. var bbox = target.getBBox();
  3089. return createRectInit(0, 0, bbox.width, bbox.height);
  3090. }
  3091. /**
  3092. * Calculates content rectangle of provided HTMLElement.
  3093. *
  3094. * @param {HTMLElement} target - Element for which to calculate the content rectangle.
  3095. * @returns {DOMRectInit}
  3096. */
  3097. function getHTMLElementContentRect(target) {
  3098. // Client width & height properties can't be
  3099. // used exclusively as they provide rounded values.
  3100. var clientWidth = target.clientWidth;
  3101. var clientHeight = target.clientHeight;
  3102. // By this condition we can catch all non-replaced inline, hidden and
  3103. // detached elements. Though elements with width & height properties less
  3104. // than 0.5 will be discarded as well.
  3105. //
  3106. // Without it we would need to implement separate methods for each of
  3107. // those cases and it's not possible to perform a precise and performance
  3108. // effective test for hidden elements. E.g. even jQuery's ':visible' filter
  3109. // gives wrong results for elements with width & height less than 0.5.
  3110. if (!clientWidth && !clientHeight) {
  3111. return emptyRect;
  3112. }
  3113. var styles = getWindowOf(target).getComputedStyle(target);
  3114. var paddings = getPaddings(styles);
  3115. var horizPad = paddings.left + paddings.right;
  3116. var vertPad = paddings.top + paddings.bottom;
  3117. // Computed styles of width & height are being used because they are the
  3118. // only dimensions available to JS that contain non-rounded values. It could
  3119. // be possible to utilize the getBoundingClientRect if only it's data wasn't
  3120. // affected by CSS transformations let alone paddings, borders and scroll bars.
  3121. var width = toFloat(styles.width),
  3122. height = toFloat(styles.height);
  3123. // Width & height include paddings and borders when the 'border-box' box
  3124. // model is applied (except for IE).
  3125. if (styles.boxSizing === 'border-box') {
  3126. // Following conditions are required to handle Internet Explorer which
  3127. // doesn't include paddings and borders to computed CSS dimensions.
  3128. //
  3129. // We can say that if CSS dimensions + paddings are equal to the "client"
  3130. // properties then it's either IE, and thus we don't need to subtract
  3131. // anything, or an element merely doesn't have paddings/borders styles.
  3132. if (Math.round(width + horizPad) !== clientWidth) {
  3133. width -= getBordersSize(styles, 'left', 'right') + horizPad;
  3134. }
  3135. if (Math.round(height + vertPad) !== clientHeight) {
  3136. height -= getBordersSize(styles, 'top', 'bottom') + vertPad;
  3137. }
  3138. }
  3139. // Following steps can't be applied to the document's root element as its
  3140. // client[Width/Height] properties represent viewport area of the window.
  3141. // Besides, it's as well not necessary as the <html> itself neither has
  3142. // rendered scroll bars nor it can be clipped.
  3143. if (!isDocumentElement(target)) {
  3144. // In some browsers (only in Firefox, actually) CSS width & height
  3145. // include scroll bars size which can be removed at this step as scroll
  3146. // bars are the only difference between rounded dimensions + paddings
  3147. // and "client" properties, though that is not always true in Chrome.
  3148. var vertScrollbar = Math.round(width + horizPad) - clientWidth;
  3149. var horizScrollbar = Math.round(height + vertPad) - clientHeight;
  3150. // Chrome has a rather weird rounding of "client" properties.
  3151. // E.g. for an element with content width of 314.2px it sometimes gives
  3152. // the client width of 315px and for the width of 314.7px it may give
  3153. // 314px. And it doesn't happen all the time. So just ignore this delta
  3154. // as a non-relevant.
  3155. if (Math.abs(vertScrollbar) !== 1) {
  3156. width -= vertScrollbar;
  3157. }
  3158. if (Math.abs(horizScrollbar) !== 1) {
  3159. height -= horizScrollbar;
  3160. }
  3161. }
  3162. return createRectInit(paddings.left, paddings.top, width, height);
  3163. }
  3164. /**
  3165. * Checks whether provided element is an instance of the SVGGraphicsElement.
  3166. *
  3167. * @param {Element} target - Element to be checked.
  3168. * @returns {boolean}
  3169. */
  3170. var isSVGGraphicsElement = (function () {
  3171. // Some browsers, namely IE and Edge, don't have the SVGGraphicsElement
  3172. // interface.
  3173. if (typeof SVGGraphicsElement !== 'undefined') {
  3174. return function (target) { return target instanceof getWindowOf(target).SVGGraphicsElement; };
  3175. }
  3176. // If it's so, then check that element is at least an instance of the
  3177. // SVGElement and that it has the "getBBox" method.
  3178. // eslint-disable-next-line no-extra-parens
  3179. return function (target) { return target instanceof getWindowOf(target).SVGElement && typeof target.getBBox === 'function'; };
  3180. })();
  3181. /**
  3182. * Checks whether provided element is a document element (<html>).
  3183. *
  3184. * @param {Element} target - Element to be checked.
  3185. * @returns {boolean}
  3186. */
  3187. function isDocumentElement(target) {
  3188. return target === getWindowOf(target).document.documentElement;
  3189. }
  3190. /**
  3191. * Calculates an appropriate content rectangle for provided html or svg element.
  3192. *
  3193. * @param {Element} target - Element content rectangle of which needs to be calculated.
  3194. * @returns {DOMRectInit}
  3195. */
  3196. function getContentRect(target) {
  3197. if (!isBrowser) {
  3198. return emptyRect;
  3199. }
  3200. if (isSVGGraphicsElement(target)) {
  3201. return getSVGContentRect(target);
  3202. }
  3203. return getHTMLElementContentRect(target);
  3204. }
  3205. /**
  3206. * Creates rectangle with an interface of the DOMRectReadOnly.
  3207. * Spec: https://drafts.fxtf.org/geometry/#domrectreadonly
  3208. *
  3209. * @param {DOMRectInit} rectInit - Object with rectangle's x/y coordinates and dimensions.
  3210. * @returns {DOMRectReadOnly}
  3211. */
  3212. function createReadOnlyRect(ref) {
  3213. var x = ref.x;
  3214. var y = ref.y;
  3215. var width = ref.width;
  3216. var height = ref.height;
  3217. // If DOMRectReadOnly is available use it as a prototype for the rectangle.
  3218. var Constr = typeof DOMRectReadOnly !== 'undefined' ? DOMRectReadOnly : Object;
  3219. var rect = Object.create(Constr.prototype);
  3220. // Rectangle's properties are not writable and non-enumerable.
  3221. defineConfigurable(rect, {
  3222. x: x, y: y, width: width, height: height,
  3223. top: y,
  3224. right: x + width,
  3225. bottom: height + y,
  3226. left: x
  3227. });
  3228. return rect;
  3229. }
  3230. /**
  3231. * Creates DOMRectInit object based on the provided dimensions and the x/y coordinates.
  3232. * Spec: https://drafts.fxtf.org/geometry/#dictdef-domrectinit
  3233. *
  3234. * @param {number} x - X coordinate.
  3235. * @param {number} y - Y coordinate.
  3236. * @param {number} width - Rectangle's width.
  3237. * @param {number} height - Rectangle's height.
  3238. * @returns {DOMRectInit}
  3239. */
  3240. function createRectInit(x, y, width, height) {
  3241. return { x: x, y: y, width: width, height: height };
  3242. }
  3243. /**
  3244. * Class that is responsible for computations of the content rectangle of
  3245. * provided DOM element and for keeping track of it's changes.
  3246. */
  3247. var ResizeObservation = function(target) {
  3248. this.broadcastWidth = 0;
  3249. this.broadcastHeight = 0;
  3250. this.contentRect_ = createRectInit(0, 0, 0, 0);
  3251. this.target = target;
  3252. };
  3253. /**
  3254. * Updates content rectangle and tells whether it's width or height properties
  3255. * have changed since the last broadcast.
  3256. *
  3257. * @returns {boolean}
  3258. */
  3259. /**
  3260. * Reference to the last observed content rectangle.
  3261. *
  3262. * @private {DOMRectInit}
  3263. */
  3264. /**
  3265. * Broadcasted width of content rectangle.
  3266. *
  3267. * @type {number}
  3268. */
  3269. ResizeObservation.prototype.isActive = function () {
  3270. var rect = getContentRect(this.target);
  3271. this.contentRect_ = rect;
  3272. return rect.width !== this.broadcastWidth || rect.height !== this.broadcastHeight;
  3273. };
  3274. /**
  3275. * Updates 'broadcastWidth' and 'broadcastHeight' properties with a data
  3276. * from the corresponding properties of the last observed content rectangle.
  3277. *
  3278. * @returns {DOMRectInit} Last observed content rectangle.
  3279. */
  3280. ResizeObservation.prototype.broadcastRect = function () {
  3281. var rect = this.contentRect_;
  3282. this.broadcastWidth = rect.width;
  3283. this.broadcastHeight = rect.height;
  3284. return rect;
  3285. };
  3286. var ResizeObserverEntry = function(target, rectInit) {
  3287. var contentRect = createReadOnlyRect(rectInit);
  3288. // According to the specification following properties are not writable
  3289. // and are also not enumerable in the native implementation.
  3290. //
  3291. // Property accessors are not being used as they'd require to define a
  3292. // private WeakMap storage which may cause memory leaks in browsers that
  3293. // don't support this type of collections.
  3294. defineConfigurable(this, { target: target, contentRect: contentRect });
  3295. };
  3296. var ResizeObserverSPI = function(callback, controller, callbackCtx) {
  3297. this.activeObservations_ = [];
  3298. this.observations_ = new MapShim();
  3299. if (typeof callback !== 'function') {
  3300. throw new TypeError('The callback provided as parameter 1 is not a function.');
  3301. }
  3302. this.callback_ = callback;
  3303. this.controller_ = controller;
  3304. this.callbackCtx_ = callbackCtx;
  3305. };
  3306. /**
  3307. * Starts observing provided element.
  3308. *
  3309. * @param {Element} target - Element to be observed.
  3310. * @returns {void}
  3311. */
  3312. /**
  3313. * Registry of the ResizeObservation instances.
  3314. *
  3315. * @private {Map<Element, ResizeObservation>}
  3316. */
  3317. /**
  3318. * Public ResizeObserver instance which will be passed to the callback
  3319. * function and used as a value of it's "this" binding.
  3320. *
  3321. * @private {ResizeObserver}
  3322. */
  3323. /**
  3324. * Collection of resize observations that have detected changes in dimensions
  3325. * of elements.
  3326. *
  3327. * @private {Array<ResizeObservation>}
  3328. */
  3329. ResizeObserverSPI.prototype.observe = function (target) {
  3330. if (!arguments.length) {
  3331. throw new TypeError('1 argument required, but only 0 present.');
  3332. }
  3333. // Do nothing if current environment doesn't have the Element interface.
  3334. if (typeof Element === 'undefined' || !(Element instanceof Object)) {
  3335. return;
  3336. }
  3337. if (!(target instanceof getWindowOf(target).Element)) {
  3338. throw new TypeError('parameter 1 is not of type "Element".');
  3339. }
  3340. var observations = this.observations_;
  3341. // Do nothing if element is already being observed.
  3342. if (observations.has(target)) {
  3343. return;
  3344. }
  3345. observations.set(target, new ResizeObservation(target));
  3346. this.controller_.addObserver(this);
  3347. // Force the update of observations.
  3348. this.controller_.refresh();
  3349. };
  3350. /**
  3351. * Stops observing provided element.
  3352. *
  3353. * @param {Element} target - Element to stop observing.
  3354. * @returns {void}
  3355. */
  3356. ResizeObserverSPI.prototype.unobserve = function (target) {
  3357. if (!arguments.length) {
  3358. throw new TypeError('1 argument required, but only 0 present.');
  3359. }
  3360. // Do nothing if current environment doesn't have the Element interface.
  3361. if (typeof Element === 'undefined' || !(Element instanceof Object)) {
  3362. return;
  3363. }
  3364. if (!(target instanceof getWindowOf(target).Element)) {
  3365. throw new TypeError('parameter 1 is not of type "Element".');
  3366. }
  3367. var observations = this.observations_;
  3368. // Do nothing if element is not being observed.
  3369. if (!observations.has(target)) {
  3370. return;
  3371. }
  3372. observations.delete(target);
  3373. if (!observations.size) {
  3374. this.controller_.removeObserver(this);
  3375. }
  3376. };
  3377. /**
  3378. * Stops observing all elements.
  3379. *
  3380. * @returns {void}
  3381. */
  3382. ResizeObserverSPI.prototype.disconnect = function () {
  3383. this.clearActive();
  3384. this.observations_.clear();
  3385. this.controller_.removeObserver(this);
  3386. };
  3387. /**
  3388. * Collects observation instances the associated element of which has changed
  3389. * it's content rectangle.
  3390. *
  3391. * @returns {void}
  3392. */
  3393. ResizeObserverSPI.prototype.gatherActive = function () {
  3394. var this$1 = this;
  3395. this.clearActive();
  3396. this.observations_.forEach(function (observation) {
  3397. if (observation.isActive()) {
  3398. this$1.activeObservations_.push(observation);
  3399. }
  3400. });
  3401. };
  3402. /**
  3403. * Invokes initial callback function with a list of ResizeObserverEntry
  3404. * instances collected from active resize observations.
  3405. *
  3406. * @returns {void}
  3407. */
  3408. ResizeObserverSPI.prototype.broadcastActive = function () {
  3409. // Do nothing if observer doesn't have active observations.
  3410. if (!this.hasActive()) {
  3411. return;
  3412. }
  3413. var ctx = this.callbackCtx_;
  3414. // Create ResizeObserverEntry instance for every active observation.
  3415. var entries = this.activeObservations_.map(function (observation) {
  3416. return new ResizeObserverEntry(observation.target, observation.broadcastRect());
  3417. });
  3418. this.callback_.call(ctx, entries, ctx);
  3419. this.clearActive();
  3420. };
  3421. /**
  3422. * Clears the collection of active observations.
  3423. *
  3424. * @returns {void}
  3425. */
  3426. ResizeObserverSPI.prototype.clearActive = function () {
  3427. this.activeObservations_.splice(0);
  3428. };
  3429. /**
  3430. * Tells whether observer has active observations.
  3431. *
  3432. * @returns {boolean}
  3433. */
  3434. ResizeObserverSPI.prototype.hasActive = function () {
  3435. return this.activeObservations_.length > 0;
  3436. };
  3437. // Registry of internal observers. If WeakMap is not available use current shim
  3438. // for the Map collection as it has all required methods and because WeakMap
  3439. // can't be fully polyfilled anyway.
  3440. var observers = typeof WeakMap !== 'undefined' ? new WeakMap() : new MapShim();
  3441. /**
  3442. * ResizeObserver API. Encapsulates the ResizeObserver SPI implementation
  3443. * exposing only those methods and properties that are defined in the spec.
  3444. */
  3445. var ResizeObserver = function(callback) {
  3446. if (!(this instanceof ResizeObserver)) {
  3447. throw new TypeError('Cannot call a class as a function.');
  3448. }
  3449. if (!arguments.length) {
  3450. throw new TypeError('1 argument required, but only 0 present.');
  3451. }
  3452. var controller = ResizeObserverController.getInstance();
  3453. var observer = new ResizeObserverSPI(callback, controller, this);
  3454. observers.set(this, observer);
  3455. };
  3456. // Expose public methods of ResizeObserver.
  3457. ['observe', 'unobserve', 'disconnect'].forEach(function (method) {
  3458. ResizeObserver.prototype[method] = function () {
  3459. return (ref = observers.get(this))[method].apply(ref, arguments);
  3460. var ref;
  3461. };
  3462. });
  3463. var index = (function () {
  3464. // Export existing implementation if available.
  3465. if (typeof global$1.ResizeObserver !== 'undefined') {
  3466. return global$1.ResizeObserver;
  3467. }
  3468. return ResizeObserver;
  3469. })();
  3470. /* harmony default export */ __webpack_exports__["default"] = (index);
  3471. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(7)))
  3472. /***/ }),
  3473. /* 14 */
  3474. /***/ (function(module, exports, __webpack_require__) {
  3475. var camel2hyphen = __webpack_require__(15);
  3476. var isDimension = function (feature) {
  3477. var re = /[height|width]$/;
  3478. return re.test(feature);
  3479. };
  3480. var obj2mq = function (obj) {
  3481. var mq = '';
  3482. var features = Object.keys(obj);
  3483. features.forEach(function (feature, index) {
  3484. var value = obj[feature];
  3485. feature = camel2hyphen(feature);
  3486. // Add px to dimension features
  3487. if (isDimension(feature) && typeof value === 'number') {
  3488. value = value + 'px';
  3489. }
  3490. if (value === true) {
  3491. mq += feature;
  3492. } else if (value === false) {
  3493. mq += 'not ' + feature;
  3494. } else {
  3495. mq += '(' + feature + ': ' + value + ')';
  3496. }
  3497. if (index < features.length-1) {
  3498. mq += ' and '
  3499. }
  3500. });
  3501. return mq;
  3502. };
  3503. var json2mq = function (query) {
  3504. var mq = '';
  3505. if (typeof query === 'string') {
  3506. return query;
  3507. }
  3508. // Handling array of media queries
  3509. if (query instanceof Array) {
  3510. query.forEach(function (q, index) {
  3511. mq += obj2mq(q);
  3512. if (index < query.length-1) {
  3513. mq += ', '
  3514. }
  3515. });
  3516. return mq;
  3517. }
  3518. // Handling single media query
  3519. return obj2mq(query);
  3520. };
  3521. module.exports = json2mq;
  3522. /***/ }),
  3523. /* 15 */
  3524. /***/ (function(module, exports) {
  3525. var camel2hyphen = function (str) {
  3526. return str
  3527. .replace(/[A-Z]/g, function (match) {
  3528. return '-' + match.toLowerCase();
  3529. })
  3530. .toLowerCase();
  3531. };
  3532. module.exports = camel2hyphen;
  3533. /***/ }),
  3534. /* 16 */
  3535. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3536. "use strict";
  3537. __webpack_require__.r(__webpack_exports__);
  3538. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
  3539. /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
  3540. var defaultProps = {
  3541. accessibility: true,
  3542. adaptiveHeight: false,
  3543. afterChange: null,
  3544. appendDots: function appendDots(dots) {
  3545. return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("ul", {
  3546. style: {
  3547. display: "block"
  3548. }
  3549. }, dots);
  3550. },
  3551. arrows: true,
  3552. autoplay: false,
  3553. autoplaySpeed: 3000,
  3554. beforeChange: null,
  3555. centerMode: false,
  3556. centerPadding: "50px",
  3557. className: "",
  3558. cssEase: "ease",
  3559. customPaging: function customPaging(i) {
  3560. return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("button", null, i + 1);
  3561. },
  3562. dots: false,
  3563. dotsClass: "slick-dots",
  3564. draggable: true,
  3565. easing: "linear",
  3566. edgeFriction: 0.35,
  3567. fade: false,
  3568. focusOnSelect: false,
  3569. infinite: true,
  3570. initialSlide: 0,
  3571. lazyLoad: null,
  3572. nextArrow: null,
  3573. onEdge: null,
  3574. onInit: null,
  3575. onLazyLoadError: null,
  3576. onReInit: null,
  3577. pauseOnDotsHover: false,
  3578. pauseOnFocus: false,
  3579. pauseOnHover: true,
  3580. prevArrow: null,
  3581. responsive: null,
  3582. rows: 1,
  3583. rtl: false,
  3584. slide: "div",
  3585. slidesPerRow: 1,
  3586. slidesToScroll: 1,
  3587. slidesToShow: 1,
  3588. speed: 500,
  3589. swipe: true,
  3590. swipeEvent: null,
  3591. swipeToSlide: false,
  3592. touchMove: true,
  3593. touchThreshold: 5,
  3594. useCSS: true,
  3595. useTransform: true,
  3596. variableWidth: false,
  3597. vertical: false,
  3598. waitForAnimate: true
  3599. };
  3600. /* harmony default export */ __webpack_exports__["default"] = (defaultProps);
  3601. /***/ }),
  3602. /* 17 */
  3603. /***/ (function(module, exports, __webpack_require__) {
  3604. var MediaQueryDispatch = __webpack_require__(18);
  3605. module.exports = new MediaQueryDispatch();
  3606. /***/ }),
  3607. /* 18 */
  3608. /***/ (function(module, exports, __webpack_require__) {
  3609. var MediaQuery = __webpack_require__(19);
  3610. var Util = __webpack_require__(21);
  3611. var each = Util.each;
  3612. var isFunction = Util.isFunction;
  3613. var isArray = Util.isArray;
  3614. /**
  3615. * Allows for registration of query handlers.
  3616. * Manages the query handler's state and is responsible for wiring up browser events
  3617. *
  3618. * @constructor
  3619. */
  3620. function MediaQueryDispatch () {
  3621. if(!window.matchMedia) {
  3622. throw new Error('matchMedia not present, legacy browsers require a polyfill');
  3623. }
  3624. this.queries = {};
  3625. this.browserIsIncapable = !window.matchMedia('only all').matches;
  3626. }
  3627. MediaQueryDispatch.prototype = {
  3628. constructor : MediaQueryDispatch,
  3629. /**
  3630. * Registers a handler for the given media query
  3631. *
  3632. * @param {string} q the media query
  3633. * @param {object || Array || Function} options either a single query handler object, a function, or an array of query handlers
  3634. * @param {function} options.match fired when query matched
  3635. * @param {function} [options.unmatch] fired when a query is no longer matched
  3636. * @param {function} [options.setup] fired when handler first triggered
  3637. * @param {boolean} [options.deferSetup=false] whether setup should be run immediately or deferred until query is first matched
  3638. * @param {boolean} [shouldDegrade=false] whether this particular media query should always run on incapable browsers
  3639. */
  3640. register : function(q, options, shouldDegrade) {
  3641. var queries = this.queries,
  3642. isUnconditional = shouldDegrade && this.browserIsIncapable;
  3643. if(!queries[q]) {
  3644. queries[q] = new MediaQuery(q, isUnconditional);
  3645. }
  3646. //normalise to object in an array
  3647. if(isFunction(options)) {
  3648. options = { match : options };
  3649. }
  3650. if(!isArray(options)) {
  3651. options = [options];
  3652. }
  3653. each(options, function(handler) {
  3654. if (isFunction(handler)) {
  3655. handler = { match : handler };
  3656. }
  3657. queries[q].addHandler(handler);
  3658. });
  3659. return this;
  3660. },
  3661. /**
  3662. * unregisters a query and all it's handlers, or a specific handler for a query
  3663. *
  3664. * @param {string} q the media query to target
  3665. * @param {object || function} [handler] specific handler to unregister
  3666. */
  3667. unregister : function(q, handler) {
  3668. var query = this.queries[q];
  3669. if(query) {
  3670. if(handler) {
  3671. query.removeHandler(handler);
  3672. }
  3673. else {
  3674. query.clear();
  3675. delete this.queries[q];
  3676. }
  3677. }
  3678. return this;
  3679. }
  3680. };
  3681. module.exports = MediaQueryDispatch;
  3682. /***/ }),
  3683. /* 19 */
  3684. /***/ (function(module, exports, __webpack_require__) {
  3685. var QueryHandler = __webpack_require__(20);
  3686. var each = __webpack_require__(21).each;
  3687. /**
  3688. * Represents a single media query, manages it's state and registered handlers for this query
  3689. *
  3690. * @constructor
  3691. * @param {string} query the media query string
  3692. * @param {boolean} [isUnconditional=false] whether the media query should run regardless of whether the conditions are met. Primarily for helping older browsers deal with mobile-first design
  3693. */
  3694. function MediaQuery(query, isUnconditional) {
  3695. this.query = query;
  3696. this.isUnconditional = isUnconditional;
  3697. this.handlers = [];
  3698. this.mql = window.matchMedia(query);
  3699. var self = this;
  3700. this.listener = function(mql) {
  3701. // Chrome passes an MediaQueryListEvent object, while other browsers pass MediaQueryList directly
  3702. self.mql = mql.currentTarget || mql;
  3703. self.assess();
  3704. };
  3705. this.mql.addListener(this.listener);
  3706. }
  3707. MediaQuery.prototype = {
  3708. constuctor : MediaQuery,
  3709. /**
  3710. * add a handler for this query, triggering if already active
  3711. *
  3712. * @param {object} handler
  3713. * @param {function} handler.match callback for when query is activated
  3714. * @param {function} [handler.unmatch] callback for when query is deactivated
  3715. * @param {function} [handler.setup] callback for immediate execution when a query handler is registered
  3716. * @param {boolean} [handler.deferSetup=false] should the setup callback be deferred until the first time the handler is matched?
  3717. */
  3718. addHandler : function(handler) {
  3719. var qh = new QueryHandler(handler);
  3720. this.handlers.push(qh);
  3721. this.matches() && qh.on();
  3722. },
  3723. /**
  3724. * removes the given handler from the collection, and calls it's destroy methods
  3725. *
  3726. * @param {object || function} handler the handler to remove
  3727. */
  3728. removeHandler : function(handler) {
  3729. var handlers = this.handlers;
  3730. each(handlers, function(h, i) {
  3731. if(h.equals(handler)) {
  3732. h.destroy();
  3733. return !handlers.splice(i,1); //remove from array and exit each early
  3734. }
  3735. });
  3736. },
  3737. /**
  3738. * Determine whether the media query should be considered a match
  3739. *
  3740. * @return {Boolean} true if media query can be considered a match, false otherwise
  3741. */
  3742. matches : function() {
  3743. return this.mql.matches || this.isUnconditional;
  3744. },
  3745. /**
  3746. * Clears all handlers and unbinds events
  3747. */
  3748. clear : function() {
  3749. each(this.handlers, function(handler) {
  3750. handler.destroy();
  3751. });
  3752. this.mql.removeListener(this.listener);
  3753. this.handlers.length = 0; //clear array
  3754. },
  3755. /*
  3756. * Assesses the query, turning on all handlers if it matches, turning them off if it doesn't match
  3757. */
  3758. assess : function() {
  3759. var action = this.matches() ? 'on' : 'off';
  3760. each(this.handlers, function(handler) {
  3761. handler[action]();
  3762. });
  3763. }
  3764. };
  3765. module.exports = MediaQuery;
  3766. /***/ }),
  3767. /* 20 */
  3768. /***/ (function(module, exports) {
  3769. /**
  3770. * Delegate to handle a media query being matched and unmatched.
  3771. *
  3772. * @param {object} options
  3773. * @param {function} options.match callback for when the media query is matched
  3774. * @param {function} [options.unmatch] callback for when the media query is unmatched
  3775. * @param {function} [options.setup] one-time callback triggered the first time a query is matched
  3776. * @param {boolean} [options.deferSetup=false] should the setup callback be run immediately, rather than first time query is matched?
  3777. * @constructor
  3778. */
  3779. function QueryHandler(options) {
  3780. this.options = options;
  3781. !options.deferSetup && this.setup();
  3782. }
  3783. QueryHandler.prototype = {
  3784. constructor : QueryHandler,
  3785. /**
  3786. * coordinates setup of the handler
  3787. *
  3788. * @function
  3789. */
  3790. setup : function() {
  3791. if(this.options.setup) {
  3792. this.options.setup();
  3793. }
  3794. this.initialised = true;
  3795. },
  3796. /**
  3797. * coordinates setup and triggering of the handler
  3798. *
  3799. * @function
  3800. */
  3801. on : function() {
  3802. !this.initialised && this.setup();
  3803. this.options.match && this.options.match();
  3804. },
  3805. /**
  3806. * coordinates the unmatch event for the handler
  3807. *
  3808. * @function
  3809. */
  3810. off : function() {
  3811. this.options.unmatch && this.options.unmatch();
  3812. },
  3813. /**
  3814. * called when a handler is to be destroyed.
  3815. * delegates to the destroy or unmatch callbacks, depending on availability.
  3816. *
  3817. * @function
  3818. */
  3819. destroy : function() {
  3820. this.options.destroy ? this.options.destroy() : this.off();
  3821. },
  3822. /**
  3823. * determines equality by reference.
  3824. * if object is supplied compare options, if function, compare match callback
  3825. *
  3826. * @function
  3827. * @param {object || function} [target] the target for comparison
  3828. */
  3829. equals : function(target) {
  3830. return this.options === target || this.options.match === target;
  3831. }
  3832. };
  3833. module.exports = QueryHandler;
  3834. /***/ }),
  3835. /* 21 */
  3836. /***/ (function(module, exports) {
  3837. /**
  3838. * Helper function for iterating over a collection
  3839. *
  3840. * @param collection
  3841. * @param fn
  3842. */
  3843. function each(collection, fn) {
  3844. var i = 0,
  3845. length = collection.length,
  3846. cont;
  3847. for(i; i < length; i++) {
  3848. cont = fn(collection[i], i);
  3849. if(cont === false) {
  3850. break; //allow early exit
  3851. }
  3852. }
  3853. }
  3854. /**
  3855. * Helper function for determining whether target object is an array
  3856. *
  3857. * @param target the object under test
  3858. * @return {Boolean} true if array, false otherwise
  3859. */
  3860. function isArray(target) {
  3861. return Object.prototype.toString.apply(target) === '[object Array]';
  3862. }
  3863. /**
  3864. * Helper function for determining whether target object is a function
  3865. *
  3866. * @param target the object under test
  3867. * @return {Boolean} true if function, false otherwise
  3868. */
  3869. function isFunction(target) {
  3870. return typeof target === 'function';
  3871. }
  3872. module.exports = {
  3873. isFunction : isFunction,
  3874. isArray : isArray,
  3875. each : each
  3876. };
  3877. /***/ })
  3878. /******/ ]);
  3879. });
  3880. //# sourceMappingURL=react-slick.js.map