[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/js/dist/ -> redux-routine.js (source)

   1  /******/ (() => { // webpackBootstrap
   2  /******/     "use strict";
   3  /******/     var __webpack_modules__ = ({
   4  
   5  /***/ 3304:
   6  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
   7  
   8  
   9  
  10  Object.defineProperty(exports, "__esModule", ({
  11    value: true
  12  }));
  13  exports.cps = exports.call = undefined;
  14  
  15  var _is = __webpack_require__(6921);
  16  
  17  var _is2 = _interopRequireDefault(_is);
  18  
  19  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  20  
  21  function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
  22  
  23  var call = exports.call = function call(value, next, rungen, yieldNext, raiseNext) {
  24    if (!_is2.default.call(value)) return false;
  25    try {
  26      next(value.func.apply(value.context, value.args));
  27    } catch (err) {
  28      raiseNext(err);
  29    }
  30    return true;
  31  };
  32  
  33  var cps = exports.cps = function cps(value, next, rungen, yieldNext, raiseNext) {
  34    var _value$func;
  35  
  36    if (!_is2.default.cps(value)) return false;
  37    (_value$func = value.func).call.apply(_value$func, [null].concat(_toConsumableArray(value.args), [function (err, result) {
  38      if (err) raiseNext(err);else next(result);
  39    }]));
  40    return true;
  41  };
  42  
  43  exports["default"] = [call, cps];
  44  
  45  /***/ }),
  46  
  47  /***/ 3524:
  48  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  49  
  50  
  51  
  52  Object.defineProperty(exports, "__esModule", ({
  53    value: true
  54  }));
  55  exports.createChannel = exports.subscribe = exports.cps = exports.apply = exports.call = exports.invoke = exports.delay = exports.race = exports.join = exports.fork = exports.error = exports.all = undefined;
  56  
  57  var _keys = __webpack_require__(4137);
  58  
  59  var _keys2 = _interopRequireDefault(_keys);
  60  
  61  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  62  
  63  var all = exports.all = function all(value) {
  64    return {
  65      type: _keys2.default.all,
  66      value: value
  67    };
  68  };
  69  
  70  var error = exports.error = function error(err) {
  71    return {
  72      type: _keys2.default.error,
  73      error: err
  74    };
  75  };
  76  
  77  var fork = exports.fork = function fork(iterator) {
  78    for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  79      args[_key - 1] = arguments[_key];
  80    }
  81  
  82    return {
  83      type: _keys2.default.fork,
  84      iterator: iterator,
  85      args: args
  86    };
  87  };
  88  
  89  var join = exports.join = function join(task) {
  90    return {
  91      type: _keys2.default.join,
  92      task: task
  93    };
  94  };
  95  
  96  var race = exports.race = function race(competitors) {
  97    return {
  98      type: _keys2.default.race,
  99      competitors: competitors
 100    };
 101  };
 102  
 103  var delay = exports.delay = function delay(timeout) {
 104    return new Promise(function (resolve) {
 105      setTimeout(function () {
 106        return resolve(true);
 107      }, timeout);
 108    });
 109  };
 110  
 111  var invoke = exports.invoke = function invoke(func) {
 112    for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
 113      args[_key2 - 1] = arguments[_key2];
 114    }
 115  
 116    return {
 117      type: _keys2.default.call,
 118      func: func,
 119      context: null,
 120      args: args
 121    };
 122  };
 123  
 124  var call = exports.call = function call(func, context) {
 125    for (var _len3 = arguments.length, args = Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
 126      args[_key3 - 2] = arguments[_key3];
 127    }
 128  
 129    return {
 130      type: _keys2.default.call,
 131      func: func,
 132      context: context,
 133      args: args
 134    };
 135  };
 136  
 137  var apply = exports.apply = function apply(func, context, args) {
 138    return {
 139      type: _keys2.default.call,
 140      func: func,
 141      context: context,
 142      args: args
 143    };
 144  };
 145  
 146  var cps = exports.cps = function cps(func) {
 147    for (var _len4 = arguments.length, args = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
 148      args[_key4 - 1] = arguments[_key4];
 149    }
 150  
 151    return {
 152      type: _keys2.default.cps,
 153      func: func,
 154      args: args
 155    };
 156  };
 157  
 158  var subscribe = exports.subscribe = function subscribe(channel) {
 159    return {
 160      type: _keys2.default.subscribe,
 161      channel: channel
 162    };
 163  };
 164  
 165  var createChannel = exports.createChannel = function createChannel(callback) {
 166    var listeners = [];
 167    var subscribe = function subscribe(l) {
 168      listeners.push(l);
 169      return function () {
 170        return listeners.splice(listeners.indexOf(l), 1);
 171      };
 172    };
 173    var next = function next(val) {
 174      return listeners.forEach(function (l) {
 175        return l(val);
 176      });
 177    };
 178    callback(next);
 179  
 180    return {
 181      subscribe: subscribe
 182    };
 183  };
 184  
 185  /***/ }),
 186  
 187  /***/ 4137:
 188  /***/ ((__unused_webpack_module, exports) => {
 189  
 190  
 191  
 192  Object.defineProperty(exports, "__esModule", ({
 193    value: true
 194  }));
 195  var keys = {
 196    all: Symbol('all'),
 197    error: Symbol('error'),
 198    fork: Symbol('fork'),
 199    join: Symbol('join'),
 200    race: Symbol('race'),
 201    call: Symbol('call'),
 202    cps: Symbol('cps'),
 203    subscribe: Symbol('subscribe')
 204  };
 205  
 206  exports["default"] = keys;
 207  
 208  /***/ }),
 209  
 210  /***/ 5136:
 211  /***/ ((__unused_webpack_module, exports) => {
 212  
 213  
 214  
 215  Object.defineProperty(exports, "__esModule", ({
 216    value: true
 217  }));
 218  var createDispatcher = function createDispatcher() {
 219    var listeners = [];
 220  
 221    return {
 222      subscribe: function subscribe(listener) {
 223        listeners.push(listener);
 224        return function () {
 225          listeners = listeners.filter(function (l) {
 226            return l !== listener;
 227          });
 228        };
 229      },
 230      dispatch: function dispatch(action) {
 231        listeners.slice().forEach(function (listener) {
 232          return listener(action);
 233        });
 234      }
 235    };
 236  };
 237  
 238  exports["default"] = createDispatcher;
 239  
 240  /***/ }),
 241  
 242  /***/ 5357:
 243  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
 244  
 245  
 246  
 247  Object.defineProperty(exports, "__esModule", ({
 248    value: true
 249  }));
 250  exports.iterator = exports.array = exports.object = exports.error = exports.any = undefined;
 251  
 252  var _is = __webpack_require__(6921);
 253  
 254  var _is2 = _interopRequireDefault(_is);
 255  
 256  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
 257  
 258  var any = exports.any = function any(value, next, rungen, yieldNext) {
 259    yieldNext(value);
 260    return true;
 261  };
 262  
 263  var error = exports.error = function error(value, next, rungen, yieldNext, raiseNext) {
 264    if (!_is2.default.error(value)) return false;
 265    raiseNext(value.error);
 266    return true;
 267  };
 268  
 269  var object = exports.object = function object(value, next, rungen, yieldNext, raiseNext) {
 270    if (!_is2.default.all(value) || !_is2.default.obj(value.value)) return false;
 271    var result = {};
 272    var keys = Object.keys(value.value);
 273    var count = 0;
 274    var hasError = false;
 275    var gotResultSuccess = function gotResultSuccess(key, ret) {
 276      if (hasError) return;
 277      result[key] = ret;
 278      count++;
 279      if (count === keys.length) {
 280        yieldNext(result);
 281      }
 282    };
 283  
 284    var gotResultError = function gotResultError(key, error) {
 285      if (hasError) return;
 286      hasError = true;
 287      raiseNext(error);
 288    };
 289  
 290    keys.map(function (key) {
 291      rungen(value.value[key], function (ret) {
 292        return gotResultSuccess(key, ret);
 293      }, function (err) {
 294        return gotResultError(key, err);
 295      });
 296    });
 297  
 298    return true;
 299  };
 300  
 301  var array = exports.array = function array(value, next, rungen, yieldNext, raiseNext) {
 302    if (!_is2.default.all(value) || !_is2.default.array(value.value)) return false;
 303    var result = [];
 304    var count = 0;
 305    var hasError = false;
 306    var gotResultSuccess = function gotResultSuccess(key, ret) {
 307      if (hasError) return;
 308      result[key] = ret;
 309      count++;
 310      if (count === value.value.length) {
 311        yieldNext(result);
 312      }
 313    };
 314  
 315    var gotResultError = function gotResultError(key, error) {
 316      if (hasError) return;
 317      hasError = true;
 318      raiseNext(error);
 319    };
 320  
 321    value.value.map(function (v, key) {
 322      rungen(v, function (ret) {
 323        return gotResultSuccess(key, ret);
 324      }, function (err) {
 325        return gotResultError(key, err);
 326      });
 327    });
 328  
 329    return true;
 330  };
 331  
 332  var iterator = exports.iterator = function iterator(value, next, rungen, yieldNext, raiseNext) {
 333    if (!_is2.default.iterator(value)) return false;
 334    rungen(value, next, raiseNext);
 335    return true;
 336  };
 337  
 338  exports["default"] = [error, iterator, array, object, any];
 339  
 340  /***/ }),
 341  
 342  /***/ 6910:
 343  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
 344  
 345  
 346  
 347  Object.defineProperty(exports, "__esModule", ({
 348    value: true
 349  }));
 350  exports.race = exports.join = exports.fork = exports.promise = undefined;
 351  
 352  var _is = __webpack_require__(6921);
 353  
 354  var _is2 = _interopRequireDefault(_is);
 355  
 356  var _helpers = __webpack_require__(3524);
 357  
 358  var _dispatcher = __webpack_require__(5136);
 359  
 360  var _dispatcher2 = _interopRequireDefault(_dispatcher);
 361  
 362  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
 363  
 364  var promise = exports.promise = function promise(value, next, rungen, yieldNext, raiseNext) {
 365    if (!_is2.default.promise(value)) return false;
 366    value.then(next, raiseNext);
 367    return true;
 368  };
 369  
 370  var forkedTasks = new Map();
 371  var fork = exports.fork = function fork(value, next, rungen) {
 372    if (!_is2.default.fork(value)) return false;
 373    var task = Symbol('fork');
 374    var dispatcher = (0, _dispatcher2.default)();
 375    forkedTasks.set(task, dispatcher);
 376    rungen(value.iterator.apply(null, value.args), function (result) {
 377      return dispatcher.dispatch(result);
 378    }, function (err) {
 379      return dispatcher.dispatch((0, _helpers.error)(err));
 380    });
 381    var unsubscribe = dispatcher.subscribe(function () {
 382      unsubscribe();
 383      forkedTasks.delete(task);
 384    });
 385    next(task);
 386    return true;
 387  };
 388  
 389  var join = exports.join = function join(value, next, rungen, yieldNext, raiseNext) {
 390    if (!_is2.default.join(value)) return false;
 391    var dispatcher = forkedTasks.get(value.task);
 392    if (!dispatcher) {
 393      raiseNext('join error : task not found');
 394    } else {
 395      (function () {
 396        var unsubscribe = dispatcher.subscribe(function (result) {
 397          unsubscribe();
 398          next(result);
 399        });
 400      })();
 401    }
 402    return true;
 403  };
 404  
 405  var race = exports.race = function race(value, next, rungen, yieldNext, raiseNext) {
 406    if (!_is2.default.race(value)) return false;
 407    var finished = false;
 408    var success = function success(result, k, v) {
 409      if (finished) return;
 410      finished = true;
 411      result[k] = v;
 412      next(result);
 413    };
 414  
 415    var fail = function fail(err) {
 416      if (finished) return;
 417      raiseNext(err);
 418    };
 419    if (_is2.default.array(value.competitors)) {
 420      (function () {
 421        var result = value.competitors.map(function () {
 422          return false;
 423        });
 424        value.competitors.forEach(function (competitor, index) {
 425          rungen(competitor, function (output) {
 426            return success(result, index, output);
 427          }, fail);
 428        });
 429      })();
 430    } else {
 431      (function () {
 432        var result = Object.keys(value.competitors).reduce(function (p, c) {
 433          p[c] = false;
 434          return p;
 435        }, {});
 436        Object.keys(value.competitors).forEach(function (index) {
 437          rungen(value.competitors[index], function (output) {
 438            return success(result, index, output);
 439          }, fail);
 440        });
 441      })();
 442    }
 443    return true;
 444  };
 445  
 446  var subscribe = function subscribe(value, next) {
 447    if (!_is2.default.subscribe(value)) return false;
 448    if (!_is2.default.channel(value.channel)) {
 449      throw new Error('the first argument of "subscribe" must be a valid channel');
 450    }
 451    var unsubscribe = value.channel.subscribe(function (ret) {
 452      unsubscribe && unsubscribe();
 453      next(ret);
 454    });
 455  
 456    return true;
 457  };
 458  
 459  exports["default"] = [promise, fork, join, race, subscribe];
 460  
 461  /***/ }),
 462  
 463  /***/ 6921:
 464  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
 465  
 466  
 467  
 468  Object.defineProperty(exports, "__esModule", ({
 469    value: true
 470  }));
 471  
 472  var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
 473  
 474  var _keys = __webpack_require__(4137);
 475  
 476  var _keys2 = _interopRequireDefault(_keys);
 477  
 478  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
 479  
 480  var is = {
 481    obj: function obj(value) {
 482      return (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && !!value;
 483    },
 484    all: function all(value) {
 485      return is.obj(value) && value.type === _keys2.default.all;
 486    },
 487    error: function error(value) {
 488      return is.obj(value) && value.type === _keys2.default.error;
 489    },
 490    array: Array.isArray,
 491    func: function func(value) {
 492      return typeof value === 'function';
 493    },
 494    promise: function promise(value) {
 495      return value && is.func(value.then);
 496    },
 497    iterator: function iterator(value) {
 498      return value && is.func(value.next) && is.func(value.throw);
 499    },
 500    fork: function fork(value) {
 501      return is.obj(value) && value.type === _keys2.default.fork;
 502    },
 503    join: function join(value) {
 504      return is.obj(value) && value.type === _keys2.default.join;
 505    },
 506    race: function race(value) {
 507      return is.obj(value) && value.type === _keys2.default.race;
 508    },
 509    call: function call(value) {
 510      return is.obj(value) && value.type === _keys2.default.call;
 511    },
 512    cps: function cps(value) {
 513      return is.obj(value) && value.type === _keys2.default.cps;
 514    },
 515    subscribe: function subscribe(value) {
 516      return is.obj(value) && value.type === _keys2.default.subscribe;
 517    },
 518    channel: function channel(value) {
 519      return is.obj(value) && is.func(value.subscribe);
 520    }
 521  };
 522  
 523  exports["default"] = is;
 524  
 525  /***/ }),
 526  
 527  /***/ 8975:
 528  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
 529  
 530  
 531  
 532  Object.defineProperty(exports, "__esModule", ({
 533    value: true
 534  }));
 535  exports.wrapControls = exports.asyncControls = exports.create = undefined;
 536  
 537  var _helpers = __webpack_require__(3524);
 538  
 539  Object.keys(_helpers).forEach(function (key) {
 540    if (key === "default") return;
 541    Object.defineProperty(exports, key, {
 542      enumerable: true,
 543      get: function get() {
 544        return _helpers[key];
 545      }
 546    });
 547  });
 548  
 549  var _create = __webpack_require__(9127);
 550  
 551  var _create2 = _interopRequireDefault(_create);
 552  
 553  var _async = __webpack_require__(6910);
 554  
 555  var _async2 = _interopRequireDefault(_async);
 556  
 557  var _wrap = __webpack_require__(3304);
 558  
 559  var _wrap2 = _interopRequireDefault(_wrap);
 560  
 561  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
 562  
 563  exports.create = _create2.default;
 564  exports.asyncControls = _async2.default;
 565  exports.wrapControls = _wrap2.default;
 566  
 567  /***/ }),
 568  
 569  /***/ 9127:
 570  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
 571  
 572  
 573  
 574  Object.defineProperty(exports, "__esModule", ({
 575    value: true
 576  }));
 577  
 578  var _builtin = __webpack_require__(5357);
 579  
 580  var _builtin2 = _interopRequireDefault(_builtin);
 581  
 582  var _is = __webpack_require__(6921);
 583  
 584  var _is2 = _interopRequireDefault(_is);
 585  
 586  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
 587  
 588  function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
 589  
 590  var create = function create() {
 591    var userControls = arguments.length <= 0 || arguments[0] === undefined ? [] : arguments[0];
 592  
 593    var controls = [].concat(_toConsumableArray(userControls), _toConsumableArray(_builtin2.default));
 594  
 595    var runtime = function runtime(input) {
 596      var success = arguments.length <= 1 || arguments[1] === undefined ? function () {} : arguments[1];
 597      var error = arguments.length <= 2 || arguments[2] === undefined ? function () {} : arguments[2];
 598  
 599      var iterate = function iterate(gen) {
 600        var yieldValue = function yieldValue(isError) {
 601          return function (ret) {
 602            try {
 603              var _ref = isError ? gen.throw(ret) : gen.next(ret);
 604  
 605              var value = _ref.value;
 606              var done = _ref.done;
 607  
 608              if (done) return success(value);
 609              next(value);
 610            } catch (e) {
 611              return error(e);
 612            }
 613          };
 614        };
 615  
 616        var next = function next(ret) {
 617          controls.some(function (control) {
 618            return control(ret, next, runtime, yieldValue(false), yieldValue(true));
 619          });
 620        };
 621  
 622        yieldValue(false)();
 623      };
 624  
 625      var iterator = _is2.default.iterator(input) ? input : regeneratorRuntime.mark(function _callee() {
 626        return regeneratorRuntime.wrap(function _callee$(_context) {
 627          while (1) {
 628            switch (_context.prev = _context.next) {
 629              case 0:
 630                _context.next = 2;
 631                return input;
 632  
 633              case 2:
 634                return _context.abrupt('return', _context.sent);
 635  
 636              case 3:
 637              case 'end':
 638                return _context.stop();
 639            }
 640          }
 641        }, _callee, this);
 642      })();
 643  
 644      iterate(iterator, success, error);
 645    };
 646  
 647    return runtime;
 648  };
 649  
 650  exports["default"] = create;
 651  
 652  /***/ })
 653  
 654  /******/     });
 655  /************************************************************************/
 656  /******/     // The module cache
 657  /******/     var __webpack_module_cache__ = {};
 658  /******/     
 659  /******/     // The require function
 660  /******/ 	function __webpack_require__(moduleId) {
 661  /******/         // Check if module is in cache
 662  /******/         var cachedModule = __webpack_module_cache__[moduleId];
 663  /******/         if (cachedModule !== undefined) {
 664  /******/             return cachedModule.exports;
 665  /******/         }
 666  /******/         // Create a new module (and put it into the cache)
 667  /******/         var module = __webpack_module_cache__[moduleId] = {
 668  /******/             // no module.id needed
 669  /******/             // no module.loaded needed
 670  /******/             exports: {}
 671  /******/         };
 672  /******/     
 673  /******/         // Execute the module function
 674  /******/         __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
 675  /******/     
 676  /******/         // Return the exports of the module
 677  /******/         return module.exports;
 678  /******/     }
 679  /******/     
 680  /************************************************************************/
 681  /******/     /* webpack/runtime/define property getters */
 682  /******/     (() => {
 683  /******/         // define getter functions for harmony exports
 684  /******/         __webpack_require__.d = (exports, definition) => {
 685  /******/             for(var key in definition) {
 686  /******/                 if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
 687  /******/                     Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
 688  /******/                 }
 689  /******/             }
 690  /******/         };
 691  /******/     })();
 692  /******/     
 693  /******/     /* webpack/runtime/hasOwnProperty shorthand */
 694  /******/     (() => {
 695  /******/         __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
 696  /******/     })();
 697  /******/     
 698  /************************************************************************/
 699  var __webpack_exports__ = {};
 700  
 701  // EXPORTS
 702  __webpack_require__.d(__webpack_exports__, {
 703    "default": () => (/* binding */ createMiddleware)
 704  });
 705  
 706  ;// ./node_modules/@wordpress/redux-routine/build-module/is-generator.js
 707  /* eslint-disable jsdoc/valid-types */
 708  /**
 709   * Returns true if the given object is a generator, or false otherwise.
 710   *
 711   * @see https://www.ecma-international.org/ecma-262/6.0/#sec-generator-objects
 712   *
 713   * @param {any} object Object to test.
 714   *
 715   * @return {object is Generator} Whether object is a generator.
 716   */
 717  function isGenerator(object) {
 718    /* eslint-enable jsdoc/valid-types */
 719    // Check that iterator (next) and iterable (Symbol.iterator) interfaces are satisfied.
 720    // These checks seem to be compatible with several generator helpers as well as the native implementation.
 721    return !!object && typeof object[Symbol.iterator] === 'function' && typeof object.next === 'function';
 722  }
 723  
 724  // EXTERNAL MODULE: ./node_modules/rungen/dist/index.js
 725  var dist = __webpack_require__(8975);
 726  ;// ./node_modules/is-promise/index.mjs
 727  function isPromise(obj) {
 728    return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
 729  }
 730  
 731  ;// ./node_modules/is-plain-object/dist/is-plain-object.mjs
 732  /*!
 733   * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
 734   *
 735   * Copyright (c) 2014-2017, Jon Schlinkert.
 736   * Released under the MIT License.
 737   */
 738  
 739  function isObject(o) {
 740    return Object.prototype.toString.call(o) === '[object Object]';
 741  }
 742  
 743  function isPlainObject(o) {
 744    var ctor,prot;
 745  
 746    if (isObject(o) === false) return false;
 747  
 748    // If has modified constructor
 749    ctor = o.constructor;
 750    if (ctor === undefined) return true;
 751  
 752    // If has modified prototype
 753    prot = ctor.prototype;
 754    if (isObject(prot) === false) return false;
 755  
 756    // If constructor does not have an Object-specific method
 757    if (prot.hasOwnProperty('isPrototypeOf') === false) {
 758      return false;
 759    }
 760  
 761    // Most likely a plain Object
 762    return true;
 763  }
 764  
 765  
 766  
 767  ;// ./node_modules/@wordpress/redux-routine/build-module/is-action.js
 768  /**
 769   * External dependencies
 770   */
 771  
 772  
 773  /* eslint-disable jsdoc/valid-types */
 774  /**
 775   * Returns true if the given object quacks like an action.
 776   *
 777   * @param {any} object Object to test
 778   *
 779   * @return {object is import('redux').AnyAction}  Whether object is an action.
 780   */
 781  function isAction(object) {
 782    return isPlainObject(object) && typeof object.type === 'string';
 783  }
 784  
 785  /**
 786   * Returns true if the given object quacks like an action and has a specific
 787   * action type
 788   *
 789   * @param {unknown} object       Object to test
 790   * @param {string}  expectedType The expected type for the action.
 791   *
 792   * @return {object is import('redux').AnyAction} Whether object is an action and is of specific type.
 793   */
 794  function isActionOfType(object, expectedType) {
 795    /* eslint-enable jsdoc/valid-types */
 796    return isAction(object) && object.type === expectedType;
 797  }
 798  
 799  ;// ./node_modules/@wordpress/redux-routine/build-module/runtime.js
 800  /**
 801   * External dependencies
 802   */
 803  
 804  
 805  
 806  /**
 807   * Internal dependencies
 808   */
 809  
 810  
 811  /**
 812   * Create a co-routine runtime.
 813   *
 814   * @param controls Object of control handlers.
 815   * @param dispatch Unhandled action dispatch.
 816   */
 817  function createRuntime(controls = {}, dispatch) {
 818    const rungenControls = Object.entries(controls).map(([actionType, control]) => (value, next, iterate, yieldNext, yieldError) => {
 819      if (!isActionOfType(value, actionType)) {
 820        return false;
 821      }
 822      const routine = control(value);
 823      if (isPromise(routine)) {
 824        // Async control routine awaits resolution.
 825        routine.then(yieldNext, yieldError);
 826      } else {
 827        yieldNext(routine);
 828      }
 829      return true;
 830    });
 831    const unhandledActionControl = (value, next) => {
 832      if (!isAction(value)) {
 833        return false;
 834      }
 835      dispatch(value);
 836      next();
 837      return true;
 838    };
 839    rungenControls.push(unhandledActionControl);
 840    const rungenRuntime = (0,dist.create)(rungenControls);
 841    return action => new Promise((resolve, reject) => rungenRuntime(action, result => {
 842      if (isAction(result)) {
 843        dispatch(result);
 844      }
 845      resolve(result);
 846    }, reject));
 847  }
 848  
 849  ;// ./node_modules/@wordpress/redux-routine/build-module/index.js
 850  /**
 851   * Internal dependencies
 852   */
 853  
 854  
 855  
 856  /**
 857   * Creates a Redux middleware, given an object of controls where each key is an
 858   * action type for which to act upon, the value a function which returns either
 859   * a promise which is to resolve when evaluation of the action should continue,
 860   * or a value. The value or resolved promise value is assigned on the return
 861   * value of the yield assignment. If the control handler returns undefined, the
 862   * execution is not continued.
 863   *
 864   * @param {Record<string, (value: import('redux').AnyAction) => Promise<boolean> | boolean>} controls Object of control handlers.
 865   *
 866   * @return {import('redux').Middleware} Co-routine runtime
 867   */
 868  function createMiddleware(controls = {}) {
 869    return store => {
 870      const runtime = createRuntime(controls, store.dispatch);
 871      return next => action => {
 872        if (!isGenerator(action)) {
 873          return next(action);
 874        }
 875        return runtime(action);
 876      };
 877    };
 878  }
 879  
 880  (window.wp = window.wp || {}).reduxRoutine = __webpack_exports__["default"];
 881  /******/ })()
 882  ;


Generated : Thu Apr 3 08:20:01 2025 Cross-referenced by PHPXref