[ Index ] |
PHP Cross Reference of WordPress |
[Summary view] [Print] [Text view]
1 this["wp"] = this["wp"] || {}; this["wp"]["blockEditor"] = 2 /******/ (function(modules) { // webpackBootstrap 3 /******/ // The module cache 4 /******/ var installedModules = {}; 5 /******/ 6 /******/ // The require function 7 /******/ function __webpack_require__(moduleId) { 8 /******/ 9 /******/ // Check if module is in cache 10 /******/ if(installedModules[moduleId]) { 11 /******/ return installedModules[moduleId].exports; 12 /******/ } 13 /******/ // Create a new module (and put it into the cache) 14 /******/ var module = installedModules[moduleId] = { 15 /******/ i: moduleId, 16 /******/ l: false, 17 /******/ exports: {} 18 /******/ }; 19 /******/ 20 /******/ // Execute the module function 21 /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 22 /******/ 23 /******/ // Flag the module as loaded 24 /******/ module.l = true; 25 /******/ 26 /******/ // Return the exports of the module 27 /******/ return module.exports; 28 /******/ } 29 /******/ 30 /******/ 31 /******/ // expose the modules object (__webpack_modules__) 32 /******/ __webpack_require__.m = modules; 33 /******/ 34 /******/ // expose the module cache 35 /******/ __webpack_require__.c = installedModules; 36 /******/ 37 /******/ // define getter function for harmony exports 38 /******/ __webpack_require__.d = function(exports, name, getter) { 39 /******/ if(!__webpack_require__.o(exports, name)) { 40 /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 41 /******/ } 42 /******/ }; 43 /******/ 44 /******/ // define __esModule on exports 45 /******/ __webpack_require__.r = function(exports) { 46 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 47 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 48 /******/ } 49 /******/ Object.defineProperty(exports, '__esModule', { value: true }); 50 /******/ }; 51 /******/ 52 /******/ // create a fake namespace object 53 /******/ // mode & 1: value is a module id, require it 54 /******/ // mode & 2: merge all properties of value into the ns 55 /******/ // mode & 4: return value when already ns object 56 /******/ // mode & 8|1: behave like require 57 /******/ __webpack_require__.t = function(value, mode) { 58 /******/ if(mode & 1) value = __webpack_require__(value); 59 /******/ if(mode & 8) return value; 60 /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 61 /******/ var ns = Object.create(null); 62 /******/ __webpack_require__.r(ns); 63 /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 64 /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 65 /******/ return ns; 66 /******/ }; 67 /******/ 68 /******/ // getDefaultExport function for compatibility with non-harmony modules 69 /******/ __webpack_require__.n = function(module) { 70 /******/ var getter = module && module.__esModule ? 71 /******/ function getDefault() { return module['default']; } : 72 /******/ function getModuleExports() { return module; }; 73 /******/ __webpack_require__.d(getter, 'a', getter); 74 /******/ return getter; 75 /******/ }; 76 /******/ 77 /******/ // Object.prototype.hasOwnProperty.call 78 /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 79 /******/ 80 /******/ // __webpack_public_path__ 81 /******/ __webpack_require__.p = ""; 82 /******/ 83 /******/ 84 /******/ // Load entry module and return exports 85 /******/ return __webpack_require__(__webpack_require__.s = 460); 86 /******/ }) 87 /************************************************************************/ 88 /******/ ([ 89 /* 0 */ 90 /***/ (function(module, exports) { 91 92 (function() { module.exports = this["wp"]["element"]; }()); 93 94 /***/ }), 95 /* 1 */ 96 /***/ (function(module, exports) { 97 98 (function() { module.exports = this["wp"]["i18n"]; }()); 99 100 /***/ }), 101 /* 2 */ 102 /***/ (function(module, exports) { 103 104 (function() { module.exports = this["lodash"]; }()); 105 106 /***/ }), 107 /* 3 */ 108 /***/ (function(module, exports) { 109 110 (function() { module.exports = this["wp"]["components"]; }()); 111 112 /***/ }), 113 /* 4 */ 114 /***/ (function(module, exports) { 115 116 (function() { module.exports = this["wp"]["data"]; }()); 117 118 /***/ }), 119 /* 5 */ 120 /***/ (function(module, __webpack_exports__, __webpack_require__) { 121 122 "use strict"; 123 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; }); 124 function _defineProperty(obj, key, value) { 125 if (key in obj) { 126 Object.defineProperty(obj, key, { 127 value: value, 128 enumerable: true, 129 configurable: true, 130 writable: true 131 }); 132 } else { 133 obj[key] = value; 134 } 135 136 return obj; 137 } 138 139 /***/ }), 140 /* 6 */, 141 /* 7 */ 142 /***/ (function(module, exports) { 143 144 (function() { module.exports = this["wp"]["primitives"]; }()); 145 146 /***/ }), 147 /* 8 */ 148 /***/ (function(module, __webpack_exports__, __webpack_require__) { 149 150 "use strict"; 151 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _extends; }); 152 function _extends() { 153 _extends = Object.assign || function (target) { 154 for (var i = 1; i < arguments.length; i++) { 155 var source = arguments[i]; 156 157 for (var key in source) { 158 if (Object.prototype.hasOwnProperty.call(source, key)) { 159 target[key] = source[key]; 160 } 161 } 162 } 163 164 return target; 165 }; 166 167 return _extends.apply(this, arguments); 168 } 169 170 /***/ }), 171 /* 9 */ 172 /***/ (function(module, exports, __webpack_require__) { 173 174 var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! 175 Copyright (c) 2017 Jed Watson. 176 Licensed under the MIT License (MIT), see 177 http://jedwatson.github.io/classnames 178 */ 179 /* global define */ 180 181 (function () { 182 'use strict'; 183 184 var hasOwn = {}.hasOwnProperty; 185 186 function classNames () { 187 var classes = []; 188 189 for (var i = 0; i < arguments.length; i++) { 190 var arg = arguments[i]; 191 if (!arg) continue; 192 193 var argType = typeof arg; 194 195 if (argType === 'string' || argType === 'number') { 196 classes.push(arg); 197 } else if (Array.isArray(arg) && arg.length) { 198 var inner = classNames.apply(null, arg); 199 if (inner) { 200 classes.push(inner); 201 } 202 } else if (argType === 'object') { 203 for (var key in arg) { 204 if (hasOwn.call(arg, key) && arg[key]) { 205 classes.push(key); 206 } 207 } 208 } 209 } 210 211 return classes.join(' '); 212 } 213 214 if ( true && module.exports) { 215 classNames.default = classNames; 216 module.exports = classNames; 217 } else if (true) { 218 // register as 'classnames', consistent with npm package name 219 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () { 220 return classNames; 221 }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), 222 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 223 } else {} 224 }()); 225 226 227 /***/ }), 228 /* 10 */ 229 /***/ (function(module, exports) { 230 231 (function() { module.exports = this["wp"]["compose"]; }()); 232 233 /***/ }), 234 /* 11 */ 235 /***/ (function(module, exports) { 236 237 (function() { module.exports = this["wp"]["blocks"]; }()); 238 239 /***/ }), 240 /* 12 */ 241 /***/ (function(module, __webpack_exports__, __webpack_require__) { 242 243 "use strict"; 244 245 // EXPORTS 246 __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _slicedToArray; }); 247 248 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js 249 var arrayWithHoles = __webpack_require__(38); 250 251 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js 252 function _iterableToArrayLimit(arr, i) { 253 if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; 254 var _arr = []; 255 var _n = true; 256 var _d = false; 257 var _e = undefined; 258 259 try { 260 for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { 261 _arr.push(_s.value); 262 263 if (i && _arr.length === i) break; 264 } 265 } catch (err) { 266 _d = true; 267 _e = err; 268 } finally { 269 try { 270 if (!_n && _i["return"] != null) _i["return"](); 271 } finally { 272 if (_d) throw _e; 273 } 274 } 275 276 return _arr; 277 } 278 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js 279 var unsupportedIterableToArray = __webpack_require__(31); 280 281 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js 282 var nonIterableRest = __webpack_require__(39); 283 284 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js 285 286 287 288 289 function _slicedToArray(arr, i) { 290 return Object(arrayWithHoles["a" /* default */])(arr) || _iterableToArrayLimit(arr, i) || Object(unsupportedIterableToArray["a" /* default */])(arr, i) || Object(nonIterableRest["a" /* default */])(); 291 } 292 293 /***/ }), 294 /* 13 */ 295 /***/ (function(module, exports) { 296 297 (function() { module.exports = this["React"]; }()); 298 299 /***/ }), 300 /* 14 */ 301 /***/ (function(module, __webpack_exports__, __webpack_require__) { 302 303 "use strict"; 304 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectWithoutProperties; }); 305 /* harmony import */ var _objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(43); 306 307 function _objectWithoutProperties(source, excluded) { 308 if (source == null) return {}; 309 var target = Object(_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(source, excluded); 310 var key, i; 311 312 if (Object.getOwnPropertySymbols) { 313 var sourceSymbolKeys = Object.getOwnPropertySymbols(source); 314 315 for (i = 0; i < sourceSymbolKeys.length; i++) { 316 key = sourceSymbolKeys[i]; 317 if (excluded.indexOf(key) >= 0) continue; 318 if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; 319 target[key] = source[key]; 320 } 321 } 322 323 return target; 324 } 325 326 /***/ }), 327 /* 15 */ 328 /***/ (function(module, __webpack_exports__, __webpack_require__) { 329 330 "use strict"; 331 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectWithoutPropertiesLoose; }); 332 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return _objectSpread2; }); 333 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return _createForOfIteratorHelperLoose; }); 334 function _defineProperty(obj, key, value) { 335 if (key in obj) { 336 Object.defineProperty(obj, key, { 337 value: value, 338 enumerable: true, 339 configurable: true, 340 writable: true 341 }); 342 } else { 343 obj[key] = value; 344 } 345 346 return obj; 347 } 348 349 function ownKeys(object, enumerableOnly) { 350 var keys = Object.keys(object); 351 352 if (Object.getOwnPropertySymbols) { 353 var symbols = Object.getOwnPropertySymbols(object); 354 if (enumerableOnly) symbols = symbols.filter(function (sym) { 355 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 356 }); 357 keys.push.apply(keys, symbols); 358 } 359 360 return keys; 361 } 362 363 function _objectSpread2(target) { 364 for (var i = 1; i < arguments.length; i++) { 365 var source = arguments[i] != null ? arguments[i] : {}; 366 367 if (i % 2) { 368 ownKeys(Object(source), true).forEach(function (key) { 369 _defineProperty(target, key, source[key]); 370 }); 371 } else if (Object.getOwnPropertyDescriptors) { 372 Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); 373 } else { 374 ownKeys(Object(source)).forEach(function (key) { 375 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); 376 }); 377 } 378 } 379 380 return target; 381 } 382 383 function _objectWithoutPropertiesLoose(source, excluded) { 384 if (source == null) return {}; 385 var target = {}; 386 var sourceKeys = Object.keys(source); 387 var key, i; 388 389 for (i = 0; i < sourceKeys.length; i++) { 390 key = sourceKeys[i]; 391 if (excluded.indexOf(key) >= 0) continue; 392 target[key] = source[key]; 393 } 394 395 return target; 396 } 397 398 function _unsupportedIterableToArray(o, minLen) { 399 if (!o) return; 400 if (typeof o === "string") return _arrayLikeToArray(o, minLen); 401 var n = Object.prototype.toString.call(o).slice(8, -1); 402 if (n === "Object" && o.constructor) n = o.constructor.name; 403 if (n === "Map" || n === "Set") return Array.from(o); 404 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); 405 } 406 407 function _arrayLikeToArray(arr, len) { 408 if (len == null || len > arr.length) len = arr.length; 409 410 for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; 411 412 return arr2; 413 } 414 415 function _createForOfIteratorHelperLoose(o, allowArrayLike) { 416 var it; 417 418 if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { 419 if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { 420 if (it) o = it; 421 var i = 0; 422 return function () { 423 if (i >= o.length) return { 424 done: true 425 }; 426 return { 427 done: false, 428 value: o[i++] 429 }; 430 }; 431 } 432 433 throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 434 } 435 436 it = o[Symbol.iterator](); 437 return it.next.bind(it); 438 } 439 440 441 442 443 /***/ }), 444 /* 16 */ 445 /***/ (function(module, __webpack_exports__, __webpack_require__) { 446 447 "use strict"; 448 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _assertThisInitialized; }); 449 function _assertThisInitialized(self) { 450 if (self === void 0) { 451 throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 452 } 453 454 return self; 455 } 456 457 /***/ }), 458 /* 17 */ 459 /***/ (function(module, __webpack_exports__, __webpack_require__) { 460 461 "use strict"; 462 463 // EXPORTS 464 __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _toConsumableArray; }); 465 466 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js 467 var arrayLikeToArray = __webpack_require__(27); 468 469 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js 470 471 function _arrayWithoutHoles(arr) { 472 if (Array.isArray(arr)) return Object(arrayLikeToArray["a" /* default */])(arr); 473 } 474 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js 475 var iterableToArray = __webpack_require__(37); 476 477 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js 478 var unsupportedIterableToArray = __webpack_require__(31); 479 480 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js 481 function _nonIterableSpread() { 482 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 483 } 484 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js 485 486 487 488 489 function _toConsumableArray(arr) { 490 return _arrayWithoutHoles(arr) || Object(iterableToArray["a" /* default */])(arr) || Object(unsupportedIterableToArray["a" /* default */])(arr) || _nonIterableSpread(); 491 } 492 493 /***/ }), 494 /* 18 */ 495 /***/ (function(module, exports) { 496 497 (function() { module.exports = this["wp"]["keycodes"]; }()); 498 499 /***/ }), 500 /* 19 */ 501 /***/ (function(module, __webpack_exports__, __webpack_require__) { 502 503 "use strict"; 504 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _getPrototypeOf; }); 505 function _getPrototypeOf(o) { 506 _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { 507 return o.__proto__ || Object.getPrototypeOf(o); 508 }; 509 return _getPrototypeOf(o); 510 } 511 512 /***/ }), 513 /* 20 */ 514 /***/ (function(module, exports) { 515 516 (function() { module.exports = this["regeneratorRuntime"]; }()); 517 518 /***/ }), 519 /* 21 */ 520 /***/ (function(module, __webpack_exports__, __webpack_require__) { 521 522 "use strict"; 523 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _classCallCheck; }); 524 function _classCallCheck(instance, Constructor) { 525 if (!(instance instanceof Constructor)) { 526 throw new TypeError("Cannot call a class as a function"); 527 } 528 } 529 530 /***/ }), 531 /* 22 */ 532 /***/ (function(module, __webpack_exports__, __webpack_require__) { 533 534 "use strict"; 535 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _createClass; }); 536 function _defineProperties(target, props) { 537 for (var i = 0; i < props.length; i++) { 538 var descriptor = props[i]; 539 descriptor.enumerable = descriptor.enumerable || false; 540 descriptor.configurable = true; 541 if ("value" in descriptor) descriptor.writable = true; 542 Object.defineProperty(target, descriptor.key, descriptor); 543 } 544 } 545 546 function _createClass(Constructor, protoProps, staticProps) { 547 if (protoProps) _defineProperties(Constructor.prototype, protoProps); 548 if (staticProps) _defineProperties(Constructor, staticProps); 549 return Constructor; 550 } 551 552 /***/ }), 553 /* 23 */ 554 /***/ (function(module, __webpack_exports__, __webpack_require__) { 555 556 "use strict"; 557 558 // EXPORTS 559 __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _inherits; }); 560 561 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js 562 function _setPrototypeOf(o, p) { 563 _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { 564 o.__proto__ = p; 565 return o; 566 }; 567 568 return _setPrototypeOf(o, p); 569 } 570 // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js 571 572 function _inherits(subClass, superClass) { 573 if (typeof superClass !== "function" && superClass !== null) { 574 throw new TypeError("Super expression must either be null or a function"); 575 } 576 577 subClass.prototype = Object.create(superClass && superClass.prototype, { 578 constructor: { 579 value: subClass, 580 writable: true, 581 configurable: true 582 } 583 }); 584 if (superClass) _setPrototypeOf(subClass, superClass); 585 } 586 587 /***/ }), 588 /* 24 */ 589 /***/ (function(module, __webpack_exports__, __webpack_require__) { 590 591 "use strict"; 592 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _possibleConstructorReturn; }); 593 /* harmony import */ var _helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(40); 594 /* harmony import */ var _assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16); 595 596 597 function _possibleConstructorReturn(self, call) { 598 if (call && (Object(_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(call) === "object" || typeof call === "function")) { 599 return call; 600 } 601 602 return Object(_assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(self); 603 } 604 605 /***/ }), 606 /* 25 */ 607 /***/ (function(module, exports) { 608 609 (function() { module.exports = this["wp"]["richText"]; }()); 610 611 /***/ }), 612 /* 26 */, 613 /* 27 */ 614 /***/ (function(module, __webpack_exports__, __webpack_require__) { 615 616 "use strict"; 617 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayLikeToArray; }); 618 function _arrayLikeToArray(arr, len) { 619 if (len == null || len > arr.length) len = arr.length; 620 621 for (var i = 0, arr2 = new Array(len); i < len; i++) { 622 arr2[i] = arr[i]; 623 } 624 625 return arr2; 626 } 627 628 /***/ }), 629 /* 28 */ 630 /***/ (function(module, exports, __webpack_require__) { 631 632 /** 633 * Copyright (c) 2013-present, Facebook, Inc. 634 * 635 * This source code is licensed under the MIT license found in the 636 * LICENSE file in the root directory of this source tree. 637 */ 638 639 if (false) { var throwOnDirectAccess, ReactIs; } else { 640 // By explicitly using `prop-types` you are opting into new production behavior. 641 // http://fb.me/prop-types-in-prod 642 module.exports = __webpack_require__(142)(); 643 } 644 645 646 /***/ }), 647 /* 29 */ 648 /***/ (function(module, exports) { 649 650 (function() { module.exports = this["wp"]["dom"]; }()); 651 652 /***/ }), 653 /* 30 */ 654 /***/ (function(module, exports) { 655 656 (function() { module.exports = this["wp"]["url"]; }()); 657 658 /***/ }), 659 /* 31 */ 660 /***/ (function(module, __webpack_exports__, __webpack_require__) { 661 662 "use strict"; 663 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _unsupportedIterableToArray; }); 664 /* harmony import */ var _arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(27); 665 666 function _unsupportedIterableToArray(o, minLen) { 667 if (!o) return; 668 if (typeof o === "string") return Object(_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen); 669 var n = Object.prototype.toString.call(o).slice(8, -1); 670 if (n === "Object" && o.constructor) n = o.constructor.name; 671 if (n === "Map" || n === "Set") return Array.from(o); 672 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Object(_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen); 673 } 674 675 /***/ }), 676 /* 32 */, 677 /* 33 */ 678 /***/ (function(module, exports) { 679 680 (function() { module.exports = this["wp"]["hooks"]; }()); 681 682 /***/ }), 683 /* 34 */, 684 /* 35 */, 685 /* 36 */ 686 /***/ (function(module, exports) { 687 688 (function() { module.exports = this["wp"]["deprecated"]; }()); 689 690 /***/ }), 691 /* 37 */ 692 /***/ (function(module, __webpack_exports__, __webpack_require__) { 693 694 "use strict"; 695 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _iterableToArray; }); 696 function _iterableToArray(iter) { 697 if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); 698 } 699 700 /***/ }), 701 /* 38 */ 702 /***/ (function(module, __webpack_exports__, __webpack_require__) { 703 704 "use strict"; 705 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayWithHoles; }); 706 function _arrayWithHoles(arr) { 707 if (Array.isArray(arr)) return arr; 708 } 709 710 /***/ }), 711 /* 39 */ 712 /***/ (function(module, __webpack_exports__, __webpack_require__) { 713 714 "use strict"; 715 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _nonIterableRest; }); 716 function _nonIterableRest() { 717 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 718 } 719 720 /***/ }), 721 /* 40 */ 722 /***/ (function(module, __webpack_exports__, __webpack_require__) { 723 724 "use strict"; 725 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _typeof; }); 726 function _typeof(obj) { 727 "@babel/helpers - typeof"; 728 729 if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { 730 _typeof = function _typeof(obj) { 731 return typeof obj; 732 }; 733 } else { 734 _typeof = function _typeof(obj) { 735 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; 736 }; 737 } 738 739 return _typeof(obj); 740 } 741 742 /***/ }), 743 /* 41 */ 744 /***/ (function(module, exports) { 745 746 (function() { module.exports = this["wp"]["blob"]; }()); 747 748 /***/ }), 749 /* 42 */ 750 /***/ (function(module, __webpack_exports__, __webpack_require__) { 751 752 "use strict"; 753 754 755 var LEAF_KEY, hasWeakMap; 756 757 /** 758 * Arbitrary value used as key for referencing cache object in WeakMap tree. 759 * 760 * @type {Object} 761 */ 762 LEAF_KEY = {}; 763 764 /** 765 * Whether environment supports WeakMap. 766 * 767 * @type {boolean} 768 */ 769 hasWeakMap = typeof WeakMap !== 'undefined'; 770 771 /** 772 * Returns the first argument as the sole entry in an array. 773 * 774 * @param {*} value Value to return. 775 * 776 * @return {Array} Value returned as entry in array. 777 */ 778 function arrayOf( value ) { 779 return [ value ]; 780 } 781 782 /** 783 * Returns true if the value passed is object-like, or false otherwise. A value 784 * is object-like if it can support property assignment, e.g. object or array. 785 * 786 * @param {*} value Value to test. 787 * 788 * @return {boolean} Whether value is object-like. 789 */ 790 function isObjectLike( value ) { 791 return !! value && 'object' === typeof value; 792 } 793 794 /** 795 * Creates and returns a new cache object. 796 * 797 * @return {Object} Cache object. 798 */ 799 function createCache() { 800 var cache = { 801 clear: function() { 802 cache.head = null; 803 }, 804 }; 805 806 return cache; 807 } 808 809 /** 810 * Returns true if entries within the two arrays are strictly equal by 811 * reference from a starting index. 812 * 813 * @param {Array} a First array. 814 * @param {Array} b Second array. 815 * @param {number} fromIndex Index from which to start comparison. 816 * 817 * @return {boolean} Whether arrays are shallowly equal. 818 */ 819 function isShallowEqual( a, b, fromIndex ) { 820 var i; 821 822 if ( a.length !== b.length ) { 823 return false; 824 } 825 826 for ( i = fromIndex; i < a.length; i++ ) { 827 if ( a[ i ] !== b[ i ] ) { 828 return false; 829 } 830 } 831 832 return true; 833 } 834 835 /** 836 * Returns a memoized selector function. The getDependants function argument is 837 * called before the memoized selector and is expected to return an immutable 838 * reference or array of references on which the selector depends for computing 839 * its own return value. The memoize cache is preserved only as long as those 840 * dependant references remain the same. If getDependants returns a different 841 * reference(s), the cache is cleared and the selector value regenerated. 842 * 843 * @param {Function} selector Selector function. 844 * @param {Function} getDependants Dependant getter returning an immutable 845 * reference or array of reference used in 846 * cache bust consideration. 847 * 848 * @return {Function} Memoized selector. 849 */ 850 /* harmony default export */ __webpack_exports__["a"] = (function( selector, getDependants ) { 851 var rootCache, getCache; 852 853 // Use object source as dependant if getter not provided 854 if ( ! getDependants ) { 855 getDependants = arrayOf; 856 } 857 858 /** 859 * Returns the root cache. If WeakMap is supported, this is assigned to the 860 * root WeakMap cache set, otherwise it is a shared instance of the default 861 * cache object. 862 * 863 * @return {(WeakMap|Object)} Root cache object. 864 */ 865 function getRootCache() { 866 return rootCache; 867 } 868 869 /** 870 * Returns the cache for a given dependants array. When possible, a WeakMap 871 * will be used to create a unique cache for each set of dependants. This 872 * is feasible due to the nature of WeakMap in allowing garbage collection 873 * to occur on entries where the key object is no longer referenced. Since 874 * WeakMap requires the key to be an object, this is only possible when the 875 * dependant is object-like. The root cache is created as a hierarchy where 876 * each top-level key is the first entry in a dependants set, the value a 877 * WeakMap where each key is the next dependant, and so on. This continues 878 * so long as the dependants are object-like. If no dependants are object- 879 * like, then the cache is shared across all invocations. 880 * 881 * @see isObjectLike 882 * 883 * @param {Array} dependants Selector dependants. 884 * 885 * @return {Object} Cache object. 886 */ 887 function getWeakMapCache( dependants ) { 888 var caches = rootCache, 889 isUniqueByDependants = true, 890 i, dependant, map, cache; 891 892 for ( i = 0; i < dependants.length; i++ ) { 893 dependant = dependants[ i ]; 894 895 // Can only compose WeakMap from object-like key. 896 if ( ! isObjectLike( dependant ) ) { 897 isUniqueByDependants = false; 898 break; 899 } 900 901 // Does current segment of cache already have a WeakMap? 902 if ( caches.has( dependant ) ) { 903 // Traverse into nested WeakMap. 904 caches = caches.get( dependant ); 905 } else { 906 // Create, set, and traverse into a new one. 907 map = new WeakMap(); 908 caches.set( dependant, map ); 909 caches = map; 910 } 911 } 912 913 // We use an arbitrary (but consistent) object as key for the last item 914 // in the WeakMap to serve as our running cache. 915 if ( ! caches.has( LEAF_KEY ) ) { 916 cache = createCache(); 917 cache.isUniqueByDependants = isUniqueByDependants; 918 caches.set( LEAF_KEY, cache ); 919 } 920 921 return caches.get( LEAF_KEY ); 922 } 923 924 // Assign cache handler by availability of WeakMap 925 getCache = hasWeakMap ? getWeakMapCache : getRootCache; 926 927 /** 928 * Resets root memoization cache. 929 */ 930 function clear() { 931 rootCache = hasWeakMap ? new WeakMap() : createCache(); 932 } 933 934 // eslint-disable-next-line jsdoc/check-param-names 935 /** 936 * The augmented selector call, considering first whether dependants have 937 * changed before passing it to underlying memoize function. 938 * 939 * @param {Object} source Source object for derivation. 940 * @param {...*} extraArgs Additional arguments to pass to selector. 941 * 942 * @return {*} Selector result. 943 */ 944 function callSelector( /* source, ...extraArgs */ ) { 945 var len = arguments.length, 946 cache, node, i, args, dependants; 947 948 // Create copy of arguments (avoid leaking deoptimization). 949 args = new Array( len ); 950 for ( i = 0; i < len; i++ ) { 951 args[ i ] = arguments[ i ]; 952 } 953 954 dependants = getDependants.apply( null, args ); 955 cache = getCache( dependants ); 956 957 // If not guaranteed uniqueness by dependants (primitive type or lack 958 // of WeakMap support), shallow compare against last dependants and, if 959 // references have changed, destroy cache to recalculate result. 960 if ( ! cache.isUniqueByDependants ) { 961 if ( cache.lastDependants && ! isShallowEqual( dependants, cache.lastDependants, 0 ) ) { 962 cache.clear(); 963 } 964 965 cache.lastDependants = dependants; 966 } 967 968 node = cache.head; 969 while ( node ) { 970 // Check whether node arguments match arguments 971 if ( ! isShallowEqual( node.args, args, 1 ) ) { 972 node = node.next; 973 continue; 974 } 975 976 // At this point we can assume we've found a match 977 978 // Surface matched node to head if not already 979 if ( node !== cache.head ) { 980 // Adjust siblings to point to each other. 981 node.prev.next = node.next; 982 if ( node.next ) { 983 node.next.prev = node.prev; 984 } 985 986 node.next = cache.head; 987 node.prev = null; 988 cache.head.prev = node; 989 cache.head = node; 990 } 991 992 // Return immediately 993 return node.val; 994 } 995 996 // No cached value found. Continue to insertion phase: 997 998 node = { 999 // Generate the result from original function 1000 val: selector.apply( null, args ), 1001 }; 1002 1003 // Avoid including the source object in the cache. 1004 args[ 0 ] = null; 1005 node.args = args; 1006 1007 // Don't need to check whether node is already head, since it would 1008 // have been returned above already if it was 1009 1010 // Shift existing head down list 1011 if ( cache.head ) { 1012 cache.head.prev = node; 1013 node.next = cache.head; 1014 } 1015 1016 cache.head = node; 1017 1018 return node.val; 1019 } 1020 1021 callSelector.getDependants = getDependants; 1022 callSelector.clear = clear; 1023 clear(); 1024 1025 return callSelector; 1026 }); 1027 1028 1029 /***/ }), 1030 /* 43 */ 1031 /***/ (function(module, __webpack_exports__, __webpack_require__) { 1032 1033 "use strict"; 1034 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectWithoutPropertiesLoose; }); 1035 function _objectWithoutPropertiesLoose(source, excluded) { 1036 if (source == null) return {}; 1037 var target = {}; 1038 var sourceKeys = Object.keys(source); 1039 var key, i; 1040 1041 for (i = 0; i < sourceKeys.length; i++) { 1042 key = sourceKeys[i]; 1043 if (excluded.indexOf(key) >= 0) continue; 1044 target[key] = source[key]; 1045 } 1046 1047 return target; 1048 } 1049 1050 /***/ }), 1051 /* 44 */, 1052 /* 45 */ 1053 /***/ (function(module, __webpack_exports__, __webpack_require__) { 1054 1055 "use strict"; 1056 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _asyncToGenerator; }); 1057 function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { 1058 try { 1059 var info = gen[key](arg); 1060 var value = info.value; 1061 } catch (error) { 1062 reject(error); 1063 return; 1064 } 1065 1066 if (info.done) { 1067 resolve(value); 1068 } else { 1069 Promise.resolve(value).then(_next, _throw); 1070 } 1071 } 1072 1073 function _asyncToGenerator(fn) { 1074 return function () { 1075 var self = this, 1076 args = arguments; 1077 return new Promise(function (resolve, reject) { 1078 var gen = fn.apply(self, args); 1079 1080 function _next(value) { 1081 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); 1082 } 1083 1084 function _throw(err) { 1085 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); 1086 } 1087 1088 _next(undefined); 1089 }); 1090 }; 1091 } 1092 1093 /***/ }), 1094 /* 46 */ 1095 /***/ (function(module, exports) { 1096 1097 (function() { module.exports = this["wp"]["a11y"]; }()); 1098 1099 /***/ }), 1100 /* 47 */, 1101 /* 48 */ 1102 /***/ (function(module, __webpack_exports__, __webpack_require__) { 1103 1104 "use strict"; 1105 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useLiveRef; }); 1106 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(13); 1107 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 1108 /* harmony import */ var _useIsomorphicEffect_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(59); 1109 1110 1111 1112 /** 1113 * A `React.Ref` that keeps track of the passed `value`. 1114 */ 1115 1116 function useLiveRef(value) { 1117 var ref = Object(react__WEBPACK_IMPORTED_MODULE_0__["useRef"])(value); 1118 Object(_useIsomorphicEffect_js__WEBPACK_IMPORTED_MODULE_1__[/* useIsomorphicEffect */ "a"])(function () { 1119 ref.current = value; 1120 }); 1121 return ref; 1122 } 1123 1124 1125 1126 1127 /***/ }), 1128 /* 49 */ 1129 /***/ (function(module, __webpack_exports__, __webpack_require__) { 1130 1131 "use strict"; 1132 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getDocument; }); 1133 /** 1134 * Returns `element.ownerDocument || window.document`. 1135 */ 1136 function getDocument(element) { 1137 return element ? element.ownerDocument || element : window.document; 1138 } 1139 1140 1141 1142 1143 /***/ }), 1144 /* 50 */ 1145 /***/ (function(module, __webpack_exports__, __webpack_require__) { 1146 1147 "use strict"; 1148 1149 // EXPORTS 1150 __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ createHook; }); 1151 1152 // EXTERNAL MODULE: external {"this":"React"} 1153 var external_this_React_ = __webpack_require__(13); 1154 1155 // EXTERNAL MODULE: ./node_modules/reakit-system/es/SystemContext.js 1156 var SystemContext = __webpack_require__(76); 1157 1158 // CONCATENATED MODULE: ./node_modules/reakit-system/es/useToken.js 1159 1160 1161 1162 /** 1163 * React custom hook that returns the value of any token defined in the 1164 * SystemContext. It's mainly used internally in [`useOptions`](#useoptions) 1165 * and [`useProps`](#useprops). 1166 * 1167 * @example 1168 * import { SystemProvider, useToken } from "reakit-system"; 1169 * 1170 * const system = { 1171 * token: "value", 1172 * }; 1173 * 1174 * function Component(props) { 1175 * const token = useToken("token", "default value"); 1176 * return <div {...props}>{token}</div>; 1177 * } 1178 * 1179 * function App() { 1180 * return ( 1181 * <SystemProvider unstable_system={system}> 1182 * <Component /> 1183 * </SystemProvider> 1184 * ); 1185 * } 1186 */ 1187 1188 function useToken(token, defaultValue) { 1189 Object(external_this_React_["useDebugValue"])(token); 1190 var context = Object(external_this_React_["useContext"])(SystemContext["a" /* SystemContext */]); 1191 return context[token] != null ? context[token] : defaultValue; 1192 } 1193 1194 1195 1196 // CONCATENATED MODULE: ./node_modules/reakit-system/es/useProps.js 1197 1198 1199 1200 1201 /** 1202 * React custom hook that returns the props returned by a given 1203 * `use${name}Props` in the SystemContext. 1204 * 1205 * @example 1206 * import { SystemProvider, useProps } from "reakit-system"; 1207 * 1208 * const system = { 1209 * useAProps(options, htmlProps) { 1210 * return { 1211 * ...htmlProps, 1212 * href: options.url, 1213 * }; 1214 * }, 1215 * }; 1216 * 1217 * function A({ url, ...htmlProps }) { 1218 * const props = useProps("A", { url }, htmlProps); 1219 * return <a {...props} />; 1220 * } 1221 * 1222 * function App() { 1223 * return ( 1224 * <SystemProvider unstable_system={system}> 1225 * <A url="url">It will convert url into href in useAProps</A> 1226 * </SystemProvider> 1227 * ); 1228 * } 1229 */ 1230 1231 function useProps(name, options, htmlProps) { 1232 if (options === void 0) { 1233 options = {}; 1234 } 1235 1236 if (htmlProps === void 0) { 1237 htmlProps = {}; 1238 } 1239 1240 var hookName = "use" + name + "Props"; 1241 Object(external_this_React_["useDebugValue"])(hookName); 1242 var useHook = useToken(hookName); 1243 1244 if (useHook) { 1245 return useHook(options, htmlProps); 1246 } 1247 1248 return htmlProps; 1249 } 1250 1251 1252 1253 // EXTERNAL MODULE: ./node_modules/reakit-system/es/_rollupPluginBabelHelpers-0c84a174.js 1254 var _rollupPluginBabelHelpers_0c84a174 = __webpack_require__(55); 1255 1256 // CONCATENATED MODULE: ./node_modules/reakit-system/es/useOptions.js 1257 1258 1259 1260 1261 1262 /** 1263 * React custom hook that returns the options returned by a given 1264 * `use${name}Options` in the SystemContext. 1265 * 1266 * @example 1267 * import React from "react"; 1268 * import { SystemProvider, useOptions } from "reakit-system"; 1269 * 1270 * const system = { 1271 * useAOptions(options, htmlProps) { 1272 * return { 1273 * ...options, 1274 * url: htmlProps.href, 1275 * }; 1276 * }, 1277 * }; 1278 * 1279 * function A({ url, ...htmlProps }) { 1280 * const options = useOptions("A", { url }, htmlProps); 1281 * return <a href={options.url} {...htmlProps} />; 1282 * } 1283 * 1284 * function App() { 1285 * return ( 1286 * <SystemProvider unstable_system={system}> 1287 * <A href="url"> 1288 * It will convert href into url in useAOptions and then url into href in A 1289 * </A> 1290 * </SystemProvider> 1291 * ); 1292 * } 1293 */ 1294 1295 function useOptions(name, options, htmlProps) { 1296 if (options === void 0) { 1297 options = {}; 1298 } 1299 1300 if (htmlProps === void 0) { 1301 htmlProps = {}; 1302 } 1303 1304 var hookName = "use" + name + "Options"; 1305 Object(external_this_React_["useDebugValue"])(hookName); 1306 var useHook = useToken(hookName); 1307 1308 if (useHook) { 1309 return Object(_rollupPluginBabelHelpers_0c84a174["a" /* _ */])(Object(_rollupPluginBabelHelpers_0c84a174["a" /* _ */])({}, options), useHook(options, htmlProps)); 1310 } 1311 1312 return options; 1313 } 1314 1315 1316 1317 // EXTERNAL MODULE: ./node_modules/reakit-utils/es/shallowEqual.js 1318 var shallowEqual = __webpack_require__(56); 1319 1320 // CONCATENATED MODULE: ./node_modules/reakit-utils/es/toArray.js 1321 /** 1322 * Transforms `arg` into an array if it's not already. 1323 * 1324 * @example 1325 * import { toArray } from "reakit-utils"; 1326 * 1327 * toArray("a"); // ["a"] 1328 * toArray(["a"]); // ["a"] 1329 */ 1330 function toArray(arg) { 1331 if (Array.isArray(arg)) { 1332 return arg; 1333 } 1334 1335 return typeof arg !== "undefined" ? [arg] : []; 1336 } 1337 1338 1339 1340 // CONCATENATED MODULE: ./node_modules/reakit-system/es/createHook.js 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 /** 1351 * Creates a React custom hook that will return component props. 1352 * 1353 * @example 1354 * import { createHook } from "reakit-system"; 1355 * 1356 * const useA = createHook({ 1357 * name: "A", 1358 * keys: ["url"], // custom props/options keys 1359 * useProps(options, htmlProps) { 1360 * return { 1361 * ...htmlProps, 1362 * href: options.url, 1363 * }; 1364 * }, 1365 * }); 1366 * 1367 * function A({ url, ...htmlProps }) { 1368 * const props = useA({ url }, htmlProps); 1369 * return <a {...props} />; 1370 * } 1371 * 1372 * @param options 1373 */ 1374 function createHook(options) { 1375 var _options$useState, _composedHooks$; 1376 1377 var composedHooks = toArray(options.compose); 1378 1379 var __useOptions = function __useOptions(hookOptions, htmlProps) { 1380 // Call the current hook's useOptions first 1381 if (options.useOptions) { 1382 hookOptions = options.useOptions(hookOptions, htmlProps); 1383 } // If there's name, call useOptions from the system context 1384 1385 1386 if (options.name) { 1387 hookOptions = useOptions(options.name, hookOptions, htmlProps); 1388 } // Run composed hooks useOptions 1389 1390 1391 if (options.compose) { 1392 for (var _iterator = Object(_rollupPluginBabelHelpers_0c84a174["c" /* b */])(composedHooks), _step; !(_step = _iterator()).done;) { 1393 var hook = _step.value; 1394 hookOptions = hook.__useOptions(hookOptions, htmlProps); 1395 } 1396 } 1397 1398 return hookOptions; 1399 }; 1400 1401 var useHook = function useHook(hookOptions, htmlProps, unstable_ignoreUseOptions) { 1402 if (hookOptions === void 0) { 1403 hookOptions = {}; 1404 } 1405 1406 if (htmlProps === void 0) { 1407 htmlProps = {}; 1408 } 1409 1410 if (unstable_ignoreUseOptions === void 0) { 1411 unstable_ignoreUseOptions = false; 1412 } 1413 1414 // This won't execute when useHook was called from within another useHook 1415 if (!unstable_ignoreUseOptions) { 1416 hookOptions = __useOptions(hookOptions, htmlProps); 1417 } // Call the current hook's useProps 1418 1419 1420 if (options.useProps) { 1421 htmlProps = options.useProps(hookOptions, htmlProps); 1422 } // If there's name, call useProps from the system context 1423 1424 1425 if (options.name) { 1426 htmlProps = useProps(options.name, hookOptions, htmlProps); 1427 } 1428 1429 if (options.compose) { 1430 if (options.useComposeOptions) { 1431 hookOptions = options.useComposeOptions(hookOptions, htmlProps); 1432 } 1433 1434 if (options.useComposeProps) { 1435 htmlProps = options.useComposeProps(hookOptions, htmlProps); 1436 } else { 1437 for (var _iterator2 = Object(_rollupPluginBabelHelpers_0c84a174["c" /* b */])(composedHooks), _step2; !(_step2 = _iterator2()).done;) { 1438 var hook = _step2.value; 1439 htmlProps = hook(hookOptions, htmlProps, true); 1440 } 1441 } 1442 } // Remove undefined values from htmlProps 1443 1444 1445 var finalHTMLProps = {}; 1446 var definedHTMLProps = htmlProps || {}; 1447 1448 for (var prop in definedHTMLProps) { 1449 if (definedHTMLProps[prop] !== undefined) { 1450 finalHTMLProps[prop] = definedHTMLProps[prop]; 1451 } 1452 } 1453 1454 return finalHTMLProps; 1455 }; 1456 1457 useHook.__useOptions = __useOptions; 1458 var composedKeys = composedHooks.reduce(function (keys, hook) { 1459 keys.push.apply(keys, hook.__keys || []); 1460 return keys; 1461 }, []); // It's used by createComponent to split option props (keys) and html props 1462 1463 useHook.__keys = [].concat(composedKeys, ((_options$useState = options.useState) === null || _options$useState === void 0 ? void 0 : _options$useState.__keys) || [], options.keys || []); 1464 useHook.unstable_propsAreEqual = options.propsAreEqual || ((_composedHooks$ = composedHooks[0]) === null || _composedHooks$ === void 0 ? void 0 : _composedHooks$.unstable_propsAreEqual) || shallowEqual["a" /* shallowEqual */]; 1465 1466 if (false) {} 1467 1468 return useHook; 1469 } 1470 1471 1472 1473 1474 /***/ }), 1475 /* 51 */ 1476 /***/ (function(module, __webpack_exports__, __webpack_require__) { 1477 1478 "use strict"; 1479 1480 // EXPORTS 1481 __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ createComponent; }); 1482 1483 // EXTERNAL MODULE: external {"this":"React"} 1484 var external_this_React_ = __webpack_require__(13); 1485 1486 // EXTERNAL MODULE: ./node_modules/reakit-system/es/_rollupPluginBabelHelpers-0c84a174.js 1487 var _rollupPluginBabelHelpers_0c84a174 = __webpack_require__(55); 1488 1489 // EXTERNAL MODULE: ./node_modules/reakit-system/es/useCreateElement.js 1490 var useCreateElement = __webpack_require__(79); 1491 1492 // CONCATENATED MODULE: ./node_modules/reakit-utils/es/splitProps.js 1493 /** 1494 * Splits an object (`props`) into a tuple where the first item is an object 1495 * with the passed `keys`, and the second item is an object with these keys 1496 * omitted. 1497 * 1498 * @example 1499 * import { splitProps } from "reakit-utils"; 1500 * 1501 * splitProps({ a: "a", b: "b" }, ["a"]); // [{ a: "a" }, { b: "b" }] 1502 */ 1503 function splitProps(props, keys) { 1504 var propsKeys = Object.keys(props); 1505 var picked = {}; 1506 var omitted = {}; 1507 1508 for (var _i = 0, _propsKeys = propsKeys; _i < _propsKeys.length; _i++) { 1509 var key = _propsKeys[_i]; 1510 1511 if (keys.indexOf(key) >= 0) { 1512 picked[key] = props[key]; 1513 } else { 1514 omitted[key] = props[key]; 1515 } 1516 } 1517 1518 return [picked, omitted]; 1519 } 1520 1521 1522 1523 // EXTERNAL MODULE: ./node_modules/reakit-utils/es/shallowEqual.js 1524 var shallowEqual = __webpack_require__(56); 1525 1526 // CONCATENATED MODULE: ./node_modules/reakit-system/es/createComponent.js 1527 1528 1529 1530 1531 1532 1533 1534 function forwardRef(component) { 1535 return /*#__PURE__*/Object(external_this_React_["forwardRef"])(component); 1536 } 1537 1538 function memo(component, propsAreEqual) { 1539 return /*#__PURE__*/Object(external_this_React_["memo"])(component, propsAreEqual); 1540 } 1541 1542 /** 1543 * Creates a React component. 1544 * 1545 * @example 1546 * import { createComponent } from "reakit-system"; 1547 * 1548 * const A = createComponent({ as: "a" }); 1549 * 1550 * @param options 1551 */ 1552 function createComponent(_ref) { 1553 var type = _ref.as, 1554 useHook = _ref.useHook, 1555 shouldMemo = _ref.memo, 1556 _ref$propsAreEqual = _ref.propsAreEqual, 1557 propsAreEqual = _ref$propsAreEqual === void 0 ? useHook === null || useHook === void 0 ? void 0 : useHook.unstable_propsAreEqual : _ref$propsAreEqual, 1558 _ref$keys = _ref.keys, 1559 keys = _ref$keys === void 0 ? (useHook === null || useHook === void 0 ? void 0 : useHook.__keys) || [] : _ref$keys, 1560 _ref$useCreateElement = _ref.useCreateElement, 1561 useCreateElement$1 = _ref$useCreateElement === void 0 ? useCreateElement["a" /* useCreateElement */] : _ref$useCreateElement; 1562 1563 var Comp = function Comp(_ref2, ref) { 1564 var _ref2$as = _ref2.as, 1565 as = _ref2$as === void 0 ? type : _ref2$as, 1566 props = Object(_rollupPluginBabelHelpers_0c84a174["b" /* a */])(_ref2, ["as"]); 1567 1568 if (useHook) { 1569 var _as$render; 1570 1571 var _splitProps = splitProps(props, keys), 1572 _options = _splitProps[0], 1573 htmlProps = _splitProps[1]; 1574 1575 var _useHook = useHook(_options, Object(_rollupPluginBabelHelpers_0c84a174["a" /* _ */])({ 1576 ref: ref 1577 }, htmlProps)), 1578 wrapElement = _useHook.wrapElement, 1579 elementProps = Object(_rollupPluginBabelHelpers_0c84a174["b" /* a */])(_useHook, ["wrapElement"]); // @ts-ignore 1580 1581 1582 var asKeys = ((_as$render = as.render) === null || _as$render === void 0 ? void 0 : _as$render.__keys) || as.__keys; 1583 var asOptions = asKeys && splitProps(props, asKeys)[0]; 1584 var allProps = asOptions ? Object(_rollupPluginBabelHelpers_0c84a174["a" /* _ */])(Object(_rollupPluginBabelHelpers_0c84a174["a" /* _ */])({}, elementProps), asOptions) : elementProps; 1585 1586 var _element = useCreateElement$1(as, allProps); 1587 1588 if (wrapElement) { 1589 return wrapElement(_element); 1590 } 1591 1592 return _element; 1593 } 1594 1595 return useCreateElement$1(as, Object(_rollupPluginBabelHelpers_0c84a174["a" /* _ */])({ 1596 ref: ref 1597 }, props)); 1598 }; 1599 1600 if (false) {} 1601 1602 Comp = forwardRef(Comp); 1603 1604 if (shouldMemo) { 1605 Comp = memo(Comp, propsAreEqual); 1606 } 1607 1608 Comp.__keys = keys; 1609 Comp.unstable_propsAreEqual = propsAreEqual || shallowEqual["a" /* shallowEqual */]; 1610 return Comp; 1611 } 1612 1613 1614 1615 1616 /***/ }), 1617 /* 52 */ 1618 /***/ (function(module, __webpack_exports__, __webpack_require__) { 1619 1620 "use strict"; 1621 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return findFirstEnabledItem; }); 1622 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return flatten; }); 1623 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return groupItems; }); 1624 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return findEnabledItemById; }); 1625 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return getCurrentId; }); 1626 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return reverse; }); 1627 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return useCompositeState; }); 1628 /* harmony import */ var _rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15); 1629 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(13); 1630 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__); 1631 /* harmony import */ var reakit_utils_useIsomorphicEffect__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(59); 1632 /* harmony import */ var reakit_utils_useSealedState__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(62); 1633 /* harmony import */ var reakit_utils_applyState__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(61); 1634 /* harmony import */ var _Id_IdState_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(65); 1635 1636 1637 1638 1639 1640 1641 1642 function reverse(array) { 1643 return array.slice().reverse(); 1644 } 1645 1646 function isElementPreceding(element1, element2) { 1647 return Boolean(element2.compareDocumentPosition(element1) & Node.DOCUMENT_POSITION_PRECEDING); 1648 } 1649 1650 function findDOMIndex(items, item) { 1651 return items.findIndex(function (currentItem) { 1652 if (!currentItem.ref.current || !item.ref.current) { 1653 return false; 1654 } 1655 1656 return isElementPreceding(item.ref.current, currentItem.ref.current); 1657 }); 1658 } 1659 1660 function findFirstEnabledItem(items, excludeId) { 1661 if (excludeId) { 1662 return items.find(function (item) { 1663 return !item.disabled && item.id !== excludeId; 1664 }); 1665 } 1666 1667 return items.find(function (item) { 1668 return !item.disabled; 1669 }); 1670 } 1671 1672 function findEnabledItemById(items, id) { 1673 if (!id) return undefined; 1674 return items === null || items === void 0 ? void 0 : items.find(function (item) { 1675 return item.id === id && !item.disabled; 1676 }); 1677 } 1678 1679 function groupItems(items) { 1680 var groups = [[]]; 1681 1682 var _loop = function _loop() { 1683 var item = _step.value; 1684 var group = groups.find(function (g) { 1685 return !g[0] || g[0].groupId === item.groupId; 1686 }); 1687 1688 if (group) { 1689 group.push(item); 1690 } else { 1691 groups.push([item]); 1692 } 1693 }; 1694 1695 for (var _iterator = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* b */ "c"])(items), _step; !(_step = _iterator()).done;) { 1696 _loop(); 1697 } 1698 1699 return groups; 1700 } 1701 1702 function getMaxLength(rows) { 1703 var maxLength = 0; 1704 1705 for (var _iterator = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* b */ "c"])(rows), _step; !(_step = _iterator()).done;) { 1706 var length = _step.value.length; 1707 1708 if (length > maxLength) { 1709 maxLength = length; 1710 } 1711 } 1712 1713 return maxLength; 1714 } 1715 1716 /** 1717 * Turns [row1, row1, row2, row2] into [row1, row2, row1, row2] 1718 */ 1719 1720 function verticalizeItems(items) { 1721 var groups = groupItems(items); 1722 var maxLength = getMaxLength(groups); 1723 var verticalized = []; 1724 1725 for (var i = 0; i < maxLength; i += 1) { 1726 for (var _iterator = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* b */ "c"])(groups), _step; !(_step = _iterator()).done;) { 1727 var group = _step.value; 1728 1729 if (group[i]) { 1730 verticalized.push(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, group[i]), {}, { 1731 // If there's no groupId, it means that it's not a grid composite, 1732 // but a single row instead. So, instead of verticalizing it, that 1733 // is, assigning a different groupId based on the column index, we 1734 // keep it undefined so they will be part of the same group. 1735 // It's useful when using up/down on one-dimensional composites. 1736 groupId: group[i].groupId ? "" + i : undefined 1737 })); 1738 } 1739 } 1740 } 1741 1742 return verticalized; 1743 } 1744 1745 function flatten(grid) { 1746 var flattened = []; 1747 1748 for (var _iterator = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* b */ "c"])(grid), _step; !(_step = _iterator()).done;) { 1749 var row = _step.value; 1750 flattened.push.apply(flattened, row); 1751 } 1752 1753 return flattened; 1754 } 1755 1756 /** 1757 * Turns [[row1, row1], [row2]] into [[row1, row1], [row2, row2]] 1758 */ 1759 1760 function fillGroups(groups) { 1761 var maxLength = getMaxLength(groups); 1762 1763 for (var _iterator = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* b */ "c"])(groups), _step; !(_step = _iterator()).done;) { 1764 var group = _step.value; 1765 1766 if (group.length < maxLength) { 1767 for (var i = 0; i < maxLength; i += 1) { 1768 if (!group[i]) { 1769 group[i] = { 1770 id: "__EMPTY_ITEM__", 1771 disabled: true, 1772 ref: { 1773 current: null 1774 }, 1775 groupId: group[i - 1].groupId 1776 }; 1777 } 1778 } 1779 } 1780 } 1781 1782 return groups; 1783 } 1784 1785 function getCurrentId(options, passedId) { 1786 var _findFirstEnabledItem; 1787 1788 if (passedId || passedId === null) { 1789 return passedId; 1790 } 1791 1792 if (options.currentId || options.currentId === null) { 1793 return options.currentId; 1794 } 1795 1796 return (_findFirstEnabledItem = findFirstEnabledItem(options.items || [])) === null || _findFirstEnabledItem === void 0 ? void 0 : _findFirstEnabledItem.id; 1797 } 1798 1799 var nullItem = { 1800 id: null, 1801 ref: { 1802 current: null 1803 } 1804 }; 1805 function placeItemsAfter(items, id, shouldInsertNullItem) { 1806 var index = items.findIndex(function (item) { 1807 return item.id === id; 1808 }); 1809 return [].concat(items.slice(index + 1), shouldInsertNullItem ? [nullItem] : [], items.slice(0, index)); 1810 } 1811 1812 function getItemsInGroup(items, groupId) { 1813 return items.filter(function (item) { 1814 return item.groupId === groupId; 1815 }); 1816 } 1817 1818 var map = { 1819 horizontal: "vertical", 1820 vertical: "horizontal" 1821 }; 1822 function getOppositeOrientation(orientation) { 1823 return orientation && map[orientation]; 1824 } 1825 1826 function addItemAtIndex(array, item, index) { 1827 if (!(index in array)) { 1828 return [].concat(array, [item]); 1829 } 1830 1831 return [].concat(array.slice(0, index), [item], array.slice(index)); 1832 } 1833 1834 function sortBasedOnDOMPosition(items) { 1835 var copy = items.slice(); 1836 var isOrderDifferent = false; 1837 copy.sort(function (a, b) { 1838 var elementA = a.ref.current; 1839 var elementB = b.ref.current; 1840 1841 if (elementA && elementB && isElementPreceding(elementA, elementB)) { 1842 isOrderDifferent = true; 1843 return -1; 1844 } 1845 1846 return 0; 1847 }); 1848 1849 if (isOrderDifferent) { 1850 return copy; 1851 } 1852 1853 return items; 1854 } 1855 1856 function reducer(state, action) { 1857 var virtual = state.unstable_virtual, 1858 rtl = state.rtl, 1859 orientation = state.orientation, 1860 items = state.items, 1861 groups = state.groups, 1862 currentId = state.currentId, 1863 loop = state.loop, 1864 wrap = state.wrap, 1865 pastIds = state.pastIds, 1866 moves = state.unstable_moves, 1867 initialVirtual = state.initialVirtual, 1868 initialRTL = state.initialRTL, 1869 initialOrientation = state.initialOrientation, 1870 initialCurrentId = state.initialCurrentId, 1871 initialLoop = state.initialLoop, 1872 initialWrap = state.initialWrap, 1873 hasSetCurrentId = state.hasSetCurrentId; 1874 1875 switch (action.type) { 1876 case "registerGroup": 1877 { 1878 var _group = action.group; // If there are no groups yet, just add it as the first one 1879 1880 if (groups.length === 0) { 1881 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, state), {}, { 1882 groups: [_group] 1883 }); 1884 } // Finds the group index based on DOM position 1885 1886 1887 var index = findDOMIndex(groups, _group); 1888 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, state), {}, { 1889 groups: addItemAtIndex(groups, _group, index) 1890 }); 1891 } 1892 1893 case "unregisterGroup": 1894 { 1895 var _id = action.id; 1896 var nextGroups = groups.filter(function (group) { 1897 return group.id !== _id; 1898 }); // The group isn't registered, so do nothing 1899 1900 if (nextGroups.length === groups.length) { 1901 return state; 1902 } 1903 1904 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, state), {}, { 1905 groups: nextGroups 1906 }); 1907 } 1908 1909 case "registerItem": 1910 { 1911 var _item = action.item; // Finds the item group based on the DOM hierarchy 1912 1913 var _group2 = groups.find(function (r) { 1914 var _r$ref$current; 1915 1916 return (_r$ref$current = r.ref.current) === null || _r$ref$current === void 0 ? void 0 : _r$ref$current.contains(_item.ref.current); 1917 }); // Group will be null if it's a one-dimensional composite 1918 1919 1920 var nextItem = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({ 1921 groupId: _group2 === null || _group2 === void 0 ? void 0 : _group2.id 1922 }, _item); 1923 1924 var _index = findDOMIndex(items, nextItem); 1925 1926 var nextState = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, state), {}, { 1927 items: addItemAtIndex(items, nextItem, _index) 1928 }); 1929 1930 if (!hasSetCurrentId && !moves && initialCurrentId === undefined) { 1931 var _findFirstEnabledItem; 1932 1933 // Sets currentId to the first enabled item. This runs whenever an item 1934 // is registered because the first enabled item may be registered 1935 // asynchronously. 1936 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, nextState), {}, { 1937 currentId: (_findFirstEnabledItem = findFirstEnabledItem(nextState.items)) === null || _findFirstEnabledItem === void 0 ? void 0 : _findFirstEnabledItem.id 1938 }); 1939 } 1940 1941 return nextState; 1942 } 1943 1944 case "unregisterItem": 1945 { 1946 var _id2 = action.id; 1947 var nextItems = items.filter(function (item) { 1948 return item.id !== _id2; 1949 }); // The item isn't registered, so do nothing 1950 1951 if (nextItems.length === items.length) { 1952 return state; 1953 } // Filters out the item that is being removed from the pastIds list 1954 1955 1956 var nextPastIds = pastIds.filter(function (pastId) { 1957 return pastId !== _id2; 1958 }); 1959 1960 var _nextState = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, state), {}, { 1961 pastIds: nextPastIds, 1962 items: nextItems 1963 }); // If the current item is the item that is being removed, focus pastId 1964 1965 1966 if (currentId && currentId === _id2) { 1967 var nextId = getCurrentId(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, _nextState), {}, { 1968 currentId: nextPastIds[0] 1969 })); 1970 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, _nextState), {}, { 1971 currentId: nextId 1972 }); 1973 } 1974 1975 return _nextState; 1976 } 1977 1978 case "move": 1979 { 1980 var _id3 = action.id; // move() does nothing 1981 1982 if (_id3 === undefined) { 1983 return state; 1984 } // Removes the current item and the item that is receiving focus from the 1985 // pastIds list 1986 1987 1988 var filteredPastIds = pastIds.filter(function (pastId) { 1989 return pastId !== currentId && pastId !== _id3; 1990 }); // If there's a currentId, add it to the pastIds list so it can be focused 1991 // if the new item gets removed or disabled 1992 1993 var _nextPastIds = currentId ? [currentId].concat(filteredPastIds) : filteredPastIds; 1994 1995 var _nextState2 = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, state), {}, { 1996 pastIds: _nextPastIds 1997 }); // move(null) will focus the composite element itself, not an item 1998 1999 2000 if (_id3 === null) { 2001 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, _nextState2), {}, { 2002 unstable_moves: moves + 1, 2003 currentId: getCurrentId(_nextState2, _id3) 2004 }); 2005 } 2006 2007 var _item2 = findEnabledItemById(items, _id3); 2008 2009 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, _nextState2), {}, { 2010 unstable_moves: _item2 ? moves + 1 : moves, 2011 currentId: getCurrentId(_nextState2, _item2 === null || _item2 === void 0 ? void 0 : _item2.id) 2012 }); 2013 } 2014 2015 case "next": 2016 { 2017 // If there's no item focused, we just move the first one 2018 if (currentId == null) { 2019 return reducer(state, Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, action), {}, { 2020 type: "first" 2021 })); 2022 } // RTL doesn't make sense on vertical navigation 2023 2024 2025 var isHorizontal = orientation !== "vertical"; 2026 var isRTL = rtl && isHorizontal; 2027 var allItems = isRTL ? reverse(items) : items; 2028 var currentItem = allItems.find(function (item) { 2029 return item.id === currentId; 2030 }); // If there's no item focused, we just move the first one 2031 2032 if (!currentItem) { 2033 return reducer(state, Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, action), {}, { 2034 type: "first" 2035 })); 2036 } 2037 2038 var isGrid = !!currentItem.groupId; 2039 var currentIndex = allItems.indexOf(currentItem); 2040 2041 var _nextItems = allItems.slice(currentIndex + 1); 2042 2043 var nextItemsInGroup = getItemsInGroup(_nextItems, currentItem.groupId); // Home, End 2044 2045 if (action.allTheWay) { 2046 // We reverse so we can get the last enabled item in the group. If it's 2047 // RTL, nextItems and nextItemsInGroup are already reversed and don't 2048 // have the items before the current one anymore. So we have to get 2049 // items in group again with allItems. 2050 var _nextItem2 = findFirstEnabledItem(isRTL ? getItemsInGroup(allItems, currentItem.groupId) : reverse(nextItemsInGroup)); 2051 2052 return reducer(state, Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, action), {}, { 2053 type: "move", 2054 id: _nextItem2 === null || _nextItem2 === void 0 ? void 0 : _nextItem2.id 2055 })); 2056 } 2057 2058 var oppositeOrientation = getOppositeOrientation( // If it's a grid and orientation is not set, it's a next/previous 2059 // call, which is inherently horizontal. up/down will call next with 2060 // orientation set to vertical by default (see below on up/down cases). 2061 isGrid ? orientation || "horizontal" : orientation); 2062 var canLoop = loop && loop !== oppositeOrientation; 2063 var canWrap = isGrid && wrap && wrap !== oppositeOrientation; 2064 var hasNullItem = // `previous` and `up` will set action.hasNullItem, but when calling 2065 // next directly, hasNullItem will only be true if it's not a grid and 2066 // loop is set to true, which means that pressing right or down keys on 2067 // grids will never focus the composite element. On one-dimensional 2068 // composites that don't loop, pressing right or down keys also doesn't 2069 // focus the composite element. 2070 action.hasNullItem || !isGrid && canLoop && initialCurrentId === null; 2071 2072 if (canLoop) { 2073 var loopItems = canWrap && !hasNullItem ? allItems : getItemsInGroup(allItems, currentItem.groupId); // Turns [0, 1, current, 3, 4] into [3, 4, 0, 1] 2074 2075 var sortedItems = placeItemsAfter(loopItems, currentId, hasNullItem); 2076 2077 var _nextItem3 = findFirstEnabledItem(sortedItems, currentId); 2078 2079 return reducer(state, Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, action), {}, { 2080 type: "move", 2081 id: _nextItem3 === null || _nextItem3 === void 0 ? void 0 : _nextItem3.id 2082 })); 2083 } 2084 2085 if (canWrap) { 2086 var _nextItem4 = findFirstEnabledItem( // We can use nextItems, which contains all the next items, including 2087 // items from other groups, to wrap between groups. However, if there 2088 // is a null item (the composite element), we'll only use the next 2089 // items in the group. So moving next from the last item will focus 2090 // the composite element (null). On grid composites, horizontal 2091 // navigation never focuses the composite element, only vertical. 2092 hasNullItem ? nextItemsInGroup : _nextItems, currentId); 2093 2094 var _nextId = hasNullItem ? (_nextItem4 === null || _nextItem4 === void 0 ? void 0 : _nextItem4.id) || null : _nextItem4 === null || _nextItem4 === void 0 ? void 0 : _nextItem4.id; 2095 2096 return reducer(state, Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, action), {}, { 2097 type: "move", 2098 id: _nextId 2099 })); 2100 } 2101 2102 var _nextItem = findFirstEnabledItem(nextItemsInGroup, currentId); 2103 2104 if (!_nextItem && hasNullItem) { 2105 return reducer(state, Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, action), {}, { 2106 type: "move", 2107 id: null 2108 })); 2109 } 2110 2111 return reducer(state, Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, action), {}, { 2112 type: "move", 2113 id: _nextItem === null || _nextItem === void 0 ? void 0 : _nextItem.id 2114 })); 2115 } 2116 2117 case "previous": 2118 { 2119 // If currentId is initially set to null, the composite element will be 2120 // focusable while navigating with arrow keys. But, if it's a grid, we 2121 // don't want to focus the composite element with horizontal navigation. 2122 var _isGrid = !!groups.length; 2123 2124 var _hasNullItem = !_isGrid && initialCurrentId === null; 2125 2126 var _nextState3 = reducer(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, state), {}, { 2127 items: reverse(items) 2128 }), Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, action), {}, { 2129 type: "next", 2130 hasNullItem: _hasNullItem 2131 })); 2132 2133 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, _nextState3), {}, { 2134 items: items 2135 }); 2136 } 2137 2138 case "down": 2139 { 2140 // First, we make sure groups have the same number of items by filling it 2141 // with disabled fake items. Then, we reorganize the items list so 2142 // [1-1, 1-2, 2-1, 2-2] becomes [1-1, 2-1, 1-2, 2-2]. 2143 var verticalItems = verticalizeItems(flatten(fillGroups(groupItems(items)))); 2144 2145 var _canLoop = loop && loop !== "horizontal"; // Pressing down arrow key will only focus the composite element if loop 2146 // is true or vertical. 2147 2148 2149 var _hasNullItem2 = _canLoop && initialCurrentId === null; 2150 2151 var _nextState4 = reducer(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, state), {}, { 2152 orientation: "vertical", 2153 items: verticalItems 2154 }), Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, action), {}, { 2155 type: "next", 2156 hasNullItem: _hasNullItem2 2157 })); 2158 2159 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, _nextState4), {}, { 2160 orientation: orientation, 2161 items: items 2162 }); 2163 } 2164 2165 case "up": 2166 { 2167 var _verticalItems = verticalizeItems(reverse(flatten(fillGroups(groupItems(items))))); // If currentId is initially set to null, we'll always focus the 2168 // composite element when the up arrow key is pressed in the first row. 2169 2170 2171 var _hasNullItem3 = initialCurrentId === null; 2172 2173 var _nextState5 = reducer(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, state), {}, { 2174 orientation: "vertical", 2175 items: _verticalItems 2176 }), Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, action), {}, { 2177 type: "next", 2178 hasNullItem: _hasNullItem3 2179 })); 2180 2181 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, _nextState5), {}, { 2182 orientation: orientation, 2183 items: items 2184 }); 2185 } 2186 2187 case "first": 2188 { 2189 var firstItem = findFirstEnabledItem(items); 2190 return reducer(state, Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, action), {}, { 2191 type: "move", 2192 id: firstItem === null || firstItem === void 0 ? void 0 : firstItem.id 2193 })); 2194 } 2195 2196 case "last": 2197 { 2198 var _nextState6 = reducer(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, state), {}, { 2199 items: reverse(items) 2200 }), Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, action), {}, { 2201 type: "first" 2202 })); 2203 2204 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, _nextState6), {}, { 2205 items: items 2206 }); 2207 } 2208 2209 case "sort": 2210 { 2211 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, state), {}, { 2212 items: sortBasedOnDOMPosition(items), 2213 groups: sortBasedOnDOMPosition(groups) 2214 }); 2215 } 2216 2217 case "setVirtual": 2218 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, state), {}, { 2219 unstable_virtual: Object(reakit_utils_applyState__WEBPACK_IMPORTED_MODULE_4__[/* applyState */ "a"])(action.virtual, virtual) 2220 }); 2221 2222 case "setRTL": 2223 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, state), {}, { 2224 rtl: Object(reakit_utils_applyState__WEBPACK_IMPORTED_MODULE_4__[/* applyState */ "a"])(action.rtl, rtl) 2225 }); 2226 2227 case "setOrientation": 2228 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, state), {}, { 2229 orientation: Object(reakit_utils_applyState__WEBPACK_IMPORTED_MODULE_4__[/* applyState */ "a"])(action.orientation, orientation) 2230 }); 2231 2232 case "setCurrentId": 2233 { 2234 var nextCurrentId = getCurrentId(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, state), {}, { 2235 currentId: Object(reakit_utils_applyState__WEBPACK_IMPORTED_MODULE_4__[/* applyState */ "a"])(action.currentId, currentId) 2236 })); 2237 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, state), {}, { 2238 currentId: nextCurrentId, 2239 hasSetCurrentId: true 2240 }); 2241 } 2242 2243 case "setLoop": 2244 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, state), {}, { 2245 loop: Object(reakit_utils_applyState__WEBPACK_IMPORTED_MODULE_4__[/* applyState */ "a"])(action.loop, loop) 2246 }); 2247 2248 case "setWrap": 2249 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, state), {}, { 2250 wrap: Object(reakit_utils_applyState__WEBPACK_IMPORTED_MODULE_4__[/* applyState */ "a"])(action.wrap, wrap) 2251 }); 2252 2253 case "reset": 2254 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, state), {}, { 2255 unstable_virtual: initialVirtual, 2256 rtl: initialRTL, 2257 orientation: initialOrientation, 2258 currentId: getCurrentId(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, state), {}, { 2259 currentId: initialCurrentId 2260 })), 2261 loop: initialLoop, 2262 wrap: initialWrap, 2263 unstable_moves: 0, 2264 pastIds: [] 2265 }); 2266 2267 default: 2268 throw new Error(); 2269 } 2270 } 2271 2272 function useAction(fn) { 2273 return Object(react__WEBPACK_IMPORTED_MODULE_1__["useCallback"])(fn, []); 2274 } 2275 2276 function useIsUnmountedRef() { 2277 var isUnmountedRef = Object(react__WEBPACK_IMPORTED_MODULE_1__["useRef"])(false); 2278 Object(reakit_utils_useIsomorphicEffect__WEBPACK_IMPORTED_MODULE_2__[/* useIsomorphicEffect */ "a"])(function () { 2279 return function () { 2280 isUnmountedRef.current = true; 2281 }; 2282 }, []); 2283 return isUnmountedRef; 2284 } 2285 2286 function useCompositeState(initialState) { 2287 if (initialState === void 0) { 2288 initialState = {}; 2289 } 2290 2291 var _useSealedState = Object(reakit_utils_useSealedState__WEBPACK_IMPORTED_MODULE_3__[/* useSealedState */ "a"])(initialState), 2292 _useSealedState$unsta = _useSealedState.unstable_virtual, 2293 virtual = _useSealedState$unsta === void 0 ? false : _useSealedState$unsta, 2294 _useSealedState$rtl = _useSealedState.rtl, 2295 rtl = _useSealedState$rtl === void 0 ? false : _useSealedState$rtl, 2296 orientation = _useSealedState.orientation, 2297 currentId = _useSealedState.currentId, 2298 _useSealedState$loop = _useSealedState.loop, 2299 loop = _useSealedState$loop === void 0 ? false : _useSealedState$loop, 2300 _useSealedState$wrap = _useSealedState.wrap, 2301 wrap = _useSealedState$wrap === void 0 ? false : _useSealedState$wrap, 2302 sealed = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* _ */ "a"])(_useSealedState, ["unstable_virtual", "rtl", "orientation", "currentId", "loop", "wrap"]); 2303 2304 var _React$useReducer = Object(react__WEBPACK_IMPORTED_MODULE_1__["useReducer"])(reducer, { 2305 unstable_virtual: virtual, 2306 rtl: rtl, 2307 orientation: orientation, 2308 items: [], 2309 groups: [], 2310 currentId: currentId, 2311 loop: loop, 2312 wrap: wrap, 2313 unstable_moves: 0, 2314 pastIds: [], 2315 initialVirtual: virtual, 2316 initialRTL: rtl, 2317 initialOrientation: orientation, 2318 initialCurrentId: currentId, 2319 initialLoop: loop, 2320 initialWrap: wrap 2321 }), 2322 _React$useReducer$ = _React$useReducer[0], 2323 pastIds = _React$useReducer$.pastIds, 2324 initialVirtual = _React$useReducer$.initialVirtual, 2325 initialRTL = _React$useReducer$.initialRTL, 2326 initialOrientation = _React$useReducer$.initialOrientation, 2327 initialCurrentId = _React$useReducer$.initialCurrentId, 2328 initialLoop = _React$useReducer$.initialLoop, 2329 initialWrap = _React$useReducer$.initialWrap, 2330 hasSetCurrentId = _React$useReducer$.hasSetCurrentId, 2331 state = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* _ */ "a"])(_React$useReducer$, ["pastIds", "initialVirtual", "initialRTL", "initialOrientation", "initialCurrentId", "initialLoop", "initialWrap", "hasSetCurrentId"]), 2332 dispatch = _React$useReducer[1]; 2333 2334 var _React$useState = Object(react__WEBPACK_IMPORTED_MODULE_1__["useState"])(false), 2335 hasActiveWidget = _React$useState[0], 2336 setHasActiveWidget = _React$useState[1]; 2337 2338 var idState = Object(_Id_IdState_js__WEBPACK_IMPORTED_MODULE_5__[/* unstable_useIdState */ "a"])(sealed); // register/unregister may be called when this component is unmounted. We 2339 // store the unmounted state here so we don't update the state if it's true. 2340 // This only happens in a very specific situation. 2341 // See https://github.com/reakit/reakit/issues/650 2342 2343 var isUnmountedRef = useIsUnmountedRef(); 2344 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, idState), state), {}, { 2345 unstable_hasActiveWidget: hasActiveWidget, 2346 unstable_setHasActiveWidget: setHasActiveWidget, 2347 registerItem: useAction(function (item) { 2348 if (isUnmountedRef.current) return; 2349 dispatch({ 2350 type: "registerItem", 2351 item: item 2352 }); 2353 }), 2354 unregisterItem: useAction(function (id) { 2355 if (isUnmountedRef.current) return; 2356 dispatch({ 2357 type: "unregisterItem", 2358 id: id 2359 }); 2360 }), 2361 registerGroup: useAction(function (group) { 2362 if (isUnmountedRef.current) return; 2363 dispatch({ 2364 type: "registerGroup", 2365 group: group 2366 }); 2367 }), 2368 unregisterGroup: useAction(function (id) { 2369 if (isUnmountedRef.current) return; 2370 dispatch({ 2371 type: "unregisterGroup", 2372 id: id 2373 }); 2374 }), 2375 move: useAction(function (id) { 2376 return dispatch({ 2377 type: "move", 2378 id: id 2379 }); 2380 }), 2381 next: useAction(function (allTheWay) { 2382 return dispatch({ 2383 type: "next", 2384 allTheWay: allTheWay 2385 }); 2386 }), 2387 previous: useAction(function (allTheWay) { 2388 return dispatch({ 2389 type: "previous", 2390 allTheWay: allTheWay 2391 }); 2392 }), 2393 up: useAction(function (allTheWay) { 2394 return dispatch({ 2395 type: "up", 2396 allTheWay: allTheWay 2397 }); 2398 }), 2399 down: useAction(function (allTheWay) { 2400 return dispatch({ 2401 type: "down", 2402 allTheWay: allTheWay 2403 }); 2404 }), 2405 first: useAction(function () { 2406 return dispatch({ 2407 type: "first" 2408 }); 2409 }), 2410 last: useAction(function () { 2411 return dispatch({ 2412 type: "last" 2413 }); 2414 }), 2415 unstable_sort: useAction(function () { 2416 return dispatch({ 2417 type: "sort" 2418 }); 2419 }), 2420 unstable_setVirtual: useAction(function (value) { 2421 return dispatch({ 2422 type: "setVirtual", 2423 virtual: value 2424 }); 2425 }), 2426 setRTL: useAction(function (value) { 2427 return dispatch({ 2428 type: "setRTL", 2429 rtl: value 2430 }); 2431 }), 2432 setOrientation: useAction(function (value) { 2433 return dispatch({ 2434 type: "setOrientation", 2435 orientation: value 2436 }); 2437 }), 2438 setCurrentId: useAction(function (value) { 2439 return dispatch({ 2440 type: "setCurrentId", 2441 currentId: value 2442 }); 2443 }), 2444 setLoop: useAction(function (value) { 2445 return dispatch({ 2446 type: "setLoop", 2447 loop: value 2448 }); 2449 }), 2450 setWrap: useAction(function (value) { 2451 return dispatch({ 2452 type: "setWrap", 2453 wrap: value 2454 }); 2455 }), 2456 reset: useAction(function () { 2457 return dispatch({ 2458 type: "reset" 2459 }); 2460 }) 2461 }); 2462 } 2463 var keys = [].concat(_Id_IdState_js__WEBPACK_IMPORTED_MODULE_5__[/* unstable_useIdState */ "a"].__keys, ["unstable_virtual", "rtl", "orientation", "items", "groups", "currentId", "loop", "wrap", "unstable_moves", "unstable_hasActiveWidget", "registerItem", "unregisterItem", "registerGroup", "unregisterGroup", "move", "next", "previous", "up", "down", "first", "last", "unstable_sort", "unstable_setVirtual", "setRTL", "setOrientation", "setCurrentId", "setLoop", "setWrap", "reset", "unstable_setHasActiveWidget"]); 2464 useCompositeState.__keys = keys; 2465 2466 2467 2468 2469 /***/ }), 2470 /* 53 */ 2471 /***/ (function(module, exports) { 2472 2473 (function() { module.exports = this["wp"]["keyboardShortcuts"]; }()); 2474 2475 /***/ }), 2476 /* 54 */ 2477 /***/ (function(module, __webpack_exports__, __webpack_require__) { 2478 2479 "use strict"; 2480 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return isSelfTarget; }); 2481 /** 2482 * Returns `true` if `event.target` and `event.currentTarget` are the same. 2483 */ 2484 function isSelfTarget(event) { 2485 return event.target === event.currentTarget; 2486 } 2487 2488 2489 2490 2491 /***/ }), 2492 /* 55 */ 2493 /***/ (function(module, __webpack_exports__, __webpack_require__) { 2494 2495 "use strict"; 2496 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectSpread2; }); 2497 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return _objectWithoutPropertiesLoose; }); 2498 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return _createForOfIteratorHelperLoose; }); 2499 function _defineProperty(obj, key, value) { 2500 if (key in obj) { 2501 Object.defineProperty(obj, key, { 2502 value: value, 2503 enumerable: true, 2504 configurable: true, 2505 writable: true 2506 }); 2507 } else { 2508 obj[key] = value; 2509 } 2510 2511 return obj; 2512 } 2513 2514 function ownKeys(object, enumerableOnly) { 2515 var keys = Object.keys(object); 2516 2517 if (Object.getOwnPropertySymbols) { 2518 var symbols = Object.getOwnPropertySymbols(object); 2519 if (enumerableOnly) symbols = symbols.filter(function (sym) { 2520 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 2521 }); 2522 keys.push.apply(keys, symbols); 2523 } 2524 2525 return keys; 2526 } 2527 2528 function _objectSpread2(target) { 2529 for (var i = 1; i < arguments.length; i++) { 2530 var source = arguments[i] != null ? arguments[i] : {}; 2531 2532 if (i % 2) { 2533 ownKeys(Object(source), true).forEach(function (key) { 2534 _defineProperty(target, key, source[key]); 2535 }); 2536 } else if (Object.getOwnPropertyDescriptors) { 2537 Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); 2538 } else { 2539 ownKeys(Object(source)).forEach(function (key) { 2540 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); 2541 }); 2542 } 2543 } 2544 2545 return target; 2546 } 2547 2548 function _objectWithoutPropertiesLoose(source, excluded) { 2549 if (source == null) return {}; 2550 var target = {}; 2551 var sourceKeys = Object.keys(source); 2552 var key, i; 2553 2554 for (i = 0; i < sourceKeys.length; i++) { 2555 key = sourceKeys[i]; 2556 if (excluded.indexOf(key) >= 0) continue; 2557 target[key] = source[key]; 2558 } 2559 2560 return target; 2561 } 2562 2563 function _unsupportedIterableToArray(o, minLen) { 2564 if (!o) return; 2565 if (typeof o === "string") return _arrayLikeToArray(o, minLen); 2566 var n = Object.prototype.toString.call(o).slice(8, -1); 2567 if (n === "Object" && o.constructor) n = o.constructor.name; 2568 if (n === "Map" || n === "Set") return Array.from(o); 2569 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); 2570 } 2571 2572 function _arrayLikeToArray(arr, len) { 2573 if (len == null || len > arr.length) len = arr.length; 2574 2575 for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; 2576 2577 return arr2; 2578 } 2579 2580 function _createForOfIteratorHelperLoose(o, allowArrayLike) { 2581 var it; 2582 2583 if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { 2584 if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { 2585 if (it) o = it; 2586 var i = 0; 2587 return function () { 2588 if (i >= o.length) return { 2589 done: true 2590 }; 2591 return { 2592 done: false, 2593 value: o[i++] 2594 }; 2595 }; 2596 } 2597 2598 throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 2599 } 2600 2601 it = o[Symbol.iterator](); 2602 return it.next.bind(it); 2603 } 2604 2605 2606 2607 2608 /***/ }), 2609 /* 56 */ 2610 /***/ (function(module, __webpack_exports__, __webpack_require__) { 2611 2612 "use strict"; 2613 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return shallowEqual; }); 2614 /** 2615 * Compares two objects. 2616 * 2617 * @example 2618 * import { shallowEqual } from "reakit-utils"; 2619 * 2620 * shallowEqual({ a: "a" }, {}); // false 2621 * shallowEqual({ a: "a" }, { b: "b" }); // false 2622 * shallowEqual({ a: "a" }, { a: "a" }); // true 2623 * shallowEqual({ a: "a" }, { a: "a", b: "b" }); // false 2624 */ 2625 function shallowEqual(objA, objB) { 2626 if (objA === objB) return true; 2627 if (!objA) return false; 2628 if (!objB) return false; 2629 if (typeof objA !== "object") return false; 2630 if (typeof objB !== "object") return false; 2631 var aKeys = Object.keys(objA); 2632 var bKeys = Object.keys(objB); 2633 var length = aKeys.length; 2634 if (bKeys.length !== length) return false; 2635 2636 for (var _i = 0, _aKeys = aKeys; _i < _aKeys.length; _i++) { 2637 var key = _aKeys[_i]; 2638 2639 if (objA[key] !== objB[key]) { 2640 return false; 2641 } 2642 } 2643 2644 return true; 2645 } 2646 2647 2648 2649 2650 /***/ }), 2651 /* 57 */ 2652 /***/ (function(module, __webpack_exports__, __webpack_require__) { 2653 2654 "use strict"; 2655 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getActiveElement; }); 2656 /* harmony import */ var _getDocument_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(49); 2657 2658 2659 /** 2660 * Returns `element.ownerDocument.activeElement`. 2661 */ 2662 2663 function getActiveElement(element) { 2664 return Object(_getDocument_js__WEBPACK_IMPORTED_MODULE_0__[/* getDocument */ "a"])(element).activeElement; 2665 } 2666 2667 2668 2669 2670 /***/ }), 2671 /* 58 */, 2672 /* 59 */ 2673 /***/ (function(module, __webpack_exports__, __webpack_require__) { 2674 2675 "use strict"; 2676 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useIsomorphicEffect; }); 2677 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(13); 2678 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 2679 2680 2681 /** 2682 * `React.useLayoutEffect` that fallbacks to `React.useEffect` on server side 2683 * rendering. 2684 */ 2685 2686 var useIsomorphicEffect = typeof window === "undefined" ? react__WEBPACK_IMPORTED_MODULE_0__["useEffect"] : react__WEBPACK_IMPORTED_MODULE_0__["useLayoutEffect"]; 2687 2688 2689 2690 2691 /***/ }), 2692 /* 60 */ 2693 /***/ (function(module, exports, __webpack_require__) { 2694 2695 /** 2696 * Memize options object. 2697 * 2698 * @typedef MemizeOptions 2699 * 2700 * @property {number} [maxSize] Maximum size of the cache. 2701 */ 2702 2703 /** 2704 * Internal cache entry. 2705 * 2706 * @typedef MemizeCacheNode 2707 * 2708 * @property {?MemizeCacheNode|undefined} [prev] Previous node. 2709 * @property {?MemizeCacheNode|undefined} [next] Next node. 2710 * @property {Array<*>} args Function arguments for cache 2711 * entry. 2712 * @property {*} val Function result. 2713 */ 2714 2715 /** 2716 * Properties of the enhanced function for controlling cache. 2717 * 2718 * @typedef MemizeMemoizedFunction 2719 * 2720 * @property {()=>void} clear Clear the cache. 2721 */ 2722 2723 /** 2724 * Accepts a function to be memoized, and returns a new memoized function, with 2725 * optional options. 2726 * 2727 * @template {Function} F 2728 * 2729 * @param {F} fn Function to memoize. 2730 * @param {MemizeOptions} [options] Options object. 2731 * 2732 * @return {F & MemizeMemoizedFunction} Memoized function. 2733 */ 2734 function memize( fn, options ) { 2735 var size = 0; 2736 2737 /** @type {?MemizeCacheNode|undefined} */ 2738 var head; 2739 2740 /** @type {?MemizeCacheNode|undefined} */ 2741 var tail; 2742 2743 options = options || {}; 2744 2745 function memoized( /* ...args */ ) { 2746 var node = head, 2747 len = arguments.length, 2748 args, i; 2749 2750 searchCache: while ( node ) { 2751 // Perform a shallow equality test to confirm that whether the node 2752 // under test is a candidate for the arguments passed. Two arrays 2753 // are shallowly equal if their length matches and each entry is 2754 // strictly equal between the two sets. Avoid abstracting to a 2755 // function which could incur an arguments leaking deoptimization. 2756 2757 // Check whether node arguments match arguments length 2758 if ( node.args.length !== arguments.length ) { 2759 node = node.next; 2760 continue; 2761 } 2762 2763 // Check whether node arguments match arguments values 2764 for ( i = 0; i < len; i++ ) { 2765 if ( node.args[ i ] !== arguments[ i ] ) { 2766 node = node.next; 2767 continue searchCache; 2768 } 2769 } 2770 2771 // At this point we can assume we've found a match 2772 2773 // Surface matched node to head if not already 2774 if ( node !== head ) { 2775 // As tail, shift to previous. Must only shift if not also 2776 // head, since if both head and tail, there is no previous. 2777 if ( node === tail ) { 2778 tail = node.prev; 2779 } 2780 2781 // Adjust siblings to point to each other. If node was tail, 2782 // this also handles new tail's empty `next` assignment. 2783 /** @type {MemizeCacheNode} */ ( node.prev ).next = node.next; 2784 if ( node.next ) { 2785 node.next.prev = node.prev; 2786 } 2787 2788 node.next = head; 2789 node.prev = null; 2790 /** @type {MemizeCacheNode} */ ( head ).prev = node; 2791 head = node; 2792 } 2793 2794 // Return immediately 2795 return node.val; 2796 } 2797 2798 // No cached value found. Continue to insertion phase: 2799 2800 // Create a copy of arguments (avoid leaking deoptimization) 2801 args = new Array( len ); 2802 for ( i = 0; i < len; i++ ) { 2803 args[ i ] = arguments[ i ]; 2804 } 2805 2806 node = { 2807 args: args, 2808 2809 // Generate the result from original function 2810 val: fn.apply( null, args ), 2811 }; 2812 2813 // Don't need to check whether node is already head, since it would 2814 // have been returned above already if it was 2815 2816 // Shift existing head down list 2817 if ( head ) { 2818 head.prev = node; 2819 node.next = head; 2820 } else { 2821 // If no head, follows that there's no tail (at initial or reset) 2822 tail = node; 2823 } 2824 2825 // Trim tail if we're reached max size and are pending cache insertion 2826 if ( size === /** @type {MemizeOptions} */ ( options ).maxSize ) { 2827 tail = /** @type {MemizeCacheNode} */ ( tail ).prev; 2828 /** @type {MemizeCacheNode} */ ( tail ).next = null; 2829 } else { 2830 size++; 2831 } 2832 2833 head = node; 2834 2835 return node.val; 2836 } 2837 2838 memoized.clear = function() { 2839 head = null; 2840 tail = null; 2841 size = 0; 2842 }; 2843 2844 if ( false ) {} 2845 2846 // Ignore reason: There's not a clear solution to create an intersection of 2847 // the function with additional properties, where the goal is to retain the 2848 // function signature of the incoming argument and add control properties 2849 // on the return value. 2850 2851 // @ts-ignore 2852 return memoized; 2853 } 2854 2855 module.exports = memize; 2856 2857 2858 /***/ }), 2859 /* 61 */ 2860 /***/ (function(module, __webpack_exports__, __webpack_require__) { 2861 2862 "use strict"; 2863 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return applyState; }); 2864 function isUpdater(argument) { 2865 return typeof argument === "function"; 2866 } 2867 /** 2868 * Receives a `setState` argument and calls it with `currentValue` if it's a 2869 * function. Otherwise return the argument as the new value. 2870 * 2871 * @example 2872 * import { applyState } from "reakit-utils"; 2873 * 2874 * applyState((value) => value + 1, 1); // 2 2875 * applyState(2, 1); // 2 2876 */ 2877 2878 2879 function applyState(argument, currentValue) { 2880 if (isUpdater(argument)) { 2881 return argument(currentValue); 2882 } 2883 2884 return argument; 2885 } 2886 2887 2888 2889 2890 /***/ }), 2891 /* 62 */ 2892 /***/ (function(module, __webpack_exports__, __webpack_require__) { 2893 2894 "use strict"; 2895 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useSealedState; }); 2896 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(13); 2897 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 2898 2899 2900 /** 2901 * React custom hook that returns the very first value passed to `initialState`, 2902 * even if it changes between re-renders. 2903 */ 2904 function useSealedState(initialState) { 2905 var _React$useState = Object(react__WEBPACK_IMPORTED_MODULE_0__["useState"])(initialState), 2906 sealed = _React$useState[0]; 2907 2908 return sealed; 2909 } 2910 2911 2912 2913 2914 /***/ }), 2915 /* 63 */ 2916 /***/ (function(module, __webpack_exports__, __webpack_require__) { 2917 2918 "use strict"; 2919 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useForkRef; }); 2920 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(13); 2921 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 2922 2923 2924 // https://github.com/mui-org/material-ui/blob/2bcc874cf07b81202968f769cb9c2398c7c11311/packages/material-ui/src/utils/useForkRef.js 2925 2926 function setRef(ref, value) { 2927 if (value === void 0) { 2928 value = null; 2929 } 2930 2931 if (!ref) return; 2932 2933 if (typeof ref === "function") { 2934 ref(value); 2935 } else { 2936 ref.current = value; 2937 } 2938 } 2939 /** 2940 * Merges up to two React Refs into a single memoized function React Ref so you 2941 * can pass it to an element. 2942 * 2943 * @example 2944 * import React from "react"; 2945 * import { useForkRef } from "reakit-utils"; 2946 * 2947 * const Component = React.forwardRef((props, ref) => { 2948 * const internalRef = React.useRef(); 2949 * return <div {...props} ref={useForkRef(internalRef, ref)} />; 2950 * }); 2951 */ 2952 2953 2954 function useForkRef(refA, refB) { 2955 return Object(react__WEBPACK_IMPORTED_MODULE_0__["useMemo"])(function () { 2956 if (refA == null && refB == null) { 2957 return null; 2958 } 2959 2960 return function (value) { 2961 setRef(refA, value); 2962 setRef(refB, value); 2963 }; 2964 }, [refA, refB]); 2965 } 2966 2967 2968 2969 2970 /***/ }), 2971 /* 64 */ 2972 /***/ (function(module, exports) { 2973 2974 (function() { module.exports = this["wp"]["isShallowEqual"]; }()); 2975 2976 /***/ }), 2977 /* 65 */ 2978 /***/ (function(module, __webpack_exports__, __webpack_require__) { 2979 2980 "use strict"; 2981 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return unstable_useIdState; }); 2982 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(13); 2983 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 2984 /* harmony import */ var reakit_utils_useSealedState__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(62); 2985 /* harmony import */ var _IdProvider_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(68); 2986 2987 2988 2989 2990 function unstable_useIdState(initialState) { 2991 if (initialState === void 0) { 2992 initialState = {}; 2993 } 2994 2995 var _useSealedState = Object(reakit_utils_useSealedState__WEBPACK_IMPORTED_MODULE_1__[/* useSealedState */ "a"])(initialState), 2996 initialBaseId = _useSealedState.baseId; 2997 2998 var generateId = Object(react__WEBPACK_IMPORTED_MODULE_0__["useContext"])(_IdProvider_js__WEBPACK_IMPORTED_MODULE_2__[/* unstable_IdContext */ "a"]); 2999 var idCountRef = Object(react__WEBPACK_IMPORTED_MODULE_0__["useRef"])(0); 3000 3001 var _React$useState = Object(react__WEBPACK_IMPORTED_MODULE_0__["useState"])(function () { 3002 return initialBaseId || generateId(); 3003 }), 3004 baseId = _React$useState[0], 3005 setBaseId = _React$useState[1]; 3006 3007 return { 3008 baseId: baseId, 3009 unstable_setBaseId: setBaseId, 3010 unstable_idCountRef: idCountRef 3011 }; 3012 } 3013 var keys = ["baseId", "unstable_setBaseId", "unstable_idCountRef"]; 3014 unstable_useIdState.__keys = keys; 3015 3016 3017 3018 3019 /***/ }), 3020 /* 66 */ 3021 /***/ (function(module, exports, __webpack_require__) { 3022 3023 var __WEBPACK_AMD_DEFINE_RESULT__;// TinyColor v1.4.2 3024 // https://github.com/bgrins/TinyColor 3025 // Brian Grinstead, MIT License 3026 3027 (function(Math) { 3028 3029 var trimLeft = /^\s+/, 3030 trimRight = /\s+$/, 3031 tinyCounter = 0, 3032 mathRound = Math.round, 3033 mathMin = Math.min, 3034 mathMax = Math.max, 3035 mathRandom = Math.random; 3036 3037 function tinycolor (color, opts) { 3038 3039 color = (color) ? color : ''; 3040 opts = opts || { }; 3041 3042 // If input is already a tinycolor, return itself 3043 if (color instanceof tinycolor) { 3044 return color; 3045 } 3046 // If we are called as a function, call using new instead 3047 if (!(this instanceof tinycolor)) { 3048 return new tinycolor(color, opts); 3049 } 3050 3051 var rgb = inputToRGB(color); 3052 this._originalInput = color, 3053 this._r = rgb.r, 3054 this._g = rgb.g, 3055 this._b = rgb.b, 3056 this._a = rgb.a, 3057 this._roundA = mathRound(100*this._a) / 100, 3058 this._format = opts.format || rgb.format; 3059 this._gradientType = opts.gradientType; 3060 3061 // Don't let the range of [0,255] come back in [0,1]. 3062 // Potentially lose a little bit of precision here, but will fix issues where 3063 // .5 gets interpreted as half of the total, instead of half of 1 3064 // If it was supposed to be 128, this was already taken care of by `inputToRgb` 3065 if (this._r < 1) { this._r = mathRound(this._r); } 3066 if (this._g < 1) { this._g = mathRound(this._g); } 3067 if (this._b < 1) { this._b = mathRound(this._b); } 3068 3069 this._ok = rgb.ok; 3070 this._tc_id = tinyCounter++; 3071 } 3072 3073 tinycolor.prototype = { 3074 isDark: function() { 3075 return this.getBrightness() < 128; 3076 }, 3077 isLight: function() { 3078 return !this.isDark(); 3079 }, 3080 isValid: function() { 3081 return this._ok; 3082 }, 3083 getOriginalInput: function() { 3084 return this._originalInput; 3085 }, 3086 getFormat: function() { 3087 return this._format; 3088 }, 3089 getAlpha: function() { 3090 return this._a; 3091 }, 3092 getBrightness: function() { 3093 //http://www.w3.org/TR/AERT#color-contrast 3094 var rgb = this.toRgb(); 3095 return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000; 3096 }, 3097 getLuminance: function() { 3098 //http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef 3099 var rgb = this.toRgb(); 3100 var RsRGB, GsRGB, BsRGB, R, G, B; 3101 RsRGB = rgb.r/255; 3102 GsRGB = rgb.g/255; 3103 BsRGB = rgb.b/255; 3104 3105 if (RsRGB <= 0.03928) {R = RsRGB / 12.92;} else {R = Math.pow(((RsRGB + 0.055) / 1.055), 2.4);} 3106 if (GsRGB <= 0.03928) {G = GsRGB / 12.92;} else {G = Math.pow(((GsRGB + 0.055) / 1.055), 2.4);} 3107 if (BsRGB <= 0.03928) {B = BsRGB / 12.92;} else {B = Math.pow(((BsRGB + 0.055) / 1.055), 2.4);} 3108 return (0.2126 * R) + (0.7152 * G) + (0.0722 * B); 3109 }, 3110 setAlpha: function(value) { 3111 this._a = boundAlpha(value); 3112 this._roundA = mathRound(100*this._a) / 100; 3113 return this; 3114 }, 3115 toHsv: function() { 3116 var hsv = rgbToHsv(this._r, this._g, this._b); 3117 return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a }; 3118 }, 3119 toHsvString: function() { 3120 var hsv = rgbToHsv(this._r, this._g, this._b); 3121 var h = mathRound(hsv.h * 360), s = mathRound(hsv.s * 100), v = mathRound(hsv.v * 100); 3122 return (this._a == 1) ? 3123 "hsv(" + h + ", " + s + "%, " + v + "%)" : 3124 "hsva(" + h + ", " + s + "%, " + v + "%, "+ this._roundA + ")"; 3125 }, 3126 toHsl: function() { 3127 var hsl = rgbToHsl(this._r, this._g, this._b); 3128 return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this._a }; 3129 }, 3130 toHslString: function() { 3131 var hsl = rgbToHsl(this._r, this._g, this._b); 3132 var h = mathRound(hsl.h * 360), s = mathRound(hsl.s * 100), l = mathRound(hsl.l * 100); 3133 return (this._a == 1) ? 3134 "hsl(" + h + ", " + s + "%, " + l + "%)" : 3135 "hsla(" + h + ", " + s + "%, " + l + "%, "+ this._roundA + ")"; 3136 }, 3137 toHex: function(allow3Char) { 3138 return rgbToHex(this._r, this._g, this._b, allow3Char); 3139 }, 3140 toHexString: function(allow3Char) { 3141 return '#' + this.toHex(allow3Char); 3142 }, 3143 toHex8: function(allow4Char) { 3144 return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char); 3145 }, 3146 toHex8String: function(allow4Char) { 3147 return '#' + this.toHex8(allow4Char); 3148 }, 3149 toRgb: function() { 3150 return { r: mathRound(this._r), g: mathRound(this._g), b: mathRound(this._b), a: this._a }; 3151 }, 3152 toRgbString: function() { 3153 return (this._a == 1) ? 3154 "rgb(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ")" : 3155 "rgba(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ", " + this._roundA + ")"; 3156 }, 3157 toPercentageRgb: function() { 3158 return { r: mathRound(bound01(this._r, 255) * 100) + "%", g: mathRound(bound01(this._g, 255) * 100) + "%", b: mathRound(bound01(this._b, 255) * 100) + "%", a: this._a }; 3159 }, 3160 toPercentageRgbString: function() { 3161 return (this._a == 1) ? 3162 "rgb(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%)" : 3163 "rgba(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")"; 3164 }, 3165 toName: function() { 3166 if (this._a === 0) { 3167 return "transparent"; 3168 } 3169 3170 if (this._a < 1) { 3171 return false; 3172 } 3173 3174 return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false; 3175 }, 3176 toFilter: function(secondColor) { 3177 var hex8String = '#' + rgbaToArgbHex(this._r, this._g, this._b, this._a); 3178 var secondHex8String = hex8String; 3179 var gradientType = this._gradientType ? "GradientType = 1, " : ""; 3180 3181 if (secondColor) { 3182 var s = tinycolor(secondColor); 3183 secondHex8String = '#' + rgbaToArgbHex(s._r, s._g, s._b, s._a); 3184 } 3185 3186 return "progid:DXImageTransform.Microsoft.gradient("+gradientType+"startColorstr="+hex8String+",endColorstr="+secondHex8String+")"; 3187 }, 3188 toString: function(format) { 3189 var formatSet = !!format; 3190 format = format || this._format; 3191 3192 var formattedString = false; 3193 var hasAlpha = this._a < 1 && this._a >= 0; 3194 var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name"); 3195 3196 if (needsAlphaFormat) { 3197 // Special case for "transparent", all other non-alpha formats 3198 // will return rgba when there is transparency. 3199 if (format === "name" && this._a === 0) { 3200 return this.toName(); 3201 } 3202 return this.toRgbString(); 3203 } 3204 if (format === "rgb") { 3205 formattedString = this.toRgbString(); 3206 } 3207 if (format === "prgb") { 3208 formattedString = this.toPercentageRgbString(); 3209 } 3210 if (format === "hex" || format === "hex6") { 3211 formattedString = this.toHexString(); 3212 } 3213 if (format === "hex3") { 3214 formattedString = this.toHexString(true); 3215 } 3216 if (format === "hex4") { 3217 formattedString = this.toHex8String(true); 3218 } 3219 if (format === "hex8") { 3220 formattedString = this.toHex8String(); 3221 } 3222 if (format === "name") { 3223 formattedString = this.toName(); 3224 } 3225 if (format === "hsl") { 3226 formattedString = this.toHslString(); 3227 } 3228 if (format === "hsv") { 3229 formattedString = this.toHsvString(); 3230 } 3231 3232 return formattedString || this.toHexString(); 3233 }, 3234 clone: function() { 3235 return tinycolor(this.toString()); 3236 }, 3237 3238 _applyModification: function(fn, args) { 3239 var color = fn.apply(null, [this].concat([].slice.call(args))); 3240 this._r = color._r; 3241 this._g = color._g; 3242 this._b = color._b; 3243 this.setAlpha(color._a); 3244 return this; 3245 }, 3246 lighten: function() { 3247 return this._applyModification(lighten, arguments); 3248 }, 3249 brighten: function() { 3250 return this._applyModification(brighten, arguments); 3251 }, 3252 darken: function() { 3253 return this._applyModification(darken, arguments); 3254 }, 3255 desaturate: function() { 3256 return this._applyModification(desaturate, arguments); 3257 }, 3258 saturate: function() { 3259 return this._applyModification(saturate, arguments); 3260 }, 3261 greyscale: function() { 3262 return this._applyModification(greyscale, arguments); 3263 }, 3264 spin: function() { 3265 return this._applyModification(spin, arguments); 3266 }, 3267 3268 _applyCombination: function(fn, args) { 3269 return fn.apply(null, [this].concat([].slice.call(args))); 3270 }, 3271 analogous: function() { 3272 return this._applyCombination(analogous, arguments); 3273 }, 3274 complement: function() { 3275 return this._applyCombination(complement, arguments); 3276 }, 3277 monochromatic: function() { 3278 return this._applyCombination(monochromatic, arguments); 3279 }, 3280 splitcomplement: function() { 3281 return this._applyCombination(splitcomplement, arguments); 3282 }, 3283 triad: function() { 3284 return this._applyCombination(triad, arguments); 3285 }, 3286 tetrad: function() { 3287 return this._applyCombination(tetrad, arguments); 3288 } 3289 }; 3290 3291 // If input is an object, force 1 into "1.0" to handle ratios properly 3292 // String input requires "1.0" as input, so 1 will be treated as 1 3293 tinycolor.fromRatio = function(color, opts) { 3294 if (typeof color == "object") { 3295 var newColor = {}; 3296 for (var i in color) { 3297 if (color.hasOwnProperty(i)) { 3298 if (i === "a") { 3299 newColor[i] = color[i]; 3300 } 3301 else { 3302 newColor[i] = convertToPercentage(color[i]); 3303 } 3304 } 3305 } 3306 color = newColor; 3307 } 3308 3309 return tinycolor(color, opts); 3310 }; 3311 3312 // Given a string or object, convert that input to RGB 3313 // Possible string inputs: 3314 // 3315 // "red" 3316 // "#f00" or "f00" 3317 // "#ff0000" or "ff0000" 3318 // "#ff000000" or "ff000000" 3319 // "rgb 255 0 0" or "rgb (255, 0, 0)" 3320 // "rgb 1.0 0 0" or "rgb (1, 0, 0)" 3321 // "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1" 3322 // "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1" 3323 // "hsl(0, 100%, 50%)" or "hsl 0 100% 50%" 3324 // "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1" 3325 // "hsv(0, 100%, 100%)" or "hsv 0 100% 100%" 3326 // 3327 function inputToRGB(color) { 3328 3329 var rgb = { r: 0, g: 0, b: 0 }; 3330 var a = 1; 3331 var s = null; 3332 var v = null; 3333 var l = null; 3334 var ok = false; 3335 var format = false; 3336 3337 if (typeof color == "string") { 3338 color = stringInputToObject(color); 3339 } 3340 3341 if (typeof color == "object") { 3342 if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) { 3343 rgb = rgbToRgb(color.r, color.g, color.b); 3344 ok = true; 3345 format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb"; 3346 } 3347 else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) { 3348 s = convertToPercentage(color.s); 3349 v = convertToPercentage(color.v); 3350 rgb = hsvToRgb(color.h, s, v); 3351 ok = true; 3352 format = "hsv"; 3353 } 3354 else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) { 3355 s = convertToPercentage(color.s); 3356 l = convertToPercentage(color.l); 3357 rgb = hslToRgb(color.h, s, l); 3358 ok = true; 3359 format = "hsl"; 3360 } 3361 3362 if (color.hasOwnProperty("a")) { 3363 a = color.a; 3364 } 3365 } 3366 3367 a = boundAlpha(a); 3368 3369 return { 3370 ok: ok, 3371 format: color.format || format, 3372 r: mathMin(255, mathMax(rgb.r, 0)), 3373 g: mathMin(255, mathMax(rgb.g, 0)), 3374 b: mathMin(255, mathMax(rgb.b, 0)), 3375 a: a 3376 }; 3377 } 3378 3379 3380 // Conversion Functions 3381 // -------------------- 3382 3383 // `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from: 3384 // <http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript> 3385 3386 // `rgbToRgb` 3387 // Handle bounds / percentage checking to conform to CSS color spec 3388 // <http://www.w3.org/TR/css3-color/> 3389 // *Assumes:* r, g, b in [0, 255] or [0, 1] 3390 // *Returns:* { r, g, b } in [0, 255] 3391 function rgbToRgb(r, g, b){ 3392 return { 3393 r: bound01(r, 255) * 255, 3394 g: bound01(g, 255) * 255, 3395 b: bound01(b, 255) * 255 3396 }; 3397 } 3398 3399 // `rgbToHsl` 3400 // Converts an RGB color value to HSL. 3401 // *Assumes:* r, g, and b are contained in [0, 255] or [0, 1] 3402 // *Returns:* { h, s, l } in [0,1] 3403 function rgbToHsl(r, g, b) { 3404 3405 r = bound01(r, 255); 3406 g = bound01(g, 255); 3407 b = bound01(b, 255); 3408 3409 var max = mathMax(r, g, b), min = mathMin(r, g, b); 3410 var h, s, l = (max + min) / 2; 3411 3412 if(max == min) { 3413 h = s = 0; // achromatic 3414 } 3415 else { 3416 var d = max - min; 3417 s = l > 0.5 ? d / (2 - max - min) : d / (max + min); 3418 switch(max) { 3419 case r: h = (g - b) / d + (g < b ? 6 : 0); break; 3420 case g: h = (b - r) / d + 2; break; 3421 case b: h = (r - g) / d + 4; break; 3422 } 3423 3424 h /= 6; 3425 } 3426 3427 return { h: h, s: s, l: l }; 3428 } 3429 3430 // `hslToRgb` 3431 // Converts an HSL color value to RGB. 3432 // *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100] 3433 // *Returns:* { r, g, b } in the set [0, 255] 3434 function hslToRgb(h, s, l) { 3435 var r, g, b; 3436 3437 h = bound01(h, 360); 3438 s = bound01(s, 100); 3439 l = bound01(l, 100); 3440 3441 function hue2rgb(p, q, t) { 3442 if(t < 0) t += 1; 3443 if(t > 1) t -= 1; 3444 if(t < 1/6) return p + (q - p) * 6 * t; 3445 if(t < 1/2) return q; 3446 if(t < 2/3) return p + (q - p) * (2/3 - t) * 6; 3447 return p; 3448 } 3449 3450 if(s === 0) { 3451 r = g = b = l; // achromatic 3452 } 3453 else { 3454 var q = l < 0.5 ? l * (1 + s) : l + s - l * s; 3455 var p = 2 * l - q; 3456 r = hue2rgb(p, q, h + 1/3); 3457 g = hue2rgb(p, q, h); 3458 b = hue2rgb(p, q, h - 1/3); 3459 } 3460 3461 return { r: r * 255, g: g * 255, b: b * 255 }; 3462 } 3463 3464 // `rgbToHsv` 3465 // Converts an RGB color value to HSV 3466 // *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1] 3467 // *Returns:* { h, s, v } in [0,1] 3468 function rgbToHsv(r, g, b) { 3469 3470 r = bound01(r, 255); 3471 g = bound01(g, 255); 3472 b = bound01(b, 255); 3473 3474 var max = mathMax(r, g, b), min = mathMin(r, g, b); 3475 var h, s, v = max; 3476 3477 var d = max - min; 3478 s = max === 0 ? 0 : d / max; 3479 3480 if(max == min) { 3481 h = 0; // achromatic 3482 } 3483 else { 3484 switch(max) { 3485 case r: h = (g - b) / d + (g < b ? 6 : 0); break; 3486 case g: h = (b - r) / d + 2; break; 3487 case b: h = (r - g) / d + 4; break; 3488 } 3489 h /= 6; 3490 } 3491 return { h: h, s: s, v: v }; 3492 } 3493 3494 // `hsvToRgb` 3495 // Converts an HSV color value to RGB. 3496 // *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100] 3497 // *Returns:* { r, g, b } in the set [0, 255] 3498 function hsvToRgb(h, s, v) { 3499 3500 h = bound01(h, 360) * 6; 3501 s = bound01(s, 100); 3502 v = bound01(v, 100); 3503 3504 var i = Math.floor(h), 3505 f = h - i, 3506 p = v * (1 - s), 3507 q = v * (1 - f * s), 3508 t = v * (1 - (1 - f) * s), 3509 mod = i % 6, 3510 r = [v, q, p, p, t, v][mod], 3511 g = [t, v, v, q, p, p][mod], 3512 b = [p, p, t, v, v, q][mod]; 3513 3514 return { r: r * 255, g: g * 255, b: b * 255 }; 3515 } 3516 3517 // `rgbToHex` 3518 // Converts an RGB color to hex 3519 // Assumes r, g, and b are contained in the set [0, 255] 3520 // Returns a 3 or 6 character hex 3521 function rgbToHex(r, g, b, allow3Char) { 3522 3523 var hex = [ 3524 pad2(mathRound(r).toString(16)), 3525 pad2(mathRound(g).toString(16)), 3526 pad2(mathRound(b).toString(16)) 3527 ]; 3528 3529 // Return a 3 character hex if possible 3530 if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) { 3531 return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0); 3532 } 3533 3534 return hex.join(""); 3535 } 3536 3537 // `rgbaToHex` 3538 // Converts an RGBA color plus alpha transparency to hex 3539 // Assumes r, g, b are contained in the set [0, 255] and 3540 // a in [0, 1]. Returns a 4 or 8 character rgba hex 3541 function rgbaToHex(r, g, b, a, allow4Char) { 3542 3543 var hex = [ 3544 pad2(mathRound(r).toString(16)), 3545 pad2(mathRound(g).toString(16)), 3546 pad2(mathRound(b).toString(16)), 3547 pad2(convertDecimalToHex(a)) 3548 ]; 3549 3550 // Return a 4 character hex if possible 3551 if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) { 3552 return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0); 3553 } 3554 3555 return hex.join(""); 3556 } 3557 3558 // `rgbaToArgbHex` 3559 // Converts an RGBA color to an ARGB Hex8 string 3560 // Rarely used, but required for "toFilter()" 3561 function rgbaToArgbHex(r, g, b, a) { 3562 3563 var hex = [ 3564 pad2(convertDecimalToHex(a)), 3565 pad2(mathRound(r).toString(16)), 3566 pad2(mathRound(g).toString(16)), 3567 pad2(mathRound(b).toString(16)) 3568 ]; 3569 3570 return hex.join(""); 3571 } 3572 3573 // `equals` 3574 // Can be called with any tinycolor input 3575 tinycolor.equals = function (color1, color2) { 3576 if (!color1 || !color2) { return false; } 3577 return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString(); 3578 }; 3579 3580 tinycolor.random = function() { 3581 return tinycolor.fromRatio({ 3582 r: mathRandom(), 3583 g: mathRandom(), 3584 b: mathRandom() 3585 }); 3586 }; 3587 3588 3589 // Modification Functions 3590 // ---------------------- 3591 // Thanks to less.js for some of the basics here 3592 // <https://github.com/cloudhead/less.js/blob/master/lib/less/functions.js> 3593 3594 function desaturate(color, amount) { 3595 amount = (amount === 0) ? 0 : (amount || 10); 3596 var hsl = tinycolor(color).toHsl(); 3597 hsl.s -= amount / 100; 3598 hsl.s = clamp01(hsl.s); 3599 return tinycolor(hsl); 3600 } 3601 3602 function saturate(color, amount) { 3603 amount = (amount === 0) ? 0 : (amount || 10); 3604 var hsl = tinycolor(color).toHsl(); 3605 hsl.s += amount / 100; 3606 hsl.s = clamp01(hsl.s); 3607 return tinycolor(hsl); 3608 } 3609 3610 function greyscale(color) { 3611 return tinycolor(color).desaturate(100); 3612 } 3613 3614 function lighten (color, amount) { 3615 amount = (amount === 0) ? 0 : (amount || 10); 3616 var hsl = tinycolor(color).toHsl(); 3617 hsl.l += amount / 100; 3618 hsl.l = clamp01(hsl.l); 3619 return tinycolor(hsl); 3620 } 3621 3622 function brighten(color, amount) { 3623 amount = (amount === 0) ? 0 : (amount || 10); 3624 var rgb = tinycolor(color).toRgb(); 3625 rgb.r = mathMax(0, mathMin(255, rgb.r - mathRound(255 * - (amount / 100)))); 3626 rgb.g = mathMax(0, mathMin(255, rgb.g - mathRound(255 * - (amount / 100)))); 3627 rgb.b = mathMax(0, mathMin(255, rgb.b - mathRound(255 * - (amount / 100)))); 3628 return tinycolor(rgb); 3629 } 3630 3631 function darken (color, amount) { 3632 amount = (amount === 0) ? 0 : (amount || 10); 3633 var hsl = tinycolor(color).toHsl(); 3634 hsl.l -= amount / 100; 3635 hsl.l = clamp01(hsl.l); 3636 return tinycolor(hsl); 3637 } 3638 3639 // Spin takes a positive or negative amount within [-360, 360] indicating the change of hue. 3640 // Values outside of this range will be wrapped into this range. 3641 function spin(color, amount) { 3642 var hsl = tinycolor(color).toHsl(); 3643 var hue = (hsl.h + amount) % 360; 3644 hsl.h = hue < 0 ? 360 + hue : hue; 3645 return tinycolor(hsl); 3646 } 3647 3648 // Combination Functions 3649 // --------------------- 3650 // Thanks to jQuery xColor for some of the ideas behind these 3651 // <https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js> 3652 3653 function complement(color) { 3654 var hsl = tinycolor(color).toHsl(); 3655 hsl.h = (hsl.h + 180) % 360; 3656 return tinycolor(hsl); 3657 } 3658 3659 function triad(color) { 3660 var hsl = tinycolor(color).toHsl(); 3661 var h = hsl.h; 3662 return [ 3663 tinycolor(color), 3664 tinycolor({ h: (h + 120) % 360, s: hsl.s, l: hsl.l }), 3665 tinycolor({ h: (h + 240) % 360, s: hsl.s, l: hsl.l }) 3666 ]; 3667 } 3668 3669 function tetrad(color) { 3670 var hsl = tinycolor(color).toHsl(); 3671 var h = hsl.h; 3672 return [ 3673 tinycolor(color), 3674 tinycolor({ h: (h + 90) % 360, s: hsl.s, l: hsl.l }), 3675 tinycolor({ h: (h + 180) % 360, s: hsl.s, l: hsl.l }), 3676 tinycolor({ h: (h + 270) % 360, s: hsl.s, l: hsl.l }) 3677 ]; 3678 } 3679 3680 function splitcomplement(color) { 3681 var hsl = tinycolor(color).toHsl(); 3682 var h = hsl.h; 3683 return [ 3684 tinycolor(color), 3685 tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l}), 3686 tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l}) 3687 ]; 3688 } 3689 3690 function analogous(color, results, slices) { 3691 results = results || 6; 3692 slices = slices || 30; 3693 3694 var hsl = tinycolor(color).toHsl(); 3695 var part = 360 / slices; 3696 var ret = [tinycolor(color)]; 3697 3698 for (hsl.h = ((hsl.h - (part * results >> 1)) + 720) % 360; --results; ) { 3699 hsl.h = (hsl.h + part) % 360; 3700 ret.push(tinycolor(hsl)); 3701 } 3702 return ret; 3703 } 3704 3705 function monochromatic(color, results) { 3706 results = results || 6; 3707 var hsv = tinycolor(color).toHsv(); 3708 var h = hsv.h, s = hsv.s, v = hsv.v; 3709 var ret = []; 3710 var modification = 1 / results; 3711 3712 while (results--) { 3713 ret.push(tinycolor({ h: h, s: s, v: v})); 3714 v = (v + modification) % 1; 3715 } 3716 3717 return ret; 3718 } 3719 3720 // Utility Functions 3721 // --------------------- 3722 3723 tinycolor.mix = function(color1, color2, amount) { 3724 amount = (amount === 0) ? 0 : (amount || 50); 3725 3726 var rgb1 = tinycolor(color1).toRgb(); 3727 var rgb2 = tinycolor(color2).toRgb(); 3728 3729 var p = amount / 100; 3730 3731 var rgba = { 3732 r: ((rgb2.r - rgb1.r) * p) + rgb1.r, 3733 g: ((rgb2.g - rgb1.g) * p) + rgb1.g, 3734 b: ((rgb2.b - rgb1.b) * p) + rgb1.b, 3735 a: ((rgb2.a - rgb1.a) * p) + rgb1.a 3736 }; 3737 3738 return tinycolor(rgba); 3739 }; 3740 3741 3742 // Readability Functions 3743 // --------------------- 3744 // <http://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef (WCAG Version 2) 3745 3746 // `contrast` 3747 // Analyze the 2 colors and returns the color contrast defined by (WCAG Version 2) 3748 tinycolor.readability = function(color1, color2) { 3749 var c1 = tinycolor(color1); 3750 var c2 = tinycolor(color2); 3751 return (Math.max(c1.getLuminance(),c2.getLuminance())+0.05) / (Math.min(c1.getLuminance(),c2.getLuminance())+0.05); 3752 }; 3753 3754 // `isReadable` 3755 // Ensure that foreground and background color combinations meet WCAG2 guidelines. 3756 // The third argument is an optional Object. 3757 // the 'level' property states 'AA' or 'AAA' - if missing or invalid, it defaults to 'AA'; 3758 // the 'size' property states 'large' or 'small' - if missing or invalid, it defaults to 'small'. 3759 // If the entire object is absent, isReadable defaults to {level:"AA",size:"small"}. 3760 3761 // *Example* 3762 // tinycolor.isReadable("#000", "#111") => false 3763 // tinycolor.isReadable("#000", "#111",{level:"AA",size:"large"}) => false 3764 tinycolor.isReadable = function(color1, color2, wcag2) { 3765 var readability = tinycolor.readability(color1, color2); 3766 var wcag2Parms, out; 3767 3768 out = false; 3769 3770 wcag2Parms = validateWCAG2Parms(wcag2); 3771 switch (wcag2Parms.level + wcag2Parms.size) { 3772 case "AAsmall": 3773 case "AAAlarge": 3774 out = readability >= 4.5; 3775 break; 3776 case "AAlarge": 3777 out = readability >= 3; 3778 break; 3779 case "AAAsmall": 3780 out = readability >= 7; 3781 break; 3782 } 3783 return out; 3784 3785 }; 3786 3787 // `mostReadable` 3788 // Given a base color and a list of possible foreground or background 3789 // colors for that base, returns the most readable color. 3790 // Optionally returns Black or White if the most readable color is unreadable. 3791 // *Example* 3792 // tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(); // "#112255" 3793 // tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString(); // "#ffffff" 3794 // tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(); // "#faf3f3" 3795 // tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(); // "#ffffff" 3796 tinycolor.mostReadable = function(baseColor, colorList, args) { 3797 var bestColor = null; 3798 var bestScore = 0; 3799 var readability; 3800 var includeFallbackColors, level, size ; 3801 args = args || {}; 3802 includeFallbackColors = args.includeFallbackColors ; 3803 level = args.level; 3804 size = args.size; 3805 3806 for (var i= 0; i < colorList.length ; i++) { 3807 readability = tinycolor.readability(baseColor, colorList[i]); 3808 if (readability > bestScore) { 3809 bestScore = readability; 3810 bestColor = tinycolor(colorList[i]); 3811 } 3812 } 3813 3814 if (tinycolor.isReadable(baseColor, bestColor, {"level":level,"size":size}) || !includeFallbackColors) { 3815 return bestColor; 3816 } 3817 else { 3818 args.includeFallbackColors=false; 3819 return tinycolor.mostReadable(baseColor,["#fff", "#000"],args); 3820 } 3821 }; 3822 3823 3824 // Big List of Colors 3825 // ------------------ 3826 // <http://www.w3.org/TR/css3-color/#svg-color> 3827 var names = tinycolor.names = { 3828 aliceblue: "f0f8ff", 3829 antiquewhite: "faebd7", 3830 aqua: "0ff", 3831 aquamarine: "7fffd4", 3832 azure: "f0ffff", 3833 beige: "f5f5dc", 3834 bisque: "ffe4c4", 3835 black: "000", 3836 blanchedalmond: "ffebcd", 3837 blue: "00f", 3838 blueviolet: "8a2be2", 3839 brown: "a52a2a", 3840 burlywood: "deb887", 3841 burntsienna: "ea7e5d", 3842 cadetblue: "5f9ea0", 3843 chartreuse: "7fff00", 3844 chocolate: "d2691e", 3845 coral: "ff7f50", 3846 cornflowerblue: "6495ed", 3847 cornsilk: "fff8dc", 3848 crimson: "dc143c", 3849 cyan: "0ff", 3850 darkblue: "00008b", 3851 darkcyan: "008b8b", 3852 darkgoldenrod: "b8860b", 3853 darkgray: "a9a9a9", 3854 darkgreen: "006400", 3855 darkgrey: "a9a9a9", 3856 darkkhaki: "bdb76b", 3857 darkmagenta: "8b008b", 3858 darkolivegreen: "556b2f", 3859 darkorange: "ff8c00", 3860 darkorchid: "9932cc", 3861 darkred: "8b0000", 3862 darksalmon: "e9967a", 3863 darkseagreen: "8fbc8f", 3864 darkslateblue: "483d8b", 3865 darkslategray: "2f4f4f", 3866 darkslategrey: "2f4f4f", 3867 darkturquoise: "00ced1", 3868 darkviolet: "9400d3", 3869 deeppink: "ff1493", 3870 deepskyblue: "00bfff", 3871 dimgray: "696969", 3872 dimgrey: "696969", 3873 dodgerblue: "1e90ff", 3874 firebrick: "b22222", 3875 floralwhite: "fffaf0", 3876 forestgreen: "228b22", 3877 fuchsia: "f0f", 3878 gainsboro: "dcdcdc", 3879 ghostwhite: "f8f8ff", 3880 gold: "ffd700", 3881 goldenrod: "daa520", 3882 gray: "808080", 3883 green: "008000", 3884 greenyellow: "adff2f", 3885 grey: "808080", 3886 honeydew: "f0fff0", 3887 hotpink: "ff69b4", 3888 indianred: "cd5c5c", 3889 indigo: "4b0082", 3890 ivory: "fffff0", 3891 khaki: "f0e68c", 3892 lavender: "e6e6fa", 3893 lavenderblush: "fff0f5", 3894 lawngreen: "7cfc00", 3895 lemonchiffon: "fffacd", 3896 lightblue: "add8e6", 3897 lightcoral: "f08080", 3898 lightcyan: "e0ffff", 3899 lightgoldenrodyellow: "fafad2", 3900 lightgray: "d3d3d3", 3901 lightgreen: "90ee90", 3902 lightgrey: "d3d3d3", 3903 lightpink: "ffb6c1", 3904 lightsalmon: "ffa07a", 3905 lightseagreen: "20b2aa", 3906 lightskyblue: "87cefa", 3907 lightslategray: "789", 3908 lightslategrey: "789", 3909 lightsteelblue: "b0c4de", 3910 lightyellow: "ffffe0", 3911 lime: "0f0", 3912 limegreen: "32cd32", 3913 linen: "faf0e6", 3914 magenta: "f0f", 3915 maroon: "800000", 3916 mediumaquamarine: "66cdaa", 3917 mediumblue: "0000cd", 3918 mediumorchid: "ba55d3", 3919 mediumpurple: "9370db", 3920 mediumseagreen: "3cb371", 3921 mediumslateblue: "7b68ee", 3922 mediumspringgreen: "00fa9a", 3923 mediumturquoise: "48d1cc", 3924 mediumvioletred: "c71585", 3925 midnightblue: "191970", 3926 mintcream: "f5fffa", 3927 mistyrose: "ffe4e1", 3928 moccasin: "ffe4b5", 3929 navajowhite: "ffdead", 3930 navy: "000080", 3931 oldlace: "fdf5e6", 3932 olive: "808000", 3933 olivedrab: "6b8e23", 3934 orange: "ffa500", 3935 orangered: "ff4500", 3936 orchid: "da70d6", 3937 palegoldenrod: "eee8aa", 3938 palegreen: "98fb98", 3939 paleturquoise: "afeeee", 3940 palevioletred: "db7093", 3941 papayawhip: "ffefd5", 3942 peachpuff: "ffdab9", 3943 peru: "cd853f", 3944 pink: "ffc0cb", 3945 plum: "dda0dd", 3946 powderblue: "b0e0e6", 3947 purple: "800080", 3948 rebeccapurple: "663399", 3949 red: "f00", 3950 rosybrown: "bc8f8f", 3951 royalblue: "4169e1", 3952 saddlebrown: "8b4513", 3953 salmon: "fa8072", 3954 sandybrown: "f4a460", 3955 seagreen: "2e8b57", 3956 seashell: "fff5ee", 3957 sienna: "a0522d", 3958 silver: "c0c0c0", 3959 skyblue: "87ceeb", 3960 slateblue: "6a5acd", 3961 slategray: "708090", 3962 slategrey: "708090", 3963 snow: "fffafa", 3964 springgreen: "00ff7f", 3965 steelblue: "4682b4", 3966 tan: "d2b48c", 3967 teal: "008080", 3968 thistle: "d8bfd8", 3969 tomato: "ff6347", 3970 turquoise: "40e0d0", 3971 violet: "ee82ee", 3972 wheat: "f5deb3", 3973 white: "fff", 3974 whitesmoke: "f5f5f5", 3975 yellow: "ff0", 3976 yellowgreen: "9acd32" 3977 }; 3978 3979 // Make it easy to access colors via `hexNames[hex]` 3980 var hexNames = tinycolor.hexNames = flip(names); 3981 3982 3983 // Utilities 3984 // --------- 3985 3986 // `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }` 3987 function flip(o) { 3988 var flipped = { }; 3989 for (var i in o) { 3990 if (o.hasOwnProperty(i)) { 3991 flipped[o[i]] = i; 3992 } 3993 } 3994 return flipped; 3995 } 3996 3997 // Return a valid alpha value [0,1] with all invalid values being set to 1 3998 function boundAlpha(a) { 3999 a = parseFloat(a); 4000 4001 if (isNaN(a) || a < 0 || a > 1) { 4002 a = 1; 4003 } 4004 4005 return a; 4006 } 4007 4008 // Take input from [0, n] and return it as [0, 1] 4009 function bound01(n, max) { 4010 if (isOnePointZero(n)) { n = "100%"; } 4011 4012 var processPercent = isPercentage(n); 4013 n = mathMin(max, mathMax(0, parseFloat(n))); 4014 4015 // Automatically convert percentage into number 4016 if (processPercent) { 4017 n = parseInt(n * max, 10) / 100; 4018 } 4019 4020 // Handle floating point rounding errors 4021 if ((Math.abs(n - max) < 0.000001)) { 4022 return 1; 4023 } 4024 4025 // Convert into [0, 1] range if it isn't already 4026 return (n % max) / parseFloat(max); 4027 } 4028 4029 // Force a number between 0 and 1 4030 function clamp01(val) { 4031 return mathMin(1, mathMax(0, val)); 4032 } 4033 4034 // Parse a base-16 hex value into a base-10 integer 4035 function parseIntFromHex(val) { 4036 return parseInt(val, 16); 4037 } 4038 4039 // Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1 4040 // <http://stackoverflow.com/questions/7422072/javascript-how-to-detect-number-as-a-decimal-including-1-0> 4041 function isOnePointZero(n) { 4042 return typeof n == "string" && n.indexOf('.') != -1 && parseFloat(n) === 1; 4043 } 4044 4045 // Check to see if string passed in is a percentage 4046 function isPercentage(n) { 4047 return typeof n === "string" && n.indexOf('%') != -1; 4048 } 4049 4050 // Force a hex value to have 2 characters 4051 function pad2(c) { 4052 return c.length == 1 ? '0' + c : '' + c; 4053 } 4054 4055 // Replace a decimal with it's percentage value 4056 function convertToPercentage(n) { 4057 if (n <= 1) { 4058 n = (n * 100) + "%"; 4059 } 4060 4061 return n; 4062 } 4063 4064 // Converts a decimal to a hex value 4065 function convertDecimalToHex(d) { 4066 return Math.round(parseFloat(d) * 255).toString(16); 4067 } 4068 // Converts a hex value to a decimal 4069 function convertHexToDecimal(h) { 4070 return (parseIntFromHex(h) / 255); 4071 } 4072 4073 var matchers = (function() { 4074 4075 // <http://www.w3.org/TR/css3-values/#integers> 4076 var CSS_INTEGER = "[-\\+]?\\d+%?"; 4077 4078 // <http://www.w3.org/TR/css3-values/#number-value> 4079 var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?"; 4080 4081 // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome. 4082 var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")"; 4083 4084 // Actual matching. 4085 // Parentheses and commas are optional, but not required. 4086 // Whitespace can take the place of commas or opening paren 4087 var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; 4088 var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?"; 4089 4090 return { 4091 CSS_UNIT: new RegExp(CSS_UNIT), 4092 rgb: new RegExp("rgb" + PERMISSIVE_MATCH3), 4093 rgba: new RegExp("rgba" + PERMISSIVE_MATCH4), 4094 hsl: new RegExp("hsl" + PERMISSIVE_MATCH3), 4095 hsla: new RegExp("hsla" + PERMISSIVE_MATCH4), 4096 hsv: new RegExp("hsv" + PERMISSIVE_MATCH3), 4097 hsva: new RegExp("hsva" + PERMISSIVE_MATCH4), 4098 hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, 4099 hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/, 4100 hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/, 4101 hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/ 4102 }; 4103 })(); 4104 4105 // `isValidCSSUnit` 4106 // Take in a single string / number and check to see if it looks like a CSS unit 4107 // (see `matchers` above for definition). 4108 function isValidCSSUnit(color) { 4109 return !!matchers.CSS_UNIT.exec(color); 4110 } 4111 4112 // `stringInputToObject` 4113 // Permissive string parsing. Take in a number of formats, and output an object 4114 // based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}` 4115 function stringInputToObject(color) { 4116 4117 color = color.replace(trimLeft,'').replace(trimRight, '').toLowerCase(); 4118 var named = false; 4119 if (names[color]) { 4120 color = names[color]; 4121 named = true; 4122 } 4123 else if (color == 'transparent') { 4124 return { r: 0, g: 0, b: 0, a: 0, format: "name" }; 4125 } 4126 4127 // Try to match string input using regular expressions. 4128 // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360] 4129 // Just return an object and let the conversion functions handle that. 4130 // This way the result will be the same whether the tinycolor is initialized with string or object. 4131 var match; 4132 if ((match = matchers.rgb.exec(color))) { 4133 return { r: match[1], g: match[2], b: match[3] }; 4134 } 4135 if ((match = matchers.rgba.exec(color))) { 4136 return { r: match[1], g: match[2], b: match[3], a: match[4] }; 4137 } 4138 if ((match = matchers.hsl.exec(color))) { 4139 return { h: match[1], s: match[2], l: match[3] }; 4140 } 4141 if ((match = matchers.hsla.exec(color))) { 4142 return { h: match[1], s: match[2], l: match[3], a: match[4] }; 4143 } 4144 if ((match = matchers.hsv.exec(color))) { 4145 return { h: match[1], s: match[2], v: match[3] }; 4146 } 4147 if ((match = matchers.hsva.exec(color))) { 4148 return { h: match[1], s: match[2], v: match[3], a: match[4] }; 4149 } 4150 if ((match = matchers.hex8.exec(color))) { 4151 return { 4152 r: parseIntFromHex(match[1]), 4153 g: parseIntFromHex(match[2]), 4154 b: parseIntFromHex(match[3]), 4155 a: convertHexToDecimal(match[4]), 4156 format: named ? "name" : "hex8" 4157 }; 4158 } 4159 if ((match = matchers.hex6.exec(color))) { 4160 return { 4161 r: parseIntFromHex(match[1]), 4162 g: parseIntFromHex(match[2]), 4163 b: parseIntFromHex(match[3]), 4164 format: named ? "name" : "hex" 4165 }; 4166 } 4167 if ((match = matchers.hex4.exec(color))) { 4168 return { 4169 r: parseIntFromHex(match[1] + '' + match[1]), 4170 g: parseIntFromHex(match[2] + '' + match[2]), 4171 b: parseIntFromHex(match[3] + '' + match[3]), 4172 a: convertHexToDecimal(match[4] + '' + match[4]), 4173 format: named ? "name" : "hex8" 4174 }; 4175 } 4176 if ((match = matchers.hex3.exec(color))) { 4177 return { 4178 r: parseIntFromHex(match[1] + '' + match[1]), 4179 g: parseIntFromHex(match[2] + '' + match[2]), 4180 b: parseIntFromHex(match[3] + '' + match[3]), 4181 format: named ? "name" : "hex" 4182 }; 4183 } 4184 4185 return false; 4186 } 4187 4188 function validateWCAG2Parms(parms) { 4189 // return valid WCAG2 parms for isReadable. 4190 // If input parms are invalid, return {"level":"AA", "size":"small"} 4191 var level, size; 4192 parms = parms || {"level":"AA", "size":"small"}; 4193 level = (parms.level || "AA").toUpperCase(); 4194 size = (parms.size || "small").toLowerCase(); 4195 if (level !== "AA" && level !== "AAA") { 4196 level = "AA"; 4197 } 4198 if (size !== "small" && size !== "large") { 4199 size = "small"; 4200 } 4201 return {"level":level, "size":size}; 4202 } 4203 4204 // Node: Export function 4205 if ( true && module.exports) { 4206 module.exports = tinycolor; 4207 } 4208 // AMD/requirejs: Define the module 4209 else if (true) { 4210 !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {return tinycolor;}).call(exports, __webpack_require__, exports, module), 4211 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 4212 } 4213 // Browser: Expose to window 4214 else {} 4215 4216 })(Math); 4217 4218 4219 /***/ }), 4220 /* 67 */ 4221 /***/ (function(module, __webpack_exports__, __webpack_require__) { 4222 4223 "use strict"; 4224 /* unused harmony export Box */ 4225 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useBox; }); 4226 /* harmony import */ var _rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15); 4227 /* harmony import */ var reakit_system_createComponent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(51); 4228 /* harmony import */ var reakit_system_createHook__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(50); 4229 /* harmony import */ var reakit_utils_shallowEqual__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(56); 4230 4231 4232 4233 4234 4235 var useBox = Object(reakit_system_createHook__WEBPACK_IMPORTED_MODULE_2__[/* createHook */ "a"])({ 4236 name: "Box", 4237 keys: ["unstable_system"], 4238 propsAreEqual: function propsAreEqual(prev, next) { 4239 var prevSystem = prev.unstable_system, 4240 prevProps = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* _ */ "a"])(prev, ["unstable_system"]); 4241 4242 var nextSystem = next.unstable_system, 4243 nextProps = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* _ */ "a"])(next, ["unstable_system"]); 4244 4245 if (prevSystem !== nextSystem && !Object(reakit_utils_shallowEqual__WEBPACK_IMPORTED_MODULE_3__[/* shallowEqual */ "a"])(prevSystem, nextSystem)) { 4246 return false; 4247 } 4248 4249 return Object(reakit_utils_shallowEqual__WEBPACK_IMPORTED_MODULE_3__[/* shallowEqual */ "a"])(prevProps, nextProps); 4250 } 4251 }); 4252 var Box = Object(reakit_system_createComponent__WEBPACK_IMPORTED_MODULE_1__[/* createComponent */ "a"])({ 4253 as: "div", 4254 useHook: useBox 4255 }); 4256 4257 4258 4259 4260 /***/ }), 4261 /* 68 */ 4262 /***/ (function(module, __webpack_exports__, __webpack_require__) { 4263 4264 "use strict"; 4265 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return unstable_IdContext; }); 4266 /* unused harmony export unstable_IdProvider */ 4267 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(13); 4268 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 4269 4270 4271 var defaultPrefix = "id"; 4272 function generateRandomString(prefix) { 4273 if (prefix === void 0) { 4274 prefix = defaultPrefix; 4275 } 4276 4277 return "" + (prefix ? prefix + "-" : "") + Math.random().toString(32).substr(2, 6); 4278 } 4279 4280 var unstable_IdContext = Object(react__WEBPACK_IMPORTED_MODULE_0__["createContext"])(generateRandomString); 4281 function unstable_IdProvider(_ref) { 4282 var children = _ref.children, 4283 _ref$prefix = _ref.prefix, 4284 prefix = _ref$prefix === void 0 ? defaultPrefix : _ref$prefix; 4285 var count = Object(react__WEBPACK_IMPORTED_MODULE_0__["useRef"])(0); 4286 var generateId = Object(react__WEBPACK_IMPORTED_MODULE_0__["useCallback"])(function (localPrefix) { 4287 if (localPrefix === void 0) { 4288 localPrefix = prefix; 4289 } 4290 4291 return "" + (localPrefix ? localPrefix + "-" : "") + ++count.current; 4292 }, [prefix]); 4293 return /*#__PURE__*/Object(react__WEBPACK_IMPORTED_MODULE_0__["createElement"])(unstable_IdContext.Provider, { 4294 value: generateId 4295 }, children); 4296 } 4297 4298 4299 4300 4301 /***/ }), 4302 /* 69 */ 4303 /***/ (function(module, exports) { 4304 4305 (function() { module.exports = this["wp"]["htmlEntities"]; }()); 4306 4307 /***/ }), 4308 /* 70 */ 4309 /***/ (function(module, __webpack_exports__, __webpack_require__) { 4310 4311 "use strict"; 4312 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return hasFocusWithin; }); 4313 /* harmony import */ var _getActiveElement_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(57); 4314 4315 4316 4317 /** 4318 * Checks if `element` has focus. 4319 * 4320 * @example 4321 * import { hasFocusWithin } from "reakit-utils"; 4322 * 4323 * hasFocusWithin(document.getElementById("id")); 4324 */ 4325 4326 function hasFocusWithin(element) { 4327 var activeElement = Object(_getActiveElement_js__WEBPACK_IMPORTED_MODULE_0__[/* getActiveElement */ "a"])(element); 4328 if (!activeElement) return false; 4329 if (element.contains(activeElement)) return true; 4330 var activeDescendant = activeElement.getAttribute("aria-activedescendant"); 4331 if (!activeDescendant) return false; 4332 return activeDescendant === element.id || !!element.querySelector("#" + activeDescendant); 4333 } 4334 4335 4336 4337 4338 /***/ }), 4339 /* 71 */ 4340 /***/ (function(module, __webpack_exports__, __webpack_require__) { 4341 4342 "use strict"; 4343 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return isButton; }); 4344 var buttonInputTypes = ["button", "color", "file", "image", "reset", "submit"]; 4345 /** 4346 * Checks whether `element` is a native HTML button element or not. 4347 * 4348 * @example 4349 * import { isButton } from "reakit-utils"; 4350 * 4351 * isButton(document.querySelector("button")); // true 4352 * isButton(document.querySelector("input[type='button']")); // true 4353 * isButton(document.querySelector("div")); // false 4354 * isButton(document.querySelector("input[type='text']")); // false 4355 * 4356 * @returns {boolean} 4357 */ 4358 4359 function isButton(element) { 4360 if (element.tagName === "BUTTON") return true; 4361 4362 if (element.tagName === "INPUT") { 4363 var input = element; 4364 return buttonInputTypes.indexOf(input.type) !== -1; 4365 } 4366 4367 return false; 4368 } 4369 4370 4371 4372 4373 /***/ }), 4374 /* 72 */ 4375 /***/ (function(module, __webpack_exports__, __webpack_require__) { 4376 4377 "use strict"; 4378 4379 // EXPORTS 4380 __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ ensureFocus; }); 4381 __webpack_require__.d(__webpack_exports__, "b", function() { return /* binding */ getClosestFocusable; }); 4382 4383 // UNUSED EXPORTS: getAllFocusableIn, getAllTabbableIn, getFirstFocusableIn, getFirstTabbableIn, getLastTabbableIn, getNextTabbableIn, getPreviousTabbableIn, isFocusable, isTabbable 4384 4385 // CONCATENATED MODULE: ./node_modules/reakit-utils/es/matches.js 4386 /** 4387 * Ponyfill for `Element.prototype.matches` 4388 * 4389 * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/matches 4390 */ 4391 function matches(element, selectors) { 4392 if ("matches" in element) return element.matches(selectors); 4393 if ("msMatchesSelector" in element) return element.msMatchesSelector(selectors); 4394 return element.webkitMatchesSelector(selectors); 4395 } 4396 4397 4398 4399 // CONCATENATED MODULE: ./node_modules/reakit-utils/es/closest.js 4400 4401 4402 /** 4403 * Ponyfill for `Element.prototype.closest` 4404 * 4405 * @example 4406 * import { closest } from "reakit-utils"; 4407 * 4408 * closest(document.getElementById("id"), "div"); 4409 * // same as 4410 * document.getElementById("id").closest("div"); 4411 */ 4412 function closest(element, selectors) { 4413 if ("closest" in element) return element.closest(selectors); 4414 4415 do { 4416 if (matches(element, selectors)) return element; 4417 element = element.parentElement || element.parentNode; 4418 } while (element !== null && element.nodeType === 1); 4419 4420 return null; 4421 } 4422 4423 4424 4425 // EXTERNAL MODULE: ./node_modules/reakit-utils/es/getActiveElement.js 4426 var getActiveElement = __webpack_require__(57); 4427 4428 // CONCATENATED MODULE: ./node_modules/reakit-utils/es/tabbable.js 4429 4430 4431 4432 4433 4434 /** @module tabbable */ 4435 var selector = "input:not([type='hidden']):not([disabled]), select:not([disabled]), " + "textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], " + "iframe, object, embed, area[href], audio[controls], video[controls], " + "[contenteditable]:not([contenteditable='false'])"; 4436 4437 function isVisible(element) { 4438 return element.offsetWidth > 0 || element.offsetHeight > 0 || element.getClientRects().length > 0; 4439 } 4440 4441 function hasNegativeTabIndex(element) { 4442 var tabIndex = parseInt(element.getAttribute("tabindex") || "0", 10); 4443 return tabIndex < 0; 4444 } 4445 /** 4446 * Checks whether `element` is focusable or not. 4447 * 4448 * @memberof tabbable 4449 * 4450 * @example 4451 * import { isFocusable } from "reakit-utils"; 4452 * 4453 * isFocusable(document.querySelector("input")); // true 4454 * isFocusable(document.querySelector("input[tabindex='-1']")); // true 4455 * isFocusable(document.querySelector("input[hidden]")); // false 4456 * isFocusable(document.querySelector("input:disabled")); // false 4457 */ 4458 4459 4460 function isFocusable(element) { 4461 return matches(element, selector) && isVisible(element); 4462 } 4463 /** 4464 * Checks whether `element` is tabbable or not. 4465 * 4466 * @memberof tabbable 4467 * 4468 * @example 4469 * import { isTabbable } from "reakit-utils"; 4470 * 4471 * isTabbable(document.querySelector("input")); // true 4472 * isTabbable(document.querySelector("input[tabindex='-1']")); // false 4473 * isTabbable(document.querySelector("input[hidden]")); // false 4474 * isTabbable(document.querySelector("input:disabled")); // false 4475 */ 4476 4477 function isTabbable(element) { 4478 return isFocusable(element) && !hasNegativeTabIndex(element); 4479 } 4480 /** 4481 * Returns all the focusable elements in `container`. 4482 * 4483 * @memberof tabbable 4484 * 4485 * @param {Element} container 4486 * 4487 * @returns {Element[]} 4488 */ 4489 4490 function getAllFocusableIn(container) { 4491 var allFocusable = Array.from(container.querySelectorAll(selector)); 4492 allFocusable.unshift(container); 4493 return allFocusable.filter(isFocusable); 4494 } 4495 /** 4496 * Returns the first focusable element in `container`. 4497 * 4498 * @memberof tabbable 4499 * 4500 * @param {Element} container 4501 * 4502 * @returns {Element|null} 4503 */ 4504 4505 function getFirstFocusableIn(container) { 4506 var allFocusable = getAllFocusableIn(container); 4507 return allFocusable.length ? allFocusable[0] : null; 4508 } 4509 /** 4510 * Returns all the tabbable elements in `container`, including the container 4511 * itself. 4512 * 4513 * @memberof tabbable 4514 * 4515 * @param {Element} container 4516 * @param fallbackToFocusable If `true`, it'll return focusable elements if there are no tabbable ones. 4517 * 4518 * @returns {Element[]} 4519 */ 4520 4521 function getAllTabbableIn(container, fallbackToFocusable) { 4522 var allFocusable = Array.from(container.querySelectorAll(selector)); 4523 var allTabbable = allFocusable.filter(isTabbable); 4524 4525 if (isTabbable(container)) { 4526 allTabbable.unshift(container); 4527 } 4528 4529 if (!allTabbable.length && fallbackToFocusable) { 4530 return allFocusable; 4531 } 4532 4533 return allTabbable; 4534 } 4535 /** 4536 * Returns the first tabbable element in `container`, including the container 4537 * itself if it's tabbable. 4538 * 4539 * @memberof tabbable 4540 * 4541 * @param {Element} container 4542 * @param fallbackToFocusable If `true`, it'll return the first focusable element if there are no tabbable ones. 4543 * 4544 * @returns {Element|null} 4545 */ 4546 4547 function getFirstTabbableIn(container, fallbackToFocusable) { 4548 var _getAllTabbableIn = getAllTabbableIn(container, fallbackToFocusable), 4549 first = _getAllTabbableIn[0]; 4550 4551 return first || null; 4552 } 4553 /** 4554 * Returns the last tabbable element in `container`, including the container 4555 * itself if it's tabbable. 4556 * 4557 * @memberof tabbable 4558 * 4559 * @param {Element} container 4560 * @param fallbackToFocusable If `true`, it'll return the last focusable element if there are no tabbable ones. 4561 * 4562 * @returns {Element|null} 4563 */ 4564 4565 function getLastTabbableIn(container, fallbackToFocusable) { 4566 var allTabbable = getAllTabbableIn(container, fallbackToFocusable); 4567 return allTabbable[allTabbable.length - 1] || null; 4568 } 4569 /** 4570 * Returns the next tabbable element in `container`. 4571 * 4572 * @memberof tabbable 4573 * 4574 * @param {Element} container 4575 * @param fallbackToFocusable If `true`, it'll return the next focusable element if there are no tabbable ones. 4576 * 4577 * @returns {Element|null} 4578 */ 4579 4580 function getNextTabbableIn(container, fallbackToFocusable) { 4581 var activeElement = Object(getActiveElement["a" /* getActiveElement */])(container); 4582 var allFocusable = getAllFocusableIn(container); 4583 var index = allFocusable.indexOf(activeElement); 4584 var slice = allFocusable.slice(index + 1); 4585 return slice.find(isTabbable) || allFocusable.find(isTabbable) || (fallbackToFocusable ? slice[0] : null); 4586 } 4587 /** 4588 * Returns the previous tabbable element in `container`. 4589 * 4590 * @memberof tabbable 4591 * 4592 * @param {Element} container 4593 * @param fallbackToFocusable If `true`, it'll return the previous focusable element if there are no tabbable ones. 4594 * 4595 * @returns {Element|null} 4596 */ 4597 4598 function getPreviousTabbableIn(container, fallbackToFocusable) { 4599 var activeElement = Object(getActiveElement["a" /* getActiveElement */])(container); 4600 var allFocusable = getAllFocusableIn(container).reverse(); 4601 var index = allFocusable.indexOf(activeElement); 4602 var slice = allFocusable.slice(index + 1); 4603 return slice.find(isTabbable) || allFocusable.find(isTabbable) || (fallbackToFocusable ? slice[0] : null); 4604 } 4605 /** 4606 * Returns the closest focusable element. 4607 * 4608 * @memberof tabbable 4609 * 4610 * @param {Element} container 4611 * 4612 * @returns {Element|null} 4613 */ 4614 4615 function getClosestFocusable(element) { 4616 while (element && !isFocusable(element)) { 4617 element = closest(element, selector); 4618 } 4619 4620 return element; 4621 } 4622 4623 function defaultIsActive(element) { 4624 return Object(getActiveElement["a" /* getActiveElement */])(element) === element; 4625 } 4626 4627 /** 4628 * Ensures `element` will receive focus if it's not already. 4629 * 4630 * @memberof tabbable 4631 * 4632 * @example 4633 * import { ensureFocus } from "reakit-utils"; 4634 * 4635 * ensureFocus(document.activeElement); // does nothing 4636 * 4637 * const element = document.querySelector("input"); 4638 * 4639 * ensureFocus(element); // focuses element 4640 * ensureFocus(element, { preventScroll: true }); // focuses element preventing scroll jump 4641 * 4642 * function isActive(el) { 4643 * return el.dataset.active === "true"; 4644 * } 4645 * 4646 * ensureFocus(document.querySelector("[data-active='true']"), { isActive }); // does nothing 4647 * 4648 * @returns {number} `requestAnimationFrame` call ID so it can be passed to `cancelAnimationFrame` if needed. 4649 */ 4650 function ensureFocus(element, _temp) { 4651 var _ref = _temp === void 0 ? {} : _temp, 4652 _ref$isActive = _ref.isActive, 4653 isActive = _ref$isActive === void 0 ? defaultIsActive : _ref$isActive, 4654 preventScroll = _ref.preventScroll; 4655 4656 if (isActive(element)) return -1; 4657 element.focus({ 4658 preventScroll: preventScroll 4659 }); 4660 if (isActive(element)) return -1; 4661 return requestAnimationFrame(function () { 4662 element.focus({ 4663 preventScroll: preventScroll 4664 }); 4665 }); 4666 } 4667 4668 4669 4670 4671 /***/ }), 4672 /* 73 */ 4673 /***/ (function(module, __webpack_exports__, __webpack_require__) { 4674 4675 "use strict"; 4676 4677 // EXPORTS 4678 __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ isPortalEvent; }); 4679 4680 // CONCATENATED MODULE: ./node_modules/reakit-utils/es/contains.js 4681 /** 4682 * Similar to `Element.prototype.contains`. 4683 */ 4684 function contains(parent, child) { 4685 return parent === child || parent.contains(child); 4686 } 4687 4688 4689 4690 // CONCATENATED MODULE: ./node_modules/reakit-utils/es/isPortalEvent.js 4691 4692 4693 /** 4694 * Returns `true` if `event` has been fired within a React Portal element. 4695 */ 4696 4697 function isPortalEvent(event) { 4698 return !contains(event.currentTarget, event.target); 4699 } 4700 4701 4702 4703 4704 /***/ }), 4705 /* 74 */ 4706 /***/ (function(module, __webpack_exports__, __webpack_require__) { 4707 4708 "use strict"; 4709 /* unused harmony export Tabbable */ 4710 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useTabbable; }); 4711 /* harmony import */ var _rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15); 4712 /* harmony import */ var reakit_system_createComponent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(51); 4713 /* harmony import */ var reakit_system_createHook__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(50); 4714 /* harmony import */ var _Box_Box_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(67); 4715 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(13); 4716 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_4__); 4717 /* harmony import */ var reakit_utils_useForkRef__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(63); 4718 /* harmony import */ var reakit_utils_isButton__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(71); 4719 /* harmony import */ var reakit_warning__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(81); 4720 /* harmony import */ var reakit_utils_useLiveRef__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(48); 4721 /* harmony import */ var reakit_utils_useIsomorphicEffect__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(59); 4722 /* harmony import */ var reakit_utils_hasFocusWithin__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(70); 4723 /* harmony import */ var reakit_utils_isPortalEvent__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(73); 4724 /* harmony import */ var reakit_utils_getActiveElement__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(57); 4725 /* harmony import */ var reakit_utils_tabbable__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(72); 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 function isUA(string) { 4743 if (typeof window === "undefined") return false; 4744 return window.navigator.userAgent.indexOf(string) !== -1; 4745 } 4746 4747 var isSafariOrFirefoxOnMac = isUA("Mac") && !isUA("Chrome") && (isUA("Safari") || isUA("Firefox")); 4748 4749 function focusIfNeeded(element) { 4750 if (!Object(reakit_utils_hasFocusWithin__WEBPACK_IMPORTED_MODULE_10__[/* hasFocusWithin */ "a"])(element)) { 4751 element.focus(); 4752 } 4753 } // Safari and Firefox on MacOS don't focus on buttons on mouse down like other 4754 // browsers/platforms. Instead, they focus on the closest focusable ancestor 4755 // element, which is ultimately the body element. So we make sure to give focus 4756 // to the tabbable element on mouse down so it works consistently across 4757 // browsers. 4758 // istanbul ignore next 4759 4760 4761 function useFocusOnMouseDown() { 4762 if (!isSafariOrFirefoxOnMac) return undefined; 4763 4764 var _React$useState = Object(react__WEBPACK_IMPORTED_MODULE_4__["useState"])(null), 4765 tabbable = _React$useState[0], 4766 scheduleFocus = _React$useState[1]; 4767 4768 Object(react__WEBPACK_IMPORTED_MODULE_4__["useEffect"])(function () { 4769 if (!tabbable) return; 4770 focusIfNeeded(tabbable); 4771 scheduleFocus(null); 4772 }, [tabbable]); 4773 var onMouseDown = Object(react__WEBPACK_IMPORTED_MODULE_4__["useCallback"])(function (event) { 4774 var element = event.currentTarget; 4775 if (Object(reakit_utils_isPortalEvent__WEBPACK_IMPORTED_MODULE_11__[/* isPortalEvent */ "a"])(event)) return; 4776 if (!Object(reakit_utils_isButton__WEBPACK_IMPORTED_MODULE_6__[/* isButton */ "a"])(element)) return; 4777 var activeElement = Object(reakit_utils_getActiveElement__WEBPACK_IMPORTED_MODULE_12__[/* getActiveElement */ "a"])(element); 4778 if (!activeElement) return; 4779 var activeElementIsBody = activeElement.tagName === "BODY"; 4780 var focusableAncestor = Object(reakit_utils_tabbable__WEBPACK_IMPORTED_MODULE_13__[/* getClosestFocusable */ "b"])(element.parentElement); 4781 4782 if (activeElement === focusableAncestor || activeElementIsBody && !focusableAncestor) { 4783 // When the active element is the focusable ancestor, it'll not emit 4784 // focus/blur events. After all, it's already focused. So we can't 4785 // listen to those events to focus this tabbable element. 4786 // When the active element is body and there's no focusable ancestor, 4787 // we also don't have any other event to listen to since body never 4788 // emits focus/blur events on itself. 4789 // In both of these cases, we have to schedule focus on this tabbable 4790 // element. 4791 scheduleFocus(element); 4792 } else if (focusableAncestor) { 4793 // Clicking (mouse down) on the tabbable element on Safari and Firefox 4794 // on MacOS will fire focus on the focusable ancestor element if 4795 // there's any and if it's not the current active element. So we wait 4796 // for this event to happen before moving focus to this element. 4797 // Instead of moving focus right away, we have to schedule it, 4798 // otherwise it's gonna prevent drag events from happening. 4799 var onFocus = function onFocus() { 4800 return scheduleFocus(element); 4801 }; 4802 4803 focusableAncestor.addEventListener("focusin", onFocus, { 4804 once: true 4805 }); 4806 } else { 4807 // Finally, if there's no focsuable ancestor and there's another 4808 // element with focus, we wait for that element to get blurred before 4809 // focusing this one. 4810 var onBlur = function onBlur() { 4811 return focusIfNeeded(element); 4812 }; 4813 4814 activeElement.addEventListener("blur", onBlur, { 4815 once: true 4816 }); 4817 } 4818 }, []); 4819 return onMouseDown; 4820 } 4821 4822 function isNativeTabbable(element) { 4823 return element.tagName === "BUTTON" || element.tagName === "INPUT" || element.tagName === "SELECT" || element.tagName === "TEXTAREA" || element.tagName === "A" || element.tagName === "AUDIO" || element.tagName === "VIDEO"; 4824 } 4825 4826 var useTabbable = Object(reakit_system_createHook__WEBPACK_IMPORTED_MODULE_2__[/* createHook */ "a"])({ 4827 name: "Tabbable", 4828 compose: _Box_Box_js__WEBPACK_IMPORTED_MODULE_3__[/* useBox */ "a"], 4829 keys: ["disabled", "focusable"], 4830 useOptions: function useOptions(options, _ref) { 4831 var disabled = _ref.disabled; 4832 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({ 4833 disabled: disabled 4834 }, options); 4835 }, 4836 useProps: function useProps(options, _ref2) { 4837 var htmlRef = _ref2.ref, 4838 htmlTabIndex = _ref2.tabIndex, 4839 htmlOnClick = _ref2.onClick, 4840 htmlOnMouseDown = _ref2.onMouseDown, 4841 htmlStyle = _ref2.style, 4842 htmlProps = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* _ */ "a"])(_ref2, ["ref", "tabIndex", "onClick", "onMouseDown", "style"]); 4843 4844 var ref = Object(react__WEBPACK_IMPORTED_MODULE_4__["useRef"])(null); 4845 var onClickRef = Object(reakit_utils_useLiveRef__WEBPACK_IMPORTED_MODULE_8__[/* useLiveRef */ "a"])(htmlOnClick); 4846 var onMouseDownRef = Object(reakit_utils_useLiveRef__WEBPACK_IMPORTED_MODULE_8__[/* useLiveRef */ "a"])(htmlOnMouseDown); 4847 var trulyDisabled = options.disabled && !options.focusable; 4848 4849 var _React$useState2 = Object(react__WEBPACK_IMPORTED_MODULE_4__["useState"])(true), 4850 nativeTabbable = _React$useState2[0], 4851 setNativeTabbable = _React$useState2[1]; 4852 4853 var tabIndex = nativeTabbable ? htmlTabIndex : htmlTabIndex || 0; 4854 var style = options.disabled ? Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({ 4855 pointerEvents: "none" 4856 }, htmlStyle) : htmlStyle; 4857 var focusOnMouseDown = useFocusOnMouseDown(); 4858 Object(reakit_utils_useIsomorphicEffect__WEBPACK_IMPORTED_MODULE_9__[/* useIsomorphicEffect */ "a"])(function () { 4859 var tabbable = ref.current; 4860 4861 if (!tabbable) { 4862 false ? undefined : void 0; 4863 return; 4864 } 4865 4866 if (!isNativeTabbable(tabbable)) { 4867 setNativeTabbable(false); 4868 } 4869 }, []); 4870 var onClick = Object(react__WEBPACK_IMPORTED_MODULE_4__["useCallback"])(function (event) { 4871 var _onClickRef$current; 4872 4873 if (options.disabled) { 4874 event.stopPropagation(); 4875 event.preventDefault(); 4876 return; 4877 } 4878 4879 (_onClickRef$current = onClickRef.current) === null || _onClickRef$current === void 0 ? void 0 : _onClickRef$current.call(onClickRef, event); 4880 }, [options.disabled]); 4881 var onMouseDown = Object(react__WEBPACK_IMPORTED_MODULE_4__["useCallback"])(function (event) { 4882 var _onMouseDownRef$curre; 4883 4884 if (options.disabled) { 4885 event.stopPropagation(); 4886 event.preventDefault(); 4887 return; 4888 } 4889 4890 (_onMouseDownRef$curre = onMouseDownRef.current) === null || _onMouseDownRef$curre === void 0 ? void 0 : _onMouseDownRef$curre.call(onMouseDownRef, event); 4891 if (event.defaultPrevented) return; 4892 focusOnMouseDown === null || focusOnMouseDown === void 0 ? void 0 : focusOnMouseDown(event); 4893 }, [options.disabled, focusOnMouseDown]); 4894 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({ 4895 ref: Object(reakit_utils_useForkRef__WEBPACK_IMPORTED_MODULE_5__[/* useForkRef */ "a"])(ref, htmlRef), 4896 style: style, 4897 tabIndex: !trulyDisabled ? tabIndex : undefined, 4898 disabled: trulyDisabled && nativeTabbable ? true : undefined, 4899 "aria-disabled": options.disabled ? true : undefined, 4900 onClick: onClick, 4901 onMouseDown: onMouseDown 4902 }, htmlProps); 4903 } 4904 }); 4905 var Tabbable = Object(reakit_system_createComponent__WEBPACK_IMPORTED_MODULE_1__[/* createComponent */ "a"])({ 4906 as: "div", 4907 useHook: useTabbable 4908 }); 4909 4910 4911 4912 4913 /***/ }), 4914 /* 75 */, 4915 /* 76 */ 4916 /***/ (function(module, __webpack_exports__, __webpack_require__) { 4917 4918 "use strict"; 4919 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return SystemContext; }); 4920 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(13); 4921 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 4922 4923 4924 var SystemContext = /*#__PURE__*/Object(react__WEBPACK_IMPORTED_MODULE_0__["createContext"])({}); 4925 4926 4927 4928 4929 /***/ }), 4930 /* 77 */, 4931 /* 78 */, 4932 /* 79 */ 4933 /***/ (function(module, __webpack_exports__, __webpack_require__) { 4934 4935 "use strict"; 4936 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useCreateElement; }); 4937 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(13); 4938 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 4939 /* harmony import */ var _SystemContext_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(76); 4940 /* harmony import */ var _rollupPluginBabelHelpers_0c84a174_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(55); 4941 4942 4943 4944 4945 function isRenderProp(children) { 4946 return typeof children === "function"; 4947 } 4948 4949 /** 4950 * Custom hook that will call `children` if it's a function. If 4951 * `useCreateElement` has been passed to the context, it'll be used instead. 4952 * 4953 * @example 4954 * import React from "react"; 4955 * import { SystemProvider, useCreateElement } from "reakit-system"; 4956 * 4957 * const system = { 4958 * useCreateElement(type, props, children = props.children) { 4959 * // very similar to what `useCreateElement` does already 4960 * if (typeof children === "function") { 4961 * const { children: _, ...rest } = props; 4962 * return children(rest); 4963 * } 4964 * return React.createElement(type, props, children); 4965 * }, 4966 * }; 4967 * 4968 * function Component(props) { 4969 * return useCreateElement("div", props); 4970 * } 4971 * 4972 * function App() { 4973 * return ( 4974 * <SystemProvider unstable_system={system}> 4975 * <Component url="url">{({ url }) => <a href={url}>link</a>}</Component> 4976 * </SystemProvider> 4977 * ); 4978 * } 4979 */ 4980 4981 var useCreateElement = function useCreateElement(type, props, children) { 4982 if (children === void 0) { 4983 children = props.children; 4984 } 4985 4986 var context = Object(react__WEBPACK_IMPORTED_MODULE_0__["useContext"])(_SystemContext_js__WEBPACK_IMPORTED_MODULE_1__[/* SystemContext */ "a"]); 4987 4988 if (context.useCreateElement) { 4989 return context.useCreateElement(type, props, children); 4990 } 4991 4992 if (typeof type === "string" && isRenderProp(children)) { 4993 var _ = props.children, 4994 rest = Object(_rollupPluginBabelHelpers_0c84a174_js__WEBPACK_IMPORTED_MODULE_2__[/* a */ "b"])(props, ["children"]); 4995 4996 return children(rest); 4997 } 4998 4999 return /*#__PURE__*/Object(react__WEBPACK_IMPORTED_MODULE_0__["createElement"])(type, props, children); 5000 }; 5001 5002 5003 5004 5005 /***/ }), 5006 /* 80 */ 5007 /***/ (function(module, __webpack_exports__, __webpack_require__) { 5008 5009 "use strict"; 5010 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Provider; }); 5011 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return useBlockEditContext; }); 5012 /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); 5013 /* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_0__); 5014 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(0); 5015 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__); 5016 /** 5017 * External dependencies 5018 */ 5019 5020 /** 5021 * WordPress dependencies 5022 */ 5023 5024 5025 var Context = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createContext"])({ 5026 name: '', 5027 isSelected: false, 5028 focusedElement: null, 5029 setFocusedElement: lodash__WEBPACK_IMPORTED_MODULE_0__["noop"], 5030 clientId: null 5031 }); 5032 var Provider = Context.Provider; 5033 5034 /** 5035 * A hook that returns the block edit context. 5036 * 5037 * @return {Object} Block edit context 5038 */ 5039 5040 function useBlockEditContext() { 5041 return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["useContext"])(Context); 5042 } 5043 5044 5045 /***/ }), 5046 /* 81 */ 5047 /***/ (function(module, __webpack_exports__, __webpack_require__) { 5048 5049 "use strict"; 5050 5051 // UNUSED EXPORTS: warning, useWarning 5052 5053 // EXTERNAL MODULE: ./node_modules/reakit-warning/es/warning.js 5054 var warning = __webpack_require__(109); 5055 5056 // EXTERNAL MODULE: external {"this":"React"} 5057 var external_this_React_ = __webpack_require__(13); 5058 5059 // CONCATENATED MODULE: ./node_modules/reakit-utils/es/isObject.js 5060 /** 5061 * Checks whether `arg` is an object or not. 5062 * 5063 * @returns {boolean} 5064 */ 5065 function isObject(arg) { 5066 return typeof arg === "object" && arg != null; 5067 } 5068 5069 5070 5071 // CONCATENATED MODULE: ./node_modules/reakit-warning/es/useWarning.js 5072 5073 5074 5075 5076 5077 function isRefObject(ref) { 5078 return isObject(ref) && "current" in ref; 5079 } 5080 /** 5081 * Logs `messages` to the console using `console.warn` based on a `condition`. 5082 * This should be used inside components. 5083 */ 5084 5085 5086 function useWarning(condition) { 5087 for (var _len = arguments.length, messages = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 5088 messages[_key - 1] = arguments[_key]; 5089 } 5090 5091 if (false) {} 5092 } 5093 5094 5095 5096 // CONCATENATED MODULE: ./node_modules/reakit-warning/es/index.js 5097 5098 5099 5100 5101 5102 5103 5104 /***/ }), 5105 /* 82 */ 5106 /***/ (function(module, __webpack_exports__, __webpack_require__) { 5107 5108 "use strict"; 5109 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return createOnKeyDown; }); 5110 /** 5111 * Returns an `onKeyDown` handler to be passed to a component. 5112 * 5113 * @param options 5114 */ 5115 function createOnKeyDown(_temp) { 5116 var _ref = _temp === void 0 ? {} : _temp, 5117 keyMap = _ref.keyMap, 5118 onKey = _ref.onKey, 5119 stopPropagation = _ref.stopPropagation, 5120 onKeyDown = _ref.onKeyDown, 5121 _ref$shouldKeyDown = _ref.shouldKeyDown, 5122 shouldKeyDown = _ref$shouldKeyDown === void 0 ? function () { 5123 return true; 5124 } : _ref$shouldKeyDown, 5125 _ref$preventDefault = _ref.preventDefault, 5126 preventDefault = _ref$preventDefault === void 0 ? true : _ref$preventDefault; 5127 5128 return function (event) { 5129 if (!keyMap) return; 5130 var finalKeyMap = typeof keyMap === "function" ? keyMap(event) : keyMap; 5131 var shouldPreventDefault = typeof preventDefault === "function" ? preventDefault(event) : preventDefault; 5132 var shouldStopPropagation = typeof stopPropagation === "function" ? stopPropagation(event) : stopPropagation; 5133 5134 if (event.key in finalKeyMap) { 5135 var action = finalKeyMap[event.key]; 5136 5137 if (typeof action === "function" && shouldKeyDown(event)) { 5138 if (shouldPreventDefault) event.preventDefault(); 5139 if (shouldStopPropagation) event.stopPropagation(); 5140 if (onKey) onKey(event); 5141 action(event); // Prevent onKeyDown from being called twice for the same keys 5142 5143 return; 5144 } 5145 } 5146 5147 if (onKeyDown && "current" in onKeyDown) { 5148 var _onKeyDown$current; 5149 5150 (_onKeyDown$current = onKeyDown.current) === null || _onKeyDown$current === void 0 ? void 0 : _onKeyDown$current.call(onKeyDown, event); 5151 } else { 5152 onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event); 5153 } 5154 }; 5155 } 5156 5157 5158 5159 5160 /***/ }), 5161 /* 83 */, 5162 /* 84 */, 5163 /* 85 */, 5164 /* 86 */, 5165 /* 87 */, 5166 /* 88 */ 5167 /***/ (function(module, __webpack_exports__, __webpack_require__) { 5168 5169 "use strict"; 5170 /* unused harmony export Clickable */ 5171 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useClickable; }); 5172 /* harmony import */ var _rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15); 5173 /* harmony import */ var reakit_system_createComponent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(51); 5174 /* harmony import */ var reakit_system_createHook__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(50); 5175 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(13); 5176 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__); 5177 /* harmony import */ var reakit_utils_isButton__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(71); 5178 /* harmony import */ var reakit_warning__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(81); 5179 /* harmony import */ var reakit_utils_useLiveRef__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(48); 5180 /* harmony import */ var reakit_utils_isSelfTarget__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(54); 5181 /* harmony import */ var _Tabbable_Tabbable_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(74); 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 function isNativeClick(event) { 5201 var element = event.currentTarget; 5202 if (!event.isTrusted) return false; // istanbul ignore next: can't test trusted events yet 5203 5204 return Object(reakit_utils_isButton__WEBPACK_IMPORTED_MODULE_4__[/* isButton */ "a"])(element) || element.tagName === "INPUT" || element.tagName === "TEXTAREA" || element.tagName === "A" || element.tagName === "SELECT"; 5205 } 5206 5207 var useClickable = Object(reakit_system_createHook__WEBPACK_IMPORTED_MODULE_2__[/* createHook */ "a"])({ 5208 name: "Clickable", 5209 compose: _Tabbable_Tabbable_js__WEBPACK_IMPORTED_MODULE_8__[/* useTabbable */ "a"], 5210 keys: ["unstable_clickOnEnter", "unstable_clickOnSpace"], 5211 useOptions: function useOptions(_ref) { 5212 var _ref$unstable_clickOn = _ref.unstable_clickOnEnter, 5213 unstable_clickOnEnter = _ref$unstable_clickOn === void 0 ? true : _ref$unstable_clickOn, 5214 _ref$unstable_clickOn2 = _ref.unstable_clickOnSpace, 5215 unstable_clickOnSpace = _ref$unstable_clickOn2 === void 0 ? true : _ref$unstable_clickOn2, 5216 options = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* _ */ "a"])(_ref, ["unstable_clickOnEnter", "unstable_clickOnSpace"]); 5217 5218 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({ 5219 unstable_clickOnEnter: unstable_clickOnEnter, 5220 unstable_clickOnSpace: unstable_clickOnSpace 5221 }, options); 5222 }, 5223 useProps: function useProps(options, _ref2) { 5224 var htmlOnKeyDown = _ref2.onKeyDown, 5225 htmlOnKeyUp = _ref2.onKeyUp, 5226 htmlProps = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* _ */ "a"])(_ref2, ["onKeyDown", "onKeyUp"]); 5227 5228 var _React$useState = Object(react__WEBPACK_IMPORTED_MODULE_3__["useState"])(false), 5229 active = _React$useState[0], 5230 setActive = _React$useState[1]; 5231 5232 var onKeyDownRef = Object(reakit_utils_useLiveRef__WEBPACK_IMPORTED_MODULE_6__[/* useLiveRef */ "a"])(htmlOnKeyDown); 5233 var onKeyUpRef = Object(reakit_utils_useLiveRef__WEBPACK_IMPORTED_MODULE_6__[/* useLiveRef */ "a"])(htmlOnKeyUp); 5234 var onKeyDown = Object(react__WEBPACK_IMPORTED_MODULE_3__["useCallback"])(function (event) { 5235 var _onKeyDownRef$current; 5236 5237 (_onKeyDownRef$current = onKeyDownRef.current) === null || _onKeyDownRef$current === void 0 ? void 0 : _onKeyDownRef$current.call(onKeyDownRef, event); 5238 if (event.defaultPrevented) return; 5239 if (options.disabled) return; 5240 if (event.metaKey) return; 5241 if (!Object(reakit_utils_isSelfTarget__WEBPACK_IMPORTED_MODULE_7__[/* isSelfTarget */ "a"])(event)) return; 5242 var isEnter = options.unstable_clickOnEnter && event.key === "Enter"; 5243 var isSpace = options.unstable_clickOnSpace && event.key === " "; 5244 5245 if (isEnter || isSpace) { 5246 if (isNativeClick(event)) return; 5247 event.preventDefault(); 5248 5249 if (isEnter) { 5250 event.currentTarget.click(); 5251 } else if (isSpace) { 5252 setActive(true); 5253 } 5254 } 5255 }, [options.disabled, options.unstable_clickOnEnter, options.unstable_clickOnSpace]); 5256 var onKeyUp = Object(react__WEBPACK_IMPORTED_MODULE_3__["useCallback"])(function (event) { 5257 var _onKeyUpRef$current; 5258 5259 (_onKeyUpRef$current = onKeyUpRef.current) === null || _onKeyUpRef$current === void 0 ? void 0 : _onKeyUpRef$current.call(onKeyUpRef, event); 5260 if (event.defaultPrevented) return; 5261 if (options.disabled) return; 5262 if (event.metaKey) return; 5263 var isSpace = options.unstable_clickOnSpace && event.key === " "; 5264 5265 if (active && isSpace) { 5266 setActive(false); 5267 event.currentTarget.click(); 5268 } 5269 }, [options.disabled, options.unstable_clickOnSpace, active]); 5270 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({ 5271 "data-active": active || undefined, 5272 onKeyDown: onKeyDown, 5273 onKeyUp: onKeyUp 5274 }, htmlProps); 5275 } 5276 }); 5277 var Clickable = Object(reakit_system_createComponent__WEBPACK_IMPORTED_MODULE_1__[/* createComponent */ "a"])({ 5278 as: "button", 5279 memo: true, 5280 useHook: useClickable 5281 }); 5282 5283 5284 5285 5286 /***/ }), 5287 /* 89 */, 5288 /* 90 */ 5289 /***/ (function(module, exports) { 5290 5291 (function() { module.exports = this["wp"]["warning"]; }()); 5292 5293 /***/ }), 5294 /* 91 */, 5295 /* 92 */ 5296 /***/ (function(module, exports) { 5297 5298 (function() { module.exports = this["wp"]["notices"]; }()); 5299 5300 /***/ }), 5301 /* 93 */, 5302 /* 94 */, 5303 /* 95 */, 5304 /* 96 */ 5305 /***/ (function(module, __webpack_exports__, __webpack_require__) { 5306 5307 "use strict"; 5308 /* unused harmony export unstable_Id */ 5309 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return unstable_useId; }); 5310 /* harmony import */ var _rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15); 5311 /* harmony import */ var reakit_system_createComponent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(51); 5312 /* harmony import */ var reakit_system_createHook__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(50); 5313 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(13); 5314 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__); 5315 /* harmony import */ var _IdProvider_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(68); 5316 /* harmony import */ var _IdState_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(65); 5317 5318 5319 5320 5321 5322 5323 5324 5325 var unstable_useId = Object(reakit_system_createHook__WEBPACK_IMPORTED_MODULE_2__[/* createHook */ "a"])({ 5326 useState: _IdState_js__WEBPACK_IMPORTED_MODULE_5__[/* unstable_useIdState */ "a"], 5327 keys: ["id"], 5328 useOptions: function useOptions(options, htmlProps) { 5329 var generateId = Object(react__WEBPACK_IMPORTED_MODULE_3__["useContext"])(_IdProvider_js__WEBPACK_IMPORTED_MODULE_4__[/* unstable_IdContext */ "a"]); 5330 5331 var _React$useState = Object(react__WEBPACK_IMPORTED_MODULE_3__["useState"])(function () { 5332 // This comes from useIdState 5333 if (options.unstable_idCountRef) { 5334 options.unstable_idCountRef.current += 1; 5335 return "-" + options.unstable_idCountRef.current; 5336 } // If there's no useIdState, we check if `baseId` was passed (as a prop, 5337 // not from useIdState). 5338 5339 5340 if (options.baseId) { 5341 return "-" + generateId(""); 5342 } 5343 5344 return ""; 5345 }), 5346 suffix = _React$useState[0]; // `baseId` will be the prop passed directly as a prop or via useIdState. 5347 // If there's neither, then it'll fallback to Context's generateId. 5348 // This generateId can result in a sequential ID (if there's a Provider) 5349 // or a random string (without Provider). 5350 5351 5352 var baseId = Object(react__WEBPACK_IMPORTED_MODULE_3__["useMemo"])(function () { 5353 return options.baseId || generateId(); 5354 }, [options.baseId, generateId]); 5355 var id = htmlProps.id || options.id || "" + baseId + suffix; 5356 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, options), {}, { 5357 id: id 5358 }); 5359 }, 5360 useProps: function useProps(options, htmlProps) { 5361 return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({ 5362 id: options.id 5363 }, htmlProps); 5364 } 5365 }); 5366 var unstable_Id = Object(reakit_system_createComponent__WEBPACK_IMPORTED_MODULE_1__[/* createComponent */ "a"])({ 5367 as: "div", 5368 useHook: unstable_useId 5369 }); 5370 5371 5372 5373 5374 /***/ }), 5375 /* 97 */ 5376 /***/ (function(module, __webpack_exports__, __webpack_require__) { 5377 5378 "use strict"; 5379 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return fireEvent; }); 5380 /* harmony import */ var _createEvent_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(126); 5381 5382 5383 5384 /** 5385 * Creates and dispatches `Event` in a way that also works on IE 11. 5386 * 5387 * @example 5388 * import { fireEvent } from "reakit-utils"; 5389 * 5390 * fireEvent(document.getElementById("id"), "blur", { 5391 * bubbles: true, 5392 * cancelable: true, 5393 * }); 5394 */ 5395 5396 function fireEvent(element, type, eventInit) { 5397 return element.dispatchEvent(Object(_createEvent_js__WEBPACK_IMPORTED_MODULE_0__[/* createEvent */ "a"])(element, type, eventInit)); 5398 } 5399 5400 5401 5402 5403 /***/ }), 5404 /* 98 */ 5405 /***/ (function(module, __webpack_exports__, __webpack_require__) { 5406 5407 "use strict"; 5408 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return isTextField; }); 5409 /** 5410 * Check whether the given element is a text field, where text field is defined 5411 * by the ability to select within the input, or that it is contenteditable. 5412 */ 5413 function isTextField(element) { 5414 try { 5415 var isTextInput = element instanceof HTMLInputElement && element.selectionStart !== null; 5416 var isTextArea = element.tagName === "TEXTAREA"; 5417 var isContentEditable = element.contentEditable === "true"; 5418 return isTextInput || isTextArea || isContentEditable || false; 5419 } catch (error) { 5420 // Safari throws an exception when trying to get `selectionStart` 5421 // on non-text <input> elements (which, understandably, don't 5422 // have the text selection API). We catch this via a try/catch 5423 // block, as opposed to a more explicit check of the element's 5424 // input types, because of Safari's non-standard behavior. This 5425 // also means we don't have to worry about the list of input 5426 // types that support `selectionStart` changing as the HTML spec 5427 // evolves over time. 5428 return false; 5429 } 5430 } 5431 5432 5433 5434 5435 /***/ }), 5436 /* 99 */ 5437 /***/ (function(module, __webpack_exports__, __webpack_require__) { 5438 5439 "use strict"; 5440 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return setTextFieldValue; }); 5441 function setTextFieldValue(element, value) { 5442 element.value = value; 5443 } 5444 5445 5446 5447 5448 /***/ }), 5449 /* 100 */ 5450 /***/ (function(module, exports, __webpack_require__) { 5451 5452 "use strict"; 5453 5454 exports.__esModule = true; 5455 var TextareaAutosize_1 = __webpack_require__(180); 5456 exports["default"] = TextareaAutosize_1["default"]; 5457 5458 5459 /***/ }), 5460 /* 101 */ 5461 /***/ (function(module, exports) { 5462 5463 (function() { module.exports = this["wp"]["viewport"]; }()); 5464 5465 /***/ }), 5466 /* 102 */, 5467 /* 103 */ 5468 /***/ (function(module, exports) { 5469 5470 // shim for using process in browser 5471 var process = module.exports = {}; 5472 5473 // cached from whatever global is present so that test runners that stub it 5474 // don't break things. But we need to wrap it in a try catch in case it is 5475 // wrapped in strict mode code which doesn't define any globals. It's inside a 5476 // function because try/catches deoptimize in certain engines. 5477 5478 var cachedSetTimeout; 5479 var cachedClearTimeout; 5480 5481 function defaultSetTimout() { 5482 throw new Error('setTimeout has not been defined'); 5483 } 5484 function defaultClearTimeout () { 5485 throw new Error('clearTimeout has not been defined'); 5486 } 5487 (function () { 5488 try { 5489 if (typeof setTimeout === 'function') { 5490 cachedSetTimeout = setTimeout; 5491 } else { 5492 cachedSetTimeout = defaultSetTimout; 5493 } 5494 } catch (e) { 5495 cachedSetTimeout = defaultSetTimout; 5496 } 5497 try { 5498 if (typeof clearTimeout === 'function') { 5499 cachedClearTimeout = clearTimeout; 5500 } else { 5501 cachedClearTimeout = defaultClearTimeout; 5502 } 5503 } catch (e) { 5504 cachedClearTimeout = defaultClearTimeout; 5505 } 5506 } ()) 5507 function runTimeout(fun) { 5508 if (cachedSetTimeout === setTimeout) { 5509 //normal enviroments in sane situations 5510 return setTimeout(fun, 0); 5511 } 5512 // if setTimeout wasn't available but was latter defined 5513 if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { 5514 cachedSetTimeout = setTimeout; 5515 return setTimeout(fun, 0); 5516 } 5517 try { 5518 // when when somebody has screwed with setTimeout but no I.E. maddness 5519 return cachedSetTimeout(fun, 0); 5520 } catch(e){ 5521 try { 5522 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally 5523 return cachedSetTimeout.call(null, fun, 0); 5524 } catch(e){ 5525 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error 5526 return cachedSetTimeout.call(this, fun, 0); 5527 } 5528 } 5529 5530 5531 } 5532 function runClearTimeout(marker) { 5533 if (cachedClearTimeout === clearTimeout) { 5534 //normal enviroments in sane situations 5535 return clearTimeout(marker); 5536 } 5537 // if clearTimeout wasn't available but was latter defined 5538 if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { 5539 cachedClearTimeout = clearTimeout; 5540 return clearTimeout(marker); 5541 } 5542 try { 5543 // when when somebody has screwed with setTimeout but no I.E. maddness 5544 return cachedClearTimeout(marker); 5545 } catch (e){ 5546 try { 5547 // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally 5548 return cachedClearTimeout.call(null, marker); 5549 } catch (e){ 5550 // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. 5551 // Some versions of I.E. have different rules for clearTimeout vs setTimeout 5552 return cachedClearTimeout.call(this, marker); 5553 } 5554 } 5555 5556 5557 5558 } 5559 var queue = []; 5560 var draining = false; 5561 var currentQueue; 5562 var queueIndex = -1; 5563 5564 function cleanUpNextTick() { 5565 if (!draining || !currentQueue) { 5566 return; 5567 } 5568 draining = false; 5569 if (currentQueue.length) { 5570 queue = currentQueue.concat(queue); 5571 } else { 5572 queueIndex = -1; 5573 } 5574 if (queue.length) { 5575 drainQueue(); 5576 } 5577 } 5578 5579 function drainQueue() { 5580 if (draining) { 5581 return; 5582 } 5583 var timeout = runTimeout(cleanUpNextTick); 5584 draining = true; 5585 5586 var len = queue.length; 5587 while(len) { 5588 currentQueue = queue; 5589 queue = []; 5590 while (++queueIndex < len) { 5591 if (currentQueue) { 5592 currentQueue[queueIndex].run(); 5593 } 5594 } 5595 queueIndex = -1; 5596 len = queue.length; 5597 } 5598 currentQueue = null; 5599 draining = false; 5600 runClearTimeout(timeout); 5601 } 5602 5603 process.nextTick = function (fun) { 5604 var args = new Array(arguments.length - 1); 5605 if (arguments.length > 1) { 5606 for (var i = 1; i < arguments.length; i++) { 5607 args[i - 1] = arguments[i]; 5608 } 5609 } 5610 queue.push(new Item(fun, args)); 5611 if (queue.length === 1 && !draining) { 5612 runTimeout(drainQueue); 5613 } 5614 }; 5615 5616 // v8 likes predictible objects 5617 function Item(fun, array) { 5618 this.fun = fun; 5619 this.array = array; 5620 } 5621 Item.prototype.run = function () { 5622 this.fun.apply(null, this.array); 5623 }; 5624 process.title = 'browser'; 5625 process.browser = true; 5626 process.env = {}; 5627 process.argv = []; 5628 process.version = ''; // empty string to avoid regexp issues 5629 process.versions = {}; 5630 5631 function noop() {} 5632 5633 process.on = noop; 5634 process.addListener = noop; 5635 process.once = noop; 5636 process.off = noop; 5637 process.removeListener = noop; 5638 process.removeAllListeners = noop; 5639 process.emit = noop; 5640 process.prependListener = noop; 5641 process.prependOnceListener = noop; 5642 5643 process.listeners = function (name) { return [] } 5644 5645 process.binding = function (name) { 5646 throw new Error('process.binding is not supported'); 5647 }; 5648 5649 process.cwd = function () { return '/' }; 5650 process.chdir = function (dir) { 5651 throw new Error('process.chdir is not supported'); 5652 }; 5653 process.umask = function() { return 0; }; 5654 5655 5656 /***/ }), 5657 /* 104 */, 5658 /* 105 */ 5659 /***/ (function(module, __webpack_exports__, __webpack_require__) { 5660 5661 "use strict"; 5662 5663 // EXPORTS 5664 __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ fireKeyboardEvent; }); 5665 5666 // EXTERNAL MODULE: ./node_modules/reakit-utils/es/getDocument.js 5667 var getDocument = __webpack_require__(49); 5668 5669 // CONCATENATED MODULE: ./node_modules/reakit-utils/es/getDefaultView.js 5670 5671 5672 /** 5673 * Returns `element.ownerDocument.defaultView || window`. 5674 */ 5675 5676 function getDefaultView(element) { 5677 return Object(getDocument["a" /* getDocument */])(element).defaultView || window; 5678 } 5679 5680 5681 5682 // CONCATENATED MODULE: ./node_modules/reakit-utils/es/createKeyboardEvent.js 5683 5684 5685 5686 /** 5687 * Creates a `KeyboardEvent` in a way that also works on IE 11. 5688 * 5689 * @example 5690 * import { createKeyboardEvent } from "reakit-utils"; 5691 * 5692 * const el = document.getElementById("id"); 5693 * el.dispatchEvent(createKeyboardEvent(el, "keydown", { key: "ArrowDown" })); 5694 */ 5695 5696 function createKeyboardEvent(element, type, eventInit) { 5697 if (eventInit === void 0) { 5698 eventInit = {}; 5699 } 5700 5701 if (typeof KeyboardEvent === "function") { 5702 return new KeyboardEvent(type, eventInit); 5703 } // IE 11 doesn't support Event constructors 5704 5705 5706 var event = Object(getDocument["a" /* getDocument */])(element).createEvent("KeyboardEvent"); 5707 event.initKeyboardEvent(type, eventInit.bubbles, eventInit.cancelable, getDefaultView(element), eventInit.key, eventInit.location, eventInit.ctrlKey, eventInit.altKey, eventInit.shiftKey, eventInit.metaKey); 5708 return event; 5709 } 5710 5711 5712 5713 // CONCATENATED MODULE: ./node_modules/reakit-utils/es/fireKeyboardEvent.js 5714 5715 5716 5717 5718 /** 5719 * Creates and dispatches `KeyboardEvent` in a way that also works on IE 11. 5720 * 5721 * @example 5722 * import { fireKeyboardEvent } from "reakit-utils"; 5723 * 5724 * fireKeyboardEvent(document.getElementById("id"), "keydown", { 5725 * key: "ArrowDown", 5726 * shiftKey: true, 5727 * }); 5728 */ 5729 5730 function fireKeyboardEvent(element, type, eventInit) { 5731 return element.dispatchEvent(createKeyboardEvent(element, type, eventInit)); 5732 } 5733 5734 5735 5736 5737 /***/ }), 5738 /* 106 */, 5739 /* 107 */, 5740 /* 108 */, 5741 /* 109 */ 5742 /***/ (function(module, __webpack_exports__, __webpack_require__) { 5743 5744 "use strict"; 5745 /* unused harmony export warning */ 5746 5747 5748 /** 5749 * Logs `messages` to the console using `console.warn` based on a `condition`. 5750 * 5751 * @example 5752 * import { warning } from "reakit-warning"; 5753 * 5754 * warning(true, "a", "b"); // console.warn("a", "\n", "b") 5755 * warning(false, "a", "b"); // does nothing 5756 */ 5757 5758 function warning(condition) { 5759 if (false) { var warns, _len, messages, _key, _console; } 5760 } 5761 5762 5763 5764 5765 /***/ }), 5766 /* 110 */ 5767 /***/ (function(module, exports) { 5768 5769 (function() { module.exports = this["ReactDOM"]; }()); 5770 5771 /***/ }), 5772 /* 111 */, 5773 /* 112 */, 5774 /* 113 */, 5775 /* 114 */, 5776 /* 115 */ 5777 /***/ (function(module, exports, __webpack_require__) { 5778 5779 "use strict"; 5780 5781 5782 Object.defineProperty(exports, '__esModule', { value: true }); 5783 5784 function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } 5785 5786 var _extends = _interopDefault(__webpack_require__(177)); 5787 var _objectWithoutPropertiesLoose = _interopDefault(__webpack_require__(178)); 5788 var React = __webpack_require__(13); 5789 var React__default = _interopDefault(React); 5790 var _inheritsLoose = _interopDefault(__webpack_require__(158)); 5791 var _assertThisInitialized = _interopDefault(__webpack_require__(179)); 5792 5793 var is = { 5794 arr: Array.isArray, 5795 obj: function obj(a) { 5796 return Object.prototype.toString.call(a) === '[object Object]'; 5797 }, 5798 fun: function fun(a) { 5799 return typeof a === 'function'; 5800 }, 5801 str: function str(a) { 5802 return typeof a === 'string'; 5803 }, 5804 num: function num(a) { 5805 return typeof a === 'number'; 5806 }, 5807 und: function und(a) { 5808 return a === void 0; 5809 }, 5810 nul: function nul(a) { 5811 return a === null; 5812 }, 5813 set: function set(a) { 5814 return a instanceof Set; 5815 }, 5816 map: function map(a) { 5817 return a instanceof Map; 5818 }, 5819 equ: function equ(a, b) { 5820 if (typeof a !== typeof b) return false; 5821 if (is.str(a) || is.num(a)) return a === b; 5822 if (is.obj(a) && is.obj(b) && Object.keys(a).length + Object.keys(b).length === 0) return true; 5823 var i; 5824 5825 for (i in a) { 5826 if (!(i in b)) return false; 5827 } 5828 5829 for (i in b) { 5830 if (a[i] !== b[i]) return false; 5831 } 5832 5833 return is.und(i) ? a === b : true; 5834 } 5835 }; 5836 function merge(target, lowercase) { 5837 if (lowercase === void 0) { 5838 lowercase = true; 5839 } 5840 5841 return function (object) { 5842 return (is.arr(object) ? object : Object.keys(object)).reduce(function (acc, element) { 5843 var key = lowercase ? element[0].toLowerCase() + element.substring(1) : element; 5844 acc[key] = target(key); 5845 return acc; 5846 }, target); 5847 }; 5848 } 5849 function useForceUpdate() { 5850 var _useState = React.useState(false), 5851 f = _useState[1]; 5852 5853 var forceUpdate = React.useCallback(function () { 5854 return f(function (v) { 5855 return !v; 5856 }); 5857 }, []); 5858 return forceUpdate; 5859 } 5860 function withDefault(value, defaultValue) { 5861 return is.und(value) || is.nul(value) ? defaultValue : value; 5862 } 5863 function toArray(a) { 5864 return !is.und(a) ? is.arr(a) ? a : [a] : []; 5865 } 5866 function callProp(obj) { 5867 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 5868 args[_key - 1] = arguments[_key]; 5869 } 5870 5871 return is.fun(obj) ? obj.apply(void 0, args) : obj; 5872 } 5873 5874 function getForwardProps(props) { 5875 var to = props.to, 5876 from = props.from, 5877 config = props.config, 5878 onStart = props.onStart, 5879 onRest = props.onRest, 5880 onFrame = props.onFrame, 5881 children = props.children, 5882 reset = props.reset, 5883 reverse = props.reverse, 5884 force = props.force, 5885 immediate = props.immediate, 5886 delay = props.delay, 5887 attach = props.attach, 5888 destroyed = props.destroyed, 5889 interpolateTo = props.interpolateTo, 5890 ref = props.ref, 5891 lazy = props.lazy, 5892 forward = _objectWithoutPropertiesLoose(props, ["to", "from", "config", "onStart", "onRest", "onFrame", "children", "reset", "reverse", "force", "immediate", "delay", "attach", "destroyed", "interpolateTo", "ref", "lazy"]); 5893 5894 return forward; 5895 } 5896 5897 function interpolateTo(props) { 5898 var forward = getForwardProps(props); 5899 if (is.und(forward)) return _extends({ 5900 to: forward 5901 }, props); 5902 var rest = Object.keys(props).reduce(function (a, k) { 5903 var _extends2; 5904 5905 return !is.und(forward[k]) ? a : _extends({}, a, (_extends2 = {}, _extends2[k] = props[k], _extends2)); 5906 }, {}); 5907 return _extends({ 5908 to: forward 5909 }, rest); 5910 } 5911 function handleRef(ref, forward) { 5912 if (forward) { 5913 // If it's a function, assume it's a ref callback 5914 if (is.fun(forward)) forward(ref);else if (is.obj(forward)) { 5915 forward.current = ref; 5916 } 5917 } 5918 5919 return ref; 5920 } 5921 5922 var Animated = 5923 /*#__PURE__*/ 5924 function () { 5925 function Animated() { 5926 this.payload = void 0; 5927 this.children = []; 5928 } 5929 5930 var _proto = Animated.prototype; 5931 5932 _proto.getAnimatedValue = function getAnimatedValue() { 5933 return this.getValue(); 5934 }; 5935 5936 _proto.getPayload = function getPayload() { 5937 return this.payload || this; 5938 }; 5939 5940 _proto.attach = function attach() {}; 5941 5942 _proto.detach = function detach() {}; 5943 5944 _proto.getChildren = function getChildren() { 5945 return this.children; 5946 }; 5947 5948 _proto.addChild = function addChild(child) { 5949 if (this.children.length === 0) this.attach(); 5950 this.children.push(child); 5951 }; 5952 5953 _proto.removeChild = function removeChild(child) { 5954 var index = this.children.indexOf(child); 5955 this.children.splice(index, 1); 5956 if (this.children.length === 0) this.detach(); 5957 }; 5958 5959 return Animated; 5960 }(); 5961 var AnimatedArray = 5962 /*#__PURE__*/ 5963 function (_Animated) { 5964 _inheritsLoose(AnimatedArray, _Animated); 5965 5966 function AnimatedArray() { 5967 var _this; 5968 5969 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 5970 args[_key] = arguments[_key]; 5971 } 5972 5973 _this = _Animated.call.apply(_Animated, [this].concat(args)) || this; 5974 _this.payload = []; 5975 5976 _this.attach = function () { 5977 return _this.payload.forEach(function (p) { 5978 return p instanceof Animated && p.addChild(_assertThisInitialized(_this)); 5979 }); 5980 }; 5981 5982 _this.detach = function () { 5983 return _this.payload.forEach(function (p) { 5984 return p instanceof Animated && p.removeChild(_assertThisInitialized(_this)); 5985 }); 5986 }; 5987 5988 return _this; 5989 } 5990 5991 return AnimatedArray; 5992 }(Animated); 5993 var AnimatedObject = 5994 /*#__PURE__*/ 5995 function (_Animated2) { 5996 _inheritsLoose(AnimatedObject, _Animated2); 5997 5998 function AnimatedObject() { 5999 var _this2; 6000 6001 for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { 6002 args[_key3] = arguments[_key3]; 6003 } 6004 6005 _this2 = _Animated2.call.apply(_Animated2, [this].concat(args)) || this; 6006 _this2.payload = {}; 6007 6008 _this2.attach = function () { 6009 return Object.values(_this2.payload).forEach(function (s) { 6010 return s instanceof Animated && s.addChild(_assertThisInitialized(_this2)); 6011 }); 6012 }; 6013 6014 _this2.detach = function () { 6015 return Object.values(_this2.payload).forEach(function (s) { 6016 return s instanceof Animated && s.removeChild(_assertThisInitialized(_this2)); 6017 }); 6018 }; 6019 6020 return _this2; 6021 } 6022 6023 var _proto2 = AnimatedObject.prototype; 6024 6025 _proto2.getValue = function getValue(animated) { 6026 if (animated === void 0) { 6027 animated = false; 6028 } 6029 6030 var payload = {}; 6031 6032 for (var _key4 in this.payload) { 6033 var value = this.payload[_key4]; 6034 if (animated && !(value instanceof Animated)) continue; 6035 payload[_key4] = value instanceof Animated ? value[animated ? 'getAnimatedValue' : 'getValue']() : value; 6036 } 6037 6038 return payload; 6039 }; 6040 6041 _proto2.getAnimatedValue = function getAnimatedValue() { 6042 return this.getValue(true); 6043 }; 6044 6045 return AnimatedObject; 6046 }(Animated); 6047 6048 var applyAnimatedValues; 6049 function injectApplyAnimatedValues(fn, transform) { 6050 applyAnimatedValues = { 6051 fn: fn, 6052 transform: transform 6053 }; 6054 } 6055 var colorNames; 6056 function injectColorNames(names) { 6057 colorNames = names; 6058 } 6059 var requestFrame = function requestFrame(cb) { 6060 return typeof window !== 'undefined' ? window.requestAnimationFrame(cb) : -1; 6061 }; 6062 var cancelFrame = function cancelFrame(id) { 6063 typeof window !== 'undefined' && window.cancelAnimationFrame(id); 6064 }; 6065 function injectFrame(raf, caf) { 6066 requestFrame = raf; 6067 cancelFrame = caf; 6068 } 6069 var interpolation; 6070 function injectStringInterpolator(fn) { 6071 interpolation = fn; 6072 } 6073 var now = function now() { 6074 return Date.now(); 6075 }; 6076 function injectNow(nowFn) { 6077 now = nowFn; 6078 } 6079 var defaultElement; 6080 function injectDefaultElement(el) { 6081 defaultElement = el; 6082 } 6083 var animatedApi = function animatedApi(node) { 6084 return node.current; 6085 }; 6086 function injectAnimatedApi(fn) { 6087 animatedApi = fn; 6088 } 6089 var createAnimatedStyle; 6090 function injectCreateAnimatedStyle(factory) { 6091 createAnimatedStyle = factory; 6092 } 6093 var manualFrameloop; 6094 function injectManualFrameloop(callback) { 6095 manualFrameloop = callback; 6096 } 6097 6098 var Globals = /*#__PURE__*/Object.freeze({ 6099 get applyAnimatedValues () { return applyAnimatedValues; }, 6100 injectApplyAnimatedValues: injectApplyAnimatedValues, 6101 get colorNames () { return colorNames; }, 6102 injectColorNames: injectColorNames, 6103 get requestFrame () { return requestFrame; }, 6104 get cancelFrame () { return cancelFrame; }, 6105 injectFrame: injectFrame, 6106 get interpolation () { return interpolation; }, 6107 injectStringInterpolator: injectStringInterpolator, 6108 get now () { return now; }, 6109 injectNow: injectNow, 6110 get defaultElement () { return defaultElement; }, 6111 injectDefaultElement: injectDefaultElement, 6112 get animatedApi () { return animatedApi; }, 6113 injectAnimatedApi: injectAnimatedApi, 6114 get createAnimatedStyle () { return createAnimatedStyle; }, 6115 injectCreateAnimatedStyle: injectCreateAnimatedStyle, 6116 get manualFrameloop () { return manualFrameloop; }, 6117 injectManualFrameloop: injectManualFrameloop 6118 }); 6119 6120 /** 6121 * Wraps the `style` property with `AnimatedStyle`. 6122 */ 6123 6124 var AnimatedProps = 6125 /*#__PURE__*/ 6126 function (_AnimatedObject) { 6127 _inheritsLoose(AnimatedProps, _AnimatedObject); 6128 6129 function AnimatedProps(props, callback) { 6130 var _this; 6131 6132 _this = _AnimatedObject.call(this) || this; 6133 _this.update = void 0; 6134 _this.payload = !props.style ? props : _extends({}, props, { 6135 style: createAnimatedStyle(props.style) 6136 }); 6137 _this.update = callback; 6138 6139 _this.attach(); 6140 6141 return _this; 6142 } 6143 6144 return AnimatedProps; 6145 }(AnimatedObject); 6146 6147 var isFunctionComponent = function isFunctionComponent(val) { 6148 return is.fun(val) && !(val.prototype instanceof React__default.Component); 6149 }; 6150 6151 var createAnimatedComponent = function createAnimatedComponent(Component) { 6152 var AnimatedComponent = React.forwardRef(function (props, ref) { 6153 var forceUpdate = useForceUpdate(); 6154 var mounted = React.useRef(true); 6155 var propsAnimated = React.useRef(null); 6156 var node = React.useRef(null); 6157 var attachProps = React.useCallback(function (props) { 6158 var oldPropsAnimated = propsAnimated.current; 6159 6160 var callback = function callback() { 6161 var didUpdate = false; 6162 6163 if (node.current) { 6164 didUpdate = applyAnimatedValues.fn(node.current, propsAnimated.current.getAnimatedValue()); 6165 } 6166 6167 if (!node.current || didUpdate === false) { 6168 // If no referenced node has been found, or the update target didn't have a 6169 // native-responder, then forceUpdate the animation ... 6170 forceUpdate(); 6171 } 6172 }; 6173 6174 propsAnimated.current = new AnimatedProps(props, callback); 6175 oldPropsAnimated && oldPropsAnimated.detach(); 6176 }, []); 6177 React.useEffect(function () { 6178 return function () { 6179 mounted.current = false; 6180 propsAnimated.current && propsAnimated.current.detach(); 6181 }; 6182 }, []); 6183 React.useImperativeHandle(ref, function () { 6184 return animatedApi(node, mounted, forceUpdate); 6185 }); 6186 attachProps(props); 6187 6188 var _getValue = propsAnimated.current.getValue(), 6189 scrollTop = _getValue.scrollTop, 6190 scrollLeft = _getValue.scrollLeft, 6191 animatedProps = _objectWithoutPropertiesLoose(_getValue, ["scrollTop", "scrollLeft"]); // Functions cannot have refs, see: 6192 // See: https://github.com/react-spring/react-spring/issues/569 6193 6194 6195 var refFn = isFunctionComponent(Component) ? undefined : function (childRef) { 6196 return node.current = handleRef(childRef, ref); 6197 }; 6198 return React__default.createElement(Component, _extends({}, animatedProps, { 6199 ref: refFn 6200 })); 6201 }); 6202 return AnimatedComponent; 6203 }; 6204 6205 var active = false; 6206 var controllers = new Set(); 6207 6208 var update = function update() { 6209 if (!active) return false; 6210 var time = now(); 6211 6212 for (var _iterator = controllers, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { 6213 var _ref; 6214 6215 if (_isArray) { 6216 if (_i >= _iterator.length) break; 6217 _ref = _iterator[_i++]; 6218 } else { 6219 _i = _iterator.next(); 6220 if (_i.done) break; 6221 _ref = _i.value; 6222 } 6223 6224 var controller = _ref; 6225 var isActive = false; 6226 6227 for (var configIdx = 0; configIdx < controller.configs.length; configIdx++) { 6228 var config = controller.configs[configIdx]; 6229 var endOfAnimation = void 0, 6230 lastTime = void 0; 6231 6232 for (var valIdx = 0; valIdx < config.animatedValues.length; valIdx++) { 6233 var animation = config.animatedValues[valIdx]; // If an animation is done, skip, until all of them conclude 6234 6235 if (animation.done) continue; 6236 var from = config.fromValues[valIdx]; 6237 var to = config.toValues[valIdx]; 6238 var position = animation.lastPosition; 6239 var isAnimated = to instanceof Animated; 6240 var velocity = Array.isArray(config.initialVelocity) ? config.initialVelocity[valIdx] : config.initialVelocity; 6241 if (isAnimated) to = to.getValue(); // Conclude animation if it's either immediate, or from-values match end-state 6242 6243 if (config.immediate) { 6244 animation.setValue(to); 6245 animation.done = true; 6246 continue; 6247 } // Break animation when string values are involved 6248 6249 6250 if (typeof from === 'string' || typeof to === 'string') { 6251 animation.setValue(to); 6252 animation.done = true; 6253 continue; 6254 } 6255 6256 if (config.duration !== void 0) { 6257 /** Duration easing */ 6258 position = from + config.easing((time - animation.startTime) / config.duration) * (to - from); 6259 endOfAnimation = time >= animation.startTime + config.duration; 6260 } else if (config.decay) { 6261 /** Decay easing */ 6262 position = from + velocity / (1 - 0.998) * (1 - Math.exp(-(1 - 0.998) * (time - animation.startTime))); 6263 endOfAnimation = Math.abs(animation.lastPosition - position) < 0.1; 6264 if (endOfAnimation) to = position; 6265 } else { 6266 /** Spring easing */ 6267 lastTime = animation.lastTime !== void 0 ? animation.lastTime : time; 6268 velocity = animation.lastVelocity !== void 0 ? animation.lastVelocity : config.initialVelocity; // If we lost a lot of frames just jump to the end. 6269 6270 if (time > lastTime + 64) lastTime = time; // http://gafferongames.com/game-physics/fix-your-timestep/ 6271 6272 var numSteps = Math.floor(time - lastTime); 6273 6274 for (var i = 0; i < numSteps; ++i) { 6275 var force = -config.tension * (position - to); 6276 var damping = -config.friction * velocity; 6277 var acceleration = (force + damping) / config.mass; 6278 velocity = velocity + acceleration * 1 / 1000; 6279 position = position + velocity * 1 / 1000; 6280 } // Conditions for stopping the spring animation 6281 6282 6283 var isOvershooting = config.clamp && config.tension !== 0 ? from < to ? position > to : position < to : false; 6284 var isVelocity = Math.abs(velocity) <= config.precision; 6285 var isDisplacement = config.tension !== 0 ? Math.abs(to - position) <= config.precision : true; 6286 endOfAnimation = isOvershooting || isVelocity && isDisplacement; 6287 animation.lastVelocity = velocity; 6288 animation.lastTime = time; 6289 } // Trails aren't done until their parents conclude 6290 6291 6292 if (isAnimated && !config.toValues[valIdx].done) endOfAnimation = false; 6293 6294 if (endOfAnimation) { 6295 // Ensure that we end up with a round value 6296 if (animation.value !== to) position = to; 6297 animation.done = true; 6298 } else isActive = true; 6299 6300 animation.setValue(position); 6301 animation.lastPosition = position; 6302 } // Keep track of updated values only when necessary 6303 6304 6305 if (controller.props.onFrame) controller.values[config.name] = config.interpolation.getValue(); 6306 } // Update callbacks in the end of the frame 6307 6308 6309 if (controller.props.onFrame) controller.props.onFrame(controller.values); // Either call onEnd or next frame 6310 6311 if (!isActive) { 6312 controllers.delete(controller); 6313 controller.stop(true); 6314 } 6315 } // Loop over as long as there are controllers ... 6316 6317 6318 if (controllers.size) { 6319 if (manualFrameloop) manualFrameloop();else requestFrame(update); 6320 } else { 6321 active = false; 6322 } 6323 6324 return active; 6325 }; 6326 6327 var start = function start(controller) { 6328 if (!controllers.has(controller)) controllers.add(controller); 6329 6330 if (!active) { 6331 active = true; 6332 if (manualFrameloop) requestFrame(manualFrameloop);else requestFrame(update); 6333 } 6334 }; 6335 6336 var stop = function stop(controller) { 6337 if (controllers.has(controller)) controllers.delete(controller); 6338 }; 6339 6340 function createInterpolator(range, output, extrapolate) { 6341 if (typeof range === 'function') { 6342 return range; 6343 } 6344 6345 if (Array.isArray(range)) { 6346 return createInterpolator({ 6347 range: range, 6348 output: output, 6349 extrapolate: extrapolate 6350 }); 6351 } 6352 6353 if (interpolation && typeof range.output[0] === 'string') { 6354 return interpolation(range); 6355 } 6356 6357 var config = range; 6358 var outputRange = config.output; 6359 var inputRange = config.range || [0, 1]; 6360 var extrapolateLeft = config.extrapolateLeft || config.extrapolate || 'extend'; 6361 var extrapolateRight = config.extrapolateRight || config.extrapolate || 'extend'; 6362 6363 var easing = config.easing || function (t) { 6364 return t; 6365 }; 6366 6367 return function (input) { 6368 var range = findRange(input, inputRange); 6369 return interpolate(input, inputRange[range], inputRange[range + 1], outputRange[range], outputRange[range + 1], easing, extrapolateLeft, extrapolateRight, config.map); 6370 }; 6371 } 6372 6373 function interpolate(input, inputMin, inputMax, outputMin, outputMax, easing, extrapolateLeft, extrapolateRight, map) { 6374 var result = map ? map(input) : input; // Extrapolate 6375 6376 if (result < inputMin) { 6377 if (extrapolateLeft === 'identity') return result;else if (extrapolateLeft === 'clamp') result = inputMin; 6378 } 6379 6380 if (result > inputMax) { 6381 if (extrapolateRight === 'identity') return result;else if (extrapolateRight === 'clamp') result = inputMax; 6382 } 6383 6384 if (outputMin === outputMax) return outputMin; 6385 if (inputMin === inputMax) return input <= inputMin ? outputMin : outputMax; // Input Range 6386 6387 if (inputMin === -Infinity) result = -result;else if (inputMax === Infinity) result = result - inputMin;else result = (result - inputMin) / (inputMax - inputMin); // Easing 6388 6389 result = easing(result); // Output Range 6390 6391 if (outputMin === -Infinity) result = -result;else if (outputMax === Infinity) result = result + outputMin;else result = result * (outputMax - outputMin) + outputMin; 6392 return result; 6393 } 6394 6395 function findRange(input, inputRange) { 6396 for (var i = 1; i < inputRange.length - 1; ++i) { 6397 if (inputRange[i] >= input) break; 6398 } 6399 6400 return i - 1; 6401 } 6402 6403 var AnimatedInterpolation = 6404 /*#__PURE__*/ 6405 function (_AnimatedArray) { 6406 _inheritsLoose(AnimatedInterpolation, _AnimatedArray); 6407 6408 function AnimatedInterpolation(parents, range, output, extrapolate) { 6409 var _this; 6410 6411 _this = _AnimatedArray.call(this) || this; 6412 _this.calc = void 0; 6413 _this.payload = parents instanceof AnimatedArray && !(parents instanceof AnimatedInterpolation) ? parents.getPayload() : Array.isArray(parents) ? parents : [parents]; 6414 _this.calc = createInterpolator(range, output, extrapolate); 6415 return _this; 6416 } 6417 6418 var _proto = AnimatedInterpolation.prototype; 6419 6420 _proto.getValue = function getValue() { 6421 return this.calc.apply(this, this.payload.map(function (value) { 6422 return value.getValue(); 6423 })); 6424 }; 6425 6426 _proto.updateConfig = function updateConfig(range, output, extrapolate) { 6427 this.calc = createInterpolator(range, output, extrapolate); 6428 }; 6429 6430 _proto.interpolate = function interpolate(range, output, extrapolate) { 6431 return new AnimatedInterpolation(this, range, output, extrapolate); 6432 }; 6433 6434 return AnimatedInterpolation; 6435 }(AnimatedArray); 6436 6437 var interpolate$1 = function interpolate(parents, range, output) { 6438 return parents && new AnimatedInterpolation(parents, range, output); 6439 }; 6440 6441 var config = { 6442 default: { 6443 tension: 170, 6444 friction: 26 6445 }, 6446 gentle: { 6447 tension: 120, 6448 friction: 14 6449 }, 6450 wobbly: { 6451 tension: 180, 6452 friction: 12 6453 }, 6454 stiff: { 6455 tension: 210, 6456 friction: 20 6457 }, 6458 slow: { 6459 tension: 280, 6460 friction: 60 6461 }, 6462 molasses: { 6463 tension: 280, 6464 friction: 120 6465 } 6466 }; 6467 6468 /** API 6469 * useChain(references, timeSteps, timeFrame) 6470 */ 6471 6472 function useChain(refs, timeSteps, timeFrame) { 6473 if (timeFrame === void 0) { 6474 timeFrame = 1000; 6475 } 6476 6477 var previous = React.useRef(); 6478 React.useEffect(function () { 6479 if (is.equ(refs, previous.current)) refs.forEach(function (_ref) { 6480 var current = _ref.current; 6481 return current && current.start(); 6482 });else if (timeSteps) { 6483 refs.forEach(function (_ref2, index) { 6484 var current = _ref2.current; 6485 6486 if (current) { 6487 var ctrls = current.controllers; 6488 6489 if (ctrls.length) { 6490 var t = timeFrame * timeSteps[index]; 6491 ctrls.forEach(function (ctrl) { 6492 ctrl.queue = ctrl.queue.map(function (e) { 6493 return _extends({}, e, { 6494 delay: e.delay + t 6495 }); 6496 }); 6497 ctrl.start(); 6498 }); 6499 } 6500 } 6501 }); 6502 } else refs.reduce(function (q, _ref3, rI) { 6503 var current = _ref3.current; 6504 return q = q.then(function () { 6505 return current.start(); 6506 }); 6507 }, Promise.resolve()); 6508 previous.current = refs; 6509 }); 6510 } 6511 6512 /** 6513 * Animated works by building a directed acyclic graph of dependencies 6514 * transparently when you render your Animated components. 6515 * 6516 * new Animated.Value(0) 6517 * .interpolate() .interpolate() new Animated.Value(1) 6518 * opacity translateY scale 6519 * style transform 6520 * View#234 style 6521 * View#123 6522 * 6523 * A) Top Down phase 6524 * When an AnimatedValue is updated, we recursively go down through this 6525 * graph in order to find leaf nodes: the views that we flag as needing 6526 * an update. 6527 * 6528 * B) Bottom Up phase 6529 * When a view is flagged as needing an update, we recursively go back up 6530 * in order to build the new value that it needs. The reason why we need 6531 * this two-phases process is to deal with composite props such as 6532 * transform which can receive values from multiple parents. 6533 */ 6534 function addAnimatedStyles(node, styles) { 6535 if ('update' in node) { 6536 styles.add(node); 6537 } else { 6538 node.getChildren().forEach(function (child) { 6539 return addAnimatedStyles(child, styles); 6540 }); 6541 } 6542 } 6543 6544 var AnimatedValue = 6545 /*#__PURE__*/ 6546 function (_Animated) { 6547 _inheritsLoose(AnimatedValue, _Animated); 6548 6549 function AnimatedValue(_value) { 6550 var _this; 6551 6552 _this = _Animated.call(this) || this; 6553 _this.animatedStyles = new Set(); 6554 _this.value = void 0; 6555 _this.startPosition = void 0; 6556 _this.lastPosition = void 0; 6557 _this.lastVelocity = void 0; 6558 _this.startTime = void 0; 6559 _this.lastTime = void 0; 6560 _this.done = false; 6561 6562 _this.setValue = function (value, flush) { 6563 if (flush === void 0) { 6564 flush = true; 6565 } 6566 6567 _this.value = value; 6568 if (flush) _this.flush(); 6569 }; 6570 6571 _this.value = _value; 6572 _this.startPosition = _value; 6573 _this.lastPosition = _value; 6574 return _this; 6575 } 6576 6577 var _proto = AnimatedValue.prototype; 6578 6579 _proto.flush = function flush() { 6580 if (this.animatedStyles.size === 0) { 6581 addAnimatedStyles(this, this.animatedStyles); 6582 } 6583 6584 this.animatedStyles.forEach(function (animatedStyle) { 6585 return animatedStyle.update(); 6586 }); 6587 }; 6588 6589 _proto.clearStyles = function clearStyles() { 6590 this.animatedStyles.clear(); 6591 }; 6592 6593 _proto.getValue = function getValue() { 6594 return this.value; 6595 }; 6596 6597 _proto.interpolate = function interpolate(range, output, extrapolate) { 6598 return new AnimatedInterpolation(this, range, output, extrapolate); 6599 }; 6600 6601 return AnimatedValue; 6602 }(Animated); 6603 6604 var AnimatedValueArray = 6605 /*#__PURE__*/ 6606 function (_AnimatedArray) { 6607 _inheritsLoose(AnimatedValueArray, _AnimatedArray); 6608 6609 function AnimatedValueArray(values) { 6610 var _this; 6611 6612 _this = _AnimatedArray.call(this) || this; 6613 _this.payload = values.map(function (n) { 6614 return new AnimatedValue(n); 6615 }); 6616 return _this; 6617 } 6618 6619 var _proto = AnimatedValueArray.prototype; 6620 6621 _proto.setValue = function setValue(value, flush) { 6622 var _this2 = this; 6623 6624 if (flush === void 0) { 6625 flush = true; 6626 } 6627 6628 if (Array.isArray(value)) { 6629 if (value.length === this.payload.length) { 6630 value.forEach(function (v, i) { 6631 return _this2.payload[i].setValue(v, flush); 6632 }); 6633 } 6634 } else { 6635 this.payload.forEach(function (p) { 6636 return p.setValue(value, flush); 6637 }); 6638 } 6639 }; 6640 6641 _proto.getValue = function getValue() { 6642 return this.payload.map(function (v) { 6643 return v.getValue(); 6644 }); 6645 }; 6646 6647 _proto.interpolate = function interpolate(range, output) { 6648 return new AnimatedInterpolation(this, range, output); 6649 }; 6650 6651 return AnimatedValueArray; 6652 }(AnimatedArray); 6653 6654 var G = 0; 6655 6656 var Controller = 6657 /*#__PURE__*/ 6658 function () { 6659 function Controller() { 6660 var _this = this; 6661 6662 this.id = void 0; 6663 this.idle = true; 6664 this.hasChanged = false; 6665 this.guid = 0; 6666 this.local = 0; 6667 this.props = {}; 6668 this.merged = {}; 6669 this.animations = {}; 6670 this.interpolations = {}; 6671 this.values = {}; 6672 this.configs = []; 6673 this.listeners = []; 6674 this.queue = []; 6675 this.localQueue = void 0; 6676 6677 this.getValues = function () { 6678 return _this.interpolations; 6679 }; 6680 6681 this.id = G++; 6682 } 6683 /** update(props) 6684 * This function filters input props and creates an array of tasks which are executed in .start() 6685 * Each task is allowed to carry a delay, which means it can execute asnychroneously */ 6686 6687 6688 var _proto = Controller.prototype; 6689 6690 _proto.update = function update$$1(args) { 6691 //this._id = n + this.id 6692 if (!args) return this; // Extract delay and the to-prop from props 6693 6694 var _ref = interpolateTo(args), 6695 _ref$delay = _ref.delay, 6696 delay = _ref$delay === void 0 ? 0 : _ref$delay, 6697 to = _ref.to, 6698 props = _objectWithoutPropertiesLoose(_ref, ["delay", "to"]); 6699 6700 if (is.arr(to) || is.fun(to)) { 6701 // If config is either a function or an array queue it up as is 6702 this.queue.push(_extends({}, props, { 6703 delay: delay, 6704 to: to 6705 })); 6706 } else if (to) { 6707 // Otherwise go through each key since it could be delayed individually 6708 var ops = {}; 6709 Object.entries(to).forEach(function (_ref2) { 6710 var _to; 6711 6712 var k = _ref2[0], 6713 v = _ref2[1]; 6714 6715 // Fetch delay and create an entry, consisting of the to-props, the delay, and basic props 6716 var entry = _extends({ 6717 to: (_to = {}, _to[k] = v, _to), 6718 delay: callProp(delay, k) 6719 }, props); 6720 6721 var previous = ops[entry.delay] && ops[entry.delay].to; 6722 ops[entry.delay] = _extends({}, ops[entry.delay], entry, { 6723 to: _extends({}, previous, entry.to) 6724 }); 6725 }); 6726 this.queue = Object.values(ops); 6727 } // Sort queue, so that async calls go last 6728 6729 6730 this.queue = this.queue.sort(function (a, b) { 6731 return a.delay - b.delay; 6732 }); // Diff the reduced props immediately (they'll contain the from-prop and some config) 6733 6734 this.diff(props); 6735 return this; 6736 } 6737 /** start(onEnd) 6738 * This function either executes a queue, if present, or starts the frameloop, which animates */ 6739 ; 6740 6741 _proto.start = function start$$1(onEnd) { 6742 var _this2 = this; 6743 6744 // If a queue is present we must excecute it 6745 if (this.queue.length) { 6746 this.idle = false; // Updates can interrupt trailing queues, in that case we just merge values 6747 6748 if (this.localQueue) { 6749 this.localQueue.forEach(function (_ref3) { 6750 var _ref3$from = _ref3.from, 6751 from = _ref3$from === void 0 ? {} : _ref3$from, 6752 _ref3$to = _ref3.to, 6753 to = _ref3$to === void 0 ? {} : _ref3$to; 6754 if (is.obj(from)) _this2.merged = _extends({}, from, _this2.merged); 6755 if (is.obj(to)) _this2.merged = _extends({}, _this2.merged, to); 6756 }); 6757 } // The guid helps us tracking frames, a new queue over an old one means an override 6758 // We discard async calls in that caseÍ 6759 6760 6761 var local = this.local = ++this.guid; 6762 var queue = this.localQueue = this.queue; 6763 this.queue = []; // Go through each entry and execute it 6764 6765 queue.forEach(function (_ref4, index) { 6766 var delay = _ref4.delay, 6767 props = _objectWithoutPropertiesLoose(_ref4, ["delay"]); 6768 6769 var cb = function cb(finished) { 6770 if (index === queue.length - 1 && local === _this2.guid && finished) { 6771 _this2.idle = true; 6772 if (_this2.props.onRest) _this2.props.onRest(_this2.merged); 6773 } 6774 6775 if (onEnd) onEnd(); 6776 }; // Entries can be delayed, ansyc or immediate 6777 6778 6779 var async = is.arr(props.to) || is.fun(props.to); 6780 6781 if (delay) { 6782 setTimeout(function () { 6783 if (local === _this2.guid) { 6784 if (async) _this2.runAsync(props, cb);else _this2.diff(props).start(cb); 6785 } 6786 }, delay); 6787 } else if (async) _this2.runAsync(props, cb);else _this2.diff(props).start(cb); 6788 }); 6789 } // Otherwise we kick of the frameloop 6790 else { 6791 if (is.fun(onEnd)) this.listeners.push(onEnd); 6792 if (this.props.onStart) this.props.onStart(); 6793 6794 start(this); 6795 } 6796 6797 return this; 6798 }; 6799 6800 _proto.stop = function stop$$1(finished) { 6801 this.listeners.forEach(function (onEnd) { 6802 return onEnd(finished); 6803 }); 6804 this.listeners = []; 6805 return this; 6806 } 6807 /** Pause sets onEnd listeners free, but also removes the controller from the frameloop */ 6808 ; 6809 6810 _proto.pause = function pause(finished) { 6811 this.stop(true); 6812 if (finished) stop(this); 6813 return this; 6814 }; 6815 6816 _proto.runAsync = function runAsync(_ref5, onEnd) { 6817 var _this3 = this; 6818 6819 var delay = _ref5.delay, 6820 props = _objectWithoutPropertiesLoose(_ref5, ["delay"]); 6821 6822 var local = this.local; // If "to" is either a function or an array it will be processed async, therefor "to" should be empty right now 6823 // If the view relies on certain values "from" has to be present 6824 6825 var queue = Promise.resolve(undefined); 6826 6827 if (is.arr(props.to)) { 6828 var _loop = function _loop(i) { 6829 var index = i; 6830 6831 var fresh = _extends({}, props, interpolateTo(props.to[index])); 6832 6833 if (is.arr(fresh.config)) fresh.config = fresh.config[index]; 6834 queue = queue.then(function () { 6835 //this.stop() 6836 if (local === _this3.guid) return new Promise(function (r) { 6837 return _this3.diff(fresh).start(r); 6838 }); 6839 }); 6840 }; 6841 6842 for (var i = 0; i < props.to.length; i++) { 6843 _loop(i); 6844 } 6845 } else if (is.fun(props.to)) { 6846 var index = 0; 6847 var last; 6848 queue = queue.then(function () { 6849 return props.to( // next(props) 6850 function (p) { 6851 var fresh = _extends({}, props, interpolateTo(p)); 6852 6853 if (is.arr(fresh.config)) fresh.config = fresh.config[index]; 6854 index++; //this.stop() 6855 6856 if (local === _this3.guid) return last = new Promise(function (r) { 6857 return _this3.diff(fresh).start(r); 6858 }); 6859 return; 6860 }, // cancel() 6861 function (finished) { 6862 if (finished === void 0) { 6863 finished = true; 6864 } 6865 6866 return _this3.stop(finished); 6867 }).then(function () { 6868 return last; 6869 }); 6870 }); 6871 } 6872 6873 queue.then(onEnd); 6874 }; 6875 6876 _proto.diff = function diff(props) { 6877 var _this4 = this; 6878 6879 this.props = _extends({}, this.props, props); 6880 var _this$props = this.props, 6881 _this$props$from = _this$props.from, 6882 from = _this$props$from === void 0 ? {} : _this$props$from, 6883 _this$props$to = _this$props.to, 6884 to = _this$props$to === void 0 ? {} : _this$props$to, 6885 _this$props$config = _this$props.config, 6886 config = _this$props$config === void 0 ? {} : _this$props$config, 6887 reverse = _this$props.reverse, 6888 attach = _this$props.attach, 6889 reset = _this$props.reset, 6890 immediate = _this$props.immediate; // Reverse values when requested 6891 6892 if (reverse) { 6893 var _ref6 = [to, from]; 6894 from = _ref6[0]; 6895 to = _ref6[1]; 6896 } // This will collect all props that were ever set, reset merged props when necessary 6897 6898 6899 this.merged = _extends({}, from, this.merged, to); 6900 this.hasChanged = false; // Attachment handling, trailed springs can "attach" themselves to a previous spring 6901 6902 var target = attach && attach(this); // Reduces input { name: value } pairs into animated values 6903 6904 this.animations = Object.entries(this.merged).reduce(function (acc, _ref7) { 6905 var name = _ref7[0], 6906 value = _ref7[1]; 6907 // Issue cached entries, except on reset 6908 var entry = acc[name] || {}; // Figure out what the value is supposed to be 6909 6910 var isNumber = is.num(value); 6911 var isString = is.str(value) && !value.startsWith('#') && !/\d/.test(value) && !colorNames[value]; 6912 var isArray = is.arr(value); 6913 var isInterpolation = !isNumber && !isArray && !isString; 6914 var fromValue = !is.und(from[name]) ? from[name] : value; 6915 var toValue = isNumber || isArray ? value : isString ? value : 1; 6916 var toConfig = callProp(config, name); 6917 if (target) toValue = target.animations[name].parent; 6918 var parent = entry.parent, 6919 interpolation$$1 = entry.interpolation, 6920 toValues = toArray(target ? toValue.getPayload() : toValue), 6921 animatedValues; 6922 var newValue = value; 6923 if (isInterpolation) newValue = interpolation({ 6924 range: [0, 1], 6925 output: [value, value] 6926 })(1); 6927 var currentValue = interpolation$$1 && interpolation$$1.getValue(); // Change detection flags 6928 6929 var isFirst = is.und(parent); 6930 var isActive = !isFirst && entry.animatedValues.some(function (v) { 6931 return !v.done; 6932 }); 6933 var currentValueDiffersFromGoal = !is.equ(newValue, currentValue); 6934 var hasNewGoal = !is.equ(newValue, entry.previous); 6935 var hasNewConfig = !is.equ(toConfig, entry.config); // Change animation props when props indicate a new goal (new value differs from previous one) 6936 // and current values differ from it. Config changes trigger a new update as well (though probably shouldn't?) 6937 6938 if (reset || hasNewGoal && currentValueDiffersFromGoal || hasNewConfig) { 6939 var _extends2; 6940 6941 // Convert regular values into animated values, ALWAYS re-use if possible 6942 if (isNumber || isString) parent = interpolation$$1 = entry.parent || new AnimatedValue(fromValue);else if (isArray) parent = interpolation$$1 = entry.parent || new AnimatedValueArray(fromValue);else if (isInterpolation) { 6943 var prev = entry.interpolation && entry.interpolation.calc(entry.parent.value); 6944 prev = prev !== void 0 && !reset ? prev : fromValue; 6945 6946 if (entry.parent) { 6947 parent = entry.parent; 6948 parent.setValue(0, false); 6949 } else parent = new AnimatedValue(0); 6950 6951 var range = { 6952 output: [prev, value] 6953 }; 6954 6955 if (entry.interpolation) { 6956 interpolation$$1 = entry.interpolation; 6957 entry.interpolation.updateConfig(range); 6958 } else interpolation$$1 = parent.interpolate(range); 6959 } 6960 toValues = toArray(target ? toValue.getPayload() : toValue); 6961 animatedValues = toArray(parent.getPayload()); 6962 if (reset && !isInterpolation) parent.setValue(fromValue, false); 6963 _this4.hasChanged = true; // Reset animated values 6964 6965 animatedValues.forEach(function (value) { 6966 value.startPosition = value.value; 6967 value.lastPosition = value.value; 6968 value.lastVelocity = isActive ? value.lastVelocity : undefined; 6969 value.lastTime = isActive ? value.lastTime : undefined; 6970 value.startTime = now(); 6971 value.done = false; 6972 value.animatedStyles.clear(); 6973 }); // Set immediate values 6974 6975 if (callProp(immediate, name)) { 6976 parent.setValue(isInterpolation ? toValue : value, false); 6977 } 6978 6979 return _extends({}, acc, (_extends2 = {}, _extends2[name] = _extends({}, entry, { 6980 name: name, 6981 parent: parent, 6982 interpolation: interpolation$$1, 6983 animatedValues: animatedValues, 6984 toValues: toValues, 6985 previous: newValue, 6986 config: toConfig, 6987 fromValues: toArray(parent.getValue()), 6988 immediate: callProp(immediate, name), 6989 initialVelocity: withDefault(toConfig.velocity, 0), 6990 clamp: withDefault(toConfig.clamp, false), 6991 precision: withDefault(toConfig.precision, 0.01), 6992 tension: withDefault(toConfig.tension, 170), 6993 friction: withDefault(toConfig.friction, 26), 6994 mass: withDefault(toConfig.mass, 1), 6995 duration: toConfig.duration, 6996 easing: withDefault(toConfig.easing, function (t) { 6997 return t; 6998 }), 6999 decay: toConfig.decay 7000 }), _extends2)); 7001 } else { 7002 if (!currentValueDiffersFromGoal) { 7003 var _extends3; 7004 7005 // So ... the current target value (newValue) appears to be different from the previous value, 7006 // which normally constitutes an update, but the actual value (currentValue) matches the target! 7007 // In order to resolve this without causing an animation update we silently flag the animation as done, 7008 // which it technically is. Interpolations also needs a config update with their target set to 1. 7009 if (isInterpolation) { 7010 parent.setValue(1, false); 7011 interpolation$$1.updateConfig({ 7012 output: [newValue, newValue] 7013 }); 7014 } 7015 7016 parent.done = true; 7017 _this4.hasChanged = true; 7018 return _extends({}, acc, (_extends3 = {}, _extends3[name] = _extends({}, acc[name], { 7019 previous: newValue 7020 }), _extends3)); 7021 } 7022 7023 return acc; 7024 } 7025 }, this.animations); 7026 7027 if (this.hasChanged) { 7028 // Make animations available to frameloop 7029 this.configs = Object.values(this.animations); 7030 this.values = {}; 7031 this.interpolations = {}; 7032 7033 for (var key in this.animations) { 7034 this.interpolations[key] = this.animations[key].interpolation; 7035 this.values[key] = this.animations[key].interpolation.getValue(); 7036 } 7037 } 7038 7039 return this; 7040 }; 7041 7042 _proto.destroy = function destroy() { 7043 this.stop(); 7044 this.props = {}; 7045 this.merged = {}; 7046 this.animations = {}; 7047 this.interpolations = {}; 7048 this.values = {}; 7049 this.configs = []; 7050 this.local = 0; 7051 }; 7052 7053 return Controller; 7054 }(); 7055 7056 /** API 7057 * const props = useSprings(number, [{ ... }, { ... }, ...]) 7058 * const [props, set] = useSprings(number, (i, controller) => ({ ... })) 7059 */ 7060 7061 var useSprings = function useSprings(length, props) { 7062 var mounted = React.useRef(false); 7063 var ctrl = React.useRef(); 7064 var isFn = is.fun(props); // The controller maintains the animation values, starts and stops animations 7065 7066 var _useMemo = React.useMemo(function () { 7067 // Remove old controllers 7068 if (ctrl.current) { 7069 ctrl.current.map(function (c) { 7070 return c.destroy(); 7071 }); 7072 ctrl.current = undefined; 7073 } 7074 7075 var ref; 7076 return [new Array(length).fill().map(function (_, i) { 7077 var ctrl = new Controller(); 7078 var newProps = isFn ? callProp(props, i, ctrl) : props[i]; 7079 if (i === 0) ref = newProps.ref; 7080 ctrl.update(newProps); 7081 if (!ref) ctrl.start(); 7082 return ctrl; 7083 }), ref]; 7084 }, [length]), 7085 controllers = _useMemo[0], 7086 ref = _useMemo[1]; 7087 7088 ctrl.current = controllers; // The hooks reference api gets defined here ... 7089 7090 var api = React.useImperativeHandle(ref, function () { 7091 return { 7092 start: function start() { 7093 return Promise.all(ctrl.current.map(function (c) { 7094 return new Promise(function (r) { 7095 return c.start(r); 7096 }); 7097 })); 7098 }, 7099 stop: function stop(finished) { 7100 return ctrl.current.forEach(function (c) { 7101 return c.stop(finished); 7102 }); 7103 }, 7104 7105 get controllers() { 7106 return ctrl.current; 7107 } 7108 7109 }; 7110 }); // This function updates the controllers 7111 7112 var updateCtrl = React.useMemo(function () { 7113 return function (updateProps) { 7114 return ctrl.current.map(function (c, i) { 7115 c.update(isFn ? callProp(updateProps, i, c) : updateProps[i]); 7116 if (!ref) c.start(); 7117 }); 7118 }; 7119 }, [length]); // Update controller if props aren't functional 7120 7121 React.useEffect(function () { 7122 if (mounted.current) { 7123 if (!isFn) updateCtrl(props); 7124 } else if (!ref) ctrl.current.forEach(function (c) { 7125 return c.start(); 7126 }); 7127 }); // Update mounted flag and destroy controller on unmount 7128 7129 React.useEffect(function () { 7130 return mounted.current = true, function () { 7131 return ctrl.current.forEach(function (c) { 7132 return c.destroy(); 7133 }); 7134 }; 7135 }, []); // Return animated props, or, anim-props + the update-setter above 7136 7137 var propValues = ctrl.current.map(function (c) { 7138 return c.getValues(); 7139 }); 7140 return isFn ? [propValues, updateCtrl, function (finished) { 7141 return ctrl.current.forEach(function (c) { 7142 return c.pause(finished); 7143 }); 7144 }] : propValues; 7145 }; 7146 7147 /** API 7148 * const props = useSpring({ ... }) 7149 * const [props, set] = useSpring(() => ({ ... })) 7150 */ 7151 7152 var useSpring = function useSpring(props) { 7153 var isFn = is.fun(props); 7154 7155 var _useSprings = useSprings(1, isFn ? props : [props]), 7156 result = _useSprings[0], 7157 set = _useSprings[1], 7158 pause = _useSprings[2]; 7159 7160 return isFn ? [result[0], set, pause] : result; 7161 }; 7162 7163 /** API 7164 * const trails = useTrail(number, { ... }) 7165 * const [trails, set] = useTrail(number, () => ({ ... })) 7166 */ 7167 7168 var useTrail = function useTrail(length, props) { 7169 var mounted = React.useRef(false); 7170 var isFn = is.fun(props); 7171 var updateProps = callProp(props); 7172 var instances = React.useRef(); 7173 7174 var _useSprings = useSprings(length, function (i, ctrl) { 7175 if (i === 0) instances.current = []; 7176 instances.current.push(ctrl); 7177 return _extends({}, updateProps, { 7178 config: callProp(updateProps.config, i), 7179 attach: i > 0 && function () { 7180 return instances.current[i - 1]; 7181 } 7182 }); 7183 }), 7184 result = _useSprings[0], 7185 set = _useSprings[1], 7186 pause = _useSprings[2]; // Set up function to update controller 7187 7188 7189 var updateCtrl = React.useMemo(function () { 7190 return function (props) { 7191 return set(function (i, ctrl) { 7192 var last = props.reverse ? i === 0 : length - 1 === i; 7193 var attachIdx = props.reverse ? i + 1 : i - 1; 7194 var attachController = instances.current[attachIdx]; 7195 return _extends({}, props, { 7196 config: callProp(props.config || updateProps.config, i), 7197 attach: attachController && function () { 7198 return attachController; 7199 } 7200 }); 7201 }); 7202 }; 7203 }, [length, updateProps.reverse]); // Update controller if props aren't functional 7204 7205 React.useEffect(function () { 7206 return void (mounted.current && !isFn && updateCtrl(props)); 7207 }); // Update mounted flag and destroy controller on unmount 7208 7209 React.useEffect(function () { 7210 return void (mounted.current = true); 7211 }, []); 7212 return isFn ? [result, updateCtrl, pause] : result; 7213 }; 7214 7215 /** API 7216 * const transitions = useTransition(items, itemKeys, { ... }) 7217 * const [transitions, update] = useTransition(items, itemKeys, () => ({ ... })) 7218 */ 7219 7220 var guid = 0; 7221 var ENTER = 'enter'; 7222 var LEAVE = 'leave'; 7223 var UPDATE = 'update'; 7224 7225 var mapKeys = function mapKeys(items, keys) { 7226 return (typeof keys === 'function' ? items.map(keys) : toArray(keys)).map(String); 7227 }; 7228 7229 var get = function get(props) { 7230 var items = props.items, 7231 _props$keys = props.keys, 7232 keys = _props$keys === void 0 ? function (item) { 7233 return item; 7234 } : _props$keys, 7235 rest = _objectWithoutPropertiesLoose(props, ["items", "keys"]); 7236 7237 items = toArray(items !== void 0 ? items : null); 7238 return _extends({ 7239 items: items, 7240 keys: mapKeys(items, keys) 7241 }, rest); 7242 }; 7243 7244 function useTransition(input, keyTransform, config) { 7245 var props = _extends({ 7246 items: input, 7247 keys: keyTransform || function (i) { 7248 return i; 7249 } 7250 }, config); 7251 7252 var _get = get(props), 7253 _get$lazy = _get.lazy, 7254 lazy = _get$lazy === void 0 ? false : _get$lazy, 7255 _get$unique = _get.unique, 7256 _get$reset = _get.reset, 7257 reset = _get$reset === void 0 ? false : _get$reset, 7258 enter = _get.enter, 7259 leave = _get.leave, 7260 update = _get.update, 7261 onDestroyed = _get.onDestroyed, 7262 keys = _get.keys, 7263 items = _get.items, 7264 onFrame = _get.onFrame, 7265 _onRest = _get.onRest, 7266 onStart = _get.onStart, 7267 ref = _get.ref, 7268 extra = _objectWithoutPropertiesLoose(_get, ["lazy", "unique", "reset", "enter", "leave", "update", "onDestroyed", "keys", "items", "onFrame", "onRest", "onStart", "ref"]); 7269 7270 var forceUpdate = useForceUpdate(); 7271 var mounted = React.useRef(false); 7272 var state = React.useRef({ 7273 mounted: false, 7274 first: true, 7275 deleted: [], 7276 current: {}, 7277 transitions: [], 7278 prevProps: {}, 7279 paused: !!props.ref, 7280 instances: !mounted.current && new Map(), 7281 forceUpdate: forceUpdate 7282 }); 7283 React.useImperativeHandle(props.ref, function () { 7284 return { 7285 start: function start() { 7286 return Promise.all(Array.from(state.current.instances).map(function (_ref) { 7287 var c = _ref[1]; 7288 return new Promise(function (r) { 7289 return c.start(r); 7290 }); 7291 })); 7292 }, 7293 stop: function stop(finished) { 7294 return Array.from(state.current.instances).forEach(function (_ref2) { 7295 var c = _ref2[1]; 7296 return c.stop(finished); 7297 }); 7298 }, 7299 7300 get controllers() { 7301 return Array.from(state.current.instances).map(function (_ref3) { 7302 var c = _ref3[1]; 7303 return c; 7304 }); 7305 } 7306 7307 }; 7308 }); // Update state 7309 7310 state.current = diffItems(state.current, props); 7311 7312 if (state.current.changed) { 7313 // Update state 7314 state.current.transitions.forEach(function (transition) { 7315 var slot = transition.slot, 7316 from = transition.from, 7317 to = transition.to, 7318 config = transition.config, 7319 trail = transition.trail, 7320 key = transition.key, 7321 item = transition.item; 7322 if (!state.current.instances.has(key)) state.current.instances.set(key, new Controller()); // update the map object 7323 7324 var ctrl = state.current.instances.get(key); 7325 7326 var newProps = _extends({}, extra, { 7327 to: to, 7328 from: from, 7329 config: config, 7330 ref: ref, 7331 onRest: function onRest(values) { 7332 if (state.current.mounted) { 7333 if (transition.destroyed) { 7334 // If no ref is given delete destroyed items immediately 7335 if (!ref && !lazy) cleanUp(state, key); 7336 if (onDestroyed) onDestroyed(item); 7337 } // A transition comes to rest once all its springs conclude 7338 7339 7340 var curInstances = Array.from(state.current.instances); 7341 var active = curInstances.some(function (_ref4) { 7342 var c = _ref4[1]; 7343 return !c.idle; 7344 }); 7345 if (!active && (ref || lazy) && state.current.deleted.length > 0) cleanUp(state); 7346 if (_onRest) _onRest(item, slot, values); 7347 } 7348 }, 7349 onStart: onStart && function () { 7350 return onStart(item, slot); 7351 }, 7352 onFrame: onFrame && function (values) { 7353 return onFrame(item, slot, values); 7354 }, 7355 delay: trail, 7356 reset: reset && slot === ENTER // Update controller 7357 7358 }); 7359 7360 ctrl.update(newProps); 7361 if (!state.current.paused) ctrl.start(); 7362 }); 7363 } 7364 7365 React.useEffect(function () { 7366 state.current.mounted = mounted.current = true; 7367 return function () { 7368 state.current.mounted = mounted.current = false; 7369 Array.from(state.current.instances).map(function (_ref5) { 7370 var c = _ref5[1]; 7371 return c.destroy(); 7372 }); 7373 state.current.instances.clear(); 7374 }; 7375 }, []); 7376 return state.current.transitions.map(function (_ref6) { 7377 var item = _ref6.item, 7378 slot = _ref6.slot, 7379 key = _ref6.key; 7380 return { 7381 item: item, 7382 key: key, 7383 state: slot, 7384 props: state.current.instances.get(key).getValues() 7385 }; 7386 }); 7387 } 7388 7389 function cleanUp(state, filterKey) { 7390 var deleted = state.current.deleted; 7391 7392 var _loop = function _loop() { 7393 if (_isArray) { 7394 if (_i >= _iterator.length) return "break"; 7395 _ref8 = _iterator[_i++]; 7396 } else { 7397 _i = _iterator.next(); 7398 if (_i.done) return "break"; 7399 _ref8 = _i.value; 7400 } 7401 7402 var _ref7 = _ref8; 7403 var key = _ref7.key; 7404 7405 var filter = function filter(t) { 7406 return t.key !== key; 7407 }; 7408 7409 if (is.und(filterKey) || filterKey === key) { 7410 state.current.instances.delete(key); 7411 state.current.transitions = state.current.transitions.filter(filter); 7412 state.current.deleted = state.current.deleted.filter(filter); 7413 } 7414 }; 7415 7416 for (var _iterator = deleted, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { 7417 var _ref8; 7418 7419 var _ret = _loop(); 7420 7421 if (_ret === "break") break; 7422 } 7423 7424 state.current.forceUpdate(); 7425 } 7426 7427 function diffItems(_ref9, props) { 7428 var first = _ref9.first, 7429 prevProps = _ref9.prevProps, 7430 state = _objectWithoutPropertiesLoose(_ref9, ["first", "prevProps"]); 7431 7432 var _get2 = get(props), 7433 items = _get2.items, 7434 keys = _get2.keys, 7435 initial = _get2.initial, 7436 from = _get2.from, 7437 enter = _get2.enter, 7438 leave = _get2.leave, 7439 update = _get2.update, 7440 _get2$trail = _get2.trail, 7441 trail = _get2$trail === void 0 ? 0 : _get2$trail, 7442 unique = _get2.unique, 7443 config = _get2.config, 7444 _get2$order = _get2.order, 7445 order = _get2$order === void 0 ? [ENTER, LEAVE, UPDATE] : _get2$order; 7446 7447 var _get3 = get(prevProps), 7448 _keys = _get3.keys, 7449 _items = _get3.items; 7450 7451 var current = _extends({}, state.current); 7452 7453 var deleted = [].concat(state.deleted); // Compare next keys with current keys 7454 7455 var currentKeys = Object.keys(current); 7456 var currentSet = new Set(currentKeys); 7457 var nextSet = new Set(keys); 7458 var added = keys.filter(function (item) { 7459 return !currentSet.has(item); 7460 }); 7461 var removed = state.transitions.filter(function (item) { 7462 return !item.destroyed && !nextSet.has(item.originalKey); 7463 }).map(function (i) { 7464 return i.originalKey; 7465 }); 7466 var updated = keys.filter(function (item) { 7467 return currentSet.has(item); 7468 }); 7469 var delay = -trail; 7470 7471 while (order.length) { 7472 var changeType = order.shift(); 7473 7474 switch (changeType) { 7475 case ENTER: 7476 { 7477 added.forEach(function (key, index) { 7478 // In unique mode, remove fading out transitions if their key comes in again 7479 if (unique && deleted.find(function (d) { 7480 return d.originalKey === key; 7481 })) deleted = deleted.filter(function (t) { 7482 return t.originalKey !== key; 7483 }); 7484 var keyIndex = keys.indexOf(key); 7485 var item = items[keyIndex]; 7486 var slot = first && initial !== void 0 ? 'initial' : ENTER; 7487 current[key] = { 7488 slot: slot, 7489 originalKey: key, 7490 key: unique ? String(key) : guid++, 7491 item: item, 7492 trail: delay = delay + trail, 7493 config: callProp(config, item, slot), 7494 from: callProp(first ? initial !== void 0 ? initial || {} : from : from, item), 7495 to: callProp(enter, item) 7496 }; 7497 }); 7498 break; 7499 } 7500 7501 case LEAVE: 7502 { 7503 removed.forEach(function (key) { 7504 var keyIndex = _keys.indexOf(key); 7505 7506 var item = _items[keyIndex]; 7507 var slot = LEAVE; 7508 deleted.unshift(_extends({}, current[key], { 7509 slot: slot, 7510 destroyed: true, 7511 left: _keys[Math.max(0, keyIndex - 1)], 7512 right: _keys[Math.min(_keys.length, keyIndex + 1)], 7513 trail: delay = delay + trail, 7514 config: callProp(config, item, slot), 7515 to: callProp(leave, item) 7516 })); 7517 delete current[key]; 7518 }); 7519 break; 7520 } 7521 7522 case UPDATE: 7523 { 7524 updated.forEach(function (key) { 7525 var keyIndex = keys.indexOf(key); 7526 var item = items[keyIndex]; 7527 var slot = UPDATE; 7528 current[key] = _extends({}, current[key], { 7529 item: item, 7530 slot: slot, 7531 trail: delay = delay + trail, 7532 config: callProp(config, item, slot), 7533 to: callProp(update, item) 7534 }); 7535 }); 7536 break; 7537 } 7538 } 7539 } 7540 7541 var out = keys.map(function (key) { 7542 return current[key]; 7543 }); // This tries to restore order for deleted items by finding their last known siblings 7544 // only using the left sibling to keep order placement consistent for all deleted items 7545 7546 deleted.forEach(function (_ref10) { 7547 var left = _ref10.left, 7548 right = _ref10.right, 7549 item = _objectWithoutPropertiesLoose(_ref10, ["left", "right"]); 7550 7551 var pos; // Was it the element on the left, if yes, move there ... 7552 7553 if ((pos = out.findIndex(function (t) { 7554 return t.originalKey === left; 7555 })) !== -1) pos += 1; // And if nothing else helps, move it to the start ¯\_(ツ)_/¯ 7556 7557 pos = Math.max(0, pos); 7558 out = [].concat(out.slice(0, pos), [item], out.slice(pos)); 7559 }); 7560 return _extends({}, state, { 7561 changed: added.length || removed.length || updated.length, 7562 first: first && added.length === 0, 7563 transitions: out, 7564 current: current, 7565 deleted: deleted, 7566 prevProps: props 7567 }); 7568 } 7569 7570 var AnimatedStyle = 7571 /*#__PURE__*/ 7572 function (_AnimatedObject) { 7573 _inheritsLoose(AnimatedStyle, _AnimatedObject); 7574 7575 function AnimatedStyle(style) { 7576 var _this; 7577 7578 if (style === void 0) { 7579 style = {}; 7580 } 7581 7582 _this = _AnimatedObject.call(this) || this; 7583 7584 if (style.transform && !(style.transform instanceof Animated)) { 7585 style = applyAnimatedValues.transform(style); 7586 } 7587 7588 _this.payload = style; 7589 return _this; 7590 } 7591 7592 return AnimatedStyle; 7593 }(AnimatedObject); 7594 7595 // http://www.w3.org/TR/css3-color/#svg-color 7596 var colors = { 7597 transparent: 0x00000000, 7598 aliceblue: 0xf0f8ffff, 7599 antiquewhite: 0xfaebd7ff, 7600 aqua: 0x00ffffff, 7601 aquamarine: 0x7fffd4ff, 7602 azure: 0xf0ffffff, 7603 beige: 0xf5f5dcff, 7604 bisque: 0xffe4c4ff, 7605 black: 0x000000ff, 7606 blanchedalmond: 0xffebcdff, 7607 blue: 0x0000ffff, 7608 blueviolet: 0x8a2be2ff, 7609 brown: 0xa52a2aff, 7610 burlywood: 0xdeb887ff, 7611 burntsienna: 0xea7e5dff, 7612 cadetblue: 0x5f9ea0ff, 7613 chartreuse: 0x7fff00ff, 7614 chocolate: 0xd2691eff, 7615 coral: 0xff7f50ff, 7616 cornflowerblue: 0x6495edff, 7617 cornsilk: 0xfff8dcff, 7618 crimson: 0xdc143cff, 7619 cyan: 0x00ffffff, 7620 darkblue: 0x00008bff, 7621 darkcyan: 0x008b8bff, 7622 darkgoldenrod: 0xb8860bff, 7623 darkgray: 0xa9a9a9ff, 7624 darkgreen: 0x006400ff, 7625 darkgrey: 0xa9a9a9ff, 7626 darkkhaki: 0xbdb76bff, 7627 darkmagenta: 0x8b008bff, 7628 darkolivegreen: 0x556b2fff, 7629 darkorange: 0xff8c00ff, 7630 darkorchid: 0x9932ccff, 7631 darkred: 0x8b0000ff, 7632 darksalmon: 0xe9967aff, 7633 darkseagreen: 0x8fbc8fff, 7634 darkslateblue: 0x483d8bff, 7635 darkslategray: 0x2f4f4fff, 7636 darkslategrey: 0x2f4f4fff, 7637 darkturquoise: 0x00ced1ff, 7638 darkviolet: 0x9400d3ff, 7639 deeppink: 0xff1493ff, 7640 deepskyblue: 0x00bfffff, 7641 dimgray: 0x696969ff, 7642 dimgrey: 0x696969ff, 7643 dodgerblue: 0x1e90ffff, 7644 firebrick: 0xb22222ff, 7645 floralwhite: 0xfffaf0ff, 7646 forestgreen: 0x228b22ff, 7647 fuchsia: 0xff00ffff, 7648 gainsboro: 0xdcdcdcff, 7649 ghostwhite: 0xf8f8ffff, 7650 gold: 0xffd700ff, 7651 goldenrod: 0xdaa520ff, 7652 gray: 0x808080ff, 7653 green: 0x008000ff, 7654 greenyellow: 0xadff2fff, 7655 grey: 0x808080ff, 7656 honeydew: 0xf0fff0ff, 7657 hotpink: 0xff69b4ff, 7658 indianred: 0xcd5c5cff, 7659 indigo: 0x4b0082ff, 7660 ivory: 0xfffff0ff, 7661 khaki: 0xf0e68cff, 7662 lavender: 0xe6e6faff, 7663 lavenderblush: 0xfff0f5ff, 7664 lawngreen: 0x7cfc00ff, 7665 lemonchiffon: 0xfffacdff, 7666 lightblue: 0xadd8e6ff, 7667 lightcoral: 0xf08080ff, 7668 lightcyan: 0xe0ffffff, 7669 lightgoldenrodyellow: 0xfafad2ff, 7670 lightgray: 0xd3d3d3ff, 7671 lightgreen: 0x90ee90ff, 7672 lightgrey: 0xd3d3d3ff, 7673 lightpink: 0xffb6c1ff, 7674 lightsalmon: 0xffa07aff, 7675 lightseagreen: 0x20b2aaff, 7676 lightskyblue: 0x87cefaff, 7677 lightslategray: 0x778899ff, 7678 lightslategrey: 0x778899ff, 7679 lightsteelblue: 0xb0c4deff, 7680 lightyellow: 0xffffe0ff, 7681 lime: 0x00ff00ff, 7682 limegreen: 0x32cd32ff, 7683 linen: 0xfaf0e6ff, 7684 magenta: 0xff00ffff, 7685 maroon: 0x800000ff, 7686 mediumaquamarine: 0x66cdaaff, 7687 mediumblue: 0x0000cdff, 7688 mediumorchid: 0xba55d3ff, 7689 mediumpurple: 0x9370dbff, 7690 mediumseagreen: 0x3cb371ff, 7691 mediumslateblue: 0x7b68eeff, 7692 mediumspringgreen: 0x00fa9aff, 7693 mediumturquoise: 0x48d1ccff, 7694 mediumvioletred: 0xc71585ff, 7695 midnightblue: 0x191970ff, 7696 mintcream: 0xf5fffaff, 7697 mistyrose: 0xffe4e1ff, 7698 moccasin: 0xffe4b5ff, 7699 navajowhite: 0xffdeadff, 7700 navy: 0x000080ff, 7701 oldlace: 0xfdf5e6ff, 7702 olive: 0x808000ff, 7703 olivedrab: 0x6b8e23ff, 7704 orange: 0xffa500ff, 7705 orangered: 0xff4500ff, 7706 orchid: 0xda70d6ff, 7707 palegoldenrod: 0xeee8aaff, 7708 palegreen: 0x98fb98ff, 7709 paleturquoise: 0xafeeeeff, 7710 palevioletred: 0xdb7093ff, 7711 papayawhip: 0xffefd5ff, 7712 peachpuff: 0xffdab9ff, 7713 peru: 0xcd853fff, 7714 pink: 0xffc0cbff, 7715 plum: 0xdda0ddff, 7716 powderblue: 0xb0e0e6ff, 7717 purple: 0x800080ff, 7718 rebeccapurple: 0x663399ff, 7719 red: 0xff0000ff, 7720 rosybrown: 0xbc8f8fff, 7721 royalblue: 0x4169e1ff, 7722 saddlebrown: 0x8b4513ff, 7723 salmon: 0xfa8072ff, 7724 sandybrown: 0xf4a460ff, 7725 seagreen: 0x2e8b57ff, 7726 seashell: 0xfff5eeff, 7727 sienna: 0xa0522dff, 7728 silver: 0xc0c0c0ff, 7729 skyblue: 0x87ceebff, 7730 slateblue: 0x6a5acdff, 7731 slategray: 0x708090ff, 7732 slategrey: 0x708090ff, 7733 snow: 0xfffafaff, 7734 springgreen: 0x00ff7fff, 7735 steelblue: 0x4682b4ff, 7736 tan: 0xd2b48cff, 7737 teal: 0x008080ff, 7738 thistle: 0xd8bfd8ff, 7739 tomato: 0xff6347ff, 7740 turquoise: 0x40e0d0ff, 7741 violet: 0xee82eeff, 7742 wheat: 0xf5deb3ff, 7743 white: 0xffffffff, 7744 whitesmoke: 0xf5f5f5ff, 7745 yellow: 0xffff00ff, 7746 yellowgreen: 0x9acd32ff 7747 }; 7748 7749 // const INTEGER = '[-+]?\\d+'; 7750 var NUMBER = '[-+]?\\d*\\.?\\d+'; 7751 var PERCENTAGE = NUMBER + '%'; 7752 7753 function call() { 7754 for (var _len = arguments.length, parts = new Array(_len), _key = 0; _key < _len; _key++) { 7755 parts[_key] = arguments[_key]; 7756 } 7757 7758 return '\\(\\s*(' + parts.join(')\\s*,\\s*(') + ')\\s*\\)'; 7759 } 7760 7761 var rgb = new RegExp('rgb' + call(NUMBER, NUMBER, NUMBER)); 7762 var rgba = new RegExp('rgba' + call(NUMBER, NUMBER, NUMBER, NUMBER)); 7763 var hsl = new RegExp('hsl' + call(NUMBER, PERCENTAGE, PERCENTAGE)); 7764 var hsla = new RegExp('hsla' + call(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER)); 7765 var hex3 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/; 7766 var hex4 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/; 7767 var hex6 = /^#([0-9a-fA-F]{6})$/; 7768 var hex8 = /^#([0-9a-fA-F]{8})$/; 7769 7770 /* 7771 https://github.com/react-community/normalize-css-color 7772 7773 BSD 3-Clause License 7774 7775 Copyright (c) 2016, React Community 7776 All rights reserved. 7777 7778 Redistribution and use in source and binary forms, with or without 7779 modification, are permitted provided that the following conditions are met: 7780 7781 * Redistributions of source code must retain the above copyright notice, this 7782 list of conditions and the following disclaimer. 7783 7784 * Redistributions in binary form must reproduce the above copyright notice, 7785 this list of conditions and the following disclaimer in the documentation 7786 and/or other materials provided with the distribution. 7787 7788 * Neither the name of the copyright holder nor the names of its 7789 contributors may be used to endorse or promote products derived from 7790 this software without specific prior written permission. 7791 7792 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 7793 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 7794 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 7795 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 7796 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 7797 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 7798 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 7799 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 7800 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 7801 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 7802 */ 7803 function normalizeColor(color) { 7804 var match; 7805 7806 if (typeof color === 'number') { 7807 return color >>> 0 === color && color >= 0 && color <= 0xffffffff ? color : null; 7808 } // Ordered based on occurrences on Facebook codebase 7809 7810 7811 if (match = hex6.exec(color)) return parseInt(match[1] + 'ff', 16) >>> 0; 7812 if (colors.hasOwnProperty(color)) return colors[color]; 7813 7814 if (match = rgb.exec(color)) { 7815 return (parse255(match[1]) << 24 | // r 7816 parse255(match[2]) << 16 | // g 7817 parse255(match[3]) << 8 | // b 7818 0x000000ff) >>> // a 7819 0; 7820 } 7821 7822 if (match = rgba.exec(color)) { 7823 return (parse255(match[1]) << 24 | // r 7824 parse255(match[2]) << 16 | // g 7825 parse255(match[3]) << 8 | // b 7826 parse1(match[4])) >>> // a 7827 0; 7828 } 7829 7830 if (match = hex3.exec(color)) { 7831 return parseInt(match[1] + match[1] + // r 7832 match[2] + match[2] + // g 7833 match[3] + match[3] + // b 7834 'ff', // a 7835 16) >>> 0; 7836 } // https://drafts.csswg.org/css-color-4/#hex-notation 7837 7838 7839 if (match = hex8.exec(color)) return parseInt(match[1], 16) >>> 0; 7840 7841 if (match = hex4.exec(color)) { 7842 return parseInt(match[1] + match[1] + // r 7843 match[2] + match[2] + // g 7844 match[3] + match[3] + // b 7845 match[4] + match[4], // a 7846 16) >>> 0; 7847 } 7848 7849 if (match = hsl.exec(color)) { 7850 return (hslToRgb(parse360(match[1]), // h 7851 parsePercentage(match[2]), // s 7852 parsePercentage(match[3]) // l 7853 ) | 0x000000ff) >>> // a 7854 0; 7855 } 7856 7857 if (match = hsla.exec(color)) { 7858 return (hslToRgb(parse360(match[1]), // h 7859 parsePercentage(match[2]), // s 7860 parsePercentage(match[3]) // l 7861 ) | parse1(match[4])) >>> // a 7862 0; 7863 } 7864 7865 return null; 7866 } 7867 7868 function hue2rgb(p, q, t) { 7869 if (t < 0) t += 1; 7870 if (t > 1) t -= 1; 7871 if (t < 1 / 6) return p + (q - p) * 6 * t; 7872 if (t < 1 / 2) return q; 7873 if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6; 7874 return p; 7875 } 7876 7877 function hslToRgb(h, s, l) { 7878 var q = l < 0.5 ? l * (1 + s) : l + s - l * s; 7879 var p = 2 * l - q; 7880 var r = hue2rgb(p, q, h + 1 / 3); 7881 var g = hue2rgb(p, q, h); 7882 var b = hue2rgb(p, q, h - 1 / 3); 7883 return Math.round(r * 255) << 24 | Math.round(g * 255) << 16 | Math.round(b * 255) << 8; 7884 } 7885 7886 function parse255(str) { 7887 var int = parseInt(str, 10); 7888 if (int < 0) return 0; 7889 if (int > 255) return 255; 7890 return int; 7891 } 7892 7893 function parse360(str) { 7894 var int = parseFloat(str); 7895 return (int % 360 + 360) % 360 / 360; 7896 } 7897 7898 function parse1(str) { 7899 var num = parseFloat(str); 7900 if (num < 0) return 0; 7901 if (num > 1) return 255; 7902 return Math.round(num * 255); 7903 } 7904 7905 function parsePercentage(str) { 7906 // parseFloat conveniently ignores the final % 7907 var int = parseFloat(str); 7908 if (int < 0) return 0; 7909 if (int > 100) return 1; 7910 return int / 100; 7911 } 7912 7913 function colorToRgba(input) { 7914 var int32Color = normalizeColor(input); 7915 if (int32Color === null) return input; 7916 int32Color = int32Color || 0; 7917 var r = (int32Color & 0xff000000) >>> 24; 7918 var g = (int32Color & 0x00ff0000) >>> 16; 7919 var b = (int32Color & 0x0000ff00) >>> 8; 7920 var a = (int32Color & 0x000000ff) / 255; 7921 return "rgba(" + r + ", " + g + ", " + b + ", " + a + ")"; 7922 } // Problem: https://github.com/animatedjs/animated/pull/102 7923 // Solution: https://stackoverflow.com/questions/638565/parsing-scientific-notation-sensibly/658662 7924 7925 7926 var stringShapeRegex = /[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g; // Covers rgb, rgba, hsl, hsla 7927 // Taken from https://gist.github.com/olmokramer/82ccce673f86db7cda5e 7928 7929 var colorRegex = /(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi; // Covers color names (transparent, blue, etc.) 7930 7931 var colorNamesRegex = new RegExp("(" + Object.keys(colors).join('|') + ")", 'g'); 7932 /** 7933 * Supports string shapes by extracting numbers so new values can be computed, 7934 * and recombines those values into new strings of the same shape. Supports 7935 * things like: 7936 * 7937 * rgba(123, 42, 99, 0.36) // colors 7938 * -45deg // values with units 7939 * 0 2px 2px 0px rgba(0, 0, 0, 0.12) // box shadows 7940 */ 7941 7942 var createStringInterpolator = function createStringInterpolator(config) { 7943 // Replace colors with rgba 7944 var outputRange = config.output.map(function (rangeValue) { 7945 return rangeValue.replace(colorRegex, colorToRgba); 7946 }).map(function (rangeValue) { 7947 return rangeValue.replace(colorNamesRegex, colorToRgba); 7948 }); 7949 var outputRanges = outputRange[0].match(stringShapeRegex).map(function () { 7950 return []; 7951 }); 7952 outputRange.forEach(function (value) { 7953 value.match(stringShapeRegex).forEach(function (number, i) { 7954 return outputRanges[i].push(+number); 7955 }); 7956 }); 7957 var interpolations = outputRange[0].match(stringShapeRegex).map(function (_value, i) { 7958 return createInterpolator(_extends({}, config, { 7959 output: outputRanges[i] 7960 })); 7961 }); 7962 return function (input) { 7963 var i = 0; 7964 return outputRange[0] // 'rgba(0, 100, 200, 0)' 7965 // -> 7966 // 'rgba(${interpolations[0](input)}, ${interpolations[1](input)}, ...' 7967 .replace(stringShapeRegex, function () { 7968 return interpolations[i++](input); 7969 }) // rgba requires that the r,g,b are integers.... so we want to round them, but we *dont* want to 7970 // round the opacity (4th column). 7971 .replace(/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi, function (_, p1, p2, p3, p4) { 7972 return "rgba(" + Math.round(p1) + ", " + Math.round(p2) + ", " + Math.round(p3) + ", " + p4 + ")"; 7973 }); 7974 }; 7975 }; 7976 7977 var isUnitlessNumber = { 7978 animationIterationCount: true, 7979 borderImageOutset: true, 7980 borderImageSlice: true, 7981 borderImageWidth: true, 7982 boxFlex: true, 7983 boxFlexGroup: true, 7984 boxOrdinalGroup: true, 7985 columnCount: true, 7986 columns: true, 7987 flex: true, 7988 flexGrow: true, 7989 flexPositive: true, 7990 flexShrink: true, 7991 flexNegative: true, 7992 flexOrder: true, 7993 gridRow: true, 7994 gridRowEnd: true, 7995 gridRowSpan: true, 7996 gridRowStart: true, 7997 gridColumn: true, 7998 gridColumnEnd: true, 7999 gridColumnSpan: true, 8000 gridColumnStart: true, 8001 fontWeight: true, 8002 lineClamp: true, 8003 lineHeight: true, 8004 opacity: true, 8005 order: true, 8006 orphans: true, 8007 tabSize: true, 8008 widows: true, 8009 zIndex: true, 8010 zoom: true, 8011 // SVG-related properties 8012 fillOpacity: true, 8013 floodOpacity: true, 8014 stopOpacity: true, 8015 strokeDasharray: true, 8016 strokeDashoffset: true, 8017 strokeMiterlimit: true, 8018 strokeOpacity: true, 8019 strokeWidth: true 8020 }; 8021 8022 var prefixKey = function prefixKey(prefix, key) { 8023 return prefix + key.charAt(0).toUpperCase() + key.substring(1); 8024 }; 8025 8026 var prefixes = ['Webkit', 'Ms', 'Moz', 'O']; 8027 isUnitlessNumber = Object.keys(isUnitlessNumber).reduce(function (acc, prop) { 8028 prefixes.forEach(function (prefix) { 8029 return acc[prefixKey(prefix, prop)] = acc[prop]; 8030 }); 8031 return acc; 8032 }, isUnitlessNumber); 8033 8034 function dangerousStyleValue(name, value, isCustomProperty) { 8035 if (value == null || typeof value === 'boolean' || value === '') return ''; 8036 if (!isCustomProperty && typeof value === 'number' && value !== 0 && !(isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name])) return value + 'px'; // Presumes implicit 'px' suffix for unitless numbers 8037 8038 return ('' + value).trim(); 8039 } 8040 8041 var attributeCache = {}; 8042 injectCreateAnimatedStyle(function (style) { 8043 return new AnimatedStyle(style); 8044 }); 8045 injectDefaultElement('div'); 8046 injectStringInterpolator(createStringInterpolator); 8047 injectColorNames(colors); 8048 injectApplyAnimatedValues(function (instance, props) { 8049 if (instance.nodeType && instance.setAttribute !== undefined) { 8050 var style = props.style, 8051 children = props.children, 8052 scrollTop = props.scrollTop, 8053 scrollLeft = props.scrollLeft, 8054 attributes = _objectWithoutPropertiesLoose(props, ["style", "children", "scrollTop", "scrollLeft"]); 8055 8056 var filter = instance.nodeName === 'filter' || instance.parentNode && instance.parentNode.nodeName === 'filter'; 8057 if (scrollTop !== void 0) instance.scrollTop = scrollTop; 8058 if (scrollLeft !== void 0) instance.scrollLeft = scrollLeft; // Set textContent, if children is an animatable value 8059 8060 if (children !== void 0) instance.textContent = children; // Set styles ... 8061 8062 for (var styleName in style) { 8063 if (!style.hasOwnProperty(styleName)) continue; 8064 var isCustomProperty = styleName.indexOf('--') === 0; 8065 var styleValue = dangerousStyleValue(styleName, style[styleName], isCustomProperty); 8066 if (styleName === 'float') styleName = 'cssFloat'; 8067 if (isCustomProperty) instance.style.setProperty(styleName, styleValue);else instance.style[styleName] = styleValue; 8068 } // Set attributes ... 8069 8070 8071 for (var name in attributes) { 8072 // Attributes are written in dash case 8073 var dashCase = filter ? name : attributeCache[name] || (attributeCache[name] = name.replace(/([A-Z])/g, function (n) { 8074 return '-' + n.toLowerCase(); 8075 })); 8076 if (typeof instance.getAttribute(dashCase) !== 'undefined') instance.setAttribute(dashCase, attributes[name]); 8077 } 8078 8079 return; 8080 } else return false; 8081 }, function (style) { 8082 return style; 8083 }); 8084 8085 var domElements = ['a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'base', 'bdi', 'bdo', 'big', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'cite', 'code', 'col', 'colgroup', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'keygen', 'label', 'legend', 'li', 'link', 'main', 'map', 'mark', 'menu', 'menuitem', 'meta', 'meter', 'nav', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'u', 'ul', 'var', 'video', 'wbr', // SVG 8086 'circle', 'clipPath', 'defs', 'ellipse', 'foreignObject', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'svg', 'text', 'tspan']; 8087 // Extend animated with all the available THREE elements 8088 var apply = merge(createAnimatedComponent, false); 8089 var extendedAnimated = apply(domElements); 8090 8091 exports.apply = apply; 8092 exports.config = config; 8093 exports.update = update; 8094 exports.animated = extendedAnimated; 8095 exports.a = extendedAnimated; 8096 exports.interpolate = interpolate$1; 8097 exports.Globals = Globals; 8098 exports.useSpring = useSpring; 8099 exports.useTrail = useTrail; 8100 exports.useTransition = useTransition; 8101 exports.useChain = useChain; 8102 exports.useSprings = useSprings; 8103 8104 8105 /***/ }), 8106 /* 116 */, 8107 /* 117 */, 8108 /* 118 */, 8109 /* 119 */, 8110 /* 120 */, 8111 /* 121 */, 8112 /* 122 */ 8113 /***/ (function(module, __webpack_exports__, __webpack_require__) { 8114 8115 "use strict"; 8116 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Composite; }); 8117 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return useComposite; }); 8118 /* harmony import */ var _rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(15); 8119 /* harmony import */ var reakit_system_createComponent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(51); 8120 /* harmony import */ var reakit_system_createHook__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(50); 8121 /* harmony import */ var _Box_Box_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(67); 8122 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(13); 8123 /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_4__); 8124 /* harmony import */ var reakit_utils_useForkRef__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(63); 8125 /* harmony import */ var reakit_warning__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(81); 8126 /* harmony import */ var reakit_utils_useLiveRef__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(48); 8127 /* harmony import */ var reakit_utils_isSelfTarget__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(54); 8128 /* harmony import */ var reakit_utils_getActiveElement__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(57); 8129 /* harmony import */ var _Tabbable_Tabbable_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(74); 8130 /* harmony import */ var reakit_system_useCreateElement__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(79); 8131 /* harmony import */ var reakit_utils_createOnKeyDown__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(82); 8132 /* harmony import */ var reakit_utils_getDocument__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(49); 8133 /* harmony import */ var reakit_utils_fireEvent__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(97); 8134 /* harmony import */ var reakit_utils_fireKeyboardEvent__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(105); 8135 /* harmony import */ var _CompositeState_3a25dcee_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(52); 8136 8137 8138 8139 8140 8141 8142 8143 8144 8145 8146 8147 8148 8149 8150 8151 8152 8153 8154 8155 8156 8157 8158 8159 8160 8161 8162 8163 8164 var isIE11 = typeof window !== "undefined" && "msCrypto" in window; 8165 function getNextActiveElementOnBlur(event) { 8166 // IE 11 doesn't support event.relatedTarget on blur. 8167 // document.activeElement points the the next active element. 8168 // On modern browsers, document.activeElement points to the current target. 8169 if (isIE11) { 8170 var activeElement = Object(reakit_utils_getActiveElement__WEBPACK_IMPORTED_MODULE_9__[/* getActiveElement */ "a"])(event.target); 8171 return activeElement; 8172 } 8173 8174 return event.relatedTarget; 8175 } 8176 8177 var validCompositeRoles = ["combobox", "grid", "tablist", "listbox", "menu", "menubar", "toolbar", "radiogroup", "tree", "treegrid"]; 8178 var isIE11$1 = typeof window !== "undefined" && "msCrypto" in window; 8179 8180 function canProxyKeyboardEvent(event) { 8181 if (!Object(reakit_utils_isSelfTarget__WEBPACK_IMPORTED_MODULE_8__[/* isSelfTarget */ "a"])(event)) return false; 8182 if (event.metaKey) return false; 8183 if (event.key === "Tab") return false; 8184 return true; 8185 } 8186 8187 function useKeyboardEventProxy(virtual, currentItem, htmlEventHandler) { 8188 var eventHandlerRef = Object(reakit_utils_useLiveRef__WEBPACK_IMPORTED_MODULE_7__[/* useLiveRef */ "a"])(htmlEventHandler); 8189 return Object(react__WEBPACK_IMPORTED_MODULE_4__["useCallback"])(function (event) { 8190 var _eventHandlerRef$curr; 8191 8192 if (virtual && canProxyKeyboardEvent(event)) { 8193 var currentElement = currentItem === null || currentItem === void 0 ? void 0 : currentItem.ref.current; 8194 8195 if (currentElement) { 8196 Object(reakit_utils_fireKeyboardEvent__WEBPACK_IMPORTED_MODULE_15__[/* fireKeyboardEvent */ "a"])(currentElement, event.type, event); // The event will be triggered on the composite item and then 8197 // propagated up to this composite element again, so we can pretend 8198 // that it wasn't called on this component in the first place. 8199 8200 if (event.currentTarget.contains(currentElement)) { 8201 event.stopPropagation(); 8202 event.preventDefault(); 8203 return; 8204 } 8205 } 8206 } 8207 8208 (_eventHandlerRef$curr = eventHandlerRef.current) === null || _eventHandlerRef$curr === void 0 ? void 0 : _eventHandlerRef$curr.call(eventHandlerRef, event); 8209 }, [virtual, currentItem]); 8210 } // istanbul ignore next 8211 8212 8213 function useActiveElementRef(elementRef) { 8214 var activeElementRef = Object(react__WEBPACK_IMPORTED_MODULE_4__["useRef"])(null); 8215