Changeset 2793666
- Timestamp:
- 10/03/2022 08:19:56 PM (3 years ago)
- Location:
- bps-splide-slider-block/trunk
- Files:
-
- 8 edited
-
README.txt (modified) (3 diffs)
-
build/block.css (modified) (1 diff)
-
build/block.js (modified) (1 diff)
-
build/frontend.css (modified) (1 diff)
-
build/frontend.js (modified) (1 diff)
-
index.php (modified) (8 diffs)
-
languages/bps-slider-block-nl_NL.mo (modified) (previous)
-
languages/bps-slider-block-nl_NL.po (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
bps-splide-slider-block/trunk/README.txt
r2684849 r2793666 3 3 Tags: slider, splide, gutenberg, blocks 4 4 Requires at least: 5.7 5 Tested up to: 5.96 Stable tag: 1. 05 Tested up to: 6.2 6 Stable tag: 1.1 7 7 License: GPLv3+ 8 8 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 11 11 12 12 == Description == 13 BPS Splide Slider Block uses the [Splide](https://splidejs.com/) library. Several display properties can be customized in the 'Splide Block' settings subpage. 13 BPS Splide Slider Block uses the [Splide](https://splidejs.com/) library. 14 15 = Slider display settings can be customized via:= 16 * General settings subpage: Admin Sidebar > Settings > Splide Block 17 * Custom Post Type Block Template 18 * Block settings menu 14 19 15 20 == Installation == 16 1. Upload 'bps-splide-slider-block' to the '/wp-content/plugins/' directory. 17 2. Activate the plugin through the 'Plugins' menu in WordPress. 18 3. Within a post or page, select the '+' symbol to add a new block. 19 4. From the 'Blocks' tab, select the 'Splide slider' block. 20 5. Add images to the block. 21 6. Customize image size and several slider properties in the settings submenu 'Splide Block'. 21 * Upload 'bps-splide-slider-block' to the '/wp-content/plugins/' directory 22 * Activate the plugin through the 'Plugins' menu in WordPress 23 * Within a post or page, select the '+' symbol to add a new block 24 * From the 'Blocks' tab, select the 'Splide slider' block 25 * Add images to the block 22 26 23 27 == Changelog == … … 25 29 = 1.0 = 26 30 * Initial release 31 32 = 1.1 = 33 * Customizable options in Block settings menu 34 * Accessible attributes for Custom Post Type Block Template -
bps-splide-slider-block/trunk/build/block.css
r2684849 r2793666 1 /*!***************************************************************************************************************************************************************************************************************************************!*\ 2 !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[3].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[3].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[3].use[3]!./src/block.scss ***! 3 \***************************************************************************************************************************************************************************************************************************************/ 4 .slider-edit-block { 5 padding: 20px; 6 border: 1px solid #d6d6d6; 7 background: #f1f1f1; 8 } 9 .slider-edit-block .slider-edit-block-element { 10 text-align: center; 11 margin: 20px 0; 12 padding: 20px 10px; 13 background: #d6d6d6; 14 } 15 16 /*# sourceMappingURL=block.css.map*/ 1 .slider-edit-block{background:#f1f1f1;border:1px solid #d6d6d6;padding:20px}.slider-edit-block .slider-edit-block-element{background:#d6d6d6;margin:20px 0;padding:20px 10px;text-align:center} -
bps-splide-slider-block/trunk/build/block.js
r2684849 r2793666 1 /******/ (function() { // webpackBootstrap 2 /******/ var __webpack_modules__ = ({ 3 4 /***/ "./node_modules/invariant/browser.js": 5 /*!*******************************************!*\ 6 !*** ./node_modules/invariant/browser.js ***! 7 \*******************************************/ 8 /***/ (function(module) { 9 10 "use strict"; 11 /** 12 * Copyright (c) 2013-present, Facebook, Inc. 13 * 14 * This source code is licensed under the MIT license found in the 15 * LICENSE file in the root directory of this source tree. 16 */ 17 18 19 20 /** 21 * Use invariant() to assert state which your program assumes to be true. 22 * 23 * Provide sprintf-style format (only %s is supported) and arguments 24 * to provide information about what broke and what you were 25 * expecting. 26 * 27 * The invariant message will be stripped in production, but the invariant 28 * will remain to ensure logic does not differ in production. 29 */ 30 31 var invariant = function(condition, format, a, b, c, d, e, f) { 32 if (true) { 33 if (format === undefined) { 34 throw new Error('invariant requires an error message argument'); 35 } 36 } 37 38 if (!condition) { 39 var error; 40 if (format === undefined) { 41 error = new Error( 42 'Minified exception occurred; use the non-minified dev environment ' + 43 'for the full error message and additional helpful warnings.' 44 ); 45 } else { 46 var args = [a, b, c, d, e, f]; 47 var argIndex = 0; 48 error = new Error( 49 format.replace(/%s/g, function() { return args[argIndex++]; }) 50 ); 51 error.name = 'Invariant Violation'; 52 } 53 54 error.framesToPop = 1; // we don't care about invariant's own frame 55 throw error; 56 } 57 }; 58 59 module.exports = invariant; 60 61 62 /***/ }), 63 64 /***/ "./src/block.scss": 65 /*!************************!*\ 66 !*** ./src/block.scss ***! 67 \************************/ 68 /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { 69 70 "use strict"; 71 __webpack_require__.r(__webpack_exports__); 72 // extracted by mini-css-extract-plugin 73 74 75 /***/ }), 76 77 /***/ "./node_modules/object-assign/index.js": 78 /*!*********************************************!*\ 79 !*** ./node_modules/object-assign/index.js ***! 80 \*********************************************/ 81 /***/ (function(module) { 82 83 "use strict"; 84 /* 85 object-assign 86 (c) Sindre Sorhus 87 @license MIT 88 */ 89 90 91 /* eslint-disable no-unused-vars */ 92 var getOwnPropertySymbols = Object.getOwnPropertySymbols; 93 var hasOwnProperty = Object.prototype.hasOwnProperty; 94 var propIsEnumerable = Object.prototype.propertyIsEnumerable; 95 96 function toObject(val) { 97 if (val === null || val === undefined) { 98 throw new TypeError('Object.assign cannot be called with null or undefined'); 99 } 100 101 return Object(val); 102 } 103 104 function shouldUseNative() { 105 try { 106 if (!Object.assign) { 107 return false; 108 } 109 110 // Detect buggy property enumeration order in older V8 versions. 111 112 // https://bugs.chromium.org/p/v8/issues/detail?id=4118 113 var test1 = new String('abc'); // eslint-disable-line no-new-wrappers 114 test1[5] = 'de'; 115 if (Object.getOwnPropertyNames(test1)[0] === '5') { 116 return false; 117 } 118 119 // https://bugs.chromium.org/p/v8/issues/detail?id=3056 120 var test2 = {}; 121 for (var i = 0; i < 10; i++) { 122 test2['_' + String.fromCharCode(i)] = i; 123 } 124 var order2 = Object.getOwnPropertyNames(test2).map(function (n) { 125 return test2[n]; 126 }); 127 if (order2.join('') !== '0123456789') { 128 return false; 129 } 130 131 // https://bugs.chromium.org/p/v8/issues/detail?id=3056 132 var test3 = {}; 133 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { 134 test3[letter] = letter; 135 }); 136 if (Object.keys(Object.assign({}, test3)).join('') !== 137 'abcdefghijklmnopqrst') { 138 return false; 139 } 140 141 return true; 142 } catch (err) { 143 // We don't expect any of the above to throw, but better to be safe. 144 return false; 145 } 146 } 147 148 module.exports = shouldUseNative() ? Object.assign : function (target, source) { 149 var from; 150 var to = toObject(target); 151 var symbols; 152 153 for (var s = 1; s < arguments.length; s++) { 154 from = Object(arguments[s]); 155 156 for (var key in from) { 157 if (hasOwnProperty.call(from, key)) { 158 to[key] = from[key]; 159 } 160 } 161 162 if (getOwnPropertySymbols) { 163 symbols = getOwnPropertySymbols(from); 164 for (var i = 0; i < symbols.length; i++) { 165 if (propIsEnumerable.call(from, symbols[i])) { 166 to[symbols[i]] = from[symbols[i]]; 167 } 168 } 169 } 170 } 171 172 return to; 173 }; 174 175 176 /***/ }), 177 178 /***/ "./node_modules/prop-types/checkPropTypes.js": 179 /*!***************************************************!*\ 180 !*** ./node_modules/prop-types/checkPropTypes.js ***! 181 \***************************************************/ 182 /***/ (function(module, __unused_webpack_exports, __webpack_require__) { 183 184 "use strict"; 185 /** 186 * Copyright (c) 2013-present, Facebook, Inc. 187 * 188 * This source code is licensed under the MIT license found in the 189 * LICENSE file in the root directory of this source tree. 190 */ 191 192 193 194 var printWarning = function() {}; 195 196 if (true) { 197 var ReactPropTypesSecret = __webpack_require__(/*! ./lib/ReactPropTypesSecret */ "./node_modules/prop-types/lib/ReactPropTypesSecret.js"); 198 var loggedTypeFailures = {}; 199 var has = __webpack_require__(/*! ./lib/has */ "./node_modules/prop-types/lib/has.js"); 200 201 printWarning = function(text) { 202 var message = 'Warning: ' + text; 203 if (typeof console !== 'undefined') { 204 console.error(message); 205 } 206 try { 207 // --- Welcome to debugging React --- 208 // This error was thrown as a convenience so that you can use this stack 209 // to find the callsite that caused this warning to fire. 210 throw new Error(message); 211 } catch (x) { /**/ } 212 }; 213 } 214 215 /** 216 * Assert that the values match with the type specs. 217 * Error messages are memorized and will only be shown once. 218 * 219 * @param {object} typeSpecs Map of name to a ReactPropType 220 * @param {object} values Runtime values that need to be type-checked 221 * @param {string} location e.g. "prop", "context", "child context" 222 * @param {string} componentName Name of the component for error messages. 223 * @param {?Function} getStack Returns the component stack. 224 * @private 225 */ 226 function checkPropTypes(typeSpecs, values, location, componentName, getStack) { 227 if (true) { 228 for (var typeSpecName in typeSpecs) { 229 if (has(typeSpecs, typeSpecName)) { 230 var error; 231 // Prop type validation may throw. In case they do, we don't want to 232 // fail the render phase where it didn't fail before. So we log it. 233 // After these have been cleaned up, we'll let them throw. 234 try { 235 // This is intentionally an invariant that gets caught. It's the same 236 // behavior as without this statement except with a better message. 237 if (typeof typeSpecs[typeSpecName] !== 'function') { 238 var err = Error( 239 (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 240 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 241 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.' 242 ); 243 err.name = 'Invariant Violation'; 244 throw err; 245 } 246 error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret); 247 } catch (ex) { 248 error = ex; 249 } 250 if (error && !(error instanceof Error)) { 251 printWarning( 252 (componentName || 'React class') + ': type specification of ' + 253 location + ' `' + typeSpecName + '` is invalid; the type checker ' + 254 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' + 255 'You may have forgotten to pass an argument to the type checker ' + 256 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 257 'shape all require an argument).' 258 ); 259 } 260 if (error instanceof Error && !(error.message in loggedTypeFailures)) { 261 // Only monitor this failure once because there tends to be a lot of the 262 // same error. 263 loggedTypeFailures[error.message] = true; 264 265 var stack = getStack ? getStack() : ''; 266 267 printWarning( 268 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '') 269 ); 270 } 271 } 272 } 273 } 274 } 275 276 /** 277 * Resets warning cache when testing. 278 * 279 * @private 280 */ 281 checkPropTypes.resetWarningCache = function() { 282 if (true) { 283 loggedTypeFailures = {}; 284 } 285 } 286 287 module.exports = checkPropTypes; 288 289 290 /***/ }), 291 292 /***/ "./node_modules/prop-types/factoryWithTypeCheckers.js": 293 /*!************************************************************!*\ 294 !*** ./node_modules/prop-types/factoryWithTypeCheckers.js ***! 295 \************************************************************/ 296 /***/ (function(module, __unused_webpack_exports, __webpack_require__) { 297 298 "use strict"; 299 /** 300 * Copyright (c) 2013-present, Facebook, Inc. 301 * 302 * This source code is licensed under the MIT license found in the 303 * LICENSE file in the root directory of this source tree. 304 */ 305 306 307 308 var ReactIs = __webpack_require__(/*! react-is */ "./node_modules/react-is/index.js"); 309 var assign = __webpack_require__(/*! object-assign */ "./node_modules/object-assign/index.js"); 310 311 var ReactPropTypesSecret = __webpack_require__(/*! ./lib/ReactPropTypesSecret */ "./node_modules/prop-types/lib/ReactPropTypesSecret.js"); 312 var has = __webpack_require__(/*! ./lib/has */ "./node_modules/prop-types/lib/has.js"); 313 var checkPropTypes = __webpack_require__(/*! ./checkPropTypes */ "./node_modules/prop-types/checkPropTypes.js"); 314 315 var printWarning = function() {}; 316 317 if (true) { 318 printWarning = function(text) { 319 var message = 'Warning: ' + text; 320 if (typeof console !== 'undefined') { 321 console.error(message); 322 } 323 try { 324 // --- Welcome to debugging React --- 325 // This error was thrown as a convenience so that you can use this stack 326 // to find the callsite that caused this warning to fire. 327 throw new Error(message); 328 } catch (x) {} 329 }; 330 } 331 332 function emptyFunctionThatReturnsNull() { 333 return null; 334 } 335 336 module.exports = function(isValidElement, throwOnDirectAccess) { 337 /* global Symbol */ 338 var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; 339 var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. 340 341 /** 342 * Returns the iterator method function contained on the iterable object. 343 * 344 * Be sure to invoke the function with the iterable as context: 345 * 346 * var iteratorFn = getIteratorFn(myIterable); 347 * if (iteratorFn) { 348 * var iterator = iteratorFn.call(myIterable); 349 * ... 350 * } 351 * 352 * @param {?object} maybeIterable 353 * @return {?function} 354 */ 355 function getIteratorFn(maybeIterable) { 356 var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); 357 if (typeof iteratorFn === 'function') { 358 return iteratorFn; 359 } 360 } 361 362 /** 363 * Collection of methods that allow declaration and validation of props that are 364 * supplied to React components. Example usage: 365 * 366 * var Props = require('ReactPropTypes'); 367 * var MyArticle = React.createClass({ 368 * propTypes: { 369 * // An optional string prop named "description". 370 * description: Props.string, 371 * 372 * // A required enum prop named "category". 373 * category: Props.oneOf(['News','Photos']).isRequired, 374 * 375 * // A prop named "dialog" that requires an instance of Dialog. 376 * dialog: Props.instanceOf(Dialog).isRequired 377 * }, 378 * render: function() { ... } 379 * }); 380 * 381 * A more formal specification of how these methods are used: 382 * 383 * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...) 384 * decl := ReactPropTypes.{type}(.isRequired)? 385 * 386 * Each and every declaration produces a function with the same signature. This 387 * allows the creation of custom validation functions. For example: 388 * 389 * var MyLink = React.createClass({ 390 * propTypes: { 391 * // An optional string or URI prop named "href". 392 * href: function(props, propName, componentName) { 393 * var propValue = props[propName]; 394 * if (propValue != null && typeof propValue !== 'string' && 395 * !(propValue instanceof URI)) { 396 * return new Error( 397 * 'Expected a string or an URI for ' + propName + ' in ' + 398 * componentName 399 * ); 400 * } 401 * } 402 * }, 403 * render: function() {...} 404 * }); 405 * 406 * @internal 407 */ 408 409 var ANONYMOUS = '<<anonymous>>'; 410 411 // Important! 412 // Keep this list in sync with production version in `./factoryWithThrowingShims.js`. 413 var ReactPropTypes = { 414 array: createPrimitiveTypeChecker('array'), 415 bigint: createPrimitiveTypeChecker('bigint'), 416 bool: createPrimitiveTypeChecker('boolean'), 417 func: createPrimitiveTypeChecker('function'), 418 number: createPrimitiveTypeChecker('number'), 419 object: createPrimitiveTypeChecker('object'), 420 string: createPrimitiveTypeChecker('string'), 421 symbol: createPrimitiveTypeChecker('symbol'), 422 423 any: createAnyTypeChecker(), 424 arrayOf: createArrayOfTypeChecker, 425 element: createElementTypeChecker(), 426 elementType: createElementTypeTypeChecker(), 427 instanceOf: createInstanceTypeChecker, 428 node: createNodeChecker(), 429 objectOf: createObjectOfTypeChecker, 430 oneOf: createEnumTypeChecker, 431 oneOfType: createUnionTypeChecker, 432 shape: createShapeTypeChecker, 433 exact: createStrictShapeTypeChecker, 434 }; 435 436 /** 437 * inlined Object.is polyfill to avoid requiring consumers ship their own 438 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is 439 */ 440 /*eslint-disable no-self-compare*/ 441 function is(x, y) { 442 // SameValue algorithm 443 if (x === y) { 444 // Steps 1-5, 7-10 445 // Steps 6.b-6.e: +0 != -0 446 return x !== 0 || 1 / x === 1 / y; 447 } else { 448 // Step 6.a: NaN == NaN 449 return x !== x && y !== y; 450 } 451 } 452 /*eslint-enable no-self-compare*/ 453 454 /** 455 * We use an Error-like object for backward compatibility as people may call 456 * PropTypes directly and inspect their output. However, we don't use real 457 * Errors anymore. We don't inspect their stack anyway, and creating them 458 * is prohibitively expensive if they are created too often, such as what 459 * happens in oneOfType() for any type before the one that matched. 460 */ 461 function PropTypeError(message, data) { 462 this.message = message; 463 this.data = data && typeof data === 'object' ? data: {}; 464 this.stack = ''; 465 } 466 // Make `instanceof Error` still work for returned errors. 467 PropTypeError.prototype = Error.prototype; 468 469 function createChainableTypeChecker(validate) { 470 if (true) { 471 var manualPropTypeCallCache = {}; 472 var manualPropTypeWarningCount = 0; 473 } 474 function checkType(isRequired, props, propName, componentName, location, propFullName, secret) { 475 componentName = componentName || ANONYMOUS; 476 propFullName = propFullName || propName; 477 478 if (secret !== ReactPropTypesSecret) { 479 if (throwOnDirectAccess) { 480 // New behavior only for users of `prop-types` package 481 var err = new Error( 482 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 483 'Use `PropTypes.checkPropTypes()` to call them. ' + 484 'Read more at http://fb.me/use-check-prop-types' 485 ); 486 err.name = 'Invariant Violation'; 487 throw err; 488 } else if ( true && typeof console !== 'undefined') { 489 // Old behavior for people using React.PropTypes 490 var cacheKey = componentName + ':' + propName; 491 if ( 492 !manualPropTypeCallCache[cacheKey] && 493 // Avoid spamming the console because they are often not actionable except for lib authors 494 manualPropTypeWarningCount < 3 495 ) { 496 printWarning( 497 'You are manually calling a React.PropTypes validation ' + 498 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' + 499 'and will throw in the standalone `prop-types` package. ' + 500 'You may be seeing this warning due to a third-party PropTypes ' + 501 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.' 502 ); 503 manualPropTypeCallCache[cacheKey] = true; 504 manualPropTypeWarningCount++; 505 } 506 } 507 } 508 if (props[propName] == null) { 509 if (isRequired) { 510 if (props[propName] === null) { 511 return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.')); 512 } 513 return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.')); 514 } 515 return null; 516 } else { 517 return validate(props, propName, componentName, location, propFullName); 518 } 519 } 520 521 var chainedCheckType = checkType.bind(null, false); 522 chainedCheckType.isRequired = checkType.bind(null, true); 523 524 return chainedCheckType; 525 } 526 527 function createPrimitiveTypeChecker(expectedType) { 528 function validate(props, propName, componentName, location, propFullName, secret) { 529 var propValue = props[propName]; 530 var propType = getPropType(propValue); 531 if (propType !== expectedType) { 532 // `propValue` being instance of, say, date/regexp, pass the 'object' 533 // check, but we can offer a more precise error message here rather than 534 // 'of type `object`'. 535 var preciseType = getPreciseType(propValue); 536 537 return new PropTypeError( 538 'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'), 539 {expectedType: expectedType} 540 ); 541 } 542 return null; 543 } 544 return createChainableTypeChecker(validate); 545 } 546 547 function createAnyTypeChecker() { 548 return createChainableTypeChecker(emptyFunctionThatReturnsNull); 549 } 550 551 function createArrayOfTypeChecker(typeChecker) { 552 function validate(props, propName, componentName, location, propFullName) { 553 if (typeof typeChecker !== 'function') { 554 return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.'); 555 } 556 var propValue = props[propName]; 557 if (!Array.isArray(propValue)) { 558 var propType = getPropType(propValue); 559 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.')); 560 } 561 for (var i = 0; i < propValue.length; i++) { 562 var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret); 563 if (error instanceof Error) { 564 return error; 565 } 566 } 567 return null; 568 } 569 return createChainableTypeChecker(validate); 570 } 571 572 function createElementTypeChecker() { 573 function validate(props, propName, componentName, location, propFullName) { 574 var propValue = props[propName]; 575 if (!isValidElement(propValue)) { 576 var propType = getPropType(propValue); 577 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.')); 578 } 579 return null; 580 } 581 return createChainableTypeChecker(validate); 582 } 583 584 function createElementTypeTypeChecker() { 585 function validate(props, propName, componentName, location, propFullName) { 586 var propValue = props[propName]; 587 if (!ReactIs.isValidElementType(propValue)) { 588 var propType = getPropType(propValue); 589 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.')); 590 } 591 return null; 592 } 593 return createChainableTypeChecker(validate); 594 } 595 596 function createInstanceTypeChecker(expectedClass) { 597 function validate(props, propName, componentName, location, propFullName) { 598 if (!(props[propName] instanceof expectedClass)) { 599 var expectedClassName = expectedClass.name || ANONYMOUS; 600 var actualClassName = getClassName(props[propName]); 601 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.')); 602 } 603 return null; 604 } 605 return createChainableTypeChecker(validate); 606 } 607 608 function createEnumTypeChecker(expectedValues) { 609 if (!Array.isArray(expectedValues)) { 610 if (true) { 611 if (arguments.length > 1) { 612 printWarning( 613 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' + 614 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).' 615 ); 616 } else { 617 printWarning('Invalid argument supplied to oneOf, expected an array.'); 618 } 619 } 620 return emptyFunctionThatReturnsNull; 621 } 622 623 function validate(props, propName, componentName, location, propFullName) { 624 var propValue = props[propName]; 625 for (var i = 0; i < expectedValues.length; i++) { 626 if (is(propValue, expectedValues[i])) { 627 return null; 628 } 629 } 630 631 var valuesString = JSON.stringify(expectedValues, function replacer(key, value) { 632 var type = getPreciseType(value); 633 if (type === 'symbol') { 634 return String(value); 635 } 636 return value; 637 }); 638 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.')); 639 } 640 return createChainableTypeChecker(validate); 641 } 642 643 function createObjectOfTypeChecker(typeChecker) { 644 function validate(props, propName, componentName, location, propFullName) { 645 if (typeof typeChecker !== 'function') { 646 return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.'); 647 } 648 var propValue = props[propName]; 649 var propType = getPropType(propValue); 650 if (propType !== 'object') { 651 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.')); 652 } 653 for (var key in propValue) { 654 if (has(propValue, key)) { 655 var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); 656 if (error instanceof Error) { 657 return error; 658 } 659 } 660 } 661 return null; 662 } 663 return createChainableTypeChecker(validate); 664 } 665 666 function createUnionTypeChecker(arrayOfTypeCheckers) { 667 if (!Array.isArray(arrayOfTypeCheckers)) { 668 true ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : 0; 669 return emptyFunctionThatReturnsNull; 670 } 671 672 for (var i = 0; i < arrayOfTypeCheckers.length; i++) { 673 var checker = arrayOfTypeCheckers[i]; 674 if (typeof checker !== 'function') { 675 printWarning( 676 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' + 677 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.' 678 ); 679 return emptyFunctionThatReturnsNull; 680 } 681 } 682 683 function validate(props, propName, componentName, location, propFullName) { 684 var expectedTypes = []; 685 for (var i = 0; i < arrayOfTypeCheckers.length; i++) { 686 var checker = arrayOfTypeCheckers[i]; 687 var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret); 688 if (checkerResult == null) { 689 return null; 690 } 691 if (checkerResult.data && has(checkerResult.data, 'expectedType')) { 692 expectedTypes.push(checkerResult.data.expectedType); 693 } 694 } 695 var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': ''; 696 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.')); 697 } 698 return createChainableTypeChecker(validate); 699 } 700 701 function createNodeChecker() { 702 function validate(props, propName, componentName, location, propFullName) { 703 if (!isNode(props[propName])) { 704 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.')); 705 } 706 return null; 707 } 708 return createChainableTypeChecker(validate); 709 } 710 711 function invalidValidatorError(componentName, location, propFullName, key, type) { 712 return new PropTypeError( 713 (componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' + 714 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.' 715 ); 716 } 717 718 function createShapeTypeChecker(shapeTypes) { 719 function validate(props, propName, componentName, location, propFullName) { 720 var propValue = props[propName]; 721 var propType = getPropType(propValue); 722 if (propType !== 'object') { 723 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); 724 } 725 for (var key in shapeTypes) { 726 var checker = shapeTypes[key]; 727 if (typeof checker !== 'function') { 728 return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker)); 729 } 730 var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); 731 if (error) { 732 return error; 733 } 734 } 735 return null; 736 } 737 return createChainableTypeChecker(validate); 738 } 739 740 function createStrictShapeTypeChecker(shapeTypes) { 741 function validate(props, propName, componentName, location, propFullName) { 742 var propValue = props[propName]; 743 var propType = getPropType(propValue); 744 if (propType !== 'object') { 745 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); 746 } 747 // We need to check all keys in case some are required but missing from props. 748 var allKeys = assign({}, props[propName], shapeTypes); 749 for (var key in allKeys) { 750 var checker = shapeTypes[key]; 751 if (has(shapeTypes, key) && typeof checker !== 'function') { 752 return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker)); 753 } 754 if (!checker) { 755 return new PropTypeError( 756 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' + 757 '\nBad object: ' + JSON.stringify(props[propName], null, ' ') + 758 '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ') 759 ); 760 } 761 var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); 762 if (error) { 763 return error; 764 } 765 } 766 return null; 767 } 768 769 return createChainableTypeChecker(validate); 770 } 771 772 function isNode(propValue) { 773 switch (typeof propValue) { 774 case 'number': 775 case 'string': 776 case 'undefined': 777 return true; 778 case 'boolean': 779 return !propValue; 780 case 'object': 781 if (Array.isArray(propValue)) { 782 return propValue.every(isNode); 783 } 784 if (propValue === null || isValidElement(propValue)) { 785 return true; 786 } 787 788 var iteratorFn = getIteratorFn(propValue); 789 if (iteratorFn) { 790 var iterator = iteratorFn.call(propValue); 791 var step; 792 if (iteratorFn !== propValue.entries) { 793 while (!(step = iterator.next()).done) { 794 if (!isNode(step.value)) { 795 return false; 796 } 797 } 798 } else { 799 // Iterator will provide entry [k,v] tuples rather than values. 800 while (!(step = iterator.next()).done) { 801 var entry = step.value; 802 if (entry) { 803 if (!isNode(entry[1])) { 804 return false; 805 } 806 } 807 } 808 } 809 } else { 810 return false; 811 } 812 813 return true; 814 default: 815 return false; 816 } 817 } 818 819 function isSymbol(propType, propValue) { 820 // Native Symbol. 821 if (propType === 'symbol') { 822 return true; 823 } 824 825 // falsy value can't be a Symbol 826 if (!propValue) { 827 return false; 828 } 829 830 // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol' 831 if (propValue['@@toStringTag'] === 'Symbol') { 832 return true; 833 } 834 835 // Fallback for non-spec compliant Symbols which are polyfilled. 836 if (typeof Symbol === 'function' && propValue instanceof Symbol) { 837 return true; 838 } 839 840 return false; 841 } 842 843 // Equivalent of `typeof` but with special handling for array and regexp. 844 function getPropType(propValue) { 845 var propType = typeof propValue; 846 if (Array.isArray(propValue)) { 847 return 'array'; 848 } 849 if (propValue instanceof RegExp) { 850 // Old webkits (at least until Android 4.0) return 'function' rather than 851 // 'object' for typeof a RegExp. We'll normalize this here so that /bla/ 852 // passes PropTypes.object. 853 return 'object'; 854 } 855 if (isSymbol(propType, propValue)) { 856 return 'symbol'; 857 } 858 return propType; 859 } 860 861 // This handles more types than `getPropType`. Only used for error messages. 862 // See `createPrimitiveTypeChecker`. 863 function getPreciseType(propValue) { 864 if (typeof propValue === 'undefined' || propValue === null) { 865 return '' + propValue; 866 } 867 var propType = getPropType(propValue); 868 if (propType === 'object') { 869 if (propValue instanceof Date) { 870 return 'date'; 871 } else if (propValue instanceof RegExp) { 872 return 'regexp'; 873 } 874 } 875 return propType; 876 } 877 878 // Returns a string that is postfixed to a warning about an invalid type. 879 // For example, "undefined" or "of type array" 880 function getPostfixForTypeWarning(value) { 881 var type = getPreciseType(value); 882 switch (type) { 883 case 'array': 884 case 'object': 885 return 'an ' + type; 886 case 'boolean': 887 case 'date': 888 case 'regexp': 889 return 'a ' + type; 890 default: 891 return type; 892 } 893 } 894 895 // Returns class name of the object, if any. 896 function getClassName(propValue) { 897 if (!propValue.constructor || !propValue.constructor.name) { 898 return ANONYMOUS; 899 } 900 return propValue.constructor.name; 901 } 902 903 ReactPropTypes.checkPropTypes = checkPropTypes; 904 ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache; 905 ReactPropTypes.PropTypes = ReactPropTypes; 906 907 return ReactPropTypes; 908 }; 909 910 911 /***/ }), 912 913 /***/ "./node_modules/prop-types/index.js": 914 /*!******************************************!*\ 915 !*** ./node_modules/prop-types/index.js ***! 916 \******************************************/ 917 /***/ (function(module, __unused_webpack_exports, __webpack_require__) { 918 919 /** 920 * Copyright (c) 2013-present, Facebook, Inc. 921 * 922 * This source code is licensed under the MIT license found in the 923 * LICENSE file in the root directory of this source tree. 924 */ 925 926 if (true) { 927 var ReactIs = __webpack_require__(/*! react-is */ "./node_modules/react-is/index.js"); 928 929 // By explicitly using `prop-types` you are opting into new development behavior. 930 // http://fb.me/prop-types-in-prod 931 var throwOnDirectAccess = true; 932 module.exports = __webpack_require__(/*! ./factoryWithTypeCheckers */ "./node_modules/prop-types/factoryWithTypeCheckers.js")(ReactIs.isElement, throwOnDirectAccess); 933 } else {} 934 935 936 /***/ }), 937 938 /***/ "./node_modules/prop-types/lib/ReactPropTypesSecret.js": 939 /*!*************************************************************!*\ 940 !*** ./node_modules/prop-types/lib/ReactPropTypesSecret.js ***! 941 \*************************************************************/ 942 /***/ (function(module) { 943 944 "use strict"; 945 /** 946 * Copyright (c) 2013-present, Facebook, Inc. 947 * 948 * This source code is licensed under the MIT license found in the 949 * LICENSE file in the root directory of this source tree. 950 */ 951 952 953 954 var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; 955 956 module.exports = ReactPropTypesSecret; 957 958 959 /***/ }), 960 961 /***/ "./node_modules/prop-types/lib/has.js": 962 /*!********************************************!*\ 963 !*** ./node_modules/prop-types/lib/has.js ***! 964 \********************************************/ 965 /***/ (function(module) { 966 967 module.exports = Function.call.bind(Object.prototype.hasOwnProperty); 968 969 970 /***/ }), 971 972 /***/ "./node_modules/react-is/cjs/react-is.development.js": 973 /*!***********************************************************!*\ 974 !*** ./node_modules/react-is/cjs/react-is.development.js ***! 975 \***********************************************************/ 976 /***/ (function(__unused_webpack_module, exports) { 977 978 "use strict"; 979 /** @license React v16.13.1 980 * react-is.development.js 981 * 982 * Copyright (c) Facebook, Inc. and its affiliates. 983 * 984 * This source code is licensed under the MIT license found in the 985 * LICENSE file in the root directory of this source tree. 986 */ 987 988 989 990 991 992 if (true) { 993 (function() { 994 'use strict'; 995 996 // The Symbol used to tag the ReactElement-like types. If there is no native Symbol 997 // nor polyfill, then a plain number is used for performance. 998 var hasSymbol = typeof Symbol === 'function' && Symbol.for; 999 var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7; 1000 var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca; 1001 var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb; 1002 var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc; 1003 var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2; 1004 var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd; 1005 var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary 1006 // (unstable) APIs that have been removed. Can we remove the symbols? 1007 1008 var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf; 1009 var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf; 1010 var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0; 1011 var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1; 1012 var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8; 1013 var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3; 1014 var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4; 1015 var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9; 1016 var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5; 1017 var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6; 1018 var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7; 1019 1020 function isValidElementType(type) { 1021 return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill. 1022 type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE); 1023 } 1024 1025 function typeOf(object) { 1026 if (typeof object === 'object' && object !== null) { 1027 var $$typeof = object.$$typeof; 1028 1029 switch ($$typeof) { 1030 case REACT_ELEMENT_TYPE: 1031 var type = object.type; 1032 1033 switch (type) { 1034 case REACT_ASYNC_MODE_TYPE: 1035 case REACT_CONCURRENT_MODE_TYPE: 1036 case REACT_FRAGMENT_TYPE: 1037 case REACT_PROFILER_TYPE: 1038 case REACT_STRICT_MODE_TYPE: 1039 case REACT_SUSPENSE_TYPE: 1040 return type; 1041 1042 default: 1043 var $$typeofType = type && type.$$typeof; 1044 1045 switch ($$typeofType) { 1046 case REACT_CONTEXT_TYPE: 1047 case REACT_FORWARD_REF_TYPE: 1048 case REACT_LAZY_TYPE: 1049 case REACT_MEMO_TYPE: 1050 case REACT_PROVIDER_TYPE: 1051 return $$typeofType; 1052 1053 default: 1054 return $$typeof; 1055 } 1056 1057 } 1058 1059 case REACT_PORTAL_TYPE: 1060 return $$typeof; 1061 } 1062 } 1063 1064 return undefined; 1065 } // AsyncMode is deprecated along with isAsyncMode 1066 1067 var AsyncMode = REACT_ASYNC_MODE_TYPE; 1068 var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE; 1069 var ContextConsumer = REACT_CONTEXT_TYPE; 1070 var ContextProvider = REACT_PROVIDER_TYPE; 1071 var Element = REACT_ELEMENT_TYPE; 1072 var ForwardRef = REACT_FORWARD_REF_TYPE; 1073 var Fragment = REACT_FRAGMENT_TYPE; 1074 var Lazy = REACT_LAZY_TYPE; 1075 var Memo = REACT_MEMO_TYPE; 1076 var Portal = REACT_PORTAL_TYPE; 1077 var Profiler = REACT_PROFILER_TYPE; 1078 var StrictMode = REACT_STRICT_MODE_TYPE; 1079 var Suspense = REACT_SUSPENSE_TYPE; 1080 var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated 1081 1082 function isAsyncMode(object) { 1083 { 1084 if (!hasWarnedAboutDeprecatedIsAsyncMode) { 1085 hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint 1086 1087 console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.'); 1088 } 1089 } 1090 1091 return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE; 1092 } 1093 function isConcurrentMode(object) { 1094 return typeOf(object) === REACT_CONCURRENT_MODE_TYPE; 1095 } 1096 function isContextConsumer(object) { 1097 return typeOf(object) === REACT_CONTEXT_TYPE; 1098 } 1099 function isContextProvider(object) { 1100 return typeOf(object) === REACT_PROVIDER_TYPE; 1101 } 1102 function isElement(object) { 1103 return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; 1104 } 1105 function isForwardRef(object) { 1106 return typeOf(object) === REACT_FORWARD_REF_TYPE; 1107 } 1108 function isFragment(object) { 1109 return typeOf(object) === REACT_FRAGMENT_TYPE; 1110 } 1111 function isLazy(object) { 1112 return typeOf(object) === REACT_LAZY_TYPE; 1113 } 1114 function isMemo(object) { 1115 return typeOf(object) === REACT_MEMO_TYPE; 1116 } 1117 function isPortal(object) { 1118 return typeOf(object) === REACT_PORTAL_TYPE; 1119 } 1120 function isProfiler(object) { 1121 return typeOf(object) === REACT_PROFILER_TYPE; 1122 } 1123 function isStrictMode(object) { 1124 return typeOf(object) === REACT_STRICT_MODE_TYPE; 1125 } 1126 function isSuspense(object) { 1127 return typeOf(object) === REACT_SUSPENSE_TYPE; 1128 } 1129 1130 exports.AsyncMode = AsyncMode; 1131 exports.ConcurrentMode = ConcurrentMode; 1132 exports.ContextConsumer = ContextConsumer; 1133 exports.ContextProvider = ContextProvider; 1134 exports.Element = Element; 1135 exports.ForwardRef = ForwardRef; 1136 exports.Fragment = Fragment; 1137 exports.Lazy = Lazy; 1138 exports.Memo = Memo; 1139 exports.Portal = Portal; 1140 exports.Profiler = Profiler; 1141 exports.StrictMode = StrictMode; 1142 exports.Suspense = Suspense; 1143 exports.isAsyncMode = isAsyncMode; 1144 exports.isConcurrentMode = isConcurrentMode; 1145 exports.isContextConsumer = isContextConsumer; 1146 exports.isContextProvider = isContextProvider; 1147 exports.isElement = isElement; 1148 exports.isForwardRef = isForwardRef; 1149 exports.isFragment = isFragment; 1150 exports.isLazy = isLazy; 1151 exports.isMemo = isMemo; 1152 exports.isPortal = isPortal; 1153 exports.isProfiler = isProfiler; 1154 exports.isStrictMode = isStrictMode; 1155 exports.isSuspense = isSuspense; 1156 exports.isValidElementType = isValidElementType; 1157 exports.typeOf = typeOf; 1158 })(); 1159 } 1160 1161 1162 /***/ }), 1163 1164 /***/ "./node_modules/react-is/index.js": 1165 /*!****************************************!*\ 1166 !*** ./node_modules/react-is/index.js ***! 1167 \****************************************/ 1168 /***/ (function(module, __unused_webpack_exports, __webpack_require__) { 1169 1170 "use strict"; 1171 1172 1173 if (false) {} else { 1174 module.exports = __webpack_require__(/*! ./cjs/react-is.development.js */ "./node_modules/react-is/cjs/react-is.development.js"); 1175 } 1176 1177 1178 /***/ }), 1179 1180 /***/ "./node_modules/react-sortable-hoc/dist/react-sortable-hoc.esm.js": 1181 /*!************************************************************************!*\ 1182 !*** ./node_modules/react-sortable-hoc/dist/react-sortable-hoc.esm.js ***! 1183 \************************************************************************/ 1184 /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { 1185 1186 "use strict"; 1187 __webpack_require__.r(__webpack_exports__); 1188 /* harmony export */ __webpack_require__.d(__webpack_exports__, { 1189 /* harmony export */ "SortableContainer": function() { return /* binding */ sortableContainer; }, 1190 /* harmony export */ "sortableContainer": function() { return /* binding */ sortableContainer; }, 1191 /* harmony export */ "SortableElement": function() { return /* binding */ sortableElement; }, 1192 /* harmony export */ "sortableElement": function() { return /* binding */ sortableElement; }, 1193 /* harmony export */ "SortableHandle": function() { return /* binding */ sortableHandle; }, 1194 /* harmony export */ "sortableHandle": function() { return /* binding */ sortableHandle; }, 1195 /* harmony export */ "arrayMove": function() { return /* binding */ arrayMove; } 1196 /* harmony export */ }); 1197 /* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ "./node_modules/@babel/runtime/helpers/esm/extends.js"); 1198 /* harmony import */ var _babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/slicedToArray */ "./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"); 1199 /* harmony import */ var _babel_runtime_helpers_esm_objectSpread__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectSpread */ "./node_modules/@babel/runtime/helpers/esm/objectSpread.js"); 1200 /* harmony import */ var _babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/esm/classCallCheck */ "./node_modules/@babel/runtime/helpers/esm/classCallCheck.js"); 1201 /* harmony import */ var _babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/esm/createClass */ "./node_modules/@babel/runtime/helpers/esm/createClass.js"); 1202 /* harmony import */ var _babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/esm/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js"); 1203 /* harmony import */ var _babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/esm/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js"); 1204 /* harmony import */ var _babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @babel/runtime/helpers/esm/inherits */ "./node_modules/@babel/runtime/helpers/esm/inherits.js"); 1205 /* harmony import */ var _babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @babel/runtime/helpers/esm/assertThisInitialized */ "./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js"); 1206 /* harmony import */ var _babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @babel/runtime/helpers/esm/defineProperty */ "./node_modules/@babel/runtime/helpers/esm/defineProperty.js"); 1207 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! react */ "react"); 1208 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_10__); 1209 /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! react-dom */ "react-dom"); 1210 /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_11__); 1211 /* harmony import */ var invariant__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! invariant */ "./node_modules/invariant/browser.js"); 1212 /* harmony import */ var invariant__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(invariant__WEBPACK_IMPORTED_MODULE_12__); 1213 /* harmony import */ var _babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @babel/runtime/helpers/esm/toConsumableArray */ "./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js"); 1214 /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js"); 1215 /* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_14__); 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 var Manager = function () { 1233 function Manager() { 1234 (0,_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_3__["default"])(this, Manager); 1235 1236 (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_9__["default"])(this, "refs", {}); 1237 } 1238 1239 (0,_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_4__["default"])(Manager, [{ 1240 key: "add", 1241 value: function add(collection, ref) { 1242 if (!this.refs[collection]) { 1243 this.refs[collection] = []; 1244 } 1245 1246 this.refs[collection].push(ref); 1247 } 1248 }, { 1249 key: "remove", 1250 value: function remove(collection, ref) { 1251 var index = this.getIndex(collection, ref); 1252 1253 if (index !== -1) { 1254 this.refs[collection].splice(index, 1); 1255 } 1256 } 1257 }, { 1258 key: "isActive", 1259 value: function isActive() { 1260 return this.active; 1261 } 1262 }, { 1263 key: "getActive", 1264 value: function getActive() { 1265 var _this = this; 1266 1267 return this.refs[this.active.collection].find(function (_ref) { 1268 var node = _ref.node; 1269 return node.sortableInfo.index == _this.active.index; 1270 }); 1271 } 1272 }, { 1273 key: "getIndex", 1274 value: function getIndex(collection, ref) { 1275 return this.refs[collection].indexOf(ref); 1276 } 1277 }, { 1278 key: "getOrderedRefs", 1279 value: function getOrderedRefs() { 1280 var collection = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.active.collection; 1281 return this.refs[collection].sort(sortByIndex); 1282 } 1283 }]); 1284 1285 return Manager; 1286 }(); 1287 1288 function sortByIndex(_ref2, _ref3) { 1289 var index1 = _ref2.node.sortableInfo.index; 1290 var index2 = _ref3.node.sortableInfo.index; 1291 return index1 - index2; 1292 } 1293 1294 function arrayMove(array, from, to) { 1295 if (true) { 1296 if (typeof console !== 'undefined') { 1297 console.warn("Deprecation warning: arrayMove will no longer be exported by 'react-sortable-hoc' in the next major release. Please install the `array-move` package locally instead. https://www.npmjs.com/package/array-move"); 1298 } 1299 } 1300 1301 array = array.slice(); 1302 array.splice(to < 0 ? array.length + to : to, 0, array.splice(from, 1)[0]); 1303 return array; 1304 } 1305 function omit(obj, keysToOmit) { 1306 return Object.keys(obj).reduce(function (acc, key) { 1307 if (keysToOmit.indexOf(key) === -1) { 1308 acc[key] = obj[key]; 1309 } 1310 1311 return acc; 1312 }, {}); 1313 } 1314 var events = { 1315 end: ['touchend', 'touchcancel', 'mouseup'], 1316 move: ['touchmove', 'mousemove'], 1317 start: ['touchstart', 'mousedown'] 1318 }; 1319 var vendorPrefix = function () { 1320 if (typeof window === 'undefined' || typeof document === 'undefined') { 1321 return ''; 1322 } 1323 1324 var styles = window.getComputedStyle(document.documentElement, '') || ['-moz-hidden-iframe']; 1325 var pre = (Array.prototype.slice.call(styles).join('').match(/-(moz|webkit|ms)-/) || styles.OLink === '' && ['', 'o'])[1]; 1326 1327 switch (pre) { 1328 case 'ms': 1329 return 'ms'; 1330 1331 default: 1332 return pre && pre.length ? pre[0].toUpperCase() + pre.substr(1) : ''; 1333 } 1334 }(); 1335 function setInlineStyles(node, styles) { 1336 Object.keys(styles).forEach(function (key) { 1337 node.style[key] = styles[key]; 1338 }); 1339 } 1340 function setTranslate3d(node, translate) { 1341 node.style["".concat(vendorPrefix, "Transform")] = translate == null ? '' : "translate3d(".concat(translate.x, "px,").concat(translate.y, "px,0)"); 1342 } 1343 function setTransitionDuration(node, duration) { 1344 node.style["".concat(vendorPrefix, "TransitionDuration")] = duration == null ? '' : "".concat(duration, "ms"); 1345 } 1346 function closest(el, fn) { 1347 while (el) { 1348 if (fn(el)) { 1349 return el; 1350 } 1351 1352 el = el.parentNode; 1353 } 1354 1355 return null; 1356 } 1357 function limit(min, max, value) { 1358 return Math.max(min, Math.min(value, max)); 1359 } 1360 1361 function getPixelValue(stringValue) { 1362 if (stringValue.substr(-2) === 'px') { 1363 return parseFloat(stringValue); 1364 } 1365 1366 return 0; 1367 } 1368 1369 function getElementMargin(element) { 1370 var style = window.getComputedStyle(element); 1371 return { 1372 bottom: getPixelValue(style.marginBottom), 1373 left: getPixelValue(style.marginLeft), 1374 right: getPixelValue(style.marginRight), 1375 top: getPixelValue(style.marginTop) 1376 }; 1377 } 1378 function provideDisplayName(prefix, Component$$1) { 1379 var componentName = Component$$1.displayName || Component$$1.name; 1380 return componentName ? "".concat(prefix, "(").concat(componentName, ")") : prefix; 1381 } 1382 function getScrollAdjustedBoundingClientRect(node, scrollDelta) { 1383 var boundingClientRect = node.getBoundingClientRect(); 1384 return { 1385 top: boundingClientRect.top + scrollDelta.top, 1386 left: boundingClientRect.left + scrollDelta.left 1387 }; 1388 } 1389 function getPosition(event) { 1390 if (event.touches && event.touches.length) { 1391 return { 1392 x: event.touches[0].pageX, 1393 y: event.touches[0].pageY 1394 }; 1395 } else if (event.changedTouches && event.changedTouches.length) { 1396 return { 1397 x: event.changedTouches[0].pageX, 1398 y: event.changedTouches[0].pageY 1399 }; 1400 } else { 1401 return { 1402 x: event.pageX, 1403 y: event.pageY 1404 }; 1405 } 1406 } 1407 function isTouchEvent(event) { 1408 return event.touches && event.touches.length || event.changedTouches && event.changedTouches.length; 1409 } 1410 function getEdgeOffset(node, parent) { 1411 var offset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : { 1412 left: 0, 1413 top: 0 1414 }; 1415 1416 if (!node) { 1417 return undefined; 1418 } 1419 1420 var nodeOffset = { 1421 left: offset.left + node.offsetLeft, 1422 top: offset.top + node.offsetTop 1423 }; 1424 1425 if (node.parentNode === parent) { 1426 return nodeOffset; 1427 } 1428 1429 return getEdgeOffset(node.parentNode, parent, nodeOffset); 1430 } 1431 function getTargetIndex(newIndex, prevIndex, oldIndex) { 1432 if (newIndex < oldIndex && newIndex > prevIndex) { 1433 return newIndex - 1; 1434 } else if (newIndex > oldIndex && newIndex < prevIndex) { 1435 return newIndex + 1; 1436 } else { 1437 return newIndex; 1438 } 1439 } 1440 function getLockPixelOffset(_ref) { 1441 var lockOffset = _ref.lockOffset, 1442 width = _ref.width, 1443 height = _ref.height; 1444 var offsetX = lockOffset; 1445 var offsetY = lockOffset; 1446 var unit = 'px'; 1447 1448 if (typeof lockOffset === 'string') { 1449 var match = /^[+-]?\d*(?:\.\d*)?(px|%)$/.exec(lockOffset); 1450 invariant__WEBPACK_IMPORTED_MODULE_12___default()(match !== null, 'lockOffset value should be a number or a string of a ' + 'number followed by "px" or "%". Given %s', lockOffset); 1451 offsetX = parseFloat(lockOffset); 1452 offsetY = parseFloat(lockOffset); 1453 unit = match[1]; 1454 } 1455 1456 invariant__WEBPACK_IMPORTED_MODULE_12___default()(isFinite(offsetX) && isFinite(offsetY), 'lockOffset value should be a finite. Given %s', lockOffset); 1457 1458 if (unit === '%') { 1459 offsetX = offsetX * width / 100; 1460 offsetY = offsetY * height / 100; 1461 } 1462 1463 return { 1464 x: offsetX, 1465 y: offsetY 1466 }; 1467 } 1468 function getLockPixelOffsets(_ref2) { 1469 var height = _ref2.height, 1470 width = _ref2.width, 1471 lockOffset = _ref2.lockOffset; 1472 var offsets = Array.isArray(lockOffset) ? lockOffset : [lockOffset, lockOffset]; 1473 invariant__WEBPACK_IMPORTED_MODULE_12___default()(offsets.length === 2, 'lockOffset prop of SortableContainer should be a single ' + 'value or an array of exactly two values. Given %s', lockOffset); 1474 1475 var _offsets = (0,_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_1__["default"])(offsets, 2), 1476 minLockOffset = _offsets[0], 1477 maxLockOffset = _offsets[1]; 1478 1479 return [getLockPixelOffset({ 1480 height: height, 1481 lockOffset: minLockOffset, 1482 width: width 1483 }), getLockPixelOffset({ 1484 height: height, 1485 lockOffset: maxLockOffset, 1486 width: width 1487 })]; 1488 } 1489 1490 function isScrollable(el) { 1491 var computedStyle = window.getComputedStyle(el); 1492 var overflowRegex = /(auto|scroll)/; 1493 var properties = ['overflow', 'overflowX', 'overflowY']; 1494 return properties.find(function (property) { 1495 return overflowRegex.test(computedStyle[property]); 1496 }); 1497 } 1498 1499 function getScrollingParent(el) { 1500 if (!(el instanceof HTMLElement)) { 1501 return null; 1502 } else if (isScrollable(el)) { 1503 return el; 1504 } else { 1505 return getScrollingParent(el.parentNode); 1506 } 1507 } 1508 function getContainerGridGap(element) { 1509 var style = window.getComputedStyle(element); 1510 1511 if (style.display === 'grid') { 1512 return { 1513 x: getPixelValue(style.gridColumnGap), 1514 y: getPixelValue(style.gridRowGap) 1515 }; 1516 } 1517 1518 return { 1519 x: 0, 1520 y: 0 1521 }; 1522 } 1523 var KEYCODE = { 1524 TAB: 9, 1525 ESC: 27, 1526 SPACE: 32, 1527 LEFT: 37, 1528 UP: 38, 1529 RIGHT: 39, 1530 DOWN: 40 1531 }; 1532 var NodeType = { 1533 Anchor: 'A', 1534 Button: 'BUTTON', 1535 Canvas: 'CANVAS', 1536 Input: 'INPUT', 1537 Option: 'OPTION', 1538 Textarea: 'TEXTAREA', 1539 Select: 'SELECT' 1540 }; 1541 function cloneNode(node) { 1542 var selector = 'input, textarea, select, canvas, [contenteditable]'; 1543 var fields = node.querySelectorAll(selector); 1544 var clonedNode = node.cloneNode(true); 1545 1546 var clonedFields = (0,_babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_13__["default"])(clonedNode.querySelectorAll(selector)); 1547 1548 clonedFields.forEach(function (field, i) { 1549 if (field.type !== 'file') { 1550 field.value = fields[i].value; 1551 } 1552 1553 if (field.type === 'radio' && field.name) { 1554 field.name = "__sortableClone__".concat(field.name); 1555 } 1556 1557 if (field.tagName === NodeType.Canvas && fields[i].width > 0 && fields[i].height > 0) { 1558 var destCtx = field.getContext('2d'); 1559 destCtx.drawImage(fields[i], 0, 0); 1560 } 1561 }); 1562 return clonedNode; 1563 } 1564 1565 function sortableHandle(WrappedComponent) { 1566 var _class, _temp; 1567 1568 var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { 1569 withRef: false 1570 }; 1571 return _temp = _class = function (_React$Component) { 1572 (0,_babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_7__["default"])(WithSortableHandle, _React$Component); 1573 1574 function WithSortableHandle() { 1575 var _getPrototypeOf2; 1576 1577 var _this; 1578 1579 (0,_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_3__["default"])(this, WithSortableHandle); 1580 1581 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 1582 args[_key] = arguments[_key]; 1583 } 1584 1585 _this = (0,_babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5__["default"])(this, (_getPrototypeOf2 = (0,_babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__["default"])(WithSortableHandle)).call.apply(_getPrototypeOf2, [this].concat(args))); 1586 1587 (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_9__["default"])((0,_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_8__["default"])((0,_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_8__["default"])(_this)), "wrappedInstance", (0,react__WEBPACK_IMPORTED_MODULE_10__.createRef)()); 1588 1589 return _this; 1590 } 1591 1592 (0,_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_4__["default"])(WithSortableHandle, [{ 1593 key: "componentDidMount", 1594 value: function componentDidMount() { 1595 var node = (0,react_dom__WEBPACK_IMPORTED_MODULE_11__.findDOMNode)(this); 1596 node.sortableHandle = true; 1597 } 1598 }, { 1599 key: "getWrappedInstance", 1600 value: function getWrappedInstance() { 1601 invariant__WEBPACK_IMPORTED_MODULE_12___default()(config.withRef, 'To access the wrapped instance, you need to pass in {withRef: true} as the second argument of the SortableHandle() call'); 1602 return this.wrappedInstance.current; 1603 } 1604 }, { 1605 key: "render", 1606 value: function render() { 1607 var ref = config.withRef ? this.wrappedInstance : null; 1608 return (0,react__WEBPACK_IMPORTED_MODULE_10__.createElement)(WrappedComponent, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({ 1609 ref: ref 1610 }, this.props)); 1611 } 1612 }]); 1613 1614 return WithSortableHandle; 1615 }(react__WEBPACK_IMPORTED_MODULE_10__.Component), (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_9__["default"])(_class, "displayName", provideDisplayName('sortableHandle', WrappedComponent)), _temp; 1616 } 1617 function isSortableHandle(node) { 1618 return node.sortableHandle != null; 1619 } 1620 1621 var AutoScroller = function () { 1622 function AutoScroller(container, onScrollCallback) { 1623 (0,_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_3__["default"])(this, AutoScroller); 1624 1625 this.container = container; 1626 this.onScrollCallback = onScrollCallback; 1627 } 1628 1629 (0,_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_4__["default"])(AutoScroller, [{ 1630 key: "clear", 1631 value: function clear() { 1632 if (this.interval == null) { 1633 return; 1634 } 1635 1636 clearInterval(this.interval); 1637 this.interval = null; 1638 } 1639 }, { 1640 key: "update", 1641 value: function update(_ref) { 1642 var _this = this; 1643 1644 var translate = _ref.translate, 1645 minTranslate = _ref.minTranslate, 1646 maxTranslate = _ref.maxTranslate, 1647 width = _ref.width, 1648 height = _ref.height; 1649 var direction = { 1650 x: 0, 1651 y: 0 1652 }; 1653 var speed = { 1654 x: 1, 1655 y: 1 1656 }; 1657 var acceleration = { 1658 x: 10, 1659 y: 10 1660 }; 1661 var _this$container = this.container, 1662 scrollTop = _this$container.scrollTop, 1663 scrollLeft = _this$container.scrollLeft, 1664 scrollHeight = _this$container.scrollHeight, 1665 scrollWidth = _this$container.scrollWidth, 1666 clientHeight = _this$container.clientHeight, 1667 clientWidth = _this$container.clientWidth; 1668 var isTop = scrollTop === 0; 1669 var isBottom = scrollHeight - scrollTop - clientHeight === 0; 1670 var isLeft = scrollLeft === 0; 1671 var isRight = scrollWidth - scrollLeft - clientWidth === 0; 1672 1673 if (translate.y >= maxTranslate.y - height / 2 && !isBottom) { 1674 direction.y = 1; 1675 speed.y = acceleration.y * Math.abs((maxTranslate.y - height / 2 - translate.y) / height); 1676 } else if (translate.x >= maxTranslate.x - width / 2 && !isRight) { 1677 direction.x = 1; 1678 speed.x = acceleration.x * Math.abs((maxTranslate.x - width / 2 - translate.x) / width); 1679 } else if (translate.y <= minTranslate.y + height / 2 && !isTop) { 1680 direction.y = -1; 1681 speed.y = acceleration.y * Math.abs((translate.y - height / 2 - minTranslate.y) / height); 1682 } else if (translate.x <= minTranslate.x + width / 2 && !isLeft) { 1683 direction.x = -1; 1684 speed.x = acceleration.x * Math.abs((translate.x - width / 2 - minTranslate.x) / width); 1685 } 1686 1687 if (this.interval) { 1688 this.clear(); 1689 this.isAutoScrolling = false; 1690 } 1691 1692 if (direction.x !== 0 || direction.y !== 0) { 1693 this.interval = setInterval(function () { 1694 _this.isAutoScrolling = true; 1695 var offset = { 1696 left: speed.x * direction.x, 1697 top: speed.y * direction.y 1698 }; 1699 _this.container.scrollTop += offset.top; 1700 _this.container.scrollLeft += offset.left; 1701 1702 _this.onScrollCallback(offset); 1703 }, 5); 1704 } 1705 } 1706 }]); 1707 1708 return AutoScroller; 1709 }(); 1710 1711 function defaultGetHelperDimensions(_ref) { 1712 var node = _ref.node; 1713 return { 1714 height: node.offsetHeight, 1715 width: node.offsetWidth 1716 }; 1717 } 1718 1719 function defaultShouldCancelStart(event) { 1720 var interactiveElements = [NodeType.Input, NodeType.Textarea, NodeType.Select, NodeType.Option, NodeType.Button]; 1721 1722 if (interactiveElements.indexOf(event.target.tagName) !== -1) { 1723 return true; 1724 } 1725 1726 if (closest(event.target, function (el) { 1727 return el.contentEditable === 'true'; 1728 })) { 1729 return true; 1730 } 1731 1732 return false; 1733 } 1734 1735 var propTypes = { 1736 axis: prop_types__WEBPACK_IMPORTED_MODULE_14___default().oneOf(['x', 'y', 'xy']), 1737 contentWindow: (prop_types__WEBPACK_IMPORTED_MODULE_14___default().any), 1738 disableAutoscroll: (prop_types__WEBPACK_IMPORTED_MODULE_14___default().bool), 1739 distance: (prop_types__WEBPACK_IMPORTED_MODULE_14___default().number), 1740 getContainer: (prop_types__WEBPACK_IMPORTED_MODULE_14___default().func), 1741 getHelperDimensions: (prop_types__WEBPACK_IMPORTED_MODULE_14___default().func), 1742 helperClass: (prop_types__WEBPACK_IMPORTED_MODULE_14___default().string), 1743 helperContainer: prop_types__WEBPACK_IMPORTED_MODULE_14___default().oneOfType([(prop_types__WEBPACK_IMPORTED_MODULE_14___default().func), typeof HTMLElement === 'undefined' ? (prop_types__WEBPACK_IMPORTED_MODULE_14___default().any) : prop_types__WEBPACK_IMPORTED_MODULE_14___default().instanceOf(HTMLElement)]), 1744 hideSortableGhost: (prop_types__WEBPACK_IMPORTED_MODULE_14___default().bool), 1745 keyboardSortingTransitionDuration: (prop_types__WEBPACK_IMPORTED_MODULE_14___default().number), 1746 lockAxis: (prop_types__WEBPACK_IMPORTED_MODULE_14___default().string), 1747 lockOffset: prop_types__WEBPACK_IMPORTED_MODULE_14___default().oneOfType([(prop_types__WEBPACK_IMPORTED_MODULE_14___default().number), (prop_types__WEBPACK_IMPORTED_MODULE_14___default().string), prop_types__WEBPACK_IMPORTED_MODULE_14___default().arrayOf(prop_types__WEBPACK_IMPORTED_MODULE_14___default().oneOfType([(prop_types__WEBPACK_IMPORTED_MODULE_14___default().number), (prop_types__WEBPACK_IMPORTED_MODULE_14___default().string)]))]), 1748 lockToContainerEdges: (prop_types__WEBPACK_IMPORTED_MODULE_14___default().bool), 1749 onSortEnd: (prop_types__WEBPACK_IMPORTED_MODULE_14___default().func), 1750 onSortMove: (prop_types__WEBPACK_IMPORTED_MODULE_14___default().func), 1751 onSortOver: (prop_types__WEBPACK_IMPORTED_MODULE_14___default().func), 1752 onSortStart: (prop_types__WEBPACK_IMPORTED_MODULE_14___default().func), 1753 pressDelay: (prop_types__WEBPACK_IMPORTED_MODULE_14___default().number), 1754 pressThreshold: (prop_types__WEBPACK_IMPORTED_MODULE_14___default().number), 1755 keyCodes: prop_types__WEBPACK_IMPORTED_MODULE_14___default().shape({ 1756 lift: prop_types__WEBPACK_IMPORTED_MODULE_14___default().arrayOf((prop_types__WEBPACK_IMPORTED_MODULE_14___default().number)), 1757 drop: prop_types__WEBPACK_IMPORTED_MODULE_14___default().arrayOf((prop_types__WEBPACK_IMPORTED_MODULE_14___default().number)), 1758 cancel: prop_types__WEBPACK_IMPORTED_MODULE_14___default().arrayOf((prop_types__WEBPACK_IMPORTED_MODULE_14___default().number)), 1759 up: prop_types__WEBPACK_IMPORTED_MODULE_14___default().arrayOf((prop_types__WEBPACK_IMPORTED_MODULE_14___default().number)), 1760 down: prop_types__WEBPACK_IMPORTED_MODULE_14___default().arrayOf((prop_types__WEBPACK_IMPORTED_MODULE_14___default().number)) 1761 }), 1762 shouldCancelStart: (prop_types__WEBPACK_IMPORTED_MODULE_14___default().func), 1763 transitionDuration: (prop_types__WEBPACK_IMPORTED_MODULE_14___default().number), 1764 updateBeforeSortStart: (prop_types__WEBPACK_IMPORTED_MODULE_14___default().func), 1765 useDragHandle: (prop_types__WEBPACK_IMPORTED_MODULE_14___default().bool), 1766 useWindowAsScrollContainer: (prop_types__WEBPACK_IMPORTED_MODULE_14___default().bool) 1767 }; 1768 var defaultKeyCodes = { 1769 lift: [KEYCODE.SPACE], 1770 drop: [KEYCODE.SPACE], 1771 cancel: [KEYCODE.ESC], 1772 up: [KEYCODE.UP, KEYCODE.LEFT], 1773 down: [KEYCODE.DOWN, KEYCODE.RIGHT] 1774 }; 1775 var defaultProps = { 1776 axis: 'y', 1777 disableAutoscroll: false, 1778 distance: 0, 1779 getHelperDimensions: defaultGetHelperDimensions, 1780 hideSortableGhost: true, 1781 lockOffset: '50%', 1782 lockToContainerEdges: false, 1783 pressDelay: 0, 1784 pressThreshold: 5, 1785 keyCodes: defaultKeyCodes, 1786 shouldCancelStart: defaultShouldCancelStart, 1787 transitionDuration: 300, 1788 useWindowAsScrollContainer: false 1789 }; 1790 var omittedProps = Object.keys(propTypes); 1791 function validateProps(props) { 1792 invariant__WEBPACK_IMPORTED_MODULE_12___default()(!(props.distance && props.pressDelay), 'Attempted to set both `pressDelay` and `distance` on SortableContainer, you may only use one or the other, not both at the same time.'); 1793 } 1794 1795 function _finallyRethrows(body, finalizer) { 1796 try { 1797 var result = body(); 1798 } catch (e) { 1799 return finalizer(true, e); 1800 } 1801 1802 if (result && result.then) { 1803 return result.then(finalizer.bind(null, false), finalizer.bind(null, true)); 1804 } 1805 1806 return finalizer(false, value); 1807 } 1808 var SortableContext = (0,react__WEBPACK_IMPORTED_MODULE_10__.createContext)({ 1809 manager: {} 1810 }); 1811 function sortableContainer(WrappedComponent) { 1812 var _class, _temp; 1813 1814 var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { 1815 withRef: false 1816 }; 1817 return _temp = _class = function (_React$Component) { 1818 (0,_babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_7__["default"])(WithSortableContainer, _React$Component); 1819 1820 function WithSortableContainer(props) { 1821 var _this; 1822 1823 (0,_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_3__["default"])(this, WithSortableContainer); 1824 1825 _this = (0,_babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5__["default"])(this, (0,_babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__["default"])(WithSortableContainer).call(this, props)); 1826 1827 (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_9__["default"])((0,_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_8__["default"])((0,_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_8__["default"])(_this)), "state", {}); 1828 1829 (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_9__["default"])((0,_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_8__["default"])((0,_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_8__["default"])(_this)), "handleStart", function (event) { 1830 var _this$props = _this.props, 1831 distance = _this$props.distance, 1832 shouldCancelStart = _this$props.shouldCancelStart; 1833 1834 if (event.button === 2 || shouldCancelStart(event)) { 1835 return; 1836 } 1837 1838 _this.touched = true; 1839 _this.position = getPosition(event); 1840 var node = closest(event.target, function (el) { 1841 return el.sortableInfo != null; 1842 }); 1843 1844 if (node && node.sortableInfo && _this.nodeIsChild(node) && !_this.state.sorting) { 1845 var useDragHandle = _this.props.useDragHandle; 1846 var _node$sortableInfo = node.sortableInfo, 1847 index = _node$sortableInfo.index, 1848 collection = _node$sortableInfo.collection, 1849 disabled = _node$sortableInfo.disabled; 1850 1851 if (disabled) { 1852 return; 1853 } 1854 1855 if (useDragHandle && !closest(event.target, isSortableHandle)) { 1856 return; 1857 } 1858 1859 _this.manager.active = { 1860 collection: collection, 1861 index: index 1862 }; 1863 1864 if (!isTouchEvent(event) && event.target.tagName === NodeType.Anchor) { 1865 event.preventDefault(); 1866 } 1867 1868 if (!distance) { 1869 if (_this.props.pressDelay === 0) { 1870 _this.handlePress(event); 1871 } else { 1872 _this.pressTimer = setTimeout(function () { 1873 return _this.handlePress(event); 1874 }, _this.props.pressDelay); 1875 } 1876 } 1877 } 1878 }); 1879 1880 (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_9__["default"])((0,_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_8__["default"])((0,_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_8__["default"])(_this)), "nodeIsChild", function (node) { 1881 return node.sortableInfo.manager === _this.manager; 1882 }); 1883 1884 (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_9__["default"])((0,_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_8__["default"])((0,_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_8__["default"])(_this)), "handleMove", function (event) { 1885 var _this$props2 = _this.props, 1886 distance = _this$props2.distance, 1887 pressThreshold = _this$props2.pressThreshold; 1888 1889 if (!_this.state.sorting && _this.touched && !_this._awaitingUpdateBeforeSortStart) { 1890 var position = getPosition(event); 1891 var delta = { 1892 x: _this.position.x - position.x, 1893 y: _this.position.y - position.y 1894 }; 1895 var combinedDelta = Math.abs(delta.x) + Math.abs(delta.y); 1896 _this.delta = delta; 1897 1898 if (!distance && (!pressThreshold || combinedDelta >= pressThreshold)) { 1899 clearTimeout(_this.cancelTimer); 1900 _this.cancelTimer = setTimeout(_this.cancel, 0); 1901 } else if (distance && combinedDelta >= distance && _this.manager.isActive()) { 1902 _this.handlePress(event); 1903 } 1904 } 1905 }); 1906 1907 (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_9__["default"])((0,_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_8__["default"])((0,_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_8__["default"])(_this)), "handleEnd", function () { 1908 _this.touched = false; 1909 1910 _this.cancel(); 1911 }); 1912 1913 (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_9__["default"])((0,_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_8__["default"])((0,_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_8__["default"])(_this)), "cancel", function () { 1914 var distance = _this.props.distance; 1915 var sorting = _this.state.sorting; 1916 1917 if (!sorting) { 1918 if (!distance) { 1919 clearTimeout(_this.pressTimer); 1920 } 1921 1922 _this.manager.active = null; 1923 } 1924 }); 1925 1926 (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_9__["default"])((0,_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_8__["default"])((0,_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_8__["default"])(_this)), "handlePress", function (event) { 1927 try { 1928 var active = _this.manager.getActive(); 1929 1930 var _temp6 = function () { 1931 if (active) { 1932 var _temp7 = function _temp7() { 1933 var index = _node.sortableInfo.index; 1934 var margin = getElementMargin(_node); 1935 var gridGap = getContainerGridGap(_this.container); 1936 1937 var containerBoundingRect = _this.scrollContainer.getBoundingClientRect(); 1938 1939 var dimensions = _getHelperDimensions({ 1940 index: index, 1941 node: _node, 1942 collection: _collection 1943 }); 1944 1945 _this.node = _node; 1946 _this.margin = margin; 1947 _this.gridGap = gridGap; 1948 _this.width = dimensions.width; 1949 _this.height = dimensions.height; 1950 _this.marginOffset = { 1951 x: _this.margin.left + _this.margin.right + _this.gridGap.x, 1952 y: Math.max(_this.margin.top, _this.margin.bottom, _this.gridGap.y) 1953 }; 1954 _this.boundingClientRect = _node.getBoundingClientRect(); 1955 _this.containerBoundingRect = containerBoundingRect; 1956 _this.index = index; 1957 _this.newIndex = index; 1958 _this.axis = { 1959 x: _axis.indexOf('x') >= 0, 1960 y: _axis.indexOf('y') >= 0 1961 }; 1962 _this.offsetEdge = getEdgeOffset(_node, _this.container); 1963 1964 if (_isKeySorting) { 1965 _this.initialOffset = getPosition((0,_babel_runtime_helpers_esm_objectSpread__WEBPACK_IMPORTED_MODULE_2__["default"])({}, event, { 1966 pageX: _this.boundingClientRect.left, 1967 pageY: _this.boundingClientRect.top 1968 })); 1969 } else { 1970 _this.initialOffset = getPosition(event); 1971 } 1972 1973 _this.initialScroll = { 1974 left: _this.scrollContainer.scrollLeft, 1975 top: _this.scrollContainer.scrollTop 1976 }; 1977 _this.initialWindowScroll = { 1978 left: window.pageXOffset, 1979 top: window.pageYOffset 1980 }; 1981 _this.helper = _this.helperContainer.appendChild(cloneNode(_node)); 1982 setInlineStyles(_this.helper, { 1983 boxSizing: 'border-box', 1984 height: "".concat(_this.height, "px"), 1985 left: "".concat(_this.boundingClientRect.left - margin.left, "px"), 1986 pointerEvents: 'none', 1987 position: 'fixed', 1988 top: "".concat(_this.boundingClientRect.top - margin.top, "px"), 1989 width: "".concat(_this.width, "px") 1990 }); 1991 1992 if (_isKeySorting) { 1993 _this.helper.focus(); 1994 } 1995 1996 if (_hideSortableGhost) { 1997 _this.sortableGhost = _node; 1998 setInlineStyles(_node, { 1999 opacity: 0, 2000 visibility: 'hidden' 2001 }); 2002 } 2003 2004 _this.minTranslate = {}; 2005 _this.maxTranslate = {}; 2006 2007 if (_isKeySorting) { 2008 var _ref = _useWindowAsScrollContainer ? { 2009 top: 0, 2010 left: 0, 2011 width: _this.contentWindow.innerWidth, 2012 height: _this.contentWindow.innerHeight 2013 } : _this.containerBoundingRect, 2014 containerTop = _ref.top, 2015 containerLeft = _ref.left, 2016 containerWidth = _ref.width, 2017 containerHeight = _ref.height; 2018 2019 var containerBottom = containerTop + containerHeight; 2020 var containerRight = containerLeft + containerWidth; 2021 2022 if (_this.axis.x) { 2023 _this.minTranslate.x = containerLeft - _this.boundingClientRect.left; 2024 _this.maxTranslate.x = containerRight - (_this.boundingClientRect.left + _this.width); 2025 } 2026 2027 if (_this.axis.y) { 2028 _this.minTranslate.y = containerTop - _this.boundingClientRect.top; 2029 _this.maxTranslate.y = containerBottom - (_this.boundingClientRect.top + _this.height); 2030 } 2031 } else { 2032 if (_this.axis.x) { 2033 _this.minTranslate.x = (_useWindowAsScrollContainer ? 0 : containerBoundingRect.left) - _this.boundingClientRect.left - _this.width / 2; 2034 _this.maxTranslate.x = (_useWindowAsScrollContainer ? _this.contentWindow.innerWidth : containerBoundingRect.left + containerBoundingRect.width) - _this.boundingClientRect.left - _this.width / 2; 2035 } 2036 2037 if (_this.axis.y) { 2038 _this.minTranslate.y = (_useWindowAsScrollContainer ? 0 : containerBoundingRect.top) - _this.boundingClientRect.top - _this.height / 2; 2039 _this.maxTranslate.y = (_useWindowAsScrollContainer ? _this.contentWindow.innerHeight : containerBoundingRect.top + containerBoundingRect.height) - _this.boundingClientRect.top - _this.height / 2; 2040 } 2041 } 2042 2043 if (_helperClass) { 2044 _helperClass.split(' ').forEach(function (className) { 2045 return _this.helper.classList.add(className); 2046 }); 2047 } 2048 2049 _this.listenerNode = event.touches ? event.target : _this.contentWindow; 2050 2051 if (_isKeySorting) { 2052 _this.listenerNode.addEventListener('wheel', _this.handleKeyEnd, true); 2053 2054 _this.listenerNode.addEventListener('mousedown', _this.handleKeyEnd, true); 2055 2056 _this.listenerNode.addEventListener('keydown', _this.handleKeyDown); 2057 } else { 2058 events.move.forEach(function (eventName) { 2059 return _this.listenerNode.addEventListener(eventName, _this.handleSortMove, false); 2060 }); 2061 events.end.forEach(function (eventName) { 2062 return _this.listenerNode.addEventListener(eventName, _this.handleSortEnd, false); 2063 }); 2064 } 2065 2066 _this.setState({ 2067 sorting: true, 2068 sortingIndex: index 2069 }); 2070 2071 if (_onSortStart) { 2072 _onSortStart({ 2073 node: _node, 2074 index: index, 2075 collection: _collection, 2076 isKeySorting: _isKeySorting, 2077 nodes: _this.manager.getOrderedRefs(), 2078 helper: _this.helper 2079 }, event); 2080 } 2081 2082 if (_isKeySorting) { 2083 _this.keyMove(0); 2084 } 2085 }; 2086 2087 var _this$props3 = _this.props, 2088 _axis = _this$props3.axis, 2089 _getHelperDimensions = _this$props3.getHelperDimensions, 2090 _helperClass = _this$props3.helperClass, 2091 _hideSortableGhost = _this$props3.hideSortableGhost, 2092 updateBeforeSortStart = _this$props3.updateBeforeSortStart, 2093 _onSortStart = _this$props3.onSortStart, 2094 _useWindowAsScrollContainer = _this$props3.useWindowAsScrollContainer; 2095 var _node = active.node, 2096 _collection = active.collection; 2097 var _isKeySorting = _this.manager.isKeySorting; 2098 2099 var _temp8 = function () { 2100 if (typeof updateBeforeSortStart === 'function') { 2101 _this._awaitingUpdateBeforeSortStart = true; 2102 2103 var _temp9 = _finallyRethrows(function () { 2104 var index = _node.sortableInfo.index; 2105 return Promise.resolve(updateBeforeSortStart({ 2106 collection: _collection, 2107 index: index, 2108 node: _node, 2109 isKeySorting: _isKeySorting 2110 }, event)).then(function () {}); 2111 }, function (_wasThrown, _result) { 2112 _this._awaitingUpdateBeforeSortStart = false; 2113 if (_wasThrown) throw _result; 2114 return _result; 2115 }); 2116 2117 if (_temp9 && _temp9.then) return _temp9.then(function () {}); 2118 } 2119 }(); 2120 2121 return _temp8 && _temp8.then ? _temp8.then(_temp7) : _temp7(_temp8); 2122 } 2123 }(); 2124 2125 return Promise.resolve(_temp6 && _temp6.then ? _temp6.then(function () {}) : void 0); 2126 } catch (e) { 2127 return Promise.reject(e); 2128 } 2129 }); 2130 2131 (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_9__["default"])((0,_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_8__["default"])((0,_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_8__["default"])(_this)), "handleSortMove", function (event) { 2132 var onSortMove = _this.props.onSortMove; 2133 2134 if (typeof event.preventDefault === 'function' && event.cancelable) { 2135 event.preventDefault(); 2136 } 2137 2138 _this.updateHelperPosition(event); 2139 2140 _this.animateNodes(); 2141 2142 _this.autoscroll(); 2143 2144 if (onSortMove) { 2145 onSortMove(event); 2146 } 2147 }); 2148 2149 (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_9__["default"])((0,_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_8__["default"])((0,_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_8__["default"])(_this)), "handleSortEnd", function (event) { 2150 var _this$props4 = _this.props, 2151 hideSortableGhost = _this$props4.hideSortableGhost, 2152 onSortEnd = _this$props4.onSortEnd; 2153 var _this$manager = _this.manager, 2154 collection = _this$manager.active.collection, 2155 isKeySorting = _this$manager.isKeySorting; 2156 2157 var nodes = _this.manager.getOrderedRefs(); 2158 2159 if (_this.listenerNode) { 2160 if (isKeySorting) { 2161 _this.listenerNode.removeEventListener('wheel', _this.handleKeyEnd, true); 2162 2163 _this.listenerNode.removeEventListener('mousedown', _this.handleKeyEnd, true); 2164 2165 _this.listenerNode.removeEventListener('keydown', _this.handleKeyDown); 2166 } else { 2167 events.move.forEach(function (eventName) { 2168 return _this.listenerNode.removeEventListener(eventName, _this.handleSortMove); 2169 }); 2170 events.end.forEach(function (eventName) { 2171 return _this.listenerNode.removeEventListener(eventName, _this.handleSortEnd); 2172 }); 2173 } 2174 } 2175 2176 _this.helper.parentNode.removeChild(_this.helper); 2177 2178 if (hideSortableGhost && _this.sortableGhost) { 2179 setInlineStyles(_this.sortableGhost, { 2180 opacity: '', 2181 visibility: '' 2182 }); 2183 } 2184 2185 for (var i = 0, len = nodes.length; i < len; i++) { 2186 var _node2 = nodes[i]; 2187 var el = _node2.node; 2188 _node2.edgeOffset = null; 2189 _node2.boundingClientRect = null; 2190 setTranslate3d(el, null); 2191 setTransitionDuration(el, null); 2192 _node2.translate = null; 2193 } 2194 2195 _this.autoScroller.clear(); 2196 2197 _this.manager.active = null; 2198 _this.manager.isKeySorting = false; 2199 2200 _this.setState({ 2201 sorting: false, 2202 sortingIndex: null 2203 }); 2204 2205 if (typeof onSortEnd === 'function') { 2206 onSortEnd({ 2207 collection: collection, 2208 newIndex: _this.newIndex, 2209 oldIndex: _this.index, 2210 isKeySorting: isKeySorting, 2211 nodes: nodes 2212 }, event); 2213 } 2214 2215 _this.touched = false; 2216 }); 2217 2218 (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_9__["default"])((0,_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_8__["default"])((0,_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_8__["default"])(_this)), "autoscroll", function () { 2219 var disableAutoscroll = _this.props.disableAutoscroll; 2220 var isKeySorting = _this.manager.isKeySorting; 2221 2222 if (disableAutoscroll) { 2223 _this.autoScroller.clear(); 2224 2225 return; 2226 } 2227 2228 if (isKeySorting) { 2229 var translate = (0,_babel_runtime_helpers_esm_objectSpread__WEBPACK_IMPORTED_MODULE_2__["default"])({}, _this.translate); 2230 2231 var scrollX = 0; 2232 var scrollY = 0; 2233 2234 if (_this.axis.x) { 2235 translate.x = Math.min(_this.maxTranslate.x, Math.max(_this.minTranslate.x, _this.translate.x)); 2236 scrollX = _this.translate.x - translate.x; 2237 } 2238 2239 if (_this.axis.y) { 2240 translate.y = Math.min(_this.maxTranslate.y, Math.max(_this.minTranslate.y, _this.translate.y)); 2241 scrollY = _this.translate.y - translate.y; 2242 } 2243 2244 _this.translate = translate; 2245 setTranslate3d(_this.helper, _this.translate); 2246 _this.scrollContainer.scrollLeft += scrollX; 2247 _this.scrollContainer.scrollTop += scrollY; 2248 return; 2249 } 2250 2251 _this.autoScroller.update({ 2252 height: _this.height, 2253 maxTranslate: _this.maxTranslate, 2254 minTranslate: _this.minTranslate, 2255 translate: _this.translate, 2256 width: _this.width 2257 }); 2258 }); 2259 2260 (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_9__["default"])((0,_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_8__["default"])((0,_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_8__["default"])(_this)), "onAutoScroll", function (offset) { 2261 _this.translate.x += offset.left; 2262 _this.translate.y += offset.top; 2263 2264 _this.animateNodes(); 2265 }); 2266 2267 (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_9__["default"])((0,_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_8__["default"])((0,_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_8__["default"])(_this)), "handleKeyDown", function (event) { 2268 var keyCode = event.keyCode; 2269 var _this$props5 = _this.props, 2270 shouldCancelStart = _this$props5.shouldCancelStart, 2271 _this$props5$keyCodes = _this$props5.keyCodes, 2272 customKeyCodes = _this$props5$keyCodes === void 0 ? {} : _this$props5$keyCodes; 2273 2274 var keyCodes = (0,_babel_runtime_helpers_esm_objectSpread__WEBPACK_IMPORTED_MODULE_2__["default"])({}, defaultKeyCodes, customKeyCodes); 2275 2276 if (_this.manager.active && !_this.manager.isKeySorting || !_this.manager.active && (!keyCodes.lift.includes(keyCode) || shouldCancelStart(event) || !_this.isValidSortingTarget(event))) { 2277 return; 2278 } 2279 2280 event.stopPropagation(); 2281 event.preventDefault(); 2282 2283 if (keyCodes.lift.includes(keyCode) && !_this.manager.active) { 2284 _this.keyLift(event); 2285 } else if (keyCodes.drop.includes(keyCode) && _this.manager.active) { 2286 _this.keyDrop(event); 2287 } else if (keyCodes.cancel.includes(keyCode)) { 2288 _this.newIndex = _this.manager.active.index; 2289 2290 _this.keyDrop(event); 2291 } else if (keyCodes.up.includes(keyCode)) { 2292 _this.keyMove(-1); 2293 } else if (keyCodes.down.includes(keyCode)) { 2294 _this.keyMove(1); 2295 } 2296 }); 2297 2298 (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_9__["default"])((0,_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_8__["default"])((0,_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_8__["default"])(_this)), "keyLift", function (event) { 2299 var target = event.target; 2300 var node = closest(target, function (el) { 2301 return el.sortableInfo != null; 2302 }); 2303 var _node$sortableInfo2 = node.sortableInfo, 2304 index = _node$sortableInfo2.index, 2305 collection = _node$sortableInfo2.collection; 2306 _this.initialFocusedNode = target; 2307 _this.manager.isKeySorting = true; 2308 _this.manager.active = { 2309 index: index, 2310 collection: collection 2311 }; 2312 2313 _this.handlePress(event); 2314 }); 2315 2316 (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_9__["default"])((0,_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_8__["default"])((0,_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_8__["default"])(_this)), "keyMove", function (shift) { 2317 var nodes = _this.manager.getOrderedRefs(); 2318 2319 var lastIndex = nodes[nodes.length - 1].node.sortableInfo.index; 2320 var newIndex = _this.newIndex + shift; 2321 var prevIndex = _this.newIndex; 2322 2323 if (newIndex < 0 || newIndex > lastIndex) { 2324 return; 2325 } 2326 2327 _this.prevIndex = prevIndex; 2328 _this.newIndex = newIndex; 2329 var targetIndex = getTargetIndex(_this.newIndex, _this.prevIndex, _this.index); 2330 var target = nodes.find(function (_ref2) { 2331 var node = _ref2.node; 2332 return node.sortableInfo.index === targetIndex; 2333 }); 2334 var targetNode = target.node; 2335 var scrollDelta = _this.containerScrollDelta; 2336 var targetBoundingClientRect = target.boundingClientRect || getScrollAdjustedBoundingClientRect(targetNode, scrollDelta); 2337 var targetTranslate = target.translate || { 2338 x: 0, 2339 y: 0 2340 }; 2341 var targetPosition = { 2342 top: targetBoundingClientRect.top + targetTranslate.y - scrollDelta.top, 2343 left: targetBoundingClientRect.left + targetTranslate.x - scrollDelta.left 2344 }; 2345 var shouldAdjustForSize = prevIndex < newIndex; 2346 var sizeAdjustment = { 2347 x: shouldAdjustForSize && _this.axis.x ? targetNode.offsetWidth - _this.width : 0, 2348 y: shouldAdjustForSize && _this.axis.y ? targetNode.offsetHeight - _this.height : 0 2349 }; 2350 2351 _this.handleSortMove({ 2352 pageX: targetPosition.left + sizeAdjustment.x, 2353 pageY: targetPosition.top + sizeAdjustment.y, 2354 ignoreTransition: shift === 0 2355 }); 2356 }); 2357 2358 (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_9__["default"])((0,_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_8__["default"])((0,_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_8__["default"])(_this)), "keyDrop", function (event) { 2359 _this.handleSortEnd(event); 2360 2361 if (_this.initialFocusedNode) { 2362 _this.initialFocusedNode.focus(); 2363 } 2364 }); 2365 2366 (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_9__["default"])((0,_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_8__["default"])((0,_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_8__["default"])(_this)), "handleKeyEnd", function (event) { 2367 if (_this.manager.active) { 2368 _this.keyDrop(event); 2369 } 2370 }); 2371 2372 (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_9__["default"])((0,_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_8__["default"])((0,_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_8__["default"])(_this)), "isValidSortingTarget", function (event) { 2373 var useDragHandle = _this.props.useDragHandle; 2374 var target = event.target; 2375 var node = closest(target, function (el) { 2376 return el.sortableInfo != null; 2377 }); 2378 return node && node.sortableInfo && !node.sortableInfo.disabled && (useDragHandle ? isSortableHandle(target) : target.sortableInfo); 2379 }); 2380 2381 var manager = new Manager(); 2382 validateProps(props); 2383 _this.manager = manager; 2384 _this.wrappedInstance = (0,react__WEBPACK_IMPORTED_MODULE_10__.createRef)(); 2385 _this.sortableContextValue = { 2386 manager: manager 2387 }; 2388 _this.events = { 2389 end: _this.handleEnd, 2390 move: _this.handleMove, 2391 start: _this.handleStart 2392 }; 2393 return _this; 2394 } 2395 2396 (0,_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_4__["default"])(WithSortableContainer, [{ 2397 key: "componentDidMount", 2398 value: function componentDidMount() { 2399 var _this2 = this; 2400 2401 var useWindowAsScrollContainer = this.props.useWindowAsScrollContainer; 2402 var container = this.getContainer(); 2403 Promise.resolve(container).then(function (containerNode) { 2404 _this2.container = containerNode; 2405 _this2.document = _this2.container.ownerDocument || document; 2406 var contentWindow = _this2.props.contentWindow || _this2.document.defaultView || window; 2407 _this2.contentWindow = typeof contentWindow === 'function' ? contentWindow() : contentWindow; 2408 _this2.scrollContainer = useWindowAsScrollContainer ? _this2.document.scrollingElement || _this2.document.documentElement : getScrollingParent(_this2.container) || _this2.container; 2409 _this2.autoScroller = new AutoScroller(_this2.scrollContainer, _this2.onAutoScroll); 2410 Object.keys(_this2.events).forEach(function (key) { 2411 return events[key].forEach(function (eventName) { 2412 return _this2.container.addEventListener(eventName, _this2.events[key], false); 2413 }); 2414 }); 2415 2416 _this2.container.addEventListener('keydown', _this2.handleKeyDown); 2417 }); 2418 } 2419 }, { 2420 key: "componentWillUnmount", 2421 value: function componentWillUnmount() { 2422 var _this3 = this; 2423 2424 if (this.helper && this.helper.parentNode) { 2425 this.helper.parentNode.removeChild(this.helper); 2426 } 2427 2428 if (!this.container) { 2429 return; 2430 } 2431 2432 Object.keys(this.events).forEach(function (key) { 2433 return events[key].forEach(function (eventName) { 2434 return _this3.container.removeEventListener(eventName, _this3.events[key]); 2435 }); 2436 }); 2437 this.container.removeEventListener('keydown', this.handleKeyDown); 2438 } 2439 }, { 2440 key: "updateHelperPosition", 2441 value: function updateHelperPosition(event) { 2442 var _this$props6 = this.props, 2443 lockAxis = _this$props6.lockAxis, 2444 lockOffset = _this$props6.lockOffset, 2445 lockToContainerEdges = _this$props6.lockToContainerEdges, 2446 transitionDuration = _this$props6.transitionDuration, 2447 _this$props6$keyboard = _this$props6.keyboardSortingTransitionDuration, 2448 keyboardSortingTransitionDuration = _this$props6$keyboard === void 0 ? transitionDuration : _this$props6$keyboard; 2449 var isKeySorting = this.manager.isKeySorting; 2450 var ignoreTransition = event.ignoreTransition; 2451 var offset = getPosition(event); 2452 var translate = { 2453 x: offset.x - this.initialOffset.x, 2454 y: offset.y - this.initialOffset.y 2455 }; 2456 translate.y -= window.pageYOffset - this.initialWindowScroll.top; 2457 translate.x -= window.pageXOffset - this.initialWindowScroll.left; 2458 this.translate = translate; 2459 2460 if (lockToContainerEdges) { 2461 var _getLockPixelOffsets = getLockPixelOffsets({ 2462 height: this.height, 2463 lockOffset: lockOffset, 2464 width: this.width 2465 }), 2466 _getLockPixelOffsets2 = (0,_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_1__["default"])(_getLockPixelOffsets, 2), 2467 minLockOffset = _getLockPixelOffsets2[0], 2468 maxLockOffset = _getLockPixelOffsets2[1]; 2469 2470 var minOffset = { 2471 x: this.width / 2 - minLockOffset.x, 2472 y: this.height / 2 - minLockOffset.y 2473 }; 2474 var maxOffset = { 2475 x: this.width / 2 - maxLockOffset.x, 2476 y: this.height / 2 - maxLockOffset.y 2477 }; 2478 translate.x = limit(this.minTranslate.x + minOffset.x, this.maxTranslate.x - maxOffset.x, translate.x); 2479 translate.y = limit(this.minTranslate.y + minOffset.y, this.maxTranslate.y - maxOffset.y, translate.y); 2480 } 2481 2482 if (lockAxis === 'x') { 2483 translate.y = 0; 2484 } else if (lockAxis === 'y') { 2485 translate.x = 0; 2486 } 2487 2488 if (isKeySorting && keyboardSortingTransitionDuration && !ignoreTransition) { 2489 setTransitionDuration(this.helper, keyboardSortingTransitionDuration); 2490 } 2491 2492 setTranslate3d(this.helper, translate); 2493 } 2494 }, { 2495 key: "animateNodes", 2496 value: function animateNodes() { 2497 var _this$props7 = this.props, 2498 transitionDuration = _this$props7.transitionDuration, 2499 hideSortableGhost = _this$props7.hideSortableGhost, 2500 onSortOver = _this$props7.onSortOver; 2501 var containerScrollDelta = this.containerScrollDelta, 2502 windowScrollDelta = this.windowScrollDelta; 2503 var nodes = this.manager.getOrderedRefs(); 2504 var sortingOffset = { 2505 left: this.offsetEdge.left + this.translate.x + containerScrollDelta.left, 2506 top: this.offsetEdge.top + this.translate.y + containerScrollDelta.top 2507 }; 2508 var isKeySorting = this.manager.isKeySorting; 2509 var prevIndex = this.newIndex; 2510 this.newIndex = null; 2511 2512 for (var i = 0, len = nodes.length; i < len; i++) { 2513 var _node3 = nodes[i].node; 2514 var index = _node3.sortableInfo.index; 2515 var width = _node3.offsetWidth; 2516 var height = _node3.offsetHeight; 2517 var offset = { 2518 height: this.height > height ? height / 2 : this.height / 2, 2519 width: this.width > width ? width / 2 : this.width / 2 2520 }; 2521 var mustShiftBackward = isKeySorting && index > this.index && index <= prevIndex; 2522 var mustShiftForward = isKeySorting && index < this.index && index >= prevIndex; 2523 var translate = { 2524 x: 0, 2525 y: 0 2526 }; 2527 var edgeOffset = nodes[i].edgeOffset; 2528 2529 if (!edgeOffset) { 2530 edgeOffset = getEdgeOffset(_node3, this.container); 2531 nodes[i].edgeOffset = edgeOffset; 2532 2533 if (isKeySorting) { 2534 nodes[i].boundingClientRect = getScrollAdjustedBoundingClientRect(_node3, containerScrollDelta); 2535 } 2536 } 2537 2538 var nextNode = i < nodes.length - 1 && nodes[i + 1]; 2539 var prevNode = i > 0 && nodes[i - 1]; 2540 2541 if (nextNode && !nextNode.edgeOffset) { 2542 nextNode.edgeOffset = getEdgeOffset(nextNode.node, this.container); 2543 2544 if (isKeySorting) { 2545 nextNode.boundingClientRect = getScrollAdjustedBoundingClientRect(nextNode.node, containerScrollDelta); 2546 } 2547 } 2548 2549 if (index === this.index) { 2550 if (hideSortableGhost) { 2551 this.sortableGhost = _node3; 2552 setInlineStyles(_node3, { 2553 opacity: 0, 2554 visibility: 'hidden' 2555 }); 2556 } 2557 2558 continue; 2559 } 2560 2561 if (transitionDuration) { 2562 setTransitionDuration(_node3, transitionDuration); 2563 } 2564 2565 if (this.axis.x) { 2566 if (this.axis.y) { 2567 if (mustShiftForward || index < this.index && (sortingOffset.left + windowScrollDelta.left - offset.width <= edgeOffset.left && sortingOffset.top + windowScrollDelta.top <= edgeOffset.top + offset.height || sortingOffset.top + windowScrollDelta.top + offset.height <= edgeOffset.top)) { 2568 translate.x = this.width + this.marginOffset.x; 2569 2570 if (edgeOffset.left + translate.x > this.containerBoundingRect.width - offset.width) { 2571 if (nextNode) { 2572 translate.x = nextNode.edgeOffset.left - edgeOffset.left; 2573 translate.y = nextNode.edgeOffset.top - edgeOffset.top; 2574 } 2575 } 2576 2577 if (this.newIndex === null) { 2578 this.newIndex = index; 2579 } 2580 } else if (mustShiftBackward || index > this.index && (sortingOffset.left + windowScrollDelta.left + offset.width >= edgeOffset.left && sortingOffset.top + windowScrollDelta.top + offset.height >= edgeOffset.top || sortingOffset.top + windowScrollDelta.top + offset.height >= edgeOffset.top + height)) { 2581 translate.x = -(this.width + this.marginOffset.x); 2582 2583 if (edgeOffset.left + translate.x < this.containerBoundingRect.left + offset.width) { 2584 if (prevNode) { 2585 translate.x = prevNode.edgeOffset.left - edgeOffset.left; 2586 translate.y = prevNode.edgeOffset.top - edgeOffset.top; 2587 } 2588 } 2589 2590 this.newIndex = index; 2591 } 2592 } else { 2593 if (mustShiftBackward || index > this.index && sortingOffset.left + windowScrollDelta.left + offset.width >= edgeOffset.left) { 2594 translate.x = -(this.width + this.marginOffset.x); 2595 this.newIndex = index; 2596 } else if (mustShiftForward || index < this.index && sortingOffset.left + windowScrollDelta.left <= edgeOffset.left + offset.width) { 2597 translate.x = this.width + this.marginOffset.x; 2598 2599 if (this.newIndex == null) { 2600 this.newIndex = index; 2601 } 2602 } 2603 } 2604 } else if (this.axis.y) { 2605 if (mustShiftBackward || index > this.index && sortingOffset.top + windowScrollDelta.top + offset.height >= edgeOffset.top) { 2606 translate.y = -(this.height + this.marginOffset.y); 2607 this.newIndex = index; 2608 } else if (mustShiftForward || index < this.index && sortingOffset.top + windowScrollDelta.top <= edgeOffset.top + offset.height) { 2609 translate.y = this.height + this.marginOffset.y; 2610 2611 if (this.newIndex == null) { 2612 this.newIndex = index; 2613 } 2614 } 2615 } 2616 2617 setTranslate3d(_node3, translate); 2618 nodes[i].translate = translate; 2619 } 2620 2621 if (this.newIndex == null) { 2622 this.newIndex = this.index; 2623 } 2624 2625 if (isKeySorting) { 2626 this.newIndex = prevIndex; 2627 } 2628 2629 var oldIndex = isKeySorting ? this.prevIndex : prevIndex; 2630 2631 if (onSortOver && this.newIndex !== oldIndex) { 2632 onSortOver({ 2633 collection: this.manager.active.collection, 2634 index: this.index, 2635 newIndex: this.newIndex, 2636 oldIndex: oldIndex, 2637 isKeySorting: isKeySorting, 2638 nodes: nodes, 2639 helper: this.helper 2640 }); 2641 } 2642 } 2643 }, { 2644 key: "getWrappedInstance", 2645 value: function getWrappedInstance() { 2646 invariant__WEBPACK_IMPORTED_MODULE_12___default()(config.withRef, 'To access the wrapped instance, you need to pass in {withRef: true} as the second argument of the SortableContainer() call'); 2647 return this.wrappedInstance.current; 2648 } 2649 }, { 2650 key: "getContainer", 2651 value: function getContainer() { 2652 var getContainer = this.props.getContainer; 2653 2654 if (typeof getContainer !== 'function') { 2655 return (0,react_dom__WEBPACK_IMPORTED_MODULE_11__.findDOMNode)(this); 2656 } 2657 2658 return getContainer(config.withRef ? this.getWrappedInstance() : undefined); 2659 } 2660 }, { 2661 key: "render", 2662 value: function render() { 2663 var ref = config.withRef ? this.wrappedInstance : null; 2664 return (0,react__WEBPACK_IMPORTED_MODULE_10__.createElement)(SortableContext.Provider, { 2665 value: this.sortableContextValue 2666 }, (0,react__WEBPACK_IMPORTED_MODULE_10__.createElement)(WrappedComponent, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({ 2667 ref: ref 2668 }, omit(this.props, omittedProps)))); 2669 } 2670 }, { 2671 key: "helperContainer", 2672 get: function get() { 2673 var helperContainer = this.props.helperContainer; 2674 2675 if (typeof helperContainer === 'function') { 2676 return helperContainer(); 2677 } 2678 2679 return this.props.helperContainer || this.document.body; 2680 } 2681 }, { 2682 key: "containerScrollDelta", 2683 get: function get() { 2684 var useWindowAsScrollContainer = this.props.useWindowAsScrollContainer; 2685 2686 if (useWindowAsScrollContainer) { 2687 return { 2688 left: 0, 2689 top: 0 2690 }; 2691 } 2692 2693 return { 2694 left: this.scrollContainer.scrollLeft - this.initialScroll.left, 2695 top: this.scrollContainer.scrollTop - this.initialScroll.top 2696 }; 2697 } 2698 }, { 2699 key: "windowScrollDelta", 2700 get: function get() { 2701 return { 2702 left: this.contentWindow.pageXOffset - this.initialWindowScroll.left, 2703 top: this.contentWindow.pageYOffset - this.initialWindowScroll.top 2704 }; 2705 } 2706 }]); 2707 2708 return WithSortableContainer; 2709 }(react__WEBPACK_IMPORTED_MODULE_10__.Component), (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_9__["default"])(_class, "displayName", provideDisplayName('sortableList', WrappedComponent)), (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_9__["default"])(_class, "defaultProps", defaultProps), (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_9__["default"])(_class, "propTypes", propTypes), _temp; 2710 } 2711 2712 var propTypes$1 = { 2713 index: (prop_types__WEBPACK_IMPORTED_MODULE_14___default().number.isRequired), 2714 collection: prop_types__WEBPACK_IMPORTED_MODULE_14___default().oneOfType([(prop_types__WEBPACK_IMPORTED_MODULE_14___default().number), (prop_types__WEBPACK_IMPORTED_MODULE_14___default().string)]), 2715 disabled: (prop_types__WEBPACK_IMPORTED_MODULE_14___default().bool) 2716 }; 2717 var omittedProps$1 = Object.keys(propTypes$1); 2718 function sortableElement(WrappedComponent) { 2719 var _class, _temp; 2720 2721 var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { 2722 withRef: false 2723 }; 2724 return _temp = _class = function (_React$Component) { 2725 (0,_babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_7__["default"])(WithSortableElement, _React$Component); 2726 2727 function WithSortableElement() { 2728 var _getPrototypeOf2; 2729 2730 var _this; 2731 2732 (0,_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_3__["default"])(this, WithSortableElement); 2733 2734 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 2735 args[_key] = arguments[_key]; 2736 } 2737 2738 _this = (0,_babel_runtime_helpers_esm_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_5__["default"])(this, (_getPrototypeOf2 = (0,_babel_runtime_helpers_esm_getPrototypeOf__WEBPACK_IMPORTED_MODULE_6__["default"])(WithSortableElement)).call.apply(_getPrototypeOf2, [this].concat(args))); 2739 2740 (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_9__["default"])((0,_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_8__["default"])((0,_babel_runtime_helpers_esm_assertThisInitialized__WEBPACK_IMPORTED_MODULE_8__["default"])(_this)), "wrappedInstance", (0,react__WEBPACK_IMPORTED_MODULE_10__.createRef)()); 2741 2742 return _this; 2743 } 2744 2745 (0,_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_4__["default"])(WithSortableElement, [{ 2746 key: "componentDidMount", 2747 value: function componentDidMount() { 2748 this.register(); 2749 } 2750 }, { 2751 key: "componentDidUpdate", 2752 value: function componentDidUpdate(prevProps) { 2753 if (this.node) { 2754 if (prevProps.index !== this.props.index) { 2755 this.node.sortableInfo.index = this.props.index; 2756 } 2757 2758 if (prevProps.disabled !== this.props.disabled) { 2759 this.node.sortableInfo.disabled = this.props.disabled; 2760 } 2761 } 2762 2763 if (prevProps.collection !== this.props.collection) { 2764 this.unregister(prevProps.collection); 2765 this.register(); 2766 } 2767 } 2768 }, { 2769 key: "componentWillUnmount", 2770 value: function componentWillUnmount() { 2771 this.unregister(); 2772 } 2773 }, { 2774 key: "register", 2775 value: function register() { 2776 var _this$props = this.props, 2777 collection = _this$props.collection, 2778 disabled = _this$props.disabled, 2779 index = _this$props.index; 2780 var node = (0,react_dom__WEBPACK_IMPORTED_MODULE_11__.findDOMNode)(this); 2781 node.sortableInfo = { 2782 collection: collection, 2783 disabled: disabled, 2784 index: index, 2785 manager: this.context.manager 2786 }; 2787 this.node = node; 2788 this.ref = { 2789 node: node 2790 }; 2791 this.context.manager.add(collection, this.ref); 2792 } 2793 }, { 2794 key: "unregister", 2795 value: function unregister() { 2796 var collection = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props.collection; 2797 this.context.manager.remove(collection, this.ref); 2798 } 2799 }, { 2800 key: "getWrappedInstance", 2801 value: function getWrappedInstance() { 2802 invariant__WEBPACK_IMPORTED_MODULE_12___default()(config.withRef, 'To access the wrapped instance, you need to pass in {withRef: true} as the second argument of the SortableElement() call'); 2803 return this.wrappedInstance.current; 2804 } 2805 }, { 2806 key: "render", 2807 value: function render() { 2808 var ref = config.withRef ? this.wrappedInstance : null; 2809 return (0,react__WEBPACK_IMPORTED_MODULE_10__.createElement)(WrappedComponent, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({ 2810 ref: ref 2811 }, omit(this.props, omittedProps$1))); 2812 } 2813 }]); 2814 2815 return WithSortableElement; 2816 }(react__WEBPACK_IMPORTED_MODULE_10__.Component), (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_9__["default"])(_class, "displayName", provideDisplayName('sortableElement', WrappedComponent)), (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_9__["default"])(_class, "contextType", SortableContext), (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_9__["default"])(_class, "propTypes", propTypes$1), (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_9__["default"])(_class, "defaultProps", { 2817 collection: 0 2818 }), _temp; 2819 } 2820 2821 2822 2823 2824 /***/ }), 2825 2826 /***/ "react": 2827 /*!************************!*\ 2828 !*** external "React" ***! 2829 \************************/ 2830 /***/ (function(module) { 2831 2832 "use strict"; 2833 module.exports = window["React"]; 2834 2835 /***/ }), 2836 2837 /***/ "react-dom": 2838 /*!***************************!*\ 2839 !*** external "ReactDOM" ***! 2840 \***************************/ 2841 /***/ (function(module) { 2842 2843 "use strict"; 2844 module.exports = window["ReactDOM"]; 2845 2846 /***/ }), 2847 2848 /***/ "@wordpress/block-editor": 2849 /*!*************************************!*\ 2850 !*** external ["wp","blockEditor"] ***! 2851 \*************************************/ 2852 /***/ (function(module) { 2853 2854 "use strict"; 2855 module.exports = window["wp"]["blockEditor"]; 2856 2857 /***/ }), 2858 2859 /***/ "@wordpress/components": 2860 /*!************************************!*\ 2861 !*** external ["wp","components"] ***! 2862 \************************************/ 2863 /***/ (function(module) { 2864 2865 "use strict"; 2866 module.exports = window["wp"]["components"]; 2867 2868 /***/ }), 2869 2870 /***/ "@wordpress/element": 2871 /*!*********************************!*\ 2872 !*** external ["wp","element"] ***! 2873 \*********************************/ 2874 /***/ (function(module) { 2875 2876 "use strict"; 2877 module.exports = window["wp"]["element"]; 2878 2879 /***/ }), 2880 2881 /***/ "./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js": 2882 /*!*********************************************************************!*\ 2883 !*** ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js ***! 2884 \*********************************************************************/ 2885 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 2886 2887 "use strict"; 2888 __webpack_require__.r(__webpack_exports__); 2889 /* harmony export */ __webpack_require__.d(__webpack_exports__, { 2890 /* harmony export */ "default": function() { return /* binding */ _arrayLikeToArray; } 2891 /* harmony export */ }); 2892 function _arrayLikeToArray(arr, len) { 2893 if (len == null || len > arr.length) len = arr.length; 2894 2895 for (var i = 0, arr2 = new Array(len); i < len; i++) { 2896 arr2[i] = arr[i]; 2897 } 2898 2899 return arr2; 2900 } 2901 2902 /***/ }), 2903 2904 /***/ "./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js": 2905 /*!*******************************************************************!*\ 2906 !*** ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js ***! 2907 \*******************************************************************/ 2908 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 2909 2910 "use strict"; 2911 __webpack_require__.r(__webpack_exports__); 2912 /* harmony export */ __webpack_require__.d(__webpack_exports__, { 2913 /* harmony export */ "default": function() { return /* binding */ _arrayWithHoles; } 2914 /* harmony export */ }); 2915 function _arrayWithHoles(arr) { 2916 if (Array.isArray(arr)) return arr; 2917 } 2918 2919 /***/ }), 2920 2921 /***/ "./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js": 2922 /*!**********************************************************************!*\ 2923 !*** ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js ***! 2924 \**********************************************************************/ 2925 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 2926 2927 "use strict"; 2928 __webpack_require__.r(__webpack_exports__); 2929 /* harmony export */ __webpack_require__.d(__webpack_exports__, { 2930 /* harmony export */ "default": function() { return /* binding */ _arrayWithoutHoles; } 2931 /* harmony export */ }); 2932 /* harmony import */ var _arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./arrayLikeToArray.js */ "./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js"); 2933 2934 function _arrayWithoutHoles(arr) { 2935 if (Array.isArray(arr)) return (0,_arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__["default"])(arr); 2936 } 2937 2938 /***/ }), 2939 2940 /***/ "./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js": 2941 /*!**************************************************************************!*\ 2942 !*** ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js ***! 2943 \**************************************************************************/ 2944 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 2945 2946 "use strict"; 2947 __webpack_require__.r(__webpack_exports__); 2948 /* harmony export */ __webpack_require__.d(__webpack_exports__, { 2949 /* harmony export */ "default": function() { return /* binding */ _assertThisInitialized; } 2950 /* harmony export */ }); 2951 function _assertThisInitialized(self) { 2952 if (self === void 0) { 2953 throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 2954 } 2955 2956 return self; 2957 } 2958 2959 /***/ }), 2960 2961 /***/ "./node_modules/@babel/runtime/helpers/esm/classCallCheck.js": 2962 /*!*******************************************************************!*\ 2963 !*** ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js ***! 2964 \*******************************************************************/ 2965 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 2966 2967 "use strict"; 2968 __webpack_require__.r(__webpack_exports__); 2969 /* harmony export */ __webpack_require__.d(__webpack_exports__, { 2970 /* harmony export */ "default": function() { return /* binding */ _classCallCheck; } 2971 /* harmony export */ }); 2972 function _classCallCheck(instance, Constructor) { 2973 if (!(instance instanceof Constructor)) { 2974 throw new TypeError("Cannot call a class as a function"); 2975 } 2976 } 2977 2978 /***/ }), 2979 2980 /***/ "./node_modules/@babel/runtime/helpers/esm/createClass.js": 2981 /*!****************************************************************!*\ 2982 !*** ./node_modules/@babel/runtime/helpers/esm/createClass.js ***! 2983 \****************************************************************/ 2984 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 2985 2986 "use strict"; 2987 __webpack_require__.r(__webpack_exports__); 2988 /* harmony export */ __webpack_require__.d(__webpack_exports__, { 2989 /* harmony export */ "default": function() { return /* binding */ _createClass; } 2990 /* harmony export */ }); 2991 function _defineProperties(target, props) { 2992 for (var i = 0; i < props.length; i++) { 2993 var descriptor = props[i]; 2994 descriptor.enumerable = descriptor.enumerable || false; 2995 descriptor.configurable = true; 2996 if ("value" in descriptor) descriptor.writable = true; 2997 Object.defineProperty(target, descriptor.key, descriptor); 2998 } 2999 } 3000 3001 function _createClass(Constructor, protoProps, staticProps) { 3002 if (protoProps) _defineProperties(Constructor.prototype, protoProps); 3003 if (staticProps) _defineProperties(Constructor, staticProps); 3004 Object.defineProperty(Constructor, "prototype", { 3005 writable: false 3006 }); 3007 return Constructor; 3008 } 3009 3010 /***/ }), 3011 3012 /***/ "./node_modules/@babel/runtime/helpers/esm/defineProperty.js": 3013 /*!*******************************************************************!*\ 3014 !*** ./node_modules/@babel/runtime/helpers/esm/defineProperty.js ***! 3015 \*******************************************************************/ 3016 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 3017 3018 "use strict"; 3019 __webpack_require__.r(__webpack_exports__); 3020 /* harmony export */ __webpack_require__.d(__webpack_exports__, { 3021 /* harmony export */ "default": function() { return /* binding */ _defineProperty; } 3022 /* harmony export */ }); 3023 function _defineProperty(obj, key, value) { 3024 if (key in obj) { 3025 Object.defineProperty(obj, key, { 3026 value: value, 3027 enumerable: true, 3028 configurable: true, 3029 writable: true 3030 }); 3031 } else { 3032 obj[key] = value; 3033 } 3034 3035 return obj; 3036 } 3037 3038 /***/ }), 3039 3040 /***/ "./node_modules/@babel/runtime/helpers/esm/extends.js": 3041 /*!************************************************************!*\ 3042 !*** ./node_modules/@babel/runtime/helpers/esm/extends.js ***! 3043 \************************************************************/ 3044 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 3045 3046 "use strict"; 3047 __webpack_require__.r(__webpack_exports__); 3048 /* harmony export */ __webpack_require__.d(__webpack_exports__, { 3049 /* harmony export */ "default": function() { return /* binding */ _extends; } 3050 /* harmony export */ }); 3051 function _extends() { 3052 _extends = Object.assign || function (target) { 3053 for (var i = 1; i < arguments.length; i++) { 3054 var source = arguments[i]; 3055 3056 for (var key in source) { 3057 if (Object.prototype.hasOwnProperty.call(source, key)) { 3058 target[key] = source[key]; 3059 } 3060 } 3061 } 3062 3063 return target; 3064 }; 3065 3066 return _extends.apply(this, arguments); 3067 } 3068 3069 /***/ }), 3070 3071 /***/ "./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js": 3072 /*!*******************************************************************!*\ 3073 !*** ./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js ***! 3074 \*******************************************************************/ 3075 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 3076 3077 "use strict"; 3078 __webpack_require__.r(__webpack_exports__); 3079 /* harmony export */ __webpack_require__.d(__webpack_exports__, { 3080 /* harmony export */ "default": function() { return /* binding */ _getPrototypeOf; } 3081 /* harmony export */ }); 3082 function _getPrototypeOf(o) { 3083 _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { 3084 return o.__proto__ || Object.getPrototypeOf(o); 3085 }; 3086 return _getPrototypeOf(o); 3087 } 3088 3089 /***/ }), 3090 3091 /***/ "./node_modules/@babel/runtime/helpers/esm/inherits.js": 3092 /*!*************************************************************!*\ 3093 !*** ./node_modules/@babel/runtime/helpers/esm/inherits.js ***! 3094 \*************************************************************/ 3095 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 3096 3097 "use strict"; 3098 __webpack_require__.r(__webpack_exports__); 3099 /* harmony export */ __webpack_require__.d(__webpack_exports__, { 3100 /* harmony export */ "default": function() { return /* binding */ _inherits; } 3101 /* harmony export */ }); 3102 /* harmony import */ var _setPrototypeOf_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setPrototypeOf.js */ "./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js"); 3103 3104 function _inherits(subClass, superClass) { 3105 if (typeof superClass !== "function" && superClass !== null) { 3106 throw new TypeError("Super expression must either be null or a function"); 3107 } 3108 3109 subClass.prototype = Object.create(superClass && superClass.prototype, { 3110 constructor: { 3111 value: subClass, 3112 writable: true, 3113 configurable: true 3114 } 3115 }); 3116 Object.defineProperty(subClass, "prototype", { 3117 writable: false 3118 }); 3119 if (superClass) (0,_setPrototypeOf_js__WEBPACK_IMPORTED_MODULE_0__["default"])(subClass, superClass); 3120 } 3121 3122 /***/ }), 3123 3124 /***/ "./node_modules/@babel/runtime/helpers/esm/iterableToArray.js": 3125 /*!********************************************************************!*\ 3126 !*** ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js ***! 3127 \********************************************************************/ 3128 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 3129 3130 "use strict"; 3131 __webpack_require__.r(__webpack_exports__); 3132 /* harmony export */ __webpack_require__.d(__webpack_exports__, { 3133 /* harmony export */ "default": function() { return /* binding */ _iterableToArray; } 3134 /* harmony export */ }); 3135 function _iterableToArray(iter) { 3136 if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); 3137 } 3138 3139 /***/ }), 3140 3141 /***/ "./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js": 3142 /*!*************************************************************************!*\ 3143 !*** ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js ***! 3144 \*************************************************************************/ 3145 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 3146 3147 "use strict"; 3148 __webpack_require__.r(__webpack_exports__); 3149 /* harmony export */ __webpack_require__.d(__webpack_exports__, { 3150 /* harmony export */ "default": function() { return /* binding */ _iterableToArrayLimit; } 3151 /* harmony export */ }); 3152 function _iterableToArrayLimit(arr, i) { 3153 var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; 3154 3155 if (_i == null) return; 3156 var _arr = []; 3157 var _n = true; 3158 var _d = false; 3159 3160 var _s, _e; 3161 3162 try { 3163 for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { 3164 _arr.push(_s.value); 3165 3166 if (i && _arr.length === i) break; 3167 } 3168 } catch (err) { 3169 _d = true; 3170 _e = err; 3171 } finally { 3172 try { 3173 if (!_n && _i["return"] != null) _i["return"](); 3174 } finally { 3175 if (_d) throw _e; 3176 } 3177 } 3178 3179 return _arr; 3180 } 3181 3182 /***/ }), 3183 3184 /***/ "./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js": 3185 /*!********************************************************************!*\ 3186 !*** ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js ***! 3187 \********************************************************************/ 3188 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 3189 3190 "use strict"; 3191 __webpack_require__.r(__webpack_exports__); 3192 /* harmony export */ __webpack_require__.d(__webpack_exports__, { 3193 /* harmony export */ "default": function() { return /* binding */ _nonIterableRest; } 3194 /* harmony export */ }); 3195 function _nonIterableRest() { 3196 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 3197 } 3198 3199 /***/ }), 3200 3201 /***/ "./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js": 3202 /*!**********************************************************************!*\ 3203 !*** ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js ***! 3204 \**********************************************************************/ 3205 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 3206 3207 "use strict"; 3208 __webpack_require__.r(__webpack_exports__); 3209 /* harmony export */ __webpack_require__.d(__webpack_exports__, { 3210 /* harmony export */ "default": function() { return /* binding */ _nonIterableSpread; } 3211 /* harmony export */ }); 3212 function _nonIterableSpread() { 3213 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 3214 } 3215 3216 /***/ }), 3217 3218 /***/ "./node_modules/@babel/runtime/helpers/esm/objectSpread.js": 3219 /*!*****************************************************************!*\ 3220 !*** ./node_modules/@babel/runtime/helpers/esm/objectSpread.js ***! 3221 \*****************************************************************/ 3222 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 3223 3224 "use strict"; 3225 __webpack_require__.r(__webpack_exports__); 3226 /* harmony export */ __webpack_require__.d(__webpack_exports__, { 3227 /* harmony export */ "default": function() { return /* binding */ _objectSpread; } 3228 /* harmony export */ }); 3229 /* harmony import */ var _defineProperty_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./defineProperty.js */ "./node_modules/@babel/runtime/helpers/esm/defineProperty.js"); 3230 3231 function _objectSpread(target) { 3232 for (var i = 1; i < arguments.length; i++) { 3233 var source = arguments[i] != null ? Object(arguments[i]) : {}; 3234 var ownKeys = Object.keys(source); 3235 3236 if (typeof Object.getOwnPropertySymbols === 'function') { 3237 ownKeys.push.apply(ownKeys, Object.getOwnPropertySymbols(source).filter(function (sym) { 3238 return Object.getOwnPropertyDescriptor(source, sym).enumerable; 3239 })); 3240 } 3241 3242 ownKeys.forEach(function (key) { 3243 (0,_defineProperty_js__WEBPACK_IMPORTED_MODULE_0__["default"])(target, key, source[key]); 3244 }); 3245 } 3246 3247 return target; 3248 } 3249 3250 /***/ }), 3251 3252 /***/ "./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js": 3253 /*!******************************************************************************!*\ 3254 !*** ./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js ***! 3255 \******************************************************************************/ 3256 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 3257 3258 "use strict"; 3259 __webpack_require__.r(__webpack_exports__); 3260 /* harmony export */ __webpack_require__.d(__webpack_exports__, { 3261 /* harmony export */ "default": function() { return /* binding */ _possibleConstructorReturn; } 3262 /* harmony export */ }); 3263 /* harmony import */ var _typeof_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./typeof.js */ "./node_modules/@babel/runtime/helpers/esm/typeof.js"); 3264 /* harmony import */ var _assertThisInitialized_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./assertThisInitialized.js */ "./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js"); 3265 3266 3267 function _possibleConstructorReturn(self, call) { 3268 if (call && ((0,_typeof_js__WEBPACK_IMPORTED_MODULE_0__["default"])(call) === "object" || typeof call === "function")) { 3269 return call; 3270 } else if (call !== void 0) { 3271 throw new TypeError("Derived constructors may only return object or undefined"); 3272 } 3273 3274 return (0,_assertThisInitialized_js__WEBPACK_IMPORTED_MODULE_1__["default"])(self); 3275 } 3276 3277 /***/ }), 3278 3279 /***/ "./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js": 3280 /*!*******************************************************************!*\ 3281 !*** ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js ***! 3282 \*******************************************************************/ 3283 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 3284 3285 "use strict"; 3286 __webpack_require__.r(__webpack_exports__); 3287 /* harmony export */ __webpack_require__.d(__webpack_exports__, { 3288 /* harmony export */ "default": function() { return /* binding */ _setPrototypeOf; } 3289 /* harmony export */ }); 3290 function _setPrototypeOf(o, p) { 3291 _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { 3292 o.__proto__ = p; 3293 return o; 3294 }; 3295 3296 return _setPrototypeOf(o, p); 3297 } 3298 3299 /***/ }), 3300 3301 /***/ "./node_modules/@babel/runtime/helpers/esm/slicedToArray.js": 3302 /*!******************************************************************!*\ 3303 !*** ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js ***! 3304 \******************************************************************/ 3305 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 3306 3307 "use strict"; 3308 __webpack_require__.r(__webpack_exports__); 3309 /* harmony export */ __webpack_require__.d(__webpack_exports__, { 3310 /* harmony export */ "default": function() { return /* binding */ _slicedToArray; } 3311 /* harmony export */ }); 3312 /* harmony import */ var _arrayWithHoles_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./arrayWithHoles.js */ "./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js"); 3313 /* harmony import */ var _iterableToArrayLimit_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./iterableToArrayLimit.js */ "./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js"); 3314 /* harmony import */ var _unsupportedIterableToArray_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./unsupportedIterableToArray.js */ "./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js"); 3315 /* harmony import */ var _nonIterableRest_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./nonIterableRest.js */ "./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js"); 3316 3317 3318 3319 3320 function _slicedToArray(arr, i) { 3321 return (0,_arrayWithHoles_js__WEBPACK_IMPORTED_MODULE_0__["default"])(arr) || (0,_iterableToArrayLimit_js__WEBPACK_IMPORTED_MODULE_1__["default"])(arr, i) || (0,_unsupportedIterableToArray_js__WEBPACK_IMPORTED_MODULE_2__["default"])(arr, i) || (0,_nonIterableRest_js__WEBPACK_IMPORTED_MODULE_3__["default"])(); 3322 } 3323 3324 /***/ }), 3325 3326 /***/ "./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js": 3327 /*!**********************************************************************!*\ 3328 !*** ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js ***! 3329 \**********************************************************************/ 3330 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 3331 3332 "use strict"; 3333 __webpack_require__.r(__webpack_exports__); 3334 /* harmony export */ __webpack_require__.d(__webpack_exports__, { 3335 /* harmony export */ "default": function() { return /* binding */ _toConsumableArray; } 3336 /* harmony export */ }); 3337 /* harmony import */ var _arrayWithoutHoles_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./arrayWithoutHoles.js */ "./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js"); 3338 /* harmony import */ var _iterableToArray_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./iterableToArray.js */ "./node_modules/@babel/runtime/helpers/esm/iterableToArray.js"); 3339 /* harmony import */ var _unsupportedIterableToArray_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./unsupportedIterableToArray.js */ "./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js"); 3340 /* harmony import */ var _nonIterableSpread_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./nonIterableSpread.js */ "./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js"); 3341 3342 3343 3344 3345 function _toConsumableArray(arr) { 3346 return (0,_arrayWithoutHoles_js__WEBPACK_IMPORTED_MODULE_0__["default"])(arr) || (0,_iterableToArray_js__WEBPACK_IMPORTED_MODULE_1__["default"])(arr) || (0,_unsupportedIterableToArray_js__WEBPACK_IMPORTED_MODULE_2__["default"])(arr) || (0,_nonIterableSpread_js__WEBPACK_IMPORTED_MODULE_3__["default"])(); 3347 } 3348 3349 /***/ }), 3350 3351 /***/ "./node_modules/@babel/runtime/helpers/esm/typeof.js": 3352 /*!***********************************************************!*\ 3353 !*** ./node_modules/@babel/runtime/helpers/esm/typeof.js ***! 3354 \***********************************************************/ 3355 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 3356 3357 "use strict"; 3358 __webpack_require__.r(__webpack_exports__); 3359 /* harmony export */ __webpack_require__.d(__webpack_exports__, { 3360 /* harmony export */ "default": function() { return /* binding */ _typeof; } 3361 /* harmony export */ }); 3362 function _typeof(obj) { 3363 "@babel/helpers - typeof"; 3364 3365 return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { 3366 return typeof obj; 3367 } : function (obj) { 3368 return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; 3369 }, _typeof(obj); 3370 } 3371 3372 /***/ }), 3373 3374 /***/ "./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js": 3375 /*!*******************************************************************************!*\ 3376 !*** ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js ***! 3377 \*******************************************************************************/ 3378 /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { 3379 3380 "use strict"; 3381 __webpack_require__.r(__webpack_exports__); 3382 /* harmony export */ __webpack_require__.d(__webpack_exports__, { 3383 /* harmony export */ "default": function() { return /* binding */ _unsupportedIterableToArray; } 3384 /* harmony export */ }); 3385 /* harmony import */ var _arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./arrayLikeToArray.js */ "./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js"); 3386 3387 function _unsupportedIterableToArray(o, minLen) { 3388 if (!o) return; 3389 if (typeof o === "string") return (0,_arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__["default"])(o, minLen); 3390 var n = Object.prototype.toString.call(o).slice(8, -1); 3391 if (n === "Object" && o.constructor) n = o.constructor.name; 3392 if (n === "Map" || n === "Set") return Array.from(o); 3393 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return (0,_arrayLikeToArray_js__WEBPACK_IMPORTED_MODULE_0__["default"])(o, minLen); 3394 } 3395 3396 /***/ }) 3397 3398 /******/ }); 3399 /************************************************************************/ 3400 /******/ // The module cache 3401 /******/ var __webpack_module_cache__ = {}; 3402 /******/ 3403 /******/ // The require function 3404 /******/ function __webpack_require__(moduleId) { 3405 /******/ // Check if module is in cache 3406 /******/ var cachedModule = __webpack_module_cache__[moduleId]; 3407 /******/ if (cachedModule !== undefined) { 3408 /******/ return cachedModule.exports; 3409 /******/ } 3410 /******/ // Create a new module (and put it into the cache) 3411 /******/ var module = __webpack_module_cache__[moduleId] = { 3412 /******/ // no module.id needed 3413 /******/ // no module.loaded needed 3414 /******/ exports: {} 3415 /******/ }; 3416 /******/ 3417 /******/ // Execute the module function 3418 /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); 3419 /******/ 3420 /******/ // Return the exports of the module 3421 /******/ return module.exports; 3422 /******/ } 3423 /******/ 3424 /************************************************************************/ 3425 /******/ /* webpack/runtime/compat get default export */ 3426 /******/ !function() { 3427 /******/ // getDefaultExport function for compatibility with non-harmony modules 3428 /******/ __webpack_require__.n = function(module) { 3429 /******/ var getter = module && module.__esModule ? 3430 /******/ function() { return module['default']; } : 3431 /******/ function() { return module; }; 3432 /******/ __webpack_require__.d(getter, { a: getter }); 3433 /******/ return getter; 3434 /******/ }; 3435 /******/ }(); 3436 /******/ 3437 /******/ /* webpack/runtime/define property getters */ 3438 /******/ !function() { 3439 /******/ // define getter functions for harmony exports 3440 /******/ __webpack_require__.d = function(exports, definition) { 3441 /******/ for(var key in definition) { 3442 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 3443 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 3444 /******/ } 3445 /******/ } 3446 /******/ }; 3447 /******/ }(); 3448 /******/ 3449 /******/ /* webpack/runtime/hasOwnProperty shorthand */ 3450 /******/ !function() { 3451 /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } 3452 /******/ }(); 3453 /******/ 3454 /******/ /* webpack/runtime/make namespace object */ 3455 /******/ !function() { 3456 /******/ // define __esModule on exports 3457 /******/ __webpack_require__.r = function(exports) { 3458 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 3459 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 3460 /******/ } 3461 /******/ Object.defineProperty(exports, '__esModule', { value: true }); 3462 /******/ }; 3463 /******/ }(); 3464 /******/ 3465 /************************************************************************/ 3466 var __webpack_exports__ = {}; 3467 // This entry need to be wrapped in an IIFE because it need to be in strict mode. 3468 !function() { 3469 "use strict"; 3470 /*!**********************!*\ 3471 !*** ./src/block.js ***! 3472 \**********************/ 3473 __webpack_require__.r(__webpack_exports__); 3474 /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/esm/defineProperty.js"); 3475 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); 3476 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__); 3477 /* harmony import */ var _block_scss__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./block.scss */ "./src/block.scss"); 3478 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react */ "react"); 3479 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__); 3480 /* harmony import */ var react_sortable_hoc__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react-sortable-hoc */ "./node_modules/react-sortable-hoc/dist/react-sortable-hoc.esm.js"); 3481 /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components"); 3482 /* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_5__); 3483 /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor"); 3484 /* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_6__); 3485 3486 3487 3488 3489 3490 3491 3492 const __ = wp.i18n.__; 3493 wp.blocks.registerBlockType("bps-blocks/slider", { 3494 title: "Splide " + __("slider", "bps-slider-block"), 3495 icon: "images-alt", 3496 category: "common", 3497 attributes: { 3498 images: { 3499 type: "array", 3500 default: [{ 3501 id: "", 3502 front_url: "", 3503 block_url: "" 3504 }] 3505 } 3506 }, 3507 edit: function (props) { 3508 let items = props.attributes.images.map(value => value.id); 3509 const SortableItem = (0,react_sortable_hoc__WEBPACK_IMPORTED_MODULE_4__.SortableElement)(_ref => { 3510 let { 3511 value 3512 } = _ref; 3513 const imageObj = props.attributes.images.filter(image => image.id == value)[0]; 3514 const imageIndex = props.attributes.images.map(element => element.id).indexOf(imageObj.id); 3515 return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_5__.FlexItem, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)("div", { 3516 className: "slider-edit-block-element" 3517 }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_6__.MediaUpload, { 3518 type: "image", 3519 value: imageObj.id, 3520 onSelect: imageObj => { 3521 const newImages = props.attributes.images.concat([]); 3522 newImages[imageIndex].id = imageObj.id; 3523 newImages[imageIndex].front_url = imageObj.url; 3524 newImages[imageIndex].block_url = imageObj.sizes.thumbnail.url; 3525 props.setAttributes({ 3526 images: newImages 3527 }); 3528 }, 3529 render: obj => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)("div", null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_5__.Button, { 3530 onClick: obj.open, 3531 style: { 3532 display: "inline-block" 3533 } 3534 }, imageObj.id ? (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)("img", { 3535 src: imageObj.block_url, 3536 onClick: obj.open 3537 }) : __("Select image", "bps-slider-block"))) 3538 }), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_5__.Button, { 3539 isDestructive: true, 3540 onClick: () => { 3541 props.setAttributes({ 3542 images: props.attributes.images.filter((item, index) => imageIndex !== index) 3543 }); 3544 } 3545 }, __("Remove image", "bps-slider-block")))); 3546 }); 3547 const SortableList = (0,react_sortable_hoc__WEBPACK_IMPORTED_MODULE_4__.SortableContainer)(_ref2 => { 3548 let { 3549 items 3550 } = _ref2; 3551 return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)("ul", null, items.map((value, index) => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(SortableItem, { 3552 key: `item-${value}`, 3553 index: index, 3554 value: value 3555 }))); 3556 }); 3557 const SortableImagesList = (0,react_sortable_hoc__WEBPACK_IMPORTED_MODULE_4__.SortableContainer)(_ref3 => { 3558 let { 3559 items 3560 } = _ref3; 3561 return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)("div", { 3562 className: "slider-edit-block" 3563 }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)("h4", null, __("Slider images", "bps-slider-block"), ":"), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_5__.Flex, { 3564 justify: "flex-start", 3565 wrap: "true" 3566 }, items.map((value, index) => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(SortableItem, { 3567 key: `item-${value}`, 3568 index: index, 3569 value: value 3570 }))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_5__.Button, { 3571 isPrimary: true, 3572 onClick: () => { 3573 props.setAttributes({ 3574 images: props.attributes.images.concat([{}]) 3575 }); 3576 } 3577 }, __("Add image", "bps-slider-block"))); 3578 }); 3579 3580 class SortableComponent extends react__WEBPACK_IMPORTED_MODULE_3__.Component { 3581 constructor() { 3582 super(...arguments); 3583 3584 (0,_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(this, "state", { 3585 items: items 3586 }); 3587 3588 (0,_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(this, "onSortEnd", _ref4 => { 3589 let { 3590 oldIndex, 3591 newIndex 3592 } = _ref4; 3593 const new_items = (0,react_sortable_hoc__WEBPACK_IMPORTED_MODULE_4__.arrayMove)(items, oldIndex, newIndex); 3594 this.setState(_ref5 => { 3595 let { 3596 items 3597 } = _ref5; 3598 return { 3599 items: (0,react_sortable_hoc__WEBPACK_IMPORTED_MODULE_4__.arrayMove)(items, oldIndex, newIndex) 3600 }; 3601 }); 3602 const newImages = props.attributes.images.concat([]); 3603 newImages.sort(function (a, b) { 3604 return new_items.indexOf(a.id) - new_items.indexOf(b.id); 3605 }); 3606 props.setAttributes({ 3607 images: newImages 3608 }); 3609 }); 3610 } 3611 3612 render() { 3613 return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(SortableImagesList, { 3614 items: this.state.items, 3615 onSortEnd: this.onSortEnd, 3616 axis: "xy" 3617 }); 3618 } 3619 3620 } 3621 3622 return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(SortableComponent, null) // return ( 3623 // <div className="slider-edit-block"> 3624 // <h4>{__("Slider images", "bps-slider-block")}:</h4> 3625 // <Flex className="bps-image-elements ui-sortable" justify="flex-start" wrap="true"> 3626 // {props.attributes.images.map(function (imageObj, imageIndex) { 3627 // return ( 3628 // <FlexItem> 3629 // <div className="slider-edit-block-element ui-sortable-handle"> 3630 // <MediaUpload 3631 // type="image" 3632 // value={imageObj.id} 3633 // onSelect={(imageObj) => { 3634 // const newImages = props.attributes.images.concat([]); 3635 // newImages[imageIndex].id = imageObj.id; 3636 // newImages[imageIndex].front_url = imageObj.url; 3637 // newImages[imageIndex].block_url = imageObj.sizes.thumbnail.url; 3638 // props.setAttributes({ images: newImages }); 3639 // }} 3640 // render={(obj) => ( 3641 // <div> 3642 // <Button onClick={obj.open} style={{ display: "inline-block" }}> 3643 // {imageObj.id ? <img src={imageObj.block_url} /> : __("Select image", "bps-slider-block")} 3644 // </Button> 3645 // </div> 3646 // )} 3647 // /> 3648 // <Button 3649 // isDestructive 3650 // onClick={() => { 3651 // props.setAttributes({ images: props.attributes.images.filter((item, index) => imageIndex !== index) }); 3652 // }} 3653 // > 3654 // {__("Remove image", "bps-slider-block")} 3655 // </Button> 3656 // </div> 3657 // </FlexItem> 3658 // ); 3659 // })} 3660 // </Flex> 3661 // <Button 3662 // isPrimary 3663 // onClick={() => { 3664 // props.setAttributes({ images: props.attributes.images.concat([{}]) }); 3665 // }} 3666 // > 3667 // {__("Add image", "bps-slider-block")} 3668 // </Button> 3669 // </div> 3670 ; 3671 }, 3672 save: function (props) { 3673 return null; 3674 } 3675 }); 3676 }(); 3677 /******/ })() 3678 ; 3679 //# sourceMappingURL=block.js.map 1 !function(){var e={143:function(e){"use strict";e.exports=function(e,t,n,r,i,o,a,l){if(!e){var s;if(void 0===t)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,i,o,a,l],u=0;(s=new Error(t.replace(/%s/g,(function(){return c[u++]})))).name="Invariant Violation"}throw s.framesToPop=1,s}}},703:function(e,t,n){"use strict";var r=n(414);function i(){}function o(){}o.resetWarningCache=i,e.exports=function(){function e(e,t,n,i,o,a){if(a!==r){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:o,resetWarningCache:i};return n.PropTypes=n,n}},697:function(e,t,n){e.exports=n(703)()},414:function(e){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){"use strict";function e(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var t=window.wp.element,r=window.React;function i(){return i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i.apply(this,arguments)}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function a(e,t){if(e){if("string"==typeof e)return o(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o=[],_n=!0,a=!1;try{for(n=n.call(e);!(_n=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);_n=!0);}catch(e){a=!0,i=e}finally{try{_n||null==n.return||n.return()}finally{if(a)throw i}}return o}}(e,t)||a(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?Object(arguments[n]):{},i=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&i.push.apply(i,Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),i.forEach((function(n){e(t,n,r[n])}))}return t}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function d(e,t,n){return t&&u(e.prototype,t),n&&u(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function f(e){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f(e)}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e,t){if(t&&("object"===f(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return h(e)}function g(e){return g=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},g(e)}function y(e,t){return y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},y(e,t)}function m(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&y(e,t)}var v=window.ReactDOM,b=n(143),x=n.n(b);var w=n(697),S=n.n(w),O=function(){function t(){c(this,t),e(this,"refs",{})}return d(t,[{key:"add",value:function(e,t){this.refs[e]||(this.refs[e]=[]),this.refs[e].push(t)}},{key:"remove",value:function(e,t){var n=this.getIndex(e,t);-1!==n&&this.refs[e].splice(n,1)}},{key:"isActive",value:function(){return this.active}},{key:"getActive",value:function(){var e=this;return this.refs[this.active.collection].find((function(t){return t.node.sortableInfo.index==e.active.index}))}},{key:"getIndex",value:function(e,t){return this.refs[e].indexOf(t)}},{key:"getOrderedRefs",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.active.collection;return this.refs[e].sort(k)}}]),t}();function k(e,t){return e.node.sortableInfo.index-t.node.sortableInfo.index}function C(e,t,n){return(e=e.slice()).splice(n<0?e.length+n:n,0,e.splice(t,1)[0]),e}function E(e,t){return Object.keys(e).reduce((function(n,r){return-1===t.indexOf(r)&&(n[r]=e[r]),n}),{})}var T={end:["touchend","touchcancel","mouseup"],move:["touchmove","mousemove"],start:["touchstart","mousedown"]},I=function(){if("undefined"==typeof window||"undefined"==typeof document)return"";var e=window.getComputedStyle(document.documentElement,"")||["-moz-hidden-iframe"],t=(Array.prototype.slice.call(e).join("").match(/-(moz|webkit|ms)-/)||""===e.OLink&&["","o"])[1];return"ms"===t?"ms":t&&t.length?t[0].toUpperCase()+t.substr(1):""}();function R(e,t){Object.keys(t).forEach((function(n){e.style[n]=t[n]}))}function D(e,t){e.style["".concat(I,"Transform")]=null==t?"":"translate3d(".concat(t.x,"px,").concat(t.y,"px,0)")}function A(e,t){e.style["".concat(I,"TransitionDuration")]=null==t?"":"".concat(t,"ms")}function P(e,t){for(;e;){if(t(e))return e;e=e.parentNode}return null}function N(e,t,n){return Math.max(e,Math.min(n,t))}function M(e){return"px"===e.substr(-2)?parseFloat(e):0}function j(e){var t=window.getComputedStyle(e);return{bottom:M(t.marginBottom),left:M(t.marginLeft),right:M(t.marginRight),top:M(t.marginTop)}}function W(e,t){var n=t.displayName||t.name;return n?"".concat(e,"(").concat(n,")"):e}function _(e,t){var n=e.getBoundingClientRect();return{top:n.top+t.top,left:n.left+t.left}}function L(e){return e.touches&&e.touches.length?{x:e.touches[0].pageX,y:e.touches[0].pageY}:e.changedTouches&&e.changedTouches.length?{x:e.changedTouches[0].pageX,y:e.changedTouches[0].pageY}:{x:e.pageX,y:e.pageY}}function K(e){return e.touches&&e.touches.length||e.changedTouches&&e.changedTouches.length}function H(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{left:0,top:0};if(e){var r={left:n.left+e.offsetLeft,top:n.top+e.offsetTop};return e.parentNode===t?r:H(e.parentNode,t,r)}}function B(e,t,n){return e<n&&e>t?e-1:e>n&&e<t?e+1:e}function G(e){var t=e.lockOffset,n=e.width,r=e.height,i=t,o=t,a="px";if("string"==typeof t){var l=/^[+-]?\d*(?:\.\d*)?(px|%)$/.exec(t);x()(null!==l,'lockOffset value should be a number or a string of a number followed by "px" or "%". Given %s',t),i=parseFloat(t),o=parseFloat(t),a=l[1]}return x()(isFinite(i)&&isFinite(o),"lockOffset value should be a finite. Given %s",t),"%"===a&&(i=i*n/100,o=o*r/100),{x:i,y:o}}function U(e){var t=e.height,n=e.width,r=e.lockOffset,i=Array.isArray(r)?r:[r,r];x()(2===i.length,"lockOffset prop of SortableContainer should be a single value or an array of exactly two values. Given %s",r);var o=l(i,2),a=o[0],s=o[1];return[G({height:t,lockOffset:a,width:n}),G({height:t,lockOffset:s,width:n})]}function F(e){return e instanceof HTMLElement?function(e){var t=window.getComputedStyle(e),n=/(auto|scroll)/;return["overflow","overflowX","overflowY"].find((function(e){return n.test(t[e])}))}(e)?e:F(e.parentNode):null}function X(e){var t=window.getComputedStyle(e);return"grid"===t.display?{x:M(t.gridColumnGap),y:M(t.gridRowGap)}:{x:0,y:0}}var Y="BUTTON",V="INPUT",q="OPTION",z="TEXTAREA",$="SELECT";function J(e){var t,n="input, textarea, select, canvas, [contenteditable]",r=e.querySelectorAll(n),i=e.cloneNode(!0);return(t=i.querySelectorAll(n),function(e){if(Array.isArray(e))return o(e)}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||a(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).forEach((function(e,t){"file"!==e.type&&(e.value=r[t].value),"radio"===e.type&&e.name&&(e.name="__sortableClone__".concat(e.name)),"CANVAS"===e.tagName&&r[t].width>0&&r[t].height>0&&e.getContext("2d").drawImage(r[t],0,0)})),i}function Q(e){return null!=e.sortableHandle}var Z=function(){function e(t,n){c(this,e),this.container=t,this.onScrollCallback=n}return d(e,[{key:"clear",value:function(){null!=this.interval&&(clearInterval(this.interval),this.interval=null)}},{key:"update",value:function(e){var t=this,n=e.translate,r=e.minTranslate,i=e.maxTranslate,o=e.width,a=e.height,l={x:0,y:0},s={x:1,y:1},c=this.container,u=c.scrollTop,d=c.scrollLeft,f=c.scrollHeight,h=c.scrollWidth,p=0===u,g=f-u-c.clientHeight==0,y=0===d,m=h-d-c.clientWidth==0;n.y>=i.y-a/2&&!g?(l.y=1,s.y=10*Math.abs((i.y-a/2-n.y)/a)):n.x>=i.x-o/2&&!m?(l.x=1,s.x=10*Math.abs((i.x-o/2-n.x)/o)):n.y<=r.y+a/2&&!p?(l.y=-1,s.y=10*Math.abs((n.y-a/2-r.y)/a)):n.x<=r.x+o/2&&!y&&(l.x=-1,s.x=10*Math.abs((n.x-o/2-r.x)/o)),this.interval&&(this.clear(),this.isAutoScrolling=!1),0===l.x&&0===l.y||(this.interval=setInterval((function(){t.isAutoScrolling=!0;var e={left:s.x*l.x,top:s.y*l.y};t.container.scrollTop+=e.top,t.container.scrollLeft+=e.left,t.onScrollCallback(e)}),5))}}]),e}(),ee={axis:S().oneOf(["x","y","xy"]),contentWindow:S().any,disableAutoscroll:S().bool,distance:S().number,getContainer:S().func,getHelperDimensions:S().func,helperClass:S().string,helperContainer:S().oneOfType([S().func,"undefined"==typeof HTMLElement?S().any:S().instanceOf(HTMLElement)]),hideSortableGhost:S().bool,keyboardSortingTransitionDuration:S().number,lockAxis:S().string,lockOffset:S().oneOfType([S().number,S().string,S().arrayOf(S().oneOfType([S().number,S().string]))]),lockToContainerEdges:S().bool,onSortEnd:S().func,onSortMove:S().func,onSortOver:S().func,onSortStart:S().func,pressDelay:S().number,pressThreshold:S().number,keyCodes:S().shape({lift:S().arrayOf(S().number),drop:S().arrayOf(S().number),cancel:S().arrayOf(S().number),up:S().arrayOf(S().number),down:S().arrayOf(S().number)}),shouldCancelStart:S().func,transitionDuration:S().number,updateBeforeSortStart:S().func,useDragHandle:S().bool,useWindowAsScrollContainer:S().bool},te={lift:[32],drop:[32],cancel:[27],up:[38,37],down:[40,39]},ne={axis:"y",disableAutoscroll:!1,distance:0,getHelperDimensions:function(e){var t=e.node;return{height:t.offsetHeight,width:t.offsetWidth}},hideSortableGhost:!0,lockOffset:"50%",lockToContainerEdges:!1,pressDelay:0,pressThreshold:5,keyCodes:te,shouldCancelStart:function(e){return-1!==[V,z,$,q,Y].indexOf(e.target.tagName)||!!P(e.target,(function(e){return"true"===e.contentEditable}))},transitionDuration:300,useWindowAsScrollContainer:!1},re=Object.keys(ee);function ie(e){x()(!(e.distance&&e.pressDelay),"Attempted to set both `pressDelay` and `distance` on SortableContainer, you may only use one or the other, not both at the same time.")}function oe(e,t){try{var n=e()}catch(e){return t(!0,e)}return n&&n.then?n.then(t.bind(null,!1),t.bind(null,!0)):t(!1,value)}var ae=(0,r.createContext)({manager:{}}),le={index:S().number.isRequired,collection:S().oneOfType([S().number,S().string]),disabled:S().bool},se=Object.keys(le),ce=window.wp.components,ue=window.wp.blockEditor;const __=wp.i18n.__;wp.blocks.registerBlockType("bps-blocks/slider",{title:"Splide "+__("slider","bps-slider-block"),icon:"images-alt",category:"common",edit:function(n){let o=n.attributes.images.map((e=>e.id));const a=function(t){var n,o,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{withRef:!1};return o=n=function(n){function o(){var t,n;c(this,o);for(var i=arguments.length,a=new Array(i),l=0;l<i;l++)a[l]=arguments[l];return e(h(h(n=p(this,(t=g(o)).call.apply(t,[this].concat(a))))),"wrappedInstance",(0,r.createRef)()),n}return m(o,n),d(o,[{key:"componentDidMount",value:function(){this.register()}},{key:"componentDidUpdate",value:function(e){this.node&&(e.index!==this.props.index&&(this.node.sortableInfo.index=this.props.index),e.disabled!==this.props.disabled&&(this.node.sortableInfo.disabled=this.props.disabled)),e.collection!==this.props.collection&&(this.unregister(e.collection),this.register())}},{key:"componentWillUnmount",value:function(){this.unregister()}},{key:"register",value:function(){var e=this.props,t=e.collection,n=e.disabled,r=e.index,i=(0,v.findDOMNode)(this);i.sortableInfo={collection:t,disabled:n,index:r,manager:this.context.manager},this.node=i,this.ref={node:i},this.context.manager.add(t,this.ref)}},{key:"unregister",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props.collection;this.context.manager.remove(e,this.ref)}},{key:"getWrappedInstance",value:function(){return x()(a.withRef,"To access the wrapped instance, you need to pass in {withRef: true} as the second argument of the SortableElement() call"),this.wrappedInstance.current}},{key:"render",value:function(){var e=a.withRef?this.wrappedInstance:null;return(0,r.createElement)(t,i({ref:e},E(this.props,se)))}}]),o}(r.Component),e(n,"displayName",W("sortableElement",t)),e(n,"contextType",ae),e(n,"propTypes",le),e(n,"defaultProps",{collection:0}),o}((e=>{let{value:r}=e;const i=n.attributes.images.filter((e=>e.id==r))[0],o=n.attributes.images.map((e=>e.id)).indexOf(i.id);return(0,t.createElement)(ce.FlexItem,null,(0,t.createElement)("div",{className:"slider-edit-block-element"},(0,t.createElement)(ue.MediaUpload,{type:"image",value:i.id,onSelect:e=>{const t=n.attributes.images.concat([]);t[o].id=e.id,t[o].front_url=e.url,t[o].block_url=e.sizes.thumbnail.url,n.setAttributes({images:t})},render:e=>(0,t.createElement)("div",null,(0,t.createElement)(ce.Button,{onClick:e.open,style:{display:"inline-block"}},i.id?(0,t.createElement)("img",{src:i.block_url,onClick:e.open}):__("Select image","bps-slider-block")))}),(0,t.createElement)(ce.Button,{isDestructive:!0,onClick:()=>{n.setAttributes({images:n.attributes.images.filter(((e,t)=>o!==t))})}},__("Remove image","bps-slider-block"))))})),u=function(t){var n,o,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{withRef:!1};return o=n=function(n){function o(t){var n;c(this,o),e(h(h(n=p(this,g(o).call(this,t)))),"state",{}),e(h(h(n)),"handleStart",(function(e){var t=n.props,r=t.distance,i=t.shouldCancelStart;if(2!==e.button&&!i(e)){n.touched=!0,n.position=L(e);var o=P(e.target,(function(e){return null!=e.sortableInfo}));if(o&&o.sortableInfo&&n.nodeIsChild(o)&&!n.state.sorting){var a=n.props.useDragHandle,l=o.sortableInfo,s=l.index,c=l.collection;if(l.disabled)return;if(a&&!P(e.target,Q))return;n.manager.active={collection:c,index:s},K(e)||"A"!==e.target.tagName||e.preventDefault(),r||(0===n.props.pressDelay?n.handlePress(e):n.pressTimer=setTimeout((function(){return n.handlePress(e)}),n.props.pressDelay))}}})),e(h(h(n)),"nodeIsChild",(function(e){return e.sortableInfo.manager===n.manager})),e(h(h(n)),"handleMove",(function(e){var t=n.props,r=t.distance,i=t.pressThreshold;if(!n.state.sorting&&n.touched&&!n._awaitingUpdateBeforeSortStart){var o=L(e),a={x:n.position.x-o.x,y:n.position.y-o.y},l=Math.abs(a.x)+Math.abs(a.y);n.delta=a,r||i&&!(l>=i)?r&&l>=r&&n.manager.isActive()&&n.handlePress(e):(clearTimeout(n.cancelTimer),n.cancelTimer=setTimeout(n.cancel,0))}})),e(h(h(n)),"handleEnd",(function(){n.touched=!1,n.cancel()})),e(h(h(n)),"cancel",(function(){var e=n.props.distance;n.state.sorting||(e||clearTimeout(n.pressTimer),n.manager.active=null)})),e(h(h(n)),"handlePress",(function(e){try{var t=n.manager.getActive(),r=function(){if(t){var r=function(){var t=h.sortableInfo.index,r=j(h),i=X(n.container),u=n.scrollContainer.getBoundingClientRect(),y=a({index:t,node:h,collection:p});if(n.node=h,n.margin=r,n.gridGap=i,n.width=y.width,n.height=y.height,n.marginOffset={x:n.margin.left+n.margin.right+n.gridGap.x,y:Math.max(n.margin.top,n.margin.bottom,n.gridGap.y)},n.boundingClientRect=h.getBoundingClientRect(),n.containerBoundingRect=u,n.index=t,n.newIndex=t,n.axis={x:o.indexOf("x")>=0,y:o.indexOf("y")>=0},n.offsetEdge=H(h,n.container),n.initialOffset=L(g?s({},e,{pageX:n.boundingClientRect.left,pageY:n.boundingClientRect.top}):e),n.initialScroll={left:n.scrollContainer.scrollLeft,top:n.scrollContainer.scrollTop},n.initialWindowScroll={left:window.pageXOffset,top:window.pageYOffset},n.helper=n.helperContainer.appendChild(J(h)),R(n.helper,{boxSizing:"border-box",height:"".concat(n.height,"px"),left:"".concat(n.boundingClientRect.left-r.left,"px"),pointerEvents:"none",position:"fixed",top:"".concat(n.boundingClientRect.top-r.top,"px"),width:"".concat(n.width,"px")}),g&&n.helper.focus(),c&&(n.sortableGhost=h,R(h,{opacity:0,visibility:"hidden"})),n.minTranslate={},n.maxTranslate={},g){var m=f?{top:0,left:0,width:n.contentWindow.innerWidth,height:n.contentWindow.innerHeight}:n.containerBoundingRect,v=m.top,b=m.left,x=m.width,w=v+m.height,S=b+x;n.axis.x&&(n.minTranslate.x=b-n.boundingClientRect.left,n.maxTranslate.x=S-(n.boundingClientRect.left+n.width)),n.axis.y&&(n.minTranslate.y=v-n.boundingClientRect.top,n.maxTranslate.y=w-(n.boundingClientRect.top+n.height))}else n.axis.x&&(n.minTranslate.x=(f?0:u.left)-n.boundingClientRect.left-n.width/2,n.maxTranslate.x=(f?n.contentWindow.innerWidth:u.left+u.width)-n.boundingClientRect.left-n.width/2),n.axis.y&&(n.minTranslate.y=(f?0:u.top)-n.boundingClientRect.top-n.height/2,n.maxTranslate.y=(f?n.contentWindow.innerHeight:u.top+u.height)-n.boundingClientRect.top-n.height/2);l&&l.split(" ").forEach((function(e){return n.helper.classList.add(e)})),n.listenerNode=e.touches?e.target:n.contentWindow,g?(n.listenerNode.addEventListener("wheel",n.handleKeyEnd,!0),n.listenerNode.addEventListener("mousedown",n.handleKeyEnd,!0),n.listenerNode.addEventListener("keydown",n.handleKeyDown)):(T.move.forEach((function(e){return n.listenerNode.addEventListener(e,n.handleSortMove,!1)})),T.end.forEach((function(e){return n.listenerNode.addEventListener(e,n.handleSortEnd,!1)}))),n.setState({sorting:!0,sortingIndex:t}),d&&d({node:h,index:t,collection:p,isKeySorting:g,nodes:n.manager.getOrderedRefs(),helper:n.helper},e),g&&n.keyMove(0)},i=n.props,o=i.axis,a=i.getHelperDimensions,l=i.helperClass,c=i.hideSortableGhost,u=i.updateBeforeSortStart,d=i.onSortStart,f=i.useWindowAsScrollContainer,h=t.node,p=t.collection,g=n.manager.isKeySorting,y=function(){if("function"==typeof u){n._awaitingUpdateBeforeSortStart=!0;var t=oe((function(){var t=h.sortableInfo.index;return Promise.resolve(u({collection:p,index:t,node:h,isKeySorting:g},e)).then((function(){}))}),(function(e,t){if(n._awaitingUpdateBeforeSortStart=!1,e)throw t;return t}));if(t&&t.then)return t.then((function(){}))}}();return y&&y.then?y.then(r):r()}}();return Promise.resolve(r&&r.then?r.then((function(){})):void 0)}catch(e){return Promise.reject(e)}})),e(h(h(n)),"handleSortMove",(function(e){var t=n.props.onSortMove;"function"==typeof e.preventDefault&&e.cancelable&&e.preventDefault(),n.updateHelperPosition(e),n.animateNodes(),n.autoscroll(),t&&t(e)})),e(h(h(n)),"handleSortEnd",(function(e){var t=n.props,r=t.hideSortableGhost,i=t.onSortEnd,o=n.manager,a=o.active.collection,l=o.isKeySorting,s=n.manager.getOrderedRefs();n.listenerNode&&(l?(n.listenerNode.removeEventListener("wheel",n.handleKeyEnd,!0),n.listenerNode.removeEventListener("mousedown",n.handleKeyEnd,!0),n.listenerNode.removeEventListener("keydown",n.handleKeyDown)):(T.move.forEach((function(e){return n.listenerNode.removeEventListener(e,n.handleSortMove)})),T.end.forEach((function(e){return n.listenerNode.removeEventListener(e,n.handleSortEnd)})))),n.helper.parentNode.removeChild(n.helper),r&&n.sortableGhost&&R(n.sortableGhost,{opacity:"",visibility:""});for(var c=0,u=s.length;c<u;c++){var d=s[c],f=d.node;d.edgeOffset=null,d.boundingClientRect=null,D(f,null),A(f,null),d.translate=null}n.autoScroller.clear(),n.manager.active=null,n.manager.isKeySorting=!1,n.setState({sorting:!1,sortingIndex:null}),"function"==typeof i&&i({collection:a,newIndex:n.newIndex,oldIndex:n.index,isKeySorting:l,nodes:s},e),n.touched=!1})),e(h(h(n)),"autoscroll",(function(){var e=n.props.disableAutoscroll,t=n.manager.isKeySorting;if(e)n.autoScroller.clear();else{if(t){var r=s({},n.translate),i=0,o=0;return n.axis.x&&(r.x=Math.min(n.maxTranslate.x,Math.max(n.minTranslate.x,n.translate.x)),i=n.translate.x-r.x),n.axis.y&&(r.y=Math.min(n.maxTranslate.y,Math.max(n.minTranslate.y,n.translate.y)),o=n.translate.y-r.y),n.translate=r,D(n.helper,n.translate),n.scrollContainer.scrollLeft+=i,void(n.scrollContainer.scrollTop+=o)}n.autoScroller.update({height:n.height,maxTranslate:n.maxTranslate,minTranslate:n.minTranslate,translate:n.translate,width:n.width})}})),e(h(h(n)),"onAutoScroll",(function(e){n.translate.x+=e.left,n.translate.y+=e.top,n.animateNodes()})),e(h(h(n)),"handleKeyDown",(function(e){var t=e.keyCode,r=n.props,i=r.shouldCancelStart,o=r.keyCodes,a=s({},te,void 0===o?{}:o);n.manager.active&&!n.manager.isKeySorting||!(n.manager.active||a.lift.includes(t)&&!i(e)&&n.isValidSortingTarget(e))||(e.stopPropagation(),e.preventDefault(),a.lift.includes(t)&&!n.manager.active?n.keyLift(e):a.drop.includes(t)&&n.manager.active?n.keyDrop(e):a.cancel.includes(t)?(n.newIndex=n.manager.active.index,n.keyDrop(e)):a.up.includes(t)?n.keyMove(-1):a.down.includes(t)&&n.keyMove(1))})),e(h(h(n)),"keyLift",(function(e){var t=e.target,r=P(t,(function(e){return null!=e.sortableInfo})).sortableInfo,i=r.index,o=r.collection;n.initialFocusedNode=t,n.manager.isKeySorting=!0,n.manager.active={index:i,collection:o},n.handlePress(e)})),e(h(h(n)),"keyMove",(function(e){var t=n.manager.getOrderedRefs(),r=t[t.length-1].node.sortableInfo.index,i=n.newIndex+e,o=n.newIndex;if(!(i<0||i>r)){n.prevIndex=o,n.newIndex=i;var a=B(n.newIndex,n.prevIndex,n.index),l=t.find((function(e){return e.node.sortableInfo.index===a})),s=l.node,c=n.containerScrollDelta,u=l.boundingClientRect||_(s,c),d=l.translate||{x:0,y:0},f=u.top+d.y-c.top,h=u.left+d.x-c.left,p=o<i,g=p&&n.axis.x?s.offsetWidth-n.width:0,y=p&&n.axis.y?s.offsetHeight-n.height:0;n.handleSortMove({pageX:h+g,pageY:f+y,ignoreTransition:0===e})}})),e(h(h(n)),"keyDrop",(function(e){n.handleSortEnd(e),n.initialFocusedNode&&n.initialFocusedNode.focus()})),e(h(h(n)),"handleKeyEnd",(function(e){n.manager.active&&n.keyDrop(e)})),e(h(h(n)),"isValidSortingTarget",(function(e){var t=n.props.useDragHandle,r=e.target,i=P(r,(function(e){return null!=e.sortableInfo}));return i&&i.sortableInfo&&!i.sortableInfo.disabled&&(t?Q(r):r.sortableInfo)}));var i=new O;return ie(t),n.manager=i,n.wrappedInstance=(0,r.createRef)(),n.sortableContextValue={manager:i},n.events={end:n.handleEnd,move:n.handleMove,start:n.handleStart},n}return m(o,n),d(o,[{key:"componentDidMount",value:function(){var e=this,t=this.props.useWindowAsScrollContainer,n=this.getContainer();Promise.resolve(n).then((function(n){e.container=n,e.document=e.container.ownerDocument||document;var r=e.props.contentWindow||e.document.defaultView||window;e.contentWindow="function"==typeof r?r():r,e.scrollContainer=t?e.document.scrollingElement||e.document.documentElement:F(e.container)||e.container,e.autoScroller=new Z(e.scrollContainer,e.onAutoScroll),Object.keys(e.events).forEach((function(t){return T[t].forEach((function(n){return e.container.addEventListener(n,e.events[t],!1)}))})),e.container.addEventListener("keydown",e.handleKeyDown)}))}},{key:"componentWillUnmount",value:function(){var e=this;this.helper&&this.helper.parentNode&&this.helper.parentNode.removeChild(this.helper),this.container&&(Object.keys(this.events).forEach((function(t){return T[t].forEach((function(n){return e.container.removeEventListener(n,e.events[t])}))})),this.container.removeEventListener("keydown",this.handleKeyDown))}},{key:"updateHelperPosition",value:function(e){var t=this.props,n=t.lockAxis,r=t.lockOffset,i=t.lockToContainerEdges,o=t.transitionDuration,a=t.keyboardSortingTransitionDuration,s=void 0===a?o:a,c=this.manager.isKeySorting,u=e.ignoreTransition,d=L(e),f={x:d.x-this.initialOffset.x,y:d.y-this.initialOffset.y};if(f.y-=window.pageYOffset-this.initialWindowScroll.top,f.x-=window.pageXOffset-this.initialWindowScroll.left,this.translate=f,i){var h=l(U({height:this.height,lockOffset:r,width:this.width}),2),p=h[0],g=h[1],y={x:this.width/2-p.x,y:this.height/2-p.y},m={x:this.width/2-g.x,y:this.height/2-g.y};f.x=N(this.minTranslate.x+y.x,this.maxTranslate.x-m.x,f.x),f.y=N(this.minTranslate.y+y.y,this.maxTranslate.y-m.y,f.y)}"x"===n?f.y=0:"y"===n&&(f.x=0),c&&s&&!u&&A(this.helper,s),D(this.helper,f)}},{key:"animateNodes",value:function(){var e=this.props,t=e.transitionDuration,n=e.hideSortableGhost,r=e.onSortOver,i=this.containerScrollDelta,o=this.windowScrollDelta,a=this.manager.getOrderedRefs(),l=this.offsetEdge.left+this.translate.x+i.left,s=this.offsetEdge.top+this.translate.y+i.top,c=this.manager.isKeySorting,u=this.newIndex;this.newIndex=null;for(var d=0,f=a.length;d<f;d++){var h=a[d].node,p=h.sortableInfo.index,g=h.offsetWidth,y=h.offsetHeight,m={height:this.height>y?y/2:this.height/2,width:this.width>g?g/2:this.width/2},v=c&&p>this.index&&p<=u,b=c&&p<this.index&&p>=u,x={x:0,y:0},w=a[d].edgeOffset;w||(w=H(h,this.container),a[d].edgeOffset=w,c&&(a[d].boundingClientRect=_(h,i)));var S=d<a.length-1&&a[d+1],O=d>0&&a[d-1];S&&!S.edgeOffset&&(S.edgeOffset=H(S.node,this.container),c&&(S.boundingClientRect=_(S.node,i))),p!==this.index?(t&&A(h,t),this.axis.x?this.axis.y?b||p<this.index&&(l+o.left-m.width<=w.left&&s+o.top<=w.top+m.height||s+o.top+m.height<=w.top)?(x.x=this.width+this.marginOffset.x,w.left+x.x>this.containerBoundingRect.width-m.width&&S&&(x.x=S.edgeOffset.left-w.left,x.y=S.edgeOffset.top-w.top),null===this.newIndex&&(this.newIndex=p)):(v||p>this.index&&(l+o.left+m.width>=w.left&&s+o.top+m.height>=w.top||s+o.top+m.height>=w.top+y))&&(x.x=-(this.width+this.marginOffset.x),w.left+x.x<this.containerBoundingRect.left+m.width&&O&&(x.x=O.edgeOffset.left-w.left,x.y=O.edgeOffset.top-w.top),this.newIndex=p):v||p>this.index&&l+o.left+m.width>=w.left?(x.x=-(this.width+this.marginOffset.x),this.newIndex=p):(b||p<this.index&&l+o.left<=w.left+m.width)&&(x.x=this.width+this.marginOffset.x,null==this.newIndex&&(this.newIndex=p)):this.axis.y&&(v||p>this.index&&s+o.top+m.height>=w.top?(x.y=-(this.height+this.marginOffset.y),this.newIndex=p):(b||p<this.index&&s+o.top<=w.top+m.height)&&(x.y=this.height+this.marginOffset.y,null==this.newIndex&&(this.newIndex=p))),D(h,x),a[d].translate=x):n&&(this.sortableGhost=h,R(h,{opacity:0,visibility:"hidden"}))}null==this.newIndex&&(this.newIndex=this.index),c&&(this.newIndex=u);var k=c?this.prevIndex:u;r&&this.newIndex!==k&&r({collection:this.manager.active.collection,index:this.index,newIndex:this.newIndex,oldIndex:k,isKeySorting:c,nodes:a,helper:this.helper})}},{key:"getWrappedInstance",value:function(){return x()(a.withRef,"To access the wrapped instance, you need to pass in {withRef: true} as the second argument of the SortableContainer() call"),this.wrappedInstance.current}},{key:"getContainer",value:function(){var e=this.props.getContainer;return"function"!=typeof e?(0,v.findDOMNode)(this):e(a.withRef?this.getWrappedInstance():void 0)}},{key:"render",value:function(){var e=a.withRef?this.wrappedInstance:null;return(0,r.createElement)(ae.Provider,{value:this.sortableContextValue},(0,r.createElement)(t,i({ref:e},E(this.props,re))))}},{key:"helperContainer",get:function(){var e=this.props.helperContainer;return"function"==typeof e?e():this.props.helperContainer||this.document.body}},{key:"containerScrollDelta",get:function(){return this.props.useWindowAsScrollContainer?{left:0,top:0}:{left:this.scrollContainer.scrollLeft-this.initialScroll.left,top:this.scrollContainer.scrollTop-this.initialScroll.top}}},{key:"windowScrollDelta",get:function(){return{left:this.contentWindow.pageXOffset-this.initialWindowScroll.left,top:this.contentWindow.pageYOffset-this.initialWindowScroll.top}}}]),o}(r.Component),e(n,"displayName",W("sortableList",t)),e(n,"defaultProps",ne),e(n,"propTypes",ee),o}((e=>{let{items:r}=e;return(0,t.createElement)("div",{className:"slider-edit-block"},(0,t.createElement)("h4",null,__("Slider images","bps-slider-block"),":"),(0,t.createElement)(ce.Flex,{justify:"flex-start",wrap:"true"},r.map(((e,n)=>(0,t.createElement)(a,{key:`item-${e}`,index:n,value:e})))),(0,t.createElement)(ce.Button,{isPrimary:!0,onClick:()=>{n.setAttributes({images:n.attributes.images.concat([{}])})}},__("Add image","bps-slider-block")))}));class f extends r.Component{constructor(){super(...arguments),e(this,"state",{items:o}),e(this,"onSortEnd",(e=>{let{oldIndex:t,newIndex:r}=e;const i=C(o,t,r);this.setState((e=>{let{items:n}=e;return{items:C(n,t,r)}}));const a=n.attributes.images.concat([]);a.sort((function(e,t){return i.indexOf(e.id)-i.indexOf(t.id)})),n.setAttributes({images:a})}))}render(){return(0,t.createElement)(u,{items:this.state.items,onSortEnd:this.onSortEnd,axis:"xy"})}}class y extends r.Component{render(){return(0,t.createElement)(ue.InspectorControls,null,(0,t.createElement)(ce.PanelBody,{title:__("Slider settings","bps-slider-block"),initialOpen:!0},(0,t.createElement)(ce.RangeControl,{label:__("Height ratio","bps-slider-block"),value:n.attributes.height_ratio,onChange:e=>n.setAttributes({height_ratio:e.toString()}),initialPosition:n.attributes.height_ratio,min:.4,max:1,step:.1}),(0,t.createElement)(ce.RangeControl,{label:__("Gap in px","bps-slider-block"),value:n.attributes.gap,onChange:e=>n.setAttributes({gap:e.toString()}),initialPosition:n.attributes.gap,min:0,max:100,step:5}),(0,t.createElement)(ce.RangeControl,{label:__("Padding in %","bps-slider-block"),value:n.attributes.padding,onChange:e=>n.setAttributes({padding:e.toString()}),initialPosition:n.attributes.padding,min:0,max:30,step:2})))}}return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(y,null),(0,t.createElement)(f,null))},save:function(e){return null}})}()}(); -
bps-splide-slider-block/trunk/build/frontend.css
r2684849 r2793666 1 /*!*************************************************************************************************************************************!*\2 !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[3].use[1]!./node_modules/@splidejs/splide/dist/css/splide.min.css ***!3 \*************************************************************************************************************************************/4 1 .splide__container{box-sizing:border-box;position:relative}.splide__list{-webkit-backface-visibility:hidden;backface-visibility:hidden;display:-ms-flexbox;display:flex;height:100%;margin:0!important;padding:0!important;transform-style:preserve-3d}.splide.is-initialized:not(.is-active) .splide__list{display:block}.splide__pagination{-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-pack:center;justify-content:center;margin:0;pointer-events:none}.splide__pagination li{display:inline-block;line-height:1;list-style-type:none;margin:0;pointer-events:auto}.splide__progress__bar{width:0}.splide{outline:none;position:relative;visibility:hidden}.splide.is-initialized,.splide.is-rendered{visibility:visible}.splide__slide{-webkit-backface-visibility:hidden;backface-visibility:hidden;box-sizing:border-box;-ms-flex-negative:0;flex-shrink:0;list-style-type:none!important;margin:0;outline:none;position:relative}.splide__slide img{vertical-align:bottom}.splide__slider{position:relative}.splide__spinner{animation:splide-loading 1s linear infinite;border:2px solid #999;border-left-color:transparent;border-radius:50%;bottom:0;contain:strict;display:inline-block;height:20px;left:0;margin:auto;position:absolute;right:0;top:0;width:20px}.splide__track{overflow:hidden;position:relative;z-index:0}@keyframes splide-loading{0%{transform:rotate(0)}to{transform:rotate(1turn)}}.splide--draggable>.splide__slider>.splide__track,.splide--draggable>.splide__track{-webkit-user-select:none;-ms-user-select:none;user-select:none}.splide--fade>.splide__slider>.splide__track>.splide__list,.splide--fade>.splide__track>.splide__list{display:block}.splide--fade>.splide__slider>.splide__track>.splide__list>.splide__slide,.splide--fade>.splide__track>.splide__list>.splide__slide{left:0;opacity:0;position:absolute;top:0;z-index:0}.splide--fade>.splide__slider>.splide__track>.splide__list>.splide__slide.is-active,.splide--fade>.splide__track>.splide__list>.splide__slide.is-active{opacity:1;position:relative;z-index:1}.splide--rtl{direction:rtl}.splide--ttb.is-active>.splide__slider>.splide__track>.splide__list,.splide--ttb.is-active>.splide__track>.splide__list{display:block}.splide__arrow{-ms-flex-align:center;align-items:center;background:#ccc;border:0;border-radius:50%;cursor:pointer;display:-ms-flexbox;display:flex;height:2em;-ms-flex-pack:center;justify-content:center;opacity:.7;padding:0;position:absolute;top:50%;transform:translateY(-50%);width:2em;z-index:1}.splide__arrow svg{fill:#000;height:1.2em;width:1.2em}.splide__arrow:hover{opacity:.9}.splide__arrow:focus{outline:none}.splide__arrow--prev{left:1em}.splide__arrow--prev svg{transform:scaleX(-1)}.splide__arrow--next{right:1em}.splide__pagination{bottom:.5em;left:0;padding:0 1em;position:absolute;right:0;z-index:1}.splide__pagination__page{background:#ccc;border:0;border-radius:50%;display:inline-block;height:8px;margin:3px;opacity:.7;padding:0;transition:transform .2s linear;width:8px}.splide__pagination__page.is-active{background:#fff;transform:scale(1.4)}.splide__pagination__page:hover{cursor:pointer;opacity:.9}.splide__pagination__page:focus{outline:none}.splide__progress__bar{background:#ccc;height:3px}.splide--nav>.splide__slider>.splide__track>.splide__list>.splide__slide,.splide--nav>.splide__track>.splide__list>.splide__slide{border:3px solid transparent;cursor:pointer}.splide--nav>.splide__slider>.splide__track>.splide__list>.splide__slide.is-active,.splide--nav>.splide__track>.splide__list>.splide__slide.is-active{border:3px solid #000}.splide--nav>.splide__slider>.splide__track>.splide__list>.splide__slide:focus,.splide--nav>.splide__track>.splide__list>.splide__slide:focus{outline:none}.splide--rtl>.splide__arrows .splide__arrow--prev,.splide--rtl>.splide__slider>.splide__track>.splide__arrows .splide__arrow--prev,.splide--rtl>.splide__track>.splide__arrows .splide__arrow--prev{left:auto;right:1em}.splide--rtl>.splide__arrows .splide__arrow--prev svg,.splide--rtl>.splide__slider>.splide__track>.splide__arrows .splide__arrow--prev svg,.splide--rtl>.splide__track>.splide__arrows .splide__arrow--prev svg{transform:scaleX(1)}.splide--rtl>.splide__arrows .splide__arrow--next,.splide--rtl>.splide__slider>.splide__track>.splide__arrows .splide__arrow--next,.splide--rtl>.splide__track>.splide__arrows .splide__arrow--next{left:1em;right:auto}.splide--rtl>.splide__arrows .splide__arrow--next svg,.splide--rtl>.splide__slider>.splide__track>.splide__arrows .splide__arrow--next svg,.splide--rtl>.splide__track>.splide__arrows .splide__arrow--next svg{transform:scaleX(-1)}.splide--ttb>.splide__arrows .splide__arrow,.splide--ttb>.splide__slider>.splide__track>.splide__arrows .splide__arrow,.splide--ttb>.splide__track>.splide__arrows .splide__arrow{left:50%;transform:translate(-50%)}.splide--ttb>.splide__arrows .splide__arrow--prev,.splide--ttb>.splide__slider>.splide__track>.splide__arrows .splide__arrow--prev,.splide--ttb>.splide__track>.splide__arrows .splide__arrow--prev{top:1em}.splide--ttb>.splide__arrows .splide__arrow--prev svg,.splide--ttb>.splide__slider>.splide__track>.splide__arrows .splide__arrow--prev svg,.splide--ttb>.splide__track>.splide__arrows .splide__arrow--prev svg{transform:rotate(-90deg)}.splide--ttb>.splide__arrows .splide__arrow--next,.splide--ttb>.splide__slider>.splide__track>.splide__arrows .splide__arrow--next,.splide--ttb>.splide__track>.splide__arrows .splide__arrow--next{bottom:1em;top:auto}.splide--ttb>.splide__arrows .splide__arrow--next svg,.splide--ttb>.splide__slider>.splide__track>.splide__arrows .splide__arrow--next svg,.splide--ttb>.splide__track>.splide__arrows .splide__arrow--next svg{transform:rotate(90deg)}.splide--ttb>.splide__pagination,.splide--ttb>.splide__slider>.splide__pagination{bottom:0;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;left:auto;padding:1em 0;right:.5em;top:0} 5 /*!******************************************************************************************************************************************************************************************************************************************!*\6 !*** css ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[3].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[3].use[2]!./node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[3].use[3]!./src/frontend.scss ***!7 \******************************************************************************************************************************************************************************************************************************************/8 2 9 10 /*# sourceMappingURL=frontend.css.map*/ -
bps-splide-slider-block/trunk/build/frontend.js
r2684849 r2793666 1 /******/ (function() { // webpackBootstrap 2 /******/ "use strict"; 3 /******/ var __webpack_modules__ = ({ 4 5 /***/ "./node_modules/@splidejs/react-splide/dist/js/react-splide.esm.js": 6 /*!*************************************************************************!*\ 7 !*** ./node_modules/@splidejs/react-splide/dist/js/react-splide.esm.js ***! 8 \*************************************************************************/ 9 /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { 10 11 __webpack_require__.r(__webpack_exports__); 12 /* harmony export */ __webpack_require__.d(__webpack_exports__, { 13 /* harmony export */ "Splide": function() { return /* binding */ Splide2; }, 14 /* harmony export */ "SplideSlide": function() { return /* binding */ SplideSlide; } 15 /* harmony export */ }); 16 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); 17 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 18 // node_modules/@splidejs/splide/dist/js/splide.esm.js 19 var PROJECT_CODE = "splide"; 20 var DATA_ATTRIBUTE = `data-${PROJECT_CODE}`; 21 var CREATED = 1; 22 var MOUNTED = 2; 23 var IDLE = 3; 24 var MOVING = 4; 25 var DESTROYED = 5; 26 var STATES = { 27 CREATED, 28 MOUNTED, 29 IDLE, 30 MOVING, 31 DESTROYED 32 }; 33 var DEFAULT_EVENT_PRIORITY = 10; 34 var DEFAULT_USER_EVENT_PRIORITY = 20; 35 function empty(array) { 36 array.length = 0; 37 } 38 function isObject(subject) { 39 return !isNull(subject) && typeof subject === "object"; 40 } 41 function isArray(subject) { 42 return Array.isArray(subject); 43 } 44 function isFunction(subject) { 45 return typeof subject === "function"; 46 } 47 function isString(subject) { 48 return typeof subject === "string"; 49 } 50 function isUndefined(subject) { 51 return typeof subject === "undefined"; 52 } 53 function isNull(subject) { 54 return subject === null; 55 } 56 function isHTMLElement(subject) { 57 return subject instanceof HTMLElement; 58 } 59 function toArray(value) { 60 return isArray(value) ? value : [value]; 61 } 62 function forEach(values, iteratee) { 63 toArray(values).forEach(iteratee); 64 } 65 function includes(array, value) { 66 return array.indexOf(value) > -1; 67 } 68 function push(array, items) { 69 array.push(...toArray(items)); 70 return array; 71 } 72 var arrayProto = Array.prototype; 73 function slice(arrayLike, start, end) { 74 return arrayProto.slice.call(arrayLike, start, end); 75 } 76 function find(arrayLike, predicate) { 77 return slice(arrayLike).filter(predicate)[0]; 78 } 79 function toggleClass(elm, classes, add) { 80 if (elm) { 81 forEach(classes, (name) => { 82 if (name) { 83 elm.classList[add ? "add" : "remove"](name); 84 } 85 }); 86 } 87 } 88 function addClass(elm, classes) { 89 toggleClass(elm, isString(classes) ? classes.split(" ") : classes, true); 90 } 91 function append(parent, children2) { 92 forEach(children2, parent.appendChild.bind(parent)); 93 } 94 function before(nodes, ref) { 95 forEach(nodes, (node) => { 96 const parent = ref.parentNode; 97 if (parent) { 98 parent.insertBefore(node, ref); 99 } 100 }); 101 } 102 function matches(elm, selector) { 103 return isHTMLElement(elm) && (elm["msMatchesSelector"] || elm.matches).call(elm, selector); 104 } 105 function children(parent, selector) { 106 return parent ? slice(parent.children).filter((child2) => matches(child2, selector)) : []; 107 } 108 function child(parent, selector) { 109 return selector ? children(parent, selector)[0] : parent.firstElementChild; 110 } 111 function forOwn(object, iteratee, right) { 112 if (object) { 113 let keys = Object.keys(object); 114 keys = right ? keys.reverse() : keys; 115 for (let i = 0; i < keys.length; i++) { 116 const key = keys[i]; 117 if (key !== "__proto__") { 118 if (iteratee(object[key], key) === false) { 119 break; 120 } 121 } 122 } 123 } 124 return object; 125 } 126 function assign(object) { 127 slice(arguments, 1).forEach((source) => { 128 forOwn(source, (value, key) => { 129 object[key] = source[key]; 130 }); 131 }); 132 return object; 133 } 134 function merge(object, source) { 135 forOwn(source, (value, key) => { 136 if (isArray(value)) { 137 object[key] = value.slice(); 138 } else if (isObject(value)) { 139 object[key] = merge(isObject(object[key]) ? object[key] : {}, value); 140 } else { 141 object[key] = value; 142 } 143 }); 144 return object; 145 } 146 function removeAttribute(elm, attrs) { 147 if (elm) { 148 forEach(attrs, (attr) => { 149 elm.removeAttribute(attr); 150 }); 151 } 152 } 153 function setAttribute(elm, attrs, value) { 154 if (isObject(attrs)) { 155 forOwn(attrs, (value2, name) => { 156 setAttribute(elm, name, value2); 157 }); 158 } else { 159 isNull(value) ? removeAttribute(elm, attrs) : elm.setAttribute(attrs, String(value)); 160 } 161 } 162 function create(tag, attrs, parent) { 163 const elm = document.createElement(tag); 164 if (attrs) { 165 isString(attrs) ? addClass(elm, attrs) : setAttribute(elm, attrs); 166 } 167 parent && append(parent, elm); 168 return elm; 169 } 170 function style(elm, prop, value) { 171 if (isUndefined(value)) { 172 return getComputedStyle(elm)[prop]; 173 } 174 if (!isNull(value)) { 175 const { style: style2 } = elm; 176 value = `${value}`; 177 if (style2[prop] !== value) { 178 style2[prop] = value; 179 } 180 } 181 } 182 function display(elm, display2) { 183 style(elm, "display", display2); 184 } 185 function focus(elm) { 186 elm["setActive"] && elm["setActive"]() || elm.focus({ preventScroll: true }); 187 } 188 function getAttribute(elm, attr) { 189 return elm.getAttribute(attr); 190 } 191 function hasClass(elm, className) { 192 return elm && elm.classList.contains(className); 193 } 194 function rect(target) { 195 return target.getBoundingClientRect(); 196 } 197 function remove(nodes) { 198 forEach(nodes, (node) => { 199 if (node && node.parentNode) { 200 node.parentNode.removeChild(node); 201 } 202 }); 203 } 204 function measure(parent, value) { 205 if (isString(value)) { 206 const div = create("div", { style: `width: ${value}; position: absolute;` }, parent); 207 value = rect(div).width; 208 remove(div); 209 } 210 return value; 211 } 212 function parseHtml(html) { 213 return child(new DOMParser().parseFromString(html, "text/html").body); 214 } 215 function prevent(e, stopPropagation) { 216 e.preventDefault(); 217 if (stopPropagation) { 218 e.stopPropagation(); 219 e.stopImmediatePropagation(); 220 } 221 } 222 function query(parent, selector) { 223 return parent && parent.querySelector(selector); 224 } 225 function queryAll(parent, selector) { 226 return slice(parent.querySelectorAll(selector)); 227 } 228 function removeClass(elm, classes) { 229 toggleClass(elm, classes, false); 230 } 231 function unit(value) { 232 return isString(value) ? value : value ? `${value}px` : ""; 233 } 234 function assert(condition, message = "") { 235 if (!condition) { 236 throw new Error(`[${PROJECT_CODE}] ${message}`); 237 } 238 } 239 function nextTick(callback) { 240 setTimeout(callback); 241 } 242 var noop = () => { 243 }; 244 function raf(func) { 245 return requestAnimationFrame(func); 246 } 247 var { min, max, floor, ceil, abs } = Math; 248 function approximatelyEqual(x, y, epsilon) { 249 return abs(x - y) < epsilon; 250 } 251 function between(number, minOrMax, maxOrMin, exclusive) { 252 const minimum = min(minOrMax, maxOrMin); 253 const maximum = max(minOrMax, maxOrMin); 254 return exclusive ? minimum < number && number < maximum : minimum <= number && number <= maximum; 255 } 256 function clamp(number, x, y) { 257 const minimum = min(x, y); 258 const maximum = max(x, y); 259 return min(max(minimum, number), maximum); 260 } 261 function sign(x) { 262 return +(x > 0) - +(x < 0); 263 } 264 function format(string, replacements) { 265 forEach(replacements, (replacement) => { 266 string = string.replace("%s", `${replacement}`); 267 }); 268 return string; 269 } 270 function pad(number) { 271 return number < 10 ? `0${number}` : `${number}`; 272 } 273 var ids = {}; 274 function uniqueId(prefix) { 275 return `${prefix}${pad(ids[prefix] = (ids[prefix] || 0) + 1)}`; 276 } 277 function EventBus() { 278 let handlers = {}; 279 function on(events, callback, key, priority = DEFAULT_EVENT_PRIORITY) { 280 forEachEvent(events, (event, namespace) => { 281 handlers[event] = handlers[event] || []; 282 push(handlers[event], { 283 _event: event, 284 _callback: callback, 285 _namespace: namespace, 286 _priority: priority, 287 _key: key 288 }).sort((handler1, handler2) => handler1._priority - handler2._priority); 289 }); 290 } 291 function off(events, key) { 292 forEachEvent(events, (event, namespace) => { 293 const eventHandlers = handlers[event]; 294 handlers[event] = eventHandlers && eventHandlers.filter((handler) => { 295 return handler._key ? handler._key !== key : key || handler._namespace !== namespace; 296 }); 297 }); 298 } 299 function offBy(key) { 300 forOwn(handlers, (eventHandlers, event) => { 301 off(event, key); 302 }); 303 } 304 function emit(event) { 305 (handlers[event] || []).forEach((handler) => { 306 handler._callback.apply(handler, slice(arguments, 1)); 307 }); 308 } 309 function destroy() { 310 handlers = {}; 311 } 312 function forEachEvent(events, iteratee) { 313 toArray(events).join(" ").split(" ").forEach((eventNS) => { 314 const fragments = eventNS.split("."); 315 iteratee(fragments[0], fragments[1]); 316 }); 317 } 318 return { 319 on, 320 off, 321 offBy, 322 emit, 323 destroy 324 }; 325 } 326 var EVENT_MOUNTED = "mounted"; 327 var EVENT_READY = "ready"; 328 var EVENT_MOVE = "move"; 329 var EVENT_MOVED = "moved"; 330 var EVENT_SHIFTED = "shifted"; 331 var EVENT_CLICK = "click"; 332 var EVENT_ACTIVE = "active"; 333 var EVENT_INACTIVE = "inactive"; 334 var EVENT_VISIBLE = "visible"; 335 var EVENT_HIDDEN = "hidden"; 336 var EVENT_SLIDE_KEYDOWN = "slide:keydown"; 337 var EVENT_REFRESH = "refresh"; 338 var EVENT_UPDATED = "updated"; 339 var EVENT_RESIZE = "resize"; 340 var EVENT_RESIZED = "resized"; 341 var EVENT_REPOSITIONED = "repositioned"; 342 var EVENT_DRAG = "drag"; 343 var EVENT_DRAGGING = "dragging"; 344 var EVENT_DRAGGED = "dragged"; 345 var EVENT_SCROLL = "scroll"; 346 var EVENT_SCROLLED = "scrolled"; 347 var EVENT_DESTROY = "destroy"; 348 var EVENT_ARROWS_MOUNTED = "arrows:mounted"; 349 var EVENT_ARROWS_UPDATED = "arrows:updated"; 350 var EVENT_PAGINATION_MOUNTED = "pagination:mounted"; 351 var EVENT_PAGINATION_UPDATED = "pagination:updated"; 352 var EVENT_NAVIGATION_MOUNTED = "navigation:mounted"; 353 var EVENT_AUTOPLAY_PLAY = "autoplay:play"; 354 var EVENT_AUTOPLAY_PLAYING = "autoplay:playing"; 355 var EVENT_AUTOPLAY_PAUSE = "autoplay:pause"; 356 var EVENT_LAZYLOAD_LOADED = "lazyload:loaded"; 357 function EventInterface(Splide22) { 358 const { event } = Splide22; 359 const key = {}; 360 let listeners = []; 361 function on(events, callback, priority) { 362 event.on(events, callback, key, priority); 363 } 364 function off(events) { 365 event.off(events, key); 366 } 367 function bind(targets, events, callback, options) { 368 forEachEvent(targets, events, (target, event2) => { 369 listeners.push([target, event2, callback, options]); 370 target.addEventListener(event2, callback, options); 371 }); 372 } 373 function unbind(targets, events, callback) { 374 forEachEvent(targets, events, (target, event2) => { 375 listeners = listeners.filter((listener) => { 376 if (listener[0] === target && listener[1] === event2 && (!callback || listener[2] === callback)) { 377 target.removeEventListener(event2, listener[2], listener[3]); 378 return false; 379 } 380 return true; 381 }); 382 }); 383 } 384 function forEachEvent(targets, events, iteratee) { 385 forEach(targets, (target) => { 386 if (target) { 387 events.split(" ").forEach(iteratee.bind(null, target)); 388 } 389 }); 390 } 391 function destroy() { 392 listeners = listeners.filter((data) => unbind(data[0], data[1])); 393 event.offBy(key); 394 } 395 event.on(EVENT_DESTROY, destroy, key); 396 return { 397 on, 398 off, 399 emit: event.emit, 400 bind, 401 unbind, 402 destroy 403 }; 404 } 405 function RequestInterval(interval, onInterval, onUpdate, limit) { 406 const { now } = Date; 407 let startTime; 408 let rate = 0; 409 let id; 410 let paused = true; 411 let count = 0; 412 function update() { 413 if (!paused) { 414 const elapsed = now() - startTime; 415 if (elapsed >= interval) { 416 rate = 1; 417 startTime = now(); 418 } else { 419 rate = elapsed / interval; 420 } 421 if (onUpdate) { 422 onUpdate(rate); 423 } 424 if (rate === 1) { 425 onInterval(); 426 if (limit && ++count >= limit) { 427 return pause(); 428 } 429 } 430 raf(update); 431 } 432 } 433 function start(resume) { 434 !resume && cancel(); 435 startTime = now() - (resume ? rate * interval : 0); 436 paused = false; 437 raf(update); 438 } 439 function pause() { 440 paused = true; 441 } 442 function rewind() { 443 startTime = now(); 444 rate = 0; 445 if (onUpdate) { 446 onUpdate(rate); 447 } 448 } 449 function cancel() { 450 cancelAnimationFrame(id); 451 rate = 0; 452 id = 0; 453 paused = true; 454 } 455 function set(time) { 456 interval = time; 457 } 458 function isPaused() { 459 return paused; 460 } 461 return { 462 start, 463 rewind, 464 pause, 465 cancel, 466 set, 467 isPaused 468 }; 469 } 470 function State(initialState) { 471 let state = initialState; 472 function set(value) { 473 state = value; 474 } 475 function is(states) { 476 return includes(toArray(states), state); 477 } 478 return { set, is }; 479 } 480 function Throttle(func, duration) { 481 let interval; 482 function throttled() { 483 if (!interval) { 484 interval = RequestInterval(duration || 0, () => { 485 func.apply(this, arguments); 486 interval = null; 487 }, null, 1); 488 interval.start(); 489 } 490 } 491 return throttled; 492 } 493 function Options(Splide22, Components2, options) { 494 const throttledObserve = Throttle(observe); 495 let initialOptions; 496 let points; 497 let currPoint; 498 function setup() { 499 try { 500 merge(options, JSON.parse(getAttribute(Splide22.root, DATA_ATTRIBUTE))); 501 } catch (e) { 502 assert(false, e.message); 503 } 504 initialOptions = merge({}, options); 505 const { breakpoints } = options; 506 if (breakpoints) { 507 const isMin = options.mediaQuery === "min"; 508 points = Object.keys(breakpoints).sort((n, m) => isMin ? +m - +n : +n - +m).map((point) => [ 509 point, 510 matchMedia(`(${isMin ? "min" : "max"}-width:${point}px)`) 511 ]); 512 observe(); 513 } 514 } 515 function mount() { 516 if (points) { 517 addEventListener("resize", throttledObserve); 518 } 519 } 520 function destroy(completely) { 521 if (completely) { 522 removeEventListener("resize", throttledObserve); 523 } 524 } 525 function observe() { 526 const item = find(points, (item2) => item2[1].matches) || []; 527 if (item[0] !== currPoint) { 528 onMatch(currPoint = item[0]); 529 } 530 } 531 function onMatch(point) { 532 const newOptions = options.breakpoints[point] || initialOptions; 533 if (newOptions.destroy) { 534 Splide22.options = initialOptions; 535 Splide22.destroy(newOptions.destroy === "completely"); 536 } else { 537 if (Splide22.state.is(DESTROYED)) { 538 destroy(true); 539 Splide22.mount(); 540 } 541 Splide22.options = newOptions; 542 } 543 } 544 return { 545 setup, 546 mount, 547 destroy 548 }; 549 } 550 var RTL = "rtl"; 551 var TTB = "ttb"; 552 var ORIENTATION_MAP = { 553 marginRight: ["marginBottom", "marginLeft"], 554 autoWidth: ["autoHeight"], 555 fixedWidth: ["fixedHeight"], 556 paddingLeft: ["paddingTop", "paddingRight"], 557 paddingRight: ["paddingBottom", "paddingLeft"], 558 width: ["height"], 559 left: ["top", "right"], 560 right: ["bottom", "left"], 561 x: ["y"], 562 X: ["Y"], 563 Y: ["X"], 564 ArrowLeft: ["ArrowUp", "ArrowRight"], 565 ArrowRight: ["ArrowDown", "ArrowLeft"] 566 }; 567 function Direction(Splide22, Components2, options) { 568 function resolve(prop, axisOnly) { 569 const { direction } = options; 570 const index = direction === RTL && !axisOnly ? 1 : direction === TTB ? 0 : -1; 571 return ORIENTATION_MAP[prop][index] || prop; 572 } 573 function orient(value) { 574 return value * (options.direction === RTL ? 1 : -1); 575 } 576 return { 577 resolve, 578 orient 579 }; 580 } 581 var CLASS_ROOT = PROJECT_CODE; 582 var CLASS_SLIDER = `${PROJECT_CODE}__slider`; 583 var CLASS_TRACK = `${PROJECT_CODE}__track`; 584 var CLASS_LIST = `${PROJECT_CODE}__list`; 585 var CLASS_SLIDE = `${PROJECT_CODE}__slide`; 586 var CLASS_CLONE = `${CLASS_SLIDE}--clone`; 587 var CLASS_CONTAINER = `${CLASS_SLIDE}__container`; 588 var CLASS_ARROWS = `${PROJECT_CODE}__arrows`; 589 var CLASS_ARROW = `${PROJECT_CODE}__arrow`; 590 var CLASS_ARROW_PREV = `${CLASS_ARROW}--prev`; 591 var CLASS_ARROW_NEXT = `${CLASS_ARROW}--next`; 592 var CLASS_PAGINATION = `${PROJECT_CODE}__pagination`; 593 var CLASS_PAGINATION_PAGE = `${CLASS_PAGINATION}__page`; 594 var CLASS_PROGRESS = `${PROJECT_CODE}__progress`; 595 var CLASS_PROGRESS_BAR = `${CLASS_PROGRESS}__bar`; 596 var CLASS_AUTOPLAY = `${PROJECT_CODE}__autoplay`; 597 var CLASS_PLAY = `${PROJECT_CODE}__play`; 598 var CLASS_PAUSE = `${PROJECT_CODE}__pause`; 599 var CLASS_SPINNER = `${PROJECT_CODE}__spinner`; 600 var CLASS_INITIALIZED = "is-initialized"; 601 var CLASS_ACTIVE = "is-active"; 602 var CLASS_PREV = "is-prev"; 603 var CLASS_NEXT = "is-next"; 604 var CLASS_VISIBLE = "is-visible"; 605 var CLASS_LOADING = "is-loading"; 606 var STATUS_CLASSES = [CLASS_ACTIVE, CLASS_VISIBLE, CLASS_PREV, CLASS_NEXT, CLASS_LOADING]; 607 var CLASSES = { 608 slide: CLASS_SLIDE, 609 clone: CLASS_CLONE, 610 arrows: CLASS_ARROWS, 611 arrow: CLASS_ARROW, 612 prev: CLASS_ARROW_PREV, 613 next: CLASS_ARROW_NEXT, 614 pagination: CLASS_PAGINATION, 615 page: CLASS_PAGINATION_PAGE, 616 spinner: CLASS_SPINNER 617 }; 618 function Elements(Splide22, Components2, options) { 619 const { on } = EventInterface(Splide22); 620 const { root } = Splide22; 621 const elements = {}; 622 const slides = []; 623 let classes; 624 let slider; 625 let track; 626 let list; 627 function setup() { 628 collect(); 629 identify(); 630 addClass(root, classes = getClasses()); 631 } 632 function mount() { 633 on(EVENT_REFRESH, refresh, DEFAULT_EVENT_PRIORITY - 2); 634 on(EVENT_UPDATED, update); 635 } 636 function destroy() { 637 [root, track, list].forEach((elm) => { 638 removeAttribute(elm, "style"); 639 }); 640 empty(slides); 641 removeClass(root, classes); 642 } 643 function refresh() { 644 destroy(); 645 setup(); 646 } 647 function update() { 648 removeClass(root, classes); 649 addClass(root, classes = getClasses()); 650 } 651 function collect() { 652 slider = child(root, `.${CLASS_SLIDER}`); 653 track = query(root, `.${CLASS_TRACK}`); 654 list = child(track, `.${CLASS_LIST}`); 655 assert(track && list, "A track/list element is missing."); 656 push(slides, children(list, `.${CLASS_SLIDE}:not(.${CLASS_CLONE})`)); 657 const autoplay = find2(`.${CLASS_AUTOPLAY}`); 658 const arrows = find2(`.${CLASS_ARROWS}`); 659 assign(elements, { 660 root, 661 slider, 662 track, 663 list, 664 slides, 665 arrows, 666 autoplay, 667 prev: query(arrows, `.${CLASS_ARROW_PREV}`), 668 next: query(arrows, `.${CLASS_ARROW_NEXT}`), 669 bar: query(find2(`.${CLASS_PROGRESS}`), `.${CLASS_PROGRESS_BAR}`), 670 play: query(autoplay, `.${CLASS_PLAY}`), 671 pause: query(autoplay, `.${CLASS_PAUSE}`) 672 }); 673 } 674 function identify() { 675 const id = root.id || uniqueId(PROJECT_CODE); 676 root.id = id; 677 track.id = track.id || `${id}-track`; 678 list.id = list.id || `${id}-list`; 679 } 680 function find2(selector) { 681 return child(root, selector) || child(slider, selector); 682 } 683 function getClasses() { 684 return [ 685 `${CLASS_ROOT}--${options.type}`, 686 `${CLASS_ROOT}--${options.direction}`, 687 options.drag && `${CLASS_ROOT}--draggable`, 688 options.isNavigation && `${CLASS_ROOT}--nav`, 689 CLASS_ACTIVE 690 ]; 691 } 692 return assign(elements, { 693 setup, 694 mount, 695 destroy 696 }); 697 } 698 var ROLE = "role"; 699 var ARIA_CONTROLS = "aria-controls"; 700 var ARIA_CURRENT = "aria-current"; 701 var ARIA_LABEL = "aria-label"; 702 var ARIA_HIDDEN = "aria-hidden"; 703 var TAB_INDEX = "tabindex"; 704 var DISABLED = "disabled"; 705 var ARIA_ORIENTATION = "aria-orientation"; 706 var ALL_ATTRIBUTES = [ 707 ROLE, 708 ARIA_CONTROLS, 709 ARIA_CURRENT, 710 ARIA_LABEL, 711 ARIA_HIDDEN, 712 ARIA_ORIENTATION, 713 TAB_INDEX, 714 DISABLED 715 ]; 716 var SLIDE = "slide"; 717 var LOOP = "loop"; 718 var FADE = "fade"; 719 function Slide$1(Splide22, index, slideIndex, slide) { 720 const { on, emit, bind, destroy: destroyEvents } = EventInterface(Splide22); 721 const { Components, root, options } = Splide22; 722 const { isNavigation, updateOnMove } = options; 723 const { resolve } = Components.Direction; 724 const styles = getAttribute(slide, "style"); 725 const isClone = slideIndex > -1; 726 const container = child(slide, `.${CLASS_CONTAINER}`); 727 const focusableNodes = options.focusableNodes && queryAll(slide, options.focusableNodes); 728 let destroyed; 729 function mount() { 730 if (!isClone) { 731 slide.id = `${root.id}-slide${pad(index + 1)}`; 732 } 733 bind(slide, "click keydown", (e) => { 734 emit(e.type === "click" ? EVENT_CLICK : EVENT_SLIDE_KEYDOWN, self, e); 735 }); 736 on([EVENT_REFRESH, EVENT_REPOSITIONED, EVENT_SHIFTED, EVENT_MOVED, EVENT_SCROLLED], update); 737 on(EVENT_NAVIGATION_MOUNTED, initNavigation); 738 if (updateOnMove) { 739 on(EVENT_MOVE, onMove); 740 } 741 } 742 function destroy() { 743 destroyed = true; 744 destroyEvents(); 745 removeClass(slide, STATUS_CLASSES); 746 removeAttribute(slide, ALL_ATTRIBUTES); 747 setAttribute(slide, "style", styles); 748 } 749 function initNavigation() { 750 const idx = isClone ? slideIndex : index; 751 const label = format(options.i18n.slideX, idx + 1); 752 const controls = Splide22.splides.map((target) => target.splide.root.id).join(" "); 753 setAttribute(slide, ARIA_LABEL, label); 754 setAttribute(slide, ARIA_CONTROLS, controls); 755 setAttribute(slide, ROLE, "menuitem"); 756 updateActivity(isActive()); 757 } 758 function onMove() { 759 if (!destroyed) { 760 update(); 761 } 762 } 763 function update() { 764 if (!destroyed) { 765 const { index: currIndex } = Splide22; 766 updateActivity(isActive()); 767 updateVisibility(isVisible()); 768 toggleClass(slide, CLASS_PREV, index === currIndex - 1); 769 toggleClass(slide, CLASS_NEXT, index === currIndex + 1); 770 } 771 } 772 function updateActivity(active) { 773 if (active !== hasClass(slide, CLASS_ACTIVE)) { 774 toggleClass(slide, CLASS_ACTIVE, active); 775 if (isNavigation) { 776 setAttribute(slide, ARIA_CURRENT, active || null); 777 } 778 emit(active ? EVENT_ACTIVE : EVENT_INACTIVE, self); 779 } 780 } 781 function updateVisibility(visible) { 782 const hidden = !visible && (!isActive() || isClone); 783 setAttribute(slide, ARIA_HIDDEN, hidden || null); 784 setAttribute(slide, TAB_INDEX, !hidden && options.slideFocus ? 0 : null); 785 if (focusableNodes) { 786 focusableNodes.forEach((node) => { 787 setAttribute(node, TAB_INDEX, hidden ? -1 : null); 788 }); 789 } 790 if (visible !== hasClass(slide, CLASS_VISIBLE)) { 791 toggleClass(slide, CLASS_VISIBLE, visible); 792 emit(visible ? EVENT_VISIBLE : EVENT_HIDDEN, self); 793 } 794 } 795 function style$1(prop, value, useContainer) { 796 style(useContainer && container || slide, prop, value); 797 } 798 function isActive() { 799 const { index: curr } = Splide22; 800 return curr === index || options.cloneStatus && curr === slideIndex; 801 } 802 function isVisible() { 803 if (Splide22.is(FADE)) { 804 return isActive(); 805 } 806 const trackRect = rect(Components.Elements.track); 807 const slideRect = rect(slide); 808 const left = resolve("left"); 809 const right = resolve("right"); 810 return floor(trackRect[left]) <= ceil(slideRect[left]) && floor(slideRect[right]) <= ceil(trackRect[right]); 811 } 812 function isWithin(from, distance) { 813 let diff = abs(from - index); 814 if (!isClone && (options.rewind || Splide22.is(LOOP))) { 815 diff = min(diff, Splide22.length - diff); 816 } 817 return diff <= distance; 818 } 819 const self = { 820 index, 821 slideIndex, 822 slide, 823 container, 824 isClone, 825 mount, 826 destroy, 827 update, 828 style: style$1, 829 isWithin 830 }; 831 return self; 832 } 833 function Slides(Splide22, Components2, options) { 834 const { on, emit, bind } = EventInterface(Splide22); 835 const { slides, list } = Components2.Elements; 836 const Slides2 = []; 837 function mount() { 838 init(); 839 on(EVENT_REFRESH, refresh); 840 on([EVENT_MOUNTED, EVENT_REFRESH], () => { 841 Slides2.sort((Slide1, Slide2) => Slide1.index - Slide2.index); 842 }); 843 } 844 function init() { 845 slides.forEach((slide, index) => { 846 register(slide, index, -1); 847 }); 848 } 849 function destroy() { 850 forEach$1((Slide2) => { 851 Slide2.destroy(); 852 }); 853 empty(Slides2); 854 } 855 function refresh() { 856 destroy(); 857 init(); 858 } 859 function update() { 860 forEach$1((Slide2) => { 861 Slide2.update(); 862 }); 863 } 864 function register(slide, index, slideIndex) { 865 const object = Slide$1(Splide22, index, slideIndex, slide); 866 object.mount(); 867 Slides2.push(object); 868 } 869 function get(excludeClones) { 870 return excludeClones ? filter((Slide2) => !Slide2.isClone) : Slides2; 871 } 872 function getIn(page) { 873 const { Controller: Controller2 } = Components2; 874 const index = Controller2.toIndex(page); 875 const max2 = Controller2.hasFocus() ? 1 : options.perPage; 876 return filter((Slide2) => between(Slide2.index, index, index + max2 - 1)); 877 } 878 function getAt(index) { 879 return filter(index)[0]; 880 } 881 function add(items, index) { 882 forEach(items, (slide) => { 883 if (isString(slide)) { 884 slide = parseHtml(slide); 885 } 886 if (isHTMLElement(slide)) { 887 const ref = slides[index]; 888 ref ? before(slide, ref) : append(list, slide); 889 addClass(slide, options.classes.slide); 890 observeImages(slide, emit.bind(null, EVENT_RESIZE)); 891 } 892 }); 893 emit(EVENT_REFRESH); 894 } 895 function remove$1(matcher) { 896 remove(filter(matcher).map((Slide2) => Slide2.slide)); 897 emit(EVENT_REFRESH); 898 } 899 function forEach$1(iteratee, excludeClones) { 900 get(excludeClones).forEach(iteratee); 901 } 902 function filter(matcher) { 903 return Slides2.filter(isFunction(matcher) ? matcher : (Slide2) => isString(matcher) ? matches(Slide2.slide, matcher) : includes(toArray(matcher), Slide2.index)); 904 } 905 function style2(prop, value, useContainer) { 906 forEach$1((Slide2) => { 907 Slide2.style(prop, value, useContainer); 908 }); 909 } 910 function observeImages(elm, callback) { 911 const images = queryAll(elm, "img"); 912 let { length } = images; 913 if (length) { 914 images.forEach((img) => { 915 bind(img, "load error", () => { 916 if (!--length) { 917 callback(); 918 } 919 }); 920 }); 921 } else { 922 callback(); 923 } 924 } 925 function getLength(excludeClones) { 926 return excludeClones ? slides.length : Slides2.length; 927 } 928 function isEnough() { 929 return Slides2.length > options.perPage; 930 } 931 return { 932 mount, 933 destroy, 934 update, 935 register, 936 get, 937 getIn, 938 getAt, 939 add, 940 remove: remove$1, 941 forEach: forEach$1, 942 filter, 943 style: style2, 944 getLength, 945 isEnough 946 }; 947 } 948 function Layout(Splide22, Components2, options) { 949 const { on, bind, emit } = EventInterface(Splide22); 950 const { Slides: Slides2 } = Components2; 951 const { resolve } = Components2.Direction; 952 const { root, track, list } = Components2.Elements; 953 const { getAt } = Slides2; 954 let vertical; 955 let rootRect; 956 function mount() { 957 init(); 958 bind(window, "resize load", Throttle(emit.bind(this, EVENT_RESIZE))); 959 on([EVENT_UPDATED, EVENT_REFRESH], init); 960 on(EVENT_RESIZE, resize); 961 } 962 function init() { 963 rootRect = null; 964 vertical = options.direction === TTB; 965 style(root, "maxWidth", unit(options.width)); 966 style(track, resolve("paddingLeft"), cssPadding(false)); 967 style(track, resolve("paddingRight"), cssPadding(true)); 968 resize(); 969 } 970 function resize() { 971 const newRect = rect(root); 972 if (!rootRect || rootRect.width !== newRect.width || rootRect.height !== newRect.height) { 973 style(track, "height", cssTrackHeight()); 974 Slides2.style(resolve("marginRight"), unit(options.gap)); 975 Slides2.style("width", cssSlideWidth() || null); 976 setSlidesHeight(); 977 rootRect = newRect; 978 emit(EVENT_RESIZED); 979 } 980 } 981 function setSlidesHeight() { 982 Slides2.style("height", cssSlideHeight() || null, true); 983 } 984 function cssPadding(right) { 985 const { padding } = options; 986 const prop = resolve(right ? "right" : "left"); 987 return padding && unit(padding[prop] || (isObject(padding) ? 0 : padding)) || "0px"; 988 } 989 function cssTrackHeight() { 990 let height = ""; 991 if (vertical) { 992 height = cssHeight(); 993 assert(height, "height or heightRatio is missing."); 994 height = `calc(${height} - ${cssPadding(false)} - ${cssPadding(true)})`; 995 } 996 return height; 997 } 998 function cssHeight() { 999 return unit(options.height || rect(list).width * options.heightRatio); 1000 } 1001 function cssSlideWidth() { 1002 return options.autoWidth ? "" : unit(options.fixedWidth) || (vertical ? "" : cssSlideSize()); 1003 } 1004 function cssSlideHeight() { 1005 return unit(options.fixedHeight) || (vertical ? options.autoHeight ? "" : cssSlideSize() : cssHeight()); 1006 } 1007 function cssSlideSize() { 1008 const gap = unit(options.gap); 1009 return `calc((100%${gap && ` + ${gap}`})/${options.perPage || 1}${gap && ` - ${gap}`})`; 1010 } 1011 function listSize() { 1012 return rect(list)[resolve("width")]; 1013 } 1014 function slideSize(index, withoutGap) { 1015 const Slide2 = getAt(index || 0); 1016 return Slide2 ? rect(Slide2.slide)[resolve("width")] + (withoutGap ? 0 : getGap()) : 0; 1017 } 1018 function totalSize(index, withoutGap) { 1019 const Slide2 = getAt(index); 1020 if (Slide2) { 1021 const right = rect(Slide2.slide)[resolve("right")]; 1022 const left = rect(list)[resolve("left")]; 1023 return abs(right - left) + (withoutGap ? 0 : getGap()); 1024 } 1025 return 0; 1026 } 1027 function sliderSize() { 1028 return totalSize(Splide22.length - 1, true) - totalSize(-1, true); 1029 } 1030 function getGap() { 1031 const Slide2 = getAt(0); 1032 return Slide2 && parseFloat(style(Slide2.slide, resolve("marginRight"))) || 0; 1033 } 1034 function getPadding(right) { 1035 return parseFloat(style(track, resolve(`padding${right ? "Right" : "Left"}`))) || 0; 1036 } 1037 return { 1038 mount, 1039 listSize, 1040 slideSize, 1041 sliderSize, 1042 totalSize, 1043 getPadding 1044 }; 1045 } 1046 function Clones(Splide22, Components2, options) { 1047 const { on, emit } = EventInterface(Splide22); 1048 const { Elements: Elements2, Slides: Slides2 } = Components2; 1049 const { resolve } = Components2.Direction; 1050 const clones = []; 1051 let cloneCount; 1052 function mount() { 1053 init(); 1054 on(EVENT_REFRESH, refresh); 1055 on([EVENT_UPDATED, EVENT_RESIZE], observe); 1056 } 1057 function init() { 1058 if (cloneCount = computeCloneCount()) { 1059 generate(cloneCount); 1060 emit(EVENT_RESIZE); 1061 } 1062 } 1063 function destroy() { 1064 remove(clones); 1065 empty(clones); 1066 } 1067 function refresh() { 1068 destroy(); 1069 init(); 1070 } 1071 function observe() { 1072 if (cloneCount < computeCloneCount()) { 1073 emit(EVENT_REFRESH); 1074 } 1075 } 1076 function generate(count) { 1077 const slides = Slides2.get().slice(); 1078 const { length } = slides; 1079 if (length) { 1080 while (slides.length < count) { 1081 push(slides, slides); 1082 } 1083 push(slides.slice(-count), slides.slice(0, count)).forEach((Slide2, index) => { 1084 const isHead = index < count; 1085 const clone = cloneDeep(Slide2.slide, index); 1086 isHead ? before(clone, slides[0].slide) : append(Elements2.list, clone); 1087 push(clones, clone); 1088 Slides2.register(clone, index - count + (isHead ? 0 : length), Slide2.index); 1089 }); 1090 } 1091 } 1092 function cloneDeep(elm, index) { 1093 const clone = elm.cloneNode(true); 1094 addClass(clone, options.classes.clone); 1095 clone.id = `${Splide22.root.id}-clone${pad(index + 1)}`; 1096 return clone; 1097 } 1098 function computeCloneCount() { 1099 let { clones: clones2 } = options; 1100 if (!Splide22.is(LOOP)) { 1101 clones2 = 0; 1102 } else if (!clones2) { 1103 const fixedSize = measure(Elements2.list, options[resolve("fixedWidth")]); 1104 const fixedCount = fixedSize && ceil(rect(Elements2.track)[resolve("width")] / fixedSize); 1105 const baseCount = fixedCount || options[resolve("autoWidth")] && Splide22.length || options.perPage; 1106 clones2 = baseCount * (options.drag ? (options.flickMaxPages || 1) + 1 : 2); 1107 } 1108 return clones2; 1109 } 1110 return { 1111 mount, 1112 destroy 1113 }; 1114 } 1115 function Move(Splide22, Components2, options) { 1116 const { on, emit } = EventInterface(Splide22); 1117 const { slideSize, getPadding, totalSize, listSize, sliderSize } = Components2.Layout; 1118 const { resolve, orient } = Components2.Direction; 1119 const { list, track } = Components2.Elements; 1120 let Transition; 1121 function mount() { 1122 Transition = Components2.Transition; 1123 on([EVENT_MOUNTED, EVENT_RESIZED, EVENT_UPDATED, EVENT_REFRESH], reposition); 1124 } 1125 function destroy() { 1126 removeAttribute(list, "style"); 1127 } 1128 function reposition() { 1129 if (!isBusy()) { 1130 Components2.Scroll.cancel(); 1131 jump(Splide22.index); 1132 emit(EVENT_REPOSITIONED); 1133 } 1134 } 1135 function move(dest, index, prev, callback) { 1136 if (!isBusy()) { 1137 const { set } = Splide22.state; 1138 const position = getPosition(); 1139 if (dest !== index) { 1140 Transition.cancel(); 1141 translate(shift(position, dest > index), true); 1142 } 1143 set(MOVING); 1144 emit(EVENT_MOVE, index, prev, dest); 1145 Transition.start(index, () => { 1146 set(IDLE); 1147 emit(EVENT_MOVED, index, prev, dest); 1148 if (options.trimSpace === "move" && dest !== prev && position === getPosition()) { 1149 Components2.Controller.go(dest > prev ? ">" : "<", false, callback); 1150 } else { 1151 callback && callback(); 1152 } 1153 }); 1154 } 1155 } 1156 function jump(index) { 1157 translate(toPosition(index, true)); 1158 } 1159 function translate(position, preventLoop) { 1160 if (!Splide22.is(FADE)) { 1161 const destination = preventLoop ? position : loop(position); 1162 list.style.transform = `translate${resolve("X")}(${destination}px)`; 1163 position !== destination && emit(EVENT_SHIFTED); 1164 } 1165 } 1166 function loop(position) { 1167 if (Splide22.is(LOOP)) { 1168 const diff = orient(position - getPosition()); 1169 const exceededMin = exceededLimit(false, position) && diff < 0; 1170 const exceededMax = exceededLimit(true, position) && diff > 0; 1171 if (exceededMin || exceededMax) { 1172 position = shift(position, exceededMax); 1173 } 1174 } 1175 return position; 1176 } 1177 function shift(position, backwards) { 1178 const excess = position - getLimit(backwards); 1179 const size = sliderSize(); 1180 position -= orient(size * (ceil(abs(excess) / size) || 1)) * (backwards ? 1 : -1); 1181 return position; 1182 } 1183 function cancel() { 1184 translate(getPosition()); 1185 Transition.cancel(); 1186 } 1187 function toIndex(position) { 1188 const Slides2 = Components2.Slides.get(); 1189 let index = 0; 1190 let minDistance = Infinity; 1191 for (let i = 0; i < Slides2.length; i++) { 1192 const slideIndex = Slides2[i].index; 1193 const distance = abs(toPosition(slideIndex, true) - position); 1194 if (distance <= minDistance) { 1195 minDistance = distance; 1196 index = slideIndex; 1197 } else { 1198 break; 1199 } 1200 } 1201 return index; 1202 } 1203 function toPosition(index, trimming) { 1204 const position = orient(totalSize(index - 1) - offset(index)); 1205 return trimming ? trim(position) : position; 1206 } 1207 function getPosition() { 1208 const left = resolve("left"); 1209 return rect(list)[left] - rect(track)[left] + orient(getPadding(false)); 1210 } 1211 function trim(position) { 1212 if (options.trimSpace && Splide22.is(SLIDE)) { 1213 position = clamp(position, 0, orient(sliderSize() - listSize())); 1214 } 1215 return position; 1216 } 1217 function offset(index) { 1218 const { focus: focus2 } = options; 1219 return focus2 === "center" ? (listSize() - slideSize(index, true)) / 2 : +focus2 * slideSize(index) || 0; 1220 } 1221 function getLimit(max2) { 1222 return toPosition(max2 ? Components2.Controller.getEnd() : 0, !!options.trimSpace); 1223 } 1224 function isBusy() { 1225 return Splide22.state.is(MOVING) && options.waitForTransition; 1226 } 1227 function exceededLimit(max2, position) { 1228 position = isUndefined(position) ? getPosition() : position; 1229 const exceededMin = max2 !== true && orient(position) < orient(getLimit(false)); 1230 const exceededMax = max2 !== false && orient(position) > orient(getLimit(true)); 1231 return exceededMin || exceededMax; 1232 } 1233 return { 1234 mount, 1235 destroy, 1236 move, 1237 jump, 1238 translate, 1239 shift, 1240 cancel, 1241 toIndex, 1242 toPosition, 1243 getPosition, 1244 getLimit, 1245 isBusy, 1246 exceededLimit 1247 }; 1248 } 1249 function Controller(Splide22, Components2, options) { 1250 const { on } = EventInterface(Splide22); 1251 const { Move: Move2 } = Components2; 1252 const { getPosition, getLimit } = Move2; 1253 const { isEnough, getLength } = Components2.Slides; 1254 const isLoop = Splide22.is(LOOP); 1255 const isSlide = Splide22.is(SLIDE); 1256 let currIndex = options.start || 0; 1257 let prevIndex = currIndex; 1258 let slideCount; 1259 let perMove; 1260 let perPage; 1261 function mount() { 1262 init(); 1263 on([EVENT_UPDATED, EVENT_REFRESH], init, DEFAULT_EVENT_PRIORITY - 1); 1264 } 1265 function init() { 1266 slideCount = getLength(true); 1267 perMove = options.perMove; 1268 perPage = options.perPage; 1269 currIndex = clamp(currIndex, 0, slideCount - 1); 1270 } 1271 function go(control, allowSameIndex, callback) { 1272 const dest = parse(control); 1273 if (options.useScroll) { 1274 scroll(dest, true, true, options.speed, callback); 1275 } else { 1276 const index = loop(dest); 1277 if (index > -1 && !Move2.isBusy() && (allowSameIndex || index !== currIndex)) { 1278 setIndex(index); 1279 Move2.move(dest, index, prevIndex, callback); 1280 } 1281 } 1282 } 1283 function scroll(destination, useIndex, snap, duration, callback) { 1284 const dest = useIndex ? destination : toDest(destination); 1285 Components2.Scroll.scroll(useIndex || snap ? Move2.toPosition(dest, true) : destination, duration, () => { 1286 setIndex(Move2.toIndex(Move2.getPosition())); 1287 callback && callback(); 1288 }); 1289 } 1290 function parse(control) { 1291 let index = currIndex; 1292 if (isString(control)) { 1293 const [, indicator, number] = control.match(/([+\-<>])(\d+)?/) || []; 1294 if (indicator === "+" || indicator === "-") { 1295 index = computeDestIndex(currIndex + +`${indicator}${+number || 1}`, currIndex, true); 1296 } else if (indicator === ">") { 1297 index = number ? toIndex(+number) : getNext(true); 1298 } else if (indicator === "<") { 1299 index = getPrev(true); 1300 } 1301 } else { 1302 index = isLoop ? control : clamp(control, 0, getEnd()); 1303 } 1304 return index; 1305 } 1306 function getNext(destination) { 1307 return getAdjacent(false, destination); 1308 } 1309 function getPrev(destination) { 1310 return getAdjacent(true, destination); 1311 } 1312 function getAdjacent(prev, destination) { 1313 const number = perMove || (hasFocus() ? 1 : perPage); 1314 const dest = computeDestIndex(currIndex + number * (prev ? -1 : 1), currIndex); 1315 if (dest === -1 && isSlide) { 1316 if (!approximatelyEqual(getPosition(), getLimit(!prev), 1)) { 1317 return prev ? 0 : getEnd(); 1318 } 1319 } 1320 return destination ? dest : loop(dest); 1321 } 1322 function computeDestIndex(dest, from, incremental) { 1323 if (isEnough()) { 1324 const end = getEnd(); 1325 if (dest < 0 || dest > end) { 1326 if (between(0, dest, from, true) || between(end, from, dest, true)) { 1327 dest = toIndex(toPage(dest)); 1328 } else { 1329 if (isLoop) { 1330 dest = perMove || hasFocus() ? dest : dest < 0 ? -(slideCount % perPage || perPage) : slideCount; 1331 } else if (options.rewind) { 1332 dest = dest < 0 ? end : 0; 1333 } else { 1334 dest = -1; 1335 } 1336 } 1337 } else { 1338 if (!incremental && dest !== from) { 1339 dest = perMove ? dest : toIndex(toPage(from) + (dest < from ? -1 : 1)); 1340 } 1341 } 1342 } else { 1343 dest = -1; 1344 } 1345 return dest; 1346 } 1347 function getEnd() { 1348 let end = slideCount - perPage; 1349 if (hasFocus() || isLoop && perMove) { 1350 end = slideCount - 1; 1351 } 1352 return max(end, 0); 1353 } 1354 function loop(index) { 1355 if (isLoop) { 1356 return isEnough() ? index % slideCount + (index < 0 ? slideCount : 0) : -1; 1357 } 1358 return index; 1359 } 1360 function toIndex(page) { 1361 return clamp(hasFocus() ? page : perPage * page, 0, getEnd()); 1362 } 1363 function toPage(index) { 1364 if (!hasFocus()) { 1365 index = between(index, slideCount - perPage, slideCount - 1) ? slideCount - 1 : index; 1366 index = floor(index / perPage); 1367 } 1368 return index; 1369 } 1370 function toDest(destination) { 1371 const closest = Move2.toIndex(destination); 1372 return isSlide ? clamp(closest, 0, getEnd()) : closest; 1373 } 1374 function setIndex(index) { 1375 if (index !== currIndex) { 1376 prevIndex = currIndex; 1377 currIndex = index; 1378 } 1379 } 1380 function getIndex(prev) { 1381 return prev ? prevIndex : currIndex; 1382 } 1383 function hasFocus() { 1384 return !isUndefined(options.focus) || options.isNavigation; 1385 } 1386 return { 1387 mount, 1388 go, 1389 scroll, 1390 getNext, 1391 getPrev, 1392 getAdjacent, 1393 getEnd, 1394 setIndex, 1395 getIndex, 1396 toIndex, 1397 toPage, 1398 toDest, 1399 hasFocus 1400 }; 1401 } 1402 var XML_NAME_SPACE = "http://www.w3.org/2000/svg"; 1403 var PATH = "m15.5 0.932-4.3 4.38 14.5 14.6-14.5 14.5 4.3 4.4 14.6-14.6 4.4-4.3-4.4-4.4-14.6-14.6z"; 1404 var SIZE = 40; 1405 function Arrows(Splide22, Components2, options) { 1406 const { on, bind, emit } = EventInterface(Splide22); 1407 const { classes, i18n } = options; 1408 const { Elements: Elements2, Controller: Controller2 } = Components2; 1409 let wrapper = Elements2.arrows; 1410 let prev = Elements2.prev; 1411 let next = Elements2.next; 1412 let created; 1413 const arrows = {}; 1414 function mount() { 1415 init(); 1416 on(EVENT_UPDATED, init); 1417 } 1418 function init() { 1419 if (options.arrows) { 1420 if (!prev || !next) { 1421 createArrows(); 1422 } 1423 } 1424 if (prev && next) { 1425 if (!arrows.prev) { 1426 const { id } = Elements2.track; 1427 setAttribute(prev, ARIA_CONTROLS, id); 1428 setAttribute(next, ARIA_CONTROLS, id); 1429 arrows.prev = prev; 1430 arrows.next = next; 1431 listen(); 1432 emit(EVENT_ARROWS_MOUNTED, prev, next); 1433 } else { 1434 display(wrapper, options.arrows === false ? "none" : ""); 1435 } 1436 } 1437 } 1438 function destroy() { 1439 if (created) { 1440 remove(wrapper); 1441 } else { 1442 removeAttribute(prev, ALL_ATTRIBUTES); 1443 removeAttribute(next, ALL_ATTRIBUTES); 1444 } 1445 } 1446 function listen() { 1447 const { go } = Controller2; 1448 on([EVENT_MOUNTED, EVENT_MOVED, EVENT_UPDATED, EVENT_REFRESH, EVENT_SCROLLED], update); 1449 bind(next, "click", () => { 1450 go(">", true); 1451 }); 1452 bind(prev, "click", () => { 1453 go("<", true); 1454 }); 1455 } 1456 function createArrows() { 1457 wrapper = create("div", classes.arrows); 1458 prev = createArrow(true); 1459 next = createArrow(false); 1460 created = true; 1461 append(wrapper, [prev, next]); 1462 before(wrapper, child(options.arrows === "slider" && Elements2.slider || Splide22.root)); 1463 } 1464 function createArrow(prev2) { 1465 const arrow = `<button class="${classes.arrow} ${prev2 ? classes.prev : classes.next}" type="button"><svg xmlns="${XML_NAME_SPACE}" viewBox="0 0 ${SIZE} ${SIZE}" width="${SIZE}" height="${SIZE}"><path d="${options.arrowPath || PATH}" />`; 1466 return parseHtml(arrow); 1467 } 1468 function update() { 1469 const index = Splide22.index; 1470 const prevIndex = Controller2.getPrev(); 1471 const nextIndex = Controller2.getNext(); 1472 const prevLabel = prevIndex > -1 && index < prevIndex ? i18n.last : i18n.prev; 1473 const nextLabel = nextIndex > -1 && index > nextIndex ? i18n.first : i18n.next; 1474 prev.disabled = prevIndex < 0; 1475 next.disabled = nextIndex < 0; 1476 setAttribute(prev, ARIA_LABEL, prevLabel); 1477 setAttribute(next, ARIA_LABEL, nextLabel); 1478 emit(EVENT_ARROWS_UPDATED, prev, next, prevIndex, nextIndex); 1479 } 1480 return { 1481 arrows, 1482 mount, 1483 destroy 1484 }; 1485 } 1486 var INTERVAL_DATA_ATTRIBUTE = `${DATA_ATTRIBUTE}-interval`; 1487 function Autoplay(Splide22, Components2, options) { 1488 const { on, bind, emit } = EventInterface(Splide22); 1489 const interval = RequestInterval(options.interval, Splide22.go.bind(Splide22, ">"), update); 1490 const { isPaused } = interval; 1491 const { Elements: Elements2 } = Components2; 1492 let hovered; 1493 let focused; 1494 let paused; 1495 function mount() { 1496 const { autoplay } = options; 1497 if (autoplay) { 1498 initButton(true); 1499 initButton(false); 1500 listen(); 1501 if (autoplay !== "pause") { 1502 play(); 1503 } 1504 } 1505 } 1506 function initButton(forPause) { 1507 const prop = forPause ? "pause" : "play"; 1508 const button = Elements2[prop]; 1509 if (button) { 1510 setAttribute(button, ARIA_CONTROLS, Elements2.track.id); 1511 setAttribute(button, ARIA_LABEL, options.i18n[prop]); 1512 bind(button, "click", forPause ? pause : play); 1513 } 1514 } 1515 function listen() { 1516 const { root } = Elements2; 1517 if (options.pauseOnHover) { 1518 bind(root, "mouseenter mouseleave", (e) => { 1519 hovered = e.type === "mouseenter"; 1520 autoToggle(); 1521 }); 1522 } 1523 if (options.pauseOnFocus) { 1524 bind(root, "focusin focusout", (e) => { 1525 focused = e.type === "focusin"; 1526 autoToggle(); 1527 }); 1528 } 1529 on([EVENT_MOVE, EVENT_SCROLL, EVENT_REFRESH], interval.rewind); 1530 on(EVENT_MOVE, updateInterval); 1531 } 1532 function play() { 1533 if (isPaused() && Components2.Slides.isEnough()) { 1534 interval.start(!options.resetProgress); 1535 focused = hovered = paused = false; 1536 emit(EVENT_AUTOPLAY_PLAY); 1537 } 1538 } 1539 function pause(manual = true) { 1540 if (!isPaused()) { 1541 interval.pause(); 1542 emit(EVENT_AUTOPLAY_PAUSE); 1543 } 1544 paused = manual; 1545 } 1546 function autoToggle() { 1547 if (!paused) { 1548 if (!hovered && !focused) { 1549 play(); 1550 } else { 1551 pause(false); 1552 } 1553 } 1554 } 1555 function update(rate) { 1556 const { bar } = Elements2; 1557 bar && style(bar, "width", `${rate * 100}%`); 1558 emit(EVENT_AUTOPLAY_PLAYING, rate); 1559 } 1560 function updateInterval() { 1561 const Slide2 = Components2.Slides.getAt(Splide22.index); 1562 interval.set(Slide2 && +getAttribute(Slide2.slide, INTERVAL_DATA_ATTRIBUTE) || options.interval); 1563 } 1564 return { 1565 mount, 1566 destroy: interval.cancel, 1567 play, 1568 pause, 1569 isPaused 1570 }; 1571 } 1572 function Cover(Splide22, Components2, options) { 1573 const { on } = EventInterface(Splide22); 1574 function mount() { 1575 if (options.cover) { 1576 on(EVENT_LAZYLOAD_LOADED, (img, Slide2) => { 1577 toggle(true, img, Slide2); 1578 }); 1579 on([EVENT_MOUNTED, EVENT_UPDATED, EVENT_REFRESH], apply.bind(null, true)); 1580 } 1581 } 1582 function destroy() { 1583 apply(false); 1584 } 1585 function apply(cover) { 1586 Components2.Slides.forEach((Slide2) => { 1587 const img = child(Slide2.container || Slide2.slide, "img"); 1588 if (img && img.src) { 1589 toggle(cover, img, Slide2); 1590 } 1591 }); 1592 } 1593 function toggle(cover, img, Slide2) { 1594 Slide2.style("background", cover ? `center/cover no-repeat url("${img.src}")` : "", true); 1595 display(img, cover ? "none" : ""); 1596 } 1597 return { 1598 mount, 1599 destroy 1600 }; 1601 } 1602 var BOUNCE_DIFF_THRESHOLD = 10; 1603 var BOUNCE_DURATION = 600; 1604 var FRICTION_FACTOR = 0.6; 1605 var BASE_VELOCITY = 1.5; 1606 var MIN_DURATION = 800; 1607 function Scroll(Splide22, Components2, options) { 1608 const { on, emit } = EventInterface(Splide22); 1609 const { Move: Move2 } = Components2; 1610 const { getPosition, getLimit, exceededLimit } = Move2; 1611 let interval; 1612 let scrollCallback; 1613 function mount() { 1614 on(EVENT_MOVE, clear); 1615 on([EVENT_UPDATED, EVENT_REFRESH], cancel); 1616 } 1617 function scroll(destination, duration, callback, suppressConstraint) { 1618 const start = getPosition(); 1619 let friction = 1; 1620 duration = duration || computeDuration(abs(destination - start)); 1621 scrollCallback = callback; 1622 clear(); 1623 interval = RequestInterval(duration, onScrolled, (rate) => { 1624 const position = getPosition(); 1625 const target = start + (destination - start) * easing(rate); 1626 const diff = (target - getPosition()) * friction; 1627 Move2.translate(position + diff); 1628 if (Splide22.is(SLIDE) && !suppressConstraint && exceededLimit()) { 1629 friction *= FRICTION_FACTOR; 1630 if (abs(diff) < BOUNCE_DIFF_THRESHOLD) { 1631 bounce(exceededLimit(false)); 1632 } 1633 } 1634 }, 1); 1635 emit(EVENT_SCROLL); 1636 interval.start(); 1637 } 1638 function bounce(backwards) { 1639 scroll(getLimit(!backwards), BOUNCE_DURATION, null, true); 1640 } 1641 function onScrolled() { 1642 const position = getPosition(); 1643 const index = Move2.toIndex(position); 1644 if (!between(index, 0, Splide22.length - 1)) { 1645 Move2.translate(Move2.shift(position, index > 0), true); 1646 } 1647 scrollCallback && scrollCallback(); 1648 emit(EVENT_SCROLLED); 1649 } 1650 function computeDuration(distance) { 1651 return max(distance / BASE_VELOCITY, MIN_DURATION); 1652 } 1653 function clear() { 1654 if (interval) { 1655 interval.cancel(); 1656 } 1657 } 1658 function cancel() { 1659 if (interval && !interval.isPaused()) { 1660 clear(); 1661 onScrolled(); 1662 } 1663 } 1664 function easing(t) { 1665 const { easingFunc } = options; 1666 return easingFunc ? easingFunc(t) : 1 - Math.pow(1 - t, 4); 1667 } 1668 return { 1669 mount, 1670 destroy: clear, 1671 scroll, 1672 cancel 1673 }; 1674 } 1675 var SCROLL_LISTENER_OPTIONS = { passive: false, capture: true }; 1676 var FRICTION = 5; 1677 var LOG_INTERVAL = 200; 1678 var POINTER_DOWN_EVENTS = "touchstart mousedown"; 1679 var POINTER_MOVE_EVENTS = "touchmove mousemove"; 1680 var POINTER_UP_EVENTS = "touchend touchcancel mouseup"; 1681 function Drag(Splide22, Components2, options) { 1682 const { on, emit, bind, unbind } = EventInterface(Splide22); 1683 const { Move: Move2, Scroll: Scroll2, Controller: Controller2 } = Components2; 1684 const { track } = Components2.Elements; 1685 const { resolve, orient } = Components2.Direction; 1686 const { getPosition, exceededLimit } = Move2; 1687 let basePosition; 1688 let baseEvent; 1689 let prevBaseEvent; 1690 let lastEvent; 1691 let isFree; 1692 let dragging; 1693 let hasExceeded = false; 1694 let clickPrevented; 1695 let disabled; 1696 let target; 1697 function mount() { 1698 bind(track, POINTER_MOVE_EVENTS, noop, SCROLL_LISTENER_OPTIONS); 1699 bind(track, POINTER_UP_EVENTS, noop, SCROLL_LISTENER_OPTIONS); 1700 bind(track, POINTER_DOWN_EVENTS, onPointerDown, SCROLL_LISTENER_OPTIONS); 1701 bind(track, "click", onClick, { capture: true }); 1702 bind(track, "dragstart", prevent); 1703 on([EVENT_MOUNTED, EVENT_UPDATED], init); 1704 } 1705 function init() { 1706 const { drag } = options; 1707 disable(!drag); 1708 isFree = drag === "free"; 1709 } 1710 function onPointerDown(e) { 1711 if (!disabled) { 1712 const { noDrag } = options; 1713 const isTouch = isTouchEvent(e); 1714 const isDraggable = !noDrag || !matches(e.target, noDrag); 1715 clickPrevented = false; 1716 if (isDraggable && (isTouch || !e.button)) { 1717 if (!Move2.isBusy()) { 1718 target = isTouch ? track : window; 1719 prevBaseEvent = null; 1720 lastEvent = null; 1721 bind(target, POINTER_MOVE_EVENTS, onPointerMove, SCROLL_LISTENER_OPTIONS); 1722 bind(target, POINTER_UP_EVENTS, onPointerUp, SCROLL_LISTENER_OPTIONS); 1723 Move2.cancel(); 1724 Scroll2.cancel(); 1725 save(e); 1726 } else { 1727 prevent(e, true); 1728 } 1729 } 1730 } 1731 } 1732 function onPointerMove(e) { 1733 if (!lastEvent) { 1734 emit(EVENT_DRAG); 1735 } 1736 lastEvent = e; 1737 if (e.cancelable) { 1738 const diff = coordOf(e) - coordOf(baseEvent); 1739 if (dragging) { 1740 Move2.translate(basePosition + constrain(diff)); 1741 const expired = timeOf(e) - timeOf(baseEvent) > LOG_INTERVAL; 1742 const exceeded = hasExceeded !== (hasExceeded = exceededLimit()); 1743 if (expired || exceeded) { 1744 save(e); 1745 } 1746 emit(EVENT_DRAGGING); 1747 clickPrevented = true; 1748 prevent(e); 1749 } else { 1750 let { dragMinThreshold: thresholds } = options; 1751 thresholds = isObject(thresholds) ? thresholds : { mouse: 0, touch: +thresholds || 10 }; 1752 dragging = abs(diff) > (isTouchEvent(e) ? thresholds.touch : thresholds.mouse); 1753 if (isSliderDirection()) { 1754 prevent(e); 1755 } 1756 } 1757 } 1758 } 1759 function onPointerUp(e) { 1760 unbind(target, POINTER_MOVE_EVENTS, onPointerMove); 1761 unbind(target, POINTER_UP_EVENTS, onPointerUp); 1762 const { index } = Splide22; 1763 if (lastEvent) { 1764 if (dragging || e.cancelable && isSliderDirection()) { 1765 const velocity = computeVelocity(e); 1766 const destination = computeDestination(velocity); 1767 if (isFree) { 1768 Controller2.scroll(destination); 1769 } else if (Splide22.is(FADE)) { 1770 Controller2.go(index + orient(sign(velocity))); 1771 } else { 1772 Controller2.go(Controller2.toDest(destination), true); 1773 } 1774 prevent(e); 1775 } 1776 emit(EVENT_DRAGGED); 1777 } else { 1778 if (!isFree && getPosition() !== Move2.toPosition(index)) { 1779 Controller2.go(index, true); 1780 } 1781 } 1782 dragging = false; 1783 } 1784 function save(e) { 1785 prevBaseEvent = baseEvent; 1786 baseEvent = e; 1787 basePosition = getPosition(); 1788 } 1789 function onClick(e) { 1790 if (!disabled && clickPrevented) { 1791 prevent(e, true); 1792 } 1793 } 1794 function isSliderDirection() { 1795 const diffX = abs(coordOf(lastEvent) - coordOf(baseEvent)); 1796 const diffY = abs(coordOf(lastEvent, true) - coordOf(baseEvent, true)); 1797 return diffX > diffY; 1798 } 1799 function computeVelocity(e) { 1800 if (Splide22.is(LOOP) || !hasExceeded) { 1801 const base = baseEvent === lastEvent && prevBaseEvent || baseEvent; 1802 const diffCoord = coordOf(lastEvent) - coordOf(base); 1803 const diffTime = timeOf(e) - timeOf(base); 1804 const isFlick = timeOf(e) - timeOf(lastEvent) < LOG_INTERVAL; 1805 if (diffTime && isFlick) { 1806 return diffCoord / diffTime; 1807 } 1808 } 1809 return 0; 1810 } 1811 function computeDestination(velocity) { 1812 return getPosition() + sign(velocity) * min(abs(velocity) * (options.flickPower || 600), isFree ? Infinity : Components2.Layout.listSize() * (options.flickMaxPages || 1)); 1813 } 1814 function coordOf(e, orthogonal) { 1815 return (isTouchEvent(e) ? e.touches[0] : e)[`page${resolve(orthogonal ? "Y" : "X")}`]; 1816 } 1817 function timeOf(e) { 1818 return e.timeStamp; 1819 } 1820 function constrain(diff) { 1821 return diff / (hasExceeded && Splide22.is(SLIDE) ? FRICTION : 1); 1822 } 1823 function isTouchEvent(e) { 1824 return typeof TouchEvent !== "undefined" && e instanceof TouchEvent; 1825 } 1826 function isDragging() { 1827 return dragging; 1828 } 1829 function disable(value) { 1830 disabled = value; 1831 } 1832 return { 1833 mount, 1834 disable, 1835 isDragging 1836 }; 1837 } 1838 var IE_ARROW_KEYS = ["Left", "Right", "Up", "Down"]; 1839 var KEYBOARD_EVENT = "keydown"; 1840 function Keyboard(Splide22, Components2, options) { 1841 const { on, bind, unbind } = EventInterface(Splide22); 1842 const { root } = Splide22; 1843 const { resolve } = Components2.Direction; 1844 let target; 1845 let disabled; 1846 function mount() { 1847 init(); 1848 on(EVENT_UPDATED, onUpdated); 1849 on(EVENT_MOVE, onMove); 1850 } 1851 function init() { 1852 const { keyboard } = options; 1853 if (keyboard) { 1854 if (keyboard === "focused") { 1855 target = root; 1856 setAttribute(root, TAB_INDEX, 0); 1857 } else { 1858 target = window; 1859 } 1860 bind(target, KEYBOARD_EVENT, onKeydown); 1861 } 1862 } 1863 function destroy() { 1864 unbind(target, KEYBOARD_EVENT); 1865 if (isHTMLElement(target)) { 1866 removeAttribute(target, TAB_INDEX); 1867 } 1868 } 1869 function disable(value) { 1870 disabled = value; 1871 } 1872 function onMove() { 1873 const _disabled = disabled; 1874 disabled = true; 1875 nextTick(() => { 1876 disabled = _disabled; 1877 }); 1878 } 1879 function onUpdated() { 1880 destroy(); 1881 init(); 1882 } 1883 function onKeydown(e) { 1884 if (!disabled) { 1885 const { key } = e; 1886 const normalizedKey = includes(IE_ARROW_KEYS, key) ? `Arrow${key}` : key; 1887 if (normalizedKey === resolve("ArrowLeft")) { 1888 Splide22.go("<"); 1889 } else if (normalizedKey === resolve("ArrowRight")) { 1890 Splide22.go(">"); 1891 } 1892 } 1893 } 1894 return { 1895 mount, 1896 destroy, 1897 disable 1898 }; 1899 } 1900 var SRC_DATA_ATTRIBUTE = `${DATA_ATTRIBUTE}-lazy`; 1901 var SRCSET_DATA_ATTRIBUTE = `${SRC_DATA_ATTRIBUTE}-srcset`; 1902 var IMAGE_SELECTOR = `[${SRC_DATA_ATTRIBUTE}], [${SRCSET_DATA_ATTRIBUTE}]`; 1903 function LazyLoad(Splide22, Components2, options) { 1904 const { on, off, bind, emit } = EventInterface(Splide22); 1905 const isSequential = options.lazyLoad === "sequential"; 1906 let images = []; 1907 let index = 0; 1908 function mount() { 1909 if (options.lazyLoad) { 1910 init(); 1911 on(EVENT_REFRESH, refresh); 1912 if (!isSequential) { 1913 on([EVENT_MOUNTED, EVENT_REFRESH, EVENT_MOVED, EVENT_SCROLLED], observe); 1914 } 1915 } 1916 } 1917 function refresh() { 1918 destroy(); 1919 init(); 1920 } 1921 function init() { 1922 Components2.Slides.forEach((_Slide) => { 1923 queryAll(_Slide.slide, IMAGE_SELECTOR).forEach((_img) => { 1924 const src = getAttribute(_img, SRC_DATA_ATTRIBUTE); 1925 const srcset = getAttribute(_img, SRCSET_DATA_ATTRIBUTE); 1926 if (src !== _img.src || srcset !== _img.srcset) { 1927 const className = options.classes.spinner; 1928 const parent = _img.parentElement; 1929 const _spinner = child(parent, `.${className}`) || create("span", className, parent); 1930 setAttribute(_spinner, ROLE, "presentation"); 1931 images.push({ _img, _Slide, src, srcset, _spinner }); 1932 !_img.src && display(_img, "none"); 1933 } 1934 }); 1935 }); 1936 if (isSequential) { 1937 loadNext(); 1938 } 1939 } 1940 function destroy() { 1941 index = 0; 1942 images = []; 1943 } 1944 function observe() { 1945 images = images.filter((data) => { 1946 const distance = options.perPage * ((options.preloadPages || 1) + 1) - 1; 1947 if (data._Slide.isWithin(Splide22.index, distance)) { 1948 return load(data); 1949 } 1950 return true; 1951 }); 1952 if (!images.length) { 1953 off(EVENT_MOVED); 1954 } 1955 } 1956 function load(data) { 1957 const { _img } = data; 1958 addClass(data._Slide.slide, CLASS_LOADING); 1959 bind(_img, "load error", (e) => { 1960 onLoad(data, e.type === "error"); 1961 }); 1962 ["srcset", "src"].forEach((name) => { 1963 if (data[name]) { 1964 setAttribute(_img, name, data[name]); 1965 removeAttribute(_img, name === "src" ? SRC_DATA_ATTRIBUTE : SRCSET_DATA_ATTRIBUTE); 1966 } 1967 }); 1968 } 1969 function onLoad(data, error) { 1970 const { _Slide } = data; 1971 removeClass(_Slide.slide, CLASS_LOADING); 1972 if (!error) { 1973 remove(data._spinner); 1974 display(data._img, ""); 1975 emit(EVENT_LAZYLOAD_LOADED, data._img, _Slide); 1976 emit(EVENT_RESIZE); 1977 } 1978 if (isSequential) { 1979 loadNext(); 1980 } 1981 } 1982 function loadNext() { 1983 if (index < images.length) { 1984 load(images[index++]); 1985 } 1986 } 1987 return { 1988 mount, 1989 destroy 1990 }; 1991 } 1992 function Pagination(Splide22, Components2, options) { 1993 const { on, emit, bind, unbind } = EventInterface(Splide22); 1994 const { Slides: Slides2, Elements: Elements2, Controller: Controller2 } = Components2; 1995 const { hasFocus, getIndex } = Controller2; 1996 const items = []; 1997 let list; 1998 function mount() { 1999 init(); 2000 on([EVENT_UPDATED, EVENT_REFRESH], init); 2001 on([EVENT_MOVE, EVENT_SCROLLED], update); 2002 } 2003 function init() { 2004 destroy(); 2005 if (options.pagination && Slides2.isEnough()) { 2006 createPagination(); 2007 emit(EVENT_PAGINATION_MOUNTED, { list, items }, getAt(Splide22.index)); 2008 update(); 2009 } 2010 } 2011 function destroy() { 2012 if (list) { 2013 remove(list); 2014 items.forEach((item) => { 2015 unbind(item.button, "click"); 2016 }); 2017 empty(items); 2018 list = null; 2019 } 2020 } 2021 function createPagination() { 2022 const { length } = Splide22; 2023 const { classes, i18n, perPage } = options; 2024 const parent = options.pagination === "slider" && Elements2.slider || Elements2.root; 2025 const max2 = hasFocus() ? length : ceil(length / perPage); 2026 list = create("ul", classes.pagination, parent); 2027 for (let i = 0; i < max2; i++) { 2028 const li = create("li", null, list); 2029 const button = create("button", { class: classes.page, type: "button" }, li); 2030 const controls = Slides2.getIn(i).map((Slide2) => Slide2.slide.id); 2031 const text = !hasFocus() && perPage > 1 ? i18n.pageX : i18n.slideX; 2032 bind(button, "click", onClick.bind(null, i)); 2033 setAttribute(button, ARIA_CONTROLS, controls.join(" ")); 2034 setAttribute(button, ARIA_LABEL, format(text, i + 1)); 2035 items.push({ li, button, page: i }); 2036 } 2037 } 2038 function onClick(page) { 2039 Controller2.go(`>${page}`, true, () => { 2040 const Slide2 = Slides2.getAt(Controller2.toIndex(page)); 2041 Slide2 && focus(Slide2.slide); 2042 }); 2043 } 2044 function getAt(index) { 2045 return items[Controller2.toPage(index)]; 2046 } 2047 function update() { 2048 const prev = getAt(getIndex(true)); 2049 const curr = getAt(getIndex()); 2050 if (prev) { 2051 removeClass(prev.button, CLASS_ACTIVE); 2052 removeAttribute(prev.button, ARIA_CURRENT); 2053 } 2054 if (curr) { 2055 addClass(curr.button, CLASS_ACTIVE); 2056 setAttribute(curr.button, ARIA_CURRENT, true); 2057 } 2058 emit(EVENT_PAGINATION_UPDATED, { list, items }, prev, curr); 2059 } 2060 return { 2061 items, 2062 mount, 2063 destroy, 2064 getAt, 2065 update 2066 }; 2067 } 2068 var TRIGGER_KEYS = [" ", "Enter", "Spacebar"]; 2069 function Sync(Splide22, Components2, options) { 2070 const { list } = Components2.Elements; 2071 const events = []; 2072 function mount() { 2073 Splide22.splides.forEach((target) => { 2074 !target.isParent && sync(target.splide); 2075 }); 2076 if (options.isNavigation) { 2077 navigate(); 2078 } 2079 } 2080 function destroy() { 2081 removeAttribute(list, ALL_ATTRIBUTES); 2082 events.forEach((event) => { 2083 event.destroy(); 2084 }); 2085 empty(events); 2086 } 2087 function remount() { 2088 destroy(); 2089 mount(); 2090 } 2091 function sync(splide) { 2092 [Splide22, splide].forEach((instance) => { 2093 const event = EventInterface(instance); 2094 const target = instance === Splide22 ? splide : Splide22; 2095 event.on(EVENT_MOVE, (index, prev, dest) => { 2096 target.go(target.is(LOOP) ? dest : index); 2097 }); 2098 events.push(event); 2099 }); 2100 } 2101 function navigate() { 2102 const event = EventInterface(Splide22); 2103 const { on } = event; 2104 on(EVENT_CLICK, onClick); 2105 on(EVENT_SLIDE_KEYDOWN, onKeydown); 2106 on([EVENT_MOUNTED, EVENT_UPDATED], update); 2107 setAttribute(list, ROLE, "menu"); 2108 events.push(event); 2109 event.emit(EVENT_NAVIGATION_MOUNTED, Splide22.splides); 2110 } 2111 function update() { 2112 setAttribute(list, ARIA_ORIENTATION, options.direction !== TTB ? "horizontal" : null); 2113 } 2114 function onClick(Slide2) { 2115 Splide22.go(Slide2.index); 2116 } 2117 function onKeydown(Slide2, e) { 2118 if (includes(TRIGGER_KEYS, e.key)) { 2119 onClick(Slide2); 2120 prevent(e); 2121 } 2122 } 2123 return { 2124 mount, 2125 destroy, 2126 remount 2127 }; 2128 } 2129 function Wheel(Splide22, Components2, options) { 2130 const { bind } = EventInterface(Splide22); 2131 function mount() { 2132 if (options.wheel) { 2133 bind(Components2.Elements.track, "wheel", onWheel, SCROLL_LISTENER_OPTIONS); 2134 } 2135 } 2136 function onWheel(e) { 2137 if (e.cancelable) { 2138 const { deltaY } = e; 2139 if (deltaY) { 2140 const backwards = deltaY < 0; 2141 Splide22.go(backwards ? "<" : ">"); 2142 shouldPrevent(backwards) && prevent(e); 2143 } 2144 } 2145 } 2146 function shouldPrevent(backwards) { 2147 return !options.releaseWheel || Splide22.state.is(MOVING) || Components2.Controller.getAdjacent(backwards) !== -1; 2148 } 2149 return { 2150 mount 2151 }; 2152 } 2153 var ComponentConstructors = /* @__PURE__ */ Object.freeze({ 2154 __proto__: null, 2155 Options, 2156 Direction, 2157 Elements, 2158 Slides, 2159 Layout, 2160 Clones, 2161 Move, 2162 Controller, 2163 Arrows, 2164 Autoplay, 2165 Cover, 2166 Scroll, 2167 Drag, 2168 Keyboard, 2169 LazyLoad, 2170 Pagination, 2171 Sync, 2172 Wheel 2173 }); 2174 var I18N = { 2175 prev: "Previous slide", 2176 next: "Next slide", 2177 first: "Go to first slide", 2178 last: "Go to last slide", 2179 slideX: "Go to slide %s", 2180 pageX: "Go to page %s", 2181 play: "Start autoplay", 2182 pause: "Pause autoplay" 2183 }; 2184 var DEFAULTS = { 2185 type: "slide", 2186 speed: 400, 2187 waitForTransition: true, 2188 perPage: 1, 2189 cloneStatus: true, 2190 arrows: true, 2191 pagination: true, 2192 interval: 5e3, 2193 pauseOnHover: true, 2194 pauseOnFocus: true, 2195 resetProgress: true, 2196 keyboard: true, 2197 easing: "cubic-bezier(0.25, 1, 0.5, 1)", 2198 drag: true, 2199 direction: "ltr", 2200 slideFocus: true, 2201 trimSpace: true, 2202 focusableNodes: "a, button, textarea, input, select, iframe", 2203 classes: CLASSES, 2204 i18n: I18N 2205 }; 2206 function Fade(Splide22, Components2, options) { 2207 const { on } = EventInterface(Splide22); 2208 function mount() { 2209 on([EVENT_MOUNTED, EVENT_REFRESH], () => { 2210 nextTick(() => { 2211 Components2.Slides.style("transition", `opacity ${options.speed}ms ${options.easing}`); 2212 }); 2213 }); 2214 } 2215 function start(index, done) { 2216 const { track } = Components2.Elements; 2217 style(track, "height", unit(rect(track).height)); 2218 nextTick(() => { 2219 done(); 2220 style(track, "height", ""); 2221 }); 2222 } 2223 return { 2224 mount, 2225 start, 2226 cancel: noop 2227 }; 2228 } 2229 function Slide(Splide22, Components2, options) { 2230 const { bind } = EventInterface(Splide22); 2231 const { Move: Move2, Controller: Controller2 } = Components2; 2232 const { list } = Components2.Elements; 2233 let endCallback; 2234 function mount() { 2235 bind(list, "transitionend", (e) => { 2236 if (e.target === list && endCallback) { 2237 cancel(); 2238 endCallback(); 2239 } 2240 }); 2241 } 2242 function start(index, done) { 2243 const destination = Move2.toPosition(index, true); 2244 const position = Move2.getPosition(); 2245 const speed = getSpeed(index); 2246 if (abs(destination - position) >= 1 && speed >= 1) { 2247 apply(`transform ${speed}ms ${options.easing}`); 2248 Move2.translate(destination, true); 2249 endCallback = done; 2250 } else { 2251 Move2.jump(index); 2252 done(); 2253 } 2254 } 2255 function cancel() { 2256 apply(""); 2257 } 2258 function getSpeed(index) { 2259 const { rewindSpeed } = options; 2260 if (Splide22.is(SLIDE) && rewindSpeed) { 2261 const prev = Controller2.getIndex(true); 2262 const end = Controller2.getEnd(); 2263 if (prev === 0 && index >= end || prev >= end && index === 0) { 2264 return rewindSpeed; 2265 } 2266 } 2267 return options.speed; 2268 } 2269 function apply(transition) { 2270 style(list, "transition", transition); 2271 } 2272 return { 2273 mount, 2274 start, 2275 cancel 2276 }; 2277 } 2278 var _Splide = class { 2279 constructor(target, options) { 2280 this.event = EventBus(); 2281 this.Components = {}; 2282 this.state = State(CREATED); 2283 this.splides = []; 2284 this._options = {}; 2285 this._Extensions = {}; 2286 const root = isString(target) ? query(document, target) : target; 2287 assert(root, `${root} is invalid.`); 2288 this.root = root; 2289 merge(DEFAULTS, _Splide.defaults); 2290 merge(merge(this._options, DEFAULTS), options || {}); 2291 } 2292 mount(Extensions, Transition) { 2293 const { state, Components: Components2 } = this; 2294 assert(state.is([CREATED, DESTROYED]), "Already mounted!"); 2295 state.set(CREATED); 2296 this._Components = Components2; 2297 this._Transition = Transition || this._Transition || (this.is(FADE) ? Fade : Slide); 2298 this._Extensions = Extensions || this._Extensions; 2299 const Constructors = assign({}, ComponentConstructors, this._Extensions, { Transition: this._Transition }); 2300 forOwn(Constructors, (Component, key) => { 2301 const component = Component(this, Components2, this._options); 2302 Components2[key] = component; 2303 component.setup && component.setup(); 2304 }); 2305 forOwn(Components2, (component) => { 2306 component.mount && component.mount(); 2307 }); 2308 this.emit(EVENT_MOUNTED); 2309 addClass(this.root, CLASS_INITIALIZED); 2310 state.set(IDLE); 2311 this.emit(EVENT_READY); 2312 return this; 2313 } 2314 sync(splide) { 2315 this.splides.push({ splide }); 2316 splide.splides.push({ splide: this, isParent: true }); 2317 if (this.state.is(IDLE)) { 2318 this._Components.Sync.remount(); 2319 splide.Components.Sync.remount(); 2320 } 2321 return this; 2322 } 2323 go(control) { 2324 this._Components.Controller.go(control); 2325 return this; 2326 } 2327 on(events, callback) { 2328 this.event.on(events, callback, null, DEFAULT_USER_EVENT_PRIORITY); 2329 return this; 2330 } 2331 off(events) { 2332 this.event.off(events); 2333 return this; 2334 } 2335 emit(event) { 2336 this.event.emit(event, ...slice(arguments, 1)); 2337 return this; 2338 } 2339 add(slides, index) { 2340 this._Components.Slides.add(slides, index); 2341 return this; 2342 } 2343 remove(matcher) { 2344 this._Components.Slides.remove(matcher); 2345 return this; 2346 } 2347 is(type) { 2348 return this._options.type === type; 2349 } 2350 refresh() { 2351 this.emit(EVENT_REFRESH); 2352 return this; 2353 } 2354 destroy(completely = true) { 2355 const { event, state } = this; 2356 if (state.is(CREATED)) { 2357 event.on(EVENT_READY, this.destroy.bind(this, completely), this); 2358 } else { 2359 forOwn(this._Components, (component) => { 2360 component.destroy && component.destroy(completely); 2361 }, true); 2362 event.emit(EVENT_DESTROY); 2363 event.destroy(); 2364 completely && empty(this.splides); 2365 state.set(DESTROYED); 2366 } 2367 return this; 2368 } 2369 get options() { 2370 return this._options; 2371 } 2372 set options(options) { 2373 const { _options } = this; 2374 merge(_options, options); 2375 if (!this.state.is(CREATED)) { 2376 this.emit(EVENT_UPDATED, _options); 2377 } 2378 } 2379 get length() { 2380 return this._Components.Slides.getLength(true); 2381 } 2382 get index() { 2383 return this._Components.Controller.getIndex(); 2384 } 2385 }; 2386 var Splide = _Splide; 2387 Splide.defaults = {}; 2388 Splide.STATES = STATES; 2389 2390 // src/js/components/Splide/Splide.tsx 2391 2392 2393 // src/js/constants/events.ts 2394 var EVENTS = [ 2395 [EVENT_MOUNTED, "onMounted"], 2396 [EVENT_READY, "onReady"], 2397 [EVENT_MOVE, "onMove"], 2398 [EVENT_MOVED, "onMoved"], 2399 [EVENT_CLICK, "onClick"], 2400 [EVENT_ACTIVE, "onActive"], 2401 [EVENT_INACTIVE, "onInactive"], 2402 [EVENT_VISIBLE, "onVisible"], 2403 [EVENT_HIDDEN, "onHidden"], 2404 [EVENT_REFRESH, "onRefresh"], 2405 [EVENT_UPDATED, "onUpdated"], 2406 [EVENT_RESIZE, "onResize"], 2407 [EVENT_RESIZED, "onResized"], 2408 [EVENT_DRAG, "onDrag"], 2409 [EVENT_DRAGGING, "onDragging"], 2410 [EVENT_DRAGGED, "onDragged"], 2411 [EVENT_SCROLL, "onScroll"], 2412 [EVENT_SCROLLED, "onScrolled"], 2413 [EVENT_DESTROY, "onDestroy"], 2414 [EVENT_ARROWS_MOUNTED, "onArrowsMounted"], 2415 [EVENT_ARROWS_UPDATED, "onArrowsUpdated"], 2416 [EVENT_PAGINATION_MOUNTED, "onPaginationMounted"], 2417 [EVENT_PAGINATION_UPDATED, "onPaginationUpdated"], 2418 [EVENT_NAVIGATION_MOUNTED, "onNavigationMounted"], 2419 [EVENT_AUTOPLAY_PLAY, "onAutoplayPlay"], 2420 [EVENT_AUTOPLAY_PLAYING, "onAutoplayPlaying"], 2421 [EVENT_AUTOPLAY_PAUSE, "onAutoplayPause"], 2422 [EVENT_LAZYLOAD_LOADED, "onLazyLoadLoaded"] 2423 ]; 2424 2425 // src/js/utils/classNames/classNames.ts 2426 function classNames(...classes) { 2427 return classes.filter(Boolean).join(" "); 2428 } 2429 2430 // src/js/utils/isObject/isObject.ts 2431 function isObject2(subject) { 2432 return subject !== null && typeof subject === "object"; 2433 } 2434 2435 // src/js/utils/isEqualDeep/isEqualDeep.ts 2436 function isEqualDeep(subject1, subject2) { 2437 if (Array.isArray(subject1) && Array.isArray(subject2)) { 2438 return subject1.length === subject2.length && !subject1.some((elm, index) => !isEqualDeep(elm, subject2[index])); 2439 } 2440 if (isObject2(subject1) && isObject2(subject2)) { 2441 const keys1 = Object.keys(subject1); 2442 const keys2 = Object.keys(subject2); 2443 return keys1.length === keys2.length && !keys1.some((key) => { 2444 return !Object.prototype.hasOwnProperty.call(subject2, key) || !isEqualDeep(subject1[key], subject2[key]); 2445 }); 2446 } 2447 return subject1 === subject2; 2448 } 2449 2450 // src/js/utils/isEqualShallow/isEqualShallow.ts 2451 function isEqualShallow(array1, array2) { 2452 return array1.length === array2.length && !array1.some((elm, index) => elm !== array2[index]); 2453 } 2454 2455 // src/js/utils/forOwn/forOwn.ts 2456 function forOwn2(object, iteratee) { 2457 if (object) { 2458 const keys = Object.keys(object); 2459 for (let i = 0; i < keys.length; i++) { 2460 const key = keys[i]; 2461 if (key !== "__proto__") { 2462 if (iteratee(object[key], key) === false) { 2463 break; 2464 } 2465 } 2466 } 2467 } 2468 return object; 2469 } 2470 2471 // src/js/utils/merge/merge.ts 2472 function merge2(object, source) { 2473 const merged = object; 2474 forOwn2(source, (value, key) => { 2475 if (Array.isArray(value)) { 2476 merged[key] = value.slice(); 2477 } else if (isObject2(value)) { 2478 merged[key] = merge2(isObject2(merged[key]) ? merged[key] : {}, value); 2479 } else { 2480 merged[key] = value; 2481 } 2482 }); 2483 return merged; 2484 } 2485 2486 // src/js/components/Splide/Splide.tsx 2487 var Splide2 = class extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component) { 2488 constructor() { 2489 super(...arguments); 2490 this.splideRef = react__WEBPACK_IMPORTED_MODULE_0___default().createRef(); 2491 this.slides = []; 2492 } 2493 componentDidMount() { 2494 const { options, Extensions, Transition } = this.props; 2495 const { current } = this.splideRef; 2496 if (current) { 2497 this.splide = new Splide(current, options); 2498 this.bind(this.splide); 2499 this.splide.mount(Extensions, Transition); 2500 this.options = merge2({}, options || {}); 2501 this.slides = this.getSlides(); 2502 } 2503 } 2504 componentWillUnmount() { 2505 if (this.splide) { 2506 this.splide.destroy(); 2507 this.splide = void 0; 2508 } 2509 this.options = void 0; 2510 this.slides.length = 0; 2511 } 2512 componentDidUpdate() { 2513 if (!this.splide) { 2514 return; 2515 } 2516 const { options } = this.props; 2517 if (options && !isEqualDeep(this.options, options)) { 2518 this.splide.options = options; 2519 this.options = merge2({}, options); 2520 } 2521 const newSlides = this.getSlides(); 2522 if (!isEqualShallow(this.slides, newSlides)) { 2523 this.splide.refresh(); 2524 this.slides = newSlides; 2525 } 2526 } 2527 sync(splide) { 2528 var _a; 2529 (_a = this.splide) == null ? void 0 : _a.sync(splide); 2530 } 2531 go(control) { 2532 var _a; 2533 (_a = this.splide) == null ? void 0 : _a.go(control); 2534 } 2535 getSlides() { 2536 var _a; 2537 if (this.splide) { 2538 const children2 = (_a = this.splide.Components.Elements) == null ? void 0 : _a.list.children; 2539 return children2 && Array.prototype.slice.call(children2) || []; 2540 } 2541 return []; 2542 } 2543 bind(splide) { 2544 EVENTS.forEach(([event, name]) => { 2545 const handler = this.props[name]; 2546 if (typeof handler === "function") { 2547 splide.on(event, (...args) => { 2548 handler(splide, ...args); 2549 }); 2550 } 2551 }); 2552 } 2553 renderTrack() { 2554 return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { 2555 className: "splide__track" 2556 }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0___default().createElement("ul", { 2557 className: "splide__list" 2558 }, this.props.children)); 2559 } 2560 render() { 2561 const { 2562 id, 2563 className, 2564 hasSliderWrapper, 2565 hasAutoplayProgress, 2566 hasAutoplayControls, 2567 playButtonLabel = "Play", 2568 pauseButtonLabel = "Pause", 2569 renderControls 2570 } = this.props; 2571 return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { 2572 id, 2573 className: classNames("splide", className), 2574 ref: this.splideRef 2575 }, hasSliderWrapper ? /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { 2576 className: "splide__slider" 2577 }, this.renderTrack()) : this.renderTrack(), hasAutoplayProgress && /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { 2578 className: "splide__progress" 2579 }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { 2580 className: "splide__progress__bar" 2581 })), hasAutoplayControls && /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { 2582 className: "splide__autoplay" 2583 }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0___default().createElement("button", { 2584 className: "splide__play" 2585 }, playButtonLabel), /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0___default().createElement("button", { 2586 className: "splide__pause" 2587 }, pauseButtonLabel)), renderControls && renderControls()); 2588 } 2589 }; 2590 2591 // src/js/components/SplideSlide/SplideSlide.tsx 2592 2593 var SplideSlide = ({ children: children2, className, ...props }) => { 2594 return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0___default().createElement("li", { 2595 className: classNames("splide__slide", className), 2596 ...props 2597 }, children2); 2598 }; 2599 2600 /*! 2601 * Splide.js 2602 * Version : 3.6.12 2603 * License : MIT 2604 * Copyright: 2022 Naotoshi Fujita 2605 */ 2606 2607 2608 /***/ }), 2609 2610 /***/ "./src/frontend.scss": 2611 /*!***************************!*\ 2612 !*** ./src/frontend.scss ***! 2613 \***************************/ 2614 /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { 2615 2616 __webpack_require__.r(__webpack_exports__); 2617 // extracted by mini-css-extract-plugin 2618 2619 2620 /***/ }), 2621 2622 /***/ "react": 2623 /*!************************!*\ 2624 !*** external "React" ***! 2625 \************************/ 2626 /***/ (function(module) { 2627 2628 module.exports = window["React"]; 2629 2630 /***/ }), 2631 2632 /***/ "react-dom": 2633 /*!***************************!*\ 2634 !*** external "ReactDOM" ***! 2635 \***************************/ 2636 /***/ (function(module) { 2637 2638 module.exports = window["ReactDOM"]; 2639 2640 /***/ }), 2641 2642 /***/ "@wordpress/element": 2643 /*!*********************************!*\ 2644 !*** external ["wp","element"] ***! 2645 \*********************************/ 2646 /***/ (function(module) { 2647 2648 module.exports = window["wp"]["element"]; 2649 2650 /***/ }) 2651 2652 /******/ }); 2653 /************************************************************************/ 2654 /******/ // The module cache 2655 /******/ var __webpack_module_cache__ = {}; 2656 /******/ 2657 /******/ // The require function 2658 /******/ function __webpack_require__(moduleId) { 2659 /******/ // Check if module is in cache 2660 /******/ var cachedModule = __webpack_module_cache__[moduleId]; 2661 /******/ if (cachedModule !== undefined) { 2662 /******/ return cachedModule.exports; 2663 /******/ } 2664 /******/ // Create a new module (and put it into the cache) 2665 /******/ var module = __webpack_module_cache__[moduleId] = { 2666 /******/ // no module.id needed 2667 /******/ // no module.loaded needed 2668 /******/ exports: {} 2669 /******/ }; 2670 /******/ 2671 /******/ // Execute the module function 2672 /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); 2673 /******/ 2674 /******/ // Return the exports of the module 2675 /******/ return module.exports; 2676 /******/ } 2677 /******/ 2678 /************************************************************************/ 2679 /******/ /* webpack/runtime/compat get default export */ 2680 /******/ !function() { 2681 /******/ // getDefaultExport function for compatibility with non-harmony modules 2682 /******/ __webpack_require__.n = function(module) { 2683 /******/ var getter = module && module.__esModule ? 2684 /******/ function() { return module['default']; } : 2685 /******/ function() { return module; }; 2686 /******/ __webpack_require__.d(getter, { a: getter }); 2687 /******/ return getter; 2688 /******/ }; 2689 /******/ }(); 2690 /******/ 2691 /******/ /* webpack/runtime/define property getters */ 2692 /******/ !function() { 2693 /******/ // define getter functions for harmony exports 2694 /******/ __webpack_require__.d = function(exports, definition) { 2695 /******/ for(var key in definition) { 2696 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 2697 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 2698 /******/ } 2699 /******/ } 2700 /******/ }; 2701 /******/ }(); 2702 /******/ 2703 /******/ /* webpack/runtime/hasOwnProperty shorthand */ 2704 /******/ !function() { 2705 /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } 2706 /******/ }(); 2707 /******/ 2708 /******/ /* webpack/runtime/make namespace object */ 2709 /******/ !function() { 2710 /******/ // define __esModule on exports 2711 /******/ __webpack_require__.r = function(exports) { 2712 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 2713 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 2714 /******/ } 2715 /******/ Object.defineProperty(exports, '__esModule', { value: true }); 2716 /******/ }; 2717 /******/ }(); 2718 /******/ 2719 /************************************************************************/ 2720 var __webpack_exports__ = {}; 2721 // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. 2722 !function() { 2723 /*!*************************!*\ 2724 !*** ./src/frontend.js ***! 2725 \*************************/ 2726 __webpack_require__.r(__webpack_exports__); 2727 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); 2728 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); 2729 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react"); 2730 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__); 2731 /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-dom */ "react-dom"); 2732 /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_2__); 2733 /* harmony import */ var _splidejs_react_splide__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @splidejs/react-splide */ "./node_modules/@splidejs/react-splide/dist/js/react-splide.esm.js"); 2734 /* harmony import */ var _frontend_scss__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./frontend.scss */ "./src/frontend.scss"); 2735 2736 2737 2738 2739 2740 const divsToUpdate = document.querySelectorAll(".splide_element"); 2741 divsToUpdate.forEach(function (div) { 2742 const data = JSON.parse(div.querySelector("pre").innerHTML); 2743 react_dom__WEBPACK_IMPORTED_MODULE_2___default().render((0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(Slider, data), div); 2744 div.classList.remove("splide_element"); 2745 }); 2746 2747 function Slider(props) { 2748 // Don't show empty items 2749 props.images = props.images.filter(function (image) { 2750 return image.id > 0; 2751 }); 2752 return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_splidejs_react_splide__WEBPACK_IMPORTED_MODULE_3__.Splide, { 2753 options: { 2754 type: slider_options.type, 2755 rewind: slider_options.rewind, 2756 heightRatio: slider_options.height_ratio, 2757 gap: slider_options.gap + "px", 2758 padding: slider_options.padding + "%", 2759 breakpoints: slider_options.breakpoint == "" ? "" : { 2760 [slider_options.breakpoint]: { 2761 rewind: slider_options.rewind, 2762 type: slider_options.type, 2763 heightRatio: slider_options.breakpoint_height_ratio, 2764 gap: slider_options.breakpoint_gap + "px", 2765 padding: slider_options.breakpoint_padding + "%" 2766 } 2767 } 2768 } 2769 }, props.images.map(image => { 2770 return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(_splidejs_react_splide__WEBPACK_IMPORTED_MODULE_3__.SplideSlide, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("a", { 2771 className: "foobox", 2772 rel: "gallery", 2773 href: image.front_url 2774 }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", { 2775 src: image.front_url, 2776 alt: "" 2777 }))); 2778 })); 2779 } 2780 }(); 2781 /******/ })() 2782 ; 2783 //# sourceMappingURL=frontend.js.map 1 !function(){"use strict";var t={n:function(n){var e=n&&n.__esModule?function(){return n.default}:function(){return n};return t.d(e,{a:e}),e},d:function(n,e){for(var i in e)t.o(e,i)&&!t.o(n,i)&&Object.defineProperty(n,i,{enumerable:!0,get:e[i]})},o:function(t,n){return Object.prototype.hasOwnProperty.call(t,n)}},n=window.wp.element,e=window.React,i=t.n(e),o=window.ReactDOM,s=t.n(o);function r(t){t.length=0}function c(t){return!d(t)&&"object"==typeof t}function u(t){return Array.isArray(t)}function l(t){return"string"==typeof t}function a(t){return void 0===t}function d(t){return null===t}function f(t){return t instanceof HTMLElement}function p(t){return u(t)?t:[t]}function h(t,n){p(t).forEach(n)}function g(t,n){return t.indexOf(n)>-1}function m(t,n){return t.push(...p(n)),t}var y=Array.prototype;function _(t,n,e){return y.slice.call(t,n,e)}function v(t,n,e){t&&h(n,(n=>{n&&t.classList[e?"add":"remove"](n)}))}function b(t,n){v(t,l(n)?n.split(" "):n,!0)}function w(t,n){h(n,t.appendChild.bind(t))}function E(t,n){h(t,(t=>{const e=n.parentNode;e&&e.insertBefore(t,n)}))}function x(t,n){return f(t)&&(t.msMatchesSelector||t.matches).call(t,n)}function S(t,n){return t?_(t.children).filter((t=>x(t,n))):[]}function k(t,n){return n?S(t,n)[0]:t.firstElementChild}function P(t,n,e){if(t){let i=Object.keys(t);i=e?i.reverse():i;for(let e=0;e<i.length;e++){const o=i[e];if("__proto__"!==o&&!1===n(t[o],o))break}}return t}function A(t){return _(arguments,1).forEach((n=>{P(n,((e,i)=>{t[i]=n[i]}))})),t}function $(t,n){return P(n,((n,e)=>{u(n)?t[e]=n.slice():c(n)?t[e]=$(c(t[e])?t[e]:{},n):t[e]=n})),t}function L(t,n){t&&h(n,(n=>{t.removeAttribute(n)}))}function C(t,n,e){c(n)?P(n,((n,e)=>{C(t,e,n)})):d(e)?L(t,n):t.setAttribute(n,String(e))}function N(t,n,e){const i=document.createElement(t);return n&&(l(n)?b(i,n):C(i,n)),e&&w(e,i),i}function z(t,n,e){if(a(e))return getComputedStyle(t)[n];if(!d(e)){const{style:i}=t;e=`${e}`,i[n]!==e&&(i[n]=e)}}function D(t,n){z(t,"display",n)}function M(t,n){return t.getAttribute(n)}function R(t,n){return t&&t.classList.contains(n)}function O(t){return t.getBoundingClientRect()}function T(t){h(t,(t=>{t&&t.parentNode&&t.parentNode.removeChild(t)}))}function I(t){return k((new DOMParser).parseFromString(t,"text/html").body)}function j(t,n){t.preventDefault(),n&&(t.stopPropagation(),t.stopImmediatePropagation())}function F(t,n){return t&&t.querySelector(n)}function B(t,n){return _(t.querySelectorAll(n))}function W(t,n){v(t,n,!1)}function H(t){return l(t)?t:t?`${t}px`:""}function X(t,n=""){if(!t)throw new Error(`[splide] ${n}`)}function U(t){setTimeout(t)}var q=()=>{};function G(t){return requestAnimationFrame(t)}var{min:Y,max:J,floor:V,ceil:K,abs:Q}=Math;function Z(t,n,e,i){const o=Y(n,e),s=J(n,e);return i?o<t&&t<s:o<=t&&t<=s}function tt(t,n,e){const i=Y(n,e),o=J(n,e);return Y(J(i,t),o)}function nt(t){return+(t>0)-+(t<0)}function et(t,n){return h(n,(n=>{t=t.replace("%s",`${n}`)})),t}function it(t){return t<10?`0${t}`:`${t}`}var ot={},st="mounted",rt="ready",ct="move",ut="moved",lt="shifted",at="click",dt="active",ft="inactive",pt="visible",ht="hidden",gt="slide:keydown",mt="refresh",yt="updated",_t="resize",vt="resized",bt="repositioned",wt="drag",Et="dragging",xt="dragged",St="scroll",kt="scrolled",Pt="destroy",At="arrows:mounted",$t="arrows:updated",Lt="pagination:mounted",Ct="pagination:updated",Nt="navigation:mounted",zt="autoplay:play",Dt="autoplay:playing",Mt="autoplay:pause",Rt="lazyload:loaded";function Ot(t){const{event:n}=t,e={};let i=[];function o(t,n,e){s(t,n,((t,n)=>{i=i.filter((i=>!!(i[0]!==t||i[1]!==n||e&&i[2]!==e)||(t.removeEventListener(n,i[2],i[3]),!1)))}))}function s(t,n,e){h(t,(t=>{t&&n.split(" ").forEach(e.bind(null,t))}))}function r(){i=i.filter((t=>o(t[0],t[1]))),n.offBy(e)}return n.on(Pt,r,e),{on:function(t,i,o){n.on(t,i,e,o)},off:function(t){n.off(t,e)},emit:n.emit,bind:function(t,n,e,o){s(t,n,((t,n)=>{i.push([t,n,e,o]),t.addEventListener(n,e,o)}))},unbind:o,destroy:r}}function Tt(t,n,e,i){const{now:o}=Date;let s,r,c=0,u=!0,l=0;function a(){if(!u){const r=o()-s;if(r>=t?(c=1,s=o()):c=r/t,e&&e(c),1===c&&(n(),i&&++l>=i))return d();G(a)}}function d(){u=!0}function f(){cancelAnimationFrame(r),c=0,r=0,u=!0}return{start:function(n){!n&&f(),s=o()-(n?c*t:0),u=!1,G(a)},rewind:function(){s=o(),c=0,e&&e(c)},pause:d,cancel:f,set:function(n){t=n},isPaused:function(){return u}}}function It(t,n){let e;return function(){e||(e=Tt(n||0,(()=>{t.apply(this,arguments),e=null}),null,1),e.start())}}var jt="ttb",Ft={marginRight:["marginBottom","marginLeft"],autoWidth:["autoHeight"],fixedWidth:["fixedHeight"],paddingLeft:["paddingTop","paddingRight"],paddingRight:["paddingBottom","paddingLeft"],width:["height"],left:["top","right"],right:["bottom","left"],x:["y"],X:["Y"],Y:["X"],ArrowLeft:["ArrowUp","ArrowRight"],ArrowRight:["ArrowDown","ArrowLeft"]},Bt="splide__slide--clone",Wt="is-active",Ht="is-prev",Xt="is-next",Ut="is-visible",qt="is-loading",Gt=[Wt,Ut,Ht,Xt,qt],Yt={slide:"splide__slide",clone:Bt,arrows:"splide__arrows",arrow:"splide__arrow",prev:"splide__arrow--prev",next:"splide__arrow--next",pagination:"splide__pagination",page:"splide__pagination__page",spinner:"splide__spinner"},Jt="role",Vt="aria-controls",Kt="aria-current",Qt="aria-label",Zt="aria-hidden",tn="tabindex",nn="aria-orientation",en=[Jt,Vt,Kt,Qt,Zt,nn,tn,"disabled"],on="slide",sn="loop",rn="fade";var cn={passive:!1,capture:!0},un="touchmove mousemove",ln="touchend touchcancel mouseup",an=["Left","Right","Up","Down"],dn="keydown",fn="data-splide-lazy",pn="data-splide-lazy-srcset",hn=[" ","Enter","Spacebar"],gn=Object.freeze({__proto__:null,Options:function(t,n,e){const i=It(u);let o,s,r;function c(t){t&&removeEventListener("resize",i)}function u(){const n=(i=t=>t[1].matches,_(s).filter(i)[0]||[]);var i;n[0]!==r&&function(n){const i=e.breakpoints[n]||o;i.destroy?(t.options=o,t.destroy("completely"===i.destroy)):(t.state.is(5)&&(c(!0),t.mount()),t.options=i)}(r=n[0])}return{setup:function(){try{$(e,JSON.parse(M(t.root,"data-splide")))}catch(t){X(!1,t.message)}o=$({},e);const{breakpoints:n}=e;if(n){const t="min"===e.mediaQuery;s=Object.keys(n).sort(((n,e)=>t?+e-+n:+n-+e)).map((n=>[n,matchMedia(`(${t?"min":"max"}-width:${n}px)`)])),u()}},mount:function(){s&&addEventListener("resize",i)},destroy:c}},Direction:function(t,n,e){return{resolve:function(t,n){const{direction:i}=e;return Ft[t]["rtl"!==i||n?i===jt?0:-1:1]||t},orient:function(t){return t*("rtl"===e.direction?1:-1)}}},Elements:function(t,n,e){const{on:i}=Ot(t),{root:o}=t,s={},c=[];let u,l,a,d;function f(){!function(){l=k(o,".splide__slider"),a=F(o,".splide__track"),d=k(a,".splide__list"),X(a&&d,"A track/list element is missing."),m(c,S(d,`.splide__slide:not(.${Bt})`));const t=y(".splide__autoplay"),n=y(".splide__arrows");A(s,{root:o,slider:l,track:a,list:d,slides:c,arrows:n,autoplay:t,prev:F(n,".splide__arrow--prev"),next:F(n,".splide__arrow--next"),bar:F(y(".splide__progress"),".splide__progress__bar"),play:F(t,".splide__play"),pause:F(t,".splide__pause")})}(),function(){const t=o.id||("splide",`splide${it(ot.splide=(ot.splide||0)+1)}`);o.id=t,a.id=a.id||`${t}-track`,d.id=d.id||`${t}-list`}(),b(o,u=_())}function p(){[o,a,d].forEach((t=>{L(t,"style")})),r(c),W(o,u)}function h(){p(),f()}function g(){W(o,u),b(o,u=_())}function y(t){return k(o,t)||k(l,t)}function _(){return[`splide--${e.type}`,`splide--${e.direction}`,e.drag&&"splide--draggable",e.isNavigation&&"splide--nav",Wt]}return A(s,{setup:f,mount:function(){i(mt,h,8),i(yt,g)},destroy:p})},Slides:function(t,n,e){const{on:i,emit:o,bind:s}=Ot(t),{slides:c,list:u}=n.Elements,a=[];function d(){c.forEach(((t,n)=>{_(t,n,-1)}))}function m(){P((t=>{t.destroy()})),r(a)}function y(){m(),d()}function _(n,e,i){const o=function(t,n,e,i){const{on:o,emit:s,bind:r,destroy:c}=Ot(t),{Components:u,root:l,options:a}=t,{isNavigation:d,updateOnMove:f}=a,{resolve:p}=u.Direction,h=M(i,"style"),g=e>-1,m=k(i,".splide__slide__container"),y=a.focusableNodes&&B(i,a.focusableNodes);let _;function b(){const o=g?e:n,s=et(a.i18n.slideX,o+1),r=t.splides.map((t=>t.splide.root.id)).join(" ");C(i,Qt,s),C(i,Vt,r),C(i,Jt,"menuitem"),x(S())}function w(){_||E()}function E(){if(!_){const{index:e}=t;x(S()),function(t){const n=!t&&(!S()||g);C(i,Zt,n||null),C(i,tn,!n&&a.slideFocus?0:null),y&&y.forEach((t=>{C(t,tn,n?-1:null)})),t!==R(i,Ut)&&(v(i,Ut,t),s(t?pt:ht,P))}(function(){if(t.is(rn))return S();const n=O(u.Elements.track),e=O(i),o=p("left"),s=p("right");return V(n[o])<=K(e[o])&&V(e[s])<=K(n[s])}()),v(i,Ht,n===e-1),v(i,Xt,n===e+1)}}function x(t){t!==R(i,Wt)&&(v(i,Wt,t),d&&C(i,Kt,t||null),s(t?dt:ft,P))}function S(){const{index:i}=t;return i===n||a.cloneStatus&&i===e}const P={index:n,slideIndex:e,slide:i,container:m,isClone:g,mount:function(){g||(i.id=`${l.id}-slide${it(n+1)}`),r(i,"click keydown",(t=>{s("click"===t.type?at:gt,P,t)})),o([mt,bt,lt,ut,kt],E),o(Nt,b),f&&o(ct,w)},destroy:function(){_=!0,c(),W(i,Gt),L(i,en),C(i,"style",h)},update:E,style:function(t,n,e){z(e&&m||i,t,n)},isWithin:function(e,i){let o=Q(e-n);return g||!a.rewind&&!t.is(sn)||(o=Y(o,t.length-o)),o<=i}};return P}(t,e,i,n);o.mount(),a.push(o)}function S(t){return t?A((t=>!t.isClone)):a}function P(t,n){S(n).forEach(t)}function A(t){return a.filter("function"==typeof t?t:n=>l(t)?x(n.slide,t):g(p(t),n.index))}return{mount:function(){d(),i(mt,y),i([st,mt],(()=>{a.sort(((t,n)=>t.index-n.index))}))},destroy:m,update:function(){P((t=>{t.update()}))},register:_,get:S,getIn:function(t){const{Controller:i}=n,o=i.toIndex(t),s=i.hasFocus()?1:e.perPage;return A((t=>Z(t.index,o,o+s-1)))},getAt:function(t){return A(t)[0]},add:function(t,n){h(t,(t=>{if(l(t)&&(t=I(t)),f(t)){const i=c[n];i?E(t,i):w(u,t),b(t,e.classes.slide),function(t,n){const e=B(t,"img");let{length:i}=e;i?e.forEach((t=>{s(t,"load error",(()=>{--i||n()}))})):n()}(t,o.bind(null,_t))}})),o(mt)},remove:function(t){T(A(t).map((t=>t.slide))),o(mt)},forEach:P,filter:A,style:function(t,n,e){P((i=>{i.style(t,n,e)}))},getLength:function(t){return t?c.length:a.length},isEnough:function(){return a.length>e.perPage}}},Layout:function(t,n,e){const{on:i,bind:o,emit:s}=Ot(t),{Slides:r}=n,{resolve:u}=n.Direction,{root:l,track:a,list:d}=n.Elements,{getAt:f}=r;let p,h;function g(){h=null,p=e.direction===jt,z(l,"maxWidth",H(e.width)),z(a,u("paddingLeft"),y(!1)),z(a,u("paddingRight"),y(!0)),m()}function m(){const t=O(l);h&&h.width===t.width&&h.height===t.height||(z(a,"height",function(){let t="";return p&&(t=_(),X(t,"height or heightRatio is missing."),t=`calc(${t} - ${y(!1)} - ${y(!0)})`),t}()),r.style(u("marginRight"),H(e.gap)),r.style("width",(e.autoWidth?"":H(e.fixedWidth)||(p?"":v()))||null),r.style("height",H(e.fixedHeight)||(p?e.autoHeight?"":v():_())||null,!0),h=t,s(vt))}function y(t){const{padding:n}=e,i=u(t?"right":"left");return n&&H(n[i]||(c(n)?0:n))||"0px"}function _(){return H(e.height||O(d).width*e.heightRatio)}function v(){const t=H(e.gap);return`calc((100%${t&&` + ${t}`})/${e.perPage||1}${t&&` - ${t}`})`}function b(t,n){const e=f(t);if(e){const t=O(e.slide)[u("right")],i=O(d)[u("left")];return Q(t-i)+(n?0:w())}return 0}function w(){const t=f(0);return t&&parseFloat(z(t.slide,u("marginRight")))||0}return{mount:function(){g(),o(window,"resize load",It(s.bind(this,_t))),i([yt,mt],g),i(_t,m)},listSize:function(){return O(d)[u("width")]},slideSize:function(t,n){const e=f(t||0);return e?O(e.slide)[u("width")]+(n?0:w()):0},sliderSize:function(){return b(t.length-1,!0)-b(-1,!0)},totalSize:b,getPadding:function(t){return parseFloat(z(a,u("padding"+(t?"Right":"Left"))))||0}}},Clones:function(t,n,e){const{on:i,emit:o}=Ot(t),{Elements:s,Slides:c}=n,{resolve:u}=n.Direction,a=[];let d;function f(){(d=y())&&(function(n){const i=c.get().slice(),{length:o}=i;if(o){for(;i.length<n;)m(i,i);m(i.slice(-n),i.slice(0,n)).forEach(((r,u)=>{const l=u<n,d=function(n,i){const o=n.cloneNode(!0);return b(o,e.classes.clone),o.id=`${t.root.id}-clone${it(i+1)}`,o}(r.slide,u);l?E(d,i[0].slide):w(s.list,d),m(a,d),c.register(d,u-n+(l?0:o),r.index)}))}}(d),o(_t))}function p(){T(a),r(a)}function h(){p(),f()}function g(){d<y()&&o(mt)}function y(){let{clones:n}=e;if(t.is(sn)){if(!n){const i=function(t,n){if(l(n)){const e=N("div",{style:`width: ${n}; position: absolute;`},t);n=O(e).width,T(e)}return n}(s.list,e[u("fixedWidth")]);n=(i&&K(O(s.track)[u("width")]/i)||e[u("autoWidth")]&&t.length||e.perPage)*(e.drag?(e.flickMaxPages||1)+1:2)}}else n=0;return n}return{mount:function(){f(),i(mt,h),i([yt,_t],g)},destroy:p}},Move:function(t,n,e){const{on:i,emit:o}=Ot(t),{slideSize:s,getPadding:r,totalSize:c,listSize:u,sliderSize:l}=n.Layout,{resolve:d,orient:f}=n.Direction,{list:p,track:h}=n.Elements;let g;function m(){x()||(n.Scroll.cancel(),y(t.index),o(bt))}function y(t){_(b(t,!0))}function _(n,e){if(!t.is(rn)){const i=e?n:function(n){if(t.is(sn)){const t=f(n-w()),e=S(!1,n)&&t<0,i=S(!0,n)&&t>0;(e||i)&&(n=v(n,i))}return n}(n);p.style.transform=`translate${d("X")}(${i}px)`,n!==i&&o(lt)}}function v(t,n){const e=t-E(n),i=l();return t-f(i*(K(Q(e)/i)||1))*(n?1:-1)}function b(n,i){const o=f(c(n-1)-function(t){const{focus:n}=e;return"center"===n?(u()-s(t,!0))/2:+n*s(t)||0}(n));return i?function(n){return e.trimSpace&&t.is(on)&&(n=tt(n,0,f(l()-u()))),n}(o):o}function w(){const t=d("left");return O(p)[t]-O(h)[t]+f(r(!1))}function E(t){return b(t?n.Controller.getEnd():0,!!e.trimSpace)}function x(){return t.state.is(4)&&e.waitForTransition}function S(t,n){n=a(n)?w():n;const e=!0!==t&&f(n)<f(E(!1)),i=!1!==t&&f(n)>f(E(!0));return e||i}return{mount:function(){g=n.Transition,i([st,vt,yt,mt],m)},destroy:function(){L(p,"style")},move:function(i,s,r,c){if(!x()){const{set:u}=t.state,l=w();i!==s&&(g.cancel(),_(v(l,i>s),!0)),u(4),o(ct,s,r,i),g.start(s,(()=>{u(3),o(ut,s,r,i),"move"===e.trimSpace&&i!==r&&l===w()?n.Controller.go(i>r?">":"<",!1,c):c&&c()}))}},jump:y,translate:_,shift:v,cancel:function(){_(w()),g.cancel()},toIndex:function(t){const e=n.Slides.get();let i=0,o=1/0;for(let n=0;n<e.length;n++){const s=e[n].index,r=Q(b(s,!0)-t);if(!(r<=o))break;o=r,i=s}return i},toPosition:b,getPosition:w,getLimit:E,isBusy:x,exceededLimit:S}},Controller:function(t,n,e){const{on:i}=Ot(t),{Move:o}=n,{getPosition:s,getLimit:r}=o,{isEnough:c,getLength:u}=n.Slides,d=t.is(sn),f=t.is(on);let p,h,g,m=e.start||0,y=m;function _(){p=u(!0),h=e.perMove,g=e.perPage,m=tt(m,0,p-1)}function v(t,e,i,s,r){const c=e?t:$(t);n.Scroll.scroll(e||i?o.toPosition(c,!0):t,s,(()=>{L(o.toIndex(o.getPosition())),r&&r()}))}function b(t){return E(!1,t)}function w(t){return E(!0,t)}function E(t,n){const e=h||(C()?1:g),i=x(m+e*(t?-1:1),m);return-1!==i||!f||(o=s(),c=r(!t),1,Q(o-c)<1)?n?i:k(i):t?0:S();var o,c}function x(t,n,i){if(c()){const o=S();t<0||t>o?t=Z(0,t,n,!0)||Z(o,n,t,!0)?P(A(t)):d?h||C()?t:t<0?-(p%g||g):p:e.rewind?t<0?o:0:-1:i||t===n||(t=h?t:P(A(n)+(t<n?-1:1)))}else t=-1;return t}function S(){let t=p-g;return(C()||d&&h)&&(t=p-1),J(t,0)}function k(t){return d?c()?t%p+(t<0?p:0):-1:t}function P(t){return tt(C()?t:g*t,0,S())}function A(t){return C()||(t=Z(t,p-g,p-1)?p-1:t,t=V(t/g)),t}function $(t){const n=o.toIndex(t);return f?tt(n,0,S()):n}function L(t){t!==m&&(y=m,m=t)}function C(){return!a(e.focus)||e.isNavigation}return{mount:function(){_(),i([yt,mt],_,9)},go:function(t,n,i){const s=function(t){let n=m;if(l(t)){const[,e,i]=t.match(/([+\-<>])(\d+)?/)||[];"+"===e||"-"===e?n=x(m+ +`${e}${+i||1}`,m,!0):">"===e?n=i?P(+i):b(!0):"<"===e&&(n=w(!0))}else n=d?t:tt(t,0,S());return n}(t);if(e.useScroll)v(s,!0,!0,e.speed,i);else{const t=k(s);t>-1&&!o.isBusy()&&(n||t!==m)&&(L(t),o.move(s,t,y,i))}},scroll:v,getNext:b,getPrev:w,getAdjacent:E,getEnd:S,setIndex:L,getIndex:function(t){return t?y:m},toIndex:P,toPage:A,toDest:$,hasFocus:C}},Arrows:function(t,n,e){const{on:i,bind:o,emit:s}=Ot(t),{classes:r,i18n:c}=e,{Elements:u,Controller:l}=n;let a,d=u.arrows,f=u.prev,p=u.next;const h={};function g(){if(e.arrows&&(f&&p||(d=N("div",r.arrows),f=m(!0),p=m(!1),a=!0,w(d,[f,p]),E(d,k("slider"===e.arrows&&u.slider||t.root)))),f&&p)if(h.prev)D(d,!1===e.arrows?"none":"");else{const{id:t}=u.track;C(f,Vt,t),C(p,Vt,t),h.prev=f,h.next=p,function(){const{go:t}=l;i([st,ut,yt,mt,kt],y),o(p,"click",(()=>{t(">",!0)})),o(f,"click",(()=>{t("<",!0)}))}(),s(At,f,p)}}function m(t){return I(`<button class="${r.arrow} ${t?r.prev:r.next}" type="button"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" width="40" height="40"><path d="${e.arrowPath||"m15.5 0.932-4.3 4.38 14.5 14.6-14.5 14.5 4.3 4.4 14.6-14.6 4.4-4.3-4.4-4.4-14.6-14.6z"}" />`)}function y(){const n=t.index,e=l.getPrev(),i=l.getNext(),o=e>-1&&n<e?c.last:c.prev,r=i>-1&&n>i?c.first:c.next;f.disabled=e<0,p.disabled=i<0,C(f,Qt,o),C(p,Qt,r),s($t,f,p,e,i)}return{arrows:h,mount:function(){g(),i(yt,g)},destroy:function(){a?T(d):(L(f,en),L(p,en))}}},Autoplay:function(t,n,e){const{on:i,bind:o,emit:s}=Ot(t),r=Tt(e.interval,t.go.bind(t,">"),(function(t){const{bar:n}=u;n&&z(n,"width",100*t+"%"),s(Dt,t)})),{isPaused:c}=r,{Elements:u}=n;let l,a,d;function f(t){const n=t?"pause":"play",i=u[n];i&&(C(i,Vt,u.track.id),C(i,Qt,e.i18n[n]),o(i,"click",t?h:p))}function p(){c()&&n.Slides.isEnough()&&(r.start(!e.resetProgress),a=l=d=!1,s(zt))}function h(t=!0){c()||(r.pause(),s(Mt)),d=t}function g(){d||(l||a?h(!1):p())}function m(){const i=n.Slides.getAt(t.index);r.set(i&&+M(i.slide,"data-splide-interval")||e.interval)}return{mount:function(){const{autoplay:t}=e;t&&(f(!0),f(!1),function(){const{root:t}=u;e.pauseOnHover&&o(t,"mouseenter mouseleave",(t=>{l="mouseenter"===t.type,g()})),e.pauseOnFocus&&o(t,"focusin focusout",(t=>{a="focusin"===t.type,g()})),i([ct,St,mt],r.rewind),i(ct,m)}(),"pause"!==t&&p())},destroy:r.cancel,play:p,pause:h,isPaused:c}},Cover:function(t,n,e){const{on:i}=Ot(t);function o(t){n.Slides.forEach((n=>{const e=k(n.container||n.slide,"img");e&&e.src&&s(t,e,n)}))}function s(t,n,e){e.style("background",t?`center/cover no-repeat url("${n.src}")`:"",!0),D(n,t?"none":"")}return{mount:function(){e.cover&&(i(Rt,((t,n)=>{s(!0,t,n)})),i([st,yt,mt],o.bind(null,!0)))},destroy:function(){o(!1)}}},Scroll:function(t,n,e){const{on:i,emit:o}=Ot(t),{Move:s}=n,{getPosition:r,getLimit:c,exceededLimit:u}=s;let l,a;function d(){const n=r(),e=s.toIndex(n);Z(e,0,t.length-1)||s.translate(s.shift(n,e>0),!0),a&&a(),o(kt)}function f(){l&&l.cancel()}function p(){l&&!l.isPaused()&&(f(),d())}return{mount:function(){i(ct,f),i([yt,mt],p)},destroy:f,scroll:function n(i,p,h,g){const m=r();let y=1;var _;p=p||(_=Q(i-m),J(_/1.5,800)),a=h,f(),l=Tt(p,d,(o=>{const l=r(),a=(m+(i-m)*function(t){const{easingFunc:n}=e;return n?n(t):1-Math.pow(1-t,4)}(o)-r())*y;var d;s.translate(l+a),t.is(on)&&!g&&u()&&(y*=.6,Q(a)<10&&(d=u(!1),n(c(!d),600,null,!0)))}),1),o(St),l.start()},cancel:p}},Drag:function(t,n,e){const{on:i,emit:o,bind:s,unbind:r}=Ot(t),{Move:u,Scroll:l,Controller:a}=n,{track:d}=n.Elements,{resolve:f,orient:p}=n.Direction,{getPosition:h,exceededLimit:g}=u;let m,y,_,v,b,w,E,S,k,P=!1;function A(){const{drag:t}=e;T(!t),b="free"===t}function $(t){if(!S){const{noDrag:n}=e,i=O(t),o=!n||!x(t.target,n);E=!1,!o||!i&&t.button||(u.isBusy()?j(t,!0):(k=i?d:window,_=null,v=null,s(k,un,L,cn),s(k,ln,C,cn),u.cancel(),l.cancel(),N(t)))}}function L(n){if(v||o(wt),v=n,n.cancelable){const i=M(n)-M(y);if(w){u.translate(m+function(n){return n/(P&&t.is(on)?5:1)}(i));const e=R(n)-R(y)>200,s=P!==(P=g());(e||s)&&N(n),o(Et),E=!0,j(n)}else{let{dragMinThreshold:t}=e;t=c(t)?t:{mouse:0,touch:+t||10},w=Q(i)>(O(n)?t.touch:t.mouse),D()&&j(n)}}}function C(i){r(k,un,L),r(k,ln,C);const{index:s}=t;if(v){if(w||i.cancelable&&D()){const o=function(n){if(t.is(sn)||!P){const t=y===v&&_||y,e=M(v)-M(t),i=R(n)-R(t),o=R(n)-R(v)<200;if(i&&o)return e/i}return 0}(i),r=function(t){return h()+nt(t)*Y(Q(t)*(e.flickPower||600),b?1/0:n.Layout.listSize()*(e.flickMaxPages||1))}(o);b?a.scroll(r):t.is(rn)?a.go(s+p(nt(o))):a.go(a.toDest(r),!0),j(i)}o(xt)}else b||h()===u.toPosition(s)||a.go(s,!0);w=!1}function N(t){_=y,y=t,m=h()}function z(t){!S&&E&&j(t,!0)}function D(){return Q(M(v)-M(y))>Q(M(v,!0)-M(y,!0))}function M(t,n){return(O(t)?t.touches[0]:t)[`page${f(n?"Y":"X")}`]}function R(t){return t.timeStamp}function O(t){return"undefined"!=typeof TouchEvent&&t instanceof TouchEvent}function T(t){S=t}return{mount:function(){s(d,un,q,cn),s(d,ln,q,cn),s(d,"touchstart mousedown",$,cn),s(d,"click",z,{capture:!0}),s(d,"dragstart",j),i([st,yt],A)},disable:T,isDragging:function(){return w}}},Keyboard:function(t,n,e){const{on:i,bind:o,unbind:s}=Ot(t),{root:r}=t,{resolve:c}=n.Direction;let u,l;function a(){const{keyboard:t}=e;t&&("focused"===t?(u=r,C(r,tn,0)):u=window,o(u,dn,m))}function d(){s(u,dn),f(u)&&L(u,tn)}function p(){const t=l;l=!0,U((()=>{l=t}))}function h(){d(),a()}function m(n){if(!l){const{key:e}=n,i=g(an,e)?`Arrow${e}`:e;i===c("ArrowLeft")?t.go("<"):i===c("ArrowRight")&&t.go(">")}}return{mount:function(){a(),i(yt,h),i(ct,p)},destroy:d,disable:function(t){l=t}}},LazyLoad:function(t,n,e){const{on:i,off:o,bind:s,emit:r}=Ot(t),c="sequential"===e.lazyLoad;let u=[],l=0;function a(){f(),d()}function d(){n.Slides.forEach((t=>{B(t.slide,"[data-splide-lazy], [data-splide-lazy-srcset]").forEach((n=>{const i=M(n,fn),o=M(n,pn);if(i!==n.src||o!==n.srcset){const s=e.classes.spinner,r=n.parentElement,c=k(r,`.${s}`)||N("span",s,r);C(c,Jt,"presentation"),u.push({_img:n,_Slide:t,src:i,srcset:o,_spinner:c}),!n.src&&D(n,"none")}}))})),c&&g()}function f(){l=0,u=[]}function p(){u=u.filter((n=>{const i=e.perPage*((e.preloadPages||1)+1)-1;return!n._Slide.isWithin(t.index,i)||h(n)})),u.length||o(ut)}function h(t){const{_img:n}=t;b(t._Slide.slide,qt),s(n,"load error",(n=>{!function(t,n){const{_Slide:e}=t;W(e.slide,qt),n||(T(t._spinner),D(t._img,""),r(Rt,t._img,e),r(_t)),c&&g()}(t,"error"===n.type)})),["srcset","src"].forEach((e=>{t[e]&&(C(n,e,t[e]),L(n,"src"===e?fn:pn))}))}function g(){l<u.length&&h(u[l++])}return{mount:function(){e.lazyLoad&&(d(),i(mt,a),c||i([st,mt,ut,kt],p))},destroy:f}},Pagination:function(t,n,e){const{on:i,emit:o,bind:s,unbind:c}=Ot(t),{Slides:u,Elements:l,Controller:a}=n,{hasFocus:d,getIndex:f}=a,p=[];let h;function g(){m(),e.pagination&&u.isEnough()&&(function(){const{length:n}=t,{classes:i,i18n:o,perPage:r}=e,c="slider"===e.pagination&&l.slider||l.root,a=d()?n:K(n/r);h=N("ul",i.pagination,c);for(let t=0;t<a;t++){const n=N("li",null,h),e=N("button",{class:i.page,type:"button"},n),c=u.getIn(t).map((t=>t.slide.id)),l=!d()&&r>1?o.pageX:o.slideX;s(e,"click",y.bind(null,t)),C(e,Vt,c.join(" ")),C(e,Qt,et(l,t+1)),p.push({li:n,button:e,page:t})}}(),o(Lt,{list:h,items:p},_(t.index)),v())}function m(){h&&(T(h),p.forEach((t=>{c(t.button,"click")})),r(p),h=null)}function y(t){a.go(`>${t}`,!0,(()=>{const n=u.getAt(a.toIndex(t));var e;n&&((e=n.slide).setActive&&e.setActive()||e.focus({preventScroll:!0}))}))}function _(t){return p[a.toPage(t)]}function v(){const t=_(f(!0)),n=_(f());t&&(W(t.button,Wt),L(t.button,Kt)),n&&(b(n.button,Wt),C(n.button,Kt,!0)),o(Ct,{list:h,items:p},t,n)}return{items:p,mount:function(){g(),i([yt,mt],g),i([ct,kt],v)},destroy:m,getAt:_,update:v}},Sync:function(t,n,e){const{list:i}=n.Elements,o=[];function s(){t.splides.forEach((n=>{var e;!n.isParent&&(e=n.splide,[t,e].forEach((n=>{const i=Ot(n),s=n===t?e:t;i.on(ct,((t,n,e)=>{s.go(s.is(sn)?e:t)})),o.push(i)})))})),e.isNavigation&&function(){const n=Ot(t),{on:e}=n;e(at,l),e(gt,a),e([st,yt],u),C(i,Jt,"menu"),o.push(n),n.emit(Nt,t.splides)}()}function c(){L(i,en),o.forEach((t=>{t.destroy()})),r(o)}function u(){C(i,nn,e.direction!==jt?"horizontal":null)}function l(n){t.go(n.index)}function a(t,n){g(hn,n.key)&&(l(t),j(n))}return{mount:s,destroy:c,remount:function(){c(),s()}}},Wheel:function(t,n,e){const{bind:i}=Ot(t);function o(i){if(i.cancelable){const{deltaY:o}=i;if(o){const s=o<0;t.go(s?"<":">"),function(i){return!e.releaseWheel||t.state.is(4)||-1!==n.Controller.getAdjacent(i)}(s)&&j(i)}}}return{mount:function(){e.wheel&&i(n.Elements.track,"wheel",o,cn)}}}}),mn={type:"slide",speed:400,waitForTransition:!0,perPage:1,cloneStatus:!0,arrows:!0,pagination:!0,interval:5e3,pauseOnHover:!0,pauseOnFocus:!0,resetProgress:!0,keyboard:!0,easing:"cubic-bezier(0.25, 1, 0.5, 1)",drag:!0,direction:"ltr",slideFocus:!0,trimSpace:!0,focusableNodes:"a, button, textarea, input, select, iframe",classes:Yt,i18n:{prev:"Previous slide",next:"Next slide",first:"Go to first slide",last:"Go to last slide",slideX:"Go to slide %s",pageX:"Go to page %s",play:"Start autoplay",pause:"Pause autoplay"}};function yn(t,n,e){const{on:i}=Ot(t);return{mount:function(){i([st,mt],(()=>{U((()=>{n.Slides.style("transition",`opacity ${e.speed}ms ${e.easing}`)}))}))},start:function(t,e){const{track:i}=n.Elements;z(i,"height",H(O(i).height)),U((()=>{e(),z(i,"height","")}))},cancel:q}}function vn(t,n,e){const{bind:i}=Ot(t),{Move:o,Controller:s}=n,{list:r}=n.Elements;let c;function u(){l("")}function l(t){z(r,"transition",t)}return{mount:function(){i(r,"transitionend",(t=>{t.target===r&&c&&(u(),c())}))},start:function(n,i){const r=o.toPosition(n,!0),u=o.getPosition(),a=function(n){const{rewindSpeed:i}=e;if(t.is(on)&&i){const t=s.getIndex(!0),e=s.getEnd();if(0===t&&n>=e||t>=e&&0===n)return i}return e.speed}(n);Q(r-u)>=1&&a>=1?(l(`transform ${a}ms ${e.easing}`),o.translate(r,!0),c=i):(o.jump(n),i())},cancel:u}}var bn=class{constructor(t,n){this.event=function(){let t={};function n(n,i){e(n,((n,e)=>{const o=t[n];t[n]=o&&o.filter((t=>t._key?t._key!==i:i||t._namespace!==e))}))}function e(t,n){p(t).join(" ").split(" ").forEach((t=>{const e=t.split(".");n(e[0],e[1])}))}return{on:function(n,i,o,s=10){e(n,((n,e)=>{t[n]=t[n]||[],m(t[n],{_event:n,_callback:i,_namespace:e,_priority:s,_key:o}).sort(((t,n)=>t._priority-n._priority))}))},off:n,offBy:function(e){P(t,((t,i)=>{n(i,e)}))},emit:function(n){(t[n]||[]).forEach((t=>{t._callback.apply(t,_(arguments,1))}))},destroy:function(){t={}}}}(),this.Components={},this.state=function(t){let n=1;return{set:function(t){n=t},is:function(t){return g(p(t),n)}}}(),this.splides=[],this._options={},this._Extensions={};const e=l(t)?F(document,t):t;X(e,`${e} is invalid.`),this.root=e,$(mn,bn.defaults),$($(this._options,mn),n||{})}mount(t,n){const{state:e,Components:i}=this;return X(e.is([1,5]),"Already mounted!"),e.set(1),this._Components=i,this._Transition=n||this._Transition||(this.is(rn)?yn:vn),this._Extensions=t||this._Extensions,P(A({},gn,this._Extensions,{Transition:this._Transition}),((t,n)=>{const e=t(this,i,this._options);i[n]=e,e.setup&&e.setup()})),P(i,(t=>{t.mount&&t.mount()})),this.emit(st),b(this.root,"is-initialized"),e.set(3),this.emit(rt),this}sync(t){return this.splides.push({splide:t}),t.splides.push({splide:this,isParent:!0}),this.state.is(3)&&(this._Components.Sync.remount(),t.Components.Sync.remount()),this}go(t){return this._Components.Controller.go(t),this}on(t,n){return this.event.on(t,n,null,20),this}off(t){return this.event.off(t),this}emit(t){return this.event.emit(t,..._(arguments,1)),this}add(t,n){return this._Components.Slides.add(t,n),this}remove(t){return this._Components.Slides.remove(t),this}is(t){return this._options.type===t}refresh(){return this.emit(mt),this}destroy(t=!0){const{event:n,state:e}=this;return e.is(1)?n.on(rt,this.destroy.bind(this,t),this):(P(this._Components,(n=>{n.destroy&&n.destroy(t)}),!0),n.emit(Pt),n.destroy(),t&&r(this.splides),e.set(5)),this}get options(){return this._options}set options(t){const{_options:n}=this;$(n,t),this.state.is(1)||this.emit(yt,n)}get length(){return this._Components.Slides.getLength(!0)}get index(){return this._Components.Controller.getIndex()}},wn=bn;wn.defaults={},wn.STATES={CREATED:1,MOUNTED:2,IDLE:3,MOVING:4,DESTROYED:5};var En=[[st,"onMounted"],[rt,"onReady"],[ct,"onMove"],[ut,"onMoved"],[at,"onClick"],[dt,"onActive"],[ft,"onInactive"],[pt,"onVisible"],[ht,"onHidden"],[mt,"onRefresh"],[yt,"onUpdated"],[_t,"onResize"],[vt,"onResized"],[wt,"onDrag"],[Et,"onDragging"],[xt,"onDragged"],[St,"onScroll"],[kt,"onScrolled"],[Pt,"onDestroy"],[At,"onArrowsMounted"],[$t,"onArrowsUpdated"],[Lt,"onPaginationMounted"],[Ct,"onPaginationUpdated"],[Nt,"onNavigationMounted"],[zt,"onAutoplayPlay"],[Dt,"onAutoplayPlaying"],[Mt,"onAutoplayPause"],[Rt,"onLazyLoadLoaded"]];function xn(...t){return t.filter(Boolean).join(" ")}function Sn(t){return null!==t&&"object"==typeof t}function kn(t,n){if(Array.isArray(t)&&Array.isArray(n))return t.length===n.length&&!t.some(((t,e)=>!kn(t,n[e])));if(Sn(t)&&Sn(n)){const e=Object.keys(t),i=Object.keys(n);return e.length===i.length&&!e.some((e=>!Object.prototype.hasOwnProperty.call(n,e)||!kn(t[e],n[e])))}return t===n}function Pn(t,n){const e=t;return function(t,n){if(t){const e=Object.keys(t);for(let i=0;i<e.length;i++){const o=e[i];if("__proto__"!==o&&!1===n(t[o],o))break}}}(n,((t,n)=>{Array.isArray(t)?e[n]=t.slice():Sn(t)?e[n]=Pn(Sn(e[n])?e[n]:{},t):e[n]=t})),e}var An=class extends i().Component{constructor(){super(...arguments),this.splideRef=i().createRef(),this.slides=[]}componentDidMount(){const{options:t,Extensions:n,Transition:e}=this.props,{current:i}=this.splideRef;i&&(this.splide=new wn(i,t),this.bind(this.splide),this.splide.mount(n,e),this.options=Pn({},t||{}),this.slides=this.getSlides())}componentWillUnmount(){this.splide&&(this.splide.destroy(),this.splide=void 0),this.options=void 0,this.slides.length=0}componentDidUpdate(){if(!this.splide)return;const{options:t}=this.props;t&&!kn(this.options,t)&&(this.splide.options=t,this.options=Pn({},t));const n=this.getSlides();var e,i;e=this.slides,i=n,(e.length!==i.length||e.some(((t,n)=>t!==i[n])))&&(this.splide.refresh(),this.slides=n)}sync(t){var n;null==(n=this.splide)||n.sync(t)}go(t){var n;null==(n=this.splide)||n.go(t)}getSlides(){var t;if(this.splide){const n=null==(t=this.splide.Components.Elements)?void 0:t.list.children;return n&&Array.prototype.slice.call(n)||[]}return[]}bind(t){En.forEach((([n,e])=>{const i=this.props[e];"function"==typeof i&&t.on(n,((...n)=>{i(t,...n)}))}))}renderTrack(){return i().createElement("div",{className:"splide__track"},i().createElement("ul",{className:"splide__list"},this.props.children))}render(){const{id:t,className:n,hasSliderWrapper:e,hasAutoplayProgress:o,hasAutoplayControls:s,playButtonLabel:r="Play",pauseButtonLabel:c="Pause",renderControls:u}=this.props;return i().createElement("div",{id:t,className:xn("splide",n),ref:this.splideRef},e?i().createElement("div",{className:"splide__slider"},this.renderTrack()):this.renderTrack(),o&&i().createElement("div",{className:"splide__progress"},i().createElement("div",{className:"splide__progress__bar"})),s&&i().createElement("div",{className:"splide__autoplay"},i().createElement("button",{className:"splide__play"},r),i().createElement("button",{className:"splide__pause"},c)),u&&u())}},$n=({children:t,className:n,...e})=>i().createElement("li",{className:xn("splide__slide",n),...e},t);function Ln(t){return t.images=t.images.filter((function(t){return t.id>0})),t.images.length>0?(0,n.createElement)(An,{options:{type:t.type,rewind:parseInt(t.rewind),heightRatio:t.height_ratio,gap:t.gap+"px",padding:t.padding+"%",breakpoints:""==t.breakpoint?"":{[t.breakpoint]:{type:t.type,rewind:parseInt(t.rewind),heightRatio:t.breakpoint_height_ratio,gap:t.breakpoint_gap+"px",padding:t.breakpoint_padding+"%"}}}},t.images.map((t=>(0,n.createElement)($n,null,(0,n.createElement)("a",{className:"foobox",rel:"gallery",href:t.front_url},(0,n.createElement)("img",{src:t.front_url,alt:""})))))):null}document.querySelectorAll(".splide_element").forEach((function(t){const e=JSON.parse(t.querySelector("pre").innerHTML);s().render((0,n.createElement)(Ln,e),t),t.classList.remove("splide_element")}))}(); -
bps-splide-slider-block/trunk/index.php
r2684849 r2793666 17 17 function __construct() { 18 18 19 $this->sbp_ default_image_size_name = 'splide-slider';20 $this->sbp_ default_image_width = '900';21 $this->sbp_ default_image_height = '600';22 $this->sbp_ default_type = 'loop';23 $this->sbp_ default_rewind = '1';24 $this->sbp_ default_height_ratio = '0.6';25 $this->sbp_ default_gap = '20';26 $this->sbp_ default_padding = '20';27 $this->sbp_ default_breakpoint = '';28 $this->sbp_ default_breakpoint_height_ratio = '1';29 $this->sbp_ default_breakpoint_gap = '0';30 $this->sbp_ default_breakpoint_padding = '0';19 $this->sbp_image_size_name = 'splide-slider'; 20 $this->sbp_image_width = '900'; 21 $this->sbp_image_height = '600'; 22 $this->sbp_type = 'loop'; 23 $this->sbp_rewind = '1'; 24 $this->sbp_height_ratio = '0.6'; 25 $this->sbp_gap = '20'; 26 $this->sbp_padding = '20'; 27 $this->sbp_breakpoint = ''; 28 $this->sbp_breakpoint_height_ratio = '1'; 29 $this->sbp_breakpoint_gap = '0'; 30 $this->sbp_breakpoint_padding = '0'; 31 31 32 32 $this->splide_slider_type_options = ['slide', 'loop', 'fade']; 33 33 34 add_image_size($this->sbp_ default_image_size_name, get_option('sbp_image_width') ? get_option('sbp_image_width') : $this->sbp_default_image_width, get_option('sbp_image_height') ? get_option('sbp_image_height') : $this->sbp_default_image_height, true);34 add_image_size($this->sbp_image_size_name, get_option('sbp_image_width') ? get_option('sbp_image_width') : $this->sbp_image_width, get_option('sbp_image_height') ? get_option('sbp_image_height') : $this->sbp_image_height, true); 35 35 36 36 add_action('init', array($this, 'onInit')); … … 51 51 'editor_style' => 'sbp_style', 52 52 'editor_script' => 'sbp_script', 53 'render_callback' => array($this, 'render') 53 'render_callback' => array($this, 'render'), 54 // Attributes are loaded in following order: 55 // - Default values as specified in constructor 56 // - Values changed via Settings page 57 // - Values specified in custom post type block template 58 // - Values set for a specific block via block controls 59 'attributes' => array( 60 'images' => array( 61 'type' => 'array', 62 'default' => array( 63 array( 64 'id' => '', 65 'front_url' => '', 66 'block_url' => '' 67 ) 68 ) 69 ), 70 'type' => array( 71 'type' => 'string', 72 'default' => get_option('sbp_type') ? get_option('sbp_type') : $this->sbp_type 73 ), 74 'rewind' => array( 75 'type' => 'bool', 76 'default' => (get_option('sbp_rewind') || get_option('sbp_rewind') === '0') ? get_option('sbp_rewind') : $this->sbp_rewind, 77 ), 78 'height_ratio' => array( 79 'type' => 'number', 80 'default' => get_option('sbp_height_ratio') ? get_option('sbp_height_ratio') : $this->sbp_height_ratio, 81 ), 82 'gap' => array( 83 'type' => 'number', 84 'default' => (get_option('sbp_gap') || get_option('sbp_gap') === '0') ? get_option('sbp_gap') : $this->sbp_gap, 85 ), 86 'padding' => array( 87 'type' => 'number', 88 'default' => (get_option('sbp_padding') || get_option('sbp_padding') === '0') ? get_option('sbp_padding') : $this->sbp_padding, 89 ), 90 'breakpoint' => array( 91 'type' => 'number', 92 'default' => get_option('sbp_breakpoint') ? get_option('sbp_breakpoint') : $this->sbp_breakpoint, 93 ), 94 'breakpoint_height_ratio' => array( 95 'type' => 'number', 96 'default' => get_option('sbp_breakpoint_height_ratio') ? get_option('sbp_breakpoint_height_ratio') : $this->sbp_breakpoint_height_ratio, 97 ), 98 'breakpoint_gap' => array( 99 'type' => 'number', 100 'default' => (get_option('sbp_breakpoint_gap') || get_option('sbp_breakpoint_gap') === '0') ? get_option('sbp_breakpoint_gap') : $this->sbp_breakpoint_gap, 101 ), 102 'breakpoint_padding' => array( 103 'type' => 'number', 104 'default' => (get_option('sbp_breakpoint_padding') || get_option('sbp_breakpoint_padding') === '0') ? get_option('sbp_breakpoint_padding') : $this->sbp_breakpoint_padding, 105 ), 106 ) 54 107 )); 55 108 } 56 109 57 function render($ data) {110 function render($attributes) { 58 111 if (!is_admin()) { 59 112 wp_enqueue_style('sbp_frontend_style', plugin_dir_url(__FILE__) . 'build/frontend.css'); 60 113 wp_enqueue_script('sbp_frontend_script', plugin_dir_url(__FILE__) . 'build/frontend.js', array('wp-element')); 61 $options = array( 62 'type' => get_option('sbp_type') ? get_option('sbp_type') : $this->sbp_default_type, 63 'rewind' => get_option('sbp_rewind') ? get_option('sbp_rewind') : $this->sbp_default_rewind, 64 'height_ratio' => get_option('sbp_height_ratio') ? get_option('sbp_height_ratio') : $this->sbp_default_height_ratio, 65 'gap' => get_option('sbp_gap') ? get_option('sbp_gap') : $this->sbp_default_gap, 66 'padding' => get_option('sbp_padding') ? get_option('sbp_padding') : $this->sbp_default_padding, 67 'breakpoint' => get_option('sbp_breakpoint') ? get_option('sbp_breakpoint') : $this->sbp_default_breakpoint, 68 'breakpoint_height_ratio' => get_option('sbp_breakpoint_height_ratio') ? get_option('sbp_breakpoint_height_ratio') : $this->sbp_default_breakpoint_height_ratio, 69 'breakpoint_gap' => get_option('sbp_breakpoint_gap') ? get_option('sbp_breakpoint_gap') : $this->sbp_default_breakpoint_gap, 70 'breakpoint_padding' => get_option('sbp_breakpoint_padding') ? get_option('sbp_breakpoint_padding') : $this->sbp_default_breakpoint_padding, 71 ); 72 wp_localize_script('sbp_frontend_script', 'slider_options', $options); 73 } 74 75 if (array_key_exists('images', $data)) { 76 foreach ($data['images'] as $key => $image) { 114 } 115 116 if (array_key_exists('images', $attributes)) { 117 foreach ($attributes['images'] as $key => $image) { 77 118 if (array_key_exists('id', $image)) { 78 119 $image_id = $image['id']; 79 120 if (wp_get_attachment_metadata($image_id)) { 80 121 $image_data = wp_get_attachment_metadata($image_id); 81 if (array_key_exists($this->sbp_ default_image_size_name, $image_data['sizes'])) {82 $ data['images'][$key]['front_url'] = wp_get_upload_dir()['url'] . '/' . $image_data['sizes'][$this->sbp_default_image_size_name]['file'];122 if (array_key_exists($this->sbp_image_size_name, $image_data['sizes'])) { 123 $attributes['images'][$key]['front_url'] = wp_get_upload_dir()['url'] . '/' . $image_data['sizes'][$this->sbp_image_size_name]['file']; 83 124 } 84 125 } … … 86 127 } 87 128 } 129 88 130 ob_start() ?> 89 131 <div class="splide_element"> 90 <pre style="display: none;"><?php echo wp_json_encode($ data) ?></pre>132 <pre style="display: none;"><?php echo wp_json_encode($attributes) ?></pre> 91 133 </div> 92 134 <?php return ob_get_clean(); … … 103 145 104 146 add_settings_field('sbp_image_width', esc_html__('Image width in px', 'bps-slider-block'), array($this, 'imageWidthHTML'), 'splide-settings', 'sbp_main_section'); 105 register_setting('splide_block_plugin', 'sbp_image_width', array('sanitize_callback' => array($this, 'sanitizeImageWidth'), 'default' => $this->sbp_ default_image_width));147 register_setting('splide_block_plugin', 'sbp_image_width', array('sanitize_callback' => array($this, 'sanitizeImageWidth'), 'default' => $this->sbp_image_width)); 106 148 107 149 add_settings_field('sbp_image_height', esc_html__('Image height in px', 'bps-slider-block'), array($this, 'imageHeightHTML'), 'splide-settings', 'sbp_main_section'); 108 register_setting('splide_block_plugin', 'sbp_image_height', array('sanitize_callback' => array($this, 'sanitizeImageHeight'), 'default' => $this->sbp_ default_image_height));150 register_setting('splide_block_plugin', 'sbp_image_height', array('sanitize_callback' => array($this, 'sanitizeImageHeight'), 'default' => $this->sbp_image_height)); 109 151 110 152 add_settings_field('sbp_type', esc_html__('Type', 'bps-slider-block'), array($this, 'typeHTML'), 'splide-settings', 'sbp_main_section'); 111 register_setting('splide_block_plugin', 'sbp_type', array('sanitize_callback' => array($this, 'sanitizeType'), 'default' => $this->sbp_ default_type));153 register_setting('splide_block_plugin', 'sbp_type', array('sanitize_callback' => array($this, 'sanitizeType'), 'default' => $this->sbp_type)); 112 154 113 155 add_settings_field('sbp_rewind', esc_html__('Rewind', 'bps-slider-block'), array($this, 'rewindHTML'), 'splide-settings', 'sbp_main_section'); 114 register_setting('splide_block_plugin', 'sbp_rewind', array('sanitize_callback' => array($this, 'sanitizeRewind'), 'default' => $this->sbp_ default_rewind));156 register_setting('splide_block_plugin', 'sbp_rewind', array('sanitize_callback' => array($this, 'sanitizeRewind'), 'default' => $this->sbp_rewind)); 115 157 116 158 add_settings_field('sbp_height_ratio', esc_html__('Height ratio', 'bps-slider-block'), array($this, 'heightRatioHTML'), 'splide-settings', 'sbp_main_section'); 117 register_setting('splide_block_plugin', 'sbp_height_ratio', array('sanitize_callback' => array($this, 'sanitizeHeightRatio'), 'default' => $this->sbp_ default_height_ratio));159 register_setting('splide_block_plugin', 'sbp_height_ratio', array('sanitize_callback' => array($this, 'sanitizeHeightRatio'), 'default' => $this->sbp_height_ratio)); 118 160 119 161 add_settings_field('sbp_gap', esc_html__('Gap in px', 'bps-slider-block'), array($this, 'gapHTML'), 'splide-settings', 'sbp_main_section'); 120 register_setting('splide_block_plugin', 'sbp_gap', array('sanitize_callback' => array($this, 'sanitizeGap'), 'default' => $this->sbp_ default_gap));162 register_setting('splide_block_plugin', 'sbp_gap', array('sanitize_callback' => array($this, 'sanitizeGap'), 'default' => $this->sbp_gap)); 121 163 122 164 add_settings_field('sbp_padding', esc_html__('Padding in %', 'bps-slider-block'), array($this, 'paddingHTML'), 'splide-settings', 'sbp_main_section'); 123 register_setting('splide_block_plugin', 'sbp_padding', array('sanitize_callback' => array($this, 'sanitizePadding'), 'default' => $this->sbp_ default_padding));165 register_setting('splide_block_plugin', 'sbp_padding', array('sanitize_callback' => array($this, 'sanitizePadding'), 'default' => $this->sbp_padding)); 124 166 125 167 // Optional breakpoint settings … … 127 169 128 170 add_settings_field('sbp_breakpoint', esc_html__('Breakpoint in px', 'bps-slider-block'), array($this, 'breakpointHTML'), 'splide-settings', 'sbp_breakpoint_section'); 129 register_setting('splide_block_plugin', 'sbp_breakpoint', array('sanitize_callback' => array($this, 'sanitizeBreakpoint'), 'default' => $this->sbp_ default_breakpoint));171 register_setting('splide_block_plugin', 'sbp_breakpoint', array('sanitize_callback' => array($this, 'sanitizeBreakpoint'), 'default' => $this->sbp_breakpoint)); 130 172 131 173 add_settings_field('sbp_breakpoint_height_ratio', esc_html__('Height ratio', 'bps-slider-block'), array($this, 'breakpointHeightRatioHTML'), 'splide-settings', 'sbp_breakpoint_section'); 132 register_setting('splide_block_plugin', 'sbp_breakpoint_height_ratio', array('sanitize_callback' => array($this, 'sanitizeBreakpointHeightRatio'), 'default' => $this->sbp_ default_breakpoint_height_ratio));174 register_setting('splide_block_plugin', 'sbp_breakpoint_height_ratio', array('sanitize_callback' => array($this, 'sanitizeBreakpointHeightRatio'), 'default' => $this->sbp_breakpoint_height_ratio)); 133 175 134 176 add_settings_field('sbp_breakpoint_gap', esc_html__('Gap in px', 'bps-slider-block'), array($this, 'breakpointGapHTML'), 'splide-settings', 'sbp_breakpoint_section'); 135 register_setting('splide_block_plugin', 'sbp_breakpoint_gap', array('sanitize_callback' => array($this, 'sanitizeBreakpointGap'), 'default' => $this->sbp_ default_breakpoint_gap));177 register_setting('splide_block_plugin', 'sbp_breakpoint_gap', array('sanitize_callback' => array($this, 'sanitizeBreakpointGap'), 'default' => $this->sbp_breakpoint_gap)); 136 178 137 179 add_settings_field('sbp_breakpoint_padding', esc_html__('Padding in %', 'bps-slider-block'), array($this, 'breakpointPaddingHTML'), 'splide-settings', 'sbp_breakpoint_section'); 138 register_setting('splide_block_plugin', 'sbp_breakpoint_padding', array('sanitize_callback' => array($this, 'sanitizeBreakpointPadding'), 'default' => $this->sbp_ default_breakpoint_padding));180 register_setting('splide_block_plugin', 'sbp_breakpoint_padding', array('sanitize_callback' => array($this, 'sanitizeBreakpointPadding'), 'default' => $this->sbp_breakpoint_padding)); 139 181 } 140 182 … … 206 248 207 249 function sanitizeRewind($input) { 208 if ($input != 1) {250 if ($input != '1') { 209 251 $input = '0'; 210 252 } … … 258 300 259 301 function sanitizeBreakpoint($input) { 260 if ((is_numeric($input) && $input >= 100 && $input <= 1500) || empty($input)) {302 if ((is_numeric($input) && $input >= 100 && $input <= 1500) || $input == "") { 261 303 return sanitize_text_field($input); 262 304 } else { … … 297 339 function adminPageHTML() { ?> 298 340 <div class="wrap"> 299 <h1>Splide Slider Block <?php e cho esc_html__('Settings', 'bps-slider-block') ?></h1>341 <h1>Splide Slider Block <?php esc_html_e('Settings', 'bps-slider-block') ?></h1> 300 342 <form action="options.php" method="post"> 301 343 <?php -
bps-splide-slider-block/trunk/languages/bps-slider-block-nl_NL.po
r2684849 r2793666 7 7 "block\n" 8 8 "POT-Creation-Date: 2022-02-24T13:41:53+01:00\n" 9 "PO-Revision-Date: 2022- 02-24 13:47+0100\n"9 "PO-Revision-Date: 2022-10-03 21:13+0200\n" 10 10 "Last-Translator: \n" 11 11 "Language-Team: Nederlands\n" … … 25 25 #. Description of the plugin 26 26 msgid "Custom block for Splide slider with customizable parameters" 27 msgstr " "27 msgstr "Custom blok voor Splide slider met aanpasbare parameters" 28 28 29 29 #. Author of the plugin
Note: See TracChangeset
for help on using the changeset viewer.