Initial boiler plate project
This commit is contained in:
21
node_modules/next/dist/compiled/scheduler/LICENSE
generated
vendored
Normal file
21
node_modules/next/dist/compiled/scheduler/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
711
node_modules/next/dist/compiled/scheduler/cjs/scheduler-unstable_mock.development.js
generated
vendored
Normal file
711
node_modules/next/dist/compiled/scheduler/cjs/scheduler-unstable_mock.development.js
generated
vendored
Normal file
@ -0,0 +1,711 @@
|
||||
/**
|
||||
* @license React
|
||||
* scheduler-unstable_mock.development.js
|
||||
*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
var enableSchedulerDebugging = false;
|
||||
var enableProfiling = false;
|
||||
|
||||
function push(heap, node) {
|
||||
var index = heap.length;
|
||||
heap.push(node);
|
||||
siftUp(heap, node, index);
|
||||
}
|
||||
function peek(heap) {
|
||||
return heap.length === 0 ? null : heap[0];
|
||||
}
|
||||
function pop(heap) {
|
||||
if (heap.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var first = heap[0];
|
||||
var last = heap.pop();
|
||||
|
||||
if (last !== first) {
|
||||
heap[0] = last;
|
||||
siftDown(heap, last, 0);
|
||||
}
|
||||
|
||||
return first;
|
||||
}
|
||||
|
||||
function siftUp(heap, node, i) {
|
||||
var index = i;
|
||||
|
||||
while (index > 0) {
|
||||
var parentIndex = index - 1 >>> 1;
|
||||
var parent = heap[parentIndex];
|
||||
|
||||
if (compare(parent, node) > 0) {
|
||||
// The parent is larger. Swap positions.
|
||||
heap[parentIndex] = node;
|
||||
heap[index] = parent;
|
||||
index = parentIndex;
|
||||
} else {
|
||||
// The parent is smaller. Exit.
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function siftDown(heap, node, i) {
|
||||
var index = i;
|
||||
var length = heap.length;
|
||||
var halfLength = length >>> 1;
|
||||
|
||||
while (index < halfLength) {
|
||||
var leftIndex = (index + 1) * 2 - 1;
|
||||
var left = heap[leftIndex];
|
||||
var rightIndex = leftIndex + 1;
|
||||
var right = heap[rightIndex]; // If the left or right node is smaller, swap with the smaller of those.
|
||||
|
||||
if (compare(left, node) < 0) {
|
||||
if (rightIndex < length && compare(right, left) < 0) {
|
||||
heap[index] = right;
|
||||
heap[rightIndex] = node;
|
||||
index = rightIndex;
|
||||
} else {
|
||||
heap[index] = left;
|
||||
heap[leftIndex] = node;
|
||||
index = leftIndex;
|
||||
}
|
||||
} else if (rightIndex < length && compare(right, node) < 0) {
|
||||
heap[index] = right;
|
||||
heap[rightIndex] = node;
|
||||
index = rightIndex;
|
||||
} else {
|
||||
// Neither child is smaller. Exit.
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function compare(a, b) {
|
||||
// Compare sort index first, then task id.
|
||||
var diff = a.sortIndex - b.sortIndex;
|
||||
return diff !== 0 ? diff : a.id - b.id;
|
||||
}
|
||||
|
||||
// TODO: Use symbols?
|
||||
var ImmediatePriority = 1;
|
||||
var UserBlockingPriority = 2;
|
||||
var NormalPriority = 3;
|
||||
var LowPriority = 4;
|
||||
var IdlePriority = 5;
|
||||
|
||||
function markTaskErrored(task, ms) {
|
||||
}
|
||||
|
||||
/* eslint-disable no-var */
|
||||
// Math.pow(2, 30) - 1
|
||||
// 0b111111111111111111111111111111
|
||||
|
||||
var maxSigned31BitInt = 1073741823; // Times out immediately
|
||||
|
||||
var IMMEDIATE_PRIORITY_TIMEOUT = -1; // Eventually times out
|
||||
|
||||
var USER_BLOCKING_PRIORITY_TIMEOUT = 250;
|
||||
var NORMAL_PRIORITY_TIMEOUT = 5000;
|
||||
var LOW_PRIORITY_TIMEOUT = 10000; // Never times out
|
||||
|
||||
var IDLE_PRIORITY_TIMEOUT = maxSigned31BitInt; // Tasks are stored on a min heap
|
||||
|
||||
var taskQueue = [];
|
||||
var timerQueue = []; // Incrementing id counter. Used to maintain insertion order.
|
||||
|
||||
var taskIdCounter = 1; // Pausing the scheduler is useful for debugging.
|
||||
var currentTask = null;
|
||||
var currentPriorityLevel = NormalPriority; // This is set while performing work, to prevent re-entrance.
|
||||
|
||||
var isPerformingWork = false;
|
||||
var isHostCallbackScheduled = false;
|
||||
var isHostTimeoutScheduled = false;
|
||||
var currentMockTime = 0;
|
||||
var scheduledCallback = null;
|
||||
var scheduledTimeout = null;
|
||||
var timeoutTime = -1;
|
||||
var yieldedValues = null;
|
||||
var expectedNumberOfYields = -1;
|
||||
var didStop = false;
|
||||
var isFlushing = false;
|
||||
var needsPaint = false;
|
||||
var shouldYieldForPaint = false;
|
||||
var disableYieldValue = false;
|
||||
|
||||
function setDisableYieldValue(newValue) {
|
||||
disableYieldValue = newValue;
|
||||
}
|
||||
|
||||
function advanceTimers(currentTime) {
|
||||
// Check for tasks that are no longer delayed and add them to the queue.
|
||||
var timer = peek(timerQueue);
|
||||
|
||||
while (timer !== null) {
|
||||
if (timer.callback === null) {
|
||||
// Timer was cancelled.
|
||||
pop(timerQueue);
|
||||
} else if (timer.startTime <= currentTime) {
|
||||
// Timer fired. Transfer to the task queue.
|
||||
pop(timerQueue);
|
||||
timer.sortIndex = timer.expirationTime;
|
||||
push(taskQueue, timer);
|
||||
} else {
|
||||
// Remaining timers are pending.
|
||||
return;
|
||||
}
|
||||
|
||||
timer = peek(timerQueue);
|
||||
}
|
||||
}
|
||||
|
||||
function handleTimeout(currentTime) {
|
||||
isHostTimeoutScheduled = false;
|
||||
advanceTimers(currentTime);
|
||||
|
||||
if (!isHostCallbackScheduled) {
|
||||
if (peek(taskQueue) !== null) {
|
||||
isHostCallbackScheduled = true;
|
||||
requestHostCallback(flushWork);
|
||||
} else {
|
||||
var firstTimer = peek(timerQueue);
|
||||
|
||||
if (firstTimer !== null) {
|
||||
requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function flushWork(hasTimeRemaining, initialTime) {
|
||||
|
||||
|
||||
isHostCallbackScheduled = false;
|
||||
|
||||
if (isHostTimeoutScheduled) {
|
||||
// We scheduled a timeout but it's no longer needed. Cancel it.
|
||||
isHostTimeoutScheduled = false;
|
||||
cancelHostTimeout();
|
||||
}
|
||||
|
||||
isPerformingWork = true;
|
||||
var previousPriorityLevel = currentPriorityLevel;
|
||||
|
||||
try {
|
||||
var currentTime; if (enableProfiling) ; else {
|
||||
// No catch in prod code path.
|
||||
return workLoop(hasTimeRemaining, initialTime);
|
||||
}
|
||||
} finally {
|
||||
currentTask = null;
|
||||
currentPriorityLevel = previousPriorityLevel;
|
||||
isPerformingWork = false;
|
||||
}
|
||||
}
|
||||
|
||||
function workLoop(hasTimeRemaining, initialTime) {
|
||||
var currentTime = initialTime;
|
||||
advanceTimers(currentTime);
|
||||
currentTask = peek(taskQueue);
|
||||
|
||||
while (currentTask !== null && !(enableSchedulerDebugging )) {
|
||||
if (currentTask.expirationTime > currentTime && (!hasTimeRemaining || shouldYieldToHost())) {
|
||||
// This currentTask hasn't expired, and we've reached the deadline.
|
||||
break;
|
||||
} // $FlowFixMe[incompatible-use] found when upgrading Flow
|
||||
|
||||
|
||||
var callback = currentTask.callback;
|
||||
|
||||
if (typeof callback === 'function') {
|
||||
// $FlowFixMe[incompatible-use] found when upgrading Flow
|
||||
currentTask.callback = null; // $FlowFixMe[incompatible-use] found when upgrading Flow
|
||||
|
||||
currentPriorityLevel = currentTask.priorityLevel; // $FlowFixMe[incompatible-use] found when upgrading Flow
|
||||
|
||||
var didUserCallbackTimeout = currentTask.expirationTime <= currentTime;
|
||||
|
||||
var continuationCallback = callback(didUserCallbackTimeout);
|
||||
currentTime = getCurrentTime();
|
||||
|
||||
if (typeof continuationCallback === 'function') {
|
||||
// If a continuation is returned, immediately yield to the main thread
|
||||
// regardless of how much time is left in the current time slice.
|
||||
// $FlowFixMe[incompatible-use] found when upgrading Flow
|
||||
currentTask.callback = continuationCallback;
|
||||
|
||||
advanceTimers(currentTime);
|
||||
|
||||
if (shouldYieldForPaint) {
|
||||
needsPaint = true;
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
|
||||
if (currentTask === peek(taskQueue)) {
|
||||
pop(taskQueue);
|
||||
}
|
||||
|
||||
advanceTimers(currentTime);
|
||||
}
|
||||
} else {
|
||||
pop(taskQueue);
|
||||
}
|
||||
|
||||
currentTask = peek(taskQueue);
|
||||
} // Return whether there's additional work
|
||||
|
||||
|
||||
if (currentTask !== null) {
|
||||
return true;
|
||||
} else {
|
||||
var firstTimer = peek(timerQueue);
|
||||
|
||||
if (firstTimer !== null) {
|
||||
requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function unstable_runWithPriority(priorityLevel, eventHandler) {
|
||||
switch (priorityLevel) {
|
||||
case ImmediatePriority:
|
||||
case UserBlockingPriority:
|
||||
case NormalPriority:
|
||||
case LowPriority:
|
||||
case IdlePriority:
|
||||
break;
|
||||
|
||||
default:
|
||||
priorityLevel = NormalPriority;
|
||||
}
|
||||
|
||||
var previousPriorityLevel = currentPriorityLevel;
|
||||
currentPriorityLevel = priorityLevel;
|
||||
|
||||
try {
|
||||
return eventHandler();
|
||||
} finally {
|
||||
currentPriorityLevel = previousPriorityLevel;
|
||||
}
|
||||
}
|
||||
|
||||
function unstable_next(eventHandler) {
|
||||
var priorityLevel;
|
||||
|
||||
switch (currentPriorityLevel) {
|
||||
case ImmediatePriority:
|
||||
case UserBlockingPriority:
|
||||
case NormalPriority:
|
||||
// Shift down to normal priority
|
||||
priorityLevel = NormalPriority;
|
||||
break;
|
||||
|
||||
default:
|
||||
// Anything lower than normal priority should remain at the current level.
|
||||
priorityLevel = currentPriorityLevel;
|
||||
break;
|
||||
}
|
||||
|
||||
var previousPriorityLevel = currentPriorityLevel;
|
||||
currentPriorityLevel = priorityLevel;
|
||||
|
||||
try {
|
||||
return eventHandler();
|
||||
} finally {
|
||||
currentPriorityLevel = previousPriorityLevel;
|
||||
}
|
||||
}
|
||||
|
||||
function unstable_wrapCallback(callback) {
|
||||
var parentPriorityLevel = currentPriorityLevel; // $FlowFixMe[incompatible-return]
|
||||
// $FlowFixMe[missing-this-annot]
|
||||
|
||||
return function () {
|
||||
// This is a fork of runWithPriority, inlined for performance.
|
||||
var previousPriorityLevel = currentPriorityLevel;
|
||||
currentPriorityLevel = parentPriorityLevel;
|
||||
|
||||
try {
|
||||
return callback.apply(this, arguments);
|
||||
} finally {
|
||||
currentPriorityLevel = previousPriorityLevel;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function unstable_scheduleCallback(priorityLevel, callback, options) {
|
||||
var currentTime = getCurrentTime();
|
||||
var startTime;
|
||||
|
||||
if (typeof options === 'object' && options !== null) {
|
||||
var delay = options.delay;
|
||||
|
||||
if (typeof delay === 'number' && delay > 0) {
|
||||
startTime = currentTime + delay;
|
||||
} else {
|
||||
startTime = currentTime;
|
||||
}
|
||||
} else {
|
||||
startTime = currentTime;
|
||||
}
|
||||
|
||||
var timeout;
|
||||
|
||||
switch (priorityLevel) {
|
||||
case ImmediatePriority:
|
||||
timeout = IMMEDIATE_PRIORITY_TIMEOUT;
|
||||
break;
|
||||
|
||||
case UserBlockingPriority:
|
||||
timeout = USER_BLOCKING_PRIORITY_TIMEOUT;
|
||||
break;
|
||||
|
||||
case IdlePriority:
|
||||
timeout = IDLE_PRIORITY_TIMEOUT;
|
||||
break;
|
||||
|
||||
case LowPriority:
|
||||
timeout = LOW_PRIORITY_TIMEOUT;
|
||||
break;
|
||||
|
||||
case NormalPriority:
|
||||
default:
|
||||
timeout = NORMAL_PRIORITY_TIMEOUT;
|
||||
break;
|
||||
}
|
||||
|
||||
var expirationTime = startTime + timeout;
|
||||
var newTask = {
|
||||
id: taskIdCounter++,
|
||||
callback: callback,
|
||||
priorityLevel: priorityLevel,
|
||||
startTime: startTime,
|
||||
expirationTime: expirationTime,
|
||||
sortIndex: -1
|
||||
};
|
||||
|
||||
if (startTime > currentTime) {
|
||||
// This is a delayed task.
|
||||
newTask.sortIndex = startTime;
|
||||
push(timerQueue, newTask);
|
||||
|
||||
if (peek(taskQueue) === null && newTask === peek(timerQueue)) {
|
||||
// All tasks are delayed, and this is the task with the earliest delay.
|
||||
if (isHostTimeoutScheduled) {
|
||||
// Cancel an existing timeout.
|
||||
cancelHostTimeout();
|
||||
} else {
|
||||
isHostTimeoutScheduled = true;
|
||||
} // Schedule a timeout.
|
||||
|
||||
|
||||
requestHostTimeout(handleTimeout, startTime - currentTime);
|
||||
}
|
||||
} else {
|
||||
newTask.sortIndex = expirationTime;
|
||||
push(taskQueue, newTask);
|
||||
// wait until the next time we yield.
|
||||
|
||||
|
||||
if (!isHostCallbackScheduled && !isPerformingWork) {
|
||||
isHostCallbackScheduled = true;
|
||||
requestHostCallback(flushWork);
|
||||
}
|
||||
}
|
||||
|
||||
return newTask;
|
||||
}
|
||||
|
||||
function unstable_pauseExecution() {
|
||||
}
|
||||
|
||||
function unstable_continueExecution() {
|
||||
|
||||
if (!isHostCallbackScheduled && !isPerformingWork) {
|
||||
isHostCallbackScheduled = true;
|
||||
requestHostCallback(flushWork);
|
||||
}
|
||||
}
|
||||
|
||||
function unstable_getFirstCallbackNode() {
|
||||
return peek(taskQueue);
|
||||
}
|
||||
|
||||
function unstable_cancelCallback(task) {
|
||||
// remove from the queue because you can't remove arbitrary nodes from an
|
||||
// array based heap, only the first one.)
|
||||
|
||||
|
||||
task.callback = null;
|
||||
}
|
||||
|
||||
function unstable_getCurrentPriorityLevel() {
|
||||
return currentPriorityLevel;
|
||||
}
|
||||
|
||||
function requestHostCallback(callback) {
|
||||
scheduledCallback = callback;
|
||||
}
|
||||
|
||||
function requestHostTimeout(callback, ms) {
|
||||
scheduledTimeout = callback;
|
||||
timeoutTime = currentMockTime + ms;
|
||||
}
|
||||
|
||||
function cancelHostTimeout() {
|
||||
scheduledTimeout = null;
|
||||
timeoutTime = -1;
|
||||
}
|
||||
|
||||
function shouldYieldToHost() {
|
||||
if (expectedNumberOfYields === 0 && yieldedValues === null || expectedNumberOfYields !== -1 && yieldedValues !== null && yieldedValues.length >= expectedNumberOfYields || shouldYieldForPaint && needsPaint) {
|
||||
// We yielded at least as many values as expected. Stop flushing.
|
||||
didStop = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function getCurrentTime() {
|
||||
return currentMockTime;
|
||||
}
|
||||
|
||||
function forceFrameRate() {// No-op
|
||||
}
|
||||
|
||||
function reset() {
|
||||
if (isFlushing) {
|
||||
throw new Error('Cannot reset while already flushing work.');
|
||||
}
|
||||
|
||||
currentMockTime = 0;
|
||||
scheduledCallback = null;
|
||||
scheduledTimeout = null;
|
||||
timeoutTime = -1;
|
||||
yieldedValues = null;
|
||||
expectedNumberOfYields = -1;
|
||||
didStop = false;
|
||||
isFlushing = false;
|
||||
needsPaint = false;
|
||||
} // Should only be used via an assertion helper that inspects the yielded values.
|
||||
|
||||
|
||||
function unstable_flushNumberOfYields(count) {
|
||||
if (isFlushing) {
|
||||
throw new Error('Already flushing work.');
|
||||
}
|
||||
|
||||
if (scheduledCallback !== null) {
|
||||
var cb = scheduledCallback;
|
||||
expectedNumberOfYields = count;
|
||||
isFlushing = true;
|
||||
|
||||
try {
|
||||
var hasMoreWork = true;
|
||||
|
||||
do {
|
||||
hasMoreWork = cb(true, currentMockTime);
|
||||
} while (hasMoreWork && !didStop);
|
||||
|
||||
if (!hasMoreWork) {
|
||||
scheduledCallback = null;
|
||||
}
|
||||
} finally {
|
||||
expectedNumberOfYields = -1;
|
||||
didStop = false;
|
||||
isFlushing = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function unstable_flushUntilNextPaint() {
|
||||
if (isFlushing) {
|
||||
throw new Error('Already flushing work.');
|
||||
}
|
||||
|
||||
if (scheduledCallback !== null) {
|
||||
var cb = scheduledCallback;
|
||||
shouldYieldForPaint = true;
|
||||
needsPaint = false;
|
||||
isFlushing = true;
|
||||
|
||||
try {
|
||||
var hasMoreWork = true;
|
||||
|
||||
do {
|
||||
hasMoreWork = cb(true, currentMockTime);
|
||||
} while (hasMoreWork && !didStop);
|
||||
|
||||
if (!hasMoreWork) {
|
||||
scheduledCallback = null;
|
||||
}
|
||||
} finally {
|
||||
shouldYieldForPaint = false;
|
||||
didStop = false;
|
||||
isFlushing = false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function unstable_hasPendingWork() {
|
||||
return scheduledCallback !== null;
|
||||
}
|
||||
|
||||
function unstable_flushExpired() {
|
||||
if (isFlushing) {
|
||||
throw new Error('Already flushing work.');
|
||||
}
|
||||
|
||||
if (scheduledCallback !== null) {
|
||||
isFlushing = true;
|
||||
|
||||
try {
|
||||
var hasMoreWork = scheduledCallback(false, currentMockTime);
|
||||
|
||||
if (!hasMoreWork) {
|
||||
scheduledCallback = null;
|
||||
}
|
||||
} finally {
|
||||
isFlushing = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function unstable_flushAllWithoutAsserting() {
|
||||
// Returns false if no work was flushed.
|
||||
if (isFlushing) {
|
||||
throw new Error('Already flushing work.');
|
||||
}
|
||||
|
||||
if (scheduledCallback !== null) {
|
||||
var cb = scheduledCallback;
|
||||
isFlushing = true;
|
||||
|
||||
try {
|
||||
var hasMoreWork = true;
|
||||
|
||||
do {
|
||||
hasMoreWork = cb(true, currentMockTime);
|
||||
} while (hasMoreWork);
|
||||
|
||||
if (!hasMoreWork) {
|
||||
scheduledCallback = null;
|
||||
}
|
||||
|
||||
return true;
|
||||
} finally {
|
||||
isFlushing = false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function unstable_clearLog() {
|
||||
if (yieldedValues === null) {
|
||||
return [];
|
||||
}
|
||||
|
||||
var values = yieldedValues;
|
||||
yieldedValues = null;
|
||||
return values;
|
||||
}
|
||||
|
||||
function unstable_flushAll() {
|
||||
if (yieldedValues !== null) {
|
||||
throw new Error('Log is not empty. Assert on the log of yielded values before ' + 'flushing additional work.');
|
||||
}
|
||||
|
||||
unstable_flushAllWithoutAsserting();
|
||||
|
||||
if (yieldedValues !== null) {
|
||||
throw new Error('While flushing work, something yielded a value. Use an ' + 'assertion helper to assert on the log of yielded values, e.g. ' + 'expect(Scheduler).toFlushAndYield([...])');
|
||||
}
|
||||
}
|
||||
|
||||
function log(value) {
|
||||
// eslint-disable-next-line react-internal/no-production-logging
|
||||
if (console.log.name === 'disabledLog' || disableYieldValue) {
|
||||
// If console.log has been patched, we assume we're in render
|
||||
// replaying and we ignore any values yielding in the second pass.
|
||||
return;
|
||||
}
|
||||
|
||||
if (yieldedValues === null) {
|
||||
yieldedValues = [value];
|
||||
} else {
|
||||
yieldedValues.push(value);
|
||||
}
|
||||
}
|
||||
|
||||
function unstable_advanceTime(ms) {
|
||||
// eslint-disable-next-line react-internal/no-production-logging
|
||||
if (console.log.name === 'disabledLog' || disableYieldValue) {
|
||||
// If console.log has been patched, we assume we're in render
|
||||
// replaying and we ignore any time advancing in the second pass.
|
||||
return;
|
||||
}
|
||||
|
||||
currentMockTime += ms;
|
||||
|
||||
if (scheduledTimeout !== null && timeoutTime <= currentMockTime) {
|
||||
scheduledTimeout(currentMockTime);
|
||||
timeoutTime = -1;
|
||||
scheduledTimeout = null;
|
||||
}
|
||||
}
|
||||
|
||||
function requestPaint() {
|
||||
needsPaint = true;
|
||||
}
|
||||
var unstable_Profiling = null;
|
||||
|
||||
exports.log = log;
|
||||
exports.reset = reset;
|
||||
exports.unstable_IdlePriority = IdlePriority;
|
||||
exports.unstable_ImmediatePriority = ImmediatePriority;
|
||||
exports.unstable_LowPriority = LowPriority;
|
||||
exports.unstable_NormalPriority = NormalPriority;
|
||||
exports.unstable_Profiling = unstable_Profiling;
|
||||
exports.unstable_UserBlockingPriority = UserBlockingPriority;
|
||||
exports.unstable_advanceTime = unstable_advanceTime;
|
||||
exports.unstable_cancelCallback = unstable_cancelCallback;
|
||||
exports.unstable_clearLog = unstable_clearLog;
|
||||
exports.unstable_continueExecution = unstable_continueExecution;
|
||||
exports.unstable_flushAll = unstable_flushAll;
|
||||
exports.unstable_flushAllWithoutAsserting = unstable_flushAllWithoutAsserting;
|
||||
exports.unstable_flushExpired = unstable_flushExpired;
|
||||
exports.unstable_flushNumberOfYields = unstable_flushNumberOfYields;
|
||||
exports.unstable_flushUntilNextPaint = unstable_flushUntilNextPaint;
|
||||
exports.unstable_forceFrameRate = forceFrameRate;
|
||||
exports.unstable_getCurrentPriorityLevel = unstable_getCurrentPriorityLevel;
|
||||
exports.unstable_getFirstCallbackNode = unstable_getFirstCallbackNode;
|
||||
exports.unstable_hasPendingWork = unstable_hasPendingWork;
|
||||
exports.unstable_next = unstable_next;
|
||||
exports.unstable_now = getCurrentTime;
|
||||
exports.unstable_pauseExecution = unstable_pauseExecution;
|
||||
exports.unstable_requestPaint = requestPaint;
|
||||
exports.unstable_runWithPriority = unstable_runWithPriority;
|
||||
exports.unstable_scheduleCallback = unstable_scheduleCallback;
|
||||
exports.unstable_setDisableYieldValue = setDisableYieldValue;
|
||||
exports.unstable_shouldYield = shouldYieldToHost;
|
||||
exports.unstable_wrapCallback = unstable_wrapCallback;
|
||||
})();
|
||||
}
|
||||
705
node_modules/next/dist/compiled/scheduler/cjs/scheduler-unstable_mock.production.js
generated
vendored
Normal file
705
node_modules/next/dist/compiled/scheduler/cjs/scheduler-unstable_mock.production.js
generated
vendored
Normal file
@ -0,0 +1,705 @@
|
||||
/**
|
||||
* @license React
|
||||
* scheduler-unstable_mock.production.min.js
|
||||
*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const enableSchedulerDebugging = false;
|
||||
const enableProfiling = false;
|
||||
|
||||
function push(heap, node) {
|
||||
const index = heap.length;
|
||||
heap.push(node);
|
||||
siftUp(heap, node, index);
|
||||
}
|
||||
function peek(heap) {
|
||||
return heap.length === 0 ? null : heap[0];
|
||||
}
|
||||
function pop(heap) {
|
||||
if (heap.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const first = heap[0];
|
||||
const last = heap.pop();
|
||||
|
||||
if (last !== first) {
|
||||
heap[0] = last;
|
||||
siftDown(heap, last, 0);
|
||||
}
|
||||
|
||||
return first;
|
||||
}
|
||||
|
||||
function siftUp(heap, node, i) {
|
||||
let index = i;
|
||||
|
||||
while (index > 0) {
|
||||
const parentIndex = index - 1 >>> 1;
|
||||
const parent = heap[parentIndex];
|
||||
|
||||
if (compare(parent, node) > 0) {
|
||||
// The parent is larger. Swap positions.
|
||||
heap[parentIndex] = node;
|
||||
heap[index] = parent;
|
||||
index = parentIndex;
|
||||
} else {
|
||||
// The parent is smaller. Exit.
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function siftDown(heap, node, i) {
|
||||
let index = i;
|
||||
const length = heap.length;
|
||||
const halfLength = length >>> 1;
|
||||
|
||||
while (index < halfLength) {
|
||||
const leftIndex = (index + 1) * 2 - 1;
|
||||
const left = heap[leftIndex];
|
||||
const rightIndex = leftIndex + 1;
|
||||
const right = heap[rightIndex]; // If the left or right node is smaller, swap with the smaller of those.
|
||||
|
||||
if (compare(left, node) < 0) {
|
||||
if (rightIndex < length && compare(right, left) < 0) {
|
||||
heap[index] = right;
|
||||
heap[rightIndex] = node;
|
||||
index = rightIndex;
|
||||
} else {
|
||||
heap[index] = left;
|
||||
heap[leftIndex] = node;
|
||||
index = leftIndex;
|
||||
}
|
||||
} else if (rightIndex < length && compare(right, node) < 0) {
|
||||
heap[index] = right;
|
||||
heap[rightIndex] = node;
|
||||
index = rightIndex;
|
||||
} else {
|
||||
// Neither child is smaller. Exit.
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function compare(a, b) {
|
||||
// Compare sort index first, then task id.
|
||||
const diff = a.sortIndex - b.sortIndex;
|
||||
return diff !== 0 ? diff : a.id - b.id;
|
||||
}
|
||||
|
||||
// TODO: Use symbols?
|
||||
const ImmediatePriority = 1;
|
||||
const UserBlockingPriority = 2;
|
||||
const NormalPriority = 3;
|
||||
const LowPriority = 4;
|
||||
const IdlePriority = 5;
|
||||
|
||||
function markTaskErrored(task, ms) {
|
||||
}
|
||||
|
||||
/* eslint-disable no-var */
|
||||
// Math.pow(2, 30) - 1
|
||||
// 0b111111111111111111111111111111
|
||||
|
||||
var maxSigned31BitInt = 1073741823; // Times out immediately
|
||||
|
||||
var IMMEDIATE_PRIORITY_TIMEOUT = -1; // Eventually times out
|
||||
|
||||
var USER_BLOCKING_PRIORITY_TIMEOUT = 250;
|
||||
var NORMAL_PRIORITY_TIMEOUT = 5000;
|
||||
var LOW_PRIORITY_TIMEOUT = 10000; // Never times out
|
||||
|
||||
var IDLE_PRIORITY_TIMEOUT = maxSigned31BitInt; // Tasks are stored on a min heap
|
||||
|
||||
var taskQueue = [];
|
||||
var timerQueue = []; // Incrementing id counter. Used to maintain insertion order.
|
||||
|
||||
var taskIdCounter = 1; // Pausing the scheduler is useful for debugging.
|
||||
var currentTask = null;
|
||||
var currentPriorityLevel = NormalPriority; // This is set while performing work, to prevent re-entrance.
|
||||
|
||||
var isPerformingWork = false;
|
||||
var isHostCallbackScheduled = false;
|
||||
var isHostTimeoutScheduled = false;
|
||||
let currentMockTime = 0;
|
||||
let scheduledCallback = null;
|
||||
let scheduledTimeout = null;
|
||||
let timeoutTime = -1;
|
||||
let yieldedValues = null;
|
||||
let expectedNumberOfYields = -1;
|
||||
let didStop = false;
|
||||
let isFlushing = false;
|
||||
let needsPaint = false;
|
||||
let shouldYieldForPaint = false;
|
||||
var disableYieldValue = false;
|
||||
|
||||
function setDisableYieldValue(newValue) {
|
||||
disableYieldValue = newValue;
|
||||
}
|
||||
|
||||
function advanceTimers(currentTime) {
|
||||
// Check for tasks that are no longer delayed and add them to the queue.
|
||||
let timer = peek(timerQueue);
|
||||
|
||||
while (timer !== null) {
|
||||
if (timer.callback === null) {
|
||||
// Timer was cancelled.
|
||||
pop(timerQueue);
|
||||
} else if (timer.startTime <= currentTime) {
|
||||
// Timer fired. Transfer to the task queue.
|
||||
pop(timerQueue);
|
||||
timer.sortIndex = timer.expirationTime;
|
||||
push(taskQueue, timer);
|
||||
} else {
|
||||
// Remaining timers are pending.
|
||||
return;
|
||||
}
|
||||
|
||||
timer = peek(timerQueue);
|
||||
}
|
||||
}
|
||||
|
||||
function handleTimeout(currentTime) {
|
||||
isHostTimeoutScheduled = false;
|
||||
advanceTimers(currentTime);
|
||||
|
||||
if (!isHostCallbackScheduled) {
|
||||
if (peek(taskQueue) !== null) {
|
||||
isHostCallbackScheduled = true;
|
||||
requestHostCallback(flushWork);
|
||||
} else {
|
||||
const firstTimer = peek(timerQueue);
|
||||
|
||||
if (firstTimer !== null) {
|
||||
requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function flushWork(hasTimeRemaining, initialTime) {
|
||||
|
||||
|
||||
isHostCallbackScheduled = false;
|
||||
|
||||
if (isHostTimeoutScheduled) {
|
||||
// We scheduled a timeout but it's no longer needed. Cancel it.
|
||||
isHostTimeoutScheduled = false;
|
||||
cancelHostTimeout();
|
||||
}
|
||||
|
||||
isPerformingWork = true;
|
||||
const previousPriorityLevel = currentPriorityLevel;
|
||||
|
||||
try {
|
||||
if (enableProfiling) ; else {
|
||||
// No catch in prod code path.
|
||||
return workLoop(hasTimeRemaining, initialTime);
|
||||
}
|
||||
} finally {
|
||||
currentTask = null;
|
||||
currentPriorityLevel = previousPriorityLevel;
|
||||
isPerformingWork = false;
|
||||
}
|
||||
}
|
||||
|
||||
function workLoop(hasTimeRemaining, initialTime) {
|
||||
let currentTime = initialTime;
|
||||
advanceTimers(currentTime);
|
||||
currentTask = peek(taskQueue);
|
||||
|
||||
while (currentTask !== null && !(enableSchedulerDebugging )) {
|
||||
if (currentTask.expirationTime > currentTime && (!hasTimeRemaining || shouldYieldToHost())) {
|
||||
// This currentTask hasn't expired, and we've reached the deadline.
|
||||
break;
|
||||
} // $FlowFixMe[incompatible-use] found when upgrading Flow
|
||||
|
||||
|
||||
const callback = currentTask.callback;
|
||||
|
||||
if (typeof callback === 'function') {
|
||||
// $FlowFixMe[incompatible-use] found when upgrading Flow
|
||||
currentTask.callback = null; // $FlowFixMe[incompatible-use] found when upgrading Flow
|
||||
|
||||
currentPriorityLevel = currentTask.priorityLevel; // $FlowFixMe[incompatible-use] found when upgrading Flow
|
||||
|
||||
const didUserCallbackTimeout = currentTask.expirationTime <= currentTime;
|
||||
|
||||
const continuationCallback = callback(didUserCallbackTimeout);
|
||||
currentTime = getCurrentTime();
|
||||
|
||||
if (typeof continuationCallback === 'function') {
|
||||
// If a continuation is returned, immediately yield to the main thread
|
||||
// regardless of how much time is left in the current time slice.
|
||||
// $FlowFixMe[incompatible-use] found when upgrading Flow
|
||||
currentTask.callback = continuationCallback;
|
||||
|
||||
advanceTimers(currentTime);
|
||||
|
||||
if (shouldYieldForPaint) {
|
||||
needsPaint = true;
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
|
||||
if (currentTask === peek(taskQueue)) {
|
||||
pop(taskQueue);
|
||||
}
|
||||
|
||||
advanceTimers(currentTime);
|
||||
}
|
||||
} else {
|
||||
pop(taskQueue);
|
||||
}
|
||||
|
||||
currentTask = peek(taskQueue);
|
||||
} // Return whether there's additional work
|
||||
|
||||
|
||||
if (currentTask !== null) {
|
||||
return true;
|
||||
} else {
|
||||
const firstTimer = peek(timerQueue);
|
||||
|
||||
if (firstTimer !== null) {
|
||||
requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function unstable_runWithPriority(priorityLevel, eventHandler) {
|
||||
switch (priorityLevel) {
|
||||
case ImmediatePriority:
|
||||
case UserBlockingPriority:
|
||||
case NormalPriority:
|
||||
case LowPriority:
|
||||
case IdlePriority:
|
||||
break;
|
||||
|
||||
default:
|
||||
priorityLevel = NormalPriority;
|
||||
}
|
||||
|
||||
var previousPriorityLevel = currentPriorityLevel;
|
||||
currentPriorityLevel = priorityLevel;
|
||||
|
||||
try {
|
||||
return eventHandler();
|
||||
} finally {
|
||||
currentPriorityLevel = previousPriorityLevel;
|
||||
}
|
||||
}
|
||||
|
||||
function unstable_next(eventHandler) {
|
||||
var priorityLevel;
|
||||
|
||||
switch (currentPriorityLevel) {
|
||||
case ImmediatePriority:
|
||||
case UserBlockingPriority:
|
||||
case NormalPriority:
|
||||
// Shift down to normal priority
|
||||
priorityLevel = NormalPriority;
|
||||
break;
|
||||
|
||||
default:
|
||||
// Anything lower than normal priority should remain at the current level.
|
||||
priorityLevel = currentPriorityLevel;
|
||||
break;
|
||||
}
|
||||
|
||||
var previousPriorityLevel = currentPriorityLevel;
|
||||
currentPriorityLevel = priorityLevel;
|
||||
|
||||
try {
|
||||
return eventHandler();
|
||||
} finally {
|
||||
currentPriorityLevel = previousPriorityLevel;
|
||||
}
|
||||
}
|
||||
|
||||
function unstable_wrapCallback(callback) {
|
||||
var parentPriorityLevel = currentPriorityLevel; // $FlowFixMe[incompatible-return]
|
||||
// $FlowFixMe[missing-this-annot]
|
||||
|
||||
return function () {
|
||||
// This is a fork of runWithPriority, inlined for performance.
|
||||
var previousPriorityLevel = currentPriorityLevel;
|
||||
currentPriorityLevel = parentPriorityLevel;
|
||||
|
||||
try {
|
||||
return callback.apply(this, arguments);
|
||||
} finally {
|
||||
currentPriorityLevel = previousPriorityLevel;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function unstable_scheduleCallback(priorityLevel, callback, options) {
|
||||
var currentTime = getCurrentTime();
|
||||
var startTime;
|
||||
|
||||
if (typeof options === 'object' && options !== null) {
|
||||
var delay = options.delay;
|
||||
|
||||
if (typeof delay === 'number' && delay > 0) {
|
||||
startTime = currentTime + delay;
|
||||
} else {
|
||||
startTime = currentTime;
|
||||
}
|
||||
} else {
|
||||
startTime = currentTime;
|
||||
}
|
||||
|
||||
var timeout;
|
||||
|
||||
switch (priorityLevel) {
|
||||
case ImmediatePriority:
|
||||
timeout = IMMEDIATE_PRIORITY_TIMEOUT;
|
||||
break;
|
||||
|
||||
case UserBlockingPriority:
|
||||
timeout = USER_BLOCKING_PRIORITY_TIMEOUT;
|
||||
break;
|
||||
|
||||
case IdlePriority:
|
||||
timeout = IDLE_PRIORITY_TIMEOUT;
|
||||
break;
|
||||
|
||||
case LowPriority:
|
||||
timeout = LOW_PRIORITY_TIMEOUT;
|
||||
break;
|
||||
|
||||
case NormalPriority:
|
||||
default:
|
||||
timeout = NORMAL_PRIORITY_TIMEOUT;
|
||||
break;
|
||||
}
|
||||
|
||||
var expirationTime = startTime + timeout;
|
||||
var newTask = {
|
||||
id: taskIdCounter++,
|
||||
callback,
|
||||
priorityLevel,
|
||||
startTime,
|
||||
expirationTime,
|
||||
sortIndex: -1
|
||||
};
|
||||
|
||||
if (startTime > currentTime) {
|
||||
// This is a delayed task.
|
||||
newTask.sortIndex = startTime;
|
||||
push(timerQueue, newTask);
|
||||
|
||||
if (peek(taskQueue) === null && newTask === peek(timerQueue)) {
|
||||
// All tasks are delayed, and this is the task with the earliest delay.
|
||||
if (isHostTimeoutScheduled) {
|
||||
// Cancel an existing timeout.
|
||||
cancelHostTimeout();
|
||||
} else {
|
||||
isHostTimeoutScheduled = true;
|
||||
} // Schedule a timeout.
|
||||
|
||||
|
||||
requestHostTimeout(handleTimeout, startTime - currentTime);
|
||||
}
|
||||
} else {
|
||||
newTask.sortIndex = expirationTime;
|
||||
push(taskQueue, newTask);
|
||||
// wait until the next time we yield.
|
||||
|
||||
|
||||
if (!isHostCallbackScheduled && !isPerformingWork) {
|
||||
isHostCallbackScheduled = true;
|
||||
requestHostCallback(flushWork);
|
||||
}
|
||||
}
|
||||
|
||||
return newTask;
|
||||
}
|
||||
|
||||
function unstable_pauseExecution() {
|
||||
}
|
||||
|
||||
function unstable_continueExecution() {
|
||||
|
||||
if (!isHostCallbackScheduled && !isPerformingWork) {
|
||||
isHostCallbackScheduled = true;
|
||||
requestHostCallback(flushWork);
|
||||
}
|
||||
}
|
||||
|
||||
function unstable_getFirstCallbackNode() {
|
||||
return peek(taskQueue);
|
||||
}
|
||||
|
||||
function unstable_cancelCallback(task) {
|
||||
// remove from the queue because you can't remove arbitrary nodes from an
|
||||
// array based heap, only the first one.)
|
||||
|
||||
|
||||
task.callback = null;
|
||||
}
|
||||
|
||||
function unstable_getCurrentPriorityLevel() {
|
||||
return currentPriorityLevel;
|
||||
}
|
||||
|
||||
function requestHostCallback(callback) {
|
||||
scheduledCallback = callback;
|
||||
}
|
||||
|
||||
function requestHostTimeout(callback, ms) {
|
||||
scheduledTimeout = callback;
|
||||
timeoutTime = currentMockTime + ms;
|
||||
}
|
||||
|
||||
function cancelHostTimeout() {
|
||||
scheduledTimeout = null;
|
||||
timeoutTime = -1;
|
||||
}
|
||||
|
||||
function shouldYieldToHost() {
|
||||
if (expectedNumberOfYields === 0 && yieldedValues === null || expectedNumberOfYields !== -1 && yieldedValues !== null && yieldedValues.length >= expectedNumberOfYields || shouldYieldForPaint && needsPaint) {
|
||||
// We yielded at least as many values as expected. Stop flushing.
|
||||
didStop = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function getCurrentTime() {
|
||||
return currentMockTime;
|
||||
}
|
||||
|
||||
function forceFrameRate() {// No-op
|
||||
}
|
||||
|
||||
function reset() {
|
||||
if (isFlushing) {
|
||||
throw new Error('Cannot reset while already flushing work.');
|
||||
}
|
||||
|
||||
currentMockTime = 0;
|
||||
scheduledCallback = null;
|
||||
scheduledTimeout = null;
|
||||
timeoutTime = -1;
|
||||
yieldedValues = null;
|
||||
expectedNumberOfYields = -1;
|
||||
didStop = false;
|
||||
isFlushing = false;
|
||||
needsPaint = false;
|
||||
} // Should only be used via an assertion helper that inspects the yielded values.
|
||||
|
||||
|
||||
function unstable_flushNumberOfYields(count) {
|
||||
if (isFlushing) {
|
||||
throw new Error('Already flushing work.');
|
||||
}
|
||||
|
||||
if (scheduledCallback !== null) {
|
||||
const cb = scheduledCallback;
|
||||
expectedNumberOfYields = count;
|
||||
isFlushing = true;
|
||||
|
||||
try {
|
||||
let hasMoreWork = true;
|
||||
|
||||
do {
|
||||
hasMoreWork = cb(true, currentMockTime);
|
||||
} while (hasMoreWork && !didStop);
|
||||
|
||||
if (!hasMoreWork) {
|
||||
scheduledCallback = null;
|
||||
}
|
||||
} finally {
|
||||
expectedNumberOfYields = -1;
|
||||
didStop = false;
|
||||
isFlushing = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function unstable_flushUntilNextPaint() {
|
||||
if (isFlushing) {
|
||||
throw new Error('Already flushing work.');
|
||||
}
|
||||
|
||||
if (scheduledCallback !== null) {
|
||||
const cb = scheduledCallback;
|
||||
shouldYieldForPaint = true;
|
||||
needsPaint = false;
|
||||
isFlushing = true;
|
||||
|
||||
try {
|
||||
let hasMoreWork = true;
|
||||
|
||||
do {
|
||||
hasMoreWork = cb(true, currentMockTime);
|
||||
} while (hasMoreWork && !didStop);
|
||||
|
||||
if (!hasMoreWork) {
|
||||
scheduledCallback = null;
|
||||
}
|
||||
} finally {
|
||||
shouldYieldForPaint = false;
|
||||
didStop = false;
|
||||
isFlushing = false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function unstable_hasPendingWork() {
|
||||
return scheduledCallback !== null;
|
||||
}
|
||||
|
||||
function unstable_flushExpired() {
|
||||
if (isFlushing) {
|
||||
throw new Error('Already flushing work.');
|
||||
}
|
||||
|
||||
if (scheduledCallback !== null) {
|
||||
isFlushing = true;
|
||||
|
||||
try {
|
||||
const hasMoreWork = scheduledCallback(false, currentMockTime);
|
||||
|
||||
if (!hasMoreWork) {
|
||||
scheduledCallback = null;
|
||||
}
|
||||
} finally {
|
||||
isFlushing = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function unstable_flushAllWithoutAsserting() {
|
||||
// Returns false if no work was flushed.
|
||||
if (isFlushing) {
|
||||
throw new Error('Already flushing work.');
|
||||
}
|
||||
|
||||
if (scheduledCallback !== null) {
|
||||
const cb = scheduledCallback;
|
||||
isFlushing = true;
|
||||
|
||||
try {
|
||||
let hasMoreWork = true;
|
||||
|
||||
do {
|
||||
hasMoreWork = cb(true, currentMockTime);
|
||||
} while (hasMoreWork);
|
||||
|
||||
if (!hasMoreWork) {
|
||||
scheduledCallback = null;
|
||||
}
|
||||
|
||||
return true;
|
||||
} finally {
|
||||
isFlushing = false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function unstable_clearLog() {
|
||||
if (yieldedValues === null) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const values = yieldedValues;
|
||||
yieldedValues = null;
|
||||
return values;
|
||||
}
|
||||
|
||||
function unstable_flushAll() {
|
||||
if (yieldedValues !== null) {
|
||||
throw new Error('Log is not empty. Assert on the log of yielded values before ' + 'flushing additional work.');
|
||||
}
|
||||
|
||||
unstable_flushAllWithoutAsserting();
|
||||
|
||||
if (yieldedValues !== null) {
|
||||
throw new Error('While flushing work, something yielded a value. Use an ' + 'assertion helper to assert on the log of yielded values, e.g. ' + 'expect(Scheduler).toFlushAndYield([...])');
|
||||
}
|
||||
}
|
||||
|
||||
function log(value) {
|
||||
// eslint-disable-next-line react-internal/no-production-logging
|
||||
if (console.log.name === 'disabledLog' || disableYieldValue) {
|
||||
// If console.log has been patched, we assume we're in render
|
||||
// replaying and we ignore any values yielding in the second pass.
|
||||
return;
|
||||
}
|
||||
|
||||
if (yieldedValues === null) {
|
||||
yieldedValues = [value];
|
||||
} else {
|
||||
yieldedValues.push(value);
|
||||
}
|
||||
}
|
||||
|
||||
function unstable_advanceTime(ms) {
|
||||
// eslint-disable-next-line react-internal/no-production-logging
|
||||
if (console.log.name === 'disabledLog' || disableYieldValue) {
|
||||
// If console.log has been patched, we assume we're in render
|
||||
// replaying and we ignore any time advancing in the second pass.
|
||||
return;
|
||||
}
|
||||
|
||||
currentMockTime += ms;
|
||||
|
||||
if (scheduledTimeout !== null && timeoutTime <= currentMockTime) {
|
||||
scheduledTimeout(currentMockTime);
|
||||
timeoutTime = -1;
|
||||
scheduledTimeout = null;
|
||||
}
|
||||
}
|
||||
|
||||
function requestPaint() {
|
||||
needsPaint = true;
|
||||
}
|
||||
const unstable_Profiling = null;
|
||||
|
||||
exports.log = log;
|
||||
exports.reset = reset;
|
||||
exports.unstable_IdlePriority = IdlePriority;
|
||||
exports.unstable_ImmediatePriority = ImmediatePriority;
|
||||
exports.unstable_LowPriority = LowPriority;
|
||||
exports.unstable_NormalPriority = NormalPriority;
|
||||
exports.unstable_Profiling = unstable_Profiling;
|
||||
exports.unstable_UserBlockingPriority = UserBlockingPriority;
|
||||
exports.unstable_advanceTime = unstable_advanceTime;
|
||||
exports.unstable_cancelCallback = unstable_cancelCallback;
|
||||
exports.unstable_clearLog = unstable_clearLog;
|
||||
exports.unstable_continueExecution = unstable_continueExecution;
|
||||
exports.unstable_flushAll = unstable_flushAll;
|
||||
exports.unstable_flushAllWithoutAsserting = unstable_flushAllWithoutAsserting;
|
||||
exports.unstable_flushExpired = unstable_flushExpired;
|
||||
exports.unstable_flushNumberOfYields = unstable_flushNumberOfYields;
|
||||
exports.unstable_flushUntilNextPaint = unstable_flushUntilNextPaint;
|
||||
exports.unstable_forceFrameRate = forceFrameRate;
|
||||
exports.unstable_getCurrentPriorityLevel = unstable_getCurrentPriorityLevel;
|
||||
exports.unstable_getFirstCallbackNode = unstable_getFirstCallbackNode;
|
||||
exports.unstable_hasPendingWork = unstable_hasPendingWork;
|
||||
exports.unstable_next = unstable_next;
|
||||
exports.unstable_now = getCurrentTime;
|
||||
exports.unstable_pauseExecution = unstable_pauseExecution;
|
||||
exports.unstable_requestPaint = requestPaint;
|
||||
exports.unstable_runWithPriority = unstable_runWithPriority;
|
||||
exports.unstable_scheduleCallback = unstable_scheduleCallback;
|
||||
exports.unstable_setDisableYieldValue = setDisableYieldValue;
|
||||
exports.unstable_shouldYield = shouldYieldToHost;
|
||||
exports.unstable_wrapCallback = unstable_wrapCallback;
|
||||
22
node_modules/next/dist/compiled/scheduler/cjs/scheduler-unstable_mock.production.min.js
generated
vendored
Normal file
22
node_modules/next/dist/compiled/scheduler/cjs/scheduler-unstable_mock.production.min.js
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
React
|
||||
scheduler-unstable_mock.production.min.js
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
|
||||
This source code is licensed under the MIT license found in the
|
||||
LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
'use strict';function f(a,b){var c=a.length;a.push(b);a:for(;0<c;){var d=c-1>>>1,e=a[d];if(0<g(e,b))a[d]=b,a[c]=e,c=d;else break a}}function h(a){return 0===a.length?null:a[0]}function k(a){if(0===a.length)return null;var b=a[0],c=a.pop();if(c!==b){a[0]=c;a:for(var d=0,e=a.length,z=e>>>1;d<z;){var u=2*(d+1)-1,A=a[u],v=u+1,F=a[v];if(0>g(A,c))v<e&&0>g(F,A)?(a[d]=F,a[v]=c,d=v):(a[d]=A,a[u]=c,d=u);else if(v<e&&0>g(F,c))a[d]=F,a[v]=c,d=v;else break a}}return b}
|
||||
function g(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}var l=[],m=[],n=1,p=null,q=3,r=!1,t=!1,w=!1,x=0,y=null,B=null,C=-1,D=null,E=-1,G=!1,H=!1,I=!1,J=!1,K=!1;function L(a){for(var b=h(m);null!==b;){if(null===b.callback)k(m);else if(b.startTime<=a)k(m),b.sortIndex=b.expirationTime,f(l,b);else break;b=h(m)}}function M(a){w=!1;L(a);if(!t)if(null!==h(l))t=!0,y=N;else{var b=h(m);null!==b&&(a=b.startTime-a,B=M,C=x+a)}}
|
||||
function N(a,b){t=!1;w&&(w=!1,B=null,C=-1);r=!0;var c=q;try{a:{L(b);for(p=h(l);null!==p&&(!(p.expirationTime>b)||a&&!O());){var d=p.callback;if("function"===typeof d){p.callback=null;q=p.priorityLevel;var e=d(p.expirationTime<=b);b=x;if("function"===typeof e){if(p.callback=e,L(b),J){var z=I=!0;break a}}else p===h(l)&&k(l),L(b)}else k(l);p=h(l)}if(null!==p)z=!0;else{var u=h(m);if(null!==u){var A=u.startTime-b;B=M;C=x+A}z=!1}}return z}finally{p=null,q=c,r=!1}}
|
||||
function O(){return 0===E&&null===D||-1!==E&&null!==D&&D.length>=E||J&&I?G=!0:!1}function P(){if(H)throw Error("Already flushing work.");if(null!==y){var a=y;H=!0;try{var b=!0;do b=a(!0,x);while(b);b||(y=null);return!0}finally{H=!1}}else return!1}exports.log=function(a){"disabledLog"===console.log.name||K||(null===D?D=[a]:D.push(a))};exports.reset=function(){if(H)throw Error("Cannot reset while already flushing work.");x=0;B=y=null;C=-1;D=null;E=-1;I=H=G=!1};exports.unstable_IdlePriority=5;
|
||||
exports.unstable_ImmediatePriority=1;exports.unstable_LowPriority=4;exports.unstable_NormalPriority=3;exports.unstable_Profiling=null;exports.unstable_UserBlockingPriority=2;exports.unstable_advanceTime=function(a){"disabledLog"===console.log.name||K||(x+=a,null!==B&&C<=x&&(B(x),C=-1,B=null))};exports.unstable_cancelCallback=function(a){a.callback=null};exports.unstable_clearLog=function(){if(null===D)return[];var a=D;D=null;return a};exports.unstable_continueExecution=function(){t||r||(t=!0,y=N)};
|
||||
exports.unstable_flushAll=function(){if(null!==D)throw Error("Log is not empty. Assert on the log of yielded values before flushing additional work.");P();if(null!==D)throw Error("While flushing work, something yielded a value. Use an assertion helper to assert on the log of yielded values, e.g. expect(Scheduler).toFlushAndYield([...])");};exports.unstable_flushAllWithoutAsserting=P;
|
||||
exports.unstable_flushExpired=function(){if(H)throw Error("Already flushing work.");if(null!==y){H=!0;try{y(!1,x)||(y=null)}finally{H=!1}}};exports.unstable_flushNumberOfYields=function(a){if(H)throw Error("Already flushing work.");if(null!==y){var b=y;E=a;H=!0;try{a=!0;do a=b(!0,x);while(a&&!G);a||(y=null)}finally{E=-1,H=G=!1}}};
|
||||
exports.unstable_flushUntilNextPaint=function(){if(H)throw Error("Already flushing work.");if(null!==y){var a=y;J=!0;I=!1;H=!0;try{var b=!0;do b=a(!0,x);while(b&&!G);b||(y=null)}finally{H=G=J=!1}}return!1};exports.unstable_forceFrameRate=function(){};exports.unstable_getCurrentPriorityLevel=function(){return q};exports.unstable_getFirstCallbackNode=function(){return h(l)};exports.unstable_hasPendingWork=function(){return null!==y};
|
||||
exports.unstable_next=function(a){switch(q){case 1:case 2:case 3:var b=3;break;default:b=q}var c=q;q=b;try{return a()}finally{q=c}};exports.unstable_now=function(){return x};exports.unstable_pauseExecution=function(){};exports.unstable_requestPaint=function(){I=!0};exports.unstable_runWithPriority=function(a,b){switch(a){case 1:case 2:case 3:case 4:case 5:break;default:a=3}var c=q;q=a;try{return b()}finally{q=c}};
|
||||
exports.unstable_scheduleCallback=function(a,b,c){var d=x;"object"===typeof c&&null!==c?(c=c.delay,c="number"===typeof c&&0<c?d+c:d):c=d;switch(a){case 1:var e=-1;break;case 2:e=250;break;case 5:e=1073741823;break;case 4:e=1E4;break;default:e=5E3}e=c+e;a={id:n++,callback:b,priorityLevel:a,startTime:c,expirationTime:e,sortIndex:-1};c>d?(a.sortIndex=c,f(m,a),null===h(l)&&a===h(m)&&(w?(B=null,C=-1):w=!0,B=M,C=x+(c-d))):(a.sortIndex=e,f(l,a),t||r||(t=!0,y=N));return a};
|
||||
exports.unstable_setDisableYieldValue=function(a){K=a};exports.unstable_shouldYield=O;exports.unstable_wrapCallback=function(a){var b=q;return function(){var c=q;q=b;try{return a.apply(this,arguments)}finally{q=c}}};
|
||||
|
||||
//# sourceMappingURL=scheduler-unstable_mock.production.min.js.map
|
||||
209
node_modules/next/dist/compiled/scheduler/cjs/scheduler-unstable_post_task.development.js
generated
vendored
Normal file
209
node_modules/next/dist/compiled/scheduler/cjs/scheduler-unstable_post_task.development.js
generated
vendored
Normal file
@ -0,0 +1,209 @@
|
||||
/**
|
||||
* @license React
|
||||
* scheduler-unstable_post_task.development.js
|
||||
*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
// TODO: Use symbols?
|
||||
var ImmediatePriority = 1;
|
||||
var UserBlockingPriority = 2;
|
||||
var NormalPriority = 3;
|
||||
var LowPriority = 4;
|
||||
var IdlePriority = 5;
|
||||
|
||||
var perf = window.performance;
|
||||
var setTimeout = window.setTimeout; // Use experimental Chrome Scheduler postTask API.
|
||||
|
||||
var scheduler = global.scheduler;
|
||||
var getCurrentTime = perf.now.bind(perf);
|
||||
var unstable_now = getCurrentTime; // Scheduler periodically yields in case there is other work on the main
|
||||
// thread, like user events. By default, it yields multiple times per frame.
|
||||
// It does not attempt to align with frame boundaries, since most tasks don't
|
||||
// need to be frame aligned; for those that do, use requestAnimationFrame.
|
||||
|
||||
var yieldInterval = 5;
|
||||
var deadline = 0;
|
||||
var currentPriorityLevel_DEPRECATED = NormalPriority; // `isInputPending` is not available. Since we have no way of knowing if
|
||||
// there's pending input, always yield at the end of the frame.
|
||||
|
||||
function unstable_shouldYield() {
|
||||
return getCurrentTime() >= deadline;
|
||||
}
|
||||
function unstable_requestPaint() {// Since we yield every frame regardless, `requestPaint` has no effect.
|
||||
}
|
||||
function unstable_scheduleCallback(priorityLevel, callback, options) {
|
||||
var postTaskPriority;
|
||||
|
||||
switch (priorityLevel) {
|
||||
case ImmediatePriority:
|
||||
case UserBlockingPriority:
|
||||
postTaskPriority = 'user-blocking';
|
||||
break;
|
||||
|
||||
case LowPriority:
|
||||
case NormalPriority:
|
||||
postTaskPriority = 'user-visible';
|
||||
break;
|
||||
|
||||
case IdlePriority:
|
||||
postTaskPriority = 'background';
|
||||
break;
|
||||
|
||||
default:
|
||||
postTaskPriority = 'user-visible';
|
||||
break;
|
||||
}
|
||||
|
||||
var controller = new TaskController({
|
||||
priority: postTaskPriority
|
||||
});
|
||||
var postTaskOptions = {
|
||||
delay: typeof options === 'object' && options !== null ? options.delay : 0,
|
||||
signal: controller.signal
|
||||
};
|
||||
var node = {
|
||||
_controller: controller
|
||||
};
|
||||
scheduler.postTask(runTask.bind(null, priorityLevel, postTaskPriority, node, callback), postTaskOptions).catch(handleAbortError);
|
||||
return node;
|
||||
}
|
||||
|
||||
function runTask(priorityLevel, postTaskPriority, node, callback) {
|
||||
deadline = getCurrentTime() + yieldInterval;
|
||||
|
||||
try {
|
||||
currentPriorityLevel_DEPRECATED = priorityLevel;
|
||||
var didTimeout_DEPRECATED = false;
|
||||
var result = callback(didTimeout_DEPRECATED);
|
||||
|
||||
if (typeof result === 'function') {
|
||||
// Assume this is a continuation
|
||||
var continuation = result;
|
||||
var continuationOptions = {
|
||||
signal: node._controller.signal
|
||||
};
|
||||
var nextTask = runTask.bind(null, priorityLevel, postTaskPriority, node, continuation);
|
||||
|
||||
if (scheduler.yield !== undefined) {
|
||||
scheduler.yield(continuationOptions).then(nextTask).catch(handleAbortError);
|
||||
} else {
|
||||
scheduler.postTask(nextTask, continuationOptions).catch(handleAbortError);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
// We're inside a `postTask` promise. If we don't handle this error, then it
|
||||
// will trigger an "Unhandled promise rejection" error. We don't want that,
|
||||
// but we do want the default error reporting behavior that normal
|
||||
// (non-Promise) tasks get for unhandled errors.
|
||||
//
|
||||
// So we'll re-throw the error inside a regular browser task.
|
||||
setTimeout(function () {
|
||||
throw error;
|
||||
});
|
||||
} finally {
|
||||
currentPriorityLevel_DEPRECATED = NormalPriority;
|
||||
}
|
||||
}
|
||||
|
||||
function handleAbortError(error) {// Abort errors are an implementation detail. We don't expose the
|
||||
// TaskController to the user, nor do we expose the promise that is returned
|
||||
// from `postTask`. So we should suppress them, since there's no way for the
|
||||
// user to handle them.
|
||||
}
|
||||
|
||||
function unstable_cancelCallback(node) {
|
||||
var controller = node._controller;
|
||||
controller.abort();
|
||||
}
|
||||
function unstable_runWithPriority(priorityLevel, callback) {
|
||||
var previousPriorityLevel = currentPriorityLevel_DEPRECATED;
|
||||
currentPriorityLevel_DEPRECATED = priorityLevel;
|
||||
|
||||
try {
|
||||
return callback();
|
||||
} finally {
|
||||
currentPriorityLevel_DEPRECATED = previousPriorityLevel;
|
||||
}
|
||||
}
|
||||
function unstable_getCurrentPriorityLevel() {
|
||||
return currentPriorityLevel_DEPRECATED;
|
||||
}
|
||||
function unstable_next(callback) {
|
||||
var priorityLevel;
|
||||
|
||||
switch (currentPriorityLevel_DEPRECATED) {
|
||||
case ImmediatePriority:
|
||||
case UserBlockingPriority:
|
||||
case NormalPriority:
|
||||
// Shift down to normal priority
|
||||
priorityLevel = NormalPriority;
|
||||
break;
|
||||
|
||||
default:
|
||||
// Anything lower than normal priority should remain at the current level.
|
||||
priorityLevel = currentPriorityLevel_DEPRECATED;
|
||||
break;
|
||||
}
|
||||
|
||||
var previousPriorityLevel = currentPriorityLevel_DEPRECATED;
|
||||
currentPriorityLevel_DEPRECATED = priorityLevel;
|
||||
|
||||
try {
|
||||
return callback();
|
||||
} finally {
|
||||
currentPriorityLevel_DEPRECATED = previousPriorityLevel;
|
||||
}
|
||||
}
|
||||
function unstable_wrapCallback(callback) {
|
||||
var parentPriorityLevel = currentPriorityLevel_DEPRECATED;
|
||||
return function () {
|
||||
var previousPriorityLevel = currentPriorityLevel_DEPRECATED;
|
||||
currentPriorityLevel_DEPRECATED = parentPriorityLevel;
|
||||
|
||||
try {
|
||||
return callback();
|
||||
} finally {
|
||||
currentPriorityLevel_DEPRECATED = previousPriorityLevel;
|
||||
}
|
||||
};
|
||||
}
|
||||
function unstable_forceFrameRate() {}
|
||||
function unstable_pauseExecution() {}
|
||||
function unstable_continueExecution() {}
|
||||
function unstable_getFirstCallbackNode() {
|
||||
return null;
|
||||
} // Currently no profiling build
|
||||
|
||||
var unstable_Profiling = null;
|
||||
|
||||
exports.unstable_IdlePriority = IdlePriority;
|
||||
exports.unstable_ImmediatePriority = ImmediatePriority;
|
||||
exports.unstable_LowPriority = LowPriority;
|
||||
exports.unstable_NormalPriority = NormalPriority;
|
||||
exports.unstable_Profiling = unstable_Profiling;
|
||||
exports.unstable_UserBlockingPriority = UserBlockingPriority;
|
||||
exports.unstable_cancelCallback = unstable_cancelCallback;
|
||||
exports.unstable_continueExecution = unstable_continueExecution;
|
||||
exports.unstable_forceFrameRate = unstable_forceFrameRate;
|
||||
exports.unstable_getCurrentPriorityLevel = unstable_getCurrentPriorityLevel;
|
||||
exports.unstable_getFirstCallbackNode = unstable_getFirstCallbackNode;
|
||||
exports.unstable_next = unstable_next;
|
||||
exports.unstable_now = unstable_now;
|
||||
exports.unstable_pauseExecution = unstable_pauseExecution;
|
||||
exports.unstable_requestPaint = unstable_requestPaint;
|
||||
exports.unstable_runWithPriority = unstable_runWithPriority;
|
||||
exports.unstable_scheduleCallback = unstable_scheduleCallback;
|
||||
exports.unstable_shouldYield = unstable_shouldYield;
|
||||
exports.unstable_wrapCallback = unstable_wrapCallback;
|
||||
})();
|
||||
}
|
||||
203
node_modules/next/dist/compiled/scheduler/cjs/scheduler-unstable_post_task.production.js
generated
vendored
Normal file
203
node_modules/next/dist/compiled/scheduler/cjs/scheduler-unstable_post_task.production.js
generated
vendored
Normal file
@ -0,0 +1,203 @@
|
||||
/**
|
||||
* @license React
|
||||
* scheduler-unstable_post_task.production.min.js
|
||||
*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
// TODO: Use symbols?
|
||||
const ImmediatePriority = 1;
|
||||
const UserBlockingPriority = 2;
|
||||
const NormalPriority = 3;
|
||||
const LowPriority = 4;
|
||||
const IdlePriority = 5;
|
||||
|
||||
const perf = window.performance;
|
||||
const setTimeout = window.setTimeout; // Use experimental Chrome Scheduler postTask API.
|
||||
|
||||
const scheduler = global.scheduler;
|
||||
const getCurrentTime = perf.now.bind(perf);
|
||||
const unstable_now = getCurrentTime; // Scheduler periodically yields in case there is other work on the main
|
||||
// thread, like user events. By default, it yields multiple times per frame.
|
||||
// It does not attempt to align with frame boundaries, since most tasks don't
|
||||
// need to be frame aligned; for those that do, use requestAnimationFrame.
|
||||
|
||||
const yieldInterval = 5;
|
||||
let deadline = 0;
|
||||
let currentPriorityLevel_DEPRECATED = NormalPriority; // `isInputPending` is not available. Since we have no way of knowing if
|
||||
// there's pending input, always yield at the end of the frame.
|
||||
|
||||
function unstable_shouldYield() {
|
||||
return getCurrentTime() >= deadline;
|
||||
}
|
||||
function unstable_requestPaint() {// Since we yield every frame regardless, `requestPaint` has no effect.
|
||||
}
|
||||
function unstable_scheduleCallback(priorityLevel, callback, options) {
|
||||
let postTaskPriority;
|
||||
|
||||
switch (priorityLevel) {
|
||||
case ImmediatePriority:
|
||||
case UserBlockingPriority:
|
||||
postTaskPriority = 'user-blocking';
|
||||
break;
|
||||
|
||||
case LowPriority:
|
||||
case NormalPriority:
|
||||
postTaskPriority = 'user-visible';
|
||||
break;
|
||||
|
||||
case IdlePriority:
|
||||
postTaskPriority = 'background';
|
||||
break;
|
||||
|
||||
default:
|
||||
postTaskPriority = 'user-visible';
|
||||
break;
|
||||
}
|
||||
|
||||
const controller = new TaskController({
|
||||
priority: postTaskPriority
|
||||
});
|
||||
const postTaskOptions = {
|
||||
delay: typeof options === 'object' && options !== null ? options.delay : 0,
|
||||
signal: controller.signal
|
||||
};
|
||||
const node = {
|
||||
_controller: controller
|
||||
};
|
||||
scheduler.postTask(runTask.bind(null, priorityLevel, postTaskPriority, node, callback), postTaskOptions).catch(handleAbortError);
|
||||
return node;
|
||||
}
|
||||
|
||||
function runTask(priorityLevel, postTaskPriority, node, callback) {
|
||||
deadline = getCurrentTime() + yieldInterval;
|
||||
|
||||
try {
|
||||
currentPriorityLevel_DEPRECATED = priorityLevel;
|
||||
const didTimeout_DEPRECATED = false;
|
||||
const result = callback(didTimeout_DEPRECATED);
|
||||
|
||||
if (typeof result === 'function') {
|
||||
// Assume this is a continuation
|
||||
const continuation = result;
|
||||
const continuationOptions = {
|
||||
signal: node._controller.signal
|
||||
};
|
||||
const nextTask = runTask.bind(null, priorityLevel, postTaskPriority, node, continuation);
|
||||
|
||||
if (scheduler.yield !== undefined) {
|
||||
scheduler.yield(continuationOptions).then(nextTask).catch(handleAbortError);
|
||||
} else {
|
||||
scheduler.postTask(nextTask, continuationOptions).catch(handleAbortError);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
// We're inside a `postTask` promise. If we don't handle this error, then it
|
||||
// will trigger an "Unhandled promise rejection" error. We don't want that,
|
||||
// but we do want the default error reporting behavior that normal
|
||||
// (non-Promise) tasks get for unhandled errors.
|
||||
//
|
||||
// So we'll re-throw the error inside a regular browser task.
|
||||
setTimeout(() => {
|
||||
throw error;
|
||||
});
|
||||
} finally {
|
||||
currentPriorityLevel_DEPRECATED = NormalPriority;
|
||||
}
|
||||
}
|
||||
|
||||
function handleAbortError(error) {// Abort errors are an implementation detail. We don't expose the
|
||||
// TaskController to the user, nor do we expose the promise that is returned
|
||||
// from `postTask`. So we should suppress them, since there's no way for the
|
||||
// user to handle them.
|
||||
}
|
||||
|
||||
function unstable_cancelCallback(node) {
|
||||
const controller = node._controller;
|
||||
controller.abort();
|
||||
}
|
||||
function unstable_runWithPriority(priorityLevel, callback) {
|
||||
const previousPriorityLevel = currentPriorityLevel_DEPRECATED;
|
||||
currentPriorityLevel_DEPRECATED = priorityLevel;
|
||||
|
||||
try {
|
||||
return callback();
|
||||
} finally {
|
||||
currentPriorityLevel_DEPRECATED = previousPriorityLevel;
|
||||
}
|
||||
}
|
||||
function unstable_getCurrentPriorityLevel() {
|
||||
return currentPriorityLevel_DEPRECATED;
|
||||
}
|
||||
function unstable_next(callback) {
|
||||
let priorityLevel;
|
||||
|
||||
switch (currentPriorityLevel_DEPRECATED) {
|
||||
case ImmediatePriority:
|
||||
case UserBlockingPriority:
|
||||
case NormalPriority:
|
||||
// Shift down to normal priority
|
||||
priorityLevel = NormalPriority;
|
||||
break;
|
||||
|
||||
default:
|
||||
// Anything lower than normal priority should remain at the current level.
|
||||
priorityLevel = currentPriorityLevel_DEPRECATED;
|
||||
break;
|
||||
}
|
||||
|
||||
const previousPriorityLevel = currentPriorityLevel_DEPRECATED;
|
||||
currentPriorityLevel_DEPRECATED = priorityLevel;
|
||||
|
||||
try {
|
||||
return callback();
|
||||
} finally {
|
||||
currentPriorityLevel_DEPRECATED = previousPriorityLevel;
|
||||
}
|
||||
}
|
||||
function unstable_wrapCallback(callback) {
|
||||
const parentPriorityLevel = currentPriorityLevel_DEPRECATED;
|
||||
return () => {
|
||||
const previousPriorityLevel = currentPriorityLevel_DEPRECATED;
|
||||
currentPriorityLevel_DEPRECATED = parentPriorityLevel;
|
||||
|
||||
try {
|
||||
return callback();
|
||||
} finally {
|
||||
currentPriorityLevel_DEPRECATED = previousPriorityLevel;
|
||||
}
|
||||
};
|
||||
}
|
||||
function unstable_forceFrameRate() {}
|
||||
function unstable_pauseExecution() {}
|
||||
function unstable_continueExecution() {}
|
||||
function unstable_getFirstCallbackNode() {
|
||||
return null;
|
||||
} // Currently no profiling build
|
||||
|
||||
const unstable_Profiling = null;
|
||||
|
||||
exports.unstable_IdlePriority = IdlePriority;
|
||||
exports.unstable_ImmediatePriority = ImmediatePriority;
|
||||
exports.unstable_LowPriority = LowPriority;
|
||||
exports.unstable_NormalPriority = NormalPriority;
|
||||
exports.unstable_Profiling = unstable_Profiling;
|
||||
exports.unstable_UserBlockingPriority = UserBlockingPriority;
|
||||
exports.unstable_cancelCallback = unstable_cancelCallback;
|
||||
exports.unstable_continueExecution = unstable_continueExecution;
|
||||
exports.unstable_forceFrameRate = unstable_forceFrameRate;
|
||||
exports.unstable_getCurrentPriorityLevel = unstable_getCurrentPriorityLevel;
|
||||
exports.unstable_getFirstCallbackNode = unstable_getFirstCallbackNode;
|
||||
exports.unstable_next = unstable_next;
|
||||
exports.unstable_now = unstable_now;
|
||||
exports.unstable_pauseExecution = unstable_pauseExecution;
|
||||
exports.unstable_requestPaint = unstable_requestPaint;
|
||||
exports.unstable_runWithPriority = unstable_runWithPriority;
|
||||
exports.unstable_scheduleCallback = unstable_scheduleCallback;
|
||||
exports.unstable_shouldYield = unstable_shouldYield;
|
||||
exports.unstable_wrapCallback = unstable_wrapCallback;
|
||||
16
node_modules/next/dist/compiled/scheduler/cjs/scheduler-unstable_post_task.production.min.js
generated
vendored
Normal file
16
node_modules/next/dist/compiled/scheduler/cjs/scheduler-unstable_post_task.production.min.js
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
React
|
||||
scheduler-unstable_post_task.production.min.js
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
|
||||
This source code is licensed under the MIT license found in the
|
||||
LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
'use strict';var a=window.performance,g=window.setTimeout,h=global.scheduler,k=a.now.bind(a),l=0,m=3;function n(c,d,b,f){l=k()+5;try{m=c;var e=f(!1);if("function"===typeof e){var p={signal:b._controller.signal},q=n.bind(null,c,d,b,e);void 0!==h.yield?h.yield(p).then(q).catch(r):h.postTask(q,p).catch(r)}}catch(t){g(function(){throw t;})}finally{m=3}}function r(){}exports.unstable_IdlePriority=5;exports.unstable_ImmediatePriority=1;exports.unstable_LowPriority=4;exports.unstable_NormalPriority=3;
|
||||
exports.unstable_Profiling=null;exports.unstable_UserBlockingPriority=2;exports.unstable_cancelCallback=function(c){c._controller.abort()};exports.unstable_continueExecution=function(){};exports.unstable_forceFrameRate=function(){};exports.unstable_getCurrentPriorityLevel=function(){return m};exports.unstable_getFirstCallbackNode=function(){return null};exports.unstable_next=function(c){switch(m){case 1:case 2:case 3:var d=3;break;default:d=m}var b=m;m=d;try{return c()}finally{m=b}};
|
||||
exports.unstable_now=k;exports.unstable_pauseExecution=function(){};exports.unstable_requestPaint=function(){};exports.unstable_runWithPriority=function(c,d){var b=m;m=c;try{return d()}finally{m=b}};
|
||||
exports.unstable_scheduleCallback=function(c,d,b){switch(c){case 1:case 2:var f="user-blocking";break;case 4:case 3:f="user-visible";break;case 5:f="background";break;default:f="user-visible"}var e=new TaskController({priority:f});b={delay:"object"===typeof b&&null!==b?b.delay:0,signal:e.signal};e={_controller:e};h.postTask(n.bind(null,c,f,e,d),b).catch(r);return e};exports.unstable_shouldYield=function(){return k()>=l};
|
||||
exports.unstable_wrapCallback=function(c){var d=m;return function(){var b=m;m=d;try{return c()}finally{m=b}}};
|
||||
|
||||
//# sourceMappingURL=scheduler-unstable_post_task.production.min.js.map
|
||||
631
node_modules/next/dist/compiled/scheduler/cjs/scheduler.development.js
generated
vendored
Normal file
631
node_modules/next/dist/compiled/scheduler/cjs/scheduler.development.js
generated
vendored
Normal file
@ -0,0 +1,631 @@
|
||||
/**
|
||||
* @license React
|
||||
* scheduler.development.js
|
||||
*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
||||
if (
|
||||
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
||||
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===
|
||||
'function'
|
||||
) {
|
||||
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
||||
}
|
||||
var enableSchedulerDebugging = false;
|
||||
var enableProfiling = false;
|
||||
var frameYieldMs = 5;
|
||||
var userBlockingPriorityTimeout = 250;
|
||||
var normalPriorityTimeout = 5000;
|
||||
var lowPriorityTimeout = 10000;
|
||||
|
||||
function push(heap, node) {
|
||||
var index = heap.length;
|
||||
heap.push(node);
|
||||
siftUp(heap, node, index);
|
||||
}
|
||||
function peek(heap) {
|
||||
return heap.length === 0 ? null : heap[0];
|
||||
}
|
||||
function pop(heap) {
|
||||
if (heap.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var first = heap[0];
|
||||
var last = heap.pop();
|
||||
|
||||
if (last !== first) {
|
||||
heap[0] = last;
|
||||
siftDown(heap, last, 0);
|
||||
}
|
||||
|
||||
return first;
|
||||
}
|
||||
|
||||
function siftUp(heap, node, i) {
|
||||
var index = i;
|
||||
|
||||
while (index > 0) {
|
||||
var parentIndex = index - 1 >>> 1;
|
||||
var parent = heap[parentIndex];
|
||||
|
||||
if (compare(parent, node) > 0) {
|
||||
// The parent is larger. Swap positions.
|
||||
heap[parentIndex] = node;
|
||||
heap[index] = parent;
|
||||
index = parentIndex;
|
||||
} else {
|
||||
// The parent is smaller. Exit.
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function siftDown(heap, node, i) {
|
||||
var index = i;
|
||||
var length = heap.length;
|
||||
var halfLength = length >>> 1;
|
||||
|
||||
while (index < halfLength) {
|
||||
var leftIndex = (index + 1) * 2 - 1;
|
||||
var left = heap[leftIndex];
|
||||
var rightIndex = leftIndex + 1;
|
||||
var right = heap[rightIndex]; // If the left or right node is smaller, swap with the smaller of those.
|
||||
|
||||
if (compare(left, node) < 0) {
|
||||
if (rightIndex < length && compare(right, left) < 0) {
|
||||
heap[index] = right;
|
||||
heap[rightIndex] = node;
|
||||
index = rightIndex;
|
||||
} else {
|
||||
heap[index] = left;
|
||||
heap[leftIndex] = node;
|
||||
index = leftIndex;
|
||||
}
|
||||
} else if (rightIndex < length && compare(right, node) < 0) {
|
||||
heap[index] = right;
|
||||
heap[rightIndex] = node;
|
||||
index = rightIndex;
|
||||
} else {
|
||||
// Neither child is smaller. Exit.
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function compare(a, b) {
|
||||
// Compare sort index first, then task id.
|
||||
var diff = a.sortIndex - b.sortIndex;
|
||||
return diff !== 0 ? diff : a.id - b.id;
|
||||
}
|
||||
|
||||
// TODO: Use symbols?
|
||||
var ImmediatePriority = 1;
|
||||
var UserBlockingPriority = 2;
|
||||
var NormalPriority = 3;
|
||||
var LowPriority = 4;
|
||||
var IdlePriority = 5;
|
||||
|
||||
function markTaskErrored(task, ms) {
|
||||
}
|
||||
|
||||
/* eslint-disable no-var */
|
||||
exports.unstable_now = void 0;
|
||||
var hasPerformanceNow = // $FlowFixMe[method-unbinding]
|
||||
typeof performance === 'object' && typeof performance.now === 'function';
|
||||
|
||||
if (hasPerformanceNow) {
|
||||
var localPerformance = performance;
|
||||
|
||||
exports.unstable_now = function () {
|
||||
return localPerformance.now();
|
||||
};
|
||||
} else {
|
||||
var localDate = Date;
|
||||
var initialTime = localDate.now();
|
||||
|
||||
exports.unstable_now = function () {
|
||||
return localDate.now() - initialTime;
|
||||
};
|
||||
} // Max 31 bit integer. The max integer size in V8 for 32-bit systems.
|
||||
// Math.pow(2, 30) - 1
|
||||
// 0b111111111111111111111111111111
|
||||
|
||||
|
||||
var maxSigned31BitInt = 1073741823; // Tasks are stored on a min heap
|
||||
|
||||
var taskQueue = [];
|
||||
var timerQueue = []; // Incrementing id counter. Used to maintain insertion order.
|
||||
|
||||
var taskIdCounter = 1; // Pausing the scheduler is useful for debugging.
|
||||
var currentTask = null;
|
||||
var currentPriorityLevel = NormalPriority; // This is set while performing work, to prevent re-entrance.
|
||||
|
||||
var isPerformingWork = false;
|
||||
var isHostCallbackScheduled = false;
|
||||
var isHostTimeoutScheduled = false; // Capture local references to native APIs, in case a polyfill overrides them.
|
||||
|
||||
var localSetTimeout = typeof setTimeout === 'function' ? setTimeout : null;
|
||||
var localClearTimeout = typeof clearTimeout === 'function' ? clearTimeout : null;
|
||||
var localSetImmediate = typeof setImmediate !== 'undefined' ? setImmediate : null; // IE and Node.js + jsdom
|
||||
|
||||
typeof navigator !== 'undefined' && // $FlowFixMe[prop-missing]
|
||||
navigator.scheduling !== undefined && // $FlowFixMe[incompatible-type]
|
||||
navigator.scheduling.isInputPending !== undefined ? navigator.scheduling.isInputPending.bind(navigator.scheduling) : null;
|
||||
|
||||
function advanceTimers(currentTime) {
|
||||
// Check for tasks that are no longer delayed and add them to the queue.
|
||||
var timer = peek(timerQueue);
|
||||
|
||||
while (timer !== null) {
|
||||
if (timer.callback === null) {
|
||||
// Timer was cancelled.
|
||||
pop(timerQueue);
|
||||
} else if (timer.startTime <= currentTime) {
|
||||
// Timer fired. Transfer to the task queue.
|
||||
pop(timerQueue);
|
||||
timer.sortIndex = timer.expirationTime;
|
||||
push(taskQueue, timer);
|
||||
} else {
|
||||
// Remaining timers are pending.
|
||||
return;
|
||||
}
|
||||
|
||||
timer = peek(timerQueue);
|
||||
}
|
||||
}
|
||||
|
||||
function handleTimeout(currentTime) {
|
||||
isHostTimeoutScheduled = false;
|
||||
advanceTimers(currentTime);
|
||||
|
||||
if (!isHostCallbackScheduled) {
|
||||
if (peek(taskQueue) !== null) {
|
||||
isHostCallbackScheduled = true;
|
||||
requestHostCallback();
|
||||
} else {
|
||||
var firstTimer = peek(timerQueue);
|
||||
|
||||
if (firstTimer !== null) {
|
||||
requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function flushWork(initialTime) {
|
||||
|
||||
|
||||
isHostCallbackScheduled = false;
|
||||
|
||||
if (isHostTimeoutScheduled) {
|
||||
// We scheduled a timeout but it's no longer needed. Cancel it.
|
||||
isHostTimeoutScheduled = false;
|
||||
cancelHostTimeout();
|
||||
}
|
||||
|
||||
isPerformingWork = true;
|
||||
var previousPriorityLevel = currentPriorityLevel;
|
||||
|
||||
try {
|
||||
var currentTime; if (enableProfiling) ; else {
|
||||
// No catch in prod code path.
|
||||
return workLoop(initialTime);
|
||||
}
|
||||
} finally {
|
||||
currentTask = null;
|
||||
currentPriorityLevel = previousPriorityLevel;
|
||||
isPerformingWork = false;
|
||||
}
|
||||
}
|
||||
|
||||
function workLoop(initialTime) {
|
||||
var currentTime = initialTime;
|
||||
advanceTimers(currentTime);
|
||||
currentTask = peek(taskQueue);
|
||||
|
||||
while (currentTask !== null && !(enableSchedulerDebugging )) {
|
||||
if (currentTask.expirationTime > currentTime && shouldYieldToHost()) {
|
||||
// This currentTask hasn't expired, and we've reached the deadline.
|
||||
break;
|
||||
} // $FlowFixMe[incompatible-use] found when upgrading Flow
|
||||
|
||||
|
||||
var callback = currentTask.callback;
|
||||
|
||||
if (typeof callback === 'function') {
|
||||
// $FlowFixMe[incompatible-use] found when upgrading Flow
|
||||
currentTask.callback = null; // $FlowFixMe[incompatible-use] found when upgrading Flow
|
||||
|
||||
currentPriorityLevel = currentTask.priorityLevel; // $FlowFixMe[incompatible-use] found when upgrading Flow
|
||||
|
||||
var didUserCallbackTimeout = currentTask.expirationTime <= currentTime;
|
||||
|
||||
var continuationCallback = callback(didUserCallbackTimeout);
|
||||
currentTime = exports.unstable_now();
|
||||
|
||||
if (typeof continuationCallback === 'function') {
|
||||
// If a continuation is returned, immediately yield to the main thread
|
||||
// regardless of how much time is left in the current time slice.
|
||||
// $FlowFixMe[incompatible-use] found when upgrading Flow
|
||||
currentTask.callback = continuationCallback;
|
||||
|
||||
advanceTimers(currentTime);
|
||||
return true;
|
||||
} else {
|
||||
|
||||
if (currentTask === peek(taskQueue)) {
|
||||
pop(taskQueue);
|
||||
}
|
||||
|
||||
advanceTimers(currentTime);
|
||||
}
|
||||
} else {
|
||||
pop(taskQueue);
|
||||
}
|
||||
|
||||
currentTask = peek(taskQueue);
|
||||
} // Return whether there's additional work
|
||||
|
||||
|
||||
if (currentTask !== null) {
|
||||
return true;
|
||||
} else {
|
||||
var firstTimer = peek(timerQueue);
|
||||
|
||||
if (firstTimer !== null) {
|
||||
requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function unstable_runWithPriority(priorityLevel, eventHandler) {
|
||||
switch (priorityLevel) {
|
||||
case ImmediatePriority:
|
||||
case UserBlockingPriority:
|
||||
case NormalPriority:
|
||||
case LowPriority:
|
||||
case IdlePriority:
|
||||
break;
|
||||
|
||||
default:
|
||||
priorityLevel = NormalPriority;
|
||||
}
|
||||
|
||||
var previousPriorityLevel = currentPriorityLevel;
|
||||
currentPriorityLevel = priorityLevel;
|
||||
|
||||
try {
|
||||
return eventHandler();
|
||||
} finally {
|
||||
currentPriorityLevel = previousPriorityLevel;
|
||||
}
|
||||
}
|
||||
|
||||
function unstable_next(eventHandler) {
|
||||
var priorityLevel;
|
||||
|
||||
switch (currentPriorityLevel) {
|
||||
case ImmediatePriority:
|
||||
case UserBlockingPriority:
|
||||
case NormalPriority:
|
||||
// Shift down to normal priority
|
||||
priorityLevel = NormalPriority;
|
||||
break;
|
||||
|
||||
default:
|
||||
// Anything lower than normal priority should remain at the current level.
|
||||
priorityLevel = currentPriorityLevel;
|
||||
break;
|
||||
}
|
||||
|
||||
var previousPriorityLevel = currentPriorityLevel;
|
||||
currentPriorityLevel = priorityLevel;
|
||||
|
||||
try {
|
||||
return eventHandler();
|
||||
} finally {
|
||||
currentPriorityLevel = previousPriorityLevel;
|
||||
}
|
||||
}
|
||||
|
||||
function unstable_wrapCallback(callback) {
|
||||
var parentPriorityLevel = currentPriorityLevel; // $FlowFixMe[incompatible-return]
|
||||
// $FlowFixMe[missing-this-annot]
|
||||
|
||||
return function () {
|
||||
// This is a fork of runWithPriority, inlined for performance.
|
||||
var previousPriorityLevel = currentPriorityLevel;
|
||||
currentPriorityLevel = parentPriorityLevel;
|
||||
|
||||
try {
|
||||
return callback.apply(this, arguments);
|
||||
} finally {
|
||||
currentPriorityLevel = previousPriorityLevel;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function unstable_scheduleCallback(priorityLevel, callback, options) {
|
||||
var currentTime = exports.unstable_now();
|
||||
var startTime;
|
||||
|
||||
if (typeof options === 'object' && options !== null) {
|
||||
var delay = options.delay;
|
||||
|
||||
if (typeof delay === 'number' && delay > 0) {
|
||||
startTime = currentTime + delay;
|
||||
} else {
|
||||
startTime = currentTime;
|
||||
}
|
||||
} else {
|
||||
startTime = currentTime;
|
||||
}
|
||||
|
||||
var timeout;
|
||||
|
||||
switch (priorityLevel) {
|
||||
case ImmediatePriority:
|
||||
// Times out immediately
|
||||
timeout = -1;
|
||||
break;
|
||||
|
||||
case UserBlockingPriority:
|
||||
// Eventually times out
|
||||
timeout = userBlockingPriorityTimeout;
|
||||
break;
|
||||
|
||||
case IdlePriority:
|
||||
// Never times out
|
||||
timeout = maxSigned31BitInt;
|
||||
break;
|
||||
|
||||
case LowPriority:
|
||||
// Eventually times out
|
||||
timeout = lowPriorityTimeout;
|
||||
break;
|
||||
|
||||
case NormalPriority:
|
||||
default:
|
||||
// Eventually times out
|
||||
timeout = normalPriorityTimeout;
|
||||
break;
|
||||
}
|
||||
|
||||
var expirationTime = startTime + timeout;
|
||||
var newTask = {
|
||||
id: taskIdCounter++,
|
||||
callback: callback,
|
||||
priorityLevel: priorityLevel,
|
||||
startTime: startTime,
|
||||
expirationTime: expirationTime,
|
||||
sortIndex: -1
|
||||
};
|
||||
|
||||
if (startTime > currentTime) {
|
||||
// This is a delayed task.
|
||||
newTask.sortIndex = startTime;
|
||||
push(timerQueue, newTask);
|
||||
|
||||
if (peek(taskQueue) === null && newTask === peek(timerQueue)) {
|
||||
// All tasks are delayed, and this is the task with the earliest delay.
|
||||
if (isHostTimeoutScheduled) {
|
||||
// Cancel an existing timeout.
|
||||
cancelHostTimeout();
|
||||
} else {
|
||||
isHostTimeoutScheduled = true;
|
||||
} // Schedule a timeout.
|
||||
|
||||
|
||||
requestHostTimeout(handleTimeout, startTime - currentTime);
|
||||
}
|
||||
} else {
|
||||
newTask.sortIndex = expirationTime;
|
||||
push(taskQueue, newTask);
|
||||
// wait until the next time we yield.
|
||||
|
||||
|
||||
if (!isHostCallbackScheduled && !isPerformingWork) {
|
||||
isHostCallbackScheduled = true;
|
||||
requestHostCallback();
|
||||
}
|
||||
}
|
||||
|
||||
return newTask;
|
||||
}
|
||||
|
||||
function unstable_pauseExecution() {
|
||||
}
|
||||
|
||||
function unstable_continueExecution() {
|
||||
|
||||
if (!isHostCallbackScheduled && !isPerformingWork) {
|
||||
isHostCallbackScheduled = true;
|
||||
requestHostCallback();
|
||||
}
|
||||
}
|
||||
|
||||
function unstable_getFirstCallbackNode() {
|
||||
return peek(taskQueue);
|
||||
}
|
||||
|
||||
function unstable_cancelCallback(task) {
|
||||
// remove from the queue because you can't remove arbitrary nodes from an
|
||||
// array based heap, only the first one.)
|
||||
|
||||
|
||||
task.callback = null;
|
||||
}
|
||||
|
||||
function unstable_getCurrentPriorityLevel() {
|
||||
return currentPriorityLevel;
|
||||
}
|
||||
|
||||
var isMessageLoopRunning = false;
|
||||
var taskTimeoutID = -1; // Scheduler periodically yields in case there is other work on the main
|
||||
// thread, like user events. By default, it yields multiple times per frame.
|
||||
// It does not attempt to align with frame boundaries, since most tasks don't
|
||||
// need to be frame aligned; for those that do, use requestAnimationFrame.
|
||||
|
||||
var frameInterval = frameYieldMs;
|
||||
var startTime = -1;
|
||||
|
||||
function shouldYieldToHost() {
|
||||
var timeElapsed = exports.unstable_now() - startTime;
|
||||
|
||||
if (timeElapsed < frameInterval) {
|
||||
// The main thread has only been blocked for a really short amount of time;
|
||||
// smaller than a single frame. Don't yield yet.
|
||||
return false;
|
||||
} // The main thread has been blocked for a non-negligible amount of time. We
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function requestPaint() {
|
||||
|
||||
}
|
||||
|
||||
function forceFrameRate(fps) {
|
||||
if (fps < 0 || fps > 125) {
|
||||
// Using console['error'] to evade Babel and ESLint
|
||||
console['error']('forceFrameRate takes a positive int between 0 and 125, ' + 'forcing frame rates higher than 125 fps is not supported');
|
||||
return;
|
||||
}
|
||||
|
||||
if (fps > 0) {
|
||||
frameInterval = Math.floor(1000 / fps);
|
||||
} else {
|
||||
// reset the framerate
|
||||
frameInterval = frameYieldMs;
|
||||
}
|
||||
}
|
||||
|
||||
var performWorkUntilDeadline = function () {
|
||||
if (isMessageLoopRunning) {
|
||||
var currentTime = exports.unstable_now(); // Keep track of the start time so we can measure how long the main thread
|
||||
// has been blocked.
|
||||
|
||||
startTime = currentTime; // If a scheduler task throws, exit the current browser task so the
|
||||
// error can be observed.
|
||||
//
|
||||
// Intentionally not using a try-catch, since that makes some debugging
|
||||
// techniques harder. Instead, if `flushWork` errors, then `hasMoreWork` will
|
||||
// remain true, and we'll continue the work loop.
|
||||
|
||||
var hasMoreWork = true;
|
||||
|
||||
try {
|
||||
hasMoreWork = flushWork(currentTime);
|
||||
} finally {
|
||||
if (hasMoreWork) {
|
||||
// If there's more work, schedule the next message event at the end
|
||||
// of the preceding one.
|
||||
schedulePerformWorkUntilDeadline();
|
||||
} else {
|
||||
isMessageLoopRunning = false;
|
||||
}
|
||||
}
|
||||
} // Yielding to the browser will give it a chance to paint, so we can
|
||||
};
|
||||
|
||||
var schedulePerformWorkUntilDeadline;
|
||||
|
||||
if (typeof localSetImmediate === 'function') {
|
||||
// Node.js and old IE.
|
||||
// There's a few reasons for why we prefer setImmediate.
|
||||
//
|
||||
// Unlike MessageChannel, it doesn't prevent a Node.js process from exiting.
|
||||
// (Even though this is a DOM fork of the Scheduler, you could get here
|
||||
// with a mix of Node.js 15+, which has a MessageChannel, and jsdom.)
|
||||
// https://github.com/facebook/react/issues/20756
|
||||
//
|
||||
// But also, it runs earlier which is the semantic we want.
|
||||
// If other browsers ever implement it, it's better to use it.
|
||||
// Although both of these would be inferior to native scheduling.
|
||||
schedulePerformWorkUntilDeadline = function () {
|
||||
localSetImmediate(performWorkUntilDeadline);
|
||||
};
|
||||
} else if (typeof MessageChannel !== 'undefined') {
|
||||
// DOM and Worker environments.
|
||||
// We prefer MessageChannel because of the 4ms setTimeout clamping.
|
||||
var channel = new MessageChannel();
|
||||
var port = channel.port2;
|
||||
channel.port1.onmessage = performWorkUntilDeadline;
|
||||
|
||||
schedulePerformWorkUntilDeadline = function () {
|
||||
port.postMessage(null);
|
||||
};
|
||||
} else {
|
||||
// We should only fallback here in non-browser environments.
|
||||
schedulePerformWorkUntilDeadline = function () {
|
||||
// $FlowFixMe[not-a-function] nullable value
|
||||
localSetTimeout(performWorkUntilDeadline, 0);
|
||||
};
|
||||
}
|
||||
|
||||
function requestHostCallback() {
|
||||
if (!isMessageLoopRunning) {
|
||||
isMessageLoopRunning = true;
|
||||
schedulePerformWorkUntilDeadline();
|
||||
}
|
||||
}
|
||||
|
||||
function requestHostTimeout(callback, ms) {
|
||||
// $FlowFixMe[not-a-function] nullable value
|
||||
taskTimeoutID = localSetTimeout(function () {
|
||||
callback(exports.unstable_now());
|
||||
}, ms);
|
||||
}
|
||||
|
||||
function cancelHostTimeout() {
|
||||
// $FlowFixMe[not-a-function] nullable value
|
||||
localClearTimeout(taskTimeoutID);
|
||||
taskTimeoutID = -1;
|
||||
}
|
||||
var unstable_Profiling = null;
|
||||
|
||||
exports.unstable_IdlePriority = IdlePriority;
|
||||
exports.unstable_ImmediatePriority = ImmediatePriority;
|
||||
exports.unstable_LowPriority = LowPriority;
|
||||
exports.unstable_NormalPriority = NormalPriority;
|
||||
exports.unstable_Profiling = unstable_Profiling;
|
||||
exports.unstable_UserBlockingPriority = UserBlockingPriority;
|
||||
exports.unstable_cancelCallback = unstable_cancelCallback;
|
||||
exports.unstable_continueExecution = unstable_continueExecution;
|
||||
exports.unstable_forceFrameRate = forceFrameRate;
|
||||
exports.unstable_getCurrentPriorityLevel = unstable_getCurrentPriorityLevel;
|
||||
exports.unstable_getFirstCallbackNode = unstable_getFirstCallbackNode;
|
||||
exports.unstable_next = unstable_next;
|
||||
exports.unstable_pauseExecution = unstable_pauseExecution;
|
||||
exports.unstable_requestPaint = requestPaint;
|
||||
exports.unstable_runWithPriority = unstable_runWithPriority;
|
||||
exports.unstable_scheduleCallback = unstable_scheduleCallback;
|
||||
exports.unstable_shouldYield = shouldYieldToHost;
|
||||
exports.unstable_wrapCallback = unstable_wrapCallback;
|
||||
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
||||
if (
|
||||
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
||||
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===
|
||||
'function'
|
||||
) {
|
||||
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
||||
}
|
||||
|
||||
})();
|
||||
}
|
||||
544
node_modules/next/dist/compiled/scheduler/cjs/scheduler.native.development.js
generated
vendored
Normal file
544
node_modules/next/dist/compiled/scheduler/cjs/scheduler.native.development.js
generated
vendored
Normal file
@ -0,0 +1,544 @@
|
||||
/**
|
||||
* @license React
|
||||
* scheduler.native.development.js
|
||||
*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
if (process.env.NODE_ENV !== "production") {
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
var enableSchedulerDebugging = false;
|
||||
var enableProfiling = false;
|
||||
var frameYieldMs = 5;
|
||||
var userBlockingPriorityTimeout = 250;
|
||||
var normalPriorityTimeout = 5000;
|
||||
var lowPriorityTimeout = 10000;
|
||||
|
||||
function push(heap, node) {
|
||||
var index = heap.length;
|
||||
heap.push(node);
|
||||
siftUp(heap, node, index);
|
||||
}
|
||||
function peek(heap) {
|
||||
return heap.length === 0 ? null : heap[0];
|
||||
}
|
||||
function pop(heap) {
|
||||
if (heap.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var first = heap[0];
|
||||
var last = heap.pop();
|
||||
|
||||
if (last !== first) {
|
||||
heap[0] = last;
|
||||
siftDown(heap, last, 0);
|
||||
}
|
||||
|
||||
return first;
|
||||
}
|
||||
|
||||
function siftUp(heap, node, i) {
|
||||
var index = i;
|
||||
|
||||
while (index > 0) {
|
||||
var parentIndex = index - 1 >>> 1;
|
||||
var parent = heap[parentIndex];
|
||||
|
||||
if (compare(parent, node) > 0) {
|
||||
// The parent is larger. Swap positions.
|
||||
heap[parentIndex] = node;
|
||||
heap[index] = parent;
|
||||
index = parentIndex;
|
||||
} else {
|
||||
// The parent is smaller. Exit.
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function siftDown(heap, node, i) {
|
||||
var index = i;
|
||||
var length = heap.length;
|
||||
var halfLength = length >>> 1;
|
||||
|
||||
while (index < halfLength) {
|
||||
var leftIndex = (index + 1) * 2 - 1;
|
||||
var left = heap[leftIndex];
|
||||
var rightIndex = leftIndex + 1;
|
||||
var right = heap[rightIndex]; // If the left or right node is smaller, swap with the smaller of those.
|
||||
|
||||
if (compare(left, node) < 0) {
|
||||
if (rightIndex < length && compare(right, left) < 0) {
|
||||
heap[index] = right;
|
||||
heap[rightIndex] = node;
|
||||
index = rightIndex;
|
||||
} else {
|
||||
heap[index] = left;
|
||||
heap[leftIndex] = node;
|
||||
index = leftIndex;
|
||||
}
|
||||
} else if (rightIndex < length && compare(right, node) < 0) {
|
||||
heap[index] = right;
|
||||
heap[rightIndex] = node;
|
||||
index = rightIndex;
|
||||
} else {
|
||||
// Neither child is smaller. Exit.
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function compare(a, b) {
|
||||
// Compare sort index first, then task id.
|
||||
var diff = a.sortIndex - b.sortIndex;
|
||||
return diff !== 0 ? diff : a.id - b.id;
|
||||
}
|
||||
|
||||
// TODO: Use symbols?
|
||||
var ImmediatePriority = 1;
|
||||
var UserBlockingPriority = 2;
|
||||
var NormalPriority = 3;
|
||||
var LowPriority = 4;
|
||||
var IdlePriority = 5;
|
||||
|
||||
function markTaskErrored(task, ms) {
|
||||
}
|
||||
|
||||
/* eslint-disable no-var */
|
||||
var getCurrentTime;
|
||||
var hasPerformanceNow = // $FlowFixMe[method-unbinding]
|
||||
typeof performance === 'object' && typeof performance.now === 'function';
|
||||
|
||||
if (hasPerformanceNow) {
|
||||
var localPerformance = performance;
|
||||
|
||||
getCurrentTime = function () {
|
||||
return localPerformance.now();
|
||||
};
|
||||
} else {
|
||||
var localDate = Date;
|
||||
var initialTime = localDate.now();
|
||||
|
||||
getCurrentTime = function () {
|
||||
return localDate.now() - initialTime;
|
||||
};
|
||||
} // Max 31 bit integer. The max integer size in V8 for 32-bit systems.
|
||||
// Math.pow(2, 30) - 1
|
||||
// 0b111111111111111111111111111111
|
||||
|
||||
|
||||
var maxSigned31BitInt = 1073741823; // Tasks are stored on a min heap
|
||||
|
||||
var taskQueue = [];
|
||||
var timerQueue = []; // Incrementing id counter. Used to maintain insertion order.
|
||||
|
||||
var taskIdCounter = 1; // Pausing the scheduler is useful for debugging.
|
||||
var currentTask = null;
|
||||
var currentPriorityLevel = NormalPriority; // This is set while performing work, to prevent re-entrance.
|
||||
|
||||
var isPerformingWork = false;
|
||||
var isHostCallbackScheduled = false;
|
||||
var isHostTimeoutScheduled = false; // Capture local references to native APIs, in case a polyfill overrides them.
|
||||
|
||||
var localSetTimeout = typeof setTimeout === 'function' ? setTimeout : null;
|
||||
var localClearTimeout = typeof clearTimeout === 'function' ? clearTimeout : null;
|
||||
var localSetImmediate = typeof setImmediate !== 'undefined' ? setImmediate : null; // IE and Node.js + jsdom
|
||||
|
||||
typeof navigator !== 'undefined' && // $FlowFixMe[prop-missing]
|
||||
navigator.scheduling !== undefined && // $FlowFixMe[incompatible-type]
|
||||
navigator.scheduling.isInputPending !== undefined ? navigator.scheduling.isInputPending.bind(navigator.scheduling) : null;
|
||||
|
||||
function advanceTimers(currentTime) {
|
||||
// Check for tasks that are no longer delayed and add them to the queue.
|
||||
var timer = peek(timerQueue);
|
||||
|
||||
while (timer !== null) {
|
||||
if (timer.callback === null) {
|
||||
// Timer was cancelled.
|
||||
pop(timerQueue);
|
||||
} else if (timer.startTime <= currentTime) {
|
||||
// Timer fired. Transfer to the task queue.
|
||||
pop(timerQueue);
|
||||
timer.sortIndex = timer.expirationTime;
|
||||
push(taskQueue, timer);
|
||||
} else {
|
||||
// Remaining timers are pending.
|
||||
return;
|
||||
}
|
||||
|
||||
timer = peek(timerQueue);
|
||||
}
|
||||
}
|
||||
|
||||
function handleTimeout(currentTime) {
|
||||
isHostTimeoutScheduled = false;
|
||||
advanceTimers(currentTime);
|
||||
|
||||
if (!isHostCallbackScheduled) {
|
||||
if (peek(taskQueue) !== null) {
|
||||
isHostCallbackScheduled = true;
|
||||
requestHostCallback();
|
||||
} else {
|
||||
var firstTimer = peek(timerQueue);
|
||||
|
||||
if (firstTimer !== null) {
|
||||
requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function flushWork(initialTime) {
|
||||
|
||||
|
||||
isHostCallbackScheduled = false;
|
||||
|
||||
if (isHostTimeoutScheduled) {
|
||||
// We scheduled a timeout but it's no longer needed. Cancel it.
|
||||
isHostTimeoutScheduled = false;
|
||||
cancelHostTimeout();
|
||||
}
|
||||
|
||||
isPerformingWork = true;
|
||||
var previousPriorityLevel = currentPriorityLevel;
|
||||
|
||||
try {
|
||||
var currentTime; if (enableProfiling) ; else {
|
||||
// No catch in prod code path.
|
||||
return workLoop(initialTime);
|
||||
}
|
||||
} finally {
|
||||
currentTask = null;
|
||||
currentPriorityLevel = previousPriorityLevel;
|
||||
isPerformingWork = false;
|
||||
}
|
||||
}
|
||||
|
||||
function workLoop(initialTime) {
|
||||
var currentTime = initialTime;
|
||||
advanceTimers(currentTime);
|
||||
currentTask = peek(taskQueue);
|
||||
|
||||
while (currentTask !== null && !(enableSchedulerDebugging )) {
|
||||
if (currentTask.expirationTime > currentTime && shouldYieldToHost()) {
|
||||
// This currentTask hasn't expired, and we've reached the deadline.
|
||||
break;
|
||||
} // $FlowFixMe[incompatible-use] found when upgrading Flow
|
||||
|
||||
|
||||
var callback = currentTask.callback;
|
||||
|
||||
if (typeof callback === 'function') {
|
||||
// $FlowFixMe[incompatible-use] found when upgrading Flow
|
||||
currentTask.callback = null; // $FlowFixMe[incompatible-use] found when upgrading Flow
|
||||
|
||||
currentPriorityLevel = currentTask.priorityLevel; // $FlowFixMe[incompatible-use] found when upgrading Flow
|
||||
|
||||
var didUserCallbackTimeout = currentTask.expirationTime <= currentTime;
|
||||
|
||||
var continuationCallback = callback(didUserCallbackTimeout);
|
||||
currentTime = getCurrentTime();
|
||||
|
||||
if (typeof continuationCallback === 'function') {
|
||||
// If a continuation is returned, immediately yield to the main thread
|
||||
// regardless of how much time is left in the current time slice.
|
||||
// $FlowFixMe[incompatible-use] found when upgrading Flow
|
||||
currentTask.callback = continuationCallback;
|
||||
|
||||
advanceTimers(currentTime);
|
||||
return true;
|
||||
} else {
|
||||
|
||||
if (currentTask === peek(taskQueue)) {
|
||||
pop(taskQueue);
|
||||
}
|
||||
|
||||
advanceTimers(currentTime);
|
||||
}
|
||||
} else {
|
||||
pop(taskQueue);
|
||||
}
|
||||
|
||||
currentTask = peek(taskQueue);
|
||||
} // Return whether there's additional work
|
||||
|
||||
|
||||
if (currentTask !== null) {
|
||||
return true;
|
||||
} else {
|
||||
var firstTimer = peek(timerQueue);
|
||||
|
||||
if (firstTimer !== null) {
|
||||
requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function unstable_scheduleCallback$1(priorityLevel, callback, options) {
|
||||
var currentTime = getCurrentTime();
|
||||
var startTime;
|
||||
|
||||
if (typeof options === 'object' && options !== null) {
|
||||
var delay = options.delay;
|
||||
|
||||
if (typeof delay === 'number' && delay > 0) {
|
||||
startTime = currentTime + delay;
|
||||
} else {
|
||||
startTime = currentTime;
|
||||
}
|
||||
} else {
|
||||
startTime = currentTime;
|
||||
}
|
||||
|
||||
var timeout;
|
||||
|
||||
switch (priorityLevel) {
|
||||
case ImmediatePriority:
|
||||
// Times out immediately
|
||||
timeout = -1;
|
||||
break;
|
||||
|
||||
case UserBlockingPriority:
|
||||
// Eventually times out
|
||||
timeout = userBlockingPriorityTimeout;
|
||||
break;
|
||||
|
||||
case IdlePriority:
|
||||
// Never times out
|
||||
timeout = maxSigned31BitInt;
|
||||
break;
|
||||
|
||||
case LowPriority:
|
||||
// Eventually times out
|
||||
timeout = lowPriorityTimeout;
|
||||
break;
|
||||
|
||||
case NormalPriority:
|
||||
default:
|
||||
// Eventually times out
|
||||
timeout = normalPriorityTimeout;
|
||||
break;
|
||||
}
|
||||
|
||||
var expirationTime = startTime + timeout;
|
||||
var newTask = {
|
||||
id: taskIdCounter++,
|
||||
callback: callback,
|
||||
priorityLevel: priorityLevel,
|
||||
startTime: startTime,
|
||||
expirationTime: expirationTime,
|
||||
sortIndex: -1
|
||||
};
|
||||
|
||||
if (startTime > currentTime) {
|
||||
// This is a delayed task.
|
||||
newTask.sortIndex = startTime;
|
||||
push(timerQueue, newTask);
|
||||
|
||||
if (peek(taskQueue) === null && newTask === peek(timerQueue)) {
|
||||
// All tasks are delayed, and this is the task with the earliest delay.
|
||||
if (isHostTimeoutScheduled) {
|
||||
// Cancel an existing timeout.
|
||||
cancelHostTimeout();
|
||||
} else {
|
||||
isHostTimeoutScheduled = true;
|
||||
} // Schedule a timeout.
|
||||
|
||||
|
||||
requestHostTimeout(handleTimeout, startTime - currentTime);
|
||||
}
|
||||
} else {
|
||||
newTask.sortIndex = expirationTime;
|
||||
push(taskQueue, newTask);
|
||||
// wait until the next time we yield.
|
||||
|
||||
|
||||
if (!isHostCallbackScheduled && !isPerformingWork) {
|
||||
isHostCallbackScheduled = true;
|
||||
requestHostCallback();
|
||||
}
|
||||
}
|
||||
|
||||
return newTask;
|
||||
}
|
||||
|
||||
function unstable_cancelCallback$1(task) {
|
||||
// remove from the queue because you can't remove arbitrary nodes from an
|
||||
// array based heap, only the first one.)
|
||||
|
||||
|
||||
task.callback = null;
|
||||
}
|
||||
|
||||
function unstable_getCurrentPriorityLevel$1() {
|
||||
return currentPriorityLevel;
|
||||
}
|
||||
|
||||
var isMessageLoopRunning = false;
|
||||
var taskTimeoutID = -1; // Scheduler periodically yields in case there is other work on the main
|
||||
// thread, like user events. By default, it yields multiple times per frame.
|
||||
// It does not attempt to align with frame boundaries, since most tasks don't
|
||||
// need to be frame aligned; for those that do, use requestAnimationFrame.
|
||||
|
||||
var frameInterval = frameYieldMs;
|
||||
var startTime = -1;
|
||||
|
||||
function shouldYieldToHost() {
|
||||
var timeElapsed = getCurrentTime() - startTime;
|
||||
|
||||
if (timeElapsed < frameInterval) {
|
||||
// The main thread has only been blocked for a really short amount of time;
|
||||
// smaller than a single frame. Don't yield yet.
|
||||
return false;
|
||||
} // The main thread has been blocked for a non-negligible amount of time. We
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function requestPaint() {
|
||||
|
||||
}
|
||||
|
||||
var performWorkUntilDeadline = function () {
|
||||
if (isMessageLoopRunning) {
|
||||
var currentTime = getCurrentTime(); // Keep track of the start time so we can measure how long the main thread
|
||||
// has been blocked.
|
||||
|
||||
startTime = currentTime; // If a scheduler task throws, exit the current browser task so the
|
||||
// error can be observed.
|
||||
//
|
||||
// Intentionally not using a try-catch, since that makes some debugging
|
||||
// techniques harder. Instead, if `flushWork` errors, then `hasMoreWork` will
|
||||
// remain true, and we'll continue the work loop.
|
||||
|
||||
var hasMoreWork = true;
|
||||
|
||||
try {
|
||||
hasMoreWork = flushWork(currentTime);
|
||||
} finally {
|
||||
if (hasMoreWork) {
|
||||
// If there's more work, schedule the next message event at the end
|
||||
// of the preceding one.
|
||||
schedulePerformWorkUntilDeadline();
|
||||
} else {
|
||||
isMessageLoopRunning = false;
|
||||
}
|
||||
}
|
||||
} // Yielding to the browser will give it a chance to paint, so we can
|
||||
};
|
||||
|
||||
var schedulePerformWorkUntilDeadline;
|
||||
|
||||
if (typeof localSetImmediate === 'function') {
|
||||
// Node.js and old IE.
|
||||
// There's a few reasons for why we prefer setImmediate.
|
||||
//
|
||||
// Unlike MessageChannel, it doesn't prevent a Node.js process from exiting.
|
||||
// (Even though this is a DOM fork of the Scheduler, you could get here
|
||||
// with a mix of Node.js 15+, which has a MessageChannel, and jsdom.)
|
||||
// https://github.com/facebook/react/issues/20756
|
||||
//
|
||||
// But also, it runs earlier which is the semantic we want.
|
||||
// If other browsers ever implement it, it's better to use it.
|
||||
// Although both of these would be inferior to native scheduling.
|
||||
schedulePerformWorkUntilDeadline = function () {
|
||||
localSetImmediate(performWorkUntilDeadline);
|
||||
};
|
||||
} else if (typeof MessageChannel !== 'undefined') {
|
||||
// DOM and Worker environments.
|
||||
// We prefer MessageChannel because of the 4ms setTimeout clamping.
|
||||
var channel = new MessageChannel();
|
||||
var port = channel.port2;
|
||||
channel.port1.onmessage = performWorkUntilDeadline;
|
||||
|
||||
schedulePerformWorkUntilDeadline = function () {
|
||||
port.postMessage(null);
|
||||
};
|
||||
} else {
|
||||
// We should only fallback here in non-browser environments.
|
||||
schedulePerformWorkUntilDeadline = function () {
|
||||
// $FlowFixMe[not-a-function] nullable value
|
||||
localSetTimeout(performWorkUntilDeadline, 0);
|
||||
};
|
||||
}
|
||||
|
||||
function requestHostCallback() {
|
||||
if (!isMessageLoopRunning) {
|
||||
isMessageLoopRunning = true;
|
||||
schedulePerformWorkUntilDeadline();
|
||||
}
|
||||
}
|
||||
|
||||
function requestHostTimeout(callback, ms) {
|
||||
// $FlowFixMe[not-a-function] nullable value
|
||||
taskTimeoutID = localSetTimeout(function () {
|
||||
callback(getCurrentTime());
|
||||
}, ms);
|
||||
}
|
||||
|
||||
function cancelHostTimeout() {
|
||||
// $FlowFixMe[not-a-function] nullable value
|
||||
localClearTimeout(taskTimeoutID);
|
||||
taskTimeoutID = -1;
|
||||
}
|
||||
|
||||
// https://github.com/facebook/react-native/blob/main/packages/react-native/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerBinding.cpp
|
||||
|
||||
var unstable_UserBlockingPriority = typeof nativeRuntimeScheduler !== 'undefined' ? nativeRuntimeScheduler.unstable_UserBlockingPriority : UserBlockingPriority;
|
||||
var unstable_NormalPriority = typeof nativeRuntimeScheduler !== 'undefined' ? nativeRuntimeScheduler.unstable_NormalPriority : NormalPriority;
|
||||
var unstable_IdlePriority = typeof nativeRuntimeScheduler !== 'undefined' ? nativeRuntimeScheduler.unstable_IdlePriority : IdlePriority;
|
||||
var unstable_LowPriority = typeof nativeRuntimeScheduler !== 'undefined' ? nativeRuntimeScheduler.unstable_LowPriority : LowPriority;
|
||||
var unstable_ImmediatePriority = typeof nativeRuntimeScheduler !== 'undefined' ? nativeRuntimeScheduler.unstable_ImmediatePriority : ImmediatePriority;
|
||||
var unstable_scheduleCallback = typeof nativeRuntimeScheduler !== 'undefined' ? nativeRuntimeScheduler.unstable_scheduleCallback : unstable_scheduleCallback$1;
|
||||
var unstable_cancelCallback = typeof nativeRuntimeScheduler !== 'undefined' ? nativeRuntimeScheduler.unstable_cancelCallback : unstable_cancelCallback$1;
|
||||
var unstable_getCurrentPriorityLevel = typeof nativeRuntimeScheduler !== 'undefined' ? nativeRuntimeScheduler.unstable_getCurrentPriorityLevel : unstable_getCurrentPriorityLevel$1;
|
||||
var unstable_shouldYield = typeof nativeRuntimeScheduler !== 'undefined' ? nativeRuntimeScheduler.unstable_shouldYield : shouldYieldToHost;
|
||||
var unstable_requestPaint = typeof nativeRuntimeScheduler !== 'undefined' ? nativeRuntimeScheduler.unstable_requestPaint : requestPaint;
|
||||
var unstable_now = typeof nativeRuntimeScheduler !== 'undefined' ? nativeRuntimeScheduler.unstable_now : getCurrentTime; // These were never implemented on the native scheduler because React never calls them.
|
||||
// For consistency, let's disable them altogether and make them throw.
|
||||
|
||||
var unstable_next = throwNotImplemented;
|
||||
var unstable_runWithPriority = throwNotImplemented;
|
||||
var unstable_wrapCallback = throwNotImplemented;
|
||||
var unstable_continueExecution = throwNotImplemented;
|
||||
var unstable_pauseExecution = throwNotImplemented;
|
||||
var unstable_getFirstCallbackNode = throwNotImplemented;
|
||||
var unstable_forceFrameRate = throwNotImplemented;
|
||||
var unstable_Profiling = null;
|
||||
|
||||
function throwNotImplemented() {
|
||||
throw Error('Not implemented.');
|
||||
} // Flow magic to verify the exports of this file match the original version.
|
||||
|
||||
exports.unstable_IdlePriority = unstable_IdlePriority;
|
||||
exports.unstable_ImmediatePriority = unstable_ImmediatePriority;
|
||||
exports.unstable_LowPriority = unstable_LowPriority;
|
||||
exports.unstable_NormalPriority = unstable_NormalPriority;
|
||||
exports.unstable_Profiling = unstable_Profiling;
|
||||
exports.unstable_UserBlockingPriority = unstable_UserBlockingPriority;
|
||||
exports.unstable_cancelCallback = unstable_cancelCallback;
|
||||
exports.unstable_continueExecution = unstable_continueExecution;
|
||||
exports.unstable_forceFrameRate = unstable_forceFrameRate;
|
||||
exports.unstable_getCurrentPriorityLevel = unstable_getCurrentPriorityLevel;
|
||||
exports.unstable_getFirstCallbackNode = unstable_getFirstCallbackNode;
|
||||
exports.unstable_next = unstable_next;
|
||||
exports.unstable_now = unstable_now;
|
||||
exports.unstable_pauseExecution = unstable_pauseExecution;
|
||||
exports.unstable_requestPaint = unstable_requestPaint;
|
||||
exports.unstable_runWithPriority = unstable_runWithPriority;
|
||||
exports.unstable_scheduleCallback = unstable_scheduleCallback;
|
||||
exports.unstable_shouldYield = unstable_shouldYield;
|
||||
exports.unstable_wrapCallback = unstable_wrapCallback;
|
||||
})();
|
||||
}
|
||||
534
node_modules/next/dist/compiled/scheduler/cjs/scheduler.native.production.js
generated
vendored
Normal file
534
node_modules/next/dist/compiled/scheduler/cjs/scheduler.native.production.js
generated
vendored
Normal file
@ -0,0 +1,534 @@
|
||||
/**
|
||||
* @license React
|
||||
* scheduler.native.production.min.js
|
||||
*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const enableSchedulerDebugging = false;
|
||||
const enableProfiling = false;
|
||||
const frameYieldMs = 5;
|
||||
const userBlockingPriorityTimeout = 250;
|
||||
const normalPriorityTimeout = 5000;
|
||||
const lowPriorityTimeout = 10000;
|
||||
|
||||
function push(heap, node) {
|
||||
const index = heap.length;
|
||||
heap.push(node);
|
||||
siftUp(heap, node, index);
|
||||
}
|
||||
function peek(heap) {
|
||||
return heap.length === 0 ? null : heap[0];
|
||||
}
|
||||
function pop(heap) {
|
||||
if (heap.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const first = heap[0];
|
||||
const last = heap.pop();
|
||||
|
||||
if (last !== first) {
|
||||
heap[0] = last;
|
||||
siftDown(heap, last, 0);
|
||||
}
|
||||
|
||||
return first;
|
||||
}
|
||||
|
||||
function siftUp(heap, node, i) {
|
||||
let index = i;
|
||||
|
||||
while (index > 0) {
|
||||
const parentIndex = index - 1 >>> 1;
|
||||
const parent = heap[parentIndex];
|
||||
|
||||
if (compare(parent, node) > 0) {
|
||||
// The parent is larger. Swap positions.
|
||||
heap[parentIndex] = node;
|
||||
heap[index] = parent;
|
||||
index = parentIndex;
|
||||
} else {
|
||||
// The parent is smaller. Exit.
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function siftDown(heap, node, i) {
|
||||
let index = i;
|
||||
const length = heap.length;
|
||||
const halfLength = length >>> 1;
|
||||
|
||||
while (index < halfLength) {
|
||||
const leftIndex = (index + 1) * 2 - 1;
|
||||
const left = heap[leftIndex];
|
||||
const rightIndex = leftIndex + 1;
|
||||
const right = heap[rightIndex]; // If the left or right node is smaller, swap with the smaller of those.
|
||||
|
||||
if (compare(left, node) < 0) {
|
||||
if (rightIndex < length && compare(right, left) < 0) {
|
||||
heap[index] = right;
|
||||
heap[rightIndex] = node;
|
||||
index = rightIndex;
|
||||
} else {
|
||||
heap[index] = left;
|
||||
heap[leftIndex] = node;
|
||||
index = leftIndex;
|
||||
}
|
||||
} else if (rightIndex < length && compare(right, node) < 0) {
|
||||
heap[index] = right;
|
||||
heap[rightIndex] = node;
|
||||
index = rightIndex;
|
||||
} else {
|
||||
// Neither child is smaller. Exit.
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function compare(a, b) {
|
||||
// Compare sort index first, then task id.
|
||||
const diff = a.sortIndex - b.sortIndex;
|
||||
return diff !== 0 ? diff : a.id - b.id;
|
||||
}
|
||||
|
||||
// TODO: Use symbols?
|
||||
const ImmediatePriority = 1;
|
||||
const UserBlockingPriority = 2;
|
||||
const NormalPriority = 3;
|
||||
const LowPriority = 4;
|
||||
const IdlePriority = 5;
|
||||
|
||||
function markTaskErrored(task, ms) {
|
||||
}
|
||||
|
||||
/* eslint-disable no-var */
|
||||
let getCurrentTime;
|
||||
const hasPerformanceNow = // $FlowFixMe[method-unbinding]
|
||||
typeof performance === 'object' && typeof performance.now === 'function';
|
||||
|
||||
if (hasPerformanceNow) {
|
||||
const localPerformance = performance;
|
||||
|
||||
getCurrentTime = () => localPerformance.now();
|
||||
} else {
|
||||
const localDate = Date;
|
||||
const initialTime = localDate.now();
|
||||
|
||||
getCurrentTime = () => localDate.now() - initialTime;
|
||||
} // Max 31 bit integer. The max integer size in V8 for 32-bit systems.
|
||||
// Math.pow(2, 30) - 1
|
||||
// 0b111111111111111111111111111111
|
||||
|
||||
|
||||
var maxSigned31BitInt = 1073741823; // Tasks are stored on a min heap
|
||||
|
||||
var taskQueue = [];
|
||||
var timerQueue = []; // Incrementing id counter. Used to maintain insertion order.
|
||||
|
||||
var taskIdCounter = 1; // Pausing the scheduler is useful for debugging.
|
||||
var currentTask = null;
|
||||
var currentPriorityLevel = NormalPriority; // This is set while performing work, to prevent re-entrance.
|
||||
|
||||
var isPerformingWork = false;
|
||||
var isHostCallbackScheduled = false;
|
||||
var isHostTimeoutScheduled = false; // Capture local references to native APIs, in case a polyfill overrides them.
|
||||
|
||||
const localSetTimeout = typeof setTimeout === 'function' ? setTimeout : null;
|
||||
const localClearTimeout = typeof clearTimeout === 'function' ? clearTimeout : null;
|
||||
const localSetImmediate = typeof setImmediate !== 'undefined' ? setImmediate : null; // IE and Node.js + jsdom
|
||||
|
||||
typeof navigator !== 'undefined' && // $FlowFixMe[prop-missing]
|
||||
navigator.scheduling !== undefined && // $FlowFixMe[incompatible-type]
|
||||
navigator.scheduling.isInputPending !== undefined ? navigator.scheduling.isInputPending.bind(navigator.scheduling) : null;
|
||||
|
||||
function advanceTimers(currentTime) {
|
||||
// Check for tasks that are no longer delayed and add them to the queue.
|
||||
let timer = peek(timerQueue);
|
||||
|
||||
while (timer !== null) {
|
||||
if (timer.callback === null) {
|
||||
// Timer was cancelled.
|
||||
pop(timerQueue);
|
||||
} else if (timer.startTime <= currentTime) {
|
||||
// Timer fired. Transfer to the task queue.
|
||||
pop(timerQueue);
|
||||
timer.sortIndex = timer.expirationTime;
|
||||
push(taskQueue, timer);
|
||||
} else {
|
||||
// Remaining timers are pending.
|
||||
return;
|
||||
}
|
||||
|
||||
timer = peek(timerQueue);
|
||||
}
|
||||
}
|
||||
|
||||
function handleTimeout(currentTime) {
|
||||
isHostTimeoutScheduled = false;
|
||||
advanceTimers(currentTime);
|
||||
|
||||
if (!isHostCallbackScheduled) {
|
||||
if (peek(taskQueue) !== null) {
|
||||
isHostCallbackScheduled = true;
|
||||
requestHostCallback();
|
||||
} else {
|
||||
const firstTimer = peek(timerQueue);
|
||||
|
||||
if (firstTimer !== null) {
|
||||
requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function flushWork(initialTime) {
|
||||
|
||||
|
||||
isHostCallbackScheduled = false;
|
||||
|
||||
if (isHostTimeoutScheduled) {
|
||||
// We scheduled a timeout but it's no longer needed. Cancel it.
|
||||
isHostTimeoutScheduled = false;
|
||||
cancelHostTimeout();
|
||||
}
|
||||
|
||||
isPerformingWork = true;
|
||||
const previousPriorityLevel = currentPriorityLevel;
|
||||
|
||||
try {
|
||||
if (enableProfiling) ; else {
|
||||
// No catch in prod code path.
|
||||
return workLoop(initialTime);
|
||||
}
|
||||
} finally {
|
||||
currentTask = null;
|
||||
currentPriorityLevel = previousPriorityLevel;
|
||||
isPerformingWork = false;
|
||||
}
|
||||
}
|
||||
|
||||
function workLoop(initialTime) {
|
||||
let currentTime = initialTime;
|
||||
advanceTimers(currentTime);
|
||||
currentTask = peek(taskQueue);
|
||||
|
||||
while (currentTask !== null && !(enableSchedulerDebugging )) {
|
||||
if (currentTask.expirationTime > currentTime && shouldYieldToHost()) {
|
||||
// This currentTask hasn't expired, and we've reached the deadline.
|
||||
break;
|
||||
} // $FlowFixMe[incompatible-use] found when upgrading Flow
|
||||
|
||||
|
||||
const callback = currentTask.callback;
|
||||
|
||||
if (typeof callback === 'function') {
|
||||
// $FlowFixMe[incompatible-use] found when upgrading Flow
|
||||
currentTask.callback = null; // $FlowFixMe[incompatible-use] found when upgrading Flow
|
||||
|
||||
currentPriorityLevel = currentTask.priorityLevel; // $FlowFixMe[incompatible-use] found when upgrading Flow
|
||||
|
||||
const didUserCallbackTimeout = currentTask.expirationTime <= currentTime;
|
||||
|
||||
const continuationCallback = callback(didUserCallbackTimeout);
|
||||
currentTime = getCurrentTime();
|
||||
|
||||
if (typeof continuationCallback === 'function') {
|
||||
// If a continuation is returned, immediately yield to the main thread
|
||||
// regardless of how much time is left in the current time slice.
|
||||
// $FlowFixMe[incompatible-use] found when upgrading Flow
|
||||
currentTask.callback = continuationCallback;
|
||||
|
||||
advanceTimers(currentTime);
|
||||
return true;
|
||||
} else {
|
||||
|
||||
if (currentTask === peek(taskQueue)) {
|
||||
pop(taskQueue);
|
||||
}
|
||||
|
||||
advanceTimers(currentTime);
|
||||
}
|
||||
} else {
|
||||
pop(taskQueue);
|
||||
}
|
||||
|
||||
currentTask = peek(taskQueue);
|
||||
} // Return whether there's additional work
|
||||
|
||||
|
||||
if (currentTask !== null) {
|
||||
return true;
|
||||
} else {
|
||||
const firstTimer = peek(timerQueue);
|
||||
|
||||
if (firstTimer !== null) {
|
||||
requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function unstable_scheduleCallback$1(priorityLevel, callback, options) {
|
||||
var currentTime = getCurrentTime();
|
||||
var startTime;
|
||||
|
||||
if (typeof options === 'object' && options !== null) {
|
||||
var delay = options.delay;
|
||||
|
||||
if (typeof delay === 'number' && delay > 0) {
|
||||
startTime = currentTime + delay;
|
||||
} else {
|
||||
startTime = currentTime;
|
||||
}
|
||||
} else {
|
||||
startTime = currentTime;
|
||||
}
|
||||
|
||||
var timeout;
|
||||
|
||||
switch (priorityLevel) {
|
||||
case ImmediatePriority:
|
||||
// Times out immediately
|
||||
timeout = -1;
|
||||
break;
|
||||
|
||||
case UserBlockingPriority:
|
||||
// Eventually times out
|
||||
timeout = userBlockingPriorityTimeout;
|
||||
break;
|
||||
|
||||
case IdlePriority:
|
||||
// Never times out
|
||||
timeout = maxSigned31BitInt;
|
||||
break;
|
||||
|
||||
case LowPriority:
|
||||
// Eventually times out
|
||||
timeout = lowPriorityTimeout;
|
||||
break;
|
||||
|
||||
case NormalPriority:
|
||||
default:
|
||||
// Eventually times out
|
||||
timeout = normalPriorityTimeout;
|
||||
break;
|
||||
}
|
||||
|
||||
var expirationTime = startTime + timeout;
|
||||
var newTask = {
|
||||
id: taskIdCounter++,
|
||||
callback,
|
||||
priorityLevel,
|
||||
startTime,
|
||||
expirationTime,
|
||||
sortIndex: -1
|
||||
};
|
||||
|
||||
if (startTime > currentTime) {
|
||||
// This is a delayed task.
|
||||
newTask.sortIndex = startTime;
|
||||
push(timerQueue, newTask);
|
||||
|
||||
if (peek(taskQueue) === null && newTask === peek(timerQueue)) {
|
||||
// All tasks are delayed, and this is the task with the earliest delay.
|
||||
if (isHostTimeoutScheduled) {
|
||||
// Cancel an existing timeout.
|
||||
cancelHostTimeout();
|
||||
} else {
|
||||
isHostTimeoutScheduled = true;
|
||||
} // Schedule a timeout.
|
||||
|
||||
|
||||
requestHostTimeout(handleTimeout, startTime - currentTime);
|
||||
}
|
||||
} else {
|
||||
newTask.sortIndex = expirationTime;
|
||||
push(taskQueue, newTask);
|
||||
// wait until the next time we yield.
|
||||
|
||||
|
||||
if (!isHostCallbackScheduled && !isPerformingWork) {
|
||||
isHostCallbackScheduled = true;
|
||||
requestHostCallback();
|
||||
}
|
||||
}
|
||||
|
||||
return newTask;
|
||||
}
|
||||
|
||||
function unstable_cancelCallback$1(task) {
|
||||
// remove from the queue because you can't remove arbitrary nodes from an
|
||||
// array based heap, only the first one.)
|
||||
|
||||
|
||||
task.callback = null;
|
||||
}
|
||||
|
||||
function unstable_getCurrentPriorityLevel$1() {
|
||||
return currentPriorityLevel;
|
||||
}
|
||||
|
||||
let isMessageLoopRunning = false;
|
||||
let taskTimeoutID = -1; // Scheduler periodically yields in case there is other work on the main
|
||||
// thread, like user events. By default, it yields multiple times per frame.
|
||||
// It does not attempt to align with frame boundaries, since most tasks don't
|
||||
// need to be frame aligned; for those that do, use requestAnimationFrame.
|
||||
|
||||
let frameInterval = frameYieldMs;
|
||||
let startTime = -1;
|
||||
|
||||
function shouldYieldToHost() {
|
||||
const timeElapsed = getCurrentTime() - startTime;
|
||||
|
||||
if (timeElapsed < frameInterval) {
|
||||
// The main thread has only been blocked for a really short amount of time;
|
||||
// smaller than a single frame. Don't yield yet.
|
||||
return false;
|
||||
} // The main thread has been blocked for a non-negligible amount of time. We
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function requestPaint() {
|
||||
|
||||
}
|
||||
|
||||
const performWorkUntilDeadline = () => {
|
||||
if (isMessageLoopRunning) {
|
||||
const currentTime = getCurrentTime(); // Keep track of the start time so we can measure how long the main thread
|
||||
// has been blocked.
|
||||
|
||||
startTime = currentTime; // If a scheduler task throws, exit the current browser task so the
|
||||
// error can be observed.
|
||||
//
|
||||
// Intentionally not using a try-catch, since that makes some debugging
|
||||
// techniques harder. Instead, if `flushWork` errors, then `hasMoreWork` will
|
||||
// remain true, and we'll continue the work loop.
|
||||
|
||||
let hasMoreWork = true;
|
||||
|
||||
try {
|
||||
hasMoreWork = flushWork(currentTime);
|
||||
} finally {
|
||||
if (hasMoreWork) {
|
||||
// If there's more work, schedule the next message event at the end
|
||||
// of the preceding one.
|
||||
schedulePerformWorkUntilDeadline();
|
||||
} else {
|
||||
isMessageLoopRunning = false;
|
||||
}
|
||||
}
|
||||
} // Yielding to the browser will give it a chance to paint, so we can
|
||||
};
|
||||
|
||||
let schedulePerformWorkUntilDeadline;
|
||||
|
||||
if (typeof localSetImmediate === 'function') {
|
||||
// Node.js and old IE.
|
||||
// There's a few reasons for why we prefer setImmediate.
|
||||
//
|
||||
// Unlike MessageChannel, it doesn't prevent a Node.js process from exiting.
|
||||
// (Even though this is a DOM fork of the Scheduler, you could get here
|
||||
// with a mix of Node.js 15+, which has a MessageChannel, and jsdom.)
|
||||
// https://github.com/facebook/react/issues/20756
|
||||
//
|
||||
// But also, it runs earlier which is the semantic we want.
|
||||
// If other browsers ever implement it, it's better to use it.
|
||||
// Although both of these would be inferior to native scheduling.
|
||||
schedulePerformWorkUntilDeadline = () => {
|
||||
localSetImmediate(performWorkUntilDeadline);
|
||||
};
|
||||
} else if (typeof MessageChannel !== 'undefined') {
|
||||
// DOM and Worker environments.
|
||||
// We prefer MessageChannel because of the 4ms setTimeout clamping.
|
||||
const channel = new MessageChannel();
|
||||
const port = channel.port2;
|
||||
channel.port1.onmessage = performWorkUntilDeadline;
|
||||
|
||||
schedulePerformWorkUntilDeadline = () => {
|
||||
port.postMessage(null);
|
||||
};
|
||||
} else {
|
||||
// We should only fallback here in non-browser environments.
|
||||
schedulePerformWorkUntilDeadline = () => {
|
||||
// $FlowFixMe[not-a-function] nullable value
|
||||
localSetTimeout(performWorkUntilDeadline, 0);
|
||||
};
|
||||
}
|
||||
|
||||
function requestHostCallback() {
|
||||
if (!isMessageLoopRunning) {
|
||||
isMessageLoopRunning = true;
|
||||
schedulePerformWorkUntilDeadline();
|
||||
}
|
||||
}
|
||||
|
||||
function requestHostTimeout(callback, ms) {
|
||||
// $FlowFixMe[not-a-function] nullable value
|
||||
taskTimeoutID = localSetTimeout(() => {
|
||||
callback(getCurrentTime());
|
||||
}, ms);
|
||||
}
|
||||
|
||||
function cancelHostTimeout() {
|
||||
// $FlowFixMe[not-a-function] nullable value
|
||||
localClearTimeout(taskTimeoutID);
|
||||
taskTimeoutID = -1;
|
||||
}
|
||||
|
||||
// https://github.com/facebook/react-native/blob/main/packages/react-native/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerBinding.cpp
|
||||
|
||||
const unstable_UserBlockingPriority = typeof nativeRuntimeScheduler !== 'undefined' ? nativeRuntimeScheduler.unstable_UserBlockingPriority : UserBlockingPriority;
|
||||
const unstable_NormalPriority = typeof nativeRuntimeScheduler !== 'undefined' ? nativeRuntimeScheduler.unstable_NormalPriority : NormalPriority;
|
||||
const unstable_IdlePriority = typeof nativeRuntimeScheduler !== 'undefined' ? nativeRuntimeScheduler.unstable_IdlePriority : IdlePriority;
|
||||
const unstable_LowPriority = typeof nativeRuntimeScheduler !== 'undefined' ? nativeRuntimeScheduler.unstable_LowPriority : LowPriority;
|
||||
const unstable_ImmediatePriority = typeof nativeRuntimeScheduler !== 'undefined' ? nativeRuntimeScheduler.unstable_ImmediatePriority : ImmediatePriority;
|
||||
const unstable_scheduleCallback = typeof nativeRuntimeScheduler !== 'undefined' ? nativeRuntimeScheduler.unstable_scheduleCallback : unstable_scheduleCallback$1;
|
||||
const unstable_cancelCallback = typeof nativeRuntimeScheduler !== 'undefined' ? nativeRuntimeScheduler.unstable_cancelCallback : unstable_cancelCallback$1;
|
||||
const unstable_getCurrentPriorityLevel = typeof nativeRuntimeScheduler !== 'undefined' ? nativeRuntimeScheduler.unstable_getCurrentPriorityLevel : unstable_getCurrentPriorityLevel$1;
|
||||
const unstable_shouldYield = typeof nativeRuntimeScheduler !== 'undefined' ? nativeRuntimeScheduler.unstable_shouldYield : shouldYieldToHost;
|
||||
const unstable_requestPaint = typeof nativeRuntimeScheduler !== 'undefined' ? nativeRuntimeScheduler.unstable_requestPaint : requestPaint;
|
||||
const unstable_now = typeof nativeRuntimeScheduler !== 'undefined' ? nativeRuntimeScheduler.unstable_now : getCurrentTime; // These were never implemented on the native scheduler because React never calls them.
|
||||
// For consistency, let's disable them altogether and make them throw.
|
||||
|
||||
const unstable_next = throwNotImplemented;
|
||||
const unstable_runWithPriority = throwNotImplemented;
|
||||
const unstable_wrapCallback = throwNotImplemented;
|
||||
const unstable_continueExecution = throwNotImplemented;
|
||||
const unstable_pauseExecution = throwNotImplemented;
|
||||
const unstable_getFirstCallbackNode = throwNotImplemented;
|
||||
const unstable_forceFrameRate = throwNotImplemented;
|
||||
const unstable_Profiling = null;
|
||||
|
||||
function throwNotImplemented() {
|
||||
throw Error('Not implemented.');
|
||||
} // Flow magic to verify the exports of this file match the original version.
|
||||
|
||||
exports.unstable_IdlePriority = unstable_IdlePriority;
|
||||
exports.unstable_ImmediatePriority = unstable_ImmediatePriority;
|
||||
exports.unstable_LowPriority = unstable_LowPriority;
|
||||
exports.unstable_NormalPriority = unstable_NormalPriority;
|
||||
exports.unstable_Profiling = unstable_Profiling;
|
||||
exports.unstable_UserBlockingPriority = unstable_UserBlockingPriority;
|
||||
exports.unstable_cancelCallback = unstable_cancelCallback;
|
||||
exports.unstable_continueExecution = unstable_continueExecution;
|
||||
exports.unstable_forceFrameRate = unstable_forceFrameRate;
|
||||
exports.unstable_getCurrentPriorityLevel = unstable_getCurrentPriorityLevel;
|
||||
exports.unstable_getFirstCallbackNode = unstable_getFirstCallbackNode;
|
||||
exports.unstable_next = unstable_next;
|
||||
exports.unstable_now = unstable_now;
|
||||
exports.unstable_pauseExecution = unstable_pauseExecution;
|
||||
exports.unstable_requestPaint = unstable_requestPaint;
|
||||
exports.unstable_runWithPriority = unstable_runWithPriority;
|
||||
exports.unstable_scheduleCallback = unstable_scheduleCallback;
|
||||
exports.unstable_shouldYield = unstable_shouldYield;
|
||||
exports.unstable_wrapCallback = unstable_wrapCallback;
|
||||
22
node_modules/next/dist/compiled/scheduler/cjs/scheduler.native.production.min.js
generated
vendored
Normal file
22
node_modules/next/dist/compiled/scheduler/cjs/scheduler.native.production.min.js
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
React
|
||||
scheduler.native.production.min.js
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
|
||||
This source code is licensed under the MIT license found in the
|
||||
LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
'use strict';function f(a,c){var b=a.length;a.push(c);a:for(;0<b;){var d=b-1>>>1,e=a[d];if(0<g(e,c))a[d]=c,a[b]=e,b=d;else break a}}function h(a){return 0===a.length?null:a[0]}function k(a){if(0===a.length)return null;var c=a[0],b=a.pop();if(b!==c){a[0]=b;a:for(var d=0,e=a.length,x=e>>>1;d<x;){var y=2*(d+1)-1,D=a[y],m=y+1,z=a[m];if(0>g(D,b))m<e&&0>g(z,D)?(a[d]=z,a[m]=b,d=m):(a[d]=D,a[y]=b,d=y);else if(m<e&&0>g(z,b))a[d]=z,a[m]=b,d=m;else break a}}return c}
|
||||
function g(a,c){var b=a.sortIndex-c.sortIndex;return 0!==b?b:a.id-c.id}var l;if("object"===typeof performance&&"function"===typeof performance.now){var n=performance;l=function(){return n.now()}}else{var p=Date,q=p.now();l=function(){return p.now()-q}}var r=[],t=[],u=1,v=null,w=3,A=!1,B=!1,C=!1,E="function"===typeof setTimeout?setTimeout:null,F="function"===typeof clearTimeout?clearTimeout:null,G="undefined"!==typeof setImmediate?setImmediate:null;
|
||||
"undefined"!==typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending?navigator.scheduling.isInputPending.bind(navigator.scheduling):null;function H(a){for(var c=h(t);null!==c;){if(null===c.callback)k(t);else if(c.startTime<=a)k(t),c.sortIndex=c.expirationTime,f(r,c);else break;c=h(t)}}function I(a){C=!1;H(a);if(!B)if(null!==h(r))B=!0,J||(J=!0,K());else{var c=h(t);null!==c&&L(I,c.startTime-a)}}
|
||||
function M(a,c,b){var d=l();"object"===typeof b&&null!==b?(b=b.delay,b="number"===typeof b&&0<b?d+b:d):b=d;switch(a){case 1:var e=-1;break;case 2:e=250;break;case 5:e=1073741823;break;case 4:e=1E4;break;default:e=5E3}e=b+e;a={id:u++,callback:c,priorityLevel:a,startTime:b,expirationTime:e,sortIndex:-1};b>d?(a.sortIndex=b,f(t,a),null===h(r)&&a===h(t)&&(C?(F(N),N=-1):C=!0,L(I,b-d))):(a.sortIndex=e,f(r,a),B||A||(B=!0,J||(J=!0,K())));return a}function O(a){a.callback=null}function P(){return w}
|
||||
var J=!1,N=-1,Q=-1;function R(){return 5>l()-Q?!1:!0}function S(){}
|
||||
function T(){if(J){var a=l();Q=a;var c=!0;try{a:{B=!1;C&&(C=!1,F(N),N=-1);A=!0;var b=w;try{b:{H(a);for(v=h(r);null!==v&&!(v.expirationTime>a&&R());){var d=v.callback;if("function"===typeof d){v.callback=null;w=v.priorityLevel;var e=d(v.expirationTime<=a);a=l();if("function"===typeof e){v.callback=e;H(a);c=!0;break b}v===h(r)&&k(r);H(a)}else k(r);v=h(r)}if(null!==v)c=!0;else{var x=h(t);null!==x&&L(I,x.startTime-a);c=!1}}break a}finally{v=null,w=b,A=!1}c=void 0}}finally{c?K():J=!1}}}var K;
|
||||
if("function"===typeof G)K=function(){G(T)};else if("undefined"!==typeof MessageChannel){var U=new MessageChannel,V=U.port2;U.port1.onmessage=T;K=function(){V.postMessage(null)}}else K=function(){E(T,0)};function L(a,c){N=E(function(){a(l())},c)}
|
||||
var W="undefined"!==typeof nativeRuntimeScheduler?nativeRuntimeScheduler.unstable_UserBlockingPriority:2,X="undefined"!==typeof nativeRuntimeScheduler?nativeRuntimeScheduler.unstable_NormalPriority:3,Y="undefined"!==typeof nativeRuntimeScheduler?nativeRuntimeScheduler.unstable_LowPriority:4,aa="undefined"!==typeof nativeRuntimeScheduler?nativeRuntimeScheduler.unstable_ImmediatePriority:1,ba="undefined"!==typeof nativeRuntimeScheduler?nativeRuntimeScheduler.unstable_scheduleCallback:M,ca="undefined"!==
|
||||
typeof nativeRuntimeScheduler?nativeRuntimeScheduler.unstable_cancelCallback:O,da="undefined"!==typeof nativeRuntimeScheduler?nativeRuntimeScheduler.unstable_getCurrentPriorityLevel:P,ea="undefined"!==typeof nativeRuntimeScheduler?nativeRuntimeScheduler.unstable_shouldYield:R,fa="undefined"!==typeof nativeRuntimeScheduler?nativeRuntimeScheduler.unstable_requestPaint:S,ha="undefined"!==typeof nativeRuntimeScheduler?nativeRuntimeScheduler.unstable_now:l;
|
||||
function Z(){throw Error("Not implemented.");}exports.unstable_IdlePriority="undefined"!==typeof nativeRuntimeScheduler?nativeRuntimeScheduler.unstable_IdlePriority:5;exports.unstable_ImmediatePriority=aa;exports.unstable_LowPriority=Y;exports.unstable_NormalPriority=X;exports.unstable_Profiling=null;exports.unstable_UserBlockingPriority=W;exports.unstable_cancelCallback=ca;exports.unstable_continueExecution=Z;exports.unstable_forceFrameRate=Z;exports.unstable_getCurrentPriorityLevel=da;
|
||||
exports.unstable_getFirstCallbackNode=Z;exports.unstable_next=Z;exports.unstable_now=ha;exports.unstable_pauseExecution=Z;exports.unstable_requestPaint=fa;exports.unstable_runWithPriority=Z;exports.unstable_scheduleCallback=ba;exports.unstable_shouldYield=ea;exports.unstable_wrapCallback=Z;
|
||||
|
||||
//# sourceMappingURL=scheduler.native.production.min.js.map
|
||||
603
node_modules/next/dist/compiled/scheduler/cjs/scheduler.production.js
generated
vendored
Normal file
603
node_modules/next/dist/compiled/scheduler/cjs/scheduler.production.js
generated
vendored
Normal file
@ -0,0 +1,603 @@
|
||||
/**
|
||||
* @license React
|
||||
* scheduler.production.min.js
|
||||
*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const enableSchedulerDebugging = false;
|
||||
const enableProfiling = false;
|
||||
const frameYieldMs = 5;
|
||||
const userBlockingPriorityTimeout = 250;
|
||||
const normalPriorityTimeout = 5000;
|
||||
const lowPriorityTimeout = 10000;
|
||||
|
||||
function push(heap, node) {
|
||||
const index = heap.length;
|
||||
heap.push(node);
|
||||
siftUp(heap, node, index);
|
||||
}
|
||||
function peek(heap) {
|
||||
return heap.length === 0 ? null : heap[0];
|
||||
}
|
||||
function pop(heap) {
|
||||
if (heap.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const first = heap[0];
|
||||
const last = heap.pop();
|
||||
|
||||
if (last !== first) {
|
||||
heap[0] = last;
|
||||
siftDown(heap, last, 0);
|
||||
}
|
||||
|
||||
return first;
|
||||
}
|
||||
|
||||
function siftUp(heap, node, i) {
|
||||
let index = i;
|
||||
|
||||
while (index > 0) {
|
||||
const parentIndex = index - 1 >>> 1;
|
||||
const parent = heap[parentIndex];
|
||||
|
||||
if (compare(parent, node) > 0) {
|
||||
// The parent is larger. Swap positions.
|
||||
heap[parentIndex] = node;
|
||||
heap[index] = parent;
|
||||
index = parentIndex;
|
||||
} else {
|
||||
// The parent is smaller. Exit.
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function siftDown(heap, node, i) {
|
||||
let index = i;
|
||||
const length = heap.length;
|
||||
const halfLength = length >>> 1;
|
||||
|
||||
while (index < halfLength) {
|
||||
const leftIndex = (index + 1) * 2 - 1;
|
||||
const left = heap[leftIndex];
|
||||
const rightIndex = leftIndex + 1;
|
||||
const right = heap[rightIndex]; // If the left or right node is smaller, swap with the smaller of those.
|
||||
|
||||
if (compare(left, node) < 0) {
|
||||
if (rightIndex < length && compare(right, left) < 0) {
|
||||
heap[index] = right;
|
||||
heap[rightIndex] = node;
|
||||
index = rightIndex;
|
||||
} else {
|
||||
heap[index] = left;
|
||||
heap[leftIndex] = node;
|
||||
index = leftIndex;
|
||||
}
|
||||
} else if (rightIndex < length && compare(right, node) < 0) {
|
||||
heap[index] = right;
|
||||
heap[rightIndex] = node;
|
||||
index = rightIndex;
|
||||
} else {
|
||||
// Neither child is smaller. Exit.
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function compare(a, b) {
|
||||
// Compare sort index first, then task id.
|
||||
const diff = a.sortIndex - b.sortIndex;
|
||||
return diff !== 0 ? diff : a.id - b.id;
|
||||
}
|
||||
|
||||
// TODO: Use symbols?
|
||||
const ImmediatePriority = 1;
|
||||
const UserBlockingPriority = 2;
|
||||
const NormalPriority = 3;
|
||||
const LowPriority = 4;
|
||||
const IdlePriority = 5;
|
||||
|
||||
function markTaskErrored(task, ms) {
|
||||
}
|
||||
|
||||
/* eslint-disable no-var */
|
||||
exports.unstable_now = void 0;
|
||||
const hasPerformanceNow = // $FlowFixMe[method-unbinding]
|
||||
typeof performance === 'object' && typeof performance.now === 'function';
|
||||
|
||||
if (hasPerformanceNow) {
|
||||
const localPerformance = performance;
|
||||
|
||||
exports.unstable_now = () => localPerformance.now();
|
||||
} else {
|
||||
const localDate = Date;
|
||||
const initialTime = localDate.now();
|
||||
|
||||
exports.unstable_now = () => localDate.now() - initialTime;
|
||||
} // Max 31 bit integer. The max integer size in V8 for 32-bit systems.
|
||||
// Math.pow(2, 30) - 1
|
||||
// 0b111111111111111111111111111111
|
||||
|
||||
|
||||
var maxSigned31BitInt = 1073741823; // Tasks are stored on a min heap
|
||||
|
||||
var taskQueue = [];
|
||||
var timerQueue = []; // Incrementing id counter. Used to maintain insertion order.
|
||||
|
||||
var taskIdCounter = 1; // Pausing the scheduler is useful for debugging.
|
||||
var currentTask = null;
|
||||
var currentPriorityLevel = NormalPriority; // This is set while performing work, to prevent re-entrance.
|
||||
|
||||
var isPerformingWork = false;
|
||||
var isHostCallbackScheduled = false;
|
||||
var isHostTimeoutScheduled = false; // Capture local references to native APIs, in case a polyfill overrides them.
|
||||
|
||||
const localSetTimeout = typeof setTimeout === 'function' ? setTimeout : null;
|
||||
const localClearTimeout = typeof clearTimeout === 'function' ? clearTimeout : null;
|
||||
const localSetImmediate = typeof setImmediate !== 'undefined' ? setImmediate : null; // IE and Node.js + jsdom
|
||||
|
||||
typeof navigator !== 'undefined' && // $FlowFixMe[prop-missing]
|
||||
navigator.scheduling !== undefined && // $FlowFixMe[incompatible-type]
|
||||
navigator.scheduling.isInputPending !== undefined ? navigator.scheduling.isInputPending.bind(navigator.scheduling) : null;
|
||||
|
||||
function advanceTimers(currentTime) {
|
||||
// Check for tasks that are no longer delayed and add them to the queue.
|
||||
let timer = peek(timerQueue);
|
||||
|
||||
while (timer !== null) {
|
||||
if (timer.callback === null) {
|
||||
// Timer was cancelled.
|
||||
pop(timerQueue);
|
||||
} else if (timer.startTime <= currentTime) {
|
||||
// Timer fired. Transfer to the task queue.
|
||||
pop(timerQueue);
|
||||
timer.sortIndex = timer.expirationTime;
|
||||
push(taskQueue, timer);
|
||||
} else {
|
||||
// Remaining timers are pending.
|
||||
return;
|
||||
}
|
||||
|
||||
timer = peek(timerQueue);
|
||||
}
|
||||
}
|
||||
|
||||
function handleTimeout(currentTime) {
|
||||
isHostTimeoutScheduled = false;
|
||||
advanceTimers(currentTime);
|
||||
|
||||
if (!isHostCallbackScheduled) {
|
||||
if (peek(taskQueue) !== null) {
|
||||
isHostCallbackScheduled = true;
|
||||
requestHostCallback();
|
||||
} else {
|
||||
const firstTimer = peek(timerQueue);
|
||||
|
||||
if (firstTimer !== null) {
|
||||
requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function flushWork(initialTime) {
|
||||
|
||||
|
||||
isHostCallbackScheduled = false;
|
||||
|
||||
if (isHostTimeoutScheduled) {
|
||||
// We scheduled a timeout but it's no longer needed. Cancel it.
|
||||
isHostTimeoutScheduled = false;
|
||||
cancelHostTimeout();
|
||||
}
|
||||
|
||||
isPerformingWork = true;
|
||||
const previousPriorityLevel = currentPriorityLevel;
|
||||
|
||||
try {
|
||||
if (enableProfiling) ; else {
|
||||
// No catch in prod code path.
|
||||
return workLoop(initialTime);
|
||||
}
|
||||
} finally {
|
||||
currentTask = null;
|
||||
currentPriorityLevel = previousPriorityLevel;
|
||||
isPerformingWork = false;
|
||||
}
|
||||
}
|
||||
|
||||
function workLoop(initialTime) {
|
||||
let currentTime = initialTime;
|
||||
advanceTimers(currentTime);
|
||||
currentTask = peek(taskQueue);
|
||||
|
||||
while (currentTask !== null && !(enableSchedulerDebugging )) {
|
||||
if (currentTask.expirationTime > currentTime && shouldYieldToHost()) {
|
||||
// This currentTask hasn't expired, and we've reached the deadline.
|
||||
break;
|
||||
} // $FlowFixMe[incompatible-use] found when upgrading Flow
|
||||
|
||||
|
||||
const callback = currentTask.callback;
|
||||
|
||||
if (typeof callback === 'function') {
|
||||
// $FlowFixMe[incompatible-use] found when upgrading Flow
|
||||
currentTask.callback = null; // $FlowFixMe[incompatible-use] found when upgrading Flow
|
||||
|
||||
currentPriorityLevel = currentTask.priorityLevel; // $FlowFixMe[incompatible-use] found when upgrading Flow
|
||||
|
||||
const didUserCallbackTimeout = currentTask.expirationTime <= currentTime;
|
||||
|
||||
const continuationCallback = callback(didUserCallbackTimeout);
|
||||
currentTime = exports.unstable_now();
|
||||
|
||||
if (typeof continuationCallback === 'function') {
|
||||
// If a continuation is returned, immediately yield to the main thread
|
||||
// regardless of how much time is left in the current time slice.
|
||||
// $FlowFixMe[incompatible-use] found when upgrading Flow
|
||||
currentTask.callback = continuationCallback;
|
||||
|
||||
advanceTimers(currentTime);
|
||||
return true;
|
||||
} else {
|
||||
|
||||
if (currentTask === peek(taskQueue)) {
|
||||
pop(taskQueue);
|
||||
}
|
||||
|
||||
advanceTimers(currentTime);
|
||||
}
|
||||
} else {
|
||||
pop(taskQueue);
|
||||
}
|
||||
|
||||
currentTask = peek(taskQueue);
|
||||
} // Return whether there's additional work
|
||||
|
||||
|
||||
if (currentTask !== null) {
|
||||
return true;
|
||||
} else {
|
||||
const firstTimer = peek(timerQueue);
|
||||
|
||||
if (firstTimer !== null) {
|
||||
requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function unstable_runWithPriority(priorityLevel, eventHandler) {
|
||||
switch (priorityLevel) {
|
||||
case ImmediatePriority:
|
||||
case UserBlockingPriority:
|
||||
case NormalPriority:
|
||||
case LowPriority:
|
||||
case IdlePriority:
|
||||
break;
|
||||
|
||||
default:
|
||||
priorityLevel = NormalPriority;
|
||||
}
|
||||
|
||||
var previousPriorityLevel = currentPriorityLevel;
|
||||
currentPriorityLevel = priorityLevel;
|
||||
|
||||
try {
|
||||
return eventHandler();
|
||||
} finally {
|
||||
currentPriorityLevel = previousPriorityLevel;
|
||||
}
|
||||
}
|
||||
|
||||
function unstable_next(eventHandler) {
|
||||
var priorityLevel;
|
||||
|
||||
switch (currentPriorityLevel) {
|
||||
case ImmediatePriority:
|
||||
case UserBlockingPriority:
|
||||
case NormalPriority:
|
||||
// Shift down to normal priority
|
||||
priorityLevel = NormalPriority;
|
||||
break;
|
||||
|
||||
default:
|
||||
// Anything lower than normal priority should remain at the current level.
|
||||
priorityLevel = currentPriorityLevel;
|
||||
break;
|
||||
}
|
||||
|
||||
var previousPriorityLevel = currentPriorityLevel;
|
||||
currentPriorityLevel = priorityLevel;
|
||||
|
||||
try {
|
||||
return eventHandler();
|
||||
} finally {
|
||||
currentPriorityLevel = previousPriorityLevel;
|
||||
}
|
||||
}
|
||||
|
||||
function unstable_wrapCallback(callback) {
|
||||
var parentPriorityLevel = currentPriorityLevel; // $FlowFixMe[incompatible-return]
|
||||
// $FlowFixMe[missing-this-annot]
|
||||
|
||||
return function () {
|
||||
// This is a fork of runWithPriority, inlined for performance.
|
||||
var previousPriorityLevel = currentPriorityLevel;
|
||||
currentPriorityLevel = parentPriorityLevel;
|
||||
|
||||
try {
|
||||
return callback.apply(this, arguments);
|
||||
} finally {
|
||||
currentPriorityLevel = previousPriorityLevel;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function unstable_scheduleCallback(priorityLevel, callback, options) {
|
||||
var currentTime = exports.unstable_now();
|
||||
var startTime;
|
||||
|
||||
if (typeof options === 'object' && options !== null) {
|
||||
var delay = options.delay;
|
||||
|
||||
if (typeof delay === 'number' && delay > 0) {
|
||||
startTime = currentTime + delay;
|
||||
} else {
|
||||
startTime = currentTime;
|
||||
}
|
||||
} else {
|
||||
startTime = currentTime;
|
||||
}
|
||||
|
||||
var timeout;
|
||||
|
||||
switch (priorityLevel) {
|
||||
case ImmediatePriority:
|
||||
// Times out immediately
|
||||
timeout = -1;
|
||||
break;
|
||||
|
||||
case UserBlockingPriority:
|
||||
// Eventually times out
|
||||
timeout = userBlockingPriorityTimeout;
|
||||
break;
|
||||
|
||||
case IdlePriority:
|
||||
// Never times out
|
||||
timeout = maxSigned31BitInt;
|
||||
break;
|
||||
|
||||
case LowPriority:
|
||||
// Eventually times out
|
||||
timeout = lowPriorityTimeout;
|
||||
break;
|
||||
|
||||
case NormalPriority:
|
||||
default:
|
||||
// Eventually times out
|
||||
timeout = normalPriorityTimeout;
|
||||
break;
|
||||
}
|
||||
|
||||
var expirationTime = startTime + timeout;
|
||||
var newTask = {
|
||||
id: taskIdCounter++,
|
||||
callback,
|
||||
priorityLevel,
|
||||
startTime,
|
||||
expirationTime,
|
||||
sortIndex: -1
|
||||
};
|
||||
|
||||
if (startTime > currentTime) {
|
||||
// This is a delayed task.
|
||||
newTask.sortIndex = startTime;
|
||||
push(timerQueue, newTask);
|
||||
|
||||
if (peek(taskQueue) === null && newTask === peek(timerQueue)) {
|
||||
// All tasks are delayed, and this is the task with the earliest delay.
|
||||
if (isHostTimeoutScheduled) {
|
||||
// Cancel an existing timeout.
|
||||
cancelHostTimeout();
|
||||
} else {
|
||||
isHostTimeoutScheduled = true;
|
||||
} // Schedule a timeout.
|
||||
|
||||
|
||||
requestHostTimeout(handleTimeout, startTime - currentTime);
|
||||
}
|
||||
} else {
|
||||
newTask.sortIndex = expirationTime;
|
||||
push(taskQueue, newTask);
|
||||
// wait until the next time we yield.
|
||||
|
||||
|
||||
if (!isHostCallbackScheduled && !isPerformingWork) {
|
||||
isHostCallbackScheduled = true;
|
||||
requestHostCallback();
|
||||
}
|
||||
}
|
||||
|
||||
return newTask;
|
||||
}
|
||||
|
||||
function unstable_pauseExecution() {
|
||||
}
|
||||
|
||||
function unstable_continueExecution() {
|
||||
|
||||
if (!isHostCallbackScheduled && !isPerformingWork) {
|
||||
isHostCallbackScheduled = true;
|
||||
requestHostCallback();
|
||||
}
|
||||
}
|
||||
|
||||
function unstable_getFirstCallbackNode() {
|
||||
return peek(taskQueue);
|
||||
}
|
||||
|
||||
function unstable_cancelCallback(task) {
|
||||
// remove from the queue because you can't remove arbitrary nodes from an
|
||||
// array based heap, only the first one.)
|
||||
|
||||
|
||||
task.callback = null;
|
||||
}
|
||||
|
||||
function unstable_getCurrentPriorityLevel() {
|
||||
return currentPriorityLevel;
|
||||
}
|
||||
|
||||
let isMessageLoopRunning = false;
|
||||
let taskTimeoutID = -1; // Scheduler periodically yields in case there is other work on the main
|
||||
// thread, like user events. By default, it yields multiple times per frame.
|
||||
// It does not attempt to align with frame boundaries, since most tasks don't
|
||||
// need to be frame aligned; for those that do, use requestAnimationFrame.
|
||||
|
||||
let frameInterval = frameYieldMs;
|
||||
let startTime = -1;
|
||||
|
||||
function shouldYieldToHost() {
|
||||
const timeElapsed = exports.unstable_now() - startTime;
|
||||
|
||||
if (timeElapsed < frameInterval) {
|
||||
// The main thread has only been blocked for a really short amount of time;
|
||||
// smaller than a single frame. Don't yield yet.
|
||||
return false;
|
||||
} // The main thread has been blocked for a non-negligible amount of time. We
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function requestPaint() {
|
||||
|
||||
}
|
||||
|
||||
function forceFrameRate(fps) {
|
||||
if (fps < 0 || fps > 125) {
|
||||
// Using console['error'] to evade Babel and ESLint
|
||||
console['error']('forceFrameRate takes a positive int between 0 and 125, ' + 'forcing frame rates higher than 125 fps is not supported');
|
||||
return;
|
||||
}
|
||||
|
||||
if (fps > 0) {
|
||||
frameInterval = Math.floor(1000 / fps);
|
||||
} else {
|
||||
// reset the framerate
|
||||
frameInterval = frameYieldMs;
|
||||
}
|
||||
}
|
||||
|
||||
const performWorkUntilDeadline = () => {
|
||||
if (isMessageLoopRunning) {
|
||||
const currentTime = exports.unstable_now(); // Keep track of the start time so we can measure how long the main thread
|
||||
// has been blocked.
|
||||
|
||||
startTime = currentTime; // If a scheduler task throws, exit the current browser task so the
|
||||
// error can be observed.
|
||||
//
|
||||
// Intentionally not using a try-catch, since that makes some debugging
|
||||
// techniques harder. Instead, if `flushWork` errors, then `hasMoreWork` will
|
||||
// remain true, and we'll continue the work loop.
|
||||
|
||||
let hasMoreWork = true;
|
||||
|
||||
try {
|
||||
hasMoreWork = flushWork(currentTime);
|
||||
} finally {
|
||||
if (hasMoreWork) {
|
||||
// If there's more work, schedule the next message event at the end
|
||||
// of the preceding one.
|
||||
schedulePerformWorkUntilDeadline();
|
||||
} else {
|
||||
isMessageLoopRunning = false;
|
||||
}
|
||||
}
|
||||
} // Yielding to the browser will give it a chance to paint, so we can
|
||||
};
|
||||
|
||||
let schedulePerformWorkUntilDeadline;
|
||||
|
||||
if (typeof localSetImmediate === 'function') {
|
||||
// Node.js and old IE.
|
||||
// There's a few reasons for why we prefer setImmediate.
|
||||
//
|
||||
// Unlike MessageChannel, it doesn't prevent a Node.js process from exiting.
|
||||
// (Even though this is a DOM fork of the Scheduler, you could get here
|
||||
// with a mix of Node.js 15+, which has a MessageChannel, and jsdom.)
|
||||
// https://github.com/facebook/react/issues/20756
|
||||
//
|
||||
// But also, it runs earlier which is the semantic we want.
|
||||
// If other browsers ever implement it, it's better to use it.
|
||||
// Although both of these would be inferior to native scheduling.
|
||||
schedulePerformWorkUntilDeadline = () => {
|
||||
localSetImmediate(performWorkUntilDeadline);
|
||||
};
|
||||
} else if (typeof MessageChannel !== 'undefined') {
|
||||
// DOM and Worker environments.
|
||||
// We prefer MessageChannel because of the 4ms setTimeout clamping.
|
||||
const channel = new MessageChannel();
|
||||
const port = channel.port2;
|
||||
channel.port1.onmessage = performWorkUntilDeadline;
|
||||
|
||||
schedulePerformWorkUntilDeadline = () => {
|
||||
port.postMessage(null);
|
||||
};
|
||||
} else {
|
||||
// We should only fallback here in non-browser environments.
|
||||
schedulePerformWorkUntilDeadline = () => {
|
||||
// $FlowFixMe[not-a-function] nullable value
|
||||
localSetTimeout(performWorkUntilDeadline, 0);
|
||||
};
|
||||
}
|
||||
|
||||
function requestHostCallback() {
|
||||
if (!isMessageLoopRunning) {
|
||||
isMessageLoopRunning = true;
|
||||
schedulePerformWorkUntilDeadline();
|
||||
}
|
||||
}
|
||||
|
||||
function requestHostTimeout(callback, ms) {
|
||||
// $FlowFixMe[not-a-function] nullable value
|
||||
taskTimeoutID = localSetTimeout(() => {
|
||||
callback(exports.unstable_now());
|
||||
}, ms);
|
||||
}
|
||||
|
||||
function cancelHostTimeout() {
|
||||
// $FlowFixMe[not-a-function] nullable value
|
||||
localClearTimeout(taskTimeoutID);
|
||||
taskTimeoutID = -1;
|
||||
}
|
||||
const unstable_Profiling = null;
|
||||
|
||||
exports.unstable_IdlePriority = IdlePriority;
|
||||
exports.unstable_ImmediatePriority = ImmediatePriority;
|
||||
exports.unstable_LowPriority = LowPriority;
|
||||
exports.unstable_NormalPriority = NormalPriority;
|
||||
exports.unstable_Profiling = unstable_Profiling;
|
||||
exports.unstable_UserBlockingPriority = UserBlockingPriority;
|
||||
exports.unstable_cancelCallback = unstable_cancelCallback;
|
||||
exports.unstable_continueExecution = unstable_continueExecution;
|
||||
exports.unstable_forceFrameRate = forceFrameRate;
|
||||
exports.unstable_getCurrentPriorityLevel = unstable_getCurrentPriorityLevel;
|
||||
exports.unstable_getFirstCallbackNode = unstable_getFirstCallbackNode;
|
||||
exports.unstable_next = unstable_next;
|
||||
exports.unstable_pauseExecution = unstable_pauseExecution;
|
||||
exports.unstable_requestPaint = requestPaint;
|
||||
exports.unstable_runWithPriority = unstable_runWithPriority;
|
||||
exports.unstable_scheduleCallback = unstable_scheduleCallback;
|
||||
exports.unstable_shouldYield = shouldYieldToHost;
|
||||
exports.unstable_wrapCallback = unstable_wrapCallback;
|
||||
21
node_modules/next/dist/compiled/scheduler/cjs/scheduler.production.min.js
generated
vendored
Normal file
21
node_modules/next/dist/compiled/scheduler/cjs/scheduler.production.min.js
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
/*
|
||||
React
|
||||
scheduler.production.min.js
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
|
||||
This source code is licensed under the MIT license found in the
|
||||
LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
'use strict';function f(a,c){var b=a.length;a.push(c);a:for(;0<b;){var d=b-1>>>1,e=a[d];if(0<g(e,c))a[d]=c,a[b]=e,b=d;else break a}}function h(a){return 0===a.length?null:a[0]}function k(a){if(0===a.length)return null;var c=a[0],b=a.pop();if(b!==c){a[0]=b;a:for(var d=0,e=a.length,v=e>>>1;d<v;){var w=2*(d+1)-1,C=a[w],m=w+1,x=a[m];if(0>g(C,b))m<e&&0>g(x,C)?(a[d]=x,a[m]=b,d=m):(a[d]=C,a[w]=b,d=w);else if(m<e&&0>g(x,b))a[d]=x,a[m]=b,d=m;else break a}}return c}
|
||||
function g(a,c){var b=a.sortIndex-c.sortIndex;return 0!==b?b:a.id-c.id}exports.unstable_now=void 0;if("object"===typeof performance&&"function"===typeof performance.now){var l=performance;exports.unstable_now=function(){return l.now()}}else{var n=Date,p=n.now();exports.unstable_now=function(){return n.now()-p}}
|
||||
var q=[],r=[],t=1,u=null,y=3,z=!1,A=!1,B=!1,D="function"===typeof setTimeout?setTimeout:null,E="function"===typeof clearTimeout?clearTimeout:null,F="undefined"!==typeof setImmediate?setImmediate:null;"undefined"!==typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending?navigator.scheduling.isInputPending.bind(navigator.scheduling):null;
|
||||
function G(a){for(var c=h(r);null!==c;){if(null===c.callback)k(r);else if(c.startTime<=a)k(r),c.sortIndex=c.expirationTime,f(q,c);else break;c=h(r)}}function H(a){B=!1;G(a);if(!A)if(null!==h(q))A=!0,I();else{var c=h(r);null!==c&&J(H,c.startTime-a)}}var K=!1,L=-1,M=5,N=-1;function O(){return exports.unstable_now()-N<M?!1:!0}
|
||||
function P(){if(K){var a=exports.unstable_now();N=a;var c=!0;try{a:{A=!1;B&&(B=!1,E(L),L=-1);z=!0;var b=y;try{b:{G(a);for(u=h(q);null!==u&&!(u.expirationTime>a&&O());){var d=u.callback;if("function"===typeof d){u.callback=null;y=u.priorityLevel;var e=d(u.expirationTime<=a);a=exports.unstable_now();if("function"===typeof e){u.callback=e;G(a);c=!0;break b}u===h(q)&&k(q);G(a)}else k(q);u=h(q)}if(null!==u)c=!0;else{var v=h(r);null!==v&&J(H,v.startTime-a);c=!1}}break a}finally{u=null,y=b,z=!1}c=void 0}}finally{c?
|
||||
Q():K=!1}}}var Q;if("function"===typeof F)Q=function(){F(P)};else if("undefined"!==typeof MessageChannel){var R=new MessageChannel,S=R.port2;R.port1.onmessage=P;Q=function(){S.postMessage(null)}}else Q=function(){D(P,0)};function I(){K||(K=!0,Q())}function J(a,c){L=D(function(){a(exports.unstable_now())},c)}exports.unstable_IdlePriority=5;exports.unstable_ImmediatePriority=1;exports.unstable_LowPriority=4;exports.unstable_NormalPriority=3;exports.unstable_Profiling=null;
|
||||
exports.unstable_UserBlockingPriority=2;exports.unstable_cancelCallback=function(a){a.callback=null};exports.unstable_continueExecution=function(){A||z||(A=!0,I())};exports.unstable_forceFrameRate=function(a){0>a||125<a?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<a?Math.floor(1E3/a):5};exports.unstable_getCurrentPriorityLevel=function(){return y};exports.unstable_getFirstCallbackNode=function(){return h(q)};
|
||||
exports.unstable_next=function(a){switch(y){case 1:case 2:case 3:var c=3;break;default:c=y}var b=y;y=c;try{return a()}finally{y=b}};exports.unstable_pauseExecution=function(){};exports.unstable_requestPaint=function(){};exports.unstable_runWithPriority=function(a,c){switch(a){case 1:case 2:case 3:case 4:case 5:break;default:a=3}var b=y;y=a;try{return c()}finally{y=b}};
|
||||
exports.unstable_scheduleCallback=function(a,c,b){var d=exports.unstable_now();"object"===typeof b&&null!==b?(b=b.delay,b="number"===typeof b&&0<b?d+b:d):b=d;switch(a){case 1:var e=-1;break;case 2:e=250;break;case 5:e=1073741823;break;case 4:e=1E4;break;default:e=5E3}e=b+e;a={id:t++,callback:c,priorityLevel:a,startTime:b,expirationTime:e,sortIndex:-1};b>d?(a.sortIndex=b,f(r,a),null===h(q)&&a===h(r)&&(B?(E(L),L=-1):B=!0,J(H,b-d))):(a.sortIndex=e,f(q,a),A||z||(A=!0,I()));return a};
|
||||
exports.unstable_shouldYield=O;exports.unstable_wrapCallback=function(a){var c=y;return function(){var b=y;y=c;try{return a.apply(this,arguments)}finally{y=b}}};
|
||||
|
||||
//# sourceMappingURL=scheduler.production.min.js.map
|
||||
7
node_modules/next/dist/compiled/scheduler/index.js
generated
vendored
Normal file
7
node_modules/next/dist/compiled/scheduler/index.js
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
module.exports = require('./cjs/scheduler.production.min.js');
|
||||
} else {
|
||||
module.exports = require('./cjs/scheduler.development.js');
|
||||
}
|
||||
7
node_modules/next/dist/compiled/scheduler/index.native.js
generated
vendored
Normal file
7
node_modules/next/dist/compiled/scheduler/index.native.js
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
module.exports = require('./cjs/scheduler.native.production.min.js');
|
||||
} else {
|
||||
module.exports = require('./cjs/scheduler.native.development.js');
|
||||
}
|
||||
6
node_modules/next/dist/compiled/scheduler/package.json
generated
vendored
Normal file
6
node_modules/next/dist/compiled/scheduler/package.json
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "scheduler-builtin",
|
||||
"dependencies": {
|
||||
"loose-envify": "^1.1.0"
|
||||
}
|
||||
}
|
||||
7
node_modules/next/dist/compiled/scheduler/unstable_mock.js
generated
vendored
Normal file
7
node_modules/next/dist/compiled/scheduler/unstable_mock.js
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
module.exports = require('./cjs/scheduler-unstable_mock.production.min.js');
|
||||
} else {
|
||||
module.exports = require('./cjs/scheduler-unstable_mock.development.js');
|
||||
}
|
||||
7
node_modules/next/dist/compiled/scheduler/unstable_post_task.js
generated
vendored
Normal file
7
node_modules/next/dist/compiled/scheduler/unstable_post_task.js
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
module.exports = require('./cjs/scheduler-unstable_post_task.production.min.js');
|
||||
} else {
|
||||
module.exports = require('./cjs/scheduler-unstable_post_task.development.js');
|
||||
}
|
||||
Reference in New Issue
Block a user