vendor: 4,541 bytes, lines 1-105
1/******/ (function() { // webpackBootstrap 2/******/ "use strict"; 3/******/ // The require scope 4/******/ var __webpack_require__ = {}; 5/******/ 6/************************************************************************/ 7/******/ /* webpack/runtime/define property getters */ 8/******/ !function() { 9/******/ // define getter functions for harmony exports 10/******/ __webpack_require__.d = function(exports, definition) { 11/******/ for(var key in definition) { 12/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 13/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 14/******/ } 15/******/ } 16/******/ }; 17/******/ }(); 18/******/ 19/******/ /* webpack/runtime/hasOwnProperty shorthand */ 20/******/ !function() { 21/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } 22/******/ }(); 23/******/ 24/******/ /* webpack/runtime/make namespace object */ 25/******/ !function() { 26/******/ // define __esModule on exports 27/******/ __webpack_require__.r = function(exports) { 28/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 29/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 30/******/ } 31/******/ Object.defineProperty(exports, '__esModule', { value: true }); 32/******/ }; 33/******/ }(); 34/******/ 35/************************************************************************/ 36var __webpack_exports__ = {}; 37// ESM COMPAT FLAG 38__webpack_require__.r(__webpack_exports__); 39 40// EXPORTS 41__webpack_require__.d(__webpack_exports__, { 42 "actions": function() { return /* binding */ actions; }, 43 "addAction": function() { return /* binding */ addAction; }, 44 "addFilter": function() { return /* binding */ addFilter; }, 45 "applyFilters": function() { return /* binding */ applyFilters; }, 46 "createHooks": function() { return /* reexport */ build_module_createHooks; }, 47 "currentAction": function() { return /* binding */ currentAction; }, 48 "currentFilter": function() { return /* binding */ currentFilter; }, 49 "defaultHooks": function() { return /* binding */ defaultHooks; }, 50 "didAction": function() { return /* binding */ didAction; }, 51 "didFilter": function() { return /* binding */ didFilter; }, 52 "doAction": function() { return /* binding */ doAction; }, 53 "doingAction": function() { return /* binding */ doingAction; }, 54 "doingFilter": function() { return /* binding */ doingFilter; }, 55 "filters": function() { return /* binding */ filters; }, 56 "hasAction": function() { return /* binding */ hasAction; }, 57 "hasFilter": function() { return /* binding */ hasFilter; }, 58 "removeAction": function() { return /* binding */ removeAction; }, 59 "removeAllActions": function() { return /* binding */ removeAllActions; }, 60 "removeAllFilters": function() { return /* binding */ removeAllFilters; }, 61 "removeFilter": function() { return /* binding */ removeFilter; } 62}); 63 64;// CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/validateNamespace.js 65/** 66 * Validate a namespace string. 67 * 68 * @param {string} namespace The namespace to validate - should take the form 69 * `vendor/plugin/function`. 70 * 71 * @return {boolean} Whether the namespace is valid. 72 */ 73function validateNamespace(namespace) { 74 if ('string' !== typeof namespace || '' === namespace) { 75 // eslint-disable-next-line no-console 76 console.error('The namespace must be a non-empty string.'); 77 return false; 78 } 79 80 if (!/^[a-zA-Z][a-zA-Z0-9_.\-\/]*$/.test(namespace)) { 81 // eslint-disable-next-line no-console 82 console.error('The namespace can only contain numbers, letters, dashes, periods, underscores and slashes.'); 83 return false; 84 } 85 86 return true; 87} 88 89/* harmony default export */ var build_module_validateNamespace = (validateNamespace); 90 91;// CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/validateHookName.js 92/** 93 * Validate a hookName string. 94 * 95 * @param {string} hookName The hook name to validate. Should be a non empty string containing 96 * only numbers, letters, dashes, periods and underscores. Also, 97 * the hook name cannot begin with `__`. 98 * 99 * @return {boolean} Whether the hook name is valid. 100 */ 101function validateHookName(hookName) { 102 if ('string' !== typeof hookName || '' === hookName) { 103 // eslint-disable-next-line no-console 104 console.error('The hook name must be a non-empty string.'); 105 return false;
106 } 107 108 if (/^__/.test(hookName)) { 109 // eslint-disable-next-line no-console 110 console.error('The hook name cannot begin with `__`.'); 111 return false; 112 } 113 114 if (!/^[a-zA-Z][a-zA-Z0-9_.-]*$/.test(hookName)) { 115 // eslint-disable-next-line no-console 116 console.error('The hook name can only contain numbers, letters, dashes, periods and underscores.'); 117 return false; 118 } 119 120 return true; 121} 122 123/* harmony default export */ var build_module_validateHookName = (validateHookName); 124 125;// CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createAddHook.js 126/** 127 * Internal dependencies 128 */ 129 130 131/** 132 * @callback AddHook 133 * 134 * Adds the hook to the appropriate hooks container. 135 * 136 * @param {string} hookName Name of hook to add 137 * @param {string} namespace The unique namespace identifying the callback in the form `vendor/plugin/function`. 138 * @param {import('.').Callback} callback Function to call when the hook is run 139 * @param {number} [priority=10] Priority of this hook 140 */ 141 142/** 143 * Returns a function which, when invoked, will add a hook. 144 * 145 * @param {import('.').Hooks} hooks Hooks instance. 146 * @param {import('.').StoreKey} storeKey 147 * 148 * @return {AddHook} Function that adds a new hook. 149 */ 150 151function createAddHook(hooks, storeKey) { 152 return function addHook(hookName, namespace, callback, priority = 10) { 153 const hooksStore = hooks[storeKey]; 154 155 if (!build_module_validateHookName(hookName)) { 156 return; 157 } 158 159 if (!build_module_validateNamespace(namespace)) { 160 return; 161 } 162 163 if ('function' !== typeof callback) { 164 // eslint-disable-next-line no-console 165 console.error('The hook callback must be a function.'); 166 return; 167 } // Validate numeric priority 168 169 170 if ('number' !== typeof priority) { 171 // eslint-disable-next-line no-console 172 console.error('If specified, the hook priority must be a number.'); 173 return; 174 } 175 176 const handler = { 177 callback, 178 priority, 179 namespace 180 }; 181 182 if (hooksStore[hookName]) { 183 // Find the correct insert index of the new hook. 184 const handlers = hooksStore[hookName].handlers; 185 /** @type {number} */ 186 187 let i; 188 189 for (i = handlers.length; i > 0; i--) { 190 if (priority >= handlers[i - 1].priority) { 191 break; 192 } 193 } 194 195 if (i === handlers.length) { 196 // If append, operate via direct assignment. 197 handlers[i] = handler; 198 } else { 199 // Otherwise, insert before index via splice. 200 handlers.splice(i, 0, handler); 201 } // We may also be currently executing this hook. If the callback 202 // we're adding would come after the current callback, there's no 203 // problem; otherwise we need to increase the execution index of 204 // any other runs by 1 to account for the added element. 205 206 207 hooksStore.__current.forEach(hookInfo => { 208 if (hookInfo.name === hookName && hookInfo.currentIndex >= i) { 209 hookInfo.currentIndex++; 210 } 211 }); 212 } else { 213 // This is the first hook of its type. 214 hooksStore[hookName] = { 215 handlers: [handler], 216 runs: 0 217 }; 218 } 219 220 if (hookName !== 'hookAdded') { 221 hooks.doAction('hookAdded', hookName, namespace, callback, priority); 222 } 223 }; 224} 225 226/* harmony default export */ var build_module_createAddHook = (createAddHook); 227 228;// CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createRemoveHook.js 229/** 230 * Internal dependencies 231 */ 232 233 234/** 235 * @callback RemoveHook 236 * Removes the specified callback (or all callbacks) from the hook with a given hookName 237 * and namespace. 238 * 239 * @param {string} hookName The name of the hook to modify. 240 * @param {string} namespace The unique namespace identifying the callback in the 241 * form `vendor/plugin/function`. 242 * 243 * @return {number | undefined} The number of callbacks removed. 244 */ 245 246/** 247 * Returns a function which, when invoked, will remove a specified hook or all 248 * hooks by the given name. 249 * 250 * @param {import('.').Hooks} hooks Hooks instance. 251 * @param {import('.').StoreKey} storeKey 252 * @param {boolean} [removeAll=false] Whether to remove all callbacks for a hookName, 253 * without regard to namespace. Used to create 254 * `removeAll*` functions. 255 * 256 * @return {RemoveHook} Function that removes hooks. 257 */ 258 259function createRemoveHook(hooks, storeKey, removeAll = false) { 260 return function removeHook(hookName, namespace) { 261 const hooksStore = hooks[storeKey]; 262 263 if (!build_module_validateHookName(hookName)) { 264 return; 265 } 266 267 if (!removeAll && !build_module_validateNamespace(namespace)) { 268 return; 269 } // Bail if no hooks exist by this name. 270 271 272 if (!hooksStore[hookName]) { 273 return 0; 274 } 275 276 let handlersRemoved = 0; 277 278 if (removeAll) { 279 handlersRemoved = hooksStore[hookName].handlers.length; 280 hooksStore[hookName] = { 281 runs: hooksStore[hookName].runs, 282 handlers: [] 283 }; 284 } else { 285 // Try to find the specified callback to remove. 286 const handlers = hooksStore[hookName].handlers; 287 288 for (let i = handlers.length - 1; i >= 0; i--) { 289 if (handlers[i].namespace === namespace) { 290 handlers.splice(i, 1); 291 handlersRemoved++; // This callback may also be part of a hook that is 292 // currently executing. If the callback we're removing 293 // comes after the current callback, there's no problem; 294 // otherwise we need to decrease the execution index of any 295 // other runs by 1 to account for the removed element. 296 297 hooksStore.__current.forEach(hookInfo => { 298 if (hookInfo.name === hookName && hookInfo.currentIndex >= i) { 299 hookInfo.currentIndex--; 300 } 301 }); 302 } 303 } 304 } 305 306 if (hookName !== 'hookRemoved') { 307 hooks.doAction('hookRemoved', hookName, namespace); 308 } 309 310 return handlersRemoved; 311 }; 312} 313 314/* harmony default export */ var build_module_createRemoveHook = (createRemoveHook); 315 316;// CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createHasHook.js 317/** 318 * @callback HasHook 319 * 320 * Returns whether any handlers are attached for the given hookName and optional namespace. 321 * 322 * @param {string} hookName The name of the hook to check for. 323 * @param {string} [namespace] Optional. The unique namespace identifying the callback 324 * in the form `vendor/plugin/function`. 325 * 326 * @return {boolean} Whether there are handlers that are attached to the given hook. 327 */ 328 329/** 330 * Returns a function which, when invoked, will return whether any handlers are 331 * attached to a particular hook. 332 * 333 * @param {import('.').Hooks} hooks Hooks instance. 334 * @param {import('.').StoreKey} storeKey 335 * 336 * @return {HasHook} Function that returns whether any handlers are 337 * attached to a particular hook and optional namespace. 338 */ 339function createHasHook(hooks, storeKey) { 340 return function hasHook(hookName, namespace) { 341 const hooksStore = hooks[storeKey]; // Use the namespace if provided. 342 343 if ('undefined' !== typeof namespace) { 344 return hookName in hooksStore && hooksStore[hookName].handlers.some(hook => hook.namespace === namespace); 345 } 346 347 return hookName in hooksStore; 348 }; 349} 350 351/* harmony default export */ var build_module_createHasHook = (createHasHook); 352 353;// CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createRunHook.js 354/** 355 * Returns a function which, when invoked, will execute all callbacks 356 * registered to a hook of the specified type, optionally returning the final 357 * value of the call chain. 358 * 359 * @param {import('.').Hooks} hooks Hooks instance. 360 * @param {import('.').StoreKey} storeKey 361 * @param {boolean} [returnFirstArg=false] Whether each hook callback is expected to 362 * return its first argument. 363 *
364 * @return {(hookName:string, ...args: unknown[]) => unknown} Function that runs hook callbacks. 365 */ 366function createRunHook(hooks, storeKey, returnFirstArg = false) { 367 return function runHooks(hookName, ...args) { 368 const hooksStore = hooks[storeKey]; 369 370 if (!hooksStore[hookName]) { 371 hooksStore[hookName] = { 372 handlers: [], 373 runs: 0 374 }; 375 } 376 377 hooksStore[hookName].runs++; 378 const handlers = hooksStore[hookName].handlers; // The following code is stripped from production builds. 379 380 if (false) {} 381 382 if (!handlers || !handlers.length) { 383 return returnFirstArg ? args[0] : undefined; 384 } 385 386 const hookInfo = { 387 name: hookName, 388 currentIndex: 0 389 }; 390 391 hooksStore.__current.push(hookInfo); 392 393 while (hookInfo.currentIndex < handlers.length) { 394 const handler = handlers[hookInfo.currentIndex]; 395 const result = handler.callback.apply(null, args); 396 397 if (returnFirstArg) { 398 args[0] = result; 399 } 400 401 hookInfo.currentIndex++; 402 } 403 404 hooksStore.__current.pop(); 405 406 if (returnFirstArg) { 407 return args[0]; 408 } 409 }; 410} 411 412/* harmony default export */ var build_module_createRunHook = (createRunHook); 413 414;// CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createCurrentHook.js 415/** 416 * Returns a function which, when invoked, will return the name of the 417 * currently running hook, or `null` if no hook of the given type is currently 418 * running. 419 * 420 * @param {import('.').Hooks} hooks Hooks instance. 421 * @param {import('.').StoreKey} storeKey 422 * 423 * @return {() => string | null} Function that returns the current hook name or null. 424 */ 425function createCurrentHook(hooks, storeKey) { 426 return function currentHook() { 427 var _hooksStore$__current; 428 429 const hooksStore = hooks[storeKey]; 430 return (_hooksStore$__current = hooksStore.__current[hooksStore.__current.length - 1]?.name) !== null && _hooksStore$__current !== void 0 ? _hooksStore$__current : null; 431 }; 432} 433 434/* harmony default export */ var build_module_createCurrentHook = (createCurrentHook); 435 436;// CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createDoingHook.js 437/** 438 * @callback DoingHook 439 * Returns whether a hook is currently being executed. 440 * 441 * @param {string} [hookName] The name of the hook to check for. If 442 * omitted, will check for any hook being executed. 443 * 444 * @return {boolean} Whether the hook is being executed. 445 */ 446 447/** 448 * Returns a function which, when invoked, will return whether a hook is 449 * currently being executed. 450 * 451 * @param {import('.').Hooks} hooks Hooks instance. 452 * @param {import('.').StoreKey} storeKey 453 * 454 * @return {DoingHook} Function that returns whether a hook is currently 455 * being executed. 456 */ 457function createDoingHook(hooks, storeKey) { 458 return function doingHook(hookName) { 459 const hooksStore = hooks[storeKey]; // If the hookName was not passed, check for any current hook. 460 461 if ('undefined' === typeof hookName) { 462 return 'undefined' !== typeof hooksStore.__current[0]; 463 } // Return the __current hook. 464 465 466 return hooksStore.__current[0] ? hookName === hooksStore.__current[0].name : false; 467 }; 468} 469 470/* harmony default export */ var build_module_createDoingHook = (createDoingHook); 471 472;// CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createDidHook.js 473/** 474 * Internal dependencies 475 */ 476 477/** 478 * @callback DidHook 479 * 480 * Returns the number of times an action has been fired. 481 * 482 * @param {string} hookName The hook name to check. 483 * 484 * @return {number | undefined} The number of times the hook has run. 485 */ 486 487/** 488 * Returns a function which, when invoked, will return the number of times a 489 * hook has been called. 490 * 491 * @param {import('.').Hooks} hooks Hooks instance. 492 * @param {import('.').StoreKey} storeKey 493 * 494 * @return {DidHook} Function that returns a hook's call count. 495 */ 496 497function createDidHook(hooks, storeKey) { 498 return function didHook(hookName) { 499 const hooksStore = hooks[storeKey]; 500 501 if (!build_module_validateHookName(hookName)) { 502 return; 503 } 504 505 return hooksStore[hookName] && hooksStore[hookName].runs ? hooksStore[hookName].runs : 0; 506 }; 507} 508 509/* harmony default export */ var build_module_createDidHook = (createDidHook); 510 511;// CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/createHooks.js 512/** 513 * Internal dependencies 514 */ 515 516 517 518 519 520 521 522/**
523 * Internal class for constructing hooks. Use `createHooks()` function 524 * 525 * Note, it is necessary to expose this class to make its type public. 526 * 527 * @private 528 */ 529 530class _Hooks { 531 constructor() { 532 /** @type {import('.').Store} actions */ 533 this.actions = Object.create(null); 534 this.actions.__current = []; 535 /** @type {import('.').Store} filters */ 536 537 this.filters = Object.create(null); 538 this.filters.__current = []; 539 this.addAction = build_module_createAddHook(this, 'actions'); 540 this.addFilter = build_module_createAddHook(this, 'filters'); 541 this.removeAction = build_module_createRemoveHook(this, 'actions'); 542 this.removeFilter = build_module_createRemoveHook(this, 'filters'); 543 this.hasAction = build_module_createHasHook(this, 'actions'); 544 this.hasFilter = build_module_createHasHook(this, 'filters'); 545 this.removeAllActions = build_module_createRemoveHook(this, 'actions', true); 546 this.removeAllFilters = build_module_createRemoveHook(this, 'filters', true); 547 this.doAction = build_module_createRunHook(this, 'actions'); 548 this.applyFilters = build_module_createRunHook(this, 'filters', true); 549 this.currentAction = build_module_createCurrentHook(this, 'actions'); 550 this.currentFilter = build_module_createCurrentHook(this, 'filters'); 551 this.doingAction = build_module_createDoingHook(this, 'actions'); 552 this.doingFilter = build_module_createDoingHook(this, 'filters'); 553 this.didAction = build_module_createDidHook(this, 'actions'); 554 this.didFilter = build_module_createDidHook(this, 'filters'); 555 } 556 557} 558/** @typedef {_Hooks} Hooks */ 559 560/** 561 * Returns an instance of the hooks object. 562 * 563 * @return {Hooks} A Hooks instance. 564 */ 565 566function createHooks() { 567 return new _Hooks(); 568} 569 570/* harmony default export */ var build_module_createHooks = (createHooks); 571 572;// CONCATENATED MODULE: ./node_modules/@wordpress/hooks/build-module/index.js 573/** 574 * Internal dependencies 575 */ 576 577/** @typedef {(...args: any[])=>any} Callback */ 578 579/** 580 * @typedef Handler 581 * @property {Callback} callback The callback 582 * @property {string} namespace The namespace 583 * @property {number} priority The namespace 584 */ 585 586/** 587 * @typedef Hook 588 * @property {Handler[]} handlers Array of handlers 589 * @property {number} runs Run counter 590 */ 591 592/** 593 * @typedef Current 594 * @property {string} name Hook name 595 * @property {number} currentIndex The index 596 */ 597 598/** 599 * @typedef {Record<string, Hook> & {__current: Current[]}} Store 600 */ 601 602/** 603 * @typedef {'actions' | 'filters'} StoreKey 604 */ 605 606/** 607 * @typedef {import('./createHooks').Hooks} Hooks 608 */ 609 610const defaultHooks = build_module_createHooks(); 611const { 612 addAction, 613 addFilter, 614 removeAction, 615 removeFilter, 616 hasAction, 617 hasFilter, 618 removeAllActions, 619 removeAllFilters, 620 doAction, 621 applyFilters, 622 currentAction, 623 currentFilter, 624 doingAction, 625 doingFilter, 626 didAction, 627 didFilter, 628 actions, 629 filters 630} = defaultHooks; 631 632 633(window.wp = window.wp || {}).hooks = __webpack_exports__; 634/******/ })() 635;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.