| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 (function() { 2 "use strict"; 3 var wp; 4 (wp ||= {}).priorityQueue = (() => { 5 var __create = Object.create; 6 var __defProp = Object.defineProperty; 7 var __getOwnPropDesc = Object.getOwnPropertyDescriptor; 8 var __getOwnPropNames = Object.getOwnPropertyNames; 9 var __getProtoOf = Object.getPrototypeOf; 10 var __hasOwnProp = Object.prototype.hasOwnProperty; 11 var __commonJS = (cb, mod) => function __require() { 12 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; 13 }; 14 var __export = (target, all) => { 15 for (var name in all) 16 __defProp(target, name, { get: all[name], enumerable: true }); 17 }; 18 var __copyProps = (to, from, except, desc) => { 19 if (from && typeof from === "object" || typeof from === "function") { 20 for (let key of __getOwnPropNames(from)) 21 if (!__hasOwnProp.call(to, key) && key !== except) 22 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); 23 } 24 return to; 25 }; 26 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( 27 // If the importer is in node compatibility mode or this is not an ESM 28 // file that has been converted to a CommonJS file using a Babel- 29 // compatible transform (i.e. "__esModule" has not been set), then set 30 // "default" to the CommonJS "module.exports" for node compatibility. 31 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, 32 mod 33 )); 34 var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); 35 36 // node_modules/requestidlecallback/index.js 37 var require_requestidlecallback = __commonJS({ 38 "node_modules/requestidlecallback/index.js"(exports, module) { 39 (function(factory) { 40 if (typeof define === "function" && define.amd) { 41 define([], factory); 42 } else if (typeof module === "object" && module.exports) { 43 module.exports = factory(); 44 } else { 45 window.idleCallbackShim = factory(); 46 } 47 })(function() { 48 "use strict"; 49 var scheduleStart, throttleDelay, lazytimer, lazyraf; 50 var root = typeof window != "undefined" ? window : typeof global != void 0 ? global : this || {}; 51 var requestAnimationFrame = root.cancelRequestAnimationFrame && root.requestAnimationFrame || setTimeout; 52 var cancelRequestAnimationFrame = root.cancelRequestAnimationFrame || clearTimeout; 53 var tasks = []; 54 var runAttempts = 0; 55 var isRunning = false; 56 var remainingTime = 7; 57 var minThrottle = 35; 58 var throttle = 125; 59 var index = 0; 60 var taskStart = 0; 61 var tasklength = 0; 62 var IdleDeadline = { 63 get didTimeout() { 64 return false; 65 }, 66 timeRemaining: function() { 67 var timeRemaining = remainingTime - (Date.now() - taskStart); 68 return timeRemaining < 0 ? 0 : timeRemaining; 69 } 70 }; 71 var setInactive = debounce(function() { 72 remainingTime = 22; 73 throttle = 66; 74 minThrottle = 0; 75 }); 76 function debounce(fn) { 77 var id, timestamp; 78 var wait = 99; 79 var check = function() { 80 var last = Date.now() - timestamp; 81 if (last < wait) { 82 id = setTimeout(check, wait - last); 83 } else { 84 id = null; 85 fn(); 86 } 87 }; 88 return function() { 89 timestamp = Date.now(); 90 if (!id) { 91 id = setTimeout(check, wait); 92 } 93 }; 94 } 95 function abortRunning() { 96 if (isRunning) { 97 if (lazyraf) { 98 cancelRequestAnimationFrame(lazyraf); 99 } 100 if (lazytimer) { 101 clearTimeout(lazytimer); 102 } 103 isRunning = false; 104 } 105 } 106 function onInputorMutation() { 107 if (throttle != 125) { 108 remainingTime = 7; 109 throttle = 125; 110 minThrottle = 35; 111 if (isRunning) { 112 abortRunning(); 113 scheduleLazy(); 114 } 115 } 116 setInactive(); 117 } 118 function scheduleAfterRaf() { 119 lazyraf = null; 120 lazytimer = setTimeout(runTasks, 0); 121 } 122 function scheduleRaf() { 123 lazytimer = null; 124 requestAnimationFrame(scheduleAfterRaf); 125 } 126 function scheduleLazy() { 127 if (isRunning) { 128 return; 129 } 130 throttleDelay = throttle - (Date.now() - taskStart); 131 scheduleStart = Date.now(); 132 isRunning = true; 133 if (minThrottle && throttleDelay < minThrottle) { 134 throttleDelay = minThrottle; 135 } 136 if (throttleDelay > 9) { 137 lazytimer = setTimeout(scheduleRaf, throttleDelay); 138 } else { 139 throttleDelay = 0; 140 scheduleRaf(); 141 } 142 } 143 function runTasks() { 144 var task, i, len; 145 var timeThreshold = remainingTime > 9 ? 9 : 1; 146 taskStart = Date.now(); 147 isRunning = false; 148 lazytimer = null; 149 if (runAttempts > 2 || taskStart - throttleDelay - 50 < scheduleStart) { 150 for (i = 0, len = tasks.length; i < len && IdleDeadline.timeRemaining() > timeThreshold; i++) { 151 task = tasks.shift(); 152 tasklength++; 153 if (task) { 154 task(IdleDeadline); 155 } 156 } 157 } 158 if (tasks.length) { 159 scheduleLazy(); 160 } else { 161 runAttempts = 0; 162 } 163 } 164 function requestIdleCallbackShim(task) { 165 index++; 166 tasks.push(task); 167 scheduleLazy(); 168 return index; 169 } 170 function cancelIdleCallbackShim(id) { 171 var index2 = id - 1 - tasklength; 172 if (tasks[index2]) { 173 tasks[index2] = null; 174 } 175 } 176 if (!root.requestIdleCallback || !root.cancelIdleCallback) { 177 root.requestIdleCallback = requestIdleCallbackShim; 178 root.cancelIdleCallback = cancelIdleCallbackShim; 179 if (root.document && document.addEventListener) { 180 root.addEventListener("scroll", onInputorMutation, true); 181 root.addEventListener("resize", onInputorMutation); 182 document.addEventListener("focus", onInputorMutation, true); 183 document.addEventListener("mouseover", onInputorMutation, true); 184 ["click", "keypress", "touchstart", "mousedown"].forEach(function(name) { 185 document.addEventListener(name, onInputorMutation, { capture: true, passive: true }); 186 }); 187 if (root.MutationObserver) { 188 new MutationObserver(onInputorMutation).observe(document.documentElement, { childList: true, subtree: true, attributes: true }); 189 } 190 } 191 } else { 192 try { 193 root.requestIdleCallback(function() { 194 }, { timeout: 0 }); 195 } catch (e) { 196 (function(rIC) { 197 var timeRemainingProto, timeRemaining; 198 root.requestIdleCallback = function(fn, timeout) { 199 if (timeout && typeof timeout.timeout == "number") { 200 return rIC(fn, timeout.timeout); 201 } 202 return rIC(fn); 203 }; 204 if (root.IdleCallbackDeadline && (timeRemainingProto = IdleCallbackDeadline.prototype)) { 205 timeRemaining = Object.getOwnPropertyDescriptor(timeRemainingProto, "timeRemaining"); 206 if (!timeRemaining || !timeRemaining.configurable || !timeRemaining.get) { 207 return; 208 } 209 Object.defineProperty(timeRemainingProto, "timeRemaining", { 210 value: function() { 211 return timeRemaining.get.call(this); 212 }, 213 enumerable: true, 214 configurable: true 215 }); 216 } 217 })(root.requestIdleCallback); 218 } 219 } 220 return { 221 request: requestIdleCallbackShim, 222 cancel: cancelIdleCallbackShim 223 }; 224 }); 225 } 226 }); 227 228 // packages/priority-queue/build-module/index.mjs 229 var index_exports = {}; 230 __export(index_exports, { 231 createQueue: () => createQueue 232 }); 233 234 // packages/priority-queue/build-module/request-idle-callback.mjs 235 var import_requestidlecallback = __toESM(require_requestidlecallback(), 1); 236 function createRequestIdleCallback() { 237 if (typeof window === "undefined") { 238 return (callback) => { 239 setTimeout(() => callback(Date.now()), 0); 240 }; 241 } 242 return window.requestIdleCallback; 243 } 244 var request_idle_callback_default = createRequestIdleCallback(); 245 246 // packages/priority-queue/build-module/index.mjs 247 var createQueue = () => { 248 const waitingList = /* @__PURE__ */ new Map(); 249 let isRunning = false; 250 const runWaitingList = (deadline) => { 251 for (const [nextElement, callback] of waitingList) { 252 waitingList.delete(nextElement); 253 callback(); 254 if ("number" === typeof deadline || deadline.timeRemaining() <= 0) { 255 break; 256 } 257 } 258 if (waitingList.size === 0) { 259 isRunning = false; 260 return; 261 } 262 request_idle_callback_default(runWaitingList); 263 }; 264 const add = (element, item) => { 265 waitingList.set(element, item); 266 if (!isRunning) { 267 isRunning = true; 268 request_idle_callback_default(runWaitingList); 269 } 270 }; 271 const flush = (element) => { 272 const callback = waitingList.get(element); 273 if (void 0 === callback) { 274 return false; 275 } 276 waitingList.delete(element); 277 callback(); 278 return true; 279 }; 280 const cancel = (element) => { 281 return waitingList.delete(element); 282 }; 283 const reset = () => { 284 waitingList.clear(); 285 isRunning = false; 286 }; 287 return { 288 add, 289 flush, 290 cancel, 291 reset 292 }; 293 }; 294 return __toCommonJS(index_exports); 295 })(); 296 (window.wp ||= {}).priorityQueue = wp.priorityQueue; 297 })();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Sun Aug 9 08:20:21 2026 | Cross-referenced by PHPXref |