[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/js/dist/ -> compose.js (source)

   1  this["wp"] = this["wp"] || {}; this["wp"]["compose"] =
   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 = 446);
  86  /******/ })
  87  /************************************************************************/
  88  /******/ ({
  89  
  90  /***/ 0:
  91  /***/ (function(module, exports) {
  92  
  93  (function() { module.exports = this["wp"]["element"]; }());
  94  
  95  /***/ }),
  96  
  97  /***/ 12:
  98  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  99  
 100  "use strict";
 101  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _assertThisInitialized; });
 102  function _assertThisInitialized(self) {
 103    if (self === void 0) {
 104      throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
 105    }
 106  
 107    return self;
 108  }
 109  
 110  /***/ }),
 111  
 112  /***/ 13:
 113  /***/ (function(module, exports) {
 114  
 115  (function() { module.exports = this["React"]; }());
 116  
 117  /***/ }),
 118  
 119  /***/ 14:
 120  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 121  
 122  "use strict";
 123  
 124  // EXPORTS
 125  __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _slicedToArray; });
 126  
 127  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
 128  var arrayWithHoles = __webpack_require__(38);
 129  
 130  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
 131  function _iterableToArrayLimit(arr, i) {
 132    if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
 133    var _arr = [];
 134    var _n = true;
 135    var _d = false;
 136    var _e = undefined;
 137  
 138    try {
 139      for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
 140        _arr.push(_s.value);
 141  
 142        if (i && _arr.length === i) break;
 143      }
 144    } catch (err) {
 145      _d = true;
 146      _e = err;
 147    } finally {
 148      try {
 149        if (!_n && _i["return"] != null) _i["return"]();
 150      } finally {
 151        if (_d) throw _e;
 152      }
 153    }
 154  
 155    return _arr;
 156  }
 157  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
 158  var unsupportedIterableToArray = __webpack_require__(29);
 159  
 160  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
 161  var nonIterableRest = __webpack_require__(39);
 162  
 163  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js
 164  
 165  
 166  
 167  
 168  function _slicedToArray(arr, i) {
 169    return Object(arrayWithHoles["a" /* default */])(arr) || _iterableToArrayLimit(arr, i) || Object(unsupportedIterableToArray["a" /* default */])(arr, i) || Object(nonIterableRest["a" /* default */])();
 170  }
 171  
 172  /***/ }),
 173  
 174  /***/ 149:
 175  /***/ (function(module, exports, __webpack_require__) {
 176  
 177  var e=__webpack_require__(13),n={display:"block",opacity:0,position:"absolute",top:0,left:0,height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none",zIndex:-1},t=function(t){var r=t.onResize,u=e.useRef();return function(n,t){var r=function(){return n.current&&n.current.contentDocument&&n.current.contentDocument.defaultView};function u(){t();var e=r();e&&e.addEventListener("resize",t)}e.useEffect((function(){return r()?u():n.current&&n.current.addEventListener&&n.current.addEventListener("load",u),function(){var e=r();e&&"function"==typeof e.removeEventListener&&e.removeEventListener("resize",t)}}),[])}(u,(function(){return r(u)})),e.createElement("iframe",{style:n,src:"about:blank",ref:u,"aria-hidden":!0,tabIndex:-1,frameBorder:0})},r=function(e){return{width:null!=e?e.offsetWidth:null,height:null!=e?e.offsetHeight:null}};module.exports=function(n){void 0===n&&(n=r);var u=e.useState(n(null)),o=u[0],i=u[1],c=e.useCallback((function(e){return i(n(e.current))}),[n]);return[e.useMemo((function(){return e.createElement(t,{onResize:c})}),[c]),o]};
 178  
 179  
 180  /***/ }),
 181  
 182  /***/ 150:
 183  /***/ (function(module, exports) {
 184  
 185  (function() { module.exports = this["wp"]["priorityQueue"]; }());
 186  
 187  /***/ }),
 188  
 189  /***/ 16:
 190  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 191  
 192  "use strict";
 193  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _getPrototypeOf; });
 194  function _getPrototypeOf(o) {
 195    _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
 196      return o.__proto__ || Object.getPrototypeOf(o);
 197    };
 198    return _getPrototypeOf(o);
 199  }
 200  
 201  /***/ }),
 202  
 203  /***/ 18:
 204  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 205  
 206  "use strict";
 207  
 208  // EXPORTS
 209  __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _toConsumableArray; });
 210  
 211  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
 212  var arrayLikeToArray = __webpack_require__(26);
 213  
 214  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
 215  
 216  function _arrayWithoutHoles(arr) {
 217    if (Array.isArray(arr)) return Object(arrayLikeToArray["a" /* default */])(arr);
 218  }
 219  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js
 220  var iterableToArray = __webpack_require__(35);
 221  
 222  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
 223  var unsupportedIterableToArray = __webpack_require__(29);
 224  
 225  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
 226  function _nonIterableSpread() {
 227    throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
 228  }
 229  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
 230  
 231  
 232  
 233  
 234  function _toConsumableArray(arr) {
 235    return _arrayWithoutHoles(arr) || Object(iterableToArray["a" /* default */])(arr) || Object(unsupportedIterableToArray["a" /* default */])(arr) || _nonIterableSpread();
 236  }
 237  
 238  /***/ }),
 239  
 240  /***/ 19:
 241  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 242  
 243  "use strict";
 244  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _createClass; });
 245  function _defineProperties(target, props) {
 246    for (var i = 0; i < props.length; i++) {
 247      var descriptor = props[i];
 248      descriptor.enumerable = descriptor.enumerable || false;
 249      descriptor.configurable = true;
 250      if ("value" in descriptor) descriptor.writable = true;
 251      Object.defineProperty(target, descriptor.key, descriptor);
 252    }
 253  }
 254  
 255  function _createClass(Constructor, protoProps, staticProps) {
 256    if (protoProps) _defineProperties(Constructor.prototype, protoProps);
 257    if (staticProps) _defineProperties(Constructor, staticProps);
 258    return Constructor;
 259  }
 260  
 261  /***/ }),
 262  
 263  /***/ 2:
 264  /***/ (function(module, exports) {
 265  
 266  (function() { module.exports = this["lodash"]; }());
 267  
 268  /***/ }),
 269  
 270  /***/ 20:
 271  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 272  
 273  "use strict";
 274  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _classCallCheck; });
 275  function _classCallCheck(instance, Constructor) {
 276    if (!(instance instanceof Constructor)) {
 277      throw new TypeError("Cannot call a class as a function");
 278    }
 279  }
 280  
 281  /***/ }),
 282  
 283  /***/ 22:
 284  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 285  
 286  "use strict";
 287  
 288  // EXPORTS
 289  __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _inherits; });
 290  
 291  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
 292  function _setPrototypeOf(o, p) {
 293    _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
 294      o.__proto__ = p;
 295      return o;
 296    };
 297  
 298    return _setPrototypeOf(o, p);
 299  }
 300  // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js
 301  
 302  function _inherits(subClass, superClass) {
 303    if (typeof superClass !== "function" && superClass !== null) {
 304      throw new TypeError("Super expression must either be null or a function");
 305    }
 306  
 307    subClass.prototype = Object.create(superClass && superClass.prototype, {
 308      constructor: {
 309        value: subClass,
 310        writable: true,
 311        configurable: true
 312      }
 313    });
 314    if (superClass) _setPrototypeOf(subClass, superClass);
 315  }
 316  
 317  /***/ }),
 318  
 319  /***/ 23:
 320  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 321  
 322  "use strict";
 323  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _possibleConstructorReturn; });
 324  /* harmony import */ var _helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(40);
 325  /* harmony import */ var _assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(12);
 326  
 327  
 328  function _possibleConstructorReturn(self, call) {
 329    if (call && (Object(_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(call) === "object" || typeof call === "function")) {
 330      return call;
 331    }
 332  
 333    return Object(_assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(self);
 334  }
 335  
 336  /***/ }),
 337  
 338  /***/ 26:
 339  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 340  
 341  "use strict";
 342  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayLikeToArray; });
 343  function _arrayLikeToArray(arr, len) {
 344    if (len == null || len > arr.length) len = arr.length;
 345  
 346    for (var i = 0, arr2 = new Array(len); i < len; i++) {
 347      arr2[i] = arr[i];
 348    }
 349  
 350    return arr2;
 351  }
 352  
 353  /***/ }),
 354  
 355  /***/ 271:
 356  /***/ (function(module, exports, __webpack_require__) {
 357  
 358  /*!
 359   * clipboard.js v2.0.6
 360   * https://clipboardjs.com/
 361   * 
 362   * Licensed MIT © Zeno Rocha
 363   */
 364  (function webpackUniversalModuleDefinition(root, factory) {
 365      if(true)
 366          module.exports = factory();
 367      else {}
 368  })(this, function() {
 369  return /******/ (function(modules) { // webpackBootstrap
 370  /******/     // The module cache
 371  /******/     var installedModules = {};
 372  /******/
 373  /******/     // The require function
 374  /******/ 	function __webpack_require__(moduleId) {
 375  /******/
 376  /******/         // Check if module is in cache
 377  /******/         if(installedModules[moduleId]) {
 378  /******/             return installedModules[moduleId].exports;
 379  /******/         }
 380  /******/         // Create a new module (and put it into the cache)
 381  /******/         var module = installedModules[moduleId] = {
 382  /******/             i: moduleId,
 383  /******/             l: false,
 384  /******/             exports: {}
 385  /******/         };
 386  /******/
 387  /******/         // Execute the module function
 388  /******/         modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
 389  /******/
 390  /******/         // Flag the module as loaded
 391  /******/         module.l = true;
 392  /******/
 393  /******/         // Return the exports of the module
 394  /******/         return module.exports;
 395  /******/     }
 396  /******/
 397  /******/
 398  /******/     // expose the modules object (__webpack_modules__)
 399  /******/     __webpack_require__.m = modules;
 400  /******/
 401  /******/     // expose the module cache
 402  /******/     __webpack_require__.c = installedModules;
 403  /******/
 404  /******/     // define getter function for harmony exports
 405  /******/     __webpack_require__.d = function(exports, name, getter) {
 406  /******/         if(!__webpack_require__.o(exports, name)) {
 407  /******/             Object.defineProperty(exports, name, { enumerable: true, get: getter });
 408  /******/         }
 409  /******/     };
 410  /******/
 411  /******/     // define __esModule on exports
 412  /******/     __webpack_require__.r = function(exports) {
 413  /******/         if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
 414  /******/             Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
 415  /******/         }
 416  /******/         Object.defineProperty(exports, '__esModule', { value: true });
 417  /******/     };
 418  /******/
 419  /******/     // create a fake namespace object
 420  /******/     // mode & 1: value is a module id, require it
 421  /******/     // mode & 2: merge all properties of value into the ns
 422  /******/     // mode & 4: return value when already ns object
 423  /******/     // mode & 8|1: behave like require
 424  /******/     __webpack_require__.t = function(value, mode) {
 425  /******/         if(mode & 1) value = __webpack_require__(value);
 426  /******/         if(mode & 8) return value;
 427  /******/         if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
 428  /******/         var ns = Object.create(null);
 429  /******/         __webpack_require__.r(ns);
 430  /******/         Object.defineProperty(ns, 'default', { enumerable: true, value: value });
 431  /******/         if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
 432  /******/         return ns;
 433  /******/     };
 434  /******/
 435  /******/     // getDefaultExport function for compatibility with non-harmony modules
 436  /******/     __webpack_require__.n = function(module) {
 437  /******/         var getter = module && module.__esModule ?
 438  /******/ 			function getDefault() { return module['default']; } :
 439  /******/ 			function getModuleExports() { return module; };
 440  /******/         __webpack_require__.d(getter, 'a', getter);
 441  /******/         return getter;
 442  /******/     };
 443  /******/
 444  /******/     // Object.prototype.hasOwnProperty.call
 445  /******/     __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
 446  /******/
 447  /******/     // __webpack_public_path__
 448  /******/     __webpack_require__.p = "";
 449  /******/
 450  /******/
 451  /******/     // Load entry module and return exports
 452  /******/     return __webpack_require__(__webpack_require__.s = 6);
 453  /******/ })
 454  /************************************************************************/
 455  /******/ ([
 456  /* 0 */
 457  /***/ (function(module, exports) {
 458  
 459  function select(element) {
 460      var selectedText;
 461  
 462      if (element.nodeName === 'SELECT') {
 463          element.focus();
 464  
 465          selectedText = element.value;
 466      }
 467      else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
 468          var isReadOnly = element.hasAttribute('readonly');
 469  
 470          if (!isReadOnly) {
 471              element.setAttribute('readonly', '');
 472          }
 473  
 474          element.select();
 475          element.setSelectionRange(0, element.value.length);
 476  
 477          if (!isReadOnly) {
 478              element.removeAttribute('readonly');
 479          }
 480  
 481          selectedText = element.value;
 482      }
 483      else {
 484          if (element.hasAttribute('contenteditable')) {
 485              element.focus();
 486          }
 487  
 488          var selection = window.getSelection();
 489          var range = document.createRange();
 490  
 491          range.selectNodeContents(element);
 492          selection.removeAllRanges();
 493          selection.addRange(range);
 494  
 495          selectedText = selection.toString();
 496      }
 497  
 498      return selectedText;
 499  }
 500  
 501  module.exports = select;
 502  
 503  
 504  /***/ }),
 505  /* 1 */
 506  /***/ (function(module, exports) {
 507  
 508  function E () {
 509    // Keep this empty so it's easier to inherit from
 510    // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
 511  }
 512  
 513  E.prototype = {
 514    on: function (name, callback, ctx) {
 515      var e = this.e || (this.e = {});
 516  
 517      (e[name] || (e[name] = [])).push({
 518        fn: callback,
 519        ctx: ctx
 520      });
 521  
 522      return this;
 523    },
 524  
 525    once: function (name, callback, ctx) {
 526      var self = this;
 527      function listener () {
 528        self.off(name, listener);
 529        callback.apply(ctx, arguments);
 530      };
 531  
 532      listener._ = callback
 533      return this.on(name, listener, ctx);
 534    },
 535  
 536    emit: function (name) {
 537      var data = [].slice.call(arguments, 1);
 538      var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
 539      var i = 0;
 540      var len = evtArr.length;
 541  
 542      for (i; i < len; i++) {
 543        evtArr[i].fn.apply(evtArr[i].ctx, data);
 544      }
 545  
 546      return this;
 547    },
 548  
 549    off: function (name, callback) {
 550      var e = this.e || (this.e = {});
 551      var evts = e[name];
 552      var liveEvents = [];
 553  
 554      if (evts && callback) {
 555        for (var i = 0, len = evts.length; i < len; i++) {
 556          if (evts[i].fn !== callback && evts[i].fn._ !== callback)
 557            liveEvents.push(evts[i]);
 558        }
 559      }
 560  
 561      // Remove event from queue to prevent memory leak
 562      // Suggested by https://github.com/lazd
 563      // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
 564  
 565      (liveEvents.length)
 566        ? e[name] = liveEvents
 567        : delete e[name];
 568  
 569      return this;
 570    }
 571  };
 572  
 573  module.exports = E;
 574  module.exports.TinyEmitter = E;
 575  
 576  
 577  /***/ }),
 578  /* 2 */
 579  /***/ (function(module, exports, __webpack_require__) {
 580  
 581  var is = __webpack_require__(3);
 582  var delegate = __webpack_require__(4);
 583  
 584  /**
 585   * Validates all params and calls the right
 586   * listener function based on its target type.
 587   *
 588   * @param {String|HTMLElement|HTMLCollection|NodeList} target
 589   * @param {String} type
 590   * @param {Function} callback
 591   * @return {Object}
 592   */
 593  function listen(target, type, callback) {
 594      if (!target && !type && !callback) {
 595          throw new Error('Missing required arguments');
 596      }
 597  
 598      if (!is.string(type)) {
 599          throw new TypeError('Second argument must be a String');
 600      }
 601  
 602      if (!is.fn(callback)) {
 603          throw new TypeError('Third argument must be a Function');
 604      }
 605  
 606      if (is.node(target)) {
 607          return listenNode(target, type, callback);
 608      }
 609      else if (is.nodeList(target)) {
 610          return listenNodeList(target, type, callback);
 611      }
 612      else if (is.string(target)) {
 613          return listenSelector(target, type, callback);
 614      }
 615      else {
 616          throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
 617      }
 618  }
 619  
 620  /**
 621   * Adds an event listener to a HTML element
 622   * and returns a remove listener function.
 623   *
 624   * @param {HTMLElement} node
 625   * @param {String} type
 626   * @param {Function} callback
 627   * @return {Object}
 628   */
 629  function listenNode(node, type, callback) {
 630      node.addEventListener(type, callback);
 631  
 632      return {
 633          destroy: function() {
 634              node.removeEventListener(type, callback);
 635          }
 636      }
 637  }
 638  
 639  /**
 640   * Add an event listener to a list of HTML elements
 641   * and returns a remove listener function.
 642   *
 643   * @param {NodeList|HTMLCollection} nodeList
 644   * @param {String} type
 645   * @param {Function} callback
 646   * @return {Object}
 647   */
 648  function listenNodeList(nodeList, type, callback) {
 649      Array.prototype.forEach.call(nodeList, function(node) {
 650          node.addEventListener(type, callback);
 651      });
 652  
 653      return {
 654          destroy: function() {
 655              Array.prototype.forEach.call(nodeList, function(node) {
 656                  node.removeEventListener(type, callback);
 657              });
 658          }
 659      }
 660  }
 661  
 662  /**
 663   * Add an event listener to a selector
 664   * and returns a remove listener function.
 665   *
 666   * @param {String} selector
 667   * @param {String} type
 668   * @param {Function} callback
 669   * @return {Object}
 670   */
 671  function listenSelector(selector, type, callback) {
 672      return delegate(document.body, selector, type, callback);
 673  }
 674  
 675  module.exports = listen;
 676  
 677  
 678  /***/ }),
 679  /* 3 */
 680  /***/ (function(module, exports) {
 681  
 682  /**
 683   * Check if argument is a HTML element.
 684   *
 685   * @param {Object} value
 686   * @return {Boolean}
 687   */
 688  exports.node = function(value) {
 689      return value !== undefined
 690          && value instanceof HTMLElement
 691          && value.nodeType === 1;
 692  };
 693  
 694  /**
 695   * Check if argument is a list of HTML elements.
 696   *
 697   * @param {Object} value
 698   * @return {Boolean}
 699   */
 700  exports.nodeList = function(value) {
 701      var type = Object.prototype.toString.call(value);
 702  
 703      return value !== undefined
 704          && (type === '[object NodeList]' || type === '[object HTMLCollection]')
 705          && ('length' in value)
 706          && (value.length === 0 || exports.node(value[0]));
 707  };
 708  
 709  /**
 710   * Check if argument is a string.
 711   *
 712   * @param {Object} value
 713   * @return {Boolean}
 714   */
 715  exports.string = function(value) {
 716      return typeof value === 'string'
 717          || value instanceof String;
 718  };
 719  
 720  /**
 721   * Check if argument is a function.
 722   *
 723   * @param {Object} value
 724   * @return {Boolean}
 725   */
 726  exports.fn = function(value) {
 727      var type = Object.prototype.toString.call(value);
 728  
 729      return type === '[object Function]';
 730  };
 731  
 732  
 733  /***/ }),
 734  /* 4 */
 735  /***/ (function(module, exports, __webpack_require__) {
 736  
 737  var closest = __webpack_require__(5);
 738  
 739  /**
 740   * Delegates event to a selector.
 741   *
 742   * @param {Element} element
 743   * @param {String} selector
 744   * @param {String} type
 745   * @param {Function} callback
 746   * @param {Boolean} useCapture
 747   * @return {Object}
 748   */
 749  function _delegate(element, selector, type, callback, useCapture) {
 750      var listenerFn = listener.apply(this, arguments);
 751  
 752      element.addEventListener(type, listenerFn, useCapture);
 753  
 754      return {
 755          destroy: function() {
 756              element.removeEventListener(type, listenerFn, useCapture);
 757          }
 758      }
 759  }
 760  
 761  /**
 762   * Delegates event to a selector.
 763   *
 764   * @param {Element|String|Array} [elements]
 765   * @param {String} selector
 766   * @param {String} type
 767   * @param {Function} callback
 768   * @param {Boolean} useCapture
 769   * @return {Object}
 770   */
 771  function delegate(elements, selector, type, callback, useCapture) {
 772      // Handle the regular Element usage
 773      if (typeof elements.addEventListener === 'function') {
 774          return _delegate.apply(null, arguments);
 775      }
 776  
 777      // Handle Element-less usage, it defaults to global delegation
 778      if (typeof type === 'function') {
 779          // Use `document` as the first parameter, then apply arguments
 780          // This is a short way to .unshift `arguments` without running into deoptimizations
 781          return _delegate.bind(null, document).apply(null, arguments);
 782      }
 783  
 784      // Handle Selector-based usage
 785      if (typeof elements === 'string') {
 786          elements = document.querySelectorAll(elements);
 787      }
 788  
 789      // Handle Array-like based usage
 790      return Array.prototype.map.call(elements, function (element) {
 791          return _delegate(element, selector, type, callback, useCapture);
 792      });
 793  }
 794  
 795  /**
 796   * Finds closest match and invokes callback.
 797   *
 798   * @param {Element} element
 799   * @param {String} selector
 800   * @param {String} type
 801   * @param {Function} callback
 802   * @return {Function}
 803   */
 804  function listener(element, selector, type, callback) {
 805      return function(e) {
 806          e.delegateTarget = closest(e.target, selector);
 807  
 808          if (e.delegateTarget) {
 809              callback.call(element, e);
 810          }
 811      }
 812  }
 813  
 814  module.exports = delegate;
 815  
 816  
 817  /***/ }),
 818  /* 5 */
 819  /***/ (function(module, exports) {
 820  
 821  var DOCUMENT_NODE_TYPE = 9;
 822  
 823  /**
 824   * A polyfill for Element.matches()
 825   */
 826  if (typeof Element !== 'undefined' && !Element.prototype.matches) {
 827      var proto = Element.prototype;
 828  
 829      proto.matches = proto.matchesSelector ||
 830                      proto.mozMatchesSelector ||
 831                      proto.msMatchesSelector ||
 832                      proto.oMatchesSelector ||
 833                      proto.webkitMatchesSelector;
 834  }
 835  
 836  /**
 837   * Finds the closest parent that matches a selector.
 838   *
 839   * @param {Element} element
 840   * @param {String} selector
 841   * @return {Function}
 842   */
 843  function closest (element, selector) {
 844      while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
 845          if (typeof element.matches === 'function' &&
 846              element.matches(selector)) {
 847            return element;
 848          }
 849          element = element.parentNode;
 850      }
 851  }
 852  
 853  module.exports = closest;
 854  
 855  
 856  /***/ }),
 857  /* 6 */
 858  /***/ (function(module, __webpack_exports__, __webpack_require__) {
 859  
 860  "use strict";
 861  __webpack_require__.r(__webpack_exports__);
 862  
 863  // EXTERNAL MODULE: ./node_modules/select/src/select.js
 864  var src_select = __webpack_require__(0);
 865  var select_default = /*#__PURE__*/__webpack_require__.n(src_select);
 866  
 867  // CONCATENATED MODULE: ./src/clipboard-action.js
 868  var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
 869  
 870  var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
 871  
 872  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 873  
 874  
 875  
 876  /**
 877   * Inner class which performs selection from either `text` or `target`
 878   * properties and then executes copy or cut operations.
 879   */
 880  
 881  var clipboard_action_ClipboardAction = function () {
 882      /**
 883       * @param {Object} options
 884       */
 885      function ClipboardAction(options) {
 886          _classCallCheck(this, ClipboardAction);
 887  
 888          this.resolveOptions(options);
 889          this.initSelection();
 890      }
 891  
 892      /**
 893       * Defines base properties passed from constructor.
 894       * @param {Object} options
 895       */
 896  
 897  
 898      _createClass(ClipboardAction, [{
 899          key: 'resolveOptions',
 900          value: function resolveOptions() {
 901              var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
 902  
 903              this.action = options.action;
 904              this.container = options.container;
 905              this.emitter = options.emitter;
 906              this.target = options.target;
 907              this.text = options.text;
 908              this.trigger = options.trigger;
 909  
 910              this.selectedText = '';
 911          }
 912  
 913          /**
 914           * Decides which selection strategy is going to be applied based
 915           * on the existence of `text` and `target` properties.
 916           */
 917  
 918      }, {
 919          key: 'initSelection',
 920          value: function initSelection() {
 921              if (this.text) {
 922                  this.selectFake();
 923              } else if (this.target) {
 924                  this.selectTarget();
 925              }
 926          }
 927  
 928          /**
 929           * Creates a fake textarea element, sets its value from `text` property,
 930           * and makes a selection on it.
 931           */
 932  
 933      }, {
 934          key: 'selectFake',
 935          value: function selectFake() {
 936              var _this = this;
 937  
 938              var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
 939  
 940              this.removeFake();
 941  
 942              this.fakeHandlerCallback = function () {
 943                  return _this.removeFake();
 944              };
 945              this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
 946  
 947              this.fakeElem = document.createElement('textarea');
 948              // Prevent zooming on iOS
 949              this.fakeElem.style.fontSize = '12pt';
 950              // Reset box model
 951              this.fakeElem.style.border = '0';
 952              this.fakeElem.style.padding = '0';
 953              this.fakeElem.style.margin = '0';
 954              // Move element out of screen horizontally
 955              this.fakeElem.style.position = 'absolute';
 956              this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
 957              // Move element to the same position vertically
 958              var yPosition = window.pageYOffset || document.documentElement.scrollTop;
 959              this.fakeElem.style.top = yPosition + 'px';
 960  
 961              this.fakeElem.setAttribute('readonly', '');
 962              this.fakeElem.value = this.text;
 963  
 964              this.container.appendChild(this.fakeElem);
 965  
 966              this.selectedText = select_default()(this.fakeElem);
 967              this.copyText();
 968          }
 969  
 970          /**
 971           * Only removes the fake element after another click event, that way
 972           * a user can hit `Ctrl+C` to copy because selection still exists.
 973           */
 974  
 975      }, {
 976          key: 'removeFake',
 977          value: function removeFake() {
 978              if (this.fakeHandler) {
 979                  this.container.removeEventListener('click', this.fakeHandlerCallback);
 980                  this.fakeHandler = null;
 981                  this.fakeHandlerCallback = null;
 982              }
 983  
 984              if (this.fakeElem) {
 985                  this.container.removeChild(this.fakeElem);
 986                  this.fakeElem = null;
 987              }
 988          }
 989  
 990          /**
 991           * Selects the content from element passed on `target` property.
 992           */
 993  
 994      }, {
 995          key: 'selectTarget',
 996          value: function selectTarget() {
 997              this.selectedText = select_default()(this.target);
 998              this.copyText();
 999          }
1000  
1001          /**
1002           * Executes the copy operation based on the current selection.
1003           */
1004  
1005      }, {
1006          key: 'copyText',
1007          value: function copyText() {
1008              var succeeded = void 0;
1009  
1010              try {
1011                  succeeded = document.execCommand(this.action);
1012              } catch (err) {
1013                  succeeded = false;
1014              }
1015  
1016              this.handleResult(succeeded);
1017          }
1018  
1019          /**
1020           * Fires an event based on the copy operation result.
1021           * @param {Boolean} succeeded
1022           */
1023  
1024      }, {
1025          key: 'handleResult',
1026          value: function handleResult(succeeded) {
1027              this.emitter.emit(succeeded ? 'success' : 'error', {
1028                  action: this.action,
1029                  text: this.selectedText,
1030                  trigger: this.trigger,
1031                  clearSelection: this.clearSelection.bind(this)
1032              });
1033          }
1034  
1035          /**
1036           * Moves focus away from `target` and back to the trigger, removes current selection.
1037           */
1038  
1039      }, {
1040          key: 'clearSelection',
1041          value: function clearSelection() {
1042              if (this.trigger) {
1043                  this.trigger.focus();
1044              }
1045              document.activeElement.blur();
1046              window.getSelection().removeAllRanges();
1047          }
1048  
1049          /**
1050           * Sets the `action` to be performed which can be either 'copy' or 'cut'.
1051           * @param {String} action
1052           */
1053  
1054      }, {
1055          key: 'destroy',
1056  
1057  
1058          /**
1059           * Destroy lifecycle.
1060           */
1061          value: function destroy() {
1062              this.removeFake();
1063          }
1064      }, {
1065          key: 'action',
1066          set: function set() {
1067              var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
1068  
1069              this._action = action;
1070  
1071              if (this._action !== 'copy' && this._action !== 'cut') {
1072                  throw new Error('Invalid "action" value, use either "copy" or "cut"');
1073              }
1074          }
1075  
1076          /**
1077           * Gets the `action` property.
1078           * @return {String}
1079           */
1080          ,
1081          get: function get() {
1082              return this._action;
1083          }
1084  
1085          /**
1086           * Sets the `target` property using an element
1087           * that will be have its content copied.
1088           * @param {Element} target
1089           */
1090  
1091      }, {
1092          key: 'target',
1093          set: function set(target) {
1094              if (target !== undefined) {
1095                  if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
1096                      if (this.action === 'copy' && target.hasAttribute('disabled')) {
1097                          throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
1098                      }
1099  
1100                      if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
1101                          throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
1102                      }
1103  
1104                      this._target = target;
1105                  } else {
1106                      throw new Error('Invalid "target" value, use a valid Element');
1107                  }
1108              }
1109          }
1110  
1111          /**
1112           * Gets the `target` property.
1113           * @return {String|HTMLElement}
1114           */
1115          ,
1116          get: function get() {
1117              return this._target;
1118          }
1119      }]);
1120  
1121      return ClipboardAction;
1122  }();
1123  
1124  /* harmony default export */ var clipboard_action = (clipboard_action_ClipboardAction);
1125  // EXTERNAL MODULE: ./node_modules/tiny-emitter/index.js
1126  var tiny_emitter = __webpack_require__(1);
1127  var tiny_emitter_default = /*#__PURE__*/__webpack_require__.n(tiny_emitter);
1128  
1129  // EXTERNAL MODULE: ./node_modules/good-listener/src/listen.js
1130  var listen = __webpack_require__(2);
1131  var listen_default = /*#__PURE__*/__webpack_require__.n(listen);
1132  
1133  // CONCATENATED MODULE: ./src/clipboard.js
1134  var clipboard_typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
1135  
1136  var clipboard_createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
1137  
1138  function clipboard_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1139  
1140  function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
1141  
1142  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
1143  
1144  
1145  
1146  
1147  
1148  /**
1149   * Base class which takes one or more elements, adds event listeners to them,
1150   * and instantiates a new `ClipboardAction` on each click.
1151   */
1152  
1153  var clipboard_Clipboard = function (_Emitter) {
1154      _inherits(Clipboard, _Emitter);
1155  
1156      /**
1157       * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
1158       * @param {Object} options
1159       */
1160      function Clipboard(trigger, options) {
1161          clipboard_classCallCheck(this, Clipboard);
1162  
1163          var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
1164  
1165          _this.resolveOptions(options);
1166          _this.listenClick(trigger);
1167          return _this;
1168      }
1169  
1170      /**
1171       * Defines if attributes would be resolved using internal setter functions
1172       * or custom functions that were passed in the constructor.
1173       * @param {Object} options
1174       */
1175  
1176  
1177      clipboard_createClass(Clipboard, [{
1178          key: 'resolveOptions',
1179          value: function resolveOptions() {
1180              var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1181  
1182              this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
1183              this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
1184              this.text = typeof options.text === 'function' ? options.text : this.defaultText;
1185              this.container = clipboard_typeof(options.container) === 'object' ? options.container : document.body;
1186          }
1187  
1188          /**
1189           * Adds a click event listener to the passed trigger.
1190           * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
1191           */
1192  
1193      }, {
1194          key: 'listenClick',
1195          value: function listenClick(trigger) {
1196              var _this2 = this;
1197  
1198              this.listener = listen_default()(trigger, 'click', function (e) {
1199                  return _this2.onClick(e);
1200              });
1201          }
1202  
1203          /**
1204           * Defines a new `ClipboardAction` on each click event.
1205           * @param {Event} e
1206           */
1207  
1208      }, {
1209          key: 'onClick',
1210          value: function onClick(e) {
1211              var trigger = e.delegateTarget || e.currentTarget;
1212  
1213              if (this.clipboardAction) {
1214                  this.clipboardAction = null;
1215              }
1216  
1217              this.clipboardAction = new clipboard_action({
1218                  action: this.action(trigger),
1219                  target: this.target(trigger),
1220                  text: this.text(trigger),
1221                  container: this.container,
1222                  trigger: trigger,
1223                  emitter: this
1224              });
1225          }
1226  
1227          /**
1228           * Default `action` lookup function.
1229           * @param {Element} trigger
1230           */
1231  
1232      }, {
1233          key: 'defaultAction',
1234          value: function defaultAction(trigger) {
1235              return getAttributeValue('action', trigger);
1236          }
1237  
1238          /**
1239           * Default `target` lookup function.
1240           * @param {Element} trigger
1241           */
1242  
1243      }, {
1244          key: 'defaultTarget',
1245          value: function defaultTarget(trigger) {
1246              var selector = getAttributeValue('target', trigger);
1247  
1248              if (selector) {
1249                  return document.querySelector(selector);
1250              }
1251          }
1252  
1253          /**
1254           * Returns the support of the given action, or all actions if no action is
1255           * given.
1256           * @param {String} [action]
1257           */
1258  
1259      }, {
1260          key: 'defaultText',
1261  
1262  
1263          /**
1264           * Default `text` lookup function.
1265           * @param {Element} trigger
1266           */
1267          value: function defaultText(trigger) {
1268              return getAttributeValue('text', trigger);
1269          }
1270  
1271          /**
1272           * Destroy lifecycle.
1273           */
1274  
1275      }, {
1276          key: 'destroy',
1277          value: function destroy() {
1278              this.listener.destroy();
1279  
1280              if (this.clipboardAction) {
1281                  this.clipboardAction.destroy();
1282                  this.clipboardAction = null;
1283              }
1284          }
1285      }], [{
1286          key: 'isSupported',
1287          value: function isSupported() {
1288              var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
1289  
1290              var actions = typeof action === 'string' ? [action] : action;
1291              var support = !!document.queryCommandSupported;
1292  
1293              actions.forEach(function (action) {
1294                  support = support && !!document.queryCommandSupported(action);
1295              });
1296  
1297              return support;
1298          }
1299      }]);
1300  
1301      return Clipboard;
1302  }(tiny_emitter_default.a);
1303  
1304  /**
1305   * Helper function to retrieve attribute value.
1306   * @param {String} suffix
1307   * @param {Element} element
1308   */
1309  
1310  
1311  function getAttributeValue(suffix, element) {
1312      var attribute = 'data-clipboard-' + suffix;
1313  
1314      if (!element.hasAttribute(attribute)) {
1315          return;
1316      }
1317  
1318      return element.getAttribute(attribute);
1319  }
1320  
1321  /* harmony default export */ var clipboard = __webpack_exports__["default"] = (clipboard_Clipboard);
1322  
1323  /***/ })
1324  /******/ ])["default"];
1325  });
1326  
1327  /***/ }),
1328  
1329  /***/ 272:
1330  /***/ (function(module, exports, __webpack_require__) {
1331  
1332  var __WEBPACK_AMD_DEFINE_RESULT__;/*global define:false */
1333  /**
1334   * Copyright 2012-2017 Craig Campbell
1335   *
1336   * Licensed under the Apache License, Version 2.0 (the "License");
1337   * you may not use this file except in compliance with the License.
1338   * You may obtain a copy of the License at
1339   *
1340   * http://www.apache.org/licenses/LICENSE-2.0
1341   *
1342   * Unless required by applicable law or agreed to in writing, software
1343   * distributed under the License is distributed on an "AS IS" BASIS,
1344   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1345   * See the License for the specific language governing permissions and
1346   * limitations under the License.
1347   *
1348   * Mousetrap is a simple keyboard shortcut library for Javascript with
1349   * no external dependencies
1350   *
1351   * @version 1.6.5
1352   * @url craig.is/killing/mice
1353   */
1354  (function(window, document, undefined) {
1355  
1356      // Check if mousetrap is used inside browser, if not, return
1357      if (!window) {
1358          return;
1359      }
1360  
1361      /**
1362       * mapping of special keycodes to their corresponding keys
1363       *
1364       * everything in this dictionary cannot use keypress events
1365       * so it has to be here to map to the correct keycodes for
1366       * keyup/keydown events
1367       *
1368       * @type {Object}
1369       */
1370      var _MAP = {
1371          8: 'backspace',
1372          9: 'tab',
1373          13: 'enter',
1374          16: 'shift',
1375          17: 'ctrl',
1376          18: 'alt',
1377          20: 'capslock',
1378          27: 'esc',
1379          32: 'space',
1380          33: 'pageup',
1381          34: 'pagedown',
1382          35: 'end',
1383          36: 'home',
1384          37: 'left',
1385          38: 'up',
1386          39: 'right',
1387          40: 'down',
1388          45: 'ins',
1389          46: 'del',
1390          91: 'meta',
1391          93: 'meta',
1392          224: 'meta'
1393      };
1394  
1395      /**
1396       * mapping for special characters so they can support
1397       *
1398       * this dictionary is only used incase you want to bind a
1399       * keyup or keydown event to one of these keys
1400       *
1401       * @type {Object}
1402       */
1403      var _KEYCODE_MAP = {
1404          106: '*',
1405          107: '+',
1406          109: '-',
1407          110: '.',
1408          111 : '/',
1409          186: ';',
1410          187: '=',
1411          188: ',',
1412          189: '-',
1413          190: '.',
1414          191: '/',
1415          192: '`',
1416          219: '[',
1417          220: '\\',
1418          221: ']',
1419          222: '\''
1420      };
1421  
1422      /**
1423       * this is a mapping of keys that require shift on a US keypad
1424       * back to the non shift equivelents
1425       *
1426       * this is so you can use keyup events with these keys
1427       *
1428       * note that this will only work reliably on US keyboards
1429       *
1430       * @type {Object}
1431       */
1432      var _SHIFT_MAP = {
1433          '~': '`',
1434          '!': '1',
1435          '@': '2',
1436          '#': '3',
1437          '$': '4',
1438          '%': '5',
1439          '^': '6',
1440          '&': '7',
1441          '*': '8',
1442          '(': '9',
1443          ')': '0',
1444          '_': '-',
1445          '+': '=',
1446          ':': ';',
1447          '\"': '\'',
1448          '<': ',',
1449          '>': '.',
1450          '?': '/',
1451          '|': '\\'
1452      };
1453  
1454      /**
1455       * this is a list of special strings you can use to map
1456       * to modifier keys when you specify your keyboard shortcuts
1457       *
1458       * @type {Object}
1459       */
1460      var _SPECIAL_ALIASES = {
1461          'option': 'alt',
1462          'command': 'meta',
1463          'return': 'enter',
1464          'escape': 'esc',
1465          'plus': '+',
1466          'mod': /Mac|iPod|iPhone|iPad/.test(navigator.platform) ? 'meta' : 'ctrl'
1467      };
1468  
1469      /**
1470       * variable to store the flipped version of _MAP from above
1471       * needed to check if we should use keypress or not when no action
1472       * is specified
1473       *
1474       * @type {Object|undefined}
1475       */
1476      var _REVERSE_MAP;
1477  
1478      /**
1479       * loop through the f keys, f1 to f19 and add them to the map
1480       * programatically
1481       */
1482      for (var i = 1; i < 20; ++i) {
1483          _MAP[111 + i] = 'f' + i;
1484      }
1485  
1486      /**
1487       * loop through to map numbers on the numeric keypad
1488       */
1489      for (i = 0; i <= 9; ++i) {
1490  
1491          // This needs to use a string cause otherwise since 0 is falsey
1492          // mousetrap will never fire for numpad 0 pressed as part of a keydown
1493          // event.
1494          //
1495          // @see https://github.com/ccampbell/mousetrap/pull/258
1496          _MAP[i + 96] = i.toString();
1497      }
1498  
1499      /**
1500       * cross browser add event method
1501       *
1502       * @param {Element|HTMLDocument} object
1503       * @param {string} type
1504       * @param {Function} callback
1505       * @returns void
1506       */
1507      function _addEvent(object, type, callback) {
1508          if (object.addEventListener) {
1509              object.addEventListener(type, callback, false);
1510              return;
1511          }
1512  
1513          object.attachEvent('on' + type, callback);
1514      }
1515  
1516      /**
1517       * takes the event and returns the key character
1518       *
1519       * @param {Event} e
1520       * @return {string}
1521       */
1522      function _characterFromEvent(e) {
1523  
1524          // for keypress events we should return the character as is
1525          if (e.type == 'keypress') {
1526              var character = String.fromCharCode(e.which);
1527  
1528              // if the shift key is not pressed then it is safe to assume
1529              // that we want the character to be lowercase.  this means if
1530              // you accidentally have caps lock on then your key bindings
1531              // will continue to work
1532              //
1533              // the only side effect that might not be desired is if you
1534              // bind something like 'A' cause you want to trigger an
1535              // event when capital A is pressed caps lock will no longer
1536              // trigger the event.  shift+a will though.
1537              if (!e.shiftKey) {
1538                  character = character.toLowerCase();
1539              }
1540  
1541              return character;
1542          }
1543  
1544          // for non keypress events the special maps are needed
1545          if (_MAP[e.which]) {
1546              return _MAP[e.which];
1547          }
1548  
1549          if (_KEYCODE_MAP[e.which]) {
1550              return _KEYCODE_MAP[e.which];
1551          }
1552  
1553          // if it is not in the special map
1554  
1555          // with keydown and keyup events the character seems to always
1556          // come in as an uppercase character whether you are pressing shift
1557          // or not.  we should make sure it is always lowercase for comparisons
1558          return String.fromCharCode(e.which).toLowerCase();
1559      }
1560  
1561      /**
1562       * checks if two arrays are equal
1563       *
1564       * @param {Array} modifiers1
1565       * @param {Array} modifiers2
1566       * @returns {boolean}
1567       */
1568      function _modifiersMatch(modifiers1, modifiers2) {
1569          return modifiers1.sort().join(',') === modifiers2.sort().join(',');
1570      }
1571  
1572      /**
1573       * takes a key event and figures out what the modifiers are
1574       *
1575       * @param {Event} e
1576       * @returns {Array}
1577       */
1578      function _eventModifiers(e) {
1579          var modifiers = [];
1580  
1581          if (e.shiftKey) {
1582              modifiers.push('shift');
1583          }
1584  
1585          if (e.altKey) {
1586              modifiers.push('alt');
1587          }
1588  
1589          if (e.ctrlKey) {
1590              modifiers.push('ctrl');
1591          }
1592  
1593          if (e.metaKey) {
1594              modifiers.push('meta');
1595          }
1596  
1597          return modifiers;
1598      }
1599  
1600      /**
1601       * prevents default for this event
1602       *
1603       * @param {Event} e
1604       * @returns void
1605       */
1606      function _preventDefault(e) {
1607          if (e.preventDefault) {
1608              e.preventDefault();
1609              return;
1610          }
1611  
1612          e.returnValue = false;
1613      }
1614  
1615      /**
1616       * stops propogation for this event
1617       *
1618       * @param {Event} e
1619       * @returns void
1620       */
1621      function _stopPropagation(e) {
1622          if (e.stopPropagation) {
1623              e.stopPropagation();
1624              return;
1625          }
1626  
1627          e.cancelBubble = true;
1628      }
1629  
1630      /**
1631       * determines if the keycode specified is a modifier key or not
1632       *
1633       * @param {string} key
1634       * @returns {boolean}
1635       */
1636      function _isModifier(key) {
1637          return key == 'shift' || key == 'ctrl' || key == 'alt' || key == 'meta';
1638      }
1639  
1640      /**
1641       * reverses the map lookup so that we can look for specific keys
1642       * to see what can and can't use keypress
1643       *
1644       * @return {Object}
1645       */
1646      function _getReverseMap() {
1647          if (!_REVERSE_MAP) {
1648              _REVERSE_MAP = {};
1649              for (var key in _MAP) {
1650  
1651                  // pull out the numeric keypad from here cause keypress should
1652                  // be able to detect the keys from the character
1653                  if (key > 95 && key < 112) {
1654                      continue;
1655                  }
1656  
1657                  if (_MAP.hasOwnProperty(key)) {
1658                      _REVERSE_MAP[_MAP[key]] = key;
1659                  }
1660              }
1661          }
1662          return _REVERSE_MAP;
1663      }
1664  
1665      /**
1666       * picks the best action based on the key combination
1667       *
1668       * @param {string} key - character for key
1669       * @param {Array} modifiers
1670       * @param {string=} action passed in
1671       */
1672      function _pickBestAction(key, modifiers, action) {
1673  
1674          // if no action was picked in we should try to pick the one
1675          // that we think would work best for this key
1676          if (!action) {
1677              action = _getReverseMap()[key] ? 'keydown' : 'keypress';
1678          }
1679  
1680          // modifier keys don't work as expected with keypress,
1681          // switch to keydown
1682          if (action == 'keypress' && modifiers.length) {
1683              action = 'keydown';
1684          }
1685  
1686          return action;
1687      }
1688  
1689      /**
1690       * Converts from a string key combination to an array
1691       *
1692       * @param  {string} combination like "command+shift+l"
1693       * @return {Array}
1694       */
1695      function _keysFromString(combination) {
1696          if (combination === '+') {
1697              return ['+'];
1698          }
1699  
1700          combination = combination.replace(/\+{2}/g, '+plus');
1701          return combination.split('+');
1702      }
1703  
1704      /**
1705       * Gets info for a specific key combination
1706       *
1707       * @param  {string} combination key combination ("command+s" or "a" or "*")
1708       * @param  {string=} action
1709       * @returns {Object}
1710       */
1711      function _getKeyInfo(combination, action) {
1712          var keys;
1713          var key;
1714          var i;
1715          var modifiers = [];
1716  
1717          // take the keys from this pattern and figure out what the actual
1718          // pattern is all about
1719          keys = _keysFromString(combination);
1720  
1721          for (i = 0; i < keys.length; ++i) {
1722              key = keys[i];
1723  
1724              // normalize key names
1725              if (_SPECIAL_ALIASES[key]) {
1726                  key = _SPECIAL_ALIASES[key];
1727              }
1728  
1729              // if this is not a keypress event then we should
1730              // be smart about using shift keys
1731              // this will only work for US keyboards however
1732              if (action && action != 'keypress' && _SHIFT_MAP[key]) {
1733                  key = _SHIFT_MAP[key];
1734                  modifiers.push('shift');
1735              }
1736  
1737              // if this key is a modifier then add it to the list of modifiers
1738              if (_isModifier(key)) {
1739                  modifiers.push(key);
1740              }
1741          }
1742  
1743          // depending on what the key combination is
1744          // we will try to pick the best event for it
1745          action = _pickBestAction(key, modifiers, action);
1746  
1747          return {
1748              key: key,
1749              modifiers: modifiers,
1750              action: action
1751          };
1752      }
1753  
1754      function _belongsTo(element, ancestor) {
1755          if (element === null || element === document) {
1756              return false;
1757          }
1758  
1759          if (element === ancestor) {
1760              return true;
1761          }
1762  
1763          return _belongsTo(element.parentNode, ancestor);
1764      }
1765  
1766      function Mousetrap(targetElement) {
1767          var self = this;
1768  
1769          targetElement = targetElement || document;
1770  
1771          if (!(self instanceof Mousetrap)) {
1772              return new Mousetrap(targetElement);
1773          }
1774  
1775          /**
1776           * element to attach key events to
1777           *
1778           * @type {Element}
1779           */
1780          self.target = targetElement;
1781  
1782          /**
1783           * a list of all the callbacks setup via Mousetrap.bind()
1784           *
1785           * @type {Object}
1786           */
1787          self._callbacks = {};
1788  
1789          /**
1790           * direct map of string combinations to callbacks used for trigger()
1791           *
1792           * @type {Object}
1793           */
1794          self._directMap = {};
1795  
1796          /**
1797           * keeps track of what level each sequence is at since multiple
1798           * sequences can start out with the same sequence
1799           *
1800           * @type {Object}
1801           */
1802          var _sequenceLevels = {};
1803  
1804          /**
1805           * variable to store the setTimeout call
1806           *
1807           * @type {null|number}
1808           */
1809          var _resetTimer;
1810  
1811          /**
1812           * temporary state where we will ignore the next keyup
1813           *
1814           * @type {boolean|string}
1815           */
1816          var _ignoreNextKeyup = false;
1817  
1818          /**
1819           * temporary state where we will ignore the next keypress
1820           *
1821           * @type {boolean}
1822           */
1823          var _ignoreNextKeypress = false;
1824  
1825          /**
1826           * are we currently inside of a sequence?
1827           * type of action ("keyup" or "keydown" or "keypress") or false
1828           *
1829           * @type {boolean|string}
1830           */
1831          var _nextExpectedAction = false;
1832  
1833          /**
1834           * resets all sequence counters except for the ones passed in
1835           *
1836           * @param {Object} doNotReset
1837           * @returns void
1838           */
1839          function _resetSequences(doNotReset) {
1840              doNotReset = doNotReset || {};
1841  
1842              var activeSequences = false,
1843                  key;
1844  
1845              for (key in _sequenceLevels) {
1846                  if (doNotReset[key]) {
1847                      activeSequences = true;
1848                      continue;
1849                  }
1850                  _sequenceLevels[key] = 0;
1851              }
1852  
1853              if (!activeSequences) {
1854                  _nextExpectedAction = false;
1855              }
1856          }
1857  
1858          /**
1859           * finds all callbacks that match based on the keycode, modifiers,
1860           * and action
1861           *
1862           * @param {string} character
1863           * @param {Array} modifiers
1864           * @param {Event|Object} e
1865           * @param {string=} sequenceName - name of the sequence we are looking for
1866           * @param {string=} combination
1867           * @param {number=} level
1868           * @returns {Array}
1869           */
1870          function _getMatches(character, modifiers, e, sequenceName, combination, level) {
1871              var i;
1872              var callback;
1873              var matches = [];
1874              var action = e.type;
1875  
1876              // if there are no events related to this keycode
1877              if (!self._callbacks[character]) {
1878                  return [];
1879              }
1880  
1881              // if a modifier key is coming up on its own we should allow it
1882              if (action == 'keyup' && _isModifier(character)) {
1883                  modifiers = [character];
1884              }
1885  
1886              // loop through all callbacks for the key that was pressed
1887              // and see if any of them match
1888              for (i = 0; i < self._callbacks[character].length; ++i) {
1889                  callback = self._callbacks[character][i];
1890  
1891                  // if a sequence name is not specified, but this is a sequence at
1892                  // the wrong level then move onto the next match
1893                  if (!sequenceName && callback.seq && _sequenceLevels[callback.seq] != callback.level) {
1894                      continue;
1895                  }
1896  
1897                  // if the action we are looking for doesn't match the action we got
1898                  // then we should keep going
1899                  if (action != callback.action) {
1900                      continue;
1901                  }
1902  
1903                  // if this is a keypress event and the meta key and control key
1904                  // are not pressed that means that we need to only look at the
1905                  // character, otherwise check the modifiers as well
1906                  //
1907                  // chrome will not fire a keypress if meta or control is down
1908                  // safari will fire a keypress if meta or meta+shift is down
1909                  // firefox will fire a keypress if meta or control is down
1910                  if ((action == 'keypress' && !e.metaKey && !e.ctrlKey) || _modifiersMatch(modifiers, callback.modifiers)) {
1911  
1912                      // when you bind a combination or sequence a second time it
1913                      // should overwrite the first one.  if a sequenceName or
1914                      // combination is specified in this call it does just that
1915                      //
1916                      // @todo make deleting its own method?
1917                      var deleteCombo = !sequenceName && callback.combo == combination;
1918                      var deleteSequence = sequenceName && callback.seq == sequenceName && callback.level == level;
1919                      if (deleteCombo || deleteSequence) {
1920                          self._callbacks[character].splice(i, 1);
1921                      }
1922  
1923                      matches.push(callback);
1924                  }
1925              }
1926  
1927              return matches;
1928          }
1929  
1930          /**
1931           * actually calls the callback function
1932           *
1933           * if your callback function returns false this will use the jquery
1934           * convention - prevent default and stop propogation on the event
1935           *
1936           * @param {Function} callback
1937           * @param {Event} e
1938           * @returns void
1939           */
1940          function _fireCallback(callback, e, combo, sequence) {
1941  
1942              // if this event should not happen stop here
1943              if (self.stopCallback(e, e.target || e.srcElement, combo, sequence)) {
1944                  return;
1945              }
1946  
1947              if (callback(e, combo) === false) {
1948                  _preventDefault(e);
1949                  _stopPropagation(e);
1950              }
1951          }
1952  
1953          /**
1954           * handles a character key event
1955           *
1956           * @param {string} character
1957           * @param {Array} modifiers
1958           * @param {Event} e
1959           * @returns void
1960           */
1961          self._handleKey = function(character, modifiers, e) {
1962              var callbacks = _getMatches(character, modifiers, e);
1963              var i;
1964              var doNotReset = {};
1965              var maxLevel = 0;
1966              var processedSequenceCallback = false;
1967  
1968              // Calculate the maxLevel for sequences so we can only execute the longest callback sequence
1969              for (i = 0; i < callbacks.length; ++i) {
1970                  if (callbacks[i].seq) {
1971                      maxLevel = Math.max(maxLevel, callbacks[i].level);
1972                  }
1973              }
1974  
1975              // loop through matching callbacks for this key event
1976              for (i = 0; i < callbacks.length; ++i) {
1977  
1978                  // fire for all sequence callbacks
1979                  // this is because if for example you have multiple sequences
1980                  // bound such as "g i" and "g t" they both need to fire the
1981                  // callback for matching g cause otherwise you can only ever
1982                  // match the first one
1983                  if (callbacks[i].seq) {
1984  
1985                      // only fire callbacks for the maxLevel to prevent
1986                      // subsequences from also firing
1987                      //
1988                      // for example 'a option b' should not cause 'option b' to fire
1989                      // even though 'option b' is part of the other sequence
1990                      //
1991                      // any sequences that do not match here will be discarded
1992                      // below by the _resetSequences call
1993                      if (callbacks[i].level != maxLevel) {
1994                          continue;
1995                      }
1996  
1997                      processedSequenceCallback = true;
1998  
1999                      // keep a list of which sequences were matches for later
2000                      doNotReset[callbacks[i].seq] = 1;
2001                      _fireCallback(callbacks[i].callback, e, callbacks[i].combo, callbacks[i].seq);
2002                      continue;
2003                  }
2004  
2005                  // if there were no sequence matches but we are still here
2006                  // that means this is a regular match so we should fire that
2007                  if (!processedSequenceCallback) {
2008                      _fireCallback(callbacks[i].callback, e, callbacks[i].combo);
2009                  }
2010              }
2011  
2012              // if the key you pressed matches the type of sequence without
2013              // being a modifier (ie "keyup" or "keypress") then we should
2014              // reset all sequences that were not matched by this event
2015              //
2016              // this is so, for example, if you have the sequence "h a t" and you
2017              // type "h e a r t" it does not match.  in this case the "e" will
2018              // cause the sequence to reset
2019              //
2020              // modifier keys are ignored because you can have a sequence
2021              // that contains modifiers such as "enter ctrl+space" and in most
2022              // cases the modifier key will be pressed before the next key
2023              //
2024              // also if you have a sequence such as "ctrl+b a" then pressing the
2025              // "b" key will trigger a "keypress" and a "keydown"
2026              //
2027              // the "keydown" is expected when there is a modifier, but the
2028              // "keypress" ends up matching the _nextExpectedAction since it occurs
2029              // after and that causes the sequence to reset
2030              //
2031              // we ignore keypresses in a sequence that directly follow a keydown
2032              // for the same character
2033              var ignoreThisKeypress = e.type == 'keypress' && _ignoreNextKeypress;
2034              if (e.type == _nextExpectedAction && !_isModifier(character) && !ignoreThisKeypress) {
2035                  _resetSequences(doNotReset);
2036              }
2037  
2038              _ignoreNextKeypress = processedSequenceCallback && e.type == 'keydown';
2039          };
2040  
2041          /**
2042           * handles a keydown event
2043           *
2044           * @param {Event} e
2045           * @returns void
2046           */
2047          function _handleKeyEvent(e) {
2048  
2049              // normalize e.which for key events
2050              // @see http://stackoverflow.com/questions/4285627/javascript-keycode-vs-charcode-utter-confusion
2051              if (typeof e.which !== 'number') {
2052                  e.which = e.keyCode;
2053              }
2054  
2055              var character = _characterFromEvent(e);
2056  
2057              // no character found then stop
2058              if (!character) {
2059                  return;
2060              }
2061  
2062              // need to use === for the character check because the character can be 0
2063              if (e.type == 'keyup' && _ignoreNextKeyup === character) {
2064                  _ignoreNextKeyup = false;
2065                  return;
2066              }
2067  
2068              self.handleKey(character, _eventModifiers(e), e);
2069          }
2070  
2071          /**
2072           * called to set a 1 second timeout on the specified sequence
2073           *
2074           * this is so after each key press in the sequence you have 1 second
2075           * to press the next key before you have to start over
2076           *
2077           * @returns void
2078           */
2079          function _resetSequenceTimer() {
2080              clearTimeout(_resetTimer);
2081              _resetTimer = setTimeout(_resetSequences, 1000);
2082          }
2083  
2084          /**
2085           * binds a key sequence to an event
2086           *
2087           * @param {string} combo - combo specified in bind call
2088           * @param {Array} keys
2089           * @param {Function} callback
2090           * @param {string=} action
2091           * @returns void
2092           */
2093          function _bindSequence(combo, keys, callback, action) {
2094  
2095              // start off by adding a sequence level record for this combination
2096              // and setting the level to 0
2097              _sequenceLevels[combo] = 0;
2098  
2099              /**
2100               * callback to increase the sequence level for this sequence and reset
2101               * all other sequences that were active
2102               *
2103               * @param {string} nextAction
2104               * @returns {Function}
2105               */
2106              function _increaseSequence(nextAction) {
2107                  return function() {
2108                      _nextExpectedAction = nextAction;
2109                      ++_sequenceLevels[combo];
2110                      _resetSequenceTimer();
2111                  };
2112              }
2113  
2114              /**
2115               * wraps the specified callback inside of another function in order
2116               * to reset all sequence counters as soon as this sequence is done
2117               *
2118               * @param {Event} e
2119               * @returns void
2120               */
2121              function _callbackAndReset(e) {
2122                  _fireCallback(callback, e, combo);
2123  
2124                  // we should ignore the next key up if the action is key down
2125                  // or keypress.  this is so if you finish a sequence and
2126                  // release the key the final key will not trigger a keyup
2127                  if (action !== 'keyup') {
2128                      _ignoreNextKeyup = _characterFromEvent(e);
2129                  }
2130  
2131                  // weird race condition if a sequence ends with the key
2132                  // another sequence begins with
2133                  setTimeout(_resetSequences, 10);
2134              }
2135  
2136              // loop through keys one at a time and bind the appropriate callback
2137              // function.  for any key leading up to the final one it should
2138              // increase the sequence. after the final, it should reset all sequences
2139              //
2140              // if an action is specified in the original bind call then that will
2141              // be used throughout.  otherwise we will pass the action that the
2142              // next key in the sequence should match.  this allows a sequence
2143              // to mix and match keypress and keydown events depending on which
2144              // ones are better suited to the key provided
2145              for (var i = 0; i < keys.length; ++i) {
2146                  var isFinal = i + 1 === keys.length;
2147                  var wrappedCallback = isFinal ? _callbackAndReset : _increaseSequence(action || _getKeyInfo(keys[i + 1]).action);
2148                  _bindSingle(keys[i], wrappedCallback, action, combo, i);
2149              }
2150          }
2151  
2152          /**
2153           * binds a single keyboard combination
2154           *
2155           * @param {string} combination
2156           * @param {Function} callback
2157           * @param {string=} action
2158           * @param {string=} sequenceName - name of sequence if part of sequence
2159           * @param {number=} level - what part of the sequence the command is
2160           * @returns void
2161           */
2162          function _bindSingle(combination, callback, action, sequenceName, level) {
2163  
2164              // store a direct mapped reference for use with Mousetrap.trigger
2165              self._directMap[combination + ':' + action] = callback;
2166  
2167              // make sure multiple spaces in a row become a single space
2168              combination = combination.replace(/\s+/g, ' ');
2169  
2170              var sequence = combination.split(' ');
2171              var info;
2172  
2173              // if this pattern is a sequence of keys then run through this method
2174              // to reprocess each pattern one key at a time
2175              if (sequence.length > 1) {
2176                  _bindSequence(combination, sequence, callback, action);
2177                  return;
2178              }
2179  
2180              info = _getKeyInfo(combination, action);
2181  
2182              // make sure to initialize array if this is the first time
2183              // a callback is added for this key
2184              self._callbacks[info.key] = self._callbacks[info.key] || [];
2185  
2186              // remove an existing match if there is one
2187              _getMatches(info.key, info.modifiers, {type: info.action}, sequenceName, combination, level);
2188  
2189              // add this call back to the array
2190              // if it is a sequence put it at the beginning
2191              // if not put it at the end
2192              //
2193              // this is important because the way these are processed expects
2194              // the sequence ones to come first
2195              self._callbacks[info.key][sequenceName ? 'unshift' : 'push']({
2196                  callback: callback,
2197                  modifiers: info.modifiers,
2198                  action: info.action,
2199                  seq: sequenceName,
2200                  level: level,
2201                  combo: combination
2202              });
2203          }
2204  
2205          /**
2206           * binds multiple combinations to the same callback
2207           *
2208           * @param {Array} combinations
2209           * @param {Function} callback
2210           * @param {string|undefined} action
2211           * @returns void
2212           */
2213          self._bindMultiple = function(combinations, callback, action) {
2214              for (var i = 0; i < combinations.length; ++i) {
2215                  _bindSingle(combinations[i], callback, action);
2216              }
2217          };
2218  
2219          // start!
2220          _addEvent(targetElement, 'keypress', _handleKeyEvent);
2221          _addEvent(targetElement, 'keydown', _handleKeyEvent);
2222          _addEvent(targetElement, 'keyup', _handleKeyEvent);
2223      }
2224  
2225      /**
2226       * binds an event to mousetrap
2227       *
2228       * can be a single key, a combination of keys separated with +,
2229       * an array of keys, or a sequence of keys separated by spaces
2230       *
2231       * be sure to list the modifier keys first to make sure that the
2232       * correct key ends up getting bound (the last key in the pattern)
2233       *
2234       * @param {string|Array} keys
2235       * @param {Function} callback
2236       * @param {string=} action - 'keypress', 'keydown', or 'keyup'
2237       * @returns void
2238       */
2239      Mousetrap.prototype.bind = function(keys, callback, action) {
2240          var self = this;
2241          keys = keys instanceof Array ? keys : [keys];
2242          self._bindMultiple.call(self, keys, callback, action);
2243          return self;
2244      };
2245  
2246      /**
2247       * unbinds an event to mousetrap
2248       *
2249       * the unbinding sets the callback function of the specified key combo
2250       * to an empty function and deletes the corresponding key in the
2251       * _directMap dict.
2252       *
2253       * TODO: actually remove this from the _callbacks dictionary instead
2254       * of binding an empty function
2255       *
2256       * the keycombo+action has to be exactly the same as
2257       * it was defined in the bind method
2258       *
2259       * @param {string|Array} keys
2260       * @param {string} action
2261       * @returns void
2262       */
2263      Mousetrap.prototype.unbind = function(keys, action) {
2264          var self = this;
2265          return self.bind.call(self, keys, function() {}, action);
2266      };
2267  
2268      /**
2269       * triggers an event that has already been bound
2270       *
2271       * @param {string} keys
2272       * @param {string=} action
2273       * @returns void
2274       */
2275      Mousetrap.prototype.trigger = function(keys, action) {
2276          var self = this;
2277          if (self._directMap[keys + ':' + action]) {
2278              self._directMap[keys + ':' + action]({}, keys);
2279          }
2280          return self;
2281      };
2282  
2283      /**
2284       * resets the library back to its initial state.  this is useful
2285       * if you want to clear out the current keyboard shortcuts and bind
2286       * new ones - for example if you switch to another page
2287       *
2288       * @returns void
2289       */
2290      Mousetrap.prototype.reset = function() {
2291          var self = this;
2292          self._callbacks = {};
2293          self._directMap = {};
2294          return self;
2295      };
2296  
2297      /**
2298       * should we stop this event before firing off callbacks
2299       *
2300       * @param {Event} e
2301       * @param {Element} element
2302       * @return {boolean}
2303       */
2304      Mousetrap.prototype.stopCallback = function(e, element) {
2305          var self = this;
2306  
2307          // if the element has the class "mousetrap" then no need to stop
2308          if ((' ' + element.className + ' ').indexOf(' mousetrap ') > -1) {
2309              return false;
2310          }
2311  
2312          if (_belongsTo(element, self.target)) {
2313              return false;
2314          }
2315  
2316          // Events originating from a shadow DOM are re-targetted and `e.target` is the shadow host,
2317          // not the initial event target in the shadow tree. Note that not all events cross the
2318          // shadow boundary.
2319          // For shadow trees with `mode: 'open'`, the initial event target is the first element in
2320          // the event’s composed path. For shadow trees with `mode: 'closed'`, the initial event
2321          // target cannot be obtained.
2322          if ('composedPath' in e && typeof e.composedPath === 'function') {
2323              // For open shadow trees, update `element` so that the following check works.
2324              var initialEventTarget = e.composedPath()[0];
2325              if (initialEventTarget !== e.target) {
2326                  element = initialEventTarget;
2327              }
2328          }
2329  
2330          // stop for input, select, and textarea
2331          return element.tagName == 'INPUT' || element.tagName == 'SELECT' || element.tagName == 'TEXTAREA' || element.isContentEditable;
2332      };
2333  
2334      /**
2335       * exposes _handleKey publicly so it can be overwritten by extensions
2336       */
2337      Mousetrap.prototype.handleKey = function() {
2338          var self = this;
2339          return self._handleKey.apply(self, arguments);
2340      };
2341  
2342      /**
2343       * allow custom key mappings
2344       */
2345      Mousetrap.addKeycodes = function(object) {
2346          for (var key in object) {
2347              if (object.hasOwnProperty(key)) {
2348                  _MAP[key] = object[key];
2349              }
2350          }
2351          _REVERSE_MAP = null;
2352      };
2353  
2354      /**
2355       * Init the global mousetrap functions
2356       *
2357       * This method is needed to allow the global mousetrap functions to work
2358       * now that mousetrap is a constructor function.
2359       */
2360      Mousetrap.init = function() {
2361          var documentMousetrap = Mousetrap(document);
2362          for (var method in documentMousetrap) {
2363              if (method.charAt(0) !== '_') {
2364                  Mousetrap[method] = (function(method) {
2365                      return function() {
2366                          return documentMousetrap[method].apply(documentMousetrap, arguments);
2367                      };
2368                  } (method));
2369              }
2370          }
2371      };
2372  
2373      Mousetrap.init();
2374  
2375      // expose mousetrap to the global object
2376      window.Mousetrap = Mousetrap;
2377  
2378      // expose as a common js module
2379      if ( true && module.exports) {
2380          module.exports = Mousetrap;
2381      }
2382  
2383      // expose mousetrap as an AMD module
2384      if (true) {
2385          !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
2386              return Mousetrap;
2387          }).call(exports, __webpack_require__, exports, module),
2388                  __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
2389      }
2390  }) (typeof window !== 'undefined' ? window : null, typeof  window !== 'undefined' ? document : null);
2391  
2392  
2393  /***/ }),
2394  
2395  /***/ 29:
2396  /***/ (function(module, __webpack_exports__, __webpack_require__) {
2397  
2398  "use strict";
2399  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _unsupportedIterableToArray; });
2400  /* harmony import */ var _arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(26);
2401  
2402  function _unsupportedIterableToArray(o, minLen) {
2403    if (!o) return;
2404    if (typeof o === "string") return Object(_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen);
2405    var n = Object.prototype.toString.call(o).slice(8, -1);
2406    if (n === "Object" && o.constructor) n = o.constructor.name;
2407    if (n === "Map" || n === "Set") return Array.from(o);
2408    if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return Object(_arrayLikeToArray__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(o, minLen);
2409  }
2410  
2411  /***/ }),
2412  
2413  /***/ 35:
2414  /***/ (function(module, __webpack_exports__, __webpack_require__) {
2415  
2416  "use strict";
2417  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _iterableToArray; });
2418  function _iterableToArray(iter) {
2419    if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
2420  }
2421  
2422  /***/ }),
2423  
2424  /***/ 38:
2425  /***/ (function(module, __webpack_exports__, __webpack_require__) {
2426  
2427  "use strict";
2428  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arrayWithHoles; });
2429  function _arrayWithHoles(arr) {
2430    if (Array.isArray(arr)) return arr;
2431  }
2432  
2433  /***/ }),
2434  
2435  /***/ 39:
2436  /***/ (function(module, __webpack_exports__, __webpack_require__) {
2437  
2438  "use strict";
2439  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _nonIterableRest; });
2440  function _nonIterableRest() {
2441    throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2442  }
2443  
2444  /***/ }),
2445  
2446  /***/ 40:
2447  /***/ (function(module, __webpack_exports__, __webpack_require__) {
2448  
2449  "use strict";
2450  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _typeof; });
2451  function _typeof(obj) {
2452    "@babel/helpers - typeof";
2453  
2454    if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
2455      _typeof = function _typeof(obj) {
2456        return typeof obj;
2457      };
2458    } else {
2459      _typeof = function _typeof(obj) {
2460        return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
2461      };
2462    }
2463  
2464    return _typeof(obj);
2465  }
2466  
2467  /***/ }),
2468  
2469  /***/ 412:
2470  /***/ (function(module, exports) {
2471  
2472  /**
2473   * adds a bindGlobal method to Mousetrap that allows you to
2474   * bind specific keyboard shortcuts that will still work
2475   * inside a text input field
2476   *
2477   * usage:
2478   * Mousetrap.bindGlobal('ctrl+s', _saveChanges);
2479   */
2480  /* global Mousetrap:true */
2481  (function(Mousetrap) {
2482      if (! Mousetrap) {
2483          return;
2484      }
2485      var _globalCallbacks = {};
2486      var _originalStopCallback = Mousetrap.prototype.stopCallback;
2487  
2488      Mousetrap.prototype.stopCallback = function(e, element, combo, sequence) {
2489          var self = this;
2490  
2491          if (self.paused) {
2492              return true;
2493          }
2494  
2495          if (_globalCallbacks[combo] || _globalCallbacks[sequence]) {
2496              return false;
2497          }
2498  
2499          return _originalStopCallback.call(self, e, element, combo);
2500      };
2501  
2502      Mousetrap.prototype.bindGlobal = function(keys, callback, action) {
2503          var self = this;
2504          self.bind(keys, callback, action);
2505  
2506          if (keys instanceof Array) {
2507              for (var i = 0; i < keys.length; i++) {
2508                  _globalCallbacks[keys[i]] = true;
2509              }
2510              return;
2511          }
2512  
2513          _globalCallbacks[keys] = true;
2514      };
2515  
2516      Mousetrap.init();
2517  }) (typeof Mousetrap !== "undefined" ? Mousetrap : undefined);
2518  
2519  
2520  /***/ }),
2521  
2522  /***/ 446:
2523  /***/ (function(module, __webpack_exports__, __webpack_require__) {
2524  
2525  "use strict";
2526  // ESM COMPAT FLAG
2527  __webpack_require__.r(__webpack_exports__);
2528  
2529  // EXPORTS
2530  __webpack_require__.d(__webpack_exports__, "createHigherOrderComponent", function() { return /* reexport */ create_higher_order_component; });
2531  __webpack_require__.d(__webpack_exports__, "compose", function() { return /* reexport */ compose; });
2532  __webpack_require__.d(__webpack_exports__, "ifCondition", function() { return /* reexport */ if_condition; });
2533  __webpack_require__.d(__webpack_exports__, "pure", function() { return /* reexport */ higher_order_pure; });
2534  __webpack_require__.d(__webpack_exports__, "withGlobalEvents", function() { return /* reexport */ with_global_events; });
2535  __webpack_require__.d(__webpack_exports__, "withInstanceId", function() { return /* reexport */ with_instance_id; });
2536  __webpack_require__.d(__webpack_exports__, "withSafeTimeout", function() { return /* reexport */ with_safe_timeout; });
2537  __webpack_require__.d(__webpack_exports__, "withState", function() { return /* reexport */ withState; });
2538  __webpack_require__.d(__webpack_exports__, "useCopyOnClick", function() { return /* reexport */ useCopyOnClick; });
2539  __webpack_require__.d(__webpack_exports__, "__experimentalUseDragging", function() { return /* reexport */ useDragging; });
2540  __webpack_require__.d(__webpack_exports__, "useInstanceId", function() { return /* reexport */ useInstanceId; });
2541  __webpack_require__.d(__webpack_exports__, "useKeyboardShortcut", function() { return /* reexport */ use_keyboard_shortcut; });
2542  __webpack_require__.d(__webpack_exports__, "useMediaQuery", function() { return /* reexport */ useMediaQuery; });
2543  __webpack_require__.d(__webpack_exports__, "usePrevious", function() { return /* reexport */ usePrevious; });
2544  __webpack_require__.d(__webpack_exports__, "useReducedMotion", function() { return /* reexport */ use_reduced_motion; });
2545  __webpack_require__.d(__webpack_exports__, "useViewportMatch", function() { return /* reexport */ use_viewport_match; });
2546  __webpack_require__.d(__webpack_exports__, "useResizeObserver", function() { return /* reexport */ use_resize_observer; });
2547  __webpack_require__.d(__webpack_exports__, "useAsyncList", function() { return /* reexport */ use_async_list; });
2548  __webpack_require__.d(__webpack_exports__, "useWarnOnChange", function() { return /* reexport */ use_warn_on_change; });
2549  
2550  // EXTERNAL MODULE: external {"this":"lodash"}
2551  var external_this_lodash_ = __webpack_require__(2);
2552  
2553  // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/utils/create-higher-order-component/index.js
2554  /**
2555   * External dependencies
2556   */
2557  
2558  /**
2559   * Given a function mapping a component to an enhanced component and modifier
2560   * name, returns the enhanced component augmented with a generated displayName.
2561   *
2562   * @param {Function} mapComponentToEnhancedComponent Function mapping component
2563   *                                                   to enhanced component.
2564   * @param {string}   modifierName                    Seed name from which to
2565   *                                                   generated display name.
2566   *
2567   * @return {WPComponent} Component class with generated display name assigned.
2568   */
2569  
2570  function createHigherOrderComponent(mapComponentToEnhancedComponent, modifierName) {
2571    return function (OriginalComponent) {
2572      var EnhancedComponent = mapComponentToEnhancedComponent(OriginalComponent);
2573      var _OriginalComponent$di = OriginalComponent.displayName,
2574          displayName = _OriginalComponent$di === void 0 ? OriginalComponent.name || 'Component' : _OriginalComponent$di;
2575      EnhancedComponent.displayName = "".concat(Object(external_this_lodash_["upperFirst"])(Object(external_this_lodash_["camelCase"])(modifierName)), "(").concat(displayName, ")");
2576      return EnhancedComponent;
2577    };
2578  }
2579  
2580  /* harmony default export */ var create_higher_order_component = (createHigherOrderComponent);
2581  
2582  // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/higher-order/compose.js
2583  /**
2584   * External dependencies
2585   */
2586  
2587  /**
2588   * Composes multiple higher-order components into a single higher-order component. Performs right-to-left function
2589   * composition, where each successive invocation is supplied the return value of the previous.
2590   *
2591   * @param {...Function} hocs The HOC functions to invoke.
2592   *
2593   * @return {Function} Returns the new composite function.
2594   */
2595  
2596  /* harmony default export */ var compose = (external_this_lodash_["flowRight"]);
2597  
2598  // EXTERNAL MODULE: external {"this":["wp","element"]}
2599  var external_this_wp_element_ = __webpack_require__(0);
2600  
2601  // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/higher-order/if-condition/index.js
2602  
2603  
2604  /**
2605   * Internal dependencies
2606   */
2607  
2608  /**
2609   * Higher-order component creator, creating a new component which renders if
2610   * the given condition is satisfied or with the given optional prop name.
2611   *
2612   * @param {Function} predicate Function to test condition.
2613   *
2614   * @return {Function} Higher-order component.
2615   */
2616  
2617  var if_condition_ifCondition = function ifCondition(predicate) {
2618    return create_higher_order_component(function (WrappedComponent) {
2619      return function (props) {
2620        if (!predicate(props)) {
2621          return null;
2622        }
2623  
2624        return Object(external_this_wp_element_["createElement"])(WrappedComponent, props);
2625      };
2626    }, 'ifCondition');
2627  };
2628  
2629  /* harmony default export */ var if_condition = (if_condition_ifCondition);
2630  
2631  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js
2632  var classCallCheck = __webpack_require__(20);
2633  
2634  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js
2635  var createClass = __webpack_require__(19);
2636  
2637  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js
2638  var possibleConstructorReturn = __webpack_require__(23);
2639  
2640  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js
2641  var getPrototypeOf = __webpack_require__(16);
2642  
2643  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js + 1 modules
2644  var inherits = __webpack_require__(22);
2645  
2646  // EXTERNAL MODULE: external {"this":["wp","isShallowEqual"]}
2647  var external_this_wp_isShallowEqual_ = __webpack_require__(64);
2648  var external_this_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_isShallowEqual_);
2649  
2650  // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/higher-order/pure/index.js
2651  
2652  
2653  
2654  
2655  
2656  
2657  
2658  function _createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; }
2659  
2660  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
2661  
2662  /**
2663   * WordPress dependencies
2664   */
2665  
2666  
2667  /**
2668   * Internal dependencies
2669   */
2670  
2671  
2672  /**
2673   * Given a component returns the enhanced component augmented with a component
2674   * only rerendering when its props/state change
2675   *
2676   * @param {Function} mapComponentToEnhancedComponent Function mapping component
2677   *                                                   to enhanced component.
2678   * @param {string}   modifierName                    Seed name from which to
2679   *                                                   generated display name.
2680   *
2681   * @return {WPComponent} Component class with generated display name assigned.
2682   */
2683  
2684  var pure = create_higher_order_component(function (Wrapped) {
2685    if (Wrapped.prototype instanceof external_this_wp_element_["Component"]) {
2686      return /*#__PURE__*/function (_Wrapped) {
2687        Object(inherits["a" /* default */])(_class, _Wrapped);
2688  
2689        var _super = _createSuper(_class);
2690  
2691        function _class() {
2692          Object(classCallCheck["a" /* default */])(this, _class);
2693  
2694          return _super.apply(this, arguments);
2695        }
2696  
2697        Object(createClass["a" /* default */])(_class, [{
2698          key: "shouldComponentUpdate",
2699          value: function shouldComponentUpdate(nextProps, nextState) {
2700            return !external_this_wp_isShallowEqual_default()(nextProps, this.props) || !external_this_wp_isShallowEqual_default()(nextState, this.state);
2701          }
2702        }]);
2703  
2704        return _class;
2705      }(Wrapped);
2706    }
2707  
2708    return /*#__PURE__*/function (_Component) {
2709      Object(inherits["a" /* default */])(_class2, _Component);
2710  
2711      var _super2 = _createSuper(_class2);
2712  
2713      function _class2() {
2714        Object(classCallCheck["a" /* default */])(this, _class2);
2715  
2716        return _super2.apply(this, arguments);
2717      }
2718  
2719      Object(createClass["a" /* default */])(_class2, [{
2720        key: "shouldComponentUpdate",
2721        value: function shouldComponentUpdate(nextProps) {
2722          return !external_this_wp_isShallowEqual_default()(nextProps, this.props);
2723        }
2724      }, {
2725        key: "render",
2726        value: function render() {
2727          return Object(external_this_wp_element_["createElement"])(Wrapped, this.props);
2728        }
2729      }]);
2730  
2731      return _class2;
2732    }(external_this_wp_element_["Component"]);
2733  }, 'pure');
2734  /* harmony default export */ var higher_order_pure = (pure);
2735  
2736  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
2737  var esm_extends = __webpack_require__(8);
2738  
2739  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js
2740  var assertThisInitialized = __webpack_require__(12);
2741  
2742  // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/higher-order/with-global-events/listener.js
2743  
2744  
2745  
2746  /**
2747   * External dependencies
2748   */
2749  
2750  /**
2751   * Class responsible for orchestrating event handling on the global window,
2752   * binding a single event to be shared across all handling instances, and
2753   * removing the handler when no instances are listening for the event.
2754   */
2755  
2756  var listener_Listener = /*#__PURE__*/function () {
2757    function Listener() {
2758      Object(classCallCheck["a" /* default */])(this, Listener);
2759  
2760      this.listeners = {};
2761      this.handleEvent = this.handleEvent.bind(this);
2762    }
2763  
2764    Object(createClass["a" /* default */])(Listener, [{
2765      key: "add",
2766      value: function add(eventType, instance) {
2767        if (!this.listeners[eventType]) {
2768          // Adding first listener for this type, so bind event.
2769          window.addEventListener(eventType, this.handleEvent);
2770          this.listeners[eventType] = [];
2771        }
2772  
2773        this.listeners[eventType].push(instance);
2774      }
2775    }, {
2776      key: "remove",
2777      value: function remove(eventType, instance) {
2778        this.listeners[eventType] = Object(external_this_lodash_["without"])(this.listeners[eventType], instance);
2779  
2780        if (!this.listeners[eventType].length) {
2781          // Removing last listener for this type, so unbind event.
2782          window.removeEventListener(eventType, this.handleEvent);
2783          delete this.listeners[eventType];
2784        }
2785      }
2786    }, {
2787      key: "handleEvent",
2788      value: function handleEvent(event) {
2789        Object(external_this_lodash_["forEach"])(this.listeners[event.type], function (instance) {
2790          instance.handleEvent(event);
2791        });
2792      }
2793    }]);
2794  
2795    return Listener;
2796  }();
2797  
2798  /* harmony default export */ var listener = (listener_Listener);
2799  
2800  // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/higher-order/with-global-events/index.js
2801  
2802  
2803  
2804  
2805  
2806  
2807  
2808  
2809  
2810  function with_global_events_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (with_global_events_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; }
2811  
2812  function with_global_events_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
2813  
2814  /**
2815   * External dependencies
2816   */
2817  
2818  /**
2819   * WordPress dependencies
2820   */
2821  
2822  
2823  /**
2824   * Internal dependencies
2825   */
2826  
2827  
2828  
2829  /**
2830   * Listener instance responsible for managing document event handling.
2831   *
2832   * @type {Listener}
2833   */
2834  
2835  var with_global_events_listener = new listener();
2836  /**
2837   * Higher-order component creator which, given an object of DOM event types and
2838   * values corresponding to a callback function name on the component, will
2839   * create or update a window event handler to invoke the callback when an event
2840   * occurs. On behalf of the consuming developer, the higher-order component
2841   * manages unbinding when the component unmounts, and binding at most a single
2842   * event handler for the entire application.
2843   *
2844   * @param {Object<string,string>} eventTypesToHandlers Object with keys of DOM
2845   *                                                     event type, the value a
2846   *                                                     name of the function on
2847   *                                                     the original component's
2848   *                                                     instance which handles
2849   *                                                     the event.
2850   *
2851   * @return {Function} Higher-order component.
2852   */
2853  
2854  function withGlobalEvents(eventTypesToHandlers) {
2855    return create_higher_order_component(function (WrappedComponent) {
2856      var Wrapper = /*#__PURE__*/function (_Component) {
2857        Object(inherits["a" /* default */])(Wrapper, _Component);
2858  
2859        var _super = with_global_events_createSuper(Wrapper);
2860  
2861        function Wrapper() {
2862          var _this;
2863  
2864          Object(classCallCheck["a" /* default */])(this, Wrapper);
2865  
2866          _this = _super.apply(this, arguments);
2867          _this.handleEvent = _this.handleEvent.bind(Object(assertThisInitialized["a" /* default */])(_this));
2868          _this.handleRef = _this.handleRef.bind(Object(assertThisInitialized["a" /* default */])(_this));
2869          return _this;
2870        }
2871  
2872        Object(createClass["a" /* default */])(Wrapper, [{
2873          key: "componentDidMount",
2874          value: function componentDidMount() {
2875            var _this2 = this;
2876  
2877            Object(external_this_lodash_["forEach"])(eventTypesToHandlers, function (handler, eventType) {
2878              with_global_events_listener.add(eventType, _this2);
2879            });
2880          }
2881        }, {
2882          key: "componentWillUnmount",
2883          value: function componentWillUnmount() {
2884            var _this3 = this;
2885  
2886            Object(external_this_lodash_["forEach"])(eventTypesToHandlers, function (handler, eventType) {
2887              with_global_events_listener.remove(eventType, _this3);
2888            });
2889          }
2890        }, {
2891          key: "handleEvent",
2892          value: function handleEvent(event) {
2893            var handler = eventTypesToHandlers[event.type];
2894  
2895            if (typeof this.wrappedRef[handler] === 'function') {
2896              this.wrappedRef[handler](event);
2897            }
2898          }
2899        }, {
2900          key: "handleRef",
2901          value: function handleRef(el) {
2902            this.wrappedRef = el; // Any component using `withGlobalEvents` that is not setting a `ref`
2903            // will cause `this.props.forwardedRef` to be `null`, so we need this
2904            // check.
2905  
2906            if (this.props.forwardedRef) {
2907              this.props.forwardedRef(el);
2908            }
2909          }
2910        }, {
2911          key: "render",
2912          value: function render() {
2913            return Object(external_this_wp_element_["createElement"])(WrappedComponent, Object(esm_extends["a" /* default */])({}, this.props.ownProps, {
2914              ref: this.handleRef
2915            }));
2916          }
2917        }]);
2918  
2919        return Wrapper;
2920      }(external_this_wp_element_["Component"]);
2921  
2922      return Object(external_this_wp_element_["forwardRef"])(function (props, ref) {
2923        return Object(external_this_wp_element_["createElement"])(Wrapper, {
2924          ownProps: props,
2925          forwardedRef: ref
2926        });
2927      });
2928    }, 'withGlobalEvents');
2929  }
2930  
2931  /* harmony default export */ var with_global_events = (withGlobalEvents);
2932  
2933  // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-instance-id/index.js
2934  /**
2935   * WordPress dependencies
2936   */
2937  
2938  var instanceMap = new WeakMap();
2939  /**
2940   * Creates a new id for a given object.
2941   *
2942   * @param {Object} object Object reference to create an id for.
2943   */
2944  
2945  function createId(object) {
2946    var instances = instanceMap.get(object) || 0;
2947    instanceMap.set(object, instances + 1);
2948    return instances;
2949  }
2950  /**
2951   * Provides a unique instance ID.
2952   *
2953   * @param {Object} object Object reference to create an id for.
2954   * @param {string} prefix Prefix for the unique id.
2955   */
2956  
2957  
2958  function useInstanceId(object, prefix) {
2959    return Object(external_this_wp_element_["useMemo"])(function () {
2960      var id = createId(object);
2961      return prefix ? "".concat(prefix, "-").concat(id) : id;
2962    }, [object]);
2963  }
2964  
2965  // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/higher-order/with-instance-id/index.js
2966  
2967  
2968  
2969  /**
2970   * Internal dependencies
2971   */
2972  
2973  
2974  /**
2975   * A Higher Order Component used to be provide a unique instance ID by
2976   * component.
2977   *
2978   * @param {WPComponent} WrappedComponent The wrapped component.
2979   *
2980   * @return {WPComponent} Component with an instanceId prop.
2981   */
2982  
2983  /* harmony default export */ var with_instance_id = (create_higher_order_component(function (WrappedComponent) {
2984    return function (props) {
2985      var instanceId = useInstanceId(WrappedComponent);
2986      return Object(external_this_wp_element_["createElement"])(WrappedComponent, Object(esm_extends["a" /* default */])({}, props, {
2987        instanceId: instanceId
2988      }));
2989    };
2990  }, 'withInstanceId'));
2991  
2992  // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/higher-order/with-safe-timeout/index.js
2993  
2994  
2995  
2996  
2997  
2998  
2999  
3000  
3001  
3002  function with_safe_timeout_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (with_safe_timeout_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; }
3003  
3004  function with_safe_timeout_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
3005  
3006  /**
3007   * External dependencies
3008   */
3009  
3010  /**
3011   * WordPress dependencies
3012   */
3013  
3014  
3015  /**
3016   * Internal dependencies
3017   */
3018  
3019  
3020  /**
3021   * A higher-order component used to provide and manage delayed function calls
3022   * that ought to be bound to a component's lifecycle.
3023   *
3024   * @param {WPComponent} OriginalComponent Component requiring setTimeout
3025   *
3026   * @return {WPComponent} Wrapped component.
3027   */
3028  
3029  var withSafeTimeout = create_higher_order_component(function (OriginalComponent) {
3030    return /*#__PURE__*/function (_Component) {
3031      Object(inherits["a" /* default */])(WrappedComponent, _Component);
3032  
3033      var _super = with_safe_timeout_createSuper(WrappedComponent);
3034  
3035      function WrappedComponent() {
3036        var _this;
3037  
3038        Object(classCallCheck["a" /* default */])(this, WrappedComponent);
3039  
3040        _this = _super.apply(this, arguments);
3041        _this.timeouts = [];
3042        _this.setTimeout = _this.setTimeout.bind(Object(assertThisInitialized["a" /* default */])(_this));
3043        _this.clearTimeout = _this.clearTimeout.bind(Object(assertThisInitialized["a" /* default */])(_this));
3044        return _this;
3045      }
3046  
3047      Object(createClass["a" /* default */])(WrappedComponent, [{
3048        key: "componentWillUnmount",
3049        value: function componentWillUnmount() {
3050          this.timeouts.forEach(clearTimeout);
3051        }
3052      }, {
3053        key: "setTimeout",
3054        value: function (_setTimeout) {
3055          function setTimeout(_x, _x2) {
3056            return _setTimeout.apply(this, arguments);
3057          }
3058  
3059          setTimeout.toString = function () {
3060            return _setTimeout.toString();
3061          };
3062  
3063          return setTimeout;
3064        }(function (fn, delay) {
3065          var _this2 = this;
3066  
3067          var id = setTimeout(function () {
3068            fn();
3069  
3070            _this2.clearTimeout(id);
3071          }, delay);
3072          this.timeouts.push(id);
3073          return id;
3074        })
3075      }, {
3076        key: "clearTimeout",
3077        value: function (_clearTimeout) {
3078          function clearTimeout(_x3) {
3079            return _clearTimeout.apply(this, arguments);
3080          }
3081  
3082          clearTimeout.toString = function () {
3083            return _clearTimeout.toString();
3084          };
3085  
3086          return clearTimeout;
3087        }(function (id) {
3088          clearTimeout(id);
3089          this.timeouts = Object(external_this_lodash_["without"])(this.timeouts, id);
3090        })
3091      }, {
3092        key: "render",
3093        value: function render() {
3094          return Object(external_this_wp_element_["createElement"])(OriginalComponent, Object(esm_extends["a" /* default */])({}, this.props, {
3095            setTimeout: this.setTimeout,
3096            clearTimeout: this.clearTimeout
3097          }));
3098        }
3099      }]);
3100  
3101      return WrappedComponent;
3102    }(external_this_wp_element_["Component"]);
3103  }, 'withSafeTimeout');
3104  /* harmony default export */ var with_safe_timeout = (withSafeTimeout);
3105  
3106  // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/higher-order/with-state/index.js
3107  
3108  
3109  
3110  
3111  
3112  
3113  
3114  
3115  
3116  function with_state_createSuper(Derived) { return function () { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (with_state_isNativeReflectConstruct()) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; }
3117  
3118  function with_state_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
3119  
3120  /**
3121   * WordPress dependencies
3122   */
3123  
3124  /**
3125   * Internal dependencies
3126   */
3127  
3128  
3129  /**
3130   * A Higher Order Component used to provide and manage internal component state
3131   * via props.
3132   *
3133   * @param {?Object} initialState Optional initial state of the component.
3134   *
3135   * @return {WPComponent} Wrapped component.
3136   */
3137  
3138  function withState() {
3139    var initialState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
3140    return create_higher_order_component(function (OriginalComponent) {
3141      return /*#__PURE__*/function (_Component) {
3142        Object(inherits["a" /* default */])(WrappedComponent, _Component);
3143  
3144        var _super = with_state_createSuper(WrappedComponent);
3145  
3146        function WrappedComponent() {
3147          var _this;
3148  
3149          Object(classCallCheck["a" /* default */])(this, WrappedComponent);
3150  
3151          _this = _super.apply(this, arguments);
3152          _this.setState = _this.setState.bind(Object(assertThisInitialized["a" /* default */])(_this));
3153          _this.state = initialState;
3154          return _this;
3155        }
3156  
3157        Object(createClass["a" /* default */])(WrappedComponent, [{
3158          key: "render",
3159          value: function render() {
3160            return Object(external_this_wp_element_["createElement"])(OriginalComponent, Object(esm_extends["a" /* default */])({}, this.props, this.state, {
3161              setState: this.setState
3162            }));
3163          }
3164        }]);
3165  
3166        return WrappedComponent;
3167      }(external_this_wp_element_["Component"]);
3168    }, 'withState');
3169  }
3170  
3171  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules
3172  var slicedToArray = __webpack_require__(14);
3173  
3174  // EXTERNAL MODULE: ./node_modules/clipboard/dist/clipboard.js
3175  var dist_clipboard = __webpack_require__(271);
3176  var clipboard_default = /*#__PURE__*/__webpack_require__.n(dist_clipboard);
3177  
3178  // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-copy-on-click/index.js
3179  
3180  
3181  /**
3182   * External dependencies
3183   */
3184  
3185  /**
3186   * WordPress dependencies
3187   */
3188  
3189  
3190  /**
3191   * Copies the text to the clipboard when the element is clicked.
3192   *
3193   * @param {Object}          ref     Reference with the element.
3194   * @param {string|Function} text    The text to copy.
3195   * @param {number}          timeout Optional timeout to reset the returned
3196   *                                  state. 4 seconds by default.
3197   *
3198   * @return {boolean} Whether or not the text has been copied. Resets after the
3199   *                   timeout.
3200   */
3201  
3202  function useCopyOnClick(ref, _text) {
3203    var timeout = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 4000;
3204    var clipboard = Object(external_this_wp_element_["useRef"])();
3205  
3206    var _useState = Object(external_this_wp_element_["useState"])(false),
3207        _useState2 = Object(slicedToArray["a" /* default */])(_useState, 2),
3208        hasCopied = _useState2[0],
3209        setHasCopied = _useState2[1];
3210  
3211    Object(external_this_wp_element_["useEffect"])(function () {
3212      var timeoutId; // Clipboard listens to click events.
3213  
3214      clipboard.current = new clipboard_default.a(ref.current, {
3215        text: function text() {
3216          return typeof _text === 'function' ? _text() : _text;
3217        }
3218      });
3219      clipboard.current.on('success', function (_ref) {
3220        var clearSelection = _ref.clearSelection,
3221            trigger = _ref.trigger;
3222        // Clearing selection will move focus back to the triggering button,
3223        // ensuring that it is not reset to the body, and further that it is
3224        // kept within the rendered node.
3225        clearSelection(); // Handle ClipboardJS focus bug, see https://github.com/zenorocha/clipboard.js/issues/680
3226  
3227        if (trigger) {
3228          trigger.focus();
3229        }
3230  
3231        if (timeout) {
3232          setHasCopied(true);
3233          clearTimeout(timeoutId);
3234          timeoutId = setTimeout(function () {
3235            return setHasCopied(false);
3236          }, timeout);
3237        }
3238      });
3239      return function () {
3240        clipboard.current.destroy();
3241        clearTimeout(timeoutId);
3242      };
3243    }, [_text, timeout, setHasCopied]);
3244    return hasCopied;
3245  }
3246  
3247  // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-dragging/index.js
3248  
3249  
3250  /**
3251   * WordPress dependencies
3252   */
3253  
3254  var useIsomorphicLayoutEffect = typeof window !== 'undefined' ? external_this_wp_element_["useLayoutEffect"] : external_this_wp_element_["useEffect"];
3255  function useDragging(_ref) {
3256    var onDragStart = _ref.onDragStart,
3257        onDragMove = _ref.onDragMove,
3258        onDragEnd = _ref.onDragEnd;
3259  
3260    var _useState = Object(external_this_wp_element_["useState"])(false),
3261        _useState2 = Object(slicedToArray["a" /* default */])(_useState, 2),
3262        isDragging = _useState2[0],
3263        setIsDragging = _useState2[1];
3264  
3265    var eventsRef = Object(external_this_wp_element_["useRef"])({
3266      onDragStart: onDragStart,
3267      onDragMove: onDragMove,
3268      onDragEnd: onDragEnd
3269    });
3270    useIsomorphicLayoutEffect(function () {
3271      eventsRef.current.onDragStart = onDragStart;
3272      eventsRef.current.onDragMove = onDragMove;
3273      eventsRef.current.onDragEnd = onDragEnd;
3274    }, [onDragStart, onDragMove, onDragEnd]);
3275    var onMouseMove = Object(external_this_wp_element_["useCallback"])(function () {
3276      var _eventsRef$current;
3277  
3278      return eventsRef.current.onDragMove && (_eventsRef$current = eventsRef.current).onDragMove.apply(_eventsRef$current, arguments);
3279    }, []);
3280    var endDrag = Object(external_this_wp_element_["useCallback"])(function () {
3281      if (eventsRef.current.onDragEnd) {
3282        var _eventsRef$current2;
3283  
3284        (_eventsRef$current2 = eventsRef.current).onDragEnd.apply(_eventsRef$current2, arguments);
3285      }
3286  
3287      document.removeEventListener('mousemove', onMouseMove);
3288      document.removeEventListener('mouseup', endDrag);
3289      setIsDragging(false);
3290    }, []);
3291    var startDrag = Object(external_this_wp_element_["useCallback"])(function () {
3292      if (eventsRef.current.onDragStart) {
3293        var _eventsRef$current3;
3294  
3295        (_eventsRef$current3 = eventsRef.current).onDragStart.apply(_eventsRef$current3, arguments);
3296      }
3297  
3298      document.addEventListener('mousemove', onMouseMove);
3299      document.addEventListener('mouseup', endDrag);
3300      setIsDragging(true);
3301    }, []); // Remove the global events when unmounting if needed.
3302  
3303    Object(external_this_wp_element_["useEffect"])(function () {
3304      return function () {
3305        if (isDragging) {
3306          document.removeEventListener('mousemove', onMouseMove);
3307          document.removeEventListener('mouseup', endDrag);
3308        }
3309      };
3310    }, [isDragging]);
3311    return {
3312      startDrag: startDrag,
3313      endDrag: endDrag,
3314      isDragging: isDragging
3315    };
3316  }
3317  
3318  // EXTERNAL MODULE: ./node_modules/mousetrap/mousetrap.js
3319  var mousetrap_mousetrap = __webpack_require__(272);
3320  var mousetrap_default = /*#__PURE__*/__webpack_require__.n(mousetrap_mousetrap);
3321  
3322  // EXTERNAL MODULE: ./node_modules/mousetrap/plugins/global-bind/mousetrap-global-bind.js
3323  var mousetrap_global_bind = __webpack_require__(412);
3324  
3325  // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-keyboard-shortcut/index.js
3326  /**
3327   * External dependencies
3328   */
3329  
3330  
3331  
3332  /**
3333   * WordPress dependencies
3334   */
3335  
3336  
3337  /**
3338   * A block selection object.
3339   *
3340   * @typedef {Object} WPKeyboardShortcutConfig
3341   *
3342   * @property {boolean} [bindGlobal]  Handle keyboard events anywhere including inside textarea/input fields.
3343   * @property {string}  [eventName]   Event name used to trigger the handler, defaults to keydown.
3344   * @property {boolean} [isDisabled]  Disables the keyboard handler if the value is true.
3345   * @property {Object}  [target]      React reference to the DOM element used to catch the keyboard event.
3346   */
3347  
3348  /**
3349   * Return true if platform is MacOS.
3350   *
3351   * @param {Object} _window   window object by default; used for DI testing.
3352   *
3353   * @return {boolean} True if MacOS; false otherwise.
3354   */
3355  
3356  function isAppleOS() {
3357    var _window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window;
3358  
3359    var platform = _window.navigator.platform;
3360    return platform.indexOf('Mac') !== -1 || Object(external_this_lodash_["includes"])(['iPad', 'iPhone'], platform);
3361  }
3362  /**
3363   * Attach a keyboard shortcut handler.
3364   *
3365   * @param {string[]|string}         shortcuts  Keyboard Shortcuts.
3366   * @param {Function}                callback   Shortcut callback.
3367   * @param {WPKeyboardShortcutConfig} options    Shortcut options.
3368   */
3369  
3370  
3371  function useKeyboardShortcut(shortcuts, callback) {
3372    var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
3373        _ref$bindGlobal = _ref.bindGlobal,
3374        bindGlobal = _ref$bindGlobal === void 0 ? false : _ref$bindGlobal,
3375        _ref$eventName = _ref.eventName,
3376        eventName = _ref$eventName === void 0 ? 'keydown' : _ref$eventName,
3377        _ref$isDisabled = _ref.isDisabled,
3378        isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
3379        target = _ref.target;
3380  
3381    var currentCallback = Object(external_this_wp_element_["useRef"])(callback);
3382    Object(external_this_wp_element_["useEffect"])(function () {
3383      currentCallback.current = callback;
3384    }, [callback]);
3385    Object(external_this_wp_element_["useEffect"])(function () {
3386      if (isDisabled) {
3387        return;
3388      }
3389  
3390      var mousetrap = new mousetrap_default.a(target ? target.current : document);
3391      Object(external_this_lodash_["castArray"])(shortcuts).forEach(function (shortcut) {
3392        var keys = shortcut.split('+'); // Determines whether a key is a modifier by the length of the string.
3393        // E.g. if I add a pass a shortcut Shift+Cmd+M, it'll determine that
3394        // the modifiers are Shift and Cmd because they're not a single character.
3395  
3396        var modifiers = new Set(keys.filter(function (value) {
3397          return value.length > 1;
3398        }));
3399        var hasAlt = modifiers.has('alt');
3400        var hasShift = modifiers.has('shift'); // This should be better moved to the shortcut registration instead.
3401  
3402        if (isAppleOS() && (modifiers.size === 1 && hasAlt || modifiers.size === 2 && hasAlt && hasShift)) {
3403          throw new Error("Cannot bind ".concat(shortcut, ". Alt and Shift+Alt modifiers are reserved for character input."));
3404        }
3405  
3406        var bindFn = bindGlobal ? 'bindGlobal' : 'bind';
3407        mousetrap[bindFn](shortcut, function () {
3408          return currentCallback.current.apply(currentCallback, arguments);
3409        }, eventName);
3410      });
3411      return function () {
3412        mousetrap.reset();
3413      };
3414    }, [shortcuts, bindGlobal, eventName, target, isDisabled]);
3415  }
3416  
3417  /* harmony default export */ var use_keyboard_shortcut = (useKeyboardShortcut);
3418  
3419  // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-media-query/index.js
3420  
3421  
3422  /**
3423   * WordPress dependencies
3424   */
3425  
3426  /**
3427   * Runs a media query and returns its value when it changes.
3428   *
3429   * @param {string} [query] Media Query.
3430   * @return {boolean} return value of the media query.
3431   */
3432  
3433  function useMediaQuery(query) {
3434    var _useState = Object(external_this_wp_element_["useState"])(query && window.matchMedia(query).matches),
3435        _useState2 = Object(slicedToArray["a" /* default */])(_useState, 2),
3436        match = _useState2[0],
3437        setMatch = _useState2[1];
3438  
3439    Object(external_this_wp_element_["useEffect"])(function () {
3440      if (!query) {
3441        return;
3442      }
3443  
3444      var updateMatch = function updateMatch() {
3445        return setMatch(window.matchMedia(query).matches);
3446      };
3447  
3448      updateMatch();
3449      var list = window.matchMedia(query);
3450      list.addListener(updateMatch);
3451      return function () {
3452        list.removeListener(updateMatch);
3453      };
3454    }, [query]);
3455    return query && match;
3456  }
3457  
3458  // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-previous/index.js
3459  /**
3460   * WordPress dependencies
3461   */
3462  
3463  /**
3464   * Use something's value from the previous render.
3465   * Based on https://usehooks.com/usePrevious/.
3466   *
3467   * @template T
3468   *
3469   * @param {T} value The value to track.
3470   *
3471   * @return {T|undefined} The value from the previous render.
3472   */
3473  
3474  function usePrevious(value) {
3475    // Disable reason: without an explicit type detail, the type of ref will be
3476    // inferred based on the initial useRef argument, which is undefined.
3477    // https://github.com/WordPress/gutenberg/pull/22597#issuecomment-633588366
3478  
3479    /* eslint-disable jsdoc/no-undefined-types */
3480    var ref = Object(external_this_wp_element_["useRef"])(
3481    /** @type {T|undefined} */
3482    undefined);
3483    /* eslint-enable jsdoc/no-undefined-types */
3484    // Store current value in ref.
3485  
3486    Object(external_this_wp_element_["useEffect"])(function () {
3487      ref.current = value;
3488    }, [value]); // Re-run when value changes.
3489    // Return previous value (happens before update in useEffect above).
3490  
3491    return ref.current;
3492  }
3493  
3494  // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-reduced-motion/index.js
3495  /**
3496   * Internal dependencies
3497   */
3498  
3499  /**
3500   * Whether or not the user agent is Internet Explorer.
3501   *
3502   * @type {boolean}
3503   */
3504  
3505  var IS_IE = typeof window !== 'undefined' && window.navigator.userAgent.indexOf('Trident') >= 0;
3506  /**
3507   * Hook returning whether the user has a preference for reduced motion.
3508   *
3509   * @return {boolean} Reduced motion preference value.
3510   */
3511  
3512  var useReducedMotion = undefined || IS_IE ? function () {
3513    return true;
3514  } : function () {
3515    return useMediaQuery('(prefers-reduced-motion: reduce)');
3516  };
3517  /* harmony default export */ var use_reduced_motion = (useReducedMotion);
3518  
3519  // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-viewport-match/index.js
3520  /**
3521   * WordPress dependencies
3522   */
3523  
3524  /**
3525   * Internal dependencies
3526   */
3527  
3528  
3529  /**
3530   * @typedef {"huge"|"wide"|"large"|"medium"|"small"|"mobile"} WPBreakpoint
3531   */
3532  
3533  /**
3534   * Hash of breakpoint names with pixel width at which it becomes effective.
3535   *
3536   * @see _breakpoints.scss
3537   *
3538   * @type {Object<WPBreakpoint,number>}
3539   */
3540  
3541  var BREAKPOINTS = {
3542    huge: 1440,
3543    wide: 1280,
3544    large: 960,
3545    medium: 782,
3546    small: 600,
3547    mobile: 480
3548  };
3549  /**
3550   * @typedef {">="|"<"} WPViewportOperator
3551   */
3552  
3553  /**
3554   * Object mapping media query operators to the condition to be used.
3555   *
3556   * @type {Object<WPViewportOperator,string>}
3557   */
3558  
3559  var CONDITIONS = {
3560    '>=': 'min-width',
3561    '<': 'max-width'
3562  };
3563  /**
3564   * Object mapping media query operators to a function that given a breakpointValue and a width evaluates if the operator matches the values.
3565   *
3566   * @type {Object<WPViewportOperator,Function>}
3567   */
3568  
3569  var OPERATOR_EVALUATORS = {
3570    '>=': function _(breakpointValue, width) {
3571      return width >= breakpointValue;
3572    },
3573    '<': function _(breakpointValue, width) {
3574      return width < breakpointValue;
3575    }
3576  };
3577  var ViewportMatchWidthContext = Object(external_this_wp_element_["createContext"])(null);
3578  /**
3579   * Returns true if the viewport matches the given query, or false otherwise.
3580   *
3581   * @param {WPBreakpoint}       breakpoint      Breakpoint size name.
3582   * @param {WPViewportOperator} [operator=">="] Viewport operator.
3583   *
3584   * @example
3585   *
3586   * ```js
3587   * useViewportMatch( 'huge', '<' );
3588   * useViewportMatch( 'medium' );
3589   * ```
3590   *
3591   * @return {boolean} Whether viewport matches query.
3592   */
3593  
3594  var use_viewport_match_useViewportMatch = function useViewportMatch(breakpoint) {
3595    var operator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '>=';
3596    var simulatedWidth = Object(external_this_wp_element_["useContext"])(ViewportMatchWidthContext);
3597    var mediaQuery = !simulatedWidth && "(".concat(CONDITIONS[operator], ": ").concat(BREAKPOINTS[breakpoint], "px)");
3598    var mediaQueryResult = useMediaQuery(mediaQuery);
3599  
3600    if (simulatedWidth) {
3601      return OPERATOR_EVALUATORS[operator](BREAKPOINTS[breakpoint], simulatedWidth);
3602    }
3603  
3604    return mediaQueryResult;
3605  };
3606  
3607  use_viewport_match_useViewportMatch.__experimentalWidthProvider = ViewportMatchWidthContext.Provider;
3608  /* harmony default export */ var use_viewport_match = (use_viewport_match_useViewportMatch);
3609  
3610  // EXTERNAL MODULE: ./node_modules/react-resize-aware/dist/index.js
3611  var dist = __webpack_require__(149);
3612  var dist_default = /*#__PURE__*/__webpack_require__.n(dist);
3613  
3614  // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-resize-observer/index.js
3615  /**
3616   * External dependencies
3617   */
3618  
3619  /**
3620   * Hook which allows to listen the resize event of any target element when it changes sizes.
3621   * _Note: `useResizeObserver` will report `null` until after first render_
3622   *
3623   * @return {Array} An array of {Element} `resizeListener` and {?Object} `sizes` with properties `width` and `height`
3624   *
3625   * @example
3626   *
3627   * ```js
3628   * const App = () => {
3629   *     const [ resizeListener, sizes ] = useResizeObserver();
3630   *
3631   *     return (
3632   *         <div>
3633   *             { resizeListener }
3634   *             Your content here
3635   *         </div>
3636   *     );
3637   * };
3638   * ```
3639   *
3640   */
3641  
3642  /* harmony default export */ var use_resize_observer = (dist_default.a);
3643  
3644  // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules
3645  var toConsumableArray = __webpack_require__(18);
3646  
3647  // EXTERNAL MODULE: external {"this":["wp","priorityQueue"]}
3648  var external_this_wp_priorityQueue_ = __webpack_require__(150);
3649  
3650  // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-async-list/index.js
3651  
3652  
3653  
3654  /**
3655   * WordPress dependencies
3656   */
3657  
3658  
3659  /**
3660   * Returns the first items from list that are present on state.
3661   *
3662   * @param {Array} list  New array.
3663   * @param {Array} state Current state.
3664   * @return {Array} First items present iin state.
3665   */
3666  
3667  function getFirstItemsPresentInState(list, state) {
3668    var firstItems = [];
3669  
3670    for (var i = 0; i < list.length; i++) {
3671      var item = list[i];
3672  
3673      if (!state.includes(item)) {
3674        break;
3675      }
3676  
3677      firstItems.push(item);
3678    }
3679  
3680    return firstItems;
3681  }
3682  /**
3683   * Reducer keeping track of a list of appended items.
3684   *
3685   * @param {Array}  state  Current state
3686   * @param {Object} action Action
3687   *
3688   * @return {Array} update state.
3689   */
3690  
3691  
3692  function listReducer(state, action) {
3693    if (action.type === 'reset') {
3694      return action.list;
3695    }
3696  
3697    if (action.type === 'append') {
3698      return [].concat(Object(toConsumableArray["a" /* default */])(state), [action.item]);
3699    }
3700  
3701    return state;
3702  }
3703  /**
3704   * React hook returns an array which items get asynchronously appended from a source array.
3705   * This behavior is useful if we want to render a list of items asynchronously for performance reasons.
3706   *
3707   * @param {Array} list Source array.
3708   * @return {Array} Async array.
3709   */
3710  
3711  
3712  function useAsyncList(list) {
3713    var _useReducer = Object(external_this_wp_element_["useReducer"])(listReducer, []),
3714        _useReducer2 = Object(slicedToArray["a" /* default */])(_useReducer, 2),
3715        current = _useReducer2[0],
3716        dispatch = _useReducer2[1];
3717  
3718    Object(external_this_wp_element_["useEffect"])(function () {
3719      // On reset, we keep the first items that were previously rendered.
3720      var firstItems = getFirstItemsPresentInState(list, current);
3721      dispatch({
3722        type: 'reset',
3723        list: firstItems
3724      });
3725      var asyncQueue = Object(external_this_wp_priorityQueue_["createQueue"])();
3726  
3727      var append = function append(index) {
3728        return function () {
3729          if (list.length <= index) {
3730            return;
3731          }
3732  
3733          dispatch({
3734            type: 'append',
3735            item: list[index]
3736          });
3737          asyncQueue.add({}, append(index + 1));
3738        };
3739      };
3740  
3741      asyncQueue.add({}, append(firstItems.length));
3742      return function () {
3743        return asyncQueue.reset();
3744      };
3745    }, [list]);
3746    return current;
3747  }
3748  
3749  /* harmony default export */ var use_async_list = (useAsyncList);
3750  
3751  // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-warn-on-change/index.js
3752  
3753  
3754  /**
3755   * Internal dependencies
3756   */
3757  
3758  /**
3759   * Hook that performs a shallow comparison between the preview value of an object
3760   * and the new one, if there's a difference, it prints it to the console.
3761   * this is useful in performance related work, to check why a component re-renders.
3762   *
3763   *  @example
3764   *
3765   * ```jsx
3766   * function MyComponent(props) {
3767   *    useWarnOnChange(props);
3768   *
3769   *    return "Something";
3770   * }
3771   * ```
3772   *
3773   * @param {Object} object Object which changes to compare.
3774   * @param {string} prefix Just a prefix to show when console logging.
3775   */
3776  
3777  function useWarnOnChange(object) {
3778    var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'Change detection';
3779    var previousValues = usePrevious(object);
3780    Object.entries(previousValues !== null && previousValues !== void 0 ? previousValues : []).forEach(function (_ref) {
3781      var _ref2 = Object(slicedToArray["a" /* default */])(_ref, 2),
3782          key = _ref2[0],
3783          value = _ref2[1];
3784  
3785      if (value !== object[key]) {
3786        // eslint-disable-next-line no-console
3787        console.warn("".concat(prefix, ": ").concat(key, " key changed:"), value, object[key]);
3788      }
3789    });
3790  }
3791  
3792  /* harmony default export */ var use_warn_on_change = (useWarnOnChange);
3793  
3794  // CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/index.js
3795  // Utils
3796   // Compose helper (aliased flowRight from Lodash)
3797  
3798   // Higher-order components
3799  
3800  
3801  
3802  
3803  
3804  
3805   // Hooks
3806  
3807  
3808  
3809  
3810  
3811  
3812  
3813  
3814  
3815  
3816  
3817  
3818  
3819  
3820  /***/ }),
3821  
3822  /***/ 64:
3823  /***/ (function(module, exports) {
3824  
3825  (function() { module.exports = this["wp"]["isShallowEqual"]; }());
3826  
3827  /***/ }),
3828  
3829  /***/ 8:
3830  /***/ (function(module, __webpack_exports__, __webpack_require__) {
3831  
3832  "use strict";
3833  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _extends; });
3834  function _extends() {
3835    _extends = Object.assign || function (target) {
3836      for (var i = 1; i < arguments.length; i++) {
3837        var source = arguments[i];
3838  
3839        for (var key in source) {
3840          if (Object.prototype.hasOwnProperty.call(source, key)) {
3841            target[key] = source[key];
3842          }
3843        }
3844      }
3845  
3846      return target;
3847    };
3848  
3849    return _extends.apply(this, arguments);
3850  }
3851  
3852  /***/ })
3853  
3854  /******/ });


Generated: Mon Sep 21 01:00:03 2020 Cross-referenced by PHPXref 0.7.1